From: support Date: Mon, 24 Oct 2022 16:24:56 +0000 (+0000) Subject: Built motion from commit 1fd437e9.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=5a0630adbe3a87a3233169bdb98dc4a5ee53740c;p=motion2.git Built motion from commit 1fd437e9.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 2b19929..b90dd24 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-24T15:51:17.883Z", + "time": "2022-10-24T16:17:15.617Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0634d8c..18ef972 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-24T15:51:17.883Z", + "time": "2022-10-24T16:17:15.617Z", "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 755341d..c4d3a3b 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 _0x2e63=['VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[headers],\x20browser[wsindowHeight]','exports'];(function(_0x2d1167,_0xce40cf){var _0x52ed8a=function(_0x3c4a83){while(--_0x3c4a83){_0x2d1167['push'](_0x2d1167['shift']());}};_0x52ed8a(++_0xce40cf);}(_0x2e63,0x6f));var _0x32e6=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x2e63[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require('sequelize');module[_0x32e6('0x0')]={'name':{'type':Sequelize[_0x32e6('0x1')],'get':function(_0x489a4f){return this[_0x32e6('0x2')](_0x32e6('0x3'));}},'action':{'type':Sequelize[_0x32e6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x32e6('0x5'),'integration',_0x32e6('0x6'),_0x32e6('0x7'),_0x32e6('0x8'),_0x32e6('0x9'),_0x32e6('0xa'),_0x32e6('0xb')]],'msg':_0x32e6('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x32e6('0x4')](0x1000),'comment':_0x32e6('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x32e6('0x4')](0x1000),'comment':_0x32e6('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x32e6('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x32e6('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xc360=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','VIRTUAL','getDataValue','action','contactManager','integration','jscripty','urlForward','browser','script'];(function(_0x2b1e99,_0xcb3464){var _0x99721b=function(_0x242133){while(--_0x242133){_0x2b1e99['push'](_0x2b1e99['shift']());}};_0x99721b(++_0xcb3464);}(_0xc360,0x15f));var _0x0c36=function(_0x2b24d0,_0x49b3d7){_0x2b24d0=_0x2b24d0-0x0;var _0x1a2482=_0xc360[_0x2b24d0];return _0x1a2482;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c36('0x0')],'get':function(_0x1d1cff){return this[_0x0c36('0x1')](_0x0c36('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x0c36('0x3'),_0x0c36('0x4'),'motionbar',_0x0c36('0x5'),_0x0c36('0x6'),_0x0c36('0x7'),'bot',_0x0c36('0x8')]],'msg':_0x0c36('0x9')}},'comment':_0x0c36('0x9')},'data1':{'type':Sequelize[_0x0c36('0xa')](0x1000),'comment':_0x0c36('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x0c36('0xc')},'data3':{'type':Sequelize[_0x0c36('0xa')](0x1000),'comment':_0x0c36('0xd')},'data4':{'type':Sequelize[_0x0c36('0xa')](0x1000),'comments':_0x0c36('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x0c36('0xf')},'data6':{'type':Sequelize[_0x0c36('0xa')],'comments':_0x0c36('0x10')},'data7':{'type':Sequelize['TEXT'],'comments':_0x0c36('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 439c93a..9de1314 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 _0x0f9d=['Action','find','params','catch','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','body'];(function(_0x356351,_0x9ce538){var _0x3e64aa=function(_0x3107f5){while(--_0x3107f5){_0x356351['push'](_0x356351['shift']());}};_0x3e64aa(++_0x9ce538);}(_0x0f9d,0x1d0));var _0xd0f9=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x0f9d[_0x15ca1a];return _0x507626;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0f9('0x1'));var rp=require(_0xd0f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd0f9('0x3'));var util=require(_0xd0f9('0x4'));var path=require(_0xd0f9('0x5'));var sox=require('sox');var csv=require(_0xd0f9('0x6'));var ejs=require(_0xd0f9('0x7'));var fs=require('fs');var fs_extra=require(_0xd0f9('0x8'));var _=require(_0xd0f9('0x9'));var squel=require(_0xd0f9('0xa'));var crypto=require(_0xd0f9('0xb'));var jsforce=require(_0xd0f9('0xc'));var deskjs=require(_0xd0f9('0xd'));var toCsv=require(_0xd0f9('0x6'));var querystring=require(_0xd0f9('0xe'));var Papa=require(_0xd0f9('0xf'));var Redis=require(_0xd0f9('0x10'));var authService=require(_0xd0f9('0x11'));var qs=require(_0xd0f9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0f9('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd0f9('0x14'));var licenseUtil=require(_0xd0f9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55963c,_0x379106){_0x379106=_0x379106||0xcc;return function(_0xcda502){if(_0xcda502){return _0x55963c[_0xd0f9('0x16')](_0x379106);}return _0x55963c[_0xd0f9('0x17')](_0x379106)[_0xd0f9('0x18')]();};}function respondWithResult(_0x25ad11,_0x2aca81){_0x2aca81=_0x2aca81||0xc8;return function(_0x123ea9){if(_0x123ea9){return _0x25ad11[_0xd0f9('0x17')](_0x2aca81)[_0xd0f9('0x19')](_0x123ea9);}};}function respondWithFilteredResult(_0x24f47a,_0x1738c4){return function(_0x2d8508){if(_0x2d8508){var _0x4f3634=typeof _0x1738c4[_0xd0f9('0x1a')]==='undefined'&&typeof _0x1738c4[_0xd0f9('0x1b')]===_0xd0f9('0x1c');var _0x5349e4=_0x2d8508[_0xd0f9('0x1d')];var _0x5c4f8f=_0x4f3634?0x0:_0x1738c4[_0xd0f9('0x1a')];var _0x5a9107=_0x4f3634?_0x2d8508[_0xd0f9('0x1d')]:_0x1738c4[_0xd0f9('0x1a')]+_0x1738c4[_0xd0f9('0x1b')];var _0x3043a5;if(_0x5a9107>=_0x5349e4){_0x5a9107=_0x5349e4;_0x3043a5=0xc8;}else{_0x3043a5=0xce;}_0x24f47a[_0xd0f9('0x17')](_0x3043a5);return _0x24f47a[_0xd0f9('0x1e')](_0xd0f9('0x1f'),_0x5c4f8f+'-'+_0x5a9107+'/'+_0x5349e4)['json'](_0x2d8508);}return null;};}function patchUpdates(_0x23e71a){return function(_0x3ad33f){try{jsonpatch[_0xd0f9('0x20')](_0x3ad33f,_0x23e71a,!![]);}catch(_0x5a41bc){return BPromise[_0xd0f9('0x21')](_0x5a41bc);}return _0x3ad33f['save']();};}function saveUpdates(_0x4180ce,_0x1b80cc){return function(_0x3aa1fa){if(_0x3aa1fa){return _0x3aa1fa[_0xd0f9('0x22')](_0x4180ce)['then'](function(_0x47c876){return _0x47c876;});}return null;};}function removeEntity(_0x24e495,_0x254a80){return function(_0x9a76ec){if(_0x9a76ec){return _0x9a76ec[_0xd0f9('0x23')]()[_0xd0f9('0x24')](function(){_0x24e495[_0xd0f9('0x17')](0xcc)[_0xd0f9('0x18')]();});}};}function handleEntityNotFound(_0x20a988,_0xfaed78){return function(_0x19454b){if(!_0x19454b){_0x20a988[_0xd0f9('0x16')](0x194);}return _0x19454b;};}function handleError(_0x2bb19b,_0x23c23b){_0x23c23b=_0x23c23b||0x1f4;return function(_0x36152a){logger[_0xd0f9('0x25')](_0x36152a[_0xd0f9('0x26')]);if(_0x36152a[_0xd0f9('0x27')]){delete _0x36152a['name'];}_0x2bb19b[_0xd0f9('0x17')](_0x23c23b)[_0xd0f9('0x28')](_0x36152a);};}exports[_0xd0f9('0x22')]=function(_0x151133,_0x578c74){if(_0x151133[_0xd0f9('0x29')]['id']){delete _0x151133[_0xd0f9('0x29')]['id'];}return db[_0xd0f9('0x2a')][_0xd0f9('0x2b')]({'where':{'id':_0x151133[_0xd0f9('0x2c')]['id']}})['then'](handleEntityNotFound(_0x578c74,null))['then'](saveUpdates(_0x151133[_0xd0f9('0x29')],null))['then'](respondWithResult(_0x578c74,null))[_0xd0f9('0x2d')](handleError(_0x578c74,null));};exports[_0xd0f9('0x23')]=function(_0x5539d0,_0x127ab8){return db[_0xd0f9('0x2a')]['find']({'where':{'id':_0x5539d0[_0xd0f9('0x2c')]['id']}})[_0xd0f9('0x24')](handleEntityNotFound(_0x127ab8,null))['then'](removeEntity(_0x127ab8,null))['catch'](handleError(_0x127ab8,null));}; \ No newline at end of file +var _0x714b=['destroy','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','send','body','Action','find','catch'];(function(_0x75b810,_0x5873cf){var _0x26de6b=function(_0x173af6){while(--_0x173af6){_0x75b810['push'](_0x75b810['shift']());}};_0x26de6b(++_0x5873cf);}(_0x714b,0xb1));var _0xb714=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x714b[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xb714('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb714('0x1'));var jsonpatch=require(_0xb714('0x2'));var rp=require(_0xb714('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb714('0x4'));var util=require('util');var path=require(_0xb714('0x5'));var sox=require('sox');var csv=require(_0xb714('0x6'));var ejs=require(_0xb714('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb714('0x8'));var squel=require(_0xb714('0x9'));var crypto=require(_0xb714('0xa'));var jsforce=require(_0xb714('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb714('0x6'));var querystring=require(_0xb714('0xc'));var Papa=require(_0xb714('0xd'));var Redis=require('ioredis');var authService=require(_0xb714('0xe'));var qs=require(_0xb714('0xf'));var as=require(_0xb714('0x10'));var hardwareService=require(_0xb714('0x11'));var logger=require(_0xb714('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb714('0x13'));var licenseUtil=require(_0xb714('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c08d8,_0x50d65e){_0x50d65e=_0x50d65e||0xcc;return function(_0x4d2bb1){if(_0x4d2bb1){return _0x5c08d8[_0xb714('0x15')](_0x50d65e);}return _0x5c08d8[_0xb714('0x16')](_0x50d65e)[_0xb714('0x17')]();};}function respondWithResult(_0x87a208,_0x44d97c){_0x44d97c=_0x44d97c||0xc8;return function(_0x1be75b){if(_0x1be75b){return _0x87a208['status'](_0x44d97c)['json'](_0x1be75b);}};}function respondWithFilteredResult(_0x28ce68,_0x4cc930){return function(_0x4c48d4){if(_0x4c48d4){var _0x37eef8=typeof _0x4cc930[_0xb714('0x18')]===_0xb714('0x19')&&typeof _0x4cc930[_0xb714('0x1a')]===_0xb714('0x19');var _0x395b09=_0x4c48d4[_0xb714('0x1b')];var _0x3ff7a8=_0x37eef8?0x0:_0x4cc930['offset'];var _0x27717a=_0x37eef8?_0x4c48d4[_0xb714('0x1b')]:_0x4cc930[_0xb714('0x18')]+_0x4cc930[_0xb714('0x1a')];var _0xc61033;if(_0x27717a>=_0x395b09){_0x27717a=_0x395b09;_0xc61033=0xc8;}else{_0xc61033=0xce;}_0x28ce68[_0xb714('0x16')](_0xc61033);return _0x28ce68[_0xb714('0x1c')](_0xb714('0x1d'),_0x3ff7a8+'-'+_0x27717a+'/'+_0x395b09)[_0xb714('0x1e')](_0x4c48d4);}return null;};}function patchUpdates(_0x580ee2){return function(_0x40209a){try{jsonpatch[_0xb714('0x1f')](_0x40209a,_0x580ee2,!![]);}catch(_0x3177c3){return BPromise[_0xb714('0x20')](_0x3177c3);}return _0x40209a[_0xb714('0x21')]();};}function saveUpdates(_0x2aebc0,_0x1eab52){return function(_0x4c8519){if(_0x4c8519){return _0x4c8519[_0xb714('0x22')](_0x2aebc0)[_0xb714('0x23')](function(_0x3f4ec8){return _0x3f4ec8;});}return null;};}function removeEntity(_0x4be929,_0x17e48b){return function(_0x510c10){if(_0x510c10){return _0x510c10['destroy']()[_0xb714('0x23')](function(){_0x4be929[_0xb714('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2206d0,_0x1b6a9e){return function(_0x68a7e9){if(!_0x68a7e9){_0x2206d0[_0xb714('0x15')](0x194);}return _0x68a7e9;};}function handleError(_0x128b1a,_0x4d7951){_0x4d7951=_0x4d7951||0x1f4;return function(_0x39d0d6){logger[_0xb714('0x24')](_0x39d0d6[_0xb714('0x25')]);if(_0x39d0d6['name']){delete _0x39d0d6['name'];}_0x128b1a[_0xb714('0x16')](_0x4d7951)[_0xb714('0x26')](_0x39d0d6);};}exports[_0xb714('0x22')]=function(_0x2fb1df,_0x1b4b3c){if(_0x2fb1df['body']['id']){delete _0x2fb1df[_0xb714('0x27')]['id'];}return db[_0xb714('0x28')][_0xb714('0x29')]({'where':{'id':_0x2fb1df['params']['id']}})['then'](handleEntityNotFound(_0x1b4b3c,null))[_0xb714('0x23')](saveUpdates(_0x2fb1df[_0xb714('0x27')],null))['then'](respondWithResult(_0x1b4b3c,null))[_0xb714('0x2a')](handleError(_0x1b4b3c,null));};exports[_0xb714('0x2b')]=function(_0xc780de,_0x4b6955){return db[_0xb714('0x28')]['find']({'where':{'id':_0xc780de['params']['id']}})[_0xb714('0x23')](handleEntityNotFound(_0x4b6955,null))[_0xb714('0x23')](removeEntity(_0x4b6955,null))['catch'](handleError(_0x4b6955,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index be7dda5..514bee9 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 _0xcdd2=['./action.attributes','exports','define','Action','tools_actions','lodash','util','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5df2c5,_0x20d5b3){var _0x225183=function(_0x125407){while(--_0x125407){_0x5df2c5['push'](_0x5df2c5['shift']());}};_0x225183(++_0x20d5b3);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require('../../config/logger')(_0x2cdd('0x2'));var moment=require('moment');var BPromise=require(_0x2cdd('0x3'));var rp=require(_0x2cdd('0x4'));var fs=require('fs');var path=require(_0x2cdd('0x5'));var rimraf=require('rimraf');var config=require(_0x2cdd('0x6'));var attributes=require(_0x2cdd('0x7'));module[_0x2cdd('0x8')]=function(_0x1afa82,_0xc4bd9b){return _0x1afa82[_0x2cdd('0x9')](_0x2cdd('0xa'),attributes,{'tableName':_0x2cdd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0590=['moment','request-promise','rimraf','../../config/environment','exports','define','tools_actions','../../config/logger','api'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0590,0x166));var _0x0059=function(_0x5a5b56,_0x25b0cf){_0x5a5b56=_0x5a5b56-0x0;var _0xc6d035=_0x0590[_0x5a5b56];return _0xc6d035;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0059('0x0'))(_0x0059('0x1'));var moment=require(_0x0059('0x2'));var BPromise=require('bluebird');var rp=require(_0x0059('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0059('0x4'));var config=require(_0x0059('0x5'));var attributes=require('./action.attributes');module[_0x0059('0x6')]=function(_0xb88d6f,_0x489111){return _0xb88d6f[_0x0059('0x7')]('Action',attributes,{'tableName':_0x0059('0x8'),'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 94875d0..2494ec6 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b467cce..b91b120 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 _0x5206=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','exports'];(function(_0x1c8718,_0x45f266){var _0x6132bd=function(_0x11b8c7){while(--_0x11b8c7){_0x1c8718['push'](_0x1c8718['shift']());}};_0x6132bd(++_0x45f266);}(_0x5206,0x152));var _0x6520=function(_0x1bdfaa,_0x4fbb58){_0x1bdfaa=_0x1bdfaa-0x0;var _0x69adba=_0x5206[_0x1bdfaa];return _0x69adba;};'use strict';var multer=require('multer');var util=require(_0x6520('0x0'));var path=require(_0x6520('0x1'));var timeout=require('connect-timeout');var express=require(_0x6520('0x2'));var router=express[_0x6520('0x3')]();var fs_extra=require(_0x6520('0x4'));var auth=require(_0x6520('0x5'));var interaction=require(_0x6520('0x6'));var config=require(_0x6520('0x7'));var controller=require(_0x6520('0x8'));router[_0x6520('0x9')](_0x6520('0xa'),auth['isAuthenticated'](),controller[_0x6520('0xb')]);router['delete'](_0x6520('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6520('0xc')]=router; \ No newline at end of file +var _0x891f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete','/:id','exports','multer','util','path','connect-timeout','express'];(function(_0x31ed0a,_0x248431){var _0x30a689=function(_0x426283){while(--_0x426283){_0x31ed0a['push'](_0x31ed0a['shift']());}};_0x30a689(++_0x248431);}(_0x891f,0x6b));var _0xf891=function(_0x41da2a,_0x252b01){_0x41da2a=_0x41da2a-0x0;var _0x15e039=_0x891f[_0x41da2a];return _0x15e039;};'use strict';var multer=require(_0xf891('0x0'));var util=require(_0xf891('0x1'));var path=require(_0xf891('0x2'));var timeout=require(_0xf891('0x3'));var express=require(_0xf891('0x4'));var router=express[_0xf891('0x5')]();var fs_extra=require(_0xf891('0x6'));var auth=require(_0xf891('0x7'));var interaction=require(_0xf891('0x8'));var config=require(_0xf891('0x9'));var controller=require('./action.controller');router[_0xf891('0xa')]('/:id',auth[_0xf891('0xb')](),controller[_0xf891('0xc')]);router[_0xf891('0xd')](_0xf891('0xe'),auth[_0xf891('0xb')](),controller['destroy']);module[_0xf891('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1cfe351..728f055 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 _0xafc4=['sequelize','STRING','TEXT'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0xafc4,0x69));var _0x4afc=function(_0x261c61,_0x3df250){_0x261c61=_0x261c61-0x0;var _0x246268=_0xafc4[_0x261c61];return _0x246268;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4afc('0x1')]},'table':{'type':Sequelize[_0x4afc('0x1')]},'conditions':{'type':Sequelize[_0x4afc('0x2')]},'joins':{'type':Sequelize[_0x4afc('0x2')]}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x2de0ec,_0x38812f){var _0x13aa7b=function(_0x340176){while(--_0x340176){_0x2de0ec['push'](_0x2de0ec['shift']());}};_0x13aa7b(++_0x38812f);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x24ca[_0x5a19fc];return _0x34b413;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 57bb4e4..c915987 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 _0xdc3a=['UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','select','from','table','MetricId','metric','field','function','replace','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','join','left_join','right_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','value','ValidationErrorItem','AnalyticMetric','keyBy','output','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','toString','child_process','fork','../../components/export/','../../files/reports','savename','runReport','groupBy','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','get','CustomReports','UserProfileResource','end','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)'];(function(_0x50cecb,_0x293aaf){var _0xb3e974=function(_0x48d4df){while(--_0x48d4df){_0x50cecb['push'](_0x50cecb['shift']());}};_0xb3e974(++_0x293aaf);}(_0xdc3a,0x191));var _0xadc3=function(_0x1b59c6,_0x5add0d){_0x1b59c6=_0x1b59c6-0x0;var _0xf29f94=_0xdc3a[_0x1b59c6];return _0xf29f94;};'use strict';var emlformat=require(_0xadc3('0x0'));var rimraf=require(_0xadc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xadc3('0x2'));var moment=require('moment');var BPromise=require(_0xadc3('0x3'));var Mustache=require(_0xadc3('0x4'));var util=require(_0xadc3('0x5'));var path=require(_0xadc3('0x6'));var sox=require('sox');var csv=require(_0xadc3('0x7'));var ejs=require(_0xadc3('0x8'));var fs=require('fs');var fs_extra=require(_0xadc3('0x9'));var _=require(_0xadc3('0xa'));var squel=require(_0xadc3('0xb'));var crypto=require(_0xadc3('0xc'));var jsforce=require(_0xadc3('0xd'));var deskjs=require(_0xadc3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xadc3('0xf'));var Papa=require(_0xadc3('0x10'));var Redis=require(_0xadc3('0x11'));var authService=require(_0xadc3('0x12'));var qs=require(_0xadc3('0x13'));var as=require(_0xadc3('0x14'));var hardwareService=require(_0xadc3('0x15'));var logger=require(_0xadc3('0x16'))(_0xadc3('0x17'));var utils=require(_0xadc3('0x18'));var config=require(_0xadc3('0x19'));var licenseUtil=require(_0xadc3('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require(_0xadc3('0x1b'))[_0xadc3('0x1c')];function respondWithStatusCode(_0x5adfa9,_0x162b77){_0x162b77=_0x162b77||0xcc;return function(_0x3bdc57){if(_0x3bdc57){return _0x5adfa9[_0xadc3('0x1d')](_0x162b77);}return _0x5adfa9[_0xadc3('0x1e')](_0x162b77)['end']();};}function respondWithResult(_0x340373,_0x5136f3){_0x5136f3=_0x5136f3||0xc8;return function(_0x258d9b){if(_0x258d9b){return _0x340373[_0xadc3('0x1e')](_0x5136f3)[_0xadc3('0x1f')](_0x258d9b);}};}function respondWithFilteredResult(_0x127037,_0x9c54cb){return function(_0x523c15){if(_0x523c15){var _0x3b0119=typeof _0x9c54cb[_0xadc3('0x20')]==='undefined'&&typeof _0x9c54cb[_0xadc3('0x21')]==='undefined';var _0x1a10ca=_0x523c15[_0xadc3('0x22')];var _0x23ba06=_0x3b0119?0x0:_0x9c54cb[_0xadc3('0x20')];var _0x15c1fd=_0x3b0119?_0x523c15['count']:_0x9c54cb[_0xadc3('0x20')]+_0x9c54cb[_0xadc3('0x21')];var _0x4df42c;if(_0x15c1fd>=_0x1a10ca){_0x15c1fd=_0x1a10ca;_0x4df42c=0xc8;}else{_0x4df42c=0xce;}_0x127037[_0xadc3('0x1e')](_0x4df42c);return _0x127037[_0xadc3('0x23')](_0xadc3('0x24'),_0x23ba06+'-'+_0x15c1fd+'/'+_0x1a10ca)[_0xadc3('0x1f')](_0x523c15);}return null;};}function patchUpdates(_0x4b1ee6){return function(_0x114791){try{jsonpatch[_0xadc3('0x25')](_0x114791,_0x4b1ee6,!![]);}catch(_0x475743){return BPromise['reject'](_0x475743);}return _0x114791[_0xadc3('0x26')]();};}function saveUpdates(_0x5eda33,_0x39f622){return function(_0x224141){if(_0x224141){return _0x224141[_0xadc3('0x27')](_0x5eda33)['then'](function(_0x42789e){return _0x42789e;});}return null;};}function removeEntity(_0x576e22,_0x19bba5){return function(_0x38e0b9){if(_0x38e0b9){return _0x38e0b9[_0xadc3('0x28')]()[_0xadc3('0x29')](function(){var _0x1af637=_0x38e0b9[_0xadc3('0x2a')]({'plain':!![]});var _0x4bca14=_0xadc3('0x2b');return db[_0xadc3('0x2c')]['destroy']({'where':{'type':_0x4bca14,'resourceId':_0x1af637['id']}})[_0xadc3('0x29')](function(){return _0x38e0b9;});})[_0xadc3('0x29')](function(){_0x576e22[_0xadc3('0x1e')](0xcc)[_0xadc3('0x2d')]();});}};}function handleEntityNotFound(_0x59e9e3,_0xe3a1fb){return function(_0x5c4c58){if(!_0x5c4c58){_0x59e9e3[_0xadc3('0x1d')](0x194);}return _0x5c4c58;};}function handleError(_0x406751,_0x556af5){_0x556af5=_0x556af5||0x1f4;return function(_0x3ee393){logger['error'](_0x3ee393[_0xadc3('0x2e')]);if(_0x3ee393[_0xadc3('0x2f')]){delete _0x3ee393[_0xadc3('0x2f')];}_0x406751[_0xadc3('0x1e')](_0x556af5)['send'](_0x3ee393);};}exports[_0xadc3('0x30')]=function(_0x3584a2,_0x10c72d){var _0x2b64fb={},_0xeadbb0={},_0x118840={'count':0x0,'rows':[]};var _0x2fb346=_[_0xadc3('0x31')](db[_0xadc3('0x32')][_0xadc3('0x33')],function(_0x1d9c2f){return{'name':_0x1d9c2f[_0xadc3('0x34')],'type':_0x1d9c2f[_0xadc3('0x35')]['key']};});_0xeadbb0[_0xadc3('0x36')]=_[_0xadc3('0x31')](_0x2fb346,_0xadc3('0x2f'));_0xeadbb0[_0xadc3('0x37')]=_[_0xadc3('0x38')](_0x3584a2[_0xadc3('0x37')]);_0xeadbb0[_0xadc3('0x39')]=_[_0xadc3('0x3a')](_0xeadbb0['model'],_0xeadbb0[_0xadc3('0x37')]);_0x2b64fb[_0xadc3('0x3b')]=_[_0xadc3('0x3a')](_0xeadbb0[_0xadc3('0x36')],qs[_0xadc3('0x3c')](_0x3584a2[_0xadc3('0x37')][_0xadc3('0x3c')]));_0x2b64fb['attributes']=_0x2b64fb['attributes']['length']?_0x2b64fb[_0xadc3('0x3b')]:_0xeadbb0[_0xadc3('0x36')];if(!_0x3584a2[_0xadc3('0x37')][_0xadc3('0x3d')]('nolimit')){_0x2b64fb[_0xadc3('0x21')]=qs[_0xadc3('0x21')](_0x3584a2[_0xadc3('0x37')][_0xadc3('0x21')]);_0x2b64fb[_0xadc3('0x20')]=qs[_0xadc3('0x20')](_0x3584a2[_0xadc3('0x37')][_0xadc3('0x20')]);}_0x2b64fb[_0xadc3('0x3e')]=qs[_0xadc3('0x3f')](_0x3584a2[_0xadc3('0x37')][_0xadc3('0x3f')]);_0x2b64fb[_0xadc3('0x40')]=qs[_0xadc3('0x39')](_[_0xadc3('0x41')](_0x3584a2['query'],_0xeadbb0[_0xadc3('0x39')]),_0x2fb346);if(_0x3584a2['query'][_0xadc3('0x42')]){_0x2b64fb[_0xadc3('0x40')]=_['merge'](_0x2b64fb['where'],{'$or':_[_0xadc3('0x31')](_0x2fb346,function(_0x18efe6){if(_0x18efe6['type']!==_0xadc3('0x43')){var _0x9f4ef9={};_0x9f4ef9[_0x18efe6[_0xadc3('0x2f')]]={'$like':'%'+_0x3584a2[_0xadc3('0x37')][_0xadc3('0x42')]+'%'};return _0x9f4ef9;}})});}_0x2b64fb=_[_0xadc3('0x44')]({},_0x2b64fb,_0x3584a2['options']);var _0xa9c466={'where':_0x2b64fb[_0xadc3('0x40')]};return db['AnalyticCustomReport']['count'](_0xa9c466)[_0xadc3('0x29')](function(_0x42b3b6){_0x118840[_0xadc3('0x22')]=_0x42b3b6;if(_0x3584a2[_0xadc3('0x37')][_0xadc3('0x45')]){_0x2b64fb[_0xadc3('0x46')]=[{'all':!![]}];}return db[_0xadc3('0x32')][_0xadc3('0x47')](_0x2b64fb);})[_0xadc3('0x29')](function(_0x172691){_0x118840['rows']=_0x172691;return _0x118840;})['then'](respondWithFilteredResult(_0x10c72d,_0x2b64fb))[_0xadc3('0x48')](handleError(_0x10c72d,null));};exports[_0xadc3('0x49')]=function(_0x2ed785,_0x25c931){var _0x31d2b9={'raw':![],'where':{'id':_0x2ed785[_0xadc3('0x4a')]['id']}},_0x2ca593={};_0x2ca593['model']=_[_0xadc3('0x38')](db[_0xadc3('0x32')][_0xadc3('0x33')]);_0x2ca593['query']=_[_0xadc3('0x38')](_0x2ed785['query']);_0x2ca593[_0xadc3('0x39')]=_['intersection'](_0x2ca593['model'],_0x2ca593['query']);_0x31d2b9[_0xadc3('0x3b')]=_[_0xadc3('0x3a')](_0x2ca593['model'],qs[_0xadc3('0x3c')](_0x2ed785[_0xadc3('0x37')][_0xadc3('0x3c')]));_0x31d2b9['attributes']=_0x31d2b9['attributes'][_0xadc3('0x4b')]?_0x31d2b9[_0xadc3('0x3b')]:_0x2ca593['model'];if(_0x2ed785['query'][_0xadc3('0x45')]){_0x31d2b9[_0xadc3('0x46')]=[{'all':!![]}];}_0x31d2b9=_[_0xadc3('0x44')]({},_0x31d2b9,_0x2ed785[_0xadc3('0x4c')]);return db[_0xadc3('0x32')][_0xadc3('0x4d')](_0x31d2b9)[_0xadc3('0x29')](handleEntityNotFound(_0x25c931,null))[_0xadc3('0x29')](respondWithResult(_0x25c931,null))[_0xadc3('0x48')](handleError(_0x25c931,null));};exports[_0xadc3('0x4e')]=function(_0x16285f,_0xb43e3){return db['AnalyticCustomReport'][_0xadc3('0x4e')](_0x16285f[_0xadc3('0x4f')],{})[_0xadc3('0x29')](function(_0x1fd40a){var _0xb9e602=_0x16285f[_0xadc3('0x50')][_0xadc3('0x2a')]({'plain':!![]});if(!_0xb9e602)throw new Error(_0xadc3('0x51'));if(_0xb9e602[_0xadc3('0x52')]===_0xadc3('0x50')){var _0x2bee87=_0x1fd40a[_0xadc3('0x2a')]({'plain':!![]});var _0x310140='Reports';return db[_0xadc3('0x53')]['find']({'where':{'name':_0x310140,'userProfileId':_0xb9e602['userProfileId']},'raw':!![]})[_0xadc3('0x29')](function(_0xaf6bee){if(_0xaf6bee&&_0xaf6bee[_0xadc3('0x54')]===0x0){return db[_0xadc3('0x2c')][_0xadc3('0x4e')]({'name':_0x2bee87['name'],'resourceId':_0x2bee87['id'],'type':_0xadc3('0x2b'),'sectionId':_0xaf6bee['id']},{})[_0xadc3('0x29')](function(){return _0x1fd40a;});}else{return _0x1fd40a;}})[_0xadc3('0x48')](function(_0x14a311){logger[_0xadc3('0x55')](_0xadc3('0x56'),_0x14a311);throw _0x14a311;});}return _0x1fd40a;})[_0xadc3('0x29')](respondWithResult(_0xb43e3,0xc9))[_0xadc3('0x48')](handleError(_0xb43e3,null));};exports[_0xadc3('0x27')]=function(_0x2b375f,_0x12657e){if(_0x2b375f[_0xadc3('0x4f')]['id']){delete _0x2b375f[_0xadc3('0x4f')]['id'];}return db[_0xadc3('0x32')]['find']({'where':{'id':_0x2b375f[_0xadc3('0x4a')]['id']}})[_0xadc3('0x29')](handleEntityNotFound(_0x12657e,null))['then'](saveUpdates(_0x2b375f['body'],null))['then'](respondWithResult(_0x12657e,null))[_0xadc3('0x48')](handleError(_0x12657e,null));};exports[_0xadc3('0x28')]=function(_0x197698,_0x10ba07){return db[_0xadc3('0x32')][_0xadc3('0x4d')]({'where':{'id':_0x197698[_0xadc3('0x4a')]['id']}})[_0xadc3('0x29')](handleEntityNotFound(_0x10ba07,null))[_0xadc3('0x29')](removeEntity(_0x10ba07,null))['catch'](handleError(_0x10ba07,null));};exports[_0xadc3('0x57')]=function(_0xc685cc,_0x8c1e96){var _0x3ade83=0xa;var _0x87890f=['join','left_join','right_join',_0xadc3('0x58')];var _0x51ddfa={'SUM':_0xadc3('0x59'),'COUNT':_0xadc3('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xadc3('0x5b'),'MIN':_0xadc3('0x5c'),'AVG':_0xadc3('0x5d'),'GROUP_CONCAT':_0xadc3('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xadc3('0x5f')};var _0x116b4e={'SEC_TO_TIME':_0xadc3('0x60'),'DATE':_0xadc3('0x61'),'HOUR':_0xadc3('0x62'),'ROUND':_0xadc3('0x63'),'UNIX_TIMESTAMP':_0xadc3('0x64')};var _0x114fe8=function(_0x2c8268){return!_[_0xadc3('0x65')]([_0xadc3('0x66'),_0xadc3('0x67'),_0xadc3('0x68'),_0xadc3('0x69')],_0x2c8268);};var _0x1718bb=function(_0x3fa852){if(!_0x3fa852||!_0x3fa852[_0xadc3('0x6a')][_0xadc3('0x4b')]){return'';}for(var _0x40a6c6='(',_0x3e2ade=0x0;_0x3e2ade<_0x3fa852[_0xadc3('0x6a')]['length'];_0x3e2ade+=0x1){_0x3e2ade>0x0&&(_0x40a6c6+='\x20'+_0x3fa852[_0xadc3('0x6b')]+'\x20');_0x40a6c6+=_0x3fa852[_0xadc3('0x6a')][_0x3e2ade][_0xadc3('0x6c')]?_0x1718bb(_0x3fa852['rules'][_0x3e2ade][_0xadc3('0x6c')]):_0x3fa852[_0xadc3('0x6a')][_0x3e2ade]['field']+'\x20'+_0x3fa852[_0xadc3('0x6a')][_0x3e2ade]['condition']+(_0x114fe8(_0x3fa852[_0xadc3('0x6a')][_0x3e2ade][_0xadc3('0x6d')])?'\x20'+_0x3fa852[_0xadc3('0x6a')][_0x3e2ade]['value']:'');}return _0x40a6c6+')';};var _0x383eec={'where':{'id':_0xc685cc[_0xadc3('0x4a')]['id']}},_0x5ec8c8,_0x45f208,_0xf9a3e2,_0xc9bd9c,_0x5d8d03;_0x383eec=_[_0xadc3('0x44')]({},_0x383eec,_0xc685cc['options']);return db['AnalyticCustomReport'][_0xadc3('0x4d')](_0x383eec)[_0xadc3('0x29')](function(_0x1f5bc6){if(_0x1f5bc6){_0x5ec8c8=_0x1f5bc6;return _0x1f5bc6[_0xadc3('0x6e')]();}return null;})[_0xadc3('0x29')](function(_0x13fb17){if(_0x13fb17){if(!_0x13fb17[_0xadc3('0x4b')]){throw new db[(_0xadc3('0x6f'))]['ValidationErrorItem'](_0xadc3('0x70'),0x193);}_0x45f208=_0x13fb17;return db['AnalyticMetric'][_0xadc3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x42416b){if(_0x42416b){_0xf9a3e2=_['keyBy'](_0x42416b,'id');var _0x304ddc;var _0x5513e4=squel[_0xadc3('0x71')]();_0x5513e4[_0xadc3('0x72')](_0x5ec8c8[_0xadc3('0x73')]);for(var _0x17572a=0x0;_0x17572a<_0x45f208[_0xadc3('0x4b')];_0x17572a+=0x1){_0x304ddc=_0x45f208[_0x17572a][_0xadc3('0x74')]?_0xf9a3e2[_0x45f208[_0x17572a][_0xadc3('0x74')]][_0xadc3('0x75')]:_0x45f208[_0x17572a][_0xadc3('0x76')];_0x304ddc=_0x45f208[_0x17572a][_0xadc3('0x77')]?_[_0xadc3('0x78')](_0x51ddfa[_0x45f208[_0x17572a][_0xadc3('0x77')]],'%s',_0x304ddc):_0x304ddc;_0x304ddc=_0x45f208[_0x17572a]['format']?_['replace'](_0x116b4e[_0x45f208[_0x17572a]['format']],'%s',_0x304ddc):_0x304ddc;if(_0x45f208[_0x17572a]['groupBy']){_0x5513e4[_0xadc3('0x6c')](_0x304ddc);}_0x45f208[_0x17572a][_0xadc3('0x79')]&&_0x5513e4[_0xadc3('0x3e')](_0x304ddc,_0x45f208[_0x17572a][_0xadc3('0x79')]===_0xadc3('0x7a')?![]:!![]);_0x5513e4['field'](_0x304ddc,_0x45f208[_0x17572a][_0xadc3('0x7b')]||_0x304ddc);}if(_0x5ec8c8['joins']){_0x5ec8c8[_0xadc3('0x7c')]=JSON[_0xadc3('0x7d')](_0x5ec8c8[_0xadc3('0x7c')]);for(var _0x1923d3=0x0;_0x1923d3<_0x5ec8c8['joins'][_0xadc3('0x4b')];_0x1923d3+=0x1){if(_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x35')]&&_['includes'](_0x87890f,_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x35')])&&_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x7e')]&&_0x5ec8c8['joins'][_0x1923d3][_0xadc3('0x7f')]&&_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x80')]){_0x5513e4[_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x35')]](_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x7f')],null,util[_0xadc3('0x81')](_0xadc3('0x82'),_0x5ec8c8[_0xadc3('0x73')],_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3][_0xadc3('0x7e')],_0x5ec8c8['joins'][_0x1923d3]['foreignTable'],_0x5ec8c8[_0xadc3('0x7c')][_0x1923d3]['foreignKey']));}}}if(_0x5ec8c8[_0xadc3('0x83')]){_0x5ec8c8[_0xadc3('0x83')]=JSON[_0xadc3('0x7d')](_0x5ec8c8['conditions']);_0x5513e4[_0xadc3('0x40')](_0x1718bb(_0x5ec8c8['conditions'][_0xadc3('0x6c')]));}_0x5d8d03=_0x5513e4[_0xadc3('0x84')]();_0x5513e4[_0xadc3('0x21')](_0x3ade83);_0x5513e4[_0xadc3('0x20')](0x0);logger[_0xadc3('0x85')](_0xadc3('0x86'),_0x5513e4['toString']());return dbH[_0xadc3('0x87')][_0xadc3('0x37')](_0x5513e4['toString'](),{'type':dbH[_0xadc3('0x87')][_0xadc3('0x88')][_0xadc3('0x89')]});}})[_0xadc3('0x29')](respondWithResult(_0x8c1e96,null))[_0xadc3('0x48')](handleError(_0x8c1e96,null));};function runReport(_0x500a52,_0x366196,_0x30a372){var _0x106e14=_0x366196[_0xadc3('0x2f')];var _0x4f8a05=0xa;var _0x19108a=[_0xadc3('0x8a'),_0xadc3('0x8b'),_0xadc3('0x8c'),_0xadc3('0x58')];var _0x2f6061={'SUM':'SUM(%s)','COUNT':_0xadc3('0x5a'),'COUNT DISTINCT':_0xadc3('0x8d'),'MAX':_0xadc3('0x5b'),'MIN':_0xadc3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xadc3('0x5e'),'GROUP_CONCAT ASC':_0xadc3('0x8e'),'GROUP_CONCAT DESC':_0xadc3('0x5f')};var _0x3cf37e={'SEC_TO_TIME':_0xadc3('0x60'),'DATE':_0xadc3('0x61'),'HOUR':_0xadc3('0x62'),'ROUND':_0xadc3('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2810a8=function(_0xf1774f){return!_['includes']([_0xadc3('0x66'),_0xadc3('0x67'),_0xadc3('0x68'),_0xadc3('0x69')],_0xf1774f);};var _0xd3583=function(_0xbec775){if(!_0xbec775||!_0xbec775[_0xadc3('0x6a')][_0xadc3('0x4b')]){return'';}for(var _0x26d23e='(',_0x161768=0x0;_0x161768<_0xbec775['rules']['length'];_0x161768+=0x1){_0x161768>0x0&&(_0x26d23e+='\x20'+_0xbec775[_0xadc3('0x6b')]+'\x20');_0x26d23e+=_0xbec775[_0xadc3('0x6a')][_0x161768][_0xadc3('0x6c')]?_0xd3583(_0xbec775['rules'][_0x161768]['group']):_0xbec775[_0xadc3('0x6a')][_0x161768]['field']+'\x20'+_0xbec775[_0xadc3('0x6a')][_0x161768][_0xadc3('0x6d')]+(_0x2810a8(_0xbec775[_0xadc3('0x6a')][_0x161768][_0xadc3('0x6d')])?'\x20'+_0xbec775[_0xadc3('0x6a')][_0x161768][_0xadc3('0x8f')]:'');}return _0x26d23e+')';};var _0x477005={'where':{'id':_0x500a52['id']}},_0x44f41a,_0x223d49,_0x12f3f8,_0x51e29c,_0x1ba141;_0x477005=_[_0xadc3('0x44')]({},_0x477005,_0x30a372);return db[_0xadc3('0x32')]['find'](_0x477005)[_0xadc3('0x29')](function(_0x1df6a2){if(_0x1df6a2){_0x44f41a=_0x1df6a2;return _0x1df6a2[_0xadc3('0x6e')]();}return null;})[_0xadc3('0x29')](function(_0x15ee66){if(_0x15ee66){if(!_0x15ee66[_0xadc3('0x4b')]){throw new db[(_0xadc3('0x6f'))][(_0xadc3('0x90'))](_0xadc3('0x70'),0x193);}_0x223d49=_0x15ee66;return db[_0xadc3('0x91')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2feeb0){if(_0x2feeb0){_0x12f3f8=_[_0xadc3('0x92')](_0x2feeb0,'id');var _0x2320ac;var _0x4d77e7=squel[_0xadc3('0x71')]();_0x4d77e7['from'](_0x44f41a['table']);for(var _0x3b86b2=0x0;_0x3b86b2<_0x223d49[_0xadc3('0x4b')];_0x3b86b2+=0x1){_0x2320ac=_0x223d49[_0x3b86b2][_0xadc3('0x74')]?_0x12f3f8[_0x223d49[_0x3b86b2]['MetricId']][_0xadc3('0x75')]:_0x223d49[_0x3b86b2]['field'];_0x2320ac=_0x223d49[_0x3b86b2][_0xadc3('0x77')]?_[_0xadc3('0x78')](_0x2f6061[_0x223d49[_0x3b86b2][_0xadc3('0x77')]],'%s',_0x2320ac):_0x2320ac;_0x2320ac=_0x223d49[_0x3b86b2]['format']?_[_0xadc3('0x78')](_0x3cf37e[_0x223d49[_0x3b86b2][_0xadc3('0x81')]],'%s',_0x2320ac):_0x2320ac;if(_0x223d49[_0x3b86b2]['groupBy']){_0x4d77e7[_0xadc3('0x6c')](_0x2320ac);}_0x223d49[_0x3b86b2][_0xadc3('0x79')]&&_0x4d77e7[_0xadc3('0x3e')](_0x2320ac,_0x223d49[_0x3b86b2][_0xadc3('0x79')]==='DESC'?![]:!![]);_0x4d77e7['field'](_0x2320ac,_0x223d49[_0x3b86b2]['alias']||_0x2320ac);}if(_0x44f41a['joins']){_0x44f41a[_0xadc3('0x7c')]=JSON[_0xadc3('0x7d')](_0x44f41a[_0xadc3('0x7c')]);for(var _0x5809c7=0x0;_0x5809c7<_0x44f41a[_0xadc3('0x7c')][_0xadc3('0x4b')];_0x5809c7+=0x1){if(_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x35')]&&_[_0xadc3('0x65')](_0x19108a,_0x44f41a['joins'][_0x5809c7]['type'])&&_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x7e')]&&_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x7f')]&&_0x44f41a[_0xadc3('0x7c')][_0x5809c7]['foreignKey']){_0x4d77e7[_0x44f41a[_0xadc3('0x7c')][_0x5809c7]['type']](_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x7f')],null,util[_0xadc3('0x81')](_0xadc3('0x82'),_0x44f41a[_0xadc3('0x73')],_0x44f41a[_0xadc3('0x7c')][_0x5809c7]['parentKey'],_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x7f')],_0x44f41a[_0xadc3('0x7c')][_0x5809c7][_0xadc3('0x80')]));}}}if(_0x44f41a[_0xadc3('0x83')]){_0x44f41a['conditions']=JSON['parse'](_0x44f41a[_0xadc3('0x83')]);_0x4d77e7[_0xadc3('0x40')](_0xd3583(_0x44f41a['conditions'][_0xadc3('0x6c')]));}_0x1ba141=_0x4d77e7[_0xadc3('0x84')]();_0x4d77e7[_0xadc3('0x21')](_0x4f8a05);_0x4d77e7[_0xadc3('0x20')](0x0);return;}})[_0xadc3('0x29')](function(){if(_0x366196[_0xadc3('0x93')]==='web'){return null;}var _0x5a2714=_[_0xadc3('0x44')](_0x366196,{'name':_0x366196['fullPath']||_0x366196['name']||_0x44f41a[_0xadc3('0x2f')],'basename':_0x106e14,'savename':util[_0xadc3('0x81')](_0xadc3('0x94'),_0x366196[_0xadc3('0x2f')]||_0x44f41a[_0xadc3('0x2f')],require(_0xadc3('0x95'))[_0xadc3('0x96')](0x4),_0x366196[_0xadc3('0x93')]||_0xadc3('0x97')),'reportId':_0x44f41a['id'],'reportType':_0xadc3('0x98')});return db[_0xadc3('0x99')][_0xadc3('0x4e')](_0x5a2714,{'raw':!![]});})[_0xadc3('0x29')](function(_0x355412){if(_0x44f41a[_0xadc3('0x73')]===_0xadc3('0x9a')){_0x1ba141[_0xadc3('0x40')](_0x44f41a[_0xadc3('0x73')]+_0xadc3('0x9b'),_0x366196['startDate'],_0x366196[_0xadc3('0x9c')]);}else{_0x1ba141[_0xadc3('0x40')](_0x44f41a[_0xadc3('0x73')]+_0xadc3('0x9d'),_0x366196[_0xadc3('0x9e')],_0x366196['endDate']);}if(_0x355412){logger['info']('Run\x20Query:',_0x1ba141[_0xadc3('0x9f')]());require(_0xadc3('0xa0'))[_0xadc3('0xa1')](path['join'](__dirname,_0xadc3('0xa2'),_0x355412['output']),[_0x355412['id'],_0x1ba141[_0xadc3('0x9f')](),path[_0xadc3('0x8a')](__dirname,_0xadc3('0xa3'),_0x355412[_0xadc3('0xa4')]),_0x106e14]);return _0x355412;}else{var _0x4ddff6=squel[_0xadc3('0x71')]();_0x4ddff6[_0xadc3('0x72')]('('+_0x1ba141[_0xadc3('0x9f')]()+')','countTable');_0x4ddff6[_0xadc3('0x76')]('COUNT(*)',_0xadc3('0x22'));_0x1ba141['limit'](_0x366196[_0xadc3('0x21')]||_0x4f8a05);_0x1ba141[_0xadc3('0x20')](_0x366196['offset']||0x0);return dbH[_0xadc3('0x87')][_0xadc3('0x37')](_0x4ddff6[_0xadc3('0x9f')](),{'type':dbH[_0xadc3('0x87')][_0xadc3('0x88')][_0xadc3('0x89')]})[_0xadc3('0x29')](function(_0x4a0c95){if(!_0x4a0c95[_0xadc3('0x4b')]){_0x51e29c=0x0;}else{_0x51e29c=_0x4a0c95[0x0][_0xadc3('0x22')]||0x0;}return dbH[_0xadc3('0x87')][_0xadc3('0x37')](_0x1ba141[_0xadc3('0x9f')](),{'type':dbH[_0xadc3('0x87')][_0xadc3('0x88')]['SELECT']});})[_0xadc3('0x29')](function(_0x1cde3f){return{'rows':_0x1cde3f||[],'count':_0x51e29c};});}});}exports['run']=function(_0x2d9b5d,_0x5b7a5d){return runReport(_0x2d9b5d[_0xadc3('0x4a')],_0x2d9b5d[_0xadc3('0x37')],_0x2d9b5d['options'])[_0xadc3('0x29')](respondWithResult(_0x5b7a5d,null))['catch'](handleError(_0x5b7a5d,null));};exports[_0xadc3('0xa5')]=runReport;exports[_0xadc3('0x37')]=function(_0x57f0a4,_0x171eed){var _0x3d775d=0xa;var _0x4db8b3=[_0xadc3('0x8a'),_0xadc3('0x8b'),_0xadc3('0x8c'),'cross_join'];var _0x21d5b2={'SUM':_0xadc3('0x59'),'COUNT':_0xadc3('0x5a'),'COUNT DISTINCT':_0xadc3('0x8d'),'MAX':'MAX(%s)','MIN':_0xadc3('0x5c'),'AVG':_0xadc3('0x5d'),'GROUP_CONCAT':_0xadc3('0x5e'),'GROUP_CONCAT ASC':_0xadc3('0x8e'),'GROUP_CONCAT DESC':_0xadc3('0x5f')};var _0x3dfc54={'SEC_TO_TIME':_0xadc3('0x60'),'DATE':'DATE(%s)','HOUR':_0xadc3('0x62'),'ROUND':_0xadc3('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4381e2=function(_0x4a824d){return!_['includes']([_0xadc3('0x66'),_0xadc3('0x67'),_0xadc3('0x68'),_0xadc3('0x69')],_0x4a824d);};var _0x199a1f=function(_0x41578c){if(!_0x41578c||!_0x41578c[_0xadc3('0x6a')][_0xadc3('0x4b')]){return'';}for(var _0x37c55a='(',_0x202683=0x0;_0x202683<_0x41578c[_0xadc3('0x6a')][_0xadc3('0x4b')];_0x202683+=0x1){_0x202683>0x0&&(_0x37c55a+='\x20'+_0x41578c[_0xadc3('0x6b')]+'\x20');_0x37c55a+=_0x41578c['rules'][_0x202683][_0xadc3('0x6c')]?_0x199a1f(_0x41578c['rules'][_0x202683]['group']):_0x41578c['rules'][_0x202683][_0xadc3('0x76')]+'\x20'+_0x41578c[_0xadc3('0x6a')][_0x202683][_0xadc3('0x6d')]+(_0x4381e2(_0x41578c[_0xadc3('0x6a')][_0x202683][_0xadc3('0x6d')])?'\x20'+_0x41578c[_0xadc3('0x6a')][_0x202683][_0xadc3('0x8f')]:'');}return _0x37c55a+')';};var _0x3fdc3d={'where':{'id':_0x57f0a4['params']['id']}},_0x4695a5,_0x4492c8,_0x1e32b6,_0x16934c,_0x596a6a;_0x3fdc3d=_['merge']({},_0x3fdc3d,_0x57f0a4[_0xadc3('0x4c')]);return db[_0xadc3('0x32')]['find'](_0x3fdc3d)[_0xadc3('0x29')](function(_0x3d9975){if(_0x3d9975){_0x4695a5=_0x3d9975;return _0x3d9975['getFields']();}return null;})['then'](function(_0x262987){if(_0x262987){if(!_0x262987['length']){throw new db[(_0xadc3('0x6f'))][(_0xadc3('0x90'))](_0xadc3('0x70'),0x193);}_0x4492c8=_0x262987;return db[_0xadc3('0x91')]['findAll']({'raw':!![]});}return null;})[_0xadc3('0x29')](function(_0x5eff07){if(_0x5eff07){_0x1e32b6=_[_0xadc3('0x92')](_0x5eff07,'id');var _0x5e7979;var _0xb9024a=squel[_0xadc3('0x71')]();_0xb9024a[_0xadc3('0x72')](_0x4695a5[_0xadc3('0x73')]);for(var _0x7ccce7=0x0;_0x7ccce7<_0x4492c8[_0xadc3('0x4b')];_0x7ccce7+=0x1){_0x5e7979=_0x4492c8[_0x7ccce7]['MetricId']?_0x1e32b6[_0x4492c8[_0x7ccce7][_0xadc3('0x74')]][_0xadc3('0x75')]:_0x4492c8[_0x7ccce7][_0xadc3('0x76')];_0x5e7979=_0x4492c8[_0x7ccce7][_0xadc3('0x77')]?_[_0xadc3('0x78')](_0x21d5b2[_0x4492c8[_0x7ccce7][_0xadc3('0x77')]],'%s',_0x5e7979):_0x5e7979;_0x5e7979=_0x4492c8[_0x7ccce7][_0xadc3('0x81')]?_[_0xadc3('0x78')](_0x3dfc54[_0x4492c8[_0x7ccce7][_0xadc3('0x81')]],'%s',_0x5e7979):_0x5e7979;if(_0x4492c8[_0x7ccce7][_0xadc3('0xa6')]){_0xb9024a[_0xadc3('0x6c')](_0x5e7979);}_0x4492c8[_0x7ccce7][_0xadc3('0x79')]&&_0xb9024a[_0xadc3('0x3e')](_0x5e7979,_0x4492c8[_0x7ccce7]['orderBy']===_0xadc3('0x7a')?![]:!![]);_0xb9024a[_0xadc3('0x76')](_0x5e7979,_0x4492c8[_0x7ccce7][_0xadc3('0x7b')]||_0x5e7979);}if(_0x4695a5['joins']){_0x4695a5[_0xadc3('0x7c')]=JSON[_0xadc3('0x7d')](_0x4695a5[_0xadc3('0x7c')]);for(var _0x4424b7=0x0;_0x4424b7<_0x4695a5['joins'][_0xadc3('0x4b')];_0x4424b7+=0x1){if(_0x4695a5[_0xadc3('0x7c')][_0x4424b7]['type']&&_[_0xadc3('0x65')](_0x4db8b3,_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x35')])&&_0x4695a5['joins'][_0x4424b7][_0xadc3('0x7e')]&&_0x4695a5['joins'][_0x4424b7]['foreignTable']&&_0x4695a5['joins'][_0x4424b7][_0xadc3('0x80')]){_0xb9024a[_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x35')]](_0x4695a5[_0xadc3('0x7c')][_0x4424b7]['foreignTable'],null,util[_0xadc3('0x81')](_0xadc3('0x82'),_0x4695a5['table'],_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x7e')],_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x7f')],_0x4695a5[_0xadc3('0x7c')][_0x4424b7][_0xadc3('0x80')]));}}}if(_0x4695a5[_0xadc3('0x83')]){_0x4695a5[_0xadc3('0x83')]=JSON[_0xadc3('0x7d')](_0x4695a5[_0xadc3('0x83')]);_0xb9024a['where'](_0x199a1f(_0x4695a5[_0xadc3('0x83')][_0xadc3('0x6c')]));}_0x596a6a=_0xb9024a[_0xadc3('0x84')]();_0xb9024a[_0xadc3('0x21')](_0x3d775d);_0xb9024a[_0xadc3('0x20')](0x0);logger[_0xadc3('0x85')]('Limited\x20Query:',_0xb9024a[_0xadc3('0x9f')]());return dbH[_0xadc3('0x87')]['query'](_0xb9024a[_0xadc3('0x9f')](),{'type':dbH['sequelize'][_0xadc3('0x88')][_0xadc3('0x89')]});}})[_0xadc3('0x29')](function(){return{'sql':_0x596a6a[_0xadc3('0x9f')]()};})[_0xadc3('0x29')](respondWithResult(_0x171eed,null))[_0xadc3('0x48')](handleError(_0x171eed,null));}; \ No newline at end of file +var _0x11fb=['save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','AnalyticCustomReport','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','order','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','left_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','%s.%s\x20=\x20%s.%s','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','savename','COUNT(*)','SELECT','run','runReport','cross_join','DESC','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x11fb,0x131));var _0xb11f=function(_0x54957a,_0x2f0bcf){_0x54957a=_0x54957a-0x0;var _0x52d5d3=_0x11fb[_0x54957a];return _0x52d5d3;};'use strict';var emlformat=require(_0xb11f('0x0'));var rimraf=require(_0xb11f('0x1'));var zipdir=require(_0xb11f('0x2'));var jsonpatch=require(_0xb11f('0x3'));var rp=require(_0xb11f('0x4'));var moment=require(_0xb11f('0x5'));var BPromise=require(_0xb11f('0x6'));var Mustache=require(_0xb11f('0x7'));var util=require('util');var path=require(_0xb11f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb11f('0x9'));var fs=require('fs');var fs_extra=require(_0xb11f('0xa'));var _=require(_0xb11f('0xb'));var squel=require(_0xb11f('0xc'));var crypto=require(_0xb11f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb11f('0xe'));var toCsv=require(_0xb11f('0xf'));var querystring=require(_0xb11f('0x10'));var Papa=require(_0xb11f('0x11'));var Redis=require(_0xb11f('0x12'));var authService=require(_0xb11f('0x13'));var qs=require(_0xb11f('0x14'));var as=require(_0xb11f('0x15'));var hardwareService=require(_0xb11f('0x16'));var logger=require(_0xb11f('0x17'))(_0xb11f('0x18'));var utils=require(_0xb11f('0x19'));var config=require(_0xb11f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb11f('0x1b'))['db'];var dbH=require(_0xb11f('0x1b'))[_0xb11f('0x1c')];function respondWithStatusCode(_0x5177ad,_0x40a2e3){_0x40a2e3=_0x40a2e3||0xcc;return function(_0x333360){if(_0x333360){return _0x5177ad[_0xb11f('0x1d')](_0x40a2e3);}return _0x5177ad[_0xb11f('0x1e')](_0x40a2e3)[_0xb11f('0x1f')]();};}function respondWithResult(_0x51e1c6,_0x193122){_0x193122=_0x193122||0xc8;return function(_0x2962e6){if(_0x2962e6){return _0x51e1c6[_0xb11f('0x1e')](_0x193122)[_0xb11f('0x20')](_0x2962e6);}};}function respondWithFilteredResult(_0x466f11,_0x15e48f){return function(_0x187a4f){if(_0x187a4f){var _0x3e4694=typeof _0x15e48f[_0xb11f('0x21')]===_0xb11f('0x22')&&typeof _0x15e48f[_0xb11f('0x23')]===_0xb11f('0x22');var _0x2dbb60=_0x187a4f[_0xb11f('0x24')];var _0x38df8b=_0x3e4694?0x0:_0x15e48f[_0xb11f('0x21')];var _0x14be34=_0x3e4694?_0x187a4f[_0xb11f('0x24')]:_0x15e48f[_0xb11f('0x21')]+_0x15e48f[_0xb11f('0x23')];var _0x317f53;if(_0x14be34>=_0x2dbb60){_0x14be34=_0x2dbb60;_0x317f53=0xc8;}else{_0x317f53=0xce;}_0x466f11[_0xb11f('0x1e')](_0x317f53);return _0x466f11['set'](_0xb11f('0x25'),_0x38df8b+'-'+_0x14be34+'/'+_0x2dbb60)[_0xb11f('0x20')](_0x187a4f);}return null;};}function patchUpdates(_0x3f1dd2){return function(_0x484c31){try{jsonpatch['apply'](_0x484c31,_0x3f1dd2,!![]);}catch(_0x4b13e3){return BPromise[_0xb11f('0x26')](_0x4b13e3);}return _0x484c31[_0xb11f('0x27')]();};}function saveUpdates(_0x2f11b9,_0x262bba){return function(_0x31d4e4){if(_0x31d4e4){return _0x31d4e4[_0xb11f('0x28')](_0x2f11b9)[_0xb11f('0x29')](function(_0x249ccb){return _0x249ccb;});}return null;};}function removeEntity(_0x2c5ad2,_0x21561e){return function(_0x2c42e1){if(_0x2c42e1){return _0x2c42e1[_0xb11f('0x2a')]()['then'](function(){var _0x31b137=_0x2c42e1['get']({'plain':!![]});var _0x4ccd02=_0xb11f('0x2b');return db[_0xb11f('0x2c')][_0xb11f('0x2a')]({'where':{'type':_0x4ccd02,'resourceId':_0x31b137['id']}})[_0xb11f('0x29')](function(){return _0x2c42e1;});})['then'](function(){_0x2c5ad2[_0xb11f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54be11,_0x14adf1){return function(_0x592c00){if(!_0x592c00){_0x54be11[_0xb11f('0x1d')](0x194);}return _0x592c00;};}function handleError(_0x3bb1a7,_0x5bd105){_0x5bd105=_0x5bd105||0x1f4;return function(_0x5113f8){logger[_0xb11f('0x2d')](_0x5113f8[_0xb11f('0x2e')]);if(_0x5113f8[_0xb11f('0x2f')]){delete _0x5113f8[_0xb11f('0x2f')];}_0x3bb1a7[_0xb11f('0x1e')](_0x5bd105)[_0xb11f('0x30')](_0x5113f8);};}exports['index']=function(_0x3b1d0f,_0x44f6ae){var _0x59efe7={},_0x59d8a9={},_0x4e7837={'count':0x0,'rows':[]};var _0x24a5dd=_[_0xb11f('0x31')](db['AnalyticCustomReport']['rawAttributes'],function(_0x4d63ef){return{'name':_0x4d63ef[_0xb11f('0x32')],'type':_0x4d63ef['type'][_0xb11f('0x33')]};});_0x59d8a9[_0xb11f('0x34')]=_[_0xb11f('0x31')](_0x24a5dd,_0xb11f('0x2f'));_0x59d8a9[_0xb11f('0x35')]=_[_0xb11f('0x36')](_0x3b1d0f[_0xb11f('0x35')]);_0x59d8a9['filters']=_[_0xb11f('0x37')](_0x59d8a9['model'],_0x59d8a9[_0xb11f('0x35')]);_0x59efe7[_0xb11f('0x38')]=_['intersection'](_0x59d8a9['model'],qs[_0xb11f('0x39')](_0x3b1d0f[_0xb11f('0x35')][_0xb11f('0x39')]));_0x59efe7[_0xb11f('0x38')]=_0x59efe7['attributes'][_0xb11f('0x3a')]?_0x59efe7[_0xb11f('0x38')]:_0x59d8a9[_0xb11f('0x34')];if(!_0x3b1d0f['query'][_0xb11f('0x3b')](_0xb11f('0x3c'))){_0x59efe7[_0xb11f('0x23')]=qs['limit'](_0x3b1d0f[_0xb11f('0x35')][_0xb11f('0x23')]);_0x59efe7[_0xb11f('0x21')]=qs[_0xb11f('0x21')](_0x3b1d0f[_0xb11f('0x35')]['offset']);}_0x59efe7['order']=qs[_0xb11f('0x3d')](_0x3b1d0f['query'][_0xb11f('0x3d')]);_0x59efe7[_0xb11f('0x3e')]=qs[_0xb11f('0x3f')](_[_0xb11f('0x40')](_0x3b1d0f[_0xb11f('0x35')],_0x59d8a9[_0xb11f('0x3f')]),_0x24a5dd);if(_0x3b1d0f[_0xb11f('0x35')][_0xb11f('0x41')]){_0x59efe7[_0xb11f('0x3e')]=_[_0xb11f('0x42')](_0x59efe7['where'],{'$or':_[_0xb11f('0x31')](_0x24a5dd,function(_0x2acac3){if(_0x2acac3[_0xb11f('0x43')]!==_0xb11f('0x44')){var _0x29c5e8={};_0x29c5e8[_0x2acac3[_0xb11f('0x2f')]]={'$like':'%'+_0x3b1d0f['query'][_0xb11f('0x41')]+'%'};return _0x29c5e8;}})});}_0x59efe7=_[_0xb11f('0x42')]({},_0x59efe7,_0x3b1d0f[_0xb11f('0x45')]);var _0x53051f={'where':_0x59efe7[_0xb11f('0x3e')]};return db['AnalyticCustomReport'][_0xb11f('0x24')](_0x53051f)['then'](function(_0x235091){_0x4e7837[_0xb11f('0x24')]=_0x235091;if(_0x3b1d0f[_0xb11f('0x35')][_0xb11f('0x46')]){_0x59efe7[_0xb11f('0x47')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xb11f('0x48')](_0x59efe7);})[_0xb11f('0x29')](function(_0x57206b){_0x4e7837[_0xb11f('0x49')]=_0x57206b;return _0x4e7837;})[_0xb11f('0x29')](respondWithFilteredResult(_0x44f6ae,_0x59efe7))[_0xb11f('0x4a')](handleError(_0x44f6ae,null));};exports[_0xb11f('0x4b')]=function(_0xd2cd95,_0x442b00){var _0x2212c4={'raw':![],'where':{'id':_0xd2cd95[_0xb11f('0x4c')]['id']}},_0x4baf4e={};_0x4baf4e['model']=_['keys'](db[_0xb11f('0x4d')][_0xb11f('0x4e')]);_0x4baf4e[_0xb11f('0x35')]=_[_0xb11f('0x36')](_0xd2cd95[_0xb11f('0x35')]);_0x4baf4e[_0xb11f('0x3f')]=_['intersection'](_0x4baf4e[_0xb11f('0x34')],_0x4baf4e[_0xb11f('0x35')]);_0x2212c4['attributes']=_[_0xb11f('0x37')](_0x4baf4e['model'],qs[_0xb11f('0x39')](_0xd2cd95[_0xb11f('0x35')][_0xb11f('0x39')]));_0x2212c4['attributes']=_0x2212c4[_0xb11f('0x38')]['length']?_0x2212c4[_0xb11f('0x38')]:_0x4baf4e[_0xb11f('0x34')];if(_0xd2cd95['query'][_0xb11f('0x46')]){_0x2212c4[_0xb11f('0x47')]=[{'all':!![]}];}_0x2212c4=_['merge']({},_0x2212c4,_0xd2cd95[_0xb11f('0x45')]);return db[_0xb11f('0x4d')][_0xb11f('0x4f')](_0x2212c4)[_0xb11f('0x29')](handleEntityNotFound(_0x442b00,null))[_0xb11f('0x29')](respondWithResult(_0x442b00,null))[_0xb11f('0x4a')](handleError(_0x442b00,null));};exports[_0xb11f('0x50')]=function(_0x351ee5,_0x2ce91e){return db[_0xb11f('0x4d')][_0xb11f('0x50')](_0x351ee5['body'],{})['then'](function(_0xf3cc2b){var _0x18eefb=_0x351ee5[_0xb11f('0x51')]['get']({'plain':!![]});if(!_0x18eefb)throw new Error(_0xb11f('0x52'));if(_0x18eefb[_0xb11f('0x53')]===_0xb11f('0x51')){var _0x1653e7=_0xf3cc2b['get']({'plain':!![]});var _0x492cef='Reports';return db[_0xb11f('0x54')][_0xb11f('0x4f')]({'where':{'name':_0x492cef,'userProfileId':_0x18eefb[_0xb11f('0x55')]},'raw':!![]})[_0xb11f('0x29')](function(_0x479815){if(_0x479815&&_0x479815[_0xb11f('0x56')]===0x0){return db['UserProfileResource'][_0xb11f('0x50')]({'name':_0x1653e7['name'],'resourceId':_0x1653e7['id'],'type':_0xb11f('0x2b'),'sectionId':_0x479815['id']},{})[_0xb11f('0x29')](function(){return _0xf3cc2b;});}else{return _0xf3cc2b;}})[_0xb11f('0x4a')](function(_0x5cb97f){logger[_0xb11f('0x2d')](_0xb11f('0x57'),_0x5cb97f);throw _0x5cb97f;});}return _0xf3cc2b;})['then'](respondWithResult(_0x2ce91e,0xc9))[_0xb11f('0x4a')](handleError(_0x2ce91e,null));};exports[_0xb11f('0x28')]=function(_0x3f032e,_0x593d17){if(_0x3f032e[_0xb11f('0x58')]['id']){delete _0x3f032e[_0xb11f('0x58')]['id'];}return db[_0xb11f('0x4d')][_0xb11f('0x4f')]({'where':{'id':_0x3f032e[_0xb11f('0x4c')]['id']}})[_0xb11f('0x29')](handleEntityNotFound(_0x593d17,null))[_0xb11f('0x29')](saveUpdates(_0x3f032e['body'],null))[_0xb11f('0x29')](respondWithResult(_0x593d17,null))[_0xb11f('0x4a')](handleError(_0x593d17,null));};exports[_0xb11f('0x2a')]=function(_0x3d8e8f,_0x1e2320){return db[_0xb11f('0x4d')][_0xb11f('0x4f')]({'where':{'id':_0x3d8e8f[_0xb11f('0x4c')]['id']}})[_0xb11f('0x29')](handleEntityNotFound(_0x1e2320,null))[_0xb11f('0x29')](removeEntity(_0x1e2320,null))['catch'](handleError(_0x1e2320,null));};exports[_0xb11f('0x59')]=function(_0x25ec45,_0x9fa56f){var _0x34421b=0xa;var _0x5e5dbb=[_0xb11f('0x5a'),'left_join',_0xb11f('0x5b'),'cross_join'];var _0x5a1eef={'SUM':_0xb11f('0x5c'),'COUNT':_0xb11f('0x5d'),'COUNT DISTINCT':_0xb11f('0x5e'),'MAX':_0xb11f('0x5f'),'MIN':_0xb11f('0x60'),'AVG':_0xb11f('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb11f('0x62')};var _0x3d9b24={'SEC_TO_TIME':_0xb11f('0x63'),'DATE':_0xb11f('0x64'),'HOUR':_0xb11f('0x65'),'ROUND':_0xb11f('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1985ad=function(_0x26174a){return!_[_0xb11f('0x67')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb11f('0x68'),'IS\x20NOT\x20EMPTY'],_0x26174a);};var _0x340531=function(_0xaf67f){if(!_0xaf67f||!_0xaf67f[_0xb11f('0x69')][_0xb11f('0x3a')]){return'';}for(var _0x4997fc='(',_0x49fc47=0x0;_0x49fc47<_0xaf67f['rules'][_0xb11f('0x3a')];_0x49fc47+=0x1){_0x49fc47>0x0&&(_0x4997fc+='\x20'+_0xaf67f[_0xb11f('0x6a')]+'\x20');_0x4997fc+=_0xaf67f[_0xb11f('0x69')][_0x49fc47][_0xb11f('0x6b')]?_0x340531(_0xaf67f[_0xb11f('0x69')][_0x49fc47][_0xb11f('0x6b')]):_0xaf67f[_0xb11f('0x69')][_0x49fc47]['field']+'\x20'+_0xaf67f[_0xb11f('0x69')][_0x49fc47][_0xb11f('0x6c')]+(_0x1985ad(_0xaf67f[_0xb11f('0x69')][_0x49fc47][_0xb11f('0x6c')])?'\x20'+_0xaf67f['rules'][_0x49fc47][_0xb11f('0x6d')]:'');}return _0x4997fc+')';};var _0x314fa1={'where':{'id':_0x25ec45['params']['id']}},_0x3f7f96,_0x40692a,_0x56f0ad,_0x1cebe0,_0x4202b9;_0x314fa1=_[_0xb11f('0x42')]({},_0x314fa1,_0x25ec45[_0xb11f('0x45')]);return db[_0xb11f('0x4d')][_0xb11f('0x4f')](_0x314fa1)[_0xb11f('0x29')](function(_0x55ea29){if(_0x55ea29){_0x3f7f96=_0x55ea29;return _0x55ea29[_0xb11f('0x6e')]();}return null;})[_0xb11f('0x29')](function(_0x14db42){if(_0x14db42){if(!_0x14db42[_0xb11f('0x3a')]){throw new db[(_0xb11f('0x6f'))][(_0xb11f('0x70'))](_0xb11f('0x71'),0x193);}_0x40692a=_0x14db42;return db[_0xb11f('0x72')][_0xb11f('0x48')]({'raw':!![]});}return null;})[_0xb11f('0x29')](function(_0x34dd7e){if(_0x34dd7e){_0x56f0ad=_[_0xb11f('0x73')](_0x34dd7e,'id');var _0x5bd649;var _0x408b24=squel[_0xb11f('0x74')]();_0x408b24[_0xb11f('0x75')](_0x3f7f96[_0xb11f('0x76')]);for(var _0x3284f6=0x0;_0x3284f6<_0x40692a['length'];_0x3284f6+=0x1){_0x5bd649=_0x40692a[_0x3284f6][_0xb11f('0x77')]?_0x56f0ad[_0x40692a[_0x3284f6]['MetricId']][_0xb11f('0x78')]:_0x40692a[_0x3284f6][_0xb11f('0x79')];_0x5bd649=_0x40692a[_0x3284f6][_0xb11f('0x7a')]?_[_0xb11f('0x7b')](_0x5a1eef[_0x40692a[_0x3284f6][_0xb11f('0x7a')]],'%s',_0x5bd649):_0x5bd649;_0x5bd649=_0x40692a[_0x3284f6][_0xb11f('0x7c')]?_[_0xb11f('0x7b')](_0x3d9b24[_0x40692a[_0x3284f6][_0xb11f('0x7c')]],'%s',_0x5bd649):_0x5bd649;if(_0x40692a[_0x3284f6][_0xb11f('0x7d')]){_0x408b24[_0xb11f('0x6b')](_0x5bd649);}_0x40692a[_0x3284f6][_0xb11f('0x7e')]&&_0x408b24[_0xb11f('0x7f')](_0x5bd649,_0x40692a[_0x3284f6]['orderBy']==='DESC'?![]:!![]);_0x408b24[_0xb11f('0x79')](_0x5bd649,_0x40692a[_0x3284f6][_0xb11f('0x80')]||_0x5bd649);}if(_0x3f7f96[_0xb11f('0x81')]){_0x3f7f96['joins']=JSON[_0xb11f('0x82')](_0x3f7f96[_0xb11f('0x81')]);for(var _0x472f09=0x0;_0x472f09<_0x3f7f96['joins'][_0xb11f('0x3a')];_0x472f09+=0x1){if(_0x3f7f96['joins'][_0x472f09][_0xb11f('0x43')]&&_['includes'](_0x5e5dbb,_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x43')])&&_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x83')]&&_0x3f7f96[_0xb11f('0x81')][_0x472f09]['foreignTable']&&_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x84')]){_0x408b24[_0x3f7f96[_0xb11f('0x81')][_0x472f09]['type']](_0x3f7f96['joins'][_0x472f09]['foreignTable'],null,util[_0xb11f('0x7c')]('%s.%s\x20=\x20%s.%s',_0x3f7f96['table'],_0x3f7f96[_0xb11f('0x81')][_0x472f09]['parentKey'],_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x85')],_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x84')]));}}}if(_0x3f7f96[_0xb11f('0x86')]){_0x3f7f96[_0xb11f('0x86')]=JSON[_0xb11f('0x82')](_0x3f7f96[_0xb11f('0x86')]);_0x408b24[_0xb11f('0x3e')](_0x340531(_0x3f7f96[_0xb11f('0x86')][_0xb11f('0x6b')]));}_0x4202b9=_0x408b24['clone']();_0x408b24[_0xb11f('0x23')](_0x34421b);_0x408b24['offset'](0x0);logger[_0xb11f('0x87')](_0xb11f('0x88'),_0x408b24['toString']());return dbH[_0xb11f('0x89')]['query'](_0x408b24[_0xb11f('0x8a')](),{'type':dbH[_0xb11f('0x89')][_0xb11f('0x8b')]['SELECT']});}})[_0xb11f('0x29')](respondWithResult(_0x9fa56f,null))[_0xb11f('0x4a')](handleError(_0x9fa56f,null));};function runReport(_0x145462,_0x3f860e,_0x4a46f4){var _0x5757e7=_0x3f860e[_0xb11f('0x2f')];var _0x398ebf=0xa;var _0x19f64a=[_0xb11f('0x5a'),_0xb11f('0x8c'),_0xb11f('0x5b'),'cross_join'];var _0x454310={'SUM':_0xb11f('0x5c'),'COUNT':_0xb11f('0x5d'),'COUNT DISTINCT':_0xb11f('0x5e'),'MAX':_0xb11f('0x5f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xb11f('0x8d'),'GROUP_CONCAT ASC':_0xb11f('0x8e'),'GROUP_CONCAT DESC':_0xb11f('0x62')};var _0x1dc041={'SEC_TO_TIME':_0xb11f('0x63'),'DATE':_0xb11f('0x64'),'HOUR':_0xb11f('0x65'),'ROUND':_0xb11f('0x66'),'UNIX_TIMESTAMP':_0xb11f('0x8f')};var _0x2fac8e=function(_0x10b162){return!_[_0xb11f('0x67')]([_0xb11f('0x90'),_0xb11f('0x91'),_0xb11f('0x68'),_0xb11f('0x92')],_0x10b162);};var _0x7f8c97=function(_0x15780b){if(!_0x15780b||!_0x15780b[_0xb11f('0x69')][_0xb11f('0x3a')]){return'';}for(var _0x2ace1f='(',_0x1ef2b1=0x0;_0x1ef2b1<_0x15780b[_0xb11f('0x69')][_0xb11f('0x3a')];_0x1ef2b1+=0x1){_0x1ef2b1>0x0&&(_0x2ace1f+='\x20'+_0x15780b[_0xb11f('0x6a')]+'\x20');_0x2ace1f+=_0x15780b[_0xb11f('0x69')][_0x1ef2b1][_0xb11f('0x6b')]?_0x7f8c97(_0x15780b['rules'][_0x1ef2b1]['group']):_0x15780b[_0xb11f('0x69')][_0x1ef2b1]['field']+'\x20'+_0x15780b[_0xb11f('0x69')][_0x1ef2b1][_0xb11f('0x6c')]+(_0x2fac8e(_0x15780b[_0xb11f('0x69')][_0x1ef2b1]['condition'])?'\x20'+_0x15780b[_0xb11f('0x69')][_0x1ef2b1]['value']:'');}return _0x2ace1f+')';};var _0x58b5f5={'where':{'id':_0x145462['id']}},_0x4b28c2,_0x39035c,_0x3527af,_0x33df96,_0x2ab825;_0x58b5f5=_['merge']({},_0x58b5f5,_0x4a46f4);return db[_0xb11f('0x4d')][_0xb11f('0x4f')](_0x58b5f5)[_0xb11f('0x29')](function(_0x363424){if(_0x363424){_0x4b28c2=_0x363424;return _0x363424[_0xb11f('0x6e')]();}return null;})[_0xb11f('0x29')](function(_0xa10855){if(_0xa10855){if(!_0xa10855[_0xb11f('0x3a')]){throw new db[(_0xb11f('0x6f'))][(_0xb11f('0x70'))](_0xb11f('0x71'),0x193);}_0x39035c=_0xa10855;return db[_0xb11f('0x72')]['findAll']({'raw':!![]});}return null;})[_0xb11f('0x29')](function(_0x2bc50a){if(_0x2bc50a){_0x3527af=_[_0xb11f('0x73')](_0x2bc50a,'id');var _0x15fadb;var _0x101ac4=squel[_0xb11f('0x74')]();_0x101ac4[_0xb11f('0x75')](_0x4b28c2[_0xb11f('0x76')]);for(var _0x19d190=0x0;_0x19d190<_0x39035c[_0xb11f('0x3a')];_0x19d190+=0x1){_0x15fadb=_0x39035c[_0x19d190][_0xb11f('0x77')]?_0x3527af[_0x39035c[_0x19d190][_0xb11f('0x77')]][_0xb11f('0x78')]:_0x39035c[_0x19d190]['field'];_0x15fadb=_0x39035c[_0x19d190][_0xb11f('0x7a')]?_['replace'](_0x454310[_0x39035c[_0x19d190][_0xb11f('0x7a')]],'%s',_0x15fadb):_0x15fadb;_0x15fadb=_0x39035c[_0x19d190][_0xb11f('0x7c')]?_['replace'](_0x1dc041[_0x39035c[_0x19d190][_0xb11f('0x7c')]],'%s',_0x15fadb):_0x15fadb;if(_0x39035c[_0x19d190][_0xb11f('0x7d')]){_0x101ac4[_0xb11f('0x6b')](_0x15fadb);}_0x39035c[_0x19d190][_0xb11f('0x7e')]&&_0x101ac4[_0xb11f('0x7f')](_0x15fadb,_0x39035c[_0x19d190][_0xb11f('0x7e')]==='DESC'?![]:!![]);_0x101ac4[_0xb11f('0x79')](_0x15fadb,_0x39035c[_0x19d190][_0xb11f('0x80')]||_0x15fadb);}if(_0x4b28c2[_0xb11f('0x81')]){_0x4b28c2[_0xb11f('0x81')]=JSON[_0xb11f('0x82')](_0x4b28c2[_0xb11f('0x81')]);for(var _0x5f522f=0x0;_0x5f522f<_0x4b28c2[_0xb11f('0x81')][_0xb11f('0x3a')];_0x5f522f+=0x1){if(_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x43')]&&_[_0xb11f('0x67')](_0x19f64a,_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x43')])&&_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x83')]&&_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x85')]&&_0x4b28c2['joins'][_0x5f522f][_0xb11f('0x84')]){_0x101ac4[_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x43')]](_0x4b28c2[_0xb11f('0x81')][_0x5f522f]['foreignTable'],null,util['format'](_0xb11f('0x93'),_0x4b28c2[_0xb11f('0x76')],_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x83')],_0x4b28c2[_0xb11f('0x81')][_0x5f522f]['foreignTable'],_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x84')]));}}}if(_0x4b28c2['conditions']){_0x4b28c2[_0xb11f('0x86')]=JSON[_0xb11f('0x82')](_0x4b28c2[_0xb11f('0x86')]);_0x101ac4[_0xb11f('0x3e')](_0x7f8c97(_0x4b28c2['conditions'][_0xb11f('0x6b')]));}_0x2ab825=_0x101ac4[_0xb11f('0x94')]();_0x101ac4[_0xb11f('0x23')](_0x398ebf);_0x101ac4['offset'](0x0);return;}})['then'](function(){if(_0x3f860e[_0xb11f('0x95')]===_0xb11f('0x96')){return null;}var _0x38b26f=_['merge'](_0x3f860e,{'name':_0x3f860e[_0xb11f('0x97')]||_0x3f860e['name']||_0x4b28c2['name'],'basename':_0x5757e7,'savename':util['format'](_0xb11f('0x98'),_0x3f860e[_0xb11f('0x2f')]||_0x4b28c2[_0xb11f('0x2f')],require(_0xb11f('0x99'))[_0xb11f('0x9a')](0x4),_0x3f860e['output']||_0xb11f('0x9b')),'reportId':_0x4b28c2['id'],'reportType':_0xb11f('0x9c')});return db[_0xb11f('0x9d')][_0xb11f('0x50')](_0x38b26f,{'raw':!![]});})['then'](function(_0x105c96){if(_0x4b28c2[_0xb11f('0x76')]==='cdr'){_0x2ab825[_0xb11f('0x3e')](_0x4b28c2[_0xb11f('0x76')]+_0xb11f('0x9e'),_0x3f860e[_0xb11f('0x9f')],_0x3f860e[_0xb11f('0xa0')]);}else{_0x2ab825['where'](_0x4b28c2[_0xb11f('0x76')]+_0xb11f('0xa1'),_0x3f860e[_0xb11f('0x9f')],_0x3f860e[_0xb11f('0xa0')]);}if(_0x105c96){logger[_0xb11f('0xa2')](_0xb11f('0xa3'),_0x2ab825[_0xb11f('0x8a')]());require(_0xb11f('0xa4'))['fork'](path[_0xb11f('0x5a')](__dirname,'../../components/export/',_0x105c96['output']),[_0x105c96['id'],_0x2ab825['toString'](),path[_0xb11f('0x5a')](__dirname,'../../files/reports',_0x105c96[_0xb11f('0xa5')]),_0x5757e7]);return _0x105c96;}else{var _0x16dfb9=squel['select']();_0x16dfb9['from']('('+_0x2ab825[_0xb11f('0x8a')]()+')','countTable');_0x16dfb9[_0xb11f('0x79')](_0xb11f('0xa6'),_0xb11f('0x24'));_0x2ab825[_0xb11f('0x23')](_0x3f860e[_0xb11f('0x23')]||_0x398ebf);_0x2ab825['offset'](_0x3f860e[_0xb11f('0x21')]||0x0);return dbH[_0xb11f('0x89')][_0xb11f('0x35')](_0x16dfb9[_0xb11f('0x8a')](),{'type':dbH[_0xb11f('0x89')][_0xb11f('0x8b')]['SELECT']})[_0xb11f('0x29')](function(_0xb1b446){if(!_0xb1b446[_0xb11f('0x3a')]){_0x33df96=0x0;}else{_0x33df96=_0xb1b446[0x0]['count']||0x0;}return dbH['sequelize'][_0xb11f('0x35')](_0x2ab825[_0xb11f('0x8a')](),{'type':dbH[_0xb11f('0x89')][_0xb11f('0x8b')][_0xb11f('0xa7')]});})[_0xb11f('0x29')](function(_0x4c6ea3){return{'rows':_0x4c6ea3||[],'count':_0x33df96};});}});}exports[_0xb11f('0xa8')]=function(_0x3d3b8a,_0x39566d){return runReport(_0x3d3b8a[_0xb11f('0x4c')],_0x3d3b8a[_0xb11f('0x35')],_0x3d3b8a['options'])[_0xb11f('0x29')](respondWithResult(_0x39566d,null))[_0xb11f('0x4a')](handleError(_0x39566d,null));};exports[_0xb11f('0xa9')]=runReport;exports['query']=function(_0x26f696,_0x3f1bfb){var _0x1f6011=0xa;var _0x36c97f=['join','left_join',_0xb11f('0x5b'),_0xb11f('0xaa')];var _0x48e2f5={'SUM':_0xb11f('0x5c'),'COUNT':_0xb11f('0x5d'),'COUNT DISTINCT':_0xb11f('0x5e'),'MAX':_0xb11f('0x5f'),'MIN':_0xb11f('0x60'),'AVG':_0xb11f('0x61'),'GROUP_CONCAT':_0xb11f('0x8d'),'GROUP_CONCAT ASC':_0xb11f('0x8e'),'GROUP_CONCAT DESC':_0xb11f('0x62')};var _0x3ffe4c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb11f('0x64'),'HOUR':_0xb11f('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb11f('0x8f')};var _0x1def94=function(_0x4829c3){return!_[_0xb11f('0x67')]([_0xb11f('0x90'),_0xb11f('0x91'),_0xb11f('0x68'),'IS\x20NOT\x20EMPTY'],_0x4829c3);};var _0x3aa1dd=function(_0x3f0ece){if(!_0x3f0ece||!_0x3f0ece[_0xb11f('0x69')][_0xb11f('0x3a')]){return'';}for(var _0x583ee7='(',_0x5e15da=0x0;_0x5e15da<_0x3f0ece[_0xb11f('0x69')][_0xb11f('0x3a')];_0x5e15da+=0x1){_0x5e15da>0x0&&(_0x583ee7+='\x20'+_0x3f0ece[_0xb11f('0x6a')]+'\x20');_0x583ee7+=_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6b')]?_0x3aa1dd(_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6b')]):_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x79')]+'\x20'+_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6c')]+(_0x1def94(_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6c')])?'\x20'+_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6d')]:'');}return _0x583ee7+')';};var _0x265410={'where':{'id':_0x26f696[_0xb11f('0x4c')]['id']}},_0x2d0970,_0x46eb9a,_0x41c4e1,_0x5a79a3,_0x2106dd;_0x265410=_[_0xb11f('0x42')]({},_0x265410,_0x26f696[_0xb11f('0x45')]);return db[_0xb11f('0x4d')][_0xb11f('0x4f')](_0x265410)[_0xb11f('0x29')](function(_0x240f64){if(_0x240f64){_0x2d0970=_0x240f64;return _0x240f64[_0xb11f('0x6e')]();}return null;})['then'](function(_0x23875a){if(_0x23875a){if(!_0x23875a[_0xb11f('0x3a')]){throw new db['Sequelize'][(_0xb11f('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x46eb9a=_0x23875a;return db[_0xb11f('0x72')][_0xb11f('0x48')]({'raw':!![]});}return null;})[_0xb11f('0x29')](function(_0x241a71){if(_0x241a71){_0x41c4e1=_[_0xb11f('0x73')](_0x241a71,'id');var _0x44298;var _0x2ff93e=squel[_0xb11f('0x74')]();_0x2ff93e[_0xb11f('0x75')](_0x2d0970[_0xb11f('0x76')]);for(var _0x47cfa2=0x0;_0x47cfa2<_0x46eb9a['length'];_0x47cfa2+=0x1){_0x44298=_0x46eb9a[_0x47cfa2][_0xb11f('0x77')]?_0x41c4e1[_0x46eb9a[_0x47cfa2][_0xb11f('0x77')]][_0xb11f('0x78')]:_0x46eb9a[_0x47cfa2][_0xb11f('0x79')];_0x44298=_0x46eb9a[_0x47cfa2]['function']?_['replace'](_0x48e2f5[_0x46eb9a[_0x47cfa2]['function']],'%s',_0x44298):_0x44298;_0x44298=_0x46eb9a[_0x47cfa2][_0xb11f('0x7c')]?_[_0xb11f('0x7b')](_0x3ffe4c[_0x46eb9a[_0x47cfa2][_0xb11f('0x7c')]],'%s',_0x44298):_0x44298;if(_0x46eb9a[_0x47cfa2][_0xb11f('0x7d')]){_0x2ff93e[_0xb11f('0x6b')](_0x44298);}_0x46eb9a[_0x47cfa2][_0xb11f('0x7e')]&&_0x2ff93e[_0xb11f('0x7f')](_0x44298,_0x46eb9a[_0x47cfa2][_0xb11f('0x7e')]===_0xb11f('0xab')?![]:!![]);_0x2ff93e['field'](_0x44298,_0x46eb9a[_0x47cfa2][_0xb11f('0x80')]||_0x44298);}if(_0x2d0970[_0xb11f('0x81')]){_0x2d0970[_0xb11f('0x81')]=JSON[_0xb11f('0x82')](_0x2d0970[_0xb11f('0x81')]);for(var _0x198c5a=0x0;_0x198c5a<_0x2d0970[_0xb11f('0x81')][_0xb11f('0x3a')];_0x198c5a+=0x1){if(_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x43')]&&_['includes'](_0x36c97f,_0x2d0970['joins'][_0x198c5a][_0xb11f('0x43')])&&_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x83')]&&_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x85')]&&_0x2d0970['joins'][_0x198c5a][_0xb11f('0x84')]){_0x2ff93e[_0x2d0970['joins'][_0x198c5a][_0xb11f('0x43')]](_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x85')],null,util[_0xb11f('0x7c')](_0xb11f('0x93'),_0x2d0970[_0xb11f('0x76')],_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x83')],_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x85')],_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x84')]));}}}if(_0x2d0970[_0xb11f('0x86')]){_0x2d0970[_0xb11f('0x86')]=JSON[_0xb11f('0x82')](_0x2d0970[_0xb11f('0x86')]);_0x2ff93e['where'](_0x3aa1dd(_0x2d0970['conditions'][_0xb11f('0x6b')]));}_0x2106dd=_0x2ff93e[_0xb11f('0x94')]();_0x2ff93e[_0xb11f('0x23')](_0x1f6011);_0x2ff93e['offset'](0x0);logger[_0xb11f('0x87')](_0xb11f('0x88'),_0x2ff93e['toString']());return dbH[_0xb11f('0x89')][_0xb11f('0x35')](_0x2ff93e['toString'](),{'type':dbH[_0xb11f('0x89')][_0xb11f('0x8b')]['SELECT']});}})[_0xb11f('0x29')](function(){return{'sql':_0x2106dd['toString']()};})['then'](respondWithResult(_0x3f1bfb,null))[_0xb11f('0x4a')](handleError(_0x3f1bfb,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bd373e3..8c41add 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 _0x6232=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','lodash'];(function(_0x4693b7,_0xdc6f8a){var _0x23fba2=function(_0x35d758){while(--_0x35d758){_0x4693b7['push'](_0x4693b7['shift']());}};_0x23fba2(++_0xdc6f8a);}(_0x6232,0x16a));var _0x2623=function(_0x345f35,_0x354c87){_0x345f35=_0x345f35-0x0;var _0x457ec4=_0x6232[_0x345f35];return _0x457ec4;};'use strict';var _=require(_0x2623('0x0'));var util=require('util');var logger=require(_0x2623('0x1'))(_0x2623('0x2'));var moment=require('moment');var BPromise=require(_0x2623('0x3'));var rp=require(_0x2623('0x4'));var fs=require('fs');var path=require(_0x2623('0x5'));var rimraf=require(_0x2623('0x6'));var config=require(_0x2623('0x7'));var attributes=require(_0x2623('0x8'));module[_0x2623('0x9')]=function(_0x53bfa5,_0x53987b){return _0x53bfa5[_0x2623('0xa')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda7b=['./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x23fc4b,_0x2602f8){var _0x9d10c1=function(_0x14096b){while(--_0x14096b){_0x23fc4b['push'](_0x23fc4b['shift']());}};_0x9d10c1(++_0x2602f8);}(_0xda7b,0x1f3));var _0xbda7=function(_0x4bfd80,_0x34ce14){_0x4bfd80=_0x4bfd80-0x0;var _0x920c6c=_0xda7b[_0x4bfd80];return _0x920c6c;};'use strict';var _=require(_0xbda7('0x0'));var util=require('util');var logger=require(_0xbda7('0x1'))('api');var moment=require(_0xbda7('0x2'));var BPromise=require(_0xbda7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbda7('0x4'));var rimraf=require(_0xbda7('0x5'));var config=require(_0xbda7('0x6'));var attributes=require(_0xbda7('0x7'));module[_0xbda7('0x8')]=function(_0x2fa8d3,_0x1ff07c){return _0x2fa8d3[_0xbda7('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xbda7('0xa'),'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 010bac8..b85feef 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 _0x612e=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x612e,0xfc));var _0xe612=function(_0x19cebc,_0x1d886b){_0x19cebc=_0x19cebc-0x0;var _0x5f0441=_0x612e[_0x19cebc];return _0x5f0441;};'use strict';var _=require(_0xe612('0x0'));var util=require('util');var moment=require(_0xe612('0x1'));var BPromise=require(_0xe612('0x2'));var rs=require(_0xe612('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe612('0x4'))['db'];var utils=require(_0xe612('0x5'));var logger=require(_0xe612('0x6'))(_0xe612('0x7'));var config=require(_0xe612('0x8'));var jayson=require(_0xe612('0x9'));var client=jayson[_0xe612('0xa')][_0xe612('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x323688,_0x409145,_0x4e55d6){return new BPromise(function(_0x5156fb,_0x365553){return client[_0xe612('0xc')](_0x323688,_0x4e55d6)[_0xe612('0xd')](function(_0x55be4c){logger[_0xe612('0xe')](_0xe612('0xf'),_0x409145,_0xe612('0x10'));logger['debug'](_0xe612('0x11'),_0x409145,'request\x20sent',JSON[_0xe612('0x12')](_0x55be4c));if(_0x55be4c[_0xe612('0x13')]){if(_0x55be4c[_0xe612('0x13')][_0xe612('0x14')]===0x1f4){logger[_0xe612('0x13')](_0xe612('0xf'),_0x409145,_0x55be4c[_0xe612('0x13')]['message']);return _0x365553(_0x55be4c[_0xe612('0x13')][_0xe612('0x15')]);}logger[_0xe612('0x13')](_0xe612('0xf'),_0x409145,_0x55be4c['error'][_0xe612('0x15')]);return _0x5156fb(_0x55be4c[_0xe612('0x13')][_0xe612('0x15')]);}else{logger[_0xe612('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x409145,_0xe612('0x10'));_0x5156fb(_0x55be4c[_0xe612('0x16')]['message']);}})[_0xe612('0x17')](function(_0x10c8d9){logger[_0xe612('0x13')](_0xe612('0xf'),_0x409145,_0x10c8d9);_0x365553(_0x10c8d9);});});} \ No newline at end of file +var _0x91c5=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x91c5,0x1ae));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x591c('0x0'));var util=require(_0x591c('0x1'));var moment=require('moment');var BPromise=require(_0x591c('0x2'));var rs=require(_0x591c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x591c('0x4'))['db'];var utils=require(_0x591c('0x5'));var logger=require(_0x591c('0x6'))(_0x591c('0x7'));var config=require(_0x591c('0x8'));var jayson=require(_0x591c('0x9'));var client=jayson[_0x591c('0xa')][_0x591c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53b554,_0xba6cfe,_0x1e2569){return new BPromise(function(_0x3888bc,_0x496def){return client[_0x591c('0xc')](_0x53b554,_0x1e2569)[_0x591c('0xd')](function(_0x8ffeb1){logger[_0x591c('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0xba6cfe,_0x591c('0xf'));logger[_0x591c('0x10')](_0x591c('0x11'),_0xba6cfe,_0x591c('0xf'),JSON['stringify'](_0x8ffeb1));if(_0x8ffeb1[_0x591c('0x12')]){if(_0x8ffeb1[_0x591c('0x12')][_0x591c('0x13')]===0x1f4){logger['error'](_0x591c('0x14'),_0xba6cfe,_0x8ffeb1['error'][_0x591c('0x15')]);return _0x496def(_0x8ffeb1[_0x591c('0x12')][_0x591c('0x15')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xba6cfe,_0x8ffeb1[_0x591c('0x12')][_0x591c('0x15')]);return _0x3888bc(_0x8ffeb1[_0x591c('0x12')][_0x591c('0x15')]);}else{logger['info'](_0x591c('0x14'),_0xba6cfe,_0x591c('0xf'));_0x3888bc(_0x8ffeb1[_0x591c('0x16')]['message']);}})[_0x591c('0x17')](function(_0x355469){logger[_0x591c('0x12')](_0x591c('0x14'),_0xba6cfe,_0x355469);_0x496def(_0x355469);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index de3b483..36b48d1 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 _0xb925=['get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x16724a,_0x403ef8){var _0x1df0ae=function(_0x30974d){while(--_0x30974d){_0x16724a['push'](_0x16724a['shift']());}};_0x1df0ae(++_0x403ef8);}(_0xb925,0x6f));var _0x5b92=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xb925[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x5b92('0x0'));var util=require(_0x5b92('0x1'));var path=require(_0x5b92('0x2'));var timeout=require(_0x5b92('0x3'));var express=require(_0x5b92('0x4'));var router=express[_0x5b92('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b92('0x6'));var interaction=require(_0x5b92('0x7'));var config=require(_0x5b92('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x5b92('0x9')]('/',auth[_0x5b92('0xa')](),controller[_0x5b92('0xb')]);router[_0x5b92('0x9')](_0x5b92('0xc'),auth[_0x5b92('0xa')](),controller['show']);router[_0x5b92('0x9')](_0x5b92('0xd'),auth[_0x5b92('0xa')](),controller[_0x5b92('0xe')]);router[_0x5b92('0x9')](_0x5b92('0xf'),auth['isAuthenticated'](),controller[_0x5b92('0x10')]);router['get'](_0x5b92('0x11'),auth[_0x5b92('0xa')](),controller[_0x5b92('0x12')]);router['post']('/',auth[_0x5b92('0xa')](),controller['create']);router[_0x5b92('0x13')](_0x5b92('0xc'),auth[_0x5b92('0xa')](),controller[_0x5b92('0x14')]);router[_0x5b92('0x15')](_0x5b92('0xc'),auth[_0x5b92('0xa')](),controller[_0x5b92('0x16')]);module[_0x5b92('0x17')]=router; \ No newline at end of file +var _0x90e0=['/:id/preview','preview','/:id/run','/:id/query','query','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0xa787cb,_0x1b48c7){var _0x5964f8=function(_0x390d65){while(--_0x390d65){_0xa787cb['push'](_0xa787cb['shift']());}};_0x5964f8(++_0x1b48c7);}(_0x90e0,0x153));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x090e('0x0'));var util=require(_0x090e('0x1'));var path=require('path');var timeout=require(_0x090e('0x2'));var express=require(_0x090e('0x3'));var router=express[_0x090e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x090e('0x5'));var config=require(_0x090e('0x6'));var controller=require(_0x090e('0x7'));router['get']('/',auth[_0x090e('0x8')](),controller[_0x090e('0x9')]);router[_0x090e('0xa')](_0x090e('0xb'),auth[_0x090e('0x8')](),controller[_0x090e('0xc')]);router[_0x090e('0xa')](_0x090e('0xd'),auth[_0x090e('0x8')](),controller[_0x090e('0xe')]);router['get'](_0x090e('0xf'),auth[_0x090e('0x8')](),controller['run']);router[_0x090e('0xa')](_0x090e('0x10'),auth['isAuthenticated'](),controller[_0x090e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x090e('0x12')](_0x090e('0xb'),auth['isAuthenticated'](),controller[_0x090e('0x13')]);router[_0x090e('0x14')](_0x090e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x090e('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 63a70ab..2b2a457 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 _0x3eea=['STRING','TEXT','sequelize'];(function(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1b9f81,_0x3b6131){_0x1b9f81=_0x1b9f81-0x0;var _0x1c64e4=_0x3eea[_0x1b9f81];return _0x1c64e4;};'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 +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x46ed,0x168));var _0xd46e=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x46ed[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index cbfcde3..c8a9ed0 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 _0x687b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x534fb9,_0x466466){_0x534fb9=_0x534fb9-0x0;var _0x57d679=_0x687b[_0x534fb9];return _0x57d679;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file +var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x5b9168,_0x203c8a){var _0x1c8403=function(_0x59b381){while(--_0x59b381){_0x5b9168['push'](_0x5b9168['shift']());}};_0x1c8403(++_0x203c8a);}(_0xba34,0x119));var _0x4ba3=function(_0x55a269,_0x3be6d9){_0x55a269=_0x55a269-0x0;var _0x29968a=_0xba34[_0x55a269];return _0x29968a;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index eb66b13..cb0345e 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 _0x62a5=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x62a5,0x1d5));var _0x562a=function(_0x3b8c1e,_0x2e5b4b){_0x3b8c1e=_0x3b8c1e-0x0;var _0x41116b=_0x62a5[_0x3b8c1e];return _0x41116b;};'use strict';var _=require(_0x562a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x562a('0x1'));var moment=require(_0x562a('0x2'));var BPromise=require(_0x562a('0x3'));var rp=require(_0x562a('0x4'));var fs=require('fs');var path=require(_0x562a('0x5'));var rimraf=require(_0x562a('0x6'));var config=require(_0x562a('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x562a('0x8')]=function(_0x47b23f,_0x2fb1ed){return _0x47b23f[_0x562a('0x9')](_0x562a('0xa'),attributes,{'tableName':_0x562a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb1f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x4f0dc8,_0xb40b72){var _0x240785=function(_0x590c2d){while(--_0x590c2d){_0x4f0dc8['push'](_0x4f0dc8['shift']());}};_0x240785(++_0xb40b72);}(_0xdb1f,0x128));var _0xfdb1=function(_0x34b7e0,_0x2f90f2){_0x34b7e0=_0x34b7e0-0x0;var _0x320937=_0xdb1f[_0x34b7e0];return _0x320937;};'use strict';var _=require(_0xfdb1('0x0'));var util=require(_0xfdb1('0x1'));var logger=require(_0xfdb1('0x2'))('api');var moment=require(_0xfdb1('0x3'));var BPromise=require(_0xfdb1('0x4'));var rp=require(_0xfdb1('0x5'));var fs=require('fs');var path=require(_0xfdb1('0x6'));var rimraf=require(_0xfdb1('0x7'));var config=require(_0xfdb1('0x8'));var attributes=require(_0xfdb1('0x9'));module[_0xfdb1('0xa')]=function(_0x3aff69,_0x423aab){return _0x3aff69[_0xfdb1('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0xfdb1('0xc'),'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 e8a127d..4ffc9ca 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 _0xf9e2=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0xf9e2,0x16f));var _0x2f9e=function(_0x352605,_0x1472ac){_0x352605=_0x352605-0x0;var _0x2d1220=_0xf9e2[_0x352605];return _0x2d1220;};'use strict';var _=require('lodash');var util=require(_0x2f9e('0x0'));var moment=require('moment');var BPromise=require(_0x2f9e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f9e('0x2'));var db=require(_0x2f9e('0x3'))['db'];var utils=require(_0x2f9e('0x4'));var logger=require(_0x2f9e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2f9e('0x6'));var client=jayson[_0x2f9e('0x7')][_0x2f9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24d820,_0x4bbb20,_0x3a9203){return new BPromise(function(_0x5d37ad,_0x379d03){return client[_0x2f9e('0x9')](_0x24d820,_0x3a9203)[_0x2f9e('0xa')](function(_0x22c715){logger[_0x2f9e('0xb')](_0x2f9e('0xc'),_0x4bbb20,_0x2f9e('0xd'));logger[_0x2f9e('0xe')](_0x2f9e('0xf'),_0x4bbb20,'request\x20sent',JSON[_0x2f9e('0x10')](_0x22c715));if(_0x22c715[_0x2f9e('0x11')]){if(_0x22c715['error']['code']===0x1f4){logger['error'](_0x2f9e('0xc'),_0x4bbb20,_0x22c715['error'][_0x2f9e('0x12')]);return _0x379d03(_0x22c715[_0x2f9e('0x11')]['message']);}logger[_0x2f9e('0x11')](_0x2f9e('0xc'),_0x4bbb20,_0x22c715['error'][_0x2f9e('0x12')]);return _0x5d37ad(_0x22c715[_0x2f9e('0x11')][_0x2f9e('0x12')]);}else{logger[_0x2f9e('0xb')](_0x2f9e('0xc'),_0x4bbb20,_0x2f9e('0xd'));_0x5d37ad(_0x22c715['result'][_0x2f9e('0x12')]);}})['catch'](function(_0xa3ed39){logger[_0x2f9e('0x11')](_0x2f9e('0xc'),_0x4bbb20,_0xa3ed39);_0x379d03(_0xa3ed39);});});} \ No newline at end of file +var _0xf08d=['then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x24cef0,_0x42a80f){var _0x2b767b=function(_0x2529ee){while(--_0x2529ee){_0x24cef0['push'](_0x24cef0['shift']());}};_0x2b767b(++_0x42a80f);}(_0xf08d,0xd0));var _0xdf08=function(_0x1e4fbf,_0x2862c4){_0x1e4fbf=_0x1e4fbf-0x0;var _0x2441a8=_0xf08d[_0x1e4fbf];return _0x2441a8;};'use strict';var _=require(_0xdf08('0x0'));var util=require(_0xdf08('0x1'));var moment=require(_0xdf08('0x2'));var BPromise=require(_0xdf08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf08('0x5'));var logger=require(_0xdf08('0x6'))(_0xdf08('0x7'));var config=require(_0xdf08('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdf08('0x9')][_0xdf08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2893f9,_0x137c59,_0x226707){return new BPromise(function(_0x45d7ee,_0x43dc03){return client[_0xdf08('0xb')](_0x2893f9,_0x226707)[_0xdf08('0xc')](function(_0x2481ff){logger['info'](_0xdf08('0xd'),_0x137c59,_0xdf08('0xe'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x137c59,_0xdf08('0xe'),JSON[_0xdf08('0xf')](_0x2481ff));if(_0x2481ff[_0xdf08('0x10')]){if(_0x2481ff[_0xdf08('0x10')]['code']===0x1f4){logger['error'](_0xdf08('0xd'),_0x137c59,_0x2481ff[_0xdf08('0x10')][_0xdf08('0x11')]);return _0x43dc03(_0x2481ff[_0xdf08('0x10')][_0xdf08('0x11')]);}logger['error'](_0xdf08('0xd'),_0x137c59,_0x2481ff[_0xdf08('0x10')][_0xdf08('0x11')]);return _0x45d7ee(_0x2481ff[_0xdf08('0x10')][_0xdf08('0x11')]);}else{logger[_0xdf08('0x12')](_0xdf08('0xd'),_0x137c59,_0xdf08('0xe'));_0x45d7ee(_0x2481ff['result'][_0xdf08('0x11')]);}})[_0xdf08('0x13')](function(_0x367399){logger['error'](_0xdf08('0xd'),_0x137c59,_0x367399);_0x43dc03(_0x367399);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8d3fed8..bff2ccd 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 _0x8ac1=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete'];(function(_0x4f9baf,_0x17a0a1){var _0x5dd2dd=function(_0xc553ed){while(--_0xc553ed){_0x4f9baf['push'](_0x4f9baf['shift']());}};_0x5dd2dd(++_0x17a0a1);}(_0x8ac1,0x147));var _0x18ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8ac1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x18ac('0x0'));var util=require(_0x18ac('0x1'));var path=require('path');var timeout=require(_0x18ac('0x2'));var express=require(_0x18ac('0x3'));var router=express[_0x18ac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x18ac('0x5'));var interaction=require(_0x18ac('0x6'));var config=require(_0x18ac('0x7'));var controller=require(_0x18ac('0x8'));router[_0x18ac('0x9')]('/',auth[_0x18ac('0xa')](),controller['index']);router[_0x18ac('0x9')](_0x18ac('0xb'),auth[_0x18ac('0xa')](),controller[_0x18ac('0xc')]);router[_0x18ac('0x9')](_0x18ac('0xd'),auth['isAuthenticated'](),controller[_0x18ac('0xe')]);router['get'](_0x18ac('0xf'),auth[_0x18ac('0xa')](),controller[_0x18ac('0x10')]);router[_0x18ac('0x9')](_0x18ac('0x11'),auth[_0x18ac('0xa')](),controller[_0x18ac('0x12')]);router[_0x18ac('0x13')]('/',auth['isAuthenticated'](),controller[_0x18ac('0x14')]);router[_0x18ac('0x15')](_0x18ac('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x18ac('0x16')](_0x18ac('0xb'),auth[_0x18ac('0xa')](),controller[_0x18ac('0x17')]);module[_0x18ac('0x18')]=router; \ No newline at end of file +var _0x9129=['./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x395162,_0x5af476){var _0x13f769=function(_0x300065){while(--_0x300065){_0x395162['push'](_0x395162['shift']());}};_0x13f769(++_0x5af476);}(_0x9129,0xcc));var _0x9912=function(_0xfee10f,_0x53470e){_0xfee10f=_0xfee10f-0x0;var _0xb91051=_0x9129[_0xfee10f];return _0xb91051;};'use strict';var multer=require(_0x9912('0x0'));var util=require(_0x9912('0x1'));var path=require('path');var timeout=require(_0x9912('0x2'));var express=require('express');var router=express[_0x9912('0x3')]();var fs_extra=require(_0x9912('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9912('0x5'));var controller=require(_0x9912('0x6'));router[_0x9912('0x7')]('/',auth[_0x9912('0x8')](),controller[_0x9912('0x9')]);router['get'](_0x9912('0xa'),auth[_0x9912('0x8')](),controller[_0x9912('0xb')]);router['get']('/:id/preview',auth[_0x9912('0x8')](),controller['preview']);router[_0x9912('0x7')]('/:id/run',auth[_0x9912('0x8')](),controller[_0x9912('0xc')]);router[_0x9912('0x7')](_0x9912('0xd'),auth[_0x9912('0x8')](),controller[_0x9912('0xe')]);router[_0x9912('0xf')]('/',auth['isAuthenticated'](),controller[_0x9912('0x10')]);router['put'](_0x9912('0xa'),auth[_0x9912('0x8')](),controller[_0x9912('0x11')]);router[_0x9912('0x12')](_0x9912('0xa'),auth[_0x9912('0x8')](),controller[_0x9912('0x13')]);module[_0x9912('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 f9eee6a..f313113 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 _0x4a1a=['xlsx','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','exports','STRING','csv','pdf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4a1a,0x13f));var _0xa4a1=function(_0x2fd1af,_0x1104b3){_0x2fd1af=_0x2fd1af-0x0;var _0x542a14=_0x4a1a[_0x2fd1af];return _0x542a14;};'use strict';var Sequelize=require(_0xa4a1('0x0'));var moment=require('moment');module[_0xa4a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xa4a1('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xa4a1('0x3'),_0xa4a1('0x4'),_0xa4a1('0x5')),'allowNull':![],'defaultValue':_0xa4a1('0x3')},'savename':{'type':Sequelize[_0xa4a1('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa4a1('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xa4a1('0x7')},'type':{'type':Sequelize[_0xa4a1('0x8')](_0xa4a1('0x9'),_0xa4a1('0xa')),'allowNull':![],'defaultValue':_0xa4a1('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xa4a1('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe1d3=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','DATE'];(function(_0x2191fb,_0x216516){var _0x31d7a1=function(_0x2035f7){while(--_0x2035f7){_0x2191fb['push'](_0x2191fb['shift']());}};_0x31d7a1(++_0x216516);}(_0xe1d3,0x19c));var _0x3e1d=function(_0x1fb16c,_0x440bfd){_0x1fb16c=_0x1fb16c-0x0;var _0xee214e=_0xe1d3[_0x1fb16c];return _0xee214e;};'use strict';var Sequelize=require(_0x3e1d('0x0'));var moment=require(_0x3e1d('0x1'));module[_0x3e1d('0x2')]={'name':{'type':Sequelize[_0x3e1d('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x3e1d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x3e1d('0x4')](_0x3e1d('0x5'),_0x3e1d('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0x3e1d('0x5')},'savename':{'type':Sequelize[_0x3e1d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3e1d('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x3e1d('0x4')](_0x3e1d('0x8'),_0x3e1d('0x9')),'allowNull':![],'defaultValue':_0x3e1d('0x8')},'reportId':{'type':Sequelize[_0x3e1d('0xa')](0xb)[_0x3e1d('0xb')]},'reportType':{'type':Sequelize[_0x3e1d('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7dfb899..35a1db7 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 _0x708f=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','download','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','ExtractedReports','UserProfileSection'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x708f,0x137));var _0xf708=function(_0x18d047,_0x4e2cfb){_0x18d047=_0x18d047-0x0;var _0x28c3c2=_0x708f[_0x18d047];return _0x28c3c2;};'use strict';var emlformat=require(_0xf708('0x0'));var rimraf=require(_0xf708('0x1'));var zipdir=require(_0xf708('0x2'));var jsonpatch=require(_0xf708('0x3'));var rp=require(_0xf708('0x4'));var moment=require(_0xf708('0x5'));var BPromise=require(_0xf708('0x6'));var Mustache=require(_0xf708('0x7'));var util=require('util');var path=require(_0xf708('0x8'));var sox=require(_0xf708('0x9'));var csv=require(_0xf708('0xa'));var ejs=require(_0xf708('0xb'));var fs=require('fs');var fs_extra=require(_0xf708('0xc'));var _=require(_0xf708('0xd'));var squel=require(_0xf708('0xe'));var crypto=require(_0xf708('0xf'));var jsforce=require(_0xf708('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf708('0xa'));var querystring=require(_0xf708('0x11'));var Papa=require('papaparse');var Redis=require(_0xf708('0x12'));var authService=require(_0xf708('0x13'));var qs=require(_0xf708('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf708('0x15'));var logger=require(_0xf708('0x16'))('api');var utils=require(_0xf708('0x17'));var config=require(_0xf708('0x18'));var licenseUtil=require(_0xf708('0x19'));var db=require(_0xf708('0x1a'))['db'];function respondWithStatusCode(_0x4b4c76,_0x2a4f58){_0x2a4f58=_0x2a4f58||0xcc;return function(_0x31daa6){if(_0x31daa6){return _0x4b4c76[_0xf708('0x1b')](_0x2a4f58);}return _0x4b4c76[_0xf708('0x1c')](_0x2a4f58)['end']();};}function respondWithResult(_0x366454,_0x132e2b){_0x132e2b=_0x132e2b||0xc8;return function(_0x1bde54){if(_0x1bde54){return _0x366454[_0xf708('0x1c')](_0x132e2b)['json'](_0x1bde54);}};}function respondWithFilteredResult(_0x27d035,_0x5061bb){return function(_0x1bee5b){if(_0x1bee5b){var _0x5e3843=typeof _0x5061bb[_0xf708('0x1d')]==='undefined'&&typeof _0x5061bb['limit']===_0xf708('0x1e');var _0x2634af=_0x1bee5b[_0xf708('0x1f')];var _0x220dc0=_0x5e3843?0x0:_0x5061bb[_0xf708('0x1d')];var _0x273348=_0x5e3843?_0x1bee5b[_0xf708('0x1f')]:_0x5061bb['offset']+_0x5061bb[_0xf708('0x20')];var _0x1b41fe;if(_0x273348>=_0x2634af){_0x273348=_0x2634af;_0x1b41fe=0xc8;}else{_0x1b41fe=0xce;}_0x27d035[_0xf708('0x1c')](_0x1b41fe);return _0x27d035['set'](_0xf708('0x21'),_0x220dc0+'-'+_0x273348+'/'+_0x2634af)[_0xf708('0x22')](_0x1bee5b);}return null;};}function patchUpdates(_0x3faf84){return function(_0x316571){try{jsonpatch['apply'](_0x316571,_0x3faf84,!![]);}catch(_0x58090d){return BPromise[_0xf708('0x23')](_0x58090d);}return _0x316571[_0xf708('0x24')]();};}function saveUpdates(_0x389ea1,_0x27810a){return function(_0x17d410){if(_0x17d410){return _0x17d410[_0xf708('0x25')](_0x389ea1)[_0xf708('0x26')](function(_0x3f2278){return _0x3f2278;});}return null;};}function removeEntity(_0x11e3d5,_0x3621c2){return function(_0x272902){if(_0x272902){return _0x272902[_0xf708('0x27')]()[_0xf708('0x26')](function(){var _0x2b31c8=_0x272902['get']({'plain':!![]});var _0x1145a8='ExtractedReports';return db[_0xf708('0x28')]['destroy']({'where':{'type':_0x1145a8,'resourceId':_0x2b31c8['id']}})[_0xf708('0x26')](function(){return _0x272902;});})[_0xf708('0x26')](function(){_0x11e3d5['status'](0xcc)[_0xf708('0x29')]();});}};}function handleEntityNotFound(_0x4ad5f9,_0x57bc57){return function(_0x16b5bc){if(!_0x16b5bc){_0x4ad5f9[_0xf708('0x1b')](0x194);}return _0x16b5bc;};}function handleError(_0x4f54ef,_0x51fe4b){_0x51fe4b=_0x51fe4b||0x1f4;return function(_0x3ba109){logger[_0xf708('0x2a')](_0x3ba109[_0xf708('0x2b')]);if(_0x3ba109[_0xf708('0x2c')]){delete _0x3ba109[_0xf708('0x2c')];}_0x4f54ef[_0xf708('0x1c')](_0x51fe4b)[_0xf708('0x2d')](_0x3ba109);};}exports['index']=function(_0x52fefb,_0x399a71){var _0x18c376={},_0x64a590={},_0x4cd0f4={'count':0x0,'rows':[]};var _0x1fc842=_[_0xf708('0x2e')](db['AnalyticExtractedReport'][_0xf708('0x2f')],function(_0x1cc62b){return{'name':_0x1cc62b['fieldName'],'type':_0x1cc62b[_0xf708('0x30')][_0xf708('0x31')]};});_0x64a590[_0xf708('0x32')]=_['map'](_0x1fc842,_0xf708('0x2c'));_0x64a590[_0xf708('0x33')]=_[_0xf708('0x34')](_0x52fefb[_0xf708('0x33')]);_0x64a590[_0xf708('0x35')]=_[_0xf708('0x36')](_0x64a590[_0xf708('0x32')],_0x64a590['query']);_0x18c376[_0xf708('0x37')]=_[_0xf708('0x36')](_0x64a590['model'],qs[_0xf708('0x38')](_0x52fefb['query'][_0xf708('0x38')]));_0x18c376['attributes']=_0x18c376['attributes'][_0xf708('0x39')]?_0x18c376[_0xf708('0x37')]:_0x64a590[_0xf708('0x32')];if(!_0x52fefb[_0xf708('0x33')][_0xf708('0x3a')](_0xf708('0x3b'))){_0x18c376[_0xf708('0x20')]=qs[_0xf708('0x20')](_0x52fefb['query'][_0xf708('0x20')]);_0x18c376[_0xf708('0x1d')]=qs[_0xf708('0x1d')](_0x52fefb[_0xf708('0x33')]['offset']);}_0x18c376[_0xf708('0x3c')]=qs[_0xf708('0x3d')](_0x52fefb[_0xf708('0x33')][_0xf708('0x3d')]);_0x18c376[_0xf708('0x3e')]=qs[_0xf708('0x35')](_['pick'](_0x52fefb[_0xf708('0x33')],_0x64a590[_0xf708('0x35')]),_0x1fc842);if(_0x52fefb['query'][_0xf708('0x3f')]){_0x18c376['where']=_[_0xf708('0x40')](_0x18c376[_0xf708('0x3e')],{'$or':_[_0xf708('0x2e')](_0x1fc842,function(_0x14f06f){if(_0x14f06f[_0xf708('0x30')]!==_0xf708('0x41')){var _0x4e7c08={};_0x4e7c08[_0x14f06f[_0xf708('0x2c')]]={'$like':'%'+_0x52fefb[_0xf708('0x33')][_0xf708('0x3f')]+'%'};return _0x4e7c08;}})});}_0x18c376=_[_0xf708('0x40')]({},_0x18c376,_0x52fefb[_0xf708('0x42')]);var _0x5cb532={'where':_0x18c376[_0xf708('0x3e')]};return db[_0xf708('0x43')][_0xf708('0x1f')](_0x5cb532)['then'](function(_0x2a90a1){_0x4cd0f4[_0xf708('0x1f')]=_0x2a90a1;if(_0x52fefb['query'][_0xf708('0x44')]){_0x18c376[_0xf708('0x45')]=[{'all':!![]}];}return db[_0xf708('0x43')][_0xf708('0x46')](_0x18c376);})[_0xf708('0x26')](function(_0x27bd3e){_0x4cd0f4[_0xf708('0x47')]=_0x27bd3e;return _0x4cd0f4;})['then'](respondWithFilteredResult(_0x399a71,_0x18c376))[_0xf708('0x48')](handleError(_0x399a71,null));};exports['show']=function(_0x562c08,_0x1d0819){var _0x228357={'raw':!![],'where':{'id':_0x562c08[_0xf708('0x49')]['id']}},_0x56623d={};_0x56623d[_0xf708('0x32')]=_[_0xf708('0x34')](db['AnalyticExtractedReport'][_0xf708('0x2f')]);_0x56623d['query']=_[_0xf708('0x34')](_0x562c08['query']);_0x56623d[_0xf708('0x35')]=_[_0xf708('0x36')](_0x56623d[_0xf708('0x32')],_0x56623d[_0xf708('0x33')]);_0x228357[_0xf708('0x37')]=_['intersection'](_0x56623d[_0xf708('0x32')],qs[_0xf708('0x38')](_0x562c08[_0xf708('0x33')][_0xf708('0x38')]));_0x228357['attributes']=_0x228357['attributes'][_0xf708('0x39')]?_0x228357[_0xf708('0x37')]:_0x56623d['model'];if(_0x562c08[_0xf708('0x33')]['includeAll']){_0x228357[_0xf708('0x45')]=[{'all':!![]}];}_0x228357=_[_0xf708('0x40')]({},_0x228357,_0x562c08[_0xf708('0x42')]);return db['AnalyticExtractedReport'][_0xf708('0x4a')](_0x228357)[_0xf708('0x26')](handleEntityNotFound(_0x1d0819,null))[_0xf708('0x26')](respondWithResult(_0x1d0819,null))['catch'](handleError(_0x1d0819,null));};exports[_0xf708('0x4b')]=function(_0x18dd24,_0x583617){return db['AnalyticExtractedReport'][_0xf708('0x4b')](_0x18dd24[_0xf708('0x4c')],{})[_0xf708('0x26')](function(_0x118979){var _0x379cdf=_0x18dd24[_0xf708('0x4d')][_0xf708('0x4e')]({'plain':!![]});if(!_0x379cdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x379cdf['role']===_0xf708('0x4d')){var _0x3a592f=_0x118979['get']({'plain':!![]});var _0x2d4260=_0xf708('0x4f');return db[_0xf708('0x50')]['find']({'where':{'name':_0x2d4260,'userProfileId':_0x379cdf[_0xf708('0x51')]},'raw':!![]})[_0xf708('0x26')](function(_0x50a05c){if(_0x50a05c&&_0x50a05c[_0xf708('0x52')]===0x0){return db[_0xf708('0x28')][_0xf708('0x4b')]({'name':_0x3a592f[_0xf708('0x2c')],'resourceId':_0x3a592f['id'],'type':_0x50a05c[_0xf708('0x2c')],'sectionId':_0x50a05c['id']},{})[_0xf708('0x26')](function(){return _0x118979;});}else{return _0x118979;}})['catch'](function(_0x36ff78){logger['error'](_0xf708('0x53'),_0x36ff78);throw _0x36ff78;});}return _0x118979;})[_0xf708('0x26')](respondWithResult(_0x583617,0xc9))[_0xf708('0x48')](handleError(_0x583617,null));};exports['update']=function(_0x2bf1e6,_0x2c7161){if(_0x2bf1e6['body']['id']){delete _0x2bf1e6[_0xf708('0x4c')]['id'];}return db[_0xf708('0x43')][_0xf708('0x4a')]({'where':{'id':_0x2bf1e6[_0xf708('0x49')]['id']}})[_0xf708('0x26')](handleEntityNotFound(_0x2c7161,null))[_0xf708('0x26')](saveUpdates(_0x2bf1e6[_0xf708('0x4c')],null))['then'](respondWithResult(_0x2c7161,null))['catch'](handleError(_0x2c7161,null));};exports[_0xf708('0x27')]=function(_0x532ca9,_0x3da6a2){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x532ca9[_0xf708('0x49')]['id']}})[_0xf708('0x26')](handleEntityNotFound(_0x3da6a2,null))['then'](removeEntity(_0x3da6a2,null))[_0xf708('0x48')](handleError(_0x3da6a2,null));};exports['download']=function(_0x5e6b3d,_0x281a70,_0x127657){return db[_0xf708('0x43')][_0xf708('0x4a')]({'where':{'id':_0x5e6b3d[_0xf708('0x49')]['id']},'attributes':[_0xf708('0x2c'),_0xf708('0x54'),_0xf708('0x55'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x281a70,null))[_0xf708('0x26')](function(_0x4667f3){if(_0x4667f3){if(!fs[_0xf708('0x56')](path[_0xf708('0x57')](config[_0xf708('0x58')],_0xf708('0x59'),_0x4667f3[_0xf708('0x55')]))){throw new db[(_0xf708('0x5a'))][(_0xf708('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5e6b3d[_0xf708('0x33')][_0xf708('0x5c')]){return _0x281a70[_0xf708('0x1b')](0xc8);}return _0x281a70[_0xf708('0x5d')](path[_0xf708('0x57')](config['root'],_0xf708('0x59'),_0x4667f3['savename']),util[_0xf708('0x5e')](_0xf708('0x5f'),_0x4667f3[_0xf708('0x54')]||_0x4667f3[_0xf708('0x2c')],_0x4667f3[_0xf708('0x60')][_0xf708('0x61')]()));}})[_0xf708('0x48')](handleError(_0x281a70,null));}; \ No newline at end of file +var _0xba48=['options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','update','download','basename','savename','output','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','AnalyticExtractedReport','fieldName','type','key','model','map','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','params','rawAttributes','keys','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba48,0x12f));var _0x8ba4=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xba48[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0x8ba4('0x0'));var rimraf=require(_0x8ba4('0x1'));var zipdir=require(_0x8ba4('0x2'));var jsonpatch=require(_0x8ba4('0x3'));var rp=require(_0x8ba4('0x4'));var moment=require(_0x8ba4('0x5'));var BPromise=require(_0x8ba4('0x6'));var Mustache=require('mustache');var util=require(_0x8ba4('0x7'));var path=require(_0x8ba4('0x8'));var sox=require(_0x8ba4('0x9'));var csv=require(_0x8ba4('0xa'));var ejs=require(_0x8ba4('0xb'));var fs=require('fs');var fs_extra=require(_0x8ba4('0xc'));var _=require('lodash');var squel=require(_0x8ba4('0xd'));var crypto=require(_0x8ba4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8ba4('0xa'));var querystring=require('querystring');var Papa=require(_0x8ba4('0xf'));var Redis=require('ioredis');var authService=require(_0x8ba4('0x10'));var qs=require(_0x8ba4('0x11'));var as=require(_0x8ba4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ba4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8ba4('0x14'));var licenseUtil=require(_0x8ba4('0x15'));var db=require(_0x8ba4('0x16'))['db'];function respondWithStatusCode(_0x2d2b88,_0xd5cf5b){_0xd5cf5b=_0xd5cf5b||0xcc;return function(_0x1d79a7){if(_0x1d79a7){return _0x2d2b88[_0x8ba4('0x17')](_0xd5cf5b);}return _0x2d2b88[_0x8ba4('0x18')](_0xd5cf5b)[_0x8ba4('0x19')]();};}function respondWithResult(_0x493854,_0x25d4f3){_0x25d4f3=_0x25d4f3||0xc8;return function(_0x5885af){if(_0x5885af){return _0x493854[_0x8ba4('0x18')](_0x25d4f3)[_0x8ba4('0x1a')](_0x5885af);}};}function respondWithFilteredResult(_0x4cc13d,_0x39123a){return function(_0x4e4fb2){if(_0x4e4fb2){var _0x146c2c=typeof _0x39123a[_0x8ba4('0x1b')]==='undefined'&&typeof _0x39123a[_0x8ba4('0x1c')]===_0x8ba4('0x1d');var _0x2f2fde=_0x4e4fb2[_0x8ba4('0x1e')];var _0x208289=_0x146c2c?0x0:_0x39123a[_0x8ba4('0x1b')];var _0x4932f0=_0x146c2c?_0x4e4fb2[_0x8ba4('0x1e')]:_0x39123a[_0x8ba4('0x1b')]+_0x39123a[_0x8ba4('0x1c')];var _0x170b31;if(_0x4932f0>=_0x2f2fde){_0x4932f0=_0x2f2fde;_0x170b31=0xc8;}else{_0x170b31=0xce;}_0x4cc13d['status'](_0x170b31);return _0x4cc13d[_0x8ba4('0x1f')](_0x8ba4('0x20'),_0x208289+'-'+_0x4932f0+'/'+_0x2f2fde)[_0x8ba4('0x1a')](_0x4e4fb2);}return null;};}function patchUpdates(_0x14072f){return function(_0x1b01a7){try{jsonpatch[_0x8ba4('0x21')](_0x1b01a7,_0x14072f,!![]);}catch(_0x468e48){return BPromise[_0x8ba4('0x22')](_0x468e48);}return _0x1b01a7[_0x8ba4('0x23')]();};}function saveUpdates(_0x7ba7f4,_0x1e6665){return function(_0x1f2fa8){if(_0x1f2fa8){return _0x1f2fa8['update'](_0x7ba7f4)[_0x8ba4('0x24')](function(_0x2a0493){return _0x2a0493;});}return null;};}function removeEntity(_0x30292b,_0x736f9c){return function(_0x1b6a68){if(_0x1b6a68){return _0x1b6a68[_0x8ba4('0x25')]()[_0x8ba4('0x24')](function(){var _0x4d8e59=_0x1b6a68[_0x8ba4('0x26')]({'plain':!![]});var _0xe3732c=_0x8ba4('0x27');return db[_0x8ba4('0x28')]['destroy']({'where':{'type':_0xe3732c,'resourceId':_0x4d8e59['id']}})[_0x8ba4('0x24')](function(){return _0x1b6a68;});})['then'](function(){_0x30292b[_0x8ba4('0x18')](0xcc)[_0x8ba4('0x19')]();});}};}function handleEntityNotFound(_0x504d02,_0x2bf764){return function(_0x447f07){if(!_0x447f07){_0x504d02[_0x8ba4('0x17')](0x194);}return _0x447f07;};}function handleError(_0x3afcea,_0x141562){_0x141562=_0x141562||0x1f4;return function(_0x65ab5d){logger[_0x8ba4('0x29')](_0x65ab5d[_0x8ba4('0x2a')]);if(_0x65ab5d[_0x8ba4('0x2b')]){delete _0x65ab5d[_0x8ba4('0x2b')];}_0x3afcea[_0x8ba4('0x18')](_0x141562)[_0x8ba4('0x2c')](_0x65ab5d);};}exports['index']=function(_0x102a4e,_0x4fa9ef){var _0x1e01a9={},_0x353a61={},_0xd0503={'count':0x0,'rows':[]};var _0x132f38=_['map'](db[_0x8ba4('0x2d')]['rawAttributes'],function(_0x4902ee){return{'name':_0x4902ee[_0x8ba4('0x2e')],'type':_0x4902ee[_0x8ba4('0x2f')][_0x8ba4('0x30')]};});_0x353a61[_0x8ba4('0x31')]=_[_0x8ba4('0x32')](_0x132f38,_0x8ba4('0x2b'));_0x353a61['query']=_['keys'](_0x102a4e['query']);_0x353a61[_0x8ba4('0x33')]=_['intersection'](_0x353a61[_0x8ba4('0x31')],_0x353a61['query']);_0x1e01a9[_0x8ba4('0x34')]=_[_0x8ba4('0x35')](_0x353a61['model'],qs[_0x8ba4('0x36')](_0x102a4e[_0x8ba4('0x37')]['fields']));_0x1e01a9['attributes']=_0x1e01a9[_0x8ba4('0x34')][_0x8ba4('0x38')]?_0x1e01a9['attributes']:_0x353a61['model'];if(!_0x102a4e['query'][_0x8ba4('0x39')](_0x8ba4('0x3a'))){_0x1e01a9[_0x8ba4('0x1c')]=qs['limit'](_0x102a4e[_0x8ba4('0x37')][_0x8ba4('0x1c')]);_0x1e01a9['offset']=qs[_0x8ba4('0x1b')](_0x102a4e['query']['offset']);}_0x1e01a9[_0x8ba4('0x3b')]=qs['sort'](_0x102a4e[_0x8ba4('0x37')][_0x8ba4('0x3c')]);_0x1e01a9[_0x8ba4('0x3d')]=qs[_0x8ba4('0x33')](_[_0x8ba4('0x3e')](_0x102a4e[_0x8ba4('0x37')],_0x353a61[_0x8ba4('0x33')]),_0x132f38);if(_0x102a4e['query'][_0x8ba4('0x3f')]){_0x1e01a9[_0x8ba4('0x3d')]=_[_0x8ba4('0x40')](_0x1e01a9[_0x8ba4('0x3d')],{'$or':_[_0x8ba4('0x32')](_0x132f38,function(_0x4d5607){if(_0x4d5607[_0x8ba4('0x2f')]!==_0x8ba4('0x41')){var _0x56d218={};_0x56d218[_0x4d5607[_0x8ba4('0x2b')]]={'$like':'%'+_0x102a4e[_0x8ba4('0x37')][_0x8ba4('0x3f')]+'%'};return _0x56d218;}})});}_0x1e01a9=_[_0x8ba4('0x40')]({},_0x1e01a9,_0x102a4e['options']);var _0x5896f4={'where':_0x1e01a9[_0x8ba4('0x3d')]};return db[_0x8ba4('0x2d')][_0x8ba4('0x1e')](_0x5896f4)[_0x8ba4('0x24')](function(_0x39d40f){_0xd0503[_0x8ba4('0x1e')]=_0x39d40f;if(_0x102a4e[_0x8ba4('0x37')]['includeAll']){_0x1e01a9['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8ba4('0x42')](_0x1e01a9);})[_0x8ba4('0x24')](function(_0x316e5f){_0xd0503['rows']=_0x316e5f;return _0xd0503;})[_0x8ba4('0x24')](respondWithFilteredResult(_0x4fa9ef,_0x1e01a9))[_0x8ba4('0x43')](handleError(_0x4fa9ef,null));};exports['show']=function(_0x52466e,_0xd24ad5){var _0xc20218={'raw':!![],'where':{'id':_0x52466e[_0x8ba4('0x44')]['id']}},_0x1a378b={};_0x1a378b[_0x8ba4('0x31')]=_['keys'](db[_0x8ba4('0x2d')][_0x8ba4('0x45')]);_0x1a378b[_0x8ba4('0x37')]=_[_0x8ba4('0x46')](_0x52466e['query']);_0x1a378b[_0x8ba4('0x33')]=_['intersection'](_0x1a378b[_0x8ba4('0x31')],_0x1a378b['query']);_0xc20218[_0x8ba4('0x34')]=_[_0x8ba4('0x35')](_0x1a378b[_0x8ba4('0x31')],qs[_0x8ba4('0x36')](_0x52466e['query'][_0x8ba4('0x36')]));_0xc20218[_0x8ba4('0x34')]=_0xc20218[_0x8ba4('0x34')][_0x8ba4('0x38')]?_0xc20218['attributes']:_0x1a378b[_0x8ba4('0x31')];if(_0x52466e[_0x8ba4('0x37')][_0x8ba4('0x47')]){_0xc20218[_0x8ba4('0x48')]=[{'all':!![]}];}_0xc20218=_['merge']({},_0xc20218,_0x52466e[_0x8ba4('0x49')]);return db[_0x8ba4('0x2d')][_0x8ba4('0x4a')](_0xc20218)[_0x8ba4('0x24')](handleEntityNotFound(_0xd24ad5,null))[_0x8ba4('0x24')](respondWithResult(_0xd24ad5,null))[_0x8ba4('0x43')](handleError(_0xd24ad5,null));};exports[_0x8ba4('0x4b')]=function(_0x4fca59,_0x1924e7){return db[_0x8ba4('0x2d')]['create'](_0x4fca59[_0x8ba4('0x4c')],{})[_0x8ba4('0x24')](function(_0x4fa705){var _0x292e6e=_0x4fca59[_0x8ba4('0x4d')]['get']({'plain':!![]});if(!_0x292e6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x292e6e['role']===_0x8ba4('0x4d')){var _0x52acc8=_0x4fa705[_0x8ba4('0x26')]({'plain':!![]});var _0x2e5019='ExtractedReports';return db[_0x8ba4('0x4e')]['find']({'where':{'name':_0x2e5019,'userProfileId':_0x292e6e[_0x8ba4('0x4f')]},'raw':!![]})[_0x8ba4('0x24')](function(_0x350e24){if(_0x350e24&&_0x350e24[_0x8ba4('0x50')]===0x0){return db['UserProfileResource'][_0x8ba4('0x4b')]({'name':_0x52acc8[_0x8ba4('0x2b')],'resourceId':_0x52acc8['id'],'type':_0x350e24[_0x8ba4('0x2b')],'sectionId':_0x350e24['id']},{})[_0x8ba4('0x24')](function(){return _0x4fa705;});}else{return _0x4fa705;}})[_0x8ba4('0x43')](function(_0x46bd03){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46bd03);throw _0x46bd03;});}return _0x4fa705;})[_0x8ba4('0x24')](respondWithResult(_0x1924e7,0xc9))['catch'](handleError(_0x1924e7,null));};exports[_0x8ba4('0x51')]=function(_0x48f276,_0x1953fe){if(_0x48f276[_0x8ba4('0x4c')]['id']){delete _0x48f276[_0x8ba4('0x4c')]['id'];}return db[_0x8ba4('0x2d')][_0x8ba4('0x4a')]({'where':{'id':_0x48f276[_0x8ba4('0x44')]['id']}})['then'](handleEntityNotFound(_0x1953fe,null))[_0x8ba4('0x24')](saveUpdates(_0x48f276[_0x8ba4('0x4c')],null))['then'](respondWithResult(_0x1953fe,null))['catch'](handleError(_0x1953fe,null));};exports['destroy']=function(_0x221d0c,_0x4b0bdb){return db[_0x8ba4('0x2d')]['find']({'where':{'id':_0x221d0c['params']['id']}})['then'](handleEntityNotFound(_0x4b0bdb,null))[_0x8ba4('0x24')](removeEntity(_0x4b0bdb,null))[_0x8ba4('0x43')](handleError(_0x4b0bdb,null));};exports[_0x8ba4('0x52')]=function(_0x4c54ef,_0x56b018,_0xed9e06){return db[_0x8ba4('0x2d')][_0x8ba4('0x4a')]({'where':{'id':_0x4c54ef[_0x8ba4('0x44')]['id']},'attributes':['name',_0x8ba4('0x53'),_0x8ba4('0x54'),_0x8ba4('0x55')],'raw':!![]})[_0x8ba4('0x24')](handleEntityNotFound(_0x56b018,null))['then'](function(_0x1f1cb9){if(_0x1f1cb9){if(!fs['existsSync'](path[_0x8ba4('0x56')](config[_0x8ba4('0x57')],'server/files/reports',_0x1f1cb9[_0x8ba4('0x54')]))){throw new db[(_0x8ba4('0x58'))]['ValidationError'](_0x8ba4('0x59'));}if(_0x4c54ef['query'][_0x8ba4('0x5a')]){return _0x56b018['sendStatus'](0xc8);}return _0x56b018[_0x8ba4('0x52')](path[_0x8ba4('0x56')](config[_0x8ba4('0x57')],_0x8ba4('0x5b'),_0x1f1cb9[_0x8ba4('0x54')]),util[_0x8ba4('0x5c')](_0x8ba4('0x5d'),_0x1f1cb9[_0x8ba4('0x53')]||_0x1f1cb9[_0x8ba4('0x2b')],_0x1f1cb9[_0x8ba4('0x55')]['toLowerCase']()));}})['catch'](handleError(_0x56b018,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 29bbf35..0f86691 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 _0x3fc5=['moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','api'];(function(_0x582f7e,_0x4c080e){var _0x29528e=function(_0x88354){while(--_0x88354){_0x582f7e['push'](_0x582f7e['shift']());}};_0x29528e(++_0x4c080e);}(_0x3fc5,0x13d));var _0x53fc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3fc5[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x53fc('0x0'));var logger=require('../../config/logger')(_0x53fc('0x1'));var moment=require(_0x53fc('0x2'));var BPromise=require('bluebird');var rp=require(_0x53fc('0x3'));var fs=require('fs');var path=require(_0x53fc('0x4'));var rimraf=require(_0x53fc('0x5'));var config=require(_0x53fc('0x6'));var attributes=require(_0x53fc('0x7'));module['exports']=function(_0x12ee8a,_0x524d1b){return _0x12ee8a[_0x53fc('0x8')](_0x53fc('0x9'),attributes,{'tableName':_0x53fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e74=['exports','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x1c4c46,_0x3f3e8b){var _0x38e0e0=function(_0xa8038a){while(--_0xa8038a){_0x1c4c46['push'](_0x1c4c46['shift']());}};_0x38e0e0(++_0x3f3e8b);}(_0x7e74,0x16f));var _0x47e7=function(_0x29a0d7,_0x4ecd68){_0x29a0d7=_0x29a0d7-0x0;var _0x3e336f=_0x7e74[_0x29a0d7];return _0x3e336f;};'use strict';var _=require(_0x47e7('0x0'));var util=require(_0x47e7('0x1'));var logger=require(_0x47e7('0x2'))(_0x47e7('0x3'));var moment=require(_0x47e7('0x4'));var BPromise=require(_0x47e7('0x5'));var rp=require(_0x47e7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47e7('0x7'));var config=require(_0x47e7('0x8'));var attributes=require(_0x47e7('0x9'));module[_0x47e7('0xa')]=function(_0x4b110b,_0x2123f5){return _0x4b110b[_0x47e7('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x47e7('0xc'),'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 11d4ca3..63610a1 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 _0xf218=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x4622df,_0x27eb7c){var _0x5990fe=function(_0x5531ac){while(--_0x5531ac){_0x4622df['push'](_0x4622df['shift']());}};_0x5990fe(++_0x27eb7c);}(_0xf218,0xa9));var _0x8f21=function(_0x421513,_0x4879e1){_0x421513=_0x421513-0x0;var _0x186ee1=_0xf218[_0x421513];return _0x186ee1;};'use strict';var _=require(_0x8f21('0x0'));var util=require(_0x8f21('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f21('0x2'));var fs=require('fs');var Redis=require(_0x8f21('0x3'));var db=require(_0x8f21('0x4'))['db'];var utils=require(_0x8f21('0x5'));var logger=require(_0x8f21('0x6'))(_0x8f21('0x7'));var config=require(_0x8f21('0x8'));var jayson=require(_0x8f21('0x9'));var client=jayson[_0x8f21('0xa')][_0x8f21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15e9ca,_0x47d97f,_0x2d6191){return new BPromise(function(_0x50bc9a,_0x5e3d65){return client[_0x8f21('0xc')](_0x15e9ca,_0x2d6191)['then'](function(_0xd0473d){logger[_0x8f21('0xd')](_0x8f21('0xe'),_0x47d97f,_0x8f21('0xf'));logger[_0x8f21('0x10')](_0x8f21('0x11'),_0x47d97f,_0x8f21('0xf'),JSON[_0x8f21('0x12')](_0xd0473d));if(_0xd0473d[_0x8f21('0x13')]){if(_0xd0473d[_0x8f21('0x13')][_0x8f21('0x14')]===0x1f4){logger[_0x8f21('0x13')](_0x8f21('0xe'),_0x47d97f,_0xd0473d[_0x8f21('0x13')][_0x8f21('0x15')]);return _0x5e3d65(_0xd0473d['error']['message']);}logger[_0x8f21('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x47d97f,_0xd0473d[_0x8f21('0x13')][_0x8f21('0x15')]);return _0x50bc9a(_0xd0473d['error']['message']);}else{logger[_0x8f21('0xd')](_0x8f21('0xe'),_0x47d97f,_0x8f21('0xf'));_0x50bc9a(_0xd0473d['result'][_0x8f21('0x15')]);}})[_0x8f21('0x16')](function(_0x1c76ea){logger[_0x8f21('0x13')](_0x8f21('0xe'),_0x47d97f,_0x1c76ea);_0x5e3d65(_0x1c76ea);});});} \ No newline at end of file +var _0xe51d=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring'];(function(_0xd902ad,_0x34a4db){var _0x2dda06=function(_0x29e470){while(--_0x29e470){_0xd902ad['push'](_0xd902ad['shift']());}};_0x2dda06(++_0x34a4db);}(_0xe51d,0x9c));var _0xde51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde51('0x0'));var util=require(_0xde51('0x1'));var moment=require('moment');var BPromise=require(_0xde51('0x2'));var rs=require(_0xde51('0x3'));var fs=require('fs');var Redis=require(_0xde51('0x4'));var db=require(_0xde51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde51('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde51('0x7'));var client=jayson[_0xde51('0x8')][_0xde51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d1507,_0x21477c,_0x38ec14){return new BPromise(function(_0x2d6634,_0x3ff147){return client[_0xde51('0xa')](_0x5d1507,_0x38ec14)['then'](function(_0x5a95af){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x21477c,'request\x20sent');logger['debug'](_0xde51('0xb'),_0x21477c,_0xde51('0xc'),JSON[_0xde51('0xd')](_0x5a95af));if(_0x5a95af['error']){if(_0x5a95af[_0xde51('0xe')][_0xde51('0xf')]===0x1f4){logger[_0xde51('0xe')](_0xde51('0x10'),_0x21477c,_0x5a95af[_0xde51('0xe')][_0xde51('0x11')]);return _0x3ff147(_0x5a95af[_0xde51('0xe')][_0xde51('0x11')]);}logger[_0xde51('0xe')](_0xde51('0x10'),_0x21477c,_0x5a95af[_0xde51('0xe')][_0xde51('0x11')]);return _0x2d6634(_0x5a95af['error'][_0xde51('0x11')]);}else{logger[_0xde51('0x12')](_0xde51('0x10'),_0x21477c,'request\x20sent');_0x2d6634(_0x5a95af[_0xde51('0x13')][_0xde51('0x11')]);}})['catch'](function(_0x358ee5){logger[_0xde51('0xe')](_0xde51('0x10'),_0x21477c,_0x358ee5);_0x3ff147(_0x358ee5);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 204b8e3..b2876c8 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 _0xf8fc=['create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','index','get','/:id/download','isAuthenticated','download'];(function(_0x391d23,_0x1bf2a6){var _0x196779=function(_0x41471c){while(--_0x41471c){_0x391d23['push'](_0x391d23['shift']());}};_0x196779(++_0x1bf2a6);}(_0xf8fc,0x100));var _0xcf8f=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xf8fc[_0x2adbeb];return _0x5e18a6;};'use strict';var multer=require(_0xcf8f('0x0'));var util=require(_0xcf8f('0x1'));var path=require(_0xcf8f('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf8f('0x3'));var router=express[_0xcf8f('0x4')]();var fs_extra=require(_0xcf8f('0x5'));var auth=require(_0xcf8f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf8f('0x7'));var controller=require(_0xcf8f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcf8f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcf8f('0xa')](_0xcf8f('0xb'),auth[_0xcf8f('0xc')](),controller[_0xcf8f('0xd')]);router['post']('/',auth[_0xcf8f('0xc')](),controller[_0xcf8f('0xe')]);router[_0xcf8f('0xf')]('/:id',auth[_0xcf8f('0xc')](),controller['update']);router['delete']('/:id',auth[_0xcf8f('0xc')](),controller[_0xcf8f('0x10')]);module[_0xcf8f('0x11')]=router; \ No newline at end of file +var _0x4f59=['isAuthenticated','index','show','/:id/download','download','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4f59,0x68));var _0x94f5=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0x4f59[_0xb875ee];return _0x4c7f3a;};'use strict';var multer=require(_0x94f5('0x0'));var util=require(_0x94f5('0x1'));var path=require(_0x94f5('0x2'));var timeout=require(_0x94f5('0x3'));var express=require(_0x94f5('0x4'));var router=express[_0x94f5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x94f5('0x6'));var interaction=require(_0x94f5('0x7'));var config=require(_0x94f5('0x8'));var controller=require(_0x94f5('0x9'));router[_0x94f5('0xa')]('/',auth[_0x94f5('0xb')](),controller[_0x94f5('0xc')]);router[_0x94f5('0xa')]('/:id',auth[_0x94f5('0xb')](),controller[_0x94f5('0xd')]);router[_0x94f5('0xa')](_0x94f5('0xe'),auth[_0x94f5('0xb')](),controller[_0x94f5('0xf')]);router['post']('/',auth[_0x94f5('0xb')](),controller[_0x94f5('0x10')]);router[_0x94f5('0x11')]('/:id',auth[_0x94f5('0xb')](),controller[_0x94f5('0x12')]);router[_0x94f5('0x13')](_0x94f5('0x14'),auth[_0x94f5('0xb')](),controller[_0x94f5('0x15')]);module[_0x94f5('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c612751..1422d0a 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 _0x72e8=['sequelize','STRING','BOOLEAN'];(function(_0x2ad0c1,_0x7f1bd6){var _0x5c1a2e=function(_0x26ece1){while(--_0x26ece1){_0x2ad0c1['push'](_0x2ad0c1['shift']());}};_0x5c1a2e(++_0x7f1bd6);}(_0x72e8,0x180));var _0x872e=function(_0xe2bc12,_0x22c4a9){_0xe2bc12=_0xe2bc12-0x0;var _0x3cd963=_0x72e8[_0xe2bc12];return _0x3cd963;};'use strict';var Sequelize=require(_0x872e('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x872e('0x1')]},'format':{'type':Sequelize[_0x872e('0x1')]},'groupBy':{'type':Sequelize[_0x872e('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x872e('0x1')]},'custom':{'type':Sequelize[_0x872e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf3e9=['STRING','BOOLEAN','sequelize','exports'];(function(_0x352392,_0x3337c7){var _0x567118=function(_0x142120){while(--_0x142120){_0x352392['push'](_0x352392['shift']());}};_0x567118(++_0x3337c7);}(_0xf3e9,0x14e));var _0x9f3e=function(_0x3883a0,_0x38ddbf){_0x3883a0=_0x3883a0-0x0;var _0x16dc7e=_0xf3e9[_0x3883a0];return _0x16dc7e;};'use strict';var Sequelize=require(_0x9f3e('0x0'));module[_0x9f3e('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x9f3e('0x2')]},'function':{'type':Sequelize[_0x9f3e('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x9f3e('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9f3e('0x2')]},'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 c284e94..5b71c86 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 _0xa4f9=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','fields','length','include','find','create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x656f5c,_0x91ffe7){var _0x2beab5=function(_0x314c9b){while(--_0x314c9b){_0x656f5c['push'](_0x656f5c['shift']());}};_0x2beab5(++_0x91ffe7);}(_0xa4f9,0x1cf));var _0x9a4f=function(_0x52b608,_0x167590){_0x52b608=_0x52b608-0x0;var _0x354586=_0xa4f9[_0x52b608];return _0x354586;};'use strict';var emlformat=require(_0x9a4f('0x0'));var rimraf=require(_0x9a4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a4f('0x2'));var rp=require(_0x9a4f('0x3'));var moment=require(_0x9a4f('0x4'));var BPromise=require(_0x9a4f('0x5'));var Mustache=require(_0x9a4f('0x6'));var util=require(_0x9a4f('0x7'));var path=require(_0x9a4f('0x8'));var sox=require(_0x9a4f('0x9'));var csv=require(_0x9a4f('0xa'));var ejs=require(_0x9a4f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a4f('0xc'));var squel=require(_0x9a4f('0xd'));var crypto=require(_0x9a4f('0xe'));var jsforce=require(_0x9a4f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9a4f('0xa'));var querystring=require(_0x9a4f('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a4f('0x11'));var authService=require(_0x9a4f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9a4f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a4f('0x14'))(_0x9a4f('0x15'));var utils=require(_0x9a4f('0x16'));var config=require(_0x9a4f('0x17'));var licenseUtil=require(_0x9a4f('0x18'));var db=require(_0x9a4f('0x19'))['db'];function respondWithStatusCode(_0x2b8baf,_0x6c6371){_0x6c6371=_0x6c6371||0xcc;return function(_0x2b1e91){if(_0x2b1e91){return _0x2b8baf[_0x9a4f('0x1a')](_0x6c6371);}return _0x2b8baf['status'](_0x6c6371)[_0x9a4f('0x1b')]();};}function respondWithResult(_0x3f82b3,_0x45822b){_0x45822b=_0x45822b||0xc8;return function(_0x5833ac){if(_0x5833ac){return _0x3f82b3['status'](_0x45822b)[_0x9a4f('0x1c')](_0x5833ac);}};}function respondWithFilteredResult(_0x2f1ed9,_0x1b9bf7){return function(_0x5b5f0e){if(_0x5b5f0e){var _0x327f39=typeof _0x1b9bf7[_0x9a4f('0x1d')]===_0x9a4f('0x1e')&&typeof _0x1b9bf7['limit']==='undefined';var _0x29fb52=_0x5b5f0e['count'];var _0xe88cd3=_0x327f39?0x0:_0x1b9bf7[_0x9a4f('0x1d')];var _0x53635f=_0x327f39?_0x5b5f0e[_0x9a4f('0x1f')]:_0x1b9bf7[_0x9a4f('0x1d')]+_0x1b9bf7[_0x9a4f('0x20')];var _0x3e36d9;if(_0x53635f>=_0x29fb52){_0x53635f=_0x29fb52;_0x3e36d9=0xc8;}else{_0x3e36d9=0xce;}_0x2f1ed9[_0x9a4f('0x21')](_0x3e36d9);return _0x2f1ed9[_0x9a4f('0x22')](_0x9a4f('0x23'),_0xe88cd3+'-'+_0x53635f+'/'+_0x29fb52)['json'](_0x5b5f0e);}return null;};}function patchUpdates(_0x46c756){return function(_0x1eb0df){try{jsonpatch[_0x9a4f('0x24')](_0x1eb0df,_0x46c756,!![]);}catch(_0x2cc3d9){return BPromise[_0x9a4f('0x25')](_0x2cc3d9);}return _0x1eb0df['save']();};}function saveUpdates(_0x2ba826,_0x4ebed3){return function(_0xe8b38a){if(_0xe8b38a){return _0xe8b38a[_0x9a4f('0x26')](_0x2ba826)[_0x9a4f('0x27')](function(_0x498735){return _0x498735;});}return null;};}function removeEntity(_0x5c1df7,_0xd7af4f){return function(_0x141ec9){if(_0x141ec9){return _0x141ec9[_0x9a4f('0x28')]()[_0x9a4f('0x27')](function(){_0x5c1df7[_0x9a4f('0x21')](0xcc)[_0x9a4f('0x1b')]();});}};}function handleEntityNotFound(_0x43c2c7,_0x3958e4){return function(_0x4f1681){if(!_0x4f1681){_0x43c2c7['sendStatus'](0x194);}return _0x4f1681;};}function handleError(_0x2f5e32,_0x38bbd9){_0x38bbd9=_0x38bbd9||0x1f4;return function(_0xf48281){logger[_0x9a4f('0x29')](_0xf48281['stack']);if(_0xf48281['name']){delete _0xf48281[_0x9a4f('0x2a')];}_0x2f5e32[_0x9a4f('0x21')](_0x38bbd9)[_0x9a4f('0x2b')](_0xf48281);};}exports[_0x9a4f('0x2c')]=function(_0x5dd19f,_0x1ac219){var _0x16138d={},_0x4d51ed={},_0x586cdf={'count':0x0,'rows':[]};var _0x3f521c=_['map'](db['AnalyticFieldReport'][_0x9a4f('0x2d')],function(_0x3abd90){return{'name':_0x3abd90[_0x9a4f('0x2e')],'type':_0x3abd90[_0x9a4f('0x2f')]['key']};});_0x4d51ed[_0x9a4f('0x30')]=_[_0x9a4f('0x31')](_0x3f521c,'name');_0x4d51ed[_0x9a4f('0x32')]=_[_0x9a4f('0x33')](_0x5dd19f[_0x9a4f('0x32')]);_0x4d51ed[_0x9a4f('0x34')]=_[_0x9a4f('0x35')](_0x4d51ed['model'],_0x4d51ed['query']);_0x16138d[_0x9a4f('0x36')]=_[_0x9a4f('0x35')](_0x4d51ed[_0x9a4f('0x30')],qs['fields'](_0x5dd19f[_0x9a4f('0x32')]['fields']));_0x16138d[_0x9a4f('0x36')]=_0x16138d['attributes']['length']?_0x16138d[_0x9a4f('0x36')]:_0x4d51ed[_0x9a4f('0x30')];if(!_0x5dd19f['query'][_0x9a4f('0x37')]('nolimit')){_0x16138d[_0x9a4f('0x20')]=qs[_0x9a4f('0x20')](_0x5dd19f[_0x9a4f('0x32')][_0x9a4f('0x20')]);_0x16138d[_0x9a4f('0x1d')]=qs[_0x9a4f('0x1d')](_0x5dd19f[_0x9a4f('0x32')][_0x9a4f('0x1d')]);}_0x16138d['order']=qs[_0x9a4f('0x38')](_0x5dd19f[_0x9a4f('0x32')][_0x9a4f('0x38')]);_0x16138d[_0x9a4f('0x39')]=qs[_0x9a4f('0x34')](_['pick'](_0x5dd19f['query'],_0x4d51ed[_0x9a4f('0x34')]),_0x3f521c);if(_0x5dd19f[_0x9a4f('0x32')]['filter']){_0x16138d[_0x9a4f('0x39')]=_[_0x9a4f('0x3a')](_0x16138d[_0x9a4f('0x39')],{'$or':_[_0x9a4f('0x31')](_0x3f521c,function(_0x36d65d){if(_0x36d65d[_0x9a4f('0x2f')]!==_0x9a4f('0x3b')){var _0x5ea237={};_0x5ea237[_0x36d65d[_0x9a4f('0x2a')]]={'$like':'%'+_0x5dd19f['query'][_0x9a4f('0x3c')]+'%'};return _0x5ea237;}})});}_0x16138d=_[_0x9a4f('0x3a')]({},_0x16138d,_0x5dd19f[_0x9a4f('0x3d')]);var _0x2382e9={'where':_0x16138d[_0x9a4f('0x39')]};return db[_0x9a4f('0x3e')][_0x9a4f('0x1f')](_0x2382e9)[_0x9a4f('0x27')](function(_0x3b2283){_0x586cdf[_0x9a4f('0x1f')]=_0x3b2283;if(_0x5dd19f[_0x9a4f('0x32')][_0x9a4f('0x3f')]){_0x16138d['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x9a4f('0x40')](_0x16138d);})[_0x9a4f('0x27')](function(_0x37998f){_0x586cdf[_0x9a4f('0x41')]=_0x37998f;return _0x586cdf;})['then'](respondWithFilteredResult(_0x1ac219,_0x16138d))[_0x9a4f('0x42')](handleError(_0x1ac219,null));};exports[_0x9a4f('0x43')]=function(_0x1634ea,_0x24c2a2){var _0x1baf81={'raw':![],'where':{'id':_0x1634ea[_0x9a4f('0x44')]['id']}},_0x2d90a5={};_0x2d90a5[_0x9a4f('0x30')]=_[_0x9a4f('0x33')](db[_0x9a4f('0x3e')][_0x9a4f('0x2d')]);_0x2d90a5[_0x9a4f('0x32')]=_[_0x9a4f('0x33')](_0x1634ea[_0x9a4f('0x32')]);_0x2d90a5[_0x9a4f('0x34')]=_[_0x9a4f('0x35')](_0x2d90a5[_0x9a4f('0x30')],_0x2d90a5['query']);_0x1baf81[_0x9a4f('0x36')]=_['intersection'](_0x2d90a5[_0x9a4f('0x30')],qs['fields'](_0x1634ea[_0x9a4f('0x32')][_0x9a4f('0x45')]));_0x1baf81[_0x9a4f('0x36')]=_0x1baf81[_0x9a4f('0x36')][_0x9a4f('0x46')]?_0x1baf81[_0x9a4f('0x36')]:_0x2d90a5[_0x9a4f('0x30')];if(_0x1634ea['query'][_0x9a4f('0x3f')]){_0x1baf81[_0x9a4f('0x47')]=[{'all':!![]}];}_0x1baf81=_[_0x9a4f('0x3a')]({},_0x1baf81,_0x1634ea['options']);return db[_0x9a4f('0x3e')][_0x9a4f('0x48')](_0x1baf81)['then'](handleEntityNotFound(_0x24c2a2,null))[_0x9a4f('0x27')](respondWithResult(_0x24c2a2,null))[_0x9a4f('0x42')](handleError(_0x24c2a2,null));};exports[_0x9a4f('0x49')]=function(_0x324bee,_0x1ae9fc){return db['AnalyticFieldReport'][_0x9a4f('0x49')](_0x324bee['body'],{})[_0x9a4f('0x27')](respondWithResult(_0x1ae9fc,0xc9))[_0x9a4f('0x42')](handleError(_0x1ae9fc,null));};exports['bulkCreate']=function(_0x1ec51e,_0xefc89d){return db[_0x9a4f('0x3e')][_0x9a4f('0x4a')](_0x1ec51e[_0x9a4f('0x4b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xefc89d,0xc9))[_0x9a4f('0x42')](handleError(_0xefc89d,null));};exports[_0x9a4f('0x26')]=function(_0x483523,_0xfdd10){if(_0x483523['body']['id']){delete _0x483523[_0x9a4f('0x4b')]['id'];}return db[_0x9a4f('0x3e')][_0x9a4f('0x48')]({'where':{'id':_0x483523[_0x9a4f('0x44')]['id']}})[_0x9a4f('0x27')](handleEntityNotFound(_0xfdd10,null))[_0x9a4f('0x27')](saveUpdates(_0x483523['body'],null))[_0x9a4f('0x27')](respondWithResult(_0xfdd10,null))[_0x9a4f('0x42')](handleError(_0xfdd10,null));};exports[_0x9a4f('0x28')]=function(_0x232bb5,_0x2dd0a5){return db['AnalyticFieldReport'][_0x9a4f('0x48')]({'where':{'id':_0x232bb5[_0x9a4f('0x44')]['id']}})[_0x9a4f('0x27')](handleEntityNotFound(_0x2dd0a5,null))[_0x9a4f('0x27')](removeEntity(_0x2dd0a5,null))[_0x9a4f('0x42')](handleError(_0x2dd0a5,null));};exports[_0x9a4f('0x4c')]=function(_0x5f5de1,_0x273698){return db['AnalyticFieldReport'][_0x9a4f('0x28')]({'where':{'id':_0x5f5de1[_0x9a4f('0x32')][_0x9a4f('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x273698,0xcc))[_0x9a4f('0x42')](handleError(_0x273698,null));};exports['addFields']=function(_0xce80ec,_0x19089a,_0x5f2f95){return db[_0x9a4f('0x4e')]['findOne']({'where':{'id':_0xce80ec[_0x9a4f('0x44')]['id']}})['then'](handleEntityNotFound(_0x19089a,null))[_0x9a4f('0x27')](function(_0x5c62e8){if(_0x5c62e8){return db['sequelize'][_0x9a4f('0x4f')](function(_0x46e37d){return db[_0x9a4f('0x3e')]['destroy']({'where':{'CustomReportId':_0xce80ec[_0x9a4f('0x44')]['id']},'transaction':_0x46e37d})[_0x9a4f('0x27')](function(_0x2fb047){var _0x4dce74=_[_0x9a4f('0x31')](_0xce80ec[_0x9a4f('0x4b')],function(_0x3418c9){delete _0x3418c9['id'];_0x3418c9[_0x9a4f('0x50')]=_0xce80ec[_0x9a4f('0x44')]['id'];return _0x3418c9;});return db['AnalyticFieldReport'][_0x9a4f('0x4a')](_0x4dce74,{'transaction':_0x46e37d});});})[_0x9a4f('0x27')](function(){return db[_0x9a4f('0x3e')]['findAll']({'where':{'CustomReportId':_0xce80ec['params']['id']}});});}})[_0x9a4f('0x27')](respondWithResult(_0x19089a,null))['catch'](handleError(_0x19089a,null));}; \ No newline at end of file +var _0x7494=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7494,0x1e8));var _0x4749=function(_0x4b9ba1,_0x211e29){_0x4b9ba1=_0x4b9ba1-0x0;var _0x26b052=_0x7494[_0x4b9ba1];return _0x26b052;};'use strict';var emlformat=require(_0x4749('0x0'));var rimraf=require(_0x4749('0x1'));var zipdir=require(_0x4749('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4749('0x3'));var moment=require('moment');var BPromise=require(_0x4749('0x4'));var Mustache=require(_0x4749('0x5'));var util=require(_0x4749('0x6'));var path=require(_0x4749('0x7'));var sox=require(_0x4749('0x8'));var csv=require(_0x4749('0x9'));var ejs=require(_0x4749('0xa'));var fs=require('fs');var fs_extra=require(_0x4749('0xb'));var _=require('lodash');var squel=require(_0x4749('0xc'));var crypto=require(_0x4749('0xd'));var jsforce=require(_0x4749('0xe'));var deskjs=require(_0x4749('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4749('0x10'));var Papa=require('papaparse');var Redis=require(_0x4749('0x11'));var authService=require(_0x4749('0x12'));var qs=require(_0x4749('0x13'));var as=require(_0x4749('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4749('0x15'))('api');var utils=require(_0x4749('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4749('0x17'));var db=require(_0x4749('0x18'))['db'];function respondWithStatusCode(_0xd412d1,_0x171248){_0x171248=_0x171248||0xcc;return function(_0x45845e){if(_0x45845e){return _0xd412d1[_0x4749('0x19')](_0x171248);}return _0xd412d1[_0x4749('0x1a')](_0x171248)[_0x4749('0x1b')]();};}function respondWithResult(_0x55c44a,_0x203d33){_0x203d33=_0x203d33||0xc8;return function(_0x4fc66a){if(_0x4fc66a){return _0x55c44a[_0x4749('0x1a')](_0x203d33)[_0x4749('0x1c')](_0x4fc66a);}};}function respondWithFilteredResult(_0x1cbc3e,_0x2fcfa2){return function(_0x3bd2c5){if(_0x3bd2c5){var _0x378a70=typeof _0x2fcfa2['offset']===_0x4749('0x1d')&&typeof _0x2fcfa2[_0x4749('0x1e')]===_0x4749('0x1d');var _0x53576e=_0x3bd2c5['count'];var _0x1f235e=_0x378a70?0x0:_0x2fcfa2[_0x4749('0x1f')];var _0x362e4f=_0x378a70?_0x3bd2c5[_0x4749('0x20')]:_0x2fcfa2['offset']+_0x2fcfa2['limit'];var _0x14db2b;if(_0x362e4f>=_0x53576e){_0x362e4f=_0x53576e;_0x14db2b=0xc8;}else{_0x14db2b=0xce;}_0x1cbc3e[_0x4749('0x1a')](_0x14db2b);return _0x1cbc3e[_0x4749('0x21')](_0x4749('0x22'),_0x1f235e+'-'+_0x362e4f+'/'+_0x53576e)[_0x4749('0x1c')](_0x3bd2c5);}return null;};}function patchUpdates(_0x241a76){return function(_0x2794ea){try{jsonpatch['apply'](_0x2794ea,_0x241a76,!![]);}catch(_0x11b599){return BPromise[_0x4749('0x23')](_0x11b599);}return _0x2794ea['save']();};}function saveUpdates(_0x1ad389,_0x176420){return function(_0x8516d6){if(_0x8516d6){return _0x8516d6[_0x4749('0x24')](_0x1ad389)[_0x4749('0x25')](function(_0x14ad62){return _0x14ad62;});}return null;};}function removeEntity(_0x3b950c,_0x35f298){return function(_0xeab13c){if(_0xeab13c){return _0xeab13c[_0x4749('0x26')]()[_0x4749('0x25')](function(){_0x3b950c['status'](0xcc)[_0x4749('0x1b')]();});}};}function handleEntityNotFound(_0x91547d,_0x4e649d){return function(_0x9f1632){if(!_0x9f1632){_0x91547d[_0x4749('0x19')](0x194);}return _0x9f1632;};}function handleError(_0x4fef74,_0x36dd51){_0x36dd51=_0x36dd51||0x1f4;return function(_0x469f32){logger[_0x4749('0x27')](_0x469f32[_0x4749('0x28')]);if(_0x469f32[_0x4749('0x29')]){delete _0x469f32['name'];}_0x4fef74[_0x4749('0x1a')](_0x36dd51)[_0x4749('0x2a')](_0x469f32);};}exports['index']=function(_0x299b47,_0x53b71a){var _0x5072e9={},_0x1bc56e={},_0x9e49fc={'count':0x0,'rows':[]};var _0x967886=_[_0x4749('0x2b')](db[_0x4749('0x2c')]['rawAttributes'],function(_0x4a58c1){return{'name':_0x4a58c1[_0x4749('0x2d')],'type':_0x4a58c1[_0x4749('0x2e')][_0x4749('0x2f')]};});_0x1bc56e['model']=_[_0x4749('0x2b')](_0x967886,_0x4749('0x29'));_0x1bc56e[_0x4749('0x30')]=_[_0x4749('0x31')](_0x299b47['query']);_0x1bc56e[_0x4749('0x32')]=_[_0x4749('0x33')](_0x1bc56e[_0x4749('0x34')],_0x1bc56e[_0x4749('0x30')]);_0x5072e9['attributes']=_[_0x4749('0x33')](_0x1bc56e[_0x4749('0x34')],qs[_0x4749('0x35')](_0x299b47[_0x4749('0x30')][_0x4749('0x35')]));_0x5072e9[_0x4749('0x36')]=_0x5072e9[_0x4749('0x36')][_0x4749('0x37')]?_0x5072e9[_0x4749('0x36')]:_0x1bc56e['model'];if(!_0x299b47['query'][_0x4749('0x38')](_0x4749('0x39'))){_0x5072e9[_0x4749('0x1e')]=qs[_0x4749('0x1e')](_0x299b47['query'][_0x4749('0x1e')]);_0x5072e9[_0x4749('0x1f')]=qs[_0x4749('0x1f')](_0x299b47['query'][_0x4749('0x1f')]);}_0x5072e9[_0x4749('0x3a')]=qs[_0x4749('0x3b')](_0x299b47['query'][_0x4749('0x3b')]);_0x5072e9['where']=qs[_0x4749('0x32')](_[_0x4749('0x3c')](_0x299b47['query'],_0x1bc56e[_0x4749('0x32')]),_0x967886);if(_0x299b47[_0x4749('0x30')][_0x4749('0x3d')]){_0x5072e9[_0x4749('0x3e')]=_[_0x4749('0x3f')](_0x5072e9['where'],{'$or':_[_0x4749('0x2b')](_0x967886,function(_0x4fd305){if(_0x4fd305[_0x4749('0x2e')]!=='VIRTUAL'){var _0x5c0fdf={};_0x5c0fdf[_0x4fd305['name']]={'$like':'%'+_0x299b47[_0x4749('0x30')][_0x4749('0x3d')]+'%'};return _0x5c0fdf;}})});}_0x5072e9=_[_0x4749('0x3f')]({},_0x5072e9,_0x299b47['options']);var _0x43f449={'where':_0x5072e9[_0x4749('0x3e')]};return db['AnalyticFieldReport'][_0x4749('0x20')](_0x43f449)['then'](function(_0x6e6ba7){_0x9e49fc[_0x4749('0x20')]=_0x6e6ba7;if(_0x299b47[_0x4749('0x30')][_0x4749('0x40')]){_0x5072e9[_0x4749('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4749('0x42')](_0x5072e9);})[_0x4749('0x25')](function(_0xd9cf08){_0x9e49fc['rows']=_0xd9cf08;return _0x9e49fc;})[_0x4749('0x25')](respondWithFilteredResult(_0x53b71a,_0x5072e9))[_0x4749('0x43')](handleError(_0x53b71a,null));};exports[_0x4749('0x44')]=function(_0x50e3ca,_0x1b0ba3){var _0x2c6ae8={'raw':![],'where':{'id':_0x50e3ca['params']['id']}},_0x161790={};_0x161790[_0x4749('0x34')]=_['keys'](db[_0x4749('0x2c')][_0x4749('0x45')]);_0x161790['query']=_[_0x4749('0x31')](_0x50e3ca[_0x4749('0x30')]);_0x161790[_0x4749('0x32')]=_[_0x4749('0x33')](_0x161790[_0x4749('0x34')],_0x161790[_0x4749('0x30')]);_0x2c6ae8['attributes']=_[_0x4749('0x33')](_0x161790[_0x4749('0x34')],qs[_0x4749('0x35')](_0x50e3ca[_0x4749('0x30')][_0x4749('0x35')]));_0x2c6ae8[_0x4749('0x36')]=_0x2c6ae8[_0x4749('0x36')][_0x4749('0x37')]?_0x2c6ae8['attributes']:_0x161790[_0x4749('0x34')];if(_0x50e3ca[_0x4749('0x30')][_0x4749('0x40')]){_0x2c6ae8[_0x4749('0x41')]=[{'all':!![]}];}_0x2c6ae8=_[_0x4749('0x3f')]({},_0x2c6ae8,_0x50e3ca[_0x4749('0x46')]);return db[_0x4749('0x2c')][_0x4749('0x47')](_0x2c6ae8)[_0x4749('0x25')](handleEntityNotFound(_0x1b0ba3,null))[_0x4749('0x25')](respondWithResult(_0x1b0ba3,null))['catch'](handleError(_0x1b0ba3,null));};exports[_0x4749('0x48')]=function(_0x2d0638,_0x1eb7ae){return db['AnalyticFieldReport'][_0x4749('0x48')](_0x2d0638[_0x4749('0x49')],{})[_0x4749('0x25')](respondWithResult(_0x1eb7ae,0xc9))[_0x4749('0x43')](handleError(_0x1eb7ae,null));};exports['bulkCreate']=function(_0x39ad55,_0x863db4){return db[_0x4749('0x2c')][_0x4749('0x4a')](_0x39ad55[_0x4749('0x49')],{'raw':![],'individualHooks':!![]})[_0x4749('0x25')](respondWithResult(_0x863db4,0xc9))['catch'](handleError(_0x863db4,null));};exports[_0x4749('0x24')]=function(_0x4e8b51,_0x4afab3){if(_0x4e8b51['body']['id']){delete _0x4e8b51[_0x4749('0x49')]['id'];}return db[_0x4749('0x2c')][_0x4749('0x47')]({'where':{'id':_0x4e8b51[_0x4749('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4afab3,null))[_0x4749('0x25')](saveUpdates(_0x4e8b51['body'],null))[_0x4749('0x25')](respondWithResult(_0x4afab3,null))['catch'](handleError(_0x4afab3,null));};exports[_0x4749('0x26')]=function(_0x3ce349,_0x4b8815){return db[_0x4749('0x2c')][_0x4749('0x47')]({'where':{'id':_0x3ce349['params']['id']}})[_0x4749('0x25')](handleEntityNotFound(_0x4b8815,null))[_0x4749('0x25')](removeEntity(_0x4b8815,null))[_0x4749('0x43')](handleError(_0x4b8815,null));};exports[_0x4749('0x4c')]=function(_0x399242,_0x30f4bf){return db[_0x4749('0x2c')][_0x4749('0x26')]({'where':{'id':_0x399242[_0x4749('0x30')][_0x4749('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x4749('0x25')](respondWithResult(_0x30f4bf,0xcc))[_0x4749('0x43')](handleError(_0x30f4bf,null));};exports[_0x4749('0x4e')]=function(_0x541129,_0x30a1ca,_0x522f72){return db[_0x4749('0x4f')][_0x4749('0x50')]({'where':{'id':_0x541129[_0x4749('0x4b')]['id']}})['then'](handleEntityNotFound(_0x30a1ca,null))[_0x4749('0x25')](function(_0x144513){if(_0x144513){return db[_0x4749('0x51')][_0x4749('0x52')](function(_0x1478da){return db[_0x4749('0x2c')][_0x4749('0x26')]({'where':{'CustomReportId':_0x541129['params']['id']},'transaction':_0x1478da})['then'](function(_0x2706de){var _0x3be598=_[_0x4749('0x2b')](_0x541129[_0x4749('0x49')],function(_0x42e934){delete _0x42e934['id'];_0x42e934[_0x4749('0x53')]=_0x541129[_0x4749('0x4b')]['id'];return _0x42e934;});return db[_0x4749('0x2c')][_0x4749('0x4a')](_0x3be598,{'transaction':_0x1478da});});})[_0x4749('0x25')](function(){return db[_0x4749('0x2c')][_0x4749('0x42')]({'where':{'CustomReportId':_0x541129[_0x4749('0x4b')]['id']}});});}})[_0x4749('0x25')](respondWithResult(_0x30a1ca,null))[_0x4749('0x43')](handleError(_0x30a1ca,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 4e29ec9..c462fdc 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 _0x2135=['rimraf','../../config/environment','./analyticFieldReport.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2146c3,_0x59a32a){var _0x7e73f=function(_0xe344b7){while(--_0xe344b7){_0x2146c3['push'](_0x2146c3['shift']());}};_0x7e73f(++_0x59a32a);}(_0x2135,0xad));var _0x5213=function(_0x2b266c,_0x39fd9f){_0x2b266c=_0x2b266c-0x0;var _0x3c38f2=_0x2135[_0x2b266c];return _0x3c38f2;};'use strict';var _=require(_0x5213('0x0'));var util=require(_0x5213('0x1'));var logger=require(_0x5213('0x2'))(_0x5213('0x3'));var moment=require(_0x5213('0x4'));var BPromise=require(_0x5213('0x5'));var rp=require(_0x5213('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5213('0x7'));var config=require(_0x5213('0x8'));var attributes=require(_0x5213('0x9'));module['exports']=function(_0x234f24,_0x2fa47e){return _0x234f24['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a7c=['exports','define','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a7c,0xf5));var _0xc7a7=function(_0x5685df,_0x2d90b1){_0x5685df=_0x5685df-0x0;var _0x598211=_0x7a7c[_0x5685df];return _0x598211;};'use strict';var _=require(_0xc7a7('0x0'));var util=require(_0xc7a7('0x1'));var logger=require(_0xc7a7('0x2'))(_0xc7a7('0x3'));var moment=require('moment');var BPromise=require(_0xc7a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7a7('0x5'));var rimraf=require(_0xc7a7('0x6'));var config=require(_0xc7a7('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xc7a7('0x8')]=function(_0x3bb62b,_0x1f6fc4){return _0x3bb62b[_0xc7a7('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xc7a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 7a26b1f..bb2a851 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 _0x4341=['rpc','../../config/environment','jayson/promise','client','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x17a8b5,_0x2842bd){var _0x3c05c6=function(_0x3d85ee){while(--_0x3d85ee){_0x17a8b5['push'](_0x17a8b5['shift']());}};_0x3c05c6(++_0x2842bd);}(_0x4341,0x1dc));var _0x1434=function(_0x484ad6,_0x4efaee){_0x484ad6=_0x484ad6-0x0;var _0x4950d0=_0x4341[_0x484ad6];return _0x4950d0;};'use strict';var _=require(_0x1434('0x0'));var util=require(_0x1434('0x1'));var moment=require(_0x1434('0x2'));var BPromise=require('bluebird');var rs=require(_0x1434('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1434('0x4'))['db'];var utils=require(_0x1434('0x5'));var logger=require(_0x1434('0x6'))(_0x1434('0x7'));var config=require(_0x1434('0x8'));var jayson=require(_0x1434('0x9'));var client=jayson[_0x1434('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23bcf3,_0x3f1aca,_0x26d3f0){return new BPromise(function(_0x4e739b,_0x46cd0d){return client['request'](_0x23bcf3,_0x26d3f0)[_0x1434('0xb')](function(_0x4a9222){logger[_0x1434('0xc')](_0x1434('0xd'),_0x3f1aca,'request\x20sent');logger['debug'](_0x1434('0xe'),_0x3f1aca,_0x1434('0xf'),JSON[_0x1434('0x10')](_0x4a9222));if(_0x4a9222[_0x1434('0x11')]){if(_0x4a9222[_0x1434('0x11')][_0x1434('0x12')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3f1aca,_0x4a9222[_0x1434('0x11')][_0x1434('0x13')]);return _0x46cd0d(_0x4a9222['error'][_0x1434('0x13')]);}logger[_0x1434('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f1aca,_0x4a9222[_0x1434('0x11')][_0x1434('0x13')]);return _0x4e739b(_0x4a9222[_0x1434('0x11')][_0x1434('0x13')]);}else{logger['info'](_0x1434('0xd'),_0x3f1aca,_0x1434('0xf'));_0x4e739b(_0x4a9222[_0x1434('0x14')][_0x1434('0x13')]);}})['catch'](function(_0x4e24cf){logger[_0x1434('0x11')](_0x1434('0xd'),_0x3f1aca,_0x4e24cf);_0x46cd0d(_0x4e24cf);});});} \ No newline at end of file +var _0x017a=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5d897d,_0x8f648e){var _0x21a626=function(_0x43d4c9){while(--_0x43d4c9){_0x5d897d['push'](_0x5d897d['shift']());}};_0x21a626(++_0x8f648e);}(_0x017a,0x109));var _0xa017=function(_0x8dd49d,_0x44905f){_0x8dd49d=_0x8dd49d-0x0;var _0x9c74eb=_0x017a[_0x8dd49d];return _0x9c74eb;};'use strict';var _=require(_0xa017('0x0'));var util=require('util');var moment=require(_0xa017('0x1'));var BPromise=require(_0xa017('0x2'));var rs=require(_0xa017('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa017('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa017('0x5'))(_0xa017('0x6'));var config=require(_0xa017('0x7'));var jayson=require(_0xa017('0x8'));var client=jayson[_0xa017('0x9')][_0xa017('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d6701,_0x38fd91,_0x5b2eda){return new BPromise(function(_0x52f000,_0x4abacf){return client[_0xa017('0xb')](_0x2d6701,_0x5b2eda)['then'](function(_0x4e6559){logger[_0xa017('0xc')](_0xa017('0xd'),_0x38fd91,_0xa017('0xe'));logger['debug'](_0xa017('0xf'),_0x38fd91,_0xa017('0xe'),JSON[_0xa017('0x10')](_0x4e6559));if(_0x4e6559['error']){if(_0x4e6559[_0xa017('0x11')][_0xa017('0x12')]===0x1f4){logger[_0xa017('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x38fd91,_0x4e6559[_0xa017('0x11')][_0xa017('0x13')]);return _0x4abacf(_0x4e6559[_0xa017('0x11')][_0xa017('0x13')]);}logger['error'](_0xa017('0xd'),_0x38fd91,_0x4e6559[_0xa017('0x11')][_0xa017('0x13')]);return _0x52f000(_0x4e6559[_0xa017('0x11')][_0xa017('0x13')]);}else{logger[_0xa017('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x38fd91,_0xa017('0xe'));_0x52f000(_0x4e6559[_0xa017('0x14')][_0xa017('0x13')]);}})[_0xa017('0x15')](function(_0x55ed48){logger[_0xa017('0x11')](_0xa017('0xd'),_0x38fd91,_0x55ed48);_0x4abacf(_0x55ed48);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4cb677d..8be3023 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(_0x238247,_0x2d988c){var _0x5966db=function(_0xa89fb5){while(--_0xa89fb5){_0x238247['push'](_0x238247['shift']());}};_0x5966db(++_0x2d988c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x2654ec,_0x30d1ba){var _0x4c3b5=function(_0x464e80){while(--_0x464e80){_0x2654ec['push'](_0x2654ec['shift']());}};_0x4c3b5(++_0x30d1ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 e25a643..a86cbc9 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 _0xfaa4=['exports','STRING','name','TEXT','sequelize'];(function(_0x3764f8,_0x186d80){var _0x2fd9af=function(_0x3dda80){while(--_0x3dda80){_0x3764f8['push'](_0x3764f8['shift']());}};_0x2fd9af(++_0x186d80);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x271c43,_0xfa9cf5){_0x271c43=_0x271c43-0x0;var _0x28e9f9=_0xfaa4[_0x271c43];return _0x28e9f9;};'use strict';var Sequelize=require(_0x4faa('0x0'));module[_0x4faa('0x1')]={'name':{'type':Sequelize[_0x4faa('0x2')],'allowNull':![],'unique':_0x4faa('0x3')},'table':{'type':Sequelize[_0x4faa('0x2')]},'metric':{'type':Sequelize[_0x4faa('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a83=['STRING','sequelize','exports'];(function(_0x2c4e32,_0x3a5590){var _0x1eac30=function(_0x236c8e){while(--_0x236c8e){_0x2c4e32['push'](_0x2c4e32['shift']());}};_0x1eac30(++_0x3a5590);}(_0x1a83,0x1c0));var _0x31a8=function(_0xf28cc5,_0x5a0cd2){_0xf28cc5=_0xf28cc5-0x0;var _0xd96383=_0x1a83[_0xf28cc5];return _0xd96383;};'use strict';var Sequelize=require(_0x31a8('0x0'));module[_0x31a8('0x1')]={'name':{'type':Sequelize[_0x31a8('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x31a8('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x31a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0182411..7506aa3 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3a4b19,_0x3be831){var _0x16f356=function(_0x3b242f){while(--_0x3b242f){_0x3a4b19['push'](_0x3a4b19['shift']());}};_0x16f356(++_0x3be831);}(_0x008c,0x188));var _0xc008=function(_0x11c4b6,_0x572fdb){_0x11c4b6=_0x11c4b6-0x0;var _0x2cb405=_0x008c[_0x11c4b6];return _0x2cb405;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0x9957=['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','Metrics','UserProfileResource','end','error','name','map','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticMetric','include','findAll','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){var _0x472195=_0x563799['get']({'plain':!![]});var _0x39df42=_0x7995('0x28');return db[_0x7995('0x29')][_0x7995('0x27')]({'where':{'type':_0x39df42,'resourceId':_0x472195['id']}})[_0x7995('0x26')](function(){return _0x563799;});})[_0x7995('0x26')](function(){_0x204507['status'](0xcc)[_0x7995('0x2a')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x1b')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2b')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x2c')]){delete _0x4b6f99[_0x7995('0x2c')];}_0x132a42[_0x7995('0x1c')](_0x11c1eb)['send'](_0x4b6f99);};}exports['index']=function(_0x48e573,_0x3573be){var _0xe6b0b3={},_0x327a81={},_0x2b874d={'count':0x0,'rows':[]};var _0x2e3493=_[_0x7995('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0xfa8f15){return{'name':_0xfa8f15['fieldName'],'type':_0xfa8f15[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x327a81[_0x7995('0x30')]=_[_0x7995('0x2d')](_0x2e3493,_0x7995('0x2c'));_0x327a81['query']=_[_0x7995('0x31')](_0x48e573[_0x7995('0x32')]);_0x327a81['filters']=_['intersection'](_0x327a81['model'],_0x327a81[_0x7995('0x32')]);_0xe6b0b3[_0x7995('0x33')]=_['intersection'](_0x327a81[_0x7995('0x30')],qs['fields'](_0x48e573[_0x7995('0x32')][_0x7995('0x34')]));_0xe6b0b3[_0x7995('0x33')]=_0xe6b0b3['attributes']['length']?_0xe6b0b3[_0x7995('0x33')]:_0x327a81['model'];if(!_0x48e573['query'][_0x7995('0x35')](_0x7995('0x36'))){_0xe6b0b3['limit']=qs[_0x7995('0x21')](_0x48e573[_0x7995('0x32')][_0x7995('0x21')]);_0xe6b0b3[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x48e573['query'][_0x7995('0x20')]);}_0xe6b0b3[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x48e573[_0x7995('0x32')]['sort']);_0xe6b0b3[_0x7995('0x39')]=qs[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x48e573[_0x7995('0x32')],_0x327a81[_0x7995('0x3a')]),_0x2e3493);if(_0x48e573[_0x7995('0x32')]['filter']){_0xe6b0b3[_0x7995('0x39')]=_[_0x7995('0x3c')](_0xe6b0b3[_0x7995('0x39')],{'$or':_[_0x7995('0x2d')](_0x2e3493,function(_0x2e04cd){if(_0x2e04cd[_0x7995('0x2e')]!==_0x7995('0x3d')){var _0x270c0e={};_0x270c0e[_0x2e04cd[_0x7995('0x2c')]]={'$like':'%'+_0x48e573[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x270c0e;}})});}_0xe6b0b3=_[_0x7995('0x3c')]({},_0xe6b0b3,_0x48e573[_0x7995('0x3f')]);var _0x53cda2={'where':_0xe6b0b3['where']};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x53cda2)['then'](function(_0x4b0855){_0x2b874d[_0x7995('0x1f')]=_0x4b0855;if(_0x48e573['query']['includeAll']){_0xe6b0b3[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x42')](_0xe6b0b3);})['then'](function(_0x46ac4f){_0x2b874d['rows']=_0x46ac4f;return _0x2b874d;})[_0x7995('0x26')](respondWithFilteredResult(_0x3573be,_0xe6b0b3))['catch'](handleError(_0x3573be,null));};exports['show']=function(_0x39c5b8,_0x403f54){var _0xc04e5={'raw':!![],'where':{'id':_0x39c5b8['params']['id']}},_0x3f1c35={};_0x3f1c35[_0x7995('0x30')]=_[_0x7995('0x31')](db[_0x7995('0x40')][_0x7995('0x43')]);_0x3f1c35['query']=_['keys'](_0x39c5b8[_0x7995('0x32')]);_0x3f1c35['filters']=_[_0x7995('0x44')](_0x3f1c35['model'],_0x3f1c35[_0x7995('0x32')]);_0xc04e5['attributes']=_[_0x7995('0x44')](_0x3f1c35[_0x7995('0x30')],qs['fields'](_0x39c5b8[_0x7995('0x32')][_0x7995('0x34')]));_0xc04e5[_0x7995('0x33')]=_0xc04e5[_0x7995('0x33')]['length']?_0xc04e5[_0x7995('0x33')]:_0x3f1c35[_0x7995('0x30')];if(_0x39c5b8[_0x7995('0x32')]['includeAll']){_0xc04e5[_0x7995('0x41')]=[{'all':!![]}];}_0xc04e5=_[_0x7995('0x3c')]({},_0xc04e5,_0x39c5b8[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x45')](_0xc04e5)['then'](handleEntityNotFound(_0x403f54,null))[_0x7995('0x26')](respondWithResult(_0x403f54,null))[_0x7995('0x46')](handleError(_0x403f54,null));};exports['create']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x40')][_0x7995('0x47')](_0x3d1dbb[_0x7995('0x48')],{})[_0x7995('0x26')](function(_0xddf537){var _0x14b537=_0x3d1dbb[_0x7995('0x49')]['get']({'plain':!![]});if(!_0x14b537)throw new Error(_0x7995('0x4a'));if(_0x14b537[_0x7995('0x4b')]===_0x7995('0x49')){var _0x4ffc8a=_0xddf537[_0x7995('0x4c')]({'plain':!![]});var _0x1fe77e=_0x7995('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1fe77e,'userProfileId':_0x14b537['userProfileId']},'raw':!![]})[_0x7995('0x26')](function(_0x1fd1ca){if(_0x1fd1ca&&_0x1fd1ca['autoAssociation']===0x0){return db[_0x7995('0x29')][_0x7995('0x47')]({'name':_0x4ffc8a[_0x7995('0x2c')],'resourceId':_0x4ffc8a['id'],'type':_0x1fd1ca[_0x7995('0x2c')],'sectionId':_0x1fd1ca['id']},{})[_0x7995('0x26')](function(){return _0xddf537;});}else{return _0xddf537;}})['catch'](function(_0x29ee32){logger['error'](_0x7995('0x4d'),_0x29ee32);throw _0x29ee32;});}return _0xddf537;})[_0x7995('0x26')](respondWithResult(_0x5843ba,0xc9))[_0x7995('0x46')](handleError(_0x5843ba,null));};exports['update']=function(_0x5e1f34,_0x54e2b1){if(_0x5e1f34['body']['id']){delete _0x5e1f34[_0x7995('0x48')]['id'];}return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0x5e1f34[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x26')](saveUpdates(_0x5e1f34[_0x7995('0x48')],null))[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x46')](handleError(_0x54e2b1,null));};exports[_0x7995('0x27')]=function(_0xa7af8c,_0x133c63){return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0xa7af8c[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x133c63,null))[_0x7995('0x26')](removeEntity(_0x133c63,null))[_0x7995('0x46')](handleError(_0x133c63,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 719ad55..12dad25 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 _0x44fe=['./analyticMetric.attributes','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x44fe,0x16f));var _0xe44f=function(_0x27f970,_0x2249a6){_0x27f970=_0x27f970-0x0;var _0x3ae10f=_0x44fe[_0x27f970];return _0x3ae10f;};'use strict';var _=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var logger=require(_0xe44f('0x2'))(_0xe44f('0x3'));var moment=require(_0xe44f('0x4'));var BPromise=require(_0xe44f('0x5'));var rp=require(_0xe44f('0x6'));var fs=require('fs');var path=require(_0xe44f('0x7'));var rimraf=require(_0xe44f('0x8'));var config=require(_0xe44f('0x9'));var attributes=require(_0xe44f('0xa'));module['exports']=function(_0x4a41be,_0x1abe56){return _0x4a41be[_0xe44f('0xb')]('AnalyticMetric',attributes,{'tableName':_0xe44f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5419=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0x1fb471,_0x5904f9){var _0x3b1354=function(_0x4dc5ef){while(--_0x4dc5ef){_0x1fb471['push'](_0x1fb471['shift']());}};_0x3b1354(++_0x5904f9);}(_0x5419,0x175));var _0x9541=function(_0x21bf3e,_0x82e5f2){_0x21bf3e=_0x21bf3e-0x0;var _0x3fdb5a=_0x5419[_0x21bf3e];return _0x3fdb5a;};'use strict';var _=require(_0x9541('0x0'));var util=require(_0x9541('0x1'));var logger=require(_0x9541('0x2'))(_0x9541('0x3'));var moment=require(_0x9541('0x4'));var BPromise=require(_0x9541('0x5'));var rp=require(_0x9541('0x6'));var fs=require('fs');var path=require(_0x9541('0x7'));var rimraf=require(_0x9541('0x8'));var config=require(_0x9541('0x9'));var attributes=require('./analyticMetric.attributes');module[_0x9541('0xa')]=function(_0x1f9139,_0xbdabaf){return _0x1f9139[_0x9541('0xb')](_0x9541('0xc'),attributes,{'tableName':_0x9541('0xd'),'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 64638d2..0f8c5c1 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 _0x5020=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x5020,0x1ed));var _0x0502=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5020[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0502('0x0'));var util=require(_0x0502('0x1'));var moment=require(_0x0502('0x2'));var BPromise=require(_0x0502('0x3'));var rs=require(_0x0502('0x4'));var fs=require('fs');var Redis=require(_0x0502('0x5'));var db=require(_0x0502('0x6'))['db'];var utils=require(_0x0502('0x7'));var logger=require(_0x0502('0x8'))('rpc');var config=require(_0x0502('0x9'));var jayson=require(_0x0502('0xa'));var client=jayson[_0x0502('0xb')][_0x0502('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12c782,_0x11e20a,_0x401122){return new BPromise(function(_0x55d1d2,_0x340f75){return client[_0x0502('0xd')](_0x12c782,_0x401122)[_0x0502('0xe')](function(_0x29ca70){logger[_0x0502('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x11e20a,_0x0502('0x10'));logger[_0x0502('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x11e20a,'request\x20sent',JSON[_0x0502('0x12')](_0x29ca70));if(_0x29ca70[_0x0502('0x13')]){if(_0x29ca70[_0x0502('0x13')][_0x0502('0x14')]===0x1f4){logger[_0x0502('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x11e20a,_0x29ca70[_0x0502('0x13')][_0x0502('0x15')]);return _0x340f75(_0x29ca70['error'][_0x0502('0x15')]);}logger['error'](_0x0502('0x16'),_0x11e20a,_0x29ca70[_0x0502('0x13')][_0x0502('0x15')]);return _0x55d1d2(_0x29ca70[_0x0502('0x13')][_0x0502('0x15')]);}else{logger[_0x0502('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x11e20a,_0x0502('0x10'));_0x55d1d2(_0x29ca70['result'][_0x0502('0x15')]);}})[_0x0502('0x17')](function(_0x558982){logger['error'](_0x0502('0x16'),_0x11e20a,_0x558982);_0x340f75(_0x558982);});});} \ No newline at end of file +var _0x8162=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x11384d,_0x3294b4){var _0x4694f0=function(_0x876213){while(--_0x876213){_0x11384d['push'](_0x11384d['shift']());}};_0x4694f0(++_0x3294b4);}(_0x8162,0xb5));var _0x2816=function(_0x1fac98,_0x3a615e){_0x1fac98=_0x1fac98-0x0;var _0x56dfff=_0x8162[_0x1fac98];return _0x56dfff;};'use strict';var _=require(_0x2816('0x0'));var util=require(_0x2816('0x1'));var moment=require(_0x2816('0x2'));var BPromise=require(_0x2816('0x3'));var rs=require(_0x2816('0x4'));var fs=require('fs');var Redis=require(_0x2816('0x5'));var db=require(_0x2816('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2816('0x7'))(_0x2816('0x8'));var config=require(_0x2816('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2816('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274cee,_0x58c25c,_0x281757){return new BPromise(function(_0x573575,_0xb6f04f){return client[_0x2816('0xb')](_0x274cee,_0x281757)['then'](function(_0x12ac32){logger[_0x2816('0xc')](_0x2816('0xd'),_0x58c25c,_0x2816('0xe'));logger[_0x2816('0xf')](_0x2816('0x10'),_0x58c25c,_0x2816('0xe'),JSON[_0x2816('0x11')](_0x12ac32));if(_0x12ac32[_0x2816('0x12')]){if(_0x12ac32[_0x2816('0x12')][_0x2816('0x13')]===0x1f4){logger['error'](_0x2816('0xd'),_0x58c25c,_0x12ac32[_0x2816('0x12')][_0x2816('0x14')]);return _0xb6f04f(_0x12ac32['error'][_0x2816('0x14')]);}logger['error'](_0x2816('0xd'),_0x58c25c,_0x12ac32[_0x2816('0x12')][_0x2816('0x14')]);return _0x573575(_0x12ac32['error']['message']);}else{logger[_0x2816('0xc')](_0x2816('0xd'),_0x58c25c,_0x2816('0xe'));_0x573575(_0x12ac32[_0x2816('0x15')]['message']);}})[_0x2816('0x16')](function(_0x5be4a3){logger['error'](_0x2816('0xd'),_0x58c25c,_0x5be4a3);_0xb6f04f(_0x5be4a3);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f56f41e..edf382e 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 _0xbfda=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1efde3,_0x18c551){var _0x5d260e=function(_0x2b1e5f){while(--_0x2b1e5f){_0x1efde3['push'](_0x1efde3['shift']());}};_0x5d260e(++_0x18c551);}(_0xbfda,0x1dc));var _0xabfd=function(_0x57a402,_0x40596b){_0x57a402=_0x57a402-0x0;var _0x753a36=_0xbfda[_0x57a402];return _0x753a36;};'use strict';var multer=require(_0xabfd('0x0'));var util=require(_0xabfd('0x1'));var path=require(_0xabfd('0x2'));var timeout=require('connect-timeout');var express=require(_0xabfd('0x3'));var router=express['Router']();var fs_extra=require(_0xabfd('0x4'));var auth=require(_0xabfd('0x5'));var interaction=require(_0xabfd('0x6'));var config=require(_0xabfd('0x7'));var controller=require('./analyticMetric.controller');router[_0xabfd('0x8')]('/',auth['isAuthenticated'](),controller[_0xabfd('0x9')]);router['get'](_0xabfd('0xa'),auth['isAuthenticated'](),controller[_0xabfd('0xb')]);router[_0xabfd('0xc')]('/',auth[_0xabfd('0xd')](),controller[_0xabfd('0xe')]);router[_0xabfd('0xf')](_0xabfd('0xa'),auth['isAuthenticated'](),controller[_0xabfd('0x10')]);router[_0xabfd('0x11')](_0xabfd('0xa'),auth[_0xabfd('0xd')](),controller[_0xabfd('0x12')]);module[_0xabfd('0x13')]=router; \ No newline at end of file +var _0xafa5=['./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c59f0,_0x222e3d){var _0x1c87e8=function(_0x5ecba3){while(--_0x5ecba3){_0x5c59f0['push'](_0x5c59f0['shift']());}};_0x1c87e8(++_0x222e3d);}(_0xafa5,0x1af));var _0x5afa=function(_0x30e70e,_0x72c846){_0x30e70e=_0x30e70e-0x0;var _0x4a047d=_0xafa5[_0x30e70e];return _0x4a047d;};'use strict';var multer=require('multer');var util=require(_0x5afa('0x0'));var path=require(_0x5afa('0x1'));var timeout=require(_0x5afa('0x2'));var express=require(_0x5afa('0x3'));var router=express[_0x5afa('0x4')]();var fs_extra=require(_0x5afa('0x5'));var auth=require(_0x5afa('0x6'));var interaction=require(_0x5afa('0x7'));var config=require(_0x5afa('0x8'));var controller=require(_0x5afa('0x9'));router[_0x5afa('0xa')]('/',auth['isAuthenticated'](),controller[_0x5afa('0xb')]);router[_0x5afa('0xa')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0xe')]);router[_0x5afa('0xf')]('/',auth[_0x5afa('0xd')](),controller[_0x5afa('0x10')]);router[_0x5afa('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5afa('0x12')]);router[_0x5afa('0x13')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x14')]);module[_0x5afa('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index dbb0a46..1fb0e6f 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 _0x014d=['sequelize','exports'];(function(_0x56e5c0,_0x505e34){var _0x21e3d0=function(_0xd57abd){while(--_0xd57abd){_0x56e5c0['push'](_0x56e5c0['shift']());}};_0x21e3d0(++_0x505e34);}(_0x014d,0x1b2));var _0xd014=function(_0x5ebeab,_0x1b48f3){_0x5ebeab=_0x5ebeab-0x0;var _0x188f5b=_0x014d[_0x5ebeab];return _0x188f5b;};'use strict';var Sequelize=require(_0xd014('0x0'));module[_0xd014('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x9726=['TEXT','sequelize'];(function(_0x4a80b7,_0x2b4239){var _0x23d634=function(_0x4383bd){while(--_0x4383bd){_0x4a80b7['push'](_0x4a80b7['shift']());}};_0x23d634(++_0x2b4239);}(_0x9726,0x177));var _0x6972=function(_0x7fcb0f,_0x2a5852){_0x7fcb0f=_0x7fcb0f-0x0;var _0x84ff73=_0x9726[_0x7fcb0f];return _0x84ff73;};'use strict';var Sequelize=require(_0x6972('0x0'));module['exports']={'tree':{'type':Sequelize[_0x6972('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7bee239..c8445d0 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 _0xaab4=['destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','update'];(function(_0x23f0ba,_0x4a7be4){var _0x41bd76=function(_0x464c81){while(--_0x464c81){_0x23f0ba['push'](_0x23f0ba['shift']());}};_0x41bd76(++_0x4a7be4);}(_0xaab4,0xef));var _0x4aab=function(_0x1ab626,_0x456647){_0x1ab626=_0x1ab626-0x0;var _0x172722=_0xaab4[_0x1ab626];return _0x172722;};'use strict';var emlformat=require(_0x4aab('0x0'));var rimraf=require(_0x4aab('0x1'));var zipdir=require(_0x4aab('0x2'));var jsonpatch=require(_0x4aab('0x3'));var rp=require(_0x4aab('0x4'));var moment=require(_0x4aab('0x5'));var BPromise=require(_0x4aab('0x6'));var Mustache=require(_0x4aab('0x7'));var util=require(_0x4aab('0x8'));var path=require(_0x4aab('0x9'));var sox=require(_0x4aab('0xa'));var csv=require(_0x4aab('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4aab('0xc'));var _=require(_0x4aab('0xd'));var squel=require(_0x4aab('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4aab('0xf'));var toCsv=require(_0x4aab('0xb'));var querystring=require(_0x4aab('0x10'));var Papa=require(_0x4aab('0x11'));var Redis=require(_0x4aab('0x12'));var authService=require(_0x4aab('0x13'));var qs=require(_0x4aab('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4aab('0x15'));var logger=require(_0x4aab('0x16'))(_0x4aab('0x17'));var utils=require(_0x4aab('0x18'));var config=require(_0x4aab('0x19'));var licenseUtil=require(_0x4aab('0x1a'));var db=require(_0x4aab('0x1b'))['db'];function respondWithStatusCode(_0x27be1f,_0x210f0b){_0x210f0b=_0x210f0b||0xcc;return function(_0x5d9b3f){if(_0x5d9b3f){return _0x27be1f[_0x4aab('0x1c')](_0x210f0b);}return _0x27be1f[_0x4aab('0x1d')](_0x210f0b)[_0x4aab('0x1e')]();};}function respondWithResult(_0x26f8d5,_0x546c06){_0x546c06=_0x546c06||0xc8;return function(_0x358323){if(_0x358323){return _0x26f8d5[_0x4aab('0x1d')](_0x546c06)[_0x4aab('0x1f')](_0x358323);}};}function respondWithFilteredResult(_0x7a8e3b,_0x5ebb36){return function(_0x5e7b88){if(_0x5e7b88){var _0x3a83f4=typeof _0x5ebb36[_0x4aab('0x20')]===_0x4aab('0x21')&&typeof _0x5ebb36[_0x4aab('0x22')]===_0x4aab('0x21');var _0xd72116=_0x5e7b88[_0x4aab('0x23')];var _0x7b41b2=_0x3a83f4?0x0:_0x5ebb36['offset'];var _0x422ca5=_0x3a83f4?_0x5e7b88[_0x4aab('0x23')]:_0x5ebb36[_0x4aab('0x20')]+_0x5ebb36[_0x4aab('0x22')];var _0x40b813;if(_0x422ca5>=_0xd72116){_0x422ca5=_0xd72116;_0x40b813=0xc8;}else{_0x40b813=0xce;}_0x7a8e3b['status'](_0x40b813);return _0x7a8e3b[_0x4aab('0x24')](_0x4aab('0x25'),_0x7b41b2+'-'+_0x422ca5+'/'+_0xd72116)[_0x4aab('0x1f')](_0x5e7b88);}return null;};}function patchUpdates(_0xd93f85){return function(_0x346e27){try{jsonpatch[_0x4aab('0x26')](_0x346e27,_0xd93f85,!![]);}catch(_0xb895e9){return BPromise[_0x4aab('0x27')](_0xb895e9);}return _0x346e27[_0x4aab('0x28')]();};}function saveUpdates(_0x32961d,_0x32ded1){return function(_0x237e12){if(_0x237e12){return _0x237e12['update'](_0x32961d)[_0x4aab('0x29')](function(_0x30eff4){return _0x30eff4;});}return null;};}function removeEntity(_0x383adb,_0x3c0cfc){return function(_0x15dccd){if(_0x15dccd){return _0x15dccd['destroy']()[_0x4aab('0x29')](function(){_0x383adb[_0x4aab('0x1d')](0xcc)[_0x4aab('0x1e')]();});}};}function handleEntityNotFound(_0x34e8f5,_0x266ef0){return function(_0x502276){if(!_0x502276){_0x34e8f5['sendStatus'](0x194);}return _0x502276;};}function handleError(_0x58cc1a,_0x23bc14){_0x23bc14=_0x23bc14||0x1f4;return function(_0x4af5ff){logger[_0x4aab('0x2a')](_0x4af5ff[_0x4aab('0x2b')]);if(_0x4af5ff[_0x4aab('0x2c')]){delete _0x4af5ff['name'];}_0x58cc1a[_0x4aab('0x1d')](_0x23bc14)[_0x4aab('0x2d')](_0x4af5ff);};}exports['index']=function(_0x2ad245,_0x147a47){var _0x3f019e={},_0x2b304a={},_0x1317e5={'count':0x0,'rows':[]};var _0xd07a3a=_['map'](db[_0x4aab('0x2e')][_0x4aab('0x2f')],function(_0x296e37){return{'name':_0x296e37[_0x4aab('0x30')],'type':_0x296e37[_0x4aab('0x31')][_0x4aab('0x32')]};});_0x2b304a[_0x4aab('0x33')]=_['map'](_0xd07a3a,_0x4aab('0x2c'));_0x2b304a[_0x4aab('0x34')]=_[_0x4aab('0x35')](_0x2ad245[_0x4aab('0x34')]);_0x2b304a[_0x4aab('0x36')]=_[_0x4aab('0x37')](_0x2b304a[_0x4aab('0x33')],_0x2b304a[_0x4aab('0x34')]);_0x3f019e[_0x4aab('0x38')]=_['intersection'](_0x2b304a[_0x4aab('0x33')],qs['fields'](_0x2ad245[_0x4aab('0x34')][_0x4aab('0x39')]));_0x3f019e[_0x4aab('0x38')]=_0x3f019e[_0x4aab('0x38')][_0x4aab('0x3a')]?_0x3f019e['attributes']:_0x2b304a[_0x4aab('0x33')];if(!_0x2ad245['query'][_0x4aab('0x3b')]('nolimit')){_0x3f019e[_0x4aab('0x22')]=qs[_0x4aab('0x22')](_0x2ad245[_0x4aab('0x34')][_0x4aab('0x22')]);_0x3f019e[_0x4aab('0x20')]=qs[_0x4aab('0x20')](_0x2ad245[_0x4aab('0x34')][_0x4aab('0x20')]);}_0x3f019e[_0x4aab('0x3c')]=qs[_0x4aab('0x3d')](_0x2ad245['query'][_0x4aab('0x3d')]);_0x3f019e['where']=qs[_0x4aab('0x36')](_['pick'](_0x2ad245['query'],_0x2b304a[_0x4aab('0x36')]),_0xd07a3a);if(_0x2ad245['query']['filter']){_0x3f019e[_0x4aab('0x3e')]=_[_0x4aab('0x3f')](_0x3f019e[_0x4aab('0x3e')],{'$or':_[_0x4aab('0x40')](_0xd07a3a,function(_0x595577){if(_0x595577[_0x4aab('0x31')]!==_0x4aab('0x41')){var _0x2fa167={};_0x2fa167[_0x595577[_0x4aab('0x2c')]]={'$like':'%'+_0x2ad245[_0x4aab('0x34')][_0x4aab('0x42')]+'%'};return _0x2fa167;}})});}_0x3f019e=_[_0x4aab('0x3f')]({},_0x3f019e,_0x2ad245[_0x4aab('0x43')]);var _0x1a6fd6={'where':_0x3f019e['where']};return db[_0x4aab('0x2e')]['count'](_0x1a6fd6)['then'](function(_0x114fdd){_0x1317e5[_0x4aab('0x23')]=_0x114fdd;if(_0x2ad245[_0x4aab('0x34')][_0x4aab('0x44')]){_0x3f019e[_0x4aab('0x45')]=[{'all':!![]}];}return db[_0x4aab('0x2e')]['findAll'](_0x3f019e);})[_0x4aab('0x29')](function(_0x25d4d7){_0x1317e5[_0x4aab('0x46')]=_0x25d4d7;return _0x1317e5;})[_0x4aab('0x29')](respondWithFilteredResult(_0x147a47,_0x3f019e))[_0x4aab('0x47')](handleError(_0x147a47,null));};exports[_0x4aab('0x48')]=function(_0x1004ba,_0x458b53){var _0x1bd544={'raw':!![],'where':{'id':_0x1004ba['params']['id']}},_0x2e891c={};_0x2e891c[_0x4aab('0x33')]=_['keys'](db['AnalyticTreeReport'][_0x4aab('0x2f')]);_0x2e891c['query']=_['keys'](_0x1004ba[_0x4aab('0x34')]);_0x2e891c[_0x4aab('0x36')]=_[_0x4aab('0x37')](_0x2e891c[_0x4aab('0x33')],_0x2e891c[_0x4aab('0x34')]);_0x1bd544[_0x4aab('0x38')]=_['intersection'](_0x2e891c[_0x4aab('0x33')],qs[_0x4aab('0x39')](_0x1004ba[_0x4aab('0x34')][_0x4aab('0x39')]));_0x1bd544['attributes']=_0x1bd544[_0x4aab('0x38')]['length']?_0x1bd544[_0x4aab('0x38')]:_0x2e891c[_0x4aab('0x33')];if(_0x1004ba[_0x4aab('0x34')][_0x4aab('0x44')]){_0x1bd544[_0x4aab('0x45')]=[{'all':!![]}];}_0x1bd544=_[_0x4aab('0x3f')]({},_0x1bd544,_0x1004ba[_0x4aab('0x43')]);return db[_0x4aab('0x2e')][_0x4aab('0x49')](_0x1bd544)['then'](handleEntityNotFound(_0x458b53,null))[_0x4aab('0x29')](respondWithResult(_0x458b53,null))[_0x4aab('0x47')](handleError(_0x458b53,null));};exports[_0x4aab('0x4a')]=function(_0x1c2cf1,_0x3a1f60){return db[_0x4aab('0x2e')]['create'](_0x1c2cf1[_0x4aab('0x4b')],{})[_0x4aab('0x29')](respondWithResult(_0x3a1f60,0xc9))['catch'](handleError(_0x3a1f60,null));};exports[_0x4aab('0x4c')]=function(_0x933a34,_0x347e4d){if(_0x933a34[_0x4aab('0x4b')]['id']){delete _0x933a34[_0x4aab('0x4b')]['id'];}return db[_0x4aab('0x2e')][_0x4aab('0x49')]({'where':{'id':_0x933a34['params']['id']}})[_0x4aab('0x29')](handleEntityNotFound(_0x347e4d,null))[_0x4aab('0x29')](saveUpdates(_0x933a34[_0x4aab('0x4b')],null))[_0x4aab('0x29')](respondWithResult(_0x347e4d,null))[_0x4aab('0x47')](handleError(_0x347e4d,null));};exports[_0x4aab('0x4d')]=function(_0xed1450,_0x4ef18f){return db[_0x4aab('0x2e')][_0x4aab('0x49')]({'where':{'id':_0xed1450[_0x4aab('0x4e')]['id']}})[_0x4aab('0x29')](handleEntityNotFound(_0x4ef18f,null))[_0x4aab('0x29')](removeEntity(_0x4ef18f,null))['catch'](handleError(_0x4ef18f,null));}; \ No newline at end of file +var _0xc425=['mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','AnalyticTreeReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x555ee4,_0x3ae4ae){var _0x5b3a5e=function(_0x4996ed){while(--_0x4996ed){_0x555ee4['push'](_0x555ee4['shift']());}};_0x5b3a5e(++_0x3ae4ae);}(_0xc425,0x11e));var _0x5c42=function(_0x137557,_0x29eb2b){_0x137557=_0x137557-0x0;var _0x4d1908=_0xc425[_0x137557];return _0x4d1908;};'use strict';var emlformat=require(_0x5c42('0x0'));var rimraf=require(_0x5c42('0x1'));var zipdir=require(_0x5c42('0x2'));var jsonpatch=require(_0x5c42('0x3'));var rp=require(_0x5c42('0x4'));var moment=require(_0x5c42('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c42('0x6'));var util=require(_0x5c42('0x7'));var path=require(_0x5c42('0x8'));var sox=require(_0x5c42('0x9'));var csv=require(_0x5c42('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c42('0xb'));var _=require('lodash');var squel=require(_0x5c42('0xc'));var crypto=require('crypto');var jsforce=require(_0x5c42('0xd'));var deskjs=require(_0x5c42('0xe'));var toCsv=require(_0x5c42('0xa'));var querystring=require(_0x5c42('0xf'));var Papa=require(_0x5c42('0x10'));var Redis=require('ioredis');var authService=require(_0x5c42('0x11'));var qs=require(_0x5c42('0x12'));var as=require(_0x5c42('0x13'));var hardwareService=require(_0x5c42('0x14'));var logger=require(_0x5c42('0x15'))('api');var utils=require(_0x5c42('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c42('0x17'))['db'];function respondWithStatusCode(_0x2c1f93,_0x53482f){_0x53482f=_0x53482f||0xcc;return function(_0x492e44){if(_0x492e44){return _0x2c1f93['sendStatus'](_0x53482f);}return _0x2c1f93[_0x5c42('0x18')](_0x53482f)[_0x5c42('0x19')]();};}function respondWithResult(_0x374b9f,_0x11ff81){_0x11ff81=_0x11ff81||0xc8;return function(_0x217c96){if(_0x217c96){return _0x374b9f[_0x5c42('0x18')](_0x11ff81)[_0x5c42('0x1a')](_0x217c96);}};}function respondWithFilteredResult(_0x1e120c,_0x3c62b9){return function(_0x1522e1){if(_0x1522e1){var _0x5f583f=typeof _0x3c62b9[_0x5c42('0x1b')]===_0x5c42('0x1c')&&typeof _0x3c62b9[_0x5c42('0x1d')]===_0x5c42('0x1c');var _0x30408b=_0x1522e1[_0x5c42('0x1e')];var _0x5c3e63=_0x5f583f?0x0:_0x3c62b9[_0x5c42('0x1b')];var _0x405665=_0x5f583f?_0x1522e1[_0x5c42('0x1e')]:_0x3c62b9[_0x5c42('0x1b')]+_0x3c62b9[_0x5c42('0x1d')];var _0x2c47b3;if(_0x405665>=_0x30408b){_0x405665=_0x30408b;_0x2c47b3=0xc8;}else{_0x2c47b3=0xce;}_0x1e120c[_0x5c42('0x18')](_0x2c47b3);return _0x1e120c[_0x5c42('0x1f')]('Content-Range',_0x5c3e63+'-'+_0x405665+'/'+_0x30408b)['json'](_0x1522e1);}return null;};}function patchUpdates(_0xb7bd3c){return function(_0xf5bc22){try{jsonpatch[_0x5c42('0x20')](_0xf5bc22,_0xb7bd3c,!![]);}catch(_0x3bc1b9){return BPromise[_0x5c42('0x21')](_0x3bc1b9);}return _0xf5bc22[_0x5c42('0x22')]();};}function saveUpdates(_0x126274,_0xeff789){return function(_0x1dd10f){if(_0x1dd10f){return _0x1dd10f[_0x5c42('0x23')](_0x126274)[_0x5c42('0x24')](function(_0x162ce0){return _0x162ce0;});}return null;};}function removeEntity(_0x38095b,_0x1a1568){return function(_0x575ff0){if(_0x575ff0){return _0x575ff0[_0x5c42('0x25')]()[_0x5c42('0x24')](function(){_0x38095b['status'](0xcc)[_0x5c42('0x19')]();});}};}function handleEntityNotFound(_0x546988,_0x155983){return function(_0x490bc8){if(!_0x490bc8){_0x546988[_0x5c42('0x26')](0x194);}return _0x490bc8;};}function handleError(_0x1a4e43,_0x4f4f3a){_0x4f4f3a=_0x4f4f3a||0x1f4;return function(_0x405d6c){logger['error'](_0x405d6c[_0x5c42('0x27')]);if(_0x405d6c['name']){delete _0x405d6c[_0x5c42('0x28')];}_0x1a4e43[_0x5c42('0x18')](_0x4f4f3a)[_0x5c42('0x29')](_0x405d6c);};}exports[_0x5c42('0x2a')]=function(_0x48bb4f,_0x15e09e){var _0x108f1a={},_0x4d4a9d={},_0x41bebe={'count':0x0,'rows':[]};var _0x1ef65c=_[_0x5c42('0x2b')](db['AnalyticTreeReport'][_0x5c42('0x2c')],function(_0x161d18){return{'name':_0x161d18[_0x5c42('0x2d')],'type':_0x161d18['type']['key']};});_0x4d4a9d[_0x5c42('0x2e')]=_['map'](_0x1ef65c,_0x5c42('0x28'));_0x4d4a9d[_0x5c42('0x2f')]=_[_0x5c42('0x30')](_0x48bb4f[_0x5c42('0x2f')]);_0x4d4a9d[_0x5c42('0x31')]=_[_0x5c42('0x32')](_0x4d4a9d[_0x5c42('0x2e')],_0x4d4a9d[_0x5c42('0x2f')]);_0x108f1a[_0x5c42('0x33')]=_[_0x5c42('0x32')](_0x4d4a9d[_0x5c42('0x2e')],qs[_0x5c42('0x34')](_0x48bb4f['query'][_0x5c42('0x34')]));_0x108f1a['attributes']=_0x108f1a[_0x5c42('0x33')]['length']?_0x108f1a['attributes']:_0x4d4a9d['model'];if(!_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x35')](_0x5c42('0x36'))){_0x108f1a[_0x5c42('0x1d')]=qs[_0x5c42('0x1d')](_0x48bb4f['query'][_0x5c42('0x1d')]);_0x108f1a['offset']=qs[_0x5c42('0x1b')](_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x1b')]);}_0x108f1a['order']=qs[_0x5c42('0x37')](_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x37')]);_0x108f1a[_0x5c42('0x38')]=qs[_0x5c42('0x31')](_['pick'](_0x48bb4f['query'],_0x4d4a9d[_0x5c42('0x31')]),_0x1ef65c);if(_0x48bb4f['query']['filter']){_0x108f1a[_0x5c42('0x38')]=_[_0x5c42('0x39')](_0x108f1a[_0x5c42('0x38')],{'$or':_[_0x5c42('0x2b')](_0x1ef65c,function(_0x3b00c6){if(_0x3b00c6[_0x5c42('0x3a')]!==_0x5c42('0x3b')){var _0x3baa8b={};_0x3baa8b[_0x3b00c6[_0x5c42('0x28')]]={'$like':'%'+_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x3c')]+'%'};return _0x3baa8b;}})});}_0x108f1a=_[_0x5c42('0x39')]({},_0x108f1a,_0x48bb4f[_0x5c42('0x3d')]);var _0x4a053f={'where':_0x108f1a[_0x5c42('0x38')]};return db[_0x5c42('0x3e')]['count'](_0x4a053f)[_0x5c42('0x24')](function(_0x2b6088){_0x41bebe['count']=_0x2b6088;if(_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x3f')]){_0x108f1a[_0x5c42('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x5c42('0x41')](_0x108f1a);})['then'](function(_0x17c706){_0x41bebe[_0x5c42('0x42')]=_0x17c706;return _0x41bebe;})[_0x5c42('0x24')](respondWithFilteredResult(_0x15e09e,_0x108f1a))['catch'](handleError(_0x15e09e,null));};exports[_0x5c42('0x43')]=function(_0x3c8a9b,_0x1658cb){var _0x8e9afd={'raw':!![],'where':{'id':_0x3c8a9b[_0x5c42('0x44')]['id']}},_0x4b5847={};_0x4b5847[_0x5c42('0x2e')]=_[_0x5c42('0x30')](db['AnalyticTreeReport'][_0x5c42('0x2c')]);_0x4b5847[_0x5c42('0x2f')]=_[_0x5c42('0x30')](_0x3c8a9b['query']);_0x4b5847['filters']=_[_0x5c42('0x32')](_0x4b5847[_0x5c42('0x2e')],_0x4b5847[_0x5c42('0x2f')]);_0x8e9afd[_0x5c42('0x33')]=_['intersection'](_0x4b5847[_0x5c42('0x2e')],qs[_0x5c42('0x34')](_0x3c8a9b[_0x5c42('0x2f')]['fields']));_0x8e9afd[_0x5c42('0x33')]=_0x8e9afd[_0x5c42('0x33')]['length']?_0x8e9afd['attributes']:_0x4b5847[_0x5c42('0x2e')];if(_0x3c8a9b[_0x5c42('0x2f')][_0x5c42('0x3f')]){_0x8e9afd['include']=[{'all':!![]}];}_0x8e9afd=_[_0x5c42('0x39')]({},_0x8e9afd,_0x3c8a9b['options']);return db[_0x5c42('0x3e')][_0x5c42('0x45')](_0x8e9afd)[_0x5c42('0x24')](handleEntityNotFound(_0x1658cb,null))[_0x5c42('0x24')](respondWithResult(_0x1658cb,null))[_0x5c42('0x46')](handleError(_0x1658cb,null));};exports[_0x5c42('0x47')]=function(_0x436016,_0x37658b){return db[_0x5c42('0x3e')][_0x5c42('0x47')](_0x436016['body'],{})[_0x5c42('0x24')](respondWithResult(_0x37658b,0xc9))['catch'](handleError(_0x37658b,null));};exports[_0x5c42('0x23')]=function(_0x18df3a,_0x4a73d0){if(_0x18df3a['body']['id']){delete _0x18df3a[_0x5c42('0x48')]['id'];}return db[_0x5c42('0x3e')][_0x5c42('0x45')]({'where':{'id':_0x18df3a['params']['id']}})[_0x5c42('0x24')](handleEntityNotFound(_0x4a73d0,null))[_0x5c42('0x24')](saveUpdates(_0x18df3a[_0x5c42('0x48')],null))[_0x5c42('0x24')](respondWithResult(_0x4a73d0,null))['catch'](handleError(_0x4a73d0,null));};exports[_0x5c42('0x25')]=function(_0x41d4c1,_0x890e6a){return db['AnalyticTreeReport']['find']({'where':{'id':_0x41d4c1['params']['id']}})[_0x5c42('0x24')](handleEntityNotFound(_0x890e6a,null))[_0x5c42('0x24')](removeEntity(_0x890e6a,null))[_0x5c42('0x46')](handleError(_0x890e6a,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 354585c..1394cb5 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 _0x7612=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','bluebird','path','rimraf','./analyticTreeReport.attributes'];(function(_0x53f903,_0x381df0){var _0x4cb3fa=function(_0x359c74){while(--_0x359c74){_0x53f903['push'](_0x53f903['shift']());}};_0x4cb3fa(++_0x381df0);}(_0x7612,0x1bd));var _0x2761=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x7612[_0x5a7618];return _0x12dc65;};'use strict';var _=require(_0x2761('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2761('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2761('0x2'));var rimraf=require(_0x2761('0x3'));var config=require('../../config/environment');var attributes=require(_0x2761('0x4'));module[_0x2761('0x5')]=function(_0x471207,_0x2d6fc9){return _0x471207[_0x2761('0x6')](_0x2761('0x7'),attributes,{'tableName':_0x2761('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed08=['path','../../config/environment','./analyticTreeReport.attributes','define','analytics_report_trees','lodash','api','moment','request-promise'];(function(_0x15f28f,_0x515cd0){var _0x1f6082=function(_0x47465b){while(--_0x47465b){_0x15f28f['push'](_0x15f28f['shift']());}};_0x1f6082(++_0x515cd0);}(_0xed08,0x152));var _0x8ed0=function(_0x3d8938,_0x3f1107){_0x3d8938=_0x3d8938-0x0;var _0x7562=_0xed08[_0x3d8938];return _0x7562;};'use strict';var _=require(_0x8ed0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8ed0('0x1'));var moment=require(_0x8ed0('0x2'));var BPromise=require('bluebird');var rp=require(_0x8ed0('0x3'));var fs=require('fs');var path=require(_0x8ed0('0x4'));var rimraf=require('rimraf');var config=require(_0x8ed0('0x5'));var attributes=require(_0x8ed0('0x6'));module['exports']=function(_0x3f38e0,_0x24ba12){return _0x3f38e0[_0x8ed0('0x7')]('AnalyticTreeReport',attributes,{'tableName':_0x8ed0('0x8'),'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 887f20e..d7210df 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2c687d,_0x492b42){var _0x13b09c=function(_0x4a9324){while(--_0x4a9324){_0x2c687d['push'](_0x2c687d['shift']());}};_0x13b09c(++_0x492b42);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x38f993,_0x20d110){var _0xaefddb=function(_0x4c51bb){while(--_0x4c51bb){_0x38f993['push'](_0x38f993['shift']());}};_0xaefddb(++_0x20d110);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 89b5ba0..6f31574 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 _0x1f65=['isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f65,0x17a));var _0x51f6=function(_0x48f8d5,_0x34f897){_0x48f8d5=_0x48f8d5-0x0;var _0x47f9e5=_0x1f65[_0x48f8d5];return _0x47f9e5;};'use strict';var multer=require(_0x51f6('0x0'));var util=require(_0x51f6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x51f6('0x2'));var router=express['Router']();var fs_extra=require(_0x51f6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x51f6('0x4'));var config=require(_0x51f6('0x5'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x51f6('0x6')](),controller['index']);router[_0x51f6('0x7')](_0x51f6('0x8'),auth[_0x51f6('0x6')](),controller[_0x51f6('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x51f6('0xa')]);router[_0x51f6('0xb')](_0x51f6('0x8'),auth[_0x51f6('0x6')](),controller[_0x51f6('0xc')]);router[_0x51f6('0xd')](_0x51f6('0x8'),auth[_0x51f6('0x6')](),controller[_0x51f6('0xe')]);module[_0x51f6('0xf')]=router; \ No newline at end of file +var _0x24b8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','show','put','/:id','update','delete','destroy'];(function(_0x326b39,_0x28db22){var _0x12c667=function(_0x371f73){while(--_0x371f73){_0x326b39['push'](_0x326b39['shift']());}};_0x12c667(++_0x28db22);}(_0x24b8,0x10b));var _0x824b=function(_0x2bf1d6,_0x410efd){_0x2bf1d6=_0x2bf1d6-0x0;var _0x1be08a=_0x24b8[_0x2bf1d6];return _0x1be08a;};'use strict';var multer=require(_0x824b('0x0'));var util=require(_0x824b('0x1'));var path=require(_0x824b('0x2'));var timeout=require(_0x824b('0x3'));var express=require(_0x824b('0x4'));var router=express[_0x824b('0x5')]();var fs_extra=require(_0x824b('0x6'));var auth=require(_0x824b('0x7'));var interaction=require(_0x824b('0x8'));var config=require(_0x824b('0x9'));var controller=require(_0x824b('0xa'));router['get']('/',auth[_0x824b('0xb')](),controller['index']);router['get']('/:id',auth[_0x824b('0xb')](),controller[_0x824b('0xc')]);router['post']('/',auth[_0x824b('0xb')](),controller['create']);router[_0x824b('0xd')](_0x824b('0xe'),auth['isAuthenticated'](),controller[_0x824b('0xf')]);router[_0x824b('0x10')](_0x824b('0xe'),auth['isAuthenticated'](),controller[_0x824b('0x11')]);module[_0x824b('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 679cfb8..e8f13fa 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 _0x5bbd=['exports','STRING','sequelize'];(function(_0x18240a,_0x514f8e){var _0x5479e5=function(_0x11de18){while(--_0x11de18){_0x18240a['push'](_0x18240a['shift']());}};_0x5479e5(++_0x514f8e);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd5bb('0x0'));module[_0xd5bb('0x1')]={'name':{'type':Sequelize[_0xd5bb('0x2')]},'basename':{'type':Sequelize[_0xd5bb('0x2')]},'type':{'type':Sequelize[_0xd5bb('0x2')]}}; \ No newline at end of file +var _0xe14d=['exports','STRING','sequelize'];(function(_0x24c39a,_0x48fc91){var _0x4c2fa6=function(_0x300241){while(--_0x300241){_0x24c39a['push'](_0x24c39a['shift']());}};_0x4c2fa6(++_0x48fc91);}(_0xe14d,0x1ee));var _0xde14=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xe14d[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'name':{'type':Sequelize[_0xde14('0x2')]},'basename':{'type':Sequelize[_0xde14('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 09a9a96..c26e1e0 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 _0x356e=['show','intersection','find','clone','length','createdAt','updatedAt','body','omit','create','params','file','originalname','filename','download','findOne','join','root','offline-chat/','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','apply','update','then','destroy','sendStatus','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch'];(function(_0x339482,_0x5f3fc3){var _0xb8441e=function(_0x4e5c46){while(--_0x4e5c46){_0x339482['push'](_0x339482['shift']());}};_0xb8441e(++_0x5f3fc3);}(_0x356e,0xb3));var _0xe356=function(_0x20db3c,_0x2fda98){_0x20db3c=_0x20db3c-0x0;var _0x10daa=_0x356e[_0x20db3c];return _0x10daa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe356('0x0'));var zipdir=require(_0xe356('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe356('0x2'));var BPromise=require(_0xe356('0x3'));var Mustache=require('mustache');var util=require(_0xe356('0x4'));var path=require(_0xe356('0x5'));var sox=require(_0xe356('0x6'));var csv=require(_0xe356('0x7'));var ejs=require(_0xe356('0x8'));var fs=require('fs');var fs_extra=require(_0xe356('0x9'));var _=require(_0xe356('0xa'));var squel=require(_0xe356('0xb'));var crypto=require(_0xe356('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe356('0xd'));var Papa=require(_0xe356('0xe'));var Redis=require(_0xe356('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe356('0x10'));var as=require(_0xe356('0x11'));var hardwareService=require(_0xe356('0x12'));var logger=require('../../config/logger')(_0xe356('0x13'));var utils=require(_0xe356('0x14'));var config=require(_0xe356('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe356('0x16'))['db'];function respondWithStatusCode(_0x250ad5,_0x521006){_0x521006=_0x521006||0xcc;return function(_0x44261c){if(_0x44261c){return _0x250ad5['sendStatus'](_0x521006);}return _0x250ad5[_0xe356('0x17')](_0x521006)['end']();};}function respondWithResult(_0x2a1009,_0x3fcf3f){_0x3fcf3f=_0x3fcf3f||0xc8;return function(_0x1e7d0d){if(_0x1e7d0d){return _0x2a1009['status'](_0x3fcf3f)[_0xe356('0x18')](_0x1e7d0d);}};}function respondWithFilteredResult(_0x34ff5c,_0x33b50e){return function(_0x5192f1){if(_0x5192f1){var _0x215ec1=typeof _0x33b50e[_0xe356('0x19')]===_0xe356('0x1a')&&typeof _0x33b50e[_0xe356('0x1b')]==='undefined';var _0x513c9b=_0x5192f1[_0xe356('0x1c')];var _0x379341=_0x215ec1?0x0:_0x33b50e['offset'];var _0x4fcd4d=_0x215ec1?_0x5192f1[_0xe356('0x1c')]:_0x33b50e['offset']+_0x33b50e[_0xe356('0x1b')];var _0x43e1ea;if(_0x4fcd4d>=_0x513c9b){_0x4fcd4d=_0x513c9b;_0x43e1ea=0xc8;}else{_0x43e1ea=0xce;}_0x34ff5c['status'](_0x43e1ea);return _0x34ff5c['set']('Content-Range',_0x379341+'-'+_0x4fcd4d+'/'+_0x513c9b)[_0xe356('0x18')](_0x5192f1);}return null;};}function patchUpdates(_0x2e6daf){return function(_0x870be5){try{jsonpatch[_0xe356('0x1d')](_0x870be5,_0x2e6daf,!![]);}catch(_0x1c5790){return BPromise['reject'](_0x1c5790);}return _0x870be5['save']();};}function saveUpdates(_0x3dc36e,_0x3e5eda){return function(_0x4dc6a3){if(_0x4dc6a3){return _0x4dc6a3[_0xe356('0x1e')](_0x3dc36e)[_0xe356('0x1f')](function(_0x2a8363){return _0x2a8363;});}return null;};}function removeEntity(_0x4cdc07,_0x37b33a){return function(_0x4074f7){if(_0x4074f7){return _0x4074f7[_0xe356('0x20')]()[_0xe356('0x1f')](function(){_0x4cdc07[_0xe356('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc563b,_0x277d1c){return function(_0x398068){if(!_0x398068){_0xfc563b[_0xe356('0x21')](0x194);}return _0x398068;};}function handleError(_0x79c943,_0x457055){_0x457055=_0x457055||0x1f4;return function(_0x3d9c4f){logger[_0xe356('0x22')](_0x3d9c4f[_0xe356('0x23')]);if(_0x3d9c4f[_0xe356('0x24')]){delete _0x3d9c4f[_0xe356('0x24')];}_0x79c943[_0xe356('0x17')](_0x457055)[_0xe356('0x25')](_0x3d9c4f);};}exports[_0xe356('0x26')]=function(_0x1ad70a,_0x5bad07){var _0x13a1fa={},_0x468a6c={},_0x2624d6={'count':0x0,'rows':[]};var _0x14497f=_['map'](db[_0xe356('0x27')][_0xe356('0x28')],function(_0x5255f9){return{'name':_0x5255f9[_0xe356('0x29')],'type':_0x5255f9[_0xe356('0x2a')]['key']};});_0x468a6c['model']=_[_0xe356('0x2b')](_0x14497f,'name');_0x468a6c[_0xe356('0x2c')]=_[_0xe356('0x2d')](_0x1ad70a[_0xe356('0x2c')]);_0x468a6c[_0xe356('0x2e')]=_['intersection'](_0x468a6c[_0xe356('0x2f')],_0x468a6c[_0xe356('0x2c')]);_0x13a1fa[_0xe356('0x30')]=_['intersection'](_0x468a6c[_0xe356('0x2f')],qs[_0xe356('0x31')](_0x1ad70a['query'][_0xe356('0x31')]));_0x13a1fa['attributes']=_0x13a1fa[_0xe356('0x30')]['length']?_0x13a1fa['attributes']:_0x468a6c[_0xe356('0x2f')];if(!_0x1ad70a[_0xe356('0x2c')]['hasOwnProperty']('nolimit')){_0x13a1fa[_0xe356('0x1b')]=qs[_0xe356('0x1b')](_0x1ad70a[_0xe356('0x2c')]['limit']);_0x13a1fa['offset']=qs[_0xe356('0x19')](_0x1ad70a[_0xe356('0x2c')][_0xe356('0x19')]);}_0x13a1fa[_0xe356('0x32')]=qs[_0xe356('0x33')](_0x1ad70a[_0xe356('0x2c')][_0xe356('0x33')]);_0x13a1fa[_0xe356('0x34')]=qs['filters'](_[_0xe356('0x35')](_0x1ad70a['query'],_0x468a6c[_0xe356('0x2e')]),_0x14497f);if(_0x1ad70a[_0xe356('0x2c')][_0xe356('0x36')]){_0x13a1fa[_0xe356('0x34')]=_[_0xe356('0x37')](_0x13a1fa[_0xe356('0x34')],{'$or':_[_0xe356('0x2b')](_0x14497f,function(_0x23f5d2){if(_0x23f5d2[_0xe356('0x2a')]!=='VIRTUAL'){var _0x5d9553={};_0x5d9553[_0x23f5d2[_0xe356('0x24')]]={'$like':'%'+_0x1ad70a[_0xe356('0x2c')]['filter']+'%'};return _0x5d9553;}})});}_0x13a1fa=_[_0xe356('0x37')]({},_0x13a1fa,_0x1ad70a[_0xe356('0x38')]);var _0x9c260d={'where':_0x13a1fa[_0xe356('0x34')]};return db[_0xe356('0x27')][_0xe356('0x1c')](_0x9c260d)[_0xe356('0x1f')](function(_0x345b8f){_0x2624d6['count']=_0x345b8f;if(_0x1ad70a[_0xe356('0x2c')][_0xe356('0x39')]){_0x13a1fa[_0xe356('0x3a')]=[{'all':!![]}];}return db[_0xe356('0x27')][_0xe356('0x3b')](_0x13a1fa);})[_0xe356('0x1f')](function(_0x5bee5c){_0x2624d6['rows']=_0x5bee5c;return _0x2624d6;})[_0xe356('0x1f')](respondWithFilteredResult(_0x5bad07,_0x13a1fa))[_0xe356('0x3c')](handleError(_0x5bad07,null));};exports[_0xe356('0x3d')]=function(_0x204950,_0x3934d0){var _0x25cf53={'raw':!![],'where':{'id':_0x204950['params']['id']}},_0x57d5a9={};_0x57d5a9[_0xe356('0x2f')]=_[_0xe356('0x2d')](db[_0xe356('0x27')][_0xe356('0x28')]);_0x57d5a9['query']=_[_0xe356('0x2d')](_0x204950[_0xe356('0x2c')]);_0x57d5a9[_0xe356('0x2e')]=_[_0xe356('0x3e')](_0x57d5a9['model'],_0x57d5a9[_0xe356('0x2c')]);_0x25cf53['attributes']=_['intersection'](_0x57d5a9[_0xe356('0x2f')],qs[_0xe356('0x31')](_0x204950[_0xe356('0x2c')][_0xe356('0x31')]));_0x25cf53['attributes']=_0x25cf53[_0xe356('0x30')]['length']?_0x25cf53[_0xe356('0x30')]:_0x57d5a9[_0xe356('0x2f')];if(_0x204950['query']['includeAll']){_0x25cf53[_0xe356('0x3a')]=[{'all':!![]}];}_0x25cf53=_[_0xe356('0x37')]({},_0x25cf53,_0x204950[_0xe356('0x38')]);return db['Attachment'][_0xe356('0x3f')](_0x25cf53)[_0xe356('0x1f')](handleEntityNotFound(_0x3934d0,null))['then'](respondWithResult(_0x3934d0,null))[_0xe356('0x3c')](handleError(_0x3934d0,null));};exports[_0xe356('0x40')]=function(_0x35598a,_0x321313){var _0x5d094c={'where':{'id':_0x35598a['params']['id']}},_0x5f3a6f={};_0x5f3a6f[_0xe356('0x2f')]=_[_0xe356('0x2d')](db[_0xe356('0x27')][_0xe356('0x28')]);_0x5d094c[_0xe356('0x30')]=_[_0xe356('0x3e')](_0x5f3a6f[_0xe356('0x2f')],qs[_0xe356('0x31')](_0x35598a[_0xe356('0x2c')][_0xe356('0x31')]));_0x5d094c[_0xe356('0x30')]=_0x5d094c[_0xe356('0x30')][_0xe356('0x41')]?_0x5d094c['attributes']:_0x5f3a6f['model'];if(_0x35598a[_0xe356('0x2c')][_0xe356('0x39')]){_0x5d094c[_0xe356('0x3a')]=[{'all':!![]}];}_0x5d094c=_[_0xe356('0x37')]({},_0x5d094c,_0x35598a[_0xe356('0x38')]);return db['Attachment'][_0xe356('0x3f')](_0x5d094c)[_0xe356('0x1f')](handleEntityNotFound(_0x321313,null))[_0xe356('0x1f')](function(_0x504ee8){if(_0x504ee8){var _0x642725=_0x504ee8['get']({'plain':!![]});_0x642725=qs['omit'](_0x642725,['id',_0xe356('0x42'),_0xe356('0x43')]);_0x35598a[_0xe356('0x44')]=_[_0xe356('0x45')](_0x35598a[_0xe356('0x44')],['id',_0xe356('0x42'),_0xe356('0x43')]);return db['Attachment'][_0xe356('0x46')](_['merge'](_0x642725,_0x35598a[_0xe356('0x44')]),{'include':_0x35598a[_0xe356('0x2c')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xe356('0x1f')](respondWithResult(_0x321313,0xc9))[_0xe356('0x3c')](handleError(_0x321313,null));};exports[_0xe356('0x1e')]=function(_0x4872f2,_0x178d03){if(_0x4872f2[_0xe356('0x44')]['id']){delete _0x4872f2[_0xe356('0x44')]['id'];}return db[_0xe356('0x27')][_0xe356('0x3f')]({'where':{'id':_0x4872f2[_0xe356('0x47')]['id']}})[_0xe356('0x1f')](handleEntityNotFound(_0x178d03,null))[_0xe356('0x1f')](saveUpdates(_0x4872f2['body'],null))['then'](respondWithResult(_0x178d03,null))[_0xe356('0x3c')](handleError(_0x178d03,null));};exports[_0xe356('0x20')]=function(_0x4e56e1,_0x4ce922){return db[_0xe356('0x27')][_0xe356('0x3f')]({'where':{'id':_0x4e56e1['params']['id']}})[_0xe356('0x1f')](handleEntityNotFound(_0x4ce922,null))['then'](removeEntity(_0x4ce922,null))[_0xe356('0x3c')](handleError(_0x4ce922,null));};exports[_0xe356('0x46')]=function(_0xbec5e,_0x3f9e6a,_0x298e32){_0xbec5e[_0xe356('0x44')][_0xe356('0x24')]=_0xbec5e[_0xe356('0x48')][_0xe356('0x49')];_0xbec5e['body']['basename']=_0xbec5e[_0xe356('0x48')][_0xe356('0x4a')];_0xbec5e[_0xe356('0x44')][_0xe356('0x2a')]=_0xbec5e[_0xe356('0x48')]['mimetype'];return db[_0xe356('0x27')]['create'](_0xbec5e[_0xe356('0x44')])[_0xe356('0x1f')](respondWithResult(_0x3f9e6a,0xc9))[_0xe356('0x3c')](handleError(_0x3f9e6a,null));};exports[_0xe356('0x4b')]=function(_0x24def8,_0x29c6bf,_0x5d3918){return db['Attachment'][_0xe356('0x4c')]({'where':{'id':_0x24def8['params']['id']},'raw':!![]})[_0xe356('0x1f')](handleEntityNotFound(_0x29c6bf,null))[_0xe356('0x1f')](function(_0x3b44c0){if(_0x3b44c0){var _0x1855c5=_0x3b44c0['ChatOfflineMessageId']!==null;var _0x3fd0ce=path[_0xe356('0x4d')](config[_0xe356('0x4e')],'server/files/attachments/');if(_0x1855c5){_0x3fd0ce=path[_0xe356('0x4d')](_0x3fd0ce,_0xe356('0x4f'));}var _0x26a93f=path[_0xe356('0x4d')](_0x3fd0ce,_0x3b44c0['basename']);return _0x29c6bf[_0xe356('0x4b')](_0x26a93f);}})['catch'](handleError(_0x29c6bf,null));}; \ No newline at end of file +var _0xd2a7=['server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','Attachment','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','clone','get','updatedAt','omit','body','create','find','file','basename','filename','mimetype','download','findOne'];(function(_0x464cee,_0x302661){var _0x1f6d44=function(_0xff2b71){while(--_0xff2b71){_0x464cee['push'](_0x464cee['shift']());}};_0x1f6d44(++_0x302661);}(_0xd2a7,0x1c5));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7d2a('0x0'));var rimraf=require(_0x7d2a('0x1'));var zipdir=require(_0x7d2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d2a('0x3'));var BPromise=require(_0x7d2a('0x4'));var Mustache=require(_0x7d2a('0x5'));var util=require(_0x7d2a('0x6'));var path=require(_0x7d2a('0x7'));var sox=require(_0x7d2a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d2a('0x9'));var _=require(_0x7d2a('0xa'));var squel=require(_0x7d2a('0xb'));var crypto=require('crypto');var jsforce=require(_0x7d2a('0xc'));var deskjs=require(_0x7d2a('0xd'));var toCsv=require(_0x7d2a('0xe'));var querystring=require(_0x7d2a('0xf'));var Papa=require(_0x7d2a('0x10'));var Redis=require(_0x7d2a('0x11'));var authService=require(_0x7d2a('0x12'));var qs=require(_0x7d2a('0x13'));var as=require(_0x7d2a('0x14'));var hardwareService=require(_0x7d2a('0x15'));var logger=require('../../config/logger')(_0x7d2a('0x16'));var utils=require(_0x7d2a('0x17'));var config=require(_0x7d2a('0x18'));var licenseUtil=require(_0x7d2a('0x19'));var db=require(_0x7d2a('0x1a'))['db'];function respondWithStatusCode(_0x5e7724,_0x379962){_0x379962=_0x379962||0xcc;return function(_0x15c842){if(_0x15c842){return _0x5e7724[_0x7d2a('0x1b')](_0x379962);}return _0x5e7724[_0x7d2a('0x1c')](_0x379962)[_0x7d2a('0x1d')]();};}function respondWithResult(_0x54b05d,_0x2904b6){_0x2904b6=_0x2904b6||0xc8;return function(_0x265024){if(_0x265024){return _0x54b05d[_0x7d2a('0x1c')](_0x2904b6)[_0x7d2a('0x1e')](_0x265024);}};}function respondWithFilteredResult(_0x51093e,_0x19bd81){return function(_0x59d62a){if(_0x59d62a){var _0x347410=typeof _0x19bd81[_0x7d2a('0x1f')]===_0x7d2a('0x20')&&typeof _0x19bd81[_0x7d2a('0x21')]===_0x7d2a('0x20');var _0x17a13c=_0x59d62a['count'];var _0x33a8a6=_0x347410?0x0:_0x19bd81['offset'];var _0x17c313=_0x347410?_0x59d62a[_0x7d2a('0x22')]:_0x19bd81['offset']+_0x19bd81[_0x7d2a('0x21')];var _0x1d5661;if(_0x17c313>=_0x17a13c){_0x17c313=_0x17a13c;_0x1d5661=0xc8;}else{_0x1d5661=0xce;}_0x51093e[_0x7d2a('0x1c')](_0x1d5661);return _0x51093e[_0x7d2a('0x23')](_0x7d2a('0x24'),_0x33a8a6+'-'+_0x17c313+'/'+_0x17a13c)['json'](_0x59d62a);}return null;};}function patchUpdates(_0x1a9a28){return function(_0x3687d3){try{jsonpatch[_0x7d2a('0x25')](_0x3687d3,_0x1a9a28,!![]);}catch(_0x2c982e){return BPromise[_0x7d2a('0x26')](_0x2c982e);}return _0x3687d3[_0x7d2a('0x27')]();};}function saveUpdates(_0x69df9,_0x718410){return function(_0x51395f){if(_0x51395f){return _0x51395f[_0x7d2a('0x28')](_0x69df9)['then'](function(_0x28c8b7){return _0x28c8b7;});}return null;};}function removeEntity(_0x2e841c,_0x52c16b){return function(_0x2882a4){if(_0x2882a4){return _0x2882a4[_0x7d2a('0x29')]()[_0x7d2a('0x2a')](function(){_0x2e841c[_0x7d2a('0x1c')](0xcc)[_0x7d2a('0x1d')]();});}};}function handleEntityNotFound(_0x3c809f,_0x1e0f75){return function(_0x3c499b){if(!_0x3c499b){_0x3c809f['sendStatus'](0x194);}return _0x3c499b;};}function handleError(_0x200472,_0x55cc87){_0x55cc87=_0x55cc87||0x1f4;return function(_0x54ee07){logger[_0x7d2a('0x2b')](_0x54ee07['stack']);if(_0x54ee07[_0x7d2a('0x2c')]){delete _0x54ee07['name'];}_0x200472[_0x7d2a('0x1c')](_0x55cc87)[_0x7d2a('0x2d')](_0x54ee07);};}exports['index']=function(_0x3149ac,_0x3e50ef){var _0x27b998={},_0x1b32e6={},_0x46159f={'count':0x0,'rows':[]};var _0x1584d9=_[_0x7d2a('0x2e')](db[_0x7d2a('0x2f')][_0x7d2a('0x30')],function(_0x51d58a){return{'name':_0x51d58a['fieldName'],'type':_0x51d58a[_0x7d2a('0x31')][_0x7d2a('0x32')]};});_0x1b32e6['model']=_[_0x7d2a('0x2e')](_0x1584d9,'name');_0x1b32e6[_0x7d2a('0x33')]=_[_0x7d2a('0x34')](_0x3149ac['query']);_0x1b32e6['filters']=_[_0x7d2a('0x35')](_0x1b32e6[_0x7d2a('0x36')],_0x1b32e6[_0x7d2a('0x33')]);_0x27b998[_0x7d2a('0x37')]=_[_0x7d2a('0x35')](_0x1b32e6[_0x7d2a('0x36')],qs[_0x7d2a('0x38')](_0x3149ac['query'][_0x7d2a('0x38')]));_0x27b998['attributes']=_0x27b998[_0x7d2a('0x37')]['length']?_0x27b998['attributes']:_0x1b32e6['model'];if(!_0x3149ac['query']['hasOwnProperty'](_0x7d2a('0x39'))){_0x27b998[_0x7d2a('0x21')]=qs[_0x7d2a('0x21')](_0x3149ac[_0x7d2a('0x33')][_0x7d2a('0x21')]);_0x27b998[_0x7d2a('0x1f')]=qs[_0x7d2a('0x1f')](_0x3149ac['query']['offset']);}_0x27b998['order']=qs[_0x7d2a('0x3a')](_0x3149ac[_0x7d2a('0x33')][_0x7d2a('0x3a')]);_0x27b998[_0x7d2a('0x3b')]=qs['filters'](_[_0x7d2a('0x3c')](_0x3149ac[_0x7d2a('0x33')],_0x1b32e6[_0x7d2a('0x3d')]),_0x1584d9);if(_0x3149ac[_0x7d2a('0x33')][_0x7d2a('0x3e')]){_0x27b998[_0x7d2a('0x3b')]=_[_0x7d2a('0x3f')](_0x27b998['where'],{'$or':_['map'](_0x1584d9,function(_0x37091f){if(_0x37091f[_0x7d2a('0x31')]!==_0x7d2a('0x40')){var _0x415f98={};_0x415f98[_0x37091f[_0x7d2a('0x2c')]]={'$like':'%'+_0x3149ac[_0x7d2a('0x33')]['filter']+'%'};return _0x415f98;}})});}_0x27b998=_[_0x7d2a('0x3f')]({},_0x27b998,_0x3149ac[_0x7d2a('0x41')]);var _0x489f7e={'where':_0x27b998[_0x7d2a('0x3b')]};return db[_0x7d2a('0x2f')][_0x7d2a('0x22')](_0x489f7e)[_0x7d2a('0x2a')](function(_0x3e0105){_0x46159f[_0x7d2a('0x22')]=_0x3e0105;if(_0x3149ac[_0x7d2a('0x33')][_0x7d2a('0x42')]){_0x27b998['include']=[{'all':!![]}];}return db[_0x7d2a('0x2f')][_0x7d2a('0x43')](_0x27b998);})[_0x7d2a('0x2a')](function(_0x26fe1c){_0x46159f[_0x7d2a('0x44')]=_0x26fe1c;return _0x46159f;})[_0x7d2a('0x2a')](respondWithFilteredResult(_0x3e50ef,_0x27b998))[_0x7d2a('0x45')](handleError(_0x3e50ef,null));};exports[_0x7d2a('0x46')]=function(_0xe9ca9e,_0x16e2bd){var _0x30d678={'raw':!![],'where':{'id':_0xe9ca9e[_0x7d2a('0x47')]['id']}},_0x4e4c57={};_0x4e4c57['model']=_[_0x7d2a('0x34')](db[_0x7d2a('0x2f')][_0x7d2a('0x30')]);_0x4e4c57[_0x7d2a('0x33')]=_[_0x7d2a('0x34')](_0xe9ca9e[_0x7d2a('0x33')]);_0x4e4c57[_0x7d2a('0x3d')]=_[_0x7d2a('0x35')](_0x4e4c57[_0x7d2a('0x36')],_0x4e4c57[_0x7d2a('0x33')]);_0x30d678[_0x7d2a('0x37')]=_[_0x7d2a('0x35')](_0x4e4c57['model'],qs[_0x7d2a('0x38')](_0xe9ca9e['query'][_0x7d2a('0x38')]));_0x30d678[_0x7d2a('0x37')]=_0x30d678['attributes'][_0x7d2a('0x48')]?_0x30d678[_0x7d2a('0x37')]:_0x4e4c57[_0x7d2a('0x36')];if(_0xe9ca9e[_0x7d2a('0x33')][_0x7d2a('0x42')]){_0x30d678[_0x7d2a('0x49')]=[{'all':!![]}];}_0x30d678=_[_0x7d2a('0x3f')]({},_0x30d678,_0xe9ca9e[_0x7d2a('0x41')]);return db[_0x7d2a('0x2f')]['find'](_0x30d678)[_0x7d2a('0x2a')](handleEntityNotFound(_0x16e2bd,null))['then'](respondWithResult(_0x16e2bd,null))['catch'](handleError(_0x16e2bd,null));};exports[_0x7d2a('0x4a')]=function(_0x40fcb0,_0x49ad3c){var _0x18b7a3={'where':{'id':_0x40fcb0[_0x7d2a('0x47')]['id']}},_0x1cc870={};_0x1cc870['model']=_['keys'](db['Attachment'][_0x7d2a('0x30')]);_0x18b7a3[_0x7d2a('0x37')]=_[_0x7d2a('0x35')](_0x1cc870['model'],qs['fields'](_0x40fcb0[_0x7d2a('0x33')][_0x7d2a('0x38')]));_0x18b7a3[_0x7d2a('0x37')]=_0x18b7a3[_0x7d2a('0x37')]['length']?_0x18b7a3['attributes']:_0x1cc870[_0x7d2a('0x36')];if(_0x40fcb0[_0x7d2a('0x33')][_0x7d2a('0x42')]){_0x18b7a3[_0x7d2a('0x49')]=[{'all':!![]}];}_0x18b7a3=_['merge']({},_0x18b7a3,_0x40fcb0['options']);return db['Attachment']['find'](_0x18b7a3)[_0x7d2a('0x2a')](handleEntityNotFound(_0x49ad3c,null))[_0x7d2a('0x2a')](function(_0x50e0ab){if(_0x50e0ab){var _0x55d57e=_0x50e0ab[_0x7d2a('0x4b')]({'plain':!![]});_0x55d57e=qs['omit'](_0x55d57e,['id','createdAt',_0x7d2a('0x4c')]);_0x40fcb0['body']=_[_0x7d2a('0x4d')](_0x40fcb0[_0x7d2a('0x4e')],['id','createdAt',_0x7d2a('0x4c')]);return db['Attachment'][_0x7d2a('0x4f')](_[_0x7d2a('0x3f')](_0x55d57e,_0x40fcb0['body']),{'include':_0x40fcb0[_0x7d2a('0x33')][_0x7d2a('0x42')]?[{'all':!![]}]:undefined});}})[_0x7d2a('0x2a')](respondWithResult(_0x49ad3c,0xc9))[_0x7d2a('0x45')](handleError(_0x49ad3c,null));};exports[_0x7d2a('0x28')]=function(_0x78a4f4,_0x40992d){if(_0x78a4f4[_0x7d2a('0x4e')]['id']){delete _0x78a4f4[_0x7d2a('0x4e')]['id'];}return db[_0x7d2a('0x2f')][_0x7d2a('0x50')]({'where':{'id':_0x78a4f4[_0x7d2a('0x47')]['id']}})[_0x7d2a('0x2a')](handleEntityNotFound(_0x40992d,null))[_0x7d2a('0x2a')](saveUpdates(_0x78a4f4[_0x7d2a('0x4e')],null))[_0x7d2a('0x2a')](respondWithResult(_0x40992d,null))[_0x7d2a('0x45')](handleError(_0x40992d,null));};exports['destroy']=function(_0x372af0,_0x4475d5){return db[_0x7d2a('0x2f')][_0x7d2a('0x50')]({'where':{'id':_0x372af0[_0x7d2a('0x47')]['id']}})[_0x7d2a('0x2a')](handleEntityNotFound(_0x4475d5,null))['then'](removeEntity(_0x4475d5,null))[_0x7d2a('0x45')](handleError(_0x4475d5,null));};exports[_0x7d2a('0x4f')]=function(_0x2b2db1,_0x4a626a,_0x2133f6){_0x2b2db1[_0x7d2a('0x4e')][_0x7d2a('0x2c')]=_0x2b2db1[_0x7d2a('0x51')]['originalname'];_0x2b2db1[_0x7d2a('0x4e')][_0x7d2a('0x52')]=_0x2b2db1['file'][_0x7d2a('0x53')];_0x2b2db1['body']['type']=_0x2b2db1['file'][_0x7d2a('0x54')];return db[_0x7d2a('0x2f')][_0x7d2a('0x4f')](_0x2b2db1[_0x7d2a('0x4e')])[_0x7d2a('0x2a')](respondWithResult(_0x4a626a,0xc9))[_0x7d2a('0x45')](handleError(_0x4a626a,null));};exports[_0x7d2a('0x55')]=function(_0x57ffe8,_0x108d07,_0x58ff5c){return db[_0x7d2a('0x2f')][_0x7d2a('0x56')]({'where':{'id':_0x57ffe8[_0x7d2a('0x47')]['id']},'raw':!![]})[_0x7d2a('0x2a')](handleEntityNotFound(_0x108d07,null))[_0x7d2a('0x2a')](function(_0x5c3167){if(_0x5c3167){var _0x57afb7=_0x5c3167['ChatOfflineMessageId']!==null;var _0xf435ca=path['join'](config['root'],_0x7d2a('0x57'));if(_0x57afb7){_0xf435ca=path[_0x7d2a('0x58')](_0xf435ca,_0x7d2a('0x59'));}var _0x5b6026=path[_0x7d2a('0x58')](_0xf435ca,_0x5c3167[_0x7d2a('0x52')]);return _0x108d07[_0x7d2a('0x55')](_0x5b6026);}})[_0x7d2a('0x45')](handleError(_0x108d07,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index efc34b4..efe78e3 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 _0xd186=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd82509,_0x8ac7eb){var _0x3b1dc9=function(_0x2bc874){while(--_0x2bc874){_0xd82509['push'](_0xd82509['shift']());}};_0x3b1dc9(++_0x8ac7eb);}(_0xd186,0x1bc));var _0x6d18=function(_0x3452a,_0x3a45b5){_0x3452a=_0x3452a-0x0;var _0x4ccb08=_0xd186[_0x3452a];return _0x4ccb08;};'use strict';var _=require(_0x6d18('0x0'));var util=require(_0x6d18('0x1'));var logger=require(_0x6d18('0x2'))(_0x6d18('0x3'));var moment=require(_0x6d18('0x4'));var BPromise=require(_0x6d18('0x5'));var rp=require(_0x6d18('0x6'));var fs=require('fs');var path=require(_0x6d18('0x7'));var rimraf=require(_0x6d18('0x8'));var config=require(_0x6d18('0x9'));var attributes=require(_0x6d18('0xa'));module[_0x6d18('0xb')]=function(_0x3fc0f7,_0x94d4b9){return _0x3fc0f7[_0x6d18('0xc')](_0x6d18('0xd'),attributes,{'tableName':_0x6d18('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fac=['bluebird','request-promise','../../config/environment','exports','define','Attachment','lodash','util','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7fac,0x1e6));var _0xc7fa=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x7fac[_0x478414];return _0x5eb6b9;};'use strict';var _=require(_0xc7fa('0x0'));var util=require(_0xc7fa('0x1'));var logger=require(_0xc7fa('0x2'))('api');var moment=require(_0xc7fa('0x3'));var BPromise=require(_0xc7fa('0x4'));var rp=require(_0xc7fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc7fa('0x6'));var attributes=require('./attachment.attributes');module[_0xc7fa('0x7')]=function(_0x1b33e7,_0x44bbac){return _0x1b33e7[_0xc7fa('0x8')](_0xc7fa('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index d4cdccb..34c5d63 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 _0xf53f=['create','options','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateAttachment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf53f,0x8d));var _0xff53=function(_0x88459d,_0x55943e){_0x88459d=_0x88459d-0x0;var _0x26d673=_0xf53f[_0x88459d];return _0x26d673;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var moment=require(_0xff53('0x2'));var BPromise=require(_0xff53('0x3'));var rs=require(_0xff53('0x4'));var fs=require('fs');var Redis=require(_0xff53('0x5'));var db=require(_0xff53('0x6'))['db'];var utils=require(_0xff53('0x7'));var logger=require(_0xff53('0x8'))(_0xff53('0x9'));var config=require(_0xff53('0xa'));var jayson=require(_0xff53('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27b397,_0x5751e7,_0x1c27bb){return new BPromise(function(_0x122746,_0x1bc4b3){return client['request'](_0x27b397,_0x1c27bb)['then'](function(_0x3c001d){logger['info'](_0xff53('0xc'),_0x5751e7,_0xff53('0xd'));logger['debug'](_0xff53('0xe'),_0x5751e7,_0xff53('0xd'),JSON['stringify'](_0x3c001d));if(_0x3c001d[_0xff53('0xf')]){if(_0x3c001d[_0xff53('0xf')][_0xff53('0x10')]===0x1f4){logger['error'](_0xff53('0xc'),_0x5751e7,_0x3c001d[_0xff53('0xf')][_0xff53('0x11')]);return _0x1bc4b3(_0x3c001d['error'][_0xff53('0x11')]);}logger[_0xff53('0xf')]('Attachment,\x20%s,\x20%s',_0x5751e7,_0x3c001d['error']['message']);return _0x122746(_0x3c001d['error'][_0xff53('0x11')]);}else{logger[_0xff53('0x12')](_0xff53('0xc'),_0x5751e7,'request\x20sent');_0x122746(_0x3c001d[_0xff53('0x13')]['message']);}})['catch'](function(_0x12e90b){logger[_0xff53('0xf')](_0xff53('0xc'),_0x5751e7,_0x12e90b);_0x1bc4b3(_0x12e90b);});});}exports[_0xff53('0x14')]=function(_0x38883f){var _0x319ce5=this;return new Promise(function(_0x14b502,_0x5e9ba6){return db['Attachment'][_0xff53('0x15')](_0x38883f['body'],{'raw':_0x38883f[_0xff53('0x16')]?_0x38883f[_0xff53('0x16')][_0xff53('0x17')]===undefined?!![]:![]:!![]})[_0xff53('0x18')](function(_0x39b3d1){logger[_0xff53('0x12')](_0xff53('0x14'),_0x38883f);logger[_0xff53('0x19')](_0xff53('0x14'),_0x38883f,JSON['stringify'](_0x39b3d1));_0x14b502(_0x39b3d1);})[_0xff53('0x1a')](function(_0x5cd878){logger['error']('CreateAttachment',_0x5cd878['message'],_0x38883f);_0x5e9ba6(_0x319ce5[_0xff53('0xf')](0x1f4,_0x5cd878[_0xff53('0x11')]));});});}; \ No newline at end of file +var _0xb6b1=['raw','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','info','result','catch','CreateAttachment','Attachment','create','body','options'];(function(_0x4672e9,_0x5caff9){var _0x2407fd=function(_0x41bd9e){while(--_0x41bd9e){_0x4672e9['push'](_0x4672e9['shift']());}};_0x2407fd(++_0x5caff9);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xb6b1[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var moment=require(_0x1b6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6b('0x2'));var fs=require('fs');var Redis=require(_0x1b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b6b('0x4'));var logger=require('../../config/logger')(_0x1b6b('0x5'));var config=require(_0x1b6b('0x6'));var jayson=require(_0x1b6b('0x7'));var client=jayson[_0x1b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d09e,_0x51cfed,_0xae4115){return new BPromise(function(_0x5042f7,_0x21f403){return client[_0x1b6b('0x9')](_0x41d09e,_0xae4115)[_0x1b6b('0xa')](function(_0x29258a){logger['info']('Attachment,\x20%s,\x20%s',_0x51cfed,_0x1b6b('0xb'));logger[_0x1b6b('0xc')](_0x1b6b('0xd'),_0x51cfed,_0x1b6b('0xb'),JSON[_0x1b6b('0xe')](_0x29258a));if(_0x29258a[_0x1b6b('0xf')]){if(_0x29258a[_0x1b6b('0xf')]['code']===0x1f4){logger[_0x1b6b('0xf')](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')]['message']);return _0x21f403(_0x29258a[_0x1b6b('0xf')]['message']);}logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);return _0x5042f7(_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);}else{logger[_0x1b6b('0x12')](_0x1b6b('0x10'),_0x51cfed,'request\x20sent');_0x5042f7(_0x29258a[_0x1b6b('0x13')][_0x1b6b('0x11')]);}})[_0x1b6b('0x14')](function(_0x33dc7e){logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x33dc7e);_0x21f403(_0x33dc7e);});});}exports[_0x1b6b('0x15')]=function(_0x2e608b){var _0x59e671=this;return new Promise(function(_0x923711,_0x15d44b){return db[_0x1b6b('0x16')][_0x1b6b('0x17')](_0x2e608b[_0x1b6b('0x18')],{'raw':_0x2e608b[_0x1b6b('0x19')]?_0x2e608b[_0x1b6b('0x19')][_0x1b6b('0x1a')]===undefined?!![]:![]:!![]})[_0x1b6b('0xa')](function(_0x20a5a3){logger['info'](_0x1b6b('0x15'),_0x2e608b);logger[_0x1b6b('0xc')](_0x1b6b('0x15'),_0x2e608b,JSON[_0x1b6b('0xe')](_0x20a5a3));_0x923711(_0x20a5a3);})[_0x1b6b('0x14')](function(_0x276713){logger[_0x1b6b('0xf')](_0x1b6b('0x15'),_0x276713[_0x1b6b('0x11')],_0x2e608b);_0x15d44b(_0x59e671['error'](0x1f4,_0x276713[_0x1b6b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a4bfb11..ddd3fd8 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x31ceb1,_0x329fd0){var _0x24942c=function(_0x1905e7){while(--_0x1905e7){_0x31ceb1['push'](_0x31ceb1['shift']());}};_0x24942c(++_0x329fd0);}(_0x757a,0xde));var _0xa757=function(_0x1f7d14,_0xd9975){_0x1f7d14=_0x1f7d14-0x0;var _0x1cde99=_0x757a[_0x1f7d14];return _0x1cde99;};'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('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x354107,_0x57f4f9){var _0x1813e6=function(_0x2fa32e){while(--_0x2fa32e){_0x354107['push'](_0x354107['shift']());}};_0x1813e6(++_0x57f4f9);}(_0xadb5,0xad));var _0x5adb=function(_0x56fe22,_0x58a02f){_0x56fe22=_0x56fe22-0x0;var _0x3eee1e=_0xadb5[_0x56fe22];return _0x3eee1e;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4ecee52..61d61ec 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 _0x6c03=['signToken','json','online','use','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','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','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','admin','agent','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x6c03,0x98));var _0x36c0=function(_0x272b7a,_0x1661fa){_0x272b7a=_0x272b7a-0x0;var _0x173883=_0x6c03[_0x272b7a];return _0x173883;};'use strict';var passport=require(_0x36c0('0x0'));var LocalStrategy=require(_0x36c0('0x1'))[_0x36c0('0x2')];var moment=require(_0x36c0('0x3'));var ActiveDirectory=require(_0x36c0('0x4'));var BPromise=require('bluebird');var util=require(_0x36c0('0x5'));var db=require(_0x36c0('0x6'))['db'];var authService=require(_0x36c0('0x7'));var utils=require(_0x36c0('0x8'));var config=require('../../config/environment');var logger=require(_0x36c0('0x9'))(_0x36c0('0xa'));function isActiveDirectoryConfigured(_0x14afae){var _0x278765=![];if(typeof _0x14afae[_0x36c0('0xb')]!=='undefined'){_0x278765=_0x14afae['activedirectory'][_0x36c0('0xc')]&&_0x14afae[_0x36c0('0xb')][_0x36c0('0xd')]&&_0x14afae[_0x36c0('0xb')][_0x36c0('0xe')];}return _0x278765;}function adAuthenticate(_0x553f01,_0xa4af92,_0x5a83b1){return new BPromise(function(_0x41c834,_0x2148dd){try{var _0x31a7a3=new ActiveDirectory(_0x553f01);_0x31a7a3[_0x36c0('0xf')](_0xa4af92,_0x5a83b1,function(_0x498d3d,_0x6ca64e){if(_0x498d3d){logger[_0x36c0('0x10')](_0x36c0('0x11'),_0xa4af92,util['inspect'](_0x498d3d,{'showHidden':![],'depth':null}));_0x2148dd('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x6ca64e){logger[_0x36c0('0x10')](_0x36c0('0x12'),_0xa4af92);_0x2148dd(_0x36c0('0x13'));}else{_0x41c834(_0x6ca64e);}});}catch(_0x40ea5a){_0x2148dd(_0x40ea5a);}});}function ActiveDirectoryAuthenticate(_0x5d4a5e,_0x332737,_0x3bebdc,_0x273f2b){var _0x37ef59,_0x579861;if(!isActiveDirectoryConfigured(config)){logger[_0x36c0('0x10')](_0x36c0('0x14'),_0x332737);return _0x273f2b(null,![],{'message':_0x36c0('0x13')});}return db[_0x36c0('0x15')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x36c0('0x16')],'raw':!![]})[_0x36c0('0x17')](function(_0x27599e){_0x37ef59=_0x27599e;if(!_0x37ef59[_0x36c0('0x18')]){logger[_0x36c0('0x10')](_0x36c0('0x19'),_0x332737);throw new Error(_0x36c0('0x13'));}return _0x5d4a5e['findOne']({'attributes':['id',_0x36c0('0x1a'),_0x36c0('0x1b'),_0x36c0('0x1c'),_0x36c0('0x1d'),_0x36c0('0x1e'),_0x36c0('0x1f'),_0x36c0('0x20'),'online'],'where':{'name':_0x332737,'role':{'$or':[_0x36c0('0x21'),'user',_0x36c0('0x22')]},'adSsoEnabled':!![]}});})[_0x36c0('0x17')](function(_0x16cbd8){if(!_0x16cbd8||_0x16cbd8&&_0x16cbd8[_0x36c0('0x1a')]!==_0x332737){throw new Error(_0x36c0('0x13'));}_0x579861=_0x16cbd8;var _0x3ba118=_0x579861[_0x36c0('0x1a')]+'@'+config[_0x36c0('0xb')][_0x36c0('0xe')];return adAuthenticate(config[_0x36c0('0xb')],_0x3ba118,_0x3bebdc);})[_0x36c0('0x17')](function(_0x247008){if(_0x579861[_0x36c0('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x37ef59[_0x36c0('0x16')]>0x0){if(_0x579861[_0x36c0('0x1f')]){if(moment(_0x579861['blockedAt'])['add'](_0x37ef59[_0x36c0('0x16')],_0x36c0('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x36c0('0x24')](_0x579861,0x0,![],null)['then'](function(){return utils[_0x36c0('0x25')](_0x579861);})[_0x36c0('0x17')](function(){return _0x273f2b(null,_0x579861);});}else{return utils[_0x36c0('0x25')](_0x579861)['then'](function(){return _0x273f2b(null,_0x579861);});}}else{return utils[_0x36c0('0x25')](_0x579861)[_0x36c0('0x17')](function(){return _0x273f2b(null,_0x579861);});}})['catch'](function(_0x1da7a3){return _0x273f2b(null,![],_0x1da7a3);});}function handleError(_0x57fe10,_0x40be8b,_0x4a3067){return _0x57fe10[_0x36c0('0x26')](_0x40be8b||0x1f4)[_0x36c0('0x27')]({'message':_0x4a3067?_0x4a3067[_0x36c0('0x28')]||_0x4a3067:''});}exports[_0x36c0('0x29')]=function(_0x54be34,_0x140433,_0x116e20){passport[_0x36c0('0xf')](_0x36c0('0x2a'),function(_0x613a63,_0x2322dd,_0x307757){var _0x2808ad=_0x613a63||_0x307757;if(_0x2808ad){return handleError(_0x140433,0x191,_0x2808ad);}if(!_0x2322dd){return handleError(_0x140433,0x194,{'message':_0x36c0('0x2b')});}else{var _0x4b2cba={'payload':{'id':_0x2322dd['id'],'role':_0x2322dd[_0x36c0('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x36c0('0x2c')](_0x4b2cba)[_0x36c0('0x17')](function(_0x24c916){_0x140433[_0x36c0('0x2d')]({'id':_0x2322dd['id'],'token':_0x24c916,'statusCall':'','isAlreadyLogged':_0x2322dd[_0x36c0('0x2e')]});});}})(_0x54be34,_0x140433,_0x116e20);};passport[_0x36c0('0x2f')](_0x36c0('0x2a'),new LocalStrategy({'usernameField':_0x36c0('0x1a'),'passwordField':_0x36c0('0x1b')},function(_0x15f5eb,_0x43fb75,_0x40fad2){return ActiveDirectoryAuthenticate(db[_0x36c0('0x30')],_0x15f5eb,_0x43fb75,_0x40fad2);})); \ No newline at end of file +var _0xf5e8=['domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blocked','admin','agent','minutes','clearBlockUser','getLicense','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','use','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url'];(function(_0x408719,_0x44c832){var _0x56fa67=function(_0x531690){while(--_0x531690){_0x408719['push'](_0x408719['shift']());}};_0x56fa67(++_0x44c832);}(_0xf5e8,0xfa));var _0x8f5e=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0xf5e8[_0x47568e];return _0x33815b;};'use strict';var passport=require(_0x8f5e('0x0'));var LocalStrategy=require(_0x8f5e('0x1'))[_0x8f5e('0x2')];var moment=require(_0x8f5e('0x3'));var ActiveDirectory=require(_0x8f5e('0x4'));var BPromise=require('bluebird');var util=require(_0x8f5e('0x5'));var db=require(_0x8f5e('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x8f5e('0x7'));var config=require(_0x8f5e('0x8'));var logger=require(_0x8f5e('0x9'))(_0x8f5e('0xa'));function isActiveDirectoryConfigured(_0x48ed61){var _0x49a02f=![];if(typeof _0x48ed61[_0x8f5e('0xb')]!==_0x8f5e('0xc')){_0x49a02f=_0x48ed61[_0x8f5e('0xb')]['baseDN']&&_0x48ed61[_0x8f5e('0xb')][_0x8f5e('0xd')]&&_0x48ed61[_0x8f5e('0xb')][_0x8f5e('0xe')];}return _0x49a02f;}function adAuthenticate(_0x2d3064,_0x352193,_0x488803){return new BPromise(function(_0x1afc61,_0xfa8aa2){try{var _0xa1642f=new ActiveDirectory(_0x2d3064);_0xa1642f[_0x8f5e('0xf')](_0x352193,_0x488803,function(_0x401607,_0x15796b){if(_0x401607){logger[_0x8f5e('0x10')](_0x8f5e('0x11'),_0x352193,util['inspect'](_0x401607,{'showHidden':![],'depth':null}));_0xfa8aa2(_0x8f5e('0x12'));}else if(!_0x15796b){logger[_0x8f5e('0x10')](_0x8f5e('0x13'),_0x352193);_0xfa8aa2(_0x8f5e('0x12'));}else{_0x1afc61(_0x15796b);}});}catch(_0x3879ad){_0xfa8aa2(_0x3879ad);}});}function ActiveDirectoryAuthenticate(_0x4cc268,_0x35aea9,_0x44d097,_0x21f48e){var _0x1a297e,_0x3efc37;if(!isActiveDirectoryConfigured(config)){logger[_0x8f5e('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x35aea9);return _0x21f48e(null,![],{'message':_0x8f5e('0x12')});}return db['Setting'][_0x8f5e('0x14')]({'where':{'id':0x1},'attributes':[_0x8f5e('0x15'),_0x8f5e('0x16')],'raw':!![]})[_0x8f5e('0x17')](function(_0x4aaf31){_0x1a297e=_0x4aaf31;if(!_0x1a297e['adSsoEnabled']){logger[_0x8f5e('0x10')](_0x8f5e('0x18'),_0x35aea9);throw new Error(_0x8f5e('0x12'));}return _0x4cc268[_0x8f5e('0x14')]({'attributes':['id',_0x8f5e('0x19'),_0x8f5e('0x1a'),'salt',_0x8f5e('0x1b'),_0x8f5e('0x1c'),_0x8f5e('0x1d'),'blockedAt','online'],'where':{'name':_0x35aea9,'role':{'$or':[_0x8f5e('0x1e'),'user',_0x8f5e('0x1f')]},'adSsoEnabled':!![]}});})['then'](function(_0x1488f0){if(!_0x1488f0||_0x1488f0&&_0x1488f0[_0x8f5e('0x19')]!==_0x35aea9){throw new Error(_0x8f5e('0x12'));}_0x3efc37=_0x1488f0;var _0x2fdcda=_0x3efc37[_0x8f5e('0x19')]+'@'+config[_0x8f5e('0xb')][_0x8f5e('0xe')];return adAuthenticate(config[_0x8f5e('0xb')],_0x2fdcda,_0x44d097);})[_0x8f5e('0x17')](function(_0x33bc36){if(_0x3efc37[_0x8f5e('0x1c')]){throw new Error(_0x8f5e('0x12'));}if(_0x1a297e['blockDuration']>0x0){if(_0x3efc37['blocked']){if(moment(_0x3efc37['blockedAt'])['add'](_0x1a297e['blockDuration'],_0x8f5e('0x20'))>moment()){throw new Error(_0x8f5e('0x12'));}return utils[_0x8f5e('0x21')](_0x3efc37,0x0,![],null)[_0x8f5e('0x17')](function(){return utils[_0x8f5e('0x22')](_0x3efc37);})[_0x8f5e('0x17')](function(){return _0x21f48e(null,_0x3efc37);});}else{return utils[_0x8f5e('0x22')](_0x3efc37)[_0x8f5e('0x17')](function(){return _0x21f48e(null,_0x3efc37);});}}else{return utils['getLicense'](_0x3efc37)[_0x8f5e('0x17')](function(){return _0x21f48e(null,_0x3efc37);});}})['catch'](function(_0x42d76f){return _0x21f48e(null,![],_0x42d76f);});}function handleError(_0x21a301,_0x1a0b72,_0x2430e5){return _0x21a301[_0x8f5e('0x23')](_0x1a0b72||0x1f4)[_0x8f5e('0x24')]({'message':_0x2430e5?_0x2430e5['message']||_0x2430e5:''});}exports[_0x8f5e('0x25')]=function(_0x1f6a74,_0x442d76,_0x12ec1f){passport[_0x8f5e('0xf')]('ad-login',function(_0x532ea7,_0x4d7ce9,_0xba3a96){var _0x4b1148=_0x532ea7||_0xba3a96;if(_0x4b1148){return handleError(_0x442d76,0x191,_0x4b1148);}if(!_0x4d7ce9){return handleError(_0x442d76,0x194,{'message':_0x8f5e('0x26')});}else{var _0x1c34b7={'payload':{'id':_0x4d7ce9['id'],'role':_0x4d7ce9[_0x8f5e('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x8f5e('0x27')](_0x1c34b7)[_0x8f5e('0x17')](function(_0x3905c0){_0x442d76['json']({'id':_0x4d7ce9['id'],'token':_0x3905c0,'statusCall':'','isAlreadyLogged':_0x4d7ce9[_0x8f5e('0x28')]});});}})(_0x1f6a74,_0x442d76,_0x12ec1f);};passport[_0x8f5e('0x29')](_0x8f5e('0x2a'),new LocalStrategy({'usernameField':_0x8f5e('0x19'),'passwordField':_0x8f5e('0x1a')},function(_0x3f36d9,_0x2eb85e,_0x7f3361){return ActiveDirectoryAuthenticate(db[_0x8f5e('0x2b')],_0x3f36d9,_0x2eb85e,_0x7f3361);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 0dd6182..a1b1658 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 _0x56dc=['express','./authActiveDirectory.controller','post','exports'];(function(_0x9a23f5,_0xfd4537){var _0x48eb4f=function(_0x57c6a0){while(--_0x57c6a0){_0x9a23f5['push'](_0x9a23f5['shift']());}};_0x48eb4f(++_0xfd4537);}(_0x56dc,0x1bc));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xc56d('0x0'));var router=express['Router']();var controller=require(_0xc56d('0x1'));router[_0xc56d('0x2')]('/',controller['login']);module[_0xc56d('0x3')]=router; \ No newline at end of file +var _0x2cf4=['login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x214f40,_0x17e44b){var _0x22a380=function(_0x47a1c6){while(--_0x47a1c6){_0x214f40['push'](_0x214f40['shift']());}};_0x22a380(++_0x17e44b);}(_0x2cf4,0x11f));var _0x42cf=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x2cf4[_0x3cb3ca];return _0x214366;};'use strict';var express=require(_0x42cf('0x0'));var router=express[_0x42cf('0x1')]();var controller=require(_0x42cf('0x2'));router['post']('/',controller[_0x42cf('0x3')]);module[_0x42cf('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 3b78b86..95a7446 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x7a54,0x106));var _0x47a5=function(_0x21b107,_0x4e609e){_0x21b107=_0x21b107-0x0;var _0x4d3ed2=_0x7a54[_0x21b107];return _0x4d3ed2;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x23603,_0x281eee){var _0x2357a1=function(_0x265b78){while(--_0x265b78){_0x23603['push'](_0x23603['shift']());}};_0x2357a1(++_0x281eee);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 6f5ca6d..ee6e203 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 _0x31d7=['exports','express','passport','Router','./authGoogle.controller','get','/callback','callback','login'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x31d7,0x160));var _0x731d=function(_0xd1557,_0x1351eb){_0xd1557=_0xd1557-0x0;var _0xcbd609=_0x31d7[_0xd1557];return _0xcbd609;};'use strict';var express=require(_0x731d('0x0'));var passport=require(_0x731d('0x1'));var router=express[_0x731d('0x2')]();var controller=require(_0x731d('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0x731d('0x4')](_0x731d('0x5'),controller[_0x731d('0x6')],authService['isMiddleware'],userController[_0x731d('0x7')],authService['setTokenCookie']);module[_0x731d('0x8')]=router; \ No newline at end of file +var _0x64d7=['setTokenCookie','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback'];(function(_0x32b3b2,_0x4571ca){var _0x3f42cc=function(_0x170106){while(--_0x170106){_0x32b3b2['push'](_0x32b3b2['shift']());}};_0x3f42cc(++_0x4571ca);}(_0x64d7,0x19f));var _0x764d=function(_0xbb4325,_0x293598){_0xbb4325=_0xbb4325-0x0;var _0xf7423a=_0x64d7[_0xbb4325];return _0xf7423a;};'use strict';var express=require(_0x764d('0x0'));var passport=require('passport');var router=express[_0x764d('0x1')]();var controller=require(_0x764d('0x2'));var userController=require(_0x764d('0x3'));var authService=require(_0x764d('0x4'));router[_0x764d('0x5')]('/',controller[_0x764d('0x6')]);router[_0x764d('0x5')]('/callback',controller[_0x764d('0x7')],authService['isMiddleware'],userController[_0x764d('0x6')],authService[_0x764d('0x8')]);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 d8cd2f9..97a102f 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 _0xbbda=['Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','previousPasswords','status','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','authenticate','minutes','clearBlockUser','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','request','error','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot'];(function(_0xafa7e8,_0x501da3){var _0x314110=function(_0x277f85){while(--_0x277f85){_0xafa7e8['push'](_0xafa7e8['shift']());}};_0x314110(++_0x501da3);}(_0xbbda,0x16a));var _0xabbd=function(_0xc27749,_0x188efd){_0xc27749=_0xc27749-0x0;var _0x566bde=_0xbbda[_0xc27749];return _0x566bde;};'use strict';var util=require(_0xabbd('0x0'));var passport=require(_0xabbd('0x1'));var LocalStrategy=require(_0xabbd('0x2'))[_0xabbd('0x3')];var jayson=require(_0xabbd('0x4'));var _=require(_0xabbd('0x5'));var rs=require(_0xabbd('0x6'));var moment=require('moment');var db=require(_0xabbd('0x7'))['db'];var authService=require(_0xabbd('0x8'));var utils=require('../../config/utils');var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0xdee9c8,_0x374e80,_0xd706b0,_0x56e953){var _0x211a97,_0x27cf10;return db[_0xabbd('0x9')][_0xabbd('0xa')]({'where':{'id':0x1},'attributes':[_0xabbd('0xb'),_0xabbd('0xc')],'raw':!![]})['then'](function(_0x8cb2c9){_0x211a97=_0x8cb2c9;return _0xdee9c8[_0xabbd('0xa')]({'attributes':['id',_0xabbd('0xd'),_0xabbd('0xe'),_0xabbd('0xf'),_0xabbd('0x10'),_0xabbd('0x11'),_0xabbd('0x12'),_0xabbd('0x13'),_0xabbd('0x14')],'where':{'name':_0x374e80,'role':{'$or':[_0xabbd('0x15'),_0xabbd('0x16'),_0xabbd('0x17')]}}});})[_0xabbd('0x18')](function(_0x4a7335){if(!_0x4a7335||_0x4a7335&&_0x4a7335['name']!==_0x374e80){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x27cf10=_0x4a7335;return _0x27cf10;}})[_0xabbd('0x18')](function(){_0x27cf10[_0xabbd('0x19')](_0xd706b0,function(_0x57d3f9,_0x594ad7){var _0x1e33bc=_0x27cf10[_0xabbd('0x14')]+0x1;if(_0x57d3f9){return _0x56e953(_0x57d3f9);}else if(!_0x594ad7){if(_0x27cf10[_0xabbd('0x11')]){return _0x56e953(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x211a97[_0xabbd('0xb')]>0x0){if(_0x27cf10[_0xabbd('0x12')]){if(_0x211a97[_0xabbd('0xc')]>0x0){if(moment(_0x27cf10[_0xabbd('0x13')])['add'](_0x211a97[_0xabbd('0xc')],_0xabbd('0x1a'))>moment()){return _0x56e953(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xabbd('0x1b')](_0x27cf10,_0x1e33bc,![],null)[_0xabbd('0x18')](function(){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});});}}else{return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}}else{if(_0x1e33bc>=_0x211a97['allowedLoginAttempts']){return utils['clearBlockUser'](_0x27cf10,0x0,!![],moment())[_0xabbd('0x18')](function(){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});});}else{return utils[_0xabbd('0x1b')](_0x27cf10,_0x1e33bc,![],null)['then'](function(){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});});}}}else{return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}}else{if(_0x27cf10[_0xabbd('0x11')]){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}else if(_0x211a97['allowedLoginAttempts']>0x0){if(_0x27cf10['blocked']){if(_0x211a97['blockDuration']>0x0){if(moment(_0x27cf10[_0xabbd('0x13')])['add'](_0x211a97[_0xabbd('0xc')],_0xabbd('0x1a'))>moment()){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}else{return utils[_0xabbd('0x1b')](_0x27cf10,0x0,![],null)[_0xabbd('0x18')](function(){return utils[_0xabbd('0x1d')](_0x27cf10);})[_0xabbd('0x18')](function(){return _0x56e953(null,_0x27cf10);});}}else{return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}}else{return utils[_0xabbd('0x1b')](_0x27cf10,0x0,![],null)[_0xabbd('0x18')](function(){return utils[_0xabbd('0x1d')](_0x27cf10);})['then'](function(){return _0x56e953(null,_0x27cf10);})[_0xabbd('0x1e')](function(_0x118595){return _0x56e953(null,![],_0x118595);});}}else{if(_0x27cf10[_0xabbd('0x12')]){return _0x56e953(null,![],{'message':_0xabbd('0x1c')});}else{return utils['getLicense'](_0x27cf10)['then'](function(){return _0x56e953(null,_0x27cf10);});}}}});})[_0xabbd('0x1e')](function(_0xd7a2f){return _0x56e953(null,![],_0xd7a2f);});}function sendServiceMail(_0x1e4a2e){return db[_0xabbd('0x1f')][_0xabbd('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xabbd('0x21')],'include':[{'model':db[_0xabbd('0x22')],'as':'Smtp','include':[{'model':db[_0xabbd('0x23')],'as':_0xabbd('0x23')}]}]})[_0xabbd('0x18')](function(_0x5e580d){if(!_0x5e580d){throw new Error(_0xabbd('0x24'));}var _0x2cebc2=_0x5e580d[_0xabbd('0x25')]();var _0x595509={'account':_0x2cebc2,'message':_['merge']({'from':util[_0xabbd('0x26')](_0xabbd('0x27'),_0x5e580d[_0xabbd('0xd')],_0x5e580d[_0xabbd('0x21')]||_0x5e580d[_0xabbd('0x28')][_0xabbd('0x16')])},_0x1e4a2e)};return client[_0xabbd('0x29')]('SendMail',_0x595509);})[_0xabbd('0x18')](function(_0x21080d){if(_0x21080d[_0xabbd('0x2a')]){throw new Error(util[_0xabbd('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x21080d[_0xabbd('0x2a')][_0xabbd('0x2b')]||JSON[_0xabbd('0x2c')](_0x21080d[_0xabbd('0x2a')])));}return!![];});}function handleError(_0x500f79,_0x5e68fe,_0x2ebf08){return _0x500f79['status'](_0x5e68fe||0x1f4)[_0xabbd('0x2d')]({'message':_0x2ebf08?_0x2ebf08[_0xabbd('0x2b')]||_0x2ebf08:''});}exports[_0xabbd('0x2e')]=function(_0x177a72,_0x17596b,_0x12010c){passport[_0xabbd('0x19')](_0xabbd('0x2f'),function(_0x57364a,_0x342586,_0x386a6d){var _0x466818=_0x57364a||_0x386a6d;if(_0x466818){return handleError(_0x17596b,0x191,_0x466818);}if(!_0x342586){return handleError(_0x17596b,0x194,{'message':_0xabbd('0x30')});}else{var _0x1f7903={'payload':{'id':_0x342586['id'],'role':_0x342586[_0xabbd('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xabbd('0x31')](_0x1f7903)[_0xabbd('0x18')](function(_0x49f727){_0x17596b[_0xabbd('0x32')]({'id':_0x342586['id'],'token':_0x49f727,'statusCall':'','isAlreadyLogged':_0x342586[_0xabbd('0x33')]});});}})(_0x177a72,_0x17596b,_0x12010c);};exports[_0xabbd('0x34')]=function(_0x385cff,_0x1948ca){if(!_0x385cff['body'][_0xabbd('0x21')]){return handleError(_0x1948ca,0x1f4,{'message':_0xabbd('0x35')});}var _0x3c46a9=rs[_0xabbd('0x36')]();_0x385cff['body'][_0xabbd('0x21')]=_0x385cff[_0xabbd('0x37')][_0xabbd('0x21')][_0xabbd('0x38')]()[_0xabbd('0x39')]();var _0x1cf5ea;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xabbd('0xb'),_0xabbd('0xc')],'raw':!![]})[_0xabbd('0x18')](function(_0xdca88a){_0x1cf5ea=_0xdca88a;return db['User'][_0xabbd('0x20')]({'where':{'email':_0x385cff[_0xabbd('0x37')]['email']}});})[_0xabbd('0x18')](function(_0x132390){if(!_0x132390){throw new Error(_0xabbd('0x3a'));}if(_0x132390['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x132390[_0xabbd('0x12')]){if(moment(_0x132390['blockedAt'])[_0xabbd('0x3b')](_0x1cf5ea['blockDuration'],'minutes')>moment()){throw new Error(_0xabbd('0x3c'));}else{_0x132390[_0xabbd('0x12')]=![];_0x132390[_0xabbd('0x13')]=null;}}_0x132390[_0xabbd('0x3d')]=_0x3c46a9;_0x132390['resetPasswordExpires']=Date[_0xabbd('0x3e')]()+0x36ee80;return _0x132390['save']();})['then'](function(){return sendServiceMail({'to':_0x385cff[_0xabbd('0x37')][_0xabbd('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xabbd('0x3f')+_0xabbd('0x40')+_0xabbd('0x41')+_0x385cff[_0xabbd('0x42')][_0xabbd('0x43')]+_0xabbd('0x44')+_0x3c46a9+'\x0a\x0a'+_0xabbd('0x45')});})[_0xabbd('0x18')](function(){_0x1948ca['status'](0xc8)['send']({'message':_0xabbd('0x46')});})[_0xabbd('0x1e')](function(_0x31708e){return handleError(_0x1948ca,0x1f4,_0x31708e);});};exports['reset']=function(_0x4baa37,_0x46fa13){return db[_0xabbd('0x47')][_0xabbd('0x20')]({'where':{'resetPasswordToken':_0x4baa37[_0xabbd('0x48')][_0xabbd('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xabbd('0x18')](function(_0x5d5696){if(!_0x5d5696){throw new Error(_0xabbd('0x4a'));}return db[_0xabbd('0x9')][_0xabbd('0xa')]({'attributes':['id','securePassword',_0xabbd('0x4b'),_0xabbd('0x4c')]})['then'](function(_0x330dcb){if(_0x330dcb[_0xabbd('0x4d')])authService[_0xabbd('0x4e')](_0x4baa37[_0xabbd('0x37')][_0xabbd('0xe')]);if(!_0x330dcb[_0xabbd('0x4b')]||!_0x5d5696['previousPasswords'])return _0x5d5696;authService[_0xabbd('0x4f')](_0x4baa37[_0xabbd('0x37')][_0xabbd('0xe')],_0x5d5696[_0xabbd('0x50')],_0x330dcb[_0xabbd('0x4c')]);return _0x5d5696;})['then'](function(){_0x5d5696[_0xabbd('0xe')]=_0x4baa37['body'][_0xabbd('0xe')];_0x5d5696[_0xabbd('0x3d')]=null;_0x5d5696['resetPasswordExpires']=null;return _0x5d5696['save']();});})['then'](function(){_0x46fa13[_0xabbd('0x51')](0xc8)[_0xabbd('0x2d')]({'message':'Password\x20reset!'});})[_0xabbd('0x1e')](function(_0x4b19ad){return handleError(_0x46fa13,0x1f4,_0x4b19ad);});};passport[_0xabbd('0x52')](_0xabbd('0x2f'),new LocalStrategy({'usernameField':_0xabbd('0xd'),'passwordField':_0xabbd('0xe')},function(_0x180d9c,_0x3ee985,_0xe5ad44){return localAuthenticate(db[_0xabbd('0x47')],_0x180d9c,_0x3ee985,_0xe5ad44);})); \ No newline at end of file +var _0xa237=['merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','message','status','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','use','local-login','util','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions'];(function(_0x2e3531,_0x1f0a91){var _0x39f792=function(_0x453003){while(--_0x453003){_0x2e3531['push'](_0x2e3531['shift']());}};_0x39f792(++_0x1f0a91);}(_0xa237,0x7c));var _0x7a23=function(_0x12524e,_0x28d790){_0x12524e=_0x12524e-0x0;var _0x6274e=_0xa237[_0x12524e];return _0x6274e;};'use strict';var util=require(_0x7a23('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x7a23('0x1')];var jayson=require(_0x7a23('0x2'));var _=require(_0x7a23('0x3'));var rs=require(_0x7a23('0x4'));var moment=require(_0x7a23('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x7a23('0x6'));var utils=require(_0x7a23('0x7'));var client=jayson[_0x7a23('0x8')][_0x7a23('0x9')]({'port':0x232b});function localAuthenticate(_0x40e9a3,_0x20f11d,_0x1f8a97,_0x337eff){var _0x232784,_0x59100e;return db[_0x7a23('0xa')][_0x7a23('0xb')]({'where':{'id':0x1},'attributes':[_0x7a23('0xc'),_0x7a23('0xd')],'raw':!![]})[_0x7a23('0xe')](function(_0x5a8c2d){_0x232784=_0x5a8c2d;return _0x40e9a3[_0x7a23('0xb')]({'attributes':['id',_0x7a23('0xf'),_0x7a23('0x10'),'salt',_0x7a23('0x11'),'disabled',_0x7a23('0x12'),_0x7a23('0x13'),_0x7a23('0x14')],'where':{'name':_0x20f11d,'role':{'$or':[_0x7a23('0x15'),_0x7a23('0x16'),_0x7a23('0x17')]}}});})['then'](function(_0x5177aa){if(!_0x5177aa||_0x5177aa&&_0x5177aa[_0x7a23('0xf')]!==_0x20f11d){throw new Error(_0x7a23('0x18'));}else{_0x59100e=_0x5177aa;return _0x59100e;}})['then'](function(){_0x59100e['authenticate'](_0x1f8a97,function(_0x3d010a,_0x10f458){var _0x5b5637=_0x59100e[_0x7a23('0x14')]+0x1;if(_0x3d010a){return _0x337eff(_0x3d010a);}else if(!_0x10f458){if(_0x59100e[_0x7a23('0x19')]){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else if(_0x232784['allowedLoginAttempts']>0x0){if(_0x59100e[_0x7a23('0x12')]){if(_0x232784[_0x7a23('0xd')]>0x0){if(moment(_0x59100e['blockedAt'])[_0x7a23('0x1a')](_0x232784[_0x7a23('0xd')],_0x7a23('0x1b'))>moment()){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else{return utils[_0x7a23('0x1c')](_0x59100e,_0x5b5637,![],null)[_0x7a23('0xe')](function(){return _0x337eff(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x337eff(null,![],{'message':_0x7a23('0x18')});}}else{if(_0x5b5637>=_0x232784[_0x7a23('0xc')]){return utils[_0x7a23('0x1c')](_0x59100e,0x0,!![],moment())[_0x7a23('0xe')](function(){return _0x337eff(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x7a23('0x1c')](_0x59100e,_0x5b5637,![],null)[_0x7a23('0xe')](function(){return _0x337eff(null,![],{'message':_0x7a23('0x18')});});}}}else{return _0x337eff(null,![],{'message':_0x7a23('0x18')});}}else{if(_0x59100e[_0x7a23('0x19')]){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else if(_0x232784['allowedLoginAttempts']>0x0){if(_0x59100e[_0x7a23('0x12')]){if(_0x232784[_0x7a23('0xd')]>0x0){if(moment(_0x59100e[_0x7a23('0x13')])[_0x7a23('0x1a')](_0x232784['blockDuration'],'minutes')>moment()){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else{return utils['clearBlockUser'](_0x59100e,0x0,![],null)[_0x7a23('0xe')](function(){return utils[_0x7a23('0x1d')](_0x59100e);})[_0x7a23('0xe')](function(){return _0x337eff(null,_0x59100e);});}}else{return _0x337eff(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x7a23('0x1c')](_0x59100e,0x0,![],null)[_0x7a23('0xe')](function(){return utils['getLicense'](_0x59100e);})[_0x7a23('0xe')](function(){return _0x337eff(null,_0x59100e);})[_0x7a23('0x1e')](function(_0x4f0e1a){return _0x337eff(null,![],_0x4f0e1a);});}}else{if(_0x59100e['blocked']){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else{return utils[_0x7a23('0x1d')](_0x59100e)[_0x7a23('0xe')](function(){return _0x337eff(null,_0x59100e);});}}}});})[_0x7a23('0x1e')](function(_0x5d70d4){return _0x337eff(null,![],_0x5d70d4);});}function sendServiceMail(_0x1a55e6){return db[_0x7a23('0x1f')][_0x7a23('0x20')]({'where':{'service':!![]},'attributes':['id',_0x7a23('0xf'),_0x7a23('0x21')],'include':[{'model':db[_0x7a23('0x22')],'as':_0x7a23('0x23'),'include':[{'model':db[_0x7a23('0x24')],'as':_0x7a23('0x24')}]}]})[_0x7a23('0xe')](function(_0x2bf609){if(!_0x2bf609){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1fa127=_0x2bf609[_0x7a23('0x25')]();var _0x2a0eb1={'account':_0x1fa127,'message':_[_0x7a23('0x26')]({'from':util['format'](_0x7a23('0x27'),_0x2bf609[_0x7a23('0xf')],_0x2bf609[_0x7a23('0x21')]||_0x2bf609[_0x7a23('0x23')]['user'])},_0x1a55e6)};return client[_0x7a23('0x28')](_0x7a23('0x29'),_0x2a0eb1);})[_0x7a23('0xe')](function(_0x5c42b8){if(_0x5c42b8[_0x7a23('0x2a')]){throw new Error(util[_0x7a23('0x2b')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x5c42b8[_0x7a23('0x2a')][_0x7a23('0x2c')]||JSON['stringify'](_0x5c42b8['error'])));}return!![];});}function handleError(_0x45f19c,_0x31b285,_0x5e18f6){return _0x45f19c[_0x7a23('0x2d')](_0x31b285||0x1f4)['send']({'message':_0x5e18f6?_0x5e18f6[_0x7a23('0x2c')]||_0x5e18f6:''});}exports[_0x7a23('0x2e')]=function(_0x582ec2,_0x14d23b,_0x5a390a){passport[_0x7a23('0x2f')]('local-login',function(_0x4d17b6,_0x5dc53c,_0x37b939){var _0x2adcf6=_0x4d17b6||_0x37b939;if(_0x2adcf6){return handleError(_0x14d23b,0x191,_0x2adcf6);}if(!_0x5dc53c){return handleError(_0x14d23b,0x194,{'message':_0x7a23('0x30')});}else{var _0x48e73b={'payload':{'id':_0x5dc53c['id'],'role':_0x5dc53c[_0x7a23('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x48e73b)['then'](function(_0x592b17){_0x14d23b[_0x7a23('0x31')]({'id':_0x5dc53c['id'],'token':_0x592b17,'statusCall':'','isAlreadyLogged':_0x5dc53c[_0x7a23('0x32')]});});}})(_0x582ec2,_0x14d23b,_0x5a390a);};exports[_0x7a23('0x33')]=function(_0x777331,_0x2818ca){if(!_0x777331[_0x7a23('0x34')][_0x7a23('0x21')]){return handleError(_0x2818ca,0x1f4,{'message':_0x7a23('0x35')});}var _0x5d652f=rs[_0x7a23('0x36')]();_0x777331['body']['email']=_0x777331[_0x7a23('0x34')][_0x7a23('0x21')]['trim']()[_0x7a23('0x37')]();var _0x544d1b;return db[_0x7a23('0xa')][_0x7a23('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7a23('0xd')],'raw':!![]})[_0x7a23('0xe')](function(_0x3a43fc){_0x544d1b=_0x3a43fc;return db[_0x7a23('0x38')]['find']({'where':{'email':_0x777331[_0x7a23('0x34')]['email']}});})[_0x7a23('0xe')](function(_0xfe9755){if(!_0xfe9755){throw new Error(_0x7a23('0x39'));}if(_0xfe9755[_0x7a23('0x19')]){throw new Error(_0x7a23('0x3a'));}if(_0xfe9755[_0x7a23('0x12')]){if(moment(_0xfe9755[_0x7a23('0x13')])[_0x7a23('0x1a')](_0x544d1b['blockDuration'],_0x7a23('0x1b'))>moment()){throw new Error(_0x7a23('0x3b'));}else{_0xfe9755['blocked']=![];_0xfe9755[_0x7a23('0x13')]=null;}}_0xfe9755[_0x7a23('0x3c')]=_0x5d652f;_0xfe9755[_0x7a23('0x3d')]=Date[_0x7a23('0x3e')]()+0x36ee80;return _0xfe9755[_0x7a23('0x3f')]();})[_0x7a23('0xe')](function(){return sendServiceMail({'to':_0x777331[_0x7a23('0x34')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7a23('0x40')+_0x7a23('0x41')+_0x777331[_0x7a23('0x42')][_0x7a23('0x43')]+_0x7a23('0x44')+_0x5d652f+'\x0a\x0a'+_0x7a23('0x45')});})[_0x7a23('0xe')](function(){_0x2818ca[_0x7a23('0x2d')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0xbe786d){return handleError(_0x2818ca,0x1f4,_0xbe786d);});};exports[_0x7a23('0x46')]=function(_0x2ed2cf,_0x451dbb){return db[_0x7a23('0x38')][_0x7a23('0x20')]({'where':{'resetPasswordToken':_0x2ed2cf[_0x7a23('0x47')][_0x7a23('0x48')],'resetPasswordExpires':{'$gt':Date[_0x7a23('0x3e')]()}}})['then'](function(_0x5641a1){if(!_0x5641a1){throw new Error(_0x7a23('0x49'));}return db['Setting']['findOne']({'attributes':['id','securePassword',_0x7a23('0x4a'),'passwordHistoryLimit']})[_0x7a23('0xe')](function(_0x573aa4){if(_0x573aa4['securePassword'])authService[_0x7a23('0x4b')](_0x2ed2cf[_0x7a23('0x34')]['password']);if(!_0x573aa4[_0x7a23('0x4a')]||!_0x5641a1[_0x7a23('0x4c')])return _0x5641a1;authService[_0x7a23('0x4d')](_0x2ed2cf[_0x7a23('0x34')][_0x7a23('0x10')],_0x5641a1[_0x7a23('0x4c')],_0x573aa4[_0x7a23('0x4e')]);return _0x5641a1;})[_0x7a23('0xe')](function(){_0x5641a1[_0x7a23('0x10')]=_0x2ed2cf[_0x7a23('0x34')][_0x7a23('0x10')];_0x5641a1[_0x7a23('0x3c')]=null;_0x5641a1[_0x7a23('0x3d')]=null;return _0x5641a1['save']();});})[_0x7a23('0xe')](function(){_0x451dbb[_0x7a23('0x2d')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x7a23('0x1e')](function(_0x102a1c){return handleError(_0x451dbb,0x1f4,_0x102a1c);});};passport[_0x7a23('0x4f')](_0x7a23('0x50'),new LocalStrategy({'usernameField':_0x7a23('0xf'),'passwordField':_0x7a23('0x10')},function(_0x2f0531,_0x5f4c28,_0x2182d6){return localAuthenticate(db['User'],_0x2f0531,_0x5f4c28,_0x2182d6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0850c55..51f4aa4 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 _0x700f=['express','Router','login','post','/forgot','forgot','reset','exports'];(function(_0x1b6916,_0x5ea45e){var _0x4b37a9=function(_0x50e648){while(--_0x50e648){_0x1b6916['push'](_0x1b6916['shift']());}};_0x4b37a9(++_0x5ea45e);}(_0x700f,0x118));var _0xf700=function(_0xca167c,_0x439d26){_0xca167c=_0xca167c-0x0;var _0x30cc8b=_0x700f[_0xca167c];return _0x30cc8b;};'use strict';var express=require(_0xf700('0x0'));var router=express[_0xf700('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xf700('0x2')]);router[_0xf700('0x3')](_0xf700('0x4'),controller[_0xf700('0x5')]);router[_0xf700('0x3')]('/reset/:token',controller[_0xf700('0x6')]);module[_0xf700('0x7')]=router; \ No newline at end of file +var _0x0d6a=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','/forgot','forgot'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0d6a,0x186));var _0xa0d6=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x0d6a[_0x4b2863];return _0x567d67;};'use strict';var express=require(_0xa0d6('0x0'));var router=express[_0xa0d6('0x1')]();var controller=require(_0xa0d6('0x2'));router[_0xa0d6('0x3')]('/',controller['login']);router[_0xa0d6('0x3')](_0xa0d6('0x4'),controller[_0xa0d6('0x5')]);router[_0xa0d6('0x3')](_0xa0d6('0x6'),controller[_0xa0d6('0x7')]);module[_0xa0d6('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 7da7b65..b4e58b6 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 _0x2658=['exports','STRING','BOOLEAN'];(function(_0x2787c5,_0x422f0b){var _0x1b53c5=function(_0x398028){while(--_0x398028){_0x2787c5['push'](_0x2787c5['shift']());}};_0x1b53c5(++_0x422f0b);}(_0x2658,0x102));var _0x8265=function(_0x1fb99e,_0x6afedb){_0x1fb99e=_0x1fb99e-0x0;var _0x4b9b71=_0x2658[_0x1fb99e];return _0x4b9b71;};'use strict';var Sequelize=require('sequelize');module[_0x8265('0x0')]={'name':{'type':Sequelize[_0x8265('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x8265('0x1')]},'description':{'type':Sequelize[_0x8265('0x1')]},'status':{'type':Sequelize[_0x8265('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x8848=['BOOLEAN','INTEGER','STRING'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x8848,0x188));var _0x8884=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x8848[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8884('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x8884('0x0')]},'description':{'type':Sequelize[_0x8884('0x0')]},'status':{'type':Sequelize[_0x8884('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8884('0x2')],'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 43a0df5..fec9b1f 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 _0x4833=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','set','json','reject','save','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','offset','order','sort','where','pick','merge','map','filter','options','includeAll','include','catch','params','filters','fields','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','hasOwnProperty','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4833,0x138));var _0x3483=function(_0x133425,_0x2d60f2){_0x133425=_0x133425-0x0;var _0x45c4a4=_0x4833[_0x133425];return _0x45c4a4;};'use strict';var emlformat=require(_0x3483('0x0'));var rimraf=require(_0x3483('0x1'));var zipdir=require(_0x3483('0x2'));var jsonpatch=require(_0x3483('0x3'));var rp=require(_0x3483('0x4'));var moment=require(_0x3483('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3483('0x6'));var path=require(_0x3483('0x7'));var sox=require(_0x3483('0x8'));var csv=require(_0x3483('0x9'));var ejs=require(_0x3483('0xa'));var fs=require('fs');var fs_extra=require(_0x3483('0xb'));var _=require(_0x3483('0xc'));var squel=require(_0x3483('0xd'));var crypto=require(_0x3483('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3483('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3483('0x10'));var Papa=require(_0x3483('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3483('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3483('0x13'))(_0x3483('0x14'));var utils=require('../../config/utils');var config=require(_0x3483('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3483('0x16'))['db'];function respondWithStatusCode(_0x15cbd9,_0x44bfa6){_0x44bfa6=_0x44bfa6||0xcc;return function(_0x3de257){if(_0x3de257){return _0x15cbd9[_0x3483('0x17')](_0x44bfa6);}return _0x15cbd9[_0x3483('0x18')](_0x44bfa6)[_0x3483('0x19')]();};}function respondWithResult(_0x1ddf05,_0x28a634){_0x28a634=_0x28a634||0xc8;return function(_0x23dc4a){if(_0x23dc4a){return _0x1ddf05[_0x3483('0x18')](_0x28a634)['json'](_0x23dc4a);}};}function respondWithFilteredResult(_0xaa6bb,_0x1ea568){return function(_0x17977d){if(_0x17977d){var _0x917d97=typeof _0x1ea568['offset']===_0x3483('0x1a')&&typeof _0x1ea568[_0x3483('0x1b')]===_0x3483('0x1a');var _0x5e5f15=_0x17977d[_0x3483('0x1c')];var _0x9f9787=_0x917d97?0x0:_0x1ea568['offset'];var _0x1b9f71=_0x917d97?_0x17977d[_0x3483('0x1c')]:_0x1ea568['offset']+_0x1ea568[_0x3483('0x1b')];var _0x56d7a0;if(_0x1b9f71>=_0x5e5f15){_0x1b9f71=_0x5e5f15;_0x56d7a0=0xc8;}else{_0x56d7a0=0xce;}_0xaa6bb['status'](_0x56d7a0);return _0xaa6bb[_0x3483('0x1d')]('Content-Range',_0x9f9787+'-'+_0x1b9f71+'/'+_0x5e5f15)[_0x3483('0x1e')](_0x17977d);}return null;};}function patchUpdates(_0x23a996){return function(_0x5c4f99){try{jsonpatch['apply'](_0x5c4f99,_0x23a996,!![]);}catch(_0xfb559a){return BPromise[_0x3483('0x1f')](_0xfb559a);}return _0x5c4f99[_0x3483('0x20')]();};}function saveUpdates(_0xae11d5,_0x5dc29b){return function(_0x47154e){if(_0x47154e){return _0x47154e['update'](_0xae11d5)[_0x3483('0x21')](function(_0x2c8b98){return _0x2c8b98;});}return null;};}function removeEntity(_0x4a3472,_0x3b2dc4){return function(_0x5f3eae){if(_0x5f3eae){return _0x5f3eae[_0x3483('0x22')]()['then'](function(){_0x4a3472[_0x3483('0x18')](0xcc)[_0x3483('0x19')]();});}};}function handleEntityNotFound(_0x23f46f,_0x37f83d){return function(_0x3da448){if(!_0x3da448){_0x23f46f[_0x3483('0x17')](0x194);}return _0x3da448;};}function handleError(_0x2f8dc5,_0x5eb640){_0x5eb640=_0x5eb640||0x1f4;return function(_0x25ef22){logger[_0x3483('0x23')](_0x25ef22[_0x3483('0x24')]);if(_0x25ef22[_0x3483('0x25')]){delete _0x25ef22[_0x3483('0x25')];}_0x2f8dc5[_0x3483('0x18')](_0x5eb640)[_0x3483('0x26')](_0x25ef22);};}exports[_0x3483('0x27')]=function(_0x361a72,_0x5e7e3c){var _0x50bb78={},_0x16f58f={},_0x2c3544={'count':0x0,'rows':[]};var _0x5b9c58=_['map'](db[_0x3483('0x28')][_0x3483('0x29')],function(_0x2bbe67){return{'name':_0x2bbe67[_0x3483('0x2a')],'type':_0x2bbe67[_0x3483('0x2b')][_0x3483('0x2c')]};});_0x16f58f[_0x3483('0x2d')]=_['map'](_0x5b9c58,_0x3483('0x25'));_0x16f58f[_0x3483('0x2e')]=_[_0x3483('0x2f')](_0x361a72[_0x3483('0x2e')]);_0x16f58f['filters']=_[_0x3483('0x30')](_0x16f58f[_0x3483('0x2d')],_0x16f58f[_0x3483('0x2e')]);_0x50bb78['attributes']=_[_0x3483('0x30')](_0x16f58f[_0x3483('0x2d')],qs['fields'](_0x361a72[_0x3483('0x2e')]['fields']));_0x50bb78[_0x3483('0x31')]=_0x50bb78[_0x3483('0x31')][_0x3483('0x32')]?_0x50bb78[_0x3483('0x31')]:_0x16f58f[_0x3483('0x2d')];if(!_0x361a72[_0x3483('0x2e')]['hasOwnProperty']('nolimit')){_0x50bb78['limit']=qs[_0x3483('0x1b')](_0x361a72['query'][_0x3483('0x1b')]);_0x50bb78[_0x3483('0x33')]=qs[_0x3483('0x33')](_0x361a72[_0x3483('0x2e')]['offset']);}_0x50bb78[_0x3483('0x34')]=qs[_0x3483('0x35')](_0x361a72[_0x3483('0x2e')]['sort']);_0x50bb78[_0x3483('0x36')]=qs['filters'](_[_0x3483('0x37')](_0x361a72[_0x3483('0x2e')],_0x16f58f['filters']),_0x5b9c58);if(_0x361a72[_0x3483('0x2e')]['filter']){_0x50bb78[_0x3483('0x36')]=_[_0x3483('0x38')](_0x50bb78[_0x3483('0x36')],{'$or':_[_0x3483('0x39')](_0x5b9c58,function(_0x589c3e){if(_0x589c3e[_0x3483('0x2b')]!=='VIRTUAL'){var _0x46e4b7={};_0x46e4b7[_0x589c3e[_0x3483('0x25')]]={'$like':'%'+_0x361a72[_0x3483('0x2e')][_0x3483('0x3a')]+'%'};return _0x46e4b7;}})});}_0x50bb78=_[_0x3483('0x38')]({},_0x50bb78,_0x361a72[_0x3483('0x3b')]);var _0x4dfb10={'where':_0x50bb78[_0x3483('0x36')]};return db['Automation']['count'](_0x4dfb10)[_0x3483('0x21')](function(_0x27a399){_0x2c3544[_0x3483('0x1c')]=_0x27a399;if(_0x361a72[_0x3483('0x2e')][_0x3483('0x3c')]){_0x50bb78[_0x3483('0x3d')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x50bb78);})['then'](function(_0x10d1ed){_0x2c3544['rows']=_0x10d1ed;return _0x2c3544;})[_0x3483('0x21')](respondWithFilteredResult(_0x5e7e3c,_0x50bb78))[_0x3483('0x3e')](handleError(_0x5e7e3c,null));};exports['show']=function(_0x4eb609,_0x2aed33){var _0x2a036c={'raw':![],'where':{'id':_0x4eb609[_0x3483('0x3f')]['id']}},_0x853eb0={};_0x853eb0[_0x3483('0x2d')]=_['keys'](db[_0x3483('0x28')][_0x3483('0x29')]);_0x853eb0[_0x3483('0x2e')]=_[_0x3483('0x2f')](_0x4eb609[_0x3483('0x2e')]);_0x853eb0[_0x3483('0x40')]=_[_0x3483('0x30')](_0x853eb0['model'],_0x853eb0[_0x3483('0x2e')]);_0x2a036c[_0x3483('0x31')]=_[_0x3483('0x30')](_0x853eb0['model'],qs[_0x3483('0x41')](_0x4eb609[_0x3483('0x2e')][_0x3483('0x41')]));_0x2a036c[_0x3483('0x31')]=_0x2a036c[_0x3483('0x31')][_0x3483('0x32')]?_0x2a036c['attributes']:_0x853eb0[_0x3483('0x2d')];if(_0x4eb609[_0x3483('0x2e')][_0x3483('0x3c')]){_0x2a036c['include']=[{'all':!![]}];}_0x2a036c=_[_0x3483('0x38')]({},_0x2a036c,_0x4eb609['options']);return db[_0x3483('0x28')][_0x3483('0x42')](_0x2a036c)['then'](handleEntityNotFound(_0x2aed33,null))[_0x3483('0x21')](respondWithResult(_0x2aed33,null))[_0x3483('0x3e')](handleError(_0x2aed33,null));};exports[_0x3483('0x43')]=function(_0x5b793f,_0x46af15){return db['Automation'][_0x3483('0x43')](_0x5b793f[_0x3483('0x44')],{})[_0x3483('0x21')](respondWithResult(_0x46af15,0xc9))[_0x3483('0x3e')](handleError(_0x46af15,null));};exports['update']=function(_0x210500,_0x4e8084){if(_0x210500['body']['id']){delete _0x210500[_0x3483('0x44')]['id'];}return db[_0x3483('0x28')][_0x3483('0x42')]({'where':{'id':_0x210500['params']['id']}})[_0x3483('0x21')](handleEntityNotFound(_0x4e8084,null))['then'](saveUpdates(_0x210500['body'],null))['then'](respondWithResult(_0x4e8084,null))[_0x3483('0x3e')](handleError(_0x4e8084,null));};exports[_0x3483('0x22')]=function(_0xa8c8d2,_0x50b771){return db[_0x3483('0x28')]['find']({'where':{'id':_0xa8c8d2[_0x3483('0x3f')]['id']}})['then'](handleEntityNotFound(_0x50b771,null))['then'](removeEntity(_0x50b771,null))[_0x3483('0x3e')](handleError(_0x50b771,null));};exports[_0x3483('0x45')]=function(_0x4d2ba4,_0x857b28,_0x42c009){return db['Condition'][_0x3483('0x42')]({'where':{'id':_0x4d2ba4[_0x3483('0x3f')]['id']}})[_0x3483('0x21')](handleEntityNotFound(_0x857b28,null))[_0x3483('0x21')](function(_0x6a0ba3){if(_0x6a0ba3){return _0x6a0ba3[_0x3483('0x45')](_0x4d2ba4['body'][_0x3483('0x46')],_[_0x3483('0x47')](_0x4d2ba4[_0x3483('0x44')],['ids','id'])||{});}})[_0x3483('0x21')](respondWithResult(_0x857b28,null))['catch'](handleError(_0x857b28,null));};exports[_0x3483('0x48')]=function(_0x253c49,_0x43cbdf,_0x49e969){var _0x5f488b={};var _0x7340d5={};var _0x470d70;var _0x17c7ec;return db[_0x3483('0x28')][_0x3483('0x49')]({'where':{'id':_0x253c49[_0x3483('0x3f')]['id']}})[_0x3483('0x21')](handleEntityNotFound(_0x43cbdf,null))[_0x3483('0x21')](function(_0x441073){if(_0x441073){_0x470d70=_0x441073;_0x7340d5[_0x3483('0x2d')]=_[_0x3483('0x2f')](db[_0x3483('0x4a')][_0x3483('0x29')]);_0x7340d5[_0x3483('0x2e')]=_[_0x3483('0x2f')](_0x253c49[_0x3483('0x2e')]);_0x7340d5[_0x3483('0x40')]=_[_0x3483('0x30')](_0x7340d5[_0x3483('0x2d')],_0x7340d5[_0x3483('0x2e')]);_0x5f488b[_0x3483('0x31')]=_[_0x3483('0x30')](_0x7340d5[_0x3483('0x2d')],qs[_0x3483('0x41')](_0x253c49['query']['fields']));_0x5f488b[_0x3483('0x31')]=_0x5f488b['attributes'][_0x3483('0x32')]?_0x5f488b[_0x3483('0x31')]:_0x7340d5[_0x3483('0x2d')];_0x5f488b[_0x3483('0x34')]=qs[_0x3483('0x35')](_0x253c49[_0x3483('0x2e')][_0x3483('0x35')]);_0x5f488b[_0x3483('0x36')]=qs['filters'](_[_0x3483('0x37')](_0x253c49[_0x3483('0x2e')],_0x7340d5['filters']));if(_0x253c49['query'][_0x3483('0x3a')]){_0x5f488b[_0x3483('0x36')]=_[_0x3483('0x38')](_0x5f488b[_0x3483('0x36')],{'$or':_[_0x3483('0x39')](_0x5f488b[_0x3483('0x31')],function(_0x2fe58a){var _0x39e6a0={};_0x39e6a0[_0x2fe58a]={'$like':'%'+_0x253c49[_0x3483('0x2e')][_0x3483('0x3a')]+'%'};return _0x39e6a0;})});}_0x5f488b=_[_0x3483('0x38')]({},_0x5f488b,_0x253c49[_0x3483('0x3b')]);return _0x470d70['getConditions'](_0x5f488b);}})[_0x3483('0x21')](function(_0xe55349){if(_0xe55349){_0x17c7ec=_0xe55349[_0x3483('0x32')];if(!_0x253c49[_0x3483('0x2e')][_0x3483('0x4b')](_0x3483('0x4c'))){_0x5f488b['limit']=qs['limit'](_0x253c49[_0x3483('0x2e')][_0x3483('0x1b')]);_0x5f488b['offset']=qs[_0x3483('0x33')](_0x253c49[_0x3483('0x2e')][_0x3483('0x33')]);}return _0x470d70['getConditions'](_0x5f488b);}})['then'](function(_0x189091){if(_0x189091){return _0x189091?{'count':_0x17c7ec,'rows':_0x189091}:null;}})[_0x3483('0x21')](respondWithResult(_0x43cbdf,null))['catch'](handleError(_0x43cbdf,null));};exports['addActions']=function(_0x3f4713,_0x381e5b,_0x16d3ce){return db['Action'][_0x3483('0x42')]({'where':{'id':_0x3f4713['params']['id']}})[_0x3483('0x21')](handleEntityNotFound(_0x381e5b,null))['then'](function(_0x5b2f48){if(_0x5b2f48){return _0x5b2f48[_0x3483('0x4d')](_0x3f4713[_0x3483('0x44')][_0x3483('0x46')],_[_0x3483('0x47')](_0x3f4713['body'],[_0x3483('0x46'),'id'])||{});}})[_0x3483('0x21')](respondWithResult(_0x381e5b,null))['catch'](handleError(_0x381e5b,null));};exports['getActions']=function(_0x36917d,_0xf8ee9d,_0x581b27){var _0x179964={};var _0x22ec5f={};var _0x555da5;var _0x5ad5a8;return db[_0x3483('0x28')][_0x3483('0x49')]({'where':{'id':_0x36917d['params']['id']}})[_0x3483('0x21')](handleEntityNotFound(_0xf8ee9d,null))[_0x3483('0x21')](function(_0x1b6ec5){if(_0x1b6ec5){_0x555da5=_0x1b6ec5;_0x22ec5f[_0x3483('0x2d')]=_[_0x3483('0x2f')](db[_0x3483('0x4e')][_0x3483('0x29')]);_0x22ec5f[_0x3483('0x2e')]=_[_0x3483('0x2f')](_0x36917d[_0x3483('0x2e')]);_0x22ec5f[_0x3483('0x40')]=_['intersection'](_0x22ec5f[_0x3483('0x2d')],_0x22ec5f[_0x3483('0x2e')]);_0x179964['attributes']=_['intersection'](_0x22ec5f[_0x3483('0x2d')],qs['fields'](_0x36917d[_0x3483('0x2e')][_0x3483('0x41')]));_0x179964[_0x3483('0x31')]=_0x179964[_0x3483('0x31')]['length']?_0x179964[_0x3483('0x31')]:_0x22ec5f[_0x3483('0x2d')];_0x179964[_0x3483('0x34')]=qs['sort'](_0x36917d[_0x3483('0x2e')]['sort']);_0x179964['where']=qs[_0x3483('0x40')](_[_0x3483('0x37')](_0x36917d[_0x3483('0x2e')],_0x22ec5f[_0x3483('0x40')]));if(_0x36917d['query'][_0x3483('0x3a')]){_0x179964[_0x3483('0x36')]=_['merge'](_0x179964[_0x3483('0x36')],{'$or':_[_0x3483('0x39')](_0x179964[_0x3483('0x31')],function(_0x900ed4){var _0xf131da={};_0xf131da[_0x900ed4]={'$like':'%'+_0x36917d[_0x3483('0x2e')]['filter']+'%'};return _0xf131da;})});}_0x179964=_['merge']({},_0x179964,_0x36917d[_0x3483('0x3b')]);return _0x555da5[_0x3483('0x4f')](_0x179964);}})[_0x3483('0x21')](function(_0xf9cdfa){if(_0xf9cdfa){_0x5ad5a8=_0xf9cdfa[_0x3483('0x32')];if(!_0x36917d[_0x3483('0x2e')][_0x3483('0x4b')]('nolimit')){_0x179964['limit']=qs[_0x3483('0x1b')](_0x36917d[_0x3483('0x2e')]['limit']);_0x179964[_0x3483('0x33')]=qs['offset'](_0x36917d['query'][_0x3483('0x33')]);}return _0x555da5[_0x3483('0x4f')](_0x179964);}})[_0x3483('0x21')](function(_0x1de80d){if(_0x1de80d){return _0x1de80d?{'count':_0x5ad5a8,'rows':_0x1de80d}:null;}})[_0x3483('0x21')](respondWithResult(_0xf8ee9d,null))['catch'](handleError(_0xf8ee9d,null));}; \ No newline at end of file +var _0x1c1b=['limit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','Condition','ids','omit','getConditions','findOne','order','hasOwnProperty','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','status','stack','name','send','map','Automation','fieldName','type','key','keys','query','intersection','model','attributes','fields','length'];(function(_0x2797bc,_0x3617b0){var _0x24a66c=function(_0x2bc0ff){while(--_0x2bc0ff){_0x2797bc['push'](_0x2797bc['shift']());}};_0x24a66c(++_0x3617b0);}(_0x1c1b,0xc8));var _0xb1c1=function(_0x428dad,_0x7ff665){_0x428dad=_0x428dad-0x0;var _0x4d112f=_0x1c1b[_0x428dad];return _0x4d112f;};'use strict';var emlformat=require(_0xb1c1('0x0'));var rimraf=require(_0xb1c1('0x1'));var zipdir=require(_0xb1c1('0x2'));var jsonpatch=require(_0xb1c1('0x3'));var rp=require(_0xb1c1('0x4'));var moment=require(_0xb1c1('0x5'));var BPromise=require(_0xb1c1('0x6'));var Mustache=require(_0xb1c1('0x7'));var util=require(_0xb1c1('0x8'));var path=require(_0xb1c1('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1c1('0xa'));var _=require(_0xb1c1('0xb'));var squel=require(_0xb1c1('0xc'));var crypto=require(_0xb1c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb1c1('0xe'));var querystring=require(_0xb1c1('0xf'));var Papa=require('papaparse');var Redis=require(_0xb1c1('0x10'));var authService=require(_0xb1c1('0x11'));var qs=require(_0xb1c1('0x12'));var as=require(_0xb1c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1c1('0x14'))(_0xb1c1('0x15'));var utils=require(_0xb1c1('0x16'));var config=require(_0xb1c1('0x17'));var licenseUtil=require(_0xb1c1('0x18'));var db=require(_0xb1c1('0x19'))['db'];function respondWithStatusCode(_0x4e55e7,_0x2b52b5){_0x2b52b5=_0x2b52b5||0xcc;return function(_0x2fdd7e){if(_0x2fdd7e){return _0x4e55e7[_0xb1c1('0x1a')](_0x2b52b5);}return _0x4e55e7['status'](_0x2b52b5)[_0xb1c1('0x1b')]();};}function respondWithResult(_0x54397f,_0x1d1ec4){_0x1d1ec4=_0x1d1ec4||0xc8;return function(_0x419f4e){if(_0x419f4e){return _0x54397f['status'](_0x1d1ec4)[_0xb1c1('0x1c')](_0x419f4e);}};}function respondWithFilteredResult(_0x2f8c31,_0x57182c){return function(_0x3db660){if(_0x3db660){var _0x18c2f5=typeof _0x57182c[_0xb1c1('0x1d')]===_0xb1c1('0x1e')&&typeof _0x57182c['limit']===_0xb1c1('0x1e');var _0x32d539=_0x3db660[_0xb1c1('0x1f')];var _0x41b19e=_0x18c2f5?0x0:_0x57182c[_0xb1c1('0x1d')];var _0x877e79=_0x18c2f5?_0x3db660['count']:_0x57182c[_0xb1c1('0x1d')]+_0x57182c['limit'];var _0x387ee3;if(_0x877e79>=_0x32d539){_0x877e79=_0x32d539;_0x387ee3=0xc8;}else{_0x387ee3=0xce;}_0x2f8c31['status'](_0x387ee3);return _0x2f8c31[_0xb1c1('0x20')](_0xb1c1('0x21'),_0x41b19e+'-'+_0x877e79+'/'+_0x32d539)[_0xb1c1('0x1c')](_0x3db660);}return null;};}function patchUpdates(_0x9f66f1){return function(_0x3d3622){try{jsonpatch[_0xb1c1('0x22')](_0x3d3622,_0x9f66f1,!![]);}catch(_0x56cc37){return BPromise[_0xb1c1('0x23')](_0x56cc37);}return _0x3d3622[_0xb1c1('0x24')]();};}function saveUpdates(_0x29e58a,_0x272cf8){return function(_0xfee761){if(_0xfee761){return _0xfee761['update'](_0x29e58a)[_0xb1c1('0x25')](function(_0x93abcd){return _0x93abcd;});}return null;};}function removeEntity(_0x19bb60,_0x63f135){return function(_0x539b2c){if(_0x539b2c){return _0x539b2c[_0xb1c1('0x26')]()[_0xb1c1('0x25')](function(){_0x19bb60[_0xb1c1('0x27')](0xcc)[_0xb1c1('0x1b')]();});}};}function handleEntityNotFound(_0x57bf46,_0x2ca9e5){return function(_0x383b02){if(!_0x383b02){_0x57bf46[_0xb1c1('0x1a')](0x194);}return _0x383b02;};}function handleError(_0x1ddd99,_0x181f16){_0x181f16=_0x181f16||0x1f4;return function(_0x27b12a){logger['error'](_0x27b12a[_0xb1c1('0x28')]);if(_0x27b12a['name']){delete _0x27b12a[_0xb1c1('0x29')];}_0x1ddd99[_0xb1c1('0x27')](_0x181f16)[_0xb1c1('0x2a')](_0x27b12a);};}exports['index']=function(_0x38434d,_0x3687c9){var _0x287af3={},_0x1a8b93={},_0x1fd7d9={'count':0x0,'rows':[]};var _0x2d1d3a=_[_0xb1c1('0x2b')](db[_0xb1c1('0x2c')]['rawAttributes'],function(_0xb2e091){return{'name':_0xb2e091[_0xb1c1('0x2d')],'type':_0xb2e091[_0xb1c1('0x2e')][_0xb1c1('0x2f')]};});_0x1a8b93['model']=_[_0xb1c1('0x2b')](_0x2d1d3a,'name');_0x1a8b93['query']=_[_0xb1c1('0x30')](_0x38434d[_0xb1c1('0x31')]);_0x1a8b93['filters']=_[_0xb1c1('0x32')](_0x1a8b93[_0xb1c1('0x33')],_0x1a8b93[_0xb1c1('0x31')]);_0x287af3[_0xb1c1('0x34')]=_[_0xb1c1('0x32')](_0x1a8b93[_0xb1c1('0x33')],qs[_0xb1c1('0x35')](_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x35')]));_0x287af3[_0xb1c1('0x34')]=_0x287af3[_0xb1c1('0x34')][_0xb1c1('0x36')]?_0x287af3[_0xb1c1('0x34')]:_0x1a8b93[_0xb1c1('0x33')];if(!_0x38434d[_0xb1c1('0x31')]['hasOwnProperty']('nolimit')){_0x287af3[_0xb1c1('0x37')]=qs[_0xb1c1('0x37')](_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x37')]);_0x287af3[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0x38434d[_0xb1c1('0x31')]['offset']);}_0x287af3['order']=qs[_0xb1c1('0x38')](_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x38')]);_0x287af3['where']=qs[_0xb1c1('0x39')](_[_0xb1c1('0x3a')](_0x38434d[_0xb1c1('0x31')],_0x1a8b93[_0xb1c1('0x39')]),_0x2d1d3a);if(_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x3b')]){_0x287af3[_0xb1c1('0x3c')]=_[_0xb1c1('0x3d')](_0x287af3['where'],{'$or':_['map'](_0x2d1d3a,function(_0x38cb3d){if(_0x38cb3d['type']!==_0xb1c1('0x3e')){var _0x1705a4={};_0x1705a4[_0x38cb3d[_0xb1c1('0x29')]]={'$like':'%'+_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x3b')]+'%'};return _0x1705a4;}})});}_0x287af3=_['merge']({},_0x287af3,_0x38434d['options']);var _0x13f7b2={'where':_0x287af3['where']};return db[_0xb1c1('0x2c')][_0xb1c1('0x1f')](_0x13f7b2)['then'](function(_0x67ca0){_0x1fd7d9[_0xb1c1('0x1f')]=_0x67ca0;if(_0x38434d['query'][_0xb1c1('0x3f')]){_0x287af3['include']=[{'all':!![]}];}return db[_0xb1c1('0x2c')][_0xb1c1('0x40')](_0x287af3);})[_0xb1c1('0x25')](function(_0x58a484){_0x1fd7d9[_0xb1c1('0x41')]=_0x58a484;return _0x1fd7d9;})[_0xb1c1('0x25')](respondWithFilteredResult(_0x3687c9,_0x287af3))[_0xb1c1('0x42')](handleError(_0x3687c9,null));};exports[_0xb1c1('0x43')]=function(_0x2d12b1,_0x42ecc5){var _0x32fa62={'raw':![],'where':{'id':_0x2d12b1[_0xb1c1('0x44')]['id']}},_0xe6964f={};_0xe6964f[_0xb1c1('0x33')]=_[_0xb1c1('0x30')](db[_0xb1c1('0x2c')][_0xb1c1('0x45')]);_0xe6964f[_0xb1c1('0x31')]=_['keys'](_0x2d12b1['query']);_0xe6964f[_0xb1c1('0x39')]=_[_0xb1c1('0x32')](_0xe6964f['model'],_0xe6964f[_0xb1c1('0x31')]);_0x32fa62[_0xb1c1('0x34')]=_[_0xb1c1('0x32')](_0xe6964f[_0xb1c1('0x33')],qs['fields'](_0x2d12b1[_0xb1c1('0x31')][_0xb1c1('0x35')]));_0x32fa62[_0xb1c1('0x34')]=_0x32fa62['attributes'][_0xb1c1('0x36')]?_0x32fa62[_0xb1c1('0x34')]:_0xe6964f['model'];if(_0x2d12b1[_0xb1c1('0x31')][_0xb1c1('0x3f')]){_0x32fa62['include']=[{'all':!![]}];}_0x32fa62=_[_0xb1c1('0x3d')]({},_0x32fa62,_0x2d12b1[_0xb1c1('0x46')]);return db['Automation'][_0xb1c1('0x47')](_0x32fa62)[_0xb1c1('0x25')](handleEntityNotFound(_0x42ecc5,null))[_0xb1c1('0x25')](respondWithResult(_0x42ecc5,null))['catch'](handleError(_0x42ecc5,null));};exports['create']=function(_0x547016,_0x397003){return db['Automation'][_0xb1c1('0x48')](_0x547016[_0xb1c1('0x49')],{})[_0xb1c1('0x25')](respondWithResult(_0x397003,0xc9))['catch'](handleError(_0x397003,null));};exports['update']=function(_0xde9864,_0x3d57d0){if(_0xde9864[_0xb1c1('0x49')]['id']){delete _0xde9864[_0xb1c1('0x49')]['id'];}return db[_0xb1c1('0x2c')][_0xb1c1('0x47')]({'where':{'id':_0xde9864[_0xb1c1('0x44')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x3d57d0,null))[_0xb1c1('0x25')](saveUpdates(_0xde9864['body'],null))[_0xb1c1('0x25')](respondWithResult(_0x3d57d0,null))[_0xb1c1('0x42')](handleError(_0x3d57d0,null));};exports[_0xb1c1('0x26')]=function(_0x2f0b99,_0x2a58a3){return db[_0xb1c1('0x2c')]['find']({'where':{'id':_0x2f0b99[_0xb1c1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a58a3,null))['then'](removeEntity(_0x2a58a3,null))[_0xb1c1('0x42')](handleError(_0x2a58a3,null));};exports['addConditions']=function(_0x1ea308,_0x4c67a1,_0x25c1c2){return db[_0xb1c1('0x4a')][_0xb1c1('0x47')]({'where':{'id':_0x1ea308['params']['id']}})['then'](handleEntityNotFound(_0x4c67a1,null))[_0xb1c1('0x25')](function(_0x473155){if(_0x473155){return _0x473155['addConditions'](_0x1ea308[_0xb1c1('0x49')][_0xb1c1('0x4b')],_[_0xb1c1('0x4c')](_0x1ea308[_0xb1c1('0x49')],[_0xb1c1('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x4c67a1,null))[_0xb1c1('0x42')](handleError(_0x4c67a1,null));};exports[_0xb1c1('0x4d')]=function(_0x13c306,_0x35d94c,_0x4896ee){var _0x56ec58={};var _0x19f1f4={};var _0x2eedef;var _0x3d1243;return db[_0xb1c1('0x2c')][_0xb1c1('0x4e')]({'where':{'id':_0x13c306[_0xb1c1('0x44')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x35d94c,null))['then'](function(_0x4ecbc4){if(_0x4ecbc4){_0x2eedef=_0x4ecbc4;_0x19f1f4[_0xb1c1('0x33')]=_[_0xb1c1('0x30')](db['Condition'][_0xb1c1('0x45')]);_0x19f1f4[_0xb1c1('0x31')]=_[_0xb1c1('0x30')](_0x13c306[_0xb1c1('0x31')]);_0x19f1f4[_0xb1c1('0x39')]=_[_0xb1c1('0x32')](_0x19f1f4[_0xb1c1('0x33')],_0x19f1f4[_0xb1c1('0x31')]);_0x56ec58[_0xb1c1('0x34')]=_[_0xb1c1('0x32')](_0x19f1f4['model'],qs['fields'](_0x13c306['query'][_0xb1c1('0x35')]));_0x56ec58[_0xb1c1('0x34')]=_0x56ec58[_0xb1c1('0x34')][_0xb1c1('0x36')]?_0x56ec58['attributes']:_0x19f1f4[_0xb1c1('0x33')];_0x56ec58[_0xb1c1('0x4f')]=qs['sort'](_0x13c306['query']['sort']);_0x56ec58[_0xb1c1('0x3c')]=qs[_0xb1c1('0x39')](_[_0xb1c1('0x3a')](_0x13c306[_0xb1c1('0x31')],_0x19f1f4[_0xb1c1('0x39')]));if(_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x3b')]){_0x56ec58['where']=_[_0xb1c1('0x3d')](_0x56ec58['where'],{'$or':_[_0xb1c1('0x2b')](_0x56ec58[_0xb1c1('0x34')],function(_0x502b69){var _0x37edda={};_0x37edda[_0x502b69]={'$like':'%'+_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x3b')]+'%'};return _0x37edda;})});}_0x56ec58=_[_0xb1c1('0x3d')]({},_0x56ec58,_0x13c306['options']);return _0x2eedef['getConditions'](_0x56ec58);}})[_0xb1c1('0x25')](function(_0x3a9570){if(_0x3a9570){_0x3d1243=_0x3a9570[_0xb1c1('0x36')];if(!_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x50')](_0xb1c1('0x51'))){_0x56ec58[_0xb1c1('0x37')]=qs[_0xb1c1('0x37')](_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x37')]);_0x56ec58[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x1d')]);}return _0x2eedef[_0xb1c1('0x4d')](_0x56ec58);}})[_0xb1c1('0x25')](function(_0x34bba2){if(_0x34bba2){return _0x34bba2?{'count':_0x3d1243,'rows':_0x34bba2}:null;}})['then'](respondWithResult(_0x35d94c,null))[_0xb1c1('0x42')](handleError(_0x35d94c,null));};exports[_0xb1c1('0x52')]=function(_0x221284,_0x5ee748,_0x318bcb){return db[_0xb1c1('0x53')]['find']({'where':{'id':_0x221284[_0xb1c1('0x44')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x5ee748,null))[_0xb1c1('0x25')](function(_0x1d80ec){if(_0x1d80ec){return _0x1d80ec['addActions'](_0x221284[_0xb1c1('0x49')]['ids'],_[_0xb1c1('0x4c')](_0x221284[_0xb1c1('0x49')],['ids','id'])||{});}})[_0xb1c1('0x25')](respondWithResult(_0x5ee748,null))[_0xb1c1('0x42')](handleError(_0x5ee748,null));};exports[_0xb1c1('0x54')]=function(_0xb0e814,_0x397abf,_0x5c8ca6){var _0x1e91c7={};var _0x2c6605={};var _0x18acd9;var _0x1d95ec;return db['Automation'][_0xb1c1('0x4e')]({'where':{'id':_0xb0e814['params']['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x397abf,null))[_0xb1c1('0x25')](function(_0x380cf2){if(_0x380cf2){_0x18acd9=_0x380cf2;_0x2c6605[_0xb1c1('0x33')]=_[_0xb1c1('0x30')](db[_0xb1c1('0x53')][_0xb1c1('0x45')]);_0x2c6605[_0xb1c1('0x31')]=_[_0xb1c1('0x30')](_0xb0e814[_0xb1c1('0x31')]);_0x2c6605[_0xb1c1('0x39')]=_[_0xb1c1('0x32')](_0x2c6605['model'],_0x2c6605[_0xb1c1('0x31')]);_0x1e91c7[_0xb1c1('0x34')]=_[_0xb1c1('0x32')](_0x2c6605['model'],qs[_0xb1c1('0x35')](_0xb0e814[_0xb1c1('0x31')][_0xb1c1('0x35')]));_0x1e91c7['attributes']=_0x1e91c7['attributes'][_0xb1c1('0x36')]?_0x1e91c7['attributes']:_0x2c6605[_0xb1c1('0x33')];_0x1e91c7[_0xb1c1('0x4f')]=qs[_0xb1c1('0x38')](_0xb0e814['query'][_0xb1c1('0x38')]);_0x1e91c7[_0xb1c1('0x3c')]=qs['filters'](_['pick'](_0xb0e814[_0xb1c1('0x31')],_0x2c6605['filters']));if(_0xb0e814['query'][_0xb1c1('0x3b')]){_0x1e91c7['where']=_[_0xb1c1('0x3d')](_0x1e91c7[_0xb1c1('0x3c')],{'$or':_['map'](_0x1e91c7[_0xb1c1('0x34')],function(_0x7670a9){var _0xf1094f={};_0xf1094f[_0x7670a9]={'$like':'%'+_0xb0e814[_0xb1c1('0x31')]['filter']+'%'};return _0xf1094f;})});}_0x1e91c7=_['merge']({},_0x1e91c7,_0xb0e814[_0xb1c1('0x46')]);return _0x18acd9[_0xb1c1('0x54')](_0x1e91c7);}})['then'](function(_0x413d83){if(_0x413d83){_0x1d95ec=_0x413d83[_0xb1c1('0x36')];if(!_0xb0e814[_0xb1c1('0x31')][_0xb1c1('0x50')](_0xb1c1('0x51'))){_0x1e91c7[_0xb1c1('0x37')]=qs[_0xb1c1('0x37')](_0xb0e814[_0xb1c1('0x31')][_0xb1c1('0x37')]);_0x1e91c7[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0xb0e814[_0xb1c1('0x31')][_0xb1c1('0x1d')]);}return _0x18acd9[_0xb1c1('0x54')](_0x1e91c7);}})[_0xb1c1('0x25')](function(_0x23a22e){if(_0x23a22e){return _0x23a22e?{'count':_0x1d95ec,'rows':_0x23a22e}:null;}})['then'](respondWithResult(_0x397abf,null))[_0xb1c1('0x42')](handleError(_0x397abf,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c5c7135..54b1d54 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 _0xc9e0=['rimraf','../../config/environment','./automation.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5a8181,_0x926962){var _0x4326bb=function(_0x271398){while(--_0x271398){_0x5a8181['push'](_0x5a8181['shift']());}};_0x4326bb(++_0x926962);}(_0xc9e0,0x14f));var _0x0c9e=function(_0x1cbce4,_0xe099c7){_0x1cbce4=_0x1cbce4-0x0;var _0x5aea53=_0xc9e0[_0x1cbce4];return _0x5aea53;};'use strict';var _=require(_0x0c9e('0x0'));var util=require('util');var logger=require(_0x0c9e('0x1'))('api');var moment=require(_0x0c9e('0x2'));var BPromise=require(_0x0c9e('0x3'));var rp=require(_0x0c9e('0x4'));var fs=require('fs');var path=require(_0x0c9e('0x5'));var rimraf=require(_0x0c9e('0x6'));var config=require(_0x0c9e('0x7'));var attributes=require(_0x0c9e('0x8'));module[_0x0c9e('0x9')]=function(_0x3005eb,_0x19d165){return _0x3005eb[_0x0c9e('0xa')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2568=['tools_automations','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x265773,_0x5d1b6e){var _0x4ed75d=function(_0x3b7ce7){while(--_0x3b7ce7){_0x265773['push'](_0x265773['shift']());}};_0x4ed75d(++_0x5d1b6e);}(_0x2568,0xa9));var _0x8256=function(_0x2ca322,_0x37f83f){_0x2ca322=_0x2ca322-0x0;var _0x509bca=_0x2568[_0x2ca322];return _0x509bca;};'use strict';var _=require('lodash');var util=require(_0x8256('0x0'));var logger=require(_0x8256('0x1'))(_0x8256('0x2'));var moment=require(_0x8256('0x3'));var BPromise=require('bluebird');var rp=require(_0x8256('0x4'));var fs=require('fs');var path=require(_0x8256('0x5'));var rimraf=require('rimraf');var config=require(_0x8256('0x6'));var attributes=require(_0x8256('0x7'));module[_0x8256('0x8')]=function(_0x26804e,_0x36d18b){return _0x26804e[_0x8256('0x9')](_0x8256('0xa'),attributes,{'tableName':_0x8256('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 0bdab0b..91cc31a 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 _0xea28=['rpc','../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x75a08f,_0x2795c0){var _0x16688f=function(_0x16096d){while(--_0x16096d){_0x75a08f['push'](_0x75a08f['shift']());}};_0x16688f(++_0x2795c0);}(_0xea28,0x13a));var _0x8ea2=function(_0x27f503,_0x1f62b5){_0x27f503=_0x27f503-0x0;var _0x28226f=_0xea28[_0x27f503];return _0x28226f;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('Automation,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});} \ No newline at end of file +var _0xf7d9=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x52fb0c,_0x97790b){var _0x11697d=function(_0x80af74){while(--_0x80af74){_0x52fb0c['push'](_0x52fb0c['shift']());}};_0x11697d(++_0x97790b);}(_0xf7d9,0x122));var _0x9f7d=function(_0x3523c5,_0x426d73){_0x3523c5=_0x3523c5-0x0;var _0x2f1beb=_0xf7d9[_0x3523c5];return _0x2f1beb;};'use strict';var _=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var moment=require(_0x9f7d('0x2'));var BPromise=require(_0x9f7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7d('0x5'))(_0x9f7d('0x6'));var config=require(_0x9f7d('0x7'));var jayson=require(_0x9f7d('0x8'));var client=jayson[_0x9f7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc6b9,_0xf09259,_0x2333e8){return new BPromise(function(_0x218628,_0x2893a5){return client[_0x9f7d('0xa')](_0x4dc6b9,_0x2333e8)[_0x9f7d('0xb')](function(_0x5290e2){logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,'request\x20sent');logger[_0x9f7d('0xe')](_0x9f7d('0xf'),_0xf09259,_0x9f7d('0x10'),JSON['stringify'](_0x5290e2));if(_0x5290e2[_0x9f7d('0x11')]){if(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x12')]===0x1f4){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2[_0x9f7d('0x11')]['message']);return _0x2893a5(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2['error'][_0x9f7d('0x13')]);return _0x218628(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}else{logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,_0x9f7d('0x10'));_0x218628(_0x5290e2[_0x9f7d('0x14')]['message']);}})['catch'](function(_0x402609){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x402609);_0x2893a5(_0x402609);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ceb44ab..d4d0289 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 _0x45d1=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','getConditions','post','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports','multer'];(function(_0x41cf18,_0x2cc769){var _0x251cd4=function(_0x1aebeb){while(--_0x1aebeb){_0x41cf18['push'](_0x41cf18['shift']());}};_0x251cd4(++_0x2cc769);}(_0x45d1,0x1cb));var _0x145d=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x45d1[_0x158da6];return _0x429c30;};'use strict';var multer=require(_0x145d('0x0'));var util=require(_0x145d('0x1'));var path=require('path');var timeout=require(_0x145d('0x2'));var express=require(_0x145d('0x3'));var router=express['Router']();var fs_extra=require(_0x145d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x145d('0x5'));var config=require(_0x145d('0x6'));var controller=require(_0x145d('0x7'));router[_0x145d('0x8')]('/',auth[_0x145d('0x9')](),controller[_0x145d('0xa')]);router[_0x145d('0x8')](_0x145d('0xb'),auth[_0x145d('0x9')](),controller['show']);router['get']('/:id/conditions',auth[_0x145d('0x9')](),controller[_0x145d('0xc')]);router[_0x145d('0x8')]('/:id/actions',auth[_0x145d('0x9')](),controller['getActions']);router[_0x145d('0xd')]('/',auth[_0x145d('0x9')](),controller[_0x145d('0xe')]);router[_0x145d('0xd')]('/:id/conditions',auth[_0x145d('0x9')](),controller[_0x145d('0xf')]);router['post'](_0x145d('0x10'),auth[_0x145d('0x9')](),controller[_0x145d('0x11')]);router[_0x145d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x145d('0x13')]);router[_0x145d('0x14')](_0x145d('0xb'),auth['isAuthenticated'](),controller[_0x145d('0x15')]);module[_0x145d('0x16')]=router; \ No newline at end of file +var _0x5044=['../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getActions','post','create','addConditions','/:id/actions','addActions','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ee5d1,_0x873e57){var _0x18bc14=function(_0xba1b9b){while(--_0xba1b9b){_0x4ee5d1['push'](_0x4ee5d1['shift']());}};_0x18bc14(++_0x873e57);}(_0x5044,0xc8));var _0x4504=function(_0x32032a,_0x24e8d1){_0x32032a=_0x32032a-0x0;var _0x5d5792=_0x5044[_0x32032a];return _0x5d5792;};'use strict';var multer=require('multer');var util=require(_0x4504('0x0'));var path=require('path');var timeout=require(_0x4504('0x1'));var express=require(_0x4504('0x2'));var router=express[_0x4504('0x3')]();var fs_extra=require(_0x4504('0x4'));var auth=require(_0x4504('0x5'));var interaction=require(_0x4504('0x6'));var config=require(_0x4504('0x7'));var controller=require(_0x4504('0x8'));router['get']('/',auth[_0x4504('0x9')](),controller[_0x4504('0xa')]);router[_0x4504('0xb')](_0x4504('0xc'),auth[_0x4504('0x9')](),controller[_0x4504('0xd')]);router[_0x4504('0xb')](_0x4504('0xe'),auth[_0x4504('0x9')](),controller['getConditions']);router[_0x4504('0xb')]('/:id/actions',auth[_0x4504('0x9')](),controller[_0x4504('0xf')]);router[_0x4504('0x10')]('/',auth[_0x4504('0x9')](),controller[_0x4504('0x11')]);router[_0x4504('0x10')](_0x4504('0xe'),auth[_0x4504('0x9')](),controller[_0x4504('0x12')]);router[_0x4504('0x10')](_0x4504('0x13'),auth[_0x4504('0x9')](),controller[_0x4504('0x14')]);router['put'](_0x4504('0xc'),auth[_0x4504('0x9')](),controller['update']);router[_0x4504('0x15')](_0x4504('0xc'),auth[_0x4504('0x9')](),controller[_0x4504('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4278df3..974af81 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 _0x18ec=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','always','Active/Disactive\x20AMD','#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','ENUM','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x18ec,0x6c));var _0xc18e=function(_0xbb4285,_0x334a04){_0xbb4285=_0xbb4285-0x0;var _0x38149d=_0x18ec[_0xbb4285];return _0x38149d;};'use strict';var Sequelize=require(_0xc18e('0x0'));module[_0xc18e('0x1')]={'name':{'type':Sequelize[_0xc18e('0x2')],'unique':_0xc18e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xc18e('0x4')),'allowNull':![],'defaultValue':_0xc18e('0x4')},'description':{'type':Sequelize[_0xc18e('0x2')]},'active':{'type':Sequelize[_0xc18e('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xc18e('0x6')](0x4)[_0xc18e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc18e('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc18e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc18e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc18e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc18e('0x6')](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc18e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc18e('0xd')},'dialTimezone':{'type':Sequelize[_0xc18e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc18e('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xc18e('0xe'),'onlyIfOpen'),'defaultValue':_0xc18e('0xf')},'dialAMDActive':{'type':Sequelize[_0xc18e('0x5')],'defaultValue':0x0,'comment':_0xc18e('0x10')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc18e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc18e('0x6')](0x9)[_0xc18e('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc18e('0x6')](0x9)[_0xc18e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc18e('0x11')},'dialAMDMinWordLength':{'type':Sequelize[_0xc18e('0x6')](0x9)[_0xc18e('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc18e('0x12')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc18e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc18e('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc18e('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc18e('0x6')](0x5)[_0xc18e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc18e('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc18e('0x6')](0x9)[_0xc18e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc18e('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc18e('0x17')]('DESC',_0xc18e('0x18')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xc18e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc18e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc18e('0x19')},'dialCutDigit':{'type':Sequelize[_0xc18e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc18e('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc18e('0x6')](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0x1c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc18e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0xc18e('0x6')](0x3)[_0xc18e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc18e('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc18e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc18e('0x22')}}; \ No newline at end of file +var _0x5324=['ENUM','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\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,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x2a13f3,_0x38636a){var _0x8987ac=function(_0x4e9eef){while(--_0x4e9eef){_0x2a13f3['push'](_0x2a13f3['shift']());}};_0x8987ac(++_0x38636a);}(_0x5324,0x154));var _0x4532=function(_0x3e6f29,_0x4dda33){_0x3e6f29=_0x3e6f29-0x0;var _0xd8dd25=_0x5324[_0x3e6f29];return _0xd8dd25;};'use strict';var Sequelize=require(_0x4532('0x0'));module[_0x4532('0x1')]={'name':{'type':Sequelize[_0x4532('0x2')],'unique':_0x4532('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x4532('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x4532('0x2')]},'active':{'type':Sequelize[_0x4532('0x5')],'defaultValue':0x0,'comment':_0x4532('0x6')},'limitCalls':{'type':Sequelize[_0x4532('0x7')](0x4)[_0x4532('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4532('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4532('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4532('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4532('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x4532('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4532('0x10')},'dialTimezone':{'type':Sequelize[_0x4532('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4532('0x2')],'defaultValue':_0x4532('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x4532('0x12')),'defaultValue':_0x4532('0x13')},'dialAMDActive':{'type':Sequelize[_0x4532('0x5')],'defaultValue':0x0,'comment':_0x4532('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4532('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4532('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x4532('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4532('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4532('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4532('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4532('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4532('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4532('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4532('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4532('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4532('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4532('0x1d')](_0x4532('0x1e'),'ASC'),'defaultValue':_0x4532('0x1e')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4532('0x1f')},'dialCutDigit':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4532('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 648d105..348c385 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 _0x58d6=['NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','ListId\x20=\x20?','fromQuery','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','omit','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','length','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','body','IvrCampaigns','update','findOne','CmHopper','findAll','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','scheduledAt','ContactId','ListId','select','field','phone'];(function(_0x3d5fc8,_0x3503d7){var _0xec8c82=function(_0x43bc49){while(--_0x43bc49){_0x3d5fc8['push'](_0x3d5fc8['shift']());}};_0xec8c82(++_0x3503d7);}(_0x58d6,0x1d3));var _0x658d=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x58d6[_0x179c4a];return _0x5d1879;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x658d('0x0'));var zipdir=require(_0x658d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x658d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x658d('0x3'));var util=require(_0x658d('0x4'));var path=require(_0x658d('0x5'));var sox=require(_0x658d('0x6'));var csv=require('to-csv');var ejs=require(_0x658d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x658d('0x8'));var squel=require(_0x658d('0x9'));var crypto=require(_0x658d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x658d('0xb'));var toCsv=require(_0x658d('0xc'));var querystring=require(_0x658d('0xd'));var Papa=require('papaparse');var Redis=require(_0x658d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x658d('0xf'));var as=require(_0x658d('0x10'));var hardwareService=require(_0x658d('0x11'));var logger=require('../../config/logger')(_0x658d('0x12'));var utils=require(_0x658d('0x13'));var config=require(_0x658d('0x14'));var licenseUtil=require(_0x658d('0x15'));var db=require(_0x658d('0x16'))['db'];function respondWithStatusCode(_0x2a266b,_0x9efc8c){_0x9efc8c=_0x9efc8c||0xcc;return function(_0x51295b){if(_0x51295b){return _0x2a266b[_0x658d('0x17')](_0x9efc8c);}return _0x2a266b[_0x658d('0x18')](_0x9efc8c)[_0x658d('0x19')]();};}function respondWithResult(_0x47360e,_0x43de3d){_0x43de3d=_0x43de3d||0xc8;return function(_0x28a2d0){if(_0x28a2d0){return _0x47360e[_0x658d('0x18')](_0x43de3d)[_0x658d('0x1a')](_0x28a2d0);}};}function respondWithFilteredResult(_0x303606,_0x17b20f){return function(_0x284431){if(_0x284431){var _0x42aae9=typeof _0x17b20f[_0x658d('0x1b')]==='undefined'&&typeof _0x17b20f[_0x658d('0x1c')]===_0x658d('0x1d');var _0x3031b4=_0x284431[_0x658d('0x1e')];var _0x8bcf62=_0x42aae9?0x0:_0x17b20f[_0x658d('0x1b')];var _0x13aa47=_0x42aae9?_0x284431[_0x658d('0x1e')]:_0x17b20f[_0x658d('0x1b')]+_0x17b20f['limit'];var _0x544b7c;if(_0x13aa47>=_0x3031b4){_0x13aa47=_0x3031b4;_0x544b7c=0xc8;}else{_0x544b7c=0xce;}_0x303606[_0x658d('0x18')](_0x544b7c);return _0x303606[_0x658d('0x1f')](_0x658d('0x20'),_0x8bcf62+'-'+_0x13aa47+'/'+_0x3031b4)[_0x658d('0x1a')](_0x284431);}return null;};}function patchUpdates(_0x2f1335){return function(_0x1c0271){try{jsonpatch[_0x658d('0x21')](_0x1c0271,_0x2f1335,!![]);}catch(_0x641d4){return BPromise[_0x658d('0x22')](_0x641d4);}return _0x1c0271['save']();};}function saveUpdates(_0x559e74,_0x408996){return function(_0x3ac068){if(_0x3ac068){return _0x3ac068['update'](_0x559e74)[_0x658d('0x23')](function(_0x13cbc3){return _0x13cbc3;});}return null;};}function removeEntity(_0x3e95f5,_0x56dd20){return function(_0x4f9418){if(_0x4f9418){return _0x4f9418[_0x658d('0x24')]()[_0x658d('0x23')](function(){var _0x556ce9=_0x4f9418[_0x658d('0x25')]({'plain':!![]});var _0x41f238='IvrCampaigns';return db[_0x658d('0x26')][_0x658d('0x24')]({'where':{'type':_0x41f238,'resourceId':_0x556ce9['id']}})[_0x658d('0x23')](function(){return _0x4f9418;});})['then'](function(){_0x3e95f5[_0x658d('0x18')](0xcc)[_0x658d('0x19')]();});}};}function handleEntityNotFound(_0x12fce9,_0x18a265){return function(_0xb2f751){if(!_0xb2f751){_0x12fce9[_0x658d('0x17')](0x194);}return _0xb2f751;};}function handleError(_0x1924aa,_0x819481){_0x819481=_0x819481||0x1f4;return function(_0x918588){logger[_0x658d('0x27')](_0x918588[_0x658d('0x28')]);if(_0x918588[_0x658d('0x29')]){delete _0x918588['name'];}_0x1924aa[_0x658d('0x18')](_0x819481)[_0x658d('0x2a')](_0x918588);};}exports['index']=function(_0x11c191,_0xda355b){var _0x17db1a={},_0x1e189b={},_0xc62d8={'count':0x0,'rows':[]};var _0x9d8b62=_[_0x658d('0x2b')](db[_0x658d('0x2c')][_0x658d('0x2d')],function(_0x4b4f73){return{'name':_0x4b4f73[_0x658d('0x2e')],'type':_0x4b4f73['type'][_0x658d('0x2f')]};});_0x1e189b[_0x658d('0x30')]=_[_0x658d('0x2b')](_0x9d8b62,_0x658d('0x29'));_0x1e189b[_0x658d('0x31')]=_[_0x658d('0x32')](_0x11c191[_0x658d('0x31')]);_0x1e189b[_0x658d('0x33')]=_[_0x658d('0x34')](_0x1e189b[_0x658d('0x30')],_0x1e189b[_0x658d('0x31')]);_0x17db1a[_0x658d('0x35')]=_[_0x658d('0x34')](_0x1e189b[_0x658d('0x30')],qs[_0x658d('0x36')](_0x11c191[_0x658d('0x31')]['fields']));_0x17db1a['attributes']=_0x17db1a[_0x658d('0x35')]['length']?_0x17db1a[_0x658d('0x35')]:_0x1e189b[_0x658d('0x30')];if(!_0x11c191[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x17db1a[_0x658d('0x1c')]=qs[_0x658d('0x1c')](_0x11c191[_0x658d('0x31')][_0x658d('0x1c')]);_0x17db1a['offset']=qs['offset'](_0x11c191[_0x658d('0x31')][_0x658d('0x1b')]);}_0x17db1a[_0x658d('0x39')]=qs[_0x658d('0x3a')](_0x11c191[_0x658d('0x31')][_0x658d('0x3a')]);_0x17db1a[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x11c191[_0x658d('0x31')],_0x1e189b[_0x658d('0x33')]),_0x9d8b62);if(_0x11c191['query'][_0x658d('0x3d')]){_0x17db1a[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x17db1a[_0x658d('0x3b')],{'$or':_[_0x658d('0x2b')](_0x9d8b62,function(_0x295387){if(_0x295387[_0x658d('0x3f')]!==_0x658d('0x40')){var _0x337afd={};_0x337afd[_0x295387['name']]={'$like':'%'+_0x11c191[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x337afd;}})});}_0x17db1a=_[_0x658d('0x3e')]({},_0x17db1a,_0x11c191[_0x658d('0x41')]);var _0x3e8698={'where':_0x17db1a[_0x658d('0x3b')]};return db[_0x658d('0x2c')]['count'](_0x3e8698)[_0x658d('0x23')](function(_0xdd974f){_0xc62d8[_0x658d('0x1e')]=_0xdd974f;if(_0x11c191[_0x658d('0x31')][_0x658d('0x42')]){_0x17db1a['include']=[{'all':!![]}];}return db[_0x658d('0x2c')]['findAll'](_0x17db1a);})['then'](function(_0xce7485){_0xc62d8[_0x658d('0x43')]=_0xce7485;return _0xc62d8;})[_0x658d('0x23')](respondWithFilteredResult(_0xda355b,_0x17db1a))['catch'](handleError(_0xda355b,null));};exports[_0x658d('0x44')]=function(_0x55b50f,_0xc28287){var _0x2a340c={'raw':![],'where':{'id':_0x55b50f['params']['id']}},_0x316c0f={};_0x316c0f[_0x658d('0x30')]=_['keys'](db[_0x658d('0x2c')][_0x658d('0x2d')]);_0x316c0f[_0x658d('0x31')]=_[_0x658d('0x32')](_0x55b50f['query']);_0x316c0f[_0x658d('0x33')]=_['intersection'](_0x316c0f[_0x658d('0x30')],_0x316c0f[_0x658d('0x31')]);_0x2a340c['attributes']=_['intersection'](_0x316c0f[_0x658d('0x30')],qs[_0x658d('0x36')](_0x55b50f['query'][_0x658d('0x36')]));_0x2a340c[_0x658d('0x35')]=_0x2a340c[_0x658d('0x35')][_0x658d('0x45')]?_0x2a340c['attributes']:_0x316c0f['model'];if(_0x55b50f[_0x658d('0x31')][_0x658d('0x42')]){_0x2a340c[_0x658d('0x46')]=[{'all':!![]}];}_0x2a340c=_[_0x658d('0x3e')]({},_0x2a340c,_0x55b50f[_0x658d('0x41')]);return db[_0x658d('0x2c')]['find'](_0x2a340c)['then'](handleEntityNotFound(_0xc28287,null))[_0x658d('0x23')](respondWithResult(_0xc28287,null))[_0x658d('0x47')](handleError(_0xc28287,null));};exports['create']=function(_0xd1f6e9,_0x3e4fc1){return db[_0x658d('0x2c')][_0x658d('0x48')](_0xd1f6e9['body'],{})['then'](function(_0xa188d1){var _0x279443=_0xd1f6e9[_0x658d('0x49')][_0x658d('0x25')]({'plain':!![]});if(!_0x279443)throw new Error(_0x658d('0x4a'));if(_0x279443[_0x658d('0x4b')]===_0x658d('0x49')){var _0x3a114c=_0xa188d1['get']({'plain':!![]});var _0x1b30b8='IvrCampaigns';return db[_0x658d('0x4c')][_0x658d('0x4d')]({'where':{'name':_0x1b30b8,'userProfileId':_0x279443[_0x658d('0x4e')]},'raw':!![]})[_0x658d('0x23')](function(_0x24cf3f){if(_0x24cf3f&&_0x24cf3f[_0x658d('0x4f')]===0x0){return db[_0x658d('0x26')][_0x658d('0x48')]({'name':_0x3a114c[_0x658d('0x29')],'resourceId':_0x3a114c['id'],'type':_0x24cf3f[_0x658d('0x29')],'sectionId':_0x24cf3f['id']},{})[_0x658d('0x23')](function(){return _0xa188d1;});}else{return _0xa188d1;}})['catch'](function(_0x5ec0d0){logger[_0x658d('0x27')](_0x658d('0x50'),_0x5ec0d0);throw _0x5ec0d0;});}return _0xa188d1;})['then'](respondWithResult(_0x3e4fc1,0xc9))[_0x658d('0x47')](handleError(_0x3e4fc1,null));};exports['clone']=function(_0x49106b,_0x2ad993){var _0x63457d={'where':{'id':_0x49106b[_0x658d('0x51')]['id']}},_0x283d7f={};_0x283d7f[_0x658d('0x30')]=_[_0x658d('0x32')](db[_0x658d('0x2c')][_0x658d('0x2d')]);_0x63457d[_0x658d('0x35')]=_[_0x658d('0x34')](_0x283d7f[_0x658d('0x30')],qs[_0x658d('0x36')](_0x49106b[_0x658d('0x31')][_0x658d('0x36')]));_0x63457d[_0x658d('0x35')]=_0x63457d[_0x658d('0x35')][_0x658d('0x45')]?_0x63457d[_0x658d('0x35')]:_0x283d7f[_0x658d('0x30')];if(_0x49106b[_0x658d('0x31')][_0x658d('0x42')]){_0x63457d[_0x658d('0x46')]=[{'all':!![]}];}_0x63457d=_[_0x658d('0x3e')]({},_0x63457d,_0x49106b[_0x658d('0x41')]);return db[_0x658d('0x2c')]['find'](_0x63457d)['then'](handleEntityNotFound(_0x2ad993,null))[_0x658d('0x23')](function(_0x30d8b9){if(_0x30d8b9){var _0x4fb904=_0x30d8b9[_0x658d('0x25')]({'plain':!![]});_0x4fb904=qs['omit'](_0x4fb904,['id',_0x658d('0x52'),_0x658d('0x53')]);_0x49106b['body']=_['omit'](_0x49106b[_0x658d('0x54')],['id',_0x658d('0x52'),_0x658d('0x53')]);return db['Campaign'][_0x658d('0x48')](_[_0x658d('0x3e')](_0x4fb904,_0x49106b[_0x658d('0x54')]),{'include':_0x49106b['query'][_0x658d('0x42')]?[{'all':!![]}]:undefined})[_0x658d('0x23')](function(_0x579ee2){var _0x16e70a=_0x49106b[_0x658d('0x49')]['get']({'plain':!![]});if(!_0x16e70a)throw new Error(_0x658d('0x4a'));if(_0x16e70a['role']===_0x658d('0x49')){var _0x7c51dd=_0x579ee2[_0x658d('0x25')]({'plain':!![]});var _0x47152a=_0x658d('0x55');return db['UserProfileSection'][_0x658d('0x4d')]({'where':{'name':_0x47152a,'userProfileId':_0x16e70a[_0x658d('0x4e')]},'raw':!![]})[_0x658d('0x23')](function(_0x4715e0){if(_0x4715e0&&_0x4715e0[_0x658d('0x4f')]===0x0){return db[_0x658d('0x26')][_0x658d('0x48')]({'name':_0x7c51dd['name'],'resourceId':_0x7c51dd['id'],'type':_0x4715e0['name'],'sectionId':_0x4715e0['id']},{})['then'](function(){return _0x579ee2;});}else{return _0x579ee2;}})[_0x658d('0x47')](function(_0xf18e7f){logger[_0x658d('0x27')](_0x658d('0x50'),_0xf18e7f);throw _0xf18e7f;});}return _0x579ee2;});}})[_0x658d('0x23')](respondWithResult(_0x2ad993,0xc9))[_0x658d('0x47')](handleError(_0x2ad993,null));};exports[_0x658d('0x56')]=function(_0x1b15af,_0x273aa7){if(_0x1b15af[_0x658d('0x54')]['id']){delete _0x1b15af[_0x658d('0x54')]['id'];}return db[_0x658d('0x2c')][_0x658d('0x4d')]({'where':{'id':_0x1b15af[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x273aa7,null))['then'](saveUpdates(_0x1b15af[_0x658d('0x54')],null))[_0x658d('0x23')](respondWithResult(_0x273aa7,null))[_0x658d('0x47')](handleError(_0x273aa7,null));};exports['destroy']=function(_0x3c226f,_0x430a95){return db[_0x658d('0x2c')][_0x658d('0x4d')]({'where':{'id':_0x3c226f[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x430a95,null))[_0x658d('0x23')](removeEntity(_0x430a95,null))[_0x658d('0x47')](handleError(_0x430a95,null));};exports['getHoppers']=function(_0x5d835a,_0x5c844c,_0x564078){var _0x38fdef={'raw':!![],'where':{}};var _0x265dbc={};var _0x2b5295={'count':0x0,'rows':[]};return db[_0x658d('0x2c')][_0x658d('0x57')]({'where':{'id':_0x5d835a[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x5c844c,null))[_0x658d('0x23')](function(_0x1547f8){if(_0x1547f8){_0x265dbc[_0x658d('0x30')]=_[_0x658d('0x32')](db['CmHopper'][_0x658d('0x2d')]);_0x265dbc[_0x658d('0x31')]=_[_0x658d('0x32')](_0x5d835a[_0x658d('0x31')]);_0x265dbc[_0x658d('0x33')]=_[_0x658d('0x34')](_0x265dbc['model'],_0x265dbc['query']);_0x38fdef[_0x658d('0x35')]=_[_0x658d('0x34')](_0x265dbc[_0x658d('0x30')],qs[_0x658d('0x36')](_0x5d835a[_0x658d('0x31')]['fields']));_0x38fdef[_0x658d('0x35')]=_0x38fdef[_0x658d('0x35')]['length']?_0x38fdef['attributes']:_0x265dbc[_0x658d('0x30')];if(!_0x5d835a[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x38fdef[_0x658d('0x1c')]=qs['limit'](_0x5d835a[_0x658d('0x31')][_0x658d('0x1c')]);_0x38fdef[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0x5d835a[_0x658d('0x31')][_0x658d('0x1b')]);}_0x38fdef[_0x658d('0x39')]=qs['sort'](_0x5d835a['query'][_0x658d('0x3a')]);_0x38fdef[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x5d835a[_0x658d('0x31')],_0x265dbc[_0x658d('0x33')]));_0x38fdef[_0x658d('0x3b')]['CampaignId']=_0x1547f8['id'];if(_0x5d835a[_0x658d('0x31')]['filter']){_0x38fdef[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x38fdef[_0x658d('0x3b')],{'$or':_[_0x658d('0x2b')](_0x38fdef[_0x658d('0x35')],function(_0x37d605){var _0x402722={};_0x402722[_0x37d605]={'$like':'%'+_0x5d835a[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x402722;})});}_0x38fdef=_['merge']({},_0x38fdef,_0x5d835a[_0x658d('0x41')]);return db['CmHopper']['count']({'where':_0x38fdef[_0x658d('0x3b')]})[_0x658d('0x23')](function(_0x5f36cf){_0x2b5295[_0x658d('0x1e')]=_0x5f36cf;if(_0x5d835a['query'][_0x658d('0x42')]){_0x38fdef[_0x658d('0x46')]=[{'all':!![]}];}return db[_0x658d('0x58')][_0x658d('0x59')](_0x38fdef);})[_0x658d('0x23')](function(_0x38cc3b){_0x2b5295[_0x658d('0x43')]=_0x38cc3b;return _0x2b5295;});}})[_0x658d('0x23')](respondWithFilteredResult(_0x5c844c,_0x38fdef))[_0x658d('0x47')](handleError(_0x5c844c,null));};exports['getHopperHistories']=function(_0x210fee,_0x14f77e,_0xddcc7a){var _0x10cab6={'raw':!![],'where':{}};var _0x18a1ba={};var _0x28a5f8={'count':0x0,'rows':[]};return db[_0x658d('0x2c')][_0x658d('0x57')]({'where':{'id':_0x210fee[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x14f77e,null))['then'](function(_0x5eaa6c){if(_0x5eaa6c){_0x18a1ba[_0x658d('0x30')]=_[_0x658d('0x32')](db['CmHopperHistory'][_0x658d('0x2d')]);_0x18a1ba[_0x658d('0x31')]=_['keys'](_0x210fee[_0x658d('0x31')]);_0x18a1ba[_0x658d('0x33')]=_[_0x658d('0x34')](_0x18a1ba[_0x658d('0x30')],_0x18a1ba['query']);_0x10cab6['attributes']=_[_0x658d('0x34')](_0x18a1ba[_0x658d('0x30')],qs[_0x658d('0x36')](_0x210fee[_0x658d('0x31')]['fields']));_0x10cab6[_0x658d('0x35')]=_0x10cab6['attributes'][_0x658d('0x45')]?_0x10cab6[_0x658d('0x35')]:_0x18a1ba[_0x658d('0x30')];if(!_0x210fee[_0x658d('0x31')]['hasOwnProperty'](_0x658d('0x38'))){_0x10cab6[_0x658d('0x1c')]=qs[_0x658d('0x1c')](_0x210fee[_0x658d('0x31')][_0x658d('0x1c')]);_0x10cab6[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0x210fee[_0x658d('0x31')][_0x658d('0x1b')]);}_0x10cab6[_0x658d('0x39')]=qs[_0x658d('0x3a')](_0x210fee[_0x658d('0x31')][_0x658d('0x3a')]);_0x10cab6[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x210fee['query'],_0x18a1ba['filters']));_0x10cab6[_0x658d('0x3b')][_0x658d('0x5a')]=_0x5eaa6c['id'];if(_0x210fee[_0x658d('0x31')][_0x658d('0x3d')]){_0x10cab6[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x10cab6[_0x658d('0x3b')],{'$or':_[_0x658d('0x2b')](_0x10cab6[_0x658d('0x35')],function(_0x11444c){var _0x348f8b={};_0x348f8b[_0x11444c]={'$like':'%'+_0x210fee[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x348f8b;})});}_0x10cab6=_[_0x658d('0x3e')]({},_0x10cab6,_0x210fee['options']);return db[_0x658d('0x5b')][_0x658d('0x1e')]({'where':_0x10cab6['where']})[_0x658d('0x23')](function(_0x5866d5){_0x28a5f8[_0x658d('0x1e')]=_0x5866d5;if(_0x210fee['query'][_0x658d('0x42')]){_0x10cab6['include']=[{'all':!![]}];}return db[_0x658d('0x5b')][_0x658d('0x59')](_0x10cab6);})[_0x658d('0x23')](function(_0x12de37){_0x28a5f8[_0x658d('0x43')]=_0x12de37;return _0x28a5f8;});}})[_0x658d('0x23')](respondWithFilteredResult(_0x14f77e,_0x10cab6))[_0x658d('0x47')](handleError(_0x14f77e,null));};exports[_0x658d('0x5c')]=function(_0x3103c7,_0x9caad5,_0x167468){var _0x22cbe7={'raw':!![],'where':{}};var _0x153ef0={};var _0x4f285c={'count':0x0,'rows':[]};return db[_0x658d('0x2c')][_0x658d('0x57')]({'where':{'id':_0x3103c7[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x9caad5,null))[_0x658d('0x23')](function(_0x308a55){if(_0x308a55){_0x153ef0[_0x658d('0x30')]=_[_0x658d('0x32')](db[_0x658d('0x5d')][_0x658d('0x2d')]);_0x153ef0['query']=_[_0x658d('0x32')](_0x3103c7[_0x658d('0x31')]);_0x153ef0['filters']=_[_0x658d('0x34')](_0x153ef0[_0x658d('0x30')],_0x153ef0[_0x658d('0x31')]);_0x22cbe7['attributes']=_[_0x658d('0x34')](_0x153ef0[_0x658d('0x30')],qs[_0x658d('0x36')](_0x3103c7[_0x658d('0x31')][_0x658d('0x36')]));_0x22cbe7[_0x658d('0x35')]=_0x22cbe7[_0x658d('0x35')]['length']?_0x22cbe7[_0x658d('0x35')]:_0x153ef0[_0x658d('0x30')];if(!_0x3103c7[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x22cbe7['limit']=qs[_0x658d('0x1c')](_0x3103c7[_0x658d('0x31')][_0x658d('0x1c')]);_0x22cbe7['offset']=qs[_0x658d('0x1b')](_0x3103c7[_0x658d('0x31')]['offset']);}_0x22cbe7['order']=qs[_0x658d('0x3a')](_0x3103c7['query'][_0x658d('0x3a')]);_0x22cbe7['where']=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x3103c7[_0x658d('0x31')],_0x153ef0[_0x658d('0x33')]));_0x22cbe7[_0x658d('0x3b')]['CampaignId']=_0x308a55['id'];if(_0x3103c7['query'][_0x658d('0x3d')]){_0x22cbe7[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x22cbe7['where'],{'$or':_[_0x658d('0x2b')](_0x22cbe7[_0x658d('0x35')],function(_0x2611fb){var _0x5f4a59={};_0x5f4a59[_0x2611fb]={'$like':'%'+_0x3103c7[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x5f4a59;})});}_0x22cbe7=_[_0x658d('0x3e')]({},_0x22cbe7,_0x3103c7[_0x658d('0x41')]);return db[_0x658d('0x5d')]['count']({'where':_0x22cbe7['where']})[_0x658d('0x23')](function(_0x45ec08){_0x4f285c['count']=_0x45ec08;if(_0x3103c7[_0x658d('0x31')][_0x658d('0x42')]){_0x22cbe7[_0x658d('0x46')]=[{'all':!![]}];}return db[_0x658d('0x5d')][_0x658d('0x59')](_0x22cbe7);})['then'](function(_0xaf1039){_0x4f285c[_0x658d('0x43')]=_0xaf1039;return _0x4f285c;});}})[_0x658d('0x23')](respondWithFilteredResult(_0x9caad5,_0x22cbe7))[_0x658d('0x47')](handleError(_0x9caad5,null));};exports[_0x658d('0x5e')]=function(_0xf4d662,_0xca591d,_0x5b0627){var _0x4a4956={'raw':!![],'where':{}};var _0x12990d={};var _0x445e01={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xf4d662['params']['id']}})[_0x658d('0x23')](handleEntityNotFound(_0xca591d,null))['then'](function(_0x15da2e){if(_0x15da2e){_0x12990d[_0x658d('0x30')]=_[_0x658d('0x32')](db['CmHopperBlack']['rawAttributes']);_0x12990d[_0x658d('0x31')]=_[_0x658d('0x32')](_0xf4d662['query']);_0x12990d['filters']=_['intersection'](_0x12990d[_0x658d('0x30')],_0x12990d[_0x658d('0x31')]);_0x4a4956[_0x658d('0x35')]=_['intersection'](_0x12990d[_0x658d('0x30')],qs['fields'](_0xf4d662[_0x658d('0x31')][_0x658d('0x36')]));_0x4a4956[_0x658d('0x35')]=_0x4a4956['attributes'][_0x658d('0x45')]?_0x4a4956[_0x658d('0x35')]:_0x12990d[_0x658d('0x30')];if(!_0xf4d662[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x4a4956[_0x658d('0x1c')]=qs[_0x658d('0x1c')](_0xf4d662[_0x658d('0x31')][_0x658d('0x1c')]);_0x4a4956[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0xf4d662[_0x658d('0x31')]['offset']);}_0x4a4956['order']=qs[_0x658d('0x3a')](_0xf4d662['query'][_0x658d('0x3a')]);_0x4a4956[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0xf4d662[_0x658d('0x31')],_0x12990d[_0x658d('0x33')]));_0x4a4956[_0x658d('0x3b')][_0x658d('0x5a')]=_0x15da2e['id'];if(_0xf4d662[_0x658d('0x31')][_0x658d('0x3d')]){_0x4a4956[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x4a4956[_0x658d('0x3b')],{'$or':_['map'](_0x4a4956[_0x658d('0x35')],function(_0x11a2d3){var _0x10b453={};_0x10b453[_0x11a2d3]={'$like':'%'+_0xf4d662[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x10b453;})});}_0x4a4956=_[_0x658d('0x3e')]({},_0x4a4956,_0xf4d662[_0x658d('0x41')]);return db[_0x658d('0x5f')][_0x658d('0x1e')]({'where':_0x4a4956['where']})[_0x658d('0x23')](function(_0xd17d6d){_0x445e01[_0x658d('0x1e')]=_0xd17d6d;if(_0xf4d662[_0x658d('0x31')][_0x658d('0x42')]){_0x4a4956[_0x658d('0x46')]=[{'all':!![]}];}return db[_0x658d('0x5f')][_0x658d('0x59')](_0x4a4956);})['then'](function(_0x47336a){_0x445e01[_0x658d('0x43')]=_0x47336a;return _0x445e01;});}})['then'](respondWithFilteredResult(_0xca591d,_0x4a4956))[_0x658d('0x47')](handleError(_0xca591d,null));};exports[_0x658d('0x60')]=function(_0x2dbbe8,_0x2c6b70,_0x29eaf2){var _0x5c8167={};var _0x2685bf={};var _0x2716bd;var _0x393c73;return db[_0x658d('0x2c')]['findOne']({'where':{'id':_0x2dbbe8[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x2c6b70,null))['then'](function(_0x203863){if(_0x203863){_0x2716bd=_0x203863;_0x2685bf['model']=_['keys'](db[_0x658d('0x61')][_0x658d('0x2d')]);_0x2685bf[_0x658d('0x31')]=_[_0x658d('0x32')](_0x2dbbe8[_0x658d('0x31')]);_0x2685bf[_0x658d('0x33')]=_['intersection'](_0x2685bf[_0x658d('0x30')],_0x2685bf[_0x658d('0x31')]);_0x5c8167[_0x658d('0x35')]=_['intersection'](_0x2685bf[_0x658d('0x30')],qs[_0x658d('0x36')](_0x2dbbe8['query'][_0x658d('0x36')]));_0x5c8167[_0x658d('0x35')]=_0x5c8167[_0x658d('0x35')]['length']?_0x5c8167[_0x658d('0x35')]:_0x2685bf[_0x658d('0x30')];_0x5c8167['order']=qs[_0x658d('0x3a')](_0x2dbbe8[_0x658d('0x31')]['sort']);_0x5c8167['where']=qs[_0x658d('0x33')](_['pick'](_0x2dbbe8[_0x658d('0x31')],_0x2685bf[_0x658d('0x33')]));if(_0x2dbbe8[_0x658d('0x31')][_0x658d('0x3d')]){_0x5c8167[_0x658d('0x3b')]=_[_0x658d('0x3e')](_0x5c8167['where'],{'$or':_[_0x658d('0x2b')](_0x5c8167['attributes'],function(_0x544e39){var _0x1562fc={};_0x1562fc[_0x544e39]={'$like':'%'+_0x2dbbe8['query'][_0x658d('0x3d')]+'%'};return _0x1562fc;})});}_0x5c8167=_['merge']({},_0x5c8167,_0x2dbbe8['options']);return _0x2716bd[_0x658d('0x60')](_0x5c8167);}})[_0x658d('0x23')](function(_0x418185){if(_0x418185){_0x393c73=_0x418185[_0x658d('0x45')];if(!_0x2dbbe8[_0x658d('0x31')][_0x658d('0x37')](_0x658d('0x38'))){_0x5c8167['limit']=qs[_0x658d('0x1c')](_0x2dbbe8[_0x658d('0x31')][_0x658d('0x1c')]);_0x5c8167[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0x2dbbe8['query'][_0x658d('0x1b')]);}return _0x2716bd[_0x658d('0x60')](_0x5c8167);}})[_0x658d('0x23')](function(_0x2c910d){if(_0x2c910d){return _0x2c910d?{'count':_0x393c73,'rows':_0x2c910d}:null;}})[_0x658d('0x23')](respondWithResult(_0x2c6b70,null))['catch'](handleError(_0x2c6b70,null));};exports[_0x658d('0x62')]=function(_0x1f3304,_0xa7b32d,_0x61336f){var _0x432566,_0x55918c;var _0x351fcf=[];var _0x3b8a52=moment()[_0x658d('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x658d('0x2c')][_0x658d('0x4d')]({'where':{'id':_0x1f3304[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0xa7b32d,null))['then'](function(_0x1925df){if(_0x1925df){_0x55918c=_0x1925df;return _0x1925df[_0x658d('0x62')](_0x1f3304[_0x658d('0x54')][_0x658d('0x64')],_['omit'](_0x1f3304[_0x658d('0x54')],['ids','id'])||{});}return null;})[_0x658d('0x65')](function(_0x2e439c){var _0x4f12ab;var _0x65bbc7;_0x432566=_0x2e439c||[];var _0x725cf8=[];if(_0x2e439c){for(var _0x249e69=0x0;_0x249e69<_0x2e439c[_0x658d('0x45')];_0x249e69+=0x1){var _0x3b6ac9=_0x2e439c[_0x249e69][_0x658d('0x25')]({'plain':!![]});_0x55918c[_0x658d('0x66')]=_0x1f3304[_0x658d('0x54')][_0x658d('0x66')]?_0x1f3304[_0x658d('0x54')]['dialCheckDuplicateType']:_0x55918c[_0x658d('0x66')];switch(_0x55918c[_0x658d('0x66')]){case _0x658d('0x67'):_0x4f12ab=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x6a'))['fromQuery'](['phone',_0x658d('0x6b'),_0x658d('0x6c'),_0x658d('0x6d'),_0x658d('0x5a'),_0x658d('0x52'),_0x658d('0x53')],squel[_0x658d('0x6e')]()[_0x658d('0x6f')](_0x658d('0x70'),'phone')[_0x658d('0x6f')](_0x658d('0x71'),_0x658d('0x6b'))[_0x658d('0x6f')]('id','ContactId')[_0x658d('0x6f')](_0x3b6ac9[_0x658d('0x72')][_0x658d('0x73')](),'ListId')[_0x658d('0x6f')](_0x1f3304['params']['id']['toString'](),_0x658d('0x5a'))[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27',_0x658d('0x52'))[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27','updatedAt')[_0x658d('0x74')]('cm_contacts')[_0x658d('0x3b')](_0x658d('0x75'))['where']('ListId\x20=\x20?',_0x3b6ac9['CmListId'][_0x658d('0x73')]())['where'](_0x658d('0x76'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x658d('0x6e')]()[_0x658d('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0x658d('0x74')]('cm_hopper_final')[_0x658d('0x3b')](_0x658d('0x77'),_0x1f3304[_0x658d('0x51')]['id'][_0x658d('0x73')]()))['where'](_0x658d('0x78'),squel[_0x658d('0x6e')]()[_0x658d('0x6f')](_0x658d('0x79'))[_0x658d('0x74')](_0x658d('0x6a'))[_0x658d('0x3b')](_0x658d('0x77'),_0x1f3304[_0x658d('0x51')]['id']['toString']())))[_0x658d('0x73')]();break;case _0x658d('0x7a'):_0x4f12ab=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x6a'))['fromQuery']([_0x658d('0x70'),_0x658d('0x6b'),_0x658d('0x6c'),_0x658d('0x6d'),_0x658d('0x5a'),_0x658d('0x52'),_0x658d('0x53')],squel[_0x658d('0x6e')]()['field']('phone','phone')[_0x658d('0x6f')]('NOW()',_0x658d('0x6b'))['field']('id',_0x658d('0x6c'))[_0x658d('0x6f')](_0x3b6ac9[_0x658d('0x72')][_0x658d('0x73')](),_0x658d('0x6d'))[_0x658d('0x6f')](_0x1f3304[_0x658d('0x51')]['id'][_0x658d('0x73')](),'CampaignId')[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27',_0x658d('0x52'))['field']('\x27'+_0x3b8a52+'\x27',_0x658d('0x53'))[_0x658d('0x74')](_0x658d('0x7b'))[_0x658d('0x3b')](_0x658d('0x75'))['where'](_0x658d('0x7c'),_0x3b6ac9[_0x658d('0x72')][_0x658d('0x73')]())[_0x658d('0x3b')](_0x658d('0x76'))[_0x658d('0x3b')](_0x658d('0x78'),squel[_0x658d('0x6e')]()[_0x658d('0x6f')](_0x658d('0x79'))[_0x658d('0x74')](_0x658d('0x6a'))[_0x658d('0x3b')]('CampaignId\x20=\x20?',_0x1f3304['params']['id'][_0x658d('0x73')]())))[_0x658d('0x73')]();break;default:_0x4f12ab=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x6a'))[_0x658d('0x7d')](['phone',_0x658d('0x6b'),'ContactId',_0x658d('0x6d'),_0x658d('0x5a'),_0x658d('0x52'),'updatedAt'],squel['select']()[_0x658d('0x6f')](_0x658d('0x70'),_0x658d('0x70'))[_0x658d('0x6f')](_0x658d('0x71'),_0x658d('0x6b'))[_0x658d('0x6f')]('id','ContactId')[_0x658d('0x6f')](_0x3b6ac9[_0x658d('0x72')]['toString'](),'ListId')[_0x658d('0x6f')](_0x1f3304['params']['id'][_0x658d('0x73')](),_0x658d('0x5a'))[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27','createdAt')[_0x658d('0x6f')]('\x27'+_0x3b8a52+'\x27',_0x658d('0x53'))[_0x658d('0x74')]('cm_contacts')['where'](_0x658d('0x75'))[_0x658d('0x3b')]('ListId\x20=\x20?',_0x3b6ac9[_0x658d('0x72')]['toString']())['where'](_0x658d('0x76')))[_0x658d('0x73')]();}_0x65bbc7=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x7e'))[_0x658d('0x7d')]([_0x658d('0x7f'),_0x658d('0x6b'),_0x658d('0x70'),'OrderBy','createdAt',_0x658d('0x53')],squel[_0x658d('0x6e')]()[_0x658d('0x6f')](_0x658d('0x80'),'id')[_0x658d('0x6f')](_0x658d('0x71'),'scheduledAt')[_0x658d('0x6f')](_0x658d('0x81'),_0x658d('0x70'))[_0x658d('0x6f')](_0x658d('0x82'),'OrderBy')['field']('\x27'+_0x3b8a52+'\x27',_0x658d('0x52'))['field']('\x27'+_0x3b8a52+'\x27',_0x658d('0x53'))[_0x658d('0x74')](_0x658d('0x83'),'ci')[_0x658d('0x84')]('cm_hopper','h',_0x658d('0x85'))[_0x658d('0x3b')](_0x658d('0x86'),_0x3b6ac9[_0x658d('0x72')][_0x658d('0x73')]())['where']('h.CampaignId=?',_0x1f3304[_0x658d('0x51')]['id'][_0x658d('0x73')]())[_0x658d('0x3b')](_0x658d('0x87'),_0x3b8a52))[_0x658d('0x73')]();_0x725cf8[_0x658d('0x88')](db[_0x658d('0x89')][_0x658d('0x31')](_0x4f12ab));_0x351fcf[_0x658d('0x88')](db['sequelize']['query'](_0x65bbc7));}return BPromise[_0x658d('0x8a')](_0x725cf8);}})[_0x658d('0x23')](function(){return BPromise[_0x658d('0x8a')](_0x351fcf);})[_0x658d('0x23')](function(){return _0x432566;})['then'](respondWithResult(_0xa7b32d,null))[_0x658d('0x47')](handleError(_0xa7b32d,null));};exports['removeLists']=function(_0x12e939,_0x201aad,_0x13e792){return db[_0x658d('0x2c')][_0x658d('0x4d')]({'where':{'id':_0x12e939[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x201aad,null))[_0x658d('0x23')](function(_0x173f8b){if(_0x173f8b){return _0x173f8b[_0x658d('0x8b')](_0x12e939['query'][_0x658d('0x64')]);}})[_0x658d('0x23')](function(_0x33abe9){if(_0x33abe9){return db[_0x658d('0x58')][_0x658d('0x24')]({'where':{'ListId':_0x12e939[_0x658d('0x31')]['ids'],'CampaignId':_0x12e939[_0x658d('0x51')]['id']}})[_0x658d('0x23')](function(){return _0x33abe9;});}})[_0x658d('0x23')](respondWithStatusCode(_0x201aad,null))[_0x658d('0x47')](handleError(_0x201aad,null));};exports[_0x658d('0x8c')]=function(_0x243fb3,_0x42c8c0,_0x3fa4b4){var _0x1f5d51={};var _0x4d7697={};var _0x4a20cf;var _0x1da0d6;return db['Campaign']['findOne']({'where':{'id':_0x243fb3[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x42c8c0,null))[_0x658d('0x23')](function(_0x35a6e1){if(_0x35a6e1){_0x4a20cf=_0x35a6e1;_0x4d7697[_0x658d('0x30')]=_[_0x658d('0x32')](db['CmList']['rawAttributes']);_0x4d7697['query']=_[_0x658d('0x32')](_0x243fb3['query']);_0x4d7697['filters']=_['intersection'](_0x4d7697['model'],_0x4d7697[_0x658d('0x31')]);_0x1f5d51['attributes']=_[_0x658d('0x34')](_0x4d7697['model'],qs[_0x658d('0x36')](_0x243fb3[_0x658d('0x31')]['fields']));_0x1f5d51[_0x658d('0x35')]=_0x1f5d51[_0x658d('0x35')][_0x658d('0x45')]?_0x1f5d51['attributes']:_0x4d7697['model'];_0x1f5d51['order']=qs[_0x658d('0x3a')](_0x243fb3[_0x658d('0x31')][_0x658d('0x3a')]);_0x1f5d51[_0x658d('0x3b')]=qs[_0x658d('0x33')](_[_0x658d('0x3c')](_0x243fb3[_0x658d('0x31')],_0x4d7697[_0x658d('0x33')]));if(_0x243fb3[_0x658d('0x31')]['filter']){_0x1f5d51[_0x658d('0x3b')]=_['merge'](_0x1f5d51['where'],{'$or':_['map'](_0x1f5d51[_0x658d('0x35')],function(_0xf396d1){var _0x236395={};_0x236395[_0xf396d1]={'$like':'%'+_0x243fb3[_0x658d('0x31')][_0x658d('0x3d')]+'%'};return _0x236395;})});}_0x1f5d51=_['merge']({},_0x1f5d51,_0x243fb3['options']);return _0x4a20cf['getBlackLists'](_0x1f5d51);}})[_0x658d('0x23')](function(_0x4f2b85){if(_0x4f2b85){_0x1da0d6=_0x4f2b85[_0x658d('0x45')];if(!_0x243fb3[_0x658d('0x31')][_0x658d('0x37')]('nolimit')){_0x1f5d51[_0x658d('0x1c')]=qs['limit'](_0x243fb3[_0x658d('0x31')]['limit']);_0x1f5d51[_0x658d('0x1b')]=qs[_0x658d('0x1b')](_0x243fb3[_0x658d('0x31')][_0x658d('0x1b')]);}return _0x4a20cf[_0x658d('0x8c')](_0x1f5d51);}})['then'](function(_0x1c9e14){if(_0x1c9e14){return _0x1c9e14?{'count':_0x1da0d6,'rows':_0x1c9e14}:null;}})[_0x658d('0x23')](respondWithResult(_0x42c8c0,null))[_0x658d('0x47')](handleError(_0x42c8c0,null));};exports[_0x658d('0x8d')]=function(_0x30d5da,_0x2d1a08,_0x54a1b0){var _0xc305a0,_0x41a7c6;var _0x10318a=[];var _0xb52c9a=moment()[_0x658d('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x658d('0x2c')]['find']({'where':{'id':_0x30d5da[_0x658d('0x51')]['id']}})[_0x658d('0x23')](handleEntityNotFound(_0x2d1a08,null))[_0x658d('0x23')](function(_0x413e96){if(_0x413e96){_0x41a7c6=_0x413e96;return _0x413e96[_0x658d('0x8d')](_0x30d5da[_0x658d('0x54')][_0x658d('0x64')],_[_0x658d('0x8e')](_0x30d5da[_0x658d('0x54')],['ids','id'])||{});}return null;})['spread'](function(_0x22b198){var _0x1d8e8d;var _0x5c9606;_0xc305a0=_0x22b198||[];var _0x1941ba=[];if(_0x22b198){for(var _0x3ea974=0x0;_0x3ea974<_0x22b198[_0x658d('0x45')];_0x3ea974+=0x1){var _0x42f234=_0x22b198[_0x3ea974]['get']({'plain':!![]});_0x1d8e8d=squel[_0x658d('0x68')]()[_0x658d('0x69')](_0x658d('0x8f'))[_0x658d('0x7d')]([_0x658d('0x70'),_0x658d('0x6c'),_0x658d('0x6d'),_0x658d('0x5a'),_0x658d('0x52'),_0x658d('0x53')],squel['select']()[_0x658d('0x6f')](_0x658d('0x70'),_0x658d('0x70'))[_0x658d('0x6f')]('id',_0x658d('0x6c'))[_0x658d('0x6f')](_0x42f234[_0x658d('0x72')][_0x658d('0x73')](),_0x658d('0x6d'))[_0x658d('0x6f')](_0x30d5da['params']['id'][_0x658d('0x73')](),_0x658d('0x5a'))[_0x658d('0x6f')]('NOW()',_0x658d('0x52'))[_0x658d('0x6f')](_0x658d('0x71'),'updatedAt')['from'](_0x658d('0x7b'))[_0x658d('0x3b')](_0x658d('0x75'))[_0x658d('0x3b')](_0x658d('0x7c'),_0x42f234[_0x658d('0x72')][_0x658d('0x73')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x1941ba[_0x658d('0x88')](db[_0x658d('0x89')][_0x658d('0x31')](_0x1d8e8d));}return BPromise[_0x658d('0x8a')](_0x1941ba);}})[_0x658d('0x23')](function(){return _0xc305a0;})['then'](respondWithResult(_0x2d1a08,null))['catch'](handleError(_0x2d1a08,null));};exports[_0x658d('0x90')]=function(_0x5029e3,_0xab37a5,_0xf20281){return db['Campaign']['find']({'where':{'id':_0x5029e3['params']['id']}})[_0x658d('0x23')](handleEntityNotFound(_0xab37a5,null))[_0x658d('0x23')](function(_0x49c110){if(_0x49c110){return _0x49c110[_0x658d('0x90')](_0x5029e3['query'][_0x658d('0x64')]);}})[_0x658d('0x23')](function(_0x344af8){if(_0x344af8){return db[_0x658d('0x5f')][_0x658d('0x24')]({'where':{'ListId':_0x5029e3[_0x658d('0x31')][_0x658d('0x64')],'CampaignId':_0x5029e3[_0x658d('0x51')]['id']}})[_0x658d('0x23')](function(){return _0x344af8;});}})[_0x658d('0x23')](respondWithStatusCode(_0xab37a5,null))['catch'](handleError(_0xab37a5,null));}; \ No newline at end of file +var _0xbaca=['save','then','get','sendStatus','error','stack','name','index','Campaign','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','autoAssociation','rawAttributes','include','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','from','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','into','cm_hopper','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject'];(function(_0xa464a1,_0x4ec344){var _0x19e814=function(_0x37a871){while(--_0x37a871){_0xa464a1['push'](_0xa464a1['shift']());}};_0x19e814(++_0x4ec344);}(_0xbaca,0xfc));var _0xabac=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0xbaca[_0x351b46];return _0x1515df;};'use strict';var emlformat=require(_0xabac('0x0'));var rimraf=require(_0xabac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabac('0x2'));var rp=require(_0xabac('0x3'));var moment=require('moment');var BPromise=require(_0xabac('0x4'));var Mustache=require('mustache');var util=require(_0xabac('0x5'));var path=require(_0xabac('0x6'));var sox=require(_0xabac('0x7'));var csv=require(_0xabac('0x8'));var ejs=require(_0xabac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xabac('0xa'));var crypto=require(_0xabac('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xabac('0x8'));var querystring=require(_0xabac('0xc'));var Papa=require(_0xabac('0xd'));var Redis=require('ioredis');var authService=require(_0xabac('0xe'));var qs=require(_0xabac('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabac('0x10'));var logger=require('../../config/logger')(_0xabac('0x11'));var utils=require(_0xabac('0x12'));var config=require(_0xabac('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xabac('0x14'))['db'];function respondWithStatusCode(_0xbd90d,_0x16f966){_0x16f966=_0x16f966||0xcc;return function(_0x5d9804){if(_0x5d9804){return _0xbd90d['sendStatus'](_0x16f966);}return _0xbd90d['status'](_0x16f966)[_0xabac('0x15')]();};}function respondWithResult(_0x40883b,_0x1484a4){_0x1484a4=_0x1484a4||0xc8;return function(_0x4e0a5){if(_0x4e0a5){return _0x40883b['status'](_0x1484a4)[_0xabac('0x16')](_0x4e0a5);}};}function respondWithFilteredResult(_0x3cbd4e,_0x267e31){return function(_0x3f54bc){if(_0x3f54bc){var _0x54381d=typeof _0x267e31[_0xabac('0x17')]===_0xabac('0x18')&&typeof _0x267e31[_0xabac('0x19')]===_0xabac('0x18');var _0x331da9=_0x3f54bc[_0xabac('0x1a')];var _0x3cd537=_0x54381d?0x0:_0x267e31['offset'];var _0x174d5b=_0x54381d?_0x3f54bc['count']:_0x267e31[_0xabac('0x17')]+_0x267e31[_0xabac('0x19')];var _0x42ccfb;if(_0x174d5b>=_0x331da9){_0x174d5b=_0x331da9;_0x42ccfb=0xc8;}else{_0x42ccfb=0xce;}_0x3cbd4e[_0xabac('0x1b')](_0x42ccfb);return _0x3cbd4e[_0xabac('0x1c')](_0xabac('0x1d'),_0x3cd537+'-'+_0x174d5b+'/'+_0x331da9)[_0xabac('0x16')](_0x3f54bc);}return null;};}function patchUpdates(_0x4313d7){return function(_0x42922d){try{jsonpatch[_0xabac('0x1e')](_0x42922d,_0x4313d7,!![]);}catch(_0x4ecae5){return BPromise[_0xabac('0x1f')](_0x4ecae5);}return _0x42922d[_0xabac('0x20')]();};}function saveUpdates(_0x459c84,_0x2b0586){return function(_0x3e8dc0){if(_0x3e8dc0){return _0x3e8dc0['update'](_0x459c84)[_0xabac('0x21')](function(_0x4ca55f){return _0x4ca55f;});}return null;};}function removeEntity(_0x5892f3,_0x159dc6){return function(_0xba977d){if(_0xba977d){return _0xba977d['destroy']()[_0xabac('0x21')](function(){var _0x55e6a5=_0xba977d[_0xabac('0x22')]({'plain':!![]});var _0x12d962='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x12d962,'resourceId':_0x55e6a5['id']}})[_0xabac('0x21')](function(){return _0xba977d;});})[_0xabac('0x21')](function(){_0x5892f3[_0xabac('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec8a4,_0x62dd1e){return function(_0x191d7c){if(!_0x191d7c){_0x2ec8a4[_0xabac('0x23')](0x194);}return _0x191d7c;};}function handleError(_0x3471ab,_0x3e4a13){_0x3e4a13=_0x3e4a13||0x1f4;return function(_0xb34291){logger[_0xabac('0x24')](_0xb34291[_0xabac('0x25')]);if(_0xb34291[_0xabac('0x26')]){delete _0xb34291[_0xabac('0x26')];}_0x3471ab[_0xabac('0x1b')](_0x3e4a13)['send'](_0xb34291);};}exports[_0xabac('0x27')]=function(_0x5714d4,_0x3a624d){var _0xf2ada5={},_0x571024={},_0x308f6f={'count':0x0,'rows':[]};var _0x1eb6ee=_['map'](db[_0xabac('0x28')]['rawAttributes'],function(_0x46f2c0){return{'name':_0x46f2c0[_0xabac('0x29')],'type':_0x46f2c0['type'][_0xabac('0x2a')]};});_0x571024[_0xabac('0x2b')]=_['map'](_0x1eb6ee,_0xabac('0x26'));_0x571024[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0x5714d4[_0xabac('0x2c')]);_0x571024[_0xabac('0x2e')]=_['intersection'](_0x571024[_0xabac('0x2b')],_0x571024[_0xabac('0x2c')]);_0xf2ada5['attributes']=_[_0xabac('0x2f')](_0x571024[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x5714d4[_0xabac('0x2c')]['fields']));_0xf2ada5[_0xabac('0x31')]=_0xf2ada5[_0xabac('0x31')][_0xabac('0x32')]?_0xf2ada5[_0xabac('0x31')]:_0x571024[_0xabac('0x2b')];if(!_0x5714d4[_0xabac('0x2c')][_0xabac('0x33')](_0xabac('0x34'))){_0xf2ada5[_0xabac('0x19')]=qs[_0xabac('0x19')](_0x5714d4['query'][_0xabac('0x19')]);_0xf2ada5[_0xabac('0x17')]=qs[_0xabac('0x17')](_0x5714d4['query'][_0xabac('0x17')]);}_0xf2ada5[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x5714d4[_0xabac('0x2c')][_0xabac('0x36')]);_0xf2ada5[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x5714d4[_0xabac('0x2c')],_0x571024[_0xabac('0x2e')]),_0x1eb6ee);if(_0x5714d4[_0xabac('0x2c')][_0xabac('0x39')]){_0xf2ada5[_0xabac('0x37')]=_['merge'](_0xf2ada5[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x1eb6ee,function(_0x1ab8e7){if(_0x1ab8e7[_0xabac('0x3b')]!==_0xabac('0x3c')){var _0x403b06={};_0x403b06[_0x1ab8e7[_0xabac('0x26')]]={'$like':'%'+_0x5714d4['query'][_0xabac('0x39')]+'%'};return _0x403b06;}})});}_0xf2ada5=_[_0xabac('0x3d')]({},_0xf2ada5,_0x5714d4[_0xabac('0x3e')]);var _0x39c157={'where':_0xf2ada5['where']};return db[_0xabac('0x28')][_0xabac('0x1a')](_0x39c157)[_0xabac('0x21')](function(_0x201d51){_0x308f6f[_0xabac('0x1a')]=_0x201d51;if(_0x5714d4['query']['includeAll']){_0xf2ada5['include']=[{'all':!![]}];}return db['Campaign'][_0xabac('0x3f')](_0xf2ada5);})[_0xabac('0x21')](function(_0x1bb9bf){_0x308f6f[_0xabac('0x40')]=_0x1bb9bf;return _0x308f6f;})[_0xabac('0x21')](respondWithFilteredResult(_0x3a624d,_0xf2ada5))[_0xabac('0x41')](handleError(_0x3a624d,null));};exports[_0xabac('0x42')]=function(_0x41ffcd,_0x1b3f34){var _0x4f7792={'raw':![],'where':{'id':_0x41ffcd[_0xabac('0x43')]['id']}},_0x354541={};_0x354541[_0xabac('0x2b')]=_['keys'](db[_0xabac('0x28')]['rawAttributes']);_0x354541[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0x41ffcd[_0xabac('0x2c')]);_0x354541[_0xabac('0x2e')]=_[_0xabac('0x2f')](_0x354541[_0xabac('0x2b')],_0x354541[_0xabac('0x2c')]);_0x4f7792[_0xabac('0x31')]=_['intersection'](_0x354541[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x41ffcd[_0xabac('0x2c')][_0xabac('0x30')]));_0x4f7792[_0xabac('0x31')]=_0x4f7792[_0xabac('0x31')][_0xabac('0x32')]?_0x4f7792[_0xabac('0x31')]:_0x354541[_0xabac('0x2b')];if(_0x41ffcd[_0xabac('0x2c')][_0xabac('0x44')]){_0x4f7792['include']=[{'all':!![]}];}_0x4f7792=_['merge']({},_0x4f7792,_0x41ffcd[_0xabac('0x3e')]);return db[_0xabac('0x28')][_0xabac('0x45')](_0x4f7792)[_0xabac('0x21')](handleEntityNotFound(_0x1b3f34,null))[_0xabac('0x21')](respondWithResult(_0x1b3f34,null))[_0xabac('0x41')](handleError(_0x1b3f34,null));};exports[_0xabac('0x46')]=function(_0x50ec3b,_0x50dd71){return db[_0xabac('0x28')][_0xabac('0x46')](_0x50ec3b[_0xabac('0x47')],{})[_0xabac('0x21')](function(_0x18449a){var _0x13227a=_0x50ec3b[_0xabac('0x48')][_0xabac('0x22')]({'plain':!![]});if(!_0x13227a)throw new Error(_0xabac('0x49'));if(_0x13227a[_0xabac('0x4a')]===_0xabac('0x48')){var _0x2af818=_0x18449a[_0xabac('0x22')]({'plain':!![]});var _0x199ab5=_0xabac('0x4b');return db[_0xabac('0x4c')][_0xabac('0x45')]({'where':{'name':_0x199ab5,'userProfileId':_0x13227a['userProfileId']},'raw':!![]})[_0xabac('0x21')](function(_0x54a04d){if(_0x54a04d&&_0x54a04d[_0xabac('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x2af818['name'],'resourceId':_0x2af818['id'],'type':_0x54a04d[_0xabac('0x26')],'sectionId':_0x54a04d['id']},{})['then'](function(){return _0x18449a;});}else{return _0x18449a;}})[_0xabac('0x41')](function(_0x1cb946){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cb946);throw _0x1cb946;});}return _0x18449a;})[_0xabac('0x21')](respondWithResult(_0x50dd71,0xc9))[_0xabac('0x41')](handleError(_0x50dd71,null));};exports['clone']=function(_0x2edc16,_0x2e6b2e){var _0x1c5553={'where':{'id':_0x2edc16[_0xabac('0x43')]['id']}},_0xcc22ed={};_0xcc22ed[_0xabac('0x2b')]=_[_0xabac('0x2d')](db[_0xabac('0x28')][_0xabac('0x4e')]);_0x1c5553[_0xabac('0x31')]=_[_0xabac('0x2f')](_0xcc22ed[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x2edc16[_0xabac('0x2c')][_0xabac('0x30')]));_0x1c5553[_0xabac('0x31')]=_0x1c5553[_0xabac('0x31')][_0xabac('0x32')]?_0x1c5553[_0xabac('0x31')]:_0xcc22ed[_0xabac('0x2b')];if(_0x2edc16[_0xabac('0x2c')][_0xabac('0x44')]){_0x1c5553[_0xabac('0x4f')]=[{'all':!![]}];}_0x1c5553=_['merge']({},_0x1c5553,_0x2edc16[_0xabac('0x3e')]);return db['Campaign'][_0xabac('0x45')](_0x1c5553)[_0xabac('0x21')](handleEntityNotFound(_0x2e6b2e,null))[_0xabac('0x21')](function(_0x3d6878){if(_0x3d6878){var _0x3f1b5a=_0x3d6878[_0xabac('0x22')]({'plain':!![]});_0x3f1b5a=qs[_0xabac('0x50')](_0x3f1b5a,['id',_0xabac('0x51'),_0xabac('0x52')]);_0x2edc16[_0xabac('0x47')]=_[_0xabac('0x50')](_0x2edc16[_0xabac('0x47')],['id','createdAt',_0xabac('0x52')]);return db[_0xabac('0x28')][_0xabac('0x46')](_[_0xabac('0x3d')](_0x3f1b5a,_0x2edc16[_0xabac('0x47')]),{'include':_0x2edc16['query'][_0xabac('0x44')]?[{'all':!![]}]:undefined})[_0xabac('0x21')](function(_0xf8ecbc){var _0x44ce6b=_0x2edc16[_0xabac('0x48')]['get']({'plain':!![]});if(!_0x44ce6b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44ce6b[_0xabac('0x4a')]===_0xabac('0x48')){var _0x490821=_0xf8ecbc[_0xabac('0x22')]({'plain':!![]});var _0x6bc7a4=_0xabac('0x4b');return db[_0xabac('0x4c')][_0xabac('0x45')]({'where':{'name':_0x6bc7a4,'userProfileId':_0x44ce6b[_0xabac('0x53')]},'raw':!![]})[_0xabac('0x21')](function(_0x25e25e){if(_0x25e25e&&_0x25e25e[_0xabac('0x4d')]===0x0){return db['UserProfileResource'][_0xabac('0x46')]({'name':_0x490821[_0xabac('0x26')],'resourceId':_0x490821['id'],'type':_0x25e25e[_0xabac('0x26')],'sectionId':_0x25e25e['id']},{})[_0xabac('0x21')](function(){return _0xf8ecbc;});}else{return _0xf8ecbc;}})[_0xabac('0x41')](function(_0x2ed8ca){logger[_0xabac('0x24')](_0xabac('0x54'),_0x2ed8ca);throw _0x2ed8ca;});}return _0xf8ecbc;});}})[_0xabac('0x21')](respondWithResult(_0x2e6b2e,0xc9))[_0xabac('0x41')](handleError(_0x2e6b2e,null));};exports[_0xabac('0x55')]=function(_0x42cbef,_0xc1b4ae){if(_0x42cbef[_0xabac('0x47')]['id']){delete _0x42cbef['body']['id'];}return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x42cbef['params']['id']}})[_0xabac('0x21')](handleEntityNotFound(_0xc1b4ae,null))[_0xabac('0x21')](saveUpdates(_0x42cbef[_0xabac('0x47')],null))[_0xabac('0x21')](respondWithResult(_0xc1b4ae,null))[_0xabac('0x41')](handleError(_0xc1b4ae,null));};exports[_0xabac('0x56')]=function(_0x5507b4,_0x7c45b1){return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x5507b4[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x7c45b1,null))[_0xabac('0x21')](removeEntity(_0x7c45b1,null))[_0xabac('0x41')](handleError(_0x7c45b1,null));};exports['getHoppers']=function(_0x2ac6a8,_0x3573c7,_0x889cf2){var _0x135057={'raw':!![],'where':{}};var _0x3aa068={};var _0x1d6b8e={'count':0x0,'rows':[]};return db[_0xabac('0x28')][_0xabac('0x57')]({'where':{'id':_0x2ac6a8[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x3573c7,null))[_0xabac('0x21')](function(_0x30e525){if(_0x30e525){_0x3aa068['model']=_[_0xabac('0x2d')](db[_0xabac('0x58')][_0xabac('0x4e')]);_0x3aa068[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0x2ac6a8[_0xabac('0x2c')]);_0x3aa068[_0xabac('0x2e')]=_[_0xabac('0x2f')](_0x3aa068[_0xabac('0x2b')],_0x3aa068[_0xabac('0x2c')]);_0x135057[_0xabac('0x31')]=_[_0xabac('0x2f')](_0x3aa068['model'],qs['fields'](_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x30')]));_0x135057[_0xabac('0x31')]=_0x135057[_0xabac('0x31')][_0xabac('0x32')]?_0x135057[_0xabac('0x31')]:_0x3aa068[_0xabac('0x2b')];if(!_0x2ac6a8['query'][_0xabac('0x33')](_0xabac('0x34'))){_0x135057['limit']=qs[_0xabac('0x19')](_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x19')]);_0x135057['offset']=qs['offset'](_0x2ac6a8['query'][_0xabac('0x17')]);}_0x135057[_0xabac('0x35')]=qs['sort'](_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x36')]);_0x135057[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x2ac6a8[_0xabac('0x2c')],_0x3aa068[_0xabac('0x2e')]));_0x135057[_0xabac('0x37')][_0xabac('0x59')]=_0x30e525['id'];if(_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x39')]){_0x135057[_0xabac('0x37')]=_[_0xabac('0x3d')](_0x135057[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x135057['attributes'],function(_0x23dd76){var _0x19448b={};_0x19448b[_0x23dd76]={'$like':'%'+_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x39')]+'%'};return _0x19448b;})});}_0x135057=_[_0xabac('0x3d')]({},_0x135057,_0x2ac6a8['options']);return db[_0xabac('0x58')][_0xabac('0x1a')]({'where':_0x135057[_0xabac('0x37')]})['then'](function(_0x30be11){_0x1d6b8e[_0xabac('0x1a')]=_0x30be11;if(_0x2ac6a8[_0xabac('0x2c')]['includeAll']){_0x135057['include']=[{'all':!![]}];}return db[_0xabac('0x58')][_0xabac('0x3f')](_0x135057);})['then'](function(_0x34a827){_0x1d6b8e[_0xabac('0x40')]=_0x34a827;return _0x1d6b8e;});}})[_0xabac('0x21')](respondWithFilteredResult(_0x3573c7,_0x135057))['catch'](handleError(_0x3573c7,null));};exports[_0xabac('0x5a')]=function(_0x498dda,_0x4abe55,_0x2b9eba){var _0xa31a74={'raw':!![],'where':{}};var _0x39950c={};var _0x509ac1={'count':0x0,'rows':[]};return db[_0xabac('0x28')][_0xabac('0x57')]({'where':{'id':_0x498dda[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x4abe55,null))[_0xabac('0x21')](function(_0x445a94){if(_0x445a94){_0x39950c['model']=_[_0xabac('0x2d')](db['CmHopperHistory'][_0xabac('0x4e')]);_0x39950c[_0xabac('0x2c')]=_['keys'](_0x498dda[_0xabac('0x2c')]);_0x39950c[_0xabac('0x2e')]=_[_0xabac('0x2f')](_0x39950c[_0xabac('0x2b')],_0x39950c[_0xabac('0x2c')]);_0xa31a74['attributes']=_['intersection'](_0x39950c['model'],qs[_0xabac('0x30')](_0x498dda[_0xabac('0x2c')][_0xabac('0x30')]));_0xa31a74['attributes']=_0xa31a74[_0xabac('0x31')][_0xabac('0x32')]?_0xa31a74[_0xabac('0x31')]:_0x39950c['model'];if(!_0x498dda[_0xabac('0x2c')]['hasOwnProperty'](_0xabac('0x34'))){_0xa31a74[_0xabac('0x19')]=qs['limit'](_0x498dda['query'][_0xabac('0x19')]);_0xa31a74[_0xabac('0x17')]=qs['offset'](_0x498dda[_0xabac('0x2c')]['offset']);}_0xa31a74[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x498dda[_0xabac('0x2c')][_0xabac('0x36')]);_0xa31a74[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x498dda['query'],_0x39950c[_0xabac('0x2e')]));_0xa31a74[_0xabac('0x37')]['CampaignId']=_0x445a94['id'];if(_0x498dda[_0xabac('0x2c')][_0xabac('0x39')]){_0xa31a74[_0xabac('0x37')]=_[_0xabac('0x3d')](_0xa31a74[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0xa31a74['attributes'],function(_0x4896b0){var _0x229c23={};_0x229c23[_0x4896b0]={'$like':'%'+_0x498dda[_0xabac('0x2c')]['filter']+'%'};return _0x229c23;})});}_0xa31a74=_['merge']({},_0xa31a74,_0x498dda[_0xabac('0x3e')]);return db[_0xabac('0x5b')][_0xabac('0x1a')]({'where':_0xa31a74[_0xabac('0x37')]})[_0xabac('0x21')](function(_0x3fe47f){_0x509ac1['count']=_0x3fe47f;if(_0x498dda['query']['includeAll']){_0xa31a74['include']=[{'all':!![]}];}return db[_0xabac('0x5b')]['findAll'](_0xa31a74);})[_0xabac('0x21')](function(_0x309125){_0x509ac1['rows']=_0x309125;return _0x509ac1;});}})[_0xabac('0x21')](respondWithFilteredResult(_0x4abe55,_0xa31a74))['catch'](handleError(_0x4abe55,null));};exports[_0xabac('0x5c')]=function(_0x1e10b6,_0x52cf62,_0x3dedae){var _0x168965={'raw':!![],'where':{}};var _0x5e445f={};var _0x4b8675={'count':0x0,'rows':[]};return db[_0xabac('0x28')][_0xabac('0x57')]({'where':{'id':_0x1e10b6[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x52cf62,null))[_0xabac('0x21')](function(_0x3b4670){if(_0x3b4670){_0x5e445f['model']=_['keys'](db['CmHopperFinal'][_0xabac('0x4e')]);_0x5e445f[_0xabac('0x2c')]=_['keys'](_0x1e10b6[_0xabac('0x2c')]);_0x5e445f[_0xabac('0x2e')]=_['intersection'](_0x5e445f[_0xabac('0x2b')],_0x5e445f['query']);_0x168965[_0xabac('0x31')]=_[_0xabac('0x2f')](_0x5e445f[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x1e10b6['query'][_0xabac('0x30')]));_0x168965[_0xabac('0x31')]=_0x168965[_0xabac('0x31')][_0xabac('0x32')]?_0x168965[_0xabac('0x31')]:_0x5e445f[_0xabac('0x2b')];if(!_0x1e10b6[_0xabac('0x2c')][_0xabac('0x33')]('nolimit')){_0x168965['limit']=qs[_0xabac('0x19')](_0x1e10b6[_0xabac('0x2c')][_0xabac('0x19')]);_0x168965['offset']=qs['offset'](_0x1e10b6[_0xabac('0x2c')][_0xabac('0x17')]);}_0x168965[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x1e10b6[_0xabac('0x2c')]['sort']);_0x168965[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x1e10b6[_0xabac('0x2c')],_0x5e445f[_0xabac('0x2e')]));_0x168965[_0xabac('0x37')][_0xabac('0x59')]=_0x3b4670['id'];if(_0x1e10b6[_0xabac('0x2c')][_0xabac('0x39')]){_0x168965[_0xabac('0x37')]=_[_0xabac('0x3d')](_0x168965['where'],{'$or':_[_0xabac('0x3a')](_0x168965[_0xabac('0x31')],function(_0x3affbc){var _0x3da961={};_0x3da961[_0x3affbc]={'$like':'%'+_0x1e10b6[_0xabac('0x2c')]['filter']+'%'};return _0x3da961;})});}_0x168965=_[_0xabac('0x3d')]({},_0x168965,_0x1e10b6[_0xabac('0x3e')]);return db['CmHopperFinal'][_0xabac('0x1a')]({'where':_0x168965[_0xabac('0x37')]})[_0xabac('0x21')](function(_0x19c2da){_0x4b8675[_0xabac('0x1a')]=_0x19c2da;if(_0x1e10b6[_0xabac('0x2c')][_0xabac('0x44')]){_0x168965[_0xabac('0x4f')]=[{'all':!![]}];}return db[_0xabac('0x5d')][_0xabac('0x3f')](_0x168965);})[_0xabac('0x21')](function(_0x1a7ba1){_0x4b8675[_0xabac('0x40')]=_0x1a7ba1;return _0x4b8675;});}})[_0xabac('0x21')](respondWithFilteredResult(_0x52cf62,_0x168965))[_0xabac('0x41')](handleError(_0x52cf62,null));};exports[_0xabac('0x5e')]=function(_0x3223cc,_0x5e96cb,_0x2b6b16){var _0x24d29c={'raw':!![],'where':{}};var _0x2e0c6f={};var _0x4e38ff={'count':0x0,'rows':[]};return db[_0xabac('0x28')][_0xabac('0x57')]({'where':{'id':_0x3223cc[_0xabac('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e96cb,null))['then'](function(_0x1d4d87){if(_0x1d4d87){_0x2e0c6f[_0xabac('0x2b')]=_[_0xabac('0x2d')](db['CmHopperBlack']['rawAttributes']);_0x2e0c6f['query']=_[_0xabac('0x2d')](_0x3223cc[_0xabac('0x2c')]);_0x2e0c6f['filters']=_['intersection'](_0x2e0c6f['model'],_0x2e0c6f[_0xabac('0x2c')]);_0x24d29c[_0xabac('0x31')]=_[_0xabac('0x2f')](_0x2e0c6f[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x3223cc['query'][_0xabac('0x30')]));_0x24d29c['attributes']=_0x24d29c[_0xabac('0x31')][_0xabac('0x32')]?_0x24d29c['attributes']:_0x2e0c6f[_0xabac('0x2b')];if(!_0x3223cc[_0xabac('0x2c')]['hasOwnProperty'](_0xabac('0x34'))){_0x24d29c['limit']=qs[_0xabac('0x19')](_0x3223cc[_0xabac('0x2c')][_0xabac('0x19')]);_0x24d29c[_0xabac('0x17')]=qs[_0xabac('0x17')](_0x3223cc[_0xabac('0x2c')][_0xabac('0x17')]);}_0x24d29c[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x3223cc[_0xabac('0x2c')][_0xabac('0x36')]);_0x24d29c[_0xabac('0x37')]=qs['filters'](_[_0xabac('0x38')](_0x3223cc[_0xabac('0x2c')],_0x2e0c6f[_0xabac('0x2e')]));_0x24d29c[_0xabac('0x37')][_0xabac('0x59')]=_0x1d4d87['id'];if(_0x3223cc[_0xabac('0x2c')][_0xabac('0x39')]){_0x24d29c[_0xabac('0x37')]=_['merge'](_0x24d29c[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x24d29c[_0xabac('0x31')],function(_0x379fd0){var _0x52c45c={};_0x52c45c[_0x379fd0]={'$like':'%'+_0x3223cc[_0xabac('0x2c')][_0xabac('0x39')]+'%'};return _0x52c45c;})});}_0x24d29c=_['merge']({},_0x24d29c,_0x3223cc[_0xabac('0x3e')]);return db[_0xabac('0x5f')][_0xabac('0x1a')]({'where':_0x24d29c[_0xabac('0x37')]})[_0xabac('0x21')](function(_0x5dbb72){_0x4e38ff['count']=_0x5dbb72;if(_0x3223cc['query'][_0xabac('0x44')]){_0x24d29c[_0xabac('0x4f')]=[{'all':!![]}];}return db[_0xabac('0x5f')][_0xabac('0x3f')](_0x24d29c);})[_0xabac('0x21')](function(_0xe37d20){_0x4e38ff[_0xabac('0x40')]=_0xe37d20;return _0x4e38ff;});}})[_0xabac('0x21')](respondWithFilteredResult(_0x5e96cb,_0x24d29c))['catch'](handleError(_0x5e96cb,null));};exports[_0xabac('0x60')]=function(_0x330324,_0x413f0e,_0x467f73){var _0x51c300={};var _0x2ab4bc={};var _0x2c272f;var _0x37a1bc;return db['Campaign']['findOne']({'where':{'id':_0x330324['params']['id']}})['then'](handleEntityNotFound(_0x413f0e,null))[_0xabac('0x21')](function(_0x1e8064){if(_0x1e8064){_0x2c272f=_0x1e8064;_0x2ab4bc['model']=_['keys'](db[_0xabac('0x61')][_0xabac('0x4e')]);_0x2ab4bc[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0x330324[_0xabac('0x2c')]);_0x2ab4bc[_0xabac('0x2e')]=_['intersection'](_0x2ab4bc['model'],_0x2ab4bc[_0xabac('0x2c')]);_0x51c300[_0xabac('0x31')]=_[_0xabac('0x2f')](_0x2ab4bc['model'],qs['fields'](_0x330324[_0xabac('0x2c')]['fields']));_0x51c300[_0xabac('0x31')]=_0x51c300['attributes']['length']?_0x51c300[_0xabac('0x31')]:_0x2ab4bc[_0xabac('0x2b')];_0x51c300[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x330324['query']['sort']);_0x51c300[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x330324[_0xabac('0x2c')],_0x2ab4bc[_0xabac('0x2e')]));if(_0x330324[_0xabac('0x2c')][_0xabac('0x39')]){_0x51c300['where']=_[_0xabac('0x3d')](_0x51c300[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x51c300[_0xabac('0x31')],function(_0x2effdd){var _0x2ce3d3={};_0x2ce3d3[_0x2effdd]={'$like':'%'+_0x330324[_0xabac('0x2c')][_0xabac('0x39')]+'%'};return _0x2ce3d3;})});}_0x51c300=_[_0xabac('0x3d')]({},_0x51c300,_0x330324['options']);return _0x2c272f[_0xabac('0x60')](_0x51c300);}})[_0xabac('0x21')](function(_0x5abf97){if(_0x5abf97){_0x37a1bc=_0x5abf97[_0xabac('0x32')];if(!_0x330324[_0xabac('0x2c')]['hasOwnProperty']('nolimit')){_0x51c300[_0xabac('0x19')]=qs[_0xabac('0x19')](_0x330324[_0xabac('0x2c')][_0xabac('0x19')]);_0x51c300[_0xabac('0x17')]=qs[_0xabac('0x17')](_0x330324[_0xabac('0x2c')]['offset']);}return _0x2c272f[_0xabac('0x60')](_0x51c300);}})[_0xabac('0x21')](function(_0x532ebe){if(_0x532ebe){return _0x532ebe?{'count':_0x37a1bc,'rows':_0x532ebe}:null;}})[_0xabac('0x21')](respondWithResult(_0x413f0e,null))['catch'](handleError(_0x413f0e,null));};exports[_0xabac('0x62')]=function(_0x70d28d,_0x5a790f,_0x24853c){var _0x5c5415,_0x33bad0;var _0x3da35c=[];var _0x2c0caa=moment()[_0xabac('0x63')](_0xabac('0x64'));return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x70d28d['params']['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x5a790f,null))[_0xabac('0x21')](function(_0x26b5f2){if(_0x26b5f2){_0x33bad0=_0x26b5f2;return _0x26b5f2[_0xabac('0x62')](_0x70d28d[_0xabac('0x47')][_0xabac('0x65')],_[_0xabac('0x50')](_0x70d28d[_0xabac('0x47')],['ids','id'])||{});}return null;})[_0xabac('0x66')](function(_0x2f683){var _0x14fe10;var _0x4d86da;_0x5c5415=_0x2f683||[];var _0x507448=[];if(_0x2f683){for(var _0x39d47b=0x0;_0x39d47b<_0x2f683['length'];_0x39d47b+=0x1){var _0x56145f=_0x2f683[_0x39d47b]['get']({'plain':!![]});_0x33bad0['dialCheckDuplicateType']=_0x70d28d['body'][_0xabac('0x67')]?_0x70d28d['body'][_0xabac('0x67')]:_0x33bad0[_0xabac('0x67')];switch(_0x33bad0[_0xabac('0x67')]){case _0xabac('0x68'):_0x14fe10=squel[_0xabac('0x69')]()['into']('cm_hopper')[_0xabac('0x6a')]([_0xabac('0x6b'),_0xabac('0x6c'),_0xabac('0x6d'),_0xabac('0x6e'),_0xabac('0x59'),'createdAt',_0xabac('0x52')],squel[_0xabac('0x6f')]()['field'](_0xabac('0x6b'),_0xabac('0x6b'))[_0xabac('0x70')](_0xabac('0x71'),_0xabac('0x6c'))[_0xabac('0x70')]('id',_0xabac('0x6d'))[_0xabac('0x70')](_0x56145f[_0xabac('0x72')]['toString'](),_0xabac('0x6e'))[_0xabac('0x70')](_0x70d28d[_0xabac('0x43')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x2c0caa+'\x27',_0xabac('0x51'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x52'))['from'](_0xabac('0x73'))[_0xabac('0x37')](_0xabac('0x74'))[_0xabac('0x37')](_0xabac('0x75'),_0x56145f['CmListId'][_0xabac('0x76')]())[_0xabac('0x37')](_0xabac('0x77'))[_0xabac('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0xabac('0x6f')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xabac('0x78')]('cm_hopper_final')[_0xabac('0x37')]('CampaignId\x20=\x20?',_0x70d28d[_0xabac('0x43')]['id'][_0xabac('0x76')]()))[_0xabac('0x37')](_0xabac('0x79'),squel[_0xabac('0x6f')]()[_0xabac('0x70')]('COALESCE(phone,\x27\x27)')[_0xabac('0x78')]('cm_hopper')[_0xabac('0x37')](_0xabac('0x7a'),_0x70d28d[_0xabac('0x43')]['id'][_0xabac('0x76')]())))[_0xabac('0x76')]();break;case'onlyIfOpen':_0x14fe10=squel[_0xabac('0x69')]()[_0xabac('0x7b')](_0xabac('0x7c'))[_0xabac('0x6a')](['phone',_0xabac('0x6c'),_0xabac('0x6d'),_0xabac('0x6e'),_0xabac('0x59'),_0xabac('0x51'),_0xabac('0x52')],squel['select']()[_0xabac('0x70')]('phone','phone')[_0xabac('0x70')](_0xabac('0x71'),_0xabac('0x6c'))['field']('id',_0xabac('0x6d'))['field'](_0x56145f['CmListId'][_0xabac('0x76')](),_0xabac('0x6e'))[_0xabac('0x70')](_0x70d28d[_0xabac('0x43')]['id']['toString'](),_0xabac('0x59'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x51'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x52'))[_0xabac('0x78')](_0xabac('0x73'))[_0xabac('0x37')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x56145f[_0xabac('0x72')][_0xabac('0x76')]())[_0xabac('0x37')](_0xabac('0x77'))[_0xabac('0x37')](_0xabac('0x79'),squel[_0xabac('0x6f')]()['field'](_0xabac('0x7d'))['from']('cm_hopper')[_0xabac('0x37')](_0xabac('0x7a'),_0x70d28d[_0xabac('0x43')]['id']['toString']())))['toString']();break;default:_0x14fe10=squel[_0xabac('0x69')]()[_0xabac('0x7b')](_0xabac('0x7c'))[_0xabac('0x6a')](['phone','scheduledAt',_0xabac('0x6d'),_0xabac('0x6e'),_0xabac('0x59'),_0xabac('0x51'),'updatedAt'],squel['select']()[_0xabac('0x70')](_0xabac('0x6b'),_0xabac('0x6b'))['field']('NOW()',_0xabac('0x6c'))['field']('id',_0xabac('0x6d'))[_0xabac('0x70')](_0x56145f[_0xabac('0x72')]['toString'](),'ListId')[_0xabac('0x70')](_0x70d28d[_0xabac('0x43')]['id'][_0xabac('0x76')](),_0xabac('0x59'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27','createdAt')[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x52'))['from'](_0xabac('0x73'))[_0xabac('0x37')](_0xabac('0x74'))[_0xabac('0x37')](_0xabac('0x75'),_0x56145f[_0xabac('0x72')]['toString']())['where'](_0xabac('0x77')))[_0xabac('0x76')]();}_0x4d86da=squel[_0xabac('0x69')]()[_0xabac('0x7b')](_0xabac('0x7e'))[_0xabac('0x6a')]([_0xabac('0x7f'),_0xabac('0x6c'),_0xabac('0x6b'),'OrderBy','createdAt',_0xabac('0x52')],squel[_0xabac('0x6f')]()[_0xabac('0x70')]('h.id','id')['field'](_0xabac('0x71'),'scheduledAt')['field'](_0xabac('0x80'),_0xabac('0x6b'))[_0xabac('0x70')](_0xabac('0x81'),'OrderBy')['field']('\x27'+_0x2c0caa+'\x27',_0xabac('0x51'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x52'))['from'](_0xabac('0x82'),'ci')['join'](_0xabac('0x7c'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xabac('0x37')](_0xabac('0x83'),_0x56145f[_0xabac('0x72')]['toString']())[_0xabac('0x37')](_0xabac('0x84'),_0x70d28d[_0xabac('0x43')]['id'][_0xabac('0x76')]())[_0xabac('0x37')](_0xabac('0x85'),_0x2c0caa))[_0xabac('0x76')]();_0x507448[_0xabac('0x86')](db[_0xabac('0x87')]['query'](_0x14fe10));_0x3da35c[_0xabac('0x86')](db[_0xabac('0x87')][_0xabac('0x2c')](_0x4d86da));}return BPromise['all'](_0x507448);}})[_0xabac('0x21')](function(){return BPromise[_0xabac('0x88')](_0x3da35c);})[_0xabac('0x21')](function(){return _0x5c5415;})[_0xabac('0x21')](respondWithResult(_0x5a790f,null))['catch'](handleError(_0x5a790f,null));};exports[_0xabac('0x89')]=function(_0x3fe4cd,_0x1852db,_0x17b65d){return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x3fe4cd['params']['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x1852db,null))[_0xabac('0x21')](function(_0x3490ee){if(_0x3490ee){return _0x3490ee[_0xabac('0x89')](_0x3fe4cd[_0xabac('0x2c')][_0xabac('0x65')]);}})['then'](function(_0x512838){if(_0x512838){return db['CmHopper'][_0xabac('0x56')]({'where':{'ListId':_0x3fe4cd[_0xabac('0x2c')][_0xabac('0x65')],'CampaignId':_0x3fe4cd[_0xabac('0x43')]['id']}})[_0xabac('0x21')](function(){return _0x512838;});}})[_0xabac('0x21')](respondWithStatusCode(_0x1852db,null))[_0xabac('0x41')](handleError(_0x1852db,null));};exports[_0xabac('0x8a')]=function(_0xcf8beb,_0x3bdc03,_0x24f177){var _0x189bc3={};var _0x5b1034={};var _0x557670;var _0x11cb24;return db[_0xabac('0x28')]['findOne']({'where':{'id':_0xcf8beb['params']['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x3bdc03,null))[_0xabac('0x21')](function(_0x182471){if(_0x182471){_0x557670=_0x182471;_0x5b1034[_0xabac('0x2b')]=_[_0xabac('0x2d')](db['CmList'][_0xabac('0x4e')]);_0x5b1034[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0xcf8beb['query']);_0x5b1034[_0xabac('0x2e')]=_[_0xabac('0x2f')](_0x5b1034[_0xabac('0x2b')],_0x5b1034[_0xabac('0x2c')]);_0x189bc3[_0xabac('0x31')]=_['intersection'](_0x5b1034['model'],qs[_0xabac('0x30')](_0xcf8beb['query']['fields']));_0x189bc3[_0xabac('0x31')]=_0x189bc3['attributes'][_0xabac('0x32')]?_0x189bc3[_0xabac('0x31')]:_0x5b1034['model'];_0x189bc3['order']=qs[_0xabac('0x36')](_0xcf8beb[_0xabac('0x2c')][_0xabac('0x36')]);_0x189bc3['where']=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0xcf8beb['query'],_0x5b1034['filters']));if(_0xcf8beb[_0xabac('0x2c')][_0xabac('0x39')]){_0x189bc3['where']=_[_0xabac('0x3d')](_0x189bc3[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x189bc3[_0xabac('0x31')],function(_0xc5242e){var _0x36d829={};_0x36d829[_0xc5242e]={'$like':'%'+_0xcf8beb['query'][_0xabac('0x39')]+'%'};return _0x36d829;})});}_0x189bc3=_[_0xabac('0x3d')]({},_0x189bc3,_0xcf8beb[_0xabac('0x3e')]);return _0x557670['getBlackLists'](_0x189bc3);}})['then'](function(_0x16c0cf){if(_0x16c0cf){_0x11cb24=_0x16c0cf['length'];if(!_0xcf8beb[_0xabac('0x2c')][_0xabac('0x33')](_0xabac('0x34'))){_0x189bc3[_0xabac('0x19')]=qs[_0xabac('0x19')](_0xcf8beb['query']['limit']);_0x189bc3[_0xabac('0x17')]=qs[_0xabac('0x17')](_0xcf8beb[_0xabac('0x2c')][_0xabac('0x17')]);}return _0x557670[_0xabac('0x8a')](_0x189bc3);}})[_0xabac('0x21')](function(_0x4ed552){if(_0x4ed552){return _0x4ed552?{'count':_0x11cb24,'rows':_0x4ed552}:null;}})[_0xabac('0x21')](respondWithResult(_0x3bdc03,null))['catch'](handleError(_0x3bdc03,null));};exports[_0xabac('0x8b')]=function(_0x155341,_0xc44f98,_0x55c34d){var _0x277b6b,_0x48b17a;var _0x21fcd8=[];var _0x5bd78b=moment()[_0xabac('0x63')](_0xabac('0x64'));return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x155341[_0xabac('0x43')]['id']}})['then'](handleEntityNotFound(_0xc44f98,null))[_0xabac('0x21')](function(_0x41559e){if(_0x41559e){_0x48b17a=_0x41559e;return _0x41559e[_0xabac('0x8b')](_0x155341[_0xabac('0x47')][_0xabac('0x65')],_[_0xabac('0x50')](_0x155341['body'],[_0xabac('0x65'),'id'])||{});}return null;})['spread'](function(_0x3e237f){var _0x20446d;var _0x2d0fb0;_0x277b6b=_0x3e237f||[];var _0x37bfac=[];if(_0x3e237f){for(var _0x3316b6=0x0;_0x3316b6<_0x3e237f[_0xabac('0x32')];_0x3316b6+=0x1){var _0x3640f5=_0x3e237f[_0x3316b6][_0xabac('0x22')]({'plain':!![]});_0x20446d=squel['insert']()[_0xabac('0x7b')](_0xabac('0x8c'))[_0xabac('0x6a')]([_0xabac('0x6b'),_0xabac('0x6d'),_0xabac('0x6e'),_0xabac('0x59'),_0xabac('0x51'),_0xabac('0x52')],squel[_0xabac('0x6f')]()[_0xabac('0x70')](_0xabac('0x6b'),_0xabac('0x6b'))[_0xabac('0x70')]('id',_0xabac('0x6d'))['field'](_0x3640f5[_0xabac('0x72')][_0xabac('0x76')](),_0xabac('0x6e'))[_0xabac('0x70')](_0x155341[_0xabac('0x43')]['id']['toString'](),_0xabac('0x59'))[_0xabac('0x70')](_0xabac('0x71'),_0xabac('0x51'))[_0xabac('0x70')]('NOW()',_0xabac('0x52'))[_0xabac('0x78')](_0xabac('0x73'))[_0xabac('0x37')]('deletedAt\x20IS\x20NULL')[_0xabac('0x37')](_0xabac('0x75'),_0x3640f5['CmListId'][_0xabac('0x76')]())['where'](_0xabac('0x77')))['toString']();_0x37bfac[_0xabac('0x86')](db['sequelize'][_0xabac('0x2c')](_0x20446d));}return BPromise['all'](_0x37bfac);}})[_0xabac('0x21')](function(){return _0x277b6b;})['then'](respondWithResult(_0xc44f98,null))[_0xabac('0x41')](handleError(_0xc44f98,null));};exports[_0xabac('0x8d')]=function(_0x5cffca,_0x350f7b,_0x10f24d){return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x5cffca[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x350f7b,null))['then'](function(_0x1c9d3f){if(_0x1c9d3f){return _0x1c9d3f['removeBlackLists'](_0x5cffca['query'][_0xabac('0x65')]);}})['then'](function(_0x472f3f){if(_0x472f3f){return db[_0xabac('0x5f')][_0xabac('0x56')]({'where':{'ListId':_0x5cffca[_0xabac('0x2c')][_0xabac('0x65')],'CampaignId':_0x5cffca[_0xabac('0x43')]['id']}})[_0xabac('0x21')](function(){return _0x472f3f;});}})[_0xabac('0x21')](respondWithStatusCode(_0x350f7b,null))[_0xabac('0x41')](handleError(_0x350f7b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 5b5418f..6c848ec 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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x5bb215,_0x268c07){var _0x5c615f=function(_0x2d458c){while(--_0x2d458c){_0x5bb215['push'](_0x5bb215['shift']());}};_0x5c615f(++_0x268c07);}(_0x7a54,0x106));var _0x47a5=function(_0x186e9b,_0x4869b6){_0x186e9b=_0x186e9b-0x0;var _0x48177c=_0x7a54[_0x186e9b];return _0x48177c;};'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 7859276..5d727c4 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 _0xbdeb=['then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x5f37fc,_0x3e6e09){var _0x32745d=function(_0x485ca7){while(--_0x485ca7){_0x5f37fc['push'](_0x5f37fc['shift']());}};_0x32745d(++_0x3e6e09);}(_0xbdeb,0x6f));var _0xbbde=function(_0x2fcccd,_0x4a8380){_0x2fcccd=_0x2fcccd-0x0;var _0x2423b4=_0xbdeb[_0x2fcccd];return _0x2423b4;};'use strict';var _=require('lodash');var util=require(_0xbbde('0x0'));var moment=require('moment');var BPromise=require(_0xbbde('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbde('0x2'));var db=require(_0xbbde('0x3'))['db'];var utils=require(_0xbbde('0x4'));var logger=require(_0xbbde('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbbde('0x6'));var client=jayson[_0xbbde('0x7')][_0xbbde('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a8482,_0x5e6273,_0x49966c){return new BPromise(function(_0x3215c9,_0x17df59){return client['request'](_0x1a8482,_0x49966c)[_0xbbde('0x9')](function(_0xec50fa){logger[_0xbbde('0xa')](_0xbbde('0xb'),_0x5e6273,_0xbbde('0xc'));logger[_0xbbde('0xd')](_0xbbde('0xe'),_0x5e6273,_0xbbde('0xc'),JSON[_0xbbde('0xf')](_0xec50fa));if(_0xec50fa[_0xbbde('0x10')]){if(_0xec50fa['error']['code']===0x1f4){logger[_0xbbde('0x10')]('Campaign,\x20%s,\x20%s',_0x5e6273,_0xec50fa[_0xbbde('0x10')]['message']);return _0x17df59(_0xec50fa[_0xbbde('0x10')][_0xbbde('0x11')]);}logger[_0xbbde('0x10')](_0xbbde('0xb'),_0x5e6273,_0xec50fa[_0xbbde('0x10')][_0xbbde('0x11')]);return _0x3215c9(_0xec50fa[_0xbbde('0x10')]['message']);}else{logger[_0xbbde('0xa')](_0xbbde('0xb'),_0x5e6273,'request\x20sent');_0x3215c9(_0xec50fa['result'][_0xbbde('0x11')]);}})['catch'](function(_0x88e8a5){logger['error'](_0xbbde('0xb'),_0x5e6273,_0x88e8a5);_0x17df59(_0x88e8a5);});});}exports[_0xbbde('0x12')]=function(_0x593e58){var _0x2073d1=this;return new Promise(function(_0x1bc7eb,_0xeb6b63){return db[_0xbbde('0x13')][_0xbbde('0x14')]({'raw':_0x593e58[_0xbbde('0x15')]?_0x593e58['options'][_0xbbde('0x16')]===undefined?!![]:![]:!![],'where':_0x593e58[_0xbbde('0x15')]?_0x593e58[_0xbbde('0x15')][_0xbbde('0x17')]||null:null,'attributes':_0x593e58[_0xbbde('0x15')]?_0x593e58['options'][_0xbbde('0x18')]||null:null,'limit':_0x593e58[_0xbbde('0x15')]?_0x593e58[_0xbbde('0x15')][_0xbbde('0x19')]||null:null,'include':_0x593e58[_0xbbde('0x15')]?_0x593e58[_0xbbde('0x15')][_0xbbde('0x1a')]?_[_0xbbde('0x1b')](_0x593e58[_0xbbde('0x15')][_0xbbde('0x1a')],function(_0x4ac50b){return{'model':db[_0x4ac50b[_0xbbde('0x1c')]],'as':_0x4ac50b['as'],'attributes':_0x4ac50b[_0xbbde('0x18')],'include':_0x4ac50b[_0xbbde('0x1a')]?_['map'](_0x4ac50b[_0xbbde('0x1a')],function(_0x34c327){return{'model':db[_0x34c327[_0xbbde('0x1c')]],'as':_0x34c327['as'],'attributes':_0x34c327[_0xbbde('0x18')],'include':_0x34c327[_0xbbde('0x1a')]?_['map'](_0x34c327[_0xbbde('0x1a')],function(_0x14243a){return{'model':db[_0x14243a['model']],'as':_0x14243a['as'],'attributes':_0x14243a[_0xbbde('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbbde('0x9')](function(_0x2854d7){logger[_0xbbde('0xa')](_0xbbde('0x12'),_0x593e58);logger['debug']('GetCampaign',_0x593e58,JSON[_0xbbde('0xf')](_0x2854d7));_0x1bc7eb(_0x2854d7);})[_0xbbde('0x1d')](function(_0x5ac8a2){logger[_0xbbde('0x10')](_0xbbde('0x12'),_0x5ac8a2[_0xbbde('0x11')],_0x593e58);_0xeb6b63(_0x2073d1[_0xbbde('0x10')](0x1f4,_0x5ac8a2[_0xbbde('0x11')]));});});}; \ No newline at end of file +var _0x9234=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','findAll','options','raw','where','attributes','map','include','model','lodash','moment','bluebird'];(function(_0x510bf0,_0x595be7){var _0xd9877f=function(_0x98aff){while(--_0x98aff){_0x510bf0['push'](_0x510bf0['shift']());}};_0xd9877f(++_0x595be7);}(_0x9234,0x1bd));var _0x4923=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x9234[_0x3cb30b];return _0x2ca717;};'use strict';var _=require(_0x4923('0x0'));var util=require('util');var moment=require(_0x4923('0x1'));var BPromise=require(_0x4923('0x2'));var rs=require(_0x4923('0x3'));var fs=require('fs');var Redis=require(_0x4923('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4923('0x5'));var logger=require(_0x4923('0x6'))('rpc');var config=require(_0x4923('0x7'));var jayson=require(_0x4923('0x8'));var client=jayson[_0x4923('0x9')][_0x4923('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17b854,_0x133b0d,_0x2de396){return new BPromise(function(_0x548676,_0x1fffc2){return client['request'](_0x17b854,_0x2de396)[_0x4923('0xb')](function(_0x2c4057){logger[_0x4923('0xc')]('Campaign,\x20%s,\x20%s',_0x133b0d,_0x4923('0xd'));logger[_0x4923('0xe')](_0x4923('0xf'),_0x133b0d,_0x4923('0xd'),JSON[_0x4923('0x10')](_0x2c4057));if(_0x2c4057[_0x4923('0x11')]){if(_0x2c4057[_0x4923('0x11')][_0x4923('0x12')]===0x1f4){logger[_0x4923('0x11')](_0x4923('0x13'),_0x133b0d,_0x2c4057['error']['message']);return _0x1fffc2(_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);}logger[_0x4923('0x11')]('Campaign,\x20%s,\x20%s',_0x133b0d,_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);return _0x548676(_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);}else{logger[_0x4923('0xc')](_0x4923('0x13'),_0x133b0d,_0x4923('0xd'));_0x548676(_0x2c4057[_0x4923('0x15')][_0x4923('0x14')]);}})[_0x4923('0x16')](function(_0x559e4a){logger[_0x4923('0x11')](_0x4923('0x13'),_0x133b0d,_0x559e4a);_0x1fffc2(_0x559e4a);});});}exports[_0x4923('0x17')]=function(_0x1be04d){var _0x517b95=this;return new Promise(function(_0x50fd18,_0x16955b){return db['Campaign'][_0x4923('0x18')]({'raw':_0x1be04d[_0x4923('0x19')]?_0x1be04d['options'][_0x4923('0x1a')]===undefined?!![]:![]:!![],'where':_0x1be04d[_0x4923('0x19')]?_0x1be04d[_0x4923('0x19')][_0x4923('0x1b')]||null:null,'attributes':_0x1be04d['options']?_0x1be04d[_0x4923('0x19')][_0x4923('0x1c')]||null:null,'limit':_0x1be04d['options']?_0x1be04d[_0x4923('0x19')]['limit']||null:null,'include':_0x1be04d[_0x4923('0x19')]?_0x1be04d[_0x4923('0x19')]['include']?_[_0x4923('0x1d')](_0x1be04d[_0x4923('0x19')][_0x4923('0x1e')],function(_0x161cf9){return{'model':db[_0x161cf9[_0x4923('0x1f')]],'as':_0x161cf9['as'],'attributes':_0x161cf9[_0x4923('0x1c')],'include':_0x161cf9[_0x4923('0x1e')]?_['map'](_0x161cf9['include'],function(_0x23ec97){return{'model':db[_0x23ec97[_0x4923('0x1f')]],'as':_0x23ec97['as'],'attributes':_0x23ec97[_0x4923('0x1c')],'include':_0x23ec97[_0x4923('0x1e')]?_[_0x4923('0x1d')](_0x23ec97[_0x4923('0x1e')],function(_0x13681b){return{'model':db[_0x13681b[_0x4923('0x1f')]],'as':_0x13681b['as'],'attributes':_0x13681b[_0x4923('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4923('0xb')](function(_0x3a7852){logger['info'](_0x4923('0x17'),_0x1be04d);logger[_0x4923('0xe')](_0x4923('0x17'),_0x1be04d,JSON[_0x4923('0x10')](_0x3a7852));_0x50fd18(_0x3a7852);})[_0x4923('0x16')](function(_0x47158c){logger[_0x4923('0x11')](_0x4923('0x17'),_0x47158c[_0x4923('0x14')],_0x1be04d);_0x16955b(_0x517b95[_0x4923('0x11')](0x1f4,_0x47158c[_0x4923('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index fd7960f..7001a87 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 _0x4444=['put','delete','removeBlackLists','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','index','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists'];(function(_0x3023b8,_0x11daa4){var _0x51bbc2=function(_0x1e92a4){while(--_0x1e92a4){_0x3023b8['push'](_0x3023b8['shift']());}};_0x51bbc2(++_0x11daa4);}(_0x4444,0xa3));var _0x4444=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x4444[_0x40dd56];return _0x4f850f;};'use strict';var multer=require(_0x4444('0x0'));var util=require(_0x4444('0x1'));var path=require('path');var timeout=require(_0x4444('0x2'));var express=require(_0x4444('0x3'));var router=express[_0x4444('0x4')]();var fs_extra=require(_0x4444('0x5'));var auth=require(_0x4444('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4444('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4444('0x8')]);router[_0x4444('0x9')](_0x4444('0xa'),auth[_0x4444('0xb')](),controller[_0x4444('0xc')]);router[_0x4444('0x9')]('/:id/hoppers',auth[_0x4444('0xb')](),controller[_0x4444('0xd')]);router[_0x4444('0x9')](_0x4444('0xe'),auth[_0x4444('0xb')](),controller[_0x4444('0xf')]);router[_0x4444('0x9')](_0x4444('0x10'),auth[_0x4444('0xb')](),controller[_0x4444('0x11')]);router[_0x4444('0x9')](_0x4444('0x12'),auth['isAuthenticated'](),controller[_0x4444('0x13')]);router['get'](_0x4444('0x14'),auth[_0x4444('0xb')](),controller[_0x4444('0x15')]);router[_0x4444('0x9')]('/:id/blacklists',auth[_0x4444('0xb')](),controller[_0x4444('0x16')]);router[_0x4444('0x17')]('/',auth[_0x4444('0xb')](),controller[_0x4444('0x18')]);router[_0x4444('0x17')](_0x4444('0x19'),auth[_0x4444('0xb')](),controller[_0x4444('0x1a')]);router[_0x4444('0x17')](_0x4444('0x14'),auth['isAuthenticated'](),controller[_0x4444('0x1b')]);router[_0x4444('0x17')]('/:id/blacklists',auth[_0x4444('0xb')](),controller[_0x4444('0x1c')]);router[_0x4444('0x1d')](_0x4444('0xa'),auth[_0x4444('0xb')](),controller['update']);router[_0x4444('0x1e')]('/:id',auth[_0x4444('0xb')](),controller['destroy']);router[_0x4444('0x1e')](_0x4444('0x14'),auth[_0x4444('0xb')](),controller['removeLists']);router[_0x4444('0x1e')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x4444('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xc5b1=['update','destroy','removeLists','delete','removeBlackLists','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists'];(function(_0x1376c2,_0x2a07ef){var _0x39232a=function(_0x43d810){while(--_0x43d810){_0x1376c2['push'](_0x1376c2['shift']());}};_0x39232a(++_0x2a07ef);}(_0xc5b1,0x106));var _0x1c5b=function(_0x5740bb,_0x215865){_0x5740bb=_0x5740bb-0x0;var _0x60a2d2=_0xc5b1[_0x5740bb];return _0x60a2d2;};'use strict';var multer=require(_0x1c5b('0x0'));var util=require(_0x1c5b('0x1'));var path=require(_0x1c5b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c5b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1c5b('0x4'));var config=require(_0x1c5b('0x5'));var controller=require('./campaign.controller');router[_0x1c5b('0x6')]('/',auth['isAuthenticated'](),controller[_0x1c5b('0x7')]);router[_0x1c5b('0x6')](_0x1c5b('0x8'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0xa')]);router['get'](_0x1c5b('0xb'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0xc')]);router[_0x1c5b('0x6')](_0x1c5b('0xd'),auth['isAuthenticated'](),controller[_0x1c5b('0xe')]);router[_0x1c5b('0x6')](_0x1c5b('0xf'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x10')]);router['get']('/:id/hopper_black',auth[_0x1c5b('0x9')](),controller['getHopperBlacks']);router['get'](_0x1c5b('0x11'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x12')]);router[_0x1c5b('0x6')](_0x1c5b('0x13'),auth[_0x1c5b('0x9')](),controller['getBlackLists']);router[_0x1c5b('0x14')]('/',auth['isAuthenticated'](),controller[_0x1c5b('0x15')]);router[_0x1c5b('0x14')](_0x1c5b('0x16'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x17')]);router[_0x1c5b('0x14')](_0x1c5b('0x11'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x18')]);router[_0x1c5b('0x14')](_0x1c5b('0x13'),auth['isAuthenticated'](),controller[_0x1c5b('0x19')]);router['put']('/:id',auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x1a')]);router['delete']('/:id',auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x1b')]);router['delete'](_0x1c5b('0x11'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x1c')]);router[_0x1c5b('0x1d')](_0x1c5b('0x13'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x1e')]);module[_0x1c5b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 239d9a5..ef98ba9 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 _0x9596=['sequelize','STRING','TEXT','medium','VIRTUAL'];(function(_0x477730,_0x57edc6){var _0x2399a6=function(_0x215be4){while(--_0x215be4){_0x477730['push'](_0x477730['shift']());}};_0x2399a6(++_0x57edc6);}(_0x9596,0xc3));var _0x6959=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x9596[_0x5f382f];return _0x3bb11b;};'use strict';var Sequelize=require(_0x6959('0x0'));module['exports']={'key':{'type':Sequelize[_0x6959('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x6959('0x2')],'length':_0x6959('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6959('0x1')]},'name':{'type':Sequelize[_0x6959('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x2ca6=['getDataValue','sequelize','exports','STRING','TEXT','medium','VIRTUAL'];(function(_0x390791,_0x56a05f){var _0x543bc6=function(_0x5a5e8f){while(--_0x5a5e8f){_0x390791['push'](_0x390791['shift']());}};_0x543bc6(++_0x56a05f);}(_0x2ca6,0xb0));var _0x62ca=function(_0x2489d5,_0x118404){_0x2489d5=_0x2489d5-0x0;var _0x453f4e=_0x2ca6[_0x2489d5];return _0x453f4e;};'use strict';var Sequelize=require(_0x62ca('0x0'));module[_0x62ca('0x1')]={'key':{'type':Sequelize[_0x62ca('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x62ca('0x3')],'length':_0x62ca('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x62ca('0x5')],'get':function(){return this[_0x62ca('0x6')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 9bab4e4..455191a 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 _0x5cf3=['name','send','index','CannedAnswer','rawAttributes','type','model','keys','filters','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error'];(function(_0x4025c6,_0x5f0390){var _0x5558de=function(_0x2f85cb){while(--_0x2f85cb){_0x4025c6['push'](_0x4025c6['shift']());}};_0x5558de(++_0x5f0390);}(_0x5cf3,0x131));var _0x35cf=function(_0x4b55cb,_0x49791b){_0x4b55cb=_0x4b55cb-0x0;var _0x2631df=_0x5cf3[_0x4b55cb];return _0x2631df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35cf('0x0'));var zipdir=require(_0x35cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35cf('0x2'));var moment=require(_0x35cf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x35cf('0x4'));var util=require(_0x35cf('0x5'));var path=require(_0x35cf('0x6'));var sox=require(_0x35cf('0x7'));var csv=require(_0x35cf('0x8'));var ejs=require(_0x35cf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35cf('0xa'));var squel=require(_0x35cf('0xb'));var crypto=require(_0x35cf('0xc'));var jsforce=require(_0x35cf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35cf('0xe'));var Papa=require(_0x35cf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x35cf('0x10'));var as=require(_0x35cf('0x11'));var hardwareService=require(_0x35cf('0x12'));var logger=require(_0x35cf('0x13'))(_0x35cf('0x14'));var utils=require(_0x35cf('0x15'));var config=require(_0x35cf('0x16'));var licenseUtil=require(_0x35cf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527695,_0x195282){_0x195282=_0x195282||0xcc;return function(_0x1d2ef0){if(_0x1d2ef0){return _0x527695[_0x35cf('0x18')](_0x195282);}return _0x527695[_0x35cf('0x19')](_0x195282)[_0x35cf('0x1a')]();};}function respondWithResult(_0x5f53c1,_0x4e054f){_0x4e054f=_0x4e054f||0xc8;return function(_0x1f984e){if(_0x1f984e){return _0x5f53c1[_0x35cf('0x19')](_0x4e054f)[_0x35cf('0x1b')](_0x1f984e);}};}function respondWithFilteredResult(_0x32d90f,_0x602d2d){return function(_0x5efab8){if(_0x5efab8){var _0x2a853c=typeof _0x602d2d[_0x35cf('0x1c')]==='undefined'&&typeof _0x602d2d['limit']==='undefined';var _0x50c02a=_0x5efab8[_0x35cf('0x1d')];var _0x1961c6=_0x2a853c?0x0:_0x602d2d[_0x35cf('0x1c')];var _0x12c11d=_0x2a853c?_0x5efab8['count']:_0x602d2d[_0x35cf('0x1c')]+_0x602d2d[_0x35cf('0x1e')];var _0x32755c;if(_0x12c11d>=_0x50c02a){_0x12c11d=_0x50c02a;_0x32755c=0xc8;}else{_0x32755c=0xce;}_0x32d90f['status'](_0x32755c);return _0x32d90f[_0x35cf('0x1f')](_0x35cf('0x20'),_0x1961c6+'-'+_0x12c11d+'/'+_0x50c02a)[_0x35cf('0x1b')](_0x5efab8);}return null;};}function patchUpdates(_0x354a8c){return function(_0x2a99b3){try{jsonpatch[_0x35cf('0x21')](_0x2a99b3,_0x354a8c,!![]);}catch(_0x1487a8){return BPromise[_0x35cf('0x22')](_0x1487a8);}return _0x2a99b3[_0x35cf('0x23')]();};}function saveUpdates(_0x451386,_0x442bdd){return function(_0x1b608c){if(_0x1b608c){return _0x1b608c[_0x35cf('0x24')](_0x451386)[_0x35cf('0x25')](function(_0x3b9f6d){return _0x3b9f6d;});}return null;};}function removeEntity(_0x503db3,_0x3e1683){return function(_0x5e45f9){if(_0x5e45f9){return _0x5e45f9[_0x35cf('0x26')]()[_0x35cf('0x25')](function(){var _0x3dc4d6=_0x5e45f9[_0x35cf('0x27')]({'plain':!![]});var _0x26490c=_0x35cf('0x28');return db[_0x35cf('0x29')]['destroy']({'where':{'type':_0x26490c,'resourceId':_0x3dc4d6['id']}})['then'](function(){return _0x5e45f9;});})[_0x35cf('0x25')](function(){_0x503db3[_0x35cf('0x19')](0xcc)[_0x35cf('0x1a')]();});}};}function handleEntityNotFound(_0x5e0fa1,_0x3c635b){return function(_0x126d53){if(!_0x126d53){_0x5e0fa1[_0x35cf('0x18')](0x194);}return _0x126d53;};}function handleError(_0x18cfd3,_0x346b35){_0x346b35=_0x346b35||0x1f4;return function(_0x18f006){logger[_0x35cf('0x2a')](_0x18f006['stack']);if(_0x18f006[_0x35cf('0x2b')]){delete _0x18f006[_0x35cf('0x2b')];}_0x18cfd3[_0x35cf('0x19')](_0x346b35)[_0x35cf('0x2c')](_0x18f006);};}exports[_0x35cf('0x2d')]=function(_0x249296,_0x499012){var _0x47f0f2={},_0x566624={},_0x1a7ead={'count':0x0,'rows':[]};var _0xadf2f8=_['map'](db[_0x35cf('0x2e')][_0x35cf('0x2f')],function(_0x5c72fa){return{'name':_0x5c72fa['fieldName'],'type':_0x5c72fa[_0x35cf('0x30')]['key']};});_0x566624[_0x35cf('0x31')]=_['map'](_0xadf2f8,_0x35cf('0x2b'));_0x566624['query']=_[_0x35cf('0x32')](_0x249296['query']);_0x566624[_0x35cf('0x33')]=_['intersection'](_0x566624[_0x35cf('0x31')],_0x566624[_0x35cf('0x34')]);_0x47f0f2['attributes']=_[_0x35cf('0x35')](_0x566624[_0x35cf('0x31')],qs[_0x35cf('0x36')](_0x249296[_0x35cf('0x34')][_0x35cf('0x36')]));_0x47f0f2[_0x35cf('0x37')]=_0x47f0f2[_0x35cf('0x37')][_0x35cf('0x38')]?_0x47f0f2[_0x35cf('0x37')]:_0x566624[_0x35cf('0x31')];if(!_0x249296[_0x35cf('0x34')]['hasOwnProperty'](_0x35cf('0x39'))){_0x47f0f2[_0x35cf('0x1e')]=qs[_0x35cf('0x1e')](_0x249296[_0x35cf('0x34')]['limit']);_0x47f0f2['offset']=qs[_0x35cf('0x1c')](_0x249296['query'][_0x35cf('0x1c')]);}_0x47f0f2[_0x35cf('0x3a')]=qs[_0x35cf('0x3b')](_0x249296[_0x35cf('0x34')][_0x35cf('0x3b')]);_0x47f0f2[_0x35cf('0x3c')]=qs[_0x35cf('0x33')](_[_0x35cf('0x3d')](_0x249296['query'],_0x566624[_0x35cf('0x33')]),_0xadf2f8);if(_0x249296[_0x35cf('0x34')][_0x35cf('0x3e')]){_0x47f0f2[_0x35cf('0x3c')]=_[_0x35cf('0x3f')](_0x47f0f2[_0x35cf('0x3c')],{'$or':[{'key':{'$like':'%'+_0x249296[_0x35cf('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x249296[_0x35cf('0x34')][_0x35cf('0x3e')]+'%'}}]});}_0x47f0f2=_[_0x35cf('0x3f')]({},_0x47f0f2,_0x249296[_0x35cf('0x40')]);var _0x5c9e46={'where':_0x47f0f2['where']};return db['CannedAnswer']['count'](_0x5c9e46)[_0x35cf('0x25')](function(_0xdd747f){_0x1a7ead['count']=_0xdd747f;if(_0x249296[_0x35cf('0x34')]['includeAll']){_0x47f0f2[_0x35cf('0x41')]=[{'all':!![]}];}return db[_0x35cf('0x2e')]['findAll'](_0x47f0f2);})[_0x35cf('0x25')](function(_0x5c908c){_0x1a7ead[_0x35cf('0x42')]=_0x5c908c;return _0x1a7ead;})[_0x35cf('0x25')](respondWithFilteredResult(_0x499012,_0x47f0f2))[_0x35cf('0x43')](handleError(_0x499012,null));};exports[_0x35cf('0x44')]=function(_0x42346c,_0x5c3953){var _0x231fc5={'raw':!![],'where':{'id':_0x42346c[_0x35cf('0x45')]['id']}},_0x2aeb7a={};_0x2aeb7a[_0x35cf('0x31')]=_[_0x35cf('0x32')](db[_0x35cf('0x2e')][_0x35cf('0x2f')]);_0x2aeb7a[_0x35cf('0x34')]=_[_0x35cf('0x32')](_0x42346c['query']);_0x2aeb7a[_0x35cf('0x33')]=_[_0x35cf('0x35')](_0x2aeb7a[_0x35cf('0x31')],_0x2aeb7a[_0x35cf('0x34')]);_0x231fc5[_0x35cf('0x37')]=_[_0x35cf('0x35')](_0x2aeb7a[_0x35cf('0x31')],qs[_0x35cf('0x36')](_0x42346c[_0x35cf('0x34')]['fields']));_0x231fc5[_0x35cf('0x37')]=_0x231fc5[_0x35cf('0x37')]['length']?_0x231fc5['attributes']:_0x2aeb7a[_0x35cf('0x31')];if(_0x42346c[_0x35cf('0x34')][_0x35cf('0x46')]){_0x231fc5[_0x35cf('0x41')]=[{'all':!![]}];}_0x231fc5=_[_0x35cf('0x3f')]({},_0x231fc5,_0x42346c[_0x35cf('0x40')]);return db[_0x35cf('0x2e')][_0x35cf('0x47')](_0x231fc5)['then'](handleEntityNotFound(_0x5c3953,null))[_0x35cf('0x25')](respondWithResult(_0x5c3953,null))['catch'](handleError(_0x5c3953,null));};exports[_0x35cf('0x24')]=function(_0x59c23a,_0x564ca5){if(_0x59c23a[_0x35cf('0x48')]['id']){delete _0x59c23a[_0x35cf('0x48')]['id'];}return db[_0x35cf('0x2e')][_0x35cf('0x47')]({'where':{'id':_0x59c23a[_0x35cf('0x45')]['id']}})[_0x35cf('0x25')](handleEntityNotFound(_0x564ca5,null))[_0x35cf('0x25')](saveUpdates(_0x59c23a[_0x35cf('0x48')],null))[_0x35cf('0x25')](respondWithResult(_0x564ca5,null))[_0x35cf('0x43')](handleError(_0x564ca5,null));};exports[_0x35cf('0x26')]=function(_0x4675a8,_0x554be2){return db[_0x35cf('0x2e')][_0x35cf('0x47')]({'where':{'id':_0x4675a8[_0x35cf('0x45')]['id']}})[_0x35cf('0x25')](handleEntityNotFound(_0x554be2,null))[_0x35cf('0x25')](removeEntity(_0x554be2,null))[_0x35cf('0x43')](handleError(_0x554be2,null));};exports[_0x35cf('0x49')]=function(_0x1f8179,_0x518c91){var _0x5e0248={'key':_0x1f8179[_0x35cf('0x48')][_0x35cf('0x4a')]};if(_0x1f8179[_0x35cf('0x48')][_0x35cf('0x4b')]){_0x5e0248['MailAccountId']=_0x1f8179[_0x35cf('0x48')][_0x35cf('0x4b')];}else if(_0x1f8179['body'][_0x35cf('0x4c')]){_0x5e0248['SmsAccountId']=_0x1f8179['body'][_0x35cf('0x4c')];}else if(_0x1f8179[_0x35cf('0x48')]['OpenchannelAccountId']){_0x5e0248[_0x35cf('0x4d')]=_0x1f8179['body'][_0x35cf('0x4d')];}else if(_0x1f8179[_0x35cf('0x48')]['ChatWebsiteId']){_0x5e0248['ChatWebsiteId']=_0x1f8179['body'][_0x35cf('0x4e')];}return db[_0x35cf('0x2e')][_0x35cf('0x47')]({'where':_0x5e0248})[_0x35cf('0x25')](function(_0x3985c5){if(_0x3985c5){throw new db[(_0x35cf('0x4f'))][(_0x35cf('0x50'))](_0x35cf('0x51'));}return db[_0x35cf('0x2e')][_0x35cf('0x49')](_0x1f8179[_0x35cf('0x48')]);})[_0x35cf('0x25')](function(_0x562e51){var _0x2be6a0=_0x1f8179[_0x35cf('0x52')][_0x35cf('0x27')]({'plain':!![]});if(!_0x2be6a0)throw new Error(_0x35cf('0x53'));if(_0x2be6a0[_0x35cf('0x54')]===_0x35cf('0x52')){var _0x4e9419=_0x562e51[_0x35cf('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x35cf('0x47')]({'where':{'name':_0x35cf('0x28'),'userProfileId':_0x2be6a0[_0x35cf('0x55')]},'raw':!![]})['then'](function(_0x2a92d0){if(_0x2a92d0&&_0x2a92d0[_0x35cf('0x56')]===0x0){return db[_0x35cf('0x29')][_0x35cf('0x49')]({'name':_0x4e9419['name'],'resourceId':_0x4e9419['id'],'type':_0x2a92d0['name'],'sectionId':_0x2a92d0['id']},{})[_0x35cf('0x25')](function(){return _0x562e51;});}else{return _0x562e51;}})[_0x35cf('0x43')](function(_0x2f36ca){logger[_0x35cf('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f36ca);throw _0x2f36ca;});}return _0x562e51;})[_0x35cf('0x25')](respondWithResult(_0x518c91,0xc9))['catch'](handleError(_0x518c91,null));}; \ No newline at end of file +var _0xffdc=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','rawAttributes','type'];(function(_0xd80a30,_0x15e548){var _0x1b0c5e=function(_0x4893d6){while(--_0x4893d6){_0xd80a30['push'](_0xd80a30['shift']());}};_0x1b0c5e(++_0x15e548);}(_0xffdc,0x182));var _0xcffd=function(_0x53a8bf,_0x59b79f){_0x53a8bf=_0x53a8bf-0x0;var _0x1cee30=_0xffdc[_0x53a8bf];return _0x1cee30;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcffd('0x0'));var jsonpatch=require(_0xcffd('0x1'));var rp=require(_0xcffd('0x2'));var moment=require('moment');var BPromise=require(_0xcffd('0x3'));var Mustache=require(_0xcffd('0x4'));var util=require(_0xcffd('0x5'));var path=require('path');var sox=require(_0xcffd('0x6'));var csv=require(_0xcffd('0x7'));var ejs=require(_0xcffd('0x8'));var fs=require('fs');var fs_extra=require(_0xcffd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcffd('0xa'));var jsforce=require(_0xcffd('0xb'));var deskjs=require(_0xcffd('0xc'));var toCsv=require(_0xcffd('0x7'));var querystring=require(_0xcffd('0xd'));var Papa=require(_0xcffd('0xe'));var Redis=require(_0xcffd('0xf'));var authService=require(_0xcffd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcffd('0x11'));var hardwareService=require(_0xcffd('0x12'));var logger=require(_0xcffd('0x13'))(_0xcffd('0x14'));var utils=require(_0xcffd('0x15'));var config=require(_0xcffd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcffd('0x17'))['db'];function respondWithStatusCode(_0x84983f,_0x47879e){_0x47879e=_0x47879e||0xcc;return function(_0x2d87cc){if(_0x2d87cc){return _0x84983f[_0xcffd('0x18')](_0x47879e);}return _0x84983f[_0xcffd('0x19')](_0x47879e)['end']();};}function respondWithResult(_0x559b03,_0x70832c){_0x70832c=_0x70832c||0xc8;return function(_0xc38187){if(_0xc38187){return _0x559b03['status'](_0x70832c)[_0xcffd('0x1a')](_0xc38187);}};}function respondWithFilteredResult(_0x445a73,_0x23babd){return function(_0x57cc4f){if(_0x57cc4f){var _0x1d554a=typeof _0x23babd['offset']==='undefined'&&typeof _0x23babd[_0xcffd('0x1b')]===_0xcffd('0x1c');var _0x5b2721=_0x57cc4f[_0xcffd('0x1d')];var _0x2e2fdc=_0x1d554a?0x0:_0x23babd['offset'];var _0x3f143c=_0x1d554a?_0x57cc4f[_0xcffd('0x1d')]:_0x23babd[_0xcffd('0x1e')]+_0x23babd[_0xcffd('0x1b')];var _0x4ef531;if(_0x3f143c>=_0x5b2721){_0x3f143c=_0x5b2721;_0x4ef531=0xc8;}else{_0x4ef531=0xce;}_0x445a73[_0xcffd('0x19')](_0x4ef531);return _0x445a73[_0xcffd('0x1f')](_0xcffd('0x20'),_0x2e2fdc+'-'+_0x3f143c+'/'+_0x5b2721)[_0xcffd('0x1a')](_0x57cc4f);}return null;};}function patchUpdates(_0x20adad){return function(_0x177fe7){try{jsonpatch[_0xcffd('0x21')](_0x177fe7,_0x20adad,!![]);}catch(_0x1e60ea){return BPromise['reject'](_0x1e60ea);}return _0x177fe7[_0xcffd('0x22')]();};}function saveUpdates(_0x40f4e1,_0x8e199b){return function(_0x5895c9){if(_0x5895c9){return _0x5895c9[_0xcffd('0x23')](_0x40f4e1)[_0xcffd('0x24')](function(_0x473c82){return _0x473c82;});}return null;};}function removeEntity(_0x1c91a5,_0x39d8bd){return function(_0x5a8677){if(_0x5a8677){return _0x5a8677[_0xcffd('0x25')]()[_0xcffd('0x24')](function(){var _0x1ae068=_0x5a8677['get']({'plain':!![]});var _0x2aa886=_0xcffd('0x26');return db[_0xcffd('0x27')]['destroy']({'where':{'type':_0x2aa886,'resourceId':_0x1ae068['id']}})['then'](function(){return _0x5a8677;});})['then'](function(){_0x1c91a5['status'](0xcc)[_0xcffd('0x28')]();});}};}function handleEntityNotFound(_0x5b0787,_0x2ac475){return function(_0x30415f){if(!_0x30415f){_0x5b0787[_0xcffd('0x18')](0x194);}return _0x30415f;};}function handleError(_0x39dc42,_0x1684bc){_0x1684bc=_0x1684bc||0x1f4;return function(_0x30a96c){logger[_0xcffd('0x29')](_0x30a96c[_0xcffd('0x2a')]);if(_0x30a96c[_0xcffd('0x2b')]){delete _0x30a96c[_0xcffd('0x2b')];}_0x39dc42[_0xcffd('0x19')](_0x1684bc)[_0xcffd('0x2c')](_0x30a96c);};}exports[_0xcffd('0x2d')]=function(_0x3bded6,_0x4ef4a8){var _0x37e40e={},_0x4f4b35={},_0xe76191={'count':0x0,'rows':[]};var _0x103ff4=_['map'](db[_0xcffd('0x2e')][_0xcffd('0x2f')],function(_0x14c216){return{'name':_0x14c216['fieldName'],'type':_0x14c216[_0xcffd('0x30')][_0xcffd('0x31')]};});_0x4f4b35[_0xcffd('0x32')]=_['map'](_0x103ff4,_0xcffd('0x2b'));_0x4f4b35[_0xcffd('0x33')]=_[_0xcffd('0x34')](_0x3bded6[_0xcffd('0x33')]);_0x4f4b35[_0xcffd('0x35')]=_[_0xcffd('0x36')](_0x4f4b35[_0xcffd('0x32')],_0x4f4b35[_0xcffd('0x33')]);_0x37e40e[_0xcffd('0x37')]=_[_0xcffd('0x36')](_0x4f4b35['model'],qs[_0xcffd('0x38')](_0x3bded6[_0xcffd('0x33')][_0xcffd('0x38')]));_0x37e40e[_0xcffd('0x37')]=_0x37e40e['attributes'][_0xcffd('0x39')]?_0x37e40e['attributes']:_0x4f4b35[_0xcffd('0x32')];if(!_0x3bded6[_0xcffd('0x33')][_0xcffd('0x3a')]('nolimit')){_0x37e40e['limit']=qs[_0xcffd('0x1b')](_0x3bded6[_0xcffd('0x33')][_0xcffd('0x1b')]);_0x37e40e[_0xcffd('0x1e')]=qs[_0xcffd('0x1e')](_0x3bded6[_0xcffd('0x33')][_0xcffd('0x1e')]);}_0x37e40e['order']=qs[_0xcffd('0x3b')](_0x3bded6['query'][_0xcffd('0x3b')]);_0x37e40e[_0xcffd('0x3c')]=qs[_0xcffd('0x35')](_[_0xcffd('0x3d')](_0x3bded6[_0xcffd('0x33')],_0x4f4b35['filters']),_0x103ff4);if(_0x3bded6[_0xcffd('0x33')][_0xcffd('0x3e')]){_0x37e40e[_0xcffd('0x3c')]=_[_0xcffd('0x3f')](_0x37e40e[_0xcffd('0x3c')],{'$or':[{'key':{'$like':'%'+_0x3bded6[_0xcffd('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x3bded6[_0xcffd('0x33')][_0xcffd('0x3e')]+'%'}}]});}_0x37e40e=_[_0xcffd('0x3f')]({},_0x37e40e,_0x3bded6[_0xcffd('0x40')]);var _0x3545a2={'where':_0x37e40e['where']};return db[_0xcffd('0x2e')][_0xcffd('0x1d')](_0x3545a2)[_0xcffd('0x24')](function(_0xb8a04f){_0xe76191[_0xcffd('0x1d')]=_0xb8a04f;if(_0x3bded6[_0xcffd('0x33')][_0xcffd('0x41')]){_0x37e40e[_0xcffd('0x42')]=[{'all':!![]}];}return db[_0xcffd('0x2e')][_0xcffd('0x43')](_0x37e40e);})[_0xcffd('0x24')](function(_0x5333b2){_0xe76191[_0xcffd('0x44')]=_0x5333b2;return _0xe76191;})[_0xcffd('0x24')](respondWithFilteredResult(_0x4ef4a8,_0x37e40e))[_0xcffd('0x45')](handleError(_0x4ef4a8,null));};exports['show']=function(_0x5371e1,_0x4e5135){var _0x1eeb18={'raw':!![],'where':{'id':_0x5371e1['params']['id']}},_0x43b7bd={};_0x43b7bd['model']=_[_0xcffd('0x34')](db['CannedAnswer'][_0xcffd('0x2f')]);_0x43b7bd[_0xcffd('0x33')]=_['keys'](_0x5371e1[_0xcffd('0x33')]);_0x43b7bd['filters']=_['intersection'](_0x43b7bd[_0xcffd('0x32')],_0x43b7bd['query']);_0x1eeb18[_0xcffd('0x37')]=_[_0xcffd('0x36')](_0x43b7bd[_0xcffd('0x32')],qs['fields'](_0x5371e1[_0xcffd('0x33')]['fields']));_0x1eeb18[_0xcffd('0x37')]=_0x1eeb18[_0xcffd('0x37')][_0xcffd('0x39')]?_0x1eeb18[_0xcffd('0x37')]:_0x43b7bd[_0xcffd('0x32')];if(_0x5371e1['query'][_0xcffd('0x41')]){_0x1eeb18[_0xcffd('0x42')]=[{'all':!![]}];}_0x1eeb18=_['merge']({},_0x1eeb18,_0x5371e1[_0xcffd('0x40')]);return db['CannedAnswer'][_0xcffd('0x46')](_0x1eeb18)[_0xcffd('0x24')](handleEntityNotFound(_0x4e5135,null))['then'](respondWithResult(_0x4e5135,null))[_0xcffd('0x45')](handleError(_0x4e5135,null));};exports[_0xcffd('0x23')]=function(_0x8c83d5,_0x201e79){if(_0x8c83d5[_0xcffd('0x47')]['id']){delete _0x8c83d5[_0xcffd('0x47')]['id'];}return db[_0xcffd('0x2e')][_0xcffd('0x46')]({'where':{'id':_0x8c83d5[_0xcffd('0x48')]['id']}})[_0xcffd('0x24')](handleEntityNotFound(_0x201e79,null))[_0xcffd('0x24')](saveUpdates(_0x8c83d5[_0xcffd('0x47')],null))[_0xcffd('0x24')](respondWithResult(_0x201e79,null))[_0xcffd('0x45')](handleError(_0x201e79,null));};exports[_0xcffd('0x25')]=function(_0x11118f,_0x1fe955){return db[_0xcffd('0x2e')][_0xcffd('0x46')]({'where':{'id':_0x11118f[_0xcffd('0x48')]['id']}})['then'](handleEntityNotFound(_0x1fe955,null))[_0xcffd('0x24')](removeEntity(_0x1fe955,null))['catch'](handleError(_0x1fe955,null));};exports[_0xcffd('0x49')]=function(_0x570880,_0x147ae0){var _0x303749={'key':_0x570880['body']['key']};if(_0x570880['body'][_0xcffd('0x4a')]){_0x303749['MailAccountId']=_0x570880[_0xcffd('0x47')][_0xcffd('0x4a')];}else if(_0x570880[_0xcffd('0x47')][_0xcffd('0x4b')]){_0x303749[_0xcffd('0x4b')]=_0x570880[_0xcffd('0x47')][_0xcffd('0x4b')];}else if(_0x570880[_0xcffd('0x47')][_0xcffd('0x4c')]){_0x303749[_0xcffd('0x4c')]=_0x570880['body'][_0xcffd('0x4c')];}else if(_0x570880[_0xcffd('0x47')][_0xcffd('0x4d')]){_0x303749[_0xcffd('0x4d')]=_0x570880[_0xcffd('0x47')]['ChatWebsiteId'];}return db[_0xcffd('0x2e')][_0xcffd('0x46')]({'where':_0x303749})[_0xcffd('0x24')](function(_0x566912){if(_0x566912){throw new db[(_0xcffd('0x4e'))][(_0xcffd('0x4f'))](_0xcffd('0x50'));}return db[_0xcffd('0x2e')][_0xcffd('0x49')](_0x570880[_0xcffd('0x47')]);})[_0xcffd('0x24')](function(_0x25208b){var _0x29126a=_0x570880[_0xcffd('0x51')][_0xcffd('0x52')]({'plain':!![]});if(!_0x29126a)throw new Error(_0xcffd('0x53'));if(_0x29126a['role']==='user'){var _0x365b60=_0x25208b[_0xcffd('0x52')]({'plain':!![]});return db[_0xcffd('0x54')][_0xcffd('0x46')]({'where':{'name':_0xcffd('0x26'),'userProfileId':_0x29126a['userProfileId']},'raw':!![]})['then'](function(_0x30f363){if(_0x30f363&&_0x30f363[_0xcffd('0x55')]===0x0){return db[_0xcffd('0x27')][_0xcffd('0x49')]({'name':_0x365b60[_0xcffd('0x2b')],'resourceId':_0x365b60['id'],'type':_0x30f363[_0xcffd('0x2b')],'sectionId':_0x30f363['id']},{})[_0xcffd('0x24')](function(){return _0x25208b;});}else{return _0x25208b;}})[_0xcffd('0x45')](function(_0xb8968d){logger[_0xcffd('0x29')](_0xcffd('0x56'),_0xb8968d);throw _0xb8968d;});}return _0x25208b;})[_0xcffd('0x24')](respondWithResult(_0x147ae0,0xc9))[_0xcffd('0x45')](handleError(_0x147ae0,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f402303..1c44cf7 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 _0x2bdf=['path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','api','request-promise'];(function(_0x5d084e,_0x16fe70){var _0x32fb37=function(_0x1da934){while(--_0x1da934){_0x5d084e['push'](_0x5d084e['shift']());}};_0x32fb37(++_0x16fe70);}(_0x2bdf,0xbd));var _0xf2bd=function(_0x3df1d2,_0x5e118e){_0x3df1d2=_0x3df1d2-0x0;var _0x33d99c=_0x2bdf[_0x3df1d2];return _0x33d99c;};'use strict';var _=require('lodash');var util=require(_0xf2bd('0x0'));var logger=require('../../config/logger')(_0xf2bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf2bd('0x2'));var fs=require('fs');var path=require(_0xf2bd('0x3'));var rimraf=require('rimraf');var config=require(_0xf2bd('0x4'));var attributes=require(_0xf2bd('0x5'));module[_0xf2bd('0x6')]=function(_0x55b3dd,_0x3fd9f0){return _0x55b3dd[_0xf2bd('0x7')](_0xf2bd('0x8'),attributes,{'tableName':_0xf2bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2bd('0xa'),'collate':_0xf2bd('0xb')});}; \ No newline at end of file +var _0xeebc=['lodash','../../config/logger','moment','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x218d1b,_0x5cf934){var _0x405ad0=function(_0x1e7d68){while(--_0x1e7d68){_0x218d1b['push'](_0x218d1b['shift']());}};_0x405ad0(++_0x5cf934);}(_0xeebc,0x79));var _0xceeb=function(_0x491703,_0x349860){_0x491703=_0x491703-0x0;var _0x53d338=_0xeebc[_0x491703];return _0x53d338;};'use strict';var _=require(_0xceeb('0x0'));var util=require('util');var logger=require(_0xceeb('0x1'))('api');var moment=require(_0xceeb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xceeb('0x3'));var config=require(_0xceeb('0x4'));var attributes=require(_0xceeb('0x5'));module[_0xceeb('0x6')]=function(_0x3bef84,_0x287895){return _0x3bef84[_0xceeb('0x7')](_0xceeb('0x8'),attributes,{'tableName':_0xceeb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xceeb('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index ce8cb21..4aded27 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(_0x17c76f,_0x1f3f24){var _0x351090=function(_0x1191ec){while(--_0x1191ec){_0x17c76f['push'](_0x17c76f['shift']());}};_0x351090(++_0x1f3f24);}(_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 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(_0x5420c5,_0x48d0ac){var _0x164f68=function(_0x15d032){while(--_0x15d032){_0x5420c5['push'](_0x5420c5['shift']());}};_0x164f68(++_0x48d0ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 b3a9249..4c7a613 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 _0x4955=['./cannedAnswer.controller','get','index','isAuthenticated','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4955,0x70));var _0x5495=function(_0x5b0328,_0x267672){_0x5b0328=_0x5b0328-0x0;var _0x325210=_0x4955[_0x5b0328];return _0x325210;};'use strict';var multer=require(_0x5495('0x0'));var util=require(_0x5495('0x1'));var path=require(_0x5495('0x2'));var timeout=require(_0x5495('0x3'));var express=require(_0x5495('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5495('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5495('0x6'));var controller=require(_0x5495('0x7'));router[_0x5495('0x8')]('/',auth['isAuthenticated'](),controller[_0x5495('0x9')]);router[_0x5495('0x8')]('/:id',auth[_0x5495('0xa')](),controller['show']);router[_0x5495('0xb')]('/',auth[_0x5495('0xa')](),controller[_0x5495('0xc')]);router[_0x5495('0xd')](_0x5495('0xe'),auth[_0x5495('0xa')](),controller['update']);router['delete']('/:id',auth[_0x5495('0xa')](),controller[_0x5495('0xf')]);module[_0x5495('0x10')]=router; \ No newline at end of file +var _0xb033=['isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','get'];(function(_0xc1da2f,_0x4aa1c5){var _0x11f1b1=function(_0x346f6a){while(--_0x346f6a){_0xc1da2f['push'](_0xc1da2f['shift']());}};_0x11f1b1(++_0x4aa1c5);}(_0xb033,0x180));var _0x3b03=function(_0x3616e4,_0xf41415){_0x3616e4=_0x3616e4-0x0;var _0x20c9ab=_0xb033[_0x3616e4];return _0x20c9ab;};'use strict';var multer=require('multer');var util=require(_0x3b03('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3b03('0x1'));var router=express[_0x3b03('0x2')]();var fs_extra=require(_0x3b03('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3b03('0x4'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x3b03('0x5')]('/',auth[_0x3b03('0x6')](),controller[_0x3b03('0x7')]);router[_0x3b03('0x5')](_0x3b03('0x8'),auth[_0x3b03('0x6')](),controller[_0x3b03('0x9')]);router[_0x3b03('0xa')]('/',auth[_0x3b03('0x6')](),controller[_0x3b03('0xb')]);router[_0x3b03('0xc')](_0x3b03('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3b03('0x8'),auth[_0x3b03('0x6')](),controller[_0x3b03('0xd')]);module[_0x3b03('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index cb77553..399ab9b 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 _0x24b3=['INTEGER','sequelize','exports','DATE','STRING'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x24b3,0xd3));var _0x324b=function(_0x3477bb,_0xe6ddaa){_0x3477bb=_0x3477bb-0x0;var _0x549bc2=_0x24b3[_0x3477bb];return _0x549bc2;};'use strict';var Sequelize=require(_0x324b('0x0'));module[_0x324b('0x1')]={'calldate':{'type':Sequelize[_0x324b('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x324b('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x324b('0x3')]},'dstchannel':{'type':Sequelize[_0x324b('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x324b('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x324b('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x324b('0x3')]},'userfield':{'type':Sequelize[_0x324b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x324b('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x324b('0x3')]}}; \ No newline at end of file +var _0xacc5=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x4ec40b,_0x242c15){var _0x360697=function(_0x1017e7){while(--_0x1017e7){_0x4ec40b['push'](_0x4ec40b['shift']());}};_0x360697(++_0x242c15);}(_0xacc5,0x104));var _0x5acc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xacc5[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x5acc('0x0'));module[_0x5acc('0x1')]={'calldate':{'type':Sequelize[_0x5acc('0x2')],'allowNull':![],'defaultValue':_0x5acc('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5acc('0x4')]},'dst':{'type':Sequelize[_0x5acc('0x4')]},'dcontext':{'type':Sequelize[_0x5acc('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x5acc('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5acc('0x4')]},'amaflags':{'type':Sequelize[_0x5acc('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x5acc('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x5acc('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x5acc('0x4')]},'type':{'type':Sequelize[_0x5acc('0x4')]},'tag':{'type':Sequelize[_0x5acc('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 0a820c6..3162bd6 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x1db9,0x176));var _0x91db=function(_0x51cffd,_0x4377a0){_0x51cffd=_0x51cffd-0x0;var _0x433a56=_0x1db9[_0x51cffd];return _0x433a56;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['Cdr'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['Cdr']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file +var _0x8819=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','zip-dir','fast-json-patch'];(function(_0xaf63c5,_0x3ad012){var _0x4f4ac5=function(_0x4d36b4){while(--_0x4d36b4){_0xaf63c5['push'](_0xaf63c5['shift']());}};_0x4f4ac5(++_0x3ad012);}(_0x8819,0x94));var _0x9881=function(_0x27411f,_0x38e1d9){_0x27411f=_0x27411f-0x0;var _0x37d0f5=_0x8819[_0x27411f];return _0x37d0f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9881('0x0'));var jsonpatch=require(_0x9881('0x1'));var rp=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var Mustache=require('mustache');var util=require(_0x9881('0x5'));var path=require(_0x9881('0x6'));var sox=require(_0x9881('0x7'));var csv=require(_0x9881('0x8'));var ejs=require(_0x9881('0x9'));var fs=require('fs');var fs_extra=require(_0x9881('0xa'));var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var as=require(_0x9881('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9881('0x11'))(_0x9881('0x12'));var utils=require(_0x9881('0x13'));var config=require(_0x9881('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9881('0x15'))['db'];function respondWithStatusCode(_0x26ee3f,_0x5c6d2d){_0x5c6d2d=_0x5c6d2d||0xcc;return function(_0x42850e){if(_0x42850e){return _0x26ee3f['sendStatus'](_0x5c6d2d);}return _0x26ee3f['status'](_0x5c6d2d)['end']();};}function respondWithResult(_0x58f526,_0x12794f){_0x12794f=_0x12794f||0xc8;return function(_0x3178d7){if(_0x3178d7){return _0x58f526[_0x9881('0x16')](_0x12794f)[_0x9881('0x17')](_0x3178d7);}};}function respondWithFilteredResult(_0x39d127,_0x1d57ea){return function(_0x4b9d1b){if(_0x4b9d1b){var _0x411513=typeof _0x1d57ea[_0x9881('0x18')]===_0x9881('0x19')&&typeof _0x1d57ea['limit']==='undefined';var _0x4c92c9=_0x4b9d1b[_0x9881('0x1a')];var _0x4c3493=_0x411513?0x0:_0x1d57ea[_0x9881('0x18')];var _0x5a9848=_0x411513?_0x4b9d1b['count']:_0x1d57ea[_0x9881('0x18')]+_0x1d57ea[_0x9881('0x1b')];var _0x1cbac3;if(_0x5a9848>=_0x4c92c9){_0x5a9848=_0x4c92c9;_0x1cbac3=0xc8;}else{_0x1cbac3=0xce;}_0x39d127[_0x9881('0x16')](_0x1cbac3);return _0x39d127[_0x9881('0x1c')](_0x9881('0x1d'),_0x4c3493+'-'+_0x5a9848+'/'+_0x4c92c9)[_0x9881('0x17')](_0x4b9d1b);}return null;};}function patchUpdates(_0x1243cc){return function(_0x1ee450){try{jsonpatch[_0x9881('0x1e')](_0x1ee450,_0x1243cc,!![]);}catch(_0x32ca84){return BPromise[_0x9881('0x1f')](_0x32ca84);}return _0x1ee450[_0x9881('0x20')]();};}function saveUpdates(_0x300fa6,_0x174b39){return function(_0x58485d){if(_0x58485d){return _0x58485d['update'](_0x300fa6)[_0x9881('0x21')](function(_0x513545){return _0x513545;});}return null;};}function removeEntity(_0x499461,_0x1ba558){return function(_0x30ed15){if(_0x30ed15){return _0x30ed15['destroy']()['then'](function(){_0x499461[_0x9881('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bddc1,_0x161f8d){return function(_0x16eeca){if(!_0x16eeca){_0x2bddc1[_0x9881('0x22')](0x194);}return _0x16eeca;};}function handleError(_0x2c3cd1,_0x14e6f9){_0x14e6f9=_0x14e6f9||0x1f4;return function(_0x2f6b7c){logger[_0x9881('0x23')](_0x2f6b7c[_0x9881('0x24')]);if(_0x2f6b7c[_0x9881('0x25')]){delete _0x2f6b7c[_0x9881('0x25')];}_0x2c3cd1[_0x9881('0x16')](_0x14e6f9)[_0x9881('0x26')](_0x2f6b7c);};}exports['index']=function(_0x31956e,_0x41fe0d){var _0x5c2815={},_0x236979={},_0x3d7120={'count':0x0,'rows':[]};var _0x4970be=_[_0x9881('0x27')](db[_0x9881('0x28')][_0x9881('0x29')],function(_0x204f2b){return{'name':_0x204f2b[_0x9881('0x2a')],'type':_0x204f2b[_0x9881('0x2b')][_0x9881('0x2c')]};});_0x236979[_0x9881('0x2d')]=_['map'](_0x4970be,_0x9881('0x25'));_0x236979[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x31956e[_0x9881('0x2e')]);_0x236979[_0x9881('0x30')]=_[_0x9881('0x31')](_0x236979['model'],_0x236979[_0x9881('0x2e')]);_0x5c2815[_0x9881('0x32')]=_['intersection'](_0x236979[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x31956e[_0x9881('0x2e')][_0x9881('0x33')]));_0x5c2815[_0x9881('0x32')]=_0x5c2815['attributes'][_0x9881('0x34')]?_0x5c2815[_0x9881('0x32')]:_0x236979[_0x9881('0x2d')];if(!_0x31956e[_0x9881('0x2e')][_0x9881('0x35')](_0x9881('0x36'))){_0x5c2815[_0x9881('0x1b')]=qs[_0x9881('0x1b')](_0x31956e[_0x9881('0x2e')][_0x9881('0x1b')]);_0x5c2815[_0x9881('0x18')]=qs[_0x9881('0x18')](_0x31956e[_0x9881('0x2e')][_0x9881('0x18')]);}_0x5c2815[_0x9881('0x37')]=qs[_0x9881('0x38')](_0x31956e['query'][_0x9881('0x38')]);_0x5c2815['where']=qs[_0x9881('0x30')](_['pick'](_0x31956e[_0x9881('0x2e')],_0x236979[_0x9881('0x30')]),_0x4970be);if(_0x31956e['query'][_0x9881('0x39')]){_0x5c2815['where']=_[_0x9881('0x3a')](_0x5c2815[_0x9881('0x3b')],{'$or':_[_0x9881('0x27')](_0x4970be,function(_0x204fc3){if(_0x204fc3['type']!==_0x9881('0x3c')){var _0x3d183e={};_0x3d183e[_0x204fc3[_0x9881('0x25')]]={'$like':'%'+_0x31956e[_0x9881('0x2e')][_0x9881('0x39')]+'%'};return _0x3d183e;}})});}_0x5c2815=_[_0x9881('0x3a')]({},_0x5c2815,_0x31956e[_0x9881('0x3d')]);var _0x4feb70={'where':_0x5c2815[_0x9881('0x3b')]};return db['Cdr'][_0x9881('0x1a')](_0x4feb70)[_0x9881('0x21')](function(_0x1c0396){_0x3d7120['count']=_0x1c0396;if(_0x31956e[_0x9881('0x2e')][_0x9881('0x3e')]){_0x5c2815[_0x9881('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0x9881('0x40')](_0x5c2815);})[_0x9881('0x21')](function(_0x4fe13d){_0x3d7120[_0x9881('0x41')]=_0x4fe13d;return _0x3d7120;})[_0x9881('0x21')](respondWithFilteredResult(_0x41fe0d,_0x5c2815))[_0x9881('0x42')](handleError(_0x41fe0d,null));};exports[_0x9881('0x43')]=function(_0x424ed1,_0x1eae2f){var _0x2ac606={'raw':!![],'where':{'id':_0x424ed1[_0x9881('0x44')]['id']}},_0x4421bc={};_0x4421bc[_0x9881('0x2d')]=_['keys'](db[_0x9881('0x28')][_0x9881('0x29')]);_0x4421bc[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x424ed1[_0x9881('0x2e')]);_0x4421bc['filters']=_[_0x9881('0x31')](_0x4421bc[_0x9881('0x2d')],_0x4421bc[_0x9881('0x2e')]);_0x2ac606[_0x9881('0x32')]=_['intersection'](_0x4421bc[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x424ed1[_0x9881('0x2e')]['fields']));_0x2ac606[_0x9881('0x32')]=_0x2ac606[_0x9881('0x32')][_0x9881('0x34')]?_0x2ac606[_0x9881('0x32')]:_0x4421bc[_0x9881('0x2d')];if(_0x424ed1[_0x9881('0x2e')][_0x9881('0x3e')]){_0x2ac606[_0x9881('0x3f')]=[{'all':!![]}];}_0x2ac606=_[_0x9881('0x3a')]({},_0x2ac606,_0x424ed1[_0x9881('0x3d')]);return db['Cdr'][_0x9881('0x45')](_0x2ac606)[_0x9881('0x21')](handleEntityNotFound(_0x1eae2f,null))[_0x9881('0x21')](respondWithResult(_0x1eae2f,null))['catch'](handleError(_0x1eae2f,null));};exports[_0x9881('0x46')]=function(_0x24a52b,_0x1e1f0f){return db['Cdr']['create'](_0x24a52b[_0x9881('0x47')],{})[_0x9881('0x21')](respondWithResult(_0x1e1f0f,0xc9))[_0x9881('0x42')](handleError(_0x1e1f0f,null));};exports[_0x9881('0x48')]=function(_0x49c478,_0x514263){if(_0x49c478[_0x9881('0x47')]['id']){delete _0x49c478[_0x9881('0x47')]['id'];}return db[_0x9881('0x28')]['find']({'where':{'id':_0x49c478[_0x9881('0x44')]['id']}})[_0x9881('0x21')](handleEntityNotFound(_0x514263,null))['then'](saveUpdates(_0x49c478[_0x9881('0x47')],null))[_0x9881('0x21')](respondWithResult(_0x514263,null))[_0x9881('0x42')](handleError(_0x514263,null));};exports[_0x9881('0x49')]=function(_0x21720a,_0x32cb89){return db[_0x9881('0x28')]['find']({'where':{'id':_0x21720a[_0x9881('0x44')]['id']}})['then'](handleEntityNotFound(_0x32cb89,null))[_0x9881('0x21')](removeEntity(_0x32cb89,null))[_0x9881('0x42')](handleError(_0x32cb89,null));};exports[_0x9881('0x4a')]=function(_0x16ca26,_0x590acc){return db['Cdr'][_0x9881('0x4a')]()[_0x9881('0x21')](respondWithResult(_0x590acc,null))[_0x9881('0x42')](handleError(_0x590acc,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e3947f9..b390a9d 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x243203,_0x2a9990){var _0x4707de=function(_0xc19be6){while(--_0xc19be6){_0x243203['push'](_0x243203['shift']());}};_0x4707de(++_0x2a9990);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xd94408,_0x31df46){var _0x5b06ee=function(_0x37911c){while(--_0x37911c){_0xd94408['push'](_0xd94408['shift']());}};_0x5b06ee(++_0x31df46);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index c53989f..68e4dec 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 _0xf38a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x494567,_0x1a98ce){var _0x500e3a=function(_0xd97c01){while(--_0xd97c01){_0x494567['push'](_0x494567['shift']());}};_0x500e3a(++_0x1a98ce);}(_0xf38a,0x1e3));var _0xaf38=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xf38a[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0xaf38('0x0'));var util=require(_0xaf38('0x1'));var moment=require(_0xaf38('0x2'));var BPromise=require(_0xaf38('0x3'));var rs=require(_0xaf38('0x4'));var fs=require('fs');var Redis=require(_0xaf38('0x5'));var db=require(_0xaf38('0x6'))['db'];var utils=require(_0xaf38('0x7'));var logger=require(_0xaf38('0x8'))(_0xaf38('0x9'));var config=require(_0xaf38('0xa'));var jayson=require(_0xaf38('0xb'));var client=jayson[_0xaf38('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x346b15,_0x1fe0a0,_0x22a35c){return new BPromise(function(_0x1aab61,_0x3075fd){return client[_0xaf38('0xd')](_0x346b15,_0x22a35c)[_0xaf38('0xe')](function(_0x2c0908){logger[_0xaf38('0xf')](_0xaf38('0x10'),_0x1fe0a0,_0xaf38('0x11'));logger[_0xaf38('0x12')](_0xaf38('0x13'),_0x1fe0a0,_0xaf38('0x11'),JSON['stringify'](_0x2c0908));if(_0x2c0908[_0xaf38('0x14')]){if(_0x2c0908[_0xaf38('0x14')][_0xaf38('0x15')]===0x1f4){logger[_0xaf38('0x14')](_0xaf38('0x10'),_0x1fe0a0,_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);return _0x3075fd(_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);}logger[_0xaf38('0x14')]('Cdr,\x20%s,\x20%s',_0x1fe0a0,_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);return _0x1aab61(_0x2c0908[_0xaf38('0x14')]['message']);}else{logger[_0xaf38('0xf')](_0xaf38('0x10'),_0x1fe0a0,_0xaf38('0x11'));_0x1aab61(_0x2c0908['result'][_0xaf38('0x16')]);}})['catch'](function(_0x12a1d7){logger['error']('Cdr,\x20%s,\x20%s',_0x1fe0a0,_0x12a1d7);_0x3075fd(_0x12a1d7);});});} \ No newline at end of file +var _0x8669=['randomstring','ioredis','../../config/logger','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8669,0x1eb));var _0x9866=function(_0x23e015,_0x44c03d){_0x23e015=_0x23e015-0x0;var _0x5e5208=_0x8669[_0x23e015];return _0x5e5208;};'use strict';var _=require('lodash');var util=require(_0x9866('0x0'));var moment=require(_0x9866('0x1'));var BPromise=require(_0x9866('0x2'));var rs=require(_0x9866('0x3'));var fs=require('fs');var Redis=require(_0x9866('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9866('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9866('0x6'));var client=jayson[_0x9866('0x7')][_0x9866('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41d1d5,_0x3a2382,_0x5c67a7){return new BPromise(function(_0x541138,_0x4687a9){return client['request'](_0x41d1d5,_0x5c67a7)[_0x9866('0x9')](function(_0x157d36){logger[_0x9866('0xa')](_0x9866('0xb'),_0x3a2382,_0x9866('0xc'));logger[_0x9866('0xd')](_0x9866('0xe'),_0x3a2382,'request\x20sent',JSON['stringify'](_0x157d36));if(_0x157d36[_0x9866('0xf')]){if(_0x157d36[_0x9866('0xf')][_0x9866('0x10')]===0x1f4){logger['error'](_0x9866('0xb'),_0x3a2382,_0x157d36[_0x9866('0xf')]['message']);return _0x4687a9(_0x157d36[_0x9866('0xf')][_0x9866('0x11')]);}logger[_0x9866('0xf')](_0x9866('0xb'),_0x3a2382,_0x157d36[_0x9866('0xf')][_0x9866('0x11')]);return _0x541138(_0x157d36[_0x9866('0xf')][_0x9866('0x11')]);}else{logger['info'](_0x9866('0xb'),_0x3a2382,'request\x20sent');_0x541138(_0x157d36[_0x9866('0x12')][_0x9866('0x11')]);}})['catch'](function(_0x42daf2){logger[_0x9866('0xf')](_0x9866('0xb'),_0x3a2382,_0x42daf2);_0x4687a9(_0x42daf2);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8d2a013..e7d226d 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(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x42f3e4,_0x2646fd){var _0x1d7aa6=function(_0x4a721d){while(--_0x4a721d){_0x42f3e4['push'](_0x42f3e4['shift']());}};_0x1d7aa6(++_0x2646fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 8708566..2d1e417 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 _0xeaa4=['exports','noop','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaa4,0x143));var _0x4eaa=function(_0xc1e593,_0x1b1f5f){_0xc1e593=_0xc1e593-0x0;var _0x4c4648=_0xeaa4[_0xc1e593];return _0x4c4648;};'use strict';var Sequelize=require(_0x4eaa('0x0'));module[_0x4eaa('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4eaa('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4eaa('0x3')]},'interval':{'type':Sequelize[_0x4eaa('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1912=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1912,0x9d));var _0x2191=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1912[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x2191('0x0'));module[_0x2191('0x1')]={'priority':{'type':Sequelize[_0x2191('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2191('0x3')],'allowNull':![],'defaultValue':_0x2191('0x4')},'appdata':{'type':Sequelize[_0x2191('0x5')]()},'description':{'type':Sequelize[_0x2191('0x3')]},'interval':{'type':Sequelize[_0x2191('0x3')],'defaultValue':_0x2191('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5078089..b758740 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','ChatApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x44278,_0x1bd66f){var _0x2d97f9=function(_0x18a1a3){while(--_0x18a1a3){_0x44278['push'](_0x44278['shift']());}};_0x2d97f9(++_0x1bd66f);}(_0x70e0,0x17b));var _0x070e=function(_0x362f85,_0x2b44f1){_0x362f85=_0x362f85-0x0;var _0x266308=_0x70e0[_0x362f85];return _0x266308;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0x0db9=['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','count','Content-Range','apply','reject','update','then','stack','name','send','show','model','keys','rawAttributes','query','intersection','fields','attributes','includeAll','include','merge','options','catch','body','ChatApplication','find','destroy','params','eml-format','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x0db9,0xa3));var _0x90db=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x0db9[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x90db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90db('0x1'));var moment=require(_0x90db('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x90db('0x3'));var util=require('util');var path=require(_0x90db('0x4'));var sox=require(_0x90db('0x5'));var csv=require('to-csv');var ejs=require(_0x90db('0x6'));var fs=require('fs');var fs_extra=require(_0x90db('0x7'));var _=require(_0x90db('0x8'));var squel=require(_0x90db('0x9'));var crypto=require(_0x90db('0xa'));var jsforce=require(_0x90db('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x90db('0xc'));var querystring=require(_0x90db('0xd'));var Papa=require(_0x90db('0xe'));var Redis=require(_0x90db('0xf'));var authService=require(_0x90db('0x10'));var qs=require(_0x90db('0x11'));var as=require(_0x90db('0x12'));var hardwareService=require(_0x90db('0x13'));var logger=require(_0x90db('0x14'))(_0x90db('0x15'));var utils=require(_0x90db('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x90db('0x17'));var db=require(_0x90db('0x18'))['db'];function respondWithStatusCode(_0x45ad3c,_0x436327){_0x436327=_0x436327||0xcc;return function(_0x1b410d){if(_0x1b410d){return _0x45ad3c[_0x90db('0x19')](_0x436327);}return _0x45ad3c[_0x90db('0x1a')](_0x436327)[_0x90db('0x1b')]();};}function respondWithResult(_0x7826f7,_0x309aea){_0x309aea=_0x309aea||0xc8;return function(_0x334e22){if(_0x334e22){return _0x7826f7[_0x90db('0x1a')](_0x309aea)[_0x90db('0x1c')](_0x334e22);}};}function respondWithFilteredResult(_0xda2abe,_0x544226){return function(_0x3124d4){if(_0x3124d4){var _0x5ef456=typeof _0x544226[_0x90db('0x1d')]===_0x90db('0x1e')&&typeof _0x544226[_0x90db('0x1f')]===_0x90db('0x1e');var _0x32ff04=_0x3124d4[_0x90db('0x20')];var _0x15e33e=_0x5ef456?0x0:_0x544226[_0x90db('0x1d')];var _0x24a16a=_0x5ef456?_0x3124d4[_0x90db('0x20')]:_0x544226['offset']+_0x544226[_0x90db('0x1f')];var _0x445a22;if(_0x24a16a>=_0x32ff04){_0x24a16a=_0x32ff04;_0x445a22=0xc8;}else{_0x445a22=0xce;}_0xda2abe['status'](_0x445a22);return _0xda2abe['set'](_0x90db('0x21'),_0x15e33e+'-'+_0x24a16a+'/'+_0x32ff04)[_0x90db('0x1c')](_0x3124d4);}return null;};}function patchUpdates(_0x300dc2){return function(_0x3a58c4){try{jsonpatch[_0x90db('0x22')](_0x3a58c4,_0x300dc2,!![]);}catch(_0x168eaf){return BPromise[_0x90db('0x23')](_0x168eaf);}return _0x3a58c4['save']();};}function saveUpdates(_0xb45340,_0x1aeab9){return function(_0x23934a){if(_0x23934a){return _0x23934a[_0x90db('0x24')](_0xb45340)['then'](function(_0x43028e){return _0x43028e;});}return null;};}function removeEntity(_0x5a98f6,_0x459068){return function(_0x19f9c6){if(_0x19f9c6){return _0x19f9c6['destroy']()[_0x90db('0x25')](function(){_0x5a98f6[_0x90db('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f8469,_0x3e3fbd){return function(_0x5b3c09){if(!_0x5b3c09){_0x2f8469[_0x90db('0x19')](0x194);}return _0x5b3c09;};}function handleError(_0xe026cf,_0x1cc660){_0x1cc660=_0x1cc660||0x1f4;return function(_0x94cd84){logger['error'](_0x94cd84[_0x90db('0x26')]);if(_0x94cd84[_0x90db('0x27')]){delete _0x94cd84[_0x90db('0x27')];}_0xe026cf[_0x90db('0x1a')](_0x1cc660)[_0x90db('0x28')](_0x94cd84);};}exports[_0x90db('0x29')]=function(_0x44b5b6,_0x3c7f67){var _0x4c6311={'raw':!![],'where':{'id':_0x44b5b6['params']['id']}},_0x3489d1={};_0x3489d1[_0x90db('0x2a')]=_[_0x90db('0x2b')](db['ChatApplication'][_0x90db('0x2c')]);_0x3489d1[_0x90db('0x2d')]=_[_0x90db('0x2b')](_0x44b5b6[_0x90db('0x2d')]);_0x3489d1['filters']=_[_0x90db('0x2e')](_0x3489d1[_0x90db('0x2a')],_0x3489d1[_0x90db('0x2d')]);_0x4c6311['attributes']=_['intersection'](_0x3489d1[_0x90db('0x2a')],qs[_0x90db('0x2f')](_0x44b5b6[_0x90db('0x2d')]['fields']));_0x4c6311[_0x90db('0x30')]=_0x4c6311[_0x90db('0x30')]['length']?_0x4c6311[_0x90db('0x30')]:_0x3489d1[_0x90db('0x2a')];if(_0x44b5b6['query'][_0x90db('0x31')]){_0x4c6311[_0x90db('0x32')]=[{'all':!![]}];}_0x4c6311=_[_0x90db('0x33')]({},_0x4c6311,_0x44b5b6[_0x90db('0x34')]);return db['ChatApplication']['find'](_0x4c6311)[_0x90db('0x25')](handleEntityNotFound(_0x3c7f67,null))['then'](respondWithResult(_0x3c7f67,null))[_0x90db('0x35')](handleError(_0x3c7f67,null));};exports[_0x90db('0x24')]=function(_0x45cebb,_0x540176){if(_0x45cebb[_0x90db('0x36')]['id']){delete _0x45cebb['body']['id'];}return db[_0x90db('0x37')][_0x90db('0x38')]({'where':{'id':_0x45cebb['params']['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x540176,null))[_0x90db('0x25')](saveUpdates(_0x45cebb[_0x90db('0x36')],null))[_0x90db('0x25')](respondWithResult(_0x540176,null))[_0x90db('0x35')](handleError(_0x540176,null));};exports[_0x90db('0x39')]=function(_0x4de656,_0x88789f){return db[_0x90db('0x37')]['find']({'where':{'id':_0x4de656[_0x90db('0x3a')]['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x88789f,null))[_0x90db('0x25')](removeEntity(_0x88789f,null))['catch'](handleError(_0x88789f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9d244ac..4993361 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 _0x5959=['ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x25ea0a,_0x287721){var _0x38996c=function(_0x72959f){while(--_0x72959f){_0x25ea0a['push'](_0x25ea0a['shift']());}};_0x38996c(++_0x287721);}(_0x5959,0x17c));var _0x9595=function(_0x567d,_0x2f8123){_0x567d=_0x567d-0x0;var _0x3b7a37=_0x5959[_0x567d];return _0x3b7a37;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var logger=require(_0x9595('0x2'))('api');var moment=require(_0x9595('0x3'));var BPromise=require(_0x9595('0x4'));var rp=require(_0x9595('0x5'));var fs=require('fs');var path=require(_0x9595('0x6'));var rimraf=require(_0x9595('0x7'));var config=require(_0x9595('0x8'));var attributes=require(_0x9595('0x9'));module['exports']=function(_0x20e2fb,_0x19b27c){return _0x20e2fb['define'](_0x9595('0xa'),attributes,{'tableName':_0x9595('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9595('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x28eb=['utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x28eb,0x105));var _0xb28e=function(_0x266ca7,_0x15005f){_0x266ca7=_0x266ca7-0x0;var _0x2969ca=_0x28eb[_0x266ca7];return _0x2969ca;};'use strict';var _=require(_0xb28e('0x0'));var util=require(_0xb28e('0x1'));var logger=require(_0xb28e('0x2'))('api');var moment=require(_0xb28e('0x3'));var BPromise=require(_0xb28e('0x4'));var rp=require(_0xb28e('0x5'));var fs=require('fs');var path=require(_0xb28e('0x6'));var rimraf=require(_0xb28e('0x7'));var config=require(_0xb28e('0x8'));var attributes=require(_0xb28e('0x9'));module['exports']=function(_0x42b823,_0x4638f9){return _0x42b823[_0xb28e('0xa')](_0xb28e('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb28e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f5821d1..af7a4fd 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 _0x7a0c=['ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring'];(function(_0x59a901,_0xd01104){var _0x5b2b75=function(_0x4b6044){while(--_0x4b6044){_0x59a901['push'](_0x59a901['shift']());}};_0x5b2b75(++_0xd01104);}(_0x7a0c,0x14c));var _0xc7a0=function(_0x48ab6d,_0x13868d){_0x48ab6d=_0x48ab6d-0x0;var _0x1dcebe=_0x7a0c[_0x48ab6d];return _0x1dcebe;};'use strict';var _=require(_0xc7a0('0x0'));var util=require(_0xc7a0('0x1'));var moment=require(_0xc7a0('0x2'));var BPromise=require('bluebird');var rs=require(_0xc7a0('0x3'));var fs=require('fs');var Redis=require(_0xc7a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7a0('0x5'));var logger=require(_0xc7a0('0x6'))(_0xc7a0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc7a0('0x8')][_0xc7a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6290fa,_0x37311c,_0x4560bb){return new BPromise(function(_0x34dd90,_0x1dfca1){return client['request'](_0x6290fa,_0x4560bb)[_0xc7a0('0xa')](function(_0x477cbb){logger[_0xc7a0('0xb')]('ChatApplication,\x20%s,\x20%s',_0x37311c,_0xc7a0('0xc'));logger[_0xc7a0('0xd')](_0xc7a0('0xe'),_0x37311c,_0xc7a0('0xc'),JSON[_0xc7a0('0xf')](_0x477cbb));if(_0x477cbb[_0xc7a0('0x10')]){if(_0x477cbb[_0xc7a0('0x10')][_0xc7a0('0x11')]===0x1f4){logger['error'](_0xc7a0('0x12'),_0x37311c,_0x477cbb[_0xc7a0('0x10')][_0xc7a0('0x13')]);return _0x1dfca1(_0x477cbb['error'][_0xc7a0('0x13')]);}logger['error'](_0xc7a0('0x12'),_0x37311c,_0x477cbb[_0xc7a0('0x10')]['message']);return _0x34dd90(_0x477cbb['error'][_0xc7a0('0x13')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x37311c,'request\x20sent');_0x34dd90(_0x477cbb[_0xc7a0('0x14')][_0xc7a0('0x13')]);}})['catch'](function(_0x1e8d6a){logger[_0xc7a0('0x10')](_0xc7a0('0x12'),_0x37311c,_0x1e8d6a);_0x1dfca1(_0x1e8d6a);});});} \ No newline at end of file +var _0x906c=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x906c,0x192));var _0xc906=function(_0x4b759f,_0x25b082){_0x4b759f=_0x4b759f-0x0;var _0x4518cc=_0x906c[_0x4b759f];return _0x4518cc;};'use strict';var _=require(_0xc906('0x0'));var util=require('util');var moment=require(_0xc906('0x1'));var BPromise=require('bluebird');var rs=require(_0xc906('0x2'));var fs=require('fs');var Redis=require(_0xc906('0x3'));var db=require(_0xc906('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc906('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc906('0x6'));var client=jayson['client'][_0xc906('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30cefe,_0x412740,_0x2ae2a1){return new BPromise(function(_0x5191ea,_0xfbb96c){return client[_0xc906('0x8')](_0x30cefe,_0x2ae2a1)[_0xc906('0x9')](function(_0x3a2697){logger['info'](_0xc906('0xa'),_0x412740,_0xc906('0xb'));logger[_0xc906('0xc')](_0xc906('0xd'),_0x412740,'request\x20sent',JSON['stringify'](_0x3a2697));if(_0x3a2697[_0xc906('0xe')]){if(_0x3a2697['error'][_0xc906('0xf')]===0x1f4){logger['error'](_0xc906('0xa'),_0x412740,_0x3a2697['error'][_0xc906('0x10')]);return _0xfbb96c(_0x3a2697[_0xc906('0xe')][_0xc906('0x10')]);}logger[_0xc906('0xe')](_0xc906('0xa'),_0x412740,_0x3a2697['error']['message']);return _0x5191ea(_0x3a2697[_0xc906('0xe')][_0xc906('0x10')]);}else{logger[_0xc906('0x11')](_0xc906('0xa'),_0x412740,'request\x20sent');_0x5191ea(_0x3a2697[_0xc906('0x12')][_0xc906('0x10')]);}})[_0xc906('0x13')](function(_0x4eba5f){logger[_0xc906('0xe')](_0xc906('0xa'),_0x412740,_0x4eba5f);_0xfbb96c(_0x4eba5f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9de271d..bae263c 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 _0x2d9b=['update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','put'];(function(_0x16b33f,_0x1e933f){var _0x27c5e0=function(_0x29a857){while(--_0x29a857){_0x16b33f['push'](_0x16b33f['shift']());}};_0x27c5e0(++_0x1e933f);}(_0x2d9b,0x17c));var _0xb2d9=function(_0x2b08dd,_0xabf45c){_0x2b08dd=_0x2b08dd-0x0;var _0x48ad5f=_0x2d9b[_0x2b08dd];return _0x48ad5f;};'use strict';var multer=require(_0xb2d9('0x0'));var util=require('util');var path=require(_0xb2d9('0x1'));var timeout=require(_0xb2d9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2d9('0x3'));var interaction=require(_0xb2d9('0x4'));var config=require('../../config/environment');var controller=require(_0xb2d9('0x5'));router['get'](_0xb2d9('0x6'),auth[_0xb2d9('0x7')](),controller[_0xb2d9('0x8')]);router[_0xb2d9('0x9')](_0xb2d9('0x6'),auth[_0xb2d9('0x7')](),controller[_0xb2d9('0xa')]);router['delete'](_0xb2d9('0x6'),auth['isAuthenticated'](),controller[_0xb2d9('0xb')]);module[_0xb2d9('0xc')]=router; \ No newline at end of file +var _0x212c=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x352cd3,_0x3489ae){var _0x5a5be1=function(_0x58fdcd){while(--_0x58fdcd){_0x352cd3['push'](_0x352cd3['shift']());}};_0x5a5be1(++_0x3489ae);}(_0x212c,0x1af));var _0xc212=function(_0x3b7f17,_0x5ba525){_0x3b7f17=_0x3b7f17-0x0;var _0x1195dc=_0x212c[_0x3b7f17];return _0x1195dc;};'use strict';var multer=require(_0xc212('0x0'));var util=require(_0xc212('0x1'));var path=require(_0xc212('0x2'));var timeout=require(_0xc212('0x3'));var express=require('express');var router=express[_0xc212('0x4')]();var fs_extra=require(_0xc212('0x5'));var auth=require(_0xc212('0x6'));var interaction=require(_0xc212('0x7'));var config=require(_0xc212('0x8'));var controller=require('./chatApplication.controller');router[_0xc212('0x9')](_0xc212('0xa'),auth[_0xc212('0xb')](),controller[_0xc212('0xc')]);router[_0xc212('0xd')]('/:id',auth[_0xc212('0xb')](),controller[_0xc212('0xe')]);router[_0xc212('0xf')](_0xc212('0xa'),auth[_0xc212('0xb')](),controller['destroy']);module[_0xc212('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 825bcf6..ff84bdc 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 _0xc6f8=['STRING','BOOLEAN'];(function(_0x24e064,_0x240373){var _0x34abec=function(_0x244b5d){while(--_0x244b5d){_0x24e064['push'](_0x24e064['shift']());}};_0x34abec(++_0x240373);}(_0xc6f8,0x14c));var _0x8c6f=function(_0x56fe34,_0x5eb857){_0x56fe34=_0x56fe34-0x0;var _0xb6206d=_0xc6f8[_0x56fe34];return _0xb6206d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8c6f('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x8c6f('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6c99=['sequelize','exports','STRING'];(function(_0x2410da,_0x15fc59){var _0x17db47=function(_0x4b8ed3){while(--_0x4b8ed3){_0x2410da['push'](_0x2410da['shift']());}};_0x17db47(++_0x15fc59);}(_0x6c99,0x19b));var _0x96c9=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x6c99[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require(_0x96c9('0x0'));module[_0x96c9('0x1')]={'name':{'type':Sequelize[_0x96c9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x96c9('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index bf80641..343b117 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 _0xf3b9=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ChatGroup','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','ChatInternalMessage','user','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','options','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0xa711b,_0x81a280){var _0x1f061d=function(_0x4c7a37){while(--_0x4c7a37){_0xa711b['push'](_0xa711b['shift']());}};_0x1f061d(++_0x81a280);}(_0xf3b9,0x19d));var _0x9f3b=function(_0x1ec849,_0x386984){_0x1ec849=_0x1ec849-0x0;var _0x1fff97=_0xf3b9[_0x1ec849];return _0x1fff97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f3b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f3b('0x1'));var rp=require('request-promise');var moment=require(_0x9f3b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9f3b('0x3'));var util=require(_0x9f3b('0x4'));var path=require(_0x9f3b('0x5'));var sox=require(_0x9f3b('0x6'));var csv=require(_0x9f3b('0x7'));var ejs=require(_0x9f3b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f3b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9f3b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f3b('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x9f3b('0xc'));var as=require(_0x9f3b('0xd'));var hardwareService=require(_0x9f3b('0xe'));var logger=require(_0x9f3b('0xf'))(_0x9f3b('0x10'));var utils=require(_0x9f3b('0x11'));var config=require(_0x9f3b('0x12'));var licenseUtil=require(_0x9f3b('0x13'));var db=require(_0x9f3b('0x14'))['db'];config[_0x9f3b('0x15')]=_[_0x9f3b('0x16')](config[_0x9f3b('0x15')],{'host':_0x9f3b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9f3b('0x18'))[_0x9f3b('0x19')](socket);function respondWithStatusCode(_0x5693f0,_0x4345af){_0x4345af=_0x4345af||0xcc;return function(_0xe3a59b){if(_0xe3a59b){return _0x5693f0['sendStatus'](_0x4345af);}return _0x5693f0[_0x9f3b('0x1a')](_0x4345af)[_0x9f3b('0x1b')]();};}function respondWithResult(_0x1383f2,_0x56f409){_0x56f409=_0x56f409||0xc8;return function(_0x5412cf){if(_0x5412cf){return _0x1383f2['status'](_0x56f409)[_0x9f3b('0x1c')](_0x5412cf);}};}function respondWithFilteredResult(_0x3be6be,_0x3ec11f){return function(_0x51f096){if(_0x51f096){var _0xcba5bb=typeof _0x3ec11f[_0x9f3b('0x1d')]==='undefined'&&typeof _0x3ec11f['limit']===_0x9f3b('0x1e');var _0x49dcd6=_0x51f096['count'];var _0x3b17f5=_0xcba5bb?0x0:_0x3ec11f[_0x9f3b('0x1d')];var _0x5cce47=_0xcba5bb?_0x51f096[_0x9f3b('0x1f')]:_0x3ec11f[_0x9f3b('0x1d')]+_0x3ec11f[_0x9f3b('0x20')];var _0x438c98;if(_0x5cce47>=_0x49dcd6){_0x5cce47=_0x49dcd6;_0x438c98=0xc8;}else{_0x438c98=0xce;}_0x3be6be[_0x9f3b('0x1a')](_0x438c98);return _0x3be6be[_0x9f3b('0x21')](_0x9f3b('0x22'),_0x3b17f5+'-'+_0x5cce47+'/'+_0x49dcd6)['json'](_0x51f096);}return null;};}function patchUpdates(_0x54edaf){return function(_0x2838e4){try{jsonpatch[_0x9f3b('0x23')](_0x2838e4,_0x54edaf,!![]);}catch(_0x451d63){return BPromise[_0x9f3b('0x24')](_0x451d63);}return _0x2838e4[_0x9f3b('0x25')]();};}function saveUpdates(_0xe18230,_0x345ccc){return function(_0x24cbb4){if(_0x24cbb4){return _0x24cbb4[_0x9f3b('0x26')](_0xe18230)[_0x9f3b('0x27')](function(_0xa200e0){return _0xa200e0;});}return null;};}function removeEntity(_0x6fb490,_0x37adc2){return function(_0x3eb503){if(_0x3eb503){return _0x3eb503[_0x9f3b('0x28')]()[_0x9f3b('0x27')](function(){_0x6fb490[_0x9f3b('0x1a')](0xcc)[_0x9f3b('0x1b')]();});}};}function handleEntityNotFound(_0xd3a98e,_0x3c32bf){return function(_0x45ed77){if(!_0x45ed77){_0xd3a98e[_0x9f3b('0x29')](0x194);}return _0x45ed77;};}function handleError(_0x4a4658,_0xeb3b93){_0xeb3b93=_0xeb3b93||0x1f4;return function(_0x19f0ad){logger[_0x9f3b('0x2a')](_0x19f0ad['stack']);if(_0x19f0ad[_0x9f3b('0x2b')]){delete _0x19f0ad[_0x9f3b('0x2b')];}_0x4a4658[_0x9f3b('0x1a')](_0xeb3b93)[_0x9f3b('0x2c')](_0x19f0ad);};}exports[_0x9f3b('0x2d')]=function(_0x2ef7d3,_0x364445){var _0x5880f1={},_0x87cf5d={},_0x578160={'count':0x0,'rows':[]};var _0x2e5572=_[_0x9f3b('0x2e')](db['ChatGroup'][_0x9f3b('0x2f')],function(_0x13c14f){return{'name':_0x13c14f['fieldName'],'type':_0x13c14f[_0x9f3b('0x30')][_0x9f3b('0x31')]};});_0x87cf5d[_0x9f3b('0x32')]=_[_0x9f3b('0x2e')](_0x2e5572,'name');_0x87cf5d[_0x9f3b('0x33')]=_[_0x9f3b('0x34')](_0x2ef7d3[_0x9f3b('0x33')]);_0x87cf5d[_0x9f3b('0x35')]=_[_0x9f3b('0x36')](_0x87cf5d[_0x9f3b('0x32')],_0x87cf5d['query']);_0x5880f1[_0x9f3b('0x37')]=_[_0x9f3b('0x36')](_0x87cf5d[_0x9f3b('0x32')],qs['fields'](_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x38')]));_0x5880f1[_0x9f3b('0x37')]=_0x5880f1[_0x9f3b('0x37')][_0x9f3b('0x39')]?_0x5880f1[_0x9f3b('0x37')]:_0x87cf5d[_0x9f3b('0x32')];if(!_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x3a')](_0x9f3b('0x3b'))){_0x5880f1[_0x9f3b('0x20')]=qs[_0x9f3b('0x20')](_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x20')]);_0x5880f1[_0x9f3b('0x1d')]=qs[_0x9f3b('0x1d')](_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x1d')]);}_0x5880f1[_0x9f3b('0x3c')]=qs[_0x9f3b('0x3d')](_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x3d')]);_0x5880f1[_0x9f3b('0x3e')]=qs[_0x9f3b('0x35')](_[_0x9f3b('0x3f')](_0x2ef7d3[_0x9f3b('0x33')],_0x87cf5d['filters']),_0x2e5572);if(_0x2ef7d3[_0x9f3b('0x33')]['filter']){_0x5880f1[_0x9f3b('0x3e')]=_[_0x9f3b('0x40')](_0x5880f1[_0x9f3b('0x3e')],{'$or':_[_0x9f3b('0x2e')](_0x2e5572,function(_0x4815c9){if(_0x4815c9[_0x9f3b('0x30')]!==_0x9f3b('0x41')){var _0xf109bb={};_0xf109bb[_0x4815c9['name']]={'$like':'%'+_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x42')]+'%'};return _0xf109bb;}})});}_0x5880f1=_[_0x9f3b('0x40')]({},_0x5880f1,_0x2ef7d3['options']);var _0x1a7d77={'where':_0x5880f1['where']};return db[_0x9f3b('0x43')]['count'](_0x1a7d77)['then'](function(_0x2351a7){_0x578160[_0x9f3b('0x1f')]=_0x2351a7;if(_0x2ef7d3[_0x9f3b('0x33')][_0x9f3b('0x44')]){_0x5880f1[_0x9f3b('0x45')]=[{'all':!![]}];}return db[_0x9f3b('0x43')][_0x9f3b('0x46')](_0x5880f1);})['then'](function(_0x198a0d){_0x578160[_0x9f3b('0x47')]=_0x198a0d;return _0x578160;})[_0x9f3b('0x27')](respondWithFilteredResult(_0x364445,_0x5880f1))[_0x9f3b('0x48')](handleError(_0x364445,null));};exports[_0x9f3b('0x49')]=function(_0x41d6dd,_0xfc97b1){var _0x2338e0={'raw':!![],'where':{'id':_0x41d6dd[_0x9f3b('0x4a')]['id']}},_0x1571cc={};_0x1571cc['model']=_['keys'](db['ChatGroup'][_0x9f3b('0x2f')]);_0x1571cc[_0x9f3b('0x33')]=_['keys'](_0x41d6dd[_0x9f3b('0x33')]);_0x1571cc[_0x9f3b('0x35')]=_[_0x9f3b('0x36')](_0x1571cc[_0x9f3b('0x32')],_0x1571cc['query']);_0x2338e0['attributes']=_[_0x9f3b('0x36')](_0x1571cc[_0x9f3b('0x32')],qs['fields'](_0x41d6dd['query']['fields']));_0x2338e0[_0x9f3b('0x37')]=_0x2338e0['attributes']['length']?_0x2338e0[_0x9f3b('0x37')]:_0x1571cc[_0x9f3b('0x32')];if(_0x41d6dd[_0x9f3b('0x33')][_0x9f3b('0x44')]){_0x2338e0[_0x9f3b('0x45')]=[{'all':!![]}];}_0x2338e0=_[_0x9f3b('0x40')]({},_0x2338e0,_0x41d6dd['options']);return db[_0x9f3b('0x43')][_0x9f3b('0x4b')](_0x2338e0)[_0x9f3b('0x27')](handleEntityNotFound(_0xfc97b1,null))[_0x9f3b('0x27')](respondWithResult(_0xfc97b1,null))[_0x9f3b('0x48')](handleError(_0xfc97b1,null));};exports[_0x9f3b('0x4c')]=function(_0x250de6,_0x18f5fa){return db[_0x9f3b('0x43')][_0x9f3b('0x4c')](_0x250de6[_0x9f3b('0x4d')],{})[_0x9f3b('0x27')](respondWithResult(_0x18f5fa,0xc9))[_0x9f3b('0x48')](handleError(_0x18f5fa,null));};exports[_0x9f3b('0x26')]=function(_0x1ab9e2,_0x42168b){if(_0x1ab9e2[_0x9f3b('0x4d')]['id']){delete _0x1ab9e2[_0x9f3b('0x4d')]['id'];}return db[_0x9f3b('0x43')][_0x9f3b('0x4b')]({'where':{'id':_0x1ab9e2[_0x9f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42168b,null))[_0x9f3b('0x27')](saveUpdates(_0x1ab9e2['body'],null))[_0x9f3b('0x27')](respondWithResult(_0x42168b,null))['catch'](handleError(_0x42168b,null));};exports['destroy']=function(_0x1e201d,_0x3b6cba){return db[_0x9f3b('0x43')][_0x9f3b('0x4b')]({'where':{'id':_0x1e201d[_0x9f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b6cba,null))[_0x9f3b('0x27')](removeEntity(_0x3b6cba,null))[_0x9f3b('0x48')](handleError(_0x3b6cba,null));};exports['describe']=function(_0x5f0760,_0x2f27c3){return db[_0x9f3b('0x43')][_0x9f3b('0x4e')]()[_0x9f3b('0x27')](respondWithResult(_0x2f27c3,null))[_0x9f3b('0x48')](handleError(_0x2f27c3,null));};exports['getUnread']=function(_0x1bef9a,_0x592642,_0x4a7e29){return db[_0x9f3b('0x4f')][_0x9f3b('0x1f')]({'where':{'ChatGroupId':_0x1bef9a[_0x9f3b('0x4a')]['id'],'ToId':_0x1bef9a[_0x9f3b('0x50')]['id'],'read':![]}})[_0x9f3b('0x27')](function(_0x2ac5fe){return{'id':_['toInteger'](_0x1bef9a['params']['id']),'count':_0x2ac5fe};})['then'](respondWithResult(_0x592642,null))['catch'](handleError(_0x592642,null));};exports[_0x9f3b('0x51')]=function(_0x2af7c8,_0x51a4c4,_0x3514ac){return db['ChatGroup'][_0x9f3b('0x4b')]({'where':{'id':_0x2af7c8[_0x9f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51a4c4,null))[_0x9f3b('0x27')](function(_0x5722a3){if(_0x5722a3){return _0x5722a3[_0x9f3b('0x51')](_0x2af7c8[_0x9f3b('0x4d')][_0x9f3b('0x52')],_['omit'](_0x2af7c8[_0x9f3b('0x4d')],[_0x9f3b('0x52'),'id'])||{});}})[_0x9f3b('0x27')](respondWithResult(_0x51a4c4,null))['catch'](handleError(_0x51a4c4,null));};exports[_0x9f3b('0x53')]=function(_0xbaf498,_0x23f54b,_0x5a4c75){var _0xc6cb63={};var _0x446fec={};var _0x70a3d8;var _0x3e5ff9;return db[_0x9f3b('0x43')][_0x9f3b('0x54')]({'where':{'id':_0xbaf498[_0x9f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x23f54b,null))['then'](function(_0x365aee){if(_0x365aee){_0x70a3d8=_0x365aee;_0x446fec[_0x9f3b('0x32')]=_[_0x9f3b('0x34')](db[_0x9f3b('0x55')][_0x9f3b('0x2f')]);_0x446fec[_0x9f3b('0x33')]=_['keys'](_0xbaf498[_0x9f3b('0x33')]);_0x446fec[_0x9f3b('0x35')]=_['intersection'](_0x446fec[_0x9f3b('0x32')],_0x446fec[_0x9f3b('0x33')]);_0xc6cb63['attributes']=_[_0x9f3b('0x36')](_0x446fec[_0x9f3b('0x32')],qs['fields'](_0xbaf498[_0x9f3b('0x33')]['fields']));_0xc6cb63[_0x9f3b('0x37')]=_0xc6cb63['attributes'][_0x9f3b('0x39')]?_0xc6cb63[_0x9f3b('0x37')]:_0x446fec[_0x9f3b('0x32')];_0xc6cb63[_0x9f3b('0x3c')]=qs[_0x9f3b('0x3d')](_0xbaf498[_0x9f3b('0x33')][_0x9f3b('0x3d')]);_0xc6cb63[_0x9f3b('0x3e')]=qs[_0x9f3b('0x35')](_[_0x9f3b('0x3f')](_0xbaf498[_0x9f3b('0x33')],_0x446fec[_0x9f3b('0x35')]));if(_0xbaf498[_0x9f3b('0x33')][_0x9f3b('0x42')]){_0xc6cb63[_0x9f3b('0x3e')]=_[_0x9f3b('0x40')](_0xc6cb63[_0x9f3b('0x3e')],{'$or':_[_0x9f3b('0x2e')](_0xc6cb63[_0x9f3b('0x37')],function(_0x5004c5){var _0x7c05eb={};_0x7c05eb[_0x5004c5]={'$like':'%'+_0xbaf498['query'][_0x9f3b('0x42')]+'%'};return _0x7c05eb;})});}_0xc6cb63=_['merge']({},_0xc6cb63,_0xbaf498['options']);return _0x70a3d8[_0x9f3b('0x53')](_0xc6cb63);}})['then'](function(_0x207f4a){if(_0x207f4a){_0x3e5ff9=_0x207f4a[_0x9f3b('0x39')];if(!_0xbaf498['query']['hasOwnProperty'](_0x9f3b('0x3b'))){_0xc6cb63[_0x9f3b('0x20')]=qs['limit'](_0xbaf498[_0x9f3b('0x33')][_0x9f3b('0x20')]);_0xc6cb63['offset']=qs[_0x9f3b('0x1d')](_0xbaf498[_0x9f3b('0x33')][_0x9f3b('0x1d')]);}return _0x70a3d8[_0x9f3b('0x53')](_0xc6cb63);}})[_0x9f3b('0x27')](function(_0x5e1d55){if(_0x5e1d55){return _0x5e1d55?{'count':_0x3e5ff9,'rows':_0x5e1d55}:null;}})['then'](respondWithResult(_0x23f54b,null))[_0x9f3b('0x48')](handleError(_0x23f54b,null));};exports[_0x9f3b('0x56')]=function(_0x271953,_0x578832,_0x3b85c7){return db[_0x9f3b('0x43')][_0x9f3b('0x4b')]({'where':{'id':_0x271953[_0x9f3b('0x4a')]['id']}})[_0x9f3b('0x27')](handleEntityNotFound(_0x578832,null))['then'](function(_0x28af91){if(_0x28af91){return _0x28af91['removeMembers'](_0x271953[_0x9f3b('0x33')][_0x9f3b('0x52')]);}})[_0x9f3b('0x27')](respondWithStatusCode(_0x578832,null))[_0x9f3b('0x48')](handleError(_0x578832,null));};exports[_0x9f3b('0x57')]=function(_0x109cb8,_0xb1c947,_0x4d992d){if(_0x109cb8[_0x9f3b('0x4d')]['id']){delete _0x109cb8['body']['id'];}return db['ChatGroup'][_0x9f3b('0x4b')]({'where':{'id':_0x109cb8[_0x9f3b('0x4a')]['id']}})[_0x9f3b('0x27')](handleEntityNotFound(_0xb1c947,null))[_0x9f3b('0x27')](function(_0x383e60){if(_0x383e60){_0x109cb8[_0x9f3b('0x4d')][_0x9f3b('0x58')]=_0x383e60['id'];return db[_0x9f3b('0x4f')][_0x9f3b('0x4c')](_0x109cb8[_0x9f3b('0x4d')]);}})['then'](respondWithResult(_0xb1c947,null))['catch'](handleError(_0xb1c947,null));};exports[_0x9f3b('0x59')]=function(_0x204bdc,_0x39061a,_0x16c41e){var _0x41377e={};var _0x4c0fdd={};var _0x51b94c;var _0x18d719;return db[_0x9f3b('0x43')][_0x9f3b('0x54')]({'where':{'id':_0x204bdc['params']['id']}})[_0x9f3b('0x27')](handleEntityNotFound(_0x39061a,null))['then'](function(_0x3eb22b){if(_0x3eb22b){_0x51b94c=_0x3eb22b;_0x4c0fdd[_0x9f3b('0x32')]=_[_0x9f3b('0x34')](db[_0x9f3b('0x4f')]['rawAttributes']);_0x4c0fdd[_0x9f3b('0x33')]=_['keys'](_0x204bdc[_0x9f3b('0x33')]);_0x4c0fdd[_0x9f3b('0x35')]=_[_0x9f3b('0x36')](_0x4c0fdd[_0x9f3b('0x32')],_0x4c0fdd[_0x9f3b('0x33')]);_0x41377e[_0x9f3b('0x37')]=_[_0x9f3b('0x36')](_0x4c0fdd[_0x9f3b('0x32')],qs[_0x9f3b('0x38')](_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x38')]));_0x41377e[_0x9f3b('0x37')]=_0x41377e[_0x9f3b('0x37')][_0x9f3b('0x39')]?_0x41377e[_0x9f3b('0x37')]:_0x4c0fdd[_0x9f3b('0x32')];_0x41377e['order']=qs[_0x9f3b('0x3d')](_0x204bdc['query'][_0x9f3b('0x3d')]);_0x41377e['where']=qs['filters'](_[_0x9f3b('0x3f')](_0x204bdc['query'],_0x4c0fdd[_0x9f3b('0x35')]));if(_0x204bdc['query'][_0x9f3b('0x42')]){_0x41377e[_0x9f3b('0x3e')]=_[_0x9f3b('0x40')](_0x41377e['where'],{'$or':_[_0x9f3b('0x2e')](_0x41377e[_0x9f3b('0x37')],function(_0x5b505a){var _0xf67e3={};_0xf67e3[_0x5b505a]={'$like':'%'+_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x42')]+'%'};return _0xf67e3;})});}if(_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x5a')]){var _0x3d35b1=_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x5a')][_0x9f3b('0x5b')](',');var _0x10d989={};_0x10d989[_0x3d35b1[0x0]]={'$gte':moment(_0x3d35b1[0x1])[_0x9f3b('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x41377e[_0x9f3b('0x3e')]=_['merge'](_0x41377e[_0x9f3b('0x3e')],_0x10d989);}_0x41377e=_[_0x9f3b('0x40')]({},_0x41377e,_0x204bdc[_0x9f3b('0x5d')]);return _0x51b94c[_0x9f3b('0x59')](_0x41377e);}})[_0x9f3b('0x27')](function(_0x3ecfa1){if(_0x3ecfa1){_0x18d719=_0x3ecfa1[_0x9f3b('0x39')];if(!_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x3a')](_0x9f3b('0x3b'))){_0x41377e[_0x9f3b('0x20')]=qs[_0x9f3b('0x20')](_0x204bdc['query']['limit']);_0x41377e[_0x9f3b('0x1d')]=qs['offset'](_0x204bdc[_0x9f3b('0x33')][_0x9f3b('0x1d')]);}return _0x51b94c[_0x9f3b('0x59')](_0x41377e);}})['then'](function(_0x4bad41){if(_0x4bad41){return _0x4bad41?{'count':_0x18d719,'rows':_0x4bad41}:null;}})['then'](respondWithResult(_0x39061a,null))[_0x9f3b('0x48')](handleError(_0x39061a,null));}; \ No newline at end of file +var _0xb982=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','ChatGroup','findAll','rows','catch','show','length','include','create','body','find','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','pick','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xb982,0x1d3));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2b98('0x0'));var rimraf=require(_0x2b98('0x1'));var zipdir=require(_0x2b98('0x2'));var jsonpatch=require(_0x2b98('0x3'));var rp=require(_0x2b98('0x4'));var moment=require(_0x2b98('0x5'));var BPromise=require(_0x2b98('0x6'));var Mustache=require(_0x2b98('0x7'));var util=require(_0x2b98('0x8'));var path=require('path');var sox=require(_0x2b98('0x9'));var csv=require(_0x2b98('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b98('0xb'));var _=require('lodash');var squel=require(_0x2b98('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b98('0xd'));var Papa=require(_0x2b98('0xe'));var Redis=require(_0x2b98('0xf'));var authService=require(_0x2b98('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b98('0x11'));var logger=require(_0x2b98('0x12'))(_0x2b98('0x13'));var utils=require('../../config/utils');var config=require(_0x2b98('0x14'));var licenseUtil=require(_0x2b98('0x15'));var db=require(_0x2b98('0x16'))['db'];config[_0x2b98('0x17')]=_[_0x2b98('0x18')](config[_0x2b98('0x17')],{'host':_0x2b98('0x19'),'port':0x18eb});var socket=require(_0x2b98('0x1a'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x2b98('0x1b')](socket);function respondWithStatusCode(_0x1534a6,_0x41f740){_0x41f740=_0x41f740||0xcc;return function(_0x58189a){if(_0x58189a){return _0x1534a6[_0x2b98('0x1c')](_0x41f740);}return _0x1534a6['status'](_0x41f740)[_0x2b98('0x1d')]();};}function respondWithResult(_0x592457,_0x36521f){_0x36521f=_0x36521f||0xc8;return function(_0x4e09e7){if(_0x4e09e7){return _0x592457[_0x2b98('0x1e')](_0x36521f)[_0x2b98('0x1f')](_0x4e09e7);}};}function respondWithFilteredResult(_0x580fff,_0x286e22){return function(_0x289c3a){if(_0x289c3a){var _0x1910eb=typeof _0x286e22[_0x2b98('0x20')]===_0x2b98('0x21')&&typeof _0x286e22['limit']==='undefined';var _0x46f101=_0x289c3a[_0x2b98('0x22')];var _0x685ea7=_0x1910eb?0x0:_0x286e22[_0x2b98('0x20')];var _0x3876bb=_0x1910eb?_0x289c3a[_0x2b98('0x22')]:_0x286e22[_0x2b98('0x20')]+_0x286e22[_0x2b98('0x23')];var _0x72a6ba;if(_0x3876bb>=_0x46f101){_0x3876bb=_0x46f101;_0x72a6ba=0xc8;}else{_0x72a6ba=0xce;}_0x580fff[_0x2b98('0x1e')](_0x72a6ba);return _0x580fff[_0x2b98('0x24')]('Content-Range',_0x685ea7+'-'+_0x3876bb+'/'+_0x46f101)['json'](_0x289c3a);}return null;};}function patchUpdates(_0x4d3e9b){return function(_0x3f2446){try{jsonpatch[_0x2b98('0x25')](_0x3f2446,_0x4d3e9b,!![]);}catch(_0x5d08a5){return BPromise[_0x2b98('0x26')](_0x5d08a5);}return _0x3f2446['save']();};}function saveUpdates(_0x4cab34,_0x457c37){return function(_0x414627){if(_0x414627){return _0x414627[_0x2b98('0x27')](_0x4cab34)[_0x2b98('0x28')](function(_0xcf3f7a){return _0xcf3f7a;});}return null;};}function removeEntity(_0x29339c,_0x313830){return function(_0x3f6498){if(_0x3f6498){return _0x3f6498[_0x2b98('0x29')]()[_0x2b98('0x28')](function(){_0x29339c['status'](0xcc)[_0x2b98('0x1d')]();});}};}function handleEntityNotFound(_0x4f80d9,_0x40c063){return function(_0x456a4a){if(!_0x456a4a){_0x4f80d9[_0x2b98('0x1c')](0x194);}return _0x456a4a;};}function handleError(_0x3f4a34,_0x3ce673){_0x3ce673=_0x3ce673||0x1f4;return function(_0x587de6){logger['error'](_0x587de6[_0x2b98('0x2a')]);if(_0x587de6['name']){delete _0x587de6[_0x2b98('0x2b')];}_0x3f4a34['status'](_0x3ce673)[_0x2b98('0x2c')](_0x587de6);};}exports['index']=function(_0x1d7d76,_0x1ec185){var _0x44e747={},_0x2b04fe={},_0x256709={'count':0x0,'rows':[]};var _0x486ae0=_[_0x2b98('0x2d')](db['ChatGroup'][_0x2b98('0x2e')],function(_0x21dff4){return{'name':_0x21dff4['fieldName'],'type':_0x21dff4[_0x2b98('0x2f')][_0x2b98('0x30')]};});_0x2b04fe[_0x2b98('0x31')]=_[_0x2b98('0x2d')](_0x486ae0,_0x2b98('0x2b'));_0x2b04fe[_0x2b98('0x32')]=_[_0x2b98('0x33')](_0x1d7d76[_0x2b98('0x32')]);_0x2b04fe[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0x2b04fe[_0x2b98('0x31')],_0x2b04fe[_0x2b98('0x32')]);_0x44e747[_0x2b98('0x36')]=_['intersection'](_0x2b04fe[_0x2b98('0x31')],qs[_0x2b98('0x37')](_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x37')]));_0x44e747['attributes']=_0x44e747[_0x2b98('0x36')]['length']?_0x44e747[_0x2b98('0x36')]:_0x2b04fe[_0x2b98('0x31')];if(!_0x1d7d76[_0x2b98('0x32')]['hasOwnProperty'](_0x2b98('0x38'))){_0x44e747[_0x2b98('0x23')]=qs[_0x2b98('0x23')](_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x23')]);_0x44e747[_0x2b98('0x20')]=qs[_0x2b98('0x20')](_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x20')]);}_0x44e747[_0x2b98('0x39')]=qs['sort'](_0x1d7d76['query'][_0x2b98('0x3a')]);_0x44e747[_0x2b98('0x3b')]=qs['filters'](_['pick'](_0x1d7d76[_0x2b98('0x32')],_0x2b04fe['filters']),_0x486ae0);if(_0x1d7d76[_0x2b98('0x32')]['filter']){_0x44e747[_0x2b98('0x3b')]=_['merge'](_0x44e747['where'],{'$or':_[_0x2b98('0x2d')](_0x486ae0,function(_0x4eb80c){if(_0x4eb80c[_0x2b98('0x2f')]!==_0x2b98('0x3c')){var _0x3f68ae={};_0x3f68ae[_0x4eb80c['name']]={'$like':'%'+_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x3d')]+'%'};return _0x3f68ae;}})});}_0x44e747=_[_0x2b98('0x3e')]({},_0x44e747,_0x1d7d76[_0x2b98('0x3f')]);var _0x768433={'where':_0x44e747[_0x2b98('0x3b')]};return db['ChatGroup']['count'](_0x768433)[_0x2b98('0x28')](function(_0x4324d1){_0x256709['count']=_0x4324d1;if(_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x40')]){_0x44e747['include']=[{'all':!![]}];}return db[_0x2b98('0x41')][_0x2b98('0x42')](_0x44e747);})['then'](function(_0x3f2306){_0x256709[_0x2b98('0x43')]=_0x3f2306;return _0x256709;})[_0x2b98('0x28')](respondWithFilteredResult(_0x1ec185,_0x44e747))[_0x2b98('0x44')](handleError(_0x1ec185,null));};exports[_0x2b98('0x45')]=function(_0x55d9e8,_0x5cc2db){var _0x3dbdaf={'raw':!![],'where':{'id':_0x55d9e8['params']['id']}},_0xe7685d={};_0xe7685d[_0x2b98('0x31')]=_[_0x2b98('0x33')](db[_0x2b98('0x41')][_0x2b98('0x2e')]);_0xe7685d[_0x2b98('0x32')]=_[_0x2b98('0x33')](_0x55d9e8[_0x2b98('0x32')]);_0xe7685d[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0xe7685d[_0x2b98('0x31')],_0xe7685d['query']);_0x3dbdaf[_0x2b98('0x36')]=_[_0x2b98('0x35')](_0xe7685d[_0x2b98('0x31')],qs[_0x2b98('0x37')](_0x55d9e8[_0x2b98('0x32')][_0x2b98('0x37')]));_0x3dbdaf[_0x2b98('0x36')]=_0x3dbdaf['attributes'][_0x2b98('0x46')]?_0x3dbdaf[_0x2b98('0x36')]:_0xe7685d[_0x2b98('0x31')];if(_0x55d9e8[_0x2b98('0x32')][_0x2b98('0x40')]){_0x3dbdaf[_0x2b98('0x47')]=[{'all':!![]}];}_0x3dbdaf=_[_0x2b98('0x3e')]({},_0x3dbdaf,_0x55d9e8[_0x2b98('0x3f')]);return db[_0x2b98('0x41')]['find'](_0x3dbdaf)[_0x2b98('0x28')](handleEntityNotFound(_0x5cc2db,null))[_0x2b98('0x28')](respondWithResult(_0x5cc2db,null))[_0x2b98('0x44')](handleError(_0x5cc2db,null));};exports['create']=function(_0x53e6dc,_0x3fdcca){return db[_0x2b98('0x41')][_0x2b98('0x48')](_0x53e6dc[_0x2b98('0x49')],{})[_0x2b98('0x28')](respondWithResult(_0x3fdcca,0xc9))[_0x2b98('0x44')](handleError(_0x3fdcca,null));};exports['update']=function(_0x55bd9b,_0x3536ce){if(_0x55bd9b[_0x2b98('0x49')]['id']){delete _0x55bd9b[_0x2b98('0x49')]['id'];}return db['ChatGroup'][_0x2b98('0x4a')]({'where':{'id':_0x55bd9b['params']['id']}})['then'](handleEntityNotFound(_0x3536ce,null))[_0x2b98('0x28')](saveUpdates(_0x55bd9b['body'],null))[_0x2b98('0x28')](respondWithResult(_0x3536ce,null))['catch'](handleError(_0x3536ce,null));};exports[_0x2b98('0x29')]=function(_0x4ec7b0,_0x1bf8ed){return db[_0x2b98('0x41')][_0x2b98('0x4a')]({'where':{'id':_0x4ec7b0[_0x2b98('0x4b')]['id']}})[_0x2b98('0x28')](handleEntityNotFound(_0x1bf8ed,null))['then'](removeEntity(_0x1bf8ed,null))[_0x2b98('0x44')](handleError(_0x1bf8ed,null));};exports[_0x2b98('0x4c')]=function(_0x534949,_0x35cc0f){return db[_0x2b98('0x41')][_0x2b98('0x4c')]()[_0x2b98('0x28')](respondWithResult(_0x35cc0f,null))[_0x2b98('0x44')](handleError(_0x35cc0f,null));};exports['getUnread']=function(_0x23172d,_0x413afd,_0x4970fe){return db[_0x2b98('0x4d')]['count']({'where':{'ChatGroupId':_0x23172d[_0x2b98('0x4b')]['id'],'ToId':_0x23172d[_0x2b98('0x4e')]['id'],'read':![]}})[_0x2b98('0x28')](function(_0x5da52f){return{'id':_[_0x2b98('0x4f')](_0x23172d[_0x2b98('0x4b')]['id']),'count':_0x5da52f};})[_0x2b98('0x28')](respondWithResult(_0x413afd,null))[_0x2b98('0x44')](handleError(_0x413afd,null));};exports[_0x2b98('0x50')]=function(_0x1846e6,_0x2e13e1,_0x37d527){return db[_0x2b98('0x41')][_0x2b98('0x4a')]({'where':{'id':_0x1846e6[_0x2b98('0x4b')]['id']}})[_0x2b98('0x28')](handleEntityNotFound(_0x2e13e1,null))[_0x2b98('0x28')](function(_0x3a3bb8){if(_0x3a3bb8){return _0x3a3bb8[_0x2b98('0x50')](_0x1846e6['body'][_0x2b98('0x51')],_[_0x2b98('0x52')](_0x1846e6[_0x2b98('0x49')],[_0x2b98('0x51'),'id'])||{});}})['then'](respondWithResult(_0x2e13e1,null))[_0x2b98('0x44')](handleError(_0x2e13e1,null));};exports['getMembers']=function(_0x396153,_0x4e4c32,_0x20640a){var _0x13ec57={};var _0x5617d4={};var _0x38ed34;var _0xe0e0cd;return db[_0x2b98('0x41')][_0x2b98('0x53')]({'where':{'id':_0x396153[_0x2b98('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e4c32,null))[_0x2b98('0x28')](function(_0x4f255d){if(_0x4f255d){_0x38ed34=_0x4f255d;_0x5617d4[_0x2b98('0x31')]=_[_0x2b98('0x33')](db[_0x2b98('0x54')][_0x2b98('0x2e')]);_0x5617d4[_0x2b98('0x32')]=_[_0x2b98('0x33')](_0x396153['query']);_0x5617d4[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0x5617d4[_0x2b98('0x31')],_0x5617d4[_0x2b98('0x32')]);_0x13ec57[_0x2b98('0x36')]=_['intersection'](_0x5617d4[_0x2b98('0x31')],qs[_0x2b98('0x37')](_0x396153[_0x2b98('0x32')]['fields']));_0x13ec57[_0x2b98('0x36')]=_0x13ec57[_0x2b98('0x36')]['length']?_0x13ec57[_0x2b98('0x36')]:_0x5617d4[_0x2b98('0x31')];_0x13ec57[_0x2b98('0x39')]=qs[_0x2b98('0x3a')](_0x396153[_0x2b98('0x32')][_0x2b98('0x3a')]);_0x13ec57['where']=qs['filters'](_[_0x2b98('0x55')](_0x396153['query'],_0x5617d4[_0x2b98('0x34')]));if(_0x396153['query']['filter']){_0x13ec57['where']=_[_0x2b98('0x3e')](_0x13ec57[_0x2b98('0x3b')],{'$or':_[_0x2b98('0x2d')](_0x13ec57[_0x2b98('0x36')],function(_0x509f3e){var _0x4c9446={};_0x4c9446[_0x509f3e]={'$like':'%'+_0x396153[_0x2b98('0x32')]['filter']+'%'};return _0x4c9446;})});}_0x13ec57=_['merge']({},_0x13ec57,_0x396153[_0x2b98('0x3f')]);return _0x38ed34[_0x2b98('0x56')](_0x13ec57);}})[_0x2b98('0x28')](function(_0x24890f){if(_0x24890f){_0xe0e0cd=_0x24890f[_0x2b98('0x46')];if(!_0x396153[_0x2b98('0x32')][_0x2b98('0x57')](_0x2b98('0x38'))){_0x13ec57[_0x2b98('0x23')]=qs[_0x2b98('0x23')](_0x396153['query']['limit']);_0x13ec57[_0x2b98('0x20')]=qs[_0x2b98('0x20')](_0x396153['query']['offset']);}return _0x38ed34[_0x2b98('0x56')](_0x13ec57);}})[_0x2b98('0x28')](function(_0x1ff8d6){if(_0x1ff8d6){return _0x1ff8d6?{'count':_0xe0e0cd,'rows':_0x1ff8d6}:null;}})[_0x2b98('0x28')](respondWithResult(_0x4e4c32,null))[_0x2b98('0x44')](handleError(_0x4e4c32,null));};exports[_0x2b98('0x58')]=function(_0x5554dd,_0x4b227a,_0x2b4ee9){return db[_0x2b98('0x41')][_0x2b98('0x4a')]({'where':{'id':_0x5554dd[_0x2b98('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b227a,null))[_0x2b98('0x28')](function(_0x5b6026){if(_0x5b6026){return _0x5b6026['removeMembers'](_0x5554dd[_0x2b98('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x4b227a,null))[_0x2b98('0x44')](handleError(_0x4b227a,null));};exports[_0x2b98('0x59')]=function(_0x139ed6,_0x6be0ad,_0xd91ee){if(_0x139ed6[_0x2b98('0x49')]['id']){delete _0x139ed6[_0x2b98('0x49')]['id'];}return db[_0x2b98('0x41')][_0x2b98('0x4a')]({'where':{'id':_0x139ed6[_0x2b98('0x4b')]['id']}})[_0x2b98('0x28')](handleEntityNotFound(_0x6be0ad,null))[_0x2b98('0x28')](function(_0xca3056){if(_0xca3056){_0x139ed6[_0x2b98('0x49')][_0x2b98('0x5a')]=_0xca3056['id'];return db[_0x2b98('0x4d')][_0x2b98('0x48')](_0x139ed6['body']);}})[_0x2b98('0x28')](respondWithResult(_0x6be0ad,null))[_0x2b98('0x44')](handleError(_0x6be0ad,null));};exports[_0x2b98('0x5b')]=function(_0x22279e,_0x2f028c,_0x23d160){var _0x7f3d01={};var _0x15a30d={};var _0x469a38;var _0x29f32d;return db[_0x2b98('0x41')][_0x2b98('0x53')]({'where':{'id':_0x22279e[_0x2b98('0x4b')]['id']}})[_0x2b98('0x28')](handleEntityNotFound(_0x2f028c,null))['then'](function(_0xd2d251){if(_0xd2d251){_0x469a38=_0xd2d251;_0x15a30d['model']=_['keys'](db['ChatInternalMessage'][_0x2b98('0x2e')]);_0x15a30d[_0x2b98('0x32')]=_[_0x2b98('0x33')](_0x22279e[_0x2b98('0x32')]);_0x15a30d[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0x15a30d[_0x2b98('0x31')],_0x15a30d[_0x2b98('0x32')]);_0x7f3d01[_0x2b98('0x36')]=_[_0x2b98('0x35')](_0x15a30d[_0x2b98('0x31')],qs[_0x2b98('0x37')](_0x22279e[_0x2b98('0x32')][_0x2b98('0x37')]));_0x7f3d01[_0x2b98('0x36')]=_0x7f3d01[_0x2b98('0x36')][_0x2b98('0x46')]?_0x7f3d01[_0x2b98('0x36')]:_0x15a30d[_0x2b98('0x31')];_0x7f3d01[_0x2b98('0x39')]=qs[_0x2b98('0x3a')](_0x22279e[_0x2b98('0x32')][_0x2b98('0x3a')]);_0x7f3d01[_0x2b98('0x3b')]=qs[_0x2b98('0x34')](_[_0x2b98('0x55')](_0x22279e[_0x2b98('0x32')],_0x15a30d['filters']));if(_0x22279e[_0x2b98('0x32')][_0x2b98('0x3d')]){_0x7f3d01[_0x2b98('0x3b')]=_[_0x2b98('0x3e')](_0x7f3d01['where'],{'$or':_[_0x2b98('0x2d')](_0x7f3d01[_0x2b98('0x36')],function(_0x218d80){var _0x2da025={};_0x2da025[_0x218d80]={'$like':'%'+_0x22279e[_0x2b98('0x32')][_0x2b98('0x3d')]+'%'};return _0x2da025;})});}if(_0x22279e[_0x2b98('0x32')]['$gte']){var _0x4197bd=_0x22279e[_0x2b98('0x32')][_0x2b98('0x5c')][_0x2b98('0x5d')](',');var _0xe45294={};_0xe45294[_0x4197bd[0x0]]={'$gte':moment(_0x4197bd[0x1])[_0x2b98('0x5e')](_0x2b98('0x5f'))};_0x7f3d01[_0x2b98('0x3b')]=_[_0x2b98('0x3e')](_0x7f3d01[_0x2b98('0x3b')],_0xe45294);}_0x7f3d01=_[_0x2b98('0x3e')]({},_0x7f3d01,_0x22279e[_0x2b98('0x3f')]);return _0x469a38[_0x2b98('0x5b')](_0x7f3d01);}})['then'](function(_0x32d91d){if(_0x32d91d){_0x29f32d=_0x32d91d['length'];if(!_0x22279e[_0x2b98('0x32')]['hasOwnProperty'](_0x2b98('0x38'))){_0x7f3d01[_0x2b98('0x23')]=qs['limit'](_0x22279e[_0x2b98('0x32')][_0x2b98('0x23')]);_0x7f3d01[_0x2b98('0x20')]=qs['offset'](_0x22279e[_0x2b98('0x32')][_0x2b98('0x20')]);}return _0x469a38[_0x2b98('0x5b')](_0x7f3d01);}})['then'](function(_0x2114bd){if(_0x2114bd){return _0x2114bd?{'count':_0x29f32d,'rows':_0x2114bd}:null;}})[_0x2b98('0x28')](respondWithResult(_0x2f028c,null))[_0x2b98('0x44')](handleError(_0x2f028c,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 7f4a13e..e544872 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 _0xbc6c=['update','emit','hasOwnProperty','hook','exports','events','ChatGroup','setMaxListeners','save'];(function(_0x2bebb2,_0x321313){var _0x277503=function(_0x15c37e){while(--_0x15c37e){_0x2bebb2['push'](_0x2bebb2['shift']());}};_0x277503(++_0x321313);}(_0xbc6c,0x101));var _0xcbc6=function(_0x319619,_0x58c07a){_0x319619=_0x319619-0x0;var _0x55cb02=_0xbc6c[_0x319619];return _0x55cb02;};'use strict';var EventEmitter=require(_0xcbc6('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xcbc6('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xcbc6('0x2')](0x0);var events={'afterCreate':_0xcbc6('0x3'),'afterUpdate':_0xcbc6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51a997){return function(_0x2ab1ac,_0x15cead,_0x1a3bfb){ChatGroupEvents[_0xcbc6('0x5')](_0x51a997+':'+_0x2ab1ac['id'],_0x2ab1ac);ChatGroupEvents['emit'](_0x51a997,_0x2ab1ac);_0x1a3bfb(null);};}for(var e in events){if(events[_0xcbc6('0x6')](e)){var event=events[e];ChatGroup[_0xcbc6('0x7')](e,emitEvent(event));}}module[_0xcbc6('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x41013b,_0x428de5){var _0x3f9601=function(_0x8587d3){while(--_0x8587d3){_0x41013b['push'](_0x41013b['shift']());}};_0x3f9601(++_0x428de5);}(_0x4888,0x198));var _0x8488=function(_0x5350ec,_0x316fd1){_0x5350ec=_0x5350ec-0x0;var _0x47da97=_0x4888[_0x5350ec];return _0x47da97;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){ChatGroupEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);ChatGroupEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];ChatGroup[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 65013e3..f486a26 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 _0xb56b=['./chatGroup.attributes','exports','chat_groups','lodash','util','moment','bluebird','request-promise','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb56b,0x159));var _0xbb56=function(_0x3cc8b4,_0x33bc7d){_0x3cc8b4=_0x3cc8b4-0x0;var _0x20ff15=_0xb56b[_0x3cc8b4];return _0x20ff15;};'use strict';var _=require(_0xbb56('0x0'));var util=require(_0xbb56('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbb56('0x2'));var BPromise=require(_0xbb56('0x3'));var rp=require(_0xbb56('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbb56('0x5'));var attributes=require(_0xbb56('0x6'));module[_0xbb56('0x7')]=function(_0x5b41ba,_0x30260d){return _0x5b41ba['define']('ChatGroup',attributes,{'tableName':_0xbb56('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26f6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x5dee43,_0x35aa9b){var _0x3bcfb0=function(_0x22dad2){while(--_0x22dad2){_0x5dee43['push'](_0x5dee43['shift']());}};_0x3bcfb0(++_0x35aa9b);}(_0x26f6,0xfd));var _0x626f=function(_0x4897ae,_0x574381){_0x4897ae=_0x4897ae-0x0;var _0x8f8f7c=_0x26f6[_0x4897ae];return _0x8f8f7c;};'use strict';var _=require(_0x626f('0x0'));var util=require(_0x626f('0x1'));var logger=require(_0x626f('0x2'))('api');var moment=require(_0x626f('0x3'));var BPromise=require(_0x626f('0x4'));var rp=require(_0x626f('0x5'));var fs=require('fs');var path=require(_0x626f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x626f('0x7'));module[_0x626f('0x8')]=function(_0x35bf4d,_0x581fee){return _0x35bf4d[_0x626f('0x9')](_0x626f('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5a92440..aaa3c5b 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 _0x4b47=['then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','request'];(function(_0x826fd8,_0x3f4104){var _0x2b5e49=function(_0x11e1d9){while(--_0x11e1d9){_0x826fd8['push'](_0x826fd8['shift']());}};_0x2b5e49(++_0x3f4104);}(_0x4b47,0x1b4));var _0x74b4=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x4b47[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x74b4('0x0'));var util=require('util');var moment=require(_0x74b4('0x1'));var BPromise=require(_0x74b4('0x2'));var rs=require(_0x74b4('0x3'));var fs=require('fs');var Redis=require(_0x74b4('0x4'));var db=require(_0x74b4('0x5'))['db'];var utils=require(_0x74b4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b4('0x7'));var jayson=require(_0x74b4('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x74b4('0x9')](config[_0x74b4('0xa')],{'host':_0x74b4('0xb'),'port':0x18eb});var socket=require(_0x74b4('0xc'))(new Redis(config[_0x74b4('0xa')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x2f4acd,_0x83da1b,_0x4f1886){return new BPromise(function(_0x513edb,_0x52c215){return client[_0x74b4('0xd')](_0x2f4acd,_0x4f1886)[_0x74b4('0xe')](function(_0x1e84a3){logger[_0x74b4('0xf')]('ChatGroup,\x20%s,\x20%s',_0x83da1b,_0x74b4('0x10'));logger['debug'](_0x74b4('0x11'),_0x83da1b,'request\x20sent',JSON[_0x74b4('0x12')](_0x1e84a3));if(_0x1e84a3[_0x74b4('0x13')]){if(_0x1e84a3[_0x74b4('0x13')][_0x74b4('0x14')]===0x1f4){logger['error'](_0x74b4('0x15'),_0x83da1b,_0x1e84a3[_0x74b4('0x13')]['message']);return _0x52c215(_0x1e84a3[_0x74b4('0x13')][_0x74b4('0x16')]);}logger[_0x74b4('0x13')](_0x74b4('0x15'),_0x83da1b,_0x1e84a3['error'][_0x74b4('0x16')]);return _0x513edb(_0x1e84a3[_0x74b4('0x13')]['message']);}else{logger['info'](_0x74b4('0x15'),_0x83da1b,_0x74b4('0x10'));_0x513edb(_0x1e84a3[_0x74b4('0x17')][_0x74b4('0x16')]);}})[_0x74b4('0x18')](function(_0x315a51){logger[_0x74b4('0x13')](_0x74b4('0x15'),_0x83da1b,_0x315a51);_0x52c215(_0x315a51);});});} \ No newline at end of file +var _0x1353=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','then','info','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x578432,_0x3977e0){var _0x2ee8b3=function(_0x5acd9f){while(--_0x5acd9f){_0x578432['push'](_0x578432['shift']());}};_0x2ee8b3(++_0x3977e0);}(_0x1353,0xb3));var _0x3135=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x1353[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x3135('0x0'));var util=require(_0x3135('0x1'));var moment=require(_0x3135('0x2'));var BPromise=require(_0x3135('0x3'));var rs=require(_0x3135('0x4'));var fs=require('fs');var Redis=require(_0x3135('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3135('0x6'));var logger=require(_0x3135('0x7'))(_0x3135('0x8'));var config=require(_0x3135('0x9'));var jayson=require(_0x3135('0xa'));var client=jayson['client'][_0x3135('0xb')]({'port':0x232a});config[_0x3135('0xc')]=_['defaults'](config[_0x3135('0xc')],{'host':_0x3135('0xd'),'port':0x18eb});var socket=require(_0x3135('0xe'))(new Redis(config[_0x3135('0xc')]));require(_0x3135('0xf'))['register'](socket);function respondWithRpcPromise(_0xab9e19,_0x1c0a36,_0x22c939){return new BPromise(function(_0x249bf0,_0x3721de){return client['request'](_0xab9e19,_0x22c939)[_0x3135('0x10')](function(_0x499acd){logger[_0x3135('0x11')]('ChatGroup,\x20%s,\x20%s',_0x1c0a36,_0x3135('0x12'));logger[_0x3135('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1c0a36,_0x3135('0x12'),JSON['stringify'](_0x499acd));if(_0x499acd[_0x3135('0x14')]){if(_0x499acd[_0x3135('0x14')][_0x3135('0x15')]===0x1f4){logger['error'](_0x3135('0x16'),_0x1c0a36,_0x499acd['error']['message']);return _0x3721de(_0x499acd[_0x3135('0x14')][_0x3135('0x17')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x1c0a36,_0x499acd['error'][_0x3135('0x17')]);return _0x249bf0(_0x499acd[_0x3135('0x14')][_0x3135('0x17')]);}else{logger[_0x3135('0x11')]('ChatGroup,\x20%s,\x20%s',_0x1c0a36,_0x3135('0x12'));_0x249bf0(_0x499acd[_0x3135('0x18')][_0x3135('0x17')]);}})[_0x3135('0x19')](function(_0x67a9fb){logger[_0x3135('0x14')](_0x3135('0x16'),_0x1c0a36,_0x67a9fb);_0x3721de(_0x67a9fb);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 43075f5..122411f 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 _0xff5f=['save','update','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0xf3b362,_0x37807e){var _0x3d0192=function(_0x43e69a){while(--_0x43e69a){_0xf3b362['push'](_0xf3b362['shift']());}};_0x3d0192(++_0x37807e);}(_0xff5f,0xd8));var _0xfff5=function(_0x317d4b,_0x3d96d4){_0x317d4b=_0x317d4b-0x0;var _0x299b0b=_0xff5f[_0x317d4b];return _0x299b0b;};'use strict';var ChatGroupEvents=require(_0xfff5('0x0'));var events=[_0xfff5('0x1'),'remove',_0xfff5('0x2')];function createListener(_0x29247e,_0x4312ab){return function(_0x48136c){_0x4312ab['emit'](_0x29247e,_0x48136c);};}function removeListener(_0x34d498,_0x4e5af6){return function(){ChatGroupEvents[_0xfff5('0x3')](_0x34d498,_0x4e5af6);};}exports[_0xfff5('0x4')]=function(_0x51bd21){for(var _0x3b6ff7=0x0,_0x31b7dc=events[_0xfff5('0x5')];_0x3b6ff7<_0x31b7dc;_0x3b6ff7++){var _0x15d5d3=events[_0x3b6ff7];var _0x53f30b=createListener(_0xfff5('0x6')+_0x15d5d3,_0x51bd21);ChatGroupEvents['on'](_0x15d5d3,_0x53f30b);}}; \ No newline at end of file +var _0x6476=['chatGroup:','save','update','emit','register','length'];(function(_0x5048f6,_0xf9eadc){var _0x4aa085=function(_0x414ecb){while(--_0x414ecb){_0x5048f6['push'](_0x5048f6['shift']());}};_0x4aa085(++_0xf9eadc);}(_0x6476,0x17b));var _0x6647=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x6476[_0x12d033];return _0x3b4e80;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x6647('0x0'),'remove',_0x6647('0x1')];function createListener(_0x2e6339,_0x4d2fe3){return function(_0x58e57e){_0x4d2fe3[_0x6647('0x2')](_0x2e6339,_0x58e57e);};}function removeListener(_0x1123e8,_0x30e24e){return function(){ChatGroupEvents['removeListener'](_0x1123e8,_0x30e24e);};}exports[_0x6647('0x3')]=function(_0x305d41){for(var _0x37a4b1=0x0,_0x554295=events[_0x6647('0x4')];_0x37a4b1<_0x554295;_0x37a4b1++){var _0x40d8fc=events[_0x37a4b1];var _0x5991df=createListener(_0x6647('0x5')+_0x40d8fc,_0x305d41);ChatGroupEvents['on'](_0x40d8fc,_0x5991df);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1a6519b..0c22aeb 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 _0x9a18=['removeMembers','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','index','get','isAuthenticated','show','/:id/unread','getUnread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','/:id','update','delete','destroy'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x9a18,0x13a));var _0x89a1=function(_0x90c0ea,_0xfe9689){_0x90c0ea=_0x90c0ea-0x0;var _0x8bd383=_0x9a18[_0x90c0ea];return _0x8bd383;};'use strict';var multer=require(_0x89a1('0x0'));var util=require(_0x89a1('0x1'));var path=require(_0x89a1('0x2'));var timeout=require(_0x89a1('0x3'));var express=require(_0x89a1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x89a1('0x5'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x89a1('0x6')]);router[_0x89a1('0x7')]('/describe',auth[_0x89a1('0x8')](),controller['describe']);router[_0x89a1('0x7')]('/:id',auth[_0x89a1('0x8')](),controller[_0x89a1('0x9')]);router[_0x89a1('0x7')](_0x89a1('0xa'),auth[_0x89a1('0x8')](),controller[_0x89a1('0xb')]);router[_0x89a1('0x7')]('/:id/members',auth[_0x89a1('0x8')](),controller['getMembers']);router[_0x89a1('0x7')](_0x89a1('0xc'),auth[_0x89a1('0x8')](),controller[_0x89a1('0xd')]);router[_0x89a1('0xe')]('/',auth[_0x89a1('0x8')](),controller[_0x89a1('0xf')]);router['post'](_0x89a1('0x10'),auth['isAuthenticated'](),controller[_0x89a1('0x11')]);router[_0x89a1('0xe')](_0x89a1('0xc'),auth[_0x89a1('0x8')](),controller[_0x89a1('0x12')]);router[_0x89a1('0x13')](_0x89a1('0x14'),auth[_0x89a1('0x8')](),controller[_0x89a1('0x15')]);router[_0x89a1('0x16')]('/:id',auth[_0x89a1('0x8')](),controller[_0x89a1('0x17')]);router[_0x89a1('0x16')](_0x89a1('0x10'),auth[_0x89a1('0x8')](),controller[_0x89a1('0x18')]);module[_0x89a1('0x19')]=router; \ No newline at end of file +var _0xcdde=['./chatGroup.controller','get','isAuthenticated','show','getUnread','/:id/members','/:id/messages','post','addMessage','/:id','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a5259,_0x34c361){var _0x402adc=function(_0x3ebd28){while(--_0x3ebd28){_0x3a5259['push'](_0x3a5259['shift']());}};_0x402adc(++_0x34c361);}(_0xcdde,0x1a7));var _0xecdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdde[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xecdd('0x0'));var util=require(_0xecdd('0x1'));var path=require(_0xecdd('0x2'));var timeout=require(_0xecdd('0x3'));var express=require(_0xecdd('0x4'));var router=express['Router']();var fs_extra=require(_0xecdd('0x5'));var auth=require(_0xecdd('0x6'));var interaction=require(_0xecdd('0x7'));var config=require(_0xecdd('0x8'));var controller=require(_0xecdd('0x9'));router[_0xecdd('0xa')]('/',auth[_0xecdd('0xb')](),controller['index']);router[_0xecdd('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xecdd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xecdd('0xc')]);router['get']('/:id/unread',auth[_0xecdd('0xb')](),controller[_0xecdd('0xd')]);router['get'](_0xecdd('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xecdd('0xa')](_0xecdd('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xecdd('0x10')]('/',auth[_0xecdd('0xb')](),controller['create']);router[_0xecdd('0x10')](_0xecdd('0xe'),auth[_0xecdd('0xb')](),controller['addMembers']);router['post'](_0xecdd('0xf'),auth[_0xecdd('0xb')](),controller[_0xecdd('0x11')]);router['put'](_0xecdd('0x12'),auth['isAuthenticated'](),controller[_0xecdd('0x13')]);router[_0xecdd('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xecdd('0x15')]);router[_0xecdd('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0xecdd('0x16')]);module[_0xecdd('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index bbff2dd..62858e2 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 _0xf632=['exports','BOOLEAN','star','TEXT','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x5251fe,_0x2b3eca){var _0x280649=function(_0x1209f7){while(--_0x1209f7){_0x5251fe['push'](_0x5251fe['shift']());}};_0x280649(++_0x2b3eca);}(_0xf632,0x77));var _0x2f63=function(_0x20d448,_0x538782){_0x20d448=_0x20d448-0x0;var _0x580bdb=_0xf632[_0x20d448];return _0x580bdb;};'use strict';var Sequelize=require(_0x2f63('0x0'));module[_0x2f63('0x1')]={'closed':{'type':Sequelize[_0x2f63('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0x2f63('0x3')},'ratingMessage':{'type':Sequelize[_0x2f63('0x4')]},'pathTranscript':{'type':Sequelize[_0x2f63('0x4')]},'mailTranscript':{'type':Sequelize[_0x2f63('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2f63('0x6')]},'disposition':{'type':Sequelize[_0x2f63('0x5')]},'secondDisposition':{'type':Sequelize[_0x2f63('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x2f63('0x5')]},'browserVersion':{'type':Sequelize[_0x2f63('0x5')]},'osName':{'type':Sequelize[_0x2f63('0x5')]},'osVersion':{'type':Sequelize[_0x2f63('0x5')]},'deviceModel':{'type':Sequelize[_0x2f63('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x2f63('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2f63('0x4')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x2f63('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x2f63('0x7')]('in',_0x2f63('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2f63('0x5')]},'customerPort':{'type':Sequelize[_0x2f63('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x2f63('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2f63('0x9')]}}; \ No newline at end of file +var _0xa9c6=['thumb','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0xf19481,_0x175a45){var _0x32ffb9=function(_0x3a8fed){while(--_0x3a8fed){_0xf19481['push'](_0xf19481['shift']());}};_0x32ffb9(++_0x175a45);}(_0xa9c6,0x12f));var _0x6a9c=function(_0x17d5af,_0x2ef8a7){_0x17d5af=_0x17d5af-0x0;var _0x4363c8=_0xa9c6[_0x17d5af];return _0x4363c8;};'use strict';var Sequelize=require(_0x6a9c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6a9c('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6a9c('0x2')]},'ratingType':{'type':Sequelize[_0x6a9c('0x3')](_0x6a9c('0x4'),_0x6a9c('0x5')),'defaultValue':_0x6a9c('0x4')},'ratingMessage':{'type':Sequelize[_0x6a9c('0x6')]},'pathTranscript':{'type':Sequelize[_0x6a9c('0x6')]},'mailTranscript':{'type':Sequelize[_0x6a9c('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6a9c('0x8')]},'disposition':{'type':Sequelize[_0x6a9c('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x6a9c('0x7')]},'osName':{'type':Sequelize[_0x6a9c('0x7')]},'osVersion':{'type':Sequelize[_0x6a9c('0x7')]},'deviceModel':{'type':Sequelize[_0x6a9c('0x7')]},'deviceVendor':{'type':Sequelize[_0x6a9c('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6a9c('0x6')]},'customerIp':{'type':Sequelize[_0x6a9c('0x7')]},'formData':{'type':Sequelize[_0x6a9c('0x6')](_0x6a9c('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x6a9c('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6a9c('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6a9c('0x7')]},'customerPort':{'type':Sequelize[_0x6a9c('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x6a9c('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x6a9c('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index dd3f526..70d53bd 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 _0x7f1d=['limit','set','update','stack','name','send','render','merge','body','contact','agent','interaction','index','map','ChatInteraction','fieldName','key','chat','query','user','then','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options','create','find','params','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','join','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','agentAlias','System','customer','%s%d','Visitor','ContactId','alias','agent_fullname','createdAt','direction','secret','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','include','includeAgent','push','addTags','setTags','omit','Tag','unix','toString','root','server','tmp','files','attachments','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','read','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count'];(function(_0x70404,_0x507113){var _0x2da0b9=function(_0x3fa2a9){while(--_0x3fa2a9){_0x70404['push'](_0x70404['shift']());}};_0x2da0b9(++_0x507113);}(_0x7f1d,0x170));var _0xd7f1=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x7f1d[_0x47aa64];return _0x549c7a;};'use strict';var rimraf=require(_0xd7f1('0x0'));var zipdir=require(_0xd7f1('0x1'));var rp=require(_0xd7f1('0x2'));var moment=require('moment');var BPromise=require(_0xd7f1('0x3'));var Mustache=require(_0xd7f1('0x4'));var util=require('util');var path=require('path');var ejs=require(_0xd7f1('0x5'));var fs=require('fs');var _=require(_0xd7f1('0x6'));var Redis=require(_0xd7f1('0x7'));var interaction=require(_0xd7f1('0x8'));var qs=require(_0xd7f1('0x9'));var pdf=require(_0xd7f1('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xd7f1('0xb'));var db=require('../../mysqldb')['db'];config[_0xd7f1('0xc')]=_[_0xd7f1('0xd')](config[_0xd7f1('0xc')],{'host':_0xd7f1('0xe'),'port':0x18eb});var socket=require(_0xd7f1('0xf'))(new Redis(config[_0xd7f1('0xc')]));require(_0xd7f1('0x10'))['register'](socket);var jayson=require(_0xd7f1('0x11'));var client=jayson[_0xd7f1('0x12')][_0xd7f1('0x13')]({'port':0x232b});var client9004=jayson[_0xd7f1('0x12')][_0xd7f1('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x37f3cc,_0x5b86ae,_0x510b27,_0x237f1f){return new BPromise(function(_0x2969af,_0x360f6a){var _0x27ed70=_0x237f1f||client;return _0x27ed70['request'](_0x37f3cc,_0x510b27)['then'](function(_0x49b590){logger['info'](_0xd7f1('0x14'),_0x5b86ae,_0xd7f1('0x15'));logger[_0xd7f1('0x16')](_0xd7f1('0x17'),_0x5b86ae,_0xd7f1('0x15'),JSON['stringify'](_0x49b590));if(_0x49b590['error']){if(_0x49b590[_0xd7f1('0x18')]['code']===0x1f4){logger[_0xd7f1('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5b86ae,_0x49b590['error'][_0xd7f1('0x19')]);return _0x360f6a(_0x49b590[_0xd7f1('0x18')][_0xd7f1('0x19')]);}logger['error'](_0xd7f1('0x14'),_0x5b86ae,_0x49b590[_0xd7f1('0x18')][_0xd7f1('0x19')]);return _0x2969af(_0x49b590[_0xd7f1('0x18')][_0xd7f1('0x19')]);}else{logger[_0xd7f1('0x1a')](_0xd7f1('0x14'),_0x5b86ae,_0xd7f1('0x15'));_0x2969af(_0x49b590[_0xd7f1('0x1b')]['message']);}})[_0xd7f1('0x1c')](function(_0x51b831){logger[_0xd7f1('0x18')](_0xd7f1('0x14'),_0x5b86ae,_0x51b831);_0x360f6a(_0x51b831);});});}function respondWithStatusCode(_0x3b3acf,_0x3cb36f){_0x3cb36f=_0x3cb36f||0xcc;return function(_0x3e0c6c){if(_0x3e0c6c){return _0x3b3acf[_0xd7f1('0x1d')](_0x3cb36f);}return _0x3b3acf[_0xd7f1('0x1e')](_0x3cb36f)[_0xd7f1('0x1f')]();};}function respondWithResult(_0x50e104,_0x193926){_0x193926=_0x193926||0xc8;return function(_0x1bb71f){if(_0x1bb71f){return _0x50e104[_0xd7f1('0x1e')](_0x193926)[_0xd7f1('0x20')](_0x1bb71f);}};}function respondWithFilteredResult(_0x8c8457,_0x459cb2){return function(_0x2bb33b){if(_0x2bb33b){var _0x5c991a=typeof _0x459cb2[_0xd7f1('0x21')]==='undefined'&&typeof _0x459cb2['limit']===_0xd7f1('0x22');var _0x3f83f1=_0x2bb33b[_0xd7f1('0x23')];var _0x3b6fde=_0x5c991a?0x0:_0x459cb2[_0xd7f1('0x21')];var _0x44adab=_0x5c991a?_0x2bb33b['count']:_0x459cb2[_0xd7f1('0x21')]+_0x459cb2[_0xd7f1('0x24')];var _0x32c142;if(_0x44adab>=_0x3f83f1){_0x44adab=_0x3f83f1;_0x32c142=0xc8;}else{_0x32c142=0xce;}_0x8c8457[_0xd7f1('0x1e')](_0x32c142);return _0x8c8457[_0xd7f1('0x25')]('Content-Range',_0x3b6fde+'-'+_0x44adab+'/'+_0x3f83f1)[_0xd7f1('0x20')](_0x2bb33b);}return null;};}function saveUpdates(_0x17d20f){return function(_0x203e18){if(_0x203e18){return _0x203e18[_0xd7f1('0x26')](_0x17d20f)['then'](function(_0x176afa){return _0x176afa;});}return null;};}function removeEntity(_0x52b714){return function(_0x51144c){if(_0x51144c){return _0x51144c['destroy']()['then'](function(){_0x52b714[_0xd7f1('0x1e')](0xcc)[_0xd7f1('0x1f')]();});}};}function handleEntityNotFound(_0x4b2765){return function(_0x45344e){if(!_0x45344e){_0x4b2765['sendStatus'](0x194);}return _0x45344e;};}function handleError(_0x563be2,_0x7eb48e){_0x7eb48e=_0x7eb48e||0x1f4;return function(_0x41be5e){logger['error'](_0x41be5e[_0xd7f1('0x27')]);if(_0x41be5e[_0xd7f1('0x28')]){delete _0x41be5e[_0xd7f1('0x28')];}_0x563be2[_0xd7f1('0x1e')](_0x7eb48e)[_0xd7f1('0x29')](_0x41be5e);};}function getMustacheRender(_0x122baf,_0x36798d){return Mustache[_0xd7f1('0x2a')](_0x122baf,_[_0xd7f1('0x2b')](_0x36798d[_0xd7f1('0x2c')],{'contact':_0x36798d[_0xd7f1('0x2d')],'message':_0x36798d['message'],'agent':_0x36798d[_0xd7f1('0x2e')],'interaction':_0x36798d[_0xd7f1('0x2f')],'account':_0x36798d['account']}))||'';}exports[_0xd7f1('0x30')]=function(_0x158fa1,_0x42071d){var _0x35d25c={};var _0x4a0aeb=_[_0xd7f1('0x31')](db[_0xd7f1('0x32')]['rawAttributes'],function(_0x3cd225){return{'name':_0x3cd225[_0xd7f1('0x33')],'type':_0x3cd225['type'][_0xd7f1('0x34')]};});_0x35d25c=qs['getOptions'](_0x4a0aeb,_0x158fa1);return interaction['findAll'](_0xd7f1('0x35'),_0x158fa1[_0xd7f1('0x36')],_0x158fa1[_0xd7f1('0x37')],_0x35d25c,_0x4a0aeb)[_0xd7f1('0x38')](respondWithFilteredResult(_0x42071d,_0x35d25c))[_0xd7f1('0x1c')](handleError(_0x42071d,null));};exports[_0xd7f1('0x39')]=function(_0x5c2dc0,_0x3cf43c){var _0x2d8f44={'raw':![],'where':{'id':_0x5c2dc0['params']['id']}},_0x54a021={};_0x54a021[_0xd7f1('0x3a')]=_[_0xd7f1('0x3b')](db[_0xd7f1('0x32')][_0xd7f1('0x3c')]);_0x54a021[_0xd7f1('0x36')]=_[_0xd7f1('0x3b')](_0x5c2dc0[_0xd7f1('0x36')]);_0x54a021[_0xd7f1('0x3d')]=_[_0xd7f1('0x3e')](_0x54a021[_0xd7f1('0x3a')],_0x54a021['query']);_0x2d8f44[_0xd7f1('0x3f')]=_[_0xd7f1('0x3e')](_0x54a021[_0xd7f1('0x3a')],qs[_0xd7f1('0x40')](_0x5c2dc0[_0xd7f1('0x36')][_0xd7f1('0x40')]));_0x2d8f44[_0xd7f1('0x3f')]=_0x2d8f44['attributes'][_0xd7f1('0x41')]?_0x2d8f44[_0xd7f1('0x3f')]:_0x54a021['model'];if(_0x5c2dc0[_0xd7f1('0x36')][_0xd7f1('0x42')]){_0x2d8f44['include']=[{'all':!![]}];}_0x2d8f44=_['merge']({},_0x2d8f44,_0x5c2dc0[_0xd7f1('0x43')]);return db['ChatInteraction']['find'](_0x2d8f44)[_0xd7f1('0x38')](handleEntityNotFound(_0x3cf43c,null))[_0xd7f1('0x38')](respondWithResult(_0x3cf43c,null))[_0xd7f1('0x1c')](handleError(_0x3cf43c,null));};exports[_0xd7f1('0x44')]=function(_0x5f0cdc,_0x1bc89d){return db['ChatInteraction'][_0xd7f1('0x44')](_0x5f0cdc[_0xd7f1('0x2c')],{})[_0xd7f1('0x38')](respondWithResult(_0x1bc89d,0xc9))['catch'](handleError(_0x1bc89d,null));};exports[_0xd7f1('0x26')]=function(_0x2acebd,_0x1bef96){if(_0x2acebd[_0xd7f1('0x2c')]['id']){delete _0x2acebd[_0xd7f1('0x2c')]['id'];}return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x2acebd['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x1bef96,null))[_0xd7f1('0x38')](saveUpdates(_0x2acebd[_0xd7f1('0x2c')],null))[_0xd7f1('0x38')](respondWithResult(_0x1bef96,null))[_0xd7f1('0x1c')](handleError(_0x1bef96,null));};exports['destroy']=function(_0x4a2a2a,_0x52bab0){return db['ChatInteraction']['find']({'where':{'id':_0x4a2a2a[_0xd7f1('0x46')]['id']}})['then'](handleEntityNotFound(_0x52bab0,null))[_0xd7f1('0x38')](removeEntity(_0x52bab0,null))[_0xd7f1('0x1c')](handleError(_0x52bab0,null));};exports[_0xd7f1('0x47')]=function(_0x4f9552,_0x35d9f0){return db['ChatInteraction'][_0xd7f1('0x47')]()[_0xd7f1('0x38')](respondWithResult(_0x35d9f0,null))[_0xd7f1('0x1c')](handleError(_0x35d9f0,null));};exports['createVidaooSession']=function(_0x3d8da8,_0x2077f7){var _0x343e9c=_0x3d8da8[_0xd7f1('0x46')]['id'];var _0xfba2db;var _0x2d5203;var _0x24eecb;return db[_0xd7f1('0x32')][_0xd7f1('0x48')]({'where':{'id':_0x343e9c}})[_0xd7f1('0x38')](function(_0x351e91){_0xfba2db=_0x351e91;return db[_0xd7f1('0x49')]['findOne']({'where':{'id':_0x351e91[_0xd7f1('0x4a')]},'attributes':['id','vidaooApiKey',_0xd7f1('0x4b'),_0xd7f1('0x4c'),_0xd7f1('0x4d'),_0xd7f1('0x4e')],'raw':!![]});})[_0xd7f1('0x38')](function(_0x4d223f){if(_0x4d223f&&_0x4d223f[_0xd7f1('0x4f')]&&_0x4d223f[_0xd7f1('0x4b')]){_0x2d5203=_0x4d223f;var _0x42b90a={'interaction':{'id':_0x343e9c},'agent':{'id':_0x3d8da8[_0xd7f1('0x37')]['id'],'name':_0x3d8da8['user'][_0xd7f1('0x28')],'fullname':_0x3d8da8[_0xd7f1('0x37')][_0xd7f1('0x50')],'email':_0x3d8da8[_0xd7f1('0x37')][_0xd7f1('0x51')]},'contact':_0x3d8da8['body'][_0xd7f1('0x2d')],'account':_0x3d8da8[_0xd7f1('0x2c')][_0xd7f1('0x52')]};var _0x2a70a4={'rejectUnauthorized':![],'method':_0xd7f1('0x53'),'url':_0xd7f1('0x54'),'headers':{'X-APIKEY':_0x4d223f[_0xd7f1('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3d8da8[_0xd7f1('0x37')][_0xd7f1('0x51')]],'buttons':null,'topic':_0x2d5203[_0xd7f1('0x4c')],'note':_[_0xd7f1('0x55')](_0x2d5203[_0xd7f1('0x4d')])?null:getMustacheRender(_0x2d5203[_0xd7f1('0x4d')],_0x42b90a),'metadata':null},'redirect':_0xd7f1('0x56'),'json':!![]};try{if(!_[_0xd7f1('0x55')](_0x2d5203[_0xd7f1('0x4e')])){var _0x2005b9=getMustacheRender(_0x2d5203[_0xd7f1('0x4e')],_0x42b90a);var _0x8ce093=JSON[_0xd7f1('0x57')](_0x2005b9);_0x2a70a4['body'][_0xd7f1('0x58')]=_0x8ce093;}}catch(_0x5b2d44){throw new db[(_0xd7f1('0x59'))][(_0xd7f1('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2a70a4);}else{throw new db[(_0xd7f1('0x59'))]['ValidationError'](_0xd7f1('0x5b'));}})[_0xd7f1('0x38')](function(_0x26b780){_0x24eecb=_0x26b780;if(_0x24eecb['id']){var _0x168a14={'body':_0x24eecb[_0xd7f1('0x5c')],'ChatWebsiteId':_0x2d5203['id'],'ChatInteractionId':_0xfba2db['id'],'direction':_0xd7f1('0x5d'),'UserId':_0x3d8da8['user']['id']};return db[_0xd7f1('0x5e')][_0xd7f1('0x44')](_0x168a14,{});}else{throw new db[(_0xd7f1('0x59'))][(_0xd7f1('0x5a'))](_0xd7f1('0x5f'));}})['then'](function(){return _0xfba2db[_0xd7f1('0x60')]({'vidaooSessionId':_0x24eecb['id']});})['then'](respondWithResult(_0x2077f7,null))[_0xd7f1('0x1c')](handleError(_0x2077f7,null));};exports[_0xd7f1('0x61')]=function(_0x18cc90,_0x31def8){if(_0x18cc90[_0xd7f1('0x2c')]['id']){delete _0x18cc90['body']['id'];}return db[_0xd7f1('0x32')]['find']({'where':{'id':_0x18cc90[_0xd7f1('0x46')]['id']},'include':[{'model':db[_0xd7f1('0x62')],'as':_0xd7f1('0x63')}]})[_0xd7f1('0x38')](handleEntityNotFound(_0x31def8,null))[_0xd7f1('0x38')](saveUpdates(_0x18cc90['body'],null))[_0xd7f1('0x38')](respondWithResult(_0x31def8,null))[_0xd7f1('0x1c')](handleError(_0x31def8,null));};exports[_0xd7f1('0x64')]=function(_0x2a3a27,_0xd38d03){if(_0x2a3a27[_0xd7f1('0x2c')]['id']){delete _0x2a3a27[_0xd7f1('0x2c')]['id'];}return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x2a3a27['params']['id']}})['then'](function(_0x2c9f7b){if(!_0x2c9f7b){logger[_0xd7f1('0x18')](_0xd7f1('0x65'),_0xd7f1('0x64'),0x194,_0xd7f1('0x66'));_0xd38d03[_0xd7f1('0x1d')](0x194);}else{if(_0x2c9f7b[_0xd7f1('0x67')]){throw new db[(_0xd7f1('0x59'))][(_0xd7f1('0x5a'))](_0xd7f1('0x68'));}}return _0x2c9f7b;})['then'](function(_0xda5ae0){if(_0xda5ae0){return _0xda5ae0['update']({'closed':_0x2a3a27[_0xd7f1('0x2c')][_0xd7f1('0x69')],'disposition':_0x2a3a27[_0xd7f1('0x2c')][_0xd7f1('0x6a')]})[_0xd7f1('0x38')](function(_0x1d778a){return _0x1d778a;});}})[_0xd7f1('0x38')](function(){return respondWithRpcPromise(_0xd7f1('0x6b'),_0xd7f1('0x64'),_0x2a3a27[_0xd7f1('0x2c')],client9004);})[_0xd7f1('0x38')](respondWithResult(_0xd38d03,null))['catch'](handleError(_0xd38d03,null));};exports[_0xd7f1('0x6c')]=function(_0xdba8e2,_0xb1b415){_0xdba8e2['body'][_0xd7f1('0x28')]=_0xdba8e2[_0xd7f1('0x6d')][_0xd7f1('0x6e')];_0xdba8e2[_0xd7f1('0x2c')][_0xd7f1('0x6f')]=_0xdba8e2[_0xd7f1('0x6d')][_0xd7f1('0x70')];_0xdba8e2[_0xd7f1('0x2c')]['type']=_0xdba8e2[_0xd7f1('0x6d')]['mimetype'];return db[_0xd7f1('0x71')][_0xd7f1('0x44')](_0xdba8e2[_0xd7f1('0x2c')])[_0xd7f1('0x38')](respondWithResult(_0xb1b415,0xc9))[_0xd7f1('0x1c')](handleError(_0xb1b415,null));};exports[_0xd7f1('0x72')]=function(_0x18b2e8,_0x277a4d){return db[_0xd7f1('0x32')][_0xd7f1('0x48')]({'where':{'id':_0x18b2e8[_0xd7f1('0x46')]['id']},'raw':!![]})[_0xd7f1('0x38')](handleEntityNotFound(_0x277a4d,null))['then'](function(_0x16d9df){if(_0x16d9df){if(_0x16d9df[_0xd7f1('0x69')]){return _0x277a4d['status'](0x193)[_0xd7f1('0x20')]({'status':0x193,'message':_0xd7f1('0x73')});}return db[_0xd7f1('0x71')][_0xd7f1('0x48')]({'where':{'id':_0x18b2e8[_0xd7f1('0x36')][_0xd7f1('0x74')]},'raw':!![]})['then'](handleEntityNotFound(_0x277a4d,null));}})[_0xd7f1('0x38')](function(_0x2d2a50){if(_0x2d2a50){var _0x28b3b1=_0x2d2a50['ChatOfflineMessageId']!==null;var _0x14ece6=path[_0xd7f1('0x75')](config['root'],'server/files/attachments/');if(_0x28b3b1){_0x14ece6=path['join'](_0x14ece6,_0xd7f1('0x76'));}var _0xea926c=path[_0xd7f1('0x75')](_0x14ece6,_0x2d2a50[_0xd7f1('0x6f')]);return _0x277a4d[_0xd7f1('0x77')](_0xea926c);}})[_0xd7f1('0x1c')](handleError(_0x277a4d,null));};exports[_0xd7f1('0x78')]=function(_0x8cd360,_0x465cc4){var _0x3955c0=null;var _0xbf12a4=null;var _0x32be9b=null;if(_0x8cd360[_0xd7f1('0x2c')]['id']){delete _0x8cd360['body']['id'];}if(_0x8cd360[_0xd7f1('0x2c')][_0xd7f1('0x79')]){_0x32be9b=path[_0xd7f1('0x75')](config['root'],'server/files/chat/upload/',util[_0xd7f1('0x7a')](_0xd7f1('0x7b'),Date[_0xd7f1('0x7c')]()));_0x8cd360[_0xd7f1('0x2c')][_0xd7f1('0x7d')]=_0x32be9b;}return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x8cd360['params']['id']},'include':[{'model':db[_0xd7f1('0x5e')],'as':_0xd7f1('0x7e'),'include':[{'model':db['User'],'as':_0xd7f1('0x7f')}]}]})['then'](handleEntityNotFound(_0x465cc4,null))[_0xd7f1('0x38')](saveUpdates(_0x8cd360[_0xd7f1('0x2c')],null))['then'](function(_0x3ac2d1){if(_0x3ac2d1){_0x3955c0=_0x3ac2d1;return db[_0xd7f1('0x49')][_0xd7f1('0x45')]({'where':{'id':_0x3955c0[_0xd7f1('0x4a')]}});}})[_0xd7f1('0x38')](function(_0x5a5d29){if(_0x5a5d29){_0xbf12a4=_0x5a5d29;return db[_0xd7f1('0x62')][_0xd7f1('0x45')]({'where':{'id':_0x3955c0['ContactId']}});}})['then'](function(_0xbb3400){if(_0xbb3400){if(_0x32be9b){var _0x145346=null;for(var _0x48a5ac=0x1;_0x48a5ac<_0x3955c0[_0xd7f1('0x7e')][_0xd7f1('0x41')];++_0x48a5ac){_0x145346=_0x3955c0[_0xd7f1('0x7e')][_0x48a5ac];var _0xaabcb7=_0x145346[_0xd7f1('0x67')]?util[_0xd7f1('0x7a')]('%s%d',_0xbf12a4[_0xd7f1('0x80')],_0x145346[_0xd7f1('0x67')]):_0xd7f1('0x81');var _0x240d0d=_0x8cd360['body'][_0xd7f1('0x82')]||util[_0xd7f1('0x7a')](_0xd7f1('0x83'),_0xd7f1('0x84'),_0x145346[_0xd7f1('0x85')]);switch(_0xbf12a4['agentIdentifier']){case'website_alias':_0xaabcb7=_0x145346['UserId']?util[_0xd7f1('0x7a')](_0xd7f1('0x83'),_0xbf12a4[_0xd7f1('0x80')],_0x145346[_0xd7f1('0x67')]):'System';break;case'agent_alias':_0xaabcb7=_0x145346['UserId']?_0x145346[_0xd7f1('0x7f')][_0xd7f1('0x86')]||_0x145346[_0xd7f1('0x7f')]['fullname']:_0xd7f1('0x81');break;case _0xd7f1('0x87'):_0xaabcb7=_0x145346['UserId']?_0x145346[_0xd7f1('0x7f')][_0xd7f1('0x50')]:'System';break;default:_0xaabcb7=_0x145346[_0xd7f1('0x67')]?util[_0xd7f1('0x7a')](_0xd7f1('0x83'),_0xbf12a4['agentAlias'],_0x145346[_0xd7f1('0x67')]):'System';}var _0x1e7cae=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x145346[_0xd7f1('0x88')])[_0xd7f1('0x7a')]('MM/DD/YYYY\x20HH:mm:ss'),_0x145346[_0xd7f1('0x89')]==='in'?_0x240d0d:_0xaabcb7,_0x145346[_0xd7f1('0x2c')]);if(!_0x145346[_0xd7f1('0x8a')]){fs[_0xd7f1('0x8b')](_0x32be9b,_0x1e7cae);}}return db['MailAccount'][_0xd7f1('0x48')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd7f1('0x8c'),'raw':!![],'include':[{'model':db[_0xd7f1('0x8d')],'as':_0xd7f1('0x8d'),'raw':!![]}]}]});}}})[_0xd7f1('0x38')](function(_0x449fc5){if(!_0x449fc5||!_0x449fc5[_0xd7f1('0x8c')]||!_0x8cd360[_0xd7f1('0x2c')])return _0x3955c0;var _0x1f6692=_0x449fc5[_0xd7f1('0x8e')]();return respondWithRpcPromise(_0xd7f1('0x8f'),_0xd7f1('0x90'),{'account':_0x1f6692,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x449fc5[_0xd7f1('0x28')],_0x449fc5[_0xd7f1('0x51')]||_0x449fc5[_0xd7f1('0x8c')][_0xd7f1('0x37')]),'to':_0x8cd360[_0xd7f1('0x2c')][_0xd7f1('0x79')],'subject':'Mail\x20Transcript','text':util['format'](_0xd7f1('0x91'),_0x8cd360['body']['mailTranscript']),'attachments':[{'path':_0x32be9b}]}})['then'](function(){return _0x3955c0;})[_0xd7f1('0x1c')](function(_0x3d52a8){logger['error'](_0x3d52a8);});})['then'](respondWithStatusCode(_0x465cc4,0xc8))[_0xd7f1('0x1c')](handleError(_0x465cc4,null));};exports[_0xd7f1('0x92')]=function(_0x3327c0,_0x593b3e){return db[_0xd7f1('0x5e')][_0xd7f1('0x45')]({'where':{'id':_0x3327c0['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x593b3e,null))[_0xd7f1('0x38')](function(_0x22856b){if(_0x22856b){return _0x22856b[_0xd7f1('0x92')](_0x3327c0[_0xd7f1('0x2c')][_0xd7f1('0x93')],_['omit'](_0x3327c0[_0xd7f1('0x2c')],[_0xd7f1('0x93'),'id'])||{});}})[_0xd7f1('0x38')](respondWithResult(_0x593b3e,null))[_0xd7f1('0x1c')](handleError(_0x593b3e,null));};exports[_0xd7f1('0x94')]=function(_0x4036ef,_0x1dfdaf){var _0x519cd5={'raw':![],'where':{}};var _0x52ea41={};var _0x364503={'count':0x0,'rows':[]};return db[_0xd7f1('0x32')][_0xd7f1('0x48')]({'where':{'id':_0x4036ef['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x1dfdaf,null))[_0xd7f1('0x38')](function(_0xf82973){if(_0xf82973){_0x52ea41[_0xd7f1('0x3a')]=_[_0xd7f1('0x3b')](db['ChatMessage'][_0xd7f1('0x3c')]);_0x52ea41[_0xd7f1('0x36')]=_[_0xd7f1('0x3b')](_0x4036ef[_0xd7f1('0x36')]);_0x52ea41[_0xd7f1('0x3d')]=_['intersection'](_0x52ea41[_0xd7f1('0x3a')],_0x52ea41['query']);_0x519cd5[_0xd7f1('0x3f')]=_[_0xd7f1('0x3e')](_0x52ea41[_0xd7f1('0x3a')],qs[_0xd7f1('0x40')](_0x4036ef['query'][_0xd7f1('0x40')]));_0x519cd5['attributes']=_0x519cd5['attributes']['length']?_0x519cd5[_0xd7f1('0x3f')]:_0x52ea41[_0xd7f1('0x3a')];if(!_0x4036ef['query'][_0xd7f1('0x95')](_0xd7f1('0x96'))){_0x519cd5[_0xd7f1('0x24')]=qs[_0xd7f1('0x24')](_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x24')]);_0x519cd5[_0xd7f1('0x21')]=qs['offset'](_0x4036ef['query'][_0xd7f1('0x21')]);}_0x519cd5[_0xd7f1('0x97')]=qs[_0xd7f1('0x98')](_0x4036ef['query'][_0xd7f1('0x98')]);_0x519cd5[_0xd7f1('0x99')]=qs[_0xd7f1('0x3d')](_[_0xd7f1('0x9a')](_0x4036ef[_0xd7f1('0x36')],_0x52ea41['filters']));_0x519cd5[_0xd7f1('0x99')][_0xd7f1('0x9b')]=_0xf82973['id'];if(_0x4036ef['query'][_0xd7f1('0x9c')]){_0x519cd5[_0xd7f1('0x99')]=_[_0xd7f1('0x2b')](_0x519cd5['where'],{'$or':_[_0xd7f1('0x31')](_0x519cd5[_0xd7f1('0x3f')],function(_0x1c3f2d){var _0x41a08d={};_0x41a08d[_0x1c3f2d]={'$like':'%'+_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x9c')]+'%'};return _0x41a08d;})});}if(_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x9d')]){var _0x44c328=_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x9d')][_0xd7f1('0x9e')](',');var _0x194e9a={};_0x194e9a[_0x44c328[0x0]]={'$gte':moment(_0x44c328[0x1])[_0xd7f1('0x7a')](_0xd7f1('0x9f'))};_0x519cd5[_0xd7f1('0x99')]=_[_0xd7f1('0x2b')](_0x519cd5[_0xd7f1('0x99')],_0x194e9a);}_0x519cd5=_[_0xd7f1('0x2b')]({},_0x519cd5,_0x4036ef[_0xd7f1('0x43')]);return db['ChatMessage'][_0xd7f1('0x23')]({'where':_0x519cd5['where']})[_0xd7f1('0x38')](function(_0xb19e0a){_0x364503['count']=_0xb19e0a;if(_0x4036ef[_0xd7f1('0x36')][_0xd7f1('0x42')]){_0x519cd5['include']=[{'all':!![]}];}return db[_0xd7f1('0x5e')][_0xd7f1('0xa0')](_0x519cd5);})[_0xd7f1('0x38')](function(_0x3fc5a6){_0x364503[_0xd7f1('0xa1')]=_0x3fc5a6;return _0x364503;});}})[_0xd7f1('0x38')](respondWithFilteredResult(_0x1dfdaf,_0x519cd5))['catch'](handleError(_0x1dfdaf,null));};exports[_0xd7f1('0xa2')]=function(_0x368e48,_0x2d8032){var _0x4f676c={'where':{}},_0x140ebb={},_0x5181be={'count':0x0,'rows':[]};return db[_0xd7f1('0x32')][_0xd7f1('0x48')]({'where':{'id':_0x368e48[_0xd7f1('0x46')]['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x2d8032,null))[_0xd7f1('0x38')](function(_0x590828){if(_0x590828){_0x140ebb[_0xd7f1('0x3a')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x140ebb[_0xd7f1('0x36')]=_['keys'](_0x368e48['query']);_0x140ebb[_0xd7f1('0x3d')]=_['intersection'](_0x140ebb[_0xd7f1('0x3a')],_0x140ebb[_0xd7f1('0x36')]);_0x4f676c[_0xd7f1('0x3f')]=_['intersection'](_0x140ebb[_0xd7f1('0x3a')],qs[_0xd7f1('0x40')](_0x368e48[_0xd7f1('0x36')]['fields']));_0x4f676c[_0xd7f1('0x3f')]=_0x4f676c[_0xd7f1('0x3f')][_0xd7f1('0x41')]?_0x4f676c['attributes']:_0x140ebb[_0xd7f1('0x3a')];if(!_0x368e48['query'][_0xd7f1('0x95')](_0xd7f1('0x96'))){_0x4f676c[_0xd7f1('0x24')]=qs['limit'](_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x24')]);_0x4f676c[_0xd7f1('0x21')]=qs[_0xd7f1('0x21')](_0x368e48[_0xd7f1('0x36')]['offset']);}_0x4f676c[_0xd7f1('0x97')]=qs[_0xd7f1('0x98')](_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x98')]);_0x4f676c[_0xd7f1('0x99')]=qs[_0xd7f1('0x3d')](_['pick'](_0x368e48[_0xd7f1('0x36')],_0x140ebb[_0xd7f1('0x3d')]));_0x4f676c['where']['ChatInteractionId']=_0x590828['id'];if(_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x9c')]){_0x4f676c[_0xd7f1('0x99')]=_[_0xd7f1('0x2b')](_0x4f676c['where'],{'$or':_[_0xd7f1('0x31')](_0x4f676c[_0xd7f1('0x3f')],function(_0x253327){var _0x345abc={};_0x345abc[_0x253327]={'$like':'%'+_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x9c')]+'%'};return _0x345abc;})});}_0x4f676c[_0xd7f1('0x99')]['secret']=![];if(_0x368e48['query']['id']){_0x4f676c[_0xd7f1('0x99')]['id']={'$gt':_0x368e48[_0xd7f1('0x36')]['id']};}_0x4f676c=_[_0xd7f1('0x2b')]({},_0x4f676c,_0x368e48[_0xd7f1('0x43')]);return db['ChatMessage'][_0xd7f1('0x23')]({'where':_0x4f676c[_0xd7f1('0x99')]})[_0xd7f1('0x38')](function(_0x234c84){_0x5181be[_0xd7f1('0x23')]=_0x234c84;_0x4f676c[_0xd7f1('0xa3')]=[];if(_0x368e48[_0xd7f1('0x36')][_0xd7f1('0xa4')]){_0x4f676c[_0xd7f1('0xa3')][_0xd7f1('0xa5')]({'model':db[_0xd7f1('0x7f')],'as':_0xd7f1('0x7f'),'attributes':['id',_0xd7f1('0x50'),_0xd7f1('0x86')]});}if(_0x368e48[_0xd7f1('0x36')][_0xd7f1('0x42')]){_0x4f676c[_0xd7f1('0xa3')]=[{'all':!![]}];}return db['ChatMessage'][_0xd7f1('0xa0')](_0x4f676c);})[_0xd7f1('0x38')](function(_0x209e9d){_0x5181be['rows']=_0x209e9d;return _0x5181be;});}})[_0xd7f1('0x38')](respondWithFilteredResult(_0x2d8032,_0x4f676c))[_0xd7f1('0x1c')](handleError(_0x2d8032,null));};exports[_0xd7f1('0xa6')]=function(_0x479fda,_0x324210){return db['ChatInteraction']['find']({'where':{'id':_0x479fda['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x324210,null))[_0xd7f1('0x38')](function(_0x59066a){if(_0x59066a){return _0x59066a[_0xd7f1('0xa7')](_0x479fda[_0xd7f1('0x2c')]['ids'],_[_0xd7f1('0xa8')](_0x479fda[_0xd7f1('0x2c')],['ids','id'])||{})['spread'](function(){return db[_0xd7f1('0xa9')][_0xd7f1('0xa0')]({'attributes':['id',_0xd7f1('0x28'),'color'],'where':{'id':_0x479fda['body'][_0xd7f1('0x93')]}});})[_0xd7f1('0x38')](function(_0x3657c0){socket['emit']('chatInteractionTags:save',{'id':Number(_0x479fda[_0xd7f1('0x46')]['id']),'tags':_0x3657c0||[]});return{'id':Number(_0x479fda['params']['id']),'tags':_0x3657c0||[]};});}})[_0xd7f1('0x38')](respondWithResult(_0x324210,null))[_0xd7f1('0x1c')](handleError(_0x324210,null));};exports['removeTags']=function(_0x25b763,_0x25d799){return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x25b763['params']['id']}})[_0xd7f1('0x38')](handleEntityNotFound(_0x25d799,null))[_0xd7f1('0x38')](function(_0x2d5a9a){if(_0x2d5a9a){return _0x2d5a9a['removeTags'](_0x25b763['query'][_0xd7f1('0x93')]);}})['then'](respondWithStatusCode(_0x25d799,null))[_0xd7f1('0x1c')](handleError(_0x25d799,null));};exports['download']=function(_0x3ab014,_0x2361bd){var _0x3a1f10=moment()[_0xd7f1('0xaa')]()[_0xd7f1('0xab')]();var _0x25572d=path[_0xd7f1('0x75')](config[_0xd7f1('0xac')],_0xd7f1('0xad'),'files',_0xd7f1('0xae'));var _0x562f63=path[_0xd7f1('0x75')](config['root'],_0xd7f1('0xad'),_0xd7f1('0xaf'),_0xd7f1('0xb0'));var _0x523288=path[_0xd7f1('0x75')](_0x25572d,_0x3a1f10);var _0x1c318a=util[_0xd7f1('0x7a')]('transcript-%d-%s.zip',_0x3ab014[_0xd7f1('0x46')]['id'],_0x3a1f10);var _0x34f908=path['join'](_0x25572d,_0x1c318a);var _0x1f84a1=[];_0x1f84a1[_0xd7f1('0xa5')]({'model':db[_0xd7f1('0x7f')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1f84a1[_0xd7f1('0xa5')]({'model':db[_0xd7f1('0x62')],'as':_0xd7f1('0x63'),'attributes':['id',_0xd7f1('0xb1'),_0xd7f1('0xb2')],'raw':!![]});if(_0x3ab014[_0xd7f1('0x36')][_0xd7f1('0xb0')]){_0x1f84a1[_0xd7f1('0xa5')]({'model':db[_0xd7f1('0x71')],'as':'Attachment','raw':!![]});}var _0x34b26e=[{'model':db[_0xd7f1('0x5e')],'as':'Messages','attributes':['id','body',_0xd7f1('0x88'),_0xd7f1('0x89'),'secret','read'],'include':_0x1f84a1}];_0x34b26e['push']({'model':db[_0xd7f1('0x49')],'as':_0xd7f1('0xb3'),'attributes':['id',_0xd7f1('0x28')]});_0x34b26e['push']({'model':db[_0xd7f1('0x7f')],'as':_0xd7f1('0xb4'),'attributes':['id','fullname']});return db[_0xd7f1('0x32')][_0xd7f1('0x45')]({'where':{'id':_0x3ab014['params']['id']},'include':_0x34b26e})[_0xd7f1('0x38')](handleEntityNotFound(_0x2361bd,null))[_0xd7f1('0x38')](function(_0x4e2269){if(_0x4e2269){var _0x3ee709=_0x4e2269[_0xd7f1('0xb5')]({'plain':!![]});fs[_0xd7f1('0xb6')](_0x523288);var _0x4b259d={'channel':_0xd7f1('0xb7'),'account':_0x3ee709[_0xd7f1('0xb3')][_0xd7f1('0x28')],'agent':_0x3ee709['Owner']?_0x3ee709[_0xd7f1('0xb4')][_0xd7f1('0x50')]:_0xd7f1('0xb8'),'createdAt':moment(_0x3ee709[_0xd7f1('0x88')])[_0xd7f1('0x7a')](_0xd7f1('0x9f'))[_0xd7f1('0xab')](),'closedAt':_0x3ee709[_0xd7f1('0x69')]?moment(_0x3ee709[_0xd7f1('0xb9')])[_0xd7f1('0x7a')](_0xd7f1('0x9f'))['toString']():'','disposition':_0x3ee709['disposition'],'chatInfo':{'browser':_0x3ee709[_0xd7f1('0xba')],'os':_0x3ee709[_0xd7f1('0xbb')],'referer':_0x3ee709[_0xd7f1('0xbc')],'customerIp':_0x3ee709[_0xd7f1('0xbd')],'customerPort':_0x3ee709[_0xd7f1('0xbe')]?_0x3ee709[_0xd7f1('0xbe')]:_0xd7f1('0xb8')},'messages':_(_0x3ee709['Messages'])[_0xd7f1('0xbf')]()[_0xd7f1('0x9c')]({'secret':![]})[_0xd7f1('0x31')](function(_0xe4715e){if(_0xe4715e['Attachment']){var _0x6cc653=path[_0xd7f1('0x75')](_0x562f63,_0xe4715e[_0xd7f1('0x71')][_0xd7f1('0x6f')]);if(fs[_0xd7f1('0xc0')](_0x6cc653)){fs[_0xd7f1('0xc1')](_0x6cc653)[_0xd7f1('0xc2')](fs[_0xd7f1('0xc3')](path[_0xd7f1('0x75')](_0x523288,_0xe4715e['Attachment'][_0xd7f1('0x6f')])));}}return{'date':moment(_0xe4715e[_0xd7f1('0x88')])[_0xd7f1('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd7f1('0xab')](),'sender':_0xe4715e[_0xd7f1('0x89')]===_0xd7f1('0x5d')?_0xe4715e['User']?_0xe4715e[_0xd7f1('0x7f')]['fullname']:_0xd7f1('0x81'):_0xe4715e[_0xd7f1('0x63')]['firstName']+(_0xe4715e[_0xd7f1('0x63')][_0xd7f1('0xb2')]?'\x20'+_0xe4715e[_0xd7f1('0x63')][_0xd7f1('0xb2')]:''),'body':_0xe4715e[_0xd7f1('0x71')]?_0xe4715e[_0xd7f1('0x71')]['basename']:_0xe4715e[_0xd7f1('0x2c')],'direction':_0xe4715e['direction']===_0xd7f1('0x5d')?'A':'C','secret':_0xe4715e['secret'],'read':_0xe4715e[_0xd7f1('0xc4')],'attachment':_0xe4715e[_0xd7f1('0x71')]};})['value']()};return ejs['renderFile'](path[_0xd7f1('0x75')](config[_0xd7f1('0xac')],_0xd7f1('0xad'),_0xd7f1('0xc5'),'downloadInteraction.ejs'),{'interaction':_0x4b259d})[_0xd7f1('0x38')](function(_0x9b102a){var _0x522e30=path[_0xd7f1('0x75')](_0x523288,_0xd7f1('0xc6')+_0x3ee709['id']+'-'+_0x3a1f10+_0xd7f1('0xc7'));var _0x42c7da={'path':_0x522e30,'channel':_0xd7f1('0xb7'),'interactionId':_0x3ee709['id']};return pdf[_0xd7f1('0xc8')](_0x9b102a,_0x42c7da);})[_0xd7f1('0x38')](function(){return new Promise(function(_0x1ebba8,_0x4da180){zipdir(_0x523288,{'saveTo':_0x34f908},function(_0x2054ad,_0x595d0b){if(_0x2054ad)return _0x4da180(_0x2054ad);return _0x1ebba8(_0x595d0b);});})[_0xd7f1('0x38')](function(){return new BPromise(function(_0x246609,_0x5c1ac7){rimraf(_0x523288,function(_0x5dfa2e){if(_0x5dfa2e)_0x5c1ac7(_0x5dfa2e);return _0x246609();});});})[_0xd7f1('0x38')](function(){return _0x2361bd['download'](_0x34f908,_0x1c318a,function(_0x37286b){if(_0x37286b){logger['error']('err',_0x37286b);}else{fs[_0xd7f1('0xc9')](_0x34f908);}});});});}else{return _0x2361bd[_0xd7f1('0x1d')](0xc8);}})[_0xd7f1('0x1c')](handleError(_0x2361bd,null));}; \ No newline at end of file +var _0x0e42=['create','destroy','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','vidaooTopic','follow','isNull','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','agentAlias','System','customer','%s%d','Visitor','ContactId','website_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','push','rows','addTags','omit','spread','Tag','color','emit','removeTags','toString','files','server','transcript-%d-%s.zip','firstName','attachments','ChatWebsite','Account','Owner','get','mkdirSync','Chat','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','direction','lastName','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','json','update','name','send','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','findAll','user','show','params','model','keys','ChatInteraction','filters','intersection','query','attributes','fields','length','includeAll','include','options','find'];(function(_0x1ed938,_0x3ee138){var _0x30b8a1=function(_0x4b7103){while(--_0x4b7103){_0x1ed938['push'](_0x1ed938['shift']());}};_0x30b8a1(++_0x3ee138);}(_0x0e42,0x14e));var _0x20e4=function(_0x14989b,_0xc4ae0){_0x14989b=_0x14989b-0x0;var _0x1c9f55=_0x0e42[_0x14989b];return _0x1c9f55;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x20e4('0x0'));var rp=require(_0x20e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x20e4('0x2'));var path=require(_0x20e4('0x3'));var ejs=require(_0x20e4('0x4'));var fs=require('fs');var _=require(_0x20e4('0x5'));var Redis=require(_0x20e4('0x6'));var interaction=require(_0x20e4('0x7'));var qs=require(_0x20e4('0x8'));var pdf=require(_0x20e4('0x9'));var logger=require(_0x20e4('0xa'))(_0x20e4('0xb'));var config=require(_0x20e4('0xc'));var db=require(_0x20e4('0xd'))['db'];config['redis']=_[_0x20e4('0xe')](config[_0x20e4('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x20e4('0x10'))(new Redis(config[_0x20e4('0xf')]));require(_0x20e4('0x11'))['register'](socket);var jayson=require(_0x20e4('0x12'));var client=jayson[_0x20e4('0x13')][_0x20e4('0x14')]({'port':0x232b});var client9004=jayson[_0x20e4('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0xf6d6a9,_0x110f51,_0x487461,_0x202f17){return new BPromise(function(_0x15ad61,_0x5be9d5){var _0x1cbf48=_0x202f17||client;return _0x1cbf48['request'](_0xf6d6a9,_0x487461)[_0x20e4('0x15')](function(_0x185292){logger['info'](_0x20e4('0x16'),_0x110f51,_0x20e4('0x17'));logger[_0x20e4('0x18')](_0x20e4('0x19'),_0x110f51,_0x20e4('0x17'),JSON[_0x20e4('0x1a')](_0x185292));if(_0x185292[_0x20e4('0x1b')]){if(_0x185292[_0x20e4('0x1b')][_0x20e4('0x1c')]===0x1f4){logger[_0x20e4('0x1b')](_0x20e4('0x16'),_0x110f51,_0x185292[_0x20e4('0x1b')][_0x20e4('0x1d')]);return _0x5be9d5(_0x185292[_0x20e4('0x1b')][_0x20e4('0x1d')]);}logger[_0x20e4('0x1b')](_0x20e4('0x16'),_0x110f51,_0x185292[_0x20e4('0x1b')][_0x20e4('0x1d')]);return _0x15ad61(_0x185292['error']['message']);}else{logger[_0x20e4('0x1e')](_0x20e4('0x16'),_0x110f51,_0x20e4('0x17'));_0x15ad61(_0x185292[_0x20e4('0x1f')][_0x20e4('0x1d')]);}})[_0x20e4('0x20')](function(_0x3bba22){logger[_0x20e4('0x1b')](_0x20e4('0x16'),_0x110f51,_0x3bba22);_0x5be9d5(_0x3bba22);});});}function respondWithStatusCode(_0xddec2b,_0x1b29e3){_0x1b29e3=_0x1b29e3||0xcc;return function(_0x5d17dc){if(_0x5d17dc){return _0xddec2b[_0x20e4('0x21')](_0x1b29e3);}return _0xddec2b[_0x20e4('0x22')](_0x1b29e3)[_0x20e4('0x23')]();};}function respondWithResult(_0x55b72c,_0x34f0b5){_0x34f0b5=_0x34f0b5||0xc8;return function(_0x3179aa){if(_0x3179aa){return _0x55b72c['status'](_0x34f0b5)['json'](_0x3179aa);}};}function respondWithFilteredResult(_0x43dad0,_0x435512){return function(_0x5e43cd){if(_0x5e43cd){var _0x4713b8=typeof _0x435512[_0x20e4('0x24')]===_0x20e4('0x25')&&typeof _0x435512[_0x20e4('0x26')]==='undefined';var _0x4781f4=_0x5e43cd[_0x20e4('0x27')];var _0x4cc6d5=_0x4713b8?0x0:_0x435512[_0x20e4('0x24')];var _0x1f6606=_0x4713b8?_0x5e43cd[_0x20e4('0x27')]:_0x435512[_0x20e4('0x24')]+_0x435512[_0x20e4('0x26')];var _0x290a54;if(_0x1f6606>=_0x4781f4){_0x1f6606=_0x4781f4;_0x290a54=0xc8;}else{_0x290a54=0xce;}_0x43dad0[_0x20e4('0x22')](_0x290a54);return _0x43dad0['set']('Content-Range',_0x4cc6d5+'-'+_0x1f6606+'/'+_0x4781f4)[_0x20e4('0x28')](_0x5e43cd);}return null;};}function saveUpdates(_0x1cf996){return function(_0xf8adbf){if(_0xf8adbf){return _0xf8adbf[_0x20e4('0x29')](_0x1cf996)[_0x20e4('0x15')](function(_0x45276){return _0x45276;});}return null;};}function removeEntity(_0xb6535a){return function(_0x456821){if(_0x456821){return _0x456821['destroy']()[_0x20e4('0x15')](function(){_0xb6535a['status'](0xcc)[_0x20e4('0x23')]();});}};}function handleEntityNotFound(_0x59c991){return function(_0x24131f){if(!_0x24131f){_0x59c991['sendStatus'](0x194);}return _0x24131f;};}function handleError(_0x4abc43,_0x3dd2a6){_0x3dd2a6=_0x3dd2a6||0x1f4;return function(_0x347144){logger['error'](_0x347144['stack']);if(_0x347144[_0x20e4('0x2a')]){delete _0x347144[_0x20e4('0x2a')];}_0x4abc43[_0x20e4('0x22')](_0x3dd2a6)[_0x20e4('0x2b')](_0x347144);};}function getMustacheRender(_0x4b258b,_0x1b3080){return Mustache[_0x20e4('0x2c')](_0x4b258b,_[_0x20e4('0x2d')](_0x1b3080[_0x20e4('0x2e')],{'contact':_0x1b3080[_0x20e4('0x2f')],'message':_0x1b3080[_0x20e4('0x1d')],'agent':_0x1b3080[_0x20e4('0x30')],'interaction':_0x1b3080[_0x20e4('0x31')],'account':_0x1b3080[_0x20e4('0x32')]}))||'';}exports[_0x20e4('0x33')]=function(_0x3aeec5,_0x1f7726){var _0x4cd982={};var _0x5d1c11=_[_0x20e4('0x34')](db['ChatInteraction'][_0x20e4('0x35')],function(_0x1e7e0d){return{'name':_0x1e7e0d[_0x20e4('0x36')],'type':_0x1e7e0d[_0x20e4('0x37')][_0x20e4('0x38')]};});_0x4cd982=qs['getOptions'](_0x5d1c11,_0x3aeec5);return interaction[_0x20e4('0x39')]('chat',_0x3aeec5['query'],_0x3aeec5[_0x20e4('0x3a')],_0x4cd982,_0x5d1c11)[_0x20e4('0x15')](respondWithFilteredResult(_0x1f7726,_0x4cd982))['catch'](handleError(_0x1f7726,null));};exports[_0x20e4('0x3b')]=function(_0x572852,_0x4ee3a8){var _0x57d49c={'raw':![],'where':{'id':_0x572852[_0x20e4('0x3c')]['id']}},_0x35bfb4={};_0x35bfb4[_0x20e4('0x3d')]=_[_0x20e4('0x3e')](db[_0x20e4('0x3f')][_0x20e4('0x35')]);_0x35bfb4['query']=_[_0x20e4('0x3e')](_0x572852['query']);_0x35bfb4[_0x20e4('0x40')]=_[_0x20e4('0x41')](_0x35bfb4['model'],_0x35bfb4[_0x20e4('0x42')]);_0x57d49c[_0x20e4('0x43')]=_[_0x20e4('0x41')](_0x35bfb4[_0x20e4('0x3d')],qs[_0x20e4('0x44')](_0x572852[_0x20e4('0x42')][_0x20e4('0x44')]));_0x57d49c[_0x20e4('0x43')]=_0x57d49c[_0x20e4('0x43')][_0x20e4('0x45')]?_0x57d49c[_0x20e4('0x43')]:_0x35bfb4['model'];if(_0x572852['query'][_0x20e4('0x46')]){_0x57d49c[_0x20e4('0x47')]=[{'all':!![]}];}_0x57d49c=_[_0x20e4('0x2d')]({},_0x57d49c,_0x572852[_0x20e4('0x48')]);return db[_0x20e4('0x3f')][_0x20e4('0x49')](_0x57d49c)[_0x20e4('0x15')](handleEntityNotFound(_0x4ee3a8,null))[_0x20e4('0x15')](respondWithResult(_0x4ee3a8,null))[_0x20e4('0x20')](handleError(_0x4ee3a8,null));};exports[_0x20e4('0x4a')]=function(_0x580d5c,_0x44b281){return db[_0x20e4('0x3f')][_0x20e4('0x4a')](_0x580d5c[_0x20e4('0x2e')],{})[_0x20e4('0x15')](respondWithResult(_0x44b281,0xc9))[_0x20e4('0x20')](handleError(_0x44b281,null));};exports['update']=function(_0x412be1,_0x248394){if(_0x412be1['body']['id']){delete _0x412be1[_0x20e4('0x2e')]['id'];}return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0x412be1[_0x20e4('0x3c')]['id']}})['then'](handleEntityNotFound(_0x248394,null))['then'](saveUpdates(_0x412be1[_0x20e4('0x2e')],null))[_0x20e4('0x15')](respondWithResult(_0x248394,null))[_0x20e4('0x20')](handleError(_0x248394,null));};exports[_0x20e4('0x4b')]=function(_0x33bd67,_0x5bca1c){return db[_0x20e4('0x3f')][_0x20e4('0x49')]({'where':{'id':_0x33bd67[_0x20e4('0x3c')]['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x5bca1c,null))['then'](removeEntity(_0x5bca1c,null))[_0x20e4('0x20')](handleError(_0x5bca1c,null));};exports['describe']=function(_0x2eac7a,_0x413708){return db[_0x20e4('0x3f')][_0x20e4('0x4c')]()[_0x20e4('0x15')](respondWithResult(_0x413708,null))[_0x20e4('0x20')](handleError(_0x413708,null));};exports['createVidaooSession']=function(_0x39434c,_0x3c7ffb){var _0x419be2=_0x39434c['params']['id'];var _0x3d01a4;var _0x537bbb;var _0xb20207;return db[_0x20e4('0x3f')][_0x20e4('0x4d')]({'where':{'id':_0x419be2}})[_0x20e4('0x15')](function(_0x3864dd){_0x3d01a4=_0x3864dd;return db['ChatWebsite'][_0x20e4('0x4d')]({'where':{'id':_0x3864dd[_0x20e4('0x4e')]},'attributes':['id',_0x20e4('0x4f'),_0x20e4('0x50'),'vidaooTopic',_0x20e4('0x51'),_0x20e4('0x52')],'raw':!![]});})[_0x20e4('0x15')](function(_0x18fbbe){if(_0x18fbbe&&_0x18fbbe[_0x20e4('0x4f')]&&_0x18fbbe[_0x20e4('0x50')]){_0x537bbb=_0x18fbbe;var _0x13034c={'interaction':{'id':_0x419be2},'agent':{'id':_0x39434c[_0x20e4('0x3a')]['id'],'name':_0x39434c[_0x20e4('0x3a')][_0x20e4('0x2a')],'fullname':_0x39434c[_0x20e4('0x3a')][_0x20e4('0x53')],'email':_0x39434c[_0x20e4('0x3a')][_0x20e4('0x54')]},'contact':_0x39434c[_0x20e4('0x2e')]['contact'],'account':_0x39434c[_0x20e4('0x2e')][_0x20e4('0x32')]};var _0x404e69={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x18fbbe[_0x20e4('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x39434c[_0x20e4('0x3a')][_0x20e4('0x54')]],'buttons':null,'topic':_0x537bbb[_0x20e4('0x55')],'note':_['isNull'](_0x537bbb['vidaooNote'])?null:getMustacheRender(_0x537bbb['vidaooNote'],_0x13034c),'metadata':null},'redirect':_0x20e4('0x56'),'json':!![]};try{if(!_[_0x20e4('0x57')](_0x537bbb[_0x20e4('0x52')])){var _0x5029fc=getMustacheRender(_0x537bbb['vidaooMetadata'],_0x13034c);var _0x1e4332=JSON[_0x20e4('0x58')](_0x5029fc);_0x404e69['body']['metadata']=_0x1e4332;}}catch(_0x11a5a5){throw new db[(_0x20e4('0x59'))][(_0x20e4('0x5a'))](_0x20e4('0x5b'));}return rp(_0x404e69);}else{throw new db[(_0x20e4('0x59'))][(_0x20e4('0x5a'))](_0x20e4('0x5c'));}})[_0x20e4('0x15')](function(_0x5ba9e3){_0xb20207=_0x5ba9e3;if(_0xb20207['id']){var _0x477162={'body':_0xb20207[_0x20e4('0x5d')],'ChatWebsiteId':_0x537bbb['id'],'ChatInteractionId':_0x3d01a4['id'],'direction':_0x20e4('0x5e'),'UserId':_0x39434c[_0x20e4('0x3a')]['id']};return db[_0x20e4('0x5f')]['create'](_0x477162,{});}else{throw new db['Sequelize'][(_0x20e4('0x5a'))](_0x20e4('0x60'));}})['then'](function(){return _0x3d01a4[_0x20e4('0x61')]({'vidaooSessionId':_0xb20207['id']});})[_0x20e4('0x15')](respondWithResult(_0x3c7ffb,null))[_0x20e4('0x20')](handleError(_0x3c7ffb,null));};exports['customUpdate']=function(_0x5def37,_0x1856ce){if(_0x5def37[_0x20e4('0x2e')]['id']){delete _0x5def37[_0x20e4('0x2e')]['id'];}return db[_0x20e4('0x3f')][_0x20e4('0x49')]({'where':{'id':_0x5def37[_0x20e4('0x3c')]['id']},'include':[{'model':db['CmContact'],'as':_0x20e4('0x62')}]})[_0x20e4('0x15')](handleEntityNotFound(_0x1856ce,null))[_0x20e4('0x15')](saveUpdates(_0x5def37[_0x20e4('0x2e')],null))['then'](respondWithResult(_0x1856ce,null))[_0x20e4('0x20')](handleError(_0x1856ce,null));};exports['abandon']=function(_0x5090f7,_0x591705){if(_0x5090f7[_0x20e4('0x2e')]['id']){delete _0x5090f7[_0x20e4('0x2e')]['id'];}return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0x5090f7['params']['id']}})[_0x20e4('0x15')](function(_0x462005){if(!_0x462005){logger[_0x20e4('0x1b')](_0x20e4('0x63'),'abandon',0x194,_0x20e4('0x64'));_0x591705[_0x20e4('0x21')](0x194);}else{if(_0x462005[_0x20e4('0x65')]){throw new db[(_0x20e4('0x59'))][(_0x20e4('0x5a'))]('Interaction\x20already\x20assigned');}}return _0x462005;})[_0x20e4('0x15')](function(_0x4e62b6){if(_0x4e62b6){return _0x4e62b6[_0x20e4('0x29')]({'closed':_0x5090f7['body'][_0x20e4('0x66')],'disposition':_0x5090f7['body'][_0x20e4('0x67')]})[_0x20e4('0x15')](function(_0x3f25d9){return _0x3f25d9;});}})[_0x20e4('0x15')](function(){return respondWithRpcPromise(_0x20e4('0x68'),_0x20e4('0x69'),_0x5090f7[_0x20e4('0x2e')],client9004);})[_0x20e4('0x15')](respondWithResult(_0x591705,null))[_0x20e4('0x20')](handleError(_0x591705,null));};exports[_0x20e4('0x6a')]=function(_0x10b27b,_0x22e38c){_0x10b27b[_0x20e4('0x2e')][_0x20e4('0x2a')]=_0x10b27b[_0x20e4('0x6b')][_0x20e4('0x6c')];_0x10b27b['body'][_0x20e4('0x6d')]=_0x10b27b['file']['filename'];_0x10b27b['body'][_0x20e4('0x37')]=_0x10b27b[_0x20e4('0x6b')][_0x20e4('0x6e')];return db[_0x20e4('0x6f')][_0x20e4('0x4a')](_0x10b27b[_0x20e4('0x2e')])[_0x20e4('0x15')](respondWithResult(_0x22e38c,0xc9))[_0x20e4('0x20')](handleError(_0x22e38c,null));};exports[_0x20e4('0x70')]=function(_0x17d0c5,_0x2d7f94){return db[_0x20e4('0x3f')][_0x20e4('0x4d')]({'where':{'id':_0x17d0c5['params']['id']},'raw':!![]})[_0x20e4('0x15')](handleEntityNotFound(_0x2d7f94,null))[_0x20e4('0x15')](function(_0x1fc07c){if(_0x1fc07c){if(_0x1fc07c[_0x20e4('0x66')]){return _0x2d7f94[_0x20e4('0x22')](0x193)['json']({'status':0x193,'message':_0x20e4('0x71')});}return db[_0x20e4('0x6f')]['findOne']({'where':{'id':_0x17d0c5[_0x20e4('0x42')][_0x20e4('0x72')]},'raw':!![]})[_0x20e4('0x15')](handleEntityNotFound(_0x2d7f94,null));}})[_0x20e4('0x15')](function(_0x2ce824){if(_0x2ce824){var _0x30597d=_0x2ce824[_0x20e4('0x73')]!==null;var _0x4f3935=path[_0x20e4('0x74')](config[_0x20e4('0x75')],_0x20e4('0x76'));if(_0x30597d){_0x4f3935=path['join'](_0x4f3935,_0x20e4('0x77'));}var _0x5a239a=path[_0x20e4('0x74')](_0x4f3935,_0x2ce824['basename']);return _0x2d7f94[_0x20e4('0x78')](_0x5a239a);}})[_0x20e4('0x20')](handleError(_0x2d7f94,null));};exports['close']=function(_0x1186b2,_0x159c3e){var _0xef777e=null;var _0x43c1c6=null;var _0x4a711d=null;if(_0x1186b2[_0x20e4('0x2e')]['id']){delete _0x1186b2[_0x20e4('0x2e')]['id'];}if(_0x1186b2['body'][_0x20e4('0x79')]){_0x4a711d=path[_0x20e4('0x74')](config[_0x20e4('0x75')],_0x20e4('0x7a'),util[_0x20e4('0x7b')](_0x20e4('0x7c'),Date[_0x20e4('0x7d')]()));_0x1186b2[_0x20e4('0x2e')][_0x20e4('0x7e')]=_0x4a711d;}return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0x1186b2[_0x20e4('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x20e4('0x7f'),'include':[{'model':db[_0x20e4('0x80')],'as':_0x20e4('0x80')}]}]})[_0x20e4('0x15')](handleEntityNotFound(_0x159c3e,null))[_0x20e4('0x15')](saveUpdates(_0x1186b2[_0x20e4('0x2e')],null))[_0x20e4('0x15')](function(_0x293710){if(_0x293710){_0xef777e=_0x293710;return db['ChatWebsite'][_0x20e4('0x49')]({'where':{'id':_0xef777e['ChatWebsiteId']}});}})[_0x20e4('0x15')](function(_0x12ffcf){if(_0x12ffcf){_0x43c1c6=_0x12ffcf;return db[_0x20e4('0x81')][_0x20e4('0x49')]({'where':{'id':_0xef777e['ContactId']}});}})['then'](function(_0x3cffb1){if(_0x3cffb1){if(_0x4a711d){var _0x3dff75=null;for(var _0x303d15=0x1;_0x303d15<_0xef777e[_0x20e4('0x7f')]['length'];++_0x303d15){_0x3dff75=_0xef777e['Messages'][_0x303d15];var _0x4bd331=_0x3dff75[_0x20e4('0x65')]?util[_0x20e4('0x7b')]('%s%d',_0x43c1c6[_0x20e4('0x82')],_0x3dff75[_0x20e4('0x65')]):_0x20e4('0x83');var _0x5cf134=_0x1186b2[_0x20e4('0x2e')][_0x20e4('0x84')]||util[_0x20e4('0x7b')](_0x20e4('0x85'),_0x20e4('0x86'),_0x3dff75[_0x20e4('0x87')]);switch(_0x43c1c6['agentIdentifier']){case _0x20e4('0x88'):_0x4bd331=_0x3dff75[_0x20e4('0x65')]?util[_0x20e4('0x7b')](_0x20e4('0x85'),_0x43c1c6[_0x20e4('0x82')],_0x3dff75[_0x20e4('0x65')]):_0x20e4('0x83');break;case'agent_alias':_0x4bd331=_0x3dff75['UserId']?_0x3dff75[_0x20e4('0x80')][_0x20e4('0x89')]||_0x3dff75[_0x20e4('0x80')]['fullname']:_0x20e4('0x83');break;case _0x20e4('0x8a'):_0x4bd331=_0x3dff75['UserId']?_0x3dff75[_0x20e4('0x80')][_0x20e4('0x53')]:_0x20e4('0x83');break;default:_0x4bd331=_0x3dff75[_0x20e4('0x65')]?util[_0x20e4('0x7b')](_0x20e4('0x85'),_0x43c1c6['agentAlias'],_0x3dff75['UserId']):_0x20e4('0x83');}var _0x1abbaf=util[_0x20e4('0x7b')]('[%s]\x20%s:\x20%s\x0a',moment(_0x3dff75[_0x20e4('0x8b')])['format'](_0x20e4('0x8c')),_0x3dff75['direction']==='in'?_0x5cf134:_0x4bd331,_0x3dff75[_0x20e4('0x2e')]);if(!_0x3dff75[_0x20e4('0x8d')]){fs[_0x20e4('0x8e')](_0x4a711d,_0x1abbaf);}}return db['MailAccount'][_0x20e4('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x20e4('0x8f')],'as':_0x20e4('0x90'),'raw':!![],'include':[{'model':db[_0x20e4('0x91')],'as':_0x20e4('0x91'),'raw':!![]}]}]});}}})['then'](function(_0x12a861){if(!_0x12a861||!_0x12a861['Smtp']||!_0x1186b2[_0x20e4('0x2e')])return _0xef777e;var _0x147bda=_0x12a861[_0x20e4('0x92')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x147bda,'message':{'from':util[_0x20e4('0x7b')](_0x20e4('0x93'),_0x12a861[_0x20e4('0x2a')],_0x12a861[_0x20e4('0x54')]||_0x12a861[_0x20e4('0x90')]['user']),'to':_0x1186b2[_0x20e4('0x2e')][_0x20e4('0x79')],'subject':_0x20e4('0x94'),'text':util[_0x20e4('0x7b')](_0x20e4('0x95'),_0x1186b2[_0x20e4('0x2e')][_0x20e4('0x79')]),'attachments':[{'path':_0x4a711d}]}})['then'](function(){return _0xef777e;})[_0x20e4('0x20')](function(_0x3f6872){logger[_0x20e4('0x1b')](_0x3f6872);});})[_0x20e4('0x15')](respondWithStatusCode(_0x159c3e,0xc8))[_0x20e4('0x20')](handleError(_0x159c3e,null));};exports[_0x20e4('0x96')]=function(_0x3772a4,_0x6d2f3c){return db[_0x20e4('0x5f')][_0x20e4('0x49')]({'where':{'id':_0x3772a4['params']['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x6d2f3c,null))[_0x20e4('0x15')](function(_0x47e2de){if(_0x47e2de){return _0x47e2de[_0x20e4('0x96')](_0x3772a4['body'][_0x20e4('0x97')],_['omit'](_0x3772a4[_0x20e4('0x2e')],[_0x20e4('0x97'),'id'])||{});}})[_0x20e4('0x15')](respondWithResult(_0x6d2f3c,null))['catch'](handleError(_0x6d2f3c,null));};exports[_0x20e4('0x98')]=function(_0x28b358,_0x7f2445){var _0x153539={'raw':![],'where':{}};var _0x4a196c={};var _0x32d4f7={'count':0x0,'rows':[]};return db[_0x20e4('0x3f')][_0x20e4('0x4d')]({'where':{'id':_0x28b358[_0x20e4('0x3c')]['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x7f2445,null))[_0x20e4('0x15')](function(_0x5157cd){if(_0x5157cd){_0x4a196c[_0x20e4('0x3d')]=_['keys'](db[_0x20e4('0x5f')][_0x20e4('0x35')]);_0x4a196c[_0x20e4('0x42')]=_[_0x20e4('0x3e')](_0x28b358[_0x20e4('0x42')]);_0x4a196c[_0x20e4('0x40')]=_[_0x20e4('0x41')](_0x4a196c[_0x20e4('0x3d')],_0x4a196c[_0x20e4('0x42')]);_0x153539['attributes']=_[_0x20e4('0x41')](_0x4a196c[_0x20e4('0x3d')],qs[_0x20e4('0x44')](_0x28b358[_0x20e4('0x42')][_0x20e4('0x44')]));_0x153539[_0x20e4('0x43')]=_0x153539['attributes'][_0x20e4('0x45')]?_0x153539[_0x20e4('0x43')]:_0x4a196c['model'];if(!_0x28b358[_0x20e4('0x42')][_0x20e4('0x99')](_0x20e4('0x9a'))){_0x153539['limit']=qs['limit'](_0x28b358[_0x20e4('0x42')][_0x20e4('0x26')]);_0x153539[_0x20e4('0x24')]=qs[_0x20e4('0x24')](_0x28b358[_0x20e4('0x42')][_0x20e4('0x24')]);}_0x153539[_0x20e4('0x9b')]=qs['sort'](_0x28b358[_0x20e4('0x42')][_0x20e4('0x9c')]);_0x153539[_0x20e4('0x9d')]=qs[_0x20e4('0x40')](_[_0x20e4('0x9e')](_0x28b358[_0x20e4('0x42')],_0x4a196c['filters']));_0x153539['where'][_0x20e4('0x9f')]=_0x5157cd['id'];if(_0x28b358[_0x20e4('0x42')][_0x20e4('0xa0')]){_0x153539[_0x20e4('0x9d')]=_[_0x20e4('0x2d')](_0x153539['where'],{'$or':_[_0x20e4('0x34')](_0x153539[_0x20e4('0x43')],function(_0x268ffd){var _0x3e76b9={};_0x3e76b9[_0x268ffd]={'$like':'%'+_0x28b358['query']['filter']+'%'};return _0x3e76b9;})});}if(_0x28b358[_0x20e4('0x42')][_0x20e4('0xa1')]){var _0x368a28=_0x28b358[_0x20e4('0x42')][_0x20e4('0xa1')][_0x20e4('0xa2')](',');var _0x53520f={};_0x53520f[_0x368a28[0x0]]={'$gte':moment(_0x368a28[0x1])[_0x20e4('0x7b')](_0x20e4('0xa3'))};_0x153539[_0x20e4('0x9d')]=_[_0x20e4('0x2d')](_0x153539['where'],_0x53520f);}_0x153539=_[_0x20e4('0x2d')]({},_0x153539,_0x28b358[_0x20e4('0x48')]);return db[_0x20e4('0x5f')][_0x20e4('0x27')]({'where':_0x153539[_0x20e4('0x9d')]})[_0x20e4('0x15')](function(_0x5ee5ed){_0x32d4f7[_0x20e4('0x27')]=_0x5ee5ed;if(_0x28b358[_0x20e4('0x42')]['includeAll']){_0x153539['include']=[{'all':!![]}];}return db[_0x20e4('0x5f')]['findAll'](_0x153539);})[_0x20e4('0x15')](function(_0x4177be){_0x32d4f7['rows']=_0x4177be;return _0x32d4f7;});}})['then'](respondWithFilteredResult(_0x7f2445,_0x153539))['catch'](handleError(_0x7f2445,null));};exports[_0x20e4('0xa4')]=function(_0x28b305,_0x880704){var _0xfb5f24={'where':{}},_0x9f9772={},_0x38ad8d={'count':0x0,'rows':[]};return db[_0x20e4('0x3f')]['findOne']({'where':{'id':_0x28b305['params']['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x880704,null))[_0x20e4('0x15')](function(_0x1b1a0e){if(_0x1b1a0e){_0x9f9772[_0x20e4('0x3d')]=_['keys'](db[_0x20e4('0x5f')]['rawAttributes']);_0x9f9772[_0x20e4('0x42')]=_[_0x20e4('0x3e')](_0x28b305[_0x20e4('0x42')]);_0x9f9772[_0x20e4('0x40')]=_[_0x20e4('0x41')](_0x9f9772[_0x20e4('0x3d')],_0x9f9772['query']);_0xfb5f24[_0x20e4('0x43')]=_[_0x20e4('0x41')](_0x9f9772[_0x20e4('0x3d')],qs[_0x20e4('0x44')](_0x28b305[_0x20e4('0x42')][_0x20e4('0x44')]));_0xfb5f24[_0x20e4('0x43')]=_0xfb5f24[_0x20e4('0x43')][_0x20e4('0x45')]?_0xfb5f24['attributes']:_0x9f9772[_0x20e4('0x3d')];if(!_0x28b305['query'][_0x20e4('0x99')](_0x20e4('0x9a'))){_0xfb5f24['limit']=qs[_0x20e4('0x26')](_0x28b305[_0x20e4('0x42')]['limit']);_0xfb5f24['offset']=qs[_0x20e4('0x24')](_0x28b305[_0x20e4('0x42')]['offset']);}_0xfb5f24[_0x20e4('0x9b')]=qs[_0x20e4('0x9c')](_0x28b305[_0x20e4('0x42')][_0x20e4('0x9c')]);_0xfb5f24['where']=qs[_0x20e4('0x40')](_[_0x20e4('0x9e')](_0x28b305[_0x20e4('0x42')],_0x9f9772[_0x20e4('0x40')]));_0xfb5f24[_0x20e4('0x9d')][_0x20e4('0x9f')]=_0x1b1a0e['id'];if(_0x28b305[_0x20e4('0x42')]['filter']){_0xfb5f24[_0x20e4('0x9d')]=_[_0x20e4('0x2d')](_0xfb5f24[_0x20e4('0x9d')],{'$or':_[_0x20e4('0x34')](_0xfb5f24[_0x20e4('0x43')],function(_0x52f208){var _0x408b95={};_0x408b95[_0x52f208]={'$like':'%'+_0x28b305[_0x20e4('0x42')]['filter']+'%'};return _0x408b95;})});}_0xfb5f24['where'][_0x20e4('0x8d')]=![];if(_0x28b305[_0x20e4('0x42')]['id']){_0xfb5f24['where']['id']={'$gt':_0x28b305[_0x20e4('0x42')]['id']};}_0xfb5f24=_[_0x20e4('0x2d')]({},_0xfb5f24,_0x28b305[_0x20e4('0x48')]);return db[_0x20e4('0x5f')][_0x20e4('0x27')]({'where':_0xfb5f24['where']})[_0x20e4('0x15')](function(_0x21c583){_0x38ad8d['count']=_0x21c583;_0xfb5f24['include']=[];if(_0x28b305[_0x20e4('0x42')]['includeAgent']){_0xfb5f24[_0x20e4('0x47')][_0x20e4('0xa5')]({'model':db[_0x20e4('0x80')],'as':_0x20e4('0x80'),'attributes':['id','fullname',_0x20e4('0x89')]});}if(_0x28b305[_0x20e4('0x42')][_0x20e4('0x46')]){_0xfb5f24[_0x20e4('0x47')]=[{'all':!![]}];}return db[_0x20e4('0x5f')]['findAll'](_0xfb5f24);})[_0x20e4('0x15')](function(_0xfc88fc){_0x38ad8d[_0x20e4('0xa6')]=_0xfc88fc;return _0x38ad8d;});}})[_0x20e4('0x15')](respondWithFilteredResult(_0x880704,_0xfb5f24))[_0x20e4('0x20')](handleError(_0x880704,null));};exports[_0x20e4('0xa7')]=function(_0x23a920,_0x3ad567){return db[_0x20e4('0x3f')][_0x20e4('0x49')]({'where':{'id':_0x23a920[_0x20e4('0x3c')]['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x3ad567,null))['then'](function(_0x5cda52){if(_0x5cda52){return _0x5cda52['setTags'](_0x23a920[_0x20e4('0x2e')]['ids'],_[_0x20e4('0xa8')](_0x23a920[_0x20e4('0x2e')],[_0x20e4('0x97'),'id'])||{})[_0x20e4('0xa9')](function(){return db[_0x20e4('0xaa')][_0x20e4('0x39')]({'attributes':['id',_0x20e4('0x2a'),_0x20e4('0xab')],'where':{'id':_0x23a920[_0x20e4('0x2e')][_0x20e4('0x97')]}});})[_0x20e4('0x15')](function(_0x33e1eb){socket[_0x20e4('0xac')]('chatInteractionTags:save',{'id':Number(_0x23a920[_0x20e4('0x3c')]['id']),'tags':_0x33e1eb||[]});return{'id':Number(_0x23a920[_0x20e4('0x3c')]['id']),'tags':_0x33e1eb||[]};});}})[_0x20e4('0x15')](respondWithResult(_0x3ad567,null))[_0x20e4('0x20')](handleError(_0x3ad567,null));};exports[_0x20e4('0xad')]=function(_0xe9a5de,_0x38dcd7){return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0xe9a5de['params']['id']}})['then'](handleEntityNotFound(_0x38dcd7,null))[_0x20e4('0x15')](function(_0x33712b){if(_0x33712b){return _0x33712b[_0x20e4('0xad')](_0xe9a5de[_0x20e4('0x42')]['ids']);}})[_0x20e4('0x15')](respondWithStatusCode(_0x38dcd7,null))[_0x20e4('0x20')](handleError(_0x38dcd7,null));};exports[_0x20e4('0x78')]=function(_0x5985a7,_0x36b332){var _0xe45735=moment()['unix']()[_0x20e4('0xae')]();var _0x520ebf=path[_0x20e4('0x74')](config[_0x20e4('0x75')],'server',_0x20e4('0xaf'),'tmp');var _0x1baceb=path[_0x20e4('0x74')](config[_0x20e4('0x75')],_0x20e4('0xb0'),_0x20e4('0xaf'),'attachments');var _0xba5e76=path[_0x20e4('0x74')](_0x520ebf,_0xe45735);var _0x492287=util[_0x20e4('0x7b')](_0x20e4('0xb1'),_0x5985a7[_0x20e4('0x3c')]['id'],_0xe45735);var _0x413ec8=path[_0x20e4('0x74')](_0x520ebf,_0x492287);var _0xcddf31=[];_0xcddf31['push']({'model':db['User'],'as':_0x20e4('0x80'),'attributes':['id',_0x20e4('0x53')],'raw':!![]});_0xcddf31[_0x20e4('0xa5')]({'model':db['CmContact'],'as':_0x20e4('0x62'),'attributes':['id',_0x20e4('0xb2'),'lastName'],'raw':!![]});if(_0x5985a7['query'][_0x20e4('0xb3')]){_0xcddf31[_0x20e4('0xa5')]({'model':db[_0x20e4('0x6f')],'as':'Attachment','raw':!![]});}var _0x20b1fd=[{'model':db[_0x20e4('0x5f')],'as':_0x20e4('0x7f'),'attributes':['id',_0x20e4('0x2e'),_0x20e4('0x8b'),'direction',_0x20e4('0x8d'),'read'],'include':_0xcddf31}];_0x20b1fd[_0x20e4('0xa5')]({'model':db[_0x20e4('0xb4')],'as':_0x20e4('0xb5'),'attributes':['id',_0x20e4('0x2a')]});_0x20b1fd[_0x20e4('0xa5')]({'model':db[_0x20e4('0x80')],'as':_0x20e4('0xb6'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0x5985a7[_0x20e4('0x3c')]['id']},'include':_0x20b1fd})[_0x20e4('0x15')](handleEntityNotFound(_0x36b332,null))[_0x20e4('0x15')](function(_0x2ac219){if(_0x2ac219){var _0xc052e=_0x2ac219[_0x20e4('0xb7')]({'plain':!![]});fs[_0x20e4('0xb8')](_0xba5e76);var _0x40d6e8={'channel':_0x20e4('0xb9'),'account':_0xc052e['Account']['name'],'agent':_0xc052e[_0x20e4('0xb6')]?_0xc052e[_0x20e4('0xb6')][_0x20e4('0x53')]:'N.A.','createdAt':moment(_0xc052e[_0x20e4('0x8b')])[_0x20e4('0x7b')](_0x20e4('0xa3'))[_0x20e4('0xae')](),'closedAt':_0xc052e[_0x20e4('0x66')]?moment(_0xc052e['closedAt'])[_0x20e4('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0xc052e['disposition'],'chatInfo':{'browser':_0xc052e['browserName'],'os':_0xc052e[_0x20e4('0xba')],'referer':_0xc052e[_0x20e4('0xbb')],'customerIp':_0xc052e['customerIp'],'customerPort':_0xc052e[_0x20e4('0xbc')]?_0xc052e['customerPort']:'N.A.'},'messages':_(_0xc052e[_0x20e4('0x7f')])[_0x20e4('0xbd')]()['filter']({'secret':![]})[_0x20e4('0x34')](function(_0x55d9ff){if(_0x55d9ff[_0x20e4('0x6f')]){var _0x27b663=path['join'](_0x1baceb,_0x55d9ff[_0x20e4('0x6f')][_0x20e4('0x6d')]);if(fs[_0x20e4('0xbe')](_0x27b663)){fs[_0x20e4('0xbf')](_0x27b663)[_0x20e4('0xc0')](fs['createWriteStream'](path[_0x20e4('0x74')](_0xba5e76,_0x55d9ff[_0x20e4('0x6f')]['basename'])));}}return{'date':moment(_0x55d9ff[_0x20e4('0x8b')])[_0x20e4('0x7b')](_0x20e4('0xa3'))['toString'](),'sender':_0x55d9ff[_0x20e4('0xc1')]===_0x20e4('0x5e')?_0x55d9ff[_0x20e4('0x80')]?_0x55d9ff[_0x20e4('0x80')]['fullname']:_0x20e4('0x83'):_0x55d9ff['Contact']['firstName']+(_0x55d9ff[_0x20e4('0x62')][_0x20e4('0xc2')]?'\x20'+_0x55d9ff[_0x20e4('0x62')][_0x20e4('0xc2')]:''),'body':_0x55d9ff['Attachment']?_0x55d9ff[_0x20e4('0x6f')]['basename']:_0x55d9ff[_0x20e4('0x2e')],'direction':_0x55d9ff[_0x20e4('0xc1')]===_0x20e4('0x5e')?'A':'C','secret':_0x55d9ff['secret'],'read':_0x55d9ff[_0x20e4('0xc3')],'attachment':_0x55d9ff[_0x20e4('0x6f')]};})[_0x20e4('0xc4')]()};return ejs[_0x20e4('0xc5')](path[_0x20e4('0x74')](config['root'],_0x20e4('0xb0'),_0x20e4('0xc6'),_0x20e4('0xc7')),{'interaction':_0x40d6e8})['then'](function(_0x463bbb){var _0x1cc618=path[_0x20e4('0x74')](_0xba5e76,'transcript-'+_0xc052e['id']+'-'+_0xe45735+_0x20e4('0xc8'));var _0x26b1c3={'path':_0x1cc618,'channel':_0x20e4('0xb9'),'interactionId':_0xc052e['id']};return pdf[_0x20e4('0xc9')](_0x463bbb,_0x26b1c3);})[_0x20e4('0x15')](function(){return new Promise(function(_0x4fdc64,_0xe1d666){zipdir(_0xba5e76,{'saveTo':_0x413ec8},function(_0x28f7ec,_0x1a97cb){if(_0x28f7ec)return _0xe1d666(_0x28f7ec);return _0x4fdc64(_0x1a97cb);});})[_0x20e4('0x15')](function(){return new BPromise(function(_0x253233,_0x1886a5){rimraf(_0xba5e76,function(_0x7bb7dc){if(_0x7bb7dc)_0x1886a5(_0x7bb7dc);return _0x253233();});});})[_0x20e4('0x15')](function(){return _0x36b332[_0x20e4('0x78')](_0x413ec8,_0x492287,function(_0x55ffd8){if(_0x55ffd8){logger[_0x20e4('0x1b')](_0x20e4('0xca'),_0x55ffd8);}else{fs[_0x20e4('0xcb')](_0x413ec8);}});});});}else{return _0x36b332[_0x20e4('0x21')](0xc8);}})[_0x20e4('0x20')](handleError(_0x36b332,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 23a76dc..87bc9b0 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 _0x1634=['findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map'];(function(_0x3112d0,_0x55961c){var _0x2ea0e1=function(_0x16c64c){while(--_0x16c64c){_0x3112d0['push'](_0x3112d0['shift']());}};_0x2ea0e1(++_0x55961c);}(_0x1634,0x198));var _0x4163=function(_0x52a755,_0x237d81){_0x52a755=_0x52a755-0x0;var _0x280129=_0x1634[_0x52a755];return _0x280129;};'use strict';var EventEmitter=require(_0x4163('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x4163('0x1')];var ChatMessage=require(_0x4163('0x2'))['db'][_0x4163('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4163('0x4')](0x0);var events={'afterCreate':_0x4163('0x5'),'afterUpdate':_0x4163('0x6'),'afterDestroy':_0x4163('0x7')};function emitEvent(_0x5b5321){return function(_0x5b27db,_0x3dec77,_0x106c6e){_0x5b27db[_0x4163('0x8')]({'attributes':['id'],'raw':!![]})[_0x4163('0x9')](function(_0x1a7af2){_0x5b27db['setDataValue'](_0x4163('0xa'),_0x1a7af2[_0x4163('0xb')](function(_0x206953){return{'id':_0x206953['id']};}));return ChatMessage[_0x4163('0xc')]({'where':{'ChatInteractionId':_0x5b27db['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xba6389){_0x5b27db[_0x4163('0xd')](_0x4163('0xe'),_0xba6389[_0x4163('0xf')]);ChatInteractionEvents['emit'](_0x5b5321+':'+_0x5b27db['id'],_0x5b27db);ChatInteractionEvents[_0x4163('0x10')](_0x5b5321,_0x5b27db);_0x106c6e(null);})[_0x4163('0x11')](_0x106c6e(null));};}for(var e in events){if(events[_0x4163('0x12')](e)){var event=events[e];ChatInteraction[_0x4163('0x13')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x4514=['events','../../mysqldb','ChatInteraction','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x4514,0xfc));var _0x4451=function(_0x27900c,_0x2868fd){_0x27900c=_0x27900c-0x0;var _0x3ea8e0=_0x4514[_0x27900c];return _0x3ea8e0;};'use strict';var EventEmitter=require(_0x4451('0x0'));var ChatInteraction=require(_0x4451('0x1'))['db'][_0x4451('0x2')];var ChatMessage=require(_0x4451('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4451('0x3')](0x0);var events={'afterCreate':_0x4451('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3be86e){return function(_0x1c621f,_0x348baf,_0x13e94b){_0x1c621f[_0x4451('0x5')]({'attributes':['id'],'raw':!![]})[_0x4451('0x6')](function(_0x55d661){_0x1c621f[_0x4451('0x7')](_0x4451('0x8'),_0x55d661[_0x4451('0x9')](function(_0x2d83be){return{'id':_0x2d83be['id']};}));return ChatMessage[_0x4451('0xa')]({'where':{'ChatInteractionId':_0x1c621f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4451('0x6')](function(_0x484370){_0x1c621f[_0x4451('0x7')](_0x4451('0xb'),_0x484370[_0x4451('0xc')]);ChatInteractionEvents[_0x4451('0xd')](_0x3be86e+':'+_0x1c621f['id'],_0x1c621f);ChatInteractionEvents[_0x4451('0xd')](_0x3be86e,_0x1c621f);_0x13e94b(null);})[_0x4451('0xe')](_0x13e94b(null));};}for(var e in events){if(events[_0x4451('0xf')](e)){var event=events[e];ChatInteraction[_0x4451('0x10')](e,emitEvent(event));}}module[_0x4451('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 46b3f66..927a5eb 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 _0x9f07=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions'];(function(_0x15148b,_0x4dd6cf){var _0x3bdf7f=function(_0x4dcec8){while(--_0x4dcec8){_0x15148b['push'](_0x15148b['shift']());}};_0x3bdf7f(++_0x4dd6cf);}(_0x9f07,0x71));var _0x79f0=function(_0x29326c,_0x125d69){_0x29326c=_0x29326c-0x0;var _0x20aba9=_0x9f07[_0x29326c];return _0x20aba9;};'use strict';var _=require(_0x79f0('0x0'));var util=require(_0x79f0('0x1'));var logger=require(_0x79f0('0x2'))(_0x79f0('0x3'));var moment=require(_0x79f0('0x4'));var BPromise=require('bluebird');var rp=require(_0x79f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79f0('0x6'));var config=require(_0x79f0('0x7'));var attributes=require(_0x79f0('0x8'));module[_0x79f0('0x9')]=function(_0x76e394,_0x734381){return _0x76e394[_0x79f0('0xa')](_0x79f0('0xb'),attributes,{'tableName':_0x79f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a08fa,_0xd9b1cf,_0x17318f){if(_0x2a08fa[_0x79f0('0xd')](_0x79f0('0xe'))){_0x2a08fa['closedAt']=moment()[_0x79f0('0xf')](_0x79f0('0x10'));}_0x17318f(null,_0x2a08fa);}},'charset':'utf8mb4','collate':_0x79f0('0x11')});}; \ No newline at end of file +var _0xcd82=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0xcd82,0x11e));var _0x2cd8=function(_0x1ac5ed,_0x37c9ea){_0x1ac5ed=_0x1ac5ed-0x0;var _0x56cda8=_0xcd82[_0x1ac5ed];return _0x56cda8;};'use strict';var _=require(_0x2cd8('0x0'));var util=require(_0x2cd8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2cd8('0x2'));var rp=require(_0x2cd8('0x3'));var fs=require('fs');var path=require(_0x2cd8('0x4'));var rimraf=require(_0x2cd8('0x5'));var config=require('../../config/environment');var attributes=require(_0x2cd8('0x6'));module[_0x2cd8('0x7')]=function(_0x15bc39,_0x2932af){return _0x15bc39['define'](_0x2cd8('0x8'),attributes,{'tableName':_0x2cd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1241e2,_0x242932,_0x3406ba){if(_0x1241e2[_0x2cd8('0xa')](_0x2cd8('0xb'))){_0x1241e2['closedAt']=moment()[_0x2cd8('0xc')](_0x2cd8('0xd'));}_0x3406ba(null,_0x1241e2);}},'charset':'utf8mb4','collate':_0x2cd8('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 52e8290..47189e8 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 _0x3c32=['error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','info','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x28b057,_0x205efa){var _0x781d8d=function(_0x23aeb4){while(--_0x23aeb4){_0x28b057['push'](_0x28b057['shift']());}};_0x781d8d(++_0x205efa);}(_0x3c32,0x11d));var _0x23c3=function(_0x55028d,_0x3d7980){_0x55028d=_0x55028d-0x0;var _0x17fd1e=_0x3c32[_0x55028d];return _0x17fd1e;};'use strict';var _=require(_0x23c3('0x0'));var util=require('util');var moment=require(_0x23c3('0x1'));var BPromise=require(_0x23c3('0x2'));var rs=require(_0x23c3('0x3'));var fs=require('fs');var Redis=require(_0x23c3('0x4'));var db=require(_0x23c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23c3('0x6'))(_0x23c3('0x7'));var config=require(_0x23c3('0x8'));var jayson=require(_0x23c3('0x9'));var client=jayson[_0x23c3('0xa')][_0x23c3('0xb')]({'port':0x232a});config['redis']=_[_0x23c3('0xc')](config[_0x23c3('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23c3('0xd')]));require(_0x23c3('0xe'))['register'](socket);function respondWithRpcPromise(_0x212d6b,_0xe9304b,_0xd580b1){return new BPromise(function(_0x70e6d6,_0x553657){return client['request'](_0x212d6b,_0xd580b1)[_0x23c3('0xf')](function(_0x4ea131){logger['info'](_0x23c3('0x10'),_0xe9304b,_0x23c3('0x11'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xe9304b,_0x23c3('0x11'),JSON[_0x23c3('0x12')](_0x4ea131));if(_0x4ea131['error']){if(_0x4ea131[_0x23c3('0x13')][_0x23c3('0x14')]===0x1f4){logger[_0x23c3('0x13')](_0x23c3('0x10'),_0xe9304b,_0x4ea131[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x553657(_0x4ea131[_0x23c3('0x13')][_0x23c3('0x15')]);}logger[_0x23c3('0x13')]('ChatInteraction,\x20%s,\x20%s',_0xe9304b,_0x4ea131[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x70e6d6(_0x4ea131['error'][_0x23c3('0x15')]);}else{logger['info'](_0x23c3('0x10'),_0xe9304b,_0x23c3('0x11'));_0x70e6d6(_0x4ea131[_0x23c3('0x16')][_0x23c3('0x15')]);}})[_0x23c3('0x17')](function(_0x28ee27){logger['error'](_0x23c3('0x10'),_0xe9304b,_0x28ee27);_0x553657(_0x28ee27);});});}exports[_0x23c3('0x18')]=function(_0x2f17cf){var _0x55bf1e=this;return new Promise(function(_0x3d60e0,_0x5aa35e){return db[_0x23c3('0x19')][_0x23c3('0x1a')](_0x2f17cf['body'],{'raw':_0x2f17cf[_0x23c3('0x1b')]?_0x2f17cf[_0x23c3('0x1b')][_0x23c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f17cf[_0x23c3('0x1b')]?_0x2f17cf[_0x23c3('0x1b')][_0x23c3('0x1d')]||null:null,'attributes':_0x2f17cf[_0x23c3('0x1b')]?_0x2f17cf[_0x23c3('0x1b')][_0x23c3('0x1e')]||null:null,'limit':_0x2f17cf[_0x23c3('0x1b')]?_0x2f17cf[_0x23c3('0x1b')][_0x23c3('0x1f')]||null:null})['then'](function(_0x4e451b){logger[_0x23c3('0x20')](_0x23c3('0x18'),_0x2f17cf);logger['debug']('UpdateChatInteraction',_0x2f17cf,JSON[_0x23c3('0x12')](_0x4e451b));_0x3d60e0(_0x4e451b);})[_0x23c3('0x17')](function(_0x1465a5){logger[_0x23c3('0x13')](_0x23c3('0x18'),_0x1465a5[_0x23c3('0x15')],_0x2f17cf);_0x5aa35e(_0x55bf1e[_0x23c3('0x13')](0x1f4,_0x1465a5[_0x23c3('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x1f97a7){return new Promise(function(_0x45dee2,_0x3c4e86){return db['ChatInteraction']['find']({'where':_0x1f97a7['options']?_0x1f97a7['options'][_0x23c3('0x1d')]||null:null})['then'](function(_0x1a1ed0){if(_0x1a1ed0){return _0x1a1ed0['addTags'](_0x1f97a7[_0x23c3('0x21')][_0x23c3('0x22')],_[_0x23c3('0x23')](_0x1f97a7[_0x23c3('0x21')],['ids','id'])||{});}})[_0x23c3('0x24')](function(_0x5e5c0d){logger[_0x23c3('0x20')](_0x23c3('0x25'),_0x1f97a7);logger['debug'](_0x23c3('0x25'),_0x1f97a7,JSON[_0x23c3('0x12')](_0x5e5c0d));_0x45dee2(_0x5e5c0d);})[_0x23c3('0x17')](function(_0x368c0e){logger[_0x23c3('0x13')](_0x23c3('0x25'),_0x368c0e['message'],_0x1f97a7);_0x3c4e86(_this[_0x23c3('0x13')](0x1f4,_0x368c0e[_0x23c3('0x15')]));});});}; \ No newline at end of file +var _0x837b=['omit','ids','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','AddTagsToChatInteraction','find','where','addTags'];(function(_0x106517,_0x9ada4d){var _0x5a6280=function(_0x33805e){while(--_0x33805e){_0x106517['push'](_0x106517['shift']());}};_0x5a6280(++_0x9ada4d);}(_0x837b,0x14c));var _0xb837=function(_0x2c7f80,_0x2b0052){_0x2c7f80=_0x2c7f80-0x0;var _0x11fe38=_0x837b[_0x2c7f80];return _0x11fe38;};'use strict';var _=require(_0xb837('0x0'));var util=require('util');var moment=require(_0xb837('0x1'));var BPromise=require('bluebird');var rs=require(_0xb837('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb837('0x3'))['db'];var utils=require(_0xb837('0x4'));var logger=require(_0xb837('0x5'))(_0xb837('0x6'));var config=require('../../config/environment');var jayson=require(_0xb837('0x7'));var client=jayson[_0xb837('0x8')]['http']({'port':0x232a});config[_0xb837('0x9')]=_[_0xb837('0xa')](config['redis'],{'host':_0xb837('0xb'),'port':0x18eb});var socket=require(_0xb837('0xc'))(new Redis(config[_0xb837('0x9')]));require(_0xb837('0xd'))['register'](socket);function respondWithRpcPromise(_0x318b8a,_0x4c78a2,_0x161000){return new BPromise(function(_0x377511,_0x39575a){return client[_0xb837('0xe')](_0x318b8a,_0x161000)[_0xb837('0xf')](function(_0x3f0eaf){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4c78a2,_0xb837('0x10'));logger[_0xb837('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4c78a2,_0xb837('0x10'),JSON[_0xb837('0x12')](_0x3f0eaf));if(_0x3f0eaf[_0xb837('0x13')]){if(_0x3f0eaf[_0xb837('0x13')][_0xb837('0x14')]===0x1f4){logger[_0xb837('0x13')](_0xb837('0x15'),_0x4c78a2,_0x3f0eaf[_0xb837('0x13')][_0xb837('0x16')]);return _0x39575a(_0x3f0eaf[_0xb837('0x13')][_0xb837('0x16')]);}logger[_0xb837('0x13')](_0xb837('0x15'),_0x4c78a2,_0x3f0eaf['error'][_0xb837('0x16')]);return _0x377511(_0x3f0eaf[_0xb837('0x13')][_0xb837('0x16')]);}else{logger[_0xb837('0x17')](_0xb837('0x15'),_0x4c78a2,_0xb837('0x10'));_0x377511(_0x3f0eaf['result']['message']);}})[_0xb837('0x18')](function(_0x3f7107){logger['error'](_0xb837('0x15'),_0x4c78a2,_0x3f7107);_0x39575a(_0x3f7107);});});}exports[_0xb837('0x19')]=function(_0x2fcd94){var _0x458587=this;return new Promise(function(_0x40e6fc,_0x15ef9d){return db[_0xb837('0x1a')][_0xb837('0x1b')](_0x2fcd94[_0xb837('0x1c')],{'raw':_0x2fcd94[_0xb837('0x1d')]?_0x2fcd94[_0xb837('0x1d')][_0xb837('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fcd94[_0xb837('0x1d')]?_0x2fcd94[_0xb837('0x1d')]['where']||null:null,'attributes':_0x2fcd94[_0xb837('0x1d')]?_0x2fcd94[_0xb837('0x1d')][_0xb837('0x1f')]||null:null,'limit':_0x2fcd94['options']?_0x2fcd94[_0xb837('0x1d')][_0xb837('0x20')]||null:null})[_0xb837('0xf')](function(_0x2ed1cb){logger[_0xb837('0x17')](_0xb837('0x19'),_0x2fcd94);logger[_0xb837('0x11')]('UpdateChatInteraction',_0x2fcd94,JSON[_0xb837('0x12')](_0x2ed1cb));_0x40e6fc(_0x2ed1cb);})['catch'](function(_0x3413a9){logger[_0xb837('0x13')](_0xb837('0x19'),_0x3413a9['message'],_0x2fcd94);_0x15ef9d(_0x458587['error'](0x1f4,_0x3413a9[_0xb837('0x16')]));});});};exports[_0xb837('0x21')]=function(_0x1446d0){return new Promise(function(_0xcea74c,_0x12d1a1){return db['ChatInteraction'][_0xb837('0x22')]({'where':_0x1446d0[_0xb837('0x1d')]?_0x1446d0['options'][_0xb837('0x23')]||null:null})[_0xb837('0xf')](function(_0x582ab4){if(_0x582ab4){return _0x582ab4[_0xb837('0x24')](_0x1446d0['body']['ids'],_[_0xb837('0x25')](_0x1446d0['body'],[_0xb837('0x26'),'id'])||{});}})[_0xb837('0x27')](function(_0x45a6e9){logger[_0xb837('0x17')]('AddTags',_0x1446d0);logger['debug'](_0xb837('0x28'),_0x1446d0,JSON[_0xb837('0x12')](_0x45a6e9));_0xcea74c(_0x45a6e9);})[_0xb837('0x18')](function(_0x3a74a9){logger['error']('AddTags',_0x3a74a9['message'],_0x1446d0);_0x12d1a1(_this['error'](0x1f4,_0x3a74a9[_0xb837('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 25d4073..4be20a1 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 _0xd6e1=['emit','removeListener','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x4ce422,_0x100a18){var _0x4ae250=function(_0x309ac0){while(--_0x309ac0){_0x4ce422['push'](_0x4ce422['shift']());}};_0x4ae250(++_0x100a18);}(_0xd6e1,0x9c));var _0x1d6e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd6e1[_0x21a9d9];return _0x46adce;};'use strict';var ChatInteractionEvents=require(_0x1d6e('0x0'));var events=[_0x1d6e('0x1'),_0x1d6e('0x2'),_0x1d6e('0x3')];function createListener(_0x2fdb6d,_0x1b5666){return function(_0x360601){_0x1b5666[_0x1d6e('0x4')](_0x2fdb6d,_0x360601);};}function removeListener(_0x5b24d4,_0x5ad7cb){return function(){ChatInteractionEvents[_0x1d6e('0x5')](_0x5b24d4,_0x5ad7cb);};}exports['register']=function(_0x7e022f){for(var _0x44f06f=0x0,_0x2a3bba=events[_0x1d6e('0x6')];_0x44f06f<_0x2a3bba;_0x44f06f++){var _0x5a218c=events[_0x44f06f];var _0x2da0ae=createListener(_0x1d6e('0x7')+_0x5a218c,_0x7e022f);ChatInteractionEvents['on'](_0x5a218c,_0x2da0ae);}}; \ No newline at end of file +var _0x1b9c=['removeListener','length','chatInteraction:','./chatInteraction.events','save','update'];(function(_0x183214,_0x2b0629){var _0x701714=function(_0x24f5fc){while(--_0x24f5fc){_0x183214['push'](_0x183214['shift']());}};_0x701714(++_0x2b0629);}(_0x1b9c,0x1ad));var _0xc1b9=function(_0x473773,_0x55bf3c){_0x473773=_0x473773-0x0;var _0x14a95c=_0x1b9c[_0x473773];return _0x14a95c;};'use strict';var ChatInteractionEvents=require(_0xc1b9('0x0'));var events=[_0xc1b9('0x1'),'remove',_0xc1b9('0x2')];function createListener(_0xe4413e,_0x5551a4){return function(_0x8d93c4){_0x5551a4['emit'](_0xe4413e,_0x8d93c4);};}function removeListener(_0x90b4e4,_0x5593de){return function(){ChatInteractionEvents[_0xc1b9('0x3')](_0x90b4e4,_0x5593de);};}exports['register']=function(_0x21e501){for(var _0x56a1f5=0x0,_0x52ac80=events[_0xc1b9('0x4')];_0x56a1f5<_0x52ac80;_0x56a1f5++){var _0x1b9fe7=events[_0x56a1f5];var _0x584782=createListener(_0xc1b9('0x5')+_0x1b9fe7,_0x21e501);ChatInteractionEvents['on'](_0x1b9fe7,_0x584782);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ea8e41b..00163cc 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 _0x335e=['originalname','replace','single','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','/describe','isAuthenticated','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','format','%s-%s','now'];(function(_0xb4e052,_0x1d3cb6){var _0x5197e7=function(_0x9bc429){while(--_0x9bc429){_0xb4e052['push'](_0xb4e052['shift']());}};_0x5197e7(++_0x1d3cb6);}(_0x335e,0xaf));var _0xe335=function(_0x48d9cc,_0x5a0935){_0x48d9cc=_0x48d9cc-0x0;var _0x41078e=_0x335e[_0x48d9cc];return _0x41078e;};'use strict';var multer=require('multer');var util=require(_0xe335('0x0'));var path=require(_0xe335('0x1'));var timeout=require(_0xe335('0x2'));var express=require(_0xe335('0x3'));var router=express['Router']();var fs_extra=require(_0xe335('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe335('0x5'));var config=require(_0xe335('0x6'));var controller=require(_0xe335('0x7'));router[_0xe335('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe335('0x8')](_0xe335('0x9'),auth[_0xe335('0xa')](),controller['describe']);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0xe335('0xb')]);router[_0xe335('0x8')](_0xe335('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xe335('0xd')]);router[_0xe335('0x8')](_0xe335('0xe'),auth[_0xe335('0xa')](),controller[_0xe335('0xf')]);router[_0xe335('0x8')](_0xe335('0x10'),auth[_0xe335('0x11')](),controller[_0xe335('0x12')]);router[_0xe335('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xe335('0x13')]);router[_0xe335('0x14')]('/',auth[_0xe335('0xa')](),controller[_0xe335('0x15')]);router['post'](_0xe335('0x16'),auth['isAuthenticated'](),controller[_0xe335('0x17')]);var upload=multer({'storage':multer[_0xe335('0x18')]({'destination':function(_0x38c0c1,_0x5e9233,_0xee2c17){_0xee2c17(null,path['join'](config[_0xe335('0x19')],'server/files/attachments/'));},'filename':function(_0x398658,_0x566249,_0x130f03){_0x130f03(null,util[_0xe335('0x1a')](_0xe335('0x1b'),Date[_0xe335('0x1c')](),_0x566249[_0xe335('0x1d')][_0xe335('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe335('0x14')]('/:id/attachment_upload',upload[_0xe335('0x1f')]('file'),controller['attachmentUpload']);router['post'](_0xe335('0xe'),auth[_0xe335('0x11')](),controller['addMessage']);router['post'](_0xe335('0x20'),auth[_0xe335('0xa')](),interaction[_0xe335('0x21')](_0xe335('0x22'),_0xe335('0x23')),controller[_0xe335('0x24')]);router[_0xe335('0x25')](_0xe335('0x26'),auth[_0xe335('0xa')](),interaction[_0xe335('0x21')](_0xe335('0x22'),_0xe335('0x27')),controller[_0xe335('0x28')]);router['put'](_0xe335('0x29'),controller[_0xe335('0x2a')]);router[_0xe335('0x25')](_0xe335('0x2b'),auth[_0xe335('0x11')](),controller[_0xe335('0x2c')]);router[_0xe335('0x25')](_0xe335('0x2d'),controller[_0xe335('0x2e')]);router[_0xe335('0x2f')](_0xe335('0x26'),auth[_0xe335('0xa')](),interaction[_0xe335('0x21')]('chat','chatinteraction:destroy'),controller[_0xe335('0x30')]);router[_0xe335('0x2f')](_0xe335('0x20'),auth[_0xe335('0xa')](),controller[_0xe335('0x31')]);module[_0xe335('0x32')]=router; \ No newline at end of file +var _0x6dc2=['/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','chat','chatinteraction:addtags','addTags','tracked','chatinteraction:update','put','customUpdate','/:id/abandon','abandon','close','chatinteraction:destroy','destroy','delete','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages'];(function(_0xddfab6,_0x57f0f6){var _0x238867=function(_0x13e72e){while(--_0x13e72e){_0xddfab6['push'](_0xddfab6['shift']());}};_0x238867(++_0x57f0f6);}(_0x6dc2,0xc5));var _0x26dc=function(_0x26e9c6,_0x3b7098){_0x26e9c6=_0x26e9c6-0x0;var _0x461ebc=_0x6dc2[_0x26e9c6];return _0x461ebc;};'use strict';var multer=require(_0x26dc('0x0'));var util=require(_0x26dc('0x1'));var path=require(_0x26dc('0x2'));var timeout=require(_0x26dc('0x3'));var express=require(_0x26dc('0x4'));var router=express[_0x26dc('0x5')]();var fs_extra=require(_0x26dc('0x6'));var auth=require(_0x26dc('0x7'));var interaction=require(_0x26dc('0x8'));var config=require(_0x26dc('0x9'));var controller=require(_0x26dc('0xa'));router[_0x26dc('0xb')]('/',auth[_0x26dc('0xc')](),controller[_0x26dc('0xd')]);router[_0x26dc('0xb')](_0x26dc('0xe'),auth[_0x26dc('0xc')](),controller[_0x26dc('0xf')]);router[_0x26dc('0xb')](_0x26dc('0x10'),auth[_0x26dc('0x11')](),controller[_0x26dc('0x12')]);router[_0x26dc('0xb')](_0x26dc('0x13'),auth[_0x26dc('0x11')](),controller[_0x26dc('0x14')]);router[_0x26dc('0xb')](_0x26dc('0x15'),auth['isAuthenticated'](),controller[_0x26dc('0x16')]);router[_0x26dc('0xb')](_0x26dc('0x17'),auth[_0x26dc('0x11')](),controller[_0x26dc('0x18')]);router[_0x26dc('0xb')](_0x26dc('0x19'),auth[_0x26dc('0xc')](),controller[_0x26dc('0x1a')]);router[_0x26dc('0x1b')]('/',auth['isAuthenticated'](),controller[_0x26dc('0x1c')]);router[_0x26dc('0x1b')]('/:id/vidaoo',auth[_0x26dc('0xc')](),controller[_0x26dc('0x1d')]);var upload=multer({'storage':multer[_0x26dc('0x1e')]({'destination':function(_0x11bf94,_0x1b880c,_0xf92c3f){_0xf92c3f(null,path['join'](config[_0x26dc('0x1f')],_0x26dc('0x20')));},'filename':function(_0x5f243b,_0x4712b0,_0x21eba9){_0x21eba9(null,util[_0x26dc('0x21')]('%s-%s',Date['now'](),_0x4712b0[_0x26dc('0x22')][_0x26dc('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x26dc('0x1b')](_0x26dc('0x24'),upload[_0x26dc('0x25')]('file'),controller[_0x26dc('0x26')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x26dc('0x27')]);router[_0x26dc('0x1b')]('/:id/tags',auth[_0x26dc('0xc')](),interaction['tracked'](_0x26dc('0x28'),_0x26dc('0x29')),controller[_0x26dc('0x2a')]);router['put'](_0x26dc('0x10'),auth['isAuthenticated'](),interaction[_0x26dc('0x2b')](_0x26dc('0x28'),_0x26dc('0x2c')),controller['update']);router[_0x26dc('0x2d')]('/:id/custom_update',controller[_0x26dc('0x2e')]);router['put'](_0x26dc('0x2f'),auth[_0x26dc('0x11')](),controller[_0x26dc('0x30')]);router['put']('/:id/close',controller[_0x26dc('0x31')]);router['delete']('/:id',auth[_0x26dc('0xc')](),interaction[_0x26dc('0x2b')](_0x26dc('0x28'),_0x26dc('0x32')),controller[_0x26dc('0x33')]);router[_0x26dc('0x34')](_0x26dc('0x35'),auth[_0x26dc('0xc')](),controller['removeTags']);module[_0x26dc('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5cd9022..b9f1378 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 _0x25ee=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x1419fb,_0x5bd084){var _0x2b3c60=function(_0x2a749a){while(--_0x2a749a){_0x1419fb['push'](_0x1419fb['shift']());}};_0x2b3c60(++_0x5bd084);}(_0x25ee,0x1f2));var _0xe25e=function(_0x303e03,_0x48c0cf){_0x303e03=_0x303e03-0x0;var _0xc72223=_0x25ee[_0x303e03];return _0xc72223;};'use strict';var Sequelize=require(_0xe25e('0x0'));module[_0xe25e('0x1')]={'body':{'type':Sequelize[_0xe25e('0x2')](_0xe25e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe25e('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe25e('0x5')]}}; \ No newline at end of file +var _0x2435=['BOOLEAN','INTEGER','TEXT','medium'];(function(_0x14a63a,_0x5a0ad1){var _0x1cc157=function(_0x136390){while(--_0x136390){_0x14a63a['push'](_0x14a63a['shift']());}};_0x1cc157(++_0x5a0ad1);}(_0x2435,0x146));var _0x5243=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x2435[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x5243('0x0')](_0x5243('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5243('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5243('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e3fa093..ccc8872 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 _0x0196=['crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','status','end','offset','undefined','limit','count','set','json','apply','reject','then','sendStatus','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','keys','find','create','body','params','destroy','describe','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','read','-createdAt','all','rimraf','request-promise','mustache','util','path','ejs','lodash','squel'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x0196,0xc4));var _0x6019=function(_0x226da5,_0x393d1a){_0x226da5=_0x226da5-0x0;var _0x57ce5e=_0x0196[_0x226da5];return _0x57ce5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6019('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6019('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6019('0x2'));var util=require(_0x6019('0x3'));var path=require(_0x6019('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6019('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6019('0x6'));var squel=require(_0x6019('0x7'));var crypto=require(_0x6019('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6019('0x9'));var toCsv=require(_0x6019('0xa'));var querystring=require(_0x6019('0xb'));var Papa=require('papaparse');var Redis=require(_0x6019('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6019('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6019('0xe'));var logger=require('../../config/logger')(_0x6019('0xf'));var utils=require(_0x6019('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6019('0x11'))['db'];config[_0x6019('0x12')]=_[_0x6019('0x13')](config[_0x6019('0x12')],{'host':_0x6019('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6019('0x12')]));require('./chatInternalMessage.socket')[_0x6019('0x15')](socket);function respondWithStatusCode(_0xccf2c0,_0xba4a54){_0xba4a54=_0xba4a54||0xcc;return function(_0xe9e3a1){if(_0xe9e3a1){return _0xccf2c0['sendStatus'](_0xba4a54);}return _0xccf2c0[_0x6019('0x16')](_0xba4a54)[_0x6019('0x17')]();};}function respondWithResult(_0x58be2e,_0x3595de){_0x3595de=_0x3595de||0xc8;return function(_0x552129){if(_0x552129){return _0x58be2e[_0x6019('0x16')](_0x3595de)['json'](_0x552129);}};}function respondWithFilteredResult(_0x5d49f6,_0x20e0c8){return function(_0x5256bc){if(_0x5256bc){var _0x3e03fc=typeof _0x20e0c8[_0x6019('0x18')]===_0x6019('0x19')&&typeof _0x20e0c8[_0x6019('0x1a')]===_0x6019('0x19');var _0x136c0a=_0x5256bc['count'];var _0x39777c=_0x3e03fc?0x0:_0x20e0c8[_0x6019('0x18')];var _0x1ac0a4=_0x3e03fc?_0x5256bc[_0x6019('0x1b')]:_0x20e0c8[_0x6019('0x18')]+_0x20e0c8[_0x6019('0x1a')];var _0x352c73;if(_0x1ac0a4>=_0x136c0a){_0x1ac0a4=_0x136c0a;_0x352c73=0xc8;}else{_0x352c73=0xce;}_0x5d49f6[_0x6019('0x16')](_0x352c73);return _0x5d49f6[_0x6019('0x1c')]('Content-Range',_0x39777c+'-'+_0x1ac0a4+'/'+_0x136c0a)[_0x6019('0x1d')](_0x5256bc);}return null;};}function patchUpdates(_0x2e34c6){return function(_0x428230){try{jsonpatch[_0x6019('0x1e')](_0x428230,_0x2e34c6,!![]);}catch(_0xfd5b16){return BPromise[_0x6019('0x1f')](_0xfd5b16);}return _0x428230['save']();};}function saveUpdates(_0x2f305c,_0x4a6f36){return function(_0x2c26da){if(_0x2c26da){return _0x2c26da['update'](_0x2f305c)[_0x6019('0x20')](function(_0x4eedf6){return _0x4eedf6;});}return null;};}function removeEntity(_0x29bbf6,_0x7536e3){return function(_0x17b096){if(_0x17b096){return _0x17b096['destroy']()[_0x6019('0x20')](function(){_0x29bbf6['status'](0xcc)[_0x6019('0x17')]();});}};}function handleEntityNotFound(_0x348656,_0x53dc39){return function(_0x139db2){if(!_0x139db2){_0x348656[_0x6019('0x21')](0x194);}return _0x139db2;};}function handleError(_0x2f07bb,_0x4392ef){_0x4392ef=_0x4392ef||0x1f4;return function(_0x4a873b){logger[_0x6019('0x22')](_0x4a873b[_0x6019('0x23')]);if(_0x4a873b[_0x6019('0x24')]){delete _0x4a873b[_0x6019('0x24')];}_0x2f07bb[_0x6019('0x16')](_0x4392ef)[_0x6019('0x25')](_0x4a873b);};}exports['index']=function(_0x212551,_0x4e956b){var _0x4d8666={},_0x912959={},_0x20e833={'count':0x0,'rows':[]};var _0x34895d=_[_0x6019('0x26')](db[_0x6019('0x27')][_0x6019('0x28')],function(_0x33f219){return{'name':_0x33f219[_0x6019('0x29')],'type':_0x33f219[_0x6019('0x2a')][_0x6019('0x2b')]};});_0x912959[_0x6019('0x2c')]=_[_0x6019('0x26')](_0x34895d,_0x6019('0x24'));_0x912959[_0x6019('0x2d')]=_['keys'](_0x212551[_0x6019('0x2d')]);_0x912959[_0x6019('0x2e')]=_[_0x6019('0x2f')](_0x912959[_0x6019('0x2c')],_0x912959[_0x6019('0x2d')]);_0x4d8666['attributes']=_[_0x6019('0x2f')](_0x912959[_0x6019('0x2c')],qs[_0x6019('0x30')](_0x212551['query'][_0x6019('0x30')]));_0x4d8666[_0x6019('0x31')]=_0x4d8666[_0x6019('0x31')][_0x6019('0x32')]?_0x4d8666[_0x6019('0x31')]:_0x912959[_0x6019('0x2c')];if(!_0x212551[_0x6019('0x2d')][_0x6019('0x33')]('nolimit')){_0x4d8666[_0x6019('0x1a')]=qs['limit'](_0x212551[_0x6019('0x2d')][_0x6019('0x1a')]);_0x4d8666[_0x6019('0x18')]=qs[_0x6019('0x18')](_0x212551[_0x6019('0x2d')][_0x6019('0x18')]);}_0x4d8666['order']=qs[_0x6019('0x34')](_0x212551[_0x6019('0x2d')][_0x6019('0x34')]);_0x4d8666[_0x6019('0x35')]=qs[_0x6019('0x2e')](_[_0x6019('0x36')](_0x212551[_0x6019('0x2d')],_0x912959[_0x6019('0x2e')]),_0x34895d);if(_0x212551['query'][_0x6019('0x37')]){_0x4d8666[_0x6019('0x35')]=_['merge'](_0x4d8666[_0x6019('0x35')],{'$or':_[_0x6019('0x26')](_0x34895d,function(_0x149238){if(_0x149238[_0x6019('0x2a')]!=='VIRTUAL'){var _0xe4fbd6={};_0xe4fbd6[_0x149238['name']]={'$like':'%'+_0x212551['query']['filter']+'%'};return _0xe4fbd6;}})});}_0x4d8666=_[_0x6019('0x38')]({},_0x4d8666,_0x212551[_0x6019('0x39')]);var _0x36053e={'where':_0x4d8666['where']};return db[_0x6019('0x27')][_0x6019('0x1b')](_0x36053e)['then'](function(_0x330527){_0x20e833[_0x6019('0x1b')]=_0x330527;if(_0x212551[_0x6019('0x2d')][_0x6019('0x3a')]){_0x4d8666['include']=[{'all':!![]}];}return db[_0x6019('0x27')][_0x6019('0x3b')](_0x4d8666);})[_0x6019('0x20')](function(_0x5a4278){_0x20e833['rows']=_0x5a4278;return _0x20e833;})['then'](respondWithFilteredResult(_0x4e956b,_0x4d8666))[_0x6019('0x3c')](handleError(_0x4e956b,null));};exports[_0x6019('0x3d')]=function(_0x4db31c,_0x4e294e){var _0x2e4c86={'raw':!![],'where':{'id':_0x4db31c['params']['id']}},_0x239048={};_0x239048['model']=_[_0x6019('0x3e')](db['ChatInternalMessage'][_0x6019('0x28')]);_0x239048[_0x6019('0x2d')]=_['keys'](_0x4db31c[_0x6019('0x2d')]);_0x239048[_0x6019('0x2e')]=_[_0x6019('0x2f')](_0x239048['model'],_0x239048[_0x6019('0x2d')]);_0x2e4c86[_0x6019('0x31')]=_[_0x6019('0x2f')](_0x239048[_0x6019('0x2c')],qs[_0x6019('0x30')](_0x4db31c['query'][_0x6019('0x30')]));_0x2e4c86[_0x6019('0x31')]=_0x2e4c86[_0x6019('0x31')][_0x6019('0x32')]?_0x2e4c86['attributes']:_0x239048[_0x6019('0x2c')];if(_0x4db31c[_0x6019('0x2d')][_0x6019('0x3a')]){_0x2e4c86['include']=[{'all':!![]}];}_0x2e4c86=_[_0x6019('0x38')]({},_0x2e4c86,_0x4db31c[_0x6019('0x39')]);return db[_0x6019('0x27')][_0x6019('0x3f')](_0x2e4c86)[_0x6019('0x20')](handleEntityNotFound(_0x4e294e,null))[_0x6019('0x20')](respondWithResult(_0x4e294e,null))[_0x6019('0x3c')](handleError(_0x4e294e,null));};exports['create']=function(_0x4dac8c,_0x552b24){return db[_0x6019('0x27')][_0x6019('0x40')](_0x4dac8c['body'],{})[_0x6019('0x20')](respondWithResult(_0x552b24,0xc9))[_0x6019('0x3c')](handleError(_0x552b24,null));};exports['update']=function(_0x2aa943,_0x289ee1){if(_0x2aa943[_0x6019('0x41')]['id']){delete _0x2aa943[_0x6019('0x41')]['id'];}return db[_0x6019('0x27')][_0x6019('0x3f')]({'where':{'id':_0x2aa943[_0x6019('0x42')]['id']}})[_0x6019('0x20')](handleEntityNotFound(_0x289ee1,null))['then'](saveUpdates(_0x2aa943[_0x6019('0x41')],null))[_0x6019('0x20')](respondWithResult(_0x289ee1,null))['catch'](handleError(_0x289ee1,null));};exports[_0x6019('0x43')]=function(_0x1d024e,_0x2bd0ec){return db['ChatInternalMessage'][_0x6019('0x3f')]({'where':{'id':_0x1d024e[_0x6019('0x42')]['id']}})[_0x6019('0x20')](handleEntityNotFound(_0x2bd0ec,null))[_0x6019('0x20')](removeEntity(_0x2bd0ec,null))[_0x6019('0x3c')](handleError(_0x2bd0ec,null));};exports['describe']=function(_0x47950e,_0x23fa0a){return db['ChatInternalMessage'][_0x6019('0x44')]()['then'](respondWithResult(_0x23fa0a,null))[_0x6019('0x3c')](handleError(_0x23fa0a,null));};function wrapUser(_0x411cbd){return function(_0x19fa24){var _0x1983ff=_0x411cbd['get']({'plain':!![]});_0x1983ff[_0x6019('0x45')]=[];if(_0x19fa24){_0x1983ff['lastMessageAt']=_0x19fa24[_0x6019('0x46')];_0x1983ff['lastMessage']=_0x19fa24;}else{_0x1983ff[_0x6019('0x47')]=moment(0x0)[_0x6019('0x48')](_0x6019('0x49'));_0x1983ff[_0x6019('0x4a')]={};}return _0x1983ff;};}exports[_0x6019('0x4b')]=function(_0x580929,_0x5ee2ae,_0x5cbae0){var _0x437715=[];return db[_0x6019('0x4c')]['findAll']({'where':{'role':[_0x6019('0x4d'),_0x6019('0x4e'),_0x6019('0x4f')]},'attributes':['id',_0x6019('0x50'),_0x6019('0x24'),_0x6019('0x51'),_0x6019('0x52'),_0x6019('0x53'),_0x6019('0x54'),_0x6019('0x55'),_0x6019('0x56'),_0x6019('0x57')],'order':qs['sort'](_0x6019('0x58')),'include':[{'model':db['VoiceQueue'],'as':_0x6019('0x59'),'attributes':['id',_0x6019('0x24'),_0x6019('0x2a')],'through':{'attributes':[]}}]})[_0x6019('0x20')](function(_0x4eb425){if(_0x4eb425){var _0x36dc3f=_0x580929[_0x6019('0x4f')]['get']({'plain':!![]});if(!_0x36dc3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36dc3f[_0x6019('0x51')]===_0x6019('0x4f')){return db[_0x6019('0x5a')]['find']({'where':{'name':_0x6019('0x5b'),'userProfileId':_0x36dc3f[_0x6019('0x5c')]},'raw':!![]})[_0x6019('0x20')](function(_0x1de5f4){if(_0x1de5f4){if(_0x1de5f4[_0x6019('0x5d')]===0x0){return db[_0x6019('0x5e')]['findAll']({'where':{'sectionId':_0x1de5f4['id']},'raw':!![]})['then'](function(_0x1cfab8){var _0x4617f8=[];if(_[_0x6019('0x5f')](_0x1cfab8)){_0x4617f8=_[_0x6019('0x37')](_0x4eb425,function(_0x51180d){if(_0x51180d[_0x6019('0x51')]!=='agent'){return _0x51180d;}});return _0x4617f8;}else{for(var _0x62e373=0x0;_0x62e373<_0x4eb425[_0x6019('0x32')];_0x62e373++){var _0x16ddcb=_0x4eb425[_0x62e373];if(_0x16ddcb['role']===_0x6019('0x4d')){var _0xe7ed64=_[_0x6019('0x3f')](_0x1cfab8,function(_0x32531f){return _0x32531f['resourceId']===_0x16ddcb['id'];});if(_0xe7ed64)_0x4617f8[_0x6019('0x60')](_0x16ddcb);}else{_0x4617f8[_0x6019('0x60')](_0x16ddcb);}}return _0x4617f8;}});}else{return _0x4eb425;}}else{var _0x104896=_[_0x6019('0x37')](_0x4eb425,function(_0x211f36){if(_0x211f36[_0x6019('0x51')]!==_0x6019('0x4d')){return _0x211f36;}});return _0x104896;}});}else{return _0x4eb425;}}})['then'](function(_0x123c5a){var _0x11918f=[];if(_0x123c5a){_0x437715=_0x123c5a;for(var _0x34a851=0x0;_0x34a851<_0x123c5a[_0x6019('0x32')];_0x34a851+=0x1){_0x437715[_0x34a851][_0x6019('0x45')]=[];_0x11918f[_0x6019('0x60')](db[_0x6019('0x27')][_0x6019('0x3f')]({'where':{'FromId':[_0x580929['user']['id'],_0x123c5a[_0x34a851]['id']],'ToId':[_0x580929[_0x6019('0x4f')]['id'],_0x123c5a[_0x34a851]['id']],'ChatGroupId':null},'attributes':['id',_0x6019('0x46'),_0x6019('0x61'),_0x6019('0x62'),_0x6019('0x63'),'body'],'order':qs[_0x6019('0x34')](_0x6019('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6019('0x20')](wrapUser(_0x123c5a[_0x34a851])));}return BPromise[_0x6019('0x65')](_0x11918f);}return[];})[_0x6019('0x20')](function(_0x3cc741){return{'rows':_0x3cc741,'count':_0x3cc741[_0x6019('0x32')]};})['then'](respondWithResult(_0x5ee2ae,null))['catch'](handleError(_0x5ee2ae,null));}; \ No newline at end of file +var _0xf038=['get','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','agent','admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','push','user','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','ChatInternalMessage','rawAttributes','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe'];(function(_0x23b204,_0x4b773c){var _0x29ac3b=function(_0x26dedf){while(--_0x26dedf){_0x23b204['push'](_0x23b204['shift']());}};_0x29ac3b(++_0x4b773c);}(_0xf038,0x1ea));var _0x8f03=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0xf038[_0x12e3e3];return _0x26602e;};'use strict';var emlformat=require(_0x8f03('0x0'));var rimraf=require(_0x8f03('0x1'));var zipdir=require(_0x8f03('0x2'));var jsonpatch=require(_0x8f03('0x3'));var rp=require(_0x8f03('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8f03('0x5'));var util=require(_0x8f03('0x6'));var path=require(_0x8f03('0x7'));var sox=require(_0x8f03('0x8'));var csv=require(_0x8f03('0x9'));var ejs=require(_0x8f03('0xa'));var fs=require('fs');var fs_extra=require(_0x8f03('0xb'));var _=require(_0x8f03('0xc'));var squel=require(_0x8f03('0xd'));var crypto=require(_0x8f03('0xe'));var jsforce=require(_0x8f03('0xf'));var deskjs=require(_0x8f03('0x10'));var toCsv=require(_0x8f03('0x9'));var querystring=require(_0x8f03('0x11'));var Papa=require('papaparse');var Redis=require(_0x8f03('0x12'));var authService=require(_0x8f03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8f03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f03('0x15'))(_0x8f03('0x16'));var utils=require(_0x8f03('0x17'));var config=require(_0x8f03('0x18'));var licenseUtil=require(_0x8f03('0x19'));var db=require(_0x8f03('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x8f03('0x1b'),'port':0x18eb});var socket=require(_0x8f03('0x1c'))(new Redis(config[_0x8f03('0x1d')]));require(_0x8f03('0x1e'))['register'](socket);function respondWithStatusCode(_0x5bdbf2,_0x44f3cb){_0x44f3cb=_0x44f3cb||0xcc;return function(_0x58b779){if(_0x58b779){return _0x5bdbf2[_0x8f03('0x1f')](_0x44f3cb);}return _0x5bdbf2[_0x8f03('0x20')](_0x44f3cb)[_0x8f03('0x21')]();};}function respondWithResult(_0x512ca9,_0x295d6){_0x295d6=_0x295d6||0xc8;return function(_0x3d2c7f){if(_0x3d2c7f){return _0x512ca9[_0x8f03('0x20')](_0x295d6)['json'](_0x3d2c7f);}};}function respondWithFilteredResult(_0xca857d,_0x295a48){return function(_0x330af9){if(_0x330af9){var _0xd11178=typeof _0x295a48[_0x8f03('0x22')]==='undefined'&&typeof _0x295a48['limit']===_0x8f03('0x23');var _0x474fdb=_0x330af9[_0x8f03('0x24')];var _0x5e368c=_0xd11178?0x0:_0x295a48[_0x8f03('0x22')];var _0x2738d5=_0xd11178?_0x330af9[_0x8f03('0x24')]:_0x295a48[_0x8f03('0x22')]+_0x295a48[_0x8f03('0x25')];var _0x14c714;if(_0x2738d5>=_0x474fdb){_0x2738d5=_0x474fdb;_0x14c714=0xc8;}else{_0x14c714=0xce;}_0xca857d[_0x8f03('0x20')](_0x14c714);return _0xca857d['set'](_0x8f03('0x26'),_0x5e368c+'-'+_0x2738d5+'/'+_0x474fdb)[_0x8f03('0x27')](_0x330af9);}return null;};}function patchUpdates(_0x5402bb){return function(_0xfc4058){try{jsonpatch[_0x8f03('0x28')](_0xfc4058,_0x5402bb,!![]);}catch(_0x49632f){return BPromise[_0x8f03('0x29')](_0x49632f);}return _0xfc4058[_0x8f03('0x2a')]();};}function saveUpdates(_0x580f02,_0x5b8919){return function(_0x37f537){if(_0x37f537){return _0x37f537[_0x8f03('0x2b')](_0x580f02)['then'](function(_0x385ce1){return _0x385ce1;});}return null;};}function removeEntity(_0xe11c87,_0x44b20d){return function(_0x49d176){if(_0x49d176){return _0x49d176[_0x8f03('0x2c')]()[_0x8f03('0x2d')](function(){_0xe11c87[_0x8f03('0x20')](0xcc)[_0x8f03('0x21')]();});}};}function handleEntityNotFound(_0x1f8071,_0x15d017){return function(_0x4f8b08){if(!_0x4f8b08){_0x1f8071['sendStatus'](0x194);}return _0x4f8b08;};}function handleError(_0x3907f8,_0x55c641){_0x55c641=_0x55c641||0x1f4;return function(_0xdcaa50){logger['error'](_0xdcaa50[_0x8f03('0x2e')]);if(_0xdcaa50[_0x8f03('0x2f')]){delete _0xdcaa50[_0x8f03('0x2f')];}_0x3907f8[_0x8f03('0x20')](_0x55c641)[_0x8f03('0x30')](_0xdcaa50);};}exports[_0x8f03('0x31')]=function(_0x525ee5,_0x3357f2){var _0x56bf55={},_0x562cb9={},_0x546482={'count':0x0,'rows':[]};var _0x49ec7f=_[_0x8f03('0x32')](db[_0x8f03('0x33')][_0x8f03('0x34')],function(_0x3ce409){return{'name':_0x3ce409['fieldName'],'type':_0x3ce409['type']['key']};});_0x562cb9[_0x8f03('0x35')]=_[_0x8f03('0x32')](_0x49ec7f,_0x8f03('0x2f'));_0x562cb9['query']=_['keys'](_0x525ee5[_0x8f03('0x36')]);_0x562cb9[_0x8f03('0x37')]=_['intersection'](_0x562cb9[_0x8f03('0x35')],_0x562cb9[_0x8f03('0x36')]);_0x56bf55[_0x8f03('0x38')]=_[_0x8f03('0x39')](_0x562cb9[_0x8f03('0x35')],qs[_0x8f03('0x3a')](_0x525ee5[_0x8f03('0x36')][_0x8f03('0x3a')]));_0x56bf55['attributes']=_0x56bf55[_0x8f03('0x38')]['length']?_0x56bf55[_0x8f03('0x38')]:_0x562cb9[_0x8f03('0x35')];if(!_0x525ee5[_0x8f03('0x36')][_0x8f03('0x3b')](_0x8f03('0x3c'))){_0x56bf55['limit']=qs[_0x8f03('0x25')](_0x525ee5[_0x8f03('0x36')]['limit']);_0x56bf55[_0x8f03('0x22')]=qs[_0x8f03('0x22')](_0x525ee5[_0x8f03('0x36')]['offset']);}_0x56bf55[_0x8f03('0x3d')]=qs['sort'](_0x525ee5[_0x8f03('0x36')][_0x8f03('0x3e')]);_0x56bf55[_0x8f03('0x3f')]=qs['filters'](_[_0x8f03('0x40')](_0x525ee5[_0x8f03('0x36')],_0x562cb9[_0x8f03('0x37')]),_0x49ec7f);if(_0x525ee5[_0x8f03('0x36')][_0x8f03('0x41')]){_0x56bf55['where']=_[_0x8f03('0x42')](_0x56bf55['where'],{'$or':_[_0x8f03('0x32')](_0x49ec7f,function(_0x395873){if(_0x395873['type']!=='VIRTUAL'){var _0x14ad0f={};_0x14ad0f[_0x395873[_0x8f03('0x2f')]]={'$like':'%'+_0x525ee5[_0x8f03('0x36')][_0x8f03('0x41')]+'%'};return _0x14ad0f;}})});}_0x56bf55=_[_0x8f03('0x42')]({},_0x56bf55,_0x525ee5['options']);var _0x4825cf={'where':_0x56bf55[_0x8f03('0x3f')]};return db[_0x8f03('0x33')][_0x8f03('0x24')](_0x4825cf)['then'](function(_0x268498){_0x546482[_0x8f03('0x24')]=_0x268498;if(_0x525ee5[_0x8f03('0x36')][_0x8f03('0x43')]){_0x56bf55[_0x8f03('0x44')]=[{'all':!![]}];}return db[_0x8f03('0x33')][_0x8f03('0x45')](_0x56bf55);})['then'](function(_0x2a44ea){_0x546482[_0x8f03('0x46')]=_0x2a44ea;return _0x546482;})[_0x8f03('0x2d')](respondWithFilteredResult(_0x3357f2,_0x56bf55))[_0x8f03('0x47')](handleError(_0x3357f2,null));};exports[_0x8f03('0x48')]=function(_0xcdef67,_0x5eb5cb){var _0x3fb31e={'raw':!![],'where':{'id':_0xcdef67[_0x8f03('0x49')]['id']}},_0x75adeb={};_0x75adeb[_0x8f03('0x35')]=_[_0x8f03('0x4a')](db[_0x8f03('0x33')][_0x8f03('0x34')]);_0x75adeb[_0x8f03('0x36')]=_[_0x8f03('0x4a')](_0xcdef67['query']);_0x75adeb['filters']=_['intersection'](_0x75adeb[_0x8f03('0x35')],_0x75adeb['query']);_0x3fb31e['attributes']=_['intersection'](_0x75adeb[_0x8f03('0x35')],qs[_0x8f03('0x3a')](_0xcdef67[_0x8f03('0x36')][_0x8f03('0x3a')]));_0x3fb31e[_0x8f03('0x38')]=_0x3fb31e[_0x8f03('0x38')]['length']?_0x3fb31e[_0x8f03('0x38')]:_0x75adeb[_0x8f03('0x35')];if(_0xcdef67[_0x8f03('0x36')][_0x8f03('0x43')]){_0x3fb31e[_0x8f03('0x44')]=[{'all':!![]}];}_0x3fb31e=_['merge']({},_0x3fb31e,_0xcdef67[_0x8f03('0x4b')]);return db[_0x8f03('0x33')]['find'](_0x3fb31e)[_0x8f03('0x2d')](handleEntityNotFound(_0x5eb5cb,null))['then'](respondWithResult(_0x5eb5cb,null))[_0x8f03('0x47')](handleError(_0x5eb5cb,null));};exports[_0x8f03('0x4c')]=function(_0x1f58e0,_0x4cc274){return db['ChatInternalMessage']['create'](_0x1f58e0[_0x8f03('0x4d')],{})[_0x8f03('0x2d')](respondWithResult(_0x4cc274,0xc9))[_0x8f03('0x47')](handleError(_0x4cc274,null));};exports[_0x8f03('0x2b')]=function(_0x368dde,_0x5aa2e0){if(_0x368dde[_0x8f03('0x4d')]['id']){delete _0x368dde[_0x8f03('0x4d')]['id'];}return db[_0x8f03('0x33')][_0x8f03('0x4e')]({'where':{'id':_0x368dde['params']['id']}})['then'](handleEntityNotFound(_0x5aa2e0,null))[_0x8f03('0x2d')](saveUpdates(_0x368dde[_0x8f03('0x4d')],null))['then'](respondWithResult(_0x5aa2e0,null))[_0x8f03('0x47')](handleError(_0x5aa2e0,null));};exports[_0x8f03('0x2c')]=function(_0x2bad2c,_0x3a9d72){return db[_0x8f03('0x33')][_0x8f03('0x4e')]({'where':{'id':_0x2bad2c['params']['id']}})[_0x8f03('0x2d')](handleEntityNotFound(_0x3a9d72,null))[_0x8f03('0x2d')](removeEntity(_0x3a9d72,null))[_0x8f03('0x47')](handleError(_0x3a9d72,null));};exports[_0x8f03('0x4f')]=function(_0x254ef0,_0x1473a5){return db['ChatInternalMessage'][_0x8f03('0x4f')]()[_0x8f03('0x2d')](respondWithResult(_0x1473a5,null))[_0x8f03('0x47')](handleError(_0x1473a5,null));};function wrapUser(_0x2c3d18){return function(_0xe298a5){var _0xe75147=_0x2c3d18[_0x8f03('0x50')]({'plain':!![]});_0xe75147[_0x8f03('0x51')]=[];if(_0xe298a5){_0xe75147[_0x8f03('0x52')]=_0xe298a5[_0x8f03('0x53')];_0xe75147['lastMessage']=_0xe298a5;}else{_0xe75147[_0x8f03('0x52')]=moment(0x0)[_0x8f03('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0xe75147[_0x8f03('0x55')]={};}return _0xe75147;};}exports[_0x8f03('0x56')]=function(_0x2fb0ea,_0x2b61ea,_0x40a581){var _0x17a829=[];return db[_0x8f03('0x57')]['findAll']({'where':{'role':[_0x8f03('0x58'),_0x8f03('0x59'),'user']},'attributes':['id',_0x8f03('0x5a'),'name','role',_0x8f03('0x5b'),_0x8f03('0x5c'),_0x8f03('0x5d'),_0x8f03('0x5e'),_0x8f03('0x5f'),_0x8f03('0x60')],'order':qs[_0x8f03('0x3e')](_0x8f03('0x61')),'include':[{'model':db['VoiceQueue'],'as':_0x8f03('0x62'),'attributes':['id',_0x8f03('0x2f'),_0x8f03('0x63')],'through':{'attributes':[]}}]})[_0x8f03('0x2d')](function(_0xaac356){if(_0xaac356){var _0x11d991=_0x2fb0ea['user'][_0x8f03('0x50')]({'plain':!![]});if(!_0x11d991)throw new Error(_0x8f03('0x64'));if(_0x11d991[_0x8f03('0x65')]==='user'){return db[_0x8f03('0x66')][_0x8f03('0x4e')]({'where':{'name':'Agents','userProfileId':_0x11d991[_0x8f03('0x67')]},'raw':!![]})[_0x8f03('0x2d')](function(_0x5b68f7){if(_0x5b68f7){if(_0x5b68f7[_0x8f03('0x68')]===0x0){return db[_0x8f03('0x69')][_0x8f03('0x45')]({'where':{'sectionId':_0x5b68f7['id']},'raw':!![]})['then'](function(_0x2afc0f){var _0x43b0fa=[];if(_[_0x8f03('0x6a')](_0x2afc0f)){_0x43b0fa=_[_0x8f03('0x41')](_0xaac356,function(_0x54bbbe){if(_0x54bbbe['role']!==_0x8f03('0x58')){return _0x54bbbe;}});return _0x43b0fa;}else{for(var _0x42fb2=0x0;_0x42fb2<_0xaac356[_0x8f03('0x6b')];_0x42fb2++){var _0xdfb7c6=_0xaac356[_0x42fb2];if(_0xdfb7c6[_0x8f03('0x65')]===_0x8f03('0x58')){var _0x2e4dc7=_[_0x8f03('0x4e')](_0x2afc0f,function(_0x14fc38){return _0x14fc38['resourceId']===_0xdfb7c6['id'];});if(_0x2e4dc7)_0x43b0fa[_0x8f03('0x6c')](_0xdfb7c6);}else{_0x43b0fa[_0x8f03('0x6c')](_0xdfb7c6);}}return _0x43b0fa;}});}else{return _0xaac356;}}else{var _0x202322=_[_0x8f03('0x41')](_0xaac356,function(_0x4a9833){if(_0x4a9833['role']!==_0x8f03('0x58')){return _0x4a9833;}});return _0x202322;}});}else{return _0xaac356;}}})[_0x8f03('0x2d')](function(_0x4e4947){var _0x20845e=[];if(_0x4e4947){_0x17a829=_0x4e4947;for(var _0x38d747=0x0;_0x38d747<_0x4e4947['length'];_0x38d747+=0x1){_0x17a829[_0x38d747][_0x8f03('0x51')]=[];_0x20845e[_0x8f03('0x6c')](db[_0x8f03('0x33')]['find']({'where':{'FromId':[_0x2fb0ea[_0x8f03('0x6d')]['id'],_0x4e4947[_0x38d747]['id']],'ToId':[_0x2fb0ea[_0x8f03('0x6d')]['id'],_0x4e4947[_0x38d747]['id']],'ChatGroupId':null},'attributes':['id',_0x8f03('0x53'),_0x8f03('0x6e'),_0x8f03('0x6f'),'read','body'],'order':qs[_0x8f03('0x3e')](_0x8f03('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8f03('0x2d')](wrapUser(_0x4e4947[_0x38d747])));}return BPromise[_0x8f03('0x71')](_0x20845e);}return[];})[_0x8f03('0x2d')](function(_0xc87025){return{'rows':_0xc87025,'count':_0xc87025[_0x8f03('0x6b')]};})[_0x8f03('0x2d')](respondWithResult(_0x2b61ea,null))[_0x8f03('0x47')](handleError(_0x2b61ea,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 79cf113..4e29dd7 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 _0x840a=['../../mysqldb','ChatInternalMessage','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x46a60f,_0x1bec56){var _0x216028=function(_0x336f76){while(--_0x336f76){_0x46a60f['push'](_0x46a60f['shift']());}};_0x216028(++_0x1bec56);}(_0x840a,0x77));var _0xa840=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x840a[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xa840('0x0'));var ChatInternalMessage=require(_0xa840('0x1'))['db'][_0xa840('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa840('0x3'),'afterUpdate':'update','afterDestroy':_0xa840('0x4')};function emitEvent(_0x3561b6){return function(_0x4ed806,_0x702a4b,_0x27cba5){ChatInternalMessageEvents[_0xa840('0x5')](_0x3561b6+':'+_0x4ed806['id'],_0x4ed806);ChatInternalMessageEvents[_0xa840('0x5')](_0x3561b6,_0x4ed806);_0x27cba5(null);};}for(var e in events){if(events[_0xa840('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xa840('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x943a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x943a,0x84));var _0xa943=function(_0x4baac8,_0x5f1dc7){_0x4baac8=_0x4baac8-0x0;var _0x56ebc5=_0x943a[_0x4baac8];return _0x56ebc5;};'use strict';var EventEmitter=require(_0xa943('0x0'));var ChatInternalMessage=require(_0xa943('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa943('0x2'),'afterUpdate':_0xa943('0x3'),'afterDestroy':_0xa943('0x4')};function emitEvent(_0x47a2cb){return function(_0x56f1fd,_0x186955,_0x2bbb60){ChatInternalMessageEvents[_0xa943('0x5')](_0x47a2cb+':'+_0x56f1fd['id'],_0x56f1fd);ChatInternalMessageEvents[_0xa943('0x5')](_0x47a2cb,_0x56f1fd);_0x2bbb60(null);};}for(var e in events){if(events[_0xa943('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xa943('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 37523a3..0b48223 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 _0x9b65=['rimraf','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path'];(function(_0x5bcafb,_0x37dc03){var _0xa29d82=function(_0x24477a){while(--_0x24477a){_0x5bcafb['push'](_0x5bcafb['shift']());}};_0xa29d82(++_0x37dc03);}(_0x9b65,0x19a));var _0x59b6=function(_0x1dfd46,_0x52efef){_0x1dfd46=_0x1dfd46-0x0;var _0x1702da=_0x9b65[_0x1dfd46];return _0x1702da;};'use strict';var _=require('lodash');var util=require(_0x59b6('0x0'));var logger=require('../../config/logger')(_0x59b6('0x1'));var moment=require(_0x59b6('0x2'));var BPromise=require(_0x59b6('0x3'));var rp=require(_0x59b6('0x4'));var fs=require('fs');var path=require(_0x59b6('0x5'));var rimraf=require(_0x59b6('0x6'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x59b6('0x7')]=function(_0x22c82c,_0x45ea56){return _0x22c82c[_0x59b6('0x8')](_0x59b6('0x9'),attributes,{'tableName':_0x59b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59b6('0xb'),'collate':_0x59b6('0xc')});}; \ No newline at end of file +var _0x4f54=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1301df,_0x58d8ff){var _0x26c233=function(_0x42c800){while(--_0x42c800){_0x1301df['push'](_0x1301df['shift']());}};_0x26c233(++_0x58d8ff);}(_0x4f54,0x1c6));var _0x44f5=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4f54[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x44f5('0x0'));var util=require('util');var logger=require(_0x44f5('0x1'))(_0x44f5('0x2'));var moment=require(_0x44f5('0x3'));var BPromise=require(_0x44f5('0x4'));var rp=require(_0x44f5('0x5'));var fs=require('fs');var path=require(_0x44f5('0x6'));var rimraf=require(_0x44f5('0x7'));var config=require('../../config/environment');var attributes=require(_0x44f5('0x8'));module['exports']=function(_0xee464d,_0x191305){return _0xee464d['define'](_0x44f5('0x9'),attributes,{'tableName':_0x44f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44f5('0xb'),'collate':_0x44f5('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e0a9b9c..f5ad55c 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 _0xed95=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x1b3b4a,_0x27562f){var _0x5c82e7=function(_0x2fa764){while(--_0x2fa764){_0x1b3b4a['push'](_0x1b3b4a['shift']());}};_0x5c82e7(++_0x27562f);}(_0xed95,0x1d0));var _0x5ed9=function(_0x9222a6,_0x4b32e7){_0x9222a6=_0x9222a6-0x0;var _0x1233f1=_0xed95[_0x9222a6];return _0x1233f1;};'use strict';var _=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var moment=require(_0x5ed9('0x2'));var BPromise=require(_0x5ed9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ed9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ed9('0x5'));var logger=require('../../config/logger')(_0x5ed9('0x6'));var config=require(_0x5ed9('0x7'));var jayson=require(_0x5ed9('0x8'));var client=jayson['client'][_0x5ed9('0x9')]({'port':0x232a});config[_0x5ed9('0xa')]=_['defaults'](config[_0x5ed9('0xa')],{'host':_0x5ed9('0xb'),'port':0x18eb});var socket=require(_0x5ed9('0xc'))(new Redis(config[_0x5ed9('0xa')]));require(_0x5ed9('0xd'))[_0x5ed9('0xe')](socket);function respondWithRpcPromise(_0x53907c,_0x2f858a,_0xfe757d){return new BPromise(function(_0x49473c,_0x269522){return client[_0x5ed9('0xf')](_0x53907c,_0xfe757d)[_0x5ed9('0x10')](function(_0x4a929a){logger['info'](_0x5ed9('0x11'),_0x2f858a,_0x5ed9('0x12'));logger['debug'](_0x5ed9('0x13'),_0x2f858a,'request\x20sent',JSON['stringify'](_0x4a929a));if(_0x4a929a['error']){if(_0x4a929a[_0x5ed9('0x14')][_0x5ed9('0x15')]===0x1f4){logger[_0x5ed9('0x14')](_0x5ed9('0x11'),_0x2f858a,_0x4a929a[_0x5ed9('0x14')]['message']);return _0x269522(_0x4a929a[_0x5ed9('0x14')][_0x5ed9('0x16')]);}logger['error'](_0x5ed9('0x11'),_0x2f858a,_0x4a929a[_0x5ed9('0x14')][_0x5ed9('0x16')]);return _0x49473c(_0x4a929a[_0x5ed9('0x14')][_0x5ed9('0x16')]);}else{logger[_0x5ed9('0x17')](_0x5ed9('0x11'),_0x2f858a,'request\x20sent');_0x49473c(_0x4a929a[_0x5ed9('0x18')][_0x5ed9('0x16')]);}})[_0x5ed9('0x19')](function(_0x46a55b){logger[_0x5ed9('0x14')](_0x5ed9('0x11'),_0x2f858a,_0x46a55b);_0x269522(_0x46a55b);});});} \ No newline at end of file +var _0x934a=['./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x934a,0x127));var _0xa934=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x934a[_0x2714ec];return _0x2608e5;};'use strict';var _=require(_0xa934('0x0'));var util=require('util');var moment=require(_0xa934('0x1'));var BPromise=require(_0xa934('0x2'));var rs=require(_0xa934('0x3'));var fs=require('fs');var Redis=require(_0xa934('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa934('0x5'));var logger=require(_0xa934('0x6'))(_0xa934('0x7'));var config=require(_0xa934('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa934('0x9')][_0xa934('0xa')]({'port':0x232a});config[_0xa934('0xb')]=_['defaults'](config[_0xa934('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa934('0xc'))(new Redis(config[_0xa934('0xb')]));require(_0xa934('0xd'))[_0xa934('0xe')](socket);function respondWithRpcPromise(_0x17372b,_0x3d3774,_0x27e438){return new BPromise(function(_0x31c980,_0x116e97){return client[_0xa934('0xf')](_0x17372b,_0x27e438)[_0xa934('0x10')](function(_0xd58e8c){logger[_0xa934('0x11')](_0xa934('0x12'),_0x3d3774,'request\x20sent');logger[_0xa934('0x13')](_0xa934('0x14'),_0x3d3774,'request\x20sent',JSON[_0xa934('0x15')](_0xd58e8c));if(_0xd58e8c['error']){if(_0xd58e8c['error'][_0xa934('0x16')]===0x1f4){logger[_0xa934('0x17')](_0xa934('0x12'),_0x3d3774,_0xd58e8c[_0xa934('0x17')][_0xa934('0x18')]);return _0x116e97(_0xd58e8c[_0xa934('0x17')][_0xa934('0x18')]);}logger[_0xa934('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x3d3774,_0xd58e8c['error'][_0xa934('0x18')]);return _0x31c980(_0xd58e8c['error'][_0xa934('0x18')]);}else{logger[_0xa934('0x11')](_0xa934('0x12'),_0x3d3774,_0xa934('0x19'));_0x31c980(_0xd58e8c[_0xa934('0x1a')][_0xa934('0x18')]);}})[_0xa934('0x1b')](function(_0x2c13ff){logger[_0xa934('0x17')](_0xa934('0x12'),_0x3d3774,_0x2c13ff);_0x116e97(_0x2c13ff);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 43a6af1..88734fc 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 _0xc61a=['save','remove','update','emit','removeListener','register','length','./chatInternalMessage.events'];(function(_0x3b9705,_0x4a421e){var _0x239319=function(_0x32ebe1){while(--_0x32ebe1){_0x3b9705['push'](_0x3b9705['shift']());}};_0x239319(++_0x4a421e);}(_0xc61a,0x15f));var _0xac61=function(_0x16d6b4,_0x50360d){_0x16d6b4=_0x16d6b4-0x0;var _0x11f272=_0xc61a[_0x16d6b4];return _0x11f272;};'use strict';var ChatInternalMessageEvents=require(_0xac61('0x0'));var events=[_0xac61('0x1'),_0xac61('0x2'),_0xac61('0x3')];function createListener(_0x48f7a6,_0x38fd8f){return function(_0x2bb724){_0x38fd8f[_0xac61('0x4')](_0x48f7a6,_0x2bb724);};}function removeListener(_0x2c3de8,_0x44b23a){return function(){ChatInternalMessageEvents[_0xac61('0x5')](_0x2c3de8,_0x44b23a);};}exports[_0xac61('0x6')]=function(_0xc18d16){for(var _0x152717=0x0,_0x44cba3=events[_0xac61('0x7')];_0x152717<_0x44cba3;_0x152717++){var _0xbe935f=events[_0x152717];var _0x1c0d76=createListener('chatInternalMessage:'+_0xbe935f,_0xc18d16);ChatInternalMessageEvents['on'](_0xbe935f,_0x1c0d76);}}; \ No newline at end of file +var _0xd378=['update','emit','removeListener','register','remove'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xd378,0x1d0));var _0x8d37=function(_0x547b1c,_0xae1569){_0x547b1c=_0x547b1c-0x0;var _0x13defa=_0xd378[_0x547b1c];return _0x13defa;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x8d37('0x0'),_0x8d37('0x1')];function createListener(_0x3c77bc,_0x6426e7){return function(_0x39ed33){_0x6426e7[_0x8d37('0x2')](_0x3c77bc,_0x39ed33);};}function removeListener(_0x29ab0d,_0x2bcfe2){return function(){ChatInternalMessageEvents[_0x8d37('0x3')](_0x29ab0d,_0x2bcfe2);};}exports[_0x8d37('0x4')]=function(_0x48efda){for(var _0x486b67=0x0,_0x41d501=events['length'];_0x486b67<_0x41d501;_0x486b67++){var _0x4e4679=events[_0x486b67];var _0x405812=createListener('chatInternalMessage:'+_0x4e4679,_0x48efda);ChatInternalMessageEvents['on'](_0x4e4679,_0x405812);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a161f6a..1b2a28c 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 _0x3fa7=['update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','create','put'];(function(_0x5d3eaa,_0x4420df){var _0x283dd1=function(_0x133e69){while(--_0x133e69){_0x5d3eaa['push'](_0x5d3eaa['shift']());}};_0x283dd1(++_0x4420df);}(_0x3fa7,0x1b8));var _0x73fa=function(_0x20a35e,_0x1e4cc9){_0x20a35e=_0x20a35e-0x0;var _0x5a0cfd=_0x3fa7[_0x20a35e];return _0x5a0cfd;};'use strict';var multer=require('multer');var util=require(_0x73fa('0x0'));var path=require(_0x73fa('0x1'));var timeout=require(_0x73fa('0x2'));var express=require('express');var router=express[_0x73fa('0x3')]();var fs_extra=require(_0x73fa('0x4'));var auth=require(_0x73fa('0x5'));var interaction=require(_0x73fa('0x6'));var config=require(_0x73fa('0x7'));var controller=require(_0x73fa('0x8'));router[_0x73fa('0x9')]('/',auth[_0x73fa('0xa')](),controller[_0x73fa('0xb')]);router[_0x73fa('0x9')](_0x73fa('0xc'),auth[_0x73fa('0xa')](),controller[_0x73fa('0xd')]);router[_0x73fa('0x9')](_0x73fa('0xe'),auth[_0x73fa('0xa')](),controller[_0x73fa('0xf')]);router['get'](_0x73fa('0x10'),auth[_0x73fa('0xa')](),controller[_0x73fa('0x11')]);router['post']('/',auth[_0x73fa('0xa')](),controller[_0x73fa('0x12')]);router[_0x73fa('0x13')](_0x73fa('0x10'),controller[_0x73fa('0x14')]);router['delete'](_0x73fa('0x10'),auth[_0x73fa('0xa')](),controller[_0x73fa('0x15')]);module[_0x73fa('0x16')]=router; \ No newline at end of file +var _0x6dfe=['path','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','/:id','show','post','create','put','update','delete','exports','util'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x6dfe,0x1a3));var _0xe6df=function(_0x59bfb8,_0x5dde3f){_0x59bfb8=_0x59bfb8-0x0;var _0x428495=_0x6dfe[_0x59bfb8];return _0x428495;};'use strict';var multer=require('multer');var util=require(_0xe6df('0x0'));var path=require(_0xe6df('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe6df('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe6df('0x3'));var interaction=require(_0xe6df('0x4'));var config=require('../../config/environment');var controller=require(_0xe6df('0x5'));router[_0xe6df('0x6')]('/',auth[_0xe6df('0x7')](),controller[_0xe6df('0x8')]);router[_0xe6df('0x6')](_0xe6df('0x9'),auth['isAuthenticated'](),controller[_0xe6df('0xa')]);router[_0xe6df('0x6')](_0xe6df('0xb'),auth[_0xe6df('0x7')](),controller['getUsers']);router[_0xe6df('0x6')](_0xe6df('0xc'),auth[_0xe6df('0x7')](),controller[_0xe6df('0xd')]);router[_0xe6df('0xe')]('/',auth[_0xe6df('0x7')](),controller[_0xe6df('0xf')]);router[_0xe6df('0x10')](_0xe6df('0xc'),controller[_0xe6df('0x11')]);router[_0xe6df('0x12')](_0xe6df('0xc'),auth[_0xe6df('0x7')](),controller['destroy']);module[_0xe6df('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d9ad3cc..aaa71b5 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 _0xd8b0=['exports','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0d8b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0d8b('0x3')]('in',_0x0d8b('0x4')),'defaultValue':_0x0d8b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0d8b('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xce3a=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x2b6061,_0xd17e1a){var _0x1efbe1=function(_0x26b4ee){while(--_0x26b4ee){_0x2b6061['push'](_0x2b6061['shift']());}};_0x1efbe1(++_0xd17e1a);}(_0xce3a,0x194));var _0xace3=function(_0x3a657f,_0x25679f){_0x3a657f=_0x3a657f-0x0;var _0x415e94=_0xce3a[_0x3a657f];return _0x415e94;};'use strict';var Sequelize=require(_0xace3('0x0'));module[_0xace3('0x1')]={'body':{'type':Sequelize[_0xace3('0x2')](_0xace3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xace3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xace3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xace3('0x5')]('in',_0xace3('0x6')),'defaultValue':_0xace3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xace3('0x7')]},'providerName':{'type':Sequelize[_0xace3('0x8')]},'providerResponse':{'type':Sequelize[_0xace3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e5934be..6114a1e 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 _0x1f93=['destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','model','fields','find','create','body','update','describe','chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE: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','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x3657d2,_0x354f60){var _0x3eef68=function(_0x3a4633){while(--_0x3a4633){_0x3657d2['push'](_0x3657d2['shift']());}};_0x3eef68(++_0x354f60);}(_0x1f93,0xd8));var _0x31f9=function(_0x1f3f78,_0x5cab65){_0x1f3f78=_0x1f3f78-0x0;var _0x4eca9a=_0x1f93[_0x1f3f78];return _0x4eca9a;};'use strict';var emlformat=require(_0x31f9('0x0'));var rimraf=require(_0x31f9('0x1'));var zipdir=require(_0x31f9('0x2'));var jsonpatch=require(_0x31f9('0x3'));var rp=require('request-promise');var moment=require(_0x31f9('0x4'));var BPromise=require(_0x31f9('0x5'));var Mustache=require(_0x31f9('0x6'));var util=require(_0x31f9('0x7'));var path=require('path');var sox=require(_0x31f9('0x8'));var csv=require('to-csv');var ejs=require(_0x31f9('0x9'));var fs=require('fs');var fs_extra=require(_0x31f9('0xa'));var _=require('lodash');var squel=require(_0x31f9('0xb'));var crypto=require(_0x31f9('0xc'));var jsforce=require(_0x31f9('0xd'));var deskjs=require(_0x31f9('0xe'));var toCsv=require(_0x31f9('0xf'));var querystring=require('querystring');var Papa=require(_0x31f9('0x10'));var Redis=require(_0x31f9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x31f9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31f9('0x13'));var logger=require(_0x31f9('0x14'))(_0x31f9('0x15'));var utils=require(_0x31f9('0x16'));var config=require(_0x31f9('0x17'));var licenseUtil=require(_0x31f9('0x18'));var db=require(_0x31f9('0x19'))['db'];config[_0x31f9('0x1a')]=_[_0x31f9('0x1b')](config[_0x31f9('0x1a')],{'host':_0x31f9('0x1c'),'port':0x18eb});var socket=require(_0x31f9('0x1d'))(new Redis(config[_0x31f9('0x1a')]));require(_0x31f9('0x1e'))[_0x31f9('0x1f')](socket);var jayson=require(_0x31f9('0x20'));var client=jayson[_0x31f9('0x21')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14a6da,_0x65c02f,_0x358912,_0x163a33){return new BPromise(function(_0x42f592,_0xa50f0a){var _0x306dc0=_0x163a33||client;return _0x306dc0[_0x31f9('0x22')](_0x14a6da,_0x358912)[_0x31f9('0x23')](function(_0x3490fb){logger[_0x31f9('0x24')]('ChatMessage,\x20%s,\x20%s',_0x65c02f,_0x31f9('0x25'));logger[_0x31f9('0x26')](_0x31f9('0x27'),_0x65c02f,_0x31f9('0x25'),JSON[_0x31f9('0x28')](_0x3490fb));if(_0x3490fb[_0x31f9('0x29')]){if(_0x3490fb[_0x31f9('0x29')][_0x31f9('0x2a')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x65c02f,_0x3490fb[_0x31f9('0x29')][_0x31f9('0x2b')]);return _0xa50f0a(_0x3490fb['error'][_0x31f9('0x2b')]);}logger[_0x31f9('0x29')](_0x31f9('0x2c'),_0x65c02f,_0x3490fb[_0x31f9('0x29')][_0x31f9('0x2b')]);return _0x42f592(_0x3490fb[_0x31f9('0x29')][_0x31f9('0x2b')]);}else{logger[_0x31f9('0x24')](_0x31f9('0x2c'),_0x65c02f,'request\x20sent');_0x42f592(_0x3490fb[_0x31f9('0x2d')][_0x31f9('0x2b')]);}})[_0x31f9('0x2e')](function(_0x3a1e83){logger[_0x31f9('0x29')]('ChatMessage,\x20%s,\x20%s',_0x65c02f,_0x3a1e83);_0xa50f0a(_0x3a1e83);});});}function respondWithStatusCode(_0x25c382,_0x29448e){_0x29448e=_0x29448e||0xcc;return function(_0x143531){if(_0x143531){return _0x25c382[_0x31f9('0x2f')](_0x29448e);}return _0x25c382[_0x31f9('0x30')](_0x29448e)['end']();};}function respondWithResult(_0x2cec26,_0x18fde1){_0x18fde1=_0x18fde1||0xc8;return function(_0x37813a){if(_0x37813a){return _0x2cec26[_0x31f9('0x30')](_0x18fde1)[_0x31f9('0x31')](_0x37813a);}};}function respondWithFilteredResult(_0x2b3735,_0x309557){return function(_0x56d239){if(_0x56d239){var _0x24523c=typeof _0x309557[_0x31f9('0x32')]===_0x31f9('0x33')&&typeof _0x309557[_0x31f9('0x34')]===_0x31f9('0x33');var _0x235e0b=_0x56d239['count'];var _0x7eb962=_0x24523c?0x0:_0x309557['offset'];var _0x4e8755=_0x24523c?_0x56d239[_0x31f9('0x35')]:_0x309557[_0x31f9('0x32')]+_0x309557[_0x31f9('0x34')];var _0x448e0a;if(_0x4e8755>=_0x235e0b){_0x4e8755=_0x235e0b;_0x448e0a=0xc8;}else{_0x448e0a=0xce;}_0x2b3735[_0x31f9('0x30')](_0x448e0a);return _0x2b3735[_0x31f9('0x36')](_0x31f9('0x37'),_0x7eb962+'-'+_0x4e8755+'/'+_0x235e0b)[_0x31f9('0x31')](_0x56d239);}return null;};}function patchUpdates(_0x1e68c0){return function(_0x2eecf7){try{jsonpatch[_0x31f9('0x38')](_0x2eecf7,_0x1e68c0,!![]);}catch(_0x527f01){return BPromise[_0x31f9('0x39')](_0x527f01);}return _0x2eecf7['save']();};}function saveUpdates(_0x53cf0e,_0x4f0fee){return function(_0x29c576){if(_0x29c576){return _0x29c576['update'](_0x53cf0e)['then'](function(_0x381688){return _0x381688;});}return null;};}function removeEntity(_0x4e50d5,_0x1007b3){return function(_0x279cf4){if(_0x279cf4){return _0x279cf4[_0x31f9('0x3a')]()[_0x31f9('0x23')](function(){_0x4e50d5[_0x31f9('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5743b8,_0x260117){return function(_0x211769){if(!_0x211769){_0x5743b8['sendStatus'](0x194);}return _0x211769;};}function handleError(_0xe7add1,_0x5cecce){_0x5cecce=_0x5cecce||0x1f4;return function(_0x518923){logger[_0x31f9('0x29')](_0x518923[_0x31f9('0x3b')]);if(_0x518923[_0x31f9('0x3c')]){delete _0x518923[_0x31f9('0x3c')];}_0xe7add1['status'](_0x5cecce)['send'](_0x518923);};}exports[_0x31f9('0x3d')]=function(_0x21554e,_0x5202cc){var _0x44aa6f={},_0x421f56={},_0x157586={'count':0x0,'rows':[]};var _0x4af48b=_[_0x31f9('0x3e')](db[_0x31f9('0x3f')][_0x31f9('0x40')],function(_0x905314){return{'name':_0x905314[_0x31f9('0x41')],'type':_0x905314[_0x31f9('0x42')][_0x31f9('0x43')]};});_0x421f56['model']=_[_0x31f9('0x3e')](_0x4af48b,_0x31f9('0x3c'));_0x421f56[_0x31f9('0x44')]=_[_0x31f9('0x45')](_0x21554e[_0x31f9('0x44')]);_0x421f56[_0x31f9('0x46')]=_[_0x31f9('0x47')](_0x421f56['model'],_0x421f56[_0x31f9('0x44')]);_0x44aa6f['attributes']=_['intersection'](_0x421f56['model'],qs['fields'](_0x21554e[_0x31f9('0x44')]['fields']));_0x44aa6f[_0x31f9('0x48')]=_0x44aa6f[_0x31f9('0x48')][_0x31f9('0x49')]?_0x44aa6f[_0x31f9('0x48')]:_0x421f56['model'];if(!_0x21554e['query'][_0x31f9('0x4a')](_0x31f9('0x4b'))){_0x44aa6f['limit']=qs['limit'](_0x21554e[_0x31f9('0x44')][_0x31f9('0x34')]);_0x44aa6f['offset']=qs[_0x31f9('0x32')](_0x21554e[_0x31f9('0x44')]['offset']);}_0x44aa6f[_0x31f9('0x4c')]=qs[_0x31f9('0x4d')](_0x21554e[_0x31f9('0x44')][_0x31f9('0x4d')]);_0x44aa6f[_0x31f9('0x4e')]=qs[_0x31f9('0x46')](_[_0x31f9('0x4f')](_0x21554e[_0x31f9('0x44')],_0x421f56[_0x31f9('0x46')]),_0x4af48b);if(_0x21554e[_0x31f9('0x44')][_0x31f9('0x50')]){_0x44aa6f[_0x31f9('0x4e')]=_[_0x31f9('0x51')](_0x44aa6f[_0x31f9('0x4e')],{'$or':_[_0x31f9('0x3e')](_0x4af48b,function(_0x5bfaa5){if(_0x5bfaa5[_0x31f9('0x42')]!==_0x31f9('0x52')){var _0x1f4a03={};_0x1f4a03[_0x5bfaa5['name']]={'$like':'%'+_0x21554e[_0x31f9('0x44')][_0x31f9('0x50')]+'%'};return _0x1f4a03;}})});}_0x44aa6f=_[_0x31f9('0x51')]({},_0x44aa6f,_0x21554e[_0x31f9('0x53')]);var _0x561cb0={'where':_0x44aa6f['where']};return db[_0x31f9('0x3f')][_0x31f9('0x35')](_0x561cb0)[_0x31f9('0x23')](function(_0x5a1eb9){_0x157586[_0x31f9('0x35')]=_0x5a1eb9;if(_0x21554e[_0x31f9('0x44')][_0x31f9('0x54')]){_0x44aa6f[_0x31f9('0x55')]=[{'all':!![]}];}return db[_0x31f9('0x3f')][_0x31f9('0x56')](_0x44aa6f);})[_0x31f9('0x23')](function(_0x150ff0){_0x157586[_0x31f9('0x57')]=_0x150ff0;return _0x157586;})[_0x31f9('0x23')](respondWithFilteredResult(_0x5202cc,_0x44aa6f))[_0x31f9('0x2e')](handleError(_0x5202cc,null));};exports['show']=function(_0x531565,_0x569d2f){var _0x39c48a={'raw':!![],'where':{'id':_0x531565[_0x31f9('0x58')]['id']}},_0x21bd15={};_0x21bd15[_0x31f9('0x59')]=_[_0x31f9('0x45')](db[_0x31f9('0x3f')][_0x31f9('0x40')]);_0x21bd15[_0x31f9('0x44')]=_['keys'](_0x531565[_0x31f9('0x44')]);_0x21bd15[_0x31f9('0x46')]=_[_0x31f9('0x47')](_0x21bd15[_0x31f9('0x59')],_0x21bd15[_0x31f9('0x44')]);_0x39c48a[_0x31f9('0x48')]=_[_0x31f9('0x47')](_0x21bd15[_0x31f9('0x59')],qs[_0x31f9('0x5a')](_0x531565['query']['fields']));_0x39c48a[_0x31f9('0x48')]=_0x39c48a[_0x31f9('0x48')][_0x31f9('0x49')]?_0x39c48a[_0x31f9('0x48')]:_0x21bd15[_0x31f9('0x59')];if(_0x531565['query'][_0x31f9('0x54')]){_0x39c48a[_0x31f9('0x55')]=[{'all':!![]}];}_0x39c48a=_['merge']({},_0x39c48a,_0x531565[_0x31f9('0x53')]);return db['ChatMessage'][_0x31f9('0x5b')](_0x39c48a)[_0x31f9('0x23')](handleEntityNotFound(_0x569d2f,null))[_0x31f9('0x23')](respondWithResult(_0x569d2f,null))[_0x31f9('0x2e')](handleError(_0x569d2f,null));};exports[_0x31f9('0x5c')]=function(_0x2720ae,_0x24a5a1){return db['ChatMessage'][_0x31f9('0x5c')](_0x2720ae[_0x31f9('0x5d')],{})[_0x31f9('0x23')](respondWithResult(_0x24a5a1,0xc9))[_0x31f9('0x2e')](handleError(_0x24a5a1,null));};exports[_0x31f9('0x5e')]=function(_0x44d61b,_0x1ae87f){if(_0x44d61b[_0x31f9('0x5d')]['id']){delete _0x44d61b[_0x31f9('0x5d')]['id'];}return db['ChatMessage'][_0x31f9('0x5b')]({'where':{'id':_0x44d61b[_0x31f9('0x58')]['id']}})[_0x31f9('0x23')](handleEntityNotFound(_0x1ae87f,null))[_0x31f9('0x23')](saveUpdates(_0x44d61b[_0x31f9('0x5d')],null))[_0x31f9('0x23')](respondWithResult(_0x1ae87f,null))[_0x31f9('0x2e')](handleError(_0x1ae87f,null));};exports[_0x31f9('0x3a')]=function(_0x408388,_0x4cdcf4){return db[_0x31f9('0x3f')][_0x31f9('0x5b')]({'where':{'id':_0x408388[_0x31f9('0x58')]['id']}})[_0x31f9('0x23')](handleEntityNotFound(_0x4cdcf4,null))[_0x31f9('0x23')](removeEntity(_0x4cdcf4,null))['catch'](handleError(_0x4cdcf4,null));};exports[_0x31f9('0x5f')]=function(_0x59c1a2,_0x38b5bc){return db['ChatMessage'][_0x31f9('0x5f')]()['then'](respondWithResult(_0x38b5bc,null))[_0x31f9('0x2e')](handleError(_0x38b5bc,null));};var interaction_log=require(_0x31f9('0x14'))(_0x31f9('0x60'));exports[_0x31f9('0x61')]=function(_0x28abf7,_0x5a9c11,_0x4956ca){var _0x147929={'agent':{},'channel':'chat'};if(_0x28abf7[_0x31f9('0x5d')]['id']){delete _0x28abf7[_0x31f9('0x5d')]['id'];}_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x62')]=!![];_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x63')]=moment()[_0x31f9('0x64')](_0x31f9('0x65'));_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x66')]=_0x28abf7['body'][_0x31f9('0x66')]||_0x28abf7['user']['id'];_0x147929[_0x31f9('0x67')]['id']=_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x66')];return db['ChatMessage'][_0x31f9('0x5b')]({'where':{'id':_0x28abf7[_0x31f9('0x58')]['id'],'UserId':null}})[_0x31f9('0x23')](handleEntityNotFound(_0x5a9c11,null))['then'](saveUpdates(_0x28abf7[_0x31f9('0x5d')],null))[_0x31f9('0x23')](function(_0x123086){if(_0x123086){_0x147929[_0x31f9('0x2b')]=_0x123086[_0x31f9('0x68')]({'plain':!![]});return db[_0x31f9('0x69')]['find']({'where':{'id':_0x123086[_0x31f9('0x6a')]}});}return null;})[_0x31f9('0x23')](handleEntityNotFound(_0x5a9c11,null))[_0x31f9('0x23')](function(_0x43fefb){if(_0x43fefb){return _0x43fefb[_0x31f9('0x5e')]({'UserId':_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x66')],'read1stAt':_['isNil'](_0x43fefb[_0x31f9('0x6b')])?moment()[_0x31f9('0x64')](_0x31f9('0x65')):undefined});}return null;})[_0x31f9('0x23')](function(_0x5b78d7){if(_0x5b78d7){_0x147929[_0x31f9('0x6c')]=_0x5b78d7['get']({'plain':!![]});interaction_log[_0x31f9('0x24')](_0x31f9('0x6d'),_0x28abf7[_0x31f9('0x6e')]['id'],_0x28abf7[_0x31f9('0x6e')][_0x31f9('0x3c')],_0x28abf7[_0x31f9('0x6e')][_0x31f9('0x6f')],_0x147929['interaction']['id'],_0x28abf7[_0x31f9('0x5d')]?JSON[_0x31f9('0x28')](_0x28abf7[_0x31f9('0x5d')]):_0x31f9('0x70'));return respondWithRpcPromise(_0x31f9('0x71'),_0x31f9('0x72'),_0x147929);}return null;})['then'](function(_0x3bc855){var _0x45c0b2=_0x31f9('0x73')+_0x3bc855[_0x31f9('0x2b')][_0x31f9('0x74')];return db['sequelize'][_0x31f9('0x44')](_0x45c0b2,{'type':db[_0x31f9('0x75')]['QueryTypes'][_0x31f9('0x76')],'raw':!![]})[_0x31f9('0x23')](function(_0x143a1c){return _0x143a1c;});})[_0x31f9('0x23')](function(_0x1057ee){if(_0x1057ee){_0x147929[_0x31f9('0x2b')][_0x31f9('0x77')]=_0x1057ee[0x0];if(!_0x28abf7[_0x31f9('0x5d')]['UserId'])return;return db[_0x31f9('0x78')][_0x31f9('0x5b')]({'where':{'id':_0x28abf7[_0x31f9('0x5d')][_0x31f9('0x66')],'role':'agent'},'attributes':['id',_0x31f9('0x3c'),_0x31f9('0x79'),_0x31f9('0x7a'),_0x31f9('0x7b')],'raw':!![]});}return null;})['then'](function(_0x5586bd){if(!_0x5586bd)return null;_0x147929[_0x31f9('0x2b')][_0x31f9('0x67')]=_0x5586bd;return _0x147929;})[_0x31f9('0x23')](function(_0x433b06){if(_0x433b06){if(_0x28abf7[_0x31f9('0x5d')]['manual']){_0x147929[_0x31f9('0x2b')][_0x31f9('0x7c')]=util[_0x31f9('0x64')](_0x31f9('0x7d'),_0x28abf7[_0x31f9('0x6e')][_0x31f9('0x3c')]);_0x147929[_0x31f9('0x2b')][_0x31f9('0x7e')]=_0x147929['channel'];_0x147929[_0x31f9('0x2b')][_0x31f9('0x7f')]=_0x147929[_0x31f9('0x7e')];_0x147929[_0x31f9('0x2b')][_0x31f9('0x80')]='accept';return respondWithRpcPromise(_0x31f9('0x81'),_0x31f9('0x81'),{'event':'acceptmessage','message':_[_0x31f9('0x51')](_0x147929[_0x31f9('0x2b')],JSON[_0x31f9('0x82')](_0x147929['interaction'][_0x31f9('0x83')]))},client9002)[_0x31f9('0x23')](function(){return _0x147929;});}return _0x147929;}return null;})[_0x31f9('0x23')](respondWithResult(_0x5a9c11,null))[_0x31f9('0x2e')](handleError(_0x5a9c11,null));};var interaction_log=require(_0x31f9('0x14'))('chat-interactions');exports['reject']=function(_0x5de05c,_0x7aae9,_0x46a1c4){var _0x5d46db={'agent':{},'channel':_0x31f9('0x84')};if(_0x5de05c[_0x31f9('0x5d')]['id']){delete _0x5de05c[_0x31f9('0x5d')]['id'];}_0x5de05c[_0x31f9('0x5d')][_0x31f9('0x66')]=_0x5de05c[_0x31f9('0x5d')]['UserId']||_0x5de05c[_0x31f9('0x6e')]['id'];_0x5d46db['agent']['id']=_0x5de05c['body'][_0x31f9('0x66')];return db[_0x31f9('0x3f')][_0x31f9('0x5b')]({'where':{'id':_0x5de05c[_0x31f9('0x58')]['id'],'UserId':null}})[_0x31f9('0x23')](handleEntityNotFound(_0x7aae9,null))['then'](function(_0xffbc3d){if(_0xffbc3d){_0x5d46db[_0x31f9('0x2b')]=_0xffbc3d[_0x31f9('0x68')]({'plain':!![]});return db[_0x31f9('0x69')][_0x31f9('0x5b')]({'where':{'id':_0xffbc3d[_0x31f9('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x7aae9,null))['then'](function(_0x40e19c){if(_0x40e19c){_0x5d46db[_0x31f9('0x6c')]=_0x40e19c['get']({'plain':!![]});interaction_log[_0x31f9('0x24')](_0x31f9('0x85'),_0x5de05c['user']['id'],_0x5de05c['user'][_0x31f9('0x3c')],_0x5de05c[_0x31f9('0x6e')]['role'],_0x5d46db[_0x31f9('0x6c')]['id'],_0x5de05c[_0x31f9('0x5d')]?JSON[_0x31f9('0x28')](_0x5de05c[_0x31f9('0x5d')]):_0x31f9('0x70'));return respondWithRpcPromise(_0x31f9('0x86'),_0x31f9('0x87'),_0x5d46db);}return null;})[_0x31f9('0x23')](function(_0x351ff2){var _0x682558=_0x31f9('0x73')+_0x351ff2[_0x31f9('0x2b')]['ContactId'];return db['sequelize'][_0x31f9('0x44')](_0x682558,{'type':db[_0x31f9('0x75')]['QueryTypes']['SELECT'],'raw':!![]})[_0x31f9('0x23')](function(_0x24f887){return _0x24f887;});})[_0x31f9('0x23')](function(_0x2d328e){if(_0x2d328e){_0x5d46db[_0x31f9('0x2b')][_0x31f9('0x77')]=_0x2d328e[0x0];if(!_0x5de05c[_0x31f9('0x5d')]['UserId'])return;return db[_0x31f9('0x78')][_0x31f9('0x5b')]({'where':{'id':_0x5de05c[_0x31f9('0x5d')][_0x31f9('0x66')],'role':'agent'},'attributes':['id',_0x31f9('0x3c'),_0x31f9('0x79'),_0x31f9('0x7a'),_0x31f9('0x7b')],'raw':!![]});}return null;})[_0x31f9('0x23')](function(_0x19edd4){if(!_0x19edd4)return null;_0x5d46db[_0x31f9('0x2b')][_0x31f9('0x67')]=_0x19edd4;return _0x5d46db;})['then'](function(_0x3ec04b){if(_0x3ec04b){_0x3ec04b[_0x31f9('0x2b')][_0x31f9('0x7c')]=util[_0x31f9('0x64')](_0x31f9('0x7d'),_0x5de05c[_0x31f9('0x6e')][_0x31f9('0x3c')]);_0x3ec04b[_0x31f9('0x2b')]['channel']=_0x5d46db[_0x31f9('0x7e')];_0x3ec04b[_0x31f9('0x2b')]['motionChannel']=_0x5d46db['channel'];_0x3ec04b[_0x31f9('0x2b')][_0x31f9('0x80')]=_0x31f9('0x39');respondWithRpcPromise('EventManager',_0x31f9('0x81'),{'event':_0x31f9('0x88'),'message':_[_0x31f9('0x51')](_0x5d46db[_0x31f9('0x2b')],JSON['parse'](_0x5d46db[_0x31f9('0x6c')]['formData']))},client9002);return _0x5d46db;}return null;})[_0x31f9('0x23')](respondWithResult(_0x7aae9,null))[_0x31f9('0x2e')](handleError(_0x7aae9,null));}; \ No newline at end of file +var _0x30dd=['Sequelize','SELECT','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','accept','EventManager','acceptmessage','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','QueryTypes','contact','SIP/%s','event','rejectmessage','parse','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','destroy','end','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','show','params','options','find','create','body','update','describe','chat-interactions','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','format','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x30dd,0x1ab));var _0xd30d=function(_0x3fb9f7,_0x297de6){_0x3fb9f7=_0x3fb9f7-0x0;var _0x70fabc=_0x30dd[_0x3fb9f7];return _0x70fabc;};'use strict';var emlformat=require(_0xd30d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd30d('0x1'));var rp=require(_0xd30d('0x2'));var moment=require(_0xd30d('0x3'));var BPromise=require(_0xd30d('0x4'));var Mustache=require(_0xd30d('0x5'));var util=require(_0xd30d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd30d('0x7'));var ejs=require(_0xd30d('0x8'));var fs=require('fs');var fs_extra=require(_0xd30d('0x9'));var _=require(_0xd30d('0xa'));var squel=require(_0xd30d('0xb'));var crypto=require(_0xd30d('0xc'));var jsforce=require(_0xd30d('0xd'));var deskjs=require(_0xd30d('0xe'));var toCsv=require(_0xd30d('0x7'));var querystring=require(_0xd30d('0xf'));var Papa=require(_0xd30d('0x10'));var Redis=require(_0xd30d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd30d('0x12'));var as=require(_0xd30d('0x13'));var hardwareService=require(_0xd30d('0x14'));var logger=require(_0xd30d('0x15'))(_0xd30d('0x16'));var utils=require(_0xd30d('0x17'));var config=require(_0xd30d('0x18'));var licenseUtil=require(_0xd30d('0x19'));var db=require(_0xd30d('0x1a'))['db'];config[_0xd30d('0x1b')]=_[_0xd30d('0x1c')](config['redis'],{'host':_0xd30d('0x1d'),'port':0x18eb});var socket=require(_0xd30d('0x1e'))(new Redis(config[_0xd30d('0x1b')]));require('./chatMessage.socket')[_0xd30d('0x1f')](socket);var jayson=require(_0xd30d('0x20'));var client=jayson['client'][_0xd30d('0x21')]({'port':0x232c});var client9002=jayson[_0xd30d('0x22')][_0xd30d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5cc3bf,_0x1dcffe,_0x32c1e5,_0x344bae){return new BPromise(function(_0x37713f,_0x3cb322){var _0x7e0d63=_0x344bae||client;return _0x7e0d63[_0xd30d('0x23')](_0x5cc3bf,_0x32c1e5)[_0xd30d('0x24')](function(_0x3dbff2){logger[_0xd30d('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1dcffe,_0xd30d('0x26'));logger[_0xd30d('0x27')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1dcffe,_0xd30d('0x26'),JSON['stringify'](_0x3dbff2));if(_0x3dbff2[_0xd30d('0x28')]){if(_0x3dbff2[_0xd30d('0x28')]['code']===0x1f4){logger[_0xd30d('0x28')](_0xd30d('0x29'),_0x1dcffe,_0x3dbff2[_0xd30d('0x28')][_0xd30d('0x2a')]);return _0x3cb322(_0x3dbff2[_0xd30d('0x28')]['message']);}logger[_0xd30d('0x28')]('ChatMessage,\x20%s,\x20%s',_0x1dcffe,_0x3dbff2[_0xd30d('0x28')]['message']);return _0x37713f(_0x3dbff2[_0xd30d('0x28')][_0xd30d('0x2a')]);}else{logger[_0xd30d('0x25')](_0xd30d('0x29'),_0x1dcffe,_0xd30d('0x26'));_0x37713f(_0x3dbff2[_0xd30d('0x2b')][_0xd30d('0x2a')]);}})[_0xd30d('0x2c')](function(_0x1a1814){logger[_0xd30d('0x28')](_0xd30d('0x29'),_0x1dcffe,_0x1a1814);_0x3cb322(_0x1a1814);});});}function respondWithStatusCode(_0x19d376,_0xd16469){_0xd16469=_0xd16469||0xcc;return function(_0x51d91d){if(_0x51d91d){return _0x19d376[_0xd30d('0x2d')](_0xd16469);}return _0x19d376[_0xd30d('0x2e')](_0xd16469)['end']();};}function respondWithResult(_0xa4c709,_0x207608){_0x207608=_0x207608||0xc8;return function(_0x540479){if(_0x540479){return _0xa4c709[_0xd30d('0x2e')](_0x207608)['json'](_0x540479);}};}function respondWithFilteredResult(_0x4b3de9,_0x4a7857){return function(_0x2b3945){if(_0x2b3945){var _0x10b7c5=typeof _0x4a7857['offset']===_0xd30d('0x2f')&&typeof _0x4a7857['limit']==='undefined';var _0x5f178a=_0x2b3945[_0xd30d('0x30')];var _0x99a141=_0x10b7c5?0x0:_0x4a7857['offset'];var _0x441c46=_0x10b7c5?_0x2b3945[_0xd30d('0x30')]:_0x4a7857[_0xd30d('0x31')]+_0x4a7857['limit'];var _0x39970c;if(_0x441c46>=_0x5f178a){_0x441c46=_0x5f178a;_0x39970c=0xc8;}else{_0x39970c=0xce;}_0x4b3de9[_0xd30d('0x2e')](_0x39970c);return _0x4b3de9[_0xd30d('0x32')](_0xd30d('0x33'),_0x99a141+'-'+_0x441c46+'/'+_0x5f178a)[_0xd30d('0x34')](_0x2b3945);}return null;};}function patchUpdates(_0x29851c){return function(_0x2bf8d2){try{jsonpatch[_0xd30d('0x35')](_0x2bf8d2,_0x29851c,!![]);}catch(_0x9c538d){return BPromise['reject'](_0x9c538d);}return _0x2bf8d2['save']();};}function saveUpdates(_0x580399,_0x38cac9){return function(_0x23246d){if(_0x23246d){return _0x23246d['update'](_0x580399)['then'](function(_0x118920){return _0x118920;});}return null;};}function removeEntity(_0x53c508,_0x2883b1){return function(_0x4e63c6){if(_0x4e63c6){return _0x4e63c6[_0xd30d('0x36')]()[_0xd30d('0x24')](function(){_0x53c508[_0xd30d('0x2e')](0xcc)[_0xd30d('0x37')]();});}};}function handleEntityNotFound(_0x4b616e,_0x14917a){return function(_0x5d71c0){if(!_0x5d71c0){_0x4b616e[_0xd30d('0x2d')](0x194);}return _0x5d71c0;};}function handleError(_0x3ec58f,_0x353ac6){_0x353ac6=_0x353ac6||0x1f4;return function(_0x5d70a9){logger['error'](_0x5d70a9['stack']);if(_0x5d70a9[_0xd30d('0x38')]){delete _0x5d70a9['name'];}_0x3ec58f[_0xd30d('0x2e')](_0x353ac6)[_0xd30d('0x39')](_0x5d70a9);};}exports[_0xd30d('0x3a')]=function(_0x294c50,_0x1ec303){var _0x20c6c9={},_0x2f151d={},_0x33beb0={'count':0x0,'rows':[]};var _0x5d5c42=_[_0xd30d('0x3b')](db[_0xd30d('0x3c')][_0xd30d('0x3d')],function(_0x28eeb5){return{'name':_0x28eeb5[_0xd30d('0x3e')],'type':_0x28eeb5['type'][_0xd30d('0x3f')]};});_0x2f151d[_0xd30d('0x40')]=_[_0xd30d('0x3b')](_0x5d5c42,_0xd30d('0x38'));_0x2f151d[_0xd30d('0x41')]=_[_0xd30d('0x42')](_0x294c50[_0xd30d('0x41')]);_0x2f151d[_0xd30d('0x43')]=_[_0xd30d('0x44')](_0x2f151d[_0xd30d('0x40')],_0x2f151d[_0xd30d('0x41')]);_0x20c6c9[_0xd30d('0x45')]=_[_0xd30d('0x44')](_0x2f151d[_0xd30d('0x40')],qs['fields'](_0x294c50[_0xd30d('0x41')][_0xd30d('0x46')]));_0x20c6c9[_0xd30d('0x45')]=_0x20c6c9[_0xd30d('0x45')][_0xd30d('0x47')]?_0x20c6c9[_0xd30d('0x45')]:_0x2f151d['model'];if(!_0x294c50[_0xd30d('0x41')]['hasOwnProperty']('nolimit')){_0x20c6c9[_0xd30d('0x48')]=qs[_0xd30d('0x48')](_0x294c50[_0xd30d('0x41')]['limit']);_0x20c6c9[_0xd30d('0x31')]=qs[_0xd30d('0x31')](_0x294c50[_0xd30d('0x41')][_0xd30d('0x31')]);}_0x20c6c9[_0xd30d('0x49')]=qs[_0xd30d('0x4a')](_0x294c50[_0xd30d('0x41')][_0xd30d('0x4a')]);_0x20c6c9[_0xd30d('0x4b')]=qs[_0xd30d('0x43')](_['pick'](_0x294c50[_0xd30d('0x41')],_0x2f151d[_0xd30d('0x43')]),_0x5d5c42);if(_0x294c50[_0xd30d('0x41')][_0xd30d('0x4c')]){_0x20c6c9[_0xd30d('0x4b')]=_[_0xd30d('0x4d')](_0x20c6c9[_0xd30d('0x4b')],{'$or':_[_0xd30d('0x3b')](_0x5d5c42,function(_0x1d873d){if(_0x1d873d[_0xd30d('0x4e')]!=='VIRTUAL'){var _0x50dd3e={};_0x50dd3e[_0x1d873d[_0xd30d('0x38')]]={'$like':'%'+_0x294c50['query'][_0xd30d('0x4c')]+'%'};return _0x50dd3e;}})});}_0x20c6c9=_[_0xd30d('0x4d')]({},_0x20c6c9,_0x294c50['options']);var _0x4dec84={'where':_0x20c6c9[_0xd30d('0x4b')]};return db[_0xd30d('0x3c')][_0xd30d('0x30')](_0x4dec84)[_0xd30d('0x24')](function(_0x1672c1){_0x33beb0['count']=_0x1672c1;if(_0x294c50[_0xd30d('0x41')][_0xd30d('0x4f')]){_0x20c6c9[_0xd30d('0x50')]=[{'all':!![]}];}return db['ChatMessage'][_0xd30d('0x51')](_0x20c6c9);})[_0xd30d('0x24')](function(_0x44ea6a){_0x33beb0[_0xd30d('0x52')]=_0x44ea6a;return _0x33beb0;})['then'](respondWithFilteredResult(_0x1ec303,_0x20c6c9))[_0xd30d('0x2c')](handleError(_0x1ec303,null));};exports[_0xd30d('0x53')]=function(_0x2ec9e4,_0x47c512){var _0xce43c7={'raw':!![],'where':{'id':_0x2ec9e4[_0xd30d('0x54')]['id']}},_0x5dffb6={};_0x5dffb6['model']=_[_0xd30d('0x42')](db[_0xd30d('0x3c')][_0xd30d('0x3d')]);_0x5dffb6['query']=_[_0xd30d('0x42')](_0x2ec9e4[_0xd30d('0x41')]);_0x5dffb6[_0xd30d('0x43')]=_['intersection'](_0x5dffb6['model'],_0x5dffb6[_0xd30d('0x41')]);_0xce43c7['attributes']=_[_0xd30d('0x44')](_0x5dffb6[_0xd30d('0x40')],qs[_0xd30d('0x46')](_0x2ec9e4[_0xd30d('0x41')][_0xd30d('0x46')]));_0xce43c7[_0xd30d('0x45')]=_0xce43c7[_0xd30d('0x45')][_0xd30d('0x47')]?_0xce43c7[_0xd30d('0x45')]:_0x5dffb6[_0xd30d('0x40')];if(_0x2ec9e4[_0xd30d('0x41')]['includeAll']){_0xce43c7[_0xd30d('0x50')]=[{'all':!![]}];}_0xce43c7=_[_0xd30d('0x4d')]({},_0xce43c7,_0x2ec9e4[_0xd30d('0x55')]);return db[_0xd30d('0x3c')][_0xd30d('0x56')](_0xce43c7)['then'](handleEntityNotFound(_0x47c512,null))[_0xd30d('0x24')](respondWithResult(_0x47c512,null))[_0xd30d('0x2c')](handleError(_0x47c512,null));};exports['create']=function(_0x437882,_0x144cac){return db[_0xd30d('0x3c')][_0xd30d('0x57')](_0x437882[_0xd30d('0x58')],{})['then'](respondWithResult(_0x144cac,0xc9))[_0xd30d('0x2c')](handleError(_0x144cac,null));};exports[_0xd30d('0x59')]=function(_0x33fd1c,_0x52b686){if(_0x33fd1c[_0xd30d('0x58')]['id']){delete _0x33fd1c[_0xd30d('0x58')]['id'];}return db[_0xd30d('0x3c')][_0xd30d('0x56')]({'where':{'id':_0x33fd1c[_0xd30d('0x54')]['id']}})[_0xd30d('0x24')](handleEntityNotFound(_0x52b686,null))['then'](saveUpdates(_0x33fd1c[_0xd30d('0x58')],null))[_0xd30d('0x24')](respondWithResult(_0x52b686,null))[_0xd30d('0x2c')](handleError(_0x52b686,null));};exports[_0xd30d('0x36')]=function(_0x1fb840,_0x42528d){return db[_0xd30d('0x3c')]['find']({'where':{'id':_0x1fb840['params']['id']}})[_0xd30d('0x24')](handleEntityNotFound(_0x42528d,null))[_0xd30d('0x24')](removeEntity(_0x42528d,null))[_0xd30d('0x2c')](handleError(_0x42528d,null));};exports[_0xd30d('0x5a')]=function(_0x3fbec7,_0x44db0a){return db[_0xd30d('0x3c')][_0xd30d('0x5a')]()[_0xd30d('0x24')](respondWithResult(_0x44db0a,null))['catch'](handleError(_0x44db0a,null));};var interaction_log=require(_0xd30d('0x15'))(_0xd30d('0x5b'));exports['accept']=function(_0x158269,_0x586c46,_0x2ebca8){var _0x4bb854={'agent':{},'channel':_0xd30d('0x5c')};if(_0x158269['body']['id']){delete _0x158269['body']['id'];}_0x158269['body'][_0xd30d('0x5d')]=!![];_0x158269[_0xd30d('0x58')][_0xd30d('0x5e')]=moment()['format'](_0xd30d('0x5f'));_0x158269[_0xd30d('0x58')][_0xd30d('0x60')]=_0x158269[_0xd30d('0x58')]['UserId']||_0x158269[_0xd30d('0x61')]['id'];_0x4bb854['agent']['id']=_0x158269[_0xd30d('0x58')][_0xd30d('0x60')];return db[_0xd30d('0x3c')][_0xd30d('0x56')]({'where':{'id':_0x158269[_0xd30d('0x54')]['id'],'UserId':null}})[_0xd30d('0x24')](handleEntityNotFound(_0x586c46,null))[_0xd30d('0x24')](saveUpdates(_0x158269['body'],null))[_0xd30d('0x24')](function(_0x205a18){if(_0x205a18){_0x4bb854[_0xd30d('0x2a')]=_0x205a18['get']({'plain':!![]});return db[_0xd30d('0x62')][_0xd30d('0x56')]({'where':{'id':_0x205a18[_0xd30d('0x63')]}});}return null;})[_0xd30d('0x24')](handleEntityNotFound(_0x586c46,null))[_0xd30d('0x24')](function(_0x5b911e){if(_0x5b911e){return _0x5b911e[_0xd30d('0x59')]({'UserId':_0x158269['body'][_0xd30d('0x60')],'read1stAt':_['isNil'](_0x5b911e['read1stAt'])?moment()[_0xd30d('0x64')](_0xd30d('0x5f')):undefined});}return null;})['then'](function(_0x18b257){if(_0x18b257){_0x4bb854[_0xd30d('0x65')]=_0x18b257[_0xd30d('0x66')]({'plain':!![]});interaction_log['info'](_0xd30d('0x67'),_0x158269[_0xd30d('0x61')]['id'],_0x158269['user'][_0xd30d('0x38')],_0x158269[_0xd30d('0x61')]['role'],_0x4bb854[_0xd30d('0x65')]['id'],_0x158269[_0xd30d('0x58')]?JSON[_0xd30d('0x68')](_0x158269[_0xd30d('0x58')]):_0xd30d('0x69'));return respondWithRpcPromise(_0xd30d('0x6a'),'acceptMessage',_0x4bb854);}return null;})[_0xd30d('0x24')](function(_0x1d68bd){var _0x5b28e4=_0xd30d('0x6b')+_0x1d68bd['message'][_0xd30d('0x6c')];return db['sequelize']['query'](_0x5b28e4,{'type':db[_0xd30d('0x6d')]['QueryTypes'][_0xd30d('0x6e')],'raw':!![]})['then'](function(_0x882260){return _0x882260;});})[_0xd30d('0x24')](function(_0xa3775){if(_0xa3775){_0x4bb854[_0xd30d('0x2a')]['contact']=_0xa3775[0x0];if(!_0x158269[_0xd30d('0x58')][_0xd30d('0x60')])return;return db[_0xd30d('0x6f')][_0xd30d('0x56')]({'where':{'id':_0x158269[_0xd30d('0x58')][_0xd30d('0x60')],'role':_0xd30d('0x70')},'attributes':['id',_0xd30d('0x38'),_0xd30d('0x71'),_0xd30d('0x72'),_0xd30d('0x73')],'raw':!![]});}return null;})[_0xd30d('0x24')](function(_0x341e4){if(!_0x341e4)return null;_0x4bb854[_0xd30d('0x2a')][_0xd30d('0x70')]=_0x341e4;return _0x4bb854;})[_0xd30d('0x24')](function(_0x5f42a7){if(_0x5f42a7){if(_0x158269[_0xd30d('0x58')][_0xd30d('0x74')]){_0x4bb854[_0xd30d('0x2a')][_0xd30d('0x75')]=util[_0xd30d('0x64')]('SIP/%s',_0x158269[_0xd30d('0x61')]['name']);_0x4bb854[_0xd30d('0x2a')][_0xd30d('0x76')]=_0x4bb854[_0xd30d('0x76')];_0x4bb854['message'][_0xd30d('0x77')]=_0x4bb854[_0xd30d('0x76')];_0x4bb854[_0xd30d('0x2a')]['event']=_0xd30d('0x78');return respondWithRpcPromise(_0xd30d('0x79'),_0xd30d('0x79'),{'event':_0xd30d('0x7a'),'message':_[_0xd30d('0x4d')](_0x4bb854['message'],JSON['parse'](_0x4bb854[_0xd30d('0x65')][_0xd30d('0x7b')]))},client9002)[_0xd30d('0x24')](function(){return _0x4bb854;});}return _0x4bb854;}return null;})[_0xd30d('0x24')](respondWithResult(_0x586c46,null))[_0xd30d('0x2c')](handleError(_0x586c46,null));};var interaction_log=require(_0xd30d('0x15'))(_0xd30d('0x5b'));exports[_0xd30d('0x7c')]=function(_0x32dc0f,_0x3ca5c1,_0x1c4423){var _0x4c7d1b={'agent':{},'channel':'chat'};if(_0x32dc0f[_0xd30d('0x58')]['id']){delete _0x32dc0f[_0xd30d('0x58')]['id'];}_0x32dc0f['body']['UserId']=_0x32dc0f['body']['UserId']||_0x32dc0f[_0xd30d('0x61')]['id'];_0x4c7d1b[_0xd30d('0x70')]['id']=_0x32dc0f[_0xd30d('0x58')][_0xd30d('0x60')];return db[_0xd30d('0x3c')][_0xd30d('0x56')]({'where':{'id':_0x32dc0f[_0xd30d('0x54')]['id'],'UserId':null}})[_0xd30d('0x24')](handleEntityNotFound(_0x3ca5c1,null))[_0xd30d('0x24')](function(_0x1ed0b4){if(_0x1ed0b4){_0x4c7d1b['message']=_0x1ed0b4[_0xd30d('0x66')]({'plain':!![]});return db[_0xd30d('0x62')][_0xd30d('0x56')]({'where':{'id':_0x1ed0b4[_0xd30d('0x63')]}});}return null;})[_0xd30d('0x24')](handleEntityNotFound(_0x3ca5c1,null))[_0xd30d('0x24')](function(_0x11df78){if(_0x11df78){_0x4c7d1b['interaction']=_0x11df78[_0xd30d('0x66')]({'plain':!![]});interaction_log[_0xd30d('0x25')](_0xd30d('0x7d'),_0x32dc0f['user']['id'],_0x32dc0f[_0xd30d('0x61')][_0xd30d('0x38')],_0x32dc0f['user'][_0xd30d('0x7e')],_0x4c7d1b['interaction']['id'],_0x32dc0f[_0xd30d('0x58')]?JSON[_0xd30d('0x68')](_0x32dc0f[_0xd30d('0x58')]):_0xd30d('0x69'));return respondWithRpcPromise(_0xd30d('0x7f'),'rejectMessage',_0x4c7d1b);}return null;})[_0xd30d('0x24')](function(_0x81597c){var _0x5acd99=_0xd30d('0x6b')+_0x81597c[_0xd30d('0x2a')][_0xd30d('0x6c')];return db['sequelize'][_0xd30d('0x41')](_0x5acd99,{'type':db['Sequelize'][_0xd30d('0x80')]['SELECT'],'raw':!![]})[_0xd30d('0x24')](function(_0x1e25e1){return _0x1e25e1;});})[_0xd30d('0x24')](function(_0x12b5d7){if(_0x12b5d7){_0x4c7d1b['message'][_0xd30d('0x81')]=_0x12b5d7[0x0];if(!_0x32dc0f[_0xd30d('0x58')][_0xd30d('0x60')])return;return db[_0xd30d('0x6f')][_0xd30d('0x56')]({'where':{'id':_0x32dc0f[_0xd30d('0x58')]['UserId'],'role':_0xd30d('0x70')},'attributes':['id',_0xd30d('0x38'),'fullname',_0xd30d('0x72'),_0xd30d('0x73')],'raw':!![]});}return null;})[_0xd30d('0x24')](function(_0x16d8b2){if(!_0x16d8b2)return null;_0x4c7d1b[_0xd30d('0x2a')][_0xd30d('0x70')]=_0x16d8b2;return _0x4c7d1b;})[_0xd30d('0x24')](function(_0x225488){if(_0x225488){_0x225488['message'][_0xd30d('0x75')]=util[_0xd30d('0x64')](_0xd30d('0x82'),_0x32dc0f['user'][_0xd30d('0x38')]);_0x225488['message']['channel']=_0x4c7d1b[_0xd30d('0x76')];_0x225488[_0xd30d('0x2a')][_0xd30d('0x77')]=_0x4c7d1b[_0xd30d('0x76')];_0x225488['message'][_0xd30d('0x83')]=_0xd30d('0x7c');respondWithRpcPromise('EventManager','EventManager',{'event':_0xd30d('0x84'),'message':_['merge'](_0x4c7d1b[_0xd30d('0x2a')],JSON[_0xd30d('0x85')](_0x4c7d1b[_0xd30d('0x65')][_0xd30d('0x7b')]))},client9002);return _0x4c7d1b;}return null;})[_0xd30d('0x24')](respondWithResult(_0x3ca5c1,null))[_0xd30d('0x2c')](handleError(_0x3ca5c1,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index bf98a55..769a6a0 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 _0xcc6f=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x4922db,_0x21c496){var _0x294b2c=function(_0x2efc91){while(--_0x2efc91){_0x4922db['push'](_0x4922db['shift']());}};_0x294b2c(++_0x21c496);}(_0xcc6f,0xb5));var _0xfcc6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcc6f[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xfcc6('0x0'));var ChatMessage=require(_0xfcc6('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcc6('0x2'),'afterUpdate':_0xfcc6('0x3'),'afterDestroy':_0xfcc6('0x4')};function emitEvent(_0x9bfabb){return function(_0x444a6b,_0x13b0b6,_0xa051ac){ChatMessageEvents['emit'](_0x9bfabb+':'+_0x444a6b['id'],_0x444a6b);ChatMessageEvents[_0xfcc6('0x5')](_0x9bfabb,_0x444a6b);_0xa051ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xfcc6('0x6')](e,emitEvent(event));}}module[_0xfcc6('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x54aa=['../../mysqldb','ChatMessage','save','emit','exports','events'];(function(_0x238cd5,_0x5eaefc){var _0x196bfb=function(_0x5c7d53){while(--_0x5c7d53){_0x238cd5['push'](_0x238cd5['shift']());}};_0x196bfb(++_0x5eaefc);}(_0x54aa,0x1a9));var _0xa54a=function(_0x596c48,_0x5f4b40){_0x596c48=_0x596c48-0x0;var _0x2508d0=_0x54aa[_0x596c48];return _0x2508d0;};'use strict';var EventEmitter=require(_0xa54a('0x0'));var ChatMessage=require(_0xa54a('0x1'))['db'][_0xa54a('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa54a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x11e72c){return function(_0x53829d,_0x5147b6,_0x35d176){ChatMessageEvents['emit'](_0x11e72c+':'+_0x53829d['id'],_0x53829d);ChatMessageEvents[_0xa54a('0x4')](_0x11e72c,_0x53829d);_0x35d176(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xa54a('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 85ba3a1..dbbf3f3 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 _0xc913=['./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x7c0070,_0x4ecf28){var _0x46a772=function(_0x44083b){while(--_0x44083b){_0x7c0070['push'](_0x7c0070['shift']());}};_0x46a772(++_0x4ecf28);}(_0xc913,0xd9));var _0x3c91=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0xc913[_0x5a99db];return _0x3aad62;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c91('0x0'))(_0x3c91('0x1'));var moment=require(_0x3c91('0x2'));var BPromise=require(_0x3c91('0x3'));var rp=require(_0x3c91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c91('0x5'));var config=require(_0x3c91('0x6'));var attributes=require(_0x3c91('0x7'));module[_0x3c91('0x8')]=function(_0x340d56,_0x9b69d){return _0x340d56['define'](_0x3c91('0x9'),attributes,{'tableName':_0x3c91('0xa'),'paranoid':![],'indexes':[{'name':_0x3c91('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31756f,_0x2df461,_0x459f45){var _0x4c769d=_0x340d56[_0x3c91('0xc')];var _0x4ebcee=_0x31756f[_0x3c91('0xd')]({'plain':!![]});if(_0x4ebcee[_0x3c91('0xe')][_0x3c91('0xf')]()==='in'||_0x4ebcee[_0x3c91('0xe')]['toLowerCase']()===_0x3c91('0x10')&&!_0x4ebcee[_0x3c91('0x11')]&&!_[_0x3c91('0x12')](_0x4ebcee['UserId'])){_0x4c769d[_0x3c91('0x13')][_0x3c91('0x14')]({'where':{'id':_0x4ebcee[_0x3c91('0x15')]}})[_0x3c91('0x16')](function(_0x168267){if(_0x168267){_0x168267[_0x3c91('0x17')]({'lastMsgAt':_0x4ebcee[_0x3c91('0x18')],'lastMsgDirection':_0x4ebcee[_0x3c91('0xe')][_0x3c91('0xf')]()});}})['catch'](function(_0x23e8b8){console[_0x3c91('0x19')](_0x23e8b8);});}_0x459f45();}},'charset':_0x3c91('0x1a'),'collate':_0x3c91('0x1b')});}; \ No newline at end of file +var _0x1403=['secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x289874,_0x1b6752){var _0x2f8bbb=function(_0x23ee80){while(--_0x23ee80){_0x289874['push'](_0x289874['shift']());}};_0x2f8bbb(++_0x1b6752);}(_0x1403,0x9b));var _0x3140=function(_0x4873e7,_0xadd09b){_0x4873e7=_0x4873e7-0x0;var _0x589ef4=_0x1403[_0x4873e7];return _0x589ef4;};'use strict';var _=require('lodash');var util=require(_0x3140('0x0'));var logger=require(_0x3140('0x1'))(_0x3140('0x2'));var moment=require(_0x3140('0x3'));var BPromise=require(_0x3140('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3140('0x5'));var rimraf=require(_0x3140('0x6'));var config=require(_0x3140('0x7'));var attributes=require(_0x3140('0x8'));module['exports']=function(_0x5cb034,_0x5cfeb0){return _0x5cb034[_0x3140('0x9')](_0x3140('0xa'),attributes,{'tableName':_0x3140('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x3140('0xc')],'type':_0x3140('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47d0f4,_0x269c6b,_0xa63ba6){var _0x2491e3=_0x5cb034[_0x3140('0xe')];var _0x35818a=_0x47d0f4[_0x3140('0xf')]({'plain':!![]});if(_0x35818a[_0x3140('0x10')][_0x3140('0x11')]()==='in'||_0x35818a[_0x3140('0x10')][_0x3140('0x11')]()===_0x3140('0x12')&&!_0x35818a[_0x3140('0x13')]&&!_[_0x3140('0x14')](_0x35818a[_0x3140('0x15')])){_0x2491e3[_0x3140('0x16')][_0x3140('0x17')]({'where':{'id':_0x35818a[_0x3140('0x18')]}})['then'](function(_0x505750){if(_0x505750){_0x505750['update']({'lastMsgAt':_0x35818a[_0x3140('0x19')],'lastMsgDirection':_0x35818a[_0x3140('0x10')][_0x3140('0x11')]()});}})['catch'](function(_0x136b5b){console[_0x3140('0x1a')](_0x136b5b);});}_0xa63ba6();}},'charset':_0x3140('0x1b'),'collate':_0x3140('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 060fc34..2aa7d8b 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 _0x3475=['register','request','then','info','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','ChatMessage','body','options','raw','CreateChatMessage','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket'];(function(_0x113c74,_0xd2f035){var _0x1909bb=function(_0x4c3212){while(--_0x4c3212){_0x113c74['push'](_0x113c74['shift']());}};_0x1909bb(++_0xd2f035);}(_0x3475,0xbc));var _0x5347=function(_0x33ccfb,_0x5503c7){_0x33ccfb=_0x33ccfb-0x0;var _0x5e4f46=_0x3475[_0x33ccfb];return _0x5e4f46;};'use strict';var _=require(_0x5347('0x0'));var util=require(_0x5347('0x1'));var moment=require(_0x5347('0x2'));var BPromise=require(_0x5347('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5347('0x4'));var db=require(_0x5347('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5347('0x6'))(_0x5347('0x7'));var config=require('../../config/environment');var jayson=require(_0x5347('0x8'));var client=jayson[_0x5347('0x9')][_0x5347('0xa')]({'port':0x232a});config[_0x5347('0xb')]=_[_0x5347('0xc')](config['redis'],{'host':_0x5347('0xd'),'port':0x18eb});var socket=require(_0x5347('0xe'))(new Redis(config[_0x5347('0xb')]));require(_0x5347('0xf'))[_0x5347('0x10')](socket);function respondWithRpcPromise(_0x5ce222,_0x4db134,_0x403a8c){return new BPromise(function(_0x18b5e2,_0x343354){return client[_0x5347('0x11')](_0x5ce222,_0x403a8c)[_0x5347('0x12')](function(_0x4f9626){logger[_0x5347('0x13')]('ChatMessage,\x20%s,\x20%s',_0x4db134,_0x5347('0x14'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4db134,_0x5347('0x14'),JSON[_0x5347('0x15')](_0x4f9626));if(_0x4f9626['error']){if(_0x4f9626[_0x5347('0x16')][_0x5347('0x17')]===0x1f4){logger[_0x5347('0x16')](_0x5347('0x18'),_0x4db134,_0x4f9626[_0x5347('0x16')][_0x5347('0x19')]);return _0x343354(_0x4f9626[_0x5347('0x16')][_0x5347('0x19')]);}logger[_0x5347('0x16')](_0x5347('0x18'),_0x4db134,_0x4f9626[_0x5347('0x16')][_0x5347('0x19')]);return _0x18b5e2(_0x4f9626[_0x5347('0x16')][_0x5347('0x19')]);}else{logger[_0x5347('0x13')](_0x5347('0x18'),_0x4db134,_0x5347('0x14'));_0x18b5e2(_0x4f9626[_0x5347('0x1a')][_0x5347('0x19')]);}})['catch'](function(_0x1238fa){logger[_0x5347('0x16')]('ChatMessage,\x20%s,\x20%s',_0x4db134,_0x1238fa);_0x343354(_0x1238fa);});});}exports['CreateChatMessage']=function(_0x187b3a){var _0x406e75=this;return new Promise(function(_0xe62d2a,_0x19fe45){return db[_0x5347('0x1b')]['create'](_0x187b3a[_0x5347('0x1c')],{'raw':_0x187b3a[_0x5347('0x1d')]?_0x187b3a['options'][_0x5347('0x1e')]===undefined?!![]:![]:!![]})[_0x5347('0x12')](function(_0x1199d2){logger[_0x5347('0x13')](_0x5347('0x1f'),_0x187b3a);logger[_0x5347('0x20')](_0x5347('0x1f'),_0x187b3a,JSON[_0x5347('0x15')](_0x1199d2));_0xe62d2a(_0x1199d2);})[_0x5347('0x21')](function(_0x20db23){logger[_0x5347('0x16')](_0x5347('0x1f'),_0x20db23[_0x5347('0x19')],_0x187b3a);_0x19fe45(_0x406e75[_0x5347('0x16')](0x1f4,_0x20db23[_0x5347('0x19')]));});});}; \ No newline at end of file +var _0xd399=['http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','ChatMessage','create','body','options','CreateChatMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3251d0,_0x4d310c){var _0x28dd57=function(_0x19bcb4){while(--_0x19bcb4){_0x3251d0['push'](_0x3251d0['shift']());}};_0x28dd57(++_0x4d310c);}(_0xd399,0x181));var _0x9d39=function(_0x4d71b7,_0x3a110d){_0x4d71b7=_0x4d71b7-0x0;var _0x252631=_0xd399[_0x4d71b7];return _0x252631;};'use strict';var _=require(_0x9d39('0x0'));var util=require(_0x9d39('0x1'));var moment=require(_0x9d39('0x2'));var BPromise=require(_0x9d39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d39('0x4'));var db=require(_0x9d39('0x5'))['db'];var utils=require(_0x9d39('0x6'));var logger=require(_0x9d39('0x7'))(_0x9d39('0x8'));var config=require('../../config/environment');var jayson=require(_0x9d39('0x9'));var client=jayson[_0x9d39('0xa')][_0x9d39('0xb')]({'port':0x232a});config['redis']=_[_0x9d39('0xc')](config[_0x9d39('0xd')],{'host':_0x9d39('0xe'),'port':0x18eb});var socket=require(_0x9d39('0xf'))(new Redis(config[_0x9d39('0xd')]));require(_0x9d39('0x10'))[_0x9d39('0x11')](socket);function respondWithRpcPromise(_0x482e61,_0x49a963,_0x1b4583){return new BPromise(function(_0x17d13e,_0x43572f){return client[_0x9d39('0x12')](_0x482e61,_0x1b4583)[_0x9d39('0x13')](function(_0x2886e6){logger[_0x9d39('0x14')]('ChatMessage,\x20%s,\x20%s',_0x49a963,'request\x20sent');logger[_0x9d39('0x15')](_0x9d39('0x16'),_0x49a963,_0x9d39('0x17'),JSON[_0x9d39('0x18')](_0x2886e6));if(_0x2886e6[_0x9d39('0x19')]){if(_0x2886e6[_0x9d39('0x19')][_0x9d39('0x1a')]===0x1f4){logger[_0x9d39('0x19')]('ChatMessage,\x20%s,\x20%s',_0x49a963,_0x2886e6[_0x9d39('0x19')][_0x9d39('0x1b')]);return _0x43572f(_0x2886e6[_0x9d39('0x19')][_0x9d39('0x1b')]);}logger[_0x9d39('0x19')]('ChatMessage,\x20%s,\x20%s',_0x49a963,_0x2886e6[_0x9d39('0x19')][_0x9d39('0x1b')]);return _0x17d13e(_0x2886e6[_0x9d39('0x19')]['message']);}else{logger['info'](_0x9d39('0x1c'),_0x49a963,_0x9d39('0x17'));_0x17d13e(_0x2886e6[_0x9d39('0x1d')]['message']);}})[_0x9d39('0x1e')](function(_0x8f9a6c){logger[_0x9d39('0x19')](_0x9d39('0x1c'),_0x49a963,_0x8f9a6c);_0x43572f(_0x8f9a6c);});});}exports['CreateChatMessage']=function(_0x48c2fd){var _0x750458=this;return new Promise(function(_0x284f67,_0xd2ced7){return db[_0x9d39('0x1f')][_0x9d39('0x20')](_0x48c2fd[_0x9d39('0x21')],{'raw':_0x48c2fd[_0x9d39('0x22')]?_0x48c2fd['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x23f0fe){logger[_0x9d39('0x14')](_0x9d39('0x23'),_0x48c2fd);logger[_0x9d39('0x15')](_0x9d39('0x23'),_0x48c2fd,JSON['stringify'](_0x23f0fe));_0x284f67(_0x23f0fe);})[_0x9d39('0x1e')](function(_0x406060){logger[_0x9d39('0x19')](_0x9d39('0x23'),_0x406060['message'],_0x48c2fd);_0xd2ced7(_0x750458[_0x9d39('0x19')](0x1f4,_0x406060[_0x9d39('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index fa1ab85..a467ca0 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 _0x9fc5=['save','remove','emit','removeListener','register','length','chatMessage:'];(function(_0x147d4c,_0xc24f70){var _0x1811fc=function(_0x15c2ee){while(--_0x15c2ee){_0x147d4c['push'](_0x147d4c['shift']());}};_0x1811fc(++_0xc24f70);}(_0x9fc5,0xb6));var _0x59fc=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x9fc5[_0x2405bc];return _0x5272d4;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x59fc('0x0'),_0x59fc('0x1'),'update'];function createListener(_0x4647c5,_0x24cd55){return function(_0x46c819){_0x24cd55[_0x59fc('0x2')](_0x4647c5,_0x46c819);};}function removeListener(_0x44979c,_0x1b0778){return function(){ChatMessageEvents[_0x59fc('0x3')](_0x44979c,_0x1b0778);};}exports[_0x59fc('0x4')]=function(_0x4cb94d){for(var _0x3bde0b=0x0,_0x13897f=events[_0x59fc('0x5')];_0x3bde0b<_0x13897f;_0x3bde0b++){var _0x55fa6d=events[_0x3bde0b];var _0xdd2bb9=createListener(_0x59fc('0x6')+_0x55fa6d,_0x4cb94d);ChatMessageEvents['on'](_0x55fa6d,_0xdd2bb9);}}; \ No newline at end of file +var _0x60c2=['removeListener','register','length','save','remove','update','emit'];(function(_0x527771,_0x466d7b){var _0x1e9a21=function(_0x67cad8){while(--_0x67cad8){_0x527771['push'](_0x527771['shift']());}};_0x1e9a21(++_0x466d7b);}(_0x60c2,0x8f));var _0x260c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x60c2[_0xa464c9];return _0x3d73c4;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x260c('0x0'),_0x260c('0x1'),_0x260c('0x2')];function createListener(_0x3ad4c5,_0x2f5bc8){return function(_0x759b92){_0x2f5bc8[_0x260c('0x3')](_0x3ad4c5,_0x759b92);};}function removeListener(_0x309bde,_0x17a599){return function(){ChatMessageEvents[_0x260c('0x4')](_0x309bde,_0x17a599);};}exports[_0x260c('0x5')]=function(_0x13c7d0){for(var _0x558b0c=0x0,_0x14fab2=events[_0x260c('0x6')];_0x558b0c<_0x14fab2;_0x558b0c++){var _0x3b432d=events[_0x558b0c];var _0xf22c37=createListener('chatMessage:'+_0x3b432d,_0x13c7d0);ChatMessageEvents['on'](_0x3b432d,_0xf22c37);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 67d1ae2..69bfecb 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 _0xb582=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','chatmessage:create','create','put','update','reject','destroy','exports','path','connect-timeout','express'];(function(_0x1f0ebc,_0x519687){var _0x17ada6=function(_0x207a39){while(--_0x207a39){_0x1f0ebc['push'](_0x1f0ebc['shift']());}};_0x17ada6(++_0x519687);}(_0xb582,0x1dd));var _0x2b58=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb582[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2b58('0x0'));var timeout=require(_0x2b58('0x1'));var express=require(_0x2b58('0x2'));var router=express[_0x2b58('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b58('0x4'));var interaction=require(_0x2b58('0x5'));var config=require(_0x2b58('0x6'));var controller=require(_0x2b58('0x7'));router[_0x2b58('0x8')]('/',auth[_0x2b58('0x9')](),controller[_0x2b58('0xa')]);router[_0x2b58('0x8')](_0x2b58('0xb'),auth[_0x2b58('0x9')](),controller[_0x2b58('0xc')]);router[_0x2b58('0x8')](_0x2b58('0xd'),auth[_0x2b58('0x9')](),controller[_0x2b58('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x2b58('0xf')](_0x2b58('0x10'),_0x2b58('0x11')),controller[_0x2b58('0x12')]);router[_0x2b58('0x13')]('/:id',controller[_0x2b58('0x14')]);router[_0x2b58('0x13')]('/:id/accept',auth[_0x2b58('0x9')](),controller['accept']);router[_0x2b58('0x13')]('/:id/reject',auth[_0x2b58('0x9')](),controller[_0x2b58('0x15')]);router['delete'](_0x2b58('0xd'),auth[_0x2b58('0x9')](),controller[_0x2b58('0x16')]);module[_0x2b58('0x17')]=router; \ No newline at end of file +var _0x3dcb=['../../config/environment','isAuthenticated','get','/describe','describe','show','post','chat','chatmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29e24c,_0x168327){var _0x1bfa32=function(_0x46f400){while(--_0x46f400){_0x29e24c['push'](_0x29e24c['shift']());}};_0x1bfa32(++_0x168327);}(_0x3dcb,0x13d));var _0xb3dc=function(_0x4f5a83,_0x2e5c25){_0x4f5a83=_0x4f5a83-0x0;var _0xd165f9=_0x3dcb[_0x4f5a83];return _0xd165f9;};'use strict';var multer=require(_0xb3dc('0x0'));var util=require(_0xb3dc('0x1'));var path=require(_0xb3dc('0x2'));var timeout=require(_0xb3dc('0x3'));var express=require('express');var router=express[_0xb3dc('0x4')]();var fs_extra=require(_0xb3dc('0x5'));var auth=require(_0xb3dc('0x6'));var interaction=require(_0xb3dc('0x7'));var config=require(_0xb3dc('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xb3dc('0x9')](),controller['index']);router[_0xb3dc('0xa')](_0xb3dc('0xb'),auth[_0xb3dc('0x9')](),controller[_0xb3dc('0xc')]);router[_0xb3dc('0xa')]('/:id',auth[_0xb3dc('0x9')](),controller[_0xb3dc('0xd')]);router[_0xb3dc('0xe')]('/',auth[_0xb3dc('0x9')](),interaction['tracked'](_0xb3dc('0xf'),_0xb3dc('0x10')),controller[_0xb3dc('0x11')]);router[_0xb3dc('0x12')](_0xb3dc('0x13'),controller[_0xb3dc('0x14')]);router['put'](_0xb3dc('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xb3dc('0x12')](_0xb3dc('0x16'),auth[_0xb3dc('0x9')](),controller['reject']);router[_0xb3dc('0x17')]('/:id',auth[_0xb3dc('0x9')](),controller[_0xb3dc('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 43561e0..ff5c171 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x39664c,_0x47c3c6){var _0x220cb8=function(_0x130d40){while(--_0x130d40){_0x39664c['push'](_0x39664c['shift']());}};_0x220cb8(++_0x47c3c6);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e18a,_0x2d220a){_0x4e18a=_0x4e18a-0x0;var _0x56cc08=_0xb10b[_0x4e18a];return _0x56cc08;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x757a,0xde));var _0xa757=function(_0x10734c,_0x5ba664){_0x10734c=_0x10734c-0x0;var _0x40e81d=_0x757a[_0x10734c];return _0x40e81d;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index c8ece0b..525bd4b 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x7a54,0x106));var _0x47a5=function(_0x5d9f6a,_0x25b34c){_0x5d9f6a=_0x5d9f6a-0x0;var _0x18b0ba=_0x7a54[_0x5d9f6a];return _0x18b0ba;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _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(_0x495e47,_0x1cfb0e){var _0x2ce11c=function(_0x43057f){while(--_0x43057f){_0x495e47['push'](_0x495e47['shift']());}};_0x2ce11c(++_0x1cfb0e);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 2717ac7..712d6eb 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 _0x11e5=['emit','hasOwnProperty','hook','events','ChatOfflineMessage','setMaxListeners','update','remove'];(function(_0x4ba86d,_0x3a6310){var _0x5521b6=function(_0x35a646){while(--_0x35a646){_0x4ba86d['push'](_0x4ba86d['shift']());}};_0x5521b6(++_0x3a6310);}(_0x11e5,0x8b));var _0x511e=function(_0x22b0cb,_0x5a764a){_0x22b0cb=_0x22b0cb-0x0;var _0x444178=_0x11e5[_0x22b0cb];return _0x444178;};'use strict';var EventEmitter=require(_0x511e('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x511e('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x511e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x511e('0x3'),'afterDestroy':_0x511e('0x4')};function emitEvent(_0x101e06){return function(_0x5cab33,_0x249e4d,_0x4fbd4f){ChatOfflineMessageEvents['emit'](_0x101e06+':'+_0x5cab33['id'],_0x5cab33);ChatOfflineMessageEvents[_0x511e('0x5')](_0x101e06,_0x5cab33);_0x4fbd4f(null);};}for(var e in events){if(events[_0x511e('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x511e('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xa6a4=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove'];(function(_0x43fba9,_0x36b884){var _0x24cb3e=function(_0x7f8441){while(--_0x7f8441){_0x43fba9['push'](_0x43fba9['shift']());}};_0x24cb3e(++_0x36b884);}(_0xa6a4,0xe9));var _0x4a6a=function(_0x43fb6b,_0xd25c0f){_0x43fb6b=_0x43fb6b-0x0;var _0x16dd9e=_0xa6a4[_0x43fb6b];return _0x16dd9e;};'use strict';var EventEmitter=require(_0x4a6a('0x0'));var ChatOfflineMessage=require(_0x4a6a('0x1'))['db'][_0x4a6a('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4a6a('0x3')](0x0);var events={'afterCreate':_0x4a6a('0x4'),'afterUpdate':_0x4a6a('0x5'),'afterDestroy':_0x4a6a('0x6')};function emitEvent(_0x1d70ef){return function(_0x5f53ea,_0x4a946a,_0x36aa0c){ChatOfflineMessageEvents[_0x4a6a('0x7')](_0x1d70ef+':'+_0x5f53ea['id'],_0x5f53ea);ChatOfflineMessageEvents[_0x4a6a('0x7')](_0x1d70ef,_0x5f53ea);_0x36aa0c(null);};}for(var e in events){if(events[_0x4a6a('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x4a6a('0x9')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c35f78d..2571d00 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 _0x6433=['ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define'];(function(_0x5c7b86,_0x361fde){var _0x189239=function(_0x36887c){while(--_0x36887c){_0x5c7b86['push'](_0x5c7b86['shift']());}};_0x189239(++_0x361fde);}(_0x6433,0xa5));var _0x3643=function(_0x178808,_0x3563f0){_0x178808=_0x178808-0x0;var _0x413b3f=_0x6433[_0x178808];return _0x413b3f;};'use strict';var attributes=require(_0x3643('0x0'));module[_0x3643('0x1')]=function(_0x585ea3){return _0x585ea3[_0x3643('0x2')](_0x3643('0x3'),attributes,{'tableName':_0x3643('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3643('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x52f6=['utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x2493a0,_0x30e38d){var _0x261a78=function(_0x309150){while(--_0x309150){_0x2493a0['push'](_0x2493a0['shift']());}};_0x261a78(++_0x30e38d);}(_0x52f6,0x157));var _0x652f=function(_0x38448c,_0xf81883){_0x38448c=_0x38448c-0x0;var _0x441f82=_0x52f6[_0x38448c];return _0x441f82;};'use strict';var attributes=require(_0x652f('0x0'));module[_0x652f('0x1')]=function(_0x33bc2f){return _0x33bc2f[_0x652f('0x2')](_0x652f('0x3'),attributes,{'tableName':_0x652f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x652f('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index fc401f5..942cef7 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 _0x0f09=['code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f09,0x1a5));var _0x90f0=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x0f09[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x90f0('0x0'));var moment=require(_0x90f0('0x1'));var BPromise=require(_0x90f0('0x2'));var rs=require(_0x90f0('0x3'));var fs=require('fs');var Redis=require(_0x90f0('0x4'));var db=require(_0x90f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x90f0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x90f0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4741a3,_0x17e4ba,_0x2d3559){return new BPromise(function(_0x51edf1,_0x2fa7fc){return client[_0x90f0('0x8')](_0x4741a3,_0x2d3559)[_0x90f0('0x9')](function(_0x39f16e){logger[_0x90f0('0xa')](_0x90f0('0xb'),_0x17e4ba,_0x90f0('0xc'));logger[_0x90f0('0xd')](_0x90f0('0xe'),_0x17e4ba,_0x90f0('0xc'),JSON['stringify'](_0x39f16e));if(_0x39f16e[_0x90f0('0xf')]){if(_0x39f16e[_0x90f0('0xf')][_0x90f0('0x10')]===0x1f4){logger[_0x90f0('0xf')](_0x90f0('0xb'),_0x17e4ba,_0x39f16e[_0x90f0('0xf')]['message']);return _0x2fa7fc(_0x39f16e[_0x90f0('0xf')][_0x90f0('0x11')]);}logger[_0x90f0('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x17e4ba,_0x39f16e[_0x90f0('0xf')]['message']);return _0x51edf1(_0x39f16e['error']['message']);}else{logger[_0x90f0('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x17e4ba,_0x90f0('0xc'));_0x51edf1(_0x39f16e['result'][_0x90f0('0x11')]);}})[_0x90f0('0x12')](function(_0x4f75d5){logger['error'](_0x90f0('0xb'),_0x17e4ba,_0x4f75d5);_0x2fa7fc(_0x4f75d5);});});} \ No newline at end of file +var _0x6726=['request\x20sent','debug','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x46c644,_0x5eca5a){var _0x1058fa=function(_0x28073f){while(--_0x28073f){_0x46c644['push'](_0x46c644['shift']());}};_0x1058fa(++_0x5eca5a);}(_0x6726,0xdb));var _0x6672=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x6726[_0x65c903];return _0x23e1d7;};'use strict';var _=require('lodash');var util=require(_0x6672('0x0'));var moment=require(_0x6672('0x1'));var BPromise=require('bluebird');var rs=require(_0x6672('0x2'));var fs=require('fs');var Redis=require(_0x6672('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6672('0x4'));var logger=require('../../config/logger')(_0x6672('0x5'));var config=require(_0x6672('0x6'));var jayson=require(_0x6672('0x7'));var client=jayson[_0x6672('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa1d3b7,_0x303146,_0x263321){return new BPromise(function(_0x379b90,_0xc53855){return client[_0x6672('0x9')](_0xa1d3b7,_0x263321)[_0x6672('0xa')](function(_0x3c093b){logger[_0x6672('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x303146,_0x6672('0xc'));logger[_0x6672('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x303146,_0x6672('0xc'),JSON[_0x6672('0xe')](_0x3c093b));if(_0x3c093b[_0x6672('0xf')]){if(_0x3c093b[_0x6672('0xf')][_0x6672('0x10')]===0x1f4){logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);return _0xc53855(_0x3c093b['error'][_0x6672('0x12')]);}logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);return _0x379b90(_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);}else{logger['info'](_0x6672('0x11'),_0x303146,_0x6672('0xc'));_0x379b90(_0x3c093b[_0x6672('0x13')][_0x6672('0x12')]);}})[_0x6672('0x14')](function(_0x6884f){logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x6884f);_0xc53855(_0x6884f);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 9986b3e..bdc43ab 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 _0xa792=['util','connect-timeout','express','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','put','/:id','update','delete','exports','multer'];(function(_0x4ebe52,_0x42faf2){var _0x4c0e8c=function(_0x47cdf1){while(--_0x47cdf1){_0x4ebe52['push'](_0x4ebe52['shift']());}};_0x4c0e8c(++_0x42faf2);}(_0xa792,0x98));var _0x2a79=function(_0x5911db,_0x5e9a5f){_0x5911db=_0x5911db-0x0;var _0x4f14ae=_0xa792[_0x5911db];return _0x4f14ae;};'use strict';var multer=require(_0x2a79('0x0'));var util=require(_0x2a79('0x1'));var path=require('path');var timeout=require(_0x2a79('0x2'));var express=require(_0x2a79('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2a79('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2a79('0x5'));var controller=require(_0x2a79('0x6'));router['get']('/',auth[_0x2a79('0x7')](),controller[_0x2a79('0x8')]);router[_0x2a79('0x9')](_0x2a79('0xa'),auth['isAuthenticated'](),controller[_0x2a79('0xb')]);router[_0x2a79('0x9')]('/:id',auth[_0x2a79('0x7')](),controller['show']);router['post']('/',auth[_0x2a79('0x7')](),controller['create']);router[_0x2a79('0xc')](_0x2a79('0xd'),auth[_0x2a79('0x7')](),controller[_0x2a79('0xe')]);router[_0x2a79('0xf')](_0x2a79('0xd'),auth[_0x2a79('0x7')](),controller['destroy']);module[_0x2a79('0x10')]=router; \ No newline at end of file +var _0xe2c3=['isAuthenticated','index','describe','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xe2c3,0x1c1));var _0x3e2c=function(_0x45bd84,_0x4a61bb){_0x45bd84=_0x45bd84-0x0;var _0x551b62=_0xe2c3[_0x45bd84];return _0x551b62;};'use strict';var multer=require(_0x3e2c('0x0'));var util=require(_0x3e2c('0x1'));var path=require(_0x3e2c('0x2'));var timeout=require(_0x3e2c('0x3'));var express=require('express');var router=express[_0x3e2c('0x4')]();var fs_extra=require(_0x3e2c('0x5'));var auth=require(_0x3e2c('0x6'));var interaction=require(_0x3e2c('0x7'));var config=require(_0x3e2c('0x8'));var controller=require(_0x3e2c('0x9'));router[_0x3e2c('0xa')]('/',auth[_0x3e2c('0xb')](),controller[_0x3e2c('0xc')]);router[_0x3e2c('0xa')]('/describe',auth[_0x3e2c('0xb')](),controller[_0x3e2c('0xd')]);router[_0x3e2c('0xa')](_0x3e2c('0xe'),auth[_0x3e2c('0xb')](),controller[_0x3e2c('0xf')]);router[_0x3e2c('0x10')]('/',auth[_0x3e2c('0xb')](),controller[_0x3e2c('0x11')]);router['put'](_0x3e2c('0xe'),auth[_0x3e2c('0xb')](),controller['update']);router[_0x3e2c('0x12')](_0x3e2c('0xe'),auth[_0x3e2c('0xb')](),controller['destroy']);module[_0x3e2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c4b5678..a9ac3a9 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 _0x70ab=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x70ab,0x1e1));var _0xb70a=function(_0x4b5a9f,_0x3bbdf0){_0x4b5a9f=_0x4b5a9f-0x0;var _0x53163a=_0x70ab[_0x4b5a9f];return _0x53163a;};'use strict';var Sequelize=require(_0xb70a('0x0'));module[_0xb70a('0x1')]={'name':{'type':Sequelize[_0xb70a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb70a('0x3')](_0xb70a('0x4'),_0xb70a('0x5')),'defaultValue':_0xb70a('0x4')},'selector':{'type':Sequelize[_0xb70a('0x2')]},'timeout':{'type':Sequelize[_0xb70a('0x6')]}}; \ No newline at end of file +var _0xaee1=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x51f2c0,_0xb7c46e){var _0x34ffd5=function(_0x2238c0){while(--_0x2238c0){_0x51f2c0['push'](_0x51f2c0['shift']());}};_0x34ffd5(++_0xb7c46e);}(_0xaee1,0x8a));var _0x1aee=function(_0x583c9c,_0x1cfa5a){_0x583c9c=_0x583c9c-0x0;var _0x3b5d86=_0xaee1[_0x583c9c];return _0x3b5d86;};'use strict';var Sequelize=require(_0x1aee('0x0'));module[_0x1aee('0x1')]={'name':{'type':Sequelize[_0x1aee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1aee('0x3')](_0x1aee('0x4'),_0x1aee('0x5')),'defaultValue':_0x1aee('0x4')},'selector':{'type':Sequelize[_0x1aee('0x2')]},'timeout':{'type':Sequelize[_0x1aee('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9360dc5..e45154a 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 _0x8917=['../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','destroy','then','sendStatus','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x2e9bd9,_0x1c98df){var _0x1bddf6=function(_0x209089){while(--_0x209089){_0x2e9bd9['push'](_0x2e9bd9['shift']());}};_0x1bddf6(++_0x1c98df);}(_0x8917,0x1d7));var _0x7891=function(_0x4d5cf9,_0x44c875){_0x4d5cf9=_0x4d5cf9-0x0;var _0x348451=_0x8917[_0x4d5cf9];return _0x348451;};'use strict';var emlformat=require(_0x7891('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7891('0x1'));var jsonpatch=require(_0x7891('0x2'));var rp=require(_0x7891('0x3'));var moment=require(_0x7891('0x4'));var BPromise=require(_0x7891('0x5'));var Mustache=require(_0x7891('0x6'));var util=require(_0x7891('0x7'));var path=require(_0x7891('0x8'));var sox=require(_0x7891('0x9'));var csv=require('to-csv');var ejs=require(_0x7891('0xa'));var fs=require('fs');var fs_extra=require(_0x7891('0xb'));var _=require(_0x7891('0xc'));var squel=require(_0x7891('0xd'));var crypto=require(_0x7891('0xe'));var jsforce=require(_0x7891('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7891('0x10'));var querystring=require('querystring');var Papa=require(_0x7891('0x11'));var Redis=require(_0x7891('0x12'));var authService=require(_0x7891('0x13'));var qs=require(_0x7891('0x14'));var as=require(_0x7891('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7891('0x16'))(_0x7891('0x17'));var utils=require(_0x7891('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7891('0x19'));var db=require(_0x7891('0x1a'))['db'];function respondWithStatusCode(_0x1a1dbc,_0x31692f){_0x31692f=_0x31692f||0xcc;return function(_0x1b481e){if(_0x1b481e){return _0x1a1dbc['sendStatus'](_0x31692f);}return _0x1a1dbc[_0x7891('0x1b')](_0x31692f)[_0x7891('0x1c')]();};}function respondWithResult(_0x2517f1,_0xc56bc0){_0xc56bc0=_0xc56bc0||0xc8;return function(_0x71e75c){if(_0x71e75c){return _0x2517f1[_0x7891('0x1b')](_0xc56bc0)['json'](_0x71e75c);}};}function respondWithFilteredResult(_0x1fa45b,_0x21a74f){return function(_0x5bfe12){if(_0x5bfe12){var _0x23286b=typeof _0x21a74f[_0x7891('0x1d')]==='undefined'&&typeof _0x21a74f[_0x7891('0x1e')]===_0x7891('0x1f');var _0x250f65=_0x5bfe12[_0x7891('0x20')];var _0x9ff8c2=_0x23286b?0x0:_0x21a74f[_0x7891('0x1d')];var _0x457f50=_0x23286b?_0x5bfe12[_0x7891('0x20')]:_0x21a74f[_0x7891('0x1d')]+_0x21a74f[_0x7891('0x1e')];var _0x20da1e;if(_0x457f50>=_0x250f65){_0x457f50=_0x250f65;_0x20da1e=0xc8;}else{_0x20da1e=0xce;}_0x1fa45b['status'](_0x20da1e);return _0x1fa45b['set'](_0x7891('0x21'),_0x9ff8c2+'-'+_0x457f50+'/'+_0x250f65)[_0x7891('0x22')](_0x5bfe12);}return null;};}function patchUpdates(_0x30b2ae){return function(_0x4c76fe){try{jsonpatch['apply'](_0x4c76fe,_0x30b2ae,!![]);}catch(_0x19a628){return BPromise[_0x7891('0x23')](_0x19a628);}return _0x4c76fe[_0x7891('0x24')]();};}function saveUpdates(_0x36f66a,_0x155a97){return function(_0xf09f20){if(_0xf09f20){return _0xf09f20[_0x7891('0x25')](_0x36f66a)['then'](function(_0x28a917){return _0x28a917;});}return null;};}function removeEntity(_0xab091c,_0x27f2e0){return function(_0x2de356){if(_0x2de356){return _0x2de356[_0x7891('0x26')]()[_0x7891('0x27')](function(){_0xab091c[_0x7891('0x1b')](0xcc)[_0x7891('0x1c')]();});}};}function handleEntityNotFound(_0x24372f,_0x2acda5){return function(_0x55108b){if(!_0x55108b){_0x24372f[_0x7891('0x28')](0x194);}return _0x55108b;};}function handleError(_0x369740,_0x397d03){_0x397d03=_0x397d03||0x1f4;return function(_0x12ed70){logger['error'](_0x12ed70[_0x7891('0x29')]);if(_0x12ed70['name']){delete _0x12ed70[_0x7891('0x2a')];}_0x369740[_0x7891('0x1b')](_0x397d03)[_0x7891('0x2b')](_0x12ed70);};}exports['show']=function(_0x4009f8,_0x1a6bef){var _0x44442f={'raw':!![],'where':{'id':_0x4009f8[_0x7891('0x2c')]['id']}},_0x263f13={};_0x263f13[_0x7891('0x2d')]=_[_0x7891('0x2e')](db['ChatProactiveAction'][_0x7891('0x2f')]);_0x263f13['query']=_[_0x7891('0x2e')](_0x4009f8[_0x7891('0x30')]);_0x263f13[_0x7891('0x31')]=_[_0x7891('0x32')](_0x263f13[_0x7891('0x2d')],_0x263f13[_0x7891('0x30')]);_0x44442f[_0x7891('0x33')]=_['intersection'](_0x263f13[_0x7891('0x2d')],qs[_0x7891('0x34')](_0x4009f8[_0x7891('0x30')][_0x7891('0x34')]));_0x44442f[_0x7891('0x33')]=_0x44442f[_0x7891('0x33')][_0x7891('0x35')]?_0x44442f['attributes']:_0x263f13['model'];if(_0x4009f8['query']['includeAll']){_0x44442f[_0x7891('0x36')]=[{'all':!![]}];}_0x44442f=_[_0x7891('0x37')]({},_0x44442f,_0x4009f8[_0x7891('0x38')]);return db[_0x7891('0x39')][_0x7891('0x3a')](_0x44442f)[_0x7891('0x27')](handleEntityNotFound(_0x1a6bef,null))['then'](respondWithResult(_0x1a6bef,null))[_0x7891('0x3b')](handleError(_0x1a6bef,null));};exports[_0x7891('0x3c')]=function(_0x19e258,_0x2c1c67){return db[_0x7891('0x39')][_0x7891('0x3c')](_0x19e258[_0x7891('0x3d')],{})['then'](respondWithResult(_0x2c1c67,0xc9))[_0x7891('0x3b')](handleError(_0x2c1c67,null));};exports['update']=function(_0x16ca6d,_0x5ba995){if(_0x16ca6d[_0x7891('0x3d')]['id']){delete _0x16ca6d[_0x7891('0x3d')]['id'];}return db[_0x7891('0x39')][_0x7891('0x3a')]({'where':{'id':_0x16ca6d[_0x7891('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5ba995,null))[_0x7891('0x27')](saveUpdates(_0x16ca6d[_0x7891('0x3d')],null))[_0x7891('0x27')](respondWithResult(_0x5ba995,null))[_0x7891('0x3b')](handleError(_0x5ba995,null));};exports[_0x7891('0x26')]=function(_0x516d5c,_0x4e63ee){return db['ChatProactiveAction'][_0x7891('0x3a')]({'where':{'id':_0x516d5c[_0x7891('0x2c')]['id']}})[_0x7891('0x27')](handleEntityNotFound(_0x4e63ee,null))[_0x7891('0x27')](removeEntity(_0x4e63ee,null))[_0x7891('0x3b')](handleError(_0x4e63ee,null));}; \ No newline at end of file +var _0xab36=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0xb3b5ed,_0x386a22){var _0x373859=function(_0x2b71fb){while(--_0x2b71fb){_0xb3b5ed['push'](_0xb3b5ed['shift']());}};_0x373859(++_0x386a22);}(_0xab36,0x1df));var _0x6ab3=function(_0x1b673b,_0x3b3ac0){_0x1b673b=_0x1b673b-0x0;var _0x3ee6f0=_0xab36[_0x1b673b];return _0x3ee6f0;};'use strict';var emlformat=require(_0x6ab3('0x0'));var rimraf=require(_0x6ab3('0x1'));var zipdir=require(_0x6ab3('0x2'));var jsonpatch=require(_0x6ab3('0x3'));var rp=require(_0x6ab3('0x4'));var moment=require('moment');var BPromise=require(_0x6ab3('0x5'));var Mustache=require(_0x6ab3('0x6'));var util=require(_0x6ab3('0x7'));var path=require('path');var sox=require(_0x6ab3('0x8'));var csv=require(_0x6ab3('0x9'));var ejs=require(_0x6ab3('0xa'));var fs=require('fs');var fs_extra=require(_0x6ab3('0xb'));var _=require(_0x6ab3('0xc'));var squel=require(_0x6ab3('0xd'));var crypto=require('crypto');var jsforce=require(_0x6ab3('0xe'));var deskjs=require(_0x6ab3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6ab3('0x10'));var Papa=require('papaparse');var Redis=require(_0x6ab3('0x11'));var authService=require(_0x6ab3('0x12'));var qs=require(_0x6ab3('0x13'));var as=require(_0x6ab3('0x14'));var hardwareService=require(_0x6ab3('0x15'));var logger=require(_0x6ab3('0x16'))('api');var utils=require(_0x6ab3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6ab3('0x18'));var db=require(_0x6ab3('0x19'))['db'];function respondWithStatusCode(_0x183508,_0x2fe47b){_0x2fe47b=_0x2fe47b||0xcc;return function(_0x23d0ae){if(_0x23d0ae){return _0x183508['sendStatus'](_0x2fe47b);}return _0x183508[_0x6ab3('0x1a')](_0x2fe47b)[_0x6ab3('0x1b')]();};}function respondWithResult(_0x32acd8,_0x313481){_0x313481=_0x313481||0xc8;return function(_0x1412c2){if(_0x1412c2){return _0x32acd8['status'](_0x313481)[_0x6ab3('0x1c')](_0x1412c2);}};}function respondWithFilteredResult(_0x51a0c4,_0x246b5b){return function(_0x27595a){if(_0x27595a){var _0xc20d35=typeof _0x246b5b[_0x6ab3('0x1d')]===_0x6ab3('0x1e')&&typeof _0x246b5b[_0x6ab3('0x1f')]===_0x6ab3('0x1e');var _0xfa65b4=_0x27595a[_0x6ab3('0x20')];var _0x586dcb=_0xc20d35?0x0:_0x246b5b[_0x6ab3('0x1d')];var _0x5db46c=_0xc20d35?_0x27595a[_0x6ab3('0x20')]:_0x246b5b[_0x6ab3('0x1d')]+_0x246b5b[_0x6ab3('0x1f')];var _0x2c1b52;if(_0x5db46c>=_0xfa65b4){_0x5db46c=_0xfa65b4;_0x2c1b52=0xc8;}else{_0x2c1b52=0xce;}_0x51a0c4[_0x6ab3('0x1a')](_0x2c1b52);return _0x51a0c4[_0x6ab3('0x21')](_0x6ab3('0x22'),_0x586dcb+'-'+_0x5db46c+'/'+_0xfa65b4)['json'](_0x27595a);}return null;};}function patchUpdates(_0x253bb2){return function(_0x22b143){try{jsonpatch[_0x6ab3('0x23')](_0x22b143,_0x253bb2,!![]);}catch(_0x4cb92c){return BPromise[_0x6ab3('0x24')](_0x4cb92c);}return _0x22b143['save']();};}function saveUpdates(_0x4bf937,_0x1ac3c6){return function(_0x4e6680){if(_0x4e6680){return _0x4e6680[_0x6ab3('0x25')](_0x4bf937)[_0x6ab3('0x26')](function(_0x30aec0){return _0x30aec0;});}return null;};}function removeEntity(_0x1f0579,_0x344e9f){return function(_0x30af9e){if(_0x30af9e){return _0x30af9e[_0x6ab3('0x27')]()[_0x6ab3('0x26')](function(){_0x1f0579[_0x6ab3('0x1a')](0xcc)[_0x6ab3('0x1b')]();});}};}function handleEntityNotFound(_0x16cfb2,_0x1284d8){return function(_0x10d362){if(!_0x10d362){_0x16cfb2[_0x6ab3('0x28')](0x194);}return _0x10d362;};}function handleError(_0x5d75f6,_0x23cb5b){_0x23cb5b=_0x23cb5b||0x1f4;return function(_0x554cf0){logger[_0x6ab3('0x29')](_0x554cf0[_0x6ab3('0x2a')]);if(_0x554cf0[_0x6ab3('0x2b')]){delete _0x554cf0[_0x6ab3('0x2b')];}_0x5d75f6[_0x6ab3('0x1a')](_0x23cb5b)[_0x6ab3('0x2c')](_0x554cf0);};}exports['show']=function(_0x5b5647,_0x365edb){var _0x57c04b={'raw':!![],'where':{'id':_0x5b5647[_0x6ab3('0x2d')]['id']}},_0x5370d7={};_0x5370d7[_0x6ab3('0x2e')]=_[_0x6ab3('0x2f')](db[_0x6ab3('0x30')][_0x6ab3('0x31')]);_0x5370d7[_0x6ab3('0x32')]=_[_0x6ab3('0x2f')](_0x5b5647[_0x6ab3('0x32')]);_0x5370d7['filters']=_[_0x6ab3('0x33')](_0x5370d7[_0x6ab3('0x2e')],_0x5370d7[_0x6ab3('0x32')]);_0x57c04b[_0x6ab3('0x34')]=_[_0x6ab3('0x33')](_0x5370d7[_0x6ab3('0x2e')],qs[_0x6ab3('0x35')](_0x5b5647[_0x6ab3('0x32')]['fields']));_0x57c04b[_0x6ab3('0x34')]=_0x57c04b['attributes']['length']?_0x57c04b[_0x6ab3('0x34')]:_0x5370d7['model'];if(_0x5b5647[_0x6ab3('0x32')][_0x6ab3('0x36')]){_0x57c04b[_0x6ab3('0x37')]=[{'all':!![]}];}_0x57c04b=_[_0x6ab3('0x38')]({},_0x57c04b,_0x5b5647[_0x6ab3('0x39')]);return db[_0x6ab3('0x30')][_0x6ab3('0x3a')](_0x57c04b)[_0x6ab3('0x26')](handleEntityNotFound(_0x365edb,null))[_0x6ab3('0x26')](respondWithResult(_0x365edb,null))[_0x6ab3('0x3b')](handleError(_0x365edb,null));};exports[_0x6ab3('0x3c')]=function(_0x22e39a,_0xdfe14b){return db[_0x6ab3('0x30')]['create'](_0x22e39a[_0x6ab3('0x3d')],{})[_0x6ab3('0x26')](respondWithResult(_0xdfe14b,0xc9))[_0x6ab3('0x3b')](handleError(_0xdfe14b,null));};exports[_0x6ab3('0x25')]=function(_0x315c99,_0xd70937){if(_0x315c99['body']['id']){delete _0x315c99[_0x6ab3('0x3d')]['id'];}return db['ChatProactiveAction'][_0x6ab3('0x3a')]({'where':{'id':_0x315c99[_0x6ab3('0x2d')]['id']}})['then'](handleEntityNotFound(_0xd70937,null))[_0x6ab3('0x26')](saveUpdates(_0x315c99[_0x6ab3('0x3d')],null))['then'](respondWithResult(_0xd70937,null))['catch'](handleError(_0xd70937,null));};exports[_0x6ab3('0x27')]=function(_0x4a3988,_0x2ec0c7){return db[_0x6ab3('0x30')]['find']({'where':{'id':_0x4a3988['params']['id']}})[_0x6ab3('0x26')](handleEntityNotFound(_0x2ec0c7,null))[_0x6ab3('0x26')](removeEntity(_0x2ec0c7,null))['catch'](handleError(_0x2ec0c7,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 72fdd05..681b57d 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 _0x9ff3=['exports','define','chat_proactive_actions','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x9ff3,0x159));var _0x39ff=function(_0x451680,_0x9187d8){_0x451680=_0x451680-0x0;var _0x1ba454=_0x9ff3[_0x451680];return _0x1ba454;};'use strict';var _=require('lodash');var util=require(_0x39ff('0x0'));var logger=require(_0x39ff('0x1'))('api');var moment=require('moment');var BPromise=require(_0x39ff('0x2'));var rp=require(_0x39ff('0x3'));var fs=require('fs');var path=require(_0x39ff('0x4'));var rimraf=require(_0x39ff('0x5'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x39ff('0x6')]=function(_0x1c3d09,_0x48c1fa){return _0x1c3d09[_0x39ff('0x7')]('ChatProactiveAction',attributes,{'tableName':_0x39ff('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22f0=['api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x1ec8b7,_0x1d1b94){var _0x281722=function(_0x556075){while(--_0x556075){_0x1ec8b7['push'](_0x1ec8b7['shift']());}};_0x281722(++_0x1d1b94);}(_0x22f0,0xf9));var _0x022f=function(_0x2c6a9c,_0x244ed9){_0x2c6a9c=_0x2c6a9c-0x0;var _0x21591f=_0x22f0[_0x2c6a9c];return _0x21591f;};'use strict';var _=require(_0x022f('0x0'));var util=require(_0x022f('0x1'));var logger=require(_0x022f('0x2'))(_0x022f('0x3'));var moment=require(_0x022f('0x4'));var BPromise=require('bluebird');var rp=require(_0x022f('0x5'));var fs=require('fs');var path=require(_0x022f('0x6'));var rimraf=require(_0x022f('0x7'));var config=require(_0x022f('0x8'));var attributes=require(_0x022f('0x9'));module[_0x022f('0xa')]=function(_0x1ad02f,_0x10f4bd){return _0x1ad02f[_0x022f('0xb')](_0x022f('0xc'),attributes,{'tableName':_0x022f('0xd'),'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 cbacfc8..7146693 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 _0x5e36=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x5e36,0x97));var _0x65e3=function(_0x32b5d2,_0x6c38e6){_0x32b5d2=_0x32b5d2-0x0;var _0x43e2ec=_0x5e36[_0x32b5d2];return _0x43e2ec;};'use strict';var _=require(_0x65e3('0x0'));var util=require(_0x65e3('0x1'));var moment=require(_0x65e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x65e3('0x3'));var fs=require('fs');var Redis=require(_0x65e3('0x4'));var db=require(_0x65e3('0x5'))['db'];var utils=require(_0x65e3('0x6'));var logger=require(_0x65e3('0x7'))(_0x65e3('0x8'));var config=require(_0x65e3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x65e3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e7385,_0x4a7bf3,_0x2d64f9){return new BPromise(function(_0x1ea9ac,_0x391f0d){return client[_0x65e3('0xb')](_0x3e7385,_0x2d64f9)[_0x65e3('0xc')](function(_0x1c3ba1){logger[_0x65e3('0xd')](_0x65e3('0xe'),_0x4a7bf3,_0x65e3('0xf'));logger[_0x65e3('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4a7bf3,_0x65e3('0xf'),JSON[_0x65e3('0x11')](_0x1c3ba1));if(_0x1c3ba1[_0x65e3('0x12')]){if(_0x1c3ba1[_0x65e3('0x12')][_0x65e3('0x13')]===0x1f4){logger['error'](_0x65e3('0xe'),_0x4a7bf3,_0x1c3ba1[_0x65e3('0x12')]['message']);return _0x391f0d(_0x1c3ba1[_0x65e3('0x12')][_0x65e3('0x14')]);}logger[_0x65e3('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x4a7bf3,_0x1c3ba1['error'][_0x65e3('0x14')]);return _0x1ea9ac(_0x1c3ba1[_0x65e3('0x12')][_0x65e3('0x14')]);}else{logger[_0x65e3('0xd')](_0x65e3('0xe'),_0x4a7bf3,'request\x20sent');_0x1ea9ac(_0x1c3ba1['result'][_0x65e3('0x14')]);}})[_0x65e3('0x15')](function(_0x3165b2){logger[_0x65e3('0x12')](_0x65e3('0xe'),_0x4a7bf3,_0x3165b2);_0x391f0d(_0x3165b2);});});} \ No newline at end of file +var _0xa117=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','lodash','util'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xa117,0x11c));var _0x7a11=function(_0x348567,_0x151fc1){_0x348567=_0x348567-0x0;var _0x2deeef=_0xa117[_0x348567];return _0x2deeef;};'use strict';var _=require(_0x7a11('0x0'));var util=require(_0x7a11('0x1'));var moment=require(_0x7a11('0x2'));var BPromise=require(_0x7a11('0x3'));var rs=require(_0x7a11('0x4'));var fs=require('fs');var Redis=require(_0x7a11('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a11('0x6'));var logger=require(_0x7a11('0x7'))(_0x7a11('0x8'));var config=require(_0x7a11('0x9'));var jayson=require(_0x7a11('0xa'));var client=jayson['client'][_0x7a11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x385b18,_0x41306b,_0x5814bc){return new BPromise(function(_0x4879df,_0x276463){return client['request'](_0x385b18,_0x5814bc)[_0x7a11('0xc')](function(_0x44a722){logger[_0x7a11('0xd')](_0x7a11('0xe'),_0x41306b,'request\x20sent');logger[_0x7a11('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x41306b,'request\x20sent',JSON[_0x7a11('0x10')](_0x44a722));if(_0x44a722['error']){if(_0x44a722[_0x7a11('0x11')][_0x7a11('0x12')]===0x1f4){logger[_0x7a11('0x11')](_0x7a11('0xe'),_0x41306b,_0x44a722[_0x7a11('0x11')]['message']);return _0x276463(_0x44a722[_0x7a11('0x11')][_0x7a11('0x13')]);}logger[_0x7a11('0x11')](_0x7a11('0xe'),_0x41306b,_0x44a722['error'][_0x7a11('0x13')]);return _0x4879df(_0x44a722[_0x7a11('0x11')][_0x7a11('0x13')]);}else{logger[_0x7a11('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x41306b,_0x7a11('0x14'));_0x4879df(_0x44a722[_0x7a11('0x15')][_0x7a11('0x13')]);}})['catch'](function(_0x4e3818){logger[_0x7a11('0x11')](_0x7a11('0xe'),_0x41306b,_0x4e3818);_0x276463(_0x4e3818);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 30be541..f71d08d 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 _0xf2ca=['show','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x3eb6d1,_0x25131d){var _0x68df02=function(_0x20e40a){while(--_0x20e40a){_0x3eb6d1['push'](_0x3eb6d1['shift']());}};_0x68df02(++_0x25131d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x565faf,_0x5f3718){_0x565faf=_0x565faf-0x0;var _0x42292f=_0xf2ca[_0x565faf];return _0x42292f;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xaf2c('0x9')](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xd')]);router['put'](_0xaf2c('0xa'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['delete'](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xf')]);module[_0xaf2c('0x10')]=router; \ No newline at end of file +var _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5b449b,_0x5fdca9){_0x5b449b=_0x5b449b-0x0;var _0x43660a=_0xb4c7[_0x5b449b];return _0x43660a;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 9b17191..7cc356b 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 _0x8a44=['roundrobin','sequelize','STRING','name','rrmemory','beepall'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x8a44,0x18d));var _0x48a4=function(_0x3f7815,_0x362d63){_0x3f7815=_0x3f7815-0x0;var _0x31ab67=_0x8a44[_0x3f7815];return _0x31ab67;};'use strict';var Sequelize=require(_0x48a4('0x0'));module['exports']={'name':{'type':Sequelize[_0x48a4('0x1')],'unique':_0x48a4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x48a4('0x3'),_0x48a4('0x4'),_0x48a4('0x5'))}}; \ No newline at end of file +var _0xeac8=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x13c304,_0x4791de){var _0x12696e=function(_0x2070d4){while(--_0x2070d4){_0x13c304['push'](_0x13c304['shift']());}};_0x12696e(++_0x4791de);}(_0xeac8,0x1d6));var _0x8eac=function(_0x2e8496,_0xa4934a){_0x2e8496=_0x2e8496-0x0;var _0x31979b=_0xeac8[_0x2e8496];return _0x31979b;};'use strict';var Sequelize=require(_0x8eac('0x0'));module[_0x8eac('0x1')]={'name':{'type':Sequelize[_0x8eac('0x2')],'unique':_0x8eac('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8eac('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8eac('0x4')](_0x8eac('0x5'),_0x8eac('0x6'),_0x8eac('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4129ce6..1b56e4f 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 _0x76eb=['select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','union','value','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','util','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','get','ChatQueues','UserProfileResource','end','error','stack','name','send','index','map','ChatQueue','type','key','getOptions','where','include','findAll','rows','show','model','keys','rawAttributes','filters','query','attributes','fields','length','includeAll','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserChatQueue','intersection','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','SIP','getTeams','Team','options','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams'];(function(_0x31c183,_0x3aa6eb){var _0x48e56c=function(_0x1d01fa){while(--_0x1d01fa){_0x31c183['push'](_0x31c183['shift']());}};_0x48e56c(++_0x3aa6eb);}(_0x76eb,0x176));var _0xb76e=function(_0x35ebae,_0x4f86c4){_0x35ebae=_0x35ebae-0x0;var _0x1924cf=_0x76eb[_0x35ebae];return _0x1924cf;};'use strict';var BPromise=require('bluebird');var util=require(_0xb76e('0x0'));var _=require(_0xb76e('0x1'));var squel=require('squel');var Redis=require(_0xb76e('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xb76e('0x3'))(_0xb76e('0x4'));var config=require(_0xb76e('0x5'));var db=require(_0xb76e('0x6'))['db'];config['redis']=_[_0xb76e('0x7')](config[_0xb76e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb76e('0x9'))(new Redis(config[_0xb76e('0x8')]));require('./chatQueue.socket')[_0xb76e('0xa')](socket);function respondWithStatusCode(_0x59e14a,_0x530ea5){_0x530ea5=_0x530ea5||0xcc;return function(_0x55dc2a){if(_0x55dc2a){return _0x59e14a[_0xb76e('0xb')](_0x530ea5);}return _0x59e14a['status'](_0x530ea5)['end']();};}function respondWithResult(_0x5078f5,_0x35f6b0){_0x35f6b0=_0x35f6b0||0xc8;return function(_0x5ca6da){if(_0x5ca6da){return _0x5078f5[_0xb76e('0xc')](_0x35f6b0)[_0xb76e('0xd')](_0x5ca6da);}};}function respondWithFilteredResult(_0x5bb31e,_0x8b0b1e){return function(_0x2e656f){if(_0x2e656f){var _0x47ecf9=typeof _0x8b0b1e[_0xb76e('0xe')]==='undefined'&&typeof _0x8b0b1e[_0xb76e('0xf')]===_0xb76e('0x10');var _0x2dcb7f=_0x2e656f[_0xb76e('0x11')];var _0x509272=_0x47ecf9?0x0:_0x8b0b1e[_0xb76e('0xe')];var _0x325d8c=_0x47ecf9?_0x2e656f['count']:_0x8b0b1e['offset']+_0x8b0b1e['limit'];var _0xbc6184;if(_0x325d8c>=_0x2dcb7f){_0x325d8c=_0x2dcb7f;_0xbc6184=0xc8;}else{_0xbc6184=0xce;}_0x5bb31e[_0xb76e('0xc')](_0xbc6184);return _0x5bb31e[_0xb76e('0x12')](_0xb76e('0x13'),_0x509272+'-'+_0x325d8c+'/'+_0x2dcb7f)[_0xb76e('0xd')](_0x2e656f);}return null;};}function saveUpdates(_0x44c3cb){return function(_0x3d131b){if(_0x3d131b){return _0x3d131b['update'](_0x44c3cb)[_0xb76e('0x14')](function(_0x4e56a4){return _0x4e56a4;});}return null;};}function removeEntity(_0x5ba985){return function(_0x30896f){if(_0x30896f){return _0x30896f[_0xb76e('0x15')]()[_0xb76e('0x14')](function(){var _0x22e5a0=_0x30896f[_0xb76e('0x16')]({'plain':!![]});var _0x1a2c3c=_0xb76e('0x17');return db[_0xb76e('0x18')][_0xb76e('0x15')]({'where':{'type':_0x1a2c3c,'resourceId':_0x22e5a0['id']}})[_0xb76e('0x14')](function(){return _0x30896f;});})[_0xb76e('0x14')](function(){_0x5ba985['status'](0xcc)[_0xb76e('0x19')]();});}};}function handleEntityNotFound(_0x5d7207){return function(_0x1ddf97){if(!_0x1ddf97){_0x5d7207[_0xb76e('0xb')](0x194);}return _0x1ddf97;};}function handleError(_0x89f626,_0x429441){_0x429441=_0x429441||0x1f4;return function(_0x361712){logger[_0xb76e('0x1a')](_0x361712[_0xb76e('0x1b')]);if(_0x361712[_0xb76e('0x1c')]){delete _0x361712['name'];}_0x89f626[_0xb76e('0xc')](_0x429441)[_0xb76e('0x1d')](_0x361712);};}exports[_0xb76e('0x1e')]=function(_0x58ff59,_0x33344){var _0x1419c8={};var _0x265e4e={'count':0x0,'rows':[]};var _0x50e21e=_[_0xb76e('0x1f')](db[_0xb76e('0x20')]['rawAttributes'],function(_0x7ba9ba){return{'name':_0x7ba9ba['fieldName'],'type':_0x7ba9ba[_0xb76e('0x21')][_0xb76e('0x22')]};});_0x1419c8=qs[_0xb76e('0x23')](_0x50e21e,_0x58ff59);var _0x13c832={'where':_0x1419c8[_0xb76e('0x24')]};return db[_0xb76e('0x20')][_0xb76e('0x11')](_0x13c832)[_0xb76e('0x14')](function(_0x11cc48){_0x265e4e['count']=_0x11cc48;_0x1419c8[_0xb76e('0x25')]=qs[_0xb76e('0x25')](_0x58ff59['query']);return db[_0xb76e('0x20')][_0xb76e('0x26')](_0x1419c8);})[_0xb76e('0x14')](function(_0x33719b){_0x265e4e[_0xb76e('0x27')]=_0x33719b;return _0x265e4e;})['then'](respondWithFilteredResult(_0x33344,_0x1419c8))['catch'](handleError(_0x33344,null));};exports[_0xb76e('0x28')]=function(_0x31cbb0,_0x493680){var _0x18a642={'raw':!![],'where':{'id':_0x31cbb0['params']['id']}},_0x1d063a={};_0x1d063a[_0xb76e('0x29')]=_[_0xb76e('0x2a')](db[_0xb76e('0x20')][_0xb76e('0x2b')]);_0x1d063a['query']=_[_0xb76e('0x2a')](_0x31cbb0['query']);_0x1d063a[_0xb76e('0x2c')]=_['intersection'](_0x1d063a[_0xb76e('0x29')],_0x1d063a[_0xb76e('0x2d')]);_0x18a642[_0xb76e('0x2e')]=_['intersection'](_0x1d063a[_0xb76e('0x29')],qs['fields'](_0x31cbb0[_0xb76e('0x2d')][_0xb76e('0x2f')]));_0x18a642[_0xb76e('0x2e')]=_0x18a642['attributes'][_0xb76e('0x30')]?_0x18a642[_0xb76e('0x2e')]:_0x1d063a[_0xb76e('0x29')];if(_0x31cbb0[_0xb76e('0x2d')][_0xb76e('0x31')]){_0x18a642[_0xb76e('0x25')]=[{'all':!![]}];}_0x18a642=_[_0xb76e('0x32')]({},_0x18a642,_0x31cbb0['options']);return db[_0xb76e('0x20')][_0xb76e('0x33')](_0x18a642)[_0xb76e('0x14')](handleEntityNotFound(_0x493680,null))[_0xb76e('0x14')](respondWithResult(_0x493680,null))[_0xb76e('0x34')](handleError(_0x493680,null));};exports[_0xb76e('0x35')]=function(_0x162568,_0x183a51){return db['ChatQueue'][_0xb76e('0x35')](_0x162568[_0xb76e('0x36')],{})[_0xb76e('0x14')](function(_0x49c01a){var _0x2a52d0=_0x162568['user'][_0xb76e('0x16')]({'plain':!![]});if(!_0x2a52d0)throw new Error(_0xb76e('0x37'));if(_0x2a52d0[_0xb76e('0x38')]===_0xb76e('0x39')){var _0x23d9d1=_0x49c01a['get']({'plain':!![]});var _0x4a08d8=_0xb76e('0x17');return db['UserProfileSection'][_0xb76e('0x33')]({'where':{'name':_0x4a08d8,'userProfileId':_0x2a52d0[_0xb76e('0x3a')]},'raw':!![]})['then'](function(_0x235e25){if(_0x235e25&&_0x235e25[_0xb76e('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0x23d9d1[_0xb76e('0x1c')],'resourceId':_0x23d9d1['id'],'type':_0x235e25['name'],'sectionId':_0x235e25['id']},{})[_0xb76e('0x14')](function(){return _0x49c01a;});}else{return _0x49c01a;}})[_0xb76e('0x34')](function(_0xeb3b63){logger[_0xb76e('0x1a')](_0xb76e('0x3c'),_0xeb3b63);throw _0xeb3b63;});}return _0x49c01a;})[_0xb76e('0x14')](respondWithResult(_0x183a51,0xc9))[_0xb76e('0x34')](handleError(_0x183a51,null));};exports[_0xb76e('0x3d')]=function(_0xc39912,_0xc97790){if(_0xc39912[_0xb76e('0x36')]['id']){delete _0xc39912[_0xb76e('0x36')]['id'];}return db[_0xb76e('0x20')][_0xb76e('0x33')]({'where':{'id':_0xc39912[_0xb76e('0x3e')]['id']}})['then'](handleEntityNotFound(_0xc97790,null))[_0xb76e('0x14')](saveUpdates(_0xc39912['body'],null))['then'](respondWithResult(_0xc97790,null))['catch'](handleError(_0xc97790,null));};exports[_0xb76e('0x15')]=function(_0x295101,_0x5b8936){return db['ChatQueue']['find']({'where':{'id':_0x295101['params']['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x5b8936,null))[_0xb76e('0x14')](removeEntity(_0x5b8936,null))[_0xb76e('0x34')](handleError(_0x5b8936,null));};exports[_0xb76e('0x3f')]=function(_0x35a90f,_0x435c00){return db[_0xb76e('0x20')][_0xb76e('0x3f')]()[_0xb76e('0x14')](respondWithResult(_0x435c00,null))[_0xb76e('0x34')](handleError(_0x435c00,null));};exports[_0xb76e('0x40')]=function(_0xb70b4b,_0x386883){var _0x1f3db6={'raw':!![],'where':{}},_0xae27cc={},_0x3c517f;return db[_0xb76e('0x20')][_0xb76e('0x41')]({'where':{'id':_0xb70b4b[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x386883,null))[_0xb76e('0x14')](function(_0x1a2d0d){if(_0x1a2d0d){_0x3c517f=_0x1a2d0d[_0xb76e('0x16')]({'plain':!![]});_0xae27cc[_0xb76e('0x29')]=_[_0xb76e('0x2a')](db[_0xb76e('0x42')][_0xb76e('0x2b')]);_0xae27cc[_0xb76e('0x2d')]=_[_0xb76e('0x2a')](_0xb70b4b[_0xb76e('0x2d')]);_0xae27cc[_0xb76e('0x2c')]=_[_0xb76e('0x43')](_0xae27cc[_0xb76e('0x29')],_0xae27cc[_0xb76e('0x2d')]);_0x1f3db6[_0xb76e('0x2e')]=_[_0xb76e('0x43')](_0xae27cc['model'],qs['fields'](_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x2f')]));_0x1f3db6[_0xb76e('0x2e')]=_0x1f3db6[_0xb76e('0x2e')][_0xb76e('0x30')]?_0x1f3db6[_0xb76e('0x2e')]:_0xae27cc[_0xb76e('0x29')];if(!_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x44')](_0xb76e('0x45'))){_0x1f3db6[_0xb76e('0xf')]=qs['limit'](_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0xf')]);_0x1f3db6[_0xb76e('0xe')]=qs[_0xb76e('0xe')](_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0xe')]);}_0x1f3db6[_0xb76e('0x46')]=qs[_0xb76e('0x47')](_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x47')]);_0x1f3db6['where']=qs[_0xb76e('0x2c')](_[_0xb76e('0x48')](_0xb70b4b[_0xb76e('0x2d')],_0xae27cc[_0xb76e('0x2c')]));_0x1f3db6[_0xb76e('0x24')]['ChatQueueId']=_0x1a2d0d['id'];if(_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x49')]){_0x1f3db6[_0xb76e('0x24')]=_[_0xb76e('0x32')](_0x1f3db6['where'],{'$or':_[_0xb76e('0x1f')](_0x1f3db6['attributes'],function(_0x4d6cb4){var _0x1829a5={};_0x1829a5[_0x4d6cb4]={'$like':'%'+_0xb70b4b[_0xb76e('0x2d')][_0xb76e('0x49')]+'%'};return _0x1829a5;})});}_0x1f3db6=_[_0xb76e('0x32')]({},_0x1f3db6,_0xb70b4b['options']);return db[_0xb76e('0x42')]['findAll'](_0x1f3db6);}})[_0xb76e('0x14')](function(_0x5bd484){if(_0x5bd484){return db[_0xb76e('0x4a')][_0xb76e('0x4b')]({'where':{'id':_[_0xb76e('0x1f')](_0x5bd484,'UserId'),'role':_0xb76e('0x4c')},'attributes':['id','name',_0xb76e('0x4d'),_0xb76e('0x4e'),_0xb76e('0x4f')]});}})[_0xb76e('0x14')](function(_0x3bc75b){if(_0x3bc75b){return{'count':_0x3bc75b['count'],'rows':_[_0xb76e('0x1f')](_0x3bc75b[_0xb76e('0x27')],function(_0x2dcc91){return{'membername':_0x2dcc91['name'],'UserId':_0x2dcc91['id'],'queue_name':_0x3c517f['name'],'ChatQueueId':_0x3c517f['id'],'interface':util['format']('%s/%s',_0xb76e('0x50'),_0x2dcc91[_0xb76e('0x1c')]),'penalty':0x0,'paused':_0x2dcc91[_0xb76e('0x4d')],'createdAt':_0x2dcc91[_0xb76e('0x4f')],'updatedAt':_0x2dcc91[_0xb76e('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb76e('0x14')](respondWithFilteredResult(_0x386883,_0x1f3db6))[_0xb76e('0x34')](handleError(_0x386883,null));};exports[_0xb76e('0x51')]=function(_0x10c198,_0xa849d6){var _0x1e12f5={};var _0x36f5f3={};var _0x11bead;var _0x35feeb;return db[_0xb76e('0x20')][_0xb76e('0x41')]({'where':{'id':_0x10c198[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0xa849d6,null))['then'](function(_0x1cf5e7){if(_0x1cf5e7){_0x11bead=_0x1cf5e7;_0x36f5f3[_0xb76e('0x29')]=_[_0xb76e('0x2a')](db[_0xb76e('0x52')]['rawAttributes']);_0x36f5f3['query']=_[_0xb76e('0x2a')](_0x10c198[_0xb76e('0x2d')]);_0x36f5f3['filters']=_[_0xb76e('0x43')](_0x36f5f3[_0xb76e('0x29')],_0x36f5f3['query']);_0x1e12f5['attributes']=_[_0xb76e('0x43')](_0x36f5f3[_0xb76e('0x29')],qs['fields'](_0x10c198[_0xb76e('0x2d')]['fields']));_0x1e12f5['attributes']=_0x1e12f5[_0xb76e('0x2e')][_0xb76e('0x30')]?_0x1e12f5[_0xb76e('0x2e')]:_0x36f5f3[_0xb76e('0x29')];_0x1e12f5[_0xb76e('0x46')]=qs[_0xb76e('0x47')](_0x10c198[_0xb76e('0x2d')][_0xb76e('0x47')]);_0x1e12f5[_0xb76e('0x24')]=qs[_0xb76e('0x2c')](_[_0xb76e('0x48')](_0x10c198['query'],_0x36f5f3[_0xb76e('0x2c')]));if(_0x10c198[_0xb76e('0x2d')][_0xb76e('0x49')]){_0x1e12f5['where']=_['merge'](_0x1e12f5['where'],{'$or':_[_0xb76e('0x1f')](_0x1e12f5[_0xb76e('0x2e')],function(_0x834b6c){var _0x25bc1e={};_0x25bc1e[_0x834b6c]={'$like':'%'+_0x10c198['query']['filter']+'%'};return _0x25bc1e;})});}_0x1e12f5=_[_0xb76e('0x32')]({},_0x1e12f5,_0x10c198[_0xb76e('0x53')]);return _0x11bead[_0xb76e('0x51')](_0x1e12f5);}})['then'](function(_0x42bc8f){if(_0x42bc8f){_0x35feeb=_0x42bc8f['length'];if(!_0x10c198[_0xb76e('0x2d')]['hasOwnProperty'](_0xb76e('0x45'))){_0x1e12f5[_0xb76e('0xf')]=qs[_0xb76e('0xf')](_0x10c198[_0xb76e('0x2d')][_0xb76e('0xf')]);_0x1e12f5[_0xb76e('0xe')]=qs[_0xb76e('0xe')](_0x10c198[_0xb76e('0x2d')][_0xb76e('0xe')]);}return _0x11bead['getTeams'](_0x1e12f5);}})[_0xb76e('0x14')](function(_0x5ab5f0){if(_0x5ab5f0){return _0x5ab5f0?{'count':_0x35feeb,'rows':_0x5ab5f0}:null;}})[_0xb76e('0x14')](respondWithResult(_0xa849d6,null))[_0xb76e('0x34')](handleError(_0xa849d6,null));};exports[_0xb76e('0x54')]=function(_0x46c0d1,_0x31307d){var _0x389f42=_0x46c0d1[_0xb76e('0x36')][_0xb76e('0x55')];return db[_0xb76e('0x52')][_0xb76e('0x26')]({'where':{'id':_0x389f42},'attributes':['id'],'include':[{'model':db[_0xb76e('0x4a')],'as':_0xb76e('0x56'),'attributes':['id',_0xb76e('0x1c'),_0xb76e('0x57'),_0xb76e('0x58'),_0xb76e('0x59')],'raw':!![]}]})[_0xb76e('0x14')](function(_0xed0b45){if(_0xed0b45){var _0x357851=_[_0xb76e('0x5a')](_0xed0b45,function(_0x414682){var _0x5480af=_0x414682[_0xb76e('0x16')]({'plain':!![]});return _0x5480af['Agents'];});return db[_0xb76e('0x20')][_0xb76e('0x33')]({'where':{'id':_0x46c0d1[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](function(_0x202b7a){return db[_0xb76e('0x5b')][_0xb76e('0x5c')](function(_0x35f0e1){return _0x202b7a[_0xb76e('0x54')](_0x389f42,{'transaction':_0x35f0e1})[_0xb76e('0x14')](function(){return BPromise['each'](_0x357851,function(_0xb305d2){return db[_0xb76e('0x42')][_0xb76e('0x5d')]({'where':{'UserId':_0xb305d2['id'],'ChatQueueId':_0x46c0d1[_0xb76e('0x3e')]['id']},'transaction':_0x35f0e1});});})[_0xb76e('0x14')](function(){_0x357851[_0xb76e('0x5e')](function(_0x110ce1){socket[_0xb76e('0x5f')](_0xb76e('0x60'),{'UserId':_0x110ce1['id'],'ChatQueueId':_0x202b7a['id']});});});});});}})[_0xb76e('0x14')](respondWithStatusCode(_0x31307d,null))[_0xb76e('0x34')](handleError(_0x31307d,null));};exports[_0xb76e('0x61')]=function(_0x33589c,_0x3be4d6){return db[_0xb76e('0x52')][_0xb76e('0x26')]({'where':{'id':_0x33589c['query'][_0xb76e('0x55')]},'attributes':['id'],'include':[{'model':db[_0xb76e('0x4a')],'as':_0xb76e('0x56'),'attributes':['id'],'raw':!![]}]})[_0xb76e('0x14')](handleEntityNotFound(_0x3be4d6,null))[_0xb76e('0x14')](function(_0x4cefa9){var _0x23a3ce=_[_0xb76e('0x1f')](_0x4cefa9,'id');var _0x1e018f=[];var _0x51aa44=[];var _0x1d40f8=squel[_0xb76e('0x62')]();_0x1d40f8[_0xb76e('0x63')](_0xb76e('0x64'))['from'](_0xb76e('0x65'),'tq')[_0xb76e('0x66')](_0xb76e('0x67'),'ut',_0xb76e('0x68'))['where'](_0xb76e('0x69'),_0x33589c[_0xb76e('0x3e')]['id']);for(var _0x4a6e44=0x0;_0x4a6e44<_0x4cefa9['length'];_0x4a6e44+=0x1){let _0x3d5492=_0x4cefa9[_0x4a6e44];for(var _0x3d5143=0x0;_0x3d5143<_0x3d5492['Agents'][_0xb76e('0x30')];_0x3d5143+=0x1){let _0x2b672c=_0x3d5492[_0xb76e('0x56')][_0x3d5143];var _0x4adde5=_0x1d40f8['clone']();_0x4adde5[_0xb76e('0x24')](_0xb76e('0x6a'),_0x2b672c['id']);_0x51aa44[_0xb76e('0x6b')](db[_0xb76e('0x5b')][_0xb76e('0x2d')](_0x4adde5[_0xb76e('0x6c')](),{'type':db[_0xb76e('0x5b')][_0xb76e('0x6d')]['SELECT']})[_0xb76e('0x14')](function(_0x2b3d17){if(_0x2b3d17[_0xb76e('0x30')]===0x1){return _0x2b672c['id'];}else{var _0xefd865=_['every'](_[_0xb76e('0x1f')](_0x2b3d17,'TeamId'),function(_0xf977b8){return _['includes'](_0x23a3ce,_0xf977b8);});if(_0xefd865){return _0x2b672c['id'];}}}));}}return BPromise['all'](_0x51aa44)[_0xb76e('0x14')](function(_0x4a8ba3){_0x1e018f=_(_0x1e018f)[_0xb76e('0x6e')](_0x4a8ba3)['compact']()[_0xb76e('0x6f')]();return db['ChatQueue'][_0xb76e('0x33')]({'where':{'id':_0x33589c[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](function(_0x163b60){return db['sequelize'][_0xb76e('0x5c')](function(_0x25c28e){return _0x163b60[_0xb76e('0x61')](_0x33589c[_0xb76e('0x2d')][_0xb76e('0x55')],{'transaction':_0x25c28e})[_0xb76e('0x14')](function(){if(!_['isEmpty'](_0x1e018f)){return _0x163b60[_0xb76e('0x70')](_0x1e018f,{'transaction':_0x25c28e});}})[_0xb76e('0x14')](function(){_0x1e018f['forEach'](function(_0x1b0e38){socket['emit']('userChatQueue:remove',{'UserId':_0x1b0e38,'ChatQueueId':_0x163b60['id']});});});});});});})[_0xb76e('0x14')](respondWithStatusCode(_0x3be4d6,null))[_0xb76e('0x34')](handleError(_0x3be4d6,null));};exports['addAgents']=function(_0xd57cb3,_0x44410f){return db['ChatQueue']['find']({'where':{'id':_0xd57cb3[_0xb76e('0x3e')]['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x44410f,null))['then'](function(_0x3abbb1){if(_0x3abbb1){return _0x3abbb1[_0xb76e('0x71')](_0xd57cb3['body'][_0xb76e('0x55')],_[_0xb76e('0x72')](_0xd57cb3['body'],[_0xb76e('0x55'),'id'])||{})['spread'](function(_0x23b708){for(var _0x433464=0x0;_0x433464<_0xd57cb3[_0xb76e('0x36')][_0xb76e('0x55')][_0xb76e('0x30')];_0x433464+=0x1){socket[_0xb76e('0x5f')](_0xb76e('0x60'),{'UserId':Number(_0xd57cb3[_0xb76e('0x36')][_0xb76e('0x55')][_0x433464]),'ChatQueueId':Number(_0xd57cb3[_0xb76e('0x3e')]['id'])});}return _0x23b708;});}})[_0xb76e('0x14')](respondWithResult(_0x44410f,null))[_0xb76e('0x34')](handleError(_0x44410f,null));};exports[_0xb76e('0x70')]=function(_0x51b78b,_0x12b11e){return db[_0xb76e('0x20')][_0xb76e('0x33')]({'where':{'id':_0x51b78b['params']['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x12b11e,null))[_0xb76e('0x14')](function(_0x3b1959){if(_0x3b1959){return _0x3b1959[_0xb76e('0x70')](_0x51b78b[_0xb76e('0x2d')][_0xb76e('0x55')])[_0xb76e('0x14')](function(){if(_[_0xb76e('0x73')](_0x51b78b[_0xb76e('0x2d')]['ids'])){for(var _0x4f9ce5=0x0;_0x4f9ce5<_0x51b78b[_0xb76e('0x2d')][_0xb76e('0x55')][_0xb76e('0x30')];_0x4f9ce5+=0x1){socket[_0xb76e('0x5f')](_0xb76e('0x74'),{'UserId':Number(_0x51b78b[_0xb76e('0x2d')][_0xb76e('0x55')][_0x4f9ce5]),'ChatQueueId':Number(_0x51b78b['params']['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x51b78b[_0xb76e('0x2d')][_0xb76e('0x55')]),'ChatQueueId':Number(_0x51b78b[_0xb76e('0x3e')]['id'])});}});}})[_0xb76e('0x14')](respondWithStatusCode(_0x12b11e,null))[_0xb76e('0x34')](handleError(_0x12b11e,null));};exports[_0xb76e('0x75')]=function(_0x1aecfc,_0x58edba){var _0xbcdc57={};var _0x1511c3={};var _0x21f9c5;var _0x114f14;return db[_0xb76e('0x20')]['findOne']({'where':{'id':_0x1aecfc['params']['id']}})[_0xb76e('0x14')](handleEntityNotFound(_0x58edba,null))[_0xb76e('0x14')](function(_0x282f70){if(_0x282f70){_0x21f9c5=_0x282f70;_0x1511c3[_0xb76e('0x29')]=_[_0xb76e('0x2a')](db['User'][_0xb76e('0x2b')]);_0x1511c3[_0xb76e('0x2d')]=_[_0xb76e('0x2a')](_0x1aecfc[_0xb76e('0x2d')]);_0x1511c3[_0xb76e('0x2c')]=_[_0xb76e('0x43')](_0x1511c3[_0xb76e('0x29')],_0x1511c3[_0xb76e('0x2d')]);_0xbcdc57['attributes']=_[_0xb76e('0x43')](_0x1511c3[_0xb76e('0x29')],qs[_0xb76e('0x2f')](_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0x2f')]));_0xbcdc57[_0xb76e('0x2e')]=_0xbcdc57[_0xb76e('0x2e')][_0xb76e('0x30')]?_0xbcdc57[_0xb76e('0x2e')]:_0x1511c3[_0xb76e('0x29')];_0xbcdc57[_0xb76e('0x46')]=qs[_0xb76e('0x47')](_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0x47')]);_0xbcdc57[_0xb76e('0x24')]=qs[_0xb76e('0x2c')](_['pick'](_0x1aecfc['query'],_0x1511c3[_0xb76e('0x2c')]));if(_0x1aecfc[_0xb76e('0x2d')]['filter']){_0xbcdc57[_0xb76e('0x24')]=_[_0xb76e('0x32')](_0xbcdc57[_0xb76e('0x24')],{'$or':_['map'](_0xbcdc57['attributes'],function(_0x49b232){var _0x2ddbf6={};_0x2ddbf6[_0x49b232]={'$like':'%'+_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0x49')]+'%'};return _0x2ddbf6;})});}_0xbcdc57=_[_0xb76e('0x32')]({},_0xbcdc57,_0x1aecfc[_0xb76e('0x53')]);return _0x21f9c5['getAgents'](_0xbcdc57);}})[_0xb76e('0x14')](function(_0x26d387){if(_0x26d387){_0x114f14=_0x26d387[_0xb76e('0x30')];if(!_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0x44')]('nolimit')){_0xbcdc57[_0xb76e('0xf')]=qs[_0xb76e('0xf')](_0x1aecfc['query']['limit']);_0xbcdc57[_0xb76e('0xe')]=qs[_0xb76e('0xe')](_0x1aecfc[_0xb76e('0x2d')][_0xb76e('0xe')]);}return _0x21f9c5[_0xb76e('0x75')](_0xbcdc57);}})['then'](function(_0x36a269){if(_0x36a269){return _0x36a269?{'count':_0x114f14,'rows':_0x36a269}:null;}})[_0xb76e('0x14')](respondWithResult(_0x58edba,null))[_0xb76e('0x34')](handleError(_0x58edba,null));}; \ No newline at end of file +var _0x272f=['lodash','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','type','getOptions','include','rows','catch','params','model','keys','rawAttributes','query','filters','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','destroy','describe','getMembers','intersection','hasOwnProperty','nolimit','sort','where','pick','ChatQueueId','filter','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','format','SIP','chatPause','createdAt','updatedAt','getTeams','findOne','Team','order','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util'];(function(_0x543f4d,_0x5953de){var _0x173378=function(_0x59aaff){while(--_0x59aaff){_0x543f4d['push'](_0x543f4d['shift']());}};_0x173378(++_0x5953de);}(_0x272f,0x1ee));var _0xf272=function(_0x225c4b,_0x45d0e9){_0x225c4b=_0x225c4b-0x0;var _0x3305b1=_0x272f[_0x225c4b];return _0x3305b1;};'use strict';var BPromise=require(_0xf272('0x0'));var util=require(_0xf272('0x1'));var _=require(_0xf272('0x2'));var squel=require(_0xf272('0x3'));var Redis=require(_0xf272('0x4'));var qs=require(_0xf272('0x5'));var logger=require('../../config/logger')(_0xf272('0x6'));var config=require('../../config/environment');var db=require(_0xf272('0x7'))['db'];config[_0xf272('0x8')]=_['defaults'](config[_0xf272('0x8')],{'host':_0xf272('0x9'),'port':0x18eb});var socket=require(_0xf272('0xa'))(new Redis(config[_0xf272('0x8')]));require(_0xf272('0xb'))[_0xf272('0xc')](socket);function respondWithStatusCode(_0x248ebc,_0x52769c){_0x52769c=_0x52769c||0xcc;return function(_0x849b2c){if(_0x849b2c){return _0x248ebc[_0xf272('0xd')](_0x52769c);}return _0x248ebc['status'](_0x52769c)[_0xf272('0xe')]();};}function respondWithResult(_0x265db8,_0x433a28){_0x433a28=_0x433a28||0xc8;return function(_0x3fea1b){if(_0x3fea1b){return _0x265db8[_0xf272('0xf')](_0x433a28)[_0xf272('0x10')](_0x3fea1b);}};}function respondWithFilteredResult(_0xb4f29e,_0x107e5c){return function(_0x991223){if(_0x991223){var _0x231901=typeof _0x107e5c['offset']===_0xf272('0x11')&&typeof _0x107e5c[_0xf272('0x12')]===_0xf272('0x11');var _0x4bfcf4=_0x991223[_0xf272('0x13')];var _0x505152=_0x231901?0x0:_0x107e5c[_0xf272('0x14')];var _0x4895e4=_0x231901?_0x991223[_0xf272('0x13')]:_0x107e5c[_0xf272('0x14')]+_0x107e5c[_0xf272('0x12')];var _0x2214f4;if(_0x4895e4>=_0x4bfcf4){_0x4895e4=_0x4bfcf4;_0x2214f4=0xc8;}else{_0x2214f4=0xce;}_0xb4f29e['status'](_0x2214f4);return _0xb4f29e[_0xf272('0x15')](_0xf272('0x16'),_0x505152+'-'+_0x4895e4+'/'+_0x4bfcf4)[_0xf272('0x10')](_0x991223);}return null;};}function saveUpdates(_0x26f93a){return function(_0x3f640c){if(_0x3f640c){return _0x3f640c[_0xf272('0x17')](_0x26f93a)[_0xf272('0x18')](function(_0x570a67){return _0x570a67;});}return null;};}function removeEntity(_0x4fb668){return function(_0x1c9620){if(_0x1c9620){return _0x1c9620['destroy']()['then'](function(){var _0x501675=_0x1c9620[_0xf272('0x19')]({'plain':!![]});var _0x2c68d0=_0xf272('0x1a');return db[_0xf272('0x1b')]['destroy']({'where':{'type':_0x2c68d0,'resourceId':_0x501675['id']}})['then'](function(){return _0x1c9620;});})['then'](function(){_0x4fb668[_0xf272('0xf')](0xcc)[_0xf272('0xe')]();});}};}function handleEntityNotFound(_0x46ec78){return function(_0x314337){if(!_0x314337){_0x46ec78[_0xf272('0xd')](0x194);}return _0x314337;};}function handleError(_0x1596e9,_0x59d556){_0x59d556=_0x59d556||0x1f4;return function(_0xb7cccb){logger[_0xf272('0x1c')](_0xb7cccb[_0xf272('0x1d')]);if(_0xb7cccb[_0xf272('0x1e')]){delete _0xb7cccb['name'];}_0x1596e9['status'](_0x59d556)[_0xf272('0x1f')](_0xb7cccb);};}exports[_0xf272('0x20')]=function(_0xcbf388,_0x1bddd1){var _0x29a87a={};var _0x5d6449={'count':0x0,'rows':[]};var _0x3db6b5=_[_0xf272('0x21')](db[_0xf272('0x22')]['rawAttributes'],function(_0x398a6d){return{'name':_0x398a6d['fieldName'],'type':_0x398a6d[_0xf272('0x23')]['key']};});_0x29a87a=qs[_0xf272('0x24')](_0x3db6b5,_0xcbf388);var _0x58ddaf={'where':_0x29a87a['where']};return db[_0xf272('0x22')][_0xf272('0x13')](_0x58ddaf)[_0xf272('0x18')](function(_0x571746){_0x5d6449[_0xf272('0x13')]=_0x571746;_0x29a87a[_0xf272('0x25')]=qs[_0xf272('0x25')](_0xcbf388['query']);return db[_0xf272('0x22')]['findAll'](_0x29a87a);})[_0xf272('0x18')](function(_0x273cd6){_0x5d6449[_0xf272('0x26')]=_0x273cd6;return _0x5d6449;})[_0xf272('0x18')](respondWithFilteredResult(_0x1bddd1,_0x29a87a))[_0xf272('0x27')](handleError(_0x1bddd1,null));};exports['show']=function(_0x2f1b53,_0x2bce85){var _0x176fdf={'raw':!![],'where':{'id':_0x2f1b53[_0xf272('0x28')]['id']}},_0x1ee4fa={};_0x1ee4fa[_0xf272('0x29')]=_[_0xf272('0x2a')](db[_0xf272('0x22')][_0xf272('0x2b')]);_0x1ee4fa[_0xf272('0x2c')]=_[_0xf272('0x2a')](_0x2f1b53[_0xf272('0x2c')]);_0x1ee4fa[_0xf272('0x2d')]=_['intersection'](_0x1ee4fa[_0xf272('0x29')],_0x1ee4fa[_0xf272('0x2c')]);_0x176fdf[_0xf272('0x2e')]=_['intersection'](_0x1ee4fa[_0xf272('0x29')],qs['fields'](_0x2f1b53[_0xf272('0x2c')][_0xf272('0x2f')]));_0x176fdf[_0xf272('0x2e')]=_0x176fdf[_0xf272('0x2e')][_0xf272('0x30')]?_0x176fdf['attributes']:_0x1ee4fa[_0xf272('0x29')];if(_0x2f1b53[_0xf272('0x2c')][_0xf272('0x31')]){_0x176fdf['include']=[{'all':!![]}];}_0x176fdf=_[_0xf272('0x32')]({},_0x176fdf,_0x2f1b53[_0xf272('0x33')]);return db['ChatQueue'][_0xf272('0x34')](_0x176fdf)['then'](handleEntityNotFound(_0x2bce85,null))[_0xf272('0x18')](respondWithResult(_0x2bce85,null))['catch'](handleError(_0x2bce85,null));};exports[_0xf272('0x35')]=function(_0x381655,_0x1ab4de){return db[_0xf272('0x22')][_0xf272('0x35')](_0x381655[_0xf272('0x36')],{})['then'](function(_0x393778){var _0xc02997=_0x381655['user'][_0xf272('0x19')]({'plain':!![]});if(!_0xc02997)throw new Error(_0xf272('0x37'));if(_0xc02997[_0xf272('0x38')]===_0xf272('0x39')){var _0x9461b4=_0x393778[_0xf272('0x19')]({'plain':!![]});var _0xba876=_0xf272('0x1a');return db[_0xf272('0x3a')]['find']({'where':{'name':_0xba876,'userProfileId':_0xc02997[_0xf272('0x3b')]},'raw':!![]})[_0xf272('0x18')](function(_0x22dc79){if(_0x22dc79&&_0x22dc79[_0xf272('0x3c')]===0x0){return db[_0xf272('0x1b')][_0xf272('0x35')]({'name':_0x9461b4['name'],'resourceId':_0x9461b4['id'],'type':_0x22dc79['name'],'sectionId':_0x22dc79['id']},{})['then'](function(){return _0x393778;});}else{return _0x393778;}})[_0xf272('0x27')](function(_0xd1f941){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd1f941);throw _0xd1f941;});}return _0x393778;})[_0xf272('0x18')](respondWithResult(_0x1ab4de,0xc9))[_0xf272('0x27')](handleError(_0x1ab4de,null));};exports[_0xf272('0x17')]=function(_0x4ee7d9,_0x15853f){if(_0x4ee7d9[_0xf272('0x36')]['id']){delete _0x4ee7d9[_0xf272('0x36')]['id'];}return db[_0xf272('0x22')][_0xf272('0x34')]({'where':{'id':_0x4ee7d9[_0xf272('0x28')]['id']}})['then'](handleEntityNotFound(_0x15853f,null))[_0xf272('0x18')](saveUpdates(_0x4ee7d9[_0xf272('0x36')],null))[_0xf272('0x18')](respondWithResult(_0x15853f,null))['catch'](handleError(_0x15853f,null));};exports[_0xf272('0x3d')]=function(_0x47e1f7,_0x5b4d8b){return db[_0xf272('0x22')]['find']({'where':{'id':_0x47e1f7[_0xf272('0x28')]['id']}})[_0xf272('0x18')](handleEntityNotFound(_0x5b4d8b,null))[_0xf272('0x18')](removeEntity(_0x5b4d8b,null))['catch'](handleError(_0x5b4d8b,null));};exports[_0xf272('0x3e')]=function(_0x45a672,_0x4eedbe){return db[_0xf272('0x22')][_0xf272('0x3e')]()[_0xf272('0x18')](respondWithResult(_0x4eedbe,null))[_0xf272('0x27')](handleError(_0x4eedbe,null));};exports[_0xf272('0x3f')]=function(_0x45d335,_0x15f662){var _0x12d767={'raw':!![],'where':{}},_0x5c57ab={},_0x45a9b0;return db['ChatQueue']['findOne']({'where':{'id':_0x45d335[_0xf272('0x28')]['id']}})[_0xf272('0x18')](handleEntityNotFound(_0x15f662,null))['then'](function(_0x212225){if(_0x212225){_0x45a9b0=_0x212225[_0xf272('0x19')]({'plain':!![]});_0x5c57ab['model']=_[_0xf272('0x2a')](db['UserChatQueue']['rawAttributes']);_0x5c57ab[_0xf272('0x2c')]=_['keys'](_0x45d335['query']);_0x5c57ab[_0xf272('0x2d')]=_[_0xf272('0x40')](_0x5c57ab[_0xf272('0x29')],_0x5c57ab[_0xf272('0x2c')]);_0x12d767[_0xf272('0x2e')]=_[_0xf272('0x40')](_0x5c57ab['model'],qs[_0xf272('0x2f')](_0x45d335['query'][_0xf272('0x2f')]));_0x12d767['attributes']=_0x12d767[_0xf272('0x2e')]['length']?_0x12d767[_0xf272('0x2e')]:_0x5c57ab['model'];if(!_0x45d335[_0xf272('0x2c')][_0xf272('0x41')](_0xf272('0x42'))){_0x12d767['limit']=qs[_0xf272('0x12')](_0x45d335[_0xf272('0x2c')][_0xf272('0x12')]);_0x12d767[_0xf272('0x14')]=qs[_0xf272('0x14')](_0x45d335[_0xf272('0x2c')][_0xf272('0x14')]);}_0x12d767['order']=qs[_0xf272('0x43')](_0x45d335[_0xf272('0x2c')][_0xf272('0x43')]);_0x12d767[_0xf272('0x44')]=qs['filters'](_[_0xf272('0x45')](_0x45d335[_0xf272('0x2c')],_0x5c57ab[_0xf272('0x2d')]));_0x12d767[_0xf272('0x44')][_0xf272('0x46')]=_0x212225['id'];if(_0x45d335[_0xf272('0x2c')][_0xf272('0x47')]){_0x12d767[_0xf272('0x44')]=_['merge'](_0x12d767['where'],{'$or':_[_0xf272('0x21')](_0x12d767[_0xf272('0x2e')],function(_0x71664e){var _0x415d2f={};_0x415d2f[_0x71664e]={'$like':'%'+_0x45d335['query'][_0xf272('0x47')]+'%'};return _0x415d2f;})});}_0x12d767=_[_0xf272('0x32')]({},_0x12d767,_0x45d335[_0xf272('0x33')]);return db[_0xf272('0x48')][_0xf272('0x49')](_0x12d767);}})[_0xf272('0x18')](function(_0x23c0ff){if(_0x23c0ff){return db[_0xf272('0x4a')][_0xf272('0x4b')]({'where':{'id':_[_0xf272('0x21')](_0x23c0ff,_0xf272('0x4c')),'role':_0xf272('0x4d')},'attributes':['id','name','chatPause','updatedAt','createdAt']});}})[_0xf272('0x18')](function(_0x972763){if(_0x972763){return{'count':_0x972763[_0xf272('0x13')],'rows':_[_0xf272('0x21')](_0x972763[_0xf272('0x26')],function(_0x13f37f){return{'membername':_0x13f37f[_0xf272('0x1e')],'UserId':_0x13f37f['id'],'queue_name':_0x45a9b0[_0xf272('0x1e')],'ChatQueueId':_0x45a9b0['id'],'interface':util[_0xf272('0x4e')]('%s/%s',_0xf272('0x4f'),_0x13f37f[_0xf272('0x1e')]),'penalty':0x0,'paused':_0x13f37f[_0xf272('0x50')],'createdAt':_0x13f37f[_0xf272('0x51')],'updatedAt':_0x13f37f[_0xf272('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf272('0x18')](respondWithFilteredResult(_0x15f662,_0x12d767))['catch'](handleError(_0x15f662,null));};exports[_0xf272('0x53')]=function(_0x5cb010,_0x5387be){var _0x4e53d4={};var _0x2f0ba7={};var _0x535c00;var _0x5d1104;return db['ChatQueue'][_0xf272('0x54')]({'where':{'id':_0x5cb010[_0xf272('0x28')]['id']}})[_0xf272('0x18')](handleEntityNotFound(_0x5387be,null))[_0xf272('0x18')](function(_0x4f89b3){if(_0x4f89b3){_0x535c00=_0x4f89b3;_0x2f0ba7[_0xf272('0x29')]=_[_0xf272('0x2a')](db[_0xf272('0x55')][_0xf272('0x2b')]);_0x2f0ba7[_0xf272('0x2c')]=_[_0xf272('0x2a')](_0x5cb010[_0xf272('0x2c')]);_0x2f0ba7[_0xf272('0x2d')]=_['intersection'](_0x2f0ba7[_0xf272('0x29')],_0x2f0ba7[_0xf272('0x2c')]);_0x4e53d4['attributes']=_['intersection'](_0x2f0ba7[_0xf272('0x29')],qs[_0xf272('0x2f')](_0x5cb010['query']['fields']));_0x4e53d4['attributes']=_0x4e53d4[_0xf272('0x2e')]['length']?_0x4e53d4[_0xf272('0x2e')]:_0x2f0ba7[_0xf272('0x29')];_0x4e53d4[_0xf272('0x56')]=qs['sort'](_0x5cb010[_0xf272('0x2c')][_0xf272('0x43')]);_0x4e53d4['where']=qs[_0xf272('0x2d')](_[_0xf272('0x45')](_0x5cb010['query'],_0x2f0ba7[_0xf272('0x2d')]));if(_0x5cb010[_0xf272('0x2c')][_0xf272('0x47')]){_0x4e53d4[_0xf272('0x44')]=_[_0xf272('0x32')](_0x4e53d4[_0xf272('0x44')],{'$or':_[_0xf272('0x21')](_0x4e53d4[_0xf272('0x2e')],function(_0x37380b){var _0x4ac7c6={};_0x4ac7c6[_0x37380b]={'$like':'%'+_0x5cb010[_0xf272('0x2c')][_0xf272('0x47')]+'%'};return _0x4ac7c6;})});}_0x4e53d4=_['merge']({},_0x4e53d4,_0x5cb010[_0xf272('0x33')]);return _0x535c00[_0xf272('0x53')](_0x4e53d4);}})[_0xf272('0x18')](function(_0x322e0b){if(_0x322e0b){_0x5d1104=_0x322e0b[_0xf272('0x30')];if(!_0x5cb010[_0xf272('0x2c')][_0xf272('0x41')](_0xf272('0x42'))){_0x4e53d4[_0xf272('0x12')]=qs['limit'](_0x5cb010[_0xf272('0x2c')][_0xf272('0x12')]);_0x4e53d4[_0xf272('0x14')]=qs[_0xf272('0x14')](_0x5cb010[_0xf272('0x2c')][_0xf272('0x14')]);}return _0x535c00['getTeams'](_0x4e53d4);}})[_0xf272('0x18')](function(_0x2f979b){if(_0x2f979b){return _0x2f979b?{'count':_0x5d1104,'rows':_0x2f979b}:null;}})[_0xf272('0x18')](respondWithResult(_0x5387be,null))[_0xf272('0x27')](handleError(_0x5387be,null));};exports['addTeams']=function(_0x4141ed,_0x25ad70){var _0x2c6ec3=_0x4141ed['body'][_0xf272('0x57')];return db[_0xf272('0x55')][_0xf272('0x49')]({'where':{'id':_0x2c6ec3},'attributes':['id'],'include':[{'model':db[_0xf272('0x4a')],'as':'Agents','attributes':['id','name',_0xf272('0x58'),_0xf272('0x59'),_0xf272('0x5a')],'raw':!![]}]})[_0xf272('0x18')](function(_0x11bbb9){if(_0x11bbb9){var _0x3c4a2e=_[_0xf272('0x5b')](_0x11bbb9,function(_0x51a356){var _0x3ae7c9=_0x51a356[_0xf272('0x19')]({'plain':!![]});return _0x3ae7c9[_0xf272('0x5c')];});return db[_0xf272('0x22')][_0xf272('0x34')]({'where':{'id':_0x4141ed['params']['id']}})[_0xf272('0x18')](function(_0x44cb14){return db[_0xf272('0x5d')][_0xf272('0x5e')](function(_0x3cd0c0){return _0x44cb14['addTeams'](_0x2c6ec3,{'transaction':_0x3cd0c0})[_0xf272('0x18')](function(){return BPromise[_0xf272('0x5f')](_0x3c4a2e,function(_0x1f5e4e){return db[_0xf272('0x48')][_0xf272('0x60')]({'where':{'UserId':_0x1f5e4e['id'],'ChatQueueId':_0x4141ed['params']['id']},'transaction':_0x3cd0c0});});})[_0xf272('0x18')](function(){_0x3c4a2e['forEach'](function(_0x317f1f){socket[_0xf272('0x61')](_0xf272('0x62'),{'UserId':_0x317f1f['id'],'ChatQueueId':_0x44cb14['id']});});});});});}})['then'](respondWithStatusCode(_0x25ad70,null))['catch'](handleError(_0x25ad70,null));};exports[_0xf272('0x63')]=function(_0x30369e,_0xcfb7b6){return db['Team'][_0xf272('0x49')]({'where':{'id':_0x30369e[_0xf272('0x2c')][_0xf272('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf272('0x4a')],'as':_0xf272('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xf272('0x18')](handleEntityNotFound(_0xcfb7b6,null))[_0xf272('0x18')](function(_0x42bb79){var _0xd493d7=_[_0xf272('0x21')](_0x42bb79,'id');var _0x694003=[];var _0x265812=[];var _0x236212=squel[_0xf272('0x64')]();_0x236212['field'](_0xf272('0x65'))['from'](_0xf272('0x66'),'tq')[_0xf272('0x67')]('user_has_teams','ut',_0xf272('0x68'))[_0xf272('0x44')](_0xf272('0x69'),_0x30369e[_0xf272('0x28')]['id']);for(var _0x9bc57b=0x0;_0x9bc57b<_0x42bb79[_0xf272('0x30')];_0x9bc57b+=0x1){let _0x4a7017=_0x42bb79[_0x9bc57b];for(var _0x3e9f36=0x0;_0x3e9f36<_0x4a7017[_0xf272('0x5c')][_0xf272('0x30')];_0x3e9f36+=0x1){let _0x3e952f=_0x4a7017[_0xf272('0x5c')][_0x3e9f36];var _0x44b688=_0x236212['clone']();_0x44b688[_0xf272('0x44')](_0xf272('0x6a'),_0x3e952f['id']);_0x265812['push'](db[_0xf272('0x5d')]['query'](_0x44b688[_0xf272('0x6b')](),{'type':db[_0xf272('0x5d')][_0xf272('0x6c')][_0xf272('0x6d')]})[_0xf272('0x18')](function(_0x1c0aaf){if(_0x1c0aaf['length']===0x1){return _0x3e952f['id'];}else{var _0x41404e=_[_0xf272('0x6e')](_[_0xf272('0x21')](_0x1c0aaf,_0xf272('0x6f')),function(_0x1ccbb0){return _['includes'](_0xd493d7,_0x1ccbb0);});if(_0x41404e){return _0x3e952f['id'];}}}));}}return BPromise[_0xf272('0x70')](_0x265812)[_0xf272('0x18')](function(_0x2610ed){_0x694003=_(_0x694003)[_0xf272('0x71')](_0x2610ed)[_0xf272('0x72')]()[_0xf272('0x73')]();return db['ChatQueue'][_0xf272('0x34')]({'where':{'id':_0x30369e['params']['id']}})['then'](function(_0x30333d){return db[_0xf272('0x5d')][_0xf272('0x5e')](function(_0x1e5e29){return _0x30333d['removeTeams'](_0x30369e[_0xf272('0x2c')][_0xf272('0x57')],{'transaction':_0x1e5e29})['then'](function(){if(!_[_0xf272('0x74')](_0x694003)){return _0x30333d[_0xf272('0x75')](_0x694003,{'transaction':_0x1e5e29});}})[_0xf272('0x18')](function(){_0x694003[_0xf272('0x76')](function(_0xa74252){socket['emit'](_0xf272('0x77'),{'UserId':_0xa74252,'ChatQueueId':_0x30333d['id']});});});});});});})[_0xf272('0x18')](respondWithStatusCode(_0xcfb7b6,null))[_0xf272('0x27')](handleError(_0xcfb7b6,null));};exports[_0xf272('0x78')]=function(_0x338761,_0x18db7f){return db[_0xf272('0x22')][_0xf272('0x34')]({'where':{'id':_0x338761[_0xf272('0x28')]['id']}})[_0xf272('0x18')](handleEntityNotFound(_0x18db7f,null))[_0xf272('0x18')](function(_0x2cf6d2){if(_0x2cf6d2){return _0x2cf6d2['addAgents'](_0x338761['body']['ids'],_[_0xf272('0x79')](_0x338761[_0xf272('0x36')],['ids','id'])||{})['spread'](function(_0xf4891a){for(var _0x4ac5f0=0x0;_0x4ac5f0<_0x338761[_0xf272('0x36')][_0xf272('0x57')]['length'];_0x4ac5f0+=0x1){socket['emit'](_0xf272('0x62'),{'UserId':Number(_0x338761['body'][_0xf272('0x57')][_0x4ac5f0]),'ChatQueueId':Number(_0x338761[_0xf272('0x28')]['id'])});}return _0xf4891a;});}})[_0xf272('0x18')](respondWithResult(_0x18db7f,null))['catch'](handleError(_0x18db7f,null));};exports[_0xf272('0x75')]=function(_0x3f3123,_0x4ba569){return db[_0xf272('0x22')][_0xf272('0x34')]({'where':{'id':_0x3f3123['params']['id']}})['then'](handleEntityNotFound(_0x4ba569,null))[_0xf272('0x18')](function(_0x3adbcd){if(_0x3adbcd){return _0x3adbcd['removeAgents'](_0x3f3123['query'][_0xf272('0x57')])[_0xf272('0x18')](function(){if(_[_0xf272('0x7a')](_0x3f3123[_0xf272('0x2c')][_0xf272('0x57')])){for(var _0x578f2d=0x0;_0x578f2d<_0x3f3123[_0xf272('0x2c')][_0xf272('0x57')]['length'];_0x578f2d+=0x1){socket[_0xf272('0x61')]('userChatQueue:remove',{'UserId':Number(_0x3f3123[_0xf272('0x2c')][_0xf272('0x57')][_0x578f2d]),'ChatQueueId':Number(_0x3f3123[_0xf272('0x28')]['id'])});}}else{socket['emit'](_0xf272('0x77'),{'UserId':Number(_0x3f3123[_0xf272('0x2c')][_0xf272('0x57')]),'ChatQueueId':Number(_0x3f3123[_0xf272('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ba569,null))[_0xf272('0x27')](handleError(_0x4ba569,null));};exports[_0xf272('0x7b')]=function(_0x321171,_0x1fa98a){var _0x37bec8={};var _0x5a4c65={};var _0x54dbee;var _0x5a035c;return db[_0xf272('0x22')][_0xf272('0x54')]({'where':{'id':_0x321171[_0xf272('0x28')]['id']}})['then'](handleEntityNotFound(_0x1fa98a,null))[_0xf272('0x18')](function(_0x1b48b9){if(_0x1b48b9){_0x54dbee=_0x1b48b9;_0x5a4c65[_0xf272('0x29')]=_[_0xf272('0x2a')](db[_0xf272('0x4a')][_0xf272('0x2b')]);_0x5a4c65[_0xf272('0x2c')]=_[_0xf272('0x2a')](_0x321171[_0xf272('0x2c')]);_0x5a4c65[_0xf272('0x2d')]=_[_0xf272('0x40')](_0x5a4c65[_0xf272('0x29')],_0x5a4c65['query']);_0x37bec8[_0xf272('0x2e')]=_[_0xf272('0x40')](_0x5a4c65['model'],qs[_0xf272('0x2f')](_0x321171[_0xf272('0x2c')][_0xf272('0x2f')]));_0x37bec8[_0xf272('0x2e')]=_0x37bec8[_0xf272('0x2e')][_0xf272('0x30')]?_0x37bec8['attributes']:_0x5a4c65[_0xf272('0x29')];_0x37bec8['order']=qs['sort'](_0x321171[_0xf272('0x2c')][_0xf272('0x43')]);_0x37bec8[_0xf272('0x44')]=qs['filters'](_[_0xf272('0x45')](_0x321171['query'],_0x5a4c65[_0xf272('0x2d')]));if(_0x321171[_0xf272('0x2c')]['filter']){_0x37bec8[_0xf272('0x44')]=_['merge'](_0x37bec8[_0xf272('0x44')],{'$or':_[_0xf272('0x21')](_0x37bec8[_0xf272('0x2e')],function(_0x2cd679){var _0x3891cb={};_0x3891cb[_0x2cd679]={'$like':'%'+_0x321171['query']['filter']+'%'};return _0x3891cb;})});}_0x37bec8=_[_0xf272('0x32')]({},_0x37bec8,_0x321171['options']);return _0x54dbee[_0xf272('0x7b')](_0x37bec8);}})['then'](function(_0x596135){if(_0x596135){_0x5a035c=_0x596135[_0xf272('0x30')];if(!_0x321171['query']['hasOwnProperty'](_0xf272('0x42'))){_0x37bec8[_0xf272('0x12')]=qs[_0xf272('0x12')](_0x321171[_0xf272('0x2c')]['limit']);_0x37bec8[_0xf272('0x14')]=qs['offset'](_0x321171[_0xf272('0x2c')][_0xf272('0x14')]);}return _0x54dbee[_0xf272('0x7b')](_0x37bec8);}})[_0xf272('0x18')](function(_0x3bf295){if(_0x3bf295){return _0x3bf295?{'count':_0x5a035c,'rows':_0x3bf295}:null;}})[_0xf272('0x18')](respondWithResult(_0x1fa98a,null))[_0xf272('0x27')](handleError(_0x1fa98a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 058e566..e320b01 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 _0x9406=['hasOwnProperty','hook','exports','ChatQueue','setMaxListeners','update','remove','emit'];(function(_0x13f9ae,_0xb03598){var _0x14d535=function(_0x39d44f){while(--_0x39d44f){_0x13f9ae['push'](_0x13f9ae['shift']());}};_0x14d535(++_0xb03598);}(_0x9406,0x14b));var _0x6940=function(_0x543881,_0x57a681){_0x543881=_0x543881-0x0;var _0x12311b=_0x9406[_0x543881];return _0x12311b;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x6940('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6940('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6940('0x2'),'afterDestroy':_0x6940('0x3')};function emitEvent(_0x5b8be7){return function(_0x5ce139,_0x3bc0ba,_0x421f62){ChatQueueEvents[_0x6940('0x4')](_0x5b8be7+':'+_0x5ce139['id'],_0x5ce139);ChatQueueEvents[_0x6940('0x4')](_0x5b8be7,_0x5ce139);_0x421f62(null);};}for(var e in events){if(events[_0x6940('0x5')](e)){var event=events[e];ChatQueue[_0x6940('0x6')](e,emitEvent(event));}}module[_0x6940('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x8eb1=['../../mysqldb','ChatQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8eb1,0x108));var _0x18eb=function(_0x30a04c,_0x1949e1){_0x30a04c=_0x30a04c-0x0;var _0x1da59b=_0x8eb1[_0x30a04c];return _0x1da59b;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x18eb('0x0'))['db'][_0x18eb('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x18eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x18eb('0x3')};function emitEvent(_0x51b833){return function(_0x264b0e,_0x2bf482,_0x4a33b8){ChatQueueEvents['emit'](_0x51b833+':'+_0x264b0e['id'],_0x264b0e);ChatQueueEvents[_0x18eb('0x4')](_0x51b833,_0x264b0e);_0x4a33b8(null);};}for(var e in events){if(events[_0x18eb('0x5')](e)){var event=events[e];ChatQueue[_0x18eb('0x6')](e,emitEvent(event));}}module[_0x18eb('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index fbf978c..dff7294 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 _0xa39e=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment'];(function(_0x13c52d,_0x232bc0){var _0x5177b3=function(_0xdf3dac){while(--_0xdf3dac){_0x13c52d['push'](_0x13c52d['shift']());}};_0x5177b3(++_0x232bc0);}(_0xa39e,0xa5));var _0xea39=function(_0x1061de,_0x38998a){_0x1061de=_0x1061de-0x0;var _0x3b543f=_0xa39e[_0x1061de];return _0x3b543f;};'use strict';var _=require(_0xea39('0x0'));var util=require('util');var logger=require(_0xea39('0x1'))(_0xea39('0x2'));var moment=require(_0xea39('0x3'));var BPromise=require('bluebird');var rp=require(_0xea39('0x4'));var fs=require('fs');var path=require(_0xea39('0x5'));var rimraf=require(_0xea39('0x6'));var config=require(_0xea39('0x7'));var attributes=require(_0xea39('0x8'));module[_0xea39('0x9')]=function(_0x39ef56,_0x1e735d){return _0x39ef56[_0xea39('0xa')](_0xea39('0xb'),attributes,{'tableName':_0xea39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78bb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x53a442,_0x1b0063){var _0x2e8e36=function(_0x191266){while(--_0x191266){_0x53a442['push'](_0x53a442['shift']());}};_0x2e8e36(++_0x1b0063);}(_0x78bb,0x74));var _0xb78b=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x78bb[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0xb78b('0x0'));var util=require(_0xb78b('0x1'));var logger=require(_0xb78b('0x2'))(_0xb78b('0x3'));var moment=require(_0xb78b('0x4'));var BPromise=require(_0xb78b('0x5'));var rp=require(_0xb78b('0x6'));var fs=require('fs');var path=require(_0xb78b('0x7'));var rimraf=require(_0xb78b('0x8'));var config=require(_0xb78b('0x9'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x15c70c,_0x28005f){return _0x15c70c['define'](_0xb78b('0xa'),attributes,{'tableName':_0xb78b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 1e17bdd..adcc5a4 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 _0xd4a2=['defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowChatQueue','find','catch','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dc587,_0x2ebc6c){var _0x29f93a=function(_0x5ab3d4){while(--_0x5ab3d4){_0x3dc587['push'](_0x3dc587['shift']());}};_0x29f93a(++_0x2ebc6c);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2a4fa7,_0x83dd47){_0x2a4fa7=_0x2a4fa7-0x0;var _0x2a66d2=_0xd4a2[_0x2a4fa7];return _0x2a66d2;};'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});config['redis']=_[_0x2d4a('0x9')](config[_0x2d4a('0xa')],{'host':_0x2d4a('0xb'),'port':0x18eb});var socket=require(_0x2d4a('0xc'))(new Redis(config[_0x2d4a('0xa')]));require(_0x2d4a('0xd'))[_0x2d4a('0xe')](socket);function respondWithRpcPromise(_0x113839,_0x33b786,_0x4738dc){return new BPromise(function(_0x3abbbd,_0xce6af6){return client['request'](_0x113839,_0x4738dc)['then'](function(_0x4002de){logger['info'](_0x2d4a('0xf'),_0x33b786,_0x2d4a('0x10'));logger[_0x2d4a('0x11')](_0x2d4a('0x12'),_0x33b786,_0x2d4a('0x10'),JSON[_0x2d4a('0x13')](_0x4002de));if(_0x4002de[_0x2d4a('0x14')]){if(_0x4002de[_0x2d4a('0x14')]['code']===0x1f4){logger['error'](_0x2d4a('0xf'),_0x33b786,_0x4002de['error'][_0x2d4a('0x15')]);return _0xce6af6(_0x4002de[_0x2d4a('0x14')][_0x2d4a('0x15')]);}logger[_0x2d4a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x33b786,_0x4002de[_0x2d4a('0x14')]['message']);return _0x3abbbd(_0x4002de[_0x2d4a('0x14')]['message']);}else{logger[_0x2d4a('0x16')](_0x2d4a('0xf'),_0x33b786,_0x2d4a('0x10'));_0x3abbbd(_0x4002de[_0x2d4a('0x17')]['message']);}})['catch'](function(_0x5ac74b){logger[_0x2d4a('0x14')](_0x2d4a('0xf'),_0x33b786,_0x5ac74b);_0xce6af6(_0x5ac74b);});});}exports[_0x2d4a('0x18')]=function(_0x419df5){var _0x46c331=this;return new Promise(function(_0x2e4069,_0x56445a){return db['ChatQueue'][_0x2d4a('0x19')]({'raw':_0x419df5[_0x2d4a('0x1a')]?_0x419df5[_0x2d4a('0x1a')][_0x2d4a('0x1b')]===undefined?!![]:![]:!![],'where':_0x419df5[_0x2d4a('0x1a')]?_0x419df5[_0x2d4a('0x1a')][_0x2d4a('0x1c')]||null:null,'attributes':_0x419df5[_0x2d4a('0x1a')]?_0x419df5['options'][_0x2d4a('0x1d')]||null:null,'limit':_0x419df5[_0x2d4a('0x1a')]?_0x419df5[_0x2d4a('0x1a')][_0x2d4a('0x1e')]||null:null,'include':_0x419df5[_0x2d4a('0x1a')]?_0x419df5[_0x2d4a('0x1a')][_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x419df5['options']['include'],function(_0x5cc7d8){return{'model':db[_0x5cc7d8[_0x2d4a('0x21')]],'as':_0x5cc7d8['as'],'attributes':_0x5cc7d8['attributes'],'include':_0x5cc7d8[_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x5cc7d8[_0x2d4a('0x1f')],function(_0x1d2fa6){return{'model':db[_0x1d2fa6[_0x2d4a('0x21')]],'as':_0x1d2fa6['as'],'attributes':_0x1d2fa6[_0x2d4a('0x1d')],'include':_0x1d2fa6[_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x1d2fa6['include'],function(_0x436f53){return{'model':db[_0x436f53['model']],'as':_0x436f53['as'],'attributes':_0x436f53[_0x2d4a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2d4a('0x22')](function(_0xc497ce){logger[_0x2d4a('0x16')](_0x2d4a('0x18'),_0x419df5);logger[_0x2d4a('0x11')](_0x2d4a('0x18'),_0x419df5,JSON[_0x2d4a('0x13')](_0xc497ce));_0x2e4069(_0xc497ce);})['catch'](function(_0x45a4fa){logger[_0x2d4a('0x14')](_0x2d4a('0x18'),_0x45a4fa[_0x2d4a('0x15')],_0x419df5);_0x56445a(_0x46c331[_0x2d4a('0x14')](0x1f4,_0x45a4fa['message']));});});};exports[_0x2d4a('0x23')]=function(_0x31d8ae){var _0x27015d=this;return new Promise(function(_0x24bcc2,_0x2bb93d){return db['ChatQueue'][_0x2d4a('0x24')]({'raw':_0x31d8ae[_0x2d4a('0x1a')]?_0x31d8ae[_0x2d4a('0x1a')][_0x2d4a('0x1b')]===undefined?!![]:![]:!![],'where':_0x31d8ae[_0x2d4a('0x1a')]?_0x31d8ae[_0x2d4a('0x1a')]['where']||null:null,'attributes':_0x31d8ae[_0x2d4a('0x1a')]?_0x31d8ae[_0x2d4a('0x1a')][_0x2d4a('0x1d')]||null:null,'include':_0x31d8ae[_0x2d4a('0x1a')]?_0x31d8ae[_0x2d4a('0x1a')]['include']?_[_0x2d4a('0x20')](_0x31d8ae[_0x2d4a('0x1a')]['include'],function(_0x2b3093){return{'model':db[_0x2b3093[_0x2d4a('0x21')]],'as':_0x2b3093['as'],'attributes':_0x2b3093[_0x2d4a('0x1d')],'include':_0x2b3093[_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x2b3093[_0x2d4a('0x1f')],function(_0x487d2e){return{'model':db[_0x487d2e[_0x2d4a('0x21')]],'as':_0x487d2e['as'],'attributes':_0x487d2e[_0x2d4a('0x1d')],'include':_0x487d2e[_0x2d4a('0x1f')]?_[_0x2d4a('0x20')](_0x487d2e[_0x2d4a('0x1f')],function(_0x145f21){return{'model':db[_0x145f21['model']],'as':_0x145f21['as'],'attributes':_0x145f21['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d4a('0x22')](function(_0x4b833b){logger[_0x2d4a('0x16')](_0x2d4a('0x23'),_0x31d8ae);logger['debug'](_0x2d4a('0x23'),_0x31d8ae,JSON[_0x2d4a('0x13')](_0x4b833b));_0x24bcc2(_0x4b833b);})[_0x2d4a('0x25')](function(_0x1035b9){logger[_0x2d4a('0x14')](_0x2d4a('0x23'),_0x1035b9[_0x2d4a('0x15')],_0x31d8ae);_0x2bb93d(_0x27015d[_0x2d4a('0x14')](0x1f4,_0x1035b9[_0x2d4a('0x15')]));});});}; \ No newline at end of file +var _0xa0a3=['ChatQueue','findAll','options','where','attributes','limit','include','map','model','ShowChatQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatQueue.socket','register','then','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','catch','GetChatQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x172318,_0x25c35f){_0x172318=_0x172318-0x0;var _0xf34564=_0xa0a3[_0x172318];return _0xf34564;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require(_0x3a0a('0x4'))['db'];var utils=require(_0x3a0a('0x5'));var logger=require(_0x3a0a('0x6'))(_0x3a0a('0x7'));var config=require(_0x3a0a('0x8'));var jayson=require(_0x3a0a('0x9'));var client=jayson[_0x3a0a('0xa')][_0x3a0a('0xb')]({'port':0x232a});config[_0x3a0a('0xc')]=_[_0x3a0a('0xd')](config[_0x3a0a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a0a('0xc')]));require(_0x3a0a('0xe'))[_0x3a0a('0xf')](socket);function respondWithRpcPromise(_0x3460be,_0x43e9ec,_0x272435){return new BPromise(function(_0x42235e,_0x53f366){return client['request'](_0x3460be,_0x272435)[_0x3a0a('0x10')](function(_0x3b1003){logger['info']('ChatQueue,\x20%s,\x20%s',_0x43e9ec,_0x3a0a('0x11'));logger[_0x3a0a('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x43e9ec,_0x3a0a('0x11'),JSON[_0x3a0a('0x13')](_0x3b1003));if(_0x3b1003[_0x3a0a('0x14')]){if(_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x15')]===0x1f4){logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x17')]);return _0x53f366(_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x17')]);}logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x3b1003[_0x3a0a('0x14')]['message']);return _0x42235e(_0x3b1003[_0x3a0a('0x14')]['message']);}else{logger[_0x3a0a('0x18')](_0x3a0a('0x16'),_0x43e9ec,_0x3a0a('0x11'));_0x42235e(_0x3b1003['result'][_0x3a0a('0x17')]);}})[_0x3a0a('0x19')](function(_0x4f0372){logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x4f0372);_0x53f366(_0x4f0372);});});}exports[_0x3a0a('0x1a')]=function(_0x36ca41){var _0x91d764=this;return new Promise(function(_0x423990,_0x3e99f9){return db[_0x3a0a('0x1b')][_0x3a0a('0x1c')]({'raw':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41['options']['raw']===undefined?!![]:![]:!![],'where':_0x36ca41['options']?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x1e')]||null:null,'attributes':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x1f')]||null:null,'limit':_0x36ca41['options']?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x20')]||null:null,'include':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41['options'][_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x36ca41['options']['include'],function(_0x16e93d){return{'model':db[_0x16e93d[_0x3a0a('0x23')]],'as':_0x16e93d['as'],'attributes':_0x16e93d[_0x3a0a('0x1f')],'include':_0x16e93d['include']?_[_0x3a0a('0x22')](_0x16e93d[_0x3a0a('0x21')],function(_0x130ca6){return{'model':db[_0x130ca6[_0x3a0a('0x23')]],'as':_0x130ca6['as'],'attributes':_0x130ca6[_0x3a0a('0x1f')],'include':_0x130ca6['include']?_['map'](_0x130ca6[_0x3a0a('0x21')],function(_0x3d01d8){return{'model':db[_0x3d01d8['model']],'as':_0x3d01d8['as'],'attributes':_0x3d01d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a0a('0x10')](function(_0x2e7481){logger[_0x3a0a('0x18')](_0x3a0a('0x1a'),_0x36ca41);logger['debug']('GetChatQueue',_0x36ca41,JSON[_0x3a0a('0x13')](_0x2e7481));_0x423990(_0x2e7481);})[_0x3a0a('0x19')](function(_0x177181){logger['error'](_0x3a0a('0x1a'),_0x177181[_0x3a0a('0x17')],_0x36ca41);_0x3e99f9(_0x91d764[_0x3a0a('0x14')](0x1f4,_0x177181[_0x3a0a('0x17')]));});});};exports[_0x3a0a('0x24')]=function(_0x3184cb){var _0x26ff5d=this;return new Promise(function(_0x1218fd,_0x21be1c){return db['ChatQueue'][_0x3a0a('0x25')]({'raw':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x26')]===undefined?!![]:![]:!![],'where':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb['options'][_0x3a0a('0x1e')]||null:null,'attributes':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x1f')]||null:null,'include':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')]['include']?_[_0x3a0a('0x22')](_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x21')],function(_0x32c2e1){return{'model':db[_0x32c2e1[_0x3a0a('0x23')]],'as':_0x32c2e1['as'],'attributes':_0x32c2e1[_0x3a0a('0x1f')],'include':_0x32c2e1[_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x32c2e1['include'],function(_0x2301be){return{'model':db[_0x2301be[_0x3a0a('0x23')]],'as':_0x2301be['as'],'attributes':_0x2301be[_0x3a0a('0x1f')],'include':_0x2301be[_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x2301be[_0x3a0a('0x21')],function(_0x2ab6d2){return{'model':db[_0x2ab6d2[_0x3a0a('0x23')]],'as':_0x2ab6d2['as'],'attributes':_0x2ab6d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a0a('0x10')](function(_0x143696){logger[_0x3a0a('0x18')](_0x3a0a('0x24'),_0x3184cb);logger[_0x3a0a('0x12')](_0x3a0a('0x24'),_0x3184cb,JSON[_0x3a0a('0x13')](_0x143696));_0x1218fd(_0x143696);})[_0x3a0a('0x19')](function(_0xea232d){logger['error'](_0x3a0a('0x24'),_0xea232d['message'],_0x3184cb);_0x21be1c(_0x26ff5d[_0x3a0a('0x14')](0x1f4,_0xea232d[_0x3a0a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 322feba..8b2b003 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 _0x0bde=['save','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){ChatQueueEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);ChatQueueEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file +var _0x00bb=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0x00bb,0x1d8));var _0xb00b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x00bb[_0x33032e];return _0x13316b;};'use strict';var ChatQueueEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){ChatQueueEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);ChatQueueEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 9cd180c..e926c52 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5373dc,_0x1c10d9){var _0x102fde=function(_0x2eecf5){while(--_0x2eecf5){_0x5373dc['push'](_0x5373dc['shift']());}};_0x102fde(++_0x1c10d9);}(_0x008c,0x188));var _0xc008=function(_0x419b6a,_0x265b43){_0x419b6a=_0x419b6a-0x0;var _0x229232=_0x008c[_0x419b6a];return _0x229232;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3e74,0x175));var _0x43e7=function(_0x15757e,_0x8031c2){_0x15757e=_0x15757e-0x0;var _0x5a5843=_0x3e74[_0x15757e];return _0x5a5843;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 39ae136..f29054d 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 _0x5b84=['sequelize','exports','STRING','DATE'];(function(_0x47a2a0,_0x3a8742){var _0x4d279d=function(_0x6e5f3a){while(--_0x6e5f3a){_0x47a2a0['push'](_0x47a2a0['shift']());}};_0x4d279d(++_0x3a8742);}(_0x5b84,0x1ac));var _0x45b8=function(_0x507b3f,_0xd4249c){_0x507b3f=_0x507b3f-0x0;var _0x428730=_0x5b84[_0x507b3f];return _0x428730;};'use strict';var moment=require('moment');var Sequelize=require(_0x45b8('0x0'));module[_0x45b8('0x1')]={'uniqueid':{'type':Sequelize[_0x45b8('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x45b8('0x3')]},'leaveAt':{'type':Sequelize[_0x45b8('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x45b8('0x3')]},'reason':{'type':Sequelize[_0x45b8('0x2')]}}; \ No newline at end of file +var _0x71ef=['moment','exports','STRING','DATE'];(function(_0x5923e8,_0xc8d316){var _0x7a1148=function(_0x95a6bc){while(--_0x95a6bc){_0x5923e8['push'](_0x5923e8['shift']());}};_0x7a1148(++_0xc8d316);}(_0x71ef,0x140));var _0xf71e=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x71ef[_0x1399d6];return _0x4a9db4;};'use strict';var moment=require(_0xf71e('0x0'));var Sequelize=require('sequelize');module[_0xf71e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf71e('0x2')]},'joinAt':{'type':Sequelize[_0xf71e('0x3')]},'leaveAt':{'type':Sequelize[_0xf71e('0x3')]},'acceptAt':{'type':Sequelize[_0xf71e('0x3')]},'exitAt':{'type':Sequelize[_0xf71e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 27b7cb8..8fbcb94 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 _0x7f94=['ChatQueueReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','filter','merge','options','include','findAll','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x5217ee,_0xd2c4d3){var _0x1e5cd=function(_0x49665e){while(--_0x49665e){_0x5217ee['push'](_0x5217ee['shift']());}};_0x1e5cd(++_0xd2c4d3);}(_0x7f94,0x65));var _0x47f9=function(_0x5e9a54,_0x39a4e1){_0x5e9a54=_0x5e9a54-0x0;var _0x581d64=_0x7f94[_0x5e9a54];return _0x581d64;};'use strict';var emlformat=require(_0x47f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47f9('0x1'));var jsonpatch=require(_0x47f9('0x2'));var rp=require(_0x47f9('0x3'));var moment=require(_0x47f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47f9('0x5'));var util=require(_0x47f9('0x6'));var path=require(_0x47f9('0x7'));var sox=require(_0x47f9('0x8'));var csv=require(_0x47f9('0x9'));var ejs=require(_0x47f9('0xa'));var fs=require('fs');var fs_extra=require(_0x47f9('0xb'));var _=require('lodash');var squel=require(_0x47f9('0xc'));var crypto=require(_0x47f9('0xd'));var jsforce=require(_0x47f9('0xe'));var deskjs=require(_0x47f9('0xf'));var toCsv=require(_0x47f9('0x9'));var querystring=require(_0x47f9('0x10'));var Papa=require(_0x47f9('0x11'));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(_0x47f9('0x12'));var logger=require(_0x47f9('0x13'))(_0x47f9('0x14'));var utils=require(_0x47f9('0x15'));var config=require(_0x47f9('0x16'));var licenseUtil=require(_0x47f9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a8bac,_0x1002f7){_0x1002f7=_0x1002f7||0xcc;return function(_0x49c33c){if(_0x49c33c){return _0x5a8bac['sendStatus'](_0x1002f7);}return _0x5a8bac['status'](_0x1002f7)[_0x47f9('0x18')]();};}function respondWithResult(_0x43e4db,_0x4d44dd){_0x4d44dd=_0x4d44dd||0xc8;return function(_0x166860){if(_0x166860){return _0x43e4db[_0x47f9('0x19')](_0x4d44dd)[_0x47f9('0x1a')](_0x166860);}};}function respondWithFilteredResult(_0x2a6444,_0x48cc81){return function(_0x3320d1){if(_0x3320d1){var _0x3703e1=typeof _0x48cc81[_0x47f9('0x1b')]===_0x47f9('0x1c')&&typeof _0x48cc81[_0x47f9('0x1d')]==='undefined';var _0x56775f=_0x3320d1['count'];var _0xd80474=_0x3703e1?0x0:_0x48cc81[_0x47f9('0x1b')];var _0x32bb57=_0x3703e1?_0x3320d1[_0x47f9('0x1e')]:_0x48cc81[_0x47f9('0x1b')]+_0x48cc81[_0x47f9('0x1d')];var _0x29700e;if(_0x32bb57>=_0x56775f){_0x32bb57=_0x56775f;_0x29700e=0xc8;}else{_0x29700e=0xce;}_0x2a6444[_0x47f9('0x19')](_0x29700e);return _0x2a6444[_0x47f9('0x1f')](_0x47f9('0x20'),_0xd80474+'-'+_0x32bb57+'/'+_0x56775f)[_0x47f9('0x1a')](_0x3320d1);}return null;};}function patchUpdates(_0x328d14){return function(_0x397dd5){try{jsonpatch['apply'](_0x397dd5,_0x328d14,!![]);}catch(_0x4d35bf){return BPromise[_0x47f9('0x21')](_0x4d35bf);}return _0x397dd5['save']();};}function saveUpdates(_0x2e2b69,_0x29b7f8){return function(_0x2ecf99){if(_0x2ecf99){return _0x2ecf99[_0x47f9('0x22')](_0x2e2b69)[_0x47f9('0x23')](function(_0x11ef91){return _0x11ef91;});}return null;};}function removeEntity(_0x6a49d,_0x3c4778){return function(_0x4fd2b1){if(_0x4fd2b1){return _0x4fd2b1[_0x47f9('0x24')]()[_0x47f9('0x23')](function(){_0x6a49d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26bd84,_0x4c16e0){return function(_0x76077d){if(!_0x76077d){_0x26bd84['sendStatus'](0x194);}return _0x76077d;};}function handleError(_0x26174a,_0x1a8c4b){_0x1a8c4b=_0x1a8c4b||0x1f4;return function(_0x5dbdda){logger[_0x47f9('0x25')](_0x5dbdda[_0x47f9('0x26')]);if(_0x5dbdda[_0x47f9('0x27')]){delete _0x5dbdda[_0x47f9('0x27')];}_0x26174a[_0x47f9('0x19')](_0x1a8c4b)[_0x47f9('0x28')](_0x5dbdda);};}exports[_0x47f9('0x29')]=function(_0x52927a,_0x53e951){var _0x4c37d2={},_0x481ccb={},_0x1a5b58={'count':0x0,'rows':[]};var _0x5818a6=_[_0x47f9('0x2a')](db[_0x47f9('0x2b')][_0x47f9('0x2c')],function(_0xaf0fea){return{'name':_0xaf0fea[_0x47f9('0x2d')],'type':_0xaf0fea[_0x47f9('0x2e')]['key']};});_0x481ccb['model']=_[_0x47f9('0x2a')](_0x5818a6,_0x47f9('0x27'));_0x481ccb['query']=_[_0x47f9('0x2f')](_0x52927a[_0x47f9('0x30')]);_0x481ccb[_0x47f9('0x31')]=_[_0x47f9('0x32')](_0x481ccb[_0x47f9('0x33')],_0x481ccb[_0x47f9('0x30')]);_0x4c37d2[_0x47f9('0x34')]=_[_0x47f9('0x32')](_0x481ccb[_0x47f9('0x33')],qs[_0x47f9('0x35')](_0x52927a[_0x47f9('0x30')][_0x47f9('0x35')]));_0x4c37d2[_0x47f9('0x34')]=_0x4c37d2['attributes'][_0x47f9('0x36')]?_0x4c37d2[_0x47f9('0x34')]:_0x481ccb['model'];if(!_0x52927a[_0x47f9('0x30')][_0x47f9('0x37')]('nolimit')){_0x4c37d2[_0x47f9('0x1d')]=qs['limit'](_0x52927a[_0x47f9('0x30')][_0x47f9('0x1d')]);_0x4c37d2[_0x47f9('0x1b')]=qs['offset'](_0x52927a[_0x47f9('0x30')][_0x47f9('0x1b')]);}_0x4c37d2[_0x47f9('0x38')]=qs[_0x47f9('0x39')](_0x52927a[_0x47f9('0x30')]['sort']);_0x4c37d2['where']=qs['filters'](_[_0x47f9('0x3a')](_0x52927a[_0x47f9('0x30')],_0x481ccb[_0x47f9('0x31')]),_0x5818a6);if(_0x52927a['query']['filter']){_0x4c37d2[_0x47f9('0x3b')]=_['merge'](_0x4c37d2[_0x47f9('0x3b')],{'$or':_['map'](_0x5818a6,function(_0x563492){if(_0x563492[_0x47f9('0x2e')]!=='VIRTUAL'){var _0xfe4480={};_0xfe4480[_0x563492[_0x47f9('0x27')]]={'$like':'%'+_0x52927a[_0x47f9('0x30')][_0x47f9('0x3c')]+'%'};return _0xfe4480;}})});}_0x4c37d2=_[_0x47f9('0x3d')]({},_0x4c37d2,_0x52927a[_0x47f9('0x3e')]);var _0x27ca33={'where':_0x4c37d2['where']};return db['ChatQueueReport'][_0x47f9('0x1e')](_0x27ca33)[_0x47f9('0x23')](function(_0x118db1){_0x1a5b58[_0x47f9('0x1e')]=_0x118db1;if(_0x52927a[_0x47f9('0x30')]['includeAll']){_0x4c37d2[_0x47f9('0x3f')]=[{'all':!![]}];}return db[_0x47f9('0x2b')][_0x47f9('0x40')](_0x4c37d2);})[_0x47f9('0x23')](function(_0x3128bc){_0x1a5b58[_0x47f9('0x41')]=_0x3128bc;return _0x1a5b58;})[_0x47f9('0x23')](respondWithFilteredResult(_0x53e951,_0x4c37d2))[_0x47f9('0x42')](handleError(_0x53e951,null));};exports['show']=function(_0x311975,_0xc61254){var _0x55443d={'raw':!![],'where':{'id':_0x311975['params']['id']}},_0x587a7f={};_0x587a7f[_0x47f9('0x33')]=_[_0x47f9('0x2f')](db[_0x47f9('0x2b')][_0x47f9('0x2c')]);_0x587a7f[_0x47f9('0x30')]=_[_0x47f9('0x2f')](_0x311975[_0x47f9('0x30')]);_0x587a7f[_0x47f9('0x31')]=_[_0x47f9('0x32')](_0x587a7f[_0x47f9('0x33')],_0x587a7f['query']);_0x55443d['attributes']=_['intersection'](_0x587a7f[_0x47f9('0x33')],qs['fields'](_0x311975[_0x47f9('0x30')][_0x47f9('0x35')]));_0x55443d['attributes']=_0x55443d[_0x47f9('0x34')][_0x47f9('0x36')]?_0x55443d['attributes']:_0x587a7f[_0x47f9('0x33')];if(_0x311975[_0x47f9('0x30')]['includeAll']){_0x55443d[_0x47f9('0x3f')]=[{'all':!![]}];}_0x55443d=_[_0x47f9('0x3d')]({},_0x55443d,_0x311975[_0x47f9('0x3e')]);return db[_0x47f9('0x2b')][_0x47f9('0x43')](_0x55443d)[_0x47f9('0x23')](handleEntityNotFound(_0xc61254,null))[_0x47f9('0x23')](respondWithResult(_0xc61254,null))[_0x47f9('0x42')](handleError(_0xc61254,null));};exports[_0x47f9('0x44')]=function(_0x411695,_0x38d61d){return db[_0x47f9('0x2b')][_0x47f9('0x44')](_0x411695[_0x47f9('0x45')],{})[_0x47f9('0x23')](respondWithResult(_0x38d61d,0xc9))['catch'](handleError(_0x38d61d,null));};exports[_0x47f9('0x22')]=function(_0x1c6e21,_0x58fc09){if(_0x1c6e21[_0x47f9('0x45')]['id']){delete _0x1c6e21[_0x47f9('0x45')]['id'];}return db[_0x47f9('0x2b')]['find']({'where':{'id':_0x1c6e21['params']['id']}})[_0x47f9('0x23')](handleEntityNotFound(_0x58fc09,null))['then'](saveUpdates(_0x1c6e21[_0x47f9('0x45')],null))['then'](respondWithResult(_0x58fc09,null))['catch'](handleError(_0x58fc09,null));};exports[_0x47f9('0x24')]=function(_0x2bd2c7,_0x1b1029){return db[_0x47f9('0x2b')]['find']({'where':{'id':_0x2bd2c7[_0x47f9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b1029,null))['then'](removeEntity(_0x1b1029,null))[_0x47f9('0x42')](handleError(_0x1b1029,null));};exports[_0x47f9('0x47')]=function(_0x43eb5b,_0x3d796c){return db[_0x47f9('0x2b')][_0x47f9('0x47')]()['then'](respondWithResult(_0x3d796c,null))[_0x47f9('0x42')](handleError(_0x3d796c,null));}; \ No newline at end of file +var _0x7163=['key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','params','includeAll','find','create','body','catch','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type'];(function(_0x123af9,_0x9ae1a8){var _0x379fa9=function(_0x306b03){while(--_0x306b03){_0x123af9['push'](_0x123af9['shift']());}};_0x379fa9(++_0x9ae1a8);}(_0x7163,0x1ef));var _0x3716=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x7163[_0xa2c0a3];return _0x52c618;};'use strict';var emlformat=require(_0x3716('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3716('0x1'));var rp=require(_0x3716('0x2'));var moment=require(_0x3716('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3716('0x4'));var util=require(_0x3716('0x5'));var path=require(_0x3716('0x6'));var sox=require(_0x3716('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3716('0x8'));var _=require(_0x3716('0x9'));var squel=require(_0x3716('0xa'));var crypto=require(_0x3716('0xb'));var jsforce=require(_0x3716('0xc'));var deskjs=require(_0x3716('0xd'));var toCsv=require(_0x3716('0xe'));var querystring=require(_0x3716('0xf'));var Papa=require(_0x3716('0x10'));var Redis=require(_0x3716('0x11'));var authService=require(_0x3716('0x12'));var qs=require(_0x3716('0x13'));var as=require(_0x3716('0x14'));var hardwareService=require(_0x3716('0x15'));var logger=require(_0x3716('0x16'))(_0x3716('0x17'));var utils=require(_0x3716('0x18'));var config=require(_0x3716('0x19'));var licenseUtil=require(_0x3716('0x1a'));var db=require(_0x3716('0x1b'))['db'];function respondWithStatusCode(_0x2c32cf,_0x2bbb95){_0x2bbb95=_0x2bbb95||0xcc;return function(_0x21925a){if(_0x21925a){return _0x2c32cf[_0x3716('0x1c')](_0x2bbb95);}return _0x2c32cf[_0x3716('0x1d')](_0x2bbb95)[_0x3716('0x1e')]();};}function respondWithResult(_0xc095c4,_0x131c5a){_0x131c5a=_0x131c5a||0xc8;return function(_0x4d1791){if(_0x4d1791){return _0xc095c4['status'](_0x131c5a)['json'](_0x4d1791);}};}function respondWithFilteredResult(_0x493b7d,_0x372785){return function(_0x5bbc0a){if(_0x5bbc0a){var _0x166835=typeof _0x372785[_0x3716('0x1f')]===_0x3716('0x20')&&typeof _0x372785['limit']==='undefined';var _0x5f3833=_0x5bbc0a['count'];var _0x27fa57=_0x166835?0x0:_0x372785[_0x3716('0x1f')];var _0x5d16c4=_0x166835?_0x5bbc0a[_0x3716('0x21')]:_0x372785[_0x3716('0x1f')]+_0x372785[_0x3716('0x22')];var _0xf6c764;if(_0x5d16c4>=_0x5f3833){_0x5d16c4=_0x5f3833;_0xf6c764=0xc8;}else{_0xf6c764=0xce;}_0x493b7d[_0x3716('0x1d')](_0xf6c764);return _0x493b7d[_0x3716('0x23')](_0x3716('0x24'),_0x27fa57+'-'+_0x5d16c4+'/'+_0x5f3833)['json'](_0x5bbc0a);}return null;};}function patchUpdates(_0x4cd0a6){return function(_0x524db1){try{jsonpatch[_0x3716('0x25')](_0x524db1,_0x4cd0a6,!![]);}catch(_0x49a885){return BPromise[_0x3716('0x26')](_0x49a885);}return _0x524db1[_0x3716('0x27')]();};}function saveUpdates(_0x2cccca,_0x233517){return function(_0x2b5296){if(_0x2b5296){return _0x2b5296[_0x3716('0x28')](_0x2cccca)[_0x3716('0x29')](function(_0x12bc19){return _0x12bc19;});}return null;};}function removeEntity(_0x1f18b2,_0x483bdd){return function(_0xec15ce){if(_0xec15ce){return _0xec15ce[_0x3716('0x2a')]()[_0x3716('0x29')](function(){_0x1f18b2['status'](0xcc)[_0x3716('0x1e')]();});}};}function handleEntityNotFound(_0x3e7452,_0x4daec7){return function(_0x3fd2bf){if(!_0x3fd2bf){_0x3e7452['sendStatus'](0x194);}return _0x3fd2bf;};}function handleError(_0x224451,_0x2c3df6){_0x2c3df6=_0x2c3df6||0x1f4;return function(_0x203310){logger['error'](_0x203310[_0x3716('0x2b')]);if(_0x203310['name']){delete _0x203310[_0x3716('0x2c')];}_0x224451[_0x3716('0x1d')](_0x2c3df6)['send'](_0x203310);};}exports[_0x3716('0x2d')]=function(_0x3dcf6b,_0x1c29b8){var _0xc5211={},_0x1e413c={},_0x4f76dc={'count':0x0,'rows':[]};var _0x2fdfa1=_[_0x3716('0x2e')](db[_0x3716('0x2f')][_0x3716('0x30')],function(_0x4fee70){return{'name':_0x4fee70[_0x3716('0x31')],'type':_0x4fee70[_0x3716('0x32')][_0x3716('0x33')]};});_0x1e413c[_0x3716('0x34')]=_[_0x3716('0x2e')](_0x2fdfa1,'name');_0x1e413c[_0x3716('0x35')]=_[_0x3716('0x36')](_0x3dcf6b[_0x3716('0x35')]);_0x1e413c['filters']=_['intersection'](_0x1e413c[_0x3716('0x34')],_0x1e413c[_0x3716('0x35')]);_0xc5211[_0x3716('0x37')]=_[_0x3716('0x38')](_0x1e413c['model'],qs[_0x3716('0x39')](_0x3dcf6b[_0x3716('0x35')][_0x3716('0x39')]));_0xc5211[_0x3716('0x37')]=_0xc5211[_0x3716('0x37')][_0x3716('0x3a')]?_0xc5211['attributes']:_0x1e413c[_0x3716('0x34')];if(!_0x3dcf6b[_0x3716('0x35')][_0x3716('0x3b')]('nolimit')){_0xc5211['limit']=qs[_0x3716('0x22')](_0x3dcf6b['query'][_0x3716('0x22')]);_0xc5211[_0x3716('0x1f')]=qs[_0x3716('0x1f')](_0x3dcf6b[_0x3716('0x35')][_0x3716('0x1f')]);}_0xc5211[_0x3716('0x3c')]=qs[_0x3716('0x3d')](_0x3dcf6b[_0x3716('0x35')]['sort']);_0xc5211[_0x3716('0x3e')]=qs[_0x3716('0x3f')](_[_0x3716('0x40')](_0x3dcf6b['query'],_0x1e413c[_0x3716('0x3f')]),_0x2fdfa1);if(_0x3dcf6b['query'][_0x3716('0x41')]){_0xc5211[_0x3716('0x3e')]=_[_0x3716('0x42')](_0xc5211[_0x3716('0x3e')],{'$or':_[_0x3716('0x2e')](_0x2fdfa1,function(_0x207d5e){if(_0x207d5e[_0x3716('0x32')]!==_0x3716('0x43')){var _0x4028b9={};_0x4028b9[_0x207d5e[_0x3716('0x2c')]]={'$like':'%'+_0x3dcf6b[_0x3716('0x35')]['filter']+'%'};return _0x4028b9;}})});}_0xc5211=_[_0x3716('0x42')]({},_0xc5211,_0x3dcf6b[_0x3716('0x44')]);var _0xe69c79={'where':_0xc5211[_0x3716('0x3e')]};return db['ChatQueueReport'][_0x3716('0x21')](_0xe69c79)[_0x3716('0x29')](function(_0x48a539){_0x4f76dc[_0x3716('0x21')]=_0x48a539;if(_0x3dcf6b[_0x3716('0x35')]['includeAll']){_0xc5211[_0x3716('0x45')]=[{'all':!![]}];}return db[_0x3716('0x2f')]['findAll'](_0xc5211);})[_0x3716('0x29')](function(_0xe4b86a){_0x4f76dc['rows']=_0xe4b86a;return _0x4f76dc;})[_0x3716('0x29')](respondWithFilteredResult(_0x1c29b8,_0xc5211))['catch'](handleError(_0x1c29b8,null));};exports[_0x3716('0x46')]=function(_0x215ca6,_0x50dabb){var _0x55147c={'raw':!![],'where':{'id':_0x215ca6[_0x3716('0x47')]['id']}},_0x100807={};_0x100807[_0x3716('0x34')]=_['keys'](db[_0x3716('0x2f')][_0x3716('0x30')]);_0x100807['query']=_[_0x3716('0x36')](_0x215ca6['query']);_0x100807[_0x3716('0x3f')]=_[_0x3716('0x38')](_0x100807[_0x3716('0x34')],_0x100807['query']);_0x55147c['attributes']=_[_0x3716('0x38')](_0x100807[_0x3716('0x34')],qs['fields'](_0x215ca6[_0x3716('0x35')][_0x3716('0x39')]));_0x55147c[_0x3716('0x37')]=_0x55147c[_0x3716('0x37')][_0x3716('0x3a')]?_0x55147c[_0x3716('0x37')]:_0x100807[_0x3716('0x34')];if(_0x215ca6['query'][_0x3716('0x48')]){_0x55147c[_0x3716('0x45')]=[{'all':!![]}];}_0x55147c=_[_0x3716('0x42')]({},_0x55147c,_0x215ca6[_0x3716('0x44')]);return db[_0x3716('0x2f')][_0x3716('0x49')](_0x55147c)[_0x3716('0x29')](handleEntityNotFound(_0x50dabb,null))['then'](respondWithResult(_0x50dabb,null))['catch'](handleError(_0x50dabb,null));};exports['create']=function(_0x5b5df8,_0x1ef5da){return db[_0x3716('0x2f')][_0x3716('0x4a')](_0x5b5df8[_0x3716('0x4b')],{})['then'](respondWithResult(_0x1ef5da,0xc9))[_0x3716('0x4c')](handleError(_0x1ef5da,null));};exports['update']=function(_0xf06450,_0x524088){if(_0xf06450[_0x3716('0x4b')]['id']){delete _0xf06450['body']['id'];}return db[_0x3716('0x2f')][_0x3716('0x49')]({'where':{'id':_0xf06450[_0x3716('0x47')]['id']}})[_0x3716('0x29')](handleEntityNotFound(_0x524088,null))[_0x3716('0x29')](saveUpdates(_0xf06450[_0x3716('0x4b')],null))[_0x3716('0x29')](respondWithResult(_0x524088,null))[_0x3716('0x4c')](handleError(_0x524088,null));};exports[_0x3716('0x2a')]=function(_0xca5eca,_0x3f05de){return db['ChatQueueReport']['find']({'where':{'id':_0xca5eca[_0x3716('0x47')]['id']}})[_0x3716('0x29')](handleEntityNotFound(_0x3f05de,null))['then'](removeEntity(_0x3f05de,null))[_0x3716('0x4c')](handleError(_0x3f05de,null));};exports[_0x3716('0x4d')]=function(_0x2e439e,_0x2ae48b){return db[_0x3716('0x2f')]['describe']()[_0x3716('0x29')](respondWithResult(_0x2ae48b,null))[_0x3716('0x4c')](handleError(_0x2ae48b,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b6e5ceb..008e03f 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x116102,_0x2abcbb){var _0x213f03=function(_0x243030){while(--_0x243030){_0x116102['push'](_0x116102['shift']());}};_0x213f03(++_0x2abcbb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'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(_0x27faed,_0x217be4){var _0x2aaeab=function(_0x2e8b17){while(--_0x2e8b17){_0x27faed['push'](_0x27faed['shift']());}};_0x2aaeab(++_0x217be4);}(_0x757a,0xde));var _0xa757=function(_0x14f957,_0x25c3a7){_0x14f957=_0x14f957-0x0;var _0x5af3c8=_0x757a[_0x14f957];return _0x5af3c8;};'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 110d95b..c2eadd0 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 _0x4a37=['limit','UpdateChatQueueReport','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','update'];(function(_0x27a630,_0x3ba6c7){var _0x26a5fb=function(_0x369314){while(--_0x369314){_0x27a630['push'](_0x27a630['shift']());}};_0x26a5fb(++_0x3ba6c7);}(_0x4a37,0x12e));var _0x74a3=function(_0x1d7586,_0x3d5b25){_0x1d7586=_0x1d7586-0x0;var _0x5975db=_0x4a37[_0x1d7586];return _0x5975db;};'use strict';var _=require(_0x74a3('0x0'));var util=require('util');var moment=require(_0x74a3('0x1'));var BPromise=require(_0x74a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a3('0x3'))['db'];var utils=require(_0x74a3('0x4'));var logger=require(_0x74a3('0x5'))('rpc');var config=require(_0x74a3('0x6'));var jayson=require(_0x74a3('0x7'));var client=jayson[_0x74a3('0x8')][_0x74a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x437908,_0x5bdf8c,_0x15d3a1){return new BPromise(function(_0x5ceec8,_0x1acffd){return client[_0x74a3('0xa')](_0x437908,_0x15d3a1)[_0x74a3('0xb')](function(_0x7ade76){logger[_0x74a3('0xc')](_0x74a3('0xd'),_0x5bdf8c,_0x74a3('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5bdf8c,'request\x20sent',JSON[_0x74a3('0xf')](_0x7ade76));if(_0x7ade76[_0x74a3('0x10')]){if(_0x7ade76[_0x74a3('0x10')]['code']===0x1f4){logger['error'](_0x74a3('0xd'),_0x5bdf8c,_0x7ade76['error'][_0x74a3('0x11')]);return _0x1acffd(_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);}logger[_0x74a3('0x10')](_0x74a3('0xd'),_0x5bdf8c,_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);return _0x5ceec8(_0x7ade76[_0x74a3('0x10')][_0x74a3('0x11')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5bdf8c,_0x74a3('0xe'));_0x5ceec8(_0x7ade76[_0x74a3('0x12')]['message']);}})[_0x74a3('0x13')](function(_0x137ad7){logger[_0x74a3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x5bdf8c,_0x137ad7);_0x1acffd(_0x137ad7);});});}exports[_0x74a3('0x14')]=function(_0x3210ae){var _0x14de06=this;return new Promise(function(_0x844d64,_0x14f25e){return db[_0x74a3('0x15')][_0x74a3('0x16')](_0x3210ae[_0x74a3('0x17')],{'raw':_0x3210ae[_0x74a3('0x18')]?_0x3210ae[_0x74a3('0x18')][_0x74a3('0x19')]===undefined?!![]:![]:!![]})[_0x74a3('0xb')](function(_0x4a80c3){logger['info'](_0x74a3('0x14'),_0x3210ae);logger[_0x74a3('0x1a')]('CreateChatQueueReport',_0x3210ae,JSON['stringify'](_0x4a80c3));_0x844d64(_0x4a80c3);})[_0x74a3('0x13')](function(_0x3f7914){logger['error'](_0x74a3('0x14'),_0x3f7914[_0x74a3('0x11')],_0x3210ae);_0x14f25e(_0x14de06[_0x74a3('0x10')](0x1f4,_0x3f7914[_0x74a3('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x454dc9){var _0x1d07c5=this;return new Promise(function(_0x53be10,_0x2fced6){return db['ChatQueueReport'][_0x74a3('0x1b')](_0x454dc9[_0x74a3('0x17')],{'raw':_0x454dc9[_0x74a3('0x18')]?_0x454dc9[_0x74a3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x454dc9['options']?_0x454dc9[_0x74a3('0x18')]['where']||null:null,'attributes':_0x454dc9[_0x74a3('0x18')]?_0x454dc9[_0x74a3('0x18')]['attributes']||null:null,'limit':_0x454dc9['options']?_0x454dc9[_0x74a3('0x18')][_0x74a3('0x1c')]||null:null})[_0x74a3('0xb')](function(_0xca25ff){logger['info'](_0x74a3('0x1d'),_0x454dc9);logger[_0x74a3('0x1a')](_0x74a3('0x1d'),_0x454dc9,JSON[_0x74a3('0xf')](_0xca25ff));_0x53be10(_0xca25ff);})['catch'](function(_0x4fd09a){logger[_0x74a3('0x10')](_0x74a3('0x1d'),_0x4fd09a[_0x74a3('0x11')],_0x454dc9);_0x2fced6(_0x1d07c5[_0x74a3('0x10')](0x1f4,_0x4fd09a[_0x74a3('0x11')]));});});}; \ No newline at end of file +var _0x9829=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','then','UpdateChatQueueReport','update','where','attributes','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info'];(function(_0x93a15c,_0x2ec812){var _0x1e32e4=function(_0x174b05){while(--_0x174b05){_0x93a15c['push'](_0x93a15c['shift']());}};_0x1e32e4(++_0x2ec812);}(_0x9829,0xfb));var _0x9982=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x9829[_0x25c326];return _0x762452;};'use strict';var _=require(_0x9982('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9982('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9982('0x2'));var db=require(_0x9982('0x3'))['db'];var utils=require(_0x9982('0x4'));var logger=require('../../config/logger')(_0x9982('0x5'));var config=require(_0x9982('0x6'));var jayson=require(_0x9982('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44a7f4,_0x45c41d,_0x4b7b7b){return new BPromise(function(_0x3d2209,_0x385713){return client[_0x9982('0x8')](_0x44a7f4,_0x4b7b7b)['then'](function(_0x4cbfd0){logger[_0x9982('0x9')](_0x9982('0xa'),_0x45c41d,_0x9982('0xb'));logger[_0x9982('0xc')](_0x9982('0xd'),_0x45c41d,_0x9982('0xb'),JSON[_0x9982('0xe')](_0x4cbfd0));if(_0x4cbfd0[_0x9982('0xf')]){if(_0x4cbfd0[_0x9982('0xf')]['code']===0x1f4){logger[_0x9982('0xf')](_0x9982('0xa'),_0x45c41d,_0x4cbfd0['error']['message']);return _0x385713(_0x4cbfd0[_0x9982('0xf')]['message']);}logger[_0x9982('0xf')](_0x9982('0xa'),_0x45c41d,_0x4cbfd0[_0x9982('0xf')][_0x9982('0x10')]);return _0x3d2209(_0x4cbfd0[_0x9982('0xf')][_0x9982('0x10')]);}else{logger[_0x9982('0x9')](_0x9982('0xa'),_0x45c41d,_0x9982('0xb'));_0x3d2209(_0x4cbfd0[_0x9982('0x11')][_0x9982('0x10')]);}})[_0x9982('0x12')](function(_0x5598cd){logger[_0x9982('0xf')](_0x9982('0xa'),_0x45c41d,_0x5598cd);_0x385713(_0x5598cd);});});}exports[_0x9982('0x13')]=function(_0xecdd2a){var _0x1368e0=this;return new Promise(function(_0xa0534c,_0x34dc32){return db[_0x9982('0x14')]['create'](_0xecdd2a[_0x9982('0x15')],{'raw':_0xecdd2a['options']?_0xecdd2a[_0x9982('0x16')][_0x9982('0x17')]===undefined?!![]:![]:!![]})[_0x9982('0x18')](function(_0x1e71f9){logger[_0x9982('0x9')](_0x9982('0x13'),_0xecdd2a);logger[_0x9982('0xc')]('CreateChatQueueReport',_0xecdd2a,JSON[_0x9982('0xe')](_0x1e71f9));_0xa0534c(_0x1e71f9);})[_0x9982('0x12')](function(_0x2b5c35){logger[_0x9982('0xf')](_0x9982('0x13'),_0x2b5c35[_0x9982('0x10')],_0xecdd2a);_0x34dc32(_0x1368e0[_0x9982('0xf')](0x1f4,_0x2b5c35[_0x9982('0x10')]));});});};exports[_0x9982('0x19')]=function(_0x358345){var _0x95dd7c=this;return new Promise(function(_0x354ab7,_0x5a0f25){return db[_0x9982('0x14')][_0x9982('0x1a')](_0x358345[_0x9982('0x15')],{'raw':_0x358345[_0x9982('0x16')]?_0x358345[_0x9982('0x16')][_0x9982('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x358345['options']?_0x358345['options'][_0x9982('0x1b')]||null:null,'attributes':_0x358345['options']?_0x358345[_0x9982('0x16')][_0x9982('0x1c')]||null:null,'limit':_0x358345[_0x9982('0x16')]?_0x358345[_0x9982('0x16')]['limit']||null:null})[_0x9982('0x18')](function(_0x1ff242){logger[_0x9982('0x9')](_0x9982('0x19'),_0x358345);logger[_0x9982('0xc')]('UpdateChatQueueReport',_0x358345,JSON[_0x9982('0xe')](_0x1ff242));_0x354ab7(_0x1ff242);})[_0x9982('0x12')](function(_0x868f62){logger[_0x9982('0xf')](_0x9982('0x19'),_0x868f62[_0x9982('0x10')],_0x358345);_0x5a0f25(_0x95dd7c['error'](0x1f4,_0x868f62['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index cab5a2c..a191296 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 _0x7e19=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x431eb9,_0x458e58){var _0x33e92d=function(_0x4ba8f7){while(--_0x4ba8f7){_0x431eb9['push'](_0x431eb9['shift']());}};_0x33e92d(++_0x458e58);}(_0x7e19,0x16c));var _0x97e1=function(_0x4e4a3f,_0x42009f){_0x4e4a3f=_0x4e4a3f-0x0;var _0x3b2b12=_0x7e19[_0x4e4a3f];return _0x3b2b12;};'use strict';var multer=require(_0x97e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x97e1('0x1'));var express=require(_0x97e1('0x2'));var router=express[_0x97e1('0x3')]();var fs_extra=require(_0x97e1('0x4'));var auth=require(_0x97e1('0x5'));var interaction=require(_0x97e1('0x6'));var config=require(_0x97e1('0x7'));var controller=require('./chatQueueReport.controller');router[_0x97e1('0x8')]('/',auth[_0x97e1('0x9')](),controller[_0x97e1('0xa')]);router[_0x97e1('0x8')](_0x97e1('0xb'),auth['isAuthenticated'](),controller[_0x97e1('0xc')]);router[_0x97e1('0x8')](_0x97e1('0xd'),auth['isAuthenticated'](),controller[_0x97e1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x97e1('0xf')]);router['put'](_0x97e1('0xd'),auth[_0x97e1('0x9')](),controller['update']);router[_0x97e1('0x10')]('/:id',auth[_0x97e1('0x9')](),controller[_0x97e1('0x11')]);module[_0x97e1('0x12')]=router; \ No newline at end of file +var _0x10b6=['isAuthenticated','index','/describe','describe','/:id','show','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get'];(function(_0x560497,_0x342635){var _0x6250c1=function(_0x15fd4c){while(--_0x15fd4c){_0x560497['push'](_0x560497['shift']());}};_0x6250c1(++_0x342635);}(_0x10b6,0x172));var _0x610b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x10b6[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x610b('0x0'));var util=require(_0x610b('0x1'));var path=require(_0x610b('0x2'));var timeout=require(_0x610b('0x3'));var express=require('express');var router=express[_0x610b('0x4')]();var fs_extra=require(_0x610b('0x5'));var auth=require(_0x610b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x610b('0x7'));var controller=require(_0x610b('0x8'));router[_0x610b('0x9')]('/',auth[_0x610b('0xa')](),controller[_0x610b('0xb')]);router[_0x610b('0x9')](_0x610b('0xc'),auth['isAuthenticated'](),controller[_0x610b('0xd')]);router[_0x610b('0x9')](_0x610b('0xe'),auth[_0x610b('0xa')](),controller[_0x610b('0xf')]);router['post']('/',auth[_0x610b('0xa')](),controller['create']);router[_0x610b('0x10')](_0x610b('0xe'),auth[_0x610b('0xa')](),controller['update']);router['delete'](_0x610b('0xe'),auth[_0x610b('0xa')](),controller[_0x610b('0x11')]);module[_0x610b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 30edc6c..373898b 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x28112b,_0xcbf761){_0x28112b=_0x28112b-0x0;var _0x4bb2c5=_0xb43b[_0x28112b];return _0x4bb2c5;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x54ef,0x112));var _0xf54e=function(_0x34731d,_0x2660af){_0x34731d=_0x34731d-0x0;var _0x2f379e=_0x54ef[_0x34731d];return _0x2f379e;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4946c60..40a49a5 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 _0x15ff=['ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatTransferReport','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x4209e1,_0x571956){var _0x6241a8=function(_0x48512f){while(--_0x48512f){_0x4209e1['push'](_0x4209e1['shift']());}};_0x6241a8(++_0x571956);}(_0x15ff,0xcd));var _0xf15f=function(_0x4d0d85,_0x3250d3){_0x4d0d85=_0x4d0d85-0x0;var _0x290a74=_0x15ff[_0x4d0d85];return _0x290a74;};'use strict';var emlformat=require(_0xf15f('0x0'));var rimraf=require(_0xf15f('0x1'));var zipdir=require(_0xf15f('0x2'));var jsonpatch=require(_0xf15f('0x3'));var rp=require(_0xf15f('0x4'));var moment=require(_0xf15f('0x5'));var BPromise=require(_0xf15f('0x6'));var Mustache=require(_0xf15f('0x7'));var util=require(_0xf15f('0x8'));var path=require(_0xf15f('0x9'));var sox=require('sox');var csv=require(_0xf15f('0xa'));var ejs=require(_0xf15f('0xb'));var fs=require('fs');var fs_extra=require(_0xf15f('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf15f('0xd'));var jsforce=require(_0xf15f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf15f('0xa'));var querystring=require(_0xf15f('0xf'));var Papa=require('papaparse');var Redis=require(_0xf15f('0x10'));var authService=require(_0xf15f('0x11'));var qs=require(_0xf15f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15f('0x13'));var logger=require('../../config/logger')(_0xf15f('0x14'));var utils=require(_0xf15f('0x15'));var config=require(_0xf15f('0x16'));var licenseUtil=require(_0xf15f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b4745,_0x400932){_0x400932=_0x400932||0xcc;return function(_0x3e323f){if(_0x3e323f){return _0x3b4745['sendStatus'](_0x400932);}return _0x3b4745[_0xf15f('0x18')](_0x400932)[_0xf15f('0x19')]();};}function respondWithResult(_0x546274,_0x4c3148){_0x4c3148=_0x4c3148||0xc8;return function(_0x4b7326){if(_0x4b7326){return _0x546274[_0xf15f('0x18')](_0x4c3148)[_0xf15f('0x1a')](_0x4b7326);}};}function respondWithFilteredResult(_0x452c1b,_0x447336){return function(_0x5f3ece){if(_0x5f3ece){var _0x41efd3=typeof _0x447336[_0xf15f('0x1b')]==='undefined'&&typeof _0x447336[_0xf15f('0x1c')]==='undefined';var _0x5ea5a8=_0x5f3ece[_0xf15f('0x1d')];var _0x83403d=_0x41efd3?0x0:_0x447336['offset'];var _0x9c0ef9=_0x41efd3?_0x5f3ece[_0xf15f('0x1d')]:_0x447336[_0xf15f('0x1b')]+_0x447336[_0xf15f('0x1c')];var _0x5b0959;if(_0x9c0ef9>=_0x5ea5a8){_0x9c0ef9=_0x5ea5a8;_0x5b0959=0xc8;}else{_0x5b0959=0xce;}_0x452c1b[_0xf15f('0x18')](_0x5b0959);return _0x452c1b[_0xf15f('0x1e')](_0xf15f('0x1f'),_0x83403d+'-'+_0x9c0ef9+'/'+_0x5ea5a8)[_0xf15f('0x1a')](_0x5f3ece);}return null;};}function patchUpdates(_0x12f7db){return function(_0x562657){try{jsonpatch['apply'](_0x562657,_0x12f7db,!![]);}catch(_0x4a187a){return BPromise['reject'](_0x4a187a);}return _0x562657[_0xf15f('0x20')]();};}function saveUpdates(_0x51ea19,_0x3f3585){return function(_0x2cb01b){if(_0x2cb01b){return _0x2cb01b[_0xf15f('0x21')](_0x51ea19)[_0xf15f('0x22')](function(_0x3ca2bf){return _0x3ca2bf;});}return null;};}function removeEntity(_0x150b6d,_0x507de2){return function(_0x53b9d9){if(_0x53b9d9){return _0x53b9d9[_0xf15f('0x23')]()[_0xf15f('0x22')](function(){_0x150b6d['status'](0xcc)[_0xf15f('0x19')]();});}};}function handleEntityNotFound(_0x448ffe,_0x3029c1){return function(_0x38ecec){if(!_0x38ecec){_0x448ffe['sendStatus'](0x194);}return _0x38ecec;};}function handleError(_0x582d63,_0x1f6f28){_0x1f6f28=_0x1f6f28||0x1f4;return function(_0x33dbf5){logger[_0xf15f('0x24')](_0x33dbf5['stack']);if(_0x33dbf5['name']){delete _0x33dbf5[_0xf15f('0x25')];}_0x582d63[_0xf15f('0x18')](_0x1f6f28)[_0xf15f('0x26')](_0x33dbf5);};}exports['index']=function(_0x2f0833,_0x4aa3cb){var _0x23adc9={},_0x5c9d36={},_0x15a171={'count':0x0,'rows':[]};var _0x3a7afa=_[_0xf15f('0x27')](db['ChatTransferReport'][_0xf15f('0x28')],function(_0x49bcb4){return{'name':_0x49bcb4[_0xf15f('0x29')],'type':_0x49bcb4[_0xf15f('0x2a')][_0xf15f('0x2b')]};});_0x5c9d36['model']=_[_0xf15f('0x27')](_0x3a7afa,_0xf15f('0x25'));_0x5c9d36['query']=_['keys'](_0x2f0833[_0xf15f('0x2c')]);_0x5c9d36[_0xf15f('0x2d')]=_[_0xf15f('0x2e')](_0x5c9d36[_0xf15f('0x2f')],_0x5c9d36[_0xf15f('0x2c')]);_0x23adc9[_0xf15f('0x30')]=_[_0xf15f('0x2e')](_0x5c9d36[_0xf15f('0x2f')],qs['fields'](_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x31')]));_0x23adc9[_0xf15f('0x30')]=_0x23adc9[_0xf15f('0x30')][_0xf15f('0x32')]?_0x23adc9[_0xf15f('0x30')]:_0x5c9d36[_0xf15f('0x2f')];if(!_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x33')](_0xf15f('0x34'))){_0x23adc9[_0xf15f('0x1c')]=qs[_0xf15f('0x1c')](_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x1c')]);_0x23adc9[_0xf15f('0x1b')]=qs['offset'](_0x2f0833['query'][_0xf15f('0x1b')]);}_0x23adc9[_0xf15f('0x35')]=qs[_0xf15f('0x36')](_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x36')]);_0x23adc9[_0xf15f('0x37')]=qs['filters'](_[_0xf15f('0x38')](_0x2f0833[_0xf15f('0x2c')],_0x5c9d36[_0xf15f('0x2d')]),_0x3a7afa);if(_0x2f0833[_0xf15f('0x2c')]['filter']){_0x23adc9[_0xf15f('0x37')]=_[_0xf15f('0x39')](_0x23adc9[_0xf15f('0x37')],{'$or':_[_0xf15f('0x27')](_0x3a7afa,function(_0x53e4a8){if(_0x53e4a8['type']!==_0xf15f('0x3a')){var _0x17c7c6={};_0x17c7c6[_0x53e4a8['name']]={'$like':'%'+_0x2f0833[_0xf15f('0x2c')][_0xf15f('0x3b')]+'%'};return _0x17c7c6;}})});}_0x23adc9=_[_0xf15f('0x39')]({},_0x23adc9,_0x2f0833[_0xf15f('0x3c')]);var _0xcf862f={'where':_0x23adc9[_0xf15f('0x37')]};return db['ChatTransferReport'][_0xf15f('0x1d')](_0xcf862f)['then'](function(_0x55debf){_0x15a171['count']=_0x55debf;if(_0x2f0833['query']['includeAll']){_0x23adc9['include']=[{'all':!![]}];}return db[_0xf15f('0x3d')][_0xf15f('0x3e')](_0x23adc9);})[_0xf15f('0x22')](function(_0x2ac88f){_0x15a171[_0xf15f('0x3f')]=_0x2ac88f;return _0x15a171;})[_0xf15f('0x22')](respondWithFilteredResult(_0x4aa3cb,_0x23adc9))[_0xf15f('0x40')](handleError(_0x4aa3cb,null));};exports['show']=function(_0xf9de9c,_0x388f9d){var _0x10cf27={'raw':!![],'where':{'id':_0xf9de9c[_0xf15f('0x41')]['id']}},_0xa0317a={};_0xa0317a['model']=_[_0xf15f('0x42')](db[_0xf15f('0x3d')][_0xf15f('0x28')]);_0xa0317a[_0xf15f('0x2c')]=_[_0xf15f('0x42')](_0xf9de9c[_0xf15f('0x2c')]);_0xa0317a['filters']=_[_0xf15f('0x2e')](_0xa0317a['model'],_0xa0317a[_0xf15f('0x2c')]);_0x10cf27[_0xf15f('0x30')]=_['intersection'](_0xa0317a['model'],qs[_0xf15f('0x31')](_0xf9de9c[_0xf15f('0x2c')][_0xf15f('0x31')]));_0x10cf27[_0xf15f('0x30')]=_0x10cf27[_0xf15f('0x30')][_0xf15f('0x32')]?_0x10cf27[_0xf15f('0x30')]:_0xa0317a['model'];if(_0xf9de9c['query'][_0xf15f('0x43')]){_0x10cf27['include']=[{'all':!![]}];}_0x10cf27=_[_0xf15f('0x39')]({},_0x10cf27,_0xf9de9c[_0xf15f('0x3c')]);return db[_0xf15f('0x3d')][_0xf15f('0x44')](_0x10cf27)[_0xf15f('0x22')](handleEntityNotFound(_0x388f9d,null))[_0xf15f('0x22')](respondWithResult(_0x388f9d,null))[_0xf15f('0x40')](handleError(_0x388f9d,null));};exports['create']=function(_0x33265c,_0x457675){return db[_0xf15f('0x3d')][_0xf15f('0x45')](_0x33265c[_0xf15f('0x46')],{})['then'](respondWithResult(_0x457675,0xc9))[_0xf15f('0x40')](handleError(_0x457675,null));};exports['update']=function(_0x24c56f,_0x42626b){if(_0x24c56f['body']['id']){delete _0x24c56f[_0xf15f('0x46')]['id'];}return db['ChatTransferReport'][_0xf15f('0x44')]({'where':{'id':_0x24c56f[_0xf15f('0x41')]['id']}})[_0xf15f('0x22')](handleEntityNotFound(_0x42626b,null))['then'](saveUpdates(_0x24c56f['body'],null))['then'](respondWithResult(_0x42626b,null))[_0xf15f('0x40')](handleError(_0x42626b,null));};exports['destroy']=function(_0x4031bd,_0x9b0da3){return db[_0xf15f('0x3d')]['find']({'where':{'id':_0x4031bd['params']['id']}})[_0xf15f('0x22')](handleEntityNotFound(_0x9b0da3,null))[_0xf15f('0x22')](removeEntity(_0x9b0da3,null))['catch'](handleError(_0x9b0da3,null));};exports[_0xf15f('0x47')]=function(_0x3e7e33,_0x3f40c2){return db[_0xf15f('0x3d')][_0xf15f('0x47')]()[_0xf15f('0x22')](respondWithResult(_0x3f40c2,null))[_0xf15f('0x40')](handleError(_0x3f40c2,null));}; \ No newline at end of file +var _0xdab4=['error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','filters','options','create','body','find','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','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x4b39ec,_0x26ae2a){var _0x574102=function(_0x1e9d24){while(--_0x1e9d24){_0x4b39ec['push'](_0x4b39ec['shift']());}};_0x574102(++_0x26ae2a);}(_0xdab4,0x11a));var _0x4dab=function(_0x3619f0,_0x393b23){_0x3619f0=_0x3619f0-0x0;var _0x369c02=_0xdab4[_0x3619f0];return _0x369c02;};'use strict';var emlformat=require(_0x4dab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dab('0x1'));var jsonpatch=require(_0x4dab('0x2'));var rp=require(_0x4dab('0x3'));var moment=require(_0x4dab('0x4'));var BPromise=require(_0x4dab('0x5'));var Mustache=require(_0x4dab('0x6'));var util=require(_0x4dab('0x7'));var path=require(_0x4dab('0x8'));var sox=require(_0x4dab('0x9'));var csv=require('to-csv');var ejs=require(_0x4dab('0xa'));var fs=require('fs');var fs_extra=require(_0x4dab('0xb'));var _=require(_0x4dab('0xc'));var squel=require(_0x4dab('0xd'));var crypto=require(_0x4dab('0xe'));var jsforce=require(_0x4dab('0xf'));var deskjs=require(_0x4dab('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4dab('0x11'));var Papa=require(_0x4dab('0x12'));var Redis=require('ioredis');var authService=require(_0x4dab('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4dab('0x14'));var hardwareService=require(_0x4dab('0x15'));var logger=require(_0x4dab('0x16'))('api');var utils=require(_0x4dab('0x17'));var config=require(_0x4dab('0x18'));var licenseUtil=require(_0x4dab('0x19'));var db=require(_0x4dab('0x1a'))['db'];function respondWithStatusCode(_0x47d367,_0x51c024){_0x51c024=_0x51c024||0xcc;return function(_0x127b40){if(_0x127b40){return _0x47d367[_0x4dab('0x1b')](_0x51c024);}return _0x47d367['status'](_0x51c024)[_0x4dab('0x1c')]();};}function respondWithResult(_0x5b07dd,_0x2750db){_0x2750db=_0x2750db||0xc8;return function(_0x395fda){if(_0x395fda){return _0x5b07dd[_0x4dab('0x1d')](_0x2750db)[_0x4dab('0x1e')](_0x395fda);}};}function respondWithFilteredResult(_0x4cec35,_0x55743e){return function(_0x4b3019){if(_0x4b3019){var _0x7f4222=typeof _0x55743e[_0x4dab('0x1f')]===_0x4dab('0x20')&&typeof _0x55743e['limit']==='undefined';var _0x93d100=_0x4b3019[_0x4dab('0x21')];var _0x595864=_0x7f4222?0x0:_0x55743e[_0x4dab('0x1f')];var _0x4c6e11=_0x7f4222?_0x4b3019[_0x4dab('0x21')]:_0x55743e['offset']+_0x55743e[_0x4dab('0x22')];var _0x1b422f;if(_0x4c6e11>=_0x93d100){_0x4c6e11=_0x93d100;_0x1b422f=0xc8;}else{_0x1b422f=0xce;}_0x4cec35[_0x4dab('0x1d')](_0x1b422f);return _0x4cec35[_0x4dab('0x23')](_0x4dab('0x24'),_0x595864+'-'+_0x4c6e11+'/'+_0x93d100)[_0x4dab('0x1e')](_0x4b3019);}return null;};}function patchUpdates(_0x95a064){return function(_0x53e814){try{jsonpatch[_0x4dab('0x25')](_0x53e814,_0x95a064,!![]);}catch(_0x1fd2a7){return BPromise[_0x4dab('0x26')](_0x1fd2a7);}return _0x53e814['save']();};}function saveUpdates(_0x21fd93,_0x37549a){return function(_0x4dd0f3){if(_0x4dd0f3){return _0x4dd0f3[_0x4dab('0x27')](_0x21fd93)[_0x4dab('0x28')](function(_0x3c5077){return _0x3c5077;});}return null;};}function removeEntity(_0x17ab24,_0x269cb0){return function(_0xfc646b){if(_0xfc646b){return _0xfc646b[_0x4dab('0x29')]()[_0x4dab('0x28')](function(){_0x17ab24[_0x4dab('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc834,_0x983dec){return function(_0x34ce06){if(!_0x34ce06){_0x4dc834[_0x4dab('0x1b')](0x194);}return _0x34ce06;};}function handleError(_0x34da6a,_0x20d922){_0x20d922=_0x20d922||0x1f4;return function(_0x10925f){logger[_0x4dab('0x2a')](_0x10925f[_0x4dab('0x2b')]);if(_0x10925f['name']){delete _0x10925f[_0x4dab('0x2c')];}_0x34da6a[_0x4dab('0x1d')](_0x20d922)[_0x4dab('0x2d')](_0x10925f);};}exports[_0x4dab('0x2e')]=function(_0x37450c,_0x2b2e68){var _0x3f88d5={},_0x5c913c={},_0xfff2a0={'count':0x0,'rows':[]};var _0x2e5387=_[_0x4dab('0x2f')](db[_0x4dab('0x30')][_0x4dab('0x31')],function(_0x5baab8){return{'name':_0x5baab8[_0x4dab('0x32')],'type':_0x5baab8[_0x4dab('0x33')][_0x4dab('0x34')]};});_0x5c913c['model']=_[_0x4dab('0x2f')](_0x2e5387,_0x4dab('0x2c'));_0x5c913c['query']=_['keys'](_0x37450c[_0x4dab('0x35')]);_0x5c913c['filters']=_[_0x4dab('0x36')](_0x5c913c[_0x4dab('0x37')],_0x5c913c[_0x4dab('0x35')]);_0x3f88d5['attributes']=_['intersection'](_0x5c913c[_0x4dab('0x37')],qs[_0x4dab('0x38')](_0x37450c[_0x4dab('0x35')]['fields']));_0x3f88d5[_0x4dab('0x39')]=_0x3f88d5[_0x4dab('0x39')][_0x4dab('0x3a')]?_0x3f88d5['attributes']:_0x5c913c[_0x4dab('0x37')];if(!_0x37450c[_0x4dab('0x35')][_0x4dab('0x3b')]('nolimit')){_0x3f88d5['limit']=qs[_0x4dab('0x22')](_0x37450c[_0x4dab('0x35')][_0x4dab('0x22')]);_0x3f88d5[_0x4dab('0x1f')]=qs[_0x4dab('0x1f')](_0x37450c['query'][_0x4dab('0x1f')]);}_0x3f88d5[_0x4dab('0x3c')]=qs[_0x4dab('0x3d')](_0x37450c[_0x4dab('0x35')][_0x4dab('0x3d')]);_0x3f88d5['where']=qs['filters'](_[_0x4dab('0x3e')](_0x37450c[_0x4dab('0x35')],_0x5c913c['filters']),_0x2e5387);if(_0x37450c[_0x4dab('0x35')][_0x4dab('0x3f')]){_0x3f88d5['where']=_[_0x4dab('0x40')](_0x3f88d5[_0x4dab('0x41')],{'$or':_['map'](_0x2e5387,function(_0x2d2340){if(_0x2d2340[_0x4dab('0x33')]!==_0x4dab('0x42')){var _0x172993={};_0x172993[_0x2d2340['name']]={'$like':'%'+_0x37450c[_0x4dab('0x35')]['filter']+'%'};return _0x172993;}})});}_0x3f88d5=_[_0x4dab('0x40')]({},_0x3f88d5,_0x37450c['options']);var _0x27114e={'where':_0x3f88d5[_0x4dab('0x41')]};return db['ChatTransferReport'][_0x4dab('0x21')](_0x27114e)[_0x4dab('0x28')](function(_0x134b92){_0xfff2a0['count']=_0x134b92;if(_0x37450c[_0x4dab('0x35')][_0x4dab('0x43')]){_0x3f88d5[_0x4dab('0x44')]=[{'all':!![]}];}return db[_0x4dab('0x30')][_0x4dab('0x45')](_0x3f88d5);})[_0x4dab('0x28')](function(_0x477120){_0xfff2a0[_0x4dab('0x46')]=_0x477120;return _0xfff2a0;})['then'](respondWithFilteredResult(_0x2b2e68,_0x3f88d5))[_0x4dab('0x47')](handleError(_0x2b2e68,null));};exports[_0x4dab('0x48')]=function(_0x41195f,_0x2798c9){var _0x71a014={'raw':!![],'where':{'id':_0x41195f[_0x4dab('0x49')]['id']}},_0x490bd9={};_0x490bd9['model']=_['keys'](db['ChatTransferReport'][_0x4dab('0x31')]);_0x490bd9[_0x4dab('0x35')]=_[_0x4dab('0x4a')](_0x41195f['query']);_0x490bd9[_0x4dab('0x4b')]=_[_0x4dab('0x36')](_0x490bd9['model'],_0x490bd9['query']);_0x71a014[_0x4dab('0x39')]=_[_0x4dab('0x36')](_0x490bd9[_0x4dab('0x37')],qs[_0x4dab('0x38')](_0x41195f['query'][_0x4dab('0x38')]));_0x71a014[_0x4dab('0x39')]=_0x71a014['attributes'][_0x4dab('0x3a')]?_0x71a014[_0x4dab('0x39')]:_0x490bd9[_0x4dab('0x37')];if(_0x41195f['query'][_0x4dab('0x43')]){_0x71a014['include']=[{'all':!![]}];}_0x71a014=_[_0x4dab('0x40')]({},_0x71a014,_0x41195f[_0x4dab('0x4c')]);return db[_0x4dab('0x30')]['find'](_0x71a014)[_0x4dab('0x28')](handleEntityNotFound(_0x2798c9,null))[_0x4dab('0x28')](respondWithResult(_0x2798c9,null))[_0x4dab('0x47')](handleError(_0x2798c9,null));};exports[_0x4dab('0x4d')]=function(_0xa414b5,_0x429adf){return db[_0x4dab('0x30')]['create'](_0xa414b5[_0x4dab('0x4e')],{})[_0x4dab('0x28')](respondWithResult(_0x429adf,0xc9))[_0x4dab('0x47')](handleError(_0x429adf,null));};exports[_0x4dab('0x27')]=function(_0x18d84a,_0x733de){if(_0x18d84a['body']['id']){delete _0x18d84a[_0x4dab('0x4e')]['id'];}return db[_0x4dab('0x30')]['find']({'where':{'id':_0x18d84a[_0x4dab('0x49')]['id']}})[_0x4dab('0x28')](handleEntityNotFound(_0x733de,null))['then'](saveUpdates(_0x18d84a['body'],null))[_0x4dab('0x28')](respondWithResult(_0x733de,null))['catch'](handleError(_0x733de,null));};exports[_0x4dab('0x29')]=function(_0x5dff65,_0x36e5ed){return db['ChatTransferReport'][_0x4dab('0x4f')]({'where':{'id':_0x5dff65['params']['id']}})['then'](handleEntityNotFound(_0x36e5ed,null))[_0x4dab('0x28')](removeEntity(_0x36e5ed,null))[_0x4dab('0x47')](handleError(_0x36e5ed,null));};exports[_0x4dab('0x50')]=function(_0x1eb3a2,_0x416323){return db['ChatTransferReport'][_0x4dab('0x50')]()[_0x4dab('0x28')](respondWithResult(_0x416323,null))[_0x4dab('0x47')](handleError(_0x416323,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e13e15b..77d10cf 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 _0xbe0d=['rimraf','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbe0d,0x11a));var _0xdbe0=function(_0x2477b1,_0x3aedce){_0x2477b1=_0x2477b1-0x0;var _0x349bf7=_0xbe0d[_0x2477b1];return _0x349bf7;};'use strict';var _=require(_0xdbe0('0x0'));var util=require(_0xdbe0('0x1'));var logger=require(_0xdbe0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdbe0('0x3'));var rp=require(_0xdbe0('0x4'));var fs=require('fs');var path=require(_0xdbe0('0x5'));var rimraf=require(_0xdbe0('0x6'));var config=require('../../config/environment');var attributes=require(_0xdbe0('0x7'));module[_0xdbe0('0x8')]=function(_0x4a5479,_0x5878c2){return _0x4a5479[_0xdbe0('0x9')]('ChatTransferReport',attributes,{'tableName':_0xdbe0('0xa'),'paranoid':![],'indexes':[{'name':_0xdbe0('0xb'),'fields':[_0xdbe0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa1=['api','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x27d217,_0x475037){var _0x5cef01=function(_0x1f66a3){while(--_0x1f66a3){_0x27d217['push'](_0x27d217['shift']());}};_0x5cef01(++_0x475037);}(_0xcfa1,0x80));var _0x1cfa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcfa1[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x1cfa('0x0'));var util=require(_0x1cfa('0x1'));var logger=require('../../config/logger')(_0x1cfa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1cfa('0x3'));var fs=require('fs');var path=require(_0x1cfa('0x4'));var rimraf=require(_0x1cfa('0x5'));var config=require(_0x1cfa('0x6'));var attributes=require(_0x1cfa('0x7'));module[_0x1cfa('0x8')]=function(_0x2a793c,_0xd5a873){return _0x2a793c[_0x1cfa('0x9')](_0x1cfa('0xa'),attributes,{'tableName':_0x1cfa('0xb'),'paranoid':![],'indexes':[{'name':_0x1cfa('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 7cb7c13..2dbffd7 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 _0x9967=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','result','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x9967,0x86));var _0x7996=function(_0x31b9ca,_0x48585d){_0x31b9ca=_0x31b9ca-0x0;var _0x26ad47=_0x9967[_0x31b9ca];return _0x26ad47;};'use strict';var _=require(_0x7996('0x0'));var util=require('util');var moment=require(_0x7996('0x1'));var BPromise=require(_0x7996('0x2'));var rs=require(_0x7996('0x3'));var fs=require('fs');var Redis=require(_0x7996('0x4'));var db=require(_0x7996('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7996('0x6'));var client=jayson[_0x7996('0x7')][_0x7996('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9503a3,_0x3025da,_0x4d999d){return new BPromise(function(_0x581d4a,_0x887389){return client[_0x7996('0x9')](_0x9503a3,_0x4d999d)[_0x7996('0xa')](function(_0x59c3f6){logger[_0x7996('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x3025da,_0x7996('0xc'));logger['debug'](_0x7996('0xd'),_0x3025da,_0x7996('0xc'),JSON[_0x7996('0xe')](_0x59c3f6));if(_0x59c3f6[_0x7996('0xf')]){if(_0x59c3f6[_0x7996('0xf')][_0x7996('0x10')]===0x1f4){logger[_0x7996('0xf')](_0x7996('0x11'),_0x3025da,_0x59c3f6[_0x7996('0xf')]['message']);return _0x887389(_0x59c3f6[_0x7996('0xf')]['message']);}logger['error'](_0x7996('0x11'),_0x3025da,_0x59c3f6['error']['message']);return _0x581d4a(_0x59c3f6['error']['message']);}else{logger[_0x7996('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x3025da,_0x7996('0xc'));_0x581d4a(_0x59c3f6[_0x7996('0x12')][_0x7996('0x13')]);}})[_0x7996('0x14')](function(_0x4dadad){logger['error'](_0x7996('0x11'),_0x3025da,_0x4dadad);_0x887389(_0x4dadad);});});} \ No newline at end of file +var _0x01de=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x35a049,_0x58e987){var _0x272abc=function(_0x1cf89a){while(--_0x1cf89a){_0x35a049['push'](_0x35a049['shift']());}};_0x272abc(++_0x58e987);}(_0x01de,0x81));var _0xe01d=function(_0x3b3f6c,_0x3315f4){_0x3b3f6c=_0x3b3f6c-0x0;var _0x1b7f33=_0x01de[_0x3b3f6c];return _0x1b7f33;};'use strict';var _=require('lodash');var util=require(_0xe01d('0x0'));var moment=require(_0xe01d('0x1'));var BPromise=require(_0xe01d('0x2'));var rs=require(_0xe01d('0x3'));var fs=require('fs');var Redis=require(_0xe01d('0x4'));var db=require(_0xe01d('0x5'))['db'];var utils=require(_0xe01d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe01d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe01d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21ba82,_0x5b3503,_0x5f0bad){return new BPromise(function(_0x2a857b,_0x27f92e){return client[_0xe01d('0x9')](_0x21ba82,_0x5f0bad)[_0xe01d('0xa')](function(_0x113738){logger[_0xe01d('0xb')](_0xe01d('0xc'),_0x5b3503,_0xe01d('0xd'));logger[_0xe01d('0xe')](_0xe01d('0xf'),_0x5b3503,'request\x20sent',JSON[_0xe01d('0x10')](_0x113738));if(_0x113738[_0xe01d('0x11')]){if(_0x113738[_0xe01d('0x11')][_0xe01d('0x12')]===0x1f4){logger[_0xe01d('0x11')](_0xe01d('0xc'),_0x5b3503,_0x113738[_0xe01d('0x11')][_0xe01d('0x13')]);return _0x27f92e(_0x113738[_0xe01d('0x11')][_0xe01d('0x13')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5b3503,_0x113738['error']['message']);return _0x2a857b(_0x113738['error'][_0xe01d('0x13')]);}else{logger[_0xe01d('0xb')](_0xe01d('0xc'),_0x5b3503,_0xe01d('0xd'));_0x2a857b(_0x113738[_0xe01d('0x14')][_0xe01d('0x13')]);}})[_0xe01d('0x15')](function(_0x317b40){logger[_0xe01d('0x11')](_0xe01d('0xc'),_0x5b3503,_0x317b40);_0x27f92e(_0x317b40);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 06ee983..ef8d2bb 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 _0x4bdc=['index','/describe','describe','show','create','put','/:id','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x51e18a,_0x1f1dcc){var _0x375376=function(_0x43002c){while(--_0x43002c){_0x51e18a['push'](_0x51e18a['shift']());}};_0x375376(++_0x1f1dcc);}(_0x4bdc,0x1d7));var _0xc4bd=function(_0x13f9c0,_0x287bd4){_0x13f9c0=_0x13f9c0-0x0;var _0x100b86=_0x4bdc[_0x13f9c0];return _0x100b86;};'use strict';var multer=require('multer');var util=require(_0xc4bd('0x0'));var path=require(_0xc4bd('0x1'));var timeout=require(_0xc4bd('0x2'));var express=require(_0xc4bd('0x3'));var router=express[_0xc4bd('0x4')]();var fs_extra=require(_0xc4bd('0x5'));var auth=require(_0xc4bd('0x6'));var interaction=require(_0xc4bd('0x7'));var config=require(_0xc4bd('0x8'));var controller=require(_0xc4bd('0x9'));router[_0xc4bd('0xa')]('/',auth[_0xc4bd('0xb')](),controller[_0xc4bd('0xc')]);router[_0xc4bd('0xa')](_0xc4bd('0xd'),auth[_0xc4bd('0xb')](),controller[_0xc4bd('0xe')]);router[_0xc4bd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc4bd('0xf')]);router['post']('/',auth[_0xc4bd('0xb')](),controller[_0xc4bd('0x10')]);router[_0xc4bd('0x11')](_0xc4bd('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xc4bd('0x13')](_0xc4bd('0x12'),auth[_0xc4bd('0xb')](),controller['destroy']);module[_0xc4bd('0x14')]=router; \ No newline at end of file +var _0x25a4=['/:id','show','isAuthenticated','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','/describe','describe','get'];(function(_0x3f3bd7,_0x361f3b){var _0x688ea2=function(_0x419d9c){while(--_0x419d9c){_0x3f3bd7['push'](_0x3f3bd7['shift']());}};_0x688ea2(++_0x361f3b);}(_0x25a4,0x9b));var _0x425a=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x25a4[_0x9df060];return _0x338dfe;};'use strict';var multer=require('multer');var util=require(_0x425a('0x0'));var path=require(_0x425a('0x1'));var timeout=require(_0x425a('0x2'));var express=require(_0x425a('0x3'));var router=express[_0x425a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x425a('0x5'));var interaction=require(_0x425a('0x6'));var config=require(_0x425a('0x7'));var controller=require(_0x425a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x425a('0x9')]);router['get'](_0x425a('0xa'),auth['isAuthenticated'](),controller[_0x425a('0xb')]);router[_0x425a('0xc')](_0x425a('0xd'),auth['isAuthenticated'](),controller[_0x425a('0xe')]);router['post']('/',auth[_0x425a('0xf')](),controller[_0x425a('0x10')]);router[_0x425a('0x11')](_0x425a('0xd'),auth[_0x425a('0xf')](),controller[_0x425a('0x12')]);router[_0x425a('0x13')](_0x425a('0xd'),auth[_0x425a('0xf')](),controller[_0x425a('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 018f542..3d904fd 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 _0xd008=['parse','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Feedback','star','input','name','getDataValue','onlineForm'];(function(_0x296da0,_0x4d4ea8){var _0x816ff3=function(_0x52d1ff){while(--_0x52d1ff){_0x296da0['push'](_0x296da0['shift']());}};_0x816ff3(++_0x4d4ea8);}(_0xd008,0xa8));var _0x8d00=function(_0x1a4549,_0xd9e730){_0x1a4549=_0x1a4549-0x0;var _0xca9a7f=_0xd008[_0x1a4549];return _0xca9a7f;};'use strict';var Sequelize=require(_0x8d00('0x0'));var rs=require(_0x8d00('0x1'));module[_0x8d00('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8d00('0x3')]},'mapKey':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x4')},'mapKeyOffline':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x5')},'customerAlias':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8d00('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8d00('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8d00('0x9')](_0x8d00('0xa'),_0x8d00('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0xc')},'download_transcript':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8d00('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8d00('0xf')]},'closingQuestion':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x12')},'placeholderMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x13')},'closingMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x16')},'ratingType':{'type':Sequelize[_0x8d00('0x9')](_0x8d00('0x17'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x8d00('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8d00('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8d00('0x18'),'variable':null,'config':{'placeholder':_0x8d00('0x19'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8d00('0x18'),'props':{'title':_0x8d00('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8d00('0x4'),'type':_0x8d00('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8d00('0x1a')](_0x8d00('0x1b'))?JSON[_0x8d00('0x1c')](this[_0x8d00('0x1a')](_0x8d00('0x1b'))):{};},'set':function(_0x41d2a7){return this['setDataValue']('onlineForm',JSON[_0x8d00('0x1d')](_0x41d2a7));}},'offlineForm':{'type':Sequelize[_0x8d00('0xf')],'defaultValue':function(){return JSON[_0x8d00('0x1d')]({'items':[{'type':_0x8d00('0x18'),'props':{'title':_0x8d00('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8d00('0x4'),'type':_0x8d00('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x8d00('0x1e')},'props':{'title':_0x8d00('0x1e'),'helpText':_0x8d00('0x1f')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8d00('0x20'))?JSON[_0x8d00('0x1c')](this[_0x8d00('0x1a')](_0x8d00('0x20'))):{};},'set':function(_0x7b27cb){return this['setDataValue'](_0x8d00('0x20'),JSON[_0x8d00('0x1d')](_0x7b27cb));}},'token':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':function(){return rs[_0x8d00('0x21')]();}},'autoclose':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8d00('0x3')]},'forwardOffline':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8d00('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x23')},'skipUnmanaged':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x15')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8d00('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8d00('0xf')],'defaultValue':function(){return _0x8d00('0x24');}},'notificationSound':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x25')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8d00('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x26')},'verticalAlignment':{'type':Sequelize[_0x8d00('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':_0x8d00('0x27')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x8d00('0x28')},'defaultTitle':{'type':Sequelize[_0x8d00('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8d00('0x3')],'allowNull':![],'defaultValue':_0x8d00('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8d00('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x8d00('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8d00('0x8')],'comment':_0x8d00('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![],'comment':_0x8d00('0x2b'),'set':function(_0x3e31f5){if(!_0x3e31f5)this[_0x8d00('0x2c')](_0x8d00('0x2d'),null);this[_0x8d00('0x2c')](_0x8d00('0x2e'),_0x3e31f5);}},'vidaooEscalation':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8d00('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8d00('0x2f')},'vidaooNote':{'type':Sequelize[_0x8d00('0x3')],'defaultValue':function(){return _0x8d00('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x8d00('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8d00('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8d00('0xf')]}}; \ No newline at end of file +var _0xea96=['mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','star','stringify','name','text','input','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea96,0x183));var _0x6ea9=function(_0x4b835c,_0xa85bb1){_0x4b835c=_0x4b835c-0x0;var _0x18e7f2=_0xea96[_0x4b835c];return _0x18e7f2;};'use strict';var Sequelize=require(_0x6ea9('0x0'));var rs=require(_0x6ea9('0x1'));module['exports']={'name':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'unique':_0x6ea9('0x3')},'description':{'type':Sequelize[_0x6ea9('0x2')]},'mapKey':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x4')},'mapKeyOffline':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x4')},'key':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':_0x6ea9('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6ea9('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':_0x6ea9('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':_0x6ea9('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6ea9('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6ea9('0x2')]},'animation':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6ea9('0xa')](_0x6ea9('0xb'),'squared'),'defaultValue':_0x6ea9('0xb')},'header_online':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0xc')},'start_chat_button':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0xd')},'offline_chat_button':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6ea9('0x10')]},'closingQuestion':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x13')},'noteTitle':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x16')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x6ea9('0x18'),'thumb'),'defaultValue':_0x6ea9('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6ea9('0x10')],'defaultValue':function(){return JSON[_0x6ea9('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6ea9('0x1a'),'type':_0x6ea9('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6ea9('0x1c'),'props':{'title':_0x6ea9('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6ea9('0x4'),'type':_0x6ea9('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6ea9('0x1d'))?JSON[_0x6ea9('0x1e')](this[_0x6ea9('0x1f')](_0x6ea9('0x1d'))):{};},'set':function(_0x3c7e68){return this['setDataValue']('onlineForm',JSON[_0x6ea9('0x19')](_0x3c7e68));}},'offlineForm':{'type':Sequelize[_0x6ea9('0x10')],'defaultValue':function(){return JSON[_0x6ea9('0x19')]({'items':[{'type':_0x6ea9('0x1c'),'props':{'title':_0x6ea9('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6ea9('0x4'),'type':_0x6ea9('0x4')},'variable':null},{'type':_0x6ea9('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x6ea9('0x21'),'helpText':_0x6ea9('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x6ea9('0x1f')](_0x6ea9('0x23'))?JSON[_0x6ea9('0x1e')](this['getDataValue'](_0x6ea9('0x23'))):{};},'set':function(_0x1ef0ec){return this['setDataValue'](_0x6ea9('0x23'),JSON[_0x6ea9('0x19')](_0x1ef0ec));}},'token':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6ea9('0x2')]},'forwardOffline':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x26')},'skipUnmanaged':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x17')},'sendUnmanaged':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x16')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6ea9('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6ea9('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6ea9('0x10')],'defaultValue':function(){return _0x6ea9('0x27');}},'notificationSound':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ea9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6ea9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x29')},'verticalAlignment':{'type':Sequelize[_0x6ea9('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x6ea9('0x2')]},'customerAvatar':{'type':Sequelize[_0x6ea9('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6ea9('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ea9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ea9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ea9('0x8')],'comment':_0x6ea9('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6ea9('0x2b'),'set':function(_0x13460b){if(!_0x13460b)this[_0x6ea9('0x2c')](_0x6ea9('0x2d'),null);this[_0x6ea9('0x2c')]('mandatoryDisposition',_0x13460b);}},'vidaooEscalation':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6ea9('0x2')]},'vidaooTopic':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':_0x6ea9('0x2e')},'vidaooNote':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':function(){return _0x6ea9('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x6ea9('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6ea9('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6362e8e..b4fd1ba 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 _0x5d26=['includes','mapKey','CmList','List','updatedAt','DESC','Applications','Interval','list','orderBy','priority','asc','account','defaults','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','lastName','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','waitForTheAssignedAgent','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','CloudProvider','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','email','Smtp','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','User','Owner','fullname','internal','Tag','color','tag','virtual','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','addProactiveActions','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','ejs','fs-extra','querystring','html-to-text','ioredis','url','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIOutOfIntervalError','handleError','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','UserProfileResource','stack','name','send','Command','getSnippet','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','timezone','No\x20timezone','catch','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','map','Intervals','some','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','vendor','type','Pause','mandatoryDispositionPause','rawAttributes','fieldName','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ChatWebsite','findAll','rows','show','params','intersection','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','find','autoAssociation','update','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','ChatWebsiteId','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5d26,0x85));var _0x65d2=function(_0x15d1eb,_0x59bba1){_0x15d1eb=_0x15d1eb-0x0;var _0xfc710d=_0x5d26[_0x15d1eb];return _0xfc710d;};'use strict';var Mustache=require('mustache');var util=require(_0x65d2('0x0'));var path=require('path');var ejs=require(_0x65d2('0x1'));var fs=require('fs');var fs_extra=require(_0x65d2('0x2'));var _=require('lodash');var querystring=require(_0x65d2('0x3'));var htmlToText=require(_0x65d2('0x4'));var Redis=require(_0x65d2('0x5'));var jayson=require('jayson/promise');var url=require(_0x65d2('0x6'));var qs=require(_0x65d2('0x7'));var logger=require('../../config/logger')(_0x65d2('0x8'));var config=require(_0x65d2('0x9'));var APIOutOfIntervalError=require(_0x65d2('0xa'))[_0x65d2('0xb')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require(_0x65d2('0xa'))[_0x65d2('0xc')];var db=require(_0x65d2('0xd'))['db'];config[_0x65d2('0xe')]=_['defaults'](config[_0x65d2('0xe')],{'host':_0x65d2('0xf'),'port':0x18eb});var socket=require(_0x65d2('0x10'))(new Redis(config[_0x65d2('0xe')]));require('./chatWebsite.socket')['register'](socket);var client=jayson[_0x65d2('0x11')][_0x65d2('0x12')]({'port':0x232c});var client9002=jayson[_0x65d2('0x11')][_0x65d2('0x12')]({'port':0x232a});var client9003=jayson[_0x65d2('0x11')][_0x65d2('0x12')]({'port':0x232b});var client9001=jayson[_0x65d2('0x11')][_0x65d2('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x2fd7bb,_0x300ce6,_0x438101,_0xce7da3){return new Promise(function(_0x3bdebc,_0x4b63d6){var _0x40f45b=_0xce7da3||client;return _0x40f45b[_0x65d2('0x13')](_0x2fd7bb,_0x438101)[_0x65d2('0x14')](function(_0x33ab32){logger[_0x65d2('0x15')](_0x65d2('0x16'),_0x300ce6,'request\x20sent');logger[_0x65d2('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x300ce6,_0x65d2('0x18'),JSON[_0x65d2('0x19')](_0x33ab32));if(_0x33ab32[_0x65d2('0x1a')]){if(_0x33ab32['error']['code']===0x1f4){logger['error'](_0x65d2('0x16'),_0x300ce6,_0x33ab32[_0x65d2('0x1a')]['message']);return _0x4b63d6(_0x33ab32['error'][_0x65d2('0x1b')]);}logger[_0x65d2('0x1a')](_0x65d2('0x16'),_0x300ce6,_0x33ab32['error'][_0x65d2('0x1b')]);return _0x3bdebc(_0x33ab32['error']['message']);}else{logger[_0x65d2('0x15')](_0x65d2('0x16'),_0x300ce6,_0x65d2('0x18'));_0x3bdebc(_0x33ab32[_0x65d2('0x1c')][_0x65d2('0x1b')]);}})['catch'](function(_0x400cd6){logger[_0x65d2('0x1a')](_0x65d2('0x16'),_0x300ce6,_0x400cd6);_0x4b63d6(_0x400cd6);});});}function respondWithStatusCode(_0x59da24,_0x201b1f){_0x201b1f=_0x201b1f||0xcc;return function(_0x1db9d8){if(_0x1db9d8){return _0x59da24[_0x65d2('0x1d')](_0x201b1f);}return _0x59da24[_0x65d2('0x1e')](_0x201b1f)[_0x65d2('0x1f')]();};}function respondWithResult(_0x4c59b9,_0x3d6685){_0x3d6685=_0x3d6685||0xc8;return function(_0x4a3fb2){if(_0x4a3fb2){return _0x4c59b9[_0x65d2('0x1e')](_0x3d6685)[_0x65d2('0x20')](_0x4a3fb2);}};}function respondWithFilteredResult(_0x2fcadf,_0x2393c0){return function(_0x1d9918){if(_0x1d9918){var _0x191d6e=typeof _0x2393c0[_0x65d2('0x21')]===_0x65d2('0x22')&&typeof _0x2393c0[_0x65d2('0x23')]==='undefined';var _0x78e448=_0x1d9918[_0x65d2('0x24')];var _0x19f46e=_0x191d6e?0x0:_0x2393c0[_0x65d2('0x21')];var _0x34b5cd=_0x191d6e?_0x1d9918[_0x65d2('0x24')]:_0x2393c0['offset']+_0x2393c0[_0x65d2('0x23')];var _0x5265f9;if(_0x34b5cd>=_0x78e448){_0x34b5cd=_0x78e448;_0x5265f9=0xc8;}else{_0x5265f9=0xce;}_0x2fcadf['status'](_0x5265f9);return _0x2fcadf[_0x65d2('0x25')](_0x65d2('0x26'),_0x19f46e+'-'+_0x34b5cd+'/'+_0x78e448)[_0x65d2('0x20')](_0x1d9918);}return null;};}function saveUpdates(_0x45beb0){return function(_0x1c1ec9){if(_0x1c1ec9){return _0x1c1ec9['update'](_0x45beb0)[_0x65d2('0x14')](function(_0x344fe8){return _0x344fe8;});}return null;};}function removeEntity(_0x58b464){return function(_0x1c1877){if(_0x1c1877){return _0x1c1877[_0x65d2('0x27')]()['then'](function(){var _0x51d45d=_0x1c1877['get']({'plain':!![]});var _0xc67ec9='ChatWebsites';return db[_0x65d2('0x28')][_0x65d2('0x27')]({'where':{'type':_0xc67ec9,'resourceId':_0x51d45d['id']}})['then'](function(){return _0x1c1877;});})[_0x65d2('0x14')](function(){_0x58b464[_0x65d2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a27a7){return function(_0x47a929){if(!_0x47a929){_0x5a27a7[_0x65d2('0x1d')](0x194);}return _0x47a929;};}function handleError(_0x1828a0,_0x26a2b3){_0x26a2b3=_0x26a2b3||0x1f4;return function(_0x3cbba6){logger[_0x65d2('0x1a')](_0x3cbba6[_0x65d2('0x29')]);if(_0x3cbba6[_0x65d2('0x2a')]){delete _0x3cbba6[_0x65d2('0x2a')];}_0x1828a0[_0x65d2('0x1e')](_0x26a2b3)[_0x65d2('0x2b')](_0x3cbba6);};}function iftimePromise(_0x18244b,_0x3247f6){return respondWithRpcPromise(_0x65d2('0x2c'),_0x65d2('0x2d'),{'command':_0x3247f6['timezone']?util[_0x65d2('0x2e')](_0x65d2('0x2f'),_0x18244b[_0x65d2('0x30')],_0x3247f6['timezone']):util[_0x65d2('0x2e')](_0x65d2('0x31'),_0x18244b[_0x65d2('0x30')])},client9002)[_0x65d2('0x14')](function(_0x3b5a22){var _0x2842ce=_0x3b5a22&&_0x3b5a22[_0x65d2('0x32')](_0x65d2('0x33'))>=0x0?!![]:![];logger[_0x65d2('0x15')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3247f6['id'],_0x18244b['id'],_0x18244b[_0x65d2('0x30')],_0x2842ce?'ONLINE':'OFFLINE',_0x3247f6[_0x65d2('0x34')]?_0x3247f6[_0x65d2('0x34')]:_0x65d2('0x35'));return _0x2842ce;})[_0x65d2('0x36')](function(_0x148c66){logger[_0x65d2('0x1a')](_0x65d2('0x37'),_0x3247f6['id'],_0x18244b['id'],_0x18244b['interval'],util[_0x65d2('0x38')](_0x148c66,{'showHidden':![],'depth':null}),_0x3247f6[_0x65d2('0x34')]?_0x3247f6[_0x65d2('0x34')]:_0x65d2('0x35'));return![];});}function checkWebsiteIntervals(_0x40d572){var _0x31cd22=_[_0x65d2('0x39')](_0x40d572['Interval'][_0x65d2('0x3a')],function(_0x51948c){var _0x6e6ea2=_0x51948c['get']({'plain':!![]});return iftimePromise(_0x6e6ea2,_0x40d572);});return Promise['all'](_0x31cd22)['then'](function(_0x431a1f){return _[_0x65d2('0x3b')](_0x431a1f);});}function createInteractionObject(_0x4a4c27,_0x21ea8a,_0x5c05d5,_0x3c768c){var _0x17b330=require('user-agent-parser');var _0x1225af=new _0x17b330();var _0x269333=_0x1225af['setUA'](_0x5c05d5[_0x65d2('0x3c')])[_0x65d2('0x3d')]();var _0x21b6d1=_0x21ea8a[_0x65d2('0x3e')];if(_0x5c05d5[_0x65d2('0x3f')]){_0x21b6d1=_0x5c05d5[_0x65d2('0x3f')];}else if(_0x5c05d5[_0x65d2('0x40')]){_0x21b6d1=_[_0x65d2('0x41')](_0x5c05d5[_0x65d2('0x40')][_0x65d2('0x42')](','));}return{'ContactId':_0x3c768c['id'],'ChatWebsiteId':_0x4a4c27,'from':(_0x3c768c[_0x65d2('0x43')]||'')+'\x20'+(_0x3c768c['lastName']||''),'customerIp':_0x21b6d1,'customerPort':_0x5c05d5[_0x65d2('0x44')]?_0x5c05d5[_0x65d2('0x44')]:null,'referer':_0x21ea8a[_0x65d2('0x45')],'browserName':_0x269333[_0x65d2('0x46')][_0x65d2('0x2a')]&&_0x269333[_0x65d2('0x46')][_0x65d2('0x47')]?util[_0x65d2('0x2e')](_0x65d2('0x48'),_0x269333[_0x65d2('0x46')]['name'],_0x269333[_0x65d2('0x46')]['version']):_0x65d2('0x49'),'browserVersion':_0x269333[_0x65d2('0x46')][_0x65d2('0x47')]||_0x65d2('0x49'),'osName':util[_0x65d2('0x2e')](_0x65d2('0x48'),_0x269333['os'][_0x65d2('0x2a')],_0x269333['os']['version']),'osVersion':_0x269333['os'][_0x65d2('0x47')],'deviceModel':_0x269333[_0x65d2('0x4a')][_0x65d2('0x4b')]&&_0x269333[_0x65d2('0x4a')][_0x65d2('0x4c')]?util['format']('%s\x20%s\x20%s',_0x269333[_0x65d2('0x4a')][_0x65d2('0x4b')],_0x269333['device'][_0x65d2('0x4c')],_0x269333['device']['type']):null,'deviceVendor':_0x269333['device'][_0x65d2('0x4c')],'deviceType':_0x269333['device'][_0x65d2('0x4d')],'formData':JSON['stringify'](_0x21ea8a)};}exports['index']=function(_0x45db0f,_0x30df0c){var _0x4c0ff6={'include':[{'model':db[_0x65d2('0x4e')],'as':_0x65d2('0x4f')}]},_0x57de17={},_0x41334e={'count':0x0,'rows':[]};var _0x2e3cd9=_[_0x65d2('0x39')](db['ChatWebsite'][_0x65d2('0x50')],function(_0x1a15b1){return{'name':_0x1a15b1[_0x65d2('0x51')],'type':_0x1a15b1[_0x65d2('0x4d')]['key']};});_0x57de17[_0x65d2('0x4b')]=_[_0x65d2('0x39')](_0x2e3cd9,_0x65d2('0x2a'));_0x57de17[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x45db0f[_0x65d2('0x52')]);_0x57de17[_0x65d2('0x54')]=_['intersection'](_0x57de17[_0x65d2('0x4b')],_0x57de17[_0x65d2('0x52')]);_0x4c0ff6[_0x65d2('0x55')]=_['intersection'](_0x57de17[_0x65d2('0x4b')],qs['fields'](_0x45db0f[_0x65d2('0x52')][_0x65d2('0x56')]));_0x4c0ff6[_0x65d2('0x55')]=_0x4c0ff6[_0x65d2('0x55')][_0x65d2('0x57')]?_0x4c0ff6['attributes']:_0x57de17[_0x65d2('0x4b')];if(!_0x45db0f['query'][_0x65d2('0x58')](_0x65d2('0x59'))){_0x4c0ff6[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x45db0f[_0x65d2('0x52')][_0x65d2('0x23')]);_0x4c0ff6[_0x65d2('0x21')]=qs['offset'](_0x45db0f[_0x65d2('0x52')][_0x65d2('0x21')]);}_0x4c0ff6[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x45db0f[_0x65d2('0x52')]['sort']);_0x4c0ff6['where']=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x45db0f[_0x65d2('0x52')],_0x57de17[_0x65d2('0x54')]),_0x2e3cd9);if(_0x45db0f['query'][_0x65d2('0x5d')]){_0x4c0ff6['where']=_[_0x65d2('0x5e')](_0x4c0ff6[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x2e3cd9,function(_0x4526a8){if(_0x4526a8[_0x65d2('0x4d')]!==_0x65d2('0x60')){var _0x2cbc75={};_0x2cbc75[_0x4526a8[_0x65d2('0x2a')]]={'$like':'%'+_0x45db0f[_0x65d2('0x52')][_0x65d2('0x5d')]+'%'};return _0x2cbc75;}})});}_0x4c0ff6=_[_0x65d2('0x5e')]({},_0x4c0ff6,_0x45db0f[_0x65d2('0x61')]);var _0x44cf04={'where':_0x4c0ff6[_0x65d2('0x5f')]};return db[_0x65d2('0x62')][_0x65d2('0x24')](_0x44cf04)[_0x65d2('0x14')](function(_0x2132f4){_0x41334e[_0x65d2('0x24')]=_0x2132f4;if(_0x45db0f[_0x65d2('0x52')]['includeAll']){_0x4c0ff6['include']=[{'all':!![]}];}return db[_0x65d2('0x62')][_0x65d2('0x63')](_0x4c0ff6);})[_0x65d2('0x14')](function(_0x27b473){_0x41334e[_0x65d2('0x64')]=_0x27b473;return _0x41334e;})['then'](respondWithFilteredResult(_0x30df0c,_0x4c0ff6))[_0x65d2('0x36')](handleError(_0x30df0c,null));};exports[_0x65d2('0x65')]=function(_0x56c5d7,_0x4e8684){var _0x4a92aa={'raw':![],'where':{'id':_0x56c5d7[_0x65d2('0x66')]['id']},'include':[{'model':db[_0x65d2('0x4e')],'as':_0x65d2('0x4f')}]},_0x5bcca8={};_0x5bcca8['model']=_['keys'](db['ChatWebsite'][_0x65d2('0x50')]);_0x5bcca8[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x56c5d7['query']);_0x5bcca8[_0x65d2('0x54')]=_[_0x65d2('0x67')](_0x5bcca8[_0x65d2('0x4b')],_0x5bcca8[_0x65d2('0x52')]);_0x4a92aa[_0x65d2('0x55')]=_['intersection'](_0x5bcca8[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x56c5d7[_0x65d2('0x52')][_0x65d2('0x56')]));_0x4a92aa['attributes']=_0x4a92aa[_0x65d2('0x55')][_0x65d2('0x57')]?_0x4a92aa[_0x65d2('0x55')]:_0x5bcca8['model'];if(_0x56c5d7['query'][_0x65d2('0x68')]){_0x4a92aa[_0x65d2('0x69')]=[{'all':!![]}];}_0x4a92aa=_[_0x65d2('0x5e')]({},_0x4a92aa,_0x56c5d7[_0x65d2('0x61')]);return db['ChatWebsite']['find'](_0x4a92aa)['then'](handleEntityNotFound(_0x4e8684,null))[_0x65d2('0x14')](respondWithResult(_0x4e8684,null))['catch'](handleError(_0x4e8684,null));};exports[_0x65d2('0x6a')]=function(_0x58dbbf,_0x2a96c4){return db['ChatWebsite'][_0x65d2('0x6a')](_0x58dbbf[_0x65d2('0x6b')],{})[_0x65d2('0x14')](function(_0x2fe77d){var _0x3b4891=_0x58dbbf[_0x65d2('0x6c')][_0x65d2('0x6d')]({'plain':!![]});if(!_0x3b4891)throw new Error(_0x65d2('0x6e'));if(_0x3b4891[_0x65d2('0x6f')]===_0x65d2('0x6c')){var _0xb9544e=_0x2fe77d[_0x65d2('0x6d')]({'plain':!![]});var _0x168f01=_0x65d2('0x70');return db[_0x65d2('0x71')][_0x65d2('0x72')]({'where':{'name':_0x168f01,'userProfileId':_0x3b4891['userProfileId']},'raw':!![]})[_0x65d2('0x14')](function(_0x86213){if(_0x86213&&_0x86213[_0x65d2('0x73')]===0x0){return db['UserProfileResource'][_0x65d2('0x6a')]({'name':_0xb9544e[_0x65d2('0x2a')],'resourceId':_0xb9544e['id'],'type':_0x86213['name'],'sectionId':_0x86213['id']},{})['then'](function(){return _0x2fe77d;});}else{return _0x2fe77d;}})[_0x65d2('0x36')](function(_0xdfc288){logger[_0x65d2('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdfc288);throw _0xdfc288;});}return _0x2fe77d;})[_0x65d2('0x14')](respondWithResult(_0x2a96c4,0xc9))['catch'](handleError(_0x2a96c4,null));};exports[_0x65d2('0x74')]=function(_0x33ebfd,_0x57a510){if(_0x33ebfd[_0x65d2('0x6b')]['id']){delete _0x33ebfd[_0x65d2('0x6b')]['id'];}return db[_0x65d2('0x62')]['find']({'where':{'id':_0x33ebfd[_0x65d2('0x66')]['id']},'include':[{'model':db[_0x65d2('0x4e')],'as':_0x65d2('0x4f')}]})['then'](handleEntityNotFound(_0x57a510,null))['then'](saveUpdates(_0x33ebfd[_0x65d2('0x6b')],null))[_0x65d2('0x14')](respondWithResult(_0x57a510,null))[_0x65d2('0x36')](handleError(_0x57a510,null));};exports[_0x65d2('0x27')]=function(_0x52f54d,_0x5e7372){return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x52f54d[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x5e7372,null))['then'](removeEntity(_0x5e7372,null))[_0x65d2('0x36')](handleError(_0x5e7372,null));};exports['describe']=function(_0x7ef538,_0x5de165){return db[_0x65d2('0x62')]['describe']()[_0x65d2('0x14')](respondWithResult(_0x5de165,null))[_0x65d2('0x36')](handleError(_0x5de165,null));};exports[_0x65d2('0x75')]=function(_0x4964de,_0x3107f8){if(_0x4964de[_0x65d2('0x6b')]['id']){delete _0x4964de[_0x65d2('0x6b')]['id'];}return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x4964de[_0x65d2('0x66')]['id']}})['then'](handleEntityNotFound(_0x3107f8,null))[_0x65d2('0x14')](function(_0x6738c8){if(_0x6738c8){_0x4964de[_0x65d2('0x6b')]['ChatWebsiteId']=_0x6738c8['id'];return db[_0x65d2('0x76')]['create'](_0x4964de[_0x65d2('0x6b')]);}})[_0x65d2('0x14')](respondWithResult(_0x3107f8,null))[_0x65d2('0x36')](handleError(_0x3107f8,null));};exports[_0x65d2('0x77')]=function(_0x2c9dd0,_0x42b53e){var _0x520acc={'raw':![],'where':{}};var _0x520b19={};var _0x3add5d={'count':0x0,'rows':[]};return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x2c9dd0['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x42b53e,null))[_0x65d2('0x14')](function(_0xc71220){if(_0xc71220){_0x520b19[_0x65d2('0x4b')]=_['keys'](db[_0x65d2('0x76')][_0x65d2('0x50')]);_0x520b19[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x2c9dd0[_0x65d2('0x52')]);_0x520b19[_0x65d2('0x54')]=_[_0x65d2('0x67')](_0x520b19[_0x65d2('0x4b')],_0x520b19[_0x65d2('0x52')]);_0x520acc[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x520b19[_0x65d2('0x4b')],qs['fields'](_0x2c9dd0[_0x65d2('0x52')][_0x65d2('0x56')]));_0x520acc[_0x65d2('0x55')]=_0x520acc['attributes']['length']?_0x520acc[_0x65d2('0x55')]:_0x520b19[_0x65d2('0x4b')];if(!_0x2c9dd0[_0x65d2('0x52')][_0x65d2('0x58')]('nolimit')){_0x520acc[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x2c9dd0[_0x65d2('0x52')][_0x65d2('0x23')]);_0x520acc[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x2c9dd0[_0x65d2('0x52')]['offset']);}_0x520acc[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x2c9dd0[_0x65d2('0x52')][_0x65d2('0x5b')]);_0x520acc[_0x65d2('0x5f')]=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x2c9dd0[_0x65d2('0x52')],_0x520b19[_0x65d2('0x54')]));_0x520acc[_0x65d2('0x5f')]['ChatWebsiteId']=_0xc71220['id'];if(_0x2c9dd0['query'][_0x65d2('0x5d')]){_0x520acc[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x520acc['where'],{'$or':_[_0x65d2('0x39')](_0x520acc[_0x65d2('0x55')],function(_0x410964){var _0x18cb26={};_0x18cb26[_0x410964]={'$like':'%'+_0x2c9dd0['query'][_0x65d2('0x5d')]+'%'};return _0x18cb26;})});}_0x520acc=_[_0x65d2('0x5e')]({},_0x520acc,_0x2c9dd0[_0x65d2('0x61')]);return db[_0x65d2('0x76')][_0x65d2('0x24')]({'where':_0x520acc['where']})[_0x65d2('0x14')](function(_0x2d32d6){_0x3add5d['count']=_0x2d32d6;if(_0x2c9dd0[_0x65d2('0x52')]['includeAll']){_0x520acc['include']=[{'all':!![]}];}return db[_0x65d2('0x76')][_0x65d2('0x63')](_0x520acc);})[_0x65d2('0x14')](function(_0x305181){_0x3add5d[_0x65d2('0x64')]=_0x305181;return _0x3add5d;});}})[_0x65d2('0x14')](respondWithFilteredResult(_0x42b53e,_0x520acc))['catch'](handleError(_0x42b53e,null));};exports[_0x65d2('0x79')]=function(_0x231bb1,_0x3a7330){return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x231bb1['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x3a7330,null))['then'](function(_0x2285a0){if(_0x2285a0){return _0x2285a0['removeDispositions'](_0x231bb1[_0x65d2('0x52')][_0x65d2('0x7a')]);}})[_0x65d2('0x14')](respondWithStatusCode(_0x3a7330,null))[_0x65d2('0x36')](handleError(_0x3a7330,null));};exports['addAnswer']=function(_0xbe7f2a,_0x55bff2){if(_0xbe7f2a[_0x65d2('0x6b')]['id']){delete _0xbe7f2a['body']['id'];}return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0xbe7f2a[_0x65d2('0x66')]['id']}})['then'](handleEntityNotFound(_0x55bff2,null))[_0x65d2('0x14')](function(_0x1f9c81){if(_0x1f9c81){_0xbe7f2a[_0x65d2('0x6b')][_0x65d2('0x7b')]=_0x1f9c81['id'];return db[_0x65d2('0x7c')]['create'](_0xbe7f2a[_0x65d2('0x6b')]);}})[_0x65d2('0x14')](respondWithResult(_0x55bff2,null))[_0x65d2('0x36')](handleError(_0x55bff2,null));};exports['getAnswers']=function(_0x5b14b2,_0x5c0553){var _0x3b576e={'raw':![],'where':{}};var _0x334064={};var _0x477e82={'count':0x0,'rows':[]};return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x5b14b2[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x5c0553,null))[_0x65d2('0x14')](function(_0x4aa41f){if(_0x4aa41f){_0x334064['model']=_[_0x65d2('0x53')](db[_0x65d2('0x7c')][_0x65d2('0x50')]);_0x334064[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x5b14b2['query']);_0x334064['filters']=_['intersection'](_0x334064[_0x65d2('0x4b')],_0x334064[_0x65d2('0x52')]);_0x3b576e[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x334064[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x5b14b2[_0x65d2('0x52')]['fields']));_0x3b576e[_0x65d2('0x55')]=_0x3b576e[_0x65d2('0x55')][_0x65d2('0x57')]?_0x3b576e['attributes']:_0x334064[_0x65d2('0x4b')];if(!_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x58')]('nolimit')){_0x3b576e[_0x65d2('0x23')]=qs['limit'](_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x23')]);_0x3b576e[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x21')]);}_0x3b576e[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x5b14b2[_0x65d2('0x52')]['sort']);_0x3b576e[_0x65d2('0x5f')]=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x5b14b2['query'],_0x334064[_0x65d2('0x54')]));_0x3b576e['where'][_0x65d2('0x7b')]=_0x4aa41f['id'];if(_0x5b14b2[_0x65d2('0x52')]['filter']){_0x3b576e[_0x65d2('0x5f')]=_['merge'](_0x3b576e[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x3b576e['attributes'],function(_0x11162c){var _0x1c08ac={};_0x1c08ac[_0x11162c]={'$like':'%'+_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x5d')]+'%'};return _0x1c08ac;})});}_0x3b576e=_[_0x65d2('0x5e')]({},_0x3b576e,_0x5b14b2['options']);return db[_0x65d2('0x7c')][_0x65d2('0x24')]({'where':_0x3b576e[_0x65d2('0x5f')]})[_0x65d2('0x14')](function(_0xf146d6){_0x477e82[_0x65d2('0x24')]=_0xf146d6;if(_0x5b14b2[_0x65d2('0x52')][_0x65d2('0x68')]){_0x3b576e['include']=[{'all':!![]}];}return db[_0x65d2('0x7c')][_0x65d2('0x63')](_0x3b576e);})['then'](function(_0x355feb){_0x477e82['rows']=_0x355feb;return _0x477e82;});}})[_0x65d2('0x14')](respondWithFilteredResult(_0x5c0553,_0x3b576e))[_0x65d2('0x36')](handleError(_0x5c0553,null));};exports[_0x65d2('0x7d')]=function(_0x5b3dc1,_0x7d4178){return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x5b3dc1[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x7d4178,null))[_0x65d2('0x14')](function(_0x3c3e77){if(_0x3c3e77){return _0x3c3e77[_0x65d2('0x7d')](_0x5b3dc1['query'][_0x65d2('0x7a')]);}})[_0x65d2('0x14')](respondWithStatusCode(_0x7d4178,null))['catch'](handleError(_0x7d4178,null));};exports[_0x65d2('0x7e')]=function(_0x4cdb34,_0x446ee3){_0x4cdb34['body'][_0x65d2('0x7f')]=_0x4cdb34[_0x65d2('0x80')][_0x65d2('0x81')];return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x4cdb34['params']['id']}})['then'](handleEntityNotFound(_0x446ee3,null))[_0x65d2('0x14')](saveUpdates(_0x4cdb34['body'],null))[_0x65d2('0x14')](respondWithResult(_0x446ee3,null))['catch'](handleError(_0x446ee3,null));};exports[_0x65d2('0x82')]=function(_0x47fddf,_0x550baa){_0x47fddf['body'][_0x65d2('0x83')]=_0x47fddf[_0x65d2('0x80')]['filename'];return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x47fddf[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x550baa,null))[_0x65d2('0x14')](saveUpdates(_0x47fddf[_0x65d2('0x6b')],null))[_0x65d2('0x14')](respondWithResult(_0x550baa,null))[_0x65d2('0x36')](handleError(_0x550baa,null));};exports[_0x65d2('0x84')]=function(_0x4b4f5e,_0x50b7d4){_0x4b4f5e['body'][_0x65d2('0x85')]=_0x4b4f5e[_0x65d2('0x80')][_0x65d2('0x81')];return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x4b4f5e[_0x65d2('0x66')]['id']}})['then'](handleEntityNotFound(_0x50b7d4,null))[_0x65d2('0x14')](saveUpdates(_0x4b4f5e[_0x65d2('0x6b')],null))['then'](respondWithResult(_0x50b7d4,null))['catch'](handleError(_0x50b7d4,null));};exports[_0x65d2('0x86')]=function(_0x462a37,_0xa38168){_0x462a37[_0x65d2('0x6b')][_0x65d2('0x87')]=_0x462a37[_0x65d2('0x80')][_0x65d2('0x81')];return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x462a37[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0xa38168,null))[_0x65d2('0x14')](saveUpdates(_0x462a37[_0x65d2('0x6b')],null))[_0x65d2('0x14')](respondWithResult(_0xa38168,null))['catch'](handleError(_0xa38168,null));};exports[_0x65d2('0x88')]=function(_0xd73b22,_0x54495e){var _0x2d6f15=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x8b'));var _0x4be9ee={'where':{'id':_0xd73b22[_0x65d2('0x66')]['id']},'attributes':['id',_0x65d2('0x7f')],'raw':!![]};var _0x1473ad=![];return require('../../config/license/util')[_0x65d2('0x8c')]()[_0x65d2('0x14')](function(_0x592f28){if(_0x592f28){_0x1473ad=_0x592f28[_0x65d2('0x8d')];}})[_0x65d2('0x14')](function(){return db[_0x65d2('0x62')][_0x65d2('0x72')](_0x4be9ee);})[_0x65d2('0x14')](handleEntityNotFound(_0x54495e,null))[_0x65d2('0x14')](function(_0x565b4b){if(_0x565b4b){if(!_[_0x65d2('0x8e')](_0x565b4b[_0x65d2('0x7f')])){if(fs[_0x65d2('0x8f')](path['join'](config[_0x65d2('0x8a')],_0x65d2('0x90'),_0x565b4b[_0x65d2('0x7f')]))&&_0x1473ad){_0x2d6f15=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x90'),_0x565b4b['sitepic']);}}return _0x54495e[_0x65d2('0x91')](_0x2d6f15);}})[_0x65d2('0x36')](handleError(_0x54495e,null));};exports[_0x65d2('0x92')]=function(_0x7423b9,_0x54240b){var _0x5e732a=path[_0x65d2('0x89')](config['root'],_0x65d2('0x93'));var _0x24edff={'where':{'id':_0x7423b9[_0x65d2('0x66')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x24edff)[_0x65d2('0x14')](handleEntityNotFound(_0x54240b,null))[_0x65d2('0x14')](function(_0x410c92){if(_0x410c92){if(!_[_0x65d2('0x8e')](_0x410c92[_0x65d2('0x83')])){if(fs[_0x65d2('0x8f')](path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x410c92[_0x65d2('0x83')]))){_0x5e732a=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x410c92['agentAvatar']);}}return _0x54240b[_0x65d2('0x91')](_0x5e732a);}})[_0x65d2('0x36')](handleError(_0x54240b,null));};exports[_0x65d2('0x95')]=function(_0x1b846b,_0x194db3){var _0x58d46c=path['join'](config[_0x65d2('0x8a')],_0x65d2('0x96'));var _0x1e9288={'where':{'id':_0x1b846b[_0x65d2('0x66')]['id']},'attributes':['id',_0x65d2('0x85'),_0x65d2('0x97')],'raw':!![]};return db[_0x65d2('0x62')][_0x65d2('0x72')](_0x1e9288)[_0x65d2('0x14')](handleEntityNotFound(_0x194db3,null))[_0x65d2('0x14')](function(_0x589b14){if(_0x589b14){if(!_[_0x65d2('0x8e')](_0x589b14[_0x65d2('0x85')])){if(fs[_0x65d2('0x8f')](path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x589b14[_0x65d2('0x85')]))&&_0x589b14[_0x65d2('0x97')]){_0x58d46c=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x589b14[_0x65d2('0x85')]);}}return _0x194db3[_0x65d2('0x91')](_0x58d46c);}})[_0x65d2('0x36')](handleError(_0x194db3,null));};exports[_0x65d2('0x98')]=function(_0x40402f,_0x12052e){var _0x2e93fb=path['join'](config[_0x65d2('0x8a')],_0x65d2('0x99'));var _0x261e1d={'where':{'id':_0x40402f['params']['id']},'attributes':['id',_0x65d2('0x87')],'raw':!![]};return db[_0x65d2('0x62')]['find'](_0x261e1d)[_0x65d2('0x14')](handleEntityNotFound(_0x12052e,null))[_0x65d2('0x14')](function(_0x15d89d){if(_0x15d89d){if(!_['isNil'](_0x15d89d[_0x65d2('0x87')])){if(fs[_0x65d2('0x8f')](path[_0x65d2('0x89')](config[_0x65d2('0x8a')],'server/files/images/avatars/',_0x15d89d[_0x65d2('0x87')]))){_0x2e93fb=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0x94'),_0x15d89d[_0x65d2('0x87')]);}}return _0x12052e['download'](_0x2e93fb);}})[_0x65d2('0x36')](handleError(_0x12052e,null));};exports[_0x65d2('0x9a')]=function(_0x3c5b5e,_0x32cd6a){var _0x400298={'body':_0x3c5b5e['body'],'channel':_0x65d2('0x9b')};var _0x892ea6=[];var _0x57da55=[];var _0x518174={};var _0x2d7aa3=![];return db[_0x65d2('0x9c')][_0x65d2('0x9d')]()[_0x65d2('0x14')](function(_0x514faa){if(!_0x514faa){throw new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))](_0x65d2('0xa0'));}_0x892ea6=_['difference'](_[_0x65d2('0x53')](_0x514faa),[_0x65d2('0xa1'),'updatedAt']);_0x57da55=_[_0x65d2('0xa2')](_[_0x65d2('0x53')](_0x514faa),[_0x65d2('0xa1'),'updatedAt',_0x65d2('0xa3'),_0x65d2('0xa4')]);if(_0x3c5b5e['body']['id']){delete _0x3c5b5e[_0x65d2('0x6b')]['id'];}if(_[_0x65d2('0x8e')](_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xa5')])){throw new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))]('from\x20is\x20mandatory');}if(_[_0x65d2('0x8e')](_0x3c5b5e['body']['body'])||_0x3c5b5e['body'][_0x65d2('0x6b')]===''){throw new db['Sequelize'][(_0x65d2('0x9f'))](_0x65d2('0xa6'));}if(_[_0x65d2('0x8e')](_0x3c5b5e[_0x65d2('0x6b')]['mapKey'])){throw new db['Sequelize'][(_0x65d2('0x9f'))](_0x65d2('0xa7')+_0x57da55);}if(!_[_0x65d2('0xa8')](_0x57da55,_0x3c5b5e['body'][_0x65d2('0xa9')])){throw new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x57da55);}_0x518174[_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xa9')]]=_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xa5')];})[_0x65d2('0x14')](function(){return db[_0x65d2('0x62')][_0x65d2('0x72')]({'where':{'id':_0x3c5b5e['params']['id']},'include':[{'model':db[_0x65d2('0xaa')],'as':_0x65d2('0xab'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x518174,'limit':0x1,'order':[[_0x65d2('0xac'),_0x65d2('0xad')]]}]},{'model':db['ChatApplication'],'as':_0x65d2('0xae')},{'model':db['Interval'],'as':_0x65d2('0xaf'),'include':[{'model':db[_0x65d2('0xaf')],'as':_0x65d2('0x3a'),'attributes':['id',_0x65d2('0x30')],'raw':!![]}]}]});})[_0x65d2('0x14')](function(_0x35721a){if(!_0x35721a)throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x3c5b5e[_0x65d2('0x66')]['id']));if(!_0x35721a[_0x65d2('0xaf')]||!_0x35721a[_0x65d2('0xaf')]['Intervals'])return[_0x35721a,!![]];return[_0x35721a,checkWebsiteIntervals(_0x35721a)];})['spread'](function(_0x59bc3c,_0x22c581){if(!_0x22c581)throw new APIOutOfIntervalError();if(!_0x59bc3c[_0x65d2('0xab')])return;_0x400298['account']=_0x59bc3c;_0x400298[_0x65d2('0xb0')]=_0x59bc3c[_0x65d2('0xab')];_0x400298['applications']=_[_0x65d2('0xb1')](_0x59bc3c['Applications'],[_0x65d2('0xb2')],[_0x65d2('0xb3')]);if(_0x400298[_0x65d2('0xb4')][_0x65d2('0xae')]){delete _0x400298['account']['Applications'];}if(_0x400298[_0x65d2('0xb4')][_0x65d2('0xab')]&&_0x400298[_0x65d2('0xb4')]['List']['Contacts']['length']){return _0x400298[_0x65d2('0xb4')][_0x65d2('0xab')]['Contacts'][0x0];}var _0x522567=_[_0x65d2('0xb5')](_0x3c5b5e[_0x65d2('0x6b')],{'firstName':_0x3c5b5e[_0x65d2('0x6b')]['from'],'ListId':_0x59bc3c[_0x65d2('0xa4')]});_0x522567[_0x3c5b5e[_0x65d2('0x6b')]['mapKey']]=_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xa5')];return db['CmContact'][_0x65d2('0x6a')](_0x522567,{'fields':_0x892ea6,'raw':!![]});})['then'](function(_0x409e8a){_0x400298['contact']=_0x409e8a;var _0x461a4d=createInteractionObject(_0x3c5b5e[_0x65d2('0x66')]['id'],_0x3c5b5e['body'],_0x3c5b5e[_0x65d2('0xb6')],_0x409e8a);var _0x3acf8d={'ChatWebsiteId':_0x3c5b5e[_0x65d2('0x66')]['id'],'closed':![]};if(_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb7')]){_0x3acf8d[_0x65d2('0xb7')]=_0x3c5b5e['body'][_0x65d2('0xb7')];return db[_0x65d2('0xb8')][_0x65d2('0x72')]({'where':_0x3acf8d})[_0x65d2('0x14')](function(_0x23b585){if(_0x23b585){_0x2d7aa3=!![];return _0x23b585;}_0x461a4d[_0x65d2('0xb7')]=_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb7')];_0x461a4d[_0x65d2('0xb9')]=_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb9')];return db[_0x65d2('0xb8')][_0x65d2('0x6a')](_0x461a4d);});}_0x3acf8d[_0x65d2('0xba')]=_0x409e8a['id'];if(_0x3c5b5e[_0x65d2('0x6b')]['interaction']&&_0x3c5b5e[_0x65d2('0x6b')]['interaction']['id']){_0x3acf8d['id']=_0x3c5b5e['body'][_0x65d2('0xbb')]['id'];return db[_0x65d2('0xb8')][_0x65d2('0x72')]({'where':_0x3acf8d})[_0x65d2('0x14')](function(_0x4993aa){if(_0x4993aa){_0x2d7aa3=!![];return _0x4993aa;}return db['ChatInteraction'][_0x65d2('0x6a')](_0x461a4d);});}return db[_0x65d2('0xb8')]['create'](_0x461a4d);})[_0x65d2('0x14')](function(_0xb0c75d){if(!_0x2d7aa3)return _0xb0c75d;var _0x2a4254={'from':(_0x400298['contact'][_0x65d2('0x43')]||'')+'\x20'+(_0x400298[_0x65d2('0xbc')][_0x65d2('0xbd')]||'')};if(_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb7')]&&_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xbe')]&&_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xb7')]!=_0x3c5b5e[_0x65d2('0x6b')]['messageId']){_0x2a4254['threadId']=_0x3c5b5e['body']['messageId'];}return _0xb0c75d['update'](_0x2a4254);})[_0x65d2('0x14')](function(_0x132975){_0x400298[_0x65d2('0xbb')]=_0x132975[_0x65d2('0x6d')]({'plain':!![]});_0x400298[_0x65d2('0xbb')][_0x65d2('0xbf')]=!_0x2d7aa3;if(_0x400298[_0x65d2('0xbb')]['created']){if(_0x400298['account']['autoclose']){_0x400298['applications']['push']({'id':0x0,'priority':_0x400298['applications'][_0x65d2('0x57')]+0x1,'app':_0x65d2('0xc0'),'appdata':_0x65d2('0xc1'),'interval':_0x65d2('0xc2')});}}return db[_0x65d2('0xc3')][_0x65d2('0x6a')]({'body':_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0x6b')],'ChatWebsiteId':_0x3c5b5e['params']['id'],'ChatInteractionId':_0x132975['id'],'direction':'in','ContactId':_0x400298[_0x65d2('0xbc')]['id'],'AttachmentId':_0x3c5b5e[_0x65d2('0x6b')][_0x65d2('0xc4')]});})[_0x65d2('0x14')](function(_0x4abd50){_0x400298[_0x65d2('0x1b')]=_0x4abd50;if(!_0x400298[_0x65d2('0xbb')][_0x65d2('0xc5')]){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x400298['interaction']['UserId']}});})[_0x65d2('0x14')](function(_0x549a2a){if(_0x549a2a){_0x400298['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x549a2a[_0x65d2('0x2a')]+','+(_0x400298['account'][_0x65d2('0xc6')]||0xa),'interval':_0x65d2('0xc2')});_0x400298['forcedOwnership']=!![];}if(!_0x400298[_0x65d2('0xbb')][_0x65d2('0xc7')]){return;}return db[_0x65d2('0xc8')][_0x65d2('0x72')]({'attributes':['id',_0x65d2('0x2a')],'where':{'id':_0x400298[_0x65d2('0xbb')][_0x65d2('0xc7')]}});})[_0x65d2('0x14')](function(_0x3f6ad7){if(_0x3f6ad7){_0x400298['applications'][_0x65d2('0xc9')]({'id':0x0,'priority':0x1,'app':_0x65d2('0xca'),'appdata':_0x3f6ad7['name']+','+(_0x400298[_0x65d2('0xb4')][_0x65d2('0xcb')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x65d2('0xcc'),_0x65d2('0xcd'),_0x400298);})[_0x65d2('0x14')](function(_0x33b64e){respondWithRpcPromise(_0x65d2('0xce'),_0x65d2('0xce'),{'event':'notify','message':_0x33b64e},client9002);return _0x33b64e;})['then'](respondWithResult(_0x32cd6a,null))[_0x65d2('0x36')](APIHandleError(_0x32cd6a));};exports[_0x65d2('0xcf')]=function(_0x33347e,_0x2bb54d){var _0x51a3a2,_0x478eba,_0x1a49db;var _0x431904=[];var _0x54200c={};var _0x582aba=_0x33347e[_0x65d2('0xd0')]||[];var _0x832f63=[];var _0x18a87e;return db[_0x65d2('0x9c')]['describe']()['then'](function(_0xf329d1){if(!_0xf329d1){throw new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))]('no\x20available\x20attributes');}_0x431904=_['difference'](_['keys'](_0xf329d1),[_0x65d2('0xa1'),_0x65d2('0xac'),_0x65d2('0xa3'),_0x65d2('0xa4')]);if(_0x33347e[_0x65d2('0x6b')]['id']){delete _0x33347e['body']['id'];}if(_[_0x65d2('0x8e')](_0x33347e[_0x65d2('0x6b')][_0x65d2('0xa5')])){throw _0x2bb54d[_0x65d2('0x1e')](0x1f4)[_0x65d2('0x2b')](new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))]('from\x20is\x20mandatory'));}if(_[_0x65d2('0x8e')](_0x33347e[_0x65d2('0x6b')][_0x65d2('0x6b')])||_0x33347e[_0x65d2('0x6b')][_0x65d2('0x6b')]===''){throw _0x2bb54d[_0x65d2('0x1e')](0x1f4)[_0x65d2('0x2b')](new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))](_0x65d2('0xa6')));}if(_[_0x65d2('0x8e')](_0x33347e[_0x65d2('0x6b')][_0x65d2('0xd1')])){throw _0x2bb54d[_0x65d2('0x1e')](0x1f4)[_0x65d2('0x2b')](new db[(_0x65d2('0x9e'))][(_0x65d2('0x9f'))](_0x65d2('0xd2')+_0x431904));}if(!_[_0x65d2('0xa8')](_0x431904,_0x33347e[_0x65d2('0x6b')][_0x65d2('0xd1')])){throw _0x2bb54d[_0x65d2('0x1e')](0x1f4)[_0x65d2('0x2b')](new db['Sequelize'][(_0x65d2('0x9f'))](_0x65d2('0xd3')+_0x431904));}_0x54200c[_0x33347e[_0x65d2('0x6b')]['mapKeyOffline']]=_0x33347e[_0x65d2('0x6b')][_0x65d2('0xa5')];})[_0x65d2('0x14')](function(){return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x33347e[_0x65d2('0x66')]['id']},'include':[{'model':db[_0x65d2('0xaa')],'as':'List'},{'model':db[_0x65d2('0xd4')],'as':_0x65d2('0xd4')}]});})[_0x65d2('0x14')](handleEntityNotFound(_0x2bb54d,null))['then'](function(_0x2a755f){if(_0x2a755f&&_0x2a755f['List']){_0x478eba=_0x2a755f;var _0x58e5ac=_[_0x65d2('0xb5')](_0x33347e[_0x65d2('0x6b')],{'firstName':_0x33347e['body'][_0x65d2('0xa5')],'phone':_0x33347e[_0x65d2('0x6b')][_0x65d2('0xa5')],'ListId':_0x2a755f[_0x65d2('0xa4')]});_0x58e5ac[_0x33347e[_0x65d2('0x6b')]['mapKeyOffline']]=_0x33347e[_0x65d2('0x6b')][_0x65d2('0xa5')];return db['CmContact']['findOrCreate']({'where':_0x54200c,'defaults':_0x58e5ac});}})[_0x65d2('0xd5')](function(_0x5a1858){if(_0x5a1858){_0x1a49db=_0x5a1858;var _0x17859b=fs['readFileSync'](path['join'](config[_0x65d2('0x8a')],'server/files/templates/chatOfflineMessage.ejs'),_0x65d2('0xd6'));var _0x566136=ejs[_0x65d2('0xd7')](_0x17859b,{'body':_[_0x65d2('0xd8')](_0x33347e[_0x65d2('0x6b')]['body']),'bodyTitle':_0x478eba[_0x65d2('0xd9')]});return db[_0x65d2('0xda')][_0x65d2('0x6a')]({'body':_0x566136,'plainBody':htmlToText[_0x65d2('0xdb')](_0x566136),'ContactId':_0x5a1858['id'],'ChatWebsiteId':_0x478eba['id']});}})[_0x65d2('0x14')](function(_0x85b208){_0x18a87e=_0x85b208;if(_0x582aba[_0x65d2('0x57')]){var _0x4aa86a=_0x582aba[_0x65d2('0x39')](function(_0x32724b){return{'name':_0x32724b[_0x65d2('0xdc')],'basename':_0x32724b[_0x65d2('0x81')],'type':_0x32724b[_0x65d2('0xdd')],'ChatOfflineMessageId':_0x85b208['id']};});_0x832f63=_0x4aa86a[_0x65d2('0x39')](_0x3397c0=>{var _0x59c527={'filename':_0x3397c0['name'],'path':path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0xde'),_0x65d2('0xd0'),_0x65d2('0xdf'),_0x65d2('0xe0'),_0x3397c0[_0x65d2('0xe1')])};return _0x59c527;});if(!_0x478eba[_0x65d2('0xe2')]){return db['sequelize'][_0x65d2('0xe3')](function(_0x1e1933){return db[_0x65d2('0xe4')][_0x65d2('0xe5')](_0x4aa86a,{'transaction':_0x1e1933});});}}})[_0x65d2('0x14')](function(){if(_0x18a87e){_0x51a3a2=_0x18a87e;return db['MailAccount'][_0x65d2('0x78')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x65d2('0xe6')],'as':_0x65d2('0xe6'),'raw':!![]}]}]});}})[_0x65d2('0x14')](function(_0x346dc3){if(_0x346dc3&&_0x346dc3['Smtp']&&_0x478eba['forwardOffline']&&_0x478eba[_0x65d2('0xe7')]){var _0x48fed6=_0x346dc3['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x65d2('0xe8'),{'account':_0x48fed6,'message':{'from':util[_0x65d2('0x2e')](_0x65d2('0xe9'),_0x346dc3[_0x65d2('0x2a')],_0x346dc3[_0x65d2('0xea')]||_0x346dc3[_0x65d2('0xeb')][_0x65d2('0x6c')]),'to':_0x478eba[_0x65d2('0xe7')],'subject':_0x478eba[_0x65d2('0xec')],'html':_0x51a3a2[_0x65d2('0x6b')],'attachments':_0x832f63}},client9003)[_0x65d2('0x14')](function(){return _0x51a3a2;})[_0x65d2('0x36')](function(_0x3ffd4d){logger[_0x65d2('0x1a')](_0x3ffd4d);});}})[_0x65d2('0x14')](function(){if(_0x478eba&&_0x478eba[_0x65d2('0xe2')]&&_0x478eba[_0x65d2('0xed')]){var _0x3db7a1=[];if(_0x582aba[_0x65d2('0x57')]){_0x3db7a1=_0x582aba['map'](function(_0x2e626f){return{'name':_0x2e626f[_0x65d2('0xdc')],'basename':_0x2e626f[_0x65d2('0x81')],'type':_0x2e626f[_0x65d2('0xdd')],'ChatOfflineMessageId':_0x18a87e['id']};});}var _0x3bec36;if(!_[_0x65d2('0x8e')](_0x478eba[_0x65d2('0xee')])){var _0x4c722a=_[_0x65d2('0x39')](_0x33347e[_0x65d2('0x6b')],function(_0x1d7e79){return _0x1d7e79;});var _0x224ad8=_[_0x65d2('0xef')](_0x4c722a)[0x0];var _0x1c9e72=_[_0x65d2('0xf0')](_0x224ad8,function(_0x2ead1e){return _0x2ead1e;});_0x3bec36=_0x1c9e72[0x1][_0x478eba[_0x65d2('0xee')]];}var _0x5e5b22={'from':_0x1a49db[_0x65d2('0xea')],'firstName':_0x1a49db['firstName'],'lastName':_0x1a49db[_0x65d2('0xbd')],'mapKey':_0x65d2('0xea'),'message':{'from':_0x1a49db[_0x65d2('0xea')],'to':_0x478eba[_0x65d2('0xd4')][_0x65d2('0xea')],'cc':'','subject':_['isNil'](_0x3bec36)?_0x478eba['offlineMessageSubject']:_0x3bec36,'messageId':'','sentAt':new Date(),'attach':_0x3db7a1[_0x65d2('0x57')],'attachments':_0x3db7a1,'originChannel':_0x65d2('0xf1'),'ChatWebsiteId':_0x478eba['id'],'ChatOfflineMessageId':_0x51a3a2['id'],'originTo':_0x478eba[_0x65d2('0xd4')]['email']},'body':_0x51a3a2[_0x65d2('0x6b')]};var _0x26d613={'account':{'id':_0x478eba['MailAccountId']},'body':_0x5e5b22,'log':_0x65d2('0xf2')};return respondWithRpcPromise(_0x65d2('0xf2'),_0x65d2('0xf3'),_0x26d613,client9001)[_0x65d2('0x14')](function(){return _0x51a3a2;})[_0x65d2('0x36')](function(_0x5d7387){logger[_0x65d2('0x1a')](_0x5d7387);});}return;})[_0x65d2('0x14')](function(){if(_0x51a3a2){return _0x51a3a2;}})[_0x65d2('0x14')](respondWithResult(_0x2bb54d,null))['catch'](function(){for(var _0x2c2828 of _0x582aba){var _0x35fbe0=path[_0x65d2('0x89')](config[_0x65d2('0x8a')],_0x65d2('0xde'),_0x65d2('0xd0'),_0x65d2('0xdf'),_0x65d2('0xe0'),_0x2c2828['filename']);fs_extra['remove'](_0x35fbe0)['catch'](function(_0x2f96b3){logger['error'](_0x65d2('0xf4'),_0x35fbe0,_0x2f96b3);});}});};exports[_0x65d2('0xf5')]=function(_0x2820e8,_0x472fad){return db[_0x65d2('0xb8')][_0x65d2('0x72')]({'where':{'id':_0x2820e8[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x472fad,null))[_0x65d2('0x14')](function(_0x431288){if(_0x431288){return _0x431288[_0x65d2('0xf5')](_0x2820e8[_0x65d2('0x6b')][_0x65d2('0x7a')],_[_0x65d2('0xf6')](_0x2820e8[_0x65d2('0x6b')],[_0x65d2('0x7a'),'id'])||{});}})[_0x65d2('0x14')](respondWithResult(_0x472fad,null))[_0x65d2('0x36')](handleError(_0x472fad,null));};exports['getInteractions']=function(_0x28188c,_0x8f82bf){var _0x5153dc={'raw':![],'where':{}};var _0x143083={};var _0x5936c4={'count':0x0,'rows':[]};return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x28188c[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x8f82bf,null))[_0x65d2('0x14')](function(_0x4a9496){if(_0x4a9496){_0x143083[_0x65d2('0x4b')]=_['keys'](db[_0x65d2('0xb8')][_0x65d2('0x50')]);_0x143083[_0x65d2('0x52')]=_['keys'](_0x28188c[_0x65d2('0x52')]);_0x143083[_0x65d2('0x54')]=_['intersection'](_0x143083[_0x65d2('0x4b')],_0x143083[_0x65d2('0x52')]);_0x5153dc[_0x65d2('0x55')]=_['intersection'](_0x143083['model'],qs[_0x65d2('0x56')](_0x28188c['query'][_0x65d2('0x56')]));_0x5153dc[_0x65d2('0x55')]=_0x5153dc[_0x65d2('0x55')][_0x65d2('0x57')]?_0x5153dc['attributes']:_0x143083['model'];if(!_0x28188c[_0x65d2('0x52')][_0x65d2('0x58')]('nolimit')){_0x5153dc[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x28188c['query'][_0x65d2('0x23')]);_0x5153dc[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x28188c[_0x65d2('0x52')][_0x65d2('0x21')]);}_0x5153dc[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x28188c[_0x65d2('0x52')][_0x65d2('0x5b')]);_0x5153dc['where']=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x28188c[_0x65d2('0x52')],_0x143083[_0x65d2('0x54')]));_0x5153dc[_0x65d2('0x5f')][_0x65d2('0x7b')]=_0x4a9496['id'];if(_0x28188c[_0x65d2('0x52')][_0x65d2('0x5d')]){_0x5153dc[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x5153dc[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x5153dc[_0x65d2('0x55')],function(_0x1cb101){var _0x52f530={};_0x52f530[_0x1cb101]={'$like':'%'+_0x28188c[_0x65d2('0x52')]['filter']+'%'};return _0x52f530;})});}_0x5153dc=_[_0x65d2('0x5e')]({},_0x5153dc,_0x28188c['options']);return db[_0x65d2('0xb8')][_0x65d2('0x24')]({'where':_0x5153dc[_0x65d2('0x5f')]})[_0x65d2('0x14')](function(_0x14b1f2){_0x5936c4[_0x65d2('0x24')]=_0x14b1f2;if(_0x28188c[_0x65d2('0x52')][_0x65d2('0x68')]){_0x5153dc[_0x65d2('0x69')]=[{'model':db[_0x65d2('0x9c')],'as':_0x65d2('0xf7'),'required':![]},{'model':db[_0x65d2('0xf8')],'as':_0x65d2('0xf9'),'attributes':['name',_0x65d2('0xfa'),_0x65d2('0xfb')],'required':![]},{'model':db[_0x65d2('0xfc')],'as':'Tags','attributes':['id',_0x65d2('0x2a'),_0x65d2('0xfd')],'where':_0x28188c[_0x65d2('0x52')][_0x65d2('0xfe')]?{'id':_0x28188c[_0x65d2('0x52')]['tag']}:undefined,'required':_0x28188c[_0x65d2('0x52')][_0x65d2('0xfe')]?!![]:![]}];}return db['ChatInteraction'][_0x65d2('0x63')](_0x5153dc);})[_0x65d2('0x14')](function(_0x4abee4){_0x5936c4[_0x65d2('0x64')]=_0x4abee4;return _0x5936c4;});}})[_0x65d2('0x14')](respondWithFilteredResult(_0x8f82bf,_0x5153dc))[_0x65d2('0x36')](handleError(_0x8f82bf,null));};exports[_0x65d2('0x2d')]=function(_0x2b7033,_0x21ae48){var _0x36d7cd=0x0;var _0x2cd96d=0x0;var _0x3bc1c7=![];var _0x1d324f;var _0x31bc70;return db[_0x65d2('0x62')]['find']({'where':{'id':_0x2b7033[_0x65d2('0x66')]['id']},'include':[{'model':db[_0x65d2('0xaf')],'as':'Interval','include':[{'model':db[_0x65d2('0xaf')],'as':'Intervals','attributes':['id','interval']}]}]})[_0x65d2('0x14')](handleEntityNotFound(_0x21ae48,null))[_0x65d2('0x14')](function(_0x48f4a8){if(_0x48f4a8){_0x1d324f=_0x48f4a8;return _0x48f4a8['getProactiveActions']({'raw':!![]});}})[_0x65d2('0x14')](function(_0x285d08){if(_0x1d324f){if(_0x285d08){_0x31bc70=_0x285d08;}}return require('../../config/license/util')[_0x65d2('0x8c')]();})[_0x65d2('0x14')](function(_0x4907d9){if(_0x4907d9){_0x2cd96d=_0x4907d9[_0x65d2('0xff')];_0x3bc1c7=_0x4907d9[_0x65d2('0x8d')];}})[_0x65d2('0x14')](function(){return db[_0x65d2('0xb8')][_0x65d2('0x24')]({'where':{'closed':![]}});})[_0x65d2('0x14')](function(_0x1064c1){_0x36d7cd=_0x1064c1;if(_0x2cd96d&&_0x1064c1>_0x2cd96d){return db['License']['findOne']({'where':{'id':0x1}})[_0x65d2('0x14')](function(_0x51dfdf){if(_0x51dfdf){_0x51dfdf[_0x65d2('0x100')](_0x65d2('0x101'));}});}})[_0x65d2('0x14')](function(){if(!_0x1d324f[_0x65d2('0xaf')]||!_0x1d324f[_0x65d2('0xaf')][_0x65d2('0x3a')])return!![];return checkWebsiteIntervals(_0x1d324f);})[_0x65d2('0x14')](function(_0xe0b7d3){var _0x1927f0=fs[_0x65d2('0x102')](path[_0x65d2('0x89')](config['root'],_0x65d2('0x103')),_0x65d2('0xd6'));var _0x4518ad=new url[(_0x65d2('0x104'))](_0x1d324f[_0x65d2('0x105')])[_0x65d2('0x106')];var _0x4de7bd=_0x65d2('0x107');var _0x76d8d2=![];var _0x44b538={'chatVersion':_0x4de7bd,'chatWebsiteAddressOrigin':_0x4518ad,'remote':_0x1d324f[_0x65d2('0x108')],'query':querystring['stringify'](_[_0x65d2('0x5e')](_0x1d324f[_0x65d2('0x6d')]({'plain':!![]}),{'customerIp':_0x2b7033[_0x65d2('0xb6')][_0x65d2('0x40')]||_0x2b7033['headers'][_0x65d2('0x109')]||_0x2b7033[_0x65d2('0x10a')][_0x65d2('0x10b')]||_0x2b7033['ip'],'referer':_0x2b7033[_0x65d2('0xb6')][_0x65d2('0x45')],'openedInteractions':_0x36d7cd,'maxInteractions':_0x2cd96d,'virtual':_0x3bc1c7[_0x65d2('0xff')],'online':_0xe0b7d3,'custom':_0x3bc1c7}))['replace'](/'/g,'\x5c\x27')};_0x21ae48[_0x65d2('0x2b')](ejs[_0x65d2('0xd7')](Mustache[_0x65d2('0xd7')](_0x1927f0,_0x44b538),{'proactiveActions':_0x31bc70,'alignment':_0x1d324f[_0x65d2('0x10c')],'verticalAlignment':_0x1d324f[_0x65d2('0x10d')],'div_color':_0x1d324f[_0x65d2('0xfd')],'labelText':_0x1d324f[_0x65d2('0x10e')],'text_color':_0x1d324f['textColor'],'text_button_color':_0x1d324f[_0x65d2('0x10f')],'button_color':_0x1d324f['color_button'],'background_color':_0x1d324f[_0x65d2('0x110')],'hideWhenOffline':_0x1d324f[_0x65d2('0x111')],'intervalId':_0x1d324f[_0x65d2('0x112')],'isDevelopment':_0x76d8d2,'chatVersion':_0x4de7bd}));})['catch'](handleError(_0x21ae48,null));};exports[_0x65d2('0x113')]=function(_0x419ba9,_0x3a1e1a){var _0x42d45e=_0x419ba9[_0x65d2('0x66')]['id'];var _0x16f4c1=_0x419ba9[_0x65d2('0x6b')];var _0x5dd7ae=0xc8;var _0x287ad6=null;return db[_0x65d2('0x114')][_0x65d2('0xe3')]({'isolationLevel':db[_0x65d2('0x114')][_0x65d2('0x115')][_0x65d2('0x116')][_0x65d2('0x117')]},function(_0x19ab22){return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x42d45e},'transaction':_0x19ab22})[_0x65d2('0x14')](function(_0x5d9cf4){if(_0x5d9cf4){return db[_0x65d2('0x118')][_0x65d2('0x27')]({'where':{'ChatWebsiteId':_0x42d45e},'transaction':_0x19ab22})['then'](function(){var _0x47002d=_[_0x65d2('0x39')](_0x16f4c1,function(_0x1dd28b){_0x1dd28b[_0x65d2('0x7b')]=_0x42d45e;return _0x1dd28b;});return db[_0x65d2('0x118')]['bulkCreate'](_0x47002d,{'transaction':_0x19ab22});});}else{_0x5dd7ae=0x194;_0x287ad6=[];}});})['then'](function(){if(_0x5dd7ae!==0x194){return db['ChatApplication'][_0x65d2('0x119')]({'where':{'ChatWebsiteId':_0x42d45e},'order':_0x65d2('0xb2')})['then'](function(_0x15d23b){_0x287ad6=_0x15d23b;});}})[_0x65d2('0x36')](function(_0x16a4d8){_0x5dd7ae=0x1f4;logger[_0x65d2('0x1a')](_0x16a4d8[_0x65d2('0x29')]);if(_0x16a4d8['name']){delete _0x16a4d8[_0x65d2('0x2a')];}_0x287ad6=_0x16a4d8;})['finally'](function(){if(_0x287ad6===null){_0x3a1e1a[_0x65d2('0x1d')](_0x5dd7ae);}else{if(_0x5dd7ae===0x1f4){_0x3a1e1a[_0x65d2('0x1e')](_0x5dd7ae)['send'](_0x287ad6);}else{_0x3a1e1a[_0x65d2('0x1e')](_0x5dd7ae)['json'](_0x287ad6);}}});};exports[_0x65d2('0x11a')]=function(_0x46957e,_0x5115c2){var _0x3b319d={};var _0xea9978={};var _0xd4d1fa;var _0x1d643f;return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x46957e['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x5115c2,null))[_0x65d2('0x14')](function(_0x9d9e99){if(_0x9d9e99){_0xd4d1fa=_0x9d9e99;_0xea9978['model']=_[_0x65d2('0x53')](db['ChatApplication'][_0x65d2('0x50')]);_0xea9978[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x46957e[_0x65d2('0x52')]);_0xea9978['filters']=_[_0x65d2('0x67')](_0xea9978['model'],_0xea9978[_0x65d2('0x52')]);_0x3b319d[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0xea9978[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x46957e[_0x65d2('0x52')][_0x65d2('0x56')]));_0x3b319d[_0x65d2('0x55')]=_0x3b319d[_0x65d2('0x55')][_0x65d2('0x57')]?_0x3b319d['attributes']:_0xea9978[_0x65d2('0x4b')];_0x3b319d[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x46957e[_0x65d2('0x52')][_0x65d2('0x5b')]);_0x3b319d[_0x65d2('0x5f')]=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x46957e[_0x65d2('0x52')],_0xea9978[_0x65d2('0x54')]));if(_0x46957e[_0x65d2('0x52')][_0x65d2('0x5d')]){_0x3b319d[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x3b319d[_0x65d2('0x5f')],{'$or':_['map'](_0x3b319d[_0x65d2('0x55')],function(_0x5b2e5c){var _0x1a213a={};_0x1a213a[_0x5b2e5c]={'$like':'%'+_0x46957e[_0x65d2('0x52')]['filter']+'%'};return _0x1a213a;})});}_0x3b319d=_['merge']({},_0x3b319d,_0x46957e['options']);return _0xd4d1fa[_0x65d2('0x11a')](_0x3b319d);}})[_0x65d2('0x14')](function(_0x1eb426){if(_0x1eb426){_0x1d643f=_0x1eb426[_0x65d2('0x57')];if(!_0x46957e[_0x65d2('0x52')]['hasOwnProperty']('nolimit')){_0x3b319d[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x46957e['query']['limit']);_0x3b319d[_0x65d2('0x21')]=qs['offset'](_0x46957e[_0x65d2('0x52')][_0x65d2('0x21')]);}return _0xd4d1fa[_0x65d2('0x11a')](_0x3b319d);}})['then'](function(_0x466bda){if(_0x466bda){return _0x466bda?{'count':_0x1d643f,'rows':_0x466bda}:null;}})[_0x65d2('0x14')](respondWithResult(_0x5115c2,null))['catch'](handleError(_0x5115c2,null));};exports['addProactiveActions']=function(_0x36ef1f,_0x525fe8){return db['chatProactiveAction'][_0x65d2('0x72')]({'where':{'id':_0x36ef1f[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x525fe8,null))[_0x65d2('0x14')](function(_0x5d6cda){if(_0x5d6cda){return _0x5d6cda[_0x65d2('0x11b')](_0x36ef1f['body'][_0x65d2('0x7a')],_['omit'](_0x36ef1f['body'],[_0x65d2('0x7a'),'id'])||{});}})[_0x65d2('0x14')](respondWithResult(_0x525fe8,null))[_0x65d2('0x36')](handleError(_0x525fe8,null));};exports[_0x65d2('0x11c')]=function(_0x1b1d9e,_0x9dc08d){var _0x548515={};var _0x4c0e05={};var _0xc82592;var _0x4adfee;return db[_0x65d2('0x62')]['findOne']({'where':{'id':_0x1b1d9e['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x9dc08d,null))[_0x65d2('0x14')](function(_0x5207bb){if(_0x5207bb){_0xc82592=_0x5207bb;_0x4c0e05[_0x65d2('0x4b')]=_['keys'](db['ChatProactiveAction'][_0x65d2('0x50')]);_0x4c0e05[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x1b1d9e[_0x65d2('0x52')]);_0x4c0e05[_0x65d2('0x54')]=_[_0x65d2('0x67')](_0x4c0e05['model'],_0x4c0e05[_0x65d2('0x52')]);_0x548515[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x4c0e05[_0x65d2('0x4b')],qs['fields'](_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x56')]));_0x548515[_0x65d2('0x55')]=_0x548515[_0x65d2('0x55')][_0x65d2('0x57')]?_0x548515[_0x65d2('0x55')]:_0x4c0e05[_0x65d2('0x4b')];_0x548515[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x1b1d9e['query'][_0x65d2('0x5b')]);_0x548515[_0x65d2('0x5f')]=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x1b1d9e['query'],_0x4c0e05['filters']));if(_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x5d')]){_0x548515[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x548515[_0x65d2('0x5f')],{'$or':_['map'](_0x548515['attributes'],function(_0x4c6850){var _0x52473a={};_0x52473a[_0x4c6850]={'$like':'%'+_0x1b1d9e['query'][_0x65d2('0x5d')]+'%'};return _0x52473a;})});}_0x548515=_[_0x65d2('0x5e')]({},_0x548515,_0x1b1d9e[_0x65d2('0x61')]);return _0xc82592[_0x65d2('0x11c')](_0x548515);}})[_0x65d2('0x14')](function(_0x406943){if(_0x406943){_0x4adfee=_0x406943[_0x65d2('0x57')];if(!_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x58')]('nolimit')){_0x548515[_0x65d2('0x23')]=qs[_0x65d2('0x23')](_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x23')]);_0x548515[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x1b1d9e[_0x65d2('0x52')][_0x65d2('0x21')]);}return _0xc82592['getProactiveActions'](_0x548515);}})[_0x65d2('0x14')](function(_0x2c8818){if(_0x2c8818){return _0x2c8818?{'count':_0x4adfee,'rows':_0x2c8818}:null;}})[_0x65d2('0x14')](respondWithResult(_0x9dc08d,null))[_0x65d2('0x36')](handleError(_0x9dc08d,null));};exports[_0x65d2('0x11d')]=function(_0x325b9e,_0x3e0c3a){var _0x18a11c=_0x325b9e[_0x65d2('0x52')][_0x65d2('0x11e')]===_0x65d2('0x11f')?_0x65d2('0x120'):_0x65d2('0x121');return db[_0x65d2('0x62')]['find']({'attributes':['id',_0x18a11c],'where':{'id':_0x325b9e['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x3e0c3a,null))[_0x65d2('0x14')](function(_0x5d46af){if(_0x5d46af){var _0x897887=_0x5d46af[_0x18a11c];var _0x897d5=_0x897887&&_0x897887[_0x65d2('0x122')]?_0x897887[_0x65d2('0x122')]:[];_0x3e0c3a[_0x65d2('0x2b')]({'fromKey':_[_0x65d2('0x8e')](_0x897887['fromKey'])?undefined:_0x897887[_0x65d2('0x123')],'count':_0x897d5['length'],'rows':_0x897d5});}})[_0x65d2('0x36')](handleError(_0x3e0c3a,null));};exports[_0x65d2('0x124')]=function(_0x51fee2,_0x5794e4){var _0x11fc86={'raw':![],'where':{}};var _0x35cb27={};var _0x1fbd02={'count':0x0,'rows':[]};return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x51fee2[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x5794e4,null))[_0x65d2('0x14')](function(_0xfaba88){if(_0xfaba88){_0x35cb27[_0x65d2('0x4b')]=_[_0x65d2('0x53')](db[_0x65d2('0xda')][_0x65d2('0x50')]);_0x35cb27[_0x65d2('0x52')]=_[_0x65d2('0x53')](_0x51fee2[_0x65d2('0x52')]);_0x35cb27[_0x65d2('0x54')]=_[_0x65d2('0x67')](_0x35cb27[_0x65d2('0x4b')],_0x35cb27[_0x65d2('0x52')]);_0x11fc86[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x35cb27[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x51fee2[_0x65d2('0x52')][_0x65d2('0x56')]));_0x11fc86[_0x65d2('0x55')]=_0x11fc86['attributes'][_0x65d2('0x57')]?_0x11fc86[_0x65d2('0x55')]:_0x35cb27[_0x65d2('0x4b')];if(!_0x51fee2[_0x65d2('0x52')][_0x65d2('0x58')](_0x65d2('0x59'))){_0x11fc86[_0x65d2('0x23')]=qs['limit'](_0x51fee2[_0x65d2('0x52')][_0x65d2('0x23')]);_0x11fc86[_0x65d2('0x21')]=qs[_0x65d2('0x21')](_0x51fee2[_0x65d2('0x52')][_0x65d2('0x21')]);}_0x11fc86[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x51fee2[_0x65d2('0x52')][_0x65d2('0x5b')]);_0x11fc86['where']=qs[_0x65d2('0x54')](_[_0x65d2('0x5c')](_0x51fee2[_0x65d2('0x52')],_0x35cb27[_0x65d2('0x54')]));_0x11fc86[_0x65d2('0x5f')]['ChatWebsiteId']=_0xfaba88['id'];if(_0x51fee2[_0x65d2('0x52')][_0x65d2('0x5d')]){_0x11fc86[_0x65d2('0x5f')]=_[_0x65d2('0x5e')](_0x11fc86[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x11fc86[_0x65d2('0x55')],function(_0x34e879){var _0x55a6fb={};_0x55a6fb[_0x34e879]={'$like':'%'+_0x51fee2[_0x65d2('0x52')][_0x65d2('0x5d')]+'%'};return _0x55a6fb;})});}_0x11fc86=_[_0x65d2('0x5e')]({},_0x11fc86,_0x51fee2[_0x65d2('0x61')]);return db[_0x65d2('0xda')][_0x65d2('0x24')]({'where':_0x11fc86[_0x65d2('0x5f')]})[_0x65d2('0x14')](function(_0x16d657){_0x1fbd02['count']=_0x16d657;if(_0x51fee2[_0x65d2('0x52')][_0x65d2('0x68')]){_0x11fc86[_0x65d2('0x69')]=[{'all':!![]}];}else{_0x11fc86[_0x65d2('0x69')]=[{'model':db[_0x65d2('0x9c')],'as':_0x65d2('0xf7'),'required':![]},{'model':db[_0x65d2('0xe4')],'as':_0x65d2('0x125'),'required':![]}];}return db[_0x65d2('0xda')][_0x65d2('0x63')](_0x11fc86);})[_0x65d2('0x14')](function(_0xff0fe4){_0x1fbd02['rows']=_0xff0fe4;return _0x1fbd02;});}})['then'](respondWithFilteredResult(_0x5794e4,_0x11fc86))['catch'](handleError(_0x5794e4,null));};exports[_0x65d2('0x126')]=function(_0x4138cb,_0x2d2f85){return db['ChatWebsite'][_0x65d2('0x72')]({'where':{'id':_0x4138cb['params']['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x2d2f85,null))[_0x65d2('0x14')](function(_0x2cb663){if(_0x2cb663){return _0x2cb663['addAgents'](_0x4138cb[_0x65d2('0x6b')][_0x65d2('0x7a')],_['omit'](_0x4138cb[_0x65d2('0x6b')],[_0x65d2('0x7a'),'id'])||{})['spread'](function(_0x2bde38){for(var _0x5235f5=0x0;_0x5235f5<_0x4138cb[_0x65d2('0x6b')][_0x65d2('0x7a')][_0x65d2('0x57')];_0x5235f5+=0x1){socket[_0x65d2('0x127')](_0x65d2('0x128'),{'UserId':Number(_0x4138cb['body'][_0x65d2('0x7a')][_0x5235f5]),'ChatWebsiteId':Number(_0x4138cb[_0x65d2('0x66')]['id'])});}return _0x2bde38;});}})[_0x65d2('0x14')](respondWithResult(_0x2d2f85,null))[_0x65d2('0x36')](handleError(_0x2d2f85,null));};exports[_0x65d2('0x129')]=function(_0x1a20a4,_0x14ee33){return db[_0x65d2('0x62')]['find']({'where':{'id':_0x1a20a4[_0x65d2('0x66')]['id']}})[_0x65d2('0x14')](handleEntityNotFound(_0x14ee33,null))['then'](function(_0x4b9467){if(_0x4b9467){return _0x4b9467['removeAgents'](_0x1a20a4[_0x65d2('0x52')][_0x65d2('0x7a')])['then'](function(){if(_[_0x65d2('0x12a')](_0x1a20a4[_0x65d2('0x52')][_0x65d2('0x7a')])){for(var _0x7ad92e=0x0;_0x7ad92e<_0x1a20a4[_0x65d2('0x52')]['ids']['length'];_0x7ad92e+=0x1){socket[_0x65d2('0x127')](_0x65d2('0x12b'),{'UserId':Number(_0x1a20a4['query'][_0x65d2('0x7a')][_0x7ad92e]),'ChatWebsiteId':Number(_0x1a20a4[_0x65d2('0x66')]['id'])});}}else{socket['emit'](_0x65d2('0x12b'),{'UserId':Number(_0x1a20a4[_0x65d2('0x52')]['ids']),'ChatWebsiteId':Number(_0x1a20a4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x14ee33,null))[_0x65d2('0x36')](handleError(_0x14ee33,null));};exports[_0x65d2('0x12c')]=function(_0x153381,_0x1f5ac1){var _0x587422={};var _0x497a1c={};var _0x24b5bd;var _0x32293b;return db[_0x65d2('0x62')][_0x65d2('0x78')]({'where':{'id':_0x153381[_0x65d2('0x66')]['id']}})['then'](handleEntityNotFound(_0x1f5ac1,null))[_0x65d2('0x14')](function(_0x401fe1){if(_0x401fe1){_0x24b5bd=_0x401fe1;_0x497a1c[_0x65d2('0x4b')]=_['keys'](db[_0x65d2('0xf8')][_0x65d2('0x50')]);_0x497a1c[_0x65d2('0x52')]=_['keys'](_0x153381['query']);_0x497a1c[_0x65d2('0x54')]=_['intersection'](_0x497a1c[_0x65d2('0x4b')],_0x497a1c[_0x65d2('0x52')]);_0x587422[_0x65d2('0x55')]=_[_0x65d2('0x67')](_0x497a1c[_0x65d2('0x4b')],qs[_0x65d2('0x56')](_0x153381[_0x65d2('0x52')][_0x65d2('0x56')]));_0x587422['attributes']=_0x587422[_0x65d2('0x55')][_0x65d2('0x57')]?_0x587422[_0x65d2('0x55')]:_0x497a1c[_0x65d2('0x4b')];_0x587422[_0x65d2('0x5a')]=qs[_0x65d2('0x5b')](_0x153381['query'][_0x65d2('0x5b')]);_0x587422['where']=qs[_0x65d2('0x54')](_['pick'](_0x153381['query'],_0x497a1c[_0x65d2('0x54')]));if(_0x153381['query'][_0x65d2('0x5d')]){_0x587422['where']=_['merge'](_0x587422[_0x65d2('0x5f')],{'$or':_[_0x65d2('0x39')](_0x587422[_0x65d2('0x55')],function(_0x640c84){var _0x432d1e={};_0x432d1e[_0x640c84]={'$like':'%'+_0x153381[_0x65d2('0x52')][_0x65d2('0x5d')]+'%'};return _0x432d1e;})});}_0x587422=_[_0x65d2('0x5e')]({},_0x587422,_0x153381['options']);return _0x24b5bd[_0x65d2('0x12c')](_0x587422);}})[_0x65d2('0x14')](function(_0x2afdf2){if(_0x2afdf2){_0x32293b=_0x2afdf2['length'];if(!_0x153381['query'][_0x65d2('0x58')](_0x65d2('0x59'))){_0x587422['limit']=qs[_0x65d2('0x23')](_0x153381['query'][_0x65d2('0x23')]);_0x587422['offset']=qs[_0x65d2('0x21')](_0x153381[_0x65d2('0x52')][_0x65d2('0x21')]);}return _0x24b5bd[_0x65d2('0x12c')](_0x587422);}})['then'](function(_0x52b013){if(_0x52b013){return _0x52b013?{'count':_0x32293b,'rows':_0x52b013}:null;}})[_0x65d2('0x14')](respondWithResult(_0x1f5ac1,null))['catch'](handleError(_0x1f5ac1,null));}; \ No newline at end of file +var _0xa9fc=['destroy','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','inspect','No\x20timezone','map','Interval','Intervals','get','all','some','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','vendor','type','index','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','rows','catch','show','params','Pause','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','ChatWebsiteId','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','notify','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','list','priority','asc','account','from','contact','headers','threadId','ChatInteraction','externalUrl','interaction','lastName','messageId','created','push','applications','close','*,*,*,*','ChatMessage','UserId','User','unshift','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','updatedAt','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Owner','internal','Tag','Tags','tag','getProactiveActions','virtual','License','increment','utf8','origin','3.5.0','remote','connection','render','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','addProactiveActions','omit','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','handleError','../../mysqldb','redis','defaults','localhost','register','http','client','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','status','json','undefined','limit','count','offset','update'];(function(_0x1b57af,_0x839caa){var _0x242d5d=function(_0xf5e00e){while(--_0xf5e00e){_0x1b57af['push'](_0x1b57af['shift']());}};_0x242d5d(++_0x839caa);}(_0xa9fc,0xfd));var _0xca9f=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0xa9fc[_0x368587];return _0x42d33c;};'use strict';var Mustache=require('mustache');var util=require(_0xca9f('0x0'));var path=require(_0xca9f('0x1'));var ejs=require(_0xca9f('0x2'));var fs=require('fs');var fs_extra=require(_0xca9f('0x3'));var _=require(_0xca9f('0x4'));var querystring=require(_0xca9f('0x5'));var htmlToText=require(_0xca9f('0x6'));var Redis=require(_0xca9f('0x7'));var jayson=require('jayson/promise');var url=require('url');var qs=require(_0xca9f('0x8'));var logger=require(_0xca9f('0x9'))(_0xca9f('0xa'));var config=require(_0xca9f('0xb'));var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require('../../errors/api')[_0xca9f('0xc')];var db=require(_0xca9f('0xd'))['db'];config[_0xca9f('0xe')]=_[_0xca9f('0xf')](config[_0xca9f('0xe')],{'host':_0xca9f('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca9f('0xe')]));require('./chatWebsite.socket')[_0xca9f('0x11')](socket);var client=jayson['client'][_0xca9f('0x12')]({'port':0x232c});var client9002=jayson[_0xca9f('0x13')][_0xca9f('0x12')]({'port':0x232a});var client9003=jayson[_0xca9f('0x13')][_0xca9f('0x12')]({'port':0x232b});var client9001=jayson[_0xca9f('0x13')][_0xca9f('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x4f72c5,_0x18377e,_0x2d0189,_0x424d27){return new Promise(function(_0x37cc03,_0x2d11cb){var _0x36dc70=_0x424d27||client;return _0x36dc70['request'](_0x4f72c5,_0x2d0189)[_0xca9f('0x14')](function(_0x30ae2a){logger['info'](_0xca9f('0x15'),_0x18377e,_0xca9f('0x16'));logger[_0xca9f('0x17')](_0xca9f('0x18'),_0x18377e,_0xca9f('0x16'),JSON[_0xca9f('0x19')](_0x30ae2a));if(_0x30ae2a['error']){if(_0x30ae2a['error'][_0xca9f('0x1a')]===0x1f4){logger[_0xca9f('0x1b')](_0xca9f('0x15'),_0x18377e,_0x30ae2a[_0xca9f('0x1b')][_0xca9f('0x1c')]);return _0x2d11cb(_0x30ae2a[_0xca9f('0x1b')][_0xca9f('0x1c')]);}logger[_0xca9f('0x1b')](_0xca9f('0x15'),_0x18377e,_0x30ae2a[_0xca9f('0x1b')][_0xca9f('0x1c')]);return _0x37cc03(_0x30ae2a[_0xca9f('0x1b')]['message']);}else{logger[_0xca9f('0x1d')](_0xca9f('0x15'),_0x18377e,'request\x20sent');_0x37cc03(_0x30ae2a['result'][_0xca9f('0x1c')]);}})['catch'](function(_0x4ff5b4){logger[_0xca9f('0x1b')](_0xca9f('0x15'),_0x18377e,_0x4ff5b4);_0x2d11cb(_0x4ff5b4);});});}function respondWithStatusCode(_0x3d79b0,_0x173966){_0x173966=_0x173966||0xcc;return function(_0xa34f){if(_0xa34f){return _0x3d79b0['sendStatus'](_0x173966);}return _0x3d79b0[_0xca9f('0x1e')](_0x173966)['end']();};}function respondWithResult(_0x150b46,_0x4a0827){_0x4a0827=_0x4a0827||0xc8;return function(_0x40d00c){if(_0x40d00c){return _0x150b46[_0xca9f('0x1e')](_0x4a0827)[_0xca9f('0x1f')](_0x40d00c);}};}function respondWithFilteredResult(_0x449004,_0x296c16){return function(_0x1f6fab){if(_0x1f6fab){var _0x2cb22f=typeof _0x296c16['offset']===_0xca9f('0x20')&&typeof _0x296c16[_0xca9f('0x21')]==='undefined';var _0x19e8ac=_0x1f6fab[_0xca9f('0x22')];var _0x4b37de=_0x2cb22f?0x0:_0x296c16[_0xca9f('0x23')];var _0x135c51=_0x2cb22f?_0x1f6fab[_0xca9f('0x22')]:_0x296c16[_0xca9f('0x23')]+_0x296c16[_0xca9f('0x21')];var _0x44d7ec;if(_0x135c51>=_0x19e8ac){_0x135c51=_0x19e8ac;_0x44d7ec=0xc8;}else{_0x44d7ec=0xce;}_0x449004[_0xca9f('0x1e')](_0x44d7ec);return _0x449004['set']('Content-Range',_0x4b37de+'-'+_0x135c51+'/'+_0x19e8ac)[_0xca9f('0x1f')](_0x1f6fab);}return null;};}function saveUpdates(_0x43bc6e){return function(_0xde54bf){if(_0xde54bf){return _0xde54bf[_0xca9f('0x24')](_0x43bc6e)[_0xca9f('0x14')](function(_0x1332c4){return _0x1332c4;});}return null;};}function removeEntity(_0x5d5694){return function(_0x3b7969){if(_0x3b7969){return _0x3b7969[_0xca9f('0x25')]()['then'](function(){var _0x2dd14e=_0x3b7969['get']({'plain':!![]});var _0x1af3eb=_0xca9f('0x26');return db[_0xca9f('0x27')][_0xca9f('0x25')]({'where':{'type':_0x1af3eb,'resourceId':_0x2dd14e['id']}})['then'](function(){return _0x3b7969;});})[_0xca9f('0x14')](function(){_0x5d5694[_0xca9f('0x1e')](0xcc)[_0xca9f('0x28')]();});}};}function handleEntityNotFound(_0x2b78b3){return function(_0x19ee44){if(!_0x19ee44){_0x2b78b3[_0xca9f('0x29')](0x194);}return _0x19ee44;};}function handleError(_0x8debf,_0x90c31f){_0x90c31f=_0x90c31f||0x1f4;return function(_0x3eb0b4){logger[_0xca9f('0x1b')](_0x3eb0b4[_0xca9f('0x2a')]);if(_0x3eb0b4[_0xca9f('0x2b')]){delete _0x3eb0b4['name'];}_0x8debf[_0xca9f('0x1e')](_0x90c31f)[_0xca9f('0x2c')](_0x3eb0b4);};}function iftimePromise(_0x238997,_0x52309c){return respondWithRpcPromise('Command',_0xca9f('0x2d'),{'command':_0x52309c[_0xca9f('0x2e')]?util[_0xca9f('0x2f')](_0xca9f('0x30'),_0x238997[_0xca9f('0x31')],_0x52309c['timezone']):util[_0xca9f('0x2f')](_0xca9f('0x32'),_0x238997[_0xca9f('0x31')])},client9002)[_0xca9f('0x14')](function(_0xefedc8){var _0x5e0de0=_0xefedc8&&_0xefedc8['indexOf'](_0xca9f('0x33'))>=0x0?!![]:![];logger[_0xca9f('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x52309c['id'],_0x238997['id'],_0x238997['interval'],_0x5e0de0?_0xca9f('0x34'):'OFFLINE',_0x52309c[_0xca9f('0x2e')]?_0x52309c[_0xca9f('0x2e')]:'No\x20timezone');return _0x5e0de0;})['catch'](function(_0x5588ea){logger[_0xca9f('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x52309c['id'],_0x238997['id'],_0x238997['interval'],util[_0xca9f('0x35')](_0x5588ea,{'showHidden':![],'depth':null}),_0x52309c[_0xca9f('0x2e')]?_0x52309c['timezone']:_0xca9f('0x36'));return![];});}function checkWebsiteIntervals(_0x87bb97){var _0x163090=_[_0xca9f('0x37')](_0x87bb97[_0xca9f('0x38')][_0xca9f('0x39')],function(_0x55b6ee){var _0x4494df=_0x55b6ee[_0xca9f('0x3a')]({'plain':!![]});return iftimePromise(_0x4494df,_0x87bb97);});return Promise[_0xca9f('0x3b')](_0x163090)['then'](function(_0x1931bc){return _[_0xca9f('0x3c')](_0x1931bc);});}function createInteractionObject(_0x133796,_0x56c6e5,_0x3abe1b,_0x11f2a8){var _0x61320a=require(_0xca9f('0x3d'));var _0x12d7b9=new _0x61320a();var _0x520035=_0x12d7b9[_0xca9f('0x3e')](_0x3abe1b['user-agent'])[_0xca9f('0x3f')]();var _0xe90b13=_0x56c6e5[_0xca9f('0x40')];if(_0x3abe1b[_0xca9f('0x41')]){_0xe90b13=_0x3abe1b[_0xca9f('0x41')];}else if(_0x3abe1b[_0xca9f('0x42')]){_0xe90b13=_[_0xca9f('0x43')](_0x3abe1b[_0xca9f('0x42')][_0xca9f('0x44')](','));}return{'ContactId':_0x11f2a8['id'],'ChatWebsiteId':_0x133796,'from':(_0x11f2a8[_0xca9f('0x45')]||'')+'\x20'+(_0x11f2a8['lastName']||''),'customerIp':_0xe90b13,'customerPort':_0x3abe1b[_0xca9f('0x46')]?_0x3abe1b[_0xca9f('0x46')]:null,'referer':_0x56c6e5[_0xca9f('0x47')],'browserName':_0x520035[_0xca9f('0x48')][_0xca9f('0x2b')]&&_0x520035['browser'][_0xca9f('0x49')]?util[_0xca9f('0x2f')](_0xca9f('0x4a'),_0x520035['browser'][_0xca9f('0x2b')],_0x520035[_0xca9f('0x48')][_0xca9f('0x49')]):_0xca9f('0x4b'),'browserVersion':_0x520035[_0xca9f('0x48')][_0xca9f('0x49')]||'unknown','osName':util[_0xca9f('0x2f')](_0xca9f('0x4a'),_0x520035['os'][_0xca9f('0x2b')],_0x520035['os'][_0xca9f('0x49')]),'osVersion':_0x520035['os'][_0xca9f('0x49')],'deviceModel':_0x520035[_0xca9f('0x4c')][_0xca9f('0x4d')]&&_0x520035[_0xca9f('0x4c')][_0xca9f('0x4e')]?util[_0xca9f('0x2f')]('%s\x20%s\x20%s',_0x520035[_0xca9f('0x4c')]['model'],_0x520035[_0xca9f('0x4c')][_0xca9f('0x4e')],_0x520035[_0xca9f('0x4c')][_0xca9f('0x4f')]):null,'deviceVendor':_0x520035[_0xca9f('0x4c')][_0xca9f('0x4e')],'deviceType':_0x520035['device']['type'],'formData':JSON[_0xca9f('0x19')](_0x56c6e5)};}exports[_0xca9f('0x50')]=function(_0x509c9d,_0x1b1047){var _0x5582ca={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2de39c={},_0x338d6f={'count':0x0,'rows':[]};var _0x397125=_[_0xca9f('0x37')](db[_0xca9f('0x51')][_0xca9f('0x52')],function(_0x45f9bc){return{'name':_0x45f9bc[_0xca9f('0x53')],'type':_0x45f9bc[_0xca9f('0x4f')][_0xca9f('0x54')]};});_0x2de39c[_0xca9f('0x4d')]=_['map'](_0x397125,_0xca9f('0x2b'));_0x2de39c[_0xca9f('0x55')]=_[_0xca9f('0x56')](_0x509c9d[_0xca9f('0x55')]);_0x2de39c[_0xca9f('0x57')]=_[_0xca9f('0x58')](_0x2de39c[_0xca9f('0x4d')],_0x2de39c['query']);_0x5582ca[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x2de39c['model'],qs[_0xca9f('0x5a')](_0x509c9d[_0xca9f('0x55')]['fields']));_0x5582ca[_0xca9f('0x59')]=_0x5582ca[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x5582ca[_0xca9f('0x59')]:_0x2de39c[_0xca9f('0x4d')];if(!_0x509c9d[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x5582ca['limit']=qs['limit'](_0x509c9d[_0xca9f('0x55')]['limit']);_0x5582ca[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x509c9d[_0xca9f('0x55')][_0xca9f('0x23')]);}_0x5582ca[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x509c9d['query'][_0xca9f('0x5f')]);_0x5582ca[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0x509c9d[_0xca9f('0x55')],_0x2de39c[_0xca9f('0x57')]),_0x397125);if(_0x509c9d[_0xca9f('0x55')][_0xca9f('0x62')]){_0x5582ca[_0xca9f('0x60')]=_['merge'](_0x5582ca['where'],{'$or':_['map'](_0x397125,function(_0x207067){if(_0x207067[_0xca9f('0x4f')]!==_0xca9f('0x63')){var _0x3fb80d={};_0x3fb80d[_0x207067[_0xca9f('0x2b')]]={'$like':'%'+_0x509c9d[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x3fb80d;}})});}_0x5582ca=_[_0xca9f('0x64')]({},_0x5582ca,_0x509c9d[_0xca9f('0x65')]);var _0x5e1e2f={'where':_0x5582ca['where']};return db[_0xca9f('0x51')][_0xca9f('0x22')](_0x5e1e2f)[_0xca9f('0x14')](function(_0x8fb35f){_0x338d6f['count']=_0x8fb35f;if(_0x509c9d[_0xca9f('0x55')]['includeAll']){_0x5582ca['include']=[{'all':!![]}];}return db[_0xca9f('0x51')]['findAll'](_0x5582ca);})[_0xca9f('0x14')](function(_0x376b85){_0x338d6f[_0xca9f('0x66')]=_0x376b85;return _0x338d6f;})[_0xca9f('0x14')](respondWithFilteredResult(_0x1b1047,_0x5582ca))[_0xca9f('0x67')](handleError(_0x1b1047,null));};exports[_0xca9f('0x68')]=function(_0x19ae59,_0x95acdf){var _0x20727d={'raw':![],'where':{'id':_0x19ae59[_0xca9f('0x69')]['id']},'include':[{'model':db[_0xca9f('0x6a')],'as':'mandatoryDispositionPause'}]},_0x491a61={};_0x491a61['model']=_[_0xca9f('0x56')](db[_0xca9f('0x51')]['rawAttributes']);_0x491a61[_0xca9f('0x55')]=_[_0xca9f('0x56')](_0x19ae59[_0xca9f('0x55')]);_0x491a61['filters']=_['intersection'](_0x491a61[_0xca9f('0x4d')],_0x491a61[_0xca9f('0x55')]);_0x20727d[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x491a61[_0xca9f('0x4d')],qs[_0xca9f('0x5a')](_0x19ae59[_0xca9f('0x55')]['fields']));_0x20727d['attributes']=_0x20727d['attributes']['length']?_0x20727d[_0xca9f('0x59')]:_0x491a61[_0xca9f('0x4d')];if(_0x19ae59[_0xca9f('0x55')][_0xca9f('0x6b')]){_0x20727d['include']=[{'all':!![]}];}_0x20727d=_[_0xca9f('0x64')]({},_0x20727d,_0x19ae59['options']);return db[_0xca9f('0x51')][_0xca9f('0x6c')](_0x20727d)['then'](handleEntityNotFound(_0x95acdf,null))['then'](respondWithResult(_0x95acdf,null))[_0xca9f('0x67')](handleError(_0x95acdf,null));};exports[_0xca9f('0x6d')]=function(_0x52d135,_0x23b7b1){return db[_0xca9f('0x51')]['create'](_0x52d135[_0xca9f('0x6e')],{})['then'](function(_0x26e351){var _0x448806=_0x52d135['user'][_0xca9f('0x3a')]({'plain':!![]});if(!_0x448806)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x448806[_0xca9f('0x6f')]===_0xca9f('0x70')){var _0x4b7b59=_0x26e351['get']({'plain':!![]});var _0x3d14cd='ChatWebsites';return db[_0xca9f('0x71')]['find']({'where':{'name':_0x3d14cd,'userProfileId':_0x448806[_0xca9f('0x72')]},'raw':!![]})[_0xca9f('0x14')](function(_0x9c2a4c){if(_0x9c2a4c&&_0x9c2a4c[_0xca9f('0x73')]===0x0){return db[_0xca9f('0x27')][_0xca9f('0x6d')]({'name':_0x4b7b59['name'],'resourceId':_0x4b7b59['id'],'type':_0x9c2a4c['name'],'sectionId':_0x9c2a4c['id']},{})[_0xca9f('0x14')](function(){return _0x26e351;});}else{return _0x26e351;}})['catch'](function(_0x5251a9){logger[_0xca9f('0x1b')](_0xca9f('0x74'),_0x5251a9);throw _0x5251a9;});}return _0x26e351;})[_0xca9f('0x14')](respondWithResult(_0x23b7b1,0xc9))['catch'](handleError(_0x23b7b1,null));};exports[_0xca9f('0x24')]=function(_0x12b983,_0x49484e){if(_0x12b983['body']['id']){delete _0x12b983[_0xca9f('0x6e')]['id'];}return db['ChatWebsite'][_0xca9f('0x6c')]({'where':{'id':_0x12b983[_0xca9f('0x69')]['id']},'include':[{'model':db[_0xca9f('0x6a')],'as':_0xca9f('0x75')}]})[_0xca9f('0x14')](handleEntityNotFound(_0x49484e,null))[_0xca9f('0x14')](saveUpdates(_0x12b983['body'],null))['then'](respondWithResult(_0x49484e,null))[_0xca9f('0x67')](handleError(_0x49484e,null));};exports['destroy']=function(_0x2d7c5a,_0x4ec969){return db['ChatWebsite'][_0xca9f('0x6c')]({'where':{'id':_0x2d7c5a['params']['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x4ec969,null))[_0xca9f('0x14')](removeEntity(_0x4ec969,null))[_0xca9f('0x67')](handleError(_0x4ec969,null));};exports[_0xca9f('0x76')]=function(_0x1e4e99,_0x3c9816){return db['ChatWebsite'][_0xca9f('0x76')]()['then'](respondWithResult(_0x3c9816,null))[_0xca9f('0x67')](handleError(_0x3c9816,null));};exports[_0xca9f('0x77')]=function(_0x2a3954,_0x235b6b){if(_0x2a3954[_0xca9f('0x6e')]['id']){delete _0x2a3954['body']['id'];}return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x2a3954[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x235b6b,null))['then'](function(_0x36a3fe){if(_0x36a3fe){_0x2a3954[_0xca9f('0x6e')]['ChatWebsiteId']=_0x36a3fe['id'];return db[_0xca9f('0x78')][_0xca9f('0x6d')](_0x2a3954['body']);}})[_0xca9f('0x14')](respondWithResult(_0x235b6b,null))[_0xca9f('0x67')](handleError(_0x235b6b,null));};exports[_0xca9f('0x79')]=function(_0x1c0445,_0x2a922b){var _0xc4969f={'raw':![],'where':{}};var _0x2e80f2={};var _0x3d87ef={'count':0x0,'rows':[]};return db[_0xca9f('0x51')]['findOne']({'where':{'id':_0x1c0445[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x2a922b,null))[_0xca9f('0x14')](function(_0x46a58d){if(_0x46a58d){_0x2e80f2[_0xca9f('0x4d')]=_[_0xca9f('0x56')](db[_0xca9f('0x78')][_0xca9f('0x52')]);_0x2e80f2[_0xca9f('0x55')]=_['keys'](_0x1c0445[_0xca9f('0x55')]);_0x2e80f2[_0xca9f('0x57')]=_['intersection'](_0x2e80f2[_0xca9f('0x4d')],_0x2e80f2[_0xca9f('0x55')]);_0xc4969f['attributes']=_['intersection'](_0x2e80f2['model'],qs[_0xca9f('0x5a')](_0x1c0445[_0xca9f('0x55')][_0xca9f('0x5a')]));_0xc4969f[_0xca9f('0x59')]=_0xc4969f['attributes']['length']?_0xc4969f[_0xca9f('0x59')]:_0x2e80f2[_0xca9f('0x4d')];if(!_0x1c0445[_0xca9f('0x55')]['hasOwnProperty']('nolimit')){_0xc4969f[_0xca9f('0x21')]=qs[_0xca9f('0x21')](_0x1c0445[_0xca9f('0x55')][_0xca9f('0x21')]);_0xc4969f[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x1c0445[_0xca9f('0x55')][_0xca9f('0x23')]);}_0xc4969f[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x1c0445['query'][_0xca9f('0x5f')]);_0xc4969f[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_['pick'](_0x1c0445[_0xca9f('0x55')],_0x2e80f2[_0xca9f('0x57')]));_0xc4969f[_0xca9f('0x60')][_0xca9f('0x7a')]=_0x46a58d['id'];if(_0x1c0445['query']['filter']){_0xc4969f[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0xc4969f[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0xc4969f[_0xca9f('0x59')],function(_0x40e2bd){var _0x490beb={};_0x490beb[_0x40e2bd]={'$like':'%'+_0x1c0445[_0xca9f('0x55')]['filter']+'%'};return _0x490beb;})});}_0xc4969f=_[_0xca9f('0x64')]({},_0xc4969f,_0x1c0445[_0xca9f('0x65')]);return db['Disposition'][_0xca9f('0x22')]({'where':_0xc4969f[_0xca9f('0x60')]})['then'](function(_0x26691a){_0x3d87ef[_0xca9f('0x22')]=_0x26691a;if(_0x1c0445[_0xca9f('0x55')][_0xca9f('0x6b')]){_0xc4969f[_0xca9f('0x7b')]=[{'all':!![]}];}return db[_0xca9f('0x78')][_0xca9f('0x7c')](_0xc4969f);})[_0xca9f('0x14')](function(_0x2b5a67){_0x3d87ef[_0xca9f('0x66')]=_0x2b5a67;return _0x3d87ef;});}})[_0xca9f('0x14')](respondWithFilteredResult(_0x2a922b,_0xc4969f))['catch'](handleError(_0x2a922b,null));};exports['removeDispositions']=function(_0x419d25,_0x5c1074){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x419d25[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x5c1074,null))[_0xca9f('0x14')](function(_0x5f3b41){if(_0x5f3b41){return _0x5f3b41[_0xca9f('0x7d')](_0x419d25[_0xca9f('0x55')][_0xca9f('0x7e')]);}})[_0xca9f('0x14')](respondWithStatusCode(_0x5c1074,null))[_0xca9f('0x67')](handleError(_0x5c1074,null));};exports[_0xca9f('0x7f')]=function(_0x43e2f3,_0x280c4e){if(_0x43e2f3[_0xca9f('0x6e')]['id']){delete _0x43e2f3[_0xca9f('0x6e')]['id'];}return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x43e2f3[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x280c4e,null))[_0xca9f('0x14')](function(_0x50b0d5){if(_0x50b0d5){_0x43e2f3[_0xca9f('0x6e')][_0xca9f('0x7a')]=_0x50b0d5['id'];return db[_0xca9f('0x80')][_0xca9f('0x6d')](_0x43e2f3[_0xca9f('0x6e')]);}})[_0xca9f('0x14')](respondWithResult(_0x280c4e,null))['catch'](handleError(_0x280c4e,null));};exports[_0xca9f('0x81')]=function(_0xbfdf0,_0x504f24){var _0x247761={'raw':![],'where':{}};var _0x390b25={};var _0x44b89e={'count':0x0,'rows':[]};return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0xbfdf0[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x504f24,null))[_0xca9f('0x14')](function(_0x419f76){if(_0x419f76){_0x390b25['model']=_['keys'](db[_0xca9f('0x80')][_0xca9f('0x52')]);_0x390b25['query']=_[_0xca9f('0x56')](_0xbfdf0[_0xca9f('0x55')]);_0x390b25[_0xca9f('0x57')]=_[_0xca9f('0x58')](_0x390b25[_0xca9f('0x4d')],_0x390b25[_0xca9f('0x55')]);_0x247761[_0xca9f('0x59')]=_['intersection'](_0x390b25['model'],qs[_0xca9f('0x5a')](_0xbfdf0[_0xca9f('0x55')][_0xca9f('0x5a')]));_0x247761['attributes']=_0x247761[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x247761[_0xca9f('0x59')]:_0x390b25['model'];if(!_0xbfdf0['query']['hasOwnProperty'](_0xca9f('0x5d'))){_0x247761[_0xca9f('0x21')]=qs['limit'](_0xbfdf0['query']['limit']);_0x247761[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0xbfdf0[_0xca9f('0x55')]['offset']);}_0x247761['order']=qs[_0xca9f('0x5f')](_0xbfdf0['query'][_0xca9f('0x5f')]);_0x247761[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0xbfdf0[_0xca9f('0x55')],_0x390b25[_0xca9f('0x57')]));_0x247761[_0xca9f('0x60')][_0xca9f('0x7a')]=_0x419f76['id'];if(_0xbfdf0[_0xca9f('0x55')][_0xca9f('0x62')]){_0x247761[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0x247761['where'],{'$or':_[_0xca9f('0x37')](_0x247761['attributes'],function(_0x42dd70){var _0x1b0b37={};_0x1b0b37[_0x42dd70]={'$like':'%'+_0xbfdf0[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x1b0b37;})});}_0x247761=_[_0xca9f('0x64')]({},_0x247761,_0xbfdf0[_0xca9f('0x65')]);return db['CannedAnswer'][_0xca9f('0x22')]({'where':_0x247761[_0xca9f('0x60')]})['then'](function(_0x534daa){_0x44b89e[_0xca9f('0x22')]=_0x534daa;if(_0xbfdf0[_0xca9f('0x55')]['includeAll']){_0x247761['include']=[{'all':!![]}];}return db[_0xca9f('0x80')]['findAll'](_0x247761);})[_0xca9f('0x14')](function(_0x185a8c){_0x44b89e['rows']=_0x185a8c;return _0x44b89e;});}})[_0xca9f('0x14')](respondWithFilteredResult(_0x504f24,_0x247761))[_0xca9f('0x67')](handleError(_0x504f24,null));};exports[_0xca9f('0x83')]=function(_0x59080c,_0x12c4a7){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x59080c[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x12c4a7,null))['then'](function(_0x2fcd16){if(_0x2fcd16){return _0x2fcd16[_0xca9f('0x83')](_0x59080c[_0xca9f('0x55')][_0xca9f('0x7e')]);}})[_0xca9f('0x14')](respondWithStatusCode(_0x12c4a7,null))[_0xca9f('0x67')](handleError(_0x12c4a7,null));};exports[_0xca9f('0x84')]=function(_0x2c74b7,_0xc598fe){_0x2c74b7['body'][_0xca9f('0x85')]=_0x2c74b7['file'][_0xca9f('0x86')];return db['ChatWebsite'][_0xca9f('0x6c')]({'where':{'id':_0x2c74b7[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0xc598fe,null))['then'](saveUpdates(_0x2c74b7[_0xca9f('0x6e')],null))['then'](respondWithResult(_0xc598fe,null))[_0xca9f('0x67')](handleError(_0xc598fe,null));};exports['addAvatar']=function(_0x1f82c2,_0x192bb8){_0x1f82c2[_0xca9f('0x6e')][_0xca9f('0x87')]=_0x1f82c2[_0xca9f('0x88')][_0xca9f('0x86')];return db['ChatWebsite']['find']({'where':{'id':_0x1f82c2[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x192bb8,null))[_0xca9f('0x14')](saveUpdates(_0x1f82c2[_0xca9f('0x6e')],null))['then'](respondWithResult(_0x192bb8,null))[_0xca9f('0x67')](handleError(_0x192bb8,null));};exports['addCustomerAvatar']=function(_0x1ff090,_0x5902b6){_0x1ff090[_0xca9f('0x6e')][_0xca9f('0x89')]=_0x1ff090[_0xca9f('0x88')][_0xca9f('0x86')];return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x1ff090['params']['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x5902b6,null))[_0xca9f('0x14')](saveUpdates(_0x1ff090[_0xca9f('0x6e')],null))['then'](respondWithResult(_0x5902b6,null))[_0xca9f('0x67')](handleError(_0x5902b6,null));};exports['addSystemAvatar']=function(_0x1b87c8,_0x396b04){_0x1b87c8[_0xca9f('0x6e')][_0xca9f('0x8a')]=_0x1b87c8['file'][_0xca9f('0x86')];return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x1b87c8[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x396b04,null))[_0xca9f('0x14')](saveUpdates(_0x1b87c8[_0xca9f('0x6e')],null))[_0xca9f('0x14')](respondWithResult(_0x396b04,null))[_0xca9f('0x67')](handleError(_0x396b04,null));};exports[_0xca9f('0x8b')]=function(_0x8ea22f,_0x365a8a){var _0x223732=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0x8e'));var _0x4c7625={'where':{'id':_0x8ea22f['params']['id']},'attributes':['id',_0xca9f('0x85')],'raw':!![]};var _0x4622c6=![];return require(_0xca9f('0x8f'))[_0xca9f('0x90')]()[_0xca9f('0x14')](function(_0x32c2a8){if(_0x32c2a8){_0x4622c6=_0x32c2a8[_0xca9f('0x91')];}})[_0xca9f('0x14')](function(){return db[_0xca9f('0x51')]['find'](_0x4c7625);})[_0xca9f('0x14')](handleEntityNotFound(_0x365a8a,null))[_0xca9f('0x14')](function(_0x4e9574){if(_0x4e9574){if(!_[_0xca9f('0x92')](_0x4e9574['sitepic'])){if(fs[_0xca9f('0x93')](path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0x94'),_0x4e9574['sitepic']))&&_0x4622c6){_0x223732=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0x94'),_0x4e9574[_0xca9f('0x85')]);}}return _0x365a8a[_0xca9f('0x95')](_0x223732);}})['catch'](handleError(_0x365a8a,null));};exports['getAvatar']=function(_0x3dec24,_0xe232e5){var _0x29df49=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0x96'));var _0x97a0f5={'where':{'id':_0x3dec24[_0xca9f('0x69')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xca9f('0x51')][_0xca9f('0x6c')](_0x97a0f5)['then'](handleEntityNotFound(_0xe232e5,null))[_0xca9f('0x14')](function(_0x462254){if(_0x462254){if(!_[_0xca9f('0x92')](_0x462254['agentAvatar'])){if(fs['existsSync'](path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],'server/files/images/avatars/',_0x462254[_0xca9f('0x87')]))){_0x29df49=path['join'](config[_0xca9f('0x8d')],_0xca9f('0x97'),_0x462254[_0xca9f('0x87')]);}}return _0xe232e5['download'](_0x29df49);}})[_0xca9f('0x67')](handleError(_0xe232e5,null));};exports[_0xca9f('0x98')]=function(_0x948c25,_0x57e916){var _0x4545cc=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],'server/files/images/avatars/customer_avatar.png');var _0x4a3d38={'where':{'id':_0x948c25[_0xca9f('0x69')]['id']},'attributes':['id',_0xca9f('0x89'),_0xca9f('0x99')],'raw':!![]};return db[_0xca9f('0x51')][_0xca9f('0x6c')](_0x4a3d38)[_0xca9f('0x14')](handleEntityNotFound(_0x57e916,null))[_0xca9f('0x14')](function(_0xdd77d5){if(_0xdd77d5){if(!_[_0xca9f('0x92')](_0xdd77d5[_0xca9f('0x89')])){if(fs[_0xca9f('0x93')](path[_0xca9f('0x8c')](config['root'],_0xca9f('0x97'),_0xdd77d5[_0xca9f('0x89')]))&&_0xdd77d5['showCustomerAvatar']){_0x4545cc=path[_0xca9f('0x8c')](config['root'],'server/files/images/avatars/',_0xdd77d5[_0xca9f('0x89')]);}}return _0x57e916[_0xca9f('0x95')](_0x4545cc);}})[_0xca9f('0x67')](handleError(_0x57e916,null));};exports['getSystemAvatar']=function(_0x295479,_0xb8fc0e){var _0x502a19=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],'server/files/images/avatars/system_avatar.png');var _0x354695={'where':{'id':_0x295479[_0xca9f('0x69')]['id']},'attributes':['id',_0xca9f('0x8a')],'raw':!![]};return db['ChatWebsite']['find'](_0x354695)[_0xca9f('0x14')](handleEntityNotFound(_0xb8fc0e,null))[_0xca9f('0x14')](function(_0x3bee67){if(_0x3bee67){if(!_[_0xca9f('0x92')](_0x3bee67[_0xca9f('0x8a')])){if(fs[_0xca9f('0x93')](path['join'](config[_0xca9f('0x8d')],_0xca9f('0x97'),_0x3bee67[_0xca9f('0x8a')]))){_0x502a19=path[_0xca9f('0x8c')](config['root'],_0xca9f('0x97'),_0x3bee67[_0xca9f('0x8a')]);}}return _0xb8fc0e[_0xca9f('0x95')](_0x502a19);}})[_0xca9f('0x67')](handleError(_0xb8fc0e,null));};exports[_0xca9f('0x9a')]=function(_0x2c2686,_0x409bf0){var _0x2ca6f2={'body':_0x2c2686[_0xca9f('0x6e')],'channel':_0xca9f('0x9b')};var _0x2771be=[];var _0x36097d=[];var _0x331e75={};var _0x122302=![];return db[_0xca9f('0x9c')][_0xca9f('0x76')]()[_0xca9f('0x14')](function(_0x5a309c){if(!_0x5a309c){throw new db['Sequelize'][(_0xca9f('0x9d'))](_0xca9f('0x9e'));}_0x2771be=_[_0xca9f('0x9f')](_['keys'](_0x5a309c),[_0xca9f('0xa0'),'updatedAt']);_0x36097d=_['difference'](_[_0xca9f('0x56')](_0x5a309c),[_0xca9f('0xa0'),'updatedAt','CompanyId',_0xca9f('0xa1')]);if(_0x2c2686[_0xca9f('0x6e')]['id']){delete _0x2c2686['body']['id'];}if(_[_0xca9f('0x92')](_0x2c2686['body']['from'])){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa3'));}if(_[_0xca9f('0x92')](_0x2c2686[_0xca9f('0x6e')][_0xca9f('0x6e')])||_0x2c2686['body'][_0xca9f('0x6e')]===''){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa4'));}if(_[_0xca9f('0x92')](_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xa5')])){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa6')+_0x36097d);}if(!_[_0xca9f('0xa7')](_0x36097d,_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xa5')])){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa8')+_0x36097d);}_0x331e75[_0x2c2686['body'][_0xca9f('0xa5')]]=_0x2c2686[_0xca9f('0x6e')]['from'];})[_0xca9f('0x14')](function(){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x2c2686[_0xca9f('0x69')]['id']},'include':[{'model':db[_0xca9f('0xa9')],'as':_0xca9f('0xaa'),'include':[{'model':db[_0xca9f('0x9c')],'as':_0xca9f('0xab'),'where':_0x331e75,'limit':0x1,'order':[['updatedAt',_0xca9f('0xac')]]}]},{'model':db['ChatApplication'],'as':_0xca9f('0xad')},{'model':db[_0xca9f('0x38')],'as':_0xca9f('0x38'),'include':[{'model':db[_0xca9f('0x38')],'as':_0xca9f('0x39'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0xca9f('0x14')](function(_0x5d9417){if(!_0x5d9417)throw new APINotFoundError(util[_0xca9f('0x2f')](_0xca9f('0xae'),_0x2c2686[_0xca9f('0x69')]['id']));if(!_0x5d9417['Interval']||!_0x5d9417[_0xca9f('0x38')][_0xca9f('0x39')])return[_0x5d9417,!![]];return[_0x5d9417,checkWebsiteIntervals(_0x5d9417)];})[_0xca9f('0xaf')](function(_0x3fccad,_0x5c8bd2){if(!_0x5c8bd2)throw new APIOutOfIntervalError();if(!_0x3fccad['List'])return;_0x2ca6f2['account']=_0x3fccad;_0x2ca6f2[_0xca9f('0xb0')]=_0x3fccad[_0xca9f('0xaa')];_0x2ca6f2['applications']=_['orderBy'](_0x3fccad[_0xca9f('0xad')],[_0xca9f('0xb1')],[_0xca9f('0xb2')]);if(_0x2ca6f2[_0xca9f('0xb3')][_0xca9f('0xad')]){delete _0x2ca6f2[_0xca9f('0xb3')][_0xca9f('0xad')];}if(_0x2ca6f2[_0xca9f('0xb3')][_0xca9f('0xaa')]&&_0x2ca6f2[_0xca9f('0xb3')]['List'][_0xca9f('0xab')][_0xca9f('0x5b')]){return _0x2ca6f2[_0xca9f('0xb3')][_0xca9f('0xaa')][_0xca9f('0xab')][0x0];}var _0x3614b4=_[_0xca9f('0xf')](_0x2c2686[_0xca9f('0x6e')],{'firstName':_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb4')],'ListId':_0x3fccad['ListId']});_0x3614b4[_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xa5')]]=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb4')];return db['CmContact'][_0xca9f('0x6d')](_0x3614b4,{'fields':_0x2771be,'raw':!![]});})[_0xca9f('0x14')](function(_0x55398d){_0x2ca6f2[_0xca9f('0xb5')]=_0x55398d;var _0x1281e8=createInteractionObject(_0x2c2686['params']['id'],_0x2c2686['body'],_0x2c2686[_0xca9f('0xb6')],_0x55398d);var _0x159000={'ChatWebsiteId':_0x2c2686['params']['id'],'closed':![]};if(_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb7')]){_0x159000[_0xca9f('0xb7')]=_0x2c2686[_0xca9f('0x6e')]['threadId'];return db[_0xca9f('0xb8')]['find']({'where':_0x159000})[_0xca9f('0x14')](function(_0x24c69f){if(_0x24c69f){_0x122302=!![];return _0x24c69f;}_0x1281e8[_0xca9f('0xb7')]=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb7')];_0x1281e8['externalUrl']=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb9')];return db[_0xca9f('0xb8')]['create'](_0x1281e8);});}_0x159000['ContactId']=_0x55398d['id'];if(_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xba')]&&_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xba')]['id']){_0x159000['id']=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xba')]['id'];return db[_0xca9f('0xb8')][_0xca9f('0x6c')]({'where':_0x159000})[_0xca9f('0x14')](function(_0x4f4dff){if(_0x4f4dff){_0x122302=!![];return _0x4f4dff;}return db[_0xca9f('0xb8')][_0xca9f('0x6d')](_0x1281e8);});}return db[_0xca9f('0xb8')][_0xca9f('0x6d')](_0x1281e8);})[_0xca9f('0x14')](function(_0x2508ab){if(!_0x122302)return _0x2508ab;var _0x4d6985={'from':(_0x2ca6f2['contact'][_0xca9f('0x45')]||'')+'\x20'+(_0x2ca6f2[_0xca9f('0xb5')][_0xca9f('0xbb')]||'')};if(_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb7')]&&_0x2c2686['body'][_0xca9f('0xbc')]&&_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb7')]!=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xbc')]){_0x4d6985['threadId']=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xbc')];}return _0x2508ab[_0xca9f('0x24')](_0x4d6985);})[_0xca9f('0x14')](function(_0x30bba9){_0x2ca6f2['interaction']=_0x30bba9[_0xca9f('0x3a')]({'plain':!![]});_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xbd')]=!_0x122302;if(_0x2ca6f2[_0xca9f('0xba')]['created']){if(_0x2ca6f2[_0xca9f('0xb3')]['autoclose']){_0x2ca6f2['applications'][_0xca9f('0xbe')]({'id':0x0,'priority':_0x2ca6f2[_0xca9f('0xbf')]['length']+0x1,'app':_0xca9f('0xc0'),'appdata':'unmanaged','interval':_0xca9f('0xc1')});}}return db[_0xca9f('0xc2')]['create']({'body':_0x2c2686[_0xca9f('0x6e')][_0xca9f('0x6e')],'ChatWebsiteId':_0x2c2686['params']['id'],'ChatInteractionId':_0x30bba9['id'],'direction':'in','ContactId':_0x2ca6f2[_0xca9f('0xb5')]['id'],'AttachmentId':_0x2c2686[_0xca9f('0x6e')]['AttachmentId']});})[_0xca9f('0x14')](function(_0x47325b){_0x2ca6f2[_0xca9f('0x1c')]=_0x47325b;if(!_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xc3')]){return;}return db[_0xca9f('0xc4')][_0xca9f('0x6c')]({'attributes':['id',_0xca9f('0x2b')],'where':{'id':_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xc3')]}});})[_0xca9f('0x14')](function(_0x40e632){if(_0x40e632){_0x2ca6f2['applications'][_0xca9f('0xc5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40e632['name']+','+(_0x2ca6f2[_0xca9f('0xb3')]['waitForTheAssignedAgent']||0xa),'interval':_0xca9f('0xc1')});_0x2ca6f2[_0xca9f('0xc6')]=!![];}if(!_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xc7')]){return;}return db[_0xca9f('0xc8')][_0xca9f('0x6c')]({'attributes':['id',_0xca9f('0x2b')],'where':{'id':_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xc7')]}});})[_0xca9f('0x14')](function(_0x59ca2f){if(_0x59ca2f){_0x2ca6f2[_0xca9f('0xbf')][_0xca9f('0xc5')]({'id':0x0,'priority':0x1,'app':_0xca9f('0xc9'),'appdata':_0x59ca2f['name']+','+(_0x2ca6f2['account'][_0xca9f('0xca')]||0x12c),'interval':_0xca9f('0xc1')});}return respondWithRpcPromise(_0xca9f('0xcb'),'startRouting',_0x2ca6f2);})[_0xca9f('0x14')](function(_0x2bf376){respondWithRpcPromise(_0xca9f('0xcc'),_0xca9f('0xcc'),{'event':_0xca9f('0x9a'),'message':_0x2bf376},client9002);return _0x2bf376;})[_0xca9f('0x14')](respondWithResult(_0x409bf0,null))['catch'](APIHandleError(_0x409bf0));};exports['offline']=function(_0x3aedda,_0x39c187){var _0x441705,_0x2c59c3,_0x335695;var _0x417c7e=[];var _0x35d6b6={};var _0x5ac80a=_0x3aedda['files']||[];var _0x3f3570=[];var _0x549fa0;return db[_0xca9f('0x9c')][_0xca9f('0x76')]()[_0xca9f('0x14')](function(_0x96099c){if(!_0x96099c){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))]('no\x20available\x20attributes');}_0x417c7e=_[_0xca9f('0x9f')](_['keys'](_0x96099c),['createdAt',_0xca9f('0xcd'),'CompanyId',_0xca9f('0xa1')]);if(_0x3aedda[_0xca9f('0x6e')]['id']){delete _0x3aedda[_0xca9f('0x6e')]['id'];}if(_[_0xca9f('0x92')](_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xb4')])){throw _0x39c187[_0xca9f('0x1e')](0x1f4)[_0xca9f('0x2c')](new db['Sequelize'][(_0xca9f('0x9d'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x3aedda[_0xca9f('0x6e')][_0xca9f('0x6e')])||_0x3aedda[_0xca9f('0x6e')]['body']===''){throw _0x39c187[_0xca9f('0x1e')](0x1f4)['send'](new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa4')));}if(_[_0xca9f('0x92')](_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xce')])){throw _0x39c187[_0xca9f('0x1e')](0x1f4)[_0xca9f('0x2c')](new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xcf')+_0x417c7e));}if(!_[_0xca9f('0xa7')](_0x417c7e,_0x3aedda['body'][_0xca9f('0xce')])){throw _0x39c187[_0xca9f('0x1e')](0x1f4)[_0xca9f('0x2c')](new db[(_0xca9f('0xa2'))]['ValidationError'](_0xca9f('0xd0')+_0x417c7e));}_0x35d6b6[_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xce')]]=_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xb4')];})[_0xca9f('0x14')](function(){return db['ChatWebsite'][_0xca9f('0x6c')]({'where':{'id':_0x3aedda[_0xca9f('0x69')]['id']},'include':[{'model':db['CmList'],'as':_0xca9f('0xaa')},{'model':db[_0xca9f('0xd1')],'as':_0xca9f('0xd1')}]});})[_0xca9f('0x14')](handleEntityNotFound(_0x39c187,null))[_0xca9f('0x14')](function(_0x4465cf){if(_0x4465cf&&_0x4465cf[_0xca9f('0xaa')]){_0x2c59c3=_0x4465cf;var _0x41d485=_['defaults'](_0x3aedda[_0xca9f('0x6e')],{'firstName':_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xb4')],'phone':_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xb4')],'ListId':_0x4465cf['ListId']});_0x41d485[_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xce')]]=_0x3aedda['body'][_0xca9f('0xb4')];return db[_0xca9f('0x9c')][_0xca9f('0xd2')]({'where':_0x35d6b6,'defaults':_0x41d485});}})[_0xca9f('0xaf')](function(_0x32cae8){if(_0x32cae8){_0x335695=_0x32cae8;var _0x1a88c5=fs[_0xca9f('0xd3')](path[_0xca9f('0x8c')](config['root'],_0xca9f('0xd4')),'utf8');var _0x5c4e5c=ejs['render'](_0x1a88c5,{'body':_[_0xca9f('0xd5')](_0x3aedda[_0xca9f('0x6e')][_0xca9f('0x6e')]),'bodyTitle':_0x2c59c3[_0xca9f('0xd6')]});return db[_0xca9f('0xd7')]['create']({'body':_0x5c4e5c,'plainBody':htmlToText[_0xca9f('0xd8')](_0x5c4e5c),'ContactId':_0x32cae8['id'],'ChatWebsiteId':_0x2c59c3['id']});}})[_0xca9f('0x14')](function(_0xe923a4){_0x549fa0=_0xe923a4;if(_0x5ac80a['length']){var _0x29b84b=_0x5ac80a[_0xca9f('0x37')](function(_0x314bdf){return{'name':_0x314bdf[_0xca9f('0xd9')],'basename':_0x314bdf['filename'],'type':_0x314bdf['mimetype'],'ChatOfflineMessageId':_0xe923a4['id']};});_0x3f3570=_0x29b84b[_0xca9f('0x37')](_0x4497a4=>{var _0x362568={'filename':_0x4497a4[_0xca9f('0x2b')],'path':path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0xda'),_0xca9f('0xdb'),_0xca9f('0xdc'),_0xca9f('0xdd'),_0x4497a4[_0xca9f('0xde')])};return _0x362568;});if(!_0x2c59c3[_0xca9f('0xdf')]){return db[_0xca9f('0xe0')][_0xca9f('0xe1')](function(_0x258d77){return db[_0xca9f('0xe2')][_0xca9f('0xe3')](_0x29b84b,{'transaction':_0x258d77});});}}})[_0xca9f('0x14')](function(){if(_0x549fa0){_0x441705=_0x549fa0;return db[_0xca9f('0xd1')][_0xca9f('0x82')]({'where':{'service':!![]},'include':[{'model':db[_0xca9f('0xe4')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xca9f('0xe5'),'raw':!![]}]}]});}})[_0xca9f('0x14')](function(_0x1b5ddd){if(_0x1b5ddd&&_0x1b5ddd[_0xca9f('0xe6')]&&_0x2c59c3[_0xca9f('0xe7')]&&_0x2c59c3[_0xca9f('0xe8')]){var _0x5d22e5=_0x1b5ddd['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xca9f('0xe9'),{'account':_0x5d22e5,'message':{'from':util[_0xca9f('0x2f')](_0xca9f('0xea'),_0x1b5ddd[_0xca9f('0x2b')],_0x1b5ddd['email']||_0x1b5ddd[_0xca9f('0xe6')][_0xca9f('0x70')]),'to':_0x2c59c3['forwardOfflineAddress'],'subject':_0x2c59c3['offlineMessageSubject'],'html':_0x441705[_0xca9f('0x6e')],'attachments':_0x3f3570}},client9003)[_0xca9f('0x14')](function(){return _0x441705;})[_0xca9f('0x67')](function(_0x1e5d1c){logger['error'](_0x1e5d1c);});}})[_0xca9f('0x14')](function(){if(_0x2c59c3&&_0x2c59c3['openNewInteraction']&&_0x2c59c3[_0xca9f('0xeb')]){var _0x328974=[];if(_0x5ac80a[_0xca9f('0x5b')]){_0x328974=_0x5ac80a['map'](function(_0x223d1a){return{'name':_0x223d1a[_0xca9f('0xd9')],'basename':_0x223d1a[_0xca9f('0x86')],'type':_0x223d1a['mimetype'],'ChatOfflineMessageId':_0x549fa0['id']};});}var _0x2d6d3f;if(!_['isNil'](_0x2c59c3[_0xca9f('0xec')])){var _0x2cd013=_[_0xca9f('0x37')](_0x3aedda['body'],function(_0x365ab3){return _0x365ab3;});var _0x1704c3=_[_0xca9f('0xed')](_0x2cd013)[0x0];var _0x10a35a=_[_0xca9f('0xee')](_0x1704c3,function(_0x2364ce){return _0x2364ce;});_0x2d6d3f=_0x10a35a[0x1][_0x2c59c3[_0xca9f('0xec')]];}var _0x484c24={'from':_0x335695[_0xca9f('0xef')],'firstName':_0x335695[_0xca9f('0x45')],'lastName':_0x335695[_0xca9f('0xbb')],'mapKey':'email','message':{'from':_0x335695[_0xca9f('0xef')],'to':_0x2c59c3[_0xca9f('0xd1')][_0xca9f('0xef')],'cc':'','subject':_['isNil'](_0x2d6d3f)?_0x2c59c3[_0xca9f('0xf0')]:_0x2d6d3f,'messageId':'','sentAt':new Date(),'attach':_0x328974[_0xca9f('0x5b')],'attachments':_0x328974,'originChannel':_0xca9f('0xf1'),'ChatWebsiteId':_0x2c59c3['id'],'ChatOfflineMessageId':_0x441705['id'],'originTo':_0x2c59c3[_0xca9f('0xd1')][_0xca9f('0xef')]},'body':_0x441705[_0xca9f('0x6e')]};var _0xc503d7={'account':{'id':_0x2c59c3[_0xca9f('0xeb')]},'body':_0x484c24,'log':_0xca9f('0xf2')};return respondWithRpcPromise(_0xca9f('0xf2'),_0xca9f('0xf3'),_0xc503d7,client9001)[_0xca9f('0x14')](function(){return _0x441705;})[_0xca9f('0x67')](function(_0xf69cb){logger[_0xca9f('0x1b')](_0xf69cb);});}return;})[_0xca9f('0x14')](function(){if(_0x441705){return _0x441705;}})['then'](respondWithResult(_0x39c187,null))['catch'](function(){for(var _0x4c30d9 of _0x5ac80a){var _0x4f9f2f=path['join'](config[_0xca9f('0x8d')],'server',_0xca9f('0xdb'),_0xca9f('0xdc'),_0xca9f('0xdd'),_0x4c30d9[_0xca9f('0x86')]);fs_extra[_0xca9f('0xf4')](_0x4f9f2f)[_0xca9f('0x67')](function(_0x51cb72){logger[_0xca9f('0x1b')](_0xca9f('0xf5'),_0x4f9f2f,_0x51cb72);});}});};exports[_0xca9f('0xf6')]=function(_0xb3ba93,_0xfe02eb){return db[_0xca9f('0xb8')][_0xca9f('0x6c')]({'where':{'id':_0xb3ba93[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0xfe02eb,null))['then'](function(_0x18c699){if(_0x18c699){return _0x18c699[_0xca9f('0xf6')](_0xb3ba93[_0xca9f('0x6e')]['ids'],_['omit'](_0xb3ba93[_0xca9f('0x6e')],['ids','id'])||{});}})[_0xca9f('0x14')](respondWithResult(_0xfe02eb,null))['catch'](handleError(_0xfe02eb,null));};exports['getInteractions']=function(_0x240547,_0x20d914){var _0x44734d={'raw':![],'where':{}};var _0x5708b2={};var _0x38d93d={'count':0x0,'rows':[]};return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0x240547[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x20d914,null))[_0xca9f('0x14')](function(_0x182397){if(_0x182397){_0x5708b2['model']=_[_0xca9f('0x56')](db[_0xca9f('0xb8')]['rawAttributes']);_0x5708b2[_0xca9f('0x55')]=_[_0xca9f('0x56')](_0x240547[_0xca9f('0x55')]);_0x5708b2[_0xca9f('0x57')]=_['intersection'](_0x5708b2['model'],_0x5708b2[_0xca9f('0x55')]);_0x44734d[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x5708b2[_0xca9f('0x4d')],qs[_0xca9f('0x5a')](_0x240547['query'][_0xca9f('0x5a')]));_0x44734d['attributes']=_0x44734d[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x44734d[_0xca9f('0x59')]:_0x5708b2[_0xca9f('0x4d')];if(!_0x240547[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x44734d[_0xca9f('0x21')]=qs['limit'](_0x240547[_0xca9f('0x55')]['limit']);_0x44734d[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x240547[_0xca9f('0x55')]['offset']);}_0x44734d[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x240547['query'][_0xca9f('0x5f')]);_0x44734d['where']=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0x240547['query'],_0x5708b2[_0xca9f('0x57')]));_0x44734d[_0xca9f('0x60')][_0xca9f('0x7a')]=_0x182397['id'];if(_0x240547['query'][_0xca9f('0x62')]){_0x44734d[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0x44734d[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0x44734d[_0xca9f('0x59')],function(_0x3eefbc){var _0x51723d={};_0x51723d[_0x3eefbc]={'$like':'%'+_0x240547[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x51723d;})});}_0x44734d=_[_0xca9f('0x64')]({},_0x44734d,_0x240547['options']);return db[_0xca9f('0xb8')][_0xca9f('0x22')]({'where':_0x44734d[_0xca9f('0x60')]})[_0xca9f('0x14')](function(_0x403185){_0x38d93d['count']=_0x403185;if(_0x240547['query']['includeAll']){_0x44734d[_0xca9f('0x7b')]=[{'model':db[_0xca9f('0x9c')],'as':_0xca9f('0xf7'),'required':![]},{'model':db[_0xca9f('0xc4')],'as':_0xca9f('0xf8'),'attributes':[_0xca9f('0x2b'),'fullname',_0xca9f('0xf9')],'required':![]},{'model':db[_0xca9f('0xfa')],'as':_0xca9f('0xfb'),'attributes':['id',_0xca9f('0x2b'),'color'],'where':_0x240547[_0xca9f('0x55')][_0xca9f('0xfc')]?{'id':_0x240547['query'][_0xca9f('0xfc')]}:undefined,'required':_0x240547[_0xca9f('0x55')][_0xca9f('0xfc')]?!![]:![]}];}return db[_0xca9f('0xb8')][_0xca9f('0x7c')](_0x44734d);})[_0xca9f('0x14')](function(_0x17833c){_0x38d93d[_0xca9f('0x66')]=_0x17833c;return _0x38d93d;});}})[_0xca9f('0x14')](respondWithFilteredResult(_0x20d914,_0x44734d))[_0xca9f('0x67')](handleError(_0x20d914,null));};exports[_0xca9f('0x2d')]=function(_0x25ec4c,_0x29e558){var _0x392438=0x0;var _0x2af499=0x0;var _0x110e57=![];var _0x5ca130;var _0x3d79db;return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x25ec4c['params']['id']},'include':[{'model':db['Interval'],'as':_0xca9f('0x38'),'include':[{'model':db[_0xca9f('0x38')],'as':_0xca9f('0x39'),'attributes':['id',_0xca9f('0x31')]}]}]})[_0xca9f('0x14')](handleEntityNotFound(_0x29e558,null))[_0xca9f('0x14')](function(_0x1df8d5){if(_0x1df8d5){_0x5ca130=_0x1df8d5;return _0x1df8d5[_0xca9f('0xfd')]({'raw':!![]});}})['then'](function(_0x12364e){if(_0x5ca130){if(_0x12364e){_0x3d79db=_0x12364e;}}return require(_0xca9f('0x8f'))[_0xca9f('0x90')]();})['then'](function(_0x5a6b3e){if(_0x5a6b3e){_0x2af499=_0x5a6b3e[_0xca9f('0xfe')];_0x110e57=_0x5a6b3e['custom'];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xca9f('0x14')](function(_0x146b17){_0x392438=_0x146b17;if(_0x2af499&&_0x146b17>_0x2af499){return db[_0xca9f('0xff')][_0xca9f('0x82')]({'where':{'id':0x1}})[_0xca9f('0x14')](function(_0xdf0d8e){if(_0xdf0d8e){_0xdf0d8e[_0xca9f('0x100')]('chatLicenseExceeded');}});}})['then'](function(){if(!_0x5ca130[_0xca9f('0x38')]||!_0x5ca130[_0xca9f('0x38')][_0xca9f('0x39')])return!![];return checkWebsiteIntervals(_0x5ca130);})[_0xca9f('0x14')](function(_0x3584c3){var _0x236cf2=fs[_0xca9f('0xd3')](path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],'server/files/chat/iframe.ejs'),_0xca9f('0x101'));var _0x2b24fd=new url['URL'](_0x5ca130['address'])[_0xca9f('0x102')];var _0x2014d3=_0xca9f('0x103');var _0x28f85a=![];var _0x26da36={'chatVersion':_0x2014d3,'chatWebsiteAddressOrigin':_0x2b24fd,'remote':_0x5ca130[_0xca9f('0x104')],'query':querystring[_0xca9f('0x19')](_[_0xca9f('0x64')](_0x5ca130[_0xca9f('0x3a')]({'plain':!![]}),{'customerIp':_0x25ec4c[_0xca9f('0xb6')][_0xca9f('0x42')]||_0x25ec4c[_0xca9f('0xb6')]['x-real-ip']||_0x25ec4c[_0xca9f('0x105')]['remoteAddress']||_0x25ec4c['ip'],'referer':_0x25ec4c[_0xca9f('0xb6')][_0xca9f('0x47')],'openedInteractions':_0x392438,'maxInteractions':_0x2af499,'virtual':_0x110e57[_0xca9f('0xfe')],'online':_0x3584c3,'custom':_0x110e57}))['replace'](/'/g,'\x5c\x27')};_0x29e558[_0xca9f('0x2c')](ejs[_0xca9f('0x106')](Mustache[_0xca9f('0x106')](_0x236cf2,_0x26da36),{'proactiveActions':_0x3d79db,'alignment':_0x5ca130[_0xca9f('0x107')],'verticalAlignment':_0x5ca130[_0xca9f('0x108')],'div_color':_0x5ca130['color'],'labelText':_0x5ca130[_0xca9f('0x109')],'text_color':_0x5ca130[_0xca9f('0x10a')],'text_button_color':_0x5ca130['textButtonColor'],'button_color':_0x5ca130[_0xca9f('0x10b')],'background_color':_0x5ca130[_0xca9f('0x10c')],'hideWhenOffline':_0x5ca130[_0xca9f('0x10d')],'intervalId':_0x5ca130[_0xca9f('0x10e')],'isDevelopment':_0x28f85a,'chatVersion':_0x2014d3}));})['catch'](handleError(_0x29e558,null));};exports['addApplications']=function(_0x1bbd50,_0x31b68e){var _0x171be2=_0x1bbd50[_0xca9f('0x69')]['id'];var _0x8a6f66=_0x1bbd50[_0xca9f('0x6e')];var _0x45735e=0xc8;var _0x4287ad=null;return db[_0xca9f('0xe0')][_0xca9f('0xe1')]({'isolationLevel':db[_0xca9f('0xe0')]['Transaction']['ISOLATION_LEVELS'][_0xca9f('0x10f')]},function(_0x223002){return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0x171be2},'transaction':_0x223002})[_0xca9f('0x14')](function(_0xc90557){if(_0xc90557){return db[_0xca9f('0x110')]['destroy']({'where':{'ChatWebsiteId':_0x171be2},'transaction':_0x223002})[_0xca9f('0x14')](function(){var _0xac3dd0=_[_0xca9f('0x37')](_0x8a6f66,function(_0x1d4991){_0x1d4991['ChatWebsiteId']=_0x171be2;return _0x1d4991;});return db[_0xca9f('0x110')][_0xca9f('0xe3')](_0xac3dd0,{'transaction':_0x223002});});}else{_0x45735e=0x194;_0x4287ad=[];}});})[_0xca9f('0x14')](function(){if(_0x45735e!==0x194){return db[_0xca9f('0x110')][_0xca9f('0x111')]({'where':{'ChatWebsiteId':_0x171be2},'order':_0xca9f('0xb1')})[_0xca9f('0x14')](function(_0x3752c8){_0x4287ad=_0x3752c8;});}})[_0xca9f('0x67')](function(_0x650705){_0x45735e=0x1f4;logger[_0xca9f('0x1b')](_0x650705[_0xca9f('0x2a')]);if(_0x650705[_0xca9f('0x2b')]){delete _0x650705[_0xca9f('0x2b')];}_0x4287ad=_0x650705;})['finally'](function(){if(_0x4287ad===null){_0x31b68e[_0xca9f('0x29')](_0x45735e);}else{if(_0x45735e===0x1f4){_0x31b68e['status'](_0x45735e)[_0xca9f('0x2c')](_0x4287ad);}else{_0x31b68e['status'](_0x45735e)['json'](_0x4287ad);}}});};exports['getApplications']=function(_0x1f0323,_0x672a97){var _0x2be16e={};var _0x1dcb76={};var _0x2e96cb;var _0x2f55a4;return db[_0xca9f('0x51')]['findOne']({'where':{'id':_0x1f0323['params']['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x672a97,null))[_0xca9f('0x14')](function(_0x739f79){if(_0x739f79){_0x2e96cb=_0x739f79;_0x1dcb76[_0xca9f('0x4d')]=_[_0xca9f('0x56')](db[_0xca9f('0x110')][_0xca9f('0x52')]);_0x1dcb76['query']=_[_0xca9f('0x56')](_0x1f0323['query']);_0x1dcb76['filters']=_[_0xca9f('0x58')](_0x1dcb76['model'],_0x1dcb76[_0xca9f('0x55')]);_0x2be16e[_0xca9f('0x59')]=_['intersection'](_0x1dcb76['model'],qs[_0xca9f('0x5a')](_0x1f0323[_0xca9f('0x55')][_0xca9f('0x5a')]));_0x2be16e[_0xca9f('0x59')]=_0x2be16e[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x2be16e[_0xca9f('0x59')]:_0x1dcb76['model'];_0x2be16e[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x1f0323[_0xca9f('0x55')][_0xca9f('0x5f')]);_0x2be16e['where']=qs[_0xca9f('0x57')](_['pick'](_0x1f0323[_0xca9f('0x55')],_0x1dcb76[_0xca9f('0x57')]));if(_0x1f0323[_0xca9f('0x55')]['filter']){_0x2be16e['where']=_[_0xca9f('0x64')](_0x2be16e[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0x2be16e[_0xca9f('0x59')],function(_0x5eedc6){var _0x134eb3={};_0x134eb3[_0x5eedc6]={'$like':'%'+_0x1f0323['query'][_0xca9f('0x62')]+'%'};return _0x134eb3;})});}_0x2be16e=_[_0xca9f('0x64')]({},_0x2be16e,_0x1f0323['options']);return _0x2e96cb[_0xca9f('0x112')](_0x2be16e);}})['then'](function(_0x15574f){if(_0x15574f){_0x2f55a4=_0x15574f[_0xca9f('0x5b')];if(!_0x1f0323[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x2be16e[_0xca9f('0x21')]=qs['limit'](_0x1f0323['query'][_0xca9f('0x21')]);_0x2be16e['offset']=qs['offset'](_0x1f0323[_0xca9f('0x55')]['offset']);}return _0x2e96cb[_0xca9f('0x112')](_0x2be16e);}})[_0xca9f('0x14')](function(_0xa24131){if(_0xa24131){return _0xa24131?{'count':_0x2f55a4,'rows':_0xa24131}:null;}})['then'](respondWithResult(_0x672a97,null))[_0xca9f('0x67')](handleError(_0x672a97,null));};exports[_0xca9f('0x113')]=function(_0xaec7e9,_0x975f42){return db['chatProactiveAction'][_0xca9f('0x6c')]({'where':{'id':_0xaec7e9[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x975f42,null))[_0xca9f('0x14')](function(_0x5c97cf){if(_0x5c97cf){return _0x5c97cf['addProactiveActions'](_0xaec7e9[_0xca9f('0x6e')][_0xca9f('0x7e')],_[_0xca9f('0x114')](_0xaec7e9[_0xca9f('0x6e')],[_0xca9f('0x7e'),'id'])||{});}})[_0xca9f('0x14')](respondWithResult(_0x975f42,null))['catch'](handleError(_0x975f42,null));};exports['getProactiveActions']=function(_0x57a9d8,_0x1f93b7){var _0x3d1f13={};var _0x22a425={};var _0x2196d5;var _0x42b873;return db['ChatWebsite'][_0xca9f('0x82')]({'where':{'id':_0x57a9d8[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x1f93b7,null))[_0xca9f('0x14')](function(_0xe6d5ef){if(_0xe6d5ef){_0x2196d5=_0xe6d5ef;_0x22a425['model']=_['keys'](db['ChatProactiveAction'][_0xca9f('0x52')]);_0x22a425[_0xca9f('0x55')]=_['keys'](_0x57a9d8['query']);_0x22a425['filters']=_[_0xca9f('0x58')](_0x22a425[_0xca9f('0x4d')],_0x22a425[_0xca9f('0x55')]);_0x3d1f13[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x22a425[_0xca9f('0x4d')],qs['fields'](_0x57a9d8[_0xca9f('0x55')]['fields']));_0x3d1f13['attributes']=_0x3d1f13[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x3d1f13['attributes']:_0x22a425[_0xca9f('0x4d')];_0x3d1f13[_0xca9f('0x5e')]=qs['sort'](_0x57a9d8['query'][_0xca9f('0x5f')]);_0x3d1f13[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_['pick'](_0x57a9d8[_0xca9f('0x55')],_0x22a425['filters']));if(_0x57a9d8[_0xca9f('0x55')][_0xca9f('0x62')]){_0x3d1f13[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0x3d1f13[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0x3d1f13[_0xca9f('0x59')],function(_0x173ab0){var _0x5974d2={};_0x5974d2[_0x173ab0]={'$like':'%'+_0x57a9d8['query'][_0xca9f('0x62')]+'%'};return _0x5974d2;})});}_0x3d1f13=_['merge']({},_0x3d1f13,_0x57a9d8[_0xca9f('0x65')]);return _0x2196d5[_0xca9f('0xfd')](_0x3d1f13);}})[_0xca9f('0x14')](function(_0x54c2d1){if(_0x54c2d1){_0x42b873=_0x54c2d1[_0xca9f('0x5b')];if(!_0x57a9d8[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x3d1f13[_0xca9f('0x21')]=qs['limit'](_0x57a9d8['query'][_0xca9f('0x21')]);_0x3d1f13[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x57a9d8[_0xca9f('0x55')][_0xca9f('0x23')]);}return _0x2196d5['getProactiveActions'](_0x3d1f13);}})['then'](function(_0x20e55b){if(_0x20e55b){return _0x20e55b?{'count':_0x42b873,'rows':_0x20e55b}:null;}})[_0xca9f('0x14')](respondWithResult(_0x1f93b7,null))[_0xca9f('0x67')](handleError(_0x1f93b7,null));};exports[_0xca9f('0x115')]=function(_0x3ccc81,_0x2b8637){var _0xd040f7=_0x3ccc81[_0xca9f('0x55')]['online']==='false'?_0xca9f('0x116'):_0xca9f('0x117');return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'attributes':['id',_0xd040f7],'where':{'id':_0x3ccc81[_0xca9f('0x69')]['id']}})['then'](handleEntityNotFound(_0x2b8637,null))[_0xca9f('0x14')](function(_0x1e2d30){if(_0x1e2d30){var _0x2d1860=_0x1e2d30[_0xd040f7];var _0x179bc5=_0x2d1860&&_0x2d1860[_0xca9f('0x118')]?_0x2d1860[_0xca9f('0x118')]:[];_0x2b8637['send']({'fromKey':_['isNil'](_0x2d1860[_0xca9f('0x119')])?undefined:_0x2d1860[_0xca9f('0x119')],'count':_0x179bc5[_0xca9f('0x5b')],'rows':_0x179bc5});}})[_0xca9f('0x67')](handleError(_0x2b8637,null));};exports[_0xca9f('0x11a')]=function(_0x512bfe,_0x3d0759){var _0xb48531={'raw':![],'where':{}};var _0x5fa57a={};var _0x4845ae={'count':0x0,'rows':[]};return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0x512bfe[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x3d0759,null))[_0xca9f('0x14')](function(_0x9fb9e2){if(_0x9fb9e2){_0x5fa57a[_0xca9f('0x4d')]=_[_0xca9f('0x56')](db[_0xca9f('0xd7')]['rawAttributes']);_0x5fa57a['query']=_[_0xca9f('0x56')](_0x512bfe['query']);_0x5fa57a['filters']=_[_0xca9f('0x58')](_0x5fa57a[_0xca9f('0x4d')],_0x5fa57a['query']);_0xb48531[_0xca9f('0x59')]=_['intersection'](_0x5fa57a[_0xca9f('0x4d')],qs[_0xca9f('0x5a')](_0x512bfe['query'][_0xca9f('0x5a')]));_0xb48531[_0xca9f('0x59')]=_0xb48531[_0xca9f('0x59')][_0xca9f('0x5b')]?_0xb48531[_0xca9f('0x59')]:_0x5fa57a[_0xca9f('0x4d')];if(!_0x512bfe['query']['hasOwnProperty']('nolimit')){_0xb48531[_0xca9f('0x21')]=qs['limit'](_0x512bfe[_0xca9f('0x55')][_0xca9f('0x21')]);_0xb48531[_0xca9f('0x23')]=qs['offset'](_0x512bfe[_0xca9f('0x55')]['offset']);}_0xb48531[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x512bfe[_0xca9f('0x55')][_0xca9f('0x5f')]);_0xb48531['where']=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0x512bfe[_0xca9f('0x55')],_0x5fa57a['filters']));_0xb48531[_0xca9f('0x60')][_0xca9f('0x7a')]=_0x9fb9e2['id'];if(_0x512bfe[_0xca9f('0x55')]['filter']){_0xb48531[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0xb48531[_0xca9f('0x60')],{'$or':_['map'](_0xb48531[_0xca9f('0x59')],function(_0x33472e){var _0x25cbaf={};_0x25cbaf[_0x33472e]={'$like':'%'+_0x512bfe[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x25cbaf;})});}_0xb48531=_[_0xca9f('0x64')]({},_0xb48531,_0x512bfe['options']);return db[_0xca9f('0xd7')]['count']({'where':_0xb48531[_0xca9f('0x60')]})['then'](function(_0x55b609){_0x4845ae[_0xca9f('0x22')]=_0x55b609;if(_0x512bfe[_0xca9f('0x55')][_0xca9f('0x6b')]){_0xb48531[_0xca9f('0x7b')]=[{'all':!![]}];}else{_0xb48531[_0xca9f('0x7b')]=[{'model':db[_0xca9f('0x9c')],'as':_0xca9f('0xf7'),'required':![]},{'model':db['Attachment'],'as':_0xca9f('0x11b'),'required':![]}];}return db[_0xca9f('0xd7')][_0xca9f('0x7c')](_0xb48531);})['then'](function(_0x53e174){_0x4845ae[_0xca9f('0x66')]=_0x53e174;return _0x4845ae;});}})[_0xca9f('0x14')](respondWithFilteredResult(_0x3d0759,_0xb48531))[_0xca9f('0x67')](handleError(_0x3d0759,null));};exports[_0xca9f('0x11c')]=function(_0x4ccab2,_0x37245b){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x4ccab2[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x37245b,null))[_0xca9f('0x14')](function(_0x38b006){if(_0x38b006){return _0x38b006[_0xca9f('0x11c')](_0x4ccab2[_0xca9f('0x6e')][_0xca9f('0x7e')],_[_0xca9f('0x114')](_0x4ccab2[_0xca9f('0x6e')],['ids','id'])||{})[_0xca9f('0xaf')](function(_0x461688){for(var _0x13319a=0x0;_0x13319a<_0x4ccab2[_0xca9f('0x6e')][_0xca9f('0x7e')][_0xca9f('0x5b')];_0x13319a+=0x1){socket[_0xca9f('0x11d')](_0xca9f('0x11e'),{'UserId':Number(_0x4ccab2['body'][_0xca9f('0x7e')][_0x13319a]),'ChatWebsiteId':Number(_0x4ccab2[_0xca9f('0x69')]['id'])});}return _0x461688;});}})['then'](respondWithResult(_0x37245b,null))['catch'](handleError(_0x37245b,null));};exports[_0xca9f('0x11f')]=function(_0x1ed2fe,_0x5e1a1d){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x1ed2fe[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x5e1a1d,null))[_0xca9f('0x14')](function(_0x15b7c6){if(_0x15b7c6){return _0x15b7c6[_0xca9f('0x11f')](_0x1ed2fe['query'][_0xca9f('0x7e')])[_0xca9f('0x14')](function(){if(_['isArray'](_0x1ed2fe[_0xca9f('0x55')][_0xca9f('0x7e')])){for(var _0xd7ead=0x0;_0xd7ead<_0x1ed2fe[_0xca9f('0x55')]['ids'][_0xca9f('0x5b')];_0xd7ead+=0x1){socket[_0xca9f('0x11d')](_0xca9f('0x120'),{'UserId':Number(_0x1ed2fe[_0xca9f('0x55')]['ids'][_0xd7ead]),'ChatWebsiteId':Number(_0x1ed2fe['params']['id'])});}}else{socket['emit'](_0xca9f('0x120'),{'UserId':Number(_0x1ed2fe[_0xca9f('0x55')]['ids']),'ChatWebsiteId':Number(_0x1ed2fe[_0xca9f('0x69')]['id'])});}});}})[_0xca9f('0x14')](respondWithStatusCode(_0x5e1a1d,null))[_0xca9f('0x67')](handleError(_0x5e1a1d,null));};exports[_0xca9f('0x121')]=function(_0x2492a0,_0x4283c3){var _0x1466e0={};var _0x2cf498={};var _0x3f4a3a;var _0xd5c09e;return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0x2492a0[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x4283c3,null))[_0xca9f('0x14')](function(_0x2cc3e8){if(_0x2cc3e8){_0x3f4a3a=_0x2cc3e8;_0x2cf498['model']=_[_0xca9f('0x56')](db['User'][_0xca9f('0x52')]);_0x2cf498[_0xca9f('0x55')]=_[_0xca9f('0x56')](_0x2492a0[_0xca9f('0x55')]);_0x2cf498[_0xca9f('0x57')]=_['intersection'](_0x2cf498[_0xca9f('0x4d')],_0x2cf498[_0xca9f('0x55')]);_0x1466e0[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x2cf498[_0xca9f('0x4d')],qs['fields'](_0x2492a0[_0xca9f('0x55')]['fields']));_0x1466e0[_0xca9f('0x59')]=_0x1466e0['attributes'][_0xca9f('0x5b')]?_0x1466e0['attributes']:_0x2cf498[_0xca9f('0x4d')];_0x1466e0['order']=qs[_0xca9f('0x5f')](_0x2492a0[_0xca9f('0x55')]['sort']);_0x1466e0[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0x2492a0['query'],_0x2cf498[_0xca9f('0x57')]));if(_0x2492a0['query'][_0xca9f('0x62')]){_0x1466e0['where']=_[_0xca9f('0x64')](_0x1466e0[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0x1466e0['attributes'],function(_0x5f1b4d){var _0x534066={};_0x534066[_0x5f1b4d]={'$like':'%'+_0x2492a0[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x534066;})});}_0x1466e0=_[_0xca9f('0x64')]({},_0x1466e0,_0x2492a0[_0xca9f('0x65')]);return _0x3f4a3a[_0xca9f('0x121')](_0x1466e0);}})[_0xca9f('0x14')](function(_0x5d329a){if(_0x5d329a){_0xd5c09e=_0x5d329a[_0xca9f('0x5b')];if(!_0x2492a0[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x1466e0['limit']=qs[_0xca9f('0x21')](_0x2492a0['query'][_0xca9f('0x21')]);_0x1466e0[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x2492a0[_0xca9f('0x55')][_0xca9f('0x23')]);}return _0x3f4a3a[_0xca9f('0x121')](_0x1466e0);}})[_0xca9f('0x14')](function(_0x29d97d){if(_0x29d97d){return _0x29d97d?{'count':_0xd5c09e,'rows':_0x29d97d}:null;}})['then'](respondWithResult(_0x4283c3,null))['catch'](handleError(_0x4283c3,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3dbe38f..a3a0fbe 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 _0x9ade=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9ade,0x107));var _0xe9ad=function(_0xc6b2ff,_0x1558d7){_0xc6b2ff=_0xc6b2ff-0x0;var _0x47f7a4=_0x9ade[_0xc6b2ff];return _0x47f7a4;};'use strict';var EventEmitter=require(_0xe9ad('0x0'));var ChatWebsite=require(_0xe9ad('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe9ad('0x2'),'afterUpdate':'update','afterDestroy':_0xe9ad('0x3')};function emitEvent(_0x38d722){return function(_0x4d4ee0,_0x52984f,_0x36e151){ChatWebsiteEvents[_0xe9ad('0x4')](_0x38d722+':'+_0x4d4ee0['id'],_0x4d4ee0);ChatWebsiteEvents[_0xe9ad('0x4')](_0x38d722,_0x4d4ee0);_0x36e151(null);};}for(var e in events){if(events[_0xe9ad('0x5')](e)){var event=events[e];ChatWebsite[_0xe9ad('0x6')](e,emitEvent(event));}}module[_0xe9ad('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc090=['update','remove','emit','hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x2f20e1,_0x9b9fad){var _0xc2a856=function(_0x1307a5){while(--_0x1307a5){_0x2f20e1['push'](_0x2f20e1['shift']());}};_0xc2a856(++_0x9b9fad);}(_0xc090,0x112));var _0x0c09=function(_0xa7597,_0x8edd65){_0xa7597=_0xa7597-0x0;var _0x25d273=_0xc090[_0xa7597];return _0x25d273;};'use strict';var EventEmitter=require(_0x0c09('0x0'));var ChatWebsite=require(_0x0c09('0x1'))['db'][_0x0c09('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0c09('0x3')](0x0);var events={'afterCreate':_0x0c09('0x4'),'afterUpdate':_0x0c09('0x5'),'afterDestroy':_0x0c09('0x6')};function emitEvent(_0x260c36){return function(_0x11984f,_0x487f03,_0x2e968b){ChatWebsiteEvents[_0x0c09('0x7')](_0x260c36+':'+_0x11984f['id'],_0x11984f);ChatWebsiteEvents['emit'](_0x260c36,_0x11984f);_0x2e968b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x0c09('0x8')](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 a5e4323..2a41408 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 _0x84dd=['../../config/environment','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x3fa813,_0x295ac7){var _0x3cbab1=function(_0x5b2451){while(--_0x5b2451){_0x3fa813['push'](_0x3fa813['shift']());}};_0x3cbab1(++_0x295ac7);}(_0x84dd,0xa2));var _0xd84d=function(_0x33de9c,_0x30aed9){_0x33de9c=_0x33de9c-0x0;var _0x189342=_0x84dd[_0x33de9c];return _0x189342;};'use strict';var _=require(_0xd84d('0x0'));var util=require(_0xd84d('0x1'));var logger=require(_0xd84d('0x2'))(_0xd84d('0x3'));var moment=require(_0xd84d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd84d('0x5'));var config=require(_0xd84d('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x11999a,_0x570213){return _0x11999a['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f68=['chat_websites','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define'];(function(_0x223d84,_0x1db87b){var _0x3ae043=function(_0x3a78b7){while(--_0x3a78b7){_0x223d84['push'](_0x223d84['shift']());}};_0x3ae043(++_0x1db87b);}(_0x3f68,0x1d5));var _0x83f6=function(_0x4785fc,_0x216a89){_0x4785fc=_0x4785fc-0x0;var _0x363332=_0x3f68[_0x4785fc];return _0x363332;};'use strict';var _=require(_0x83f6('0x0'));var util=require(_0x83f6('0x1'));var logger=require('../../config/logger')(_0x83f6('0x2'));var moment=require(_0x83f6('0x3'));var BPromise=require(_0x83f6('0x4'));var rp=require(_0x83f6('0x5'));var fs=require('fs');var path=require(_0x83f6('0x6'));var rimraf=require(_0x83f6('0x7'));var config=require('../../config/environment');var attributes=require(_0x83f6('0x8'));module[_0x83f6('0x9')]=function(_0x5af2b1,_0xdaf088){return _0x5af2b1[_0x83f6('0xa')]('ChatWebsite',attributes,{'tableName':_0x83f6('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 f9191e5..9c0c77c 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 _0x44b3=['client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x434a7a,_0xd166b){var _0x49addb=function(_0x39d79d){while(--_0x39d79d){_0x434a7a['push'](_0x434a7a['shift']());}};_0x49addb(++_0xd166b);}(_0x44b3,0xc1));var _0x344b=function(_0x214855,_0x114ac2){_0x214855=_0x214855-0x0;var _0xfbb29=_0x44b3[_0x214855];return _0xfbb29;};'use strict';var _=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var moment=require('moment');var BPromise=require(_0x344b('0x2'));var rs=require(_0x344b('0x3'));var fs=require('fs');var Redis=require(_0x344b('0x4'));var db=require(_0x344b('0x5'))['db'];var utils=require(_0x344b('0x6'));var logger=require(_0x344b('0x7'))(_0x344b('0x8'));var config=require(_0x344b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x344b('0xa')]['http']({'port':0x232a});config[_0x344b('0xb')]=_[_0x344b('0xc')](config[_0x344b('0xb')],{'host':_0x344b('0xd'),'port':0x18eb});var socket=require(_0x344b('0xe'))(new Redis(config['redis']));require(_0x344b('0xf'))[_0x344b('0x10')](socket);function respondWithRpcPromise(_0x3317c2,_0x1c881e,_0x2a6010){return new BPromise(function(_0x412051,_0x326d10){return client[_0x344b('0x11')](_0x3317c2,_0x2a6010)[_0x344b('0x12')](function(_0x87f652){logger[_0x344b('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x1c881e,_0x344b('0x14'));logger[_0x344b('0x15')](_0x344b('0x16'),_0x1c881e,_0x344b('0x14'),JSON[_0x344b('0x17')](_0x87f652));if(_0x87f652[_0x344b('0x18')]){if(_0x87f652[_0x344b('0x18')]['code']===0x1f4){logger[_0x344b('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1c881e,_0x87f652[_0x344b('0x18')][_0x344b('0x19')]);return _0x326d10(_0x87f652[_0x344b('0x18')][_0x344b('0x19')]);}logger[_0x344b('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1c881e,_0x87f652[_0x344b('0x18')][_0x344b('0x19')]);return _0x412051(_0x87f652[_0x344b('0x18')][_0x344b('0x19')]);}else{logger['info'](_0x344b('0x1a'),_0x1c881e,'request\x20sent');_0x412051(_0x87f652[_0x344b('0x1b')][_0x344b('0x19')]);}})[_0x344b('0x1c')](function(_0x208b20){logger['error'](_0x344b('0x1a'),_0x1c881e,_0x208b20);_0x326d10(_0x208b20);});});} \ No newline at end of file +var _0x459e=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request'];(function(_0x2593ea,_0xff1577){var _0x49e40e=function(_0x48607b){while(--_0x48607b){_0x2593ea['push'](_0x2593ea['shift']());}};_0x49e40e(++_0xff1577);}(_0x459e,0x183));var _0xe459=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x459e[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xe459('0x0'));var util=require(_0xe459('0x1'));var moment=require(_0xe459('0x2'));var BPromise=require(_0xe459('0x3'));var rs=require(_0xe459('0x4'));var fs=require('fs');var Redis=require(_0xe459('0x5'));var db=require(_0xe459('0x6'))['db'];var utils=require(_0xe459('0x7'));var logger=require(_0xe459('0x8'))('rpc');var config=require(_0xe459('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe459('0xa')][_0xe459('0xb')]({'port':0x232a});config[_0xe459('0xc')]=_[_0xe459('0xd')](config[_0xe459('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe459('0xe'))(new Redis(config[_0xe459('0xc')]));require(_0xe459('0xf'))[_0xe459('0x10')](socket);function respondWithRpcPromise(_0x55e5fe,_0x556927,_0x25f803){return new BPromise(function(_0x2f856c,_0x3bc3bc){return client[_0xe459('0x11')](_0x55e5fe,_0x25f803)['then'](function(_0x436759){logger[_0xe459('0x12')](_0xe459('0x13'),_0x556927,_0xe459('0x14'));logger[_0xe459('0x15')](_0xe459('0x16'),_0x556927,'request\x20sent',JSON[_0xe459('0x17')](_0x436759));if(_0x436759[_0xe459('0x18')]){if(_0x436759[_0xe459('0x18')][_0xe459('0x19')]===0x1f4){logger[_0xe459('0x18')](_0xe459('0x13'),_0x556927,_0x436759['error']['message']);return _0x3bc3bc(_0x436759['error'][_0xe459('0x1a')]);}logger[_0xe459('0x18')](_0xe459('0x13'),_0x556927,_0x436759['error'][_0xe459('0x1a')]);return _0x2f856c(_0x436759['error'][_0xe459('0x1a')]);}else{logger[_0xe459('0x12')](_0xe459('0x13'),_0x556927,_0xe459('0x14'));_0x2f856c(_0x436759['result'][_0xe459('0x1a')]);}})['catch'](function(_0x5d4b8d){logger[_0xe459('0x18')](_0xe459('0x13'),_0x556927,_0x5d4b8d);_0x3bc3bc(_0x5d4b8d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f81d050..2f516f3 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 _0x5cec=['length','chatWebsite:','./chatWebsite.events','save','update','emit','removeListener'];(function(_0x20efe6,_0x2d6285){var _0x2680c2=function(_0x1c969b){while(--_0x1c969b){_0x20efe6['push'](_0x20efe6['shift']());}};_0x2680c2(++_0x2d6285);}(_0x5cec,0x1e5));var _0xc5ce=function(_0x18beb4,_0x2c9a9c){_0x18beb4=_0x18beb4-0x0;var _0x170b3e=_0x5cec[_0x18beb4];return _0x170b3e;};'use strict';var ChatWebsiteEvents=require(_0xc5ce('0x0'));var events=[_0xc5ce('0x1'),'remove',_0xc5ce('0x2')];function createListener(_0x299537,_0x5d1b97){return function(_0x23be66){_0x5d1b97[_0xc5ce('0x3')](_0x299537,_0x23be66);};}function removeListener(_0x4311d7,_0x41b539){return function(){ChatWebsiteEvents[_0xc5ce('0x4')](_0x4311d7,_0x41b539);};}exports['register']=function(_0x35fa6e){for(var _0x54365a=0x0,_0xdcea44=events[_0xc5ce('0x5')];_0x54365a<_0xdcea44;_0x54365a++){var _0x371ad3=events[_0x54365a];var _0x2babf1=createListener(_0xc5ce('0x6')+_0x371ad3,_0x35fa6e);ChatWebsiteEvents['on'](_0x371ad3,_0x2babf1);}}; \ No newline at end of file +var _0xba6f=['./chatWebsite.events','save','emit','register','chatWebsite:'];(function(_0x1b49ba,_0x3533f7){var _0x490b2a=function(_0x54f4a1){while(--_0x54f4a1){_0x1b49ba['push'](_0x1b49ba['shift']());}};_0x490b2a(++_0x3533f7);}(_0xba6f,0x73));var _0xfba6=function(_0x51fd25,_0x2fcbb){_0x51fd25=_0x51fd25-0x0;var _0x4529ae=_0xba6f[_0x51fd25];return _0x4529ae;};'use strict';var ChatWebsiteEvents=require(_0xfba6('0x0'));var events=[_0xfba6('0x1'),'remove','update'];function createListener(_0x9e3004,_0x29d888){return function(_0x1ef3cd){_0x29d888[_0xfba6('0x2')](_0x9e3004,_0x1ef3cd);};}function removeListener(_0x54b38e,_0x401bb9){return function(){ChatWebsiteEvents['removeListener'](_0x54b38e,_0x401bb9);};}exports[_0xfba6('0x3')]=function(_0x5ad294){for(var _0x455a4d=0x0,_0x48463f=events['length'];_0x455a4d<_0x48463f;_0x455a4d++){var _0x2166c9=events[_0x455a4d];var _0x5a68cc=createListener(_0xfba6('0x4')+_0x2166c9,_0x5ad294);ChatWebsiteEvents['on'](_0x2166c9,_0x5a68cc);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 53aab55..b255003 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 _0xdac6=['/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','addDisposition','post','/:id/canned_answers','addAnswer','join','root','server/files/images/logos/','%s-%s','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','format','now','/:id/avatar','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','any','offline','addInteraction','addApplications','addProactiveActions'];(function(_0x5c8376,_0x1d3be6){var _0x41a258=function(_0x410bc4){while(--_0x410bc4){_0x5c8376['push'](_0x5c8376['shift']());}};_0x41a258(++_0x1d3be6);}(_0xdac6,0x175));var _0x6dac=function(_0x4c2892,_0xf4b250){_0x4c2892=_0x4c2892-0x0;var _0x1695ef=_0xdac6[_0x4c2892];return _0x1695ef;};'use strict';var multer=require(_0x6dac('0x0'));var util=require('util');var path=require(_0x6dac('0x1'));var timeout=require(_0x6dac('0x2'));var express=require(_0x6dac('0x3'));var router=express[_0x6dac('0x4')]();var fs_extra=require(_0x6dac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6dac('0x6'));var config=require(_0x6dac('0x7'));var controller=require('./chatWebsite.controller');router[_0x6dac('0x8')]('/',auth[_0x6dac('0x9')](),controller['index']);router[_0x6dac('0x8')](_0x6dac('0xa'),auth[_0x6dac('0x9')](),controller[_0x6dac('0xb')]);router[_0x6dac('0x8')](_0x6dac('0xc'),auth[_0x6dac('0x9')](),controller[_0x6dac('0xd')]);router['get'](_0x6dac('0xe'),auth[_0x6dac('0x9')](),controller[_0x6dac('0xf')]);router[_0x6dac('0x8')]('/:id/canned_answers',auth[_0x6dac('0x9')](),controller['getAnswers']);router[_0x6dac('0x8')](_0x6dac('0x10'),controller[_0x6dac('0x11')]);router[_0x6dac('0x8')]('/:id/avatar',controller[_0x6dac('0x12')]);router['get'](_0x6dac('0x13'),controller[_0x6dac('0x14')]);router['get'](_0x6dac('0x15'),controller[_0x6dac('0x16')]);router[_0x6dac('0x8')](_0x6dac('0x17'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x18')]);router[_0x6dac('0x8')]('/:id/snippet',controller[_0x6dac('0x19')]);router[_0x6dac('0x8')](_0x6dac('0x1a'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x1b')]);router[_0x6dac('0x8')](_0x6dac('0x1c'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x1d')]);router['get'](_0x6dac('0x1e'),controller['getFields']);router[_0x6dac('0x8')](_0x6dac('0x1f'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x20')]);router[_0x6dac('0x8')]('/:id/users',auth[_0x6dac('0x9')](),controller[_0x6dac('0x21')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6dac('0xe'),auth['isAuthenticated'](),controller[_0x6dac('0x22')]);router[_0x6dac('0x23')](_0x6dac('0x24'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbb215a,_0x63d6ec,_0x1f92fc){_0x1f92fc(null,path[_0x6dac('0x26')](config[_0x6dac('0x27')],_0x6dac('0x28')));},'filename':function(_0x42690b,_0x5be55e,_0x4163ea){_0x4163ea(null,util['format'](_0x6dac('0x29'),Date['now'](),_0x5be55e[_0x6dac('0x2a')]));}})});router[_0x6dac('0x23')](_0x6dac('0x10'),upload[_0x6dac('0x2b')](_0x6dac('0x2c')),controller[_0x6dac('0x2d')]);var upload=multer({'storage':multer[_0x6dac('0x2e')]({'destination':function(_0x23cc17,_0x65d54c,_0x8216f9){_0x8216f9(null,path[_0x6dac('0x26')](config[_0x6dac('0x27')],_0x6dac('0x2f')));},'filename':function(_0x4900d7,_0x584af5,_0x2c8dc3){_0x2c8dc3(null,util[_0x6dac('0x30')](_0x6dac('0x29'),Date[_0x6dac('0x31')](),_0x584af5['originalname']));}})});router[_0x6dac('0x23')](_0x6dac('0x32'),upload[_0x6dac('0x2b')](_0x6dac('0x2c')),controller[_0x6dac('0x33')]);var upload=multer({'storage':multer[_0x6dac('0x2e')]({'destination':function(_0x5f2b15,_0x51637f,_0x3826fe){_0x3826fe(null,path[_0x6dac('0x26')](config[_0x6dac('0x27')],_0x6dac('0x2f')));},'filename':function(_0x46da7c,_0x2d6203,_0x1feee1){_0x1feee1(null,util[_0x6dac('0x30')](_0x6dac('0x29'),Date['now'](),_0x2d6203[_0x6dac('0x2a')]));}})});router['post'](_0x6dac('0x13'),upload[_0x6dac('0x2b')]('file'),controller[_0x6dac('0x34')]);var upload=multer({'storage':multer[_0x6dac('0x2e')]({'destination':function(_0x37a398,_0x5e7e88,_0xa0bc77){_0xa0bc77(null,path['join'](config[_0x6dac('0x27')],_0x6dac('0x2f')));},'filename':function(_0x5356c6,_0x1df81a,_0x4f0db6){_0x4f0db6(null,util[_0x6dac('0x30')](_0x6dac('0x29'),Date[_0x6dac('0x31')](),_0x1df81a[_0x6dac('0x2a')]));}})});router['post'](_0x6dac('0x15'),upload[_0x6dac('0x2b')](_0x6dac('0x2c')),controller[_0x6dac('0x35')]);router[_0x6dac('0x23')](_0x6dac('0x36'),controller[_0x6dac('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x6dac('0x2e')]({'destination':function(_0x16743d,_0x24f941,_0x650f4){const _0x2e8b07=path[_0x6dac('0x26')](config[_0x6dac('0x27')],_0x6dac('0x38'),_0x6dac('0x39'),_0x6dac('0x3a'));fs_extra['ensureDir'](_0x2e8b07,function(){_0x650f4(null,_0x2e8b07);});},'filename':function(_0x57b281,_0x100ffe,_0x487a6d){const _0x21c171=_0x100ffe[_0x6dac('0x2a')][_0x6dac('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x167ab6=path['extname'](_0x21c171);const _0x18ec6e=Date['now']()+'-'+_0x21c171[_0x6dac('0x3b')](_0x167ab6,'')+_0x167ab6;_0x487a6d(null,_0x18ec6e);}})});router[_0x6dac('0x23')]('/:id/offline',offlineUploadMulter[_0x6dac('0x3c')](),controller[_0x6dac('0x3d')]);router[_0x6dac('0x23')](_0x6dac('0x17'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x3e')]);router[_0x6dac('0x23')](_0x6dac('0x1a'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x3f')]);router[_0x6dac('0x23')](_0x6dac('0x1c'),auth['isAuthenticated'](),controller[_0x6dac('0x40')]);router[_0x6dac('0x23')](_0x6dac('0x41'),auth[_0x6dac('0x9')](),controller['addAgents']);router[_0x6dac('0x42')](_0x6dac('0xc'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x43')]);router[_0x6dac('0x44')](_0x6dac('0xc'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x45')]);router[_0x6dac('0x44')](_0x6dac('0xe'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x46')]);router[_0x6dac('0x44')](_0x6dac('0x24'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x47')]);router[_0x6dac('0x44')](_0x6dac('0x41'),auth[_0x6dac('0x9')](),controller[_0x6dac('0x48')]);module['exports']=router; \ No newline at end of file +var _0xef04=['../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/users','getAgents','post','create','/:id/dispositions','diskStorage','join','format','%s-%s','now','originalname','single','addLogo','root','file','addAvatar','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','notify','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xef04,0x111));var _0x4ef0=function(_0x38c121,_0x29c927){_0x38c121=_0x38c121-0x0;var _0x21c1f5=_0xef04[_0x38c121];return _0x21c1f5;};'use strict';var multer=require(_0x4ef0('0x0'));var util=require('util');var path=require(_0x4ef0('0x1'));var timeout=require(_0x4ef0('0x2'));var express=require(_0x4ef0('0x3'));var router=express[_0x4ef0('0x4')]();var fs_extra=require(_0x4ef0('0x5'));var auth=require(_0x4ef0('0x6'));var interaction=require(_0x4ef0('0x7'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x9')]);router['get'](_0x4ef0('0xa'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0xb')]);router[_0x4ef0('0xc')](_0x4ef0('0xd'),auth[_0x4ef0('0x8')](),controller['show']);router['get']('/:id/dispositions',auth[_0x4ef0('0x8')](),controller['getDispositions']);router[_0x4ef0('0xc')](_0x4ef0('0xe'),auth['isAuthenticated'](),controller[_0x4ef0('0xf')]);router['get'](_0x4ef0('0x10'),controller[_0x4ef0('0x11')]);router[_0x4ef0('0xc')](_0x4ef0('0x12'),controller[_0x4ef0('0x13')]);router['get'](_0x4ef0('0x14'),controller[_0x4ef0('0x15')]);router[_0x4ef0('0xc')](_0x4ef0('0x16'),controller['getSystemAvatar']);router[_0x4ef0('0xc')](_0x4ef0('0x17'),auth[_0x4ef0('0x8')](),controller['getInteractions']);router[_0x4ef0('0xc')](_0x4ef0('0x18'),controller['getSnippet']);router[_0x4ef0('0xc')]('/:id/applications',auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x19')]);router[_0x4ef0('0xc')](_0x4ef0('0x1a'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x1b')]);router[_0x4ef0('0xc')](_0x4ef0('0x1c'),controller[_0x4ef0('0x1d')]);router['get']('/:id/offline_messages',auth[_0x4ef0('0x8')](),controller['getOfflineMessages']);router[_0x4ef0('0xc')](_0x4ef0('0x1e'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x1f')]);router[_0x4ef0('0x20')]('/',auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x21')]);router['post'](_0x4ef0('0x22'),auth[_0x4ef0('0x8')](),controller['addDisposition']);router[_0x4ef0('0x20')](_0x4ef0('0xe'),auth[_0x4ef0('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x4ef0('0x23')]({'destination':function(_0x2a6333,_0x561e51,_0x39f5b2){_0x39f5b2(null,path[_0x4ef0('0x24')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5f5cf5,_0xcfefe5,_0x518299){_0x518299(null,util[_0x4ef0('0x25')](_0x4ef0('0x26'),Date[_0x4ef0('0x27')](),_0xcfefe5[_0x4ef0('0x28')]));}})});router[_0x4ef0('0x20')](_0x4ef0('0x10'),upload[_0x4ef0('0x29')]('file'),controller[_0x4ef0('0x2a')]);var upload=multer({'storage':multer[_0x4ef0('0x23')]({'destination':function(_0x1132a8,_0x272497,_0x1b66b2){_0x1b66b2(null,path['join'](config[_0x4ef0('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x4445bf,_0x513d6b,_0x1fe5ca){_0x1fe5ca(null,util[_0x4ef0('0x25')](_0x4ef0('0x26'),Date[_0x4ef0('0x27')](),_0x513d6b[_0x4ef0('0x28')]));}})});router[_0x4ef0('0x20')]('/:id/avatar',upload[_0x4ef0('0x29')](_0x4ef0('0x2c')),controller[_0x4ef0('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x9e2798,_0x472395,_0x41fbeb){_0x41fbeb(null,path[_0x4ef0('0x24')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x1f722b,_0x429c58,_0x3a6d9e){_0x3a6d9e(null,util[_0x4ef0('0x25')](_0x4ef0('0x26'),Date[_0x4ef0('0x27')](),_0x429c58[_0x4ef0('0x28')]));}})});router[_0x4ef0('0x20')](_0x4ef0('0x14'),upload[_0x4ef0('0x29')](_0x4ef0('0x2c')),controller[_0x4ef0('0x2e')]);var upload=multer({'storage':multer[_0x4ef0('0x23')]({'destination':function(_0x1c811e,_0x412da5,_0x3f9b8a){_0x3f9b8a(null,path[_0x4ef0('0x24')](config[_0x4ef0('0x2b')],_0x4ef0('0x2f')));},'filename':function(_0x4529d3,_0x1e73fe,_0x318b55){_0x318b55(null,util['format'](_0x4ef0('0x26'),Date['now'](),_0x1e73fe[_0x4ef0('0x28')]));}})});router[_0x4ef0('0x20')](_0x4ef0('0x16'),upload[_0x4ef0('0x29')](_0x4ef0('0x2c')),controller[_0x4ef0('0x30')]);router['post']('/:id/notify',controller[_0x4ef0('0x31')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1c6a7b,_0x25bf8a,_0x591773){const _0x164f38=path[_0x4ef0('0x24')](config[_0x4ef0('0x2b')],'server/files','attachments',_0x4ef0('0x32'));fs_extra[_0x4ef0('0x33')](_0x164f38,function(){_0x591773(null,_0x164f38);});},'filename':function(_0x5a7a2c,_0xfa322c,_0x42fc50){const _0x32c42f=_0xfa322c[_0x4ef0('0x28')][_0x4ef0('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x30c468=path[_0x4ef0('0x35')](_0x32c42f);const _0x2a1d1c=Date[_0x4ef0('0x27')]()+'-'+_0x32c42f[_0x4ef0('0x34')](_0x30c468,'')+_0x30c468;_0x42fc50(null,_0x2a1d1c);}})});router[_0x4ef0('0x20')](_0x4ef0('0x36'),offlineUploadMulter[_0x4ef0('0x37')](),controller[_0x4ef0('0x38')]);router[_0x4ef0('0x20')](_0x4ef0('0x17'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x39')]);router['post'](_0x4ef0('0x3a'),auth['isAuthenticated'](),controller[_0x4ef0('0x3b')]);router[_0x4ef0('0x20')](_0x4ef0('0x1a'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x3c')]);router['post'](_0x4ef0('0x1e'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x3d')]);router[_0x4ef0('0x3e')]('/:id',auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x3f')]);router['delete'](_0x4ef0('0xd'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x40')]);router[_0x4ef0('0x41')](_0x4ef0('0x22'),auth['isAuthenticated'](),controller[_0x4ef0('0x42')]);router['delete'](_0x4ef0('0xe'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x43')]);router[_0x4ef0('0x41')](_0x4ef0('0x1e'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x44')]);module[_0x4ef0('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c0c9f39..1ffa29e 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 _0xcf0b=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xcf0b,0xe3));var _0xbcf0=function(_0x4dd072,_0x515c74){_0x4dd072=_0x4dd072-0x0;var _0x45ee58=_0xcf0b[_0x4dd072];return _0x45ee58;};var beaverLogger=require(_0xbcf0('0x0'));var express=require(_0xbcf0('0x1'));var auth=require(_0xbcf0('0x2'));var config=require(_0xbcf0('0x3'));var router=express[_0xbcf0('0x4')]();var isProduction=config[_0xbcf0('0x5')]===_0xbcf0('0x6')||![];function clientSideLogs(_0x365555,_0x39a878,_0x28d8ab){var _0x5b127c=_0x365555['app'][_0xbcf0('0x7')](_0xbcf0('0x8'));if(!_0x5b127c){throw new Error(_0xbcf0('0x9'));}return beaverLogger[_0xbcf0('0xa')]({'uri':_0xbcf0('0xb'),'logger':_0x5b127c,'enableCors':!isProduction})(_0x365555,_0x39a878,_0x28d8ab);}router['use'](auth[_0xbcf0('0xc')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x30d3=['isAuthenticated','exports','beaver-logger/server','express','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0x5bd688,_0x182339){var _0xa84424=function(_0xc9fbb4){while(--_0xc9fbb4){_0x5bd688['push'](_0x5bd688['shift']());}};_0xa84424(++_0x182339);}(_0x30d3,0xc6));var _0x330d=function(_0x6c7031,_0x434dbf){_0x6c7031=_0x6c7031-0x0;var _0xc677f6=_0x30d3[_0x6c7031];return _0xc677f6;};var beaverLogger=require(_0x330d('0x0'));var express=require(_0x330d('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x330d('0x2')]();var isProduction=config[_0x330d('0x3')]===_0x330d('0x4')||![];function clientSideLogs(_0x2f7591,_0x17ed29,_0x480612){var _0x4a5a34=_0x2f7591[_0x330d('0x5')][_0x330d('0x6')](_0x330d('0x7'));if(!_0x4a5a34){throw new Error(_0x330d('0x8'));}return beaverLogger[_0x330d('0x9')]({'uri':_0x330d('0xa'),'logger':_0x4a5a34,'enableCors':!isProduction})(_0x2f7591,_0x17ed29,_0x480612);}router[_0x330d('0xb')](auth[_0x330d('0xc')](),clientSideLogs);module[_0x330d('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 4605107..21ac330 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 _0xa88c=['STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','exports'];(function(_0x9da8b9,_0x445b60){var _0x207521=function(_0x4e0527){while(--_0x4e0527){_0x9da8b9['push'](_0x9da8b9['shift']());}};_0x207521(++_0x445b60);}(_0xa88c,0x185));var _0xca88=function(_0x544f09,_0x1624a3){_0x544f09=_0x544f09-0x0;var _0x542110=_0xa88c[_0x544f09];return _0x542110;};'use strict';var Sequelize=require('sequelize');module[_0xca88('0x0')]={'name':{'type':Sequelize[_0xca88('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xca88('0x2')](_0xca88('0x3'),_0xca88('0x4'),_0xca88('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xca88('0x6'),_0xca88('0x7'))},'data1':{'type':Sequelize[_0xca88('0x1')],'comment':_0xca88('0x8')},'data2':{'type':Sequelize[_0xca88('0x1')],'comment':_0xca88('0x9')},'data3':{'type':Sequelize[_0xca88('0x1')],'comment':_0xca88('0xa')},'data4':{'type':Sequelize[_0xca88('0x1')],'comment':_0xca88('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0xca88('0xc')},'data6':{'type':Sequelize[_0xca88('0xd')],'comment':_0xca88('0xe')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x1f37=['Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','Google','MicrosoftAzure'];(function(_0x58a994,_0x2e1bcf){var _0x40a74c=function(_0xd5e396){while(--_0xd5e396){_0x58a994['push'](_0x58a994['shift']());}};_0x40a74c(++_0x2e1bcf);}(_0x1f37,0x1d8));var _0x71f3=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x1f37[_0x4394b6];return _0x360244;};'use strict';var Sequelize=require('sequelize');module[_0x71f3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x71f3('0x1')]('AmazonAWS',_0x71f3('0x2'),_0x71f3('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x71f3('0x1')](_0x71f3('0x4'),_0x71f3('0x5'))},'data1':{'type':Sequelize[_0x71f3('0x6')],'comment':_0x71f3('0x7')},'data2':{'type':Sequelize['STRING'],'comment':_0x71f3('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x71f3('0x9')},'data4':{'type':Sequelize[_0x71f3('0x6')],'comment':_0x71f3('0xa')},'data5':{'type':Sequelize[_0x71f3('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0x71f3('0xc')},'data7':{'type':Sequelize[_0x71f3('0xb')],'comment':_0x71f3('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 65a6103..04bde99 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 _0xe291=['Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','MicrosoftAzure','params','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','stack','name','send','padEnd','CloudProvider','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','decryptString','data3','catch','show','find','service','create','body'];(function(_0x278d73,_0xb20d63){var _0x31ca5c=function(_0x3355d5){while(--_0x3355d5){_0x278d73['push'](_0x278d73['shift']());}};_0x31ca5c(++_0xb20d63);}(_0xe291,0x12f));var _0x1e29=function(_0x3cb339,_0xaa2c29){_0x3cb339=_0x3cb339-0x0;var _0x302367=_0xe291[_0x3cb339];return _0x302367;};'use strict';var _=require('lodash');var Redis=require(_0x1e29('0x0'));var qs=require(_0x1e29('0x1'));var encryptor=require(_0x1e29('0x2'));var config=require(_0x1e29('0x3'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x1e29('0x4'));config[_0x1e29('0x5')]=_[_0x1e29('0x6')](config[_0x1e29('0x5')],{'host':_0x1e29('0x7'),'port':0x18eb});var socket=require(_0x1e29('0x8'))(new Redis(config[_0x1e29('0x5')]));var redis=new Redis(config[_0x1e29('0x5')]);function respondWithStatusCode(_0x389e9c,_0x132bf2){_0x132bf2=_0x132bf2||0xcc;return function(_0x3080b8){if(_0x3080b8){return _0x389e9c[_0x1e29('0x9')](_0x132bf2);}return _0x389e9c[_0x1e29('0xa')](_0x132bf2)[_0x1e29('0xb')]();};}function respondWithResult(_0x3e1d56,_0x38d77d){_0x38d77d=_0x38d77d||0xc8;return function(_0x3579d5){if(_0x3579d5){return _0x3e1d56[_0x1e29('0xa')](_0x38d77d)['json'](_0x3579d5);}};}function respondWithFilteredResult(_0x30bf66,_0x1b0c23){return function(_0x50b20a){if(_0x50b20a){var _0x47bd3f=typeof _0x1b0c23[_0x1e29('0xc')]===_0x1e29('0xd')&&typeof _0x1b0c23[_0x1e29('0xe')]==='undefined';var _0x5605a7=_0x50b20a[_0x1e29('0xf')];var _0x2ecc94=_0x47bd3f?0x0:_0x1b0c23[_0x1e29('0xc')];var _0x165bcf=_0x47bd3f?_0x50b20a[_0x1e29('0xf')]:_0x1b0c23[_0x1e29('0xc')]+_0x1b0c23[_0x1e29('0xe')];var _0x23b147;if(_0x165bcf>=_0x5605a7){_0x165bcf=_0x5605a7;_0x23b147=0xc8;}else{_0x23b147=0xce;}_0x30bf66['status'](_0x23b147);return _0x30bf66[_0x1e29('0x10')](_0x1e29('0x11'),_0x2ecc94+'-'+_0x165bcf+'/'+_0x5605a7)[_0x1e29('0x12')](_0x50b20a);}return null;};}function saveUpdates(_0x189e5c){return function(_0x381127){if(_0x381127){return _0x381127[_0x1e29('0x13')](_0x189e5c)[_0x1e29('0x14')](function(_0xb768d1){return _0xb768d1;});}return null;};}function removeEntity(_0x234f40){return function(_0x3bb992){if(_0x3bb992){return _0x3bb992['destroy']()[_0x1e29('0x14')](function(){_0x234f40[_0x1e29('0xa')](0xcc)[_0x1e29('0xb')]();});}};}function handleEntityNotFound(_0x246784){return function(_0x2547fe){if(!_0x2547fe){_0x246784['sendStatus'](0x194);}return _0x2547fe;};}function handleError(_0x332712,_0x2e3745){_0x2e3745=_0x2e3745||0x1f4;return function(_0x14b8ca){logger[_0x1e29('0x15')](_0x14b8ca[_0x1e29('0x16')]);if(_0x14b8ca[_0x1e29('0x17')]){delete _0x14b8ca[_0x1e29('0x17')];}_0x332712[_0x1e29('0xa')](_0x2e3745)[_0x1e29('0x18')](_0x14b8ca);};}function maskClientSecret(_0x531c0f){return _[_0x1e29('0x19')](_0x531c0f['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x95d8ee,_0x525ba1){var _0x324d0f={},_0x301dc6={},_0x27db2a={'count':0x0,'rows':[]};var _0xdc4427=_['map'](db[_0x1e29('0x1a')][_0x1e29('0x1b')],function(_0x216512){return{'name':_0x216512[_0x1e29('0x1c')],'type':_0x216512['type'][_0x1e29('0x1d')]};});_0x301dc6[_0x1e29('0x1e')]=_[_0x1e29('0x1f')](_0xdc4427,_0x1e29('0x17'));_0x301dc6[_0x1e29('0x20')]=_[_0x1e29('0x21')](_0x95d8ee[_0x1e29('0x20')]);_0x301dc6[_0x1e29('0x22')]=_[_0x1e29('0x23')](_0x301dc6[_0x1e29('0x1e')],_0x301dc6[_0x1e29('0x20')]);_0x324d0f['attributes']=_['intersection'](_0x301dc6[_0x1e29('0x1e')],qs[_0x1e29('0x24')](_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x24')]));_0x324d0f['attributes']=_0x324d0f[_0x1e29('0x25')][_0x1e29('0x26')]?_0x324d0f[_0x1e29('0x25')]:_0x301dc6[_0x1e29('0x1e')];if(!_0x95d8ee['query'][_0x1e29('0x27')]('nolimit')){_0x324d0f[_0x1e29('0xe')]=qs['limit'](_0x95d8ee['query']['limit']);_0x324d0f[_0x1e29('0xc')]=qs['offset'](_0x95d8ee['query']['offset']);}_0x324d0f[_0x1e29('0x28')]=qs[_0x1e29('0x29')](_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x29')]);_0x324d0f[_0x1e29('0x2a')]=qs['filters'](_[_0x1e29('0x2b')](_0x95d8ee[_0x1e29('0x20')],_0x301dc6[_0x1e29('0x22')]),_0xdc4427);if(_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x2c')]){_0x324d0f[_0x1e29('0x2a')]=_['merge'](_0x324d0f[_0x1e29('0x2a')],{'$or':_[_0x1e29('0x1f')](_0xdc4427,function(_0x13ee00){if(_0x13ee00[_0x1e29('0x2d')]!==_0x1e29('0x2e')){var _0x5eeef9={};_0x5eeef9[_0x13ee00[_0x1e29('0x17')]]={'$like':'%'+_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x2c')]+'%'};return _0x5eeef9;}})});}_0x324d0f=_[_0x1e29('0x2f')]({},_0x324d0f,_0x95d8ee[_0x1e29('0x30')]);var _0x2b8e56={'where':_0x324d0f['where']};return db[_0x1e29('0x1a')]['count'](_0x2b8e56)['then'](function(_0x15c166){_0x27db2a[_0x1e29('0xf')]=_0x15c166;if(_0x95d8ee[_0x1e29('0x20')][_0x1e29('0x31')]){_0x324d0f[_0x1e29('0x32')]=[{'all':!![]}];}return db[_0x1e29('0x1a')][_0x1e29('0x33')](_0x324d0f);})['then'](function(_0x2e074c){_0x27db2a[_0x1e29('0x34')]=_['map'](_0x2e074c,function(_0x30b01c){if(_0x30b01c['service']==='MicrosoftAzure'){var _0x5a51ab=encryptor[_0x1e29('0x35')](_0x30b01c[_0x1e29('0x36')]);_0x30b01c[_0x1e29('0x36')]=maskClientSecret(_0x5a51ab);}return _0x30b01c;});return _0x27db2a;})['then'](respondWithFilteredResult(_0x525ba1,_0x324d0f))[_0x1e29('0x37')](handleError(_0x525ba1,null));};exports[_0x1e29('0x38')]=function(_0x4c4ee5,_0x22f380){var _0x2e386a={'raw':!![],'where':{'id':_0x4c4ee5['params']['id']}},_0x175a63={};_0x175a63[_0x1e29('0x1e')]=_[_0x1e29('0x21')](db['CloudProvider'][_0x1e29('0x1b')]);_0x175a63[_0x1e29('0x20')]=_[_0x1e29('0x21')](_0x4c4ee5[_0x1e29('0x20')]);_0x175a63[_0x1e29('0x22')]=_[_0x1e29('0x23')](_0x175a63[_0x1e29('0x1e')],_0x175a63[_0x1e29('0x20')]);_0x2e386a[_0x1e29('0x25')]=_[_0x1e29('0x23')](_0x175a63[_0x1e29('0x1e')],qs[_0x1e29('0x24')](_0x4c4ee5[_0x1e29('0x20')][_0x1e29('0x24')]));_0x2e386a[_0x1e29('0x25')]=_0x2e386a['attributes'][_0x1e29('0x26')]?_0x2e386a[_0x1e29('0x25')]:_0x175a63['model'];if(_0x4c4ee5['query'][_0x1e29('0x31')]){_0x2e386a[_0x1e29('0x32')]=[{'all':!![]}];}_0x2e386a=_[_0x1e29('0x2f')]({},_0x2e386a,_0x4c4ee5[_0x1e29('0x30')]);return db['CloudProvider'][_0x1e29('0x39')](_0x2e386a)['then'](handleEntityNotFound(_0x22f380,null))['then'](function(_0x440d5d){if(_0x440d5d[_0x1e29('0x3a')]==='MicrosoftAzure'){var _0x4ceb0c=encryptor[_0x1e29('0x35')](_0x440d5d['data3']);_0x440d5d[_0x1e29('0x36')]=maskClientSecret(_0x4ceb0c);}return _0x440d5d;})[_0x1e29('0x14')](respondWithResult(_0x22f380,null))[_0x1e29('0x37')](handleError(_0x22f380,null));};exports[_0x1e29('0x3b')]=function(_0x51d957,_0x117f93){if(!_0x51d957[_0x1e29('0x3c')][_0x1e29('0x17')])throw new Error(_0x1e29('0x3d'));if(!_0x51d957[_0x1e29('0x3c')][_0x1e29('0x3a')])throw new Error(_0x1e29('0x3e'));var _0x9fa867=db[_0x1e29('0x1a')][_0x1e29('0x1b')][_0x1e29('0x3a')]['values'];if(!_0x9fa867['includes'](_0x51d957[_0x1e29('0x3c')][_0x1e29('0x3a')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x9fa867['join'](',\x20'));if(_0x51d957[_0x1e29('0x3c')][_0x1e29('0x3a')]===_0x1e29('0x3f')&&_0x51d957[_0x1e29('0x3c')][_0x1e29('0x36')]){_0x51d957[_0x1e29('0x3c')][_0x1e29('0x36')]=encryptor['encryptString'](_0x51d957[_0x1e29('0x3c')][_0x1e29('0x36')]);}return db['CloudProvider']['create'](_0x51d957[_0x1e29('0x3c')],{})[_0x1e29('0x14')](respondWithResult(_0x117f93,0xc9))[_0x1e29('0x37')](handleError(_0x117f93,null));};exports[_0x1e29('0x13')]=function(_0x5dba85,_0x1cff9a){if(_0x5dba85[_0x1e29('0x3c')]['id']){delete _0x5dba85[_0x1e29('0x3c')]['id'];}return db[_0x1e29('0x1a')][_0x1e29('0x39')]({'where':{'id':_0x5dba85[_0x1e29('0x40')]['id']}})[_0x1e29('0x14')](handleEntityNotFound(_0x1cff9a,null))['then'](function(_0x3e264e){if(_0x3e264e[_0x1e29('0x3a')]===_0x1e29('0x3f')&&_0x5dba85[_0x1e29('0x3c')][_0x1e29('0x36')]){_0x5dba85['body'][_0x1e29('0x36')]=encryptor[_0x1e29('0x41')](_0x5dba85[_0x1e29('0x3c')][_0x1e29('0x36')]);}return _0x3e264e;})[_0x1e29('0x14')](saveUpdates(_0x5dba85[_0x1e29('0x3c')],null))[_0x1e29('0x14')](respondWithResult(_0x1cff9a,null))[_0x1e29('0x37')](handleError(_0x1cff9a,null));};exports['destroy']=function(_0x18c6a3,_0xba5c2f){return db['CloudProvider'][_0x1e29('0x39')]({'where':{'id':_0x18c6a3[_0x1e29('0x40')]['id']}})[_0x1e29('0x14')](handleEntityNotFound(_0xba5c2f,null))[_0x1e29('0x14')](removeEntity(_0xba5c2f,null))['catch'](handleError(_0xba5c2f,null));};exports[_0x1e29('0x42')]=function(_0x5a2fa6,_0x13c407){return db['CloudProvider']['findOne']({'where':{'id':_0x5a2fa6[_0x1e29('0x40')]['id']},'raw':!![]})[_0x1e29('0x14')](function(_0x4550fc){if(!_0x4550fc)return _0x13c407['sendStatus'](0x194);return{'url':oauth[_0x1e29('0x43')](_0x4550fc,_0x5a2fa6[_0x1e29('0x44')]['id'])};})[_0x1e29('0x14')](respondWithResult(_0x13c407,null))['catch'](handleError(_0x13c407,null));};exports[_0x1e29('0x45')]=function(_0x22b13c,_0x3d78ad){var _0x2cb0ed=_0x22b13c[_0x1e29('0x3c')];var _0x172fdf;var _0xe7f688;if(_0x2cb0ed['error'])throw _0x2cb0ed;redis[_0x1e29('0x46')](_0x2cb0ed[_0x1e29('0x47')])['then'](function(_0x265277){if(!_0x265277)throw new Error(_0x1e29('0x48'));_0x172fdf=JSON[_0x1e29('0x49')](_0x265277);var _0x210b2f=Buffer[_0x1e29('0x4a')](_0x2cb0ed['state'],_0x1e29('0x4b'))[_0x1e29('0x4c')](_0x1e29('0x4d'));_0xe7f688=JSON[_0x1e29('0x49')](_0x210b2f);if(!oauth['isValidIdToken'](_0x2cb0ed['id_token'],_0x172fdf['oauth2Claims']))throw new Error(_0x1e29('0x4e'));redis[_0x1e29('0x4f')](_0x2cb0ed[_0x1e29('0x47')]);return oauth[_0x1e29('0x50')](_0x2cb0ed[_0x1e29('0x51')],_0x172fdf);})[_0x1e29('0x14')](function(_0x1be120){_0x172fdf[_0x1e29('0x52')]=_0x1be120[_0x1e29('0x53')];_0x172fdf['data6']=_0x1be120['refresh_token'];return db[_0x1e29('0x1a')]['update']({'data5':_0x172fdf['data5'],'data6':_0x172fdf[_0x1e29('0x54')]},{'where':{'id':_0x172fdf['id']}});})[_0x1e29('0x14')](function(){oauth[_0x1e29('0x55')](_0x172fdf);socket[_0x1e29('0x56')](_0x1e29('0x57'),{'id':_0xe7f688['id']});return;})[_0x1e29('0x14')](respondWithStatusCode(_0x3d78ad,null))[_0x1e29('0x37')](function(_0x17ca5b){if(_0xe7f688){socket[_0x1e29('0x56')]('microsoftAuthorization:error',{'id':_0xe7f688['id']});}if(!_0x172fdf){logger['error'](_0x1e29('0x58'),_0x17ca5b);return _0x3d78ad[_0x1e29('0xa')](0x1f4)['send'](_0x17ca5b[_0x1e29('0x59')]);}logger[_0x1e29('0x15')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x172fdf['id'],JSON[_0x1e29('0x5a')](_0x17ca5b));});}; \ No newline at end of file +var _0x3ae0=['json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','sendStatus','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','params','length','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','find','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','parse','from','state','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status'];(function(_0x34ae7e,_0x1e8cdd){var _0x2a5324=function(_0x4f1dfc){while(--_0x4f1dfc){_0x34ae7e['push'](_0x34ae7e['shift']());}};_0x2a5324(++_0x1e8cdd);}(_0x3ae0,0x110));var _0x03ae=function(_0x57349e,_0x34c1c1){_0x57349e=_0x57349e-0x0;var _0x2a2671=_0x3ae0[_0x57349e];return _0x2a2671;};'use strict';var _=require(_0x03ae('0x0'));var Redis=require(_0x03ae('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x03ae('0x2'))(_0x03ae('0x3'));var db=require(_0x03ae('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0x03ae('0x5')](config[_0x03ae('0x6')],{'host':_0x03ae('0x7'),'port':0x18eb});var socket=require(_0x03ae('0x8'))(new Redis(config[_0x03ae('0x6')]));var redis=new Redis(config[_0x03ae('0x6')]);function respondWithStatusCode(_0x3a64fc,_0x1aa2a0){_0x1aa2a0=_0x1aa2a0||0xcc;return function(_0x2d2093){if(_0x2d2093){return _0x3a64fc['sendStatus'](_0x1aa2a0);}return _0x3a64fc[_0x03ae('0x9')](_0x1aa2a0)['end']();};}function respondWithResult(_0x51ee33,_0x2c327f){_0x2c327f=_0x2c327f||0xc8;return function(_0x53f7bc){if(_0x53f7bc){return _0x51ee33[_0x03ae('0x9')](_0x2c327f)[_0x03ae('0xa')](_0x53f7bc);}};}function respondWithFilteredResult(_0x5a2aa8,_0x2d87c0){return function(_0x43c660){if(_0x43c660){var _0x2d0517=typeof _0x2d87c0['offset']===_0x03ae('0xb')&&typeof _0x2d87c0[_0x03ae('0xc')]==='undefined';var _0x549c2a=_0x43c660[_0x03ae('0xd')];var _0x21682e=_0x2d0517?0x0:_0x2d87c0[_0x03ae('0xe')];var _0x403a8a=_0x2d0517?_0x43c660['count']:_0x2d87c0[_0x03ae('0xe')]+_0x2d87c0[_0x03ae('0xc')];var _0x541da5;if(_0x403a8a>=_0x549c2a){_0x403a8a=_0x549c2a;_0x541da5=0xc8;}else{_0x541da5=0xce;}_0x5a2aa8['status'](_0x541da5);return _0x5a2aa8[_0x03ae('0xf')](_0x03ae('0x10'),_0x21682e+'-'+_0x403a8a+'/'+_0x549c2a)[_0x03ae('0xa')](_0x43c660);}return null;};}function saveUpdates(_0x371aa2){return function(_0x596f5b){if(_0x596f5b){return _0x596f5b[_0x03ae('0x11')](_0x371aa2)[_0x03ae('0x12')](function(_0x2c81f){return _0x2c81f;});}return null;};}function removeEntity(_0x2cdb86){return function(_0x54f93a){if(_0x54f93a){return _0x54f93a[_0x03ae('0x13')]()[_0x03ae('0x12')](function(){_0x2cdb86[_0x03ae('0x9')](0xcc)[_0x03ae('0x14')]();});}};}function handleEntityNotFound(_0x2b3643){return function(_0x2cf171){if(!_0x2cf171){_0x2b3643[_0x03ae('0x15')](0x194);}return _0x2cf171;};}function handleError(_0xa8c24f,_0x43a149){_0x43a149=_0x43a149||0x1f4;return function(_0x509b0e){logger[_0x03ae('0x16')](_0x509b0e['stack']);if(_0x509b0e[_0x03ae('0x17')]){delete _0x509b0e[_0x03ae('0x17')];}_0xa8c24f[_0x03ae('0x9')](_0x43a149)[_0x03ae('0x18')](_0x509b0e);};}function maskClientSecret(_0x5674f9){return _[_0x03ae('0x19')](_0x5674f9[_0x03ae('0x1a')](0x0,0x3),0x14,'*');}exports[_0x03ae('0x1b')]=function(_0x560dbd,_0x78e833){var _0x126ba7={},_0x342eda={},_0x9c832b={'count':0x0,'rows':[]};var _0x28c9fb=_[_0x03ae('0x1c')](db[_0x03ae('0x1d')][_0x03ae('0x1e')],function(_0x527c7d){return{'name':_0x527c7d['fieldName'],'type':_0x527c7d[_0x03ae('0x1f')][_0x03ae('0x20')]};});_0x342eda[_0x03ae('0x21')]=_[_0x03ae('0x1c')](_0x28c9fb,_0x03ae('0x17'));_0x342eda[_0x03ae('0x22')]=_[_0x03ae('0x23')](_0x560dbd[_0x03ae('0x22')]);_0x342eda[_0x03ae('0x24')]=_[_0x03ae('0x25')](_0x342eda[_0x03ae('0x21')],_0x342eda['query']);_0x126ba7[_0x03ae('0x26')]=_[_0x03ae('0x25')](_0x342eda['model'],qs[_0x03ae('0x27')](_0x560dbd[_0x03ae('0x22')]['fields']));_0x126ba7['attributes']=_0x126ba7[_0x03ae('0x26')]['length']?_0x126ba7['attributes']:_0x342eda['model'];if(!_0x560dbd[_0x03ae('0x22')]['hasOwnProperty'](_0x03ae('0x28'))){_0x126ba7[_0x03ae('0xc')]=qs[_0x03ae('0xc')](_0x560dbd[_0x03ae('0x22')][_0x03ae('0xc')]);_0x126ba7[_0x03ae('0xe')]=qs['offset'](_0x560dbd[_0x03ae('0x22')][_0x03ae('0xe')]);}_0x126ba7[_0x03ae('0x29')]=qs[_0x03ae('0x2a')](_0x560dbd[_0x03ae('0x22')]['sort']);_0x126ba7[_0x03ae('0x2b')]=qs[_0x03ae('0x24')](_[_0x03ae('0x2c')](_0x560dbd[_0x03ae('0x22')],_0x342eda[_0x03ae('0x24')]),_0x28c9fb);if(_0x560dbd[_0x03ae('0x22')]['filter']){_0x126ba7['where']=_[_0x03ae('0x2d')](_0x126ba7[_0x03ae('0x2b')],{'$or':_['map'](_0x28c9fb,function(_0x554c95){if(_0x554c95[_0x03ae('0x1f')]!==_0x03ae('0x2e')){var _0x21333d={};_0x21333d[_0x554c95[_0x03ae('0x17')]]={'$like':'%'+_0x560dbd[_0x03ae('0x22')][_0x03ae('0x2f')]+'%'};return _0x21333d;}})});}_0x126ba7=_['merge']({},_0x126ba7,_0x560dbd[_0x03ae('0x30')]);var _0x528c3a={'where':_0x126ba7[_0x03ae('0x2b')]};return db[_0x03ae('0x1d')]['count'](_0x528c3a)[_0x03ae('0x12')](function(_0x394e58){_0x9c832b[_0x03ae('0xd')]=_0x394e58;if(_0x560dbd[_0x03ae('0x22')][_0x03ae('0x31')]){_0x126ba7[_0x03ae('0x32')]=[{'all':!![]}];}return db[_0x03ae('0x1d')][_0x03ae('0x33')](_0x126ba7);})[_0x03ae('0x12')](function(_0x6f4c34){_0x9c832b[_0x03ae('0x34')]=_[_0x03ae('0x1c')](_0x6f4c34,function(_0x1c5bb8){if(_0x1c5bb8[_0x03ae('0x35')]===_0x03ae('0x36')){var _0x4b85fc=encryptor[_0x03ae('0x37')](_0x1c5bb8[_0x03ae('0x38')]);_0x1c5bb8[_0x03ae('0x38')]=maskClientSecret(_0x4b85fc);}return _0x1c5bb8;});return _0x9c832b;})[_0x03ae('0x12')](respondWithFilteredResult(_0x78e833,_0x126ba7))[_0x03ae('0x39')](handleError(_0x78e833,null));};exports['show']=function(_0x52db40,_0x29c6be){var _0x5d07da={'raw':!![],'where':{'id':_0x52db40[_0x03ae('0x3a')]['id']}},_0x184d38={};_0x184d38['model']=_[_0x03ae('0x23')](db[_0x03ae('0x1d')][_0x03ae('0x1e')]);_0x184d38['query']=_[_0x03ae('0x23')](_0x52db40[_0x03ae('0x22')]);_0x184d38[_0x03ae('0x24')]=_['intersection'](_0x184d38['model'],_0x184d38[_0x03ae('0x22')]);_0x5d07da[_0x03ae('0x26')]=_[_0x03ae('0x25')](_0x184d38['model'],qs[_0x03ae('0x27')](_0x52db40[_0x03ae('0x22')][_0x03ae('0x27')]));_0x5d07da[_0x03ae('0x26')]=_0x5d07da[_0x03ae('0x26')][_0x03ae('0x3b')]?_0x5d07da['attributes']:_0x184d38['model'];if(_0x52db40[_0x03ae('0x22')][_0x03ae('0x31')]){_0x5d07da['include']=[{'all':!![]}];}_0x5d07da=_[_0x03ae('0x2d')]({},_0x5d07da,_0x52db40[_0x03ae('0x30')]);return db['CloudProvider']['find'](_0x5d07da)[_0x03ae('0x12')](handleEntityNotFound(_0x29c6be,null))[_0x03ae('0x12')](function(_0x15787b){if(_0x15787b[_0x03ae('0x35')]===_0x03ae('0x36')){var _0x3e65dc=encryptor[_0x03ae('0x37')](_0x15787b[_0x03ae('0x38')]);_0x15787b[_0x03ae('0x38')]=maskClientSecret(_0x3e65dc);}return _0x15787b;})[_0x03ae('0x12')](respondWithResult(_0x29c6be,null))[_0x03ae('0x39')](handleError(_0x29c6be,null));};exports[_0x03ae('0x3c')]=function(_0x2a72ef,_0x388220){if(!_0x2a72ef['body']['name'])throw new Error(_0x03ae('0x3d'));if(!_0x2a72ef[_0x03ae('0x3e')][_0x03ae('0x35')])throw new Error(_0x03ae('0x3f'));var _0x594031=db['CloudProvider'][_0x03ae('0x1e')]['service'][_0x03ae('0x40')];if(!_0x594031['includes'](_0x2a72ef[_0x03ae('0x3e')][_0x03ae('0x35')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x594031['join'](',\x20'));if(_0x2a72ef[_0x03ae('0x3e')][_0x03ae('0x35')]==='MicrosoftAzure'&&_0x2a72ef['body'][_0x03ae('0x38')]){_0x2a72ef['body'][_0x03ae('0x38')]=encryptor['encryptString'](_0x2a72ef[_0x03ae('0x3e')][_0x03ae('0x38')]);}return db[_0x03ae('0x1d')][_0x03ae('0x3c')](_0x2a72ef['body'],{})['then'](respondWithResult(_0x388220,0xc9))[_0x03ae('0x39')](handleError(_0x388220,null));};exports[_0x03ae('0x11')]=function(_0x5cc266,_0x55463c){if(_0x5cc266[_0x03ae('0x3e')]['id']){delete _0x5cc266[_0x03ae('0x3e')]['id'];}return db[_0x03ae('0x1d')][_0x03ae('0x41')]({'where':{'id':_0x5cc266[_0x03ae('0x3a')]['id']}})['then'](handleEntityNotFound(_0x55463c,null))[_0x03ae('0x12')](function(_0xbca63d){if(_0xbca63d[_0x03ae('0x35')]===_0x03ae('0x36')&&_0x5cc266[_0x03ae('0x3e')]['data3']){_0x5cc266['body'][_0x03ae('0x38')]=encryptor[_0x03ae('0x42')](_0x5cc266[_0x03ae('0x3e')][_0x03ae('0x38')]);}return _0xbca63d;})[_0x03ae('0x12')](saveUpdates(_0x5cc266['body'],null))['then'](respondWithResult(_0x55463c,null))[_0x03ae('0x39')](handleError(_0x55463c,null));};exports[_0x03ae('0x13')]=function(_0x3d5eb7,_0x5e987f){return db[_0x03ae('0x1d')]['find']({'where':{'id':_0x3d5eb7[_0x03ae('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5e987f,null))['then'](removeEntity(_0x5e987f,null))[_0x03ae('0x39')](handleError(_0x5e987f,null));};exports[_0x03ae('0x43')]=function(_0x35ae87,_0x34151f){return db[_0x03ae('0x1d')][_0x03ae('0x44')]({'where':{'id':_0x35ae87[_0x03ae('0x3a')]['id']},'raw':!![]})[_0x03ae('0x12')](function(_0x51f4c0){if(!_0x51f4c0)return _0x34151f[_0x03ae('0x15')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x51f4c0,_0x35ae87[_0x03ae('0x45')]['id'])};})['then'](respondWithResult(_0x34151f,null))[_0x03ae('0x39')](handleError(_0x34151f,null));};exports[_0x03ae('0x46')]=function(_0x1b2139,_0x564a1c){var _0x4cadb9=_0x1b2139[_0x03ae('0x3e')];var _0x32188d;var _0x1ea4b8;if(_0x4cadb9[_0x03ae('0x16')])throw _0x4cadb9;redis[_0x03ae('0x47')](_0x4cadb9['state'])['then'](function(_0x38ffbb){if(!_0x38ffbb)throw new Error('Invalid\x20state\x20parameter');_0x32188d=JSON[_0x03ae('0x48')](_0x38ffbb);var _0x467f4a=Buffer[_0x03ae('0x49')](_0x4cadb9[_0x03ae('0x4a')],_0x03ae('0x4b'))[_0x03ae('0x4c')](_0x03ae('0x4d'));_0x1ea4b8=JSON['parse'](_0x467f4a);if(!oauth[_0x03ae('0x4e')](_0x4cadb9['id_token'],_0x32188d[_0x03ae('0x4f')]))throw new Error(_0x03ae('0x50'));redis[_0x03ae('0x51')](_0x4cadb9['state']);return oauth[_0x03ae('0x52')](_0x4cadb9[_0x03ae('0x53')],_0x32188d);})['then'](function(_0x49b5e5){_0x32188d[_0x03ae('0x54')]=_0x49b5e5['access_token'];_0x32188d[_0x03ae('0x55')]=_0x49b5e5[_0x03ae('0x56')];return db[_0x03ae('0x1d')][_0x03ae('0x11')]({'data5':_0x32188d[_0x03ae('0x54')],'data6':_0x32188d[_0x03ae('0x55')]},{'where':{'id':_0x32188d['id']}});})['then'](function(){oauth[_0x03ae('0x57')](_0x32188d);socket[_0x03ae('0x58')](_0x03ae('0x59'),{'id':_0x1ea4b8['id']});return;})[_0x03ae('0x12')](respondWithStatusCode(_0x564a1c,null))['catch'](function(_0x14f1cf){if(_0x1ea4b8){socket['emit'](_0x03ae('0x5a'),{'id':_0x1ea4b8['id']});}if(!_0x32188d){logger[_0x03ae('0x16')](_0x03ae('0x5b'),_0x14f1cf);return _0x564a1c['status'](0x1f4)[_0x03ae('0x18')](_0x14f1cf[_0x03ae('0x5c')]);}logger[_0x03ae('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x32188d['id'],JSON[_0x03ae('0x5d')](_0x14f1cf));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 82c8ece..eb8ac64 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 _0x9cac=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x11af81,_0x3d1a99){var _0x367dc6=function(_0x34370a){while(--_0x34370a){_0x11af81['push'](_0x11af81['shift']());}};_0x367dc6(++_0x3d1a99);}(_0x9cac,0x18c));var _0xc9ca=function(_0x487003,_0x57d4b9){_0x487003=_0x487003-0x0;var _0x2503c7=_0x9cac[_0x487003];return _0x2503c7;};'use strict';var _=require(_0xc9ca('0x0'));var util=require(_0xc9ca('0x1'));var logger=require('../../config/logger')(_0xc9ca('0x2'));var moment=require('moment');var BPromise=require(_0xc9ca('0x3'));var rp=require(_0xc9ca('0x4'));var fs=require('fs');var path=require(_0xc9ca('0x5'));var rimraf=require(_0xc9ca('0x6'));var config=require(_0xc9ca('0x7'));var attributes=require(_0xc9ca('0x8'));module[_0xc9ca('0x9')]=function(_0x5911ff,_0x4abb34){return _0x5911ff[_0xc9ca('0xa')](_0xc9ca('0xb'),attributes,{'tableName':_0xc9ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0b=['moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','lodash','util','../../config/logger','api'];(function(_0x2262bf,_0xd7cf1){var _0x5115cc=function(_0x18e1f9){while(--_0x18e1f9){_0x2262bf['push'](_0x2262bf['shift']());}};_0x5115cc(++_0xd7cf1);}(_0x0b0b,0x128));var _0xb0b0=function(_0xdfd280,_0x17f746){_0xdfd280=_0xdfd280-0x0;var _0x1c5d8f=_0x0b0b[_0xdfd280];return _0x1c5d8f;};'use strict';var _=require(_0xb0b0('0x0'));var util=require(_0xb0b0('0x1'));var logger=require(_0xb0b0('0x2'))(_0xb0b0('0x3'));var moment=require(_0xb0b0('0x4'));var BPromise=require(_0xb0b0('0x5'));var rp=require(_0xb0b0('0x6'));var fs=require('fs');var path=require(_0xb0b0('0x7'));var rimraf=require('rimraf');var config=require(_0xb0b0('0x8'));var attributes=require(_0xb0b0('0x9'));module[_0xb0b0('0xa')]=function(_0x565baa,_0x48de74){return _0x565baa['define'](_0xb0b0('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 7c8311c..aa40339 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 _0x4cdd=['isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}','access_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','type','Dynamics365','/.default','join','data7','replace','data2','code','from','stringify','toString','base64','client_id','data1','response_type','data4','response_mode','form_post','scope','state','nonce','prompt','map','value','oauth2Claims','decode','payload','iss','issuer'];(function(_0x4e8cf3,_0x59b5f9){var _0x2c1fa1=function(_0x1f0d95){while(--_0x1f0d95){_0x4e8cf3['push'](_0x4e8cf3['shift']());}};_0x2c1fa1(++_0x59b5f9);}(_0x4cdd,0x1dc));var _0xd4cd=function(_0x2462ba,_0x5f0261){_0x2462ba=_0x2462ba-0x0;var _0xefe16a=_0x4cdd[_0x2462ba];return _0xefe16a;};'use strict';var _=require('lodash');var crypto=require(_0xd4cd('0x0'));var jwt=require(_0xd4cd('0x1'));var moment=require(_0xd4cd('0x2'));var Redis=require(_0xd4cd('0x3'));var rp=require('request-promise');var util=require(_0xd4cd('0x4'));var encryptor=require(_0xd4cd('0x5'));var config=require(_0xd4cd('0x6'));var logger=require('../../config/logger')(_0xd4cd('0x7'));var schedule=require(_0xd4cd('0x8'));var db=require(_0xd4cd('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd4cd('0xa'),'port':0x18eb});var redis=new Redis(config[_0xd4cd('0xb')]);var MICROSOFT_AUTH_URL=_0xd4cd('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xd4cd('0xd'),_0xd4cd('0xe'),_0xd4cd('0xf'),'offline_access',_0xd4cd('0x10'),_0xd4cd('0x11'),_0xd4cd('0x12')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xd4cd('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x52aeeb){var _0x20370a=_['map'](AZURE_AUTH_SCOPES[_0x52aeeb[_0xd4cd('0x14')]]);if(_0x52aeeb['type']===_0xd4cd('0x15'))_0x20370a['push'](_0x52aeeb['data7']+_0xd4cd('0x16'));return _0x20370a[_0xd4cd('0x17')]('\x20');}function getAccessTokenScope(_0x4555ac){if(_0x4555ac[_0xd4cd('0x14')]==='Outlook365')return _0xd4cd('0x10');if(_0x4555ac['type']==='Dynamics365')return _0x4555ac[_0xd4cd('0x18')]+_0xd4cd('0x16');}function generateMicrosoftAuthorizationUrl(_0x200385,_0x59cd37){var _0xd5c49c=MICROSOFT_AUTH_URL[_0xd4cd('0x19')]('{TENANT_ID}',_0x200385[_0xd4cd('0x1a')]);var _0x541a7b=[_0xd4cd('0x1b'),'id_token'];var _0x42ac09=Buffer[_0xd4cd('0x1c')](JSON[_0xd4cd('0x1d')]({'id':_0x59cd37}))[_0xd4cd('0x1e')](_0xd4cd('0x1f'));var _0x110514=crypto['randomBytes'](0x10)[_0xd4cd('0x1e')]('hex');var _0x6c03b8=getAuthorizationScopes(_0x200385);var _0x538f65=[{'key':_0xd4cd('0x20'),'value':_0x200385[_0xd4cd('0x21')]},{'key':_0xd4cd('0x22'),'value':encodeURIComponent(_0x541a7b[_0xd4cd('0x17')]('\x20'))},{'key':'redirect_uri','value':_0x200385[_0xd4cd('0x23')]},{'key':_0xd4cd('0x24'),'value':_0xd4cd('0x25')},{'key':_0xd4cd('0x26'),'value':encodeURIComponent(_0x6c03b8)},{'key':_0xd4cd('0x27'),'value':_0x42ac09},{'key':_0xd4cd('0x28'),'value':_0x110514},{'key':_0xd4cd('0x29'),'value':'login'}];var _0xe0029c=_0xd5c49c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xd4cd('0x2a')](_0x538f65,function(_0x43f548){return _0x43f548['key']+'='+_0x43f548[_0xd4cd('0x2b')];})[_0xd4cd('0x17')]('&');_0x200385[_0xd4cd('0x2c')]={'issuer':_0xd5c49c[_0xd4cd('0x19')]('oauth2/',''),'audience':_0x200385['data1'],'state':_0x42ac09,'nonce':_0x110514};redis['set'](_0x42ac09,JSON[_0xd4cd('0x1d')](_0x200385));return _0xe0029c;}function isValidIdToken(_0x3b4757,_0x40c033){try{var _0x11f3ae=jwt[_0xd4cd('0x2d')](_0x3b4757,{'complete':!![]});var _0x4c138c=_0x11f3ae[_0xd4cd('0x2e')];if(_0x4c138c[_0xd4cd('0x2f')]!==_0x40c033[_0xd4cd('0x30')])return![];if(_0x4c138c['aud']!==_0x40c033['audience'])return![];if(_0x4c138c[_0xd4cd('0x28')]!==_0x40c033[_0xd4cd('0x28')])return![];if(moment()[_0xd4cd('0x31')](moment[_0xd4cd('0x32')](_0x4c138c[_0xd4cd('0x33')])))return![];return!![];}catch(_0x257ac0){throw _0x257ac0;}}function refreshOauth2MicrosoftAccessToken(_0xab2ec9){return Promise[_0xd4cd('0x34')]()[_0xd4cd('0x35')](function(){if(_0xab2ec9[_0xd4cd('0x36')])return _0xab2ec9;return db[_0xd4cd('0x37')][_0xd4cd('0x38')]({'where':{'id':_0xab2ec9['id']},'raw':!![]});})[_0xd4cd('0x35')](function(_0x56a237){var _0x1fdce8={'grant_type':_0xd4cd('0x39'),'refresh_token':_0x56a237[_0xd4cd('0x3a')],'scope':getAccessTokenScope(_0x56a237),'redirect_uri':_0x56a237[_0xd4cd('0x23')],'client_id':_0x56a237['data1'],'client_secret':encryptor[_0xd4cd('0x3b')](_0x56a237[_0xd4cd('0x36')])};var _0x4b8cfb={'method':_0xd4cd('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xd4cd('0x19')](_0xd4cd('0x3d'),_0x56a237['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1fdce8,'json':!![]};return rp(_0x4b8cfb);})[_0xd4cd('0x35')](function(_0x491d45){_0xab2ec9['data5']=_0x491d45[_0xd4cd('0x3e')];_0xab2ec9['data6']=_0x491d45[_0xd4cd('0x39')];return db[_0xd4cd('0x37')][_0xd4cd('0x3f')]({'data5':_0xab2ec9[_0xd4cd('0x40')],'data6':_0xab2ec9[_0xd4cd('0x3a')]},{'where':{'id':_0xab2ec9['id']}});})['then'](function(){return _0xab2ec9;})[_0xd4cd('0x41')](function(_0x4a98c2){logger[_0xd4cd('0x42')](_0xd4cd('0x43'),_0xab2ec9['id'],_0x4a98c2);});}function getOauth2MicrosoftAccessToken(_0x2f88a5,_0x4a27e4){var _0x45cc49={'grant_type':_0xd4cd('0x44'),'code':_0x2f88a5,'scope':getAccessTokenScope(_0x4a27e4),'redirect_uri':_0x4a27e4[_0xd4cd('0x23')],'client_id':_0x4a27e4[_0xd4cd('0x21')],'client_secret':encryptor['decryptString'](_0x4a27e4['data3'])};var _0x1739b3={'method':_0xd4cd('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xd4cd('0x19')]('{TENANT_ID}',_0x4a27e4['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x45cc49,'json':!![]};return rp(_0x1739b3);}function startRefreshInterval(_0x59667f){var _0x4a120e=schedule[_0xd4cd('0x45')];if(_0x4a120e[_0x59667f['id']])clearInterval(_0x4a120e[_0x59667f['id']]);_0x4a120e[_0x59667f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xd4cd('0x46')](this,{'id':_0x59667f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4a120e;}function startAllRefreshIntervals(){return db[_0xd4cd('0x37')][_0xd4cd('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x3ab22c){var _0x58104b=_0x3ab22c[_0xd4cd('0x2a')](function(_0x2667b4){return refreshOauth2MicrosoftAccessToken(_0x2667b4)[_0xd4cd('0x35')](function(_0x2c42df){startRefreshInterval(_0x2c42df);});});return Promise[_0xd4cd('0x48')](_0x58104b);})[_0xd4cd('0x41')](function(_0xdc926){var _0x21cdfb=_0xdc926?util['inspect'](_0xdc926,{'showHidden':![],'depth':null}):'';logger['error'](_0xd4cd('0x49'),_0x21cdfb);});}module[_0xd4cd('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x1a1a=['openid','profile','https://outlook.office.com/SMTP.Send','offline_access','/authorize','map','type','Dynamics365','push','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','/.default','{TENANT_ID}','data2','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','set','decode','payload','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','decryptString','POST','data5','access_token','data6','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','bind','findAll','all','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','localhost'];(function(_0x1f99cc,_0x35138a){var _0x4e9c75=function(_0x41a9c9){while(--_0x41a9c9){_0x1f99cc['push'](_0x1f99cc['shift']());}};_0x4e9c75(++_0x35138a);}(_0x1a1a,0x12e));var _0xa1a1=function(_0x4d1631,_0x416231){_0x4d1631=_0x4d1631-0x0;var _0x3538a2=_0x1a1a[_0x4d1631];return _0x3538a2;};'use strict';var _=require(_0xa1a1('0x0'));var crypto=require(_0xa1a1('0x1'));var jwt=require(_0xa1a1('0x2'));var moment=require(_0xa1a1('0x3'));var Redis=require(_0xa1a1('0x4'));var rp=require(_0xa1a1('0x5'));var util=require(_0xa1a1('0x6'));var encryptor=require(_0xa1a1('0x7'));var config=require('../../config/environment');var logger=require(_0xa1a1('0x8'))(_0xa1a1('0x9'));var schedule=require(_0xa1a1('0xa'));var db=require('../../mysqldb')['db'];config[_0xa1a1('0xb')]=_[_0xa1a1('0xc')](config[_0xa1a1('0xb')],{'host':_0xa1a1('0xd'),'port':0x18eb});var redis=new Redis(config[_0xa1a1('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xa1a1('0xe'),_0xa1a1('0xf'),'email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0xa1a1('0x10')],'Dynamics365':[_0xa1a1('0xe'),_0xa1a1('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xa1a1('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x575e54){var _0x122261=_[_0xa1a1('0x13')](AZURE_AUTH_SCOPES[_0x575e54['type']]);if(_0x575e54[_0xa1a1('0x14')]===_0xa1a1('0x15'))_0x122261[_0xa1a1('0x16')](_0x575e54['data7']+'/.default');return _0x122261[_0xa1a1('0x17')]('\x20');}function getAccessTokenScope(_0x3fa648){if(_0x3fa648[_0xa1a1('0x14')]===_0xa1a1('0x18'))return _0xa1a1('0x19');if(_0x3fa648['type']===_0xa1a1('0x15'))return _0x3fa648['data7']+_0xa1a1('0x1a');}function generateMicrosoftAuthorizationUrl(_0x425543,_0x4b1a54){var _0x343949=MICROSOFT_AUTH_URL['replace'](_0xa1a1('0x1b'),_0x425543[_0xa1a1('0x1c')]);var _0x40f400=['code','id_token'];var _0x423d5=Buffer[_0xa1a1('0x1d')](JSON[_0xa1a1('0x1e')]({'id':_0x4b1a54}))[_0xa1a1('0x1f')](_0xa1a1('0x20'));var _0x2a17d1=crypto[_0xa1a1('0x21')](0x10)['toString'](_0xa1a1('0x22'));var _0x28e0fc=getAuthorizationScopes(_0x425543);var _0x51a283=[{'key':_0xa1a1('0x23'),'value':_0x425543[_0xa1a1('0x24')]},{'key':_0xa1a1('0x25'),'value':encodeURIComponent(_0x40f400[_0xa1a1('0x17')]('\x20'))},{'key':_0xa1a1('0x26'),'value':_0x425543[_0xa1a1('0x27')]},{'key':_0xa1a1('0x28'),'value':_0xa1a1('0x29')},{'key':'scope','value':encodeURIComponent(_0x28e0fc)},{'key':_0xa1a1('0x2a'),'value':_0x423d5},{'key':_0xa1a1('0x2b'),'value':_0x2a17d1},{'key':_0xa1a1('0x2c'),'value':_0xa1a1('0x2d')}];var _0x5861f5=_0x343949+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa1a1('0x13')](_0x51a283,function(_0x4f6c33){return _0x4f6c33[_0xa1a1('0x2e')]+'='+_0x4f6c33[_0xa1a1('0x2f')];})[_0xa1a1('0x17')]('&');_0x425543[_0xa1a1('0x30')]={'issuer':_0x343949[_0xa1a1('0x31')](_0xa1a1('0x32'),''),'audience':_0x425543[_0xa1a1('0x24')],'state':_0x423d5,'nonce':_0x2a17d1};redis[_0xa1a1('0x33')](_0x423d5,JSON[_0xa1a1('0x1e')](_0x425543));return _0x5861f5;}function isValidIdToken(_0x44670b,_0x3c7134){try{var _0x334bfd=jwt[_0xa1a1('0x34')](_0x44670b,{'complete':!![]});var _0x3ac40b=_0x334bfd[_0xa1a1('0x35')];if(_0x3ac40b['iss']!==_0x3c7134[_0xa1a1('0x36')])return![];if(_0x3ac40b[_0xa1a1('0x37')]!==_0x3c7134[_0xa1a1('0x38')])return![];if(_0x3ac40b['nonce']!==_0x3c7134[_0xa1a1('0x2b')])return![];if(moment()[_0xa1a1('0x39')](moment[_0xa1a1('0x3a')](_0x3ac40b[_0xa1a1('0x3b')])))return![];return!![];}catch(_0x1ba598){throw _0x1ba598;}}function refreshOauth2MicrosoftAccessToken(_0x5e5ab3){return Promise[_0xa1a1('0x3c')]()[_0xa1a1('0x3d')](function(){if(_0x5e5ab3[_0xa1a1('0x3e')])return _0x5e5ab3;return db[_0xa1a1('0x3f')][_0xa1a1('0x40')]({'where':{'id':_0x5e5ab3['id']},'raw':!![]});})[_0xa1a1('0x3d')](function(_0x324070){var _0x37aa2f={'grant_type':_0xa1a1('0x41'),'refresh_token':_0x324070['data6'],'scope':getAccessTokenScope(_0x324070),'redirect_uri':_0x324070[_0xa1a1('0x27')],'client_id':_0x324070[_0xa1a1('0x24')],'client_secret':encryptor[_0xa1a1('0x42')](_0x324070[_0xa1a1('0x3e')])};var _0x316aa5={'method':_0xa1a1('0x43'),'uri':MICROSOFT_AUTH_URL[_0xa1a1('0x31')](_0xa1a1('0x1b'),_0x324070[_0xa1a1('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x37aa2f,'json':!![]};return rp(_0x316aa5);})[_0xa1a1('0x3d')](function(_0xecb709){_0x5e5ab3[_0xa1a1('0x44')]=_0xecb709[_0xa1a1('0x45')];_0x5e5ab3[_0xa1a1('0x46')]=_0xecb709[_0xa1a1('0x41')];return db[_0xa1a1('0x3f')][_0xa1a1('0x47')]({'data5':_0x5e5ab3[_0xa1a1('0x44')],'data6':_0x5e5ab3[_0xa1a1('0x46')]},{'where':{'id':_0x5e5ab3['id']}});})['then'](function(){return _0x5e5ab3;})[_0xa1a1('0x48')](function(_0x4a605f){logger[_0xa1a1('0x49')](_0xa1a1('0x4a'),_0x5e5ab3['id'],_0x4a605f);});}function getOauth2MicrosoftAccessToken(_0x422163,_0x5eb82c){var _0x2e5a48={'grant_type':'authorization_code','code':_0x422163,'scope':getAccessTokenScope(_0x5eb82c),'redirect_uri':_0x5eb82c['data4'],'client_id':_0x5eb82c[_0xa1a1('0x24')],'client_secret':encryptor[_0xa1a1('0x42')](_0x5eb82c['data3'])};var _0x12aec2={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xa1a1('0x1b'),_0x5eb82c[_0xa1a1('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2e5a48,'json':!![]};return rp(_0x12aec2);}function startRefreshInterval(_0x3c910b){var _0x5ee4b1=schedule['intervals'];if(_0x5ee4b1[_0x3c910b['id']])clearInterval(_0x5ee4b1[_0x3c910b['id']]);_0x5ee4b1[_0x3c910b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa1a1('0x4b')](this,{'id':_0x3c910b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5ee4b1;}function startAllRefreshIntervals(){return db[_0xa1a1('0x3f')][_0xa1a1('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa1a1('0x3d')](function(_0x3f6df7){var _0x452aba=_0x3f6df7[_0xa1a1('0x13')](function(_0x26aaae){return refreshOauth2MicrosoftAccessToken(_0x26aaae)[_0xa1a1('0x3d')](function(_0x289f70){startRefreshInterval(_0x289f70);});});return Promise[_0xa1a1('0x4d')](_0x452aba);})['catch'](function(_0x5507fe){var _0x70c3d6=_0x5507fe?util['inspect'](_0x5507fe,{'showHidden':![],'depth':null}):'';logger[_0xa1a1('0x49')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x70c3d6);});}module[_0xa1a1('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index fd58744..cc32fb6 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 _0x5360=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result'];(function(_0x377434,_0x49e358){var _0x2282bd=function(_0xa92e0b){while(--_0xa92e0b){_0x377434['push'](_0x377434['shift']());}};_0x2282bd(++_0x49e358);}(_0x5360,0x157));var _0x0536=function(_0x5b8731,_0x4b677a){_0x5b8731=_0x5b8731-0x0;var _0x34382e=_0x5360[_0x5b8731];return _0x34382e;};'use strict';var _=require(_0x0536('0x0'));var util=require(_0x0536('0x1'));var moment=require(_0x0536('0x2'));var BPromise=require(_0x0536('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0536('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0536('0x5'))(_0x0536('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19c89e,_0x1122a2,_0x27cac6){return new BPromise(function(_0x4974ad,_0x180b94){return client[_0x0536('0x8')](_0x19c89e,_0x27cac6)[_0x0536('0x9')](function(_0x5b78e2){logger[_0x0536('0xa')]('CloudProvider,\x20%s,\x20%s',_0x1122a2,'request\x20sent');logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1122a2,_0x0536('0xb'),JSON[_0x0536('0xc')](_0x5b78e2));if(_0x5b78e2[_0x0536('0xd')]){if(_0x5b78e2[_0x0536('0xd')][_0x0536('0xe')]===0x1f4){logger[_0x0536('0xd')](_0x0536('0xf'),_0x1122a2,_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);return _0x180b94(_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);}logger[_0x0536('0xd')](_0x0536('0xf'),_0x1122a2,_0x5b78e2['error'][_0x0536('0x10')]);return _0x4974ad(_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);}else{logger[_0x0536('0xa')](_0x0536('0xf'),_0x1122a2,'request\x20sent');_0x4974ad(_0x5b78e2[_0x0536('0x11')][_0x0536('0x10')]);}})[_0x0536('0x12')](function(_0x1ff4f9){logger['error']('CloudProvider,\x20%s,\x20%s',_0x1122a2,_0x1ff4f9);_0x180b94(_0x1ff4f9);});});} \ No newline at end of file +var _0xd5a2=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0xa48ac5,_0xde975d){var _0x1e1d7a=function(_0x529efa){while(--_0x529efa){_0xa48ac5['push'](_0xa48ac5['shift']());}};_0x1e1d7a(++_0xde975d);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x568c2c,_0x366739){_0x568c2c=_0x568c2c-0x0;var _0x465923=_0xd5a2[_0x568c2c];return _0x465923;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var moment=require(_0x2d5a('0x1'));var BPromise=require(_0x2d5a('0x2'));var rs=require(_0x2d5a('0x3'));var fs=require('fs');var Redis=require(_0x2d5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d5a('0x5'));var logger=require(_0x2d5a('0x6'))(_0x2d5a('0x7'));var config=require(_0x2d5a('0x8'));var jayson=require(_0x2d5a('0x9'));var client=jayson[_0x2d5a('0xa')][_0x2d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae103,_0x1cdfc4,_0x7eb4c3){return new BPromise(function(_0x79898c,_0x4d5c52){return client['request'](_0x1ae103,_0x7eb4c3)[_0x2d5a('0xc')](function(_0x562b6a){logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,'request\x20sent');logger[_0x2d5a('0xf')](_0x2d5a('0x10'),_0x1cdfc4,_0x2d5a('0x11'),JSON[_0x2d5a('0x12')](_0x562b6a));if(_0x562b6a[_0x2d5a('0x13')]){if(_0x562b6a['error'][_0x2d5a('0x14')]===0x1f4){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x4d5c52(_0x562b6a['error'][_0x2d5a('0x15')]);}logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x79898c(_0x562b6a[_0x2d5a('0x13')][_0x2d5a('0x15')]);}else{logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,_0x2d5a('0x11'));_0x79898c(_0x562b6a['result'][_0x2d5a('0x15')]);}})[_0x2d5a('0x16')](function(_0x38de62){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x38de62);_0x4d5c52(_0x38de62);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a279b36..6c31f98 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x1261,0x144));var _0x1126=function(_0x5b086e,_0x5eb6c0){_0x5b086e=_0x5b086e-0x0;var _0x3e2c2c=_0x1261[_0x5b086e];return _0x3e2c2c;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x199cc7,_0x5bace6){var _0x3fcea6=function(_0x444685){while(--_0x444685){_0x199cc7['push'](_0x199cc7['shift']());}};_0x3fcea6(++_0x5bace6);}(_0xadb5,0xad));var _0x5adb=function(_0x19e1d7,_0x2be996){_0x19e1d7=_0x19e1d7-0x0;var _0x41db5f=_0xadb5[_0x19e1d7];return _0x41db5f;};'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['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8bd2a6e..f8655ba 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 _0xd5cd=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5cd,0x7e));var _0xdd5c=function(_0xaec54f,_0x2a794d){_0xaec54f=_0xaec54f-0x0;var _0x4c4cb1=_0xd5cd[_0xaec54f];return _0x4c4cb1;};'use strict';var Sequelize=require(_0xdd5c('0x0'));module[_0xdd5c('0x1')]={'name':{'type':Sequelize[_0xdd5c('0x2')],'unique':_0xdd5c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xdd5c('0x2')]},'companyId':{'type':Sequelize[_0xdd5c('0x2')]},'website':{'type':Sequelize[_0xdd5c('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xdd5c('0x2')]},'type':{'type':Sequelize[_0xdd5c('0x2')]},'street':{'type':Sequelize[_0xdd5c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xdd5c('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdd5c('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xdd5c('0x2')]},'sStreet':{'type':Sequelize[_0xdd5c('0x2')]},'sPostalCode':{'type':Sequelize[_0xdd5c('0x2')]},'sCity':{'type':Sequelize[_0xdd5c('0x2')]},'sCountry':{'type':Sequelize[_0xdd5c('0x2')]},'description':{'type':Sequelize[_0xdd5c('0x2')]}}; \ No newline at end of file +var _0x49e9=['exports','STRING','name'];(function(_0x1fd2e6,_0x319411){var _0x38284b=function(_0x220170){while(--_0x220170){_0x1fd2e6['push'](_0x1fd2e6['shift']());}};_0x38284b(++_0x319411);}(_0x49e9,0x1cb));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x949e('0x0')]={'name':{'type':Sequelize[_0x949e('0x1')],'unique':_0x949e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x949e('0x1')]},'companyId':{'type':Sequelize[_0x949e('0x1')]},'website':{'type':Sequelize[_0x949e('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x949e('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x949e('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x949e('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x949e('0x1')]},'sStreet':{'type':Sequelize[_0x949e('0x1')]},'sPostalCode':{'type':Sequelize[_0x949e('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x949e('0x1')]},'description':{'type':Sequelize[_0x949e('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f17fbc2..0727310 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 _0xa423=['rawAttributes','intersection','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addContacts','CmContact','omit','getContacts','findOne','sort','filters','eml-format','zip-dir','fast-json-patch','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','map','merge','options','includeAll','include','rows','catch','show'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0xa423,0x68));var _0x3a42=function(_0x10f5ea,_0xeb348a){_0x10f5ea=_0x10f5ea-0x0;var _0x5c4f0f=_0xa423[_0x10f5ea];return _0x5c4f0f;};'use strict';var emlformat=require(_0x3a42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a42('0x1'));var jsonpatch=require(_0x3a42('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3a42('0x3'));var Mustache=require(_0x3a42('0x4'));var util=require(_0x3a42('0x5'));var path=require(_0x3a42('0x6'));var sox=require(_0x3a42('0x7'));var csv=require(_0x3a42('0x8'));var ejs=require(_0x3a42('0x9'));var fs=require('fs');var fs_extra=require(_0x3a42('0xa'));var _=require(_0x3a42('0xb'));var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3a42('0xe'));var toCsv=require(_0x3a42('0x8'));var querystring=require(_0x3a42('0xf'));var Papa=require(_0x3a42('0x10'));var Redis=require('ioredis');var authService=require(_0x3a42('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a42('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x13'))(_0x3a42('0x14'));var utils=require(_0x3a42('0x15'));var config=require(_0x3a42('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a42('0x17'))['db'];function respondWithStatusCode(_0x201be3,_0x44ce86){_0x44ce86=_0x44ce86||0xcc;return function(_0x95b304){if(_0x95b304){return _0x201be3[_0x3a42('0x18')](_0x44ce86);}return _0x201be3[_0x3a42('0x19')](_0x44ce86)[_0x3a42('0x1a')]();};}function respondWithResult(_0x160dd6,_0x4c6734){_0x4c6734=_0x4c6734||0xc8;return function(_0x1e16c1){if(_0x1e16c1){return _0x160dd6[_0x3a42('0x19')](_0x4c6734)[_0x3a42('0x1b')](_0x1e16c1);}};}function respondWithFilteredResult(_0x1e9083,_0x5b5360){return function(_0x4c07d6){if(_0x4c07d6){var _0x3de11e=typeof _0x5b5360[_0x3a42('0x1c')]===_0x3a42('0x1d')&&typeof _0x5b5360[_0x3a42('0x1e')]==='undefined';var _0x1aa2c9=_0x4c07d6['count'];var _0x1b8b58=_0x3de11e?0x0:_0x5b5360['offset'];var _0x307ece=_0x3de11e?_0x4c07d6[_0x3a42('0x1f')]:_0x5b5360['offset']+_0x5b5360['limit'];var _0x195947;if(_0x307ece>=_0x1aa2c9){_0x307ece=_0x1aa2c9;_0x195947=0xc8;}else{_0x195947=0xce;}_0x1e9083[_0x3a42('0x19')](_0x195947);return _0x1e9083[_0x3a42('0x20')]('Content-Range',_0x1b8b58+'-'+_0x307ece+'/'+_0x1aa2c9)[_0x3a42('0x1b')](_0x4c07d6);}return null;};}function patchUpdates(_0x46f346){return function(_0x2d2503){try{jsonpatch[_0x3a42('0x21')](_0x2d2503,_0x46f346,!![]);}catch(_0x5ba57c){return BPromise['reject'](_0x5ba57c);}return _0x2d2503[_0x3a42('0x22')]();};}function saveUpdates(_0x289dac,_0x4821f9){return function(_0x529994){if(_0x529994){return _0x529994['update'](_0x289dac)[_0x3a42('0x23')](function(_0x5ca5c){return _0x5ca5c;});}return null;};}function removeEntity(_0x52c626,_0x3df28e){return function(_0x320761){if(_0x320761){return _0x320761[_0x3a42('0x24')]()[_0x3a42('0x23')](function(){var _0x317461=_0x320761[_0x3a42('0x25')]({'plain':!![]});var _0x147f3d=_0x3a42('0x26');return db[_0x3a42('0x27')][_0x3a42('0x24')]({'where':{'type':_0x147f3d,'resourceId':_0x317461['id']}})[_0x3a42('0x23')](function(){return _0x320761;});})[_0x3a42('0x23')](function(){_0x52c626[_0x3a42('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14ea60,_0x2c8255){return function(_0x2c3e6b){if(!_0x2c3e6b){_0x14ea60[_0x3a42('0x18')](0x194);}return _0x2c3e6b;};}function handleError(_0x4d785c,_0x159a04){_0x159a04=_0x159a04||0x1f4;return function(_0x49caac){logger[_0x3a42('0x28')](_0x49caac[_0x3a42('0x29')]);if(_0x49caac[_0x3a42('0x2a')]){delete _0x49caac[_0x3a42('0x2a')];}_0x4d785c[_0x3a42('0x19')](_0x159a04)[_0x3a42('0x2b')](_0x49caac);};}exports[_0x3a42('0x2c')]=function(_0x2a5fbd,_0x32016f){var _0x4c5ac5={},_0xc0023c={},_0x2add60={'count':0x0,'rows':[]};return db[_0x3a42('0x2d')][_0x3a42('0x2e')]()[_0x3a42('0x23')](function(_0x5e1777){_0xc0023c[_0x3a42('0x2f')]=_[_0x3a42('0x30')](_0x5e1777);_0xc0023c[_0x3a42('0x31')]=_[_0x3a42('0x30')](_0x2a5fbd['query']);_0xc0023c['filters']=_['intersection'](_0xc0023c[_0x3a42('0x2f')],_0xc0023c['query']);_0x4c5ac5[_0x3a42('0x32')]=_['intersection'](_0xc0023c[_0x3a42('0x2f')],qs[_0x3a42('0x33')](_0x2a5fbd[_0x3a42('0x31')]['fields']));_0x4c5ac5['attributes']=_0x4c5ac5[_0x3a42('0x32')][_0x3a42('0x34')]?_0x4c5ac5['attributes']:_0xc0023c[_0x3a42('0x2f')];if(!_0x2a5fbd['query'][_0x3a42('0x35')](_0x3a42('0x36'))){_0x4c5ac5['limit']=qs[_0x3a42('0x1e')](_0x2a5fbd[_0x3a42('0x31')]['limit']);_0x4c5ac5[_0x3a42('0x1c')]=qs[_0x3a42('0x1c')](_0x2a5fbd[_0x3a42('0x31')][_0x3a42('0x1c')]);}_0x4c5ac5['order']=qs['sort'](_0x2a5fbd[_0x3a42('0x31')]['sort']);_0x4c5ac5[_0x3a42('0x37')]=qs['filters'](_[_0x3a42('0x38')](_0x2a5fbd[_0x3a42('0x31')],_0xc0023c['filters']),_0x5e1777);if(_0x2a5fbd[_0x3a42('0x31')][_0x3a42('0x39')]){_0x4c5ac5['where']=_['merge'](_0x4c5ac5[_0x3a42('0x37')],{'$or':_[_0x3a42('0x3a')](_0x4c5ac5[_0x3a42('0x32')],function(_0x4cd4d8){var _0x4d2a66={};_0x4d2a66[_0x4cd4d8]={'$like':'%'+_0x2a5fbd[_0x3a42('0x31')][_0x3a42('0x39')]+'%'};return _0x4d2a66;})});}_0x4c5ac5=_[_0x3a42('0x3b')]({},_0x4c5ac5,_0x2a5fbd[_0x3a42('0x3c')]);var _0x5459d0={'where':_0x4c5ac5[_0x3a42('0x37')]};return db['CmCompany'][_0x3a42('0x1f')](_0x5459d0)[_0x3a42('0x23')](function(_0x22736e){_0x2add60[_0x3a42('0x1f')]=_0x22736e;if(_0x2a5fbd[_0x3a42('0x31')][_0x3a42('0x3d')]){_0x4c5ac5[_0x3a42('0x3e')]=[{'all':!![]}];}return db[_0x3a42('0x2d')]['findAll'](_0x4c5ac5);})[_0x3a42('0x23')](function(_0xe16dc7){_0x2add60[_0x3a42('0x3f')]=_0xe16dc7;return _0x2add60;})[_0x3a42('0x23')](respondWithFilteredResult(_0x32016f,_0x4c5ac5))[_0x3a42('0x40')](handleError(_0x32016f,null));})[_0x3a42('0x40')](handleError(_0x32016f,null));};exports[_0x3a42('0x41')]=function(_0x4207a0,_0x40f0d9){var _0x38dd63={'raw':![],'where':{'id':_0x4207a0['params']['id']}},_0x4a3c5b={};_0x4a3c5b[_0x3a42('0x2f')]=_[_0x3a42('0x30')](db[_0x3a42('0x2d')][_0x3a42('0x42')]);_0x4a3c5b['query']=_[_0x3a42('0x30')](_0x4207a0[_0x3a42('0x31')]);_0x4a3c5b['filters']=_[_0x3a42('0x43')](_0x4a3c5b[_0x3a42('0x2f')],_0x4a3c5b[_0x3a42('0x31')]);_0x38dd63[_0x3a42('0x32')]=_[_0x3a42('0x43')](_0x4a3c5b[_0x3a42('0x2f')],qs[_0x3a42('0x33')](_0x4207a0[_0x3a42('0x31')][_0x3a42('0x33')]));_0x38dd63[_0x3a42('0x32')]=_0x38dd63['attributes'][_0x3a42('0x34')]?_0x38dd63[_0x3a42('0x32')]:_0x4a3c5b[_0x3a42('0x2f')];if(_0x4207a0[_0x3a42('0x31')][_0x3a42('0x3d')]){_0x38dd63[_0x3a42('0x3e')]=[{'all':!![]}];}_0x38dd63=_['merge']({},_0x38dd63,_0x4207a0[_0x3a42('0x3c')]);return db[_0x3a42('0x2d')]['find'](_0x38dd63)[_0x3a42('0x23')](handleEntityNotFound(_0x40f0d9,null))[_0x3a42('0x23')](respondWithResult(_0x40f0d9,null))[_0x3a42('0x40')](handleError(_0x40f0d9,null));};exports['create']=function(_0x324db2,_0x179cf4){return db[_0x3a42('0x2d')][_0x3a42('0x44')](_0x324db2[_0x3a42('0x45')],{})[_0x3a42('0x23')](function(_0x1000f9){var _0x353c6c=_0x324db2[_0x3a42('0x46')][_0x3a42('0x25')]({'plain':!![]});if(!_0x353c6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x353c6c['role']==='user'){var _0x53cf0d=_0x1000f9['get']({'plain':!![]});var _0x3a5687=_0x3a42('0x26');return db[_0x3a42('0x47')][_0x3a42('0x48')]({'where':{'name':_0x3a5687,'userProfileId':_0x353c6c[_0x3a42('0x49')]},'raw':!![]})[_0x3a42('0x23')](function(_0x4f8a7d){if(_0x4f8a7d&&_0x4f8a7d[_0x3a42('0x4a')]===0x0){return db[_0x3a42('0x27')][_0x3a42('0x44')]({'name':_0x53cf0d['name'],'resourceId':_0x53cf0d['id'],'type':_0x4f8a7d[_0x3a42('0x2a')],'sectionId':_0x4f8a7d['id']},{})['then'](function(){return _0x1000f9;});}else{return _0x1000f9;}})[_0x3a42('0x40')](function(_0x8f3c69){logger['error'](_0x3a42('0x4b'),_0x8f3c69);throw _0x8f3c69;});}return _0x1000f9;})[_0x3a42('0x23')](respondWithResult(_0x179cf4,0xc9))[_0x3a42('0x40')](handleError(_0x179cf4,null));};exports[_0x3a42('0x4c')]=function(_0x3030f5,_0x2e217e){if(_0x3030f5[_0x3a42('0x45')]['id']){delete _0x3030f5[_0x3a42('0x45')]['id'];}return db['CmCompany'][_0x3a42('0x48')]({'where':{'id':_0x3030f5[_0x3a42('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e217e,null))['then'](saveUpdates(_0x3030f5['body'],null))[_0x3a42('0x23')](respondWithResult(_0x2e217e,null))[_0x3a42('0x40')](handleError(_0x2e217e,null));};exports[_0x3a42('0x24')]=function(_0x418212,_0x392e77){return db[_0x3a42('0x2d')]['find']({'where':{'id':_0x418212[_0x3a42('0x4d')]['id']}})[_0x3a42('0x23')](handleEntityNotFound(_0x392e77,null))[_0x3a42('0x23')](removeEntity(_0x392e77,null))['catch'](handleError(_0x392e77,null));};exports['describe']=function(_0x3af76b,_0x25b799){return db[_0x3a42('0x2d')][_0x3a42('0x2e')]()[_0x3a42('0x23')](respondWithResult(_0x25b799,null))['catch'](handleError(_0x25b799,null));};exports[_0x3a42('0x4e')]=function(_0x17a63f,_0x2f8b2e,_0x452483){return db[_0x3a42('0x4f')]['find']({'where':{'id':_0x17a63f['params']['id']}})[_0x3a42('0x23')](handleEntityNotFound(_0x2f8b2e,null))[_0x3a42('0x23')](function(_0x39a333){if(_0x39a333){return _0x39a333[_0x3a42('0x4e')](_0x17a63f[_0x3a42('0x45')]['ids'],_[_0x3a42('0x50')](_0x17a63f['body'],['ids','id'])||{});}})[_0x3a42('0x23')](respondWithResult(_0x2f8b2e,null))['catch'](handleError(_0x2f8b2e,null));};exports[_0x3a42('0x51')]=function(_0x5e2383,_0x499f81,_0x13e360){var _0xc91101={};var _0x440b6b={};var _0x41ee80;var _0x12645f;return db[_0x3a42('0x2d')][_0x3a42('0x52')]({'where':{'id':_0x5e2383['params']['id']}})[_0x3a42('0x23')](handleEntityNotFound(_0x499f81,null))[_0x3a42('0x23')](function(_0x166d18){if(_0x166d18){_0x41ee80=_0x166d18;_0x440b6b[_0x3a42('0x2f')]=_[_0x3a42('0x30')](db[_0x3a42('0x4f')][_0x3a42('0x42')]);_0x440b6b[_0x3a42('0x31')]=_['keys'](_0x5e2383[_0x3a42('0x31')]);_0x440b6b['filters']=_[_0x3a42('0x43')](_0x440b6b[_0x3a42('0x2f')],_0x440b6b['query']);_0xc91101['attributes']=_[_0x3a42('0x43')](_0x440b6b[_0x3a42('0x2f')],qs[_0x3a42('0x33')](_0x5e2383[_0x3a42('0x31')][_0x3a42('0x33')]));_0xc91101[_0x3a42('0x32')]=_0xc91101[_0x3a42('0x32')]['length']?_0xc91101[_0x3a42('0x32')]:_0x440b6b['model'];_0xc91101['order']=qs[_0x3a42('0x53')](_0x5e2383[_0x3a42('0x31')][_0x3a42('0x53')]);_0xc91101[_0x3a42('0x37')]=qs[_0x3a42('0x54')](_[_0x3a42('0x38')](_0x5e2383['query'],_0x440b6b[_0x3a42('0x54')]));if(_0x5e2383[_0x3a42('0x31')]['filter']){_0xc91101[_0x3a42('0x37')]=_[_0x3a42('0x3b')](_0xc91101[_0x3a42('0x37')],{'$or':_[_0x3a42('0x3a')](_0xc91101['attributes'],function(_0xb3afde){var _0x2518cf={};_0x2518cf[_0xb3afde]={'$like':'%'+_0x5e2383[_0x3a42('0x31')]['filter']+'%'};return _0x2518cf;})});}_0xc91101=_[_0x3a42('0x3b')]({},_0xc91101,_0x5e2383[_0x3a42('0x3c')]);return _0x41ee80[_0x3a42('0x51')](_0xc91101);}})[_0x3a42('0x23')](function(_0x1274d1){if(_0x1274d1){_0x12645f=_0x1274d1[_0x3a42('0x34')];if(!_0x5e2383[_0x3a42('0x31')][_0x3a42('0x35')]('nolimit')){_0xc91101[_0x3a42('0x1e')]=qs[_0x3a42('0x1e')](_0x5e2383[_0x3a42('0x31')]['limit']);_0xc91101[_0x3a42('0x1c')]=qs[_0x3a42('0x1c')](_0x5e2383[_0x3a42('0x31')][_0x3a42('0x1c')]);}return _0x41ee80[_0x3a42('0x51')](_0xc91101);}})[_0x3a42('0x23')](function(_0x2a5e41){if(_0x2a5e41){return _0x2a5e41?{'count':_0x12645f,'rows':_0x2a5e41}:null;}})[_0x3a42('0x23')](respondWithResult(_0x499f81,null))[_0x3a42('0x40')](handleError(_0x499f81,null));}; \ No newline at end of file +var _0xdbcb=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts','ids','omit','findOne','CmContact','options','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','index','CmCompany','keys','query','filters','intersection','model'];(function(_0x326f81,_0x57c9d8){var _0x8a3c6e=function(_0xde3601){while(--_0xde3601){_0x326f81['push'](_0x326f81['shift']());}};_0x8a3c6e(++_0x57c9d8);}(_0xdbcb,0x12f));var _0xbdbc=function(_0x25dfdf,_0x542333){_0x25dfdf=_0x25dfdf-0x0;var _0x5220da=_0xdbcb[_0x25dfdf];return _0x5220da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdbc('0x0'));var zipdir=require(_0xbdbc('0x1'));var jsonpatch=require(_0xbdbc('0x2'));var rp=require(_0xbdbc('0x3'));var moment=require(_0xbdbc('0x4'));var BPromise=require(_0xbdbc('0x5'));var Mustache=require(_0xbdbc('0x6'));var util=require(_0xbdbc('0x7'));var path=require('path');var sox=require(_0xbdbc('0x8'));var csv=require(_0xbdbc('0x9'));var ejs=require(_0xbdbc('0xa'));var fs=require('fs');var fs_extra=require(_0xbdbc('0xb'));var _=require(_0xbdbc('0xc'));var squel=require(_0xbdbc('0xd'));var crypto=require(_0xbdbc('0xe'));var jsforce=require(_0xbdbc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbdbc('0x9'));var querystring=require('querystring');var Papa=require(_0xbdbc('0x10'));var Redis=require(_0xbdbc('0x11'));var authService=require(_0xbdbc('0x12'));var qs=require(_0xbdbc('0x13'));var as=require(_0xbdbc('0x14'));var hardwareService=require(_0xbdbc('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbdbc('0x16'));var config=require(_0xbdbc('0x17'));var licenseUtil=require(_0xbdbc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14335d,_0x51e0f5){_0x51e0f5=_0x51e0f5||0xcc;return function(_0x2d6c27){if(_0x2d6c27){return _0x14335d[_0xbdbc('0x19')](_0x51e0f5);}return _0x14335d[_0xbdbc('0x1a')](_0x51e0f5)[_0xbdbc('0x1b')]();};}function respondWithResult(_0x495abb,_0xe41dda){_0xe41dda=_0xe41dda||0xc8;return function(_0x5efb98){if(_0x5efb98){return _0x495abb[_0xbdbc('0x1a')](_0xe41dda)[_0xbdbc('0x1c')](_0x5efb98);}};}function respondWithFilteredResult(_0x4eb118,_0x3f6ba3){return function(_0x2cacff){if(_0x2cacff){var _0xce5d1f=typeof _0x3f6ba3['offset']===_0xbdbc('0x1d')&&typeof _0x3f6ba3[_0xbdbc('0x1e')]==='undefined';var _0x5077ea=_0x2cacff[_0xbdbc('0x1f')];var _0x504810=_0xce5d1f?0x0:_0x3f6ba3[_0xbdbc('0x20')];var _0x4f3bd1=_0xce5d1f?_0x2cacff[_0xbdbc('0x1f')]:_0x3f6ba3[_0xbdbc('0x20')]+_0x3f6ba3[_0xbdbc('0x1e')];var _0x341590;if(_0x4f3bd1>=_0x5077ea){_0x4f3bd1=_0x5077ea;_0x341590=0xc8;}else{_0x341590=0xce;}_0x4eb118[_0xbdbc('0x1a')](_0x341590);return _0x4eb118[_0xbdbc('0x21')](_0xbdbc('0x22'),_0x504810+'-'+_0x4f3bd1+'/'+_0x5077ea)['json'](_0x2cacff);}return null;};}function patchUpdates(_0x5e405c){return function(_0xe66cfc){try{jsonpatch[_0xbdbc('0x23')](_0xe66cfc,_0x5e405c,!![]);}catch(_0xd21760){return BPromise[_0xbdbc('0x24')](_0xd21760);}return _0xe66cfc[_0xbdbc('0x25')]();};}function saveUpdates(_0x1500ff,_0x345d36){return function(_0x2bb9a2){if(_0x2bb9a2){return _0x2bb9a2[_0xbdbc('0x26')](_0x1500ff)[_0xbdbc('0x27')](function(_0x551253){return _0x551253;});}return null;};}function removeEntity(_0x5cee67,_0x2416a4){return function(_0x285158){if(_0x285158){return _0x285158[_0xbdbc('0x28')]()[_0xbdbc('0x27')](function(){var _0x455a30=_0x285158[_0xbdbc('0x29')]({'plain':!![]});var _0x5c16b7=_0xbdbc('0x2a');return db[_0xbdbc('0x2b')][_0xbdbc('0x28')]({'where':{'type':_0x5c16b7,'resourceId':_0x455a30['id']}})['then'](function(){return _0x285158;});})[_0xbdbc('0x27')](function(){_0x5cee67[_0xbdbc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x398321,_0x158201){return function(_0xe962ec){if(!_0xe962ec){_0x398321[_0xbdbc('0x19')](0x194);}return _0xe962ec;};}function handleError(_0x144f2e,_0x114ec5){_0x114ec5=_0x114ec5||0x1f4;return function(_0x20571c){logger[_0xbdbc('0x2c')](_0x20571c['stack']);if(_0x20571c[_0xbdbc('0x2d')]){delete _0x20571c['name'];}_0x144f2e[_0xbdbc('0x1a')](_0x114ec5)['send'](_0x20571c);};}exports[_0xbdbc('0x2e')]=function(_0x2e8458,_0x549643){var _0x4127fb={},_0xcdc5b1={},_0x9496d6={'count':0x0,'rows':[]};return db[_0xbdbc('0x2f')]['describe']()['then'](function(_0x100e07){_0xcdc5b1['model']=_[_0xbdbc('0x30')](_0x100e07);_0xcdc5b1[_0xbdbc('0x31')]=_['keys'](_0x2e8458[_0xbdbc('0x31')]);_0xcdc5b1[_0xbdbc('0x32')]=_[_0xbdbc('0x33')](_0xcdc5b1[_0xbdbc('0x34')],_0xcdc5b1['query']);_0x4127fb[_0xbdbc('0x35')]=_['intersection'](_0xcdc5b1[_0xbdbc('0x34')],qs[_0xbdbc('0x36')](_0x2e8458['query'][_0xbdbc('0x36')]));_0x4127fb[_0xbdbc('0x35')]=_0x4127fb[_0xbdbc('0x35')][_0xbdbc('0x37')]?_0x4127fb[_0xbdbc('0x35')]:_0xcdc5b1[_0xbdbc('0x34')];if(!_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x38')](_0xbdbc('0x39'))){_0x4127fb[_0xbdbc('0x1e')]=qs[_0xbdbc('0x1e')](_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x1e')]);_0x4127fb[_0xbdbc('0x20')]=qs[_0xbdbc('0x20')](_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x20')]);}_0x4127fb[_0xbdbc('0x3a')]=qs[_0xbdbc('0x3b')](_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x3b')]);_0x4127fb[_0xbdbc('0x3c')]=qs[_0xbdbc('0x32')](_[_0xbdbc('0x3d')](_0x2e8458[_0xbdbc('0x31')],_0xcdc5b1[_0xbdbc('0x32')]),_0x100e07);if(_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x3e')]){_0x4127fb[_0xbdbc('0x3c')]=_[_0xbdbc('0x3f')](_0x4127fb[_0xbdbc('0x3c')],{'$or':_[_0xbdbc('0x40')](_0x4127fb[_0xbdbc('0x35')],function(_0x3caa46){var _0xcbe8db={};_0xcbe8db[_0x3caa46]={'$like':'%'+_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x3e')]+'%'};return _0xcbe8db;})});}_0x4127fb=_[_0xbdbc('0x3f')]({},_0x4127fb,_0x2e8458['options']);var _0x4239c2={'where':_0x4127fb[_0xbdbc('0x3c')]};return db['CmCompany']['count'](_0x4239c2)['then'](function(_0x563b43){_0x9496d6[_0xbdbc('0x1f')]=_0x563b43;if(_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x41')]){_0x4127fb[_0xbdbc('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0xbdbc('0x43')](_0x4127fb);})[_0xbdbc('0x27')](function(_0x25681c){_0x9496d6[_0xbdbc('0x44')]=_0x25681c;return _0x9496d6;})[_0xbdbc('0x27')](respondWithFilteredResult(_0x549643,_0x4127fb))[_0xbdbc('0x45')](handleError(_0x549643,null));})[_0xbdbc('0x45')](handleError(_0x549643,null));};exports[_0xbdbc('0x46')]=function(_0x528900,_0x52d471){var _0x3a8ff2={'raw':![],'where':{'id':_0x528900[_0xbdbc('0x47')]['id']}},_0x4ecc7f={};_0x4ecc7f['model']=_[_0xbdbc('0x30')](db[_0xbdbc('0x2f')][_0xbdbc('0x48')]);_0x4ecc7f['query']=_[_0xbdbc('0x30')](_0x528900[_0xbdbc('0x31')]);_0x4ecc7f[_0xbdbc('0x32')]=_[_0xbdbc('0x33')](_0x4ecc7f[_0xbdbc('0x34')],_0x4ecc7f[_0xbdbc('0x31')]);_0x3a8ff2[_0xbdbc('0x35')]=_[_0xbdbc('0x33')](_0x4ecc7f['model'],qs[_0xbdbc('0x36')](_0x528900['query']['fields']));_0x3a8ff2[_0xbdbc('0x35')]=_0x3a8ff2[_0xbdbc('0x35')][_0xbdbc('0x37')]?_0x3a8ff2[_0xbdbc('0x35')]:_0x4ecc7f[_0xbdbc('0x34')];if(_0x528900[_0xbdbc('0x31')]['includeAll']){_0x3a8ff2[_0xbdbc('0x42')]=[{'all':!![]}];}_0x3a8ff2=_['merge']({},_0x3a8ff2,_0x528900['options']);return db[_0xbdbc('0x2f')]['find'](_0x3a8ff2)[_0xbdbc('0x27')](handleEntityNotFound(_0x52d471,null))['then'](respondWithResult(_0x52d471,null))[_0xbdbc('0x45')](handleError(_0x52d471,null));};exports['create']=function(_0x59d54f,_0x49f7c4){return db[_0xbdbc('0x2f')][_0xbdbc('0x49')](_0x59d54f['body'],{})[_0xbdbc('0x27')](function(_0x45ea2c){var _0x2dec30=_0x59d54f[_0xbdbc('0x4a')][_0xbdbc('0x29')]({'plain':!![]});if(!_0x2dec30)throw new Error(_0xbdbc('0x4b'));if(_0x2dec30['role']===_0xbdbc('0x4a')){var _0x4ada71=_0x45ea2c[_0xbdbc('0x29')]({'plain':!![]});var _0xc3e643=_0xbdbc('0x2a');return db[_0xbdbc('0x4c')][_0xbdbc('0x4d')]({'where':{'name':_0xc3e643,'userProfileId':_0x2dec30['userProfileId']},'raw':!![]})[_0xbdbc('0x27')](function(_0x4b9426){if(_0x4b9426&&_0x4b9426[_0xbdbc('0x4e')]===0x0){return db[_0xbdbc('0x2b')]['create']({'name':_0x4ada71['name'],'resourceId':_0x4ada71['id'],'type':_0x4b9426['name'],'sectionId':_0x4b9426['id']},{})[_0xbdbc('0x27')](function(){return _0x45ea2c;});}else{return _0x45ea2c;}})[_0xbdbc('0x45')](function(_0x5ac03c){logger[_0xbdbc('0x2c')](_0xbdbc('0x4f'),_0x5ac03c);throw _0x5ac03c;});}return _0x45ea2c;})[_0xbdbc('0x27')](respondWithResult(_0x49f7c4,0xc9))['catch'](handleError(_0x49f7c4,null));};exports[_0xbdbc('0x26')]=function(_0x310a8d,_0x5e983f){if(_0x310a8d['body']['id']){delete _0x310a8d['body']['id'];}return db[_0xbdbc('0x2f')][_0xbdbc('0x4d')]({'where':{'id':_0x310a8d[_0xbdbc('0x47')]['id']}})[_0xbdbc('0x27')](handleEntityNotFound(_0x5e983f,null))[_0xbdbc('0x27')](saveUpdates(_0x310a8d[_0xbdbc('0x50')],null))[_0xbdbc('0x27')](respondWithResult(_0x5e983f,null))[_0xbdbc('0x45')](handleError(_0x5e983f,null));};exports['destroy']=function(_0x4b83c7,_0x4dc319){return db[_0xbdbc('0x2f')][_0xbdbc('0x4d')]({'where':{'id':_0x4b83c7[_0xbdbc('0x47')]['id']}})[_0xbdbc('0x27')](handleEntityNotFound(_0x4dc319,null))['then'](removeEntity(_0x4dc319,null))[_0xbdbc('0x45')](handleError(_0x4dc319,null));};exports[_0xbdbc('0x51')]=function(_0x14995f,_0x4c8797){return db[_0xbdbc('0x2f')][_0xbdbc('0x51')]()[_0xbdbc('0x27')](respondWithResult(_0x4c8797,null))['catch'](handleError(_0x4c8797,null));};exports['addContacts']=function(_0x2469ea,_0xdcdd54,_0x292175){return db['CmContact'][_0xbdbc('0x4d')]({'where':{'id':_0x2469ea['params']['id']}})[_0xbdbc('0x27')](handleEntityNotFound(_0xdcdd54,null))[_0xbdbc('0x27')](function(_0x3dc32c){if(_0x3dc32c){return _0x3dc32c[_0xbdbc('0x52')](_0x2469ea['body'][_0xbdbc('0x53')],_[_0xbdbc('0x54')](_0x2469ea[_0xbdbc('0x50')],[_0xbdbc('0x53'),'id'])||{});}})[_0xbdbc('0x27')](respondWithResult(_0xdcdd54,null))[_0xbdbc('0x45')](handleError(_0xdcdd54,null));};exports['getContacts']=function(_0x4e3d19,_0x58f641,_0x1b7827){var _0x321bd4={};var _0x2975db={};var _0x3f5fdf;var _0x27481c;return db[_0xbdbc('0x2f')][_0xbdbc('0x55')]({'where':{'id':_0x4e3d19[_0xbdbc('0x47')]['id']}})[_0xbdbc('0x27')](handleEntityNotFound(_0x58f641,null))[_0xbdbc('0x27')](function(_0x5aa9d2){if(_0x5aa9d2){_0x3f5fdf=_0x5aa9d2;_0x2975db['model']=_[_0xbdbc('0x30')](db[_0xbdbc('0x56')][_0xbdbc('0x48')]);_0x2975db[_0xbdbc('0x31')]=_[_0xbdbc('0x30')](_0x4e3d19['query']);_0x2975db['filters']=_[_0xbdbc('0x33')](_0x2975db[_0xbdbc('0x34')],_0x2975db[_0xbdbc('0x31')]);_0x321bd4[_0xbdbc('0x35')]=_['intersection'](_0x2975db[_0xbdbc('0x34')],qs[_0xbdbc('0x36')](_0x4e3d19[_0xbdbc('0x31')]['fields']));_0x321bd4[_0xbdbc('0x35')]=_0x321bd4['attributes']['length']?_0x321bd4[_0xbdbc('0x35')]:_0x2975db[_0xbdbc('0x34')];_0x321bd4['order']=qs[_0xbdbc('0x3b')](_0x4e3d19[_0xbdbc('0x31')][_0xbdbc('0x3b')]);_0x321bd4[_0xbdbc('0x3c')]=qs[_0xbdbc('0x32')](_[_0xbdbc('0x3d')](_0x4e3d19['query'],_0x2975db[_0xbdbc('0x32')]));if(_0x4e3d19[_0xbdbc('0x31')][_0xbdbc('0x3e')]){_0x321bd4['where']=_['merge'](_0x321bd4[_0xbdbc('0x3c')],{'$or':_[_0xbdbc('0x40')](_0x321bd4[_0xbdbc('0x35')],function(_0x294614){var _0x42a1ff={};_0x42a1ff[_0x294614]={'$like':'%'+_0x4e3d19[_0xbdbc('0x31')][_0xbdbc('0x3e')]+'%'};return _0x42a1ff;})});}_0x321bd4=_[_0xbdbc('0x3f')]({},_0x321bd4,_0x4e3d19[_0xbdbc('0x57')]);return _0x3f5fdf[_0xbdbc('0x58')](_0x321bd4);}})[_0xbdbc('0x27')](function(_0x35385e){if(_0x35385e){_0x27481c=_0x35385e['length'];if(!_0x4e3d19['query']['hasOwnProperty'](_0xbdbc('0x39'))){_0x321bd4[_0xbdbc('0x1e')]=qs[_0xbdbc('0x1e')](_0x4e3d19[_0xbdbc('0x31')]['limit']);_0x321bd4['offset']=qs[_0xbdbc('0x20')](_0x4e3d19[_0xbdbc('0x31')][_0xbdbc('0x20')]);}return _0x3f5fdf[_0xbdbc('0x58')](_0x321bd4);}})['then'](function(_0xb755b8){if(_0xb755b8){return _0xb755b8?{'count':_0x27481c,'rows':_0xb755b8}:null;}})[_0xbdbc('0x27')](respondWithResult(_0x58f641,null))[_0xbdbc('0x45')](handleError(_0x58f641,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 0ccf006..35aab15 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 _0x7085=['exports','define','CmCompany','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e7f48,_0x4435f7){var _0x2a57e2=function(_0x1c9c0a){while(--_0x1c9c0a){_0x2e7f48['push'](_0x2e7f48['shift']());}};_0x2a57e2(++_0x4435f7);}(_0x7085,0x71));var _0x5708=function(_0x736a72,_0x574f49){_0x736a72=_0x736a72-0x0;var _0x3741ad=_0x7085[_0x736a72];return _0x3741ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5708('0x0'))('api');var moment=require(_0x5708('0x1'));var BPromise=require(_0x5708('0x2'));var rp=require(_0x5708('0x3'));var fs=require('fs');var path=require(_0x5708('0x4'));var rimraf=require(_0x5708('0x5'));var config=require(_0x5708('0x6'));var attributes=require('./cmCompany.attributes');module[_0x5708('0x7')]=function(_0x508831,_0x52175b){return _0x508831[_0x5708('0x8')](_0x5708('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf50f=['exports','cm_companies','lodash','util','bluebird','path','rimraf','./cmCompany.attributes'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xf50f,0x112));var _0xff50=function(_0x53da6b,_0x2ce125){_0x53da6b=_0x53da6b-0x0;var _0x309813=_0xf50f[_0x53da6b];return _0x309813;};'use strict';var _=require(_0xff50('0x0'));var util=require(_0xff50('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xff50('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff50('0x3'));var rimraf=require(_0xff50('0x4'));var config=require('../../config/environment');var attributes=require(_0xff50('0x5'));module[_0xff50('0x6')]=function(_0x250636,_0x4701b1){return _0x250636['define']('CmCompany',attributes,{'tableName':_0xff50('0x7'),'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 1fd7108..edb540d 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 _0x2be3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20e641,_0x3e23fb){var _0x2b9ab9=function(_0x5ebdd9){while(--_0x5ebdd9){_0x20e641['push'](_0x20e641['shift']());}};_0x2b9ab9(++_0x3e23fb);}(_0x2be3,0x1dd));var _0x32be=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2be3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x32be('0x0'));var util=require(_0x32be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32be('0x2'));var fs=require('fs');var Redis=require(_0x32be('0x3'));var db=require(_0x32be('0x4'))['db'];var utils=require(_0x32be('0x5'));var logger=require(_0x32be('0x6'))(_0x32be('0x7'));var config=require(_0x32be('0x8'));var jayson=require(_0x32be('0x9'));var client=jayson[_0x32be('0xa')][_0x32be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x321cb1,_0x2306fc,_0x46f1e0){return new BPromise(function(_0x59bd69,_0x4dfd8e){return client[_0x32be('0xc')](_0x321cb1,_0x46f1e0)[_0x32be('0xd')](function(_0x2ace65){logger[_0x32be('0xe')](_0x32be('0xf'),_0x2306fc,_0x32be('0x10'));logger[_0x32be('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2306fc,_0x32be('0x10'),JSON[_0x32be('0x12')](_0x2ace65));if(_0x2ace65['error']){if(_0x2ace65[_0x32be('0x13')]['code']===0x1f4){logger[_0x32be('0x13')](_0x32be('0xf'),_0x2306fc,_0x2ace65[_0x32be('0x13')][_0x32be('0x14')]);return _0x4dfd8e(_0x2ace65[_0x32be('0x13')][_0x32be('0x14')]);}logger[_0x32be('0x13')](_0x32be('0xf'),_0x2306fc,_0x2ace65[_0x32be('0x13')][_0x32be('0x14')]);return _0x59bd69(_0x2ace65[_0x32be('0x13')][_0x32be('0x14')]);}else{logger[_0x32be('0xe')](_0x32be('0xf'),_0x2306fc,'request\x20sent');_0x59bd69(_0x2ace65[_0x32be('0x15')][_0x32be('0x14')]);}})[_0x32be('0x16')](function(_0x3885fa){logger[_0x32be('0x13')](_0x32be('0xf'),_0x2306fc,_0x3885fa);_0x4dfd8e(_0x3885fa);});});} \ No newline at end of file +var _0x3565=['jayson/promise','client','http','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3565,0x1af));var _0x5356=function(_0x32622d,_0x1ef3bd){_0x32622d=_0x32622d-0x0;var _0x29146a=_0x3565[_0x32622d];return _0x29146a;};'use strict';var _=require(_0x5356('0x0'));var util=require(_0x5356('0x1'));var moment=require(_0x5356('0x2'));var BPromise=require(_0x5356('0x3'));var rs=require(_0x5356('0x4'));var fs=require('fs');var Redis=require(_0x5356('0x5'));var db=require(_0x5356('0x6'))['db'];var utils=require(_0x5356('0x7'));var logger=require(_0x5356('0x8'))('rpc');var config=require(_0x5356('0x9'));var jayson=require(_0x5356('0xa'));var client=jayson[_0x5356('0xb')][_0x5356('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb32b50,_0x5c0770,_0x5a1761){return new BPromise(function(_0x13ba82,_0x3fb29e){return client['request'](_0xb32b50,_0x5a1761)['then'](function(_0xc3d93e){logger[_0x5356('0xd')](_0x5356('0xe'),_0x5c0770,'request\x20sent');logger['debug'](_0x5356('0xf'),_0x5c0770,_0x5356('0x10'),JSON['stringify'](_0xc3d93e));if(_0xc3d93e[_0x5356('0x11')]){if(_0xc3d93e['error'][_0x5356('0x12')]===0x1f4){logger[_0x5356('0x11')]('CmCompany,\x20%s,\x20%s',_0x5c0770,_0xc3d93e[_0x5356('0x11')]['message']);return _0x3fb29e(_0xc3d93e[_0x5356('0x11')]['message']);}logger[_0x5356('0x11')](_0x5356('0xe'),_0x5c0770,_0xc3d93e[_0x5356('0x11')][_0x5356('0x13')]);return _0x13ba82(_0xc3d93e[_0x5356('0x11')]['message']);}else{logger['info'](_0x5356('0xe'),_0x5c0770,_0x5356('0x10'));_0x13ba82(_0xc3d93e[_0x5356('0x14')][_0x5356('0x13')]);}})['catch'](function(_0x4ef6d5){logger[_0x5356('0x11')](_0x5356('0xe'),_0x5c0770,_0x4ef6d5);_0x3fb29e(_0x4ef6d5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0fac2d8..2c00742 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 _0xcbb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe','/:id','/:id/contacts','getContacts','create','post','addContacts','put','update','delete','destroy','multer','path'];(function(_0x1116cd,_0x41a0b7){var _0x52974a=function(_0x3c4e70){while(--_0x3c4e70){_0x1116cd['push'](_0x1116cd['shift']());}};_0x52974a(++_0x41a0b7);}(_0xcbb8,0x139));var _0x8cbb=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xcbb8[_0x24259d];return _0x5a701;};'use strict';var multer=require(_0x8cbb('0x0'));var util=require('util');var path=require(_0x8cbb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8cbb('0x2'));var auth=require(_0x8cbb('0x3'));var interaction=require(_0x8cbb('0x4'));var config=require(_0x8cbb('0x5'));var controller=require(_0x8cbb('0x6'));router['get']('/',auth[_0x8cbb('0x7')](),controller[_0x8cbb('0x8')]);router[_0x8cbb('0x9')]('/describe',auth[_0x8cbb('0x7')](),controller[_0x8cbb('0xa')]);router[_0x8cbb('0x9')](_0x8cbb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8cbb('0x9')](_0x8cbb('0xc'),auth[_0x8cbb('0x7')](),controller[_0x8cbb('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8cbb('0xe')]);router[_0x8cbb('0xf')](_0x8cbb('0xc'),auth[_0x8cbb('0x7')](),controller[_0x8cbb('0x10')]);router[_0x8cbb('0x11')](_0x8cbb('0xb'),auth[_0x8cbb('0x7')](),controller[_0x8cbb('0x12')]);router[_0x8cbb('0x13')](_0x8cbb('0xb'),auth['isAuthenticated'](),controller[_0x8cbb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3f49=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/:id','isAuthenticated','/:id/contacts','post','addContacts','put','destroy'];(function(_0x2ca636,_0x4f4da1){var _0x168e73=function(_0x282200){while(--_0x282200){_0x2ca636['push'](_0x2ca636['shift']());}};_0x168e73(++_0x4f4da1);}(_0x3f49,0x1b9));var _0x93f4=function(_0x5534f0,_0x4841a1){_0x5534f0=_0x5534f0-0x0;var _0x5089dd=_0x3f49[_0x5534f0];return _0x5089dd;};'use strict';var multer=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var path=require(_0x93f4('0x2'));var timeout=require(_0x93f4('0x3'));var express=require('express');var router=express[_0x93f4('0x4')]();var fs_extra=require(_0x93f4('0x5'));var auth=require(_0x93f4('0x6'));var interaction=require(_0x93f4('0x7'));var config=require(_0x93f4('0x8'));var controller=require(_0x93f4('0x9'));router[_0x93f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x93f4('0xb')]);router[_0x93f4('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x93f4('0xa')](_0x93f4('0xc'),auth[_0x93f4('0xd')](),controller['show']);router['get'](_0x93f4('0xe'),auth['isAuthenticated'](),controller['getContacts']);router[_0x93f4('0xf')]('/',auth[_0x93f4('0xd')](),controller['create']);router[_0x93f4('0xf')](_0x93f4('0xe'),auth[_0x93f4('0xd')](),controller[_0x93f4('0x10')]);router[_0x93f4('0x11')](_0x93f4('0xc'),auth[_0x93f4('0xd')](),controller['update']);router['delete']('/:id',auth[_0x93f4('0xd')](),controller[_0x93f4('0x12')]);module[_0x93f4('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index dad1846..edad918 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 _0x03da=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x1b7ea6,_0x195a62){var _0x4fcea6=function(_0x29ace1){while(--_0x29ace1){_0x1b7ea6['push'](_0x1b7ea6['shift']());}};_0x4fcea6(++_0x195a62);}(_0x03da,0x15e));var _0xa03d=function(_0x53c1a1,_0x1f401c){_0x53c1a1=_0x53c1a1-0x0;var _0x4f2ddf=_0x03da[_0x53c1a1];return _0x4f2ddf;};'use strict';var _=require(_0xa03d('0x0'));var Sequelize=require(_0xa03d('0x1'));module[_0xa03d('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa03d('0x3')]},'postalCode':{'type':Sequelize[_0xa03d('0x3')]},'city':{'type':Sequelize[_0xa03d('0x3')]},'country':{'type':Sequelize[_0xa03d('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa03d('0x3')]},'description':{'type':Sequelize[_0xa03d('0x4')]},'phone':{'type':Sequelize[_0xa03d('0x3')]},'mobile':{'type':Sequelize[_0xa03d('0x3')]},'fax':{'type':Sequelize[_0xa03d('0x3')]},'email':{'type':Sequelize[_0xa03d('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xa03d('0x3')]},'skype':{'type':Sequelize[_0xa03d('0x3')]},'teams':{'type':Sequelize[_0xa03d('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xa03d('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xa03d('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa03d('0x5')](0x2)[_0xa03d('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa03d('0x7')],'defaultValue':Sequelize[_0xa03d('0x8')]},'dialTimezone':{'type':Sequelize[_0xa03d('0x3')]},'utcOffset':{'type':Sequelize[_0xa03d('0x5')]}}; \ No newline at end of file +var _0x5c48=['exports','STRING','INTEGER','UNSIGNED','NOW'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x5c48,0x1c7));var _0x85c4=function(_0x59055e,_0x5add8f){_0x59055e=_0x59055e-0x0;var _0xd6174b=_0x5c48[_0x59055e];return _0xd6174b;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x85c4('0x0')]={'firstName':{'type':Sequelize[_0x85c4('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x85c4('0x1')]},'street':{'type':Sequelize[_0x85c4('0x1')]},'postalCode':{'type':Sequelize[_0x85c4('0x1')]},'city':{'type':Sequelize[_0x85c4('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x85c4('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x85c4('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x85c4('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x85c4('0x1')]},'skype':{'type':Sequelize[_0x85c4('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x85c4('0x1')]},'wechat':{'type':Sequelize[_0x85c4('0x1')]},'telegram':{'type':Sequelize[_0x85c4('0x1')]},'UserId':{'type':Sequelize[_0x85c4('0x2')]},'AdditionalPhones':{'type':Sequelize[_0x85c4('0x1')]},'priority':{'type':Sequelize[_0x85c4('0x2')](0x2)[_0x85c4('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x85c4('0x4')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x85c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f6d84b4..36def5b 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 _0xc750=['omit','map','isEmpty','table','cm_contacts','setFields','toParam','text','phone','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','getTags','setTags','ids','setAdditionalPhones','all','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','CmHopperId','ItemType.OrderBy','bulkCreate','getAdditionalPhones','`ItemType`.OrderBy','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','options','includeAll','include','rows','getHopperHistories','getHopperFinals','nolimit','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','parse','import','agent','No\x20ListId\x20specified','binding','firstName','stringify','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','importUpdates','User','message','exit','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','Account','closed','closedAt','disposition','thirdDisposition','key','Owner','customerIp','customerPort','osName','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','startCase','Interaction','flatten','sortBy','slice','moment','bluebird','util','path','lodash','squel','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','stack','name','send','index','describe','getOptions','findAll','query','user','catch','params','keys','startsWith','cf_','columnName','CmCustomField','length','displayName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','CmContact','from','get','mergeWith','isArray','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','isNil','dialTimezone','utcOffset','additionalPhones','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','find','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','format','cf_%d','timezones'];(function(_0x27973f,_0x3dc301){var _0x406fbe=function(_0x53a81f){while(--_0x53a81f){_0x27973f['push'](_0x27973f['shift']());}};_0x406fbe(++_0x3dc301);}(_0xc750,0x187));var _0x0c75=function(_0x4a6312,_0x5f2f95){_0x4a6312=_0x4a6312-0x0;var _0x5d8929=_0xc750[_0x4a6312];return _0x5d8929;};'use strict';var moment=require(_0x0c75('0x0'));var BPromise=require(_0x0c75('0x1'));var util=require(_0x0c75('0x2'));var path=require(_0x0c75('0x3'));var fs=require('fs');var _=require(_0x0c75('0x4'));var squel=require(_0x0c75('0x5'));var Papa=require('papaparse');var Redis=require(_0x0c75('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0x0c75('0x7'))('api');var config=require(_0x0c75('0x8'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x0c75('0x9')]=_[_0x0c75('0xa')](config[_0x0c75('0x9')],{'host':_0x0c75('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c75('0x9')]));require(_0x0c75('0xc'))[_0x0c75('0xd')](socket);function respondWithResult(_0xe04b01,_0x19ab26){_0x19ab26=_0x19ab26||0xc8;return function(_0x5397f3){if(_0x5397f3){return _0xe04b01[_0x0c75('0xe')](_0x19ab26)[_0x0c75('0xf')](_0x5397f3);}};}function respondWithFilteredResult(_0x5d42be,_0xe16dbf){return function(_0x52718c){if(_0x52718c){var _0x9626dc=typeof _0xe16dbf[_0x0c75('0x10')]===_0x0c75('0x11')&&typeof _0xe16dbf[_0x0c75('0x12')]==='undefined';var _0x460896=_0x52718c[_0x0c75('0x13')];var _0x22a893=_0x9626dc?0x0:_0xe16dbf[_0x0c75('0x10')];var _0x1c1011=_0x9626dc?_0x52718c['count']:_0xe16dbf[_0x0c75('0x10')]+_0xe16dbf[_0x0c75('0x12')];var _0x2024ff;if(_0x1c1011>=_0x460896){_0x1c1011=_0x460896;_0x2024ff=0xc8;}else{_0x2024ff=0xce;}_0x5d42be[_0x0c75('0xe')](_0x2024ff);return _0x5d42be[_0x0c75('0x14')]('Content-Range',_0x22a893+'-'+_0x1c1011+'/'+_0x460896)[_0x0c75('0xf')](_0x52718c);}return null;};}function saveUpdates(_0x478968){return function(_0x510d5f){if(_0x510d5f){return _0x510d5f[_0x0c75('0x15')](_0x478968)[_0x0c75('0x16')](function(_0x544834){return _0x544834;});}return null;};}function removeEntity(_0x5e893f){return function(_0x26829b){if(_0x26829b){return _0x26829b[_0x0c75('0x17')]()['then'](function(){_0x5e893f[_0x0c75('0xe')](0xcc)[_0x0c75('0x18')]();});}};}function handleEntityNotFound(_0x36aa99){return function(_0x5316ae){if(!_0x5316ae){_0x36aa99[_0x0c75('0x19')](0x194);}return _0x5316ae;};}function handleError(_0xaba5dd,_0xd6dc03){_0xd6dc03=_0xd6dc03||0x1f4;return function(_0x47f009){logger['error'](_0x47f009[_0x0c75('0x1a')]);if(_0x47f009['name']){delete _0x47f009[_0x0c75('0x1b')];}_0xaba5dd[_0x0c75('0xe')](_0xd6dc03)[_0x0c75('0x1c')](_0x47f009);};}exports[_0x0c75('0x1d')]=function(_0x2a8907,_0x46bfad){var _0x151523={};return contacts[_0x0c75('0x1e')]()[_0x0c75('0x16')](function(_0x2a4938){_0x151523=qs[_0x0c75('0x1f')](_0x2a4938,_0x2a8907);return contacts[_0x0c75('0x20')](_0x2a8907[_0x0c75('0x21')],_0x2a8907[_0x0c75('0x22')],_0x151523,_0x2a4938);})['then'](respondWithFilteredResult(_0x46bfad,_0x151523))[_0x0c75('0x23')](handleError(_0x46bfad,null));};exports[_0x0c75('0x17')]=function(_0x2b2fb1,_0x2b8660){return db['CmContact']['find']({'where':{'id':_0x2b2fb1[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x2b8660,null))['then'](removeEntity(_0x2b8660,null))['catch'](handleError(_0x2b8660,null));};exports[_0x0c75('0x1e')]=function(_0x4097ed,_0x47deb5){return db['CmContact'][_0x0c75('0x1e')]()[_0x0c75('0x16')](function(_0x1d31d4){delete _0x1d31d4['tags'];for(var _0x362753=0x0;_0x3627530x0){return new Promise(function(_0x55008a){var _0x41be38=[];for(var _0x4c2326=0x0;_0x4c2326<_0x3d7e41['length'];_0x4c2326++){_0x41be38[_0x0c75('0x5f')](insertAdditionalPhones(_0x3d7e41[_0x4c2326][_0x0c75('0x63')],_0x3d7e41[_0x4c2326][_0x0c75('0x5a')]));}Promise['all'](_0x41be38)['then'](function(){_0x55008a(0x1);});})[_0x0c75('0x16')](function(){return{'success':_0x22dcfd,'failure':_0xf7cf97,'duplicates':_0x47b5d2};});}else{return{'success':_0x22dcfd,'failure':_0xf7cf97,'duplicates':_0x47b5d2};}}})['then'](respondWithResult(_0xe006c3,0xc9))[_0x0c75('0x23')](handleError(_0xe006c3,null));};exports['show']=function(_0xc64b58,_0x3ceb33){var _0x374d9a;return db[_0x0c75('0x36')][_0x0c75('0x1e')]()[_0x0c75('0x16')](function(_0x4a8ffd){return db[_0x0c75('0x36')][_0x0c75('0x64')]({'where':{'id':_0xc64b58[_0x0c75('0x24')]['id']},'include':[{'model':db[_0x0c75('0x65')],'as':_0x0c75('0x66'),'attributes':['id',_0x0c75('0x1b'),_0x0c75('0x67')],'required':_0xc64b58[_0x0c75('0x21')][_0x0c75('0x68')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0c75('0x69'),'where':{'CmContactId':_0xc64b58['params']['id']},'required':![],'include':[{'model':db[_0x0c75('0x6a')],'as':_0x0c75('0x6b')}]}],'order':[db[_0x0c75('0x6c')][_0x0c75('0x6d')](_0x0c75('0x6e'))],'attributes':_[_0x0c75('0x25')](_0x4a8ffd)});})[_0x0c75('0x16')](function(_0x4131cb){if(!_[_0x0c75('0x57')](_0x4131cb)){_0x374d9a=_0x4131cb[_0x0c75('0x38')]({'plain':!![]});var _0x237f0d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4131cb&&_0x4131cb[_0x0c75('0x60')]){if(_0x4131cb[_0x0c75('0x60')]){_0x237f0d[_0x0c75('0x5d')][_0x0c75('0x6f')][_0x0c75('0x5f')]({'ListId':{'$ne':_0x4131cb[_0x0c75('0x60')]}});}}return db[_0x0c75('0x29')]['findAll'](_0x237f0d);}})[_0x0c75('0x16')](function(_0x788afc){if(!_[_0x0c75('0x57')](_0x788afc)){return _['omit'](_0x374d9a,_['map'](_0x788afc,function(_0x427cf1){return util[_0x0c75('0x70')](_0x0c75('0x71'),_0x427cf1['id']);}));}})[_0x0c75('0x16')](handleEntityNotFound(_0x3ceb33,null))[_0x0c75('0x16')](respondWithResult(_0x3ceb33,null))[_0x0c75('0x23')](handleError(_0x3ceb33,null));};exports['update']=function(_0x588ca8,_0xd11e53){var _0x59679b;if(_0x588ca8[_0x0c75('0x35')]['id']){delete _0x588ca8[_0x0c75('0x35')]['id'];}if(!_[_0x0c75('0x57')](_0x588ca8[_0x0c75('0x35')]['dialTimezone'])){var _0x1e71f8=_0x588ca8['body'][_0x0c75('0x58')];if(!_['isNil'](shared[_0x0c75('0x72')][_0x1e71f8]))_0x588ca8['body'][_0x0c75('0x59')]=shared[_0x0c75('0x72')][_0x1e71f8][_0x0c75('0x59')];}return db[_0x0c75('0x36')][_0x0c75('0x64')]({'where':{'id':_0x588ca8['params']['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0xd11e53,null))[_0x0c75('0x16')](saveUpdates(_0x588ca8['body'],null))[_0x0c75('0x16')](function(_0x7059da){_0x59679b=_0x7059da;var _0x2b5f4a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x7059da&&_0x7059da[_0x0c75('0x60')]){if(_0x7059da[_0x0c75('0x60')]){_0x2b5f4a[_0x0c75('0x5d')][_0x0c75('0x6f')][_0x0c75('0x5f')]({'ListId':{'$ne':_0x7059da[_0x0c75('0x60')]}});}}return db[_0x0c75('0x29')][_0x0c75('0x20')](_0x2b5f4a);})[_0x0c75('0x16')](function(_0x111897){if(_0x111897){return _[_0x0c75('0x73')](_['pickBy'](_0x588ca8[_0x0c75('0x35')],function(_0x1d1e62,_0x1e8b12){return _[_0x0c75('0x26')](_0x1e8b12,'cf_');}),_[_0x0c75('0x74')](_0x111897,function(_0x851060){return util[_0x0c75('0x70')](_0x0c75('0x71'),_0x851060['id']);}));}})[_0x0c75('0x16')](function(_0x495e5d){if(_0x495e5d&&!_[_0x0c75('0x75')](_0x495e5d)){var _0x5c7465=squel[_0x0c75('0x15')]()[_0x0c75('0x76')](_0x0c75('0x77'))[_0x0c75('0x78')](_0x495e5d)[_0x0c75('0x5d')]('id\x20=\x20?',_0x588ca8[_0x0c75('0x24')]['id'])[_0x0c75('0x79')]();return db[_0x0c75('0x6c')]['query'](_0x5c7465[_0x0c75('0x7a')],{'replacements':_0x5c7465['values']});}})[_0x0c75('0x16')](function(){if(_0x588ca8[_0x0c75('0x35')][_0x0c75('0x7b')]&&_0x59679b){return db[_0x0c75('0x3d')][_0x0c75('0x15')]({'phone':_0x588ca8[_0x0c75('0x35')][_0x0c75('0x7b')],'OrderBy':0x0},{'where':{'ContactId':_0x59679b['id']}});}})[_0x0c75('0x16')](function(){return _0x59679b;})[_0x0c75('0x16')](respondWithResult(_0xd11e53,null))[_0x0c75('0x23')](handleError(_0xd11e53,null));};exports['getTags']=function(_0x4ad950,_0x56d989){var _0x49025e={};var _0x18f38d={};var _0x5d0df8;var _0x534eb3;return db[_0x0c75('0x36')][_0x0c75('0x7c')]({'where':{'id':_0x4ad950[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x56d989,null))['then'](function(_0x4a00c7){if(_0x4a00c7){_0x5d0df8=_0x4a00c7;_0x18f38d[_0x0c75('0x7d')]=_['keys'](db[_0x0c75('0x65')][_0x0c75('0x7e')]);_0x18f38d[_0x0c75('0x21')]=_[_0x0c75('0x25')](_0x4ad950['query']);_0x18f38d[_0x0c75('0x7f')]=_[_0x0c75('0x80')](_0x18f38d[_0x0c75('0x7d')],_0x18f38d[_0x0c75('0x21')]);_0x49025e[_0x0c75('0x81')]=_['intersection'](_0x18f38d['model'],qs[_0x0c75('0x82')](_0x4ad950[_0x0c75('0x21')][_0x0c75('0x82')]));_0x49025e[_0x0c75('0x81')]=_0x49025e[_0x0c75('0x81')]['length']?_0x49025e[_0x0c75('0x81')]:_0x18f38d[_0x0c75('0x7d')];_0x49025e[_0x0c75('0x83')]=qs[_0x0c75('0x84')](_0x4ad950[_0x0c75('0x21')][_0x0c75('0x84')]);_0x49025e[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_[_0x0c75('0x85')](_0x4ad950[_0x0c75('0x21')],_0x18f38d['filters']));if(_0x4ad950[_0x0c75('0x21')][_0x0c75('0x86')]){_0x49025e[_0x0c75('0x5d')]=_[_0x0c75('0x34')](_0x49025e['where'],{'$or':_['map'](_0x49025e[_0x0c75('0x81')],function(_0x582f77){var _0xec2072={};_0xec2072[_0x582f77]={'$like':'%'+_0x4ad950[_0x0c75('0x21')][_0x0c75('0x86')]+'%'};return _0xec2072;})});}_0x49025e=_['merge']({},_0x49025e,_0x4ad950['options']);return _0x5d0df8['getTags'](_0x49025e);}})[_0x0c75('0x16')](function(_0x5ce419){if(_0x5ce419){_0x534eb3=_0x5ce419['length'];if(!_0x4ad950[_0x0c75('0x21')][_0x0c75('0x33')]('nolimit')){_0x49025e['limit']=qs['limit'](_0x4ad950[_0x0c75('0x21')][_0x0c75('0x12')]);_0x49025e[_0x0c75('0x10')]=qs['offset'](_0x4ad950[_0x0c75('0x21')][_0x0c75('0x10')]);}return _0x5d0df8[_0x0c75('0x87')](_0x49025e);}})['then'](function(_0x28633d){if(_0x28633d){return _0x28633d?{'count':_0x534eb3,'rows':_0x28633d}:null;}})['then'](respondWithResult(_0x56d989,null))['catch'](handleError(_0x56d989,null));};exports[_0x0c75('0x88')]=function(_0x4b5304,_0x2ed87b){if(_0x4b5304[_0x0c75('0x35')]['id']){delete _0x4b5304[_0x0c75('0x35')]['id'];}return db[_0x0c75('0x36')]['findOne']({'where':{'id':_0x4b5304[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x2ed87b,null))[_0x0c75('0x16')](function(_0x5f06a9){if(_0x5f06a9){return _0x5f06a9['setTags'](_0x4b5304[_0x0c75('0x35')][_0x0c75('0x89')]||[]);}return null;})[_0x0c75('0x16')](respondWithResult(_0x2ed87b,null))[_0x0c75('0x23')](handleError(_0x2ed87b,null));};exports[_0x0c75('0x8a')]=function(_0x2641e2,_0x4f3101){var _0x3167a1=[];_0x3167a1['push'](addAdditionalPhones(_0x2641e2['body']));Promise[_0x0c75('0x8b')](_0x3167a1)[_0x0c75('0x16')](function(){_0x3167a1=[];_0x3167a1[_0x0c75('0x5f')](deleteCmHopperPhones(_0x2641e2[_0x0c75('0x35')]['id']));_0x3167a1[_0x0c75('0x5f')](addCmHopperPhones(_0x2641e2[_0x0c75('0x35')]['id']));Promise[_0x0c75('0x8b')](_0x3167a1)[_0x0c75('0x16')](function(){return[0x1];})[_0x0c75('0x16')](respondWithResult(_0x4f3101,null));});};function addAdditionalPhones(_0x4e04f7){var _0x3f221b;return new Promise(function(_0x36508b){return db[_0x0c75('0x48')][_0x0c75('0x17')]({'where':{'CmContactId':_0x4e04f7['id']}})['then'](function(){db[_0x0c75('0x6a')][_0x0c75('0x20')]({'raw':!![],'attributes':['id',_0x0c75('0x8c')]})[_0x0c75('0x16')](function(_0x5e9d06){var _0x39bdc5=[];for(var _0xb2f606=0x0;_0xb2f606<_0x4e04f7[_0x0c75('0x8d')][_0x0c75('0x2a')];_0xb2f606++){var _0x6947e7=_0x4e04f7[_0x0c75('0x8e')]?_[_0x0c75('0x57')](_0x4e04f7[_0x0c75('0x8e')][_0xb2f606])?'':_0x4e04f7['item_types'][_0xb2f606]:_0x4e04f7['items'][_0xb2f606]['ItemTypeId']?_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x8f')]:'';var _0x2b32e3=_[_0x0c75('0x57')](_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x90')])?'':_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x90')];var _0x463cc9=_0x6947e7+':'+_0x4e04f7['items'][_0xb2f606][_0x0c75('0x7b')]+'§'+_0x2b32e3;if(_['isNil'](_0x3f221b))_0x3f221b=_0x463cc9;else _0x3f221b+=';'+_0x463cc9;var _0x527861=null;var _0x422756=null;if(_0x4e04f7[_0x0c75('0x8e')]){if(!_['isNil'](_0x4e04f7[_0x0c75('0x8e')][_0xb2f606])){_0x422756=_[_0x0c75('0x64')](_0x5e9d06,function(_0x28d312){return _0x28d312['id']===_0x4e04f7['item_types'][_0xb2f606];});if(!_[_0x0c75('0x57')](_0x422756)){_0x527861=_0x422756['OrderBy'];}}}else{if(!_['isNil'](_0x4e04f7[_0x0c75('0x8d')][_0xb2f606])){_0x422756=_[_0x0c75('0x64')](_0x5e9d06,function(_0x21a0a7){return _0x21a0a7['id']===_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x8f')];});if(!_[_0x0c75('0x57')](_0x422756)){_0x527861=_0xb2f606;}}}if(_[_0x0c75('0x57')](_0x527861)){_0x527861=0x64;}_0x39bdc5['push'](addAdditionalPhone(_0x4e04f7['id'],_0x4e04f7[_0x0c75('0x8d')][_0xb2f606]['phone'],_0x4e04f7[_0x0c75('0x8e')]?_[_0x0c75('0x57')](_0x4e04f7[_0x0c75('0x8e')][_0xb2f606])?null:_0x4e04f7['item_types'][_0xb2f606]:_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x8f')]?_0x4e04f7[_0x0c75('0x8d')][_0xb2f606][_0x0c75('0x8f')]:null,_0x527861,_0x2b32e3));}Promise[_0x0c75('0x8b')](_0x39bdc5)[_0x0c75('0x16')](function(){db[_0x0c75('0x36')]['update']({'AdditionalPhones':_0x3f221b},{'where':{'id':_0x4e04f7['id']}})[_0x0c75('0x16')](function(){_0x36508b(0x1);});});});});});}function addAdditionalPhone(_0x2f9327,_0x3a2d32,_0x1b5f8a,_0xc8e20,_0x12a329){return db[_0x0c75('0x48')][_0x0c75('0x64')]({'where':{'CmContactId':_0x2f9327,'item':_0x3a2d32}})['then'](function(_0x351769){if(_0x351769)logger[_0x0c75('0x30')](_0x0c75('0x91'),_0x351769);else{db[_0x0c75('0x48')]['create']({'CmContactId':_0x2f9327,'item':_0x3a2d32,'ItemTypeId':_0x1b5f8a,'OrderBy':_0xc8e20,'ItemClass':_0x0c75('0x92'),'description':_0x12a329});}});}function deleteCmHopperPhones(_0x5ef7e6){return new Promise(function(_0x598cdc){return db[_0x0c75('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5ef7e6}})[_0x0c75('0x16')](function(_0x6377b9){db[_0x0c75('0x93')][_0x0c75('0x17')]({'where':{'CmHopperId':{'$in':_[_0x0c75('0x74')](_0x6377b9,'id')}}});})[_0x0c75('0x16')](function(){_0x598cdc(0x1);});});}function addCmHopperPhones(_0x24af4c){return new Promise(function(_0x20b1d6){return db[_0x0c75('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x24af4c}})[_0x0c75('0x16')](function(_0x377053){var _0x6c2e4c=[];_[_0x0c75('0x74')](_0x377053,function(_0x5f4798){_0x6c2e4c[_0x0c75('0x5f')](createCmHopperPhone(_0x24af4c,_0x5f4798['id']));});Promise[_0x0c75('0x8b')](_0x6c2e4c)[_0x0c75('0x16')](function(){_0x20b1d6(0x1);});});});}function createCmHopperPhone(_0x3551a8,_0x39f410){return new Promise(function(_0x34a71d){db[_0x0c75('0x48')][_0x0c75('0x20')]({'raw':!![],'attributes':[_0x0c75('0x94'),_0x0c75('0x8c')],'where':{'CmContactId':_0x3551a8,'ItemClass':'PHONE'},'include':[{'model':db[_0x0c75('0x6a')],'attributes':[_0x0c75('0x8c')],'as':_0x0c75('0x6b')}],'order':['OrderBy',db['sequelize'][_0x0c75('0x6d')]('`ItemType`.OrderBy')]})[_0x0c75('0x16')](function(_0x287088){var _0x1e7fc5=0x1;var _0x3496d0=_[_0x0c75('0x74')](_0x287088,function(_0x1f96fc){_0x1f96fc[_0x0c75('0x95')]=_0x39f410;_0x1f96fc[_0x0c75('0x7b')]=_0x1f96fc[_0x0c75('0x94')];_0x1f96fc[_0x0c75('0x8c')]=_0x1e7fc5;delete _0x1f96fc[_0x0c75('0x96')];_0x1e7fc5=_0x1e7fc5+0x1;return _0x1f96fc;});return db[_0x0c75('0x93')][_0x0c75('0x97')](_0x3496d0,{});})[_0x0c75('0x16')](function(){_0x34a71d(0x1);});});}function insertAdditionalPhones(_0x382d57,_0x4fe3ca){return new Promise(function(_0x21bce2){var _0x331a16=[];for(var _0x4b5acb=0x0;_0x4b5acb<_0x4fe3ca[_0x0c75('0x2a')];_0x4b5acb++){var _0x22bada=_0x4fe3ca[_0x4b5acb];_0x331a16[_0x0c75('0x5f')](parseContactItemType(_0x22bada));}Promise[_0x0c75('0x8b')](_0x331a16)[_0x0c75('0x16')](function(){var _0x57e7f3={'id':_0x382d57['id'],'items':_0x4fe3ca};return addAdditionalPhones(_0x57e7f3)[_0x0c75('0x16')](function(){return addCmHopperPhones(_0x382d57['id']);});})[_0x0c75('0x16')](function(){_0x21bce2(_0x382d57);});});}function parseContactItemType(_0x19a23a){return new Promise(function(_0x843332){if(_0x19a23a[_0x0c75('0x33')](_0x0c75('0x8f'))){_0x843332(_0x19a23a);}else{return db[_0x0c75('0x6a')][_0x0c75('0x64')]({'where':{'name':_0x19a23a['ItemType']}})[_0x0c75('0x16')](function(_0xe0a4d2){if(_['isNil'](_0xe0a4d2))_0x19a23a['ItemTypeId']=null;else _0x19a23a['ItemTypeId']=_0xe0a4d2['id'];_0x843332(_0x19a23a);});}});}exports[_0x0c75('0x98')]=function(_0x597467,_0x1719c9){return db['CmContactHasItem'][_0x0c75('0x20')]({'raw':!![],'where':{'CmContactId':_0x597467[_0x0c75('0x24')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x0c75('0x6a')],'as':_0x0c75('0x6b')}],'order':[['OrderBy'],[db['sequelize']['literal'](_0x0c75('0x99'))]]})[_0x0c75('0x16')](function(_0x109e99){return _0x109e99;})[_0x0c75('0x16')](respondWithResult(_0x1719c9,null))[_0x0c75('0x23')](handleError(_0x1719c9,null));};exports['duplicateAdditionalPhones']=function(_0x2a52a6,_0x2a05fc){return db[_0x0c75('0x48')][_0x0c75('0x20')]({'raw':!![],'where':{'CmContactId':_0x2a52a6[_0x0c75('0x35')]['fromContactId']}})[_0x0c75('0x16')](function(_0x2d79b4){var _0x16353e=_[_0x0c75('0x74')](_0x2d79b4,function(_0x34231d){_0x34231d[_0x0c75('0x9a')]=_0x2a52a6['body'][_0x0c75('0x9b')];return _0x34231d;});return db['CmContactHasItem'][_0x0c75('0x97')](_0x16353e,{});})[_0x0c75('0x16')](function(){return addCmHopperPhones(_0x2a52a6[_0x0c75('0x35')][_0x0c75('0x9b')]);})[_0x0c75('0x16')](function(){return['ok'];})[_0x0c75('0x16')](respondWithResult(_0x2a05fc,null))[_0x0c75('0x23')](handleError(_0x2a05fc,null));};exports[_0x0c75('0x9c')]=function(_0x2c0409,_0xf63a14){var _0x2cf2df=[];_0x2cf2df[_0x0c75('0x5f')](createCmHopperPhone(_0x2c0409[_0x0c75('0x35')]['id'],_0x2c0409['body']['hopperId']));Promise[_0x0c75('0x8b')](_0x2cf2df)['then'](function(){return[0x1];})[_0x0c75('0x16')](respondWithResult(_0xf63a14,null));};exports[_0x0c75('0x9d')]=function(_0x28084a,_0x57baa7){var _0x4d8319={'raw':![],'where':{}};var _0x186708={};var _0x245696={'count':0x0,'rows':[]};return db[_0x0c75('0x36')][_0x0c75('0x7c')]({'where':{'id':_0x28084a[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x57baa7,null))[_0x0c75('0x16')](function(_0x25066c){if(_0x25066c){_0x186708[_0x0c75('0x7d')]=_[_0x0c75('0x25')](db[_0x0c75('0x3d')]['rawAttributes']);_0x186708[_0x0c75('0x21')]=_[_0x0c75('0x25')](_0x28084a[_0x0c75('0x21')]);_0x186708[_0x0c75('0x7f')]=_['intersection'](_0x186708[_0x0c75('0x7d')],_0x186708[_0x0c75('0x21')]);_0x4d8319[_0x0c75('0x81')]=_['intersection'](_0x186708['model'],qs[_0x0c75('0x82')](_0x28084a[_0x0c75('0x21')][_0x0c75('0x82')]));_0x4d8319[_0x0c75('0x81')]=_0x4d8319['attributes'][_0x0c75('0x2a')]?_0x4d8319[_0x0c75('0x81')]:_0x186708[_0x0c75('0x7d')];if(!_0x28084a[_0x0c75('0x21')][_0x0c75('0x33')]('nolimit')){_0x4d8319[_0x0c75('0x12')]=qs[_0x0c75('0x12')](_0x28084a[_0x0c75('0x21')][_0x0c75('0x12')]);_0x4d8319['offset']=qs[_0x0c75('0x10')](_0x28084a[_0x0c75('0x21')][_0x0c75('0x10')]);}_0x4d8319['order']=qs[_0x0c75('0x84')](_0x28084a['query'][_0x0c75('0x84')]);_0x4d8319[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_[_0x0c75('0x85')](_0x28084a[_0x0c75('0x21')],_0x186708['filters']));_0x4d8319[_0x0c75('0x5d')][_0x0c75('0x9e')]=_0x25066c['id'];if(_0x28084a[_0x0c75('0x21')][_0x0c75('0x86')]){_0x4d8319[_0x0c75('0x5d')]=_[_0x0c75('0x34')](_0x4d8319['where'],{'$or':_[_0x0c75('0x74')](_0x4d8319[_0x0c75('0x81')],function(_0x4a10b7){var _0x4e044f={};_0x4e044f[_0x4a10b7]={'$like':'%'+_0x28084a[_0x0c75('0x21')][_0x0c75('0x86')]+'%'};return _0x4e044f;})});}_0x4d8319=_[_0x0c75('0x34')]({},_0x4d8319,_0x28084a[_0x0c75('0x9f')]);return db[_0x0c75('0x3d')]['count']({'where':_0x4d8319[_0x0c75('0x5d')]})[_0x0c75('0x16')](function(_0x5159f1){_0x245696['count']=_0x5159f1;if(_0x28084a['query'][_0x0c75('0xa0')]){_0x4d8319[_0x0c75('0xa1')]=[{'all':!![]}];}return db['CmHopper'][_0x0c75('0x20')](_0x4d8319);})[_0x0c75('0x16')](function(_0x467e58){_0x245696[_0x0c75('0xa2')]=_0x467e58;return _0x245696;});}})['then'](respondWithFilteredResult(_0x57baa7,_0x4d8319))[_0x0c75('0x23')](handleError(_0x57baa7,null));};exports[_0x0c75('0xa3')]=function(_0x119b36,_0x203d13){var _0x1dde6b={'raw':!![],'where':{}};var _0x54bff5={};var _0x11f63c={'count':0x0,'rows':[]};return db[_0x0c75('0x36')][_0x0c75('0x7c')]({'where':{'id':_0x119b36['params']['id']}})['then'](handleEntityNotFound(_0x203d13,null))[_0x0c75('0x16')](function(_0x331375){if(_0x331375){_0x54bff5[_0x0c75('0x7d')]=_[_0x0c75('0x25')](db[_0x0c75('0x4a')][_0x0c75('0x7e')]);_0x54bff5[_0x0c75('0x21')]=_[_0x0c75('0x25')](_0x119b36['query']);_0x54bff5[_0x0c75('0x7f')]=_[_0x0c75('0x80')](_0x54bff5['model'],_0x54bff5[_0x0c75('0x21')]);_0x1dde6b['attributes']=_[_0x0c75('0x80')](_0x54bff5[_0x0c75('0x7d')],qs[_0x0c75('0x82')](_0x119b36[_0x0c75('0x21')]['fields']));_0x1dde6b[_0x0c75('0x81')]=_0x1dde6b[_0x0c75('0x81')]['length']?_0x1dde6b[_0x0c75('0x81')]:_0x54bff5['model'];if(!_0x119b36[_0x0c75('0x21')][_0x0c75('0x33')]('nolimit')){_0x1dde6b['limit']=qs[_0x0c75('0x12')](_0x119b36[_0x0c75('0x21')][_0x0c75('0x12')]);_0x1dde6b[_0x0c75('0x10')]=qs[_0x0c75('0x10')](_0x119b36[_0x0c75('0x21')][_0x0c75('0x10')]);}_0x1dde6b['order']=qs['sort'](_0x119b36[_0x0c75('0x21')][_0x0c75('0x84')]);_0x1dde6b[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_['pick'](_0x119b36[_0x0c75('0x21')],_0x54bff5[_0x0c75('0x7f')]));_0x1dde6b[_0x0c75('0x5d')][_0x0c75('0x9e')]=_0x331375['id'];if(_0x119b36[_0x0c75('0x21')]['filter']){_0x1dde6b[_0x0c75('0x5d')]=_[_0x0c75('0x34')](_0x1dde6b[_0x0c75('0x5d')],{'$or':_[_0x0c75('0x74')](_0x1dde6b[_0x0c75('0x81')],function(_0x2d2a96){var _0xe4835d={};_0xe4835d[_0x2d2a96]={'$like':'%'+_0x119b36[_0x0c75('0x21')][_0x0c75('0x86')]+'%'};return _0xe4835d;})});}_0x1dde6b=_[_0x0c75('0x34')]({},_0x1dde6b,_0x119b36[_0x0c75('0x9f')]);return db[_0x0c75('0x4a')][_0x0c75('0x13')]({'where':_0x1dde6b[_0x0c75('0x5d')]})['then'](function(_0x23d44b){_0x11f63c[_0x0c75('0x13')]=_0x23d44b;if(_0x119b36[_0x0c75('0x21')][_0x0c75('0xa0')]){_0x1dde6b['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1dde6b);})[_0x0c75('0x16')](function(_0x5e637a){_0x11f63c[_0x0c75('0xa2')]=_0x5e637a;return _0x11f63c;});}})[_0x0c75('0x16')](respondWithFilteredResult(_0x203d13,_0x1dde6b))[_0x0c75('0x23')](handleError(_0x203d13,null));};exports[_0x0c75('0xa4')]=function(_0x5d106f,_0xcef3c){var _0xe67e67={'raw':!![],'where':{}};var _0x28c650={};var _0x458d54={'count':0x0,'rows':[]};return db[_0x0c75('0x36')][_0x0c75('0x7c')]({'where':{'id':_0x5d106f['params']['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0xcef3c,null))[_0x0c75('0x16')](function(_0xf0f8a){if(_0xf0f8a){_0x28c650[_0x0c75('0x7d')]=_[_0x0c75('0x25')](db[_0x0c75('0x49')]['rawAttributes']);_0x28c650['query']=_[_0x0c75('0x25')](_0x5d106f[_0x0c75('0x21')]);_0x28c650[_0x0c75('0x7f')]=_['intersection'](_0x28c650[_0x0c75('0x7d')],_0x28c650[_0x0c75('0x21')]);_0xe67e67['attributes']=_[_0x0c75('0x80')](_0x28c650['model'],qs[_0x0c75('0x82')](_0x5d106f['query'][_0x0c75('0x82')]));_0xe67e67[_0x0c75('0x81')]=_0xe67e67['attributes']['length']?_0xe67e67[_0x0c75('0x81')]:_0x28c650[_0x0c75('0x7d')];if(!_0x5d106f[_0x0c75('0x21')][_0x0c75('0x33')](_0x0c75('0xa5'))){_0xe67e67[_0x0c75('0x12')]=qs['limit'](_0x5d106f[_0x0c75('0x21')][_0x0c75('0x12')]);_0xe67e67[_0x0c75('0x10')]=qs['offset'](_0x5d106f[_0x0c75('0x21')][_0x0c75('0x10')]);}_0xe67e67[_0x0c75('0x83')]=qs[_0x0c75('0x84')](_0x5d106f[_0x0c75('0x21')]['sort']);_0xe67e67[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_['pick'](_0x5d106f['query'],_0x28c650[_0x0c75('0x7f')]));_0xe67e67['where'][_0x0c75('0x9e')]=_0xf0f8a['id'];if(_0x5d106f[_0x0c75('0x21')][_0x0c75('0x86')]){_0xe67e67['where']=_[_0x0c75('0x34')](_0xe67e67[_0x0c75('0x5d')],{'$or':_['map'](_0xe67e67[_0x0c75('0x81')],function(_0x1a5cf0){var _0x264c56={};_0x264c56[_0x1a5cf0]={'$like':'%'+_0x5d106f[_0x0c75('0x21')][_0x0c75('0x86')]+'%'};return _0x264c56;})});}_0xe67e67=_[_0x0c75('0x34')]({},_0xe67e67,_0x5d106f[_0x0c75('0x9f')]);return db['CmHopperFinal']['count']({'where':_0xe67e67[_0x0c75('0x5d')]})[_0x0c75('0x16')](function(_0x44233c){_0x458d54[_0x0c75('0x13')]=_0x44233c;if(_0x5d106f[_0x0c75('0x21')][_0x0c75('0xa0')]){_0xe67e67[_0x0c75('0xa1')]=[{'all':!![]}];}return db[_0x0c75('0x49')]['findAll'](_0xe67e67);})[_0x0c75('0x16')](function(_0x5c217a){_0x458d54['rows']=_0x5c217a;return _0x458d54;});}})[_0x0c75('0x16')](respondWithFilteredResult(_0xcef3c,_0xe67e67))['catch'](handleError(_0xcef3c,null));};exports['getJscriptySessions']=function(_0x291af6,_0x5d898){var _0x19fd51={'raw':!![],'where':{}};var _0x578b9e={};var _0x19c3aa={'count':0x0,'rows':[]};return db['CmContact'][_0x0c75('0x7c')]({'where':{'id':_0x291af6[_0x0c75('0x24')]['id']}})[_0x0c75('0x16')](handleEntityNotFound(_0x5d898,null))[_0x0c75('0x16')](function(_0xce37f6){if(_0xce37f6){_0x578b9e[_0x0c75('0x7d')]=_[_0x0c75('0x25')](db['JscriptySessionReport']['rawAttributes']);_0x578b9e[_0x0c75('0x21')]=_[_0x0c75('0x25')](_0x291af6[_0x0c75('0x21')]);_0x578b9e['filters']=_[_0x0c75('0x80')](_0x578b9e[_0x0c75('0x7d')],_0x578b9e[_0x0c75('0x21')]);_0x19fd51['attributes']=_[_0x0c75('0x80')](_0x578b9e[_0x0c75('0x7d')],qs[_0x0c75('0x82')](_0x291af6[_0x0c75('0x21')][_0x0c75('0x82')]));_0x19fd51[_0x0c75('0x81')]=_0x19fd51[_0x0c75('0x81')]['length']?_0x19fd51['attributes']:_0x578b9e[_0x0c75('0x7d')];if(!_0x291af6[_0x0c75('0x21')][_0x0c75('0x33')](_0x0c75('0xa5'))){_0x19fd51[_0x0c75('0x12')]=qs['limit'](_0x291af6['query'][_0x0c75('0x12')]);_0x19fd51[_0x0c75('0x10')]=qs[_0x0c75('0x10')](_0x291af6['query']['offset']);}_0x19fd51[_0x0c75('0x83')]=qs['sort'](_0x291af6['query'][_0x0c75('0x84')]);_0x19fd51[_0x0c75('0x5d')]=qs[_0x0c75('0x7f')](_['pick'](_0x291af6[_0x0c75('0x21')],_0x578b9e[_0x0c75('0x7f')]));_0x19fd51[_0x0c75('0x5d')][_0x0c75('0x9e')]=_0xce37f6['id'];if(_0x291af6[_0x0c75('0x21')][_0x0c75('0x86')]){_0x19fd51['where']=_[_0x0c75('0x34')](_0x19fd51['where'],{'$or':_[_0x0c75('0x74')](_0x19fd51['attributes'],function(_0x402190){var _0x37fd7d={};_0x37fd7d[_0x402190]={'$like':'%'+_0x291af6['query'][_0x0c75('0x86')]+'%'};return _0x37fd7d;})});}_0x19fd51=_[_0x0c75('0x34')]({},_0x19fd51,_0x291af6[_0x0c75('0x9f')]);return db['JscriptySessionReport'][_0x0c75('0x13')]({'where':_0x19fd51['where']})['then'](function(_0x1c1372){_0x19c3aa[_0x0c75('0x13')]=_0x1c1372;if(_0x291af6[_0x0c75('0x21')][_0x0c75('0xa0')]){_0x19fd51[_0x0c75('0xa1')]=[{'all':!![]}];}return db[_0x0c75('0x51')][_0x0c75('0x20')](_0x19fd51);})['then'](function(_0x5a26b8){_0x19c3aa[_0x0c75('0xa2')]=_0x5a26b8;return _0x19c3aa;});}})[_0x0c75('0x16')](respondWithFilteredResult(_0x5d898,_0x19fd51))[_0x0c75('0x23')](handleError(_0x5d898,null));};exports['uploadCsv']=function(_0x2d4026,_0x512dfe){try{if(!_0x2d4026[_0x0c75('0x35')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x2d4026[_0x0c75('0x35')][_0x0c75('0xa6')]){throw new Error(_0x0c75('0xa7'));}if(!_0x2d4026['body'][_0x0c75('0xa8')]){throw new Error(_0x0c75('0xa9'));}if(!_0x2d4026[_0x0c75('0x35')][_0x0c75('0xaa')]){throw new Error(_0x0c75('0xab'));}var _0x51f995=_0x2d4026[_0x0c75('0x35')][_0x0c75('0xa6')][_0x0c75('0xac')](',');var _0x754af=_0x2d4026[_0x0c75('0x35')][_0x0c75('0xa8')][_0x0c75('0xac')](',');if(!_0x51f995['length']||!_0x754af[_0x0c75('0x2a')]||_0x51f995[_0x0c75('0x2a')]!==_0x754af[_0x0c75('0x2a')]){throw new Error(_0x0c75('0xad'));}_0x2d4026[_0x0c75('0x35')][_0x0c75('0x82')]=_[_0x0c75('0xae')](_0x51f995,_0x754af);if(!_0x2d4026[_0x0c75('0x35')][_0x0c75('0x82')][_0x0c75('0x7b')]){throw new Error(_0x0c75('0xaf'));}if(!_0x2d4026[_0x0c75('0x35')]['fields']['firstName']){throw new Error(_0x0c75('0xb0'));}var _0x19b19a=path[_0x0c75('0x56')](config[_0x0c75('0xb1')],_0x0c75('0xb2'),_0x2d4026[_0x0c75('0xb3')][_0x0c75('0xb4')]);fs[_0x0c75('0xb5')](_0x19b19a,parseInt(_0x0c75('0xb6'),0x8));var _0x11f942=require(_0x0c75('0xb7'))[_0x0c75('0xb8')](path['join'](__dirname,_0x0c75('0xb9')),[_0x19b19a,_0x2d4026['body'][_0x0c75('0xa6')],_0x2d4026[_0x0c75('0x35')][_0x0c75('0xa8')],_0x2d4026[_0x0c75('0x35')][_0x0c75('0x60')],_0x2d4026['body'][_0x0c75('0xba')],_0x2d4026[_0x0c75('0x35')][_0x0c75('0x5c')],_0x2d4026[_0x0c75('0x35')][_0x0c75('0xaa')]]);return _0x512dfe['status'](0xc8)[_0x0c75('0xf')]({'message':_0x0c75('0xbb'),'pid':_0x11f942['pid']});}catch(_0x4d8462){return _0x512dfe[_0x0c75('0xe')](0x1f4)['send'](_0x4d8462);}};exports[_0x0c75('0xbc')]=function(_0x500dbf,_0x11d86d){var _0x2a5977=fs['createReadStream'](_0x500dbf['file'][_0x0c75('0x3')]);Papa[_0x0c75('0xbd')](_0x2a5977,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x475efb){return _0x11d86d['status'](0xc8)['json']({'file':_0x500dbf[_0x0c75('0xb3')],'fields':_0x475efb['meta'][_0x0c75('0x82')]});}});};exports[_0x0c75('0xbe')]=function(_0x49beed,_0x1035ae){return db['User'][_0x0c75('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0c75('0xbf')}})[_0x0c75('0x16')](function(_0xa2cb62){var _0x512fa5=![];if(!_0x49beed[_0x0c75('0x35')][_0x0c75('0x60')]){throw new Error(_0x0c75('0xc0'));}if(!_0x49beed[_0x0c75('0x35')][_0x0c75('0xc1')]['phone']){throw new Error(_0x0c75('0xaf'));}if(!_0x49beed[_0x0c75('0x35')][_0x0c75('0xc1')][_0x0c75('0xc2')]){throw new Error(_0x0c75('0xb0'));}if(!_0x49beed[_0x0c75('0x35')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3ab176=require('child_process')[_0x0c75('0xb8')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x49beed[_0x0c75('0x24')]['id'],JSON[_0x0c75('0xc3')](_0x49beed[_0x0c75('0x35')]),JSON[_0x0c75('0xc3')](_0xa2cb62)]);_0x3ab176['on']('message',function(){_0x512fa5=!![];return _0x1035ae[_0x0c75('0xe')](0xc8)[_0x0c75('0xf')]({'message':_0x0c75('0xc4'),'pid':_0x3ab176[_0x0c75('0xc5')]});});_0x3ab176['on']('exit',function(_0x4f7f0f){if(_0x4f7f0f&&!_0x512fa5){return _0x1035ae[_0x0c75('0xe')](0x1f4)['json']({'message':_0x0c75('0xc6'),'pid':_0x3ab176[_0x0c75('0xc5')]});}});})[_0x0c75('0x23')](handleError(_0x1035ae,null));};exports[_0x0c75('0xc7')]=function(_0x1e1f44,_0x235a8a){return db[_0x0c75('0xc8')][_0x0c75('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x0c75('0x16')](function(_0x1a9d9c){var _0x3cbdd8=![];if(!_0x1e1f44['body'][_0x0c75('0x60')]){throw new Error(_0x0c75('0xc0'));}if(!_0x1e1f44[_0x0c75('0x35')][_0x0c75('0xc1')][_0x0c75('0x7b')]){throw new Error(_0x0c75('0xaf'));}if(!_0x1e1f44['body'][_0x0c75('0xc1')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1e1f44[_0x0c75('0x35')][_0x0c75('0xaa')]){throw new Error(_0x0c75('0xab'));}var _0x130fba=require('child_process')[_0x0c75('0xb8')](path[_0x0c75('0x56')](__dirname,'../../components/import/cm/csvUpdates'),[_0x1e1f44[_0x0c75('0x24')]['id'],JSON[_0x0c75('0xc3')](_0x1e1f44[_0x0c75('0x35')]),JSON[_0x0c75('0xc3')](_0x1a9d9c)]);_0x130fba['on'](_0x0c75('0xc9'),function(){_0x3cbdd8=!![];return _0x235a8a['status'](0xc8)[_0x0c75('0xf')]({'message':_0x0c75('0xc4'),'pid':_0x130fba[_0x0c75('0xc5')]});});_0x130fba['on'](_0x0c75('0xca'),function(_0x152a78){if(_0x152a78&&!_0x3cbdd8){return _0x235a8a[_0x0c75('0xe')](0x1f4)[_0x0c75('0xf')]({'message':_0x0c75('0xc6'),'pid':_0x130fba[_0x0c75('0xc5')]});}});})[_0x0c75('0x23')](handleError(_0x235a8a,null));};exports['getJourney']=function(_0x887f4c,_0xe6c2e){var _0x22f62f=[_0x0c75('0xcb'),_0x0c75('0xcc'),_0x0c75('0xcd'),_0x0c75('0xce'),_0x0c75('0xcf'),_0x0c75('0xd0'),_0x0c75('0xd1')];var _0x25dbd1={'offset':0x0,'order':qs[_0x0c75('0x84')](_0x0c75('0xd2'))},_0x22ccad={'count':0x0,'rows':[]};Promise['resolve']()[_0x0c75('0x16')](function(){if(_0x887f4c[_0x0c75('0x21')][_0x0c75('0xd3')]){if(!_[_0x0c75('0xd4')](_0x22f62f,_0x887f4c['query']['channel']['toLowerCase']())){throw new Error(_0x0c75('0xd5'));}_0x22f62f=[_0x887f4c['query'][_0x0c75('0xd3')]['toLowerCase']()];}if(_0x887f4c[_0x0c75('0x21')][_0x0c75('0xd6')]){try{var _0x3f48f5=JSON[_0x0c75('0xbd')](_0x887f4c[_0x0c75('0x21')]['range']);if(!moment(_0x3f48f5[_0x0c75('0x37')])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x3f48f5['to'])[_0x0c75('0xd7')]()){throw new Error(_0x0c75('0xd8'));}}catch(_0x9da7c4){throw new Error(_0x0c75('0xd9'));}}if(!_0x887f4c[_0x0c75('0x21')]['hasOwnProperty']('nolimit')){_0x25dbd1['limit']=qs['limit'](_0x887f4c[_0x0c75('0x21')]['limit']||0xa);_0x25dbd1['offset']=qs[_0x0c75('0x10')](_0x887f4c[_0x0c75('0x21')][_0x0c75('0x10')]);}var _0x3ed1cc=_0x22f62f[_0x0c75('0x74')](function(_0x1abc1d){if(_0x1abc1d==='voice'){var _0xa1a4f3={'attributes':['id',_0x0c75('0xda'),_0x0c75('0x2e'),_0x0c75('0xdb'),_0x0c75('0xdc'),_0x0c75('0xdd'),_0x0c75('0xde'),'endtime',_0x0c75('0xdf'),_0x0c75('0xe0'),_0x0c75('0xe1'),_0x0c75('0xe2'),'userSecondDisposition',_0x0c75('0xe3'),_0x0c75('0xe4')],'where':{'ContactId':_0x887f4c['params']['id']},'include':[{'model':db[_0x0c75('0xc8')],'as':_0x0c75('0xc8'),'attributes':['id',_0x0c75('0x1b'),_0x0c75('0xe5'),'alias']}],'order':[[_0x0c75('0xe1'),_0x0c75('0xe6')]]};if(_0x887f4c['query']['range']){_0xa1a4f3[_0x0c75('0x5d')]['createdAt']={'$gte':_0x3f48f5[_0x0c75('0x37')],'$lte':_0x3f48f5['to']};}return db[_0x0c75('0x4c')]['findAndCountAll'](_0xa1a4f3)[_0x0c75('0x16')](function(_0x4b4933){_0x22ccad[_0x0c75('0x13')]+=_0x4b4933[_0x0c75('0x13')];return _[_0x0c75('0x74')](_0x4b4933['rows'],function(_0x55ba76){var _0x406f12=_0x55ba76[_0x0c75('0x38')]({'plain':!![]});_0x406f12[_0x0c75('0xd3')]=_0x1abc1d;if(_0x406f12['User']){_0x406f12[_0x0c75('0xc8')]={'id':_0x406f12[_0x0c75('0xc8')]['id'],'name':_0x406f12[_0x0c75('0xc8')][_0x0c75('0x1b')],'fullname':_0x406f12[_0x0c75('0xc8')][_0x0c75('0xe5')],'alias':_0x406f12[_0x0c75('0xc8')]['alias']};}return _0x406f12;});});}else{var _0x9f6630=_['startCase'](_0x1abc1d)+(_0x1abc1d===_0x0c75('0xcc')?'Website':_0x0c75('0xe7'));var _0x2968c1={'attributes':['id',_0x0c75('0xe8'),_0x0c75('0xe9'),'createdAt',_0x0c75('0xe0'),_0x0c75('0xea'),'secondDisposition',_0x0c75('0xeb'),_0x0c75('0xe4'),_0x9f6630+'Id'],'where':{'ContactId':_0x887f4c[_0x0c75('0x24')]['id']},'include':[{'model':db[_0x9f6630],'as':'Account','attributes':['id',_0x0c75('0x1b'),_0x0c75('0xec')]},{'model':db[_0x0c75('0xc8')],'as':_0x0c75('0xed'),'attributes':['id','name','fullname']},{'model':db['Tag'],'as':_0x0c75('0x66'),'attributes':['id',_0x0c75('0x1b'),'color'],'through':{'attributes':[]}}],'order':[[_0x0c75('0xe1'),_0x0c75('0xe6')]]};if(_0x887f4c[_0x0c75('0x21')][_0x0c75('0xd6')]){_0x2968c1['where'][_0x0c75('0xe1')]={'$gte':_0x3f48f5[_0x0c75('0x37')],'$lte':_0x3f48f5['to']};}switch(_0x1abc1d){case _0x0c75('0xcc'):_0x2968c1[_0x0c75('0x81')][_0x0c75('0x5f')]('browserName',_0x0c75('0xee'),_0x0c75('0xef'),'deviceModel',_0x0c75('0xf0'),'ratingMessage',_0x0c75('0xf1'),_0x0c75('0xf2'),_0x0c75('0xf3'));break;case _0x0c75('0xcb'):_0x2968c1[_0x0c75('0x81')][_0x0c75('0x5f')](_0x0c75('0xf4'),_0x0c75('0xf5'));break;case _0x0c75('0xce'):_0x2968c1['attributes']['push'](_0x0c75('0xf6'),_0x0c75('0xf7'));break;}return db[_[_0x0c75('0xf8')](_0x1abc1d)+_0x0c75('0xf9')]['findAndCountAll'](_0x2968c1)[_0x0c75('0x16')](function(_0x384c46){_0x22ccad[_0x0c75('0x13')]+=_0x384c46['count'];return _['map'](_0x384c46[_0x0c75('0xa2')],function(_0x700761){var _0x435bdd=_0x700761['get']({'plain':!![]});_0x435bdd[_0x0c75('0xd3')]=_0x1abc1d;if(_0x435bdd[_0x0c75('0xed')]){_0x435bdd['Owner']={'id':_0x435bdd[_0x0c75('0xed')]['id'],'name':_0x435bdd[_0x0c75('0xed')][_0x0c75('0x1b')],'fullname':_0x435bdd['Owner'][_0x0c75('0xe5')]};}return _0x435bdd;});});}});return Promise['all'](_0x3ed1cc);})[_0x0c75('0x16')](function(_0x4c2202){return _(_0x4c2202)[_0x0c75('0xfa')]()[_0x0c75('0xfb')]('createdAt')['reverse']()['value']();})['then'](function(_0x5bd6a6){_0x22ccad['rows']=_0x25dbd1[_0x0c75('0x12')]?_0x5bd6a6[_0x0c75('0xfc')](_0x25dbd1[_0x0c75('0x10')],_0x25dbd1['offset']+_0x25dbd1[_0x0c75('0x12')]):_0x5bd6a6;return _0x22ccad;})[_0x0c75('0x16')](respondWithFilteredResult(_0xe6c2e,_0x25dbd1))['catch'](handleError(_0xe6c2e,null));}; \ No newline at end of file +var _0xbfcb=['fields','order','filter','include','rows','getHopperHistories','rawAttributes','ContactId','count','CmHopperFinal','pick','includeAll','getJscriptySessions','nolimit','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','No\x20ListId\x20specified','binding','fork','stringify','start\x20child\x20process\x20correctly!','exit','importUpdates','../../components/import/cm/csvUpdates','message','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','toLowerCase','Invalid\x20channel','channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','Website','closed','closedAt','disposition','thirdDisposition','Account','key','Owner','browserName','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','limit','set','Content-Range','update','destroy','sendStatus','stack','name','send','describe','then','findAll','query','user','catch','CmContact','find','params','tags','keys','cf_','columnName','analytics','CmCustomField','displayName','alias','custom','type','values','info','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','length','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsMessage','FaxInteraction','FaxMessage','CmContactHasItem','CmHopperHistory','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','create','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','contact','all','show','Tags','color','tag','Phones','ItemType','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','startsWith','isEmpty','table','id\x20=\x20?','sequelize','text','phone','findOne','model','Tag','filters','intersection','attributes','sort','options','getTags','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','description','ItemTypeId','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfcb,0x69));var _0xbbfc=function(_0x19707a,_0x46a4b1){_0x19707a=_0x19707a-0x0;var _0xa0f2b6=_0xbfcb[_0x19707a];return _0xa0f2b6;};'use strict';var moment=require(_0xbbfc('0x0'));var BPromise=require(_0xbbfc('0x1'));var util=require(_0xbbfc('0x2'));var path=require(_0xbbfc('0x3'));var fs=require('fs');var _=require(_0xbbfc('0x4'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xbbfc('0x5'));var contacts=require(_0xbbfc('0x6'));var qs=require(_0xbbfc('0x7'));var logger=require(_0xbbfc('0x8'))(_0xbbfc('0x9'));var config=require(_0xbbfc('0xa'));var shared=require(_0xbbfc('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xbbfc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbfc('0xd'))(new Redis(config['redis']));require(_0xbbfc('0xe'))['register'](socket);function respondWithResult(_0xdefebe,_0x46d591){_0x46d591=_0x46d591||0xc8;return function(_0x51c904){if(_0x51c904){return _0xdefebe[_0xbbfc('0xf')](_0x46d591)[_0xbbfc('0x10')](_0x51c904);}};}function respondWithFilteredResult(_0x417336,_0x434385){return function(_0xabf66e){if(_0xabf66e){var _0xf1685a=typeof _0x434385[_0xbbfc('0x11')]===_0xbbfc('0x12')&&typeof _0x434385[_0xbbfc('0x13')]===_0xbbfc('0x12');var _0x14988c=_0xabf66e['count'];var _0x5d1f90=_0xf1685a?0x0:_0x434385[_0xbbfc('0x11')];var _0x48fc76=_0xf1685a?_0xabf66e['count']:_0x434385[_0xbbfc('0x11')]+_0x434385['limit'];var _0xec846e;if(_0x48fc76>=_0x14988c){_0x48fc76=_0x14988c;_0xec846e=0xc8;}else{_0xec846e=0xce;}_0x417336['status'](_0xec846e);return _0x417336[_0xbbfc('0x14')](_0xbbfc('0x15'),_0x5d1f90+'-'+_0x48fc76+'/'+_0x14988c)[_0xbbfc('0x10')](_0xabf66e);}return null;};}function saveUpdates(_0x5a29c6){return function(_0x3ec825){if(_0x3ec825){return _0x3ec825[_0xbbfc('0x16')](_0x5a29c6)['then'](function(_0x4a5840){return _0x4a5840;});}return null;};}function removeEntity(_0x1342e6){return function(_0x280c4b){if(_0x280c4b){return _0x280c4b[_0xbbfc('0x17')]()['then'](function(){_0x1342e6[_0xbbfc('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a217b){return function(_0x29bc50){if(!_0x29bc50){_0x1a217b[_0xbbfc('0x18')](0x194);}return _0x29bc50;};}function handleError(_0x25c0cf,_0x4e9f06){_0x4e9f06=_0x4e9f06||0x1f4;return function(_0x2fed4a){logger['error'](_0x2fed4a[_0xbbfc('0x19')]);if(_0x2fed4a[_0xbbfc('0x1a')]){delete _0x2fed4a[_0xbbfc('0x1a')];}_0x25c0cf[_0xbbfc('0xf')](_0x4e9f06)[_0xbbfc('0x1b')](_0x2fed4a);};}exports['index']=function(_0x42242c,_0x521441){var _0x3a5521={};return contacts[_0xbbfc('0x1c')]()[_0xbbfc('0x1d')](function(_0x197a23){_0x3a5521=qs['getOptions'](_0x197a23,_0x42242c);return contacts[_0xbbfc('0x1e')](_0x42242c[_0xbbfc('0x1f')],_0x42242c[_0xbbfc('0x20')],_0x3a5521,_0x197a23);})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x521441,_0x3a5521))[_0xbbfc('0x21')](handleError(_0x521441,null));};exports[_0xbbfc('0x17')]=function(_0x96d435,_0x5e888f){return db[_0xbbfc('0x22')][_0xbbfc('0x23')]({'where':{'id':_0x96d435[_0xbbfc('0x24')]['id']}})['then'](handleEntityNotFound(_0x5e888f,null))[_0xbbfc('0x1d')](removeEntity(_0x5e888f,null))[_0xbbfc('0x21')](handleError(_0x5e888f,null));};exports[_0xbbfc('0x1c')]=function(_0x512aae,_0x10010f){return db[_0xbbfc('0x22')][_0xbbfc('0x1c')]()[_0xbbfc('0x1d')](function(_0x35365b){delete _0x35365b[_0xbbfc('0x25')];for(var _0x2d2da3=0x0;_0x2d2da30x0){return new Promise(function(_0x57bbfd){var _0x23e0b4=[];for(var _0x54bad4=0x0;_0x54bad4<_0x2ec47f[_0xbbfc('0x39')];_0x54bad4++){_0x23e0b4[_0xbbfc('0x5b')](insertAdditionalPhones(_0x2ec47f[_0x54bad4][_0xbbfc('0x5e')],_0x2ec47f[_0x54bad4]['additionalPhones']));}Promise[_0xbbfc('0x5f')](_0x23e0b4)['then'](function(){_0x57bbfd(0x1);});})['then'](function(){return{'success':_0x33951d,'failure':_0x31e3dc,'duplicates':_0x26d673};});}else{return{'success':_0x33951d,'failure':_0x31e3dc,'duplicates':_0x26d673};}}})[_0xbbfc('0x1d')](respondWithResult(_0x5a027c,0xc9))[_0xbbfc('0x21')](handleError(_0x5a027c,null));};exports[_0xbbfc('0x60')]=function(_0x35b1b3,_0x19c1dd){var _0xc48479;return db[_0xbbfc('0x22')][_0xbbfc('0x1c')]()[_0xbbfc('0x1d')](function(_0x106bf4){return db['CmContact'][_0xbbfc('0x23')]({'where':{'id':_0x35b1b3[_0xbbfc('0x24')]['id']},'include':[{'model':db['Tag'],'as':_0xbbfc('0x61'),'attributes':['id',_0xbbfc('0x1a'),_0xbbfc('0x62')],'required':_0x35b1b3['query'][_0xbbfc('0x63')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xbbfc('0x64'),'where':{'CmContactId':_0x35b1b3[_0xbbfc('0x24')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xbbfc('0x65')}]}],'order':[db['sequelize'][_0xbbfc('0x66')](_0xbbfc('0x67'))],'attributes':_[_0xbbfc('0x26')](_0x106bf4)});})['then'](function(_0x329155){if(!_[_0xbbfc('0x52')](_0x329155)){_0xc48479=_0x329155[_0xbbfc('0x36')]({'plain':!![]});var _0x2f9519={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x329155&&_0x329155[_0xbbfc('0x5c')]){if(_0x329155['ListId']){_0x2f9519[_0xbbfc('0x59')][_0xbbfc('0x68')][_0xbbfc('0x5b')]({'ListId':{'$ne':_0x329155[_0xbbfc('0x5c')]}});}}return db['CmCustomField'][_0xbbfc('0x1e')](_0x2f9519);}})[_0xbbfc('0x1d')](function(_0x87b8){if(!_[_0xbbfc('0x52')](_0x87b8)){return _[_0xbbfc('0x69')](_0xc48479,_[_0xbbfc('0x6a')](_0x87b8,function(_0x5e4c36){return util[_0xbbfc('0x6b')](_0xbbfc('0x6c'),_0x5e4c36['id']);}));}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x19c1dd,null))[_0xbbfc('0x1d')](respondWithResult(_0x19c1dd,null))[_0xbbfc('0x21')](handleError(_0x19c1dd,null));};exports[_0xbbfc('0x16')]=function(_0x40deed,_0x2d18a0){var _0x2a164c;if(_0x40deed[_0xbbfc('0x34')]['id']){delete _0x40deed['body']['id'];}if(!_[_0xbbfc('0x52')](_0x40deed[_0xbbfc('0x34')][_0xbbfc('0x51')])){var _0x382f5b=_0x40deed[_0xbbfc('0x34')]['dialTimezone'];if(!_['isNil'](shared[_0xbbfc('0x53')][_0x382f5b]))_0x40deed[_0xbbfc('0x34')][_0xbbfc('0x54')]=shared[_0xbbfc('0x53')][_0x382f5b][_0xbbfc('0x54')];}return db[_0xbbfc('0x22')]['find']({'where':{'id':_0x40deed[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x2d18a0,null))['then'](saveUpdates(_0x40deed[_0xbbfc('0x34')],null))[_0xbbfc('0x1d')](function(_0x2ab09b){_0x2a164c=_0x2ab09b;var _0x2981dc={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2ab09b&&_0x2ab09b[_0xbbfc('0x5c')]){if(_0x2ab09b[_0xbbfc('0x5c')]){_0x2981dc['where']['$and'][_0xbbfc('0x5b')]({'ListId':{'$ne':_0x2ab09b['ListId']}});}}return db[_0xbbfc('0x2a')][_0xbbfc('0x1e')](_0x2981dc);})['then'](function(_0x20db0d){if(_0x20db0d){return _[_0xbbfc('0x69')](_['pickBy'](_0x40deed['body'],function(_0xb25c03,_0x187588){return _[_0xbbfc('0x6d')](_0x187588,_0xbbfc('0x27'));}),_['map'](_0x20db0d,function(_0xf0afc6){return util['format'](_0xbbfc('0x6c'),_0xf0afc6['id']);}));}})['then'](function(_0x4682b4){if(_0x4682b4&&!_[_0xbbfc('0x6e')](_0x4682b4)){var _0x5d7cc5=squel[_0xbbfc('0x16')]()[_0xbbfc('0x6f')]('cm_contacts')['setFields'](_0x4682b4)[_0xbbfc('0x59')](_0xbbfc('0x70'),_0x40deed[_0xbbfc('0x24')]['id'])['toParam']();return db[_0xbbfc('0x71')][_0xbbfc('0x1f')](_0x5d7cc5[_0xbbfc('0x72')],{'replacements':_0x5d7cc5['values']});}})[_0xbbfc('0x1d')](function(){if(_0x40deed[_0xbbfc('0x34')][_0xbbfc('0x73')]&&_0x2a164c){return db[_0xbbfc('0x3c')][_0xbbfc('0x16')]({'phone':_0x40deed[_0xbbfc('0x34')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x2a164c['id']}});}})[_0xbbfc('0x1d')](function(){return _0x2a164c;})[_0xbbfc('0x1d')](respondWithResult(_0x2d18a0,null))[_0xbbfc('0x21')](handleError(_0x2d18a0,null));};exports['getTags']=function(_0x47bed2,_0x2c79a4){var _0x5893ca={};var _0x21f480={};var _0x2bd004;var _0x281cd9;return db['CmContact'][_0xbbfc('0x74')]({'where':{'id':_0x47bed2[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x2c79a4,null))[_0xbbfc('0x1d')](function(_0x1a9629){if(_0x1a9629){_0x2bd004=_0x1a9629;_0x21f480[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db[_0xbbfc('0x76')]['rawAttributes']);_0x21f480[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x47bed2['query']);_0x21f480[_0xbbfc('0x77')]=_['intersection'](_0x21f480[_0xbbfc('0x75')],_0x21f480[_0xbbfc('0x1f')]);_0x5893ca['attributes']=_[_0xbbfc('0x78')](_0x21f480[_0xbbfc('0x75')],qs['fields'](_0x47bed2[_0xbbfc('0x1f')]['fields']));_0x5893ca[_0xbbfc('0x79')]=_0x5893ca[_0xbbfc('0x79')]['length']?_0x5893ca[_0xbbfc('0x79')]:_0x21f480[_0xbbfc('0x75')];_0x5893ca['order']=qs[_0xbbfc('0x7a')](_0x47bed2[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x5893ca[_0xbbfc('0x59')]=qs[_0xbbfc('0x77')](_['pick'](_0x47bed2[_0xbbfc('0x1f')],_0x21f480['filters']));if(_0x47bed2[_0xbbfc('0x1f')]['filter']){_0x5893ca['where']=_['merge'](_0x5893ca[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x5893ca[_0xbbfc('0x79')],function(_0x188f2d){var _0x5f05ab={};_0x5f05ab[_0x188f2d]={'$like':'%'+_0x47bed2['query']['filter']+'%'};return _0x5f05ab;})});}_0x5893ca=_[_0xbbfc('0x33')]({},_0x5893ca,_0x47bed2[_0xbbfc('0x7b')]);return _0x2bd004[_0xbbfc('0x7c')](_0x5893ca);}})[_0xbbfc('0x1d')](function(_0x35bb3e){if(_0x35bb3e){_0x281cd9=_0x35bb3e[_0xbbfc('0x39')];if(!_0x47bed2['query'][_0xbbfc('0x32')]('nolimit')){_0x5893ca['limit']=qs[_0xbbfc('0x13')](_0x47bed2[_0xbbfc('0x1f')][_0xbbfc('0x13')]);_0x5893ca['offset']=qs['offset'](_0x47bed2[_0xbbfc('0x1f')][_0xbbfc('0x11')]);}return _0x2bd004[_0xbbfc('0x7c')](_0x5893ca);}})[_0xbbfc('0x1d')](function(_0x3ee6d7){if(_0x3ee6d7){return _0x3ee6d7?{'count':_0x281cd9,'rows':_0x3ee6d7}:null;}})[_0xbbfc('0x1d')](respondWithResult(_0x2c79a4,null))[_0xbbfc('0x21')](handleError(_0x2c79a4,null));};exports['setTags']=function(_0x16e884,_0x203451){if(_0x16e884[_0xbbfc('0x34')]['id']){delete _0x16e884['body']['id'];}return db['CmContact']['findOne']({'where':{'id':_0x16e884[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x203451,null))['then'](function(_0x36b8c3){if(_0x36b8c3){return _0x36b8c3[_0xbbfc('0x7d')](_0x16e884['body'][_0xbbfc('0x7e')]||[]);}return null;})[_0xbbfc('0x1d')](respondWithResult(_0x203451,null))[_0xbbfc('0x21')](handleError(_0x203451,null));};exports[_0xbbfc('0x7f')]=function(_0x222892,_0x2629b1){var _0x551e8b=[];_0x551e8b[_0xbbfc('0x5b')](addAdditionalPhones(_0x222892[_0xbbfc('0x34')]));Promise[_0xbbfc('0x5f')](_0x551e8b)['then'](function(){_0x551e8b=[];_0x551e8b['push'](deleteCmHopperPhones(_0x222892['body']['id']));_0x551e8b[_0xbbfc('0x5b')](addCmHopperPhones(_0x222892['body']['id']));Promise[_0xbbfc('0x5f')](_0x551e8b)[_0xbbfc('0x1d')](function(){return[0x1];})['then'](respondWithResult(_0x2629b1,null));});};function addAdditionalPhones(_0xd2f449){var _0x364619;return new Promise(function(_0x4ceab4){return db[_0xbbfc('0x48')][_0xbbfc('0x17')]({'where':{'CmContactId':_0xd2f449['id']}})[_0xbbfc('0x1d')](function(){db[_0xbbfc('0x80')]['findAll']({'raw':!![],'attributes':['id',_0xbbfc('0x81')]})['then'](function(_0x20021c){var _0x175c89=[];for(var _0x2aa451=0x0;_0x2aa451<_0xd2f449[_0xbbfc('0x82')]['length'];_0x2aa451++){var _0x22c591=_0xd2f449[_0xbbfc('0x83')]?_['isNil'](_0xd2f449[_0xbbfc('0x83')][_0x2aa451])?'':_0xd2f449[_0xbbfc('0x83')][_0x2aa451]:_0xd2f449['items'][_0x2aa451]['ItemTypeId']?_0xd2f449[_0xbbfc('0x82')][_0x2aa451]['ItemTypeId']:'';var _0x3408ce=_[_0xbbfc('0x52')](_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x84')])?'':_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x84')];var _0x4d6df4=_0x22c591+':'+_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x73')]+'§'+_0x3408ce;if(_[_0xbbfc('0x52')](_0x364619))_0x364619=_0x4d6df4;else _0x364619+=';'+_0x4d6df4;var _0x2dc418=null;var _0x20d846=null;if(_0xd2f449[_0xbbfc('0x83')]){if(!_['isNil'](_0xd2f449[_0xbbfc('0x83')][_0x2aa451])){_0x20d846=_[_0xbbfc('0x23')](_0x20021c,function(_0x32acae){return _0x32acae['id']===_0xd2f449['item_types'][_0x2aa451];});if(!_[_0xbbfc('0x52')](_0x20d846)){_0x2dc418=_0x20d846[_0xbbfc('0x81')];}}}else{if(!_['isNil'](_0xd2f449[_0xbbfc('0x82')][_0x2aa451])){_0x20d846=_['find'](_0x20021c,function(_0x2df28c){return _0x2df28c['id']===_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x85')];});if(!_['isNil'](_0x20d846)){_0x2dc418=_0x2aa451;}}}if(_[_0xbbfc('0x52')](_0x2dc418)){_0x2dc418=0x64;}_0x175c89[_0xbbfc('0x5b')](addAdditionalPhone(_0xd2f449['id'],_0xd2f449['items'][_0x2aa451][_0xbbfc('0x73')],_0xd2f449[_0xbbfc('0x83')]?_['isNil'](_0xd2f449[_0xbbfc('0x83')][_0x2aa451])?null:_0xd2f449['item_types'][_0x2aa451]:_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x85')]?_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x85')]:null,_0x2dc418,_0x3408ce));}Promise[_0xbbfc('0x5f')](_0x175c89)[_0xbbfc('0x1d')](function(){db['CmContact'][_0xbbfc('0x16')]({'AdditionalPhones':_0x364619},{'where':{'id':_0xd2f449['id']}})['then'](function(){_0x4ceab4(0x1);});});});});});}function addAdditionalPhone(_0x4d40b3,_0x131949,_0x383c89,_0x335544,_0x2618fa){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x4d40b3,'item':_0x131949}})[_0xbbfc('0x1d')](function(_0x559b38){if(_0x559b38)logger['info'](_0xbbfc('0x86'),_0x559b38);else{db['CmContactHasItem'][_0xbbfc('0x50')]({'CmContactId':_0x4d40b3,'item':_0x131949,'ItemTypeId':_0x383c89,'OrderBy':_0x335544,'ItemClass':'PHONE','description':_0x2618fa});}});}function deleteCmHopperPhones(_0x53142a){return new Promise(function(_0x4dec7b){return db[_0xbbfc('0x3c')][_0xbbfc('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x53142a}})[_0xbbfc('0x1d')](function(_0x53137e){db[_0xbbfc('0x87')]['destroy']({'where':{'CmHopperId':{'$in':_[_0xbbfc('0x6a')](_0x53137e,'id')}}});})[_0xbbfc('0x1d')](function(){_0x4dec7b(0x1);});});}function addCmHopperPhones(_0x979a9c){return new Promise(function(_0x5732ed){return db[_0xbbfc('0x3c')][_0xbbfc('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x979a9c}})[_0xbbfc('0x1d')](function(_0x31539d){var _0x4256e0=[];_[_0xbbfc('0x6a')](_0x31539d,function(_0x406288){_0x4256e0['push'](createCmHopperPhone(_0x979a9c,_0x406288['id']));});Promise[_0xbbfc('0x5f')](_0x4256e0)[_0xbbfc('0x1d')](function(){_0x5732ed(0x1);});});});}function createCmHopperPhone(_0xfd9f31,_0x119d3f){return new Promise(function(_0x59e461){db[_0xbbfc('0x48')][_0xbbfc('0x1e')]({'raw':!![],'attributes':[_0xbbfc('0x88'),_0xbbfc('0x81')],'where':{'CmContactId':_0xfd9f31,'ItemClass':_0xbbfc('0x89')},'include':[{'model':db[_0xbbfc('0x80')],'attributes':[_0xbbfc('0x81')],'as':_0xbbfc('0x65')}],'order':['OrderBy',db[_0xbbfc('0x71')][_0xbbfc('0x66')]('`ItemType`.OrderBy')]})[_0xbbfc('0x1d')](function(_0x48db8c){var _0x3da7e3=0x1;var _0x38368e=_[_0xbbfc('0x6a')](_0x48db8c,function(_0x473643){_0x473643[_0xbbfc('0x8a')]=_0x119d3f;_0x473643['phone']=_0x473643[_0xbbfc('0x88')];_0x473643[_0xbbfc('0x81')]=_0x3da7e3;delete _0x473643[_0xbbfc('0x8b')];_0x3da7e3=_0x3da7e3+0x1;return _0x473643;});return db['CmHopperAdditionalPhone'][_0xbbfc('0x56')](_0x38368e,{});})[_0xbbfc('0x1d')](function(){_0x59e461(0x1);});});}function insertAdditionalPhones(_0x107736,_0xa950c2){return new Promise(function(_0x204081){var _0x10ec50=[];for(var _0x4c9fd2=0x0;_0x4c9fd2<_0xa950c2[_0xbbfc('0x39')];_0x4c9fd2++){var _0x29480d=_0xa950c2[_0x4c9fd2];_0x10ec50[_0xbbfc('0x5b')](parseContactItemType(_0x29480d));}Promise[_0xbbfc('0x5f')](_0x10ec50)[_0xbbfc('0x1d')](function(){var _0x3606e0={'id':_0x107736['id'],'items':_0xa950c2};return addAdditionalPhones(_0x3606e0)['then'](function(){return addCmHopperPhones(_0x107736['id']);});})[_0xbbfc('0x1d')](function(){_0x204081(_0x107736);});});}function parseContactItemType(_0x23ea76){return new Promise(function(_0x217054){if(_0x23ea76[_0xbbfc('0x32')](_0xbbfc('0x85'))){_0x217054(_0x23ea76);}else{return db['ContactItemType'][_0xbbfc('0x23')]({'where':{'name':_0x23ea76[_0xbbfc('0x65')]}})[_0xbbfc('0x1d')](function(_0x41978a){if(_[_0xbbfc('0x52')](_0x41978a))_0x23ea76[_0xbbfc('0x85')]=null;else _0x23ea76['ItemTypeId']=_0x41978a['id'];_0x217054(_0x23ea76);});}});}exports[_0xbbfc('0x8c')]=function(_0xc3cc9e,_0x1c47c9){return db[_0xbbfc('0x48')]['findAll']({'raw':!![],'where':{'CmContactId':_0xc3cc9e[_0xbbfc('0x24')]['id'],'ItemClass':_0xbbfc('0x89')},'include':[{'model':db[_0xbbfc('0x80')],'as':'ItemType'}],'order':[[_0xbbfc('0x81')],[db[_0xbbfc('0x71')]['literal'](_0xbbfc('0x8d'))]]})['then'](function(_0x5ebbc4){return _0x5ebbc4;})[_0xbbfc('0x1d')](respondWithResult(_0x1c47c9,null))[_0xbbfc('0x21')](handleError(_0x1c47c9,null));};exports[_0xbbfc('0x8e')]=function(_0x55b6f8,_0x5702fd){return db[_0xbbfc('0x48')][_0xbbfc('0x1e')]({'raw':!![],'where':{'CmContactId':_0x55b6f8[_0xbbfc('0x34')][_0xbbfc('0x8f')]}})['then'](function(_0xeafb81){var _0x1b4071=_[_0xbbfc('0x6a')](_0xeafb81,function(_0x97b0e6){_0x97b0e6[_0xbbfc('0x90')]=_0x55b6f8['body']['toContactId'];return _0x97b0e6;});return db[_0xbbfc('0x48')]['bulkCreate'](_0x1b4071,{});})['then'](function(){return addCmHopperPhones(_0x55b6f8[_0xbbfc('0x34')][_0xbbfc('0x91')]);})['then'](function(){return['ok'];})['then'](respondWithResult(_0x5702fd,null))[_0xbbfc('0x21')](handleError(_0x5702fd,null));};exports[_0xbbfc('0x92')]=function(_0x3c81b7,_0x41360d){var _0x4c845a=[];_0x4c845a[_0xbbfc('0x5b')](createCmHopperPhone(_0x3c81b7[_0xbbfc('0x34')]['id'],_0x3c81b7['body']['hopperId']));Promise[_0xbbfc('0x5f')](_0x4c845a)[_0xbbfc('0x1d')](function(){return[0x1];})[_0xbbfc('0x1d')](respondWithResult(_0x41360d,null));};exports[_0xbbfc('0x93')]=function(_0x16d96e,_0x45b3c5){var _0x3fb92b={'raw':![],'where':{}};var _0x1f03b0={};var _0x560c51={'count':0x0,'rows':[]};return db[_0xbbfc('0x22')][_0xbbfc('0x74')]({'where':{'id':_0x16d96e['params']['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x45b3c5,null))[_0xbbfc('0x1d')](function(_0x295be5){if(_0x295be5){_0x1f03b0[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db[_0xbbfc('0x3c')]['rawAttributes']);_0x1f03b0[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x16d96e[_0xbbfc('0x1f')]);_0x1f03b0[_0xbbfc('0x77')]=_[_0xbbfc('0x78')](_0x1f03b0[_0xbbfc('0x75')],_0x1f03b0[_0xbbfc('0x1f')]);_0x3fb92b[_0xbbfc('0x79')]=_[_0xbbfc('0x78')](_0x1f03b0['model'],qs[_0xbbfc('0x94')](_0x16d96e[_0xbbfc('0x1f')]['fields']));_0x3fb92b[_0xbbfc('0x79')]=_0x3fb92b[_0xbbfc('0x79')][_0xbbfc('0x39')]?_0x3fb92b[_0xbbfc('0x79')]:_0x1f03b0['model'];if(!_0x16d96e['query']['hasOwnProperty']('nolimit')){_0x3fb92b[_0xbbfc('0x13')]=qs[_0xbbfc('0x13')](_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x13')]);_0x3fb92b['offset']=qs[_0xbbfc('0x11')](_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x11')]);}_0x3fb92b[_0xbbfc('0x95')]=qs[_0xbbfc('0x7a')](_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x3fb92b[_0xbbfc('0x59')]=qs[_0xbbfc('0x77')](_['pick'](_0x16d96e[_0xbbfc('0x1f')],_0x1f03b0[_0xbbfc('0x77')]));_0x3fb92b['where']['ContactId']=_0x295be5['id'];if(_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x96')]){_0x3fb92b[_0xbbfc('0x59')]=_[_0xbbfc('0x33')](_0x3fb92b[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x3fb92b['attributes'],function(_0x49db7d){var _0x531666={};_0x531666[_0x49db7d]={'$like':'%'+_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x96')]+'%'};return _0x531666;})});}_0x3fb92b=_[_0xbbfc('0x33')]({},_0x3fb92b,_0x16d96e[_0xbbfc('0x7b')]);return db[_0xbbfc('0x3c')]['count']({'where':_0x3fb92b[_0xbbfc('0x59')]})[_0xbbfc('0x1d')](function(_0x445f0c){_0x560c51['count']=_0x445f0c;if(_0x16d96e['query']['includeAll']){_0x3fb92b[_0xbbfc('0x97')]=[{'all':!![]}];}return db[_0xbbfc('0x3c')][_0xbbfc('0x1e')](_0x3fb92b);})[_0xbbfc('0x1d')](function(_0x497d34){_0x560c51[_0xbbfc('0x98')]=_0x497d34;return _0x560c51;});}})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x45b3c5,_0x3fb92b))[_0xbbfc('0x21')](handleError(_0x45b3c5,null));};exports[_0xbbfc('0x99')]=function(_0x310cbc,_0x77beec){var _0x4040c6={'raw':!![],'where':{}};var _0x10d0b4={};var _0x3813a1={'count':0x0,'rows':[]};return db[_0xbbfc('0x22')][_0xbbfc('0x74')]({'where':{'id':_0x310cbc[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x77beec,null))[_0xbbfc('0x1d')](function(_0x4586d3){if(_0x4586d3){_0x10d0b4[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db['CmHopperHistory'][_0xbbfc('0x9a')]);_0x10d0b4[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x310cbc['query']);_0x10d0b4[_0xbbfc('0x77')]=_[_0xbbfc('0x78')](_0x10d0b4[_0xbbfc('0x75')],_0x10d0b4[_0xbbfc('0x1f')]);_0x4040c6[_0xbbfc('0x79')]=_['intersection'](_0x10d0b4[_0xbbfc('0x75')],qs['fields'](_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x94')]));_0x4040c6[_0xbbfc('0x79')]=_0x4040c6['attributes'][_0xbbfc('0x39')]?_0x4040c6['attributes']:_0x10d0b4['model'];if(!_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x32')]('nolimit')){_0x4040c6['limit']=qs[_0xbbfc('0x13')](_0x310cbc['query'][_0xbbfc('0x13')]);_0x4040c6[_0xbbfc('0x11')]=qs['offset'](_0x310cbc['query']['offset']);}_0x4040c6[_0xbbfc('0x95')]=qs[_0xbbfc('0x7a')](_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x4040c6[_0xbbfc('0x59')]=qs[_0xbbfc('0x77')](_['pick'](_0x310cbc[_0xbbfc('0x1f')],_0x10d0b4[_0xbbfc('0x77')]));_0x4040c6[_0xbbfc('0x59')][_0xbbfc('0x9b')]=_0x4586d3['id'];if(_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x96')]){_0x4040c6['where']=_['merge'](_0x4040c6[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x4040c6['attributes'],function(_0x27d20a){var _0x35e260={};_0x35e260[_0x27d20a]={'$like':'%'+_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x96')]+'%'};return _0x35e260;})});}_0x4040c6=_[_0xbbfc('0x33')]({},_0x4040c6,_0x310cbc[_0xbbfc('0x7b')]);return db['CmHopperHistory']['count']({'where':_0x4040c6[_0xbbfc('0x59')]})[_0xbbfc('0x1d')](function(_0x26b785){_0x3813a1[_0xbbfc('0x9c')]=_0x26b785;if(_0x310cbc[_0xbbfc('0x1f')]['includeAll']){_0x4040c6['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xbbfc('0x1e')](_0x4040c6);})[_0xbbfc('0x1d')](function(_0x36ff2f){_0x3813a1[_0xbbfc('0x98')]=_0x36ff2f;return _0x3813a1;});}})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x77beec,_0x4040c6))['catch'](handleError(_0x77beec,null));};exports['getHopperFinals']=function(_0x51cd8d,_0x28298f){var _0x54dde0={'raw':!![],'where':{}};var _0x5e5782={};var _0x3ae4dc={'count':0x0,'rows':[]};return db['CmContact'][_0xbbfc('0x74')]({'where':{'id':_0x51cd8d[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x28298f,null))[_0xbbfc('0x1d')](function(_0x5127f1){if(_0x5127f1){_0x5e5782[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db[_0xbbfc('0x9d')][_0xbbfc('0x9a')]);_0x5e5782[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x51cd8d['query']);_0x5e5782[_0xbbfc('0x77')]=_[_0xbbfc('0x78')](_0x5e5782[_0xbbfc('0x75')],_0x5e5782[_0xbbfc('0x1f')]);_0x54dde0[_0xbbfc('0x79')]=_[_0xbbfc('0x78')](_0x5e5782[_0xbbfc('0x75')],qs[_0xbbfc('0x94')](_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x94')]));_0x54dde0[_0xbbfc('0x79')]=_0x54dde0[_0xbbfc('0x79')][_0xbbfc('0x39')]?_0x54dde0[_0xbbfc('0x79')]:_0x5e5782[_0xbbfc('0x75')];if(!_0x51cd8d[_0xbbfc('0x1f')]['hasOwnProperty']('nolimit')){_0x54dde0[_0xbbfc('0x13')]=qs[_0xbbfc('0x13')](_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x13')]);_0x54dde0['offset']=qs[_0xbbfc('0x11')](_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x11')]);}_0x54dde0[_0xbbfc('0x95')]=qs[_0xbbfc('0x7a')](_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x54dde0[_0xbbfc('0x59')]=qs[_0xbbfc('0x77')](_[_0xbbfc('0x9e')](_0x51cd8d['query'],_0x5e5782[_0xbbfc('0x77')]));_0x54dde0[_0xbbfc('0x59')][_0xbbfc('0x9b')]=_0x5127f1['id'];if(_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x96')]){_0x54dde0[_0xbbfc('0x59')]=_[_0xbbfc('0x33')](_0x54dde0[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x54dde0[_0xbbfc('0x79')],function(_0xe8d50c){var _0x4627d3={};_0x4627d3[_0xe8d50c]={'$like':'%'+_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x96')]+'%'};return _0x4627d3;})});}_0x54dde0=_[_0xbbfc('0x33')]({},_0x54dde0,_0x51cd8d[_0xbbfc('0x7b')]);return db['CmHopperFinal'][_0xbbfc('0x9c')]({'where':_0x54dde0[_0xbbfc('0x59')]})[_0xbbfc('0x1d')](function(_0x1cc6a5){_0x3ae4dc[_0xbbfc('0x9c')]=_0x1cc6a5;if(_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x9f')]){_0x54dde0['include']=[{'all':!![]}];}return db[_0xbbfc('0x9d')][_0xbbfc('0x1e')](_0x54dde0);})['then'](function(_0x3db340){_0x3ae4dc[_0xbbfc('0x98')]=_0x3db340;return _0x3ae4dc;});}})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x28298f,_0x54dde0))[_0xbbfc('0x21')](handleError(_0x28298f,null));};exports[_0xbbfc('0xa0')]=function(_0x4c1f91,_0x281435){var _0x3df6fd={'raw':!![],'where':{}};var _0x2efd7e={};var _0x575b44={'count':0x0,'rows':[]};return db[_0xbbfc('0x22')][_0xbbfc('0x74')]({'where':{'id':_0x4c1f91[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x281435,null))[_0xbbfc('0x1d')](function(_0x289b9e){if(_0x289b9e){_0x2efd7e[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db[_0xbbfc('0x4d')][_0xbbfc('0x9a')]);_0x2efd7e[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x4c1f91[_0xbbfc('0x1f')]);_0x2efd7e['filters']=_[_0xbbfc('0x78')](_0x2efd7e[_0xbbfc('0x75')],_0x2efd7e[_0xbbfc('0x1f')]);_0x3df6fd['attributes']=_['intersection'](_0x2efd7e[_0xbbfc('0x75')],qs[_0xbbfc('0x94')](_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x94')]));_0x3df6fd[_0xbbfc('0x79')]=_0x3df6fd['attributes'][_0xbbfc('0x39')]?_0x3df6fd[_0xbbfc('0x79')]:_0x2efd7e[_0xbbfc('0x75')];if(!_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x32')](_0xbbfc('0xa1'))){_0x3df6fd[_0xbbfc('0x13')]=qs[_0xbbfc('0x13')](_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x13')]);_0x3df6fd[_0xbbfc('0x11')]=qs[_0xbbfc('0x11')](_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x11')]);}_0x3df6fd['order']=qs[_0xbbfc('0x7a')](_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x3df6fd[_0xbbfc('0x59')]=qs['filters'](_[_0xbbfc('0x9e')](_0x4c1f91[_0xbbfc('0x1f')],_0x2efd7e[_0xbbfc('0x77')]));_0x3df6fd[_0xbbfc('0x59')][_0xbbfc('0x9b')]=_0x289b9e['id'];if(_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x96')]){_0x3df6fd[_0xbbfc('0x59')]=_[_0xbbfc('0x33')](_0x3df6fd[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x3df6fd[_0xbbfc('0x79')],function(_0x471d74){var _0x472e97={};_0x472e97[_0x471d74]={'$like':'%'+_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x96')]+'%'};return _0x472e97;})});}_0x3df6fd=_['merge']({},_0x3df6fd,_0x4c1f91[_0xbbfc('0x7b')]);return db[_0xbbfc('0x4d')][_0xbbfc('0x9c')]({'where':_0x3df6fd[_0xbbfc('0x59')]})[_0xbbfc('0x1d')](function(_0x24104c){_0x575b44[_0xbbfc('0x9c')]=_0x24104c;if(_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x9f')]){_0x3df6fd[_0xbbfc('0x97')]=[{'all':!![]}];}return db[_0xbbfc('0x4d')][_0xbbfc('0x1e')](_0x3df6fd);})['then'](function(_0x169437){_0x575b44[_0xbbfc('0x98')]=_0x169437;return _0x575b44;});}})['then'](respondWithFilteredResult(_0x281435,_0x3df6fd))[_0xbbfc('0x21')](handleError(_0x281435,null));};exports[_0xbbfc('0xa2')]=function(_0x3415ae,_0x437553){try{if(!_0x3415ae['body'][_0xbbfc('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3415ae['body'][_0xbbfc('0xa3')]){throw new Error(_0xbbfc('0xa4'));}if(!_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa5')]){throw new Error(_0xbbfc('0xa6'));}if(!_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5058bc=_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa3')][_0xbbfc('0xa8')](',');var _0x5d045e=_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa5')][_0xbbfc('0xa8')](',');if(!_0x5058bc['length']||!_0x5d045e['length']||_0x5058bc[_0xbbfc('0x39')]!==_0x5d045e[_0xbbfc('0x39')]){throw new Error(_0xbbfc('0xa9'));}_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0x94')]=_['zipObject'](_0x5058bc,_0x5d045e);if(!_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0x94')][_0xbbfc('0x73')]){throw new Error(_0xbbfc('0xaa'));}if(!_0x3415ae[_0xbbfc('0x34')]['fields'][_0xbbfc('0xab')]){throw new Error(_0xbbfc('0xac'));}var _0x14e546=path['join'](config['root'],_0xbbfc('0xad'),_0x3415ae[_0xbbfc('0xae')]['filename']);fs['chmodSync'](_0x14e546,parseInt(_0xbbfc('0xaf'),0x8));var _0x47e377=require(_0xbbfc('0xb0'))['fork'](path[_0xbbfc('0x3a')](__dirname,_0xbbfc('0xb1')),[_0x14e546,_0x3415ae['body']['binding_keys'],_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa5')],_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0x5c')],_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xb2')],_0x3415ae[_0xbbfc('0x34')]['duplicates'],_0x3415ae[_0xbbfc('0x34')]['socket_timestamp']]);return _0x437553[_0xbbfc('0xf')](0xc8)[_0xbbfc('0x10')]({'message':_0xbbfc('0xb3'),'pid':_0x47e377[_0xbbfc('0xb4')]});}catch(_0x31caa6){return _0x437553[_0xbbfc('0xf')](0x1f4)[_0xbbfc('0x1b')](_0x31caa6);}};exports[_0xbbfc('0xb5')]=function(_0x3cf89f,_0x12f1bd){var _0x32a30b=fs[_0xbbfc('0xb6')](_0x3cf89f[_0xbbfc('0xae')][_0xbbfc('0x3')]);Papa[_0xbbfc('0xb7')](_0x32a30b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x8c0ce8){return _0x12f1bd[_0xbbfc('0xf')](0xc8)[_0xbbfc('0x10')]({'file':_0x3cf89f['file'],'fields':_0x8c0ce8[_0xbbfc('0xb8')]['fields']});}});};exports[_0xbbfc('0xb9')]=function(_0x471f68,_0xd44aee){return db[_0xbbfc('0xba')][_0xbbfc('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbbfc('0xbb')}})[_0xbbfc('0x1d')](function(_0x50b4b3){var _0x1a76ef=![];if(!_0x471f68[_0xbbfc('0x34')][_0xbbfc('0x5c')]){throw new Error(_0xbbfc('0xbc'));}if(!_0x471f68['body'][_0xbbfc('0xbd')][_0xbbfc('0x73')]){throw new Error(_0xbbfc('0xaa'));}if(!_0x471f68[_0xbbfc('0x34')][_0xbbfc('0xbd')][_0xbbfc('0xab')]){throw new Error(_0xbbfc('0xac'));}if(!_0x471f68[_0xbbfc('0x34')][_0xbbfc('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x457c15=require(_0xbbfc('0xb0'))[_0xbbfc('0xbe')](path[_0xbbfc('0x3a')](__dirname,'../../components/import/cm/csv2'),[_0x471f68[_0xbbfc('0x24')]['id'],JSON['stringify'](_0x471f68[_0xbbfc('0x34')]),JSON[_0xbbfc('0xbf')](_0x50b4b3)]);_0x457c15['on']('message',function(){_0x1a76ef=!![];return _0xd44aee[_0xbbfc('0xf')](0xc8)[_0xbbfc('0x10')]({'message':_0xbbfc('0xc0'),'pid':_0x457c15['pid']});});_0x457c15['on'](_0xbbfc('0xc1'),function(_0x2b4048){if(_0x2b4048&&!_0x1a76ef){return _0xd44aee[_0xbbfc('0xf')](0x1f4)[_0xbbfc('0x10')]({'message':'error\x20child\x20process','pid':_0x457c15['pid']});}});})[_0xbbfc('0x21')](handleError(_0xd44aee,null));};exports[_0xbbfc('0xc2')]=function(_0x3bd632,_0x178ad8){return db[_0xbbfc('0xba')][_0xbbfc('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbbfc('0xbb')}})[_0xbbfc('0x1d')](function(_0x372ffe){var _0x237e77=![];if(!_0x3bd632[_0xbbfc('0x34')][_0xbbfc('0x5c')]){throw new Error(_0xbbfc('0xbc'));}if(!_0x3bd632['body'][_0xbbfc('0xbd')][_0xbbfc('0x73')]){throw new Error(_0xbbfc('0xaa'));}if(!_0x3bd632['body'][_0xbbfc('0xbd')][_0xbbfc('0xab')]){throw new Error(_0xbbfc('0xac'));}if(!_0x3bd632[_0xbbfc('0x34')][_0xbbfc('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x9d2b6c=require(_0xbbfc('0xb0'))[_0xbbfc('0xbe')](path['join'](__dirname,_0xbbfc('0xc3')),[_0x3bd632[_0xbbfc('0x24')]['id'],JSON['stringify'](_0x3bd632[_0xbbfc('0x34')]),JSON['stringify'](_0x372ffe)]);_0x9d2b6c['on'](_0xbbfc('0xc4'),function(){_0x237e77=!![];return _0x178ad8['status'](0xc8)[_0xbbfc('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x9d2b6c['pid']});});_0x9d2b6c['on']('exit',function(_0x5f116f){if(_0x5f116f&&!_0x237e77){return _0x178ad8[_0xbbfc('0xf')](0x1f4)[_0xbbfc('0x10')]({'message':_0xbbfc('0xc5'),'pid':_0x9d2b6c[_0xbbfc('0xb4')]});}});})[_0xbbfc('0x21')](handleError(_0x178ad8,null));};exports[_0xbbfc('0xc6')]=function(_0x26cef6,_0x486e79){var _0xf10e4f=[_0xbbfc('0xc7'),_0xbbfc('0xc8'),_0xbbfc('0xc9'),_0xbbfc('0xca'),_0xbbfc('0xcb'),_0xbbfc('0xcc'),_0xbbfc('0xcd')];var _0x4267c3={'offset':0x0,'order':qs['sort'](_0xbbfc('0xce'))},_0x2cb34c={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x26cef6['query']['channel']){if(!_['includes'](_0xf10e4f,_0x26cef6[_0xbbfc('0x1f')]['channel'][_0xbbfc('0xcf')]())){throw new Error(_0xbbfc('0xd0'));}_0xf10e4f=[_0x26cef6[_0xbbfc('0x1f')][_0xbbfc('0xd1')][_0xbbfc('0xcf')]()];}if(_0x26cef6['query'][_0xbbfc('0xd2')]){try{var _0x524864=JSON['parse'](_0x26cef6[_0xbbfc('0x1f')][_0xbbfc('0xd2')]);if(!moment(_0x524864[_0xbbfc('0x35')])[_0xbbfc('0xd3')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x524864['to'])['isValid']()){throw new Error(_0xbbfc('0xd4'));}}catch(_0x303a8e){throw new Error(_0xbbfc('0xd5'));}}if(!_0x26cef6[_0xbbfc('0x1f')][_0xbbfc('0x32')](_0xbbfc('0xa1'))){_0x4267c3['limit']=qs['limit'](_0x26cef6['query'][_0xbbfc('0x13')]||0xa);_0x4267c3[_0xbbfc('0x11')]=qs[_0xbbfc('0x11')](_0x26cef6['query']['offset']);}var _0x88d0a8=_0xf10e4f[_0xbbfc('0x6a')](function(_0x56754c){if(_0x56754c===_0xbbfc('0xcd')){var _0x3daad2={'attributes':['id','uniqueid',_0xbbfc('0x2e'),_0xbbfc('0xd6'),_0xbbfc('0xd7'),_0xbbfc('0xd8'),_0xbbfc('0xd9'),'endtime',_0xbbfc('0xda'),_0xbbfc('0xdb'),_0xbbfc('0xdc'),_0xbbfc('0xdd'),_0xbbfc('0xde'),_0xbbfc('0xdf'),_0xbbfc('0xe0')],'where':{'ContactId':_0x26cef6['params']['id']},'include':[{'model':db[_0xbbfc('0xba')],'as':_0xbbfc('0xba'),'attributes':['id',_0xbbfc('0x1a'),_0xbbfc('0xe1'),_0xbbfc('0x2c')]}],'order':[['createdAt',_0xbbfc('0xe2')]]};if(_0x26cef6[_0xbbfc('0x1f')][_0xbbfc('0xd2')]){_0x3daad2[_0xbbfc('0x59')][_0xbbfc('0xdc')]={'$gte':_0x524864[_0xbbfc('0x35')],'$lte':_0x524864['to']};}return db[_0xbbfc('0xe3')][_0xbbfc('0xe4')](_0x3daad2)[_0xbbfc('0x1d')](function(_0xb5bbb0){_0x2cb34c[_0xbbfc('0x9c')]+=_0xb5bbb0[_0xbbfc('0x9c')];return _[_0xbbfc('0x6a')](_0xb5bbb0[_0xbbfc('0x98')],function(_0xdc2c3d){var _0x4903d1=_0xdc2c3d[_0xbbfc('0x36')]({'plain':!![]});_0x4903d1[_0xbbfc('0xd1')]=_0x56754c;if(_0x4903d1['User']){_0x4903d1[_0xbbfc('0xba')]={'id':_0x4903d1[_0xbbfc('0xba')]['id'],'name':_0x4903d1[_0xbbfc('0xba')][_0xbbfc('0x1a')],'fullname':_0x4903d1[_0xbbfc('0xba')]['fullname'],'alias':_0x4903d1[_0xbbfc('0xba')]['alias']};}return _0x4903d1;});});}else{var _0x29586=_[_0xbbfc('0xe5')](_0x56754c)+(_0x56754c===_0xbbfc('0xc8')?_0xbbfc('0xe6'):'Account');var _0x5de7a2={'attributes':['id',_0xbbfc('0xe7'),_0xbbfc('0xe8'),_0xbbfc('0xdc'),'note',_0xbbfc('0xe9'),'secondDisposition',_0xbbfc('0xea'),_0xbbfc('0xe0'),_0x29586+'Id'],'where':{'ContactId':_0x26cef6['params']['id']},'include':[{'model':db[_0x29586],'as':_0xbbfc('0xeb'),'attributes':['id','name',_0xbbfc('0xec')]},{'model':db['User'],'as':_0xbbfc('0xed'),'attributes':['id',_0xbbfc('0x1a'),_0xbbfc('0xe1')]},{'model':db[_0xbbfc('0x76')],'as':_0xbbfc('0x61'),'attributes':['id',_0xbbfc('0x1a'),_0xbbfc('0x62')],'through':{'attributes':[]}}],'order':[['createdAt',_0xbbfc('0xe2')]]};if(_0x26cef6[_0xbbfc('0x1f')]['range']){_0x5de7a2['where'][_0xbbfc('0xdc')]={'$gte':_0x524864[_0xbbfc('0x35')],'$lte':_0x524864['to']};}switch(_0x56754c){case _0xbbfc('0xc8'):_0x5de7a2['attributes']['push'](_0xbbfc('0xee'),'customerIp',_0xbbfc('0xef'),_0xbbfc('0xf0'),'osName',_0xbbfc('0xf1'),_0xbbfc('0xf2'),_0xbbfc('0xf3'),_0xbbfc('0xf4'));break;case _0xbbfc('0xc7'):_0x5de7a2['attributes']['push'](_0xbbfc('0xf5'),'substatus');break;case'openchannel':_0x5de7a2[_0xbbfc('0x79')][_0xbbfc('0x5b')]('externalUrl',_0xbbfc('0xf6'));break;}return db[_[_0xbbfc('0xe5')](_0x56754c)+_0xbbfc('0xf7')][_0xbbfc('0xe4')](_0x5de7a2)[_0xbbfc('0x1d')](function(_0x17875a){_0x2cb34c['count']+=_0x17875a[_0xbbfc('0x9c')];return _[_0xbbfc('0x6a')](_0x17875a[_0xbbfc('0x98')],function(_0x2278af){var _0x360769=_0x2278af['get']({'plain':!![]});_0x360769['channel']=_0x56754c;if(_0x360769['Owner']){_0x360769[_0xbbfc('0xed')]={'id':_0x360769[_0xbbfc('0xed')]['id'],'name':_0x360769[_0xbbfc('0xed')][_0xbbfc('0x1a')],'fullname':_0x360769[_0xbbfc('0xed')][_0xbbfc('0xe1')]};}return _0x360769;});});}});return Promise[_0xbbfc('0x5f')](_0x88d0a8);})[_0xbbfc('0x1d')](function(_0x5f38f7){return _(_0x5f38f7)[_0xbbfc('0xf8')]()[_0xbbfc('0xf9')](_0xbbfc('0xdc'))[_0xbbfc('0xfa')]()[_0xbbfc('0xfb')]();})[_0xbbfc('0x1d')](function(_0x166a04){_0x2cb34c[_0xbbfc('0x98')]=_0x4267c3[_0xbbfc('0x13')]?_0x166a04[_0xbbfc('0xfc')](_0x4267c3['offset'],_0x4267c3[_0xbbfc('0x11')]+_0x4267c3[_0xbbfc('0x13')]):_0x166a04;return _0x2cb34c;})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x486e79,_0x4267c3))[_0xbbfc('0x21')](handleError(_0x486e79,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 778cc1b..047a1b6 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 _0x7ffe=['hook','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xbb0d59,_0x227edf){var _0x40a72f=function(_0x27815c){while(--_0x27815c){_0xbb0d59['push'](_0xbb0d59['shift']());}};_0x40a72f(++_0x227edf);}(_0x7ffe,0xfc));var _0xe7ff=function(_0x5d78d6,_0x160934){_0x5d78d6=_0x5d78d6-0x0;var _0x3826b1=_0x7ffe[_0x5d78d6];return _0x3826b1;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xe7ff('0x0'))['db'][_0xe7ff('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xe7ff('0x2')](0x0);var events={'afterCreate':_0xe7ff('0x3'),'afterUpdate':_0xe7ff('0x4'),'afterDestroy':_0xe7ff('0x5')};function emitEvent(_0x258ca0){return function(_0x2b7906,_0x1b819d,_0x34bdb5){CmContactEvents[_0xe7ff('0x6')](_0x258ca0+':'+_0x2b7906['id'],_0x2b7906);CmContactEvents[_0xe7ff('0x6')](_0x258ca0,_0x2b7906);_0x34bdb5(null);};}for(var e in events){if(events[_0xe7ff('0x7')](e)){var event=events[e];CmContact[_0xe7ff('0x8')](e,emitEvent(event));}}module[_0xe7ff('0x9')]=CmContactEvents; \ No newline at end of file +var _0xcd99=['save','emit','hasOwnProperty','hook','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x5676fc,_0x1507e4){var _0x13999b=function(_0x11395a){while(--_0x11395a){_0x5676fc['push'](_0x5676fc['shift']());}};_0x13999b(++_0x1507e4);}(_0xcd99,0x18c));var _0x9cd9=function(_0x13ea04,_0x301eb8){_0x13ea04=_0x13ea04-0x0;var _0x5ef653=_0xcd99[_0x13ea04];return _0x5ef653;};'use strict';var EventEmitter=require(_0x9cd9('0x0'));var CmContact=require(_0x9cd9('0x1'))['db'][_0x9cd9('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9cd9('0x3')](0x0);var events={'afterCreate':_0x9cd9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50935f){return function(_0x57af45,_0x2ba912,_0x43e673){CmContactEvents[_0x9cd9('0x5')](_0x50935f+':'+_0x57af45['id'],_0x57af45);CmContactEvents[_0x9cd9('0x5')](_0x50935f,_0x57af45);_0x43e673(null);};}for(var e in events){if(events[_0x9cd9('0x6')](e)){var event=events[e];CmContact[_0x9cd9('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index d519a11..fb42649 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 _0xdde0=['get','error','cmContact','inspect','scheduledat','format','isNil','dialTimezone','VoiceQueue','then','utcOffset','add','ret','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','catch','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','Campaign','timezones','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','CmList','Lists','dialCheckDuplicateType','always','onlyIfOpen','findAll','BlackLists','length','cmContact,\x20%s,\x20%s','message','models','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','email','FULLTEXT','utf8mb4_unicode_ci'];(function(_0x15dce0,_0x28ac01){var _0x20bc1a=function(_0x410c43){while(--_0x410c43){_0x15dce0['push'](_0x15dce0['shift']());}};_0x20bc1a(++_0x28ac01);}(_0xdde0,0x159));var _0x0dde=function(_0x13da67,_0x1baf8c){_0x13da67=_0x13da67-0x0;var _0x25cff7=_0xdde0[_0x13da67];return _0x25cff7;};'use strict';var _=require(_0x0dde('0x0'));var util=require(_0x0dde('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0dde('0x2'));var BPromise=require(_0x0dde('0x3'));var rp=require(_0x0dde('0x4'));var fs=require('fs');var path=require(_0x0dde('0x5'));var rimraf=require(_0x0dde('0x6'));var config=require(_0x0dde('0x7'));var shared=require(_0x0dde('0x8'));var attributes=require('./cmContact.attributes');module[_0x0dde('0x9')]=function(_0x4016cf,_0x13ecbc){return _0x4016cf[_0x0dde('0xa')](_0x0dde('0xb'),attributes,{'tableName':_0x0dde('0xc'),'paranoid':!![],'indexes':[{'name':_0x0dde('0xd'),'fields':['phone']},{'name':_0x0dde('0xe'),'fields':[_0x0dde('0xf'),_0x0dde('0x10'),_0x0dde('0xd'),'mobile','fax',_0x0dde('0x11')],'type':_0x0dde('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x0dde('0x13'),'hooks':{'afterCreate':function(_0x37737b,_0x4a1420,_0x4e02cb){var _0x8da5ff=_0x4016cf['models'];var _0x2261fc=_0x37737b[_0x0dde('0x14')]({'plain':!![]});function _0xfe7a17(){return function(_0x1f3a78){logger[_0x0dde('0x15')](_0x0dde('0x16'),'afterCreate',util[_0x0dde('0x17')](_0x1f3a78,{'showHidden':![],'depth':null}));};}function _0x3cfe82(_0x4fde93,_0x3e8714){var _0x151bee=_0x3e8714[_0x0dde('0x18')]?_0x3e8714[_0x0dde('0x18')]:moment()[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0xfcf3eb,_0x14099d){if(_[_0x0dde('0x1a')](_0x3e8714[_0x0dde('0x1b')])){_0xfcf3eb({'ret':_0x151bee});}else{_0x8da5ff[_0x0dde('0x1c')]['findOne']({'where':{'id':_0x4fde93['id']}})[_0x0dde('0x1d')](function(_0x57e09a){if(!_[_0x0dde('0x1a')](_0x57e09a)){var _0x256281=_0x57e09a[_0x0dde('0x1b')];if(!_[_0x0dde('0x1a')](_0x256281)){var _0x3c3d9c=shared['timezones'];var _0x24699e=_0x3c3d9c[_0x256281];var _0x1c6127=_0x3c3d9c[_0x3e8714[_0x0dde('0x1b')]];if(!_[_0x0dde('0x1a')](_0x24699e)&&!_[_0x0dde('0x1a')](_0x1c6127)){var _0x1473aa=_0x24699e['utcOffset']-_0x1c6127[_0x0dde('0x1e')];_0x151bee=_0x3e8714['scheduledat']?_0x3e8714[_0x0dde('0x18')]:moment();var _0x229ae4=moment(_0x151bee)[_0x0dde('0x1f')](_0x1473aa,'minutes');_0xfcf3eb({'ret':_0x229ae4[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0xfcf3eb({'ret':_0x151bee});}else _0xfcf3eb({'ret':_0x151bee});}else{_0xfcf3eb({'ret':_0x151bee});}});}});return 0xa;}var _0x4a39ab=function(_0x31ee65){return new BPromise(function(_0x57b3f6,_0x1a4c18){_0x3cfe82(_0x31ee65,_0x2261fc)[_0x0dde('0x1d')](function(_0x389a85){_0x2261fc[_0x0dde('0x18')]=_0x389a85[_0x0dde('0x20')];_0x8da5ff['CmHopper'][_0x0dde('0x21')]({'where':{'phone':_0x2261fc['phone'],'VoiceQueueId':_0x31ee65['id']}})['then'](function(_0x2de3c8){if(!_[_0x0dde('0x1a')](_0x2de3c8)){throw new Error(_0x0dde('0x22')+_0x2261fc[_0x0dde('0xd')]+_0x0dde('0x23')+_0x31ee65['id']);}return _0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc['phone'],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'priority':_0x2261fc[_0x0dde('0x27')]?_0x2261fc['priority']:0x2,'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc[_0x0dde('0x18')]:moment()[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc['callbackUniqueid']?moment()[_0x0dde('0x19')](_0x0dde('0x29')):undefined,'VoiceQueueId':_0x31ee65['id']});})[_0x0dde('0x2a')](function(_0x44df3d){_0x1a4c18(_0x44df3d);});});});};var _0x2cbf0b=function(_0x222db1){return new BPromise(function(_0x441b6b,_0x3ff9b3){_0x3cfe82(_0x222db1,_0x2261fc)['then'](function(_0x269aab){_0x2261fc[_0x0dde('0x18')]=_0x269aab['ret'];_0x8da5ff['CmHopper'][_0x0dde('0x21')]({'where':{'phone':_0x2261fc[_0x0dde('0xd')],'VoiceQueueId':_0x222db1['id']}})[_0x0dde('0x1d')](function(_0x18e72a){if(!_['isNil'](_0x18e72a)){throw new Error(_0x0dde('0x22')+_0x2261fc[_0x0dde('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x222db1['id']);}return _0x8da5ff['CmHopperFinal'][_0x0dde('0x21')]({'where':{'calleridnum':_0x2261fc['phone'],'VoiceQueueId':_0x222db1['id']}});})['then'](function(_0xa61f37){if(!_[_0x0dde('0x1a')](_0xa61f37)){throw new Error(_0x0dde('0x2b')+_0x2261fc[_0x0dde('0xd')]+_0x0dde('0x2c')+_0x222db1['id']);}return _0x8da5ff['CmHopper']['create']({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc['ListId'],'priority':_0x2261fc['priority']?_0x2261fc[_0x0dde('0x27')]:0x2,'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc[_0x0dde('0x18')]:moment()[_0x0dde('0x19')](_0x0dde('0x29')),'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc[_0x0dde('0x28')]?moment()[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x222db1['id']});})['catch'](function(_0x5b7860){_0x3ff9b3(_0x5b7860);});});});};function _0x41a501(){return function(_0x235471){logger[_0x0dde('0x15')](_0x0dde('0x16'),_0x0dde('0x2d'),util['inspect'](_0x235471,{'showHidden':![],'depth':null}));};}function _0x4fb746(_0x107906,_0x1e0f84){var _0x5f0540=_0x1e0f84['scheduledat']?_0x1e0f84[_0x0dde('0x18')]:moment()['format'](_0x0dde('0x29'));return new BPromise(function(_0x3c3f9e,_0x5847c2){if(_[_0x0dde('0x1a')](_0x1e0f84[_0x0dde('0x1b')])){_0x3c3f9e({'ret':_0x5f0540});}else{_0x8da5ff[_0x0dde('0x2e')][_0x0dde('0x21')]({'where':{'id':_0x107906['id']}})[_0x0dde('0x1d')](function(_0x2f2860){if(!_[_0x0dde('0x1a')](_0x2f2860)){var _0x2843b2=_0x2f2860[_0x0dde('0x1b')];if(!_['isNil'](_0x2843b2)){var _0x3ed875=shared[_0x0dde('0x2f')];var _0x5f6ae5=_0x3ed875[_0x2843b2];var _0x232b2f=_0x3ed875[_0x1e0f84[_0x0dde('0x1b')]];if(!_[_0x0dde('0x1a')](_0x5f6ae5)&&!_['isNil'](_0x232b2f)){var _0x1a9241=_0x5f6ae5[_0x0dde('0x1e')]-_0x232b2f[_0x0dde('0x1e')];_0x5f0540=_0x1e0f84[_0x0dde('0x18')]?_0x1e0f84['scheduledat']:moment();var _0x5ea7f4=moment(_0x5f0540)['add'](_0x1a9241,_0x0dde('0x30'));_0x3c3f9e({'ret':_0x5ea7f4['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3c3f9e({'ret':_0x5f0540});}else _0x3c3f9e({'ret':_0x5f0540});}else{_0x3c3f9e({'ret':_0x5f0540});}});}});return 0xa;}var _0x4db6e3=function(_0x242e28){return new BPromise(function(_0x22f12d,_0x3f37f7){_0x4fb746(_0x242e28,_0x2261fc)[_0x0dde('0x1d')](function(_0x51063a){_0x2261fc[_0x0dde('0x18')]=_0x51063a[_0x0dde('0x20')];_0x8da5ff[_0x0dde('0x24')][_0x0dde('0x21')]({'where':{'phone':_0x2261fc[_0x0dde('0xd')],'CampaignId':_0x242e28['id']}})['then'](function(_0x3674bc){if(!_[_0x0dde('0x1a')](_0x3674bc)){throw new Error(_0x0dde('0x22')+_0x2261fc[_0x0dde('0xd')]+_0x0dde('0x31')+_0x242e28['id']);}return _0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'priority':_0x2261fc['priority']?_0x2261fc['priority']:0x2,'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc['scheduledat']:moment()[_0x0dde('0x19')](_0x0dde('0x29')),'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc['callbackUniqueid']?moment()[_0x0dde('0x19')](_0x0dde('0x29')):undefined,'CampaignId':_0x242e28['id']});})[_0x0dde('0x2a')](function(_0x304187){_0x3f37f7(_0x304187);});});});};var _0x42b1fe=function(_0x1b44c4){return new BPromise(function(_0x4c5af3,_0x60ceef){_0x4fb746(_0x1b44c4,_0x2261fc)[_0x0dde('0x1d')](function(_0x1fdf52){_0x2261fc[_0x0dde('0x18')]=_0x1fdf52[_0x0dde('0x20')];_0x8da5ff[_0x0dde('0x24')]['findOne']({'where':{'phone':_0x2261fc['phone'],'CampaignId':_0x1b44c4['id']}})[_0x0dde('0x1d')](function(_0xa7aabe){if(!_[_0x0dde('0x1a')](_0xa7aabe)){throw new Error(_0x0dde('0x22')+_0x2261fc['phone']+_0x0dde('0x32')+_0x1b44c4['id']);}return _0x8da5ff['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x2261fc[_0x0dde('0xd')],'CampaignId':_0x1b44c4['id']}});})[_0x0dde('0x1d')](function(_0x3ce5ff){if(!_[_0x0dde('0x1a')](_0x3ce5ff)){throw new Error(_0x0dde('0x2b')+_0x2261fc[_0x0dde('0xd')]+_0x0dde('0x33')+_0x1b44c4['id']);}return _0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'priority':_0x2261fc[_0x0dde('0x27')]?_0x2261fc[_0x0dde('0x27')]:0x2,'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc[_0x0dde('0x18')]:moment()[_0x0dde('0x19')](_0x0dde('0x29')),'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc[_0x0dde('0x28')]?moment()[_0x0dde('0x19')](_0x0dde('0x29')):undefined,'CampaignId':_0x1b44c4['id']});})[_0x0dde('0x2a')](function(_0x5c00d0){_0x60ceef(_0x5c00d0);});});});};if(_0x2261fc['ListId']){_0x8da5ff['VoiceQueue']['findAll']({'where':{'type':_0x0dde('0x34')},'attributes':['id','dialCheckDuplicateType',_0x0dde('0x1b')],'include':[{'model':_0x8da5ff[_0x0dde('0x35')],'as':_0x0dde('0x36'),'where':{'id':_0x2261fc[_0x0dde('0x26')]}}]})[_0x0dde('0x1d')](function(_0x4d350f){if(_0x4d350f){var _0x471c46=[];for(var _0x17f702=0x0,_0xded916;_0x17f702<_0x4d350f['length'];_0x17f702+=0x1){_0xded916=_0x4d350f[_0x17f702][_0x0dde('0x14')]({'plain':!![]});switch(_0xded916[_0x0dde('0x37')]){case _0x0dde('0x38'):_0x2cbf0b(_0xded916)[_0x0dde('0x2a')](_0xfe7a17());break;case _0x0dde('0x39'):_0x4a39ab(_0xded916)[_0x0dde('0x2a')](_0xfe7a17());break;default:_0x4fb746(_0xded916,_0x2261fc)[_0x0dde('0x1d')](function(_0x2c4f77){_0x2261fc[_0x0dde('0x18')]=_0x2c4f77[_0x0dde('0x20')];_0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'scheduledat':_0x2261fc['scheduledat']?_0x2261fc[_0x0dde('0x18')]:moment()['format'](_0x0dde('0x29')),'priority':_0x2261fc['priority']?_0x2261fc['priority']:0x2,'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc['callbackUniqueid']?moment()[_0x0dde('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xded916['id']})[_0x0dde('0x2a')](_0xfe7a17());});}}}})[_0x0dde('0x1d')](function(){return _0x8da5ff[_0x0dde('0x1c')][_0x0dde('0x3a')]({'where':{'type':_0x0dde('0x34')},'attributes':['id'],'include':[{'model':_0x8da5ff['CmList'],'as':_0x0dde('0x3b'),'where':{'id':_0x2261fc[_0x0dde('0x26')]}}]})[_0x0dde('0x1d')](function(_0x56b10a){if(_0x56b10a){var _0x3951bb=[];for(var _0x512aa6=0x0,_0x496edf;_0x512aa6<_0x56b10a[_0x0dde('0x3c')];_0x512aa6+=0x1){_0x496edf=_0x56b10a[_0x512aa6][_0x0dde('0x14')]({'plain':!![]});_0x8da5ff['CmHopperBlack']['create']({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'VoiceQueueId':_0x496edf['id']})['catch'](function(_0x4f557b){logger[_0x0dde('0x15')](_0x0dde('0x3d'),_0x0dde('0x2d'),_0x4f557b[_0x0dde('0x3e')]);});}}});})[_0x0dde('0x1d')](function(){return _0x8da5ff[_0x0dde('0x2e')][_0x0dde('0x3a')]({'attributes':['id',_0x0dde('0x37'),'dialTimezone'],'include':[{'model':_0x8da5ff[_0x0dde('0x35')],'as':_0x0dde('0x36'),'where':{'id':_0x2261fc[_0x0dde('0x26')]}}]})['then'](function(_0xec4f23){if(_0xec4f23){var _0x14ca96=[];for(var _0x5997d2=0x0,_0x1037b4;_0x5997d2<_0xec4f23[_0x0dde('0x3c')];_0x5997d2+=0x1){_0x1037b4=_0xec4f23[_0x5997d2][_0x0dde('0x14')]({'plain':!![]});switch(_0x1037b4[_0x0dde('0x37')]){case _0x0dde('0x38'):_0x42b1fe(_0x1037b4)['catch'](_0x41a501());break;case _0x0dde('0x39'):_0x4db6e3(_0x1037b4)[_0x0dde('0x2a')](_0x41a501());break;default:_0x8da5ff[_0x0dde('0x24')][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'scheduledat':_0x2261fc[_0x0dde('0x18')]?_0x2261fc[_0x0dde('0x18')]:moment()[_0x0dde('0x19')](_0x0dde('0x29')),'priority':_0x2261fc[_0x0dde('0x27')]?_0x2261fc[_0x0dde('0x27')]:0x2,'callback':_0x2261fc[_0x0dde('0x28')]?!![]:![],'callbackuniqueid':_0x2261fc[_0x0dde('0x28')]?_0x2261fc[_0x0dde('0x28')]:undefined,'callbackat':_0x2261fc[_0x0dde('0x28')]?moment()[_0x0dde('0x19')](_0x0dde('0x29')):undefined,'CampaignId':_0x1037b4['id']})[_0x0dde('0x2a')](_0x41a501());}}}});})[_0x0dde('0x1d')](function(){return _0x8da5ff[_0x0dde('0x2e')]['findAll']({'attributes':['id'],'include':[{'model':_0x8da5ff[_0x0dde('0x35')],'as':'BlackLists','where':{'id':_0x2261fc[_0x0dde('0x26')]}}]})[_0x0dde('0x1d')](function(_0x3b8336){if(_0x3b8336){var _0x16a86b=[];for(var _0x5888ed=0x0,_0x15c45d;_0x5888ed<_0x3b8336[_0x0dde('0x3c')];_0x5888ed+=0x1){_0x15c45d=_0x3b8336[_0x5888ed][_0x0dde('0x14')]({'plain':!![]});_0x8da5ff['CmHopperBlack'][_0x0dde('0x25')]({'phone':_0x2261fc[_0x0dde('0xd')],'ContactId':_0x2261fc['id'],'ListId':_0x2261fc[_0x0dde('0x26')],'CampaignId':_0x15c45d['id']})[_0x0dde('0x2a')](function(_0x5442c2){logger[_0x0dde('0x15')](_0x0dde('0x3d'),'afterCreate',_0x5442c2[_0x0dde('0x3e')]);});}}});})[_0x0dde('0x1d')](function(){_0x4e02cb();})[_0x0dde('0x2a')](function(_0xd1bae3){logger['error']('cmContact,\x20%s,\x20%s',_0x0dde('0x2d'),_0xd1bae3[_0x0dde('0x3e')]);_0x4e02cb(_0xd1bae3);});}else{_0x4e02cb(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x58e5b8,_0x197d64,_0x58617f){var _0x3eba8e=_0x4016cf[_0x0dde('0x3f')];var _0x557538=_0x58e5b8[_0x0dde('0x14')]({'plain':!![]});return _0x3eba8e[_0x0dde('0x24')][_0x0dde('0x3a')]({'raw':!![],'where':{'ListId':_0x557538[_0x0dde('0x26')],'ContactId':_0x557538['id']}})[_0x0dde('0x1d')](function(_0x57d1ea){if(!_['isEmpty'](_0x57d1ea)){var _0x144438=[];for(var _0x15d8dc=0x0;_0x15d8dc<_0x57d1ea[_0x0dde('0x3c')];_0x15d8dc+=0x1){var _0x416e65=_0x3eba8e[_0x0dde('0x24')][_0x0dde('0x40')]({'where':{'ListId':_0x57d1ea[_0x15d8dc][_0x0dde('0x26')],'ContactId':_0x57d1ea[_0x15d8dc][_0x0dde('0x41')],'VoiceQueueId':_0x57d1ea[_0x15d8dc][_0x0dde('0x42')],'CampaignId':_0x57d1ea[_0x15d8dc][_0x0dde('0x43')]}});_0x144438[_0x0dde('0x44')](_0x416e65);}return BPromise[_0x0dde('0x45')](_0x144438);}})['then'](function(_0x48b8e2){logger[_0x0dde('0x46')](_0x0dde('0x47'),util[_0x0dde('0x17')](_0x48b8e2,{'showHidden':![],'depth':null}));_0x58617f();})[_0x0dde('0x2a')](function(_0x593e35){logger[_0x0dde('0x15')](_0x0dde('0x48'),util[_0x0dde('0x17')](_0x593e35,{'showHidden':![],'depth':null}));_0x58617f(_0x593e35);});}}});}; \ No newline at end of file +var _0x47be=['VoiceQueue','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','onlyIfOpen','BlackLists','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','phone','firstName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','findOne','then','isNil','dialTimezone','timezones','utcOffset','add','minutes','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','\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','catch','error','inspect','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopper','\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','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x47be,0xf5));var _0xe47b=function(_0x2b2b33,_0x56606f){_0x2b2b33=_0x2b2b33-0x0;var _0x229157=_0x47be[_0x2b2b33];return _0x229157;};'use strict';var _=require('lodash');var util=require(_0xe47b('0x0'));var logger=require('../../config/logger')(_0xe47b('0x1'));var moment=require(_0xe47b('0x2'));var BPromise=require(_0xe47b('0x3'));var rp=require(_0xe47b('0x4'));var fs=require('fs');var path=require(_0xe47b('0x5'));var rimraf=require(_0xe47b('0x6'));var config=require(_0xe47b('0x7'));var shared=require(_0xe47b('0x8'));var attributes=require(_0xe47b('0x9'));module[_0xe47b('0xa')]=function(_0x47a7bc,_0x56ffb7){return _0x47a7bc['define'](_0xe47b('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xe47b('0xc'),'fields':[_0xe47b('0xc')]},{'name':'fti_cm_contacts','fields':[_0xe47b('0xd'),'lastName',_0xe47b('0xc'),_0xe47b('0xe'),_0xe47b('0xf'),_0xe47b('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xe47b('0x11'),'collate':_0xe47b('0x12'),'hooks':{'afterCreate':function(_0x48b559,_0x2d9cab,_0x14377d){var _0x20b74b=_0x47a7bc[_0xe47b('0x13')];var _0xf140c3=_0x48b559[_0xe47b('0x14')]({'plain':!![]});function _0x47e005(){return function(_0x51c427){logger['error'](_0xe47b('0x15'),_0xe47b('0x16'),util['inspect'](_0x51c427,{'showHidden':![],'depth':null}));};}function _0x387854(_0x2450a6,_0x3babce){var _0x31464e=_0x3babce[_0xe47b('0x17')]?_0x3babce[_0xe47b('0x17')]:moment()[_0xe47b('0x18')](_0xe47b('0x19'));return new BPromise(function(_0xa0885e,_0x4f9838){if(_['isNil'](_0x3babce['dialTimezone'])){_0xa0885e({'ret':_0x31464e});}else{_0x20b74b['VoiceQueue'][_0xe47b('0x1a')]({'where':{'id':_0x2450a6['id']}})[_0xe47b('0x1b')](function(_0x5593c2){if(!_[_0xe47b('0x1c')](_0x5593c2)){var _0x5e9af4=_0x5593c2[_0xe47b('0x1d')];if(!_[_0xe47b('0x1c')](_0x5e9af4)){var _0x4a7d6e=shared[_0xe47b('0x1e')];var _0x40c563=_0x4a7d6e[_0x5e9af4];var _0x58d20e=_0x4a7d6e[_0x3babce[_0xe47b('0x1d')]];if(!_[_0xe47b('0x1c')](_0x40c563)&&!_[_0xe47b('0x1c')](_0x58d20e)){var _0x9999d8=_0x40c563[_0xe47b('0x1f')]-_0x58d20e[_0xe47b('0x1f')];_0x31464e=_0x3babce[_0xe47b('0x17')]?_0x3babce[_0xe47b('0x17')]:moment();var _0x3dab39=moment(_0x31464e)[_0xe47b('0x20')](_0x9999d8,_0xe47b('0x21'));_0xa0885e({'ret':_0x3dab39[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0xa0885e({'ret':_0x31464e});}else _0xa0885e({'ret':_0x31464e});}else{_0xa0885e({'ret':_0x31464e});}});}});return 0xa;}var _0x182d47=function(_0x5ccf36){return new BPromise(function(_0x386ede,_0x3d7071){_0x387854(_0x5ccf36,_0xf140c3)[_0xe47b('0x1b')](function(_0x444a71){_0xf140c3[_0xe47b('0x17')]=_0x444a71['ret'];_0x20b74b['CmHopper'][_0xe47b('0x1a')]({'where':{'phone':_0xf140c3[_0xe47b('0xc')],'VoiceQueueId':_0x5ccf36['id']}})[_0xe47b('0x1b')](function(_0x5747c7){if(!_[_0xe47b('0x1c')](_0x5747c7)){throw new Error(_0xe47b('0x22')+_0xf140c3[_0xe47b('0xc')]+_0xe47b('0x23')+_0x5ccf36['id']);}return _0x20b74b['CmHopper'][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'priority':_0xf140c3[_0xe47b('0x26')]?_0xf140c3[_0xe47b('0x26')]:0x2,'scheduledat':_0xf140c3['scheduledat']?_0xf140c3[_0xe47b('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3[_0xe47b('0x27')]?_0xf140c3[_0xe47b('0x27')]:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5ccf36['id']});})['catch'](function(_0x54e819){_0x3d7071(_0x54e819);});});});};var _0x3b342e=function(_0x1c9ed2){return new BPromise(function(_0x32e271,_0xd3d7d4){_0x387854(_0x1c9ed2,_0xf140c3)[_0xe47b('0x1b')](function(_0x4c5e4){_0xf140c3[_0xe47b('0x17')]=_0x4c5e4['ret'];_0x20b74b['CmHopper'][_0xe47b('0x1a')]({'where':{'phone':_0xf140c3['phone'],'VoiceQueueId':_0x1c9ed2['id']}})[_0xe47b('0x1b')](function(_0x27d39e){if(!_[_0xe47b('0x1c')](_0x27d39e)){throw new Error(_0xe47b('0x22')+_0xf140c3[_0xe47b('0xc')]+_0xe47b('0x28')+_0x1c9ed2['id']);}return _0x20b74b[_0xe47b('0x29')]['findOne']({'where':{'calleridnum':_0xf140c3[_0xe47b('0xc')],'VoiceQueueId':_0x1c9ed2['id']}});})[_0xe47b('0x1b')](function(_0xdd470){if(!_[_0xe47b('0x1c')](_0xdd470)){throw new Error(_0xe47b('0x2a')+_0xf140c3['phone']+_0xe47b('0x2b')+_0x1c9ed2['id']);}return _0x20b74b['CmHopper'][_0xe47b('0x24')]({'phone':_0xf140c3['phone'],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3['ListId'],'priority':_0xf140c3[_0xe47b('0x26')]?_0xf140c3[_0xe47b('0x26')]:0x2,'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3[_0xe47b('0x17')]:moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3['callbackUniqueid']?_0xf140c3[_0xe47b('0x27')]:undefined,'callbackat':_0xf140c3['callbackUniqueid']?moment()[_0xe47b('0x18')](_0xe47b('0x19')):undefined,'VoiceQueueId':_0x1c9ed2['id']});})[_0xe47b('0x2c')](function(_0x5d1f9b){_0xd3d7d4(_0x5d1f9b);});});});};function _0xb3bef3(){return function(_0x420194){logger[_0xe47b('0x2d')]('cmContact',_0xe47b('0x16'),util[_0xe47b('0x2e')](_0x420194,{'showHidden':![],'depth':null}));};}function _0x247369(_0x5f20b2,_0x5ccf7f){var _0x1964ab=_0x5ccf7f['scheduledat']?_0x5ccf7f[_0xe47b('0x17')]:moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x556a13,_0x2a6147){if(_[_0xe47b('0x1c')](_0x5ccf7f[_0xe47b('0x1d')])){_0x556a13({'ret':_0x1964ab});}else{_0x20b74b['Campaign']['findOne']({'where':{'id':_0x5f20b2['id']}})[_0xe47b('0x1b')](function(_0x5a5f8e){if(!_[_0xe47b('0x1c')](_0x5a5f8e)){var _0x157044=_0x5a5f8e[_0xe47b('0x1d')];if(!_[_0xe47b('0x1c')](_0x157044)){var _0x3219f9=shared[_0xe47b('0x1e')];var _0x42392b=_0x3219f9[_0x157044];var _0x4d1ac6=_0x3219f9[_0x5ccf7f[_0xe47b('0x1d')]];if(!_[_0xe47b('0x1c')](_0x42392b)&&!_[_0xe47b('0x1c')](_0x4d1ac6)){var _0x1d520e=_0x42392b[_0xe47b('0x1f')]-_0x4d1ac6[_0xe47b('0x1f')];_0x1964ab=_0x5ccf7f['scheduledat']?_0x5ccf7f[_0xe47b('0x17')]:moment();var _0x1fb647=moment(_0x1964ab)[_0xe47b('0x20')](_0x1d520e,'minutes');_0x556a13({'ret':_0x1fb647[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x556a13({'ret':_0x1964ab});}else _0x556a13({'ret':_0x1964ab});}else{_0x556a13({'ret':_0x1964ab});}});}});return 0xa;}var _0x37e8a0=function(_0x4bd64d){return new BPromise(function(_0x36502a,_0x5d9eb5){_0x247369(_0x4bd64d,_0xf140c3)['then'](function(_0x561375){_0xf140c3['scheduledat']=_0x561375[_0xe47b('0x2f')];_0x20b74b['CmHopper'][_0xe47b('0x1a')]({'where':{'phone':_0xf140c3['phone'],'CampaignId':_0x4bd64d['id']}})[_0xe47b('0x1b')](function(_0x35ce9a){if(!_[_0xe47b('0x1c')](_0x35ce9a)){throw new Error(_0xe47b('0x22')+_0xf140c3[_0xe47b('0xc')]+_0xe47b('0x30')+_0x4bd64d['id']);}return _0x20b74b[_0xe47b('0x31')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3['ListId'],'priority':_0xf140c3['priority']?_0xf140c3[_0xe47b('0x26')]:0x2,'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3[_0xe47b('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3[_0xe47b('0x27')]?_0xf140c3[_0xe47b('0x27')]:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4bd64d['id']});})['catch'](function(_0x51e4e4){_0x5d9eb5(_0x51e4e4);});});});};var _0x2fe858=function(_0x189602){return new BPromise(function(_0x2a6464,_0xafb853){_0x247369(_0x189602,_0xf140c3)[_0xe47b('0x1b')](function(_0x36ed08){_0xf140c3['scheduledat']=_0x36ed08['ret'];_0x20b74b[_0xe47b('0x31')]['findOne']({'where':{'phone':_0xf140c3[_0xe47b('0xc')],'CampaignId':_0x189602['id']}})['then'](function(_0x2684e9){if(!_[_0xe47b('0x1c')](_0x2684e9)){throw new Error(_0xe47b('0x22')+_0xf140c3[_0xe47b('0xc')]+_0xe47b('0x32')+_0x189602['id']);}return _0x20b74b[_0xe47b('0x29')]['findOne']({'where':{'calleridnum':_0xf140c3[_0xe47b('0xc')],'CampaignId':_0x189602['id']}});})[_0xe47b('0x1b')](function(_0xb2a728){if(!_[_0xe47b('0x1c')](_0xb2a728)){throw new Error(_0xe47b('0x2a')+_0xf140c3['phone']+_0xe47b('0x33')+_0x189602['id']);}return _0x20b74b[_0xe47b('0x31')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'priority':_0xf140c3[_0xe47b('0x26')]?_0xf140c3[_0xe47b('0x26')]:0x2,'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3[_0xe47b('0x17')]:moment()['format'](_0xe47b('0x19')),'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3['callbackUniqueid']?_0xf140c3['callbackUniqueid']:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()['format'](_0xe47b('0x19')):undefined,'CampaignId':_0x189602['id']});})['catch'](function(_0xb0c4d9){_0xafb853(_0xb0c4d9);});});});};if(_0xf140c3[_0xe47b('0x25')]){_0x20b74b['VoiceQueue'][_0xe47b('0x34')]({'where':{'type':_0xe47b('0x35')},'attributes':['id',_0xe47b('0x36'),_0xe47b('0x1d')],'include':[{'model':_0x20b74b[_0xe47b('0x37')],'as':_0xe47b('0x38'),'where':{'id':_0xf140c3[_0xe47b('0x25')]}}]})['then'](function(_0x1f007f){if(_0x1f007f){var _0x386893=[];for(var _0x6658ac=0x0,_0x244483;_0x6658ac<_0x1f007f[_0xe47b('0x39')];_0x6658ac+=0x1){_0x244483=_0x1f007f[_0x6658ac][_0xe47b('0x14')]({'plain':!![]});switch(_0x244483['dialCheckDuplicateType']){case _0xe47b('0x3a'):_0x3b342e(_0x244483)['catch'](_0x47e005());break;case'onlyIfOpen':_0x182d47(_0x244483)[_0xe47b('0x2c')](_0x47e005());break;default:_0x247369(_0x244483,_0xf140c3)['then'](function(_0xf8c121){_0xf140c3[_0xe47b('0x17')]=_0xf8c121['ret'];_0x20b74b[_0xe47b('0x31')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3['scheduledat']:moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xf140c3['priority']?_0xf140c3[_0xe47b('0x26')]:0x2,'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3['callbackUniqueid']?_0xf140c3[_0xe47b('0x27')]:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x244483['id']})['catch'](_0x47e005());});}}}})[_0xe47b('0x1b')](function(){return _0x20b74b[_0xe47b('0x3b')]['findAll']({'where':{'type':_0xe47b('0x35')},'attributes':['id'],'include':[{'model':_0x20b74b['CmList'],'as':'BlackLists','where':{'id':_0xf140c3[_0xe47b('0x25')]}}]})[_0xe47b('0x1b')](function(_0x49ae59){if(_0x49ae59){var _0x4890a5=[];for(var _0xad026e=0x0,_0x58e630;_0xad026e<_0x49ae59['length'];_0xad026e+=0x1){_0x58e630=_0x49ae59[_0xad026e]['get']({'plain':!![]});_0x20b74b[_0xe47b('0x3c')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'VoiceQueueId':_0x58e630['id']})[_0xe47b('0x2c')](function(_0x63bea1){logger[_0xe47b('0x2d')](_0xe47b('0x3d'),_0xe47b('0x16'),_0x63bea1[_0xe47b('0x3e')]);});}}});})[_0xe47b('0x1b')](function(){return _0x20b74b[_0xe47b('0x3f')][_0xe47b('0x34')]({'attributes':['id',_0xe47b('0x36'),_0xe47b('0x1d')],'include':[{'model':_0x20b74b[_0xe47b('0x37')],'as':_0xe47b('0x38'),'where':{'id':_0xf140c3[_0xe47b('0x25')]}}]})[_0xe47b('0x1b')](function(_0x501acf){if(_0x501acf){var _0x284087=[];for(var _0x1045ff=0x0,_0xb39b97;_0x1045ff<_0x501acf[_0xe47b('0x39')];_0x1045ff+=0x1){_0xb39b97=_0x501acf[_0x1045ff][_0xe47b('0x14')]({'plain':!![]});switch(_0xb39b97[_0xe47b('0x36')]){case _0xe47b('0x3a'):_0x2fe858(_0xb39b97)[_0xe47b('0x2c')](_0xb3bef3());break;case _0xe47b('0x40'):_0x37e8a0(_0xb39b97)[_0xe47b('0x2c')](_0xb3bef3());break;default:_0x20b74b[_0xe47b('0x31')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3[_0xe47b('0x17')]:moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xf140c3[_0xe47b('0x26')]?_0xf140c3[_0xe47b('0x26')]:0x2,'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3[_0xe47b('0x27')]?_0xf140c3['callbackUniqueid']:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()[_0xe47b('0x18')](_0xe47b('0x19')):undefined,'CampaignId':_0xb39b97['id']})[_0xe47b('0x2c')](_0xb3bef3());}}}});})['then'](function(){return _0x20b74b['Campaign'][_0xe47b('0x34')]({'attributes':['id'],'include':[{'model':_0x20b74b[_0xe47b('0x37')],'as':_0xe47b('0x41'),'where':{'id':_0xf140c3['ListId']}}]})[_0xe47b('0x1b')](function(_0x49c720){if(_0x49c720){var _0x2cc6cf=[];for(var _0x59f1cb=0x0,_0x22425c;_0x59f1cb<_0x49c720[_0xe47b('0x39')];_0x59f1cb+=0x1){_0x22425c=_0x49c720[_0x59f1cb]['get']({'plain':!![]});_0x20b74b[_0xe47b('0x3c')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'CampaignId':_0x22425c['id']})[_0xe47b('0x2c')](function(_0x510464){logger[_0xe47b('0x2d')](_0xe47b('0x3d'),_0xe47b('0x16'),_0x510464[_0xe47b('0x3e')]);});}}});})[_0xe47b('0x1b')](function(){_0x14377d();})[_0xe47b('0x2c')](function(_0x118d6c){logger[_0xe47b('0x2d')](_0xe47b('0x3d'),'afterCreate',_0x118d6c[_0xe47b('0x3e')]);_0x14377d(_0x118d6c);});}else{_0x14377d(new Error(_0xe47b('0x42')));}},'afterDestroy':function(_0x9014c3,_0x17ee25,_0x438d8a){var _0x2c24db=_0x47a7bc[_0xe47b('0x13')];var _0x437875=_0x9014c3['get']({'plain':!![]});return _0x2c24db['CmHopper'][_0xe47b('0x34')]({'raw':!![],'where':{'ListId':_0x437875[_0xe47b('0x25')],'ContactId':_0x437875['id']}})['then'](function(_0x4c388c){if(!_[_0xe47b('0x43')](_0x4c388c)){var _0x4b1674=[];for(var _0x55f2ba=0x0;_0x55f2ba<_0x4c388c[_0xe47b('0x39')];_0x55f2ba+=0x1){var _0x476928=_0x2c24db[_0xe47b('0x31')][_0xe47b('0x44')]({'where':{'ListId':_0x4c388c[_0x55f2ba][_0xe47b('0x25')],'ContactId':_0x4c388c[_0x55f2ba][_0xe47b('0x45')],'VoiceQueueId':_0x4c388c[_0x55f2ba][_0xe47b('0x46')],'CampaignId':_0x4c388c[_0x55f2ba]['CampaignId']}});_0x4b1674[_0xe47b('0x47')](_0x476928);}return BPromise[_0xe47b('0x48')](_0x4b1674);}})[_0xe47b('0x1b')](function(_0x22d246){logger[_0xe47b('0x49')](_0xe47b('0x4a'),util[_0xe47b('0x2e')](_0x22d246,{'showHidden':![],'depth':null}));_0x438d8a();})[_0xe47b('0x2c')](function(_0x22c230){logger[_0xe47b('0x2d')](_0xe47b('0x4b'),util[_0xe47b('0x2e')](_0x22c230,{'showHidden':![],'depth':null}));_0x438d8a(_0x22c230);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index c0a440c..88054dd 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x380e03,_0x531ae1){var _0x2d6a19=function(_0x334159){while(--_0x334159){_0x380e03['push'](_0x380e03['shift']());}};_0x2d6a19(++_0x531ae1);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x1084e3,_0x24bbc8){var _0x46ca04=function(_0x7f7c89){while(--_0x7f7c89){_0x1084e3['push'](_0x1084e3['shift']());}};_0x46ca04(++_0x24bbc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 16d968b..8827c51 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 _0x98d3=['exports','STRING','INTEGER','sequelize'];(function(_0x26a31e,_0x273d4b){var _0x28897a=function(_0x187a90){while(--_0x187a90){_0x26a31e['push'](_0x26a31e['shift']());}};_0x28897a(++_0x273d4b);}(_0x98d3,0x173));var _0x398d=function(_0x542653,_0x31ecd7){_0x542653=_0x542653-0x0;var _0x191254=_0x98d3[_0x542653];return _0x191254;};'use strict';var Sequelize=require(_0x398d('0x0'));module[_0x398d('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x398d('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x398d('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x398d('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x398d('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x97a2=['PHONE','sequelize','INTEGER','STRING'];(function(_0x152ef6,_0x1cec9){var _0x82781c=function(_0x7e92b9){while(--_0x7e92b9){_0x152ef6['push'](_0x152ef6['shift']());}};_0x82781c(++_0x1cec9);}(_0x97a2,0x1b1));var _0x297a=function(_0x38cf2d,_0x35a091){_0x38cf2d=_0x38cf2d-0x0;var _0x1e06cd=_0x97a2[_0x38cf2d];return _0x1e06cd;};'use strict';var Sequelize=require(_0x297a('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x297a('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x297a('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x297a('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x297a('0x2')],'defaultValue':_0x297a('0x3')},'OrderBy':{'type':Sequelize[_0x297a('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x297a('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 660f1a9..439c703 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 _0x5c17=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','get','CmContactHasItems','then','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x5c17,0x1f1));var _0x75c1=function(_0x149221,_0x4099ad){_0x149221=_0x149221-0x0;var _0xb08d4f=_0x5c17[_0x149221];return _0xb08d4f;};'use strict';var emlformat=require(_0x75c1('0x0'));var rimraf=require(_0x75c1('0x1'));var zipdir=require(_0x75c1('0x2'));var jsonpatch=require(_0x75c1('0x3'));var rp=require(_0x75c1('0x4'));var moment=require(_0x75c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75c1('0x6'));var util=require(_0x75c1('0x7'));var path=require(_0x75c1('0x8'));var sox=require('sox');var csv=require(_0x75c1('0x9'));var ejs=require(_0x75c1('0xa'));var fs=require('fs');var fs_extra=require(_0x75c1('0xb'));var _=require(_0x75c1('0xc'));var squel=require(_0x75c1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x75c1('0xe'));var toCsv=require(_0x75c1('0x9'));var querystring=require(_0x75c1('0xf'));var Papa=require(_0x75c1('0x10'));var Redis=require(_0x75c1('0x11'));var authService=require(_0x75c1('0x12'));var qs=require(_0x75c1('0x13'));var as=require(_0x75c1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x75c1('0x15'));var utils=require(_0x75c1('0x16'));var config=require(_0x75c1('0x17'));var licenseUtil=require(_0x75c1('0x18'));var db=require(_0x75c1('0x19'))['db'];function respondWithStatusCode(_0x4cf93f,_0x3c3afd){_0x3c3afd=_0x3c3afd||0xcc;return function(_0xe6968c){if(_0xe6968c){return _0x4cf93f[_0x75c1('0x1a')](_0x3c3afd);}return _0x4cf93f[_0x75c1('0x1b')](_0x3c3afd)[_0x75c1('0x1c')]();};}function respondWithResult(_0x58e3b0,_0x507130){_0x507130=_0x507130||0xc8;return function(_0x26c0f8){if(_0x26c0f8){return _0x58e3b0[_0x75c1('0x1b')](_0x507130)[_0x75c1('0x1d')](_0x26c0f8);}};}function respondWithFilteredResult(_0x586721,_0x424d59){return function(_0x1f549b){if(_0x1f549b){var _0x4df9bc=typeof _0x424d59[_0x75c1('0x1e')]===_0x75c1('0x1f')&&typeof _0x424d59[_0x75c1('0x20')]===_0x75c1('0x1f');var _0x47d41f=_0x1f549b['count'];var _0x335872=_0x4df9bc?0x0:_0x424d59[_0x75c1('0x1e')];var _0x309365=_0x4df9bc?_0x1f549b['count']:_0x424d59[_0x75c1('0x1e')]+_0x424d59['limit'];var _0x556cbe;if(_0x309365>=_0x47d41f){_0x309365=_0x47d41f;_0x556cbe=0xc8;}else{_0x556cbe=0xce;}_0x586721[_0x75c1('0x1b')](_0x556cbe);return _0x586721[_0x75c1('0x21')](_0x75c1('0x22'),_0x335872+'-'+_0x309365+'/'+_0x47d41f)['json'](_0x1f549b);}return null;};}function patchUpdates(_0x4a8dae){return function(_0x2a1d3e){try{jsonpatch[_0x75c1('0x23')](_0x2a1d3e,_0x4a8dae,!![]);}catch(_0x50be40){return BPromise[_0x75c1('0x24')](_0x50be40);}return _0x2a1d3e[_0x75c1('0x25')]();};}function saveUpdates(_0x320e9c,_0xc529cc){return function(_0x2feb9b){if(_0x2feb9b){return _0x2feb9b[_0x75c1('0x26')](_0x320e9c)['then'](function(_0x3fe8cb){return _0x3fe8cb;});}return null;};}function removeEntity(_0x2991e3,_0x2ab24e){return function(_0x3e4529){if(_0x3e4529){return _0x3e4529[_0x75c1('0x27')]()['then'](function(){var _0x18e54a=_0x3e4529[_0x75c1('0x28')]({'plain':!![]});var _0x254e5d=_0x75c1('0x29');return db['UserProfileResource'][_0x75c1('0x27')]({'where':{'type':_0x254e5d,'resourceId':_0x18e54a['id']}})[_0x75c1('0x2a')](function(){return _0x3e4529;});})[_0x75c1('0x2a')](function(){_0x2991e3[_0x75c1('0x1b')](0xcc)[_0x75c1('0x1c')]();});}};}function handleEntityNotFound(_0x192eb2,_0x4adfce){return function(_0x27dfaa){if(!_0x27dfaa){_0x192eb2[_0x75c1('0x1a')](0x194);}return _0x27dfaa;};}function handleError(_0x58de94,_0x27a350){_0x27a350=_0x27a350||0x1f4;return function(_0x33d3ef){logger[_0x75c1('0x2b')](_0x33d3ef[_0x75c1('0x2c')]);if(_0x33d3ef[_0x75c1('0x2d')]){delete _0x33d3ef[_0x75c1('0x2d')];}_0x58de94[_0x75c1('0x1b')](_0x27a350)[_0x75c1('0x2e')](_0x33d3ef);};}exports['index']=function(_0x14c3df,_0x1e0d14){var _0x4520a0={},_0x1bea70={},_0x4f7f82={'count':0x0,'rows':[]};var _0x163ea1=_[_0x75c1('0x2f')](db[_0x75c1('0x30')][_0x75c1('0x31')],function(_0x4643b6){return{'name':_0x4643b6[_0x75c1('0x32')],'type':_0x4643b6[_0x75c1('0x33')]['key']};});_0x1bea70['model']=_[_0x75c1('0x2f')](_0x163ea1,_0x75c1('0x2d'));_0x1bea70[_0x75c1('0x34')]=_['keys'](_0x14c3df['query']);_0x1bea70[_0x75c1('0x35')]=_[_0x75c1('0x36')](_0x1bea70[_0x75c1('0x37')],_0x1bea70[_0x75c1('0x34')]);_0x4520a0['attributes']=_['intersection'](_0x1bea70[_0x75c1('0x37')],qs[_0x75c1('0x38')](_0x14c3df[_0x75c1('0x34')][_0x75c1('0x38')]));_0x4520a0['attributes']=_0x4520a0[_0x75c1('0x39')][_0x75c1('0x3a')]?_0x4520a0[_0x75c1('0x39')]:_0x1bea70[_0x75c1('0x37')];if(!_0x14c3df['query'][_0x75c1('0x3b')]('nolimit')){_0x4520a0['limit']=qs[_0x75c1('0x20')](_0x14c3df['query'][_0x75c1('0x20')]);_0x4520a0[_0x75c1('0x1e')]=qs['offset'](_0x14c3df[_0x75c1('0x34')][_0x75c1('0x1e')]);}_0x4520a0[_0x75c1('0x3c')]=qs['sort'](_0x14c3df[_0x75c1('0x34')][_0x75c1('0x3d')]);_0x4520a0[_0x75c1('0x3e')]=qs[_0x75c1('0x35')](_[_0x75c1('0x3f')](_0x14c3df[_0x75c1('0x34')],_0x1bea70[_0x75c1('0x35')]),_0x163ea1);if(_0x14c3df[_0x75c1('0x34')][_0x75c1('0x40')]){_0x4520a0[_0x75c1('0x3e')]=_[_0x75c1('0x41')](_0x4520a0[_0x75c1('0x3e')],{'$or':_[_0x75c1('0x2f')](_0x163ea1,function(_0x58eb95){if(_0x58eb95[_0x75c1('0x33')]!==_0x75c1('0x42')){var _0x4db579={};_0x4db579[_0x58eb95[_0x75c1('0x2d')]]={'$like':'%'+_0x14c3df[_0x75c1('0x34')]['filter']+'%'};return _0x4db579;}})});}_0x4520a0=_[_0x75c1('0x41')]({},_0x4520a0,_0x14c3df[_0x75c1('0x43')]);var _0x31096e={'where':_0x4520a0[_0x75c1('0x3e')]};return db[_0x75c1('0x30')][_0x75c1('0x44')](_0x31096e)[_0x75c1('0x2a')](function(_0x36573a){_0x4f7f82[_0x75c1('0x44')]=_0x36573a;if(_0x14c3df[_0x75c1('0x34')][_0x75c1('0x45')]){_0x4520a0['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x75c1('0x46')](_0x4520a0);})[_0x75c1('0x2a')](function(_0x23a706){_0x4f7f82[_0x75c1('0x47')]=_0x23a706;return _0x4f7f82;})[_0x75c1('0x2a')](respondWithFilteredResult(_0x1e0d14,_0x4520a0))[_0x75c1('0x48')](handleError(_0x1e0d14,null));};exports[_0x75c1('0x49')]=function(_0x3ffea0,_0x344ca9){var _0x315008={'raw':!![],'where':{'id':_0x3ffea0[_0x75c1('0x4a')]['id']}},_0x519e3a={};_0x519e3a['model']=_[_0x75c1('0x4b')](db['CmContactHasItem']['rawAttributes']);_0x519e3a['query']=_[_0x75c1('0x4b')](_0x3ffea0[_0x75c1('0x34')]);_0x519e3a[_0x75c1('0x35')]=_[_0x75c1('0x36')](_0x519e3a['model'],_0x519e3a[_0x75c1('0x34')]);_0x315008[_0x75c1('0x39')]=_['intersection'](_0x519e3a[_0x75c1('0x37')],qs[_0x75c1('0x38')](_0x3ffea0[_0x75c1('0x34')][_0x75c1('0x38')]));_0x315008[_0x75c1('0x39')]=_0x315008[_0x75c1('0x39')][_0x75c1('0x3a')]?_0x315008['attributes']:_0x519e3a[_0x75c1('0x37')];if(_0x3ffea0['query'][_0x75c1('0x45')]){_0x315008['include']=[{'all':!![]}];}_0x315008=_[_0x75c1('0x41')]({},_0x315008,_0x3ffea0[_0x75c1('0x43')]);return db[_0x75c1('0x30')][_0x75c1('0x4c')](_0x315008)[_0x75c1('0x2a')](handleEntityNotFound(_0x344ca9,null))[_0x75c1('0x2a')](respondWithResult(_0x344ca9,null))[_0x75c1('0x48')](handleError(_0x344ca9,null));};exports[_0x75c1('0x4d')]=function(_0x1d44da,_0x825466){return db['CmContactHasItem'][_0x75c1('0x4d')](_0x1d44da['body'],{})[_0x75c1('0x2a')](function(_0x25efe2){var _0x1f4505=_0x1d44da[_0x75c1('0x4e')][_0x75c1('0x28')]({'plain':!![]});if(!_0x1f4505)throw new Error(_0x75c1('0x4f'));if(_0x1f4505['role']===_0x75c1('0x4e')){var _0x2abcd6=_0x25efe2[_0x75c1('0x28')]({'plain':!![]});var _0x1aec1b=_0x75c1('0x29');return db[_0x75c1('0x50')][_0x75c1('0x4c')]({'where':{'name':_0x1aec1b,'userProfileId':_0x1f4505[_0x75c1('0x51')]},'raw':!![]})[_0x75c1('0x2a')](function(_0x20cda7){if(_0x20cda7&&_0x20cda7[_0x75c1('0x52')]===0x0){return db[_0x75c1('0x53')]['create']({'name':_0x2abcd6[_0x75c1('0x2d')],'resourceId':_0x2abcd6['id'],'type':_0x20cda7[_0x75c1('0x2d')],'sectionId':_0x20cda7['id']},{})['then'](function(){return _0x25efe2;});}else{return _0x25efe2;}})[_0x75c1('0x48')](function(_0x4757f1){logger[_0x75c1('0x2b')](_0x75c1('0x54'),_0x4757f1);throw _0x4757f1;});}return _0x25efe2;})[_0x75c1('0x2a')](respondWithResult(_0x825466,0xc9))[_0x75c1('0x48')](handleError(_0x825466,null));};exports[_0x75c1('0x26')]=function(_0x129d33,_0x3ab0ae){if(_0x129d33[_0x75c1('0x55')]['id']){delete _0x129d33['body']['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x129d33['params']['id']}})[_0x75c1('0x2a')](handleEntityNotFound(_0x3ab0ae,null))[_0x75c1('0x2a')](saveUpdates(_0x129d33[_0x75c1('0x55')],null))[_0x75c1('0x2a')](respondWithResult(_0x3ab0ae,null))['catch'](handleError(_0x3ab0ae,null));};exports[_0x75c1('0x27')]=function(_0x23b619,_0x5c80b3){return db[_0x75c1('0x30')][_0x75c1('0x4c')]({'where':{'id':_0x23b619['params']['id']}})[_0x75c1('0x2a')](handleEntityNotFound(_0x5c80b3,null))[_0x75c1('0x2a')](removeEntity(_0x5c80b3,null))[_0x75c1('0x48')](handleError(_0x5c80b3,null));}; \ No newline at end of file +var _0xe249=['includeAll','include','findAll','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','name','send','index','map','CmContactHasItem','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count'];(function(_0x7967fc,_0x14e753){var _0x351203=function(_0x38a68a){while(--_0x38a68a){_0x7967fc['push'](_0x7967fc['shift']());}};_0x351203(++_0x14e753);}(_0xe249,0x172));var _0x9e24=function(_0x5f540f,_0x390da4){_0x5f540f=_0x5f540f-0x0;var _0x15e8f8=_0xe249[_0x5f540f];return _0x15e8f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e24('0x0'));var zipdir=require(_0x9e24('0x1'));var jsonpatch=require(_0x9e24('0x2'));var rp=require(_0x9e24('0x3'));var moment=require(_0x9e24('0x4'));var BPromise=require(_0x9e24('0x5'));var Mustache=require(_0x9e24('0x6'));var util=require('util');var path=require(_0x9e24('0x7'));var sox=require(_0x9e24('0x8'));var csv=require(_0x9e24('0x9'));var ejs=require(_0x9e24('0xa'));var fs=require('fs');var fs_extra=require(_0x9e24('0xb'));var _=require(_0x9e24('0xc'));var squel=require(_0x9e24('0xd'));var crypto=require(_0x9e24('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9e24('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9e24('0x10'));var Papa=require(_0x9e24('0x11'));var Redis=require(_0x9e24('0x12'));var authService=require(_0x9e24('0x13'));var qs=require(_0x9e24('0x14'));var as=require(_0x9e24('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e24('0x16'))(_0x9e24('0x17'));var utils=require(_0x9e24('0x18'));var config=require(_0x9e24('0x19'));var licenseUtil=require(_0x9e24('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41885d,_0x5a083f){_0x5a083f=_0x5a083f||0xcc;return function(_0x1da12c){if(_0x1da12c){return _0x41885d[_0x9e24('0x1b')](_0x5a083f);}return _0x41885d[_0x9e24('0x1c')](_0x5a083f)[_0x9e24('0x1d')]();};}function respondWithResult(_0x19b387,_0x4a8640){_0x4a8640=_0x4a8640||0xc8;return function(_0x269e35){if(_0x269e35){return _0x19b387[_0x9e24('0x1c')](_0x4a8640)[_0x9e24('0x1e')](_0x269e35);}};}function respondWithFilteredResult(_0x561fa5,_0x53ef35){return function(_0x41dfe4){if(_0x41dfe4){var _0x25ea1e=typeof _0x53ef35[_0x9e24('0x1f')]==='undefined'&&typeof _0x53ef35['limit']===_0x9e24('0x20');var _0x1320a4=_0x41dfe4['count'];var _0x6e9a8d=_0x25ea1e?0x0:_0x53ef35[_0x9e24('0x1f')];var _0x4b37d3=_0x25ea1e?_0x41dfe4['count']:_0x53ef35['offset']+_0x53ef35[_0x9e24('0x21')];var _0x2756a9;if(_0x4b37d3>=_0x1320a4){_0x4b37d3=_0x1320a4;_0x2756a9=0xc8;}else{_0x2756a9=0xce;}_0x561fa5[_0x9e24('0x1c')](_0x2756a9);return _0x561fa5[_0x9e24('0x22')]('Content-Range',_0x6e9a8d+'-'+_0x4b37d3+'/'+_0x1320a4)[_0x9e24('0x1e')](_0x41dfe4);}return null;};}function patchUpdates(_0x18925d){return function(_0x2626db){try{jsonpatch[_0x9e24('0x23')](_0x2626db,_0x18925d,!![]);}catch(_0x17347a){return BPromise[_0x9e24('0x24')](_0x17347a);}return _0x2626db[_0x9e24('0x25')]();};}function saveUpdates(_0x178763,_0x1dd77b){return function(_0x2552ae){if(_0x2552ae){return _0x2552ae[_0x9e24('0x26')](_0x178763)[_0x9e24('0x27')](function(_0x3650ce){return _0x3650ce;});}return null;};}function removeEntity(_0x2d56a5,_0x164f9a){return function(_0x4b43bd){if(_0x4b43bd){return _0x4b43bd[_0x9e24('0x28')]()[_0x9e24('0x27')](function(){var _0x19032d=_0x4b43bd['get']({'plain':!![]});var _0x25d31f=_0x9e24('0x29');return db[_0x9e24('0x2a')][_0x9e24('0x28')]({'where':{'type':_0x25d31f,'resourceId':_0x19032d['id']}})['then'](function(){return _0x4b43bd;});})[_0x9e24('0x27')](function(){_0x2d56a5[_0x9e24('0x1c')](0xcc)[_0x9e24('0x1d')]();});}};}function handleEntityNotFound(_0x103b7a,_0x2492ca){return function(_0x577729){if(!_0x577729){_0x103b7a['sendStatus'](0x194);}return _0x577729;};}function handleError(_0x275ff3,_0x523a0b){_0x523a0b=_0x523a0b||0x1f4;return function(_0x5616e9){logger[_0x9e24('0x2b')](_0x5616e9['stack']);if(_0x5616e9[_0x9e24('0x2c')]){delete _0x5616e9[_0x9e24('0x2c')];}_0x275ff3[_0x9e24('0x1c')](_0x523a0b)[_0x9e24('0x2d')](_0x5616e9);};}exports[_0x9e24('0x2e')]=function(_0x2e0cb5,_0x3d2a03){var _0x573fd5={},_0xc65870={},_0x1fdea2={'count':0x0,'rows':[]};var _0x4c8b6a=_[_0x9e24('0x2f')](db[_0x9e24('0x30')][_0x9e24('0x31')],function(_0x5b4c44){return{'name':_0x5b4c44['fieldName'],'type':_0x5b4c44[_0x9e24('0x32')][_0x9e24('0x33')]};});_0xc65870['model']=_[_0x9e24('0x2f')](_0x4c8b6a,_0x9e24('0x2c'));_0xc65870[_0x9e24('0x34')]=_[_0x9e24('0x35')](_0x2e0cb5[_0x9e24('0x34')]);_0xc65870[_0x9e24('0x36')]=_[_0x9e24('0x37')](_0xc65870['model'],_0xc65870['query']);_0x573fd5['attributes']=_[_0x9e24('0x37')](_0xc65870[_0x9e24('0x38')],qs[_0x9e24('0x39')](_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x39')]));_0x573fd5['attributes']=_0x573fd5[_0x9e24('0x3a')][_0x9e24('0x3b')]?_0x573fd5['attributes']:_0xc65870[_0x9e24('0x38')];if(!_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x3c')](_0x9e24('0x3d'))){_0x573fd5['limit']=qs[_0x9e24('0x21')](_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x21')]);_0x573fd5[_0x9e24('0x1f')]=qs[_0x9e24('0x1f')](_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x1f')]);}_0x573fd5[_0x9e24('0x3e')]=qs['sort'](_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x3f')]);_0x573fd5['where']=qs[_0x9e24('0x36')](_['pick'](_0x2e0cb5[_0x9e24('0x34')],_0xc65870[_0x9e24('0x36')]),_0x4c8b6a);if(_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x40')]){_0x573fd5[_0x9e24('0x41')]=_[_0x9e24('0x42')](_0x573fd5[_0x9e24('0x41')],{'$or':_[_0x9e24('0x2f')](_0x4c8b6a,function(_0x494970){if(_0x494970[_0x9e24('0x32')]!==_0x9e24('0x43')){var _0x2fc608={};_0x2fc608[_0x494970[_0x9e24('0x2c')]]={'$like':'%'+_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x40')]+'%'};return _0x2fc608;}})});}_0x573fd5=_['merge']({},_0x573fd5,_0x2e0cb5[_0x9e24('0x44')]);var _0x42b2a7={'where':_0x573fd5['where']};return db[_0x9e24('0x30')][_0x9e24('0x45')](_0x42b2a7)[_0x9e24('0x27')](function(_0x5c1f80){_0x1fdea2[_0x9e24('0x45')]=_0x5c1f80;if(_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x46')]){_0x573fd5[_0x9e24('0x47')]=[{'all':!![]}];}return db[_0x9e24('0x30')][_0x9e24('0x48')](_0x573fd5);})['then'](function(_0x4ba964){_0x1fdea2[_0x9e24('0x49')]=_0x4ba964;return _0x1fdea2;})['then'](respondWithFilteredResult(_0x3d2a03,_0x573fd5))[_0x9e24('0x4a')](handleError(_0x3d2a03,null));};exports[_0x9e24('0x4b')]=function(_0x4ec434,_0xb90ec3){var _0x4d4449={'raw':!![],'where':{'id':_0x4ec434['params']['id']}},_0x256b7f={};_0x256b7f[_0x9e24('0x38')]=_[_0x9e24('0x35')](db[_0x9e24('0x30')][_0x9e24('0x31')]);_0x256b7f[_0x9e24('0x34')]=_['keys'](_0x4ec434[_0x9e24('0x34')]);_0x256b7f[_0x9e24('0x36')]=_[_0x9e24('0x37')](_0x256b7f['model'],_0x256b7f['query']);_0x4d4449['attributes']=_[_0x9e24('0x37')](_0x256b7f[_0x9e24('0x38')],qs[_0x9e24('0x39')](_0x4ec434['query']['fields']));_0x4d4449['attributes']=_0x4d4449[_0x9e24('0x3a')]['length']?_0x4d4449[_0x9e24('0x3a')]:_0x256b7f['model'];if(_0x4ec434[_0x9e24('0x34')][_0x9e24('0x46')]){_0x4d4449[_0x9e24('0x47')]=[{'all':!![]}];}_0x4d4449=_[_0x9e24('0x42')]({},_0x4d4449,_0x4ec434[_0x9e24('0x44')]);return db[_0x9e24('0x30')]['find'](_0x4d4449)[_0x9e24('0x27')](handleEntityNotFound(_0xb90ec3,null))[_0x9e24('0x27')](respondWithResult(_0xb90ec3,null))[_0x9e24('0x4a')](handleError(_0xb90ec3,null));};exports[_0x9e24('0x4c')]=function(_0x344e6e,_0x48b84b){return db[_0x9e24('0x30')][_0x9e24('0x4c')](_0x344e6e[_0x9e24('0x4d')],{})['then'](function(_0x18d1a0){var _0x42778b=_0x344e6e[_0x9e24('0x4e')][_0x9e24('0x4f')]({'plain':!![]});if(!_0x42778b)throw new Error(_0x9e24('0x50'));if(_0x42778b[_0x9e24('0x51')]===_0x9e24('0x4e')){var _0x5b79ef=_0x18d1a0[_0x9e24('0x4f')]({'plain':!![]});var _0x7e3dd7='CmContactHasItems';return db[_0x9e24('0x52')][_0x9e24('0x53')]({'where':{'name':_0x7e3dd7,'userProfileId':_0x42778b[_0x9e24('0x54')]},'raw':!![]})[_0x9e24('0x27')](function(_0x41fd48){if(_0x41fd48&&_0x41fd48[_0x9e24('0x55')]===0x0){return db[_0x9e24('0x2a')][_0x9e24('0x4c')]({'name':_0x5b79ef[_0x9e24('0x2c')],'resourceId':_0x5b79ef['id'],'type':_0x41fd48['name'],'sectionId':_0x41fd48['id']},{})[_0x9e24('0x27')](function(){return _0x18d1a0;});}else{return _0x18d1a0;}})['catch'](function(_0x936dd4){logger[_0x9e24('0x2b')](_0x9e24('0x56'),_0x936dd4);throw _0x936dd4;});}return _0x18d1a0;})['then'](respondWithResult(_0x48b84b,0xc9))[_0x9e24('0x4a')](handleError(_0x48b84b,null));};exports[_0x9e24('0x26')]=function(_0x5ea97c,_0x2c29f8){if(_0x5ea97c[_0x9e24('0x4d')]['id']){delete _0x5ea97c[_0x9e24('0x4d')]['id'];}return db['CmContactHasItem'][_0x9e24('0x53')]({'where':{'id':_0x5ea97c[_0x9e24('0x57')]['id']}})[_0x9e24('0x27')](handleEntityNotFound(_0x2c29f8,null))['then'](saveUpdates(_0x5ea97c[_0x9e24('0x4d')],null))[_0x9e24('0x27')](respondWithResult(_0x2c29f8,null))[_0x9e24('0x4a')](handleError(_0x2c29f8,null));};exports[_0x9e24('0x28')]=function(_0x11b679,_0x33236f){return db['CmContactHasItem'][_0x9e24('0x53')]({'where':{'id':_0x11b679['params']['id']}})[_0x9e24('0x27')](handleEntityNotFound(_0x33236f,null))[_0x9e24('0x27')](removeEntity(_0x33236f,null))[_0x9e24('0x4a')](handleError(_0x33236f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index b57bc25..ed213ec 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 _0xe996=['path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c17d8,_0x51cc20){var _0x1841de=function(_0x128311){while(--_0x128311){_0x5c17d8['push'](_0x5c17d8['shift']());}};_0x1841de(++_0x51cc20);}(_0xe996,0x1e8));var _0x6e99=function(_0x3c8abc,_0xdb0295){_0x3c8abc=_0x3c8abc-0x0;var _0x420d0=_0xe996[_0x3c8abc];return _0x420d0;};'use strict';var _=require(_0x6e99('0x0'));var util=require('util');var logger=require(_0x6e99('0x1'))(_0x6e99('0x2'));var moment=require(_0x6e99('0x3'));var BPromise=require(_0x6e99('0x4'));var rp=require(_0x6e99('0x5'));var fs=require('fs');var path=require(_0x6e99('0x6'));var rimraf=require('rimraf');var config=require(_0x6e99('0x7'));var attributes=require(_0x6e99('0x8'));module[_0x6e99('0x9')]=function(_0x1c4e8c,_0x4b20c1){return _0x1c4e8c[_0x6e99('0xa')](_0x6e99('0xb'),attributes,{'tableName':_0x6e99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b3c=['./cmContactHasItem.attributes','CmContactHasItem','cm_contact_has_items','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x15263e,_0x58d1ad){var _0xfa15b6=function(_0x4beecc){while(--_0x4beecc){_0x15263e['push'](_0x15263e['shift']());}};_0xfa15b6(++_0x58d1ad);}(_0x2b3c,0xc9));var _0xc2b3=function(_0x29efd7,_0x25bbf5){_0x29efd7=_0x29efd7-0x0;var _0x11fb6d=_0x2b3c[_0x29efd7];return _0x11fb6d;};'use strict';var _=require('lodash');var util=require(_0xc2b3('0x0'));var logger=require(_0xc2b3('0x1'))(_0xc2b3('0x2'));var moment=require(_0xc2b3('0x3'));var BPromise=require(_0xc2b3('0x4'));var rp=require(_0xc2b3('0x5'));var fs=require('fs');var path=require(_0xc2b3('0x6'));var rimraf=require(_0xc2b3('0x7'));var config=require('../../config/environment');var attributes=require(_0xc2b3('0x8'));module['exports']=function(_0x1d3809,_0x7359c9){return _0x1d3809['define'](_0xc2b3('0x9'),attributes,{'tableName':_0xc2b3('0xa'),'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 0258290..6af14e1 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 _0x0e44=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','CmContactHasItem,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x35bd9e,_0x3fc3c0){var _0x2a5eae=function(_0x5e635e){while(--_0x5e635e){_0x35bd9e['push'](_0x35bd9e['shift']());}};_0x2a5eae(++_0x3fc3c0);}(_0x0e44,0x8b));var _0x40e4=function(_0x10bc64,_0x56e086){_0x10bc64=_0x10bc64-0x0;var _0x4f8bea=_0x0e44[_0x10bc64];return _0x4f8bea;};'use strict';var _=require(_0x40e4('0x0'));var util=require('util');var moment=require(_0x40e4('0x1'));var BPromise=require(_0x40e4('0x2'));var rs=require(_0x40e4('0x3'));var fs=require('fs');var Redis=require(_0x40e4('0x4'));var db=require(_0x40e4('0x5'))['db'];var utils=require(_0x40e4('0x6'));var logger=require(_0x40e4('0x7'))(_0x40e4('0x8'));var config=require(_0x40e4('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b025f,_0x56e5fd,_0x3704c9){return new BPromise(function(_0x20e588,_0x180f78){return client[_0x40e4('0xa')](_0x1b025f,_0x3704c9)[_0x40e4('0xb')](function(_0x1d7f2d){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x56e5fd,_0x40e4('0xc'));logger['debug'](_0x40e4('0xd'),_0x56e5fd,'request\x20sent',JSON['stringify'](_0x1d7f2d));if(_0x1d7f2d[_0x40e4('0xe')]){if(_0x1d7f2d[_0x40e4('0xe')][_0x40e4('0xf')]===0x1f4){logger['error'](_0x40e4('0x10'),_0x56e5fd,_0x1d7f2d[_0x40e4('0xe')]['message']);return _0x180f78(_0x1d7f2d[_0x40e4('0xe')]['message']);}logger[_0x40e4('0xe')](_0x40e4('0x10'),_0x56e5fd,_0x1d7f2d['error'][_0x40e4('0x11')]);return _0x20e588(_0x1d7f2d['error'][_0x40e4('0x11')]);}else{logger[_0x40e4('0x12')](_0x40e4('0x10'),_0x56e5fd,'request\x20sent');_0x20e588(_0x1d7f2d[_0x40e4('0x13')][_0x40e4('0x11')]);}})['catch'](function(_0x321460){logger['error'](_0x40e4('0x10'),_0x56e5fd,_0x321460);_0x180f78(_0x321460);});});} \ No newline at end of file +var _0xdd21=['../../config/environment','jayson/promise','http','request','then','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','CmContactHasItem,\x20%s,\x20%s','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d5853,_0x398ac2){var _0x5608df=function(_0x581ba6){while(--_0x581ba6){_0x3d5853['push'](_0x3d5853['shift']());}};_0x5608df(++_0x398ac2);}(_0xdd21,0x19b));var _0x1dd2=function(_0xf771fe,_0x1d1fa8){_0xf771fe=_0xf771fe-0x0;var _0x27eecc=_0xdd21[_0xf771fe];return _0x27eecc;};'use strict';var _=require(_0x1dd2('0x0'));var util=require(_0x1dd2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1dd2('0x2'));var fs=require('fs');var Redis=require(_0x1dd2('0x3'));var db=require(_0x1dd2('0x4'))['db'];var utils=require(_0x1dd2('0x5'));var logger=require(_0x1dd2('0x6'))('rpc');var config=require(_0x1dd2('0x7'));var jayson=require(_0x1dd2('0x8'));var client=jayson['client'][_0x1dd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56e5f4,_0x42ec7c,_0x50b991){return new BPromise(function(_0x547622,_0x502618){return client[_0x1dd2('0xa')](_0x56e5f4,_0x50b991)[_0x1dd2('0xb')](function(_0x2b5354){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x42ec7c,_0x1dd2('0xc'));logger['debug'](_0x1dd2('0xd'),_0x42ec7c,_0x1dd2('0xc'),JSON[_0x1dd2('0xe')](_0x2b5354));if(_0x2b5354[_0x1dd2('0xf')]){if(_0x2b5354['error']['code']===0x1f4){logger[_0x1dd2('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x42ec7c,_0x2b5354[_0x1dd2('0xf')][_0x1dd2('0x10')]);return _0x502618(_0x2b5354[_0x1dd2('0xf')][_0x1dd2('0x10')]);}logger[_0x1dd2('0xf')](_0x1dd2('0x11'),_0x42ec7c,_0x2b5354[_0x1dd2('0xf')]['message']);return _0x547622(_0x2b5354[_0x1dd2('0xf')][_0x1dd2('0x10')]);}else{logger['info'](_0x1dd2('0x11'),_0x42ec7c,'request\x20sent');_0x547622(_0x2b5354[_0x1dd2('0x12')][_0x1dd2('0x10')]);}})['catch'](function(_0x36793e){logger[_0x1dd2('0xf')](_0x1dd2('0x11'),_0x42ec7c,_0x36793e);_0x502618(_0x36793e);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index ee73d2b..acba576 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 _0x9e17=['put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3a60ff,_0x3996fb){var _0x1f256d=function(_0xdc8362){while(--_0xdc8362){_0x3a60ff['push'](_0x3a60ff['shift']());}};_0x1f256d(++_0x3996fb);}(_0x9e17,0x6b));var _0x79e1=function(_0x25c044,_0xbd05f8){_0x25c044=_0x25c044-0x0;var _0x558ee5=_0x9e17[_0x25c044];return _0x558ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79e1('0x0'));var timeout=require('connect-timeout');var express=require(_0x79e1('0x1'));var router=express[_0x79e1('0x2')]();var fs_extra=require(_0x79e1('0x3'));var auth=require(_0x79e1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0x79e1('0x5')]('/',auth[_0x79e1('0x6')](),controller[_0x79e1('0x7')]);router[_0x79e1('0x5')](_0x79e1('0x8'),auth[_0x79e1('0x6')](),controller[_0x79e1('0x9')]);router[_0x79e1('0xa')]('/',auth[_0x79e1('0x6')](),controller[_0x79e1('0xb')]);router[_0x79e1('0xc')](_0x79e1('0x8'),auth[_0x79e1('0x6')](),controller[_0x79e1('0xd')]);router[_0x79e1('0xe')](_0x79e1('0x8'),auth['isAuthenticated'](),controller[_0x79e1('0xf')]);module[_0x79e1('0x10')]=router; \ No newline at end of file +var _0x2864=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer'];(function(_0x2fe123,_0x397321){var _0x585623=function(_0x385c90){while(--_0x385c90){_0x2fe123['push'](_0x2fe123['shift']());}};_0x585623(++_0x397321);}(_0x2864,0x179));var _0x4286=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x2864[_0x40be86];return _0xda3c3b;};'use strict';var multer=require(_0x4286('0x0'));var util=require(_0x4286('0x1'));var path=require('path');var timeout=require(_0x4286('0x2'));var express=require(_0x4286('0x3'));var router=express[_0x4286('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4286('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4286('0x6'));var controller=require(_0x4286('0x7'));router[_0x4286('0x8')]('/',auth[_0x4286('0x9')](),controller[_0x4286('0xa')]);router[_0x4286('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4286('0xb')]);router[_0x4286('0xc')]('/',auth[_0x4286('0x9')](),controller[_0x4286('0xd')]);router[_0x4286('0xe')](_0x4286('0xf'),auth[_0x4286('0x9')](),controller[_0x4286('0x10')]);router[_0x4286('0x11')]('/:id',auth[_0x4286('0x9')](),controller['destroy']);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 80b1bdb..b2a8af5 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 _0xa4c2=['values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','select'];(function(_0x4b9108,_0x2cce77){var _0x365982=function(_0x4dc3fb){while(--_0x4dc3fb){_0x4b9108['push'](_0x4b9108['shift']());}};_0x365982(++_0x2cce77);}(_0xa4c2,0xf0));var _0x2a4c=function(_0x5799e1,_0x25ef85){_0x5799e1=_0x5799e1-0x0;var _0x30822c=_0xa4c2[_0x5799e1];return _0x30822c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2a4c('0x0'));module[_0x2a4c('0x1')]={'name':{'type':Sequelize[_0x2a4c('0x2')],'get':function(_0x41b06b){return this['getDataValue'](_0x2a4c('0x3'));}},'alias':{'type':Sequelize[_0x2a4c('0x4')],'allowNull':![],'set':function(_0x9c66c2){this[_0x2a4c('0x5')](_0x2a4c('0x3'),_0x9c66c2?_0x9c66c2:this[_0x2a4c('0x6')](_0x2a4c('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x2a4c('0x8')](_0x2a4c('0x9')),'get':function(){if(this['getDataValue'](_0x2a4c('0xa'))===_0x2a4c('0xb')){return JSON['parse'](this[_0x2a4c('0x6')](_0x2a4c('0xc')));}else{return this[_0x2a4c('0x6')]('values');}},'set':function(_0x4c8117){if(Array[_0x2a4c('0xd')](_0x4c8117)){this[_0x2a4c('0x5')](_0x2a4c('0xc'),JSON[_0x2a4c('0xe')](_0x4c8117));}else{this[_0x2a4c('0x5')](_0x2a4c('0xc'),_0x4c8117);}}},'required':{'type':Sequelize[_0x2a4c('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x2a4c('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2a4c('0x10')](_0x2a4c('0x11'))}}; \ No newline at end of file +var _0x1a5c=['long','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT'];(function(_0x124ab0,_0x5556fe){var _0x51be00=function(_0x51ecc2){while(--_0x51ecc2){_0x124ab0['push'](_0x124ab0['shift']());}};_0x51be00(++_0x5556fe);}(_0x1a5c,0x1cb));var _0xc1a5=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x1a5c[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0xc1a5('0x0'));var _=require(_0xc1a5('0x1'));module[_0xc1a5('0x2')]={'name':{'type':Sequelize[_0xc1a5('0x3')],'get':function(_0x6eb0cb){return this[_0xc1a5('0x4')](_0xc1a5('0x5'));}},'alias':{'type':Sequelize[_0xc1a5('0x6')],'allowNull':![],'set':function(_0x239b60){this[_0xc1a5('0x7')](_0xc1a5('0x5'),_0x239b60?_0x239b60:this[_0xc1a5('0x4')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xc1a5('0x8')](_0xc1a5('0x9')),'get':function(){if(this[_0xc1a5('0x4')](_0xc1a5('0xa'))==='select'){return JSON[_0xc1a5('0xb')](this[_0xc1a5('0x4')](_0xc1a5('0xc')));}else{return this[_0xc1a5('0x4')](_0xc1a5('0xc'));}},'set':function(_0x366101){if(Array[_0xc1a5('0xd')](_0x366101)){this[_0xc1a5('0x7')](_0xc1a5('0xc'),JSON[_0xc1a5('0xe')](_0x366101));}else{this[_0xc1a5('0x7')]('values',_0x366101);}}},'required':{'type':Sequelize[_0xc1a5('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc1a5('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc1a5('0x10')](_0xc1a5('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index dbae48b..c7bc308 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 _0xb628=['length','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','rows','show','params','rawAttributes','find','catch','body','sequelize','transaction','create','Sequelize','TEXT','text','switch','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','map','CmCustomField','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x3020e0,_0x8f72ac){var _0x3de063=function(_0x69444a){while(--_0x69444a){_0x3020e0['push'](_0x3020e0['shift']());}};_0x3de063(++_0x8f72ac);}(_0xb628,0x113));var _0x8b62=function(_0x15c6a4,_0x29051a){_0x15c6a4=_0x15c6a4-0x0;var _0x13f835=_0xb628[_0x15c6a4];return _0x13f835;};'use strict';var emlformat=require(_0x8b62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b62('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b62('0x2'));var moment=require(_0x8b62('0x3'));var BPromise=require(_0x8b62('0x4'));var Mustache=require(_0x8b62('0x5'));var util=require(_0x8b62('0x6'));var path=require(_0x8b62('0x7'));var sox=require(_0x8b62('0x8'));var csv=require('to-csv');var ejs=require(_0x8b62('0x9'));var fs=require('fs');var fs_extra=require(_0x8b62('0xa'));var _=require(_0x8b62('0xb'));var squel=require(_0x8b62('0xc'));var crypto=require(_0x8b62('0xd'));var jsforce=require(_0x8b62('0xe'));var deskjs=require(_0x8b62('0xf'));var toCsv=require(_0x8b62('0x10'));var querystring=require(_0x8b62('0x11'));var Papa=require(_0x8b62('0x12'));var Redis=require('ioredis');var authService=require(_0x8b62('0x13'));var qs=require(_0x8b62('0x14'));var as=require(_0x8b62('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b62('0x16'))(_0x8b62('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b62('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bbc67,_0x16e5fe){_0x16e5fe=_0x16e5fe||0xcc;return function(_0x196f3f){if(_0x196f3f){return _0x3bbc67[_0x8b62('0x19')](_0x16e5fe);}return _0x3bbc67[_0x8b62('0x1a')](_0x16e5fe)[_0x8b62('0x1b')]();};}function respondWithResult(_0xa862dd,_0x52c1a5){_0x52c1a5=_0x52c1a5||0xc8;return function(_0x491c4c){if(_0x491c4c){return _0xa862dd[_0x8b62('0x1a')](_0x52c1a5)[_0x8b62('0x1c')](_0x491c4c);}};}function respondWithFilteredResult(_0xa75b0a,_0x1419ce){return function(_0x2cce4e){if(_0x2cce4e){var _0x43e006=typeof _0x1419ce[_0x8b62('0x1d')]===_0x8b62('0x1e')&&typeof _0x1419ce[_0x8b62('0x1f')]===_0x8b62('0x1e');var _0x431836=_0x2cce4e[_0x8b62('0x20')];var _0x26128e=_0x43e006?0x0:_0x1419ce[_0x8b62('0x1d')];var _0x103d5f=_0x43e006?_0x2cce4e[_0x8b62('0x20')]:_0x1419ce[_0x8b62('0x1d')]+_0x1419ce['limit'];var _0x28bb96;if(_0x103d5f>=_0x431836){_0x103d5f=_0x431836;_0x28bb96=0xc8;}else{_0x28bb96=0xce;}_0xa75b0a['status'](_0x28bb96);return _0xa75b0a[_0x8b62('0x21')](_0x8b62('0x22'),_0x26128e+'-'+_0x103d5f+'/'+_0x431836)[_0x8b62('0x1c')](_0x2cce4e);}return null;};}function patchUpdates(_0x47337c){return function(_0xaf75d){try{jsonpatch[_0x8b62('0x23')](_0xaf75d,_0x47337c,!![]);}catch(_0x4c9ba3){return BPromise['reject'](_0x4c9ba3);}return _0xaf75d[_0x8b62('0x24')]();};}function saveUpdates(_0x2a9123,_0x10402f){return function(_0x3bc263){if(_0x3bc263){return _0x3bc263[_0x8b62('0x25')](_0x2a9123)['then'](function(_0x3a1d22){return _0x3a1d22;});}return null;};}function removeEntity(_0x2578f1,_0x2c4f52){return function(_0x5af022){if(_0x5af022){return _0x5af022[_0x8b62('0x26')]()[_0x8b62('0x27')](function(){_0x2578f1[_0x8b62('0x1a')](0xcc)[_0x8b62('0x1b')]();});}};}function handleEntityNotFound(_0x1131d0,_0x5dbfd0){return function(_0x193f7d){if(!_0x193f7d){_0x1131d0[_0x8b62('0x19')](0x194);}return _0x193f7d;};}function handleError(_0x385e1f,_0x33b737){_0x33b737=_0x33b737||0x1f4;return function(_0x4a5f67){logger[_0x8b62('0x28')](_0x4a5f67[_0x8b62('0x29')]);if(_0x4a5f67[_0x8b62('0x2a')]){delete _0x4a5f67['name'];}_0x385e1f[_0x8b62('0x1a')](_0x33b737)['send'](_0x4a5f67);};}exports['index']=function(_0x5e64e2,_0x4488bc){var _0x5ee765={},_0x554741={},_0x5e80a3={'count':0x0,'rows':[]};var _0x5d3296=_[_0x8b62('0x2b')](db[_0x8b62('0x2c')]['rawAttributes'],function(_0x1431fe){return{'name':_0x1431fe['fieldName'],'type':_0x1431fe['type'][_0x8b62('0x2d')]};});_0x554741[_0x8b62('0x2e')]=_['differenceBy'](_[_0x8b62('0x2b')](_0x5d3296,'name'),['name']);_0x554741[_0x8b62('0x2f')]=_[_0x8b62('0x30')](_0x5e64e2[_0x8b62('0x2f')]);_0x554741[_0x8b62('0x31')]=_['intersection'](_0x554741['model'],_0x554741[_0x8b62('0x2f')]);_0x5ee765['attributes']=_[_0x8b62('0x32')](_0x554741['model'],qs[_0x8b62('0x33')](_0x5e64e2['query'][_0x8b62('0x33')]));_0x5ee765[_0x8b62('0x34')]=_0x5ee765['attributes'][_0x8b62('0x35')]?_0x5ee765[_0x8b62('0x34')]:_0x554741[_0x8b62('0x2e')];if(!_0x5e64e2[_0x8b62('0x2f')]['hasOwnProperty']('nolimit')){_0x5ee765[_0x8b62('0x1f')]=qs[_0x8b62('0x1f')](_0x5e64e2[_0x8b62('0x2f')][_0x8b62('0x1f')]);_0x5ee765[_0x8b62('0x1d')]=qs[_0x8b62('0x1d')](_0x5e64e2['query']['offset']);}_0x5ee765[_0x8b62('0x36')]=qs[_0x8b62('0x37')](_0x5e64e2['query'][_0x8b62('0x37')]);_0x5ee765[_0x8b62('0x38')]=qs[_0x8b62('0x31')](_[_0x8b62('0x39')](_0x5e64e2['query'],_0x554741[_0x8b62('0x31')]),_0x5d3296);if(_0x5e64e2['query']['filter']){_0x5ee765['where']=_['merge'](_0x5ee765[_0x8b62('0x38')],{'$or':_[_0x8b62('0x2b')](_0x5d3296,function(_0x470879){if(_0x470879[_0x8b62('0x3a')]!==_0x8b62('0x3b')){var _0x438573={};_0x438573[_0x470879[_0x8b62('0x2a')]]={'$like':'%'+_0x5e64e2[_0x8b62('0x2f')][_0x8b62('0x3c')]+'%'};return _0x438573;}})});}_0x5ee765=_[_0x8b62('0x3d')]({},_0x5ee765,_0x5e64e2[_0x8b62('0x3e')]);var _0x2b2b9c={'where':_0x5ee765[_0x8b62('0x38')]};return db[_0x8b62('0x2c')][_0x8b62('0x20')](_0x2b2b9c)[_0x8b62('0x27')](function(_0x379065){_0x5e80a3[_0x8b62('0x20')]=_0x379065;if(_0x5e64e2['query'][_0x8b62('0x3f')]){_0x5ee765['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x5ee765);})[_0x8b62('0x27')](function(_0x57653b){_0x5e80a3[_0x8b62('0x40')]=_0x57653b;return _0x5e80a3;})[_0x8b62('0x27')](respondWithFilteredResult(_0x4488bc,_0x5ee765))['catch'](handleError(_0x4488bc,null));};exports[_0x8b62('0x41')]=function(_0x9900cf,_0x4ac670){var _0x368a4a={'raw':!![],'where':{'id':_0x9900cf[_0x8b62('0x42')]['id']}},_0x243ac9={};_0x243ac9['model']=_['keys'](db[_0x8b62('0x2c')][_0x8b62('0x43')]);_0x243ac9[_0x8b62('0x2f')]=_[_0x8b62('0x30')](_0x9900cf[_0x8b62('0x2f')]);_0x243ac9[_0x8b62('0x31')]=_['intersection'](_0x243ac9[_0x8b62('0x2e')],_0x243ac9[_0x8b62('0x2f')]);_0x368a4a[_0x8b62('0x34')]=_[_0x8b62('0x32')](_0x243ac9[_0x8b62('0x2e')],qs['fields'](_0x9900cf[_0x8b62('0x2f')][_0x8b62('0x33')]));_0x368a4a[_0x8b62('0x34')]=_0x368a4a[_0x8b62('0x34')][_0x8b62('0x35')]?_0x368a4a[_0x8b62('0x34')]:_0x243ac9[_0x8b62('0x2e')];if(_0x9900cf[_0x8b62('0x2f')][_0x8b62('0x3f')]){_0x368a4a['include']=[{'all':!![]}];}_0x368a4a=_[_0x8b62('0x3d')]({},_0x368a4a,_0x9900cf[_0x8b62('0x3e')]);return db[_0x8b62('0x2c')][_0x8b62('0x44')](_0x368a4a)[_0x8b62('0x27')](handleEntityNotFound(_0x4ac670,null))[_0x8b62('0x27')](respondWithResult(_0x4ac670,null))[_0x8b62('0x45')](handleError(_0x4ac670,null));};exports[_0x8b62('0x25')]=function(_0x33e78c,_0x1e27de){if(_0x33e78c[_0x8b62('0x46')]['id']){delete _0x33e78c[_0x8b62('0x46')]['id'];}return db[_0x8b62('0x2c')][_0x8b62('0x44')]({'where':{'id':_0x33e78c[_0x8b62('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e27de,null))['then'](saveUpdates(_0x33e78c['body'],null))[_0x8b62('0x27')](respondWithResult(_0x1e27de,null))[_0x8b62('0x45')](handleError(_0x1e27de,null));};exports['destroy']=function(_0x52fd79,_0x563b1a){return db['CmCustomField'][_0x8b62('0x44')]({'where':{'id':_0x52fd79[_0x8b62('0x42')]['id']}})[_0x8b62('0x27')](handleEntityNotFound(_0x563b1a,null))['then'](removeEntity(_0x563b1a,null))[_0x8b62('0x45')](handleError(_0x563b1a,null));};exports['create']=function(_0xcc326a,_0x54ed19){var _0x17f829;return db[_0x8b62('0x47')][_0x8b62('0x48')](function(_0x44be46){return db[_0x8b62('0x2c')][_0x8b62('0x49')](_0xcc326a['body'],{'transaction':_0x44be46})[_0x8b62('0x27')](function(_0x5b9f86){_0x17f829=_0x5b9f86;var _0x4df7aa={'type':db[_0x8b62('0x4a')][_0x8b62('0x4b')],'transaction':_0x44be46};switch(_0xcc326a[_0x8b62('0x46')][_0x8b62('0x3a')]){case _0x8b62('0x4c'):_0x4df7aa[_0x8b62('0x3a')]=db[_0x8b62('0x4a')][_0x8b62('0x4b')];break;case'number':_0x4df7aa[_0x8b62('0x3a')]=db[_0x8b62('0x4a')]['INTEGER'];break;case _0x8b62('0x4d'):_0x4df7aa[_0x8b62('0x3a')]=db[_0x8b62('0x4a')]['BOOLEAN'];_0x4df7aa[_0x8b62('0x4e')]=![];break;default:}return db[_0x8b62('0x47')][_0x8b62('0x4f')][_0x8b62('0x50')](_0x8b62('0x51'),util['format']('cf_%d',_0x17f829['id']),_0x4df7aa);})[_0x8b62('0x27')](function(){return _0x17f829;});})[_0x8b62('0x27')](respondWithResult(_0x54ed19,0xc9))[_0x8b62('0x45')](handleError(_0x54ed19,null));}; \ No newline at end of file +var _0x2d7c=['attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','body','destroy','transaction','create','Sequelize','TEXT','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters'];(function(_0x244819,_0x1a7b04){var _0x294ebc=function(_0x2d04aa){while(--_0x2d04aa){_0x244819['push'](_0x244819['shift']());}};_0x294ebc(++_0x1a7b04);}(_0x2d7c,0x12d));var _0xc2d7=function(_0x11fd4e,_0x1a32ec){_0x11fd4e=_0x11fd4e-0x0;var _0x324371=_0x2d7c[_0x11fd4e];return _0x324371;};'use strict';var emlformat=require(_0xc2d7('0x0'));var rimraf=require(_0xc2d7('0x1'));var zipdir=require(_0xc2d7('0x2'));var jsonpatch=require(_0xc2d7('0x3'));var rp=require(_0xc2d7('0x4'));var moment=require(_0xc2d7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2d7('0x6'));var util=require(_0xc2d7('0x7'));var path=require(_0xc2d7('0x8'));var sox=require(_0xc2d7('0x9'));var csv=require(_0xc2d7('0xa'));var ejs=require(_0xc2d7('0xb'));var fs=require('fs');var fs_extra=require(_0xc2d7('0xc'));var _=require('lodash');var squel=require(_0xc2d7('0xd'));var crypto=require(_0xc2d7('0xe'));var jsforce=require(_0xc2d7('0xf'));var deskjs=require(_0xc2d7('0x10'));var toCsv=require(_0xc2d7('0xa'));var querystring=require(_0xc2d7('0x11'));var Papa=require('papaparse');var Redis=require(_0xc2d7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc2d7('0x13'));var hardwareService=require(_0xc2d7('0x14'));var logger=require(_0xc2d7('0x15'))(_0xc2d7('0x16'));var utils=require(_0xc2d7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc2d7('0x18'));var db=require(_0xc2d7('0x19'))['db'];function respondWithStatusCode(_0x502125,_0xc4668f){_0xc4668f=_0xc4668f||0xcc;return function(_0x2fd576){if(_0x2fd576){return _0x502125[_0xc2d7('0x1a')](_0xc4668f);}return _0x502125[_0xc2d7('0x1b')](_0xc4668f)[_0xc2d7('0x1c')]();};}function respondWithResult(_0x1d0543,_0x5a7a43){_0x5a7a43=_0x5a7a43||0xc8;return function(_0x6cd0ca){if(_0x6cd0ca){return _0x1d0543[_0xc2d7('0x1b')](_0x5a7a43)[_0xc2d7('0x1d')](_0x6cd0ca);}};}function respondWithFilteredResult(_0x35ee16,_0x39c85b){return function(_0x44633f){if(_0x44633f){var _0x372c70=typeof _0x39c85b[_0xc2d7('0x1e')]===_0xc2d7('0x1f')&&typeof _0x39c85b[_0xc2d7('0x20')]===_0xc2d7('0x1f');var _0x465396=_0x44633f[_0xc2d7('0x21')];var _0x1ba3cc=_0x372c70?0x0:_0x39c85b[_0xc2d7('0x1e')];var _0x107a5d=_0x372c70?_0x44633f['count']:_0x39c85b['offset']+_0x39c85b[_0xc2d7('0x20')];var _0x4d4374;if(_0x107a5d>=_0x465396){_0x107a5d=_0x465396;_0x4d4374=0xc8;}else{_0x4d4374=0xce;}_0x35ee16['status'](_0x4d4374);return _0x35ee16[_0xc2d7('0x22')](_0xc2d7('0x23'),_0x1ba3cc+'-'+_0x107a5d+'/'+_0x465396)[_0xc2d7('0x1d')](_0x44633f);}return null;};}function patchUpdates(_0x2098cd){return function(_0x4548f9){try{jsonpatch[_0xc2d7('0x24')](_0x4548f9,_0x2098cd,!![]);}catch(_0x5f3ba1){return BPromise[_0xc2d7('0x25')](_0x5f3ba1);}return _0x4548f9[_0xc2d7('0x26')]();};}function saveUpdates(_0x17a510,_0x20e955){return function(_0x5ea661){if(_0x5ea661){return _0x5ea661[_0xc2d7('0x27')](_0x17a510)[_0xc2d7('0x28')](function(_0x215e2c){return _0x215e2c;});}return null;};}function removeEntity(_0x1248dd,_0x3c79fa){return function(_0x4f615d){if(_0x4f615d){return _0x4f615d['destroy']()[_0xc2d7('0x28')](function(){_0x1248dd[_0xc2d7('0x1b')](0xcc)[_0xc2d7('0x1c')]();});}};}function handleEntityNotFound(_0x5829d6,_0xe4a16b){return function(_0x3ebf84){if(!_0x3ebf84){_0x5829d6['sendStatus'](0x194);}return _0x3ebf84;};}function handleError(_0x137079,_0x134adb){_0x134adb=_0x134adb||0x1f4;return function(_0x35544f){logger[_0xc2d7('0x29')](_0x35544f['stack']);if(_0x35544f[_0xc2d7('0x2a')]){delete _0x35544f[_0xc2d7('0x2a')];}_0x137079[_0xc2d7('0x1b')](_0x134adb)[_0xc2d7('0x2b')](_0x35544f);};}exports[_0xc2d7('0x2c')]=function(_0xf114e,_0x24f0b3){var _0x533945={},_0x45ac0e={},_0x4e4795={'count':0x0,'rows':[]};var _0x400753=_[_0xc2d7('0x2d')](db[_0xc2d7('0x2e')][_0xc2d7('0x2f')],function(_0x29db53){return{'name':_0x29db53[_0xc2d7('0x30')],'type':_0x29db53[_0xc2d7('0x31')][_0xc2d7('0x32')]};});_0x45ac0e[_0xc2d7('0x33')]=_[_0xc2d7('0x34')](_[_0xc2d7('0x2d')](_0x400753,_0xc2d7('0x2a')),[_0xc2d7('0x2a')]);_0x45ac0e['query']=_['keys'](_0xf114e[_0xc2d7('0x35')]);_0x45ac0e[_0xc2d7('0x36')]=_['intersection'](_0x45ac0e[_0xc2d7('0x33')],_0x45ac0e[_0xc2d7('0x35')]);_0x533945[_0xc2d7('0x37')]=_[_0xc2d7('0x38')](_0x45ac0e[_0xc2d7('0x33')],qs[_0xc2d7('0x39')](_0xf114e['query']['fields']));_0x533945[_0xc2d7('0x37')]=_0x533945[_0xc2d7('0x37')][_0xc2d7('0x3a')]?_0x533945[_0xc2d7('0x37')]:_0x45ac0e[_0xc2d7('0x33')];if(!_0xf114e[_0xc2d7('0x35')]['hasOwnProperty']('nolimit')){_0x533945[_0xc2d7('0x20')]=qs[_0xc2d7('0x20')](_0xf114e[_0xc2d7('0x35')][_0xc2d7('0x20')]);_0x533945[_0xc2d7('0x1e')]=qs[_0xc2d7('0x1e')](_0xf114e[_0xc2d7('0x35')]['offset']);}_0x533945['order']=qs[_0xc2d7('0x3b')](_0xf114e['query'][_0xc2d7('0x3b')]);_0x533945[_0xc2d7('0x3c')]=qs['filters'](_[_0xc2d7('0x3d')](_0xf114e[_0xc2d7('0x35')],_0x45ac0e[_0xc2d7('0x36')]),_0x400753);if(_0xf114e[_0xc2d7('0x35')][_0xc2d7('0x3e')]){_0x533945['where']=_[_0xc2d7('0x3f')](_0x533945[_0xc2d7('0x3c')],{'$or':_['map'](_0x400753,function(_0x1f0e1e){if(_0x1f0e1e[_0xc2d7('0x31')]!==_0xc2d7('0x40')){var _0x2eff95={};_0x2eff95[_0x1f0e1e[_0xc2d7('0x2a')]]={'$like':'%'+_0xf114e[_0xc2d7('0x35')][_0xc2d7('0x3e')]+'%'};return _0x2eff95;}})});}_0x533945=_['merge']({},_0x533945,_0xf114e[_0xc2d7('0x41')]);var _0x415ecc={'where':_0x533945[_0xc2d7('0x3c')]};return db[_0xc2d7('0x2e')]['count'](_0x415ecc)[_0xc2d7('0x28')](function(_0x1d228c){_0x4e4795[_0xc2d7('0x21')]=_0x1d228c;if(_0xf114e[_0xc2d7('0x35')][_0xc2d7('0x42')]){_0x533945[_0xc2d7('0x43')]=[{'all':!![]}];}return db['CmCustomField'][_0xc2d7('0x44')](_0x533945);})['then'](function(_0x6e18cb){_0x4e4795['rows']=_0x6e18cb;return _0x4e4795;})[_0xc2d7('0x28')](respondWithFilteredResult(_0x24f0b3,_0x533945))[_0xc2d7('0x45')](handleError(_0x24f0b3,null));};exports[_0xc2d7('0x46')]=function(_0x50a4ef,_0x496bd5){var _0x3fb28b={'raw':!![],'where':{'id':_0x50a4ef[_0xc2d7('0x47')]['id']}},_0x273108={};_0x273108['model']=_['keys'](db[_0xc2d7('0x2e')][_0xc2d7('0x2f')]);_0x273108[_0xc2d7('0x35')]=_[_0xc2d7('0x48')](_0x50a4ef[_0xc2d7('0x35')]);_0x273108[_0xc2d7('0x36')]=_[_0xc2d7('0x38')](_0x273108[_0xc2d7('0x33')],_0x273108['query']);_0x3fb28b[_0xc2d7('0x37')]=_[_0xc2d7('0x38')](_0x273108[_0xc2d7('0x33')],qs[_0xc2d7('0x39')](_0x50a4ef[_0xc2d7('0x35')][_0xc2d7('0x39')]));_0x3fb28b[_0xc2d7('0x37')]=_0x3fb28b[_0xc2d7('0x37')][_0xc2d7('0x3a')]?_0x3fb28b['attributes']:_0x273108[_0xc2d7('0x33')];if(_0x50a4ef[_0xc2d7('0x35')][_0xc2d7('0x42')]){_0x3fb28b['include']=[{'all':!![]}];}_0x3fb28b=_['merge']({},_0x3fb28b,_0x50a4ef[_0xc2d7('0x41')]);return db[_0xc2d7('0x2e')][_0xc2d7('0x49')](_0x3fb28b)[_0xc2d7('0x28')](handleEntityNotFound(_0x496bd5,null))[_0xc2d7('0x28')](respondWithResult(_0x496bd5,null))[_0xc2d7('0x45')](handleError(_0x496bd5,null));};exports[_0xc2d7('0x27')]=function(_0xe260dd,_0x33ca2e){if(_0xe260dd[_0xc2d7('0x4a')]['id']){delete _0xe260dd[_0xc2d7('0x4a')]['id'];}return db[_0xc2d7('0x2e')][_0xc2d7('0x49')]({'where':{'id':_0xe260dd[_0xc2d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x33ca2e,null))[_0xc2d7('0x28')](saveUpdates(_0xe260dd[_0xc2d7('0x4a')],null))['then'](respondWithResult(_0x33ca2e,null))[_0xc2d7('0x45')](handleError(_0x33ca2e,null));};exports[_0xc2d7('0x4b')]=function(_0x47e0e1,_0x102850){return db[_0xc2d7('0x2e')]['find']({'where':{'id':_0x47e0e1[_0xc2d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x102850,null))[_0xc2d7('0x28')](removeEntity(_0x102850,null))[_0xc2d7('0x45')](handleError(_0x102850,null));};exports['create']=function(_0x29b610,_0x571c0f){var _0x562dbc;return db['sequelize'][_0xc2d7('0x4c')](function(_0x1db72c){return db[_0xc2d7('0x2e')][_0xc2d7('0x4d')](_0x29b610[_0xc2d7('0x4a')],{'transaction':_0x1db72c})[_0xc2d7('0x28')](function(_0x1bae88){_0x562dbc=_0x1bae88;var _0x3a59c5={'type':db[_0xc2d7('0x4e')][_0xc2d7('0x4f')],'transaction':_0x1db72c};switch(_0x29b610[_0xc2d7('0x4a')]['type']){case'text':_0x3a59c5[_0xc2d7('0x31')]=db[_0xc2d7('0x4e')][_0xc2d7('0x4f')];break;case _0xc2d7('0x50'):_0x3a59c5[_0xc2d7('0x31')]=db['Sequelize'][_0xc2d7('0x51')];break;case _0xc2d7('0x52'):_0x3a59c5[_0xc2d7('0x31')]=db[_0xc2d7('0x4e')]['BOOLEAN'];_0x3a59c5[_0xc2d7('0x53')]=![];break;default:}return db[_0xc2d7('0x54')][_0xc2d7('0x55')][_0xc2d7('0x56')]('cm_contacts',util[_0xc2d7('0x57')](_0xc2d7('0x58'),_0x562dbc['id']),_0x3a59c5);})[_0xc2d7('0x28')](function(){return _0x562dbc;});})[_0xc2d7('0x28')](respondWithResult(_0x571c0f,0xc9))[_0xc2d7('0x45')](handleError(_0x571c0f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 04cc3e4..3997e2a 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 _0x0ced=['moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api'];(function(_0x14a675,_0xcf4dbb){var _0x9a6cb4=function(_0x1ef8b5){while(--_0x1ef8b5){_0x14a675['push'](_0x14a675['shift']());}};_0x9a6cb4(++_0xcf4dbb);}(_0x0ced,0x7e));var _0xd0ce=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x0ced[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xd0ce('0x0'));var util=require(_0xd0ce('0x1'));var logger=require(_0xd0ce('0x2'))(_0xd0ce('0x3'));var moment=require(_0xd0ce('0x4'));var BPromise=require('bluebird');var rp=require(_0xd0ce('0x5'));var fs=require('fs');var path=require(_0xd0ce('0x6'));var rimraf=require(_0xd0ce('0x7'));var config=require(_0xd0ce('0x8'));var attributes=require(_0xd0ce('0x9'));module[_0xd0ce('0xa')]=function(_0x5bf410,_0x4a7789){return _0x5bf410['define'](_0xd0ce('0xb'),attributes,{'tableName':_0xd0ce('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2579=['bluebird','request-promise','path','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','api'];(function(_0x1e3d38,_0x106d12){var _0x497698=function(_0x393727){while(--_0x393727){_0x1e3d38['push'](_0x1e3d38['shift']());}};_0x497698(++_0x106d12);}(_0x2579,0x173));var _0x9257=function(_0x16ac79,_0x19ca16){_0x16ac79=_0x16ac79-0x0;var _0x2c0f0f=_0x2579[_0x16ac79];return _0x2c0f0f;};'use strict';var _=require(_0x9257('0x0'));var util=require(_0x9257('0x1'));var logger=require('../../config/logger')(_0x9257('0x2'));var moment=require('moment');var BPromise=require(_0x9257('0x3'));var rp=require(_0x9257('0x4'));var fs=require('fs');var path=require(_0x9257('0x5'));var rimraf=require('rimraf');var config=require(_0x9257('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x9257('0x7')]=function(_0xc2e0bf,_0x4d9649){return _0xc2e0bf[_0x9257('0x8')](_0x9257('0x9'),attributes,{'tableName':_0x9257('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index b304748..8e3393a 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 _0xd6ac=['error','CmCustomField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','debug','stringify'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xd6ac,0x92));var _0xcd6a=function(_0x57504a,_0x518579){_0x57504a=_0x57504a-0x0;var _0x47d994=_0xd6ac[_0x57504a];return _0x47d994;};'use strict';var _=require(_0xcd6a('0x0'));var util=require(_0xcd6a('0x1'));var moment=require(_0xcd6a('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd6a('0x3'));var fs=require('fs');var Redis=require(_0xcd6a('0x4'));var db=require(_0xcd6a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd6a('0x6'))(_0xcd6a('0x7'));var config=require('../../config/environment');var jayson=require(_0xcd6a('0x8'));var client=jayson[_0xcd6a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16caa6,_0x50ed14,_0x5e2e86){return new BPromise(function(_0x2fad69,_0x226ff5){return client[_0xcd6a('0xa')](_0x16caa6,_0x5e2e86)[_0xcd6a('0xb')](function(_0x14dd91){logger['info']('CmCustomField,\x20%s,\x20%s',_0x50ed14,'request\x20sent');logger[_0xcd6a('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x50ed14,'request\x20sent',JSON[_0xcd6a('0xd')](_0x14dd91));if(_0x14dd91['error']){if(_0x14dd91[_0xcd6a('0xe')]['code']===0x1f4){logger['error'](_0xcd6a('0xf'),_0x50ed14,_0x14dd91[_0xcd6a('0xe')][_0xcd6a('0x10')]);return _0x226ff5(_0x14dd91[_0xcd6a('0xe')]['message']);}logger['error'](_0xcd6a('0xf'),_0x50ed14,_0x14dd91[_0xcd6a('0xe')][_0xcd6a('0x10')]);return _0x2fad69(_0x14dd91[_0xcd6a('0xe')][_0xcd6a('0x10')]);}else{logger['info'](_0xcd6a('0xf'),_0x50ed14,_0xcd6a('0x11'));_0x2fad69(_0x14dd91[_0xcd6a('0x12')]['message']);}})[_0xcd6a('0x13')](function(_0x399598){logger[_0xcd6a('0xe')](_0xcd6a('0xf'),_0x50ed14,_0x399598);_0x226ff5(_0x399598);});});} \ No newline at end of file +var _0xa6d2=['client','http','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xa6d2,0x11c));var _0x2a6d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa6d2[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2a6d('0x0'));var util=require(_0x2a6d('0x1'));var moment=require(_0x2a6d('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a6d('0x3'));var fs=require('fs');var Redis=require(_0x2a6d('0x4'));var db=require(_0x2a6d('0x5'))['db'];var utils=require(_0x2a6d('0x6'));var logger=require(_0x2a6d('0x7'))('rpc');var config=require(_0x2a6d('0x8'));var jayson=require(_0x2a6d('0x9'));var client=jayson[_0x2a6d('0xa')][_0x2a6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41aa6e,_0x5ea17f,_0x275d15){return new BPromise(function(_0x9adc9b,_0x4837fb){return client['request'](_0x41aa6e,_0x275d15)['then'](function(_0x3a7551){logger['info']('CmCustomField,\x20%s,\x20%s',_0x5ea17f,_0x2a6d('0xc'));logger[_0x2a6d('0xd')](_0x2a6d('0xe'),_0x5ea17f,'request\x20sent',JSON[_0x2a6d('0xf')](_0x3a7551));if(_0x3a7551[_0x2a6d('0x10')]){if(_0x3a7551[_0x2a6d('0x10')]['code']===0x1f4){logger['error'](_0x2a6d('0x11'),_0x5ea17f,_0x3a7551[_0x2a6d('0x10')][_0x2a6d('0x12')]);return _0x4837fb(_0x3a7551[_0x2a6d('0x10')][_0x2a6d('0x12')]);}logger['error'](_0x2a6d('0x11'),_0x5ea17f,_0x3a7551[_0x2a6d('0x10')][_0x2a6d('0x12')]);return _0x9adc9b(_0x3a7551['error'][_0x2a6d('0x12')]);}else{logger[_0x2a6d('0x13')](_0x2a6d('0x11'),_0x5ea17f,'request\x20sent');_0x9adc9b(_0x3a7551[_0x2a6d('0x14')][_0x2a6d('0x12')]);}})['catch'](function(_0x2fee10){logger[_0x2a6d('0x10')]('CmCustomField,\x20%s,\x20%s',_0x5ea17f,_0x2fee10);_0x4837fb(_0x2fee10);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 888adfe..ee37700 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 _0x9ab0=['show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x2af655,_0x43eac3){var _0x54380a=function(_0x2a76fd){while(--_0x2a76fd){_0x2af655['push'](_0x2af655['shift']());}};_0x54380a(++_0x43eac3);}(_0x9ab0,0x195));var _0x09ab=function(_0x497e9d,_0x2f07cd){_0x497e9d=_0x497e9d-0x0;var _0x11e8bd=_0x9ab0[_0x497e9d];return _0x11e8bd;};'use strict';var multer=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var path=require(_0x09ab('0x2'));var timeout=require(_0x09ab('0x3'));var express=require(_0x09ab('0x4'));var router=express[_0x09ab('0x5')]();var fs_extra=require(_0x09ab('0x6'));var auth=require(_0x09ab('0x7'));var interaction=require(_0x09ab('0x8'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x09ab('0x9')](),controller[_0x09ab('0xa')]);router[_0x09ab('0xb')](_0x09ab('0xc'),auth[_0x09ab('0x9')](),controller[_0x09ab('0xd')]);router[_0x09ab('0xe')]('/',auth[_0x09ab('0x9')](),controller[_0x09ab('0xf')]);router['put'](_0x09ab('0xc'),auth['isAuthenticated'](),controller[_0x09ab('0x10')]);router[_0x09ab('0x11')](_0x09ab('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x09ab('0x12')]=router; \ No newline at end of file +var _0x9df5=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller'];(function(_0x581274,_0x370501){var _0x2d720a=function(_0x152afb){while(--_0x152afb){_0x581274['push'](_0x581274['shift']());}};_0x2d720a(++_0x370501);}(_0x9df5,0x9b));var _0x59df=function(_0x4ae7e0,_0x15fee0){_0x4ae7e0=_0x4ae7e0-0x0;var _0x304d8a=_0x9df5[_0x4ae7e0];return _0x304d8a;};'use strict';var multer=require(_0x59df('0x0'));var util=require(_0x59df('0x1'));var path=require(_0x59df('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59df('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x59df('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x59df('0x5'));var controller=require(_0x59df('0x6'));router[_0x59df('0x7')]('/',auth[_0x59df('0x8')](),controller['index']);router[_0x59df('0x7')](_0x59df('0x9'),auth['isAuthenticated'](),controller[_0x59df('0xa')]);router[_0x59df('0xb')]('/',auth[_0x59df('0x8')](),controller[_0x59df('0xc')]);router[_0x59df('0xd')](_0x59df('0x9'),auth[_0x59df('0x8')](),controller[_0x59df('0xe')]);router[_0x59df('0xf')](_0x59df('0x9'),auth['isAuthenticated'](),controller[_0x59df('0x10')]);module[_0x59df('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5193fbf..9d4536d 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 _0xa38e=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa38e,0x83));var _0xea38=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0xa38e[_0x4defd6];return _0x4c9276;};'use strict';var moment=require(_0xea38('0x0'));var Sequelize=require(_0xea38('0x1'));module['exports']={'phone':{'type':Sequelize[_0xea38('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xea38('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xea38('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xea38('0x5')](0x2)[_0xea38('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xea38('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xea38('0x5')],'unique':_0xea38('0x7')},'ListId':{'type':Sequelize[_0xea38('0x5')],'unique':_0xea38('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xea38('0x5')],'unique':_0xea38('0x7')},'CampaignId':{'type':Sequelize[_0xea38('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea38('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xea38('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xea38('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xea38('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa35e=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment'];(function(_0x25bd0c,_0x103172){var _0x16f18e=function(_0x3f9444){while(--_0x3f9444){_0x25bd0c['push'](_0x25bd0c['shift']());}};_0x16f18e(++_0x103172);}(_0xa35e,0xbd));var _0xea35=function(_0x566b67,_0x4b2769){_0x566b67=_0x566b67-0x0;var _0x4da054=_0xa35e[_0x566b67];return _0x4da054;};'use strict';var moment=require(_0xea35('0x0'));var Sequelize=require(_0xea35('0x1'));module[_0xea35('0x2')]={'phone':{'type':Sequelize[_0xea35('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xea35('0x5')],'defaultValue':moment()[_0xea35('0x6')](_0xea35('0x7'))},'countbusyretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xea35('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xea35('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xea35('0x8')],'unique':_0xea35('0x9')},'UserId':{'type':Sequelize[_0xea35('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xea35('0x8')],'unique':_0xea35('0x9')},'CampaignId':{'type':Sequelize[_0xea35('0x8')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xea35('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e2cbbec..22af9ae 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 _0xb458=['update','then','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','filters','concat','$and','$or','$lt','$lte','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','sequelize','dialPreviewAutoRecallMe','value','direction','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','transaction','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','status','offset','undefined','count','Content-Range','json'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xb458,0x103));var _0x8b45=function(_0x2331af,_0xa80e25){_0x2331af=_0x2331af-0x0;var _0x478d81=_0xb458[_0x2331af];return _0x478d81;};'use strict';var moment=require(_0x8b45('0x0'));var _=require(_0x8b45('0x1'));var qs=require(_0x8b45('0x2'));var logger=require('../../config/logger')('api');var shared=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];function respondWithResult(_0x141a44,_0x13a8c6){_0x13a8c6=_0x13a8c6||0xc8;return function(_0x5d51e4){if(_0x5d51e4){return _0x141a44[_0x8b45('0x5')](_0x13a8c6)['json'](_0x5d51e4);}};}function respondWithFilteredResult(_0x5cc2d5,_0xe8d774){return function(_0x12bd05){if(_0x12bd05){var _0x2daa9a=typeof _0xe8d774[_0x8b45('0x6')]===_0x8b45('0x7')&&typeof _0xe8d774['limit']===_0x8b45('0x7');var _0x12bea8=_0x12bd05[_0x8b45('0x8')];var _0x2bc809=_0x2daa9a?0x0:_0xe8d774[_0x8b45('0x6')];var _0x499899=_0x2daa9a?_0x12bd05[_0x8b45('0x8')]:_0xe8d774[_0x8b45('0x6')]+_0xe8d774['limit'];var _0x5316af;if(_0x499899>=_0x12bea8){_0x499899=_0x12bea8;_0x5316af=0xc8;}else{_0x5316af=0xce;}_0x5cc2d5['status'](_0x5316af);return _0x5cc2d5['set'](_0x8b45('0x9'),_0x2bc809+'-'+_0x499899+'/'+_0x12bea8)[_0x8b45('0xa')](_0x12bd05);}return null;};}function saveUpdates(_0x37c220,_0x52c4db){return function(_0x30d38c){if(_0x30d38c){return _0x30d38c[_0x8b45('0xb')](_0x37c220)[_0x8b45('0xc')](function(_0x2e5ec3){return _0x2e5ec3;});}return null;};}function handleEntityNotFound(_0x32babc,_0x2ad2ae){return function(_0x5f0b20){if(!_0x5f0b20){_0x32babc['sendStatus'](0x194);}return _0x5f0b20;};}function handleError(_0x45881c,_0x23f1dd){_0x23f1dd=_0x23f1dd||0x1f4;return function(_0x445170){logger[_0x8b45('0xd')](_0x445170[_0x8b45('0xe')]);if(_0x445170[_0x8b45('0xf')]){delete _0x445170[_0x8b45('0xf')];}_0x45881c[_0x8b45('0x5')](_0x23f1dd)[_0x8b45('0x10')](_0x445170);};}exports[_0x8b45('0x11')]=function(_0x287a3b,_0x21d5b2){var _0x1ed5ca={},_0x43ffb7={},_0x1623d8={'count':0x0,'rows':[]};var _0x31c6b4=_[_0x8b45('0x12')](db[_0x8b45('0x13')]['rawAttributes'],function(_0x25e8a1){return{'name':_0x25e8a1[_0x8b45('0x14')],'type':_0x25e8a1[_0x8b45('0x15')][_0x8b45('0x16')]};});_0x43ffb7[_0x8b45('0x17')]=_[_0x8b45('0x12')](_0x31c6b4,_0x8b45('0xf'));_0x43ffb7[_0x8b45('0x18')]=_['keys'](_0x287a3b['query']);_0x43ffb7[_0x8b45('0x19')]=_['intersection'](_0x43ffb7[_0x8b45('0x17')],_0x43ffb7[_0x8b45('0x18')]);_0x43ffb7[_0x8b45('0x19')]=_[_0x8b45('0x1a')](_0x43ffb7[_0x8b45('0x19')],[_0x8b45('0x1b'),_0x8b45('0x1c'),'$gt','$gte',_0x8b45('0x1d'),_0x8b45('0x1e'),'$ne','$eq',_0x8b45('0x1f'),_0x8b45('0x20'),_0x8b45('0x21'),_0x8b45('0x22'),'$notIn',_0x8b45('0x23'),_0x8b45('0x24'),_0x8b45('0x25'),_0x8b45('0x26'),_0x8b45('0x23'),_0x8b45('0x27'),_0x8b45('0x28'),_0x8b45('0x29'),_0x8b45('0x2a')]);_0x1ed5ca[_0x8b45('0x2b')]=_[_0x8b45('0x2c')](_0x43ffb7[_0x8b45('0x17')],qs[_0x8b45('0x2d')](_0x287a3b['query'][_0x8b45('0x2d')]));_0x1ed5ca[_0x8b45('0x2b')]=_0x1ed5ca[_0x8b45('0x2b')][_0x8b45('0x2e')]?_0x1ed5ca[_0x8b45('0x2b')]:_0x43ffb7[_0x8b45('0x17')];if(!_0x287a3b[_0x8b45('0x18')][_0x8b45('0x2f')]('nolimit')){_0x1ed5ca[_0x8b45('0x30')]=qs[_0x8b45('0x30')](_0x287a3b[_0x8b45('0x18')][_0x8b45('0x30')]);_0x1ed5ca[_0x8b45('0x6')]=qs['offset'](_0x287a3b[_0x8b45('0x18')]['offset']);}_0x1ed5ca['order']=qs[_0x8b45('0x31')](_0x287a3b[_0x8b45('0x18')][_0x8b45('0x31')]);_0x1ed5ca[_0x8b45('0x32')]=qs[_0x8b45('0x19')](_[_0x8b45('0x33')](_0x287a3b['query'],_0x43ffb7[_0x8b45('0x19')]),_0x31c6b4);if(_0x287a3b[_0x8b45('0x18')][_0x8b45('0x34')]){_0x1ed5ca[_0x8b45('0x32')]=_['merge'](_0x1ed5ca[_0x8b45('0x32')],{'$or':_[_0x8b45('0x12')](_0x31c6b4,function(_0x191db0){if(_0x191db0['type']!==_0x8b45('0x35')){var _0x475401={};_0x475401[_0x191db0[_0x8b45('0xf')]]={'$like':'%'+_0x287a3b['query'][_0x8b45('0x34')]+'%'};return _0x475401;}})});}_0x1ed5ca=_[_0x8b45('0x36')]({},_0x1ed5ca,_0x287a3b[_0x8b45('0x37')]);var _0x4016b7={'where':_0x1ed5ca['where']};return db[_0x8b45('0x13')][_0x8b45('0x8')](_0x4016b7)[_0x8b45('0xc')](function(_0x15df7c){_0x1623d8[_0x8b45('0x8')]=_0x15df7c;if(_0x287a3b[_0x8b45('0x18')]['includeAll']){_0x1ed5ca['include']=[{'all':!![]}];}return db[_0x8b45('0x13')][_0x8b45('0x38')](_0x1ed5ca);})[_0x8b45('0xc')](function(_0x12d4b2){_0x1623d8[_0x8b45('0x39')]=_0x12d4b2;return _0x1623d8;})['then'](respondWithFilteredResult(_0x21d5b2,_0x1ed5ca))[_0x8b45('0x3a')](handleError(_0x21d5b2,null));};exports['show']=function(_0x67c59a,_0x17e9a8){var _0x5fae26={'raw':!![],'where':{'id':_0x67c59a[_0x8b45('0x3b')]['id']}},_0x280bb0={};_0x280bb0[_0x8b45('0x17')]=_[_0x8b45('0x3c')](db[_0x8b45('0x13')][_0x8b45('0x3d')]);_0x280bb0[_0x8b45('0x18')]=_[_0x8b45('0x3c')](_0x67c59a['query']);_0x280bb0[_0x8b45('0x19')]=_['intersection'](_0x280bb0[_0x8b45('0x17')],_0x280bb0['query']);_0x5fae26[_0x8b45('0x2b')]=_[_0x8b45('0x2c')](_0x280bb0[_0x8b45('0x17')],qs[_0x8b45('0x2d')](_0x67c59a[_0x8b45('0x18')][_0x8b45('0x2d')]));_0x5fae26['attributes']=_0x5fae26[_0x8b45('0x2b')]['length']?_0x5fae26['attributes']:_0x280bb0[_0x8b45('0x17')];if(_0x67c59a[_0x8b45('0x18')][_0x8b45('0x3e')]){_0x5fae26['include']=[{'all':!![]}];}_0x5fae26=_[_0x8b45('0x36')]({},_0x5fae26,_0x67c59a['options']);return db[_0x8b45('0x13')][_0x8b45('0x3f')](_0x5fae26)[_0x8b45('0xc')](handleEntityNotFound(_0x17e9a8,null))[_0x8b45('0xc')](respondWithResult(_0x17e9a8,null))[_0x8b45('0x3a')](handleError(_0x17e9a8,null));};exports[_0x8b45('0x40')]=function(_0x526c90,_0x3cebd2){return db[_0x8b45('0x13')][_0x8b45('0x40')](_0x526c90[_0x8b45('0x41')],{})[_0x8b45('0xc')](respondWithResult(_0x3cebd2,0xc9))[_0x8b45('0x3a')](handleError(_0x3cebd2,null));};exports[_0x8b45('0xb')]=function(_0x3de3c2,_0x37b94a){if(_0x3de3c2[_0x8b45('0x41')]['id']){delete _0x3de3c2[_0x8b45('0x41')]['id'];}return db[_0x8b45('0x13')][_0x8b45('0x3f')]({'where':{'id':_0x3de3c2[_0x8b45('0x3b')]['id']}})[_0x8b45('0xc')](handleEntityNotFound(_0x37b94a,null))[_0x8b45('0xc')](saveUpdates(_0x3de3c2['body'],null))['then'](respondWithResult(_0x37b94a,null))['catch'](handleError(_0x37b94a,null));};exports[_0x8b45('0x42')]=function(_0x214e28,_0x3a1621){return db[_0x8b45('0x13')][_0x8b45('0x42')]()[_0x8b45('0xc')](respondWithResult(_0x3a1621,null))[_0x8b45('0x3a')](handleError(_0x3a1621,null));};exports[_0x8b45('0x43')]=function(_0x5e2a03,_0x102d01){var _0x5d5be2;var _0x23b5c6=_0x5e2a03[_0x8b45('0x3b')]['id'];return db[_0x8b45('0x13')][_0x8b45('0x3f')]({'where':{'id':_0x5e2a03['params']['id']}})[_0x8b45('0xc')](handleEntityNotFound(_0x102d01,null))[_0x8b45('0xc')](function(_0x5e42e6){if(_0x5e42e6){return _0x5e42e6[_0x8b45('0x43')]()[_0x8b45('0xc')](function(_0x52970c){return _0x52970c;});}})[_0x8b45('0xc')](function(_0x5758c){_0x5d5be2=_0x5758c;if(_0x5758c){if(_0x5758c[_0x8b45('0x44')]||_0x5758c[_0x8b45('0x45')]){return db[_0x5758c[_0x8b45('0x44')]?_0x8b45('0x46'):'Campaign']['find']({'where':{'id':_0x5758c[_0x8b45('0x44')]?_0x5758c[_0x8b45('0x44')]:_0x5758c[_0x8b45('0x45')]},'attributes':['id','name'],'raw':!![]});}}})[_0x8b45('0xc')](function(_0x11d1a5){var _0x20a68b={};if(_0x11d1a5){_[_0x8b45('0x36')](_0x20a68b,_[_0x8b45('0x47')](_0x5d5be2['dataValues'],[_0x8b45('0x48'),_0x8b45('0x49'),'id']));_0x20a68b['state']=0x15;_0x20a68b[_0x8b45('0x4a')]='deleted';_0x20a68b[_0x8b45('0x4b')]=_0x11d1a5[_0x8b45('0xf')];_0x20a68b[_0x8b45('0x4c')]=_0x5e2a03[_0x8b45('0x4d')]['name'];_0x20a68b[_0x8b45('0x4e')]=_0x5e2a03[_0x8b45('0x4d')]['id'];_0x20a68b[_0x8b45('0x4f')]=!![];_0x20a68b[_0x8b45('0x50')]=moment()[_0x8b45('0x51')](_0x8b45('0x52'));_0x20a68b[_0x8b45('0x53')]=_0x5d5be2[_0x8b45('0x54')];_0x20a68b[_0x8b45('0x55')]=_0x5d5be2[_0x8b45('0x44')]?_0x8b45('0x56'):_0x8b45('0x57');return db[_0x8b45('0x58')][_0x8b45('0x3f')]({'where':{'id':_0x20a68b[_0x8b45('0x59')]},'attributes':['firstName',_0x8b45('0x5a')]})[_0x8b45('0xc')](function(_0x15c9ae){if(!_['isNil'](_0x102d01)&&!_[_0x8b45('0x5b')](_0x15c9ae[_0x8b45('0x5c')])){_0x20a68b[_0x8b45('0x5d')]=_0x15c9ae[_0x8b45('0x5c')];if(!_['isNil'](_0x15c9ae[_0x8b45('0x5a')])){_0x20a68b[_0x8b45('0x5d')]+='\x20'+_0x15c9ae[_0x8b45('0x5a')];}}})[_0x8b45('0x5e')](function(){return db['CmHopperFinal'][_0x8b45('0x40')](_0x20a68b);});}})[_0x8b45('0xc')](function(_0x417778){return db[_0x8b45('0x5f')][_0x8b45('0x43')]({'where':{'CmHopperId':_0x23b5c6}});})['then'](function(){return _0x102d01[_0x8b45('0x5')](0xcc)['end']();})[_0x8b45('0x3a')](handleError(_0x102d01,null));};exports[_0x8b45('0x60')]=function(_0x19152b,_0x19c80e){var _0x6a77bd=[];return db[_0x8b45('0x58')]['describe']()['then'](function(_0x5ace1){_0x6a77bd=_[_0x8b45('0x3c')](_0x5ace1);return _0x19152b['user'][_0x8b45('0x61')]({'where':{'type':_0x8b45('0x62'),'dialActive':!![],'dialMethod':_0x8b45('0x63')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8b45('0xc')](function(_0x8e5a41){if(_0x8e5a41&&_0x8e5a41['length']){return db[_0x8b45('0x64')]['transaction'](function(_0xf1ab37){var _0x560c51={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8b45('0x52'))},'VoiceQueueId':{'$in':_[_0x8b45('0x12')](_0x8e5a41,'id')},'$or':[{'UserId':null},{'UserId':_0x19152b['user']['id']}]};var _0x324592={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x8e5a41)[_0x8b45('0x34')]([_0x8b45('0x65'),0x0])[_0x8b45('0x12')]('id')[_0x8b45('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x19152b['user']['id']}]};var _0x37f580={'$or':[_0x560c51,_0x324592]};var _0x3b3d21=[];if(_0x19152b[_0x8b45('0x41')]['direction']&&_0x19152b['body'][_0x8b45('0x67')]==='prev'){if(!_[_0x8b45('0x68')](_0x19152b['body']['hopperIds'])){_0x37f580['id']={'$in':_0x19152b['body'][_0x8b45('0x69')]};}_0x3b3d21=[['priority',_0x8b45('0x6a')],[_0x8b45('0x6b'),_0x8e5a41[0x0]['dialOrderByScheduledAt']===_0x8b45('0x6a')?_0x8b45('0x6c'):'ASC'],db[_0x8b45('0x64')][_0x8b45('0x6d')](_0x8b45('0x6e')),['id',_0x8b45('0x6c')]];}else{if(!_[_0x8b45('0x68')](_0x19152b[_0x8b45('0x41')][_0x8b45('0x69')])){_0x37f580['id']={'$notIn':_0x19152b[_0x8b45('0x41')][_0x8b45('0x69')]};}_0x3b3d21=[[_0x8b45('0x6f'),_0x8b45('0x6c')],[_0x8b45('0x6b'),_0x8e5a41[0x0]['dialOrderByScheduledAt']],db[_0x8b45('0x64')][_0x8b45('0x6d')](_0x8b45('0x70')),['id',_0x8b45('0x6a')]];}return db[_0x8b45('0x13')][_0x8b45('0x71')]({'attributes':['id',_0x8b45('0x72'),_0x8b45('0x54'),_0x8b45('0x73')],'where':_0x37f580,'order':_0x3b3d21,'transaction':_0xf1ab37,'lock':_0xf1ab37[_0x8b45('0x74')][_0x8b45('0x75')],'include':[{'model':db[_0x8b45('0x58')],'as':_0x8b45('0x76'),'attributes':_0x6a77bd,'include':[{'model':db[_0x8b45('0x77')],'as':_0x8b45('0x78'),'attributes':['id','name']}]},{'model':db[_0x8b45('0x79')],'as':_0x8b45('0x7a'),'attributes':['id',_0x8b45('0xf')]},{'model':db[_0x8b45('0x46')],'as':_0x8b45('0x7b'),'attributes':['id',_0x8b45('0xf'),_0x8b45('0x7c')]}]})[_0x8b45('0xc')](function(_0x47d8f7){if(_0x47d8f7){return _0x47d8f7[_0x8b45('0xb')]({'UserId':_0x19152b[_0x8b45('0x4d')]['id']},{'transaction':_0xf1ab37});}});});}})[_0x8b45('0xc')](handleEntityNotFound(_0x19c80e,null))[_0x8b45('0xc')](respondWithResult(_0x19c80e,null))[_0x8b45('0x3a')](handleError(_0x19c80e,null));};exports[_0x8b45('0x7d')]=function(_0xd5a325,_0x9b123d,_0x2a6fee){var _0xd19d7c=[];var _0x2d0045=_0xd5a325['params']['id'];var _0x4b5cd7=_0xd5a325[_0x8b45('0x4d')]['id'];return db[_0x8b45('0x58')][_0x8b45('0x42')]()[_0x8b45('0xc')](function(_0x6a235a){_0xd19d7c=_[_0x8b45('0x3c')](_0x6a235a);return db[_0x8b45('0x64')][_0x8b45('0x7e')](function(_0x63ab53){const _0x4b3fb3={'id':_0x2d0045};return db['CmHopper'][_0x8b45('0x71')]({'attributes':['id',_0x8b45('0x72'),_0x8b45('0x73')],'where':_0x4b3fb3,'transaction':_0x63ab53,'lock':_0x63ab53[_0x8b45('0x74')]['UPDATE'],'include':[{'model':db[_0x8b45('0x58')],'as':_0x8b45('0x76'),'attributes':_0xd19d7c,'include':[{'model':db[_0x8b45('0x77')],'as':_0x8b45('0x78'),'attributes':['id',_0x8b45('0xf')]}]},{'model':db[_0x8b45('0x79')],'as':'List','attributes':['id','name']},{'model':db[_0x8b45('0x46')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x8b45('0xc')](function(_0x170b95){if(_0x170b95){return _0x170b95[_0x8b45('0xb')]({'UserId':_0x4b5cd7},{'transaction':_0x63ab53});}});});})[_0x8b45('0xc')](handleEntityNotFound(_0x9b123d,null))[_0x8b45('0xc')](respondWithResult(_0x9b123d,null))[_0x8b45('0x3a')](handleError(_0x9b123d,null));};exports[_0x8b45('0x7f')]=function(_0xc9be77,_0xc89fc6){return _0xc9be77[_0x8b45('0x4d')][_0x8b45('0x61')]({'where':{'type':_0x8b45('0x62'),'dialActive':!![],'dialMethod':_0x8b45('0x63')},'attributes':['id'],'raw':!![]})[_0x8b45('0xc')](function(_0x42b192){if(_0x42b192&&_0x42b192['length']){return db[_0x8b45('0x13')][_0x8b45('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b45('0x51')](_0x8b45('0x52'))},'VoiceQueueId':{'$in':_[_0x8b45('0x12')](_0x42b192,'id')},'$or':[{'UserId':null},{'UserId':_0xc9be77[_0x8b45('0x4d')]['id']}]}});}return 0x0;})[_0x8b45('0xc')](function(_0x251584){if(!_[_0x8b45('0x5b')](_0x251584)&&_[_0x8b45('0x80')](_0x251584)){return _0xc89fc6['status'](0xc8)[_0x8b45('0xa')]({'contacts':_0x251584});}else{logger[_0x8b45('0xd')](_0x8b45('0x81'),_0x8b45('0x7f'),0x194,'entity\x20not\x20found');_0xc89fc6[_0x8b45('0x82')](0x194);}})['catch'](handleError(_0xc89fc6,null));};exports[_0x8b45('0x83')]=function(_0x55acc4,_0x2d3b89){var _0x6966ea=shared[_0x8b45('0x84')];var _0x3e4437=[];_[_0x8b45('0x12')](_0x6966ea,function(_0x45beb9){_0x3e4437['push']({'id':_0x45beb9[_0x8b45('0xf')],'name':_0x45beb9[_0x8b45('0xf')],'utcOffset':_0x45beb9[_0x8b45('0x85')]});});return _0x2d3b89[_0x8b45('0x5')](0xc8)['json']({'tz':_0x3e4437});};exports[_0x8b45('0x86')]=function(_0x3bdd64,_0x4adb06){var _0x5c3dbd=shared[_0x8b45('0x84')];var _0x24a570={};if(!_[_0x8b45('0x5b')](_0x5c3dbd[_0x3bdd64['body']['id']]))_0x24a570=_0x5c3dbd[_0x3bdd64[_0x8b45('0x41')]['id']];return _0x4adb06['status'](0xc8)[_0x8b45('0xa')](_0x24a570);}; \ No newline at end of file +var _0x80d9=['$iLike','$notILike','$contains','$contained','$any','attributes','model','fields','length','hasOwnProperty','where','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','state','statedesc','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','CmContact','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','filter','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','List','VoiceQueue','Queue','dialActive','getPreviewRecall','scheduledat','Company','CmList','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','json','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','offset','undefined','limit','count','Content-Range','update','then','sendStatus','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','keys','query','filters','intersection','$and','$gt','$ne','$eq','$not','$between','$notIn','$like','$notLike'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x80d9,0x15c));var _0x980d=function(_0x53b869,_0xc8f8a4){_0x53b869=_0x53b869-0x0;var _0x104414=_0x80d9[_0x53b869];return _0x104414;};'use strict';var moment=require(_0x980d('0x0'));var _=require('lodash');var qs=require(_0x980d('0x1'));var logger=require(_0x980d('0x2'))(_0x980d('0x3'));var shared=require('../../config/environment');var db=require(_0x980d('0x4'))['db'];function respondWithResult(_0x3a9d1e,_0x38d1b9){_0x38d1b9=_0x38d1b9||0xc8;return function(_0x279d93){if(_0x279d93){return _0x3a9d1e[_0x980d('0x5')](_0x38d1b9)['json'](_0x279d93);}};}function respondWithFilteredResult(_0x4c3533,_0x2fd4b9){return function(_0x50854e){if(_0x50854e){var _0x5d9eb0=typeof _0x2fd4b9[_0x980d('0x6')]===_0x980d('0x7')&&typeof _0x2fd4b9[_0x980d('0x8')]===_0x980d('0x7');var _0x3b1043=_0x50854e[_0x980d('0x9')];var _0x1c4589=_0x5d9eb0?0x0:_0x2fd4b9['offset'];var _0x55b479=_0x5d9eb0?_0x50854e['count']:_0x2fd4b9[_0x980d('0x6')]+_0x2fd4b9[_0x980d('0x8')];var _0x4a9536;if(_0x55b479>=_0x3b1043){_0x55b479=_0x3b1043;_0x4a9536=0xc8;}else{_0x4a9536=0xce;}_0x4c3533[_0x980d('0x5')](_0x4a9536);return _0x4c3533['set'](_0x980d('0xa'),_0x1c4589+'-'+_0x55b479+'/'+_0x3b1043)['json'](_0x50854e);}return null;};}function saveUpdates(_0xc0168a,_0x19cb9b){return function(_0x171a61){if(_0x171a61){return _0x171a61[_0x980d('0xb')](_0xc0168a)[_0x980d('0xc')](function(_0x18469c){return _0x18469c;});}return null;};}function handleEntityNotFound(_0x109ddf,_0x3a317b){return function(_0x5f524e){if(!_0x5f524e){_0x109ddf[_0x980d('0xd')](0x194);}return _0x5f524e;};}function handleError(_0x138882,_0x3fc5f7){_0x3fc5f7=_0x3fc5f7||0x1f4;return function(_0x3846bd){logger[_0x980d('0xe')](_0x3846bd[_0x980d('0xf')]);if(_0x3846bd['name']){delete _0x3846bd[_0x980d('0x10')];}_0x138882[_0x980d('0x5')](_0x3fc5f7)['send'](_0x3846bd);};}exports[_0x980d('0x11')]=function(_0x4e9d73,_0x23f64c){var _0x1bc7e4={},_0x39192b={},_0x3c06c5={'count':0x0,'rows':[]};var _0x2a9ce4=_[_0x980d('0x12')](db[_0x980d('0x13')][_0x980d('0x14')],function(_0xa59cc9){return{'name':_0xa59cc9[_0x980d('0x15')],'type':_0xa59cc9[_0x980d('0x16')]['key']};});_0x39192b['model']=_[_0x980d('0x12')](_0x2a9ce4,'name');_0x39192b['query']=_[_0x980d('0x17')](_0x4e9d73[_0x980d('0x18')]);_0x39192b[_0x980d('0x19')]=_[_0x980d('0x1a')](_0x39192b['model'],_0x39192b['query']);_0x39192b[_0x980d('0x19')]=_['concat'](_0x39192b[_0x980d('0x19')],[_0x980d('0x1b'),'$or',_0x980d('0x1c'),'$gte','$lt','$lte',_0x980d('0x1d'),_0x980d('0x1e'),_0x980d('0x1f'),_0x980d('0x20'),'$notBetween','$in',_0x980d('0x21'),_0x980d('0x22'),_0x980d('0x23'),_0x980d('0x24'),_0x980d('0x25'),'$like','$overlap',_0x980d('0x26'),_0x980d('0x27'),_0x980d('0x28')]);_0x1bc7e4[_0x980d('0x29')]=_[_0x980d('0x1a')](_0x39192b[_0x980d('0x2a')],qs['fields'](_0x4e9d73[_0x980d('0x18')][_0x980d('0x2b')]));_0x1bc7e4[_0x980d('0x29')]=_0x1bc7e4[_0x980d('0x29')][_0x980d('0x2c')]?_0x1bc7e4[_0x980d('0x29')]:_0x39192b[_0x980d('0x2a')];if(!_0x4e9d73[_0x980d('0x18')][_0x980d('0x2d')]('nolimit')){_0x1bc7e4[_0x980d('0x8')]=qs[_0x980d('0x8')](_0x4e9d73[_0x980d('0x18')]['limit']);_0x1bc7e4['offset']=qs[_0x980d('0x6')](_0x4e9d73['query'][_0x980d('0x6')]);}_0x1bc7e4['order']=qs['sort'](_0x4e9d73['query']['sort']);_0x1bc7e4['where']=qs['filters'](_['pick'](_0x4e9d73[_0x980d('0x18')],_0x39192b[_0x980d('0x19')]),_0x2a9ce4);if(_0x4e9d73[_0x980d('0x18')]['filter']){_0x1bc7e4[_0x980d('0x2e')]=_[_0x980d('0x2f')](_0x1bc7e4[_0x980d('0x2e')],{'$or':_[_0x980d('0x12')](_0x2a9ce4,function(_0x120bf1){if(_0x120bf1[_0x980d('0x16')]!==_0x980d('0x30')){var _0x56b08e={};_0x56b08e[_0x120bf1[_0x980d('0x10')]]={'$like':'%'+_0x4e9d73[_0x980d('0x18')]['filter']+'%'};return _0x56b08e;}})});}_0x1bc7e4=_[_0x980d('0x2f')]({},_0x1bc7e4,_0x4e9d73['options']);var _0x293f7d={'where':_0x1bc7e4[_0x980d('0x2e')]};return db[_0x980d('0x13')]['count'](_0x293f7d)['then'](function(_0x5d5903){_0x3c06c5[_0x980d('0x9')]=_0x5d5903;if(_0x4e9d73['query']['includeAll']){_0x1bc7e4[_0x980d('0x31')]=[{'all':!![]}];}return db[_0x980d('0x13')][_0x980d('0x32')](_0x1bc7e4);})['then'](function(_0x41174b){_0x3c06c5[_0x980d('0x33')]=_0x41174b;return _0x3c06c5;})[_0x980d('0xc')](respondWithFilteredResult(_0x23f64c,_0x1bc7e4))[_0x980d('0x34')](handleError(_0x23f64c,null));};exports[_0x980d('0x35')]=function(_0x4e2aac,_0x5a8515){var _0x18f844={'raw':!![],'where':{'id':_0x4e2aac['params']['id']}},_0x5d356d={};_0x5d356d['model']=_['keys'](db[_0x980d('0x13')][_0x980d('0x14')]);_0x5d356d[_0x980d('0x18')]=_['keys'](_0x4e2aac[_0x980d('0x18')]);_0x5d356d[_0x980d('0x19')]=_[_0x980d('0x1a')](_0x5d356d[_0x980d('0x2a')],_0x5d356d[_0x980d('0x18')]);_0x18f844[_0x980d('0x29')]=_[_0x980d('0x1a')](_0x5d356d['model'],qs[_0x980d('0x2b')](_0x4e2aac[_0x980d('0x18')][_0x980d('0x2b')]));_0x18f844['attributes']=_0x18f844[_0x980d('0x29')][_0x980d('0x2c')]?_0x18f844[_0x980d('0x29')]:_0x5d356d[_0x980d('0x2a')];if(_0x4e2aac[_0x980d('0x18')][_0x980d('0x36')]){_0x18f844[_0x980d('0x31')]=[{'all':!![]}];}_0x18f844=_['merge']({},_0x18f844,_0x4e2aac[_0x980d('0x37')]);return db['CmHopper'][_0x980d('0x38')](_0x18f844)[_0x980d('0xc')](handleEntityNotFound(_0x5a8515,null))[_0x980d('0xc')](respondWithResult(_0x5a8515,null))[_0x980d('0x34')](handleError(_0x5a8515,null));};exports[_0x980d('0x39')]=function(_0x20479d,_0x31581d){return db[_0x980d('0x13')]['create'](_0x20479d['body'],{})[_0x980d('0xc')](respondWithResult(_0x31581d,0xc9))[_0x980d('0x34')](handleError(_0x31581d,null));};exports[_0x980d('0xb')]=function(_0x3ee5e1,_0x1d724a){if(_0x3ee5e1['body']['id']){delete _0x3ee5e1[_0x980d('0x3a')]['id'];}return db[_0x980d('0x13')]['find']({'where':{'id':_0x3ee5e1[_0x980d('0x3b')]['id']}})[_0x980d('0xc')](handleEntityNotFound(_0x1d724a,null))[_0x980d('0xc')](saveUpdates(_0x3ee5e1[_0x980d('0x3a')],null))[_0x980d('0xc')](respondWithResult(_0x1d724a,null))[_0x980d('0x34')](handleError(_0x1d724a,null));};exports[_0x980d('0x3c')]=function(_0x135c26,_0x7515ac){return db['CmHopper'][_0x980d('0x3c')]()[_0x980d('0xc')](respondWithResult(_0x7515ac,null))[_0x980d('0x34')](handleError(_0x7515ac,null));};exports[_0x980d('0x3d')]=function(_0x2e18c6,_0x7d0acf){var _0x2e6cdf;var _0x4f0a6e=_0x2e18c6[_0x980d('0x3b')]['id'];return db['CmHopper'][_0x980d('0x38')]({'where':{'id':_0x2e18c6[_0x980d('0x3b')]['id']}})[_0x980d('0xc')](handleEntityNotFound(_0x7d0acf,null))[_0x980d('0xc')](function(_0xb1d509){if(_0xb1d509){return _0xb1d509['destroy']()[_0x980d('0xc')](function(_0x448b3c){return _0x448b3c;});}})[_0x980d('0xc')](function(_0x12c1ea){_0x2e6cdf=_0x12c1ea;if(_0x12c1ea){if(_0x12c1ea[_0x980d('0x3e')]||_0x12c1ea[_0x980d('0x3f')]){return db[_0x12c1ea[_0x980d('0x3e')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x12c1ea['VoiceQueueId']?_0x12c1ea[_0x980d('0x3e')]:_0x12c1ea[_0x980d('0x3f')]},'attributes':['id',_0x980d('0x10')],'raw':!![]});}}})[_0x980d('0xc')](function(_0x177bb2){var _0x316f6c={};if(_0x177bb2){_['merge'](_0x316f6c,_[_0x980d('0x40')](_0x2e6cdf['dataValues'],[_0x980d('0x41'),_0x980d('0x42'),'id']));_0x316f6c[_0x980d('0x43')]=0x15;_0x316f6c[_0x980d('0x44')]='deleted';_0x316f6c['campaign']=_0x177bb2[_0x980d('0x10')];_0x316f6c[_0x980d('0x45')]=_0x2e18c6[_0x980d('0x46')]['name'];_0x316f6c['UserId']=_0x2e18c6[_0x980d('0x46')]['id'];_0x316f6c['deleted']=!![];_0x316f6c[_0x980d('0x47')]=moment()[_0x980d('0x48')](_0x980d('0x49'));_0x316f6c[_0x980d('0x4a')]=_0x2e6cdf[_0x980d('0x4b')];_0x316f6c[_0x980d('0x4c')]=_0x2e6cdf[_0x980d('0x3e')]?_0x980d('0x4d'):'ivr';return db['CmContact'][_0x980d('0x38')]({'where':{'id':_0x316f6c['ContactId']},'attributes':[_0x980d('0x4e'),_0x980d('0x4f')]})['then'](function(_0x2b28e4){if(!_[_0x980d('0x50')](_0x7d0acf)&&!_[_0x980d('0x50')](_0x2b28e4[_0x980d('0x4e')])){_0x316f6c['calleridname']=_0x2b28e4[_0x980d('0x4e')];if(!_['isNil'](_0x2b28e4['lastName'])){_0x316f6c[_0x980d('0x51')]+='\x20'+_0x2b28e4['lastName'];}}})[_0x980d('0x52')](function(){return db['CmHopperFinal'][_0x980d('0x39')](_0x316f6c);});}})[_0x980d('0xc')](function(_0x5a74e5){return db[_0x980d('0x53')][_0x980d('0x3d')]({'where':{'CmHopperId':_0x4f0a6e}});})[_0x980d('0xc')](function(){return _0x7d0acf[_0x980d('0x5')](0xcc)[_0x980d('0x54')]();})[_0x980d('0x34')](handleError(_0x7d0acf,null));};exports[_0x980d('0x55')]=function(_0x3b5008,_0x3190b4){var _0x6df3f7=[];return db[_0x980d('0x56')][_0x980d('0x3c')]()['then'](function(_0x5416f1){_0x6df3f7=_['keys'](_0x5416f1);return _0x3b5008[_0x980d('0x46')]['getVoiceQueues']({'where':{'type':_0x980d('0x57'),'dialActive':!![],'dialMethod':_0x980d('0x58')},'attributes':['id',_0x980d('0x59'),_0x980d('0x5a')],'raw':!![]});})['then'](function(_0x395a95){if(_0x395a95&&_0x395a95[_0x980d('0x2c')]){return db['sequelize'][_0x980d('0x5b')](function(_0x5aebee){var _0x39dd5b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x980d('0x12')](_0x395a95,'id')},'$or':[{'UserId':null},{'UserId':_0x3b5008[_0x980d('0x46')]['id']}]};var _0x3e6234={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x395a95)[_0x980d('0x5c')](['dialPreviewAutoRecallMe',0x0])[_0x980d('0x12')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3b5008['user']['id']}]};var _0x3fa7be={'$or':[_0x39dd5b,_0x3e6234]};var _0x360944=[];if(_0x3b5008[_0x980d('0x3a')][_0x980d('0x5d')]&&_0x3b5008[_0x980d('0x3a')][_0x980d('0x5d')]===_0x980d('0x5e')){if(!_[_0x980d('0x5f')](_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')])){_0x3fa7be['id']={'$in':_0x3b5008['body'][_0x980d('0x60')]};}_0x360944=[['priority',_0x980d('0x61')],[_0x980d('0x62'),_0x395a95[0x0]['dialOrderByScheduledAt']===_0x980d('0x61')?_0x980d('0x63'):_0x980d('0x61')],db[_0x980d('0x64')]['literal'](_0x980d('0x65')),['id',_0x980d('0x63')]];}else{if(!_[_0x980d('0x5f')](_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')])){_0x3fa7be['id']={'$notIn':_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')]};}_0x360944=[[_0x980d('0x66'),_0x980d('0x63')],[_0x980d('0x62'),_0x395a95[0x0]['dialOrderByScheduledAt']],db[_0x980d('0x64')][_0x980d('0x67')](_0x980d('0x68')),['id',_0x980d('0x61')]];}return db[_0x980d('0x13')][_0x980d('0x69')]({'attributes':['id','scheduledat','phone',_0x980d('0x6a')],'where':_0x3fa7be,'order':_0x360944,'transaction':_0x5aebee,'lock':_0x5aebee[_0x980d('0x6b')][_0x980d('0x6c')],'include':[{'model':db[_0x980d('0x56')],'as':_0x980d('0x6d'),'attributes':_0x6df3f7,'include':[{'model':db[_0x980d('0x6e')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x980d('0x6f'),'attributes':['id','name']},{'model':db[_0x980d('0x70')],'as':_0x980d('0x71'),'attributes':['id',_0x980d('0x10'),_0x980d('0x72')]}]})['then'](function(_0x4996f3){if(_0x4996f3){return _0x4996f3[_0x980d('0xb')]({'UserId':_0x3b5008['user']['id']},{'transaction':_0x5aebee});}});});}})[_0x980d('0xc')](handleEntityNotFound(_0x3190b4,null))[_0x980d('0xc')](respondWithResult(_0x3190b4,null))[_0x980d('0x34')](handleError(_0x3190b4,null));};exports[_0x980d('0x73')]=function(_0x579623,_0x32540e,_0x569c2d){var _0x2e2fe1=[];var _0x30e444=_0x579623[_0x980d('0x3b')]['id'];var _0xd56320=_0x579623['user']['id'];return db[_0x980d('0x56')][_0x980d('0x3c')]()[_0x980d('0xc')](function(_0xe2df60){_0x2e2fe1=_[_0x980d('0x17')](_0xe2df60);return db[_0x980d('0x64')]['transaction'](function(_0x313f04){const _0x40bc31={'id':_0x30e444};return db['CmHopper'][_0x980d('0x69')]({'attributes':['id',_0x980d('0x74'),'recallme'],'where':_0x40bc31,'transaction':_0x313f04,'lock':_0x313f04['LOCK']['UPDATE'],'include':[{'model':db[_0x980d('0x56')],'as':_0x980d('0x6d'),'attributes':_0x2e2fe1,'include':[{'model':db[_0x980d('0x6e')],'as':_0x980d('0x75'),'attributes':['id',_0x980d('0x10')]}]},{'model':db[_0x980d('0x76')],'as':_0x980d('0x6f'),'attributes':['id',_0x980d('0x10')]},{'model':db[_0x980d('0x70')],'as':_0x980d('0x71'),'attributes':['id','name',_0x980d('0x72')]}]})[_0x980d('0xc')](function(_0x1543a8){if(_0x1543a8){return _0x1543a8[_0x980d('0xb')]({'UserId':_0xd56320},{'transaction':_0x313f04});}});});})[_0x980d('0xc')](handleEntityNotFound(_0x32540e,null))[_0x980d('0xc')](respondWithResult(_0x32540e,null))['catch'](handleError(_0x32540e,null));};exports['getOpenContacts']=function(_0x358fc8,_0x232828){return _0x358fc8['user'][_0x980d('0x77')]({'where':{'type':_0x980d('0x57'),'dialActive':!![],'dialMethod':_0x980d('0x58')},'attributes':['id'],'raw':!![]})[_0x980d('0xc')](function(_0x9691){if(_0x9691&&_0x9691[_0x980d('0x2c')]){return db['CmHopper'][_0x980d('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x980d('0x48')](_0x980d('0x49'))},'VoiceQueueId':{'$in':_[_0x980d('0x12')](_0x9691,'id')},'$or':[{'UserId':null},{'UserId':_0x358fc8['user']['id']}]}});}return 0x0;})[_0x980d('0xc')](function(_0x495d56){if(!_['isNil'](_0x495d56)&&_['isNumber'](_0x495d56)){return _0x232828[_0x980d('0x5')](0xc8)['json']({'contacts':_0x495d56});}else{logger[_0x980d('0xe')](_0x980d('0x78'),_0x980d('0x79'),0x194,_0x980d('0x7a'));_0x232828[_0x980d('0xd')](0x194);}})[_0x980d('0x34')](handleError(_0x232828,null));};exports['getTimezones']=function(_0x1cce28,_0x6b83e9){var _0x5ea5e4=shared[_0x980d('0x7b')];var _0x573c58=[];_['map'](_0x5ea5e4,function(_0x336709){_0x573c58[_0x980d('0x7c')]({'id':_0x336709[_0x980d('0x10')],'name':_0x336709[_0x980d('0x10')],'utcOffset':_0x336709[_0x980d('0x7d')]});});return _0x6b83e9[_0x980d('0x5')](0xc8)[_0x980d('0x7e')]({'tz':_0x573c58});};exports[_0x980d('0x7f')]=function(_0x15c87b,_0x3517bd){var _0x28dbea=shared[_0x980d('0x7b')];var _0x1e14c5={};if(!_[_0x980d('0x50')](_0x28dbea[_0x15c87b['body']['id']]))_0x1e14c5=_0x28dbea[_0x15c87b[_0x980d('0x3a')]['id']];return _0x3517bd['status'](0xc8)['json'](_0x1e14c5);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index cc789f1..2d68ead 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 _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0xe7f261,_0x549392){var _0x2eda0a=function(_0x389fc0){while(--_0x389fc0){_0xe7f261['push'](_0xe7f261['shift']());}};_0x2eda0a(++_0x549392);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x86d3('0x9')]},{'name':_0x86d3('0xa'),'fields':[_0x86d3('0xa')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x989031,_0x49924b){var _0x47ca12=function(_0x279d0e){while(--_0x279d0e){_0x989031['push'](_0x989031['shift']());}};_0x47ca12(++_0x49924b);}(_0x7c09,0x102));var _0x97c0=function(_0x192147,_0x3fc103){_0x192147=_0x192147-0x0;var _0x425b4d=_0x7c09[_0x192147];return _0x425b4d;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index a09f40a..734f054 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 _0xfde6=['CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','\x20MINUTE','NOW()','name','List','util','moment','../../mysqldb','rpc','GetCmHopper','CmHopper','options','attributes','limit','include','model','map','then','debug','error','message','where','info','stringify','catch','ShowCmHopper','CreateCmHopper','create','update','raw','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','findAll','order','LOCK','UPDATE','keys','User','Agent','voicePause','length','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0xfde6,0xaf));var _0x6fde=function(_0x2237bb,_0x46a955){_0x2237bb=_0x2237bb-0x0;var _0xdb379b=_0xfde6[_0x2237bb];return _0xdb379b;};'use strict';var _=require('lodash');var util=require(_0x6fde('0x0'));var moment=require(_0x6fde('0x1'));var BPromise=require('bluebird');var db=require(_0x6fde('0x2'))['db'];var logger=require('../../config/logger')(_0x6fde('0x3'));exports[_0x6fde('0x4')]=function(_0x4aeb66){var _0x2eebf9=this;return new Promise(function(_0x43e3b6,_0xd3f939){return db[_0x6fde('0x5')]['findAll']({'raw':_0x4aeb66['options']?_0x4aeb66[_0x6fde('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x4aeb66[_0x6fde('0x6')]?_0x4aeb66[_0x6fde('0x6')]['where']||null:null,'attributes':_0x4aeb66[_0x6fde('0x6')]?_0x4aeb66[_0x6fde('0x6')][_0x6fde('0x7')]||null:null,'limit':_0x4aeb66[_0x6fde('0x6')]?_0x4aeb66[_0x6fde('0x6')][_0x6fde('0x8')]||null:null,'include':_0x4aeb66[_0x6fde('0x6')]?_0x4aeb66[_0x6fde('0x6')][_0x6fde('0x9')]?_['map'](_0x4aeb66[_0x6fde('0x6')][_0x6fde('0x9')],function(_0x5ba24c){return{'model':db[_0x5ba24c[_0x6fde('0xa')]],'as':_0x5ba24c['as'],'attributes':_0x5ba24c[_0x6fde('0x7')],'include':_0x5ba24c['include']?_[_0x6fde('0xb')](_0x5ba24c[_0x6fde('0x9')],function(_0x29812c){return{'model':db[_0x29812c[_0x6fde('0xa')]],'as':_0x29812c['as'],'attributes':_0x29812c[_0x6fde('0x7')],'include':_0x29812c['include']?_[_0x6fde('0xb')](_0x29812c[_0x6fde('0x9')],function(_0x233680){return{'model':db[_0x233680['model']],'as':_0x233680['as'],'attributes':_0x233680[_0x6fde('0x7')]};}):[]};}):[]};}):[]:[]})[_0x6fde('0xc')](function(_0x1740c7){logger['info'](_0x6fde('0x4'),_0x4aeb66);logger[_0x6fde('0xd')](_0x6fde('0x4'),_0x4aeb66,JSON['stringify'](_0x1740c7));_0x43e3b6(_0x1740c7);})['catch'](function(_0x1f8da0){logger[_0x6fde('0xe')](_0x6fde('0x4'),_0x1f8da0[_0x6fde('0xf')],_0x4aeb66);_0xd3f939(_0x2eebf9[_0x6fde('0xe')](0x1f4,_0x1f8da0['message']));});});};exports['ShowCmHopper']=function(_0x5a9b90){var _0x5a0877=this;return new Promise(function(_0x382d22,_0x4a8a0d){return db['CmHopper']['find']({'raw':_0x5a9b90['options']?_0x5a9b90[_0x6fde('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x5a9b90[_0x6fde('0x6')]?_0x5a9b90[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'attributes':_0x5a9b90['options']?_0x5a9b90['options'][_0x6fde('0x7')]||null:null,'include':_0x5a9b90[_0x6fde('0x6')]?_0x5a9b90[_0x6fde('0x6')][_0x6fde('0x9')]?_[_0x6fde('0xb')](_0x5a9b90[_0x6fde('0x6')]['include'],function(_0x139fca){return{'model':db[_0x139fca[_0x6fde('0xa')]],'as':_0x139fca['as'],'attributes':_0x139fca[_0x6fde('0x7')],'include':_0x139fca[_0x6fde('0x9')]?_[_0x6fde('0xb')](_0x139fca[_0x6fde('0x9')],function(_0x8c2f8f){return{'model':db[_0x8c2f8f[_0x6fde('0xa')]],'as':_0x8c2f8f['as'],'attributes':_0x8c2f8f['attributes'],'include':_0x8c2f8f['include']?_[_0x6fde('0xb')](_0x8c2f8f[_0x6fde('0x9')],function(_0x282159){return{'model':db[_0x282159[_0x6fde('0xa')]],'as':_0x282159['as'],'attributes':_0x282159[_0x6fde('0x7')]};}):[]};}):[]};}):[]:[]})[_0x6fde('0xc')](function(_0x96491e){logger[_0x6fde('0x11')]('ShowCmHopper',_0x5a9b90);logger[_0x6fde('0xd')]('ShowCmHopper',_0x5a9b90,JSON[_0x6fde('0x12')](_0x96491e));_0x382d22(_0x96491e);})[_0x6fde('0x13')](function(_0x232524){logger['error'](_0x6fde('0x14'),_0x232524[_0x6fde('0xf')],_0x5a9b90);_0x4a8a0d(_0x5a0877['error'](0x1f4,_0x232524[_0x6fde('0xf')]));});});};exports[_0x6fde('0x15')]=function(_0x51981a){var _0x56361f=this;return new Promise(function(_0x5a6c86,_0x27da2c){return db[_0x6fde('0x5')][_0x6fde('0x16')](_0x51981a['body'],{'raw':_0x51981a['options']?_0x51981a['options']['raw']===undefined?!![]:![]:!![]})[_0x6fde('0xc')](function(_0x4ceaba){logger[_0x6fde('0x11')](_0x6fde('0x15'),_0x51981a);logger['debug'](_0x6fde('0x15'),_0x51981a,JSON[_0x6fde('0x12')](_0x4ceaba));_0x5a6c86(_0x4ceaba);})[_0x6fde('0x13')](function(_0x1accbe){logger['error'](_0x6fde('0x15'),_0x1accbe[_0x6fde('0xf')],_0x51981a);_0x27da2c(_0x56361f[_0x6fde('0xe')](0x1f4,_0x1accbe[_0x6fde('0xf')]));});});};exports['UpdateCmHopper']=function(_0x599365){var _0x10cae9=this;return new Promise(function(_0x4c4cbf,_0x1cc864){return db[_0x6fde('0x5')][_0x6fde('0x17')](_0x599365['body'],{'raw':_0x599365[_0x6fde('0x6')]?_0x599365[_0x6fde('0x6')][_0x6fde('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599365[_0x6fde('0x6')]?_0x599365['options'][_0x6fde('0x10')]||null:null,'attributes':_0x599365[_0x6fde('0x6')]?_0x599365['options'][_0x6fde('0x7')]||null:null,'limit':_0x599365[_0x6fde('0x6')]?_0x599365[_0x6fde('0x6')][_0x6fde('0x8')]||null:null})[_0x6fde('0xc')](function(_0x4d5858){logger[_0x6fde('0x11')]('UpdateCmHopper',_0x599365);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x6fde('0x12')](_0x599365[_0x6fde('0x6')][_0x6fde('0x10')]),_0x599365[_0x6fde('0x19')]['active']);logger[_0x6fde('0xd')](_0x6fde('0x1a'),_0x599365,JSON[_0x6fde('0x12')](_0x4d5858));_0x4c4cbf(_0x4d5858);})[_0x6fde('0x13')](function(_0x7fde77){logger[_0x6fde('0xe')](_0x6fde('0x1a'),_0x7fde77[_0x6fde('0xf')],_0x599365);_0x1cc864(_0x10cae9[_0x6fde('0xe')](0x1f4,_0x7fde77['message']));});});};exports[_0x6fde('0x1b')]=function(_0x4bbd14){var _0xe2b72f=this;return new Promise(function(_0xd7f23a,_0x56a59f){return db[_0x6fde('0x5')][_0x6fde('0x1c')]({'where':_0x4bbd14['options']?_0x4bbd14[_0x6fde('0x6')][_0x6fde('0x10')]||null:null})[_0x6fde('0xc')](function(_0x3eff00){logger[_0x6fde('0x11')](_0x6fde('0x1b'),_0x4bbd14);logger['debug'](_0x6fde('0x1b'),_0x4bbd14,JSON[_0x6fde('0x12')](_0x3eff00));_0xd7f23a(_0x3eff00);})[_0x6fde('0x13')](function(_0x4ef62e){logger[_0x6fde('0xe')](_0x6fde('0x1b'),_0x4ef62e['message'],_0x4bbd14);_0x56a59f(_0xe2b72f[_0x6fde('0xe')](0x1f4,_0x4ef62e['message']));});});};exports[_0x6fde('0x1d')]=function(_0x2525a7){var _0xb90b72=this;return new Promise(function(_0x2f1544,_0x50b488){return db[_0x6fde('0x1e')][_0x6fde('0x1f')]()[_0x6fde('0xc')](function(_0x3832cd){return db['sequelize'][_0x6fde('0x20')](function(_0x494cf8){return db[_0x6fde('0x5')][_0x6fde('0x21')]({'where':_0x2525a7[_0x6fde('0x6')]?_0x2525a7[_0x6fde('0x6')]['where']||null:null,'attributes':_0x2525a7[_0x6fde('0x6')]?_0x2525a7['options'][_0x6fde('0x7')]||null:null,'limit':_0x2525a7[_0x6fde('0x6')]?_0x2525a7[_0x6fde('0x6')]['limit']||null:null,'order':_0x2525a7[_0x6fde('0x6')]?_0x2525a7[_0x6fde('0x6')][_0x6fde('0x22')]||null:null,'transaction':_0x494cf8,'lock':_0x494cf8[_0x6fde('0x23')][_0x6fde('0x24')],'include':[{'model':db[_0x6fde('0x1e')],'as':'Contact','attributes':_[_0x6fde('0x25')](_0x3832cd)},{'model':db[_0x6fde('0x26')],'as':_0x6fde('0x27'),'attributes':['id','name',_0x6fde('0x28')]}]})[_0x6fde('0xc')](function(_0xe72ea8){var _0x5a5057=[];var _0x2b7e4b=[];for(var _0x828260=0x0;_0x828260<_0xe72ea8[_0x6fde('0x29')];_0x828260+=0x1){var _0x15daa6=_0xe72ea8[_0x828260]['UserId'];if(_0x15daa6===null){_0x5a5057['push'](_0xe72ea8[_0x828260][_0x6fde('0x17')](_0x2525a7['body'],{'transaction':_0x494cf8}));}else if(!_0x2b7e4b[_0x6fde('0x2a')](_0x15daa6)){_0x2b7e4b[_0x6fde('0x2b')](_0x15daa6);_0x5a5057[_0x6fde('0x2b')](_0xe72ea8[_0x828260]['update'](_0x2525a7[_0x6fde('0x19')],{'transaction':_0x494cf8}));}}return BPromise[_0x6fde('0x2c')](_0x5a5057);});})['then'](function(_0x37569c){logger[_0x6fde('0x11')](_0x6fde('0x1d'),_0x2525a7);if(_0x37569c[_0x6fde('0x29')]>0x0){logger[_0x6fde('0x11')](_0x6fde('0x2d'),_0x37569c[0x0][_0x6fde('0x2e')]['id'],_0x37569c[0x0]['dataValues'][_0x6fde('0x2f')],_0x37569c[0x0]['dataValues'][_0x6fde('0x30')]);}logger[_0x6fde('0xd')](_0x6fde('0x1d'),_0x2525a7,JSON[_0x6fde('0x12')](_0x37569c));_0x2f1544(_0x37569c);})['catch'](function(_0x2f6abf){logger[_0x6fde('0xe')]('GetContactDialer',_0x2f6abf[_0x6fde('0xf')],_0x2525a7);_0x50b488(_0xb90b72[_0x6fde('0xe')](0x1f4,_0x2f6abf[_0x6fde('0xf')]));});});});};exports[_0x6fde('0x31')]=function(_0x4d74b3){var _0x430cf5=this;return new Promise(function(_0x537b4e,_0x54d1e7){return db[_0x6fde('0x32')][_0x6fde('0x20')](function(_0x207762){return db[_0x6fde('0x33')]['create'](_0x4d74b3[_0x6fde('0x19')],{'raw':_0x4d74b3[_0x6fde('0x6')]?_0x4d74b3['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x207762})[_0x6fde('0xc')](function(){logger[_0x6fde('0x11')](_0x6fde('0x34'),JSON['stringify'](_0x4d74b3['options'][_0x6fde('0x10')]),_0x4d74b3[_0x6fde('0x6')][_0x6fde('0x10')][_0x6fde('0x30')]);return db['CmHopper'][_0x6fde('0x1c')]({'where':_0x4d74b3[_0x6fde('0x6')]?_0x4d74b3[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'transaction':_0x207762});});})[_0x6fde('0xc')](function(_0x158e81){logger[_0x6fde('0x11')](_0x6fde('0x31'),_0x4d74b3);logger[_0x6fde('0xd')](_0x6fde('0x31'),_0x4d74b3,JSON[_0x6fde('0x12')](_0x158e81));_0x537b4e(_0x158e81);})[_0x6fde('0x13')](function(_0x3fa047){logger[_0x6fde('0xe')](_0x6fde('0x31'),_0x3fa047['message'],_0x4d74b3);_0x54d1e7(_0x430cf5[_0x6fde('0xe')](0x1f4,_0x3fa047[_0x6fde('0xf')]));});});};exports[_0x6fde('0x35')]=function(_0x3ccc1f){var _0xdceeb4=this;return new Promise(function(_0x4af212,_0x203788){return db['CmHopper'][_0x6fde('0x21')]({'raw':_0x3ccc1f[_0x6fde('0x6')]?_0x3ccc1f[_0x6fde('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x3ccc1f[_0x6fde('0x6')]?_0x3ccc1f[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6fde('0x36'),db['sequelize']['fn']('IF',db[_0x6fde('0x32')]['literal'](_0x6fde('0x37')+util[_0x6fde('0x38')](_0x6fde('0x39'),moment()[_0x6fde('0x38')](_0x6fde('0x3a')))+'\x20,\x201,\x20null'))),_0x6fde('0x3b')]]})['then'](function(_0x2c79e1){logger[_0x6fde('0x11')](_0x6fde('0x35'),_0x3ccc1f);logger[_0x6fde('0xd')](_0x6fde('0x35'),_0x3ccc1f,JSON[_0x6fde('0x12')](_0x2c79e1));_0x4af212(_0x2c79e1);})['catch'](function(_0x1cebe1){logger[_0x6fde('0xe')](_0x6fde('0x35'),_0x1cebe1['message'],_0x3ccc1f);_0x203788(_0xdceeb4[_0x6fde('0xe')](0x1f4,_0x1cebe1['message']));});});};exports[_0x6fde('0x3c')]=function(_0x2860c9){var _0x5a370a=this;return new Promise(function(_0x275621,_0x471159){return db[_0x6fde('0x1e')][_0x6fde('0x1f')]()[_0x6fde('0xc')](function(){return db[_0x6fde('0x32')][_0x6fde('0x20')](function(_0x4ef465){return db[_0x6fde('0x5')]['findAll']({'where':_0x2860c9[_0x6fde('0x6')]?_0x2860c9[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'attributes':_0x2860c9[_0x6fde('0x6')]?_0x2860c9[_0x6fde('0x6')][_0x6fde('0x7')]||null:null,'limit':0x1,'order':_0x2860c9[_0x6fde('0x6')]?_0x2860c9[_0x6fde('0x6')][_0x6fde('0x22')]||null:null,'group':db[_0x6fde('0x5')][_0x6fde('0x3d')],'transaction':_0x4ef465,'lock':_0x4ef465['LOCK'][_0x6fde('0x24')],'include':_0x2860c9['options']?_0x2860c9[_0x6fde('0x6')][_0x6fde('0x9')]?_['map'](_0x2860c9[_0x6fde('0x6')][_0x6fde('0x9')],function(_0x38898b){return{'model':db[_0x38898b[_0x6fde('0xa')]],'as':_0x38898b['as'],'attributes':_0x38898b['attributes'],'include':_0x38898b[_0x6fde('0x9')]?_[_0x6fde('0xb')](_0x38898b[_0x6fde('0x9')],function(_0x18c24d){return{'model':db[_0x18c24d['model']],'as':_0x18c24d['as'],'attributes':_0x18c24d['attributes'],'include':_0x18c24d[_0x6fde('0x9')]?_['map'](_0x18c24d[_0x6fde('0x9')],function(_0x1edc48){return{'model':db[_0x1edc48[_0x6fde('0xa')]],'as':_0x1edc48['as'],'attributes':_0x1edc48['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fde('0xc')](function(_0x271263){var _0x3d0685=[];for(var _0x3e2db1=0x0;_0x3e2db1<_0x271263['length'];_0x3e2db1+=0x1){_0x3d0685['push'](_0x271263[_0x3e2db1][_0x6fde('0x17')](_0x2860c9[_0x6fde('0x19')],{'transaction':_0x4ef465}));}return BPromise[_0x6fde('0x2c')](_0x3d0685);});})['then'](function(_0x21f792){logger['info'](_0x6fde('0x3c'),_0x2860c9);logger[_0x6fde('0xd')](_0x6fde('0x3c'),_0x2860c9,JSON[_0x6fde('0x12')](_0x21f792));_0x275621(_0x21f792);})[_0x6fde('0x13')](function(_0x46636d){logger['error'](_0x6fde('0x3c'),_0x46636d[_0x6fde('0xf')],_0x2860c9);_0x471159(_0x5a370a[_0x6fde('0xe')](0x1f4,_0x46636d[_0x6fde('0xf')]));});});});};exports[_0x6fde('0x3e')]=function(_0x51f268){var _0x344e1b=this;return new Promise(function(_0x41f7ee,_0x1328da){db['CmContact'][_0x6fde('0x1f')]()['then'](function(_0x3430a6){return db[_0x6fde('0x5')]['findAll']({'raw':_0x51f268['options']?_0x51f268['options'][_0x6fde('0x18')]===undefined?!![]:![]:!![],'where':_0x51f268[_0x6fde('0x6')]?_0x51f268[_0x6fde('0x6')][_0x6fde('0x10')]||null:null,'attributes':_0x51f268[_0x6fde('0x6')]?_0x51f268[_0x6fde('0x6')][_0x6fde('0x7')]||null:null,'limit':_0x51f268[_0x6fde('0x6')]?_0x51f268[_0x6fde('0x6')][_0x6fde('0x8')]||null:null,'include':_0x51f268['options']?_0x51f268[_0x6fde('0x6')][_0x6fde('0x9')]?_[_0x6fde('0xb')](_0x51f268[_0x6fde('0x6')]['include'],function(_0x310b62){return{'model':db[_0x310b62[_0x6fde('0xa')]],'as':_0x310b62['as'],'attributes':_0x310b62['as']==='Contact'?_[_0x6fde('0x25')](_0x3430a6):_0x310b62[_0x6fde('0x7')],'include':_0x310b62[_0x6fde('0x9')]?_['map'](_0x310b62[_0x6fde('0x9')],function(_0xf59fc1){return{'model':db[_0xf59fc1[_0x6fde('0xa')]],'as':_0xf59fc1['as'],'attributes':_0xf59fc1['attributes'],'include':_0xf59fc1[_0x6fde('0x9')]?_[_0x6fde('0xb')](_0xf59fc1[_0x6fde('0x9')],function(_0x3d78a6){return{'model':db[_0x3d78a6[_0x6fde('0xa')]],'as':_0x3d78a6['as'],'attributes':_0x3d78a6[_0x6fde('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf5a867){logger[_0x6fde('0x11')]('GetCmHopper',_0x51f268);logger['debug'](_0x6fde('0x4'),_0x51f268,JSON['stringify'](_0xf5a867));_0x41f7ee(_0xf5a867);})['catch'](function(_0x4b5046){logger[_0x6fde('0xe')]('GetCmHopper',_0x4b5046[_0x6fde('0xf')],_0x51f268);_0x1328da(_0x344e1b[_0x6fde('0xe')](0x1f4,_0x4b5046[_0x6fde('0xf')]));});});});};exports[_0x6fde('0x3f')]=function(_0x1c0d75){var _0x16cefb=this;return new Promise(function(_0x365e2f,_0x588c1d){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x1c0d75['options']['where'][_0x6fde('0x40')]},'attributes':['id','dialTimezone'],'order':[['id',_0x6fde('0x41')]]})[_0x6fde('0xc')](function(_0x46e930){logger[_0x6fde('0x11')](_0x6fde('0x42'),_0x1c0d75);logger['debug'](_0x6fde('0x42'),_0x1c0d75,JSON[_0x6fde('0x12')](_0x46e930));_0x365e2f(_0x46e930);})[_0x6fde('0x13')](function(_0x283f1e){logger[_0x6fde('0xe')](_0x6fde('0x42'),_0x283f1e[_0x6fde('0xf')],_0x1c0d75);_0x588c1d(_0x16cefb['error'](0x1f4,_0x283f1e[_0x6fde('0xf')]));});});};exports['ResetActiveCalls']=function(_0x1670ee){var _0x370984=this;return new Promise(function(_0x38ad44,_0xba9b71){return db[_0x6fde('0x32')]['transaction'](function(_0x273a1c){var _0x360597=_0x1670ee[_0x6fde('0x6')]&&_0x1670ee[_0x6fde('0x6')]['where']?_0x1670ee['options'][_0x6fde('0x10')]:{};return db[_0x6fde('0x5')][_0x6fde('0x17')](_0x1670ee[_0x6fde('0x19')],{'where':_0x360597,'transaction':_0x273a1c})[_0x6fde('0xc')](function(_0x932657){logger[_0x6fde('0x11')](_0x6fde('0x43'),_0x1670ee);logger[_0x6fde('0xd')](_0x6fde('0x43'),_0x1670ee,JSON[_0x6fde('0x12')](_0x932657));_0x38ad44(_0x932657);})[_0x6fde('0x13')](function(_0x3355fa){logger[_0x6fde('0xe')](_0x6fde('0x43'),_0x3355fa[_0x6fde('0xf')],_0x1670ee);_0xba9b71(_0x370984[_0x6fde('0xe')](0x1f4,_0x3355fa[_0x6fde('0xf')]));});});});};exports[_0x6fde('0x44')]=function(_0x3313ab){var _0x34b2b5=this;var _0x4fb7b7=_0x3313ab[_0x6fde('0x19')]['where'][_0x6fde('0x45')];var _0x1f2e8c=_0x3313ab[_0x6fde('0x19')][_0x6fde('0x10')]['interval'];var _0x8937a2=_0x3313ab[_0x6fde('0x19')][_0x6fde('0x10')][_0x6fde('0x46')];return new Promise(function(_0x3a049e,_0x3ec649){return db['CmHopper'][_0x6fde('0x21')]({'where':{'voiceQueueId':{'$in':_0x4fb7b7},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x6fde('0x32')][_0x6fde('0x47')]('NOW()\x20+\x20INTERVAL\x20'+_0x1f2e8c+_0x6fde('0x48')),'$gt':db[_0x6fde('0x32')][_0x6fde('0x47')](_0x6fde('0x49'))}},'UserId':{'$in':_0x8937a2}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':_0x6fde('0x27'),'attributes':['id',_0x6fde('0x4a'),_0x6fde('0x28')]},{'model':db['CmList'],'as':_0x6fde('0x4b')}]})[_0x6fde('0xc')](function(_0x1a494a){if(_0x1a494a[_0x6fde('0x29')]>0x0){return db[_0x6fde('0x32')][_0x6fde('0x20')](function(_0x4dc34a){return db['CmHopper'][_0x6fde('0x17')]({'recallmeNotifiedDate':db[_0x6fde('0x32')]['literal'](_0x6fde('0x49'))},{'where':{'id':{'$in':_[_0x6fde('0xb')](_0x1a494a,'id')}},'transaction':_0x4dc34a})[_0x6fde('0xc')](function(){_0x3a049e(_0x1a494a);})[_0x6fde('0x13')](function(_0xbf6003){logger['error']('CmHopperHandlePreviewRecallNotifications',_0xbf6003[_0x6fde('0xf')],_0x3313ab);_0x3ec649(_0x34b2b5[_0x6fde('0xe')](0x1f4,_0xbf6003['message']));});})[_0x6fde('0x13')](function(_0x4ddd79){logger['error'](_0x6fde('0x44'),_0x4ddd79[_0x6fde('0xf')],_0x3313ab);_0x3ec649(_0x34b2b5[_0x6fde('0xe')](0x1f4,_0x4ddd79[_0x6fde('0xf')]));});}else{_0x3a049e(_0x1a494a);}});});}; \ No newline at end of file +var _0x6688=['findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','voicePause','CmList','lodash','util','moment','../../config/logger','CmHopper','options','raw','where','attributes','limit','include','map','model','info','GetCmHopper','stringify','error','message','then','debug','ShowCmHopper','CreateCmHopper','body','catch','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','transaction','order','LOCK','Contact','User','Agent','length','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UserId','UPDATE','all','GetContactRecallMe','GetCmHopperPreview','describe','keys'];(function(_0x22008d,_0xd13c17){var _0x4d3080=function(_0x317895){while(--_0x317895){_0x22008d['push'](_0x22008d['shift']());}};_0x4d3080(++_0xd13c17);}(_0x6688,0x19e));var _0x8668=function(_0x3045c1,_0x184319){_0x3045c1=_0x3045c1-0x0;var _0x254c71=_0x6688[_0x3045c1];return _0x254c71;};'use strict';var _=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var moment=require(_0x8668('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x8668('0x3'))('rpc');exports['GetCmHopper']=function(_0x300f92){var _0xa121da=this;return new Promise(function(_0x30fb3f,_0x5738a0){return db[_0x8668('0x4')]['findAll']({'raw':_0x300f92[_0x8668('0x5')]?_0x300f92[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'where':_0x300f92[_0x8668('0x5')]?_0x300f92[_0x8668('0x5')][_0x8668('0x7')]||null:null,'attributes':_0x300f92['options']?_0x300f92[_0x8668('0x5')][_0x8668('0x8')]||null:null,'limit':_0x300f92[_0x8668('0x5')]?_0x300f92['options'][_0x8668('0x9')]||null:null,'include':_0x300f92[_0x8668('0x5')]?_0x300f92[_0x8668('0x5')][_0x8668('0xa')]?_[_0x8668('0xb')](_0x300f92[_0x8668('0x5')][_0x8668('0xa')],function(_0x493794){return{'model':db[_0x493794[_0x8668('0xc')]],'as':_0x493794['as'],'attributes':_0x493794['attributes'],'include':_0x493794[_0x8668('0xa')]?_[_0x8668('0xb')](_0x493794[_0x8668('0xa')],function(_0x5767f7){return{'model':db[_0x5767f7['model']],'as':_0x5767f7['as'],'attributes':_0x5767f7[_0x8668('0x8')],'include':_0x5767f7[_0x8668('0xa')]?_['map'](_0x5767f7['include'],function(_0xa0519f){return{'model':db[_0xa0519f['model']],'as':_0xa0519f['as'],'attributes':_0xa0519f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c52d4){logger[_0x8668('0xd')](_0x8668('0xe'),_0x300f92);logger['debug'](_0x8668('0xe'),_0x300f92,JSON[_0x8668('0xf')](_0x4c52d4));_0x30fb3f(_0x4c52d4);})['catch'](function(_0x5a6c28){logger[_0x8668('0x10')](_0x8668('0xe'),_0x5a6c28[_0x8668('0x11')],_0x300f92);_0x5738a0(_0xa121da[_0x8668('0x10')](0x1f4,_0x5a6c28[_0x8668('0x11')]));});});};exports['ShowCmHopper']=function(_0x22ec49){var _0x3efbe8=this;return new Promise(function(_0x1a29b7,_0x259038){return db['CmHopper']['find']({'raw':_0x22ec49[_0x8668('0x5')]?_0x22ec49[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'where':_0x22ec49['options']?_0x22ec49['options'][_0x8668('0x7')]||null:null,'attributes':_0x22ec49[_0x8668('0x5')]?_0x22ec49[_0x8668('0x5')][_0x8668('0x8')]||null:null,'include':_0x22ec49[_0x8668('0x5')]?_0x22ec49['options'][_0x8668('0xa')]?_[_0x8668('0xb')](_0x22ec49[_0x8668('0x5')]['include'],function(_0x5a285b){return{'model':db[_0x5a285b[_0x8668('0xc')]],'as':_0x5a285b['as'],'attributes':_0x5a285b[_0x8668('0x8')],'include':_0x5a285b[_0x8668('0xa')]?_[_0x8668('0xb')](_0x5a285b[_0x8668('0xa')],function(_0x277f5d){return{'model':db[_0x277f5d[_0x8668('0xc')]],'as':_0x277f5d['as'],'attributes':_0x277f5d['attributes'],'include':_0x277f5d['include']?_[_0x8668('0xb')](_0x277f5d[_0x8668('0xa')],function(_0x4a2742){return{'model':db[_0x4a2742['model']],'as':_0x4a2742['as'],'attributes':_0x4a2742[_0x8668('0x8')]};}):[]};}):[]};}):[]:[]})[_0x8668('0x12')](function(_0x2d8636){logger['info']('ShowCmHopper',_0x22ec49);logger[_0x8668('0x13')](_0x8668('0x14'),_0x22ec49,JSON[_0x8668('0xf')](_0x2d8636));_0x1a29b7(_0x2d8636);})['catch'](function(_0x3631fc){logger[_0x8668('0x10')](_0x8668('0x14'),_0x3631fc[_0x8668('0x11')],_0x22ec49);_0x259038(_0x3efbe8[_0x8668('0x10')](0x1f4,_0x3631fc[_0x8668('0x11')]));});});};exports[_0x8668('0x15')]=function(_0x520260){var _0x30faf4=this;return new Promise(function(_0x55e8aa,_0x44d565){return db[_0x8668('0x4')]['create'](_0x520260[_0x8668('0x16')],{'raw':_0x520260[_0x8668('0x5')]?_0x520260['options']['raw']===undefined?!![]:![]:!![]})[_0x8668('0x12')](function(_0x530bbd){logger[_0x8668('0xd')]('CreateCmHopper',_0x520260);logger['debug'](_0x8668('0x15'),_0x520260,JSON[_0x8668('0xf')](_0x530bbd));_0x55e8aa(_0x530bbd);})[_0x8668('0x17')](function(_0x13eaa6){logger[_0x8668('0x10')](_0x8668('0x15'),_0x13eaa6[_0x8668('0x11')],_0x520260);_0x44d565(_0x30faf4['error'](0x1f4,_0x13eaa6[_0x8668('0x11')]));});});};exports[_0x8668('0x18')]=function(_0x56c4e1){var _0x3c6165=this;return new Promise(function(_0x50aac2,_0x57a776){return db[_0x8668('0x4')][_0x8668('0x19')](_0x56c4e1['body'],{'raw':_0x56c4e1[_0x8668('0x5')]?_0x56c4e1[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c4e1[_0x8668('0x5')]?_0x56c4e1['options']['where']||null:null,'attributes':_0x56c4e1[_0x8668('0x5')]?_0x56c4e1[_0x8668('0x5')]['attributes']||null:null,'limit':_0x56c4e1[_0x8668('0x5')]?_0x56c4e1[_0x8668('0x5')][_0x8668('0x9')]||null:null})[_0x8668('0x12')](function(_0x20d54e){logger[_0x8668('0xd')](_0x8668('0x18'),_0x56c4e1);logger[_0x8668('0xd')](_0x8668('0x1a'),JSON[_0x8668('0xf')](_0x56c4e1[_0x8668('0x5')]['where']),_0x56c4e1['body'][_0x8668('0x1b')]);logger[_0x8668('0x13')](_0x8668('0x18'),_0x56c4e1,JSON['stringify'](_0x20d54e));_0x50aac2(_0x20d54e);})['catch'](function(_0x31140d){logger[_0x8668('0x10')](_0x8668('0x18'),_0x31140d['message'],_0x56c4e1);_0x57a776(_0x3c6165[_0x8668('0x10')](0x1f4,_0x31140d['message']));});});};exports[_0x8668('0x1c')]=function(_0x1068dc){var _0xf2c201=this;return new Promise(function(_0x4f618f,_0x1c33a8){return db[_0x8668('0x4')][_0x8668('0x1d')]({'where':_0x1068dc[_0x8668('0x5')]?_0x1068dc[_0x8668('0x5')][_0x8668('0x7')]||null:null})[_0x8668('0x12')](function(_0x86b5ff){logger[_0x8668('0xd')](_0x8668('0x1c'),_0x1068dc);logger[_0x8668('0x13')](_0x8668('0x1c'),_0x1068dc,JSON[_0x8668('0xf')](_0x86b5ff));_0x4f618f(_0x86b5ff);})[_0x8668('0x17')](function(_0x5759ad){logger[_0x8668('0x10')](_0x8668('0x1c'),_0x5759ad[_0x8668('0x11')],_0x1068dc);_0x1c33a8(_0xf2c201['error'](0x1f4,_0x5759ad['message']));});});};exports[_0x8668('0x1e')]=function(_0x3fe241){var _0x1e6871=this;return new Promise(function(_0x10f571,_0x1c6b11){return db[_0x8668('0x1f')]['describe']()[_0x8668('0x12')](function(_0x1d88b9){return db['sequelize'][_0x8668('0x20')](function(_0x533163){return db[_0x8668('0x4')]['findAll']({'where':_0x3fe241[_0x8668('0x5')]?_0x3fe241[_0x8668('0x5')][_0x8668('0x7')]||null:null,'attributes':_0x3fe241[_0x8668('0x5')]?_0x3fe241[_0x8668('0x5')][_0x8668('0x8')]||null:null,'limit':_0x3fe241[_0x8668('0x5')]?_0x3fe241[_0x8668('0x5')][_0x8668('0x9')]||null:null,'order':_0x3fe241[_0x8668('0x5')]?_0x3fe241[_0x8668('0x5')][_0x8668('0x21')]||null:null,'transaction':_0x533163,'lock':_0x533163[_0x8668('0x22')]['UPDATE'],'include':[{'model':db[_0x8668('0x1f')],'as':_0x8668('0x23'),'attributes':_['keys'](_0x1d88b9)},{'model':db[_0x8668('0x24')],'as':_0x8668('0x25'),'attributes':['id','name','voicePause']}]})['then'](function(_0x1c31f1){var _0x446a2f=[];var _0x1e3452=[];for(var _0x15abef=0x0;_0x15abef<_0x1c31f1[_0x8668('0x26')];_0x15abef+=0x1){var _0x3320d0=_0x1c31f1[_0x15abef]['UserId'];if(_0x3320d0===null){_0x446a2f[_0x8668('0x27')](_0x1c31f1[_0x15abef][_0x8668('0x19')](_0x3fe241[_0x8668('0x16')],{'transaction':_0x533163}));}else if(!_0x1e3452[_0x8668('0x28')](_0x3320d0)){_0x1e3452['push'](_0x3320d0);_0x446a2f[_0x8668('0x27')](_0x1c31f1[_0x15abef][_0x8668('0x19')](_0x3fe241[_0x8668('0x16')],{'transaction':_0x533163}));}}return BPromise['all'](_0x446a2f);});})['then'](function(_0x38d7c5){logger['info']('GetContactDialer',_0x3fe241);if(_0x38d7c5[_0x8668('0x26')]>0x0){logger['info'](_0x8668('0x29'),_0x38d7c5[0x0][_0x8668('0x2a')]['id'],_0x38d7c5[0x0]['dataValues'][_0x8668('0x2b')],_0x38d7c5[0x0][_0x8668('0x2a')]['active']);}logger[_0x8668('0x13')](_0x8668('0x1e'),_0x3fe241,JSON['stringify'](_0x38d7c5));_0x10f571(_0x38d7c5);})[_0x8668('0x17')](function(_0x4144a6){logger[_0x8668('0x10')](_0x8668('0x1e'),_0x4144a6['message'],_0x3fe241);_0x1c6b11(_0x1e6871[_0x8668('0x10')](0x1f4,_0x4144a6[_0x8668('0x11')]));});});});};exports[_0x8668('0x2c')]=function(_0x1d5f50){var _0x47812b=this;return new Promise(function(_0x480bce,_0x3cf77d){return db[_0x8668('0x2d')][_0x8668('0x20')](function(_0x8a2b1f){return db[_0x8668('0x2e')][_0x8668('0x2f')](_0x1d5f50['body'],{'raw':_0x1d5f50[_0x8668('0x5')]?_0x1d5f50[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'transaction':_0x8a2b1f})[_0x8668('0x12')](function(){logger['info'](_0x8668('0x30'),JSON[_0x8668('0xf')](_0x1d5f50[_0x8668('0x5')][_0x8668('0x7')]),_0x1d5f50['options'][_0x8668('0x7')][_0x8668('0x1b')]);return db['CmHopper']['destroy']({'where':_0x1d5f50[_0x8668('0x5')]?_0x1d5f50[_0x8668('0x5')][_0x8668('0x7')]||null:null,'transaction':_0x8a2b1f});});})[_0x8668('0x12')](function(_0x2f9593){logger[_0x8668('0xd')](_0x8668('0x2c'),_0x1d5f50);logger[_0x8668('0x13')](_0x8668('0x2c'),_0x1d5f50,JSON[_0x8668('0xf')](_0x2f9593));_0x480bce(_0x2f9593);})[_0x8668('0x17')](function(_0x34fec8){logger['error'](_0x8668('0x2c'),_0x34fec8[_0x8668('0x11')],_0x1d5f50);_0x3cf77d(_0x47812b[_0x8668('0x10')](0x1f4,_0x34fec8[_0x8668('0x11')]));});});};exports[_0x8668('0x31')]=function(_0x501b55){var _0x5f204f=this;return new Promise(function(_0x1b730e,_0x5a55bf){return db[_0x8668('0x4')][_0x8668('0x32')]({'raw':_0x501b55[_0x8668('0x5')]?_0x501b55[_0x8668('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x501b55[_0x8668('0x5')]?_0x501b55['options']['where']||null:null,'attributes':[[db[_0x8668('0x2d')]['fn'](_0x8668('0x33'),db['sequelize']['fn']('IF',db[_0x8668('0x2d')][_0x8668('0x34')](_0x8668('0x35')+util[_0x8668('0x36')](_0x8668('0x37'),moment()[_0x8668('0x36')](_0x8668('0x38')))+_0x8668('0x39')))),_0x8668('0x3a')]]})['then'](function(_0x549fb){logger[_0x8668('0xd')](_0x8668('0x31'),_0x501b55);logger[_0x8668('0x13')](_0x8668('0x31'),_0x501b55,JSON[_0x8668('0xf')](_0x549fb));_0x1b730e(_0x549fb);})[_0x8668('0x17')](function(_0x4d05d8){logger[_0x8668('0x10')](_0x8668('0x31'),_0x4d05d8[_0x8668('0x11')],_0x501b55);_0x5a55bf(_0x5f204f[_0x8668('0x10')](0x1f4,_0x4d05d8[_0x8668('0x11')]));});});};exports['GetContactRecallMe']=function(_0x2bf78c){var _0x3bd3ae=this;return new Promise(function(_0x4e1a75,_0x10c69f){return db[_0x8668('0x1f')]['describe']()[_0x8668('0x12')](function(){return db[_0x8668('0x2d')]['transaction'](function(_0x4e226e){return db[_0x8668('0x4')][_0x8668('0x32')]({'where':_0x2bf78c[_0x8668('0x5')]?_0x2bf78c['options'][_0x8668('0x7')]||null:null,'attributes':_0x2bf78c[_0x8668('0x5')]?_0x2bf78c['options'][_0x8668('0x8')]||null:null,'limit':0x1,'order':_0x2bf78c[_0x8668('0x5')]?_0x2bf78c[_0x8668('0x5')]['order']||null:null,'group':db['CmHopper'][_0x8668('0x3b')],'transaction':_0x4e226e,'lock':_0x4e226e[_0x8668('0x22')][_0x8668('0x3c')],'include':_0x2bf78c[_0x8668('0x5')]?_0x2bf78c[_0x8668('0x5')]['include']?_[_0x8668('0xb')](_0x2bf78c[_0x8668('0x5')][_0x8668('0xa')],function(_0x25e84c){return{'model':db[_0x25e84c[_0x8668('0xc')]],'as':_0x25e84c['as'],'attributes':_0x25e84c[_0x8668('0x8')],'include':_0x25e84c[_0x8668('0xa')]?_[_0x8668('0xb')](_0x25e84c[_0x8668('0xa')],function(_0x156185){return{'model':db[_0x156185[_0x8668('0xc')]],'as':_0x156185['as'],'attributes':_0x156185[_0x8668('0x8')],'include':_0x156185[_0x8668('0xa')]?_[_0x8668('0xb')](_0x156185[_0x8668('0xa')],function(_0x3eb5fa){return{'model':db[_0x3eb5fa[_0x8668('0xc')]],'as':_0x3eb5fa['as'],'attributes':_0x3eb5fa[_0x8668('0x8')]};}):[]};}):[]};}):[]:[]})[_0x8668('0x12')](function(_0x2bca25){var _0x2e946b=[];for(var _0x4d937a=0x0;_0x4d937a<_0x2bca25[_0x8668('0x26')];_0x4d937a+=0x1){_0x2e946b[_0x8668('0x27')](_0x2bca25[_0x4d937a][_0x8668('0x19')](_0x2bf78c[_0x8668('0x16')],{'transaction':_0x4e226e}));}return BPromise[_0x8668('0x3d')](_0x2e946b);});})[_0x8668('0x12')](function(_0x16bf89){logger[_0x8668('0xd')]('GetContactRecallMe',_0x2bf78c);logger[_0x8668('0x13')]('GetContactRecallMe',_0x2bf78c,JSON[_0x8668('0xf')](_0x16bf89));_0x4e1a75(_0x16bf89);})[_0x8668('0x17')](function(_0x279ff7){logger['error'](_0x8668('0x3e'),_0x279ff7[_0x8668('0x11')],_0x2bf78c);_0x10c69f(_0x3bd3ae[_0x8668('0x10')](0x1f4,_0x279ff7['message']));});});});};exports[_0x8668('0x3f')]=function(_0x3dfa65){var _0x49ca91=this;return new Promise(function(_0x404c78,_0x333ba2){db[_0x8668('0x1f')][_0x8668('0x40')]()['then'](function(_0x505b54){return db[_0x8668('0x4')]['findAll']({'raw':_0x3dfa65[_0x8668('0x5')]?_0x3dfa65[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'where':_0x3dfa65[_0x8668('0x5')]?_0x3dfa65['options'][_0x8668('0x7')]||null:null,'attributes':_0x3dfa65[_0x8668('0x5')]?_0x3dfa65['options'][_0x8668('0x8')]||null:null,'limit':_0x3dfa65[_0x8668('0x5')]?_0x3dfa65['options'][_0x8668('0x9')]||null:null,'include':_0x3dfa65['options']?_0x3dfa65['options'][_0x8668('0xa')]?_[_0x8668('0xb')](_0x3dfa65[_0x8668('0x5')][_0x8668('0xa')],function(_0x447c0a){return{'model':db[_0x447c0a[_0x8668('0xc')]],'as':_0x447c0a['as'],'attributes':_0x447c0a['as']===_0x8668('0x23')?_[_0x8668('0x41')](_0x505b54):_0x447c0a[_0x8668('0x8')],'include':_0x447c0a[_0x8668('0xa')]?_[_0x8668('0xb')](_0x447c0a['include'],function(_0x249eca){return{'model':db[_0x249eca[_0x8668('0xc')]],'as':_0x249eca['as'],'attributes':_0x249eca[_0x8668('0x8')],'include':_0x249eca['include']?_['map'](_0x249eca[_0x8668('0xa')],function(_0x1def5f){return{'model':db[_0x1def5f[_0x8668('0xc')]],'as':_0x1def5f['as'],'attributes':_0x1def5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8668('0x12')](function(_0x370e65){logger[_0x8668('0xd')](_0x8668('0xe'),_0x3dfa65);logger[_0x8668('0x13')]('GetCmHopper',_0x3dfa65,JSON['stringify'](_0x370e65));_0x404c78(_0x370e65);})[_0x8668('0x17')](function(_0x46f685){logger[_0x8668('0x10')](_0x8668('0xe'),_0x46f685[_0x8668('0x11')],_0x3dfa65);_0x333ba2(_0x49ca91[_0x8668('0x10')](0x1f4,_0x46f685[_0x8668('0x11')]));});});});};exports['GetContactByPhone']=function(_0x415cd9){var _0x39637a=this;return new Promise(function(_0x3e1480,_0x40b643){return db[_0x8668('0x1f')][_0x8668('0x42')]({'raw':!![],'where':{'phone':_0x415cd9['options']['where'][_0x8668('0x43')]},'attributes':['id','dialTimezone'],'order':[['id',_0x8668('0x44')]]})[_0x8668('0x12')](function(_0x22c88f){logger['info'](_0x8668('0x45'),_0x415cd9);logger[_0x8668('0x13')]('getContactByPhone',_0x415cd9,JSON[_0x8668('0xf')](_0x22c88f));_0x3e1480(_0x22c88f);})[_0x8668('0x17')](function(_0x47b605){logger['error']('getContactByPhone',_0x47b605[_0x8668('0x11')],_0x415cd9);_0x40b643(_0x39637a[_0x8668('0x10')](0x1f4,_0x47b605[_0x8668('0x11')]));});});};exports[_0x8668('0x46')]=function(_0x161979){var _0x4b7c29=this;return new Promise(function(_0x41a8b9,_0x500953){return db[_0x8668('0x2d')][_0x8668('0x20')](function(_0x6aff58){var _0x26bcdc=_0x161979[_0x8668('0x5')]&&_0x161979['options'][_0x8668('0x7')]?_0x161979[_0x8668('0x5')]['where']:{};return db[_0x8668('0x4')]['update'](_0x161979['body'],{'where':_0x26bcdc,'transaction':_0x6aff58})['then'](function(_0x5720d3){logger[_0x8668('0xd')]('ResetActiveCalls',_0x161979);logger[_0x8668('0x13')](_0x8668('0x46'),_0x161979,JSON[_0x8668('0xf')](_0x5720d3));_0x41a8b9(_0x5720d3);})[_0x8668('0x17')](function(_0x2841cd){logger[_0x8668('0x10')](_0x8668('0x46'),_0x2841cd[_0x8668('0x11')],_0x161979);_0x500953(_0x4b7c29[_0x8668('0x10')](0x1f4,_0x2841cd[_0x8668('0x11')]));});});});};exports[_0x8668('0x47')]=function(_0x303d9c){var _0x5ec8b5=this;var _0x2d4960=_0x303d9c[_0x8668('0x16')]['where']['voiceQueueIds'];var _0x22bd7f=_0x303d9c[_0x8668('0x16')][_0x8668('0x7')][_0x8668('0x48')];var _0x59ab65=_0x303d9c[_0x8668('0x16')][_0x8668('0x7')][_0x8668('0x49')];return new Promise(function(_0x50c251,_0x2429bb){return db['CmHopper'][_0x8668('0x32')]({'where':{'voiceQueueId':{'$in':_0x2d4960},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x8668('0x4a')+_0x22bd7f+_0x8668('0x4b')),'$gt':db[_0x8668('0x2d')][_0x8668('0x34')](_0x8668('0x4c'))}},'UserId':{'$in':_0x59ab65}},'include':[{'model':db[_0x8668('0x1f')],'as':_0x8668('0x23')},{'model':db[_0x8668('0x24')],'as':_0x8668('0x25'),'attributes':['id',_0x8668('0x4d'),_0x8668('0x4e')]},{'model':db[_0x8668('0x4f')],'as':'List'}]})[_0x8668('0x12')](function(_0x420d2d){if(_0x420d2d[_0x8668('0x26')]>0x0){return db['sequelize']['transaction'](function(_0x119a30){return db['CmHopper'][_0x8668('0x19')]({'recallmeNotifiedDate':db[_0x8668('0x2d')]['literal']('NOW()')},{'where':{'id':{'$in':_[_0x8668('0xb')](_0x420d2d,'id')}},'transaction':_0x119a30})['then'](function(){_0x50c251(_0x420d2d);})[_0x8668('0x17')](function(_0x41d3d4){logger['error'](_0x8668('0x47'),_0x41d3d4[_0x8668('0x11')],_0x303d9c);_0x2429bb(_0x5ec8b5['error'](0x1f4,_0x41d3d4[_0x8668('0x11')]));});})[_0x8668('0x17')](function(_0x54cf8e){logger[_0x8668('0x10')](_0x8668('0x47'),_0x54cf8e['message'],_0x303d9c);_0x2429bb(_0x5ec8b5['error'](0x1f4,_0x54cf8e[_0x8668('0x11')]));});}else{_0x50c251(_0x420d2d);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index cd026cd..1cbfeb9 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 _0xc172=['getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','post','create','/timezone','getTimezone','put','update','delete','exports','Router','../../components/auth/service','./cmHopper.controller','get','/describe','isAuthenticated','/opencontacts'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc172,0x161));var _0x2c17=function(_0x3d0ee4,_0x34c4fa){_0x3d0ee4=_0x3d0ee4-0x0;var _0x2c4202=_0xc172[_0x3d0ee4];return _0x2c4202;};'use strict';var express=require('express');var router=express[_0x2c17('0x0')]();var auth=require(_0x2c17('0x1'));var controller=require(_0x2c17('0x2'));router[_0x2c17('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2c17('0x3')](_0x2c17('0x4'),auth[_0x2c17('0x5')](),controller['describe']);router['get'](_0x2c17('0x6'),auth[_0x2c17('0x5')](),controller[_0x2c17('0x7')]);router[_0x2c17('0x3')](_0x2c17('0x8'),auth[_0x2c17('0x5')](),controller[_0x2c17('0x9')]);router[_0x2c17('0x3')](_0x2c17('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2c17('0x3')](_0x2c17('0xb'),auth[_0x2c17('0x5')](),controller['getPreviewRecall']);router[_0x2c17('0xc')]('/',auth['isAuthenticated'](),controller[_0x2c17('0xd')]);router[_0x2c17('0xc')]('/preview',auth[_0x2c17('0x5')](),controller['getPreview']);router[_0x2c17('0xc')](_0x2c17('0xe'),auth[_0x2c17('0x5')](),controller[_0x2c17('0xf')]);router[_0x2c17('0x10')](_0x2c17('0xa'),auth[_0x2c17('0x5')](),controller[_0x2c17('0x11')]);router[_0x2c17('0x12')](_0x2c17('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2c17('0x13')]=router; \ No newline at end of file +var _0xa0a2=['getTimezones','/:id','show','getPreviewRecall','create','/preview','getPreview','post','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','describe','getOpenContacts','/timezones'];(function(_0x4580b0,_0x1f3173){var _0x5464f6=function(_0xbf5a05){while(--_0xbf5a05){_0x4580b0['push'](_0x4580b0['shift']());}};_0x5464f6(++_0x1f3173);}(_0xa0a2,0xf0));var _0x2a0a=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0xa0a2[_0x244862];return _0x2bce23;};'use strict';var express=require(_0x2a0a('0x0'));var router=express[_0x2a0a('0x1')]();var auth=require(_0x2a0a('0x2'));var controller=require(_0x2a0a('0x3'));router[_0x2a0a('0x4')]('/',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x6')]);router[_0x2a0a('0x4')]('/describe',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x7')]);router['get']('/opencontacts',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x8')]);router[_0x2a0a('0x4')](_0x2a0a('0x9'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0xa')]);router['get'](_0x2a0a('0xb'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0xc')]);router[_0x2a0a('0x4')]('/:id/previewrecall',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0xd')]);router['post']('/',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0xe')]);router['post'](_0x2a0a('0xf'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x10')]);router[_0x2a0a('0x11')](_0x2a0a('0x12'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x13')]);router[_0x2a0a('0x14')](_0x2a0a('0xb'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x15')]);router[_0x2a0a('0x16')](_0x2a0a('0xb'),auth['isAuthenticated'](),controller[_0x2a0a('0x17')]);module[_0x2a0a('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 63b4b6f..8631c07 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 _0x64d9=['exports','INTEGER','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0xea43d,_0x4246e8){var _0x53e4c1=function(_0x35b6d8){while(--_0x35b6d8){_0xea43d['push'](_0xea43d['shift']());}};_0x53e4c1(++_0x4246e8);}(_0x64d9,0x1cb));var _0x964d=function(_0x2a0e5c,_0x29daeb){_0x2a0e5c=_0x2a0e5c-0x0;var _0x289d4b=_0x64d9[_0x2a0e5c];return _0x289d4b;};'use strict';var moment=require('moment');var Sequelize=require(_0x964d('0x0'));module[_0x964d('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x964d('0x3')](_0x964d('0x4'))},'countbusyretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x964d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2510=['INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x2510,0x107));var _0x0251=function(_0x514023,_0x38130f){_0x514023=_0x514023-0x0;var _0xc952d6=_0x2510[_0x514023];return _0xc952d6;};'use strict';var moment=require(_0x0251('0x0'));var Sequelize=require(_0x0251('0x1'));module[_0x0251('0x2')]={'CmHopperId':{'type':Sequelize[_0x0251('0x3')]},'phone':{'type':Sequelize[_0x0251('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0251('0x5')],'defaultValue':moment()['format'](_0x0251('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index bce13ee..442d141 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 _0xb2b1=['sort','pick','filter','where','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xb2b1,0x11d));var _0x1b2b=function(_0x239089,_0x511f9b){_0x239089=_0x239089-0x0;var _0x3ac7f1=_0xb2b1[_0x239089];return _0x3ac7f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b2b('0x0'));var zipdir=require(_0x1b2b('0x1'));var jsonpatch=require(_0x1b2b('0x2'));var rp=require(_0x1b2b('0x3'));var moment=require(_0x1b2b('0x4'));var BPromise=require(_0x1b2b('0x5'));var Mustache=require(_0x1b2b('0x6'));var util=require('util');var path=require(_0x1b2b('0x7'));var sox=require(_0x1b2b('0x8'));var csv=require(_0x1b2b('0x9'));var ejs=require(_0x1b2b('0xa'));var fs=require('fs');var fs_extra=require(_0x1b2b('0xb'));var _=require(_0x1b2b('0xc'));var squel=require(_0x1b2b('0xd'));var crypto=require(_0x1b2b('0xe'));var jsforce=require(_0x1b2b('0xf'));var deskjs=require(_0x1b2b('0x10'));var toCsv=require(_0x1b2b('0x9'));var querystring=require('querystring');var Papa=require(_0x1b2b('0x11'));var Redis=require(_0x1b2b('0x12'));var authService=require(_0x1b2b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1b2b('0x14'));var hardwareService=require(_0x1b2b('0x15'));var logger=require('../../config/logger')(_0x1b2b('0x16'));var utils=require(_0x1b2b('0x17'));var config=require(_0x1b2b('0x18'));var licenseUtil=require(_0x1b2b('0x19'));var db=require(_0x1b2b('0x1a'))['db'];function respondWithStatusCode(_0x3ce305,_0x569fd6){_0x569fd6=_0x569fd6||0xcc;return function(_0x9d8123){if(_0x9d8123){return _0x3ce305['sendStatus'](_0x569fd6);}return _0x3ce305['status'](_0x569fd6)[_0x1b2b('0x1b')]();};}function respondWithResult(_0x52f5b9,_0x2885f0){_0x2885f0=_0x2885f0||0xc8;return function(_0x5ec046){if(_0x5ec046){return _0x52f5b9['status'](_0x2885f0)['json'](_0x5ec046);}};}function respondWithFilteredResult(_0x49a96e,_0x253df0){return function(_0x515fe6){if(_0x515fe6){var _0x73dfd2=typeof _0x253df0[_0x1b2b('0x1c')]==='undefined'&&typeof _0x253df0['limit']==='undefined';var _0x48598a=_0x515fe6[_0x1b2b('0x1d')];var _0x18c742=_0x73dfd2?0x0:_0x253df0[_0x1b2b('0x1c')];var _0x3ce292=_0x73dfd2?_0x515fe6[_0x1b2b('0x1d')]:_0x253df0[_0x1b2b('0x1c')]+_0x253df0[_0x1b2b('0x1e')];var _0x34bfa9;if(_0x3ce292>=_0x48598a){_0x3ce292=_0x48598a;_0x34bfa9=0xc8;}else{_0x34bfa9=0xce;}_0x49a96e[_0x1b2b('0x1f')](_0x34bfa9);return _0x49a96e[_0x1b2b('0x20')](_0x1b2b('0x21'),_0x18c742+'-'+_0x3ce292+'/'+_0x48598a)[_0x1b2b('0x22')](_0x515fe6);}return null;};}function patchUpdates(_0x275c26){return function(_0x250095){try{jsonpatch[_0x1b2b('0x23')](_0x250095,_0x275c26,!![]);}catch(_0x292746){return BPromise[_0x1b2b('0x24')](_0x292746);}return _0x250095[_0x1b2b('0x25')]();};}function saveUpdates(_0x10335f,_0x286517){return function(_0x41c33b){if(_0x41c33b){return _0x41c33b[_0x1b2b('0x26')](_0x10335f)[_0x1b2b('0x27')](function(_0x417a7d){return _0x417a7d;});}return null;};}function removeEntity(_0x5b997d,_0x5343b0){return function(_0x3b121f){if(_0x3b121f){return _0x3b121f[_0x1b2b('0x28')]()[_0x1b2b('0x27')](function(){var _0x201f45=_0x3b121f[_0x1b2b('0x29')]({'plain':!![]});var _0x5b5a96=_0x1b2b('0x2a');return db[_0x1b2b('0x2b')]['destroy']({'where':{'type':_0x5b5a96,'resourceId':_0x201f45['id']}})[_0x1b2b('0x27')](function(){return _0x3b121f;});})['then'](function(){_0x5b997d['status'](0xcc)[_0x1b2b('0x1b')]();});}};}function handleEntityNotFound(_0x32124a,_0x4be326){return function(_0x1e0064){if(!_0x1e0064){_0x32124a[_0x1b2b('0x2c')](0x194);}return _0x1e0064;};}function handleError(_0x49d084,_0x568f0e){_0x568f0e=_0x568f0e||0x1f4;return function(_0x27b291){logger['error'](_0x27b291['stack']);if(_0x27b291[_0x1b2b('0x2d')]){delete _0x27b291['name'];}_0x49d084[_0x1b2b('0x1f')](_0x568f0e)[_0x1b2b('0x2e')](_0x27b291);};}exports[_0x1b2b('0x2f')]=function(_0x3c3656,_0x35e914){var _0x13e16b={},_0x130a21={},_0x1176f1={'count':0x0,'rows':[]};var _0x5f3b69=_[_0x1b2b('0x30')](db[_0x1b2b('0x31')][_0x1b2b('0x32')],function(_0x3ff4f9){return{'name':_0x3ff4f9['fieldName'],'type':_0x3ff4f9[_0x1b2b('0x33')][_0x1b2b('0x34')]};});_0x130a21[_0x1b2b('0x35')]=_[_0x1b2b('0x30')](_0x5f3b69,_0x1b2b('0x2d'));_0x130a21[_0x1b2b('0x36')]=_[_0x1b2b('0x37')](_0x3c3656[_0x1b2b('0x36')]);_0x130a21[_0x1b2b('0x38')]=_['intersection'](_0x130a21[_0x1b2b('0x35')],_0x130a21[_0x1b2b('0x36')]);_0x13e16b[_0x1b2b('0x39')]=_[_0x1b2b('0x3a')](_0x130a21[_0x1b2b('0x35')],qs['fields'](_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x3b')]));_0x13e16b['attributes']=_0x13e16b[_0x1b2b('0x39')]['length']?_0x13e16b['attributes']:_0x130a21['model'];if(!_0x3c3656['query'][_0x1b2b('0x3c')](_0x1b2b('0x3d'))){_0x13e16b[_0x1b2b('0x1e')]=qs[_0x1b2b('0x1e')](_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x1e')]);_0x13e16b['offset']=qs[_0x1b2b('0x1c')](_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x1c')]);}_0x13e16b[_0x1b2b('0x3e')]=qs[_0x1b2b('0x3f')](_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x3f')]);_0x13e16b['where']=qs[_0x1b2b('0x38')](_[_0x1b2b('0x40')](_0x3c3656[_0x1b2b('0x36')],_0x130a21[_0x1b2b('0x38')]),_0x5f3b69);if(_0x3c3656['query'][_0x1b2b('0x41')]){_0x13e16b[_0x1b2b('0x42')]=_['merge'](_0x13e16b[_0x1b2b('0x42')],{'$or':_[_0x1b2b('0x30')](_0x5f3b69,function(_0x48865a){if(_0x48865a['type']!==_0x1b2b('0x43')){var _0x12d2ed={};_0x12d2ed[_0x48865a['name']]={'$like':'%'+_0x3c3656[_0x1b2b('0x36')][_0x1b2b('0x41')]+'%'};return _0x12d2ed;}})});}_0x13e16b=_['merge']({},_0x13e16b,_0x3c3656[_0x1b2b('0x44')]);var _0x1065f4={'where':_0x13e16b[_0x1b2b('0x42')]};return db['CmHopperAdditionalPhone']['count'](_0x1065f4)['then'](function(_0x77b32b){_0x1176f1[_0x1b2b('0x1d')]=_0x77b32b;if(_0x3c3656[_0x1b2b('0x36')]['includeAll']){_0x13e16b[_0x1b2b('0x45')]=[{'all':!![]}];}return db[_0x1b2b('0x31')]['findAll'](_0x13e16b);})['then'](function(_0x1c83a5){_0x1176f1[_0x1b2b('0x46')]=_0x1c83a5;return _0x1176f1;})[_0x1b2b('0x27')](respondWithFilteredResult(_0x35e914,_0x13e16b))[_0x1b2b('0x47')](handleError(_0x35e914,null));};exports[_0x1b2b('0x48')]=function(_0xa72896,_0x4ee4a0){var _0x388fa6={'raw':!![],'where':{'id':_0xa72896[_0x1b2b('0x49')]['id']}},_0x4921a7={};_0x4921a7[_0x1b2b('0x35')]=_['keys'](db[_0x1b2b('0x31')]['rawAttributes']);_0x4921a7[_0x1b2b('0x36')]=_['keys'](_0xa72896[_0x1b2b('0x36')]);_0x4921a7[_0x1b2b('0x38')]=_[_0x1b2b('0x3a')](_0x4921a7[_0x1b2b('0x35')],_0x4921a7['query']);_0x388fa6[_0x1b2b('0x39')]=_[_0x1b2b('0x3a')](_0x4921a7[_0x1b2b('0x35')],qs['fields'](_0xa72896[_0x1b2b('0x36')][_0x1b2b('0x3b')]));_0x388fa6[_0x1b2b('0x39')]=_0x388fa6[_0x1b2b('0x39')][_0x1b2b('0x4a')]?_0x388fa6[_0x1b2b('0x39')]:_0x4921a7[_0x1b2b('0x35')];if(_0xa72896[_0x1b2b('0x36')][_0x1b2b('0x4b')]){_0x388fa6[_0x1b2b('0x45')]=[{'all':!![]}];}_0x388fa6=_[_0x1b2b('0x4c')]({},_0x388fa6,_0xa72896[_0x1b2b('0x44')]);return db[_0x1b2b('0x31')]['find'](_0x388fa6)[_0x1b2b('0x27')](handleEntityNotFound(_0x4ee4a0,null))[_0x1b2b('0x27')](respondWithResult(_0x4ee4a0,null))[_0x1b2b('0x47')](handleError(_0x4ee4a0,null));};exports[_0x1b2b('0x4d')]=function(_0x3080f0,_0x490890){return db[_0x1b2b('0x31')][_0x1b2b('0x4d')](_0x3080f0[_0x1b2b('0x4e')],{})[_0x1b2b('0x27')](function(_0x3b8ab4){var _0x127738=_0x3080f0[_0x1b2b('0x4f')][_0x1b2b('0x29')]({'plain':!![]});if(!_0x127738)throw new Error(_0x1b2b('0x50'));if(_0x127738['role']===_0x1b2b('0x4f')){var _0x269867=_0x3b8ab4['get']({'plain':!![]});var _0x1aa21d='CmHopperAdditionalPhones';return db[_0x1b2b('0x51')][_0x1b2b('0x52')]({'where':{'name':_0x1aa21d,'userProfileId':_0x127738[_0x1b2b('0x53')]},'raw':!![]})[_0x1b2b('0x27')](function(_0x3950b9){if(_0x3950b9&&_0x3950b9[_0x1b2b('0x54')]===0x0){return db[_0x1b2b('0x2b')]['create']({'name':_0x269867['name'],'resourceId':_0x269867['id'],'type':_0x3950b9['name'],'sectionId':_0x3950b9['id']},{})[_0x1b2b('0x27')](function(){return _0x3b8ab4;});}else{return _0x3b8ab4;}})[_0x1b2b('0x47')](function(_0x199347){logger[_0x1b2b('0x55')](_0x1b2b('0x56'),_0x199347);throw _0x199347;});}return _0x3b8ab4;})['then'](respondWithResult(_0x490890,0xc9))[_0x1b2b('0x47')](handleError(_0x490890,null));};exports['update']=function(_0x53f1f4,_0x9ae621){if(_0x53f1f4[_0x1b2b('0x4e')]['id']){delete _0x53f1f4[_0x1b2b('0x4e')]['id'];}return db[_0x1b2b('0x31')][_0x1b2b('0x52')]({'where':{'id':_0x53f1f4[_0x1b2b('0x49')]['id']}})[_0x1b2b('0x27')](handleEntityNotFound(_0x9ae621,null))['then'](saveUpdates(_0x53f1f4[_0x1b2b('0x4e')],null))[_0x1b2b('0x27')](respondWithResult(_0x9ae621,null))[_0x1b2b('0x47')](handleError(_0x9ae621,null));};exports[_0x1b2b('0x28')]=function(_0x326c85,_0xada66d){return db[_0x1b2b('0x31')]['find']({'where':{'id':_0x326c85[_0x1b2b('0x49')]['id']}})[_0x1b2b('0x27')](handleEntityNotFound(_0xada66d,null))['then'](removeEntity(_0xada66d,null))['catch'](handleError(_0xada66d,null));}; \ No newline at end of file +var _0x7e2f=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','moment'];(function(_0x1fab0a,_0x111c1b){var _0x4c20a0=function(_0x4d5e0b){while(--_0x4d5e0b){_0x1fab0a['push'](_0x1fab0a['shift']());}};_0x4c20a0(++_0x111c1b);}(_0x7e2f,0x101));var _0xf7e2=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0x7e2f[_0x1486e5];return _0x29d89b;};'use strict';var emlformat=require(_0xf7e2('0x0'));var rimraf=require(_0xf7e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7e2('0x2'));var rp=require('request-promise');var moment=require(_0xf7e2('0x3'));var BPromise=require(_0xf7e2('0x4'));var Mustache=require(_0xf7e2('0x5'));var util=require(_0xf7e2('0x6'));var path=require(_0xf7e2('0x7'));var sox=require(_0xf7e2('0x8'));var csv=require(_0xf7e2('0x9'));var ejs=require(_0xf7e2('0xa'));var fs=require('fs');var fs_extra=require(_0xf7e2('0xb'));var _=require('lodash');var squel=require(_0xf7e2('0xc'));var crypto=require('crypto');var jsforce=require(_0xf7e2('0xd'));var deskjs=require(_0xf7e2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf7e2('0xf'));var Papa=require('papaparse');var Redis=require(_0xf7e2('0x10'));var authService=require(_0xf7e2('0x11'));var qs=require(_0xf7e2('0x12'));var as=require(_0xf7e2('0x13'));var hardwareService=require(_0xf7e2('0x14'));var logger=require(_0xf7e2('0x15'))(_0xf7e2('0x16'));var utils=require(_0xf7e2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf7e2('0x18'));var db=require(_0xf7e2('0x19'))['db'];function respondWithStatusCode(_0x164d07,_0x17ef18){_0x17ef18=_0x17ef18||0xcc;return function(_0x4b168d){if(_0x4b168d){return _0x164d07[_0xf7e2('0x1a')](_0x17ef18);}return _0x164d07[_0xf7e2('0x1b')](_0x17ef18)['end']();};}function respondWithResult(_0x47974f,_0x1a5b76){_0x1a5b76=_0x1a5b76||0xc8;return function(_0x253d46){if(_0x253d46){return _0x47974f[_0xf7e2('0x1b')](_0x1a5b76)[_0xf7e2('0x1c')](_0x253d46);}};}function respondWithFilteredResult(_0x3a0b7d,_0x169161){return function(_0x3e5211){if(_0x3e5211){var _0x2c3853=typeof _0x169161[_0xf7e2('0x1d')]==='undefined'&&typeof _0x169161['limit']===_0xf7e2('0x1e');var _0x16d9d0=_0x3e5211[_0xf7e2('0x1f')];var _0x9048d3=_0x2c3853?0x0:_0x169161[_0xf7e2('0x1d')];var _0x1f3c28=_0x2c3853?_0x3e5211[_0xf7e2('0x1f')]:_0x169161[_0xf7e2('0x1d')]+_0x169161[_0xf7e2('0x20')];var _0x210f3c;if(_0x1f3c28>=_0x16d9d0){_0x1f3c28=_0x16d9d0;_0x210f3c=0xc8;}else{_0x210f3c=0xce;}_0x3a0b7d[_0xf7e2('0x1b')](_0x210f3c);return _0x3a0b7d[_0xf7e2('0x21')](_0xf7e2('0x22'),_0x9048d3+'-'+_0x1f3c28+'/'+_0x16d9d0)[_0xf7e2('0x1c')](_0x3e5211);}return null;};}function patchUpdates(_0xece596){return function(_0x20a93f){try{jsonpatch[_0xf7e2('0x23')](_0x20a93f,_0xece596,!![]);}catch(_0xc9f814){return BPromise[_0xf7e2('0x24')](_0xc9f814);}return _0x20a93f['save']();};}function saveUpdates(_0x48cb99,_0x29114c){return function(_0x32e73f){if(_0x32e73f){return _0x32e73f[_0xf7e2('0x25')](_0x48cb99)[_0xf7e2('0x26')](function(_0x123fc6){return _0x123fc6;});}return null;};}function removeEntity(_0x7e8339,_0x48b805){return function(_0x512ed4){if(_0x512ed4){return _0x512ed4[_0xf7e2('0x27')]()[_0xf7e2('0x26')](function(){var _0x429a68=_0x512ed4[_0xf7e2('0x28')]({'plain':!![]});var _0x487d5a='CmHopperAdditionalPhones';return db['UserProfileResource'][_0xf7e2('0x27')]({'where':{'type':_0x487d5a,'resourceId':_0x429a68['id']}})[_0xf7e2('0x26')](function(){return _0x512ed4;});})[_0xf7e2('0x26')](function(){_0x7e8339[_0xf7e2('0x1b')](0xcc)[_0xf7e2('0x29')]();});}};}function handleEntityNotFound(_0x5899bb,_0x54bb3c){return function(_0x4ef1c7){if(!_0x4ef1c7){_0x5899bb['sendStatus'](0x194);}return _0x4ef1c7;};}function handleError(_0x27d193,_0x2922f1){_0x2922f1=_0x2922f1||0x1f4;return function(_0x352997){logger[_0xf7e2('0x2a')](_0x352997[_0xf7e2('0x2b')]);if(_0x352997[_0xf7e2('0x2c')]){delete _0x352997['name'];}_0x27d193[_0xf7e2('0x1b')](_0x2922f1)[_0xf7e2('0x2d')](_0x352997);};}exports[_0xf7e2('0x2e')]=function(_0x3e5d14,_0x54bce6){var _0x2f471d={},_0x26b6c8={},_0x5dcc97={'count':0x0,'rows':[]};var _0x4b8b88=_[_0xf7e2('0x2f')](db[_0xf7e2('0x30')]['rawAttributes'],function(_0x9a1db1){return{'name':_0x9a1db1[_0xf7e2('0x31')],'type':_0x9a1db1[_0xf7e2('0x32')][_0xf7e2('0x33')]};});_0x26b6c8[_0xf7e2('0x34')]=_[_0xf7e2('0x2f')](_0x4b8b88,_0xf7e2('0x2c'));_0x26b6c8['query']=_[_0xf7e2('0x35')](_0x3e5d14[_0xf7e2('0x36')]);_0x26b6c8[_0xf7e2('0x37')]=_[_0xf7e2('0x38')](_0x26b6c8[_0xf7e2('0x34')],_0x26b6c8[_0xf7e2('0x36')]);_0x2f471d[_0xf7e2('0x39')]=_['intersection'](_0x26b6c8['model'],qs[_0xf7e2('0x3a')](_0x3e5d14[_0xf7e2('0x36')]['fields']));_0x2f471d[_0xf7e2('0x39')]=_0x2f471d[_0xf7e2('0x39')][_0xf7e2('0x3b')]?_0x2f471d['attributes']:_0x26b6c8['model'];if(!_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x3c')](_0xf7e2('0x3d'))){_0x2f471d[_0xf7e2('0x20')]=qs['limit'](_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x20')]);_0x2f471d['offset']=qs['offset'](_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x1d')]);}_0x2f471d[_0xf7e2('0x3e')]=qs[_0xf7e2('0x3f')](_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x3f')]);_0x2f471d[_0xf7e2('0x40')]=qs[_0xf7e2('0x37')](_['pick'](_0x3e5d14[_0xf7e2('0x36')],_0x26b6c8['filters']),_0x4b8b88);if(_0x3e5d14['query'][_0xf7e2('0x41')]){_0x2f471d['where']=_['merge'](_0x2f471d['where'],{'$or':_['map'](_0x4b8b88,function(_0x4ddfea){if(_0x4ddfea['type']!==_0xf7e2('0x42')){var _0x59dc2f={};_0x59dc2f[_0x4ddfea[_0xf7e2('0x2c')]]={'$like':'%'+_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x41')]+'%'};return _0x59dc2f;}})});}_0x2f471d=_['merge']({},_0x2f471d,_0x3e5d14[_0xf7e2('0x43')]);var _0x1179f7={'where':_0x2f471d['where']};return db[_0xf7e2('0x30')]['count'](_0x1179f7)[_0xf7e2('0x26')](function(_0x29b491){_0x5dcc97[_0xf7e2('0x1f')]=_0x29b491;if(_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x44')]){_0x2f471d[_0xf7e2('0x45')]=[{'all':!![]}];}return db[_0xf7e2('0x30')][_0xf7e2('0x46')](_0x2f471d);})[_0xf7e2('0x26')](function(_0x3979a2){_0x5dcc97[_0xf7e2('0x47')]=_0x3979a2;return _0x5dcc97;})[_0xf7e2('0x26')](respondWithFilteredResult(_0x54bce6,_0x2f471d))[_0xf7e2('0x48')](handleError(_0x54bce6,null));};exports['show']=function(_0x1cf358,_0x5dc3c2){var _0x31d0c7={'raw':!![],'where':{'id':_0x1cf358['params']['id']}},_0xb698c9={};_0xb698c9[_0xf7e2('0x34')]=_[_0xf7e2('0x35')](db[_0xf7e2('0x30')][_0xf7e2('0x49')]);_0xb698c9[_0xf7e2('0x36')]=_[_0xf7e2('0x35')](_0x1cf358[_0xf7e2('0x36')]);_0xb698c9[_0xf7e2('0x37')]=_[_0xf7e2('0x38')](_0xb698c9[_0xf7e2('0x34')],_0xb698c9[_0xf7e2('0x36')]);_0x31d0c7['attributes']=_['intersection'](_0xb698c9[_0xf7e2('0x34')],qs[_0xf7e2('0x3a')](_0x1cf358[_0xf7e2('0x36')][_0xf7e2('0x3a')]));_0x31d0c7['attributes']=_0x31d0c7[_0xf7e2('0x39')]['length']?_0x31d0c7[_0xf7e2('0x39')]:_0xb698c9['model'];if(_0x1cf358[_0xf7e2('0x36')]['includeAll']){_0x31d0c7[_0xf7e2('0x45')]=[{'all':!![]}];}_0x31d0c7=_['merge']({},_0x31d0c7,_0x1cf358[_0xf7e2('0x43')]);return db['CmHopperAdditionalPhone']['find'](_0x31d0c7)[_0xf7e2('0x26')](handleEntityNotFound(_0x5dc3c2,null))[_0xf7e2('0x26')](respondWithResult(_0x5dc3c2,null))[_0xf7e2('0x48')](handleError(_0x5dc3c2,null));};exports['create']=function(_0x3fd0b7,_0x4cc735){return db['CmHopperAdditionalPhone'][_0xf7e2('0x4a')](_0x3fd0b7['body'],{})['then'](function(_0x410aa5){var _0x115d98=_0x3fd0b7[_0xf7e2('0x4b')]['get']({'plain':!![]});if(!_0x115d98)throw new Error(_0xf7e2('0x4c'));if(_0x115d98[_0xf7e2('0x4d')]===_0xf7e2('0x4b')){var _0x5211cb=_0x410aa5[_0xf7e2('0x28')]({'plain':!![]});var _0x25d3e6=_0xf7e2('0x4e');return db[_0xf7e2('0x4f')][_0xf7e2('0x50')]({'where':{'name':_0x25d3e6,'userProfileId':_0x115d98[_0xf7e2('0x51')]},'raw':!![]})[_0xf7e2('0x26')](function(_0x3035b7){if(_0x3035b7&&_0x3035b7[_0xf7e2('0x52')]===0x0){return db[_0xf7e2('0x53')][_0xf7e2('0x4a')]({'name':_0x5211cb['name'],'resourceId':_0x5211cb['id'],'type':_0x3035b7[_0xf7e2('0x2c')],'sectionId':_0x3035b7['id']},{})[_0xf7e2('0x26')](function(){return _0x410aa5;});}else{return _0x410aa5;}})[_0xf7e2('0x48')](function(_0x493b92){logger[_0xf7e2('0x2a')](_0xf7e2('0x54'),_0x493b92);throw _0x493b92;});}return _0x410aa5;})['then'](respondWithResult(_0x4cc735,0xc9))['catch'](handleError(_0x4cc735,null));};exports[_0xf7e2('0x25')]=function(_0x50453e,_0x5d3b54){if(_0x50453e[_0xf7e2('0x55')]['id']){delete _0x50453e[_0xf7e2('0x55')]['id'];}return db[_0xf7e2('0x30')][_0xf7e2('0x50')]({'where':{'id':_0x50453e[_0xf7e2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d3b54,null))[_0xf7e2('0x26')](saveUpdates(_0x50453e[_0xf7e2('0x55')],null))[_0xf7e2('0x26')](respondWithResult(_0x5d3b54,null))[_0xf7e2('0x48')](handleError(_0x5d3b54,null));};exports[_0xf7e2('0x27')]=function(_0x1473e4,_0x2dc142){return db[_0xf7e2('0x30')]['find']({'where':{'id':_0x1473e4[_0xf7e2('0x56')]['id']}})[_0xf7e2('0x26')](handleEntityNotFound(_0x2dc142,null))[_0xf7e2('0x26')](removeEntity(_0x2dc142,null))[_0xf7e2('0x48')](handleError(_0x2dc142,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 0dbbc14..458fa9e 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 _0xdcd9=['../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','api','request-promise','path','rimraf'];(function(_0xa7f384,_0x574bcd){var _0x57527f=function(_0x5c36b7){while(--_0x5c36b7){_0xa7f384['push'](_0xa7f384['shift']());}};_0x57527f(++_0x574bcd);}(_0xdcd9,0xf5));var _0x9dcd=function(_0x56c30b,_0x45d2b8){_0x56c30b=_0x56c30b-0x0;var _0x45168e=_0xdcd9[_0x56c30b];return _0x45168e;};'use strict';var _=require('lodash');var util=require(_0x9dcd('0x0'));var logger=require('../../config/logger')(_0x9dcd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9dcd('0x2'));var fs=require('fs');var path=require(_0x9dcd('0x3'));var rimraf=require(_0x9dcd('0x4'));var config=require(_0x9dcd('0x5'));var attributes=require(_0x9dcd('0x6'));module['exports']=function(_0x5ae811,_0xd105d3){return _0x5ae811[_0x9dcd('0x7')](_0x9dcd('0x8'),attributes,{'tableName':_0x9dcd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecc1=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x27a143,_0x12269c){var _0x33b2a3=function(_0x3b98da){while(--_0x3b98da){_0x27a143['push'](_0x27a143['shift']());}};_0x33b2a3(++_0x12269c);}(_0xecc1,0x1e5));var _0x1ecc=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xecc1[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0x1ecc('0x0'));var util=require('util');var logger=require(_0x1ecc('0x1'))(_0x1ecc('0x2'));var moment=require(_0x1ecc('0x3'));var BPromise=require(_0x1ecc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ecc('0x5'));var rimraf=require('rimraf');var config=require(_0x1ecc('0x6'));var attributes=require(_0x1ecc('0x7'));module[_0x1ecc('0x8')]=function(_0x1b30bf,_0xe5136a){return _0x1b30bf[_0x1ecc('0x9')](_0x1ecc('0xa'),attributes,{'tableName':_0x1ecc('0xb'),'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 2945c44..cfa4c51 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 _0x4fe5=['SwapAdditionalPhones','OrderBy','duration','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry'];(function(_0x3e1fe8,_0x223c26){var _0x55d8e5=function(_0x15cd31){while(--_0x15cd31){_0x3e1fe8['push'](_0x3e1fe8['shift']());}};_0x55d8e5(++_0x223c26);}(_0x4fe5,0xbc));var _0x54fe=function(_0xcd9283,_0x35bd2e){_0xcd9283=_0xcd9283-0x0;var _0x1620e1=_0x4fe5[_0xcd9283];return _0x1620e1;};'use strict';var _=require(_0x54fe('0x0'));var util=require('util');var moment=require(_0x54fe('0x1'));var BPromise=require(_0x54fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54fe('0x3'));var db=require(_0x54fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54fe('0x5'));var config=require(_0x54fe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54fe('0x7')][_0x54fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf75a2f,_0x46e422,_0x4d9244){return new BPromise(function(_0x2035c5,_0x178fe6){return client['request'](_0xf75a2f,_0x4d9244)[_0x54fe('0x9')](function(_0x379adc){logger[_0x54fe('0xa')](_0x54fe('0xb'),_0x46e422,_0x54fe('0xc'));logger[_0x54fe('0xd')](_0x54fe('0xe'),_0x46e422,_0x54fe('0xc'),JSON[_0x54fe('0xf')](_0x379adc));if(_0x379adc[_0x54fe('0x10')]){if(_0x379adc[_0x54fe('0x10')][_0x54fe('0x11')]===0x1f4){logger['error'](_0x54fe('0xb'),_0x46e422,_0x379adc['error']['message']);return _0x178fe6(_0x379adc[_0x54fe('0x10')][_0x54fe('0x12')]);}logger['error'](_0x54fe('0xb'),_0x46e422,_0x379adc['error']['message']);return _0x2035c5(_0x379adc[_0x54fe('0x10')][_0x54fe('0x12')]);}else{logger[_0x54fe('0xa')](_0x54fe('0xb'),_0x46e422,_0x54fe('0xc'));_0x2035c5(_0x379adc['result'][_0x54fe('0x12')]);}})[_0x54fe('0x13')](function(_0x40f4ec){logger[_0x54fe('0x10')](_0x54fe('0xb'),_0x46e422,_0x40f4ec);_0x178fe6(_0x40f4ec);});});}exports[_0x54fe('0x14')]=function(_0x56c673){var _0x32bd82=this;return new Promise(function(_0x825901,_0x4cb0d7){return db[_0x54fe('0x15')][_0x54fe('0x16')]({'raw':!![],'where':{'ContactId':_0x56c673['body'][_0x54fe('0x17')],'ListId':_0x56c673[_0x54fe('0x18')][_0x54fe('0x19')],'VoiceQueueId':_0x56c673[_0x54fe('0x18')][_0x54fe('0x1a')]===undefined?null:_0x56c673[_0x54fe('0x18')][_0x54fe('0x1a')],'CampaignId':_0x56c673[_0x54fe('0x18')][_0x54fe('0x1b')]===undefined?null:_0x56c673['body'][_0x54fe('0x1b')]}})[_0x54fe('0x9')](function(_0x56df8e){if(_0x56df8e!=null){return db[_0x54fe('0x1c')][_0x54fe('0x16')]({'raw':!![],'where':{'CmHopperId':_0x56df8e['id'],'OrderBy':{'$gt':_0x56df8e['OrderBy']}},'order':[['OrderBy',_0x54fe('0x1d')]]})[_0x54fe('0x9')](function(_0x597323){var _0x1577ad=0x0;if(_0x597323){if(_0x597323[_0x54fe('0x1e')]+_0x597323[_0x54fe('0x1f')]+_0x597323[_0x54fe('0x20')]+_0x597323['countnosuchnumberretry']+_0x597323[_0x54fe('0x21')]+_0x597323[_0x54fe('0x22')]+_0x597323[_0x54fe('0x23')]+_0x597323[_0x54fe('0x24')]<_0x56c673[_0x54fe('0x25')][_0x54fe('0x26')])_0x1577ad=0x1;_0x825901({'additional':_0x1577ad});}else{return db[_0x54fe('0x1c')][_0x54fe('0x16')]({'raw':!![],'where':{'CmHopperId':_0x56df8e['id']},'order':[['OrderBy','ASC']]})[_0x54fe('0x9')](function(_0x371202){var _0x4734c0=0x0;if(_0x371202){if(_0x371202[_0x54fe('0x1e')]+_0x371202[_0x54fe('0x1f')]+_0x371202[_0x54fe('0x20')]+_0x371202[_0x54fe('0x27')]+_0x371202[_0x54fe('0x21')]+_0x371202[_0x54fe('0x22')]+_0x371202[_0x54fe('0x23')]+_0x371202['countagentrejectretry']<_0x56c673[_0x54fe('0x25')][_0x54fe('0x26')])_0x4734c0=0x1;_0x825901({'additional':_0x4734c0});}else{_0x825901({'additional':0x0});}})['catch'](function(_0xbd591c){logger[_0x54fe('0x10')](_0x54fe('0x14'),_0xbd591c[_0x54fe('0x12')]);_0x4cb0d7(_0x32bd82[_0x54fe('0x10')](0x1f4,_0xbd591c[_0x54fe('0x12')]));});}})[_0x54fe('0x13')](function(_0x510af3){logger[_0x54fe('0x10')](_0x54fe('0x14'),_0x510af3[_0x54fe('0x12')]);_0x4cb0d7(_0x32bd82['error'](0x1f4,_0x510af3[_0x54fe('0x12')]));});}else _0x825901({'additional':0x0});});});};exports[_0x54fe('0x28')]=function(_0x38744f){var _0xd7a8e=this;return new Promise(function(_0xae21b5,_0x4e10ba){return db[_0x54fe('0x15')][_0x54fe('0x16')]({'raw':!![],'where':{'ContactId':_0x38744f[_0x54fe('0x18')][_0x54fe('0x17')],'ListId':_0x38744f[_0x54fe('0x18')][_0x54fe('0x19')],'VoiceQueueId':_0x38744f[_0x54fe('0x18')][_0x54fe('0x1a')]===undefined?null:_0x38744f['body'][_0x54fe('0x1a')],'CampaignId':_0x38744f[_0x54fe('0x18')]['CampaignId']===undefined?null:_0x38744f[_0x54fe('0x18')]['CampaignId']}})['then'](function(_0xee789a){if(_0xee789a!=null){return db[_0x54fe('0x1c')][_0x54fe('0x16')]({'raw':!![],'where':{'CmHopperId':_0xee789a['id'],'OrderBy':{'$gte':_0xee789a[_0x54fe('0x29')]}},'order':[[_0x54fe('0x29'),_0x54fe('0x1d')]]})[_0x54fe('0x9')](function(_0x1640fc){if(_0x1640fc)return activateAdditionalPhone(_0xee789a,_0x38744f[_0x54fe('0x18')],_0x1640fc,_0x38744f[_0x54fe('0x2a')],_0x38744f[_0x54fe('0x2b')])[_0x54fe('0x9')](function(_0x4fd5fa){_0xae21b5(_0x4fd5fa);});else{return db[_0x54fe('0x1c')][_0x54fe('0x16')]({'raw':!![],'where':{'CmHopperId':_0xee789a['id']},'order':[['OrderBy','ASC']]})[_0x54fe('0x9')](function(_0x50aee3){if(_0x50aee3)return activateAdditionalPhone(_0xee789a,_0x38744f['body'],_0x50aee3,_0x38744f[_0x54fe('0x2a')],_0x38744f['waitTime'])['then'](function(_0x144a07){_0xae21b5(_0x144a07);});else{_0xae21b5({'id':_0xee789a['id'],'phone':''});}})['catch'](function(_0x58fecb){logger[_0x54fe('0x10')]('VerifyAdditionalPhones',_0x58fecb[_0x54fe('0x12')]);_0x4e10ba(_0xd7a8e[_0x54fe('0x10')](0x1f4,_0x58fecb['message']));});}})['catch'](function(_0xdace65){logger[_0x54fe('0x10')](_0x54fe('0x14'),_0xdace65['message']);_0x4e10ba(_0xd7a8e['error'](0x1f4,_0xdace65['message']));});}else _0xae21b5(0x1);});});};function activateAdditionalPhone(_0x109b68,_0x1cb568,_0x2b0163,_0x33d77d,_0x4c1666){return new Promise(function(_0x2de1c1,_0x4b1ed8){var _0xab66b6;if(_[_0x54fe('0x2c')](_0x2b0163[_0x54fe('0x2d')])){_0x2b0163[_0x54fe('0x2d')]=moment();}if(moment()>moment(_0x2b0163[_0x54fe('0x2d')])){_0xab66b6=moment()['add'](_0x4c1666||0x3,_0x54fe('0x2e'));}else{if(_0x2b0163[_0x54fe('0x29')]==0x0){_0xab66b6=moment(_0x2b0163[_0x54fe('0x2d')]);}else{_0xab66b6=moment()['add'](_0x4c1666||0x3,_0x54fe('0x2e'));}}if(_[_0x54fe('0x2c')](_0xab66b6)){_0xab66b6=moment()[_0x54fe('0x2f')](_0x4c1666||0x3,_0x54fe('0x2e'));}var _0x9b66c2={'phone':_0x109b68[_0x54fe('0x30')],'active':0x0,'OrderBy':_[_0x54fe('0x2c')](_0x109b68[_0x54fe('0x29')])?0x0:_0x109b68[_0x54fe('0x29')],'scheduledat':moment()['add'](_0x33d77d||0x1,_0x54fe('0x2e')),'countbusyretry':_0x1cb568[_0x54fe('0x1e')],'countcongestionretry':_0x1cb568[_0x54fe('0x1f')],'countnoanswerretry':_0x1cb568[_0x54fe('0x20')],'countnosuchnumberretry':_0x1cb568[_0x54fe('0x27')],'countdropretry':_0x1cb568[_0x54fe('0x21')],'countabandonedretry':_0x1cb568['countabandonedretry'],'countmachineretry':_0x1cb568['countmachineretry'],'countagentrejectretry':_0x1cb568['countagentrejectretry'],'createdAt':_0x1cb568[_0x54fe('0x31')],'updatedAt':_0x1cb568['updatedAt']};var _0x197306={'CmHopperId':_0x109b68['id'],'phone':_0x2b0163['phone'],'active':0x0,'OrderBy':_[_0x54fe('0x2c')](_0x2b0163[_0x54fe('0x29')])?0x0:_0x2b0163[_0x54fe('0x29')],'scheduledat':_0xab66b6,'countbusyretry':_0x2b0163[_0x54fe('0x1e')],'countcongestionretry':_0x2b0163[_0x54fe('0x1f')],'countnoanswerretry':_0x2b0163['countnoanswerretry'],'countnosuchnumberretry':_0x2b0163[_0x54fe('0x27')],'countdropretry':_0x2b0163[_0x54fe('0x21')],'countabandonedretry':_0x2b0163[_0x54fe('0x22')],'countmachineretry':_0x2b0163[_0x54fe('0x23')],'countagentrejectretry':_0x2b0163['countagentrejectretry'],'createdAt':_0x2b0163['createdAt'],'updatedAt':_0x2b0163[_0x54fe('0x32')]};return db[_0x54fe('0x33')][_0x54fe('0x34')](function(_0x1ca6f9){return db[_0x54fe('0x1c')]['update'](_0x9b66c2,{'where':{'id':_0x2b0163['id']}},{'transaction':_0x1ca6f9})[_0x54fe('0x9')](function(){return db['CmHopper'][_0x54fe('0x35')](_0x197306,{'where':{'id':_0x109b68['id']}},{'transaction':_0x1ca6f9});});})[_0x54fe('0x9')](function(_0x3386f4){_0x2de1c1({'id':_0x109b68['id'],'phone':_0x2b0163[_0x54fe('0x30')]});})['catch'](function(_0x8e8277){logger['error'](_0x54fe('0x36'),_0x8e8277[_0x54fe('0x12')]);_0x4b1ed8({'error':_0x8e8277['message']});});});}exports[_0x54fe('0x37')]=function(_0x95d57b){var _0x784e7=this;return new Promise(function(_0x42e008,_0x2eba52){return db[_0x54fe('0x15')][_0x54fe('0x35')](_0x95d57b[_0x54fe('0x18')][_0x54fe('0x38')],{'where':{'id':_0x95d57b[_0x54fe('0x18')]['id']}})[_0x54fe('0x9')](function(_0x29512f){_0x42e008(_0x29512f);})[_0x54fe('0x13')](function(_0xebe5ba){logger[_0x54fe('0x10')]('IncrementPreviewCounters',_0xebe5ba[_0x54fe('0x12')]);_0x2eba52(_0x784e7['error'](0x1f4,_0xebe5ba[_0x54fe('0x12')]));});});}; \ No newline at end of file +var _0xf8d0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','result','CmHopperAdditionalPhone,\x20%s,\x20%s','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','catch','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','countagentrejectretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring'];(function(_0x4c4ca2,_0x30d812){var _0x17dac3=function(_0x4f07e6){while(--_0x4f07e6){_0x4c4ca2['push'](_0x4c4ca2['shift']());}};_0x17dac3(++_0x30d812);}(_0xf8d0,0x199));var _0x0f8d=function(_0x5c8147,_0x3192ce){_0x5c8147=_0x5c8147-0x0;var _0x147d1d=_0xf8d0[_0x5c8147];return _0x147d1d;};'use strict';var _=require(_0x0f8d('0x0'));var util=require(_0x0f8d('0x1'));var moment=require('moment');var BPromise=require(_0x0f8d('0x2'));var rs=require(_0x0f8d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f8d('0x4'))['db'];var utils=require(_0x0f8d('0x5'));var logger=require(_0x0f8d('0x6'))(_0x0f8d('0x7'));var config=require(_0x0f8d('0x8'));var jayson=require(_0x0f8d('0x9'));var client=jayson[_0x0f8d('0xa')][_0x0f8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fa813,_0x1822e6,_0x579177){return new BPromise(function(_0x4bcae1,_0x259d64){return client['request'](_0x1fa813,_0x579177)[_0x0f8d('0xc')](function(_0x53c119){logger[_0x0f8d('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1822e6,_0x0f8d('0xe'));logger[_0x0f8d('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1822e6,'request\x20sent',JSON[_0x0f8d('0x10')](_0x53c119));if(_0x53c119[_0x0f8d('0x11')]){if(_0x53c119[_0x0f8d('0x11')][_0x0f8d('0x12')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1822e6,_0x53c119['error'][_0x0f8d('0x13')]);return _0x259d64(_0x53c119[_0x0f8d('0x11')][_0x0f8d('0x13')]);}logger[_0x0f8d('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1822e6,_0x53c119[_0x0f8d('0x11')][_0x0f8d('0x13')]);return _0x4bcae1(_0x53c119[_0x0f8d('0x11')][_0x0f8d('0x13')]);}else{logger[_0x0f8d('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1822e6,'request\x20sent');_0x4bcae1(_0x53c119[_0x0f8d('0x14')][_0x0f8d('0x13')]);}})['catch'](function(_0x9a42dc){logger[_0x0f8d('0x11')](_0x0f8d('0x15'),_0x1822e6,_0x9a42dc);_0x259d64(_0x9a42dc);});});}exports[_0x0f8d('0x16')]=function(_0x5136b5){var _0x252b12=this;return new Promise(function(_0x1b759d,_0x306bcd){return db[_0x0f8d('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x5136b5['body'][_0x0f8d('0x18')],'ListId':_0x5136b5[_0x0f8d('0x19')][_0x0f8d('0x1a')],'VoiceQueueId':_0x5136b5['body'][_0x0f8d('0x1b')]===undefined?null:_0x5136b5[_0x0f8d('0x19')][_0x0f8d('0x1b')],'CampaignId':_0x5136b5[_0x0f8d('0x19')][_0x0f8d('0x1c')]===undefined?null:_0x5136b5[_0x0f8d('0x19')][_0x0f8d('0x1c')]}})['then'](function(_0x5b0a83){if(_0x5b0a83!=null){return db['CmHopperAdditionalPhone'][_0x0f8d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x5b0a83['id'],'OrderBy':{'$gt':_0x5b0a83[_0x0f8d('0x1e')]}},'order':[[_0x0f8d('0x1e'),_0x0f8d('0x1f')]]})['then'](function(_0x59e711){var _0x18258e=0x0;if(_0x59e711){if(_0x59e711[_0x0f8d('0x20')]+_0x59e711[_0x0f8d('0x21')]+_0x59e711[_0x0f8d('0x22')]+_0x59e711[_0x0f8d('0x23')]+_0x59e711[_0x0f8d('0x24')]+_0x59e711[_0x0f8d('0x25')]+_0x59e711[_0x0f8d('0x26')]+_0x59e711['countagentrejectretry']<_0x5136b5[_0x0f8d('0x27')][_0x0f8d('0x28')])_0x18258e=0x1;_0x1b759d({'additional':_0x18258e});}else{return db[_0x0f8d('0x29')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5b0a83['id']},'order':[['OrderBy','ASC']]})[_0x0f8d('0xc')](function(_0x31d7c7){var _0x2060fc=0x0;if(_0x31d7c7){if(_0x31d7c7[_0x0f8d('0x20')]+_0x31d7c7[_0x0f8d('0x21')]+_0x31d7c7[_0x0f8d('0x22')]+_0x31d7c7[_0x0f8d('0x23')]+_0x31d7c7[_0x0f8d('0x24')]+_0x31d7c7['countabandonedretry']+_0x31d7c7['countmachineretry']+_0x31d7c7['countagentrejectretry']<_0x5136b5[_0x0f8d('0x27')][_0x0f8d('0x28')])_0x2060fc=0x1;_0x1b759d({'additional':_0x2060fc});}else{_0x1b759d({'additional':0x0});}})[_0x0f8d('0x2a')](function(_0x33d2cc){logger[_0x0f8d('0x11')]('VerifyAdditionalPhones',_0x33d2cc['message']);_0x306bcd(_0x252b12['error'](0x1f4,_0x33d2cc[_0x0f8d('0x13')]));});}})['catch'](function(_0x3ea121){logger[_0x0f8d('0x11')](_0x0f8d('0x16'),_0x3ea121[_0x0f8d('0x13')]);_0x306bcd(_0x252b12[_0x0f8d('0x11')](0x1f4,_0x3ea121[_0x0f8d('0x13')]));});}else _0x1b759d({'additional':0x0});});});};exports[_0x0f8d('0x2b')]=function(_0x54cc04){var _0x53dfc6=this;return new Promise(function(_0x5003c3,_0x135163){return db[_0x0f8d('0x17')][_0x0f8d('0x1d')]({'raw':!![],'where':{'ContactId':_0x54cc04['body'][_0x0f8d('0x18')],'ListId':_0x54cc04[_0x0f8d('0x19')][_0x0f8d('0x1a')],'VoiceQueueId':_0x54cc04[_0x0f8d('0x19')][_0x0f8d('0x1b')]===undefined?null:_0x54cc04[_0x0f8d('0x19')][_0x0f8d('0x1b')],'CampaignId':_0x54cc04['body'][_0x0f8d('0x1c')]===undefined?null:_0x54cc04[_0x0f8d('0x19')][_0x0f8d('0x1c')]}})[_0x0f8d('0xc')](function(_0x3a8039){if(_0x3a8039!=null){return db[_0x0f8d('0x29')][_0x0f8d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x3a8039['id'],'OrderBy':{'$gte':_0x3a8039[_0x0f8d('0x1e')]}},'order':[[_0x0f8d('0x1e'),'ASC']]})[_0x0f8d('0xc')](function(_0x91b029){if(_0x91b029)return activateAdditionalPhone(_0x3a8039,_0x54cc04[_0x0f8d('0x19')],_0x91b029,_0x54cc04[_0x0f8d('0x2c')],_0x54cc04[_0x0f8d('0x2d')])[_0x0f8d('0xc')](function(_0x4af1c4){_0x5003c3(_0x4af1c4);});else{return db[_0x0f8d('0x29')][_0x0f8d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x3a8039['id']},'order':[[_0x0f8d('0x1e'),_0x0f8d('0x1f')]]})[_0x0f8d('0xc')](function(_0x7462b0){if(_0x7462b0)return activateAdditionalPhone(_0x3a8039,_0x54cc04['body'],_0x7462b0,_0x54cc04[_0x0f8d('0x2c')],_0x54cc04[_0x0f8d('0x2d')])[_0x0f8d('0xc')](function(_0x5d7a85){_0x5003c3(_0x5d7a85);});else{_0x5003c3({'id':_0x3a8039['id'],'phone':''});}})[_0x0f8d('0x2a')](function(_0x193f85){logger[_0x0f8d('0x11')](_0x0f8d('0x16'),_0x193f85['message']);_0x135163(_0x53dfc6['error'](0x1f4,_0x193f85[_0x0f8d('0x13')]));});}})[_0x0f8d('0x2a')](function(_0x1e1f96){logger[_0x0f8d('0x11')]('VerifyAdditionalPhones',_0x1e1f96[_0x0f8d('0x13')]);_0x135163(_0x53dfc6[_0x0f8d('0x11')](0x1f4,_0x1e1f96[_0x0f8d('0x13')]));});}else _0x5003c3(0x1);});});};function activateAdditionalPhone(_0x2ff7bf,_0x26a13e,_0x563be2,_0x3ffea0,_0x136da1){return new Promise(function(_0x5cf2c9,_0xa89ebe){var _0x48e44c;if(_['isNil'](_0x563be2[_0x0f8d('0x2e')])){_0x563be2[_0x0f8d('0x2e')]=moment();}if(moment()>moment(_0x563be2[_0x0f8d('0x2e')])){_0x48e44c=moment()['add'](_0x136da1||0x3,'minutes');}else{if(_0x563be2[_0x0f8d('0x1e')]==0x0){_0x48e44c=moment(_0x563be2[_0x0f8d('0x2e')]);}else{_0x48e44c=moment()[_0x0f8d('0x2f')](_0x136da1||0x3,_0x0f8d('0x30'));}}if(_[_0x0f8d('0x31')](_0x48e44c)){_0x48e44c=moment()['add'](_0x136da1||0x3,_0x0f8d('0x30'));}var _0x4d980f={'phone':_0x2ff7bf[_0x0f8d('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x2ff7bf[_0x0f8d('0x1e')])?0x0:_0x2ff7bf[_0x0f8d('0x1e')],'scheduledat':moment()[_0x0f8d('0x2f')](_0x3ffea0||0x1,_0x0f8d('0x30')),'countbusyretry':_0x26a13e['countbusyretry'],'countcongestionretry':_0x26a13e[_0x0f8d('0x21')],'countnoanswerretry':_0x26a13e[_0x0f8d('0x22')],'countnosuchnumberretry':_0x26a13e[_0x0f8d('0x23')],'countdropretry':_0x26a13e['countdropretry'],'countabandonedretry':_0x26a13e[_0x0f8d('0x25')],'countmachineretry':_0x26a13e['countmachineretry'],'countagentrejectretry':_0x26a13e[_0x0f8d('0x33')],'createdAt':_0x26a13e[_0x0f8d('0x34')],'updatedAt':_0x26a13e[_0x0f8d('0x35')]};var _0x1497c3={'CmHopperId':_0x2ff7bf['id'],'phone':_0x563be2[_0x0f8d('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x563be2[_0x0f8d('0x1e')])?0x0:_0x563be2[_0x0f8d('0x1e')],'scheduledat':_0x48e44c,'countbusyretry':_0x563be2[_0x0f8d('0x20')],'countcongestionretry':_0x563be2[_0x0f8d('0x21')],'countnoanswerretry':_0x563be2[_0x0f8d('0x22')],'countnosuchnumberretry':_0x563be2['countnosuchnumberretry'],'countdropretry':_0x563be2[_0x0f8d('0x24')],'countabandonedretry':_0x563be2[_0x0f8d('0x25')],'countmachineretry':_0x563be2[_0x0f8d('0x26')],'countagentrejectretry':_0x563be2[_0x0f8d('0x33')],'createdAt':_0x563be2['createdAt'],'updatedAt':_0x563be2[_0x0f8d('0x35')]};return db[_0x0f8d('0x36')]['transaction'](function(_0x5e8dfa){return db['CmHopperAdditionalPhone'][_0x0f8d('0x37')](_0x4d980f,{'where':{'id':_0x563be2['id']}},{'transaction':_0x5e8dfa})[_0x0f8d('0xc')](function(){return db[_0x0f8d('0x17')][_0x0f8d('0x37')](_0x1497c3,{'where':{'id':_0x2ff7bf['id']}},{'transaction':_0x5e8dfa});});})[_0x0f8d('0xc')](function(_0x342930){_0x5cf2c9({'id':_0x2ff7bf['id'],'phone':_0x563be2[_0x0f8d('0x32')]});})[_0x0f8d('0x2a')](function(_0x3b813d){logger[_0x0f8d('0x11')](_0x0f8d('0x38'),_0x3b813d[_0x0f8d('0x13')]);_0xa89ebe({'error':_0x3b813d[_0x0f8d('0x13')]});});});}exports[_0x0f8d('0x39')]=function(_0x5483be){var _0x218d9b=this;return new Promise(function(_0xd16a46,_0x593958){return db[_0x0f8d('0x17')][_0x0f8d('0x37')](_0x5483be[_0x0f8d('0x19')][_0x0f8d('0x3a')],{'where':{'id':_0x5483be[_0x0f8d('0x19')]['id']}})[_0x0f8d('0xc')](function(_0x163795){_0xd16a46(_0x163795);})[_0x0f8d('0x2a')](function(_0x49c0b6){logger[_0x0f8d('0x11')](_0x0f8d('0x39'),_0x49c0b6[_0x0f8d('0x13')]);_0x593958(_0x218d9b[_0x0f8d('0x11')](0x1f4,_0x49c0b6[_0x0f8d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 754efe1..b89af4e 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 _0x6208=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','post','put','update','delete'];(function(_0x3086d4,_0x2a53e6){var _0x814ec3=function(_0x261344){while(--_0x261344){_0x3086d4['push'](_0x3086d4['shift']());}};_0x814ec3(++_0x2a53e6);}(_0x6208,0x192));var _0x8620=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0x6208[_0x5f746f];return _0x198d15;};'use strict';var multer=require('multer');var util=require(_0x8620('0x0'));var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require(_0x8620('0x3'));var router=express[_0x8620('0x4')]();var fs_extra=require(_0x8620('0x5'));var auth=require(_0x8620('0x6'));var interaction=require(_0x8620('0x7'));var config=require(_0x8620('0x8'));var controller=require(_0x8620('0x9'));router['get']('/',auth[_0x8620('0xa')](),controller[_0x8620('0xb')]);router[_0x8620('0xc')](_0x8620('0xd'),auth[_0x8620('0xa')](),controller['show']);router[_0x8620('0xe')]('/',auth[_0x8620('0xa')](),controller['create']);router[_0x8620('0xf')](_0x8620('0xd'),auth['isAuthenticated'](),controller[_0x8620('0x10')]);router[_0x8620('0x11')]('/:id',auth[_0x8620('0xa')](),controller[_0x8620('0x12')]);module[_0x8620('0x13')]=router; \ No newline at end of file +var _0xe5db=['/:id','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','post','create'];(function(_0x75c3eb,_0x271b5a){var _0x6e6585=function(_0x3d48f5){while(--_0x3d48f5){_0x75c3eb['push'](_0x75c3eb['shift']());}};_0x6e6585(++_0x271b5a);}(_0xe5db,0x1f3));var _0xbe5d=function(_0x325b45,_0x4352c0){_0x325b45=_0x325b45-0x0;var _0x138f33=_0xe5db[_0x325b45];return _0x138f33;};'use strict';var multer=require('multer');var util=require(_0xbe5d('0x0'));var path=require('path');var timeout=require(_0xbe5d('0x1'));var express=require(_0xbe5d('0x2'));var router=express[_0xbe5d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe5d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbe5d('0x5'));var controller=require(_0xbe5d('0x6'));router[_0xbe5d('0x7')]('/',auth[_0xbe5d('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbe5d('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe5d('0xa')]);router['put'](_0xbe5d('0xb'),auth[_0xbe5d('0x8')](),controller[_0xbe5d('0xc')]);router[_0xbe5d('0xd')](_0xbe5d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe5d('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c171bb9..ed34c7d 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 _0xf228=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x446328,_0x33dbd2){var _0x4e3edb=function(_0x27e720){while(--_0x27e720){_0x446328['push'](_0x446328['shift']());}};_0x4e3edb(++_0x33dbd2);}(_0xf228,0x1a9));var _0x8f22=function(_0x5abd9b,_0x51e58b){_0x5abd9b=_0x5abd9b-0x0;var _0x10ebc7=_0xf228[_0x5abd9b];return _0x10ebc7;};'use strict';var moment=require(_0x8f22('0x0'));var Sequelize=require(_0x8f22('0x1'));module['exports']={'phone':{'type':Sequelize[_0x8f22('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8f22('0x3')],'unique':_0x8f22('0x4')},'ListId':{'type':Sequelize[_0x8f22('0x3')],'unique':_0x8f22('0x4')},'VoiceQueueId':{'type':Sequelize[_0x8f22('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x236e=['exports','STRING','contactListQueue','INTEGER','moment','sequelize'];(function(_0x2c60ab,_0xd9feb5){var _0x1aa197=function(_0x34d3ca){while(--_0x34d3ca){_0x2c60ab['push'](_0x2c60ab['shift']());}};_0x1aa197(++_0xd9feb5);}(_0x236e,0x148));var _0xe236=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x236e[_0x34bc30];return _0x5706de;};'use strict';var moment=require(_0xe236('0x0'));var Sequelize=require(_0xe236('0x1'));module[_0xe236('0x2')]={'phone':{'type':Sequelize[_0xe236('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xe236('0x4')},'ListId':{'type':Sequelize[_0xe236('0x5')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xe236('0x5')],'unique':_0xe236('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8d18fb3..0c8470c 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 _0xcedb=['send','map','CmHopperBlack','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','intersection','include','options','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0xcedb,0xc0));var _0xbced=function(_0x5b36d9,_0x15f4c6){_0x5b36d9=_0x5b36d9-0x0;var _0x9d5a55=_0xcedb[_0x5b36d9];return _0x9d5a55;};'use strict';var emlformat=require(_0xbced('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbced('0x1'));var jsonpatch=require(_0xbced('0x2'));var rp=require(_0xbced('0x3'));var moment=require(_0xbced('0x4'));var BPromise=require(_0xbced('0x5'));var Mustache=require(_0xbced('0x6'));var util=require(_0xbced('0x7'));var path=require(_0xbced('0x8'));var sox=require(_0xbced('0x9'));var csv=require(_0xbced('0xa'));var ejs=require(_0xbced('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbced('0xc'));var squel=require(_0xbced('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbced('0xe'));var toCsv=require(_0xbced('0xa'));var querystring=require(_0xbced('0xf'));var Papa=require(_0xbced('0x10'));var Redis=require(_0xbced('0x11'));var authService=require(_0xbced('0x12'));var qs=require(_0xbced('0x13'));var as=require(_0xbced('0x14'));var hardwareService=require(_0xbced('0x15'));var logger=require(_0xbced('0x16'))(_0xbced('0x17'));var utils=require(_0xbced('0x18'));var config=require(_0xbced('0x19'));var licenseUtil=require(_0xbced('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5356a6,_0x4ae519){_0x4ae519=_0x4ae519||0xcc;return function(_0x464192){if(_0x464192){return _0x5356a6[_0xbced('0x1b')](_0x4ae519);}return _0x5356a6[_0xbced('0x1c')](_0x4ae519)[_0xbced('0x1d')]();};}function respondWithResult(_0xb3b32b,_0xae3ca4){_0xae3ca4=_0xae3ca4||0xc8;return function(_0x32949f){if(_0x32949f){return _0xb3b32b[_0xbced('0x1c')](_0xae3ca4)[_0xbced('0x1e')](_0x32949f);}};}function respondWithFilteredResult(_0x191ff3,_0x1da994){return function(_0x50fe8b){if(_0x50fe8b){var _0x2af9a9=typeof _0x1da994[_0xbced('0x1f')]===_0xbced('0x20')&&typeof _0x1da994[_0xbced('0x21')]===_0xbced('0x20');var _0x4991dc=_0x50fe8b[_0xbced('0x22')];var _0x9d59e4=_0x2af9a9?0x0:_0x1da994[_0xbced('0x1f')];var _0x3b2e1a=_0x2af9a9?_0x50fe8b[_0xbced('0x22')]:_0x1da994['offset']+_0x1da994[_0xbced('0x21')];var _0x49dc50;if(_0x3b2e1a>=_0x4991dc){_0x3b2e1a=_0x4991dc;_0x49dc50=0xc8;}else{_0x49dc50=0xce;}_0x191ff3[_0xbced('0x1c')](_0x49dc50);return _0x191ff3[_0xbced('0x23')](_0xbced('0x24'),_0x9d59e4+'-'+_0x3b2e1a+'/'+_0x4991dc)['json'](_0x50fe8b);}return null;};}function patchUpdates(_0xc68376){return function(_0x26e4b5){try{jsonpatch[_0xbced('0x25')](_0x26e4b5,_0xc68376,!![]);}catch(_0x1a22fb){return BPromise['reject'](_0x1a22fb);}return _0x26e4b5[_0xbced('0x26')]();};}function saveUpdates(_0x8a1df0,_0x184b92){return function(_0xb5f8d){if(_0xb5f8d){return _0xb5f8d[_0xbced('0x27')](_0x8a1df0)['then'](function(_0x66bd43){return _0x66bd43;});}return null;};}function removeEntity(_0x160126,_0x50770c){return function(_0x1b1c01){if(_0x1b1c01){return _0x1b1c01[_0xbced('0x28')]()[_0xbced('0x29')](function(){_0x160126[_0xbced('0x1c')](0xcc)[_0xbced('0x1d')]();});}};}function handleEntityNotFound(_0x1000a2,_0x2127e5){return function(_0x1524e9){if(!_0x1524e9){_0x1000a2[_0xbced('0x1b')](0x194);}return _0x1524e9;};}function handleError(_0x322535,_0x5e614c){_0x5e614c=_0x5e614c||0x1f4;return function(_0x1fedfb){logger[_0xbced('0x2a')](_0x1fedfb[_0xbced('0x2b')]);if(_0x1fedfb[_0xbced('0x2c')]){delete _0x1fedfb[_0xbced('0x2c')];}_0x322535[_0xbced('0x1c')](_0x5e614c)[_0xbced('0x2d')](_0x1fedfb);};}exports['index']=function(_0x2329fd,_0xde31cd){var _0x4328d5={},_0x278f68={},_0x2b9a57={'count':0x0,'rows':[]};var _0x235a17=_[_0xbced('0x2e')](db[_0xbced('0x2f')][_0xbced('0x30')],function(_0x15d2b7){return{'name':_0x15d2b7[_0xbced('0x31')],'type':_0x15d2b7[_0xbced('0x32')][_0xbced('0x33')]};});_0x278f68['model']=_[_0xbced('0x2e')](_0x235a17,_0xbced('0x2c'));_0x278f68['query']=_[_0xbced('0x34')](_0x2329fd[_0xbced('0x35')]);_0x278f68[_0xbced('0x36')]=_['intersection'](_0x278f68[_0xbced('0x37')],_0x278f68['query']);_0x4328d5[_0xbced('0x38')]=_['intersection'](_0x278f68[_0xbced('0x37')],qs[_0xbced('0x39')](_0x2329fd[_0xbced('0x35')][_0xbced('0x39')]));_0x4328d5[_0xbced('0x38')]=_0x4328d5[_0xbced('0x38')][_0xbced('0x3a')]?_0x4328d5[_0xbced('0x38')]:_0x278f68[_0xbced('0x37')];if(!_0x2329fd[_0xbced('0x35')][_0xbced('0x3b')](_0xbced('0x3c'))){_0x4328d5[_0xbced('0x21')]=qs[_0xbced('0x21')](_0x2329fd['query'][_0xbced('0x21')]);_0x4328d5['offset']=qs[_0xbced('0x1f')](_0x2329fd['query']['offset']);}_0x4328d5[_0xbced('0x3d')]=qs[_0xbced('0x3e')](_0x2329fd[_0xbced('0x35')][_0xbced('0x3e')]);_0x4328d5['where']=qs[_0xbced('0x36')](_[_0xbced('0x3f')](_0x2329fd[_0xbced('0x35')],_0x278f68[_0xbced('0x36')]),_0x235a17);if(_0x2329fd[_0xbced('0x35')][_0xbced('0x40')]){_0x4328d5[_0xbced('0x41')]=_[_0xbced('0x42')](_0x4328d5[_0xbced('0x41')],{'$or':_['map'](_0x235a17,function(_0xbcdc86){if(_0xbcdc86[_0xbced('0x32')]!==_0xbced('0x43')){var _0x10f4c0={};_0x10f4c0[_0xbcdc86[_0xbced('0x2c')]]={'$like':'%'+_0x2329fd[_0xbced('0x35')]['filter']+'%'};return _0x10f4c0;}})});}_0x4328d5=_[_0xbced('0x42')]({},_0x4328d5,_0x2329fd['options']);var _0x39446e={'where':_0x4328d5[_0xbced('0x41')]};return db[_0xbced('0x2f')][_0xbced('0x22')](_0x39446e)[_0xbced('0x29')](function(_0x3ac03e){_0x2b9a57[_0xbced('0x22')]=_0x3ac03e;if(_0x2329fd[_0xbced('0x35')][_0xbced('0x44')]){_0x4328d5['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xbced('0x45')](_0x4328d5);})[_0xbced('0x29')](function(_0x3e87b7){_0x2b9a57['rows']=_0x3e87b7;return _0x2b9a57;})[_0xbced('0x29')](respondWithFilteredResult(_0xde31cd,_0x4328d5))[_0xbced('0x46')](handleError(_0xde31cd,null));};exports[_0xbced('0x47')]=function(_0x22bafd,_0x4ca322){var _0xbf5532={'raw':!![],'where':{'id':_0x22bafd['params']['id']}},_0x547f2c={};_0x547f2c[_0xbced('0x37')]=_[_0xbced('0x34')](db[_0xbced('0x2f')]['rawAttributes']);_0x547f2c[_0xbced('0x35')]=_['keys'](_0x22bafd[_0xbced('0x35')]);_0x547f2c['filters']=_[_0xbced('0x48')](_0x547f2c[_0xbced('0x37')],_0x547f2c['query']);_0xbf5532[_0xbced('0x38')]=_[_0xbced('0x48')](_0x547f2c[_0xbced('0x37')],qs['fields'](_0x22bafd[_0xbced('0x35')][_0xbced('0x39')]));_0xbf5532[_0xbced('0x38')]=_0xbf5532[_0xbced('0x38')][_0xbced('0x3a')]?_0xbf5532[_0xbced('0x38')]:_0x547f2c[_0xbced('0x37')];if(_0x22bafd['query'][_0xbced('0x44')]){_0xbf5532[_0xbced('0x49')]=[{'all':!![]}];}_0xbf5532=_[_0xbced('0x42')]({},_0xbf5532,_0x22bafd[_0xbced('0x4a')]);return db['CmHopperBlack'][_0xbced('0x4b')](_0xbf5532)['then'](handleEntityNotFound(_0x4ca322,null))[_0xbced('0x29')](respondWithResult(_0x4ca322,null))[_0xbced('0x46')](handleError(_0x4ca322,null));};exports[_0xbced('0x27')]=function(_0x163d3f,_0x5bb550){if(_0x163d3f[_0xbced('0x4c')]['id']){delete _0x163d3f[_0xbced('0x4c')]['id'];}return db[_0xbced('0x2f')][_0xbced('0x4b')]({'where':{'id':_0x163d3f[_0xbced('0x4d')]['id']}})[_0xbced('0x29')](handleEntityNotFound(_0x5bb550,null))['then'](saveUpdates(_0x163d3f[_0xbced('0x4c')],null))[_0xbced('0x29')](respondWithResult(_0x5bb550,null))[_0xbced('0x46')](handleError(_0x5bb550,null));};exports[_0xbced('0x28')]=function(_0x5eb146,_0x3afd0f){return db['CmHopperBlack'][_0xbced('0x4b')]({'where':{'id':_0x5eb146[_0xbced('0x4d')]['id']}})[_0xbced('0x29')](handleEntityNotFound(_0x3afd0f,null))[_0xbced('0x29')](removeEntity(_0x3afd0f,null))[_0xbced('0x46')](handleError(_0x3afd0f,null));};exports['describe']=function(_0x36960d,_0x5f05d4){return db[_0xbced('0x2f')][_0xbced('0x4e')]()[_0xbced('0x29')](respondWithResult(_0x5f05d4,null))[_0xbced('0x46')](handleError(_0x5f05d4,null));}; \ No newline at end of file +var _0x70e3=['save','update','destroy','then','end','sendStatus','error','stack','name','map','CmHopperBlack','rawAttributes','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','keys','options','find','catch','body','params','describe','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x4c4645,_0x19bfd9){var _0x3efa18=function(_0x1ecf14){while(--_0x1ecf14){_0x4c4645['push'](_0x4c4645['shift']());}};_0x3efa18(++_0x19bfd9);}(_0x70e3,0xae));var _0x370e=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x70e3[_0x484c03];return _0x294127;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x370e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x370e('0x1'));var moment=require('moment');var BPromise=require(_0x370e('0x2'));var Mustache=require(_0x370e('0x3'));var util=require(_0x370e('0x4'));var path=require('path');var sox=require(_0x370e('0x5'));var csv=require(_0x370e('0x6'));var ejs=require(_0x370e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x370e('0x8'));var squel=require(_0x370e('0x9'));var crypto=require('crypto');var jsforce=require(_0x370e('0xa'));var deskjs=require(_0x370e('0xb'));var toCsv=require(_0x370e('0x6'));var querystring=require('querystring');var Papa=require(_0x370e('0xc'));var Redis=require(_0x370e('0xd'));var authService=require(_0x370e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x370e('0xf'));var hardwareService=require(_0x370e('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x370e('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a68f8,_0x168baf){_0x168baf=_0x168baf||0xcc;return function(_0x575008){if(_0x575008){return _0x1a68f8['sendStatus'](_0x168baf);}return _0x1a68f8[_0x370e('0x12')](_0x168baf)['end']();};}function respondWithResult(_0xe70b1f,_0x4b331c){_0x4b331c=_0x4b331c||0xc8;return function(_0x21cc48){if(_0x21cc48){return _0xe70b1f['status'](_0x4b331c)[_0x370e('0x13')](_0x21cc48);}};}function respondWithFilteredResult(_0x5394cf,_0x472a4a){return function(_0x291bf0){if(_0x291bf0){var _0x515270=typeof _0x472a4a[_0x370e('0x14')]===_0x370e('0x15')&&typeof _0x472a4a[_0x370e('0x16')]===_0x370e('0x15');var _0x6e65d4=_0x291bf0[_0x370e('0x17')];var _0x21f619=_0x515270?0x0:_0x472a4a[_0x370e('0x14')];var _0x5dccf0=_0x515270?_0x291bf0[_0x370e('0x17')]:_0x472a4a[_0x370e('0x14')]+_0x472a4a[_0x370e('0x16')];var _0x6120ce;if(_0x5dccf0>=_0x6e65d4){_0x5dccf0=_0x6e65d4;_0x6120ce=0xc8;}else{_0x6120ce=0xce;}_0x5394cf[_0x370e('0x12')](_0x6120ce);return _0x5394cf[_0x370e('0x18')](_0x370e('0x19'),_0x21f619+'-'+_0x5dccf0+'/'+_0x6e65d4)[_0x370e('0x13')](_0x291bf0);}return null;};}function patchUpdates(_0x4833b3){return function(_0x1105be){try{jsonpatch['apply'](_0x1105be,_0x4833b3,!![]);}catch(_0x331724){return BPromise[_0x370e('0x1a')](_0x331724);}return _0x1105be[_0x370e('0x1b')]();};}function saveUpdates(_0x1d1348,_0x200fe5){return function(_0x44591d){if(_0x44591d){return _0x44591d[_0x370e('0x1c')](_0x1d1348)['then'](function(_0x2dcc49){return _0x2dcc49;});}return null;};}function removeEntity(_0xd15072,_0x49d3c6){return function(_0x134446){if(_0x134446){return _0x134446[_0x370e('0x1d')]()[_0x370e('0x1e')](function(){_0xd15072[_0x370e('0x12')](0xcc)[_0x370e('0x1f')]();});}};}function handleEntityNotFound(_0xe8e5d1,_0x51f278){return function(_0x3d841b){if(!_0x3d841b){_0xe8e5d1[_0x370e('0x20')](0x194);}return _0x3d841b;};}function handleError(_0x5c3873,_0x18a410){_0x18a410=_0x18a410||0x1f4;return function(_0x451eb7){logger[_0x370e('0x21')](_0x451eb7[_0x370e('0x22')]);if(_0x451eb7[_0x370e('0x23')]){delete _0x451eb7[_0x370e('0x23')];}_0x5c3873[_0x370e('0x12')](_0x18a410)['send'](_0x451eb7);};}exports['index']=function(_0x56d4f6,_0x2de037){var _0x2e05dd={},_0x2244f7={},_0x5ddd7d={'count':0x0,'rows':[]};var _0xa9db42=_[_0x370e('0x24')](db[_0x370e('0x25')][_0x370e('0x26')],function(_0x2fb8ed){return{'name':_0x2fb8ed['fieldName'],'type':_0x2fb8ed[_0x370e('0x27')]['key']};});_0x2244f7[_0x370e('0x28')]=_[_0x370e('0x24')](_0xa9db42,_0x370e('0x23'));_0x2244f7['query']=_['keys'](_0x56d4f6['query']);_0x2244f7[_0x370e('0x29')]=_[_0x370e('0x2a')](_0x2244f7['model'],_0x2244f7['query']);_0x2e05dd[_0x370e('0x2b')]=_[_0x370e('0x2a')](_0x2244f7[_0x370e('0x28')],qs[_0x370e('0x2c')](_0x56d4f6[_0x370e('0x2d')][_0x370e('0x2c')]));_0x2e05dd[_0x370e('0x2b')]=_0x2e05dd[_0x370e('0x2b')][_0x370e('0x2e')]?_0x2e05dd[_0x370e('0x2b')]:_0x2244f7[_0x370e('0x28')];if(!_0x56d4f6[_0x370e('0x2d')][_0x370e('0x2f')](_0x370e('0x30'))){_0x2e05dd[_0x370e('0x16')]=qs[_0x370e('0x16')](_0x56d4f6[_0x370e('0x2d')][_0x370e('0x16')]);_0x2e05dd[_0x370e('0x14')]=qs[_0x370e('0x14')](_0x56d4f6[_0x370e('0x2d')]['offset']);}_0x2e05dd[_0x370e('0x31')]=qs[_0x370e('0x32')](_0x56d4f6['query'][_0x370e('0x32')]);_0x2e05dd[_0x370e('0x33')]=qs[_0x370e('0x29')](_[_0x370e('0x34')](_0x56d4f6[_0x370e('0x2d')],_0x2244f7[_0x370e('0x29')]),_0xa9db42);if(_0x56d4f6[_0x370e('0x2d')][_0x370e('0x35')]){_0x2e05dd[_0x370e('0x33')]=_[_0x370e('0x36')](_0x2e05dd[_0x370e('0x33')],{'$or':_[_0x370e('0x24')](_0xa9db42,function(_0xfa354f){if(_0xfa354f[_0x370e('0x27')]!=='VIRTUAL'){var _0x334991={};_0x334991[_0xfa354f[_0x370e('0x23')]]={'$like':'%'+_0x56d4f6[_0x370e('0x2d')][_0x370e('0x35')]+'%'};return _0x334991;}})});}_0x2e05dd=_[_0x370e('0x36')]({},_0x2e05dd,_0x56d4f6['options']);var _0x5952c7={'where':_0x2e05dd['where']};return db[_0x370e('0x25')]['count'](_0x5952c7)[_0x370e('0x1e')](function(_0x5caf7a){_0x5ddd7d[_0x370e('0x17')]=_0x5caf7a;if(_0x56d4f6[_0x370e('0x2d')][_0x370e('0x37')]){_0x2e05dd[_0x370e('0x38')]=[{'all':!![]}];}return db[_0x370e('0x25')][_0x370e('0x39')](_0x2e05dd);})[_0x370e('0x1e')](function(_0x2f7515){_0x5ddd7d[_0x370e('0x3a')]=_0x2f7515;return _0x5ddd7d;})['then'](respondWithFilteredResult(_0x2de037,_0x2e05dd))['catch'](handleError(_0x2de037,null));};exports[_0x370e('0x3b')]=function(_0x567353,_0x135570){var _0x310474={'raw':!![],'where':{'id':_0x567353['params']['id']}},_0x490978={};_0x490978[_0x370e('0x28')]=_[_0x370e('0x3c')](db[_0x370e('0x25')][_0x370e('0x26')]);_0x490978[_0x370e('0x2d')]=_['keys'](_0x567353[_0x370e('0x2d')]);_0x490978[_0x370e('0x29')]=_[_0x370e('0x2a')](_0x490978[_0x370e('0x28')],_0x490978[_0x370e('0x2d')]);_0x310474[_0x370e('0x2b')]=_[_0x370e('0x2a')](_0x490978[_0x370e('0x28')],qs['fields'](_0x567353[_0x370e('0x2d')][_0x370e('0x2c')]));_0x310474[_0x370e('0x2b')]=_0x310474[_0x370e('0x2b')]['length']?_0x310474[_0x370e('0x2b')]:_0x490978[_0x370e('0x28')];if(_0x567353[_0x370e('0x2d')][_0x370e('0x37')]){_0x310474['include']=[{'all':!![]}];}_0x310474=_[_0x370e('0x36')]({},_0x310474,_0x567353[_0x370e('0x3d')]);return db[_0x370e('0x25')][_0x370e('0x3e')](_0x310474)[_0x370e('0x1e')](handleEntityNotFound(_0x135570,null))[_0x370e('0x1e')](respondWithResult(_0x135570,null))[_0x370e('0x3f')](handleError(_0x135570,null));};exports[_0x370e('0x1c')]=function(_0x4039eb,_0x53b492){if(_0x4039eb[_0x370e('0x40')]['id']){delete _0x4039eb[_0x370e('0x40')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x4039eb[_0x370e('0x41')]['id']}})[_0x370e('0x1e')](handleEntityNotFound(_0x53b492,null))['then'](saveUpdates(_0x4039eb[_0x370e('0x40')],null))[_0x370e('0x1e')](respondWithResult(_0x53b492,null))[_0x370e('0x3f')](handleError(_0x53b492,null));};exports['destroy']=function(_0x7c3d6e,_0x56eb77){return db[_0x370e('0x25')]['find']({'where':{'id':_0x7c3d6e[_0x370e('0x41')]['id']}})[_0x370e('0x1e')](handleEntityNotFound(_0x56eb77,null))[_0x370e('0x1e')](removeEntity(_0x56eb77,null))[_0x370e('0x3f')](handleError(_0x56eb77,null));};exports[_0x370e('0x42')]=function(_0x2f160a,_0x37a9dc){return db['CmHopperBlack'][_0x370e('0x42')]()['then'](respondWithResult(_0x37a9dc,null))[_0x370e('0x3f')](handleError(_0x37a9dc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index fa2a5b0..ec5edf8 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 _0xb534=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black'];(function(_0x16b645,_0x207b1){var _0xb03e2d=function(_0x176282){while(--_0x176282){_0x16b645['push'](_0x16b645['shift']());}};_0xb03e2d(++_0x207b1);}(_0xb534,0xfc));var _0x4b53=function(_0x20373a,_0x52d45d){_0x20373a=_0x20373a-0x0;var _0x34c16f=_0xb534[_0x20373a];return _0x34c16f;};'use strict';var _=require(_0x4b53('0x0'));var util=require(_0x4b53('0x1'));var logger=require(_0x4b53('0x2'))(_0x4b53('0x3'));var moment=require('moment');var BPromise=require(_0x4b53('0x4'));var rp=require(_0x4b53('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b53('0x6'));var config=require(_0x4b53('0x7'));var attributes=require(_0x4b53('0x8'));module['exports']=function(_0x383031,_0x1b6933){return _0x383031[_0x4b53('0x9')](_0x4b53('0xa'),attributes,{'tableName':_0x4b53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7ef=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x19242e,_0x1093b0){var _0x217ba2=function(_0x230d2c){while(--_0x230d2c){_0x19242e['push'](_0x19242e['shift']());}};_0x217ba2(++_0x1093b0);}(_0xe7ef,0xc5));var _0xfe7e=function(_0x19fd06,_0x1e296f){_0x19fd06=_0x19fd06-0x0;var _0x302f82=_0xe7ef[_0x19fd06];return _0x302f82;};'use strict';var _=require(_0xfe7e('0x0'));var util=require(_0xfe7e('0x1'));var logger=require(_0xfe7e('0x2'))('api');var moment=require(_0xfe7e('0x3'));var BPromise=require(_0xfe7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe7e('0x5'));var rimraf=require(_0xfe7e('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe7e('0x7'));module[_0xfe7e('0x8')]=function(_0x23b18b,_0x552e62){return _0x23b18b[_0xfe7e('0x9')](_0xfe7e('0xa'),attributes,{'tableName':_0xfe7e('0xb'),'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 b3910a6..017a43c 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 _0x6163=['raw','where','attributes','include','map','model','GetCmHopperBlack','stringify','UpdateCmHopperBlack','CmHopperBlack','body','limit','then','DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','findAll','options'];(function(_0x1411a8,_0x5629b1){var _0x57828d=function(_0xcfbfe6){while(--_0xcfbfe6){_0x1411a8['push'](_0x1411a8['shift']());}};_0x57828d(++_0x5629b1);}(_0x6163,0x153));var _0x3616=function(_0x27c91d,_0x37c914){_0x27c91d=_0x27c91d-0x0;var _0xb9f8b1=_0x6163[_0x27c91d];return _0xb9f8b1;};'use strict';var _=require(_0x3616('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3616('0x1'));var rs=require(_0x3616('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3616('0x3'))['db'];var utils=require(_0x3616('0x4'));var logger=require(_0x3616('0x5'))('rpc');var config=require(_0x3616('0x6'));var jayson=require(_0x3616('0x7'));var client=jayson['client'][_0x3616('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57632d,_0x45a123,_0x178e8e){return new BPromise(function(_0x4c2236,_0x405341){return client[_0x3616('0x9')](_0x57632d,_0x178e8e)['then'](function(_0x3431df){logger['info'](_0x3616('0xa'),_0x45a123,_0x3616('0xb'));logger[_0x3616('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x45a123,'request\x20sent',JSON['stringify'](_0x3431df));if(_0x3431df['error']){if(_0x3431df[_0x3616('0xd')][_0x3616('0xe')]===0x1f4){logger[_0x3616('0xd')](_0x3616('0xa'),_0x45a123,_0x3431df[_0x3616('0xd')][_0x3616('0xf')]);return _0x405341(_0x3431df[_0x3616('0xd')][_0x3616('0xf')]);}logger[_0x3616('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x45a123,_0x3431df[_0x3616('0xd')][_0x3616('0xf')]);return _0x4c2236(_0x3431df['error'][_0x3616('0xf')]);}else{logger[_0x3616('0x10')](_0x3616('0xa'),_0x45a123,_0x3616('0xb'));_0x4c2236(_0x3431df[_0x3616('0x11')][_0x3616('0xf')]);}})[_0x3616('0x12')](function(_0x1fdcf8){logger[_0x3616('0xd')](_0x3616('0xa'),_0x45a123,_0x1fdcf8);_0x405341(_0x1fdcf8);});});}exports['GetCmHopperBlack']=function(_0x39371f){var _0x1b9181=this;return new Promise(function(_0x38155e,_0x214704){return db['CmHopperBlack'][_0x3616('0x13')]({'raw':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')][_0x3616('0x15')]===undefined?!![]:![]:!![],'where':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')][_0x3616('0x16')]||null:null,'attributes':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')][_0x3616('0x17')]||null:null,'limit':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')]['limit']||null:null,'include':_0x39371f[_0x3616('0x14')]?_0x39371f[_0x3616('0x14')][_0x3616('0x18')]?_[_0x3616('0x19')](_0x39371f['options'][_0x3616('0x18')],function(_0x1dbe46){return{'model':db[_0x1dbe46['model']],'as':_0x1dbe46['as'],'attributes':_0x1dbe46['attributes'],'include':_0x1dbe46[_0x3616('0x18')]?_[_0x3616('0x19')](_0x1dbe46[_0x3616('0x18')],function(_0x2fe790){return{'model':db[_0x2fe790[_0x3616('0x1a')]],'as':_0x2fe790['as'],'attributes':_0x2fe790[_0x3616('0x17')],'include':_0x2fe790[_0x3616('0x18')]?_[_0x3616('0x19')](_0x2fe790[_0x3616('0x18')],function(_0xcecac2){return{'model':db[_0xcecac2[_0x3616('0x1a')]],'as':_0xcecac2['as'],'attributes':_0xcecac2[_0x3616('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe2c900){logger[_0x3616('0x10')]('GetCmHopperBlack',_0x39371f);logger[_0x3616('0xc')](_0x3616('0x1b'),_0x39371f,JSON[_0x3616('0x1c')](_0xe2c900));_0x38155e(_0xe2c900);})[_0x3616('0x12')](function(_0x2d09ea){logger[_0x3616('0xd')](_0x3616('0x1b'),_0x2d09ea[_0x3616('0xf')],_0x39371f);_0x214704(_0x1b9181[_0x3616('0xd')](0x1f4,_0x2d09ea[_0x3616('0xf')]));});});};exports[_0x3616('0x1d')]=function(_0x47f779){var _0x5bf3a6=this;return new Promise(function(_0x10ddbc,_0x48eae9){return db[_0x3616('0x1e')]['update'](_0x47f779[_0x3616('0x1f')],{'raw':_0x47f779['options']?_0x47f779[_0x3616('0x14')][_0x3616('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47f779[_0x3616('0x14')]?_0x47f779[_0x3616('0x14')][_0x3616('0x16')]||null:null,'attributes':_0x47f779['options']?_0x47f779[_0x3616('0x14')]['attributes']||null:null,'limit':_0x47f779[_0x3616('0x14')]?_0x47f779[_0x3616('0x14')][_0x3616('0x20')]||null:null})[_0x3616('0x21')](function(_0x1722ad){logger[_0x3616('0x10')](_0x3616('0x1d'),_0x47f779);logger[_0x3616('0xc')](_0x3616('0x1d'),_0x47f779,JSON[_0x3616('0x1c')](_0x1722ad));_0x10ddbc(_0x1722ad);})[_0x3616('0x12')](function(_0x4e7ca3){logger[_0x3616('0xd')](_0x3616('0x1d'),_0x4e7ca3[_0x3616('0xf')],_0x47f779);_0x48eae9(_0x5bf3a6['error'](0x1f4,_0x4e7ca3[_0x3616('0xf')]));});});};exports[_0x3616('0x22')]=function(_0x461ca7){var _0x228ff1=this;return new Promise(function(_0x2269a3,_0x407ab0){return db[_0x3616('0x1e')][_0x3616('0x23')]({'where':_0x461ca7[_0x3616('0x14')]?_0x461ca7[_0x3616('0x14')][_0x3616('0x16')]||null:null})['then'](function(_0x27ec9a){logger[_0x3616('0x10')](_0x3616('0x22'),_0x461ca7);logger[_0x3616('0xc')]('DestroyCmHopperBlack',_0x461ca7,JSON[_0x3616('0x1c')](_0x27ec9a));_0x2269a3(_0x27ec9a);})['catch'](function(_0x5dcc35){logger[_0x3616('0xd')]('DestroyCmHopperBlack',_0x5dcc35['message'],_0x461ca7);_0x407ab0(_0x228ff1[_0x3616('0xd')](0x1f4,_0x5dcc35['message']));});});}; \ No newline at end of file +var _0x6e4c=['GetCmHopperBlack','debug','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','bluebird','randomstring','ioredis','../../mysqldb','rpc','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x19925b,_0x2454d7){var _0x3b2c8e=function(_0x4fee09){while(--_0x4fee09){_0x19925b['push'](_0x19925b['shift']());}};_0x3b2c8e(++_0x2454d7);}(_0x6e4c,0x15a));var _0xc6e4=function(_0x5bd60b,_0x13465a){_0x5bd60b=_0x5bd60b-0x0;var _0x2dcff0=_0x6e4c[_0x5bd60b];return _0x2dcff0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc6e4('0x0'));var rs=require(_0xc6e4('0x1'));var fs=require('fs');var Redis=require(_0xc6e4('0x2'));var db=require(_0xc6e4('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6e4('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc6e4('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x11c918,_0x129aaa,_0x442b87){return new BPromise(function(_0x33d71e,_0xd79710){return client[_0xc6e4('0x6')](_0x11c918,_0x442b87)[_0xc6e4('0x7')](function(_0x13b2aa){logger[_0xc6e4('0x8')](_0xc6e4('0x9'),_0x129aaa,_0xc6e4('0xa'));logger['debug'](_0xc6e4('0xb'),_0x129aaa,_0xc6e4('0xa'),JSON[_0xc6e4('0xc')](_0x13b2aa));if(_0x13b2aa['error']){if(_0x13b2aa['error'][_0xc6e4('0xd')]===0x1f4){logger['error'](_0xc6e4('0x9'),_0x129aaa,_0x13b2aa['error'][_0xc6e4('0xe')]);return _0xd79710(_0x13b2aa[_0xc6e4('0xf')][_0xc6e4('0xe')]);}logger[_0xc6e4('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x129aaa,_0x13b2aa['error'][_0xc6e4('0xe')]);return _0x33d71e(_0x13b2aa['error'][_0xc6e4('0xe')]);}else{logger['info'](_0xc6e4('0x9'),_0x129aaa,_0xc6e4('0xa'));_0x33d71e(_0x13b2aa[_0xc6e4('0x10')][_0xc6e4('0xe')]);}})[_0xc6e4('0x11')](function(_0x5c8b3f){logger[_0xc6e4('0xf')](_0xc6e4('0x9'),_0x129aaa,_0x5c8b3f);_0xd79710(_0x5c8b3f);});});}exports['GetCmHopperBlack']=function(_0x574c3e){var _0x5a3604=this;return new Promise(function(_0x4aa779,_0x2ca6dc){return db[_0xc6e4('0x12')][_0xc6e4('0x13')]({'raw':_0x574c3e['options']?_0x574c3e[_0xc6e4('0x14')][_0xc6e4('0x15')]===undefined?!![]:![]:!![],'where':_0x574c3e[_0xc6e4('0x14')]?_0x574c3e[_0xc6e4('0x14')][_0xc6e4('0x16')]||null:null,'attributes':_0x574c3e[_0xc6e4('0x14')]?_0x574c3e[_0xc6e4('0x14')][_0xc6e4('0x17')]||null:null,'limit':_0x574c3e[_0xc6e4('0x14')]?_0x574c3e[_0xc6e4('0x14')][_0xc6e4('0x18')]||null:null,'include':_0x574c3e[_0xc6e4('0x14')]?_0x574c3e['options'][_0xc6e4('0x19')]?_['map'](_0x574c3e[_0xc6e4('0x14')]['include'],function(_0x2d3560){return{'model':db[_0x2d3560[_0xc6e4('0x1a')]],'as':_0x2d3560['as'],'attributes':_0x2d3560['attributes'],'include':_0x2d3560[_0xc6e4('0x19')]?_['map'](_0x2d3560['include'],function(_0x423a20){return{'model':db[_0x423a20[_0xc6e4('0x1a')]],'as':_0x423a20['as'],'attributes':_0x423a20[_0xc6e4('0x17')],'include':_0x423a20[_0xc6e4('0x19')]?_[_0xc6e4('0x1b')](_0x423a20[_0xc6e4('0x19')],function(_0x276d0c){return{'model':db[_0x276d0c['model']],'as':_0x276d0c['as'],'attributes':_0x276d0c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6e4('0x7')](function(_0x232c87){logger[_0xc6e4('0x8')](_0xc6e4('0x1c'),_0x574c3e);logger[_0xc6e4('0x1d')](_0xc6e4('0x1c'),_0x574c3e,JSON[_0xc6e4('0xc')](_0x232c87));_0x4aa779(_0x232c87);})[_0xc6e4('0x11')](function(_0x4da76e){logger[_0xc6e4('0xf')](_0xc6e4('0x1c'),_0x4da76e[_0xc6e4('0xe')],_0x574c3e);_0x2ca6dc(_0x5a3604[_0xc6e4('0xf')](0x1f4,_0x4da76e[_0xc6e4('0xe')]));});});};exports['UpdateCmHopperBlack']=function(_0x43836e){var _0x2fe30b=this;return new Promise(function(_0x1138e7,_0x551be0){return db[_0xc6e4('0x12')]['update'](_0x43836e[_0xc6e4('0x1e')],{'raw':_0x43836e[_0xc6e4('0x14')]?_0x43836e[_0xc6e4('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43836e[_0xc6e4('0x14')]?_0x43836e['options'][_0xc6e4('0x16')]||null:null,'attributes':_0x43836e['options']?_0x43836e[_0xc6e4('0x14')][_0xc6e4('0x17')]||null:null,'limit':_0x43836e['options']?_0x43836e[_0xc6e4('0x14')][_0xc6e4('0x18')]||null:null})[_0xc6e4('0x7')](function(_0xd8b5aa){logger[_0xc6e4('0x8')]('UpdateCmHopperBlack',_0x43836e);logger[_0xc6e4('0x1d')](_0xc6e4('0x1f'),_0x43836e,JSON[_0xc6e4('0xc')](_0xd8b5aa));_0x1138e7(_0xd8b5aa);})[_0xc6e4('0x11')](function(_0x36d8da){logger[_0xc6e4('0xf')](_0xc6e4('0x1f'),_0x36d8da['message'],_0x43836e);_0x551be0(_0x2fe30b[_0xc6e4('0xf')](0x1f4,_0x36d8da[_0xc6e4('0xe')]));});});};exports[_0xc6e4('0x20')]=function(_0x283aac){var _0x4cdb41=this;return new Promise(function(_0x1ad043,_0x2f3556){return db['CmHopperBlack'][_0xc6e4('0x21')]({'where':_0x283aac['options']?_0x283aac[_0xc6e4('0x14')][_0xc6e4('0x16')]||null:null})[_0xc6e4('0x7')](function(_0x394209){logger['info'](_0xc6e4('0x20'),_0x283aac);logger['debug'](_0xc6e4('0x20'),_0x283aac,JSON['stringify'](_0x394209));_0x1ad043(_0x394209);})[_0xc6e4('0x11')](function(_0x22af96){logger['error'](_0xc6e4('0x20'),_0x22af96[_0xc6e4('0xe')],_0x283aac);_0x2f3556(_0x4cdb41[_0xc6e4('0xf')](0x1f4,_0x22af96[_0xc6e4('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8843cd1..e1080c9 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 _0xd101=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd101,0xc1));var _0x1d10=function(_0x24feea,_0x38275c){_0x24feea=_0x24feea-0x0;var _0x49442d=_0xd101[_0x24feea];return _0x49442d;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmHopperBlack.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xe'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);module[_0x1d10('0x14')]=router; \ No newline at end of file +var _0x7046=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','show','put','/:id','update','delete'];(function(_0x4390f7,_0x37803d){var _0x314f24=function(_0x144aa5){while(--_0x144aa5){_0x4390f7['push'](_0x4390f7['shift']());}};_0x314f24(++_0x37803d);}(_0x7046,0x144));var _0x6704=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7046[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0xe')](_0x6704('0xf'),auth[_0x6704('0xa')](),controller[_0x6704('0x10')]);router[_0x6704('0x11')](_0x6704('0xf'),auth[_0x6704('0xa')](),controller['destroy']);module[_0x6704('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 6aa84b7..7a1c657 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 _0x227b=['sequelize','moment','exports','INTEGER','STRING','DATE','followuptime','diff','seconds','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x227b,0xfa));var _0xb227=function(_0x3fceac,_0x583110){_0x3fceac=_0x3fceac-0x0;var _0x591300=_0x227b[_0x3fceac];return _0x591300;};'use strict';var Sequelize=require(_0xb227('0x0'));var moment=require(_0xb227('0x1'));module[_0xb227('0x2')]={'state':{'type':Sequelize[_0xb227('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xb227('0x4')]},'scheduledat':{'type':Sequelize[_0xb227('0x5')]},'countbusyretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xb227('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb227('0x4')]},'starttime':{'type':Sequelize[_0xb227('0x5')]},'responsetime':{'type':Sequelize[_0xb227('0x5')]},'answertime':{'type':Sequelize[_0xb227('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb227('0x4')]},'campaign':{'type':Sequelize[_0xb227('0x4')]},'campaigntype':{'type':Sequelize[_0xb227('0x4')]},'membername':{'type':Sequelize[_0xb227('0x4')]},'reason':{'type':Sequelize[_0xb227('0x4')]},'disposition':{'type':Sequelize[_0xb227('0x4')]},'secondDisposition':{'type':Sequelize[_0xb227('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb227('0x4')]},'dispositionat':{'type':Sequelize[_0xb227('0x5')],'set':function(_0x6cfb39){var _0x53f687=this['getDataValue']('endtime');if(_0x53f687&&_0x6cfb39){this['setDataValue'](_0xb227('0x6'),moment(_0x6cfb39)[_0xb227('0x7')](moment(_0x53f687),_0xb227('0x8')));}}},'amd':{'type':Sequelize[_0xb227('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb227('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb227('0x5')]},'callback':{'type':Sequelize[_0xb227('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb227('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb227('0x5')]},'deleted':{'type':Sequelize[_0xb227('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb227('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb227('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb227('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x480e=['BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','endtime','setDataValue','diff','seconds'];(function(_0x2abb08,_0x2e60f0){var _0x30ff85=function(_0x5daf45){while(--_0x5daf45){_0x2abb08['push'](_0x2abb08['shift']());}};_0x30ff85(++_0x2e60f0);}(_0x480e,0xe7));var _0xe480=function(_0x3f8fa2,_0x524a4){_0x3f8fa2=_0x3f8fa2-0x0;var _0x4dbd6c=_0x480e[_0x3f8fa2];return _0x4dbd6c;};'use strict';var Sequelize=require(_0xe480('0x0'));var moment=require(_0xe480('0x1'));module['exports']={'state':{'type':Sequelize[_0xe480('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe480('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe480('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe480('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe480('0x4')]},'ringtime':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe480('0x3')]},'reason':{'type':Sequelize[_0xe480('0x3')]},'disposition':{'type':Sequelize[_0xe480('0x3')]},'secondDisposition':{'type':Sequelize[_0xe480('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xe480('0x4')],'set':function(_0x14642d){var _0x217027=this['getDataValue'](_0xe480('0x5'));if(_0x217027&&_0x14642d){this[_0xe480('0x6')]('followuptime',moment(_0x14642d)[_0xe480('0x7')](moment(_0x217027),_0xe480('0x8')));}}},'amd':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe480('0x4')]},'callback':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe480('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe480('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe480('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 86c22cd..528a3ee 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 _0x4819=['send','map','CmHopperFinal','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','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','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x91e24e,_0x2eddb3){var _0x642ebd=function(_0x4b53c7){while(--_0x4b53c7){_0x91e24e['push'](_0x91e24e['shift']());}};_0x642ebd(++_0x2eddb3);}(_0x4819,0xcd));var _0x9481=function(_0x3cb09b,_0x31c2a5){_0x3cb09b=_0x3cb09b-0x0;var _0x242048=_0x4819[_0x3cb09b];return _0x242048;};'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'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['CmHopperFinal']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['describe']=function(_0xd36133,_0x5d3a06){return db['CmHopperFinal'][_0x9481('0x43')]()['then'](respondWithResult(_0x5d3a06,null))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports[_0x9481('0x24')]=function(_0x47f8b2,_0x277e2a){if(_0x47f8b2[_0x9481('0x44')][_0x9481('0x45')]){delete _0x47f8b2[_0x9481('0x44')][_0x9481('0x45')];}return db[_0x9481('0x2b')]['find']({'where':{'uniqueid':_0x47f8b2['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x277e2a,null))[_0x9481('0x25')](saveUpdates(_0x47f8b2[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x277e2a,null))[_0x9481('0x3f')](handleError(_0x277e2a,null));};exports[_0x9481('0x46')]=function(_0x1c070c,_0x3d2250,_0x580273){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x1c070c[_0x9481('0x48')]['id']},'attributes':[[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x9481('0x4b')](_0x9481('0x4c')))),_0x9481('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4e')))),_0x9481('0x4f')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db['sequelize']['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x56')))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0x3d2250,null))['then'](respondWithResult(_0x3d2250,null))['catch'](handleError(_0x3d2250,null));};exports[_0x9481('0x58')]=function(_0x3cbab5,_0xb58b67,_0xe008db){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'CampaignId':_0x3cbab5['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4c')))),_0x9481('0x4d')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x4e')))),'busyContacts'],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0xb58b67,null))[_0x9481('0x25')](respondWithResult(_0xb58b67,null))[_0x9481('0x3f')](handleError(_0xb58b67,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa83176,_0x265f1c,_0x2a053a){return db[_0x9481('0x59')]['find']({'where':{'id':_0xa83176['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x265f1c,null))[_0x9481('0x25')](function(_0x193992){var _0x380f2a;if(_0x193992){_0x380f2a=squel[_0x9481('0x5a')]()['into'](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),_0x9481('0x5e'),_0x9481('0x5f'),_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))[_0x9481('0x65')](_0x9481('0x67'),'scheduledAt')[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')]('ANY_VALUE(VoiceQueueId)',_0x9481('0x61'))[_0x9481('0x65')]('NOW()','createdAt')[_0x9481('0x65')]('NOW()','updatedAt')[_0x9481('0x6a')]('cm_hopper_final')[_0x9481('0x38')](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]())['where'](_0x9481('0x6d'),_0xa83176['body'][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')]('VoiceQueueId\x20=\x20?',_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x70'))['from'](_0x9481('0x71'))['where'](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id']['toString']())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')]('ContactId'))['toString']();return db[_0x9481('0x49')]['query'](_0x380f2a);}return[];})[_0x9481('0x25')](respondWithResult(_0x265f1c,null))[_0x9481('0x3f')](handleError(_0x265f1c,null));};exports[_0x9481('0x74')]=function(_0x55b428,_0x3f74f1,_0x287d06){return db[_0x9481('0x75')]['find']({'where':{'id':_0x55b428[_0x9481('0x48')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x3f74f1,null))[_0x9481('0x25')](function(_0x32b30f){var _0x347da1;if(_0x32b30f){_0x347da1=squel[_0x9481('0x5a')]()[_0x9481('0x76')](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),'scheduledAt',_0x9481('0x5f'),'ListId','CampaignId','createdAt',_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))['field'](_0x9481('0x67'),_0x9481('0x5e'))[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')](_0x9481('0x77'),'CampaignId')[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x62'))[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x63'))[_0x9481('0x6a')](_0x9481('0x71'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428['params']['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x6d'),_0x55b428[_0x9481('0x44')][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x79'))[_0x9481('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel['select']()[_0x9481('0x65')](_0x9481('0x70'))[_0x9481('0x6a')]('cm_hopper_final')['where'](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')](_0x9481('0x5f')))[_0x9481('0x6c')]();return db[_0x9481('0x49')]['query'](_0x347da1);}return[];})[_0x9481('0x25')](respondWithResult(_0x3f74f1,null))[_0x9481('0x3f')](handleError(_0x3f74f1,null));};exports['checkContactHopper']=function(_0x2c53df,_0x534979,_0x616b77){return db[_0x9481('0x7a')]['findOne']({'where':{'VoiceQueueId':_0x2c53df[_0x9481('0x44')][_0x9481('0x61')],'CampaignId':_0x2c53df[_0x9481('0x44')]['CampaignId'],'ContactId':_0x2c53df[_0x9481('0x44')][_0x9481('0x5f')]}})['then'](handleEntityNotFound(_0x534979,null))[_0x9481('0x25')](function(_0x5c7602){if(_0x5c7602){return _0x5c7602;}return null;})[_0x9481('0x25')](respondWithResult(_0x534979,null))[_0x9481('0x3f')](handleError(_0x534979,null));}; \ No newline at end of file +var _0x7880=['index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','where','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x18dab3,_0x2c480a){var _0x54a26c=function(_0x10e739){while(--_0x10e739){_0x18dab3['push'](_0x18dab3['shift']());}};_0x54a26c(++_0x2c480a);}(_0x7880,0x1f4));var _0x0788=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x7880[_0x3d5f84];return _0x1981b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':!![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['CmHopperFinal'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['describe']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')]()['then'](respondWithResult(_0x39c3cc,null))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x19aad6,_0x4563cd){if(_0x19aad6[_0x0788('0x4b')]['uniqueid']){delete _0x19aad6['body'][_0x0788('0x4c')];}return db[_0x0788('0x2d')]['find']({'where':{'uniqueid':_0x19aad6[_0x0788('0x46')]['id']}})['then'](handleEntityNotFound(_0x4563cd,null))[_0x0788('0x26')](saveUpdates(_0x19aad6[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x4563cd,null))[_0x0788('0x44')](handleError(_0x4563cd,null));};exports[_0x0788('0x4d')]=function(_0x379928,_0x1722d4,_0x25ac3c){return db['CmHopperFinal'][_0x0788('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x379928[_0x0788('0x46')]['id']},'attributes':[[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x4f')))),_0x0788('0x50')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x0788('0x52')],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x56')))),_0x0788('0x57')],[db['sequelize']['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x58')))),_0x0788('0x59')],[db['sequelize']['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5a')))),_0x0788('0x5b')],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5c')))),_0x0788('0x5d')]]})[_0x0788('0x26')](handleEntityNotFound(_0x1722d4,null))[_0x0788('0x26')](respondWithResult(_0x1722d4,null))[_0x0788('0x44')](handleError(_0x1722d4,null));};exports[_0x0788('0x5e')]=function(_0x2a8b14,_0x59fcbc,_0xe1a934){return db[_0x0788('0x2d')][_0x0788('0x42')]({'raw':![],'where':{'CampaignId':_0x2a8b14[_0x0788('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x4f')))),'noSuchContacts'],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5f')))),_0x0788('0x52')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x56')))),'congestionContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x0788('0x5a')))),'abandonedContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x60')))),_0x0788('0x61')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db['sequelize'][_0x0788('0x53')](_0x0788('0x5c')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x59fcbc,null))[_0x0788('0x26')](respondWithResult(_0x59fcbc,null))[_0x0788('0x44')](handleError(_0x59fcbc,null));};exports[_0x0788('0x62')]=function(_0x219252,_0x3628d6,_0x192798){return db['VoiceQueue'][_0x0788('0x49')]({'where':{'id':_0x219252[_0x0788('0x46')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x3628d6,null))[_0x0788('0x26')](function(_0x4e0282){var _0x35c612;if(_0x4e0282){_0x35c612=squel[_0x0788('0x63')]()[_0x0788('0x64')](_0x0788('0x65'))['fromQuery'](['phone',_0x0788('0x66'),_0x0788('0x67'),_0x0788('0x68'),_0x0788('0x69'),_0x0788('0x6a'),_0x0788('0x6b')],squel[_0x0788('0x6c')]()[_0x0788('0x6d')](_0x0788('0x6e'),'phone')[_0x0788('0x6d')](_0x0788('0x6f'),_0x0788('0x66'))['field']('ANY_VALUE(ContactId)',_0x0788('0x67'))['field'](_0x0788('0x70'),_0x0788('0x68'))[_0x0788('0x6d')](_0x0788('0x71'),_0x0788('0x69'))[_0x0788('0x6d')](_0x0788('0x6f'),_0x0788('0x6a'))[_0x0788('0x6d')]('NOW()',_0x0788('0x6b'))[_0x0788('0x72')](_0x0788('0x73'))['where'](_0x0788('0x74'),_0x219252[_0x0788('0x46')]['id'][_0x0788('0x75')]())['where'](_0x0788('0x76'),_0x219252[_0x0788('0x4b')][_0x0788('0x77')][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x79'))[_0x0788('0x78')](_0x0788('0x7a'),squel[_0x0788('0x6c')]()['field'](_0x0788('0x7b'))[_0x0788('0x72')](_0x0788('0x65'))[_0x0788('0x78')](_0x0788('0x74'),_0x219252['params']['id'][_0x0788('0x75')]()))[_0x0788('0x78')](_0x0788('0x7a'),squel['select']()[_0x0788('0x6d')](_0x0788('0x7c'))[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')]('VoiceQueueId\x20=\x20?',_0x219252[_0x0788('0x46')]['id'][_0x0788('0x75')]())['where'](_0x0788('0x7d')))[_0x0788('0x7e')]('ContactId'))[_0x0788('0x75')]();return db[_0x0788('0x4e')][_0x0788('0x34')](_0x35c612);}return[];})['then'](respondWithResult(_0x3628d6,null))[_0x0788('0x44')](handleError(_0x3628d6,null));};exports[_0x0788('0x7f')]=function(_0xbb5b1d,_0x53730a,_0xddfb97){return db[_0x0788('0x80')][_0x0788('0x49')]({'where':{'id':_0xbb5b1d[_0x0788('0x46')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x53730a,null))[_0x0788('0x26')](function(_0x2545a7){var _0x174931;if(_0x2545a7){_0x174931=squel['insert']()[_0x0788('0x64')](_0x0788('0x65'))[_0x0788('0x81')]([_0x0788('0x7b'),'scheduledAt','ContactId',_0x0788('0x68'),_0x0788('0x82'),'createdAt',_0x0788('0x6b')],squel[_0x0788('0x6c')]()[_0x0788('0x6d')]('ANY_VALUE(calleridnum)','phone')[_0x0788('0x6d')](_0x0788('0x6f'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x0788('0x67'))[_0x0788('0x6d')]('ANY_VALUE(ListId)',_0x0788('0x68'))[_0x0788('0x6d')](_0x0788('0x83'),_0x0788('0x82'))[_0x0788('0x6d')]('NOW()',_0x0788('0x6a'))['field'](_0x0788('0x6f'),'updatedAt')[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x76'),_0xbb5b1d[_0x0788('0x4b')][_0x0788('0x77')][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x0788('0x6d')](_0x0788('0x7b'))[_0x0788('0x72')](_0x0788('0x65'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]()))[_0x0788('0x78')](_0x0788('0x7a'),squel[_0x0788('0x6c')]()['field']('calleridnum')[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x7d')))['group']('ContactId'))[_0x0788('0x75')]();return db[_0x0788('0x4e')][_0x0788('0x34')](_0x174931);}return[];})[_0x0788('0x26')](respondWithResult(_0x53730a,null))[_0x0788('0x44')](handleError(_0x53730a,null));};exports[_0x0788('0x85')]=function(_0x52dd97,_0x2f6851,_0x1311d7){return db[_0x0788('0x86')][_0x0788('0x87')]({'where':{'VoiceQueueId':_0x52dd97[_0x0788('0x4b')][_0x0788('0x69')],'CampaignId':_0x52dd97[_0x0788('0x4b')][_0x0788('0x82')],'ContactId':_0x52dd97[_0x0788('0x4b')]['ContactId']}})[_0x0788('0x26')](handleEntityNotFound(_0x2f6851,null))[_0x0788('0x26')](function(_0x178f52){if(_0x178f52){return _0x178f52;}return null;})[_0x0788('0x26')](respondWithResult(_0x2f6851,null))[_0x0788('0x44')](handleError(_0x2f6851,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 97e7b16..546edda 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 _0xd2f2=['../../config/logger','api','request-promise','path','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x27aa2e,_0xed14ed){var _0x4da0cb=function(_0x519e46){while(--_0x519e46){_0x27aa2e['push'](_0x27aa2e['shift']());}};_0x4da0cb(++_0xed14ed);}(_0xd2f2,0xee));var _0x2d2f=function(_0x3e1438,_0xc6962a){_0x3e1438=_0x3e1438-0x0;var _0x39ee96=_0xd2f2[_0x3e1438];return _0x39ee96;};'use strict';var _=require(_0x2d2f('0x0'));var util=require(_0x2d2f('0x1'));var logger=require(_0x2d2f('0x2'))(_0x2d2f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d2f('0x4'));var fs=require('fs');var path=require(_0x2d2f('0x5'));var rimraf=require('rimraf');var config=require(_0x2d2f('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x2d2f('0x7')]=function(_0xe34653,_0x1f22a3){return _0xe34653['define'](_0x2d2f('0x8'),attributes,{'tableName':_0x2d2f('0x9'),'paranoid':![],'indexes':[{'name':_0x2d2f('0xa'),'fields':['calleridnum']},{'name':_0x2d2f('0xb'),'fields':[_0x2d2f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5228=['./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xe0364f,_0x1a462c){var _0xeaf880=function(_0x1ed559){while(--_0x1ed559){_0xe0364f['push'](_0xe0364f['shift']());}};_0xeaf880(++_0x1a462c);}(_0x5228,0x19c));var _0x8522=function(_0x119fd2,_0x5e8982){_0x119fd2=_0x119fd2-0x0;var _0xee4a8c=_0x5228[_0x119fd2];return _0xee4a8c;};'use strict';var _=require(_0x8522('0x0'));var util=require(_0x8522('0x1'));var logger=require(_0x8522('0x2'))('api');var moment=require(_0x8522('0x3'));var BPromise=require(_0x8522('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8522('0x5'));var rimraf=require(_0x8522('0x6'));var config=require(_0x8522('0x7'));var attributes=require(_0x8522('0x8'));module[_0x8522('0x9')]=function(_0x1c8253,_0x2c01d6){return _0x1c8253[_0x8522('0xa')](_0x8522('0xb'),attributes,{'tableName':_0x8522('0xc'),'paranoid':![],'indexes':[{'name':_0x8522('0xd'),'fields':[_0x8522('0xd')]},{'name':'uniqueid','fields':[_0x8522('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 cf2556c..7eb3998 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4d0325,_0x232025){var _0x4c9381=function(_0x16694a){while(--_0x16694a){_0x4d0325['push'](_0x4d0325['shift']());}};_0x4c9381(++_0x232025);}(_0xb10b,0x12a));var _0xbb10=function(_0x496ee9,_0x4dba12){_0x496ee9=_0x496ee9-0x0;var _0xb7016a=_0xb10b[_0x496ee9];return _0xb7016a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x18dc3b,_0x353693){var _0x2a5c8b=function(_0x5ecee0){while(--_0x5ecee0){_0x18dc3b['push'](_0x18dc3b['shift']());}};_0x2a5c8b(++_0x353693);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f1ff3,_0x2736a1){_0x4f1ff3=_0x4f1ff3-0x0;var _0x1768a5=_0xb10b[_0x4f1ff3];return _0x1768a5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f91065e..827bfbe 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 _0xdd72=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x59fc6f,_0x4a71cf){var _0x2687ce=function(_0x40cb18){while(--_0x40cb18){_0x59fc6f['push'](_0x59fc6f['shift']());}};_0x2687ce(++_0x4a71cf);}(_0xdd72,0xb4));var _0x2dd7=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xdd72[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0x2dd7('0x0'));var util=require(_0x2dd7('0x1'));var path=require('path');var timeout=require(_0x2dd7('0x2'));var express=require(_0x2dd7('0x3'));var router=express[_0x2dd7('0x4')]();var fs_extra=require(_0x2dd7('0x5'));var auth=require(_0x2dd7('0x6'));var interaction=require(_0x2dd7('0x7'));var config=require(_0x2dd7('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x2dd7('0x9')]('/',auth['isAuthenticated'](),controller[_0x2dd7('0xa')]);router[_0x2dd7('0x9')](_0x2dd7('0xb'),auth[_0x2dd7('0xc')](),controller['describe']);router['get'](_0x2dd7('0xd'),auth[_0x2dd7('0xc')](),controller[_0x2dd7('0xe')]);router[_0x2dd7('0x9')](_0x2dd7('0xf'),auth[_0x2dd7('0xc')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x2dd7('0x9')](_0x2dd7('0x10'),auth[_0x2dd7('0xc')](),controller[_0x2dd7('0x11')]);router[_0x2dd7('0x12')](_0x2dd7('0x13'),auth[_0x2dd7('0xc')](),controller[_0x2dd7('0x14')]);router[_0x2dd7('0x12')](_0x2dd7('0x15'),auth[_0x2dd7('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x2dd7('0x12')](_0x2dd7('0x16'),auth[_0x2dd7('0xc')](),controller[_0x2dd7('0x17')]);router[_0x2dd7('0x18')](_0x2dd7('0xd'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x6599=['get','/describe','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x6599,0x16e));var _0x9659=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x6599[_0x38c632];return _0x12737e;};'use strict';var multer=require(_0x9659('0x0'));var util=require(_0x9659('0x1'));var path=require(_0x9659('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9659('0x3')]();var fs_extra=require(_0x9659('0x4'));var auth=require(_0x9659('0x5'));var interaction=require(_0x9659('0x6'));var config=require(_0x9659('0x7'));var controller=require(_0x9659('0x8'));router[_0x9659('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9659('0x9')](_0x9659('0xa'),auth[_0x9659('0xb')](),controller[_0x9659('0xc')]);router[_0x9659('0x9')](_0x9659('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9659('0x9')](_0x9659('0xe'),auth[_0x9659('0xb')](),controller[_0x9659('0xf')]);router[_0x9659('0x9')](_0x9659('0x10'),auth[_0x9659('0xb')](),controller[_0x9659('0x11')]);router[_0x9659('0x12')](_0x9659('0x13'),auth[_0x9659('0xb')](),controller[_0x9659('0x14')]);router[_0x9659('0x12')](_0x9659('0x15'),auth[_0x9659('0xb')](),controller[_0x9659('0x16')]);router[_0x9659('0x12')]('/checkContactHopper',auth[_0x9659('0xb')](),controller[_0x9659('0x17')]);router[_0x9659('0x18')]('/:id',auth[_0x9659('0xb')](),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 4b15856..da0a660 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 _0xd115=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0xd115,0x192));var _0x5d11=function(_0x2dfe2c,_0x4fbb07){_0x2dfe2c=_0x2dfe2c-0x0;var _0x565802=_0xd115[_0x2dfe2c];return _0x565802;};'use strict';var Sequelize=require(_0x5d11('0x0'));module[_0x5d11('0x1')]={'state':{'type':Sequelize[_0x5d11('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5d11('0x3')]},'countbusyretry':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d11('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5d11('0x4')]},'calleridnum':{'type':Sequelize[_0x5d11('0x4')]},'calleridname':{'type':Sequelize[_0x5d11('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5d11('0x3')]},'endtime':{'type':Sequelize[_0x5d11('0x3')]},'ringtime':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5d11('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5d11('0x4')]},'membername':{'type':Sequelize[_0x5d11('0x4')]},'reason':{'type':Sequelize[_0x5d11('0x4')]},'amd':{'type':Sequelize[_0x5d11('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5d11('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d11('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5d11('0x3')]},'edited':{'type':Sequelize[_0x5d11('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5d11('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5d11('0x4')]}}; \ No newline at end of file +var _0x96c7=['STRING','BOOLEAN','sequelize','DATE','INTEGER'];(function(_0x19af30,_0x5c43c1){var _0x4a362f=function(_0x1759e8){while(--_0x1759e8){_0x19af30['push'](_0x19af30['shift']());}};_0x4a362f(++_0x5c43c1);}(_0x96c7,0x1a1));var _0x796c=function(_0x4a4386,_0x60caab){_0x4a4386=_0x4a4386-0x0;var _0x842cb9=_0x96c7[_0x4a4386];return _0x842cb9;};'use strict';var Sequelize=require(_0x796c('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x796c('0x1')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x796c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x796c('0x3')]},'originatecalleridname':{'type':Sequelize[_0x796c('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x796c('0x3')]},'starttime':{'type':Sequelize[_0x796c('0x1')]},'responsetime':{'type':Sequelize[_0x796c('0x1')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x796c('0x1')]},'endtime':{'type':Sequelize[_0x796c('0x1')]},'ringtime':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x796c('0x3')]},'campaigntype':{'type':Sequelize[_0x796c('0x3')]},'membername':{'type':Sequelize[_0x796c('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x796c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x796c('0x1')]},'recallme':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x796c('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d643dad..d79427e 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 _0xc806=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','create','body','describe','uniqueid','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model'];(function(_0x554443,_0x1a6f42){var _0x37f005=function(_0x6d9971){while(--_0x6d9971){_0x554443['push'](_0x554443['shift']());}};_0x37f005(++_0x1a6f42);}(_0xc806,0x143));var _0x6c80=function(_0x47f444,_0x1f4277){_0x47f444=_0x47f444-0x0;var _0x2fa0e6=_0xc806[_0x47f444];return _0x2fa0e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c80('0x0'));var zipdir=require(_0x6c80('0x1'));var jsonpatch=require(_0x6c80('0x2'));var rp=require(_0x6c80('0x3'));var moment=require(_0x6c80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c80('0x5'));var util=require(_0x6c80('0x6'));var path=require('path');var sox=require(_0x6c80('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c80('0x8'));var _=require('lodash');var squel=require(_0x6c80('0x9'));var crypto=require(_0x6c80('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6c80('0xb'));var toCsv=require(_0x6c80('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c80('0xd'));var qs=require(_0x6c80('0xe'));var as=require(_0x6c80('0xf'));var hardwareService=require(_0x6c80('0x10'));var logger=require(_0x6c80('0x11'))(_0x6c80('0x12'));var utils=require('../../config/utils');var config=require(_0x6c80('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c80('0x14'))['db'];function respondWithStatusCode(_0x58b590,_0x23356f){_0x23356f=_0x23356f||0xcc;return function(_0x24d189){if(_0x24d189){return _0x58b590[_0x6c80('0x15')](_0x23356f);}return _0x58b590[_0x6c80('0x16')](_0x23356f)['end']();};}function respondWithResult(_0x3f7648,_0x29b822){_0x29b822=_0x29b822||0xc8;return function(_0x219c10){if(_0x219c10){return _0x3f7648[_0x6c80('0x16')](_0x29b822)['json'](_0x219c10);}};}function respondWithFilteredResult(_0x4903d8,_0x277312){return function(_0x508e99){if(_0x508e99){var _0xc8d108=typeof _0x277312[_0x6c80('0x17')]===_0x6c80('0x18')&&typeof _0x277312[_0x6c80('0x19')]===_0x6c80('0x18');var _0x4464c5=_0x508e99['count'];var _0xceb71=_0xc8d108?0x0:_0x277312['offset'];var _0x5d2199=_0xc8d108?_0x508e99[_0x6c80('0x1a')]:_0x277312[_0x6c80('0x17')]+_0x277312[_0x6c80('0x19')];var _0x15f8e6;if(_0x5d2199>=_0x4464c5){_0x5d2199=_0x4464c5;_0x15f8e6=0xc8;}else{_0x15f8e6=0xce;}_0x4903d8[_0x6c80('0x16')](_0x15f8e6);return _0x4903d8[_0x6c80('0x1b')](_0x6c80('0x1c'),_0xceb71+'-'+_0x5d2199+'/'+_0x4464c5)[_0x6c80('0x1d')](_0x508e99);}return null;};}function patchUpdates(_0x39e6a2){return function(_0x168a20){try{jsonpatch[_0x6c80('0x1e')](_0x168a20,_0x39e6a2,!![]);}catch(_0x570b9f){return BPromise['reject'](_0x570b9f);}return _0x168a20[_0x6c80('0x1f')]();};}function saveUpdates(_0x266cc7,_0x281e67){return function(_0x1098c4){if(_0x1098c4){return _0x1098c4[_0x6c80('0x20')](_0x266cc7)[_0x6c80('0x21')](function(_0x27ec26){return _0x27ec26;});}return null;};}function removeEntity(_0x45fc9f,_0x215124){return function(_0x3e9c7c){if(_0x3e9c7c){return _0x3e9c7c[_0x6c80('0x22')]()[_0x6c80('0x21')](function(){_0x45fc9f[_0x6c80('0x16')](0xcc)[_0x6c80('0x23')]();});}};}function handleEntityNotFound(_0x2b976e,_0x18b351){return function(_0x1ad82a){if(!_0x1ad82a){_0x2b976e[_0x6c80('0x15')](0x194);}return _0x1ad82a;};}function handleError(_0x5f2bf4,_0x51257c){_0x51257c=_0x51257c||0x1f4;return function(_0x10ee07){logger[_0x6c80('0x24')](_0x10ee07[_0x6c80('0x25')]);if(_0x10ee07[_0x6c80('0x26')]){delete _0x10ee07[_0x6c80('0x26')];}_0x5f2bf4[_0x6c80('0x16')](_0x51257c)[_0x6c80('0x27')](_0x10ee07);};}exports['index']=function(_0x1c9093,_0x5f006b){var _0xf2e41e={},_0x5f1b88={},_0x319dfb={'count':0x0,'rows':[]};var _0x25421c=_[_0x6c80('0x28')](db[_0x6c80('0x29')][_0x6c80('0x2a')],function(_0x1b9e2d){return{'name':_0x1b9e2d[_0x6c80('0x2b')],'type':_0x1b9e2d[_0x6c80('0x2c')][_0x6c80('0x2d')]};});_0x5f1b88[_0x6c80('0x2e')]=_[_0x6c80('0x28')](_0x25421c,_0x6c80('0x26'));_0x5f1b88[_0x6c80('0x2f')]=_[_0x6c80('0x30')](_0x1c9093['query']);_0x5f1b88[_0x6c80('0x31')]=_[_0x6c80('0x32')](_0x5f1b88[_0x6c80('0x2e')],_0x5f1b88[_0x6c80('0x2f')]);_0xf2e41e[_0x6c80('0x33')]=_[_0x6c80('0x32')](_0x5f1b88[_0x6c80('0x2e')],qs[_0x6c80('0x34')](_0x1c9093[_0x6c80('0x2f')]['fields']));_0xf2e41e[_0x6c80('0x33')]=_0xf2e41e[_0x6c80('0x33')][_0x6c80('0x35')]?_0xf2e41e[_0x6c80('0x33')]:_0x5f1b88['model'];if(!_0x1c9093[_0x6c80('0x2f')][_0x6c80('0x36')](_0x6c80('0x37'))){_0xf2e41e[_0x6c80('0x19')]=qs[_0x6c80('0x19')](_0x1c9093[_0x6c80('0x2f')][_0x6c80('0x19')]);_0xf2e41e['offset']=qs[_0x6c80('0x17')](_0x1c9093[_0x6c80('0x2f')][_0x6c80('0x17')]);}_0xf2e41e[_0x6c80('0x38')]=qs['sort'](_0x1c9093['query']['sort']);_0xf2e41e[_0x6c80('0x39')]=qs[_0x6c80('0x31')](_[_0x6c80('0x3a')](_0x1c9093[_0x6c80('0x2f')],_0x5f1b88[_0x6c80('0x31')]),_0x25421c);if(_0x1c9093[_0x6c80('0x2f')][_0x6c80('0x3b')]){_0xf2e41e[_0x6c80('0x39')]=_[_0x6c80('0x3c')](_0xf2e41e[_0x6c80('0x39')],{'$or':_[_0x6c80('0x28')](_0x25421c,function(_0x55af19){if(_0x55af19[_0x6c80('0x2c')]!==_0x6c80('0x3d')){var _0x38e862={};_0x38e862[_0x55af19[_0x6c80('0x26')]]={'$like':'%'+_0x1c9093[_0x6c80('0x2f')]['filter']+'%'};return _0x38e862;}})});}_0xf2e41e=_['merge']({},_0xf2e41e,_0x1c9093[_0x6c80('0x3e')]);var _0xd5325a={'where':_0xf2e41e[_0x6c80('0x39')]};return db['CmHopperHistory'][_0x6c80('0x1a')](_0xd5325a)['then'](function(_0x3c34c1){_0x319dfb['count']=_0x3c34c1;if(_0x1c9093[_0x6c80('0x2f')]['includeAll']){_0xf2e41e['include']=[{'all':!![]}];}return db[_0x6c80('0x29')][_0x6c80('0x3f')](_0xf2e41e);})[_0x6c80('0x21')](function(_0x4a3a6d){_0x319dfb[_0x6c80('0x40')]=_0x4a3a6d;return _0x319dfb;})['then'](respondWithFilteredResult(_0x5f006b,_0xf2e41e))[_0x6c80('0x41')](handleError(_0x5f006b,null));};exports[_0x6c80('0x42')]=function(_0x5d9829,_0x423af3){var _0x505344={'raw':!![],'where':{'id':_0x5d9829['params']['id']}},_0x120e65={};_0x120e65[_0x6c80('0x2e')]=_['keys'](db['CmHopperHistory'][_0x6c80('0x2a')]);_0x120e65['query']=_['keys'](_0x5d9829[_0x6c80('0x2f')]);_0x120e65['filters']=_[_0x6c80('0x32')](_0x120e65['model'],_0x120e65[_0x6c80('0x2f')]);_0x505344['attributes']=_[_0x6c80('0x32')](_0x120e65[_0x6c80('0x2e')],qs['fields'](_0x5d9829['query'][_0x6c80('0x34')]));_0x505344[_0x6c80('0x33')]=_0x505344[_0x6c80('0x33')]['length']?_0x505344[_0x6c80('0x33')]:_0x120e65[_0x6c80('0x2e')];if(_0x5d9829[_0x6c80('0x2f')][_0x6c80('0x43')]){_0x505344[_0x6c80('0x44')]=[{'all':!![]}];}_0x505344=_[_0x6c80('0x3c')]({},_0x505344,_0x5d9829['options']);return db[_0x6c80('0x29')]['find'](_0x505344)[_0x6c80('0x21')](handleEntityNotFound(_0x423af3,null))[_0x6c80('0x21')](respondWithResult(_0x423af3,null))[_0x6c80('0x41')](handleError(_0x423af3,null));};exports[_0x6c80('0x45')]=function(_0x4add35,_0x4d91a1){return db[_0x6c80('0x29')]['create'](_0x4add35[_0x6c80('0x46')],{})[_0x6c80('0x21')](respondWithResult(_0x4d91a1,0xc9))[_0x6c80('0x41')](handleError(_0x4d91a1,null));};exports[_0x6c80('0x47')]=function(_0x22112f,_0x570219){return db[_0x6c80('0x29')][_0x6c80('0x47')]()[_0x6c80('0x21')](respondWithResult(_0x570219,null))['catch'](handleError(_0x570219,null));};exports[_0x6c80('0x20')]=function(_0x4ca432,_0x2d0520){if(_0x4ca432[_0x6c80('0x46')][_0x6c80('0x48')]){delete _0x4ca432[_0x6c80('0x46')]['uniqueid'];}return db[_0x6c80('0x29')]['find']({'where':{'uniqueid':_0x4ca432[_0x6c80('0x49')]['id']}})[_0x6c80('0x21')](handleEntityNotFound(_0x2d0520,null))[_0x6c80('0x21')](saveUpdates(_0x4ca432['body'],null))[_0x6c80('0x21')](respondWithResult(_0x2d0520,null))[_0x6c80('0x41')](handleError(_0x2d0520,null));}; \ No newline at end of file +var _0x510c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','catch','show','params','length','options','create','describe','update','body','uniqueid','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x1d49ed,_0x56a01c){var _0x28d473=function(_0x1e8679){while(--_0x1e8679){_0x1d49ed['push'](_0x1d49ed['shift']());}};_0x28d473(++_0x56a01c);}(_0x510c,0xda));var _0xc510=function(_0x26a069,_0x132dbf){_0x26a069=_0x26a069-0x0;var _0x11f4e7=_0x510c[_0x26a069];return _0x11f4e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc510('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc510('0x1'));var rp=require(_0xc510('0x2'));var moment=require(_0xc510('0x3'));var BPromise=require(_0xc510('0x4'));var Mustache=require(_0xc510('0x5'));var util=require(_0xc510('0x6'));var path=require(_0xc510('0x7'));var sox=require(_0xc510('0x8'));var csv=require(_0xc510('0x9'));var ejs=require(_0xc510('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc510('0xb'));var squel=require(_0xc510('0xc'));var crypto=require(_0xc510('0xd'));var jsforce=require(_0xc510('0xe'));var deskjs=require(_0xc510('0xf'));var toCsv=require(_0xc510('0x9'));var querystring=require(_0xc510('0x10'));var Papa=require('papaparse');var Redis=require(_0xc510('0x11'));var authService=require(_0xc510('0x12'));var qs=require(_0xc510('0x13'));var as=require(_0xc510('0x14'));var hardwareService=require(_0xc510('0x15'));var logger=require('../../config/logger')(_0xc510('0x16'));var utils=require(_0xc510('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc510('0x18'));var db=require(_0xc510('0x19'))['db'];function respondWithStatusCode(_0x342aa9,_0x50ddd4){_0x50ddd4=_0x50ddd4||0xcc;return function(_0x4d08fb){if(_0x4d08fb){return _0x342aa9[_0xc510('0x1a')](_0x50ddd4);}return _0x342aa9['status'](_0x50ddd4)['end']();};}function respondWithResult(_0x1e8953,_0x3f33b1){_0x3f33b1=_0x3f33b1||0xc8;return function(_0x4653d1){if(_0x4653d1){return _0x1e8953[_0xc510('0x1b')](_0x3f33b1)['json'](_0x4653d1);}};}function respondWithFilteredResult(_0x39e339,_0x78a270){return function(_0x3466e0){if(_0x3466e0){var _0x2eeab7=typeof _0x78a270[_0xc510('0x1c')]===_0xc510('0x1d')&&typeof _0x78a270[_0xc510('0x1e')]==='undefined';var _0x50824b=_0x3466e0['count'];var _0x12c4d8=_0x2eeab7?0x0:_0x78a270['offset'];var _0x928c66=_0x2eeab7?_0x3466e0['count']:_0x78a270['offset']+_0x78a270[_0xc510('0x1e')];var _0x3c320b;if(_0x928c66>=_0x50824b){_0x928c66=_0x50824b;_0x3c320b=0xc8;}else{_0x3c320b=0xce;}_0x39e339[_0xc510('0x1b')](_0x3c320b);return _0x39e339[_0xc510('0x1f')](_0xc510('0x20'),_0x12c4d8+'-'+_0x928c66+'/'+_0x50824b)[_0xc510('0x21')](_0x3466e0);}return null;};}function patchUpdates(_0x50373c){return function(_0x76d6d7){try{jsonpatch[_0xc510('0x22')](_0x76d6d7,_0x50373c,!![]);}catch(_0x5725f9){return BPromise[_0xc510('0x23')](_0x5725f9);}return _0x76d6d7['save']();};}function saveUpdates(_0x387f46,_0x4bd949){return function(_0x47ed29){if(_0x47ed29){return _0x47ed29['update'](_0x387f46)[_0xc510('0x24')](function(_0x4db726){return _0x4db726;});}return null;};}function removeEntity(_0x3cbc54,_0x221d6a){return function(_0x53b967){if(_0x53b967){return _0x53b967[_0xc510('0x25')]()['then'](function(){_0x3cbc54['status'](0xcc)[_0xc510('0x26')]();});}};}function handleEntityNotFound(_0xdc532,_0x1a4bc9){return function(_0x52fde1){if(!_0x52fde1){_0xdc532[_0xc510('0x1a')](0x194);}return _0x52fde1;};}function handleError(_0x36b1df,_0x357576){_0x357576=_0x357576||0x1f4;return function(_0x5398cd){logger[_0xc510('0x27')](_0x5398cd[_0xc510('0x28')]);if(_0x5398cd[_0xc510('0x29')]){delete _0x5398cd[_0xc510('0x29')];}_0x36b1df[_0xc510('0x1b')](_0x357576)['send'](_0x5398cd);};}exports[_0xc510('0x2a')]=function(_0xa10eb,_0x7f8ccc){var _0xc7326c={},_0x3cbab5={},_0x4c0779={'count':0x0,'rows':[]};var _0x34ddce=_[_0xc510('0x2b')](db[_0xc510('0x2c')][_0xc510('0x2d')],function(_0x29688c){return{'name':_0x29688c[_0xc510('0x2e')],'type':_0x29688c['type'][_0xc510('0x2f')]};});_0x3cbab5[_0xc510('0x30')]=_[_0xc510('0x2b')](_0x34ddce,_0xc510('0x29'));_0x3cbab5[_0xc510('0x31')]=_[_0xc510('0x32')](_0xa10eb[_0xc510('0x31')]);_0x3cbab5[_0xc510('0x33')]=_['intersection'](_0x3cbab5[_0xc510('0x30')],_0x3cbab5[_0xc510('0x31')]);_0xc7326c[_0xc510('0x34')]=_[_0xc510('0x35')](_0x3cbab5[_0xc510('0x30')],qs[_0xc510('0x36')](_0xa10eb['query'][_0xc510('0x36')]));_0xc7326c[_0xc510('0x34')]=_0xc7326c[_0xc510('0x34')]['length']?_0xc7326c[_0xc510('0x34')]:_0x3cbab5[_0xc510('0x30')];if(!_0xa10eb[_0xc510('0x31')][_0xc510('0x37')]('nolimit')){_0xc7326c[_0xc510('0x1e')]=qs[_0xc510('0x1e')](_0xa10eb[_0xc510('0x31')]['limit']);_0xc7326c['offset']=qs[_0xc510('0x1c')](_0xa10eb[_0xc510('0x31')][_0xc510('0x1c')]);}_0xc7326c[_0xc510('0x38')]=qs[_0xc510('0x39')](_0xa10eb[_0xc510('0x31')][_0xc510('0x39')]);_0xc7326c['where']=qs['filters'](_[_0xc510('0x3a')](_0xa10eb[_0xc510('0x31')],_0x3cbab5[_0xc510('0x33')]),_0x34ddce);if(_0xa10eb[_0xc510('0x31')][_0xc510('0x3b')]){_0xc7326c[_0xc510('0x3c')]=_[_0xc510('0x3d')](_0xc7326c[_0xc510('0x3c')],{'$or':_[_0xc510('0x2b')](_0x34ddce,function(_0x2b5700){if(_0x2b5700[_0xc510('0x3e')]!==_0xc510('0x3f')){var _0x23a38b={};_0x23a38b[_0x2b5700[_0xc510('0x29')]]={'$like':'%'+_0xa10eb['query'][_0xc510('0x3b')]+'%'};return _0x23a38b;}})});}_0xc7326c=_[_0xc510('0x3d')]({},_0xc7326c,_0xa10eb['options']);var _0x25224d={'where':_0xc7326c[_0xc510('0x3c')]};return db[_0xc510('0x2c')]['count'](_0x25224d)[_0xc510('0x24')](function(_0x1841ea){_0x4c0779[_0xc510('0x40')]=_0x1841ea;if(_0xa10eb[_0xc510('0x31')][_0xc510('0x41')]){_0xc7326c[_0xc510('0x42')]=[{'all':!![]}];}return db[_0xc510('0x2c')][_0xc510('0x43')](_0xc7326c);})['then'](function(_0x19d273){_0x4c0779['rows']=_0x19d273;return _0x4c0779;})[_0xc510('0x24')](respondWithFilteredResult(_0x7f8ccc,_0xc7326c))[_0xc510('0x44')](handleError(_0x7f8ccc,null));};exports[_0xc510('0x45')]=function(_0x2b0a2c,_0x5f1f45){var _0x37c643={'raw':!![],'where':{'id':_0x2b0a2c[_0xc510('0x46')]['id']}},_0x19f3f2={};_0x19f3f2['model']=_[_0xc510('0x32')](db[_0xc510('0x2c')][_0xc510('0x2d')]);_0x19f3f2['query']=_['keys'](_0x2b0a2c[_0xc510('0x31')]);_0x19f3f2[_0xc510('0x33')]=_[_0xc510('0x35')](_0x19f3f2[_0xc510('0x30')],_0x19f3f2[_0xc510('0x31')]);_0x37c643[_0xc510('0x34')]=_[_0xc510('0x35')](_0x19f3f2[_0xc510('0x30')],qs[_0xc510('0x36')](_0x2b0a2c[_0xc510('0x31')][_0xc510('0x36')]));_0x37c643[_0xc510('0x34')]=_0x37c643[_0xc510('0x34')][_0xc510('0x47')]?_0x37c643[_0xc510('0x34')]:_0x19f3f2[_0xc510('0x30')];if(_0x2b0a2c[_0xc510('0x31')][_0xc510('0x41')]){_0x37c643[_0xc510('0x42')]=[{'all':!![]}];}_0x37c643=_['merge']({},_0x37c643,_0x2b0a2c[_0xc510('0x48')]);return db[_0xc510('0x2c')]['find'](_0x37c643)[_0xc510('0x24')](handleEntityNotFound(_0x5f1f45,null))[_0xc510('0x24')](respondWithResult(_0x5f1f45,null))[_0xc510('0x44')](handleError(_0x5f1f45,null));};exports['create']=function(_0x56de9a,_0x1addbb){return db['CmHopperHistory'][_0xc510('0x49')](_0x56de9a['body'],{})['then'](respondWithResult(_0x1addbb,0xc9))['catch'](handleError(_0x1addbb,null));};exports[_0xc510('0x4a')]=function(_0xc22d4b,_0x5b42fc){return db[_0xc510('0x2c')][_0xc510('0x4a')]()[_0xc510('0x24')](respondWithResult(_0x5b42fc,null))[_0xc510('0x44')](handleError(_0x5b42fc,null));};exports[_0xc510('0x4b')]=function(_0x3ce160,_0x3ec61f){if(_0x3ce160[_0xc510('0x4c')][_0xc510('0x4d')]){delete _0x3ce160[_0xc510('0x4c')]['uniqueid'];}return db[_0xc510('0x2c')][_0xc510('0x4e')]({'where':{'uniqueid':_0x3ce160[_0xc510('0x46')]['id']}})[_0xc510('0x24')](handleEntityNotFound(_0x3ec61f,null))[_0xc510('0x24')](saveUpdates(_0x3ce160[_0xc510('0x4c')],null))[_0xc510('0x24')](respondWithResult(_0x3ec61f,null))[_0xc510('0x44')](handleError(_0x3ec61f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a362932..e94cc4e 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 _0xff01=['request-promise','path','../../config/environment','exports','cm_hopper_history','endtime','uniqueid','lodash','util','api','bluebird'];(function(_0x355d72,_0x138673){var _0x2ae2ec=function(_0x1a1e37){while(--_0x1a1e37){_0x355d72['push'](_0x355d72['shift']());}};_0x2ae2ec(++_0x138673);}(_0xff01,0xb7));var _0x1ff0=function(_0x29422e,_0x3d9af0){_0x29422e=_0x29422e-0x0;var _0x262d6e=_0xff01[_0x29422e];return _0x262d6e;};'use strict';var _=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var logger=require('../../config/logger')(_0x1ff0('0x2'));var moment=require('moment');var BPromise=require(_0x1ff0('0x3'));var rp=require(_0x1ff0('0x4'));var fs=require('fs');var path=require(_0x1ff0('0x5'));var rimraf=require('rimraf');var config=require(_0x1ff0('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0x1ff0('0x7')]=function(_0x4fd1b6,_0x3f8ca1){return _0x4fd1b6['define']('CmHopperHistory',attributes,{'tableName':_0x1ff0('0x8'),'paranoid':![],'indexes':[{'name':_0x1ff0('0x9'),'fields':['endtime']},{'name':_0x1ff0('0xa'),'fields':[_0x1ff0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a15=['endtime','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','CmHopperHistory','cm_hopper_history'];(function(_0x347412,_0xab844a){var _0x624e05=function(_0x2e7cdd){while(--_0x2e7cdd){_0x347412['push'](_0x347412['shift']());}};_0x624e05(++_0xab844a);}(_0x3a15,0xde));var _0x53a1=function(_0x1bbe79,_0x1707f5){_0x1bbe79=_0x1bbe79-0x0;var _0x4da933=_0x3a15[_0x1bbe79];return _0x4da933;};'use strict';var _=require(_0x53a1('0x0'));var util=require('util');var logger=require(_0x53a1('0x1'))('api');var moment=require(_0x53a1('0x2'));var BPromise=require(_0x53a1('0x3'));var rp=require(_0x53a1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x53a1('0x5'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5acff4,_0x292b62){return _0x5acff4['define'](_0x53a1('0x6'),attributes,{'tableName':_0x53a1('0x7'),'paranoid':![],'indexes':[{'name':_0x53a1('0x8'),'fields':['endtime']},{'name':_0x53a1('0x9'),'fields':[_0x53a1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0b60990..4edd2c1 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 _0xb248=['debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','create','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent'];(function(_0x5af532,_0x20afd7){var _0x2fa209=function(_0x27886e){while(--_0x27886e){_0x5af532['push'](_0x5af532['shift']());}};_0x2fa209(++_0x20afd7);}(_0xb248,0xc6));var _0x8b24=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xb248[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var moment=require(_0x8b24('0x1'));var BPromise=require(_0x8b24('0x2'));var rs=require(_0x8b24('0x3'));var fs=require('fs');var Redis=require(_0x8b24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b24('0x5'));var logger=require(_0x8b24('0x6'))('rpc');var config=require(_0x8b24('0x7'));var jayson=require(_0x8b24('0x8'));var client=jayson['client'][_0x8b24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4705e0,_0x588ca8,_0x3198a2){return new BPromise(function(_0x51bbad,_0x43b851){return client[_0x8b24('0xa')](_0x4705e0,_0x3198a2)[_0x8b24('0xb')](function(_0x4ad0db){logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x588ca8,_0x8b24('0xe'));logger[_0x8b24('0xf')](_0x8b24('0x10'),_0x588ca8,_0x8b24('0xe'),JSON[_0x8b24('0x11')](_0x4ad0db));if(_0x4ad0db[_0x8b24('0x12')]){if(_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x13')]===0x1f4){logger[_0x8b24('0x12')](_0x8b24('0xd'),_0x588ca8,_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);return _0x43b851(_0x4ad0db['error']['message']);}logger[_0x8b24('0x12')](_0x8b24('0xd'),_0x588ca8,_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);return _0x51bbad(_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);}else{logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x588ca8,'request\x20sent');_0x51bbad(_0x4ad0db['result']['message']);}})[_0x8b24('0x15')](function(_0x523863){logger['error'](_0x8b24('0xd'),_0x588ca8,_0x523863);_0x43b851(_0x523863);});});}exports[_0x8b24('0x16')]=function(_0x527af7){var _0x1bafdf=this;return new Promise(function(_0x5e3c52,_0x3b4805){return db['CmHopperHistory'][_0x8b24('0x17')](_0x527af7['body'],{'raw':_0x527af7[_0x8b24('0x18')]?_0x527af7[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![]})[_0x8b24('0xb')](function(_0x2a4f2d){logger[_0x8b24('0xc')](_0x8b24('0x16'),_0x527af7);logger['debug'](_0x8b24('0x16'),_0x527af7,JSON[_0x8b24('0x11')](_0x2a4f2d));_0x5e3c52(_0x2a4f2d);})['catch'](function(_0xd9b96){logger[_0x8b24('0x12')](_0x8b24('0x16'),_0xd9b96[_0x8b24('0x14')],_0x527af7);_0x3b4805(_0x1bafdf[_0x8b24('0x12')](0x1f4,_0xd9b96[_0x8b24('0x14')]));});});};exports[_0x8b24('0x1a')]=function(_0x3fddf8){var _0x2e8c46=this;return new Promise(function(_0xc1dc78,_0x2dd44b){return db[_0x8b24('0x1b')][_0x8b24('0x1c')]({'raw':_0x3fddf8[_0x8b24('0x18')]?_0x3fddf8[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![],'where':_0x3fddf8[_0x8b24('0x18')]?_0x3fddf8[_0x8b24('0x18')][_0x8b24('0x1d')]||null:null,'attributes':[[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')][_0x8b24('0x20')]('id')),_0x8b24('0x21')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal'](_0x8b24('0x22')))),_0x8b24('0x23')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0x8b24('0x25')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8b24('0x26')))),_0x8b24('0x27')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x28'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x29')))),_0x8b24('0x2a')],[db['sequelize']['fn'](_0x8b24('0x28'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal'](_0x8b24('0x2b')))),_0x8b24('0x2c')]]})[_0x8b24('0xb')](function(_0x3567b2){logger[_0x8b24('0xc')](_0x8b24('0x1a'),_0x3fddf8);logger[_0x8b24('0xf')](_0x8b24('0x1a'),_0x3fddf8,JSON[_0x8b24('0x11')](_0x3567b2));_0xc1dc78(_0x3567b2);})['catch'](function(_0xdb46f5){logger[_0x8b24('0x12')]('AvgHandleTime',_0xdb46f5[_0x8b24('0x14')],_0x3fddf8);_0x2dd44b(_0x2e8c46[_0x8b24('0x12')](0x1f4,_0xdb46f5['message']));});});};exports[_0x8b24('0x2d')]=function(_0x1e9705){var _0x45ce67=this;return new Promise(function(_0xce3162,_0x51a2f3){return db[_0x8b24('0x1b')][_0x8b24('0x1c')]({'raw':_0x1e9705[_0x8b24('0x18')]?_0x1e9705[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![],'where':_0x1e9705[_0x8b24('0x18')]?_0x1e9705['options'][_0x8b24('0x1d')]||null:null,'attributes':[[_0x8b24('0x2e'),_0x8b24('0x2f')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x30')))),_0x8b24('0x31')],[db[_0x8b24('0x1e')]['fn']('COUNT',db[_0x8b24('0x1e')]['fn']('IF',db['sequelize'][_0x8b24('0x24')](_0x8b24('0x32')))),_0x8b24('0x33')],[db['sequelize']['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal'](_0x8b24('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8b24('0x24')](_0x8b24('0x34')))),_0x8b24('0x35')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x8b24('0x36')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db['sequelize'][_0x8b24('0x24')](_0x8b24('0x37')))),_0x8b24('0x38')],[db['sequelize']['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8b24('0x39')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x3a')))),_0x8b24('0x3b')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')]['literal'](_0x8b24('0x3c')))),'outboundBlacklistCallsDay'],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8b24('0x24')](_0x8b24('0x3d')))),_0x8b24('0x3e')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x8b24('0x1f'),db['sequelize']['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x3f')))),_0x8b24('0x40')],[db['sequelize']['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x41')))),_0x8b24('0x42')],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x43')))),_0x8b24('0x44')]],'group':[_0x8b24('0x2e')]})[_0x8b24('0xb')](function(_0x19bf6f){logger[_0x8b24('0xc')]('GetVoiceQueueHopperHistory',_0x1e9705);logger[_0x8b24('0xf')](_0x8b24('0x2d'),_0x1e9705,JSON[_0x8b24('0x11')](_0x19bf6f));_0xce3162(_0x19bf6f);})[_0x8b24('0x15')](function(_0x4bac9f){logger[_0x8b24('0x12')](_0x8b24('0x2d'),_0x4bac9f[_0x8b24('0x14')],_0x1e9705);_0x51a2f3(_0x45ce67[_0x8b24('0x12')](0x1f4,_0x4bac9f[_0x8b24('0x14')]));});});};exports[_0x8b24('0x45')]=function(_0x347f33){var _0x20188b=this;return new Promise(function(_0x15b96f,_0x17cf69){return db[_0x8b24('0x1b')][_0x8b24('0x1c')]({'raw':_0x347f33[_0x8b24('0x18')]?_0x347f33[_0x8b24('0x18')][_0x8b24('0x19')]===undefined?!![]:![]:!![],'where':_0x347f33[_0x8b24('0x18')]?_0x347f33['options']['where']||null:null,'attributes':[['campaign',_0x8b24('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x8b24('0x1e')][_0x8b24('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x8b24('0x1e')]['fn'](_0x8b24('0x1f'),db[_0x8b24('0x1e')]['fn']('IF',db[_0x8b24('0x1e')][_0x8b24('0x24')](_0x8b24('0x22')))),_0x8b24('0x46')]],'group':['campaign']})[_0x8b24('0xb')](function(_0x405172){logger[_0x8b24('0xc')]('GetCampaignHopperHistory',_0x347f33);logger['debug'](_0x8b24('0x45'),_0x347f33,JSON[_0x8b24('0x11')](_0x405172));_0x15b96f(_0x405172);})[_0x8b24('0x15')](function(_0x5a419c){logger[_0x8b24('0x12')]('GetCampaignHopperHistory',_0x5a419c[_0x8b24('0x14')],_0x347f33);_0x17cf69(_0x20188b[_0x8b24('0x12')](0x1f4,_0x5a419c[_0x8b24('0x14')]));});});}; \ No newline at end of file +var _0x3dbb=['sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','where','COUNT'];(function(_0x311421,_0x558f91){var _0x3b279e=function(_0xfb0a01){while(--_0xfb0a01){_0x311421['push'](_0x311421['shift']());}};_0x3b279e(++_0x558f91);}(_0x3dbb,0x67));var _0xb3db=function(_0x274e0e,_0x3aace4){_0x274e0e=_0x274e0e-0x0;var _0x4ca356=_0x3dbb[_0x274e0e];return _0x4ca356;};'use strict';var _=require(_0xb3db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb3db('0x1'));var rs=require(_0xb3db('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3db('0x3'))['db'];var utils=require(_0xb3db('0x4'));var logger=require(_0xb3db('0x5'))(_0xb3db('0x6'));var config=require('../../config/environment');var jayson=require(_0xb3db('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe5b11b,_0xb11a52,_0x3e6f98){return new BPromise(function(_0x4ab503,_0x20ae30){return client['request'](_0xe5b11b,_0x3e6f98)[_0xb3db('0x8')](function(_0x43fdd4){logger['info'](_0xb3db('0x9'),_0xb11a52,_0xb3db('0xa'));logger[_0xb3db('0xb')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xb11a52,_0xb3db('0xa'),JSON[_0xb3db('0xc')](_0x43fdd4));if(_0x43fdd4[_0xb3db('0xd')]){if(_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xe')]===0x1f4){logger['error'](_0xb3db('0x9'),_0xb11a52,_0x43fdd4['error'][_0xb3db('0xf')]);return _0x20ae30(_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xf')]);}logger['error'](_0xb3db('0x9'),_0xb11a52,_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xf')]);return _0x4ab503(_0x43fdd4['error'][_0xb3db('0xf')]);}else{logger[_0xb3db('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0xb11a52,_0xb3db('0xa'));_0x4ab503(_0x43fdd4[_0xb3db('0x11')][_0xb3db('0xf')]);}})[_0xb3db('0x12')](function(_0x38da8c){logger[_0xb3db('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0xb11a52,_0x38da8c);_0x20ae30(_0x38da8c);});});}exports[_0xb3db('0x13')]=function(_0x40939f){var _0x5dd370=this;return new Promise(function(_0x1e9e84,_0x4210aa){return db[_0xb3db('0x14')][_0xb3db('0x15')](_0x40939f[_0xb3db('0x16')],{'raw':_0x40939f['options']?_0x40939f[_0xb3db('0x17')][_0xb3db('0x18')]===undefined?!![]:![]:!![]})[_0xb3db('0x8')](function(_0x325d53){logger['info'](_0xb3db('0x13'),_0x40939f);logger[_0xb3db('0xb')](_0xb3db('0x13'),_0x40939f,JSON[_0xb3db('0xc')](_0x325d53));_0x1e9e84(_0x325d53);})[_0xb3db('0x12')](function(_0x52d719){logger[_0xb3db('0xd')]('CreateCmHopperHistory',_0x52d719[_0xb3db('0xf')],_0x40939f);_0x4210aa(_0x5dd370[_0xb3db('0xd')](0x1f4,_0x52d719[_0xb3db('0xf')]));});});};exports['AvgHandleTime']=function(_0x42cf59){var _0x391598=this;return new Promise(function(_0x46c69a,_0x2c8e16){return db[_0xb3db('0x14')]['findAll']({'raw':_0x42cf59['options']?_0x42cf59[_0xb3db('0x17')][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x42cf59[_0xb3db('0x17')]?_0x42cf59[_0xb3db('0x17')][_0xb3db('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')][_0xb3db('0x1c')]('id')),_0xb3db('0x1d')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x20')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2010,\x201,\x20null'))),_0xb3db('0x21')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xb3db('0x22')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x23'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xb3db('0x24')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x23'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x25')))),_0xb3db('0x26')]]})['then'](function(_0x5596ae){logger[_0xb3db('0x10')](_0xb3db('0x27'),_0x42cf59);logger[_0xb3db('0xb')](_0xb3db('0x27'),_0x42cf59,JSON['stringify'](_0x5596ae));_0x46c69a(_0x5596ae);})['catch'](function(_0x3e59e0){logger['error'](_0xb3db('0x27'),_0x3e59e0['message'],_0x42cf59);_0x2c8e16(_0x391598['error'](0x1f4,_0x3e59e0[_0xb3db('0xf')]));});});};exports[_0xb3db('0x28')]=function(_0x555a20){var _0x5a1880=this;return new Promise(function(_0x506f1e,_0x125a0c){return db['CmHopperHistory'][_0xb3db('0x29')]({'raw':_0x555a20[_0xb3db('0x17')]?_0x555a20['options'][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x555a20[_0xb3db('0x17')]?_0x555a20[_0xb3db('0x17')][_0xb3db('0x19')]||null:null,'attributes':[[_0xb3db('0x2a'),'name'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal'](_0xb3db('0x2b')))),_0xb3db('0x2c')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xb3db('0x2d')))),_0xb3db('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x2f')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xb3db('0x30')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x31')))),'outboundCongestionCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal'](_0xb3db('0x32')))),_0xb3db('0x33')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xb3db('0x1a'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x34')))),_0xb3db('0x35')],[db[_0xb3db('0x1b')]['fn']('COUNT',db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x36')))),_0xb3db('0x37')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x39')))),_0xb3db('0x3a')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x3b')))),_0xb3db('0x3a')],[db[_0xb3db('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xb3db('0x3c')]],'group':[_0xb3db('0x2a')]})[_0xb3db('0x8')](function(_0x4a9209){logger[_0xb3db('0x10')](_0xb3db('0x28'),_0x555a20);logger['debug'](_0xb3db('0x28'),_0x555a20,JSON[_0xb3db('0xc')](_0x4a9209));_0x506f1e(_0x4a9209);})[_0xb3db('0x12')](function(_0x31dd93){logger[_0xb3db('0xd')]('GetVoiceQueueHopperHistory',_0x31dd93['message'],_0x555a20);_0x125a0c(_0x5a1880[_0xb3db('0xd')](0x1f4,_0x31dd93[_0xb3db('0xf')]));});});};exports[_0xb3db('0x3d')]=function(_0x4be0cd){var _0xd1a45=this;return new Promise(function(_0x4cf00c,_0x329bc8){return db[_0xb3db('0x14')][_0xb3db('0x29')]({'raw':_0x4be0cd[_0xb3db('0x17')]?_0x4be0cd['options'][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x4be0cd[_0xb3db('0x17')]?_0x4be0cd['options'][_0xb3db('0x19')]||null:null,'attributes':[[_0xb3db('0x2a'),_0xb3db('0x3e')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['col']('id')),_0xb3db('0x3f')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x40')]],'group':['campaign']})[_0xb3db('0x8')](function(_0x1075fa){logger[_0xb3db('0x10')](_0xb3db('0x3d'),_0x4be0cd);logger[_0xb3db('0xb')]('GetCampaignHopperHistory',_0x4be0cd,JSON[_0xb3db('0xc')](_0x1075fa));_0x4cf00c(_0x1075fa);})[_0xb3db('0x12')](function(_0x9a62f6){logger[_0xb3db('0xd')]('GetCampaignHopperHistory',_0x9a62f6['message'],_0x4be0cd);_0x329bc8(_0xd1a45['error'](0x1f4,_0x9a62f6[_0xb3db('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 216c0de..0bdb908 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 _0x6008=['show','post','create','put','update','exports','path','express','fs-extra','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x479407,_0x136ea4){var _0x393ac0=function(_0x1fce7f){while(--_0x1fce7f){_0x479407['push'](_0x479407['shift']());}};_0x393ac0(++_0x136ea4);}(_0x6008,0x1b9));var _0x8600=function(_0x42b645,_0x193beb){_0x42b645=_0x42b645-0x0;var _0x16e5a8=_0x6008[_0x42b645];return _0x16e5a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8600('0x0'));var timeout=require('connect-timeout');var express=require(_0x8600('0x1'));var router=express['Router']();var fs_extra=require(_0x8600('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8600('0x3'));router['get']('/',auth[_0x8600('0x4')](),controller[_0x8600('0x5')]);router[_0x8600('0x6')](_0x8600('0x7'),auth[_0x8600('0x4')](),controller['describe']);router[_0x8600('0x6')](_0x8600('0x8'),auth[_0x8600('0x4')](),controller[_0x8600('0x9')]);router[_0x8600('0xa')]('/',auth[_0x8600('0x4')](),controller[_0x8600('0xb')]);router[_0x8600('0xc')](_0x8600('0x8'),auth[_0x8600('0x4')](),controller[_0x8600('0xd')]);module[_0x8600('0xe')]=router; \ No newline at end of file +var _0x2dae=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','/:id','isAuthenticated','create','put','update'];(function(_0x526753,_0x5a3c1a){var _0x52986a=function(_0x233f7c){while(--_0x233f7c){_0x526753['push'](_0x526753['shift']());}};_0x52986a(++_0x5a3c1a);}(_0x2dae,0xff));var _0xe2da=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x2dae[_0x1c5142];return _0x1268cb;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe2da('0x9')](_0xe2da('0xc'),auth[_0xe2da('0xd')](),controller['show']);router['post']('/',auth[_0xe2da('0xd')](),controller[_0xe2da('0xe')]);router[_0xe2da('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe2da('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 04e5421..c02d4cd 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 _0x0f89=['sequelize','exports','STRING'];(function(_0x54c38c,_0x11fc30){var _0xfcc1f8=function(_0x261718){while(--_0x261718){_0x54c38c['push'](_0x54c38c['shift']());}};_0xfcc1f8(++_0x11fc30);}(_0x0f89,0x111));var _0x90f8=function(_0x3a9955,_0x424c88){_0x3a9955=_0x3a9955-0x0;var _0xd9dafd=_0x0f89[_0x3a9955];return _0xd9dafd;};'use strict';var Sequelize=require(_0x90f8('0x0'));module[_0x90f8('0x1')]={'name':{'type':Sequelize[_0x90f8('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x90f8('0x2')]},'dialPrefix':{'type':Sequelize[_0x90f8('0x2')]}}; \ No newline at end of file +var _0xeddd=['name','sequelize','exports','STRING'];(function(_0xc5ce8f,_0x44c5fb){var _0x3cfb03=function(_0x461fbd){while(--_0x461fbd){_0xc5ce8f['push'](_0xc5ce8f['shift']());}};_0x3cfb03(++_0x44c5fb);}(_0xeddd,0x69));var _0xdedd=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xeddd[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0xdedd('0x0'));module[_0xdedd('0x1')]={'name':{'type':Sequelize[_0xdedd('0x2')],'unique':_0xdedd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xdedd('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 570bd00..8d52608 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 _0x2f3d=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','redis','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','get','Lists','error','stack','name','send','map','CmList','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','item','from','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','request-promise'];(function(_0x560bbf,_0x519bbe){var _0x12a2a0=function(_0x2ff0a1){while(--_0x2ff0a1){_0x560bbf['push'](_0x560bbf['shift']());}};_0x12a2a0(++_0x519bbe);}(_0x2f3d,0xa6));var _0xd2f3=function(_0x125f69,_0x201680){_0x125f69=_0x125f69-0x0;var _0x22e9ce=_0x2f3d[_0x125f69];return _0x22e9ce;};'use strict';var emlformat=require(_0xd2f3('0x0'));var rimraf=require(_0xd2f3('0x1'));var zipdir=require(_0xd2f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2f3('0x3'));var moment=require('moment');var BPromise=require(_0xd2f3('0x4'));var Mustache=require(_0xd2f3('0x5'));var util=require(_0xd2f3('0x6'));var path=require(_0xd2f3('0x7'));var sox=require(_0xd2f3('0x8'));var csv=require(_0xd2f3('0x9'));var ejs=require(_0xd2f3('0xa'));var fs=require('fs');var fs_extra=require(_0xd2f3('0xb'));var _=require(_0xd2f3('0xc'));var squel=require(_0xd2f3('0xd'));var crypto=require(_0xd2f3('0xe'));var jsforce=require(_0xd2f3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd2f3('0x9'));var querystring=require('querystring');var Papa=require(_0xd2f3('0x10'));var Redis=require(_0xd2f3('0x11'));var authService=require(_0xd2f3('0x12'));var qs=require(_0xd2f3('0x13'));var as=require(_0xd2f3('0x14'));var hardwareService=require(_0xd2f3('0x15'));var logger=require(_0xd2f3('0x16'))(_0xd2f3('0x17'));var utils=require(_0xd2f3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd2f3('0x19'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0xd2f3('0x1a')](config['redis'],{'host':_0xd2f3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2f3('0x1c')]));require(_0xd2f3('0x1d'))[_0xd2f3('0x1e')](socket);function respondWithStatusCode(_0x4f4d9b,_0x144f02){_0x144f02=_0x144f02||0xcc;return function(_0x57b0f8){if(_0x57b0f8){return _0x4f4d9b[_0xd2f3('0x1f')](_0x144f02);}return _0x4f4d9b[_0xd2f3('0x20')](_0x144f02)[_0xd2f3('0x21')]();};}function respondWithResult(_0x1d1c53,_0x28d724){_0x28d724=_0x28d724||0xc8;return function(_0x59b022){if(_0x59b022){return _0x1d1c53['status'](_0x28d724)[_0xd2f3('0x22')](_0x59b022);}};}function respondWithFilteredResult(_0x134148,_0xb0dc6a){return function(_0x51c88d){if(_0x51c88d){var _0x210148=typeof _0xb0dc6a[_0xd2f3('0x23')]===_0xd2f3('0x24')&&typeof _0xb0dc6a['limit']===_0xd2f3('0x24');var _0x53fda7=_0x51c88d['count'];var _0x3f12da=_0x210148?0x0:_0xb0dc6a[_0xd2f3('0x23')];var _0x2e562c=_0x210148?_0x51c88d['count']:_0xb0dc6a['offset']+_0xb0dc6a[_0xd2f3('0x25')];var _0x40eaf3;if(_0x2e562c>=_0x53fda7){_0x2e562c=_0x53fda7;_0x40eaf3=0xc8;}else{_0x40eaf3=0xce;}_0x134148['status'](_0x40eaf3);return _0x134148[_0xd2f3('0x26')]('Content-Range',_0x3f12da+'-'+_0x2e562c+'/'+_0x53fda7)[_0xd2f3('0x22')](_0x51c88d);}return null;};}function patchUpdates(_0x24f87a){return function(_0x5b0a13){try{jsonpatch[_0xd2f3('0x27')](_0x5b0a13,_0x24f87a,!![]);}catch(_0x4931ed){return BPromise[_0xd2f3('0x28')](_0x4931ed);}return _0x5b0a13[_0xd2f3('0x29')]();};}function saveUpdates(_0x4f7fbe,_0x5a8a58){return function(_0x389d3e){if(_0x389d3e){return _0x389d3e[_0xd2f3('0x2a')](_0x4f7fbe)[_0xd2f3('0x2b')](function(_0x3f5eda){return _0x3f5eda;});}return null;};}function removeEntity(_0x13b8de,_0x3abce0){return function(_0x3c21ed){if(_0x3c21ed){return _0x3c21ed[_0xd2f3('0x2c')]()[_0xd2f3('0x2b')](function(){var _0x5e93dd=_0x3c21ed[_0xd2f3('0x2d')]({'plain':!![]});var _0x1afe56=_0xd2f3('0x2e');return db['UserProfileResource'][_0xd2f3('0x2c')]({'where':{'type':_0x1afe56,'resourceId':_0x5e93dd['id']}})['then'](function(){return _0x3c21ed;});})['then'](function(){_0x13b8de[_0xd2f3('0x20')](0xcc)[_0xd2f3('0x21')]();});}};}function handleEntityNotFound(_0x5ef254,_0x514b65){return function(_0x2dc01c){if(!_0x2dc01c){_0x5ef254[_0xd2f3('0x1f')](0x194);}return _0x2dc01c;};}function handleError(_0x3e4458,_0x4340e2){_0x4340e2=_0x4340e2||0x1f4;return function(_0x2aae31){logger[_0xd2f3('0x2f')](_0x2aae31[_0xd2f3('0x30')]);if(_0x2aae31[_0xd2f3('0x31')]){delete _0x2aae31[_0xd2f3('0x31')];}_0x3e4458[_0xd2f3('0x20')](_0x4340e2)[_0xd2f3('0x32')](_0x2aae31);};}exports['index']=function(_0x4cf6bc,_0x3316dc){var _0x3cf2b7={},_0x5de5f1={},_0x4f8876={'count':0x0,'rows':[]};var _0x22fa5c=_[_0xd2f3('0x33')](db[_0xd2f3('0x34')][_0xd2f3('0x35')],function(_0x27ac6e){return{'name':_0x27ac6e[_0xd2f3('0x36')],'type':_0x27ac6e['type']['key']};});_0x5de5f1[_0xd2f3('0x37')]=_[_0xd2f3('0x33')](_0x22fa5c,'name');_0x5de5f1[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x4cf6bc[_0xd2f3('0x38')]);_0x5de5f1['filters']=_['intersection'](_0x5de5f1[_0xd2f3('0x37')],_0x5de5f1[_0xd2f3('0x38')]);_0x3cf2b7[_0xd2f3('0x3a')]=_[_0xd2f3('0x3b')](_0x5de5f1['model'],qs[_0xd2f3('0x3c')](_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x3c')]));_0x3cf2b7['attributes']=_0x3cf2b7[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x3cf2b7[_0xd2f3('0x3a')]:_0x5de5f1['model'];if(!_0x4cf6bc['query'][_0xd2f3('0x3e')](_0xd2f3('0x3f'))){_0x3cf2b7[_0xd2f3('0x25')]=qs[_0xd2f3('0x25')](_0x4cf6bc['query']['limit']);_0x3cf2b7[_0xd2f3('0x23')]=qs[_0xd2f3('0x23')](_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x23')]);}_0x3cf2b7[_0xd2f3('0x40')]=qs['sort'](_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x41')]);_0x3cf2b7[_0xd2f3('0x42')]=qs[_0xd2f3('0x43')](_[_0xd2f3('0x44')](_0x4cf6bc['query'],_0x5de5f1['filters']),_0x22fa5c);if(_0x4cf6bc['query'][_0xd2f3('0x45')]){_0x3cf2b7[_0xd2f3('0x42')]=_[_0xd2f3('0x46')](_0x3cf2b7[_0xd2f3('0x42')],{'$or':_[_0xd2f3('0x33')](_0x22fa5c,function(_0x251bc4){if(_0x251bc4[_0xd2f3('0x47')]!==_0xd2f3('0x48')){var _0x1e5aed={};_0x1e5aed[_0x251bc4[_0xd2f3('0x31')]]={'$like':'%'+_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x45')]+'%'};return _0x1e5aed;}})});}_0x3cf2b7=_['merge']({},_0x3cf2b7,_0x4cf6bc[_0xd2f3('0x49')]);var _0x577a24={'where':_0x3cf2b7[_0xd2f3('0x42')]};return db[_0xd2f3('0x34')][_0xd2f3('0x4a')](_0x577a24)[_0xd2f3('0x2b')](function(_0xefa2e){_0x4f8876[_0xd2f3('0x4a')]=_0xefa2e;if(_0x4cf6bc[_0xd2f3('0x38')][_0xd2f3('0x4b')]){_0x3cf2b7[_0xd2f3('0x4c')]=[{'all':!![]}];}return db[_0xd2f3('0x34')][_0xd2f3('0x4d')](_0x3cf2b7);})[_0xd2f3('0x2b')](function(_0x4bd9c7){_0x4f8876[_0xd2f3('0x4e')]=_0x4bd9c7;return _0x4f8876;})[_0xd2f3('0x2b')](respondWithFilteredResult(_0x3316dc,_0x3cf2b7))['catch'](handleError(_0x3316dc,null));};exports[_0xd2f3('0x4f')]=function(_0x151b3b,_0x4ce4f0){var _0x195b31={'raw':![],'where':{'id':_0x151b3b[_0xd2f3('0x50')]['id']}},_0x433656={};_0x433656[_0xd2f3('0x37')]=_[_0xd2f3('0x39')](db[_0xd2f3('0x34')][_0xd2f3('0x35')]);_0x433656[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x151b3b[_0xd2f3('0x38')]);_0x433656['filters']=_[_0xd2f3('0x3b')](_0x433656[_0xd2f3('0x37')],_0x433656[_0xd2f3('0x38')]);_0x195b31[_0xd2f3('0x3a')]=_[_0xd2f3('0x3b')](_0x433656['model'],qs[_0xd2f3('0x3c')](_0x151b3b[_0xd2f3('0x38')][_0xd2f3('0x3c')]));_0x195b31[_0xd2f3('0x3a')]=_0x195b31[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x195b31[_0xd2f3('0x3a')]:_0x433656[_0xd2f3('0x37')];if(_0x151b3b[_0xd2f3('0x38')]['includeAll']){_0x195b31[_0xd2f3('0x4c')]=[{'all':!![]}];}_0x195b31=_[_0xd2f3('0x46')]({},_0x195b31,_0x151b3b[_0xd2f3('0x49')]);return db['CmList'][_0xd2f3('0x51')](_0x195b31)[_0xd2f3('0x2b')](handleEntityNotFound(_0x4ce4f0,null))[_0xd2f3('0x2b')](respondWithResult(_0x4ce4f0,null))[_0xd2f3('0x52')](handleError(_0x4ce4f0,null));};exports[_0xd2f3('0x53')]=function(_0x3be6cd,_0x1a4303){return db[_0xd2f3('0x34')][_0xd2f3('0x53')](_0x3be6cd[_0xd2f3('0x54')],{})[_0xd2f3('0x2b')](function(_0x55900b){var _0x147104=_0x3be6cd[_0xd2f3('0x55')]['get']({'plain':!![]});if(!_0x147104)throw new Error(_0xd2f3('0x56'));if(_0x147104[_0xd2f3('0x57')]===_0xd2f3('0x55')){var _0x6f794d=_0x55900b[_0xd2f3('0x2d')]({'plain':!![]});var _0x33dbe1=_0xd2f3('0x2e');return db[_0xd2f3('0x58')]['find']({'where':{'name':_0x33dbe1,'userProfileId':_0x147104[_0xd2f3('0x59')]},'raw':!![]})['then'](function(_0x3ce686){if(_0x3ce686&&_0x3ce686['autoAssociation']===0x0){return db[_0xd2f3('0x5a')][_0xd2f3('0x53')]({'name':_0x6f794d[_0xd2f3('0x31')],'resourceId':_0x6f794d['id'],'type':_0x3ce686[_0xd2f3('0x31')],'sectionId':_0x3ce686['id']},{})[_0xd2f3('0x2b')](function(){return _0x55900b;});}else{return _0x55900b;}})[_0xd2f3('0x52')](function(_0x251621){logger[_0xd2f3('0x2f')](_0xd2f3('0x5b'),_0x251621);throw _0x251621;});}return _0x55900b;})['then'](respondWithResult(_0x1a4303,0xc9))['catch'](handleError(_0x1a4303,null));};exports[_0xd2f3('0x2a')]=function(_0x376d0e,_0x3ef136){if(_0x376d0e[_0xd2f3('0x54')]['id']){delete _0x376d0e['body']['id'];}return db[_0xd2f3('0x34')][_0xd2f3('0x51')]({'where':{'id':_0x376d0e[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x3ef136,null))[_0xd2f3('0x2b')](saveUpdates(_0x376d0e['body'],null))[_0xd2f3('0x2b')](respondWithResult(_0x3ef136,null))['catch'](handleError(_0x3ef136,null));};exports[_0xd2f3('0x2c')]=function(_0x32c651,_0x177047){return db['CmList'][_0xd2f3('0x51')]({'where':{'id':_0x32c651[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x177047,null))['then'](removeEntity(_0x177047,null))[_0xd2f3('0x52')](handleError(_0x177047,null));};exports[_0xd2f3('0x5c')]=function(_0x3093c2,_0x2c7048){return db['CmList'][_0xd2f3('0x5c')]()[_0xd2f3('0x2b')](respondWithResult(_0x2c7048,null))[_0xd2f3('0x52')](handleError(_0x2c7048,null));};exports['addDisposition']=function(_0x3e9cc9,_0x2878db,_0x5e0a5e){if(_0x3e9cc9[_0xd2f3('0x54')]['id']){delete _0x3e9cc9['body']['id'];}return db[_0xd2f3('0x34')][_0xd2f3('0x51')]({'where':{'id':_0x3e9cc9[_0xd2f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x2878db,null))['then'](function(_0x5365f2){if(_0x5365f2){_0x3e9cc9[_0xd2f3('0x54')][_0xd2f3('0x5d')]=_0x5365f2['id'];return db[_0xd2f3('0x5e')][_0xd2f3('0x53')](_0x3e9cc9['body']);}})['then'](respondWithResult(_0x2878db,null))[_0xd2f3('0x52')](handleError(_0x2878db,null));};exports[_0xd2f3('0x5f')]=function(_0x1beb39,_0x1c1a4a,_0x26735f){var _0x4d496b={'raw':![],'where':{}};var _0x48f59c={};var _0x166bac={'count':0x0,'rows':[]};return db[_0xd2f3('0x34')][_0xd2f3('0x60')]({'where':{'id':_0x1beb39[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x1c1a4a,null))[_0xd2f3('0x2b')](function(_0x25116a){if(_0x25116a){_0x48f59c[_0xd2f3('0x37')]=_['keys'](db[_0xd2f3('0x5e')][_0xd2f3('0x35')]);_0x48f59c[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x1beb39['query']);_0x48f59c[_0xd2f3('0x43')]=_[_0xd2f3('0x3b')](_0x48f59c[_0xd2f3('0x37')],_0x48f59c[_0xd2f3('0x38')]);_0x4d496b[_0xd2f3('0x3a')]=_['intersection'](_0x48f59c[_0xd2f3('0x37')],qs['fields'](_0x1beb39[_0xd2f3('0x38')][_0xd2f3('0x3c')]));_0x4d496b[_0xd2f3('0x3a')]=_0x4d496b[_0xd2f3('0x3a')]['length']?_0x4d496b[_0xd2f3('0x3a')]:_0x48f59c[_0xd2f3('0x37')];if(!_0x1beb39[_0xd2f3('0x38')]['hasOwnProperty'](_0xd2f3('0x3f'))){_0x4d496b[_0xd2f3('0x25')]=qs[_0xd2f3('0x25')](_0x1beb39['query']['limit']);_0x4d496b[_0xd2f3('0x23')]=qs[_0xd2f3('0x23')](_0x1beb39['query'][_0xd2f3('0x23')]);}_0x4d496b[_0xd2f3('0x40')]=qs[_0xd2f3('0x41')](_0x1beb39[_0xd2f3('0x38')]['sort']);_0x4d496b[_0xd2f3('0x42')]=qs[_0xd2f3('0x43')](_[_0xd2f3('0x44')](_0x1beb39[_0xd2f3('0x38')],_0x48f59c[_0xd2f3('0x43')]));_0x4d496b[_0xd2f3('0x42')][_0xd2f3('0x5d')]=_0x25116a['id'];if(_0x1beb39[_0xd2f3('0x38')][_0xd2f3('0x45')]){_0x4d496b['where']=_[_0xd2f3('0x46')](_0x4d496b[_0xd2f3('0x42')],{'$or':_[_0xd2f3('0x33')](_0x4d496b[_0xd2f3('0x3a')],function(_0x688eb7){var _0x58845b={};_0x58845b[_0x688eb7]={'$like':'%'+_0x1beb39['query'][_0xd2f3('0x45')]+'%'};return _0x58845b;})});}_0x4d496b=_['merge']({},_0x4d496b,_0x1beb39[_0xd2f3('0x49')]);return db['Disposition'][_0xd2f3('0x4a')]({'where':_0x4d496b[_0xd2f3('0x42')]})[_0xd2f3('0x2b')](function(_0x5caf89){_0x166bac[_0xd2f3('0x4a')]=_0x5caf89;if(_0x1beb39['query']['includeAll']){_0x4d496b['include']=[{'all':!![]}];}return db['Disposition'][_0xd2f3('0x4d')](_0x4d496b);})[_0xd2f3('0x2b')](function(_0xbed3a9){_0x166bac[_0xd2f3('0x4e')]=_0xbed3a9;return _0x166bac;});}})[_0xd2f3('0x2b')](respondWithFilteredResult(_0x1c1a4a,_0x4d496b))['catch'](handleError(_0x1c1a4a,null));};exports[_0xd2f3('0x61')]=function(_0x5a9628,_0x560af6,_0x151d90){return db['CmList'][_0xd2f3('0x51')]({'where':{'id':_0x5a9628['params']['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x560af6,null))[_0xd2f3('0x2b')](function(_0xfe57e3){if(_0xfe57e3){return _0xfe57e3[_0xd2f3('0x61')](_0x5a9628['query'][_0xd2f3('0x62')]);}})[_0xd2f3('0x2b')](respondWithStatusCode(_0x560af6,null))[_0xd2f3('0x52')](handleError(_0x560af6,null));};exports[_0xd2f3('0x63')]=function(_0x3c014c,_0x417867,_0x14ad73){return db[_0xd2f3('0x34')][_0xd2f3('0x51')]({'where':{'id':_0x3c014c[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x417867,null))['then'](function(_0x180a06){if(_0x180a06){var _0x518dcc=[];var _0x26dba2={'success':[],'errors':[]};return db[_0xd2f3('0x64')]['describe']()['then'](function(_0x57d421){if(_0x3c014c[_0xd2f3('0x54')][_0xd2f3('0x65')]&&_[_0xd2f3('0x66')](_0x3c014c['body'][_0xd2f3('0x65')])){if(_0x3c014c['body'][_0xd2f3('0x65')][_0xd2f3('0x3d')]){_0x3c014c[_0xd2f3('0x54')][_0xd2f3('0x65')]=_0x3c014c['body']['tags'][_0xd2f3('0x67')](';')+';';}else{_0x3c014c['body'][_0xd2f3('0x65')]=null;}}else{_0x3c014c['body'][_0xd2f3('0x65')]=null;}if(_0x3c014c[_0xd2f3('0x54')]&&_[_0xd2f3('0x66')](_0x3c014c[_0xd2f3('0x54')])){for(var _0x4b305c=0x0;_0x4b305c<_0x3c014c[_0xd2f3('0x54')][_0xd2f3('0x3d')];_0x4b305c+=0x1){_0x3c014c[_0xd2f3('0x54')][_0x4b305c][_0xd2f3('0x5d')]=_0x3c014c[_0xd2f3('0x50')]['id'];_0x518dcc[_0xd2f3('0x68')](_0x3c014c['body'][_0x4b305c]);}return BPromise[_0xd2f3('0x69')](_0x518dcc,function(_0x5c75ed){return db[_0xd2f3('0x64')]['create'](_[_0xd2f3('0x6a')](_0x5c75ed,['ids','id'])||{},{'fields':_['keys'](_0x57d421),'raw':!![]})[_0xd2f3('0x2b')](function(_0x41381a){_0x26dba2['success']['push'](_0x41381a[_0xd2f3('0x6b')]);})['catch'](function(_0x5d0176){_0x26dba2[_0xd2f3('0x6c')]['push']({'data':_0x5c75ed,'error':_0x5d0176[_0xd2f3('0x6d')]});});})[_0xd2f3('0x2b')](function(_0x35d387){return _0x26dba2;})['catch'](function(_0x18f3a4){return _0x18f3a4;});}else{_0x417867['status'](0x190)['json']({'message':_0xd2f3('0x6e')});}});}})[_0xd2f3('0x2b')](respondWithResult(_0x417867,null))[_0xd2f3('0x52')](handleError(_0x417867,null));};exports[_0xd2f3('0x6f')]=function(_0x62abbf,_0x1122da,_0x5c7650){var _0x28869c;return db[_0xd2f3('0x34')]['find']({'where':{'id':_0x62abbf[_0xd2f3('0x50')]['id']},'include':[{'model':db[_0xd2f3('0x70')],'as':_0xd2f3('0x71')}]})['then'](handleEntityNotFound(_0x1122da,null))[_0xd2f3('0x2b')](function(_0x16092a){if(_0x16092a){_0x28869c=_0x16092a;return db[_0xd2f3('0x64')][_0xd2f3('0x35')];}})[_0xd2f3('0x2b')](function(_0x436861){if(_0x436861){var _0x41c560={};var _0x487128={};_0x487128[_0xd2f3('0x37')]=_[_0xd2f3('0x72')](_['keys'](_0x436861),_[_0xd2f3('0x33')](_0x28869c[_0xd2f3('0x71')],function(_0x1f829c){return util['format'](_0xd2f3('0x73'),_0x1f829c['id']);}));_0x487128[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x62abbf[_0xd2f3('0x38')]);_0x487128[_0xd2f3('0x43')]=_['intersection'](_0x487128[_0xd2f3('0x37')],_0x487128[_0xd2f3('0x38')]);_0x41c560[_0xd2f3('0x3a')]=_[_0xd2f3('0x3b')](_0x487128['model'],qs['fields'](_0x62abbf['query'][_0xd2f3('0x3c')]));_0x41c560[_0xd2f3('0x3a')]=_0x41c560[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x41c560[_0xd2f3('0x3a')]:_0x487128[_0xd2f3('0x37')];if(!_0x62abbf[_0xd2f3('0x38')][_0xd2f3('0x3e')]('nolimit')){_0x41c560['limit']=qs[_0xd2f3('0x25')](_0x62abbf[_0xd2f3('0x38')][_0xd2f3('0x25')]);_0x41c560[_0xd2f3('0x23')]=qs[_0xd2f3('0x23')](_0x62abbf['query'][_0xd2f3('0x23')]);}_0x41c560[_0xd2f3('0x40')]=qs['sort'](_0x62abbf['query']['sort']);_0x41c560[_0xd2f3('0x42')]=qs[_0xd2f3('0x43')](_[_0xd2f3('0x44')](_0x62abbf['query'],_0x487128[_0xd2f3('0x43')]));_0x41c560[_0xd2f3('0x74')]=!![];if(_0x62abbf[_0xd2f3('0x38')][_0xd2f3('0x45')]){_0x41c560['where']=_[_0xd2f3('0x46')](_0x41c560[_0xd2f3('0x42')],{'$or':_[_0xd2f3('0x33')](_0x41c560[_0xd2f3('0x3a')],function(_0x4e6a2b){var _0x300d5d={};_0x300d5d[_0x4e6a2b]={'$like':'%'+_0x62abbf[_0xd2f3('0x38')]['filter']+'%'};return _0x300d5d;})});}_0x41c560=_[_0xd2f3('0x46')]({},_0x41c560,_0x62abbf[_0xd2f3('0x49')]);return _0x28869c[_0xd2f3('0x6f')](_0x41c560);}})[_0xd2f3('0x2b')](respondWithResult(_0x1122da,null))[_0xd2f3('0x52')](handleError(_0x1122da,null));};exports[_0xd2f3('0x75')]=function(_0x38cbf1,_0x42ad67,_0x3fa609){var _0x17b976;var _0x177951;var _0x4ef399;var _0x1b5e3c=_0x38cbf1[_0xd2f3('0x50')]['id'];csv_results=[];return db[_0xd2f3('0x76')]['findAll']({'attributes':['id',_0xd2f3('0x31')],'raw':!![],'order':[_0xd2f3('0x77')]})['then'](function(_0x2e1d3e){_0x17b976=_0x2e1d3e;var _0x3cc641=_[_0xd2f3('0x39')](db[_0xd2f3('0x64')][_0xd2f3('0x35')]);return db[_0xd2f3('0x70')]['findAll']({'raw':!![],'attributes':['id',_0xd2f3('0x78')]})['then'](function(_0x4e21a7){_0x177951=_0x4e21a7;var _0x150455=squel[_0xd2f3('0x79')]()[_0xd2f3('0x3c')](_0x3cc641)['from']('cm_contacts','c')[_0xd2f3('0x42')](_0xd2f3('0x7a'),_0x1b5e3c)[_0xd2f3('0x42')](_0xd2f3('0x7b'))[_0xd2f3('0x7c')]();for(var _0xaee747=0x0;_0xaee747<_0x177951[_0xd2f3('0x3d')];_0xaee747++){_0x150455[_0xd2f3('0x7d')](_0xd2f3('0x7e')+_0x177951[_0xaee747]['id'],'customField_'+_0x177951[_0xaee747]['alias']);}for(var _0xaee747=0x0;_0xaee747<_0x17b976[_0xd2f3('0x3d')];_0xaee747++){_0x150455['field'](squel['select']()['field'](_0xd2f3('0x7f'))[_0xd2f3('0x80')](_0xd2f3('0x81'))[_0xd2f3('0x42')]('ItemTypeId\x20=\x20?',_0x17b976[_0xaee747]['id'])['where']('CmContactId\x20=\x20c.id'),_0xd2f3('0x82')+_0x17b976[_0xaee747][_0xd2f3('0x31')]);_0x150455['field'](squel['select']()[_0xd2f3('0x7d')](_0xd2f3('0x83'))[_0xd2f3('0x80')](_0xd2f3('0x81'))['where'](_0xd2f3('0x84'),_0x17b976[_0xaee747]['id'])['where'](_0xd2f3('0x85')),_0xd2f3('0x86')+_0x17b976[_0xaee747]['name']);}var _0x33c5ff=[];_0x33c5ff[_0xd2f3('0x68')](_0x150455['toString']());BPromise[_0xd2f3('0x69')](_0x33c5ff,handleQuery)[_0xd2f3('0x2b')](function(_0x531bb5){handleQuery(_0x150455[_0xd2f3('0x87')]());var _0x35bba5=csv_results[0x0];if(!_['isEmpty'](_0x35bba5)){var _0x101abf=toCsv(_0x35bba5);var _0x1e4db5=Date[_0xd2f3('0x88')]();fs[_0xd2f3('0x89')](util[_0xd2f3('0x8a')]('/tmp/list_%d_%s.csv',_0x1b5e3c,_0x1e4db5),_0x101abf);_0x42ad67[_0xd2f3('0x8b')](_0xd2f3('0x8c'),_0xd2f3('0x8d')+util['format']('list_%d_%s.csv',_0x1b5e3c,_0x1e4db5));_0x42ad67[_0xd2f3('0x8b')](_0xd2f3('0x8e'),'text/csv');return _0x42ad67[_0xd2f3('0x8f')](util[_0xd2f3('0x8a')](_0xd2f3('0x90'),_0x1b5e3c,_0x1e4db5));}else{return _0x42ad67[_0xd2f3('0x1f')](0xcc);}});});});};exports[_0xd2f3('0x91')]=function(_0x5ab875,_0x2a3cc3,_0x12f552){var _0x37bd30;delete _0x5ab875[_0xd2f3('0x54')]['id'];return db[_0xd2f3('0x34')][_0xd2f3('0x60')]({'where':{'id':_0x5ab875[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x2a3cc3,null))[_0xd2f3('0x2b')](function(_0x3990a0){if(_0x3990a0){return db[_0xd2f3('0x92')]['transaction'](function(_0x1217a4){return db[_0xd2f3('0x70')][_0xd2f3('0x53')](_0x5ab875[_0xd2f3('0x54')],{'transaction':_0x1217a4})[_0xd2f3('0x2b')](function(_0x8b4eb2){_0x37bd30=_0x8b4eb2;return _0x3990a0[_0xd2f3('0x93')](_0x8b4eb2,{'transaction':_0x1217a4});})[_0xd2f3('0x2b')](function(){var _0x206c01={'type':db[_0xd2f3('0x94')][_0xd2f3('0x95')],'transaction':_0x1217a4};switch(_0x5ab875[_0xd2f3('0x54')][_0xd2f3('0x47')]){case _0xd2f3('0x96'):_0x206c01[_0xd2f3('0x47')]=db[_0xd2f3('0x94')][_0xd2f3('0x95')];break;case _0xd2f3('0x97'):_0x206c01[_0xd2f3('0x47')]=db[_0xd2f3('0x94')]['INTEGER'];break;case _0xd2f3('0x98'):_0x206c01[_0xd2f3('0x47')]=db[_0xd2f3('0x94')]['BOOLEAN'];_0x206c01[_0xd2f3('0x99')]=![];break;default:}return db['sequelize'][_0xd2f3('0x9a')][_0xd2f3('0x9b')](_0xd2f3('0x9c'),util[_0xd2f3('0x8a')](_0xd2f3('0x9d'),_0x37bd30['id']),_0x206c01);})[_0xd2f3('0x2b')](function(){return _0x37bd30;});});}})[_0xd2f3('0x2b')](respondWithResult(_0x2a3cc3,null))[_0xd2f3('0x52')](handleError(_0x2a3cc3,null));};exports[_0xd2f3('0x9e')]=function(_0x150b14,_0x31a06e,_0x1d8340){var _0x16938f={};var _0x501bca={};var _0x498396;var _0x27457b;return db[_0xd2f3('0x34')][_0xd2f3('0x60')]({'where':{'id':_0x150b14['params']['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x31a06e,null))['then'](function(_0x3ee77d){if(_0x3ee77d){_0x498396=_0x3ee77d;_0x501bca[_0xd2f3('0x37')]=_[_0xd2f3('0x39')](db[_0xd2f3('0x70')][_0xd2f3('0x35')]);_0x501bca[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x150b14[_0xd2f3('0x38')]);_0x501bca[_0xd2f3('0x43')]=_[_0xd2f3('0x3b')](_0x501bca[_0xd2f3('0x37')],_0x501bca[_0xd2f3('0x38')]);_0x16938f[_0xd2f3('0x3a')]=_[_0xd2f3('0x3b')](_0x501bca['model'],qs['fields'](_0x150b14[_0xd2f3('0x38')][_0xd2f3('0x3c')]));_0x16938f[_0xd2f3('0x3a')]=_0x16938f[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x16938f[_0xd2f3('0x3a')]:_0x501bca[_0xd2f3('0x37')];_0x16938f['order']=qs[_0xd2f3('0x41')](_0x150b14['query'][_0xd2f3('0x41')]);_0x16938f['where']=qs['filters'](_['pick'](_0x150b14[_0xd2f3('0x38')],_0x501bca[_0xd2f3('0x43')]));_0x16938f[_0xd2f3('0x42')]=_['merge'](_0x16938f[_0xd2f3('0x42')],{'$or':[{'ListId':_0x3ee77d['id']},{'ListId':null}]});if(_0x150b14[_0xd2f3('0x38')][_0xd2f3('0x45')]){_0x16938f['where']=_[_0xd2f3('0x46')](_0x16938f[_0xd2f3('0x42')],{'$or':_[_0xd2f3('0x33')](_0x16938f[_0xd2f3('0x3a')],function(_0x2e8c12){var _0x2bc1bb={};_0x2bc1bb[_0x2e8c12]={'$like':'%'+_0x150b14['query'][_0xd2f3('0x45')]+'%'};return _0x2bc1bb;})});}_0x16938f=_['merge']({},_0x16938f,_0x150b14[_0xd2f3('0x49')]);return db[_0xd2f3('0x70')][_0xd2f3('0x9f')](_0x16938f);}})[_0xd2f3('0x2b')](respondWithResult(_0x31a06e,null))['catch'](handleError(_0x31a06e,null));};exports[_0xd2f3('0xa0')]=function(_0x4c9382,_0x1b8ca3){return db[_0xd2f3('0x70')][_0xd2f3('0x9f')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x1b8ca3,null))[_0xd2f3('0x2b')](function(_0x46a7e9){return _0x46a7e9;})[_0xd2f3('0x2b')](respondWithResult(_0x1b8ca3,null))[_0xd2f3('0x52')](handleError(_0x1b8ca3,null));};exports[_0xd2f3('0xa1')]=function(_0x43e9ad,_0x2c0f21,_0x516217){return db[_0xd2f3('0x34')]['find']({'where':{'id':_0x43e9ad[_0xd2f3('0x50')]['id']}})[_0xd2f3('0x2b')](handleEntityNotFound(_0x2c0f21,null))['then'](function(_0x339f4f){if(_0x339f4f){return _0x339f4f[_0xd2f3('0xa1')](_0x43e9ad[_0xd2f3('0x54')]['ids'],_['omit'](_0x43e9ad['body'],['ids','id'])||{})[_0xd2f3('0xa2')](function(_0x1a61be){for(var _0x4904fc=0x0;_0x4904fc<_0x43e9ad[_0xd2f3('0x54')][_0xd2f3('0x62')]['length'];_0x4904fc+=0x1){socket[_0xd2f3('0xa3')](_0xd2f3('0xa4'),{'UserId':Number(_0x43e9ad['body'][_0xd2f3('0x62')][_0x4904fc]),'CmListId':Number(_0x43e9ad[_0xd2f3('0x50')]['id'])});}return _0x1a61be;});}})[_0xd2f3('0x2b')](respondWithResult(_0x2c0f21,null))[_0xd2f3('0x52')](handleError(_0x2c0f21,null));};exports[_0xd2f3('0xa5')]=function(_0x105ac9,_0x507aae,_0x5d095c){return db[_0xd2f3('0x34')][_0xd2f3('0x51')]({'where':{'id':_0x105ac9[_0xd2f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x507aae,null))['then'](function(_0x25fc18){if(_0x25fc18){return _0x25fc18[_0xd2f3('0xa5')](_0x105ac9[_0xd2f3('0x38')][_0xd2f3('0x62')])['then'](function(){if(_['isArray'](_0x105ac9[_0xd2f3('0x38')][_0xd2f3('0x62')])){for(var _0x15bb20=0x0;_0x15bb20<_0x105ac9['query'][_0xd2f3('0x62')]['length'];_0x15bb20+=0x1){socket[_0xd2f3('0xa3')]('userCmList:remove',{'UserId':Number(_0x105ac9[_0xd2f3('0x38')][_0xd2f3('0x62')][_0x15bb20]),'CmListId':Number(_0x105ac9[_0xd2f3('0x50')]['id'])});}}else{socket['emit'](_0xd2f3('0xa6'),{'UserId':Number(_0x105ac9['query'][_0xd2f3('0x62')]),'CmListId':Number(_0x105ac9[_0xd2f3('0x50')]['id'])});}});}})[_0xd2f3('0x2b')](respondWithStatusCode(_0x507aae,null))[_0xd2f3('0x52')](handleError(_0x507aae,null));};exports[_0xd2f3('0xa7')]=function(_0x18d60e,_0x51b448,_0x1fd926){var _0x1cce7e={};var _0x534648={};var _0x35a6b0;var _0x368891;return db['CmList'][_0xd2f3('0x60')]({'where':{'id':_0x18d60e['params']['id']}})['then'](handleEntityNotFound(_0x51b448,null))[_0xd2f3('0x2b')](function(_0x28342b){if(_0x28342b){_0x35a6b0=_0x28342b;_0x534648[_0xd2f3('0x37')]=_[_0xd2f3('0x39')](db[_0xd2f3('0xa8')][_0xd2f3('0x35')]);_0x534648[_0xd2f3('0x38')]=_[_0xd2f3('0x39')](_0x18d60e[_0xd2f3('0x38')]);_0x534648[_0xd2f3('0x43')]=_[_0xd2f3('0x3b')](_0x534648[_0xd2f3('0x37')],_0x534648[_0xd2f3('0x38')]);_0x1cce7e[_0xd2f3('0x3a')]=_['intersection'](_0x534648[_0xd2f3('0x37')],qs['fields'](_0x18d60e['query'][_0xd2f3('0x3c')]));_0x1cce7e[_0xd2f3('0x3a')]=_0x1cce7e[_0xd2f3('0x3a')][_0xd2f3('0x3d')]?_0x1cce7e[_0xd2f3('0x3a')]:_0x534648[_0xd2f3('0x37')];_0x1cce7e[_0xd2f3('0x40')]=qs[_0xd2f3('0x41')](_0x18d60e['query'][_0xd2f3('0x41')]);_0x1cce7e['where']=qs['filters'](_['pick'](_0x18d60e[_0xd2f3('0x38')],_0x534648['filters']));if(_0x18d60e[_0xd2f3('0x38')][_0xd2f3('0x45')]){_0x1cce7e[_0xd2f3('0x42')]=_[_0xd2f3('0x46')](_0x1cce7e[_0xd2f3('0x42')],{'$or':_['map'](_0x1cce7e[_0xd2f3('0x3a')],function(_0x4a2d7d){var _0xafc5fd={};_0xafc5fd[_0x4a2d7d]={'$like':'%'+_0x18d60e['query'][_0xd2f3('0x45')]+'%'};return _0xafc5fd;})});}_0x1cce7e=_['merge']({},_0x1cce7e,_0x18d60e[_0xd2f3('0x49')]);return _0x35a6b0[_0xd2f3('0xa7')](_0x1cce7e);}})[_0xd2f3('0x2b')](function(_0x5e5ff7){if(_0x5e5ff7){_0x368891=_0x5e5ff7[_0xd2f3('0x3d')];if(!_0x18d60e['query'][_0xd2f3('0x3e')](_0xd2f3('0x3f'))){_0x1cce7e[_0xd2f3('0x25')]=qs['limit'](_0x18d60e[_0xd2f3('0x38')][_0xd2f3('0x25')]);_0x1cce7e[_0xd2f3('0x23')]=qs[_0xd2f3('0x23')](_0x18d60e[_0xd2f3('0x38')][_0xd2f3('0x23')]);}return _0x35a6b0[_0xd2f3('0xa7')](_0x1cce7e);}})['then'](function(_0x33727a){if(_0x33727a){return _0x33727a?{'count':_0x368891,'rows':_0x33727a}:null;}})[_0xd2f3('0x2b')](respondWithResult(_0x51b448,null))[_0xd2f3('0x52')](handleError(_0x51b448,null));};function handleQuery(_0x45ee1d){logger[_0xd2f3('0xa9')](_0x45ee1d);return db[_0xd2f3('0x92')][_0xd2f3('0x38')](_0x45ee1d)[_0xd2f3('0xa2')](function(_0x3594d5){csv_results[_0xd2f3('0x68')](_0x3594d5);})[_0xd2f3('0x52')](function(_0x18b44f){logger[_0xd2f3('0x2f')](_0x18b44f[_0xd2f3('0x6d')]);});} \ No newline at end of file +var _0x954d=['end','status','json','offset','undefined','limit','count','set','reject','save','update','then','get','Lists','UserProfileResource','destroy','stack','name','send','map','CmList','rawAttributes','key','model','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','includeAll','include','findAll','rows','catch','show','params','fields','length','options','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','order','removeDispositions','ids','tags','join','isArray','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','CmContact','concat','format','raw','getContactsCsv','ContactItemType','OrderBy','select','from','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','alias','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','findOne','sequelize','transaction','addCustomFields','text','TEXT','number','Sequelize','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','squel','crypto','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','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus'];(function(_0x3a19ac,_0x484eff){var _0x2d7461=function(_0x1aeb9d){while(--_0x1aeb9d){_0x3a19ac['push'](_0x3a19ac['shift']());}};_0x2d7461(++_0x484eff);}(_0x954d,0x129));var _0xd954=function(_0x13ce0f,_0x354d4c){_0x13ce0f=_0x13ce0f-0x0;var _0x1beae8=_0x954d[_0x13ce0f];return _0x1beae8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd954('0x0'));var zipdir=require(_0xd954('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd954('0x2'));var moment=require(_0xd954('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd954('0x4'));var path=require(_0xd954('0x5'));var sox=require(_0xd954('0x6'));var csv=require('to-csv');var ejs=require(_0xd954('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd954('0x8'));var crypto=require(_0xd954('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd954('0xa'));var toCsv=require(_0xd954('0xb'));var querystring=require(_0xd954('0xc'));var Papa=require(_0xd954('0xd'));var Redis=require(_0xd954('0xe'));var authService=require(_0xd954('0xf'));var qs=require(_0xd954('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd954('0x11'));var logger=require(_0xd954('0x12'))(_0xd954('0x13'));var utils=require(_0xd954('0x14'));var config=require(_0xd954('0x15'));var licenseUtil=require(_0xd954('0x16'));var db=require(_0xd954('0x17'))['db'];var csv_results;config[_0xd954('0x18')]=_[_0xd954('0x19')](config[_0xd954('0x18')],{'host':_0xd954('0x1a'),'port':0x18eb});var socket=require(_0xd954('0x1b'))(new Redis(config[_0xd954('0x18')]));require(_0xd954('0x1c'))[_0xd954('0x1d')](socket);function respondWithStatusCode(_0x5ba256,_0x2135d4){_0x2135d4=_0x2135d4||0xcc;return function(_0x3092fd){if(_0x3092fd){return _0x5ba256[_0xd954('0x1e')](_0x2135d4);}return _0x5ba256['status'](_0x2135d4)[_0xd954('0x1f')]();};}function respondWithResult(_0x39c0e6,_0x35e8e6){_0x35e8e6=_0x35e8e6||0xc8;return function(_0x3cf567){if(_0x3cf567){return _0x39c0e6[_0xd954('0x20')](_0x35e8e6)[_0xd954('0x21')](_0x3cf567);}};}function respondWithFilteredResult(_0x23260d,_0x397a51){return function(_0x58bd75){if(_0x58bd75){var _0x3cf7e4=typeof _0x397a51[_0xd954('0x22')]===_0xd954('0x23')&&typeof _0x397a51[_0xd954('0x24')]===_0xd954('0x23');var _0x481176=_0x58bd75[_0xd954('0x25')];var _0x1b21d3=_0x3cf7e4?0x0:_0x397a51['offset'];var _0x137dca=_0x3cf7e4?_0x58bd75[_0xd954('0x25')]:_0x397a51[_0xd954('0x22')]+_0x397a51[_0xd954('0x24')];var _0x3180ef;if(_0x137dca>=_0x481176){_0x137dca=_0x481176;_0x3180ef=0xc8;}else{_0x3180ef=0xce;}_0x23260d['status'](_0x3180ef);return _0x23260d[_0xd954('0x26')]('Content-Range',_0x1b21d3+'-'+_0x137dca+'/'+_0x481176)[_0xd954('0x21')](_0x58bd75);}return null;};}function patchUpdates(_0x482844){return function(_0x1ae683){try{jsonpatch['apply'](_0x1ae683,_0x482844,!![]);}catch(_0x537fdd){return BPromise[_0xd954('0x27')](_0x537fdd);}return _0x1ae683[_0xd954('0x28')]();};}function saveUpdates(_0x3145f4,_0x3e3b49){return function(_0x102288){if(_0x102288){return _0x102288[_0xd954('0x29')](_0x3145f4)[_0xd954('0x2a')](function(_0x4f4f81){return _0x4f4f81;});}return null;};}function removeEntity(_0x56a9c5,_0x593fe0){return function(_0x436b8e){if(_0x436b8e){return _0x436b8e['destroy']()[_0xd954('0x2a')](function(){var _0x2d2545=_0x436b8e[_0xd954('0x2b')]({'plain':!![]});var _0x1eb95c=_0xd954('0x2c');return db[_0xd954('0x2d')][_0xd954('0x2e')]({'where':{'type':_0x1eb95c,'resourceId':_0x2d2545['id']}})[_0xd954('0x2a')](function(){return _0x436b8e;});})[_0xd954('0x2a')](function(){_0x56a9c5[_0xd954('0x20')](0xcc)[_0xd954('0x1f')]();});}};}function handleEntityNotFound(_0x354d1a,_0x32e688){return function(_0x1838b3){if(!_0x1838b3){_0x354d1a[_0xd954('0x1e')](0x194);}return _0x1838b3;};}function handleError(_0x540813,_0x1a8c88){_0x1a8c88=_0x1a8c88||0x1f4;return function(_0x3726aa){logger['error'](_0x3726aa[_0xd954('0x2f')]);if(_0x3726aa[_0xd954('0x30')]){delete _0x3726aa['name'];}_0x540813['status'](_0x1a8c88)[_0xd954('0x31')](_0x3726aa);};}exports['index']=function(_0x35f6d2,_0x8ec05f){var _0xcf0628={},_0x27f0bb={},_0x414c06={'count':0x0,'rows':[]};var _0x464e80=_[_0xd954('0x32')](db[_0xd954('0x33')][_0xd954('0x34')],function(_0x1c637e){return{'name':_0x1c637e['fieldName'],'type':_0x1c637e['type'][_0xd954('0x35')]};});_0x27f0bb[_0xd954('0x36')]=_['map'](_0x464e80,_0xd954('0x30'));_0x27f0bb['query']=_[_0xd954('0x37')](_0x35f6d2[_0xd954('0x38')]);_0x27f0bb[_0xd954('0x39')]=_['intersection'](_0x27f0bb['model'],_0x27f0bb[_0xd954('0x38')]);_0xcf0628[_0xd954('0x3a')]=_[_0xd954('0x3b')](_0x27f0bb['model'],qs['fields'](_0x35f6d2['query']['fields']));_0xcf0628['attributes']=_0xcf0628[_0xd954('0x3a')]['length']?_0xcf0628[_0xd954('0x3a')]:_0x27f0bb[_0xd954('0x36')];if(!_0x35f6d2[_0xd954('0x38')][_0xd954('0x3c')](_0xd954('0x3d'))){_0xcf0628[_0xd954('0x24')]=qs['limit'](_0x35f6d2['query'][_0xd954('0x24')]);_0xcf0628[_0xd954('0x22')]=qs[_0xd954('0x22')](_0x35f6d2['query'][_0xd954('0x22')]);}_0xcf0628['order']=qs[_0xd954('0x3e')](_0x35f6d2['query'][_0xd954('0x3e')]);_0xcf0628[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0x35f6d2[_0xd954('0x38')],_0x27f0bb[_0xd954('0x39')]),_0x464e80);if(_0x35f6d2[_0xd954('0x38')][_0xd954('0x41')]){_0xcf0628[_0xd954('0x3f')]=_['merge'](_0xcf0628[_0xd954('0x3f')],{'$or':_[_0xd954('0x32')](_0x464e80,function(_0x548daa){if(_0x548daa[_0xd954('0x42')]!=='VIRTUAL'){var _0x13af9a={};_0x13af9a[_0x548daa['name']]={'$like':'%'+_0x35f6d2[_0xd954('0x38')][_0xd954('0x41')]+'%'};return _0x13af9a;}})});}_0xcf0628=_[_0xd954('0x43')]({},_0xcf0628,_0x35f6d2['options']);var _0x22f1d9={'where':_0xcf0628[_0xd954('0x3f')]};return db[_0xd954('0x33')][_0xd954('0x25')](_0x22f1d9)[_0xd954('0x2a')](function(_0x37e3b1){_0x414c06['count']=_0x37e3b1;if(_0x35f6d2[_0xd954('0x38')][_0xd954('0x44')]){_0xcf0628[_0xd954('0x45')]=[{'all':!![]}];}return db[_0xd954('0x33')][_0xd954('0x46')](_0xcf0628);})[_0xd954('0x2a')](function(_0x2d1af2){_0x414c06[_0xd954('0x47')]=_0x2d1af2;return _0x414c06;})['then'](respondWithFilteredResult(_0x8ec05f,_0xcf0628))[_0xd954('0x48')](handleError(_0x8ec05f,null));};exports[_0xd954('0x49')]=function(_0x38f746,_0x1a585e){var _0x1759ce={'raw':![],'where':{'id':_0x38f746[_0xd954('0x4a')]['id']}},_0x549926={};_0x549926['model']=_[_0xd954('0x37')](db[_0xd954('0x33')]['rawAttributes']);_0x549926[_0xd954('0x38')]=_[_0xd954('0x37')](_0x38f746['query']);_0x549926[_0xd954('0x39')]=_['intersection'](_0x549926['model'],_0x549926[_0xd954('0x38')]);_0x1759ce[_0xd954('0x3a')]=_['intersection'](_0x549926[_0xd954('0x36')],qs[_0xd954('0x4b')](_0x38f746[_0xd954('0x38')][_0xd954('0x4b')]));_0x1759ce[_0xd954('0x3a')]=_0x1759ce[_0xd954('0x3a')][_0xd954('0x4c')]?_0x1759ce[_0xd954('0x3a')]:_0x549926[_0xd954('0x36')];if(_0x38f746[_0xd954('0x38')][_0xd954('0x44')]){_0x1759ce['include']=[{'all':!![]}];}_0x1759ce=_[_0xd954('0x43')]({},_0x1759ce,_0x38f746[_0xd954('0x4d')]);return db[_0xd954('0x33')]['find'](_0x1759ce)[_0xd954('0x2a')](handleEntityNotFound(_0x1a585e,null))[_0xd954('0x2a')](respondWithResult(_0x1a585e,null))[_0xd954('0x48')](handleError(_0x1a585e,null));};exports[_0xd954('0x4e')]=function(_0x5ef7aa,_0xbc52f){return db[_0xd954('0x33')]['create'](_0x5ef7aa[_0xd954('0x4f')],{})[_0xd954('0x2a')](function(_0x54a1a2){var _0x5140bb=_0x5ef7aa[_0xd954('0x50')][_0xd954('0x2b')]({'plain':!![]});if(!_0x5140bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5140bb[_0xd954('0x51')]===_0xd954('0x50')){var _0x544716=_0x54a1a2['get']({'plain':!![]});var _0x1be9d6=_0xd954('0x2c');return db[_0xd954('0x52')]['find']({'where':{'name':_0x1be9d6,'userProfileId':_0x5140bb[_0xd954('0x53')]},'raw':!![]})[_0xd954('0x2a')](function(_0x303af2){if(_0x303af2&&_0x303af2[_0xd954('0x54')]===0x0){return db[_0xd954('0x2d')][_0xd954('0x4e')]({'name':_0x544716['name'],'resourceId':_0x544716['id'],'type':_0x303af2[_0xd954('0x30')],'sectionId':_0x303af2['id']},{})['then'](function(){return _0x54a1a2;});}else{return _0x54a1a2;}})[_0xd954('0x48')](function(_0x348979){logger[_0xd954('0x55')](_0xd954('0x56'),_0x348979);throw _0x348979;});}return _0x54a1a2;})[_0xd954('0x2a')](respondWithResult(_0xbc52f,0xc9))[_0xd954('0x48')](handleError(_0xbc52f,null));};exports[_0xd954('0x29')]=function(_0x5e77a6,_0x59f640){if(_0x5e77a6[_0xd954('0x4f')]['id']){delete _0x5e77a6[_0xd954('0x4f')]['id'];}return db[_0xd954('0x33')][_0xd954('0x57')]({'where':{'id':_0x5e77a6[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x59f640,null))[_0xd954('0x2a')](saveUpdates(_0x5e77a6[_0xd954('0x4f')],null))['then'](respondWithResult(_0x59f640,null))[_0xd954('0x48')](handleError(_0x59f640,null));};exports[_0xd954('0x2e')]=function(_0x5a757,_0x3e60f2){return db[_0xd954('0x33')][_0xd954('0x57')]({'where':{'id':_0x5a757[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x3e60f2,null))[_0xd954('0x2a')](removeEntity(_0x3e60f2,null))[_0xd954('0x48')](handleError(_0x3e60f2,null));};exports[_0xd954('0x58')]=function(_0x2da832,_0x22293c){return db['CmList'][_0xd954('0x58')]()['then'](respondWithResult(_0x22293c,null))[_0xd954('0x48')](handleError(_0x22293c,null));};exports[_0xd954('0x59')]=function(_0x345e81,_0x272700,_0x120c81){if(_0x345e81[_0xd954('0x4f')]['id']){delete _0x345e81[_0xd954('0x4f')]['id'];}return db['CmList']['find']({'where':{'id':_0x345e81['params']['id']}})['then'](handleEntityNotFound(_0x272700,null))[_0xd954('0x2a')](function(_0x1e422a){if(_0x1e422a){_0x345e81[_0xd954('0x4f')][_0xd954('0x5a')]=_0x1e422a['id'];return db[_0xd954('0x5b')]['create'](_0x345e81['body']);}})[_0xd954('0x2a')](respondWithResult(_0x272700,null))[_0xd954('0x48')](handleError(_0x272700,null));};exports['getDispositions']=function(_0xedd6c5,_0x4129ca,_0x1ef2bc){var _0x5f2e50={'raw':![],'where':{}};var _0x5e9619={};var _0x72737d={'count':0x0,'rows':[]};return db[_0xd954('0x33')]['findOne']({'where':{'id':_0xedd6c5[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x4129ca,null))[_0xd954('0x2a')](function(_0x2e1565){if(_0x2e1565){_0x5e9619[_0xd954('0x36')]=_[_0xd954('0x37')](db['Disposition'][_0xd954('0x34')]);_0x5e9619['query']=_['keys'](_0xedd6c5[_0xd954('0x38')]);_0x5e9619[_0xd954('0x39')]=_[_0xd954('0x3b')](_0x5e9619['model'],_0x5e9619['query']);_0x5f2e50[_0xd954('0x3a')]=_[_0xd954('0x3b')](_0x5e9619[_0xd954('0x36')],qs[_0xd954('0x4b')](_0xedd6c5[_0xd954('0x38')][_0xd954('0x4b')]));_0x5f2e50[_0xd954('0x3a')]=_0x5f2e50[_0xd954('0x3a')]['length']?_0x5f2e50[_0xd954('0x3a')]:_0x5e9619['model'];if(!_0xedd6c5[_0xd954('0x38')][_0xd954('0x3c')](_0xd954('0x3d'))){_0x5f2e50['limit']=qs['limit'](_0xedd6c5['query'][_0xd954('0x24')]);_0x5f2e50[_0xd954('0x22')]=qs[_0xd954('0x22')](_0xedd6c5['query'][_0xd954('0x22')]);}_0x5f2e50[_0xd954('0x5c')]=qs[_0xd954('0x3e')](_0xedd6c5[_0xd954('0x38')]['sort']);_0x5f2e50[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0xedd6c5[_0xd954('0x38')],_0x5e9619[_0xd954('0x39')]));_0x5f2e50[_0xd954('0x3f')]['ListId']=_0x2e1565['id'];if(_0xedd6c5[_0xd954('0x38')][_0xd954('0x41')]){_0x5f2e50['where']=_[_0xd954('0x43')](_0x5f2e50[_0xd954('0x3f')],{'$or':_[_0xd954('0x32')](_0x5f2e50[_0xd954('0x3a')],function(_0x126b57){var _0x1a0104={};_0x1a0104[_0x126b57]={'$like':'%'+_0xedd6c5[_0xd954('0x38')][_0xd954('0x41')]+'%'};return _0x1a0104;})});}_0x5f2e50=_[_0xd954('0x43')]({},_0x5f2e50,_0xedd6c5[_0xd954('0x4d')]);return db[_0xd954('0x5b')][_0xd954('0x25')]({'where':_0x5f2e50[_0xd954('0x3f')]})[_0xd954('0x2a')](function(_0xbf928f){_0x72737d['count']=_0xbf928f;if(_0xedd6c5['query'][_0xd954('0x44')]){_0x5f2e50[_0xd954('0x45')]=[{'all':!![]}];}return db['Disposition'][_0xd954('0x46')](_0x5f2e50);})[_0xd954('0x2a')](function(_0x391c7a){_0x72737d[_0xd954('0x47')]=_0x391c7a;return _0x72737d;});}})[_0xd954('0x2a')](respondWithFilteredResult(_0x4129ca,_0x5f2e50))[_0xd954('0x48')](handleError(_0x4129ca,null));};exports[_0xd954('0x5d')]=function(_0x38dd4e,_0x57ca85,_0x3c44a1){return db[_0xd954('0x33')]['find']({'where':{'id':_0x38dd4e[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x57ca85,null))[_0xd954('0x2a')](function(_0x16762a){if(_0x16762a){return _0x16762a[_0xd954('0x5d')](_0x38dd4e['query'][_0xd954('0x5e')]);}})[_0xd954('0x2a')](respondWithStatusCode(_0x57ca85,null))[_0xd954('0x48')](handleError(_0x57ca85,null));};exports['addContacts']=function(_0x2af458,_0x36c11f,_0x345ae4){return db[_0xd954('0x33')][_0xd954('0x57')]({'where':{'id':_0x2af458[_0xd954('0x4a')]['id']}})['then'](handleEntityNotFound(_0x36c11f,null))[_0xd954('0x2a')](function(_0x5263cc){if(_0x5263cc){var _0x1c904d=[];var _0x440f1b={'success':[],'errors':[]};return db['CmContact'][_0xd954('0x58')]()[_0xd954('0x2a')](function(_0x41fbfe){if(_0x2af458[_0xd954('0x4f')][_0xd954('0x5f')]&&_['isArray'](_0x2af458[_0xd954('0x4f')]['tags'])){if(_0x2af458[_0xd954('0x4f')][_0xd954('0x5f')]['length']){_0x2af458['body'][_0xd954('0x5f')]=_0x2af458[_0xd954('0x4f')]['tags'][_0xd954('0x60')](';')+';';}else{_0x2af458[_0xd954('0x4f')]['tags']=null;}}else{_0x2af458[_0xd954('0x4f')][_0xd954('0x5f')]=null;}if(_0x2af458[_0xd954('0x4f')]&&_[_0xd954('0x61')](_0x2af458[_0xd954('0x4f')])){for(var _0x5447c9=0x0;_0x5447c9<_0x2af458[_0xd954('0x4f')][_0xd954('0x4c')];_0x5447c9+=0x1){_0x2af458[_0xd954('0x4f')][_0x5447c9][_0xd954('0x5a')]=_0x2af458[_0xd954('0x4a')]['id'];_0x1c904d[_0xd954('0x62')](_0x2af458[_0xd954('0x4f')][_0x5447c9]);}return BPromise[_0xd954('0x63')](_0x1c904d,function(_0x532f83){return db['CmContact'][_0xd954('0x4e')](_[_0xd954('0x64')](_0x532f83,[_0xd954('0x5e'),'id'])||{},{'fields':_[_0xd954('0x37')](_0x41fbfe),'raw':!![]})[_0xd954('0x2a')](function(_0x5046b0){_0x440f1b[_0xd954('0x65')]['push'](_0x5046b0[_0xd954('0x66')]);})[_0xd954('0x48')](function(_0x492ac7){_0x440f1b[_0xd954('0x67')]['push']({'data':_0x532f83,'error':_0x492ac7[_0xd954('0x68')]});});})[_0xd954('0x2a')](function(_0x35b568){return _0x440f1b;})['catch'](function(_0x412b3e){return _0x412b3e;});}else{_0x36c11f[_0xd954('0x20')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd954('0x2a')](respondWithResult(_0x36c11f,null))['catch'](handleError(_0x36c11f,null));};exports[_0xd954('0x69')]=function(_0x203f11,_0x27f807,_0xe89c39){var _0x3fa7cf;return db['CmList'][_0xd954('0x57')]({'where':{'id':_0x203f11['params']['id']},'include':[{'model':db[_0xd954('0x6a')],'as':_0xd954('0x6b')}]})['then'](handleEntityNotFound(_0x27f807,null))['then'](function(_0xbd4b69){if(_0xbd4b69){_0x3fa7cf=_0xbd4b69;return db[_0xd954('0x6c')]['rawAttributes'];}})[_0xd954('0x2a')](function(_0x25f06e){if(_0x25f06e){var _0x577579={};var _0x47372f={};_0x47372f[_0xd954('0x36')]=_[_0xd954('0x6d')](_[_0xd954('0x37')](_0x25f06e),_[_0xd954('0x32')](_0x3fa7cf['CustomFields'],function(_0x16c998){return util[_0xd954('0x6e')]('cf_%d',_0x16c998['id']);}));_0x47372f[_0xd954('0x38')]=_[_0xd954('0x37')](_0x203f11[_0xd954('0x38')]);_0x47372f[_0xd954('0x39')]=_['intersection'](_0x47372f[_0xd954('0x36')],_0x47372f[_0xd954('0x38')]);_0x577579[_0xd954('0x3a')]=_[_0xd954('0x3b')](_0x47372f[_0xd954('0x36')],qs[_0xd954('0x4b')](_0x203f11[_0xd954('0x38')][_0xd954('0x4b')]));_0x577579[_0xd954('0x3a')]=_0x577579['attributes'][_0xd954('0x4c')]?_0x577579['attributes']:_0x47372f[_0xd954('0x36')];if(!_0x203f11[_0xd954('0x38')][_0xd954('0x3c')](_0xd954('0x3d'))){_0x577579[_0xd954('0x24')]=qs['limit'](_0x203f11[_0xd954('0x38')]['limit']);_0x577579[_0xd954('0x22')]=qs[_0xd954('0x22')](_0x203f11[_0xd954('0x38')][_0xd954('0x22')]);}_0x577579['order']=qs[_0xd954('0x3e')](_0x203f11[_0xd954('0x38')]['sort']);_0x577579[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0x203f11['query'],_0x47372f[_0xd954('0x39')]));_0x577579[_0xd954('0x6f')]=!![];if(_0x203f11['query']['filter']){_0x577579[_0xd954('0x3f')]=_[_0xd954('0x43')](_0x577579['where'],{'$or':_[_0xd954('0x32')](_0x577579[_0xd954('0x3a')],function(_0x1bd5c0){var _0x1d2940={};_0x1d2940[_0x1bd5c0]={'$like':'%'+_0x203f11['query'][_0xd954('0x41')]+'%'};return _0x1d2940;})});}_0x577579=_[_0xd954('0x43')]({},_0x577579,_0x203f11[_0xd954('0x4d')]);return _0x3fa7cf['getContacts'](_0x577579);}})[_0xd954('0x2a')](respondWithResult(_0x27f807,null))['catch'](handleError(_0x27f807,null));};exports[_0xd954('0x70')]=function(_0x4fd056,_0x2e5563,_0x5c2c11){var _0x1237e3;var _0x5bb820;var _0x96c8b;var _0x18f768=_0x4fd056[_0xd954('0x4a')]['id'];csv_results=[];return db[_0xd954('0x71')][_0xd954('0x46')]({'attributes':['id',_0xd954('0x30')],'raw':!![],'order':[_0xd954('0x72')]})['then'](function(_0x4aec8a){_0x1237e3=_0x4aec8a;var _0x10935c=_[_0xd954('0x37')](db[_0xd954('0x6c')][_0xd954('0x34')]);return db[_0xd954('0x6a')][_0xd954('0x46')]({'raw':!![],'attributes':['id','alias']})[_0xd954('0x2a')](function(_0x5aef9d){_0x5bb820=_0x5aef9d;var _0xded965=squel[_0xd954('0x73')]()[_0xd954('0x4b')](_0x10935c)[_0xd954('0x74')]('cm_contacts','c')[_0xd954('0x3f')](_0xd954('0x75'),_0x18f768)['where']('c.deletedAt\x20is\x20null')[_0xd954('0x76')]();for(var _0x3d8720=0x0;_0x3d8720<_0x5bb820[_0xd954('0x4c')];_0x3d8720++){_0xded965[_0xd954('0x77')](_0xd954('0x78')+_0x5bb820[_0x3d8720]['id'],_0xd954('0x79')+_0x5bb820[_0x3d8720][_0xd954('0x7a')]);}for(var _0x3d8720=0x0;_0x3d8720<_0x1237e3[_0xd954('0x4c')];_0x3d8720++){_0xded965[_0xd954('0x77')](squel['select']()[_0xd954('0x77')]('item')[_0xd954('0x74')](_0xd954('0x7b'))[_0xd954('0x3f')](_0xd954('0x7c'),_0x1237e3[_0x3d8720]['id'])[_0xd954('0x3f')](_0xd954('0x7d')),'additionalPhone_'+_0x1237e3[_0x3d8720][_0xd954('0x30')]);_0xded965[_0xd954('0x77')](squel['select']()['field'](_0xd954('0x7e'))[_0xd954('0x74')](_0xd954('0x7b'))[_0xd954('0x3f')](_0xd954('0x7c'),_0x1237e3[_0x3d8720]['id'])['where']('CmContactId\x20=\x20c.id'),_0xd954('0x7f')+_0x1237e3[_0x3d8720][_0xd954('0x30')]);}var _0x18e392=[];_0x18e392[_0xd954('0x62')](_0xded965[_0xd954('0x80')]());BPromise[_0xd954('0x63')](_0x18e392,handleQuery)[_0xd954('0x2a')](function(_0x128678){handleQuery(_0xded965['toString']());var _0x2ac840=csv_results[0x0];if(!_[_0xd954('0x81')](_0x2ac840)){var _0x146872=toCsv(_0x2ac840);var _0x20a734=Date[_0xd954('0x82')]();fs[_0xd954('0x83')](util['format'](_0xd954('0x84'),_0x18f768,_0x20a734),_0x146872);_0x2e5563[_0xd954('0x85')](_0xd954('0x86'),_0xd954('0x87')+util[_0xd954('0x6e')](_0xd954('0x88'),_0x18f768,_0x20a734));_0x2e5563[_0xd954('0x85')]('Content-type',_0xd954('0x89'));return _0x2e5563['download'](util[_0xd954('0x6e')](_0xd954('0x84'),_0x18f768,_0x20a734));}else{return _0x2e5563['sendStatus'](0xcc);}});});});};exports[_0xd954('0x8a')]=function(_0x22f4d6,_0x408b2b,_0x544f38){var _0xb0118;delete _0x22f4d6[_0xd954('0x4f')]['id'];return db[_0xd954('0x33')][_0xd954('0x8b')]({'where':{'id':_0x22f4d6['params']['id']}})['then'](handleEntityNotFound(_0x408b2b,null))[_0xd954('0x2a')](function(_0x433bcd){if(_0x433bcd){return db[_0xd954('0x8c')][_0xd954('0x8d')](function(_0x7a4441){return db['CmCustomField']['create'](_0x22f4d6[_0xd954('0x4f')],{'transaction':_0x7a4441})[_0xd954('0x2a')](function(_0x3dc7a0){_0xb0118=_0x3dc7a0;return _0x433bcd[_0xd954('0x8e')](_0x3dc7a0,{'transaction':_0x7a4441});})[_0xd954('0x2a')](function(){var _0x1080d1={'type':db['Sequelize']['TEXT'],'transaction':_0x7a4441};switch(_0x22f4d6[_0xd954('0x4f')][_0xd954('0x42')]){case _0xd954('0x8f'):_0x1080d1[_0xd954('0x42')]=db['Sequelize'][_0xd954('0x90')];break;case _0xd954('0x91'):_0x1080d1[_0xd954('0x42')]=db[_0xd954('0x92')][_0xd954('0x93')];break;case _0xd954('0x94'):_0x1080d1[_0xd954('0x42')]=db[_0xd954('0x92')]['BOOLEAN'];_0x1080d1[_0xd954('0x95')]=![];break;default:}return db[_0xd954('0x8c')][_0xd954('0x96')][_0xd954('0x97')](_0xd954('0x98'),util[_0xd954('0x6e')]('cf_%s',_0xb0118['id']),_0x1080d1);})[_0xd954('0x2a')](function(){return _0xb0118;});});}})[_0xd954('0x2a')](respondWithResult(_0x408b2b,null))[_0xd954('0x48')](handleError(_0x408b2b,null));};exports[_0xd954('0x99')]=function(_0x2b2f47,_0x3967a8,_0x5dfc98){var _0x4372ac={};var _0xf194d8={};var _0x4e00ea;var _0x5636c5;return db[_0xd954('0x33')]['findOne']({'where':{'id':_0x2b2f47[_0xd954('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3967a8,null))[_0xd954('0x2a')](function(_0x333c3c){if(_0x333c3c){_0x4e00ea=_0x333c3c;_0xf194d8[_0xd954('0x36')]=_[_0xd954('0x37')](db['CmCustomField'][_0xd954('0x34')]);_0xf194d8[_0xd954('0x38')]=_[_0xd954('0x37')](_0x2b2f47['query']);_0xf194d8[_0xd954('0x39')]=_[_0xd954('0x3b')](_0xf194d8[_0xd954('0x36')],_0xf194d8[_0xd954('0x38')]);_0x4372ac['attributes']=_['intersection'](_0xf194d8[_0xd954('0x36')],qs[_0xd954('0x4b')](_0x2b2f47[_0xd954('0x38')]['fields']));_0x4372ac['attributes']=_0x4372ac['attributes'][_0xd954('0x4c')]?_0x4372ac['attributes']:_0xf194d8[_0xd954('0x36')];_0x4372ac[_0xd954('0x5c')]=qs[_0xd954('0x3e')](_0x2b2f47[_0xd954('0x38')][_0xd954('0x3e')]);_0x4372ac[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0x2b2f47[_0xd954('0x38')],_0xf194d8[_0xd954('0x39')]));_0x4372ac[_0xd954('0x3f')]=_[_0xd954('0x43')](_0x4372ac[_0xd954('0x3f')],{'$or':[{'ListId':_0x333c3c['id']},{'ListId':null}]});if(_0x2b2f47[_0xd954('0x38')][_0xd954('0x41')]){_0x4372ac['where']=_[_0xd954('0x43')](_0x4372ac[_0xd954('0x3f')],{'$or':_[_0xd954('0x32')](_0x4372ac[_0xd954('0x3a')],function(_0x4c54c5){var _0x3e3a2c={};_0x3e3a2c[_0x4c54c5]={'$like':'%'+_0x2b2f47['query']['filter']+'%'};return _0x3e3a2c;})});}_0x4372ac=_['merge']({},_0x4372ac,_0x2b2f47[_0xd954('0x4d')]);return db['CmCustomField'][_0xd954('0x9a')](_0x4372ac);}})[_0xd954('0x2a')](respondWithResult(_0x3967a8,null))[_0xd954('0x48')](handleError(_0x3967a8,null));};exports[_0xd954('0x9b')]=function(_0x34e72e,_0x548090){return db['CmCustomField'][_0xd954('0x9a')]({'where':{'ListId':null}})[_0xd954('0x2a')](handleEntityNotFound(_0x548090,null))[_0xd954('0x2a')](function(_0x8611a8){return _0x8611a8;})[_0xd954('0x2a')](respondWithResult(_0x548090,null))[_0xd954('0x48')](handleError(_0x548090,null));};exports[_0xd954('0x9c')]=function(_0x2214f4,_0x30ecef,_0x528c81){return db[_0xd954('0x33')][_0xd954('0x57')]({'where':{'id':_0x2214f4['params']['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x30ecef,null))['then'](function(_0x121e3a){if(_0x121e3a){return _0x121e3a[_0xd954('0x9c')](_0x2214f4['body'][_0xd954('0x5e')],_[_0xd954('0x64')](_0x2214f4[_0xd954('0x4f')],[_0xd954('0x5e'),'id'])||{})[_0xd954('0x9d')](function(_0x7b746c){for(var _0x235e96=0x0;_0x235e96<_0x2214f4[_0xd954('0x4f')][_0xd954('0x5e')][_0xd954('0x4c')];_0x235e96+=0x1){socket[_0xd954('0x9e')](_0xd954('0x9f'),{'UserId':Number(_0x2214f4[_0xd954('0x4f')][_0xd954('0x5e')][_0x235e96]),'CmListId':Number(_0x2214f4['params']['id'])});}return _0x7b746c;});}})[_0xd954('0x2a')](respondWithResult(_0x30ecef,null))[_0xd954('0x48')](handleError(_0x30ecef,null));};exports[_0xd954('0xa0')]=function(_0x1c8846,_0x24c5cd,_0xeb1b3a){return db['CmList'][_0xd954('0x57')]({'where':{'id':_0x1c8846[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x24c5cd,null))[_0xd954('0x2a')](function(_0x1cad3f){if(_0x1cad3f){return _0x1cad3f[_0xd954('0xa0')](_0x1c8846[_0xd954('0x38')][_0xd954('0x5e')])[_0xd954('0x2a')](function(){if(_['isArray'](_0x1c8846[_0xd954('0x38')]['ids'])){for(var _0x26d3f8=0x0;_0x26d3f8<_0x1c8846[_0xd954('0x38')][_0xd954('0x5e')][_0xd954('0x4c')];_0x26d3f8+=0x1){socket[_0xd954('0x9e')](_0xd954('0xa1'),{'UserId':Number(_0x1c8846[_0xd954('0x38')][_0xd954('0x5e')][_0x26d3f8]),'CmListId':Number(_0x1c8846[_0xd954('0x4a')]['id'])});}}else{socket['emit'](_0xd954('0xa1'),{'UserId':Number(_0x1c8846['query'][_0xd954('0x5e')]),'CmListId':Number(_0x1c8846[_0xd954('0x4a')]['id'])});}});}})[_0xd954('0x2a')](respondWithStatusCode(_0x24c5cd,null))[_0xd954('0x48')](handleError(_0x24c5cd,null));};exports[_0xd954('0xa2')]=function(_0x3fe14b,_0x7cfe3e,_0x25177f){var _0x2cdcdc={};var _0xd49b0f={};var _0x14f82e;var _0x2a040b;return db[_0xd954('0x33')][_0xd954('0x8b')]({'where':{'id':_0x3fe14b[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x7cfe3e,null))[_0xd954('0x2a')](function(_0x4ebe8f){if(_0x4ebe8f){_0x14f82e=_0x4ebe8f;_0xd49b0f['model']=_['keys'](db['User'][_0xd954('0x34')]);_0xd49b0f[_0xd954('0x38')]=_[_0xd954('0x37')](_0x3fe14b[_0xd954('0x38')]);_0xd49b0f['filters']=_[_0xd954('0x3b')](_0xd49b0f[_0xd954('0x36')],_0xd49b0f[_0xd954('0x38')]);_0x2cdcdc[_0xd954('0x3a')]=_[_0xd954('0x3b')](_0xd49b0f[_0xd954('0x36')],qs[_0xd954('0x4b')](_0x3fe14b['query'][_0xd954('0x4b')]));_0x2cdcdc['attributes']=_0x2cdcdc['attributes'][_0xd954('0x4c')]?_0x2cdcdc['attributes']:_0xd49b0f[_0xd954('0x36')];_0x2cdcdc[_0xd954('0x5c')]=qs[_0xd954('0x3e')](_0x3fe14b['query']['sort']);_0x2cdcdc[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0x3fe14b[_0xd954('0x38')],_0xd49b0f[_0xd954('0x39')]));if(_0x3fe14b[_0xd954('0x38')][_0xd954('0x41')]){_0x2cdcdc['where']=_[_0xd954('0x43')](_0x2cdcdc['where'],{'$or':_[_0xd954('0x32')](_0x2cdcdc[_0xd954('0x3a')],function(_0x24d312){var _0xf5af3f={};_0xf5af3f[_0x24d312]={'$like':'%'+_0x3fe14b[_0xd954('0x38')]['filter']+'%'};return _0xf5af3f;})});}_0x2cdcdc=_[_0xd954('0x43')]({},_0x2cdcdc,_0x3fe14b[_0xd954('0x4d')]);return _0x14f82e[_0xd954('0xa2')](_0x2cdcdc);}})['then'](function(_0x4abe27){if(_0x4abe27){_0x2a040b=_0x4abe27[_0xd954('0x4c')];if(!_0x3fe14b[_0xd954('0x38')][_0xd954('0x3c')](_0xd954('0x3d'))){_0x2cdcdc[_0xd954('0x24')]=qs[_0xd954('0x24')](_0x3fe14b[_0xd954('0x38')][_0xd954('0x24')]);_0x2cdcdc[_0xd954('0x22')]=qs[_0xd954('0x22')](_0x3fe14b[_0xd954('0x38')][_0xd954('0x22')]);}return _0x14f82e[_0xd954('0xa2')](_0x2cdcdc);}})[_0xd954('0x2a')](function(_0x133a26){if(_0x133a26){return _0x133a26?{'count':_0x2a040b,'rows':_0x133a26}:null;}})[_0xd954('0x2a')](respondWithResult(_0x7cfe3e,null))[_0xd954('0x48')](handleError(_0x7cfe3e,null));};function handleQuery(_0xb2d6f6){logger[_0xd954('0xa3')](_0xb2d6f6);return db[_0xd954('0x8c')][_0xd954('0x38')](_0xb2d6f6)[_0xd954('0x9d')](function(_0x1dddcb){csv_results[_0xd954('0x62')](_0x1dddcb);})[_0xd954('0x48')](function(_0x247f0e){logger['error'](_0x247f0e[_0xd954('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index fcea5b2..a426330 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x55ca,0x126));var _0xa55c=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0x55ca[_0x3825a8];return _0xabc9bc;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x5fc3[_0x3ceb54];return _0x26d8a6;};'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 8e3cb1b..6734c54 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 _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0x316255,_0x255c3f){var _0x912326=function(_0x3befd1){while(--_0x3befd1){_0x316255['push'](_0x316255['shift']());}};_0x912326(++_0x255c3f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3429c3,_0xb379bf){_0x3429c3=_0x3429c3-0x0;var _0x580823=_0xb43b[_0x3429c3];return _0x580823;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x750a=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','moment','bluebird','request-promise'];(function(_0x382345,_0xdf03d9){var _0x286bed=function(_0x4d894c){while(--_0x4d894c){_0x382345['push'](_0x382345['shift']());}};_0x286bed(++_0xdf03d9);}(_0x750a,0x140));var _0xa750=function(_0x50558f,_0x2f673e){_0x50558f=_0x50558f-0x0;var _0x3c4e80=_0x750a[_0x50558f];return _0x3c4e80;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'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 52dbc4f..ea7ea86 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 _0x1d4c=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result'];(function(_0xfca425,_0x2950d6){var _0x44ea89=function(_0x5c0db6){while(--_0x5c0db6){_0xfca425['push'](_0xfca425['shift']());}};_0x44ea89(++_0x2950d6);}(_0x1d4c,0x70));var _0xc1d4=function(_0x6224f4,_0x3524c5){_0x6224f4=_0x6224f4-0x0;var _0x2e9bef=_0x1d4c[_0x6224f4];return _0x2e9bef;};'use strict';var _=require(_0xc1d4('0x0'));var util=require(_0xc1d4('0x1'));var moment=require('moment');var BPromise=require(_0xc1d4('0x2'));var rs=require(_0xc1d4('0x3'));var fs=require('fs');var Redis=require(_0xc1d4('0x4'));var db=require(_0xc1d4('0x5'))['db'];var utils=require(_0xc1d4('0x6'));var logger=require(_0xc1d4('0x7'))(_0xc1d4('0x8'));var config=require(_0xc1d4('0x9'));var jayson=require(_0xc1d4('0xa'));var client=jayson['client'][_0xc1d4('0xb')]({'port':0x232a});config[_0xc1d4('0xc')]=_[_0xc1d4('0xd')](config[_0xc1d4('0xc')],{'host':_0xc1d4('0xe'),'port':0x18eb});var socket=require(_0xc1d4('0xf'))(new Redis(config[_0xc1d4('0xc')]));require(_0xc1d4('0x10'))[_0xc1d4('0x11')](socket);function respondWithRpcPromise(_0x152d22,_0x33293c,_0x5bdeb5){return new BPromise(function(_0x5342ab,_0x31f389){return client['request'](_0x152d22,_0x5bdeb5)[_0xc1d4('0x12')](function(_0x49924b){logger['info']('CmList,\x20%s,\x20%s',_0x33293c,_0xc1d4('0x13'));logger['debug'](_0xc1d4('0x14'),_0x33293c,'request\x20sent',JSON[_0xc1d4('0x15')](_0x49924b));if(_0x49924b['error']){if(_0x49924b[_0xc1d4('0x16')][_0xc1d4('0x17')]===0x1f4){logger[_0xc1d4('0x16')](_0xc1d4('0x18'),_0x33293c,_0x49924b[_0xc1d4('0x16')][_0xc1d4('0x19')]);return _0x31f389(_0x49924b['error'][_0xc1d4('0x19')]);}logger[_0xc1d4('0x16')](_0xc1d4('0x18'),_0x33293c,_0x49924b[_0xc1d4('0x16')][_0xc1d4('0x19')]);return _0x5342ab(_0x49924b[_0xc1d4('0x16')][_0xc1d4('0x19')]);}else{logger[_0xc1d4('0x1a')]('CmList,\x20%s,\x20%s',_0x33293c,'request\x20sent');_0x5342ab(_0x49924b[_0xc1d4('0x1b')][_0xc1d4('0x19')]);}})['catch'](function(_0x15ad25){logger[_0xc1d4('0x16')](_0xc1d4('0x18'),_0x33293c,_0x15ad25);_0x31f389(_0x15ad25);});});} \ No newline at end of file +var _0x8924=['../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x564989,_0x5aa378){var _0x3a0eee=function(_0x2443ea){while(--_0x2443ea){_0x564989['push'](_0x564989['shift']());}};_0x3a0eee(++_0x5aa378);}(_0x8924,0x1e8));var _0x4892=function(_0x417774,_0x1b95e6){_0x417774=_0x417774-0x0;var _0x10015d=_0x8924[_0x417774];return _0x10015d;};'use strict';var _=require(_0x4892('0x0'));var util=require('util');var moment=require(_0x4892('0x1'));var BPromise=require(_0x4892('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4892('0x3'));var db=require(_0x4892('0x4'))['db'];var utils=require(_0x4892('0x5'));var logger=require(_0x4892('0x6'))(_0x4892('0x7'));var config=require('../../config/environment');var jayson=require(_0x4892('0x8'));var client=jayson[_0x4892('0x9')][_0x4892('0xa')]({'port':0x232a});config['redis']=_[_0x4892('0xb')](config['redis'],{'host':_0x4892('0xc'),'port':0x18eb});var socket=require(_0x4892('0xd'))(new Redis(config[_0x4892('0xe')]));require('./cmList.socket')[_0x4892('0xf')](socket);function respondWithRpcPromise(_0x17e8d4,_0x85d9ef,_0x3df25d){return new BPromise(function(_0x549b30,_0x2b0666){return client[_0x4892('0x10')](_0x17e8d4,_0x3df25d)[_0x4892('0x11')](function(_0x19b3d6){logger[_0x4892('0x12')](_0x4892('0x13'),_0x85d9ef,_0x4892('0x14'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x85d9ef,'request\x20sent',JSON[_0x4892('0x15')](_0x19b3d6));if(_0x19b3d6['error']){if(_0x19b3d6[_0x4892('0x16')]['code']===0x1f4){logger['error'](_0x4892('0x13'),_0x85d9ef,_0x19b3d6[_0x4892('0x16')][_0x4892('0x17')]);return _0x2b0666(_0x19b3d6[_0x4892('0x16')][_0x4892('0x17')]);}logger[_0x4892('0x16')](_0x4892('0x13'),_0x85d9ef,_0x19b3d6[_0x4892('0x16')][_0x4892('0x17')]);return _0x549b30(_0x19b3d6[_0x4892('0x16')][_0x4892('0x17')]);}else{logger[_0x4892('0x12')]('CmList,\x20%s,\x20%s',_0x85d9ef,_0x4892('0x14'));_0x549b30(_0x19b3d6[_0x4892('0x18')]['message']);}})[_0x4892('0x19')](function(_0x272317){logger[_0x4892('0x16')](_0x4892('0x13'),_0x85d9ef,_0x272317);_0x2b0666(_0x272317);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 377842d..4d2f343 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 _0xdc79=['update','register','length','./cmList.events','save','remove'];(function(_0x2290dc,_0x14621b){var _0x2b1c3e=function(_0xcdd3e4){while(--_0xcdd3e4){_0x2290dc['push'](_0x2290dc['shift']());}};_0x2b1c3e(++_0x14621b);}(_0xdc79,0xed));var _0x9dc7=function(_0x103d14,_0x12e1a7){_0x103d14=_0x103d14-0x0;var _0x4d8531=_0xdc79[_0x103d14];return _0x4d8531;};'use strict';var CmListEvents=require(_0x9dc7('0x0'));var events=[_0x9dc7('0x1'),_0x9dc7('0x2'),_0x9dc7('0x3')];function createListener(_0x280097,_0x454903){return function(_0x5462e5){_0x454903['emit'](_0x280097,_0x5462e5);};}function removeListener(_0x62def2,_0x487e29){return function(){CmListEvents['removeListener'](_0x62def2,_0x487e29);};}exports[_0x9dc7('0x4')]=function(_0x209e44){for(var _0x462eb4=0x0,_0x5406b7=events[_0x9dc7('0x5')];_0x462eb4<_0x5406b7;_0x462eb4++){var _0x29109c=events[_0x462eb4];var _0x5e1b57=createListener('cmList:'+_0x29109c,_0x209e44);CmListEvents['on'](_0x29109c,_0x5e1b57);}}; \ No newline at end of file +var _0x0199=['length','cmList:','./cmList.events','save','remove','update','emit','removeListener','register'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x0199,0x1d6));var _0x9019=function(_0x237a85,_0x32ad46){_0x237a85=_0x237a85-0x0;var _0x13fcd5=_0x0199[_0x237a85];return _0x13fcd5;};'use strict';var CmListEvents=require(_0x9019('0x0'));var events=[_0x9019('0x1'),_0x9019('0x2'),_0x9019('0x3')];function createListener(_0x155c83,_0x44541d){return function(_0xdac46f){_0x44541d[_0x9019('0x4')](_0x155c83,_0xdac46f);};}function removeListener(_0x5873b2,_0x2f9d95){return function(){CmListEvents[_0x9019('0x5')](_0x5873b2,_0x2f9d95);};}exports[_0x9019('0x6')]=function(_0x56e47f){for(var _0x82c1d4=0x0,_0x30c7a3=events[_0x9019('0x7')];_0x82c1d4<_0x30c7a3;_0x82c1d4++){var _0x50eff5=events[_0x82c1d4];var _0x31e293=createListener(_0x9019('0x8')+_0x50eff5,_0x56e47f);CmListEvents['on'](_0x50eff5,_0x31e293);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a3565c2..ecf53fc 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 _0xe562=['delete','destroy','/:id/dispositions','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','update'];(function(_0x5918eb,_0x290d56){var _0x428f70=function(_0x43bdb0){while(--_0x43bdb0){_0x5918eb['push'](_0x5918eb['shift']());}};_0x428f70(++_0x290d56);}(_0xe562,0x6b));var _0x2e56=function(_0x579906,_0x410344){_0x579906=_0x579906-0x0;var _0x5e1392=_0xe562[_0x579906];return _0x5e1392;};'use strict';var multer=require(_0x2e56('0x0'));var util=require('util');var path=require(_0x2e56('0x1'));var timeout=require(_0x2e56('0x2'));var express=require('express');var router=express[_0x2e56('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2e56('0x4'));var interaction=require(_0x2e56('0x5'));var config=require('../../config/environment');var controller=require(_0x2e56('0x6'));router[_0x2e56('0x7')]('/',auth[_0x2e56('0x8')](),controller['index']);router[_0x2e56('0x7')](_0x2e56('0x9'),auth['isAuthenticated'](),controller[_0x2e56('0xa')]);router['get'](_0x2e56('0xb'),auth[_0x2e56('0x8')](),controller['getGlobalCustomFields']);router['get'](_0x2e56('0xc'),auth[_0x2e56('0x8')](),controller[_0x2e56('0xd')]);router[_0x2e56('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2e56('0xe')]);router['get'](_0x2e56('0xf'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x10')]);router[_0x2e56('0x7')](_0x2e56('0x11'),auth['isAuthenticated'](),controller[_0x2e56('0x12')]);router['get'](_0x2e56('0x13'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x14')]);router[_0x2e56('0x7')]('/:id/users',auth[_0x2e56('0x8')](),controller[_0x2e56('0x15')]);router[_0x2e56('0x16')]('/',auth[_0x2e56('0x8')](),controller[_0x2e56('0x17')]);router[_0x2e56('0x16')]('/:id/dispositions',auth[_0x2e56('0x8')](),controller[_0x2e56('0x18')]);router[_0x2e56('0x16')](_0x2e56('0xf'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x19')]);router[_0x2e56('0x16')](_0x2e56('0x13'),auth['isAuthenticated'](),controller[_0x2e56('0x1a')]);router['post'](_0x2e56('0x1b'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x2e56('0x8')](),controller[_0x2e56('0x1c')]);router[_0x2e56('0x1d')](_0x2e56('0xc'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x1e')]);router[_0x2e56('0x1d')](_0x2e56('0x1f'),auth[_0x2e56('0x8')](),controller['removeDispositions']);router['delete'](_0x2e56('0x1b'),auth[_0x2e56('0x8')](),controller[_0x2e56('0x20')]);module[_0x2e56('0x21')]=router; \ No newline at end of file +var _0x0dcf=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','delete','removeDispositions','removeAgents','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x597ed6,_0x2edb30){var _0x23059a=function(_0x3743de){while(--_0x3743de){_0x597ed6['push'](_0x597ed6['shift']());}};_0x23059a(++_0x2edb30);}(_0x0dcf,0x64));var _0xf0dc=function(_0x1ccae7,_0xfeda15){_0x1ccae7=_0x1ccae7-0x0;var _0x860611=_0x0dcf[_0x1ccae7];return _0x860611;};'use strict';var multer=require(_0xf0dc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf0dc('0x1'));var express=require(_0xf0dc('0x2'));var router=express['Router']();var fs_extra=require(_0xf0dc('0x3'));var auth=require(_0xf0dc('0x4'));var interaction=require(_0xf0dc('0x5'));var config=require(_0xf0dc('0x6'));var controller=require('./cmList.controller');router[_0xf0dc('0x7')]('/',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x9')]);router['get'](_0xf0dc('0xa'),auth['isAuthenticated'](),controller[_0xf0dc('0xb')]);router[_0xf0dc('0x7')](_0xf0dc('0xc'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0xd')]);router[_0xf0dc('0x7')](_0xf0dc('0xe'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0xf')]);router[_0xf0dc('0x7')](_0xf0dc('0x10'),auth[_0xf0dc('0x8')](),controller['getDispositions']);router[_0xf0dc('0x7')](_0xf0dc('0x11'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x12')]);router[_0xf0dc('0x7')](_0xf0dc('0x13'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x14')]);router[_0xf0dc('0x7')](_0xf0dc('0x15'),auth[_0xf0dc('0x8')](),controller['getCustomFields']);router[_0xf0dc('0x7')](_0xf0dc('0x16'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x17')]);router['post']('/',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x18')]);router[_0xf0dc('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf0dc('0x1a')]);router[_0xf0dc('0x19')]('/:id/contacts',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x1b')]);router['post'](_0xf0dc('0x15'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x1c')]);router[_0xf0dc('0x19')]('/:id/users',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x1d')]);router[_0xf0dc('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf0dc('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xf0dc('0x1f')](_0xf0dc('0x10'),auth['isAuthenticated'](),controller[_0xf0dc('0x20')]);router['delete'](_0xf0dc('0x16'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x21')]);module[_0xf0dc('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 67637ca..a8a3d15 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 _0x4563=['STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x404eed,_0x5390c5){var _0xd45887=function(_0x1ee42b){while(--_0x1ee42b){_0x404eed['push'](_0x404eed['shift']());}};_0xd45887(++_0x5390c5);}(_0x4563,0x1b1));var _0x3456=function(_0x1704fa,_0x4f7d65){_0x1704fa=_0x1704fa-0x0;var _0x7f5b47=_0x4563[_0x1704fa];return _0x7f5b47;};'use strict';var Sequelize=require(_0x3456('0x0'));module['exports']={'name':{'type':Sequelize[_0x3456('0x1')],'get':function(_0x5916dd){return this[_0x3456('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x3456('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x14c7=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x23019b,_0x45b9db){var _0xd49cae=function(_0x3ad33e){while(--_0x3ad33e){_0x23019b['push'](_0x23019b['shift']());}};_0xd49cae(++_0x45b9db);}(_0x14c7,0x183));var _0x714c=function(_0x4f8a9d,_0x41770c){_0x4f8a9d=_0x4f8a9d-0x0;var _0x3f490e=_0x14c7[_0x4f8a9d];return _0x3f490e;};'use strict';var Sequelize=require(_0x714c('0x0'));module[_0x714c('0x1')]={'name':{'type':Sequelize[_0x714c('0x2')],'get':function(_0x36ae3b){return this['getDataValue'](_0x714c('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x714c('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x714c('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index f8bfb58..7b09e6f 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(_0x26a6c0,_0x31e7a1){var _0x342604=function(_0x479fa4){while(--_0x479fa4){_0x26a6c0['push'](_0x26a6c0['shift']());}};_0x342604(++_0x31e7a1);}(_0x7a54,0x106));var _0x47a5=function(_0x260510,_0x5d8637){_0x260510=_0x260510-0x0;var _0x5de28e=_0x7a54[_0x260510];return _0x5de28e;};'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(_0x2020e9,_0x74e5d7){var _0x199c13=function(_0x5875fd){while(--_0x5875fd){_0x2020e9['push'](_0x2020e9['shift']());}};_0x199c13(++_0x74e5d7);}(_0x7a54,0x106));var _0x47a5=function(_0x886020,_0x372453){_0x886020=_0x886020-0x0;var _0x2225e2=_0x7a54[_0x886020];return _0x2225e2;};'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 be5a576..9063ca1 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 _0xc07d=['../../config/environment','./condition.attributes','Condition','tools_conditions','../../config/logger','api','moment','rimraf'];(function(_0x425d0d,_0x396c0d){var _0x36a8b8=function(_0x17f45b){while(--_0x17f45b){_0x425d0d['push'](_0x425d0d['shift']());}};_0x36a8b8(++_0x396c0d);}(_0xc07d,0x6c));var _0xdc07=function(_0x1630f1,_0x2eba83){_0x1630f1=_0x1630f1-0x0;var _0x1531e6=_0xc07d[_0x1630f1];return _0x1531e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdc07('0x0'))(_0xdc07('0x1'));var moment=require(_0xdc07('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdc07('0x3'));var config=require(_0xdc07('0x4'));var attributes=require(_0xdc07('0x5'));module['exports']=function(_0x4c5e32,_0x46083c){return _0x4c5e32['define'](_0xdc07('0x6'),attributes,{'tableName':_0xdc07('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfe=['moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger'];(function(_0x573b76,_0x3fcca8){var _0x22e32c=function(_0xb4aa75){while(--_0xb4aa75){_0x573b76['push'](_0x573b76['shift']());}};_0x22e32c(++_0x3fcca8);}(_0x7dfe,0xbd));var _0xe7df=function(_0x13907b,_0x86ef33){_0x13907b=_0x13907b-0x0;var _0x6bf1da=_0x7dfe[_0x13907b];return _0x6bf1da;};'use strict';var _=require(_0xe7df('0x0'));var util=require(_0xe7df('0x1'));var logger=require(_0xe7df('0x2'))('api');var moment=require(_0xe7df('0x3'));var BPromise=require(_0xe7df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7df('0x5'));var rimraf=require(_0xe7df('0x6'));var config=require(_0xe7df('0x7'));var attributes=require(_0xe7df('0x8'));module[_0xe7df('0x9')]=function(_0xff1259,_0x4f8d87){return _0xff1259[_0xe7df('0xa')]('Condition',attributes,{'tableName':_0xe7df('0xb'),'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 ba99db7..ef30d9b 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 _0x650c=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x49a8a9,_0x38009b){var _0x48fc90=function(_0x364655){while(--_0x364655){_0x49a8a9['push'](_0x49a8a9['shift']());}};_0x48fc90(++_0x38009b);}(_0x650c,0x86));var _0xc650=function(_0x59adba,_0x189ca9){_0x59adba=_0x59adba-0x0;var _0x53d5d7=_0x650c[_0x59adba];return _0x53d5d7;};'use strict';var _=require(_0xc650('0x0'));var util=require(_0xc650('0x1'));var moment=require(_0xc650('0x2'));var BPromise=require(_0xc650('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc650('0x4'))['db'];var utils=require(_0xc650('0x5'));var logger=require(_0xc650('0x6'))(_0xc650('0x7'));var config=require(_0xc650('0x8'));var jayson=require(_0xc650('0x9'));var client=jayson['client'][_0xc650('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x433d6d,_0x4d280b,_0x4bfd19){return new BPromise(function(_0x1073ef,_0x421fde){return client['request'](_0x433d6d,_0x4bfd19)['then'](function(_0x1f4833){logger[_0xc650('0xb')](_0xc650('0xc'),_0x4d280b,_0xc650('0xd'));logger[_0xc650('0xe')](_0xc650('0xf'),_0x4d280b,'request\x20sent',JSON[_0xc650('0x10')](_0x1f4833));if(_0x1f4833[_0xc650('0x11')]){if(_0x1f4833[_0xc650('0x11')][_0xc650('0x12')]===0x1f4){logger[_0xc650('0x11')](_0xc650('0xc'),_0x4d280b,_0x1f4833[_0xc650('0x11')][_0xc650('0x13')]);return _0x421fde(_0x1f4833[_0xc650('0x11')][_0xc650('0x13')]);}logger[_0xc650('0x11')](_0xc650('0xc'),_0x4d280b,_0x1f4833['error'][_0xc650('0x13')]);return _0x1073ef(_0x1f4833['error']['message']);}else{logger[_0xc650('0xb')]('Condition,\x20%s,\x20%s',_0x4d280b,_0xc650('0xd'));_0x1073ef(_0x1f4833[_0xc650('0x14')][_0xc650('0x13')]);}})[_0xc650('0x15')](function(_0x39ff84){logger[_0xc650('0x11')](_0xc650('0xc'),_0x4d280b,_0x39ff84);_0x421fde(_0x39ff84);});});} \ No newline at end of file +var _0x758e=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','Condition,\x20%s,\x20%s'];(function(_0x200f4e,_0x5d79a1){var _0x25ef41=function(_0x335bde){while(--_0x335bde){_0x200f4e['push'](_0x200f4e['shift']());}};_0x25ef41(++_0x5d79a1);}(_0x758e,0x1a7));var _0xe758=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x758e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var moment=require(_0xe758('0x1'));var BPromise=require(_0xe758('0x2'));var rs=require(_0xe758('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe758('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe758('0x5'));var config=require(_0xe758('0x6'));var jayson=require(_0xe758('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaf9ab2,_0x1cc526,_0xf3849e){return new BPromise(function(_0x4a8416,_0x3781b2){return client[_0xe758('0x8')](_0xaf9ab2,_0xf3849e)[_0xe758('0x9')](function(_0x373be8){logger[_0xe758('0xa')]('Condition,\x20%s,\x20%s',_0x1cc526,_0xe758('0xb'));logger[_0xe758('0xc')](_0xe758('0xd'),_0x1cc526,_0xe758('0xb'),JSON['stringify'](_0x373be8));if(_0x373be8[_0xe758('0xe')]){if(_0x373be8[_0xe758('0xe')][_0xe758('0xf')]===0x1f4){logger[_0xe758('0xe')](_0xe758('0x10'),_0x1cc526,_0x373be8[_0xe758('0xe')][_0xe758('0x11')]);return _0x3781b2(_0x373be8['error']['message']);}logger[_0xe758('0xe')](_0xe758('0x10'),_0x1cc526,_0x373be8['error'][_0xe758('0x11')]);return _0x4a8416(_0x373be8[_0xe758('0xe')][_0xe758('0x11')]);}else{logger[_0xe758('0xa')](_0xe758('0x10'),_0x1cc526,_0xe758('0xb'));_0x4a8416(_0x373be8[_0xe758('0x12')]['message']);}})[_0xe758('0x13')](function(_0x5c5a51){logger['error'](_0xe758('0x10'),_0x1cc526,_0x5c5a51);_0x3781b2(_0x5c5a51);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b15bfdb..3cd542f 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 _0xae09=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','put','update','delete','destroy','util'];(function(_0x54af57,_0x2051fa){var _0x1a4db7=function(_0x5686e6){while(--_0x5686e6){_0x54af57['push'](_0x54af57['shift']());}};_0x1a4db7(++_0x2051fa);}(_0xae09,0x154));var _0x9ae0=function(_0x34ca09,_0x210c9d){_0x34ca09=_0x34ca09-0x0;var _0x2e543e=_0xae09[_0x34ca09];return _0x2e543e;};'use strict';var multer=require('multer');var util=require(_0x9ae0('0x0'));var path=require(_0x9ae0('0x1'));var timeout=require(_0x9ae0('0x2'));var express=require(_0x9ae0('0x3'));var router=express[_0x9ae0('0x4')]();var fs_extra=require(_0x9ae0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ae0('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x9ae0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9ae0('0x8')]);router[_0x9ae0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9ae0('0xa')]);module['exports']=router; \ No newline at end of file +var _0x0740=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x5532fa,_0x5be060){var _0x14573d=function(_0x29da07){while(--_0x29da07){_0x5532fa['push'](_0x5532fa['shift']());}};_0x14573d(++_0x5be060);}(_0x0740,0x90));var _0x0074=function(_0x5e2ebf,_0x4f3620){_0x5e2ebf=_0x5e2ebf-0x0;var _0x330df5=_0x0740[_0x5e2ebf];return _0x330df5;};'use strict';var multer=require(_0x0074('0x0'));var util=require(_0x0074('0x1'));var path=require(_0x0074('0x2'));var timeout=require('connect-timeout');var express=require(_0x0074('0x3'));var router=express['Router']();var fs_extra=require(_0x0074('0x4'));var auth=require(_0x0074('0x5'));var interaction=require(_0x0074('0x6'));var config=require(_0x0074('0x7'));var controller=require(_0x0074('0x8'));router[_0x0074('0x9')](_0x0074('0xa'),auth['isAuthenticated'](),controller[_0x0074('0xb')]);router[_0x0074('0xc')]('/:id',auth[_0x0074('0xd')](),controller[_0x0074('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1dc8758..8fced93 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 _0xf581=['INTEGER','sequelize','exports','STRING','name'];(function(_0x275293,_0x31bf61){var _0x539b28=function(_0x36e11c){while(--_0x36e11c){_0x275293['push'](_0x275293['shift']());}};_0x539b28(++_0x31bf61);}(_0xf581,0x114));var _0x1f58=function(_0x52fd3d,_0x3af718){_0x52fd3d=_0x52fd3d-0x0;var _0x49b06d=_0xf581[_0x52fd3d];return _0x49b06d;};'use strict';var Sequelize=require(_0x1f58('0x0'));module[_0x1f58('0x1')]={'name':{'type':Sequelize[_0x1f58('0x2')],'allowNull':![],'unique':_0x1f58('0x3')},'OrderBy':{'type':Sequelize[_0x1f58('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x1f58('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x649a=['INTEGER','sequelize','exports','STRING','name'];(function(_0xcbc7d0,_0x4ad63c){var _0x37b8c6=function(_0x153fee){while(--_0x153fee){_0xcbc7d0['push'](_0xcbc7d0['shift']());}};_0x37b8c6(++_0x4ad63c);}(_0x649a,0x1c3));var _0xa649=function(_0x4dc35f,_0x377c51){_0x4dc35f=_0x4dc35f-0x0;var _0x1f8820=_0x649a[_0x4dc35f];return _0x1f8820;};'use strict';var Sequelize=require(_0xa649('0x0'));module[_0xa649('0x1')]={'name':{'type':Sequelize[_0xa649('0x2')],'allowNull':![],'unique':_0xa649('0x3')},'OrderBy':{'type':Sequelize[_0xa649('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa649('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 f31827c..e04e4e3 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 _0x3de3=['update','then','get','ContactItemTypes','UserProfileResource','destroy','error','name','send','index','map','ContactItemType','fieldName','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','CmContactHasItem','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3de3,0x1ce));var _0x33de=function(_0x5982b7,_0x332365){_0x5982b7=_0x5982b7-0x0;var _0xef1a5e=_0x3de3[_0x5982b7];return _0xef1a5e;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];function respondWithStatusCode(_0x27d1d8,_0x5170ad){_0x5170ad=_0x5170ad||0xcc;return function(_0x6b1a4c){if(_0x6b1a4c){return _0x27d1d8[_0x33de('0x19')](_0x5170ad);}return _0x27d1d8['status'](_0x5170ad)['end']();};}function respondWithResult(_0x4164ab,_0x22bda8){_0x22bda8=_0x22bda8||0xc8;return function(_0x2b3748){if(_0x2b3748){return _0x4164ab[_0x33de('0x1a')](_0x22bda8)['json'](_0x2b3748);}};}function respondWithFilteredResult(_0x11e6b5,_0x1b1166){return function(_0x522ba0){if(_0x522ba0){var _0x4ff69f=typeof _0x1b1166[_0x33de('0x1b')]===_0x33de('0x1c')&&typeof _0x1b1166[_0x33de('0x1d')]==='undefined';var _0x2db887=_0x522ba0[_0x33de('0x1e')];var _0x52cfa0=_0x4ff69f?0x0:_0x1b1166[_0x33de('0x1b')];var _0x201ff3=_0x4ff69f?_0x522ba0['count']:_0x1b1166['offset']+_0x1b1166[_0x33de('0x1d')];var _0x52d718;if(_0x201ff3>=_0x2db887){_0x201ff3=_0x2db887;_0x52d718=0xc8;}else{_0x52d718=0xce;}_0x11e6b5[_0x33de('0x1a')](_0x52d718);return _0x11e6b5[_0x33de('0x1f')](_0x33de('0x20'),_0x52cfa0+'-'+_0x201ff3+'/'+_0x2db887)[_0x33de('0x21')](_0x522ba0);}return null;};}function patchUpdates(_0xc4f1a4){return function(_0x40a8e6){try{jsonpatch[_0x33de('0x22')](_0x40a8e6,_0xc4f1a4,!![]);}catch(_0x493263){return BPromise['reject'](_0x493263);}return _0x40a8e6[_0x33de('0x23')]();};}function saveUpdates(_0x5af3fa,_0x8acd8d){return function(_0x4cd8db){if(_0x4cd8db){return _0x4cd8db[_0x33de('0x24')](_0x5af3fa)[_0x33de('0x25')](function(_0x575e88){return _0x575e88;});}return null;};}function removeEntity(_0x2dbcf2,_0x5cd77e){return function(_0x67d040){if(_0x67d040){return _0x67d040['destroy']()[_0x33de('0x25')](function(){var _0x24e282=_0x67d040[_0x33de('0x26')]({'plain':!![]});var _0x5b79d7=_0x33de('0x27');return db[_0x33de('0x28')][_0x33de('0x29')]({'where':{'type':_0x5b79d7,'resourceId':_0x24e282['id']}})['then'](function(){return _0x67d040;});})[_0x33de('0x25')](function(){_0x2dbcf2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c8de9,_0x17c760){return function(_0x1a870a){if(!_0x1a870a){_0x1c8de9[_0x33de('0x19')](0x194);}return _0x1a870a;};}function handleError(_0x44b10e,_0x160687){_0x160687=_0x160687||0x1f4;return function(_0x3f22fb){logger[_0x33de('0x2a')](_0x3f22fb['stack']);if(_0x3f22fb['name']){delete _0x3f22fb[_0x33de('0x2b')];}_0x44b10e[_0x33de('0x1a')](_0x160687)[_0x33de('0x2c')](_0x3f22fb);};}exports[_0x33de('0x2d')]=function(_0x167cec,_0x20f393){var _0x427e82={},_0x4e1898={},_0x282158={'count':0x0,'rows':[]};var _0x1cee91=_[_0x33de('0x2e')](db[_0x33de('0x2f')]['rawAttributes'],function(_0xe5dc68){return{'name':_0xe5dc68[_0x33de('0x30')],'type':_0xe5dc68['type']['key']};});_0x4e1898['model']=_[_0x33de('0x2e')](_0x1cee91,_0x33de('0x2b'));_0x4e1898['query']=_[_0x33de('0x31')](_0x167cec['query']);_0x4e1898['filters']=_[_0x33de('0x32')](_0x4e1898[_0x33de('0x33')],_0x4e1898[_0x33de('0x34')]);_0x427e82[_0x33de('0x35')]=_[_0x33de('0x32')](_0x4e1898[_0x33de('0x33')],qs[_0x33de('0x36')](_0x167cec[_0x33de('0x34')]['fields']));_0x427e82[_0x33de('0x35')]=_0x427e82['attributes'][_0x33de('0x37')]?_0x427e82['attributes']:_0x4e1898['model'];if(!_0x167cec[_0x33de('0x34')][_0x33de('0x38')](_0x33de('0x39'))){_0x427e82[_0x33de('0x1d')]=qs[_0x33de('0x1d')](_0x167cec[_0x33de('0x34')]['limit']);_0x427e82[_0x33de('0x1b')]=qs[_0x33de('0x1b')](_0x167cec[_0x33de('0x34')][_0x33de('0x1b')]);}_0x427e82[_0x33de('0x3a')]=qs[_0x33de('0x3b')](_0x167cec[_0x33de('0x34')]['sort']);_0x427e82[_0x33de('0x3c')]=qs[_0x33de('0x3d')](_[_0x33de('0x3e')](_0x167cec[_0x33de('0x34')],_0x4e1898[_0x33de('0x3d')]),_0x1cee91);if(_0x167cec[_0x33de('0x34')][_0x33de('0x3f')]){_0x427e82['where']=_[_0x33de('0x40')](_0x427e82[_0x33de('0x3c')],{'$or':_[_0x33de('0x2e')](_0x1cee91,function(_0x7eaa40){if(_0x7eaa40[_0x33de('0x41')]!==_0x33de('0x42')){var _0x58f236={};_0x58f236[_0x7eaa40[_0x33de('0x2b')]]={'$like':'%'+_0x167cec['query'][_0x33de('0x3f')]+'%'};return _0x58f236;}})});}_0x427e82=_[_0x33de('0x40')]({},_0x427e82,_0x167cec['options']);var _0x198b72={'where':_0x427e82[_0x33de('0x3c')]};return db[_0x33de('0x2f')][_0x33de('0x1e')](_0x198b72)[_0x33de('0x25')](function(_0x4251e3){_0x282158[_0x33de('0x1e')]=_0x4251e3;if(_0x167cec[_0x33de('0x34')][_0x33de('0x43')]){_0x427e82['include']=[{'all':!![]}];}return db['ContactItemType'][_0x33de('0x44')](_0x427e82);})[_0x33de('0x25')](function(_0x20d04f){_0x282158[_0x33de('0x45')]=_0x20d04f;return _0x282158;})['then'](respondWithFilteredResult(_0x20f393,_0x427e82))[_0x33de('0x46')](handleError(_0x20f393,null));};exports['show']=function(_0x553ef2,_0x1f164c){var _0x3caa1f={'raw':!![],'where':{'id':_0x553ef2[_0x33de('0x47')]['id']}},_0x384b12={};_0x384b12[_0x33de('0x33')]=_[_0x33de('0x31')](db[_0x33de('0x2f')]['rawAttributes']);_0x384b12[_0x33de('0x34')]=_['keys'](_0x553ef2[_0x33de('0x34')]);_0x384b12['filters']=_[_0x33de('0x32')](_0x384b12[_0x33de('0x33')],_0x384b12['query']);_0x3caa1f[_0x33de('0x35')]=_[_0x33de('0x32')](_0x384b12[_0x33de('0x33')],qs['fields'](_0x553ef2['query'][_0x33de('0x36')]));_0x3caa1f[_0x33de('0x35')]=_0x3caa1f['attributes']['length']?_0x3caa1f[_0x33de('0x35')]:_0x384b12['model'];if(_0x553ef2['query']['includeAll']){_0x3caa1f[_0x33de('0x48')]=[{'all':!![]}];}_0x3caa1f=_[_0x33de('0x40')]({},_0x3caa1f,_0x553ef2[_0x33de('0x49')]);return db[_0x33de('0x2f')]['find'](_0x3caa1f)['then'](handleEntityNotFound(_0x1f164c,null))[_0x33de('0x25')](respondWithResult(_0x1f164c,null))[_0x33de('0x46')](handleError(_0x1f164c,null));};exports['create']=function(_0x1d016b,_0xc23633){return db[_0x33de('0x2f')][_0x33de('0x4a')](_0x1d016b[_0x33de('0x4b')],{})['then'](function(_0x185e5f){var _0x3bf2e3=_0x1d016b['user'][_0x33de('0x26')]({'plain':!![]});if(!_0x3bf2e3)throw new Error(_0x33de('0x4c'));if(_0x3bf2e3[_0x33de('0x4d')]===_0x33de('0x4e')){var _0xbbb376=_0x185e5f[_0x33de('0x26')]({'plain':!![]});var _0x3d6424=_0x33de('0x27');return db[_0x33de('0x4f')][_0x33de('0x50')]({'where':{'name':_0x3d6424,'userProfileId':_0x3bf2e3['userProfileId']},'raw':!![]})[_0x33de('0x25')](function(_0x3d66e1){if(_0x3d66e1&&_0x3d66e1[_0x33de('0x51')]===0x0){return db[_0x33de('0x28')][_0x33de('0x4a')]({'name':_0xbbb376[_0x33de('0x2b')],'resourceId':_0xbbb376['id'],'type':_0x3d66e1[_0x33de('0x2b')],'sectionId':_0x3d66e1['id']},{})['then'](function(){return _0x185e5f;});}else{return _0x185e5f;}})[_0x33de('0x46')](function(_0x32042e){logger[_0x33de('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32042e);throw _0x32042e;});}return _0x185e5f;})[_0x33de('0x25')](respondWithResult(_0xc23633,0xc9))[_0x33de('0x46')](handleError(_0xc23633,null));};exports[_0x33de('0x24')]=function(_0x303f72,_0x492aa7){if(_0x303f72['body']['id']){delete _0x303f72[_0x33de('0x4b')]['id'];}return db[_0x33de('0x2f')][_0x33de('0x50')]({'where':{'id':_0x303f72[_0x33de('0x47')]['id']}})[_0x33de('0x25')](handleEntityNotFound(_0x492aa7,null))['then'](saveUpdates(_0x303f72['body'],null))[_0x33de('0x25')](respondWithResult(_0x492aa7,null))[_0x33de('0x46')](handleError(_0x492aa7,null));};exports[_0x33de('0x29')]=function(_0x7112db,_0x3bd3b1){return db[_0x33de('0x2f')][_0x33de('0x50')]({'where':{'id':_0x7112db[_0x33de('0x47')]['id']}})[_0x33de('0x25')](handleEntityNotFound(_0x3bd3b1,null))['then'](db[_0x33de('0x52')][_0x33de('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x7112db[_0x33de('0x47')]['id']}}))['then'](removeEntity(_0x3bd3b1,null))[_0x33de('0x46')](handleError(_0x3bd3b1,null));}; \ No newline at end of file +var _0xe5af=['rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','error','CmContactHasItem'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe5af,0x9c));var _0xfe5a=function(_0x4d7530,_0xdee31){_0x4d7530=_0x4d7530-0x0;var _0x1afc9e=_0xe5af[_0x4d7530];return _0x1afc9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe5a('0x0'));var zipdir=require(_0xfe5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe5a('0x2'));var moment=require(_0xfe5a('0x3'));var BPromise=require(_0xfe5a('0x4'));var Mustache=require('mustache');var util=require(_0xfe5a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfe5a('0x6'));var ejs=require(_0xfe5a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe5a('0x8'));var crypto=require(_0xfe5a('0x9'));var jsforce=require(_0xfe5a('0xa'));var deskjs=require(_0xfe5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfe5a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe5a('0xd'));var qs=require(_0xfe5a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe5a('0xf'));var logger=require(_0xfe5a('0x10'))(_0xfe5a('0x11'));var utils=require(_0xfe5a('0x12'));var config=require(_0xfe5a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe5a('0x14'))['db'];function respondWithStatusCode(_0x9d1f4f,_0x20b206){_0x20b206=_0x20b206||0xcc;return function(_0x374ded){if(_0x374ded){return _0x9d1f4f[_0xfe5a('0x15')](_0x20b206);}return _0x9d1f4f['status'](_0x20b206)[_0xfe5a('0x16')]();};}function respondWithResult(_0x17bbbe,_0x42969b){_0x42969b=_0x42969b||0xc8;return function(_0x362115){if(_0x362115){return _0x17bbbe[_0xfe5a('0x17')](_0x42969b)[_0xfe5a('0x18')](_0x362115);}};}function respondWithFilteredResult(_0x375380,_0xeb454){return function(_0x111d4d){if(_0x111d4d){var _0x18c57b=typeof _0xeb454[_0xfe5a('0x19')]===_0xfe5a('0x1a')&&typeof _0xeb454[_0xfe5a('0x1b')]===_0xfe5a('0x1a');var _0x3edcab=_0x111d4d[_0xfe5a('0x1c')];var _0x5bf597=_0x18c57b?0x0:_0xeb454[_0xfe5a('0x19')];var _0x456707=_0x18c57b?_0x111d4d['count']:_0xeb454[_0xfe5a('0x19')]+_0xeb454[_0xfe5a('0x1b')];var _0x39d905;if(_0x456707>=_0x3edcab){_0x456707=_0x3edcab;_0x39d905=0xc8;}else{_0x39d905=0xce;}_0x375380['status'](_0x39d905);return _0x375380['set'](_0xfe5a('0x1d'),_0x5bf597+'-'+_0x456707+'/'+_0x3edcab)[_0xfe5a('0x18')](_0x111d4d);}return null;};}function patchUpdates(_0xded538){return function(_0x3b3022){try{jsonpatch[_0xfe5a('0x1e')](_0x3b3022,_0xded538,!![]);}catch(_0x355869){return BPromise['reject'](_0x355869);}return _0x3b3022[_0xfe5a('0x1f')]();};}function saveUpdates(_0x592521,_0x3dfa57){return function(_0x39d825){if(_0x39d825){return _0x39d825[_0xfe5a('0x20')](_0x592521)['then'](function(_0x4bbef1){return _0x4bbef1;});}return null;};}function removeEntity(_0x247be4,_0x3e55fd){return function(_0x494df3){if(_0x494df3){return _0x494df3[_0xfe5a('0x21')]()[_0xfe5a('0x22')](function(){var _0x578d3e=_0x494df3[_0xfe5a('0x23')]({'plain':!![]});var _0x3a4f3c=_0xfe5a('0x24');return db[_0xfe5a('0x25')]['destroy']({'where':{'type':_0x3a4f3c,'resourceId':_0x578d3e['id']}})[_0xfe5a('0x22')](function(){return _0x494df3;});})[_0xfe5a('0x22')](function(){_0x247be4[_0xfe5a('0x17')](0xcc)[_0xfe5a('0x16')]();});}};}function handleEntityNotFound(_0x36bf20,_0x222490){return function(_0xdbf1e0){if(!_0xdbf1e0){_0x36bf20[_0xfe5a('0x15')](0x194);}return _0xdbf1e0;};}function handleError(_0x55d89e,_0x4df546){_0x4df546=_0x4df546||0x1f4;return function(_0x712b44){logger['error'](_0x712b44[_0xfe5a('0x26')]);if(_0x712b44[_0xfe5a('0x27')]){delete _0x712b44[_0xfe5a('0x27')];}_0x55d89e['status'](_0x4df546)['send'](_0x712b44);};}exports['index']=function(_0x32d31e,_0x582f2d){var _0x51d1f4={},_0x498b64={},_0x3b6e4d={'count':0x0,'rows':[]};var _0x14c66d=_[_0xfe5a('0x28')](db[_0xfe5a('0x29')][_0xfe5a('0x2a')],function(_0x286f27){return{'name':_0x286f27[_0xfe5a('0x2b')],'type':_0x286f27[_0xfe5a('0x2c')][_0xfe5a('0x2d')]};});_0x498b64[_0xfe5a('0x2e')]=_[_0xfe5a('0x28')](_0x14c66d,'name');_0x498b64[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x32d31e['query']);_0x498b64[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x498b64[_0xfe5a('0x2e')],_0x498b64[_0xfe5a('0x2f')]);_0x51d1f4[_0xfe5a('0x33')]=_['intersection'](_0x498b64['model'],qs[_0xfe5a('0x34')](_0x32d31e['query'][_0xfe5a('0x34')]));_0x51d1f4[_0xfe5a('0x33')]=_0x51d1f4[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x51d1f4['attributes']:_0x498b64[_0xfe5a('0x2e')];if(!_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x36')]('nolimit')){_0x51d1f4[_0xfe5a('0x1b')]=qs[_0xfe5a('0x1b')](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x1b')]);_0x51d1f4['offset']=qs[_0xfe5a('0x19')](_0x32d31e['query'][_0xfe5a('0x19')]);}_0x51d1f4[_0xfe5a('0x37')]=qs['sort'](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x38')]);_0x51d1f4[_0xfe5a('0x39')]=qs[_0xfe5a('0x31')](_['pick'](_0x32d31e[_0xfe5a('0x2f')],_0x498b64[_0xfe5a('0x31')]),_0x14c66d);if(_0x32d31e[_0xfe5a('0x2f')]['filter']){_0x51d1f4[_0xfe5a('0x39')]=_[_0xfe5a('0x3a')](_0x51d1f4[_0xfe5a('0x39')],{'$or':_[_0xfe5a('0x28')](_0x14c66d,function(_0xec56ad){if(_0xec56ad[_0xfe5a('0x2c')]!==_0xfe5a('0x3b')){var _0x243271={};_0x243271[_0xec56ad[_0xfe5a('0x27')]]={'$like':'%'+_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3c')]+'%'};return _0x243271;}})});}_0x51d1f4=_['merge']({},_0x51d1f4,_0x32d31e[_0xfe5a('0x3d')]);var _0x315396={'where':_0x51d1f4[_0xfe5a('0x39')]};return db[_0xfe5a('0x29')][_0xfe5a('0x1c')](_0x315396)[_0xfe5a('0x22')](function(_0x3475fb){_0x3b6e4d['count']=_0x3475fb;if(_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x51d1f4['include']=[{'all':!![]}];}return db['ContactItemType'][_0xfe5a('0x3f')](_0x51d1f4);})['then'](function(_0x54096d){_0x3b6e4d[_0xfe5a('0x40')]=_0x54096d;return _0x3b6e4d;})[_0xfe5a('0x22')](respondWithFilteredResult(_0x582f2d,_0x51d1f4))['catch'](handleError(_0x582f2d,null));};exports[_0xfe5a('0x41')]=function(_0x5a9c92,_0x5112a9){var _0x1dbb2c={'raw':!![],'where':{'id':_0x5a9c92[_0xfe5a('0x42')]['id']}},_0x1a92ef={};_0x1a92ef[_0xfe5a('0x2e')]=_[_0xfe5a('0x30')](db['ContactItemType'][_0xfe5a('0x2a')]);_0x1a92ef[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x5a9c92[_0xfe5a('0x2f')]);_0x1a92ef[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],_0x1a92ef[_0xfe5a('0x2f')]);_0x1dbb2c[_0xfe5a('0x33')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],qs[_0xfe5a('0x34')](_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x34')]));_0x1dbb2c['attributes']=_0x1dbb2c[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x1dbb2c['attributes']:_0x1a92ef['model'];if(_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x1dbb2c[_0xfe5a('0x43')]=[{'all':!![]}];}_0x1dbb2c=_[_0xfe5a('0x3a')]({},_0x1dbb2c,_0x5a9c92[_0xfe5a('0x3d')]);return db[_0xfe5a('0x29')][_0xfe5a('0x44')](_0x1dbb2c)['then'](handleEntityNotFound(_0x5112a9,null))[_0xfe5a('0x22')](respondWithResult(_0x5112a9,null))['catch'](handleError(_0x5112a9,null));};exports[_0xfe5a('0x45')]=function(_0x5a807e,_0x433562){return db[_0xfe5a('0x29')][_0xfe5a('0x45')](_0x5a807e[_0xfe5a('0x46')],{})['then'](function(_0x394073){var _0x3f8447=_0x5a807e['user'][_0xfe5a('0x23')]({'plain':!![]});if(!_0x3f8447)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f8447['role']===_0xfe5a('0x47')){var _0x4e02c9=_0x394073[_0xfe5a('0x23')]({'plain':!![]});var _0x4536ba=_0xfe5a('0x24');return db[_0xfe5a('0x48')]['find']({'where':{'name':_0x4536ba,'userProfileId':_0x3f8447[_0xfe5a('0x49')]},'raw':!![]})['then'](function(_0x34247f){if(_0x34247f&&_0x34247f[_0xfe5a('0x4a')]===0x0){return db[_0xfe5a('0x25')]['create']({'name':_0x4e02c9[_0xfe5a('0x27')],'resourceId':_0x4e02c9['id'],'type':_0x34247f[_0xfe5a('0x27')],'sectionId':_0x34247f['id']},{})['then'](function(){return _0x394073;});}else{return _0x394073;}})[_0xfe5a('0x4b')](function(_0x42f2e2){logger[_0xfe5a('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42f2e2);throw _0x42f2e2;});}return _0x394073;})[_0xfe5a('0x22')](respondWithResult(_0x433562,0xc9))[_0xfe5a('0x4b')](handleError(_0x433562,null));};exports[_0xfe5a('0x20')]=function(_0x4d3bd8,_0x36395a){if(_0x4d3bd8[_0xfe5a('0x46')]['id']){delete _0x4d3bd8['body']['id'];}return db[_0xfe5a('0x29')]['find']({'where':{'id':_0x4d3bd8[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x36395a,null))[_0xfe5a('0x22')](saveUpdates(_0x4d3bd8[_0xfe5a('0x46')],null))[_0xfe5a('0x22')](respondWithResult(_0x36395a,null))[_0xfe5a('0x4b')](handleError(_0x36395a,null));};exports[_0xfe5a('0x21')]=function(_0x3432d1,_0x127a9f){return db[_0xfe5a('0x29')][_0xfe5a('0x44')]({'where':{'id':_0x3432d1[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x127a9f,null))[_0xfe5a('0x22')](db[_0xfe5a('0x4d')][_0xfe5a('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3432d1['params']['id']}}))[_0xfe5a('0x22')](removeEntity(_0x127a9f,null))[_0xfe5a('0x4b')](handleError(_0x127a9f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 911e6b2..a17f1c4 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 _0x2288=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x56d3cf,_0x20787b){var _0x5881e6=function(_0x2bd2cc){while(--_0x2bd2cc){_0x56d3cf['push'](_0x56d3cf['shift']());}};_0x5881e6(++_0x20787b);}(_0x2288,0x119));var _0x8228=function(_0x23739a,_0x14a461){_0x23739a=_0x23739a-0x0;var _0x587496=_0x2288[_0x23739a];return _0x587496;};'use strict';var _=require(_0x8228('0x0'));var util=require(_0x8228('0x1'));var logger=require(_0x8228('0x2'))('api');var moment=require(_0x8228('0x3'));var BPromise=require(_0x8228('0x4'));var rp=require(_0x8228('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8228('0x6'));var config=require(_0x8228('0x7'));var attributes=require(_0x8228('0x8'));module[_0x8228('0x9')]=function(_0x2f346f,_0x25a7fc){return _0x2f346f[_0x8228('0xa')](_0x8228('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51eb=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x51eb,0x1ba));var _0xb51e=function(_0x1554fd,_0x2fe785){_0x1554fd=_0x1554fd-0x0;var _0x56b577=_0x51eb[_0x1554fd];return _0x56b577;};'use strict';var _=require(_0xb51e('0x0'));var util=require(_0xb51e('0x1'));var logger=require(_0xb51e('0x2'))(_0xb51e('0x3'));var moment=require('moment');var BPromise=require(_0xb51e('0x4'));var rp=require(_0xb51e('0x5'));var fs=require('fs');var path=require(_0xb51e('0x6'));var rimraf=require(_0xb51e('0x7'));var config=require(_0xb51e('0x8'));var attributes=require(_0xb51e('0x9'));module[_0xb51e('0xa')]=function(_0x4ad79b,_0x4e063d){return _0x4ad79b[_0xb51e('0xb')](_0xb51e('0xc'),attributes,{'tableName':'tools_contact_item_types','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 f5da2f6..aade266 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 _0x1241=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5e6304,_0x493578){var _0x506e57=function(_0x78e5af){while(--_0x78e5af){_0x5e6304['push'](_0x5e6304['shift']());}};_0x506e57(++_0x493578);}(_0x1241,0x155));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1124('0x0'));var util=require(_0x1124('0x1'));var moment=require(_0x1124('0x2'));var BPromise=require(_0x1124('0x3'));var rs=require(_0x1124('0x4'));var fs=require('fs');var Redis=require(_0x1124('0x5'));var db=require(_0x1124('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1124('0x7'))(_0x1124('0x8'));var config=require(_0x1124('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1124('0xa')][_0x1124('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x214742,_0x58128a,_0x243606){return new BPromise(function(_0x5ca885,_0xcc972f){return client['request'](_0x214742,_0x243606)[_0x1124('0xc')](function(_0xb04f55){logger[_0x1124('0xd')]('ContactItemType,\x20%s,\x20%s',_0x58128a,'request\x20sent');logger['debug'](_0x1124('0xe'),_0x58128a,_0x1124('0xf'),JSON[_0x1124('0x10')](_0xb04f55));if(_0xb04f55['error']){if(_0xb04f55[_0x1124('0x11')][_0x1124('0x12')]===0x1f4){logger[_0x1124('0x11')](_0x1124('0x13'),_0x58128a,_0xb04f55['error']['message']);return _0xcc972f(_0xb04f55[_0x1124('0x11')][_0x1124('0x14')]);}logger[_0x1124('0x11')](_0x1124('0x13'),_0x58128a,_0xb04f55[_0x1124('0x11')][_0x1124('0x14')]);return _0x5ca885(_0xb04f55[_0x1124('0x11')]['message']);}else{logger[_0x1124('0xd')](_0x1124('0x13'),_0x58128a,_0x1124('0xf'));_0x5ca885(_0xb04f55[_0x1124('0x15')][_0x1124('0x14')]);}})[_0x1124('0x16')](function(_0x51cabc){logger[_0x1124('0x11')]('ContactItemType,\x20%s,\x20%s',_0x58128a,_0x51cabc);_0xcc972f(_0x51cabc);});});} \ No newline at end of file +var _0xc91e=['client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xc91e,0xf3));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xec91('0x0'));var moment=require(_0xec91('0x1'));var BPromise=require(_0xec91('0x2'));var rs=require(_0xec91('0x3'));var fs=require('fs');var Redis=require(_0xec91('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec91('0x5'));var logger=require(_0xec91('0x6'))(_0xec91('0x7'));var config=require(_0xec91('0x8'));var jayson=require(_0xec91('0x9'));var client=jayson[_0xec91('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd3e4,_0x200d13,_0x2642a0){return new BPromise(function(_0x231256,_0x801b57){return client[_0xec91('0xb')](_0x1fd3e4,_0x2642a0)[_0xec91('0xc')](function(_0x527010){logger[_0xec91('0xd')](_0xec91('0xe'),_0x200d13,_0xec91('0xf'));logger[_0xec91('0x10')](_0xec91('0x11'),_0x200d13,_0xec91('0xf'),JSON[_0xec91('0x12')](_0x527010));if(_0x527010[_0xec91('0x13')]){if(_0x527010[_0xec91('0x13')][_0xec91('0x14')]===0x1f4){logger[_0xec91('0x13')](_0xec91('0xe'),_0x200d13,_0x527010[_0xec91('0x13')][_0xec91('0x15')]);return _0x801b57(_0x527010[_0xec91('0x13')][_0xec91('0x15')]);}logger['error'](_0xec91('0xe'),_0x200d13,_0x527010[_0xec91('0x13')]['message']);return _0x231256(_0x527010[_0xec91('0x13')][_0xec91('0x15')]);}else{logger['info'](_0xec91('0xe'),_0x200d13,'request\x20sent');_0x231256(_0x527010[_0xec91('0x16')][_0xec91('0x15')]);}})['catch'](function(_0x5eb6e1){logger['error'](_0xec91('0xe'),_0x200d13,_0x5eb6e1);_0x801b57(_0x5eb6e1);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 75e00d9..8b3cce9 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 _0xcac6=['isAuthenticated','show','post','create','put','/:id','delete','util','path','express','fs-extra','../../components/interaction/service','get'];(function(_0x5630e5,_0x22d4d1){var _0x1d3d8f=function(_0x3aeb0e){while(--_0x3aeb0e){_0x5630e5['push'](_0x5630e5['shift']());}};_0x1d3d8f(++_0x22d4d1);}(_0xcac6,0x159));var _0x6cac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcac6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x6cac('0x0'));var path=require(_0x6cac('0x1'));var timeout=require('connect-timeout');var express=require(_0x6cac('0x2'));var router=express['Router']();var fs_extra=require(_0x6cac('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6cac('0x4'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x6cac('0x5')]('/',auth[_0x6cac('0x6')](),controller['index']);router[_0x6cac('0x5')]('/:id',auth[_0x6cac('0x6')](),controller[_0x6cac('0x7')]);router[_0x6cac('0x8')]('/',auth[_0x6cac('0x6')](),controller[_0x6cac('0x9')]);router[_0x6cac('0xa')](_0x6cac('0xb'),auth[_0x6cac('0x6')](),controller['update']);router[_0x6cac('0xc')](_0x6cac('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9120=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0x9120,0xf1));var _0x0912=function(_0x3a9737,_0xb3e2d0){_0x3a9737=_0x3a9737-0x0;var _0xcf6a9d=_0x9120[_0x3a9737];return _0xcf6a9d;};'use strict';var multer=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var path=require(_0x0912('0x2'));var timeout=require('connect-timeout');var express=require(_0x0912('0x3'));var router=express[_0x0912('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0912('0x5'));var interaction=require(_0x0912('0x6'));var config=require(_0x0912('0x7'));var controller=require(_0x0912('0x8'));router[_0x0912('0x9')]('/',auth[_0x0912('0xa')](),controller[_0x0912('0xb')]);router['get'](_0x0912('0xc'),auth[_0x0912('0xa')](),controller[_0x0912('0xd')]);router[_0x0912('0xe')]('/',auth[_0x0912('0xa')](),controller[_0x0912('0xf')]);router['put'](_0x0912('0xc'),auth[_0x0912('0xa')](),controller[_0x0912('0x10')]);router[_0x0912('0x11')](_0x0912('0xc'),auth[_0x0912('0xa')](),controller[_0x0912('0x12')]);module[_0x0912('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d739b61..27371c3 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 _0xe706=['STRING','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe706,0xa3));var _0x6e70=function(_0x3dd822,_0x3b9fed){_0x3dd822=_0x3dd822-0x0;var _0x4f58d0=_0xe706[_0x3dd822];return _0x4f58d0;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x56e2b3,_0x2153f7){var _0x3581f1=function(_0x27bc57){while(--_0x27bc57){_0x56e2b3['push'](_0x56e2b3['shift']());}};_0x3581f1(++_0x2153f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x24c15a,_0x261c48){_0x24c15a=_0x24c15a-0x0;var _0x2a3137=_0xb10b[_0x24c15a];return _0x2a3137;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index eddfb63..b66602e 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 _0x94a4=['value','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','DashboardId','getItems','findOne','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboard.socket','register','sendStatus','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','status','end','stack','name','map','rawAttributes','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','Dashboard','include','findAll','catch','show','intersection','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','update','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','attrTimezone'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x94a4,0x197));var _0x494a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x94a4[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x494a('0x0'));var rimraf=require(_0x494a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x494a('0x2'));var rp=require(_0x494a('0x3'));var moment=require('moment');var BPromise=require(_0x494a('0x4'));var Mustache=require(_0x494a('0x5'));var util=require(_0x494a('0x6'));var path=require(_0x494a('0x7'));var sox=require(_0x494a('0x8'));var csv=require(_0x494a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x494a('0xa'));var _=require(_0x494a('0xb'));var squel=require('squel');var crypto=require(_0x494a('0xc'));var jsforce=require(_0x494a('0xd'));var deskjs=require(_0x494a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x494a('0xf'));var Papa=require(_0x494a('0x10'));var Redis=require(_0x494a('0x11'));var authService=require(_0x494a('0x12'));var qs=require(_0x494a('0x13'));var as=require(_0x494a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x494a('0x15'))(_0x494a('0x16'));var utils=require(_0x494a('0x17'));var config=require(_0x494a('0x18'));var licenseUtil=require(_0x494a('0x19'));var db=require(_0x494a('0x1a'))['db'];config[_0x494a('0x1b')]=_[_0x494a('0x1c')](config[_0x494a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x494a('0x1d'))[_0x494a('0x1e')](socket);function respondWithStatusCode(_0x5eafbb,_0x16e846){_0x16e846=_0x16e846||0xcc;return function(_0x5e47f7){if(_0x5e47f7){return _0x5eafbb[_0x494a('0x1f')](_0x16e846);}return _0x5eafbb['status'](_0x16e846)['end']();};}function respondWithResult(_0x31e827,_0x3edfef){_0x3edfef=_0x3edfef||0xc8;return function(_0x153a52){if(_0x153a52){return _0x31e827['status'](_0x3edfef)['json'](_0x153a52);}};}function respondWithFilteredResult(_0x1086b7,_0x166915){return function(_0x1aeb44){if(_0x1aeb44){var _0x1512d9=typeof _0x166915[_0x494a('0x20')]==='undefined'&&typeof _0x166915[_0x494a('0x21')]===_0x494a('0x22');var _0xc6b929=_0x1aeb44[_0x494a('0x23')];var _0x10df25=_0x1512d9?0x0:_0x166915[_0x494a('0x20')];var _0xe30a42=_0x1512d9?_0x1aeb44[_0x494a('0x23')]:_0x166915[_0x494a('0x20')]+_0x166915['limit'];var _0x4cb6f4;if(_0xe30a42>=_0xc6b929){_0xe30a42=_0xc6b929;_0x4cb6f4=0xc8;}else{_0x4cb6f4=0xce;}_0x1086b7['status'](_0x4cb6f4);return _0x1086b7[_0x494a('0x24')](_0x494a('0x25'),_0x10df25+'-'+_0xe30a42+'/'+_0xc6b929)['json'](_0x1aeb44);}return null;};}function patchUpdates(_0x18adfc){return function(_0xca4088){try{jsonpatch['apply'](_0xca4088,_0x18adfc,!![]);}catch(_0x54c965){return BPromise[_0x494a('0x26')](_0x54c965);}return _0xca4088[_0x494a('0x27')]();};}function saveUpdates(_0x504d5d,_0x3d50b9){return function(_0x274285){if(_0x274285){return _0x274285['update'](_0x504d5d)[_0x494a('0x28')](function(_0x514ebd){return _0x514ebd;});}return null;};}function removeEntity(_0x2e1306,_0x5eeaad){return function(_0x2d8bb3){if(_0x2d8bb3){return _0x2d8bb3[_0x494a('0x29')]()['then'](function(){var _0x5c8e1a=_0x2d8bb3['get']({'plain':!![]});var _0x23d6c6='CustomDashboards';return db[_0x494a('0x2a')]['destroy']({'where':{'type':_0x23d6c6,'resourceId':_0x5c8e1a['id']}})[_0x494a('0x28')](function(){return _0x2d8bb3;});})[_0x494a('0x28')](function(){_0x2e1306[_0x494a('0x2b')](0xcc)[_0x494a('0x2c')]();});}};}function handleEntityNotFound(_0x4a9f24,_0x59f03b){return function(_0x42c939){if(!_0x42c939){_0x4a9f24[_0x494a('0x1f')](0x194);}return _0x42c939;};}function handleError(_0x205947,_0x3817bd){_0x3817bd=_0x3817bd||0x1f4;return function(_0x1f2283){logger['error'](_0x1f2283[_0x494a('0x2d')]);if(_0x1f2283[_0x494a('0x2e')]){delete _0x1f2283['name'];}_0x205947[_0x494a('0x2b')](_0x3817bd)['send'](_0x1f2283);};}exports['index']=function(_0x1cff1b,_0x41c766){var _0x5dc4f4={},_0x503c6e={},_0x23bb02={'count':0x0,'rows':[]};var _0x12091b=_[_0x494a('0x2f')](db['Dashboard'][_0x494a('0x30')],function(_0x1b0044){return{'name':_0x1b0044['fieldName'],'type':_0x1b0044[_0x494a('0x31')][_0x494a('0x32')]};});_0x503c6e['model']=_[_0x494a('0x2f')](_0x12091b,_0x494a('0x2e'));_0x503c6e[_0x494a('0x33')]=_[_0x494a('0x34')](_0x1cff1b[_0x494a('0x33')]);_0x503c6e['filters']=_['intersection'](_0x503c6e[_0x494a('0x35')],_0x503c6e[_0x494a('0x33')]);_0x5dc4f4[_0x494a('0x36')]=_['intersection'](_0x503c6e[_0x494a('0x35')],qs[_0x494a('0x37')](_0x1cff1b['query'][_0x494a('0x37')]));_0x5dc4f4['attributes']=_0x5dc4f4[_0x494a('0x36')][_0x494a('0x38')]?_0x5dc4f4['attributes']:_0x503c6e[_0x494a('0x35')];if(!_0x1cff1b[_0x494a('0x33')][_0x494a('0x39')]('nolimit')){_0x5dc4f4[_0x494a('0x21')]=qs[_0x494a('0x21')](_0x1cff1b[_0x494a('0x33')]['limit']);_0x5dc4f4[_0x494a('0x20')]=qs['offset'](_0x1cff1b['query'][_0x494a('0x20')]);}_0x5dc4f4[_0x494a('0x3a')]=qs[_0x494a('0x3b')](_0x1cff1b[_0x494a('0x33')]['sort']);_0x5dc4f4['where']=qs[_0x494a('0x3c')](_[_0x494a('0x3d')](_0x1cff1b[_0x494a('0x33')],_0x503c6e[_0x494a('0x3c')]),_0x12091b);if(_0x1cff1b[_0x494a('0x33')][_0x494a('0x3e')]){_0x5dc4f4[_0x494a('0x3f')]=_[_0x494a('0x40')](_0x5dc4f4[_0x494a('0x3f')],{'$or':_['map'](_0x12091b,function(_0x4c2b66){if(_0x4c2b66[_0x494a('0x31')]!=='VIRTUAL'){var _0x5b2bec={};_0x5b2bec[_0x4c2b66['name']]={'$like':'%'+_0x1cff1b[_0x494a('0x33')]['filter']+'%'};return _0x5b2bec;}})});}_0x5dc4f4=_['merge']({},_0x5dc4f4,_0x1cff1b[_0x494a('0x41')]);var _0x1ba5ff={'where':_0x5dc4f4[_0x494a('0x3f')]};return db[_0x494a('0x42')][_0x494a('0x23')](_0x1ba5ff)[_0x494a('0x28')](function(_0xf78dfd){_0x23bb02[_0x494a('0x23')]=_0xf78dfd;if(_0x1cff1b[_0x494a('0x33')]['includeAll']){_0x5dc4f4[_0x494a('0x43')]=[{'all':!![]}];}return db[_0x494a('0x42')][_0x494a('0x44')](_0x5dc4f4);})[_0x494a('0x28')](function(_0x591ccf){_0x23bb02['rows']=_0x591ccf;return _0x23bb02;})[_0x494a('0x28')](respondWithFilteredResult(_0x41c766,_0x5dc4f4))[_0x494a('0x45')](handleError(_0x41c766,null));};exports[_0x494a('0x46')]=function(_0x4072c8,_0x18094b){var _0x47d0a9={'raw':![],'where':{'id':_0x4072c8['params']['id']}},_0x1e5475={};_0x1e5475[_0x494a('0x35')]=_[_0x494a('0x34')](db[_0x494a('0x42')][_0x494a('0x30')]);_0x1e5475[_0x494a('0x33')]=_[_0x494a('0x34')](_0x4072c8['query']);_0x1e5475[_0x494a('0x3c')]=_[_0x494a('0x47')](_0x1e5475[_0x494a('0x35')],_0x1e5475[_0x494a('0x33')]);_0x47d0a9[_0x494a('0x36')]=_['intersection'](_0x1e5475[_0x494a('0x35')],qs[_0x494a('0x37')](_0x4072c8[_0x494a('0x33')][_0x494a('0x37')]));_0x47d0a9[_0x494a('0x36')]=_0x47d0a9[_0x494a('0x36')]['length']?_0x47d0a9[_0x494a('0x36')]:_0x1e5475[_0x494a('0x35')];if(_0x4072c8[_0x494a('0x33')][_0x494a('0x48')]){_0x47d0a9[_0x494a('0x43')]=[{'all':!![]}];}_0x47d0a9=_[_0x494a('0x40')]({},_0x47d0a9,_0x4072c8['options']);return db[_0x494a('0x42')][_0x494a('0x49')](_0x47d0a9)[_0x494a('0x28')](handleEntityNotFound(_0x18094b,null))[_0x494a('0x28')](respondWithResult(_0x18094b,null))['catch'](handleError(_0x18094b,null));};exports[_0x494a('0x4a')]=function(_0x7e1f84,_0x4aa7c1){return db[_0x494a('0x42')][_0x494a('0x4a')](_0x7e1f84[_0x494a('0x4b')],{})[_0x494a('0x28')](function(_0x36d7de){var _0x599abc=_0x7e1f84[_0x494a('0x4c')][_0x494a('0x4d')]({'plain':!![]});if(!_0x599abc)throw new Error(_0x494a('0x4e'));if(_0x599abc[_0x494a('0x4f')]===_0x494a('0x4c')){var _0x48057d=_0x36d7de[_0x494a('0x4d')]({'plain':!![]});var _0x4b9979=_0x494a('0x50');return db[_0x494a('0x51')][_0x494a('0x49')]({'where':{'name':_0x4b9979,'userProfileId':_0x599abc[_0x494a('0x52')]},'raw':!![]})[_0x494a('0x28')](function(_0x5e2149){if(_0x5e2149&&_0x5e2149[_0x494a('0x53')]===0x0){return db[_0x494a('0x2a')][_0x494a('0x4a')]({'name':_0x48057d[_0x494a('0x2e')],'resourceId':_0x48057d['id'],'type':_0x5e2149[_0x494a('0x2e')],'sectionId':_0x5e2149['id']},{})[_0x494a('0x28')](function(){return _0x36d7de;});}else{return _0x36d7de;}})[_0x494a('0x45')](function(_0x58af0e){logger[_0x494a('0x54')](_0x494a('0x55'),_0x58af0e);throw _0x58af0e;});}return _0x36d7de;})[_0x494a('0x28')](respondWithResult(_0x4aa7c1,0xc9))[_0x494a('0x45')](handleError(_0x4aa7c1,null));};exports[_0x494a('0x56')]=function(_0xbef9df,_0x385b7b){var _0x19ceb6={'where':{'id':_0xbef9df[_0x494a('0x57')]['id']}},_0x46c340={};_0x46c340[_0x494a('0x35')]=_[_0x494a('0x34')](db[_0x494a('0x42')][_0x494a('0x30')]);_0x19ceb6[_0x494a('0x36')]=_[_0x494a('0x47')](_0x46c340['model'],qs['fields'](_0xbef9df[_0x494a('0x33')]['fields']));_0x19ceb6[_0x494a('0x36')]=_0x19ceb6[_0x494a('0x36')][_0x494a('0x38')]?_0x19ceb6['attributes']:_0x46c340[_0x494a('0x35')];if(_0xbef9df[_0x494a('0x33')][_0x494a('0x48')]){_0x19ceb6[_0x494a('0x43')]=[{'all':!![]}];}_0x19ceb6=_[_0x494a('0x40')]({},_0x19ceb6,_0xbef9df[_0x494a('0x41')]);return db[_0x494a('0x42')][_0x494a('0x49')](_0x19ceb6)[_0x494a('0x28')](handleEntityNotFound(_0x385b7b,null))['then'](function(_0x3ec8e8){if(_0x3ec8e8){var _0x82935a=_0x3ec8e8['get']({'plain':!![]});_0x82935a=qs[_0x494a('0x58')](_0x82935a,['id',_0x494a('0x59'),_0x494a('0x5a')]);_0xbef9df['body']=_['omit'](_0xbef9df['body'],['id',_0x494a('0x59'),_0x494a('0x5a')]);return db[_0x494a('0x42')][_0x494a('0x4a')](_['merge'](_0x82935a,_0xbef9df[_0x494a('0x4b')]),{'include':_0xbef9df[_0x494a('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x494a('0x28')](function(_0x1e471c){var _0x366f44=_0xbef9df[_0x494a('0x4c')][_0x494a('0x4d')]({'plain':!![]});if(!_0x366f44)throw new Error(_0x494a('0x4e'));if(_0x366f44[_0x494a('0x4f')]===_0x494a('0x4c')){var _0xbd19ab=_0x1e471c['get']({'plain':!![]});var _0x24c8ca='CustomDashboards';return db[_0x494a('0x51')][_0x494a('0x49')]({'where':{'name':_0x24c8ca,'userProfileId':_0x366f44[_0x494a('0x52')]},'raw':!![]})['then'](function(_0x13350f){if(_0x13350f&&_0x13350f['autoAssociation']===0x0){return db[_0x494a('0x2a')]['create']({'name':_0xbd19ab[_0x494a('0x2e')],'resourceId':_0xbd19ab['id'],'type':_0x13350f['name'],'sectionId':_0x13350f['id']},{})[_0x494a('0x28')](function(){return _0x1e471c;});}else{return _0x1e471c;}})[_0x494a('0x45')](function(_0x34bcb2){logger[_0x494a('0x54')](_0x494a('0x55'),_0x34bcb2);throw _0x34bcb2;});}return _0x1e471c;});}})[_0x494a('0x28')](respondWithResult(_0x385b7b,0xc9))[_0x494a('0x45')](handleError(_0x385b7b,null));};exports[_0x494a('0x5b')]=function(_0x4f1b1c,_0x1595c0){if(_0x4f1b1c[_0x494a('0x4b')]['id']){delete _0x4f1b1c[_0x494a('0x4b')]['id'];}return db[_0x494a('0x42')][_0x494a('0x49')]({'where':{'id':_0x4f1b1c[_0x494a('0x57')]['id']}})[_0x494a('0x28')](handleEntityNotFound(_0x1595c0,null))['then'](saveUpdates(_0x4f1b1c['body'],null))[_0x494a('0x28')](respondWithResult(_0x1595c0,null))[_0x494a('0x45')](handleError(_0x1595c0,null));};exports[_0x494a('0x29')]=function(_0x32474c,_0x4191d7){return db[_0x494a('0x42')][_0x494a('0x49')]({'where':{'id':_0x32474c[_0x494a('0x57')]['id']}})[_0x494a('0x28')](handleEntityNotFound(_0x4191d7,null))[_0x494a('0x28')](removeEntity(_0x4191d7,null))[_0x494a('0x45')](handleError(_0x4191d7,null));};function widgetAttributes(_0x3667a4){try{switch(_0x3667a4[_0x494a('0x31')]){case _0x494a('0x5c'):return[{'name':_0x494a('0x5d'),'value':_0x3667a4[_0x494a('0x5d')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x0]?_0x3667a4[_0x494a('0x5e')][0x0]['value']:undefined)||_0x494a('0x5f')}];case _0x494a('0x60'):return[{'name':_0x494a('0x61'),'value':_0x3667a4[_0x494a('0x61')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x0]?_0x3667a4[_0x494a('0x5e')][0x0]['value']:undefined)||''}];case _0x494a('0x62'):return[{'name':_0x494a('0x63'),'value':_0x3667a4[_0x494a('0x63')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x0]?_0x3667a4[_0x494a('0x5e')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x494a('0x64'),'value':_0x3667a4[_0x494a('0x64')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x1]?_0x3667a4[_0x494a('0x5e')][0x1][_0x494a('0x65')]:undefined)||'0.00'},{'name':_0x494a('0x66'),'value':_0x3667a4['attrFontSize']||(_0x3667a4['attrs']&&_0x3667a4[_0x494a('0x5e')][0x2]?_0x3667a4['attrs'][0x2]['value']:undefined)||0xc}];case _0x494a('0x67'):return[{'name':'attrMetric','value':_0x3667a4[_0x494a('0x68')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x0]?_0x3667a4[_0x494a('0x5e')][0x0][_0x494a('0x65')]:undefined)||_0x494a('0x69')},{'name':_0x494a('0x6a'),'value':_0x3667a4['attrVoiceQueues']||(_0x3667a4['attrs']&&_0x3667a4[_0x494a('0x5e')][0x1]?_0x3667a4[_0x494a('0x5e')][0x1][_0x494a('0x65')]:undefined)||[]},{'name':_0x494a('0x66'),'value':_0x3667a4[_0x494a('0x66')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x2]?_0x3667a4[_0x494a('0x5e')][0x2][_0x494a('0x65')]:undefined)||0x14},{'name':'attrChannel','value':_0x3667a4[_0x494a('0x6b')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x3]?_0x3667a4['attrs'][0x3][_0x494a('0x65')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x3667a4[_0x494a('0x6c')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x4]?_0x3667a4[_0x494a('0x5e')][0x4]['value']:undefined)||''},{'name':_0x494a('0x6d'),'value':_0x3667a4[_0x494a('0x6d')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x5]?_0x3667a4[_0x494a('0x5e')][0x5][_0x494a('0x65')]:undefined)||''},{'name':_0x494a('0x6e'),'value':_0x3667a4['attrSmsAccounts']||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x6]?_0x3667a4[_0x494a('0x5e')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3667a4[_0x494a('0x6f')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x7]?_0x3667a4[_0x494a('0x5e')][0x7][_0x494a('0x65')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3667a4['attrWhatsappAccounts']||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x8]?_0x3667a4['attrs'][0x8][_0x494a('0x65')]:undefined)||''},{'name':_0x494a('0x70'),'value':_0x3667a4[_0x494a('0x70')]||(_0x3667a4['attrs']&&_0x3667a4[_0x494a('0x5e')][0x9]?_0x3667a4[_0x494a('0x5e')][0x9][_0x494a('0x65')]:undefined)||''}];case _0x494a('0x71'):case _0x494a('0x72'):return[{'name':_0x494a('0x73'),'value':_0x3667a4[_0x494a('0x73')]||(_0x3667a4['attrs']&&_0x3667a4[_0x494a('0x5e')][0x0]?_0x3667a4['attrs'][0x0][_0x494a('0x65')]:undefined)||_0x494a('0x69')},{'name':_0x494a('0x74'),'value':_0x3667a4[_0x494a('0x74')]||(_0x3667a4['attrs']&&_0x3667a4['attrs'][0x1]?_0x3667a4[_0x494a('0x5e')][0x1][_0x494a('0x65')]:undefined)||null},{'name':'attrSerie3','value':_0x3667a4[_0x494a('0x75')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x2]?_0x3667a4[_0x494a('0x5e')][0x2][_0x494a('0x65')]:undefined)||null},{'name':_0x494a('0x6a'),'value':_0x3667a4[_0x494a('0x6a')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x3]?_0x3667a4[_0x494a('0x5e')][0x3][_0x494a('0x65')]:undefined)||[]},{'name':_0x494a('0x6b'),'value':_0x3667a4[_0x494a('0x6b')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0x4]?_0x3667a4[_0x494a('0x5e')][0x4][_0x494a('0x65')]:undefined)||'voice'},{'name':_0x494a('0x6c'),'value':_0x3667a4[_0x494a('0x6c')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x5]?_0x3667a4[_0x494a('0x5e')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3667a4['attrFaxAccounts']||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x6]?_0x3667a4[_0x494a('0x5e')][0x6][_0x494a('0x65')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3667a4[_0x494a('0x6e')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x7]?_0x3667a4[_0x494a('0x5e')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3667a4[_0x494a('0x6f')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x8]?_0x3667a4[_0x494a('0x5e')][0x8][_0x494a('0x65')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3667a4[_0x494a('0x76')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x9]?_0x3667a4['attrs'][0x9]['value']:undefined)||''},{'name':_0x494a('0x70'),'value':_0x3667a4[_0x494a('0x70')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4['attrs'][0xa]?_0x3667a4['attrs'][0xa][_0x494a('0x65')]:undefined)||''}];case _0x494a('0x77'):return[{'name':'attrReport','type':_0x3667a4[_0x494a('0x78')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x0]?_0x3667a4['attrs'][0x0][_0x494a('0x31')]:undefined)||null,'value':_0x3667a4[_0x494a('0x79')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x0]?_0x3667a4[_0x494a('0x5e')][0x0][_0x494a('0x65')]:undefined)||null},{'name':'attrRefresh','value':_0x3667a4[_0x494a('0x7a')]||(_0x3667a4[_0x494a('0x5e')]&&_0x3667a4[_0x494a('0x5e')][0x1]?_0x3667a4[_0x494a('0x5e')][0x1][_0x494a('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x29c6b1){logger['error'](_0x494a('0x7b'),JSON['stringify'](_0x29c6b1));return[];}}exports['addItem']=function(_0x2a3442,_0x462fcd,_0x83a184){if(_0x2a3442[_0x494a('0x4b')]['id']){delete _0x2a3442[_0x494a('0x4b')]['id'];}return db[_0x494a('0x42')]['find']({'where':{'id':_0x2a3442[_0x494a('0x57')]['id']}})[_0x494a('0x28')](handleEntityNotFound(_0x462fcd,null))['then'](function(_0x435552){if(_0x435552){_0x2a3442[_0x494a('0x4b')][_0x494a('0x7c')]=_0x435552['id'];_0x2a3442[_0x494a('0x4b')]['attrs']=widgetAttributes(_0x2a3442[_0x494a('0x4b')]);return db['DashboardItem'][_0x494a('0x4a')](_0x2a3442['body']);}})[_0x494a('0x28')](respondWithResult(_0x462fcd,null))[_0x494a('0x45')](handleError(_0x462fcd,null));};exports[_0x494a('0x7d')]=function(_0x56b76b,_0x2584bb,_0x9cb295){var _0x510c63={};var _0x59605d={};var _0x138395;var _0x165e45;return db[_0x494a('0x42')][_0x494a('0x7e')]({'where':{'id':_0x56b76b[_0x494a('0x57')]['id']}})[_0x494a('0x28')](handleEntityNotFound(_0x2584bb,null))[_0x494a('0x28')](function(_0x41651a){if(_0x41651a){_0x138395=_0x41651a;_0x59605d[_0x494a('0x35')]=_[_0x494a('0x34')](db['DashboardItem'][_0x494a('0x30')]);_0x59605d['query']=_[_0x494a('0x34')](_0x56b76b[_0x494a('0x33')]);_0x59605d['filters']=_[_0x494a('0x47')](_0x59605d[_0x494a('0x35')],_0x59605d[_0x494a('0x33')]);_0x510c63['attributes']=_[_0x494a('0x47')](_0x59605d[_0x494a('0x35')],qs[_0x494a('0x37')](_0x56b76b[_0x494a('0x33')]['fields']));_0x510c63['attributes']=_0x510c63[_0x494a('0x36')][_0x494a('0x38')]?_0x510c63[_0x494a('0x36')]:_0x59605d['model'];_0x510c63[_0x494a('0x3a')]=qs['sort'](_0x56b76b[_0x494a('0x33')][_0x494a('0x3b')]);_0x510c63[_0x494a('0x3f')]=qs[_0x494a('0x3c')](_[_0x494a('0x3d')](_0x56b76b[_0x494a('0x33')],_0x59605d[_0x494a('0x3c')]));if(_0x56b76b['query'][_0x494a('0x3e')]){_0x510c63[_0x494a('0x3f')]=_['merge'](_0x510c63['where'],{'$or':_[_0x494a('0x2f')](_0x510c63[_0x494a('0x36')],function(_0x3b226c){var _0x20240b={};_0x20240b[_0x3b226c]={'$like':'%'+_0x56b76b['query'][_0x494a('0x3e')]+'%'};return _0x20240b;})});}_0x510c63=_[_0x494a('0x40')]({},_0x510c63,_0x56b76b[_0x494a('0x41')]);return _0x138395[_0x494a('0x7d')](_0x510c63);}})[_0x494a('0x28')](function(_0x81ecd6){if(_0x81ecd6){_0x165e45=_0x81ecd6[_0x494a('0x38')];if(!_0x56b76b['query'][_0x494a('0x39')]('nolimit')){_0x510c63[_0x494a('0x21')]=qs[_0x494a('0x21')](_0x56b76b[_0x494a('0x33')][_0x494a('0x21')]);_0x510c63[_0x494a('0x20')]=qs['offset'](_0x56b76b[_0x494a('0x33')][_0x494a('0x20')]);}return _0x138395[_0x494a('0x7d')](_0x510c63);}})[_0x494a('0x28')](function(_0x7315f5){if(_0x7315f5){return _0x7315f5?{'count':_0x165e45,'rows':_0x7315f5}:null;}})[_0x494a('0x28')](respondWithResult(_0x2584bb,null))['catch'](handleError(_0x2584bb,null));}; \ No newline at end of file +var _0x82d4=['map','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','intersection','find','create','Dashboard','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','user','role','userProfileId','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','zip-dir','request-promise','bluebird','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x82d4,0xcf));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x482d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x482d('0x1'));var moment=require('moment');var BPromise=require(_0x482d('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x482d('0x3'));var sox=require('sox');var csv=require(_0x482d('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x482d('0x5'));var squel=require(_0x482d('0x6'));var crypto=require('crypto');var jsforce=require(_0x482d('0x7'));var deskjs=require(_0x482d('0x8'));var toCsv=require(_0x482d('0x4'));var querystring=require(_0x482d('0x9'));var Papa=require(_0x482d('0xa'));var Redis=require(_0x482d('0xb'));var authService=require(_0x482d('0xc'));var qs=require(_0x482d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x482d('0xe'));var logger=require(_0x482d('0xf'))(_0x482d('0x10'));var utils=require('../../config/utils');var config=require(_0x482d('0x11'));var licenseUtil=require(_0x482d('0x12'));var db=require('../../mysqldb')['db'];config[_0x482d('0x13')]=_[_0x482d('0x14')](config[_0x482d('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x482d('0x15'))(new Redis(config[_0x482d('0x13')]));require(_0x482d('0x16'))[_0x482d('0x17')](socket);function respondWithStatusCode(_0x4d81eb,_0x40685d){_0x40685d=_0x40685d||0xcc;return function(_0x1abf85){if(_0x1abf85){return _0x4d81eb[_0x482d('0x18')](_0x40685d);}return _0x4d81eb[_0x482d('0x19')](_0x40685d)['end']();};}function respondWithResult(_0x23c092,_0x5c2d78){_0x5c2d78=_0x5c2d78||0xc8;return function(_0xa202b5){if(_0xa202b5){return _0x23c092[_0x482d('0x19')](_0x5c2d78)[_0x482d('0x1a')](_0xa202b5);}};}function respondWithFilteredResult(_0x2d6209,_0x132d89){return function(_0x111629){if(_0x111629){var _0x5cbf7e=typeof _0x132d89[_0x482d('0x1b')]===_0x482d('0x1c')&&typeof _0x132d89['limit']===_0x482d('0x1c');var _0x382b46=_0x111629['count'];var _0x548ce9=_0x5cbf7e?0x0:_0x132d89[_0x482d('0x1b')];var _0x567d10=_0x5cbf7e?_0x111629['count']:_0x132d89['offset']+_0x132d89[_0x482d('0x1d')];var _0xaa5a9e;if(_0x567d10>=_0x382b46){_0x567d10=_0x382b46;_0xaa5a9e=0xc8;}else{_0xaa5a9e=0xce;}_0x2d6209[_0x482d('0x19')](_0xaa5a9e);return _0x2d6209[_0x482d('0x1e')](_0x482d('0x1f'),_0x548ce9+'-'+_0x567d10+'/'+_0x382b46)[_0x482d('0x1a')](_0x111629);}return null;};}function patchUpdates(_0x43414d){return function(_0x3339da){try{jsonpatch['apply'](_0x3339da,_0x43414d,!![]);}catch(_0x206907){return BPromise[_0x482d('0x20')](_0x206907);}return _0x3339da[_0x482d('0x21')]();};}function saveUpdates(_0x4a84da,_0xe1f230){return function(_0xfc4ff0){if(_0xfc4ff0){return _0xfc4ff0[_0x482d('0x22')](_0x4a84da)[_0x482d('0x23')](function(_0x42f0df){return _0x42f0df;});}return null;};}function removeEntity(_0x79397a,_0x145a1b){return function(_0x4b33a2){if(_0x4b33a2){return _0x4b33a2[_0x482d('0x24')]()[_0x482d('0x23')](function(){var _0x16476e=_0x4b33a2[_0x482d('0x25')]({'plain':!![]});var _0x30e74a=_0x482d('0x26');return db[_0x482d('0x27')][_0x482d('0x24')]({'where':{'type':_0x30e74a,'resourceId':_0x16476e['id']}})[_0x482d('0x23')](function(){return _0x4b33a2;});})[_0x482d('0x23')](function(){_0x79397a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c6ce,_0x39dfc4){return function(_0x2790a3){if(!_0x2790a3){_0x43c6ce['sendStatus'](0x194);}return _0x2790a3;};}function handleError(_0x768c72,_0x248313){_0x248313=_0x248313||0x1f4;return function(_0x42cf0c){logger[_0x482d('0x28')](_0x42cf0c[_0x482d('0x29')]);if(_0x42cf0c[_0x482d('0x2a')]){delete _0x42cf0c[_0x482d('0x2a')];}_0x768c72['status'](_0x248313)[_0x482d('0x2b')](_0x42cf0c);};}exports[_0x482d('0x2c')]=function(_0x2688da,_0x468e44){var _0x1da892={},_0xfe8c6d={},_0x2ac5e2={'count':0x0,'rows':[]};var _0x2e92f8=_[_0x482d('0x2d')](db['Dashboard'][_0x482d('0x2e')],function(_0x6fa3a0){return{'name':_0x6fa3a0[_0x482d('0x2f')],'type':_0x6fa3a0[_0x482d('0x30')][_0x482d('0x31')]};});_0xfe8c6d[_0x482d('0x32')]=_[_0x482d('0x2d')](_0x2e92f8,_0x482d('0x2a'));_0xfe8c6d['query']=_[_0x482d('0x33')](_0x2688da[_0x482d('0x34')]);_0xfe8c6d[_0x482d('0x35')]=_['intersection'](_0xfe8c6d[_0x482d('0x32')],_0xfe8c6d['query']);_0x1da892['attributes']=_['intersection'](_0xfe8c6d[_0x482d('0x32')],qs[_0x482d('0x36')](_0x2688da['query'][_0x482d('0x36')]));_0x1da892[_0x482d('0x37')]=_0x1da892[_0x482d('0x37')][_0x482d('0x38')]?_0x1da892['attributes']:_0xfe8c6d[_0x482d('0x32')];if(!_0x2688da['query'][_0x482d('0x39')](_0x482d('0x3a'))){_0x1da892['limit']=qs['limit'](_0x2688da['query'][_0x482d('0x1d')]);_0x1da892[_0x482d('0x1b')]=qs['offset'](_0x2688da[_0x482d('0x34')]['offset']);}_0x1da892[_0x482d('0x3b')]=qs[_0x482d('0x3c')](_0x2688da[_0x482d('0x34')]['sort']);_0x1da892[_0x482d('0x3d')]=qs[_0x482d('0x35')](_[_0x482d('0x3e')](_0x2688da[_0x482d('0x34')],_0xfe8c6d[_0x482d('0x35')]),_0x2e92f8);if(_0x2688da[_0x482d('0x34')][_0x482d('0x3f')]){_0x1da892[_0x482d('0x3d')]=_[_0x482d('0x40')](_0x1da892[_0x482d('0x3d')],{'$or':_[_0x482d('0x2d')](_0x2e92f8,function(_0x881186){if(_0x881186[_0x482d('0x30')]!==_0x482d('0x41')){var _0x513bc2={};_0x513bc2[_0x881186['name']]={'$like':'%'+_0x2688da[_0x482d('0x34')]['filter']+'%'};return _0x513bc2;}})});}_0x1da892=_[_0x482d('0x40')]({},_0x1da892,_0x2688da[_0x482d('0x42')]);var _0x3ead0e={'where':_0x1da892[_0x482d('0x3d')]};return db['Dashboard'][_0x482d('0x43')](_0x3ead0e)[_0x482d('0x23')](function(_0xb5f26f){_0x2ac5e2[_0x482d('0x43')]=_0xb5f26f;if(_0x2688da['query'][_0x482d('0x44')]){_0x1da892[_0x482d('0x45')]=[{'all':!![]}];}return db['Dashboard'][_0x482d('0x46')](_0x1da892);})[_0x482d('0x23')](function(_0x4a2c3e){_0x2ac5e2['rows']=_0x4a2c3e;return _0x2ac5e2;})[_0x482d('0x23')](respondWithFilteredResult(_0x468e44,_0x1da892))[_0x482d('0x47')](handleError(_0x468e44,null));};exports[_0x482d('0x48')]=function(_0x36410d,_0x29ded2){var _0x32b8f6={'raw':![],'where':{'id':_0x36410d['params']['id']}},_0x3c243a={};_0x3c243a[_0x482d('0x32')]=_[_0x482d('0x33')](db['Dashboard'][_0x482d('0x2e')]);_0x3c243a[_0x482d('0x34')]=_[_0x482d('0x33')](_0x36410d[_0x482d('0x34')]);_0x3c243a[_0x482d('0x35')]=_[_0x482d('0x49')](_0x3c243a[_0x482d('0x32')],_0x3c243a[_0x482d('0x34')]);_0x32b8f6[_0x482d('0x37')]=_[_0x482d('0x49')](_0x3c243a[_0x482d('0x32')],qs[_0x482d('0x36')](_0x36410d['query'][_0x482d('0x36')]));_0x32b8f6[_0x482d('0x37')]=_0x32b8f6[_0x482d('0x37')][_0x482d('0x38')]?_0x32b8f6[_0x482d('0x37')]:_0x3c243a[_0x482d('0x32')];if(_0x36410d[_0x482d('0x34')]['includeAll']){_0x32b8f6[_0x482d('0x45')]=[{'all':!![]}];}_0x32b8f6=_[_0x482d('0x40')]({},_0x32b8f6,_0x36410d[_0x482d('0x42')]);return db['Dashboard'][_0x482d('0x4a')](_0x32b8f6)[_0x482d('0x23')](handleEntityNotFound(_0x29ded2,null))[_0x482d('0x23')](respondWithResult(_0x29ded2,null))[_0x482d('0x47')](handleError(_0x29ded2,null));};exports[_0x482d('0x4b')]=function(_0x4aa23a,_0x60132b){return db[_0x482d('0x4c')][_0x482d('0x4b')](_0x4aa23a[_0x482d('0x4d')],{})['then'](function(_0xc07fc7){var _0x38f4d5=_0x4aa23a['user'][_0x482d('0x25')]({'plain':!![]});if(!_0x38f4d5)throw new Error(_0x482d('0x4e'));if(_0x38f4d5['role']==='user'){var _0x53d8e0=_0xc07fc7[_0x482d('0x25')]({'plain':!![]});var _0x2f19e6=_0x482d('0x26');return db[_0x482d('0x4f')]['find']({'where':{'name':_0x2f19e6,'userProfileId':_0x38f4d5['userProfileId']},'raw':!![]})[_0x482d('0x23')](function(_0x4c525b){if(_0x4c525b&&_0x4c525b[_0x482d('0x50')]===0x0){return db[_0x482d('0x27')][_0x482d('0x4b')]({'name':_0x53d8e0[_0x482d('0x2a')],'resourceId':_0x53d8e0['id'],'type':_0x4c525b[_0x482d('0x2a')],'sectionId':_0x4c525b['id']},{})[_0x482d('0x23')](function(){return _0xc07fc7;});}else{return _0xc07fc7;}})[_0x482d('0x47')](function(_0x475a8a){logger[_0x482d('0x28')](_0x482d('0x51'),_0x475a8a);throw _0x475a8a;});}return _0xc07fc7;})['then'](respondWithResult(_0x60132b,0xc9))['catch'](handleError(_0x60132b,null));};exports[_0x482d('0x52')]=function(_0x5b0b8b,_0x1bb403){var _0x5e7abf={'where':{'id':_0x5b0b8b[_0x482d('0x53')]['id']}},_0x40cea3={};_0x40cea3['model']=_[_0x482d('0x33')](db[_0x482d('0x4c')][_0x482d('0x2e')]);_0x5e7abf['attributes']=_[_0x482d('0x49')](_0x40cea3[_0x482d('0x32')],qs[_0x482d('0x36')](_0x5b0b8b[_0x482d('0x34')]['fields']));_0x5e7abf[_0x482d('0x37')]=_0x5e7abf[_0x482d('0x37')][_0x482d('0x38')]?_0x5e7abf[_0x482d('0x37')]:_0x40cea3[_0x482d('0x32')];if(_0x5b0b8b[_0x482d('0x34')][_0x482d('0x44')]){_0x5e7abf[_0x482d('0x45')]=[{'all':!![]}];}_0x5e7abf=_[_0x482d('0x40')]({},_0x5e7abf,_0x5b0b8b[_0x482d('0x42')]);return db['Dashboard']['find'](_0x5e7abf)['then'](handleEntityNotFound(_0x1bb403,null))[_0x482d('0x23')](function(_0xddf3c){if(_0xddf3c){var _0x428c35=_0xddf3c[_0x482d('0x25')]({'plain':!![]});_0x428c35=qs[_0x482d('0x54')](_0x428c35,['id',_0x482d('0x55'),_0x482d('0x56')]);_0x5b0b8b[_0x482d('0x4d')]=_['omit'](_0x5b0b8b[_0x482d('0x4d')],['id',_0x482d('0x55'),_0x482d('0x56')]);return db['Dashboard'][_0x482d('0x4b')](_[_0x482d('0x40')](_0x428c35,_0x5b0b8b[_0x482d('0x4d')]),{'include':_0x5b0b8b[_0x482d('0x34')][_0x482d('0x44')]?[{'all':!![]}]:undefined})[_0x482d('0x23')](function(_0x52cddc){var _0x348913=_0x5b0b8b[_0x482d('0x57')][_0x482d('0x25')]({'plain':!![]});if(!_0x348913)throw new Error(_0x482d('0x4e'));if(_0x348913[_0x482d('0x58')]==='user'){var _0x5df6a1=_0x52cddc[_0x482d('0x25')]({'plain':!![]});var _0x6b0010=_0x482d('0x26');return db[_0x482d('0x4f')][_0x482d('0x4a')]({'where':{'name':_0x6b0010,'userProfileId':_0x348913[_0x482d('0x59')]},'raw':!![]})[_0x482d('0x23')](function(_0x4d585a){if(_0x4d585a&&_0x4d585a[_0x482d('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5df6a1[_0x482d('0x2a')],'resourceId':_0x5df6a1['id'],'type':_0x4d585a[_0x482d('0x2a')],'sectionId':_0x4d585a['id']},{})[_0x482d('0x23')](function(){return _0x52cddc;});}else{return _0x52cddc;}})[_0x482d('0x47')](function(_0x4df10c){logger[_0x482d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4df10c);throw _0x4df10c;});}return _0x52cddc;});}})[_0x482d('0x23')](respondWithResult(_0x1bb403,0xc9))[_0x482d('0x47')](handleError(_0x1bb403,null));};exports['update']=function(_0xbe5bc8,_0x37097b){if(_0xbe5bc8[_0x482d('0x4d')]['id']){delete _0xbe5bc8[_0x482d('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xbe5bc8['params']['id']}})['then'](handleEntityNotFound(_0x37097b,null))[_0x482d('0x23')](saveUpdates(_0xbe5bc8['body'],null))[_0x482d('0x23')](respondWithResult(_0x37097b,null))[_0x482d('0x47')](handleError(_0x37097b,null));};exports[_0x482d('0x24')]=function(_0x20a9ff,_0x533735){return db['Dashboard']['find']({'where':{'id':_0x20a9ff['params']['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x533735,null))[_0x482d('0x23')](removeEntity(_0x533735,null))['catch'](handleError(_0x533735,null));};function widgetAttributes(_0x11ba0b){try{switch(_0x11ba0b[_0x482d('0x30')]){case _0x482d('0x5a'):return[{'name':_0x482d('0x5b'),'value':_0x11ba0b[_0x482d('0x5b')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b['attrs'][0x0]?_0x11ba0b['attrs'][0x0]['value']:undefined)||_0x482d('0x5d')}];case'custom':return[{'name':_0x482d('0x5e'),'value':_0x11ba0b[_0x482d('0x5e')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b['attrs'][0x0][_0x482d('0x5f')]:undefined)||''}];case _0x482d('0x60'):return[{'name':'attrHourFormat','value':_0x11ba0b[_0x482d('0x61')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b['attrs'][0x0][_0x482d('0x5f')]:undefined)||'HH:mm:ss'},{'name':_0x482d('0x62'),'value':_0x11ba0b[_0x482d('0x62')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x1]?_0x11ba0b['attrs'][0x1][_0x482d('0x5f')]:undefined)||'0.00'},{'name':_0x482d('0x63'),'value':_0x11ba0b['attrFontSize']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x2]?_0x11ba0b['attrs'][0x2]['value']:undefined)||0xc}];case _0x482d('0x64'):return[{'name':_0x482d('0x65'),'value':_0x11ba0b['attrMetric']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b['attrs'][0x0][_0x482d('0x5f')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x11ba0b[_0x482d('0x66')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x1]?_0x11ba0b[_0x482d('0x5c')][0x1][_0x482d('0x5f')]:undefined)||[]},{'name':'attrFontSize','value':_0x11ba0b[_0x482d('0x63')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x2]?_0x11ba0b[_0x482d('0x5c')][0x2][_0x482d('0x5f')]:undefined)||0x14},{'name':_0x482d('0x67'),'value':_0x11ba0b[_0x482d('0x67')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x3]?_0x11ba0b[_0x482d('0x5c')][0x3][_0x482d('0x5f')]:undefined)||_0x482d('0x68')},{'name':_0x482d('0x69'),'value':_0x11ba0b[_0x482d('0x69')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x4]?_0x11ba0b['attrs'][0x4][_0x482d('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x11ba0b[_0x482d('0x6a')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x5]?_0x11ba0b['attrs'][0x5][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6b'),'value':_0x11ba0b[_0x482d('0x6b')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x6]?_0x11ba0b[_0x482d('0x5c')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x11ba0b[_0x482d('0x6c')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x7]?_0x11ba0b[_0x482d('0x5c')][0x7][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6d'),'value':_0x11ba0b['attrWhatsappAccounts']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x8]?_0x11ba0b[_0x482d('0x5c')][0x8][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6e'),'value':_0x11ba0b['attrChatWebsites']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x9]?_0x11ba0b[_0x482d('0x5c')][0x9][_0x482d('0x5f')]:undefined)||''}];case _0x482d('0x6f'):case _0x482d('0x70'):return[{'name':_0x482d('0x71'),'value':_0x11ba0b[_0x482d('0x71')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b[_0x482d('0x5c')][0x0][_0x482d('0x5f')]:undefined)||'total'},{'name':_0x482d('0x72'),'value':_0x11ba0b[_0x482d('0x72')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b['attrs'][0x1]?_0x11ba0b[_0x482d('0x5c')][0x1]['value']:undefined)||null},{'name':_0x482d('0x73'),'value':_0x11ba0b[_0x482d('0x73')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x2]?_0x11ba0b[_0x482d('0x5c')][0x2][_0x482d('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x11ba0b[_0x482d('0x66')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x3]?_0x11ba0b[_0x482d('0x5c')][0x3][_0x482d('0x5f')]:undefined)||[]},{'name':_0x482d('0x67'),'value':_0x11ba0b[_0x482d('0x67')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x4]?_0x11ba0b[_0x482d('0x5c')][0x4]['value']:undefined)||_0x482d('0x68')},{'name':'attrEmailAccounts','value':_0x11ba0b[_0x482d('0x69')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x5]?_0x11ba0b[_0x482d('0x5c')][0x5][_0x482d('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x11ba0b['attrFaxAccounts']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x6]?_0x11ba0b['attrs'][0x6][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6b'),'value':_0x11ba0b[_0x482d('0x6b')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x7]?_0x11ba0b[_0x482d('0x5c')][0x7][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6c'),'value':_0x11ba0b[_0x482d('0x6c')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x8]?_0x11ba0b['attrs'][0x8][_0x482d('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x11ba0b[_0x482d('0x6d')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x9]?_0x11ba0b[_0x482d('0x5c')][0x9][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6e'),'value':_0x11ba0b[_0x482d('0x6e')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0xa]?_0x11ba0b['attrs'][0xa][_0x482d('0x5f')]:undefined)||''}];case _0x482d('0x74'):return[{'name':_0x482d('0x75'),'type':_0x11ba0b['reportType']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b[_0x482d('0x5c')][0x0][_0x482d('0x30')]:undefined)||null,'value':_0x11ba0b[_0x482d('0x75')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b['attrs'][0x0]?_0x11ba0b[_0x482d('0x5c')][0x0][_0x482d('0x5f')]:undefined)||null},{'name':_0x482d('0x76'),'value':_0x11ba0b[_0x482d('0x76')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x1]?_0x11ba0b[_0x482d('0x5c')][0x1][_0x482d('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x4394f8){logger[_0x482d('0x28')](_0x482d('0x77'),JSON[_0x482d('0x78')](_0x4394f8));return[];}}exports[_0x482d('0x79')]=function(_0x53bec5,_0x3ecdd8,_0x29de67){if(_0x53bec5[_0x482d('0x4d')]['id']){delete _0x53bec5['body']['id'];}return db[_0x482d('0x4c')][_0x482d('0x4a')]({'where':{'id':_0x53bec5['params']['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x3ecdd8,null))[_0x482d('0x23')](function(_0x15e6c5){if(_0x15e6c5){_0x53bec5[_0x482d('0x4d')][_0x482d('0x7a')]=_0x15e6c5['id'];_0x53bec5[_0x482d('0x4d')]['attrs']=widgetAttributes(_0x53bec5[_0x482d('0x4d')]);return db[_0x482d('0x7b')][_0x482d('0x4b')](_0x53bec5[_0x482d('0x4d')]);}})[_0x482d('0x23')](respondWithResult(_0x3ecdd8,null))[_0x482d('0x47')](handleError(_0x3ecdd8,null));};exports['getItems']=function(_0x10c0c3,_0x3cf428,_0xe165ab){var _0x456159={};var _0x703d57={};var _0x44da20;var _0x47518b;return db[_0x482d('0x4c')][_0x482d('0x7c')]({'where':{'id':_0x10c0c3['params']['id']}})['then'](handleEntityNotFound(_0x3cf428,null))[_0x482d('0x23')](function(_0x234240){if(_0x234240){_0x44da20=_0x234240;_0x703d57[_0x482d('0x32')]=_['keys'](db[_0x482d('0x7b')][_0x482d('0x2e')]);_0x703d57[_0x482d('0x34')]=_[_0x482d('0x33')](_0x10c0c3[_0x482d('0x34')]);_0x703d57[_0x482d('0x35')]=_['intersection'](_0x703d57[_0x482d('0x32')],_0x703d57[_0x482d('0x34')]);_0x456159[_0x482d('0x37')]=_[_0x482d('0x49')](_0x703d57['model'],qs[_0x482d('0x36')](_0x10c0c3[_0x482d('0x34')][_0x482d('0x36')]));_0x456159[_0x482d('0x37')]=_0x456159[_0x482d('0x37')][_0x482d('0x38')]?_0x456159[_0x482d('0x37')]:_0x703d57[_0x482d('0x32')];_0x456159['order']=qs[_0x482d('0x3c')](_0x10c0c3['query'][_0x482d('0x3c')]);_0x456159['where']=qs[_0x482d('0x35')](_[_0x482d('0x3e')](_0x10c0c3[_0x482d('0x34')],_0x703d57[_0x482d('0x35')]));if(_0x10c0c3[_0x482d('0x34')][_0x482d('0x3f')]){_0x456159[_0x482d('0x3d')]=_[_0x482d('0x40')](_0x456159[_0x482d('0x3d')],{'$or':_['map'](_0x456159['attributes'],function(_0x277b50){var _0x5c0afb={};_0x5c0afb[_0x277b50]={'$like':'%'+_0x10c0c3[_0x482d('0x34')]['filter']+'%'};return _0x5c0afb;})});}_0x456159=_[_0x482d('0x40')]({},_0x456159,_0x10c0c3[_0x482d('0x42')]);return _0x44da20[_0x482d('0x7d')](_0x456159);}})[_0x482d('0x23')](function(_0x3907a4){if(_0x3907a4){_0x47518b=_0x3907a4['length'];if(!_0x10c0c3['query'][_0x482d('0x39')]('nolimit')){_0x456159[_0x482d('0x1d')]=qs['limit'](_0x10c0c3[_0x482d('0x34')][_0x482d('0x1d')]);_0x456159[_0x482d('0x1b')]=qs['offset'](_0x10c0c3['query'][_0x482d('0x1b')]);}return _0x44da20['getItems'](_0x456159);}})[_0x482d('0x23')](function(_0x85c3e2){if(_0x85c3e2){return _0x85c3e2?{'count':_0x47518b,'rows':_0x85c3e2}:null;}})[_0x482d('0x23')](respondWithResult(_0x3cf428,null))[_0x482d('0x47')](handleError(_0x3cf428,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 55e3a22..ac7f29a 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 _0xfef9=['remove','emit','hook','exports','events','Dashboard','setMaxListeners','update'];(function(_0x4c73b7,_0x2b2586){var _0x26d9b0=function(_0x2bfcf4){while(--_0x2bfcf4){_0x4c73b7['push'](_0x4c73b7['shift']());}};_0x26d9b0(++_0x2b2586);}(_0xfef9,0xcc));var _0x9fef=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0xfef9[_0x6173fc];return _0x965fbe;};'use strict';var EventEmitter=require(_0x9fef('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x9fef('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9fef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9fef('0x3'),'afterDestroy':_0x9fef('0x4')};function emitEvent(_0x9a3337){return function(_0x2da779,_0x9dee3f,_0x121cf8){DashboardEvents[_0x9fef('0x5')](_0x9a3337+':'+_0x2da779['id'],_0x2da779);DashboardEvents[_0x9fef('0x5')](_0x9a3337,_0x2da779);_0x121cf8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x9fef('0x6')](e,emitEvent(event));}}module[_0x9fef('0x7')]=DashboardEvents; \ No newline at end of file +var _0x7fab=['hook','exports','events','../../mysqldb','Dashboard','save','update','remove','emit','hasOwnProperty'];(function(_0x54dfff,_0x13369b){var _0x4cf1dd=function(_0xa808f0){while(--_0xa808f0){_0x54dfff['push'](_0x54dfff['shift']());}};_0x4cf1dd(++_0x13369b);}(_0x7fab,0x1b0));var _0xb7fa=function(_0x15294d,_0x4f6a0d){_0x15294d=_0x15294d-0x0;var _0x4f6dab=_0x7fab[_0x15294d];return _0x4f6dab;};'use strict';var EventEmitter=require(_0xb7fa('0x0'));var Dashboard=require(_0xb7fa('0x1'))['db'][_0xb7fa('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7fa('0x3'),'afterUpdate':_0xb7fa('0x4'),'afterDestroy':_0xb7fa('0x5')};function emitEvent(_0x136178){return function(_0x332985,_0x2e3983,_0x57aee5){DashboardEvents[_0xb7fa('0x6')](_0x136178+':'+_0x332985['id'],_0x332985);DashboardEvents[_0xb7fa('0x6')](_0x136178,_0x332985);_0x57aee5(null);};}for(var e in events){if(events[_0xb7fa('0x7')](e)){var event=events[e];Dashboard[_0xb7fa('0x8')](e,emitEvent(event));}}module[_0xb7fa('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 71a25dd..865665a 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 _0xf3ec=['./dashboard.attributes','define','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1a9ed0,_0x1085fc){var _0x47bbd6=function(_0x27bd1c){while(--_0x27bd1c){_0x1a9ed0['push'](_0x1a9ed0['shift']());}};_0x47bbd6(++_0x1085fc);}(_0xf3ec,0xbe));var _0xcf3e=function(_0x5c7bd9,_0x36f52a){_0x5c7bd9=_0x5c7bd9-0x0;var _0x523b46=_0xf3ec[_0x5c7bd9];return _0x523b46;};'use strict';var _=require(_0xcf3e('0x0'));var util=require(_0xcf3e('0x1'));var logger=require(_0xcf3e('0x2'))(_0xcf3e('0x3'));var moment=require(_0xcf3e('0x4'));var BPromise=require(_0xcf3e('0x5'));var rp=require(_0xcf3e('0x6'));var fs=require('fs');var path=require(_0xcf3e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf3e('0x8'));module['exports']=function(_0x5b38a5,_0x32c5aa){return _0x5b38a5[_0xcf3e('0x9')]('Dashboard',attributes,{'tableName':_0xcf3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d38=['define','Dashboard','dashboards','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x1cd229,_0x332e93){var _0x1c0133=function(_0x3c1167){while(--_0x3c1167){_0x1cd229['push'](_0x1cd229['shift']());}};_0x1c0133(++_0x332e93);}(_0x1d38,0x116));var _0x81d3=function(_0x1f2a85,_0x5a4f3b){_0x1f2a85=_0x1f2a85-0x0;var _0x5c8fda=_0x1d38[_0x1f2a85];return _0x5c8fda;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x81d3('0x0'))(_0x81d3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x81d3('0x2'));var fs=require('fs');var path=require(_0x81d3('0x3'));var rimraf=require(_0x81d3('0x4'));var config=require(_0x81d3('0x5'));var attributes=require(_0x81d3('0x6'));module[_0x81d3('0x7')]=function(_0x4e6405,_0x5e244d){return _0x4e6405[_0x81d3('0x8')](_0x81d3('0x9'),attributes,{'tableName':_0x81d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 7e20ae2..7756d59 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 _0x4578=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','socket.io-emitter','./dashboard.socket','register','then','request\x20sent'];(function(_0x43156f,_0x22657f){var _0x5249a7=function(_0x50e870){while(--_0x50e870){_0x43156f['push'](_0x43156f['shift']());}};_0x5249a7(++_0x22657f);}(_0x4578,0xd2));var _0x8457=function(_0x5b6417,_0x29f4e4){_0x5b6417=_0x5b6417-0x0;var _0x527f95=_0x4578[_0x5b6417];return _0x527f95;};'use strict';var _=require('lodash');var util=require(_0x8457('0x0'));var moment=require(_0x8457('0x1'));var BPromise=require('bluebird');var rs=require(_0x8457('0x2'));var fs=require('fs');var Redis=require(_0x8457('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8457('0x4'));var logger=require(_0x8457('0x5'))(_0x8457('0x6'));var config=require('../../config/environment');var jayson=require(_0x8457('0x7'));var client=jayson[_0x8457('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x8457('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8457('0xa'))(new Redis(config[_0x8457('0x9')]));require(_0x8457('0xb'))[_0x8457('0xc')](socket);function respondWithRpcPromise(_0x3205d1,_0xb0189a,_0x5d9427){return new BPromise(function(_0x11d6fb,_0x536101){return client['request'](_0x3205d1,_0x5d9427)[_0x8457('0xd')](function(_0x3ad63d){logger['info']('Dashboard,\x20%s,\x20%s',_0xb0189a,_0x8457('0xe'));logger[_0x8457('0xf')](_0x8457('0x10'),_0xb0189a,_0x8457('0xe'),JSON[_0x8457('0x11')](_0x3ad63d));if(_0x3ad63d[_0x8457('0x12')]){if(_0x3ad63d['error'][_0x8457('0x13')]===0x1f4){logger[_0x8457('0x12')](_0x8457('0x14'),_0xb0189a,_0x3ad63d['error'][_0x8457('0x15')]);return _0x536101(_0x3ad63d[_0x8457('0x12')][_0x8457('0x15')]);}logger[_0x8457('0x12')]('Dashboard,\x20%s,\x20%s',_0xb0189a,_0x3ad63d[_0x8457('0x12')]['message']);return _0x11d6fb(_0x3ad63d['error'][_0x8457('0x15')]);}else{logger[_0x8457('0x16')](_0x8457('0x14'),_0xb0189a,_0x8457('0xe'));_0x11d6fb(_0x3ad63d[_0x8457('0x17')][_0x8457('0x15')]);}})[_0x8457('0x18')](function(_0x132056){logger[_0x8457('0x12')](_0x8457('0x14'),_0xb0189a,_0x132056);_0x536101(_0x132056);});});} \ No newline at end of file +var _0xfd8a=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./dashboard.socket','register','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch'];(function(_0x44a274,_0x17b558){var _0x582fdc=function(_0x2f006a){while(--_0x2f006a){_0x44a274['push'](_0x44a274['shift']());}};_0x582fdc(++_0x17b558);}(_0xfd8a,0x16c));var _0xafd8=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xfd8a[_0x3c22e0];return _0x215811;};'use strict';var _=require(_0xafd8('0x0'));var util=require(_0xafd8('0x1'));var moment=require(_0xafd8('0x2'));var BPromise=require('bluebird');var rs=require(_0xafd8('0x3'));var fs=require('fs');var Redis=require(_0xafd8('0x4'));var db=require(_0xafd8('0x5'))['db'];var utils=require(_0xafd8('0x6'));var logger=require(_0xafd8('0x7'))(_0xafd8('0x8'));var config=require('../../config/environment');var jayson=require(_0xafd8('0x9'));var client=jayson['client'][_0xafd8('0xa')]({'port':0x232a});config[_0xafd8('0xb')]=_[_0xafd8('0xc')](config[_0xafd8('0xb')],{'host':_0xafd8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xafd8('0xe'))[_0xafd8('0xf')](socket);function respondWithRpcPromise(_0xcbe146,_0x1a4ed1,_0x54944d){return new BPromise(function(_0x3260ee,_0x473b04){return client['request'](_0xcbe146,_0x54944d)[_0xafd8('0x10')](function(_0x1e82ff){logger[_0xafd8('0x11')]('Dashboard,\x20%s,\x20%s',_0x1a4ed1,_0xafd8('0x12'));logger[_0xafd8('0x13')](_0xafd8('0x14'),_0x1a4ed1,_0xafd8('0x12'),JSON[_0xafd8('0x15')](_0x1e82ff));if(_0x1e82ff[_0xafd8('0x16')]){if(_0x1e82ff[_0xafd8('0x16')][_0xafd8('0x17')]===0x1f4){logger[_0xafd8('0x16')](_0xafd8('0x18'),_0x1a4ed1,_0x1e82ff[_0xafd8('0x16')]['message']);return _0x473b04(_0x1e82ff['error'][_0xafd8('0x19')]);}logger['error'](_0xafd8('0x18'),_0x1a4ed1,_0x1e82ff[_0xafd8('0x16')]['message']);return _0x3260ee(_0x1e82ff[_0xafd8('0x16')][_0xafd8('0x19')]);}else{logger[_0xafd8('0x11')](_0xafd8('0x18'),_0x1a4ed1,_0xafd8('0x12'));_0x3260ee(_0x1e82ff[_0xafd8('0x1a')][_0xafd8('0x19')]);}})[_0xafd8('0x1b')](function(_0x3f0484){logger[_0xafd8('0x16')](_0xafd8('0x18'),_0x1a4ed1,_0x3f0484);_0x473b04(_0x3f0484);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ab596e9..91b7835 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 _0x874b=['./dashboard.events','save','remove','update','emit','dashboard:'];(function(_0xf5fbd5,_0xd39527){var _0x47e6cf=function(_0x2eb557){while(--_0x2eb557){_0xf5fbd5['push'](_0xf5fbd5['shift']());}};_0x47e6cf(++_0xd39527);}(_0x874b,0xf6));var _0xb874=function(_0x10a774,_0x4d1ba2){_0x10a774=_0x10a774-0x0;var _0xd05e5b=_0x874b[_0x10a774];return _0xd05e5b;};'use strict';var DashboardEvents=require(_0xb874('0x0'));var events=[_0xb874('0x1'),_0xb874('0x2'),_0xb874('0x3')];function createListener(_0x506f66,_0x4b43c3){return function(_0x4d6af0){_0x4b43c3[_0xb874('0x4')](_0x506f66,_0x4d6af0);};}function removeListener(_0x197901,_0xe51e76){return function(){DashboardEvents['removeListener'](_0x197901,_0xe51e76);};}exports['register']=function(_0x1964fa){for(var _0x4dd6ec=0x0,_0x280ec2=events['length'];_0x4dd6ec<_0x280ec2;_0x4dd6ec++){var _0x26314d=events[_0x4dd6ec];var _0x530cdd=createListener(_0xb874('0x5')+_0x26314d,_0x1964fa);DashboardEvents['on'](_0x26314d,_0x530cdd);}}; \ No newline at end of file +var _0x7a29=['emit','removeListener','length','save','remove','update'];(function(_0xef9d34,_0x487683){var _0x4e71a0=function(_0x4edd58){while(--_0x4edd58){_0xef9d34['push'](_0xef9d34['shift']());}};_0x4e71a0(++_0x487683);}(_0x7a29,0x14d));var _0x97a2=function(_0x3151d0,_0x48b726){_0x3151d0=_0x3151d0-0x0;var _0x30cb1d=_0x7a29[_0x3151d0];return _0x30cb1d;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x97a2('0x0'),_0x97a2('0x1'),_0x97a2('0x2')];function createListener(_0x32753,_0xa75827){return function(_0x1a1c1b){_0xa75827[_0x97a2('0x3')](_0x32753,_0x1a1c1b);};}function removeListener(_0x1638ca,_0x36e1a7){return function(){DashboardEvents[_0x97a2('0x4')](_0x1638ca,_0x36e1a7);};}exports['register']=function(_0x432547){for(var _0x4cf4e0=0x0,_0x471f26=events[_0x97a2('0x5')];_0x4cf4e0<_0x471f26;_0x4cf4e0++){var _0x461cd0=events[_0x4cf4e0];var _0x29b7aa=createListener('dashboard:'+_0x461cd0,_0x432547);DashboardEvents['on'](_0x461cd0,_0x29b7aa);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3ae69e9..4b186f1 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 _0x52d1=['../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','index','/:id','show','get','getItems','create','post','/:id/items','addItem','put','update','util','Router','fs-extra'];(function(_0x4eec0f,_0xec3aee){var _0xb6cd47=function(_0x43dcee){while(--_0x43dcee){_0x4eec0f['push'](_0x4eec0f['shift']());}};_0xb6cd47(++_0xec3aee);}(_0x52d1,0x10b));var _0x152d=function(_0x486b55,_0x41c91b){_0x486b55=_0x486b55-0x0;var _0x378a03=_0x52d1[_0x486b55];return _0x378a03;};'use strict';var multer=require('multer');var util=require(_0x152d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x152d('0x1')]();var fs_extra=require(_0x152d('0x2'));var auth=require(_0x152d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x152d('0x4'));var controller=require(_0x152d('0x5'));router['get']('/',auth[_0x152d('0x6')](),controller[_0x152d('0x7')]);router['get'](_0x152d('0x8'),auth['isAuthenticated'](),controller[_0x152d('0x9')]);router[_0x152d('0xa')]('/:id/items',auth[_0x152d('0x6')](),controller[_0x152d('0xb')]);router['post']('/',auth[_0x152d('0x6')](),controller[_0x152d('0xc')]);router[_0x152d('0xd')]('/:id/clone',auth[_0x152d('0x6')](),controller['clone']);router[_0x152d('0xd')](_0x152d('0xe'),auth['isAuthenticated'](),controller[_0x152d('0xf')]);router[_0x152d('0x10')](_0x152d('0x8'),auth[_0x152d('0x6')](),controller[_0x152d('0x11')]);router['delete'](_0x152d('0x8'),auth[_0x152d('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ebb=['post','create','/:id/clone','clone','addItem','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','/:id/items','getItems'];(function(_0x3bf356,_0x5bc71f){var _0xe9ddd1=function(_0x25184f){while(--_0x25184f){_0x3bf356['push'](_0x3bf356['shift']());}};_0xe9ddd1(++_0x5bc71f);}(_0x8ebb,0x76));var _0xb8eb=function(_0x2306a0,_0x19045e){_0x2306a0=_0x2306a0-0x0;var _0x425eb8=_0x8ebb[_0x2306a0];return _0x425eb8;};'use strict';var multer=require(_0xb8eb('0x0'));var util=require('util');var path=require(_0xb8eb('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8eb('0x2'));var router=express[_0xb8eb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb8eb('0x4'));var interaction=require(_0xb8eb('0x5'));var config=require(_0xb8eb('0x6'));var controller=require(_0xb8eb('0x7'));router[_0xb8eb('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8eb('0x9')]);router[_0xb8eb('0x8')](_0xb8eb('0xa'),auth[_0xb8eb('0xb')](),controller['show']);router[_0xb8eb('0x8')](_0xb8eb('0xc'),auth[_0xb8eb('0xb')](),controller[_0xb8eb('0xd')]);router[_0xb8eb('0xe')]('/',auth[_0xb8eb('0xb')](),controller[_0xb8eb('0xf')]);router[_0xb8eb('0xe')](_0xb8eb('0x10'),auth[_0xb8eb('0xb')](),controller[_0xb8eb('0x11')]);router[_0xb8eb('0xe')](_0xb8eb('0xc'),auth[_0xb8eb('0xb')](),controller[_0xb8eb('0x12')]);router['put']('/:id',auth[_0xb8eb('0xb')](),controller['update']);router[_0xb8eb('0x13')](_0xb8eb('0xa'),auth[_0xb8eb('0xb')](),controller[_0xb8eb('0x14')]);module[_0xb8eb('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3e81d92..9a47413 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 _0xd8fb=['exports','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','STRING','sequelize','squel','lodash'];(function(_0x59f6be,_0x472a09){var _0x2aef59=function(_0x4d72d9){while(--_0x4d72d9){_0x59f6be['push'](_0x59f6be['shift']());}};_0x2aef59(++_0x472a09);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4b659e,_0x12e462){_0x4b659e=_0x4b659e-0x0;var _0x23f5cc=_0xd8fb[_0x4b659e];return _0x23f5cc;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var squel=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));module[_0xbd8f('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xbd8f('0x4')),'get':function(){try{return JSON[_0xbd8f('0x5')](this['getDataValue'](_0xbd8f('0x6')));}catch(_0x2343bf){return[];}},'set':function(_0x5543b2){try{this[_0xbd8f('0x7')]('attrs',JSON[_0xbd8f('0x8')](_0x5543b2));}catch(_0x578499){this[_0xbd8f('0x7')](_0xbd8f('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbd8f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbd8f('0x9')]},'col':{'type':Sequelize[_0xbd8f('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd8f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbd8f('0xb')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xbd8f('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xeff8=['sequelize','squel','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x23592b,_0x70ad58){var _0x41d8ae=function(_0x3f8e97){while(--_0x3f8e97){_0x23592b['push'](_0x23592b['shift']());}};_0x41d8ae(++_0x70ad58);}(_0xeff8,0x186));var _0x8eff=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xeff8[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x8eff('0x0'));var squel=require(_0x8eff('0x1'));var _=require('lodash');module[_0x8eff('0x2')]={'title':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eff('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x8eff('0x4')),'get':function(){try{return JSON[_0x8eff('0x5')](this[_0x8eff('0x6')](_0x8eff('0x7')));}catch(_0x4ac51c){return[];}},'set':function(_0x469641){try{this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')](_0x469641));}catch(_0x491f01){this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x8eff('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x8eff('0xa')]},'background':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![],'defaultValue':_0x8eff('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8eff('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eff('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 200a54f..4c23f2a 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 _0x7ed1=['attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrReport','reportType','type','widgetAttributes:\x20%s','stringify','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','sendStatus','error','stack','name','send','params','model','keys','DashboardItem','query','filters','intersection','attributes','fields','includeAll','include','options','catch','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0x10abfe,_0x7a9ad6){var _0x473c1b=function(_0x392758){while(--_0x392758){_0x10abfe['push'](_0x10abfe['shift']());}};_0x473c1b(++_0x7a9ad6);}(_0x7ed1,0xca));var _0x17ed=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x7ed1[_0x35da42];return _0x370035;};'use strict';var emlformat=require(_0x17ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17ed('0x1'));var jsonpatch=require(_0x17ed('0x2'));var rp=require(_0x17ed('0x3'));var moment=require(_0x17ed('0x4'));var BPromise=require(_0x17ed('0x5'));var Mustache=require(_0x17ed('0x6'));var util=require('util');var path=require(_0x17ed('0x7'));var sox=require(_0x17ed('0x8'));var csv=require(_0x17ed('0x9'));var ejs=require(_0x17ed('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x17ed('0xb'));var crypto=require(_0x17ed('0xc'));var jsforce=require(_0x17ed('0xd'));var deskjs=require(_0x17ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0x17ed('0xf'));var Papa=require(_0x17ed('0x10'));var Redis=require(_0x17ed('0x11'));var authService=require(_0x17ed('0x12'));var qs=require(_0x17ed('0x13'));var as=require(_0x17ed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17ed('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x17ed('0x16'));var licenseUtil=require(_0x17ed('0x17'));var db=require(_0x17ed('0x18'))['db'];config[_0x17ed('0x19')]=_[_0x17ed('0x1a')](config['redis'],{'host':_0x17ed('0x1b'),'port':0x18eb});var socket=require(_0x17ed('0x1c'))(new Redis(config[_0x17ed('0x19')]));require('./dashboardItem.socket')[_0x17ed('0x1d')](socket);function respondWithStatusCode(_0x53ec2a,_0x513e5c){_0x513e5c=_0x513e5c||0xcc;return function(_0x30a0c6){if(_0x30a0c6){return _0x53ec2a['sendStatus'](_0x513e5c);}return _0x53ec2a[_0x17ed('0x1e')](_0x513e5c)[_0x17ed('0x1f')]();};}function respondWithResult(_0xd10a00,_0x6ccf15){_0x6ccf15=_0x6ccf15||0xc8;return function(_0x5458ff){if(_0x5458ff){return _0xd10a00[_0x17ed('0x1e')](_0x6ccf15)[_0x17ed('0x20')](_0x5458ff);}};}function respondWithFilteredResult(_0x20b6d2,_0x5ade66){return function(_0x52518e){if(_0x52518e){var _0x81e1a6=typeof _0x5ade66[_0x17ed('0x21')]===_0x17ed('0x22')&&typeof _0x5ade66[_0x17ed('0x23')]===_0x17ed('0x22');var _0x49340f=_0x52518e[_0x17ed('0x24')];var _0x3dc4cb=_0x81e1a6?0x0:_0x5ade66['offset'];var _0x2cac50=_0x81e1a6?_0x52518e[_0x17ed('0x24')]:_0x5ade66['offset']+_0x5ade66[_0x17ed('0x23')];var _0x22f57d;if(_0x2cac50>=_0x49340f){_0x2cac50=_0x49340f;_0x22f57d=0xc8;}else{_0x22f57d=0xce;}_0x20b6d2[_0x17ed('0x1e')](_0x22f57d);return _0x20b6d2[_0x17ed('0x25')](_0x17ed('0x26'),_0x3dc4cb+'-'+_0x2cac50+'/'+_0x49340f)[_0x17ed('0x20')](_0x52518e);}return null;};}function patchUpdates(_0x43243e){return function(_0x50f6a3){try{jsonpatch[_0x17ed('0x27')](_0x50f6a3,_0x43243e,!![]);}catch(_0x3574f3){return BPromise['reject'](_0x3574f3);}return _0x50f6a3['save']();};}function saveUpdates(_0x464799,_0x5d095b){return function(_0x5e03b3){if(_0x5e03b3){return _0x5e03b3['update'](_0x464799)[_0x17ed('0x28')](function(_0x56722d){return _0x56722d;});}return null;};}function removeEntity(_0x2bbff3,_0x225721){return function(_0xf9c88c){if(_0xf9c88c){return _0xf9c88c['destroy']()[_0x17ed('0x28')](function(){_0x2bbff3[_0x17ed('0x1e')](0xcc)[_0x17ed('0x1f')]();});}};}function handleEntityNotFound(_0x4d1de9,_0x57470d){return function(_0x170d4f){if(!_0x170d4f){_0x4d1de9[_0x17ed('0x29')](0x194);}return _0x170d4f;};}function handleError(_0x376f03,_0x5a02ab){_0x5a02ab=_0x5a02ab||0x1f4;return function(_0x38bb50){logger[_0x17ed('0x2a')](_0x38bb50[_0x17ed('0x2b')]);if(_0x38bb50[_0x17ed('0x2c')]){delete _0x38bb50['name'];}_0x376f03[_0x17ed('0x1e')](_0x5a02ab)[_0x17ed('0x2d')](_0x38bb50);};}exports['show']=function(_0x35c300,_0xd0289){var _0xf325ed={'raw':![],'where':{'id':_0x35c300[_0x17ed('0x2e')]['id']}},_0x529966={};_0x529966[_0x17ed('0x2f')]=_[_0x17ed('0x30')](db[_0x17ed('0x31')]['rawAttributes']);_0x529966[_0x17ed('0x32')]=_['keys'](_0x35c300[_0x17ed('0x32')]);_0x529966[_0x17ed('0x33')]=_[_0x17ed('0x34')](_0x529966[_0x17ed('0x2f')],_0x529966['query']);_0xf325ed[_0x17ed('0x35')]=_[_0x17ed('0x34')](_0x529966[_0x17ed('0x2f')],qs[_0x17ed('0x36')](_0x35c300[_0x17ed('0x32')][_0x17ed('0x36')]));_0xf325ed[_0x17ed('0x35')]=_0xf325ed[_0x17ed('0x35')]['length']?_0xf325ed[_0x17ed('0x35')]:_0x529966[_0x17ed('0x2f')];if(_0x35c300[_0x17ed('0x32')][_0x17ed('0x37')]){_0xf325ed[_0x17ed('0x38')]=[{'all':!![]}];}_0xf325ed=_['merge']({},_0xf325ed,_0x35c300[_0x17ed('0x39')]);return db[_0x17ed('0x31')]['find'](_0xf325ed)['then'](handleEntityNotFound(_0xd0289,null))['then'](respondWithResult(_0xd0289,null))[_0x17ed('0x3a')](handleError(_0xd0289,null));};exports['destroy']=function(_0x14de84,_0x1c76c4){return db[_0x17ed('0x31')]['find']({'where':{'id':_0x14de84[_0x17ed('0x2e')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x1c76c4,null))[_0x17ed('0x28')](removeEntity(_0x1c76c4,null))[_0x17ed('0x3a')](handleError(_0x1c76c4,null));};function widgetAttributes(_0x7f62fa){try{switch(_0x7f62fa['type']){case _0x17ed('0x3b'):return[{'name':_0x17ed('0x3c'),'value':_0x7f62fa[_0x17ed('0x3c')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0]['value']:undefined)||'https://'}];case _0x17ed('0x3e'):return[{'name':_0x17ed('0x3f'),'value':_0x7f62fa['attrPath']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa['attrs'][0x0][_0x17ed('0x40')]:undefined)||''}];case _0x17ed('0x41'):return[{'name':_0x17ed('0x42'),'value':_0x7f62fa[_0x17ed('0x42')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0][_0x17ed('0x40')]:undefined)||'HH:mm:ss'},{'name':_0x17ed('0x43'),'value':_0x7f62fa[_0x17ed('0x43')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x1]?_0x7f62fa[_0x17ed('0x3d')][0x1][_0x17ed('0x40')]:undefined)||_0x17ed('0x44')},{'name':_0x17ed('0x45'),'value':_0x7f62fa[_0x17ed('0x45')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x2]?_0x7f62fa[_0x17ed('0x3d')][0x2][_0x17ed('0x40')]:undefined)||0xc}];case _0x17ed('0x46'):return[{'name':_0x17ed('0x47'),'value':_0x7f62fa[_0x17ed('0x47')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0]['value']:undefined)||_0x17ed('0x48')},{'name':_0x17ed('0x49'),'value':_0x7f62fa[_0x17ed('0x49')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x1]?_0x7f62fa['attrs'][0x1][_0x17ed('0x40')]:undefined)||[]},{'name':_0x17ed('0x45'),'value':_0x7f62fa[_0x17ed('0x45')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x2]?_0x7f62fa[_0x17ed('0x3d')][0x2][_0x17ed('0x40')]:undefined)||0x14},{'name':_0x17ed('0x4a'),'value':_0x7f62fa[_0x17ed('0x4a')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x3]?_0x7f62fa['attrs'][0x3]['value']:undefined)||_0x17ed('0x4b')},{'name':_0x17ed('0x4c'),'value':_0x7f62fa[_0x17ed('0x4c')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x4]?_0x7f62fa[_0x17ed('0x3d')][0x4][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x4d'),'value':_0x7f62fa[_0x17ed('0x4d')]||(_0x7f62fa['attrs']&&_0x7f62fa[_0x17ed('0x3d')][0x5]?_0x7f62fa[_0x17ed('0x3d')][0x5][_0x17ed('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x7f62fa['attrSmsAccounts']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x6]?_0x7f62fa['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x7f62fa[_0x17ed('0x4e')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x7]?_0x7f62fa[_0x17ed('0x3d')][0x7][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x4f'),'value':_0x7f62fa[_0x17ed('0x4f')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x8]?_0x7f62fa[_0x17ed('0x3d')][0x8][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x50'),'value':_0x7f62fa['attrChatWebsites']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x9]?_0x7f62fa['attrs'][0x9][_0x17ed('0x40')]:undefined)||''}];case _0x17ed('0x51'):case _0x17ed('0x52'):return[{'name':_0x17ed('0x53'),'value':_0x7f62fa[_0x17ed('0x53')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa['attrs'][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0]['value']:undefined)||_0x17ed('0x48')},{'name':'attrSerie2','value':_0x7f62fa[_0x17ed('0x54')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x1]?_0x7f62fa['attrs'][0x1]['value']:undefined)||null},{'name':_0x17ed('0x55'),'value':_0x7f62fa[_0x17ed('0x55')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x2]?_0x7f62fa[_0x17ed('0x3d')][0x2][_0x17ed('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x7f62fa['attrVoiceQueues']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x3]?_0x7f62fa[_0x17ed('0x3d')][0x3][_0x17ed('0x40')]:undefined)||[]},{'name':'attrChannel','value':_0x7f62fa['attrChannel']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x4]?_0x7f62fa[_0x17ed('0x3d')][0x4][_0x17ed('0x40')]:undefined)||_0x17ed('0x4b')},{'name':_0x17ed('0x4c'),'value':_0x7f62fa['attrEmailAccounts']||(_0x7f62fa['attrs']&&_0x7f62fa[_0x17ed('0x3d')][0x5]?_0x7f62fa['attrs'][0x5][_0x17ed('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x7f62fa[_0x17ed('0x4d')]||(_0x7f62fa['attrs']&&_0x7f62fa[_0x17ed('0x3d')][0x6]?_0x7f62fa[_0x17ed('0x3d')][0x6][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x56'),'value':_0x7f62fa['attrSmsAccounts']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x7]?_0x7f62fa[_0x17ed('0x3d')][0x7]['value']:undefined)||''},{'name':_0x17ed('0x4e'),'value':_0x7f62fa[_0x17ed('0x4e')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x8]?_0x7f62fa['attrs'][0x8][_0x17ed('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x7f62fa[_0x17ed('0x4f')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa['attrs'][0x9]?_0x7f62fa['attrs'][0x9][_0x17ed('0x40')]:undefined)||''},{'name':_0x17ed('0x50'),'value':_0x7f62fa[_0x17ed('0x50')]||(_0x7f62fa['attrs']&&_0x7f62fa[_0x17ed('0x3d')][0xa]?_0x7f62fa[_0x17ed('0x3d')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x17ed('0x57'),'type':_0x7f62fa[_0x17ed('0x58')]||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa[_0x17ed('0x3d')][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0][_0x17ed('0x59')]:undefined)||null,'value':_0x7f62fa[_0x17ed('0x57')]||(_0x7f62fa['attrs']&&_0x7f62fa['attrs'][0x0]?_0x7f62fa[_0x17ed('0x3d')][0x0][_0x17ed('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x7f62fa['attrRefresh']||(_0x7f62fa[_0x17ed('0x3d')]&&_0x7f62fa['attrs'][0x1]?_0x7f62fa['attrs'][0x1][_0x17ed('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x5368d5){logger['error'](_0x17ed('0x5a'),JSON[_0x17ed('0x5b')](_0x5368d5));return[];}}exports['create']=function(_0x3eb158,_0x31e86e){if(_0x3eb158[_0x17ed('0x5c')]){_0x3eb158[_0x17ed('0x5c')][_0x17ed('0x3d')]=widgetAttributes(_0x3eb158[_0x17ed('0x5c')]);}return db[_0x17ed('0x31')]['create'](_0x3eb158[_0x17ed('0x5c')],{})[_0x17ed('0x28')](respondWithResult(_0x31e86e,0xc9))[_0x17ed('0x3a')](handleError(_0x31e86e,null));};exports[_0x17ed('0x5d')]=function(_0x37f250,_0x3bb729){if(_0x37f250[_0x17ed('0x5c')]['id']){delete _0x37f250[_0x17ed('0x5c')]['id'];}_0x37f250[_0x17ed('0x5c')][_0x17ed('0x3d')]=widgetAttributes(_0x37f250[_0x17ed('0x5c')]);return db[_0x17ed('0x31')]['find']({'where':{'id':_0x37f250[_0x17ed('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3bb729,null))['then'](saveUpdates(_0x37f250['body'],null))[_0x17ed('0x28')](respondWithResult(_0x3bb729,null))[_0x17ed('0x3a')](handleError(_0x3bb729,null));}; \ No newline at end of file +var _0x7f27=['attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','body','create','params','eml-format','rimraf','request-promise','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','fields','attributes','length','includeAll','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts'];(function(_0x24c38f,_0x49ff05){var _0xeec58e=function(_0x14b2d0){while(--_0x14b2d0){_0x24c38f['push'](_0x24c38f['shift']());}};_0xeec58e(++_0x49ff05);}(_0x7f27,0x12e));var _0x77f2=function(_0x585136,_0x2d38d3){_0x585136=_0x585136-0x0;var _0x3ef2b0=_0x7f27[_0x585136];return _0x3ef2b0;};'use strict';var emlformat=require(_0x77f2('0x0'));var rimraf=require(_0x77f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77f2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77f2('0x3'));var util=require(_0x77f2('0x4'));var path=require(_0x77f2('0x5'));var sox=require('sox');var csv=require(_0x77f2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77f2('0x7'));var _=require(_0x77f2('0x8'));var squel=require('squel');var crypto=require(_0x77f2('0x9'));var jsforce=require(_0x77f2('0xa'));var deskjs=require(_0x77f2('0xb'));var toCsv=require(_0x77f2('0x6'));var querystring=require('querystring');var Papa=require(_0x77f2('0xc'));var Redis=require(_0x77f2('0xd'));var authService=require(_0x77f2('0xe'));var qs=require(_0x77f2('0xf'));var as=require(_0x77f2('0x10'));var hardwareService=require(_0x77f2('0x11'));var logger=require(_0x77f2('0x12'))(_0x77f2('0x13'));var utils=require(_0x77f2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77f2('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x77f2('0x16')](config[_0x77f2('0x17')],{'host':_0x77f2('0x18'),'port':0x18eb});var socket=require(_0x77f2('0x19'))(new Redis(config[_0x77f2('0x17')]));require(_0x77f2('0x1a'))['register'](socket);function respondWithStatusCode(_0x330e80,_0x131db3){_0x131db3=_0x131db3||0xcc;return function(_0x273c33){if(_0x273c33){return _0x330e80[_0x77f2('0x1b')](_0x131db3);}return _0x330e80[_0x77f2('0x1c')](_0x131db3)[_0x77f2('0x1d')]();};}function respondWithResult(_0x64471d,_0x1a1809){_0x1a1809=_0x1a1809||0xc8;return function(_0xd63885){if(_0xd63885){return _0x64471d['status'](_0x1a1809)[_0x77f2('0x1e')](_0xd63885);}};}function respondWithFilteredResult(_0x528f02,_0x1a63a0){return function(_0xffdf18){if(_0xffdf18){var _0x2368ec=typeof _0x1a63a0['offset']===_0x77f2('0x1f')&&typeof _0x1a63a0[_0x77f2('0x20')]===_0x77f2('0x1f');var _0x270ba7=_0xffdf18[_0x77f2('0x21')];var _0x15c7eb=_0x2368ec?0x0:_0x1a63a0[_0x77f2('0x22')];var _0x171b37=_0x2368ec?_0xffdf18[_0x77f2('0x21')]:_0x1a63a0[_0x77f2('0x22')]+_0x1a63a0[_0x77f2('0x20')];var _0x460941;if(_0x171b37>=_0x270ba7){_0x171b37=_0x270ba7;_0x460941=0xc8;}else{_0x460941=0xce;}_0x528f02[_0x77f2('0x1c')](_0x460941);return _0x528f02[_0x77f2('0x23')](_0x77f2('0x24'),_0x15c7eb+'-'+_0x171b37+'/'+_0x270ba7)['json'](_0xffdf18);}return null;};}function patchUpdates(_0x3db6d2){return function(_0xed3992){try{jsonpatch[_0x77f2('0x25')](_0xed3992,_0x3db6d2,!![]);}catch(_0x897e3c){return BPromise[_0x77f2('0x26')](_0x897e3c);}return _0xed3992['save']();};}function saveUpdates(_0x2afa88,_0x384f93){return function(_0x37a421){if(_0x37a421){return _0x37a421[_0x77f2('0x27')](_0x2afa88)[_0x77f2('0x28')](function(_0x37fba4){return _0x37fba4;});}return null;};}function removeEntity(_0x311e2b,_0x42f510){return function(_0x47d610){if(_0x47d610){return _0x47d610[_0x77f2('0x29')]()[_0x77f2('0x28')](function(){_0x311e2b[_0x77f2('0x1c')](0xcc)[_0x77f2('0x1d')]();});}};}function handleEntityNotFound(_0x4e4265,_0x404101){return function(_0x13f9c7){if(!_0x13f9c7){_0x4e4265[_0x77f2('0x1b')](0x194);}return _0x13f9c7;};}function handleError(_0x17bae7,_0x178235){_0x178235=_0x178235||0x1f4;return function(_0x5a260f){logger['error'](_0x5a260f['stack']);if(_0x5a260f[_0x77f2('0x2a')]){delete _0x5a260f['name'];}_0x17bae7[_0x77f2('0x1c')](_0x178235)[_0x77f2('0x2b')](_0x5a260f);};}exports[_0x77f2('0x2c')]=function(_0x1ba486,_0x5402b2){var _0x499943={'raw':![],'where':{'id':_0x1ba486['params']['id']}},_0x1f89e5={};_0x1f89e5[_0x77f2('0x2d')]=_[_0x77f2('0x2e')](db[_0x77f2('0x2f')][_0x77f2('0x30')]);_0x1f89e5[_0x77f2('0x31')]=_[_0x77f2('0x2e')](_0x1ba486[_0x77f2('0x31')]);_0x1f89e5['filters']=_['intersection'](_0x1f89e5[_0x77f2('0x2d')],_0x1f89e5[_0x77f2('0x31')]);_0x499943['attributes']=_[_0x77f2('0x32')](_0x1f89e5['model'],qs[_0x77f2('0x33')](_0x1ba486['query']['fields']));_0x499943['attributes']=_0x499943[_0x77f2('0x34')][_0x77f2('0x35')]?_0x499943[_0x77f2('0x34')]:_0x1f89e5['model'];if(_0x1ba486[_0x77f2('0x31')][_0x77f2('0x36')]){_0x499943['include']=[{'all':!![]}];}_0x499943=_['merge']({},_0x499943,_0x1ba486[_0x77f2('0x37')]);return db[_0x77f2('0x2f')][_0x77f2('0x38')](_0x499943)[_0x77f2('0x28')](handleEntityNotFound(_0x5402b2,null))[_0x77f2('0x28')](respondWithResult(_0x5402b2,null))[_0x77f2('0x39')](handleError(_0x5402b2,null));};exports[_0x77f2('0x29')]=function(_0x2f3700,_0xde504){return db['DashboardItem']['find']({'where':{'id':_0x2f3700['params']['id']}})[_0x77f2('0x28')](handleEntityNotFound(_0xde504,null))[_0x77f2('0x28')](removeEntity(_0xde504,null))['catch'](handleError(_0xde504,null));};function widgetAttributes(_0x1c0441){try{switch(_0x1c0441[_0x77f2('0x3a')]){case _0x77f2('0x3b'):return[{'name':_0x77f2('0x3c'),'value':_0x1c0441[_0x77f2('0x3c')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3e')]:undefined)||_0x77f2('0x3f')}];case _0x77f2('0x40'):return[{'name':_0x77f2('0x41'),'value':_0x1c0441['attrPath']||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3e')]:undefined)||''}];case'clock':return[{'name':_0x77f2('0x42'),'value':_0x1c0441[_0x77f2('0x42')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3e')]:undefined)||_0x77f2('0x43')},{'name':_0x77f2('0x44'),'value':_0x1c0441[_0x77f2('0x44')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x1]?_0x1c0441[_0x77f2('0x3d')][0x1][_0x77f2('0x3e')]:undefined)||_0x77f2('0x45')},{'name':_0x77f2('0x46'),'value':_0x1c0441['attrFontSize']||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x2]?_0x1c0441[_0x77f2('0x3d')][0x2][_0x77f2('0x3e')]:undefined)||0xc}];case _0x77f2('0x47'):return[{'name':_0x77f2('0x48'),'value':_0x1c0441[_0x77f2('0x48')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3e')]:undefined)||_0x77f2('0x49')},{'name':_0x77f2('0x4a'),'value':_0x1c0441[_0x77f2('0x4a')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x1]?_0x1c0441[_0x77f2('0x3d')][0x1][_0x77f2('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x1c0441[_0x77f2('0x46')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x2]?_0x1c0441[_0x77f2('0x3d')][0x2][_0x77f2('0x3e')]:undefined)||0x14},{'name':_0x77f2('0x4b'),'value':_0x1c0441[_0x77f2('0x4b')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x3]?_0x1c0441[_0x77f2('0x3d')][0x3][_0x77f2('0x3e')]:undefined)||_0x77f2('0x4c')},{'name':_0x77f2('0x4d'),'value':_0x1c0441[_0x77f2('0x4d')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x4]?_0x1c0441[_0x77f2('0x3d')][0x4][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x4e'),'value':_0x1c0441[_0x77f2('0x4e')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x5]?_0x1c0441[_0x77f2('0x3d')][0x5][_0x77f2('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1c0441[_0x77f2('0x4f')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x6]?_0x1c0441[_0x77f2('0x3d')][0x6][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x50'),'value':_0x1c0441[_0x77f2('0x50')]||(_0x1c0441['attrs']&&_0x1c0441['attrs'][0x7]?_0x1c0441[_0x77f2('0x3d')][0x7][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x51'),'value':_0x1c0441[_0x77f2('0x51')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x8]?_0x1c0441[_0x77f2('0x3d')][0x8]['value']:undefined)||''},{'name':_0x77f2('0x52'),'value':_0x1c0441[_0x77f2('0x52')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x9]?_0x1c0441['attrs'][0x9][_0x77f2('0x3e')]:undefined)||''}];case _0x77f2('0x53'):case'pie-chart':return[{'name':_0x77f2('0x54'),'value':_0x1c0441[_0x77f2('0x54')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0]['value']:undefined)||_0x77f2('0x49')},{'name':_0x77f2('0x55'),'value':_0x1c0441[_0x77f2('0x55')]||(_0x1c0441['attrs']&&_0x1c0441['attrs'][0x1]?_0x1c0441[_0x77f2('0x3d')][0x1]['value']:undefined)||null},{'name':_0x77f2('0x56'),'value':_0x1c0441[_0x77f2('0x56')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x2]?_0x1c0441[_0x77f2('0x3d')][0x2]['value']:undefined)||null},{'name':_0x77f2('0x4a'),'value':_0x1c0441[_0x77f2('0x4a')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x3]?_0x1c0441[_0x77f2('0x3d')][0x3][_0x77f2('0x3e')]:undefined)||[]},{'name':_0x77f2('0x4b'),'value':_0x1c0441[_0x77f2('0x4b')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x4]?_0x1c0441['attrs'][0x4]['value']:undefined)||_0x77f2('0x4c')},{'name':_0x77f2('0x4d'),'value':_0x1c0441['attrEmailAccounts']||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x5]?_0x1c0441[_0x77f2('0x3d')][0x5][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x4e'),'value':_0x1c0441['attrFaxAccounts']||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x6]?_0x1c0441[_0x77f2('0x3d')][0x6][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x4f'),'value':_0x1c0441[_0x77f2('0x4f')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x7]?_0x1c0441['attrs'][0x7][_0x77f2('0x3e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1c0441['attrOpenchannelAccounts']||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x8]?_0x1c0441[_0x77f2('0x3d')][0x8][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x51'),'value':_0x1c0441[_0x77f2('0x51')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x9]?_0x1c0441['attrs'][0x9][_0x77f2('0x3e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1c0441[_0x77f2('0x52')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0xa]?_0x1c0441['attrs'][0xa][_0x77f2('0x3e')]:undefined)||''}];case'web-report':return[{'name':_0x77f2('0x57'),'type':_0x1c0441[_0x77f2('0x58')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3a')]:undefined)||null,'value':_0x1c0441[_0x77f2('0x57')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x0]?_0x1c0441['attrs'][0x0]['value']:undefined)||null},{'name':_0x77f2('0x59'),'value':_0x1c0441[_0x77f2('0x59')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x1]?_0x1c0441[_0x77f2('0x3d')][0x1][_0x77f2('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x1559b4){logger[_0x77f2('0x5a')](_0x77f2('0x5b'),JSON['stringify'](_0x1559b4));return[];}}exports['create']=function(_0x38115c,_0x48eb49){if(_0x38115c[_0x77f2('0x5c')]){_0x38115c[_0x77f2('0x5c')]['attrs']=widgetAttributes(_0x38115c[_0x77f2('0x5c')]);}return db['DashboardItem'][_0x77f2('0x5d')](_0x38115c[_0x77f2('0x5c')],{})[_0x77f2('0x28')](respondWithResult(_0x48eb49,0xc9))[_0x77f2('0x39')](handleError(_0x48eb49,null));};exports[_0x77f2('0x27')]=function(_0x54d746,_0x392e88){if(_0x54d746[_0x77f2('0x5c')]['id']){delete _0x54d746[_0x77f2('0x5c')]['id'];}_0x54d746[_0x77f2('0x5c')]['attrs']=widgetAttributes(_0x54d746[_0x77f2('0x5c')]);return db[_0x77f2('0x2f')]['find']({'where':{'id':_0x54d746[_0x77f2('0x5e')]['id']}})[_0x77f2('0x28')](handleEntityNotFound(_0x392e88,null))['then'](saveUpdates(_0x54d746['body'],null))[_0x77f2('0x28')](respondWithResult(_0x392e88,null))['catch'](handleError(_0x392e88,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a785601..2df2b03 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 _0xe375=['events','../../mysqldb','save','emit','hasOwnProperty','hook','exports'];(function(_0x359842,_0xd7d82d){var _0x317362=function(_0x5cc5fb){while(--_0x5cc5fb){_0x359842['push'](_0x359842['shift']());}};_0x317362(++_0xd7d82d);}(_0xe375,0x7e));var _0x5e37=function(_0x2f9a30,_0x220d16){_0x2f9a30=_0x2f9a30-0x0;var _0x148096=_0xe375[_0x2f9a30];return _0x148096;};'use strict';var EventEmitter=require(_0x5e37('0x0'));var DashboardItem=require(_0x5e37('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e37('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4c47bd){return function(_0x1ca913,_0x844d80,_0x256716){DashboardItemEvents[_0x5e37('0x3')](_0x4c47bd+':'+_0x1ca913['id'],_0x1ca913);DashboardItemEvents[_0x5e37('0x3')](_0x4c47bd,_0x1ca913);_0x256716(null);};}for(var e in events){if(events[_0x5e37('0x4')](e)){var event=events[e];DashboardItem[_0x5e37('0x5')](e,emitEvent(event));}}module[_0x5e37('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x9275=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x59d369,_0x56a533){var _0x58c3eb=function(_0x2acb03){while(--_0x2acb03){_0x59d369['push'](_0x59d369['shift']());}};_0x58c3eb(++_0x56a533);}(_0x9275,0x170));var _0x5927=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x9275[_0xb24a3e];return _0x4038d7;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x5927('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5927('0x1')](0x0);var events={'afterCreate':_0x5927('0x2'),'afterUpdate':_0x5927('0x3'),'afterDestroy':_0x5927('0x4')};function emitEvent(_0x2f5ca9){return function(_0x11e18d,_0x562469,_0x437c69){DashboardItemEvents[_0x5927('0x5')](_0x2f5ca9+':'+_0x11e18d['id'],_0x11e18d);DashboardItemEvents['emit'](_0x2f5ca9,_0x11e18d);_0x437c69(null);};}for(var e in events){if(events[_0x5927('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x5927('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 555a1a6..914545d 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 _0xa728=['../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util'];(function(_0x569019,_0x3fd3d9){var _0x53fbb1=function(_0x5afd7a){while(--_0x5afd7a){_0x569019['push'](_0x569019['shift']());}};_0x53fbb1(++_0x3fd3d9);}(_0xa728,0xb4));var _0x8a72=function(_0x3cfc43,_0x3d09e0){_0x3cfc43=_0x3cfc43-0x0;var _0x1e3ffe=_0xa728[_0x3cfc43];return _0x1e3ffe;};'use strict';var _=require(_0x8a72('0x0'));var util=require(_0x8a72('0x1'));var logger=require(_0x8a72('0x2'))(_0x8a72('0x3'));var moment=require('moment');var BPromise=require(_0x8a72('0x4'));var rp=require(_0x8a72('0x5'));var fs=require('fs');var path=require(_0x8a72('0x6'));var rimraf=require(_0x8a72('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a72('0x8'));module[_0x8a72('0x9')]=function(_0x11a345,_0x2a0d34){return _0x11a345[_0x8a72('0xa')](_0x8a72('0xb'),attributes,{'tableName':_0x8a72('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63e1=['util','api','moment','bluebird','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','lodash'];(function(_0x42bfab,_0x4b6189){var _0x570f5f=function(_0x29da1f){while(--_0x29da1f){_0x42bfab['push'](_0x42bfab['shift']());}};_0x570f5f(++_0x4b6189);}(_0x63e1,0x6d));var _0x163e=function(_0x426c48,_0x46a23d){_0x426c48=_0x426c48-0x0;var _0x390fd0=_0x63e1[_0x426c48];return _0x390fd0;};'use strict';var _=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var logger=require('../../config/logger')(_0x163e('0x2'));var moment=require(_0x163e('0x3'));var BPromise=require(_0x163e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x163e('0x5'));var rimraf=require(_0x163e('0x6'));var config=require('../../config/environment');var attributes=require(_0x163e('0x7'));module[_0x163e('0x8')]=function(_0x260bd,_0x4e2ac6){return _0x260bd[_0x163e('0x9')](_0x163e('0xa'),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 2c21d30..3033a64 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 _0x81a8=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x2c429b,_0x11742b){var _0x35873d=function(_0x396a68){while(--_0x396a68){_0x2c429b['push'](_0x2c429b['shift']());}};_0x35873d(++_0x11742b);}(_0x81a8,0x155));var _0x881a=function(_0x4e4061,_0x26503b){_0x4e4061=_0x4e4061-0x0;var _0x371dbd=_0x81a8[_0x4e4061];return _0x371dbd;};'use strict';var _=require(_0x881a('0x0'));var util=require(_0x881a('0x1'));var moment=require(_0x881a('0x2'));var BPromise=require(_0x881a('0x3'));var rs=require(_0x881a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x881a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x881a('0x6'))(_0x881a('0x7'));var config=require('../../config/environment');var jayson=require(_0x881a('0x8'));var client=jayson[_0x881a('0x9')][_0x881a('0xa')]({'port':0x232a});config[_0x881a('0xb')]=_[_0x881a('0xc')](config[_0x881a('0xb')],{'host':_0x881a('0xd'),'port':0x18eb});var socket=require(_0x881a('0xe'))(new Redis(config[_0x881a('0xb')]));require('./dashboardItem.socket')[_0x881a('0xf')](socket);function respondWithRpcPromise(_0x55e926,_0x31199e,_0x4fdb07){return new BPromise(function(_0x1a41e9,_0x166e29){return client[_0x881a('0x10')](_0x55e926,_0x4fdb07)['then'](function(_0x1067b3){logger[_0x881a('0x11')](_0x881a('0x12'),_0x31199e,'request\x20sent');logger[_0x881a('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x31199e,_0x881a('0x14'),JSON['stringify'](_0x1067b3));if(_0x1067b3[_0x881a('0x15')]){if(_0x1067b3['error'][_0x881a('0x16')]===0x1f4){logger[_0x881a('0x15')](_0x881a('0x12'),_0x31199e,_0x1067b3['error'][_0x881a('0x17')]);return _0x166e29(_0x1067b3[_0x881a('0x15')]['message']);}logger[_0x881a('0x15')]('DashboardItem,\x20%s,\x20%s',_0x31199e,_0x1067b3[_0x881a('0x15')][_0x881a('0x17')]);return _0x1a41e9(_0x1067b3[_0x881a('0x15')][_0x881a('0x17')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x31199e,_0x881a('0x14'));_0x1a41e9(_0x1067b3['result']['message']);}})[_0x881a('0x18')](function(_0x3625c8){logger[_0x881a('0x15')]('DashboardItem,\x20%s,\x20%s',_0x31199e,_0x3625c8);_0x166e29(_0x3625c8);});});} \ No newline at end of file +var _0x40c5=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x3e6876,_0x57426f){var _0x4aea2c=function(_0x4796a8){while(--_0x4796a8){_0x3e6876['push'](_0x3e6876['shift']());}};_0x4aea2c(++_0x57426f);}(_0x40c5,0x88));var _0x540c=function(_0x40aa74,_0x1bfbf4){_0x40aa74=_0x40aa74-0x0;var _0x24a8a2=_0x40c5[_0x40aa74];return _0x24a8a2;};'use strict';var _=require(_0x540c('0x0'));var util=require(_0x540c('0x1'));var moment=require(_0x540c('0x2'));var BPromise=require(_0x540c('0x3'));var rs=require(_0x540c('0x4'));var fs=require('fs');var Redis=require(_0x540c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x540c('0x6'))(_0x540c('0x7'));var config=require(_0x540c('0x8'));var jayson=require(_0x540c('0x9'));var client=jayson[_0x540c('0xa')]['http']({'port':0x232a});config[_0x540c('0xb')]=_['defaults'](config[_0x540c('0xb')],{'host':_0x540c('0xc'),'port':0x18eb});var socket=require(_0x540c('0xd'))(new Redis(config['redis']));require(_0x540c('0xe'))['register'](socket);function respondWithRpcPromise(_0x34160d,_0x1e1728,_0x778e7d){return new BPromise(function(_0x321f1e,_0x3abb2a){return client['request'](_0x34160d,_0x778e7d)[_0x540c('0xf')](function(_0x443985){logger['info'](_0x540c('0x10'),_0x1e1728,'request\x20sent');logger[_0x540c('0x11')](_0x540c('0x12'),_0x1e1728,'request\x20sent',JSON[_0x540c('0x13')](_0x443985));if(_0x443985[_0x540c('0x14')]){if(_0x443985[_0x540c('0x14')][_0x540c('0x15')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x1e1728,_0x443985[_0x540c('0x14')]['message']);return _0x3abb2a(_0x443985['error'][_0x540c('0x16')]);}logger[_0x540c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1e1728,_0x443985[_0x540c('0x14')][_0x540c('0x16')]);return _0x321f1e(_0x443985['error'][_0x540c('0x16')]);}else{logger[_0x540c('0x17')](_0x540c('0x10'),_0x1e1728,_0x540c('0x18'));_0x321f1e(_0x443985[_0x540c('0x19')][_0x540c('0x16')]);}})[_0x540c('0x1a')](function(_0xe67c93){logger[_0x540c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1e1728,_0xe67c93);_0x3abb2a(_0xe67c93);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 42ec1ff..a27fa20 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 _0xc4aa=['update','emit','removeListener','dashboardItem:','./dashboardItem.events','remove'];(function(_0x2f3d73,_0x2e35ac){var _0x2b5fb7=function(_0x427d46){while(--_0x427d46){_0x2f3d73['push'](_0x2f3d73['shift']());}};_0x2b5fb7(++_0x2e35ac);}(_0xc4aa,0xfa));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var DashboardItemEvents=require(_0xac4a('0x0'));var events=['save',_0xac4a('0x1'),_0xac4a('0x2')];function createListener(_0xc6c925,_0x4f80dc){return function(_0x30ef77){_0x4f80dc[_0xac4a('0x3')](_0xc6c925,_0x30ef77);};}function removeListener(_0x587846,_0x47a0c6){return function(){DashboardItemEvents[_0xac4a('0x4')](_0x587846,_0x47a0c6);};}exports['register']=function(_0x481a66){for(var _0x3dcd73=0x0,_0x2d6f7e=events['length'];_0x3dcd73<_0x2d6f7e;_0x3dcd73++){var _0x12b796=events[_0x3dcd73];var _0x571540=createListener(_0xac4a('0x5')+_0x12b796,_0x481a66);DashboardItemEvents['on'](_0x12b796,_0x571540);}}; \ No newline at end of file +var _0x93fc=['remove','update','removeListener','dashboardItem:','./dashboardItem.events','save'];(function(_0x414fff,_0x312ba9){var _0x3140ad=function(_0x216004){while(--_0x216004){_0x414fff['push'](_0x414fff['shift']());}};_0x3140ad(++_0x312ba9);}(_0x93fc,0x1e4));var _0xc93f=function(_0x33a5bb,_0x492972){_0x33a5bb=_0x33a5bb-0x0;var _0x3fdae6=_0x93fc[_0x33a5bb];return _0x3fdae6;};'use strict';var DashboardItemEvents=require(_0xc93f('0x0'));var events=[_0xc93f('0x1'),_0xc93f('0x2'),_0xc93f('0x3')];function createListener(_0x5dc965,_0x48bc89){return function(_0x17d5b8){_0x48bc89['emit'](_0x5dc965,_0x17d5b8);};}function removeListener(_0x27dcdf,_0x26b402){return function(){DashboardItemEvents[_0xc93f('0x4')](_0x27dcdf,_0x26b402);};}exports['register']=function(_0x282980){for(var _0x4a3a96=0x0,_0x995748=events['length'];_0x4a3a96<_0x995748;_0x4a3a96++){var _0x1b58d8=events[_0x4a3a96];var _0x2e04b4=createListener(_0xc93f('0x5')+_0x1b58d8,_0x282980);DashboardItemEvents['on'](_0x1b58d8,_0x2e04b4);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 8076b71..f973309 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 _0xe750=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe750,0x191));var _0x0e75=function(_0x1c9d86,_0x50342f){_0x1c9d86=_0x1c9d86-0x0;var _0x2892ba=_0xe750[_0x1c9d86];return _0x2892ba;};'use strict';var multer=require(_0x0e75('0x0'));var util=require(_0x0e75('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e75('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0e75('0x3'));var interaction=require(_0x0e75('0x4'));var config=require(_0x0e75('0x5'));var controller=require(_0x0e75('0x6'));router[_0x0e75('0x7')](_0x0e75('0x8'),auth[_0x0e75('0x9')](),controller[_0x0e75('0xa')]);router[_0x0e75('0xb')]('/',auth[_0x0e75('0x9')](),controller[_0x0e75('0xc')]);router['put'](_0x0e75('0x8'),auth['isAuthenticated'](),controller[_0x0e75('0xd')]);router[_0x0e75('0xe')](_0x0e75('0x8'),auth[_0x0e75('0x9')](),controller[_0x0e75('0xf')]);module[_0x0e75('0x10')]=router; \ No newline at end of file +var _0x7de1=['destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','/:id','update'];(function(_0x3fbec3,_0x2b1471){var _0x10e7d4=function(_0x4df45f){while(--_0x4df45f){_0x3fbec3['push'](_0x3fbec3['shift']());}};_0x10e7d4(++_0x2b1471);}(_0x7de1,0xab));var _0x17de=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x7de1[_0x29c261];return _0x1a9335;};'use strict';var multer=require(_0x17de('0x0'));var util=require('util');var path=require(_0x17de('0x1'));var timeout=require(_0x17de('0x2'));var express=require(_0x17de('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x17de('0x4'));var config=require('../../config/environment');var controller=require(_0x17de('0x5'));router[_0x17de('0x6')]('/:id',auth[_0x17de('0x7')](),controller[_0x17de('0x8')]);router['post']('/',auth[_0x17de('0x7')](),controller['create']);router['put'](_0x17de('0x9'),auth['isAuthenticated'](),controller[_0x17de('0xa')]);router['delete']('/:id',auth[_0x17de('0x7')](),controller[_0x17de('0xb')]);module[_0x17de('0xc')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 6f54325..65cd37e 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 _0x541c=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x541c,0xe2));var _0xc541=function(_0xaec7d,_0x44dce6){_0xaec7d=_0xaec7d-0x0;var _0x54a0ce=_0x541c[_0xaec7d];return _0x54a0ce;};'use strict';var Sequelize=require(_0xc541('0x0'));module[_0xc541('0x1')]={'name':{'type':Sequelize[_0xc541('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc541('0x3')](_0xc541('0x4'),_0xc541('0x5'),_0xc541('0x6')),'allowNull':![],'defaultValue':_0xc541('0x4')},'description':{'type':Sequelize[_0xc541('0x2')]}}; \ No newline at end of file +var _0x5b52=['sequelize','ENUM','first','second','STRING'];(function(_0xe8cb8c,_0x5bd978){var _0x762834=function(_0x14c9f2){while(--_0x14c9f2){_0xe8cb8c['push'](_0xe8cb8c['shift']());}};_0x762834(++_0x5bd978);}(_0x5b52,0x131));var _0x25b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b52[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x25b5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x25b5('0x1')](_0x25b5('0x2'),_0x25b5('0x3'),'third'),'allowNull':![],'defaultValue':_0x25b5('0x2')},'description':{'type':Sequelize[_0x25b5('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6ec6f50..03fa779 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 _0xdcf2=['name','send','Disposition','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','Dispositions','UserProfileResource','sendStatus','error','stack'];(function(_0xb1e62b,_0x237410){var _0x45c369=function(_0x57de57){while(--_0x57de57){_0xb1e62b['push'](_0xb1e62b['shift']());}};_0x45c369(++_0x237410);}(_0xdcf2,0x115));var _0x2dcf=function(_0x348a1c,_0x473ff2){_0x348a1c=_0x348a1c-0x0;var _0x16b380=_0xdcf2[_0x348a1c];return _0x16b380;};'use strict';var emlformat=require(_0x2dcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2dcf('0x2'));var BPromise=require(_0x2dcf('0x3'));var Mustache=require(_0x2dcf('0x4'));var util=require(_0x2dcf('0x5'));var path=require(_0x2dcf('0x6'));var sox=require(_0x2dcf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dcf('0x8'));var _=require(_0x2dcf('0x9'));var squel=require(_0x2dcf('0xa'));var crypto=require('crypto');var jsforce=require(_0x2dcf('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2dcf('0xc'));var Papa=require(_0x2dcf('0xd'));var Redis=require(_0x2dcf('0xe'));var authService=require(_0x2dcf('0xf'));var qs=require(_0x2dcf('0x10'));var as=require(_0x2dcf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2dcf('0x12'));var licenseUtil=require(_0x2dcf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ef07,_0x3f78b4){_0x3f78b4=_0x3f78b4||0xcc;return function(_0x157a7e){if(_0x157a7e){return _0x35ef07['sendStatus'](_0x3f78b4);}return _0x35ef07[_0x2dcf('0x14')](_0x3f78b4)[_0x2dcf('0x15')]();};}function respondWithResult(_0x13f03d,_0x447c01){_0x447c01=_0x447c01||0xc8;return function(_0x53833c){if(_0x53833c){return _0x13f03d['status'](_0x447c01)[_0x2dcf('0x16')](_0x53833c);}};}function respondWithFilteredResult(_0x36835b,_0x33a3c6){return function(_0xa01830){if(_0xa01830){var _0x527e41=typeof _0x33a3c6['offset']==='undefined'&&typeof _0x33a3c6[_0x2dcf('0x17')]===_0x2dcf('0x18');var _0x39d275=_0xa01830[_0x2dcf('0x19')];var _0x32d52d=_0x527e41?0x0:_0x33a3c6[_0x2dcf('0x1a')];var _0x25df51=_0x527e41?_0xa01830[_0x2dcf('0x19')]:_0x33a3c6[_0x2dcf('0x1a')]+_0x33a3c6['limit'];var _0x5c48c0;if(_0x25df51>=_0x39d275){_0x25df51=_0x39d275;_0x5c48c0=0xc8;}else{_0x5c48c0=0xce;}_0x36835b[_0x2dcf('0x14')](_0x5c48c0);return _0x36835b[_0x2dcf('0x1b')](_0x2dcf('0x1c'),_0x32d52d+'-'+_0x25df51+'/'+_0x39d275)[_0x2dcf('0x16')](_0xa01830);}return null;};}function patchUpdates(_0x2e5fa6){return function(_0x266763){try{jsonpatch['apply'](_0x266763,_0x2e5fa6,!![]);}catch(_0x1193b8){return BPromise[_0x2dcf('0x1d')](_0x1193b8);}return _0x266763[_0x2dcf('0x1e')]();};}function saveUpdates(_0x40e1a0,_0x2acaa9){return function(_0x3d52d9){if(_0x3d52d9){return _0x3d52d9[_0x2dcf('0x1f')](_0x40e1a0)[_0x2dcf('0x20')](function(_0x5c333e){return _0x5c333e;});}return null;};}function removeEntity(_0x14511a,_0x1f4ffd){return function(_0x2c71c2){if(_0x2c71c2){return _0x2c71c2[_0x2dcf('0x21')]()[_0x2dcf('0x20')](function(){var _0x5d8024=_0x2c71c2['get']({'plain':!![]});var _0xa259dd=_0x2dcf('0x22');return db[_0x2dcf('0x23')]['destroy']({'where':{'type':_0xa259dd,'resourceId':_0x5d8024['id']}})[_0x2dcf('0x20')](function(){return _0x2c71c2;});})[_0x2dcf('0x20')](function(){_0x14511a[_0x2dcf('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265178,_0x151daa){return function(_0x3f1f8a){if(!_0x3f1f8a){_0x265178[_0x2dcf('0x24')](0x194);}return _0x3f1f8a;};}function handleError(_0x4153a8,_0x2c29d1){_0x2c29d1=_0x2c29d1||0x1f4;return function(_0xf7e57d){logger[_0x2dcf('0x25')](_0xf7e57d[_0x2dcf('0x26')]);if(_0xf7e57d[_0x2dcf('0x27')]){delete _0xf7e57d[_0x2dcf('0x27')];}_0x4153a8[_0x2dcf('0x14')](_0x2c29d1)[_0x2dcf('0x28')](_0xf7e57d);};}exports['index']=function(_0x75a75d,_0x1f81de){var _0x4fbbd1={},_0x273564={},_0x34a63d={'count':0x0,'rows':[]};var _0x571f1f=_['map'](db[_0x2dcf('0x29')][_0x2dcf('0x2a')],function(_0x5bd8d3){return{'name':_0x5bd8d3[_0x2dcf('0x2b')],'type':_0x5bd8d3[_0x2dcf('0x2c')]['key']};});_0x273564[_0x2dcf('0x2d')]=_[_0x2dcf('0x2e')](_0x571f1f,_0x2dcf('0x27'));_0x273564[_0x2dcf('0x2f')]=_[_0x2dcf('0x30')](_0x75a75d[_0x2dcf('0x2f')]);_0x273564[_0x2dcf('0x31')]=_[_0x2dcf('0x32')](_0x273564[_0x2dcf('0x2d')],_0x273564[_0x2dcf('0x2f')]);_0x4fbbd1[_0x2dcf('0x33')]=_[_0x2dcf('0x32')](_0x273564[_0x2dcf('0x2d')],qs[_0x2dcf('0x34')](_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x34')]));_0x4fbbd1[_0x2dcf('0x33')]=_0x4fbbd1[_0x2dcf('0x33')]['length']?_0x4fbbd1[_0x2dcf('0x33')]:_0x273564[_0x2dcf('0x2d')];if(!_0x75a75d[_0x2dcf('0x2f')]['hasOwnProperty'](_0x2dcf('0x35'))){_0x4fbbd1[_0x2dcf('0x17')]=qs[_0x2dcf('0x17')](_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x17')]);_0x4fbbd1['offset']=qs['offset'](_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x1a')]);}_0x4fbbd1[_0x2dcf('0x36')]=qs['sort'](_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x37')]);_0x4fbbd1['where']=qs['filters'](_[_0x2dcf('0x38')](_0x75a75d[_0x2dcf('0x2f')],_0x273564['filters']),_0x571f1f);if(_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x39')]){_0x4fbbd1['where']=_[_0x2dcf('0x3a')](_0x4fbbd1[_0x2dcf('0x3b')],{'$or':_[_0x2dcf('0x2e')](_0x571f1f,function(_0x11ac5d){if(_0x11ac5d[_0x2dcf('0x2c')]!==_0x2dcf('0x3c')){var _0x317567={};_0x317567[_0x11ac5d[_0x2dcf('0x27')]]={'$like':'%'+_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x39')]+'%'};return _0x317567;}})});}_0x4fbbd1=_[_0x2dcf('0x3a')]({},_0x4fbbd1,_0x75a75d['options']);var _0x2948a4={'where':_0x4fbbd1['where']};return db[_0x2dcf('0x29')]['count'](_0x2948a4)[_0x2dcf('0x20')](function(_0x35e708){_0x34a63d[_0x2dcf('0x19')]=_0x35e708;if(_0x75a75d[_0x2dcf('0x2f')][_0x2dcf('0x3d')]){_0x4fbbd1[_0x2dcf('0x3e')]=[{'all':!![]}];}return db[_0x2dcf('0x29')][_0x2dcf('0x3f')](_0x4fbbd1);})[_0x2dcf('0x20')](function(_0x259843){_0x34a63d[_0x2dcf('0x40')]=_0x259843;return _0x34a63d;})[_0x2dcf('0x20')](respondWithFilteredResult(_0x1f81de,_0x4fbbd1))[_0x2dcf('0x41')](handleError(_0x1f81de,null));};exports[_0x2dcf('0x42')]=function(_0x40e9d8,_0x6b8840){var _0x3d199b={'raw':!![],'where':{'id':_0x40e9d8['params']['id']}},_0xacc053={};_0xacc053['model']=_[_0x2dcf('0x30')](db[_0x2dcf('0x29')][_0x2dcf('0x2a')]);_0xacc053[_0x2dcf('0x2f')]=_[_0x2dcf('0x30')](_0x40e9d8[_0x2dcf('0x2f')]);_0xacc053['filters']=_['intersection'](_0xacc053['model'],_0xacc053[_0x2dcf('0x2f')]);_0x3d199b['attributes']=_['intersection'](_0xacc053['model'],qs[_0x2dcf('0x34')](_0x40e9d8[_0x2dcf('0x2f')][_0x2dcf('0x34')]));_0x3d199b['attributes']=_0x3d199b[_0x2dcf('0x33')][_0x2dcf('0x43')]?_0x3d199b[_0x2dcf('0x33')]:_0xacc053[_0x2dcf('0x2d')];if(_0x40e9d8[_0x2dcf('0x2f')]['includeAll']){_0x3d199b['include']=[{'all':!![]}];}_0x3d199b=_[_0x2dcf('0x3a')]({},_0x3d199b,_0x40e9d8[_0x2dcf('0x44')]);return db[_0x2dcf('0x29')][_0x2dcf('0x45')](_0x3d199b)[_0x2dcf('0x20')](handleEntityNotFound(_0x6b8840,null))[_0x2dcf('0x20')](respondWithResult(_0x6b8840,null))[_0x2dcf('0x41')](handleError(_0x6b8840,null));};exports['create']=function(_0x2ae991,_0x3945fd){return db[_0x2dcf('0x29')][_0x2dcf('0x46')](_0x2ae991['body'],{})['then'](function(_0x1a63ba){var _0x33951f=_0x2ae991[_0x2dcf('0x47')][_0x2dcf('0x48')]({'plain':!![]});if(!_0x33951f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33951f[_0x2dcf('0x49')]===_0x2dcf('0x47')){var _0x2c1148=_0x1a63ba[_0x2dcf('0x48')]({'plain':!![]});var _0x4c9fff=_0x2dcf('0x22');return db[_0x2dcf('0x4a')]['find']({'where':{'name':_0x4c9fff,'userProfileId':_0x33951f[_0x2dcf('0x4b')]},'raw':!![]})[_0x2dcf('0x20')](function(_0x3ac39f){if(_0x3ac39f&&_0x3ac39f['autoAssociation']===0x0){return db[_0x2dcf('0x23')][_0x2dcf('0x46')]({'name':_0x2c1148[_0x2dcf('0x27')],'resourceId':_0x2c1148['id'],'type':_0x3ac39f[_0x2dcf('0x27')],'sectionId':_0x3ac39f['id']},{})['then'](function(){return _0x1a63ba;});}else{return _0x1a63ba;}})[_0x2dcf('0x41')](function(_0x439f0c){logger['error'](_0x2dcf('0x4c'),_0x439f0c);throw _0x439f0c;});}return _0x1a63ba;})[_0x2dcf('0x20')](respondWithResult(_0x3945fd,0xc9))[_0x2dcf('0x41')](handleError(_0x3945fd,null));};exports[_0x2dcf('0x1f')]=function(_0x3b0c08,_0x4afc1d){if(_0x3b0c08[_0x2dcf('0x4d')]['id']){delete _0x3b0c08[_0x2dcf('0x4d')]['id'];}return db['Disposition']['find']({'where':{'id':_0x3b0c08['params']['id']}})[_0x2dcf('0x20')](handleEntityNotFound(_0x4afc1d,null))['then'](saveUpdates(_0x3b0c08[_0x2dcf('0x4d')],null))[_0x2dcf('0x20')](respondWithResult(_0x4afc1d,null))[_0x2dcf('0x41')](handleError(_0x4afc1d,null));};exports[_0x2dcf('0x21')]=function(_0x10cac3,_0x1bc9f0){return db[_0x2dcf('0x29')][_0x2dcf('0x45')]({'where':{'id':_0x10cac3[_0x2dcf('0x4e')]['id']}})[_0x2dcf('0x20')](handleEntityNotFound(_0x1bc9f0,null))[_0x2dcf('0x20')](removeEntity(_0x1bc9f0,null))[_0x2dcf('0x41')](handleError(_0x1bc9f0,null));}; \ No newline at end of file +var _0x872a=['catch','params','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x7510b0,_0x109b04){var _0x590028=function(_0x292c9c){while(--_0x292c9c){_0x7510b0['push'](_0x7510b0['shift']());}};_0x590028(++_0x109b04);}(_0x872a,0x100));var _0xa872=function(_0x2f4023,_0x251164){_0x2f4023=_0x2f4023-0x0;var _0x398b31=_0x872a[_0x2f4023];return _0x398b31;};'use strict';var emlformat=require(_0xa872('0x0'));var rimraf=require(_0xa872('0x1'));var zipdir=require(_0xa872('0x2'));var jsonpatch=require(_0xa872('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa872('0x4'));var util=require(_0xa872('0x5'));var path=require(_0xa872('0x6'));var sox=require(_0xa872('0x7'));var csv=require(_0xa872('0x8'));var ejs=require(_0xa872('0x9'));var fs=require('fs');var fs_extra=require(_0xa872('0xa'));var _=require('lodash');var squel=require(_0xa872('0xb'));var crypto=require(_0xa872('0xc'));var jsforce=require(_0xa872('0xd'));var deskjs=require(_0xa872('0xe'));var toCsv=require(_0xa872('0x8'));var querystring=require(_0xa872('0xf'));var Papa=require(_0xa872('0x10'));var Redis=require(_0xa872('0x11'));var authService=require(_0xa872('0x12'));var qs=require(_0xa872('0x13'));var as=require(_0xa872('0x14'));var hardwareService=require(_0xa872('0x15'));var logger=require(_0xa872('0x16'))(_0xa872('0x17'));var utils=require('../../config/utils');var config=require(_0xa872('0x18'));var licenseUtil=require(_0xa872('0x19'));var db=require(_0xa872('0x1a'))['db'];function respondWithStatusCode(_0x50a4e4,_0x3df1ed){_0x3df1ed=_0x3df1ed||0xcc;return function(_0x322863){if(_0x322863){return _0x50a4e4[_0xa872('0x1b')](_0x3df1ed);}return _0x50a4e4[_0xa872('0x1c')](_0x3df1ed)[_0xa872('0x1d')]();};}function respondWithResult(_0x5ea257,_0x3d2b0e){_0x3d2b0e=_0x3d2b0e||0xc8;return function(_0x5cd621){if(_0x5cd621){return _0x5ea257[_0xa872('0x1c')](_0x3d2b0e)[_0xa872('0x1e')](_0x5cd621);}};}function respondWithFilteredResult(_0x255abf,_0x947d7){return function(_0x54b97c){if(_0x54b97c){var _0x2619b1=typeof _0x947d7[_0xa872('0x1f')]==='undefined'&&typeof _0x947d7[_0xa872('0x20')]===_0xa872('0x21');var _0x3f5dc6=_0x54b97c['count'];var _0xa61ab3=_0x2619b1?0x0:_0x947d7[_0xa872('0x1f')];var _0x3c05b5=_0x2619b1?_0x54b97c[_0xa872('0x22')]:_0x947d7[_0xa872('0x1f')]+_0x947d7['limit'];var _0x26cc07;if(_0x3c05b5>=_0x3f5dc6){_0x3c05b5=_0x3f5dc6;_0x26cc07=0xc8;}else{_0x26cc07=0xce;}_0x255abf['status'](_0x26cc07);return _0x255abf[_0xa872('0x23')]('Content-Range',_0xa61ab3+'-'+_0x3c05b5+'/'+_0x3f5dc6)[_0xa872('0x1e')](_0x54b97c);}return null;};}function patchUpdates(_0x58bd91){return function(_0x18e3a5){try{jsonpatch['apply'](_0x18e3a5,_0x58bd91,!![]);}catch(_0xe589b5){return BPromise[_0xa872('0x24')](_0xe589b5);}return _0x18e3a5['save']();};}function saveUpdates(_0x380c1c,_0x21db5b){return function(_0x5ad012){if(_0x5ad012){return _0x5ad012[_0xa872('0x25')](_0x380c1c)[_0xa872('0x26')](function(_0x1b24f7){return _0x1b24f7;});}return null;};}function removeEntity(_0x431365,_0x167057){return function(_0x28db80){if(_0x28db80){return _0x28db80[_0xa872('0x27')]()['then'](function(){var _0x1d6686=_0x28db80[_0xa872('0x28')]({'plain':!![]});var _0x28876a=_0xa872('0x29');return db[_0xa872('0x2a')][_0xa872('0x27')]({'where':{'type':_0x28876a,'resourceId':_0x1d6686['id']}})[_0xa872('0x26')](function(){return _0x28db80;});})['then'](function(){_0x431365[_0xa872('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dd475,_0x4053c0){return function(_0x1e24c7){if(!_0x1e24c7){_0x1dd475['sendStatus'](0x194);}return _0x1e24c7;};}function handleError(_0x149f8d,_0x7c7f13){_0x7c7f13=_0x7c7f13||0x1f4;return function(_0x25322d){logger[_0xa872('0x2b')](_0x25322d['stack']);if(_0x25322d[_0xa872('0x2c')]){delete _0x25322d['name'];}_0x149f8d['status'](_0x7c7f13)[_0xa872('0x2d')](_0x25322d);};}exports['index']=function(_0x215a61,_0x408bdf){var _0x45131d={},_0x252831={},_0x391725={'count':0x0,'rows':[]};var _0x4a990d=_[_0xa872('0x2e')](db[_0xa872('0x2f')][_0xa872('0x30')],function(_0x486565){return{'name':_0x486565[_0xa872('0x31')],'type':_0x486565[_0xa872('0x32')][_0xa872('0x33')]};});_0x252831[_0xa872('0x34')]=_[_0xa872('0x2e')](_0x4a990d,_0xa872('0x2c'));_0x252831['query']=_[_0xa872('0x35')](_0x215a61[_0xa872('0x36')]);_0x252831[_0xa872('0x37')]=_[_0xa872('0x38')](_0x252831['model'],_0x252831[_0xa872('0x36')]);_0x45131d[_0xa872('0x39')]=_[_0xa872('0x38')](_0x252831[_0xa872('0x34')],qs[_0xa872('0x3a')](_0x215a61[_0xa872('0x36')][_0xa872('0x3a')]));_0x45131d[_0xa872('0x39')]=_0x45131d[_0xa872('0x39')][_0xa872('0x3b')]?_0x45131d[_0xa872('0x39')]:_0x252831[_0xa872('0x34')];if(!_0x215a61[_0xa872('0x36')][_0xa872('0x3c')](_0xa872('0x3d'))){_0x45131d[_0xa872('0x20')]=qs[_0xa872('0x20')](_0x215a61[_0xa872('0x36')][_0xa872('0x20')]);_0x45131d['offset']=qs['offset'](_0x215a61['query']['offset']);}_0x45131d[_0xa872('0x3e')]=qs[_0xa872('0x3f')](_0x215a61[_0xa872('0x36')]['sort']);_0x45131d[_0xa872('0x40')]=qs[_0xa872('0x37')](_['pick'](_0x215a61[_0xa872('0x36')],_0x252831[_0xa872('0x37')]),_0x4a990d);if(_0x215a61[_0xa872('0x36')]['filter']){_0x45131d[_0xa872('0x40')]=_[_0xa872('0x41')](_0x45131d[_0xa872('0x40')],{'$or':_['map'](_0x4a990d,function(_0xcae52b){if(_0xcae52b[_0xa872('0x32')]!==_0xa872('0x42')){var _0xd61b59={};_0xd61b59[_0xcae52b[_0xa872('0x2c')]]={'$like':'%'+_0x215a61[_0xa872('0x36')][_0xa872('0x43')]+'%'};return _0xd61b59;}})});}_0x45131d=_['merge']({},_0x45131d,_0x215a61['options']);var _0x2b2d7f={'where':_0x45131d[_0xa872('0x40')]};return db[_0xa872('0x2f')]['count'](_0x2b2d7f)[_0xa872('0x26')](function(_0x19a54b){_0x391725['count']=_0x19a54b;if(_0x215a61['query'][_0xa872('0x44')]){_0x45131d[_0xa872('0x45')]=[{'all':!![]}];}return db[_0xa872('0x2f')][_0xa872('0x46')](_0x45131d);})['then'](function(_0x46b2a2){_0x391725[_0xa872('0x47')]=_0x46b2a2;return _0x391725;})['then'](respondWithFilteredResult(_0x408bdf,_0x45131d))[_0xa872('0x48')](handleError(_0x408bdf,null));};exports['show']=function(_0x3d44d1,_0x16a28d){var _0xb89882={'raw':!![],'where':{'id':_0x3d44d1[_0xa872('0x49')]['id']}},_0x243769={};_0x243769[_0xa872('0x34')]=_[_0xa872('0x35')](db['Disposition'][_0xa872('0x30')]);_0x243769[_0xa872('0x36')]=_['keys'](_0x3d44d1[_0xa872('0x36')]);_0x243769['filters']=_[_0xa872('0x38')](_0x243769[_0xa872('0x34')],_0x243769['query']);_0xb89882[_0xa872('0x39')]=_[_0xa872('0x38')](_0x243769['model'],qs[_0xa872('0x3a')](_0x3d44d1[_0xa872('0x36')][_0xa872('0x3a')]));_0xb89882[_0xa872('0x39')]=_0xb89882[_0xa872('0x39')]['length']?_0xb89882[_0xa872('0x39')]:_0x243769[_0xa872('0x34')];if(_0x3d44d1[_0xa872('0x36')]['includeAll']){_0xb89882[_0xa872('0x45')]=[{'all':!![]}];}_0xb89882=_[_0xa872('0x41')]({},_0xb89882,_0x3d44d1['options']);return db[_0xa872('0x2f')][_0xa872('0x4a')](_0xb89882)[_0xa872('0x26')](handleEntityNotFound(_0x16a28d,null))['then'](respondWithResult(_0x16a28d,null))['catch'](handleError(_0x16a28d,null));};exports[_0xa872('0x4b')]=function(_0x1fc7d1,_0x125020){return db['Disposition'][_0xa872('0x4b')](_0x1fc7d1[_0xa872('0x4c')],{})['then'](function(_0x414d3c){var _0x459f0d=_0x1fc7d1['user'][_0xa872('0x28')]({'plain':!![]});if(!_0x459f0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x459f0d[_0xa872('0x4d')]==='user'){var _0x3023db=_0x414d3c[_0xa872('0x28')]({'plain':!![]});var _0x11ac13=_0xa872('0x29');return db[_0xa872('0x4e')][_0xa872('0x4a')]({'where':{'name':_0x11ac13,'userProfileId':_0x459f0d[_0xa872('0x4f')]},'raw':!![]})[_0xa872('0x26')](function(_0x3c5ec3){if(_0x3c5ec3&&_0x3c5ec3[_0xa872('0x50')]===0x0){return db[_0xa872('0x2a')][_0xa872('0x4b')]({'name':_0x3023db[_0xa872('0x2c')],'resourceId':_0x3023db['id'],'type':_0x3c5ec3[_0xa872('0x2c')],'sectionId':_0x3c5ec3['id']},{})['then'](function(){return _0x414d3c;});}else{return _0x414d3c;}})['catch'](function(_0xce77ed){logger[_0xa872('0x2b')](_0xa872('0x51'),_0xce77ed);throw _0xce77ed;});}return _0x414d3c;})['then'](respondWithResult(_0x125020,0xc9))['catch'](handleError(_0x125020,null));};exports[_0xa872('0x25')]=function(_0x46c828,_0x2297f8){if(_0x46c828[_0xa872('0x4c')]['id']){delete _0x46c828[_0xa872('0x4c')]['id'];}return db[_0xa872('0x2f')][_0xa872('0x4a')]({'where':{'id':_0x46c828[_0xa872('0x49')]['id']}})['then'](handleEntityNotFound(_0x2297f8,null))['then'](saveUpdates(_0x46c828[_0xa872('0x4c')],null))[_0xa872('0x26')](respondWithResult(_0x2297f8,null))[_0xa872('0x48')](handleError(_0x2297f8,null));};exports[_0xa872('0x27')]=function(_0x460bb3,_0x2e601f){return db[_0xa872('0x2f')][_0xa872('0x4a')]({'where':{'id':_0x460bb3[_0xa872('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e601f,null))[_0xa872('0x26')](removeEntity(_0x2e601f,null))[_0xa872('0x48')](handleError(_0x2e601f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1e72907..2b80529 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 _0x6476=['FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','name_mail','MailAccountId','name_sms','name_fax'];(function(_0xe26a20,_0x232bb4){var _0x17c8ba=function(_0x43f2cd){while(--_0x43f2cd){_0xe26a20['push'](_0xe26a20['shift']());}};_0x17c8ba(++_0x232bb4);}(_0x6476,0x82));var _0x6647=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x6476[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x6647('0x0'));var util=require(_0x6647('0x1'));var logger=require(_0x6647('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6647('0x3'));var rp=require(_0x6647('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6647('0x5'));var config=require(_0x6647('0x6'));var attributes=require(_0x6647('0x7'));module[_0x6647('0x8')]=function(_0x243259,_0x5332da){return _0x243259[_0x6647('0x9')](_0x6647('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x6647('0xb'),'fields':[_0x6647('0xc'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x6647('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x6647('0xd'),'fields':[_0x6647('0xc'),_0x6647('0xe')]},{'unique':!![],'name':_0x6647('0xf'),'fields':[_0x6647('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x6647('0x10'),'fields':[_0x6647('0xc'),_0x6647('0x11')]},{'unique':!![],'name':_0x6647('0x12'),'fields':['name',_0x6647('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x6647('0xc'),_0x6647('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x72e7=['exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','api','request-promise','rimraf','../../config/environment','./disposition.attributes'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x72e7,0x6d));var _0x772e=function(_0x131e1a,_0x2b7ac3){_0x131e1a=_0x131e1a-0x0;var _0x1dd2df=_0x72e7[_0x131e1a];return _0x1dd2df;};'use strict';var _=require('lodash');var util=require(_0x772e('0x0'));var logger=require('../../config/logger')(_0x772e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x772e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x772e('0x3'));var config=require(_0x772e('0x4'));var attributes=require(_0x772e('0x5'));module[_0x772e('0x6')]=function(_0x306cbc,_0x2f3c6b){return _0x306cbc['define'](_0x772e('0x7'),attributes,{'tableName':_0x772e('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x772e('0x9'),'fields':[_0x772e('0xa'),_0x772e('0xb')]},{'unique':!![],'name':_0x772e('0xc'),'fields':['name',_0x772e('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x772e('0xa'),_0x772e('0xe')]},{'unique':!![],'name':_0x772e('0xf'),'fields':[_0x772e('0xa'),_0x772e('0x10')]},{'unique':!![],'name':_0x772e('0x11'),'fields':[_0x772e('0xa'),_0x772e('0x12')]},{'unique':!![],'name':_0x772e('0x13'),'fields':[_0x772e('0xa'),_0x772e('0x14')]},{'unique':!![],'name':_0x772e('0x15'),'fields':[_0x772e('0xa'),_0x772e('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 1be3de5..a3f5291 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(_0x476fc2,_0x476521){var _0x8db6f4=function(_0x7156fb){while(--_0x7156fb){_0x476fc2['push'](_0x476fc2['shift']());}};_0x8db6f4(++_0x476521);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x37eeda,_0x52981d){var _0xbb4f77=function(_0xebc6cb){while(--_0xebc6cb){_0x37eeda['push'](_0x37eeda['shift']());}};_0xbb4f77(++_0x52981d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 949c8fd..19e8908 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 _0x087b=['isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x4b2e5c,_0x129908){var _0x2f4e84=function(_0x2786ba){while(--_0x2786ba){_0x4b2e5c['push'](_0x4b2e5c['shift']());}};_0x2f4e84(++_0x129908);}(_0x087b,0x1cb));var _0xb087=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x087b[_0x263a74];return _0x2aa86c;};'use strict';var multer=require('multer');var util=require(_0xb087('0x0'));var path=require(_0xb087('0x1'));var timeout=require(_0xb087('0x2'));var express=require('express');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['show']);router[_0xb087('0xc')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xd')]);router[_0xb087('0xe')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller['update']);router[_0xb087('0xf')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x10')]);module[_0xb087('0x11')]=router; \ No newline at end of file +var _0x9519=['show','post','create','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0x9519,0x67));var _0x9951=function(_0x444d0c,_0x1847d6){_0x444d0c=_0x444d0c-0x0;var _0x14b15d=_0x9519[_0x444d0c];return _0x14b15d;};'use strict';var multer=require(_0x9951('0x0'));var util=require('util');var path=require(_0x9951('0x1'));var timeout=require('connect-timeout');var express=require(_0x9951('0x2'));var router=express['Router']();var fs_extra=require(_0x9951('0x3'));var auth=require(_0x9951('0x4'));var interaction=require(_0x9951('0x5'));var config=require(_0x9951('0x6'));var controller=require(_0x9951('0x7'));router[_0x9951('0x8')]('/',auth[_0x9951('0x9')](),controller[_0x9951('0xa')]);router[_0x9951('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9951('0xb')]);router[_0x9951('0xc')]('/',auth[_0x9951('0x9')](),controller[_0x9951('0xd')]);router['put'](_0x9951('0xe'),auth[_0x9951('0x9')](),controller[_0x9951('0xf')]);router[_0x9951('0x10')](_0x9951('0xe'),auth[_0x9951('0x9')](),controller[_0x9951('0x11')]);module[_0x9951('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index fcd58d6..d82197b 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 _0x0e4b=['sequelize','exports','STRING','ENUM','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x57d562,_0x379b0b){_0x57d562=_0x57d562-0x0;var _0x17ac79=_0x0e4b[_0x57d562];return _0x17ac79;};'use strict';var Sequelize=require(_0xb0e4('0x0'));module[_0xb0e4('0x1')]={'name':{'type':Sequelize[_0xb0e4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xb0e4('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xb0e4('0x2')],'unique':_0xb0e4('0x4')},'minrate':{'type':Sequelize['ENUM'](_0xb0e4('0x5'),_0xb0e4('0x6'),_0xb0e4('0x7'),_0xb0e4('0x8'),_0xb0e4('0x9'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xb0e4('0x3')](_0xb0e4('0x5'),_0xb0e4('0x6'),_0xb0e4('0x7'),_0xb0e4('0x8'),_0xb0e4('0x9'),_0xb0e4('0xa')),'defaultValue':_0xb0e4('0xa')},'modem':{'type':Sequelize[_0xb0e4('0x2')],'defaultValue':_0xb0e4('0xb')},'gateway':{'type':Sequelize[_0xb0e4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb0e4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb0e4('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb0e4('0x3')](_0xb0e4('0xd'),'IAX',_0xb0e4('0xe'),_0xb0e4('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xb0e4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb0e4('0x10')],'defaultValue':function(){return _0xb0e4('0x11');}},'notificationSound':{'type':Sequelize[_0xb0e4('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb0e4('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb0e4('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb0e4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb0e4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb0e4('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xb0e4('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xb0e4('0x12')],'defaultValue':![],'comment':_0xb0e4('0x14'),'set':function(_0x3355c6){if(!_0x3355c6)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xb0e4('0x15'),_0x3355c6);}}}; \ No newline at end of file +var _0x9fd4=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','14400','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2b3888,_0x8660ee){var _0x4beb9a=function(_0x1a5a88){while(--_0x1a5a88){_0x2b3888['push'](_0x2b3888['shift']());}};_0x4beb9a(++_0x8660ee);}(_0x9fd4,0x16c));var _0x49fd=function(_0x13405d,_0xe260e2){_0x13405d=_0x13405d-0x0;var _0x486569=_0x9fd4[_0x13405d];return _0x486569;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x49fd('0x2')]},'ecm':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x4'),'no'),'defaultValue':_0x49fd('0x4')},'headerinfo':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':_0x49fd('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x6'),_0x49fd('0x7'),_0x49fd('0x8'),'9600',_0x49fd('0x9'),_0x49fd('0xa')),'defaultValue':_0x49fd('0x7')},'maxrate':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x6'),'4800',_0x49fd('0x8'),_0x49fd('0xb'),_0x49fd('0x9'),_0x49fd('0xa')),'defaultValue':_0x49fd('0xa')},'modem':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':_0x49fd('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x49fd('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0xe'),_0x49fd('0xf'),_0x49fd('0x10'),_0x49fd('0x11')),'defaultValue':_0x49fd('0xe')},'key':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x49fd('0x12')],'defaultValue':function(){return _0x49fd('0x13');}},'notificationSound':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49fd('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x49fd('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![],'comment':_0x49fd('0x16'),'set':function(_0x475eee){if(!_0x475eee)this[_0x49fd('0x17')](_0x49fd('0x18'),null);this['setDataValue'](_0x49fd('0x19'),_0x475eee);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 58bb138..29bc705 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 _0xeb22=['UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','order','include','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','system','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','updatedAt','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','user','filename','Messages','Contact\x20not\x20found','out','dataValues','SendFax','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','pick','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','get','FaxAccounts'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xeb22,0x158));var _0x2eb2=function(_0x4b33d1,_0x2414e1){_0x4b33d1=_0x4b33d1-0x0;var _0x9e7221=_0xeb22[_0x4b33d1];return _0x9e7221;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2eb2('0x0'));var jsonpatch=require(_0x2eb2('0x1'));var rp=require(_0x2eb2('0x2'));var moment=require(_0x2eb2('0x3'));var BPromise=require(_0x2eb2('0x4'));var Mustache=require(_0x2eb2('0x5'));var util=require(_0x2eb2('0x6'));var path=require(_0x2eb2('0x7'));var sox=require(_0x2eb2('0x8'));var csv=require(_0x2eb2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2eb2('0xa'));var _=require(_0x2eb2('0xb'));var squel=require(_0x2eb2('0xc'));var crypto=require(_0x2eb2('0xd'));var jsforce=require(_0x2eb2('0xe'));var deskjs=require(_0x2eb2('0xf'));var toCsv=require(_0x2eb2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2eb2('0x10'));var authService=require(_0x2eb2('0x11'));var qs=require(_0x2eb2('0x12'));var as=require(_0x2eb2('0x13'));var hardwareService=require(_0x2eb2('0x14'));var logger=require(_0x2eb2('0x15'))('api');var utils=require(_0x2eb2('0x16'));var config=require(_0x2eb2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2eb2('0x18'))['db'];config[_0x2eb2('0x19')]=_[_0x2eb2('0x1a')](config[_0x2eb2('0x19')],{'host':_0x2eb2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2eb2('0x19')]));require(_0x2eb2('0x1c'))[_0x2eb2('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2eb2('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x2eb2('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x57c79f,_0x694ffc,_0x334e22,_0x5487ea){return new BPromise(function(_0x3dd97f,_0x51016d){var _0xdc8c12=_0x5487ea||client;return _0xdc8c12[_0x2eb2('0x1f')](_0x57c79f,_0x334e22)[_0x2eb2('0x20')](function(_0x5d157e){logger[_0x2eb2('0x21')]('FaxAccount,\x20%s,\x20%s',_0x694ffc,_0x2eb2('0x22'));logger[_0x2eb2('0x23')](_0x2eb2('0x24'),_0x694ffc,_0x2eb2('0x22'),JSON[_0x2eb2('0x25')](_0x5d157e));if(_0x5d157e[_0x2eb2('0x26')]){if(_0x5d157e[_0x2eb2('0x26')][_0x2eb2('0x27')]===0x1f4){logger[_0x2eb2('0x26')](_0x2eb2('0x28'),_0x694ffc,_0x5d157e[_0x2eb2('0x26')]['message']);return _0x51016d(_0x5d157e[_0x2eb2('0x26')][_0x2eb2('0x29')]);}logger[_0x2eb2('0x26')]('FaxAccount,\x20%s,\x20%s',_0x694ffc,_0x5d157e[_0x2eb2('0x26')]['message']);return _0x3dd97f(_0x5d157e[_0x2eb2('0x26')][_0x2eb2('0x29')]);}else{logger['info'](_0x2eb2('0x28'),_0x694ffc,_0x2eb2('0x22'));_0x3dd97f(_0x5d157e[_0x2eb2('0x2a')]['message']);}})[_0x2eb2('0x2b')](function(_0x1b761e){logger[_0x2eb2('0x26')](_0x2eb2('0x28'),_0x694ffc,_0x1b761e);_0x51016d(_0x1b761e);});});}function respondWithStatusCode(_0x39f808,_0x43d162){_0x43d162=_0x43d162||0xcc;return function(_0x4e3bd4){if(_0x4e3bd4){return _0x39f808[_0x2eb2('0x2c')](_0x43d162);}return _0x39f808[_0x2eb2('0x2d')](_0x43d162)[_0x2eb2('0x2e')]();};}function respondWithResult(_0xfaf315,_0x2eb088){_0x2eb088=_0x2eb088||0xc8;return function(_0x277416){if(_0x277416){return _0xfaf315[_0x2eb2('0x2d')](_0x2eb088)[_0x2eb2('0x2f')](_0x277416);}};}function respondWithFilteredResult(_0x558278,_0x36c9f1){return function(_0x12de7b){if(_0x12de7b){var _0x265bcf=typeof _0x36c9f1[_0x2eb2('0x30')]===_0x2eb2('0x31')&&typeof _0x36c9f1[_0x2eb2('0x32')]===_0x2eb2('0x31');var _0x352c17=_0x12de7b['count'];var _0x1f2ddd=_0x265bcf?0x0:_0x36c9f1[_0x2eb2('0x30')];var _0x37d626=_0x265bcf?_0x12de7b['count']:_0x36c9f1[_0x2eb2('0x30')]+_0x36c9f1[_0x2eb2('0x32')];var _0x19381d;if(_0x37d626>=_0x352c17){_0x37d626=_0x352c17;_0x19381d=0xc8;}else{_0x19381d=0xce;}_0x558278[_0x2eb2('0x2d')](_0x19381d);return _0x558278[_0x2eb2('0x33')](_0x2eb2('0x34'),_0x1f2ddd+'-'+_0x37d626+'/'+_0x352c17)[_0x2eb2('0x2f')](_0x12de7b);}return null;};}function patchUpdates(_0xc8c163){return function(_0x578a08){try{jsonpatch['apply'](_0x578a08,_0xc8c163,!![]);}catch(_0x174764){return BPromise[_0x2eb2('0x35')](_0x174764);}return _0x578a08[_0x2eb2('0x36')]();};}function saveUpdates(_0x33dc59,_0x15f538){return function(_0x520fdb){if(_0x520fdb){return _0x520fdb[_0x2eb2('0x37')](_0x33dc59)['then'](function(_0x32510d){return _0x32510d;});}return null;};}function removeEntity(_0x13bf32,_0x381a5d){return function(_0x351289){if(_0x351289){return _0x351289['destroy']()['then'](function(){var _0x1276b2=_0x351289[_0x2eb2('0x38')]({'plain':!![]});var _0x171491=_0x2eb2('0x39');return db[_0x2eb2('0x3a')][_0x2eb2('0x3b')]({'where':{'type':_0x171491,'resourceId':_0x1276b2['id']}})['then'](function(){return _0x351289;});})[_0x2eb2('0x20')](function(){_0x13bf32[_0x2eb2('0x2d')](0xcc)[_0x2eb2('0x2e')]();});}};}function handleEntityNotFound(_0x4978d2,_0x379db0){return function(_0x3d1f19){if(!_0x3d1f19){_0x4978d2[_0x2eb2('0x2c')](0x194);}return _0x3d1f19;};}function handleError(_0x593a6a,_0x3c163e){_0x3c163e=_0x3c163e||0x1f4;return function(_0x159a7a){logger['error'](_0x159a7a[_0x2eb2('0x3c')]);if(_0x159a7a[_0x2eb2('0x3d')]){delete _0x159a7a['name'];}_0x593a6a[_0x2eb2('0x2d')](_0x3c163e)[_0x2eb2('0x3e')](_0x159a7a);};}exports[_0x2eb2('0x3f')]=function(_0x156aab,_0x280ee9){var _0xbd0730={'include':[{'model':db[_0x2eb2('0x40')],'as':_0x2eb2('0x41')}]},_0x2f4db7={},_0x296e47={'count':0x0,'rows':[]};var _0x369c07=_[_0x2eb2('0x42')](db[_0x2eb2('0x43')][_0x2eb2('0x44')],function(_0x1e027e){return{'name':_0x1e027e[_0x2eb2('0x45')],'type':_0x1e027e[_0x2eb2('0x46')][_0x2eb2('0x47')]};});_0x2f4db7[_0x2eb2('0x48')]=_[_0x2eb2('0x42')](_0x369c07,_0x2eb2('0x3d'));_0x2f4db7[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x156aab[_0x2eb2('0x49')]);_0x2f4db7[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0x2f4db7[_0x2eb2('0x48')],_0x2f4db7[_0x2eb2('0x49')]);_0xbd0730['attributes']=_['intersection'](_0x2f4db7['model'],qs[_0x2eb2('0x4d')](_0x156aab[_0x2eb2('0x49')]['fields']));_0xbd0730[_0x2eb2('0x4e')]=_0xbd0730[_0x2eb2('0x4e')]['length']?_0xbd0730[_0x2eb2('0x4e')]:_0x2f4db7['model'];if(!_0x156aab[_0x2eb2('0x49')][_0x2eb2('0x4f')]('nolimit')){_0xbd0730['limit']=qs[_0x2eb2('0x32')](_0x156aab['query']['limit']);_0xbd0730[_0x2eb2('0x30')]=qs['offset'](_0x156aab['query'][_0x2eb2('0x30')]);}_0xbd0730['order']=qs[_0x2eb2('0x50')](_0x156aab[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0xbd0730['where']=qs[_0x2eb2('0x4b')](_['pick'](_0x156aab[_0x2eb2('0x49')],_0x2f4db7[_0x2eb2('0x4b')]),_0x369c07);if(_0x156aab[_0x2eb2('0x49')]['filter']){_0xbd0730[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0xbd0730[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0x369c07,function(_0x1ad56f){if(_0x1ad56f[_0x2eb2('0x46')]!==_0x2eb2('0x53')){var _0xbb4ed5={};_0xbb4ed5[_0x1ad56f[_0x2eb2('0x3d')]]={'$like':'%'+_0x156aab['query'][_0x2eb2('0x54')]+'%'};return _0xbb4ed5;}})});}_0xbd0730=_[_0x2eb2('0x52')]({},_0xbd0730,_0x156aab[_0x2eb2('0x55')]);var _0x34f565={'where':_0xbd0730[_0x2eb2('0x51')]};return db['FaxAccount'][_0x2eb2('0x56')](_0x34f565)[_0x2eb2('0x20')](function(_0x3e1e25){_0x296e47[_0x2eb2('0x56')]=_0x3e1e25;if(_0x156aab[_0x2eb2('0x49')][_0x2eb2('0x57')]){_0xbd0730['include']=[{'all':!![]}];}return db[_0x2eb2('0x43')][_0x2eb2('0x58')](_0xbd0730);})[_0x2eb2('0x20')](function(_0x5c93dc){_0x296e47['rows']=_0x5c93dc;return _0x296e47;})['then'](respondWithFilteredResult(_0x280ee9,_0xbd0730))['catch'](handleError(_0x280ee9,null));};exports['show']=function(_0x55b0c7,_0x5926e1){var _0x5aba32={'raw':![],'where':{'id':_0x55b0c7['params']['id']},'include':[{'model':db[_0x2eb2('0x40')],'as':_0x2eb2('0x41')}]},_0x1eeae4={};_0x1eeae4[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db[_0x2eb2('0x43')][_0x2eb2('0x44')]);_0x1eeae4[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x55b0c7[_0x2eb2('0x49')]);_0x1eeae4[_0x2eb2('0x4b')]=_['intersection'](_0x1eeae4['model'],_0x1eeae4[_0x2eb2('0x49')]);_0x5aba32[_0x2eb2('0x4e')]=_[_0x2eb2('0x4c')](_0x1eeae4['model'],qs[_0x2eb2('0x4d')](_0x55b0c7['query'][_0x2eb2('0x4d')]));_0x5aba32[_0x2eb2('0x4e')]=_0x5aba32[_0x2eb2('0x4e')][_0x2eb2('0x59')]?_0x5aba32[_0x2eb2('0x4e')]:_0x1eeae4['model'];if(_0x55b0c7[_0x2eb2('0x49')][_0x2eb2('0x57')]){_0x5aba32['include']=[{'all':!![]}];}_0x5aba32=_[_0x2eb2('0x52')]({},_0x5aba32,_0x55b0c7[_0x2eb2('0x55')]);return db['FaxAccount'][_0x2eb2('0x5a')](_0x5aba32)[_0x2eb2('0x20')](handleEntityNotFound(_0x5926e1,null))[_0x2eb2('0x20')](respondWithResult(_0x5926e1,null))[_0x2eb2('0x2b')](handleError(_0x5926e1,null));};exports['create']=function(_0x536e31,_0x404adc){return db['FaxAccount'][_0x2eb2('0x5b')](_0x536e31[_0x2eb2('0x5c')],{})['then'](function(_0x2ba1c5){var _0x764c4e=_0x536e31['user'][_0x2eb2('0x38')]({'plain':!![]});if(!_0x764c4e)throw new Error(_0x2eb2('0x5d'));if(_0x764c4e[_0x2eb2('0x5e')]==='user'){var _0x2efe0d=_0x2ba1c5['get']({'plain':!![]});var _0x4877ac=_0x2eb2('0x39');return db[_0x2eb2('0x5f')][_0x2eb2('0x5a')]({'where':{'name':_0x4877ac,'userProfileId':_0x764c4e[_0x2eb2('0x60')]},'raw':!![]})[_0x2eb2('0x20')](function(_0x5186f1){if(_0x5186f1&&_0x5186f1[_0x2eb2('0x61')]===0x0){return db[_0x2eb2('0x3a')]['create']({'name':_0x2efe0d[_0x2eb2('0x3d')],'resourceId':_0x2efe0d['id'],'type':_0x5186f1['name'],'sectionId':_0x5186f1['id']},{})['then'](function(){return _0x2ba1c5;});}else{return _0x2ba1c5;}})['catch'](function(_0x4fe09a){logger[_0x2eb2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fe09a);throw _0x4fe09a;});}return _0x2ba1c5;})[_0x2eb2('0x20')](respondWithResult(_0x404adc,0xc9))['catch'](handleError(_0x404adc,null));};exports[_0x2eb2('0x37')]=function(_0x127cb5,_0x302042){if(_0x127cb5[_0x2eb2('0x5c')]['id']){delete _0x127cb5[_0x2eb2('0x5c')]['id'];}return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x127cb5[_0x2eb2('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0x2eb2('0x41')}]})['then'](handleEntityNotFound(_0x302042,null))[_0x2eb2('0x20')](saveUpdates(_0x127cb5[_0x2eb2('0x5c')],null))[_0x2eb2('0x20')](respondWithResult(_0x302042,null))['catch'](handleError(_0x302042,null));};exports[_0x2eb2('0x3b')]=function(_0x16c5d3,_0x25a103){return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x16c5d3[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x25a103,null))[_0x2eb2('0x20')](removeEntity(_0x25a103,null))[_0x2eb2('0x2b')](handleError(_0x25a103,null));};exports[_0x2eb2('0x63')]=function(_0x1a76c9,_0x10fe3f){return db[_0x2eb2('0x43')][_0x2eb2('0x63')]()[_0x2eb2('0x20')](respondWithResult(_0x10fe3f,null))['catch'](handleError(_0x10fe3f,null));};exports[_0x2eb2('0x64')]=function(_0x46f82e,_0x331d6e,_0x5a2c0f){if(_0x46f82e['body']['id']){delete _0x46f82e[_0x2eb2('0x5c')]['id'];}return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x46f82e['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x331d6e,null))['then'](function(_0x8fbfc9){if(_0x8fbfc9){_0x46f82e[_0x2eb2('0x5c')][_0x2eb2('0x65')]=_0x8fbfc9['id'];return db[_0x2eb2('0x66')]['create'](_0x46f82e[_0x2eb2('0x5c')]);}})[_0x2eb2('0x20')](respondWithResult(_0x331d6e,null))[_0x2eb2('0x2b')](handleError(_0x331d6e,null));};exports[_0x2eb2('0x67')]=function(_0x2018bc,_0x183735,_0x324e81){var _0x129597={'raw':![],'where':{}};var _0x9515db={};var _0x3f256b={'count':0x0,'rows':[]};return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x2018bc[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x183735,null))[_0x2eb2('0x20')](function(_0x359918){if(_0x359918){_0x9515db[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db['Disposition']['rawAttributes']);_0x9515db[_0x2eb2('0x49')]=_['keys'](_0x2018bc[_0x2eb2('0x49')]);_0x9515db['filters']=_[_0x2eb2('0x4c')](_0x9515db[_0x2eb2('0x48')],_0x9515db[_0x2eb2('0x49')]);_0x129597[_0x2eb2('0x4e')]=_[_0x2eb2('0x4c')](_0x9515db[_0x2eb2('0x48')],qs[_0x2eb2('0x4d')](_0x2018bc['query']['fields']));_0x129597[_0x2eb2('0x4e')]=_0x129597['attributes'][_0x2eb2('0x59')]?_0x129597[_0x2eb2('0x4e')]:_0x9515db[_0x2eb2('0x48')];if(!_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0x129597[_0x2eb2('0x32')]=qs[_0x2eb2('0x32')](_0x2018bc['query'][_0x2eb2('0x32')]);_0x129597['offset']=qs['offset'](_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x30')]);}_0x129597[_0x2eb2('0x6a')]=qs[_0x2eb2('0x50')](_0x2018bc[_0x2eb2('0x49')]['sort']);_0x129597[_0x2eb2('0x51')]=qs[_0x2eb2('0x4b')](_['pick'](_0x2018bc[_0x2eb2('0x49')],_0x9515db[_0x2eb2('0x4b')]));_0x129597[_0x2eb2('0x51')][_0x2eb2('0x65')]=_0x359918['id'];if(_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x129597['where']=_[_0x2eb2('0x52')](_0x129597[_0x2eb2('0x51')],{'$or':_['map'](_0x129597[_0x2eb2('0x4e')],function(_0x393e5b){var _0x3436f7={};_0x3436f7[_0x393e5b]={'$like':'%'+_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x54')]+'%'};return _0x3436f7;})});}_0x129597=_[_0x2eb2('0x52')]({},_0x129597,_0x2018bc[_0x2eb2('0x55')]);return db[_0x2eb2('0x66')][_0x2eb2('0x56')]({'where':_0x129597[_0x2eb2('0x51')]})[_0x2eb2('0x20')](function(_0x1bac62){_0x3f256b[_0x2eb2('0x56')]=_0x1bac62;if(_0x2018bc[_0x2eb2('0x49')][_0x2eb2('0x57')]){_0x129597[_0x2eb2('0x6b')]=[{'all':!![]}];}return db[_0x2eb2('0x66')]['findAll'](_0x129597);})[_0x2eb2('0x20')](function(_0x378c2c){_0x3f256b[_0x2eb2('0x6c')]=_0x378c2c;return _0x3f256b;});}})['then'](respondWithFilteredResult(_0x183735,_0x129597))[_0x2eb2('0x2b')](handleError(_0x183735,null));};exports[_0x2eb2('0x6d')]=function(_0x42adfb,_0x4b0fc0,_0x41deb2){return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x42adfb['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x4b0fc0,null))[_0x2eb2('0x20')](function(_0x4fd999){if(_0x4fd999){return _0x4fd999[_0x2eb2('0x6d')](_0x42adfb[_0x2eb2('0x49')][_0x2eb2('0x6e')]);}})[_0x2eb2('0x20')](respondWithStatusCode(_0x4b0fc0,null))[_0x2eb2('0x2b')](handleError(_0x4b0fc0,null));};exports['addAnswer']=function(_0x556335,_0x5b01e4,_0x154b55){if(_0x556335[_0x2eb2('0x5c')]['id']){delete _0x556335[_0x2eb2('0x5c')]['id'];}return db['FaxAccount'][_0x2eb2('0x5a')]({'where':{'id':_0x556335[_0x2eb2('0x62')]['id']}})['then'](handleEntityNotFound(_0x5b01e4,null))['then'](function(_0x1dc58e){if(_0x1dc58e){_0x556335['body'][_0x2eb2('0x65')]=_0x1dc58e['id'];return db[_0x2eb2('0x6f')][_0x2eb2('0x5b')](_0x556335[_0x2eb2('0x5c')]);}})[_0x2eb2('0x20')](respondWithResult(_0x5b01e4,null))[_0x2eb2('0x2b')](handleError(_0x5b01e4,null));};exports[_0x2eb2('0x70')]=function(_0x3d6985,_0x30d5b1,_0x2eed29){var _0x8904d9={'raw':![],'where':{}};var _0x30177d={};var _0x21c86f={'count':0x0,'rows':[]};return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x3d6985[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x30d5b1,null))[_0x2eb2('0x20')](function(_0x4074ea){if(_0x4074ea){_0x30177d[_0x2eb2('0x48')]=_['keys'](db['CannedAnswer'][_0x2eb2('0x44')]);_0x30177d[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x3d6985['query']);_0x30177d[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0x30177d[_0x2eb2('0x48')],_0x30177d[_0x2eb2('0x49')]);_0x8904d9[_0x2eb2('0x4e')]=_[_0x2eb2('0x4c')](_0x30177d['model'],qs['fields'](_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x4d')]));_0x8904d9['attributes']=_0x8904d9[_0x2eb2('0x4e')][_0x2eb2('0x59')]?_0x8904d9[_0x2eb2('0x4e')]:_0x30177d['model'];if(!_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0x8904d9[_0x2eb2('0x32')]=qs[_0x2eb2('0x32')](_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x32')]);_0x8904d9['offset']=qs[_0x2eb2('0x30')](_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x30')]);}_0x8904d9[_0x2eb2('0x6a')]=qs['sort'](_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0x8904d9[_0x2eb2('0x51')]=qs[_0x2eb2('0x4b')](_['pick'](_0x3d6985['query'],_0x30177d[_0x2eb2('0x4b')]));_0x8904d9[_0x2eb2('0x51')][_0x2eb2('0x65')]=_0x4074ea['id'];if(_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x8904d9[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0x8904d9[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0x8904d9[_0x2eb2('0x4e')],function(_0x2e2766){var _0x5a370e={};_0x5a370e[_0x2e2766]={'$like':'%'+_0x3d6985[_0x2eb2('0x49')][_0x2eb2('0x54')]+'%'};return _0x5a370e;})});}_0x8904d9=_[_0x2eb2('0x52')]({},_0x8904d9,_0x3d6985[_0x2eb2('0x55')]);return db[_0x2eb2('0x6f')][_0x2eb2('0x56')]({'where':_0x8904d9[_0x2eb2('0x51')]})['then'](function(_0x550c02){_0x21c86f[_0x2eb2('0x56')]=_0x550c02;if(_0x3d6985['query']['includeAll']){_0x8904d9['include']=[{'all':!![]}];}return db[_0x2eb2('0x6f')][_0x2eb2('0x58')](_0x8904d9);})['then'](function(_0x1a3c33){_0x21c86f[_0x2eb2('0x6c')]=_0x1a3c33;return _0x21c86f;});}})[_0x2eb2('0x20')](respondWithFilteredResult(_0x30d5b1,_0x8904d9))[_0x2eb2('0x2b')](handleError(_0x30d5b1,null));};exports['removeAnswers']=function(_0xbf208d,_0x59a995,_0x4e01f4){return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0xbf208d[_0x2eb2('0x62')]['id']}})['then'](handleEntityNotFound(_0x59a995,null))[_0x2eb2('0x20')](function(_0x33d450){if(_0x33d450){return _0x33d450[_0x2eb2('0x71')](_0xbf208d[_0x2eb2('0x49')][_0x2eb2('0x6e')]);}})[_0x2eb2('0x20')](respondWithStatusCode(_0x59a995,null))[_0x2eb2('0x2b')](handleError(_0x59a995,null));};exports['addInteraction']=function(_0x1fdb8b,_0x21f736,_0xded9a1){return db[_0x2eb2('0x72')][_0x2eb2('0x5a')]({'where':{'id':_0x1fdb8b['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x21f736,null))[_0x2eb2('0x20')](function(_0x29124d){if(_0x29124d){return _0x29124d[_0x2eb2('0x73')](_0x1fdb8b[_0x2eb2('0x5c')][_0x2eb2('0x6e')],_[_0x2eb2('0x74')](_0x1fdb8b[_0x2eb2('0x5c')],[_0x2eb2('0x6e'),'id'])||{});}})[_0x2eb2('0x20')](respondWithResult(_0x21f736,null))[_0x2eb2('0x2b')](handleError(_0x21f736,null));};exports[_0x2eb2('0x75')]=function(_0x1ffff7,_0x21373b,_0x686905){var _0x5e47a6={'raw':![],'where':{}};var _0x583bf9={};var _0x14e3e8={'count':0x0,'rows':[]};return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x1ffff7[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x21373b,null))[_0x2eb2('0x20')](function(_0x329c8c){if(_0x329c8c){_0x583bf9[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db[_0x2eb2('0x72')][_0x2eb2('0x44')]);_0x583bf9[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x1ffff7[_0x2eb2('0x49')]);_0x583bf9[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0x583bf9[_0x2eb2('0x48')],_0x583bf9[_0x2eb2('0x49')]);_0x5e47a6['attributes']=_['intersection'](_0x583bf9[_0x2eb2('0x48')],qs[_0x2eb2('0x4d')](_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x4d')]));_0x5e47a6[_0x2eb2('0x4e')]=_0x5e47a6['attributes'][_0x2eb2('0x59')]?_0x5e47a6[_0x2eb2('0x4e')]:_0x583bf9['model'];if(!_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0x5e47a6[_0x2eb2('0x32')]=qs[_0x2eb2('0x32')](_0x1ffff7[_0x2eb2('0x49')]['limit']);_0x5e47a6[_0x2eb2('0x30')]=qs[_0x2eb2('0x30')](_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x30')]);}_0x5e47a6['order']=qs[_0x2eb2('0x50')](_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0x5e47a6['where']=qs[_0x2eb2('0x4b')](_['pick'](_0x1ffff7[_0x2eb2('0x49')],_0x583bf9[_0x2eb2('0x4b')]));_0x5e47a6['where'][_0x2eb2('0x65')]=_0x329c8c['id'];if(_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x5e47a6[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0x5e47a6[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0x5e47a6['attributes'],function(_0x439072){var _0x5e12ab={};_0x5e12ab[_0x439072]={'$like':'%'+_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x54')]+'%'};return _0x5e12ab;})});}_0x5e47a6=_[_0x2eb2('0x52')]({},_0x5e47a6,_0x1ffff7['options']);return db[_0x2eb2('0x72')][_0x2eb2('0x56')]({'where':_0x5e47a6[_0x2eb2('0x51')]})[_0x2eb2('0x20')](function(_0x2bdbc7){_0x14e3e8[_0x2eb2('0x56')]=_0x2bdbc7;if(_0x1ffff7[_0x2eb2('0x49')]['includeAll']){_0x5e47a6[_0x2eb2('0x6b')]=[{'model':db[_0x2eb2('0x76')],'as':_0x2eb2('0x77'),'required':![]},{'model':db['User'],'as':_0x2eb2('0x78'),'attributes':[_0x2eb2('0x3d'),_0x2eb2('0x79'),_0x2eb2('0x7a')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2eb2('0x3d'),_0x2eb2('0x7b')],'where':_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x7c')]?{'id':_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x7c')]}:undefined,'required':_0x1ffff7[_0x2eb2('0x49')][_0x2eb2('0x7c')]?!![]:![]}];}return db[_0x2eb2('0x72')]['findAll'](_0x5e47a6);})[_0x2eb2('0x20')](function(_0x11c9fb){_0x14e3e8[_0x2eb2('0x6c')]=_0x11c9fb;return _0x14e3e8;});}})[_0x2eb2('0x20')](respondWithFilteredResult(_0x21373b,_0x5e47a6))[_0x2eb2('0x2b')](handleError(_0x21373b,null));};exports[_0x2eb2('0x7d')]=function(_0x1f5183,_0x5f2d6b){var _0x8aa068=_0x1f5183['params']['id'];var _0x29320e=_0x1f5183[_0x2eb2('0x5c')];var _0x58fe7e=0xc8;var _0x35814c=null;return db[_0x2eb2('0x7e')][_0x2eb2('0x7f')]({'isolationLevel':db[_0x2eb2('0x7e')][_0x2eb2('0x80')][_0x2eb2('0x81')][_0x2eb2('0x82')]},function(_0x18ea2a){return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x8aa068},'transaction':_0x18ea2a})[_0x2eb2('0x20')](function(_0xb0c40c){if(_0xb0c40c){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x8aa068},'transaction':_0x18ea2a})['then'](function(){var _0x28d0e6=_[_0x2eb2('0x42')](_0x29320e,function(_0x660cb2){_0x660cb2[_0x2eb2('0x65')]=_0x8aa068;return _0x660cb2;});return db[_0x2eb2('0x83')][_0x2eb2('0x84')](_0x28d0e6,{'transaction':_0x18ea2a});});}else{_0x58fe7e=0x194;_0x35814c=[];}});})['then'](function(){if(_0x58fe7e!==0x194){return db[_0x2eb2('0x83')][_0x2eb2('0x85')]({'where':{'FaxAccountId':_0x8aa068},'order':_0x2eb2('0x86')})[_0x2eb2('0x20')](function(_0x33ed07){_0x35814c=_0x33ed07;});}})['catch'](function(_0x3f4e49){_0x58fe7e=0x1f4;logger[_0x2eb2('0x26')](_0x3f4e49[_0x2eb2('0x3c')]);if(_0x3f4e49['name']){delete _0x3f4e49[_0x2eb2('0x3d')];}_0x35814c=_0x3f4e49;})[_0x2eb2('0x87')](function(){if(_0x35814c===null){_0x5f2d6b['sendStatus'](_0x58fe7e);}else{if(_0x58fe7e===0x1f4){_0x5f2d6b['status'](_0x58fe7e)[_0x2eb2('0x3e')](_0x35814c);}else{_0x5f2d6b[_0x2eb2('0x2d')](_0x58fe7e)['json'](_0x35814c);}}});};exports[_0x2eb2('0x88')]=function(_0x10e26d,_0x936cb4,_0x14cf85){var _0xd716bb={};var _0xa31204={};var _0x52ca3b;var _0x3a2aa2;return db['FaxAccount'][_0x2eb2('0x68')]({'where':{'id':_0x10e26d['params']['id']}})['then'](handleEntityNotFound(_0x936cb4,null))[_0x2eb2('0x20')](function(_0x3ad9de){if(_0x3ad9de){_0x52ca3b=_0x3ad9de;_0xa31204['model']=_[_0x2eb2('0x4a')](db[_0x2eb2('0x83')][_0x2eb2('0x44')]);_0xa31204['query']=_[_0x2eb2('0x4a')](_0x10e26d[_0x2eb2('0x49')]);_0xa31204[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0xa31204[_0x2eb2('0x48')],_0xa31204[_0x2eb2('0x49')]);_0xd716bb['attributes']=_['intersection'](_0xa31204[_0x2eb2('0x48')],qs[_0x2eb2('0x4d')](_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x4d')]));_0xd716bb['attributes']=_0xd716bb[_0x2eb2('0x4e')][_0x2eb2('0x59')]?_0xd716bb[_0x2eb2('0x4e')]:_0xa31204[_0x2eb2('0x48')];_0xd716bb[_0x2eb2('0x6a')]=qs[_0x2eb2('0x50')](_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0xd716bb[_0x2eb2('0x51')]=qs[_0x2eb2('0x4b')](_['pick'](_0x10e26d[_0x2eb2('0x49')],_0xa31204[_0x2eb2('0x4b')]));if(_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0xd716bb[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0xd716bb[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0xd716bb[_0x2eb2('0x4e')],function(_0x3cb18e){var _0x4b8dc4={};_0x4b8dc4[_0x3cb18e]={'$like':'%'+_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x54')]+'%'};return _0x4b8dc4;})});}_0xd716bb=_[_0x2eb2('0x52')]({},_0xd716bb,_0x10e26d['options']);return _0x52ca3b[_0x2eb2('0x88')](_0xd716bb);}})[_0x2eb2('0x20')](function(_0x5c550a){if(_0x5c550a){_0x3a2aa2=_0x5c550a['length'];if(!_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0xd716bb[_0x2eb2('0x32')]=qs[_0x2eb2('0x32')](_0x10e26d[_0x2eb2('0x49')][_0x2eb2('0x32')]);_0xd716bb['offset']=qs[_0x2eb2('0x30')](_0x10e26d['query']['offset']);}return _0x52ca3b[_0x2eb2('0x88')](_0xd716bb);}})[_0x2eb2('0x20')](function(_0x4cbbd1){if(_0x4cbbd1){return _0x4cbbd1?{'count':_0x3a2aa2,'rows':_0x4cbbd1}:null;}})[_0x2eb2('0x20')](respondWithResult(_0x936cb4,null))[_0x2eb2('0x2b')](handleError(_0x936cb4,null));};function Extension(_0x538073,_0x5a7afa,_0x459e28,_0x95ff8d){this[_0x2eb2('0x89')]=_0x2eb2('0x8a');this[_0x2eb2('0x8b')]=_0x538073[_0x2eb2('0x8c')];this['app']=_0x95ff8d;this[_0x2eb2('0x46')]=_0x2eb2('0x8d');this['description']=_0x2eb2('0x8e');this[_0x2eb2('0x65')]=_0x538073['id'];this[_0x2eb2('0x86')]=_0x5a7afa;this[_0x2eb2('0x8f')]=_0x459e28;}function createExtensionsReciveFax(_0x2df15d){var _0xc48b6=0x1;var _0x3f1cbb=[];_0x3f1cbb['push'](new Extension(_0x2df15d,_0xc48b6,'',_0x2eb2('0x90')));_0xc48b6+=0x1;_0x3f1cbb[_0x2eb2('0x91')](new Extension(_0x2df15d,_0xc48b6,_0x2eb2('0x92'),_0x2eb2('0x93')));_0xc48b6+=0x1;for(var _0x2ad26e in _0x2df15d){if(_0x2df15d[_0x2eb2('0x4f')](_0x2ad26e)&&(_0x2ad26e===_0x2eb2('0x94')||_0x2ad26e===_0x2eb2('0x8c')||_0x2ad26e===_0x2eb2('0x95')||_0x2ad26e==='faxdetect'||_0x2ad26e===_0x2eb2('0x96')||_0x2ad26e===_0x2eb2('0x97')||_0x2ad26e===_0x2eb2('0x98')||_0x2ad26e===_0x2eb2('0x99')||_0x2ad26e===_0x2eb2('0x9a'))){_0x3f1cbb[_0x2eb2('0x91')](new Extension(_0x2df15d,_0xc48b6,_0x2eb2('0x9b')+_0x2ad26e+')='+_0x2df15d[_0x2ad26e],_0x2eb2('0x93')));_0xc48b6+=0x1;}}_0x3f1cbb[_0x2eb2('0x91')](new Extension(_0x2df15d,_0xc48b6,'6',_0x2eb2('0x9c')));_0xc48b6+=0x1;_0x3f1cbb[_0x2eb2('0x91')](new Extension(_0x2df15d,_0xc48b6,_0x2eb2('0x9d'),_0x2eb2('0x9e')));_0xc48b6=0x0;return _0x3f1cbb;}exports[_0x2eb2('0x9f')]=function(_0x259e11,_0x8affd9,_0x278cb2){var _0x4e1ca3;return db['sequelize'][_0x2eb2('0x7f')](function(_0x13239e){return db['FaxAccount']['create'](_0x259e11[_0x2eb2('0x5c')],{'transaction':_0x13239e})[_0x2eb2('0x20')](function(_0x597ddc){_0x4e1ca3=_0x597ddc[_0x2eb2('0x38')]({'plain':!![]});return db['VoiceExtension'][_0x2eb2('0x84')](createExtensionsReciveFax(_0x4e1ca3),{'transaction':_0x13239e});});})[_0x2eb2('0x20')](function(){return _0x4e1ca3;})[_0x2eb2('0x20')](respondWithResult(_0x8affd9,null))['catch'](handleError(_0x8affd9,null));};exports[_0x2eb2('0xa0')]=function(_0x1cdb35,_0x408315,_0x3cf33c){var _0x3de572;return db[_0x2eb2('0x7e')][_0x2eb2('0x7f')](function(_0x4c8d3c){return db[_0x2eb2('0x43')]['update'](_0x1cdb35[_0x2eb2('0x5c')],{'where':{'id':_0x1cdb35['body']['id']},'transaction':_0x4c8d3c})['then'](function(_0x455d94){return db[_0x2eb2('0xa1')]['destroy']({'where':{'FaxAccountId':_0x1cdb35[_0x2eb2('0x5c')]['id']},'transaction':_0x4c8d3c})[_0x2eb2('0x20')](function(_0x451e0d){return db['VoiceExtension'][_0x2eb2('0x84')](createExtensionsReciveFax(_[_0x2eb2('0x74')](_0x1cdb35[_0x2eb2('0x5c')],[_0x2eb2('0xa2'),'key','createdAt',_0x2eb2('0xa3'),'TrunkId','ListId'])),{'transaction':_0x4c8d3c});});});})[_0x2eb2('0x20')](function(){return db['FaxAccount'][_0x2eb2('0xa4')](_0x1cdb35[_0x2eb2('0x5c')]['id']);})[_0x2eb2('0x20')](respondWithResult(_0x408315,null))[_0x2eb2('0x2b')](handleError(_0x408315,null));};exports[_0x2eb2('0xa5')]=function(_0x5f4ab2,_0x57a11e,_0x434584){var _0x3b371c={'raw':!![],'where':{}};var _0x38ef45={};var _0xf47288={'count':0x0,'rows':[]};return db[_0x2eb2('0x43')][_0x2eb2('0x68')]({'where':{'id':_0x5f4ab2[_0x2eb2('0x62')]['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x57a11e,null))[_0x2eb2('0x20')](function(_0x44fcbd){if(_0x44fcbd){_0x38ef45[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db[_0x2eb2('0xa6')]['rawAttributes']);_0x38ef45['query']=_[_0x2eb2('0x4a')](_0x5f4ab2[_0x2eb2('0x49')]);_0x38ef45[_0x2eb2('0x4b')]=_[_0x2eb2('0x4c')](_0x38ef45[_0x2eb2('0x48')],_0x38ef45[_0x2eb2('0x49')]);_0x3b371c[_0x2eb2('0x4e')]=_[_0x2eb2('0x4c')](_0x38ef45['model'],qs[_0x2eb2('0x4d')](_0x5f4ab2[_0x2eb2('0x49')]['fields']));_0x3b371c[_0x2eb2('0x4e')]=_0x3b371c[_0x2eb2('0x4e')][_0x2eb2('0x59')]?_0x3b371c['attributes']:_0x38ef45[_0x2eb2('0x48')];if(!_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x4f')](_0x2eb2('0x69'))){_0x3b371c['limit']=qs[_0x2eb2('0x32')](_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x32')]);_0x3b371c[_0x2eb2('0x30')]=qs[_0x2eb2('0x30')](_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x30')]);}_0x3b371c[_0x2eb2('0x6a')]=qs[_0x2eb2('0x50')](_0x5f4ab2[_0x2eb2('0x49')]['sort']);_0x3b371c[_0x2eb2('0x51')]=qs[_0x2eb2('0x4b')](_['pick'](_0x5f4ab2['query'],_0x38ef45['filters']));_0x3b371c[_0x2eb2('0x51')][_0x2eb2('0x65')]=_0x44fcbd['id'];if(_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x3b371c[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0x3b371c['where'],{'$or':_[_0x2eb2('0x42')](_0x3b371c[_0x2eb2('0x4e')],function(_0x47f7e2){var _0x2d0b71={};_0x2d0b71[_0x47f7e2]={'$like':'%'+_0x5f4ab2['query'][_0x2eb2('0x54')]+'%'};return _0x2d0b71;})});}if(_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0xa7')]){var _0x26b1a7=_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0xa7')][_0x2eb2('0xa8')](',');var _0x157831={};_0x157831[_0x26b1a7[0x0]]={'$gte':moment(_0x26b1a7[0x1])[_0x2eb2('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3b371c[_0x2eb2('0x51')]=_[_0x2eb2('0x52')](_0x3b371c[_0x2eb2('0x51')],_0x157831);}_0x3b371c=_[_0x2eb2('0x52')]({},_0x3b371c,_0x5f4ab2[_0x2eb2('0x55')]);return db[_0x2eb2('0xa6')][_0x2eb2('0x56')]({'where':_0x3b371c[_0x2eb2('0x51')]})[_0x2eb2('0x20')](function(_0x573012){_0xf47288[_0x2eb2('0x56')]=_0x573012;if(_0x5f4ab2[_0x2eb2('0x49')][_0x2eb2('0x57')]){_0x3b371c['include']=[{'all':!![]}];}return db['FaxMessage'][_0x2eb2('0x58')](_0x3b371c);})[_0x2eb2('0x20')](function(_0x445316){_0xf47288[_0x2eb2('0x6c')]=_0x445316;return _0xf47288;});}})[_0x2eb2('0x20')](respondWithFilteredResult(_0x57a11e,_0x3b371c))['catch'](handleError(_0x57a11e,null));};exports['send']=function(_0x22e7a6,_0xc8592d,_0x138237){var _0x11fda8,_0x4ab600={},_0x210157;if(_0x22e7a6['body']['to']){_0x210157=_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0];}return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x22e7a6['params']['id']},'include':[{'model':db[_0x2eb2('0xaa')],'as':_0x2eb2('0xab'),'include':[{'model':db['CmContact'],'as':_0x2eb2('0xac'),'where':{'fax':_0x210157},'limit':0x1,'order':[[_0x2eb2('0xa3'),'DESC']]}]}]})[_0x2eb2('0x20')](handleEntityNotFound(_0xc8592d,null))[_0x2eb2('0x20')](function(_0xe9d09f){_0x11fda8=_0xe9d09f;if(_0x22e7a6[_0x2eb2('0x5c')]['attachments']&&_0x22e7a6[_0x2eb2('0x5c')]['attachments']['length']){for(var _0x3316fd=0x0;_0x3316fd<_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')]['length'];_0x3316fd+=0x1){_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][_0x3316fd]={'filename':_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][_0x3316fd][_0x2eb2('0x3d')],'id':_0x22e7a6['body'][_0x2eb2('0xad')][_0x3316fd]['id'],'path':path[_0x2eb2('0xae')](config[_0x2eb2('0xaf')],'server/files/attachments',_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][_0x3316fd][_0x2eb2('0xb0')])};}}return respondWithRpcPromise(_0x2eb2('0xb1'),_0x2eb2('0xb1'),{'FaxAccountId':_[_0x2eb2('0xb2')](_0x22e7a6['params']['id'])?undefined:_0x22e7a6[_0x2eb2('0x62')]['id'],'path':_[_0x2eb2('0xb2')](_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0][_0x2eb2('0x7')])?undefined:_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0][_0x2eb2('0x7')],'fax':_[_0x2eb2('0xb2')](_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0])?undefined:_0x22e7a6['body']['to'][0x0]},client9002);})[_0x2eb2('0x20')](function(){if(_0x11fda8){if(_[_0x2eb2('0xb2')](_0x22e7a6[_0x2eb2('0x5c')]['from'])){_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xb3')]=util[_0x2eb2('0xa9')](_0x2eb2('0xb4'),_0x11fda8[_0x2eb2('0x3d')],_0x11fda8[_0x2eb2('0xb5')]);}if(_0x11fda8['List']){if(_0x11fda8['List'][_0x2eb2('0xac')]['length']){return _0x11fda8[_0x2eb2('0xab')][_0x2eb2('0xac')][0x0];}else{return db[_0x2eb2('0x76')][_0x2eb2('0x5b')](_[_0x2eb2('0x1a')](_0x22e7a6[_0x2eb2('0x5c')],{'firstName':_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0],'phone':_0x22e7a6['body']['to'][0x0],'fax':_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0],'ListId':_0x11fda8[_0x2eb2('0xb6')]}));}}else{throw new Error(_0x2eb2('0xb7'));}}else{throw new Error(_0x2eb2('0xb8'));}})['then'](function(_0x4dc36d){if(_0x4dc36d){return db['FaxInteraction'][_0x2eb2('0x5a')]({'where':{'ContactId':_0x4dc36d['id'],'closed':![],'FaxAccountId':_0x11fda8['id']}})[_0x2eb2('0x20')](function(_0x4a9816){if(_0x4a9816){return[_0x4a9816,![]];}return db[_0x2eb2('0x72')][_0x2eb2('0x5b')]({'UserId':_0x22e7a6[_0x2eb2('0xb9')]['id'],'ContactId':_0x4dc36d['id'],'FaxAccountId':_0x11fda8['id'],'fax':_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x22e7a6[_0x2eb2('0x5c')],{'read':![],'body':_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0][_0x2eb2('0xba')],'FaxAccountId':_0x11fda8['id'],'UserId':_0x22e7a6['user']['id'],'ContactId':_0x4dc36d['id'],'AttachmentId':_0x22e7a6['body'][_0x2eb2('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x2eb2('0xbb')}]})[_0x2eb2('0x20')](function(_0x21f061){return[_0x21f061,!![]];});});}else{throw new Error(_0x2eb2('0xbc'));}})['spread'](function(_0x6a2f6e,_0x395594){if(_0x395594){return _0x6a2f6e;}return db['FaxMessage'][_0x2eb2('0x5b')]({'direction':_0x2eb2('0xbd'),'read':![],'body':_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0][_0x2eb2('0xba')],'FaxAccountId':_0x11fda8['id'],'FaxInteractionId':_0x6a2f6e['id'],'UserId':_0x22e7a6[_0x2eb2('0xb9')]['id'],'ContactId':_0x6a2f6e['ContactId'],'AttachmentId':_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0]['id']})['then'](function(_0x1a5762){_0x6a2f6e[_0x2eb2('0xbe')][_0x2eb2('0xbb')]=[];_0x6a2f6e[_0x2eb2('0xbe')][_0x2eb2('0xbb')]['push'](_0x1a5762[_0x2eb2('0xbe')]);return _0x6a2f6e;});})[_0x2eb2('0x20')](function(_0x39b05c){respondWithRpcPromise('SendFax',_0x2eb2('0xbf'),{'FaxAccountId':_['isNil'](_0x22e7a6[_0x2eb2('0x62')]['id'])?undefined:_0x22e7a6['params']['id'],'path':_['isNil'](_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0]['path'])?undefined:_0x22e7a6[_0x2eb2('0x5c')][_0x2eb2('0xad')][0x0]['path'],'fax':_[_0x2eb2('0xb2')](_0x22e7a6[_0x2eb2('0x5c')]['to'][0x0])?undefined:_0x22e7a6['body']['to'][0x0],'AttachmentId':_0x22e7a6[_0x2eb2('0x5c')]['attachments'][0x0]['id']},client9002)['then'](function(_0x1a5c3a){logger[_0x2eb2('0x21')]('SendFaxRpc,\x20%s',_0x1a5c3a);})[_0x2eb2('0x2b')](function(_0x2a1363){logger['info']('SendFaxRpc,\x20%s',_0x2a1363);});return _0x39b05c;})['then'](respondWithResult(_0xc8592d,null))[_0x2eb2('0x2b')](handleError(_0xc8592d,null));};exports[_0x2eb2('0xc0')]=function(_0x4b9698,_0x2eb74a,_0x55b0d5){return db['FaxAccount'][_0x2eb2('0x5a')]({'where':{'id':_0x4b9698['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x2eb74a,null))[_0x2eb2('0x20')](function(_0x311fc9){if(_0x311fc9){return _0x311fc9['addAgents'](_0x4b9698[_0x2eb2('0x5c')]['ids'],_['omit'](_0x4b9698[_0x2eb2('0x5c')],[_0x2eb2('0x6e'),'id'])||{})[_0x2eb2('0xc1')](function(_0x4c77ef){for(var _0x74e3e4=0x0;_0x74e3e4<_0x4b9698[_0x2eb2('0x5c')][_0x2eb2('0x6e')][_0x2eb2('0x59')];_0x74e3e4+=0x1){socket['emit'](_0x2eb2('0xc2'),{'UserId':Number(_0x4b9698[_0x2eb2('0x5c')]['ids'][_0x74e3e4]),'FaxAccountId':Number(_0x4b9698[_0x2eb2('0x62')]['id'])});}return _0x4c77ef;});}})[_0x2eb2('0x20')](respondWithResult(_0x2eb74a,null))[_0x2eb2('0x2b')](handleError(_0x2eb74a,null));};exports[_0x2eb2('0xc3')]=function(_0x20bbf4,_0x5e398f,_0x6f4356){return db[_0x2eb2('0x43')][_0x2eb2('0x5a')]({'where':{'id':_0x20bbf4['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x5e398f,null))[_0x2eb2('0x20')](function(_0x1eaeb4){if(_0x1eaeb4){return _0x1eaeb4[_0x2eb2('0xc3')](_0x20bbf4[_0x2eb2('0x49')][_0x2eb2('0x6e')])[_0x2eb2('0x20')](function(){if(_[_0x2eb2('0xc4')](_0x20bbf4['query'][_0x2eb2('0x6e')])){for(var _0x55fea3=0x0;_0x55fea3<_0x20bbf4[_0x2eb2('0x49')][_0x2eb2('0x6e')][_0x2eb2('0x59')];_0x55fea3+=0x1){socket[_0x2eb2('0xc5')](_0x2eb2('0xc6'),{'UserId':Number(_0x20bbf4['query'][_0x2eb2('0x6e')][_0x55fea3]),'FaxAccountId':Number(_0x20bbf4[_0x2eb2('0x62')]['id'])});}}else{socket[_0x2eb2('0xc5')](_0x2eb2('0xc6'),{'UserId':Number(_0x20bbf4[_0x2eb2('0x49')][_0x2eb2('0x6e')]),'FaxAccountId':Number(_0x20bbf4['params']['id'])});}});}})[_0x2eb2('0x20')](respondWithStatusCode(_0x5e398f,null))['catch'](handleError(_0x5e398f,null));};exports[_0x2eb2('0xc7')]=function(_0x1c2204,_0x48c04f,_0x44b3bd){var _0x141511={};var _0x5a1284={};var _0x23f47e;var _0x1d7320;return db['FaxAccount']['findOne']({'where':{'id':_0x1c2204['params']['id']}})[_0x2eb2('0x20')](handleEntityNotFound(_0x48c04f,null))[_0x2eb2('0x20')](function(_0x3e7c2a){if(_0x3e7c2a){_0x23f47e=_0x3e7c2a;_0x5a1284[_0x2eb2('0x48')]=_[_0x2eb2('0x4a')](db['User'][_0x2eb2('0x44')]);_0x5a1284[_0x2eb2('0x49')]=_[_0x2eb2('0x4a')](_0x1c2204['query']);_0x5a1284['filters']=_[_0x2eb2('0x4c')](_0x5a1284[_0x2eb2('0x48')],_0x5a1284[_0x2eb2('0x49')]);_0x141511['attributes']=_[_0x2eb2('0x4c')](_0x5a1284[_0x2eb2('0x48')],qs['fields'](_0x1c2204[_0x2eb2('0x49')][_0x2eb2('0x4d')]));_0x141511['attributes']=_0x141511['attributes'][_0x2eb2('0x59')]?_0x141511[_0x2eb2('0x4e')]:_0x5a1284['model'];_0x141511[_0x2eb2('0x6a')]=qs[_0x2eb2('0x50')](_0x1c2204[_0x2eb2('0x49')][_0x2eb2('0x50')]);_0x141511[_0x2eb2('0x51')]=qs['filters'](_[_0x2eb2('0xc8')](_0x1c2204['query'],_0x5a1284[_0x2eb2('0x4b')]));if(_0x1c2204[_0x2eb2('0x49')][_0x2eb2('0x54')]){_0x141511[_0x2eb2('0x51')]=_['merge'](_0x141511[_0x2eb2('0x51')],{'$or':_[_0x2eb2('0x42')](_0x141511['attributes'],function(_0x3398ef){var _0x17d1ea={};_0x17d1ea[_0x3398ef]={'$like':'%'+_0x1c2204['query'][_0x2eb2('0x54')]+'%'};return _0x17d1ea;})});}_0x141511=_['merge']({},_0x141511,_0x1c2204[_0x2eb2('0x55')]);return _0x23f47e[_0x2eb2('0xc7')](_0x141511);}})['then'](function(_0x420105){if(_0x420105){_0x1d7320=_0x420105[_0x2eb2('0x59')];if(!_0x1c2204['query']['hasOwnProperty'](_0x2eb2('0x69'))){_0x141511['limit']=qs[_0x2eb2('0x32')](_0x1c2204[_0x2eb2('0x49')]['limit']);_0x141511[_0x2eb2('0x30')]=qs[_0x2eb2('0x30')](_0x1c2204['query'][_0x2eb2('0x30')]);}return _0x23f47e[_0x2eb2('0xc7')](_0x141511);}})[_0x2eb2('0x20')](function(_0x4cf5a9){if(_0x4cf5a9){return _0x4cf5a9?{'count':_0x1d7320,'rows':_0x4cf5a9}:null;}})[_0x2eb2('0x20')](respondWithResult(_0x48c04f,null))[_0x2eb2('0x2b')](handleError(_0x48c04f,null));}; \ No newline at end of file +var _0x5e12=['defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','get','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId','Disposition','getDispositions','findOne','order','sort','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','getInteractions','FaxInteraction','Owner','fullname','internal','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','system','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','maxrate','minrate','modem','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','updateAccountApplications','VoiceExtension','omit','tech','key','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmContact','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','List','ListId','Send\x20Fax\x20failed','out','filename','ContactId','dataValues','Messages','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5e12,0x173));var _0x25e1=function(_0x49f1ab,_0x2e925c){_0x49f1ab=_0x49f1ab-0x0;var _0x1b2d97=_0x5e12[_0x49f1ab];return _0x1b2d97;};'use strict';var emlformat=require(_0x25e1('0x0'));var rimraf=require(_0x25e1('0x1'));var zipdir=require(_0x25e1('0x2'));var jsonpatch=require(_0x25e1('0x3'));var rp=require(_0x25e1('0x4'));var moment=require(_0x25e1('0x5'));var BPromise=require(_0x25e1('0x6'));var Mustache=require(_0x25e1('0x7'));var util=require(_0x25e1('0x8'));var path=require(_0x25e1('0x9'));var sox=require(_0x25e1('0xa'));var csv=require('to-csv');var ejs=require(_0x25e1('0xb'));var fs=require('fs');var fs_extra=require(_0x25e1('0xc'));var _=require(_0x25e1('0xd'));var squel=require(_0x25e1('0xe'));var crypto=require(_0x25e1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25e1('0x10'));var Papa=require(_0x25e1('0x11'));var Redis=require(_0x25e1('0x12'));var authService=require(_0x25e1('0x13'));var qs=require(_0x25e1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25e1('0x15'));var logger=require(_0x25e1('0x16'))(_0x25e1('0x17'));var utils=require(_0x25e1('0x18'));var config=require(_0x25e1('0x19'));var licenseUtil=require(_0x25e1('0x1a'));var db=require(_0x25e1('0x1b'))['db'];config[_0x25e1('0x1c')]=_[_0x25e1('0x1d')](config[_0x25e1('0x1c')],{'host':_0x25e1('0x1e'),'port':0x18eb});var socket=require(_0x25e1('0x1f'))(new Redis(config[_0x25e1('0x1c')]));require(_0x25e1('0x20'))[_0x25e1('0x21')](socket);var jayson=require(_0x25e1('0x22'));var client=jayson['client'][_0x25e1('0x23')]({'port':0x232c});var client9002=jayson[_0x25e1('0x24')][_0x25e1('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x40b6ef,_0x3cfa65,_0x400041,_0xf01e2f){return new BPromise(function(_0xcc7ae1,_0x4a3136){var _0x44d85f=_0xf01e2f||client;return _0x44d85f[_0x25e1('0x25')](_0x40b6ef,_0x400041)['then'](function(_0x478a74){logger[_0x25e1('0x26')](_0x25e1('0x27'),_0x3cfa65,_0x25e1('0x28'));logger[_0x25e1('0x29')](_0x25e1('0x2a'),_0x3cfa65,_0x25e1('0x28'),JSON['stringify'](_0x478a74));if(_0x478a74[_0x25e1('0x2b')]){if(_0x478a74[_0x25e1('0x2b')][_0x25e1('0x2c')]===0x1f4){logger[_0x25e1('0x2b')](_0x25e1('0x27'),_0x3cfa65,_0x478a74[_0x25e1('0x2b')][_0x25e1('0x2d')]);return _0x4a3136(_0x478a74[_0x25e1('0x2b')]['message']);}logger['error'](_0x25e1('0x27'),_0x3cfa65,_0x478a74[_0x25e1('0x2b')][_0x25e1('0x2d')]);return _0xcc7ae1(_0x478a74[_0x25e1('0x2b')][_0x25e1('0x2d')]);}else{logger['info'](_0x25e1('0x27'),_0x3cfa65,_0x25e1('0x28'));_0xcc7ae1(_0x478a74[_0x25e1('0x2e')]['message']);}})[_0x25e1('0x2f')](function(_0x3c0e05){logger['error'](_0x25e1('0x27'),_0x3cfa65,_0x3c0e05);_0x4a3136(_0x3c0e05);});});}function respondWithStatusCode(_0x40a213,_0x57ff4f){_0x57ff4f=_0x57ff4f||0xcc;return function(_0x3e3c23){if(_0x3e3c23){return _0x40a213['sendStatus'](_0x57ff4f);}return _0x40a213['status'](_0x57ff4f)['end']();};}function respondWithResult(_0x1ec349,_0x200d6c){_0x200d6c=_0x200d6c||0xc8;return function(_0x25bef5){if(_0x25bef5){return _0x1ec349[_0x25e1('0x30')](_0x200d6c)[_0x25e1('0x31')](_0x25bef5);}};}function respondWithFilteredResult(_0x5645df,_0xd4b143){return function(_0x3e3ed6){if(_0x3e3ed6){var _0xe25bed=typeof _0xd4b143[_0x25e1('0x32')]===_0x25e1('0x33')&&typeof _0xd4b143[_0x25e1('0x34')]===_0x25e1('0x33');var _0x1230a4=_0x3e3ed6[_0x25e1('0x35')];var _0x3b8b43=_0xe25bed?0x0:_0xd4b143[_0x25e1('0x32')];var _0x4d6acc=_0xe25bed?_0x3e3ed6[_0x25e1('0x35')]:_0xd4b143[_0x25e1('0x32')]+_0xd4b143[_0x25e1('0x34')];var _0x3c2326;if(_0x4d6acc>=_0x1230a4){_0x4d6acc=_0x1230a4;_0x3c2326=0xc8;}else{_0x3c2326=0xce;}_0x5645df[_0x25e1('0x30')](_0x3c2326);return _0x5645df[_0x25e1('0x36')](_0x25e1('0x37'),_0x3b8b43+'-'+_0x4d6acc+'/'+_0x1230a4)[_0x25e1('0x31')](_0x3e3ed6);}return null;};}function patchUpdates(_0x10b1f5){return function(_0x12d5ca){try{jsonpatch['apply'](_0x12d5ca,_0x10b1f5,!![]);}catch(_0xc4c8c3){return BPromise[_0x25e1('0x38')](_0xc4c8c3);}return _0x12d5ca['save']();};}function saveUpdates(_0x2f94f0,_0x509a79){return function(_0x475b56){if(_0x475b56){return _0x475b56[_0x25e1('0x39')](_0x2f94f0)['then'](function(_0x201806){return _0x201806;});}return null;};}function removeEntity(_0x547771,_0x44d681){return function(_0x316328){if(_0x316328){return _0x316328[_0x25e1('0x3a')]()[_0x25e1('0x3b')](function(){var _0x3d39b3=_0x316328[_0x25e1('0x3c')]({'plain':!![]});var _0x487868='FaxAccounts';return db[_0x25e1('0x3d')]['destroy']({'where':{'type':_0x487868,'resourceId':_0x3d39b3['id']}})[_0x25e1('0x3b')](function(){return _0x316328;});})[_0x25e1('0x3b')](function(){_0x547771[_0x25e1('0x30')](0xcc)[_0x25e1('0x3e')]();});}};}function handleEntityNotFound(_0x5b3e8d,_0x5e2f1d){return function(_0x1f6050){if(!_0x1f6050){_0x5b3e8d[_0x25e1('0x3f')](0x194);}return _0x1f6050;};}function handleError(_0x8c1452,_0xec57bf){_0xec57bf=_0xec57bf||0x1f4;return function(_0x3a381c){logger['error'](_0x3a381c[_0x25e1('0x40')]);if(_0x3a381c['name']){delete _0x3a381c[_0x25e1('0x41')];}_0x8c1452[_0x25e1('0x30')](_0xec57bf)[_0x25e1('0x42')](_0x3a381c);};}exports[_0x25e1('0x43')]=function(_0x5ac689,_0x4e4413){var _0x492989={'include':[{'model':db[_0x25e1('0x44')],'as':_0x25e1('0x45')}]},_0x36d44a={},_0x488ef9={'count':0x0,'rows':[]};var _0x41d561=_[_0x25e1('0x46')](db[_0x25e1('0x47')][_0x25e1('0x48')],function(_0x48b4f8){return{'name':_0x48b4f8[_0x25e1('0x49')],'type':_0x48b4f8[_0x25e1('0x4a')]['key']};});_0x36d44a['model']=_[_0x25e1('0x46')](_0x41d561,_0x25e1('0x41'));_0x36d44a[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x5ac689['query']);_0x36d44a[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x36d44a[_0x25e1('0x4f')],_0x36d44a['query']);_0x492989[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x36d44a[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x492989[_0x25e1('0x50')]=_0x492989[_0x25e1('0x50')][_0x25e1('0x52')]?_0x492989[_0x25e1('0x50')]:_0x36d44a[_0x25e1('0x4f')];if(!_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x53')](_0x25e1('0x54'))){_0x492989[_0x25e1('0x34')]=qs['limit'](_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x34')]);_0x492989[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x32')]);}_0x492989['order']=qs['sort'](_0x5ac689[_0x25e1('0x4b')]['sort']);_0x492989[_0x25e1('0x55')]=qs['filters'](_[_0x25e1('0x56')](_0x5ac689[_0x25e1('0x4b')],_0x36d44a[_0x25e1('0x4d')]),_0x41d561);if(_0x5ac689[_0x25e1('0x4b')]['filter']){_0x492989['where']=_[_0x25e1('0x57')](_0x492989[_0x25e1('0x55')],{'$or':_['map'](_0x41d561,function(_0x3935bc){if(_0x3935bc['type']!==_0x25e1('0x58')){var _0x562524={};_0x562524[_0x3935bc['name']]={'$like':'%'+_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x59')]+'%'};return _0x562524;}})});}_0x492989=_[_0x25e1('0x57')]({},_0x492989,_0x5ac689[_0x25e1('0x5a')]);var _0x41d55a={'where':_0x492989[_0x25e1('0x55')]};return db['FaxAccount']['count'](_0x41d55a)[_0x25e1('0x3b')](function(_0x2e8bb5){_0x488ef9[_0x25e1('0x35')]=_0x2e8bb5;if(_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x5b')]){_0x492989[_0x25e1('0x5c')]=[{'all':!![]}];}return db[_0x25e1('0x47')][_0x25e1('0x5d')](_0x492989);})[_0x25e1('0x3b')](function(_0x30b181){_0x488ef9[_0x25e1('0x5e')]=_0x30b181;return _0x488ef9;})[_0x25e1('0x3b')](respondWithFilteredResult(_0x4e4413,_0x492989))[_0x25e1('0x2f')](handleError(_0x4e4413,null));};exports[_0x25e1('0x5f')]=function(_0x34708e,_0x20c714){var _0x5e52d5={'raw':![],'where':{'id':_0x34708e[_0x25e1('0x60')]['id']},'include':[{'model':db[_0x25e1('0x44')],'as':_0x25e1('0x45')}]},_0x1b7c61={};_0x1b7c61[_0x25e1('0x4f')]=_['keys'](db['FaxAccount'][_0x25e1('0x48')]);_0x1b7c61[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x34708e[_0x25e1('0x4b')]);_0x1b7c61[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x1b7c61[_0x25e1('0x4f')],_0x1b7c61['query']);_0x5e52d5[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x1b7c61[_0x25e1('0x4f')],qs['fields'](_0x34708e['query'][_0x25e1('0x51')]));_0x5e52d5['attributes']=_0x5e52d5['attributes'][_0x25e1('0x52')]?_0x5e52d5['attributes']:_0x1b7c61['model'];if(_0x34708e[_0x25e1('0x4b')][_0x25e1('0x5b')]){_0x5e52d5['include']=[{'all':!![]}];}_0x5e52d5=_[_0x25e1('0x57')]({},_0x5e52d5,_0x34708e[_0x25e1('0x5a')]);return db[_0x25e1('0x47')][_0x25e1('0x61')](_0x5e52d5)[_0x25e1('0x3b')](handleEntityNotFound(_0x20c714,null))[_0x25e1('0x3b')](respondWithResult(_0x20c714,null))['catch'](handleError(_0x20c714,null));};exports['create']=function(_0xcb2450,_0x4cd1c1){return db['FaxAccount'][_0x25e1('0x62')](_0xcb2450['body'],{})[_0x25e1('0x3b')](function(_0x2bdd32){var _0x231b77=_0xcb2450[_0x25e1('0x63')][_0x25e1('0x3c')]({'plain':!![]});if(!_0x231b77)throw new Error(_0x25e1('0x64'));if(_0x231b77[_0x25e1('0x65')]===_0x25e1('0x63')){var _0x38ff19=_0x2bdd32[_0x25e1('0x3c')]({'plain':!![]});var _0x4ac9fc=_0x25e1('0x66');return db['UserProfileSection'][_0x25e1('0x61')]({'where':{'name':_0x4ac9fc,'userProfileId':_0x231b77['userProfileId']},'raw':!![]})[_0x25e1('0x3b')](function(_0x4f099f){if(_0x4f099f&&_0x4f099f[_0x25e1('0x67')]===0x0){return db[_0x25e1('0x3d')][_0x25e1('0x62')]({'name':_0x38ff19[_0x25e1('0x41')],'resourceId':_0x38ff19['id'],'type':_0x4f099f[_0x25e1('0x41')],'sectionId':_0x4f099f['id']},{})[_0x25e1('0x3b')](function(){return _0x2bdd32;});}else{return _0x2bdd32;}})[_0x25e1('0x2f')](function(_0x9f62dd){logger['error'](_0x25e1('0x68'),_0x9f62dd);throw _0x9f62dd;});}return _0x2bdd32;})[_0x25e1('0x3b')](respondWithResult(_0x4cd1c1,0xc9))['catch'](handleError(_0x4cd1c1,null));};exports[_0x25e1('0x39')]=function(_0xc9a5ab,_0x5400c9){if(_0xc9a5ab['body']['id']){delete _0xc9a5ab['body']['id'];}return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0xc9a5ab[_0x25e1('0x60')]['id']},'include':[{'model':db[_0x25e1('0x44')],'as':_0x25e1('0x45')}]})['then'](handleEntityNotFound(_0x5400c9,null))[_0x25e1('0x3b')](saveUpdates(_0xc9a5ab[_0x25e1('0x69')],null))[_0x25e1('0x3b')](respondWithResult(_0x5400c9,null))[_0x25e1('0x2f')](handleError(_0x5400c9,null));};exports[_0x25e1('0x3a')]=function(_0x5ba35b,_0x21d339){return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x5ba35b['params']['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x21d339,null))['then'](removeEntity(_0x21d339,null))['catch'](handleError(_0x21d339,null));};exports['describe']=function(_0x342aa8,_0x39fb42){return db['FaxAccount'][_0x25e1('0x6a')]()[_0x25e1('0x3b')](respondWithResult(_0x39fb42,null))[_0x25e1('0x2f')](handleError(_0x39fb42,null));};exports['addDisposition']=function(_0x39db6d,_0x58d323,_0x5f4eae){if(_0x39db6d[_0x25e1('0x69')]['id']){delete _0x39db6d[_0x25e1('0x69')]['id'];}return db[_0x25e1('0x47')]['find']({'where':{'id':_0x39db6d[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x58d323,null))[_0x25e1('0x3b')](function(_0x2bddef){if(_0x2bddef){_0x39db6d[_0x25e1('0x69')][_0x25e1('0x6b')]=_0x2bddef['id'];return db[_0x25e1('0x6c')]['create'](_0x39db6d['body']);}})['then'](respondWithResult(_0x58d323,null))[_0x25e1('0x2f')](handleError(_0x58d323,null));};exports[_0x25e1('0x6d')]=function(_0x1fd33b,_0x3cc99b,_0x5de520){var _0x247c0d={'raw':![],'where':{}};var _0x5cef35={};var _0x22e702={'count':0x0,'rows':[]};return db['FaxAccount'][_0x25e1('0x6e')]({'where':{'id':_0x1fd33b[_0x25e1('0x60')]['id']}})['then'](handleEntityNotFound(_0x3cc99b,null))['then'](function(_0x70ff40){if(_0x70ff40){_0x5cef35[_0x25e1('0x4f')]=_['keys'](db['Disposition'][_0x25e1('0x48')]);_0x5cef35[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x1fd33b[_0x25e1('0x4b')]);_0x5cef35['filters']=_[_0x25e1('0x4e')](_0x5cef35['model'],_0x5cef35[_0x25e1('0x4b')]);_0x247c0d['attributes']=_['intersection'](_0x5cef35[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x1fd33b[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x247c0d[_0x25e1('0x50')]=_0x247c0d['attributes']['length']?_0x247c0d['attributes']:_0x5cef35['model'];if(!_0x1fd33b[_0x25e1('0x4b')][_0x25e1('0x53')](_0x25e1('0x54'))){_0x247c0d[_0x25e1('0x34')]=qs[_0x25e1('0x34')](_0x1fd33b['query'][_0x25e1('0x34')]);_0x247c0d['offset']=qs[_0x25e1('0x32')](_0x1fd33b[_0x25e1('0x4b')]['offset']);}_0x247c0d[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x1fd33b[_0x25e1('0x4b')][_0x25e1('0x70')]);_0x247c0d['where']=qs['filters'](_['pick'](_0x1fd33b[_0x25e1('0x4b')],_0x5cef35[_0x25e1('0x4d')]));_0x247c0d['where'][_0x25e1('0x6b')]=_0x70ff40['id'];if(_0x1fd33b[_0x25e1('0x4b')]['filter']){_0x247c0d['where']=_[_0x25e1('0x57')](_0x247c0d[_0x25e1('0x55')],{'$or':_[_0x25e1('0x46')](_0x247c0d[_0x25e1('0x50')],function(_0xb31901){var _0x470965={};_0x470965[_0xb31901]={'$like':'%'+_0x1fd33b['query']['filter']+'%'};return _0x470965;})});}_0x247c0d=_['merge']({},_0x247c0d,_0x1fd33b[_0x25e1('0x5a')]);return db[_0x25e1('0x6c')]['count']({'where':_0x247c0d['where']})[_0x25e1('0x3b')](function(_0x4d85a7){_0x22e702['count']=_0x4d85a7;if(_0x1fd33b[_0x25e1('0x4b')]['includeAll']){_0x247c0d['include']=[{'all':!![]}];}return db['Disposition'][_0x25e1('0x5d')](_0x247c0d);})[_0x25e1('0x3b')](function(_0x59598a){_0x22e702[_0x25e1('0x5e')]=_0x59598a;return _0x22e702;});}})[_0x25e1('0x3b')](respondWithFilteredResult(_0x3cc99b,_0x247c0d))['catch'](handleError(_0x3cc99b,null));};exports[_0x25e1('0x71')]=function(_0x4fd48f,_0x365e7d,_0x3c3e0e){return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x4fd48f[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x365e7d,null))[_0x25e1('0x3b')](function(_0x26109b){if(_0x26109b){return _0x26109b[_0x25e1('0x71')](_0x4fd48f[_0x25e1('0x4b')][_0x25e1('0x72')]);}})[_0x25e1('0x3b')](respondWithStatusCode(_0x365e7d,null))[_0x25e1('0x2f')](handleError(_0x365e7d,null));};exports[_0x25e1('0x73')]=function(_0x2f5517,_0x1df684,_0x1a8165){if(_0x2f5517[_0x25e1('0x69')]['id']){delete _0x2f5517[_0x25e1('0x69')]['id'];}return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x2f5517['params']['id']}})['then'](handleEntityNotFound(_0x1df684,null))['then'](function(_0x390e7b){if(_0x390e7b){_0x2f5517[_0x25e1('0x69')][_0x25e1('0x6b')]=_0x390e7b['id'];return db['CannedAnswer'][_0x25e1('0x62')](_0x2f5517[_0x25e1('0x69')]);}})[_0x25e1('0x3b')](respondWithResult(_0x1df684,null))['catch'](handleError(_0x1df684,null));};exports[_0x25e1('0x74')]=function(_0x1b49a1,_0x3bafea,_0xff6a36){var _0xa225d4={'raw':![],'where':{}};var _0x14784a={};var _0x57f5c3={'count':0x0,'rows':[]};return db['FaxAccount'][_0x25e1('0x6e')]({'where':{'id':_0x1b49a1[_0x25e1('0x60')]['id']}})['then'](handleEntityNotFound(_0x3bafea,null))[_0x25e1('0x3b')](function(_0x127494){if(_0x127494){_0x14784a[_0x25e1('0x4f')]=_[_0x25e1('0x4c')](db[_0x25e1('0x75')][_0x25e1('0x48')]);_0x14784a[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x1b49a1[_0x25e1('0x4b')]);_0x14784a[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x14784a[_0x25e1('0x4f')],_0x14784a[_0x25e1('0x4b')]);_0xa225d4[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x14784a['model'],qs[_0x25e1('0x51')](_0x1b49a1[_0x25e1('0x4b')][_0x25e1('0x51')]));_0xa225d4[_0x25e1('0x50')]=_0xa225d4['attributes']['length']?_0xa225d4['attributes']:_0x14784a['model'];if(!_0x1b49a1[_0x25e1('0x4b')]['hasOwnProperty'](_0x25e1('0x54'))){_0xa225d4[_0x25e1('0x34')]=qs[_0x25e1('0x34')](_0x1b49a1[_0x25e1('0x4b')]['limit']);_0xa225d4[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x1b49a1['query'][_0x25e1('0x32')]);}_0xa225d4[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x1b49a1[_0x25e1('0x4b')]['sort']);_0xa225d4[_0x25e1('0x55')]=qs[_0x25e1('0x4d')](_[_0x25e1('0x56')](_0x1b49a1[_0x25e1('0x4b')],_0x14784a['filters']));_0xa225d4[_0x25e1('0x55')][_0x25e1('0x6b')]=_0x127494['id'];if(_0x1b49a1[_0x25e1('0x4b')]['filter']){_0xa225d4[_0x25e1('0x55')]=_[_0x25e1('0x57')](_0xa225d4[_0x25e1('0x55')],{'$or':_[_0x25e1('0x46')](_0xa225d4[_0x25e1('0x50')],function(_0x3f50c2){var _0x18f79b={};_0x18f79b[_0x3f50c2]={'$like':'%'+_0x1b49a1[_0x25e1('0x4b')][_0x25e1('0x59')]+'%'};return _0x18f79b;})});}_0xa225d4=_[_0x25e1('0x57')]({},_0xa225d4,_0x1b49a1[_0x25e1('0x5a')]);return db[_0x25e1('0x75')][_0x25e1('0x35')]({'where':_0xa225d4['where']})[_0x25e1('0x3b')](function(_0x47dbd5){_0x57f5c3[_0x25e1('0x35')]=_0x47dbd5;if(_0x1b49a1[_0x25e1('0x4b')][_0x25e1('0x5b')]){_0xa225d4[_0x25e1('0x5c')]=[{'all':!![]}];}return db[_0x25e1('0x75')][_0x25e1('0x5d')](_0xa225d4);})[_0x25e1('0x3b')](function(_0x859b7a){_0x57f5c3[_0x25e1('0x5e')]=_0x859b7a;return _0x57f5c3;});}})[_0x25e1('0x3b')](respondWithFilteredResult(_0x3bafea,_0xa225d4))[_0x25e1('0x2f')](handleError(_0x3bafea,null));};exports[_0x25e1('0x76')]=function(_0x33d57c,_0x4817ad,_0x58cb62){return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x33d57c[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x4817ad,null))[_0x25e1('0x3b')](function(_0x2d9ccf){if(_0x2d9ccf){return _0x2d9ccf[_0x25e1('0x76')](_0x33d57c[_0x25e1('0x4b')][_0x25e1('0x72')]);}})[_0x25e1('0x3b')](respondWithStatusCode(_0x4817ad,null))[_0x25e1('0x2f')](handleError(_0x4817ad,null));};exports[_0x25e1('0x77')]=function(_0x17710c,_0x346554,_0x176210){return db['FaxInteraction']['find']({'where':{'id':_0x17710c[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x346554,null))[_0x25e1('0x3b')](function(_0x4793fd){if(_0x4793fd){return _0x4793fd[_0x25e1('0x77')](_0x17710c[_0x25e1('0x69')][_0x25e1('0x72')],_['omit'](_0x17710c['body'],[_0x25e1('0x72'),'id'])||{});}})[_0x25e1('0x3b')](respondWithResult(_0x346554,null))['catch'](handleError(_0x346554,null));};exports[_0x25e1('0x78')]=function(_0x504fb8,_0x3c7dc8,_0x440627){var _0x4982ce={'raw':![],'where':{}};var _0x5b56df={};var _0x15f750={'count':0x0,'rows':[]};return db[_0x25e1('0x47')][_0x25e1('0x6e')]({'where':{'id':_0x504fb8['params']['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x3c7dc8,null))[_0x25e1('0x3b')](function(_0x17dc9f){if(_0x17dc9f){_0x5b56df[_0x25e1('0x4f')]=_[_0x25e1('0x4c')](db[_0x25e1('0x79')]['rawAttributes']);_0x5b56df['query']=_['keys'](_0x504fb8[_0x25e1('0x4b')]);_0x5b56df[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x5b56df[_0x25e1('0x4f')],_0x5b56df[_0x25e1('0x4b')]);_0x4982ce['attributes']=_[_0x25e1('0x4e')](_0x5b56df[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x4982ce[_0x25e1('0x50')]=_0x4982ce[_0x25e1('0x50')]['length']?_0x4982ce[_0x25e1('0x50')]:_0x5b56df[_0x25e1('0x4f')];if(!_0x504fb8['query'][_0x25e1('0x53')]('nolimit')){_0x4982ce[_0x25e1('0x34')]=qs[_0x25e1('0x34')](_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x34')]);_0x4982ce[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x32')]);}_0x4982ce[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x504fb8[_0x25e1('0x4b')]['sort']);_0x4982ce['where']=qs['filters'](_[_0x25e1('0x56')](_0x504fb8[_0x25e1('0x4b')],_0x5b56df[_0x25e1('0x4d')]));_0x4982ce[_0x25e1('0x55')][_0x25e1('0x6b')]=_0x17dc9f['id'];if(_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x59')]){_0x4982ce[_0x25e1('0x55')]=_['merge'](_0x4982ce[_0x25e1('0x55')],{'$or':_[_0x25e1('0x46')](_0x4982ce[_0x25e1('0x50')],function(_0x5ce275){var _0x5aac65={};_0x5aac65[_0x5ce275]={'$like':'%'+_0x504fb8[_0x25e1('0x4b')]['filter']+'%'};return _0x5aac65;})});}_0x4982ce=_['merge']({},_0x4982ce,_0x504fb8[_0x25e1('0x5a')]);return db['FaxInteraction'][_0x25e1('0x35')]({'where':_0x4982ce['where']})[_0x25e1('0x3b')](function(_0xa9afae){_0x15f750[_0x25e1('0x35')]=_0xa9afae;if(_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x5b')]){_0x4982ce[_0x25e1('0x5c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x25e1('0x7a'),'attributes':['name',_0x25e1('0x7b'),_0x25e1('0x7c')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x25e1('0x41'),_0x25e1('0x7d')],'where':_0x504fb8[_0x25e1('0x4b')]['tag']?{'id':_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x7e')]}:undefined,'required':_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x7e')]?!![]:![]}];}return db[_0x25e1('0x79')][_0x25e1('0x5d')](_0x4982ce);})[_0x25e1('0x3b')](function(_0x5664b8){_0x15f750['rows']=_0x5664b8;return _0x15f750;});}})[_0x25e1('0x3b')](respondWithFilteredResult(_0x3c7dc8,_0x4982ce))[_0x25e1('0x2f')](handleError(_0x3c7dc8,null));};exports[_0x25e1('0x7f')]=function(_0x49182f,_0x3788d0){var _0x50554d=_0x49182f[_0x25e1('0x60')]['id'];var _0xab33f8=_0x49182f['body'];var _0x33744b=0xc8;var _0x12afa2=null;return db[_0x25e1('0x80')]['transaction']({'isolationLevel':db[_0x25e1('0x80')][_0x25e1('0x81')]['ISOLATION_LEVELS'][_0x25e1('0x82')]},function(_0x3c2949){return db[_0x25e1('0x47')][_0x25e1('0x6e')]({'where':{'id':_0x50554d},'transaction':_0x3c2949})[_0x25e1('0x3b')](function(_0x320658){if(_0x320658){return db[_0x25e1('0x83')]['destroy']({'where':{'FaxAccountId':_0x50554d},'transaction':_0x3c2949})[_0x25e1('0x3b')](function(){var _0xbad1a8=_[_0x25e1('0x46')](_0xab33f8,function(_0x5cbf7d){_0x5cbf7d['FaxAccountId']=_0x50554d;return _0x5cbf7d;});return db[_0x25e1('0x83')][_0x25e1('0x84')](_0xbad1a8,{'transaction':_0x3c2949});});}else{_0x33744b=0x194;_0x12afa2=[];}});})[_0x25e1('0x3b')](function(){if(_0x33744b!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x50554d},'order':_0x25e1('0x85')})[_0x25e1('0x3b')](function(_0x21bb5d){_0x12afa2=_0x21bb5d;});}})[_0x25e1('0x2f')](function(_0x2d9c8f){_0x33744b=0x1f4;logger[_0x25e1('0x2b')](_0x2d9c8f['stack']);if(_0x2d9c8f[_0x25e1('0x41')]){delete _0x2d9c8f[_0x25e1('0x41')];}_0x12afa2=_0x2d9c8f;})[_0x25e1('0x86')](function(){if(_0x12afa2===null){_0x3788d0[_0x25e1('0x3f')](_0x33744b);}else{if(_0x33744b===0x1f4){_0x3788d0[_0x25e1('0x30')](_0x33744b)[_0x25e1('0x42')](_0x12afa2);}else{_0x3788d0[_0x25e1('0x30')](_0x33744b)[_0x25e1('0x31')](_0x12afa2);}}});};exports[_0x25e1('0x87')]=function(_0x54d1bd,_0x4cd812,_0x3fef63){var _0x3db9ae={};var _0x28468c={};var _0x32c04b;var _0x460d76;return db[_0x25e1('0x47')]['findOne']({'where':{'id':_0x54d1bd['params']['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x4cd812,null))['then'](function(_0x233f2b){if(_0x233f2b){_0x32c04b=_0x233f2b;_0x28468c[_0x25e1('0x4f')]=_['keys'](db[_0x25e1('0x83')][_0x25e1('0x48')]);_0x28468c['query']=_[_0x25e1('0x4c')](_0x54d1bd[_0x25e1('0x4b')]);_0x28468c['filters']=_[_0x25e1('0x4e')](_0x28468c['model'],_0x28468c[_0x25e1('0x4b')]);_0x3db9ae['attributes']=_[_0x25e1('0x4e')](_0x28468c[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x54d1bd[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x3db9ae[_0x25e1('0x50')]=_0x3db9ae[_0x25e1('0x50')][_0x25e1('0x52')]?_0x3db9ae['attributes']:_0x28468c[_0x25e1('0x4f')];_0x3db9ae[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x54d1bd['query'][_0x25e1('0x70')]);_0x3db9ae[_0x25e1('0x55')]=qs[_0x25e1('0x4d')](_['pick'](_0x54d1bd['query'],_0x28468c[_0x25e1('0x4d')]));if(_0x54d1bd[_0x25e1('0x4b')][_0x25e1('0x59')]){_0x3db9ae[_0x25e1('0x55')]=_[_0x25e1('0x57')](_0x3db9ae[_0x25e1('0x55')],{'$or':_['map'](_0x3db9ae['attributes'],function(_0x38bef9){var _0x596f75={};_0x596f75[_0x38bef9]={'$like':'%'+_0x54d1bd[_0x25e1('0x4b')]['filter']+'%'};return _0x596f75;})});}_0x3db9ae=_['merge']({},_0x3db9ae,_0x54d1bd[_0x25e1('0x5a')]);return _0x32c04b[_0x25e1('0x87')](_0x3db9ae);}})[_0x25e1('0x3b')](function(_0x1325f0){if(_0x1325f0){_0x460d76=_0x1325f0[_0x25e1('0x52')];if(!_0x54d1bd[_0x25e1('0x4b')][_0x25e1('0x53')]('nolimit')){_0x3db9ae['limit']=qs[_0x25e1('0x34')](_0x54d1bd[_0x25e1('0x4b')][_0x25e1('0x34')]);_0x3db9ae[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x54d1bd[_0x25e1('0x4b')]['offset']);}return _0x32c04b[_0x25e1('0x87')](_0x3db9ae);}})['then'](function(_0xf1362d){if(_0xf1362d){return _0xf1362d?{'count':_0x460d76,'rows':_0xf1362d}:null;}})[_0x25e1('0x3b')](respondWithResult(_0x4cd812,null))[_0x25e1('0x2f')](handleError(_0x4cd812,null));};function Extension(_0x5d0f0e,_0x53fbe6,_0x25d18b,_0x139fd1){this[_0x25e1('0x88')]=_0x25e1('0x89');this[_0x25e1('0x8a')]=_0x5d0f0e[_0x25e1('0x8b')];this['app']=_0x139fd1;this[_0x25e1('0x4a')]=_0x25e1('0x8c');this['description']='Fax\x20Extension';this['FaxAccountId']=_0x5d0f0e['id'];this['priority']=_0x53fbe6;this[_0x25e1('0x8d')]=_0x25d18b;}function createExtensionsReciveFax(_0x5da03d){var _0x208418=0x1;var _0x1c3c5b=[];_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,'',_0x25e1('0x8f')));_0x208418+=0x1;_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,_0x25e1('0x90'),'Set'));_0x208418+=0x1;for(var _0x4d3b52 in _0x5da03d){if(_0x5da03d[_0x25e1('0x53')](_0x4d3b52)&&(_0x4d3b52==='ecm'||_0x4d3b52===_0x25e1('0x8b')||_0x4d3b52===_0x25e1('0x91')||_0x4d3b52===_0x25e1('0x92')||_0x4d3b52==='headerinfo'||_0x4d3b52===_0x25e1('0x93')||_0x4d3b52===_0x25e1('0x94')||_0x4d3b52===_0x25e1('0x95')||_0x4d3b52==='t38timeout')){_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,_0x25e1('0x96')+_0x4d3b52+')='+_0x5da03d[_0x4d3b52],_0x25e1('0x97')));_0x208418+=0x1;}}_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,'6',_0x25e1('0x98')));_0x208418+=0x1;_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,_0x25e1('0x99'),_0x25e1('0x9a')));_0x208418=0x0;return _0x1c3c5b;}exports[_0x25e1('0x9b')]=function(_0x2aa7b2,_0x42d8fb,_0x2e3e0d){var _0x5b26ee;return db[_0x25e1('0x80')][_0x25e1('0x9c')](function(_0x291abe){return db[_0x25e1('0x47')][_0x25e1('0x62')](_0x2aa7b2[_0x25e1('0x69')],{'transaction':_0x291abe})[_0x25e1('0x3b')](function(_0x87c7c3){_0x5b26ee=_0x87c7c3[_0x25e1('0x3c')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x5b26ee),{'transaction':_0x291abe});});})[_0x25e1('0x3b')](function(){return _0x5b26ee;})[_0x25e1('0x3b')](respondWithResult(_0x42d8fb,null))[_0x25e1('0x2f')](handleError(_0x42d8fb,null));};exports[_0x25e1('0x9d')]=function(_0x2103db,_0x620c50,_0x4234f1){var _0x2a60e0;return db[_0x25e1('0x80')][_0x25e1('0x9c')](function(_0x2d0a52){return db[_0x25e1('0x47')][_0x25e1('0x39')](_0x2103db[_0x25e1('0x69')],{'where':{'id':_0x2103db[_0x25e1('0x69')]['id']},'transaction':_0x2d0a52})[_0x25e1('0x3b')](function(_0x3c947d){return db[_0x25e1('0x9e')]['destroy']({'where':{'FaxAccountId':_0x2103db[_0x25e1('0x69')]['id']},'transaction':_0x2d0a52})[_0x25e1('0x3b')](function(_0x206bf9){return db[_0x25e1('0x9e')][_0x25e1('0x84')](createExtensionsReciveFax(_[_0x25e1('0x9f')](_0x2103db[_0x25e1('0x69')],[_0x25e1('0xa0'),_0x25e1('0xa1'),_0x25e1('0xa2'),_0x25e1('0xa3'),_0x25e1('0xa4'),'ListId'])),{'transaction':_0x2d0a52});});});})['then'](function(){return db[_0x25e1('0x47')][_0x25e1('0xa5')](_0x2103db[_0x25e1('0x69')]['id']);})[_0x25e1('0x3b')](respondWithResult(_0x620c50,null))['catch'](handleError(_0x620c50,null));};exports[_0x25e1('0xa6')]=function(_0x441f2d,_0x4b4b13,_0x357247){var _0x1f6848={'raw':!![],'where':{}};var _0x12f5ec={};var _0x5ce04f={'count':0x0,'rows':[]};return db[_0x25e1('0x47')][_0x25e1('0x6e')]({'where':{'id':_0x441f2d[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x4b4b13,null))[_0x25e1('0x3b')](function(_0x4f3654){if(_0x4f3654){_0x12f5ec['model']=_[_0x25e1('0x4c')](db['FaxMessage'][_0x25e1('0x48')]);_0x12f5ec['query']=_[_0x25e1('0x4c')](_0x441f2d[_0x25e1('0x4b')]);_0x12f5ec[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x12f5ec[_0x25e1('0x4f')],_0x12f5ec[_0x25e1('0x4b')]);_0x1f6848[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x12f5ec[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x441f2d[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x1f6848[_0x25e1('0x50')]=_0x1f6848[_0x25e1('0x50')]['length']?_0x1f6848['attributes']:_0x12f5ec[_0x25e1('0x4f')];if(!_0x441f2d['query']['hasOwnProperty'](_0x25e1('0x54'))){_0x1f6848['limit']=qs[_0x25e1('0x34')](_0x441f2d['query'][_0x25e1('0x34')]);_0x1f6848[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x441f2d[_0x25e1('0x4b')][_0x25e1('0x32')]);}_0x1f6848[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x441f2d[_0x25e1('0x4b')]['sort']);_0x1f6848[_0x25e1('0x55')]=qs[_0x25e1('0x4d')](_[_0x25e1('0x56')](_0x441f2d[_0x25e1('0x4b')],_0x12f5ec[_0x25e1('0x4d')]));_0x1f6848['where'][_0x25e1('0x6b')]=_0x4f3654['id'];if(_0x441f2d['query'][_0x25e1('0x59')]){_0x1f6848[_0x25e1('0x55')]=_['merge'](_0x1f6848[_0x25e1('0x55')],{'$or':_['map'](_0x1f6848['attributes'],function(_0x19c97c){var _0x24e6c5={};_0x24e6c5[_0x19c97c]={'$like':'%'+_0x441f2d[_0x25e1('0x4b')][_0x25e1('0x59')]+'%'};return _0x24e6c5;})});}if(_0x441f2d[_0x25e1('0x4b')][_0x25e1('0xa7')]){var _0x509d39=_0x441f2d[_0x25e1('0x4b')][_0x25e1('0xa7')][_0x25e1('0xa8')](',');var _0xd472ad={};_0xd472ad[_0x509d39[0x0]]={'$gte':moment(_0x509d39[0x1])[_0x25e1('0xa9')](_0x25e1('0xaa'))};_0x1f6848[_0x25e1('0x55')]=_[_0x25e1('0x57')](_0x1f6848[_0x25e1('0x55')],_0xd472ad);}_0x1f6848=_['merge']({},_0x1f6848,_0x441f2d[_0x25e1('0x5a')]);return db[_0x25e1('0xab')][_0x25e1('0x35')]({'where':_0x1f6848['where']})[_0x25e1('0x3b')](function(_0x14d433){_0x5ce04f[_0x25e1('0x35')]=_0x14d433;if(_0x441f2d[_0x25e1('0x4b')]['includeAll']){_0x1f6848[_0x25e1('0x5c')]=[{'all':!![]}];}return db[_0x25e1('0xab')]['findAll'](_0x1f6848);})[_0x25e1('0x3b')](function(_0x585b49){_0x5ce04f[_0x25e1('0x5e')]=_0x585b49;return _0x5ce04f;});}})[_0x25e1('0x3b')](respondWithFilteredResult(_0x4b4b13,_0x1f6848))[_0x25e1('0x2f')](handleError(_0x4b4b13,null));};exports[_0x25e1('0x42')]=function(_0x5a3eb5,_0x23e9cc,_0x4cebf6){var _0x3e5a64,_0x3c5353={},_0x35d9c3;if(_0x5a3eb5[_0x25e1('0x69')]['to']){_0x35d9c3=_0x5a3eb5[_0x25e1('0x69')]['to'][0x0];}return db[_0x25e1('0x47')]['find']({'where':{'id':_0x5a3eb5[_0x25e1('0x60')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x25e1('0xac')],'as':_0x25e1('0xad'),'where':{'fax':_0x35d9c3},'limit':0x1,'order':[[_0x25e1('0xa3'),'DESC']]}]}]})[_0x25e1('0x3b')](handleEntityNotFound(_0x23e9cc,null))['then'](function(_0x50439d){_0x3e5a64=_0x50439d;if(_0x5a3eb5['body'][_0x25e1('0xae')]&&_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x25e1('0x52')]){for(var _0x1da12c=0x0;_0x1da12c<_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x25e1('0x52')];_0x1da12c+=0x1){_0x5a3eb5['body']['attachments'][_0x1da12c]={'filename':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x1da12c][_0x25e1('0x41')],'id':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x1da12c]['id'],'path':path[_0x25e1('0xaf')](config[_0x25e1('0xb0')],_0x25e1('0xb1'),_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x1da12c]['basename'])};}}return respondWithRpcPromise(_0x25e1('0xb2'),_0x25e1('0xb2'),{'FaxAccountId':_[_0x25e1('0xb3')](_0x5a3eb5[_0x25e1('0x60')]['id'])?undefined:_0x5a3eb5[_0x25e1('0x60')]['id'],'path':_[_0x25e1('0xb3')](_0x5a3eb5['body'][_0x25e1('0xae')][0x0][_0x25e1('0x9')])?undefined:_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['path'],'fax':_[_0x25e1('0xb3')](_0x5a3eb5['body']['to'][0x0])?undefined:_0x5a3eb5['body']['to'][0x0]},client9002);})[_0x25e1('0x3b')](function(){if(_0x3e5a64){if(_[_0x25e1('0xb3')](_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xb4')])){_0x5a3eb5['body'][_0x25e1('0xb4')]=util['format']('\x22%s\x22\x20<%s>',_0x3e5a64[_0x25e1('0x41')],_0x3e5a64[_0x25e1('0xb5')]);}if(_0x3e5a64[_0x25e1('0xb6')]){if(_0x3e5a64['List'][_0x25e1('0xad')][_0x25e1('0x52')]){return _0x3e5a64[_0x25e1('0xb6')]['Contacts'][0x0];}else{return db[_0x25e1('0xac')][_0x25e1('0x62')](_['defaults'](_0x5a3eb5[_0x25e1('0x69')],{'firstName':_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'phone':_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'fax':_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'ListId':_0x3e5a64[_0x25e1('0xb7')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x25e1('0xb8'));}})[_0x25e1('0x3b')](function(_0x3d6f5e){if(_0x3d6f5e){return db[_0x25e1('0x79')][_0x25e1('0x61')]({'where':{'ContactId':_0x3d6f5e['id'],'closed':![],'FaxAccountId':_0x3e5a64['id']}})['then'](function(_0x571332){if(_0x571332){return[_0x571332,![]];}return db['FaxInteraction'][_0x25e1('0x62')]({'UserId':_0x5a3eb5[_0x25e1('0x63')]['id'],'ContactId':_0x3d6f5e['id'],'FaxAccountId':_0x3e5a64['id'],'fax':_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'firstMsgDirection':_0x25e1('0xb9'),'Messages':[_[_0x25e1('0x57')](_0x5a3eb5[_0x25e1('0x69')],{'read':![],'body':_0x5a3eb5[_0x25e1('0x69')]['attachments'][0x0][_0x25e1('0xba')],'FaxAccountId':_0x3e5a64['id'],'UserId':_0x5a3eb5[_0x25e1('0x63')]['id'],'ContactId':_0x3d6f5e['id'],'AttachmentId':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x25e1('0xab')],'as':'Messages'}]})[_0x25e1('0x3b')](function(_0x1035fe){return[_0x1035fe,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x5ea95a,_0x17fe3b){if(_0x17fe3b){return _0x5ea95a;}return db[_0x25e1('0xab')][_0x25e1('0x62')]({'direction':_0x25e1('0xb9'),'read':![],'body':_0x5a3eb5['body'][_0x25e1('0xae')][0x0][_0x25e1('0xba')],'FaxAccountId':_0x3e5a64['id'],'FaxInteractionId':_0x5ea95a['id'],'UserId':_0x5a3eb5[_0x25e1('0x63')]['id'],'ContactId':_0x5ea95a[_0x25e1('0xbb')],'AttachmentId':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['id']})[_0x25e1('0x3b')](function(_0x566bbe){_0x5ea95a[_0x25e1('0xbc')][_0x25e1('0xbd')]=[];_0x5ea95a[_0x25e1('0xbc')]['Messages'][_0x25e1('0x8e')](_0x566bbe[_0x25e1('0xbc')]);return _0x5ea95a;});})[_0x25e1('0x3b')](function(_0x4d5ad4){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x25e1('0xb3')](_0x5a3eb5[_0x25e1('0x60')]['id'])?undefined:_0x5a3eb5[_0x25e1('0x60')]['id'],'path':_[_0x25e1('0xb3')](_0x5a3eb5['body']['attachments'][0x0][_0x25e1('0x9')])?undefined:_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['path'],'fax':_[_0x25e1('0xb3')](_0x5a3eb5[_0x25e1('0x69')]['to'][0x0])?undefined:_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'AttachmentId':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['id']},client9002)[_0x25e1('0x3b')](function(_0x439bcb){logger[_0x25e1('0x26')]('SendFaxRpc,\x20%s',_0x439bcb);})[_0x25e1('0x2f')](function(_0x24d8c9){logger[_0x25e1('0x26')](_0x25e1('0xbe'),_0x24d8c9);});return _0x4d5ad4;})[_0x25e1('0x3b')](respondWithResult(_0x23e9cc,null))[_0x25e1('0x2f')](handleError(_0x23e9cc,null));};exports[_0x25e1('0xbf')]=function(_0x271725,_0x35b98f,_0x47e5b9){return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x271725[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x35b98f,null))[_0x25e1('0x3b')](function(_0x5b7469){if(_0x5b7469){return _0x5b7469[_0x25e1('0xbf')](_0x271725[_0x25e1('0x69')][_0x25e1('0x72')],_[_0x25e1('0x9f')](_0x271725[_0x25e1('0x69')],[_0x25e1('0x72'),'id'])||{})[_0x25e1('0xc0')](function(_0x40e24e){for(var _0x58a6d4=0x0;_0x58a6d4<_0x271725[_0x25e1('0x69')][_0x25e1('0x72')][_0x25e1('0x52')];_0x58a6d4+=0x1){socket[_0x25e1('0xc1')](_0x25e1('0xc2'),{'UserId':Number(_0x271725[_0x25e1('0x69')][_0x25e1('0x72')][_0x58a6d4]),'FaxAccountId':Number(_0x271725[_0x25e1('0x60')]['id'])});}return _0x40e24e;});}})[_0x25e1('0x3b')](respondWithResult(_0x35b98f,null))[_0x25e1('0x2f')](handleError(_0x35b98f,null));};exports['removeAgents']=function(_0x40a69d,_0x45283b,_0x312d74){return db[_0x25e1('0x47')]['find']({'where':{'id':_0x40a69d['params']['id']}})['then'](handleEntityNotFound(_0x45283b,null))[_0x25e1('0x3b')](function(_0x580318){if(_0x580318){return _0x580318[_0x25e1('0xc3')](_0x40a69d['query'][_0x25e1('0x72')])['then'](function(){if(_[_0x25e1('0xc4')](_0x40a69d[_0x25e1('0x4b')][_0x25e1('0x72')])){for(var _0x6b730e=0x0;_0x6b730e<_0x40a69d[_0x25e1('0x4b')]['ids'][_0x25e1('0x52')];_0x6b730e+=0x1){socket['emit'](_0x25e1('0xc5'),{'UserId':Number(_0x40a69d[_0x25e1('0x4b')][_0x25e1('0x72')][_0x6b730e]),'FaxAccountId':Number(_0x40a69d[_0x25e1('0x60')]['id'])});}}else{socket[_0x25e1('0xc1')](_0x25e1('0xc5'),{'UserId':Number(_0x40a69d[_0x25e1('0x4b')]['ids']),'FaxAccountId':Number(_0x40a69d['params']['id'])});}});}})[_0x25e1('0x3b')](respondWithStatusCode(_0x45283b,null))[_0x25e1('0x2f')](handleError(_0x45283b,null));};exports[_0x25e1('0xc6')]=function(_0x443db3,_0x584fd1,_0x204fef){var _0x31c264={};var _0x101c44={};var _0x33859a;var _0x565e25;return db[_0x25e1('0x47')]['findOne']({'where':{'id':_0x443db3[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x584fd1,null))[_0x25e1('0x3b')](function(_0x4d37fe){if(_0x4d37fe){_0x33859a=_0x4d37fe;_0x101c44[_0x25e1('0x4f')]=_[_0x25e1('0x4c')](db[_0x25e1('0xc7')][_0x25e1('0x48')]);_0x101c44[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x443db3['query']);_0x101c44['filters']=_[_0x25e1('0x4e')](_0x101c44[_0x25e1('0x4f')],_0x101c44[_0x25e1('0x4b')]);_0x31c264[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x101c44[_0x25e1('0x4f')],qs['fields'](_0x443db3[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x31c264['attributes']=_0x31c264[_0x25e1('0x50')][_0x25e1('0x52')]?_0x31c264[_0x25e1('0x50')]:_0x101c44[_0x25e1('0x4f')];_0x31c264[_0x25e1('0x6f')]=qs['sort'](_0x443db3['query'][_0x25e1('0x70')]);_0x31c264[_0x25e1('0x55')]=qs[_0x25e1('0x4d')](_[_0x25e1('0x56')](_0x443db3[_0x25e1('0x4b')],_0x101c44[_0x25e1('0x4d')]));if(_0x443db3[_0x25e1('0x4b')][_0x25e1('0x59')]){_0x31c264[_0x25e1('0x55')]=_[_0x25e1('0x57')](_0x31c264[_0x25e1('0x55')],{'$or':_[_0x25e1('0x46')](_0x31c264[_0x25e1('0x50')],function(_0xe3b0ff){var _0x3fefea={};_0x3fefea[_0xe3b0ff]={'$like':'%'+_0x443db3[_0x25e1('0x4b')][_0x25e1('0x59')]+'%'};return _0x3fefea;})});}_0x31c264=_[_0x25e1('0x57')]({},_0x31c264,_0x443db3['options']);return _0x33859a[_0x25e1('0xc6')](_0x31c264);}})[_0x25e1('0x3b')](function(_0x29e42a){if(_0x29e42a){_0x565e25=_0x29e42a[_0x25e1('0x52')];if(!_0x443db3['query']['hasOwnProperty'](_0x25e1('0x54'))){_0x31c264[_0x25e1('0x34')]=qs[_0x25e1('0x34')](_0x443db3[_0x25e1('0x4b')][_0x25e1('0x34')]);_0x31c264[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x443db3[_0x25e1('0x4b')][_0x25e1('0x32')]);}return _0x33859a['getAgents'](_0x31c264);}})[_0x25e1('0x3b')](function(_0x49977e){if(_0x49977e){return _0x49977e?{'count':_0x565e25,'rows':_0x49977e}:null;}})[_0x25e1('0x3b')](respondWithResult(_0x584fd1,null))['catch'](handleError(_0x584fd1,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 01c419b..ef90c5f 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 _0xdddf=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x293617,_0x43ff20){var _0x1f9d33=function(_0x31f191){while(--_0x31f191){_0x293617['push'](_0x293617['shift']());}};_0x1f9d33(++_0x43ff20);}(_0xdddf,0x9b));var _0xfddd=function(_0x281b34,_0x2c518d){_0x281b34=_0x281b34-0x0;var _0x2ee85c=_0xdddf[_0x281b34];return _0x2ee85c;};'use strict';var EventEmitter=require(_0xfddd('0x0'));var FaxAccount=require(_0xfddd('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xfddd('0x2')](0x0);var events={'afterCreate':_0xfddd('0x3'),'afterUpdate':'update','afterDestroy':_0xfddd('0x4')};function emitEvent(_0x2407e7){return function(_0x1a424e,_0x17f9f8,_0x52ed8d){FaxAccountEvents[_0xfddd('0x5')](_0x2407e7+':'+_0x1a424e['id'],_0x1a424e);FaxAccountEvents['emit'](_0x2407e7,_0x1a424e);_0x52ed8d(null);};}for(var e in events){if(events[_0xfddd('0x6')](e)){var event=events[e];FaxAccount[_0xfddd('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xf571=['emit','hasOwnProperty','hook','exports','events','FaxAccount','save','update','remove'];(function(_0x3b07ca,_0x56c4bc){var _0x61e09=function(_0x5cd016){while(--_0x5cd016){_0x3b07ca['push'](_0x3b07ca['shift']());}};_0x61e09(++_0x56c4bc);}(_0xf571,0x1a2));var _0x1f57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf571[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x1f57('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x1f57('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f57('0x2'),'afterUpdate':_0x1f57('0x3'),'afterDestroy':_0x1f57('0x4')};function emitEvent(_0xee3268){return function(_0x7084fe,_0x50f510,_0x3d6ad2){FaxAccountEvents[_0x1f57('0x5')](_0xee3268+':'+_0x7084fe['id'],_0x7084fe);FaxAccountEvents[_0x1f57('0x5')](_0xee3268,_0x7084fe);_0x3d6ad2(null);};}for(var e in events){if(events[_0x1f57('0x6')](e)){var event=events[e];FaxAccount[_0x1f57('0x7')](e,emitEvent(event));}}module[_0x1f57('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 507dc32..a8f0454 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 _0xc81a=['./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc81a,0x191));var _0xac81=function(_0x2effd6,_0x8e1532){_0x2effd6=_0x2effd6-0x0;var _0x4f2dd6=_0xc81a[_0x2effd6];return _0x4f2dd6;};'use strict';var _=require(_0xac81('0x0'));var util=require(_0xac81('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xac81('0x2'));var rp=require(_0xac81('0x3'));var fs=require('fs');var path=require(_0xac81('0x4'));var rimraf=require(_0xac81('0x5'));var config=require('../../config/environment');var attributes=require(_0xac81('0x6'));module[_0xac81('0x7')]=function(_0x1f0ceb,_0x1b7523){return _0x1f0ceb[_0xac81('0x8')](_0xac81('0x9'),attributes,{'tableName':_0xac81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x255a=['request-promise','path','rimraf','./faxAccount.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1abda0,_0x57f78e){var _0x33fe72=function(_0x48a83c){while(--_0x48a83c){_0x1abda0['push'](_0x1abda0['shift']());}};_0x33fe72(++_0x57f78e);}(_0x255a,0x1a8));var _0xa255=function(_0x491048,_0x5d691f){_0x491048=_0x491048-0x0;var _0x2d3c83=_0x255a[_0x491048];return _0x2d3c83;};'use strict';var _=require(_0xa255('0x0'));var util=require(_0xa255('0x1'));var logger=require(_0xa255('0x2'))('api');var moment=require(_0xa255('0x3'));var BPromise=require(_0xa255('0x4'));var rp=require(_0xa255('0x5'));var fs=require('fs');var path=require(_0xa255('0x6'));var rimraf=require(_0xa255('0x7'));var config=require('../../config/environment');var attributes=require(_0xa255('0x8'));module[_0xa255('0x9')]=function(_0x10a91a,_0x2f29ec){return _0x10a91a[_0xa255('0xa')]('FaxAccount',attributes,{'tableName':'fax_accounts','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 8e95c0b..93064fa 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 _0x65a7=['waitForTheAssignedAgent','FaxQueue','queueId','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','FaxInteraction','Contact\x20not\x20found','spread','push','close','*,*,*,*','created','create','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x65a7,0x17a));var _0x765a=function(_0x504b73,_0x2b4a50){_0x504b73=_0x504b73-0x0;var _0x47e36a=_0x65a7[_0x504b73];return _0x47e36a;};'use strict';var _=require(_0x765a('0x0'));var util=require('util');var moment=require(_0x765a('0x1'));var BPromise=require(_0x765a('0x2'));var rs=require(_0x765a('0x3'));var fs=require('fs');var Redis=require(_0x765a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x765a('0x5'));var logger=require(_0x765a('0x6'))(_0x765a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x765a('0x8')][_0x765a('0x9')]({'port':0x232c});config[_0x765a('0xa')]=_[_0x765a('0xb')](config['redis'],{'host':_0x765a('0xc'),'port':0x18eb});var socket=require(_0x765a('0xd'))(new Redis(config[_0x765a('0xa')]));require(_0x765a('0xe'))['register'](socket);function respondWithRpcPromise(_0x3249f7,_0x2e9db7,_0x232079){return new BPromise(function(_0x5cd0ed,_0x5b6b57){return client[_0x765a('0xf')](_0x3249f7,_0x232079)['then'](function(_0x4166ea){logger[_0x765a('0x10')](_0x765a('0x11'),_0x2e9db7,'request\x20sent');logger[_0x765a('0x12')](_0x765a('0x13'),_0x2e9db7,_0x765a('0x14'),JSON[_0x765a('0x15')](_0x4166ea));if(_0x4166ea[_0x765a('0x16')]){if(_0x4166ea[_0x765a('0x16')]['code']===0x1f4){logger['error'](_0x765a('0x11'),_0x2e9db7,_0x4166ea['error']['message']);return _0x5b6b57(_0x4166ea['error']['message']);}logger[_0x765a('0x16')]('FaxAccount,\x20%s,\x20%s',_0x2e9db7,_0x4166ea[_0x765a('0x16')][_0x765a('0x17')]);return _0x5cd0ed(_0x4166ea[_0x765a('0x16')][_0x765a('0x17')]);}else{logger['info'](_0x765a('0x11'),_0x2e9db7,'request\x20sent');_0x5cd0ed(_0x4166ea[_0x765a('0x18')][_0x765a('0x17')]);}})[_0x765a('0x19')](function(_0x4c96ae){logger['error'](_0x765a('0x11'),_0x2e9db7,_0x4c96ae);_0x5b6b57(_0x4c96ae);});});}exports['GetFaxAccount']=function(_0x4af83f){var _0x2d0ec3=this;return new Promise(function(_0x5c14f8,_0x362195){return db[_0x765a('0x1a')][_0x765a('0x1b')]({'raw':_0x4af83f[_0x765a('0x1c')]?_0x4af83f[_0x765a('0x1c')][_0x765a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4af83f[_0x765a('0x1c')]?_0x4af83f[_0x765a('0x1c')][_0x765a('0x1e')]||null:null,'attributes':_0x4af83f['options']?_0x4af83f[_0x765a('0x1c')][_0x765a('0x1f')]||null:null,'limit':_0x4af83f['options']?_0x4af83f['options'][_0x765a('0x20')]||null:null,'include':_0x4af83f[_0x765a('0x1c')]?_0x4af83f[_0x765a('0x1c')]['include']?_[_0x765a('0x21')](_0x4af83f[_0x765a('0x1c')][_0x765a('0x22')],function(_0x5495c6){return{'model':db[_0x5495c6[_0x765a('0x23')]],'as':_0x5495c6['as'],'attributes':_0x5495c6['attributes'],'include':_0x5495c6['include']?_['map'](_0x5495c6[_0x765a('0x22')],function(_0x1f1b4a){return{'model':db[_0x1f1b4a[_0x765a('0x23')]],'as':_0x1f1b4a['as'],'attributes':_0x1f1b4a[_0x765a('0x1f')],'include':_0x1f1b4a[_0x765a('0x22')]?_['map'](_0x1f1b4a[_0x765a('0x22')],function(_0x49c325){return{'model':db[_0x49c325[_0x765a('0x23')]],'as':_0x49c325['as'],'attributes':_0x49c325[_0x765a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x73f5f4){logger[_0x765a('0x10')](_0x765a('0x24'),_0x4af83f);logger['debug'](_0x765a('0x24'),_0x4af83f,JSON[_0x765a('0x15')](_0x73f5f4));_0x5c14f8(_0x73f5f4);})[_0x765a('0x19')](function(_0x274279){logger[_0x765a('0x16')](_0x765a('0x24'),_0x274279[_0x765a('0x17')],_0x4af83f);_0x362195(_0x2d0ec3['error'](0x1f4,_0x274279[_0x765a('0x17')]));});});};exports[_0x765a('0x25')]=function(_0x5b3e4f,_0x3c0b93,_0x4d57a2){var _0x47c730=this;return new Promise(function(_0x5e1f0e,_0x4c8d67){var _0x2e8570={'body':_0x5b3e4f[_0x765a('0x26')],'channel':_0x765a('0x27')};var _0x1a36b1=[];var _0x633fa7=[];var _0x19121d={};return db[_0x765a('0x28')]['describe']()[_0x765a('0x29')](function(_0x1d2c76){if(!_0x1d2c76){throw new db[(_0x765a('0x2a'))][(_0x765a('0x2b'))](_0x765a('0x2c'));}_0x1a36b1=_[_0x765a('0x2d')](_['keys'](_0x1d2c76),['createdAt',_0x765a('0x2e')]);_0x633fa7=_[_0x765a('0x2d')](_[_0x765a('0x2f')](_0x1d2c76),[_0x765a('0x30'),_0x765a('0x2e'),_0x765a('0x31'),_0x765a('0x32')]);if(_0x5b3e4f[_0x765a('0x26')]['id']){delete _0x5b3e4f['body']['id'];}if(_[_0x765a('0x33')](_0x5b3e4f['body'][_0x765a('0x34')])){throw new db[(_0x765a('0x2a'))][(_0x765a('0x2b'))](_0x765a('0x35'));}if(_['isNil'](_0x5b3e4f[_0x765a('0x26')]['body'])||_0x5b3e4f[_0x765a('0x26')]['body']===''){throw new db[(_0x765a('0x2a'))][(_0x765a('0x2b'))](_0x765a('0x36'));}if(_['isNil'](_0x5b3e4f[_0x765a('0x26')][_0x765a('0x37')])){throw new db[(_0x765a('0x2a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x633fa7);}if(!_['includes'](_0x633fa7,_0x5b3e4f[_0x765a('0x26')][_0x765a('0x37')])){throw new db[(_0x765a('0x2a'))][(_0x765a('0x2b'))](_0x765a('0x38')+_0x633fa7);}_0x19121d[_0x5b3e4f[_0x765a('0x26')][_0x765a('0x37')]]=_0x5b3e4f[_0x765a('0x26')][_0x765a('0x34')];})[_0x765a('0x29')](function(){return db[_0x765a('0x1a')]['find']({'where':{'id':_0x5b3e4f[_0x765a('0x39')]['id']},'include':[{'model':db[_0x765a('0x3a')],'as':_0x765a('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x19121d,'limit':0x1,'order':[['updatedAt',_0x765a('0x3c')]]}]},{'model':db[_0x765a('0x3d')],'as':_0x765a('0x3e')}]});})[_0x765a('0x29')](function(_0x7e24b5){if(_0x7e24b5&&_0x7e24b5['List']){var _0x1e8bd0=_0x7e24b5[_0x765a('0x3f')]({'plain':!![]});_0x2e8570[_0x765a('0x39')]=_0x1e8bd0;_0x2e8570[_0x765a('0x40')]=_0x1e8bd0[_0x765a('0x3e')];_0x2e8570[_0x765a('0x41')]=_0x1e8bd0[_0x765a('0x3b')];_0x2e8570[_0x765a('0x40')]=_[_0x765a('0x42')](_0x2e8570[_0x765a('0x40')],[_0x765a('0x43')],[_0x765a('0x44')]);if(_0x2e8570[_0x765a('0x39')][_0x765a('0x3e')]){delete _0x2e8570[_0x765a('0x39')]['Applications'];}if(_0x2e8570[_0x765a('0x39')][_0x765a('0x3b')]&&_0x2e8570[_0x765a('0x39')]['List'][_0x765a('0x45')][_0x765a('0x46')]){return _0x2e8570[_0x765a('0x39')]['List']['Contacts'][0x0];}var _0x12a5f9=_['defaults'](_0x5b3e4f[_0x765a('0x26')],{'firstName':_0x5b3e4f[_0x765a('0x26')][_0x765a('0x34')],'ListId':_0x1e8bd0[_0x765a('0x32')]});_0x12a5f9[_0x5b3e4f['body'][_0x765a('0x37')]]=_0x5b3e4f['body']['from'];return db[_0x765a('0x28')]['create'](_0x12a5f9,{'fields':_0x1a36b1,'raw':!![]});}})[_0x765a('0x29')](function(_0x59c82e){_0x2e8570['contact']=_0x59c82e;if(_0x59c82e){var _0x39c361={'ContactId':_0x59c82e['id'],'FaxAccountId':_0x5b3e4f[_0x765a('0x39')]['id'],'fax':_0x59c82e[_0x765a('0x27')]};return db[_0x765a('0x47')]['find']({'where':{'ContactId':_0x59c82e['id'],'closed':![],'FaxAccountId':_0x5b3e4f['account']['id']}})['then'](function(_0x2dd484){if(_0x2dd484){return[_0x2dd484,![]];}return db['FaxInteraction']['create'](_0x39c361)['then'](function(_0x1bac71){return[_0x1bac71,!![]];});});}else{throw new Error(_0x765a('0x48'));}})[_0x765a('0x49')](function(_0x41bdcd,_0xc687fc){var _0x13b7a3=_0x41bdcd['get']({'plain':!![]});if(_0xc687fc){if(_0x2e8570[_0x765a('0x39')]['autoclose']){_0x2e8570[_0x765a('0x40')][_0x765a('0x4a')]({'id':0x0,'priority':_0x2e8570[_0x765a('0x40')][_0x765a('0x46')]+0x1,'app':_0x765a('0x4b'),'appdata':'unmanaged','interval':_0x765a('0x4c')});}_0x13b7a3[_0x765a('0x4d')]=!![];}else{_0x13b7a3[_0x765a('0x4d')]=![];}_0x2e8570['interaction']=_0x13b7a3;return db['FaxMessage'][_0x765a('0x4e')]({'body':_0x5b3e4f['body'][_0x765a('0x26')],'FaxAccountId':_0x5b3e4f['account']['id'],'FaxInteractionId':_0x41bdcd['id'],'direction':'in','ContactId':_0x41bdcd[_0x765a('0x4f')],'AttachmentId':_0x5b3e4f[_0x765a('0x26')][_0x765a('0x50')]});})['then'](function(_0x214517){_0x2e8570[_0x765a('0x17')]=_0x214517;if(!_0x2e8570[_0x765a('0x51')][_0x765a('0x52')])return;return db[_0x765a('0x53')]['find']({'attributes':['id',_0x765a('0x54')],'where':{'id':_0x2e8570[_0x765a('0x51')]['UserId']}});})[_0x765a('0x29')](function(_0x24bacf){if(_0x24bacf){_0x2e8570[_0x765a('0x40')][_0x765a('0x55')]({'id':0x0,'priority':0x0,'app':_0x765a('0x56'),'appdata':_0x24bacf['name']+','+(_0x2e8570[_0x765a('0x39')][_0x765a('0x57')]||0xa),'interval':_0x765a('0x4c')});}if(!_0x2e8570[_0x765a('0x51')]['queueId'])return;return db[_0x765a('0x58')]['find']({'attributes':['id',_0x765a('0x54')],'where':{'id':_0x2e8570[_0x765a('0x51')][_0x765a('0x59')]}});})[_0x765a('0x29')](function(_0x2c3eac){if(_0x2c3eac){_0x2e8570[_0x765a('0x40')][_0x765a('0x55')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2c3eac[_0x765a('0x54')]+','+(_0x2e8570['account'][_0x765a('0x5a')]||0x12c),'interval':_0x765a('0x4c')});}return respondWithRpcPromise(_0x765a('0x5b'),_0x765a('0x5c'),_0x2e8570);})[_0x765a('0x29')](function(_0x1868ac){_0x5e1f0e(_0x1868ac);})[_0x765a('0x19')](function(_0x5e93c3){_0x4c8d67(_0x47c730[_0x765a('0x16')](0x1f4,_0x5e93c3[_0x765a('0x17')]));});});}; \ No newline at end of file +var _0xcb6d=['isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','priority','defaults','ListId','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','length','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','agent','name','*,*,*,*','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','FaxAccount','findAll','options','raw','attributes','limit','map','model','include','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcb6d,0x85));var _0xdcb6=function(_0x166f80,_0x52f6c9){_0x166f80=_0x166f80-0x0;var _0x564f98=_0xcb6d[_0x166f80];return _0x564f98;};'use strict';var _=require(_0xdcb6('0x0'));var util=require('util');var moment=require(_0xdcb6('0x1'));var BPromise=require(_0xdcb6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcb6('0x3'));var db=require(_0xdcb6('0x4'))['db'];var utils=require(_0xdcb6('0x5'));var logger=require(_0xdcb6('0x6'))('rpc');var config=require(_0xdcb6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdcb6('0x8')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0xdcb6('0x9')],{'host':_0xdcb6('0xa'),'port':0x18eb});var socket=require(_0xdcb6('0xb'))(new Redis(config[_0xdcb6('0x9')]));require('./faxAccount.socket')[_0xdcb6('0xc')](socket);function respondWithRpcPromise(_0x231091,_0x4f8a3e,_0x2b81d0){return new BPromise(function(_0x1748f7,_0x3ba05f){return client['request'](_0x231091,_0x2b81d0)[_0xdcb6('0xd')](function(_0x30b7d9){logger[_0xdcb6('0xe')]('FaxAccount,\x20%s,\x20%s',_0x4f8a3e,_0xdcb6('0xf'));logger[_0xdcb6('0x10')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4f8a3e,_0xdcb6('0xf'),JSON[_0xdcb6('0x11')](_0x30b7d9));if(_0x30b7d9[_0xdcb6('0x12')]){if(_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x13')]===0x1f4){logger[_0xdcb6('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4f8a3e,_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x14')]);return _0x3ba05f(_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x14')]);}logger[_0xdcb6('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4f8a3e,_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x14')]);return _0x1748f7(_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x14')]);}else{logger[_0xdcb6('0xe')](_0xdcb6('0x15'),_0x4f8a3e,_0xdcb6('0xf'));_0x1748f7(_0x30b7d9['result'][_0xdcb6('0x14')]);}})[_0xdcb6('0x16')](function(_0x1d49ed){logger[_0xdcb6('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4f8a3e,_0x1d49ed);_0x3ba05f(_0x1d49ed);});});}exports['GetFaxAccount']=function(_0x39513c){var _0x1fd362=this;return new Promise(function(_0xa50dc9,_0x35b2b8){return db[_0xdcb6('0x17')][_0xdcb6('0x18')]({'raw':_0x39513c[_0xdcb6('0x19')]?_0x39513c[_0xdcb6('0x19')][_0xdcb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x39513c[_0xdcb6('0x19')]?_0x39513c['options']['where']||null:null,'attributes':_0x39513c['options']?_0x39513c[_0xdcb6('0x19')][_0xdcb6('0x1b')]||null:null,'limit':_0x39513c[_0xdcb6('0x19')]?_0x39513c[_0xdcb6('0x19')][_0xdcb6('0x1c')]||null:null,'include':_0x39513c['options']?_0x39513c[_0xdcb6('0x19')]['include']?_[_0xdcb6('0x1d')](_0x39513c[_0xdcb6('0x19')]['include'],function(_0x4cc381){return{'model':db[_0x4cc381[_0xdcb6('0x1e')]],'as':_0x4cc381['as'],'attributes':_0x4cc381[_0xdcb6('0x1b')],'include':_0x4cc381[_0xdcb6('0x1f')]?_[_0xdcb6('0x1d')](_0x4cc381['include'],function(_0x575c65){return{'model':db[_0x575c65[_0xdcb6('0x1e')]],'as':_0x575c65['as'],'attributes':_0x575c65[_0xdcb6('0x1b')],'include':_0x575c65[_0xdcb6('0x1f')]?_['map'](_0x575c65[_0xdcb6('0x1f')],function(_0x36a552){return{'model':db[_0x36a552[_0xdcb6('0x1e')]],'as':_0x36a552['as'],'attributes':_0x36a552[_0xdcb6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdcb6('0xd')](function(_0x444c06){logger[_0xdcb6('0xe')](_0xdcb6('0x20'),_0x39513c);logger[_0xdcb6('0x10')](_0xdcb6('0x20'),_0x39513c,JSON[_0xdcb6('0x11')](_0x444c06));_0xa50dc9(_0x444c06);})[_0xdcb6('0x16')](function(_0x432623){logger[_0xdcb6('0x12')](_0xdcb6('0x20'),_0x432623[_0xdcb6('0x14')],_0x39513c);_0x35b2b8(_0x1fd362[_0xdcb6('0x12')](0x1f4,_0x432623[_0xdcb6('0x14')]));});});};exports[_0xdcb6('0x21')]=function(_0x5866a7,_0x51bb38,_0xc5d006){var _0x3ae8cb=this;return new Promise(function(_0x2e1bc1,_0xaa3d55){var _0x54694c={'body':_0x5866a7[_0xdcb6('0x22')],'channel':'fax'};var _0x4a364c=[];var _0x5b7a7b=[];var _0x5dc99c={};return db[_0xdcb6('0x23')][_0xdcb6('0x24')]()['then'](function(_0x46e389){if(!_0x46e389){throw new db[(_0xdcb6('0x25'))][(_0xdcb6('0x26'))](_0xdcb6('0x27'));}_0x4a364c=_[_0xdcb6('0x28')](_[_0xdcb6('0x29')](_0x46e389),[_0xdcb6('0x2a'),_0xdcb6('0x2b')]);_0x5b7a7b=_[_0xdcb6('0x28')](_[_0xdcb6('0x29')](_0x46e389),[_0xdcb6('0x2a'),_0xdcb6('0x2b'),_0xdcb6('0x2c'),'ListId']);if(_0x5866a7[_0xdcb6('0x22')]['id']){delete _0x5866a7[_0xdcb6('0x22')]['id'];}if(_[_0xdcb6('0x2d')](_0x5866a7[_0xdcb6('0x22')]['from'])){throw new db[(_0xdcb6('0x25'))][(_0xdcb6('0x26'))](_0xdcb6('0x2e'));}if(_[_0xdcb6('0x2d')](_0x5866a7['body'][_0xdcb6('0x22')])||_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x22')]===''){throw new db[(_0xdcb6('0x25'))]['ValidationError'](_0xdcb6('0x2f'));}if(_['isNil'](_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x30')])){throw new db[(_0xdcb6('0x25'))][(_0xdcb6('0x26'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b7a7b);}if(!_[_0xdcb6('0x31')](_0x5b7a7b,_0x5866a7['body'][_0xdcb6('0x30')])){throw new db[(_0xdcb6('0x25'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b7a7b);}_0x5dc99c[_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x30')]]=_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x32')];})[_0xdcb6('0xd')](function(){return db[_0xdcb6('0x17')][_0xdcb6('0x33')]({'where':{'id':_0x5866a7[_0xdcb6('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0xdcb6('0x35'),'include':[{'model':db[_0xdcb6('0x23')],'as':_0xdcb6('0x36'),'where':_0x5dc99c,'limit':0x1,'order':[[_0xdcb6('0x2b'),_0xdcb6('0x37')]]}]},{'model':db[_0xdcb6('0x38')],'as':_0xdcb6('0x39')}]});})[_0xdcb6('0xd')](function(_0x26bd2c){if(_0x26bd2c&&_0x26bd2c[_0xdcb6('0x35')]){var _0x4a0a6e=_0x26bd2c[_0xdcb6('0x3a')]({'plain':!![]});_0x54694c[_0xdcb6('0x34')]=_0x4a0a6e;_0x54694c[_0xdcb6('0x3b')]=_0x4a0a6e[_0xdcb6('0x39')];_0x54694c['list']=_0x4a0a6e['List'];_0x54694c[_0xdcb6('0x3b')]=_[_0xdcb6('0x3c')](_0x54694c[_0xdcb6('0x3b')],[_0xdcb6('0x3d')],['asc']);if(_0x54694c[_0xdcb6('0x34')][_0xdcb6('0x39')]){delete _0x54694c[_0xdcb6('0x34')]['Applications'];}if(_0x54694c[_0xdcb6('0x34')]['List']&&_0x54694c[_0xdcb6('0x34')][_0xdcb6('0x35')][_0xdcb6('0x36')]['length']){return _0x54694c[_0xdcb6('0x34')]['List'][_0xdcb6('0x36')][0x0];}var _0x2357a3=_[_0xdcb6('0x3e')](_0x5866a7[_0xdcb6('0x22')],{'firstName':_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x32')],'ListId':_0x4a0a6e[_0xdcb6('0x3f')]});_0x2357a3[_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x30')]]=_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x32')];return db['CmContact'][_0xdcb6('0x40')](_0x2357a3,{'fields':_0x4a364c,'raw':!![]});}})[_0xdcb6('0xd')](function(_0x4b9149){_0x54694c[_0xdcb6('0x41')]=_0x4b9149;if(_0x4b9149){var _0x516efe={'ContactId':_0x4b9149['id'],'FaxAccountId':_0x5866a7[_0xdcb6('0x34')]['id'],'fax':_0x4b9149[_0xdcb6('0x42')]};return db['FaxInteraction'][_0xdcb6('0x33')]({'where':{'ContactId':_0x4b9149['id'],'closed':![],'FaxAccountId':_0x5866a7['account']['id']}})[_0xdcb6('0xd')](function(_0x1829f5){if(_0x1829f5){return[_0x1829f5,![]];}return db[_0xdcb6('0x43')][_0xdcb6('0x40')](_0x516efe)[_0xdcb6('0xd')](function(_0x5b4ffa){return[_0x5b4ffa,!![]];});});}else{throw new Error(_0xdcb6('0x44'));}})[_0xdcb6('0x45')](function(_0x2332a0,_0x50eb92){var _0x23c94a=_0x2332a0[_0xdcb6('0x3a')]({'plain':!![]});if(_0x50eb92){if(_0x54694c[_0xdcb6('0x34')][_0xdcb6('0x46')]){_0x54694c[_0xdcb6('0x3b')]['push']({'id':0x0,'priority':_0x54694c[_0xdcb6('0x3b')][_0xdcb6('0x47')]+0x1,'app':_0xdcb6('0x48'),'appdata':_0xdcb6('0x49'),'interval':'*,*,*,*'});}_0x23c94a[_0xdcb6('0x4a')]=!![];}else{_0x23c94a[_0xdcb6('0x4a')]=![];}_0x54694c[_0xdcb6('0x4b')]=_0x23c94a;return db[_0xdcb6('0x4c')][_0xdcb6('0x40')]({'body':_0x5866a7['body'][_0xdcb6('0x22')],'FaxAccountId':_0x5866a7[_0xdcb6('0x34')]['id'],'FaxInteractionId':_0x2332a0['id'],'direction':'in','ContactId':_0x2332a0[_0xdcb6('0x4d')],'AttachmentId':_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x4e')]});})['then'](function(_0x9d66c6){_0x54694c['message']=_0x9d66c6;if(!_0x54694c['interaction']['UserId'])return;return db['User'][_0xdcb6('0x33')]({'attributes':['id','name'],'where':{'id':_0x54694c[_0xdcb6('0x4b')][_0xdcb6('0x4f')]}});})['then'](function(_0x4d6841){if(_0x4d6841){_0x54694c[_0xdcb6('0x3b')][_0xdcb6('0x50')]({'id':0x0,'priority':0x0,'app':_0xdcb6('0x51'),'appdata':_0x4d6841[_0xdcb6('0x52')]+','+(_0x54694c[_0xdcb6('0x34')]['waitForTheAssignedAgent']||0xa),'interval':_0xdcb6('0x53')});}if(!_0x54694c[_0xdcb6('0x4b')][_0xdcb6('0x54')])return;return db[_0xdcb6('0x55')][_0xdcb6('0x33')]({'attributes':['id',_0xdcb6('0x52')],'where':{'id':_0x54694c['interaction']['queueId']}});})[_0xdcb6('0xd')](function(_0x32fa67){if(_0x32fa67){_0x54694c[_0xdcb6('0x3b')]['unshift']({'id':0x0,'priority':0x1,'app':_0xdcb6('0x56'),'appdata':_0x32fa67[_0xdcb6('0x52')]+','+(_0x54694c[_0xdcb6('0x34')][_0xdcb6('0x57')]||0x12c),'interval':_0xdcb6('0x53')});}return respondWithRpcPromise('Start',_0xdcb6('0x58'),_0x54694c);})['then'](function(_0x54b743){_0x2e1bc1(_0x54b743);})[_0xdcb6('0x16')](function(_0x5b25a5){_0xaa3d55(_0x3ae8cb[_0xdcb6('0x12')](0x1f4,_0x5b25a5[_0xdcb6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cf362ea..75add87 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 _0x85c2=['removeListener','register','length','./faxAccount.events','save','remove','update'];(function(_0x59155c,_0x586361){var _0x35423b=function(_0x290acc){while(--_0x290acc){_0x59155c['push'](_0x59155c['shift']());}};_0x35423b(++_0x586361);}(_0x85c2,0x168));var _0x285c=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x85c2[_0x1035c1];return _0x308d67;};'use strict';var FaxAccountEvents=require(_0x285c('0x0'));var events=[_0x285c('0x1'),_0x285c('0x2'),_0x285c('0x3')];function createListener(_0x15b730,_0x44a2c3){return function(_0x26440e){_0x44a2c3['emit'](_0x15b730,_0x26440e);};}function removeListener(_0x4f2efc,_0x3b5e0a){return function(){FaxAccountEvents[_0x285c('0x4')](_0x4f2efc,_0x3b5e0a);};}exports[_0x285c('0x5')]=function(_0x1552c2){for(var _0x1732ee=0x0,_0x2ace8a=events[_0x285c('0x6')];_0x1732ee<_0x2ace8a;_0x1732ee++){var _0x4056cc=events[_0x1732ee];var _0x54d491=createListener('faxAccount:'+_0x4056cc,_0x1552c2);FaxAccountEvents['on'](_0x4056cc,_0x54d491);}}; \ No newline at end of file +var _0xe95b=['remove','update','emit','removeListener','register','faxAccount:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe95b,0x99));var _0xbe95=function(_0x3d9b22,_0xa968b7){_0x3d9b22=_0x3d9b22-0x0;var _0x30390f=_0xe95b[_0x3d9b22];return _0x30390f;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xbe95('0x0'),_0xbe95('0x1'),_0xbe95('0x2')];function createListener(_0x556373,_0xa73011){return function(_0x35a0eb){_0xa73011[_0xbe95('0x3')](_0x556373,_0x35a0eb);};}function removeListener(_0x2f8970,_0x2f5113){return function(){FaxAccountEvents[_0xbe95('0x4')](_0x2f8970,_0x2f5113);};}exports[_0xbe95('0x5')]=function(_0x3f5d8a){for(var _0x2ce5e2=0x0,_0x5a8b8c=events['length'];_0x2ce5e2<_0x5a8b8c;_0x2ce5e2++){var _0x3a0e5e=events[_0x2ce5e2];var _0x1fe721=createListener(_0xbe95('0x6')+_0x3a0e5e,_0x3f5d8a);FaxAccountEvents['on'](_0x3a0e5e,_0x1fe721);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 393004c..9b23e53 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 _0x34e1=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2dc11a,_0x1caf06){var _0xd6d9d2=function(_0x316248){while(--_0x316248){_0x2dc11a['push'](_0x2dc11a['shift']());}};_0xd6d9d2(++_0x1caf06);}(_0x34e1,0xcd));var _0x134e=function(_0x4050a2,_0x185d9d){_0x4050a2=_0x4050a2-0x0;var _0x2fea5c=_0x34e1[_0x4050a2];return _0x2fea5c;};'use strict';var multer=require(_0x134e('0x0'));var util=require(_0x134e('0x1'));var path=require('path');var timeout=require(_0x134e('0x2'));var express=require(_0x134e('0x3'));var router=express[_0x134e('0x4')]();var fs_extra=require(_0x134e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x134e('0x6'));var config=require(_0x134e('0x7'));var controller=require(_0x134e('0x8'));router[_0x134e('0x9')]('/',auth[_0x134e('0xa')](),controller[_0x134e('0xb')]);router[_0x134e('0x9')](_0x134e('0xc'),auth[_0x134e('0xa')](),controller[_0x134e('0xd')]);router['get'](_0x134e('0xe'),auth[_0x134e('0xa')](),controller[_0x134e('0xf')]);router[_0x134e('0x9')](_0x134e('0x10'),auth[_0x134e('0xa')](),controller[_0x134e('0x11')]);router[_0x134e('0x9')](_0x134e('0x12'),auth['isAuthenticated'](),controller[_0x134e('0x13')]);router[_0x134e('0x9')](_0x134e('0x14'),auth[_0x134e('0xa')](),controller['getInteractions']);router[_0x134e('0x9')](_0x134e('0x15'),auth[_0x134e('0xa')](),controller[_0x134e('0x16')]);router['get']('/:id/messages',auth[_0x134e('0xa')](),controller[_0x134e('0x17')]);router['get'](_0x134e('0x18'),auth[_0x134e('0xa')](),controller[_0x134e('0x19')]);router['post']('/',auth[_0x134e('0xa')](),controller[_0x134e('0x1a')]);router[_0x134e('0x1b')](_0x134e('0x10'),auth['isAuthenticated'](),controller[_0x134e('0x1c')]);router[_0x134e('0x1b')](_0x134e('0x12'),auth[_0x134e('0xa')](),controller[_0x134e('0x1d')]);router[_0x134e('0x1b')](_0x134e('0x14'),auth[_0x134e('0xa')](),controller[_0x134e('0x1e')]);router[_0x134e('0x1b')](_0x134e('0x15'),auth[_0x134e('0xa')](),controller[_0x134e('0x1f')]);router[_0x134e('0x1b')](_0x134e('0x20'),auth[_0x134e('0xa')](),controller[_0x134e('0x21')]);router[_0x134e('0x1b')](_0x134e('0x22'),auth[_0x134e('0xa')](),controller[_0x134e('0x23')]);router[_0x134e('0x1b')]('/:id/send',auth[_0x134e('0xa')](),controller['send']);router[_0x134e('0x1b')](_0x134e('0x18'),auth[_0x134e('0xa')](),controller[_0x134e('0x24')]);router[_0x134e('0x25')](_0x134e('0xe'),auth['isAuthenticated'](),controller[_0x134e('0x26')]);router[_0x134e('0x27')](_0x134e('0xe'),auth['isAuthenticated'](),controller[_0x134e('0x28')]);router[_0x134e('0x27')](_0x134e('0x10'),auth[_0x134e('0xa')](),controller[_0x134e('0x29')]);router[_0x134e('0x27')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x134e('0x27')]('/:id/users',auth[_0x134e('0xa')](),controller[_0x134e('0x2a')]);module[_0x134e('0x2b')]=router; \ No newline at end of file +var _0x0926=['getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','/describe','/:id','isAuthenticated','show','/:id/dispositions'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x0926,0x118));var _0x6092=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x0926[_0x31b5b2];return _0x364f13;};'use strict';var multer=require(_0x6092('0x0'));var util=require(_0x6092('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6092('0x2'));var router=express[_0x6092('0x3')]();var fs_extra=require(_0x6092('0x4'));var auth=require(_0x6092('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6092('0x6'));var controller=require(_0x6092('0x7'));router[_0x6092('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6092('0x8')](_0x6092('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6092('0x8')](_0x6092('0xa'),auth[_0x6092('0xb')](),controller[_0x6092('0xc')]);router[_0x6092('0x8')](_0x6092('0xd'),auth[_0x6092('0xb')](),controller[_0x6092('0xe')]);router['get'](_0x6092('0xf'),auth[_0x6092('0xb')](),controller['getAnswers']);router['get'](_0x6092('0x10'),auth[_0x6092('0xb')](),controller[_0x6092('0x11')]);router[_0x6092('0x8')](_0x6092('0x12'),auth[_0x6092('0xb')](),controller[_0x6092('0x13')]);router[_0x6092('0x8')](_0x6092('0x14'),auth[_0x6092('0xb')](),controller[_0x6092('0x15')]);router[_0x6092('0x8')](_0x6092('0x16'),auth[_0x6092('0xb')](),controller[_0x6092('0x17')]);router['post']('/',auth[_0x6092('0xb')](),controller[_0x6092('0x18')]);router[_0x6092('0x19')](_0x6092('0xd'),auth[_0x6092('0xb')](),controller[_0x6092('0x1a')]);router[_0x6092('0x19')]('/:id/canned_answers',auth[_0x6092('0xb')](),controller[_0x6092('0x1b')]);router[_0x6092('0x19')](_0x6092('0x10'),auth[_0x6092('0xb')](),controller[_0x6092('0x1c')]);router['post'](_0x6092('0x12'),auth['isAuthenticated'](),controller[_0x6092('0x1d')]);router[_0x6092('0x19')]('/addaccountapplications',auth[_0x6092('0xb')](),controller[_0x6092('0x1e')]);router[_0x6092('0x19')]('/updateaccountapplications',auth[_0x6092('0xb')](),controller[_0x6092('0x1f')]);router['post'](_0x6092('0x20'),auth['isAuthenticated'](),controller[_0x6092('0x21')]);router[_0x6092('0x19')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x6092('0x22')](_0x6092('0xa'),auth[_0x6092('0xb')](),controller[_0x6092('0x23')]);router[_0x6092('0x24')](_0x6092('0xa'),auth[_0x6092('0xb')](),controller[_0x6092('0x25')]);router[_0x6092('0x24')](_0x6092('0xd'),auth[_0x6092('0xb')](),controller[_0x6092('0x26')]);router[_0x6092('0x24')](_0x6092('0xf'),auth[_0x6092('0xb')](),controller[_0x6092('0x27')]);router[_0x6092('0x24')](_0x6092('0x16'),auth[_0x6092('0xb')](),controller[_0x6092('0x28')]);module[_0x6092('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 29a366e..5bac339 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 _0x161d=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1a9364,_0x24304b){var _0x58640d=function(_0x47a58b){while(--_0x47a58b){_0x1a9364['push'](_0x1a9364['shift']());}};_0x58640d(++_0x24304b);}(_0x161d,0x13b));var _0xd161=function(_0x543538,_0x52c8f0){_0x543538=_0x543538-0x0;var _0x35fa8c=_0x161d[_0x543538];return _0x35fa8c;};'use strict';var Sequelize=require(_0xd161('0x0'));module[_0xd161('0x1')]={'priority':{'type':Sequelize[_0xd161('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd161('0x3')],'allowNull':![],'defaultValue':_0xd161('0x4')},'appdata':{'type':Sequelize[_0xd161('0x5')]()},'description':{'type':Sequelize[_0xd161('0x3')]},'interval':{'type':Sequelize[_0xd161('0x3')],'defaultValue':_0xd161('0x6')}}; \ No newline at end of file +var _0x6d76=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0xee2850,_0x4a076a){var _0x51f866=function(_0x392174){while(--_0x392174){_0xee2850['push'](_0xee2850['shift']());}};_0x51f866(++_0x4a076a);}(_0x6d76,0x13a));var _0x66d7=function(_0x55a6da,_0x2b84ec){_0x55a6da=_0x55a6da-0x0;var _0x132462=_0x6d76[_0x55a6da];return _0x132462;};'use strict';var Sequelize=require('sequelize');module[_0x66d7('0x0')]={'priority':{'type':Sequelize[_0x66d7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x66d7('0x2')],'allowNull':![],'defaultValue':_0x66d7('0x3')},'appdata':{'type':Sequelize[_0x66d7('0x4')]()},'description':{'type':Sequelize[_0x66d7('0x2')]},'interval':{'type':Sequelize[_0x66d7('0x2')],'defaultValue':_0x66d7('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4d2f04b..ae04315 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 _0x0444=['merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','eml-format','zip-dir','bluebird','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0x0444,0xe5));var _0x4044=function(_0x131b43,_0x308d50){_0x131b43=_0x131b43-0x0;var _0x199734=_0x0444[_0x131b43];return _0x199734;};'use strict';var emlformat=require(_0x4044('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4044('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4044('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4044('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4044('0x4'));var _=require(_0x4044('0x5'));var squel=require(_0x4044('0x6'));var crypto=require(_0x4044('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x4044('0x8'));var toCsv=require('to-csv');var querystring=require(_0x4044('0x9'));var Papa=require(_0x4044('0xa'));var Redis=require(_0x4044('0xb'));var authService=require(_0x4044('0xc'));var qs=require(_0x4044('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4044('0xe'))(_0x4044('0xf'));var utils=require(_0x4044('0x10'));var config=require(_0x4044('0x11'));var licenseUtil=require(_0x4044('0x12'));var db=require(_0x4044('0x13'))['db'];function respondWithStatusCode(_0x1b9e7e,_0x1285a2){_0x1285a2=_0x1285a2||0xcc;return function(_0x472f63){if(_0x472f63){return _0x1b9e7e[_0x4044('0x14')](_0x1285a2);}return _0x1b9e7e['status'](_0x1285a2)[_0x4044('0x15')]();};}function respondWithResult(_0x39a190,_0x300600){_0x300600=_0x300600||0xc8;return function(_0x3c4892){if(_0x3c4892){return _0x39a190[_0x4044('0x16')](_0x300600)[_0x4044('0x17')](_0x3c4892);}};}function respondWithFilteredResult(_0x541720,_0x58b957){return function(_0x1288ee){if(_0x1288ee){var _0x552fa8=typeof _0x58b957[_0x4044('0x18')]===_0x4044('0x19')&&typeof _0x58b957[_0x4044('0x1a')]===_0x4044('0x19');var _0x428d79=_0x1288ee['count'];var _0x57a1d8=_0x552fa8?0x0:_0x58b957['offset'];var _0xbf2ba9=_0x552fa8?_0x1288ee['count']:_0x58b957['offset']+_0x58b957[_0x4044('0x1a')];var _0x274984;if(_0xbf2ba9>=_0x428d79){_0xbf2ba9=_0x428d79;_0x274984=0xc8;}else{_0x274984=0xce;}_0x541720['status'](_0x274984);return _0x541720[_0x4044('0x1b')](_0x4044('0x1c'),_0x57a1d8+'-'+_0xbf2ba9+'/'+_0x428d79)[_0x4044('0x17')](_0x1288ee);}return null;};}function patchUpdates(_0x3b18ef){return function(_0x20468b){try{jsonpatch[_0x4044('0x1d')](_0x20468b,_0x3b18ef,!![]);}catch(_0x3e9989){return BPromise['reject'](_0x3e9989);}return _0x20468b[_0x4044('0x1e')]();};}function saveUpdates(_0x7db6c1,_0x56335c){return function(_0x630a0e){if(_0x630a0e){return _0x630a0e[_0x4044('0x1f')](_0x7db6c1)[_0x4044('0x20')](function(_0x33409d){return _0x33409d;});}return null;};}function removeEntity(_0x4f6efd,_0x81718f){return function(_0x3f2ce3){if(_0x3f2ce3){return _0x3f2ce3[_0x4044('0x21')]()[_0x4044('0x20')](function(){_0x4f6efd[_0x4044('0x16')](0xcc)[_0x4044('0x15')]();});}};}function handleEntityNotFound(_0x2d58ee,_0x1a00e7){return function(_0x38a465){if(!_0x38a465){_0x2d58ee[_0x4044('0x14')](0x194);}return _0x38a465;};}function handleError(_0x3ffe3d,_0x115f9c){_0x115f9c=_0x115f9c||0x1f4;return function(_0x296c6a){logger[_0x4044('0x22')](_0x296c6a[_0x4044('0x23')]);if(_0x296c6a[_0x4044('0x24')]){delete _0x296c6a['name'];}_0x3ffe3d[_0x4044('0x16')](_0x115f9c)[_0x4044('0x25')](_0x296c6a);};}exports[_0x4044('0x26')]=function(_0xfa1e30,_0x2abff2){var _0x5a8ec9={},_0x11176f={},_0x87730f={'count':0x0,'rows':[]};var _0x1da7cf=_[_0x4044('0x27')](db[_0x4044('0x28')]['rawAttributes'],function(_0x346342){return{'name':_0x346342[_0x4044('0x29')],'type':_0x346342['type'][_0x4044('0x2a')]};});_0x11176f[_0x4044('0x2b')]=_['map'](_0x1da7cf,_0x4044('0x24'));_0x11176f[_0x4044('0x2c')]=_['keys'](_0xfa1e30[_0x4044('0x2c')]);_0x11176f[_0x4044('0x2d')]=_[_0x4044('0x2e')](_0x11176f[_0x4044('0x2b')],_0x11176f[_0x4044('0x2c')]);_0x5a8ec9[_0x4044('0x2f')]=_[_0x4044('0x2e')](_0x11176f[_0x4044('0x2b')],qs[_0x4044('0x30')](_0xfa1e30['query'][_0x4044('0x30')]));_0x5a8ec9[_0x4044('0x2f')]=_0x5a8ec9[_0x4044('0x2f')][_0x4044('0x31')]?_0x5a8ec9[_0x4044('0x2f')]:_0x11176f[_0x4044('0x2b')];if(!_0xfa1e30[_0x4044('0x2c')][_0x4044('0x32')]('nolimit')){_0x5a8ec9[_0x4044('0x1a')]=qs[_0x4044('0x1a')](_0xfa1e30[_0x4044('0x2c')]['limit']);_0x5a8ec9['offset']=qs[_0x4044('0x18')](_0xfa1e30[_0x4044('0x2c')][_0x4044('0x18')]);}_0x5a8ec9[_0x4044('0x33')]=qs['sort'](_0xfa1e30[_0x4044('0x2c')]['sort']);_0x5a8ec9[_0x4044('0x34')]=qs['filters'](_[_0x4044('0x35')](_0xfa1e30[_0x4044('0x2c')],_0x11176f[_0x4044('0x2d')]),_0x1da7cf);if(_0xfa1e30[_0x4044('0x2c')][_0x4044('0x36')]){_0x5a8ec9[_0x4044('0x34')]=_[_0x4044('0x37')](_0x5a8ec9[_0x4044('0x34')],{'$or':_['map'](_0x1da7cf,function(_0x485e0b){if(_0x485e0b['type']!==_0x4044('0x38')){var _0x165b20={};_0x165b20[_0x485e0b[_0x4044('0x24')]]={'$like':'%'+_0xfa1e30[_0x4044('0x2c')][_0x4044('0x36')]+'%'};return _0x165b20;}})});}_0x5a8ec9=_['merge']({},_0x5a8ec9,_0xfa1e30[_0x4044('0x39')]);var _0x2c4fa7={'where':_0x5a8ec9[_0x4044('0x34')]};return db[_0x4044('0x28')][_0x4044('0x3a')](_0x2c4fa7)['then'](function(_0x6f2df9){_0x87730f[_0x4044('0x3a')]=_0x6f2df9;if(_0xfa1e30[_0x4044('0x2c')][_0x4044('0x3b')]){_0x5a8ec9[_0x4044('0x3c')]=[{'all':!![]}];}return db[_0x4044('0x28')][_0x4044('0x3d')](_0x5a8ec9);})['then'](function(_0x119f62){_0x87730f[_0x4044('0x3e')]=_0x119f62;return _0x87730f;})[_0x4044('0x20')](respondWithFilteredResult(_0x2abff2,_0x5a8ec9))[_0x4044('0x3f')](handleError(_0x2abff2,null));};exports[_0x4044('0x40')]=function(_0x219c80,_0x388c3c){var _0x3f7646={'raw':!![],'where':{'id':_0x219c80[_0x4044('0x41')]['id']}},_0x2b2bfa={};_0x2b2bfa[_0x4044('0x2b')]=_['keys'](db[_0x4044('0x28')][_0x4044('0x42')]);_0x2b2bfa[_0x4044('0x2c')]=_[_0x4044('0x43')](_0x219c80[_0x4044('0x2c')]);_0x2b2bfa[_0x4044('0x2d')]=_['intersection'](_0x2b2bfa[_0x4044('0x2b')],_0x2b2bfa['query']);_0x3f7646['attributes']=_[_0x4044('0x2e')](_0x2b2bfa[_0x4044('0x2b')],qs['fields'](_0x219c80['query'][_0x4044('0x30')]));_0x3f7646[_0x4044('0x2f')]=_0x3f7646[_0x4044('0x2f')]['length']?_0x3f7646['attributes']:_0x2b2bfa[_0x4044('0x2b')];if(_0x219c80[_0x4044('0x2c')][_0x4044('0x3b')]){_0x3f7646[_0x4044('0x3c')]=[{'all':!![]}];}_0x3f7646=_[_0x4044('0x37')]({},_0x3f7646,_0x219c80[_0x4044('0x39')]);return db[_0x4044('0x28')][_0x4044('0x44')](_0x3f7646)[_0x4044('0x20')](handleEntityNotFound(_0x388c3c,null))['then'](respondWithResult(_0x388c3c,null))[_0x4044('0x3f')](handleError(_0x388c3c,null));};exports[_0x4044('0x45')]=function(_0x4fda6f,_0x5c87b8){return db[_0x4044('0x28')]['create'](_0x4fda6f[_0x4044('0x46')],{})['then'](respondWithResult(_0x5c87b8,0xc9))[_0x4044('0x3f')](handleError(_0x5c87b8,null));};exports[_0x4044('0x1f')]=function(_0x271b94,_0xf264fd){if(_0x271b94[_0x4044('0x46')]['id']){delete _0x271b94[_0x4044('0x46')]['id'];}return db[_0x4044('0x28')][_0x4044('0x44')]({'where':{'id':_0x271b94['params']['id']}})[_0x4044('0x20')](handleEntityNotFound(_0xf264fd,null))[_0x4044('0x20')](saveUpdates(_0x271b94[_0x4044('0x46')],null))[_0x4044('0x20')](respondWithResult(_0xf264fd,null))[_0x4044('0x3f')](handleError(_0xf264fd,null));};exports[_0x4044('0x21')]=function(_0x92f2a5,_0x2d56ef){return db['FaxApplication'][_0x4044('0x44')]({'where':{'id':_0x92f2a5[_0x4044('0x41')]['id']}})[_0x4044('0x20')](handleEntityNotFound(_0x2d56ef,null))[_0x4044('0x20')](removeEntity(_0x2d56ef,null))['catch'](handleError(_0x2d56ef,null));}; \ No newline at end of file +var _0x86dd=['ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','json','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','show','create','catch','body','params','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x3f6fea,_0x35f25e){var _0x208e6b=function(_0xd6e09){while(--_0xd6e09){_0x3f6fea['push'](_0x3f6fea['shift']());}};_0x208e6b(++_0x35f25e);}(_0x86dd,0x1a7));var _0xd86d=function(_0x1cb6e9,_0x18f418){_0x1cb6e9=_0x1cb6e9-0x0;var _0x350dfd=_0x86dd[_0x1cb6e9];return _0x350dfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd86d('0x0'));var zipdir=require(_0xd86d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd86d('0x2'));var moment=require(_0xd86d('0x3'));var BPromise=require(_0xd86d('0x4'));var Mustache=require(_0xd86d('0x5'));var util=require(_0xd86d('0x6'));var path=require(_0xd86d('0x7'));var sox=require('sox');var csv=require(_0xd86d('0x8'));var ejs=require(_0xd86d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd86d('0xa'));var squel=require(_0xd86d('0xb'));var crypto=require('crypto');var jsforce=require(_0xd86d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd86d('0x8'));var querystring=require(_0xd86d('0xd'));var Papa=require(_0xd86d('0xe'));var Redis=require(_0xd86d('0xf'));var authService=require(_0xd86d('0x10'));var qs=require(_0xd86d('0x11'));var as=require(_0xd86d('0x12'));var hardwareService=require(_0xd86d('0x13'));var logger=require(_0xd86d('0x14'))(_0xd86d('0x15'));var utils=require(_0xd86d('0x16'));var config=require(_0xd86d('0x17'));var licenseUtil=require(_0xd86d('0x18'));var db=require(_0xd86d('0x19'))['db'];function respondWithStatusCode(_0x5b1dcb,_0x5879c6){_0x5879c6=_0x5879c6||0xcc;return function(_0x72998){if(_0x72998){return _0x5b1dcb[_0xd86d('0x1a')](_0x5879c6);}return _0x5b1dcb[_0xd86d('0x1b')](_0x5879c6)[_0xd86d('0x1c')]();};}function respondWithResult(_0x4842cc,_0x1f11ea){_0x1f11ea=_0x1f11ea||0xc8;return function(_0x101676){if(_0x101676){return _0x4842cc[_0xd86d('0x1b')](_0x1f11ea)['json'](_0x101676);}};}function respondWithFilteredResult(_0x97b8dc,_0x3931dd){return function(_0xa78889){if(_0xa78889){var _0x54ecff=typeof _0x3931dd['offset']==='undefined'&&typeof _0x3931dd['limit']===_0xd86d('0x1d');var _0x217f9c=_0xa78889[_0xd86d('0x1e')];var _0x3afde1=_0x54ecff?0x0:_0x3931dd[_0xd86d('0x1f')];var _0x4eaeaf=_0x54ecff?_0xa78889[_0xd86d('0x1e')]:_0x3931dd[_0xd86d('0x1f')]+_0x3931dd['limit'];var _0x2cc5ab;if(_0x4eaeaf>=_0x217f9c){_0x4eaeaf=_0x217f9c;_0x2cc5ab=0xc8;}else{_0x2cc5ab=0xce;}_0x97b8dc[_0xd86d('0x1b')](_0x2cc5ab);return _0x97b8dc[_0xd86d('0x20')]('Content-Range',_0x3afde1+'-'+_0x4eaeaf+'/'+_0x217f9c)[_0xd86d('0x21')](_0xa78889);}return null;};}function patchUpdates(_0x5617e5){return function(_0x244ad5){try{jsonpatch['apply'](_0x244ad5,_0x5617e5,!![]);}catch(_0x15a63d){return BPromise[_0xd86d('0x22')](_0x15a63d);}return _0x244ad5[_0xd86d('0x23')]();};}function saveUpdates(_0x2da43f,_0x249a56){return function(_0x5cbeab){if(_0x5cbeab){return _0x5cbeab[_0xd86d('0x24')](_0x2da43f)[_0xd86d('0x25')](function(_0x5ec414){return _0x5ec414;});}return null;};}function removeEntity(_0x4ccc3b,_0x323f52){return function(_0x4643e1){if(_0x4643e1){return _0x4643e1[_0xd86d('0x26')]()[_0xd86d('0x25')](function(){_0x4ccc3b[_0xd86d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58448a,_0x44628d){return function(_0x428053){if(!_0x428053){_0x58448a[_0xd86d('0x1a')](0x194);}return _0x428053;};}function handleError(_0x15cee6,_0x1ec96d){_0x1ec96d=_0x1ec96d||0x1f4;return function(_0x146141){logger['error'](_0x146141['stack']);if(_0x146141[_0xd86d('0x27')]){delete _0x146141[_0xd86d('0x27')];}_0x15cee6['status'](_0x1ec96d)[_0xd86d('0x28')](_0x146141);};}exports['index']=function(_0x1b32ee,_0x35d024){var _0x2e4a0c={},_0x2ae959={},_0x2cd273={'count':0x0,'rows':[]};var _0x2e060e=_[_0xd86d('0x29')](db['FaxApplication'][_0xd86d('0x2a')],function(_0x45d18f){return{'name':_0x45d18f[_0xd86d('0x2b')],'type':_0x45d18f[_0xd86d('0x2c')][_0xd86d('0x2d')]};});_0x2ae959['model']=_[_0xd86d('0x29')](_0x2e060e,_0xd86d('0x27'));_0x2ae959[_0xd86d('0x2e')]=_[_0xd86d('0x2f')](_0x1b32ee['query']);_0x2ae959[_0xd86d('0x30')]=_[_0xd86d('0x31')](_0x2ae959[_0xd86d('0x32')],_0x2ae959[_0xd86d('0x2e')]);_0x2e4a0c[_0xd86d('0x33')]=_[_0xd86d('0x31')](_0x2ae959[_0xd86d('0x32')],qs[_0xd86d('0x34')](_0x1b32ee['query']['fields']));_0x2e4a0c[_0xd86d('0x33')]=_0x2e4a0c['attributes'][_0xd86d('0x35')]?_0x2e4a0c[_0xd86d('0x33')]:_0x2ae959[_0xd86d('0x32')];if(!_0x1b32ee[_0xd86d('0x2e')]['hasOwnProperty']('nolimit')){_0x2e4a0c['limit']=qs['limit'](_0x1b32ee[_0xd86d('0x2e')][_0xd86d('0x36')]);_0x2e4a0c[_0xd86d('0x1f')]=qs[_0xd86d('0x1f')](_0x1b32ee[_0xd86d('0x2e')][_0xd86d('0x1f')]);}_0x2e4a0c['order']=qs[_0xd86d('0x37')](_0x1b32ee['query'][_0xd86d('0x37')]);_0x2e4a0c[_0xd86d('0x38')]=qs[_0xd86d('0x30')](_[_0xd86d('0x39')](_0x1b32ee[_0xd86d('0x2e')],_0x2ae959[_0xd86d('0x30')]),_0x2e060e);if(_0x1b32ee[_0xd86d('0x2e')][_0xd86d('0x3a')]){_0x2e4a0c[_0xd86d('0x38')]=_[_0xd86d('0x3b')](_0x2e4a0c[_0xd86d('0x38')],{'$or':_[_0xd86d('0x29')](_0x2e060e,function(_0x3860e9){if(_0x3860e9[_0xd86d('0x2c')]!==_0xd86d('0x3c')){var _0x5cf591={};_0x5cf591[_0x3860e9['name']]={'$like':'%'+_0x1b32ee[_0xd86d('0x2e')][_0xd86d('0x3a')]+'%'};return _0x5cf591;}})});}_0x2e4a0c=_['merge']({},_0x2e4a0c,_0x1b32ee[_0xd86d('0x3d')]);var _0x2b197d={'where':_0x2e4a0c[_0xd86d('0x38')]};return db[_0xd86d('0x3e')]['count'](_0x2b197d)[_0xd86d('0x25')](function(_0x4651fe){_0x2cd273[_0xd86d('0x1e')]=_0x4651fe;if(_0x1b32ee['query'][_0xd86d('0x3f')]){_0x2e4a0c[_0xd86d('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0xd86d('0x41')](_0x2e4a0c);})[_0xd86d('0x25')](function(_0x547c6d){_0x2cd273['rows']=_0x547c6d;return _0x2cd273;})[_0xd86d('0x25')](respondWithFilteredResult(_0x35d024,_0x2e4a0c))['catch'](handleError(_0x35d024,null));};exports[_0xd86d('0x42')]=function(_0x3744d5,_0x182fa9){var _0x4c38f5={'raw':!![],'where':{'id':_0x3744d5['params']['id']}},_0xcccace={};_0xcccace[_0xd86d('0x32')]=_['keys'](db[_0xd86d('0x3e')]['rawAttributes']);_0xcccace['query']=_['keys'](_0x3744d5[_0xd86d('0x2e')]);_0xcccace['filters']=_[_0xd86d('0x31')](_0xcccace[_0xd86d('0x32')],_0xcccace[_0xd86d('0x2e')]);_0x4c38f5[_0xd86d('0x33')]=_[_0xd86d('0x31')](_0xcccace['model'],qs[_0xd86d('0x34')](_0x3744d5[_0xd86d('0x2e')][_0xd86d('0x34')]));_0x4c38f5[_0xd86d('0x33')]=_0x4c38f5[_0xd86d('0x33')][_0xd86d('0x35')]?_0x4c38f5['attributes']:_0xcccace[_0xd86d('0x32')];if(_0x3744d5[_0xd86d('0x2e')]['includeAll']){_0x4c38f5[_0xd86d('0x40')]=[{'all':!![]}];}_0x4c38f5=_['merge']({},_0x4c38f5,_0x3744d5[_0xd86d('0x3d')]);return db[_0xd86d('0x3e')]['find'](_0x4c38f5)[_0xd86d('0x25')](handleEntityNotFound(_0x182fa9,null))[_0xd86d('0x25')](respondWithResult(_0x182fa9,null))['catch'](handleError(_0x182fa9,null));};exports[_0xd86d('0x43')]=function(_0x46d9c2,_0x4156ec){return db[_0xd86d('0x3e')][_0xd86d('0x43')](_0x46d9c2['body'],{})['then'](respondWithResult(_0x4156ec,0xc9))[_0xd86d('0x44')](handleError(_0x4156ec,null));};exports[_0xd86d('0x24')]=function(_0x334966,_0x24cced){if(_0x334966[_0xd86d('0x45')]['id']){delete _0x334966[_0xd86d('0x45')]['id'];}return db[_0xd86d('0x3e')]['find']({'where':{'id':_0x334966[_0xd86d('0x46')]['id']}})['then'](handleEntityNotFound(_0x24cced,null))[_0xd86d('0x25')](saveUpdates(_0x334966[_0xd86d('0x45')],null))['then'](respondWithResult(_0x24cced,null))[_0xd86d('0x44')](handleError(_0x24cced,null));};exports[_0xd86d('0x26')]=function(_0x3cec68,_0x22c998){return db['FaxApplication'][_0xd86d('0x47')]({'where':{'id':_0x3cec68[_0xd86d('0x46')]['id']}})[_0xd86d('0x25')](handleEntityNotFound(_0x22c998,null))['then'](removeEntity(_0x22c998,null))['catch'](handleError(_0x22c998,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1e5888b..085a3d4 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 _0x90e3=['rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x340cf6,_0xb5e3d){var _0x59ae2c=function(_0x3f50b0){while(--_0x3f50b0){_0x340cf6['push'](_0x340cf6['shift']());}};_0x59ae2c(++_0xb5e3d);}(_0x90e3,0xc5));var _0x390e=function(_0x517aba,_0x4814e5){_0x517aba=_0x517aba-0x0;var _0x246abe=_0x90e3[_0x517aba];return _0x246abe;};'use strict';var _=require('lodash');var util=require(_0x390e('0x0'));var logger=require(_0x390e('0x1'))(_0x390e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x390e('0x3'));var config=require(_0x390e('0x4'));var attributes=require('./faxApplication.attributes');module[_0x390e('0x5')]=function(_0x3fdfe0,_0x36287a){return _0x3fdfe0[_0x390e('0x6')](_0x390e('0x7'),attributes,{'tableName':_0x390e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x390e('0x9')});}; \ No newline at end of file +var _0x26ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util'];(function(_0x18023d,_0x1aa982){var _0x13cd6a=function(_0x24c179){while(--_0x24c179){_0x18023d['push'](_0x18023d['shift']());}};_0x13cd6a(++_0x1aa982);}(_0x26ac,0xf6));var _0xc26a=function(_0x107021,_0x47fd3f){_0x107021=_0x107021-0x0;var _0x12df45=_0x26ac[_0x107021];return _0x12df45;};'use strict';var _=require('lodash');var util=require(_0xc26a('0x0'));var logger=require('../../config/logger')(_0xc26a('0x1'));var moment=require(_0xc26a('0x2'));var BPromise=require(_0xc26a('0x3'));var rp=require(_0xc26a('0x4'));var fs=require('fs');var path=require(_0xc26a('0x5'));var rimraf=require(_0xc26a('0x6'));var config=require(_0xc26a('0x7'));var attributes=require('./faxApplication.attributes');module[_0xc26a('0x8')]=function(_0x273da6,_0xd91d55){return _0x273da6[_0xc26a('0x9')](_0xc26a('0xa'),attributes,{'tableName':_0xc26a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc26a('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index db7f2e9..fae7f43 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 _0x39a9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UpdateFaxApplication','update','body','options','raw','limit','stringify'];(function(_0x55336a,_0x240d59){var _0x28ceb3=function(_0x399d5c){while(--_0x399d5c){_0x55336a['push'](_0x55336a['shift']());}};_0x28ceb3(++_0x240d59);}(_0x39a9,0x1d0));var _0x939a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x39a9[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var moment=require(_0x939a('0x2'));var BPromise=require(_0x939a('0x3'));var rs=require(_0x939a('0x4'));var fs=require('fs');var Redis=require(_0x939a('0x5'));var db=require(_0x939a('0x6'))['db'];var utils=require(_0x939a('0x7'));var logger=require(_0x939a('0x8'))(_0x939a('0x9'));var config=require(_0x939a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x939a('0xb')][_0x939a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12cd66,_0x1c97c1,_0x3bed20){return new BPromise(function(_0xe6a08,_0x398389){return client[_0x939a('0xd')](_0x12cd66,_0x3bed20)['then'](function(_0x382b90){logger[_0x939a('0xe')](_0x939a('0xf'),_0x1c97c1,'request\x20sent');logger[_0x939a('0x10')](_0x939a('0x11'),_0x1c97c1,_0x939a('0x12'),JSON['stringify'](_0x382b90));if(_0x382b90[_0x939a('0x13')]){if(_0x382b90[_0x939a('0x13')][_0x939a('0x14')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x1c97c1,_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);return _0x398389(_0x382b90[_0x939a('0x13')]['message']);}logger[_0x939a('0x13')](_0x939a('0xf'),_0x1c97c1,_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);return _0xe6a08(_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);}else{logger[_0x939a('0xe')]('FaxApplication,\x20%s,\x20%s',_0x1c97c1,_0x939a('0x12'));_0xe6a08(_0x382b90['result'][_0x939a('0x15')]);}})['catch'](function(_0x42c937){logger[_0x939a('0x13')](_0x939a('0xf'),_0x1c97c1,_0x42c937);_0x398389(_0x42c937);});});}exports[_0x939a('0x16')]=function(_0x48741c){var _0x4e8e70=this;return new Promise(function(_0x2a78c1,_0x5e5dbd){return db['FaxApplication'][_0x939a('0x17')](_0x48741c[_0x939a('0x18')],{'raw':_0x48741c[_0x939a('0x19')]?_0x48741c[_0x939a('0x19')][_0x939a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48741c['options']?_0x48741c[_0x939a('0x19')]['where']||null:null,'attributes':_0x48741c[_0x939a('0x19')]?_0x48741c['options']['attributes']||null:null,'limit':_0x48741c[_0x939a('0x19')]?_0x48741c[_0x939a('0x19')][_0x939a('0x1b')]||null:null})['then'](function(_0x588ccf){logger['info'](_0x939a('0x16'),_0x48741c);logger['debug'](_0x939a('0x16'),_0x48741c,JSON[_0x939a('0x1c')](_0x588ccf));_0x2a78c1(_0x588ccf);})['catch'](function(_0x2b345c){logger['error'](_0x939a('0x16'),_0x2b345c['message'],_0x48741c);_0x5e5dbd(_0x4e8e70[_0x939a('0x13')](0x1f4,_0x2b345c[_0x939a('0x15')]));});});}; \ No newline at end of file +var _0xc955=['FaxApplication','update','options','raw','where','attributes','limit','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','catch','UpdateFaxApplication'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0xc955,0x80));var _0x5c95=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xc955[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0x5c95('0x0'));var util=require(_0x5c95('0x1'));var moment=require(_0x5c95('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c95('0x3'));var fs=require('fs');var Redis=require(_0x5c95('0x4'));var db=require(_0x5c95('0x5'))['db'];var utils=require(_0x5c95('0x6'));var logger=require(_0x5c95('0x7'))(_0x5c95('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c95('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590cc5,_0x4bf2cc,_0x20a038){return new BPromise(function(_0x44aa90,_0x21dff0){return client[_0x5c95('0xa')](_0x590cc5,_0x20a038)[_0x5c95('0xb')](function(_0x17afe5){logger[_0x5c95('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4bf2cc,_0x5c95('0xd'));logger['debug'](_0x5c95('0xe'),_0x4bf2cc,_0x5c95('0xd'),JSON[_0x5c95('0xf')](_0x17afe5));if(_0x17afe5[_0x5c95('0x10')]){if(_0x17afe5[_0x5c95('0x10')][_0x5c95('0x11')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4bf2cc,_0x17afe5[_0x5c95('0x10')][_0x5c95('0x12')]);return _0x21dff0(_0x17afe5['error'][_0x5c95('0x12')]);}logger[_0x5c95('0x10')](_0x5c95('0x13'),_0x4bf2cc,_0x17afe5[_0x5c95('0x10')][_0x5c95('0x12')]);return _0x44aa90(_0x17afe5[_0x5c95('0x10')][_0x5c95('0x12')]);}else{logger[_0x5c95('0xc')](_0x5c95('0x13'),_0x4bf2cc,'request\x20sent');_0x44aa90(_0x17afe5['result'][_0x5c95('0x12')]);}})[_0x5c95('0x14')](function(_0x4ab2fb){logger[_0x5c95('0x10')](_0x5c95('0x13'),_0x4bf2cc,_0x4ab2fb);_0x21dff0(_0x4ab2fb);});});}exports[_0x5c95('0x15')]=function(_0x5213aa){var _0x3ff315=this;return new Promise(function(_0x3b7d72,_0x29101a){return db[_0x5c95('0x16')][_0x5c95('0x17')](_0x5213aa['body'],{'raw':_0x5213aa[_0x5c95('0x18')]?_0x5213aa[_0x5c95('0x18')][_0x5c95('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5213aa[_0x5c95('0x18')]?_0x5213aa[_0x5c95('0x18')][_0x5c95('0x1a')]||null:null,'attributes':_0x5213aa['options']?_0x5213aa[_0x5c95('0x18')][_0x5c95('0x1b')]||null:null,'limit':_0x5213aa[_0x5c95('0x18')]?_0x5213aa[_0x5c95('0x18')][_0x5c95('0x1c')]||null:null})['then'](function(_0x3ca0da){logger[_0x5c95('0xc')](_0x5c95('0x15'),_0x5213aa);logger[_0x5c95('0x1d')](_0x5c95('0x15'),_0x5213aa,JSON[_0x5c95('0xf')](_0x3ca0da));_0x3b7d72(_0x3ca0da);})[_0x5c95('0x14')](function(_0x52aba1){logger[_0x5c95('0x10')](_0x5c95('0x15'),_0x52aba1[_0x5c95('0x12')],_0x5213aa);_0x29101a(_0x3ff315['error'](0x1f4,_0x52aba1[_0x5c95('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 0a4f773..13cc6ca 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 _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x43e665,_0x2434b8){_0x43e665=_0x43e665-0x0;var _0x711f73=_0xd7d1[_0x43e665];return _0x711f73;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file +var _0x0598=['../../components/auth/service','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x0598,0x92));var _0x8059=function(_0x1c90aa,_0x30961b){_0x1c90aa=_0x1c90aa-0x0;var _0x51b4c4=_0x0598[_0x1c90aa];return _0x51b4c4;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8059('0xa')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router[_0x8059('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0xd')]);module[_0x8059('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b2f1bad..2c9997e 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 _0x7708=['sequelize','exports','DATE','STRING','out','ENUM','INTEGER'];(function(_0x350979,_0x1e0e61){var _0xd51ab0=function(_0x5b2cd3){while(--_0x5b2cd3){_0x350979['push'](_0x350979['shift']());}};_0xd51ab0(++_0x1e0e61);}(_0x7708,0x188));var _0x8770=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x7708[_0x2389bc];return _0x170548;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8770('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8770('0x2')]},'fax':{'type':Sequelize[_0x8770('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8770('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8770('0x5')]('in',_0x8770('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x8770('0x6')]}}; \ No newline at end of file +var _0x32b6=['ENUM','out','INTEGER','sequelize','exports','DATE','STRING'];(function(_0x4e221e,_0x22329a){var _0x2297eb=function(_0x59a4cd){while(--_0x59a4cd){_0x4e221e['push'](_0x4e221e['shift']());}};_0x2297eb(++_0x22329a);}(_0x32b6,0x1d1));var _0x632b=function(_0x59ddd9,_0x20661b){_0x59ddd9=_0x59ddd9-0x0;var _0x367b00=_0x32b6[_0x59ddd9];return _0x367b00;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x632b('0x2')]},'disposition':{'type':Sequelize[_0x632b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x632b('0x3')]},'read1stAt':{'type':Sequelize[_0x632b('0x2')]},'fax':{'type':Sequelize[_0x632b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x632b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x632b('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index c4df3c5..2ea13cf 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 _0xcfbe=['status','end','offset','undefined','limit','count','set','json','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','findAll','fax','query','user','catch','show','params','FaxInteraction','keys','filters','intersection','model','attributes','fields','length','merge','find','create','body','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','toString','tmp','join','root','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','existsSync','createWriteStream','basename','resolve','download','log','err','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x549c56,_0xc02b6a){var _0x385a97=function(_0x5f5c22){while(--_0x5f5c22){_0x549c56['push'](_0x549c56['shift']());}};_0x385a97(++_0xc02b6a);}(_0xcfbe,0x181));var _0xecfb=function(_0x1679cc,_0x242c53){_0x1679cc=_0x1679cc-0x0;var _0x4aaec8=_0xcfbe[_0x1679cc];return _0x4aaec8;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xecfb('0x0'));var moment=require(_0xecfb('0x1'));var BPromise=require(_0xecfb('0x2'));var util=require(_0xecfb('0x3'));var path=require(_0xecfb('0x4'));var fs=require('fs');var _=require(_0xecfb('0x5'));var Redis=require(_0xecfb('0x6'));var interaction=require(_0xecfb('0x7'));var qs=require(_0xecfb('0x8'));var logger=require('../../config/logger')(_0xecfb('0x9'));var config=require('../../config/environment');var db=require(_0xecfb('0xa'))['db'];config[_0xecfb('0xb')]=_['defaults'](config['redis'],{'host':_0xecfb('0xc'),'port':0x18eb});var socket=require(_0xecfb('0xd'))(new Redis(config[_0xecfb('0xb')]));require(_0xecfb('0xe'))['register'](socket);function respondWithStatusCode(_0x1e8e1a,_0x2d09be){_0x2d09be=_0x2d09be||0xcc;return function(_0x229623){if(_0x229623){return _0x1e8e1a['sendStatus'](_0x2d09be);}return _0x1e8e1a[_0xecfb('0xf')](_0x2d09be)[_0xecfb('0x10')]();};}function respondWithResult(_0x4a21c5,_0x550128){_0x550128=_0x550128||0xc8;return function(_0x3c548d){if(_0x3c548d){return _0x4a21c5[_0xecfb('0xf')](_0x550128)['json'](_0x3c548d);}};}function respondWithFilteredResult(_0x3e9d0e,_0x35e2b9){return function(_0x45778f){if(_0x45778f){var _0x2db17d=typeof _0x35e2b9[_0xecfb('0x11')]===_0xecfb('0x12')&&typeof _0x35e2b9[_0xecfb('0x13')]==='undefined';var _0x13f545=_0x45778f[_0xecfb('0x14')];var _0x5e098e=_0x2db17d?0x0:_0x35e2b9[_0xecfb('0x11')];var _0x4e09de=_0x2db17d?_0x45778f[_0xecfb('0x14')]:_0x35e2b9[_0xecfb('0x11')]+_0x35e2b9['limit'];var _0x391772;if(_0x4e09de>=_0x13f545){_0x4e09de=_0x13f545;_0x391772=0xc8;}else{_0x391772=0xce;}_0x3e9d0e[_0xecfb('0xf')](_0x391772);return _0x3e9d0e[_0xecfb('0x15')]('Content-Range',_0x5e098e+'-'+_0x4e09de+'/'+_0x13f545)[_0xecfb('0x16')](_0x45778f);}return null;};}function saveUpdates(_0x5932ce){return function(_0x49d557){if(_0x49d557){return _0x49d557['update'](_0x5932ce)[_0xecfb('0x17')](function(_0x62ebb6){return _0x62ebb6;});}return null;};}function removeEntity(_0x31ea58){return function(_0x37e655){if(_0x37e655){return _0x37e655[_0xecfb('0x18')]()[_0xecfb('0x17')](function(){_0x31ea58[_0xecfb('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df686){return function(_0x3e1ee9){if(!_0x3e1ee9){_0x1df686[_0xecfb('0x19')](0x194);}return _0x3e1ee9;};}function handleError(_0x1f68fc,_0x1de79c){_0x1de79c=_0x1de79c||0x1f4;return function(_0x38bddc){logger[_0xecfb('0x1a')](_0x38bddc[_0xecfb('0x1b')]);if(_0x38bddc[_0xecfb('0x1c')]){delete _0x38bddc['name'];}_0x1f68fc[_0xecfb('0xf')](_0x1de79c)[_0xecfb('0x1d')](_0x38bddc);};}exports[_0xecfb('0x1e')]=function(_0x53410c,_0x38143d){var _0x17b8a6={};var _0xde2fcd=_[_0xecfb('0x1f')](db['FaxInteraction'][_0xecfb('0x20')],function(_0x1582a0){return{'name':_0x1582a0[_0xecfb('0x21')],'type':_0x1582a0[_0xecfb('0x22')]['key']};});_0x17b8a6=qs[_0xecfb('0x23')](_0xde2fcd,_0x53410c);return interaction[_0xecfb('0x24')](_0xecfb('0x25'),_0x53410c[_0xecfb('0x26')],_0x53410c[_0xecfb('0x27')],_0x17b8a6,_0xde2fcd)['then'](respondWithFilteredResult(_0x38143d,_0x17b8a6))[_0xecfb('0x28')](handleError(_0x38143d,null));};exports[_0xecfb('0x29')]=function(_0x10579f,_0x526998){var _0x2b49c8={'raw':![],'where':{'id':_0x10579f[_0xecfb('0x2a')]['id']}},_0x4a7331={};_0x4a7331['model']=_['keys'](db[_0xecfb('0x2b')][_0xecfb('0x20')]);_0x4a7331[_0xecfb('0x26')]=_[_0xecfb('0x2c')](_0x10579f[_0xecfb('0x26')]);_0x4a7331[_0xecfb('0x2d')]=_[_0xecfb('0x2e')](_0x4a7331[_0xecfb('0x2f')],_0x4a7331['query']);_0x2b49c8[_0xecfb('0x30')]=_[_0xecfb('0x2e')](_0x4a7331[_0xecfb('0x2f')],qs['fields'](_0x10579f['query'][_0xecfb('0x31')]));_0x2b49c8[_0xecfb('0x30')]=_0x2b49c8['attributes'][_0xecfb('0x32')]?_0x2b49c8[_0xecfb('0x30')]:_0x4a7331[_0xecfb('0x2f')];if(_0x10579f['query']['includeAll']){_0x2b49c8['include']=[{'all':!![]}];}_0x2b49c8=_[_0xecfb('0x33')]({},_0x2b49c8,_0x10579f['options']);return db[_0xecfb('0x2b')][_0xecfb('0x34')](_0x2b49c8)[_0xecfb('0x17')](handleEntityNotFound(_0x526998,null))['then'](respondWithResult(_0x526998,null))[_0xecfb('0x28')](handleError(_0x526998,null));};exports[_0xecfb('0x35')]=function(_0x1c6bd6,_0x1476e3){return db[_0xecfb('0x2b')]['create'](_0x1c6bd6['body'],{})[_0xecfb('0x17')](respondWithResult(_0x1476e3,0xc9))[_0xecfb('0x28')](handleError(_0x1476e3,null));};exports['update']=function(_0x344f87,_0x1c37f0){if(_0x344f87[_0xecfb('0x36')]['id']){delete _0x344f87[_0xecfb('0x36')]['id'];}return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x344f87[_0xecfb('0x2a')]['id']}})[_0xecfb('0x17')](handleEntityNotFound(_0x1c37f0,null))[_0xecfb('0x17')](saveUpdates(_0x344f87[_0xecfb('0x36')],null))[_0xecfb('0x17')](respondWithResult(_0x1c37f0,null))[_0xecfb('0x28')](handleError(_0x1c37f0,null));};exports[_0xecfb('0x18')]=function(_0x439f52,_0x2239c2){return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x439f52[_0xecfb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2239c2,null))[_0xecfb('0x17')](removeEntity(_0x2239c2,null))[_0xecfb('0x28')](handleError(_0x2239c2,null));};exports[_0xecfb('0x37')]=function(_0xd8719c,_0x13e3a0){return db['FaxInteraction'][_0xecfb('0x37')]()[_0xecfb('0x17')](respondWithResult(_0x13e3a0,null))[_0xecfb('0x28')](handleError(_0x13e3a0,null));};exports['addMessage']=function(_0xd64a6,_0x173809){return db[_0xecfb('0x38')]['find']({'where':{'id':_0xd64a6[_0xecfb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x173809,null))[_0xecfb('0x17')](function(_0x68b811){if(_0x68b811){return _0x68b811[_0xecfb('0x39')](_0xd64a6['body'][_0xecfb('0x3a')],_[_0xecfb('0x3b')](_0xd64a6[_0xecfb('0x36')],[_0xecfb('0x3a'),'id'])||{});}})[_0xecfb('0x17')](respondWithResult(_0x173809,null))['catch'](handleError(_0x173809,null));};exports[_0xecfb('0x3c')]=function(_0x251dd2,_0x5e54dc){var _0x1bad1a={'raw':![],'where':{}};var _0x1988a7={};var _0x5708ed={'count':0x0,'rows':[]};return db[_0xecfb('0x2b')][_0xecfb('0x3d')]({'where':{'id':_0x251dd2[_0xecfb('0x2a')]['id']}})[_0xecfb('0x17')](handleEntityNotFound(_0x5e54dc,null))[_0xecfb('0x17')](function(_0x53ff6d){if(_0x53ff6d){_0x1988a7['model']=_[_0xecfb('0x2c')](db['FaxMessage'][_0xecfb('0x20')]);_0x1988a7[_0xecfb('0x26')]=_['keys'](_0x251dd2['query']);_0x1988a7[_0xecfb('0x2d')]=_[_0xecfb('0x2e')](_0x1988a7['model'],_0x1988a7[_0xecfb('0x26')]);_0x1bad1a['attributes']=_[_0xecfb('0x2e')](_0x1988a7['model'],qs[_0xecfb('0x31')](_0x251dd2['query'][_0xecfb('0x31')]));_0x1bad1a[_0xecfb('0x30')]=_0x1bad1a['attributes']['length']?_0x1bad1a['attributes']:_0x1988a7[_0xecfb('0x2f')];if(!_0x251dd2['query'][_0xecfb('0x3e')](_0xecfb('0x3f'))){_0x1bad1a[_0xecfb('0x13')]=qs[_0xecfb('0x13')](_0x251dd2[_0xecfb('0x26')][_0xecfb('0x13')]);_0x1bad1a[_0xecfb('0x11')]=qs[_0xecfb('0x11')](_0x251dd2[_0xecfb('0x26')][_0xecfb('0x11')]);}_0x1bad1a[_0xecfb('0x40')]=qs[_0xecfb('0x41')](_0x251dd2['query']['sort']);_0x1bad1a['where']=qs[_0xecfb('0x2d')](_['pick'](_0x251dd2[_0xecfb('0x26')],_0x1988a7[_0xecfb('0x2d')]));_0x1bad1a[_0xecfb('0x42')][_0xecfb('0x43')]=_0x53ff6d['id'];if(_0x251dd2[_0xecfb('0x26')]['filter']){_0x1bad1a['where']=_['merge'](_0x1bad1a['where'],{'$or':_[_0xecfb('0x1f')](_0x1bad1a[_0xecfb('0x30')],function(_0x9dcbe6){var _0x59fc42={};_0x59fc42[_0x9dcbe6]={'$like':'%'+_0x251dd2[_0xecfb('0x26')][_0xecfb('0x44')]+'%'};return _0x59fc42;})});}if(_0x251dd2['query'][_0xecfb('0x45')]){var _0x135586=_0x251dd2[_0xecfb('0x26')][_0xecfb('0x45')][_0xecfb('0x46')](',');var _0x11642d={};_0x11642d[_0x135586[0x0]]={'$gte':moment(_0x135586[0x1])['format'](_0xecfb('0x47'))};_0x1bad1a[_0xecfb('0x42')]=_['merge'](_0x1bad1a['where'],_0x11642d);}_0x1bad1a=_['merge']({},_0x1bad1a,_0x251dd2[_0xecfb('0x48')]);return db[_0xecfb('0x38')][_0xecfb('0x14')]({'where':_0x1bad1a[_0xecfb('0x42')]})['then'](function(_0x5d8d36){_0x5708ed[_0xecfb('0x14')]=_0x5d8d36;if(_0x251dd2[_0xecfb('0x26')][_0xecfb('0x49')]){_0x1bad1a[_0xecfb('0x4a')]=[{'all':!![]}];}return db[_0xecfb('0x38')][_0xecfb('0x24')](_0x1bad1a);})[_0xecfb('0x17')](function(_0x11e7b6){_0x5708ed['rows']=_0x11e7b6;return _0x5708ed;});}})[_0xecfb('0x17')](respondWithFilteredResult(_0x5e54dc,_0x1bad1a))[_0xecfb('0x28')](handleError(_0x5e54dc,null));};exports[_0xecfb('0x4b')]=function(_0x4a1b91,_0x47daa0){return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x4a1b91['params']['id']}})['then'](handleEntityNotFound(_0x47daa0,null))['then'](function(_0x9555d5){if(_0x9555d5){return _0x9555d5[_0xecfb('0x4c')](_0x4a1b91[_0xecfb('0x36')][_0xecfb('0x3a')],_['omit'](_0x4a1b91['body'],[_0xecfb('0x3a'),'id'])||{})[_0xecfb('0x4d')](function(){return db[_0xecfb('0x4e')][_0xecfb('0x24')]({'attributes':['id','name',_0xecfb('0x4f')],'where':{'id':_0x4a1b91['body']['ids']}});})[_0xecfb('0x17')](function(_0x531555){socket['emit'](_0xecfb('0x50'),{'id':Number(_0x4a1b91[_0xecfb('0x2a')]['id']),'tags':_0x531555||[]});return{'id':Number(_0x4a1b91[_0xecfb('0x2a')]['id']),'tags':_0x531555||[]};});}})['then'](respondWithResult(_0x47daa0,null))['catch'](handleError(_0x47daa0,null));};exports['removeTags']=function(_0x4b1d33,_0x3913b1){return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x4b1d33[_0xecfb('0x2a')]['id']}})[_0xecfb('0x17')](handleEntityNotFound(_0x3913b1,null))[_0xecfb('0x17')](function(_0x303067){if(_0x303067){return _0x303067[_0xecfb('0x51')](_0x4b1d33['query'][_0xecfb('0x3a')]);}})[_0xecfb('0x17')](respondWithStatusCode(_0x3913b1,null))['catch'](handleError(_0x3913b1,null));};exports['download']=function(_0x431e54,_0x231dad){var _0x378d49=moment()['unix']()[_0xecfb('0x52')]();var _0x272271=path['join'](config['root'],'server','files',_0xecfb('0x53'));var _0x36bbc7=path[_0xecfb('0x54')](config[_0xecfb('0x55')],'server','files',_0xecfb('0x56'));var _0x48151c=path[_0xecfb('0x54')](_0x272271,_0x378d49);var _0x56085e=util[_0xecfb('0x57')](_0xecfb('0x58'),_0x431e54[_0xecfb('0x2a')]['id'],_0x378d49);var _0x19fbf8=path[_0xecfb('0x54')](_0x272271,_0x56085e);var _0x5f22ff=[];_0x5f22ff['push']({'model':db[_0xecfb('0x59')],'as':_0xecfb('0x59'),'raw':!![]});var _0x4e6c8d=[{'model':db[_0xecfb('0x38')],'as':_0xecfb('0x5a'),'attributes':['id',_0xecfb('0x36'),_0xecfb('0x5b')],'include':_0x5f22ff}];return db[_0xecfb('0x2b')][_0xecfb('0x34')]({'where':{'id':_0x431e54['params']['id']},'include':_0x4e6c8d})[_0xecfb('0x17')](handleEntityNotFound(_0x231dad,null))[_0xecfb('0x17')](function(_0x156972){if(_0x156972&&_0x156972[_0xecfb('0x5a')]){var _0x53f9f0=_0x156972['get']({'plain':!![]});fs[_0xecfb('0x5c')](_0x48151c);for(var _0x24209e=0x0;_0x24209e<_0x53f9f0['Messages'][_0xecfb('0x32')];_0x24209e++){var _0x2cd682=_0x53f9f0[_0xecfb('0x5a')][_0x24209e]['Attachment'];if(_0x2cd682){var _0x5ad9ae=path[_0xecfb('0x54')](_0x36bbc7,_0x2cd682['basename']);if(fs[_0xecfb('0x5d')](_0x5ad9ae)){fs['createReadStream'](_0x5ad9ae)['pipe'](fs[_0xecfb('0x5e')](path[_0xecfb('0x54')](_0x48151c,_0x2cd682[_0xecfb('0x5f')])));}}}return BPromise[_0xecfb('0x60')]()['then'](function(){return new BPromise(function(_0x86113c,_0xc847b2){zipdir(_0x48151c,{'saveTo':_0x19fbf8},function(_0x4b9ac4,_0xff5edb){if(_0x4b9ac4)return _0xc847b2(_0x4b9ac4);return _0x86113c(_0xff5edb);});})[_0xecfb('0x17')](function(){return new BPromise(function(_0x2bda52,_0x3eb426){rimraf(_0x48151c,function(_0x205c12){if(_0x205c12)_0x3eb426(_0x205c12);return _0x2bda52();});});})[_0xecfb('0x17')](function(){return _0x231dad[_0xecfb('0x61')](_0x19fbf8,_0x56085e,function(_0x58091c){if(_0x58091c){console[_0xecfb('0x62')](_0xecfb('0x63'),_0x58091c);}else{fs['unlinkSync'](_0x19fbf8);}});});});}else{return _0x231dad[_0xecfb('0x19')](0xc8);}})[_0xecfb('0x28')](handleError(_0x231dad,null));}; \ No newline at end of file +var _0xafaa=['setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','json','undefined','count','limit','set','Content-Range','update','then','destroy','end','name','send','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags'];(function(_0x11cc86,_0x1cda4e){var _0x357ad0=function(_0x5405df){while(--_0x5405df){_0x11cc86['push'](_0x11cc86['shift']());}};_0x357ad0(++_0x1cda4e);}(_0xafaa,0x15e));var _0xaafa=function(_0x27650e,_0x278f7a){_0x27650e=_0x27650e-0x0;var _0x28fe08=_0xafaa[_0x27650e];return _0x28fe08;};'use strict';var rimraf=require(_0xaafa('0x0'));var zipdir=require(_0xaafa('0x1'));var moment=require(_0xaafa('0x2'));var BPromise=require(_0xaafa('0x3'));var util=require(_0xaafa('0x4'));var path=require(_0xaafa('0x5'));var fs=require('fs');var _=require(_0xaafa('0x6'));var Redis=require(_0xaafa('0x7'));var interaction=require(_0xaafa('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xaafa('0x9'))(_0xaafa('0xa'));var config=require(_0xaafa('0xb'));var db=require(_0xaafa('0xc'))['db'];config[_0xaafa('0xd')]=_['defaults'](config[_0xaafa('0xd')],{'host':_0xaafa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaafa('0xd')]));require('./faxInteraction.socket')[_0xaafa('0xf')](socket);function respondWithStatusCode(_0x4c38bc,_0x5a355a){_0x5a355a=_0x5a355a||0xcc;return function(_0x5f14c0){if(_0x5f14c0){return _0x4c38bc[_0xaafa('0x10')](_0x5a355a);}return _0x4c38bc[_0xaafa('0x11')](_0x5a355a)['end']();};}function respondWithResult(_0x4e2d34,_0x1aa7c9){_0x1aa7c9=_0x1aa7c9||0xc8;return function(_0x13e63c){if(_0x13e63c){return _0x4e2d34[_0xaafa('0x11')](_0x1aa7c9)[_0xaafa('0x12')](_0x13e63c);}};}function respondWithFilteredResult(_0x151298,_0x185668){return function(_0x494cd7){if(_0x494cd7){var _0x3eec2b=typeof _0x185668['offset']===_0xaafa('0x13')&&typeof _0x185668['limit']===_0xaafa('0x13');var _0x2f5082=_0x494cd7['count'];var _0x5115fd=_0x3eec2b?0x0:_0x185668['offset'];var _0x579a6b=_0x3eec2b?_0x494cd7[_0xaafa('0x14')]:_0x185668['offset']+_0x185668[_0xaafa('0x15')];var _0xae39cf;if(_0x579a6b>=_0x2f5082){_0x579a6b=_0x2f5082;_0xae39cf=0xc8;}else{_0xae39cf=0xce;}_0x151298['status'](_0xae39cf);return _0x151298[_0xaafa('0x16')](_0xaafa('0x17'),_0x5115fd+'-'+_0x579a6b+'/'+_0x2f5082)[_0xaafa('0x12')](_0x494cd7);}return null;};}function saveUpdates(_0x13718b){return function(_0x24beea){if(_0x24beea){return _0x24beea[_0xaafa('0x18')](_0x13718b)[_0xaafa('0x19')](function(_0xe1999c){return _0xe1999c;});}return null;};}function removeEntity(_0x31b898){return function(_0x1952b9){if(_0x1952b9){return _0x1952b9[_0xaafa('0x1a')]()[_0xaafa('0x19')](function(){_0x31b898[_0xaafa('0x11')](0xcc)[_0xaafa('0x1b')]();});}};}function handleEntityNotFound(_0x497a28){return function(_0xca2375){if(!_0xca2375){_0x497a28['sendStatus'](0x194);}return _0xca2375;};}function handleError(_0x2e60e4,_0x3a14ef){_0x3a14ef=_0x3a14ef||0x1f4;return function(_0x22e3dc){logger['error'](_0x22e3dc['stack']);if(_0x22e3dc['name']){delete _0x22e3dc[_0xaafa('0x1c')];}_0x2e60e4['status'](_0x3a14ef)[_0xaafa('0x1d')](_0x22e3dc);};}exports[_0xaafa('0x1e')]=function(_0x3fc7d7,_0x29f217){var _0x340132={};var _0x32e446=_[_0xaafa('0x1f')](db[_0xaafa('0x20')][_0xaafa('0x21')],function(_0x1e9c24){return{'name':_0x1e9c24['fieldName'],'type':_0x1e9c24[_0xaafa('0x22')][_0xaafa('0x23')]};});_0x340132=qs[_0xaafa('0x24')](_0x32e446,_0x3fc7d7);return interaction[_0xaafa('0x25')](_0xaafa('0x26'),_0x3fc7d7[_0xaafa('0x27')],_0x3fc7d7['user'],_0x340132,_0x32e446)[_0xaafa('0x19')](respondWithFilteredResult(_0x29f217,_0x340132))[_0xaafa('0x28')](handleError(_0x29f217,null));};exports[_0xaafa('0x29')]=function(_0x233de5,_0x1a3185){var _0x5591e8={'raw':![],'where':{'id':_0x233de5[_0xaafa('0x2a')]['id']}},_0x1ad4ea={};_0x1ad4ea[_0xaafa('0x2b')]=_[_0xaafa('0x2c')](db[_0xaafa('0x20')][_0xaafa('0x21')]);_0x1ad4ea['query']=_[_0xaafa('0x2c')](_0x233de5[_0xaafa('0x27')]);_0x1ad4ea[_0xaafa('0x2d')]=_[_0xaafa('0x2e')](_0x1ad4ea[_0xaafa('0x2b')],_0x1ad4ea[_0xaafa('0x27')]);_0x5591e8[_0xaafa('0x2f')]=_[_0xaafa('0x2e')](_0x1ad4ea[_0xaafa('0x2b')],qs[_0xaafa('0x30')](_0x233de5[_0xaafa('0x27')][_0xaafa('0x30')]));_0x5591e8['attributes']=_0x5591e8['attributes'][_0xaafa('0x31')]?_0x5591e8[_0xaafa('0x2f')]:_0x1ad4ea['model'];if(_0x233de5[_0xaafa('0x27')][_0xaafa('0x32')]){_0x5591e8[_0xaafa('0x33')]=[{'all':!![]}];}_0x5591e8=_[_0xaafa('0x34')]({},_0x5591e8,_0x233de5[_0xaafa('0x35')]);return db['FaxInteraction'][_0xaafa('0x36')](_0x5591e8)['then'](handleEntityNotFound(_0x1a3185,null))[_0xaafa('0x19')](respondWithResult(_0x1a3185,null))[_0xaafa('0x28')](handleError(_0x1a3185,null));};exports[_0xaafa('0x37')]=function(_0x29c847,_0x4435f8){return db[_0xaafa('0x20')][_0xaafa('0x37')](_0x29c847[_0xaafa('0x38')],{})[_0xaafa('0x19')](respondWithResult(_0x4435f8,0xc9))[_0xaafa('0x28')](handleError(_0x4435f8,null));};exports[_0xaafa('0x18')]=function(_0x5104b0,_0x258c25){if(_0x5104b0[_0xaafa('0x38')]['id']){delete _0x5104b0[_0xaafa('0x38')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x5104b0[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x258c25,null))['then'](saveUpdates(_0x5104b0[_0xaafa('0x38')],null))[_0xaafa('0x19')](respondWithResult(_0x258c25,null))[_0xaafa('0x28')](handleError(_0x258c25,null));};exports[_0xaafa('0x1a')]=function(_0x2740ee,_0x26f025){return db[_0xaafa('0x20')][_0xaafa('0x36')]({'where':{'id':_0x2740ee[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x26f025,null))[_0xaafa('0x19')](removeEntity(_0x26f025,null))['catch'](handleError(_0x26f025,null));};exports['describe']=function(_0x404cf5,_0x570c44){return db[_0xaafa('0x20')][_0xaafa('0x39')]()[_0xaafa('0x19')](respondWithResult(_0x570c44,null))[_0xaafa('0x28')](handleError(_0x570c44,null));};exports[_0xaafa('0x3a')]=function(_0x536a03,_0x10da9b){return db['FaxMessage'][_0xaafa('0x36')]({'where':{'id':_0x536a03[_0xaafa('0x2a')]['id']}})['then'](handleEntityNotFound(_0x10da9b,null))[_0xaafa('0x19')](function(_0x1bdf3a){if(_0x1bdf3a){return _0x1bdf3a['addMessage'](_0x536a03[_0xaafa('0x38')][_0xaafa('0x3b')],_[_0xaafa('0x3c')](_0x536a03[_0xaafa('0x38')],[_0xaafa('0x3b'),'id'])||{});}})[_0xaafa('0x19')](respondWithResult(_0x10da9b,null))[_0xaafa('0x28')](handleError(_0x10da9b,null));};exports[_0xaafa('0x3d')]=function(_0x459d33,_0x208c62){var _0x3bdd65={'raw':![],'where':{}};var _0x109f77={};var _0x133693={'count':0x0,'rows':[]};return db[_0xaafa('0x20')][_0xaafa('0x3e')]({'where':{'id':_0x459d33[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x208c62,null))[_0xaafa('0x19')](function(_0x4012ce){if(_0x4012ce){_0x109f77[_0xaafa('0x2b')]=_[_0xaafa('0x2c')](db[_0xaafa('0x3f')][_0xaafa('0x21')]);_0x109f77[_0xaafa('0x27')]=_['keys'](_0x459d33[_0xaafa('0x27')]);_0x109f77[_0xaafa('0x2d')]=_[_0xaafa('0x2e')](_0x109f77[_0xaafa('0x2b')],_0x109f77['query']);_0x3bdd65['attributes']=_[_0xaafa('0x2e')](_0x109f77[_0xaafa('0x2b')],qs[_0xaafa('0x30')](_0x459d33['query']['fields']));_0x3bdd65[_0xaafa('0x2f')]=_0x3bdd65['attributes'][_0xaafa('0x31')]?_0x3bdd65[_0xaafa('0x2f')]:_0x109f77[_0xaafa('0x2b')];if(!_0x459d33[_0xaafa('0x27')][_0xaafa('0x40')](_0xaafa('0x41'))){_0x3bdd65[_0xaafa('0x15')]=qs[_0xaafa('0x15')](_0x459d33[_0xaafa('0x27')][_0xaafa('0x15')]);_0x3bdd65[_0xaafa('0x42')]=qs[_0xaafa('0x42')](_0x459d33['query']['offset']);}_0x3bdd65[_0xaafa('0x43')]=qs[_0xaafa('0x44')](_0x459d33[_0xaafa('0x27')]['sort']);_0x3bdd65[_0xaafa('0x45')]=qs[_0xaafa('0x2d')](_[_0xaafa('0x46')](_0x459d33[_0xaafa('0x27')],_0x109f77[_0xaafa('0x2d')]));_0x3bdd65[_0xaafa('0x45')]['FaxInteractionId']=_0x4012ce['id'];if(_0x459d33[_0xaafa('0x27')][_0xaafa('0x47')]){_0x3bdd65[_0xaafa('0x45')]=_[_0xaafa('0x34')](_0x3bdd65[_0xaafa('0x45')],{'$or':_[_0xaafa('0x1f')](_0x3bdd65['attributes'],function(_0x56d84d){var _0x47b5f0={};_0x47b5f0[_0x56d84d]={'$like':'%'+_0x459d33['query'][_0xaafa('0x47')]+'%'};return _0x47b5f0;})});}if(_0x459d33['query'][_0xaafa('0x48')]){var _0x2f7844=_0x459d33['query'][_0xaafa('0x48')][_0xaafa('0x49')](',');var _0x2651a4={};_0x2651a4[_0x2f7844[0x0]]={'$gte':moment(_0x2f7844[0x1])[_0xaafa('0x4a')](_0xaafa('0x4b'))};_0x3bdd65['where']=_[_0xaafa('0x34')](_0x3bdd65['where'],_0x2651a4);}_0x3bdd65=_[_0xaafa('0x34')]({},_0x3bdd65,_0x459d33['options']);return db['FaxMessage']['count']({'where':_0x3bdd65['where']})[_0xaafa('0x19')](function(_0x1aa496){_0x133693[_0xaafa('0x14')]=_0x1aa496;if(_0x459d33[_0xaafa('0x27')]['includeAll']){_0x3bdd65[_0xaafa('0x33')]=[{'all':!![]}];}return db[_0xaafa('0x3f')][_0xaafa('0x25')](_0x3bdd65);})[_0xaafa('0x19')](function(_0x21e897){_0x133693[_0xaafa('0x4c')]=_0x21e897;return _0x133693;});}})['then'](respondWithFilteredResult(_0x208c62,_0x3bdd65))[_0xaafa('0x28')](handleError(_0x208c62,null));};exports[_0xaafa('0x4d')]=function(_0x221325,_0x362f96){return db['FaxInteraction'][_0xaafa('0x36')]({'where':{'id':_0x221325[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x362f96,null))['then'](function(_0x245e70){if(_0x245e70){return _0x245e70[_0xaafa('0x4e')](_0x221325[_0xaafa('0x38')][_0xaafa('0x3b')],_[_0xaafa('0x3c')](_0x221325['body'],[_0xaafa('0x3b'),'id'])||{})[_0xaafa('0x4f')](function(){return db[_0xaafa('0x50')]['findAll']({'attributes':['id',_0xaafa('0x1c'),_0xaafa('0x51')],'where':{'id':_0x221325[_0xaafa('0x38')]['ids']}});})[_0xaafa('0x19')](function(_0x3c80b6){socket[_0xaafa('0x52')](_0xaafa('0x53'),{'id':Number(_0x221325[_0xaafa('0x2a')]['id']),'tags':_0x3c80b6||[]});return{'id':Number(_0x221325[_0xaafa('0x2a')]['id']),'tags':_0x3c80b6||[]};});}})[_0xaafa('0x19')](respondWithResult(_0x362f96,null))[_0xaafa('0x28')](handleError(_0x362f96,null));};exports[_0xaafa('0x54')]=function(_0x5349a5,_0x7194d8){return db['FaxInteraction'][_0xaafa('0x36')]({'where':{'id':_0x5349a5[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x7194d8,null))[_0xaafa('0x19')](function(_0x3d4d9f){if(_0x3d4d9f){return _0x3d4d9f['removeTags'](_0x5349a5[_0xaafa('0x27')][_0xaafa('0x3b')]);}})[_0xaafa('0x19')](respondWithStatusCode(_0x7194d8,null))[_0xaafa('0x28')](handleError(_0x7194d8,null));};exports[_0xaafa('0x55')]=function(_0x2f19a6,_0x432187){var _0x4f0814=moment()[_0xaafa('0x56')]()[_0xaafa('0x57')]();var _0x409df2=path[_0xaafa('0x58')](config['root'],_0xaafa('0x59'),_0xaafa('0x5a'),_0xaafa('0x5b'));var _0x336ff1=path[_0xaafa('0x58')](config[_0xaafa('0x5c')],_0xaafa('0x59'),'files',_0xaafa('0x5d'));var _0xd73027=path['join'](_0x409df2,_0x4f0814);var _0x5d4ced=util[_0xaafa('0x4a')](_0xaafa('0x5e'),_0x2f19a6['params']['id'],_0x4f0814);var _0x1b897b=path[_0xaafa('0x58')](_0x409df2,_0x5d4ced);var _0x3217b7=[];_0x3217b7[_0xaafa('0x5f')]({'model':db[_0xaafa('0x60')],'as':_0xaafa('0x60'),'raw':!![]});var _0xd1d563=[{'model':db['FaxMessage'],'as':_0xaafa('0x61'),'attributes':['id',_0xaafa('0x38'),_0xaafa('0x62')],'include':_0x3217b7}];return db[_0xaafa('0x20')]['find']({'where':{'id':_0x2f19a6[_0xaafa('0x2a')]['id']},'include':_0xd1d563})[_0xaafa('0x19')](handleEntityNotFound(_0x432187,null))[_0xaafa('0x19')](function(_0x3b7fb4){if(_0x3b7fb4&&_0x3b7fb4[_0xaafa('0x61')]){var _0x20245f=_0x3b7fb4['get']({'plain':!![]});fs[_0xaafa('0x63')](_0xd73027);for(var _0x5167e5=0x0;_0x5167e5<_0x20245f[_0xaafa('0x61')]['length'];_0x5167e5++){var _0x5d7b56=_0x20245f['Messages'][_0x5167e5][_0xaafa('0x60')];if(_0x5d7b56){var _0x30c5f3=path['join'](_0x336ff1,_0x5d7b56[_0xaafa('0x64')]);if(fs[_0xaafa('0x65')](_0x30c5f3)){fs['createReadStream'](_0x30c5f3)[_0xaafa('0x66')](fs[_0xaafa('0x67')](path['join'](_0xd73027,_0x5d7b56[_0xaafa('0x64')])));}}}return BPromise[_0xaafa('0x68')]()[_0xaafa('0x19')](function(){return new BPromise(function(_0x1d49b1,_0x30adc0){zipdir(_0xd73027,{'saveTo':_0x1b897b},function(_0x194b1d,_0xd73403){if(_0x194b1d)return _0x30adc0(_0x194b1d);return _0x1d49b1(_0xd73403);});})['then'](function(){return new BPromise(function(_0x103baf,_0x591106){rimraf(_0xd73027,function(_0x4acc4a){if(_0x4acc4a)_0x591106(_0x4acc4a);return _0x103baf();});});})[_0xaafa('0x19')](function(){return _0x432187['download'](_0x1b897b,_0x5d4ced,function(_0x3617c0){if(_0x3617c0){console['log'](_0xaafa('0x69'),_0x3617c0);}else{fs[_0xaafa('0x6a')](_0x1b897b);}});});});}else{return _0x432187[_0xaafa('0x10')](0xc8);}})[_0xaafa('0x28')](handleError(_0x432187,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 70f0788..4c1c805 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 _0x5f14=['../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','findAll','then','setDataValue','length','emit','hasOwnProperty','hook','exports','events'];(function(_0x240c3d,_0x481a90){var _0x59b6a7=function(_0x417fd2){while(--_0x417fd2){_0x240c3d['push'](_0x240c3d['shift']());}};_0x59b6a7(++_0x481a90);}(_0x5f14,0x1a8));var _0x45f1=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x5f14[_0x2652ef];return _0x2db578;};'use strict';var EventEmitter=require(_0x45f1('0x0'));var FaxInteraction=require(_0x45f1('0x1'))['db'][_0x45f1('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x45f1('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x45f1('0x4')](0x0);var events={'afterCreate':_0x45f1('0x5'),'afterUpdate':_0x45f1('0x6'),'afterDestroy':_0x45f1('0x7')};function emitEvent(_0x103ec9){return function(_0x1b0ba6,_0x2ad061,_0x138242){_0x1b0ba6[_0x45f1('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd932f6){_0x1b0ba6['setDataValue']('Users',_0xd932f6['map'](function(_0x362570){return{'id':_0x362570['id']};}));return FaxMessage[_0x45f1('0x9')]({'where':{'FaxInteractionId':_0x1b0ba6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x45f1('0xa')](function(_0x26cbf1){_0x1b0ba6[_0x45f1('0xb')]('unreadMessages',_0x26cbf1[_0x45f1('0xc')]);FaxInteractionEvents[_0x45f1('0xd')](_0x103ec9+':'+_0x1b0ba6['id'],_0x1b0ba6);FaxInteractionEvents['emit'](_0x103ec9,_0x1b0ba6);_0x138242(null);})['catch'](_0x138242(null));};}for(var e in events){if(events[_0x45f1('0xe')](e)){var event=events[e];FaxInteraction[_0x45f1('0xf')](e,emitEvent(event));}}module[_0x45f1('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x4a56=['then','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll'];(function(_0x3f8383,_0x2672b8){var _0x4ff188=function(_0x334aaa){while(--_0x334aaa){_0x3f8383['push'](_0x3f8383['shift']());}};_0x4ff188(++_0x2672b8);}(_0x4a56,0x1d6));var _0x64a5=function(_0x163a2a,_0x338261){_0x163a2a=_0x163a2a-0x0;var _0x2e3480=_0x4a56[_0x163a2a];return _0x2e3480;};'use strict';var EventEmitter=require(_0x64a5('0x0'));var FaxInteraction=require(_0x64a5('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x64a5('0x2')](0x0);var events={'afterCreate':_0x64a5('0x3'),'afterUpdate':_0x64a5('0x4'),'afterDestroy':_0x64a5('0x5')};function emitEvent(_0x56a5f8){return function(_0x310663,_0x1769c1,_0x1b49fe){_0x310663['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2e9370){_0x310663[_0x64a5('0x6')](_0x64a5('0x7'),_0x2e9370[_0x64a5('0x8')](function(_0x932265){return{'id':_0x932265['id']};}));return FaxMessage[_0x64a5('0x9')]({'where':{'FaxInteractionId':_0x310663['id'],'direction':'in','read':![]},'raw':!![]});})[_0x64a5('0xa')](function(_0x41ede1){_0x310663[_0x64a5('0x6')]('unreadMessages',_0x41ede1[_0x64a5('0xb')]);FaxInteractionEvents[_0x64a5('0xc')](_0x56a5f8+':'+_0x310663['id'],_0x310663);FaxInteractionEvents[_0x64a5('0xc')](_0x56a5f8,_0x310663);_0x1b49fe(null);})[_0x64a5('0xd')](_0x1b49fe(null));};}for(var e in events){if(events[_0x64a5('0xe')](e)){var event=events[e];FaxInteraction[_0x64a5('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 92e7b78..ff70274 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 _0x7335=['./faxInteraction.attributes','define','FaxInteraction','fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x7335,0x74));var _0x5733=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x7335[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0x5733('0x0'));var logger=require(_0x5733('0x1'))(_0x5733('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5733('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5733('0x4'));module['exports']=function(_0x26d441,_0x51dc7b){return _0x26d441[_0x5733('0x5')](_0x5733('0x6'),attributes,{'tableName':_0x5733('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22e403,_0x840917,_0x1eedd4){if(_0x22e403['changed'](_0x5733('0x8'))){_0x22e403[_0x5733('0x9')]=moment()[_0x5733('0xa')](_0x5733('0xb'));}_0x1eedd4(null,_0x22e403);}}});}; \ No newline at end of file +var _0x5ab9=['FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','path','rimraf','./faxInteraction.attributes'];(function(_0x16cb55,_0x1a2432){var _0xda356a=function(_0x3cfa3b){while(--_0x3cfa3b){_0x16cb55['push'](_0x16cb55['shift']());}};_0xda356a(++_0x1a2432);}(_0x5ab9,0x117));var _0x95ab=function(_0x43ee7e,_0x78e09b){_0x43ee7e=_0x43ee7e-0x0;var _0x22d326=_0x5ab9[_0x43ee7e];return _0x22d326;};'use strict';var _=require('lodash');var util=require(_0x95ab('0x0'));var logger=require('../../config/logger')(_0x95ab('0x1'));var moment=require(_0x95ab('0x2'));var BPromise=require(_0x95ab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95ab('0x4'));var rimraf=require(_0x95ab('0x5'));var config=require('../../config/environment');var attributes=require(_0x95ab('0x6'));module['exports']=function(_0x461eee,_0x23b91d){return _0x461eee['define'](_0x95ab('0x7'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x195203,_0x3431c5,_0x1f32c8){if(_0x195203[_0x95ab('0x8')](_0x95ab('0x9'))){_0x195203[_0x95ab('0xa')]=moment()[_0x95ab('0xb')](_0x95ab('0xc'));}_0x1f32c8(null,_0x195203);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6123098..3b99e8b 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 _0xee06=['register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xee06,0x1f4));var _0x6ee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee06[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6ee0('0x0'));var util=require(_0x6ee0('0x1'));var moment=require(_0x6ee0('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ee0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ee0('0x4'))['db'];var utils=require(_0x6ee0('0x5'));var logger=require(_0x6ee0('0x6'))(_0x6ee0('0x7'));var config=require(_0x6ee0('0x8'));var jayson=require(_0x6ee0('0x9'));var client=jayson[_0x6ee0('0xa')][_0x6ee0('0xb')]({'port':0x232a});config[_0x6ee0('0xc')]=_['defaults'](config[_0x6ee0('0xc')],{'host':_0x6ee0('0xd'),'port':0x18eb});var socket=require(_0x6ee0('0xe'))(new Redis(config['redis']));require(_0x6ee0('0xf'))[_0x6ee0('0x10')](socket);function respondWithRpcPromise(_0x3a928c,_0x140a0e,_0x31221c){return new BPromise(function(_0xc165bf,_0x1522a5){return client[_0x6ee0('0x11')](_0x3a928c,_0x31221c)[_0x6ee0('0x12')](function(_0x3ea207){logger[_0x6ee0('0x13')](_0x6ee0('0x14'),_0x140a0e,_0x6ee0('0x15'));logger[_0x6ee0('0x16')](_0x6ee0('0x17'),_0x140a0e,'request\x20sent',JSON[_0x6ee0('0x18')](_0x3ea207));if(_0x3ea207[_0x6ee0('0x19')]){if(_0x3ea207[_0x6ee0('0x19')]['code']===0x1f4){logger[_0x6ee0('0x19')](_0x6ee0('0x14'),_0x140a0e,_0x3ea207[_0x6ee0('0x19')][_0x6ee0('0x1a')]);return _0x1522a5(_0x3ea207[_0x6ee0('0x19')][_0x6ee0('0x1a')]);}logger[_0x6ee0('0x19')](_0x6ee0('0x14'),_0x140a0e,_0x3ea207[_0x6ee0('0x19')][_0x6ee0('0x1a')]);return _0xc165bf(_0x3ea207[_0x6ee0('0x19')][_0x6ee0('0x1a')]);}else{logger['info'](_0x6ee0('0x14'),_0x140a0e,'request\x20sent');_0xc165bf(_0x3ea207[_0x6ee0('0x1b')][_0x6ee0('0x1a')]);}})[_0x6ee0('0x1c')](function(_0x208846){logger['error'](_0x6ee0('0x14'),_0x140a0e,_0x208846);_0x1522a5(_0x208846);});});}exports['UpdateFaxInteraction']=function(_0x36100b){var _0x221211=this;return new Promise(function(_0x19d7a6,_0x83513a){return db['FaxInteraction'][_0x6ee0('0x1d')](_0x36100b[_0x6ee0('0x1e')],{'raw':_0x36100b[_0x6ee0('0x1f')]?_0x36100b[_0x6ee0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36100b[_0x6ee0('0x1f')]?_0x36100b['options'][_0x6ee0('0x20')]||null:null,'attributes':_0x36100b[_0x6ee0('0x1f')]?_0x36100b[_0x6ee0('0x1f')][_0x6ee0('0x21')]||null:null,'limit':_0x36100b[_0x6ee0('0x1f')]?_0x36100b['options'][_0x6ee0('0x22')]||null:null})[_0x6ee0('0x12')](function(_0x270bef){logger[_0x6ee0('0x13')](_0x6ee0('0x23'),_0x36100b);logger[_0x6ee0('0x16')](_0x6ee0('0x23'),_0x36100b,JSON[_0x6ee0('0x18')](_0x270bef));_0x19d7a6(_0x270bef);})[_0x6ee0('0x1c')](function(_0x8659ec){logger['error'](_0x6ee0('0x23'),_0x8659ec[_0x6ee0('0x1a')],_0x36100b);_0x83513a(_0x221211[_0x6ee0('0x19')](0x1f4,_0x8659ec[_0x6ee0('0x1a')]));});});};exports[_0x6ee0('0x24')]=function(_0x2d5b75){return new Promise(function(_0x409a9e,_0x1cdbc1){return db[_0x6ee0('0x25')]['find']({'where':_0x2d5b75[_0x6ee0('0x1f')]?_0x2d5b75['options'][_0x6ee0('0x20')]||null:null})[_0x6ee0('0x12')](function(_0x2a159a){if(_0x2a159a){return _0x2a159a[_0x6ee0('0x26')](_0x2d5b75['body'][_0x6ee0('0x27')],_[_0x6ee0('0x28')](_0x2d5b75[_0x6ee0('0x1e')],[_0x6ee0('0x27'),'id'])||{});}})[_0x6ee0('0x29')](function(_0x40e637){logger[_0x6ee0('0x13')](_0x6ee0('0x2a'),_0x2d5b75);logger['debug']('AddTags',_0x2d5b75,JSON[_0x6ee0('0x18')](_0x40e637));_0x409a9e(_0x40e637);})[_0x6ee0('0x1c')](function(_0x8d7055){logger['error'](_0x6ee0('0x2a'),_0x8d7055[_0x6ee0('0x1a')],_0x2d5b75);_0x1cdbc1(_this['error'](0x1f4,_0x8d7055[_0x6ee0('0x1a')]));});});}; \ No newline at end of file +var _0xe38c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1a8caa,_0x195483){var _0x9021fe=function(_0x2eef64){while(--_0x2eef64){_0x1a8caa['push'](_0x1a8caa['shift']());}};_0x9021fe(++_0x195483);}(_0xe38c,0x1be));var _0xce38=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe38c[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xce38('0x0'));var util=require('util');var moment=require(_0xce38('0x1'));var BPromise=require(_0xce38('0x2'));var rs=require(_0xce38('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce38('0x4'))['db'];var utils=require(_0xce38('0x5'));var logger=require(_0xce38('0x6'))(_0xce38('0x7'));var config=require('../../config/environment');var jayson=require(_0xce38('0x8'));var client=jayson[_0xce38('0x9')][_0xce38('0xa')]({'port':0x232a});config[_0xce38('0xb')]=_['defaults'](config[_0xce38('0xb')],{'host':_0xce38('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce38('0xd'))[_0xce38('0xe')](socket);function respondWithRpcPromise(_0x77dec1,_0x33ab56,_0x38b5d5){return new BPromise(function(_0x342170,_0x2b6ef6){return client[_0xce38('0xf')](_0x77dec1,_0x38b5d5)[_0xce38('0x10')](function(_0x88aea0){logger[_0xce38('0x11')](_0xce38('0x12'),_0x33ab56,_0xce38('0x13'));logger['debug'](_0xce38('0x14'),_0x33ab56,_0xce38('0x13'),JSON[_0xce38('0x15')](_0x88aea0));if(_0x88aea0[_0xce38('0x16')]){if(_0x88aea0['error'][_0xce38('0x17')]===0x1f4){logger['error'](_0xce38('0x12'),_0x33ab56,_0x88aea0[_0xce38('0x16')][_0xce38('0x18')]);return _0x2b6ef6(_0x88aea0['error'][_0xce38('0x18')]);}logger[_0xce38('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x33ab56,_0x88aea0[_0xce38('0x16')][_0xce38('0x18')]);return _0x342170(_0x88aea0[_0xce38('0x16')]['message']);}else{logger[_0xce38('0x11')](_0xce38('0x12'),_0x33ab56,_0xce38('0x13'));_0x342170(_0x88aea0[_0xce38('0x19')][_0xce38('0x18')]);}})[_0xce38('0x1a')](function(_0x35be7b){logger[_0xce38('0x16')](_0xce38('0x12'),_0x33ab56,_0x35be7b);_0x2b6ef6(_0x35be7b);});});}exports[_0xce38('0x1b')]=function(_0x307945){var _0x1cab2d=this;return new Promise(function(_0x2b48cd,_0x2918a1){return db[_0xce38('0x1c')]['update'](_0x307945[_0xce38('0x1d')],{'raw':_0x307945[_0xce38('0x1e')]?_0x307945['options'][_0xce38('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x307945[_0xce38('0x1e')]?_0x307945[_0xce38('0x1e')][_0xce38('0x20')]||null:null,'attributes':_0x307945[_0xce38('0x1e')]?_0x307945[_0xce38('0x1e')][_0xce38('0x21')]||null:null,'limit':_0x307945[_0xce38('0x1e')]?_0x307945[_0xce38('0x1e')][_0xce38('0x22')]||null:null})[_0xce38('0x10')](function(_0x2bf72e){logger['info']('UpdateFaxInteraction',_0x307945);logger[_0xce38('0x23')]('UpdateFaxInteraction',_0x307945,JSON['stringify'](_0x2bf72e));_0x2b48cd(_0x2bf72e);})[_0xce38('0x1a')](function(_0x1de67a){logger[_0xce38('0x16')](_0xce38('0x1b'),_0x1de67a[_0xce38('0x18')],_0x307945);_0x2918a1(_0x1cab2d[_0xce38('0x16')](0x1f4,_0x1de67a[_0xce38('0x18')]));});});};exports[_0xce38('0x24')]=function(_0x364b19){return new Promise(function(_0x2d062c,_0x4e7b72){return db['FaxInteraction']['find']({'where':_0x364b19[_0xce38('0x1e')]?_0x364b19[_0xce38('0x1e')][_0xce38('0x20')]||null:null})[_0xce38('0x10')](function(_0xa8b377){if(_0xa8b377){return _0xa8b377['addTags'](_0x364b19[_0xce38('0x1d')][_0xce38('0x25')],_[_0xce38('0x26')](_0x364b19['body'],[_0xce38('0x25'),'id'])||{});}})[_0xce38('0x27')](function(_0x4d7c1d){logger['info'](_0xce38('0x28'),_0x364b19);logger['debug'](_0xce38('0x28'),_0x364b19,JSON['stringify'](_0x4d7c1d));_0x2d062c(_0x4d7c1d);})[_0xce38('0x1a')](function(_0x41b659){logger['error'](_0xce38('0x28'),_0x41b659[_0xce38('0x18')],_0x364b19);_0x4e7b72(_this[_0xce38('0x16')](0x1f4,_0x41b659[_0xce38('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 270f6a7..c8deb39 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 _0x25b3=['faxInteraction:','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x584211,_0x263ced){var _0x4b5ae0=function(_0x58a2ba){while(--_0x58a2ba){_0x584211['push'](_0x584211['shift']());}};_0x4b5ae0(++_0x263ced);}(_0x25b3,0x1e7));var _0x325b=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x25b3[_0x3de7e0];return _0x11d0b3;};'use strict';var FaxInteractionEvents=require(_0x325b('0x0'));var events=[_0x325b('0x1'),_0x325b('0x2'),_0x325b('0x3')];function createListener(_0xbbe492,_0x53de28){return function(_0x52dea1){_0x53de28['emit'](_0xbbe492,_0x52dea1);};}function removeListener(_0x198ab9,_0xc62420){return function(){FaxInteractionEvents[_0x325b('0x4')](_0x198ab9,_0xc62420);};}exports['register']=function(_0x260c16){for(var _0xa58a51=0x0,_0x4dd354=events['length'];_0xa58a51<_0x4dd354;_0xa58a51++){var _0x12bd2b=events[_0xa58a51];var _0x1f7304=createListener(_0x325b('0x5')+_0x12bd2b,_0x260c16);FaxInteractionEvents['on'](_0x12bd2b,_0x1f7304);}}; \ No newline at end of file +var _0x4328=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x4b8b81,_0x34f111){var _0xed7d61=function(_0x6363fb){while(--_0x6363fb){_0x4b8b81['push'](_0x4b8b81['shift']());}};_0xed7d61(++_0x34f111);}(_0x4328,0xe4));var _0x8432=function(_0x301cdf,_0x4a2872){_0x301cdf=_0x301cdf-0x0;var _0x339611=_0x4328[_0x301cdf];return _0x339611;};'use strict';var FaxInteractionEvents=require(_0x8432('0x0'));var events=[_0x8432('0x1'),_0x8432('0x2'),'update'];function createListener(_0x1706af,_0x123f58){return function(_0x30464c){_0x123f58[_0x8432('0x3')](_0x1706af,_0x30464c);};}function removeListener(_0x3423ab,_0x3558d9){return function(){FaxInteractionEvents[_0x8432('0x4')](_0x3423ab,_0x3558d9);};}exports[_0x8432('0x5')]=function(_0x4b8d4d){for(var _0x13dd3d=0x0,_0x32e695=events[_0x8432('0x6')];_0x13dd3d<_0x32e695;_0x13dd3d++){var _0x3cd55a=events[_0x13dd3d];var _0x3d8c1d=createListener(_0x8432('0x7')+_0x3cd55a,_0x4b8d4d);FaxInteractionEvents['on'](_0x3cd55a,_0x3d8c1d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9bb0dde..2450734 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 _0x1b11=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','create','post','fax','faxinteraction:addtags','addTags','put','tracked','delete','/:id','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer'];(function(_0xa6ab87,_0x4fc633){var _0x1e89c3=function(_0x543dcb){while(--_0x543dcb){_0xa6ab87['push'](_0xa6ab87['shift']());}};_0x1e89c3(++_0x4fc633);}(_0x1b11,0xf7));var _0x11b1=function(_0x319c42,_0x23dcf2){_0x319c42=_0x319c42-0x0;var _0x1a7994=_0x1b11[_0x319c42];return _0x1a7994;};'use strict';var multer=require(_0x11b1('0x0'));var util=require(_0x11b1('0x1'));var path=require('path');var timeout=require(_0x11b1('0x2'));var express=require('express');var router=express[_0x11b1('0x3')]();var fs_extra=require(_0x11b1('0x4'));var auth=require(_0x11b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x11b1('0x6'));var controller=require(_0x11b1('0x7'));router[_0x11b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x11b1('0x9')]);router[_0x11b1('0x8')](_0x11b1('0xa'),auth[_0x11b1('0xb')](),controller[_0x11b1('0xc')]);router[_0x11b1('0x8')]('/:id',auth[_0x11b1('0xb')](),controller[_0x11b1('0xd')]);router[_0x11b1('0x8')](_0x11b1('0xe'),auth[_0x11b1('0xb')](),controller[_0x11b1('0xf')]);router[_0x11b1('0x8')](_0x11b1('0x10'),auth[_0x11b1('0xb')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x11b1('0x11')]);router[_0x11b1('0x12')](_0x11b1('0xe'),auth[_0x11b1('0xb')](),controller['addMessage']);router[_0x11b1('0x12')]('/:id/tags',auth[_0x11b1('0xb')](),interaction['tracked'](_0x11b1('0x13'),_0x11b1('0x14')),controller[_0x11b1('0x15')]);router[_0x11b1('0x16')]('/:id',auth[_0x11b1('0xb')](),interaction[_0x11b1('0x17')](_0x11b1('0x13'),'faxinteraction:update'),controller['update']);router[_0x11b1('0x18')](_0x11b1('0x19'),auth[_0x11b1('0xb')](),interaction[_0x11b1('0x17')](_0x11b1('0x13'),_0x11b1('0x1a')),controller[_0x11b1('0x1b')]);router[_0x11b1('0x18')](_0x11b1('0x1c'),auth['isAuthenticated'](),controller[_0x11b1('0x1d')]);module[_0x11b1('0x1e')]=router; \ No newline at end of file +var _0xf442=['get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','faxinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0xa46411,_0x240540){var _0x3dd78d=function(_0x1e7167){while(--_0x1e7167){_0xa46411['push'](_0xa46411['shift']());}};_0x3dd78d(++_0x240540);}(_0xf442,0xbc));var _0x2f44=function(_0x1f37aa,_0x484dd5){_0x1f37aa=_0x1f37aa-0x0;var _0x44d21d=_0xf442[_0x1f37aa];return _0x44d21d;};'use strict';var multer=require(_0x2f44('0x0'));var util=require(_0x2f44('0x1'));var path=require(_0x2f44('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f44('0x3'));var router=express[_0x2f44('0x4')]();var fs_extra=require(_0x2f44('0x5'));var auth=require(_0x2f44('0x6'));var interaction=require(_0x2f44('0x7'));var config=require(_0x2f44('0x8'));var controller=require(_0x2f44('0x9'));router[_0x2f44('0xa')]('/',auth[_0x2f44('0xb')](),controller['index']);router[_0x2f44('0xa')]('/describe',auth[_0x2f44('0xb')](),controller[_0x2f44('0xc')]);router[_0x2f44('0xa')](_0x2f44('0xd'),auth[_0x2f44('0xb')](),controller[_0x2f44('0xe')]);router[_0x2f44('0xa')](_0x2f44('0xf'),auth[_0x2f44('0xb')](),controller[_0x2f44('0x10')]);router['get'](_0x2f44('0x11'),auth['isAuthenticated'](),controller[_0x2f44('0x12')]);router['post']('/',auth[_0x2f44('0xb')](),controller[_0x2f44('0x13')]);router[_0x2f44('0x14')]('/:id/messages',auth[_0x2f44('0xb')](),controller[_0x2f44('0x15')]);router[_0x2f44('0x14')](_0x2f44('0x16'),auth[_0x2f44('0xb')](),interaction[_0x2f44('0x17')](_0x2f44('0x18'),_0x2f44('0x19')),controller[_0x2f44('0x1a')]);router[_0x2f44('0x1b')](_0x2f44('0xd'),auth['isAuthenticated'](),interaction[_0x2f44('0x17')](_0x2f44('0x18'),_0x2f44('0x1c')),controller[_0x2f44('0x1d')]);router['delete'](_0x2f44('0xd'),auth[_0x2f44('0xb')](),interaction[_0x2f44('0x17')](_0x2f44('0x18'),_0x2f44('0x1e')),controller['destroy']);router['delete'](_0x2f44('0x16'),auth[_0x2f44('0xb')](),controller[_0x2f44('0x1f')]);module[_0x2f44('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 6d6eb5b..8cbbc4c 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 _0xb43b=['TEXT','DATE','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x3116d6,_0x2d574f){var _0x18729d=function(_0x1945a0){while(--_0x1945a0){_0x3116d6['push'](_0x3116d6['shift']());}};_0x18729d(++_0x2d574f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x148721,_0x55806c){_0x148721=_0x148721-0x0;var _0x289544=_0xb43b[_0x148721];return _0x289544;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbb43('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb43('0x4')]('in','out'),'defaultValue':_0xbb43('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xa3e6=['sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x89427,_0x533fa3){var _0x5695ad=function(_0x184ed7){while(--_0x184ed7){_0x89427['push'](_0x89427['shift']());}};_0x5695ad(++_0x533fa3);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x468ad3,_0x1e6d72){_0x468ad3=_0x468ad3-0x0;var _0x1346c8=_0xa3e6[_0x468ad3];return _0x1346c8;};'use strict';var Sequelize=require(_0x6a3e('0x0'));module['exports']={'body':{'type':Sequelize[_0x6a3e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6a3e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a3e('0x3')]('in',_0x6a3e('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x6a3e('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1f90c81..b357479 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 _0xa466=['channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','sequelize','Sequelize','SIP/%s','rejectmessage','create','CmContact','ContactId','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','fullname','email','internal','interface'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0xa466,0x140));var _0x6a46=function(_0x17e653,_0x4c21e9){_0x17e653=_0x17e653-0x0;var _0x4341a1=_0xa466[_0x17e653];return _0x4341a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a46('0x0'));var zipdir=require(_0x6a46('0x1'));var jsonpatch=require(_0x6a46('0x2'));var rp=require('request-promise');var moment=require(_0x6a46('0x3'));var BPromise=require(_0x6a46('0x4'));var Mustache=require(_0x6a46('0x5'));var util=require(_0x6a46('0x6'));var path=require(_0x6a46('0x7'));var sox=require(_0x6a46('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a46('0x9'));var _=require('lodash');var squel=require(_0x6a46('0xa'));var crypto=require(_0x6a46('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a46('0xc'));var toCsv=require(_0x6a46('0xd'));var querystring=require(_0x6a46('0xe'));var Papa=require(_0x6a46('0xf'));var Redis=require(_0x6a46('0x10'));var authService=require(_0x6a46('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6a46('0x12'));var hardwareService=require(_0x6a46('0x13'));var logger=require(_0x6a46('0x14'))(_0x6a46('0x15'));var utils=require(_0x6a46('0x16'));var config=require(_0x6a46('0x17'));var licenseUtil=require(_0x6a46('0x18'));var db=require(_0x6a46('0x19'))['db'];config[_0x6a46('0x1a')]=_['defaults'](config[_0x6a46('0x1a')],{'host':_0x6a46('0x1b'),'port':0x18eb});var socket=require(_0x6a46('0x1c'))(new Redis(config[_0x6a46('0x1a')]));require(_0x6a46('0x1d'))['register'](socket);var jayson=require(_0x6a46('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x6a46('0x1f')][_0x6a46('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x46a00e,_0x3969bb,_0x3ffa20,_0x87f1e6){return new BPromise(function(_0x21d991,_0x84a781){var _0x2d0cde=_0x87f1e6||client;return _0x2d0cde['request'](_0x46a00e,_0x3ffa20)[_0x6a46('0x21')](function(_0x1f75b8){logger[_0x6a46('0x22')](_0x6a46('0x23'),_0x3969bb,_0x6a46('0x24'));logger[_0x6a46('0x25')](_0x6a46('0x26'),_0x3969bb,_0x6a46('0x24'),JSON[_0x6a46('0x27')](_0x1f75b8));if(_0x1f75b8['error']){if(_0x1f75b8[_0x6a46('0x28')]['code']===0x1f4){logger[_0x6a46('0x28')](_0x6a46('0x23'),_0x3969bb,_0x1f75b8[_0x6a46('0x28')]['message']);return _0x84a781(_0x1f75b8[_0x6a46('0x28')][_0x6a46('0x29')]);}logger[_0x6a46('0x28')](_0x6a46('0x23'),_0x3969bb,_0x1f75b8[_0x6a46('0x28')][_0x6a46('0x29')]);return _0x21d991(_0x1f75b8['error'][_0x6a46('0x29')]);}else{logger[_0x6a46('0x22')](_0x6a46('0x23'),_0x3969bb,_0x6a46('0x24'));_0x21d991(_0x1f75b8[_0x6a46('0x2a')]['message']);}})[_0x6a46('0x2b')](function(_0x3c60a4){logger[_0x6a46('0x28')](_0x6a46('0x23'),_0x3969bb,_0x3c60a4);_0x84a781(_0x3c60a4);});});}function respondWithStatusCode(_0x54988b,_0x312c4b){_0x312c4b=_0x312c4b||0xcc;return function(_0x2e55b4){if(_0x2e55b4){return _0x54988b[_0x6a46('0x2c')](_0x312c4b);}return _0x54988b[_0x6a46('0x2d')](_0x312c4b)['end']();};}function respondWithResult(_0x1239aa,_0x3005e2){_0x3005e2=_0x3005e2||0xc8;return function(_0x2aa9dc){if(_0x2aa9dc){return _0x1239aa[_0x6a46('0x2d')](_0x3005e2)[_0x6a46('0x2e')](_0x2aa9dc);}};}function respondWithFilteredResult(_0x1c2627,_0x539221){return function(_0x427a28){if(_0x427a28){var _0x506729=typeof _0x539221[_0x6a46('0x2f')]===_0x6a46('0x30')&&typeof _0x539221[_0x6a46('0x31')]===_0x6a46('0x30');var _0x15e56e=_0x427a28[_0x6a46('0x32')];var _0x371899=_0x506729?0x0:_0x539221[_0x6a46('0x2f')];var _0x202a8e=_0x506729?_0x427a28['count']:_0x539221[_0x6a46('0x2f')]+_0x539221[_0x6a46('0x31')];var _0x567c04;if(_0x202a8e>=_0x15e56e){_0x202a8e=_0x15e56e;_0x567c04=0xc8;}else{_0x567c04=0xce;}_0x1c2627[_0x6a46('0x2d')](_0x567c04);return _0x1c2627[_0x6a46('0x33')](_0x6a46('0x34'),_0x371899+'-'+_0x202a8e+'/'+_0x15e56e)['json'](_0x427a28);}return null;};}function patchUpdates(_0x24c62c){return function(_0x24f386){try{jsonpatch[_0x6a46('0x35')](_0x24f386,_0x24c62c,!![]);}catch(_0x803595){return BPromise[_0x6a46('0x36')](_0x803595);}return _0x24f386[_0x6a46('0x37')]();};}function saveUpdates(_0x2d41fc,_0x2feb4d){return function(_0x71a194){if(_0x71a194){return _0x71a194[_0x6a46('0x38')](_0x2d41fc)[_0x6a46('0x21')](function(_0x46c02c){return _0x46c02c;});}return null;};}function removeEntity(_0x2dc634,_0x471275){return function(_0x25ef2b){if(_0x25ef2b){return _0x25ef2b[_0x6a46('0x39')]()[_0x6a46('0x21')](function(){_0x2dc634[_0x6a46('0x2d')](0xcc)[_0x6a46('0x3a')]();});}};}function handleEntityNotFound(_0x3203eb,_0x250ef9){return function(_0x46353b){if(!_0x46353b){_0x3203eb[_0x6a46('0x2c')](0x194);}return _0x46353b;};}function handleError(_0x523268,_0x5e4b19){_0x5e4b19=_0x5e4b19||0x1f4;return function(_0x234ef4){logger[_0x6a46('0x28')](_0x234ef4['stack']);if(_0x234ef4[_0x6a46('0x3b')]){delete _0x234ef4[_0x6a46('0x3b')];}_0x523268[_0x6a46('0x2d')](_0x5e4b19)[_0x6a46('0x3c')](_0x234ef4);};}exports[_0x6a46('0x3d')]=function(_0x28b08b,_0x517ba9){var _0x56e47e={},_0x22eabf={},_0x4d9703={'count':0x0,'rows':[]};var _0x589c8a=_[_0x6a46('0x3e')](db[_0x6a46('0x3f')][_0x6a46('0x40')],function(_0x2fc5cf){return{'name':_0x2fc5cf[_0x6a46('0x41')],'type':_0x2fc5cf[_0x6a46('0x42')][_0x6a46('0x43')]};});_0x22eabf['model']=_[_0x6a46('0x3e')](_0x589c8a,'name');_0x22eabf[_0x6a46('0x44')]=_[_0x6a46('0x45')](_0x28b08b['query']);_0x22eabf['filters']=_[_0x6a46('0x46')](_0x22eabf[_0x6a46('0x47')],_0x22eabf[_0x6a46('0x44')]);_0x56e47e[_0x6a46('0x48')]=_[_0x6a46('0x46')](_0x22eabf['model'],qs[_0x6a46('0x49')](_0x28b08b[_0x6a46('0x44')][_0x6a46('0x49')]));_0x56e47e[_0x6a46('0x48')]=_0x56e47e[_0x6a46('0x48')][_0x6a46('0x4a')]?_0x56e47e['attributes']:_0x22eabf[_0x6a46('0x47')];if(!_0x28b08b[_0x6a46('0x44')][_0x6a46('0x4b')](_0x6a46('0x4c'))){_0x56e47e[_0x6a46('0x31')]=qs[_0x6a46('0x31')](_0x28b08b[_0x6a46('0x44')][_0x6a46('0x31')]);_0x56e47e[_0x6a46('0x2f')]=qs[_0x6a46('0x2f')](_0x28b08b[_0x6a46('0x44')]['offset']);}_0x56e47e[_0x6a46('0x4d')]=qs[_0x6a46('0x4e')](_0x28b08b[_0x6a46('0x44')][_0x6a46('0x4e')]);_0x56e47e[_0x6a46('0x4f')]=qs[_0x6a46('0x50')](_[_0x6a46('0x51')](_0x28b08b[_0x6a46('0x44')],_0x22eabf[_0x6a46('0x50')]),_0x589c8a);if(_0x28b08b[_0x6a46('0x44')][_0x6a46('0x52')]){_0x56e47e[_0x6a46('0x4f')]=_[_0x6a46('0x53')](_0x56e47e['where'],{'$or':_['map'](_0x589c8a,function(_0x57108e){if(_0x57108e[_0x6a46('0x42')]!==_0x6a46('0x54')){var _0x3ca861={};_0x3ca861[_0x57108e[_0x6a46('0x3b')]]={'$like':'%'+_0x28b08b[_0x6a46('0x44')][_0x6a46('0x52')]+'%'};return _0x3ca861;}})});}_0x56e47e=_['merge']({},_0x56e47e,_0x28b08b[_0x6a46('0x55')]);var _0x3c0e07={'where':_0x56e47e[_0x6a46('0x4f')]};return db[_0x6a46('0x3f')][_0x6a46('0x32')](_0x3c0e07)['then'](function(_0x15d339){_0x4d9703[_0x6a46('0x32')]=_0x15d339;if(_0x28b08b[_0x6a46('0x44')][_0x6a46('0x56')]){_0x56e47e[_0x6a46('0x57')]=[{'all':!![]}];}return db[_0x6a46('0x3f')][_0x6a46('0x58')](_0x56e47e);})[_0x6a46('0x21')](function(_0x335caa){_0x4d9703['rows']=_0x335caa;return _0x4d9703;})[_0x6a46('0x21')](respondWithFilteredResult(_0x517ba9,_0x56e47e))[_0x6a46('0x2b')](handleError(_0x517ba9,null));};exports[_0x6a46('0x59')]=function(_0x237fa8,_0x386aa3){var _0x4c0719={'raw':!![],'where':{'id':_0x237fa8[_0x6a46('0x5a')]['id']}},_0x145b1f={};_0x145b1f[_0x6a46('0x47')]=_[_0x6a46('0x45')](db[_0x6a46('0x3f')]['rawAttributes']);_0x145b1f[_0x6a46('0x44')]=_[_0x6a46('0x45')](_0x237fa8[_0x6a46('0x44')]);_0x145b1f[_0x6a46('0x50')]=_[_0x6a46('0x46')](_0x145b1f['model'],_0x145b1f[_0x6a46('0x44')]);_0x4c0719['attributes']=_['intersection'](_0x145b1f[_0x6a46('0x47')],qs[_0x6a46('0x49')](_0x237fa8['query'][_0x6a46('0x49')]));_0x4c0719[_0x6a46('0x48')]=_0x4c0719[_0x6a46('0x48')][_0x6a46('0x4a')]?_0x4c0719[_0x6a46('0x48')]:_0x145b1f[_0x6a46('0x47')];if(_0x237fa8['query']['includeAll']){_0x4c0719[_0x6a46('0x57')]=[{'all':!![]}];}_0x4c0719=_['merge']({},_0x4c0719,_0x237fa8['options']);return db[_0x6a46('0x3f')][_0x6a46('0x5b')](_0x4c0719)[_0x6a46('0x21')](handleEntityNotFound(_0x386aa3,null))[_0x6a46('0x21')](respondWithResult(_0x386aa3,null))[_0x6a46('0x2b')](handleError(_0x386aa3,null));};exports[_0x6a46('0x38')]=function(_0x1bc7f2,_0x53e78f){if(_0x1bc7f2['body']['id']){delete _0x1bc7f2['body']['id'];}return db[_0x6a46('0x3f')][_0x6a46('0x5b')]({'where':{'id':_0x1bc7f2[_0x6a46('0x5a')]['id']}})['then'](handleEntityNotFound(_0x53e78f,null))[_0x6a46('0x21')](saveUpdates(_0x1bc7f2[_0x6a46('0x5c')],null))[_0x6a46('0x21')](respondWithResult(_0x53e78f,null))['catch'](handleError(_0x53e78f,null));};exports[_0x6a46('0x39')]=function(_0x42ab8b,_0x3abd97){return db[_0x6a46('0x3f')][_0x6a46('0x5b')]({'where':{'id':_0x42ab8b[_0x6a46('0x5a')]['id']}})[_0x6a46('0x21')](handleEntityNotFound(_0x3abd97,null))[_0x6a46('0x21')](removeEntity(_0x3abd97,null))[_0x6a46('0x2b')](handleError(_0x3abd97,null));};exports[_0x6a46('0x5d')]=function(_0x20c35f,_0x232169){return db[_0x6a46('0x3f')][_0x6a46('0x5d')]()[_0x6a46('0x21')](respondWithResult(_0x232169,null))[_0x6a46('0x2b')](handleError(_0x232169,null));};var interaction_log=require(_0x6a46('0x14'))(_0x6a46('0x5e'));exports[_0x6a46('0x5f')]=function(_0x2682d2,_0x478628,_0x5aed2d){var _0x382ee5={'agent':{},'channel':_0x6a46('0x60')};if(_0x2682d2[_0x6a46('0x5c')]['id']){delete _0x2682d2[_0x6a46('0x5c')]['id'];}_0x2682d2[_0x6a46('0x5c')][_0x6a46('0x61')]=!![];_0x2682d2['body'][_0x6a46('0x62')]=moment()[_0x6a46('0x63')](_0x6a46('0x64'));_0x2682d2[_0x6a46('0x5c')][_0x6a46('0x65')]=_0x2682d2[_0x6a46('0x5c')][_0x6a46('0x65')]||_0x2682d2[_0x6a46('0x66')]['id'];_0x382ee5[_0x6a46('0x67')]['id']=_0x2682d2['body']['UserId'];return db[_0x6a46('0x3f')][_0x6a46('0x5b')]({'where':{'id':_0x2682d2['params']['id'],'UserId':null}})[_0x6a46('0x21')](handleEntityNotFound(_0x478628,null))[_0x6a46('0x21')](saveUpdates(_0x2682d2['body'],null))['then'](function(_0x494e35){if(_0x494e35){_0x382ee5['message']=_0x494e35[_0x6a46('0x68')]({'plain':!![]});return db[_0x6a46('0x69')][_0x6a46('0x5b')]({'where':{'id':_0x494e35[_0x6a46('0x6a')]}});}return null;})[_0x6a46('0x21')](handleEntityNotFound(_0x478628,null))['then'](function(_0x392c3b){if(_0x392c3b){return _0x392c3b[_0x6a46('0x38')]({'UserId':_0x2682d2['body']['UserId'],'read1stAt':_[_0x6a46('0x6b')](_0x392c3b[_0x6a46('0x6c')])?moment()[_0x6a46('0x63')](_0x6a46('0x64')):undefined});}return null;})['then'](function(_0x425682){if(_0x425682){_0x382ee5[_0x6a46('0x6d')]=_0x425682[_0x6a46('0x68')]({'plain':!![]});interaction_log[_0x6a46('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2682d2['user']['id'],_0x2682d2[_0x6a46('0x66')]['name'],_0x2682d2[_0x6a46('0x66')]['role'],_0x382ee5[_0x6a46('0x6d')]['id'],_0x2682d2[_0x6a46('0x5c')]?JSON[_0x6a46('0x27')](_0x2682d2['body']):'null');return respondWithRpcPromise(_0x6a46('0x6e'),_0x6a46('0x6f'),_0x382ee5);}return null;})[_0x6a46('0x21')](function(_0x5357a1){var _0x43cbfc=_0x6a46('0x70')+_0x5357a1[_0x6a46('0x29')]['ContactId'];return db['sequelize'][_0x6a46('0x44')](_0x43cbfc,{'type':db['Sequelize'][_0x6a46('0x71')][_0x6a46('0x72')],'raw':!![]})['then'](function(_0x427cc1){return _0x427cc1;});})[_0x6a46('0x21')](function(_0x182254){if(_0x182254){_0x382ee5['message'][_0x6a46('0x73')]=_0x182254[0x0];if(!_0x2682d2[_0x6a46('0x5c')][_0x6a46('0x65')])return;return db[_0x6a46('0x74')][_0x6a46('0x5b')]({'where':{'id':_0x2682d2['body']['UserId'],'role':_0x6a46('0x67')},'attributes':['id',_0x6a46('0x3b'),_0x6a46('0x75'),_0x6a46('0x76'),_0x6a46('0x77')],'raw':!![]});}return null;})[_0x6a46('0x21')](function(_0x499410){if(!_0x499410)return null;_0x382ee5['message']['agent']=_0x499410;return _0x382ee5;})[_0x6a46('0x21')](function(_0x52bdd1){if(_0x52bdd1){if(_0x2682d2['body']['manual']){_0x382ee5[_0x6a46('0x29')][_0x6a46('0x78')]=util[_0x6a46('0x63')]('SIP/%s',_0x2682d2['user']['name']);_0x382ee5[_0x6a46('0x29')]['channel']=_0x382ee5[_0x6a46('0x79')];_0x382ee5[_0x6a46('0x29')][_0x6a46('0x7a')]=_0x382ee5[_0x6a46('0x79')];_0x382ee5['message'][_0x6a46('0x7b')]=_0x6a46('0x5f');return respondWithRpcPromise(_0x6a46('0x7c'),'EventManager',{'event':'acceptmessage','message':_0x382ee5[_0x6a46('0x29')]},client9002)[_0x6a46('0x21')](function(){return _0x382ee5;});}return _0x382ee5;}return null;})[_0x6a46('0x21')](respondWithResult(_0x478628,null))[_0x6a46('0x2b')](handleError(_0x478628,null));};var interaction_log=require(_0x6a46('0x14'))(_0x6a46('0x5e'));exports[_0x6a46('0x36')]=function(_0x8cecb1,_0x514df0,_0x4c38f4){var _0x1c5a90={'agent':{},'channel':'fax'};if(_0x8cecb1[_0x6a46('0x5c')]['id']){delete _0x8cecb1[_0x6a46('0x5c')]['id'];}_0x8cecb1[_0x6a46('0x5c')]['UserId']=_0x8cecb1['body'][_0x6a46('0x65')]||_0x8cecb1['user']['id'];_0x1c5a90[_0x6a46('0x67')]['id']=_0x8cecb1[_0x6a46('0x5c')][_0x6a46('0x65')];return db['FaxMessage'][_0x6a46('0x5b')]({'where':{'id':_0x8cecb1[_0x6a46('0x5a')]['id'],'UserId':null}})[_0x6a46('0x21')](handleEntityNotFound(_0x514df0,null))[_0x6a46('0x21')](function(_0x2d8a34){if(_0x2d8a34){_0x1c5a90[_0x6a46('0x29')]=_0x2d8a34['get']({'plain':!![]});return db[_0x6a46('0x69')]['find']({'where':{'id':_0x2d8a34[_0x6a46('0x6a')]}});}return null;})[_0x6a46('0x21')](handleEntityNotFound(_0x514df0,null))['then'](function(_0x2a511a){if(_0x2a511a){_0x1c5a90[_0x6a46('0x6d')]=_0x2a511a[_0x6a46('0x68')]({'plain':!![]});interaction_log['info'](_0x6a46('0x7d'),_0x8cecb1[_0x6a46('0x66')]['id'],_0x8cecb1['user'][_0x6a46('0x3b')],_0x8cecb1[_0x6a46('0x66')][_0x6a46('0x7e')],_0x1c5a90[_0x6a46('0x6d')]['id'],_0x8cecb1[_0x6a46('0x5c')]?JSON[_0x6a46('0x27')](_0x8cecb1[_0x6a46('0x5c')]):_0x6a46('0x7f'));return respondWithRpcPromise('RejectMessage',_0x6a46('0x80'),_0x1c5a90);}return null;})['then'](function(_0x9c4c16){var _0x47326c=_0x6a46('0x70')+_0x9c4c16[_0x6a46('0x29')]['ContactId'];return db[_0x6a46('0x81')]['query'](_0x47326c,{'type':db[_0x6a46('0x82')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6a46('0x21')](function(_0x186f3a){return _0x186f3a;});})[_0x6a46('0x21')](function(_0xc88e01){if(_0xc88e01){_0x1c5a90[_0x6a46('0x29')][_0x6a46('0x73')]=_0xc88e01[0x0];if(!_0x8cecb1['body'][_0x6a46('0x65')])return;return db[_0x6a46('0x74')][_0x6a46('0x5b')]({'where':{'id':_0x8cecb1[_0x6a46('0x5c')][_0x6a46('0x65')],'role':_0x6a46('0x67')},'attributes':['id','name',_0x6a46('0x75'),_0x6a46('0x76'),_0x6a46('0x77')],'raw':!![]});}return null;})[_0x6a46('0x21')](function(_0x370b93){if(!_0x370b93)return null;_0x1c5a90[_0x6a46('0x29')]['agent']=_0x370b93;return _0x1c5a90;})[_0x6a46('0x21')](function(_0x28cbc1){if(_0x28cbc1){_0x28cbc1[_0x6a46('0x29')]['interface']=util[_0x6a46('0x63')](_0x6a46('0x83'),_0x8cecb1['user']['name']);_0x28cbc1[_0x6a46('0x29')][_0x6a46('0x79')]=_0x1c5a90['channel'];_0x28cbc1[_0x6a46('0x29')][_0x6a46('0x7a')]=_0x1c5a90[_0x6a46('0x79')];_0x28cbc1[_0x6a46('0x29')][_0x6a46('0x7b')]=_0x6a46('0x36');respondWithRpcPromise('EventManager',_0x6a46('0x7c'),{'event':_0x6a46('0x84'),'message':_0x28cbc1['message']},client9002);return _0x1c5a90;}return null;})[_0x6a46('0x21')](respondWithResult(_0x514df0,null))[_0x6a46('0x2b')](handleError(_0x514df0,null));};exports['create']=function(_0x33a4de,_0x20dad4){var _0x502bc8;return db[_0x6a46('0x3f')][_0x6a46('0x85')](_0x33a4de['body'],{})[_0x6a46('0x21')](function(_0x4634e2){_0x502bc8=_0x4634e2;return db[_0x6a46('0x86')]['findOne']({'where':{'id':_0x502bc8[_0x6a46('0x87')]}});})[_0x6a46('0x21')](function(_0x555e74){if(_[_0x6a46('0x6b')](_0x555e74)){return;}else{_0x502bc8['fax']=_0x555e74['fax'];return db[_0x6a46('0x88')]['findOne']({'where':{'id':_0x502bc8[_0x6a46('0x89')]}});}})[_0x6a46('0x21')](function(_0x3d5b85){return respondWithRpcPromise(_0x6a46('0x8a'),_0x6a46('0x8a'),{'FaxAccountId':_[_0x6a46('0x6b')](_0x33a4de[_0x6a46('0x5c')])?undefined:_0x33a4de[_0x6a46('0x5c')]['FaxAccountId'],'path':_['isNil'](_0x3d5b85)?undefined:util[_0x6a46('0x63')](_0x6a46('0x8b'),_0x3d5b85[_0x6a46('0x8c')]),'fax':_[_0x6a46('0x6b')](_0x502bc8[_0x6a46('0x60')])?undefined:_0x502bc8[_0x6a46('0x60')],'AttachmentId':_0x502bc8[_0x6a46('0x89')]},client9002);})[_0x6a46('0x21')](respondWithResult(_0x20dad4,0xc9))[_0x6a46('0x2b')](handleError(_0x20dad4,null));};exports[_0x6a46('0x8d')]=function(_0x44485d,_0x557cd2){var _0x52f0bf=path[_0x6a46('0x8e')](config[_0x6a46('0x8f')],_0x6a46('0x90'),_0x6a46('0x91'),_0x6a46('0x92'));return db[_0x6a46('0x3f')]['find']({'where':{'id':_0x44485d[_0x6a46('0x5a')]['id']},'include':[{'model':db[_0x6a46('0x88')],'as':_0x6a46('0x88')}]})[_0x6a46('0x21')](handleEntityNotFound(_0x557cd2,null))[_0x6a46('0x21')](function(_0x296ce6){if(_0x296ce6){return _0x557cd2[_0x6a46('0x8d')](path[_0x6a46('0x8e')](_0x52f0bf,_0x296ce6[_0x6a46('0x88')][_0x6a46('0x8c')]));}})['catch'](handleError(_0x557cd2,null));}; \ No newline at end of file +var _0x9ff7=['SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','rejectmessage','create','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','server','files','attachments','Attachment','download','join','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','rows','filters','update','body','find','params','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes'];(function(_0x39c048,_0x3605e2){var _0x6fae26=function(_0xb7e71d){while(--_0xb7e71d){_0x39c048['push'](_0x39c048['shift']());}};_0x6fae26(++_0x3605e2);}(_0x9ff7,0x13e));var _0x79ff=function(_0x5e4372,_0x33a08a){_0x5e4372=_0x5e4372-0x0;var _0x358954=_0x9ff7[_0x5e4372];return _0x358954;};'use strict';var emlformat=require(_0x79ff('0x0'));var rimraf=require(_0x79ff('0x1'));var zipdir=require(_0x79ff('0x2'));var jsonpatch=require(_0x79ff('0x3'));var rp=require('request-promise');var moment=require(_0x79ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x79ff('0x5'));var util=require(_0x79ff('0x6'));var path=require(_0x79ff('0x7'));var sox=require(_0x79ff('0x8'));var csv=require('to-csv');var ejs=require(_0x79ff('0x9'));var fs=require('fs');var fs_extra=require(_0x79ff('0xa'));var _=require(_0x79ff('0xb'));var squel=require('squel');var crypto=require(_0x79ff('0xc'));var jsforce=require(_0x79ff('0xd'));var deskjs=require(_0x79ff('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x79ff('0xf'));var Redis=require(_0x79ff('0x10'));var authService=require(_0x79ff('0x11'));var qs=require(_0x79ff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79ff('0x13'));var logger=require(_0x79ff('0x14'))(_0x79ff('0x15'));var utils=require(_0x79ff('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x79ff('0x17'));var db=require(_0x79ff('0x18'))['db'];config[_0x79ff('0x19')]=_[_0x79ff('0x1a')](config[_0x79ff('0x19')],{'host':_0x79ff('0x1b'),'port':0x18eb});var socket=require(_0x79ff('0x1c'))(new Redis(config[_0x79ff('0x19')]));require(_0x79ff('0x1d'))[_0x79ff('0x1e')](socket);var jayson=require(_0x79ff('0x1f'));var client=jayson[_0x79ff('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x79ff('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd0af,_0xc36a70,_0x43b3b8,_0x45c49a){return new BPromise(function(_0x29fa2c,_0x2075ae){var _0x4e4172=_0x45c49a||client;return _0x4e4172[_0x79ff('0x21')](_0x1dd0af,_0x43b3b8)[_0x79ff('0x22')](function(_0x251455){logger[_0x79ff('0x23')](_0x79ff('0x24'),_0xc36a70,_0x79ff('0x25'));logger[_0x79ff('0x26')](_0x79ff('0x27'),_0xc36a70,'request\x20sent',JSON[_0x79ff('0x28')](_0x251455));if(_0x251455[_0x79ff('0x29')]){if(_0x251455[_0x79ff('0x29')][_0x79ff('0x2a')]===0x1f4){logger[_0x79ff('0x29')]('FaxMessage,\x20%s,\x20%s',_0xc36a70,_0x251455['error']['message']);return _0x2075ae(_0x251455[_0x79ff('0x29')]['message']);}logger['error'](_0x79ff('0x24'),_0xc36a70,_0x251455['error'][_0x79ff('0x2b')]);return _0x29fa2c(_0x251455[_0x79ff('0x29')]['message']);}else{logger[_0x79ff('0x23')]('FaxMessage,\x20%s,\x20%s',_0xc36a70,_0x79ff('0x25'));_0x29fa2c(_0x251455[_0x79ff('0x2c')][_0x79ff('0x2b')]);}})[_0x79ff('0x2d')](function(_0x1f4d8a){logger['error'](_0x79ff('0x24'),_0xc36a70,_0x1f4d8a);_0x2075ae(_0x1f4d8a);});});}function respondWithStatusCode(_0x9f6a94,_0x2efc90){_0x2efc90=_0x2efc90||0xcc;return function(_0xde51d1){if(_0xde51d1){return _0x9f6a94[_0x79ff('0x2e')](_0x2efc90);}return _0x9f6a94[_0x79ff('0x2f')](_0x2efc90)[_0x79ff('0x30')]();};}function respondWithResult(_0xe7faaa,_0x48564a){_0x48564a=_0x48564a||0xc8;return function(_0x478a23){if(_0x478a23){return _0xe7faaa[_0x79ff('0x2f')](_0x48564a)[_0x79ff('0x31')](_0x478a23);}};}function respondWithFilteredResult(_0x521bee,_0x54d2f1){return function(_0x3ce859){if(_0x3ce859){var _0x4f91c6=typeof _0x54d2f1[_0x79ff('0x32')]==='undefined'&&typeof _0x54d2f1[_0x79ff('0x33')]===_0x79ff('0x34');var _0x25daf4=_0x3ce859['count'];var _0x2ffb54=_0x4f91c6?0x0:_0x54d2f1[_0x79ff('0x32')];var _0x34db29=_0x4f91c6?_0x3ce859[_0x79ff('0x35')]:_0x54d2f1['offset']+_0x54d2f1['limit'];var _0x1586de;if(_0x34db29>=_0x25daf4){_0x34db29=_0x25daf4;_0x1586de=0xc8;}else{_0x1586de=0xce;}_0x521bee[_0x79ff('0x2f')](_0x1586de);return _0x521bee[_0x79ff('0x36')]('Content-Range',_0x2ffb54+'-'+_0x34db29+'/'+_0x25daf4)[_0x79ff('0x31')](_0x3ce859);}return null;};}function patchUpdates(_0x5cbdf2){return function(_0x4720a4){try{jsonpatch['apply'](_0x4720a4,_0x5cbdf2,!![]);}catch(_0x1db7b5){return BPromise['reject'](_0x1db7b5);}return _0x4720a4['save']();};}function saveUpdates(_0x329158,_0x27ffb2){return function(_0x2bd203){if(_0x2bd203){return _0x2bd203['update'](_0x329158)[_0x79ff('0x22')](function(_0x53c187){return _0x53c187;});}return null;};}function removeEntity(_0x2e7da9,_0x4a1997){return function(_0x39c7f2){if(_0x39c7f2){return _0x39c7f2[_0x79ff('0x37')]()['then'](function(){_0x2e7da9['status'](0xcc)[_0x79ff('0x30')]();});}};}function handleEntityNotFound(_0x199e4f,_0x503f91){return function(_0x3abc17){if(!_0x3abc17){_0x199e4f[_0x79ff('0x2e')](0x194);}return _0x3abc17;};}function handleError(_0x1891ca,_0x1421fd){_0x1421fd=_0x1421fd||0x1f4;return function(_0x297b79){logger[_0x79ff('0x29')](_0x297b79[_0x79ff('0x38')]);if(_0x297b79[_0x79ff('0x39')]){delete _0x297b79['name'];}_0x1891ca[_0x79ff('0x2f')](_0x1421fd)[_0x79ff('0x3a')](_0x297b79);};}exports[_0x79ff('0x3b')]=function(_0x25a0b5,_0x273d7f){var _0x3ea487={},_0x20dcdc={},_0x47c072={'count':0x0,'rows':[]};var _0x309721=_[_0x79ff('0x3c')](db[_0x79ff('0x3d')][_0x79ff('0x3e')],function(_0x434ddd){return{'name':_0x434ddd['fieldName'],'type':_0x434ddd[_0x79ff('0x3f')]['key']};});_0x20dcdc[_0x79ff('0x40')]=_[_0x79ff('0x3c')](_0x309721,_0x79ff('0x39'));_0x20dcdc[_0x79ff('0x41')]=_[_0x79ff('0x42')](_0x25a0b5[_0x79ff('0x41')]);_0x20dcdc['filters']=_[_0x79ff('0x43')](_0x20dcdc['model'],_0x20dcdc['query']);_0x3ea487[_0x79ff('0x44')]=_[_0x79ff('0x43')](_0x20dcdc[_0x79ff('0x40')],qs['fields'](_0x25a0b5['query'][_0x79ff('0x45')]));_0x3ea487[_0x79ff('0x44')]=_0x3ea487[_0x79ff('0x44')][_0x79ff('0x46')]?_0x3ea487[_0x79ff('0x44')]:_0x20dcdc[_0x79ff('0x40')];if(!_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x47')](_0x79ff('0x48'))){_0x3ea487['limit']=qs[_0x79ff('0x33')](_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x33')]);_0x3ea487['offset']=qs[_0x79ff('0x32')](_0x25a0b5[_0x79ff('0x41')]['offset']);}_0x3ea487[_0x79ff('0x49')]=qs['sort'](_0x25a0b5[_0x79ff('0x41')]['sort']);_0x3ea487[_0x79ff('0x4a')]=qs['filters'](_[_0x79ff('0x4b')](_0x25a0b5[_0x79ff('0x41')],_0x20dcdc['filters']),_0x309721);if(_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x4c')]){_0x3ea487[_0x79ff('0x4a')]=_[_0x79ff('0x4d')](_0x3ea487['where'],{'$or':_[_0x79ff('0x3c')](_0x309721,function(_0x409db0){if(_0x409db0[_0x79ff('0x3f')]!=='VIRTUAL'){var _0x402c96={};_0x402c96[_0x409db0[_0x79ff('0x39')]]={'$like':'%'+_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x4c')]+'%'};return _0x402c96;}})});}_0x3ea487=_['merge']({},_0x3ea487,_0x25a0b5[_0x79ff('0x4e')]);var _0x386ccc={'where':_0x3ea487[_0x79ff('0x4a')]};return db[_0x79ff('0x3d')][_0x79ff('0x35')](_0x386ccc)[_0x79ff('0x22')](function(_0x4ac2b1){_0x47c072[_0x79ff('0x35')]=_0x4ac2b1;if(_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x4f')]){_0x3ea487[_0x79ff('0x50')]=[{'all':!![]}];}return db[_0x79ff('0x3d')]['findAll'](_0x3ea487);})[_0x79ff('0x22')](function(_0x77a473){_0x47c072[_0x79ff('0x51')]=_0x77a473;return _0x47c072;})[_0x79ff('0x22')](respondWithFilteredResult(_0x273d7f,_0x3ea487))[_0x79ff('0x2d')](handleError(_0x273d7f,null));};exports['show']=function(_0x444bb2,_0x4b77d7){var _0x292a32={'raw':!![],'where':{'id':_0x444bb2['params']['id']}},_0x6e5bc4={};_0x6e5bc4[_0x79ff('0x40')]=_[_0x79ff('0x42')](db[_0x79ff('0x3d')][_0x79ff('0x3e')]);_0x6e5bc4['query']=_[_0x79ff('0x42')](_0x444bb2[_0x79ff('0x41')]);_0x6e5bc4[_0x79ff('0x52')]=_[_0x79ff('0x43')](_0x6e5bc4[_0x79ff('0x40')],_0x6e5bc4['query']);_0x292a32['attributes']=_[_0x79ff('0x43')](_0x6e5bc4[_0x79ff('0x40')],qs[_0x79ff('0x45')](_0x444bb2['query'][_0x79ff('0x45')]));_0x292a32[_0x79ff('0x44')]=_0x292a32[_0x79ff('0x44')]['length']?_0x292a32['attributes']:_0x6e5bc4[_0x79ff('0x40')];if(_0x444bb2[_0x79ff('0x41')][_0x79ff('0x4f')]){_0x292a32[_0x79ff('0x50')]=[{'all':!![]}];}_0x292a32=_[_0x79ff('0x4d')]({},_0x292a32,_0x444bb2[_0x79ff('0x4e')]);return db[_0x79ff('0x3d')]['find'](_0x292a32)[_0x79ff('0x22')](handleEntityNotFound(_0x4b77d7,null))['then'](respondWithResult(_0x4b77d7,null))[_0x79ff('0x2d')](handleError(_0x4b77d7,null));};exports[_0x79ff('0x53')]=function(_0x24a48e,_0x48b1ac){if(_0x24a48e[_0x79ff('0x54')]['id']){delete _0x24a48e[_0x79ff('0x54')]['id'];}return db[_0x79ff('0x3d')][_0x79ff('0x55')]({'where':{'id':_0x24a48e[_0x79ff('0x56')]['id']}})[_0x79ff('0x22')](handleEntityNotFound(_0x48b1ac,null))[_0x79ff('0x22')](saveUpdates(_0x24a48e[_0x79ff('0x54')],null))[_0x79ff('0x22')](respondWithResult(_0x48b1ac,null))[_0x79ff('0x2d')](handleError(_0x48b1ac,null));};exports[_0x79ff('0x37')]=function(_0x190f6f,_0x1c1cfb){return db[_0x79ff('0x3d')]['find']({'where':{'id':_0x190f6f['params']['id']}})['then'](handleEntityNotFound(_0x1c1cfb,null))[_0x79ff('0x22')](removeEntity(_0x1c1cfb,null))[_0x79ff('0x2d')](handleError(_0x1c1cfb,null));};exports[_0x79ff('0x57')]=function(_0x52dc71,_0x55588a){return db['FaxMessage'][_0x79ff('0x57')]()[_0x79ff('0x22')](respondWithResult(_0x55588a,null))[_0x79ff('0x2d')](handleError(_0x55588a,null));};var interaction_log=require('../../config/logger')(_0x79ff('0x58'));exports[_0x79ff('0x59')]=function(_0x3484fb,_0x50621f,_0xc0f771){var _0x254811={'agent':{},'channel':_0x79ff('0x5a')};if(_0x3484fb[_0x79ff('0x54')]['id']){delete _0x3484fb[_0x79ff('0x54')]['id'];}_0x3484fb['body'][_0x79ff('0x5b')]=!![];_0x3484fb[_0x79ff('0x54')][_0x79ff('0x5c')]=moment()[_0x79ff('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3484fb[_0x79ff('0x54')][_0x79ff('0x5e')]=_0x3484fb['body'][_0x79ff('0x5e')]||_0x3484fb[_0x79ff('0x5f')]['id'];_0x254811[_0x79ff('0x60')]['id']=_0x3484fb['body'][_0x79ff('0x5e')];return db[_0x79ff('0x3d')][_0x79ff('0x55')]({'where':{'id':_0x3484fb['params']['id'],'UserId':null}})[_0x79ff('0x22')](handleEntityNotFound(_0x50621f,null))[_0x79ff('0x22')](saveUpdates(_0x3484fb[_0x79ff('0x54')],null))[_0x79ff('0x22')](function(_0x1704ef){if(_0x1704ef){_0x254811[_0x79ff('0x2b')]=_0x1704ef[_0x79ff('0x61')]({'plain':!![]});return db[_0x79ff('0x62')][_0x79ff('0x55')]({'where':{'id':_0x1704ef[_0x79ff('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x50621f,null))[_0x79ff('0x22')](function(_0x5ce9a4){if(_0x5ce9a4){return _0x5ce9a4[_0x79ff('0x53')]({'UserId':_0x3484fb[_0x79ff('0x54')]['UserId'],'read1stAt':_[_0x79ff('0x64')](_0x5ce9a4[_0x79ff('0x65')])?moment()[_0x79ff('0x5d')](_0x79ff('0x66')):undefined});}return null;})[_0x79ff('0x22')](function(_0x46adaa){if(_0x46adaa){_0x254811['interaction']=_0x46adaa[_0x79ff('0x61')]({'plain':!![]});interaction_log[_0x79ff('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3484fb[_0x79ff('0x5f')]['id'],_0x3484fb[_0x79ff('0x5f')][_0x79ff('0x39')],_0x3484fb['user'][_0x79ff('0x67')],_0x254811[_0x79ff('0x68')]['id'],_0x3484fb['body']?JSON[_0x79ff('0x28')](_0x3484fb[_0x79ff('0x54')]):_0x79ff('0x69'));return respondWithRpcPromise(_0x79ff('0x6a'),_0x79ff('0x6b'),_0x254811);}return null;})[_0x79ff('0x22')](function(_0x2f3c0f){var _0x222adb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f3c0f[_0x79ff('0x2b')][_0x79ff('0x6c')];return db[_0x79ff('0x6d')][_0x79ff('0x41')](_0x222adb,{'type':db['Sequelize'][_0x79ff('0x6e')][_0x79ff('0x6f')],'raw':!![]})[_0x79ff('0x22')](function(_0x3d2d2f){return _0x3d2d2f;});})[_0x79ff('0x22')](function(_0x412695){if(_0x412695){_0x254811['message'][_0x79ff('0x70')]=_0x412695[0x0];if(!_0x3484fb[_0x79ff('0x54')][_0x79ff('0x5e')])return;return db[_0x79ff('0x71')][_0x79ff('0x55')]({'where':{'id':_0x3484fb[_0x79ff('0x54')]['UserId'],'role':_0x79ff('0x60')},'attributes':['id',_0x79ff('0x39'),_0x79ff('0x72'),_0x79ff('0x73'),_0x79ff('0x74')],'raw':!![]});}return null;})[_0x79ff('0x22')](function(_0x4407e2){if(!_0x4407e2)return null;_0x254811['message'][_0x79ff('0x60')]=_0x4407e2;return _0x254811;})[_0x79ff('0x22')](function(_0x347e0a){if(_0x347e0a){if(_0x3484fb[_0x79ff('0x54')][_0x79ff('0x75')]){_0x254811[_0x79ff('0x2b')][_0x79ff('0x76')]=util['format'](_0x79ff('0x77'),_0x3484fb[_0x79ff('0x5f')][_0x79ff('0x39')]);_0x254811[_0x79ff('0x2b')][_0x79ff('0x78')]=_0x254811[_0x79ff('0x78')];_0x254811[_0x79ff('0x2b')][_0x79ff('0x79')]=_0x254811[_0x79ff('0x78')];_0x254811['message']['event']=_0x79ff('0x59');return respondWithRpcPromise(_0x79ff('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x254811[_0x79ff('0x2b')]},client9002)[_0x79ff('0x22')](function(){return _0x254811;});}return _0x254811;}return null;})[_0x79ff('0x22')](respondWithResult(_0x50621f,null))['catch'](handleError(_0x50621f,null));};var interaction_log=require(_0x79ff('0x14'))('fax-interactions');exports['reject']=function(_0x16d4d9,_0x125479,_0x41740c){var _0x5bfb46={'agent':{},'channel':'fax'};if(_0x16d4d9[_0x79ff('0x54')]['id']){delete _0x16d4d9[_0x79ff('0x54')]['id'];}_0x16d4d9['body']['UserId']=_0x16d4d9[_0x79ff('0x54')][_0x79ff('0x5e')]||_0x16d4d9[_0x79ff('0x5f')]['id'];_0x5bfb46['agent']['id']=_0x16d4d9['body'][_0x79ff('0x5e')];return db['FaxMessage'][_0x79ff('0x55')]({'where':{'id':_0x16d4d9[_0x79ff('0x56')]['id'],'UserId':null}})[_0x79ff('0x22')](handleEntityNotFound(_0x125479,null))[_0x79ff('0x22')](function(_0x4e44d1){if(_0x4e44d1){_0x5bfb46[_0x79ff('0x2b')]=_0x4e44d1[_0x79ff('0x61')]({'plain':!![]});return db[_0x79ff('0x62')][_0x79ff('0x55')]({'where':{'id':_0x4e44d1[_0x79ff('0x63')]}});}return null;})[_0x79ff('0x22')](handleEntityNotFound(_0x125479,null))[_0x79ff('0x22')](function(_0x546f4d){if(_0x546f4d){_0x5bfb46[_0x79ff('0x68')]=_0x546f4d[_0x79ff('0x61')]({'plain':!![]});interaction_log['info'](_0x79ff('0x7b'),_0x16d4d9['user']['id'],_0x16d4d9[_0x79ff('0x5f')][_0x79ff('0x39')],_0x16d4d9['user'][_0x79ff('0x67')],_0x5bfb46[_0x79ff('0x68')]['id'],_0x16d4d9[_0x79ff('0x54')]?JSON['stringify'](_0x16d4d9['body']):_0x79ff('0x69'));return respondWithRpcPromise(_0x79ff('0x7c'),_0x79ff('0x7d'),_0x5bfb46);}return null;})['then'](function(_0x575182){var _0x43a913=_0x79ff('0x7e')+_0x575182['message'][_0x79ff('0x6c')];return db[_0x79ff('0x6d')][_0x79ff('0x41')](_0x43a913,{'type':db[_0x79ff('0x7f')][_0x79ff('0x6e')][_0x79ff('0x6f')],'raw':!![]})['then'](function(_0x2a22fc){return _0x2a22fc;});})[_0x79ff('0x22')](function(_0x3a7f8a){if(_0x3a7f8a){_0x5bfb46[_0x79ff('0x2b')]['contact']=_0x3a7f8a[0x0];if(!_0x16d4d9[_0x79ff('0x54')]['UserId'])return;return db[_0x79ff('0x71')][_0x79ff('0x55')]({'where':{'id':_0x16d4d9['body'][_0x79ff('0x5e')],'role':_0x79ff('0x60')},'attributes':['id','name','fullname',_0x79ff('0x73'),_0x79ff('0x74')],'raw':!![]});}return null;})[_0x79ff('0x22')](function(_0x4b1e37){if(!_0x4b1e37)return null;_0x5bfb46[_0x79ff('0x2b')][_0x79ff('0x60')]=_0x4b1e37;return _0x5bfb46;})[_0x79ff('0x22')](function(_0x1eec96){if(_0x1eec96){_0x1eec96['message'][_0x79ff('0x76')]=util[_0x79ff('0x5d')](_0x79ff('0x77'),_0x16d4d9['user'][_0x79ff('0x39')]);_0x1eec96['message']['channel']=_0x5bfb46['channel'];_0x1eec96['message'][_0x79ff('0x79')]=_0x5bfb46[_0x79ff('0x78')];_0x1eec96[_0x79ff('0x2b')]['event']='reject';respondWithRpcPromise(_0x79ff('0x7a'),_0x79ff('0x7a'),{'event':_0x79ff('0x80'),'message':_0x1eec96[_0x79ff('0x2b')]},client9002);return _0x5bfb46;}return null;})[_0x79ff('0x22')](respondWithResult(_0x125479,null))[_0x79ff('0x2d')](handleError(_0x125479,null));};exports[_0x79ff('0x81')]=function(_0x498aa2,_0x2a0045){var _0x594c86;return db['FaxMessage'][_0x79ff('0x81')](_0x498aa2['body'],{})[_0x79ff('0x22')](function(_0xa57c1a){_0x594c86=_0xa57c1a;return db['CmContact']['findOne']({'where':{'id':_0x594c86[_0x79ff('0x6c')]}});})[_0x79ff('0x22')](function(_0x4df680){if(_['isNil'](_0x4df680)){return;}else{_0x594c86[_0x79ff('0x5a')]=_0x4df680['fax'];return db['Attachment'][_0x79ff('0x82')]({'where':{'id':_0x594c86[_0x79ff('0x83')]}});}})['then'](function(_0x3799f1){return respondWithRpcPromise(_0x79ff('0x84'),_0x79ff('0x84'),{'FaxAccountId':_[_0x79ff('0x64')](_0x498aa2['body'])?undefined:_0x498aa2[_0x79ff('0x54')][_0x79ff('0x85')],'path':_[_0x79ff('0x64')](_0x3799f1)?undefined:util[_0x79ff('0x5d')](_0x79ff('0x86'),_0x3799f1[_0x79ff('0x87')]),'fax':_[_0x79ff('0x64')](_0x594c86[_0x79ff('0x5a')])?undefined:_0x594c86[_0x79ff('0x5a')],'AttachmentId':_0x594c86[_0x79ff('0x83')]},client9002);})[_0x79ff('0x22')](respondWithResult(_0x2a0045,0xc9))[_0x79ff('0x2d')](handleError(_0x2a0045,null));};exports['download']=function(_0x28e5fd,_0x590912){var _0x55cfe9=path['join'](config[_0x79ff('0x88')],_0x79ff('0x89'),_0x79ff('0x8a'),_0x79ff('0x8b'));return db['FaxMessage'][_0x79ff('0x55')]({'where':{'id':_0x28e5fd[_0x79ff('0x56')]['id']},'include':[{'model':db[_0x79ff('0x8c')],'as':_0x79ff('0x8c')}]})[_0x79ff('0x22')](handleEntityNotFound(_0x590912,null))[_0x79ff('0x22')](function(_0x5f48fd){if(_0x5f48fd){return _0x590912[_0x79ff('0x8d')](path[_0x79ff('0x8e')](_0x55cfe9,_0x5f48fd[_0x79ff('0x8c')]['basename']));}})[_0x79ff('0x2d')](handleError(_0x590912,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d0e6eb1..d987866 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 _0x6829=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','update','remove'];(function(_0x4a3746,_0x37b7a8){var _0x3916c4=function(_0x3d8b1a){while(--_0x3d8b1a){_0x4a3746['push'](_0x4a3746['shift']());}};_0x3916c4(++_0x37b7a8);}(_0x6829,0x14c));var _0x9682=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6829[_0x1ccdf7];return _0x52a0ae;};'use strict';var EventEmitter=require(_0x9682('0x0'));var FaxMessage=require(_0x9682('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9682('0x2'),'afterDestroy':_0x9682('0x3')};function emitEvent(_0x1bfe61){return function(_0x3b8d4a,_0x3b721e,_0x1b0e5f){FaxMessageEvents[_0x9682('0x4')](_0x1bfe61+':'+_0x3b8d4a['id'],_0x3b8d4a);FaxMessageEvents[_0x9682('0x4')](_0x1bfe61,_0x3b8d4a);_0x1b0e5f(null);};}for(var e in events){if(events[_0x9682('0x5')](e)){var event=events[e];FaxMessage[_0x9682('0x6')](e,emitEvent(event));}}module[_0x9682('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x6cfd=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','FaxMessage'];(function(_0x44b0af,_0xdb6975){var _0xafaa74=function(_0xf734d3){while(--_0xf734d3){_0x44b0af['push'](_0x44b0af['shift']());}};_0xafaa74(++_0xdb6975);}(_0x6cfd,0x1b7));var _0xd6cf=function(_0x1eb6ea,_0x55050e){_0x1eb6ea=_0x1eb6ea-0x0;var _0x17a663=_0x6cfd[_0x1eb6ea];return _0x17a663;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0xd6cf('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd6cf('0x1')](0x0);var events={'afterCreate':_0xd6cf('0x2'),'afterUpdate':_0xd6cf('0x3'),'afterDestroy':_0xd6cf('0x4')};function emitEvent(_0x5cfa14){return function(_0x3cbd02,_0x1ede7e,_0x150cf6){FaxMessageEvents['emit'](_0x5cfa14+':'+_0x3cbd02['id'],_0x3cbd02);FaxMessageEvents[_0xd6cf('0x5')](_0x5cfa14,_0x3cbd02);_0x150cf6(null);};}for(var e in events){if(events[_0xd6cf('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xd6cf('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9e0f193..3ae2e87 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 _0x9b6e=['secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x4dd7c2,_0x5e86af){var _0x48ae97=function(_0x477727){while(--_0x477727){_0x4dd7c2['push'](_0x4dd7c2['shift']());}};_0x48ae97(++_0x5e86af);}(_0x9b6e,0x70));var _0xe9b6=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9b6e[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xe9b6('0x0'));var util=require(_0xe9b6('0x1'));var logger=require(_0xe9b6('0x2'))(_0xe9b6('0x3'));var moment=require(_0xe9b6('0x4'));var BPromise=require(_0xe9b6('0x5'));var rp=require(_0xe9b6('0x6'));var fs=require('fs');var path=require(_0xe9b6('0x7'));var rimraf=require(_0xe9b6('0x8'));var config=require(_0xe9b6('0x9'));var attributes=require('./faxMessage.attributes');module[_0xe9b6('0xa')]=function(_0x3c83ca,_0x1f060c){return _0x3c83ca[_0xe9b6('0xb')](_0xe9b6('0xc'),attributes,{'tableName':_0xe9b6('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xe9b6('0xe')],'type':_0xe9b6('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a930b,_0x47a6e6,_0x3d4c1c){var _0x282f6e=_0x3c83ca[_0xe9b6('0x10')];var _0x3cca30=_0x3a930b[_0xe9b6('0x11')]({'plain':!![]});if(_0x3cca30[_0xe9b6('0x12')][_0xe9b6('0x13')]()==='in'||_0x3cca30['direction'][_0xe9b6('0x13')]()==='out'&&!_0x3cca30[_0xe9b6('0x14')]&&!_[_0xe9b6('0x15')](_0x3cca30[_0xe9b6('0x16')])){_0x282f6e[_0xe9b6('0x17')][_0xe9b6('0x18')]({'where':{'id':_0x3cca30[_0xe9b6('0x19')]}})[_0xe9b6('0x1a')](function(_0x3bcc65){if(_0x3bcc65){_0x3bcc65[_0xe9b6('0x1b')]({'lastMsgAt':_0x3cca30[_0xe9b6('0x1c')],'lastMsgDirection':_0x3cca30[_0xe9b6('0x12')][_0xe9b6('0x13')]()});}})[_0xe9b6('0x1d')](function(_0x4f9001){console[_0xe9b6('0x1e')](_0x4f9001);});}_0x3d4c1c();}},'charset':_0xe9b6('0x1f'),'collate':_0xe9b6('0x20')});}; \ No newline at end of file +var _0xd62b=['utf8mb4_unicode_ci','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','update','catch','utf8mb4'];(function(_0x509b29,_0x36f0c2){var _0x17e3a6=function(_0x2f723d){while(--_0x2f723d){_0x509b29['push'](_0x509b29['shift']());}};_0x17e3a6(++_0x36f0c2);}(_0xd62b,0x171));var _0xbd62=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0xd62b[_0x401ccd];return _0x5a57ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd62('0x0'))('api');var moment=require(_0xbd62('0x1'));var BPromise=require(_0xbd62('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd62('0x3'));var config=require(_0xbd62('0x4'));var attributes=require(_0xbd62('0x5'));module[_0xbd62('0x6')]=function(_0x21872d,_0x1ab037){return _0x21872d[_0xbd62('0x7')]('FaxMessage',attributes,{'tableName':_0xbd62('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x461a65,_0xa38ff9,_0x5f13a6){var _0x16757c=_0x21872d[_0xbd62('0x9')];var _0x2f6827=_0x461a65[_0xbd62('0xa')]({'plain':!![]});if(_0x2f6827[_0xbd62('0xb')][_0xbd62('0xc')]()==='in'||_0x2f6827[_0xbd62('0xb')][_0xbd62('0xc')]()===_0xbd62('0xd')&&!_0x2f6827[_0xbd62('0xe')]&&!_['isNil'](_0x2f6827[_0xbd62('0xf')])){_0x16757c[_0xbd62('0x10')][_0xbd62('0x11')]({'where':{'id':_0x2f6827[_0xbd62('0x12')]}})['then'](function(_0x4e13d5){if(_0x4e13d5){_0x4e13d5[_0xbd62('0x13')]({'lastMsgAt':_0x2f6827['createdAt'],'lastMsgDirection':_0x2f6827[_0xbd62('0xb')][_0xbd62('0xc')]()});}})[_0xbd62('0x14')](function(_0x3dba9f){console['error'](_0x3dba9f);});}_0x5f13a6();}},'charset':_0xbd62('0x15'),'collate':_0xbd62('0x16')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index bca7a56..7060f49 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 _0x9bde=['body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','limit','then','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FaxMessage','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x18adc4,_0x220d5d){_0x18adc4=_0x18adc4-0x0;var _0x329193=_0x9bde[_0x18adc4];return _0x329193;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});config[_0xe9bd('0xa')]=_[_0xe9bd('0xb')](config[_0xe9bd('0xa')],{'host':_0xe9bd('0xc'),'port':0x18eb});var socket=require(_0xe9bd('0xd'))(new Redis(config[_0xe9bd('0xa')]));require(_0xe9bd('0xe'))[_0xe9bd('0xf')](socket);function respondWithRpcPromise(_0x45c7ba,_0x581602,_0x5f36c8){return new BPromise(function(_0x3c8e95,_0x145521){return client[_0xe9bd('0x10')](_0x45c7ba,_0x5f36c8)['then'](function(_0x12c96e){logger[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));logger['debug'](_0xe9bd('0x14'),_0x581602,'request\x20sent',JSON[_0xe9bd('0x15')](_0x12c96e));if(_0x12c96e[_0xe9bd('0x16')]){if(_0x12c96e[_0xe9bd('0x16')]['code']===0x1f4){logger['error'](_0xe9bd('0x12'),_0x581602,_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);return _0x145521(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}logger[_0xe9bd('0x16')](_0xe9bd('0x12'),_0x581602,_0x12c96e['error'][_0xe9bd('0x17')]);return _0x3c8e95(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}else{logger['info'](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));_0x3c8e95(_0x12c96e[_0xe9bd('0x18')][_0xe9bd('0x17')]);}})['catch'](function(_0x20ec32){logger['error'](_0xe9bd('0x12'),_0x581602,_0x20ec32);_0x145521(_0x20ec32);});});}exports['CreateFaxMessage']=function(_0x26aa4a){var _0x417113=this;return new Promise(function(_0x134c4e,_0x3dda13){return db[_0xe9bd('0x19')][_0xe9bd('0x1a')](_0x26aa4a[_0xe9bd('0x1b')],{'raw':_0x26aa4a['options']?_0x26aa4a[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x37aec1){logger['info'](_0xe9bd('0x1e'),_0x26aa4a);logger[_0xe9bd('0x1f')](_0xe9bd('0x1e'),_0x26aa4a,JSON[_0xe9bd('0x15')](_0x37aec1));_0x134c4e(_0x37aec1);})['catch'](function(_0x24cf25){logger[_0xe9bd('0x16')](_0xe9bd('0x1e'),_0x24cf25[_0xe9bd('0x17')],_0x26aa4a);_0x3dda13(_0x417113[_0xe9bd('0x16')](0x1f4,_0x24cf25[_0xe9bd('0x17')]));});});};exports[_0xe9bd('0x20')]=function(_0x43ea90){var _0x1ae889=this;return new Promise(function(_0x5987af,_0x3c211a){return db[_0xe9bd('0x19')]['update'](_0x43ea90[_0xe9bd('0x1b')],{'raw':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')]['where']||null:null,'attributes':_0x43ea90['options']?_0x43ea90[_0xe9bd('0x1c')]['attributes']||null:null,'limit':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x21')]||null:null})[_0xe9bd('0x22')](function(_0x4057df){logger['info']('UpdateFaxMessage',_0x43ea90);logger[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x43ea90,JSON[_0xe9bd('0x15')](_0x4057df));_0x5987af(_0x4057df);})[_0xe9bd('0x23')](function(_0xe2436){logger[_0xe9bd('0x16')](_0xe9bd('0x20'),_0xe2436[_0xe9bd('0x17')],_0x43ea90);_0x3c211a(_0x1ae889[_0xe9bd('0x16')](0x1f4,_0xe2436['message']));});});}; \ No newline at end of file +var _0x00bb=['redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxMessage,\x20%s,\x20%s','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','update','attributes','UpdateFaxMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3bcff3,_0x2c1887){var _0x565baf=function(_0x262e62){while(--_0x262e62){_0x3bcff3['push'](_0x3bcff3['shift']());}};_0x565baf(++_0x2c1887);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb00b('0x8')]=_[_0xb00b('0x9')](config[_0xb00b('0x8')],{'host':_0xb00b('0xa'),'port':0x18eb});var socket=require(_0xb00b('0xb'))(new Redis(config[_0xb00b('0x8')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5154d9,_0x1e9b7b,_0x5851d4){return new BPromise(function(_0x46a25c,_0x28d3cc){return client['request'](_0x5154d9,_0x5851d4)[_0xb00b('0xc')](function(_0x5a63ed){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));logger[_0xb00b('0xe')](_0xb00b('0xf'),_0x1e9b7b,_0xb00b('0xd'),JSON[_0xb00b('0x10')](_0x5a63ed));if(_0x5a63ed[_0xb00b('0x11')]){if(_0x5a63ed['error'][_0xb00b('0x12')]===0x1f4){logger[_0xb00b('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);return _0x28d3cc(_0x5a63ed['error']['message']);}logger[_0xb00b('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed['error'][_0xb00b('0x13')]);return _0x46a25c(_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);}else{logger[_0xb00b('0x14')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));_0x46a25c(_0x5a63ed['result'][_0xb00b('0x13')]);}})['catch'](function(_0x25d7a0){logger['error'](_0xb00b('0x15'),_0x1e9b7b,_0x25d7a0);_0x28d3cc(_0x25d7a0);});});}exports[_0xb00b('0x16')]=function(_0x53ee68){var _0x55770c=this;return new Promise(function(_0x2b0da1,_0x4a334b){return db[_0xb00b('0x17')][_0xb00b('0x18')](_0x53ee68[_0xb00b('0x19')],{'raw':_0x53ee68[_0xb00b('0x1a')]?_0x53ee68['options'][_0xb00b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x25a973){logger[_0xb00b('0x14')]('CreateFaxMessage',_0x53ee68);logger[_0xb00b('0xe')](_0xb00b('0x16'),_0x53ee68,JSON['stringify'](_0x25a973));_0x2b0da1(_0x25a973);})[_0xb00b('0x1c')](function(_0x1f04d3){logger['error'](_0xb00b('0x16'),_0x1f04d3[_0xb00b('0x13')],_0x53ee68);_0x4a334b(_0x55770c[_0xb00b('0x11')](0x1f4,_0x1f04d3[_0xb00b('0x13')]));});});};exports['UpdateFaxMessage']=function(_0x50be6c){var _0x3785e9=this;return new Promise(function(_0x490380,_0x550587){return db['FaxMessage'][_0xb00b('0x1d')](_0x50be6c[_0xb00b('0x19')],{'raw':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')][_0xb00b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')]['where']||null:null,'attributes':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c['options'][_0xb00b('0x1e')]||null:null,'limit':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')]['limit']||null:null})[_0xb00b('0xc')](function(_0x280ed3){logger[_0xb00b('0x14')](_0xb00b('0x1f'),_0x50be6c);logger[_0xb00b('0xe')](_0xb00b('0x1f'),_0x50be6c,JSON[_0xb00b('0x10')](_0x280ed3));_0x490380(_0x280ed3);})[_0xb00b('0x1c')](function(_0x149c1a){logger['error'](_0xb00b('0x1f'),_0x149c1a[_0xb00b('0x13')],_0x50be6c);_0x550587(_0x3785e9['error'](0x1f4,_0x149c1a[_0xb00b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index bd0fdcb..9e9b373 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 _0xd4b7=['length','faxMessage:','update','emit','register'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd4b7,0x1ec));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save','remove',_0x7d4b('0x0')];function createListener(_0x57f202,_0x5d9bcb){return function(_0x27d449){_0x5d9bcb[_0x7d4b('0x1')](_0x57f202,_0x27d449);};}function removeListener(_0x2fbcf1,_0x1606e1){return function(){FaxMessageEvents['removeListener'](_0x2fbcf1,_0x1606e1);};}exports[_0x7d4b('0x2')]=function(_0x9d68ee){for(var _0x2d2d86=0x0,_0x1dbc26=events[_0x7d4b('0x3')];_0x2d2d86<_0x1dbc26;_0x2d2d86++){var _0x482d00=events[_0x2d2d86];var _0x4996b9=createListener(_0x7d4b('0x4')+_0x482d00,_0x9d68ee);FaxMessageEvents['on'](_0x482d00,_0x4996b9);}}; \ No newline at end of file +var _0x5125=['length','save','remove','update','emit','removeListener','register'];(function(_0x51c1f8,_0x5cc527){var _0x2ce60b=function(_0xcb8ec2){while(--_0xcb8ec2){_0x51c1f8['push'](_0x51c1f8['shift']());}};_0x2ce60b(++_0x5cc527);}(_0x5125,0x135));var _0x5512=function(_0x2d9da8,_0x5d5072){_0x2d9da8=_0x2d9da8-0x0;var _0x57a29c=_0x5125[_0x2d9da8];return _0x57a29c;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x5512('0x0'),_0x5512('0x1'),_0x5512('0x2')];function createListener(_0x21fd2f,_0xdcae41){return function(_0x87e045){_0xdcae41[_0x5512('0x3')](_0x21fd2f,_0x87e045);};}function removeListener(_0x4a96fa,_0x346041){return function(){FaxMessageEvents[_0x5512('0x4')](_0x4a96fa,_0x346041);};}exports[_0x5512('0x5')]=function(_0x51e23e){for(var _0x48a7c0=0x0,_0x4e9ff5=events[_0x5512('0x6')];_0x48a7c0<_0x4e9ff5;_0x48a7c0++){var _0x506b7c=events[_0x48a7c0];var _0x2fa6e4=createListener('faxMessage:'+_0x506b7c,_0x51e23e);FaxMessageEvents['on'](_0x506b7c,_0x2fa6e4);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e8e5adc..3fd2d04 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 _0xdb94=['express','fs-extra','../../components/auth/service','./faxMessage.controller','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/download','download','post','fax','faxmessage:create','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','connect-timeout'];(function(_0x41cce6,_0x1218e7){var _0x4890aa=function(_0x39f4a0){while(--_0x39f4a0){_0x41cce6['push'](_0x41cce6['shift']());}};_0x4890aa(++_0x1218e7);}(_0xdb94,0xab));var _0x4db9=function(_0x13884d,_0x35c80f){_0x13884d=_0x13884d-0x0;var _0x35c464=_0xdb94[_0x13884d];return _0x35c464;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),interaction['tracked'](_0x4db9('0x12'),_0x4db9('0x13')),controller['create']);router['put'](_0x4db9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4db9('0x14')](_0x4db9('0x15'),auth['isAuthenticated'](),controller[_0x4db9('0x16')]);router[_0x4db9('0x14')](_0x4db9('0x17'),auth[_0x4db9('0xd')](),controller['reject']);router['delete'](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller['destroy']);module[_0x4db9('0x18')]=router; \ No newline at end of file +var _0xaa88=['describe','get','show','download','post','fax','faxmessage:create','put','/:id','/:id/accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','/describe','isAuthenticated'];(function(_0x17323e,_0x3ed331){var _0x577592=function(_0xe72d15){while(--_0xe72d15){_0x17323e['push'](_0x17323e['shift']());}};_0x577592(++_0x3ed331);}(_0xaa88,0x137));var _0x8aa8=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0xaa88[_0x8b631b];return _0x3e6832;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0xe')]('/:id/download',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xc')](),interaction['tracked'](_0x8aa8('0x12'),_0x8aa8('0x13')),controller['create']);router[_0x8aa8('0x14')](_0x8aa8('0x15'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x16'),auth[_0x8aa8('0xc')](),controller['accept']);router[_0x8aa8('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x8aa8('0x17')]);router[_0x8aa8('0x18')](_0x8aa8('0x15'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x19')]);module[_0x8aa8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a1c4586..bc12119 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 _0x1d50=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x2c7933,_0x224c51){var _0x445360=function(_0x576156){while(--_0x576156){_0x2c7933['push'](_0x2c7933['shift']());}};_0x445360(++_0x224c51);}(_0x1d50,0xc0));var _0x01d5=function(_0x48ba95,_0x43557d){_0x48ba95=_0x48ba95-0x0;var _0x581976=_0x1d50[_0x48ba95];return _0x581976;};'use strict';var Sequelize=require(_0x01d5('0x0'));module[_0x01d5('0x1')]={'name':{'type':Sequelize[_0x01d5('0x2')],'unique':_0x01d5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x01d5('0x2')]},'timeout':{'type':Sequelize[_0x01d5('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x01d5('0x5')](_0x01d5('0x6'),_0x01d5('0x7'),_0x01d5('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x01d5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x22b9=['INTEGER','beepall','sequelize','exports','STRING','name'];(function(_0x194bd8,_0x47a1b6){var _0x4ab5e6=function(_0x144b83){while(--_0x144b83){_0x194bd8['push'](_0x194bd8['shift']());}};_0x4ab5e6(++_0x47a1b6);}(_0x22b9,0x8c));var _0x922b=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x22b9[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0x922b('0x0'));module[_0x922b('0x1')]={'name':{'type':Sequelize[_0x922b('0x2')],'unique':_0x922b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x922b('0x2')]},'timeout':{'type':Sequelize[_0x922b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x922b('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x922b('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 51f4106..9ec5a63 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 _0xa5c1=['sort','pick','filter','UserFaxQueue','User','findAndCountAll','UserId','agent','updatedAt','SIP','faxPause','createdAt','getTeams','hasOwnProperty','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userFaxQueue:save','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','toString','SELECT','every','includes','all','union','compact','value','transaction','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','removeAgents','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','count','limit','set','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','order'];(function(_0x35ce9e,_0x13cbd4){var _0x3da197=function(_0x536278){while(--_0x536278){_0x35ce9e['push'](_0x35ce9e['shift']());}};_0x3da197(++_0x13cbd4);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x51f6aa,_0x5bfd0c){_0x51f6aa=_0x51f6aa-0x0;var _0x11b1d7=_0xa5c1[_0x51f6aa];return _0x11b1d7;};'use strict';var BPromise=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var _=require(_0x1a5c('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x1a5c('0x3'));var logger=require('../../config/logger')(_0x1a5c('0x4'));var config=require(_0x1a5c('0x5'));var db=require(_0x1a5c('0x6'))['db'];config[_0x1a5c('0x7')]=_[_0x1a5c('0x8')](config[_0x1a5c('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a5c('0x9'))(new Redis(config['redis']));require(_0x1a5c('0xa'))[_0x1a5c('0xb')](socket);function respondWithStatusCode(_0x1702ce,_0x5666c3){_0x5666c3=_0x5666c3||0xcc;return function(_0x39fe5c){if(_0x39fe5c){return _0x1702ce['sendStatus'](_0x5666c3);}return _0x1702ce[_0x1a5c('0xc')](_0x5666c3)[_0x1a5c('0xd')]();};}function respondWithResult(_0x5097cf,_0x1323be){_0x1323be=_0x1323be||0xc8;return function(_0x1ac373){if(_0x1ac373){return _0x5097cf['status'](_0x1323be)[_0x1a5c('0xe')](_0x1ac373);}};}function respondWithFilteredResult(_0x3f7368,_0x591c3d){return function(_0x3f14af){if(_0x3f14af){var _0x3e344e=typeof _0x591c3d[_0x1a5c('0xf')]===_0x1a5c('0x10')&&typeof _0x591c3d['limit']===_0x1a5c('0x10');var _0x3ff425=_0x3f14af['count'];var _0x157ebb=_0x3e344e?0x0:_0x591c3d[_0x1a5c('0xf')];var _0x5cfdb9=_0x3e344e?_0x3f14af[_0x1a5c('0x11')]:_0x591c3d[_0x1a5c('0xf')]+_0x591c3d[_0x1a5c('0x12')];var _0x170112;if(_0x5cfdb9>=_0x3ff425){_0x5cfdb9=_0x3ff425;_0x170112=0xc8;}else{_0x170112=0xce;}_0x3f7368['status'](_0x170112);return _0x3f7368[_0x1a5c('0x13')]('Content-Range',_0x157ebb+'-'+_0x5cfdb9+'/'+_0x3ff425)[_0x1a5c('0xe')](_0x3f14af);}return null;};}function saveUpdates(_0x44648a){return function(_0x57cb61){if(_0x57cb61){return _0x57cb61['update'](_0x44648a)['then'](function(_0x32e177){return _0x32e177;});}return null;};}function removeEntity(_0x2e6a6f){return function(_0x18551c){if(_0x18551c){return _0x18551c[_0x1a5c('0x14')]()[_0x1a5c('0x15')](function(){var _0x57edcd=_0x18551c[_0x1a5c('0x16')]({'plain':!![]});var _0x505162=_0x1a5c('0x17');return db[_0x1a5c('0x18')][_0x1a5c('0x14')]({'where':{'type':_0x505162,'resourceId':_0x57edcd['id']}})['then'](function(){return _0x18551c;});})[_0x1a5c('0x15')](function(){_0x2e6a6f[_0x1a5c('0xc')](0xcc)[_0x1a5c('0xd')]();});}};}function handleEntityNotFound(_0x3502cb){return function(_0x144abf){if(!_0x144abf){_0x3502cb['sendStatus'](0x194);}return _0x144abf;};}function handleError(_0x11964c,_0xbd916e){_0xbd916e=_0xbd916e||0x1f4;return function(_0x8e81fa){logger[_0x1a5c('0x19')](_0x8e81fa[_0x1a5c('0x1a')]);if(_0x8e81fa[_0x1a5c('0x1b')]){delete _0x8e81fa[_0x1a5c('0x1b')];}_0x11964c[_0x1a5c('0xc')](_0xbd916e)[_0x1a5c('0x1c')](_0x8e81fa);};}exports[_0x1a5c('0x1d')]=function(_0x38244c,_0x323272){var _0x4c6520={};var _0x15e334={'count':0x0,'rows':[]};var _0x501397=_[_0x1a5c('0x1e')](db['FaxQueue'][_0x1a5c('0x1f')],function(_0x4323f8){return{'name':_0x4323f8[_0x1a5c('0x20')],'type':_0x4323f8[_0x1a5c('0x21')][_0x1a5c('0x22')]};});_0x4c6520=qs[_0x1a5c('0x23')](_0x501397,_0x38244c);var _0x157376={'where':_0x4c6520[_0x1a5c('0x24')]};return db[_0x1a5c('0x25')][_0x1a5c('0x11')](_0x157376)[_0x1a5c('0x15')](function(_0x4e2fe3){_0x15e334[_0x1a5c('0x11')]=_0x4e2fe3;_0x4c6520[_0x1a5c('0x26')]=qs[_0x1a5c('0x26')](_0x38244c[_0x1a5c('0x27')]);return db[_0x1a5c('0x25')][_0x1a5c('0x28')](_0x4c6520);})[_0x1a5c('0x15')](function(_0x1a2bec){_0x15e334[_0x1a5c('0x29')]=_0x1a2bec;return _0x15e334;})['then'](respondWithFilteredResult(_0x323272,_0x4c6520))[_0x1a5c('0x2a')](handleError(_0x323272,null));};exports[_0x1a5c('0x2b')]=function(_0x257013,_0x131215){var _0x5cce0c={'raw':!![],'where':{'id':_0x257013[_0x1a5c('0x2c')]['id']}},_0x10532b={};_0x10532b[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db[_0x1a5c('0x25')][_0x1a5c('0x1f')]);_0x10532b[_0x1a5c('0x27')]=_['keys'](_0x257013[_0x1a5c('0x27')]);_0x10532b[_0x1a5c('0x2f')]=_['intersection'](_0x10532b[_0x1a5c('0x2d')],_0x10532b[_0x1a5c('0x27')]);_0x5cce0c[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x10532b['model'],qs[_0x1a5c('0x32')](_0x257013[_0x1a5c('0x27')]['fields']));_0x5cce0c[_0x1a5c('0x30')]=_0x5cce0c[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x5cce0c[_0x1a5c('0x30')]:_0x10532b[_0x1a5c('0x2d')];if(_0x257013[_0x1a5c('0x27')][_0x1a5c('0x34')]){_0x5cce0c[_0x1a5c('0x26')]=[{'all':!![]}];}_0x5cce0c=_[_0x1a5c('0x35')]({},_0x5cce0c,_0x257013[_0x1a5c('0x36')]);return db['FaxQueue'][_0x1a5c('0x37')](_0x5cce0c)[_0x1a5c('0x15')](handleEntityNotFound(_0x131215,null))['then'](respondWithResult(_0x131215,null))[_0x1a5c('0x2a')](handleError(_0x131215,null));};exports[_0x1a5c('0x38')]=function(_0x4ba8cf,_0x4abca8){return db[_0x1a5c('0x25')][_0x1a5c('0x38')](_0x4ba8cf[_0x1a5c('0x39')],{})[_0x1a5c('0x15')](function(_0x562ff5){var _0x52ff6c=_0x4ba8cf[_0x1a5c('0x3a')][_0x1a5c('0x16')]({'plain':!![]});if(!_0x52ff6c)throw new Error(_0x1a5c('0x3b'));if(_0x52ff6c['role']===_0x1a5c('0x3a')){var _0x32fc23=_0x562ff5[_0x1a5c('0x16')]({'plain':!![]});var _0x216ba0=_0x1a5c('0x17');return db[_0x1a5c('0x3c')][_0x1a5c('0x37')]({'where':{'name':_0x216ba0,'userProfileId':_0x52ff6c[_0x1a5c('0x3d')]},'raw':!![]})['then'](function(_0x4cb0e8){if(_0x4cb0e8&&_0x4cb0e8['autoAssociation']===0x0){return db[_0x1a5c('0x18')]['create']({'name':_0x32fc23[_0x1a5c('0x1b')],'resourceId':_0x32fc23['id'],'type':_0x4cb0e8[_0x1a5c('0x1b')],'sectionId':_0x4cb0e8['id']},{})[_0x1a5c('0x15')](function(){return _0x562ff5;});}else{return _0x562ff5;}})[_0x1a5c('0x2a')](function(_0x1072d5){logger[_0x1a5c('0x19')](_0x1a5c('0x3e'),_0x1072d5);throw _0x1072d5;});}return _0x562ff5;})['then'](respondWithResult(_0x4abca8,0xc9))[_0x1a5c('0x2a')](handleError(_0x4abca8,null));};exports[_0x1a5c('0x3f')]=function(_0x2fef3e,_0x5e9d4c){if(_0x2fef3e[_0x1a5c('0x39')]['id']){delete _0x2fef3e[_0x1a5c('0x39')]['id'];}return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x2fef3e[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x5e9d4c,null))['then'](saveUpdates(_0x2fef3e[_0x1a5c('0x39')],null))[_0x1a5c('0x15')](respondWithResult(_0x5e9d4c,null))['catch'](handleError(_0x5e9d4c,null));};exports['destroy']=function(_0x56dceb,_0x3de0fa){return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x56dceb[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x3de0fa,null))[_0x1a5c('0x15')](removeEntity(_0x3de0fa,null))[_0x1a5c('0x2a')](handleError(_0x3de0fa,null));};exports[_0x1a5c('0x40')]=function(_0x33f03a,_0x120bdd){return db[_0x1a5c('0x25')][_0x1a5c('0x40')]()[_0x1a5c('0x15')](respondWithResult(_0x120bdd,null))['catch'](handleError(_0x120bdd,null));};exports[_0x1a5c('0x41')]=function(_0x20bad9,_0x3e03f5){var _0x11f4c2={'raw':!![],'where':{}},_0x3244c5={},_0x46d8bb;return db[_0x1a5c('0x25')][_0x1a5c('0x42')]({'where':{'id':_0x20bad9[_0x1a5c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3e03f5,null))['then'](function(_0x511c19){if(_0x511c19){_0x46d8bb=_0x511c19[_0x1a5c('0x16')]({'plain':!![]});_0x3244c5[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db['UserFaxQueue'][_0x1a5c('0x1f')]);_0x3244c5[_0x1a5c('0x27')]=_[_0x1a5c('0x2e')](_0x20bad9[_0x1a5c('0x27')]);_0x3244c5[_0x1a5c('0x2f')]=_['intersection'](_0x3244c5[_0x1a5c('0x2d')],_0x3244c5['query']);_0x11f4c2[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x3244c5[_0x1a5c('0x2d')],qs[_0x1a5c('0x32')](_0x20bad9['query'][_0x1a5c('0x32')]));_0x11f4c2[_0x1a5c('0x30')]=_0x11f4c2[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x11f4c2[_0x1a5c('0x30')]:_0x3244c5[_0x1a5c('0x2d')];if(!_0x20bad9[_0x1a5c('0x27')]['hasOwnProperty'](_0x1a5c('0x43'))){_0x11f4c2[_0x1a5c('0x12')]=qs['limit'](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x12')]);_0x11f4c2[_0x1a5c('0xf')]=qs[_0x1a5c('0xf')](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0xf')]);}_0x11f4c2[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x11f4c2[_0x1a5c('0x24')]=qs[_0x1a5c('0x2f')](_[_0x1a5c('0x46')](_0x20bad9[_0x1a5c('0x27')],_0x3244c5[_0x1a5c('0x2f')]));_0x11f4c2[_0x1a5c('0x24')]['FaxQueueId']=_0x511c19['id'];if(_0x20bad9[_0x1a5c('0x27')]['filter']){_0x11f4c2[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x11f4c2[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x11f4c2[_0x1a5c('0x30')],function(_0xc19a6f){var _0x290e41={};_0x290e41[_0xc19a6f]={'$like':'%'+_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x290e41;})});}_0x11f4c2=_[_0x1a5c('0x35')]({},_0x11f4c2,_0x20bad9['options']);return db[_0x1a5c('0x48')][_0x1a5c('0x28')](_0x11f4c2);}})[_0x1a5c('0x15')](function(_0x3c0268){if(_0x3c0268){return db[_0x1a5c('0x49')][_0x1a5c('0x4a')]({'where':{'id':_[_0x1a5c('0x1e')](_0x3c0268,_0x1a5c('0x4b')),'role':_0x1a5c('0x4c')},'attributes':['id',_0x1a5c('0x1b'),'faxPause',_0x1a5c('0x4d'),'createdAt']});}})['then'](function(_0x4bcbb7){if(_0x4bcbb7){return{'count':_0x4bcbb7[_0x1a5c('0x11')],'rows':_[_0x1a5c('0x1e')](_0x4bcbb7[_0x1a5c('0x29')],function(_0x50a2e5){return{'membername':_0x50a2e5[_0x1a5c('0x1b')],'UserId':_0x50a2e5['id'],'queue_name':_0x46d8bb[_0x1a5c('0x1b')],'FaxQueueId':_0x46d8bb['id'],'interface':util['format']('%s/%s',_0x1a5c('0x4e'),_0x50a2e5[_0x1a5c('0x1b')]),'penalty':0x0,'paused':_0x50a2e5[_0x1a5c('0x4f')],'createdAt':_0x50a2e5[_0x1a5c('0x50')],'updatedAt':_0x50a2e5[_0x1a5c('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1a5c('0x15')](respondWithFilteredResult(_0x3e03f5,_0x11f4c2))['catch'](handleError(_0x3e03f5,null));};exports['getTeams']=function(_0x288821,_0x4cc324){var _0x190d24={};var _0x2d71f7={};var _0x50ae82;var _0x2c00b4;return db['FaxQueue'][_0x1a5c('0x42')]({'where':{'id':_0x288821[_0x1a5c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4cc324,null))[_0x1a5c('0x15')](function(_0x17c53b){if(_0x17c53b){_0x50ae82=_0x17c53b;_0x2d71f7[_0x1a5c('0x2d')]=_['keys'](db['Team']['rawAttributes']);_0x2d71f7[_0x1a5c('0x27')]=_[_0x1a5c('0x2e')](_0x288821['query']);_0x2d71f7[_0x1a5c('0x2f')]=_['intersection'](_0x2d71f7['model'],_0x2d71f7['query']);_0x190d24['attributes']=_[_0x1a5c('0x31')](_0x2d71f7[_0x1a5c('0x2d')],qs[_0x1a5c('0x32')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x32')]));_0x190d24[_0x1a5c('0x30')]=_0x190d24[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x190d24['attributes']:_0x2d71f7[_0x1a5c('0x2d')];_0x190d24[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x190d24['where']=qs[_0x1a5c('0x2f')](_['pick'](_0x288821['query'],_0x2d71f7[_0x1a5c('0x2f')]));if(_0x288821[_0x1a5c('0x27')][_0x1a5c('0x47')]){_0x190d24[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x190d24[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x190d24[_0x1a5c('0x30')],function(_0x16235f){var _0x39c226={};_0x39c226[_0x16235f]={'$like':'%'+_0x288821[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x39c226;})});}_0x190d24=_[_0x1a5c('0x35')]({},_0x190d24,_0x288821['options']);return _0x50ae82[_0x1a5c('0x51')](_0x190d24);}})[_0x1a5c('0x15')](function(_0x29bd89){if(_0x29bd89){_0x2c00b4=_0x29bd89[_0x1a5c('0x33')];if(!_0x288821['query'][_0x1a5c('0x52')](_0x1a5c('0x43'))){_0x190d24[_0x1a5c('0x12')]=qs[_0x1a5c('0x12')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x12')]);_0x190d24[_0x1a5c('0xf')]=qs['offset'](_0x288821[_0x1a5c('0x27')][_0x1a5c('0xf')]);}return _0x50ae82['getTeams'](_0x190d24);}})[_0x1a5c('0x15')](function(_0x3694a7){if(_0x3694a7){return _0x3694a7?{'count':_0x2c00b4,'rows':_0x3694a7}:null;}})['then'](respondWithResult(_0x4cc324,null))[_0x1a5c('0x2a')](handleError(_0x4cc324,null));};exports[_0x1a5c('0x53')]=function(_0x51483c,_0x2c8caa){var _0x5a1e2d=_0x51483c[_0x1a5c('0x39')]['ids'];return db[_0x1a5c('0x54')][_0x1a5c('0x28')]({'where':{'id':_0x5a1e2d},'attributes':['id'],'include':[{'model':db[_0x1a5c('0x49')],'as':_0x1a5c('0x55'),'attributes':['id',_0x1a5c('0x1b'),_0x1a5c('0x56'),_0x1a5c('0x57'),_0x1a5c('0x58')],'raw':!![]}]})[_0x1a5c('0x15')](function(_0x5db4e1){if(_0x5db4e1){var _0x3ba5be=_[_0x1a5c('0x59')](_0x5db4e1,function(_0x3531f7){var _0x110a81=_0x3531f7[_0x1a5c('0x16')]({'plain':!![]});return _0x110a81[_0x1a5c('0x55')];});return db[_0x1a5c('0x25')][_0x1a5c('0x37')]({'where':{'id':_0x51483c[_0x1a5c('0x2c')]['id']}})['then'](function(_0x49304d){return db[_0x1a5c('0x5a')]['transaction'](function(_0x2bb9b3){return _0x49304d[_0x1a5c('0x53')](_0x5a1e2d,{'transaction':_0x2bb9b3})[_0x1a5c('0x15')](function(){return BPromise[_0x1a5c('0x5b')](_0x3ba5be,function(_0x558e21){return db[_0x1a5c('0x48')][_0x1a5c('0x5c')]({'where':{'UserId':_0x558e21['id'],'FaxQueueId':_0x51483c[_0x1a5c('0x2c')]['id']},'transaction':_0x2bb9b3});});})[_0x1a5c('0x15')](function(){_0x3ba5be[_0x1a5c('0x5d')](function(_0x55a65a){socket['emit'](_0x1a5c('0x5e'),{'UserId':_0x55a65a['id'],'FaxQueueId':_0x49304d['id']});});});});});}})[_0x1a5c('0x15')](respondWithStatusCode(_0x2c8caa,null))[_0x1a5c('0x2a')](handleError(_0x2c8caa,null));};exports['removeTeams']=function(_0x15d2ab,_0x4da8cd){return db[_0x1a5c('0x54')][_0x1a5c('0x28')]({'where':{'id':_0x15d2ab[_0x1a5c('0x27')][_0x1a5c('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x1a5c('0x49')],'as':_0x1a5c('0x55'),'attributes':['id'],'raw':!![]}]})[_0x1a5c('0x15')](handleEntityNotFound(_0x4da8cd,null))[_0x1a5c('0x15')](function(_0x43bd88){var _0x490c84=_[_0x1a5c('0x1e')](_0x43bd88,'id');var _0x10438b=[];var _0x12aa40=[];var _0x16dd12=squel[_0x1a5c('0x60')]();_0x16dd12['field'](_0x1a5c('0x61'))[_0x1a5c('0x62')]('team_has_fax_queues','tq')[_0x1a5c('0x63')](_0x1a5c('0x64'),'ut',_0x1a5c('0x65'))[_0x1a5c('0x24')](_0x1a5c('0x66'),_0x15d2ab['params']['id']);for(var _0x3e56e8=0x0;_0x3e56e8<_0x43bd88[_0x1a5c('0x33')];_0x3e56e8+=0x1){let _0x3802e3=_0x43bd88[_0x3e56e8];for(var _0x29d4ec=0x0;_0x29d4ec<_0x3802e3[_0x1a5c('0x55')][_0x1a5c('0x33')];_0x29d4ec+=0x1){let _0x1caa4b=_0x3802e3[_0x1a5c('0x55')][_0x29d4ec];var _0xeaa5e8=_0x16dd12[_0x1a5c('0x67')]();_0xeaa5e8[_0x1a5c('0x24')]('ut.UserId\x20=\x20?',_0x1caa4b['id']);_0x12aa40['push'](db[_0x1a5c('0x5a')][_0x1a5c('0x27')](_0xeaa5e8[_0x1a5c('0x68')](),{'type':db[_0x1a5c('0x5a')]['QueryTypes'][_0x1a5c('0x69')]})[_0x1a5c('0x15')](function(_0x182b5b){if(_0x182b5b[_0x1a5c('0x33')]===0x1){return _0x1caa4b['id'];}else{var _0x3447a9=_[_0x1a5c('0x6a')](_['map'](_0x182b5b,'TeamId'),function(_0x108276){return _[_0x1a5c('0x6b')](_0x490c84,_0x108276);});if(_0x3447a9){return _0x1caa4b['id'];}}}));}}return BPromise[_0x1a5c('0x6c')](_0x12aa40)[_0x1a5c('0x15')](function(_0x25fc67){_0x10438b=_(_0x10438b)[_0x1a5c('0x6d')](_0x25fc67)[_0x1a5c('0x6e')]()[_0x1a5c('0x6f')]();return db['FaxQueue'][_0x1a5c('0x37')]({'where':{'id':_0x15d2ab[_0x1a5c('0x2c')]['id']}})['then'](function(_0x3d4d37){return db[_0x1a5c('0x5a')][_0x1a5c('0x70')](function(_0x359d08){return _0x3d4d37[_0x1a5c('0x71')](_0x15d2ab['query']['ids'],{'transaction':_0x359d08})[_0x1a5c('0x15')](function(){if(!_[_0x1a5c('0x72')](_0x10438b)){return _0x3d4d37['removeAgents'](_0x10438b,{'transaction':_0x359d08});}})[_0x1a5c('0x15')](function(){_0x10438b[_0x1a5c('0x5d')](function(_0x467c1c){socket[_0x1a5c('0x73')](_0x1a5c('0x74'),{'UserId':_0x467c1c,'FaxQueueId':_0x3d4d37['id']});});});});});});})['then'](respondWithStatusCode(_0x4da8cd,null))[_0x1a5c('0x2a')](handleError(_0x4da8cd,null));};exports[_0x1a5c('0x75')]=function(_0x21cbe2,_0x166cd9){return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x21cbe2[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x166cd9,null))[_0x1a5c('0x15')](function(_0x54c34b){if(_0x54c34b){return _0x54c34b[_0x1a5c('0x75')](_0x21cbe2[_0x1a5c('0x39')][_0x1a5c('0x5f')],_['omit'](_0x21cbe2[_0x1a5c('0x39')],[_0x1a5c('0x5f'),'id'])||{})['spread'](function(_0x39c7f0){for(var _0x5bc8d0=0x0;_0x5bc8d0<_0x21cbe2[_0x1a5c('0x39')]['ids'][_0x1a5c('0x33')];_0x5bc8d0+=0x1){socket['emit'](_0x1a5c('0x5e'),{'UserId':Number(_0x21cbe2[_0x1a5c('0x39')]['ids'][_0x5bc8d0]),'FaxQueueId':Number(_0x21cbe2[_0x1a5c('0x2c')]['id'])});}return _0x39c7f0;});}})[_0x1a5c('0x15')](respondWithResult(_0x166cd9,null))[_0x1a5c('0x2a')](handleError(_0x166cd9,null));};exports[_0x1a5c('0x76')]=function(_0x3e3223,_0x104f24){return db[_0x1a5c('0x25')][_0x1a5c('0x37')]({'where':{'id':_0x3e3223['params']['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x104f24,null))['then'](function(_0x3b4a80){if(_0x3b4a80){return _0x3b4a80[_0x1a5c('0x76')](_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')])[_0x1a5c('0x15')](function(){if(_[_0x1a5c('0x77')](_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')])){for(var _0x26049a=0x0;_0x26049a<_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')]['length'];_0x26049a+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3e3223['query'][_0x1a5c('0x5f')][_0x26049a]),'FaxQueueId':Number(_0x3e3223[_0x1a5c('0x2c')]['id'])});}}else{socket[_0x1a5c('0x73')](_0x1a5c('0x74'),{'UserId':Number(_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')]),'FaxQueueId':Number(_0x3e3223[_0x1a5c('0x2c')]['id'])});}});}})[_0x1a5c('0x15')](respondWithStatusCode(_0x104f24,null))[_0x1a5c('0x2a')](handleError(_0x104f24,null));};exports[_0x1a5c('0x78')]=function(_0x1aa9a4,_0x1e1716){var _0x2ead60={};var _0x15e72e={};var _0xbf5b38;var _0x347b04;return db[_0x1a5c('0x25')][_0x1a5c('0x42')]({'where':{'id':_0x1aa9a4['params']['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x1e1716,null))[_0x1a5c('0x15')](function(_0x45260b){if(_0x45260b){_0xbf5b38=_0x45260b;_0x15e72e[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db['User'][_0x1a5c('0x1f')]);_0x15e72e['query']=_[_0x1a5c('0x2e')](_0x1aa9a4[_0x1a5c('0x27')]);_0x15e72e[_0x1a5c('0x2f')]=_[_0x1a5c('0x31')](_0x15e72e['model'],_0x15e72e[_0x1a5c('0x27')]);_0x2ead60[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x15e72e['model'],qs[_0x1a5c('0x32')](_0x1aa9a4['query'][_0x1a5c('0x32')]));_0x2ead60['attributes']=_0x2ead60[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x2ead60[_0x1a5c('0x30')]:_0x15e72e['model'];_0x2ead60[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x2ead60[_0x1a5c('0x24')]=qs[_0x1a5c('0x2f')](_[_0x1a5c('0x46')](_0x1aa9a4[_0x1a5c('0x27')],_0x15e72e[_0x1a5c('0x2f')]));if(_0x1aa9a4['query']['filter']){_0x2ead60[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x2ead60[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x2ead60[_0x1a5c('0x30')],function(_0x53d920){var _0x2f34fc={};_0x2f34fc[_0x53d920]={'$like':'%'+_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x2f34fc;})});}_0x2ead60=_['merge']({},_0x2ead60,_0x1aa9a4[_0x1a5c('0x36')]);return _0xbf5b38[_0x1a5c('0x78')](_0x2ead60);}})[_0x1a5c('0x15')](function(_0x565608){if(_0x565608){_0x347b04=_0x565608['length'];if(!_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x52')](_0x1a5c('0x43'))){_0x2ead60[_0x1a5c('0x12')]=qs[_0x1a5c('0x12')](_0x1aa9a4['query']['limit']);_0x2ead60[_0x1a5c('0xf')]=qs['offset'](_0x1aa9a4['query'][_0x1a5c('0xf')]);}return _0xbf5b38[_0x1a5c('0x78')](_0x2ead60);}})[_0x1a5c('0x15')](function(_0x18dfb8){if(_0x18dfb8){return _0x18dfb8?{'count':_0x347b04,'rows':_0x18dfb8}:null;}})[_0x1a5c('0x15')](respondWithResult(_0x1e1716,null))[_0x1a5c('0x2a')](handleError(_0x1e1716,null));}; \ No newline at end of file +var _0xb4c7=['removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','model','keys','filters','intersection','fields','attributes','length','merge','options','catch','create','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','hasOwnProperty','sort','filter','User','findAndCountAll','UserId','agent','faxPause','createdAt','SIP','updatedAt','getTeams','Team','order','pick','nolimit','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserFaxQueue','forEach','emit','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','isEmpty'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x23e87d,_0x270cfe){_0x23e87d=_0x23e87d-0x0;var _0x4966ea=_0xb4c7[_0x23e87d];return _0x4966ea;};'use strict';var BPromise=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));var squel=require(_0x7b4c('0x3'));var Redis=require(_0x7b4c('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x7b4c('0x5'))(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var db=require(_0x7b4c('0x8'))['db'];config[_0x7b4c('0x9')]=_['defaults'](config[_0x7b4c('0x9')],{'host':_0x7b4c('0xa'),'port':0x18eb});var socket=require(_0x7b4c('0xb'))(new Redis(config['redis']));require(_0x7b4c('0xc'))[_0x7b4c('0xd')](socket);function respondWithStatusCode(_0x570daa,_0x433aa2){_0x433aa2=_0x433aa2||0xcc;return function(_0x179b2d){if(_0x179b2d){return _0x570daa[_0x7b4c('0xe')](_0x433aa2);}return _0x570daa[_0x7b4c('0xf')](_0x433aa2)[_0x7b4c('0x10')]();};}function respondWithResult(_0x93d013,_0x1a996f){_0x1a996f=_0x1a996f||0xc8;return function(_0xc62104){if(_0xc62104){return _0x93d013[_0x7b4c('0xf')](_0x1a996f)[_0x7b4c('0x11')](_0xc62104);}};}function respondWithFilteredResult(_0x5d5bc3,_0x554d62){return function(_0x24dd7d){if(_0x24dd7d){var _0x18342b=typeof _0x554d62[_0x7b4c('0x12')]===_0x7b4c('0x13')&&typeof _0x554d62[_0x7b4c('0x14')]===_0x7b4c('0x13');var _0x3ea0da=_0x24dd7d[_0x7b4c('0x15')];var _0x25b90b=_0x18342b?0x0:_0x554d62[_0x7b4c('0x12')];var _0x593a19=_0x18342b?_0x24dd7d[_0x7b4c('0x15')]:_0x554d62[_0x7b4c('0x12')]+_0x554d62[_0x7b4c('0x14')];var _0x2a0e2f;if(_0x593a19>=_0x3ea0da){_0x593a19=_0x3ea0da;_0x2a0e2f=0xc8;}else{_0x2a0e2f=0xce;}_0x5d5bc3[_0x7b4c('0xf')](_0x2a0e2f);return _0x5d5bc3[_0x7b4c('0x16')](_0x7b4c('0x17'),_0x25b90b+'-'+_0x593a19+'/'+_0x3ea0da)[_0x7b4c('0x11')](_0x24dd7d);}return null;};}function saveUpdates(_0x4d3f5e){return function(_0x36e701){if(_0x36e701){return _0x36e701[_0x7b4c('0x18')](_0x4d3f5e)[_0x7b4c('0x19')](function(_0x36c02a){return _0x36c02a;});}return null;};}function removeEntity(_0x59ae96){return function(_0x3ce10c){if(_0x3ce10c){return _0x3ce10c[_0x7b4c('0x1a')]()[_0x7b4c('0x19')](function(){var _0x380b79=_0x3ce10c[_0x7b4c('0x1b')]({'plain':!![]});var _0x1363b4=_0x7b4c('0x1c');return db[_0x7b4c('0x1d')][_0x7b4c('0x1a')]({'where':{'type':_0x1363b4,'resourceId':_0x380b79['id']}})['then'](function(){return _0x3ce10c;});})[_0x7b4c('0x19')](function(){_0x59ae96[_0x7b4c('0xf')](0xcc)[_0x7b4c('0x10')]();});}};}function handleEntityNotFound(_0xabeffb){return function(_0x148a79){if(!_0x148a79){_0xabeffb[_0x7b4c('0xe')](0x194);}return _0x148a79;};}function handleError(_0x176704,_0x3d4826){_0x3d4826=_0x3d4826||0x1f4;return function(_0x2ab9e1){logger[_0x7b4c('0x1e')](_0x2ab9e1['stack']);if(_0x2ab9e1[_0x7b4c('0x1f')]){delete _0x2ab9e1[_0x7b4c('0x1f')];}_0x176704[_0x7b4c('0xf')](_0x3d4826)[_0x7b4c('0x20')](_0x2ab9e1);};}exports[_0x7b4c('0x21')]=function(_0x2bdc4d,_0x37c059){var _0x459eb4={};var _0x1f311e={'count':0x0,'rows':[]};var _0x1a69db=_[_0x7b4c('0x22')](db[_0x7b4c('0x23')][_0x7b4c('0x24')],function(_0x501f75){return{'name':_0x501f75[_0x7b4c('0x25')],'type':_0x501f75[_0x7b4c('0x26')][_0x7b4c('0x27')]};});_0x459eb4=qs[_0x7b4c('0x28')](_0x1a69db,_0x2bdc4d);var _0x207c2f={'where':_0x459eb4[_0x7b4c('0x29')]};return db[_0x7b4c('0x23')][_0x7b4c('0x15')](_0x207c2f)[_0x7b4c('0x19')](function(_0x9a799b){_0x1f311e[_0x7b4c('0x15')]=_0x9a799b;_0x459eb4[_0x7b4c('0x2a')]=qs[_0x7b4c('0x2a')](_0x2bdc4d[_0x7b4c('0x2b')]);return db[_0x7b4c('0x23')][_0x7b4c('0x2c')](_0x459eb4);})[_0x7b4c('0x19')](function(_0xce5781){_0x1f311e[_0x7b4c('0x2d')]=_0xce5781;return _0x1f311e;})['then'](respondWithFilteredResult(_0x37c059,_0x459eb4))['catch'](handleError(_0x37c059,null));};exports['show']=function(_0x2fe0f4,_0x2efff3){var _0x14fb7f={'raw':!![],'where':{'id':_0x2fe0f4['params']['id']}},_0x66e770={};_0x66e770[_0x7b4c('0x2e')]=_[_0x7b4c('0x2f')](db['FaxQueue'][_0x7b4c('0x24')]);_0x66e770['query']=_[_0x7b4c('0x2f')](_0x2fe0f4[_0x7b4c('0x2b')]);_0x66e770[_0x7b4c('0x30')]=_['intersection'](_0x66e770[_0x7b4c('0x2e')],_0x66e770[_0x7b4c('0x2b')]);_0x14fb7f['attributes']=_[_0x7b4c('0x31')](_0x66e770[_0x7b4c('0x2e')],qs[_0x7b4c('0x32')](_0x2fe0f4[_0x7b4c('0x2b')]['fields']));_0x14fb7f['attributes']=_0x14fb7f[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x14fb7f['attributes']:_0x66e770[_0x7b4c('0x2e')];if(_0x2fe0f4['query']['includeAll']){_0x14fb7f[_0x7b4c('0x2a')]=[{'all':!![]}];}_0x14fb7f=_[_0x7b4c('0x35')]({},_0x14fb7f,_0x2fe0f4[_0x7b4c('0x36')]);return db[_0x7b4c('0x23')]['find'](_0x14fb7f)[_0x7b4c('0x19')](handleEntityNotFound(_0x2efff3,null))[_0x7b4c('0x19')](respondWithResult(_0x2efff3,null))[_0x7b4c('0x37')](handleError(_0x2efff3,null));};exports[_0x7b4c('0x38')]=function(_0x346e0c,_0xddd16){return db[_0x7b4c('0x23')]['create'](_0x346e0c['body'],{})[_0x7b4c('0x19')](function(_0x37f136){var _0x31ef1e=_0x346e0c[_0x7b4c('0x39')][_0x7b4c('0x1b')]({'plain':!![]});if(!_0x31ef1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31ef1e[_0x7b4c('0x3a')]===_0x7b4c('0x39')){var _0x46b9ae=_0x37f136[_0x7b4c('0x1b')]({'plain':!![]});var _0x22f71b=_0x7b4c('0x1c');return db[_0x7b4c('0x3b')][_0x7b4c('0x3c')]({'where':{'name':_0x22f71b,'userProfileId':_0x31ef1e[_0x7b4c('0x3d')]},'raw':!![]})['then'](function(_0x2a4085){if(_0x2a4085&&_0x2a4085['autoAssociation']===0x0){return db[_0x7b4c('0x1d')]['create']({'name':_0x46b9ae[_0x7b4c('0x1f')],'resourceId':_0x46b9ae['id'],'type':_0x2a4085[_0x7b4c('0x1f')],'sectionId':_0x2a4085['id']},{})['then'](function(){return _0x37f136;});}else{return _0x37f136;}})['catch'](function(_0x354578){logger[_0x7b4c('0x1e')](_0x7b4c('0x3e'),_0x354578);throw _0x354578;});}return _0x37f136;})[_0x7b4c('0x19')](respondWithResult(_0xddd16,0xc9))['catch'](handleError(_0xddd16,null));};exports[_0x7b4c('0x18')]=function(_0x2ed731,_0x100774){if(_0x2ed731['body']['id']){delete _0x2ed731[_0x7b4c('0x3f')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x2ed731[_0x7b4c('0x40')]['id']}})['then'](handleEntityNotFound(_0x100774,null))[_0x7b4c('0x19')](saveUpdates(_0x2ed731[_0x7b4c('0x3f')],null))[_0x7b4c('0x19')](respondWithResult(_0x100774,null))[_0x7b4c('0x37')](handleError(_0x100774,null));};exports[_0x7b4c('0x1a')]=function(_0x42f386,_0x13de84){return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x42f386['params']['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x13de84,null))['then'](removeEntity(_0x13de84,null))['catch'](handleError(_0x13de84,null));};exports[_0x7b4c('0x41')]=function(_0x1f1653,_0x54a887){return db['FaxQueue'][_0x7b4c('0x41')]()[_0x7b4c('0x19')](respondWithResult(_0x54a887,null))[_0x7b4c('0x37')](handleError(_0x54a887,null));};exports[_0x7b4c('0x42')]=function(_0x8ebf9b,_0x4759e9){var _0x336796={'raw':!![],'where':{}},_0x1cf7c7={},_0x57ad8c;return db[_0x7b4c('0x23')][_0x7b4c('0x43')]({'where':{'id':_0x8ebf9b[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x4759e9,null))[_0x7b4c('0x19')](function(_0x379f15){if(_0x379f15){_0x57ad8c=_0x379f15[_0x7b4c('0x1b')]({'plain':!![]});_0x1cf7c7[_0x7b4c('0x2e')]=_[_0x7b4c('0x2f')](db['UserFaxQueue']['rawAttributes']);_0x1cf7c7[_0x7b4c('0x2b')]=_[_0x7b4c('0x2f')](_0x8ebf9b[_0x7b4c('0x2b')]);_0x1cf7c7['filters']=_[_0x7b4c('0x31')](_0x1cf7c7[_0x7b4c('0x2e')],_0x1cf7c7['query']);_0x336796[_0x7b4c('0x33')]=_['intersection'](_0x1cf7c7[_0x7b4c('0x2e')],qs['fields'](_0x8ebf9b[_0x7b4c('0x2b')]['fields']));_0x336796[_0x7b4c('0x33')]=_0x336796[_0x7b4c('0x33')]['length']?_0x336796['attributes']:_0x1cf7c7[_0x7b4c('0x2e')];if(!_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x44')]('nolimit')){_0x336796['limit']=qs[_0x7b4c('0x14')](_0x8ebf9b[_0x7b4c('0x2b')]['limit']);_0x336796['offset']=qs[_0x7b4c('0x12')](_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x12')]);}_0x336796['order']=qs[_0x7b4c('0x45')](_0x8ebf9b[_0x7b4c('0x2b')]['sort']);_0x336796['where']=qs[_0x7b4c('0x30')](_['pick'](_0x8ebf9b['query'],_0x1cf7c7[_0x7b4c('0x30')]));_0x336796['where']['FaxQueueId']=_0x379f15['id'];if(_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x46')]){_0x336796[_0x7b4c('0x29')]=_[_0x7b4c('0x35')](_0x336796['where'],{'$or':_['map'](_0x336796[_0x7b4c('0x33')],function(_0x6c226d){var _0x30a7e3={};_0x30a7e3[_0x6c226d]={'$like':'%'+_0x8ebf9b['query'][_0x7b4c('0x46')]+'%'};return _0x30a7e3;})});}_0x336796=_[_0x7b4c('0x35')]({},_0x336796,_0x8ebf9b[_0x7b4c('0x36')]);return db['UserFaxQueue'][_0x7b4c('0x2c')](_0x336796);}})[_0x7b4c('0x19')](function(_0x529803){if(_0x529803){return db[_0x7b4c('0x47')][_0x7b4c('0x48')]({'where':{'id':_[_0x7b4c('0x22')](_0x529803,_0x7b4c('0x49')),'role':_0x7b4c('0x4a')},'attributes':['id',_0x7b4c('0x1f'),_0x7b4c('0x4b'),'updatedAt',_0x7b4c('0x4c')]});}})[_0x7b4c('0x19')](function(_0x4ab9dc){if(_0x4ab9dc){return{'count':_0x4ab9dc[_0x7b4c('0x15')],'rows':_[_0x7b4c('0x22')](_0x4ab9dc[_0x7b4c('0x2d')],function(_0x6b3d5e){return{'membername':_0x6b3d5e['name'],'UserId':_0x6b3d5e['id'],'queue_name':_0x57ad8c[_0x7b4c('0x1f')],'FaxQueueId':_0x57ad8c['id'],'interface':util['format']('%s/%s',_0x7b4c('0x4d'),_0x6b3d5e[_0x7b4c('0x1f')]),'penalty':0x0,'paused':_0x6b3d5e[_0x7b4c('0x4b')],'createdAt':_0x6b3d5e[_0x7b4c('0x4c')],'updatedAt':_0x6b3d5e[_0x7b4c('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4759e9,_0x336796))['catch'](handleError(_0x4759e9,null));};exports[_0x7b4c('0x4f')]=function(_0x3c84af,_0x2b77de){var _0x5e102d={};var _0xade53c={};var _0xc4dae0;var _0x36fc5d;return db['FaxQueue'][_0x7b4c('0x43')]({'where':{'id':_0x3c84af[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x2b77de,null))['then'](function(_0x257e56){if(_0x257e56){_0xc4dae0=_0x257e56;_0xade53c[_0x7b4c('0x2e')]=_['keys'](db[_0x7b4c('0x50')]['rawAttributes']);_0xade53c[_0x7b4c('0x2b')]=_[_0x7b4c('0x2f')](_0x3c84af[_0x7b4c('0x2b')]);_0xade53c['filters']=_['intersection'](_0xade53c[_0x7b4c('0x2e')],_0xade53c[_0x7b4c('0x2b')]);_0x5e102d[_0x7b4c('0x33')]=_['intersection'](_0xade53c[_0x7b4c('0x2e')],qs['fields'](_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x32')]));_0x5e102d[_0x7b4c('0x33')]=_0x5e102d[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x5e102d['attributes']:_0xade53c[_0x7b4c('0x2e')];_0x5e102d[_0x7b4c('0x51')]=qs['sort'](_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x45')]);_0x5e102d[_0x7b4c('0x29')]=qs[_0x7b4c('0x30')](_[_0x7b4c('0x52')](_0x3c84af[_0x7b4c('0x2b')],_0xade53c[_0x7b4c('0x30')]));if(_0x3c84af[_0x7b4c('0x2b')]['filter']){_0x5e102d[_0x7b4c('0x29')]=_[_0x7b4c('0x35')](_0x5e102d[_0x7b4c('0x29')],{'$or':_[_0x7b4c('0x22')](_0x5e102d[_0x7b4c('0x33')],function(_0x3cbf32){var _0x2f3ba9={};_0x2f3ba9[_0x3cbf32]={'$like':'%'+_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x46')]+'%'};return _0x2f3ba9;})});}_0x5e102d=_[_0x7b4c('0x35')]({},_0x5e102d,_0x3c84af[_0x7b4c('0x36')]);return _0xc4dae0[_0x7b4c('0x4f')](_0x5e102d);}})[_0x7b4c('0x19')](function(_0x225f38){if(_0x225f38){_0x36fc5d=_0x225f38[_0x7b4c('0x34')];if(!_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x44')](_0x7b4c('0x53'))){_0x5e102d[_0x7b4c('0x14')]=qs[_0x7b4c('0x14')](_0x3c84af['query']['limit']);_0x5e102d[_0x7b4c('0x12')]=qs[_0x7b4c('0x12')](_0x3c84af['query'][_0x7b4c('0x12')]);}return _0xc4dae0[_0x7b4c('0x4f')](_0x5e102d);}})[_0x7b4c('0x19')](function(_0xc214ce){if(_0xc214ce){return _0xc214ce?{'count':_0x36fc5d,'rows':_0xc214ce}:null;}})[_0x7b4c('0x19')](respondWithResult(_0x2b77de,null))[_0x7b4c('0x37')](handleError(_0x2b77de,null));};exports[_0x7b4c('0x54')]=function(_0x456111,_0x40edf1){var _0x4ff33f=_0x456111[_0x7b4c('0x3f')]['ids'];return db[_0x7b4c('0x50')]['findAll']({'where':{'id':_0x4ff33f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b4c('0x55'),'attributes':['id','name','online',_0x7b4c('0x56'),_0x7b4c('0x57')],'raw':!![]}]})[_0x7b4c('0x19')](function(_0x530979){if(_0x530979){var _0x46fe2e=_[_0x7b4c('0x58')](_0x530979,function(_0x10e789){var _0x29987e=_0x10e789[_0x7b4c('0x1b')]({'plain':!![]});return _0x29987e[_0x7b4c('0x55')];});return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x456111[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](function(_0x294c8b){return db[_0x7b4c('0x59')][_0x7b4c('0x5a')](function(_0x1989e1){return _0x294c8b['addTeams'](_0x4ff33f,{'transaction':_0x1989e1})[_0x7b4c('0x19')](function(){return BPromise[_0x7b4c('0x5b')](_0x46fe2e,function(_0x35e94a){return db[_0x7b4c('0x5c')]['findOrCreate']({'where':{'UserId':_0x35e94a['id'],'FaxQueueId':_0x456111[_0x7b4c('0x40')]['id']},'transaction':_0x1989e1});});})[_0x7b4c('0x19')](function(){_0x46fe2e[_0x7b4c('0x5d')](function(_0x317cd4){socket[_0x7b4c('0x5e')](_0x7b4c('0x5f'),{'UserId':_0x317cd4['id'],'FaxQueueId':_0x294c8b['id']});});});});});}})[_0x7b4c('0x19')](respondWithStatusCode(_0x40edf1,null))['catch'](handleError(_0x40edf1,null));};exports[_0x7b4c('0x60')]=function(_0x108c99,_0x4d2c85){return db['Team']['findAll']({'where':{'id':_0x108c99[_0x7b4c('0x2b')][_0x7b4c('0x61')]},'attributes':['id'],'include':[{'model':db[_0x7b4c('0x47')],'as':_0x7b4c('0x55'),'attributes':['id'],'raw':!![]}]})[_0x7b4c('0x19')](handleEntityNotFound(_0x4d2c85,null))[_0x7b4c('0x19')](function(_0x2abb3e){var _0x200c98=_[_0x7b4c('0x22')](_0x2abb3e,'id');var _0x2bc889=[];var _0x83e8bb=[];var _0x257fae=squel[_0x7b4c('0x62')]();_0x257fae['field'](_0x7b4c('0x63'))[_0x7b4c('0x64')](_0x7b4c('0x65'),'tq')['join'](_0x7b4c('0x66'),'ut',_0x7b4c('0x67'))[_0x7b4c('0x29')](_0x7b4c('0x68'),_0x108c99[_0x7b4c('0x40')]['id']);for(var _0x57f1a0=0x0;_0x57f1a0<_0x2abb3e[_0x7b4c('0x34')];_0x57f1a0+=0x1){let _0x1cd19e=_0x2abb3e[_0x57f1a0];for(var _0x34abb1=0x0;_0x34abb1<_0x1cd19e[_0x7b4c('0x55')]['length'];_0x34abb1+=0x1){let _0x11842d=_0x1cd19e[_0x7b4c('0x55')][_0x34abb1];var _0xdfa0bc=_0x257fae['clone']();_0xdfa0bc[_0x7b4c('0x29')](_0x7b4c('0x69'),_0x11842d['id']);_0x83e8bb[_0x7b4c('0x6a')](db[_0x7b4c('0x59')]['query'](_0xdfa0bc[_0x7b4c('0x6b')](),{'type':db[_0x7b4c('0x59')][_0x7b4c('0x6c')][_0x7b4c('0x6d')]})['then'](function(_0x288a82){if(_0x288a82['length']===0x1){return _0x11842d['id'];}else{var _0x3b9d97=_['every'](_[_0x7b4c('0x22')](_0x288a82,_0x7b4c('0x6e')),function(_0xb442e3){return _['includes'](_0x200c98,_0xb442e3);});if(_0x3b9d97){return _0x11842d['id'];}}}));}}return BPromise[_0x7b4c('0x6f')](_0x83e8bb)['then'](function(_0xb2d616){_0x2bc889=_(_0x2bc889)[_0x7b4c('0x70')](_0xb2d616)['compact']()[_0x7b4c('0x71')]();return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x108c99[_0x7b4c('0x40')]['id']}})['then'](function(_0x3d1450){return db[_0x7b4c('0x59')]['transaction'](function(_0x17d1fc){return _0x3d1450[_0x7b4c('0x60')](_0x108c99[_0x7b4c('0x2b')][_0x7b4c('0x61')],{'transaction':_0x17d1fc})[_0x7b4c('0x19')](function(){if(!_[_0x7b4c('0x72')](_0x2bc889)){return _0x3d1450[_0x7b4c('0x73')](_0x2bc889,{'transaction':_0x17d1fc});}})['then'](function(){_0x2bc889['forEach'](function(_0xdb202){socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':_0xdb202,'FaxQueueId':_0x3d1450['id']});});});});});});})[_0x7b4c('0x19')](respondWithStatusCode(_0x4d2c85,null))[_0x7b4c('0x37')](handleError(_0x4d2c85,null));};exports['addAgents']=function(_0x228b2b,_0x28cf40){return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x228b2b['params']['id']}})['then'](handleEntityNotFound(_0x28cf40,null))[_0x7b4c('0x19')](function(_0x2b1cbe){if(_0x2b1cbe){return _0x2b1cbe[_0x7b4c('0x75')](_0x228b2b[_0x7b4c('0x3f')][_0x7b4c('0x61')],_['omit'](_0x228b2b[_0x7b4c('0x3f')],[_0x7b4c('0x61'),'id'])||{})[_0x7b4c('0x76')](function(_0x20a26c){for(var _0x5c067a=0x0;_0x5c067a<_0x228b2b['body']['ids'][_0x7b4c('0x34')];_0x5c067a+=0x1){socket[_0x7b4c('0x5e')](_0x7b4c('0x5f'),{'UserId':Number(_0x228b2b['body'][_0x7b4c('0x61')][_0x5c067a]),'FaxQueueId':Number(_0x228b2b['params']['id'])});}return _0x20a26c;});}})['then'](respondWithResult(_0x28cf40,null))[_0x7b4c('0x37')](handleError(_0x28cf40,null));};exports['removeAgents']=function(_0x437ef7,_0x1a7b95){return db['FaxQueue']['find']({'where':{'id':_0x437ef7[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x1a7b95,null))[_0x7b4c('0x19')](function(_0x119426){if(_0x119426){return _0x119426['removeAgents'](_0x437ef7['query'][_0x7b4c('0x61')])[_0x7b4c('0x19')](function(){if(_[_0x7b4c('0x77')](_0x437ef7[_0x7b4c('0x2b')][_0x7b4c('0x61')])){for(var _0x14fc2f=0x0;_0x14fc2f<_0x437ef7[_0x7b4c('0x2b')]['ids'][_0x7b4c('0x34')];_0x14fc2f+=0x1){socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':Number(_0x437ef7[_0x7b4c('0x2b')][_0x7b4c('0x61')][_0x14fc2f]),'FaxQueueId':Number(_0x437ef7[_0x7b4c('0x40')]['id'])});}}else{socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':Number(_0x437ef7[_0x7b4c('0x2b')]['ids']),'FaxQueueId':Number(_0x437ef7[_0x7b4c('0x40')]['id'])});}});}})[_0x7b4c('0x19')](respondWithStatusCode(_0x1a7b95,null))[_0x7b4c('0x37')](handleError(_0x1a7b95,null));};exports[_0x7b4c('0x78')]=function(_0x3a1150,_0x3c5e44){var _0x1aae06={};var _0x34a4cc={};var _0x3fd4ed;var _0x59e7b9;return db[_0x7b4c('0x23')][_0x7b4c('0x43')]({'where':{'id':_0x3a1150[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x3c5e44,null))[_0x7b4c('0x19')](function(_0x1a4ac1){if(_0x1a4ac1){_0x3fd4ed=_0x1a4ac1;_0x34a4cc['model']=_[_0x7b4c('0x2f')](db[_0x7b4c('0x47')]['rawAttributes']);_0x34a4cc['query']=_[_0x7b4c('0x2f')](_0x3a1150['query']);_0x34a4cc[_0x7b4c('0x30')]=_[_0x7b4c('0x31')](_0x34a4cc[_0x7b4c('0x2e')],_0x34a4cc[_0x7b4c('0x2b')]);_0x1aae06['attributes']=_['intersection'](_0x34a4cc[_0x7b4c('0x2e')],qs[_0x7b4c('0x32')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x32')]));_0x1aae06[_0x7b4c('0x33')]=_0x1aae06[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x1aae06[_0x7b4c('0x33')]:_0x34a4cc[_0x7b4c('0x2e')];_0x1aae06[_0x7b4c('0x51')]=qs[_0x7b4c('0x45')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x45')]);_0x1aae06[_0x7b4c('0x29')]=qs[_0x7b4c('0x30')](_['pick'](_0x3a1150[_0x7b4c('0x2b')],_0x34a4cc[_0x7b4c('0x30')]));if(_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x46')]){_0x1aae06['where']=_['merge'](_0x1aae06[_0x7b4c('0x29')],{'$or':_[_0x7b4c('0x22')](_0x1aae06[_0x7b4c('0x33')],function(_0x46be32){var _0x84555b={};_0x84555b[_0x46be32]={'$like':'%'+_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x46')]+'%'};return _0x84555b;})});}_0x1aae06=_[_0x7b4c('0x35')]({},_0x1aae06,_0x3a1150[_0x7b4c('0x36')]);return _0x3fd4ed['getAgents'](_0x1aae06);}})[_0x7b4c('0x19')](function(_0x3f29fd){if(_0x3f29fd){_0x59e7b9=_0x3f29fd[_0x7b4c('0x34')];if(!_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x44')](_0x7b4c('0x53'))){_0x1aae06[_0x7b4c('0x14')]=qs[_0x7b4c('0x14')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x14')]);_0x1aae06[_0x7b4c('0x12')]=qs[_0x7b4c('0x12')](_0x3a1150['query']['offset']);}return _0x3fd4ed[_0x7b4c('0x78')](_0x1aae06);}})[_0x7b4c('0x19')](function(_0xf491ab){if(_0xf491ab){return _0xf491ab?{'count':_0x59e7b9,'rows':_0xf491ab}:null;}})[_0x7b4c('0x19')](respondWithResult(_0x3c5e44,null))[_0x7b4c('0x37')](handleError(_0x3c5e44,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ca98eba..87cc622 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 _0x4aeb=['FaxQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x598fa2,_0x1bfd11){var _0x53dc25=function(_0x1a250f){while(--_0x1a250f){_0x598fa2['push'](_0x598fa2['shift']());}};_0x53dc25(++_0x1bfd11);}(_0x4aeb,0x170));var _0xb4ae=function(_0x528d4f,_0x19b4f9){_0x528d4f=_0x528d4f-0x0;var _0x3df605=_0x4aeb[_0x528d4f];return _0x3df605;};'use strict';var EventEmitter=require(_0xb4ae('0x0'));var FaxQueue=require(_0xb4ae('0x1'))['db'][_0xb4ae('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb4ae('0x3')](0x0);var events={'afterCreate':_0xb4ae('0x4'),'afterUpdate':_0xb4ae('0x5'),'afterDestroy':_0xb4ae('0x6')};function emitEvent(_0x203ba0){return function(_0x195799,_0x1ac9de,_0x4c6aa9){FaxQueueEvents['emit'](_0x203ba0+':'+_0x195799['id'],_0x195799);FaxQueueEvents['emit'](_0x203ba0,_0x195799);_0x4c6aa9(null);};}for(var e in events){if(events[_0xb4ae('0x7')](e)){var event=events[e];FaxQueue[_0xb4ae('0x8')](e,emitEvent(event));}}module[_0xb4ae('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x57af=['emit','hasOwnProperty','hook','exports','events','FaxQueue','save','remove'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x57af,0x16c));var _0xf57a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x57af[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require(_0xf57a('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xf57a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf57a('0x2'),'afterUpdate':'update','afterDestroy':_0xf57a('0x3')};function emitEvent(_0x3589e1){return function(_0xae971d,_0x216c42,_0x567e32){FaxQueueEvents[_0xf57a('0x4')](_0x3589e1+':'+_0xae971d['id'],_0xae971d);FaxQueueEvents[_0xf57a('0x4')](_0x3589e1,_0xae971d);_0x567e32(null);};}for(var e in events){if(events[_0xf57a('0x5')](e)){var event=events[e];FaxQueue[_0xf57a('0x6')](e,emitEvent(event));}}module[_0xf57a('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 47d53bc..bc7afff 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 _0x06e1=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','../../config/logger'];(function(_0x5756be,_0x13a88a){var _0x42b9b0=function(_0x42d42d){while(--_0x42d42d){_0x5756be['push'](_0x5756be['shift']());}};_0x42b9b0(++_0x13a88a);}(_0x06e1,0xae));var _0x106e=function(_0x38eb99,_0x3f6ecd){_0x38eb99=_0x38eb99-0x0;var _0x5844da=_0x06e1[_0x38eb99];return _0x5844da;};'use strict';var _=require(_0x106e('0x0'));var util=require('util');var logger=require(_0x106e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x106e('0x2'));var rp=require(_0x106e('0x3'));var fs=require('fs');var path=require(_0x106e('0x4'));var rimraf=require(_0x106e('0x5'));var config=require(_0x106e('0x6'));var attributes=require(_0x106e('0x7'));module[_0x106e('0x8')]=function(_0x27e915,_0x1367e8){return _0x27e915[_0x106e('0x9')]('FaxQueue',attributes,{'tableName':_0x106e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20f9=['../../config/environment','exports','define','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ae1e2,_0x29d1b0){var _0x5c3809=function(_0x45a263){while(--_0x45a263){_0x1ae1e2['push'](_0x1ae1e2['shift']());}};_0x5c3809(++_0x29d1b0);}(_0x20f9,0x190));var _0x920f=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x20f9[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x920f('0x0'));var util=require(_0x920f('0x1'));var logger=require('../../config/logger')(_0x920f('0x2'));var moment=require(_0x920f('0x3'));var BPromise=require(_0x920f('0x4'));var rp=require(_0x920f('0x5'));var fs=require('fs');var path=require(_0x920f('0x6'));var rimraf=require(_0x920f('0x7'));var config=require(_0x920f('0x8'));var attributes=require('./faxQueue.attributes');module[_0x920f('0x9')]=function(_0xca2d1c,_0x52919c){return _0xca2d1c[_0x920f('0xa')]('FaxQueue',attributes,{'tableName':_0x920f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index cf021ff..17c8d6c 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 _0xb22d=['debug','stringify','error','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x62ec77,_0x53dc59){var _0x261fdd=function(_0x3ed6d2){while(--_0x3ed6d2){_0x62ec77['push'](_0x62ec77['shift']());}};_0x261fdd(++_0x53dc59);}(_0xb22d,0xe6));var _0xdb22=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xb22d[_0x5aa373];return _0x590e8e;};'use strict';var _=require(_0xdb22('0x0'));var util=require('util');var moment=require(_0xdb22('0x1'));var BPromise=require(_0xdb22('0x2'));var rs=require(_0xdb22('0x3'));var fs=require('fs');var Redis=require(_0xdb22('0x4'));var db=require(_0xdb22('0x5'))['db'];var utils=require(_0xdb22('0x6'));var logger=require('../../config/logger')(_0xdb22('0x7'));var config=require(_0xdb22('0x8'));var jayson=require(_0xdb22('0x9'));var client=jayson[_0xdb22('0xa')][_0xdb22('0xb')]({'port':0x232a});config[_0xdb22('0xc')]=_[_0xdb22('0xd')](config[_0xdb22('0xc')],{'host':_0xdb22('0xe'),'port':0x18eb});var socket=require(_0xdb22('0xf'))(new Redis(config[_0xdb22('0xc')]));require(_0xdb22('0x10'))[_0xdb22('0x11')](socket);function respondWithRpcPromise(_0x2adf2d,_0x271ee,_0x40530e){return new BPromise(function(_0x5c75f4,_0x4d3a35){return client[_0xdb22('0x12')](_0x2adf2d,_0x40530e)[_0xdb22('0x13')](function(_0x59075a){logger['info'](_0xdb22('0x14'),_0x271ee,_0xdb22('0x15'));logger[_0xdb22('0x16')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x271ee,'request\x20sent',JSON[_0xdb22('0x17')](_0x59075a));if(_0x59075a[_0xdb22('0x18')]){if(_0x59075a[_0xdb22('0x18')]['code']===0x1f4){logger[_0xdb22('0x18')]('FaxQueue,\x20%s,\x20%s',_0x271ee,_0x59075a['error'][_0xdb22('0x19')]);return _0x4d3a35(_0x59075a[_0xdb22('0x18')][_0xdb22('0x19')]);}logger['error'](_0xdb22('0x14'),_0x271ee,_0x59075a[_0xdb22('0x18')][_0xdb22('0x19')]);return _0x5c75f4(_0x59075a[_0xdb22('0x18')]['message']);}else{logger[_0xdb22('0x1a')](_0xdb22('0x14'),_0x271ee,_0xdb22('0x15'));_0x5c75f4(_0x59075a[_0xdb22('0x1b')][_0xdb22('0x19')]);}})[_0xdb22('0x1c')](function(_0x43cb28){logger[_0xdb22('0x18')](_0xdb22('0x14'),_0x271ee,_0x43cb28);_0x4d3a35(_0x43cb28);});});}exports[_0xdb22('0x1d')]=function(_0x53d302){var _0x1a1241=this;return new Promise(function(_0x1fdcd6,_0x4556b0){return db[_0xdb22('0x1e')][_0xdb22('0x1f')]({'raw':_0x53d302['options']?_0x53d302['options']['raw']===undefined?!![]:![]:!![],'where':_0x53d302[_0xdb22('0x20')]?_0x53d302[_0xdb22('0x20')][_0xdb22('0x21')]||null:null,'attributes':_0x53d302['options']?_0x53d302[_0xdb22('0x20')][_0xdb22('0x22')]||null:null,'limit':_0x53d302[_0xdb22('0x20')]?_0x53d302['options'][_0xdb22('0x23')]||null:null,'include':_0x53d302['options']?_0x53d302[_0xdb22('0x20')][_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x53d302[_0xdb22('0x20')][_0xdb22('0x24')],function(_0x11186e){return{'model':db[_0x11186e[_0xdb22('0x26')]],'as':_0x11186e['as'],'attributes':_0x11186e[_0xdb22('0x22')],'include':_0x11186e[_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x11186e[_0xdb22('0x24')],function(_0x5b4ca2){return{'model':db[_0x5b4ca2[_0xdb22('0x26')]],'as':_0x5b4ca2['as'],'attributes':_0x5b4ca2[_0xdb22('0x22')],'include':_0x5b4ca2[_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x5b4ca2[_0xdb22('0x24')],function(_0xb1c683){return{'model':db[_0xb1c683[_0xdb22('0x26')]],'as':_0xb1c683['as'],'attributes':_0xb1c683[_0xdb22('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4636ec){logger['info'](_0xdb22('0x1d'),_0x53d302);logger[_0xdb22('0x16')](_0xdb22('0x1d'),_0x53d302,JSON[_0xdb22('0x17')](_0x4636ec));_0x1fdcd6(_0x4636ec);})[_0xdb22('0x1c')](function(_0x3014e7){logger[_0xdb22('0x18')](_0xdb22('0x1d'),_0x3014e7[_0xdb22('0x19')],_0x53d302);_0x4556b0(_0x1a1241['error'](0x1f4,_0x3014e7[_0xdb22('0x19')]));});});};exports[_0xdb22('0x27')]=function(_0x98c544){var _0x4d0cb0=this;return new Promise(function(_0x381475,_0x5a0f26){return db[_0xdb22('0x1e')][_0xdb22('0x28')]({'raw':_0x98c544['options']?_0x98c544[_0xdb22('0x20')][_0xdb22('0x29')]===undefined?!![]:![]:!![],'where':_0x98c544[_0xdb22('0x20')]?_0x98c544[_0xdb22('0x20')][_0xdb22('0x21')]||null:null,'attributes':_0x98c544[_0xdb22('0x20')]?_0x98c544['options']['attributes']||null:null,'include':_0x98c544['options']?_0x98c544[_0xdb22('0x20')]['include']?_[_0xdb22('0x25')](_0x98c544['options'][_0xdb22('0x24')],function(_0x18b738){return{'model':db[_0x18b738[_0xdb22('0x26')]],'as':_0x18b738['as'],'attributes':_0x18b738[_0xdb22('0x22')],'include':_0x18b738[_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x18b738[_0xdb22('0x24')],function(_0x5477b0){return{'model':db[_0x5477b0[_0xdb22('0x26')]],'as':_0x5477b0['as'],'attributes':_0x5477b0[_0xdb22('0x22')],'include':_0x5477b0[_0xdb22('0x24')]?_[_0xdb22('0x25')](_0x5477b0[_0xdb22('0x24')],function(_0x53557c){return{'model':db[_0x53557c[_0xdb22('0x26')]],'as':_0x53557c['as'],'attributes':_0x53557c['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb22('0x13')](function(_0x562c5f){logger[_0xdb22('0x1a')](_0xdb22('0x27'),_0x98c544);logger['debug'](_0xdb22('0x27'),_0x98c544,JSON[_0xdb22('0x17')](_0x562c5f));_0x381475(_0x562c5f);})[_0xdb22('0x1c')](function(_0x10dff2){logger[_0xdb22('0x18')](_0xdb22('0x27'),_0x10dff2['message'],_0x98c544);_0x5a0f26(_0x4d0cb0[_0xdb22('0x18')](0x1f4,_0x10dff2['message']));});});}; \ No newline at end of file +var _0x4743=['options','raw','where','attributes','include','model','map','stringify','catch','ShowFaxQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','GetFaxQueue','FaxQueue'];(function(_0x599809,_0x4d3cd0){var _0x364f0b=function(_0x2d1aa4){while(--_0x2d1aa4){_0x599809['push'](_0x599809['shift']());}};_0x364f0b(++_0x4d3cd0);}(_0x4743,0x187));var _0x3474=function(_0x5bdfb2,_0x5eeb10){_0x5bdfb2=_0x5bdfb2-0x0;var _0x5f5240=_0x4743[_0x5bdfb2];return _0x5f5240;};'use strict';var _=require(_0x3474('0x0'));var util=require(_0x3474('0x1'));var moment=require(_0x3474('0x2'));var BPromise=require('bluebird');var rs=require(_0x3474('0x3'));var fs=require('fs');var Redis=require(_0x3474('0x4'));var db=require(_0x3474('0x5'))['db'];var utils=require(_0x3474('0x6'));var logger=require(_0x3474('0x7'))(_0x3474('0x8'));var config=require(_0x3474('0x9'));var jayson=require(_0x3474('0xa'));var client=jayson[_0x3474('0xb')][_0x3474('0xc')]({'port':0x232a});config[_0x3474('0xd')]=_['defaults'](config[_0x3474('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3474('0xe'))(new Redis(config[_0x3474('0xd')]));require(_0x3474('0xf'))['register'](socket);function respondWithRpcPromise(_0x5252ca,_0x3ee747,_0x472844){return new BPromise(function(_0x2cc3db,_0x51966f){return client[_0x3474('0x10')](_0x5252ca,_0x472844)[_0x3474('0x11')](function(_0x37af41){logger[_0x3474('0x12')](_0x3474('0x13'),_0x3ee747,_0x3474('0x14'));logger[_0x3474('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3ee747,_0x3474('0x14'),JSON['stringify'](_0x37af41));if(_0x37af41[_0x3474('0x16')]){if(_0x37af41[_0x3474('0x16')][_0x3474('0x17')]===0x1f4){logger['error'](_0x3474('0x13'),_0x3ee747,_0x37af41['error'][_0x3474('0x18')]);return _0x51966f(_0x37af41['error']['message']);}logger[_0x3474('0x16')](_0x3474('0x13'),_0x3ee747,_0x37af41[_0x3474('0x16')]['message']);return _0x2cc3db(_0x37af41[_0x3474('0x16')]['message']);}else{logger['info'](_0x3474('0x13'),_0x3ee747,_0x3474('0x14'));_0x2cc3db(_0x37af41['result'][_0x3474('0x18')]);}})['catch'](function(_0x4e695a){logger['error'](_0x3474('0x13'),_0x3ee747,_0x4e695a);_0x51966f(_0x4e695a);});});}exports[_0x3474('0x19')]=function(_0x5e240c){var _0x1e26b9=this;return new Promise(function(_0x3f61d7,_0x5999e1){return db[_0x3474('0x1a')]['findAll']({'raw':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')][_0x3474('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')][_0x3474('0x1d')]||null:null,'attributes':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')][_0x3474('0x1e')]||null:null,'limit':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')]['limit']||null:null,'include':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')][_0x3474('0x1f')]?_['map'](_0x5e240c[_0x3474('0x1b')][_0x3474('0x1f')],function(_0x51cad8){return{'model':db[_0x51cad8[_0x3474('0x20')]],'as':_0x51cad8['as'],'attributes':_0x51cad8[_0x3474('0x1e')],'include':_0x51cad8['include']?_['map'](_0x51cad8[_0x3474('0x1f')],function(_0x38b0af){return{'model':db[_0x38b0af['model']],'as':_0x38b0af['as'],'attributes':_0x38b0af['attributes'],'include':_0x38b0af[_0x3474('0x1f')]?_[_0x3474('0x21')](_0x38b0af[_0x3474('0x1f')],function(_0x351c6d){return{'model':db[_0x351c6d[_0x3474('0x20')]],'as':_0x351c6d['as'],'attributes':_0x351c6d[_0x3474('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3474('0x11')](function(_0x51721f){logger[_0x3474('0x12')](_0x3474('0x19'),_0x5e240c);logger[_0x3474('0x15')](_0x3474('0x19'),_0x5e240c,JSON[_0x3474('0x22')](_0x51721f));_0x3f61d7(_0x51721f);})[_0x3474('0x23')](function(_0x3f3807){logger['error'](_0x3474('0x19'),_0x3f3807['message'],_0x5e240c);_0x5999e1(_0x1e26b9[_0x3474('0x16')](0x1f4,_0x3f3807[_0x3474('0x18')]));});});};exports[_0x3474('0x24')]=function(_0x5ca820){var _0x16e811=this;return new Promise(function(_0x556bac,_0xab2a79){return db[_0x3474('0x1a')][_0x3474('0x25')]({'raw':_0x5ca820[_0x3474('0x1b')]?_0x5ca820[_0x3474('0x1b')][_0x3474('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ca820[_0x3474('0x1b')]?_0x5ca820['options'][_0x3474('0x1d')]||null:null,'attributes':_0x5ca820[_0x3474('0x1b')]?_0x5ca820[_0x3474('0x1b')][_0x3474('0x1e')]||null:null,'include':_0x5ca820[_0x3474('0x1b')]?_0x5ca820[_0x3474('0x1b')]['include']?_['map'](_0x5ca820[_0x3474('0x1b')][_0x3474('0x1f')],function(_0x4b3158){return{'model':db[_0x4b3158[_0x3474('0x20')]],'as':_0x4b3158['as'],'attributes':_0x4b3158[_0x3474('0x1e')],'include':_0x4b3158[_0x3474('0x1f')]?_[_0x3474('0x21')](_0x4b3158[_0x3474('0x1f')],function(_0x1055a6){return{'model':db[_0x1055a6[_0x3474('0x20')]],'as':_0x1055a6['as'],'attributes':_0x1055a6['attributes'],'include':_0x1055a6['include']?_[_0x3474('0x21')](_0x1055a6[_0x3474('0x1f')],function(_0x36612f){return{'model':db[_0x36612f[_0x3474('0x20')]],'as':_0x36612f['as'],'attributes':_0x36612f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3474('0x11')](function(_0x5572fe){logger[_0x3474('0x12')](_0x3474('0x24'),_0x5ca820);logger[_0x3474('0x15')](_0x3474('0x24'),_0x5ca820,JSON[_0x3474('0x22')](_0x5572fe));_0x556bac(_0x5572fe);})[_0x3474('0x23')](function(_0x32d55a){logger[_0x3474('0x16')](_0x3474('0x24'),_0x32d55a[_0x3474('0x18')],_0x5ca820);_0xab2a79(_0x16e811['error'](0x1f4,_0x32d55a[_0x3474('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4bc585c..fc097b7 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 _0x54a7=['faxQueue:','./faxQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x237595,_0xb93473){var _0x1ca056=function(_0x3f2d33){while(--_0x3f2d33){_0x237595['push'](_0x237595['shift']());}};_0x1ca056(++_0xb93473);}(_0x54a7,0xe9));var _0x754a=function(_0x529671,_0x161540){_0x529671=_0x529671-0x0;var _0x4cf046=_0x54a7[_0x529671];return _0x4cf046;};'use strict';var FaxQueueEvents=require(_0x754a('0x0'));var events=[_0x754a('0x1'),_0x754a('0x2'),'update'];function createListener(_0x307b38,_0x57f58d){return function(_0x303a97){_0x57f58d[_0x754a('0x3')](_0x307b38,_0x303a97);};}function removeListener(_0x159af4,_0x39621e){return function(){FaxQueueEvents[_0x754a('0x4')](_0x159af4,_0x39621e);};}exports[_0x754a('0x5')]=function(_0x426afc){for(var _0x3ed013=0x0,_0x232644=events[_0x754a('0x6')];_0x3ed013<_0x232644;_0x3ed013++){var _0x407ec8=events[_0x3ed013];var _0xeddcc2=createListener(_0x754a('0x7')+_0x407ec8,_0x426afc);FaxQueueEvents['on'](_0x407ec8,_0xeddcc2);}}; \ No newline at end of file +var _0x91cc=['./faxQueue.events','save','remove','emit','removeListener','register','length','faxQueue:'];(function(_0x1985f9,_0x27ab82){var _0x292c1f=function(_0x37f57c){while(--_0x37f57c){_0x1985f9['push'](_0x1985f9['shift']());}};_0x292c1f(++_0x27ab82);}(_0x91cc,0x128));var _0xc91c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x91cc[_0x4243a3];return _0x1b2a33;};'use strict';var FaxQueueEvents=require(_0xc91c('0x0'));var events=[_0xc91c('0x1'),_0xc91c('0x2'),'update'];function createListener(_0x514c73,_0x485c21){return function(_0x2e302e){_0x485c21[_0xc91c('0x3')](_0x514c73,_0x2e302e);};}function removeListener(_0x1e493f,_0xb36ed0){return function(){FaxQueueEvents[_0xc91c('0x4')](_0x1e493f,_0xb36ed0);};}exports[_0xc91c('0x5')]=function(_0x53407f){for(var _0x4dc1c4=0x0,_0x4977a2=events[_0xc91c('0x6')];_0x4dc1c4<_0x4977a2;_0x4dc1c4++){var _0x3d3b3e=events[_0x4dc1c4];var _0xa15b1=createListener(_0xc91c('0x7')+_0x3d3b3e,_0x53407f);FaxQueueEvents['on'](_0x3d3b3e,_0xa15b1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index b456135..24b6ccf 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 _0xb145=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users'];(function(_0x4eb64a,_0x457978){var _0x34c50e=function(_0x578b8f){while(--_0x578b8f){_0x4eb64a['push'](_0x4eb64a['shift']());}};_0x34c50e(++_0x457978);}(_0xb145,0xa3));var _0x5b14=function(_0x5c83b7,_0x3383a1){_0x5c83b7=_0x5c83b7-0x0;var _0x291509=_0xb145[_0x5c83b7];return _0x291509;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x9')]('/:id/members',auth[_0x5b14('0xa')](),controller[_0x5b14('0x10')]);router[_0x5b14('0x9')](_0x5b14('0x11'),auth[_0x5b14('0xa')](),controller['getTeams']);router[_0x5b14('0x9')]('/:id/users',auth[_0x5b14('0xa')](),controller[_0x5b14('0x12')]);router[_0x5b14('0x13')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0x14')]);router[_0x5b14('0x13')]('/:id/teams',auth[_0x5b14('0xa')](),controller[_0x5b14('0x15')]);router[_0x5b14('0x13')](_0x5b14('0x16'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x17')]);router[_0x5b14('0x18')](_0x5b14('0xe'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x19')]);router[_0x5b14('0x1a')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0x1b')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x5b14('0x1c')]);router[_0x5b14('0x1a')](_0x5b14('0x16'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x1d')]);module[_0x5b14('0x1e')]=router; \ No newline at end of file +var _0x9bd9=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x8c5ebd,_0x55decc){var _0x46f257=function(_0x35d759){while(--_0x35d759){_0x8c5ebd['push'](_0x8c5ebd['shift']());}};_0x46f257(++_0x55decc);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x3cb7e8,_0xb8f77){_0x3cb7e8=_0x3cb7e8-0x0;var _0x72798f=_0x9bd9[_0x3cb7e8];return _0x72798f;};'use strict';var multer=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var path=require(_0x99bd('0x2'));var timeout=require(_0x99bd('0x3'));var express=require(_0x99bd('0x4'));var router=express[_0x99bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99bd('0x7'));var controller=require(_0x99bd('0x8'));router['get']('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xa')]);router[_0x99bd('0xb')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xd')]);router[_0x99bd('0xb')](_0x99bd('0xe'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xf')]);router[_0x99bd('0xb')](_0x99bd('0x10'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x11')]);router['get'](_0x99bd('0x12'),auth['isAuthenticated'](),controller[_0x99bd('0x13')]);router['get'](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller['getAgents']);router[_0x99bd('0x15')]('/',auth['isAuthenticated'](),controller[_0x99bd('0x16')]);router['post'](_0x99bd('0x12'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x17')]);router['post'](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x18')]);router[_0x99bd('0x19')](_0x99bd('0xe'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x1a')]);router[_0x99bd('0x1b')](_0x99bd('0xe'),auth['isAuthenticated'](),controller[_0x99bd('0x1c')]);router[_0x99bd('0x1b')](_0x99bd('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x99bd('0x1b')](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x1d')]);module[_0x99bd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 991af5d..1b30e2b 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 _0x7488=['STRING','DATE','moment','sequelize'];(function(_0x393f6d,_0x289a2a){var _0xb591a8=function(_0x1174e2){while(--_0x1174e2){_0x393f6d['push'](_0x393f6d['shift']());}};_0xb591a8(++_0x289a2a);}(_0x7488,0x19a));var _0x8748=function(_0x1a5689,_0x4920ea){_0x1a5689=_0x1a5689-0x0;var _0x1dbd8a=_0x7488[_0x1a5689];return _0x1dbd8a;};'use strict';var moment=require(_0x8748('0x0'));var Sequelize=require(_0x8748('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8748('0x2')]},'joinAt':{'type':Sequelize[_0x8748('0x3')]},'leaveAt':{'type':Sequelize[_0x8748('0x3')]},'acceptAt':{'type':Sequelize[_0x8748('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8748('0x2')]}}; \ No newline at end of file +var _0x6746=['moment','sequelize','exports','STRING','DATE'];(function(_0x4d230b,_0x41c466){var _0x31478a=function(_0x539c09){while(--_0x539c09){_0x4d230b['push'](_0x4d230b['shift']());}};_0x31478a(++_0x41c466);}(_0x6746,0xb9));var _0x6674=function(_0x6b6340,_0x6302c4){_0x6b6340=_0x6b6340-0x0;var _0x3609bf=_0x6746[_0x6b6340];return _0x3609bf;};'use strict';var moment=require(_0x6674('0x0'));var Sequelize=require(_0x6674('0x1'));module[_0x6674('0x2')]={'uniqueid':{'type':Sequelize[_0x6674('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6674('0x4')]},'acceptAt':{'type':Sequelize[_0x6674('0x4')]},'exitAt':{'type':Sequelize[_0x6674('0x4')]},'reason':{'type':Sequelize[_0x6674('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4a7093a..38f6128 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 _0xac65=['status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','FaxQueueReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x7a6838,_0x42a8dd){var _0x2a0d72=function(_0x25175b){while(--_0x25175b){_0x7a6838['push'](_0x7a6838['shift']());}};_0x2a0d72(++_0x42a8dd);}(_0xac65,0x11d));var _0x5ac6=function(_0x18a819,_0x369e83){_0x18a819=_0x18a819-0x0;var _0x3161fe=_0xac65[_0x18a819];return _0x3161fe;};'use strict';var emlformat=require(_0x5ac6('0x0'));var rimraf=require(_0x5ac6('0x1'));var zipdir=require(_0x5ac6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ac6('0x3'));var moment=require(_0x5ac6('0x4'));var BPromise=require(_0x5ac6('0x5'));var Mustache=require('mustache');var util=require(_0x5ac6('0x6'));var path=require(_0x5ac6('0x7'));var sox=require(_0x5ac6('0x8'));var csv=require('to-csv');var ejs=require(_0x5ac6('0x9'));var fs=require('fs');var fs_extra=require(_0x5ac6('0xa'));var _=require(_0x5ac6('0xb'));var squel=require(_0x5ac6('0xc'));var crypto=require(_0x5ac6('0xd'));var jsforce=require(_0x5ac6('0xe'));var deskjs=require(_0x5ac6('0xf'));var toCsv=require(_0x5ac6('0x10'));var querystring=require(_0x5ac6('0x11'));var Papa=require(_0x5ac6('0x12'));var Redis=require(_0x5ac6('0x13'));var authService=require(_0x5ac6('0x14'));var qs=require(_0x5ac6('0x15'));var as=require(_0x5ac6('0x16'));var hardwareService=require(_0x5ac6('0x17'));var logger=require(_0x5ac6('0x18'))(_0x5ac6('0x19'));var utils=require(_0x5ac6('0x1a'));var config=require(_0x5ac6('0x1b'));var licenseUtil=require(_0x5ac6('0x1c'));var db=require(_0x5ac6('0x1d'))['db'];function respondWithStatusCode(_0x2d6f0a,_0x505ae7){_0x505ae7=_0x505ae7||0xcc;return function(_0x1e1ed0){if(_0x1e1ed0){return _0x2d6f0a[_0x5ac6('0x1e')](_0x505ae7);}return _0x2d6f0a[_0x5ac6('0x1f')](_0x505ae7)['end']();};}function respondWithResult(_0x23cfa7,_0x355f2a){_0x355f2a=_0x355f2a||0xc8;return function(_0x2af869){if(_0x2af869){return _0x23cfa7['status'](_0x355f2a)[_0x5ac6('0x20')](_0x2af869);}};}function respondWithFilteredResult(_0x23ad24,_0x2db3af){return function(_0x158e9a){if(_0x158e9a){var _0xefc444=typeof _0x2db3af['offset']===_0x5ac6('0x21')&&typeof _0x2db3af['limit']==='undefined';var _0x27924d=_0x158e9a[_0x5ac6('0x22')];var _0x2e62d9=_0xefc444?0x0:_0x2db3af[_0x5ac6('0x23')];var _0x24ccd2=_0xefc444?_0x158e9a[_0x5ac6('0x22')]:_0x2db3af[_0x5ac6('0x23')]+_0x2db3af[_0x5ac6('0x24')];var _0x446733;if(_0x24ccd2>=_0x27924d){_0x24ccd2=_0x27924d;_0x446733=0xc8;}else{_0x446733=0xce;}_0x23ad24['status'](_0x446733);return _0x23ad24[_0x5ac6('0x25')](_0x5ac6('0x26'),_0x2e62d9+'-'+_0x24ccd2+'/'+_0x27924d)[_0x5ac6('0x20')](_0x158e9a);}return null;};}function patchUpdates(_0x9ed30){return function(_0x593329){try{jsonpatch[_0x5ac6('0x27')](_0x593329,_0x9ed30,!![]);}catch(_0x4fa376){return BPromise[_0x5ac6('0x28')](_0x4fa376);}return _0x593329['save']();};}function saveUpdates(_0x2c55c5,_0x3c1db4){return function(_0x4e582f){if(_0x4e582f){return _0x4e582f[_0x5ac6('0x29')](_0x2c55c5)[_0x5ac6('0x2a')](function(_0x52ba3f){return _0x52ba3f;});}return null;};}function removeEntity(_0x1c81e7,_0x4c07d6){return function(_0x2f63f1){if(_0x2f63f1){return _0x2f63f1[_0x5ac6('0x2b')]()[_0x5ac6('0x2a')](function(){_0x1c81e7[_0x5ac6('0x1f')](0xcc)[_0x5ac6('0x2c')]();});}};}function handleEntityNotFound(_0x3da323,_0x4086ed){return function(_0x4b94c0){if(!_0x4b94c0){_0x3da323[_0x5ac6('0x1e')](0x194);}return _0x4b94c0;};}function handleError(_0x11188a,_0x5b741f){_0x5b741f=_0x5b741f||0x1f4;return function(_0x333464){logger['error'](_0x333464[_0x5ac6('0x2d')]);if(_0x333464[_0x5ac6('0x2e')]){delete _0x333464['name'];}_0x11188a[_0x5ac6('0x1f')](_0x5b741f)['send'](_0x333464);};}exports['index']=function(_0x2b9e40,_0x48007a){var _0x1827c5={},_0x2c02f7={},_0x490e59={'count':0x0,'rows':[]};var _0x4cb3bd=_[_0x5ac6('0x2f')](db['FaxQueueReport'][_0x5ac6('0x30')],function(_0x4a718d){return{'name':_0x4a718d[_0x5ac6('0x31')],'type':_0x4a718d['type'][_0x5ac6('0x32')]};});_0x2c02f7[_0x5ac6('0x33')]=_[_0x5ac6('0x2f')](_0x4cb3bd,'name');_0x2c02f7[_0x5ac6('0x34')]=_[_0x5ac6('0x35')](_0x2b9e40[_0x5ac6('0x34')]);_0x2c02f7[_0x5ac6('0x36')]=_[_0x5ac6('0x37')](_0x2c02f7[_0x5ac6('0x33')],_0x2c02f7['query']);_0x1827c5['attributes']=_[_0x5ac6('0x37')](_0x2c02f7[_0x5ac6('0x33')],qs[_0x5ac6('0x38')](_0x2b9e40[_0x5ac6('0x34')][_0x5ac6('0x38')]));_0x1827c5[_0x5ac6('0x39')]=_0x1827c5[_0x5ac6('0x39')]['length']?_0x1827c5[_0x5ac6('0x39')]:_0x2c02f7[_0x5ac6('0x33')];if(!_0x2b9e40[_0x5ac6('0x34')][_0x5ac6('0x3a')](_0x5ac6('0x3b'))){_0x1827c5[_0x5ac6('0x24')]=qs[_0x5ac6('0x24')](_0x2b9e40[_0x5ac6('0x34')]['limit']);_0x1827c5[_0x5ac6('0x23')]=qs[_0x5ac6('0x23')](_0x2b9e40['query']['offset']);}_0x1827c5[_0x5ac6('0x3c')]=qs[_0x5ac6('0x3d')](_0x2b9e40[_0x5ac6('0x34')]['sort']);_0x1827c5[_0x5ac6('0x3e')]=qs[_0x5ac6('0x36')](_[_0x5ac6('0x3f')](_0x2b9e40['query'],_0x2c02f7[_0x5ac6('0x36')]),_0x4cb3bd);if(_0x2b9e40['query']['filter']){_0x1827c5['where']=_[_0x5ac6('0x40')](_0x1827c5[_0x5ac6('0x3e')],{'$or':_[_0x5ac6('0x2f')](_0x4cb3bd,function(_0x1e16b0){if(_0x1e16b0[_0x5ac6('0x41')]!=='VIRTUAL'){var _0x4df597={};_0x4df597[_0x1e16b0[_0x5ac6('0x2e')]]={'$like':'%'+_0x2b9e40[_0x5ac6('0x34')][_0x5ac6('0x42')]+'%'};return _0x4df597;}})});}_0x1827c5=_[_0x5ac6('0x40')]({},_0x1827c5,_0x2b9e40[_0x5ac6('0x43')]);var _0x33a1ad={'where':_0x1827c5['where']};return db[_0x5ac6('0x44')]['count'](_0x33a1ad)['then'](function(_0x1eaad7){_0x490e59[_0x5ac6('0x22')]=_0x1eaad7;if(_0x2b9e40[_0x5ac6('0x34')][_0x5ac6('0x45')]){_0x1827c5[_0x5ac6('0x46')]=[{'all':!![]}];}return db[_0x5ac6('0x44')][_0x5ac6('0x47')](_0x1827c5);})[_0x5ac6('0x2a')](function(_0x6ec798){_0x490e59['rows']=_0x6ec798;return _0x490e59;})[_0x5ac6('0x2a')](respondWithFilteredResult(_0x48007a,_0x1827c5))[_0x5ac6('0x48')](handleError(_0x48007a,null));};exports[_0x5ac6('0x49')]=function(_0x2ba18a,_0x76aae3){var _0x4a1992={'raw':!![],'where':{'id':_0x2ba18a[_0x5ac6('0x4a')]['id']}},_0x365396={};_0x365396[_0x5ac6('0x33')]=_[_0x5ac6('0x35')](db['FaxQueueReport']['rawAttributes']);_0x365396[_0x5ac6('0x34')]=_[_0x5ac6('0x35')](_0x2ba18a[_0x5ac6('0x34')]);_0x365396['filters']=_[_0x5ac6('0x37')](_0x365396['model'],_0x365396[_0x5ac6('0x34')]);_0x4a1992['attributes']=_[_0x5ac6('0x37')](_0x365396[_0x5ac6('0x33')],qs[_0x5ac6('0x38')](_0x2ba18a['query']['fields']));_0x4a1992[_0x5ac6('0x39')]=_0x4a1992[_0x5ac6('0x39')]['length']?_0x4a1992[_0x5ac6('0x39')]:_0x365396['model'];if(_0x2ba18a['query'][_0x5ac6('0x45')]){_0x4a1992[_0x5ac6('0x46')]=[{'all':!![]}];}_0x4a1992=_[_0x5ac6('0x40')]({},_0x4a1992,_0x2ba18a['options']);return db[_0x5ac6('0x44')][_0x5ac6('0x4b')](_0x4a1992)[_0x5ac6('0x2a')](handleEntityNotFound(_0x76aae3,null))[_0x5ac6('0x2a')](respondWithResult(_0x76aae3,null))['catch'](handleError(_0x76aae3,null));};exports[_0x5ac6('0x4c')]=function(_0x2181c8,_0x55e210){return db[_0x5ac6('0x44')][_0x5ac6('0x4c')](_0x2181c8[_0x5ac6('0x4d')],{})[_0x5ac6('0x2a')](respondWithResult(_0x55e210,0xc9))['catch'](handleError(_0x55e210,null));};exports[_0x5ac6('0x29')]=function(_0x4133ed,_0x409d8c){if(_0x4133ed[_0x5ac6('0x4d')]['id']){delete _0x4133ed['body']['id'];}return db[_0x5ac6('0x44')][_0x5ac6('0x4b')]({'where':{'id':_0x4133ed[_0x5ac6('0x4a')]['id']}})[_0x5ac6('0x2a')](handleEntityNotFound(_0x409d8c,null))[_0x5ac6('0x2a')](saveUpdates(_0x4133ed[_0x5ac6('0x4d')],null))['then'](respondWithResult(_0x409d8c,null))[_0x5ac6('0x48')](handleError(_0x409d8c,null));};exports['destroy']=function(_0x5d4e9d,_0x9662d8){return db[_0x5ac6('0x44')][_0x5ac6('0x4b')]({'where':{'id':_0x5d4e9d['params']['id']}})[_0x5ac6('0x2a')](handleEntityNotFound(_0x9662d8,null))[_0x5ac6('0x2a')](removeEntity(_0x9662d8,null))[_0x5ac6('0x48')](handleError(_0x9662d8,null));};exports[_0x5ac6('0x4e')]=function(_0x253807,_0x1cddc3){return db[_0x5ac6('0x44')][_0x5ac6('0x4e')]()[_0x5ac6('0x2a')](respondWithResult(_0x1cddc3,null))[_0x5ac6('0x48')](handleError(_0x1cddc3,null));}; \ No newline at end of file +var _0x9879=['moment','bluebird','mustache','util','path','sox','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','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x47af37,_0x10c182){var _0x1e027e=function(_0x545130){while(--_0x545130){_0x47af37['push'](_0x47af37['shift']());}};_0x1e027e(++_0x10c182);}(_0x9879,0x98));var _0x9987=function(_0x4c53d1,_0x4c808b){_0x4c53d1=_0x4c53d1-0x0;var _0x2a2638=_0x9879[_0x4c53d1];return _0x2a2638;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9987('0x0'));var zipdir=require(_0x9987('0x1'));var jsonpatch=require(_0x9987('0x2'));var rp=require(_0x9987('0x3'));var moment=require(_0x9987('0x4'));var BPromise=require(_0x9987('0x5'));var Mustache=require(_0x9987('0x6'));var util=require(_0x9987('0x7'));var path=require(_0x9987('0x8'));var sox=require(_0x9987('0x9'));var csv=require(_0x9987('0xa'));var ejs=require(_0x9987('0xb'));var fs=require('fs');var fs_extra=require(_0x9987('0xc'));var _=require(_0x9987('0xd'));var squel=require(_0x9987('0xe'));var crypto=require('crypto');var jsforce=require(_0x9987('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9987('0x10'));var Papa=require('papaparse');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'];function respondWithStatusCode(_0x2c353c,_0x4c91e3){_0x4c91e3=_0x4c91e3||0xcc;return function(_0x24a42b){if(_0x24a42b){return _0x2c353c[_0x9987('0x1c')](_0x4c91e3);}return _0x2c353c[_0x9987('0x1d')](_0x4c91e3)[_0x9987('0x1e')]();};}function respondWithResult(_0x1d66fe,_0x99976){_0x99976=_0x99976||0xc8;return function(_0x40cd6c){if(_0x40cd6c){return _0x1d66fe[_0x9987('0x1d')](_0x99976)[_0x9987('0x1f')](_0x40cd6c);}};}function respondWithFilteredResult(_0x1fcddb,_0x211574){return function(_0x383996){if(_0x383996){var _0x598a6f=typeof _0x211574['offset']===_0x9987('0x20')&&typeof _0x211574[_0x9987('0x21')]===_0x9987('0x20');var _0x38df2b=_0x383996[_0x9987('0x22')];var _0x563b33=_0x598a6f?0x0:_0x211574[_0x9987('0x23')];var _0x30cef2=_0x598a6f?_0x383996[_0x9987('0x22')]:_0x211574[_0x9987('0x23')]+_0x211574[_0x9987('0x21')];var _0x185842;if(_0x30cef2>=_0x38df2b){_0x30cef2=_0x38df2b;_0x185842=0xc8;}else{_0x185842=0xce;}_0x1fcddb[_0x9987('0x1d')](_0x185842);return _0x1fcddb['set'](_0x9987('0x24'),_0x563b33+'-'+_0x30cef2+'/'+_0x38df2b)[_0x9987('0x1f')](_0x383996);}return null;};}function patchUpdates(_0x5c4035){return function(_0x5b2adb){try{jsonpatch[_0x9987('0x25')](_0x5b2adb,_0x5c4035,!![]);}catch(_0x579341){return BPromise['reject'](_0x579341);}return _0x5b2adb[_0x9987('0x26')]();};}function saveUpdates(_0xd18e1f,_0x3deea2){return function(_0x1fcec7){if(_0x1fcec7){return _0x1fcec7[_0x9987('0x27')](_0xd18e1f)[_0x9987('0x28')](function(_0x5c2c13){return _0x5c2c13;});}return null;};}function removeEntity(_0x3c62e4,_0x2fe4b6){return function(_0x10b59c){if(_0x10b59c){return _0x10b59c[_0x9987('0x29')]()['then'](function(){_0x3c62e4[_0x9987('0x1d')](0xcc)[_0x9987('0x1e')]();});}};}function handleEntityNotFound(_0x490475,_0x5ebf79){return function(_0x27fa51){if(!_0x27fa51){_0x490475[_0x9987('0x1c')](0x194);}return _0x27fa51;};}function handleError(_0x5de1d0,_0xb0f9db){_0xb0f9db=_0xb0f9db||0x1f4;return function(_0x2e7059){logger[_0x9987('0x2a')](_0x2e7059[_0x9987('0x2b')]);if(_0x2e7059[_0x9987('0x2c')]){delete _0x2e7059[_0x9987('0x2c')];}_0x5de1d0[_0x9987('0x1d')](_0xb0f9db)[_0x9987('0x2d')](_0x2e7059);};}exports['index']=function(_0x5a86d2,_0x3606cd){var _0x40248f={},_0x26670f={},_0x4edecd={'count':0x0,'rows':[]};var _0x482d99=_[_0x9987('0x2e')](db[_0x9987('0x2f')][_0x9987('0x30')],function(_0x3807e5){return{'name':_0x3807e5[_0x9987('0x31')],'type':_0x3807e5['type'][_0x9987('0x32')]};});_0x26670f['model']=_['map'](_0x482d99,'name');_0x26670f[_0x9987('0x33')]=_[_0x9987('0x34')](_0x5a86d2[_0x9987('0x33')]);_0x26670f[_0x9987('0x35')]=_[_0x9987('0x36')](_0x26670f[_0x9987('0x37')],_0x26670f[_0x9987('0x33')]);_0x40248f[_0x9987('0x38')]=_[_0x9987('0x36')](_0x26670f[_0x9987('0x37')],qs[_0x9987('0x39')](_0x5a86d2[_0x9987('0x33')]['fields']));_0x40248f[_0x9987('0x38')]=_0x40248f[_0x9987('0x38')][_0x9987('0x3a')]?_0x40248f[_0x9987('0x38')]:_0x26670f[_0x9987('0x37')];if(!_0x5a86d2[_0x9987('0x33')][_0x9987('0x3b')]('nolimit')){_0x40248f[_0x9987('0x21')]=qs[_0x9987('0x21')](_0x5a86d2[_0x9987('0x33')][_0x9987('0x21')]);_0x40248f[_0x9987('0x23')]=qs[_0x9987('0x23')](_0x5a86d2[_0x9987('0x33')]['offset']);}_0x40248f['order']=qs['sort'](_0x5a86d2[_0x9987('0x33')][_0x9987('0x3c')]);_0x40248f[_0x9987('0x3d')]=qs[_0x9987('0x35')](_[_0x9987('0x3e')](_0x5a86d2[_0x9987('0x33')],_0x26670f[_0x9987('0x35')]),_0x482d99);if(_0x5a86d2['query'][_0x9987('0x3f')]){_0x40248f[_0x9987('0x3d')]=_['merge'](_0x40248f[_0x9987('0x3d')],{'$or':_[_0x9987('0x2e')](_0x482d99,function(_0x5d6d70){if(_0x5d6d70[_0x9987('0x40')]!==_0x9987('0x41')){var _0x4f445c={};_0x4f445c[_0x5d6d70[_0x9987('0x2c')]]={'$like':'%'+_0x5a86d2[_0x9987('0x33')][_0x9987('0x3f')]+'%'};return _0x4f445c;}})});}_0x40248f=_[_0x9987('0x42')]({},_0x40248f,_0x5a86d2['options']);var _0x481e9d={'where':_0x40248f[_0x9987('0x3d')]};return db[_0x9987('0x2f')]['count'](_0x481e9d)[_0x9987('0x28')](function(_0x1feb50){_0x4edecd[_0x9987('0x22')]=_0x1feb50;if(_0x5a86d2[_0x9987('0x33')][_0x9987('0x43')]){_0x40248f[_0x9987('0x44')]=[{'all':!![]}];}return db[_0x9987('0x2f')][_0x9987('0x45')](_0x40248f);})['then'](function(_0xcbaf54){_0x4edecd[_0x9987('0x46')]=_0xcbaf54;return _0x4edecd;})['then'](respondWithFilteredResult(_0x3606cd,_0x40248f))[_0x9987('0x47')](handleError(_0x3606cd,null));};exports['show']=function(_0x1bd44e,_0x3b3720){var _0xbc37dd={'raw':!![],'where':{'id':_0x1bd44e[_0x9987('0x48')]['id']}},_0x157213={};_0x157213[_0x9987('0x37')]=_['keys'](db[_0x9987('0x2f')]['rawAttributes']);_0x157213[_0x9987('0x33')]=_[_0x9987('0x34')](_0x1bd44e[_0x9987('0x33')]);_0x157213[_0x9987('0x35')]=_['intersection'](_0x157213['model'],_0x157213[_0x9987('0x33')]);_0xbc37dd['attributes']=_['intersection'](_0x157213[_0x9987('0x37')],qs[_0x9987('0x39')](_0x1bd44e[_0x9987('0x33')]['fields']));_0xbc37dd[_0x9987('0x38')]=_0xbc37dd['attributes'][_0x9987('0x3a')]?_0xbc37dd[_0x9987('0x38')]:_0x157213['model'];if(_0x1bd44e[_0x9987('0x33')][_0x9987('0x43')]){_0xbc37dd[_0x9987('0x44')]=[{'all':!![]}];}_0xbc37dd=_[_0x9987('0x42')]({},_0xbc37dd,_0x1bd44e[_0x9987('0x49')]);return db['FaxQueueReport'][_0x9987('0x4a')](_0xbc37dd)['then'](handleEntityNotFound(_0x3b3720,null))[_0x9987('0x28')](respondWithResult(_0x3b3720,null))['catch'](handleError(_0x3b3720,null));};exports[_0x9987('0x4b')]=function(_0x4c3b78,_0x593e3a){return db['FaxQueueReport'][_0x9987('0x4b')](_0x4c3b78[_0x9987('0x4c')],{})[_0x9987('0x28')](respondWithResult(_0x593e3a,0xc9))['catch'](handleError(_0x593e3a,null));};exports[_0x9987('0x27')]=function(_0x5adaea,_0x282300){if(_0x5adaea[_0x9987('0x4c')]['id']){delete _0x5adaea[_0x9987('0x4c')]['id'];}return db['FaxQueueReport'][_0x9987('0x4a')]({'where':{'id':_0x5adaea[_0x9987('0x48')]['id']}})[_0x9987('0x28')](handleEntityNotFound(_0x282300,null))[_0x9987('0x28')](saveUpdates(_0x5adaea[_0x9987('0x4c')],null))['then'](respondWithResult(_0x282300,null))[_0x9987('0x47')](handleError(_0x282300,null));};exports[_0x9987('0x29')]=function(_0x27da49,_0xcb87ce){return db[_0x9987('0x2f')]['find']({'where':{'id':_0x27da49[_0x9987('0x48')]['id']}})[_0x9987('0x28')](handleEntityNotFound(_0xcb87ce,null))['then'](removeEntity(_0xcb87ce,null))[_0x9987('0x47')](handleError(_0xcb87ce,null));};exports[_0x9987('0x4d')]=function(_0x248cca,_0x23f759){return db[_0x9987('0x2f')]['describe']()[_0x9987('0x28')](respondWithResult(_0x23f759,null))[_0x9987('0x47')](handleError(_0x23f759,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 150c0a1..1c5a5c3 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 _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x507cd8,_0x1e31e3){var _0x149216=function(_0x25e7b0){while(--_0x25e7b0){_0x507cd8['push'](_0x507cd8['shift']());}};_0x149216(++_0x1e31e3);}(_0xe14b,0x93));var _0xbe14=function(_0x329d74,_0x23b3fc){_0x329d74=_0x329d74-0x0;var _0x5246d9=_0xe14b[_0x329d74];return _0x5246d9;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x814b,0x1a2));var _0xb814=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x814b[_0x24a654];return _0x458651;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 7905d2b..5e154e5 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 _0x5a2a=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','update','attributes','limit','UpdateFaxQueueReport'];(function(_0x309eec,_0x351304){var _0x34bb0d=function(_0x4411b){while(--_0x4411b){_0x309eec['push'](_0x309eec['shift']());}};_0x34bb0d(++_0x351304);}(_0x5a2a,0x1b2));var _0xa5a2=function(_0x5b6c6f,_0x113cf3){_0x5b6c6f=_0x5b6c6f-0x0;var _0x517ee5=_0x5a2a[_0x5b6c6f];return _0x517ee5;};'use strict';var _=require('lodash');var util=require(_0xa5a2('0x0'));var moment=require(_0xa5a2('0x1'));var BPromise=require(_0xa5a2('0x2'));var rs=require(_0xa5a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5a2('0x4'))['db'];var utils=require(_0xa5a2('0x5'));var logger=require('../../config/logger')(_0xa5a2('0x6'));var config=require(_0xa5a2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa5a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24432f,_0xfe5336,_0x3d6533){return new BPromise(function(_0x187ffd,_0x3e403b){return client[_0xa5a2('0x9')](_0x24432f,_0x3d6533)[_0xa5a2('0xa')](function(_0x4d2b03){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0xfe5336,_0xa5a2('0xb'));logger[_0xa5a2('0xc')](_0xa5a2('0xd'),_0xfe5336,'request\x20sent',JSON[_0xa5a2('0xe')](_0x4d2b03));if(_0x4d2b03[_0xa5a2('0xf')]){if(_0x4d2b03['error'][_0xa5a2('0x10')]===0x1f4){logger[_0xa5a2('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0xfe5336,_0x4d2b03[_0xa5a2('0xf')][_0xa5a2('0x11')]);return _0x3e403b(_0x4d2b03[_0xa5a2('0xf')][_0xa5a2('0x11')]);}logger[_0xa5a2('0xf')](_0xa5a2('0x12'),_0xfe5336,_0x4d2b03['error']['message']);return _0x187ffd(_0x4d2b03[_0xa5a2('0xf')]['message']);}else{logger[_0xa5a2('0x13')](_0xa5a2('0x12'),_0xfe5336,_0xa5a2('0xb'));_0x187ffd(_0x4d2b03[_0xa5a2('0x14')][_0xa5a2('0x11')]);}})[_0xa5a2('0x15')](function(_0x20a7a5){logger[_0xa5a2('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0xfe5336,_0x20a7a5);_0x3e403b(_0x20a7a5);});});}exports[_0xa5a2('0x16')]=function(_0x39d981){var _0x4d01f0=this;return new Promise(function(_0x4d0d80,_0x35254a){return db[_0xa5a2('0x17')]['create'](_0x39d981[_0xa5a2('0x18')],{'raw':_0x39d981['options']?_0x39d981[_0xa5a2('0x19')][_0xa5a2('0x1a')]===undefined?!![]:![]:!![]})[_0xa5a2('0xa')](function(_0x102a38){logger[_0xa5a2('0x13')]('CreateFaxQueueReport',_0x39d981);logger[_0xa5a2('0xc')](_0xa5a2('0x16'),_0x39d981,JSON[_0xa5a2('0xe')](_0x102a38));_0x4d0d80(_0x102a38);})[_0xa5a2('0x15')](function(_0x537c25){logger['error'](_0xa5a2('0x16'),_0x537c25['message'],_0x39d981);_0x35254a(_0x4d01f0[_0xa5a2('0xf')](0x1f4,_0x537c25[_0xa5a2('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x48b88c){var _0x37402d=this;return new Promise(function(_0x1d56f1,_0x230fd9){return db[_0xa5a2('0x17')][_0xa5a2('0x1b')](_0x48b88c[_0xa5a2('0x18')],{'raw':_0x48b88c[_0xa5a2('0x19')]?_0x48b88c[_0xa5a2('0x19')][_0xa5a2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48b88c['options']?_0x48b88c['options']['where']||null:null,'attributes':_0x48b88c['options']?_0x48b88c['options'][_0xa5a2('0x1c')]||null:null,'limit':_0x48b88c[_0xa5a2('0x19')]?_0x48b88c['options'][_0xa5a2('0x1d')]||null:null})[_0xa5a2('0xa')](function(_0x4869a2){logger[_0xa5a2('0x13')]('UpdateFaxQueueReport',_0x48b88c);logger[_0xa5a2('0xc')](_0xa5a2('0x1e'),_0x48b88c,JSON[_0xa5a2('0xe')](_0x4869a2));_0x1d56f1(_0x4869a2);})[_0xa5a2('0x15')](function(_0xa81f20){logger[_0xa5a2('0xf')]('UpdateFaxQueueReport',_0xa81f20[_0xa5a2('0x11')],_0x48b88c);_0x230fd9(_0x37402d[_0xa5a2('0xf')](0x1f4,_0xa81f20[_0xa5a2('0x11')]));});});}; \ No newline at end of file +var _0xdae4=['../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','debug','stringify','UpdateFaxQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x32c395,_0x1567bf){var _0x4da5d1=function(_0x4a3c3c){while(--_0x4a3c3c){_0x32c395['push'](_0x32c395['shift']());}};_0x4da5d1(++_0x1567bf);}(_0xdae4,0x1e8));var _0x4dae=function(_0x1ea580,_0x33fa1d){_0x1ea580=_0x1ea580-0x0;var _0x16d4c1=_0xdae4[_0x1ea580];return _0x16d4c1;};'use strict';var _=require(_0x4dae('0x0'));var util=require(_0x4dae('0x1'));var moment=require(_0x4dae('0x2'));var BPromise=require(_0x4dae('0x3'));var rs=require(_0x4dae('0x4'));var fs=require('fs');var Redis=require(_0x4dae('0x5'));var db=require(_0x4dae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dae('0x7'))(_0x4dae('0x8'));var config=require('../../config/environment');var jayson=require(_0x4dae('0x9'));var client=jayson['client'][_0x4dae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x104614,_0x2db37d,_0x2c64b5){return new BPromise(function(_0x529394,_0x57ae29){return client[_0x4dae('0xb')](_0x104614,_0x2c64b5)[_0x4dae('0xc')](function(_0x4d1769){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2db37d,_0x4dae('0xd'));logger['debug'](_0x4dae('0xe'),_0x2db37d,_0x4dae('0xd'),JSON['stringify'](_0x4d1769));if(_0x4d1769[_0x4dae('0xf')]){if(_0x4d1769[_0x4dae('0xf')][_0x4dae('0x10')]===0x1f4){logger[_0x4dae('0xf')](_0x4dae('0x11'),_0x2db37d,_0x4d1769[_0x4dae('0xf')][_0x4dae('0x12')]);return _0x57ae29(_0x4d1769[_0x4dae('0xf')][_0x4dae('0x12')]);}logger[_0x4dae('0xf')](_0x4dae('0x11'),_0x2db37d,_0x4d1769['error']['message']);return _0x529394(_0x4d1769['error']['message']);}else{logger[_0x4dae('0x13')](_0x4dae('0x11'),_0x2db37d,_0x4dae('0xd'));_0x529394(_0x4d1769[_0x4dae('0x14')][_0x4dae('0x12')]);}})[_0x4dae('0x15')](function(_0x384324){logger[_0x4dae('0xf')](_0x4dae('0x11'),_0x2db37d,_0x384324);_0x57ae29(_0x384324);});});}exports[_0x4dae('0x16')]=function(_0x38cc72){var _0xf13e91=this;return new Promise(function(_0x3f1fee,_0x25d08e){return db[_0x4dae('0x17')]['create'](_0x38cc72[_0x4dae('0x18')],{'raw':_0x38cc72[_0x4dae('0x19')]?_0x38cc72['options'][_0x4dae('0x1a')]===undefined?!![]:![]:!![]})[_0x4dae('0xc')](function(_0x2fb0c6){logger[_0x4dae('0x13')](_0x4dae('0x16'),_0x38cc72);logger[_0x4dae('0x1b')](_0x4dae('0x16'),_0x38cc72,JSON[_0x4dae('0x1c')](_0x2fb0c6));_0x3f1fee(_0x2fb0c6);})[_0x4dae('0x15')](function(_0x1dfaf8){logger[_0x4dae('0xf')](_0x4dae('0x16'),_0x1dfaf8[_0x4dae('0x12')],_0x38cc72);_0x25d08e(_0xf13e91[_0x4dae('0xf')](0x1f4,_0x1dfaf8[_0x4dae('0x12')]));});});};exports[_0x4dae('0x1d')]=function(_0x3efb39){var _0xf5571b=this;return new Promise(function(_0x435c6c,_0x463610){return db[_0x4dae('0x17')][_0x4dae('0x1e')](_0x3efb39[_0x4dae('0x18')],{'raw':_0x3efb39[_0x4dae('0x19')]?_0x3efb39['options'][_0x4dae('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efb39[_0x4dae('0x19')]?_0x3efb39['options'][_0x4dae('0x1f')]||null:null,'attributes':_0x3efb39[_0x4dae('0x19')]?_0x3efb39[_0x4dae('0x19')]['attributes']||null:null,'limit':_0x3efb39[_0x4dae('0x19')]?_0x3efb39[_0x4dae('0x19')][_0x4dae('0x20')]||null:null})[_0x4dae('0xc')](function(_0x42a2b0){logger[_0x4dae('0x13')](_0x4dae('0x1d'),_0x3efb39);logger[_0x4dae('0x1b')](_0x4dae('0x1d'),_0x3efb39,JSON[_0x4dae('0x1c')](_0x42a2b0));_0x435c6c(_0x42a2b0);})['catch'](function(_0x3c64b4){logger[_0x4dae('0xf')](_0x4dae('0x1d'),_0x3c64b4['message'],_0x3efb39);_0x463610(_0xf5571b[_0x4dae('0xf')](0x1f4,_0x3c64b4[_0x4dae('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 3303530..2da0e8c 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 _0xee6d=['show','post','create','put','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x1d368d,_0x1bc3e3){var _0x3532fa=function(_0x5c790d){while(--_0x5c790d){_0x1d368d['push'](_0x1d368d['shift']());}};_0x3532fa(++_0x1bc3e3);}(_0xee6d,0x1ca));var _0xdee6=function(_0x4ce80d,_0x4a07e8){_0x4ce80d=_0x4ce80d-0x0;var _0x1251ba=_0xee6d[_0x4ce80d];return _0x1251ba;};'use strict';var multer=require('multer');var util=require(_0xdee6('0x0'));var path=require('path');var timeout=require(_0xdee6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdee6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xdee6('0x3'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0xdee6('0x4')](),controller[_0xdee6('0x5')]);router['get'](_0xdee6('0x6'),auth[_0xdee6('0x4')](),controller[_0xdee6('0x7')]);router[_0xdee6('0x8')](_0xdee6('0x9'),auth['isAuthenticated'](),controller[_0xdee6('0xa')]);router[_0xdee6('0xb')]('/',auth['isAuthenticated'](),controller[_0xdee6('0xc')]);router[_0xdee6('0xd')](_0xdee6('0x9'),auth[_0xdee6('0x4')](),controller[_0xdee6('0xe')]);router[_0xdee6('0xf')](_0xdee6('0x9'),auth[_0xdee6('0x4')](),controller[_0xdee6('0x10')]);module[_0xdee6('0x11')]=router; \ No newline at end of file +var _0xf504=['../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x26a855,_0x845170){var _0x301785=function(_0x38d0f6){while(--_0x38d0f6){_0x26a855['push'](_0x26a855['shift']());}};_0x301785(++_0x845170);}(_0xf504,0xa2));var _0x4f50=function(_0x38a8d7,_0x38b43d){_0x38a8d7=_0x38a8d7-0x0;var _0x4b06d6=_0xf504[_0x38a8d7];return _0x4b06d6;};'use strict';var multer=require(_0x4f50('0x0'));var util=require(_0x4f50('0x1'));var path=require(_0x4f50('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4f50('0x3')]();var fs_extra=require(_0x4f50('0x4'));var auth=require(_0x4f50('0x5'));var interaction=require(_0x4f50('0x6'));var config=require(_0x4f50('0x7'));var controller=require(_0x4f50('0x8'));router[_0x4f50('0x9')]('/',auth[_0x4f50('0xa')](),controller['index']);router[_0x4f50('0x9')](_0x4f50('0xb'),auth['isAuthenticated'](),controller[_0x4f50('0xc')]);router['get']('/:id',auth[_0x4f50('0xa')](),controller[_0x4f50('0xd')]);router[_0x4f50('0xe')]('/',auth[_0x4f50('0xa')](),controller[_0x4f50('0xf')]);router[_0x4f50('0x10')](_0x4f50('0x11'),auth[_0x4f50('0xa')](),controller[_0x4f50('0x12')]);router[_0x4f50('0x13')](_0x4f50('0x11'),auth[_0x4f50('0xa')](),controller[_0x4f50('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f667fbd..a146c51 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4205c4,_0x43b89e){var _0x17202c=function(_0x450764){while(--_0x450764){_0x4205c4['push'](_0x4205c4['shift']());}};_0x17202c(++_0x43b89e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x4b84[_0x3b90ab];return _0x206e92;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x52f247,_0x329e5f){var _0x48c78d=function(_0x39e788){while(--_0x39e788){_0x52f247['push'](_0x52f247['shift']());}};_0x48c78d(++_0x329e5f);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c68a994..35ad0b3 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 _0xc466=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf'];(function(_0x5d1eca,_0x19ef13){var _0x4a9fc4=function(_0x48b7e1){while(--_0x48b7e1){_0x5d1eca['push'](_0x5d1eca['shift']());}};_0x4a9fc4(++_0x19ef13);}(_0xc466,0x98));var _0x6c46=function(_0x1c571e,_0x548a78){_0x1c571e=_0x1c571e-0x0;var _0x4c546e=_0xc466[_0x1c571e];return _0x4c546e;};'use strict';var emlformat=require(_0x6c46('0x0'));var rimraf=require(_0x6c46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c46('0x2'));var rp=require('request-promise');var moment=require(_0x6c46('0x3'));var BPromise=require(_0x6c46('0x4'));var Mustache=require(_0x6c46('0x5'));var util=require(_0x6c46('0x6'));var path=require(_0x6c46('0x7'));var sox=require(_0x6c46('0x8'));var csv=require(_0x6c46('0x9'));var ejs=require(_0x6c46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6c46('0xb'));var crypto=require(_0x6c46('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6c46('0xd'));var toCsv=require(_0x6c46('0x9'));var querystring=require(_0x6c46('0xe'));var Papa=require(_0x6c46('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6c46('0x10'));var hardwareService=require(_0x6c46('0x11'));var logger=require(_0x6c46('0x12'))(_0x6c46('0x13'));var utils=require(_0x6c46('0x14'));var config=require(_0x6c46('0x15'));var licenseUtil=require(_0x6c46('0x16'));var db=require(_0x6c46('0x17'))['db'];function respondWithStatusCode(_0x4c5537,_0x32eea2){_0x32eea2=_0x32eea2||0xcc;return function(_0x379a86){if(_0x379a86){return _0x4c5537[_0x6c46('0x18')](_0x32eea2);}return _0x4c5537[_0x6c46('0x19')](_0x32eea2)[_0x6c46('0x1a')]();};}function respondWithResult(_0x5d10fa,_0x13d273){_0x13d273=_0x13d273||0xc8;return function(_0x443349){if(_0x443349){return _0x5d10fa[_0x6c46('0x19')](_0x13d273)[_0x6c46('0x1b')](_0x443349);}};}function respondWithFilteredResult(_0x14574a,_0x3c0b47){return function(_0x372578){if(_0x372578){var _0x4f17fc=typeof _0x3c0b47[_0x6c46('0x1c')]===_0x6c46('0x1d')&&typeof _0x3c0b47['limit']==='undefined';var _0x1ee8f8=_0x372578[_0x6c46('0x1e')];var _0xbeac74=_0x4f17fc?0x0:_0x3c0b47[_0x6c46('0x1c')];var _0x3eccff=_0x4f17fc?_0x372578[_0x6c46('0x1e')]:_0x3c0b47[_0x6c46('0x1c')]+_0x3c0b47[_0x6c46('0x1f')];var _0x4de801;if(_0x3eccff>=_0x1ee8f8){_0x3eccff=_0x1ee8f8;_0x4de801=0xc8;}else{_0x4de801=0xce;}_0x14574a['status'](_0x4de801);return _0x14574a[_0x6c46('0x20')](_0x6c46('0x21'),_0xbeac74+'-'+_0x3eccff+'/'+_0x1ee8f8)['json'](_0x372578);}return null;};}function patchUpdates(_0x3a6542){return function(_0x2477bc){try{jsonpatch[_0x6c46('0x22')](_0x2477bc,_0x3a6542,!![]);}catch(_0x15efd4){return BPromise[_0x6c46('0x23')](_0x15efd4);}return _0x2477bc[_0x6c46('0x24')]();};}function saveUpdates(_0x17e517,_0x22907e){return function(_0x2f58a4){if(_0x2f58a4){return _0x2f58a4[_0x6c46('0x25')](_0x17e517)[_0x6c46('0x26')](function(_0x28eeb7){return _0x28eeb7;});}return null;};}function removeEntity(_0x18cf4e,_0x2999ae){return function(_0x377277){if(_0x377277){return _0x377277[_0x6c46('0x27')]()[_0x6c46('0x26')](function(){_0x18cf4e['status'](0xcc)[_0x6c46('0x1a')]();});}};}function handleEntityNotFound(_0x34da47,_0x5721f4){return function(_0x17d698){if(!_0x17d698){_0x34da47[_0x6c46('0x18')](0x194);}return _0x17d698;};}function handleError(_0x579ead,_0x2045a7){_0x2045a7=_0x2045a7||0x1f4;return function(_0x17ff40){logger['error'](_0x17ff40['stack']);if(_0x17ff40[_0x6c46('0x28')]){delete _0x17ff40[_0x6c46('0x28')];}_0x579ead[_0x6c46('0x19')](_0x2045a7)[_0x6c46('0x29')](_0x17ff40);};}exports[_0x6c46('0x2a')]=function(_0x61b64c,_0x7194ad){var _0xa25849={},_0x582bc8={},_0x48de79={'count':0x0,'rows':[]};var _0x1b784b=_['map'](db[_0x6c46('0x2b')][_0x6c46('0x2c')],function(_0x51c35f){return{'name':_0x51c35f[_0x6c46('0x2d')],'type':_0x51c35f[_0x6c46('0x2e')][_0x6c46('0x2f')]};});_0x582bc8['model']=_[_0x6c46('0x30')](_0x1b784b,_0x6c46('0x28'));_0x582bc8['query']=_['keys'](_0x61b64c[_0x6c46('0x31')]);_0x582bc8[_0x6c46('0x32')]=_['intersection'](_0x582bc8['model'],_0x582bc8['query']);_0xa25849['attributes']=_[_0x6c46('0x33')](_0x582bc8[_0x6c46('0x34')],qs[_0x6c46('0x35')](_0x61b64c[_0x6c46('0x31')]['fields']));_0xa25849['attributes']=_0xa25849[_0x6c46('0x36')][_0x6c46('0x37')]?_0xa25849[_0x6c46('0x36')]:_0x582bc8['model'];if(!_0x61b64c[_0x6c46('0x31')][_0x6c46('0x38')](_0x6c46('0x39'))){_0xa25849['limit']=qs[_0x6c46('0x1f')](_0x61b64c[_0x6c46('0x31')][_0x6c46('0x1f')]);_0xa25849[_0x6c46('0x1c')]=qs[_0x6c46('0x1c')](_0x61b64c[_0x6c46('0x31')][_0x6c46('0x1c')]);}_0xa25849[_0x6c46('0x3a')]=qs[_0x6c46('0x3b')](_0x61b64c[_0x6c46('0x31')]['sort']);_0xa25849['where']=qs[_0x6c46('0x32')](_[_0x6c46('0x3c')](_0x61b64c[_0x6c46('0x31')],_0x582bc8[_0x6c46('0x32')]),_0x1b784b);if(_0x61b64c[_0x6c46('0x31')][_0x6c46('0x3d')]){_0xa25849[_0x6c46('0x3e')]=_['merge'](_0xa25849['where'],{'$or':_[_0x6c46('0x30')](_0x1b784b,function(_0x4076e8){if(_0x4076e8[_0x6c46('0x2e')]!==_0x6c46('0x3f')){var _0x1954c9={};_0x1954c9[_0x4076e8[_0x6c46('0x28')]]={'$like':'%'+_0x61b64c[_0x6c46('0x31')][_0x6c46('0x3d')]+'%'};return _0x1954c9;}})});}_0xa25849=_[_0x6c46('0x40')]({},_0xa25849,_0x61b64c['options']);var _0x88b276={'where':_0xa25849['where']};return db[_0x6c46('0x2b')][_0x6c46('0x1e')](_0x88b276)[_0x6c46('0x26')](function(_0x1dd7ca){_0x48de79[_0x6c46('0x1e')]=_0x1dd7ca;if(_0x61b64c[_0x6c46('0x31')][_0x6c46('0x41')]){_0xa25849['include']=[{'all':!![]}];}return db[_0x6c46('0x2b')][_0x6c46('0x42')](_0xa25849);})[_0x6c46('0x26')](function(_0x42d423){_0x48de79[_0x6c46('0x43')]=_0x42d423;return _0x48de79;})[_0x6c46('0x26')](respondWithFilteredResult(_0x7194ad,_0xa25849))[_0x6c46('0x44')](handleError(_0x7194ad,null));};exports[_0x6c46('0x45')]=function(_0x46c18e,_0x26ff08){var _0x14b124={'raw':!![],'where':{'id':_0x46c18e[_0x6c46('0x46')]['id']}},_0x5352aa={};_0x5352aa['model']=_['keys'](db[_0x6c46('0x2b')][_0x6c46('0x2c')]);_0x5352aa[_0x6c46('0x31')]=_[_0x6c46('0x47')](_0x46c18e['query']);_0x5352aa[_0x6c46('0x32')]=_['intersection'](_0x5352aa['model'],_0x5352aa[_0x6c46('0x31')]);_0x14b124['attributes']=_[_0x6c46('0x33')](_0x5352aa[_0x6c46('0x34')],qs[_0x6c46('0x35')](_0x46c18e[_0x6c46('0x31')]['fields']));_0x14b124[_0x6c46('0x36')]=_0x14b124[_0x6c46('0x36')][_0x6c46('0x37')]?_0x14b124[_0x6c46('0x36')]:_0x5352aa['model'];if(_0x46c18e[_0x6c46('0x31')][_0x6c46('0x41')]){_0x14b124[_0x6c46('0x48')]=[{'all':!![]}];}_0x14b124=_[_0x6c46('0x40')]({},_0x14b124,_0x46c18e['options']);return db[_0x6c46('0x2b')][_0x6c46('0x49')](_0x14b124)['then'](handleEntityNotFound(_0x26ff08,null))[_0x6c46('0x26')](respondWithResult(_0x26ff08,null))[_0x6c46('0x44')](handleError(_0x26ff08,null));};exports[_0x6c46('0x4a')]=function(_0x42d58c,_0x2212ec){return db[_0x6c46('0x2b')]['create'](_0x42d58c[_0x6c46('0x4b')],{})[_0x6c46('0x26')](respondWithResult(_0x2212ec,0xc9))[_0x6c46('0x44')](handleError(_0x2212ec,null));};exports['update']=function(_0x1f25b2,_0x5018a1){if(_0x1f25b2[_0x6c46('0x4b')]['id']){delete _0x1f25b2['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x1f25b2[_0x6c46('0x46')]['id']}})['then'](handleEntityNotFound(_0x5018a1,null))[_0x6c46('0x26')](saveUpdates(_0x1f25b2[_0x6c46('0x4b')],null))[_0x6c46('0x26')](respondWithResult(_0x5018a1,null))[_0x6c46('0x44')](handleError(_0x5018a1,null));};exports[_0x6c46('0x27')]=function(_0x4ae006,_0x475018){return db[_0x6c46('0x2b')][_0x6c46('0x49')]({'where':{'id':_0x4ae006[_0x6c46('0x46')]['id']}})[_0x6c46('0x26')](handleEntityNotFound(_0x475018,null))[_0x6c46('0x26')](removeEntity(_0x475018,null))[_0x6c46('0x44')](handleError(_0x475018,null));};exports['describe']=function(_0xa0ce5d,_0x416a45){return db[_0x6c46('0x2b')][_0x6c46('0x4c')]()[_0x6c46('0x26')](respondWithResult(_0x416a45,null))[_0x6c46('0x44')](handleError(_0x416a45,null));}; \ No newline at end of file +var _0x9419=['order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','stack','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit'];(function(_0x48cb7e,_0x256d03){var _0x2771ef=function(_0xab8e63){while(--_0xab8e63){_0x48cb7e['push'](_0x48cb7e['shift']());}};_0x2771ef(++_0x256d03);}(_0x9419,0xa2));var _0x9941=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x9419[_0x4de586];return _0x46baf5;};'use strict';var emlformat=require(_0x9941('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9941('0x1'));var rp=require(_0x9941('0x2'));var moment=require('moment');var BPromise=require(_0x9941('0x3'));var Mustache=require(_0x9941('0x4'));var util=require(_0x9941('0x5'));var path=require('path');var sox=require(_0x9941('0x6'));var csv=require(_0x9941('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9941('0x8'));var squel=require(_0x9941('0x9'));var crypto=require('crypto');var jsforce=require(_0x9941('0xa'));var deskjs=require(_0x9941('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9941('0xc'));var Papa=require(_0x9941('0xd'));var Redis=require(_0x9941('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9941('0xf'));var as=require(_0x9941('0x10'));var hardwareService=require(_0x9941('0x11'));var logger=require('../../config/logger')(_0x9941('0x12'));var utils=require(_0x9941('0x13'));var config=require(_0x9941('0x14'));var licenseUtil=require(_0x9941('0x15'));var db=require(_0x9941('0x16'))['db'];function respondWithStatusCode(_0x218f1d,_0xd10195){_0xd10195=_0xd10195||0xcc;return function(_0x1c8ec8){if(_0x1c8ec8){return _0x218f1d[_0x9941('0x17')](_0xd10195);}return _0x218f1d['status'](_0xd10195)[_0x9941('0x18')]();};}function respondWithResult(_0x57984b,_0x13fe8d){_0x13fe8d=_0x13fe8d||0xc8;return function(_0x40d687){if(_0x40d687){return _0x57984b[_0x9941('0x19')](_0x13fe8d)[_0x9941('0x1a')](_0x40d687);}};}function respondWithFilteredResult(_0x5a5e4c,_0x3743f5){return function(_0x5b3888){if(_0x5b3888){var _0x45bffe=typeof _0x3743f5[_0x9941('0x1b')]===_0x9941('0x1c')&&typeof _0x3743f5['limit']==='undefined';var _0x425921=_0x5b3888['count'];var _0x5c16a7=_0x45bffe?0x0:_0x3743f5[_0x9941('0x1b')];var _0x5c3586=_0x45bffe?_0x5b3888[_0x9941('0x1d')]:_0x3743f5[_0x9941('0x1b')]+_0x3743f5['limit'];var _0x1745a4;if(_0x5c3586>=_0x425921){_0x5c3586=_0x425921;_0x1745a4=0xc8;}else{_0x1745a4=0xce;}_0x5a5e4c[_0x9941('0x19')](_0x1745a4);return _0x5a5e4c[_0x9941('0x1e')](_0x9941('0x1f'),_0x5c16a7+'-'+_0x5c3586+'/'+_0x425921)[_0x9941('0x1a')](_0x5b3888);}return null;};}function patchUpdates(_0x12d2ff){return function(_0x528a6c){try{jsonpatch[_0x9941('0x20')](_0x528a6c,_0x12d2ff,!![]);}catch(_0x334c0e){return BPromise['reject'](_0x334c0e);}return _0x528a6c['save']();};}function saveUpdates(_0xd78759,_0xa12e29){return function(_0x427978){if(_0x427978){return _0x427978[_0x9941('0x21')](_0xd78759)[_0x9941('0x22')](function(_0x425d8f){return _0x425d8f;});}return null;};}function removeEntity(_0xac6381,_0x168834){return function(_0x174dde){if(_0x174dde){return _0x174dde[_0x9941('0x23')]()[_0x9941('0x22')](function(){_0xac6381[_0x9941('0x19')](0xcc)[_0x9941('0x18')]();});}};}function handleEntityNotFound(_0x522dc6,_0x5dc918){return function(_0xbd33d4){if(!_0xbd33d4){_0x522dc6[_0x9941('0x17')](0x194);}return _0xbd33d4;};}function handleError(_0x4606e1,_0x583e33){_0x583e33=_0x583e33||0x1f4;return function(_0x4a0a39){logger['error'](_0x4a0a39[_0x9941('0x24')]);if(_0x4a0a39['name']){delete _0x4a0a39['name'];}_0x4606e1[_0x9941('0x19')](_0x583e33)['send'](_0x4a0a39);};}exports[_0x9941('0x25')]=function(_0x2ef9cd,_0xc2291d){var _0x3dce02={},_0xd85f50={},_0x1089f7={'count':0x0,'rows':[]};var _0x5796ee=_[_0x9941('0x26')](db[_0x9941('0x27')][_0x9941('0x28')],function(_0x4d58fb){return{'name':_0x4d58fb[_0x9941('0x29')],'type':_0x4d58fb[_0x9941('0x2a')]['key']};});_0xd85f50[_0x9941('0x2b')]=_[_0x9941('0x26')](_0x5796ee,_0x9941('0x2c'));_0xd85f50['query']=_[_0x9941('0x2d')](_0x2ef9cd[_0x9941('0x2e')]);_0xd85f50[_0x9941('0x2f')]=_[_0x9941('0x30')](_0xd85f50['model'],_0xd85f50['query']);_0x3dce02[_0x9941('0x31')]=_[_0x9941('0x30')](_0xd85f50[_0x9941('0x2b')],qs['fields'](_0x2ef9cd[_0x9941('0x2e')][_0x9941('0x32')]));_0x3dce02['attributes']=_0x3dce02[_0x9941('0x31')][_0x9941('0x33')]?_0x3dce02[_0x9941('0x31')]:_0xd85f50[_0x9941('0x2b')];if(!_0x2ef9cd['query'][_0x9941('0x34')]('nolimit')){_0x3dce02[_0x9941('0x35')]=qs[_0x9941('0x35')](_0x2ef9cd['query'][_0x9941('0x35')]);_0x3dce02[_0x9941('0x1b')]=qs[_0x9941('0x1b')](_0x2ef9cd[_0x9941('0x2e')][_0x9941('0x1b')]);}_0x3dce02[_0x9941('0x36')]=qs[_0x9941('0x37')](_0x2ef9cd[_0x9941('0x2e')]['sort']);_0x3dce02[_0x9941('0x38')]=qs[_0x9941('0x2f')](_['pick'](_0x2ef9cd[_0x9941('0x2e')],_0xd85f50[_0x9941('0x2f')]),_0x5796ee);if(_0x2ef9cd[_0x9941('0x2e')][_0x9941('0x39')]){_0x3dce02['where']=_[_0x9941('0x3a')](_0x3dce02['where'],{'$or':_['map'](_0x5796ee,function(_0x18e1bc){if(_0x18e1bc[_0x9941('0x2a')]!==_0x9941('0x3b')){var _0xe4d9b8={};_0xe4d9b8[_0x18e1bc[_0x9941('0x2c')]]={'$like':'%'+_0x2ef9cd[_0x9941('0x2e')][_0x9941('0x39')]+'%'};return _0xe4d9b8;}})});}_0x3dce02=_[_0x9941('0x3a')]({},_0x3dce02,_0x2ef9cd['options']);var _0x2b7aea={'where':_0x3dce02[_0x9941('0x38')]};return db['FaxTransferReport'][_0x9941('0x1d')](_0x2b7aea)['then'](function(_0x3e97df){_0x1089f7[_0x9941('0x1d')]=_0x3e97df;if(_0x2ef9cd['query'][_0x9941('0x3c')]){_0x3dce02[_0x9941('0x3d')]=[{'all':!![]}];}return db[_0x9941('0x27')][_0x9941('0x3e')](_0x3dce02);})[_0x9941('0x22')](function(_0xfc7f88){_0x1089f7[_0x9941('0x3f')]=_0xfc7f88;return _0x1089f7;})['then'](respondWithFilteredResult(_0xc2291d,_0x3dce02))['catch'](handleError(_0xc2291d,null));};exports[_0x9941('0x40')]=function(_0x126f7c,_0x1f6137){var _0x7c215b={'raw':!![],'where':{'id':_0x126f7c['params']['id']}},_0x4d566c={};_0x4d566c[_0x9941('0x2b')]=_[_0x9941('0x2d')](db[_0x9941('0x27')][_0x9941('0x28')]);_0x4d566c[_0x9941('0x2e')]=_[_0x9941('0x2d')](_0x126f7c[_0x9941('0x2e')]);_0x4d566c[_0x9941('0x2f')]=_['intersection'](_0x4d566c[_0x9941('0x2b')],_0x4d566c[_0x9941('0x2e')]);_0x7c215b['attributes']=_['intersection'](_0x4d566c[_0x9941('0x2b')],qs[_0x9941('0x32')](_0x126f7c[_0x9941('0x2e')][_0x9941('0x32')]));_0x7c215b[_0x9941('0x31')]=_0x7c215b[_0x9941('0x31')][_0x9941('0x33')]?_0x7c215b['attributes']:_0x4d566c['model'];if(_0x126f7c[_0x9941('0x2e')][_0x9941('0x3c')]){_0x7c215b[_0x9941('0x3d')]=[{'all':!![]}];}_0x7c215b=_[_0x9941('0x3a')]({},_0x7c215b,_0x126f7c[_0x9941('0x41')]);return db['FaxTransferReport'][_0x9941('0x42')](_0x7c215b)[_0x9941('0x22')](handleEntityNotFound(_0x1f6137,null))[_0x9941('0x22')](respondWithResult(_0x1f6137,null))[_0x9941('0x43')](handleError(_0x1f6137,null));};exports[_0x9941('0x44')]=function(_0x55748e,_0x2de5fe){return db['FaxTransferReport']['create'](_0x55748e[_0x9941('0x45')],{})[_0x9941('0x22')](respondWithResult(_0x2de5fe,0xc9))[_0x9941('0x43')](handleError(_0x2de5fe,null));};exports[_0x9941('0x21')]=function(_0xe320f,_0x2f3883){if(_0xe320f[_0x9941('0x45')]['id']){delete _0xe320f[_0x9941('0x45')]['id'];}return db[_0x9941('0x27')][_0x9941('0x42')]({'where':{'id':_0xe320f[_0x9941('0x46')]['id']}})[_0x9941('0x22')](handleEntityNotFound(_0x2f3883,null))[_0x9941('0x22')](saveUpdates(_0xe320f['body'],null))[_0x9941('0x22')](respondWithResult(_0x2f3883,null))['catch'](handleError(_0x2f3883,null));};exports['destroy']=function(_0x154fd2,_0x327494){return db['FaxTransferReport']['find']({'where':{'id':_0x154fd2['params']['id']}})[_0x9941('0x22')](handleEntityNotFound(_0x327494,null))[_0x9941('0x22')](removeEntity(_0x327494,null))['catch'](handleError(_0x327494,null));};exports[_0x9941('0x47')]=function(_0x4c8aee,_0x49d83b){return db[_0x9941('0x27')][_0x9941('0x47')]()['then'](respondWithResult(_0x49d83b,null))[_0x9941('0x43')](handleError(_0x49d83b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index f5d4f7d..2109031 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 _0x3753=['uniqueid','lodash','../../config/logger','api','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x42d7f4,_0x5e9ae8){var _0x49e630=function(_0x345ea1){while(--_0x345ea1){_0x42d7f4['push'](_0x42d7f4['shift']());}};_0x49e630(++_0x5e9ae8);}(_0x3753,0x6d));var _0x3375=function(_0x2ad921,_0x3ec1d1){_0x2ad921=_0x2ad921-0x0;var _0x419042=_0x3753[_0x2ad921];return _0x419042;};'use strict';var _=require(_0x3375('0x0'));var util=require('util');var logger=require(_0x3375('0x1'))(_0x3375('0x2'));var moment=require('moment');var BPromise=require(_0x3375('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3375('0x4'));var rimraf=require('rimraf');var config=require(_0x3375('0x5'));var attributes=require(_0x3375('0x6'));module[_0x3375('0x7')]=function(_0x3a4bff,_0xced98c){return _0x3a4bff[_0x3375('0x8')](_0x3375('0x9'),attributes,{'tableName':_0x3375('0xa'),'paranoid':![],'indexes':[{'name':_0x3375('0xb'),'fields':[_0x3375('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c5f=['exports','define','FaxTransferReport','report_fax_transfer','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x1fd662,_0x2d6d12){var _0x385597=function(_0x10181f){while(--_0x10181f){_0x1fd662['push'](_0x1fd662['shift']());}};_0x385597(++_0x2d6d12);}(_0x3c5f,0x149));var _0xf3c5=function(_0x2d2886,_0x134a6e){_0x2d2886=_0x2d2886-0x0;var _0x559185=_0x3c5f[_0x2d2886];return _0x559185;};'use strict';var _=require('lodash');var util=require(_0xf3c5('0x0'));var logger=require(_0xf3c5('0x1'))('api');var moment=require(_0xf3c5('0x2'));var BPromise=require(_0xf3c5('0x3'));var rp=require(_0xf3c5('0x4'));var fs=require('fs');var path=require(_0xf3c5('0x5'));var rimraf=require(_0xf3c5('0x6'));var config=require(_0xf3c5('0x7'));var attributes=require(_0xf3c5('0x8'));module[_0xf3c5('0x9')]=function(_0x14c7a1,_0x27b81e){return _0x14c7a1[_0xf3c5('0xa')](_0xf3c5('0xb'),attributes,{'tableName':_0xf3c5('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 756b77d..5273071 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 _0xbd0f=['message','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e7301,_0x44a2f0){var _0x25ecec=function(_0x44f285){while(--_0x44f285){_0x3e7301['push'](_0x3e7301['shift']());}};_0x25ecec(++_0x44a2f0);}(_0xbd0f,0xca));var _0xfbd0=function(_0x38c4e2,_0x4b0fd3){_0x38c4e2=_0x38c4e2-0x0;var _0x56d329=_0xbd0f[_0x38c4e2];return _0x56d329;};'use strict';var _=require('lodash');var util=require(_0xfbd0('0x0'));var moment=require(_0xfbd0('0x1'));var BPromise=require(_0xfbd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfbd0('0x3'));var logger=require(_0xfbd0('0x4'))(_0xfbd0('0x5'));var config=require('../../config/environment');var jayson=require(_0xfbd0('0x6'));var client=jayson['client'][_0xfbd0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x225c39,_0x567b28,_0x333d01){return new BPromise(function(_0xd0851f,_0x3c5bfb){return client[_0xfbd0('0x8')](_0x225c39,_0x333d01)[_0xfbd0('0x9')](function(_0x5c51a1){logger[_0xfbd0('0xa')](_0xfbd0('0xb'),_0x567b28,_0xfbd0('0xc'));logger[_0xfbd0('0xd')](_0xfbd0('0xe'),_0x567b28,'request\x20sent',JSON[_0xfbd0('0xf')](_0x5c51a1));if(_0x5c51a1[_0xfbd0('0x10')]){if(_0x5c51a1[_0xfbd0('0x10')][_0xfbd0('0x11')]===0x1f4){logger['error'](_0xfbd0('0xb'),_0x567b28,_0x5c51a1['error']['message']);return _0x3c5bfb(_0x5c51a1[_0xfbd0('0x10')][_0xfbd0('0x12')]);}logger[_0xfbd0('0x10')](_0xfbd0('0xb'),_0x567b28,_0x5c51a1['error']['message']);return _0xd0851f(_0x5c51a1[_0xfbd0('0x10')][_0xfbd0('0x12')]);}else{logger[_0xfbd0('0xa')](_0xfbd0('0xb'),_0x567b28,_0xfbd0('0xc'));_0xd0851f(_0x5c51a1['result'][_0xfbd0('0x12')]);}})[_0xfbd0('0x13')](function(_0x9799d1){logger['error'](_0xfbd0('0xb'),_0x567b28,_0x9799d1);_0x3c5bfb(_0x9799d1);});});} \ No newline at end of file +var _0xea33=['rpc','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xc28702,_0x145b87){var _0x3b6e9e=function(_0xfac0c1){while(--_0xfac0c1){_0xc28702['push'](_0xc28702['shift']());}};_0x3b6e9e(++_0x145b87);}(_0xea33,0xa9));var _0x3ea3=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xea33[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x3ea3('0x0'));var util=require(_0x3ea3('0x1'));var moment=require(_0x3ea3('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ea3('0x3'));var fs=require('fs');var Redis=require(_0x3ea3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ea3('0x5'));var logger=require(_0x3ea3('0x6'))(_0x3ea3('0x7'));var config=require(_0x3ea3('0x8'));var jayson=require(_0x3ea3('0x9'));var client=jayson[_0x3ea3('0xa')][_0x3ea3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x347d79,_0x255fe7,_0x24e066){return new BPromise(function(_0x2fce48,_0x1e12a7){return client['request'](_0x347d79,_0x24e066)[_0x3ea3('0xc')](function(_0x344520){logger[_0x3ea3('0xd')](_0x3ea3('0xe'),_0x255fe7,_0x3ea3('0xf'));logger[_0x3ea3('0x10')](_0x3ea3('0x11'),_0x255fe7,_0x3ea3('0xf'),JSON['stringify'](_0x344520));if(_0x344520[_0x3ea3('0x12')]){if(_0x344520[_0x3ea3('0x12')][_0x3ea3('0x13')]===0x1f4){logger['error'](_0x3ea3('0xe'),_0x255fe7,_0x344520[_0x3ea3('0x12')][_0x3ea3('0x14')]);return _0x1e12a7(_0x344520[_0x3ea3('0x12')][_0x3ea3('0x14')]);}logger['error'](_0x3ea3('0xe'),_0x255fe7,_0x344520['error'][_0x3ea3('0x14')]);return _0x2fce48(_0x344520[_0x3ea3('0x12')]['message']);}else{logger['info'](_0x3ea3('0xe'),_0x255fe7,_0x3ea3('0xf'));_0x2fce48(_0x344520['result']['message']);}})[_0x3ea3('0x15')](function(_0x214a3c){logger[_0x3ea3('0x12')](_0x3ea3('0xe'),_0x255fe7,_0x214a3c);_0x1e12a7(_0x214a3c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8a876cf..e2bc1aa 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 _0xb946=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0xe5e7d3,_0x3e2a69){var _0x34f913=function(_0x5d9cc3){while(--_0x5d9cc3){_0xe5e7d3['push'](_0xe5e7d3['shift']());}};_0x34f913(++_0x3e2a69);}(_0xb946,0x1b3));var _0x6b94=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb946[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x6b94('0x0'));var util=require(_0x6b94('0x1'));var path=require(_0x6b94('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b94('0x3'));var router=express[_0x6b94('0x4')]();var fs_extra=require(_0x6b94('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6b94('0x6'));var config=require(_0x6b94('0x7'));var controller=require('./faxTransferReport.controller');router[_0x6b94('0x8')]('/',auth[_0x6b94('0x9')](),controller[_0x6b94('0xa')]);router[_0x6b94('0x8')](_0x6b94('0xb'),auth[_0x6b94('0x9')](),controller[_0x6b94('0xc')]);router[_0x6b94('0x8')](_0x6b94('0xd'),auth[_0x6b94('0x9')](),controller[_0x6b94('0xe')]);router[_0x6b94('0xf')]('/',auth['isAuthenticated'](),controller[_0x6b94('0x10')]);router['put'](_0x6b94('0xd'),auth[_0x6b94('0x9')](),controller[_0x6b94('0x11')]);router[_0x6b94('0x12')](_0x6b94('0xd'),auth[_0x6b94('0x9')](),controller[_0x6b94('0x13')]);module[_0x6b94('0x14')]=router; \ No newline at end of file +var _0x7dd6=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x3ce6c1,_0x3ab7a7){var _0xecc97d=function(_0x4d06d7){while(--_0x4d06d7){_0x3ce6c1['push'](_0x3ce6c1['shift']());}};_0xecc97d(++_0x3ab7a7);}(_0x7dd6,0x17c));var _0x67dd=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x7dd6[_0x25e109];return _0xc0f7d6;};'use strict';var multer=require(_0x67dd('0x0'));var util=require('util');var path=require(_0x67dd('0x1'));var timeout=require(_0x67dd('0x2'));var express=require(_0x67dd('0x3'));var router=express[_0x67dd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x67dd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x67dd('0x6'));var controller=require(_0x67dd('0x7'));router['get']('/',auth[_0x67dd('0x8')](),controller[_0x67dd('0x9')]);router[_0x67dd('0xa')](_0x67dd('0xb'),auth[_0x67dd('0x8')](),controller[_0x67dd('0xc')]);router['get'](_0x67dd('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x67dd('0xe')]('/',auth[_0x67dd('0x8')](),controller[_0x67dd('0xf')]);router[_0x67dd('0x10')](_0x67dd('0xd'),auth['isAuthenticated'](),controller[_0x67dd('0x11')]);router['delete'](_0x67dd('0xd'),auth[_0x67dd('0x8')](),controller[_0x67dd('0x12')]);module[_0x67dd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 10c6217..655cf7f 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 _0xe391=['./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xe391,0x156));var _0x1e39=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe391[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0x1e39('0x0'));var util=require(_0x1e39('0x1'));var path=require(_0x1e39('0x2'));var timeout=require(_0x1e39('0x3'));var express=require(_0x1e39('0x4'));var router=express['Router']();var fs_extra=require(_0x1e39('0x5'));var auth=require(_0x1e39('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e39('0x7'));var controller=require(_0x1e39('0x8'));router[_0x1e39('0x9')]('/',auth[_0x1e39('0xa')](),controller[_0x1e39('0xb')]);router['get']('/:id',auth[_0x1e39('0xa')](),controller[_0x1e39('0xc')]);router[_0x1e39('0x9')](_0x1e39('0xd'),auth[_0x1e39('0xa')](),controller[_0x1e39('0xe')]);router[_0x1e39('0x9')](_0x1e39('0xf'),auth['isAuthenticated'](),controller[_0x1e39('0x10')]);router[_0x1e39('0x11')]('/',auth[_0x1e39('0xa')](),controller[_0x1e39('0x12')]);router[_0x1e39('0x11')](_0x1e39('0xd'),auth['isAuthenticated'](),controller[_0x1e39('0x13')]);router[_0x1e39('0x14')](_0x1e39('0x15'),auth[_0x1e39('0xa')](),controller[_0x1e39('0x16')]);router['delete'](_0x1e39('0x15'),auth[_0x1e39('0xa')](),controller[_0x1e39('0x17')]);module[_0x1e39('0x18')]=router; \ No newline at end of file +var _0xdb01=['isAuthenticated','index','/:id','get','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','destroy','exports','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x5c66cf,_0x8fd541){var _0x4ad777=function(_0xc2b68b){while(--_0xc2b68b){_0x5c66cf['push'](_0x5c66cf['shift']());}};_0x4ad777(++_0x8fd541);}(_0xdb01,0x1ab));var _0x1db0=function(_0x112db5,_0x38a06d){_0x112db5=_0x112db5-0x0;var _0x1d7d06=_0xdb01[_0x112db5];return _0x1d7d06;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1db0('0x0'));var express=require(_0x1db0('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1db0('0x2'));var config=require(_0x1db0('0x3'));var controller=require(_0x1db0('0x4'));router['get']('/',auth[_0x1db0('0x5')](),controller[_0x1db0('0x6')]);router['get'](_0x1db0('0x7'),auth[_0x1db0('0x5')](),controller['show']);router[_0x1db0('0x8')]('/:id/configurations',auth[_0x1db0('0x5')](),controller[_0x1db0('0x9')]);router[_0x1db0('0x8')](_0x1db0('0xa'),auth[_0x1db0('0x5')](),controller[_0x1db0('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1db0('0xc')]);router[_0x1db0('0xd')](_0x1db0('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1db0('0xf')](_0x1db0('0x7'),auth[_0x1db0('0x5')](),controller['update']);router['delete'](_0x1db0('0x7'),auth['isAuthenticated'](),controller[_0x1db0('0x10')]);module[_0x1db0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 9c325f2..3b5cb65 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 _0x197b=['ENUM','basic','sequelize','STRING'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x197b,0xfa));var _0xb197=function(_0x29ffd3,_0x16289b){_0x29ffd3=_0x29ffd3-0x0;var _0x2c2a06=_0x197b[_0x29ffd3];return _0x2c2a06;};'use strict';var Sequelize=require(_0xb197('0x0'));module['exports']={'name':{'type':Sequelize[_0xb197('0x1')]},'description':{'type':Sequelize[_0xb197('0x1')]},'username':{'type':Sequelize[_0xb197('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xb197('0x2')](_0xb197('0x3')),'defaultValue':_0xb197('0x3')},'password':{'type':Sequelize[_0xb197('0x1')]},'consumerKey':{'type':Sequelize[_0xb197('0x1')]},'consumerSecret':{'type':Sequelize[_0xb197('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xb197('0x1')]},'serverUrl':{'type':Sequelize[_0xb197('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb197('0x2')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xad8d=['STRING','ENUM','basic','integrationTab','sequelize','exports'];(function(_0x3917a8,_0xa82e69){var _0x3f14ae=function(_0x140842){while(--_0x140842){_0x3917a8['push'](_0x3917a8['shift']());}};_0x3f14ae(++_0xa82e69);}(_0xad8d,0x172));var _0xdad8=function(_0x46bf45,_0x201aaf){_0x46bf45=_0x46bf45-0x0;var _0x10cdc3=_0xad8d[_0x46bf45];return _0x10cdc3;};'use strict';var Sequelize=require(_0xdad8('0x0'));module[_0xdad8('0x1')]={'name':{'type':Sequelize[_0xdad8('0x2')]},'description':{'type':Sequelize[_0xdad8('0x2')]},'username':{'type':Sequelize[_0xdad8('0x2')]},'remoteUri':{'type':Sequelize[_0xdad8('0x2')]},'authType':{'type':Sequelize[_0xdad8('0x3')]('basic'),'defaultValue':_0xdad8('0x4')},'password':{'type':Sequelize[_0xdad8('0x2')]},'consumerKey':{'type':Sequelize[_0xdad8('0x2')]},'consumerSecret':{'type':Sequelize[_0xdad8('0x2')]},'token':{'type':Sequelize[_0xdad8('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdad8('0x3')](_0xdad8('0x5'),'newTab'),'defaultValue':_0xdad8('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index ee8aaaa..768da68 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 _0x0ed6=['params','intersection','find','create','update','body','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','username','password','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','basic','Authorization','format','%s:%s','toString','base64','concat','_embedded','entries','label','test','getFields','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','limit','undefined','count','offset','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x2812c5,_0x124b54){var _0x4a99a1=function(_0x9116e2){while(--_0x9116e2){_0x2812c5['push'](_0x2812c5['shift']());}};_0x4a99a1(++_0x124b54);}(_0x0ed6,0x1d4));var _0x60ed=function(_0x21ea6f,_0x4416ad){_0x21ea6f=_0x21ea6f-0x0;var _0x30b29b=_0x0ed6[_0x21ea6f];return _0x30b29b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x60ed('0x0'));var jsonpatch=require(_0x60ed('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x60ed('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x60ed('0x3'));var sox=require('sox');var csv=require(_0x60ed('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60ed('0x5'));var _=require(_0x60ed('0x6'));var squel=require(_0x60ed('0x7'));var crypto=require(_0x60ed('0x8'));var jsforce=require(_0x60ed('0x9'));var deskjs=require(_0x60ed('0xa'));var toCsv=require('to-csv');var querystring=require(_0x60ed('0xb'));var Papa=require(_0x60ed('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x60ed('0xd'));var hardwareService=require(_0x60ed('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x60ed('0xf'));var config=require(_0x60ed('0x10'));var licenseUtil=require(_0x60ed('0x11'));var db=require(_0x60ed('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x34ee9f,_0x522327){_0x522327=_0x522327||0xcc;return function(_0x3f9831){if(_0x3f9831){return _0x34ee9f['sendStatus'](_0x522327);}return _0x34ee9f['status'](_0x522327)[_0x60ed('0x13')]();};}function respondWithResult(_0x1255a9,_0x5f24b6){_0x5f24b6=_0x5f24b6||0xc8;return function(_0x170f58){if(_0x170f58){return _0x1255a9[_0x60ed('0x14')](_0x5f24b6)[_0x60ed('0x15')](_0x170f58);}};}function respondWithFilteredResult(_0x3e8942,_0x38ebb5){return function(_0x26f08e){if(_0x26f08e){var _0x3032a8=typeof _0x38ebb5['offset']==='undefined'&&typeof _0x38ebb5[_0x60ed('0x16')]===_0x60ed('0x17');var _0x1f69aa=_0x26f08e[_0x60ed('0x18')];var _0x585a86=_0x3032a8?0x0:_0x38ebb5['offset'];var _0x4aa3d3=_0x3032a8?_0x26f08e[_0x60ed('0x18')]:_0x38ebb5[_0x60ed('0x19')]+_0x38ebb5['limit'];var _0x211afd;if(_0x4aa3d3>=_0x1f69aa){_0x4aa3d3=_0x1f69aa;_0x211afd=0xc8;}else{_0x211afd=0xce;}_0x3e8942[_0x60ed('0x14')](_0x211afd);return _0x3e8942['set']('Content-Range',_0x585a86+'-'+_0x4aa3d3+'/'+_0x1f69aa)[_0x60ed('0x15')](_0x26f08e);}return null;};}function patchUpdates(_0x5d2928){return function(_0x5ac76d){try{jsonpatch[_0x60ed('0x1a')](_0x5ac76d,_0x5d2928,!![]);}catch(_0x151993){return BPromise[_0x60ed('0x1b')](_0x151993);}return _0x5ac76d['save']();};}function saveUpdates(_0x5371f5,_0x1ccda6){return function(_0x419e60){if(_0x419e60){return _0x419e60['update'](_0x5371f5)[_0x60ed('0x1c')](function(_0x30af8d){return _0x30af8d;});}return null;};}function removeEntity(_0x15aacb,_0x1e9009){return function(_0x26606d){if(_0x26606d){return _0x26606d[_0x60ed('0x1d')]()[_0x60ed('0x1c')](function(){_0x15aacb[_0x60ed('0x14')](0xcc)[_0x60ed('0x13')]();});}};}function handleEntityNotFound(_0x4ab71b,_0x285eab){return function(_0x5c9ce4){if(!_0x5c9ce4){_0x4ab71b[_0x60ed('0x1e')](0x194);}return _0x5c9ce4;};}function handleError(_0xd153c,_0x1a7834){_0x1a7834=_0x1a7834||0x1f4;return function(_0x5b0916){logger[_0x60ed('0x1f')](_0x5b0916[_0x60ed('0x20')]);if(_0x5b0916[_0x60ed('0x21')]){delete _0x5b0916['name'];}_0xd153c[_0x60ed('0x14')](_0x1a7834)[_0x60ed('0x22')](_0x5b0916);};}exports['index']=function(_0x3199ef,_0x3232c8){var _0x35299e={},_0xfde300={},_0x4ead6e={'count':0x0,'rows':[]};var _0x596f6e=_[_0x60ed('0x23')](db[_0x60ed('0x24')][_0x60ed('0x25')],function(_0x216f39){return{'name':_0x216f39[_0x60ed('0x26')],'type':_0x216f39[_0x60ed('0x27')][_0x60ed('0x28')]};});_0xfde300[_0x60ed('0x29')]=_[_0x60ed('0x23')](_0x596f6e,_0x60ed('0x21'));_0xfde300[_0x60ed('0x2a')]=_[_0x60ed('0x2b')](_0x3199ef[_0x60ed('0x2a')]);_0xfde300[_0x60ed('0x2c')]=_['intersection'](_0xfde300[_0x60ed('0x29')],_0xfde300[_0x60ed('0x2a')]);_0x35299e['attributes']=_['intersection'](_0xfde300['model'],qs[_0x60ed('0x2d')](_0x3199ef['query'][_0x60ed('0x2d')]));_0x35299e[_0x60ed('0x2e')]=_0x35299e[_0x60ed('0x2e')][_0x60ed('0x2f')]?_0x35299e[_0x60ed('0x2e')]:_0xfde300[_0x60ed('0x29')];if(!_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x30')]('nolimit')){_0x35299e[_0x60ed('0x16')]=qs[_0x60ed('0x16')](_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x16')]);_0x35299e[_0x60ed('0x19')]=qs[_0x60ed('0x19')](_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x19')]);}_0x35299e['order']=qs[_0x60ed('0x31')](_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x31')]);_0x35299e[_0x60ed('0x32')]=qs[_0x60ed('0x2c')](_[_0x60ed('0x33')](_0x3199ef['query'],_0xfde300[_0x60ed('0x2c')]),_0x596f6e);if(_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x34')]){_0x35299e[_0x60ed('0x32')]=_[_0x60ed('0x35')](_0x35299e[_0x60ed('0x32')],{'$or':_[_0x60ed('0x23')](_0x596f6e,function(_0x2b160b){if(_0x2b160b[_0x60ed('0x27')]!==_0x60ed('0x36')){var _0x11a2ab={};_0x11a2ab[_0x2b160b[_0x60ed('0x21')]]={'$like':'%'+_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x34')]+'%'};return _0x11a2ab;}})});}_0x35299e=_['merge']({},_0x35299e,_0x3199ef[_0x60ed('0x37')]);var _0x38048e={'where':_0x35299e['where']};return db[_0x60ed('0x24')][_0x60ed('0x18')](_0x38048e)[_0x60ed('0x1c')](function(_0x3462c8){_0x4ead6e[_0x60ed('0x18')]=_0x3462c8;if(_0x3199ef[_0x60ed('0x2a')][_0x60ed('0x38')]){_0x35299e[_0x60ed('0x39')]=[{'all':!![]}];}return db['DeskAccount'][_0x60ed('0x3a')](_0x35299e);})['then'](function(_0x3388c9){_0x4ead6e[_0x60ed('0x3b')]=_0x3388c9;return _0x4ead6e;})[_0x60ed('0x1c')](respondWithFilteredResult(_0x3232c8,_0x35299e))[_0x60ed('0x3c')](handleError(_0x3232c8,null));};exports[_0x60ed('0x3d')]=function(_0x393c66,_0x487374){var _0x20ac59={'raw':![],'where':{'id':_0x393c66[_0x60ed('0x3e')]['id']}},_0x46d73a={};_0x46d73a['model']=_[_0x60ed('0x2b')](db['DeskAccount'][_0x60ed('0x25')]);_0x46d73a['query']=_[_0x60ed('0x2b')](_0x393c66['query']);_0x46d73a[_0x60ed('0x2c')]=_[_0x60ed('0x3f')](_0x46d73a[_0x60ed('0x29')],_0x46d73a[_0x60ed('0x2a')]);_0x20ac59['attributes']=_[_0x60ed('0x3f')](_0x46d73a[_0x60ed('0x29')],qs['fields'](_0x393c66[_0x60ed('0x2a')][_0x60ed('0x2d')]));_0x20ac59[_0x60ed('0x2e')]=_0x20ac59[_0x60ed('0x2e')][_0x60ed('0x2f')]?_0x20ac59[_0x60ed('0x2e')]:_0x46d73a[_0x60ed('0x29')];if(_0x393c66[_0x60ed('0x2a')][_0x60ed('0x38')]){_0x20ac59[_0x60ed('0x39')]=[{'all':!![]}];}_0x20ac59=_['merge']({},_0x20ac59,_0x393c66[_0x60ed('0x37')]);return db[_0x60ed('0x24')][_0x60ed('0x40')](_0x20ac59)[_0x60ed('0x1c')](handleEntityNotFound(_0x487374,null))[_0x60ed('0x1c')](respondWithResult(_0x487374,null))['catch'](handleError(_0x487374,null));};exports['create']=function(_0x4bb53c,_0x5838dc){return db[_0x60ed('0x24')][_0x60ed('0x41')](_0x4bb53c['body'],{})['then'](respondWithResult(_0x5838dc,0xc9))[_0x60ed('0x3c')](handleError(_0x5838dc,null));};exports[_0x60ed('0x42')]=function(_0x5b4cf5,_0xd4de5d){if(_0x5b4cf5[_0x60ed('0x43')]['id']){delete _0x5b4cf5['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x5b4cf5['params']['id']}})[_0x60ed('0x1c')](handleEntityNotFound(_0xd4de5d,null))[_0x60ed('0x1c')](saveUpdates(_0x5b4cf5[_0x60ed('0x43')],null))[_0x60ed('0x1c')](respondWithResult(_0xd4de5d,null))['catch'](handleError(_0xd4de5d,null));};exports[_0x60ed('0x1d')]=function(_0x271746,_0x47ce0e){return db[_0x60ed('0x24')]['find']({'where':{'id':_0x271746[_0x60ed('0x3e')]['id']}})[_0x60ed('0x1c')](handleEntityNotFound(_0x47ce0e,null))[_0x60ed('0x1c')](removeEntity(_0x47ce0e,null))['catch'](handleError(_0x47ce0e,null));};exports[_0x60ed('0x44')]=function(_0x73a479,_0x48670d,_0x32825d){var _0x8b3787={};var _0x3f15fb={};var _0x2e134e;var _0x20ea23;return db[_0x60ed('0x24')][_0x60ed('0x45')]({'where':{'id':_0x73a479[_0x60ed('0x3e')]['id']}})['then'](handleEntityNotFound(_0x48670d,null))[_0x60ed('0x1c')](function(_0x44b56d){if(_0x44b56d){_0x2e134e=_0x44b56d;_0x3f15fb[_0x60ed('0x29')]=_[_0x60ed('0x2b')](db[_0x60ed('0x46')][_0x60ed('0x25')]);_0x3f15fb['query']=_[_0x60ed('0x2b')](_0x73a479[_0x60ed('0x2a')]);_0x3f15fb[_0x60ed('0x2c')]=_[_0x60ed('0x3f')](_0x3f15fb[_0x60ed('0x29')],_0x3f15fb[_0x60ed('0x2a')]);_0x8b3787[_0x60ed('0x2e')]=_[_0x60ed('0x3f')](_0x3f15fb[_0x60ed('0x29')],qs[_0x60ed('0x2d')](_0x73a479[_0x60ed('0x2a')][_0x60ed('0x2d')]));_0x8b3787[_0x60ed('0x2e')]=_0x8b3787[_0x60ed('0x2e')]['length']?_0x8b3787[_0x60ed('0x2e')]:_0x3f15fb[_0x60ed('0x29')];_0x8b3787['order']=qs[_0x60ed('0x31')](_0x73a479['query'][_0x60ed('0x31')]);_0x8b3787[_0x60ed('0x32')]=qs[_0x60ed('0x2c')](_['pick'](_0x73a479[_0x60ed('0x2a')],_0x3f15fb[_0x60ed('0x2c')]));if(_0x73a479['query'][_0x60ed('0x34')]){_0x8b3787['where']=_[_0x60ed('0x35')](_0x8b3787['where'],{'$or':_['map'](_0x8b3787[_0x60ed('0x2e')],function(_0x5ebd2b){var _0x25b18f={};_0x25b18f[_0x5ebd2b]={'$like':'%'+_0x73a479[_0x60ed('0x2a')][_0x60ed('0x34')]+'%'};return _0x25b18f;})});}_0x8b3787=_[_0x60ed('0x35')]({},_0x8b3787,_0x73a479['options']);return _0x2e134e[_0x60ed('0x44')](_0x8b3787);}})['then'](function(_0x22f1fd){if(_0x22f1fd){_0x20ea23=_0x22f1fd[_0x60ed('0x2f')];if(!_0x73a479['query']['hasOwnProperty'](_0x60ed('0x47'))){_0x8b3787[_0x60ed('0x16')]=qs[_0x60ed('0x16')](_0x73a479['query']['limit']);_0x8b3787[_0x60ed('0x19')]=qs[_0x60ed('0x19')](_0x73a479['query'][_0x60ed('0x19')]);}return _0x2e134e[_0x60ed('0x44')](_0x8b3787);}})[_0x60ed('0x1c')](function(_0x3f0c05){if(_0x3f0c05){return _0x3f0c05?{'count':_0x20ea23,'rows':_0x3f0c05}:null;}})['then'](respondWithResult(_0x48670d,null))[_0x60ed('0x3c')](handleError(_0x48670d,null));};exports[_0x60ed('0x48')]=function(_0x23beb5,_0x136f9e,_0x13f3e8){if(_0x23beb5[_0x60ed('0x43')]['id']){delete _0x23beb5[_0x60ed('0x43')]['id'];}return db[_0x60ed('0x24')][_0x60ed('0x45')]({'where':{'id':_0x23beb5[_0x60ed('0x3e')]['id']}})[_0x60ed('0x1c')](handleEntityNotFound(_0x136f9e,null))['then'](function(_0x3e6e31){if(_0x3e6e31){_0x23beb5['body']['AccountId']=_0x3e6e31['id'];_0x23beb5['body'][_0x60ed('0x49')]=integrations[_0x60ed('0x4a')](_0x23beb5[_0x60ed('0x43')][_0x60ed('0x4b')],_0x23beb5['body']['type']);_0x23beb5[_0x60ed('0x43')][_0x60ed('0x4c')]=integrations[_0x60ed('0x4d')](_0x23beb5[_0x60ed('0x43')]['channel'],_0x23beb5['body']['type']);return db['DeskConfiguration'][_0x60ed('0x41')](_0x23beb5[_0x60ed('0x43')],{'include':[{'model':db[_0x60ed('0x4e')],'as':_0x60ed('0x49')},{'model':db[_0x60ed('0x4e')],'as':'Descriptions'}]});}return null;})[_0x60ed('0x1c')](respondWithResult(_0x136f9e,null))[_0x60ed('0x3c')](handleError(_0x136f9e,null));};exports['getFields']=function(_0x12775f,_0x455473,_0x58e429){var _0x322b68=[{'name':_0x60ed('0x4f'),'label':_0x60ed('0x4f'),'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 _0x4b4be0='';return db[_0x60ed('0x24')][_0x60ed('0x45')]({'where':{'id':_0x12775f['params']['id']},'attributes':['id',_0x60ed('0x50'),_0x60ed('0x51'),_0x60ed('0x52'),_0x60ed('0x53'),'consumerKey','consumerSecret',_0x60ed('0x54'),_0x60ed('0x55')]})[_0x60ed('0x1c')](handleEntityNotFound(_0x455473,null))[_0x60ed('0x1c')](function(_0x3f4bf2){if(_0x3f4bf2){_0x4b4be0=_0x3f4bf2[_0x60ed('0x50')];var _0x1ed31e=_0x4b4be0[_0x60ed('0x56')](-0x1);if(_0x1ed31e==='/'){_0x4b4be0=_0x4b4be0[_0x60ed('0x57')](0x0,_0x4b4be0[_0x60ed('0x58')](_0x1ed31e));}var _0x797413={'method':_0x60ed('0x59'),'uri':util['format'](_0x60ed('0x5a'),_0x4b4be0),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x3f4bf2[_0x60ed('0x51')]===_0x60ed('0x5b')){_0x797413['headers'][_0x60ed('0x5c')]=util['format']('Basic\x20%s',new Buffer(util[_0x60ed('0x5d')](_0x60ed('0x5e'),_0x3f4bf2[_0x60ed('0x52')],_0x3f4bf2[_0x60ed('0x53')]))[_0x60ed('0x5f')](_0x60ed('0x60')));}return rp(_0x797413)[_0x60ed('0x1c')](function(_0x1abeaa){return _0x322b68[_0x60ed('0x61')](_[_0x60ed('0x23')](_0x1abeaa[_0x60ed('0x62')][_0x60ed('0x63')],function(_0x2f370b){return{'id':_0x2f370b[_0x60ed('0x21')],'name':_0x2f370b[_0x60ed('0x21')],'type':_0x2f370b[_0x60ed('0x27')],'active':_0x2f370b['active'],'label':_0x2f370b[_0x60ed('0x64')],'custom':!![]};}));});}})[_0x60ed('0x1c')](function(_0x444fec){return{'count':_0x444fec[_0x60ed('0x2f')],'rows':_0x444fec};})[_0x60ed('0x1c')](respondWithResult(_0x455473,null))[_0x60ed('0x3c')](function(_0x548d13){var _0x4958c7=_0x12775f['query'][_0x60ed('0x65')]?0x1f4:_0x548d13['statusCode']||0x1f4;logger[_0x60ed('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x60ed('0x66'),_0x4958c7,JSON[_0x60ed('0x67')](_0x548d13));delete _0x548d13[_0x60ed('0x21')];if(_0x4958c7===0x191){_0x4958c7=0x190;}_0x455473[_0x60ed('0x14')](_0x4958c7)[_0x60ed('0x22')](_0x12775f[_0x60ed('0x2a')]['test']?{'message':_0x60ed('0x68'),'statusCode':_0x548d13[_0x60ed('0x69')]}:_0x548d13);});}; \ No newline at end of file +var _0x2bcf=['Basic\x20%s','%s:%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','error','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','DeskConfiguration','AccountId','Descriptions','getDescriptions','channel','Subjects','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization'];(function(_0x5872f4,_0x399432){var _0xcb6124=function(_0x591aba){while(--_0x591aba){_0x5872f4['push'](_0x5872f4['shift']());}};_0xcb6124(++_0x399432);}(_0x2bcf,0x1d7));var _0xf2bc=function(_0x529f79,_0x5b4c85){_0x529f79=_0x529f79-0x0;var _0x21e1d5=_0x2bcf[_0x529f79];return _0x21e1d5;};'use strict';var emlformat=require(_0xf2bc('0x0'));var rimraf=require(_0xf2bc('0x1'));var zipdir=require(_0xf2bc('0x2'));var jsonpatch=require(_0xf2bc('0x3'));var rp=require(_0xf2bc('0x4'));var moment=require(_0xf2bc('0x5'));var BPromise=require(_0xf2bc('0x6'));var Mustache=require(_0xf2bc('0x7'));var util=require(_0xf2bc('0x8'));var path=require(_0xf2bc('0x9'));var sox=require(_0xf2bc('0xa'));var csv=require(_0xf2bc('0xb'));var ejs=require(_0xf2bc('0xc'));var fs=require('fs');var fs_extra=require(_0xf2bc('0xd'));var _=require(_0xf2bc('0xe'));var squel=require(_0xf2bc('0xf'));var crypto=require(_0xf2bc('0x10'));var jsforce=require(_0xf2bc('0x11'));var deskjs=require(_0xf2bc('0x12'));var toCsv=require(_0xf2bc('0xb'));var querystring=require(_0xf2bc('0x13'));var Papa=require(_0xf2bc('0x14'));var Redis=require(_0xf2bc('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xf2bc('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2bc('0x17'));var logger=require('../../config/logger')(_0xf2bc('0x18'));var utils=require('../../config/utils');var config=require(_0xf2bc('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf2bc('0x1a'));function respondWithStatusCode(_0x371733,_0x18e8e9){_0x18e8e9=_0x18e8e9||0xcc;return function(_0x3829e2){if(_0x3829e2){return _0x371733[_0xf2bc('0x1b')](_0x18e8e9);}return _0x371733[_0xf2bc('0x1c')](_0x18e8e9)[_0xf2bc('0x1d')]();};}function respondWithResult(_0x163966,_0x4b488c){_0x4b488c=_0x4b488c||0xc8;return function(_0x16a728){if(_0x16a728){return _0x163966[_0xf2bc('0x1c')](_0x4b488c)[_0xf2bc('0x1e')](_0x16a728);}};}function respondWithFilteredResult(_0x6203c5,_0x474223){return function(_0x1f2aac){if(_0x1f2aac){var _0x45191c=typeof _0x474223[_0xf2bc('0x1f')]==='undefined'&&typeof _0x474223[_0xf2bc('0x20')]===_0xf2bc('0x21');var _0x105826=_0x1f2aac[_0xf2bc('0x22')];var _0x43957f=_0x45191c?0x0:_0x474223[_0xf2bc('0x1f')];var _0x5c8705=_0x45191c?_0x1f2aac[_0xf2bc('0x22')]:_0x474223[_0xf2bc('0x1f')]+_0x474223[_0xf2bc('0x20')];var _0x43bbd5;if(_0x5c8705>=_0x105826){_0x5c8705=_0x105826;_0x43bbd5=0xc8;}else{_0x43bbd5=0xce;}_0x6203c5[_0xf2bc('0x1c')](_0x43bbd5);return _0x6203c5[_0xf2bc('0x23')]('Content-Range',_0x43957f+'-'+_0x5c8705+'/'+_0x105826)['json'](_0x1f2aac);}return null;};}function patchUpdates(_0x4a36f0){return function(_0x2bd6c0){try{jsonpatch['apply'](_0x2bd6c0,_0x4a36f0,!![]);}catch(_0x2c76ca){return BPromise[_0xf2bc('0x24')](_0x2c76ca);}return _0x2bd6c0[_0xf2bc('0x25')]();};}function saveUpdates(_0x294b0e,_0x453129){return function(_0x1b08b0){if(_0x1b08b0){return _0x1b08b0[_0xf2bc('0x26')](_0x294b0e)['then'](function(_0x20417e){return _0x20417e;});}return null;};}function removeEntity(_0x255d00,_0x212d67){return function(_0x3a8506){if(_0x3a8506){return _0x3a8506[_0xf2bc('0x27')]()['then'](function(){_0x255d00['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x598468,_0x4466fd){return function(_0x6d1ca){if(!_0x6d1ca){_0x598468['sendStatus'](0x194);}return _0x6d1ca;};}function handleError(_0x3b5cbb,_0x2ab897){_0x2ab897=_0x2ab897||0x1f4;return function(_0x1fefd6){logger[_0xf2bc('0x28')](_0x1fefd6['stack']);if(_0x1fefd6[_0xf2bc('0x29')]){delete _0x1fefd6['name'];}_0x3b5cbb['status'](_0x2ab897)[_0xf2bc('0x2a')](_0x1fefd6);};}exports[_0xf2bc('0x2b')]=function(_0x357095,_0x437343){var _0x298a7b={},_0x5d1a25={},_0x4714df={'count':0x0,'rows':[]};var _0x14dde3=_['map'](db[_0xf2bc('0x2c')][_0xf2bc('0x2d')],function(_0x3cbd08){return{'name':_0x3cbd08[_0xf2bc('0x2e')],'type':_0x3cbd08[_0xf2bc('0x2f')][_0xf2bc('0x30')]};});_0x5d1a25[_0xf2bc('0x31')]=_[_0xf2bc('0x32')](_0x14dde3,_0xf2bc('0x29'));_0x5d1a25[_0xf2bc('0x33')]=_[_0xf2bc('0x34')](_0x357095['query']);_0x5d1a25[_0xf2bc('0x35')]=_[_0xf2bc('0x36')](_0x5d1a25[_0xf2bc('0x31')],_0x5d1a25[_0xf2bc('0x33')]);_0x298a7b['attributes']=_[_0xf2bc('0x36')](_0x5d1a25[_0xf2bc('0x31')],qs[_0xf2bc('0x37')](_0x357095[_0xf2bc('0x33')][_0xf2bc('0x37')]));_0x298a7b['attributes']=_0x298a7b[_0xf2bc('0x38')][_0xf2bc('0x39')]?_0x298a7b['attributes']:_0x5d1a25['model'];if(!_0x357095[_0xf2bc('0x33')][_0xf2bc('0x3a')](_0xf2bc('0x3b'))){_0x298a7b[_0xf2bc('0x20')]=qs[_0xf2bc('0x20')](_0x357095[_0xf2bc('0x33')]['limit']);_0x298a7b[_0xf2bc('0x1f')]=qs[_0xf2bc('0x1f')](_0x357095[_0xf2bc('0x33')][_0xf2bc('0x1f')]);}_0x298a7b[_0xf2bc('0x3c')]=qs[_0xf2bc('0x3d')](_0x357095[_0xf2bc('0x33')][_0xf2bc('0x3d')]);_0x298a7b['where']=qs[_0xf2bc('0x35')](_[_0xf2bc('0x3e')](_0x357095[_0xf2bc('0x33')],_0x5d1a25[_0xf2bc('0x35')]),_0x14dde3);if(_0x357095['query'][_0xf2bc('0x3f')]){_0x298a7b[_0xf2bc('0x40')]=_[_0xf2bc('0x41')](_0x298a7b[_0xf2bc('0x40')],{'$or':_[_0xf2bc('0x32')](_0x14dde3,function(_0x34b06e){if(_0x34b06e[_0xf2bc('0x2f')]!==_0xf2bc('0x42')){var _0x178d4b={};_0x178d4b[_0x34b06e[_0xf2bc('0x29')]]={'$like':'%'+_0x357095[_0xf2bc('0x33')][_0xf2bc('0x3f')]+'%'};return _0x178d4b;}})});}_0x298a7b=_[_0xf2bc('0x41')]({},_0x298a7b,_0x357095[_0xf2bc('0x43')]);var _0x4ec48f={'where':_0x298a7b[_0xf2bc('0x40')]};return db[_0xf2bc('0x2c')]['count'](_0x4ec48f)[_0xf2bc('0x44')](function(_0x4c642b){_0x4714df['count']=_0x4c642b;if(_0x357095[_0xf2bc('0x33')]['includeAll']){_0x298a7b['include']=[{'all':!![]}];}return db[_0xf2bc('0x2c')]['findAll'](_0x298a7b);})[_0xf2bc('0x44')](function(_0x456dae){_0x4714df[_0xf2bc('0x45')]=_0x456dae;return _0x4714df;})[_0xf2bc('0x44')](respondWithFilteredResult(_0x437343,_0x298a7b))[_0xf2bc('0x46')](handleError(_0x437343,null));};exports[_0xf2bc('0x47')]=function(_0x2ce06c,_0x281215){var _0x573847={'raw':![],'where':{'id':_0x2ce06c[_0xf2bc('0x48')]['id']}},_0x1e94c7={};_0x1e94c7[_0xf2bc('0x31')]=_[_0xf2bc('0x34')](db['DeskAccount']['rawAttributes']);_0x1e94c7[_0xf2bc('0x33')]=_[_0xf2bc('0x34')](_0x2ce06c[_0xf2bc('0x33')]);_0x1e94c7[_0xf2bc('0x35')]=_[_0xf2bc('0x36')](_0x1e94c7[_0xf2bc('0x31')],_0x1e94c7[_0xf2bc('0x33')]);_0x573847[_0xf2bc('0x38')]=_[_0xf2bc('0x36')](_0x1e94c7[_0xf2bc('0x31')],qs['fields'](_0x2ce06c[_0xf2bc('0x33')][_0xf2bc('0x37')]));_0x573847[_0xf2bc('0x38')]=_0x573847[_0xf2bc('0x38')][_0xf2bc('0x39')]?_0x573847['attributes']:_0x1e94c7[_0xf2bc('0x31')];if(_0x2ce06c[_0xf2bc('0x33')][_0xf2bc('0x49')]){_0x573847['include']=[{'all':!![]}];}_0x573847=_[_0xf2bc('0x41')]({},_0x573847,_0x2ce06c[_0xf2bc('0x43')]);return db['DeskAccount'][_0xf2bc('0x4a')](_0x573847)[_0xf2bc('0x44')](handleEntityNotFound(_0x281215,null))[_0xf2bc('0x44')](respondWithResult(_0x281215,null))[_0xf2bc('0x46')](handleError(_0x281215,null));};exports['create']=function(_0x938628,_0xdfe0c6){return db[_0xf2bc('0x2c')][_0xf2bc('0x4b')](_0x938628[_0xf2bc('0x4c')],{})[_0xf2bc('0x44')](respondWithResult(_0xdfe0c6,0xc9))[_0xf2bc('0x46')](handleError(_0xdfe0c6,null));};exports[_0xf2bc('0x26')]=function(_0x380371,_0x51b641){if(_0x380371[_0xf2bc('0x4c')]['id']){delete _0x380371[_0xf2bc('0x4c')]['id'];}return db[_0xf2bc('0x2c')][_0xf2bc('0x4a')]({'where':{'id':_0x380371[_0xf2bc('0x48')]['id']}})[_0xf2bc('0x44')](handleEntityNotFound(_0x51b641,null))[_0xf2bc('0x44')](saveUpdates(_0x380371['body'],null))['then'](respondWithResult(_0x51b641,null))[_0xf2bc('0x46')](handleError(_0x51b641,null));};exports[_0xf2bc('0x27')]=function(_0x3cbf64,_0x308765){return db[_0xf2bc('0x2c')][_0xf2bc('0x4a')]({'where':{'id':_0x3cbf64[_0xf2bc('0x48')]['id']}})['then'](handleEntityNotFound(_0x308765,null))['then'](removeEntity(_0x308765,null))[_0xf2bc('0x46')](handleError(_0x308765,null));};exports[_0xf2bc('0x4d')]=function(_0x321f8c,_0x5ef482,_0x39075b){var _0x4bb49a={};var _0x301c88={};var _0x2fb607;var _0x1a8215;return db[_0xf2bc('0x2c')][_0xf2bc('0x4e')]({'where':{'id':_0x321f8c[_0xf2bc('0x48')]['id']}})[_0xf2bc('0x44')](handleEntityNotFound(_0x5ef482,null))['then'](function(_0x272cb3){if(_0x272cb3){_0x2fb607=_0x272cb3;_0x301c88[_0xf2bc('0x31')]=_['keys'](db[_0xf2bc('0x4f')][_0xf2bc('0x2d')]);_0x301c88[_0xf2bc('0x33')]=_[_0xf2bc('0x34')](_0x321f8c[_0xf2bc('0x33')]);_0x301c88[_0xf2bc('0x35')]=_[_0xf2bc('0x36')](_0x301c88[_0xf2bc('0x31')],_0x301c88['query']);_0x4bb49a[_0xf2bc('0x38')]=_[_0xf2bc('0x36')](_0x301c88['model'],qs[_0xf2bc('0x37')](_0x321f8c['query'][_0xf2bc('0x37')]));_0x4bb49a[_0xf2bc('0x38')]=_0x4bb49a[_0xf2bc('0x38')][_0xf2bc('0x39')]?_0x4bb49a['attributes']:_0x301c88[_0xf2bc('0x31')];_0x4bb49a[_0xf2bc('0x3c')]=qs[_0xf2bc('0x3d')](_0x321f8c[_0xf2bc('0x33')]['sort']);_0x4bb49a['where']=qs['filters'](_[_0xf2bc('0x3e')](_0x321f8c['query'],_0x301c88[_0xf2bc('0x35')]));if(_0x321f8c[_0xf2bc('0x33')][_0xf2bc('0x3f')]){_0x4bb49a[_0xf2bc('0x40')]=_['merge'](_0x4bb49a['where'],{'$or':_[_0xf2bc('0x32')](_0x4bb49a[_0xf2bc('0x38')],function(_0x3ef723){var _0x50010f={};_0x50010f[_0x3ef723]={'$like':'%'+_0x321f8c[_0xf2bc('0x33')]['filter']+'%'};return _0x50010f;})});}_0x4bb49a=_[_0xf2bc('0x41')]({},_0x4bb49a,_0x321f8c['options']);return _0x2fb607['getConfigurations'](_0x4bb49a);}})[_0xf2bc('0x44')](function(_0x2c973f){if(_0x2c973f){_0x1a8215=_0x2c973f['length'];if(!_0x321f8c[_0xf2bc('0x33')][_0xf2bc('0x3a')]('nolimit')){_0x4bb49a['limit']=qs[_0xf2bc('0x20')](_0x321f8c[_0xf2bc('0x33')]['limit']);_0x4bb49a['offset']=qs[_0xf2bc('0x1f')](_0x321f8c[_0xf2bc('0x33')][_0xf2bc('0x1f')]);}return _0x2fb607[_0xf2bc('0x4d')](_0x4bb49a);}})['then'](function(_0x42a1de){if(_0x42a1de){return _0x42a1de?{'count':_0x1a8215,'rows':_0x42a1de}:null;}})['then'](respondWithResult(_0x5ef482,null))[_0xf2bc('0x46')](handleError(_0x5ef482,null));};exports['addConfiguration']=function(_0x5285d6,_0x584f8b,_0x2be745){if(_0x5285d6[_0xf2bc('0x4c')]['id']){delete _0x5285d6[_0xf2bc('0x4c')]['id'];}return db[_0xf2bc('0x2c')][_0xf2bc('0x4e')]({'where':{'id':_0x5285d6[_0xf2bc('0x48')]['id']}})[_0xf2bc('0x44')](handleEntityNotFound(_0x584f8b,null))[_0xf2bc('0x44')](function(_0x4796d8){if(_0x4796d8){_0x5285d6[_0xf2bc('0x4c')][_0xf2bc('0x50')]=_0x4796d8['id'];_0x5285d6[_0xf2bc('0x4c')]['Subjects']=integrations['getSubjects'](_0x5285d6[_0xf2bc('0x4c')]['channel'],_0x5285d6[_0xf2bc('0x4c')][_0xf2bc('0x2f')]);_0x5285d6[_0xf2bc('0x4c')][_0xf2bc('0x51')]=integrations[_0xf2bc('0x52')](_0x5285d6[_0xf2bc('0x4c')][_0xf2bc('0x53')],_0x5285d6['body'][_0xf2bc('0x2f')]);return db['DeskConfiguration']['create'](_0x5285d6[_0xf2bc('0x4c')],{'include':[{'model':db['DeskField'],'as':_0xf2bc('0x54')},{'model':db[_0xf2bc('0x55')],'as':'Descriptions'}]});}return null;})[_0xf2bc('0x44')](respondWithResult(_0x584f8b,null))[_0xf2bc('0x46')](handleError(_0x584f8b,null));};exports[_0xf2bc('0x56')]=function(_0x1bca07,_0x19179c,_0x1a3a63){var _0x100597=[{'name':_0xf2bc('0x57'),'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 _0x52d02d='';return db[_0xf2bc('0x2c')][_0xf2bc('0x4e')]({'where':{'id':_0x1bca07['params']['id']},'attributes':['id',_0xf2bc('0x58'),_0xf2bc('0x59'),_0xf2bc('0x5a'),_0xf2bc('0x5b'),_0xf2bc('0x5c'),_0xf2bc('0x5d'),_0xf2bc('0x5e'),'tokenSecret']})[_0xf2bc('0x44')](handleEntityNotFound(_0x19179c,null))[_0xf2bc('0x44')](function(_0x206a1d){if(_0x206a1d){_0x52d02d=_0x206a1d[_0xf2bc('0x58')];var _0x360601=_0x52d02d[_0xf2bc('0x5f')](-0x1);if(_0x360601==='/'){_0x52d02d=_0x52d02d[_0xf2bc('0x60')](0x0,_0x52d02d[_0xf2bc('0x61')](_0x360601));}var _0x1c864e={'method':_0xf2bc('0x62'),'uri':util[_0xf2bc('0x63')](_0xf2bc('0x64'),_0x52d02d),'headers':{'Content-Type':_0xf2bc('0x65'),'Accept':'application/json'},'json':!![]};if(_0x206a1d[_0xf2bc('0x59')]===_0xf2bc('0x66')){_0x1c864e['headers'][_0xf2bc('0x67')]=util['format'](_0xf2bc('0x68'),new Buffer(util[_0xf2bc('0x63')](_0xf2bc('0x69'),_0x206a1d[_0xf2bc('0x5a')],_0x206a1d[_0xf2bc('0x5b')]))['toString'](_0xf2bc('0x6a')));}return rp(_0x1c864e)[_0xf2bc('0x44')](function(_0x5e200f){return _0x100597[_0xf2bc('0x6b')](_[_0xf2bc('0x32')](_0x5e200f[_0xf2bc('0x6c')][_0xf2bc('0x6d')],function(_0x5ec0e5){return{'id':_0x5ec0e5[_0xf2bc('0x29')],'name':_0x5ec0e5[_0xf2bc('0x29')],'type':_0x5ec0e5['type'],'active':_0x5ec0e5[_0xf2bc('0x6e')],'label':_0x5ec0e5[_0xf2bc('0x6f')],'custom':!![]};}));});}})[_0xf2bc('0x44')](function(_0x2bd746){return{'count':_0x2bd746[_0xf2bc('0x39')],'rows':_0x2bd746};})[_0xf2bc('0x44')](respondWithResult(_0x19179c,null))[_0xf2bc('0x46')](function(_0x295a75){var _0x3d1e71=_0x1bca07[_0xf2bc('0x33')][_0xf2bc('0x70')]?0x1f4:_0x295a75[_0xf2bc('0x71')]||0x1f4;logger[_0xf2bc('0x28')](_0xf2bc('0x72'),_0xf2bc('0x56'),_0x3d1e71,JSON['stringify'](_0x295a75));delete _0x295a75[_0xf2bc('0x29')];if(_0x3d1e71===0x191){_0x3d1e71=0x190;}_0x19179c[_0xf2bc('0x1c')](_0x3d1e71)['send'](_0x1bca07['query'][_0xf2bc('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x295a75[_0xf2bc('0x71')]}:_0x295a75);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cb543ca..943503e 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 _0x01d3=['request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x2e9c6d,_0xbecdb4){var _0x139a4f=function(_0x58566b){while(--_0x58566b){_0x2e9c6d['push'](_0x2e9c6d['shift']());}};_0x139a4f(++_0xbecdb4);}(_0x01d3,0xe9));var _0x301d=function(_0x151e0e,_0x126c83){_0x151e0e=_0x151e0e-0x0;var _0x1fd348=_0x01d3[_0x151e0e];return _0x1fd348;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var logger=require(_0x301d('0x2'))(_0x301d('0x3'));var moment=require(_0x301d('0x4'));var BPromise=require('bluebird');var rp=require(_0x301d('0x5'));var fs=require('fs');var path=require(_0x301d('0x6'));var rimraf=require(_0x301d('0x7'));var config=require(_0x301d('0x8'));var attributes=require(_0x301d('0x9'));var integrations=require(_0x301d('0xa'));module[_0x301d('0xb')]=function(_0x2e0582,_0x598fe8){return _0x2e0582[_0x301d('0xc')](_0x301d('0xd'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x605c=['bluebird','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','../../config/logger','api','moment'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x605c,0x115));var _0xc605=function(_0x251547,_0x1e8a25){_0x251547=_0x251547-0x0;var _0x4c19df=_0x605c[_0x251547];return _0x4c19df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc605('0x0'))(_0xc605('0x1'));var moment=require(_0xc605('0x2'));var BPromise=require(_0xc605('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc605('0x4'));var rimraf=require(_0xc605('0x5'));var config=require('../../config/environment');var attributes=require(_0xc605('0x6'));var integrations=require(_0xc605('0x7'));module[_0xc605('0x8')]=function(_0x1baa92,_0x40226f){return _0x1baa92[_0xc605('0x9')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','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 d24ce6d..7946432 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 _0x6057=['find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','options','where','attributes','limit','map','include','model'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x6057,0x162));var _0x7605=function(_0x39758d,_0x346423){_0x39758d=_0x39758d-0x0;var _0x44ac11=_0x6057[_0x39758d];return _0x44ac11;};'use strict';var _=require(_0x7605('0x0'));var util=require(_0x7605('0x1'));var moment=require(_0x7605('0x2'));var BPromise=require(_0x7605('0x3'));var rs=require(_0x7605('0x4'));var fs=require('fs');var Redis=require(_0x7605('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7605('0x6'))(_0x7605('0x7'));var config=require('../../config/environment');var jayson=require(_0x7605('0x8'));var client=jayson[_0x7605('0x9')][_0x7605('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348e63,_0x24815f,_0x77ef97){return new BPromise(function(_0x3b5493,_0x1242e0){return client['request'](_0x348e63,_0x77ef97)[_0x7605('0xb')](function(_0x3a2a49){logger[_0x7605('0xc')](_0x7605('0xd'),_0x24815f,_0x7605('0xe'));logger[_0x7605('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x24815f,'request\x20sent',JSON[_0x7605('0x10')](_0x3a2a49));if(_0x3a2a49[_0x7605('0x11')]){if(_0x3a2a49[_0x7605('0x11')]['code']===0x1f4){logger[_0x7605('0x11')](_0x7605('0xd'),_0x24815f,_0x3a2a49[_0x7605('0x11')]['message']);return _0x1242e0(_0x3a2a49[_0x7605('0x11')][_0x7605('0x12')]);}logger[_0x7605('0x11')](_0x7605('0xd'),_0x24815f,_0x3a2a49[_0x7605('0x11')][_0x7605('0x12')]);return _0x3b5493(_0x3a2a49['error'][_0x7605('0x12')]);}else{logger['info'](_0x7605('0xd'),_0x24815f,_0x7605('0xe'));_0x3b5493(_0x3a2a49[_0x7605('0x13')][_0x7605('0x12')]);}})[_0x7605('0x14')](function(_0x35989e){logger[_0x7605('0x11')](_0x7605('0xd'),_0x24815f,_0x35989e);_0x1242e0(_0x35989e);});});}exports[_0x7605('0x15')]=function(_0x1c8420){var _0x5e1c44=this;return new Promise(function(_0x23adc7,_0x36d28d){return db[_0x7605('0x16')]['findAll']({'raw':_0x1c8420['options']?_0x1c8420[_0x7605('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1c8420[_0x7605('0x17')]?_0x1c8420[_0x7605('0x17')][_0x7605('0x18')]||null:null,'attributes':_0x1c8420[_0x7605('0x17')]?_0x1c8420['options'][_0x7605('0x19')]||null:null,'limit':_0x1c8420[_0x7605('0x17')]?_0x1c8420[_0x7605('0x17')][_0x7605('0x1a')]||null:null,'include':_0x1c8420['options']?_0x1c8420[_0x7605('0x17')]['include']?_[_0x7605('0x1b')](_0x1c8420[_0x7605('0x17')][_0x7605('0x1c')],function(_0x2ae194){return{'model':db[_0x2ae194['model']],'as':_0x2ae194['as'],'attributes':_0x2ae194['attributes'],'include':_0x2ae194[_0x7605('0x1c')]?_['map'](_0x2ae194['include'],function(_0x5edc15){return{'model':db[_0x5edc15[_0x7605('0x1d')]],'as':_0x5edc15['as'],'attributes':_0x5edc15[_0x7605('0x19')],'include':_0x5edc15['include']?_['map'](_0x5edc15[_0x7605('0x1c')],function(_0x193574){return{'model':db[_0x193574[_0x7605('0x1d')]],'as':_0x193574['as'],'attributes':_0x193574[_0x7605('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2560fa){logger[_0x7605('0xc')](_0x7605('0x15'),_0x1c8420);logger[_0x7605('0xf')](_0x7605('0x15'),_0x1c8420,JSON['stringify'](_0x2560fa));_0x23adc7(_0x2560fa);})[_0x7605('0x14')](function(_0x3fd342){logger[_0x7605('0x11')]('GetDeskAccount',_0x3fd342[_0x7605('0x12')],_0x1c8420);_0x36d28d(_0x5e1c44[_0x7605('0x11')](0x1f4,_0x3fd342['message']));});});};exports['ShowDeskAccount']=function(_0x1ff2fc){var _0x2e9b46=this;return new Promise(function(_0x44a493,_0x24962f){return db[_0x7605('0x16')][_0x7605('0x1e')]({'raw':_0x1ff2fc['options']?_0x1ff2fc['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ff2fc[_0x7605('0x17')]?_0x1ff2fc[_0x7605('0x17')]['where']||null:null,'attributes':_0x1ff2fc[_0x7605('0x17')]?_0x1ff2fc['options'][_0x7605('0x19')]||null:null,'include':_0x1ff2fc[_0x7605('0x17')]?_0x1ff2fc[_0x7605('0x17')]['include']?_['map'](_0x1ff2fc['options']['include'],function(_0x464acd){return{'model':db[_0x464acd['model']],'as':_0x464acd['as'],'attributes':_0x464acd['attributes'],'include':_0x464acd['include']?_[_0x7605('0x1b')](_0x464acd[_0x7605('0x1c')],function(_0x2c8fc8){return{'model':db[_0x2c8fc8[_0x7605('0x1d')]],'as':_0x2c8fc8['as'],'attributes':_0x2c8fc8[_0x7605('0x19')],'include':_0x2c8fc8[_0x7605('0x1c')]?_['map'](_0x2c8fc8[_0x7605('0x1c')],function(_0x4a2759){return{'model':db[_0x4a2759[_0x7605('0x1d')]],'as':_0x4a2759['as'],'attributes':_0x4a2759[_0x7605('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23a738){logger['info'](_0x7605('0x1f'),_0x1ff2fc);logger[_0x7605('0xf')](_0x7605('0x1f'),_0x1ff2fc,JSON[_0x7605('0x10')](_0x23a738));_0x44a493(_0x23a738);})[_0x7605('0x14')](function(_0x169dbf){logger['error'](_0x7605('0x1f'),_0x169dbf[_0x7605('0x12')],_0x1ff2fc);_0x24962f(_0x2e9b46[_0x7605('0x11')](0x1f4,_0x169dbf[_0x7605('0x12')]));});});}; \ No newline at end of file +var _0xbf00=['stringify','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','result','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf00,0x16c));var _0x0bf0=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0xbf00[_0x21c2c8];return _0x4dd745;};'use strict';var _=require('lodash');var util=require(_0x0bf0('0x0'));var moment=require(_0x0bf0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bf0('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0bf0('0x3'))(_0x0bf0('0x4'));var config=require(_0x0bf0('0x5'));var jayson=require(_0x0bf0('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3352b7,_0x4c4411,_0x2b70ef){return new BPromise(function(_0x316075,_0x10ecab){return client[_0x0bf0('0x7')](_0x3352b7,_0x2b70ef)[_0x0bf0('0x8')](function(_0x496c2e){logger[_0x0bf0('0x9')](_0x0bf0('0xa'),_0x4c4411,_0x0bf0('0xb'));logger[_0x0bf0('0xc')](_0x0bf0('0xd'),_0x4c4411,_0x0bf0('0xb'),JSON['stringify'](_0x496c2e));if(_0x496c2e[_0x0bf0('0xe')]){if(_0x496c2e[_0x0bf0('0xe')][_0x0bf0('0xf')]===0x1f4){logger[_0x0bf0('0xe')](_0x0bf0('0xa'),_0x4c4411,_0x496c2e['error']['message']);return _0x10ecab(_0x496c2e[_0x0bf0('0xe')]['message']);}logger[_0x0bf0('0xe')](_0x0bf0('0xa'),_0x4c4411,_0x496c2e[_0x0bf0('0xe')]['message']);return _0x316075(_0x496c2e[_0x0bf0('0xe')]['message']);}else{logger[_0x0bf0('0x9')](_0x0bf0('0xa'),_0x4c4411,_0x0bf0('0xb'));_0x316075(_0x496c2e[_0x0bf0('0x10')][_0x0bf0('0x11')]);}})[_0x0bf0('0x12')](function(_0x7afa7){logger[_0x0bf0('0xe')]('DeskAccount,\x20%s,\x20%s',_0x4c4411,_0x7afa7);_0x10ecab(_0x7afa7);});});}exports[_0x0bf0('0x13')]=function(_0x34c79e){var _0x49f14e=this;return new Promise(function(_0x3b542a,_0x5da0fc){return db[_0x0bf0('0x14')][_0x0bf0('0x15')]({'raw':_0x34c79e['options']?_0x34c79e[_0x0bf0('0x16')][_0x0bf0('0x17')]===undefined?!![]:![]:!![],'where':_0x34c79e[_0x0bf0('0x16')]?_0x34c79e['options'][_0x0bf0('0x18')]||null:null,'attributes':_0x34c79e['options']?_0x34c79e[_0x0bf0('0x16')][_0x0bf0('0x19')]||null:null,'limit':_0x34c79e[_0x0bf0('0x16')]?_0x34c79e['options'][_0x0bf0('0x1a')]||null:null,'include':_0x34c79e[_0x0bf0('0x16')]?_0x34c79e[_0x0bf0('0x16')][_0x0bf0('0x1b')]?_[_0x0bf0('0x1c')](_0x34c79e[_0x0bf0('0x16')][_0x0bf0('0x1b')],function(_0xfc4c94){return{'model':db[_0xfc4c94[_0x0bf0('0x1d')]],'as':_0xfc4c94['as'],'attributes':_0xfc4c94[_0x0bf0('0x19')],'include':_0xfc4c94[_0x0bf0('0x1b')]?_[_0x0bf0('0x1c')](_0xfc4c94[_0x0bf0('0x1b')],function(_0x5512e2){return{'model':db[_0x5512e2[_0x0bf0('0x1d')]],'as':_0x5512e2['as'],'attributes':_0x5512e2[_0x0bf0('0x19')],'include':_0x5512e2['include']?_[_0x0bf0('0x1c')](_0x5512e2['include'],function(_0x4a62d3){return{'model':db[_0x4a62d3[_0x0bf0('0x1d')]],'as':_0x4a62d3['as'],'attributes':_0x4a62d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x207bd6){logger[_0x0bf0('0x9')](_0x0bf0('0x13'),_0x34c79e);logger[_0x0bf0('0xc')]('GetDeskAccount',_0x34c79e,JSON['stringify'](_0x207bd6));_0x3b542a(_0x207bd6);})['catch'](function(_0xf54e41){logger[_0x0bf0('0xe')]('GetDeskAccount',_0xf54e41['message'],_0x34c79e);_0x5da0fc(_0x49f14e['error'](0x1f4,_0xf54e41[_0x0bf0('0x11')]));});});};exports[_0x0bf0('0x1e')]=function(_0x495c8a){var _0x2f1553=this;return new Promise(function(_0x55dfeb,_0x18baf9){return db[_0x0bf0('0x14')][_0x0bf0('0x1f')]({'raw':_0x495c8a[_0x0bf0('0x16')]?_0x495c8a[_0x0bf0('0x16')][_0x0bf0('0x17')]===undefined?!![]:![]:!![],'where':_0x495c8a[_0x0bf0('0x16')]?_0x495c8a[_0x0bf0('0x16')][_0x0bf0('0x18')]||null:null,'attributes':_0x495c8a['options']?_0x495c8a[_0x0bf0('0x16')][_0x0bf0('0x19')]||null:null,'include':_0x495c8a[_0x0bf0('0x16')]?_0x495c8a[_0x0bf0('0x16')][_0x0bf0('0x1b')]?_[_0x0bf0('0x1c')](_0x495c8a[_0x0bf0('0x16')]['include'],function(_0x32d4ab){return{'model':db[_0x32d4ab[_0x0bf0('0x1d')]],'as':_0x32d4ab['as'],'attributes':_0x32d4ab[_0x0bf0('0x19')],'include':_0x32d4ab['include']?_['map'](_0x32d4ab['include'],function(_0x822081){return{'model':db[_0x822081[_0x0bf0('0x1d')]],'as':_0x822081['as'],'attributes':_0x822081['attributes'],'include':_0x822081[_0x0bf0('0x1b')]?_['map'](_0x822081['include'],function(_0x2db2ad){return{'model':db[_0x2db2ad['model']],'as':_0x2db2ad['as'],'attributes':_0x2db2ad[_0x0bf0('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181bb7){logger['info']('ShowDeskAccount',_0x495c8a);logger[_0x0bf0('0xc')]('ShowDeskAccount',_0x495c8a,JSON[_0x0bf0('0x20')](_0x181bb7));_0x55dfeb(_0x181bb7);})[_0x0bf0('0x12')](function(_0x84254c){logger['error'](_0x0bf0('0x1e'),_0x84254c['message'],_0x495c8a);_0x18baf9(_0x2f1553[_0x0bf0('0xe')](0x1f4,_0x84254c[_0x0bf0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a1de64a..a516886 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x4aee90,_0x35faaa){var _0x4fd2ea=function(_0x1617cd){while(--_0x1617cd){_0x4aee90['push'](_0x4aee90['shift']());}};_0x4fd2ea(++_0x35faaa);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x306a4f,_0x1787e9){var _0x1b3a4a=function(_0x484d29){while(--_0x484d29){_0x306a4f['push'](_0x306a4f['shift']());}};_0x1b3a4a(++_0x1787e9);}(_0x34e8,0x12c));var _0x834e=function(_0x1694e9,_0x1ffe32){_0x1694e9=_0x1694e9-0x0;var _0x5195d6=_0x34e8[_0x1694e9];return _0x5195d6;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 058f85d..2121a59 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 _0x9df1=['STRING','exports'];(function(_0x2cc74a,_0x3027cf){var _0x36340c=function(_0x3e3451){while(--_0x3e3451){_0x2cc74a['push'](_0x2cc74a['shift']());}};_0x36340c(++_0x3027cf);}(_0x9df1,0xd7));var _0x19df=function(_0x2ea067,_0x18fe65){_0x2ea067=_0x2ea067-0x0;var _0x412cfc=_0x9df1[_0x2ea067];return _0x412cfc;};'use strict';var Sequelize=require('sequelize');module[_0x19df('0x0')]={'name':{'type':Sequelize[_0x19df('0x1')]},'description':{'type':Sequelize[_0x19df('0x1')]}}; \ No newline at end of file +var _0xf2ee=['exports','STRING','sequelize'];(function(_0x8ae1c9,_0x1c61ab){var _0x18b221=function(_0x264532){while(--_0x264532){_0x8ae1c9['push'](_0x8ae1c9['shift']());}};_0x18b221(++_0x1c61ab);}(_0xf2ee,0x98));var _0xef2e=function(_0x2e92c4,_0xb48dff){_0x2e92c4=_0x2e92c4-0x0;var _0x41bb83=_0xf2ee[_0x2e92c4];return _0x41bb83;};'use strict';var Sequelize=require(_0xef2e('0x0'));module[_0xef2e('0x1')]={'name':{'type':Sequelize[_0xef2e('0x2')]},'description':{'type':Sequelize[_0xef2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f3eed6b..2b8f4c5 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 _0x7be5=['DeskConfiguration','count','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','getFields','findOne','DeskField','length','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x7be5,0x11a));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x57be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57be('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x57be('0x2'));var BPromise=require(_0x57be('0x3'));var Mustache=require(_0x57be('0x4'));var util=require(_0x57be('0x5'));var path=require(_0x57be('0x6'));var sox=require('sox');var csv=require(_0x57be('0x7'));var ejs=require(_0x57be('0x8'));var fs=require('fs');var fs_extra=require(_0x57be('0x9'));var _=require(_0x57be('0xa'));var squel=require(_0x57be('0xb'));var crypto=require(_0x57be('0xc'));var jsforce=require(_0x57be('0xd'));var deskjs=require(_0x57be('0xe'));var toCsv=require('to-csv');var querystring=require(_0x57be('0xf'));var Papa=require(_0x57be('0x10'));var Redis=require(_0x57be('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x57be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57be('0x13'));var logger=require(_0x57be('0x14'))('api');var utils=require(_0x57be('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x57be('0x16'))['db'];function respondWithStatusCode(_0x3533f0,_0x5897d7){_0x5897d7=_0x5897d7||0xcc;return function(_0x420e6b){if(_0x420e6b){return _0x3533f0[_0x57be('0x17')](_0x5897d7);}return _0x3533f0['status'](_0x5897d7)[_0x57be('0x18')]();};}function respondWithResult(_0x419b4b,_0x9e693c){_0x9e693c=_0x9e693c||0xc8;return function(_0x3ee092){if(_0x3ee092){return _0x419b4b[_0x57be('0x19')](_0x9e693c)['json'](_0x3ee092);}};}function respondWithFilteredResult(_0x5e8664,_0x38028b){return function(_0x188edf){if(_0x188edf){var _0x366fda=typeof _0x38028b[_0x57be('0x1a')]===_0x57be('0x1b')&&typeof _0x38028b[_0x57be('0x1c')]===_0x57be('0x1b');var _0x1b7b67=_0x188edf['count'];var _0x2606ec=_0x366fda?0x0:_0x38028b[_0x57be('0x1a')];var _0x5725e9=_0x366fda?_0x188edf['count']:_0x38028b[_0x57be('0x1a')]+_0x38028b[_0x57be('0x1c')];var _0x5484d8;if(_0x5725e9>=_0x1b7b67){_0x5725e9=_0x1b7b67;_0x5484d8=0xc8;}else{_0x5484d8=0xce;}_0x5e8664[_0x57be('0x19')](_0x5484d8);return _0x5e8664[_0x57be('0x1d')](_0x57be('0x1e'),_0x2606ec+'-'+_0x5725e9+'/'+_0x1b7b67)[_0x57be('0x1f')](_0x188edf);}return null;};}function patchUpdates(_0x327f7c){return function(_0x3b776){try{jsonpatch[_0x57be('0x20')](_0x3b776,_0x327f7c,!![]);}catch(_0x2cbaab){return BPromise[_0x57be('0x21')](_0x2cbaab);}return _0x3b776[_0x57be('0x22')]();};}function saveUpdates(_0x4c2707,_0x2b0e8d){return function(_0x33aeea){if(_0x33aeea){return _0x33aeea[_0x57be('0x23')](_0x4c2707)[_0x57be('0x24')](function(_0x3cd312){return _0x3cd312;});}return null;};}function removeEntity(_0x15a06a,_0x2d6a75){return function(_0x5c9eaf){if(_0x5c9eaf){return _0x5c9eaf[_0x57be('0x25')]()[_0x57be('0x24')](function(){_0x15a06a[_0x57be('0x19')](0xcc)[_0x57be('0x18')]();});}};}function handleEntityNotFound(_0x1ce789,_0x5ae90b){return function(_0x5b517e){if(!_0x5b517e){_0x1ce789[_0x57be('0x17')](0x194);}return _0x5b517e;};}function handleError(_0x665015,_0x3d08d9){_0x3d08d9=_0x3d08d9||0x1f4;return function(_0x4e6070){logger[_0x57be('0x26')](_0x4e6070['stack']);if(_0x4e6070[_0x57be('0x27')]){delete _0x4e6070[_0x57be('0x27')];}_0x665015['status'](_0x3d08d9)[_0x57be('0x28')](_0x4e6070);};}exports[_0x57be('0x29')]=function(_0x40d0c4,_0x586873){var _0x311dca={},_0x5915e9={},_0x42b863={'count':0x0,'rows':[]};var _0x1a74d1=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0xb67954){return{'name':_0xb67954[_0x57be('0x2a')],'type':_0xb67954[_0x57be('0x2b')][_0x57be('0x2c')]};});_0x5915e9[_0x57be('0x2d')]=_[_0x57be('0x2e')](_0x1a74d1,_0x57be('0x27'));_0x5915e9[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x40d0c4[_0x57be('0x2f')]);_0x5915e9[_0x57be('0x31')]=_['intersection'](_0x5915e9[_0x57be('0x2d')],_0x5915e9[_0x57be('0x2f')]);_0x311dca['attributes']=_[_0x57be('0x32')](_0x5915e9[_0x57be('0x2d')],qs[_0x57be('0x33')](_0x40d0c4[_0x57be('0x2f')]['fields']));_0x311dca['attributes']=_0x311dca[_0x57be('0x34')]['length']?_0x311dca[_0x57be('0x34')]:_0x5915e9['model'];if(!_0x40d0c4[_0x57be('0x2f')][_0x57be('0x35')](_0x57be('0x36'))){_0x311dca['limit']=qs[_0x57be('0x1c')](_0x40d0c4['query'][_0x57be('0x1c')]);_0x311dca[_0x57be('0x1a')]=qs[_0x57be('0x1a')](_0x40d0c4[_0x57be('0x2f')][_0x57be('0x1a')]);}_0x311dca[_0x57be('0x37')]=qs['sort'](_0x40d0c4[_0x57be('0x2f')][_0x57be('0x38')]);_0x311dca['where']=qs['filters'](_['pick'](_0x40d0c4[_0x57be('0x2f')],_0x5915e9[_0x57be('0x31')]),_0x1a74d1);if(_0x40d0c4['query']['filter']){_0x311dca[_0x57be('0x39')]=_[_0x57be('0x3a')](_0x311dca[_0x57be('0x39')],{'$or':_[_0x57be('0x2e')](_0x1a74d1,function(_0x401787){if(_0x401787[_0x57be('0x2b')]!==_0x57be('0x3b')){var _0x451273={};_0x451273[_0x401787['name']]={'$like':'%'+_0x40d0c4[_0x57be('0x2f')][_0x57be('0x3c')]+'%'};return _0x451273;}})});}_0x311dca=_['merge']({},_0x311dca,_0x40d0c4[_0x57be('0x3d')]);var _0x3786e8={'where':_0x311dca[_0x57be('0x39')]};return db[_0x57be('0x3e')][_0x57be('0x3f')](_0x3786e8)['then'](function(_0x160b70){_0x42b863[_0x57be('0x3f')]=_0x160b70;if(_0x40d0c4['query'][_0x57be('0x40')]){_0x311dca['include']=[{'all':!![]}];}return db[_0x57be('0x3e')][_0x57be('0x41')](_0x311dca);})['then'](function(_0x182581){_0x42b863[_0x57be('0x42')]=_0x182581;return _0x42b863;})[_0x57be('0x24')](respondWithFilteredResult(_0x586873,_0x311dca))[_0x57be('0x43')](handleError(_0x586873,null));};exports[_0x57be('0x44')]=function(_0x57db42,_0x2dd2cf){var _0x551647={'raw':![],'where':{'id':_0x57db42['params']['id']}},_0x59450c={};_0x59450c['model']=_['keys'](db[_0x57be('0x3e')][_0x57be('0x45')]);_0x59450c[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x57db42[_0x57be('0x2f')]);_0x59450c[_0x57be('0x31')]=_[_0x57be('0x32')](_0x59450c[_0x57be('0x2d')],_0x59450c[_0x57be('0x2f')]);_0x551647[_0x57be('0x34')]=_[_0x57be('0x32')](_0x59450c[_0x57be('0x2d')],qs[_0x57be('0x33')](_0x57db42[_0x57be('0x2f')][_0x57be('0x33')]));_0x551647['attributes']=_0x551647[_0x57be('0x34')]['length']?_0x551647[_0x57be('0x34')]:_0x59450c['model'];if(_0x57db42[_0x57be('0x2f')]['includeAll']){_0x551647[_0x57be('0x46')]=[{'all':!![]}];}_0x551647=_[_0x57be('0x3a')]({},_0x551647,_0x57db42['options']);return db[_0x57be('0x3e')][_0x57be('0x47')](_0x551647)[_0x57be('0x24')](handleEntityNotFound(_0x2dd2cf,null))[_0x57be('0x24')](respondWithResult(_0x2dd2cf,null))[_0x57be('0x43')](handleError(_0x2dd2cf,null));};exports[_0x57be('0x48')]=function(_0x3490c4,_0x4806a5){return db[_0x57be('0x3e')][_0x57be('0x48')](_0x3490c4[_0x57be('0x49')],{})[_0x57be('0x24')](respondWithResult(_0x4806a5,0xc9))[_0x57be('0x43')](handleError(_0x4806a5,null));};exports[_0x57be('0x23')]=function(_0x464054,_0x49dfd4){if(_0x464054['body']['id']){delete _0x464054[_0x57be('0x49')]['id'];}return db[_0x57be('0x3e')]['find']({'where':{'id':_0x464054[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x49dfd4,null))[_0x57be('0x24')](saveUpdates(_0x464054['body'],null))[_0x57be('0x24')](respondWithResult(_0x49dfd4,null))['catch'](handleError(_0x49dfd4,null));};exports[_0x57be('0x25')]=function(_0x513b5,_0x1ff5b1){return db['DeskConfiguration'][_0x57be('0x47')]({'where':{'id':_0x513b5[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x1ff5b1,null))[_0x57be('0x24')](removeEntity(_0x1ff5b1,null))['catch'](handleError(_0x1ff5b1,null));};exports[_0x57be('0x4b')]=function(_0x7e9ce,_0x348b4f,_0x5535a7){var _0x1bcaf6={};var _0xdb732d={};var _0x569921;var _0x4d3fe6;return db[_0x57be('0x3e')][_0x57be('0x4c')]({'where':{'id':_0x7e9ce[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x348b4f,null))[_0x57be('0x24')](function(_0x2d6bb2){if(_0x2d6bb2){_0x569921=_0x2d6bb2;_0xdb732d[_0x57be('0x2d')]=_[_0x57be('0x30')](db[_0x57be('0x4d')]['rawAttributes']);_0xdb732d[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x7e9ce['query']);_0xdb732d[_0x57be('0x31')]=_['intersection'](_0xdb732d['model'],_0xdb732d['query']);_0x1bcaf6[_0x57be('0x34')]=_[_0x57be('0x32')](_0xdb732d['model'],qs[_0x57be('0x33')](_0x7e9ce[_0x57be('0x2f')][_0x57be('0x33')]));_0x1bcaf6[_0x57be('0x34')]=_0x1bcaf6[_0x57be('0x34')][_0x57be('0x4e')]?_0x1bcaf6[_0x57be('0x34')]:_0xdb732d[_0x57be('0x2d')];_0x1bcaf6[_0x57be('0x37')]=qs[_0x57be('0x38')](_0x7e9ce[_0x57be('0x2f')][_0x57be('0x38')]);_0x1bcaf6['where']=qs[_0x57be('0x31')](_[_0x57be('0x4f')](_0x7e9ce[_0x57be('0x2f')],_0xdb732d[_0x57be('0x31')]));if(_0x7e9ce[_0x57be('0x2f')][_0x57be('0x3c')]){_0x1bcaf6[_0x57be('0x39')]=_[_0x57be('0x3a')](_0x1bcaf6['where'],{'$or':_[_0x57be('0x2e')](_0x1bcaf6[_0x57be('0x34')],function(_0x2c7b6b){var _0x335565={};_0x335565[_0x2c7b6b]={'$like':'%'+_0x7e9ce[_0x57be('0x2f')][_0x57be('0x3c')]+'%'};return _0x335565;})});}_0x1bcaf6=_[_0x57be('0x3a')]({},_0x1bcaf6,_0x7e9ce[_0x57be('0x3d')]);return _0x569921[_0x57be('0x4b')](_0x1bcaf6);}})[_0x57be('0x24')](function(_0x100b0e){if(_0x100b0e){_0x4d3fe6=_0x100b0e[_0x57be('0x4e')];if(!_0x7e9ce['query']['hasOwnProperty']('nolimit')){_0x1bcaf6['limit']=qs[_0x57be('0x1c')](_0x7e9ce[_0x57be('0x2f')][_0x57be('0x1c')]);_0x1bcaf6[_0x57be('0x1a')]=qs[_0x57be('0x1a')](_0x7e9ce['query']['offset']);}return _0x569921[_0x57be('0x4b')](_0x1bcaf6);}})['then'](function(_0x347e98){if(_0x347e98){return _0x347e98?{'count':_0x4d3fe6,'rows':_0x347e98}:null;}})[_0x57be('0x24')](respondWithResult(_0x348b4f,null))[_0x57be('0x43')](handleError(_0x348b4f,null));};exports[_0x57be('0x50')]=function(_0x47959f,_0x5849ce,_0x287e70){var _0x250498={};var _0x3b4b49={};var _0x478828;var _0x4c5fc9;return db[_0x57be('0x3e')][_0x57be('0x4c')]({'where':{'id':_0x47959f[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x5849ce,null))[_0x57be('0x24')](function(_0x108707){if(_0x108707){_0x478828=_0x108707;_0x3b4b49[_0x57be('0x2d')]=_['keys'](db['DeskField'][_0x57be('0x45')]);_0x3b4b49['query']=_[_0x57be('0x30')](_0x47959f[_0x57be('0x2f')]);_0x3b4b49['filters']=_[_0x57be('0x32')](_0x3b4b49[_0x57be('0x2d')],_0x3b4b49['query']);_0x250498[_0x57be('0x34')]=_['intersection'](_0x3b4b49['model'],qs[_0x57be('0x33')](_0x47959f[_0x57be('0x2f')][_0x57be('0x33')]));_0x250498['attributes']=_0x250498[_0x57be('0x34')][_0x57be('0x4e')]?_0x250498[_0x57be('0x34')]:_0x3b4b49[_0x57be('0x2d')];_0x250498[_0x57be('0x37')]=qs[_0x57be('0x38')](_0x47959f['query'][_0x57be('0x38')]);_0x250498[_0x57be('0x39')]=qs['filters'](_[_0x57be('0x4f')](_0x47959f['query'],_0x3b4b49[_0x57be('0x31')]));if(_0x47959f[_0x57be('0x2f')][_0x57be('0x3c')]){_0x250498['where']=_[_0x57be('0x3a')](_0x250498[_0x57be('0x39')],{'$or':_['map'](_0x250498[_0x57be('0x34')],function(_0x3fe213){var _0x54fe0={};_0x54fe0[_0x3fe213]={'$like':'%'+_0x47959f[_0x57be('0x2f')][_0x57be('0x3c')]+'%'};return _0x54fe0;})});}_0x250498=_[_0x57be('0x3a')]({},_0x250498,_0x47959f['options']);return _0x478828['getSubjects'](_0x250498);}})[_0x57be('0x24')](function(_0x48f99e){if(_0x48f99e){_0x4c5fc9=_0x48f99e[_0x57be('0x4e')];if(!_0x47959f[_0x57be('0x2f')][_0x57be('0x35')](_0x57be('0x36'))){_0x250498['limit']=qs[_0x57be('0x1c')](_0x47959f[_0x57be('0x2f')][_0x57be('0x1c')]);_0x250498[_0x57be('0x1a')]=qs[_0x57be('0x1a')](_0x47959f[_0x57be('0x2f')][_0x57be('0x1a')]);}return _0x478828[_0x57be('0x50')](_0x250498);}})['then'](function(_0x429823){if(_0x429823){return _0x429823?{'count':_0x4c5fc9,'rows':_0x429823}:null;}})[_0x57be('0x24')](respondWithResult(_0x5849ce,null))[_0x57be('0x43')](handleError(_0x5849ce,null));};exports[_0x57be('0x51')]=function(_0x30fb4c,_0x5ec785,_0x3f35f3){var _0x12a7e0={};var _0x2f4f99={};var _0x35aefd;var _0x401adc;return db['DeskConfiguration'][_0x57be('0x4c')]({'where':{'id':_0x30fb4c[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x5ec785,null))['then'](function(_0x108908){if(_0x108908){_0x35aefd=_0x108908;_0x2f4f99[_0x57be('0x2d')]=_[_0x57be('0x30')](db[_0x57be('0x4d')][_0x57be('0x45')]);_0x2f4f99[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x30fb4c[_0x57be('0x2f')]);_0x2f4f99['filters']=_['intersection'](_0x2f4f99[_0x57be('0x2d')],_0x2f4f99[_0x57be('0x2f')]);_0x12a7e0[_0x57be('0x34')]=_['intersection'](_0x2f4f99[_0x57be('0x2d')],qs[_0x57be('0x33')](_0x30fb4c[_0x57be('0x2f')]['fields']));_0x12a7e0[_0x57be('0x34')]=_0x12a7e0['attributes'][_0x57be('0x4e')]?_0x12a7e0[_0x57be('0x34')]:_0x2f4f99[_0x57be('0x2d')];_0x12a7e0[_0x57be('0x37')]=qs[_0x57be('0x38')](_0x30fb4c[_0x57be('0x2f')]['sort']);_0x12a7e0[_0x57be('0x39')]=qs[_0x57be('0x31')](_[_0x57be('0x4f')](_0x30fb4c[_0x57be('0x2f')],_0x2f4f99[_0x57be('0x31')]));if(_0x30fb4c[_0x57be('0x2f')]['filter']){_0x12a7e0[_0x57be('0x39')]=_[_0x57be('0x3a')](_0x12a7e0[_0x57be('0x39')],{'$or':_['map'](_0x12a7e0['attributes'],function(_0x4ad032){var _0x54c4f6={};_0x54c4f6[_0x4ad032]={'$like':'%'+_0x30fb4c['query'][_0x57be('0x3c')]+'%'};return _0x54c4f6;})});}_0x12a7e0=_[_0x57be('0x3a')]({},_0x12a7e0,_0x30fb4c[_0x57be('0x3d')]);return _0x35aefd['getDescriptions'](_0x12a7e0);}})[_0x57be('0x24')](function(_0x281a0d){if(_0x281a0d){_0x401adc=_0x281a0d['length'];if(!_0x30fb4c[_0x57be('0x2f')][_0x57be('0x35')]('nolimit')){_0x12a7e0[_0x57be('0x1c')]=qs[_0x57be('0x1c')](_0x30fb4c[_0x57be('0x2f')][_0x57be('0x1c')]);_0x12a7e0[_0x57be('0x1a')]=qs['offset'](_0x30fb4c[_0x57be('0x2f')][_0x57be('0x1a')]);}return _0x35aefd['getDescriptions'](_0x12a7e0);}})[_0x57be('0x24')](function(_0x18f93d){if(_0x18f93d){return _0x18f93d?{'count':_0x401adc,'rows':_0x18f93d}:null;}})[_0x57be('0x24')](respondWithResult(_0x5ec785,null))[_0x57be('0x43')](handleError(_0x5ec785,null));};exports[_0x57be('0x52')]=function(_0x161dd5,_0x2b8103,_0x4d8192){var _0x2f8ad4={};var _0x38480b={};var _0x38bb33;var _0x22044c;return db['DeskConfiguration']['findOne']({'where':{'id':_0x161dd5[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x2b8103,null))[_0x57be('0x24')](function(_0x3168ed){if(_0x3168ed){_0x38bb33=_0x3168ed;_0x38480b['model']=_['keys'](db[_0x57be('0x53')][_0x57be('0x45')]);_0x38480b[_0x57be('0x2f')]=_[_0x57be('0x30')](_0x161dd5[_0x57be('0x2f')]);_0x38480b[_0x57be('0x31')]=_['intersection'](_0x38480b[_0x57be('0x2d')],_0x38480b[_0x57be('0x2f')]);_0x2f8ad4[_0x57be('0x34')]=_[_0x57be('0x32')](_0x38480b[_0x57be('0x2d')],qs[_0x57be('0x33')](_0x161dd5['query'][_0x57be('0x33')]));_0x2f8ad4[_0x57be('0x34')]=_0x2f8ad4[_0x57be('0x34')][_0x57be('0x4e')]?_0x2f8ad4[_0x57be('0x34')]:_0x38480b['model'];_0x2f8ad4[_0x57be('0x37')]=qs[_0x57be('0x38')](_0x161dd5[_0x57be('0x2f')]['sort']);_0x2f8ad4[_0x57be('0x39')]=qs[_0x57be('0x31')](_[_0x57be('0x4f')](_0x161dd5[_0x57be('0x2f')],_0x38480b[_0x57be('0x31')]));if(_0x161dd5[_0x57be('0x2f')][_0x57be('0x3c')]){_0x2f8ad4[_0x57be('0x39')]=_[_0x57be('0x3a')](_0x2f8ad4[_0x57be('0x39')],{'$or':_[_0x57be('0x2e')](_0x2f8ad4['attributes'],function(_0x58bd72){var _0x20b6bc={};_0x20b6bc[_0x58bd72]={'$like':'%'+_0x161dd5[_0x57be('0x2f')][_0x57be('0x3c')]+'%'};return _0x20b6bc;})});}_0x2f8ad4=_['merge']({},_0x2f8ad4,_0x161dd5['options']);return _0x38bb33[_0x57be('0x52')](_0x2f8ad4);}})[_0x57be('0x24')](function(_0x111d99){if(_0x111d99){_0x22044c=_0x111d99[_0x57be('0x4e')];if(!_0x161dd5['query'][_0x57be('0x35')]('nolimit')){_0x2f8ad4[_0x57be('0x1c')]=qs['limit'](_0x161dd5[_0x57be('0x2f')]['limit']);_0x2f8ad4[_0x57be('0x1a')]=qs[_0x57be('0x1a')](_0x161dd5[_0x57be('0x2f')][_0x57be('0x1a')]);}return _0x38bb33[_0x57be('0x52')](_0x2f8ad4);}})['then'](function(_0x380c64){if(_0x380c64){return _0x380c64?{'count':_0x22044c,'rows':_0x380c64}:null;}})['then'](respondWithResult(_0x2b8103,null))[_0x57be('0x43')](handleError(_0x2b8103,null));};exports[_0x57be('0x54')]=function(_0x5abc36,_0x4b6753,_0x326052){if(_0x5abc36[_0x57be('0x49')]['id']){delete _0x5abc36[_0x57be('0x49')]['id'];}return db[_0x57be('0x3e')][_0x57be('0x4c')]({'where':{'id':_0x5abc36[_0x57be('0x4a')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x4b6753,null))['then'](function(_0x25dd3b){if(_0x25dd3b){return _0x25dd3b[_0x57be('0x54')](_0x5abc36['body'][_0x57be('0x55')]||[]);}return null;})['then'](respondWithResult(_0x4b6753,null))[_0x57be('0x43')](handleError(_0x4b6753,null));}; \ No newline at end of file +var _0xa429=['length','model','hasOwnProperty','nolimit','order','where','merge','type','VIRTUAL','filter','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','getFields','findOne','DeskField','sort','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','map','query','keys','filters','attributes','fields'];(function(_0x1b6636,_0x58651a){var _0x21daeb=function(_0x4f347b){while(--_0x4f347b){_0x1b6636['push'](_0x1b6636['shift']());}};_0x21daeb(++_0x58651a);}(_0xa429,0x120));var _0x9a42=function(_0x1806da,_0xe441ff){_0x1806da=_0x1806da-0x0;var _0xbced1c=_0xa429[_0x1806da];return _0xbced1c;};'use strict';var emlformat=require(_0x9a42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a42('0x1'));var jsonpatch=require(_0x9a42('0x2'));var rp=require(_0x9a42('0x3'));var moment=require(_0x9a42('0x4'));var BPromise=require(_0x9a42('0x5'));var Mustache=require(_0x9a42('0x6'));var util=require('util');var path=require(_0x9a42('0x7'));var sox=require(_0x9a42('0x8'));var csv=require(_0x9a42('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a42('0xa'));var _=require(_0x9a42('0xb'));var squel=require(_0x9a42('0xc'));var crypto=require(_0x9a42('0xd'));var jsforce=require(_0x9a42('0xe'));var deskjs=require(_0x9a42('0xf'));var toCsv=require(_0x9a42('0x9'));var querystring=require(_0x9a42('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a42('0x11'));var authService=require(_0x9a42('0x12'));var qs=require(_0x9a42('0x13'));var as=require(_0x9a42('0x14'));var hardwareService=require(_0x9a42('0x15'));var logger=require(_0x9a42('0x16'))(_0x9a42('0x17'));var utils=require(_0x9a42('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9a42('0x19'));var db=require(_0x9a42('0x1a'))['db'];function respondWithStatusCode(_0x9f983a,_0x455062){_0x455062=_0x455062||0xcc;return function(_0x2f9b6b){if(_0x2f9b6b){return _0x9f983a[_0x9a42('0x1b')](_0x455062);}return _0x9f983a['status'](_0x455062)['end']();};}function respondWithResult(_0x32a5ac,_0x90a201){_0x90a201=_0x90a201||0xc8;return function(_0x5226eb){if(_0x5226eb){return _0x32a5ac[_0x9a42('0x1c')](_0x90a201)['json'](_0x5226eb);}};}function respondWithFilteredResult(_0x368e74,_0x2470b2){return function(_0x293471){if(_0x293471){var _0x2de816=typeof _0x2470b2[_0x9a42('0x1d')]===_0x9a42('0x1e')&&typeof _0x2470b2[_0x9a42('0x1f')]===_0x9a42('0x1e');var _0x141b72=_0x293471[_0x9a42('0x20')];var _0x530080=_0x2de816?0x0:_0x2470b2[_0x9a42('0x1d')];var _0xf14f50=_0x2de816?_0x293471[_0x9a42('0x20')]:_0x2470b2[_0x9a42('0x1d')]+_0x2470b2[_0x9a42('0x1f')];var _0x4fac39;if(_0xf14f50>=_0x141b72){_0xf14f50=_0x141b72;_0x4fac39=0xc8;}else{_0x4fac39=0xce;}_0x368e74[_0x9a42('0x1c')](_0x4fac39);return _0x368e74['set'](_0x9a42('0x21'),_0x530080+'-'+_0xf14f50+'/'+_0x141b72)[_0x9a42('0x22')](_0x293471);}return null;};}function patchUpdates(_0x510cf0){return function(_0x11931e){try{jsonpatch[_0x9a42('0x23')](_0x11931e,_0x510cf0,!![]);}catch(_0x3eab33){return BPromise[_0x9a42('0x24')](_0x3eab33);}return _0x11931e[_0x9a42('0x25')]();};}function saveUpdates(_0x5dfc60,_0x5394c4){return function(_0x1d7af0){if(_0x1d7af0){return _0x1d7af0[_0x9a42('0x26')](_0x5dfc60)[_0x9a42('0x27')](function(_0x2d1b77){return _0x2d1b77;});}return null;};}function removeEntity(_0x2b141f,_0x33cacb){return function(_0x38fed5){if(_0x38fed5){return _0x38fed5[_0x9a42('0x28')]()['then'](function(){_0x2b141f[_0x9a42('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36d574,_0x3b6eec){return function(_0x5bfd4b){if(!_0x5bfd4b){_0x36d574[_0x9a42('0x1b')](0x194);}return _0x5bfd4b;};}function handleError(_0x2c24ff,_0x466f40){_0x466f40=_0x466f40||0x1f4;return function(_0x383b5e){logger['error'](_0x383b5e['stack']);if(_0x383b5e[_0x9a42('0x29')]){delete _0x383b5e['name'];}_0x2c24ff[_0x9a42('0x1c')](_0x466f40)[_0x9a42('0x2a')](_0x383b5e);};}exports[_0x9a42('0x2b')]=function(_0x5afd38,_0x376582){var _0x17de9b={},_0x31d648={},_0x2534c4={'count':0x0,'rows':[]};var _0x38e99d=_['map'](db['DeskConfiguration'][_0x9a42('0x2c')],function(_0x16be37){return{'name':_0x16be37[_0x9a42('0x2d')],'type':_0x16be37['type']['key']};});_0x31d648['model']=_[_0x9a42('0x2e')](_0x38e99d,_0x9a42('0x29'));_0x31d648[_0x9a42('0x2f')]=_[_0x9a42('0x30')](_0x5afd38[_0x9a42('0x2f')]);_0x31d648[_0x9a42('0x31')]=_['intersection'](_0x31d648['model'],_0x31d648[_0x9a42('0x2f')]);_0x17de9b[_0x9a42('0x32')]=_['intersection'](_0x31d648['model'],qs[_0x9a42('0x33')](_0x5afd38['query'][_0x9a42('0x33')]));_0x17de9b['attributes']=_0x17de9b['attributes'][_0x9a42('0x34')]?_0x17de9b[_0x9a42('0x32')]:_0x31d648[_0x9a42('0x35')];if(!_0x5afd38[_0x9a42('0x2f')][_0x9a42('0x36')](_0x9a42('0x37'))){_0x17de9b['limit']=qs['limit'](_0x5afd38[_0x9a42('0x2f')][_0x9a42('0x1f')]);_0x17de9b[_0x9a42('0x1d')]=qs['offset'](_0x5afd38['query']['offset']);}_0x17de9b[_0x9a42('0x38')]=qs['sort'](_0x5afd38[_0x9a42('0x2f')]['sort']);_0x17de9b[_0x9a42('0x39')]=qs['filters'](_['pick'](_0x5afd38['query'],_0x31d648['filters']),_0x38e99d);if(_0x5afd38[_0x9a42('0x2f')]['filter']){_0x17de9b[_0x9a42('0x39')]=_[_0x9a42('0x3a')](_0x17de9b[_0x9a42('0x39')],{'$or':_[_0x9a42('0x2e')](_0x38e99d,function(_0x256079){if(_0x256079[_0x9a42('0x3b')]!==_0x9a42('0x3c')){var _0x43b0eb={};_0x43b0eb[_0x256079[_0x9a42('0x29')]]={'$like':'%'+_0x5afd38['query'][_0x9a42('0x3d')]+'%'};return _0x43b0eb;}})});}_0x17de9b=_[_0x9a42('0x3a')]({},_0x17de9b,_0x5afd38[_0x9a42('0x3e')]);var _0x404f53={'where':_0x17de9b[_0x9a42('0x39')]};return db[_0x9a42('0x3f')][_0x9a42('0x20')](_0x404f53)['then'](function(_0x54a242){_0x2534c4[_0x9a42('0x20')]=_0x54a242;if(_0x5afd38[_0x9a42('0x2f')][_0x9a42('0x40')]){_0x17de9b[_0x9a42('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x9a42('0x42')](_0x17de9b);})[_0x9a42('0x27')](function(_0xd34bad){_0x2534c4[_0x9a42('0x43')]=_0xd34bad;return _0x2534c4;})[_0x9a42('0x27')](respondWithFilteredResult(_0x376582,_0x17de9b))[_0x9a42('0x44')](handleError(_0x376582,null));};exports[_0x9a42('0x45')]=function(_0x4e1100,_0x48e308){var _0x5ead52={'raw':![],'where':{'id':_0x4e1100[_0x9a42('0x46')]['id']}},_0x45e001={};_0x45e001[_0x9a42('0x35')]=_['keys'](db[_0x9a42('0x3f')][_0x9a42('0x2c')]);_0x45e001[_0x9a42('0x2f')]=_[_0x9a42('0x30')](_0x4e1100[_0x9a42('0x2f')]);_0x45e001[_0x9a42('0x31')]=_[_0x9a42('0x47')](_0x45e001['model'],_0x45e001[_0x9a42('0x2f')]);_0x5ead52[_0x9a42('0x32')]=_[_0x9a42('0x47')](_0x45e001[_0x9a42('0x35')],qs[_0x9a42('0x33')](_0x4e1100[_0x9a42('0x2f')][_0x9a42('0x33')]));_0x5ead52[_0x9a42('0x32')]=_0x5ead52[_0x9a42('0x32')]['length']?_0x5ead52[_0x9a42('0x32')]:_0x45e001['model'];if(_0x4e1100[_0x9a42('0x2f')][_0x9a42('0x40')]){_0x5ead52[_0x9a42('0x41')]=[{'all':!![]}];}_0x5ead52=_[_0x9a42('0x3a')]({},_0x5ead52,_0x4e1100[_0x9a42('0x3e')]);return db[_0x9a42('0x3f')][_0x9a42('0x48')](_0x5ead52)['then'](handleEntityNotFound(_0x48e308,null))['then'](respondWithResult(_0x48e308,null))['catch'](handleError(_0x48e308,null));};exports[_0x9a42('0x49')]=function(_0x501bd3,_0x2785b9){return db['DeskConfiguration'][_0x9a42('0x49')](_0x501bd3[_0x9a42('0x4a')],{})[_0x9a42('0x27')](respondWithResult(_0x2785b9,0xc9))[_0x9a42('0x44')](handleError(_0x2785b9,null));};exports[_0x9a42('0x26')]=function(_0x1a1a59,_0x252744){if(_0x1a1a59['body']['id']){delete _0x1a1a59[_0x9a42('0x4a')]['id'];}return db[_0x9a42('0x3f')]['find']({'where':{'id':_0x1a1a59[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x252744,null))[_0x9a42('0x27')](saveUpdates(_0x1a1a59['body'],null))[_0x9a42('0x27')](respondWithResult(_0x252744,null))[_0x9a42('0x44')](handleError(_0x252744,null));};exports[_0x9a42('0x28')]=function(_0x49372e,_0x37cbea){return db['DeskConfiguration'][_0x9a42('0x48')]({'where':{'id':_0x49372e['params']['id']}})['then'](handleEntityNotFound(_0x37cbea,null))[_0x9a42('0x27')](removeEntity(_0x37cbea,null))[_0x9a42('0x44')](handleError(_0x37cbea,null));};exports[_0x9a42('0x4b')]=function(_0x177854,_0x127ef5,_0x5b840c){var _0x14c7b4={};var _0x2095a3={};var _0x3eee0a;var _0x4ce7bc;return db['DeskConfiguration'][_0x9a42('0x4c')]({'where':{'id':_0x177854[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x127ef5,null))[_0x9a42('0x27')](function(_0x238ab7){if(_0x238ab7){_0x3eee0a=_0x238ab7;_0x2095a3['model']=_[_0x9a42('0x30')](db[_0x9a42('0x4d')][_0x9a42('0x2c')]);_0x2095a3[_0x9a42('0x2f')]=_[_0x9a42('0x30')](_0x177854[_0x9a42('0x2f')]);_0x2095a3[_0x9a42('0x31')]=_[_0x9a42('0x47')](_0x2095a3[_0x9a42('0x35')],_0x2095a3[_0x9a42('0x2f')]);_0x14c7b4['attributes']=_[_0x9a42('0x47')](_0x2095a3['model'],qs['fields'](_0x177854['query'][_0x9a42('0x33')]));_0x14c7b4[_0x9a42('0x32')]=_0x14c7b4[_0x9a42('0x32')][_0x9a42('0x34')]?_0x14c7b4[_0x9a42('0x32')]:_0x2095a3[_0x9a42('0x35')];_0x14c7b4['order']=qs[_0x9a42('0x4e')](_0x177854['query'][_0x9a42('0x4e')]);_0x14c7b4[_0x9a42('0x39')]=qs[_0x9a42('0x31')](_[_0x9a42('0x4f')](_0x177854['query'],_0x2095a3[_0x9a42('0x31')]));if(_0x177854[_0x9a42('0x2f')]['filter']){_0x14c7b4[_0x9a42('0x39')]=_[_0x9a42('0x3a')](_0x14c7b4[_0x9a42('0x39')],{'$or':_[_0x9a42('0x2e')](_0x14c7b4[_0x9a42('0x32')],function(_0x202944){var _0x423f8b={};_0x423f8b[_0x202944]={'$like':'%'+_0x177854[_0x9a42('0x2f')]['filter']+'%'};return _0x423f8b;})});}_0x14c7b4=_['merge']({},_0x14c7b4,_0x177854['options']);return _0x3eee0a['getFields'](_0x14c7b4);}})[_0x9a42('0x27')](function(_0x2cfe28){if(_0x2cfe28){_0x4ce7bc=_0x2cfe28[_0x9a42('0x34')];if(!_0x177854[_0x9a42('0x2f')][_0x9a42('0x36')]('nolimit')){_0x14c7b4[_0x9a42('0x1f')]=qs[_0x9a42('0x1f')](_0x177854['query']['limit']);_0x14c7b4['offset']=qs['offset'](_0x177854[_0x9a42('0x2f')][_0x9a42('0x1d')]);}return _0x3eee0a['getFields'](_0x14c7b4);}})[_0x9a42('0x27')](function(_0x5c93e4){if(_0x5c93e4){return _0x5c93e4?{'count':_0x4ce7bc,'rows':_0x5c93e4}:null;}})[_0x9a42('0x27')](respondWithResult(_0x127ef5,null))[_0x9a42('0x44')](handleError(_0x127ef5,null));};exports[_0x9a42('0x50')]=function(_0x43612b,_0x2cec9d,_0x27be1b){var _0x20dffe={};var _0x5d131b={};var _0x25b88e;var _0x2b88d5;return db[_0x9a42('0x3f')][_0x9a42('0x4c')]({'where':{'id':_0x43612b[_0x9a42('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cec9d,null))[_0x9a42('0x27')](function(_0x55541b){if(_0x55541b){_0x25b88e=_0x55541b;_0x5d131b[_0x9a42('0x35')]=_['keys'](db[_0x9a42('0x4d')][_0x9a42('0x2c')]);_0x5d131b[_0x9a42('0x2f')]=_['keys'](_0x43612b[_0x9a42('0x2f')]);_0x5d131b[_0x9a42('0x31')]=_[_0x9a42('0x47')](_0x5d131b[_0x9a42('0x35')],_0x5d131b[_0x9a42('0x2f')]);_0x20dffe['attributes']=_[_0x9a42('0x47')](_0x5d131b[_0x9a42('0x35')],qs[_0x9a42('0x33')](_0x43612b[_0x9a42('0x2f')][_0x9a42('0x33')]));_0x20dffe[_0x9a42('0x32')]=_0x20dffe[_0x9a42('0x32')]['length']?_0x20dffe[_0x9a42('0x32')]:_0x5d131b['model'];_0x20dffe['order']=qs[_0x9a42('0x4e')](_0x43612b['query'][_0x9a42('0x4e')]);_0x20dffe[_0x9a42('0x39')]=qs[_0x9a42('0x31')](_[_0x9a42('0x4f')](_0x43612b[_0x9a42('0x2f')],_0x5d131b[_0x9a42('0x31')]));if(_0x43612b[_0x9a42('0x2f')][_0x9a42('0x3d')]){_0x20dffe[_0x9a42('0x39')]=_[_0x9a42('0x3a')](_0x20dffe[_0x9a42('0x39')],{'$or':_[_0x9a42('0x2e')](_0x20dffe[_0x9a42('0x32')],function(_0x120ad1){var _0x233e07={};_0x233e07[_0x120ad1]={'$like':'%'+_0x43612b[_0x9a42('0x2f')]['filter']+'%'};return _0x233e07;})});}_0x20dffe=_['merge']({},_0x20dffe,_0x43612b[_0x9a42('0x3e')]);return _0x25b88e[_0x9a42('0x50')](_0x20dffe);}})[_0x9a42('0x27')](function(_0x262b17){if(_0x262b17){_0x2b88d5=_0x262b17[_0x9a42('0x34')];if(!_0x43612b[_0x9a42('0x2f')][_0x9a42('0x36')](_0x9a42('0x37'))){_0x20dffe[_0x9a42('0x1f')]=qs[_0x9a42('0x1f')](_0x43612b[_0x9a42('0x2f')][_0x9a42('0x1f')]);_0x20dffe[_0x9a42('0x1d')]=qs[_0x9a42('0x1d')](_0x43612b['query']['offset']);}return _0x25b88e[_0x9a42('0x50')](_0x20dffe);}})[_0x9a42('0x27')](function(_0x32702b){if(_0x32702b){return _0x32702b?{'count':_0x2b88d5,'rows':_0x32702b}:null;}})[_0x9a42('0x27')](respondWithResult(_0x2cec9d,null))[_0x9a42('0x44')](handleError(_0x2cec9d,null));};exports['getDescriptions']=function(_0x3f628c,_0x5ef4b2,_0x40d23d){var _0x47c612={};var _0x350832={};var _0x4a3845;var _0x5da1c0;return db['DeskConfiguration'][_0x9a42('0x4c')]({'where':{'id':_0x3f628c[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x5ef4b2,null))[_0x9a42('0x27')](function(_0x55a216){if(_0x55a216){_0x4a3845=_0x55a216;_0x350832[_0x9a42('0x35')]=_[_0x9a42('0x30')](db[_0x9a42('0x4d')][_0x9a42('0x2c')]);_0x350832[_0x9a42('0x2f')]=_['keys'](_0x3f628c[_0x9a42('0x2f')]);_0x350832[_0x9a42('0x31')]=_['intersection'](_0x350832['model'],_0x350832[_0x9a42('0x2f')]);_0x47c612['attributes']=_[_0x9a42('0x47')](_0x350832[_0x9a42('0x35')],qs[_0x9a42('0x33')](_0x3f628c[_0x9a42('0x2f')][_0x9a42('0x33')]));_0x47c612[_0x9a42('0x32')]=_0x47c612[_0x9a42('0x32')]['length']?_0x47c612[_0x9a42('0x32')]:_0x350832[_0x9a42('0x35')];_0x47c612[_0x9a42('0x38')]=qs['sort'](_0x3f628c[_0x9a42('0x2f')][_0x9a42('0x4e')]);_0x47c612[_0x9a42('0x39')]=qs[_0x9a42('0x31')](_[_0x9a42('0x4f')](_0x3f628c['query'],_0x350832[_0x9a42('0x31')]));if(_0x3f628c['query'][_0x9a42('0x3d')]){_0x47c612[_0x9a42('0x39')]=_[_0x9a42('0x3a')](_0x47c612[_0x9a42('0x39')],{'$or':_[_0x9a42('0x2e')](_0x47c612[_0x9a42('0x32')],function(_0xdd15b6){var _0x5a6c9d={};_0x5a6c9d[_0xdd15b6]={'$like':'%'+_0x3f628c['query'][_0x9a42('0x3d')]+'%'};return _0x5a6c9d;})});}_0x47c612=_['merge']({},_0x47c612,_0x3f628c[_0x9a42('0x3e')]);return _0x4a3845[_0x9a42('0x51')](_0x47c612);}})[_0x9a42('0x27')](function(_0x17018f){if(_0x17018f){_0x5da1c0=_0x17018f[_0x9a42('0x34')];if(!_0x3f628c['query'][_0x9a42('0x36')](_0x9a42('0x37'))){_0x47c612['limit']=qs[_0x9a42('0x1f')](_0x3f628c[_0x9a42('0x2f')]['limit']);_0x47c612[_0x9a42('0x1d')]=qs[_0x9a42('0x1d')](_0x3f628c['query'][_0x9a42('0x1d')]);}return _0x4a3845['getDescriptions'](_0x47c612);}})['then'](function(_0x3abd88){if(_0x3abd88){return _0x3abd88?{'count':_0x5da1c0,'rows':_0x3abd88}:null;}})[_0x9a42('0x27')](respondWithResult(_0x5ef4b2,null))[_0x9a42('0x44')](handleError(_0x5ef4b2,null));};exports['getTags']=function(_0x5c1719,_0x35c06e,_0x4346aa){var _0x1ff5c5={};var _0x40ff86={};var _0x4f7847;var _0x2986ea;return db[_0x9a42('0x3f')][_0x9a42('0x4c')]({'where':{'id':_0x5c1719[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x35c06e,null))[_0x9a42('0x27')](function(_0x419499){if(_0x419499){_0x4f7847=_0x419499;_0x40ff86['model']=_[_0x9a42('0x30')](db['Tag'][_0x9a42('0x2c')]);_0x40ff86['query']=_['keys'](_0x5c1719[_0x9a42('0x2f')]);_0x40ff86['filters']=_[_0x9a42('0x47')](_0x40ff86[_0x9a42('0x35')],_0x40ff86['query']);_0x1ff5c5['attributes']=_[_0x9a42('0x47')](_0x40ff86[_0x9a42('0x35')],qs[_0x9a42('0x33')](_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x33')]));_0x1ff5c5[_0x9a42('0x32')]=_0x1ff5c5[_0x9a42('0x32')][_0x9a42('0x34')]?_0x1ff5c5[_0x9a42('0x32')]:_0x40ff86[_0x9a42('0x35')];_0x1ff5c5[_0x9a42('0x38')]=qs[_0x9a42('0x4e')](_0x5c1719[_0x9a42('0x2f')]['sort']);_0x1ff5c5[_0x9a42('0x39')]=qs[_0x9a42('0x31')](_['pick'](_0x5c1719[_0x9a42('0x2f')],_0x40ff86[_0x9a42('0x31')]));if(_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x3d')]){_0x1ff5c5[_0x9a42('0x39')]=_['merge'](_0x1ff5c5['where'],{'$or':_['map'](_0x1ff5c5[_0x9a42('0x32')],function(_0x1f51f9){var _0x5618ad={};_0x5618ad[_0x1f51f9]={'$like':'%'+_0x5c1719['query']['filter']+'%'};return _0x5618ad;})});}_0x1ff5c5=_[_0x9a42('0x3a')]({},_0x1ff5c5,_0x5c1719[_0x9a42('0x3e')]);return _0x4f7847[_0x9a42('0x52')](_0x1ff5c5);}})[_0x9a42('0x27')](function(_0x3fd197){if(_0x3fd197){_0x2986ea=_0x3fd197[_0x9a42('0x34')];if(!_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x36')](_0x9a42('0x37'))){_0x1ff5c5[_0x9a42('0x1f')]=qs['limit'](_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x1f')]);_0x1ff5c5['offset']=qs[_0x9a42('0x1d')](_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x1d')]);}return _0x4f7847[_0x9a42('0x52')](_0x1ff5c5);}})[_0x9a42('0x27')](function(_0x873539){if(_0x873539){return _0x873539?{'count':_0x2986ea,'rows':_0x873539}:null;}})['then'](respondWithResult(_0x35c06e,null))[_0x9a42('0x44')](handleError(_0x35c06e,null));};exports[_0x9a42('0x53')]=function(_0x395c37,_0x4eb05a,_0x3a4c76){if(_0x395c37[_0x9a42('0x4a')]['id']){delete _0x395c37[_0x9a42('0x4a')]['id'];}return db[_0x9a42('0x3f')][_0x9a42('0x4c')]({'where':{'id':_0x395c37[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x4eb05a,null))[_0x9a42('0x27')](function(_0xb3ec4f){if(_0xb3ec4f){return _0xb3ec4f[_0x9a42('0x53')](_0x395c37['body'][_0x9a42('0x54')]||[]);}return null;})[_0x9a42('0x27')](respondWithResult(_0x4eb05a,null))[_0x9a42('0x44')](handleError(_0x4eb05a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ffca2d1..d950b9d 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 _0xd96b=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x4e321f,_0x4f0209){var _0x42687d=function(_0x510458){while(--_0x510458){_0x4e321f['push'](_0x4e321f['shift']());}};_0x42687d(++_0x4f0209);}(_0xd96b,0x196));var _0xbd96=function(_0x1b582b,_0x904dbf){_0x1b582b=_0x1b582b-0x0;var _0x1cc573=_0xd96b[_0x1b582b];return _0x1cc573;};'use strict';var _=require(_0xbd96('0x0'));var util=require(_0xbd96('0x1'));var logger=require(_0xbd96('0x2'))(_0xbd96('0x3'));var moment=require(_0xbd96('0x4'));var BPromise=require(_0xbd96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd96('0x6'));var config=require(_0xbd96('0x7'));var attributes=require(_0xbd96('0x8'));module[_0xbd96('0x9')]=function(_0x195135,_0x2ff9c1){return _0x195135[_0xbd96('0xa')](_0xbd96('0xb'),attributes,{'tableName':_0xbd96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93d3=['../../config/logger','path','rimraf','../../config/environment','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93d3,0x1e9));var _0x393d=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x93d3[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x393d('0x0'));var util=require('util');var logger=require(_0x393d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x393d('0x2'));var rimraf=require(_0x393d('0x3'));var config=require(_0x393d('0x4'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x5192c9,_0x4ae031){return _0x5192c9['define']('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index f089c22..ed946ba 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 _0x5c21=['http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5c21,0x90));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x15c2('0x0'));var moment=require(_0x15c2('0x1'));var BPromise=require(_0x15c2('0x2'));var rs=require(_0x15c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15c2('0x4'))['db'];var utils=require(_0x15c2('0x5'));var logger=require(_0x15c2('0x6'))(_0x15c2('0x7'));var config=require(_0x15c2('0x8'));var jayson=require(_0x15c2('0x9'));var client=jayson['client'][_0x15c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e1e25,_0xf7dd99,_0x1a78e6){return new BPromise(function(_0x3fc8ac,_0x4f6891){return client[_0x15c2('0xb')](_0x5e1e25,_0x1a78e6)['then'](function(_0x336780){logger[_0x15c2('0xc')](_0x15c2('0xd'),_0xf7dd99,_0x15c2('0xe'));logger['debug'](_0x15c2('0xf'),_0xf7dd99,'request\x20sent',JSON[_0x15c2('0x10')](_0x336780));if(_0x336780[_0x15c2('0x11')]){if(_0x336780[_0x15c2('0x11')][_0x15c2('0x12')]===0x1f4){logger[_0x15c2('0x11')](_0x15c2('0xd'),_0xf7dd99,_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);return _0x4f6891(_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);}logger['error'](_0x15c2('0xd'),_0xf7dd99,_0x336780['error'][_0x15c2('0x13')]);return _0x3fc8ac(_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);}else{logger[_0x15c2('0xc')](_0x15c2('0xd'),_0xf7dd99,_0x15c2('0xe'));_0x3fc8ac(_0x336780[_0x15c2('0x14')][_0x15c2('0x13')]);}})[_0x15c2('0x15')](function(_0x7a9f15){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xf7dd99,_0x7a9f15);_0x4f6891(_0x7a9f15);});});} \ No newline at end of file +var _0x8254=['then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xf1c26,_0x234e15){var _0x36287c=function(_0x25838a){while(--_0x25838a){_0xf1c26['push'](_0xf1c26['shift']());}};_0x36287c(++_0x234e15);}(_0x8254,0x95));var _0x4825=function(_0x43a7e3,_0x27139e){_0x43a7e3=_0x43a7e3-0x0;var _0x2ec240=_0x8254[_0x43a7e3];return _0x2ec240;};'use strict';var _=require(_0x4825('0x0'));var util=require('util');var moment=require(_0x4825('0x1'));var BPromise=require('bluebird');var rs=require(_0x4825('0x2'));var fs=require('fs');var Redis=require(_0x4825('0x3'));var db=require(_0x4825('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4825('0x5'))(_0x4825('0x6'));var config=require(_0x4825('0x7'));var jayson=require(_0x4825('0x8'));var client=jayson[_0x4825('0x9')][_0x4825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a071e,_0x28332c,_0x20cd0e){return new BPromise(function(_0x3c8ed4,_0x547731){return client[_0x4825('0xb')](_0x5a071e,_0x20cd0e)[_0x4825('0xc')](function(_0x2a36c5){logger[_0x4825('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x28332c,_0x4825('0xe'));logger[_0x4825('0xf')](_0x4825('0x10'),_0x28332c,'request\x20sent',JSON[_0x4825('0x11')](_0x2a36c5));if(_0x2a36c5[_0x4825('0x12')]){if(_0x2a36c5[_0x4825('0x12')][_0x4825('0x13')]===0x1f4){logger[_0x4825('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x28332c,_0x2a36c5[_0x4825('0x12')][_0x4825('0x14')]);return _0x547731(_0x2a36c5[_0x4825('0x12')][_0x4825('0x14')]);}logger[_0x4825('0x12')](_0x4825('0x15'),_0x28332c,_0x2a36c5[_0x4825('0x12')][_0x4825('0x14')]);return _0x3c8ed4(_0x2a36c5[_0x4825('0x12')]['message']);}else{logger[_0x4825('0xd')](_0x4825('0x15'),_0x28332c,_0x4825('0xe'));_0x3c8ed4(_0x2a36c5[_0x4825('0x16')]['message']);}})['catch'](function(_0x5286fb){logger[_0x4825('0x12')](_0x4825('0x15'),_0x28332c,_0x5286fb);_0x547731(_0x5286fb);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 5d6829e..90ef7a3 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 _0x41a6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0x30c83b,_0x1773d9){var _0x14bbc9=function(_0x3b034b){while(--_0x3b034b){_0x30c83b['push'](_0x30c83b['shift']());}};_0x14bbc9(++_0x1773d9);}(_0x41a6,0x1c8));var _0x641a=function(_0x14ab22,_0x1550c5){_0x14ab22=_0x14ab22-0x0;var _0x2447e5=_0x41a6[_0x14ab22];return _0x2447e5;};'use strict';var multer=require(_0x641a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x641a('0x1'));var express=require('express');var router=express[_0x641a('0x2')]();var fs_extra=require(_0x641a('0x3'));var auth=require(_0x641a('0x4'));var interaction=require(_0x641a('0x5'));var config=require(_0x641a('0x6'));var controller=require('./intDeskField.controller');router[_0x641a('0x7')]('/',auth[_0x641a('0x8')](),controller[_0x641a('0x9')]);router[_0x641a('0x7')](_0x641a('0xa'),auth[_0x641a('0x8')](),controller['show']);router[_0x641a('0xb')]('/',auth['isAuthenticated'](),controller[_0x641a('0xc')]);router[_0x641a('0xd')](_0x641a('0xa'),auth[_0x641a('0x8')](),controller[_0x641a('0xe')]);router[_0x641a('0xf')](_0x641a('0xa'),auth[_0x641a('0x8')](),controller['destroy']);module[_0x641a('0x10')]=router; \ No newline at end of file +var _0x20d4=['create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post'];(function(_0xdfe5ed,_0x1762f0){var _0x36b3b=function(_0x285eaf){while(--_0x285eaf){_0xdfe5ed['push'](_0xdfe5ed['shift']());}};_0x36b3b(++_0x1762f0);}(_0x20d4,0xdc));var _0x420d=function(_0x23642e,_0x48ad89){_0x23642e=_0x23642e-0x0;var _0xa76ef=_0x20d4[_0x23642e];return _0xa76ef;};'use strict';var multer=require(_0x420d('0x0'));var util=require(_0x420d('0x1'));var path=require(_0x420d('0x2'));var timeout=require(_0x420d('0x3'));var express=require(_0x420d('0x4'));var router=express[_0x420d('0x5')]();var fs_extra=require(_0x420d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x420d('0x7'));var config=require(_0x420d('0x8'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x420d('0x9')](),controller[_0x420d('0xa')]);router[_0x420d('0xb')](_0x420d('0xc'),auth[_0x420d('0x9')](),controller['show']);router[_0x420d('0xd')]('/',auth[_0x420d('0x9')](),controller[_0x420d('0xe')]);router[_0x420d('0xf')](_0x420d('0xc'),auth[_0x420d('0x9')](),controller[_0x420d('0x10')]);router[_0x420d('0x11')](_0x420d('0xc'),auth[_0x420d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 460a85a..84ca103 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 _0x7e81=['keyValue','STRING','ENUM','variable','customVariable','BOOLEAN','exports','string'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x7e81,0x136));var _0x17e8=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x7e81[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require('sequelize');module[_0x17e8('0x0')]={'type':{'type':Sequelize['ENUM'](_0x17e8('0x1'),'variable','customVariable',_0x17e8('0x2'),'picklist'),'defaultValue':_0x17e8('0x1')},'content':{'type':Sequelize[_0x17e8('0x3')]},'key':{'type':Sequelize[_0x17e8('0x3')]},'keyType':{'type':Sequelize[_0x17e8('0x4')](_0x17e8('0x1'),_0x17e8('0x5'),_0x17e8('0x6'))},'keyContent':{'type':Sequelize[_0x17e8('0x3')]},'idField':{'type':Sequelize[_0x17e8('0x3')]},'nameField':{'type':Sequelize[_0x17e8('0x3')]},'customField':{'type':Sequelize[_0x17e8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x17e8('0x3')]}}; \ No newline at end of file +var _0x563c=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x5a300b,_0x3183f6){var _0xaea19f=function(_0x47fe59){while(--_0x47fe59){_0x5a300b['push'](_0x5a300b['shift']());}};_0xaea19f(++_0x3183f6);}(_0x563c,0xc9));var _0xc563=function(_0x4f90dd,_0xd28e6c){_0x4f90dd=_0x4f90dd-0x0;var _0x294603=_0x563c[_0x4f90dd];return _0x294603;};'use strict';var Sequelize=require(_0xc563('0x0'));module[_0xc563('0x1')]={'type':{'type':Sequelize[_0xc563('0x2')]('string',_0xc563('0x3'),_0xc563('0x4'),'keyValue',_0xc563('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc563('0x6'),_0xc563('0x3'),_0xc563('0x4'))},'keyContent':{'type':Sequelize[_0xc563('0x7')]},'idField':{'type':Sequelize[_0xc563('0x7')]},'nameField':{'type':Sequelize[_0xc563('0x7')]},'customField':{'type':Sequelize[_0xc563('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc563('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 57b5efe..ee58a94 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 _0x9829=['end','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x11fd66,_0x46c02d){var _0xb514b7=function(_0x40a8fc){while(--_0x40a8fc){_0x11fd66['push'](_0x11fd66['shift']());}};_0xb514b7(++_0x46c02d);}(_0x9829,0xc4));var _0x9982=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x9829[_0x2d2ca2];return _0x48489d;};'use strict';var emlformat=require(_0x9982('0x0'));var rimraf=require(_0x9982('0x1'));var zipdir=require(_0x9982('0x2'));var jsonpatch=require(_0x9982('0x3'));var rp=require(_0x9982('0x4'));var moment=require('moment');var BPromise=require(_0x9982('0x5'));var Mustache=require(_0x9982('0x6'));var util=require(_0x9982('0x7'));var path=require('path');var sox=require(_0x9982('0x8'));var csv=require(_0x9982('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9982('0xa'));var squel=require(_0x9982('0xb'));var crypto=require('crypto');var jsforce=require(_0x9982('0xc'));var deskjs=require(_0x9982('0xd'));var toCsv=require(_0x9982('0x9'));var querystring=require(_0x9982('0xe'));var Papa=require(_0x9982('0xf'));var Redis=require(_0x9982('0x10'));var authService=require(_0x9982('0x11'));var qs=require(_0x9982('0x12'));var as=require(_0x9982('0x13'));var hardwareService=require(_0x9982('0x14'));var logger=require(_0x9982('0x15'))(_0x9982('0x16'));var utils=require(_0x9982('0x17'));var config=require(_0x9982('0x18'));var licenseUtil=require(_0x9982('0x19'));var db=require(_0x9982('0x1a'))['db'];function respondWithStatusCode(_0x390539,_0x4637ca){_0x4637ca=_0x4637ca||0xcc;return function(_0x48e81f){if(_0x48e81f){return _0x390539[_0x9982('0x1b')](_0x4637ca);}return _0x390539[_0x9982('0x1c')](_0x4637ca)['end']();};}function respondWithResult(_0x3ca506,_0x5699c9){_0x5699c9=_0x5699c9||0xc8;return function(_0x39d32c){if(_0x39d32c){return _0x3ca506[_0x9982('0x1c')](_0x5699c9)[_0x9982('0x1d')](_0x39d32c);}};}function respondWithFilteredResult(_0x199688,_0x128118){return function(_0xcd1405){if(_0xcd1405){var _0x2883f6=typeof _0x128118[_0x9982('0x1e')]===_0x9982('0x1f')&&typeof _0x128118['limit']===_0x9982('0x1f');var _0x5385cc=_0xcd1405[_0x9982('0x20')];var _0x44b5ed=_0x2883f6?0x0:_0x128118['offset'];var _0x2558e1=_0x2883f6?_0xcd1405[_0x9982('0x20')]:_0x128118[_0x9982('0x1e')]+_0x128118[_0x9982('0x21')];var _0x1297d7;if(_0x2558e1>=_0x5385cc){_0x2558e1=_0x5385cc;_0x1297d7=0xc8;}else{_0x1297d7=0xce;}_0x199688[_0x9982('0x1c')](_0x1297d7);return _0x199688['set'](_0x9982('0x22'),_0x44b5ed+'-'+_0x2558e1+'/'+_0x5385cc)[_0x9982('0x1d')](_0xcd1405);}return null;};}function patchUpdates(_0x5ea55d){return function(_0x1c5214){try{jsonpatch[_0x9982('0x23')](_0x1c5214,_0x5ea55d,!![]);}catch(_0x6523c0){return BPromise[_0x9982('0x24')](_0x6523c0);}return _0x1c5214[_0x9982('0x25')]();};}function saveUpdates(_0x1eec90,_0xfde29b){return function(_0x541cc8){if(_0x541cc8){return _0x541cc8[_0x9982('0x26')](_0x1eec90)[_0x9982('0x27')](function(_0x11a7e8){return _0x11a7e8;});}return null;};}function removeEntity(_0x37bb60,_0x3797be){return function(_0x4a27d6){if(_0x4a27d6){return _0x4a27d6[_0x9982('0x28')]()[_0x9982('0x27')](function(){_0x37bb60[_0x9982('0x1c')](0xcc)[_0x9982('0x29')]();});}};}function handleEntityNotFound(_0x2d4622,_0x39747a){return function(_0x3c129a){if(!_0x3c129a){_0x2d4622[_0x9982('0x1b')](0x194);}return _0x3c129a;};}function handleError(_0xa6824b,_0x2be133){_0x2be133=_0x2be133||0x1f4;return function(_0xe752e3){logger[_0x9982('0x2a')](_0xe752e3[_0x9982('0x2b')]);if(_0xe752e3[_0x9982('0x2c')]){delete _0xe752e3[_0x9982('0x2c')];}_0xa6824b[_0x9982('0x1c')](_0x2be133)[_0x9982('0x2d')](_0xe752e3);};}exports[_0x9982('0x2e')]=function(_0x50d976,_0x533748){var _0xb1bc28={},_0x3b3bc5={},_0x4544b5={'count':0x0,'rows':[]};var _0x3c0596=_[_0x9982('0x2f')](db[_0x9982('0x30')][_0x9982('0x31')],function(_0x3337e2){return{'name':_0x3337e2[_0x9982('0x32')],'type':_0x3337e2[_0x9982('0x33')][_0x9982('0x34')]};});_0x3b3bc5[_0x9982('0x35')]=_['map'](_0x3c0596,_0x9982('0x2c'));_0x3b3bc5[_0x9982('0x36')]=_[_0x9982('0x37')](_0x50d976[_0x9982('0x36')]);_0x3b3bc5[_0x9982('0x38')]=_[_0x9982('0x39')](_0x3b3bc5['model'],_0x3b3bc5[_0x9982('0x36')]);_0xb1bc28['attributes']=_[_0x9982('0x39')](_0x3b3bc5[_0x9982('0x35')],qs[_0x9982('0x3a')](_0x50d976[_0x9982('0x36')][_0x9982('0x3a')]));_0xb1bc28[_0x9982('0x3b')]=_0xb1bc28[_0x9982('0x3b')]['length']?_0xb1bc28[_0x9982('0x3b')]:_0x3b3bc5[_0x9982('0x35')];if(!_0x50d976[_0x9982('0x36')][_0x9982('0x3c')](_0x9982('0x3d'))){_0xb1bc28['limit']=qs[_0x9982('0x21')](_0x50d976['query']['limit']);_0xb1bc28[_0x9982('0x1e')]=qs[_0x9982('0x1e')](_0x50d976['query'][_0x9982('0x1e')]);}_0xb1bc28[_0x9982('0x3e')]=qs[_0x9982('0x3f')](_0x50d976[_0x9982('0x36')][_0x9982('0x3f')]);_0xb1bc28[_0x9982('0x40')]=qs[_0x9982('0x38')](_[_0x9982('0x41')](_0x50d976[_0x9982('0x36')],_0x3b3bc5[_0x9982('0x38')]),_0x3c0596);if(_0x50d976[_0x9982('0x36')][_0x9982('0x42')]){_0xb1bc28['where']=_[_0x9982('0x43')](_0xb1bc28[_0x9982('0x40')],{'$or':_[_0x9982('0x2f')](_0x3c0596,function(_0x36e441){if(_0x36e441[_0x9982('0x33')]!=='VIRTUAL'){var _0x521c1f={};_0x521c1f[_0x36e441['name']]={'$like':'%'+_0x50d976[_0x9982('0x36')][_0x9982('0x42')]+'%'};return _0x521c1f;}})});}_0xb1bc28=_['merge']({},_0xb1bc28,_0x50d976[_0x9982('0x44')]);var _0x39afc0={'where':_0xb1bc28[_0x9982('0x40')]};return db[_0x9982('0x30')]['count'](_0x39afc0)[_0x9982('0x27')](function(_0x1942a5){_0x4544b5[_0x9982('0x20')]=_0x1942a5;if(_0x50d976[_0x9982('0x36')][_0x9982('0x45')]){_0xb1bc28[_0x9982('0x46')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0xb1bc28);})[_0x9982('0x27')](function(_0x3b0f1a){_0x4544b5[_0x9982('0x47')]=_0x3b0f1a;return _0x4544b5;})['then'](respondWithFilteredResult(_0x533748,_0xb1bc28))[_0x9982('0x48')](handleError(_0x533748,null));};exports[_0x9982('0x49')]=function(_0x1a5ea4,_0x56ad10){var _0x59be67={'raw':!![],'where':{'id':_0x1a5ea4['params']['id']}},_0x566c07={};_0x566c07['model']=_[_0x9982('0x37')](db['DeskField'][_0x9982('0x31')]);_0x566c07[_0x9982('0x36')]=_['keys'](_0x1a5ea4[_0x9982('0x36')]);_0x566c07[_0x9982('0x38')]=_[_0x9982('0x39')](_0x566c07[_0x9982('0x35')],_0x566c07[_0x9982('0x36')]);_0x59be67['attributes']=_[_0x9982('0x39')](_0x566c07[_0x9982('0x35')],qs[_0x9982('0x3a')](_0x1a5ea4[_0x9982('0x36')][_0x9982('0x3a')]));_0x59be67[_0x9982('0x3b')]=_0x59be67[_0x9982('0x3b')][_0x9982('0x4a')]?_0x59be67[_0x9982('0x3b')]:_0x566c07['model'];if(_0x1a5ea4[_0x9982('0x36')]['includeAll']){_0x59be67['include']=[{'all':!![]}];}_0x59be67=_[_0x9982('0x43')]({},_0x59be67,_0x1a5ea4[_0x9982('0x44')]);return db['DeskField'][_0x9982('0x4b')](_0x59be67)[_0x9982('0x27')](handleEntityNotFound(_0x56ad10,null))[_0x9982('0x27')](respondWithResult(_0x56ad10,null))[_0x9982('0x48')](handleError(_0x56ad10,null));};exports[_0x9982('0x4c')]=function(_0x55d1d3,_0x12261d){return db['DeskField'][_0x9982('0x4c')](_0x55d1d3[_0x9982('0x4d')],{})['then'](respondWithResult(_0x12261d,0xc9))[_0x9982('0x48')](handleError(_0x12261d,null));};exports[_0x9982('0x26')]=function(_0x251996,_0x46cac4){if(_0x251996[_0x9982('0x4d')]['id']){delete _0x251996['body']['id'];}return db[_0x9982('0x30')][_0x9982('0x4b')]({'where':{'id':_0x251996[_0x9982('0x4e')]['id']}})['then'](handleEntityNotFound(_0x46cac4,null))['then'](saveUpdates(_0x251996['body'],null))['then'](respondWithResult(_0x46cac4,null))[_0x9982('0x48')](handleError(_0x46cac4,null));};exports['destroy']=function(_0x2de9df,_0x6a7bed){return db['DeskField']['find']({'where':{'id':_0x2de9df[_0x9982('0x4e')]['id']}})[_0x9982('0x27')](handleEntityNotFound(_0x6a7bed,null))[_0x9982('0x27')](removeEntity(_0x6a7bed,null))[_0x9982('0x48')](handleError(_0x6a7bed,null));}; \ No newline at end of file +var _0x2eb2=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x2eb2[_0x5b561d];return _0x431060;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x26')](_0x1599c7,'name');_0x44cf91[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x49dd59[_0x22eb('0x2c')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],_0x44cf91[_0x22eb('0x2c')]);_0x25e5bc[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],qs['fields'](_0x49dd59['query'][_0x22eb('0x32')]));_0x25e5bc['attributes']=_0x25e5bc['attributes'][_0x22eb('0x33')]?_0x25e5bc[_0x22eb('0x31')]:_0x44cf91[_0x22eb('0x30')];if(!_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x34')](_0x22eb('0x35'))){_0x25e5bc[_0x22eb('0x36')]=qs[_0x22eb('0x36')](_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x36')]);_0x25e5bc['offset']=qs[_0x22eb('0x19')](_0x49dd59['query']['offset']);}_0x25e5bc[_0x22eb('0x37')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc[_0x22eb('0x39')]=qs[_0x22eb('0x2e')](_[_0x22eb('0x3a')](_0x49dd59[_0x22eb('0x2c')],_0x44cf91['filters']),_0x1599c7);if(_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x3b')]){_0x25e5bc['where']=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x39')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x2cc77c){if(_0x2cc77c[_0x22eb('0x2a')]!=='VIRTUAL'){var _0x51c8b5={};_0x51c8b5[_0x2cc77c[_0x22eb('0x24')]]={'$like':'%'+_0x49dd59[_0x22eb('0x2c')]['filter']+'%'};return _0x51c8b5;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59[_0x22eb('0x3d')]);var _0x46c6a1={'where':_0x25e5bc['where']};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x46c6a1)[_0x22eb('0x20')](function(_0x2a8517){_0x7c0119[_0x22eb('0x1b')]=_0x2a8517;if(_0x49dd59[_0x22eb('0x2c')]['includeAll']){_0x25e5bc[_0x22eb('0x3e')]=[{'all':!![]}];}return db[_0x22eb('0x27')]['findAll'](_0x25e5bc);})[_0x22eb('0x20')](function(_0x44d39f){_0x7c0119[_0x22eb('0x3f')]=_0x44d39f;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x40')](handleError(_0x2a950e,null));};exports[_0x22eb('0x41')]=function(_0x1ff04a,_0x78b250){var _0x1bafa3={'raw':!![],'where':{'id':_0x1ff04a[_0x22eb('0x42')]['id']}},_0x82ace8={};_0x82ace8[_0x22eb('0x30')]=_[_0x22eb('0x2d')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x82ace8[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x1ff04a[_0x22eb('0x2c')]);_0x82ace8['filters']=_[_0x22eb('0x2f')](_0x82ace8[_0x22eb('0x30')],_0x82ace8['query']);_0x1bafa3[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x82ace8['model'],qs['fields'](_0x1ff04a['query'][_0x22eb('0x32')]));_0x1bafa3[_0x22eb('0x31')]=_0x1bafa3['attributes']['length']?_0x1bafa3[_0x22eb('0x31')]:_0x82ace8[_0x22eb('0x30')];if(_0x1ff04a[_0x22eb('0x2c')][_0x22eb('0x43')]){_0x1bafa3[_0x22eb('0x3e')]=[{'all':!![]}];}_0x1bafa3=_[_0x22eb('0x3c')]({},_0x1bafa3,_0x1ff04a[_0x22eb('0x3d')]);return db[_0x22eb('0x27')]['find'](_0x1bafa3)['then'](handleEntityNotFound(_0x78b250,null))[_0x22eb('0x20')](respondWithResult(_0x78b250,null))['catch'](handleError(_0x78b250,null));};exports[_0x22eb('0x44')]=function(_0x4bd819,_0x8a2b2c){return db['DeskField']['create'](_0x4bd819['body'],{})['then'](respondWithResult(_0x8a2b2c,0xc9))[_0x22eb('0x40')](handleError(_0x8a2b2c,null));};exports['update']=function(_0x320211,_0x3b35c6){if(_0x320211['body']['id']){delete _0x320211[_0x22eb('0x45')]['id'];}return db['DeskField'][_0x22eb('0x46')]({'where':{'id':_0x320211[_0x22eb('0x42')]['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x3b35c6,null))[_0x22eb('0x20')](saveUpdates(_0x320211[_0x22eb('0x45')],null))[_0x22eb('0x20')](respondWithResult(_0x3b35c6,null))[_0x22eb('0x40')](handleError(_0x3b35c6,null));};exports[_0x22eb('0x21')]=function(_0x11942d,_0x527ef1){return db[_0x22eb('0x27')][_0x22eb('0x46')]({'where':{'id':_0x11942d['params']['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x527ef1,null))[_0x22eb('0x20')](removeEntity(_0x527ef1,null))[_0x22eb('0x40')](handleError(_0x527ef1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 2bed4e5..e3b02ce 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 _0x21c2=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField'];(function(_0x79ef38,_0x101805){var _0x253c93=function(_0xa93204){while(--_0xa93204){_0x79ef38['push'](_0x79ef38['shift']());}};_0x253c93(++_0x101805);}(_0x21c2,0x178));var _0x221c=function(_0x1e0d7f,_0x10eb41){_0x1e0d7f=_0x1e0d7f-0x0;var _0x1e757d=_0x21c2[_0x1e0d7f];return _0x1e757d;};'use strict';var _=require(_0x221c('0x0'));var util=require(_0x221c('0x1'));var logger=require(_0x221c('0x2'))('api');var moment=require(_0x221c('0x3'));var BPromise=require(_0x221c('0x4'));var rp=require(_0x221c('0x5'));var fs=require('fs');var path=require(_0x221c('0x6'));var rimraf=require(_0x221c('0x7'));var config=require('../../config/environment');var attributes=require(_0x221c('0x8'));module[_0x221c('0x9')]=function(_0x25e7ab,_0x169cb8){return _0x25e7ab[_0x221c('0xa')](_0x221c('0xb'),attributes,{'tableName':_0x221c('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x221c('0xd'),_0x221c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc194=['desk_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define','int_desk_fields'];(function(_0x4cbcca,_0x10e503){var _0x2098f1=function(_0x405758){while(--_0x405758){_0x4cbcca['push'](_0x4cbcca['shift']());}};_0x2098f1(++_0x10e503);}(_0xc194,0x189));var _0x4c19=function(_0x5da240,_0x3ce318){_0x5da240=_0x5da240-0x0;var _0x1a17bc=_0xc194[_0x5da240];return _0x1a17bc;};'use strict';var _=require(_0x4c19('0x0'));var util=require(_0x4c19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4c19('0x2'));var BPromise=require(_0x4c19('0x3'));var rp=require(_0x4c19('0x4'));var fs=require('fs');var path=require(_0x4c19('0x5'));var rimraf=require(_0x4c19('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x4c19('0x7')]=function(_0x3f30cb,_0x4970ca){return _0x3f30cb[_0x4c19('0x8')]('DeskField',attributes,{'tableName':_0x4c19('0x9'),'paranoid':![],'indexes':[{'name':_0x4c19('0xa'),'fields':[_0x4c19('0xb'),_0x4c19('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 68229cb..248a010 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 _0x223b=['then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x4f8258,_0x18fe18){var _0x2882f9=function(_0x27b51f){while(--_0x27b51f){_0x4f8258['push'](_0x4f8258['shift']());}};_0x2882f9(++_0x18fe18);}(_0x223b,0x1ee));var _0xb223=function(_0x2c8dbc,_0xafeeb){_0x2c8dbc=_0x2c8dbc-0x0;var _0x487501=_0x223b[_0x2c8dbc];return _0x487501;};'use strict';var _=require(_0xb223('0x0'));var util=require('util');var moment=require(_0xb223('0x1'));var BPromise=require(_0xb223('0x2'));var rs=require(_0xb223('0x3'));var fs=require('fs');var Redis=require(_0xb223('0x4'));var db=require(_0xb223('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb223('0x6'))(_0xb223('0x7'));var config=require(_0xb223('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb223('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c9407,_0x1eaf7a,_0x3d080e){return new BPromise(function(_0x21e753,_0x2e1ffe){return client['request'](_0x1c9407,_0x3d080e)[_0xb223('0xa')](function(_0x46f340){logger[_0xb223('0xb')](_0xb223('0xc'),_0x1eaf7a,'request\x20sent');logger[_0xb223('0xd')](_0xb223('0xe'),_0x1eaf7a,'request\x20sent',JSON[_0xb223('0xf')](_0x46f340));if(_0x46f340[_0xb223('0x10')]){if(_0x46f340['error'][_0xb223('0x11')]===0x1f4){logger[_0xb223('0x10')](_0xb223('0xc'),_0x1eaf7a,_0x46f340[_0xb223('0x10')][_0xb223('0x12')]);return _0x2e1ffe(_0x46f340[_0xb223('0x10')][_0xb223('0x12')]);}logger[_0xb223('0x10')](_0xb223('0xc'),_0x1eaf7a,_0x46f340[_0xb223('0x10')][_0xb223('0x12')]);return _0x21e753(_0x46f340[_0xb223('0x10')][_0xb223('0x12')]);}else{logger[_0xb223('0xb')]('DeskField,\x20%s,\x20%s',_0x1eaf7a,'request\x20sent');_0x21e753(_0x46f340[_0xb223('0x13')][_0xb223('0x12')]);}})[_0xb223('0x14')](function(_0x3f7855){logger[_0xb223('0x10')](_0xb223('0xc'),_0x1eaf7a,_0x3f7855);_0x2e1ffe(_0x3f7855);});});} \ No newline at end of file +var _0xbcb9=['client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x15f1cc,_0x1e99c9){var _0x3549d7=function(_0x3e2e04){while(--_0x3e2e04){_0x15f1cc['push'](_0x15f1cc['shift']());}};_0x3549d7(++_0x1e99c9);}(_0xbcb9,0x1da));var _0x9bcb=function(_0x355d77,_0x43e1ad){_0x355d77=_0x355d77-0x0;var _0x198553=_0xbcb9[_0x355d77];return _0x198553;};'use strict';var _=require(_0x9bcb('0x0'));var util=require(_0x9bcb('0x1'));var moment=require(_0x9bcb('0x2'));var BPromise=require(_0x9bcb('0x3'));var rs=require(_0x9bcb('0x4'));var fs=require('fs');var Redis=require(_0x9bcb('0x5'));var db=require(_0x9bcb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9bcb('0x7'))(_0x9bcb('0x8'));var config=require(_0x9bcb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9bcb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357858,_0x53ff8b,_0x25eb6d){return new BPromise(function(_0x106373,_0x44ba34){return client[_0x9bcb('0xb')](_0x357858,_0x25eb6d)[_0x9bcb('0xc')](function(_0x538fd2){logger[_0x9bcb('0xd')](_0x9bcb('0xe'),_0x53ff8b,_0x9bcb('0xf'));logger[_0x9bcb('0x10')](_0x9bcb('0x11'),_0x53ff8b,_0x9bcb('0xf'),JSON[_0x9bcb('0x12')](_0x538fd2));if(_0x538fd2['error']){if(_0x538fd2['error'][_0x9bcb('0x13')]===0x1f4){logger['error'](_0x9bcb('0xe'),_0x53ff8b,_0x538fd2[_0x9bcb('0x14')][_0x9bcb('0x15')]);return _0x44ba34(_0x538fd2[_0x9bcb('0x14')]['message']);}logger[_0x9bcb('0x14')]('DeskField,\x20%s,\x20%s',_0x53ff8b,_0x538fd2[_0x9bcb('0x14')]['message']);return _0x106373(_0x538fd2[_0x9bcb('0x14')][_0x9bcb('0x15')]);}else{logger[_0x9bcb('0xd')](_0x9bcb('0xe'),_0x53ff8b,_0x9bcb('0xf'));_0x106373(_0x538fd2['result'][_0x9bcb('0x15')]);}})['catch'](function(_0x360705){logger[_0x9bcb('0x14')](_0x9bcb('0xe'),_0x53ff8b,_0x360705);_0x44ba34(_0x360705);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 3ca8a22..79131a3 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 _0xe25c=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xe25c,0xae));var _0xce25=function(_0x43ef4c,_0x32b98f){_0x43ef4c=_0x43ef4c-0x0;var _0x50e9ea=_0xe25c[_0x43ef4c];return _0x50e9ea;};'use strict';var multer=require(_0xce25('0x0'));var util=require(_0xce25('0x1'));var path=require(_0xce25('0x2'));var timeout=require(_0xce25('0x3'));var express=require(_0xce25('0x4'));var router=express[_0xce25('0x5')]();var fs_extra=require(_0xce25('0x6'));var auth=require(_0xce25('0x7'));var interaction=require(_0xce25('0x8'));var config=require(_0xce25('0x9'));var controller=require(_0xce25('0xa'));router[_0xce25('0xb')]('/',auth['isAuthenticated'](),controller[_0xce25('0xc')]);router[_0xce25('0xb')]('/:id',auth[_0xce25('0xd')](),controller[_0xce25('0xe')]);router[_0xce25('0xb')](_0xce25('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xce25('0xb')](_0xce25('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0xce25('0x11')]('/',auth[_0xce25('0xd')](),controller[_0xce25('0x12')]);router[_0xce25('0x11')](_0xce25('0xf'),auth[_0xce25('0xd')](),controller[_0xce25('0x13')]);router[_0xce25('0x14')]('/:id',auth[_0xce25('0xd')](),controller[_0xce25('0x15')]);router[_0xce25('0x16')](_0xce25('0x17'),auth['isAuthenticated'](),controller[_0xce25('0x18')]);module[_0xce25('0x19')]=router; \ No newline at end of file +var _0xe9e5=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index'];(function(_0x35c111,_0x3e43b9){var _0x408930=function(_0x3b3379){while(--_0x3b3379){_0x35c111['push'](_0x35c111['shift']());}};_0x408930(++_0x3e43b9);}(_0xe9e5,0x138));var _0x5e9e=function(_0x488382,_0x2d1a4e){_0x488382=_0x488382-0x0;var _0x4f329b=_0xe9e5[_0x488382];return _0x4f329b;};'use strict';var multer=require(_0x5e9e('0x0'));var util=require(_0x5e9e('0x1'));var path=require(_0x5e9e('0x2'));var timeout=require(_0x5e9e('0x3'));var express=require(_0x5e9e('0x4'));var router=express[_0x5e9e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5e9e('0x6'));var interaction=require(_0x5e9e('0x7'));var config=require(_0x5e9e('0x8'));var controller=require(_0x5e9e('0x9'));router[_0x5e9e('0xa')]('/',auth[_0x5e9e('0xb')](),controller[_0x5e9e('0xc')]);router[_0x5e9e('0xa')](_0x5e9e('0xd'),auth['isAuthenticated'](),controller[_0x5e9e('0xe')]);router[_0x5e9e('0xa')](_0x5e9e('0xf'),auth[_0x5e9e('0xb')](),controller[_0x5e9e('0x10')]);router['get'](_0x5e9e('0x11'),auth[_0x5e9e('0xb')](),controller[_0x5e9e('0x12')]);router[_0x5e9e('0x13')]('/',auth['isAuthenticated'](),controller[_0x5e9e('0x14')]);router[_0x5e9e('0x13')](_0x5e9e('0xf'),auth[_0x5e9e('0xb')](),controller[_0x5e9e('0x15')]);router[_0x5e9e('0x16')](_0x5e9e('0xd'),auth[_0x5e9e('0xb')](),controller[_0x5e9e('0x17')]);router[_0x5e9e('0x18')](_0x5e9e('0xd'),auth[_0x5e9e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d41eeda..d76b520 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 _0xb5bb=['STRING','sequelize','exports'];(function(_0x3008c4,_0x232045){var _0x5c59d7=function(_0x9bc55a){while(--_0x9bc55a){_0x3008c4['push'](_0x3008c4['shift']());}};_0x5c59d7(++_0x232045);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x3d5b44,_0x3a02fe){_0x3d5b44=_0x3d5b44-0x0;var _0x4a72a=_0xb5bb[_0x3d5b44];return _0x4a72a;};'use strict';var Sequelize=require(_0xbb5b('0x0'));module[_0xbb5b('0x1')]={'name':{'type':Sequelize[_0xbb5b('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbb5b('0x2')]},'remoteUri':{'type':Sequelize[_0xbb5b('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3bd7=['STRING'];(function(_0xa869a2,_0x59e366){var _0x5daa67=function(_0x3fadc2){while(--_0x3fadc2){_0xa869a2['push'](_0xa869a2['shift']());}};_0x5daa67(++_0x59e366);}(_0x3bd7,0x199));var _0x73bd=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x3bd7[_0x38eb23];return _0x48506a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x73bd('0x0')]},'username':{'type':Sequelize[_0x73bd('0x0')]},'password':{'type':Sequelize[_0x73bd('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x73bd('0x0')]},'clientId':{'type':Sequelize[_0x73bd('0x0')]},'clientSecret':{'type':Sequelize[_0x73bd('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x73bd('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index e8b987a..b731fd4 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 _0xbe5e=['hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','%s/api/data/v9.0/','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','username','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','push','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','set','update','then','end','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','getConfigurations','Dynamics365Configuration','pick'];(function(_0x366219,_0x87bcee){var _0x4bba95=function(_0x409f45){while(--_0x409f45){_0x366219['push'](_0x366219['shift']());}};_0x4bba95(++_0x87bcee);}(_0xbe5e,0x81));var _0xebe5=function(_0x1337a4,_0x6e0708){_0x1337a4=_0x1337a4-0x0;var _0xacd1b1=_0xbe5e[_0x1337a4];return _0xacd1b1;};'use strict';var rp=require(_0xebe5('0x0'));var util=require(_0xebe5('0x1'));var _=require('lodash');var qs=require(_0xebe5('0x2'));var logger=require(_0xebe5('0x3'))(_0xebe5('0x4'));var db=require(_0xebe5('0x5'))['db'];var integrations=require(_0xebe5('0x6'));function respondWithResult(_0x43d7f7,_0x1e3335){_0x1e3335=_0x1e3335||0xc8;return function(_0x5edcee){if(_0x5edcee){return _0x43d7f7[_0xebe5('0x7')](_0x1e3335)['json'](_0x5edcee);}};}function respondWithFilteredResult(_0x35cf69,_0x43c6df){return function(_0x152456){if(_0x152456){var _0x73d4df=typeof _0x43c6df[_0xebe5('0x8')]===_0xebe5('0x9')&&typeof _0x43c6df[_0xebe5('0xa')]===_0xebe5('0x9');var _0x60f242=_0x152456['count'];var _0x4c8cef=_0x73d4df?0x0:_0x43c6df[_0xebe5('0x8')];var _0x16c715=_0x73d4df?_0x152456['count']:_0x43c6df[_0xebe5('0x8')]+_0x43c6df[_0xebe5('0xa')];var _0x5d8bde;if(_0x16c715>=_0x60f242){_0x16c715=_0x60f242;_0x5d8bde=0xc8;}else{_0x5d8bde=0xce;}_0x35cf69[_0xebe5('0x7')](_0x5d8bde);return _0x35cf69[_0xebe5('0xb')]('Content-Range',_0x4c8cef+'-'+_0x16c715+'/'+_0x60f242)['json'](_0x152456);}return null;};}function saveUpdates(_0x560126){return function(_0x213c72){if(_0x213c72){return _0x213c72[_0xebe5('0xc')](_0x560126)['then'](function(_0x396b16){return _0x396b16;});}return null;};}function removeEntity(_0x643d28){return function(_0x4b2b62){if(_0x4b2b62){return _0x4b2b62['destroy']()[_0xebe5('0xd')](function(){_0x643d28[_0xebe5('0x7')](0xcc)[_0xebe5('0xe')]();});}};}function handleEntityNotFound(_0x5868b7){return function(_0x505224){if(!_0x505224){_0x5868b7['sendStatus'](0x194);}return _0x505224;};}function handleError(_0x23e4f2,_0x4f2105){_0x4f2105=_0x4f2105||0x1f4;return function(_0x4baafa){logger[_0xebe5('0xf')](_0x4baafa[_0xebe5('0x10')]);if(_0x4baafa[_0xebe5('0x11')]){delete _0x4baafa[_0xebe5('0x11')];}_0x23e4f2[_0xebe5('0x7')](_0x4f2105)[_0xebe5('0x12')](_0x4baafa);};}exports[_0xebe5('0x13')]=function(_0x521ac8,_0x3be153){var _0x5eae64={},_0xfd8586={},_0x28f7b4={'count':0x0,'rows':[]};var _0xa1debc=_[_0xebe5('0x14')](db[_0xebe5('0x15')]['rawAttributes'],function(_0x536380){return{'name':_0x536380[_0xebe5('0x16')],'type':_0x536380[_0xebe5('0x17')]['key']};});_0xfd8586['model']=_[_0xebe5('0x14')](_0xa1debc,_0xebe5('0x11'));_0xfd8586[_0xebe5('0x18')]=_[_0xebe5('0x19')](_0x521ac8[_0xebe5('0x18')]);_0xfd8586['filters']=_[_0xebe5('0x1a')](_0xfd8586[_0xebe5('0x1b')],_0xfd8586[_0xebe5('0x18')]);_0x5eae64[_0xebe5('0x1c')]=_[_0xebe5('0x1a')](_0xfd8586['model'],qs[_0xebe5('0x1d')](_0x521ac8[_0xebe5('0x18')][_0xebe5('0x1d')]));_0x5eae64[_0xebe5('0x1c')]=_0x5eae64[_0xebe5('0x1c')][_0xebe5('0x1e')]?_0x5eae64[_0xebe5('0x1c')]:_0xfd8586[_0xebe5('0x1b')];if(!_0x521ac8[_0xebe5('0x18')]['hasOwnProperty'](_0xebe5('0x1f'))){_0x5eae64[_0xebe5('0xa')]=qs['limit'](_0x521ac8[_0xebe5('0x18')][_0xebe5('0xa')]);_0x5eae64['offset']=qs['offset'](_0x521ac8[_0xebe5('0x18')]['offset']);}_0x5eae64[_0xebe5('0x20')]=qs[_0xebe5('0x21')](_0x521ac8[_0xebe5('0x18')][_0xebe5('0x21')]);_0x5eae64[_0xebe5('0x22')]=qs[_0xebe5('0x23')](_['pick'](_0x521ac8[_0xebe5('0x18')],_0xfd8586['filters']),_0xa1debc);if(_0x521ac8[_0xebe5('0x18')][_0xebe5('0x24')]){_0x5eae64[_0xebe5('0x22')]=_[_0xebe5('0x25')](_0x5eae64[_0xebe5('0x22')],{'$or':_[_0xebe5('0x14')](_0xa1debc,function(_0x3a63f6){if(_0x3a63f6['type']!==_0xebe5('0x26')){var _0xc3fd3c={};_0xc3fd3c[_0x3a63f6[_0xebe5('0x11')]]={'$like':'%'+_0x521ac8['query']['filter']+'%'};return _0xc3fd3c;}})});}_0x5eae64=_[_0xebe5('0x25')]({},_0x5eae64,_0x521ac8[_0xebe5('0x27')]);var _0x1f0040={'where':_0x5eae64['where']};return db[_0xebe5('0x15')][_0xebe5('0x28')](_0x1f0040)['then'](function(_0x1704d2){_0x28f7b4['count']=_0x1704d2;if(_0x521ac8[_0xebe5('0x18')][_0xebe5('0x29')]){_0x5eae64['include']=[{'all':!![]}];}return db[_0xebe5('0x15')]['findAll'](_0x5eae64);})[_0xebe5('0xd')](function(_0x30bd3e){_0x28f7b4[_0xebe5('0x2a')]=_0x30bd3e;return _0x28f7b4;})[_0xebe5('0xd')](respondWithFilteredResult(_0x3be153,_0x5eae64))[_0xebe5('0x2b')](handleError(_0x3be153,null));};exports[_0xebe5('0x2c')]=function(_0x37ab9f,_0x643866){var _0x4c445c={'raw':![],'where':{'id':_0x37ab9f[_0xebe5('0x2d')]['id']}},_0x2b4d90={};_0x2b4d90[_0xebe5('0x1b')]=_[_0xebe5('0x19')](db[_0xebe5('0x15')][_0xebe5('0x2e')]);_0x2b4d90[_0xebe5('0x18')]=_[_0xebe5('0x19')](_0x37ab9f[_0xebe5('0x18')]);_0x2b4d90[_0xebe5('0x23')]=_[_0xebe5('0x1a')](_0x2b4d90[_0xebe5('0x1b')],_0x2b4d90[_0xebe5('0x18')]);_0x4c445c['attributes']=_[_0xebe5('0x1a')](_0x2b4d90[_0xebe5('0x1b')],qs['fields'](_0x37ab9f[_0xebe5('0x18')][_0xebe5('0x1d')]));_0x4c445c['attributes']=_0x4c445c[_0xebe5('0x1c')][_0xebe5('0x1e')]?_0x4c445c[_0xebe5('0x1c')]:_0x2b4d90[_0xebe5('0x1b')];if(_0x37ab9f[_0xebe5('0x18')]['includeAll']){_0x4c445c[_0xebe5('0x2f')]=[{'all':!![]}];}_0x4c445c=_[_0xebe5('0x25')]({},_0x4c445c,_0x37ab9f['options']);return db['Dynamics365Account'][_0xebe5('0x30')](_0x4c445c)[_0xebe5('0xd')](handleEntityNotFound(_0x643866,null))[_0xebe5('0xd')](respondWithResult(_0x643866,null))[_0xebe5('0x2b')](handleError(_0x643866,null));};exports[_0xebe5('0x31')]=function(_0x37e8f4,_0x307488){return db[_0xebe5('0x15')][_0xebe5('0x31')](_0x37e8f4['body'],{})[_0xebe5('0xd')](respondWithResult(_0x307488,0xc9))[_0xebe5('0x2b')](handleError(_0x307488,null));};exports[_0xebe5('0xc')]=function(_0x398c9c,_0x4e4ca2){if(_0x398c9c[_0xebe5('0x32')]['id']){delete _0x398c9c[_0xebe5('0x32')]['id'];}return db[_0xebe5('0x15')][_0xebe5('0x30')]({'where':{'id':_0x398c9c['params']['id']}})['then'](handleEntityNotFound(_0x4e4ca2,null))[_0xebe5('0xd')](saveUpdates(_0x398c9c['body'],null))[_0xebe5('0xd')](respondWithResult(_0x4e4ca2,null))[_0xebe5('0x2b')](handleError(_0x4e4ca2,null));};exports[_0xebe5('0x33')]=function(_0x457332,_0x3449d4){return db[_0xebe5('0x15')][_0xebe5('0x30')]({'where':{'id':_0x457332[_0xebe5('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3449d4,null))[_0xebe5('0xd')](removeEntity(_0x3449d4,null))[_0xebe5('0x2b')](handleError(_0x3449d4,null));};exports[_0xebe5('0x34')]=function(_0x3e73a7,_0x35052e){var _0x506404={};var _0x242917={};var _0x23dc81;var _0x288081;return db[_0xebe5('0x15')]['findOne']({'where':{'id':_0x3e73a7[_0xebe5('0x2d')]['id']}})[_0xebe5('0xd')](handleEntityNotFound(_0x35052e,null))[_0xebe5('0xd')](function(_0x4ed0c8){if(_0x4ed0c8){_0x23dc81=_0x4ed0c8;_0x242917[_0xebe5('0x1b')]=_[_0xebe5('0x19')](db[_0xebe5('0x35')][_0xebe5('0x2e')]);_0x242917[_0xebe5('0x18')]=_['keys'](_0x3e73a7[_0xebe5('0x18')]);_0x242917[_0xebe5('0x23')]=_[_0xebe5('0x1a')](_0x242917[_0xebe5('0x1b')],_0x242917['query']);_0x506404[_0xebe5('0x1c')]=_[_0xebe5('0x1a')](_0x242917[_0xebe5('0x1b')],qs[_0xebe5('0x1d')](_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x1d')]));_0x506404['attributes']=_0x506404[_0xebe5('0x1c')][_0xebe5('0x1e')]?_0x506404['attributes']:_0x242917[_0xebe5('0x1b')];_0x506404[_0xebe5('0x20')]=qs[_0xebe5('0x21')](_0x3e73a7['query'][_0xebe5('0x21')]);_0x506404[_0xebe5('0x22')]=qs['filters'](_[_0xebe5('0x36')](_0x3e73a7[_0xebe5('0x18')],_0x242917[_0xebe5('0x23')]));if(_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x24')]){_0x506404[_0xebe5('0x22')]=_[_0xebe5('0x25')](_0x506404[_0xebe5('0x22')],{'$or':_[_0xebe5('0x14')](_0x506404[_0xebe5('0x1c')],function(_0x4e3891){var _0x22f0b8={};_0x22f0b8[_0x4e3891]={'$like':'%'+_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x24')]+'%'};return _0x22f0b8;})});}_0x506404=_[_0xebe5('0x25')]({},_0x506404,_0x3e73a7[_0xebe5('0x27')]);return _0x23dc81['getConfigurations'](_0x506404);}})[_0xebe5('0xd')](function(_0xabfa7c){if(_0xabfa7c){_0x288081=_0xabfa7c['length'];if(!_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x37')](_0xebe5('0x1f'))){_0x506404[_0xebe5('0xa')]=qs['limit'](_0x3e73a7['query'][_0xebe5('0xa')]);_0x506404[_0xebe5('0x8')]=qs[_0xebe5('0x8')](_0x3e73a7[_0xebe5('0x18')][_0xebe5('0x8')]);}return _0x23dc81[_0xebe5('0x34')](_0x506404);}})[_0xebe5('0xd')](function(_0x1e25cf){if(_0x1e25cf){return _0x1e25cf?{'count':_0x288081,'rows':_0x1e25cf}:null;}})[_0xebe5('0xd')](respondWithResult(_0x35052e,null))[_0xebe5('0x2b')](handleError(_0x35052e,null));};exports[_0xebe5('0x38')]=function(_0x2ffb3e,_0x1536c7){if(_0x2ffb3e[_0xebe5('0x32')]['id']){delete _0x2ffb3e['body']['id'];}return db[_0xebe5('0x15')][_0xebe5('0x39')]({'where':{'id':_0x2ffb3e[_0xebe5('0x2d')]['id']}})[_0xebe5('0xd')](handleEntityNotFound(_0x1536c7,null))[_0xebe5('0xd')](function(_0x36bd2b){if(_0x36bd2b){_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3a')]=_0x36bd2b['id'];_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3b')]=integrations[_0xebe5('0x3c')](_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3d')],_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x17')]);_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3e')]=integrations[_0xebe5('0x3f')](_0x2ffb3e[_0xebe5('0x32')][_0xebe5('0x3d')],_0x2ffb3e['body']['type']);return db[_0xebe5('0x35')][_0xebe5('0x31')](_0x2ffb3e[_0xebe5('0x32')],{'include':[{'model':db[_0xebe5('0x40')],'as':_0xebe5('0x3b')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xebe5('0xd')](respondWithResult(_0x1536c7,null))[_0xebe5('0x2b')](handleError(_0x1536c7,null));};function sanitizeRemoteUri(_0x23bfee){var _0x25e73c=_0x23bfee['slice'](-0x1);if(_0x25e73c==='/')return _0x23bfee[_0xebe5('0x41')](0x0,_0x23bfee[_0xebe5('0x42')](_0x25e73c));return _0x23bfee;}function getWebApiUrl(_0x4d759b){return util['format'](_0xebe5('0x43'),_0x4d759b);}exports['getFields']=function(_0x1322ee,_0x1acacf){var _0x421b79=_0x1322ee[_0xebe5('0x18')][_0xebe5('0x44')];var _0x3dea29=_0x421b79==='incident'?_0xebe5('0x45'):'PhoneCall';var _0x3151e4='';var _0x5c770d='';var _0x2f8e83='';var _0x126902='';var _0x3b6221='';var _0x448d43='';var _0x222620='';var _0x2d0119='';var _0x105186=[_0xebe5('0x46'),_0xebe5('0x47'),_0xebe5('0x48'),_0xebe5('0x49'),_0xebe5('0x4a'),_0xebe5('0x4b'),_0xebe5('0x4c'),_0xebe5('0x4d'),_0xebe5('0x4e'),'phonecall_activity_parties'];var _0x1f96b9=[_0xebe5('0x4f'),_0xebe5('0x50'),'actualserviceunits',_0xebe5('0x51'),'contactidname',_0xebe5('0x52'),_0xebe5('0x53'),'contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame',_0xebe5('0x54'),'createdbyyominame',_0xebe5('0x55'),_0xebe5('0x56'),'createdonbehalfbyyominame',_0xebe5('0x57'),_0xebe5('0x58'),_0xebe5('0x59'),_0xebe5('0x5a'),_0xebe5('0x5b'),_0xebe5('0x5c'),_0xebe5('0x5d'),'escalatedon',_0xebe5('0x5e'),_0xebe5('0x5f'),_0xebe5('0x60'),_0xebe5('0x61'),_0xebe5('0x62'),_0xebe5('0x63'),_0xebe5('0x64'),_0xebe5('0x65'),_0xebe5('0x66'),_0xebe5('0x67'),_0xebe5('0x68'),_0xebe5('0x69'),'modifiedon',_0xebe5('0x6a'),_0xebe5('0x6b'),_0xebe5('0x6c'),_0xebe5('0x6d'),_0xebe5('0x6e'),_0xebe5('0x6f'),_0xebe5('0x70'),'owneridname',_0xebe5('0x71'),_0xebe5('0x72'),'parentcaseidname',_0xebe5('0x73'),'primarycontactidyominame',_0xebe5('0x74'),'productidname',_0xebe5('0x75'),_0xebe5('0x76'),_0xebe5('0x77'),'responseby',_0xebe5('0x78'),_0xebe5('0x79'),_0xebe5('0x7a'),_0xebe5('0x7b'),_0xebe5('0x7c'),_0xebe5('0x7d'),_0xebe5('0x7e'),_0xebe5('0x7f'),_0xebe5('0x80'),_0xebe5('0x81'),_0xebe5('0x82'),_0xebe5('0x83'),'traversedpath',_0xebe5('0x84'),'versionnumber'];var _0x331aaa=_0x105186[_0xebe5('0x85')](_0x1f96b9);return db['Dynamics365Account'][_0xebe5('0x39')]({'where':{'id':_0x1322ee[_0xebe5('0x2d')]['id']},'attributes':['id','username',_0xebe5('0x86'),_0xebe5('0x87'),_0xebe5('0x88'),'clientId',_0xebe5('0x89'),_0xebe5('0x8a')],'include':[{'model':db[_0xebe5('0x8b')],'as':_0xebe5('0x8b'),'attributes':['id',_0xebe5('0x8c'),_0xebe5('0x8d')]}]})[_0xebe5('0xd')](handleEntityNotFound(_0x1acacf,null))[_0xebe5('0xd')](function(_0x272813){if(_0x272813){if(_0x272813[_0xebe5('0x8a')]){_0x272813[_0xebe5('0x8e')]=_0x272813[_0xebe5('0x8b')][_0xebe5('0x8c')];_0x2d0119=sanitizeRemoteUri(_0x272813[_0xebe5('0x8b')]['data7']);_0x222620=getWebApiUrl(_0x2d0119);return _0x272813;}_0x2d0119=sanitizeRemoteUri(_0x272813['remoteUri']);_0x222620=getWebApiUrl(_0x2d0119);var _0x467f8c={'method':_0xebe5('0x8f'),'uri':_0xebe5('0x90')+_0x272813[_0xebe5('0x88')]+_0xebe5('0x91'),'form':{'client_id':_0x272813[_0xebe5('0x92')],'resource':_0x2d0119,'username':_0x272813[_0xebe5('0x93')],'password':_0x272813[_0xebe5('0x86')],'grant_type':_0xebe5('0x86'),'client_secret':_0x272813[_0xebe5('0x89')]},'json':!![]};return rp(_0x467f8c);}})[_0xebe5('0xd')](function(_0x330690){_0x448d43=_0x330690[_0xebe5('0x8e')];var _0x41ace1={'method':_0xebe5('0x94'),'uri':encodeURI(_0x222620+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x3dea29+'\x27'),'headers':{'Authorization':_0xebe5('0x95')+_0x448d43,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x41ace1);})[_0xebe5('0xd')](function(_0x2a5f6e){var _0x54a38a=_0x2a5f6e[_0xebe5('0x97')][0x0];var _0x2fb804=_0x54a38a[_0xebe5('0x98')];var _0x1ed648={'method':_0xebe5('0x94'),'uri':_0x222620+_0xebe5('0x99')+_0x2fb804+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xebe5('0x95')+_0x448d43,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x1ed648);})[_0xebe5('0xd')](function(_0x56d94a){_0x3151e4=_0x56d94a;_0x5c770d=_0x3151e4[_0xebe5('0x9a')];_0x5c770d=_['remove'](_0x5c770d,function(_0x1293ef){return!_0x331aaa[_0xebe5('0x9b')](_0x1293ef[_0xebe5('0x9c')]);});var _0x1746b7=[];var _0x431ec8=[];_0x5c770d[_0xebe5('0x9d')](function(_0x2062cb){if(_0x2062cb[_0xebe5('0x9e')]){var _0x5af24d=_0x2062cb[_0xebe5('0x9e')]['substring'](_0x2062cb[_0xebe5('0x9e')][_0xebe5('0x42')]('.')+0x1);if(_0x5af24d===_0xebe5('0x9f')){_0x1746b7['push'](getSelectList(_0x222620,_0x421b79,_0x431ec8,_0x3151e4[_0xebe5('0x98')],_0x2062cb[_0xebe5('0x98')],_0x448d43));}}});return Promise[_0xebe5('0xa0')](_0x1746b7);})['then'](function(_0x40f28a){_0x2f8e83=_0x40f28a[0x0];var _0x21808c=[];var _0x473c6e=[];_0x5c770d[_0xebe5('0x9d')](function(_0x371d03){if(!_['isNil'](_0x371d03[_0xebe5('0x9e')])){var _0x2c3295=_0x371d03[_0xebe5('0x9e')][_0xebe5('0x41')](_0x371d03['@odata.type'][_0xebe5('0x42')]('.')+0x1);if(_0x2c3295===_0xebe5('0xa1')){_0x21808c['push'](getBooleanList(_0x222620,_0x421b79,_0x473c6e,_0x3151e4['MetadataId'],_0x371d03['MetadataId'],_0x448d43));}}});return Promise[_0xebe5('0xa0')](_0x21808c);})[_0xebe5('0xd')](function(_0x49cfb8){_0x126902=_0x49cfb8[0x0];var _0x41f0d3=[];var _0xf2ea49=[];_0x5c770d[_0xebe5('0x9d')](function(_0x11a0f1){if(_0x11a0f1['@odata.type']){var _0x17a71e=_0x11a0f1[_0xebe5('0x9e')][_0xebe5('0x41')](_0x11a0f1[_0xebe5('0x9e')][_0xebe5('0x42')]('.')+0x1);if(_0x17a71e===_0xebe5('0xa2')||_0x17a71e===_0xebe5('0xa3')||_0x17a71e===_0xebe5('0xa4')||_0x17a71e==='IntegerAttributeMetadata'||_0x17a71e==='MemoAttributeMetadata'||_0x17a71e===_0xebe5('0xa5')||_0x17a71e===_0xebe5('0xa6')||_0x17a71e===_0xebe5('0xa7')||_0x17a71e==='StateAttributeMetadata'||_0x17a71e==='DecimalAttributeMetadata'){_0x41f0d3[_0xebe5('0xa8')](getInputList(_0x222620,_0x421b79,_0x17a71e,_0xf2ea49,_0x3151e4[_0xebe5('0x98')],_0x11a0f1['MetadataId'],_0x448d43));}}});return Promise[_0xebe5('0xa0')](_0x41f0d3);})['then'](function(_0x358146){_0x3b6221=_0x358146[0x0];var _0x317acc=_0x2f8e83[_0xebe5('0x85')](_0x126902)[_0xebe5('0x85')](_0x3b6221);var _0x11f13d={'count':_0x317acc['length'],'rows':_0x317acc};return _0x11f13d;})[_0xebe5('0xd')](respondWithResult(_0x1acacf,null))[_0xebe5('0x2b')](function(_0x1a208f){var _0x1c284c=_0x1322ee['query'][_0xebe5('0xa9')]?0x1f4:_0x1a208f['statusCode']||0x1f4;logger[_0xebe5('0xf')](_0x1a208f[_0xebe5('0x10')]);delete _0x1a208f[_0xebe5('0x11')];if(_0x1c284c===0x191){_0x1c284c=0x190;}_0x1acacf[_0xebe5('0x7')](_0x1c284c)[_0xebe5('0x12')](_0x1322ee[_0xebe5('0x18')][_0xebe5('0xa9')]?{'message':_0xebe5('0xaa'),'statusCode':_0x1a208f['statusCode']}:_0x1a208f);});};function getSelectList(_0xdf1ce1,_0x2f7c7c,_0x56bec0,_0x2e7ae6,_0x488953,_0x1e8d08){var _0x24cb71={'method':_0xebe5('0x94'),'uri':_0xdf1ce1+_0xebe5('0x99')+_0x2e7ae6+')/Attributes('+_0x488953+_0xebe5('0xab')+_0xebe5('0xac'),'headers':{'Authorization':_0xebe5('0x95')+_0x1e8d08,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x24cb71)[_0xebe5('0xd')](function(_0x3bae7a){var _0x2a4c0f=[];var _0x535798=_0x3bae7a[_0xebe5('0xad')]['Options'];_0x535798[_0xebe5('0x9d')](function(_0x559fec){_0x2a4c0f['push']({'name':_0x559fec[_0xebe5('0xae')]['UserLocalizedLabel']['Label'],'value':String(_0x559fec[_0xebe5('0xaf')])});});var _0xb33734={'id':_0x2f7c7c+'_'+_0x3bae7a[_0xebe5('0x9c')],'name':_0x3bae7a[_0xebe5('0xb0')][_0xebe5('0xb1')][_0xebe5('0xae')],'custom':![],'options':_0x2a4c0f};_0x56bec0['push'](_0xb33734);return _0x56bec0;});}function getBooleanList(_0x5c7c61,_0x30802d,_0x23c95b,_0x4d5709,_0x258936,_0x868792){var _0x5aa65b={'method':_0xebe5('0x94'),'uri':_0x5c7c61+_0xebe5('0x99')+_0x4d5709+_0xebe5('0xb2')+_0x258936+_0xebe5('0xb3'),'headers':{'Authorization':_0xebe5('0x95')+_0x868792,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x5aa65b)[_0xebe5('0xd')](function(_0x5dbf93){var _0x357dbf=[];_0x357dbf[_0xebe5('0xa8')]({'name':_0x5dbf93['OptionSet'][_0xebe5('0xb4')][_0xebe5('0xae')][_0xebe5('0xb1')][_0xebe5('0xae')],'value':_0xebe5('0xb5')},{'name':_0x5dbf93[_0xebe5('0xad')][_0xebe5('0xb6')][_0xebe5('0xae')]['UserLocalizedLabel'][_0xebe5('0xae')],'value':'false'});var _0x3da339={'id':_0x30802d+'_'+_0x5dbf93[_0xebe5('0x9c')],'name':_0x5dbf93[_0xebe5('0xb0')][_0xebe5('0xb1')][_0xebe5('0xae')],'custom':![],'options':_0x357dbf};_0x23c95b[_0xebe5('0xa8')](_0x3da339);return _0x23c95b;});}function getInputList(_0x2d6631,_0x5f18b5,_0x11a1bc,_0x3ac1d2,_0xf664c1,_0x12fb1a,_0x51fb73){var _0x428061={'method':_0xebe5('0x94'),'uri':_0x2d6631+'EntityDefinitions('+_0xf664c1+_0xebe5('0xb2')+_0x12fb1a+_0xebe5('0xb7')+_0x11a1bc+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x51fb73,'If-None-Match':null,'OData-Version':_0xebe5('0x96')},'json':!![]};return rp(_0x428061)[_0xebe5('0xd')](function(_0x3d0ade){var _0x2166f0={'id':_0x5f18b5+'_'+_0x3d0ade[_0xebe5('0x9c')],'name':_0x3d0ade[_0xebe5('0xb0')][_0xebe5('0xb1')]?_0x3d0ade[_0xebe5('0xb0')]['UserLocalizedLabel'][_0xebe5('0xae')]:_0x3d0ade[_0xebe5('0x9c')],'custom':![],'options':[]};_0x3ac1d2['push'](_0x2166f0);return _0x3ac1d2;});} \ No newline at end of file +var _0x828b=['remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','IntegerAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','update','then','end','name','send','index','Dynamics365Account','rawAttributes','fieldName','key','map','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','query','order','sort','where','filter','merge','type','VIRTUAL','options','rows','show','params','includeAll','include','find','create','body','destroy','catch','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','title','customerid','phonenumber','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','clientId','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x828b,0x182));var _0xb828=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0x828b[_0x5c7525];return _0x2e2ec8;};'use strict';var rp=require(_0xb828('0x0'));var util=require('util');var _=require('lodash');var qs=require(_0xb828('0x1'));var logger=require(_0xb828('0x2'))(_0xb828('0x3'));var db=require(_0xb828('0x4'))['db'];var integrations=require(_0xb828('0x5'));function respondWithResult(_0x2db7a2,_0x42e085){_0x42e085=_0x42e085||0xc8;return function(_0x1db075){if(_0x1db075){return _0x2db7a2['status'](_0x42e085)[_0xb828('0x6')](_0x1db075);}};}function respondWithFilteredResult(_0x15cd75,_0x482e34){return function(_0x216d9b){if(_0x216d9b){var _0x508743=typeof _0x482e34[_0xb828('0x7')]===_0xb828('0x8')&&typeof _0x482e34[_0xb828('0x9')]==='undefined';var _0x12f481=_0x216d9b[_0xb828('0xa')];var _0x2f0df3=_0x508743?0x0:_0x482e34['offset'];var _0x33ff96=_0x508743?_0x216d9b[_0xb828('0xa')]:_0x482e34[_0xb828('0x7')]+_0x482e34[_0xb828('0x9')];var _0x50135e;if(_0x33ff96>=_0x12f481){_0x33ff96=_0x12f481;_0x50135e=0xc8;}else{_0x50135e=0xce;}_0x15cd75[_0xb828('0xb')](_0x50135e);return _0x15cd75['set']('Content-Range',_0x2f0df3+'-'+_0x33ff96+'/'+_0x12f481)[_0xb828('0x6')](_0x216d9b);}return null;};}function saveUpdates(_0x5892e7){return function(_0x2ba758){if(_0x2ba758){return _0x2ba758[_0xb828('0xc')](_0x5892e7)['then'](function(_0x46e217){return _0x46e217;});}return null;};}function removeEntity(_0x4ddddb){return function(_0x1db00b){if(_0x1db00b){return _0x1db00b['destroy']()[_0xb828('0xd')](function(){_0x4ddddb[_0xb828('0xb')](0xcc)[_0xb828('0xe')]();});}};}function handleEntityNotFound(_0x1d8233){return function(_0x43fd39){if(!_0x43fd39){_0x1d8233['sendStatus'](0x194);}return _0x43fd39;};}function handleError(_0x1c1ecc,_0x24137f){_0x24137f=_0x24137f||0x1f4;return function(_0x3eeed0){logger['error'](_0x3eeed0['stack']);if(_0x3eeed0[_0xb828('0xf')]){delete _0x3eeed0[_0xb828('0xf')];}_0x1c1ecc['status'](_0x24137f)[_0xb828('0x10')](_0x3eeed0);};}exports[_0xb828('0x11')]=function(_0x52909f,_0x103f3a){var _0x19019e={},_0x45bb24={},_0x4275cd={'count':0x0,'rows':[]};var _0x805ed8=_['map'](db[_0xb828('0x12')][_0xb828('0x13')],function(_0x55bf80){return{'name':_0x55bf80[_0xb828('0x14')],'type':_0x55bf80['type'][_0xb828('0x15')]};});_0x45bb24['model']=_[_0xb828('0x16')](_0x805ed8,'name');_0x45bb24['query']=_[_0xb828('0x17')](_0x52909f['query']);_0x45bb24[_0xb828('0x18')]=_[_0xb828('0x19')](_0x45bb24['model'],_0x45bb24['query']);_0x19019e[_0xb828('0x1a')]=_['intersection'](_0x45bb24[_0xb828('0x1b')],qs[_0xb828('0x1c')](_0x52909f['query'][_0xb828('0x1c')]));_0x19019e[_0xb828('0x1a')]=_0x19019e['attributes'][_0xb828('0x1d')]?_0x19019e[_0xb828('0x1a')]:_0x45bb24[_0xb828('0x1b')];if(!_0x52909f['query'][_0xb828('0x1e')](_0xb828('0x1f'))){_0x19019e['limit']=qs['limit'](_0x52909f[_0xb828('0x20')]['limit']);_0x19019e[_0xb828('0x7')]=qs['offset'](_0x52909f[_0xb828('0x20')][_0xb828('0x7')]);}_0x19019e[_0xb828('0x21')]=qs['sort'](_0x52909f[_0xb828('0x20')][_0xb828('0x22')]);_0x19019e[_0xb828('0x23')]=qs[_0xb828('0x18')](_['pick'](_0x52909f['query'],_0x45bb24[_0xb828('0x18')]),_0x805ed8);if(_0x52909f[_0xb828('0x20')][_0xb828('0x24')]){_0x19019e['where']=_[_0xb828('0x25')](_0x19019e[_0xb828('0x23')],{'$or':_[_0xb828('0x16')](_0x805ed8,function(_0x9957f0){if(_0x9957f0[_0xb828('0x26')]!==_0xb828('0x27')){var _0x4d2399={};_0x4d2399[_0x9957f0[_0xb828('0xf')]]={'$like':'%'+_0x52909f[_0xb828('0x20')][_0xb828('0x24')]+'%'};return _0x4d2399;}})});}_0x19019e=_[_0xb828('0x25')]({},_0x19019e,_0x52909f[_0xb828('0x28')]);var _0x316b4b={'where':_0x19019e[_0xb828('0x23')]};return db[_0xb828('0x12')][_0xb828('0xa')](_0x316b4b)[_0xb828('0xd')](function(_0x3333cf){_0x4275cd['count']=_0x3333cf;if(_0x52909f[_0xb828('0x20')]['includeAll']){_0x19019e['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x19019e);})[_0xb828('0xd')](function(_0x3605d6){_0x4275cd[_0xb828('0x29')]=_0x3605d6;return _0x4275cd;})['then'](respondWithFilteredResult(_0x103f3a,_0x19019e))['catch'](handleError(_0x103f3a,null));};exports[_0xb828('0x2a')]=function(_0x1c21c8,_0x1b2e49){var _0x1b2777={'raw':![],'where':{'id':_0x1c21c8[_0xb828('0x2b')]['id']}},_0x4f626f={};_0x4f626f[_0xb828('0x1b')]=_['keys'](db['Dynamics365Account'][_0xb828('0x13')]);_0x4f626f[_0xb828('0x20')]=_['keys'](_0x1c21c8[_0xb828('0x20')]);_0x4f626f['filters']=_[_0xb828('0x19')](_0x4f626f['model'],_0x4f626f[_0xb828('0x20')]);_0x1b2777[_0xb828('0x1a')]=_[_0xb828('0x19')](_0x4f626f[_0xb828('0x1b')],qs[_0xb828('0x1c')](_0x1c21c8[_0xb828('0x20')][_0xb828('0x1c')]));_0x1b2777['attributes']=_0x1b2777[_0xb828('0x1a')][_0xb828('0x1d')]?_0x1b2777[_0xb828('0x1a')]:_0x4f626f[_0xb828('0x1b')];if(_0x1c21c8[_0xb828('0x20')][_0xb828('0x2c')]){_0x1b2777[_0xb828('0x2d')]=[{'all':!![]}];}_0x1b2777=_[_0xb828('0x25')]({},_0x1b2777,_0x1c21c8['options']);return db[_0xb828('0x12')][_0xb828('0x2e')](_0x1b2777)[_0xb828('0xd')](handleEntityNotFound(_0x1b2e49,null))[_0xb828('0xd')](respondWithResult(_0x1b2e49,null))['catch'](handleError(_0x1b2e49,null));};exports['create']=function(_0x19ef64,_0x25fc89){return db[_0xb828('0x12')][_0xb828('0x2f')](_0x19ef64[_0xb828('0x30')],{})[_0xb828('0xd')](respondWithResult(_0x25fc89,0xc9))['catch'](handleError(_0x25fc89,null));};exports['update']=function(_0x26f135,_0x1dda63){if(_0x26f135[_0xb828('0x30')]['id']){delete _0x26f135['body']['id'];}return db[_0xb828('0x12')][_0xb828('0x2e')]({'where':{'id':_0x26f135['params']['id']}})[_0xb828('0xd')](handleEntityNotFound(_0x1dda63,null))[_0xb828('0xd')](saveUpdates(_0x26f135[_0xb828('0x30')],null))[_0xb828('0xd')](respondWithResult(_0x1dda63,null))['catch'](handleError(_0x1dda63,null));};exports[_0xb828('0x31')]=function(_0x48766e,_0x247be5){return db[_0xb828('0x12')][_0xb828('0x2e')]({'where':{'id':_0x48766e[_0xb828('0x2b')]['id']}})[_0xb828('0xd')](handleEntityNotFound(_0x247be5,null))['then'](removeEntity(_0x247be5,null))[_0xb828('0x32')](handleError(_0x247be5,null));};exports[_0xb828('0x33')]=function(_0x1bdcf5,_0xc690fb){var _0x3e8e2c={};var _0x5b08e1={};var _0x15c9fc;var _0x3c5577;return db[_0xb828('0x12')][_0xb828('0x34')]({'where':{'id':_0x1bdcf5['params']['id']}})[_0xb828('0xd')](handleEntityNotFound(_0xc690fb,null))[_0xb828('0xd')](function(_0x5a82d9){if(_0x5a82d9){_0x15c9fc=_0x5a82d9;_0x5b08e1[_0xb828('0x1b')]=_[_0xb828('0x17')](db['Dynamics365Configuration'][_0xb828('0x13')]);_0x5b08e1[_0xb828('0x20')]=_[_0xb828('0x17')](_0x1bdcf5['query']);_0x5b08e1['filters']=_[_0xb828('0x19')](_0x5b08e1[_0xb828('0x1b')],_0x5b08e1['query']);_0x3e8e2c[_0xb828('0x1a')]=_[_0xb828('0x19')](_0x5b08e1[_0xb828('0x1b')],qs[_0xb828('0x1c')](_0x1bdcf5['query'][_0xb828('0x1c')]));_0x3e8e2c['attributes']=_0x3e8e2c[_0xb828('0x1a')][_0xb828('0x1d')]?_0x3e8e2c[_0xb828('0x1a')]:_0x5b08e1[_0xb828('0x1b')];_0x3e8e2c[_0xb828('0x21')]=qs[_0xb828('0x22')](_0x1bdcf5[_0xb828('0x20')]['sort']);_0x3e8e2c[_0xb828('0x23')]=qs[_0xb828('0x18')](_['pick'](_0x1bdcf5['query'],_0x5b08e1['filters']));if(_0x1bdcf5[_0xb828('0x20')][_0xb828('0x24')]){_0x3e8e2c['where']=_[_0xb828('0x25')](_0x3e8e2c[_0xb828('0x23')],{'$or':_[_0xb828('0x16')](_0x3e8e2c[_0xb828('0x1a')],function(_0xfe4189){var _0x270e25={};_0x270e25[_0xfe4189]={'$like':'%'+_0x1bdcf5[_0xb828('0x20')]['filter']+'%'};return _0x270e25;})});}_0x3e8e2c=_[_0xb828('0x25')]({},_0x3e8e2c,_0x1bdcf5[_0xb828('0x28')]);return _0x15c9fc[_0xb828('0x33')](_0x3e8e2c);}})['then'](function(_0x4382f3){if(_0x4382f3){_0x3c5577=_0x4382f3['length'];if(!_0x1bdcf5['query'][_0xb828('0x1e')]('nolimit')){_0x3e8e2c[_0xb828('0x9')]=qs[_0xb828('0x9')](_0x1bdcf5[_0xb828('0x20')][_0xb828('0x9')]);_0x3e8e2c[_0xb828('0x7')]=qs[_0xb828('0x7')](_0x1bdcf5[_0xb828('0x20')][_0xb828('0x7')]);}return _0x15c9fc[_0xb828('0x33')](_0x3e8e2c);}})['then'](function(_0x3c37e2){if(_0x3c37e2){return _0x3c37e2?{'count':_0x3c5577,'rows':_0x3c37e2}:null;}})['then'](respondWithResult(_0xc690fb,null))[_0xb828('0x32')](handleError(_0xc690fb,null));};exports[_0xb828('0x35')]=function(_0x50a6d8,_0x255777){if(_0x50a6d8['body']['id']){delete _0x50a6d8[_0xb828('0x30')]['id'];}return db[_0xb828('0x12')][_0xb828('0x34')]({'where':{'id':_0x50a6d8[_0xb828('0x2b')]['id']}})['then'](handleEntityNotFound(_0x255777,null))['then'](function(_0xd26ecf){if(_0xd26ecf){_0x50a6d8[_0xb828('0x30')][_0xb828('0x36')]=_0xd26ecf['id'];_0x50a6d8['body'][_0xb828('0x37')]=integrations['getSubjects'](_0x50a6d8['body'][_0xb828('0x38')],_0x50a6d8[_0xb828('0x30')][_0xb828('0x26')]);_0x50a6d8[_0xb828('0x30')][_0xb828('0x39')]=integrations[_0xb828('0x3a')](_0x50a6d8[_0xb828('0x30')][_0xb828('0x38')],_0x50a6d8[_0xb828('0x30')][_0xb828('0x26')]);return db[_0xb828('0x3b')][_0xb828('0x2f')](_0x50a6d8[_0xb828('0x30')],{'include':[{'model':db[_0xb828('0x3c')],'as':_0xb828('0x37')},{'model':db[_0xb828('0x3c')],'as':_0xb828('0x39')}]});}return null;})['then'](respondWithResult(_0x255777,null))['catch'](handleError(_0x255777,null));};function sanitizeRemoteUri(_0x1e5a2d){var _0x3128bb=_0x1e5a2d[_0xb828('0x3d')](-0x1);if(_0x3128bb==='/')return _0x1e5a2d['substring'](0x0,_0x1e5a2d[_0xb828('0x3e')](_0x3128bb));return _0x1e5a2d;}function getWebApiUrl(_0x259942){return util[_0xb828('0x3f')](_0xb828('0x40'),_0x259942);}exports[_0xb828('0x41')]=function(_0x2dbb3e,_0x3eadbf){var _0x4954b3=_0x2dbb3e[_0xb828('0x20')][_0xb828('0x42')];var _0x10cf1d=_0x4954b3==='incident'?_0xb828('0x43'):'PhoneCall';var _0x31d466='';var _0x202b29='';var _0x415dd9='';var _0x14d3e7='';var _0x493626='';var _0x47586f='';var _0x1a46dc='';var _0x2b4fbb='';var _0x3ab88f=[_0xb828('0x44'),'description',_0xb828('0x45'),'ownerid','caseorigincode','subject',_0xb828('0x46'),'regardingobjectid','directioncode',_0xb828('0x47')];var _0x177468=[_0xb828('0x48'),_0xb828('0x49'),'actualserviceunits',_0xb828('0x4a'),_0xb828('0x4b'),'contactidyominame',_0xb828('0x4c'),_0xb828('0x4d'),'createdbyexternalpartyname',_0xb828('0x4e'),_0xb828('0x4f'),'createdbyyominame',_0xb828('0x50'),_0xb828('0x51'),_0xb828('0x52'),_0xb828('0x53'),_0xb828('0x54'),'customeridyominame',_0xb828('0x55'),_0xb828('0x56'),_0xb828('0x57'),_0xb828('0x58'),_0xb828('0x59'),'exchangerate','firstresponsebykpiidname',_0xb828('0x5a'),_0xb828('0x5b'),'influencescore',_0xb828('0x5c'),_0xb828('0x5d'),'masteridname',_0xb828('0x5e'),_0xb828('0x5f'),'modifiedbyname',_0xb828('0x60'),'modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xb828('0x61'),'msdyn_iotalertname',_0xb828('0x62'),_0xb828('0x63'),_0xb828('0x64'),_0xb828('0x65'),'owneridtype','owneridyominame',_0xb828('0x66'),_0xb828('0x67'),_0xb828('0x68'),_0xb828('0x69'),'productidname',_0xb828('0x6a'),_0xb828('0x6b'),'resolvebykpiidname',_0xb828('0x6c'),_0xb828('0x6d'),_0xb828('0x6e'),_0xb828('0x6f'),'slainvokedidname',_0xb828('0x70'),_0xb828('0x71'),_0xb828('0x72'),_0xb828('0x73'),'subjectidname',_0xb828('0x74'),_0xb828('0x75'),_0xb828('0x76'),_0xb828('0x77'),'utcconversiontimezonecode',_0xb828('0x78')];var _0x5f433c=_0x3ab88f[_0xb828('0x79')](_0x177468);return db[_0xb828('0x12')][_0xb828('0x34')]({'where':{'id':_0x2dbb3e[_0xb828('0x2b')]['id']},'attributes':['id','username',_0xb828('0x7a'),_0xb828('0x7b'),_0xb828('0x7c'),'clientId',_0xb828('0x7d'),_0xb828('0x7e')],'include':[{'model':db[_0xb828('0x7f')],'as':_0xb828('0x7f'),'attributes':['id',_0xb828('0x80'),_0xb828('0x81')]}]})[_0xb828('0xd')](handleEntityNotFound(_0x3eadbf,null))[_0xb828('0xd')](function(_0x4f7da0){if(_0x4f7da0){if(_0x4f7da0[_0xb828('0x7e')]){_0x4f7da0[_0xb828('0x82')]=_0x4f7da0[_0xb828('0x7f')]['data5'];_0x2b4fbb=sanitizeRemoteUri(_0x4f7da0['CloudProvider'][_0xb828('0x81')]);_0x1a46dc=getWebApiUrl(_0x2b4fbb);return _0x4f7da0;}_0x2b4fbb=sanitizeRemoteUri(_0x4f7da0[_0xb828('0x7b')]);_0x1a46dc=getWebApiUrl(_0x2b4fbb);var _0x5a38be={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x4f7da0[_0xb828('0x7c')]+'/oauth2/token','form':{'client_id':_0x4f7da0[_0xb828('0x83')],'resource':_0x2b4fbb,'username':_0x4f7da0[_0xb828('0x84')],'password':_0x4f7da0['password'],'grant_type':_0xb828('0x7a'),'client_secret':_0x4f7da0[_0xb828('0x7d')]},'json':!![]};return rp(_0x5a38be);}})[_0xb828('0xd')](function(_0x166746){_0x47586f=_0x166746[_0xb828('0x82')];var _0x2ec79c={'method':_0xb828('0x85'),'uri':encodeURI(_0x1a46dc+_0xb828('0x86')+_0x10cf1d+'\x27'),'headers':{'Authorization':_0xb828('0x87')+_0x47586f,'If-None-Match':null,'OData-Version':_0xb828('0x88')},'json':!![]};return rp(_0x2ec79c);})[_0xb828('0xd')](function(_0x5aaa27){var _0x532c75=_0x5aaa27[_0xb828('0x89')][0x0];var _0x283bff=_0x532c75['MetadataId'];var _0x277794={'method':_0xb828('0x85'),'uri':_0x1a46dc+'EntityDefinitions('+_0x283bff+_0xb828('0x8a'),'headers':{'Authorization':_0xb828('0x87')+_0x47586f,'If-None-Match':null,'OData-Version':_0xb828('0x88')},'json':!![]};return rp(_0x277794);})[_0xb828('0xd')](function(_0x5a0b53){_0x31d466=_0x5a0b53;_0x202b29=_0x31d466['Attributes'];_0x202b29=_[_0xb828('0x8b')](_0x202b29,function(_0x343302){return!_0x5f433c[_0xb828('0x8c')](_0x343302[_0xb828('0x8d')]);});var _0x5cd60d=[];var _0x3523a9=[];_0x202b29[_0xb828('0x8e')](function(_0x4951c6){if(_0x4951c6['@odata.type']){var _0x3a49be=_0x4951c6[_0xb828('0x8f')][_0xb828('0x90')](_0x4951c6['@odata.type'][_0xb828('0x3e')]('.')+0x1);if(_0x3a49be===_0xb828('0x91')){_0x5cd60d['push'](getSelectList(_0x1a46dc,_0x4954b3,_0x3523a9,_0x31d466['MetadataId'],_0x4951c6[_0xb828('0x92')],_0x47586f));}}});return Promise[_0xb828('0x93')](_0x5cd60d);})['then'](function(_0x45ef04){_0x415dd9=_0x45ef04[0x0];var _0x5acbbe=[];var _0x3f9ba6=[];_0x202b29['forEach'](function(_0x268607){if(!_[_0xb828('0x94')](_0x268607[_0xb828('0x8f')])){var _0x5ca5e6=_0x268607[_0xb828('0x8f')][_0xb828('0x90')](_0x268607['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5ca5e6===_0xb828('0x95')){_0x5acbbe[_0xb828('0x96')](getBooleanList(_0x1a46dc,_0x4954b3,_0x3f9ba6,_0x31d466[_0xb828('0x92')],_0x268607[_0xb828('0x92')],_0x47586f));}}});return Promise[_0xb828('0x93')](_0x5acbbe);})[_0xb828('0xd')](function(_0x2da7e1){_0x14d3e7=_0x2da7e1[0x0];var _0x335a7c=[];var _0x30d988=[];_0x202b29[_0xb828('0x8e')](function(_0x190f0a){if(_0x190f0a[_0xb828('0x8f')]){var _0x95e5cd=_0x190f0a[_0xb828('0x8f')]['substring'](_0x190f0a['@odata.type'][_0xb828('0x3e')]('.')+0x1);if(_0x95e5cd==='StringAttributeMetadata'||_0x95e5cd==='DoubleAttributeMetadata'||_0x95e5cd==='BigIntAttributeMetadata'||_0x95e5cd===_0xb828('0x97')||_0x95e5cd==='MemoAttributeMetadata'||_0x95e5cd==='DateTimeAttributeMetadata'||_0x95e5cd==='StatusAttributeMetadata'||_0x95e5cd===_0xb828('0x98')||_0x95e5cd===_0xb828('0x99')||_0x95e5cd===_0xb828('0x9a')){_0x335a7c[_0xb828('0x96')](getInputList(_0x1a46dc,_0x4954b3,_0x95e5cd,_0x30d988,_0x31d466[_0xb828('0x92')],_0x190f0a[_0xb828('0x92')],_0x47586f));}}});return Promise[_0xb828('0x93')](_0x335a7c);})[_0xb828('0xd')](function(_0x3eea26){_0x493626=_0x3eea26[0x0];var _0x3ea444=_0x415dd9[_0xb828('0x79')](_0x14d3e7)[_0xb828('0x79')](_0x493626);var _0x39b171={'count':_0x3ea444[_0xb828('0x1d')],'rows':_0x3ea444};return _0x39b171;})['then'](respondWithResult(_0x3eadbf,null))[_0xb828('0x32')](function(_0x3adf16){var _0x42e505=_0x2dbb3e[_0xb828('0x20')][_0xb828('0x9b')]?0x1f4:_0x3adf16[_0xb828('0x9c')]||0x1f4;logger[_0xb828('0x9d')](_0x3adf16['stack']);delete _0x3adf16[_0xb828('0xf')];if(_0x42e505===0x191){_0x42e505=0x190;}_0x3eadbf[_0xb828('0xb')](_0x42e505)[_0xb828('0x10')](_0x2dbb3e['query'][_0xb828('0x9b')]?{'message':_0xb828('0x9e'),'statusCode':_0x3adf16['statusCode']}:_0x3adf16);});};function getSelectList(_0x25a9c4,_0x5e0c7e,_0x1873c5,_0x64bc31,_0xa0acbd,_0x386f13){var _0x59d598={'method':_0xb828('0x85'),'uri':_0x25a9c4+_0xb828('0x9f')+_0x64bc31+_0xb828('0xa0')+_0xa0acbd+_0xb828('0xa1')+_0xb828('0xa2'),'headers':{'Authorization':'Bearer\x20'+_0x386f13,'If-None-Match':null,'OData-Version':_0xb828('0x88')},'json':!![]};return rp(_0x59d598)[_0xb828('0xd')](function(_0x2bf731){var _0xf51ac2=[];var _0x5cd475=_0x2bf731['OptionSet'][_0xb828('0xa3')];_0x5cd475['forEach'](function(_0x57ecdf){_0xf51ac2[_0xb828('0x96')]({'name':_0x57ecdf['Label'][_0xb828('0xa4')][_0xb828('0xa5')],'value':String(_0x57ecdf[_0xb828('0xa6')])});});var _0x3d9764={'id':_0x5e0c7e+'_'+_0x2bf731[_0xb828('0x8d')],'name':_0x2bf731[_0xb828('0xa7')][_0xb828('0xa4')][_0xb828('0xa5')],'custom':![],'options':_0xf51ac2};_0x1873c5[_0xb828('0x96')](_0x3d9764);return _0x1873c5;});}function getBooleanList(_0x366828,_0x434617,_0x2d5f04,_0x223406,_0x45a61a,_0x31e758){var _0x83c775={'method':_0xb828('0x85'),'uri':_0x366828+_0xb828('0x9f')+_0x223406+_0xb828('0xa0')+_0x45a61a+_0xb828('0xa8'),'headers':{'Authorization':_0xb828('0x87')+_0x31e758,'If-None-Match':null,'OData-Version':_0xb828('0x88')},'json':!![]};return rp(_0x83c775)[_0xb828('0xd')](function(_0x3abd54){var _0x18b482=[];_0x18b482[_0xb828('0x96')]({'name':_0x3abd54[_0xb828('0xa9')][_0xb828('0xaa')][_0xb828('0xa5')][_0xb828('0xa4')][_0xb828('0xa5')],'value':_0xb828('0xab')},{'name':_0x3abd54[_0xb828('0xa9')][_0xb828('0xac')][_0xb828('0xa5')]['UserLocalizedLabel']['Label'],'value':_0xb828('0xad')});var _0x3be7b4={'id':_0x434617+'_'+_0x3abd54[_0xb828('0x8d')],'name':_0x3abd54[_0xb828('0xa7')][_0xb828('0xa4')][_0xb828('0xa5')],'custom':![],'options':_0x18b482};_0x2d5f04[_0xb828('0x96')](_0x3be7b4);return _0x2d5f04;});}function getInputList(_0x3c0543,_0x1484bc,_0x21268e,_0x2209db,_0x5763df,_0x208281,_0x52bef0){var _0x3a1616={'method':_0xb828('0x85'),'uri':_0x3c0543+_0xb828('0x9f')+_0x5763df+_0xb828('0xa0')+_0x208281+')/Microsoft.Dynamics.CRM.'+_0x21268e+_0xb828('0xae'),'headers':{'Authorization':_0xb828('0x87')+_0x52bef0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a1616)[_0xb828('0xd')](function(_0x3a93c8){var _0x463e48={'id':_0x1484bc+'_'+_0x3a93c8[_0xb828('0x8d')],'name':_0x3a93c8[_0xb828('0xa7')]['UserLocalizedLabel']?_0x3a93c8[_0xb828('0xa7')][_0xb828('0xa4')]['Label']:_0x3a93c8['LogicalName'],'custom':![],'options':[]};_0x2209db[_0xb828('0x96')](_0x463e48);return _0x2209db;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a4141de..51246e1 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x40766f,_0x1e6935){var _0x11fb7e=function(_0x4e83c1){while(--_0x4e83c1){_0x40766f['push'](_0x40766f['shift']());}};_0x11fb7e(++_0x1e6935);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x3ea59e,_0x42d141){var _0x5b01d6=function(_0xedeecf){while(--_0xedeecf){_0x3ea59e['push'](_0x3ea59e['shift']());}};_0x5b01d6(++_0x42d141);}(_0xe706,0xa3));var _0x6e70=function(_0x33a573,_0x5e88b2){_0x33a573=_0x33a573-0x0;var _0xa8c4c0=_0xe706[_0x33a573];return _0xa8c4c0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index e730448..20bba6b 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 _0x9012=['then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','Dynamics365Account','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x178176,_0x326f1a){var _0x36c404=function(_0x4dfe90){while(--_0x4dfe90){_0x178176['push'](_0x178176['shift']());}};_0x36c404(++_0x326f1a);}(_0x9012,0x147));var _0x2901=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x9012[_0xb0de07];return _0x4633d8;};'use strict';var _=require('lodash');var util=require(_0x2901('0x0'));var moment=require(_0x2901('0x1'));var BPromise=require(_0x2901('0x2'));var rs=require(_0x2901('0x3'));var fs=require('fs');var Redis=require(_0x2901('0x4'));var db=require(_0x2901('0x5'))['db'];var utils=require(_0x2901('0x6'));var logger=require(_0x2901('0x7'))(_0x2901('0x8'));var config=require(_0x2901('0x9'));var jayson=require(_0x2901('0xa'));var client=jayson[_0x2901('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190ed9,_0x4d1111,_0x2119f7){return new BPromise(function(_0x37adee,_0x46de90){return client[_0x2901('0xc')](_0x190ed9,_0x2119f7)[_0x2901('0xd')](function(_0x208bff){logger[_0x2901('0xe')](_0x2901('0xf'),_0x4d1111,_0x2901('0x10'));logger[_0x2901('0x11')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4d1111,_0x2901('0x10'),JSON[_0x2901('0x12')](_0x208bff));if(_0x208bff[_0x2901('0x13')]){if(_0x208bff[_0x2901('0x13')]['code']===0x1f4){logger[_0x2901('0x13')](_0x2901('0xf'),_0x4d1111,_0x208bff['error']['message']);return _0x46de90(_0x208bff[_0x2901('0x13')][_0x2901('0x14')]);}logger[_0x2901('0x13')](_0x2901('0xf'),_0x4d1111,_0x208bff['error'][_0x2901('0x14')]);return _0x37adee(_0x208bff[_0x2901('0x13')][_0x2901('0x14')]);}else{logger[_0x2901('0xe')](_0x2901('0xf'),_0x4d1111,_0x2901('0x10'));_0x37adee(_0x208bff[_0x2901('0x15')][_0x2901('0x14')]);}})[_0x2901('0x16')](function(_0x30a6c8){logger[_0x2901('0x13')](_0x2901('0xf'),_0x4d1111,_0x30a6c8);_0x46de90(_0x30a6c8);});});}exports['GetDynamics365Account']=function(_0x4ceaa6){var _0x4c13e2=this;return new Promise(function(_0x40cd95,_0x1ea586){return db[_0x2901('0x17')]['findAll']({'raw':_0x4ceaa6[_0x2901('0x18')]?_0x4ceaa6[_0x2901('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4ceaa6[_0x2901('0x18')]?_0x4ceaa6[_0x2901('0x18')][_0x2901('0x19')]||null:null,'attributes':_0x4ceaa6[_0x2901('0x18')]?_0x4ceaa6[_0x2901('0x18')][_0x2901('0x1a')]||null:null,'limit':_0x4ceaa6['options']?_0x4ceaa6[_0x2901('0x18')][_0x2901('0x1b')]||null:null,'include':_0x4ceaa6[_0x2901('0x18')]?_0x4ceaa6[_0x2901('0x18')][_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x4ceaa6[_0x2901('0x18')][_0x2901('0x1c')],function(_0x5cef6b){return{'model':db[_0x5cef6b['model']],'as':_0x5cef6b['as'],'attributes':_0x5cef6b['attributes'],'include':_0x5cef6b[_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x5cef6b[_0x2901('0x1c')],function(_0x2c393f){return{'model':db[_0x2c393f[_0x2901('0x1e')]],'as':_0x2c393f['as'],'attributes':_0x2c393f[_0x2901('0x1a')],'include':_0x2c393f[_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x2c393f[_0x2901('0x1c')],function(_0x59cf73){return{'model':db[_0x59cf73[_0x2901('0x1e')]],'as':_0x59cf73['as'],'attributes':_0x59cf73[_0x2901('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ccbd1){logger['info'](_0x2901('0x1f'),_0x4ceaa6);logger[_0x2901('0x11')](_0x2901('0x1f'),_0x4ceaa6,JSON[_0x2901('0x12')](_0x2ccbd1));_0x40cd95(_0x2ccbd1);})[_0x2901('0x16')](function(_0x61824d){logger[_0x2901('0x13')](_0x2901('0x1f'),_0x61824d[_0x2901('0x14')],_0x4ceaa6);_0x1ea586(_0x4c13e2[_0x2901('0x13')](0x1f4,_0x61824d[_0x2901('0x14')]));});});};exports[_0x2901('0x20')]=function(_0x305f13){var _0x797e1d=this;return new Promise(function(_0x18bf34,_0x57d56b){return db[_0x2901('0x17')]['find']({'raw':_0x305f13[_0x2901('0x18')]?_0x305f13['options'][_0x2901('0x21')]===undefined?!![]:![]:!![],'where':_0x305f13[_0x2901('0x18')]?_0x305f13[_0x2901('0x18')][_0x2901('0x19')]||null:null,'attributes':_0x305f13['options']?_0x305f13[_0x2901('0x18')][_0x2901('0x1a')]||null:null,'include':_0x305f13[_0x2901('0x18')]?_0x305f13[_0x2901('0x18')][_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x305f13[_0x2901('0x18')][_0x2901('0x1c')],function(_0x598df2){return{'model':db[_0x598df2[_0x2901('0x1e')]],'as':_0x598df2['as'],'attributes':_0x598df2['attributes'],'include':_0x598df2[_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x598df2[_0x2901('0x1c')],function(_0x5955ac){return{'model':db[_0x5955ac[_0x2901('0x1e')]],'as':_0x5955ac['as'],'attributes':_0x5955ac[_0x2901('0x1a')],'include':_0x5955ac['include']?_[_0x2901('0x1d')](_0x5955ac[_0x2901('0x1c')],function(_0x387856){return{'model':db[_0x387856[_0x2901('0x1e')]],'as':_0x387856['as'],'attributes':_0x387856[_0x2901('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2901('0xd')](function(_0x3a72b0){logger[_0x2901('0xe')](_0x2901('0x20'),_0x305f13);logger[_0x2901('0x11')](_0x2901('0x20'),_0x305f13,JSON['stringify'](_0x3a72b0));_0x18bf34(_0x3a72b0);})[_0x2901('0x16')](function(_0x321426){logger[_0x2901('0x13')]('ShowDynamics365Account',_0x321426[_0x2901('0x14')],_0x305f13);_0x57d56b(_0x797e1d[_0x2901('0x13')](0x1f4,_0x321426[_0x2901('0x14')]));});});}; \ No newline at end of file +var _0xef66=['stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','include','map','model','ShowDynamics365Account','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','Dynamics365Account,\x20%s,\x20%s','debug'];(function(_0x1bd1d1,_0x177176){var _0x178b20=function(_0x42f762){while(--_0x42f762){_0x1bd1d1['push'](_0x1bd1d1['shift']());}};_0x178b20(++_0x177176);}(_0xef66,0x19e));var _0x6ef6=function(_0x2199f5,_0xcce7be){_0x2199f5=_0x2199f5-0x0;var _0x240fbd=_0xef66[_0x2199f5];return _0x240fbd;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require(_0x6ef6('0x5'));var db=require(_0x6ef6('0x6'))['db'];var utils=require(_0x6ef6('0x7'));var logger=require(_0x6ef6('0x8'))(_0x6ef6('0x9'));var config=require('../../config/environment');var jayson=require(_0x6ef6('0xa'));var client=jayson['client'][_0x6ef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c360b,_0x103db2,_0x444beb){return new BPromise(function(_0x467e75,_0x22f6c3){return client['request'](_0x5c360b,_0x444beb)['then'](function(_0x532105){logger[_0x6ef6('0xc')](_0x6ef6('0xd'),_0x103db2,'request\x20sent');logger[_0x6ef6('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x103db2,'request\x20sent',JSON[_0x6ef6('0xf')](_0x532105));if(_0x532105[_0x6ef6('0x10')]){if(_0x532105['error'][_0x6ef6('0x11')]===0x1f4){logger[_0x6ef6('0x10')](_0x6ef6('0xd'),_0x103db2,_0x532105[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0x22f6c3(_0x532105[_0x6ef6('0x10')][_0x6ef6('0x12')]);}logger[_0x6ef6('0x10')](_0x6ef6('0xd'),_0x103db2,_0x532105[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0x467e75(_0x532105['error'][_0x6ef6('0x12')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x103db2,'request\x20sent');_0x467e75(_0x532105[_0x6ef6('0x13')][_0x6ef6('0x12')]);}})[_0x6ef6('0x14')](function(_0xfb8bd7){logger[_0x6ef6('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x103db2,_0xfb8bd7);_0x22f6c3(_0xfb8bd7);});});}exports[_0x6ef6('0x15')]=function(_0x2f7234){var _0x1614a4=this;return new Promise(function(_0x401452,_0x13ddc9){return db[_0x6ef6('0x16')][_0x6ef6('0x17')]({'raw':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234[_0x6ef6('0x18')][_0x6ef6('0x19')]===undefined?!![]:![]:!![],'where':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234[_0x6ef6('0x18')]['where']||null:null,'attributes':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234['options'][_0x6ef6('0x1a')]||null:null,'limit':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234['options']['limit']||null:null,'include':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234[_0x6ef6('0x18')][_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x2f7234[_0x6ef6('0x18')]['include'],function(_0x1fca74){return{'model':db[_0x1fca74[_0x6ef6('0x1d')]],'as':_0x1fca74['as'],'attributes':_0x1fca74[_0x6ef6('0x1a')],'include':_0x1fca74[_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x1fca74[_0x6ef6('0x1b')],function(_0xbb85af){return{'model':db[_0xbb85af[_0x6ef6('0x1d')]],'as':_0xbb85af['as'],'attributes':_0xbb85af[_0x6ef6('0x1a')],'include':_0xbb85af['include']?_[_0x6ef6('0x1c')](_0xbb85af[_0x6ef6('0x1b')],function(_0x32722c){return{'model':db[_0x32722c['model']],'as':_0x32722c['as'],'attributes':_0x32722c[_0x6ef6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4999ba){logger[_0x6ef6('0xc')]('GetDynamics365Account',_0x2f7234);logger[_0x6ef6('0xe')](_0x6ef6('0x15'),_0x2f7234,JSON[_0x6ef6('0xf')](_0x4999ba));_0x401452(_0x4999ba);})[_0x6ef6('0x14')](function(_0x3a0b0b){logger[_0x6ef6('0x10')](_0x6ef6('0x15'),_0x3a0b0b['message'],_0x2f7234);_0x13ddc9(_0x1614a4[_0x6ef6('0x10')](0x1f4,_0x3a0b0b[_0x6ef6('0x12')]));});});};exports[_0x6ef6('0x1e')]=function(_0x1d4ec0){var _0xc0b2a2=this;return new Promise(function(_0x15ab24,_0xb69826){return db[_0x6ef6('0x16')]['find']({'raw':_0x1d4ec0[_0x6ef6('0x18')]?_0x1d4ec0[_0x6ef6('0x18')][_0x6ef6('0x19')]===undefined?!![]:![]:!![],'where':_0x1d4ec0[_0x6ef6('0x18')]?_0x1d4ec0['options'][_0x6ef6('0x1f')]||null:null,'attributes':_0x1d4ec0['options']?_0x1d4ec0[_0x6ef6('0x18')]['attributes']||null:null,'include':_0x1d4ec0[_0x6ef6('0x18')]?_0x1d4ec0[_0x6ef6('0x18')][_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x1d4ec0[_0x6ef6('0x18')][_0x6ef6('0x1b')],function(_0x543363){return{'model':db[_0x543363[_0x6ef6('0x1d')]],'as':_0x543363['as'],'attributes':_0x543363['attributes'],'include':_0x543363[_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x543363[_0x6ef6('0x1b')],function(_0x4b7387){return{'model':db[_0x4b7387[_0x6ef6('0x1d')]],'as':_0x4b7387['as'],'attributes':_0x4b7387[_0x6ef6('0x1a')],'include':_0x4b7387[_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x4b7387[_0x6ef6('0x1b')],function(_0x2b2bf5){return{'model':db[_0x2b2bf5[_0x6ef6('0x1d')]],'as':_0x2b2bf5['as'],'attributes':_0x2b2bf5[_0x6ef6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6ef6('0x20')](function(_0x4994d9){logger[_0x6ef6('0xc')](_0x6ef6('0x1e'),_0x1d4ec0);logger[_0x6ef6('0xe')](_0x6ef6('0x1e'),_0x1d4ec0,JSON['stringify'](_0x4994d9));_0x15ab24(_0x4994d9);})[_0x6ef6('0x14')](function(_0x3253a3){logger[_0x6ef6('0x10')](_0x6ef6('0x1e'),_0x3253a3['message'],_0x1d4ec0);_0xb69826(_0xc0b2a2[_0x6ef6('0x10')](0x1f4,_0x3253a3[_0x6ef6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 3605f1f..f42da3a 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 _0x119c=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x36fbc5,_0x5c51d6){var _0x1aa625=function(_0x16fe6d){while(--_0x16fe6d){_0x36fbc5['push'](_0x36fbc5['shift']());}};_0x1aa625(++_0x5c51d6);}(_0x119c,0xea));var _0xc119=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x119c[_0x1034ee];return _0x2922af;};'use strict';var multer=require('multer');var util=require(_0xc119('0x0'));var path=require('path');var timeout=require(_0xc119('0x1'));var express=require(_0xc119('0x2'));var router=express[_0xc119('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc119('0x4'));var interaction=require(_0xc119('0x5'));var config=require(_0xc119('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xc119('0x7')]('/',auth['isAuthenticated'](),controller[_0xc119('0x8')]);router['get'](_0xc119('0x9'),auth[_0xc119('0xa')](),controller[_0xc119('0xb')]);router[_0xc119('0x7')](_0xc119('0xc'),auth[_0xc119('0xa')](),controller[_0xc119('0xd')]);router[_0xc119('0x7')](_0xc119('0xe'),auth[_0xc119('0xa')](),controller[_0xc119('0xf')]);router['get'](_0xc119('0x10'),auth['isAuthenticated'](),controller[_0xc119('0x11')]);router[_0xc119('0x12')]('/',auth[_0xc119('0xa')](),controller[_0xc119('0x13')]);router[_0xc119('0x14')](_0xc119('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc119('0x15')](_0xc119('0x9'),auth[_0xc119('0xa')](),controller[_0xc119('0x16')]);module[_0xc119('0x17')]=router; \ No newline at end of file +var _0xb459=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','exports','util','path'];(function(_0x59308b,_0x1a729f){var _0x380534=function(_0xb6a005){while(--_0xb6a005){_0x59308b['push'](_0x59308b['shift']());}};_0x380534(++_0x1a729f);}(_0xb459,0x1ca));var _0x9b45=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0xb459[_0x3e2489];return _0x2254ce;};'use strict';var multer=require('multer');var util=require(_0x9b45('0x0'));var path=require(_0x9b45('0x1'));var timeout=require('connect-timeout');var express=require(_0x9b45('0x2'));var router=express[_0x9b45('0x3')]();var fs_extra=require(_0x9b45('0x4'));var auth=require(_0x9b45('0x5'));var interaction=require(_0x9b45('0x6'));var config=require(_0x9b45('0x7'));var controller=require(_0x9b45('0x8'));router[_0x9b45('0x9')]('/',auth[_0x9b45('0xa')](),controller['index']);router[_0x9b45('0x9')](_0x9b45('0xb'),auth[_0x9b45('0xa')](),controller['show']);router[_0x9b45('0x9')](_0x9b45('0xc'),auth[_0x9b45('0xa')](),controller[_0x9b45('0xd')]);router['get'](_0x9b45('0xe'),auth[_0x9b45('0xa')](),controller[_0x9b45('0xf')]);router['get'](_0x9b45('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x9b45('0x11')]('/',auth[_0x9b45('0xa')](),controller[_0x9b45('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x9b45('0xb'),auth[_0x9b45('0xa')](),controller['destroy']);module[_0x9b45('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f9b2072..eb7f2ce 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 _0x8b94=['contact','sequelize','exports','STRING','ENUM'];(function(_0x51be17,_0x14d549){var _0xf9eca4=function(_0x580b98){while(--_0x580b98){_0x51be17['push'](_0x51be17['shift']());}};_0xf9eca4(++_0x14d549);}(_0x8b94,0x1cd));var _0x48b9=function(_0x490299,_0x553441){_0x490299=_0x490299-0x0;var _0x412f5f=_0x8b94[_0x490299];return _0x412f5f;};'use strict';var Sequelize=require(_0x48b9('0x0'));module[_0x48b9('0x1')]={'name':{'type':Sequelize[_0x48b9('0x2')]},'description':{'type':Sequelize[_0x48b9('0x2')]},'ticketType':{'type':Sequelize[_0x48b9('0x3')]('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x48b9('0x3')](_0x48b9('0x4'),'nothing'),'defaultValue':_0x48b9('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7768=['contact','nothing','BOOLEAN','STRING','ENUM','incident','phonecall'];(function(_0x2eee99,_0x102d54){var _0x2689b0=function(_0x560c81){while(--_0x560c81){_0x2eee99['push'](_0x2eee99['shift']());}};_0x2689b0(++_0x102d54);}(_0x7768,0x145));var _0x8776=function(_0x175391,_0x98f011){_0x175391=_0x175391-0x0;var _0x44b8cf=_0x7768[_0x175391];return _0x44b8cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8776('0x0')]},'ticketType':{'type':Sequelize[_0x8776('0x1')](_0x8776('0x2'),_0x8776('0x3')),'defaultValue':_0x8776('0x2')},'moduleCreate':{'type':Sequelize['ENUM'](_0x8776('0x4'),_0x8776('0x5')),'defaultValue':_0x8776('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8776('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8776('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index f2ad465..30a195e 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 _0x46e5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','findOne','Dynamics365Field','filter','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring'];(function(_0x25a950,_0x3b757b){var _0x40713d=function(_0xe360ac){while(--_0xe360ac){_0x25a950['push'](_0x25a950['shift']());}};_0x40713d(++_0x3b757b);}(_0x46e5,0xe8));var _0x546e=function(_0x4a325c,_0x422654){_0x4a325c=_0x4a325c-0x0;var _0x1b6676=_0x46e5[_0x4a325c];return _0x1b6676;};'use strict';var emlformat=require(_0x546e('0x0'));var rimraf=require(_0x546e('0x1'));var zipdir=require(_0x546e('0x2'));var jsonpatch=require(_0x546e('0x3'));var rp=require(_0x546e('0x4'));var moment=require('moment');var BPromise=require(_0x546e('0x5'));var Mustache=require('mustache');var util=require(_0x546e('0x6'));var path=require('path');var sox=require(_0x546e('0x7'));var csv=require(_0x546e('0x8'));var ejs=require(_0x546e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x546e('0xa'));var squel=require(_0x546e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x546e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x546e('0xd'));var Papa=require(_0x546e('0xe'));var Redis=require(_0x546e('0xf'));var authService=require(_0x546e('0x10'));var qs=require(_0x546e('0x11'));var as=require(_0x546e('0x12'));var hardwareService=require(_0x546e('0x13'));var logger=require(_0x546e('0x14'))(_0x546e('0x15'));var utils=require(_0x546e('0x16'));var config=require(_0x546e('0x17'));var licenseUtil=require(_0x546e('0x18'));var db=require(_0x546e('0x19'))['db'];function respondWithStatusCode(_0x30c6a5,_0x9abbf7){_0x9abbf7=_0x9abbf7||0xcc;return function(_0x27cf1d){if(_0x27cf1d){return _0x30c6a5[_0x546e('0x1a')](_0x9abbf7);}return _0x30c6a5[_0x546e('0x1b')](_0x9abbf7)[_0x546e('0x1c')]();};}function respondWithResult(_0x5a602a,_0x3509d8){_0x3509d8=_0x3509d8||0xc8;return function(_0x424f71){if(_0x424f71){return _0x5a602a['status'](_0x3509d8)['json'](_0x424f71);}};}function respondWithFilteredResult(_0x5a84a5,_0x4833d9){return function(_0x29b640){if(_0x29b640){var _0x34cd19=typeof _0x4833d9['offset']==='undefined'&&typeof _0x4833d9[_0x546e('0x1d')]==='undefined';var _0x4bbc6e=_0x29b640[_0x546e('0x1e')];var _0x5f0493=_0x34cd19?0x0:_0x4833d9[_0x546e('0x1f')];var _0x49da06=_0x34cd19?_0x29b640[_0x546e('0x1e')]:_0x4833d9['offset']+_0x4833d9[_0x546e('0x1d')];var _0x5cdc32;if(_0x49da06>=_0x4bbc6e){_0x49da06=_0x4bbc6e;_0x5cdc32=0xc8;}else{_0x5cdc32=0xce;}_0x5a84a5[_0x546e('0x1b')](_0x5cdc32);return _0x5a84a5[_0x546e('0x20')](_0x546e('0x21'),_0x5f0493+'-'+_0x49da06+'/'+_0x4bbc6e)[_0x546e('0x22')](_0x29b640);}return null;};}function patchUpdates(_0x25d721){return function(_0x57eb91){try{jsonpatch[_0x546e('0x23')](_0x57eb91,_0x25d721,!![]);}catch(_0x1ce9e4){return BPromise[_0x546e('0x24')](_0x1ce9e4);}return _0x57eb91[_0x546e('0x25')]();};}function saveUpdates(_0xe1064b,_0x2f0630){return function(_0x33033f){if(_0x33033f){return _0x33033f[_0x546e('0x26')](_0xe1064b)[_0x546e('0x27')](function(_0x4b038e){return _0x4b038e;});}return null;};}function removeEntity(_0x327d71,_0x31014d){return function(_0x5205f9){if(_0x5205f9){return _0x5205f9[_0x546e('0x28')]()[_0x546e('0x27')](function(){_0x327d71[_0x546e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1eecb,_0x21e34b){return function(_0x505bc9){if(!_0x505bc9){_0xf1eecb[_0x546e('0x1a')](0x194);}return _0x505bc9;};}function handleError(_0x1bd900,_0x1dba59){_0x1dba59=_0x1dba59||0x1f4;return function(_0x2ff90e){logger[_0x546e('0x29')](_0x2ff90e[_0x546e('0x2a')]);if(_0x2ff90e[_0x546e('0x2b')]){delete _0x2ff90e['name'];}_0x1bd900[_0x546e('0x1b')](_0x1dba59)[_0x546e('0x2c')](_0x2ff90e);};}exports['index']=function(_0x278cab,_0x2df1c3){var _0x8deb0={},_0x529f51={},_0x54fd46={'count':0x0,'rows':[]};var _0x18fa04=_['map'](db['Dynamics365Configuration'][_0x546e('0x2d')],function(_0x13fd32){return{'name':_0x13fd32[_0x546e('0x2e')],'type':_0x13fd32[_0x546e('0x2f')]['key']};});_0x529f51['model']=_[_0x546e('0x30')](_0x18fa04,'name');_0x529f51[_0x546e('0x31')]=_[_0x546e('0x32')](_0x278cab[_0x546e('0x31')]);_0x529f51['filters']=_[_0x546e('0x33')](_0x529f51[_0x546e('0x34')],_0x529f51['query']);_0x8deb0[_0x546e('0x35')]=_[_0x546e('0x33')](_0x529f51[_0x546e('0x34')],qs['fields'](_0x278cab[_0x546e('0x31')]['fields']));_0x8deb0[_0x546e('0x35')]=_0x8deb0[_0x546e('0x35')]['length']?_0x8deb0['attributes']:_0x529f51['model'];if(!_0x278cab['query'][_0x546e('0x36')]('nolimit')){_0x8deb0[_0x546e('0x1d')]=qs[_0x546e('0x1d')](_0x278cab[_0x546e('0x31')][_0x546e('0x1d')]);_0x8deb0[_0x546e('0x1f')]=qs[_0x546e('0x1f')](_0x278cab[_0x546e('0x31')][_0x546e('0x1f')]);}_0x8deb0[_0x546e('0x37')]=qs[_0x546e('0x38')](_0x278cab['query'][_0x546e('0x38')]);_0x8deb0['where']=qs[_0x546e('0x39')](_[_0x546e('0x3a')](_0x278cab[_0x546e('0x31')],_0x529f51[_0x546e('0x39')]),_0x18fa04);if(_0x278cab['query']['filter']){_0x8deb0[_0x546e('0x3b')]=_[_0x546e('0x3c')](_0x8deb0[_0x546e('0x3b')],{'$or':_[_0x546e('0x30')](_0x18fa04,function(_0x344a47){if(_0x344a47[_0x546e('0x2f')]!==_0x546e('0x3d')){var _0x58dea1={};_0x58dea1[_0x344a47[_0x546e('0x2b')]]={'$like':'%'+_0x278cab[_0x546e('0x31')]['filter']+'%'};return _0x58dea1;}})});}_0x8deb0=_[_0x546e('0x3c')]({},_0x8deb0,_0x278cab[_0x546e('0x3e')]);var _0x230bd3={'where':_0x8deb0['where']};return db[_0x546e('0x3f')][_0x546e('0x1e')](_0x230bd3)[_0x546e('0x27')](function(_0x408285){_0x54fd46[_0x546e('0x1e')]=_0x408285;if(_0x278cab[_0x546e('0x31')][_0x546e('0x40')]){_0x8deb0[_0x546e('0x41')]=[{'all':!![]}];}return db[_0x546e('0x3f')][_0x546e('0x42')](_0x8deb0);})[_0x546e('0x27')](function(_0x399798){_0x54fd46[_0x546e('0x43')]=_0x399798;return _0x54fd46;})['then'](respondWithFilteredResult(_0x2df1c3,_0x8deb0))[_0x546e('0x44')](handleError(_0x2df1c3,null));};exports[_0x546e('0x45')]=function(_0x5c7179,_0xeb25ee){var _0x326f9d={'raw':![],'where':{'id':_0x5c7179[_0x546e('0x46')]['id']}},_0x59fa00={};_0x59fa00[_0x546e('0x34')]=_[_0x546e('0x32')](db[_0x546e('0x3f')]['rawAttributes']);_0x59fa00[_0x546e('0x31')]=_[_0x546e('0x32')](_0x5c7179['query']);_0x59fa00[_0x546e('0x39')]=_[_0x546e('0x33')](_0x59fa00[_0x546e('0x34')],_0x59fa00['query']);_0x326f9d['attributes']=_['intersection'](_0x59fa00['model'],qs[_0x546e('0x47')](_0x5c7179[_0x546e('0x31')]['fields']));_0x326f9d[_0x546e('0x35')]=_0x326f9d[_0x546e('0x35')][_0x546e('0x48')]?_0x326f9d[_0x546e('0x35')]:_0x59fa00[_0x546e('0x34')];if(_0x5c7179[_0x546e('0x31')][_0x546e('0x40')]){_0x326f9d[_0x546e('0x41')]=[{'all':!![]}];}_0x326f9d=_[_0x546e('0x3c')]({},_0x326f9d,_0x5c7179[_0x546e('0x3e')]);return db[_0x546e('0x3f')][_0x546e('0x49')](_0x326f9d)['then'](handleEntityNotFound(_0xeb25ee,null))['then'](respondWithResult(_0xeb25ee,null))[_0x546e('0x44')](handleError(_0xeb25ee,null));};exports[_0x546e('0x4a')]=function(_0x40b544,_0x2d567c){return db[_0x546e('0x3f')][_0x546e('0x4a')](_0x40b544[_0x546e('0x4b')],{})['then'](respondWithResult(_0x2d567c,0xc9))['catch'](handleError(_0x2d567c,null));};exports[_0x546e('0x26')]=function(_0x496411,_0xb655ed){if(_0x496411[_0x546e('0x4b')]['id']){delete _0x496411['body']['id'];}return db[_0x546e('0x3f')][_0x546e('0x49')]({'where':{'id':_0x496411['params']['id']}})['then'](handleEntityNotFound(_0xb655ed,null))[_0x546e('0x27')](saveUpdates(_0x496411[_0x546e('0x4b')],null))[_0x546e('0x27')](respondWithResult(_0xb655ed,null))['catch'](handleError(_0xb655ed,null));};exports[_0x546e('0x28')]=function(_0x5c0f48,_0xf663b0){return db[_0x546e('0x3f')]['find']({'where':{'id':_0x5c0f48[_0x546e('0x46')]['id']}})[_0x546e('0x27')](handleEntityNotFound(_0xf663b0,null))[_0x546e('0x27')](removeEntity(_0xf663b0,null))[_0x546e('0x44')](handleError(_0xf663b0,null));};exports['getFields']=function(_0x1279d3,_0x509cc9,_0x44bb94){var _0x5c3ac2={};var _0x578693={};var _0x49c271;var _0x182179;return db[_0x546e('0x3f')][_0x546e('0x4c')]({'where':{'id':_0x1279d3[_0x546e('0x46')]['id']}})[_0x546e('0x27')](handleEntityNotFound(_0x509cc9,null))[_0x546e('0x27')](function(_0x1ca575){if(_0x1ca575){_0x49c271=_0x1ca575;_0x578693['model']=_[_0x546e('0x32')](db[_0x546e('0x4d')][_0x546e('0x2d')]);_0x578693[_0x546e('0x31')]=_['keys'](_0x1279d3[_0x546e('0x31')]);_0x578693['filters']=_['intersection'](_0x578693[_0x546e('0x34')],_0x578693[_0x546e('0x31')]);_0x5c3ac2[_0x546e('0x35')]=_[_0x546e('0x33')](_0x578693['model'],qs[_0x546e('0x47')](_0x1279d3[_0x546e('0x31')][_0x546e('0x47')]));_0x5c3ac2[_0x546e('0x35')]=_0x5c3ac2[_0x546e('0x35')][_0x546e('0x48')]?_0x5c3ac2['attributes']:_0x578693[_0x546e('0x34')];_0x5c3ac2['order']=qs[_0x546e('0x38')](_0x1279d3[_0x546e('0x31')]['sort']);_0x5c3ac2[_0x546e('0x3b')]=qs['filters'](_['pick'](_0x1279d3[_0x546e('0x31')],_0x578693[_0x546e('0x39')]));if(_0x1279d3[_0x546e('0x31')][_0x546e('0x4e')]){_0x5c3ac2['where']=_[_0x546e('0x3c')](_0x5c3ac2[_0x546e('0x3b')],{'$or':_[_0x546e('0x30')](_0x5c3ac2['attributes'],function(_0xd17d93){var _0x3eaf14={};_0x3eaf14[_0xd17d93]={'$like':'%'+_0x1279d3['query'][_0x546e('0x4e')]+'%'};return _0x3eaf14;})});}_0x5c3ac2=_[_0x546e('0x3c')]({},_0x5c3ac2,_0x1279d3[_0x546e('0x3e')]);return _0x49c271['getFields'](_0x5c3ac2);}})[_0x546e('0x27')](function(_0x9d1613){if(_0x9d1613){_0x182179=_0x9d1613['length'];if(!_0x1279d3[_0x546e('0x31')]['hasOwnProperty'](_0x546e('0x4f'))){_0x5c3ac2[_0x546e('0x1d')]=qs['limit'](_0x1279d3['query'][_0x546e('0x1d')]);_0x5c3ac2[_0x546e('0x1f')]=qs[_0x546e('0x1f')](_0x1279d3[_0x546e('0x31')][_0x546e('0x1f')]);}return _0x49c271['getFields'](_0x5c3ac2);}})[_0x546e('0x27')](function(_0x150ace){if(_0x150ace){return _0x150ace?{'count':_0x182179,'rows':_0x150ace}:null;}})[_0x546e('0x27')](respondWithResult(_0x509cc9,null))[_0x546e('0x44')](handleError(_0x509cc9,null));};exports['getSubjects']=function(_0x12655a,_0x2c7204,_0x5c6277){var _0x3dbe7d={};var _0x102009={};var _0x14bdc9;var _0x189770;return db[_0x546e('0x3f')][_0x546e('0x4c')]({'where':{'id':_0x12655a[_0x546e('0x46')]['id']}})[_0x546e('0x27')](handleEntityNotFound(_0x2c7204,null))[_0x546e('0x27')](function(_0x244ee5){if(_0x244ee5){_0x14bdc9=_0x244ee5;_0x102009[_0x546e('0x34')]=_[_0x546e('0x32')](db[_0x546e('0x4d')]['rawAttributes']);_0x102009[_0x546e('0x31')]=_[_0x546e('0x32')](_0x12655a[_0x546e('0x31')]);_0x102009['filters']=_['intersection'](_0x102009[_0x546e('0x34')],_0x102009[_0x546e('0x31')]);_0x3dbe7d['attributes']=_['intersection'](_0x102009[_0x546e('0x34')],qs[_0x546e('0x47')](_0x12655a[_0x546e('0x31')]['fields']));_0x3dbe7d[_0x546e('0x35')]=_0x3dbe7d['attributes'][_0x546e('0x48')]?_0x3dbe7d[_0x546e('0x35')]:_0x102009['model'];_0x3dbe7d['order']=qs[_0x546e('0x38')](_0x12655a[_0x546e('0x31')][_0x546e('0x38')]);_0x3dbe7d[_0x546e('0x3b')]=qs[_0x546e('0x39')](_['pick'](_0x12655a[_0x546e('0x31')],_0x102009[_0x546e('0x39')]));if(_0x12655a[_0x546e('0x31')][_0x546e('0x4e')]){_0x3dbe7d['where']=_[_0x546e('0x3c')](_0x3dbe7d['where'],{'$or':_[_0x546e('0x30')](_0x3dbe7d[_0x546e('0x35')],function(_0x407293){var _0x578904={};_0x578904[_0x407293]={'$like':'%'+_0x12655a['query']['filter']+'%'};return _0x578904;})});}_0x3dbe7d=_['merge']({},_0x3dbe7d,_0x12655a['options']);return _0x14bdc9[_0x546e('0x50')](_0x3dbe7d);}})[_0x546e('0x27')](function(_0x53de06){if(_0x53de06){_0x189770=_0x53de06['length'];if(!_0x12655a[_0x546e('0x31')][_0x546e('0x36')](_0x546e('0x4f'))){_0x3dbe7d['limit']=qs[_0x546e('0x1d')](_0x12655a[_0x546e('0x31')][_0x546e('0x1d')]);_0x3dbe7d[_0x546e('0x1f')]=qs['offset'](_0x12655a[_0x546e('0x31')]['offset']);}return _0x14bdc9[_0x546e('0x50')](_0x3dbe7d);}})[_0x546e('0x27')](function(_0x466d60){if(_0x466d60){return _0x466d60?{'count':_0x189770,'rows':_0x466d60}:null;}})['then'](respondWithResult(_0x2c7204,null))['catch'](handleError(_0x2c7204,null));};exports['getDescriptions']=function(_0x3f5ae5,_0x75d646,_0xeef613){var _0x514bff={};var _0x29798a={};var _0x4af0ae;var _0x59e10c;return db[_0x546e('0x3f')][_0x546e('0x4c')]({'where':{'id':_0x3f5ae5[_0x546e('0x46')]['id']}})[_0x546e('0x27')](handleEntityNotFound(_0x75d646,null))[_0x546e('0x27')](function(_0x801f2a){if(_0x801f2a){_0x4af0ae=_0x801f2a;_0x29798a[_0x546e('0x34')]=_[_0x546e('0x32')](db[_0x546e('0x4d')][_0x546e('0x2d')]);_0x29798a['query']=_[_0x546e('0x32')](_0x3f5ae5[_0x546e('0x31')]);_0x29798a['filters']=_[_0x546e('0x33')](_0x29798a['model'],_0x29798a[_0x546e('0x31')]);_0x514bff[_0x546e('0x35')]=_['intersection'](_0x29798a[_0x546e('0x34')],qs['fields'](_0x3f5ae5[_0x546e('0x31')][_0x546e('0x47')]));_0x514bff['attributes']=_0x514bff[_0x546e('0x35')][_0x546e('0x48')]?_0x514bff[_0x546e('0x35')]:_0x29798a[_0x546e('0x34')];_0x514bff[_0x546e('0x37')]=qs['sort'](_0x3f5ae5[_0x546e('0x31')][_0x546e('0x38')]);_0x514bff['where']=qs[_0x546e('0x39')](_[_0x546e('0x3a')](_0x3f5ae5[_0x546e('0x31')],_0x29798a['filters']));if(_0x3f5ae5[_0x546e('0x31')]['filter']){_0x514bff[_0x546e('0x3b')]=_[_0x546e('0x3c')](_0x514bff[_0x546e('0x3b')],{'$or':_[_0x546e('0x30')](_0x514bff[_0x546e('0x35')],function(_0x27d4d5){var _0x1dd6be={};_0x1dd6be[_0x27d4d5]={'$like':'%'+_0x3f5ae5[_0x546e('0x31')]['filter']+'%'};return _0x1dd6be;})});}_0x514bff=_[_0x546e('0x3c')]({},_0x514bff,_0x3f5ae5[_0x546e('0x3e')]);return _0x4af0ae['getDescriptions'](_0x514bff);}})['then'](function(_0x3ae302){if(_0x3ae302){_0x59e10c=_0x3ae302[_0x546e('0x48')];if(!_0x3f5ae5['query'][_0x546e('0x36')](_0x546e('0x4f'))){_0x514bff['limit']=qs[_0x546e('0x1d')](_0x3f5ae5[_0x546e('0x31')][_0x546e('0x1d')]);_0x514bff[_0x546e('0x1f')]=qs[_0x546e('0x1f')](_0x3f5ae5[_0x546e('0x31')][_0x546e('0x1f')]);}return _0x4af0ae[_0x546e('0x51')](_0x514bff);}})['then'](function(_0x5632a5){if(_0x5632a5){return _0x5632a5?{'count':_0x59e10c,'rows':_0x5632a5}:null;}})[_0x546e('0x27')](respondWithResult(_0x75d646,null))[_0x546e('0x44')](handleError(_0x75d646,null));}; \ No newline at end of file +var _0x8462=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','limit','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','Dynamics365Configuration','findAll','rows','fields','find','create','body','catch','params','getFields','findOne','order','nolimit','getSubjects','Dynamics365Field','options','getDescriptions','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x57b239,_0x582f29){var _0x5a22b9=function(_0x12a820){while(--_0x12a820){_0x57b239['push'](_0x57b239['shift']());}};_0x5a22b9(++_0x582f29);}(_0x8462,0x16c));var _0x2846=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x8462[_0x11a55c];return _0x26c390;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2846('0x0'));var rp=require(_0x2846('0x1'));var moment=require(_0x2846('0x2'));var BPromise=require(_0x2846('0x3'));var Mustache=require('mustache');var util=require(_0x2846('0x4'));var path=require(_0x2846('0x5'));var sox=require(_0x2846('0x6'));var csv=require(_0x2846('0x7'));var ejs=require(_0x2846('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2846('0x9'));var squel=require('squel');var crypto=require(_0x2846('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2846('0xb'));var toCsv=require(_0x2846('0x7'));var querystring=require(_0x2846('0xc'));var Papa=require(_0x2846('0xd'));var Redis=require(_0x2846('0xe'));var authService=require(_0x2846('0xf'));var qs=require(_0x2846('0x10'));var as=require(_0x2846('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2846('0x12'));var utils=require(_0x2846('0x13'));var config=require(_0x2846('0x14'));var licenseUtil=require(_0x2846('0x15'));var db=require(_0x2846('0x16'))['db'];function respondWithStatusCode(_0x4c5463,_0x252727){_0x252727=_0x252727||0xcc;return function(_0x270895){if(_0x270895){return _0x4c5463[_0x2846('0x17')](_0x252727);}return _0x4c5463[_0x2846('0x18')](_0x252727)['end']();};}function respondWithResult(_0x47a587,_0x225b70){_0x225b70=_0x225b70||0xc8;return function(_0x3c7877){if(_0x3c7877){return _0x47a587['status'](_0x225b70)['json'](_0x3c7877);}};}function respondWithFilteredResult(_0x4ce98e,_0x55877f){return function(_0x1d3876){if(_0x1d3876){var _0x36d02d=typeof _0x55877f[_0x2846('0x19')]===_0x2846('0x1a')&&typeof _0x55877f['limit']===_0x2846('0x1a');var _0x262b2d=_0x1d3876[_0x2846('0x1b')];var _0x5449e1=_0x36d02d?0x0:_0x55877f[_0x2846('0x19')];var _0x10012d=_0x36d02d?_0x1d3876[_0x2846('0x1b')]:_0x55877f['offset']+_0x55877f['limit'];var _0x56f926;if(_0x10012d>=_0x262b2d){_0x10012d=_0x262b2d;_0x56f926=0xc8;}else{_0x56f926=0xce;}_0x4ce98e[_0x2846('0x18')](_0x56f926);return _0x4ce98e[_0x2846('0x1c')](_0x2846('0x1d'),_0x5449e1+'-'+_0x10012d+'/'+_0x262b2d)['json'](_0x1d3876);}return null;};}function patchUpdates(_0x4e0353){return function(_0x1de40a){try{jsonpatch[_0x2846('0x1e')](_0x1de40a,_0x4e0353,!![]);}catch(_0x741b7b){return BPromise[_0x2846('0x1f')](_0x741b7b);}return _0x1de40a['save']();};}function saveUpdates(_0x3e6597,_0x5307df){return function(_0x34cb89){if(_0x34cb89){return _0x34cb89[_0x2846('0x20')](_0x3e6597)[_0x2846('0x21')](function(_0x244c7d){return _0x244c7d;});}return null;};}function removeEntity(_0x159444,_0x2fab13){return function(_0x1e73e2){if(_0x1e73e2){return _0x1e73e2[_0x2846('0x22')]()[_0x2846('0x21')](function(){_0x159444[_0x2846('0x18')](0xcc)[_0x2846('0x23')]();});}};}function handleEntityNotFound(_0x32559f,_0x7a633){return function(_0x33b2a5){if(!_0x33b2a5){_0x32559f[_0x2846('0x17')](0x194);}return _0x33b2a5;};}function handleError(_0x1dae2e,_0x11438b){_0x11438b=_0x11438b||0x1f4;return function(_0x3da9a0){logger[_0x2846('0x24')](_0x3da9a0[_0x2846('0x25')]);if(_0x3da9a0[_0x2846('0x26')]){delete _0x3da9a0[_0x2846('0x26')];}_0x1dae2e[_0x2846('0x18')](_0x11438b)[_0x2846('0x27')](_0x3da9a0);};}exports['index']=function(_0x3cd6fe,_0x1d9d2b){var _0x3086c={},_0x171290={},_0x494e4f={'count':0x0,'rows':[]};var _0x5eb46f=_['map'](db['Dynamics365Configuration'][_0x2846('0x28')],function(_0x3c1c0a){return{'name':_0x3c1c0a['fieldName'],'type':_0x3c1c0a[_0x2846('0x29')]['key']};});_0x171290['model']=_[_0x2846('0x2a')](_0x5eb46f,_0x2846('0x26'));_0x171290[_0x2846('0x2b')]=_[_0x2846('0x2c')](_0x3cd6fe[_0x2846('0x2b')]);_0x171290[_0x2846('0x2d')]=_[_0x2846('0x2e')](_0x171290[_0x2846('0x2f')],_0x171290[_0x2846('0x2b')]);_0x3086c[_0x2846('0x30')]=_['intersection'](_0x171290[_0x2846('0x2f')],qs['fields'](_0x3cd6fe['query']['fields']));_0x3086c[_0x2846('0x30')]=_0x3086c[_0x2846('0x30')][_0x2846('0x31')]?_0x3086c[_0x2846('0x30')]:_0x171290[_0x2846('0x2f')];if(!_0x3cd6fe['query'][_0x2846('0x32')]('nolimit')){_0x3086c[_0x2846('0x33')]=qs[_0x2846('0x33')](_0x3cd6fe[_0x2846('0x2b')][_0x2846('0x33')]);_0x3086c['offset']=qs[_0x2846('0x19')](_0x3cd6fe['query']['offset']);}_0x3086c['order']=qs[_0x2846('0x34')](_0x3cd6fe['query'][_0x2846('0x34')]);_0x3086c['where']=qs[_0x2846('0x2d')](_[_0x2846('0x35')](_0x3cd6fe[_0x2846('0x2b')],_0x171290['filters']),_0x5eb46f);if(_0x3cd6fe[_0x2846('0x2b')][_0x2846('0x36')]){_0x3086c['where']=_[_0x2846('0x37')](_0x3086c[_0x2846('0x38')],{'$or':_[_0x2846('0x2a')](_0x5eb46f,function(_0x39fffe){if(_0x39fffe[_0x2846('0x29')]!==_0x2846('0x39')){var _0x25230b={};_0x25230b[_0x39fffe[_0x2846('0x26')]]={'$like':'%'+_0x3cd6fe[_0x2846('0x2b')][_0x2846('0x36')]+'%'};return _0x25230b;}})});}_0x3086c=_[_0x2846('0x37')]({},_0x3086c,_0x3cd6fe['options']);var _0x12dbd6={'where':_0x3086c['where']};return db['Dynamics365Configuration']['count'](_0x12dbd6)['then'](function(_0x553602){_0x494e4f[_0x2846('0x1b')]=_0x553602;if(_0x3cd6fe[_0x2846('0x2b')][_0x2846('0x3a')]){_0x3086c[_0x2846('0x3b')]=[{'all':!![]}];}return db[_0x2846('0x3c')][_0x2846('0x3d')](_0x3086c);})[_0x2846('0x21')](function(_0x621701){_0x494e4f[_0x2846('0x3e')]=_0x621701;return _0x494e4f;})[_0x2846('0x21')](respondWithFilteredResult(_0x1d9d2b,_0x3086c))['catch'](handleError(_0x1d9d2b,null));};exports['show']=function(_0x4e846e,_0x549ef7){var _0x3e61fa={'raw':![],'where':{'id':_0x4e846e['params']['id']}},_0x2f21c1={};_0x2f21c1[_0x2846('0x2f')]=_[_0x2846('0x2c')](db[_0x2846('0x3c')][_0x2846('0x28')]);_0x2f21c1[_0x2846('0x2b')]=_[_0x2846('0x2c')](_0x4e846e[_0x2846('0x2b')]);_0x2f21c1['filters']=_[_0x2846('0x2e')](_0x2f21c1[_0x2846('0x2f')],_0x2f21c1['query']);_0x3e61fa[_0x2846('0x30')]=_[_0x2846('0x2e')](_0x2f21c1[_0x2846('0x2f')],qs[_0x2846('0x3f')](_0x4e846e[_0x2846('0x2b')][_0x2846('0x3f')]));_0x3e61fa[_0x2846('0x30')]=_0x3e61fa[_0x2846('0x30')][_0x2846('0x31')]?_0x3e61fa[_0x2846('0x30')]:_0x2f21c1[_0x2846('0x2f')];if(_0x4e846e[_0x2846('0x2b')][_0x2846('0x3a')]){_0x3e61fa[_0x2846('0x3b')]=[{'all':!![]}];}_0x3e61fa=_[_0x2846('0x37')]({},_0x3e61fa,_0x4e846e['options']);return db[_0x2846('0x3c')][_0x2846('0x40')](_0x3e61fa)['then'](handleEntityNotFound(_0x549ef7,null))[_0x2846('0x21')](respondWithResult(_0x549ef7,null))['catch'](handleError(_0x549ef7,null));};exports[_0x2846('0x41')]=function(_0x2c2e9e,_0x50662c){return db[_0x2846('0x3c')]['create'](_0x2c2e9e[_0x2846('0x42')],{})[_0x2846('0x21')](respondWithResult(_0x50662c,0xc9))[_0x2846('0x43')](handleError(_0x50662c,null));};exports[_0x2846('0x20')]=function(_0xe471ff,_0x313801){if(_0xe471ff[_0x2846('0x42')]['id']){delete _0xe471ff[_0x2846('0x42')]['id'];}return db['Dynamics365Configuration'][_0x2846('0x40')]({'where':{'id':_0xe471ff[_0x2846('0x44')]['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x313801,null))[_0x2846('0x21')](saveUpdates(_0xe471ff[_0x2846('0x42')],null))[_0x2846('0x21')](respondWithResult(_0x313801,null))[_0x2846('0x43')](handleError(_0x313801,null));};exports[_0x2846('0x22')]=function(_0x271cb8,_0x3cf773){return db[_0x2846('0x3c')][_0x2846('0x40')]({'where':{'id':_0x271cb8['params']['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x3cf773,null))['then'](removeEntity(_0x3cf773,null))['catch'](handleError(_0x3cf773,null));};exports[_0x2846('0x45')]=function(_0x37422b,_0x3243ac,_0x5bff5d){var _0x503cf3={};var _0x194cb4={};var _0x1cb998;var _0x25f088;return db[_0x2846('0x3c')][_0x2846('0x46')]({'where':{'id':_0x37422b[_0x2846('0x44')]['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x3243ac,null))[_0x2846('0x21')](function(_0x5c68de){if(_0x5c68de){_0x1cb998=_0x5c68de;_0x194cb4[_0x2846('0x2f')]=_[_0x2846('0x2c')](db['Dynamics365Field']['rawAttributes']);_0x194cb4['query']=_[_0x2846('0x2c')](_0x37422b['query']);_0x194cb4['filters']=_['intersection'](_0x194cb4[_0x2846('0x2f')],_0x194cb4[_0x2846('0x2b')]);_0x503cf3['attributes']=_[_0x2846('0x2e')](_0x194cb4[_0x2846('0x2f')],qs['fields'](_0x37422b['query'][_0x2846('0x3f')]));_0x503cf3[_0x2846('0x30')]=_0x503cf3[_0x2846('0x30')]['length']?_0x503cf3[_0x2846('0x30')]:_0x194cb4[_0x2846('0x2f')];_0x503cf3[_0x2846('0x47')]=qs['sort'](_0x37422b[_0x2846('0x2b')]['sort']);_0x503cf3[_0x2846('0x38')]=qs[_0x2846('0x2d')](_['pick'](_0x37422b[_0x2846('0x2b')],_0x194cb4[_0x2846('0x2d')]));if(_0x37422b[_0x2846('0x2b')]['filter']){_0x503cf3['where']=_[_0x2846('0x37')](_0x503cf3[_0x2846('0x38')],{'$or':_['map'](_0x503cf3['attributes'],function(_0x19e362){var _0x4e3e09={};_0x4e3e09[_0x19e362]={'$like':'%'+_0x37422b[_0x2846('0x2b')][_0x2846('0x36')]+'%'};return _0x4e3e09;})});}_0x503cf3=_[_0x2846('0x37')]({},_0x503cf3,_0x37422b['options']);return _0x1cb998['getFields'](_0x503cf3);}})[_0x2846('0x21')](function(_0x3db006){if(_0x3db006){_0x25f088=_0x3db006['length'];if(!_0x37422b[_0x2846('0x2b')]['hasOwnProperty'](_0x2846('0x48'))){_0x503cf3[_0x2846('0x33')]=qs[_0x2846('0x33')](_0x37422b[_0x2846('0x2b')][_0x2846('0x33')]);_0x503cf3[_0x2846('0x19')]=qs[_0x2846('0x19')](_0x37422b[_0x2846('0x2b')][_0x2846('0x19')]);}return _0x1cb998['getFields'](_0x503cf3);}})['then'](function(_0x1befe5){if(_0x1befe5){return _0x1befe5?{'count':_0x25f088,'rows':_0x1befe5}:null;}})['then'](respondWithResult(_0x3243ac,null))[_0x2846('0x43')](handleError(_0x3243ac,null));};exports[_0x2846('0x49')]=function(_0xf06437,_0x486d8c,_0x5275bf){var _0x3aadd4={};var _0x46fc17={};var _0x3b1b00;var _0x367562;return db[_0x2846('0x3c')]['findOne']({'where':{'id':_0xf06437[_0x2846('0x44')]['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x486d8c,null))[_0x2846('0x21')](function(_0xe78d21){if(_0xe78d21){_0x3b1b00=_0xe78d21;_0x46fc17[_0x2846('0x2f')]=_[_0x2846('0x2c')](db[_0x2846('0x4a')][_0x2846('0x28')]);_0x46fc17[_0x2846('0x2b')]=_[_0x2846('0x2c')](_0xf06437['query']);_0x46fc17['filters']=_[_0x2846('0x2e')](_0x46fc17[_0x2846('0x2f')],_0x46fc17['query']);_0x3aadd4[_0x2846('0x30')]=_[_0x2846('0x2e')](_0x46fc17[_0x2846('0x2f')],qs[_0x2846('0x3f')](_0xf06437['query'][_0x2846('0x3f')]));_0x3aadd4['attributes']=_0x3aadd4[_0x2846('0x30')][_0x2846('0x31')]?_0x3aadd4[_0x2846('0x30')]:_0x46fc17['model'];_0x3aadd4[_0x2846('0x47')]=qs[_0x2846('0x34')](_0xf06437[_0x2846('0x2b')][_0x2846('0x34')]);_0x3aadd4[_0x2846('0x38')]=qs[_0x2846('0x2d')](_['pick'](_0xf06437[_0x2846('0x2b')],_0x46fc17[_0x2846('0x2d')]));if(_0xf06437[_0x2846('0x2b')][_0x2846('0x36')]){_0x3aadd4[_0x2846('0x38')]=_[_0x2846('0x37')](_0x3aadd4[_0x2846('0x38')],{'$or':_[_0x2846('0x2a')](_0x3aadd4[_0x2846('0x30')],function(_0x5e1e3d){var _0x477719={};_0x477719[_0x5e1e3d]={'$like':'%'+_0xf06437[_0x2846('0x2b')][_0x2846('0x36')]+'%'};return _0x477719;})});}_0x3aadd4=_[_0x2846('0x37')]({},_0x3aadd4,_0xf06437[_0x2846('0x4b')]);return _0x3b1b00[_0x2846('0x49')](_0x3aadd4);}})[_0x2846('0x21')](function(_0x2330ab){if(_0x2330ab){_0x367562=_0x2330ab[_0x2846('0x31')];if(!_0xf06437[_0x2846('0x2b')][_0x2846('0x32')](_0x2846('0x48'))){_0x3aadd4[_0x2846('0x33')]=qs[_0x2846('0x33')](_0xf06437[_0x2846('0x2b')][_0x2846('0x33')]);_0x3aadd4[_0x2846('0x19')]=qs[_0x2846('0x19')](_0xf06437['query'][_0x2846('0x19')]);}return _0x3b1b00[_0x2846('0x49')](_0x3aadd4);}})[_0x2846('0x21')](function(_0x580eaf){if(_0x580eaf){return _0x580eaf?{'count':_0x367562,'rows':_0x580eaf}:null;}})[_0x2846('0x21')](respondWithResult(_0x486d8c,null))[_0x2846('0x43')](handleError(_0x486d8c,null));};exports['getDescriptions']=function(_0x41a98d,_0x4cb476,_0x11b0cf){var _0x5c7a7c={};var _0x245cd4={};var _0x3f6dbe;var _0x107add;return db[_0x2846('0x3c')]['findOne']({'where':{'id':_0x41a98d[_0x2846('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cb476,null))[_0x2846('0x21')](function(_0x555dfc){if(_0x555dfc){_0x3f6dbe=_0x555dfc;_0x245cd4['model']=_[_0x2846('0x2c')](db['Dynamics365Field']['rawAttributes']);_0x245cd4[_0x2846('0x2b')]=_[_0x2846('0x2c')](_0x41a98d[_0x2846('0x2b')]);_0x245cd4[_0x2846('0x2d')]=_[_0x2846('0x2e')](_0x245cd4['model'],_0x245cd4[_0x2846('0x2b')]);_0x5c7a7c['attributes']=_[_0x2846('0x2e')](_0x245cd4[_0x2846('0x2f')],qs[_0x2846('0x3f')](_0x41a98d['query']['fields']));_0x5c7a7c[_0x2846('0x30')]=_0x5c7a7c[_0x2846('0x30')][_0x2846('0x31')]?_0x5c7a7c[_0x2846('0x30')]:_0x245cd4[_0x2846('0x2f')];_0x5c7a7c[_0x2846('0x47')]=qs[_0x2846('0x34')](_0x41a98d[_0x2846('0x2b')][_0x2846('0x34')]);_0x5c7a7c[_0x2846('0x38')]=qs[_0x2846('0x2d')](_[_0x2846('0x35')](_0x41a98d[_0x2846('0x2b')],_0x245cd4[_0x2846('0x2d')]));if(_0x41a98d[_0x2846('0x2b')][_0x2846('0x36')]){_0x5c7a7c[_0x2846('0x38')]=_['merge'](_0x5c7a7c[_0x2846('0x38')],{'$or':_[_0x2846('0x2a')](_0x5c7a7c[_0x2846('0x30')],function(_0x54fa47){var _0x54ab37={};_0x54ab37[_0x54fa47]={'$like':'%'+_0x41a98d[_0x2846('0x2b')][_0x2846('0x36')]+'%'};return _0x54ab37;})});}_0x5c7a7c=_[_0x2846('0x37')]({},_0x5c7a7c,_0x41a98d[_0x2846('0x4b')]);return _0x3f6dbe[_0x2846('0x4c')](_0x5c7a7c);}})[_0x2846('0x21')](function(_0x392f49){if(_0x392f49){_0x107add=_0x392f49[_0x2846('0x31')];if(!_0x41a98d['query']['hasOwnProperty'](_0x2846('0x48'))){_0x5c7a7c[_0x2846('0x33')]=qs[_0x2846('0x33')](_0x41a98d[_0x2846('0x2b')]['limit']);_0x5c7a7c[_0x2846('0x19')]=qs[_0x2846('0x19')](_0x41a98d[_0x2846('0x2b')][_0x2846('0x19')]);}return _0x3f6dbe[_0x2846('0x4c')](_0x5c7a7c);}})[_0x2846('0x21')](function(_0x72e58b){if(_0x72e58b){return _0x72e58b?{'count':_0x107add,'rows':_0x72e58b}:null;}})[_0x2846('0x21')](respondWithResult(_0x4cb476,null))[_0x2846('0x43')](handleError(_0x4cb476,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index d345f7e..1a9fde0 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x56d18c,_0x4e89aa){var _0x401257=function(_0x7fbc21){while(--_0x7fbc21){_0x56d18c['push'](_0x56d18c['shift']());}};_0x401257(++_0x4e89aa);}(_0x9bde,0xe1));var _0xe9bd=function(_0xde3bcd,_0x28f9da){_0xde3bcd=_0xde3bcd-0x0;var _0x50d9c3=_0x9bde[_0xde3bcd];return _0x50d9c3;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52e05d,_0x45f151){var _0x579d10=function(_0x5b8ba3){while(--_0x5b8ba3){_0x52e05d['push'](_0x52e05d['shift']());}};_0x579d10(++_0x45f151);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xb4e6[_0x237f8b];return _0x423f94;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 74245f2..07b75ea 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 _0x69e1=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b3f3e,_0x47dfcc){var _0x921fc3=function(_0x3e4b3b){while(--_0x3e4b3b){_0x4b3f3e['push'](_0x4b3f3e['shift']());}};_0x921fc3(++_0x47dfcc);}(_0x69e1,0x1f3));var _0x169e=function(_0x510124,_0x31987){_0x510124=_0x510124-0x0;var _0x480f86=_0x69e1[_0x510124];return _0x480f86;};'use strict';var _=require(_0x169e('0x0'));var util=require(_0x169e('0x1'));var moment=require(_0x169e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x169e('0x3'));var db=require(_0x169e('0x4'))['db'];var utils=require(_0x169e('0x5'));var logger=require(_0x169e('0x6'))(_0x169e('0x7'));var config=require(_0x169e('0x8'));var jayson=require(_0x169e('0x9'));var client=jayson[_0x169e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e4150,_0x53c1dc,_0x39379a){return new BPromise(function(_0x57ba4f,_0xb9b062){return client[_0x169e('0xb')](_0x1e4150,_0x39379a)[_0x169e('0xc')](function(_0x1c1e16){logger[_0x169e('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x53c1dc,_0x169e('0xe'));logger[_0x169e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x53c1dc,_0x169e('0xe'),JSON[_0x169e('0x10')](_0x1c1e16));if(_0x1c1e16['error']){if(_0x1c1e16[_0x169e('0x11')][_0x169e('0x12')]===0x1f4){logger[_0x169e('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x53c1dc,_0x1c1e16[_0x169e('0x11')][_0x169e('0x13')]);return _0xb9b062(_0x1c1e16['error'][_0x169e('0x13')]);}logger[_0x169e('0x11')](_0x169e('0x14'),_0x53c1dc,_0x1c1e16[_0x169e('0x11')][_0x169e('0x13')]);return _0x57ba4f(_0x1c1e16[_0x169e('0x11')][_0x169e('0x13')]);}else{logger[_0x169e('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x53c1dc,_0x169e('0xe'));_0x57ba4f(_0x1c1e16[_0x169e('0x15')]['message']);}})['catch'](function(_0x385c9b){logger[_0x169e('0x11')](_0x169e('0x14'),_0x53c1dc,_0x385c9b);_0xb9b062(_0x385c9b);});});} \ No newline at end of file +var _0xfdd0=['http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0xfdd0,0x1ae));var _0x0fdd=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xfdd0[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x0fdd('0x0'));var util=require(_0x0fdd('0x1'));var moment=require('moment');var BPromise=require(_0x0fdd('0x2'));var rs=require(_0x0fdd('0x3'));var fs=require('fs');var Redis=require(_0x0fdd('0x4'));var db=require(_0x0fdd('0x5'))['db'];var utils=require(_0x0fdd('0x6'));var logger=require(_0x0fdd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0fdd('0x8'));var client=jayson[_0x0fdd('0x9')][_0x0fdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17550e,_0x240edd,_0xd5170c){return new BPromise(function(_0x2bdf86,_0x34e96a){return client[_0x0fdd('0xb')](_0x17550e,_0xd5170c)[_0x0fdd('0xc')](function(_0x552ee5){logger[_0x0fdd('0xd')](_0x0fdd('0xe'),_0x240edd,_0x0fdd('0xf'));logger[_0x0fdd('0x10')](_0x0fdd('0x11'),_0x240edd,_0x0fdd('0xf'),JSON[_0x0fdd('0x12')](_0x552ee5));if(_0x552ee5[_0x0fdd('0x13')]){if(_0x552ee5[_0x0fdd('0x13')]['code']===0x1f4){logger[_0x0fdd('0x13')](_0x0fdd('0xe'),_0x240edd,_0x552ee5['error'][_0x0fdd('0x14')]);return _0x34e96a(_0x552ee5[_0x0fdd('0x13')][_0x0fdd('0x14')]);}logger[_0x0fdd('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x240edd,_0x552ee5[_0x0fdd('0x13')][_0x0fdd('0x14')]);return _0x2bdf86(_0x552ee5['error'][_0x0fdd('0x14')]);}else{logger[_0x0fdd('0xd')](_0x0fdd('0xe'),_0x240edd,_0x0fdd('0xf'));_0x2bdf86(_0x552ee5[_0x0fdd('0x15')]['message']);}})['catch'](function(_0x194edc){logger['error'](_0x0fdd('0xe'),_0x240edd,_0x194edc);_0x34e96a(_0x194edc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 354734b..950e2d8 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 _0x3804=['/:id','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3804,0x15c));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4380('0x0'));var util=require(_0x4380('0x1'));var path=require(_0x4380('0x2'));var timeout=require(_0x4380('0x3'));var express=require(_0x4380('0x4'));var router=express['Router']();var fs_extra=require(_0x4380('0x5'));var auth=require(_0x4380('0x6'));var interaction=require(_0x4380('0x7'));var config=require(_0x4380('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x4380('0x9')]('/',auth[_0x4380('0xa')](),controller[_0x4380('0xb')]);router[_0x4380('0x9')](_0x4380('0xc'),auth[_0x4380('0xa')](),controller['show']);router[_0x4380('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4380('0xc'),auth[_0x4380('0xa')](),controller[_0x4380('0xe')]);router[_0x4380('0xf')]('/:id',auth[_0x4380('0xa')](),controller[_0x4380('0x10')]);module[_0x4380('0x11')]=router; \ No newline at end of file +var _0xeb13=['./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xec302d,_0x4eb957){var _0x5d6ed1=function(_0x502505){while(--_0x502505){_0xec302d['push'](_0xec302d['shift']());}};_0x5d6ed1(++_0x4eb957);}(_0xeb13,0x13b));var _0x3eb1=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xeb13[_0xdd2bfa];return _0x55397e;};'use strict';var multer=require(_0x3eb1('0x0'));var util=require(_0x3eb1('0x1'));var path=require('path');var timeout=require(_0x3eb1('0x2'));var express=require(_0x3eb1('0x3'));var router=express['Router']();var fs_extra=require(_0x3eb1('0x4'));var auth=require(_0x3eb1('0x5'));var interaction=require(_0x3eb1('0x6'));var config=require(_0x3eb1('0x7'));var controller=require(_0x3eb1('0x8'));router[_0x3eb1('0x9')]('/',auth[_0x3eb1('0xa')](),controller['index']);router[_0x3eb1('0x9')](_0x3eb1('0xb'),auth[_0x3eb1('0xa')](),controller[_0x3eb1('0xc')]);router[_0x3eb1('0xd')]('/',auth['isAuthenticated'](),controller[_0x3eb1('0xe')]);router[_0x3eb1('0xf')](_0x3eb1('0xb'),auth[_0x3eb1('0xa')](),controller['update']);router[_0x3eb1('0x10')](_0x3eb1('0xb'),auth[_0x3eb1('0xa')](),controller[_0x3eb1('0x11')]);module[_0x3eb1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 041405f..b5724e7 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 _0x5d81=['ENUM','sequelize','string','customVariable','picklist','STRING'];(function(_0x4afafa,_0x3e2e25){var _0x4417f1=function(_0x438fb7){while(--_0x438fb7){_0x4afafa['push'](_0x4afafa['shift']());}};_0x4417f1(++_0x3e2e25);}(_0x5d81,0x1f3));var _0x15d8=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x5d81[_0x1a7846];return _0x48049;};'use strict';var Sequelize=require(_0x15d8('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x15d8('0x1'),'variable',_0x15d8('0x2'),'keyValue',_0x15d8('0x3')),'defaultValue':_0x15d8('0x1')},'content':{'type':Sequelize[_0x15d8('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x15d8('0x5')](_0x15d8('0x1'),'variable',_0x15d8('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x15d8('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15d8('0x4')]}}; \ No newline at end of file +var _0xfc9b=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xfc9b,0xe1));var _0xbfc9=function(_0x376019,_0x2c687e){_0x376019=_0x376019-0x0;var _0x3642f2=_0xfc9b[_0x376019];return _0x3642f2;};'use strict';var Sequelize=require(_0xbfc9('0x0'));module[_0xbfc9('0x1')]={'type':{'type':Sequelize[_0xbfc9('0x2')]('string',_0xbfc9('0x3'),_0xbfc9('0x4'),_0xbfc9('0x5'),_0xbfc9('0x6')),'defaultValue':_0xbfc9('0x7')},'content':{'type':Sequelize[_0xbfc9('0x8')]},'key':{'type':Sequelize[_0xbfc9('0x8')]},'keyType':{'type':Sequelize[_0xbfc9('0x2')](_0xbfc9('0x7'),'variable',_0xbfc9('0x4'))},'keyContent':{'type':Sequelize[_0xbfc9('0x8')]},'idField':{'type':Sequelize[_0xbfc9('0x8')]},'nameField':{'type':Sequelize[_0xbfc9('0x8')]},'customField':{'type':Sequelize[_0xbfc9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbfc9('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 9af8181..0fbbb2b 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 _0x83c3=['undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x1b496f,_0x1fab72){var _0x2081b9=function(_0x143a4e){while(--_0x143a4e){_0x1b496f['push'](_0x1b496f['shift']());}};_0x2081b9(++_0x1fab72);}(_0x83c3,0xc5));var _0x383c=function(_0x429f82,_0x211f75){_0x429f82=_0x429f82-0x0;var _0x4d82bb=_0x83c3[_0x429f82];return _0x4d82bb;};'use strict';var emlformat=require(_0x383c('0x0'));var rimraf=require(_0x383c('0x1'));var zipdir=require(_0x383c('0x2'));var jsonpatch=require(_0x383c('0x3'));var rp=require(_0x383c('0x4'));var moment=require(_0x383c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x383c('0x6'));var util=require('util');var path=require(_0x383c('0x7'));var sox=require(_0x383c('0x8'));var csv=require(_0x383c('0x9'));var ejs=require(_0x383c('0xa'));var fs=require('fs');var fs_extra=require(_0x383c('0xb'));var _=require(_0x383c('0xc'));var squel=require(_0x383c('0xd'));var crypto=require('crypto');var jsforce=require(_0x383c('0xe'));var deskjs=require(_0x383c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x383c('0x10'));var Papa=require(_0x383c('0x11'));var Redis=require('ioredis');var authService=require(_0x383c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x383c('0x13'));var hardwareService=require(_0x383c('0x14'));var logger=require(_0x383c('0x15'))(_0x383c('0x16'));var utils=require(_0x383c('0x17'));var config=require(_0x383c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x383c('0x19'))['db'];function respondWithStatusCode(_0xa2e035,_0x47cf0b){_0x47cf0b=_0x47cf0b||0xcc;return function(_0x26e28a){if(_0x26e28a){return _0xa2e035[_0x383c('0x1a')](_0x47cf0b);}return _0xa2e035['status'](_0x47cf0b)[_0x383c('0x1b')]();};}function respondWithResult(_0xc676e0,_0x5b5ccf){_0x5b5ccf=_0x5b5ccf||0xc8;return function(_0x10219f){if(_0x10219f){return _0xc676e0[_0x383c('0x1c')](_0x5b5ccf)[_0x383c('0x1d')](_0x10219f);}};}function respondWithFilteredResult(_0x539477,_0x18583a){return function(_0x4cdee4){if(_0x4cdee4){var _0x24d568=typeof _0x18583a[_0x383c('0x1e')]===_0x383c('0x1f')&&typeof _0x18583a[_0x383c('0x20')]===_0x383c('0x1f');var _0x4ddc53=_0x4cdee4[_0x383c('0x21')];var _0x153adc=_0x24d568?0x0:_0x18583a[_0x383c('0x1e')];var _0x12a74c=_0x24d568?_0x4cdee4[_0x383c('0x21')]:_0x18583a[_0x383c('0x1e')]+_0x18583a[_0x383c('0x20')];var _0x26ad1a;if(_0x12a74c>=_0x4ddc53){_0x12a74c=_0x4ddc53;_0x26ad1a=0xc8;}else{_0x26ad1a=0xce;}_0x539477[_0x383c('0x1c')](_0x26ad1a);return _0x539477[_0x383c('0x22')](_0x383c('0x23'),_0x153adc+'-'+_0x12a74c+'/'+_0x4ddc53)['json'](_0x4cdee4);}return null;};}function patchUpdates(_0x102e51){return function(_0x59094d){try{jsonpatch[_0x383c('0x24')](_0x59094d,_0x102e51,!![]);}catch(_0x506f99){return BPromise['reject'](_0x506f99);}return _0x59094d[_0x383c('0x25')]();};}function saveUpdates(_0x4e476b,_0x92c1c3){return function(_0x23bc0f){if(_0x23bc0f){return _0x23bc0f[_0x383c('0x26')](_0x4e476b)['then'](function(_0x292e1f){return _0x292e1f;});}return null;};}function removeEntity(_0x3ad839,_0x3fcc48){return function(_0x5878f9){if(_0x5878f9){return _0x5878f9[_0x383c('0x27')]()[_0x383c('0x28')](function(){_0x3ad839[_0x383c('0x1c')](0xcc)[_0x383c('0x1b')]();});}};}function handleEntityNotFound(_0x3e3243,_0x4228fc){return function(_0x4436ec){if(!_0x4436ec){_0x3e3243[_0x383c('0x1a')](0x194);}return _0x4436ec;};}function handleError(_0x321c36,_0x4f2128){_0x4f2128=_0x4f2128||0x1f4;return function(_0x4dd1a1){logger[_0x383c('0x29')](_0x4dd1a1[_0x383c('0x2a')]);if(_0x4dd1a1[_0x383c('0x2b')]){delete _0x4dd1a1[_0x383c('0x2b')];}_0x321c36['status'](_0x4f2128)[_0x383c('0x2c')](_0x4dd1a1);};}exports[_0x383c('0x2d')]=function(_0x7b2c58,_0x42b2c2){var _0x5607b4={},_0x2b8b13={},_0x1527a2={'count':0x0,'rows':[]};var _0x8028cd=_['map'](db[_0x383c('0x2e')][_0x383c('0x2f')],function(_0x4bff63){return{'name':_0x4bff63[_0x383c('0x30')],'type':_0x4bff63['type']['key']};});_0x2b8b13['model']=_[_0x383c('0x31')](_0x8028cd,_0x383c('0x2b'));_0x2b8b13[_0x383c('0x32')]=_[_0x383c('0x33')](_0x7b2c58['query']);_0x2b8b13[_0x383c('0x34')]=_[_0x383c('0x35')](_0x2b8b13[_0x383c('0x36')],_0x2b8b13[_0x383c('0x32')]);_0x5607b4[_0x383c('0x37')]=_['intersection'](_0x2b8b13[_0x383c('0x36')],qs[_0x383c('0x38')](_0x7b2c58[_0x383c('0x32')]['fields']));_0x5607b4[_0x383c('0x37')]=_0x5607b4[_0x383c('0x37')][_0x383c('0x39')]?_0x5607b4['attributes']:_0x2b8b13[_0x383c('0x36')];if(!_0x7b2c58[_0x383c('0x32')][_0x383c('0x3a')](_0x383c('0x3b'))){_0x5607b4['limit']=qs[_0x383c('0x20')](_0x7b2c58[_0x383c('0x32')][_0x383c('0x20')]);_0x5607b4[_0x383c('0x1e')]=qs[_0x383c('0x1e')](_0x7b2c58[_0x383c('0x32')][_0x383c('0x1e')]);}_0x5607b4['order']=qs['sort'](_0x7b2c58[_0x383c('0x32')][_0x383c('0x3c')]);_0x5607b4[_0x383c('0x3d')]=qs[_0x383c('0x34')](_[_0x383c('0x3e')](_0x7b2c58[_0x383c('0x32')],_0x2b8b13[_0x383c('0x34')]),_0x8028cd);if(_0x7b2c58[_0x383c('0x32')][_0x383c('0x3f')]){_0x5607b4[_0x383c('0x3d')]=_[_0x383c('0x40')](_0x5607b4[_0x383c('0x3d')],{'$or':_[_0x383c('0x31')](_0x8028cd,function(_0x131f31){if(_0x131f31['type']!=='VIRTUAL'){var _0x4f4f30={};_0x4f4f30[_0x131f31[_0x383c('0x2b')]]={'$like':'%'+_0x7b2c58['query'][_0x383c('0x3f')]+'%'};return _0x4f4f30;}})});}_0x5607b4=_[_0x383c('0x40')]({},_0x5607b4,_0x7b2c58[_0x383c('0x41')]);var _0x26d4d4={'where':_0x5607b4[_0x383c('0x3d')]};return db[_0x383c('0x2e')]['count'](_0x26d4d4)[_0x383c('0x28')](function(_0x268373){_0x1527a2[_0x383c('0x21')]=_0x268373;if(_0x7b2c58[_0x383c('0x32')]['includeAll']){_0x5607b4[_0x383c('0x42')]=[{'all':!![]}];}return db[_0x383c('0x2e')][_0x383c('0x43')](_0x5607b4);})[_0x383c('0x28')](function(_0x3bf030){_0x1527a2[_0x383c('0x44')]=_0x3bf030;return _0x1527a2;})[_0x383c('0x28')](respondWithFilteredResult(_0x42b2c2,_0x5607b4))[_0x383c('0x45')](handleError(_0x42b2c2,null));};exports[_0x383c('0x46')]=function(_0x18540b,_0x2d9289){var _0x54a453={'raw':!![],'where':{'id':_0x18540b[_0x383c('0x47')]['id']}},_0x4010c0={};_0x4010c0['model']=_['keys'](db[_0x383c('0x2e')][_0x383c('0x2f')]);_0x4010c0[_0x383c('0x32')]=_[_0x383c('0x33')](_0x18540b[_0x383c('0x32')]);_0x4010c0[_0x383c('0x34')]=_[_0x383c('0x35')](_0x4010c0[_0x383c('0x36')],_0x4010c0[_0x383c('0x32')]);_0x54a453['attributes']=_[_0x383c('0x35')](_0x4010c0[_0x383c('0x36')],qs[_0x383c('0x38')](_0x18540b['query']['fields']));_0x54a453[_0x383c('0x37')]=_0x54a453[_0x383c('0x37')]['length']?_0x54a453['attributes']:_0x4010c0[_0x383c('0x36')];if(_0x18540b[_0x383c('0x32')][_0x383c('0x48')]){_0x54a453['include']=[{'all':!![]}];}_0x54a453=_[_0x383c('0x40')]({},_0x54a453,_0x18540b[_0x383c('0x41')]);return db['Dynamics365Field'][_0x383c('0x49')](_0x54a453)['then'](handleEntityNotFound(_0x2d9289,null))[_0x383c('0x28')](respondWithResult(_0x2d9289,null))[_0x383c('0x45')](handleError(_0x2d9289,null));};exports[_0x383c('0x4a')]=function(_0x5439ae,_0x1970ef){return db[_0x383c('0x2e')][_0x383c('0x4a')](_0x5439ae['body'],{})['then'](respondWithResult(_0x1970ef,0xc9))[_0x383c('0x45')](handleError(_0x1970ef,null));};exports[_0x383c('0x26')]=function(_0x5bc798,_0x2bdb24){if(_0x5bc798[_0x383c('0x4b')]['id']){delete _0x5bc798[_0x383c('0x4b')]['id'];}return db[_0x383c('0x2e')]['find']({'where':{'id':_0x5bc798['params']['id']}})[_0x383c('0x28')](handleEntityNotFound(_0x2bdb24,null))[_0x383c('0x28')](saveUpdates(_0x5bc798['body'],null))[_0x383c('0x28')](respondWithResult(_0x2bdb24,null))[_0x383c('0x45')](handleError(_0x2bdb24,null));};exports['destroy']=function(_0x17679b,_0xd4b7fe){return db[_0x383c('0x2e')][_0x383c('0x49')]({'where':{'id':_0x17679b[_0x383c('0x47')]['id']}})[_0x383c('0x28')](handleEntityNotFound(_0xd4b7fe,null))[_0x383c('0x28')](removeEntity(_0xd4b7fe,null))[_0x383c('0x45')](handleError(_0xd4b7fe,null));}; \ No newline at end of file +var _0x96c9=['ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','Dynamics365Field','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','catch','show','params','rawAttributes','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4a2a9d,_0x2a0942){var _0xd5b621=function(_0x21e7b4){while(--_0x21e7b4){_0x4a2a9d['push'](_0x4a2a9d['shift']());}};_0xd5b621(++_0x2a0942);}(_0x96c9,0xc9));var _0x996c=function(_0x14365f,_0x36a6d7){_0x14365f=_0x14365f-0x0;var _0x2164bc=_0x96c9[_0x14365f];return _0x2164bc;};'use strict';var emlformat=require(_0x996c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x996c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x996c('0x2'));var moment=require(_0x996c('0x3'));var BPromise=require(_0x996c('0x4'));var Mustache=require(_0x996c('0x5'));var util=require(_0x996c('0x6'));var path=require(_0x996c('0x7'));var sox=require(_0x996c('0x8'));var csv=require('to-csv');var ejs=require(_0x996c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x996c('0xa'));var squel=require(_0x996c('0xb'));var crypto=require('crypto');var jsforce=require(_0x996c('0xc'));var deskjs=require(_0x996c('0xd'));var toCsv=require(_0x996c('0xe'));var querystring=require(_0x996c('0xf'));var Papa=require(_0x996c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x996c('0x11'));var hardwareService=require(_0x996c('0x12'));var logger=require('../../config/logger')(_0x996c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x996c('0x14'));var db=require(_0x996c('0x15'))['db'];function respondWithStatusCode(_0x35d2f2,_0x65f494){_0x65f494=_0x65f494||0xcc;return function(_0x2338df){if(_0x2338df){return _0x35d2f2[_0x996c('0x16')](_0x65f494);}return _0x35d2f2['status'](_0x65f494)['end']();};}function respondWithResult(_0x593821,_0x560a0f){_0x560a0f=_0x560a0f||0xc8;return function(_0x4c42db){if(_0x4c42db){return _0x593821['status'](_0x560a0f)[_0x996c('0x17')](_0x4c42db);}};}function respondWithFilteredResult(_0x2a2929,_0xfb621f){return function(_0x14d023){if(_0x14d023){var _0x2a425d=typeof _0xfb621f[_0x996c('0x18')]==='undefined'&&typeof _0xfb621f[_0x996c('0x19')]===_0x996c('0x1a');var _0x91fa1d=_0x14d023[_0x996c('0x1b')];var _0x30b52a=_0x2a425d?0x0:_0xfb621f[_0x996c('0x18')];var _0x338b62=_0x2a425d?_0x14d023[_0x996c('0x1b')]:_0xfb621f[_0x996c('0x18')]+_0xfb621f['limit'];var _0x166da6;if(_0x338b62>=_0x91fa1d){_0x338b62=_0x91fa1d;_0x166da6=0xc8;}else{_0x166da6=0xce;}_0x2a2929[_0x996c('0x1c')](_0x166da6);return _0x2a2929[_0x996c('0x1d')](_0x996c('0x1e'),_0x30b52a+'-'+_0x338b62+'/'+_0x91fa1d)['json'](_0x14d023);}return null;};}function patchUpdates(_0x256c46){return function(_0x3e5961){try{jsonpatch[_0x996c('0x1f')](_0x3e5961,_0x256c46,!![]);}catch(_0x546973){return BPromise[_0x996c('0x20')](_0x546973);}return _0x3e5961[_0x996c('0x21')]();};}function saveUpdates(_0x50f6f0,_0x59670b){return function(_0x31c1c5){if(_0x31c1c5){return _0x31c1c5[_0x996c('0x22')](_0x50f6f0)[_0x996c('0x23')](function(_0x366465){return _0x366465;});}return null;};}function removeEntity(_0x325021,_0x25916e){return function(_0x3d83b8){if(_0x3d83b8){return _0x3d83b8['destroy']()[_0x996c('0x23')](function(){_0x325021[_0x996c('0x1c')](0xcc)[_0x996c('0x24')]();});}};}function handleEntityNotFound(_0x5eacb1,_0x97256f){return function(_0x217bfe){if(!_0x217bfe){_0x5eacb1['sendStatus'](0x194);}return _0x217bfe;};}function handleError(_0x496b68,_0x115b39){_0x115b39=_0x115b39||0x1f4;return function(_0x1eaa94){logger[_0x996c('0x25')](_0x1eaa94['stack']);if(_0x1eaa94[_0x996c('0x26')]){delete _0x1eaa94[_0x996c('0x26')];}_0x496b68[_0x996c('0x1c')](_0x115b39)[_0x996c('0x27')](_0x1eaa94);};}exports[_0x996c('0x28')]=function(_0x223d2a,_0x90a531){var _0x108019={},_0x550ae0={},_0x3ae36c={'count':0x0,'rows':[]};var _0x35f543=_[_0x996c('0x29')](db[_0x996c('0x2a')]['rawAttributes'],function(_0x3a7b06){return{'name':_0x3a7b06[_0x996c('0x2b')],'type':_0x3a7b06[_0x996c('0x2c')]['key']};});_0x550ae0[_0x996c('0x2d')]=_[_0x996c('0x29')](_0x35f543,'name');_0x550ae0[_0x996c('0x2e')]=_[_0x996c('0x2f')](_0x223d2a['query']);_0x550ae0[_0x996c('0x30')]=_[_0x996c('0x31')](_0x550ae0[_0x996c('0x2d')],_0x550ae0[_0x996c('0x2e')]);_0x108019['attributes']=_[_0x996c('0x31')](_0x550ae0['model'],qs[_0x996c('0x32')](_0x223d2a[_0x996c('0x2e')][_0x996c('0x32')]));_0x108019[_0x996c('0x33')]=_0x108019[_0x996c('0x33')][_0x996c('0x34')]?_0x108019[_0x996c('0x33')]:_0x550ae0[_0x996c('0x2d')];if(!_0x223d2a[_0x996c('0x2e')][_0x996c('0x35')]('nolimit')){_0x108019[_0x996c('0x19')]=qs[_0x996c('0x19')](_0x223d2a['query'][_0x996c('0x19')]);_0x108019[_0x996c('0x18')]=qs[_0x996c('0x18')](_0x223d2a[_0x996c('0x2e')][_0x996c('0x18')]);}_0x108019[_0x996c('0x36')]=qs[_0x996c('0x37')](_0x223d2a[_0x996c('0x2e')][_0x996c('0x37')]);_0x108019[_0x996c('0x38')]=qs['filters'](_['pick'](_0x223d2a['query'],_0x550ae0[_0x996c('0x30')]),_0x35f543);if(_0x223d2a[_0x996c('0x2e')][_0x996c('0x39')]){_0x108019[_0x996c('0x38')]=_['merge'](_0x108019[_0x996c('0x38')],{'$or':_['map'](_0x35f543,function(_0x131c5e){if(_0x131c5e[_0x996c('0x2c')]!==_0x996c('0x3a')){var _0xc533b0={};_0xc533b0[_0x131c5e[_0x996c('0x26')]]={'$like':'%'+_0x223d2a['query'][_0x996c('0x39')]+'%'};return _0xc533b0;}})});}_0x108019=_[_0x996c('0x3b')]({},_0x108019,_0x223d2a[_0x996c('0x3c')]);var _0x44f71d={'where':_0x108019['where']};return db['Dynamics365Field'][_0x996c('0x1b')](_0x44f71d)[_0x996c('0x23')](function(_0x598137){_0x3ae36c['count']=_0x598137;if(_0x223d2a['query'][_0x996c('0x3d')]){_0x108019['include']=[{'all':!![]}];}return db[_0x996c('0x2a')]['findAll'](_0x108019);})[_0x996c('0x23')](function(_0x3191da){_0x3ae36c['rows']=_0x3191da;return _0x3ae36c;})['then'](respondWithFilteredResult(_0x90a531,_0x108019))[_0x996c('0x3e')](handleError(_0x90a531,null));};exports[_0x996c('0x3f')]=function(_0x36bdde,_0x4140aa){var _0x5ed1a1={'raw':!![],'where':{'id':_0x36bdde[_0x996c('0x40')]['id']}},_0x412882={};_0x412882[_0x996c('0x2d')]=_[_0x996c('0x2f')](db[_0x996c('0x2a')][_0x996c('0x41')]);_0x412882[_0x996c('0x2e')]=_[_0x996c('0x2f')](_0x36bdde[_0x996c('0x2e')]);_0x412882[_0x996c('0x30')]=_[_0x996c('0x31')](_0x412882[_0x996c('0x2d')],_0x412882['query']);_0x5ed1a1[_0x996c('0x33')]=_['intersection'](_0x412882[_0x996c('0x2d')],qs['fields'](_0x36bdde['query'][_0x996c('0x32')]));_0x5ed1a1['attributes']=_0x5ed1a1['attributes'][_0x996c('0x34')]?_0x5ed1a1[_0x996c('0x33')]:_0x412882[_0x996c('0x2d')];if(_0x36bdde['query'][_0x996c('0x3d')]){_0x5ed1a1[_0x996c('0x42')]=[{'all':!![]}];}_0x5ed1a1=_[_0x996c('0x3b')]({},_0x5ed1a1,_0x36bdde[_0x996c('0x3c')]);return db[_0x996c('0x2a')][_0x996c('0x43')](_0x5ed1a1)[_0x996c('0x23')](handleEntityNotFound(_0x4140aa,null))[_0x996c('0x23')](respondWithResult(_0x4140aa,null))[_0x996c('0x3e')](handleError(_0x4140aa,null));};exports[_0x996c('0x44')]=function(_0x1bee14,_0xf5c054){return db['Dynamics365Field']['create'](_0x1bee14[_0x996c('0x45')],{})[_0x996c('0x23')](respondWithResult(_0xf5c054,0xc9))['catch'](handleError(_0xf5c054,null));};exports[_0x996c('0x22')]=function(_0x63558d,_0x12317b){if(_0x63558d[_0x996c('0x45')]['id']){delete _0x63558d[_0x996c('0x45')]['id'];}return db[_0x996c('0x2a')][_0x996c('0x43')]({'where':{'id':_0x63558d[_0x996c('0x40')]['id']}})[_0x996c('0x23')](handleEntityNotFound(_0x12317b,null))['then'](saveUpdates(_0x63558d[_0x996c('0x45')],null))['then'](respondWithResult(_0x12317b,null))[_0x996c('0x3e')](handleError(_0x12317b,null));};exports['destroy']=function(_0x2ffe0d,_0xcc8402){return db[_0x996c('0x2a')][_0x996c('0x43')]({'where':{'id':_0x2ffe0d['params']['id']}})[_0x996c('0x23')](handleEntityNotFound(_0xcc8402,null))['then'](removeEntity(_0xcc8402,null))[_0x996c('0x3e')](handleError(_0xcc8402,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2ceabac..64edf30 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 _0xe38b=['./intDynamics365Field.attributes','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xe38b,0x198));var _0xbe38=function(_0x5c5940,_0xa5f767){_0x5c5940=_0x5c5940-0x0;var _0x26c147=_0xe38b[_0x5c5940];return _0x26c147;};'use strict';var _=require(_0xbe38('0x0'));var util=require('util');var logger=require(_0xbe38('0x1'))(_0xbe38('0x2'));var moment=require(_0xbe38('0x3'));var BPromise=require(_0xbe38('0x4'));var rp=require(_0xbe38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe38('0x6'));var config=require(_0xbe38('0x7'));var attributes=require(_0xbe38('0x8'));module['exports']=function(_0xa7942e,_0x4cb698){return _0xa7942e['define']('Dynamics365Field',attributes,{'tableName':_0xbe38('0x9'),'paranoid':![],'indexes':[{'name':_0xbe38('0xa'),'fields':[_0xbe38('0xb'),_0xbe38('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17c5=['api','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x17c5,0x167));var _0x517c=function(_0x3d7a9f,_0x24e0f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x13f5f1=_0x17c5[_0x3d7a9f];return _0x13f5f1;};'use strict';var _=require('lodash');var util=require(_0x517c('0x0'));var logger=require('../../config/logger')(_0x517c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x517c('0x2'));var rimraf=require(_0x517c('0x3'));var config=require(_0x517c('0x4'));var attributes=require(_0x517c('0x5'));module[_0x517c('0x6')]=function(_0x4f099b,_0x54690d){return _0x4f099b[_0x517c('0x7')]('Dynamics365Field',attributes,{'tableName':_0x517c('0x8'),'paranoid':![],'indexes':[{'name':_0x517c('0x9'),'fields':[_0x517c('0xa'),_0x517c('0xb')],'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 b10600d..84638c9 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 _0x02e1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4e1ff6,_0x3365f5){var _0x55f00f=function(_0x467109){while(--_0x467109){_0x4e1ff6['push'](_0x4e1ff6['shift']());}};_0x55f00f(++_0x3365f5);}(_0x02e1,0xec));var _0x102e=function(_0x35fc69,_0x5782b3){_0x35fc69=_0x35fc69-0x0;var _0x512adf=_0x02e1[_0x35fc69];return _0x512adf;};'use strict';var _=require(_0x102e('0x0'));var util=require('util');var moment=require(_0x102e('0x1'));var BPromise=require('bluebird');var rs=require(_0x102e('0x2'));var fs=require('fs');var Redis=require(_0x102e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x102e('0x4'));var logger=require(_0x102e('0x5'))(_0x102e('0x6'));var config=require(_0x102e('0x7'));var jayson=require(_0x102e('0x8'));var client=jayson[_0x102e('0x9')][_0x102e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dbd22,_0x171136,_0x4e65e3){return new BPromise(function(_0x4a6029,_0x11ae45){return client[_0x102e('0xb')](_0x4dbd22,_0x4e65e3)[_0x102e('0xc')](function(_0x2efeb3){logger[_0x102e('0xd')](_0x102e('0xe'),_0x171136,_0x102e('0xf'));logger[_0x102e('0x10')](_0x102e('0x11'),_0x171136,_0x102e('0xf'),JSON[_0x102e('0x12')](_0x2efeb3));if(_0x2efeb3['error']){if(_0x2efeb3['error']['code']===0x1f4){logger[_0x102e('0x13')](_0x102e('0xe'),_0x171136,_0x2efeb3[_0x102e('0x13')]['message']);return _0x11ae45(_0x2efeb3[_0x102e('0x13')][_0x102e('0x14')]);}logger[_0x102e('0x13')](_0x102e('0xe'),_0x171136,_0x2efeb3['error'][_0x102e('0x14')]);return _0x4a6029(_0x2efeb3[_0x102e('0x13')]['message']);}else{logger['info'](_0x102e('0xe'),_0x171136,_0x102e('0xf'));_0x4a6029(_0x2efeb3[_0x102e('0x15')][_0x102e('0x14')]);}})['catch'](function(_0x10dff0){logger['error'](_0x102e('0xe'),_0x171136,_0x10dff0);_0x11ae45(_0x10dff0);});});} \ No newline at end of file +var _0x0365=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x3f386d,_0x5cbbea){var _0x235a6f=function(_0x4c1ac9){while(--_0x4c1ac9){_0x3f386d['push'](_0x3f386d['shift']());}};_0x235a6f(++_0x5cbbea);}(_0x0365,0x6c));var _0x5036=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x0365[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0x5036('0x0'));var util=require(_0x5036('0x1'));var moment=require(_0x5036('0x2'));var BPromise=require(_0x5036('0x3'));var rs=require(_0x5036('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5036('0x5'));var logger=require('../../config/logger')(_0x5036('0x6'));var config=require(_0x5036('0x7'));var jayson=require(_0x5036('0x8'));var client=jayson[_0x5036('0x9')][_0x5036('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32f1f6,_0x5db33d,_0x232e6d){return new BPromise(function(_0x560dad,_0x282fd7){return client['request'](_0x32f1f6,_0x232e6d)[_0x5036('0xb')](function(_0x4c8263){logger[_0x5036('0xc')](_0x5036('0xd'),_0x5db33d,_0x5036('0xe'));logger[_0x5036('0xf')](_0x5036('0x10'),_0x5db33d,_0x5036('0xe'),JSON[_0x5036('0x11')](_0x4c8263));if(_0x4c8263['error']){if(_0x4c8263[_0x5036('0x12')][_0x5036('0x13')]===0x1f4){logger['error'](_0x5036('0xd'),_0x5db33d,_0x4c8263['error']['message']);return _0x282fd7(_0x4c8263['error']['message']);}logger[_0x5036('0x12')](_0x5036('0xd'),_0x5db33d,_0x4c8263[_0x5036('0x12')][_0x5036('0x14')]);return _0x560dad(_0x4c8263['error'][_0x5036('0x14')]);}else{logger[_0x5036('0xc')](_0x5036('0xd'),_0x5db33d,_0x5036('0xe'));_0x560dad(_0x4c8263['result'][_0x5036('0x14')]);}})[_0x5036('0x15')](function(_0x2fb7e0){logger[_0x5036('0x12')](_0x5036('0xd'),_0x5db33d,_0x2fb7e0);_0x282fd7(_0x2fb7e0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ca9e629..2b6916f 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 _0x9ee0=['../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x580a1a,_0x4ba2ab){var _0x18910b=function(_0x38f3b1){while(--_0x38f3b1){_0x580a1a['push'](_0x580a1a['shift']());}};_0x18910b(++_0x4ba2ab);}(_0x9ee0,0x16a));var _0x09ee=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x9ee0[_0x367a3d];return _0x460539;};'use strict';var multer=require(_0x09ee('0x0'));var util=require('util');var path=require(_0x09ee('0x1'));var timeout=require(_0x09ee('0x2'));var express=require(_0x09ee('0x3'));var router=express[_0x09ee('0x4')]();var fs_extra=require(_0x09ee('0x5'));var auth=require(_0x09ee('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x09ee('0x7'));var controller=require(_0x09ee('0x8'));router[_0x09ee('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x09ee('0xa'),auth[_0x09ee('0xb')](),controller[_0x09ee('0xc')]);router['get'](_0x09ee('0xd'),auth[_0x09ee('0xb')](),controller[_0x09ee('0xe')]);router[_0x09ee('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x09ee('0xf')]);router[_0x09ee('0x10')]('/',auth[_0x09ee('0xb')](),controller[_0x09ee('0x11')]);router[_0x09ee('0x10')]('/:id/configurations',auth[_0x09ee('0xb')](),controller[_0x09ee('0x12')]);router[_0x09ee('0x13')](_0x09ee('0xa'),auth[_0x09ee('0xb')](),controller[_0x09ee('0x14')]);router['delete'](_0x09ee('0xa'),auth['isAuthenticated'](),controller[_0x09ee('0x15')]);module[_0x09ee('0x16')]=router; \ No newline at end of file +var _0x06a8=['/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','create','post','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','show'];(function(_0x5e03fc,_0x1b5ed7){var _0x116ada=function(_0x1bb90e){while(--_0x1bb90e){_0x5e03fc['push'](_0x5e03fc['shift']());}};_0x116ada(++_0x1b5ed7);}(_0x06a8,0x10e));var _0x806a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x06a8[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x806a('0x0'));var util=require(_0x806a('0x1'));var path=require('path');var timeout=require(_0x806a('0x2'));var express=require('express');var router=express[_0x806a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x806a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x806a('0x5'));var controller=require(_0x806a('0x6'));router[_0x806a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x806a('0x8'),auth['isAuthenticated'](),controller[_0x806a('0x9')]);router[_0x806a('0x7')](_0x806a('0xa'),auth[_0x806a('0xb')](),controller[_0x806a('0xc')]);router[_0x806a('0x7')](_0x806a('0xd'),auth[_0x806a('0xb')](),controller['getFields']);router['post']('/',auth[_0x806a('0xb')](),controller[_0x806a('0xe')]);router[_0x806a('0xf')]('/:id/configurations',auth[_0x806a('0xb')](),controller['addConfiguration']);router[_0x806a('0x10')]('/:id',auth[_0x806a('0xb')](),controller[_0x806a('0x11')]);router[_0x806a('0x12')](_0x806a('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x806a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d8fa06b..b913f43 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 _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7b84,0x17c));var _0x47b8=function(_0x77aa88,_0xa8dfb2){_0x77aa88=_0x77aa88-0x0;var _0xa66c8a=_0x7b84[_0x77aa88];return _0xa66c8a;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x627e=['STRING','remoteUri','sequelize','exports'];(function(_0x598d85,_0x12d6c1){var _0x4dfa88=function(_0x3bca53){while(--_0x3bca53){_0x598d85['push'](_0x598d85['shift']());}};_0x4dfa88(++_0x12d6c1);}(_0x627e,0x14a));var _0xe627=function(_0x4ecf6a,_0x124be0){_0x4ecf6a=_0x4ecf6a-0x0;var _0x2d2060=_0x627e[_0x4ecf6a];return _0x2d2060;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'name':{'type':Sequelize[_0xe627('0x2')]},'description':{'type':Sequelize[_0xe627('0x2')]},'username':{'type':Sequelize[_0xe627('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe627('0x2')]},'remoteUri':{'type':Sequelize[_0xe627('0x2')],'unique':_0xe627('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f666b52..245ea9a 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 _0x02f7=['Subjects','Descriptions','channel','FreshdeskField','getFields','remoteUri','slice','substring','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','description','ticket_type','group','company','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','set','reject','save','update','then','destroy','stack','name','send','FreshdeskAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId'];(function(_0x5a1837,_0x3426a9){var _0x3f4508=function(_0xbd211e){while(--_0xbd211e){_0x5a1837['push'](_0x5a1837['shift']());}};_0x3f4508(++_0x3426a9);}(_0x02f7,0x1d3));var _0x702f=function(_0x36d2e4,_0x49819a){_0x36d2e4=_0x36d2e4-0x0;var _0x3c32ae=_0x02f7[_0x36d2e4];return _0x3c32ae;};'use strict';var emlformat=require(_0x702f('0x0'));var rimraf=require(_0x702f('0x1'));var zipdir=require(_0x702f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x702f('0x3'));var moment=require(_0x702f('0x4'));var BPromise=require(_0x702f('0x5'));var Mustache=require(_0x702f('0x6'));var util=require(_0x702f('0x7'));var path=require(_0x702f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x702f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x702f('0xa'));var squel=require(_0x702f('0xb'));var crypto=require(_0x702f('0xc'));var jsforce=require(_0x702f('0xd'));var deskjs=require(_0x702f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x702f('0xf'));var Papa=require(_0x702f('0x10'));var Redis=require(_0x702f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x702f('0x12'));var as=require(_0x702f('0x13'));var hardwareService=require(_0x702f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x702f('0x15'));var config=require(_0x702f('0x16'));var licenseUtil=require(_0x702f('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x702f('0x18'));function respondWithStatusCode(_0x3ac816,_0x4f8528){_0x4f8528=_0x4f8528||0xcc;return function(_0x39c277){if(_0x39c277){return _0x3ac816[_0x702f('0x19')](_0x4f8528);}return _0x3ac816[_0x702f('0x1a')](_0x4f8528)[_0x702f('0x1b')]();};}function respondWithResult(_0x1a714d,_0xe4f824){_0xe4f824=_0xe4f824||0xc8;return function(_0xa07719){if(_0xa07719){return _0x1a714d['status'](_0xe4f824)[_0x702f('0x1c')](_0xa07719);}};}function respondWithFilteredResult(_0x4104ae,_0x3bef6c){return function(_0x67a47e){if(_0x67a47e){var _0x1ab677=typeof _0x3bef6c['offset']==='undefined'&&typeof _0x3bef6c[_0x702f('0x1d')]==='undefined';var _0x922c85=_0x67a47e[_0x702f('0x1e')];var _0xa749fd=_0x1ab677?0x0:_0x3bef6c[_0x702f('0x1f')];var _0x53dd8f=_0x1ab677?_0x67a47e[_0x702f('0x1e')]:_0x3bef6c['offset']+_0x3bef6c['limit'];var _0x429813;if(_0x53dd8f>=_0x922c85){_0x53dd8f=_0x922c85;_0x429813=0xc8;}else{_0x429813=0xce;}_0x4104ae[_0x702f('0x1a')](_0x429813);return _0x4104ae[_0x702f('0x20')]('Content-Range',_0xa749fd+'-'+_0x53dd8f+'/'+_0x922c85)[_0x702f('0x1c')](_0x67a47e);}return null;};}function patchUpdates(_0x218e30){return function(_0x34864e){try{jsonpatch['apply'](_0x34864e,_0x218e30,!![]);}catch(_0x38ecba){return BPromise[_0x702f('0x21')](_0x38ecba);}return _0x34864e[_0x702f('0x22')]();};}function saveUpdates(_0x3f573e,_0x16cc77){return function(_0x431e6d){if(_0x431e6d){return _0x431e6d[_0x702f('0x23')](_0x3f573e)[_0x702f('0x24')](function(_0x1f47a2){return _0x1f47a2;});}return null;};}function removeEntity(_0xc030e5,_0x4699b4){return function(_0x28a0d8){if(_0x28a0d8){return _0x28a0d8[_0x702f('0x25')]()[_0x702f('0x24')](function(){_0xc030e5[_0x702f('0x1a')](0xcc)[_0x702f('0x1b')]();});}};}function handleEntityNotFound(_0x386086,_0x5f2961){return function(_0x3a2aeb){if(!_0x3a2aeb){_0x386086[_0x702f('0x19')](0x194);}return _0x3a2aeb;};}function handleError(_0x46136d,_0x244f42){_0x244f42=_0x244f42||0x1f4;return function(_0x9bb674){logger['error'](_0x9bb674[_0x702f('0x26')]);if(_0x9bb674['name']){delete _0x9bb674[_0x702f('0x27')];}_0x46136d[_0x702f('0x1a')](_0x244f42)[_0x702f('0x28')](_0x9bb674);};}exports['index']=function(_0x573103,_0x10d5c4){var _0x52fa34={},_0x2ee69d={},_0x228d4e={'count':0x0,'rows':[]};var _0x38dde7=_['map'](db[_0x702f('0x29')][_0x702f('0x2a')],function(_0x25e9df){return{'name':_0x25e9df['fieldName'],'type':_0x25e9df['type'][_0x702f('0x2b')]};});_0x2ee69d[_0x702f('0x2c')]=_[_0x702f('0x2d')](_0x38dde7,_0x702f('0x27'));_0x2ee69d[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x573103['query']);_0x2ee69d[_0x702f('0x30')]=_[_0x702f('0x31')](_0x2ee69d[_0x702f('0x2c')],_0x2ee69d[_0x702f('0x2e')]);_0x52fa34[_0x702f('0x32')]=_['intersection'](_0x2ee69d[_0x702f('0x2c')],qs[_0x702f('0x33')](_0x573103[_0x702f('0x2e')]['fields']));_0x52fa34[_0x702f('0x32')]=_0x52fa34[_0x702f('0x32')][_0x702f('0x34')]?_0x52fa34[_0x702f('0x32')]:_0x2ee69d[_0x702f('0x2c')];if(!_0x573103[_0x702f('0x2e')][_0x702f('0x35')](_0x702f('0x36'))){_0x52fa34[_0x702f('0x1d')]=qs[_0x702f('0x1d')](_0x573103[_0x702f('0x2e')]['limit']);_0x52fa34['offset']=qs[_0x702f('0x1f')](_0x573103[_0x702f('0x2e')][_0x702f('0x1f')]);}_0x52fa34[_0x702f('0x37')]=qs[_0x702f('0x38')](_0x573103[_0x702f('0x2e')]['sort']);_0x52fa34[_0x702f('0x39')]=qs[_0x702f('0x30')](_[_0x702f('0x3a')](_0x573103[_0x702f('0x2e')],_0x2ee69d[_0x702f('0x30')]),_0x38dde7);if(_0x573103[_0x702f('0x2e')][_0x702f('0x3b')]){_0x52fa34['where']=_[_0x702f('0x3c')](_0x52fa34[_0x702f('0x39')],{'$or':_[_0x702f('0x2d')](_0x38dde7,function(_0x2bbde4){if(_0x2bbde4[_0x702f('0x3d')]!==_0x702f('0x3e')){var _0x8f1d4={};_0x8f1d4[_0x2bbde4['name']]={'$like':'%'+_0x573103['query'][_0x702f('0x3b')]+'%'};return _0x8f1d4;}})});}_0x52fa34=_[_0x702f('0x3c')]({},_0x52fa34,_0x573103['options']);var _0xed3590={'where':_0x52fa34[_0x702f('0x39')]};return db['FreshdeskAccount'][_0x702f('0x1e')](_0xed3590)[_0x702f('0x24')](function(_0x334630){_0x228d4e[_0x702f('0x1e')]=_0x334630;if(_0x573103[_0x702f('0x2e')][_0x702f('0x3f')]){_0x52fa34[_0x702f('0x40')]=[{'all':!![]}];}return db[_0x702f('0x29')][_0x702f('0x41')](_0x52fa34);})[_0x702f('0x24')](function(_0xbfd3c9){_0x228d4e[_0x702f('0x42')]=_0xbfd3c9;return _0x228d4e;})['then'](respondWithFilteredResult(_0x10d5c4,_0x52fa34))['catch'](handleError(_0x10d5c4,null));};exports[_0x702f('0x43')]=function(_0x161ac4,_0xe8831a){var _0x180e6e={'raw':![],'where':{'id':_0x161ac4[_0x702f('0x44')]['id']}},_0x43f7ad={};_0x43f7ad[_0x702f('0x2c')]=_[_0x702f('0x2f')](db['FreshdeskAccount']['rawAttributes']);_0x43f7ad[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x161ac4[_0x702f('0x2e')]);_0x43f7ad[_0x702f('0x30')]=_['intersection'](_0x43f7ad[_0x702f('0x2c')],_0x43f7ad['query']);_0x180e6e[_0x702f('0x32')]=_[_0x702f('0x31')](_0x43f7ad['model'],qs['fields'](_0x161ac4[_0x702f('0x2e')][_0x702f('0x33')]));_0x180e6e['attributes']=_0x180e6e['attributes'][_0x702f('0x34')]?_0x180e6e[_0x702f('0x32')]:_0x43f7ad[_0x702f('0x2c')];if(_0x161ac4[_0x702f('0x2e')][_0x702f('0x3f')]){_0x180e6e[_0x702f('0x40')]=[{'all':!![]}];}_0x180e6e=_['merge']({},_0x180e6e,_0x161ac4['options']);return db[_0x702f('0x29')][_0x702f('0x45')](_0x180e6e)[_0x702f('0x24')](handleEntityNotFound(_0xe8831a,null))[_0x702f('0x24')](respondWithResult(_0xe8831a,null))[_0x702f('0x46')](handleError(_0xe8831a,null));};exports[_0x702f('0x47')]=function(_0x4d9e5e,_0x2e957b){return db[_0x702f('0x29')]['create'](_0x4d9e5e[_0x702f('0x48')],{})['then'](respondWithResult(_0x2e957b,0xc9))['catch'](handleError(_0x2e957b,null));};exports['update']=function(_0x2c8599,_0x1ae430){if(_0x2c8599['body']['id']){delete _0x2c8599[_0x702f('0x48')]['id'];}return db['FreshdeskAccount'][_0x702f('0x45')]({'where':{'id':_0x2c8599[_0x702f('0x44')]['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x1ae430,null))[_0x702f('0x24')](saveUpdates(_0x2c8599[_0x702f('0x48')],null))[_0x702f('0x24')](respondWithResult(_0x1ae430,null))[_0x702f('0x46')](handleError(_0x1ae430,null));};exports[_0x702f('0x25')]=function(_0x3f378c,_0x8f260d){return db[_0x702f('0x29')][_0x702f('0x45')]({'where':{'id':_0x3f378c['params']['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x8f260d,null))[_0x702f('0x24')](removeEntity(_0x8f260d,null))[_0x702f('0x46')](handleError(_0x8f260d,null));};exports[_0x702f('0x49')]=function(_0x4a7ea9,_0x13cfdc,_0xe28bb5){var _0x1d7a1a={};var _0x1f305a={};var _0x3f1da0;var _0x3f5899;return db['FreshdeskAccount'][_0x702f('0x4a')]({'where':{'id':_0x4a7ea9[_0x702f('0x44')]['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x13cfdc,null))[_0x702f('0x24')](function(_0x541b9b){if(_0x541b9b){_0x3f1da0=_0x541b9b;_0x1f305a[_0x702f('0x2c')]=_[_0x702f('0x2f')](db[_0x702f('0x4b')]['rawAttributes']);_0x1f305a[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x4a7ea9[_0x702f('0x2e')]);_0x1f305a[_0x702f('0x30')]=_[_0x702f('0x31')](_0x1f305a['model'],_0x1f305a[_0x702f('0x2e')]);_0x1d7a1a['attributes']=_[_0x702f('0x31')](_0x1f305a[_0x702f('0x2c')],qs[_0x702f('0x33')](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x33')]));_0x1d7a1a[_0x702f('0x32')]=_0x1d7a1a[_0x702f('0x32')][_0x702f('0x34')]?_0x1d7a1a[_0x702f('0x32')]:_0x1f305a[_0x702f('0x2c')];_0x1d7a1a['order']=qs['sort'](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x38')]);_0x1d7a1a[_0x702f('0x39')]=qs[_0x702f('0x30')](_[_0x702f('0x3a')](_0x4a7ea9[_0x702f('0x2e')],_0x1f305a[_0x702f('0x30')]));if(_0x4a7ea9['query'][_0x702f('0x3b')]){_0x1d7a1a[_0x702f('0x39')]=_[_0x702f('0x3c')](_0x1d7a1a[_0x702f('0x39')],{'$or':_['map'](_0x1d7a1a['attributes'],function(_0x5e5c82){var _0x23d1d3={};_0x23d1d3[_0x5e5c82]={'$like':'%'+_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x3b')]+'%'};return _0x23d1d3;})});}_0x1d7a1a=_['merge']({},_0x1d7a1a,_0x4a7ea9['options']);return _0x3f1da0[_0x702f('0x49')](_0x1d7a1a);}})[_0x702f('0x24')](function(_0x599a40){if(_0x599a40){_0x3f5899=_0x599a40[_0x702f('0x34')];if(!_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x35')](_0x702f('0x36'))){_0x1d7a1a['limit']=qs[_0x702f('0x1d')](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x1d')]);_0x1d7a1a[_0x702f('0x1f')]=qs['offset'](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x1f')]);}return _0x3f1da0['getConfigurations'](_0x1d7a1a);}})[_0x702f('0x24')](function(_0x336ef6){if(_0x336ef6){return _0x336ef6?{'count':_0x3f5899,'rows':_0x336ef6}:null;}})[_0x702f('0x24')](respondWithResult(_0x13cfdc,null))[_0x702f('0x46')](handleError(_0x13cfdc,null));};exports[_0x702f('0x4c')]=function(_0x10de2a,_0x32e37b,_0x4facae){if(_0x10de2a[_0x702f('0x48')]['id']){delete _0x10de2a['body']['id'];}return db[_0x702f('0x29')][_0x702f('0x4a')]({'where':{'id':_0x10de2a[_0x702f('0x44')]['id']}})['then'](handleEntityNotFound(_0x32e37b,null))[_0x702f('0x24')](function(_0x4ca7ba){if(_0x4ca7ba){_0x10de2a[_0x702f('0x48')][_0x702f('0x4d')]=_0x4ca7ba['id'];_0x10de2a[_0x702f('0x48')][_0x702f('0x4e')]=integrations['getSubjects'](_0x10de2a[_0x702f('0x48')]['channel'],_0x10de2a[_0x702f('0x48')][_0x702f('0x3d')]);_0x10de2a[_0x702f('0x48')][_0x702f('0x4f')]=integrations['getDescriptions'](_0x10de2a['body'][_0x702f('0x50')],_0x10de2a[_0x702f('0x48')][_0x702f('0x3d')]);return db[_0x702f('0x4b')]['create'](_0x10de2a[_0x702f('0x48')],{'include':[{'model':db[_0x702f('0x51')],'as':_0x702f('0x4e')},{'model':db[_0x702f('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x32e37b,null))[_0x702f('0x46')](handleError(_0x32e37b,null));};exports[_0x702f('0x52')]=function(_0x3ee283,_0x57d505,_0x25709c){var _0x30b74f='';return db['FreshdeskAccount'][_0x702f('0x4a')]({'where':{'id':_0x3ee283[_0x702f('0x44')]['id']},'attributes':['id',_0x702f('0x53'),'apiKey']})['then'](handleEntityNotFound(_0x57d505,null))['then'](function(_0x31efbf){if(_0x31efbf){_0x30b74f=_0x31efbf[_0x702f('0x53')];var _0x1bf58f=_0x30b74f[_0x702f('0x54')](-0x1);if(_0x1bf58f==='/'){_0x30b74f=_0x30b74f[_0x702f('0x55')](0x0,_0x30b74f['lastIndexOf'](_0x1bf58f));}return rp({'method':'GET','uri':util[_0x702f('0x56')](_0x702f('0x57'),_0x30b74f,_0x702f('0x58')),'headers':{'Authorization':util['format'](_0x702f('0x59'),new Buffer(util[_0x702f('0x56')](_0x702f('0x5a'),_0x31efbf[_0x702f('0x5b')]))[_0x702f('0x5c')](_0x702f('0x5d')))},'json':!![]});}})[_0x702f('0x24')](function(_0x13142f){if(_0x13142f){var _0x2b6454=[_0x702f('0x5e'),'subject','agent',_0x702f('0x5f'),_0x702f('0x1a'),'priority','group','source',_0x702f('0x60'),_0x702f('0x61'),_0x702f('0x62')];_['remove'](_0x13142f,function(_0xc86c4b){return _0x2b6454[_0x702f('0x63')](_0xc86c4b['name'])||!_0xc86c4b['default']&&_0xc86c4b['type']!==_0x702f('0x64')&&_0xc86c4b[_0x702f('0x3d')]!==_0x702f('0x65');});return{'count':_0x13142f[_0x702f('0x34')],'rows':_[_0x702f('0x2d')](_0x13142f,function(_0x45ee70){return{'id':_0x45ee70['name'],'name':_0x45ee70[_0x702f('0x66')],'custom':!_0x45ee70['default'],'options':_0x45ee70[_0x702f('0x67')]?_[_0x702f('0x2d')](_0x45ee70[_0x702f('0x67')],function(_0x1daac9){return{'name':_[_0x702f('0x68')](_0x1daac9),'value':_0x1daac9};}):[]};})};}})[_0x702f('0x24')](respondWithResult(_0x57d505,null))[_0x702f('0x46')](function(_0x1ee2c0){var _0x13340e=_0x3ee283[_0x702f('0x2e')][_0x702f('0x69')]?0x1f4:_0x1ee2c0[_0x702f('0x6a')]||0x1f4;logger['error'](_0x702f('0x6b'),_0x702f('0x52'),_0x13340e,JSON['stringify'](_0x1ee2c0));delete _0x1ee2c0['name'];if(_0x13340e===0x191){_0x13340e=0x190;}_0x57d505['status'](_0x13340e)[_0x702f('0x28')](_0x3ee283[_0x702f('0x2e')][_0x702f('0x69')]?{'message':_0x702f('0x6c'),'statusCode':_0x1ee2c0['statusCode']}:_0x1ee2c0);});}; \ No newline at end of file +var _0x5fc7=['custom_text','custom_dropdown','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','limit','undefined','count','Content-Range','reject','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','FreshdeskAccount','then','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','description','priority','group','source','ticket_type','remove','includes','default'];(function(_0x3096c8,_0x4cf94c){var _0x4cb984=function(_0x5a1efc){while(--_0x5a1efc){_0x3096c8['push'](_0x3096c8['shift']());}};_0x4cb984(++_0x4cf94c);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x5fc7[_0x580b15];return _0x1adb1b;};'use strict';var emlformat=require(_0x75fc('0x0'));var rimraf=require(_0x75fc('0x1'));var zipdir=require(_0x75fc('0x2'));var jsonpatch=require(_0x75fc('0x3'));var rp=require(_0x75fc('0x4'));var moment=require(_0x75fc('0x5'));var BPromise=require(_0x75fc('0x6'));var Mustache=require(_0x75fc('0x7'));var util=require(_0x75fc('0x8'));var path=require(_0x75fc('0x9'));var sox=require(_0x75fc('0xa'));var csv=require(_0x75fc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75fc('0xc'));var _=require(_0x75fc('0xd'));var squel=require(_0x75fc('0xe'));var crypto=require(_0x75fc('0xf'));var jsforce=require(_0x75fc('0x10'));var deskjs=require(_0x75fc('0x11'));var toCsv=require(_0x75fc('0xb'));var querystring=require(_0x75fc('0x12'));var Papa=require(_0x75fc('0x13'));var Redis=require(_0x75fc('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x75fc('0x15'));var as=require(_0x75fc('0x16'));var hardwareService=require(_0x75fc('0x17'));var logger=require(_0x75fc('0x18'))('api');var utils=require(_0x75fc('0x19'));var config=require(_0x75fc('0x1a'));var licenseUtil=require(_0x75fc('0x1b'));var db=require(_0x75fc('0x1c'))['db'];var integrations=require(_0x75fc('0x1d'));function respondWithStatusCode(_0x22bdb0,_0x22b73d){_0x22b73d=_0x22b73d||0xcc;return function(_0x58748e){if(_0x58748e){return _0x22bdb0['sendStatus'](_0x22b73d);}return _0x22bdb0['status'](_0x22b73d)[_0x75fc('0x1e')]();};}function respondWithResult(_0x2e0e83,_0x2e073b){_0x2e073b=_0x2e073b||0xc8;return function(_0x2cb4ed){if(_0x2cb4ed){return _0x2e0e83[_0x75fc('0x1f')](_0x2e073b)[_0x75fc('0x20')](_0x2cb4ed);}};}function respondWithFilteredResult(_0x3b64b2,_0x3053b6){return function(_0x53f23d){if(_0x53f23d){var _0xf3dec8=typeof _0x3053b6[_0x75fc('0x21')]==='undefined'&&typeof _0x3053b6[_0x75fc('0x22')]===_0x75fc('0x23');var _0x5a3311=_0x53f23d['count'];var _0x25b52b=_0xf3dec8?0x0:_0x3053b6[_0x75fc('0x21')];var _0x3b1edf=_0xf3dec8?_0x53f23d[_0x75fc('0x24')]:_0x3053b6[_0x75fc('0x21')]+_0x3053b6[_0x75fc('0x22')];var _0x523d14;if(_0x3b1edf>=_0x5a3311){_0x3b1edf=_0x5a3311;_0x523d14=0xc8;}else{_0x523d14=0xce;}_0x3b64b2[_0x75fc('0x1f')](_0x523d14);return _0x3b64b2['set'](_0x75fc('0x25'),_0x25b52b+'-'+_0x3b1edf+'/'+_0x5a3311)[_0x75fc('0x20')](_0x53f23d);}return null;};}function patchUpdates(_0x2780e3){return function(_0x294b24){try{jsonpatch['apply'](_0x294b24,_0x2780e3,!![]);}catch(_0x34cf9c){return BPromise[_0x75fc('0x26')](_0x34cf9c);}return _0x294b24['save']();};}function saveUpdates(_0x458cc4,_0x3ed9d5){return function(_0x4d5346){if(_0x4d5346){return _0x4d5346[_0x75fc('0x27')](_0x458cc4)['then'](function(_0x14745f){return _0x14745f;});}return null;};}function removeEntity(_0x924c53,_0x54b684){return function(_0xd8b8e1){if(_0xd8b8e1){return _0xd8b8e1[_0x75fc('0x28')]()['then'](function(){_0x924c53[_0x75fc('0x1f')](0xcc)[_0x75fc('0x1e')]();});}};}function handleEntityNotFound(_0x53fcd2,_0x5774bb){return function(_0x10a59a){if(!_0x10a59a){_0x53fcd2['sendStatus'](0x194);}return _0x10a59a;};}function handleError(_0x19a59e,_0x4268ed){_0x4268ed=_0x4268ed||0x1f4;return function(_0x4f70b4){logger['error'](_0x4f70b4['stack']);if(_0x4f70b4[_0x75fc('0x29')]){delete _0x4f70b4[_0x75fc('0x29')];}_0x19a59e[_0x75fc('0x1f')](_0x4268ed)[_0x75fc('0x2a')](_0x4f70b4);};}exports[_0x75fc('0x2b')]=function(_0xc7025,_0x337058){var _0x54bcd5={},_0x23aa27={},_0x3e99d7={'count':0x0,'rows':[]};var _0x17b0c0=_[_0x75fc('0x2c')](db['FreshdeskAccount'][_0x75fc('0x2d')],function(_0x486e3f){return{'name':_0x486e3f[_0x75fc('0x2e')],'type':_0x486e3f[_0x75fc('0x2f')][_0x75fc('0x30')]};});_0x23aa27[_0x75fc('0x31')]=_['map'](_0x17b0c0,_0x75fc('0x29'));_0x23aa27['query']=_[_0x75fc('0x32')](_0xc7025[_0x75fc('0x33')]);_0x23aa27['filters']=_[_0x75fc('0x34')](_0x23aa27[_0x75fc('0x31')],_0x23aa27['query']);_0x54bcd5[_0x75fc('0x35')]=_[_0x75fc('0x34')](_0x23aa27[_0x75fc('0x31')],qs[_0x75fc('0x36')](_0xc7025[_0x75fc('0x33')][_0x75fc('0x36')]));_0x54bcd5[_0x75fc('0x35')]=_0x54bcd5[_0x75fc('0x35')]['length']?_0x54bcd5[_0x75fc('0x35')]:_0x23aa27[_0x75fc('0x31')];if(!_0xc7025[_0x75fc('0x33')][_0x75fc('0x37')](_0x75fc('0x38'))){_0x54bcd5[_0x75fc('0x22')]=qs[_0x75fc('0x22')](_0xc7025[_0x75fc('0x33')][_0x75fc('0x22')]);_0x54bcd5[_0x75fc('0x21')]=qs[_0x75fc('0x21')](_0xc7025[_0x75fc('0x33')][_0x75fc('0x21')]);}_0x54bcd5['order']=qs[_0x75fc('0x39')](_0xc7025[_0x75fc('0x33')][_0x75fc('0x39')]);_0x54bcd5[_0x75fc('0x3a')]=qs['filters'](_[_0x75fc('0x3b')](_0xc7025[_0x75fc('0x33')],_0x23aa27[_0x75fc('0x3c')]),_0x17b0c0);if(_0xc7025[_0x75fc('0x33')][_0x75fc('0x3d')]){_0x54bcd5[_0x75fc('0x3a')]=_[_0x75fc('0x3e')](_0x54bcd5[_0x75fc('0x3a')],{'$or':_['map'](_0x17b0c0,function(_0x9cd4bd){if(_0x9cd4bd[_0x75fc('0x2f')]!==_0x75fc('0x3f')){var _0x45f2b9={};_0x45f2b9[_0x9cd4bd[_0x75fc('0x29')]]={'$like':'%'+_0xc7025[_0x75fc('0x33')]['filter']+'%'};return _0x45f2b9;}})});}_0x54bcd5=_[_0x75fc('0x3e')]({},_0x54bcd5,_0xc7025[_0x75fc('0x40')]);var _0x51a36b={'where':_0x54bcd5[_0x75fc('0x3a')]};return db[_0x75fc('0x41')][_0x75fc('0x24')](_0x51a36b)[_0x75fc('0x42')](function(_0x325fcd){_0x3e99d7['count']=_0x325fcd;if(_0xc7025[_0x75fc('0x33')]['includeAll']){_0x54bcd5[_0x75fc('0x43')]=[{'all':!![]}];}return db[_0x75fc('0x41')][_0x75fc('0x44')](_0x54bcd5);})[_0x75fc('0x42')](function(_0x2fec87){_0x3e99d7[_0x75fc('0x45')]=_0x2fec87;return _0x3e99d7;})[_0x75fc('0x42')](respondWithFilteredResult(_0x337058,_0x54bcd5))[_0x75fc('0x46')](handleError(_0x337058,null));};exports[_0x75fc('0x47')]=function(_0x58c57d,_0x382ca5){var _0x3e8ec6={'raw':![],'where':{'id':_0x58c57d[_0x75fc('0x48')]['id']}},_0x327bdd={};_0x327bdd[_0x75fc('0x31')]=_['keys'](db[_0x75fc('0x41')][_0x75fc('0x2d')]);_0x327bdd[_0x75fc('0x33')]=_['keys'](_0x58c57d[_0x75fc('0x33')]);_0x327bdd[_0x75fc('0x3c')]=_[_0x75fc('0x34')](_0x327bdd[_0x75fc('0x31')],_0x327bdd[_0x75fc('0x33')]);_0x3e8ec6[_0x75fc('0x35')]=_[_0x75fc('0x34')](_0x327bdd['model'],qs[_0x75fc('0x36')](_0x58c57d[_0x75fc('0x33')]['fields']));_0x3e8ec6[_0x75fc('0x35')]=_0x3e8ec6[_0x75fc('0x35')][_0x75fc('0x49')]?_0x3e8ec6['attributes']:_0x327bdd[_0x75fc('0x31')];if(_0x58c57d['query']['includeAll']){_0x3e8ec6['include']=[{'all':!![]}];}_0x3e8ec6=_[_0x75fc('0x3e')]({},_0x3e8ec6,_0x58c57d[_0x75fc('0x40')]);return db[_0x75fc('0x41')]['find'](_0x3e8ec6)[_0x75fc('0x42')](handleEntityNotFound(_0x382ca5,null))['then'](respondWithResult(_0x382ca5,null))[_0x75fc('0x46')](handleError(_0x382ca5,null));};exports[_0x75fc('0x4a')]=function(_0x35bd3c,_0x947e85){return db['FreshdeskAccount'][_0x75fc('0x4a')](_0x35bd3c[_0x75fc('0x4b')],{})[_0x75fc('0x42')](respondWithResult(_0x947e85,0xc9))[_0x75fc('0x46')](handleError(_0x947e85,null));};exports[_0x75fc('0x27')]=function(_0x887cd4,_0x31037c){if(_0x887cd4['body']['id']){delete _0x887cd4[_0x75fc('0x4b')]['id'];}return db['FreshdeskAccount'][_0x75fc('0x4c')]({'where':{'id':_0x887cd4[_0x75fc('0x48')]['id']}})[_0x75fc('0x42')](handleEntityNotFound(_0x31037c,null))[_0x75fc('0x42')](saveUpdates(_0x887cd4[_0x75fc('0x4b')],null))[_0x75fc('0x42')](respondWithResult(_0x31037c,null))[_0x75fc('0x46')](handleError(_0x31037c,null));};exports[_0x75fc('0x28')]=function(_0x11eade,_0x55af83){return db[_0x75fc('0x41')][_0x75fc('0x4c')]({'where':{'id':_0x11eade[_0x75fc('0x48')]['id']}})[_0x75fc('0x42')](handleEntityNotFound(_0x55af83,null))['then'](removeEntity(_0x55af83,null))['catch'](handleError(_0x55af83,null));};exports[_0x75fc('0x4d')]=function(_0x491e7c,_0x315c57,_0x15ac36){var _0x17e84f={};var _0x46dc62={};var _0x2b0c59;var _0xee6e51;return db[_0x75fc('0x41')][_0x75fc('0x4e')]({'where':{'id':_0x491e7c[_0x75fc('0x48')]['id']}})[_0x75fc('0x42')](handleEntityNotFound(_0x315c57,null))['then'](function(_0x43c82a){if(_0x43c82a){_0x2b0c59=_0x43c82a;_0x46dc62[_0x75fc('0x31')]=_[_0x75fc('0x32')](db['FreshdeskConfiguration']['rawAttributes']);_0x46dc62[_0x75fc('0x33')]=_[_0x75fc('0x32')](_0x491e7c[_0x75fc('0x33')]);_0x46dc62[_0x75fc('0x3c')]=_['intersection'](_0x46dc62[_0x75fc('0x31')],_0x46dc62[_0x75fc('0x33')]);_0x17e84f['attributes']=_[_0x75fc('0x34')](_0x46dc62['model'],qs[_0x75fc('0x36')](_0x491e7c[_0x75fc('0x33')][_0x75fc('0x36')]));_0x17e84f['attributes']=_0x17e84f[_0x75fc('0x35')][_0x75fc('0x49')]?_0x17e84f[_0x75fc('0x35')]:_0x46dc62[_0x75fc('0x31')];_0x17e84f[_0x75fc('0x4f')]=qs[_0x75fc('0x39')](_0x491e7c[_0x75fc('0x33')][_0x75fc('0x39')]);_0x17e84f[_0x75fc('0x3a')]=qs['filters'](_['pick'](_0x491e7c[_0x75fc('0x33')],_0x46dc62['filters']));if(_0x491e7c[_0x75fc('0x33')][_0x75fc('0x3d')]){_0x17e84f['where']=_[_0x75fc('0x3e')](_0x17e84f[_0x75fc('0x3a')],{'$or':_['map'](_0x17e84f[_0x75fc('0x35')],function(_0x3217f4){var _0x441e02={};_0x441e02[_0x3217f4]={'$like':'%'+_0x491e7c['query'][_0x75fc('0x3d')]+'%'};return _0x441e02;})});}_0x17e84f=_[_0x75fc('0x3e')]({},_0x17e84f,_0x491e7c[_0x75fc('0x40')]);return _0x2b0c59[_0x75fc('0x4d')](_0x17e84f);}})[_0x75fc('0x42')](function(_0x3e0611){if(_0x3e0611){_0xee6e51=_0x3e0611[_0x75fc('0x49')];if(!_0x491e7c['query'][_0x75fc('0x37')]('nolimit')){_0x17e84f['limit']=qs['limit'](_0x491e7c[_0x75fc('0x33')][_0x75fc('0x22')]);_0x17e84f[_0x75fc('0x21')]=qs[_0x75fc('0x21')](_0x491e7c['query'][_0x75fc('0x21')]);}return _0x2b0c59[_0x75fc('0x4d')](_0x17e84f);}})['then'](function(_0x47432b){if(_0x47432b){return _0x47432b?{'count':_0xee6e51,'rows':_0x47432b}:null;}})[_0x75fc('0x42')](respondWithResult(_0x315c57,null))['catch'](handleError(_0x315c57,null));};exports[_0x75fc('0x50')]=function(_0x19150f,_0xd5c3c4,_0x29ef31){if(_0x19150f[_0x75fc('0x4b')]['id']){delete _0x19150f[_0x75fc('0x4b')]['id'];}return db[_0x75fc('0x41')][_0x75fc('0x4e')]({'where':{'id':_0x19150f[_0x75fc('0x48')]['id']}})[_0x75fc('0x42')](handleEntityNotFound(_0xd5c3c4,null))['then'](function(_0x45e7aa){if(_0x45e7aa){_0x19150f[_0x75fc('0x4b')][_0x75fc('0x51')]=_0x45e7aa['id'];_0x19150f[_0x75fc('0x4b')][_0x75fc('0x52')]=integrations['getSubjects'](_0x19150f[_0x75fc('0x4b')][_0x75fc('0x53')],_0x19150f['body']['type']);_0x19150f['body'][_0x75fc('0x54')]=integrations[_0x75fc('0x55')](_0x19150f[_0x75fc('0x4b')][_0x75fc('0x53')],_0x19150f[_0x75fc('0x4b')][_0x75fc('0x2f')]);return db['FreshdeskConfiguration']['create'](_0x19150f[_0x75fc('0x4b')],{'include':[{'model':db[_0x75fc('0x56')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x75fc('0x54')}]});}return null;})[_0x75fc('0x42')](respondWithResult(_0xd5c3c4,null))[_0x75fc('0x46')](handleError(_0xd5c3c4,null));};exports[_0x75fc('0x57')]=function(_0x4de63c,_0x567cfd,_0x29cfce){var _0x5743a9='';return db[_0x75fc('0x41')][_0x75fc('0x4e')]({'where':{'id':_0x4de63c[_0x75fc('0x48')]['id']},'attributes':['id',_0x75fc('0x58'),_0x75fc('0x59')]})[_0x75fc('0x42')](handleEntityNotFound(_0x567cfd,null))[_0x75fc('0x42')](function(_0x3a55fe){if(_0x3a55fe){_0x5743a9=_0x3a55fe[_0x75fc('0x58')];var _0x56a110=_0x5743a9[_0x75fc('0x5a')](-0x1);if(_0x56a110==='/'){_0x5743a9=_0x5743a9[_0x75fc('0x5b')](0x0,_0x5743a9[_0x75fc('0x5c')](_0x56a110));}return rp({'method':_0x75fc('0x5d'),'uri':util[_0x75fc('0x5e')]('%s/%s',_0x5743a9,_0x75fc('0x5f')),'headers':{'Authorization':util['format'](_0x75fc('0x60'),new Buffer(util[_0x75fc('0x5e')](_0x75fc('0x61'),_0x3a55fe[_0x75fc('0x59')]))[_0x75fc('0x62')]('base64'))},'json':!![]});}})[_0x75fc('0x42')](function(_0x2bc003){if(_0x2bc003){var _0x309986=[_0x75fc('0x63'),_0x75fc('0x64'),'agent',_0x75fc('0x65'),_0x75fc('0x1f'),_0x75fc('0x66'),_0x75fc('0x67'),_0x75fc('0x68'),_0x75fc('0x69'),'group','company'];_[_0x75fc('0x6a')](_0x2bc003,function(_0x251b2a){return _0x309986[_0x75fc('0x6b')](_0x251b2a[_0x75fc('0x29')])||!_0x251b2a[_0x75fc('0x6c')]&&_0x251b2a[_0x75fc('0x2f')]!==_0x75fc('0x6d')&&_0x251b2a[_0x75fc('0x2f')]!==_0x75fc('0x6e');});return{'count':_0x2bc003['length'],'rows':_[_0x75fc('0x2c')](_0x2bc003,function(_0x443c0f){return{'id':_0x443c0f[_0x75fc('0x29')],'name':_0x443c0f['label'],'custom':!_0x443c0f['default'],'options':_0x443c0f[_0x75fc('0x6f')]?_[_0x75fc('0x2c')](_0x443c0f[_0x75fc('0x6f')],function(_0xb5e7eb){return{'name':_[_0x75fc('0x70')](_0xb5e7eb),'value':_0xb5e7eb};}):[]};})};}})[_0x75fc('0x42')](respondWithResult(_0x567cfd,null))['catch'](function(_0x176ee8){var _0x206ba7=_0x4de63c[_0x75fc('0x33')][_0x75fc('0x71')]?0x1f4:_0x176ee8['statusCode']||0x1f4;logger[_0x75fc('0x72')](_0x75fc('0x73'),'getFields',_0x206ba7,JSON[_0x75fc('0x74')](_0x176ee8));delete _0x176ee8[_0x75fc('0x29')];if(_0x206ba7===0x191){_0x206ba7=0x190;}_0x567cfd[_0x75fc('0x1f')](_0x206ba7)[_0x75fc('0x2a')](_0x4de63c[_0x75fc('0x33')][_0x75fc('0x71')]?{'message':_0x75fc('0x75'),'statusCode':_0x176ee8['statusCode']}:_0x176ee8);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 8de0563..a78b84a 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 _0x977b=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4a25e7,_0x31483a){var _0x2238bb=function(_0x32c49e){while(--_0x32c49e){_0x4a25e7['push'](_0x4a25e7['shift']());}};_0x2238bb(++_0x31483a);}(_0x977b,0xb0));var _0xb977=function(_0x5d01f9,_0x303620){_0x5d01f9=_0x5d01f9-0x0;var _0x1fe316=_0x977b[_0x5d01f9];return _0x1fe316;};'use strict';var _=require(_0xb977('0x0'));var util=require('util');var logger=require(_0xb977('0x1'))('api');var moment=require(_0xb977('0x2'));var BPromise=require(_0xb977('0x3'));var rp=require(_0xb977('0x4'));var fs=require('fs');var path=require(_0xb977('0x5'));var rimraf=require(_0xb977('0x6'));var config=require(_0xb977('0x7'));var attributes=require(_0xb977('0x8'));var integrations=require(_0xb977('0x9'));module[_0xb977('0xa')]=function(_0x35c421,_0x2900cd){return _0x35c421['define'](_0xb977('0xb'),attributes,{'tableName':_0xb977('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35d1=['define','int_freshdesk_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x35d1,0x1d0));var _0x135d=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x35d1[_0x3fe393];return _0x534d14;};'use strict';var _=require(_0x135d('0x0'));var util=require(_0x135d('0x1'));var logger=require(_0x135d('0x2'))('api');var moment=require(_0x135d('0x3'));var BPromise=require('bluebird');var rp=require(_0x135d('0x4'));var fs=require('fs');var path=require(_0x135d('0x5'));var rimraf=require(_0x135d('0x6'));var config=require(_0x135d('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x135d('0x8')]=function(_0x26a770,_0x2d591){return _0x26a770[_0x135d('0x9')]('FreshdeskAccount',attributes,{'tableName':_0x135d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 84a1b4e..93627e9 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 _0xdcab=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x14cadd,_0x18f999){var _0x1d63f9=function(_0x5cbc6c){while(--_0x5cbc6c){_0x14cadd['push'](_0x14cadd['shift']());}};_0x1d63f9(++_0x18f999);}(_0xdcab,0x1e9));var _0xbdca=function(_0x46ba0d,_0x4e5086){_0x46ba0d=_0x46ba0d-0x0;var _0x4aa60a=_0xdcab[_0x46ba0d];return _0x4aa60a;};'use strict';var _=require(_0xbdca('0x0'));var util=require(_0xbdca('0x1'));var moment=require(_0xbdca('0x2'));var BPromise=require(_0xbdca('0x3'));var rs=require(_0xbdca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbdca('0x5'));var logger=require(_0xbdca('0x6'))(_0xbdca('0x7'));var config=require(_0xbdca('0x8'));var jayson=require(_0xbdca('0x9'));var client=jayson[_0xbdca('0xa')][_0xbdca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37b1ff,_0x45cb63,_0xd4559f){return new BPromise(function(_0x4cde25,_0x1e46b9){return client['request'](_0x37b1ff,_0xd4559f)[_0xbdca('0xc')](function(_0x2c5579){logger[_0xbdca('0xd')](_0xbdca('0xe'),_0x45cb63,_0xbdca('0xf'));logger[_0xbdca('0x10')](_0xbdca('0x11'),_0x45cb63,_0xbdca('0xf'),JSON[_0xbdca('0x12')](_0x2c5579));if(_0x2c5579['error']){if(_0x2c5579[_0xbdca('0x13')][_0xbdca('0x14')]===0x1f4){logger[_0xbdca('0x13')](_0xbdca('0xe'),_0x45cb63,_0x2c5579['error'][_0xbdca('0x15')]);return _0x1e46b9(_0x2c5579['error'][_0xbdca('0x15')]);}logger[_0xbdca('0x13')](_0xbdca('0xe'),_0x45cb63,_0x2c5579['error']['message']);return _0x4cde25(_0x2c5579[_0xbdca('0x13')][_0xbdca('0x15')]);}else{logger[_0xbdca('0xd')](_0xbdca('0xe'),_0x45cb63,_0xbdca('0xf'));_0x4cde25(_0x2c5579[_0xbdca('0x16')]['message']);}})[_0xbdca('0x17')](function(_0x69ecf6){logger[_0xbdca('0x13')](_0xbdca('0xe'),_0x45cb63,_0x69ecf6);_0x1e46b9(_0x69ecf6);});});}exports['GetFreshdeskAccount']=function(_0xa813fc){var _0x90d3d=this;return new Promise(function(_0x1b98cc,_0xb19a6){return db['FreshdeskAccount'][_0xbdca('0x18')]({'raw':_0xa813fc[_0xbdca('0x19')]?_0xa813fc['options'][_0xbdca('0x1a')]===undefined?!![]:![]:!![],'where':_0xa813fc[_0xbdca('0x19')]?_0xa813fc['options'][_0xbdca('0x1b')]||null:null,'attributes':_0xa813fc[_0xbdca('0x19')]?_0xa813fc[_0xbdca('0x19')][_0xbdca('0x1c')]||null:null,'limit':_0xa813fc[_0xbdca('0x19')]?_0xa813fc[_0xbdca('0x19')]['limit']||null:null,'include':_0xa813fc[_0xbdca('0x19')]?_0xa813fc[_0xbdca('0x19')]['include']?_['map'](_0xa813fc[_0xbdca('0x19')][_0xbdca('0x1d')],function(_0x3fb260){return{'model':db[_0x3fb260[_0xbdca('0x1e')]],'as':_0x3fb260['as'],'attributes':_0x3fb260[_0xbdca('0x1c')],'include':_0x3fb260[_0xbdca('0x1d')]?_[_0xbdca('0x1f')](_0x3fb260[_0xbdca('0x1d')],function(_0x3b260c){return{'model':db[_0x3b260c[_0xbdca('0x1e')]],'as':_0x3b260c['as'],'attributes':_0x3b260c[_0xbdca('0x1c')],'include':_0x3b260c['include']?_['map'](_0x3b260c['include'],function(_0x4cdc60){return{'model':db[_0x4cdc60['model']],'as':_0x4cdc60['as'],'attributes':_0x4cdc60[_0xbdca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbdca('0xc')](function(_0x45113b){logger[_0xbdca('0xd')](_0xbdca('0x20'),_0xa813fc);logger[_0xbdca('0x10')]('GetFreshdeskAccount',_0xa813fc,JSON[_0xbdca('0x12')](_0x45113b));_0x1b98cc(_0x45113b);})[_0xbdca('0x17')](function(_0x4cc9c6){logger[_0xbdca('0x13')]('GetFreshdeskAccount',_0x4cc9c6[_0xbdca('0x15')],_0xa813fc);_0xb19a6(_0x90d3d[_0xbdca('0x13')](0x1f4,_0x4cc9c6[_0xbdca('0x15')]));});});};exports[_0xbdca('0x21')]=function(_0x47dbd2){var _0x230f32=this;return new Promise(function(_0x1998d8,_0x1e21c5){return db[_0xbdca('0x22')][_0xbdca('0x23')]({'raw':_0x47dbd2[_0xbdca('0x19')]?_0x47dbd2['options'][_0xbdca('0x1a')]===undefined?!![]:![]:!![],'where':_0x47dbd2['options']?_0x47dbd2[_0xbdca('0x19')][_0xbdca('0x1b')]||null:null,'attributes':_0x47dbd2[_0xbdca('0x19')]?_0x47dbd2[_0xbdca('0x19')][_0xbdca('0x1c')]||null:null,'include':_0x47dbd2[_0xbdca('0x19')]?_0x47dbd2[_0xbdca('0x19')][_0xbdca('0x1d')]?_['map'](_0x47dbd2['options'][_0xbdca('0x1d')],function(_0xe2b451){return{'model':db[_0xe2b451[_0xbdca('0x1e')]],'as':_0xe2b451['as'],'attributes':_0xe2b451['attributes'],'include':_0xe2b451[_0xbdca('0x1d')]?_[_0xbdca('0x1f')](_0xe2b451['include'],function(_0x51648c){return{'model':db[_0x51648c[_0xbdca('0x1e')]],'as':_0x51648c['as'],'attributes':_0x51648c[_0xbdca('0x1c')],'include':_0x51648c['include']?_[_0xbdca('0x1f')](_0x51648c[_0xbdca('0x1d')],function(_0x5a65a0){return{'model':db[_0x5a65a0[_0xbdca('0x1e')]],'as':_0x5a65a0['as'],'attributes':_0x5a65a0[_0xbdca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbdca('0xc')](function(_0x11e109){logger[_0xbdca('0xd')](_0xbdca('0x21'),_0x47dbd2);logger['debug'](_0xbdca('0x21'),_0x47dbd2,JSON[_0xbdca('0x12')](_0x11e109));_0x1998d8(_0x11e109);})[_0xbdca('0x17')](function(_0x3bf4d6){logger[_0xbdca('0x13')]('ShowFreshdeskAccount',_0x3bf4d6[_0xbdca('0x15')],_0x47dbd2);_0x1e21c5(_0x230f32[_0xbdca('0x13')](0x1f4,_0x3bf4d6[_0xbdca('0x15')]));});});}; \ No newline at end of file +var _0xbb6e=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','findAll','options','where','attributes','limit','include','model','map','GetFreshdeskAccount','catch','ShowFreshdeskAccount','FreshdeskAccount','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info'];(function(_0x15ec35,_0x5b9972){var _0x937cce=function(_0x59326b){while(--_0x59326b){_0x15ec35['push'](_0x15ec35['shift']());}};_0x937cce(++_0x5b9972);}(_0xbb6e,0x115));var _0xebb6=function(_0x28a45c,_0x5518be){_0x28a45c=_0x28a45c-0x0;var _0x2d6f58=_0xbb6e[_0x28a45c];return _0x2d6f58;};'use strict';var _=require(_0xebb6('0x0'));var util=require('util');var moment=require(_0xebb6('0x1'));var BPromise=require('bluebird');var rs=require(_0xebb6('0x2'));var fs=require('fs');var Redis=require(_0xebb6('0x3'));var db=require(_0xebb6('0x4'))['db'];var utils=require(_0xebb6('0x5'));var logger=require(_0xebb6('0x6'))(_0xebb6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xebb6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xac57fc,_0x22a947,_0x486ed1){return new BPromise(function(_0x496f2a,_0x18c68a){return client['request'](_0xac57fc,_0x486ed1)[_0xebb6('0x9')](function(_0x2249cb){logger[_0xebb6('0xa')](_0xebb6('0xb'),_0x22a947,_0xebb6('0xc'));logger[_0xebb6('0xd')](_0xebb6('0xe'),_0x22a947,_0xebb6('0xc'),JSON[_0xebb6('0xf')](_0x2249cb));if(_0x2249cb[_0xebb6('0x10')]){if(_0x2249cb[_0xebb6('0x10')][_0xebb6('0x11')]===0x1f4){logger[_0xebb6('0x10')](_0xebb6('0xb'),_0x22a947,_0x2249cb[_0xebb6('0x10')][_0xebb6('0x12')]);return _0x18c68a(_0x2249cb[_0xebb6('0x10')]['message']);}logger[_0xebb6('0x10')](_0xebb6('0xb'),_0x22a947,_0x2249cb[_0xebb6('0x10')][_0xebb6('0x12')]);return _0x496f2a(_0x2249cb['error'][_0xebb6('0x12')]);}else{logger[_0xebb6('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x22a947,_0xebb6('0xc'));_0x496f2a(_0x2249cb['result'][_0xebb6('0x12')]);}})['catch'](function(_0x544760){logger[_0xebb6('0x10')](_0xebb6('0xb'),_0x22a947,_0x544760);_0x18c68a(_0x544760);});});}exports['GetFreshdeskAccount']=function(_0x1d1735){var _0x528d64=this;return new Promise(function(_0x314df1,_0x2b57b4){return db['FreshdeskAccount'][_0xebb6('0x13')]({'raw':_0x1d1735[_0xebb6('0x14')]?_0x1d1735[_0xebb6('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x1d1735[_0xebb6('0x14')]?_0x1d1735['options'][_0xebb6('0x15')]||null:null,'attributes':_0x1d1735[_0xebb6('0x14')]?_0x1d1735['options'][_0xebb6('0x16')]||null:null,'limit':_0x1d1735[_0xebb6('0x14')]?_0x1d1735[_0xebb6('0x14')][_0xebb6('0x17')]||null:null,'include':_0x1d1735[_0xebb6('0x14')]?_0x1d1735['options'][_0xebb6('0x18')]?_['map'](_0x1d1735[_0xebb6('0x14')][_0xebb6('0x18')],function(_0x427c5d){return{'model':db[_0x427c5d[_0xebb6('0x19')]],'as':_0x427c5d['as'],'attributes':_0x427c5d[_0xebb6('0x16')],'include':_0x427c5d[_0xebb6('0x18')]?_[_0xebb6('0x1a')](_0x427c5d[_0xebb6('0x18')],function(_0x577a67){return{'model':db[_0x577a67[_0xebb6('0x19')]],'as':_0x577a67['as'],'attributes':_0x577a67[_0xebb6('0x16')],'include':_0x577a67['include']?_['map'](_0x577a67[_0xebb6('0x18')],function(_0x1c7a0e){return{'model':db[_0x1c7a0e[_0xebb6('0x19')]],'as':_0x1c7a0e['as'],'attributes':_0x1c7a0e['attributes']};}):[]};}):[]};}):[]:[]})[_0xebb6('0x9')](function(_0x4d40d1){logger[_0xebb6('0xa')](_0xebb6('0x1b'),_0x1d1735);logger['debug'](_0xebb6('0x1b'),_0x1d1735,JSON[_0xebb6('0xf')](_0x4d40d1));_0x314df1(_0x4d40d1);})[_0xebb6('0x1c')](function(_0x1aa5f0){logger[_0xebb6('0x10')](_0xebb6('0x1b'),_0x1aa5f0[_0xebb6('0x12')],_0x1d1735);_0x2b57b4(_0x528d64[_0xebb6('0x10')](0x1f4,_0x1aa5f0[_0xebb6('0x12')]));});});};exports[_0xebb6('0x1d')]=function(_0x12e9c9){var _0x20eb2b=this;return new Promise(function(_0x58e25e,_0x13cc2a){return db[_0xebb6('0x1e')]['find']({'raw':_0x12e9c9['options']?_0x12e9c9[_0xebb6('0x14')][_0xebb6('0x1f')]===undefined?!![]:![]:!![],'where':_0x12e9c9[_0xebb6('0x14')]?_0x12e9c9[_0xebb6('0x14')][_0xebb6('0x15')]||null:null,'attributes':_0x12e9c9['options']?_0x12e9c9['options'][_0xebb6('0x16')]||null:null,'include':_0x12e9c9[_0xebb6('0x14')]?_0x12e9c9[_0xebb6('0x14')][_0xebb6('0x18')]?_[_0xebb6('0x1a')](_0x12e9c9[_0xebb6('0x14')][_0xebb6('0x18')],function(_0x5c97de){return{'model':db[_0x5c97de[_0xebb6('0x19')]],'as':_0x5c97de['as'],'attributes':_0x5c97de['attributes'],'include':_0x5c97de[_0xebb6('0x18')]?_[_0xebb6('0x1a')](_0x5c97de['include'],function(_0x591021){return{'model':db[_0x591021[_0xebb6('0x19')]],'as':_0x591021['as'],'attributes':_0x591021[_0xebb6('0x16')],'include':_0x591021[_0xebb6('0x18')]?_[_0xebb6('0x1a')](_0x591021[_0xebb6('0x18')],function(_0x593244){return{'model':db[_0x593244[_0xebb6('0x19')]],'as':_0x593244['as'],'attributes':_0x593244['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3338c7){logger[_0xebb6('0xa')](_0xebb6('0x1d'),_0x12e9c9);logger[_0xebb6('0xd')](_0xebb6('0x1d'),_0x12e9c9,JSON[_0xebb6('0xf')](_0x3338c7));_0x58e25e(_0x3338c7);})[_0xebb6('0x1c')](function(_0x365ee6){logger[_0xebb6('0x10')]('ShowFreshdeskAccount',_0x365ee6['message'],_0x12e9c9);_0x13cc2a(_0x20eb2b['error'](0x1f4,_0x365ee6[_0xebb6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 377abd1..4e0e907 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 _0x8922=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x8922,0x158));var _0x2892=function(_0x4c85c0,_0x30262f){_0x4c85c0=_0x4c85c0-0x0;var _0x170238=_0x8922[_0x4c85c0];return _0x170238;};'use strict';var multer=require(_0x2892('0x0'));var util=require(_0x2892('0x1'));var path=require(_0x2892('0x2'));var timeout=require(_0x2892('0x3'));var express=require(_0x2892('0x4'));var router=express[_0x2892('0x5')]();var fs_extra=require(_0x2892('0x6'));var auth=require(_0x2892('0x7'));var interaction=require(_0x2892('0x8'));var config=require(_0x2892('0x9'));var controller=require(_0x2892('0xa'));router[_0x2892('0xb')]('/',auth[_0x2892('0xc')](),controller['index']);router[_0x2892('0xb')](_0x2892('0xd'),auth[_0x2892('0xc')](),controller[_0x2892('0xe')]);router[_0x2892('0xb')](_0x2892('0xf'),auth[_0x2892('0xc')](),controller[_0x2892('0x10')]);router[_0x2892('0xb')](_0x2892('0x11'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2892('0xb')](_0x2892('0x12'),auth['isAuthenticated'](),controller[_0x2892('0x13')]);router[_0x2892('0xb')](_0x2892('0x14'),auth[_0x2892('0xc')](),controller['getTags']);router[_0x2892('0x15')]('/',auth[_0x2892('0xc')](),controller[_0x2892('0x16')]);router[_0x2892('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2892('0x17')]);router[_0x2892('0x18')]('/:id',auth[_0x2892('0xc')](),controller[_0x2892('0x19')]);router[_0x2892('0x1a')](_0x2892('0xd'),auth[_0x2892('0xc')](),controller[_0x2892('0x1b')]);module[_0x2892('0x1c')]=router; \ No newline at end of file +var _0x001a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','/:id','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','put','destroy','exports','multer','util','path'];(function(_0x2b0170,_0x352041){var _0x4f56d7=function(_0x2b21b2){while(--_0x2b21b2){_0x2b0170['push'](_0x2b0170['shift']());}};_0x4f56d7(++_0x352041);}(_0x001a,0x189));var _0xa001=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0x001a[_0x492af5];return _0x59f529;};'use strict';var multer=require(_0xa001('0x0'));var util=require(_0xa001('0x1'));var path=require(_0xa001('0x2'));var timeout=require(_0xa001('0x3'));var express=require(_0xa001('0x4'));var router=express['Router']();var fs_extra=require(_0xa001('0x5'));var auth=require(_0xa001('0x6'));var interaction=require(_0xa001('0x7'));var config=require('../../config/environment');var controller=require(_0xa001('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa001('0x9')](_0xa001('0xa'),auth[_0xa001('0xb')](),controller['show']);router['get']('/:id/fields',auth[_0xa001('0xb')](),controller['getFields']);router['get'](_0xa001('0xc'),auth['isAuthenticated'](),controller[_0xa001('0xd')]);router['get']('/:id/descriptions',auth[_0xa001('0xb')](),controller[_0xa001('0xe')]);router[_0xa001('0x9')](_0xa001('0xf'),auth[_0xa001('0xb')](),controller[_0xa001('0x10')]);router[_0xa001('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa001('0xf'),auth[_0xa001('0xb')](),controller[_0xa001('0x12')]);router[_0xa001('0x13')](_0xa001('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa001('0xa'),auth['isAuthenticated'](),controller[_0xa001('0x14')]);module[_0xa001('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 0333994..e1f608a 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 _0x657a=['exports','STRING','sequelize'];(function(_0x5b09d4,_0x438d56){var _0x2d88d7=function(_0x45c207){while(--_0x45c207){_0x5b09d4['push'](_0x5b09d4['shift']());}};_0x2d88d7(++_0x438d56);}(_0x657a,0x188));var _0xa657=function(_0x503679,_0x1d99bf){_0x503679=_0x503679-0x0;var _0x2c6c2b=_0x657a[_0x503679];return _0x2c6c2b;};'use strict';var Sequelize=require(_0xa657('0x0'));module[_0xa657('0x1')]={'name':{'type':Sequelize[_0xa657('0x2')]},'description':{'type':Sequelize[_0xa657('0x2')]}}; \ No newline at end of file +var _0x8227=['exports','STRING'];(function(_0x4c5e5a,_0x58ade0){var _0x2f5b8d=function(_0x94dfac){while(--_0x94dfac){_0x4c5e5a['push'](_0x4c5e5a['shift']());}};_0x2f5b8d(++_0x58ade0);}(_0x8227,0x178));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7822('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7822('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 3c053e7..63705d8 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 _0x8dac=['keys','FreshdeskConfiguration','length','find','create','update','body','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','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','offset','limit','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','rows','catch','params'];(function(_0x31b017,_0x103067){var _0x2c327a=function(_0x4e21c6){while(--_0x4e21c6){_0x31b017['push'](_0x31b017['shift']());}};_0x2c327a(++_0x103067);}(_0x8dac,0x103));var _0xc8da=function(_0x4272d8,_0x3435d5){_0x4272d8=_0x4272d8-0x0;var _0x15f27c=_0x8dac[_0x4272d8];return _0x15f27c;};'use strict';var emlformat=require(_0xc8da('0x0'));var rimraf=require(_0xc8da('0x1'));var zipdir=require(_0xc8da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8da('0x3'));var moment=require('moment');var BPromise=require(_0xc8da('0x4'));var Mustache=require(_0xc8da('0x5'));var util=require('util');var path=require(_0xc8da('0x6'));var sox=require(_0xc8da('0x7'));var csv=require(_0xc8da('0x8'));var ejs=require(_0xc8da('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8da('0xa'));var squel=require('squel');var crypto=require(_0xc8da('0xb'));var jsforce=require(_0xc8da('0xc'));var deskjs=require(_0xc8da('0xd'));var toCsv=require(_0xc8da('0x8'));var querystring=require(_0xc8da('0xe'));var Papa=require(_0xc8da('0xf'));var Redis=require(_0xc8da('0x10'));var authService=require(_0xc8da('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc8da('0x12'));var hardwareService=require(_0xc8da('0x13'));var logger=require(_0xc8da('0x14'))(_0xc8da('0x15'));var utils=require(_0xc8da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc8da('0x17'));var db=require(_0xc8da('0x18'))['db'];function respondWithStatusCode(_0x1f44ab,_0x3dbe84){_0x3dbe84=_0x3dbe84||0xcc;return function(_0x4ea396){if(_0x4ea396){return _0x1f44ab[_0xc8da('0x19')](_0x3dbe84);}return _0x1f44ab[_0xc8da('0x1a')](_0x3dbe84)['end']();};}function respondWithResult(_0x1f2101,_0x465ded){_0x465ded=_0x465ded||0xc8;return function(_0x31e73f){if(_0x31e73f){return _0x1f2101[_0xc8da('0x1a')](_0x465ded)['json'](_0x31e73f);}};}function respondWithFilteredResult(_0x1f2468,_0x2af20b){return function(_0xa7fd4f){if(_0xa7fd4f){var _0x24fc5c=typeof _0x2af20b[_0xc8da('0x1b')]==='undefined'&&typeof _0x2af20b[_0xc8da('0x1c')]===_0xc8da('0x1d');var _0x5c9a1e=_0xa7fd4f[_0xc8da('0x1e')];var _0x4c2742=_0x24fc5c?0x0:_0x2af20b[_0xc8da('0x1b')];var _0x381bc5=_0x24fc5c?_0xa7fd4f[_0xc8da('0x1e')]:_0x2af20b[_0xc8da('0x1b')]+_0x2af20b[_0xc8da('0x1c')];var _0x377eab;if(_0x381bc5>=_0x5c9a1e){_0x381bc5=_0x5c9a1e;_0x377eab=0xc8;}else{_0x377eab=0xce;}_0x1f2468['status'](_0x377eab);return _0x1f2468[_0xc8da('0x1f')](_0xc8da('0x20'),_0x4c2742+'-'+_0x381bc5+'/'+_0x5c9a1e)['json'](_0xa7fd4f);}return null;};}function patchUpdates(_0x2d7476){return function(_0x4e1c93){try{jsonpatch['apply'](_0x4e1c93,_0x2d7476,!![]);}catch(_0x129957){return BPromise['reject'](_0x129957);}return _0x4e1c93[_0xc8da('0x21')]();};}function saveUpdates(_0x89a19f,_0x28a0f8){return function(_0x5af9d7){if(_0x5af9d7){return _0x5af9d7['update'](_0x89a19f)[_0xc8da('0x22')](function(_0x386b9f){return _0x386b9f;});}return null;};}function removeEntity(_0x253da8,_0x3a8dde){return function(_0x12d69f){if(_0x12d69f){return _0x12d69f[_0xc8da('0x23')]()['then'](function(){_0x253da8[_0xc8da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1f81,_0x9a4b1d){return function(_0x239562){if(!_0x239562){_0x2e1f81[_0xc8da('0x19')](0x194);}return _0x239562;};}function handleError(_0x2ab00c,_0x1e6e20){_0x1e6e20=_0x1e6e20||0x1f4;return function(_0x42af2f){logger[_0xc8da('0x24')](_0x42af2f[_0xc8da('0x25')]);if(_0x42af2f['name']){delete _0x42af2f[_0xc8da('0x26')];}_0x2ab00c[_0xc8da('0x1a')](_0x1e6e20)[_0xc8da('0x27')](_0x42af2f);};}exports[_0xc8da('0x28')]=function(_0x1871a5,_0x190120){var _0x2f0c05={},_0x484fb8={},_0x4e901d={'count':0x0,'rows':[]};var _0x37c52a=_[_0xc8da('0x29')](db['FreshdeskConfiguration'][_0xc8da('0x2a')],function(_0x48686f){return{'name':_0x48686f[_0xc8da('0x2b')],'type':_0x48686f[_0xc8da('0x2c')]['key']};});_0x484fb8[_0xc8da('0x2d')]=_[_0xc8da('0x29')](_0x37c52a,_0xc8da('0x26'));_0x484fb8[_0xc8da('0x2e')]=_['keys'](_0x1871a5[_0xc8da('0x2e')]);_0x484fb8['filters']=_['intersection'](_0x484fb8['model'],_0x484fb8[_0xc8da('0x2e')]);_0x2f0c05['attributes']=_[_0xc8da('0x2f')](_0x484fb8[_0xc8da('0x2d')],qs[_0xc8da('0x30')](_0x1871a5[_0xc8da('0x2e')]['fields']));_0x2f0c05[_0xc8da('0x31')]=_0x2f0c05['attributes']['length']?_0x2f0c05[_0xc8da('0x31')]:_0x484fb8[_0xc8da('0x2d')];if(!_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x32')](_0xc8da('0x33'))){_0x2f0c05[_0xc8da('0x1c')]=qs[_0xc8da('0x1c')](_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x1c')]);_0x2f0c05[_0xc8da('0x1b')]=qs['offset'](_0x1871a5['query'][_0xc8da('0x1b')]);}_0x2f0c05[_0xc8da('0x34')]=qs['sort'](_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x2f0c05[_0xc8da('0x36')]=qs[_0xc8da('0x37')](_['pick'](_0x1871a5[_0xc8da('0x2e')],_0x484fb8[_0xc8da('0x37')]),_0x37c52a);if(_0x1871a5['query']['filter']){_0x2f0c05[_0xc8da('0x36')]=_[_0xc8da('0x38')](_0x2f0c05[_0xc8da('0x36')],{'$or':_['map'](_0x37c52a,function(_0x10befe){if(_0x10befe[_0xc8da('0x2c')]!=='VIRTUAL'){var _0x60aeb9={};_0x60aeb9[_0x10befe[_0xc8da('0x26')]]={'$like':'%'+_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x39')]+'%'};return _0x60aeb9;}})});}_0x2f0c05=_[_0xc8da('0x38')]({},_0x2f0c05,_0x1871a5[_0xc8da('0x3a')]);var _0x49545f={'where':_0x2f0c05[_0xc8da('0x36')]};return db['FreshdeskConfiguration'][_0xc8da('0x1e')](_0x49545f)[_0xc8da('0x22')](function(_0x3b422){_0x4e901d[_0xc8da('0x1e')]=_0x3b422;if(_0x1871a5[_0xc8da('0x2e')][_0xc8da('0x3b')]){_0x2f0c05[_0xc8da('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xc8da('0x3d')](_0x2f0c05);})[_0xc8da('0x22')](function(_0x4f3a36){_0x4e901d[_0xc8da('0x3e')]=_0x4f3a36;return _0x4e901d;})['then'](respondWithFilteredResult(_0x190120,_0x2f0c05))[_0xc8da('0x3f')](handleError(_0x190120,null));};exports['show']=function(_0x4e4cc6,_0x30be00){var _0x817518={'raw':![],'where':{'id':_0x4e4cc6[_0xc8da('0x40')]['id']}},_0x48fa2e={};_0x48fa2e['model']=_[_0xc8da('0x41')](db[_0xc8da('0x42')][_0xc8da('0x2a')]);_0x48fa2e[_0xc8da('0x2e')]=_[_0xc8da('0x41')](_0x4e4cc6[_0xc8da('0x2e')]);_0x48fa2e[_0xc8da('0x37')]=_[_0xc8da('0x2f')](_0x48fa2e[_0xc8da('0x2d')],_0x48fa2e[_0xc8da('0x2e')]);_0x817518[_0xc8da('0x31')]=_[_0xc8da('0x2f')](_0x48fa2e[_0xc8da('0x2d')],qs[_0xc8da('0x30')](_0x4e4cc6[_0xc8da('0x2e')][_0xc8da('0x30')]));_0x817518[_0xc8da('0x31')]=_0x817518[_0xc8da('0x31')][_0xc8da('0x43')]?_0x817518[_0xc8da('0x31')]:_0x48fa2e[_0xc8da('0x2d')];if(_0x4e4cc6[_0xc8da('0x2e')][_0xc8da('0x3b')]){_0x817518[_0xc8da('0x3c')]=[{'all':!![]}];}_0x817518=_[_0xc8da('0x38')]({},_0x817518,_0x4e4cc6['options']);return db[_0xc8da('0x42')][_0xc8da('0x44')](_0x817518)[_0xc8da('0x22')](handleEntityNotFound(_0x30be00,null))['then'](respondWithResult(_0x30be00,null))['catch'](handleError(_0x30be00,null));};exports[_0xc8da('0x45')]=function(_0x3e9fba,_0xb2776b){return db[_0xc8da('0x42')][_0xc8da('0x45')](_0x3e9fba['body'],{})['then'](respondWithResult(_0xb2776b,0xc9))['catch'](handleError(_0xb2776b,null));};exports[_0xc8da('0x46')]=function(_0x1e1457,_0x3abe8f){if(_0x1e1457['body']['id']){delete _0x1e1457[_0xc8da('0x47')]['id'];}return db[_0xc8da('0x42')][_0xc8da('0x44')]({'where':{'id':_0x1e1457[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x3abe8f,null))[_0xc8da('0x22')](saveUpdates(_0x1e1457[_0xc8da('0x47')],null))[_0xc8da('0x22')](respondWithResult(_0x3abe8f,null))[_0xc8da('0x3f')](handleError(_0x3abe8f,null));};exports[_0xc8da('0x23')]=function(_0x1de509,_0x4edde6){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1de509[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x4edde6,null))['then'](removeEntity(_0x4edde6,null))[_0xc8da('0x3f')](handleError(_0x4edde6,null));};exports[_0xc8da('0x48')]=function(_0x231e97,_0x227980,_0x5ac56f){var _0x589389={};var _0x385461={};var _0x56c081;var _0x31d165;return db[_0xc8da('0x42')][_0xc8da('0x49')]({'where':{'id':_0x231e97[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x227980,null))[_0xc8da('0x22')](function(_0x496c64){if(_0x496c64){_0x56c081=_0x496c64;_0x385461[_0xc8da('0x2d')]=_[_0xc8da('0x41')](db[_0xc8da('0x4a')][_0xc8da('0x2a')]);_0x385461[_0xc8da('0x2e')]=_['keys'](_0x231e97['query']);_0x385461['filters']=_['intersection'](_0x385461['model'],_0x385461[_0xc8da('0x2e')]);_0x589389['attributes']=_[_0xc8da('0x2f')](_0x385461[_0xc8da('0x2d')],qs['fields'](_0x231e97['query']['fields']));_0x589389[_0xc8da('0x31')]=_0x589389['attributes'][_0xc8da('0x43')]?_0x589389[_0xc8da('0x31')]:_0x385461[_0xc8da('0x2d')];_0x589389[_0xc8da('0x34')]=qs['sort'](_0x231e97[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x589389[_0xc8da('0x36')]=qs['filters'](_['pick'](_0x231e97['query'],_0x385461[_0xc8da('0x37')]));if(_0x231e97[_0xc8da('0x2e')][_0xc8da('0x39')]){_0x589389[_0xc8da('0x36')]=_[_0xc8da('0x38')](_0x589389[_0xc8da('0x36')],{'$or':_[_0xc8da('0x29')](_0x589389['attributes'],function(_0x1d1cbd){var _0x36e609={};_0x36e609[_0x1d1cbd]={'$like':'%'+_0x231e97['query']['filter']+'%'};return _0x36e609;})});}_0x589389=_['merge']({},_0x589389,_0x231e97['options']);return _0x56c081['getFields'](_0x589389);}})[_0xc8da('0x22')](function(_0x5bd23c){if(_0x5bd23c){_0x31d165=_0x5bd23c[_0xc8da('0x43')];if(!_0x231e97[_0xc8da('0x2e')][_0xc8da('0x32')](_0xc8da('0x33'))){_0x589389[_0xc8da('0x1c')]=qs[_0xc8da('0x1c')](_0x231e97[_0xc8da('0x2e')][_0xc8da('0x1c')]);_0x589389[_0xc8da('0x1b')]=qs[_0xc8da('0x1b')](_0x231e97['query'][_0xc8da('0x1b')]);}return _0x56c081['getFields'](_0x589389);}})['then'](function(_0x19deb){if(_0x19deb){return _0x19deb?{'count':_0x31d165,'rows':_0x19deb}:null;}})[_0xc8da('0x22')](respondWithResult(_0x227980,null))['catch'](handleError(_0x227980,null));};exports['getSubjects']=function(_0x24a888,_0x5314f3,_0x147d9f){var _0x5a46d0={};var _0x423c0e={};var _0x353c60;var _0x5a88a3;return db['FreshdeskConfiguration'][_0xc8da('0x49')]({'where':{'id':_0x24a888[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x5314f3,null))[_0xc8da('0x22')](function(_0x8a25be){if(_0x8a25be){_0x353c60=_0x8a25be;_0x423c0e[_0xc8da('0x2d')]=_[_0xc8da('0x41')](db[_0xc8da('0x4a')]['rawAttributes']);_0x423c0e[_0xc8da('0x2e')]=_[_0xc8da('0x41')](_0x24a888[_0xc8da('0x2e')]);_0x423c0e['filters']=_[_0xc8da('0x2f')](_0x423c0e[_0xc8da('0x2d')],_0x423c0e['query']);_0x5a46d0[_0xc8da('0x31')]=_[_0xc8da('0x2f')](_0x423c0e[_0xc8da('0x2d')],qs[_0xc8da('0x30')](_0x24a888['query'][_0xc8da('0x30')]));_0x5a46d0[_0xc8da('0x31')]=_0x5a46d0[_0xc8da('0x31')][_0xc8da('0x43')]?_0x5a46d0[_0xc8da('0x31')]:_0x423c0e[_0xc8da('0x2d')];_0x5a46d0[_0xc8da('0x34')]=qs['sort'](_0x24a888[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x5a46d0[_0xc8da('0x36')]=qs[_0xc8da('0x37')](_[_0xc8da('0x4b')](_0x24a888[_0xc8da('0x2e')],_0x423c0e[_0xc8da('0x37')]));if(_0x24a888[_0xc8da('0x2e')]['filter']){_0x5a46d0['where']=_[_0xc8da('0x38')](_0x5a46d0[_0xc8da('0x36')],{'$or':_[_0xc8da('0x29')](_0x5a46d0[_0xc8da('0x31')],function(_0xb60dda){var _0x65c89d={};_0x65c89d[_0xb60dda]={'$like':'%'+_0x24a888[_0xc8da('0x2e')][_0xc8da('0x39')]+'%'};return _0x65c89d;})});}_0x5a46d0=_[_0xc8da('0x38')]({},_0x5a46d0,_0x24a888[_0xc8da('0x3a')]);return _0x353c60[_0xc8da('0x4c')](_0x5a46d0);}})[_0xc8da('0x22')](function(_0x1e5b84){if(_0x1e5b84){_0x5a88a3=_0x1e5b84[_0xc8da('0x43')];if(!_0x24a888['query'][_0xc8da('0x32')](_0xc8da('0x33'))){_0x5a46d0[_0xc8da('0x1c')]=qs[_0xc8da('0x1c')](_0x24a888[_0xc8da('0x2e')]['limit']);_0x5a46d0[_0xc8da('0x1b')]=qs[_0xc8da('0x1b')](_0x24a888['query'][_0xc8da('0x1b')]);}return _0x353c60[_0xc8da('0x4c')](_0x5a46d0);}})[_0xc8da('0x22')](function(_0x4a00d4){if(_0x4a00d4){return _0x4a00d4?{'count':_0x5a88a3,'rows':_0x4a00d4}:null;}})[_0xc8da('0x22')](respondWithResult(_0x5314f3,null))[_0xc8da('0x3f')](handleError(_0x5314f3,null));};exports[_0xc8da('0x4d')]=function(_0x23a878,_0xa0a9e0,_0x3cc6e4){var _0x40707f={};var _0x51be4d={};var _0x27afb0;var _0x33f19b;return db[_0xc8da('0x42')][_0xc8da('0x49')]({'where':{'id':_0x23a878[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0xa0a9e0,null))[_0xc8da('0x22')](function(_0x5a4753){if(_0x5a4753){_0x27afb0=_0x5a4753;_0x51be4d['model']=_[_0xc8da('0x41')](db[_0xc8da('0x4a')][_0xc8da('0x2a')]);_0x51be4d[_0xc8da('0x2e')]=_[_0xc8da('0x41')](_0x23a878[_0xc8da('0x2e')]);_0x51be4d['filters']=_[_0xc8da('0x2f')](_0x51be4d[_0xc8da('0x2d')],_0x51be4d[_0xc8da('0x2e')]);_0x40707f['attributes']=_[_0xc8da('0x2f')](_0x51be4d[_0xc8da('0x2d')],qs['fields'](_0x23a878[_0xc8da('0x2e')]['fields']));_0x40707f[_0xc8da('0x31')]=_0x40707f['attributes'][_0xc8da('0x43')]?_0x40707f[_0xc8da('0x31')]:_0x51be4d['model'];_0x40707f['order']=qs[_0xc8da('0x35')](_0x23a878[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x40707f['where']=qs[_0xc8da('0x37')](_[_0xc8da('0x4b')](_0x23a878[_0xc8da('0x2e')],_0x51be4d[_0xc8da('0x37')]));if(_0x23a878[_0xc8da('0x2e')]['filter']){_0x40707f[_0xc8da('0x36')]=_[_0xc8da('0x38')](_0x40707f[_0xc8da('0x36')],{'$or':_[_0xc8da('0x29')](_0x40707f[_0xc8da('0x31')],function(_0x16fd34){var _0x1f5ff4={};_0x1f5ff4[_0x16fd34]={'$like':'%'+_0x23a878[_0xc8da('0x2e')][_0xc8da('0x39')]+'%'};return _0x1f5ff4;})});}_0x40707f=_[_0xc8da('0x38')]({},_0x40707f,_0x23a878[_0xc8da('0x3a')]);return _0x27afb0[_0xc8da('0x4d')](_0x40707f);}})[_0xc8da('0x22')](function(_0x4f300e){if(_0x4f300e){_0x33f19b=_0x4f300e[_0xc8da('0x43')];if(!_0x23a878['query'][_0xc8da('0x32')]('nolimit')){_0x40707f[_0xc8da('0x1c')]=qs[_0xc8da('0x1c')](_0x23a878[_0xc8da('0x2e')][_0xc8da('0x1c')]);_0x40707f['offset']=qs[_0xc8da('0x1b')](_0x23a878[_0xc8da('0x2e')][_0xc8da('0x1b')]);}return _0x27afb0[_0xc8da('0x4d')](_0x40707f);}})[_0xc8da('0x22')](function(_0x5e13bb){if(_0x5e13bb){return _0x5e13bb?{'count':_0x33f19b,'rows':_0x5e13bb}:null;}})[_0xc8da('0x22')](respondWithResult(_0xa0a9e0,null))[_0xc8da('0x3f')](handleError(_0xa0a9e0,null));};exports['getTags']=function(_0x166c8c,_0x21fa01,_0x5128f6){var _0x37f698={};var _0x484c41={};var _0x36c55f;var _0x1ca3cb;return db['FreshdeskConfiguration'][_0xc8da('0x49')]({'where':{'id':_0x166c8c[_0xc8da('0x40')]['id']}})['then'](handleEntityNotFound(_0x21fa01,null))['then'](function(_0x4950d0){if(_0x4950d0){_0x36c55f=_0x4950d0;_0x484c41[_0xc8da('0x2d')]=_['keys'](db['Tag'][_0xc8da('0x2a')]);_0x484c41[_0xc8da('0x2e')]=_[_0xc8da('0x41')](_0x166c8c['query']);_0x484c41[_0xc8da('0x37')]=_[_0xc8da('0x2f')](_0x484c41[_0xc8da('0x2d')],_0x484c41['query']);_0x37f698['attributes']=_[_0xc8da('0x2f')](_0x484c41[_0xc8da('0x2d')],qs[_0xc8da('0x30')](_0x166c8c[_0xc8da('0x2e')][_0xc8da('0x30')]));_0x37f698['attributes']=_0x37f698[_0xc8da('0x31')][_0xc8da('0x43')]?_0x37f698[_0xc8da('0x31')]:_0x484c41[_0xc8da('0x2d')];_0x37f698[_0xc8da('0x34')]=qs['sort'](_0x166c8c[_0xc8da('0x2e')][_0xc8da('0x35')]);_0x37f698['where']=qs[_0xc8da('0x37')](_[_0xc8da('0x4b')](_0x166c8c[_0xc8da('0x2e')],_0x484c41[_0xc8da('0x37')]));if(_0x166c8c['query'][_0xc8da('0x39')]){_0x37f698[_0xc8da('0x36')]=_[_0xc8da('0x38')](_0x37f698[_0xc8da('0x36')],{'$or':_[_0xc8da('0x29')](_0x37f698['attributes'],function(_0x18d72a){var _0xfd2a24={};_0xfd2a24[_0x18d72a]={'$like':'%'+_0x166c8c['query'][_0xc8da('0x39')]+'%'};return _0xfd2a24;})});}_0x37f698=_[_0xc8da('0x38')]({},_0x37f698,_0x166c8c[_0xc8da('0x3a')]);return _0x36c55f['getTags'](_0x37f698);}})[_0xc8da('0x22')](function(_0x5d38c4){if(_0x5d38c4){_0x1ca3cb=_0x5d38c4[_0xc8da('0x43')];if(!_0x166c8c['query'][_0xc8da('0x32')](_0xc8da('0x33'))){_0x37f698[_0xc8da('0x1c')]=qs['limit'](_0x166c8c[_0xc8da('0x2e')][_0xc8da('0x1c')]);_0x37f698[_0xc8da('0x1b')]=qs[_0xc8da('0x1b')](_0x166c8c[_0xc8da('0x2e')][_0xc8da('0x1b')]);}return _0x36c55f[_0xc8da('0x4e')](_0x37f698);}})[_0xc8da('0x22')](function(_0xf14f99){if(_0xf14f99){return _0xf14f99?{'count':_0x1ca3cb,'rows':_0xf14f99}:null;}})[_0xc8da('0x22')](respondWithResult(_0x21fa01,null))['catch'](handleError(_0x21fa01,null));};exports['setTags']=function(_0x59765a,_0x432e64,_0x7d177f){if(_0x59765a[_0xc8da('0x47')]['id']){delete _0x59765a['body']['id'];}return db[_0xc8da('0x42')][_0xc8da('0x49')]({'where':{'id':_0x59765a[_0xc8da('0x40')]['id']}})[_0xc8da('0x22')](handleEntityNotFound(_0x432e64,null))[_0xc8da('0x22')](function(_0x5e6dac){if(_0x5e6dac){return _0x5e6dac[_0xc8da('0x4f')](_0x59765a[_0xc8da('0x47')][_0xc8da('0x50')]||[]);}return null;})[_0xc8da('0x22')](respondWithResult(_0x432e64,null))[_0xc8da('0x3f')](handleError(_0x432e64,null));}; \ No newline at end of file +var _0x24f1=['type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','findAll','rows','catch','show','includeAll','include','find','create','getFields','params','FreshdeskField','options','findOne','getSubjects','getDescriptions','getTags','setTags','body','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName'];(function(_0x3ccf3e,_0x5baeec){var _0x515330=function(_0x48aae9){while(--_0x48aae9){_0x3ccf3e['push'](_0x3ccf3e['shift']());}};_0x515330(++_0x5baeec);}(_0x24f1,0xcd));var _0x124f=function(_0x1dfd6a,_0x43e2b8){_0x1dfd6a=_0x1dfd6a-0x0;var _0x41fe5e=_0x24f1[_0x1dfd6a];return _0x41fe5e;};'use strict';var emlformat=require(_0x124f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x124f('0x1'));var jsonpatch=require(_0x124f('0x2'));var rp=require(_0x124f('0x3'));var moment=require(_0x124f('0x4'));var BPromise=require(_0x124f('0x5'));var Mustache=require(_0x124f('0x6'));var util=require(_0x124f('0x7'));var path=require(_0x124f('0x8'));var sox=require(_0x124f('0x9'));var csv=require(_0x124f('0xa'));var ejs=require(_0x124f('0xb'));var fs=require('fs');var fs_extra=require(_0x124f('0xc'));var _=require(_0x124f('0xd'));var squel=require(_0x124f('0xe'));var crypto=require('crypto');var jsforce=require(_0x124f('0xf'));var deskjs=require(_0x124f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x124f('0x11'));var Redis=require('ioredis');var authService=require(_0x124f('0x12'));var qs=require(_0x124f('0x13'));var as=require(_0x124f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x124f('0x15'))('api');var utils=require(_0x124f('0x16'));var config=require(_0x124f('0x17'));var licenseUtil=require(_0x124f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5231e9,_0x12fbdf){_0x12fbdf=_0x12fbdf||0xcc;return function(_0x8d25cb){if(_0x8d25cb){return _0x5231e9[_0x124f('0x19')](_0x12fbdf);}return _0x5231e9[_0x124f('0x1a')](_0x12fbdf)[_0x124f('0x1b')]();};}function respondWithResult(_0x55af66,_0x278f7e){_0x278f7e=_0x278f7e||0xc8;return function(_0x569f1f){if(_0x569f1f){return _0x55af66[_0x124f('0x1a')](_0x278f7e)['json'](_0x569f1f);}};}function respondWithFilteredResult(_0x28f494,_0xb6b4c){return function(_0x3d52f7){if(_0x3d52f7){var _0x5c1eb9=typeof _0xb6b4c[_0x124f('0x1c')]===_0x124f('0x1d')&&typeof _0xb6b4c[_0x124f('0x1e')]===_0x124f('0x1d');var _0x218a61=_0x3d52f7['count'];var _0x169589=_0x5c1eb9?0x0:_0xb6b4c[_0x124f('0x1c')];var _0xdd8858=_0x5c1eb9?_0x3d52f7[_0x124f('0x1f')]:_0xb6b4c[_0x124f('0x1c')]+_0xb6b4c[_0x124f('0x1e')];var _0x2e3c1f;if(_0xdd8858>=_0x218a61){_0xdd8858=_0x218a61;_0x2e3c1f=0xc8;}else{_0x2e3c1f=0xce;}_0x28f494[_0x124f('0x1a')](_0x2e3c1f);return _0x28f494[_0x124f('0x20')](_0x124f('0x21'),_0x169589+'-'+_0xdd8858+'/'+_0x218a61)[_0x124f('0x22')](_0x3d52f7);}return null;};}function patchUpdates(_0x24c84c){return function(_0x210784){try{jsonpatch[_0x124f('0x23')](_0x210784,_0x24c84c,!![]);}catch(_0x20d00b){return BPromise[_0x124f('0x24')](_0x20d00b);}return _0x210784['save']();};}function saveUpdates(_0x39c9bd,_0x5c778f){return function(_0x45f9c6){if(_0x45f9c6){return _0x45f9c6[_0x124f('0x25')](_0x39c9bd)[_0x124f('0x26')](function(_0x391e93){return _0x391e93;});}return null;};}function removeEntity(_0x262c0a,_0x1f5841){return function(_0x1480cd){if(_0x1480cd){return _0x1480cd[_0x124f('0x27')]()[_0x124f('0x26')](function(){_0x262c0a[_0x124f('0x1a')](0xcc)[_0x124f('0x1b')]();});}};}function handleEntityNotFound(_0x28d4a0,_0x1c2045){return function(_0x2dc2c7){if(!_0x2dc2c7){_0x28d4a0[_0x124f('0x19')](0x194);}return _0x2dc2c7;};}function handleError(_0x1edf2b,_0x47f6de){_0x47f6de=_0x47f6de||0x1f4;return function(_0x444586){logger[_0x124f('0x28')](_0x444586['stack']);if(_0x444586[_0x124f('0x29')]){delete _0x444586[_0x124f('0x29')];}_0x1edf2b[_0x124f('0x1a')](_0x47f6de)[_0x124f('0x2a')](_0x444586);};}exports['index']=function(_0x4b505d,_0xc07f52){var _0x4a63c5={},_0x44dae9={},_0x43fd4a={'count':0x0,'rows':[]};var _0x6d37d4=_[_0x124f('0x2b')](db[_0x124f('0x2c')][_0x124f('0x2d')],function(_0x2b2c59){return{'name':_0x2b2c59[_0x124f('0x2e')],'type':_0x2b2c59[_0x124f('0x2f')]['key']};});_0x44dae9[_0x124f('0x30')]=_[_0x124f('0x2b')](_0x6d37d4,'name');_0x44dae9['query']=_[_0x124f('0x31')](_0x4b505d[_0x124f('0x32')]);_0x44dae9[_0x124f('0x33')]=_[_0x124f('0x34')](_0x44dae9['model'],_0x44dae9[_0x124f('0x32')]);_0x4a63c5[_0x124f('0x35')]=_[_0x124f('0x34')](_0x44dae9['model'],qs[_0x124f('0x36')](_0x4b505d['query'][_0x124f('0x36')]));_0x4a63c5[_0x124f('0x35')]=_0x4a63c5['attributes'][_0x124f('0x37')]?_0x4a63c5[_0x124f('0x35')]:_0x44dae9[_0x124f('0x30')];if(!_0x4b505d[_0x124f('0x32')][_0x124f('0x38')](_0x124f('0x39'))){_0x4a63c5[_0x124f('0x1e')]=qs[_0x124f('0x1e')](_0x4b505d[_0x124f('0x32')][_0x124f('0x1e')]);_0x4a63c5[_0x124f('0x1c')]=qs[_0x124f('0x1c')](_0x4b505d[_0x124f('0x32')]['offset']);}_0x4a63c5[_0x124f('0x3a')]=qs[_0x124f('0x3b')](_0x4b505d[_0x124f('0x32')][_0x124f('0x3b')]);_0x4a63c5['where']=qs[_0x124f('0x33')](_[_0x124f('0x3c')](_0x4b505d['query'],_0x44dae9[_0x124f('0x33')]),_0x6d37d4);if(_0x4b505d[_0x124f('0x32')][_0x124f('0x3d')]){_0x4a63c5[_0x124f('0x3e')]=_['merge'](_0x4a63c5[_0x124f('0x3e')],{'$or':_[_0x124f('0x2b')](_0x6d37d4,function(_0x47e89d){if(_0x47e89d[_0x124f('0x2f')]!==_0x124f('0x3f')){var _0x735d56={};_0x735d56[_0x47e89d['name']]={'$like':'%'+_0x4b505d['query'][_0x124f('0x3d')]+'%'};return _0x735d56;}})});}_0x4a63c5=_[_0x124f('0x40')]({},_0x4a63c5,_0x4b505d['options']);var _0x2afd7f={'where':_0x4a63c5[_0x124f('0x3e')]};return db[_0x124f('0x2c')][_0x124f('0x1f')](_0x2afd7f)[_0x124f('0x26')](function(_0x3c896c){_0x43fd4a[_0x124f('0x1f')]=_0x3c896c;if(_0x4b505d[_0x124f('0x32')]['includeAll']){_0x4a63c5['include']=[{'all':!![]}];}return db[_0x124f('0x2c')][_0x124f('0x41')](_0x4a63c5);})[_0x124f('0x26')](function(_0x2e26b3){_0x43fd4a[_0x124f('0x42')]=_0x2e26b3;return _0x43fd4a;})[_0x124f('0x26')](respondWithFilteredResult(_0xc07f52,_0x4a63c5))[_0x124f('0x43')](handleError(_0xc07f52,null));};exports[_0x124f('0x44')]=function(_0x372a82,_0x521ddd){var _0x259834={'raw':![],'where':{'id':_0x372a82['params']['id']}},_0x41de53={};_0x41de53[_0x124f('0x30')]=_[_0x124f('0x31')](db[_0x124f('0x2c')][_0x124f('0x2d')]);_0x41de53['query']=_[_0x124f('0x31')](_0x372a82[_0x124f('0x32')]);_0x41de53[_0x124f('0x33')]=_[_0x124f('0x34')](_0x41de53[_0x124f('0x30')],_0x41de53[_0x124f('0x32')]);_0x259834['attributes']=_['intersection'](_0x41de53['model'],qs[_0x124f('0x36')](_0x372a82[_0x124f('0x32')]['fields']));_0x259834[_0x124f('0x35')]=_0x259834[_0x124f('0x35')][_0x124f('0x37')]?_0x259834[_0x124f('0x35')]:_0x41de53[_0x124f('0x30')];if(_0x372a82[_0x124f('0x32')][_0x124f('0x45')]){_0x259834[_0x124f('0x46')]=[{'all':!![]}];}_0x259834=_[_0x124f('0x40')]({},_0x259834,_0x372a82['options']);return db['FreshdeskConfiguration'][_0x124f('0x47')](_0x259834)[_0x124f('0x26')](handleEntityNotFound(_0x521ddd,null))['then'](respondWithResult(_0x521ddd,null))[_0x124f('0x43')](handleError(_0x521ddd,null));};exports[_0x124f('0x48')]=function(_0x40aac1,_0x4cd2d1){return db[_0x124f('0x2c')][_0x124f('0x48')](_0x40aac1['body'],{})['then'](respondWithResult(_0x4cd2d1,0xc9))['catch'](handleError(_0x4cd2d1,null));};exports['update']=function(_0x416a0b,_0x29ac3b){if(_0x416a0b['body']['id']){delete _0x416a0b['body']['id'];}return db[_0x124f('0x2c')][_0x124f('0x47')]({'where':{'id':_0x416a0b['params']['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x29ac3b,null))[_0x124f('0x26')](saveUpdates(_0x416a0b['body'],null))[_0x124f('0x26')](respondWithResult(_0x29ac3b,null))[_0x124f('0x43')](handleError(_0x29ac3b,null));};exports[_0x124f('0x27')]=function(_0x7a7ac8,_0x44e7f3){return db[_0x124f('0x2c')][_0x124f('0x47')]({'where':{'id':_0x7a7ac8['params']['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x44e7f3,null))[_0x124f('0x26')](removeEntity(_0x44e7f3,null))[_0x124f('0x43')](handleError(_0x44e7f3,null));};exports[_0x124f('0x49')]=function(_0x3a587a,_0x26c04e,_0x164fe8){var _0x1d00bb={};var _0x2469e0={};var _0x3ffc65;var _0x274f96;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3a587a[_0x124f('0x4a')]['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x26c04e,null))[_0x124f('0x26')](function(_0x13b510){if(_0x13b510){_0x3ffc65=_0x13b510;_0x2469e0[_0x124f('0x30')]=_[_0x124f('0x31')](db[_0x124f('0x4b')][_0x124f('0x2d')]);_0x2469e0[_0x124f('0x32')]=_[_0x124f('0x31')](_0x3a587a[_0x124f('0x32')]);_0x2469e0['filters']=_[_0x124f('0x34')](_0x2469e0[_0x124f('0x30')],_0x2469e0[_0x124f('0x32')]);_0x1d00bb[_0x124f('0x35')]=_[_0x124f('0x34')](_0x2469e0[_0x124f('0x30')],qs[_0x124f('0x36')](_0x3a587a[_0x124f('0x32')][_0x124f('0x36')]));_0x1d00bb[_0x124f('0x35')]=_0x1d00bb['attributes'][_0x124f('0x37')]?_0x1d00bb[_0x124f('0x35')]:_0x2469e0['model'];_0x1d00bb[_0x124f('0x3a')]=qs['sort'](_0x3a587a['query'][_0x124f('0x3b')]);_0x1d00bb[_0x124f('0x3e')]=qs['filters'](_[_0x124f('0x3c')](_0x3a587a[_0x124f('0x32')],_0x2469e0['filters']));if(_0x3a587a[_0x124f('0x32')]['filter']){_0x1d00bb[_0x124f('0x3e')]=_[_0x124f('0x40')](_0x1d00bb[_0x124f('0x3e')],{'$or':_['map'](_0x1d00bb[_0x124f('0x35')],function(_0x2dc322){var _0x689675={};_0x689675[_0x2dc322]={'$like':'%'+_0x3a587a['query'][_0x124f('0x3d')]+'%'};return _0x689675;})});}_0x1d00bb=_[_0x124f('0x40')]({},_0x1d00bb,_0x3a587a[_0x124f('0x4c')]);return _0x3ffc65['getFields'](_0x1d00bb);}})[_0x124f('0x26')](function(_0x57a1d0){if(_0x57a1d0){_0x274f96=_0x57a1d0[_0x124f('0x37')];if(!_0x3a587a[_0x124f('0x32')]['hasOwnProperty'](_0x124f('0x39'))){_0x1d00bb[_0x124f('0x1e')]=qs['limit'](_0x3a587a[_0x124f('0x32')][_0x124f('0x1e')]);_0x1d00bb['offset']=qs['offset'](_0x3a587a[_0x124f('0x32')][_0x124f('0x1c')]);}return _0x3ffc65[_0x124f('0x49')](_0x1d00bb);}})[_0x124f('0x26')](function(_0x35aeda){if(_0x35aeda){return _0x35aeda?{'count':_0x274f96,'rows':_0x35aeda}:null;}})[_0x124f('0x26')](respondWithResult(_0x26c04e,null))['catch'](handleError(_0x26c04e,null));};exports['getSubjects']=function(_0x16a16f,_0x2b04d8,_0x4900c7){var _0x10a572={};var _0x120aa7={};var _0x231ca9;var _0x420f91;return db[_0x124f('0x2c')][_0x124f('0x4d')]({'where':{'id':_0x16a16f[_0x124f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b04d8,null))[_0x124f('0x26')](function(_0x4a162a){if(_0x4a162a){_0x231ca9=_0x4a162a;_0x120aa7[_0x124f('0x30')]=_[_0x124f('0x31')](db[_0x124f('0x4b')][_0x124f('0x2d')]);_0x120aa7['query']=_[_0x124f('0x31')](_0x16a16f[_0x124f('0x32')]);_0x120aa7[_0x124f('0x33')]=_['intersection'](_0x120aa7[_0x124f('0x30')],_0x120aa7[_0x124f('0x32')]);_0x10a572['attributes']=_[_0x124f('0x34')](_0x120aa7[_0x124f('0x30')],qs[_0x124f('0x36')](_0x16a16f[_0x124f('0x32')][_0x124f('0x36')]));_0x10a572[_0x124f('0x35')]=_0x10a572[_0x124f('0x35')][_0x124f('0x37')]?_0x10a572[_0x124f('0x35')]:_0x120aa7['model'];_0x10a572[_0x124f('0x3a')]=qs[_0x124f('0x3b')](_0x16a16f[_0x124f('0x32')][_0x124f('0x3b')]);_0x10a572[_0x124f('0x3e')]=qs['filters'](_['pick'](_0x16a16f['query'],_0x120aa7[_0x124f('0x33')]));if(_0x16a16f[_0x124f('0x32')][_0x124f('0x3d')]){_0x10a572[_0x124f('0x3e')]=_['merge'](_0x10a572[_0x124f('0x3e')],{'$or':_[_0x124f('0x2b')](_0x10a572['attributes'],function(_0x2da015){var _0x100d76={};_0x100d76[_0x2da015]={'$like':'%'+_0x16a16f[_0x124f('0x32')]['filter']+'%'};return _0x100d76;})});}_0x10a572=_['merge']({},_0x10a572,_0x16a16f['options']);return _0x231ca9[_0x124f('0x4e')](_0x10a572);}})[_0x124f('0x26')](function(_0x4699de){if(_0x4699de){_0x420f91=_0x4699de[_0x124f('0x37')];if(!_0x16a16f[_0x124f('0x32')]['hasOwnProperty'](_0x124f('0x39'))){_0x10a572['limit']=qs[_0x124f('0x1e')](_0x16a16f[_0x124f('0x32')][_0x124f('0x1e')]);_0x10a572[_0x124f('0x1c')]=qs['offset'](_0x16a16f[_0x124f('0x32')][_0x124f('0x1c')]);}return _0x231ca9[_0x124f('0x4e')](_0x10a572);}})[_0x124f('0x26')](function(_0x2a5831){if(_0x2a5831){return _0x2a5831?{'count':_0x420f91,'rows':_0x2a5831}:null;}})[_0x124f('0x26')](respondWithResult(_0x2b04d8,null))[_0x124f('0x43')](handleError(_0x2b04d8,null));};exports[_0x124f('0x4f')]=function(_0x208559,_0x45179f,_0x53fd82){var _0x392c4c={};var _0x479870={};var _0x3c8f10;var _0x2b6e46;return db['FreshdeskConfiguration'][_0x124f('0x4d')]({'where':{'id':_0x208559['params']['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x45179f,null))[_0x124f('0x26')](function(_0x346720){if(_0x346720){_0x3c8f10=_0x346720;_0x479870[_0x124f('0x30')]=_[_0x124f('0x31')](db[_0x124f('0x4b')][_0x124f('0x2d')]);_0x479870['query']=_[_0x124f('0x31')](_0x208559['query']);_0x479870[_0x124f('0x33')]=_[_0x124f('0x34')](_0x479870['model'],_0x479870[_0x124f('0x32')]);_0x392c4c[_0x124f('0x35')]=_[_0x124f('0x34')](_0x479870[_0x124f('0x30')],qs[_0x124f('0x36')](_0x208559[_0x124f('0x32')][_0x124f('0x36')]));_0x392c4c['attributes']=_0x392c4c['attributes'][_0x124f('0x37')]?_0x392c4c[_0x124f('0x35')]:_0x479870[_0x124f('0x30')];_0x392c4c[_0x124f('0x3a')]=qs[_0x124f('0x3b')](_0x208559['query'][_0x124f('0x3b')]);_0x392c4c[_0x124f('0x3e')]=qs[_0x124f('0x33')](_[_0x124f('0x3c')](_0x208559[_0x124f('0x32')],_0x479870[_0x124f('0x33')]));if(_0x208559[_0x124f('0x32')]['filter']){_0x392c4c['where']=_[_0x124f('0x40')](_0x392c4c['where'],{'$or':_[_0x124f('0x2b')](_0x392c4c[_0x124f('0x35')],function(_0x11fac1){var _0x140c6b={};_0x140c6b[_0x11fac1]={'$like':'%'+_0x208559['query'][_0x124f('0x3d')]+'%'};return _0x140c6b;})});}_0x392c4c=_[_0x124f('0x40')]({},_0x392c4c,_0x208559['options']);return _0x3c8f10['getDescriptions'](_0x392c4c);}})['then'](function(_0x1dd6f3){if(_0x1dd6f3){_0x2b6e46=_0x1dd6f3['length'];if(!_0x208559['query'][_0x124f('0x38')](_0x124f('0x39'))){_0x392c4c[_0x124f('0x1e')]=qs[_0x124f('0x1e')](_0x208559[_0x124f('0x32')]['limit']);_0x392c4c[_0x124f('0x1c')]=qs[_0x124f('0x1c')](_0x208559[_0x124f('0x32')][_0x124f('0x1c')]);}return _0x3c8f10['getDescriptions'](_0x392c4c);}})[_0x124f('0x26')](function(_0x2cf276){if(_0x2cf276){return _0x2cf276?{'count':_0x2b6e46,'rows':_0x2cf276}:null;}})[_0x124f('0x26')](respondWithResult(_0x45179f,null))[_0x124f('0x43')](handleError(_0x45179f,null));};exports[_0x124f('0x50')]=function(_0x3c46d5,_0x20dff0,_0x3333f3){var _0x18ab69={};var _0x3fe471={};var _0x33ceb3;var _0xfce301;return db[_0x124f('0x2c')][_0x124f('0x4d')]({'where':{'id':_0x3c46d5['params']['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x20dff0,null))[_0x124f('0x26')](function(_0x320162){if(_0x320162){_0x33ceb3=_0x320162;_0x3fe471['model']=_[_0x124f('0x31')](db['Tag'][_0x124f('0x2d')]);_0x3fe471['query']=_['keys'](_0x3c46d5[_0x124f('0x32')]);_0x3fe471['filters']=_['intersection'](_0x3fe471[_0x124f('0x30')],_0x3fe471['query']);_0x18ab69[_0x124f('0x35')]=_[_0x124f('0x34')](_0x3fe471[_0x124f('0x30')],qs[_0x124f('0x36')](_0x3c46d5['query'][_0x124f('0x36')]));_0x18ab69[_0x124f('0x35')]=_0x18ab69[_0x124f('0x35')]['length']?_0x18ab69[_0x124f('0x35')]:_0x3fe471[_0x124f('0x30')];_0x18ab69[_0x124f('0x3a')]=qs[_0x124f('0x3b')](_0x3c46d5['query'][_0x124f('0x3b')]);_0x18ab69[_0x124f('0x3e')]=qs[_0x124f('0x33')](_[_0x124f('0x3c')](_0x3c46d5[_0x124f('0x32')],_0x3fe471['filters']));if(_0x3c46d5[_0x124f('0x32')][_0x124f('0x3d')]){_0x18ab69['where']=_[_0x124f('0x40')](_0x18ab69[_0x124f('0x3e')],{'$or':_[_0x124f('0x2b')](_0x18ab69[_0x124f('0x35')],function(_0x4a1813){var _0x3dba91={};_0x3dba91[_0x4a1813]={'$like':'%'+_0x3c46d5[_0x124f('0x32')][_0x124f('0x3d')]+'%'};return _0x3dba91;})});}_0x18ab69=_[_0x124f('0x40')]({},_0x18ab69,_0x3c46d5[_0x124f('0x4c')]);return _0x33ceb3[_0x124f('0x50')](_0x18ab69);}})[_0x124f('0x26')](function(_0x35df07){if(_0x35df07){_0xfce301=_0x35df07[_0x124f('0x37')];if(!_0x3c46d5[_0x124f('0x32')][_0x124f('0x38')](_0x124f('0x39'))){_0x18ab69[_0x124f('0x1e')]=qs[_0x124f('0x1e')](_0x3c46d5[_0x124f('0x32')][_0x124f('0x1e')]);_0x18ab69[_0x124f('0x1c')]=qs[_0x124f('0x1c')](_0x3c46d5[_0x124f('0x32')][_0x124f('0x1c')]);}return _0x33ceb3[_0x124f('0x50')](_0x18ab69);}})['then'](function(_0x4b72cf){if(_0x4b72cf){return _0x4b72cf?{'count':_0xfce301,'rows':_0x4b72cf}:null;}})[_0x124f('0x26')](respondWithResult(_0x20dff0,null))[_0x124f('0x43')](handleError(_0x20dff0,null));};exports[_0x124f('0x51')]=function(_0x4f9f4a,_0x1b7843,_0x569b57){if(_0x4f9f4a[_0x124f('0x52')]['id']){delete _0x4f9f4a[_0x124f('0x52')]['id'];}return db['FreshdeskConfiguration'][_0x124f('0x4d')]({'where':{'id':_0x4f9f4a[_0x124f('0x4a')]['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x1b7843,null))[_0x124f('0x26')](function(_0x56cd7d){if(_0x56cd7d){return _0x56cd7d[_0x124f('0x51')](_0x4f9f4a[_0x124f('0x52')][_0x124f('0x53')]||[]);}return null;})[_0x124f('0x26')](respondWithResult(_0x1b7843,null))[_0x124f('0x43')](handleError(_0x1b7843,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 42e9732..bdaa4cb 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 _0x6917=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x1153e6,_0x4178fe){var _0x2b9d1c=function(_0x4d66da){while(--_0x4d66da){_0x1153e6['push'](_0x1153e6['shift']());}};_0x2b9d1c(++_0x4178fe);}(_0x6917,0x68));var _0x7691=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x6917[_0x18a436];return _0x5c2cf8;};'use strict';var _=require(_0x7691('0x0'));var util=require('util');var logger=require(_0x7691('0x1'))(_0x7691('0x2'));var moment=require(_0x7691('0x3'));var BPromise=require(_0x7691('0x4'));var rp=require(_0x7691('0x5'));var fs=require('fs');var path=require(_0x7691('0x6'));var rimraf=require(_0x7691('0x7'));var config=require(_0x7691('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x7691('0x9')]=function(_0x3b84ba,_0x151ece){return _0x3b84ba[_0x7691('0xa')](_0x7691('0xb'),attributes,{'tableName':_0x7691('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x030d=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','lodash'];(function(_0x53009a,_0x58134f){var _0xfd0a1c=function(_0x54f842){while(--_0x54f842){_0x53009a['push'](_0x53009a['shift']());}};_0xfd0a1c(++_0x58134f);}(_0x030d,0xe5));var _0xd030=function(_0x657e65,_0x307cb8){_0x657e65=_0x657e65-0x0;var _0x24c8ea=_0x030d[_0x657e65];return _0x24c8ea;};'use strict';var _=require(_0xd030('0x0'));var util=require(_0xd030('0x1'));var logger=require(_0xd030('0x2'))('api');var moment=require(_0xd030('0x3'));var BPromise=require(_0xd030('0x4'));var rp=require(_0xd030('0x5'));var fs=require('fs');var path=require(_0xd030('0x6'));var rimraf=require(_0xd030('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd030('0x8')]=function(_0x16fb93,_0x237b88){return _0x16fb93[_0xd030('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','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 cb5cccf..65f94be 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 _0xbd37=['jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xbd37,0x1b0));var _0x7bd3=function(_0x49ffda,_0x45ae69){_0x49ffda=_0x49ffda-0x0;var _0x3960ea=_0xbd37[_0x49ffda];return _0x3960ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7bd3('0x0'));var BPromise=require(_0x7bd3('0x1'));var rs=require(_0x7bd3('0x2'));var fs=require('fs');var Redis=require(_0x7bd3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bd3('0x4'));var logger=require(_0x7bd3('0x5'))(_0x7bd3('0x6'));var config=require(_0x7bd3('0x7'));var jayson=require(_0x7bd3('0x8'));var client=jayson['client'][_0x7bd3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x564c74,_0x2b4c68,_0x683073){return new BPromise(function(_0x8414d9,_0x527a99){return client['request'](_0x564c74,_0x683073)[_0x7bd3('0xa')](function(_0x25a8a5){logger[_0x7bd3('0xb')](_0x7bd3('0xc'),_0x2b4c68,'request\x20sent');logger[_0x7bd3('0xd')](_0x7bd3('0xe'),_0x2b4c68,_0x7bd3('0xf'),JSON[_0x7bd3('0x10')](_0x25a8a5));if(_0x25a8a5[_0x7bd3('0x11')]){if(_0x25a8a5[_0x7bd3('0x11')][_0x7bd3('0x12')]===0x1f4){logger[_0x7bd3('0x11')](_0x7bd3('0xc'),_0x2b4c68,_0x25a8a5[_0x7bd3('0x11')][_0x7bd3('0x13')]);return _0x527a99(_0x25a8a5[_0x7bd3('0x11')]['message']);}logger[_0x7bd3('0x11')](_0x7bd3('0xc'),_0x2b4c68,_0x25a8a5[_0x7bd3('0x11')][_0x7bd3('0x13')]);return _0x8414d9(_0x25a8a5[_0x7bd3('0x11')][_0x7bd3('0x13')]);}else{logger[_0x7bd3('0xb')](_0x7bd3('0xc'),_0x2b4c68,'request\x20sent');_0x8414d9(_0x25a8a5[_0x7bd3('0x14')][_0x7bd3('0x13')]);}})[_0x7bd3('0x15')](function(_0x3da56d){logger[_0x7bd3('0x11')](_0x7bd3('0xc'),_0x2b4c68,_0x3da56d);_0x527a99(_0x3da56d);});});} \ No newline at end of file +var _0xc73e=['lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x350dc6,_0x36ab14){var _0x2e5887=function(_0x5370ad){while(--_0x5370ad){_0x350dc6['push'](_0x350dc6['shift']());}};_0x2e5887(++_0x36ab14);}(_0xc73e,0xfc));var _0xec73=function(_0x2a2872,_0xffc2ea){_0x2a2872=_0x2a2872-0x0;var _0x296369=_0xc73e[_0x2a2872];return _0x296369;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var moment=require(_0xec73('0x2'));var BPromise=require('bluebird');var rs=require(_0xec73('0x3'));var fs=require('fs');var Redis=require(_0xec73('0x4'));var db=require(_0xec73('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec73('0x6'));var config=require(_0xec73('0x7'));var jayson=require(_0xec73('0x8'));var client=jayson['client'][_0xec73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d7461,_0x4f999a,_0x123fb0){return new BPromise(function(_0x24ee6b,_0x4541f6){return client[_0xec73('0xa')](_0x1d7461,_0x123fb0)['then'](function(_0x19fc09){logger[_0xec73('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f999a,_0xec73('0xc'));logger['debug'](_0xec73('0xd'),_0x4f999a,_0xec73('0xc'),JSON[_0xec73('0xe')](_0x19fc09));if(_0x19fc09['error']){if(_0x19fc09[_0xec73('0xf')][_0xec73('0x10')]===0x1f4){logger['error'](_0xec73('0x11'),_0x4f999a,_0x19fc09[_0xec73('0xf')][_0xec73('0x12')]);return _0x4541f6(_0x19fc09[_0xec73('0xf')][_0xec73('0x12')]);}logger[_0xec73('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f999a,_0x19fc09[_0xec73('0xf')]['message']);return _0x24ee6b(_0x19fc09[_0xec73('0xf')][_0xec73('0x12')]);}else{logger[_0xec73('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f999a,_0xec73('0xc'));_0x24ee6b(_0x19fc09[_0xec73('0x13')][_0xec73('0x12')]);}})[_0xec73('0x14')](function(_0x4aec6d){logger[_0xec73('0xf')](_0xec73('0x11'),_0x4f999a,_0x4aec6d);_0x4541f6(_0x4aec6d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d3dc069..172ad2b 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 _0xe20b=['delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','post','create','put','update'];(function(_0x5c9397,_0xe6bc88){var _0x194baf=function(_0x50d093){while(--_0x50d093){_0x5c9397['push'](_0x5c9397['shift']());}};_0x194baf(++_0xe6bc88);}(_0xe20b,0x13e));var _0xbe20=function(_0x5a6fc4,_0x5f47f6){_0x5a6fc4=_0x5a6fc4-0x0;var _0x4cee09=_0xe20b[_0x5a6fc4];return _0x4cee09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbe20('0x0'));var timeout=require(_0xbe20('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe20('0x2'));var auth=require(_0xbe20('0x3'));var interaction=require(_0xbe20('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0xbe20('0x5')](),controller['index']);router[_0xbe20('0x6')](_0xbe20('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xbe20('0x8')]('/',auth[_0xbe20('0x5')](),controller[_0xbe20('0x9')]);router[_0xbe20('0xa')](_0xbe20('0x7'),auth['isAuthenticated'](),controller[_0xbe20('0xb')]);router[_0xbe20('0xc')]('/:id',auth[_0xbe20('0x5')](),controller[_0xbe20('0xd')]);module[_0xbe20('0xe')]=router; \ No newline at end of file +var _0xd10b=['path','express','Router','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','create','update','/:id','destroy','exports','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd10b,0x141));var _0xbd10=function(_0xe2da82,_0x197b63){_0xe2da82=_0xe2da82-0x0;var _0x58fc89=_0xd10b[_0xe2da82];return _0x58fc89;};'use strict';var multer=require(_0xbd10('0x0'));var util=require(_0xbd10('0x1'));var path=require(_0xbd10('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd10('0x3'));var router=express[_0xbd10('0x4')]();var fs_extra=require(_0xbd10('0x5'));var auth=require(_0xbd10('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbd10('0x7'));router[_0xbd10('0x8')]('/',auth[_0xbd10('0x9')](),controller[_0xbd10('0xa')]);router[_0xbd10('0x8')]('/:id',auth[_0xbd10('0x9')](),controller[_0xbd10('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd10('0xc')]);router['put']('/:id',auth[_0xbd10('0x9')](),controller[_0xbd10('0xd')]);router['delete'](_0xbd10('0xe'),auth[_0xbd10('0x9')](),controller[_0xbd10('0xf')]);module[_0xbd10('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 48cf311..055b150 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 _0xca27=['STRING','sequelize','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca27,0x89));var _0x7ca2=function(_0x498acc,_0x3fab56){_0x498acc=_0x498acc-0x0;var _0x125b22=_0xca27[_0x498acc];return _0x125b22;};'use strict';var Sequelize=require(_0x7ca2('0x0'));module['exports']={'type':{'type':Sequelize[_0x7ca2('0x1')]('string',_0x7ca2('0x2'),_0x7ca2('0x3'),_0x7ca2('0x4'),_0x7ca2('0x5')),'defaultValue':_0x7ca2('0x6')},'content':{'type':Sequelize[_0x7ca2('0x7')]},'key':{'type':Sequelize[_0x7ca2('0x7')]},'keyType':{'type':Sequelize[_0x7ca2('0x1')](_0x7ca2('0x6'),_0x7ca2('0x2'),_0x7ca2('0x3'))},'keyContent':{'type':Sequelize[_0x7ca2('0x7')]},'idField':{'type':Sequelize[_0x7ca2('0x7')]},'nameField':{'type':Sequelize[_0x7ca2('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ca2('0x7')]}}; \ No newline at end of file +var _0xd6b4=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING'];(function(_0x352aef,_0x5b78b6){var _0x8732fa=function(_0x357d83){while(--_0x357d83){_0x352aef['push'](_0x352aef['shift']());}};_0x8732fa(++_0x5b78b6);}(_0xd6b4,0xfe));var _0x4d6b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd6b4[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x4d6b('0x0'));module[_0x4d6b('0x1')]={'type':{'type':Sequelize[_0x4d6b('0x2')](_0x4d6b('0x3'),'variable','customVariable',_0x4d6b('0x4'),_0x4d6b('0x5')),'defaultValue':_0x4d6b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4d6b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4d6b('0x3'),'variable',_0x4d6b('0x7'))},'keyContent':{'type':Sequelize[_0x4d6b('0x6')]},'idField':{'type':Sequelize[_0x4d6b('0x6')]},'nameField':{'type':Sequelize[_0x4d6b('0x6')]},'customField':{'type':Sequelize[_0x4d6b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4d6b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 79cd4eb..f2f9a51 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 _0xa45c=['update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','request-promise','bluebird','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save'];(function(_0x539902,_0x648798){var _0x55370f=function(_0x1a966d){while(--_0x1a966d){_0x539902['push'](_0x539902['shift']());}};_0x55370f(++_0x648798);}(_0xa45c,0x6d));var _0xca45=function(_0x44ef20,_0xc9a6b1){_0x44ef20=_0x44ef20-0x0;var _0xda501f=_0xa45c[_0x44ef20];return _0xda501f;};'use strict';var emlformat=require(_0xca45('0x0'));var rimraf=require(_0xca45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca45('0x2'));var moment=require('moment');var BPromise=require(_0xca45('0x3'));var Mustache=require('mustache');var util=require(_0xca45('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xca45('0x5'));var ejs=require(_0xca45('0x6'));var fs=require('fs');var fs_extra=require(_0xca45('0x7'));var _=require(_0xca45('0x8'));var squel=require('squel');var crypto=require(_0xca45('0x9'));var jsforce=require(_0xca45('0xa'));var deskjs=require(_0xca45('0xb'));var toCsv=require(_0xca45('0x5'));var querystring=require(_0xca45('0xc'));var Papa=require('papaparse');var Redis=require(_0xca45('0xd'));var authService=require(_0xca45('0xe'));var qs=require(_0xca45('0xf'));var as=require(_0xca45('0x10'));var hardwareService=require(_0xca45('0x11'));var logger=require(_0xca45('0x12'))(_0xca45('0x13'));var utils=require('../../config/utils');var config=require(_0xca45('0x14'));var licenseUtil=require(_0xca45('0x15'));var db=require(_0xca45('0x16'))['db'];function respondWithStatusCode(_0x17ebf7,_0x580c43){_0x580c43=_0x580c43||0xcc;return function(_0x3044b1){if(_0x3044b1){return _0x17ebf7[_0xca45('0x17')](_0x580c43);}return _0x17ebf7[_0xca45('0x18')](_0x580c43)['end']();};}function respondWithResult(_0x214939,_0x569ba6){_0x569ba6=_0x569ba6||0xc8;return function(_0x22ce19){if(_0x22ce19){return _0x214939[_0xca45('0x18')](_0x569ba6)[_0xca45('0x19')](_0x22ce19);}};}function respondWithFilteredResult(_0x1c822d,_0x35b130){return function(_0x323b19){if(_0x323b19){var _0x18dd61=typeof _0x35b130['offset']===_0xca45('0x1a')&&typeof _0x35b130['limit']==='undefined';var _0x213986=_0x323b19[_0xca45('0x1b')];var _0x553af4=_0x18dd61?0x0:_0x35b130[_0xca45('0x1c')];var _0x184bbf=_0x18dd61?_0x323b19['count']:_0x35b130[_0xca45('0x1c')]+_0x35b130[_0xca45('0x1d')];var _0x446243;if(_0x184bbf>=_0x213986){_0x184bbf=_0x213986;_0x446243=0xc8;}else{_0x446243=0xce;}_0x1c822d[_0xca45('0x18')](_0x446243);return _0x1c822d['set'](_0xca45('0x1e'),_0x553af4+'-'+_0x184bbf+'/'+_0x213986)[_0xca45('0x19')](_0x323b19);}return null;};}function patchUpdates(_0x1a16f1){return function(_0xdea7de){try{jsonpatch['apply'](_0xdea7de,_0x1a16f1,!![]);}catch(_0x2c0a39){return BPromise[_0xca45('0x1f')](_0x2c0a39);}return _0xdea7de[_0xca45('0x20')]();};}function saveUpdates(_0x34bb8d,_0x2068df){return function(_0x3e8068){if(_0x3e8068){return _0x3e8068[_0xca45('0x21')](_0x34bb8d)[_0xca45('0x22')](function(_0x14cd25){return _0x14cd25;});}return null;};}function removeEntity(_0x4998b5,_0x3d9007){return function(_0x1acb89){if(_0x1acb89){return _0x1acb89[_0xca45('0x23')]()[_0xca45('0x22')](function(){_0x4998b5[_0xca45('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5927e2,_0x4d4869){return function(_0x28d9f1){if(!_0x28d9f1){_0x5927e2['sendStatus'](0x194);}return _0x28d9f1;};}function handleError(_0x5c36c7,_0x3547cd){_0x3547cd=_0x3547cd||0x1f4;return function(_0x3e3b03){logger[_0xca45('0x24')](_0x3e3b03[_0xca45('0x25')]);if(_0x3e3b03[_0xca45('0x26')]){delete _0x3e3b03['name'];}_0x5c36c7[_0xca45('0x18')](_0x3547cd)[_0xca45('0x27')](_0x3e3b03);};}exports[_0xca45('0x28')]=function(_0x4d546c,_0x4da9b6){var _0x592ad2={},_0x430591={},_0x2e51b1={'count':0x0,'rows':[]};var _0x5cb991=_[_0xca45('0x29')](db[_0xca45('0x2a')][_0xca45('0x2b')],function(_0x3e1693){return{'name':_0x3e1693['fieldName'],'type':_0x3e1693['type']['key']};});_0x430591[_0xca45('0x2c')]=_['map'](_0x5cb991,'name');_0x430591['query']=_[_0xca45('0x2d')](_0x4d546c['query']);_0x430591['filters']=_[_0xca45('0x2e')](_0x430591[_0xca45('0x2c')],_0x430591[_0xca45('0x2f')]);_0x592ad2['attributes']=_[_0xca45('0x2e')](_0x430591[_0xca45('0x2c')],qs['fields'](_0x4d546c[_0xca45('0x2f')][_0xca45('0x30')]));_0x592ad2[_0xca45('0x31')]=_0x592ad2[_0xca45('0x31')][_0xca45('0x32')]?_0x592ad2[_0xca45('0x31')]:_0x430591[_0xca45('0x2c')];if(!_0x4d546c[_0xca45('0x2f')][_0xca45('0x33')](_0xca45('0x34'))){_0x592ad2[_0xca45('0x1d')]=qs[_0xca45('0x1d')](_0x4d546c[_0xca45('0x2f')]['limit']);_0x592ad2['offset']=qs['offset'](_0x4d546c[_0xca45('0x2f')][_0xca45('0x1c')]);}_0x592ad2['order']=qs['sort'](_0x4d546c[_0xca45('0x2f')]['sort']);_0x592ad2[_0xca45('0x35')]=qs['filters'](_[_0xca45('0x36')](_0x4d546c[_0xca45('0x2f')],_0x430591[_0xca45('0x37')]),_0x5cb991);if(_0x4d546c[_0xca45('0x2f')][_0xca45('0x38')]){_0x592ad2['where']=_[_0xca45('0x39')](_0x592ad2['where'],{'$or':_[_0xca45('0x29')](_0x5cb991,function(_0x370e8b){if(_0x370e8b[_0xca45('0x3a')]!==_0xca45('0x3b')){var _0x4e9b06={};_0x4e9b06[_0x370e8b[_0xca45('0x26')]]={'$like':'%'+_0x4d546c[_0xca45('0x2f')][_0xca45('0x38')]+'%'};return _0x4e9b06;}})});}_0x592ad2=_['merge']({},_0x592ad2,_0x4d546c['options']);var _0x39a76a={'where':_0x592ad2[_0xca45('0x35')]};return db[_0xca45('0x2a')][_0xca45('0x1b')](_0x39a76a)[_0xca45('0x22')](function(_0x27317f){_0x2e51b1[_0xca45('0x1b')]=_0x27317f;if(_0x4d546c[_0xca45('0x2f')][_0xca45('0x3c')]){_0x592ad2[_0xca45('0x3d')]=[{'all':!![]}];}return db[_0xca45('0x2a')][_0xca45('0x3e')](_0x592ad2);})[_0xca45('0x22')](function(_0x44a60a){_0x2e51b1[_0xca45('0x3f')]=_0x44a60a;return _0x2e51b1;})[_0xca45('0x22')](respondWithFilteredResult(_0x4da9b6,_0x592ad2))[_0xca45('0x40')](handleError(_0x4da9b6,null));};exports[_0xca45('0x41')]=function(_0x4788b1,_0x266a05){var _0x3273e8={'raw':!![],'where':{'id':_0x4788b1['params']['id']}},_0x2ae7a2={};_0x2ae7a2[_0xca45('0x2c')]=_[_0xca45('0x2d')](db[_0xca45('0x2a')][_0xca45('0x2b')]);_0x2ae7a2['query']=_[_0xca45('0x2d')](_0x4788b1[_0xca45('0x2f')]);_0x2ae7a2[_0xca45('0x37')]=_[_0xca45('0x2e')](_0x2ae7a2[_0xca45('0x2c')],_0x2ae7a2[_0xca45('0x2f')]);_0x3273e8[_0xca45('0x31')]=_[_0xca45('0x2e')](_0x2ae7a2[_0xca45('0x2c')],qs[_0xca45('0x30')](_0x4788b1[_0xca45('0x2f')][_0xca45('0x30')]));_0x3273e8[_0xca45('0x31')]=_0x3273e8[_0xca45('0x31')][_0xca45('0x32')]?_0x3273e8[_0xca45('0x31')]:_0x2ae7a2[_0xca45('0x2c')];if(_0x4788b1[_0xca45('0x2f')][_0xca45('0x3c')]){_0x3273e8['include']=[{'all':!![]}];}_0x3273e8=_[_0xca45('0x39')]({},_0x3273e8,_0x4788b1[_0xca45('0x42')]);return db[_0xca45('0x2a')][_0xca45('0x43')](_0x3273e8)[_0xca45('0x22')](handleEntityNotFound(_0x266a05,null))[_0xca45('0x22')](respondWithResult(_0x266a05,null))[_0xca45('0x40')](handleError(_0x266a05,null));};exports[_0xca45('0x44')]=function(_0x28516f,_0x427bf5){return db[_0xca45('0x2a')][_0xca45('0x44')](_0x28516f[_0xca45('0x45')],{})[_0xca45('0x22')](respondWithResult(_0x427bf5,0xc9))['catch'](handleError(_0x427bf5,null));};exports[_0xca45('0x21')]=function(_0x457008,_0x2c6ed1){if(_0x457008[_0xca45('0x45')]['id']){delete _0x457008[_0xca45('0x45')]['id'];}return db[_0xca45('0x2a')][_0xca45('0x43')]({'where':{'id':_0x457008[_0xca45('0x46')]['id']}})[_0xca45('0x22')](handleEntityNotFound(_0x2c6ed1,null))[_0xca45('0x22')](saveUpdates(_0x457008[_0xca45('0x45')],null))['then'](respondWithResult(_0x2c6ed1,null))['catch'](handleError(_0x2c6ed1,null));};exports[_0xca45('0x23')]=function(_0x1b15be,_0x56c0c0){return db[_0xca45('0x2a')][_0xca45('0x43')]({'where':{'id':_0x1b15be[_0xca45('0x46')]['id']}})[_0xca45('0x22')](handleEntityNotFound(_0x56c0c0,null))[_0xca45('0x22')](removeEntity(_0x56c0c0,null))[_0xca45('0x40')](handleError(_0x56c0c0,null));}; \ No newline at end of file +var _0xaa88=['model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','stack','name','send','map','FreshdeskField','fieldName','key'];(function(_0x27ee97,_0x32d286){var _0xda5fa1=function(_0x4df088){while(--_0x4df088){_0x27ee97['push'](_0x27ee97['shift']());}};_0xda5fa1(++_0x32d286);}(_0xaa88,0x137));var _0x8aa8=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0xaa88[_0x2797c6];return _0x54809f;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['index']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={},_0x385208={},_0x14be8b={'count':0x0,'rows':[]};var _0x39e892=_[_0x8aa8('0x28')](db[_0x8aa8('0x29')]['rawAttributes'],function(_0x267f4c){return{'name':_0x267f4c[_0x8aa8('0x2a')],'type':_0x267f4c['type'][_0x8aa8('0x2b')]};});_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x28')](_0x39e892,'name');_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x4c5c5c[_0x8aa8('0x2d')]);_0x385208[_0x8aa8('0x2f')]=_[_0x8aa8('0x30')](_0x385208[_0x8aa8('0x2c')],_0x385208[_0x8aa8('0x2d')]);_0x5e96c9[_0x8aa8('0x31')]=_[_0x8aa8('0x30')](_0x385208[_0x8aa8('0x2c')],qs[_0x8aa8('0x32')](_0x4c5c5c['query']['fields']));_0x5e96c9[_0x8aa8('0x31')]=_0x5e96c9[_0x8aa8('0x31')][_0x8aa8('0x33')]?_0x5e96c9[_0x8aa8('0x31')]:_0x385208[_0x8aa8('0x2c')];if(!_0x4c5c5c[_0x8aa8('0x2d')]['hasOwnProperty']('nolimit')){_0x5e96c9[_0x8aa8('0x1f')]=qs['limit'](_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x1f')]);_0x5e96c9[_0x8aa8('0x1d')]=qs['offset'](_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x1d')]);}_0x5e96c9[_0x8aa8('0x34')]=qs['sort'](_0x4c5c5c['query'][_0x8aa8('0x35')]);_0x5e96c9[_0x8aa8('0x36')]=qs['filters'](_[_0x8aa8('0x37')](_0x4c5c5c[_0x8aa8('0x2d')],_0x385208['filters']),_0x39e892);if(_0x4c5c5c[_0x8aa8('0x2d')]['filter']){_0x5e96c9['where']=_[_0x8aa8('0x38')](_0x5e96c9['where'],{'$or':_[_0x8aa8('0x28')](_0x39e892,function(_0x944927){if(_0x944927[_0x8aa8('0x39')]!==_0x8aa8('0x3a')){var _0x4ce5e9={};_0x4ce5e9[_0x944927[_0x8aa8('0x26')]]={'$like':'%'+_0x4c5c5c[_0x8aa8('0x2d')]['filter']+'%'};return _0x4ce5e9;}})});}_0x5e96c9=_[_0x8aa8('0x38')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x3b')]);var _0x5ea57a={'where':_0x5e96c9[_0x8aa8('0x36')]};return db[_0x8aa8('0x29')][_0x8aa8('0x20')](_0x5ea57a)[_0x8aa8('0x24')](function(_0x189d53){_0x14be8b[_0x8aa8('0x20')]=_0x189d53;if(_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x3c')]){_0x5e96c9[_0x8aa8('0x3d')]=[{'all':!![]}];}return db[_0x8aa8('0x29')][_0x8aa8('0x3e')](_0x5e96c9);})[_0x8aa8('0x24')](function(_0x17c730){_0x14be8b[_0x8aa8('0x3f')]=_0x17c730;return _0x14be8b;})[_0x8aa8('0x24')](respondWithFilteredResult(_0x10810d,_0x5e96c9))[_0x8aa8('0x40')](handleError(_0x10810d,null));};exports['show']=function(_0x1aade0,_0x5cdba4){var _0x4833c0={'raw':!![],'where':{'id':_0x1aade0[_0x8aa8('0x41')]['id']}},_0x572132={};_0x572132['model']=_['keys'](db[_0x8aa8('0x29')]['rawAttributes']);_0x572132[_0x8aa8('0x2d')]=_['keys'](_0x1aade0['query']);_0x572132[_0x8aa8('0x2f')]=_[_0x8aa8('0x30')](_0x572132[_0x8aa8('0x2c')],_0x572132[_0x8aa8('0x2d')]);_0x4833c0[_0x8aa8('0x31')]=_[_0x8aa8('0x30')](_0x572132[_0x8aa8('0x2c')],qs['fields'](_0x1aade0[_0x8aa8('0x2d')]['fields']));_0x4833c0[_0x8aa8('0x31')]=_0x4833c0[_0x8aa8('0x31')][_0x8aa8('0x33')]?_0x4833c0[_0x8aa8('0x31')]:_0x572132[_0x8aa8('0x2c')];if(_0x1aade0[_0x8aa8('0x2d')]['includeAll']){_0x4833c0['include']=[{'all':!![]}];}_0x4833c0=_[_0x8aa8('0x38')]({},_0x4833c0,_0x1aade0[_0x8aa8('0x3b')]);return db['FreshdeskField'][_0x8aa8('0x42')](_0x4833c0)[_0x8aa8('0x24')](handleEntityNotFound(_0x5cdba4,null))[_0x8aa8('0x24')](respondWithResult(_0x5cdba4,null))['catch'](handleError(_0x5cdba4,null));};exports['create']=function(_0x52c130,_0x4e05e7){return db[_0x8aa8('0x29')][_0x8aa8('0x43')](_0x52c130['body'],{})[_0x8aa8('0x24')](respondWithResult(_0x4e05e7,0xc9))[_0x8aa8('0x40')](handleError(_0x4e05e7,null));};exports[_0x8aa8('0x44')]=function(_0x1aa1b6,_0x20384a){if(_0x1aa1b6[_0x8aa8('0x45')]['id']){delete _0x1aa1b6['body']['id'];}return db['FreshdeskField'][_0x8aa8('0x42')]({'where':{'id':_0x1aa1b6['params']['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x20384a,null))['then'](saveUpdates(_0x1aa1b6[_0x8aa8('0x45')],null))[_0x8aa8('0x24')](respondWithResult(_0x20384a,null))[_0x8aa8('0x40')](handleError(_0x20384a,null));};exports[_0x8aa8('0x46')]=function(_0x36de37,_0x22b35d){return db[_0x8aa8('0x29')][_0x8aa8('0x42')]({'where':{'id':_0x36de37[_0x8aa8('0x41')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x22b35d,null))[_0x8aa8('0x24')](removeEntity(_0x22b35d,null))[_0x8aa8('0x40')](handleError(_0x22b35d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index e9284fb..11ab417 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 _0xfb09=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes'];(function(_0x47d110,_0x5a3020){var _0xa8e9f1=function(_0x5d899d){while(--_0x5d899d){_0x47d110['push'](_0x47d110['shift']());}};_0xa8e9f1(++_0x5a3020);}(_0xfb09,0x19d));var _0x9fb0=function(_0x267168,_0x5c0b23){_0x267168=_0x267168-0x0;var _0x3ca8f7=_0xfb09[_0x267168];return _0x3ca8f7;};'use strict';var _=require(_0x9fb0('0x0'));var util=require('util');var logger=require(_0x9fb0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9fb0('0x2'));var rp=require(_0x9fb0('0x3'));var fs=require('fs');var path=require(_0x9fb0('0x4'));var rimraf=require('rimraf');var config=require(_0x9fb0('0x5'));var attributes=require(_0x9fb0('0x6'));module['exports']=function(_0x3bad46,_0x19b030){return _0x3bad46['define'](_0x9fb0('0x7'),attributes,{'tableName':_0x9fb0('0x8'),'paranoid':![],'indexes':[{'name':_0x9fb0('0x9'),'fields':[_0x9fb0('0xa'),_0x9fb0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xecb2=['FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x44b355,_0x384ab1){var _0x5ae379=function(_0x13efe6){while(--_0x13efe6){_0x44b355['push'](_0x44b355['shift']());}};_0x5ae379(++_0x384ab1);}(_0xecb2,0x112));var _0x2ecb=function(_0x201887,_0x1cd2de){_0x201887=_0x201887-0x0;var _0xf3faa8=_0xecb2[_0x201887];return _0xf3faa8;};'use strict';var _=require(_0x2ecb('0x0'));var util=require(_0x2ecb('0x1'));var logger=require(_0x2ecb('0x2'))('api');var moment=require(_0x2ecb('0x3'));var BPromise=require(_0x2ecb('0x4'));var rp=require(_0x2ecb('0x5'));var fs=require('fs');var path=require(_0x2ecb('0x6'));var rimraf=require(_0x2ecb('0x7'));var config=require(_0x2ecb('0x8'));var attributes=require(_0x2ecb('0x9'));module[_0x2ecb('0xa')]=function(_0x414871,_0x9e6340){return _0x414871['define'](_0x2ecb('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2ecb('0xc'),'fields':[_0x2ecb('0xd'),_0x2ecb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 63fae46..8c3b4b8 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 _0xc8ef=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x46aa9c,_0x518160){var _0xf19a0b=function(_0x353d73){while(--_0x353d73){_0x46aa9c['push'](_0x46aa9c['shift']());}};_0xf19a0b(++_0x518160);}(_0xc8ef,0xa2));var _0xfc8e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xc8ef[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xfc8e('0x0'));var util=require(_0xfc8e('0x1'));var moment=require('moment');var BPromise=require(_0xfc8e('0x2'));var rs=require(_0xfc8e('0x3'));var fs=require('fs');var Redis=require(_0xfc8e('0x4'));var db=require(_0xfc8e('0x5'))['db'];var utils=require(_0xfc8e('0x6'));var logger=require(_0xfc8e('0x7'))(_0xfc8e('0x8'));var config=require('../../config/environment');var jayson=require(_0xfc8e('0x9'));var client=jayson[_0xfc8e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18542e,_0x44fb26,_0x13cfdd){return new BPromise(function(_0x22c984,_0x1ce4f3){return client[_0xfc8e('0xb')](_0x18542e,_0x13cfdd)[_0xfc8e('0xc')](function(_0x473868){logger['info'](_0xfc8e('0xd'),_0x44fb26,'request\x20sent');logger[_0xfc8e('0xe')](_0xfc8e('0xf'),_0x44fb26,_0xfc8e('0x10'),JSON[_0xfc8e('0x11')](_0x473868));if(_0x473868[_0xfc8e('0x12')]){if(_0x473868[_0xfc8e('0x12')][_0xfc8e('0x13')]===0x1f4){logger[_0xfc8e('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x44fb26,_0x473868[_0xfc8e('0x12')][_0xfc8e('0x14')]);return _0x1ce4f3(_0x473868[_0xfc8e('0x12')][_0xfc8e('0x14')]);}logger[_0xfc8e('0x12')](_0xfc8e('0xd'),_0x44fb26,_0x473868[_0xfc8e('0x12')][_0xfc8e('0x14')]);return _0x22c984(_0x473868[_0xfc8e('0x12')][_0xfc8e('0x14')]);}else{logger[_0xfc8e('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x44fb26,_0xfc8e('0x10'));_0x22c984(_0x473868[_0xfc8e('0x16')][_0xfc8e('0x14')]);}})[_0xfc8e('0x17')](function(_0x53b11c){logger[_0xfc8e('0x12')](_0xfc8e('0xd'),_0x44fb26,_0x53b11c);_0x1ce4f3(_0x53b11c);});});} \ No newline at end of file +var _0x57aa=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','moment','bluebird','ioredis','../../mysqldb','jayson/promise','request','then'];(function(_0x1216d2,_0xba895c){var _0x4ce123=function(_0x4791b5){while(--_0x4791b5){_0x1216d2['push'](_0x1216d2['shift']());}};_0x4ce123(++_0xba895c);}(_0x57aa,0xe9));var _0xa57a=function(_0x3ccbc7,_0x3093c8){_0x3ccbc7=_0x3ccbc7-0x0;var _0x50c97a=_0x57aa[_0x3ccbc7];return _0x50c97a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa57a('0x0'));var BPromise=require(_0xa57a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa57a('0x2'));var db=require(_0xa57a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa57a('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4abef0,_0x20127a,_0x1721a4){return new BPromise(function(_0x490f0b,_0x4f3217){return client[_0xa57a('0x5')](_0x4abef0,_0x1721a4)[_0xa57a('0x6')](function(_0x32b141){logger['info'](_0xa57a('0x7'),_0x20127a,_0xa57a('0x8'));logger[_0xa57a('0x9')](_0xa57a('0xa'),_0x20127a,_0xa57a('0x8'),JSON[_0xa57a('0xb')](_0x32b141));if(_0x32b141[_0xa57a('0xc')]){if(_0x32b141[_0xa57a('0xc')]['code']===0x1f4){logger[_0xa57a('0xc')](_0xa57a('0x7'),_0x20127a,_0x32b141['error'][_0xa57a('0xd')]);return _0x4f3217(_0x32b141[_0xa57a('0xc')][_0xa57a('0xd')]);}logger['error'](_0xa57a('0x7'),_0x20127a,_0x32b141[_0xa57a('0xc')][_0xa57a('0xd')]);return _0x490f0b(_0x32b141[_0xa57a('0xc')][_0xa57a('0xd')]);}else{logger[_0xa57a('0xe')](_0xa57a('0x7'),_0x20127a,'request\x20sent');_0x490f0b(_0x32b141[_0xa57a('0xf')]['message']);}})['catch'](function(_0x26a039){logger[_0xa57a('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x20127a,_0x26a039);_0x4f3217(_0x26a039);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a7a0476..f204616 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 _0x96cc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x1a381e,_0x3030ab){var _0x4d0482=function(_0x56a0a6){while(--_0x56a0a6){_0x1a381e['push'](_0x1a381e['shift']());}};_0x4d0482(++_0x3030ab);}(_0x96cc,0x16c));var _0xc96c=function(_0x58ed0e,_0x5040e2){_0x58ed0e=_0x58ed0e-0x0;var _0x2dabdc=_0x96cc[_0x58ed0e];return _0x2dabdc;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['getConfigurations']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['getFields']);router[_0xc96c('0xf')]('/',auth['isAuthenticated'](),controller[_0xc96c('0x10')]);router['post'](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x11')]);router[_0xc96c('0x12')]('/:id',auth[_0xc96c('0xa')](),controller[_0xc96c('0x13')]);router[_0xc96c('0x14')](_0xc96c('0xb'),auth['isAuthenticated'](),controller[_0xc96c('0x15')]);module[_0xc96c('0x16')]=router; \ No newline at end of file +var _0x6c76=['getConfigurations','/:id/fields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations'];(function(_0x303a96,_0x48290a){var _0x5c3685=function(_0x421ce6){while(--_0x421ce6){_0x303a96['push'](_0x303a96['shift']());}};_0x5c3685(++_0x48290a);}(_0x6c76,0x184));var _0x66c7=function(_0x487715,_0x1f5d76){_0x487715=_0x487715-0x0;var _0x258e07=_0x6c76[_0x487715];return _0x258e07;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['getFields']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),controller[_0x66c7('0xe')]);router[_0x66c7('0xd')](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xf')]);router['put'](_0x66c7('0x10'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')](_0x66c7('0x10'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);module[_0x66c7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ae581a9..ec61427 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 _0x0598=['exports','STRING','sequelize'];(function(_0xca54f9,_0x1d837b){var _0x183c63=function(_0x4729a8){while(--_0x4729a8){_0xca54f9['push'](_0xca54f9['shift']());}};_0x183c63(++_0x1d837b);}(_0x0598,0x92));var _0x8059=function(_0x285338,_0x1da2ad){_0x285338=_0x285338-0x0;var _0x34a400=_0x0598[_0x285338];return _0x34a400;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1d17d4,_0x25eccb){_0x1d17d4=_0x1d17d4-0x0;var _0x13ab32=_0xdd4f[_0x1d17d4];return _0x13ab32;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x3')},'serverUrl':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index cb28645..c61ea27 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 _0xe870=['apply','reject','update','destroy','end','sendStatus','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','catch','show','params','find','create','body','FreshsalesConfiguration','getConfigurations','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','%s%s','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','count','set','Content-Range'];(function(_0x2f7f91,_0x5e9567){var _0x353503=function(_0x2e45f4){while(--_0x2e45f4){_0x2f7f91['push'](_0x2f7f91['shift']());}};_0x353503(++_0x5e9567);}(_0xe870,0x1d6));var _0x0e87=function(_0x5c2389,_0x4e6faa){_0x5c2389=_0x5c2389-0x0;var _0x2e31e4=_0xe870[_0x5c2389];return _0x2e31e4;};'use strict';var emlformat=require(_0x0e87('0x0'));var rimraf=require(_0x0e87('0x1'));var zipdir=require(_0x0e87('0x2'));var jsonpatch=require(_0x0e87('0x3'));var rp=require(_0x0e87('0x4'));var moment=require(_0x0e87('0x5'));var BPromise=require(_0x0e87('0x6'));var Mustache=require(_0x0e87('0x7'));var util=require(_0x0e87('0x8'));var path=require(_0x0e87('0x9'));var sox=require(_0x0e87('0xa'));var csv=require(_0x0e87('0xb'));var ejs=require(_0x0e87('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e87('0xd'));var squel=require('squel');var crypto=require(_0x0e87('0xe'));var jsforce=require(_0x0e87('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0e87('0xb'));var querystring=require(_0x0e87('0x10'));var Papa=require(_0x0e87('0x11'));var Redis=require(_0x0e87('0x12'));var authService=require(_0x0e87('0x13'));var qs=require(_0x0e87('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e87('0x15'));var logger=require(_0x0e87('0x16'))(_0x0e87('0x17'));var utils=require(_0x0e87('0x18'));var config=require(_0x0e87('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e87('0x1a'))['db'];var integrations=require(_0x0e87('0x1b'));function respondWithStatusCode(_0x4b4f1f,_0x3ad8a3){_0x3ad8a3=_0x3ad8a3||0xcc;return function(_0x12f154){if(_0x12f154){return _0x4b4f1f['sendStatus'](_0x3ad8a3);}return _0x4b4f1f['status'](_0x3ad8a3)['end']();};}function respondWithResult(_0x219615,_0x112e0d){_0x112e0d=_0x112e0d||0xc8;return function(_0x5a3aa8){if(_0x5a3aa8){return _0x219615[_0x0e87('0x1c')](_0x112e0d)[_0x0e87('0x1d')](_0x5a3aa8);}};}function respondWithFilteredResult(_0x1ffbb9,_0x1d6a1b){return function(_0x171d14){if(_0x171d14){var _0x3daca0=typeof _0x1d6a1b[_0x0e87('0x1e')]==='undefined'&&typeof _0x1d6a1b[_0x0e87('0x1f')]==='undefined';var _0x2601f2=_0x171d14[_0x0e87('0x20')];var _0x13e529=_0x3daca0?0x0:_0x1d6a1b['offset'];var _0x2ea303=_0x3daca0?_0x171d14[_0x0e87('0x20')]:_0x1d6a1b[_0x0e87('0x1e')]+_0x1d6a1b[_0x0e87('0x1f')];var _0x420e3f;if(_0x2ea303>=_0x2601f2){_0x2ea303=_0x2601f2;_0x420e3f=0xc8;}else{_0x420e3f=0xce;}_0x1ffbb9[_0x0e87('0x1c')](_0x420e3f);return _0x1ffbb9[_0x0e87('0x21')](_0x0e87('0x22'),_0x13e529+'-'+_0x2ea303+'/'+_0x2601f2)[_0x0e87('0x1d')](_0x171d14);}return null;};}function patchUpdates(_0x42b015){return function(_0x3716f7){try{jsonpatch[_0x0e87('0x23')](_0x3716f7,_0x42b015,!![]);}catch(_0x55fd08){return BPromise[_0x0e87('0x24')](_0x55fd08);}return _0x3716f7['save']();};}function saveUpdates(_0x330067,_0x5d6832){return function(_0x43948f){if(_0x43948f){return _0x43948f[_0x0e87('0x25')](_0x330067)['then'](function(_0x2c0b7f){return _0x2c0b7f;});}return null;};}function removeEntity(_0x433bda,_0x11d102){return function(_0x3550f6){if(_0x3550f6){return _0x3550f6[_0x0e87('0x26')]()['then'](function(){_0x433bda['status'](0xcc)[_0x0e87('0x27')]();});}};}function handleEntityNotFound(_0x429ebf,_0x280eb5){return function(_0x454e48){if(!_0x454e48){_0x429ebf[_0x0e87('0x28')](0x194);}return _0x454e48;};}function handleError(_0x3791b6,_0x61ed8c){_0x61ed8c=_0x61ed8c||0x1f4;return function(_0x339d81){logger[_0x0e87('0x29')](_0x339d81[_0x0e87('0x2a')]);if(_0x339d81[_0x0e87('0x2b')]){delete _0x339d81[_0x0e87('0x2b')];}_0x3791b6[_0x0e87('0x1c')](_0x61ed8c)[_0x0e87('0x2c')](_0x339d81);};}exports['index']=function(_0x1b3c5a,_0x59a755){var _0x252c0d={},_0x241716={},_0x184a78={'count':0x0,'rows':[]};var _0x33986f=_[_0x0e87('0x2d')](db[_0x0e87('0x2e')][_0x0e87('0x2f')],function(_0x4735a0){return{'name':_0x4735a0[_0x0e87('0x30')],'type':_0x4735a0[_0x0e87('0x31')][_0x0e87('0x32')]};});_0x241716[_0x0e87('0x33')]=_['map'](_0x33986f,_0x0e87('0x2b'));_0x241716[_0x0e87('0x34')]=_[_0x0e87('0x35')](_0x1b3c5a[_0x0e87('0x34')]);_0x241716[_0x0e87('0x36')]=_[_0x0e87('0x37')](_0x241716[_0x0e87('0x33')],_0x241716[_0x0e87('0x34')]);_0x252c0d[_0x0e87('0x38')]=_[_0x0e87('0x37')](_0x241716['model'],qs[_0x0e87('0x39')](_0x1b3c5a[_0x0e87('0x34')]['fields']));_0x252c0d[_0x0e87('0x38')]=_0x252c0d[_0x0e87('0x38')][_0x0e87('0x3a')]?_0x252c0d[_0x0e87('0x38')]:_0x241716[_0x0e87('0x33')];if(!_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x3b')](_0x0e87('0x3c'))){_0x252c0d[_0x0e87('0x1f')]=qs[_0x0e87('0x1f')](_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x1f')]);_0x252c0d['offset']=qs[_0x0e87('0x1e')](_0x1b3c5a['query']['offset']);}_0x252c0d[_0x0e87('0x3d')]=qs[_0x0e87('0x3e')](_0x1b3c5a['query']['sort']);_0x252c0d[_0x0e87('0x3f')]=qs[_0x0e87('0x36')](_[_0x0e87('0x40')](_0x1b3c5a[_0x0e87('0x34')],_0x241716[_0x0e87('0x36')]),_0x33986f);if(_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x41')]){_0x252c0d[_0x0e87('0x3f')]=_[_0x0e87('0x42')](_0x252c0d[_0x0e87('0x3f')],{'$or':_[_0x0e87('0x2d')](_0x33986f,function(_0xf8d126){if(_0xf8d126[_0x0e87('0x31')]!==_0x0e87('0x43')){var _0xf97ee1={};_0xf97ee1[_0xf8d126[_0x0e87('0x2b')]]={'$like':'%'+_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x41')]+'%'};return _0xf97ee1;}})});}_0x252c0d=_['merge']({},_0x252c0d,_0x1b3c5a[_0x0e87('0x44')]);var _0x32d6d9={'where':_0x252c0d['where']};return db[_0x0e87('0x2e')]['count'](_0x32d6d9)[_0x0e87('0x45')](function(_0x3caf74){_0x184a78['count']=_0x3caf74;if(_0x1b3c5a[_0x0e87('0x34')][_0x0e87('0x46')]){_0x252c0d['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x252c0d);})['then'](function(_0x28bac0){_0x184a78['rows']=_0x28bac0;return _0x184a78;})['then'](respondWithFilteredResult(_0x59a755,_0x252c0d))[_0x0e87('0x47')](handleError(_0x59a755,null));};exports[_0x0e87('0x48')]=function(_0x9ca582,_0x19a1c6){var _0x2de274={'raw':![],'where':{'id':_0x9ca582[_0x0e87('0x49')]['id']}},_0x5ae457={};_0x5ae457[_0x0e87('0x33')]=_[_0x0e87('0x35')](db[_0x0e87('0x2e')][_0x0e87('0x2f')]);_0x5ae457['query']=_[_0x0e87('0x35')](_0x9ca582[_0x0e87('0x34')]);_0x5ae457[_0x0e87('0x36')]=_[_0x0e87('0x37')](_0x5ae457[_0x0e87('0x33')],_0x5ae457[_0x0e87('0x34')]);_0x2de274[_0x0e87('0x38')]=_[_0x0e87('0x37')](_0x5ae457[_0x0e87('0x33')],qs['fields'](_0x9ca582[_0x0e87('0x34')][_0x0e87('0x39')]));_0x2de274[_0x0e87('0x38')]=_0x2de274['attributes'][_0x0e87('0x3a')]?_0x2de274[_0x0e87('0x38')]:_0x5ae457['model'];if(_0x9ca582['query'][_0x0e87('0x46')]){_0x2de274['include']=[{'all':!![]}];}_0x2de274=_[_0x0e87('0x42')]({},_0x2de274,_0x9ca582[_0x0e87('0x44')]);return db[_0x0e87('0x2e')][_0x0e87('0x4a')](_0x2de274)[_0x0e87('0x45')](handleEntityNotFound(_0x19a1c6,null))[_0x0e87('0x45')](respondWithResult(_0x19a1c6,null))[_0x0e87('0x47')](handleError(_0x19a1c6,null));};exports[_0x0e87('0x4b')]=function(_0x44ec45,_0x5a64fc){return db[_0x0e87('0x2e')][_0x0e87('0x4b')](_0x44ec45[_0x0e87('0x4c')],{})[_0x0e87('0x45')](respondWithResult(_0x5a64fc,0xc9))[_0x0e87('0x47')](handleError(_0x5a64fc,null));};exports[_0x0e87('0x25')]=function(_0x5de4b4,_0x4a9177){if(_0x5de4b4[_0x0e87('0x4c')]['id']){delete _0x5de4b4[_0x0e87('0x4c')]['id'];}return db[_0x0e87('0x2e')]['find']({'where':{'id':_0x5de4b4[_0x0e87('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a9177,null))[_0x0e87('0x45')](saveUpdates(_0x5de4b4[_0x0e87('0x4c')],null))[_0x0e87('0x45')](respondWithResult(_0x4a9177,null))[_0x0e87('0x47')](handleError(_0x4a9177,null));};exports[_0x0e87('0x26')]=function(_0x4ddd9d,_0x362929){return db[_0x0e87('0x2e')][_0x0e87('0x4a')]({'where':{'id':_0x4ddd9d['params']['id']}})[_0x0e87('0x45')](handleEntityNotFound(_0x362929,null))['then'](removeEntity(_0x362929,null))[_0x0e87('0x47')](handleError(_0x362929,null));};exports['getConfigurations']=function(_0x3435fc,_0x406e54,_0x343946){var _0x376c0e={};var _0x34fca8={};var _0x502d91;var _0x10d666;return db[_0x0e87('0x2e')]['findOne']({'where':{'id':_0x3435fc['params']['id']}})['then'](handleEntityNotFound(_0x406e54,null))[_0x0e87('0x45')](function(_0x20c694){if(_0x20c694){_0x502d91=_0x20c694;_0x34fca8['model']=_['keys'](db[_0x0e87('0x4d')][_0x0e87('0x2f')]);_0x34fca8[_0x0e87('0x34')]=_[_0x0e87('0x35')](_0x3435fc['query']);_0x34fca8[_0x0e87('0x36')]=_[_0x0e87('0x37')](_0x34fca8['model'],_0x34fca8[_0x0e87('0x34')]);_0x376c0e[_0x0e87('0x38')]=_[_0x0e87('0x37')](_0x34fca8[_0x0e87('0x33')],qs[_0x0e87('0x39')](_0x3435fc[_0x0e87('0x34')][_0x0e87('0x39')]));_0x376c0e[_0x0e87('0x38')]=_0x376c0e['attributes'][_0x0e87('0x3a')]?_0x376c0e[_0x0e87('0x38')]:_0x34fca8[_0x0e87('0x33')];_0x376c0e[_0x0e87('0x3d')]=qs['sort'](_0x3435fc[_0x0e87('0x34')][_0x0e87('0x3e')]);_0x376c0e['where']=qs['filters'](_['pick'](_0x3435fc[_0x0e87('0x34')],_0x34fca8[_0x0e87('0x36')]));if(_0x3435fc['query']['filter']){_0x376c0e[_0x0e87('0x3f')]=_['merge'](_0x376c0e[_0x0e87('0x3f')],{'$or':_[_0x0e87('0x2d')](_0x376c0e[_0x0e87('0x38')],function(_0x2673fc){var _0x5cb36b={};_0x5cb36b[_0x2673fc]={'$like':'%'+_0x3435fc['query'][_0x0e87('0x41')]+'%'};return _0x5cb36b;})});}_0x376c0e=_['merge']({},_0x376c0e,_0x3435fc[_0x0e87('0x44')]);return _0x502d91[_0x0e87('0x4e')](_0x376c0e);}})[_0x0e87('0x45')](function(_0x4e9d0c){if(_0x4e9d0c){_0x10d666=_0x4e9d0c[_0x0e87('0x3a')];if(!_0x3435fc[_0x0e87('0x34')][_0x0e87('0x3b')]('nolimit')){_0x376c0e[_0x0e87('0x1f')]=qs[_0x0e87('0x1f')](_0x3435fc[_0x0e87('0x34')][_0x0e87('0x1f')]);_0x376c0e[_0x0e87('0x1e')]=qs[_0x0e87('0x1e')](_0x3435fc['query'][_0x0e87('0x1e')]);}return _0x502d91[_0x0e87('0x4e')](_0x376c0e);}})[_0x0e87('0x45')](function(_0x1b03db){if(_0x1b03db){return _0x1b03db?{'count':_0x10d666,'rows':_0x1b03db}:null;}})[_0x0e87('0x45')](respondWithResult(_0x406e54,null))['catch'](handleError(_0x406e54,null));};exports['addConfiguration']=function(_0x27ffde,_0x2483f4,_0x5ad87f){if(_0x27ffde['body']['id']){delete _0x27ffde[_0x0e87('0x4c')]['id'];}return db[_0x0e87('0x2e')][_0x0e87('0x4f')]({'where':{'id':_0x27ffde[_0x0e87('0x49')]['id']}})[_0x0e87('0x45')](handleEntityNotFound(_0x2483f4,null))[_0x0e87('0x45')](function(_0x437d02){if(_0x437d02){_0x27ffde[_0x0e87('0x4c')]['AccountId']=_0x437d02['id'];_0x27ffde['body'][_0x0e87('0x50')]=integrations[_0x0e87('0x51')](_0x27ffde['body'][_0x0e87('0x52')],_0x27ffde[_0x0e87('0x4c')][_0x0e87('0x31')]);_0x27ffde[_0x0e87('0x4c')][_0x0e87('0x53')]=integrations[_0x0e87('0x54')](_0x27ffde[_0x0e87('0x4c')][_0x0e87('0x52')],_0x27ffde[_0x0e87('0x4c')][_0x0e87('0x31')]);return db['FreshsalesConfiguration'][_0x0e87('0x4b')](_0x27ffde['body'],{'include':[{'model':db[_0x0e87('0x55')],'as':_0x0e87('0x50')},{'model':db['FreshsalesField'],'as':_0x0e87('0x53')}]});}return null;})[_0x0e87('0x45')](respondWithResult(_0x2483f4,null))[_0x0e87('0x47')](handleError(_0x2483f4,null));};exports[_0x0e87('0x56')]=function(_0x3650fa,_0x4ea5cb,_0x7f9f50){var _0x4742bd='';var _0x4981da='';return db[_0x0e87('0x2e')]['findOne']({'where':{'id':_0x3650fa[_0x0e87('0x49')]['id']},'attributes':['id',_0x0e87('0x57'),_0x0e87('0x58'),_0x0e87('0x59')]})[_0x0e87('0x45')](handleEntityNotFound(_0x4ea5cb,null))[_0x0e87('0x45')](function(_0x4bd030){if(_0x4bd030){_0x4981da=_0x4bd030[_0x0e87('0x57')];_0x4742bd=_0x4bd030['remoteUri'];var _0x1364bf=_0x4bd030[_0x0e87('0x58')][_0x0e87('0x5a')](-0x1);if(_0x1364bf==='/'){_0x4742bd=_0x4742bd['substring'](0x0,_0x4742bd[_0x0e87('0x5b')](_0x1364bf));}return rp({'method':'GET','uri':util[_0x0e87('0x5c')](_0x0e87('0x5d'),_0x4742bd,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x4bd030['apiKey']},'json':!![]});}})['then'](function(_0x5619ff){if(_0x5619ff){var _0xc24610=_0x5619ff[_0x0e87('0x5e')];var _0x20fafd=![];var _0x488d9a=null;for(_0x488d9a=0x0;_0x488d9a<_0xc24610['length'];_0x488d9a++){if(_0xc24610[_0x488d9a][_0x0e87('0x5f')]===_0x4981da){_0x20fafd=!![];}}if(_0x20fafd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0e87('0x60')});}}})[_0x0e87('0x45')](respondWithResult(_0x4ea5cb,null))[_0x0e87('0x47')](function(_0x20a7db){var _0x563c7d=_0x3650fa[_0x0e87('0x34')][_0x0e87('0x61')]?0x1f4:_0x20a7db['statusCode']||0x1f4;logger[_0x0e87('0x29')](_0x0e87('0x62'),_0x0e87('0x56'),_0x563c7d,JSON['stringify'](_0x20a7db));delete _0x20a7db[_0x0e87('0x2b')];if(_0x563c7d===0x191){_0x563c7d=0x190;}_0x4ea5cb[_0x0e87('0x1c')](_0x563c7d)[_0x0e87('0x2c')](_0x3650fa[_0x0e87('0x34')][_0x0e87('0x61')]?{'message':_0x0e87('0x63'),'statusCode':_0x20a7db[_0x0e87('0x64')]}:_0x20a7db);});}; \ No newline at end of file +var _0x5672=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','then','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','FreshsalesAccount','findAll','rows','catch','show','params','fields','create','body','update','find','destroy','findOne','FreshsalesConfiguration','merge','hasOwnProperty','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1b56a9,_0x4dd3e4){var _0xdae76=function(_0x3b7eea){while(--_0x3b7eea){_0x1b56a9['push'](_0x1b56a9['shift']());}};_0xdae76(++_0x4dd3e4);}(_0x5672,0x129));var _0x2567=function(_0x26d26f,_0x302cce){_0x26d26f=_0x26d26f-0x0;var _0x5c8c0e=_0x5672[_0x26d26f];return _0x5c8c0e;};'use strict';var emlformat=require(_0x2567('0x0'));var rimraf=require(_0x2567('0x1'));var zipdir=require(_0x2567('0x2'));var jsonpatch=require(_0x2567('0x3'));var rp=require(_0x2567('0x4'));var moment=require(_0x2567('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2567('0x6'));var util=require(_0x2567('0x7'));var path=require(_0x2567('0x8'));var sox=require(_0x2567('0x9'));var csv=require('to-csv');var ejs=require(_0x2567('0xa'));var fs=require('fs');var fs_extra=require(_0x2567('0xb'));var _=require('lodash');var squel=require(_0x2567('0xc'));var crypto=require('crypto');var jsforce=require(_0x2567('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2567('0xe'));var querystring=require(_0x2567('0xf'));var Papa=require('papaparse');var Redis=require(_0x2567('0x10'));var authService=require(_0x2567('0x11'));var qs=require(_0x2567('0x12'));var as=require(_0x2567('0x13'));var hardwareService=require(_0x2567('0x14'));var logger=require(_0x2567('0x15'))(_0x2567('0x16'));var utils=require(_0x2567('0x17'));var config=require(_0x2567('0x18'));var licenseUtil=require(_0x2567('0x19'));var db=require(_0x2567('0x1a'))['db'];var integrations=require(_0x2567('0x1b'));function respondWithStatusCode(_0x4fb875,_0x3252af){_0x3252af=_0x3252af||0xcc;return function(_0x430124){if(_0x430124){return _0x4fb875[_0x2567('0x1c')](_0x3252af);}return _0x4fb875[_0x2567('0x1d')](_0x3252af)['end']();};}function respondWithResult(_0xc0f8a7,_0x1aee53){_0x1aee53=_0x1aee53||0xc8;return function(_0x4b3d85){if(_0x4b3d85){return _0xc0f8a7['status'](_0x1aee53)['json'](_0x4b3d85);}};}function respondWithFilteredResult(_0x310ef7,_0x6a90f){return function(_0x18d6a2){if(_0x18d6a2){var _0x4c9d32=typeof _0x6a90f[_0x2567('0x1e')]===_0x2567('0x1f')&&typeof _0x6a90f[_0x2567('0x20')]===_0x2567('0x1f');var _0xcb508=_0x18d6a2[_0x2567('0x21')];var _0x5925d2=_0x4c9d32?0x0:_0x6a90f[_0x2567('0x1e')];var _0x3de21b=_0x4c9d32?_0x18d6a2[_0x2567('0x21')]:_0x6a90f[_0x2567('0x1e')]+_0x6a90f['limit'];var _0x4fb590;if(_0x3de21b>=_0xcb508){_0x3de21b=_0xcb508;_0x4fb590=0xc8;}else{_0x4fb590=0xce;}_0x310ef7[_0x2567('0x1d')](_0x4fb590);return _0x310ef7[_0x2567('0x22')]('Content-Range',_0x5925d2+'-'+_0x3de21b+'/'+_0xcb508)['json'](_0x18d6a2);}return null;};}function patchUpdates(_0x407f75){return function(_0x10b481){try{jsonpatch[_0x2567('0x23')](_0x10b481,_0x407f75,!![]);}catch(_0x5dd16f){return BPromise[_0x2567('0x24')](_0x5dd16f);}return _0x10b481[_0x2567('0x25')]();};}function saveUpdates(_0x2baaff,_0x5f2113){return function(_0x50240f){if(_0x50240f){return _0x50240f['update'](_0x2baaff)['then'](function(_0x5afc39){return _0x5afc39;});}return null;};}function removeEntity(_0x138250,_0x1d4f21){return function(_0x20da17){if(_0x20da17){return _0x20da17['destroy']()[_0x2567('0x26')](function(){_0x138250['status'](0xcc)[_0x2567('0x27')]();});}};}function handleEntityNotFound(_0x461ecb,_0x2d6559){return function(_0x2cfc4c){if(!_0x2cfc4c){_0x461ecb['sendStatus'](0x194);}return _0x2cfc4c;};}function handleError(_0x4a62ee,_0x21c8a0){_0x21c8a0=_0x21c8a0||0x1f4;return function(_0x25c4ce){logger['error'](_0x25c4ce[_0x2567('0x28')]);if(_0x25c4ce[_0x2567('0x29')]){delete _0x25c4ce[_0x2567('0x29')];}_0x4a62ee[_0x2567('0x1d')](_0x21c8a0)['send'](_0x25c4ce);};}exports[_0x2567('0x2a')]=function(_0x1b081d,_0x43ce59){var _0x1d3b61={},_0x415bf9={},_0x45cd0e={'count':0x0,'rows':[]};var _0x368ab6=_[_0x2567('0x2b')](db['FreshsalesAccount'][_0x2567('0x2c')],function(_0x1e6876){return{'name':_0x1e6876[_0x2567('0x2d')],'type':_0x1e6876[_0x2567('0x2e')][_0x2567('0x2f')]};});_0x415bf9[_0x2567('0x30')]=_['map'](_0x368ab6,_0x2567('0x29'));_0x415bf9[_0x2567('0x31')]=_[_0x2567('0x32')](_0x1b081d['query']);_0x415bf9[_0x2567('0x33')]=_[_0x2567('0x34')](_0x415bf9['model'],_0x415bf9[_0x2567('0x31')]);_0x1d3b61[_0x2567('0x35')]=_[_0x2567('0x34')](_0x415bf9[_0x2567('0x30')],qs['fields'](_0x1b081d[_0x2567('0x31')]['fields']));_0x1d3b61[_0x2567('0x35')]=_0x1d3b61[_0x2567('0x35')][_0x2567('0x36')]?_0x1d3b61[_0x2567('0x35')]:_0x415bf9[_0x2567('0x30')];if(!_0x1b081d[_0x2567('0x31')]['hasOwnProperty']('nolimit')){_0x1d3b61[_0x2567('0x20')]=qs[_0x2567('0x20')](_0x1b081d[_0x2567('0x31')]['limit']);_0x1d3b61[_0x2567('0x1e')]=qs[_0x2567('0x1e')](_0x1b081d['query']['offset']);}_0x1d3b61[_0x2567('0x37')]=qs[_0x2567('0x38')](_0x1b081d[_0x2567('0x31')][_0x2567('0x38')]);_0x1d3b61[_0x2567('0x39')]=qs['filters'](_[_0x2567('0x3a')](_0x1b081d[_0x2567('0x31')],_0x415bf9[_0x2567('0x33')]),_0x368ab6);if(_0x1b081d['query'][_0x2567('0x3b')]){_0x1d3b61[_0x2567('0x39')]=_['merge'](_0x1d3b61[_0x2567('0x39')],{'$or':_['map'](_0x368ab6,function(_0x4c0b8c){if(_0x4c0b8c[_0x2567('0x2e')]!==_0x2567('0x3c')){var _0x5d0293={};_0x5d0293[_0x4c0b8c[_0x2567('0x29')]]={'$like':'%'+_0x1b081d['query'][_0x2567('0x3b')]+'%'};return _0x5d0293;}})});}_0x1d3b61=_['merge']({},_0x1d3b61,_0x1b081d[_0x2567('0x3d')]);var _0x12a84e={'where':_0x1d3b61[_0x2567('0x39')]};return db['FreshsalesAccount']['count'](_0x12a84e)[_0x2567('0x26')](function(_0x2eeb1c){_0x45cd0e[_0x2567('0x21')]=_0x2eeb1c;if(_0x1b081d[_0x2567('0x31')][_0x2567('0x3e')]){_0x1d3b61[_0x2567('0x3f')]=[{'all':!![]}];}return db[_0x2567('0x40')][_0x2567('0x41')](_0x1d3b61);})[_0x2567('0x26')](function(_0x436637){_0x45cd0e[_0x2567('0x42')]=_0x436637;return _0x45cd0e;})[_0x2567('0x26')](respondWithFilteredResult(_0x43ce59,_0x1d3b61))[_0x2567('0x43')](handleError(_0x43ce59,null));};exports[_0x2567('0x44')]=function(_0x1f1a1d,_0xc5df1c){var _0xe116bc={'raw':![],'where':{'id':_0x1f1a1d[_0x2567('0x45')]['id']}},_0x2a9718={};_0x2a9718[_0x2567('0x30')]=_['keys'](db['FreshsalesAccount'][_0x2567('0x2c')]);_0x2a9718[_0x2567('0x31')]=_[_0x2567('0x32')](_0x1f1a1d[_0x2567('0x31')]);_0x2a9718[_0x2567('0x33')]=_[_0x2567('0x34')](_0x2a9718[_0x2567('0x30')],_0x2a9718['query']);_0xe116bc[_0x2567('0x35')]=_[_0x2567('0x34')](_0x2a9718[_0x2567('0x30')],qs['fields'](_0x1f1a1d[_0x2567('0x31')][_0x2567('0x46')]));_0xe116bc[_0x2567('0x35')]=_0xe116bc[_0x2567('0x35')][_0x2567('0x36')]?_0xe116bc[_0x2567('0x35')]:_0x2a9718[_0x2567('0x30')];if(_0x1f1a1d[_0x2567('0x31')][_0x2567('0x3e')]){_0xe116bc[_0x2567('0x3f')]=[{'all':!![]}];}_0xe116bc=_['merge']({},_0xe116bc,_0x1f1a1d[_0x2567('0x3d')]);return db[_0x2567('0x40')]['find'](_0xe116bc)[_0x2567('0x26')](handleEntityNotFound(_0xc5df1c,null))[_0x2567('0x26')](respondWithResult(_0xc5df1c,null))['catch'](handleError(_0xc5df1c,null));};exports[_0x2567('0x47')]=function(_0xf22635,_0x4ea247){return db[_0x2567('0x40')][_0x2567('0x47')](_0xf22635[_0x2567('0x48')],{})[_0x2567('0x26')](respondWithResult(_0x4ea247,0xc9))[_0x2567('0x43')](handleError(_0x4ea247,null));};exports[_0x2567('0x49')]=function(_0x25417a,_0x1bb662){if(_0x25417a[_0x2567('0x48')]['id']){delete _0x25417a[_0x2567('0x48')]['id'];}return db[_0x2567('0x40')][_0x2567('0x4a')]({'where':{'id':_0x25417a['params']['id']}})[_0x2567('0x26')](handleEntityNotFound(_0x1bb662,null))[_0x2567('0x26')](saveUpdates(_0x25417a[_0x2567('0x48')],null))['then'](respondWithResult(_0x1bb662,null))['catch'](handleError(_0x1bb662,null));};exports[_0x2567('0x4b')]=function(_0x25f11d,_0x3a7436){return db[_0x2567('0x40')]['find']({'where':{'id':_0x25f11d[_0x2567('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a7436,null))[_0x2567('0x26')](removeEntity(_0x3a7436,null))[_0x2567('0x43')](handleError(_0x3a7436,null));};exports['getConfigurations']=function(_0x2028e8,_0x360ba5,_0x55d12c){var _0x2215c7={};var _0x106cf1={};var _0x7f6fd8;var _0x2b763b;return db[_0x2567('0x40')][_0x2567('0x4c')]({'where':{'id':_0x2028e8[_0x2567('0x45')]['id']}})['then'](handleEntityNotFound(_0x360ba5,null))[_0x2567('0x26')](function(_0x3e02cb){if(_0x3e02cb){_0x7f6fd8=_0x3e02cb;_0x106cf1[_0x2567('0x30')]=_[_0x2567('0x32')](db[_0x2567('0x4d')][_0x2567('0x2c')]);_0x106cf1['query']=_['keys'](_0x2028e8['query']);_0x106cf1[_0x2567('0x33')]=_[_0x2567('0x34')](_0x106cf1[_0x2567('0x30')],_0x106cf1[_0x2567('0x31')]);_0x2215c7[_0x2567('0x35')]=_[_0x2567('0x34')](_0x106cf1['model'],qs[_0x2567('0x46')](_0x2028e8['query'][_0x2567('0x46')]));_0x2215c7['attributes']=_0x2215c7[_0x2567('0x35')][_0x2567('0x36')]?_0x2215c7[_0x2567('0x35')]:_0x106cf1[_0x2567('0x30')];_0x2215c7[_0x2567('0x37')]=qs[_0x2567('0x38')](_0x2028e8[_0x2567('0x31')][_0x2567('0x38')]);_0x2215c7['where']=qs[_0x2567('0x33')](_['pick'](_0x2028e8[_0x2567('0x31')],_0x106cf1[_0x2567('0x33')]));if(_0x2028e8['query'][_0x2567('0x3b')]){_0x2215c7[_0x2567('0x39')]=_['merge'](_0x2215c7[_0x2567('0x39')],{'$or':_[_0x2567('0x2b')](_0x2215c7['attributes'],function(_0x383b0a){var _0x5bdd73={};_0x5bdd73[_0x383b0a]={'$like':'%'+_0x2028e8[_0x2567('0x31')]['filter']+'%'};return _0x5bdd73;})});}_0x2215c7=_[_0x2567('0x4e')]({},_0x2215c7,_0x2028e8[_0x2567('0x3d')]);return _0x7f6fd8['getConfigurations'](_0x2215c7);}})[_0x2567('0x26')](function(_0x41f40d){if(_0x41f40d){_0x2b763b=_0x41f40d[_0x2567('0x36')];if(!_0x2028e8[_0x2567('0x31')][_0x2567('0x4f')](_0x2567('0x50'))){_0x2215c7[_0x2567('0x20')]=qs[_0x2567('0x20')](_0x2028e8[_0x2567('0x31')][_0x2567('0x20')]);_0x2215c7['offset']=qs['offset'](_0x2028e8[_0x2567('0x31')]['offset']);}return _0x7f6fd8['getConfigurations'](_0x2215c7);}})[_0x2567('0x26')](function(_0x234f9f){if(_0x234f9f){return _0x234f9f?{'count':_0x2b763b,'rows':_0x234f9f}:null;}})[_0x2567('0x26')](respondWithResult(_0x360ba5,null))['catch'](handleError(_0x360ba5,null));};exports[_0x2567('0x51')]=function(_0x4a4b7e,_0x5cecbb,_0x1d189b){if(_0x4a4b7e['body']['id']){delete _0x4a4b7e['body']['id'];}return db[_0x2567('0x40')]['findOne']({'where':{'id':_0x4a4b7e[_0x2567('0x45')]['id']}})[_0x2567('0x26')](handleEntityNotFound(_0x5cecbb,null))[_0x2567('0x26')](function(_0x1da176){if(_0x1da176){_0x4a4b7e['body'][_0x2567('0x52')]=_0x1da176['id'];_0x4a4b7e['body']['Subjects']=integrations['getSubjects'](_0x4a4b7e['body'][_0x2567('0x53')],_0x4a4b7e[_0x2567('0x48')][_0x2567('0x2e')]);_0x4a4b7e[_0x2567('0x48')][_0x2567('0x54')]=integrations[_0x2567('0x55')](_0x4a4b7e[_0x2567('0x48')][_0x2567('0x53')],_0x4a4b7e['body'][_0x2567('0x2e')]);return db['FreshsalesConfiguration'][_0x2567('0x47')](_0x4a4b7e[_0x2567('0x48')],{'include':[{'model':db[_0x2567('0x56')],'as':_0x2567('0x57')},{'model':db[_0x2567('0x56')],'as':_0x2567('0x54')}]});}return null;})['then'](respondWithResult(_0x5cecbb,null))[_0x2567('0x43')](handleError(_0x5cecbb,null));};exports[_0x2567('0x58')]=function(_0x4d6b55,_0x28f9a5,_0x524cdc){var _0x220eee='';var _0x1acb3c='';return db[_0x2567('0x40')][_0x2567('0x4c')]({'where':{'id':_0x4d6b55[_0x2567('0x45')]['id']},'attributes':['id',_0x2567('0x59'),_0x2567('0x5a'),_0x2567('0x5b')]})['then'](handleEntityNotFound(_0x28f9a5,null))[_0x2567('0x26')](function(_0x14b179){if(_0x14b179){_0x1acb3c=_0x14b179[_0x2567('0x59')];_0x220eee=_0x14b179['remoteUri'];var _0x2c9690=_0x14b179['remoteUri'][_0x2567('0x5c')](-0x1);if(_0x2c9690==='/'){_0x220eee=_0x220eee[_0x2567('0x5d')](0x0,_0x220eee['lastIndexOf'](_0x2c9690));}return rp({'method':_0x2567('0x5e'),'uri':util['format'](_0x2567('0x5f'),_0x220eee,_0x2567('0x60')),'headers':{'Authorization':_0x2567('0x61')+_0x14b179[_0x2567('0x5b')]},'json':!![]});}})[_0x2567('0x26')](function(_0x21be78){if(_0x21be78){var _0x556c91=_0x21be78[_0x2567('0x62')];var _0x35d77c=![];var _0x40b3b6=null;for(_0x40b3b6=0x0;_0x40b3b6<_0x556c91[_0x2567('0x36')];_0x40b3b6++){if(_0x556c91[_0x40b3b6][_0x2567('0x63')]===_0x1acb3c){_0x35d77c=!![];}}if(_0x35d77c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2567('0x64')});}}})[_0x2567('0x26')](respondWithResult(_0x28f9a5,null))['catch'](function(_0x5f38a0){var _0x23c3e3=_0x4d6b55[_0x2567('0x31')][_0x2567('0x65')]?0x1f4:_0x5f38a0[_0x2567('0x66')]||0x1f4;logger[_0x2567('0x67')](_0x2567('0x68'),_0x2567('0x58'),_0x23c3e3,JSON['stringify'](_0x5f38a0));delete _0x5f38a0['name'];if(_0x23c3e3===0x191){_0x23c3e3=0x190;}_0x28f9a5[_0x2567('0x1d')](_0x23c3e3)['send'](_0x4d6b55[_0x2567('0x31')][_0x2567('0x65')]?{'message':_0x2567('0x69'),'statusCode':_0x5f38a0[_0x2567('0x66')]}:_0x5f38a0);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e3c1908..7e45aef 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 _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0xca7350,_0x1574a3){var _0x8860f8=function(_0x46b165){while(--_0x46b165){_0xca7350['push'](_0xca7350['shift']());}};_0x8860f8(++_0x1574a3);}(_0x6050,0x196));var _0x0605=function(_0x3b1016,_0x98f11f){_0x3b1016=_0x3b1016-0x0;var _0x5c5bd1=_0x6050[_0x3b1016];return _0x5c5bd1;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd78d96,_0x578623){return _0xd78d96['define']('FreshsalesAccount',attributes,{'tableName':_0x0605('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5430=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0x5430,0x10c));var _0x0543=function(_0x1d32be,_0x357aae){_0x1d32be=_0x1d32be-0x0;var _0x18c7ea=_0x5430[_0x1d32be];return _0x18c7ea;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0543('0x7'));module[_0x0543('0x8')]=function(_0x9754ba,_0x319568){return _0x9754ba[_0x0543('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x0543('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 07a8a30..b04247a 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 _0x32f4=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','model','map','find','ShowFreshsalesAccount'];(function(_0x205ea9,_0x1cbfc8){var _0x221e26=function(_0x5bf470){while(--_0x5bf470){_0x205ea9['push'](_0x205ea9['shift']());}};_0x221e26(++_0x1cbfc8);}(_0x32f4,0x154));var _0x432f=function(_0xcca263,_0x4d8686){_0xcca263=_0xcca263-0x0;var _0x1de5ed=_0x32f4[_0xcca263];return _0x1de5ed;};'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']('FreshsalesAccount,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('FreshsalesAccount,\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);});});}exports[_0x432f('0x16')]=function(_0x243cf){var _0x3cd5da=this;return new Promise(function(_0x129582,_0x5ae24e){return db[_0x432f('0x17')]['findAll']({'raw':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x19')]===undefined?!![]:![]:!![],'where':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1a')]||null:null,'attributes':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1b')]||null:null,'limit':_0x243cf[_0x432f('0x18')]?_0x243cf[_0x432f('0x18')][_0x432f('0x1c')]||null:null,'include':_0x243cf['options']?_0x243cf['options'][_0x432f('0x1d')]?_['map'](_0x243cf[_0x432f('0x18')]['include'],function(_0x37f136){return{'model':db[_0x37f136[_0x432f('0x1e')]],'as':_0x37f136['as'],'attributes':_0x37f136[_0x432f('0x1b')],'include':_0x37f136[_0x432f('0x1d')]?_[_0x432f('0x1f')](_0x37f136[_0x432f('0x1d')],function(_0x59f352){return{'model':db[_0x59f352[_0x432f('0x1e')]],'as':_0x59f352['as'],'attributes':_0x59f352[_0x432f('0x1b')],'include':_0x59f352['include']?_[_0x432f('0x1f')](_0x59f352[_0x432f('0x1d')],function(_0x2bcbb4){return{'model':db[_0x2bcbb4[_0x432f('0x1e')]],'as':_0x2bcbb4['as'],'attributes':_0x2bcbb4[_0x432f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x432f('0xb')](function(_0x138a6a){logger['info'](_0x432f('0x16'),_0x243cf);logger['debug'](_0x432f('0x16'),_0x243cf,JSON['stringify'](_0x138a6a));_0x129582(_0x138a6a);})[_0x432f('0x15')](function(_0x5a2c14){logger[_0x432f('0x11')]('GetFreshsalesAccount',_0x5a2c14[_0x432f('0x13')],_0x243cf);_0x5ae24e(_0x3cd5da[_0x432f('0x11')](0x1f4,_0x5a2c14[_0x432f('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x6a116e){var _0x24406a=this;return new Promise(function(_0x48139b,_0x5ee0fa){return db[_0x432f('0x17')][_0x432f('0x20')]({'raw':_0x6a116e[_0x432f('0x18')]?_0x6a116e[_0x432f('0x18')][_0x432f('0x19')]===undefined?!![]:![]:!![],'where':_0x6a116e[_0x432f('0x18')]?_0x6a116e['options']['where']||null:null,'attributes':_0x6a116e[_0x432f('0x18')]?_0x6a116e[_0x432f('0x18')][_0x432f('0x1b')]||null:null,'include':_0x6a116e['options']?_0x6a116e[_0x432f('0x18')][_0x432f('0x1d')]?_[_0x432f('0x1f')](_0x6a116e[_0x432f('0x18')][_0x432f('0x1d')],function(_0x3ad632){return{'model':db[_0x3ad632[_0x432f('0x1e')]],'as':_0x3ad632['as'],'attributes':_0x3ad632[_0x432f('0x1b')],'include':_0x3ad632['include']?_['map'](_0x3ad632[_0x432f('0x1d')],function(_0xa5e0d){return{'model':db[_0xa5e0d['model']],'as':_0xa5e0d['as'],'attributes':_0xa5e0d['attributes'],'include':_0xa5e0d['include']?_[_0x432f('0x1f')](_0xa5e0d[_0x432f('0x1d')],function(_0x5648a7){return{'model':db[_0x5648a7[_0x432f('0x1e')]],'as':_0x5648a7['as'],'attributes':_0x5648a7[_0x432f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x432f('0xb')](function(_0x5903f6){logger[_0x432f('0xc')](_0x432f('0x21'),_0x6a116e);logger['debug'](_0x432f('0x21'),_0x6a116e,JSON[_0x432f('0x10')](_0x5903f6));_0x48139b(_0x5903f6);})['catch'](function(_0x28da2e){logger[_0x432f('0x11')](_0x432f('0x21'),_0x28da2e[_0x432f('0x13')],_0x6a116e);_0x5ee0fa(_0x24406a[_0x432f('0x11')](0x1f4,_0x28da2e[_0x432f('0x13')]));});});}; \ No newline at end of file +var _0xafb9=['ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','limit','map','attributes','include','model','debug'];(function(_0x1d9536,_0x38415e){var _0x534207=function(_0x4fcde2){while(--_0x4fcde2){_0x1d9536['push'](_0x1d9536['shift']());}};_0x534207(++_0x38415e);}(_0xafb9,0x68));var _0x9afb=function(_0x4758ee,_0x229746){_0x4758ee=_0x4758ee-0x0;var _0x13c007=_0xafb9[_0x4758ee];return _0x13c007;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548b24,_0x556880,_0x4c0e9d){return new BPromise(function(_0x1edf77,_0x20b8c1){return client['request'](_0x548b24,_0x4c0e9d)[_0x9afb('0xb')](function(_0x3e0264){logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x556880,_0x9afb('0xe'),JSON[_0x9afb('0xf')](_0x3e0264));if(_0x3e0264[_0x9afb('0x10')]){if(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x11')]===0x1f4){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);return _0x20b8c1(_0x3e0264[_0x9afb('0x10')]['message']);}logger[_0x9afb('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x556880,_0x3e0264['error'][_0x9afb('0x12')]);return _0x1edf77(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);}else{logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));_0x1edf77(_0x3e0264[_0x9afb('0x13')]['message']);}})[_0x9afb('0x14')](function(_0x2145c2){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x2145c2);_0x20b8c1(_0x2145c2);});});}exports[_0x9afb('0x15')]=function(_0x508433){var _0x201ff4=this;return new Promise(function(_0x50a7e4,_0x3fdb34){return db[_0x9afb('0x16')]['findAll']({'raw':_0x508433['options']?_0x508433[_0x9afb('0x17')][_0x9afb('0x18')]===undefined?!![]:![]:!![],'where':_0x508433[_0x9afb('0x17')]?_0x508433[_0x9afb('0x17')][_0x9afb('0x19')]||null:null,'attributes':_0x508433['options']?_0x508433[_0x9afb('0x17')]['attributes']||null:null,'limit':_0x508433['options']?_0x508433[_0x9afb('0x17')][_0x9afb('0x1a')]||null:null,'include':_0x508433[_0x9afb('0x17')]?_0x508433[_0x9afb('0x17')]['include']?_[_0x9afb('0x1b')](_0x508433[_0x9afb('0x17')]['include'],function(_0x571bd9){return{'model':db[_0x571bd9['model']],'as':_0x571bd9['as'],'attributes':_0x571bd9[_0x9afb('0x1c')],'include':_0x571bd9['include']?_[_0x9afb('0x1b')](_0x571bd9[_0x9afb('0x1d')],function(_0x50a919){return{'model':db[_0x50a919[_0x9afb('0x1e')]],'as':_0x50a919['as'],'attributes':_0x50a919[_0x9afb('0x1c')],'include':_0x50a919[_0x9afb('0x1d')]?_[_0x9afb('0x1b')](_0x50a919['include'],function(_0x348255){return{'model':db[_0x348255['model']],'as':_0x348255['as'],'attributes':_0x348255[_0x9afb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5692fa){logger[_0x9afb('0xc')](_0x9afb('0x15'),_0x508433);logger[_0x9afb('0x1f')](_0x9afb('0x15'),_0x508433,JSON[_0x9afb('0xf')](_0x5692fa));_0x50a7e4(_0x5692fa);})[_0x9afb('0x14')](function(_0x46673d){logger['error']('GetFreshsalesAccount',_0x46673d[_0x9afb('0x12')],_0x508433);_0x3fdb34(_0x201ff4[_0x9afb('0x10')](0x1f4,_0x46673d['message']));});});};exports[_0x9afb('0x20')]=function(_0x2f388c){var _0x5560bd=this;return new Promise(function(_0x1b9f18,_0xc220e9){return db[_0x9afb('0x16')][_0x9afb('0x21')]({'raw':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x18')]===undefined?!![]:![]:!![],'where':_0x2f388c[_0x9afb('0x17')]?_0x2f388c['options']['where']||null:null,'attributes':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x1c')]||null:null,'include':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x1d')]?_[_0x9afb('0x1b')](_0x2f388c['options']['include'],function(_0x67d63a){return{'model':db[_0x67d63a[_0x9afb('0x1e')]],'as':_0x67d63a['as'],'attributes':_0x67d63a['attributes'],'include':_0x67d63a[_0x9afb('0x1d')]?_['map'](_0x67d63a[_0x9afb('0x1d')],function(_0xc59d55){return{'model':db[_0xc59d55['model']],'as':_0xc59d55['as'],'attributes':_0xc59d55[_0x9afb('0x1c')],'include':_0xc59d55['include']?_[_0x9afb('0x1b')](_0xc59d55[_0x9afb('0x1d')],function(_0x45c57f){return{'model':db[_0x45c57f[_0x9afb('0x1e')]],'as':_0x45c57f['as'],'attributes':_0x45c57f[_0x9afb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9afb('0xb')](function(_0x19227f){logger[_0x9afb('0xc')]('ShowFreshsalesAccount',_0x2f388c);logger[_0x9afb('0x1f')]('ShowFreshsalesAccount',_0x2f388c,JSON[_0x9afb('0xf')](_0x19227f));_0x1b9f18(_0x19227f);})[_0x9afb('0x14')](function(_0x3c5231){logger[_0x9afb('0x10')](_0x9afb('0x20'),_0x3c5231[_0x9afb('0x12')],_0x2f388c);_0xc220e9(_0x5560bd[_0x9afb('0x10')](0x1f4,_0x3c5231[_0x9afb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index bc723a7..f5aff94 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 _0x6390=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy'];(function(_0x55f41a,_0xe786db){var _0x5707ed=function(_0x1bc54b){while(--_0x1bc54b){_0x55f41a['push'](_0x55f41a['shift']());}};_0x5707ed(++_0xe786db);}(_0x6390,0x6e));var _0x0639=function(_0x244108,_0x5c76a9){_0x244108=_0x244108-0x0;var _0x255cf4=_0x6390[_0x244108];return _0x255cf4;};'use strict';var multer=require(_0x0639('0x0'));var util=require('util');var path=require(_0x0639('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0639('0x2')]();var fs_extra=require(_0x0639('0x3'));var auth=require(_0x0639('0x4'));var interaction=require(_0x0639('0x5'));var config=require(_0x0639('0x6'));var controller=require(_0x0639('0x7'));router[_0x0639('0x8')]('/',auth[_0x0639('0x9')](),controller[_0x0639('0xa')]);router['get'](_0x0639('0xb'),auth['isAuthenticated'](),controller[_0x0639('0xc')]);router[_0x0639('0x8')](_0x0639('0xd'),auth['isAuthenticated'](),controller[_0x0639('0xe')]);router['get'](_0x0639('0xf'),auth[_0x0639('0x9')](),controller[_0x0639('0x10')]);router['get']('/:id/fields',auth[_0x0639('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x0639('0x11')]);router[_0x0639('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0639('0x13')]);router[_0x0639('0x14')](_0x0639('0xb'),auth[_0x0639('0x9')](),controller[_0x0639('0x15')]);module['exports']=router; \ No newline at end of file +var _0xad00=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','/:id','update','delete'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xad00,0x177));var _0x0ad0=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xad00[_0x43776a];return _0x18eb8f;};'use strict';var multer=require('multer');var util=require(_0x0ad0('0x0'));var path=require(_0x0ad0('0x1'));var timeout=require(_0x0ad0('0x2'));var express=require(_0x0ad0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0ad0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0ad0('0x5'));var controller=require(_0x0ad0('0x6'));router[_0x0ad0('0x7')]('/',auth[_0x0ad0('0x8')](),controller[_0x0ad0('0x9')]);router[_0x0ad0('0x7')]('/:id',auth[_0x0ad0('0x8')](),controller[_0x0ad0('0xa')]);router[_0x0ad0('0x7')](_0x0ad0('0xb'),auth[_0x0ad0('0x8')](),controller[_0x0ad0('0xc')]);router[_0x0ad0('0x7')]('/:id/descriptions',auth[_0x0ad0('0x8')](),controller[_0x0ad0('0xd')]);router[_0x0ad0('0x7')](_0x0ad0('0xe'),auth[_0x0ad0('0x8')](),controller[_0x0ad0('0xf')]);router[_0x0ad0('0x10')]('/',auth[_0x0ad0('0x8')](),controller[_0x0ad0('0x11')]);router['put'](_0x0ad0('0x12'),auth[_0x0ad0('0x8')](),controller[_0x0ad0('0x13')]);router[_0x0ad0('0x14')](_0x0ad0('0x12'),auth[_0x0ad0('0x8')](),controller['destroy']);module[_0x0ad0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6894af9..a4a657f 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 _0x1a91=['STRING','sequelize','exports'];(function(_0x549160,_0x490e7d){var _0x24e7ed=function(_0xadf799){while(--_0xadf799){_0x549160['push'](_0x549160['shift']());}};_0x24e7ed(++_0x490e7d);}(_0x1a91,0x1b4));var _0x11a9=function(_0x46ff4a,_0x1b501b){_0x46ff4a=_0x46ff4a-0x0;var _0x2a2a31=_0x1a91[_0x46ff4a];return _0x2a2a31;};'use strict';var Sequelize=require(_0x11a9('0x0'));module[_0x11a9('0x1')]={'name':{'type':Sequelize[_0x11a9('0x2')]},'description':{'type':Sequelize[_0x11a9('0x2')]}}; \ No newline at end of file +var _0x716b=['STRING'];(function(_0x15ce26,_0x44893d){var _0x51588f=function(_0x115e5c){while(--_0x115e5c){_0x15ce26['push'](_0x15ce26['shift']());}};_0x51588f(++_0x44893d);}(_0x716b,0xda));var _0xb716=function(_0x58f401,_0x1136c9){_0x58f401=_0x58f401-0x0;var _0x146e3d=_0x716b[_0x58f401];return _0x146e3d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb716('0x0')]},'description':{'type':Sequelize[_0xb716('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c1f7465..5d7679c 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 _0x7504=['rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','filters','find','create','body','getSubjects','findOne','FreshsalesField','length','order','sort','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','map','FreshsalesConfiguration'];(function(_0x599be2,_0x452992){var _0x9a9f96=function(_0x1e3316){while(--_0x1e3316){_0x599be2['push'](_0x599be2['shift']());}};_0x9a9f96(++_0x452992);}(_0x7504,0x1b3));var _0x4750=function(_0x187712,_0x161fe2){_0x187712=_0x187712-0x0;var _0x1c718c=_0x7504[_0x187712];return _0x1c718c;};'use strict';var emlformat=require(_0x4750('0x0'));var rimraf=require(_0x4750('0x1'));var zipdir=require(_0x4750('0x2'));var jsonpatch=require(_0x4750('0x3'));var rp=require(_0x4750('0x4'));var moment=require(_0x4750('0x5'));var BPromise=require(_0x4750('0x6'));var Mustache=require(_0x4750('0x7'));var util=require('util');var path=require(_0x4750('0x8'));var sox=require(_0x4750('0x9'));var csv=require(_0x4750('0xa'));var ejs=require(_0x4750('0xb'));var fs=require('fs');var fs_extra=require(_0x4750('0xc'));var _=require(_0x4750('0xd'));var squel=require(_0x4750('0xe'));var crypto=require(_0x4750('0xf'));var jsforce=require(_0x4750('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4750('0xa'));var querystring=require(_0x4750('0x11'));var Papa=require(_0x4750('0x12'));var Redis=require('ioredis');var authService=require(_0x4750('0x13'));var qs=require(_0x4750('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4750('0x15'));var logger=require('../../config/logger')(_0x4750('0x16'));var utils=require(_0x4750('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4750('0x18'));var db=require(_0x4750('0x19'))['db'];function respondWithStatusCode(_0x420f14,_0xa7bf95){_0xa7bf95=_0xa7bf95||0xcc;return function(_0x55022c){if(_0x55022c){return _0x420f14[_0x4750('0x1a')](_0xa7bf95);}return _0x420f14[_0x4750('0x1b')](_0xa7bf95)['end']();};}function respondWithResult(_0x12035a,_0x1edc22){_0x1edc22=_0x1edc22||0xc8;return function(_0x1bb6b8){if(_0x1bb6b8){return _0x12035a[_0x4750('0x1b')](_0x1edc22)[_0x4750('0x1c')](_0x1bb6b8);}};}function respondWithFilteredResult(_0x49f662,_0x5d7d53){return function(_0x32034c){if(_0x32034c){var _0x22c357=typeof _0x5d7d53[_0x4750('0x1d')]==='undefined'&&typeof _0x5d7d53[_0x4750('0x1e')]===_0x4750('0x1f');var _0x335811=_0x32034c[_0x4750('0x20')];var _0x579777=_0x22c357?0x0:_0x5d7d53[_0x4750('0x1d')];var _0x1e4d83=_0x22c357?_0x32034c[_0x4750('0x20')]:_0x5d7d53[_0x4750('0x1d')]+_0x5d7d53[_0x4750('0x1e')];var _0x543bd8;if(_0x1e4d83>=_0x335811){_0x1e4d83=_0x335811;_0x543bd8=0xc8;}else{_0x543bd8=0xce;}_0x49f662[_0x4750('0x1b')](_0x543bd8);return _0x49f662['set'](_0x4750('0x21'),_0x579777+'-'+_0x1e4d83+'/'+_0x335811)[_0x4750('0x1c')](_0x32034c);}return null;};}function patchUpdates(_0x54f71b){return function(_0x5439fb){try{jsonpatch[_0x4750('0x22')](_0x5439fb,_0x54f71b,!![]);}catch(_0x8bbe59){return BPromise[_0x4750('0x23')](_0x8bbe59);}return _0x5439fb['save']();};}function saveUpdates(_0x525219,_0x58b349){return function(_0x3fcc20){if(_0x3fcc20){return _0x3fcc20[_0x4750('0x24')](_0x525219)['then'](function(_0x3dbd91){return _0x3dbd91;});}return null;};}function removeEntity(_0x493986,_0xb7cb0a){return function(_0x2334ac){if(_0x2334ac){return _0x2334ac[_0x4750('0x25')]()[_0x4750('0x26')](function(){_0x493986['status'](0xcc)[_0x4750('0x27')]();});}};}function handleEntityNotFound(_0x1e7cc1,_0x2803bc){return function(_0x170aae){if(!_0x170aae){_0x1e7cc1[_0x4750('0x1a')](0x194);}return _0x170aae;};}function handleError(_0x1cfc48,_0x34672c){_0x34672c=_0x34672c||0x1f4;return function(_0x336063){logger[_0x4750('0x28')](_0x336063[_0x4750('0x29')]);if(_0x336063[_0x4750('0x2a')]){delete _0x336063[_0x4750('0x2a')];}_0x1cfc48[_0x4750('0x1b')](_0x34672c)['send'](_0x336063);};}exports['index']=function(_0x1f73f9,_0x3837fd){var _0x5754d7={},_0x434ae0={},_0x425186={'count':0x0,'rows':[]};var _0x4d8c17=_[_0x4750('0x2b')](db[_0x4750('0x2c')][_0x4750('0x2d')],function(_0x1875f2){return{'name':_0x1875f2[_0x4750('0x2e')],'type':_0x1875f2[_0x4750('0x2f')]['key']};});_0x434ae0[_0x4750('0x30')]=_['map'](_0x4d8c17,_0x4750('0x2a'));_0x434ae0[_0x4750('0x31')]=_[_0x4750('0x32')](_0x1f73f9[_0x4750('0x31')]);_0x434ae0['filters']=_[_0x4750('0x33')](_0x434ae0['model'],_0x434ae0[_0x4750('0x31')]);_0x5754d7[_0x4750('0x34')]=_[_0x4750('0x33')](_0x434ae0[_0x4750('0x30')],qs[_0x4750('0x35')](_0x1f73f9[_0x4750('0x31')][_0x4750('0x35')]));_0x5754d7[_0x4750('0x34')]=_0x5754d7[_0x4750('0x34')]['length']?_0x5754d7[_0x4750('0x34')]:_0x434ae0[_0x4750('0x30')];if(!_0x1f73f9[_0x4750('0x31')][_0x4750('0x36')](_0x4750('0x37'))){_0x5754d7['limit']=qs[_0x4750('0x1e')](_0x1f73f9['query'][_0x4750('0x1e')]);_0x5754d7[_0x4750('0x1d')]=qs['offset'](_0x1f73f9[_0x4750('0x31')]['offset']);}_0x5754d7['order']=qs['sort'](_0x1f73f9[_0x4750('0x31')]['sort']);_0x5754d7[_0x4750('0x38')]=qs['filters'](_[_0x4750('0x39')](_0x1f73f9[_0x4750('0x31')],_0x434ae0['filters']),_0x4d8c17);if(_0x1f73f9['query'][_0x4750('0x3a')]){_0x5754d7[_0x4750('0x38')]=_[_0x4750('0x3b')](_0x5754d7[_0x4750('0x38')],{'$or':_['map'](_0x4d8c17,function(_0x332dcb){if(_0x332dcb[_0x4750('0x2f')]!==_0x4750('0x3c')){var _0x56c898={};_0x56c898[_0x332dcb[_0x4750('0x2a')]]={'$like':'%'+_0x1f73f9[_0x4750('0x31')][_0x4750('0x3a')]+'%'};return _0x56c898;}})});}_0x5754d7=_[_0x4750('0x3b')]({},_0x5754d7,_0x1f73f9[_0x4750('0x3d')]);var _0x29ae3e={'where':_0x5754d7[_0x4750('0x38')]};return db[_0x4750('0x2c')][_0x4750('0x20')](_0x29ae3e)['then'](function(_0x1c982d){_0x425186[_0x4750('0x20')]=_0x1c982d;if(_0x1f73f9[_0x4750('0x31')][_0x4750('0x3e')]){_0x5754d7[_0x4750('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x4750('0x40')](_0x5754d7);})[_0x4750('0x26')](function(_0x1429a4){_0x425186[_0x4750('0x41')]=_0x1429a4;return _0x425186;})['then'](respondWithFilteredResult(_0x3837fd,_0x5754d7))[_0x4750('0x42')](handleError(_0x3837fd,null));};exports['show']=function(_0x2dc956,_0x32a23a){var _0xc41dc9={'raw':![],'where':{'id':_0x2dc956[_0x4750('0x43')]['id']}},_0x295159={};_0x295159['model']=_[_0x4750('0x32')](db[_0x4750('0x2c')]['rawAttributes']);_0x295159[_0x4750('0x31')]=_['keys'](_0x2dc956[_0x4750('0x31')]);_0x295159[_0x4750('0x44')]=_[_0x4750('0x33')](_0x295159['model'],_0x295159[_0x4750('0x31')]);_0xc41dc9[_0x4750('0x34')]=_[_0x4750('0x33')](_0x295159[_0x4750('0x30')],qs[_0x4750('0x35')](_0x2dc956[_0x4750('0x31')][_0x4750('0x35')]));_0xc41dc9[_0x4750('0x34')]=_0xc41dc9[_0x4750('0x34')]['length']?_0xc41dc9[_0x4750('0x34')]:_0x295159[_0x4750('0x30')];if(_0x2dc956['query'][_0x4750('0x3e')]){_0xc41dc9['include']=[{'all':!![]}];}_0xc41dc9=_[_0x4750('0x3b')]({},_0xc41dc9,_0x2dc956[_0x4750('0x3d')]);return db[_0x4750('0x2c')][_0x4750('0x45')](_0xc41dc9)['then'](handleEntityNotFound(_0x32a23a,null))[_0x4750('0x26')](respondWithResult(_0x32a23a,null))[_0x4750('0x42')](handleError(_0x32a23a,null));};exports['create']=function(_0x27d9fe,_0x21b7b1){return db['FreshsalesConfiguration'][_0x4750('0x46')](_0x27d9fe[_0x4750('0x47')],{})['then'](respondWithResult(_0x21b7b1,0xc9))[_0x4750('0x42')](handleError(_0x21b7b1,null));};exports[_0x4750('0x24')]=function(_0x3f37d7,_0xe095f6){if(_0x3f37d7[_0x4750('0x47')]['id']){delete _0x3f37d7[_0x4750('0x47')]['id'];}return db[_0x4750('0x2c')][_0x4750('0x45')]({'where':{'id':_0x3f37d7[_0x4750('0x43')]['id']}})[_0x4750('0x26')](handleEntityNotFound(_0xe095f6,null))[_0x4750('0x26')](saveUpdates(_0x3f37d7[_0x4750('0x47')],null))['then'](respondWithResult(_0xe095f6,null))[_0x4750('0x42')](handleError(_0xe095f6,null));};exports[_0x4750('0x25')]=function(_0x4e5095,_0x16cb33){return db[_0x4750('0x2c')][_0x4750('0x45')]({'where':{'id':_0x4e5095[_0x4750('0x43')]['id']}})['then'](handleEntityNotFound(_0x16cb33,null))[_0x4750('0x26')](removeEntity(_0x16cb33,null))[_0x4750('0x42')](handleError(_0x16cb33,null));};exports[_0x4750('0x48')]=function(_0x134b73,_0x554f25,_0x59f2b9){var _0x1242f9={};var _0x484560={};var _0x83769e;var _0x78435;return db[_0x4750('0x2c')][_0x4750('0x49')]({'where':{'id':_0x134b73[_0x4750('0x43')]['id']}})[_0x4750('0x26')](handleEntityNotFound(_0x554f25,null))[_0x4750('0x26')](function(_0x2f481e){if(_0x2f481e){_0x83769e=_0x2f481e;_0x484560[_0x4750('0x30')]=_[_0x4750('0x32')](db[_0x4750('0x4a')][_0x4750('0x2d')]);_0x484560['query']=_['keys'](_0x134b73['query']);_0x484560[_0x4750('0x44')]=_[_0x4750('0x33')](_0x484560[_0x4750('0x30')],_0x484560[_0x4750('0x31')]);_0x1242f9[_0x4750('0x34')]=_[_0x4750('0x33')](_0x484560[_0x4750('0x30')],qs[_0x4750('0x35')](_0x134b73[_0x4750('0x31')][_0x4750('0x35')]));_0x1242f9[_0x4750('0x34')]=_0x1242f9[_0x4750('0x34')][_0x4750('0x4b')]?_0x1242f9[_0x4750('0x34')]:_0x484560[_0x4750('0x30')];_0x1242f9[_0x4750('0x4c')]=qs[_0x4750('0x4d')](_0x134b73['query'][_0x4750('0x4d')]);_0x1242f9[_0x4750('0x38')]=qs[_0x4750('0x44')](_[_0x4750('0x39')](_0x134b73[_0x4750('0x31')],_0x484560[_0x4750('0x44')]));if(_0x134b73[_0x4750('0x31')]['filter']){_0x1242f9[_0x4750('0x38')]=_['merge'](_0x1242f9[_0x4750('0x38')],{'$or':_['map'](_0x1242f9['attributes'],function(_0xe3a352){var _0x6a6abe={};_0x6a6abe[_0xe3a352]={'$like':'%'+_0x134b73[_0x4750('0x31')][_0x4750('0x3a')]+'%'};return _0x6a6abe;})});}_0x1242f9=_[_0x4750('0x3b')]({},_0x1242f9,_0x134b73[_0x4750('0x3d')]);return _0x83769e[_0x4750('0x48')](_0x1242f9);}})['then'](function(_0x478e23){if(_0x478e23){_0x78435=_0x478e23[_0x4750('0x4b')];if(!_0x134b73['query'][_0x4750('0x36')](_0x4750('0x37'))){_0x1242f9[_0x4750('0x1e')]=qs['limit'](_0x134b73[_0x4750('0x31')][_0x4750('0x1e')]);_0x1242f9['offset']=qs[_0x4750('0x1d')](_0x134b73['query'][_0x4750('0x1d')]);}return _0x83769e[_0x4750('0x48')](_0x1242f9);}})[_0x4750('0x26')](function(_0xddd8b0){if(_0xddd8b0){return _0xddd8b0?{'count':_0x78435,'rows':_0xddd8b0}:null;}})['then'](respondWithResult(_0x554f25,null))[_0x4750('0x42')](handleError(_0x554f25,null));};exports[_0x4750('0x4e')]=function(_0x14c456,_0x1222c5,_0x4088d3){var _0x37088d={};var _0x3f75b2={};var _0x36d5b1;var _0x518008;return db[_0x4750('0x2c')][_0x4750('0x49')]({'where':{'id':_0x14c456['params']['id']}})[_0x4750('0x26')](handleEntityNotFound(_0x1222c5,null))[_0x4750('0x26')](function(_0x1c92ae){if(_0x1c92ae){_0x36d5b1=_0x1c92ae;_0x3f75b2[_0x4750('0x30')]=_[_0x4750('0x32')](db[_0x4750('0x4a')][_0x4750('0x2d')]);_0x3f75b2[_0x4750('0x31')]=_['keys'](_0x14c456[_0x4750('0x31')]);_0x3f75b2[_0x4750('0x44')]=_[_0x4750('0x33')](_0x3f75b2['model'],_0x3f75b2[_0x4750('0x31')]);_0x37088d[_0x4750('0x34')]=_[_0x4750('0x33')](_0x3f75b2[_0x4750('0x30')],qs[_0x4750('0x35')](_0x14c456['query'][_0x4750('0x35')]));_0x37088d[_0x4750('0x34')]=_0x37088d['attributes']['length']?_0x37088d[_0x4750('0x34')]:_0x3f75b2[_0x4750('0x30')];_0x37088d[_0x4750('0x4c')]=qs['sort'](_0x14c456[_0x4750('0x31')][_0x4750('0x4d')]);_0x37088d['where']=qs[_0x4750('0x44')](_[_0x4750('0x39')](_0x14c456[_0x4750('0x31')],_0x3f75b2['filters']));if(_0x14c456[_0x4750('0x31')][_0x4750('0x3a')]){_0x37088d[_0x4750('0x38')]=_['merge'](_0x37088d[_0x4750('0x38')],{'$or':_['map'](_0x37088d[_0x4750('0x34')],function(_0x364da1){var _0x44a718={};_0x44a718[_0x364da1]={'$like':'%'+_0x14c456[_0x4750('0x31')]['filter']+'%'};return _0x44a718;})});}_0x37088d=_['merge']({},_0x37088d,_0x14c456['options']);return _0x36d5b1['getDescriptions'](_0x37088d);}})['then'](function(_0x2d0784){if(_0x2d0784){_0x518008=_0x2d0784[_0x4750('0x4b')];if(!_0x14c456['query'][_0x4750('0x36')](_0x4750('0x37'))){_0x37088d[_0x4750('0x1e')]=qs[_0x4750('0x1e')](_0x14c456[_0x4750('0x31')][_0x4750('0x1e')]);_0x37088d['offset']=qs['offset'](_0x14c456[_0x4750('0x31')][_0x4750('0x1d')]);}return _0x36d5b1[_0x4750('0x4e')](_0x37088d);}})['then'](function(_0x579eb0){if(_0x579eb0){return _0x579eb0?{'count':_0x518008,'rows':_0x579eb0}:null;}})[_0x4750('0x26')](respondWithResult(_0x1222c5,null))[_0x4750('0x42')](handleError(_0x1222c5,null));};exports[_0x4750('0x4f')]=function(_0x3a39cb,_0x35dfb0,_0x30088e){var _0x18e2be={};var _0x4c6cb8={};var _0x31c9f8;var _0xec2854;return db[_0x4750('0x2c')][_0x4750('0x49')]({'where':{'id':_0x3a39cb[_0x4750('0x43')]['id']}})[_0x4750('0x26')](handleEntityNotFound(_0x35dfb0,null))[_0x4750('0x26')](function(_0x1244cb){if(_0x1244cb){_0x31c9f8=_0x1244cb;_0x4c6cb8[_0x4750('0x30')]=_[_0x4750('0x32')](db[_0x4750('0x4a')][_0x4750('0x2d')]);_0x4c6cb8[_0x4750('0x31')]=_[_0x4750('0x32')](_0x3a39cb['query']);_0x4c6cb8[_0x4750('0x44')]=_['intersection'](_0x4c6cb8[_0x4750('0x30')],_0x4c6cb8['query']);_0x18e2be[_0x4750('0x34')]=_['intersection'](_0x4c6cb8['model'],qs[_0x4750('0x35')](_0x3a39cb['query'][_0x4750('0x35')]));_0x18e2be[_0x4750('0x34')]=_0x18e2be['attributes']['length']?_0x18e2be[_0x4750('0x34')]:_0x4c6cb8[_0x4750('0x30')];_0x18e2be[_0x4750('0x4c')]=qs[_0x4750('0x4d')](_0x3a39cb['query'][_0x4750('0x4d')]);_0x18e2be[_0x4750('0x38')]=qs[_0x4750('0x44')](_['pick'](_0x3a39cb[_0x4750('0x31')],_0x4c6cb8[_0x4750('0x44')]));if(_0x3a39cb['query']['filter']){_0x18e2be['where']=_[_0x4750('0x3b')](_0x18e2be['where'],{'$or':_[_0x4750('0x2b')](_0x18e2be[_0x4750('0x34')],function(_0x363a0b){var _0x26d2da={};_0x26d2da[_0x363a0b]={'$like':'%'+_0x3a39cb[_0x4750('0x31')][_0x4750('0x3a')]+'%'};return _0x26d2da;})});}_0x18e2be=_['merge']({},_0x18e2be,_0x3a39cb[_0x4750('0x3d')]);return _0x31c9f8[_0x4750('0x4f')](_0x18e2be);}})[_0x4750('0x26')](function(_0x2d7ce5){if(_0x2d7ce5){_0xec2854=_0x2d7ce5[_0x4750('0x4b')];if(!_0x3a39cb[_0x4750('0x31')][_0x4750('0x36')](_0x4750('0x37'))){_0x18e2be[_0x4750('0x1e')]=qs[_0x4750('0x1e')](_0x3a39cb[_0x4750('0x31')][_0x4750('0x1e')]);_0x18e2be[_0x4750('0x1d')]=qs[_0x4750('0x1d')](_0x3a39cb['query'][_0x4750('0x1d')]);}return _0x31c9f8[_0x4750('0x4f')](_0x18e2be);}})[_0x4750('0x26')](function(_0x1fb85a){if(_0x1fb85a){return _0x1fb85a?{'count':_0xec2854,'rows':_0x1fb85a}:null;}})[_0x4750('0x26')](respondWithResult(_0x35dfb0,null))[_0x4750('0x42')](handleError(_0x35dfb0,null));}; \ No newline at end of file +var _0xcb8f=['moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','filter','includeAll','include','rows','catch','params','keys','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','rawAttributes','options','getFields','eml-format','zip-dir','fast-json-patch'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xcb8f,0xdb));var _0xfcb8=function(_0x52446c,_0x2f5a0d){_0x52446c=_0x52446c-0x0;var _0x32cd29=_0xcb8f[_0x52446c];return _0x32cd29;};'use strict';var emlformat=require(_0xfcb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcb8('0x1'));var jsonpatch=require(_0xfcb8('0x2'));var rp=require('request-promise');var moment=require(_0xfcb8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfcb8('0x4'));var util=require(_0xfcb8('0x5'));var path=require('path');var sox=require(_0xfcb8('0x6'));var csv=require('to-csv');var ejs=require(_0xfcb8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcb8('0x8'));var squel=require(_0xfcb8('0x9'));var crypto=require(_0xfcb8('0xa'));var jsforce=require(_0xfcb8('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfcb8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcb8('0xd'));var qs=require(_0xfcb8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcb8('0xf'))('api');var utils=require(_0xfcb8('0x10'));var config=require(_0xfcb8('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcb8('0x12'))['db'];function respondWithStatusCode(_0x4c3897,_0x3d8b5c){_0x3d8b5c=_0x3d8b5c||0xcc;return function(_0x41bfbe){if(_0x41bfbe){return _0x4c3897['sendStatus'](_0x3d8b5c);}return _0x4c3897[_0xfcb8('0x13')](_0x3d8b5c)[_0xfcb8('0x14')]();};}function respondWithResult(_0x1d6baf,_0x34de87){_0x34de87=_0x34de87||0xc8;return function(_0x4f9e29){if(_0x4f9e29){return _0x1d6baf[_0xfcb8('0x13')](_0x34de87)['json'](_0x4f9e29);}};}function respondWithFilteredResult(_0x39c0a2,_0x233b37){return function(_0x8a1532){if(_0x8a1532){var _0x2a2b85=typeof _0x233b37[_0xfcb8('0x15')]==='undefined'&&typeof _0x233b37['limit']===_0xfcb8('0x16');var _0x499dc2=_0x8a1532['count'];var _0x3a0278=_0x2a2b85?0x0:_0x233b37[_0xfcb8('0x15')];var _0x16b9c4=_0x2a2b85?_0x8a1532[_0xfcb8('0x17')]:_0x233b37[_0xfcb8('0x15')]+_0x233b37['limit'];var _0x5640b4;if(_0x16b9c4>=_0x499dc2){_0x16b9c4=_0x499dc2;_0x5640b4=0xc8;}else{_0x5640b4=0xce;}_0x39c0a2[_0xfcb8('0x13')](_0x5640b4);return _0x39c0a2[_0xfcb8('0x18')](_0xfcb8('0x19'),_0x3a0278+'-'+_0x16b9c4+'/'+_0x499dc2)[_0xfcb8('0x1a')](_0x8a1532);}return null;};}function patchUpdates(_0xa32303){return function(_0x375c28){try{jsonpatch[_0xfcb8('0x1b')](_0x375c28,_0xa32303,!![]);}catch(_0x184d41){return BPromise[_0xfcb8('0x1c')](_0x184d41);}return _0x375c28[_0xfcb8('0x1d')]();};}function saveUpdates(_0x3a66f9,_0x4a3745){return function(_0x41a2f6){if(_0x41a2f6){return _0x41a2f6[_0xfcb8('0x1e')](_0x3a66f9)[_0xfcb8('0x1f')](function(_0xa545fd){return _0xa545fd;});}return null;};}function removeEntity(_0xf7dda9,_0x4ba8b7){return function(_0x3eabe6){if(_0x3eabe6){return _0x3eabe6[_0xfcb8('0x20')]()['then'](function(){_0xf7dda9[_0xfcb8('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x159b95,_0x28eb81){return function(_0x526880){if(!_0x526880){_0x159b95['sendStatus'](0x194);}return _0x526880;};}function handleError(_0x3ecc04,_0x511703){_0x511703=_0x511703||0x1f4;return function(_0x30fbe5){logger[_0xfcb8('0x21')](_0x30fbe5[_0xfcb8('0x22')]);if(_0x30fbe5[_0xfcb8('0x23')]){delete _0x30fbe5[_0xfcb8('0x23')];}_0x3ecc04[_0xfcb8('0x13')](_0x511703)[_0xfcb8('0x24')](_0x30fbe5);};}exports[_0xfcb8('0x25')]=function(_0x1b4ff9,_0x4c8fc){var _0xfb9e36={},_0x5527db={},_0x5ddecc={'count':0x0,'rows':[]};var _0x170804=_[_0xfcb8('0x26')](db[_0xfcb8('0x27')]['rawAttributes'],function(_0xbb8822){return{'name':_0xbb8822['fieldName'],'type':_0xbb8822[_0xfcb8('0x28')][_0xfcb8('0x29')]};});_0x5527db[_0xfcb8('0x2a')]=_[_0xfcb8('0x26')](_0x170804,_0xfcb8('0x23'));_0x5527db[_0xfcb8('0x2b')]=_['keys'](_0x1b4ff9[_0xfcb8('0x2b')]);_0x5527db[_0xfcb8('0x2c')]=_[_0xfcb8('0x2d')](_0x5527db[_0xfcb8('0x2a')],_0x5527db[_0xfcb8('0x2b')]);_0xfb9e36[_0xfcb8('0x2e')]=_[_0xfcb8('0x2d')](_0x5527db[_0xfcb8('0x2a')],qs[_0xfcb8('0x2f')](_0x1b4ff9['query'][_0xfcb8('0x2f')]));_0xfb9e36[_0xfcb8('0x2e')]=_0xfb9e36['attributes'][_0xfcb8('0x30')]?_0xfb9e36['attributes']:_0x5527db[_0xfcb8('0x2a')];if(!_0x1b4ff9[_0xfcb8('0x2b')]['hasOwnProperty'](_0xfcb8('0x31'))){_0xfb9e36[_0xfcb8('0x32')]=qs[_0xfcb8('0x32')](_0x1b4ff9['query']['limit']);_0xfb9e36[_0xfcb8('0x15')]=qs[_0xfcb8('0x15')](_0x1b4ff9[_0xfcb8('0x2b')]['offset']);}_0xfb9e36[_0xfcb8('0x33')]=qs['sort'](_0x1b4ff9[_0xfcb8('0x2b')][_0xfcb8('0x34')]);_0xfb9e36[_0xfcb8('0x35')]=qs['filters'](_[_0xfcb8('0x36')](_0x1b4ff9['query'],_0x5527db[_0xfcb8('0x2c')]),_0x170804);if(_0x1b4ff9[_0xfcb8('0x2b')]['filter']){_0xfb9e36['where']=_[_0xfcb8('0x37')](_0xfb9e36[_0xfcb8('0x35')],{'$or':_[_0xfcb8('0x26')](_0x170804,function(_0x11e13d){if(_0x11e13d['type']!=='VIRTUAL'){var _0x51cadf={};_0x51cadf[_0x11e13d[_0xfcb8('0x23')]]={'$like':'%'+_0x1b4ff9[_0xfcb8('0x2b')][_0xfcb8('0x38')]+'%'};return _0x51cadf;}})});}_0xfb9e36=_[_0xfcb8('0x37')]({},_0xfb9e36,_0x1b4ff9['options']);var _0x291adc={'where':_0xfb9e36['where']};return db[_0xfcb8('0x27')]['count'](_0x291adc)['then'](function(_0x15b967){_0x5ddecc[_0xfcb8('0x17')]=_0x15b967;if(_0x1b4ff9['query'][_0xfcb8('0x39')]){_0xfb9e36[_0xfcb8('0x3a')]=[{'all':!![]}];}return db[_0xfcb8('0x27')]['findAll'](_0xfb9e36);})[_0xfcb8('0x1f')](function(_0x71db91){_0x5ddecc[_0xfcb8('0x3b')]=_0x71db91;return _0x5ddecc;})[_0xfcb8('0x1f')](respondWithFilteredResult(_0x4c8fc,_0xfb9e36))[_0xfcb8('0x3c')](handleError(_0x4c8fc,null));};exports['show']=function(_0x262756,_0xd1238b){var _0x1836e9={'raw':![],'where':{'id':_0x262756[_0xfcb8('0x3d')]['id']}},_0xbff04c={};_0xbff04c['model']=_['keys'](db[_0xfcb8('0x27')]['rawAttributes']);_0xbff04c[_0xfcb8('0x2b')]=_[_0xfcb8('0x3e')](_0x262756[_0xfcb8('0x2b')]);_0xbff04c[_0xfcb8('0x2c')]=_['intersection'](_0xbff04c[_0xfcb8('0x2a')],_0xbff04c[_0xfcb8('0x2b')]);_0x1836e9[_0xfcb8('0x2e')]=_[_0xfcb8('0x2d')](_0xbff04c[_0xfcb8('0x2a')],qs['fields'](_0x262756[_0xfcb8('0x2b')][_0xfcb8('0x2f')]));_0x1836e9[_0xfcb8('0x2e')]=_0x1836e9[_0xfcb8('0x2e')]['length']?_0x1836e9[_0xfcb8('0x2e')]:_0xbff04c['model'];if(_0x262756[_0xfcb8('0x2b')][_0xfcb8('0x39')]){_0x1836e9[_0xfcb8('0x3a')]=[{'all':!![]}];}_0x1836e9=_[_0xfcb8('0x37')]({},_0x1836e9,_0x262756['options']);return db[_0xfcb8('0x27')][_0xfcb8('0x3f')](_0x1836e9)[_0xfcb8('0x1f')](handleEntityNotFound(_0xd1238b,null))[_0xfcb8('0x1f')](respondWithResult(_0xd1238b,null))[_0xfcb8('0x3c')](handleError(_0xd1238b,null));};exports[_0xfcb8('0x40')]=function(_0x5e0086,_0x5ecb57){return db['FreshsalesConfiguration'][_0xfcb8('0x40')](_0x5e0086[_0xfcb8('0x41')],{})[_0xfcb8('0x1f')](respondWithResult(_0x5ecb57,0xc9))[_0xfcb8('0x3c')](handleError(_0x5ecb57,null));};exports[_0xfcb8('0x1e')]=function(_0x4c40e3,_0xbdf103){if(_0x4c40e3['body']['id']){delete _0x4c40e3['body']['id'];}return db['FreshsalesConfiguration'][_0xfcb8('0x3f')]({'where':{'id':_0x4c40e3[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0xbdf103,null))[_0xfcb8('0x1f')](saveUpdates(_0x4c40e3[_0xfcb8('0x41')],null))[_0xfcb8('0x1f')](respondWithResult(_0xbdf103,null))['catch'](handleError(_0xbdf103,null));};exports['destroy']=function(_0x286bbe,_0x5d1393){return db[_0xfcb8('0x27')][_0xfcb8('0x3f')]({'where':{'id':_0x286bbe[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0x5d1393,null))[_0xfcb8('0x1f')](removeEntity(_0x5d1393,null))[_0xfcb8('0x3c')](handleError(_0x5d1393,null));};exports[_0xfcb8('0x42')]=function(_0x117449,_0x511a1e,_0x57b805){var _0x264d28={};var _0x1955d7={};var _0x388949;var _0x3980d1;return db[_0xfcb8('0x27')][_0xfcb8('0x43')]({'where':{'id':_0x117449[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0x511a1e,null))[_0xfcb8('0x1f')](function(_0x3f0bfa){if(_0x3f0bfa){_0x388949=_0x3f0bfa;_0x1955d7['model']=_['keys'](db[_0xfcb8('0x44')]['rawAttributes']);_0x1955d7[_0xfcb8('0x2b')]=_[_0xfcb8('0x3e')](_0x117449[_0xfcb8('0x2b')]);_0x1955d7['filters']=_['intersection'](_0x1955d7[_0xfcb8('0x2a')],_0x1955d7['query']);_0x264d28['attributes']=_[_0xfcb8('0x2d')](_0x1955d7[_0xfcb8('0x2a')],qs[_0xfcb8('0x2f')](_0x117449[_0xfcb8('0x2b')][_0xfcb8('0x2f')]));_0x264d28['attributes']=_0x264d28[_0xfcb8('0x2e')][_0xfcb8('0x30')]?_0x264d28[_0xfcb8('0x2e')]:_0x1955d7[_0xfcb8('0x2a')];_0x264d28['order']=qs[_0xfcb8('0x34')](_0x117449[_0xfcb8('0x2b')]['sort']);_0x264d28[_0xfcb8('0x35')]=qs['filters'](_['pick'](_0x117449[_0xfcb8('0x2b')],_0x1955d7[_0xfcb8('0x2c')]));if(_0x117449[_0xfcb8('0x2b')][_0xfcb8('0x38')]){_0x264d28[_0xfcb8('0x35')]=_[_0xfcb8('0x37')](_0x264d28['where'],{'$or':_[_0xfcb8('0x26')](_0x264d28[_0xfcb8('0x2e')],function(_0x456183){var _0x734b3b={};_0x734b3b[_0x456183]={'$like':'%'+_0x117449['query'][_0xfcb8('0x38')]+'%'};return _0x734b3b;})});}_0x264d28=_[_0xfcb8('0x37')]({},_0x264d28,_0x117449['options']);return _0x388949[_0xfcb8('0x42')](_0x264d28);}})[_0xfcb8('0x1f')](function(_0x386bb0){if(_0x386bb0){_0x3980d1=_0x386bb0['length'];if(!_0x117449[_0xfcb8('0x2b')][_0xfcb8('0x45')]('nolimit')){_0x264d28[_0xfcb8('0x32')]=qs['limit'](_0x117449['query'][_0xfcb8('0x32')]);_0x264d28['offset']=qs[_0xfcb8('0x15')](_0x117449['query'][_0xfcb8('0x15')]);}return _0x388949[_0xfcb8('0x42')](_0x264d28);}})[_0xfcb8('0x1f')](function(_0x5abb2c){if(_0x5abb2c){return _0x5abb2c?{'count':_0x3980d1,'rows':_0x5abb2c}:null;}})['then'](respondWithResult(_0x511a1e,null))[_0xfcb8('0x3c')](handleError(_0x511a1e,null));};exports[_0xfcb8('0x46')]=function(_0x327bba,_0x4aa389,_0x17f3cc){var _0x155e47={};var _0x18576e={};var _0x480597;var _0x2916b5;return db[_0xfcb8('0x27')]['findOne']({'where':{'id':_0x327bba[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0x4aa389,null))['then'](function(_0x296eee){if(_0x296eee){_0x480597=_0x296eee;_0x18576e['model']=_['keys'](db[_0xfcb8('0x44')][_0xfcb8('0x47')]);_0x18576e['query']=_[_0xfcb8('0x3e')](_0x327bba[_0xfcb8('0x2b')]);_0x18576e[_0xfcb8('0x2c')]=_[_0xfcb8('0x2d')](_0x18576e[_0xfcb8('0x2a')],_0x18576e['query']);_0x155e47['attributes']=_[_0xfcb8('0x2d')](_0x18576e[_0xfcb8('0x2a')],qs['fields'](_0x327bba[_0xfcb8('0x2b')]['fields']));_0x155e47['attributes']=_0x155e47[_0xfcb8('0x2e')][_0xfcb8('0x30')]?_0x155e47['attributes']:_0x18576e['model'];_0x155e47[_0xfcb8('0x33')]=qs[_0xfcb8('0x34')](_0x327bba[_0xfcb8('0x2b')][_0xfcb8('0x34')]);_0x155e47['where']=qs['filters'](_[_0xfcb8('0x36')](_0x327bba[_0xfcb8('0x2b')],_0x18576e[_0xfcb8('0x2c')]));if(_0x327bba['query'][_0xfcb8('0x38')]){_0x155e47[_0xfcb8('0x35')]=_[_0xfcb8('0x37')](_0x155e47[_0xfcb8('0x35')],{'$or':_[_0xfcb8('0x26')](_0x155e47[_0xfcb8('0x2e')],function(_0x48d6a4){var _0x53b7b0={};_0x53b7b0[_0x48d6a4]={'$like':'%'+_0x327bba[_0xfcb8('0x2b')][_0xfcb8('0x38')]+'%'};return _0x53b7b0;})});}_0x155e47=_[_0xfcb8('0x37')]({},_0x155e47,_0x327bba[_0xfcb8('0x48')]);return _0x480597[_0xfcb8('0x46')](_0x155e47);}})[_0xfcb8('0x1f')](function(_0x1c8e60){if(_0x1c8e60){_0x2916b5=_0x1c8e60[_0xfcb8('0x30')];if(!_0x327bba[_0xfcb8('0x2b')][_0xfcb8('0x45')]('nolimit')){_0x155e47['limit']=qs[_0xfcb8('0x32')](_0x327bba[_0xfcb8('0x2b')][_0xfcb8('0x32')]);_0x155e47[_0xfcb8('0x15')]=qs[_0xfcb8('0x15')](_0x327bba['query'][_0xfcb8('0x15')]);}return _0x480597[_0xfcb8('0x46')](_0x155e47);}})[_0xfcb8('0x1f')](function(_0x1f3b49){if(_0x1f3b49){return _0x1f3b49?{'count':_0x2916b5,'rows':_0x1f3b49}:null;}})['then'](respondWithResult(_0x4aa389,null))[_0xfcb8('0x3c')](handleError(_0x4aa389,null));};exports[_0xfcb8('0x49')]=function(_0x476d59,_0x47f84f,_0x1e5f64){var _0x25ed38={};var _0x5ba630={};var _0x3b6ac4;var _0x5df063;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x476d59[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0x47f84f,null))[_0xfcb8('0x1f')](function(_0xa4c20b){if(_0xa4c20b){_0x3b6ac4=_0xa4c20b;_0x5ba630[_0xfcb8('0x2a')]=_['keys'](db[_0xfcb8('0x44')]['rawAttributes']);_0x5ba630[_0xfcb8('0x2b')]=_['keys'](_0x476d59[_0xfcb8('0x2b')]);_0x5ba630[_0xfcb8('0x2c')]=_['intersection'](_0x5ba630['model'],_0x5ba630['query']);_0x25ed38[_0xfcb8('0x2e')]=_[_0xfcb8('0x2d')](_0x5ba630['model'],qs[_0xfcb8('0x2f')](_0x476d59[_0xfcb8('0x2b')][_0xfcb8('0x2f')]));_0x25ed38['attributes']=_0x25ed38[_0xfcb8('0x2e')][_0xfcb8('0x30')]?_0x25ed38[_0xfcb8('0x2e')]:_0x5ba630[_0xfcb8('0x2a')];_0x25ed38[_0xfcb8('0x33')]=qs['sort'](_0x476d59[_0xfcb8('0x2b')]['sort']);_0x25ed38['where']=qs[_0xfcb8('0x2c')](_[_0xfcb8('0x36')](_0x476d59[_0xfcb8('0x2b')],_0x5ba630[_0xfcb8('0x2c')]));if(_0x476d59[_0xfcb8('0x2b')]['filter']){_0x25ed38[_0xfcb8('0x35')]=_[_0xfcb8('0x37')](_0x25ed38[_0xfcb8('0x35')],{'$or':_[_0xfcb8('0x26')](_0x25ed38['attributes'],function(_0x24b287){var _0x4f8a59={};_0x4f8a59[_0x24b287]={'$like':'%'+_0x476d59[_0xfcb8('0x2b')][_0xfcb8('0x38')]+'%'};return _0x4f8a59;})});}_0x25ed38=_[_0xfcb8('0x37')]({},_0x25ed38,_0x476d59[_0xfcb8('0x48')]);return _0x3b6ac4[_0xfcb8('0x49')](_0x25ed38);}})[_0xfcb8('0x1f')](function(_0x4262b7){if(_0x4262b7){_0x5df063=_0x4262b7['length'];if(!_0x476d59[_0xfcb8('0x2b')][_0xfcb8('0x45')](_0xfcb8('0x31'))){_0x25ed38[_0xfcb8('0x32')]=qs[_0xfcb8('0x32')](_0x476d59[_0xfcb8('0x2b')]['limit']);_0x25ed38[_0xfcb8('0x15')]=qs[_0xfcb8('0x15')](_0x476d59[_0xfcb8('0x2b')][_0xfcb8('0x15')]);}return _0x3b6ac4['getFields'](_0x25ed38);}})[_0xfcb8('0x1f')](function(_0x1b6d76){if(_0x1b6d76){return _0x1b6d76?{'count':_0x5df063,'rows':_0x1b6d76}:null;}})[_0xfcb8('0x1f')](respondWithResult(_0x47f84f,null))[_0xfcb8('0x3c')](handleError(_0x47f84f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4846678..831c1b3 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 _0x79b4=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x13558e,_0x1e3ace){var _0x501176=function(_0x3c81e8){while(--_0x3c81e8){_0x13558e['push'](_0x13558e['shift']());}};_0x501176(++_0x1e3ace);}(_0x79b4,0x1b6));var _0x479b=function(_0x112b0a,_0x55ffe6){_0x112b0a=_0x112b0a-0x0;var _0x2a5008=_0x79b4[_0x112b0a];return _0x2a5008;};'use strict';var _=require(_0x479b('0x0'));var util=require(_0x479b('0x1'));var logger=require(_0x479b('0x2'))(_0x479b('0x3'));var moment=require(_0x479b('0x4'));var BPromise=require(_0x479b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x479b('0x6'));var rimraf=require(_0x479b('0x7'));var config=require(_0x479b('0x8'));var attributes=require(_0x479b('0x9'));module[_0x479b('0xa')]=function(_0x97d51d,_0x427aa8){return _0x97d51d[_0x479b('0xb')](_0x479b('0xc'),attributes,{'tableName':_0x479b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac68=['path','../../config/environment','./intFreshsalesConfiguration.attributes','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5acd67,_0x526bd7){var _0x255885=function(_0x1bdace){while(--_0x1bdace){_0x5acd67['push'](_0x5acd67['shift']());}};_0x255885(++_0x526bd7);}(_0xac68,0x144));var _0x8ac6=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xac68[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0x8ac6('0x0'));var util=require(_0x8ac6('0x1'));var logger=require(_0x8ac6('0x2'))('api');var moment=require(_0x8ac6('0x3'));var BPromise=require(_0x8ac6('0x4'));var rp=require(_0x8ac6('0x5'));var fs=require('fs');var path=require(_0x8ac6('0x6'));var rimraf=require('rimraf');var config=require(_0x8ac6('0x7'));var attributes=require(_0x8ac6('0x8'));module['exports']=function(_0x21c6a3,_0x4f8c99){return _0x21c6a3[_0x8ac6('0x9')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','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 44a45a8..206ebff 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 _0x552d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x2a560b,_0x328990){var _0x5ea293=function(_0x30e7eb){while(--_0x30e7eb){_0x2a560b['push'](_0x2a560b['shift']());}};_0x5ea293(++_0x328990);}(_0x552d,0x78));var _0xd552=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x552d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd552('0x0'));var util=require(_0xd552('0x1'));var moment=require(_0xd552('0x2'));var BPromise=require(_0xd552('0x3'));var rs=require(_0xd552('0x4'));var fs=require('fs');var Redis=require(_0xd552('0x5'));var db=require(_0xd552('0x6'))['db'];var utils=require(_0xd552('0x7'));var logger=require(_0xd552('0x8'))(_0xd552('0x9'));var config=require(_0xd552('0xa'));var jayson=require(_0xd552('0xb'));var client=jayson[_0xd552('0xc')][_0xd552('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x393771,_0x140e03,_0x523a09){return new BPromise(function(_0x224ce6,_0x3815d2){return client['request'](_0x393771,_0x523a09)[_0xd552('0xe')](function(_0x2d5d5d){logger[_0xd552('0xf')](_0xd552('0x10'),_0x140e03,_0xd552('0x11'));logger[_0xd552('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x140e03,'request\x20sent',JSON[_0xd552('0x13')](_0x2d5d5d));if(_0x2d5d5d[_0xd552('0x14')]){if(_0x2d5d5d[_0xd552('0x14')][_0xd552('0x15')]===0x1f4){logger[_0xd552('0x14')](_0xd552('0x10'),_0x140e03,_0x2d5d5d['error'][_0xd552('0x16')]);return _0x3815d2(_0x2d5d5d[_0xd552('0x14')]['message']);}logger[_0xd552('0x14')](_0xd552('0x10'),_0x140e03,_0x2d5d5d[_0xd552('0x14')][_0xd552('0x16')]);return _0x224ce6(_0x2d5d5d[_0xd552('0x14')]['message']);}else{logger['info'](_0xd552('0x10'),_0x140e03,_0xd552('0x11'));_0x224ce6(_0x2d5d5d[_0xd552('0x17')][_0xd552('0x16')]);}})['catch'](function(_0x272113){logger[_0xd552('0x14')](_0xd552('0x10'),_0x140e03,_0x272113);_0x3815d2(_0x272113);});});} \ No newline at end of file +var _0xa683=['FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1a6712,_0x239059){var _0xd99104=function(_0x4391b6){while(--_0x4391b6){_0x1a6712['push'](_0x1a6712['shift']());}};_0xd99104(++_0x239059);}(_0xa683,0x124));var _0x3a68=function(_0x506278,_0x23a40d){_0x506278=_0x506278-0x0;var _0x2da6a4=_0xa683[_0x506278];return _0x2da6a4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a68('0x0'));var BPromise=require(_0x3a68('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a68('0x2'));var db=require(_0x3a68('0x3'))['db'];var utils=require(_0x3a68('0x4'));var logger=require('../../config/logger')(_0x3a68('0x5'));var config=require(_0x3a68('0x6'));var jayson=require(_0x3a68('0x7'));var client=jayson[_0x3a68('0x8')][_0x3a68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x583358,_0x3c6be8,_0x3e5393){return new BPromise(function(_0x111995,_0x5bd63f){return client[_0x3a68('0xa')](_0x583358,_0x3e5393)[_0x3a68('0xb')](function(_0x1f0196){logger['info'](_0x3a68('0xc'),_0x3c6be8,'request\x20sent');logger[_0x3a68('0xd')](_0x3a68('0xe'),_0x3c6be8,_0x3a68('0xf'),JSON['stringify'](_0x1f0196));if(_0x1f0196['error']){if(_0x1f0196[_0x3a68('0x10')][_0x3a68('0x11')]===0x1f4){logger[_0x3a68('0x10')](_0x3a68('0xc'),_0x3c6be8,_0x1f0196['error']['message']);return _0x5bd63f(_0x1f0196[_0x3a68('0x10')][_0x3a68('0x12')]);}logger[_0x3a68('0x10')](_0x3a68('0xc'),_0x3c6be8,_0x1f0196[_0x3a68('0x10')][_0x3a68('0x12')]);return _0x111995(_0x1f0196['error'][_0x3a68('0x12')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c6be8,'request\x20sent');_0x111995(_0x1f0196['result'][_0x3a68('0x12')]);}})['catch'](function(_0x44bdf6){logger[_0x3a68('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c6be8,_0x44bdf6);_0x5bd63f(_0x44bdf6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4f8d019..6b5b77c 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 _0x65b3=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x5e0926,_0x5f5ca7){var _0x2ffe9e=function(_0x4f23c2){while(--_0x4f23c2){_0x5e0926['push'](_0x5e0926['shift']());}};_0x2ffe9e(++_0x5f5ca7);}(_0x65b3,0xc6));var _0x365b=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x65b3[_0x50cfc3];return _0x5c11ef;};'use strict';var multer=require(_0x365b('0x0'));var util=require(_0x365b('0x1'));var path=require(_0x365b('0x2'));var timeout=require(_0x365b('0x3'));var express=require(_0x365b('0x4'));var router=express[_0x365b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x365b('0x6'));var interaction=require(_0x365b('0x7'));var config=require(_0x365b('0x8'));var controller=require('./intFreshsalesField.controller');router[_0x365b('0x9')]('/',auth[_0x365b('0xa')](),controller[_0x365b('0xb')]);router['get'](_0x365b('0xc'),auth[_0x365b('0xa')](),controller[_0x365b('0xd')]);router[_0x365b('0xe')]('/',auth[_0x365b('0xa')](),controller['create']);router[_0x365b('0xf')](_0x365b('0xc'),auth[_0x365b('0xa')](),controller[_0x365b('0x10')]);router[_0x365b('0x11')]('/:id',auth[_0x365b('0xa')](),controller[_0x365b('0x12')]);module[_0x365b('0x13')]=router; \ No newline at end of file +var _0x38a5=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x40d4a7,_0x52cfe1){var _0x27ecc2=function(_0x4d0b9d){while(--_0x4d0b9d){_0x40d4a7['push'](_0x40d4a7['shift']());}};_0x27ecc2(++_0x52cfe1);}(_0x38a5,0x69));var _0x538a=function(_0x37c9fb,_0x110411){_0x37c9fb=_0x37c9fb-0x0;var _0x13196a=_0x38a5[_0x37c9fb];return _0x13196a;};'use strict';var multer=require(_0x538a('0x0'));var util=require(_0x538a('0x1'));var path=require(_0x538a('0x2'));var timeout=require(_0x538a('0x3'));var express=require('express');var router=express[_0x538a('0x4')]();var fs_extra=require(_0x538a('0x5'));var auth=require(_0x538a('0x6'));var interaction=require(_0x538a('0x7'));var config=require(_0x538a('0x8'));var controller=require(_0x538a('0x9'));router[_0x538a('0xa')]('/',auth[_0x538a('0xb')](),controller[_0x538a('0xc')]);router[_0x538a('0xa')](_0x538a('0xd'),auth[_0x538a('0xb')](),controller[_0x538a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x538a('0xf')]);router[_0x538a('0x10')](_0x538a('0xd'),auth['isAuthenticated'](),controller[_0x538a('0x11')]);router[_0x538a('0x12')](_0x538a('0xd'),auth[_0x538a('0xb')](),controller[_0x538a('0x13')]);module[_0x538a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5585960..5cbe336 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 _0x76bc=['STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x94030f,_0x476ed2){var _0x9f7747=function(_0x2b977a){while(--_0x2b977a){_0x94030f['push'](_0x94030f['shift']());}};_0x9f7747(++_0x476ed2);}(_0x76bc,0x147));var _0xc76b=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x76bc[_0x25c326];return _0x762452;};'use strict';var Sequelize=require(_0xc76b('0x0'));module[_0xc76b('0x1')]={'type':{'type':Sequelize[_0xc76b('0x2')]('string',_0xc76b('0x3'),_0xc76b('0x4'),_0xc76b('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc76b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc76b('0x7'),_0xc76b('0x3'),_0xc76b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc76b('0x6')]},'customField':{'type':Sequelize[_0xc76b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc76b('0x6')]}}; \ No newline at end of file +var _0x222e=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','variable','STRING'];(function(_0x3d4da9,_0x3d1ca6){var _0x3afc58=function(_0x4da753){while(--_0x4da753){_0x3d4da9['push'](_0x3d4da9['shift']());}};_0x3afc58(++_0x3d1ca6);}(_0x222e,0x97));var _0xe222=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x222e[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xe222('0x0'));module[_0xe222('0x1')]={'type':{'type':Sequelize[_0xe222('0x2')](_0xe222('0x3'),'variable',_0xe222('0x4'),_0xe222('0x5'),_0xe222('0x6')),'defaultValue':_0xe222('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xe222('0x3'),_0xe222('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xe222('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe222('0x8')]},'customField':{'type':Sequelize[_0xe222('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 226950f..7da33e4 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 _0x95f5=['map','FreshsalesField','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','fields','includeAll','options','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index'];(function(_0x1ab597,_0x59629f){var _0xec975e=function(_0x49196c){while(--_0x49196c){_0x1ab597['push'](_0x1ab597['shift']());}};_0xec975e(++_0x59629f);}(_0x95f5,0xad));var _0x595f=function(_0x379019,_0x3d8955){_0x379019=_0x379019-0x0;var _0x319d15=_0x95f5[_0x379019];return _0x319d15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x595f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x595f('0x1'));var rp=require(_0x595f('0x2'));var moment=require(_0x595f('0x3'));var BPromise=require(_0x595f('0x4'));var Mustache=require(_0x595f('0x5'));var util=require(_0x595f('0x6'));var path=require(_0x595f('0x7'));var sox=require(_0x595f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x595f('0x9'));var _=require(_0x595f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x595f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x595f('0xc'));var Papa=require(_0x595f('0xd'));var Redis=require(_0x595f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x595f('0xf'));var as=require(_0x595f('0x10'));var hardwareService=require(_0x595f('0x11'));var logger=require(_0x595f('0x12'))(_0x595f('0x13'));var utils=require(_0x595f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x595f('0x15'))['db'];function respondWithStatusCode(_0x598ef9,_0x37ec66){_0x37ec66=_0x37ec66||0xcc;return function(_0x29338c){if(_0x29338c){return _0x598ef9['sendStatus'](_0x37ec66);}return _0x598ef9['status'](_0x37ec66)['end']();};}function respondWithResult(_0x4c6792,_0x4ed95d){_0x4ed95d=_0x4ed95d||0xc8;return function(_0x41c4e5){if(_0x41c4e5){return _0x4c6792[_0x595f('0x16')](_0x4ed95d)[_0x595f('0x17')](_0x41c4e5);}};}function respondWithFilteredResult(_0x1d4c78,_0x57d702){return function(_0x187722){if(_0x187722){var _0x4174a0=typeof _0x57d702[_0x595f('0x18')]===_0x595f('0x19')&&typeof _0x57d702[_0x595f('0x1a')]===_0x595f('0x19');var _0x3f9e48=_0x187722[_0x595f('0x1b')];var _0x34fd28=_0x4174a0?0x0:_0x57d702[_0x595f('0x18')];var _0x57e8cf=_0x4174a0?_0x187722[_0x595f('0x1b')]:_0x57d702['offset']+_0x57d702[_0x595f('0x1a')];var _0x4aba81;if(_0x57e8cf>=_0x3f9e48){_0x57e8cf=_0x3f9e48;_0x4aba81=0xc8;}else{_0x4aba81=0xce;}_0x1d4c78['status'](_0x4aba81);return _0x1d4c78[_0x595f('0x1c')](_0x595f('0x1d'),_0x34fd28+'-'+_0x57e8cf+'/'+_0x3f9e48)['json'](_0x187722);}return null;};}function patchUpdates(_0x170d67){return function(_0x23b31f){try{jsonpatch[_0x595f('0x1e')](_0x23b31f,_0x170d67,!![]);}catch(_0x1c8c1f){return BPromise[_0x595f('0x1f')](_0x1c8c1f);}return _0x23b31f[_0x595f('0x20')]();};}function saveUpdates(_0x5a943a,_0x168f16){return function(_0x1e2081){if(_0x1e2081){return _0x1e2081[_0x595f('0x21')](_0x5a943a)[_0x595f('0x22')](function(_0x5aa773){return _0x5aa773;});}return null;};}function removeEntity(_0x10a7e2,_0x22d997){return function(_0x1fabb4){if(_0x1fabb4){return _0x1fabb4[_0x595f('0x23')]()[_0x595f('0x22')](function(){_0x10a7e2[_0x595f('0x16')](0xcc)[_0x595f('0x24')]();});}};}function handleEntityNotFound(_0x26f7f2,_0x40d403){return function(_0x5ca107){if(!_0x5ca107){_0x26f7f2[_0x595f('0x25')](0x194);}return _0x5ca107;};}function handleError(_0x96ab60,_0x4daefd){_0x4daefd=_0x4daefd||0x1f4;return function(_0x20f8c3){logger[_0x595f('0x26')](_0x20f8c3[_0x595f('0x27')]);if(_0x20f8c3[_0x595f('0x28')]){delete _0x20f8c3[_0x595f('0x28')];}_0x96ab60[_0x595f('0x16')](_0x4daefd)[_0x595f('0x29')](_0x20f8c3);};}exports[_0x595f('0x2a')]=function(_0x17b94d,_0x421d62){var _0x296539={},_0x425868={},_0x27d5e0={'count':0x0,'rows':[]};var _0x3cce57=_[_0x595f('0x2b')](db[_0x595f('0x2c')][_0x595f('0x2d')],function(_0x2c4af4){return{'name':_0x2c4af4['fieldName'],'type':_0x2c4af4['type'][_0x595f('0x2e')]};});_0x425868[_0x595f('0x2f')]=_[_0x595f('0x2b')](_0x3cce57,'name');_0x425868[_0x595f('0x30')]=_[_0x595f('0x31')](_0x17b94d[_0x595f('0x30')]);_0x425868[_0x595f('0x32')]=_[_0x595f('0x33')](_0x425868[_0x595f('0x2f')],_0x425868[_0x595f('0x30')]);_0x296539['attributes']=_[_0x595f('0x33')](_0x425868[_0x595f('0x2f')],qs['fields'](_0x17b94d['query']['fields']));_0x296539[_0x595f('0x34')]=_0x296539[_0x595f('0x34')][_0x595f('0x35')]?_0x296539['attributes']:_0x425868['model'];if(!_0x17b94d['query'][_0x595f('0x36')]('nolimit')){_0x296539[_0x595f('0x1a')]=qs[_0x595f('0x1a')](_0x17b94d[_0x595f('0x30')][_0x595f('0x1a')]);_0x296539[_0x595f('0x18')]=qs[_0x595f('0x18')](_0x17b94d[_0x595f('0x30')]['offset']);}_0x296539['order']=qs[_0x595f('0x37')](_0x17b94d[_0x595f('0x30')][_0x595f('0x37')]);_0x296539[_0x595f('0x38')]=qs[_0x595f('0x32')](_[_0x595f('0x39')](_0x17b94d[_0x595f('0x30')],_0x425868[_0x595f('0x32')]),_0x3cce57);if(_0x17b94d[_0x595f('0x30')][_0x595f('0x3a')]){_0x296539[_0x595f('0x38')]=_[_0x595f('0x3b')](_0x296539[_0x595f('0x38')],{'$or':_[_0x595f('0x2b')](_0x3cce57,function(_0x57cd50){if(_0x57cd50['type']!==_0x595f('0x3c')){var _0x254c7c={};_0x254c7c[_0x57cd50['name']]={'$like':'%'+_0x17b94d[_0x595f('0x30')][_0x595f('0x3a')]+'%'};return _0x254c7c;}})});}_0x296539=_[_0x595f('0x3b')]({},_0x296539,_0x17b94d['options']);var _0xce64e2={'where':_0x296539[_0x595f('0x38')]};return db[_0x595f('0x2c')][_0x595f('0x1b')](_0xce64e2)['then'](function(_0x3c4706){_0x27d5e0[_0x595f('0x1b')]=_0x3c4706;if(_0x17b94d[_0x595f('0x30')]['includeAll']){_0x296539[_0x595f('0x3d')]=[{'all':!![]}];}return db[_0x595f('0x2c')][_0x595f('0x3e')](_0x296539);})[_0x595f('0x22')](function(_0x2b2309){_0x27d5e0[_0x595f('0x3f')]=_0x2b2309;return _0x27d5e0;})['then'](respondWithFilteredResult(_0x421d62,_0x296539))[_0x595f('0x40')](handleError(_0x421d62,null));};exports[_0x595f('0x41')]=function(_0xd9cc45,_0x12c9c5){var _0x54f840={'raw':!![],'where':{'id':_0xd9cc45[_0x595f('0x42')]['id']}},_0x313bfc={};_0x313bfc[_0x595f('0x2f')]=_[_0x595f('0x31')](db[_0x595f('0x2c')][_0x595f('0x2d')]);_0x313bfc[_0x595f('0x30')]=_[_0x595f('0x31')](_0xd9cc45['query']);_0x313bfc['filters']=_[_0x595f('0x33')](_0x313bfc[_0x595f('0x2f')],_0x313bfc[_0x595f('0x30')]);_0x54f840[_0x595f('0x34')]=_['intersection'](_0x313bfc[_0x595f('0x2f')],qs['fields'](_0xd9cc45[_0x595f('0x30')][_0x595f('0x43')]));_0x54f840['attributes']=_0x54f840['attributes'][_0x595f('0x35')]?_0x54f840[_0x595f('0x34')]:_0x313bfc['model'];if(_0xd9cc45[_0x595f('0x30')][_0x595f('0x44')]){_0x54f840[_0x595f('0x3d')]=[{'all':!![]}];}_0x54f840=_[_0x595f('0x3b')]({},_0x54f840,_0xd9cc45[_0x595f('0x45')]);return db[_0x595f('0x2c')]['find'](_0x54f840)[_0x595f('0x22')](handleEntityNotFound(_0x12c9c5,null))[_0x595f('0x22')](respondWithResult(_0x12c9c5,null))[_0x595f('0x40')](handleError(_0x12c9c5,null));};exports['create']=function(_0x43e436,_0x1a8327){return db[_0x595f('0x2c')]['create'](_0x43e436[_0x595f('0x46')],{})[_0x595f('0x22')](respondWithResult(_0x1a8327,0xc9))[_0x595f('0x40')](handleError(_0x1a8327,null));};exports['update']=function(_0x57699f,_0x4b3a60){if(_0x57699f[_0x595f('0x46')]['id']){delete _0x57699f[_0x595f('0x46')]['id'];}return db[_0x595f('0x2c')][_0x595f('0x47')]({'where':{'id':_0x57699f['params']['id']}})[_0x595f('0x22')](handleEntityNotFound(_0x4b3a60,null))[_0x595f('0x22')](saveUpdates(_0x57699f[_0x595f('0x46')],null))[_0x595f('0x22')](respondWithResult(_0x4b3a60,null))[_0x595f('0x40')](handleError(_0x4b3a60,null));};exports[_0x595f('0x23')]=function(_0x1c7f18,_0xfc5478){return db[_0x595f('0x2c')][_0x595f('0x47')]({'where':{'id':_0x1c7f18[_0x595f('0x42')]['id']}})[_0x595f('0x22')](handleEntityNotFound(_0xfc5478,null))[_0x595f('0x22')](removeEntity(_0xfc5478,null))[_0x595f('0x40')](handleError(_0xfc5478,null));}; \ No newline at end of file +var _0x4fed=['body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','reject','update','then','end','sendStatus','name','send','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','FreshsalesField','includeAll','include','findAll','catch','params','keys','length','find','create'];(function(_0x1e6eea,_0x580ea8){var _0x2df11b=function(_0x588ac1){while(--_0x588ac1){_0x1e6eea['push'](_0x1e6eea['shift']());}};_0x2df11b(++_0x580ea8);}(_0x4fed,0xda));var _0xd4fe=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x4fed[_0x421eeb];return _0x2c7371;};'use strict';var emlformat=require(_0xd4fe('0x0'));var rimraf=require(_0xd4fe('0x1'));var zipdir=require(_0xd4fe('0x2'));var jsonpatch=require(_0xd4fe('0x3'));var rp=require(_0xd4fe('0x4'));var moment=require(_0xd4fe('0x5'));var BPromise=require(_0xd4fe('0x6'));var Mustache=require('mustache');var util=require(_0xd4fe('0x7'));var path=require(_0xd4fe('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4fe('0x9'));var fs=require('fs');var fs_extra=require(_0xd4fe('0xa'));var _=require(_0xd4fe('0xb'));var squel=require(_0xd4fe('0xc'));var crypto=require(_0xd4fe('0xd'));var jsforce=require(_0xd4fe('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd4fe('0xf'));var querystring=require(_0xd4fe('0x10'));var Papa=require(_0xd4fe('0x11'));var Redis=require(_0xd4fe('0x12'));var authService=require(_0xd4fe('0x13'));var qs=require(_0xd4fe('0x14'));var as=require(_0xd4fe('0x15'));var hardwareService=require(_0xd4fe('0x16'));var logger=require(_0xd4fe('0x17'))(_0xd4fe('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd4fe('0x19'));var db=require(_0xd4fe('0x1a'))['db'];function respondWithStatusCode(_0x4d1210,_0x804fcb){_0x804fcb=_0x804fcb||0xcc;return function(_0x4c82a9){if(_0x4c82a9){return _0x4d1210['sendStatus'](_0x804fcb);}return _0x4d1210['status'](_0x804fcb)['end']();};}function respondWithResult(_0x3a5e43,_0x221018){_0x221018=_0x221018||0xc8;return function(_0x2afb4d){if(_0x2afb4d){return _0x3a5e43[_0xd4fe('0x1b')](_0x221018)[_0xd4fe('0x1c')](_0x2afb4d);}};}function respondWithFilteredResult(_0x225dd7,_0x38c37f){return function(_0x23c807){if(_0x23c807){var _0x305046=typeof _0x38c37f[_0xd4fe('0x1d')]==='undefined'&&typeof _0x38c37f[_0xd4fe('0x1e')]===_0xd4fe('0x1f');var _0x29ddea=_0x23c807[_0xd4fe('0x20')];var _0x3927d0=_0x305046?0x0:_0x38c37f[_0xd4fe('0x1d')];var _0x48733e=_0x305046?_0x23c807['count']:_0x38c37f[_0xd4fe('0x1d')]+_0x38c37f[_0xd4fe('0x1e')];var _0x24a322;if(_0x48733e>=_0x29ddea){_0x48733e=_0x29ddea;_0x24a322=0xc8;}else{_0x24a322=0xce;}_0x225dd7['status'](_0x24a322);return _0x225dd7[_0xd4fe('0x21')]('Content-Range',_0x3927d0+'-'+_0x48733e+'/'+_0x29ddea)[_0xd4fe('0x1c')](_0x23c807);}return null;};}function patchUpdates(_0x1a549a){return function(_0x5cc8a7){try{jsonpatch[_0xd4fe('0x22')](_0x5cc8a7,_0x1a549a,!![]);}catch(_0x205b9e){return BPromise[_0xd4fe('0x23')](_0x205b9e);}return _0x5cc8a7['save']();};}function saveUpdates(_0xcf3041,_0x13748f){return function(_0x58ac52){if(_0x58ac52){return _0x58ac52[_0xd4fe('0x24')](_0xcf3041)[_0xd4fe('0x25')](function(_0x3735f8){return _0x3735f8;});}return null;};}function removeEntity(_0x5956d9,_0x1a287c){return function(_0x28db9a){if(_0x28db9a){return _0x28db9a['destroy']()[_0xd4fe('0x25')](function(){_0x5956d9['status'](0xcc)[_0xd4fe('0x26')]();});}};}function handleEntityNotFound(_0x462c26,_0x66042d){return function(_0x1b97fb){if(!_0x1b97fb){_0x462c26[_0xd4fe('0x27')](0x194);}return _0x1b97fb;};}function handleError(_0x13033c,_0x2c7eb5){_0x2c7eb5=_0x2c7eb5||0x1f4;return function(_0x280bed){logger['error'](_0x280bed['stack']);if(_0x280bed[_0xd4fe('0x28')]){delete _0x280bed[_0xd4fe('0x28')];}_0x13033c[_0xd4fe('0x1b')](_0x2c7eb5)[_0xd4fe('0x29')](_0x280bed);};}exports['index']=function(_0x4816a7,_0x184f93){var _0x591f69={},_0x4841aa={},_0x67f26={'count':0x0,'rows':[]};var _0x22d10d=_[_0xd4fe('0x2a')](db['FreshsalesField'][_0xd4fe('0x2b')],function(_0x5e9661){return{'name':_0x5e9661[_0xd4fe('0x2c')],'type':_0x5e9661[_0xd4fe('0x2d')]['key']};});_0x4841aa[_0xd4fe('0x2e')]=_['map'](_0x22d10d,_0xd4fe('0x28'));_0x4841aa['query']=_['keys'](_0x4816a7[_0xd4fe('0x2f')]);_0x4841aa['filters']=_[_0xd4fe('0x30')](_0x4841aa['model'],_0x4841aa[_0xd4fe('0x2f')]);_0x591f69[_0xd4fe('0x31')]=_[_0xd4fe('0x30')](_0x4841aa[_0xd4fe('0x2e')],qs[_0xd4fe('0x32')](_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x32')]));_0x591f69[_0xd4fe('0x31')]=_0x591f69[_0xd4fe('0x31')]['length']?_0x591f69[_0xd4fe('0x31')]:_0x4841aa['model'];if(!_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x33')](_0xd4fe('0x34'))){_0x591f69[_0xd4fe('0x1e')]=qs[_0xd4fe('0x1e')](_0x4816a7['query']['limit']);_0x591f69[_0xd4fe('0x1d')]=qs['offset'](_0x4816a7[_0xd4fe('0x2f')]['offset']);}_0x591f69[_0xd4fe('0x35')]=qs[_0xd4fe('0x36')](_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x36')]);_0x591f69['where']=qs[_0xd4fe('0x37')](_['pick'](_0x4816a7['query'],_0x4841aa[_0xd4fe('0x37')]),_0x22d10d);if(_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x38')]){_0x591f69[_0xd4fe('0x39')]=_[_0xd4fe('0x3a')](_0x591f69[_0xd4fe('0x39')],{'$or':_[_0xd4fe('0x2a')](_0x22d10d,function(_0x3b2a13){if(_0x3b2a13['type']!=='VIRTUAL'){var _0x151ce5={};_0x151ce5[_0x3b2a13['name']]={'$like':'%'+_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x38')]+'%'};return _0x151ce5;}})});}_0x591f69=_[_0xd4fe('0x3a')]({},_0x591f69,_0x4816a7[_0xd4fe('0x3b')]);var _0x1c0a21={'where':_0x591f69['where']};return db[_0xd4fe('0x3c')][_0xd4fe('0x20')](_0x1c0a21)[_0xd4fe('0x25')](function(_0x34a401){_0x67f26[_0xd4fe('0x20')]=_0x34a401;if(_0x4816a7['query'][_0xd4fe('0x3d')]){_0x591f69[_0xd4fe('0x3e')]=[{'all':!![]}];}return db[_0xd4fe('0x3c')][_0xd4fe('0x3f')](_0x591f69);})[_0xd4fe('0x25')](function(_0xa9e330){_0x67f26['rows']=_0xa9e330;return _0x67f26;})[_0xd4fe('0x25')](respondWithFilteredResult(_0x184f93,_0x591f69))[_0xd4fe('0x40')](handleError(_0x184f93,null));};exports['show']=function(_0x4cafce,_0x3be306){var _0xa655a8={'raw':!![],'where':{'id':_0x4cafce[_0xd4fe('0x41')]['id']}},_0xd044c2={};_0xd044c2[_0xd4fe('0x2e')]=_['keys'](db[_0xd4fe('0x3c')][_0xd4fe('0x2b')]);_0xd044c2[_0xd4fe('0x2f')]=_[_0xd4fe('0x42')](_0x4cafce[_0xd4fe('0x2f')]);_0xd044c2[_0xd4fe('0x37')]=_['intersection'](_0xd044c2[_0xd4fe('0x2e')],_0xd044c2[_0xd4fe('0x2f')]);_0xa655a8[_0xd4fe('0x31')]=_[_0xd4fe('0x30')](_0xd044c2[_0xd4fe('0x2e')],qs[_0xd4fe('0x32')](_0x4cafce['query']['fields']));_0xa655a8['attributes']=_0xa655a8[_0xd4fe('0x31')][_0xd4fe('0x43')]?_0xa655a8[_0xd4fe('0x31')]:_0xd044c2[_0xd4fe('0x2e')];if(_0x4cafce[_0xd4fe('0x2f')][_0xd4fe('0x3d')]){_0xa655a8[_0xd4fe('0x3e')]=[{'all':!![]}];}_0xa655a8=_[_0xd4fe('0x3a')]({},_0xa655a8,_0x4cafce[_0xd4fe('0x3b')]);return db[_0xd4fe('0x3c')][_0xd4fe('0x44')](_0xa655a8)['then'](handleEntityNotFound(_0x3be306,null))[_0xd4fe('0x25')](respondWithResult(_0x3be306,null))[_0xd4fe('0x40')](handleError(_0x3be306,null));};exports[_0xd4fe('0x45')]=function(_0x4e06a1,_0x16cb5){return db[_0xd4fe('0x3c')][_0xd4fe('0x45')](_0x4e06a1['body'],{})[_0xd4fe('0x25')](respondWithResult(_0x16cb5,0xc9))[_0xd4fe('0x40')](handleError(_0x16cb5,null));};exports[_0xd4fe('0x24')]=function(_0x30238c,_0x3a7283){if(_0x30238c['body']['id']){delete _0x30238c[_0xd4fe('0x46')]['id'];}return db[_0xd4fe('0x3c')]['find']({'where':{'id':_0x30238c[_0xd4fe('0x41')]['id']}})[_0xd4fe('0x25')](handleEntityNotFound(_0x3a7283,null))['then'](saveUpdates(_0x30238c[_0xd4fe('0x46')],null))[_0xd4fe('0x25')](respondWithResult(_0x3a7283,null))[_0xd4fe('0x40')](handleError(_0x3a7283,null));};exports[_0xd4fe('0x47')]=function(_0xd45589,_0x2d70f8){return db['FreshsalesField'][_0xd4fe('0x44')]({'where':{'id':_0xd45589[_0xd4fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d70f8,null))[_0xd4fe('0x25')](removeEntity(_0x2d70f8,null))['catch'](handleError(_0x2d70f8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index af01cc5..38a4403 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 _0x48bc=['define','FreshsalesField','freshsales_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x909fbd,_0x3968fc){var _0x2e43cb=function(_0x1b4ec4){while(--_0x1b4ec4){_0x909fbd['push'](_0x909fbd['shift']());}};_0x2e43cb(++_0x3968fc);}(_0x48bc,0x1b6));var _0xc48b=function(_0xdf071c,_0x2581e7){_0xdf071c=_0xdf071c-0x0;var _0x2677d4=_0x48bc[_0xdf071c];return _0x2677d4;};'use strict';var _=require(_0xc48b('0x0'));var util=require(_0xc48b('0x1'));var logger=require(_0xc48b('0x2'))('api');var moment=require(_0xc48b('0x3'));var BPromise=require(_0xc48b('0x4'));var rp=require(_0xc48b('0x5'));var fs=require('fs');var path=require(_0xc48b('0x6'));var rimraf=require(_0xc48b('0x7'));var config=require(_0xc48b('0x8'));var attributes=require(_0xc48b('0x9'));module['exports']=function(_0x221555,_0x4c001c){return _0x221555[_0xc48b('0xa')](_0xc48b('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xc48b('0xc'),'fields':['idField',_0xc48b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3423=['./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'paranoid':![],'indexes':[{'name':_0x3342('0xd'),'fields':[_0x3342('0xe'),_0x3342('0xf')],'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 1227da0..d44e643 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 _0x5d17=['request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x24e8db,_0x89fc47){var _0x576cc1=function(_0x58f214){while(--_0x58f214){_0x24e8db['push'](_0x24e8db['shift']());}};_0x576cc1(++_0x89fc47);}(_0x5d17,0x114));var _0x75d1=function(_0x416a38,_0x5004e0){_0x416a38=_0x416a38-0x0;var _0xec6c28=_0x5d17[_0x416a38];return _0xec6c28;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file +var _0x2eb2=['request','then','info','request\x20sent','error','FreshsalesField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x4a0781,_0x5f0de0){var _0x1d0b45=function(_0x5b716a){while(--_0x5b716a){_0x4a0781['push'](_0x4a0781['shift']());}};_0x1d0b45(++_0x5f0de0);}(_0x2eb2,0x19f));var _0x22eb=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x2eb2[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 4539949..84722c6 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(_0x156e37,_0x5b8321){var _0x163cad=function(_0x3bf2a2){while(--_0x3bf2a2){_0x156e37['push'](_0x156e37['shift']());}};_0x163cad(++_0x5b8321);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x5c027e,_0x49b1e7){var _0x1bcefe=function(_0x263fe5){while(--_0x263fe5){_0x5c027e['push'](_0x5c027e['shift']());}};_0x1bcefe(++_0x49b1e7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 3cdab53..bd8a7a7 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 _0x1399=['STRING','username','integrationTab','newTab','sequelize','exports'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x1399,0x16c));var _0x9139=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x1399[_0xd336fa];return _0x3370b1;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'remoteUri':{'type':Sequelize[_0x9139('0x2')]},'password':{'type':Sequelize[_0x9139('0x2')]},'clientId':{'type':Sequelize[_0x9139('0x2')]},'clientSecret':{'type':Sequelize[_0x9139('0x2')]},'securityToken':{'type':Sequelize[_0x9139('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9139('0x4'),_0x9139('0x5')),'defaultValue':_0x9139('0x4')}}; \ No newline at end of file +var _0x2517=['newTab','integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x2517,0xfe));var _0x7251=function(_0x5b8676,_0x1ee6b4){_0x5b8676=_0x5b8676-0x0;var _0x4f9ae8=_0x2517[_0x5b8676];return _0x4f9ae8;};'use strict';var Sequelize=require(_0x7251('0x0'));module[_0x7251('0x1')]={'name':{'type':Sequelize[_0x7251('0x2')]},'description':{'type':Sequelize[_0x7251('0x2')]},'username':{'type':Sequelize[_0x7251('0x2')],'unique':_0x7251('0x3')},'remoteUri':{'type':Sequelize[_0x7251('0x2')]},'password':{'type':Sequelize[_0x7251('0x2')]},'clientId':{'type':Sequelize[_0x7251('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7251('0x2')]},'serverUrl':{'type':Sequelize[_0x7251('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7251('0x4')]('integrationTab',_0x7251('0x5')),'defaultValue':_0x7251('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index db46ad0..6d26879 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 _0x78b8=['password','securityToken','isNil','ticketType','describe','ActivityDate','IsRecurrence','Subject','Description','string','boolean','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','name','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','update','SalesforceConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','clientSecret','username','remoteUri','slice','substring','Connection','login'];(function(_0x53fd84,_0x319597){var _0x3c7f84=function(_0x125d13){while(--_0x125d13){_0x53fd84['push'](_0x53fd84['shift']());}};_0x3c7f84(++_0x319597);}(_0x78b8,0x1f3));var _0x878b=function(_0x3751ee,_0x53eeb4){_0x3751ee=_0x3751ee-0x0;var _0x3fbefd=_0x78b8[_0x3751ee];return _0x3fbefd;};'use strict';var emlformat=require(_0x878b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x878b('0x1'));var rp=require('request-promise');var moment=require(_0x878b('0x2'));var BPromise=require(_0x878b('0x3'));var Mustache=require(_0x878b('0x4'));var util=require(_0x878b('0x5'));var path=require(_0x878b('0x6'));var sox=require(_0x878b('0x7'));var csv=require(_0x878b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x878b('0x9'));var squel=require(_0x878b('0xa'));var crypto=require(_0x878b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x878b('0xc'));var toCsv=require(_0x878b('0x8'));var querystring=require(_0x878b('0xd'));var Papa=require(_0x878b('0xe'));var Redis=require(_0x878b('0xf'));var authService=require(_0x878b('0x10'));var qs=require(_0x878b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x878b('0x12'))(_0x878b('0x13'));var utils=require(_0x878b('0x14'));var config=require(_0x878b('0x15'));var licenseUtil=require(_0x878b('0x16'));var db=require(_0x878b('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2cc409,_0x2d4c4c){_0x2d4c4c=_0x2d4c4c||0xcc;return function(_0x57b4ac){if(_0x57b4ac){return _0x2cc409[_0x878b('0x18')](_0x2d4c4c);}return _0x2cc409['status'](_0x2d4c4c)[_0x878b('0x19')]();};}function respondWithResult(_0x528f96,_0x25bfd8){_0x25bfd8=_0x25bfd8||0xc8;return function(_0x56e364){if(_0x56e364){return _0x528f96[_0x878b('0x1a')](_0x25bfd8)[_0x878b('0x1b')](_0x56e364);}};}function respondWithFilteredResult(_0x2d9971,_0x3e7707){return function(_0x4a4a3d){if(_0x4a4a3d){var _0x49e4f1=typeof _0x3e7707[_0x878b('0x1c')]===_0x878b('0x1d')&&typeof _0x3e7707[_0x878b('0x1e')]===_0x878b('0x1d');var _0x2fde2b=_0x4a4a3d[_0x878b('0x1f')];var _0x211f08=_0x49e4f1?0x0:_0x3e7707[_0x878b('0x1c')];var _0x242f28=_0x49e4f1?_0x4a4a3d[_0x878b('0x1f')]:_0x3e7707['offset']+_0x3e7707[_0x878b('0x1e')];var _0x18e85f;if(_0x242f28>=_0x2fde2b){_0x242f28=_0x2fde2b;_0x18e85f=0xc8;}else{_0x18e85f=0xce;}_0x2d9971[_0x878b('0x1a')](_0x18e85f);return _0x2d9971[_0x878b('0x20')]('Content-Range',_0x211f08+'-'+_0x242f28+'/'+_0x2fde2b)[_0x878b('0x1b')](_0x4a4a3d);}return null;};}function patchUpdates(_0x56eb54){return function(_0x1ddf0c){try{jsonpatch[_0x878b('0x21')](_0x1ddf0c,_0x56eb54,!![]);}catch(_0x55bf21){return BPromise[_0x878b('0x22')](_0x55bf21);}return _0x1ddf0c[_0x878b('0x23')]();};}function saveUpdates(_0x1109e8,_0x2114c0){return function(_0x3a8bf6){if(_0x3a8bf6){return _0x3a8bf6['update'](_0x1109e8)['then'](function(_0x2badf2){return _0x2badf2;});}return null;};}function removeEntity(_0x380563,_0x4fe6fc){return function(_0x31e8be){if(_0x31e8be){return _0x31e8be[_0x878b('0x24')]()[_0x878b('0x25')](function(){_0x380563[_0x878b('0x1a')](0xcc)[_0x878b('0x19')]();});}};}function handleEntityNotFound(_0x223a1d,_0x30a634){return function(_0x5c4b5e){if(!_0x5c4b5e){_0x223a1d['sendStatus'](0x194);}return _0x5c4b5e;};}function handleError(_0x122ce8,_0x31a9b3){_0x31a9b3=_0x31a9b3||0x1f4;return function(_0x2406eb){logger[_0x878b('0x26')](_0x2406eb['stack']);if(_0x2406eb[_0x878b('0x27')]){delete _0x2406eb[_0x878b('0x27')];}_0x122ce8[_0x878b('0x1a')](_0x31a9b3)['send'](_0x2406eb);};}exports[_0x878b('0x28')]=function(_0x23e4d6,_0x3681f2){var _0x5caa1f={},_0x33c260={},_0x18ce8f={'count':0x0,'rows':[]};var _0x36bf1a=_[_0x878b('0x29')](db[_0x878b('0x2a')][_0x878b('0x2b')],function(_0x249750){return{'name':_0x249750['fieldName'],'type':_0x249750[_0x878b('0x2c')][_0x878b('0x2d')]};});_0x33c260[_0x878b('0x2e')]=_[_0x878b('0x29')](_0x36bf1a,_0x878b('0x27'));_0x33c260[_0x878b('0x2f')]=_[_0x878b('0x30')](_0x23e4d6[_0x878b('0x2f')]);_0x33c260['filters']=_[_0x878b('0x31')](_0x33c260[_0x878b('0x2e')],_0x33c260[_0x878b('0x2f')]);_0x5caa1f['attributes']=_['intersection'](_0x33c260[_0x878b('0x2e')],qs[_0x878b('0x32')](_0x23e4d6['query'][_0x878b('0x32')]));_0x5caa1f[_0x878b('0x33')]=_0x5caa1f[_0x878b('0x33')][_0x878b('0x34')]?_0x5caa1f['attributes']:_0x33c260[_0x878b('0x2e')];if(!_0x23e4d6[_0x878b('0x2f')][_0x878b('0x35')](_0x878b('0x36'))){_0x5caa1f[_0x878b('0x1e')]=qs['limit'](_0x23e4d6[_0x878b('0x2f')]['limit']);_0x5caa1f[_0x878b('0x1c')]=qs[_0x878b('0x1c')](_0x23e4d6[_0x878b('0x2f')][_0x878b('0x1c')]);}_0x5caa1f[_0x878b('0x37')]=qs[_0x878b('0x38')](_0x23e4d6[_0x878b('0x2f')][_0x878b('0x38')]);_0x5caa1f['where']=qs['filters'](_[_0x878b('0x39')](_0x23e4d6['query'],_0x33c260[_0x878b('0x3a')]),_0x36bf1a);if(_0x23e4d6[_0x878b('0x2f')][_0x878b('0x3b')]){_0x5caa1f['where']=_[_0x878b('0x3c')](_0x5caa1f[_0x878b('0x3d')],{'$or':_[_0x878b('0x29')](_0x36bf1a,function(_0x46f277){if(_0x46f277[_0x878b('0x2c')]!==_0x878b('0x3e')){var _0x4978f9={};_0x4978f9[_0x46f277['name']]={'$like':'%'+_0x23e4d6[_0x878b('0x2f')][_0x878b('0x3b')]+'%'};return _0x4978f9;}})});}_0x5caa1f=_['merge']({},_0x5caa1f,_0x23e4d6[_0x878b('0x3f')]);var _0x2f8778={'where':_0x5caa1f[_0x878b('0x3d')]};return db['SalesforceAccount'][_0x878b('0x1f')](_0x2f8778)[_0x878b('0x25')](function(_0x1e46ee){_0x18ce8f['count']=_0x1e46ee;if(_0x23e4d6[_0x878b('0x2f')]['includeAll']){_0x5caa1f[_0x878b('0x40')]=[{'all':!![]}];}return db[_0x878b('0x2a')][_0x878b('0x41')](_0x5caa1f);})['then'](function(_0x4545b6){_0x18ce8f[_0x878b('0x42')]=_0x4545b6;return _0x18ce8f;})['then'](respondWithFilteredResult(_0x3681f2,_0x5caa1f))[_0x878b('0x43')](handleError(_0x3681f2,null));};exports['show']=function(_0x498c43,_0x3cf49b){var _0x199fb0={'raw':![],'where':{'id':_0x498c43[_0x878b('0x44')]['id']}},_0x570f0d={};_0x570f0d['model']=_[_0x878b('0x30')](db[_0x878b('0x2a')][_0x878b('0x2b')]);_0x570f0d[_0x878b('0x2f')]=_[_0x878b('0x30')](_0x498c43['query']);_0x570f0d[_0x878b('0x3a')]=_[_0x878b('0x31')](_0x570f0d[_0x878b('0x2e')],_0x570f0d[_0x878b('0x2f')]);_0x199fb0[_0x878b('0x33')]=_[_0x878b('0x31')](_0x570f0d[_0x878b('0x2e')],qs['fields'](_0x498c43[_0x878b('0x2f')][_0x878b('0x32')]));_0x199fb0[_0x878b('0x33')]=_0x199fb0['attributes'][_0x878b('0x34')]?_0x199fb0[_0x878b('0x33')]:_0x570f0d[_0x878b('0x2e')];if(_0x498c43[_0x878b('0x2f')]['includeAll']){_0x199fb0['include']=[{'all':!![]}];}_0x199fb0=_[_0x878b('0x3c')]({},_0x199fb0,_0x498c43[_0x878b('0x3f')]);return db[_0x878b('0x2a')][_0x878b('0x45')](_0x199fb0)[_0x878b('0x25')](handleEntityNotFound(_0x3cf49b,null))[_0x878b('0x25')](respondWithResult(_0x3cf49b,null))[_0x878b('0x43')](handleError(_0x3cf49b,null));};exports[_0x878b('0x46')]=function(_0x564afa,_0x463793){return db[_0x878b('0x2a')]['create'](_0x564afa[_0x878b('0x47')],{})['then'](respondWithResult(_0x463793,0xc9))[_0x878b('0x43')](handleError(_0x463793,null));};exports[_0x878b('0x48')]=function(_0x541f6e,_0x46d3ef){if(_0x541f6e[_0x878b('0x47')]['id']){delete _0x541f6e[_0x878b('0x47')]['id'];}return db[_0x878b('0x2a')][_0x878b('0x45')]({'where':{'id':_0x541f6e['params']['id']}})[_0x878b('0x25')](handleEntityNotFound(_0x46d3ef,null))[_0x878b('0x25')](saveUpdates(_0x541f6e[_0x878b('0x47')],null))[_0x878b('0x25')](respondWithResult(_0x46d3ef,null))['catch'](handleError(_0x46d3ef,null));};exports['destroy']=function(_0x11b274,_0x29d59a){return db[_0x878b('0x2a')][_0x878b('0x45')]({'where':{'id':_0x11b274[_0x878b('0x44')]['id']}})[_0x878b('0x25')](handleEntityNotFound(_0x29d59a,null))[_0x878b('0x25')](removeEntity(_0x29d59a,null))[_0x878b('0x43')](handleError(_0x29d59a,null));};exports['getConfigurations']=function(_0x27e6a9,_0x44e567,_0x37a5d8){var _0x4f8f76={};var _0x4e689c={};var _0x3fc1ed;var _0x10e293;return db[_0x878b('0x2a')]['findOne']({'where':{'id':_0x27e6a9[_0x878b('0x44')]['id']}})['then'](handleEntityNotFound(_0x44e567,null))[_0x878b('0x25')](function(_0x173913){if(_0x173913){_0x3fc1ed=_0x173913;_0x4e689c[_0x878b('0x2e')]=_[_0x878b('0x30')](db[_0x878b('0x49')][_0x878b('0x2b')]);_0x4e689c['query']=_[_0x878b('0x30')](_0x27e6a9[_0x878b('0x2f')]);_0x4e689c[_0x878b('0x3a')]=_[_0x878b('0x31')](_0x4e689c[_0x878b('0x2e')],_0x4e689c['query']);_0x4f8f76[_0x878b('0x33')]=_[_0x878b('0x31')](_0x4e689c[_0x878b('0x2e')],qs[_0x878b('0x32')](_0x27e6a9['query'][_0x878b('0x32')]));_0x4f8f76['attributes']=_0x4f8f76[_0x878b('0x33')][_0x878b('0x34')]?_0x4f8f76[_0x878b('0x33')]:_0x4e689c[_0x878b('0x2e')];_0x4f8f76[_0x878b('0x37')]=qs[_0x878b('0x38')](_0x27e6a9[_0x878b('0x2f')][_0x878b('0x38')]);_0x4f8f76[_0x878b('0x3d')]=qs[_0x878b('0x3a')](_[_0x878b('0x39')](_0x27e6a9['query'],_0x4e689c['filters']));if(_0x27e6a9['query'][_0x878b('0x3b')]){_0x4f8f76[_0x878b('0x3d')]=_[_0x878b('0x3c')](_0x4f8f76[_0x878b('0x3d')],{'$or':_[_0x878b('0x29')](_0x4f8f76[_0x878b('0x33')],function(_0x50ab51){var _0x27ea48={};_0x27ea48[_0x50ab51]={'$like':'%'+_0x27e6a9['query'][_0x878b('0x3b')]+'%'};return _0x27ea48;})});}_0x4f8f76=_[_0x878b('0x3c')]({},_0x4f8f76,_0x27e6a9[_0x878b('0x3f')]);return _0x3fc1ed['getConfigurations'](_0x4f8f76);}})[_0x878b('0x25')](function(_0x25c08d){if(_0x25c08d){_0x10e293=_0x25c08d[_0x878b('0x34')];if(!_0x27e6a9['query'][_0x878b('0x35')](_0x878b('0x36'))){_0x4f8f76[_0x878b('0x1e')]=qs[_0x878b('0x1e')](_0x27e6a9[_0x878b('0x2f')][_0x878b('0x1e')]);_0x4f8f76[_0x878b('0x1c')]=qs[_0x878b('0x1c')](_0x27e6a9[_0x878b('0x2f')][_0x878b('0x1c')]);}return _0x3fc1ed['getConfigurations'](_0x4f8f76);}})[_0x878b('0x25')](function(_0x1a0519){if(_0x1a0519){return _0x1a0519?{'count':_0x10e293,'rows':_0x1a0519}:null;}})[_0x878b('0x25')](respondWithResult(_0x44e567,null))[_0x878b('0x43')](handleError(_0x44e567,null));};exports['addConfiguration']=function(_0x5b935b,_0x41195d,_0x1a64d1){if(_0x5b935b[_0x878b('0x47')]['id']){delete _0x5b935b[_0x878b('0x47')]['id'];}return db['SalesforceAccount'][_0x878b('0x4a')]({'where':{'id':_0x5b935b['params']['id']}})['then'](handleEntityNotFound(_0x41195d,null))[_0x878b('0x25')](function(_0x52a1ed){if(_0x52a1ed){_0x5b935b[_0x878b('0x47')][_0x878b('0x4b')]=_0x52a1ed['id'];_0x5b935b[_0x878b('0x47')][_0x878b('0x4c')]=integrations[_0x878b('0x4d')](_0x5b935b['body']['channel'],_0x5b935b[_0x878b('0x47')][_0x878b('0x2c')]);_0x5b935b[_0x878b('0x47')][_0x878b('0x4e')]=integrations[_0x878b('0x4f')](_0x5b935b[_0x878b('0x47')][_0x878b('0x50')],_0x5b935b[_0x878b('0x47')]['type']);return db[_0x878b('0x49')][_0x878b('0x46')](_0x5b935b[_0x878b('0x47')],{'include':[{'model':db['SalesforceField'],'as':_0x878b('0x4c')},{'model':db[_0x878b('0x51')],'as':_0x878b('0x4e')}]});}return null;})[_0x878b('0x25')](respondWithResult(_0x41195d,null))[_0x878b('0x43')](handleError(_0x41195d,null));};exports[_0x878b('0x52')]=function(_0x412fe7,_0x3de486,_0x597e25){var _0x4fb1eb;var _0x440508='';var _0x26eb4d=_0x878b('0x53');return db[_0x878b('0x2a')][_0x878b('0x4a')]({'where':{'id':_0x412fe7['params']['id']},'attributes':['id','remoteUri','clientId',_0x878b('0x54'),_0x878b('0x55'),'password','securityToken']})['then'](handleEntityNotFound(_0x3de486,null))[_0x878b('0x25')](function(_0x38ebe5){if(_0x38ebe5){_0x440508=_0x38ebe5[_0x878b('0x56')];var _0x5015a3=_0x440508[_0x878b('0x57')](-0x1);if(_0x5015a3==='/'){_0x440508=_0x440508[_0x878b('0x58')](0x0,_0x440508['lastIndexOf'](_0x5015a3));}_0x4fb1eb=new jsforce[(_0x878b('0x59'))]({'oauth2':{'loginUrl':_0x440508,'clientId':_0x38ebe5['clientId'],'clientSecret':_0x38ebe5[_0x878b('0x54')]}});return _0x4fb1eb[_0x878b('0x5a')](_0x38ebe5['username'],_0x38ebe5[_0x878b('0x5b')]['concat'](_0x38ebe5[_0x878b('0x5c')]));}})[_0x878b('0x25')](function(_0x40848e){if(_0x40848e){if(!_[_0x878b('0x5d')](_0x412fe7[_0x878b('0x2f')][_0x878b('0x5e')])){_0x26eb4d=_0x412fe7['query'][_0x878b('0x5e')];}return _0x4fb1eb['sobject'](_0x26eb4d)[_0x878b('0x5f')]();}})[_0x878b('0x25')](function(_0xb2a010){var _0x45d91f=['OwnerId',_0x878b('0x60'),'IsReminderSet',_0x878b('0x61'),_0x878b('0x62'),_0x878b('0x63')];var _0x469d19=[_0x878b('0x64'),'int','picklist',_0x878b('0x65'),'email',_0x878b('0x66'),_0x878b('0x67')];if(_0xb2a010){_[_0x878b('0x68')](_0xb2a010['fields'],function(_0x3f1850){return _0x45d91f[_0x878b('0x69')](_0x3f1850[_0x878b('0x27')])||!_0x469d19[_0x878b('0x69')](_0x3f1850[_0x878b('0x2c')]);});return{'count':_0xb2a010[_0x878b('0x32')][_0x878b('0x34')],'rows':_[_0x878b('0x29')](_0xb2a010[_0x878b('0x32')],function(_0x3cd81e){return{'id':_0x3cd81e[_0x878b('0x27')],'name':_0x3cd81e[_0x878b('0x6a')],'custom':_0x3cd81e[_0x878b('0x6b')],'options':_0x3cd81e[_0x878b('0x6c')][_0x878b('0x34')]>0x0?_[_0x878b('0x29')](_0x3cd81e[_0x878b('0x6c')],function(_0x47a1ea){return{'name':_0x47a1ea[_0x878b('0x6a')],'value':_0x47a1ea[_0x878b('0x6d')]};}):_0x3cd81e['type']=='boolean'?[{'name':_0x878b('0x6e'),'value':_0x878b('0x6f')},{'name':_0x878b('0x70'),'value':_0x878b('0x71')}]:[]};})};}})['then'](respondWithResult(_0x3de486,null))['catch'](function(_0x1d05cd){var _0x307a17=_0x412fe7['query'][_0x878b('0x72')]?0x1f4:_0x1d05cd[_0x878b('0x73')]||0x1f4;logger[_0x878b('0x26')](_0x878b('0x74'),_0x878b('0x52'),_0x307a17,JSON[_0x878b('0x75')](_0x1d05cd));delete _0x1d05cd[_0x878b('0x27')];if(_0x307a17===0x191){_0x307a17=0x190;}_0x3de486[_0x878b('0x1a')](_0x307a17)['send'](_0x412fe7[_0x878b('0x2f')][_0x878b('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x1d05cd[_0x878b('0x73')]}:_0x1d05cd);});}; \ No newline at end of file +var _0xed58=['Subject','Description','string','int','email','textarea','phone','includes','label','boolean','True','true','false','test','error','stringify','Wrong\x20credentials','statusCode','rimraf','moment','bluebird','mustache','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/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','findOne','order','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','OwnerId','IsReminderSet','IsRecurrence'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed58,0x186));var _0x8ed5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xed58[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ed5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8ed5('0x1'));var BPromise=require(_0x8ed5('0x2'));var Mustache=require(_0x8ed5('0x3'));var util=require(_0x8ed5('0x4'));var path=require('path');var sox=require(_0x8ed5('0x5'));var csv=require(_0x8ed5('0x6'));var ejs=require(_0x8ed5('0x7'));var fs=require('fs');var fs_extra=require(_0x8ed5('0x8'));var _=require(_0x8ed5('0x9'));var squel=require(_0x8ed5('0xa'));var crypto=require(_0x8ed5('0xb'));var jsforce=require(_0x8ed5('0xc'));var deskjs=require(_0x8ed5('0xd'));var toCsv=require(_0x8ed5('0x6'));var querystring=require('querystring');var Papa=require(_0x8ed5('0xe'));var Redis=require('ioredis');var authService=require(_0x8ed5('0xf'));var qs=require(_0x8ed5('0x10'));var as=require(_0x8ed5('0x11'));var hardwareService=require(_0x8ed5('0x12'));var logger=require(_0x8ed5('0x13'))(_0x8ed5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8ed5('0x15'));var db=require(_0x8ed5('0x16'))['db'];var integrations=require(_0x8ed5('0x17'));function respondWithStatusCode(_0x5a000d,_0x7117b4){_0x7117b4=_0x7117b4||0xcc;return function(_0x459b8b){if(_0x459b8b){return _0x5a000d[_0x8ed5('0x18')](_0x7117b4);}return _0x5a000d[_0x8ed5('0x19')](_0x7117b4)['end']();};}function respondWithResult(_0x667685,_0x413a0b){_0x413a0b=_0x413a0b||0xc8;return function(_0x29f0a3){if(_0x29f0a3){return _0x667685[_0x8ed5('0x19')](_0x413a0b)[_0x8ed5('0x1a')](_0x29f0a3);}};}function respondWithFilteredResult(_0xb36c33,_0x186b72){return function(_0x4f1543){if(_0x4f1543){var _0x47181b=typeof _0x186b72[_0x8ed5('0x1b')]==='undefined'&&typeof _0x186b72[_0x8ed5('0x1c')]===_0x8ed5('0x1d');var _0x2f4bcc=_0x4f1543[_0x8ed5('0x1e')];var _0x3733f8=_0x47181b?0x0:_0x186b72[_0x8ed5('0x1b')];var _0x5e994c=_0x47181b?_0x4f1543[_0x8ed5('0x1e')]:_0x186b72['offset']+_0x186b72[_0x8ed5('0x1c')];var _0x112c11;if(_0x5e994c>=_0x2f4bcc){_0x5e994c=_0x2f4bcc;_0x112c11=0xc8;}else{_0x112c11=0xce;}_0xb36c33[_0x8ed5('0x19')](_0x112c11);return _0xb36c33['set'](_0x8ed5('0x1f'),_0x3733f8+'-'+_0x5e994c+'/'+_0x2f4bcc)[_0x8ed5('0x1a')](_0x4f1543);}return null;};}function patchUpdates(_0x147a4a){return function(_0x2c0c27){try{jsonpatch[_0x8ed5('0x20')](_0x2c0c27,_0x147a4a,!![]);}catch(_0x269e8d){return BPromise[_0x8ed5('0x21')](_0x269e8d);}return _0x2c0c27[_0x8ed5('0x22')]();};}function saveUpdates(_0x40e659,_0x14868b){return function(_0x22d6fb){if(_0x22d6fb){return _0x22d6fb[_0x8ed5('0x23')](_0x40e659)[_0x8ed5('0x24')](function(_0x44a56d){return _0x44a56d;});}return null;};}function removeEntity(_0x37bea6,_0x33b431){return function(_0xa1fbb2){if(_0xa1fbb2){return _0xa1fbb2[_0x8ed5('0x25')]()[_0x8ed5('0x24')](function(){_0x37bea6[_0x8ed5('0x19')](0xcc)[_0x8ed5('0x26')]();});}};}function handleEntityNotFound(_0x5df1c5,_0x4df5bd){return function(_0x6c0cdf){if(!_0x6c0cdf){_0x5df1c5[_0x8ed5('0x18')](0x194);}return _0x6c0cdf;};}function handleError(_0x1a4370,_0x3cbb78){_0x3cbb78=_0x3cbb78||0x1f4;return function(_0x393be1){logger['error'](_0x393be1['stack']);if(_0x393be1[_0x8ed5('0x27')]){delete _0x393be1[_0x8ed5('0x27')];}_0x1a4370[_0x8ed5('0x19')](_0x3cbb78)[_0x8ed5('0x28')](_0x393be1);};}exports[_0x8ed5('0x29')]=function(_0x7e9c5e,_0x7d9cf3){var _0x2f3470={},_0x23c654={},_0x49d400={'count':0x0,'rows':[]};var _0x4dbf5f=_[_0x8ed5('0x2a')](db[_0x8ed5('0x2b')][_0x8ed5('0x2c')],function(_0x508cf7){return{'name':_0x508cf7[_0x8ed5('0x2d')],'type':_0x508cf7[_0x8ed5('0x2e')][_0x8ed5('0x2f')]};});_0x23c654['model']=_[_0x8ed5('0x2a')](_0x4dbf5f,_0x8ed5('0x27'));_0x23c654['query']=_[_0x8ed5('0x30')](_0x7e9c5e[_0x8ed5('0x31')]);_0x23c654[_0x8ed5('0x32')]=_[_0x8ed5('0x33')](_0x23c654[_0x8ed5('0x34')],_0x23c654[_0x8ed5('0x31')]);_0x2f3470[_0x8ed5('0x35')]=_['intersection'](_0x23c654[_0x8ed5('0x34')],qs['fields'](_0x7e9c5e[_0x8ed5('0x31')]['fields']));_0x2f3470[_0x8ed5('0x35')]=_0x2f3470[_0x8ed5('0x35')][_0x8ed5('0x36')]?_0x2f3470[_0x8ed5('0x35')]:_0x23c654[_0x8ed5('0x34')];if(!_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x37')](_0x8ed5('0x38'))){_0x2f3470[_0x8ed5('0x1c')]=qs[_0x8ed5('0x1c')](_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x1c')]);_0x2f3470['offset']=qs[_0x8ed5('0x1b')](_0x7e9c5e['query'][_0x8ed5('0x1b')]);}_0x2f3470['order']=qs['sort'](_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x39')]);_0x2f3470[_0x8ed5('0x3a')]=qs[_0x8ed5('0x32')](_[_0x8ed5('0x3b')](_0x7e9c5e[_0x8ed5('0x31')],_0x23c654['filters']),_0x4dbf5f);if(_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x3c')]){_0x2f3470[_0x8ed5('0x3a')]=_[_0x8ed5('0x3d')](_0x2f3470[_0x8ed5('0x3a')],{'$or':_[_0x8ed5('0x2a')](_0x4dbf5f,function(_0x503b4b){if(_0x503b4b[_0x8ed5('0x2e')]!==_0x8ed5('0x3e')){var _0x16e85c={};_0x16e85c[_0x503b4b[_0x8ed5('0x27')]]={'$like':'%'+_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x3c')]+'%'};return _0x16e85c;}})});}_0x2f3470=_['merge']({},_0x2f3470,_0x7e9c5e[_0x8ed5('0x3f')]);var _0x438639={'where':_0x2f3470[_0x8ed5('0x3a')]};return db[_0x8ed5('0x2b')][_0x8ed5('0x1e')](_0x438639)[_0x8ed5('0x24')](function(_0x3ec545){_0x49d400['count']=_0x3ec545;if(_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x40')]){_0x2f3470[_0x8ed5('0x41')]=[{'all':!![]}];}return db[_0x8ed5('0x2b')][_0x8ed5('0x42')](_0x2f3470);})['then'](function(_0x27b36a){_0x49d400[_0x8ed5('0x43')]=_0x27b36a;return _0x49d400;})[_0x8ed5('0x24')](respondWithFilteredResult(_0x7d9cf3,_0x2f3470))[_0x8ed5('0x44')](handleError(_0x7d9cf3,null));};exports['show']=function(_0x2825f6,_0xa26909){var _0xe0f4f1={'raw':![],'where':{'id':_0x2825f6[_0x8ed5('0x45')]['id']}},_0x10d7f9={};_0x10d7f9[_0x8ed5('0x34')]=_[_0x8ed5('0x30')](db['SalesforceAccount'][_0x8ed5('0x2c')]);_0x10d7f9[_0x8ed5('0x31')]=_[_0x8ed5('0x30')](_0x2825f6[_0x8ed5('0x31')]);_0x10d7f9['filters']=_[_0x8ed5('0x33')](_0x10d7f9[_0x8ed5('0x34')],_0x10d7f9[_0x8ed5('0x31')]);_0xe0f4f1[_0x8ed5('0x35')]=_[_0x8ed5('0x33')](_0x10d7f9['model'],qs[_0x8ed5('0x46')](_0x2825f6[_0x8ed5('0x31')][_0x8ed5('0x46')]));_0xe0f4f1[_0x8ed5('0x35')]=_0xe0f4f1['attributes'][_0x8ed5('0x36')]?_0xe0f4f1['attributes']:_0x10d7f9['model'];if(_0x2825f6['query'][_0x8ed5('0x40')]){_0xe0f4f1['include']=[{'all':!![]}];}_0xe0f4f1=_[_0x8ed5('0x3d')]({},_0xe0f4f1,_0x2825f6[_0x8ed5('0x3f')]);return db['SalesforceAccount'][_0x8ed5('0x47')](_0xe0f4f1)['then'](handleEntityNotFound(_0xa26909,null))[_0x8ed5('0x24')](respondWithResult(_0xa26909,null))[_0x8ed5('0x44')](handleError(_0xa26909,null));};exports[_0x8ed5('0x48')]=function(_0xf8034,_0x25e8a1){return db[_0x8ed5('0x2b')][_0x8ed5('0x48')](_0xf8034['body'],{})[_0x8ed5('0x24')](respondWithResult(_0x25e8a1,0xc9))[_0x8ed5('0x44')](handleError(_0x25e8a1,null));};exports['update']=function(_0xcb590b,_0x3e4bfd){if(_0xcb590b['body']['id']){delete _0xcb590b[_0x8ed5('0x49')]['id'];}return db[_0x8ed5('0x2b')]['find']({'where':{'id':_0xcb590b['params']['id']}})[_0x8ed5('0x24')](handleEntityNotFound(_0x3e4bfd,null))[_0x8ed5('0x24')](saveUpdates(_0xcb590b[_0x8ed5('0x49')],null))[_0x8ed5('0x24')](respondWithResult(_0x3e4bfd,null))[_0x8ed5('0x44')](handleError(_0x3e4bfd,null));};exports['destroy']=function(_0x27a993,_0x595d96){return db['SalesforceAccount'][_0x8ed5('0x47')]({'where':{'id':_0x27a993['params']['id']}})['then'](handleEntityNotFound(_0x595d96,null))['then'](removeEntity(_0x595d96,null))[_0x8ed5('0x44')](handleError(_0x595d96,null));};exports['getConfigurations']=function(_0x140b2a,_0x4fe77c,_0x3fa7c6){var _0x4a3c48={};var _0xbafada={};var _0x2ef590;var _0x489901;return db[_0x8ed5('0x2b')][_0x8ed5('0x4a')]({'where':{'id':_0x140b2a['params']['id']}})[_0x8ed5('0x24')](handleEntityNotFound(_0x4fe77c,null))[_0x8ed5('0x24')](function(_0x2934a3){if(_0x2934a3){_0x2ef590=_0x2934a3;_0xbafada[_0x8ed5('0x34')]=_[_0x8ed5('0x30')](db['SalesforceConfiguration'][_0x8ed5('0x2c')]);_0xbafada[_0x8ed5('0x31')]=_[_0x8ed5('0x30')](_0x140b2a[_0x8ed5('0x31')]);_0xbafada[_0x8ed5('0x32')]=_[_0x8ed5('0x33')](_0xbafada['model'],_0xbafada[_0x8ed5('0x31')]);_0x4a3c48['attributes']=_['intersection'](_0xbafada['model'],qs['fields'](_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x46')]));_0x4a3c48[_0x8ed5('0x35')]=_0x4a3c48[_0x8ed5('0x35')][_0x8ed5('0x36')]?_0x4a3c48['attributes']:_0xbafada['model'];_0x4a3c48[_0x8ed5('0x4b')]=qs[_0x8ed5('0x39')](_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x39')]);_0x4a3c48[_0x8ed5('0x3a')]=qs['filters'](_[_0x8ed5('0x3b')](_0x140b2a[_0x8ed5('0x31')],_0xbafada[_0x8ed5('0x32')]));if(_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x3c')]){_0x4a3c48['where']=_['merge'](_0x4a3c48[_0x8ed5('0x3a')],{'$or':_[_0x8ed5('0x2a')](_0x4a3c48[_0x8ed5('0x35')],function(_0xfd9d08){var _0x2e1248={};_0x2e1248[_0xfd9d08]={'$like':'%'+_0x140b2a[_0x8ed5('0x31')]['filter']+'%'};return _0x2e1248;})});}_0x4a3c48=_[_0x8ed5('0x3d')]({},_0x4a3c48,_0x140b2a['options']);return _0x2ef590[_0x8ed5('0x4c')](_0x4a3c48);}})[_0x8ed5('0x24')](function(_0x201aa2){if(_0x201aa2){_0x489901=_0x201aa2[_0x8ed5('0x36')];if(!_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x37')]('nolimit')){_0x4a3c48[_0x8ed5('0x1c')]=qs[_0x8ed5('0x1c')](_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x1c')]);_0x4a3c48[_0x8ed5('0x1b')]=qs['offset'](_0x140b2a['query'][_0x8ed5('0x1b')]);}return _0x2ef590[_0x8ed5('0x4c')](_0x4a3c48);}})[_0x8ed5('0x24')](function(_0x32e5ac){if(_0x32e5ac){return _0x32e5ac?{'count':_0x489901,'rows':_0x32e5ac}:null;}})[_0x8ed5('0x24')](respondWithResult(_0x4fe77c,null))['catch'](handleError(_0x4fe77c,null));};exports[_0x8ed5('0x4d')]=function(_0x111f24,_0x50d66a,_0xd7dcd7){if(_0x111f24[_0x8ed5('0x49')]['id']){delete _0x111f24[_0x8ed5('0x49')]['id'];}return db[_0x8ed5('0x2b')][_0x8ed5('0x4a')]({'where':{'id':_0x111f24[_0x8ed5('0x45')]['id']}})[_0x8ed5('0x24')](handleEntityNotFound(_0x50d66a,null))['then'](function(_0x1f436f){if(_0x1f436f){_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x4e')]=_0x1f436f['id'];_0x111f24[_0x8ed5('0x49')]['Subjects']=integrations[_0x8ed5('0x4f')](_0x111f24[_0x8ed5('0x49')]['channel'],_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x2e')]);_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x50')]=integrations[_0x8ed5('0x51')](_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x52')],_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x2e')]);return db[_0x8ed5('0x53')][_0x8ed5('0x48')](_0x111f24[_0x8ed5('0x49')],{'include':[{'model':db[_0x8ed5('0x54')],'as':_0x8ed5('0x55')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x50d66a,null))[_0x8ed5('0x44')](handleError(_0x50d66a,null));};exports[_0x8ed5('0x56')]=function(_0x156fe7,_0x29a4e3,_0x61dce1){var _0x2eb41a;var _0x26349b='';var _0x5901bf=_0x8ed5('0x57');return db[_0x8ed5('0x2b')][_0x8ed5('0x4a')]({'where':{'id':_0x156fe7[_0x8ed5('0x45')]['id']},'attributes':['id',_0x8ed5('0x58'),_0x8ed5('0x59'),_0x8ed5('0x5a'),_0x8ed5('0x5b'),_0x8ed5('0x5c'),_0x8ed5('0x5d')]})[_0x8ed5('0x24')](handleEntityNotFound(_0x29a4e3,null))[_0x8ed5('0x24')](function(_0x163f50){if(_0x163f50){_0x26349b=_0x163f50[_0x8ed5('0x58')];var _0x4cc7d7=_0x26349b[_0x8ed5('0x5e')](-0x1);if(_0x4cc7d7==='/'){_0x26349b=_0x26349b[_0x8ed5('0x5f')](0x0,_0x26349b[_0x8ed5('0x60')](_0x4cc7d7));}_0x2eb41a=new jsforce[(_0x8ed5('0x61'))]({'oauth2':{'loginUrl':_0x26349b,'clientId':_0x163f50[_0x8ed5('0x59')],'clientSecret':_0x163f50[_0x8ed5('0x5a')]}});return _0x2eb41a[_0x8ed5('0x62')](_0x163f50[_0x8ed5('0x5b')],_0x163f50[_0x8ed5('0x5c')][_0x8ed5('0x63')](_0x163f50[_0x8ed5('0x5d')]));}})[_0x8ed5('0x24')](function(_0x500978){if(_0x500978){if(!_[_0x8ed5('0x64')](_0x156fe7[_0x8ed5('0x31')][_0x8ed5('0x65')])){_0x5901bf=_0x156fe7[_0x8ed5('0x31')]['ticketType'];}return _0x2eb41a[_0x8ed5('0x66')](_0x5901bf)['describe']();}})[_0x8ed5('0x24')](function(_0x4b8037){var _0x3f65d2=[_0x8ed5('0x67'),'ActivityDate',_0x8ed5('0x68'),_0x8ed5('0x69'),_0x8ed5('0x6a'),_0x8ed5('0x6b')];var _0x5dff76=[_0x8ed5('0x6c'),_0x8ed5('0x6d'),'picklist','boolean',_0x8ed5('0x6e'),_0x8ed5('0x6f'),_0x8ed5('0x70')];if(_0x4b8037){_['remove'](_0x4b8037['fields'],function(_0x143e00){return _0x3f65d2['includes'](_0x143e00[_0x8ed5('0x27')])||!_0x5dff76[_0x8ed5('0x71')](_0x143e00[_0x8ed5('0x2e')]);});return{'count':_0x4b8037[_0x8ed5('0x46')][_0x8ed5('0x36')],'rows':_['map'](_0x4b8037['fields'],function(_0x55a8ae){return{'id':_0x55a8ae[_0x8ed5('0x27')],'name':_0x55a8ae[_0x8ed5('0x72')],'custom':_0x55a8ae['custom'],'options':_0x55a8ae['picklistValues'][_0x8ed5('0x36')]>0x0?_[_0x8ed5('0x2a')](_0x55a8ae['picklistValues'],function(_0x33dbd0){return{'name':_0x33dbd0['label'],'value':_0x33dbd0['value']};}):_0x55a8ae[_0x8ed5('0x2e')]==_0x8ed5('0x73')?[{'name':_0x8ed5('0x74'),'value':_0x8ed5('0x75')},{'name':'False','value':_0x8ed5('0x76')}]:[]};})};}})[_0x8ed5('0x24')](respondWithResult(_0x29a4e3,null))[_0x8ed5('0x44')](function(_0x4c753e){var _0x5a8e33=_0x156fe7['query'][_0x8ed5('0x77')]?0x1f4:_0x4c753e['statusCode']||0x1f4;logger[_0x8ed5('0x78')]('getFields,\x20%s,\x20%s,\x20%s',_0x8ed5('0x56'),_0x5a8e33,JSON[_0x8ed5('0x79')](_0x4c753e));delete _0x4c753e[_0x8ed5('0x27')];if(_0x5a8e33===0x191){_0x5a8e33=0x190;}_0x29a4e3[_0x8ed5('0x19')](_0x5a8e33)[_0x8ed5('0x28')](_0x156fe7[_0x8ed5('0x31')][_0x8ed5('0x77')]?{'message':_0x8ed5('0x7a'),'statusCode':_0x4c753e[_0x8ed5('0x7b')]}:_0x4c753e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3793eef..ecb969b 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 _0xd1a6=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','moment','bluebird'];(function(_0x3f6955,_0x88bd71){var _0x3b0e08=function(_0x5b28d9){while(--_0x5b28d9){_0x3f6955['push'](_0x3f6955['shift']());}};_0x3b0e08(++_0x88bd71);}(_0xd1a6,0x176));var _0x6d1a=function(_0x59fffa,_0x5a61db){_0x59fffa=_0x59fffa-0x0;var _0x281d4e=_0xd1a6[_0x59fffa];return _0x281d4e;};'use strict';var _=require('lodash');var util=require(_0x6d1a('0x0'));var logger=require(_0x6d1a('0x1'))('api');var moment=require(_0x6d1a('0x2'));var BPromise=require(_0x6d1a('0x3'));var rp=require(_0x6d1a('0x4'));var fs=require('fs');var path=require(_0x6d1a('0x5'));var rimraf=require(_0x6d1a('0x6'));var config=require(_0x6d1a('0x7'));var attributes=require(_0x6d1a('0x8'));var integrations=require(_0x6d1a('0x9'));module[_0x6d1a('0xa')]=function(_0x7dbe27,_0x2a0c3d){return _0x7dbe27[_0x6d1a('0xb')](_0x6d1a('0xc'),attributes,{'tableName':_0x6d1a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0e5=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','request-promise'];(function(_0x4dd7d,_0x15ba43){var _0x47eb48=function(_0x3e9819){while(--_0x3e9819){_0x4dd7d['push'](_0x4dd7d['shift']());}};_0x47eb48(++_0x15ba43);}(_0xa0e5,0x175));var _0x5a0e=function(_0x4e71a1,_0xba979c){_0x4e71a1=_0x4e71a1-0x0;var _0x580a10=_0xa0e5[_0x4e71a1];return _0x580a10;};'use strict';var _=require(_0x5a0e('0x0'));var util=require(_0x5a0e('0x1'));var logger=require('../../config/logger')(_0x5a0e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a0e('0x3'));var fs=require('fs');var path=require(_0x5a0e('0x4'));var rimraf=require(_0x5a0e('0x5'));var config=require(_0x5a0e('0x6'));var attributes=require(_0x5a0e('0x7'));var integrations=require(_0x5a0e('0x8'));module[_0x5a0e('0x9')]=function(_0x3054a4,_0x5751b6){return _0x3054a4[_0x5a0e('0xa')](_0x5a0e('0xb'),attributes,{'tableName':_0x5a0e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 05541b2..d34d25e 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 _0x4fac=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','find','ShowSalesforceAccount'];(function(_0x13e7dc,_0x4c8bdb){var _0x37684f=function(_0x1bb498){while(--_0x1bb498){_0x13e7dc['push'](_0x13e7dc['shift']());}};_0x37684f(++_0x4c8bdb);}(_0x4fac,0xd8));var _0xc4fa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4fac[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xc4fa('0x0'));var moment=require(_0xc4fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4fa('0x2'));var fs=require('fs');var Redis=require(_0xc4fa('0x3'));var db=require(_0xc4fa('0x4'))['db'];var utils=require(_0xc4fa('0x5'));var logger=require(_0xc4fa('0x6'))(_0xc4fa('0x7'));var config=require(_0xc4fa('0x8'));var jayson=require(_0xc4fa('0x9'));var client=jayson['client'][_0xc4fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x329116,_0x194194,_0x231f58){return new BPromise(function(_0x2df9d7,_0x1e130a){return client[_0xc4fa('0xb')](_0x329116,_0x231f58)['then'](function(_0x4fc9ab){logger['info'](_0xc4fa('0xc'),_0x194194,_0xc4fa('0xd'));logger[_0xc4fa('0xe')](_0xc4fa('0xf'),_0x194194,'request\x20sent',JSON[_0xc4fa('0x10')](_0x4fc9ab));if(_0x4fc9ab['error']){if(_0x4fc9ab[_0xc4fa('0x11')][_0xc4fa('0x12')]===0x1f4){logger[_0xc4fa('0x11')](_0xc4fa('0xc'),_0x194194,_0x4fc9ab[_0xc4fa('0x11')][_0xc4fa('0x13')]);return _0x1e130a(_0x4fc9ab['error'][_0xc4fa('0x13')]);}logger[_0xc4fa('0x11')](_0xc4fa('0xc'),_0x194194,_0x4fc9ab[_0xc4fa('0x11')][_0xc4fa('0x13')]);return _0x2df9d7(_0x4fc9ab[_0xc4fa('0x11')][_0xc4fa('0x13')]);}else{logger[_0xc4fa('0x14')](_0xc4fa('0xc'),_0x194194,_0xc4fa('0xd'));_0x2df9d7(_0x4fc9ab['result'][_0xc4fa('0x13')]);}})['catch'](function(_0x2b9cd4){logger['error'](_0xc4fa('0xc'),_0x194194,_0x2b9cd4);_0x1e130a(_0x2b9cd4);});});}exports[_0xc4fa('0x15')]=function(_0x146ff5){var _0x1bfa20=this;return new Promise(function(_0x40d8ac,_0xa97b4b){return db[_0xc4fa('0x16')][_0xc4fa('0x17')]({'raw':_0x146ff5[_0xc4fa('0x18')]?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x19')]===undefined?!![]:![]:!![],'where':_0x146ff5['options']?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x1a')]||null:null,'attributes':_0x146ff5[_0xc4fa('0x18')]?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x1b')]||null:null,'limit':_0x146ff5[_0xc4fa('0x18')]?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x1c')]||null:null,'include':_0x146ff5[_0xc4fa('0x18')]?_0x146ff5[_0xc4fa('0x18')][_0xc4fa('0x1d')]?_[_0xc4fa('0x1e')](_0x146ff5['options'][_0xc4fa('0x1d')],function(_0x4ebe6c){return{'model':db[_0x4ebe6c['model']],'as':_0x4ebe6c['as'],'attributes':_0x4ebe6c['attributes'],'include':_0x4ebe6c['include']?_[_0xc4fa('0x1e')](_0x4ebe6c[_0xc4fa('0x1d')],function(_0x4dbbf8){return{'model':db[_0x4dbbf8[_0xc4fa('0x1f')]],'as':_0x4dbbf8['as'],'attributes':_0x4dbbf8[_0xc4fa('0x1b')],'include':_0x4dbbf8[_0xc4fa('0x1d')]?_[_0xc4fa('0x1e')](_0x4dbbf8[_0xc4fa('0x1d')],function(_0x932231){return{'model':db[_0x932231[_0xc4fa('0x1f')]],'as':_0x932231['as'],'attributes':_0x932231['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4fa('0x20')](function(_0x483d97){logger[_0xc4fa('0x14')](_0xc4fa('0x15'),_0x146ff5);logger[_0xc4fa('0xe')](_0xc4fa('0x15'),_0x146ff5,JSON[_0xc4fa('0x10')](_0x483d97));_0x40d8ac(_0x483d97);})[_0xc4fa('0x21')](function(_0x3f960a){logger['error'](_0xc4fa('0x15'),_0x3f960a[_0xc4fa('0x13')],_0x146ff5);_0xa97b4b(_0x1bfa20[_0xc4fa('0x11')](0x1f4,_0x3f960a[_0xc4fa('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x21a110){var _0xbee653=this;return new Promise(function(_0x598095,_0x5745a6){return db[_0xc4fa('0x16')][_0xc4fa('0x22')]({'raw':_0x21a110[_0xc4fa('0x18')]?_0x21a110[_0xc4fa('0x18')][_0xc4fa('0x19')]===undefined?!![]:![]:!![],'where':_0x21a110[_0xc4fa('0x18')]?_0x21a110[_0xc4fa('0x18')][_0xc4fa('0x1a')]||null:null,'attributes':_0x21a110[_0xc4fa('0x18')]?_0x21a110[_0xc4fa('0x18')][_0xc4fa('0x1b')]||null:null,'include':_0x21a110[_0xc4fa('0x18')]?_0x21a110[_0xc4fa('0x18')]['include']?_[_0xc4fa('0x1e')](_0x21a110[_0xc4fa('0x18')][_0xc4fa('0x1d')],function(_0x2d1a65){return{'model':db[_0x2d1a65['model']],'as':_0x2d1a65['as'],'attributes':_0x2d1a65[_0xc4fa('0x1b')],'include':_0x2d1a65['include']?_[_0xc4fa('0x1e')](_0x2d1a65[_0xc4fa('0x1d')],function(_0x2c6679){return{'model':db[_0x2c6679[_0xc4fa('0x1f')]],'as':_0x2c6679['as'],'attributes':_0x2c6679[_0xc4fa('0x1b')],'include':_0x2c6679[_0xc4fa('0x1d')]?_[_0xc4fa('0x1e')](_0x2c6679[_0xc4fa('0x1d')],function(_0x50e7c7){return{'model':db[_0x50e7c7[_0xc4fa('0x1f')]],'as':_0x50e7c7['as'],'attributes':_0x50e7c7[_0xc4fa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc4fa('0x20')](function(_0x1819ad){logger['info'](_0xc4fa('0x23'),_0x21a110);logger[_0xc4fa('0xe')](_0xc4fa('0x23'),_0x21a110,JSON[_0xc4fa('0x10')](_0x1819ad));_0x598095(_0x1819ad);})[_0xc4fa('0x21')](function(_0x185dd2){logger[_0xc4fa('0x11')]('ShowSalesforceAccount',_0x185dd2[_0xc4fa('0x13')],_0x21a110);_0x5745a6(_0xbee653[_0xc4fa('0x11')](0x1f4,_0x185dd2[_0xc4fa('0x13')]));});});}; \ No newline at end of file +var _0x38a8=['../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','find','raw','ShowSalesforceAccount','lodash','moment','bluebird','randomstring'];(function(_0x3e3221,_0x392851){var _0x190da4=function(_0x13d601){while(--_0x13d601){_0x3e3221['push'](_0x3e3221['shift']());}};_0x190da4(++_0x392851);}(_0x38a8,0x10c));var _0x838a=function(_0x253bd2,_0x4e88ff){_0x253bd2=_0x253bd2-0x0;var _0x457ff9=_0x38a8[_0x253bd2];return _0x457ff9;};'use strict';var _=require(_0x838a('0x0'));var util=require('util');var moment=require(_0x838a('0x1'));var BPromise=require(_0x838a('0x2'));var rs=require(_0x838a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x838a('0x4'))['db'];var utils=require(_0x838a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x838a('0x6'));var client=jayson[_0x838a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3dfc,_0x4bed2f,_0x49236f){return new BPromise(function(_0x3abd44,_0x304a0e){return client[_0x838a('0x8')](_0x5b3dfc,_0x49236f)[_0x838a('0x9')](function(_0x330267){logger[_0x838a('0xa')](_0x838a('0xb'),_0x4bed2f,_0x838a('0xc'));logger[_0x838a('0xd')](_0x838a('0xe'),_0x4bed2f,'request\x20sent',JSON[_0x838a('0xf')](_0x330267));if(_0x330267[_0x838a('0x10')]){if(_0x330267[_0x838a('0x10')][_0x838a('0x11')]===0x1f4){logger['error'](_0x838a('0xb'),_0x4bed2f,_0x330267['error'][_0x838a('0x12')]);return _0x304a0e(_0x330267[_0x838a('0x10')][_0x838a('0x12')]);}logger[_0x838a('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4bed2f,_0x330267[_0x838a('0x10')]['message']);return _0x3abd44(_0x330267[_0x838a('0x10')][_0x838a('0x12')]);}else{logger[_0x838a('0xa')](_0x838a('0xb'),_0x4bed2f,_0x838a('0xc'));_0x3abd44(_0x330267[_0x838a('0x13')][_0x838a('0x12')]);}})[_0x838a('0x14')](function(_0x5d3467){logger[_0x838a('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4bed2f,_0x5d3467);_0x304a0e(_0x5d3467);});});}exports[_0x838a('0x15')]=function(_0x247ba3){var _0x29b3d9=this;return new Promise(function(_0x394a90,_0xa76fa5){return db[_0x838a('0x16')][_0x838a('0x17')]({'raw':_0x247ba3[_0x838a('0x18')]?_0x247ba3[_0x838a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x247ba3[_0x838a('0x18')]?_0x247ba3[_0x838a('0x18')][_0x838a('0x19')]||null:null,'attributes':_0x247ba3[_0x838a('0x18')]?_0x247ba3[_0x838a('0x18')][_0x838a('0x1a')]||null:null,'limit':_0x247ba3[_0x838a('0x18')]?_0x247ba3['options'][_0x838a('0x1b')]||null:null,'include':_0x247ba3[_0x838a('0x18')]?_0x247ba3['options'][_0x838a('0x1c')]?_[_0x838a('0x1d')](_0x247ba3['options'][_0x838a('0x1c')],function(_0x175a30){return{'model':db[_0x175a30['model']],'as':_0x175a30['as'],'attributes':_0x175a30[_0x838a('0x1a')],'include':_0x175a30['include']?_[_0x838a('0x1d')](_0x175a30[_0x838a('0x1c')],function(_0x12b65d){return{'model':db[_0x12b65d[_0x838a('0x1e')]],'as':_0x12b65d['as'],'attributes':_0x12b65d['attributes'],'include':_0x12b65d[_0x838a('0x1c')]?_[_0x838a('0x1d')](_0x12b65d[_0x838a('0x1c')],function(_0x41f955){return{'model':db[_0x41f955['model']],'as':_0x41f955['as'],'attributes':_0x41f955['attributes']};}):[]};}):[]};}):[]:[]})[_0x838a('0x9')](function(_0x3134c9){logger[_0x838a('0xa')]('GetSalesforceAccount',_0x247ba3);logger[_0x838a('0xd')](_0x838a('0x15'),_0x247ba3,JSON[_0x838a('0xf')](_0x3134c9));_0x394a90(_0x3134c9);})[_0x838a('0x14')](function(_0x593998){logger[_0x838a('0x10')](_0x838a('0x15'),_0x593998['message'],_0x247ba3);_0xa76fa5(_0x29b3d9['error'](0x1f4,_0x593998['message']));});});};exports['ShowSalesforceAccount']=function(_0x1d2c55){var _0x84b00f=this;return new Promise(function(_0x259c95,_0x515af5){return db[_0x838a('0x16')][_0x838a('0x1f')]({'raw':_0x1d2c55[_0x838a('0x18')]?_0x1d2c55[_0x838a('0x18')][_0x838a('0x20')]===undefined?!![]:![]:!![],'where':_0x1d2c55[_0x838a('0x18')]?_0x1d2c55[_0x838a('0x18')]['where']||null:null,'attributes':_0x1d2c55[_0x838a('0x18')]?_0x1d2c55[_0x838a('0x18')]['attributes']||null:null,'include':_0x1d2c55[_0x838a('0x18')]?_0x1d2c55[_0x838a('0x18')][_0x838a('0x1c')]?_[_0x838a('0x1d')](_0x1d2c55[_0x838a('0x18')][_0x838a('0x1c')],function(_0xc9b31f){return{'model':db[_0xc9b31f[_0x838a('0x1e')]],'as':_0xc9b31f['as'],'attributes':_0xc9b31f[_0x838a('0x1a')],'include':_0xc9b31f[_0x838a('0x1c')]?_[_0x838a('0x1d')](_0xc9b31f[_0x838a('0x1c')],function(_0x60c64a){return{'model':db[_0x60c64a['model']],'as':_0x60c64a['as'],'attributes':_0x60c64a[_0x838a('0x1a')],'include':_0x60c64a['include']?_['map'](_0x60c64a['include'],function(_0x55294b){return{'model':db[_0x55294b[_0x838a('0x1e')]],'as':_0x55294b['as'],'attributes':_0x55294b[_0x838a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x139d5d){logger['info']('ShowSalesforceAccount',_0x1d2c55);logger[_0x838a('0xd')](_0x838a('0x21'),_0x1d2c55,JSON[_0x838a('0xf')](_0x139d5d));_0x259c95(_0x139d5d);})[_0x838a('0x14')](function(_0x44515e){logger[_0x838a('0x10')](_0x838a('0x21'),_0x44515e[_0x838a('0x12')],_0x1d2c55);_0x515af5(_0x84b00f[_0x838a('0x10')](0x1f4,_0x44515e[_0x838a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b873212..10d5255 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 _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(_0x5111a1,_0x3a42f3){var _0x2af76d=function(_0x1d79b8){while(--_0x1d79b8){_0x5111a1['push'](_0x5111a1['shift']());}};_0x2af76d(++_0x3a42f3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'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 +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x5dc041,_0x3b8c07){var _0x53cfb6=function(_0x1093c2){while(--_0x1093c2){_0x5dc041['push'](_0x5dc041['shift']());}};_0x53cfb6(++_0x3b8c07);}(_0x2ef3,0xba));var _0x32ef=function(_0x34f915,_0x238fba){_0x34f915=_0x34f915-0x0;var _0x542afe=_0x2ef3[_0x34f915];return _0x542afe;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 4045cfd..86da6b6 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 _0xc479=['account','nothing','sequelize','exports','STRING','Task','Case','ENUM','contact_lead','contact','lead','account_contact_lead'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xc479,0x182));var _0x9c47=function(_0x3cf750,_0x347dee){_0x3cf750=_0x3cf750-0x0;var _0x5ca79e=_0xc479[_0x3cf750];return _0x5ca79e;};'use strict';var Sequelize=require(_0x9c47('0x0'));module[_0x9c47('0x1')]={'name':{'type':Sequelize[_0x9c47('0x2')]},'description':{'type':Sequelize[_0x9c47('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x9c47('0x3'),_0x9c47('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x9c47('0x5')](_0x9c47('0x6'),_0x9c47('0x7'),_0x9c47('0x8'),_0x9c47('0x9'),_0x9c47('0xa')),'defaultValue':_0x9c47('0x6')},'moduleCreate':{'type':Sequelize[_0x9c47('0x5')](_0x9c47('0xb'),_0x9c47('0x7'),_0x9c47('0x8'),'account'),'defaultValue':_0x9c47('0x8')},'leadId':{'type':Sequelize[_0x9c47('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x9c47('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x9c47('0x2')]}}; \ No newline at end of file +var _0xf506=['account','exports','STRING','Case','Task','ENUM','contact_lead','contact','lead','account_contact_lead'];(function(_0x3d4c3d,_0x911eac){var _0x19b294=function(_0x3d73f5){while(--_0x3d73f5){_0x3d4c3d['push'](_0x3d4c3d['shift']());}};_0x19b294(++_0x911eac);}(_0xf506,0x12d));var _0x6f50=function(_0x347b34,_0x2c92b9){_0x347b34=_0x347b34-0x0;var _0x3a93ae=_0xf506[_0x347b34];return _0x3a93ae;};'use strict';var Sequelize=require('sequelize');module[_0x6f50('0x0')]={'name':{'type':Sequelize[_0x6f50('0x1')]},'description':{'type':Sequelize[_0x6f50('0x1')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x6f50('0x2')),'defaultValue':_0x6f50('0x3')},'moduleSearch':{'type':Sequelize[_0x6f50('0x4')](_0x6f50('0x5'),_0x6f50('0x6'),_0x6f50('0x7'),_0x6f50('0x8'),_0x6f50('0x9')),'defaultValue':_0x6f50('0x5')},'moduleCreate':{'type':Sequelize[_0x6f50('0x4')]('nothing',_0x6f50('0x6'),_0x6f50('0x7'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x6f50('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x6f50('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x6f50('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x6f50('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 3e5f509..f8d2d9c 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 _0xbdf3=['fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getFields','SalesforceField','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection'];(function(_0x20138f,_0x7b2b26){var _0x4f258=function(_0x4352c0){while(--_0x4352c0){_0x20138f['push'](_0x20138f['shift']());}};_0x4f258(++_0x7b2b26);}(_0xbdf3,0x10a));var _0x3bdf=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0xbdf3[_0x38622b];return _0x2c1a7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bdf('0x0'));var zipdir=require(_0x3bdf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3bdf('0x2'));var moment=require('moment');var BPromise=require(_0x3bdf('0x3'));var Mustache=require(_0x3bdf('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3bdf('0x5'));var csv=require(_0x3bdf('0x6'));var ejs=require(_0x3bdf('0x7'));var fs=require('fs');var fs_extra=require(_0x3bdf('0x8'));var _=require(_0x3bdf('0x9'));var squel=require('squel');var crypto=require(_0x3bdf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3bdf('0xb'));var toCsv=require(_0x3bdf('0x6'));var querystring=require(_0x3bdf('0xc'));var Papa=require(_0x3bdf('0xd'));var Redis=require(_0x3bdf('0xe'));var authService=require(_0x3bdf('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bdf('0x10'));var logger=require(_0x3bdf('0x11'))(_0x3bdf('0x12'));var utils=require(_0x3bdf('0x13'));var config=require(_0x3bdf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419fd7,_0x51a88f){_0x51a88f=_0x51a88f||0xcc;return function(_0x4237d1){if(_0x4237d1){return _0x419fd7['sendStatus'](_0x51a88f);}return _0x419fd7['status'](_0x51a88f)[_0x3bdf('0x15')]();};}function respondWithResult(_0x66026b,_0x38a735){_0x38a735=_0x38a735||0xc8;return function(_0x4b3cda){if(_0x4b3cda){return _0x66026b[_0x3bdf('0x16')](_0x38a735)[_0x3bdf('0x17')](_0x4b3cda);}};}function respondWithFilteredResult(_0x2e15a1,_0x373708){return function(_0x2847fd){if(_0x2847fd){var _0x3ca17a=typeof _0x373708[_0x3bdf('0x18')]===_0x3bdf('0x19')&&typeof _0x373708[_0x3bdf('0x1a')]===_0x3bdf('0x19');var _0x38fa8a=_0x2847fd[_0x3bdf('0x1b')];var _0x51b247=_0x3ca17a?0x0:_0x373708[_0x3bdf('0x18')];var _0x16f3aa=_0x3ca17a?_0x2847fd[_0x3bdf('0x1b')]:_0x373708[_0x3bdf('0x18')]+_0x373708['limit'];var _0x3fd8ef;if(_0x16f3aa>=_0x38fa8a){_0x16f3aa=_0x38fa8a;_0x3fd8ef=0xc8;}else{_0x3fd8ef=0xce;}_0x2e15a1[_0x3bdf('0x16')](_0x3fd8ef);return _0x2e15a1[_0x3bdf('0x1c')](_0x3bdf('0x1d'),_0x51b247+'-'+_0x16f3aa+'/'+_0x38fa8a)['json'](_0x2847fd);}return null;};}function patchUpdates(_0x1fe112){return function(_0x1762c4){try{jsonpatch[_0x3bdf('0x1e')](_0x1762c4,_0x1fe112,!![]);}catch(_0x4cefd9){return BPromise[_0x3bdf('0x1f')](_0x4cefd9);}return _0x1762c4[_0x3bdf('0x20')]();};}function saveUpdates(_0x5248ba,_0xd18285){return function(_0x23ab3c){if(_0x23ab3c){return _0x23ab3c[_0x3bdf('0x21')](_0x5248ba)[_0x3bdf('0x22')](function(_0x2900c1){return _0x2900c1;});}return null;};}function removeEntity(_0x48951d,_0x173d2b){return function(_0x2bc07d){if(_0x2bc07d){return _0x2bc07d[_0x3bdf('0x23')]()[_0x3bdf('0x22')](function(){_0x48951d[_0x3bdf('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7495f4,_0x59869d){return function(_0x541f97){if(!_0x541f97){_0x7495f4[_0x3bdf('0x24')](0x194);}return _0x541f97;};}function handleError(_0x14d6c5,_0x3892f8){_0x3892f8=_0x3892f8||0x1f4;return function(_0x453427){logger['error'](_0x453427[_0x3bdf('0x25')]);if(_0x453427[_0x3bdf('0x26')]){delete _0x453427[_0x3bdf('0x26')];}_0x14d6c5['status'](_0x3892f8)[_0x3bdf('0x27')](_0x453427);};}exports[_0x3bdf('0x28')]=function(_0x1298b9,_0x175bd7){var _0x49966f={},_0x40c95b={},_0x511e7b={'count':0x0,'rows':[]};var _0x527bf2=_[_0x3bdf('0x29')](db[_0x3bdf('0x2a')][_0x3bdf('0x2b')],function(_0x56387c){return{'name':_0x56387c[_0x3bdf('0x2c')],'type':_0x56387c[_0x3bdf('0x2d')]['key']};});_0x40c95b[_0x3bdf('0x2e')]=_['map'](_0x527bf2,_0x3bdf('0x26'));_0x40c95b[_0x3bdf('0x2f')]=_['keys'](_0x1298b9[_0x3bdf('0x2f')]);_0x40c95b[_0x3bdf('0x30')]=_['intersection'](_0x40c95b['model'],_0x40c95b[_0x3bdf('0x2f')]);_0x49966f['attributes']=_[_0x3bdf('0x31')](_0x40c95b[_0x3bdf('0x2e')],qs[_0x3bdf('0x32')](_0x1298b9['query'][_0x3bdf('0x32')]));_0x49966f[_0x3bdf('0x33')]=_0x49966f[_0x3bdf('0x33')]['length']?_0x49966f[_0x3bdf('0x33')]:_0x40c95b['model'];if(!_0x1298b9['query'][_0x3bdf('0x34')]('nolimit')){_0x49966f[_0x3bdf('0x1a')]=qs[_0x3bdf('0x1a')](_0x1298b9[_0x3bdf('0x2f')]['limit']);_0x49966f['offset']=qs[_0x3bdf('0x18')](_0x1298b9[_0x3bdf('0x2f')]['offset']);}_0x49966f[_0x3bdf('0x35')]=qs[_0x3bdf('0x36')](_0x1298b9[_0x3bdf('0x2f')][_0x3bdf('0x36')]);_0x49966f[_0x3bdf('0x37')]=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x1298b9['query'],_0x40c95b[_0x3bdf('0x30')]),_0x527bf2);if(_0x1298b9['query'][_0x3bdf('0x39')]){_0x49966f['where']=_['merge'](_0x49966f['where'],{'$or':_['map'](_0x527bf2,function(_0x4633c9){if(_0x4633c9[_0x3bdf('0x2d')]!==_0x3bdf('0x3a')){var _0x30e4ae={};_0x30e4ae[_0x4633c9['name']]={'$like':'%'+_0x1298b9['query']['filter']+'%'};return _0x30e4ae;}})});}_0x49966f=_[_0x3bdf('0x3b')]({},_0x49966f,_0x1298b9[_0x3bdf('0x3c')]);var _0x3bde1a={'where':_0x49966f[_0x3bdf('0x37')]};return db[_0x3bdf('0x2a')][_0x3bdf('0x1b')](_0x3bde1a)[_0x3bdf('0x22')](function(_0x44e2a6){_0x511e7b[_0x3bdf('0x1b')]=_0x44e2a6;if(_0x1298b9[_0x3bdf('0x2f')][_0x3bdf('0x3d')]){_0x49966f[_0x3bdf('0x3e')]=[{'all':!![]}];}return db[_0x3bdf('0x2a')][_0x3bdf('0x3f')](_0x49966f);})[_0x3bdf('0x22')](function(_0x1fedfc){_0x511e7b[_0x3bdf('0x40')]=_0x1fedfc;return _0x511e7b;})['then'](respondWithFilteredResult(_0x175bd7,_0x49966f))[_0x3bdf('0x41')](handleError(_0x175bd7,null));};exports[_0x3bdf('0x42')]=function(_0xfc2e0e,_0x482fee){var _0x327501={'raw':![],'where':{'id':_0xfc2e0e[_0x3bdf('0x43')]['id']}},_0x46d6b7={};_0x46d6b7[_0x3bdf('0x2e')]=_[_0x3bdf('0x44')](db['SalesforceConfiguration'][_0x3bdf('0x2b')]);_0x46d6b7[_0x3bdf('0x2f')]=_[_0x3bdf('0x44')](_0xfc2e0e['query']);_0x46d6b7[_0x3bdf('0x30')]=_[_0x3bdf('0x31')](_0x46d6b7[_0x3bdf('0x2e')],_0x46d6b7[_0x3bdf('0x2f')]);_0x327501['attributes']=_[_0x3bdf('0x31')](_0x46d6b7['model'],qs[_0x3bdf('0x32')](_0xfc2e0e[_0x3bdf('0x2f')]['fields']));_0x327501['attributes']=_0x327501[_0x3bdf('0x33')][_0x3bdf('0x45')]?_0x327501[_0x3bdf('0x33')]:_0x46d6b7[_0x3bdf('0x2e')];if(_0xfc2e0e[_0x3bdf('0x2f')]['includeAll']){_0x327501[_0x3bdf('0x3e')]=[{'all':!![]}];}_0x327501=_[_0x3bdf('0x3b')]({},_0x327501,_0xfc2e0e[_0x3bdf('0x3c')]);return db[_0x3bdf('0x2a')][_0x3bdf('0x46')](_0x327501)[_0x3bdf('0x22')](handleEntityNotFound(_0x482fee,null))[_0x3bdf('0x22')](respondWithResult(_0x482fee,null))[_0x3bdf('0x41')](handleError(_0x482fee,null));};exports[_0x3bdf('0x47')]=function(_0xc8f495,_0x40855a){return db[_0x3bdf('0x2a')][_0x3bdf('0x47')](_0xc8f495[_0x3bdf('0x48')],{})['then'](respondWithResult(_0x40855a,0xc9))['catch'](handleError(_0x40855a,null));};exports[_0x3bdf('0x21')]=function(_0x5ca205,_0x132c0d){if(_0x5ca205[_0x3bdf('0x48')]['id']){delete _0x5ca205[_0x3bdf('0x48')]['id'];}return db[_0x3bdf('0x2a')]['find']({'where':{'id':_0x5ca205[_0x3bdf('0x43')]['id']}})[_0x3bdf('0x22')](handleEntityNotFound(_0x132c0d,null))['then'](saveUpdates(_0x5ca205[_0x3bdf('0x48')],null))[_0x3bdf('0x22')](respondWithResult(_0x132c0d,null))[_0x3bdf('0x41')](handleError(_0x132c0d,null));};exports[_0x3bdf('0x23')]=function(_0x373973,_0x27bd07){return db['SalesforceConfiguration'][_0x3bdf('0x46')]({'where':{'id':_0x373973[_0x3bdf('0x43')]['id']}})['then'](handleEntityNotFound(_0x27bd07,null))[_0x3bdf('0x22')](removeEntity(_0x27bd07,null))[_0x3bdf('0x41')](handleError(_0x27bd07,null));};exports[_0x3bdf('0x49')]=function(_0x531420,_0x1375f0,_0x23ead3){var _0x2696ff={};var _0x4f1633={};var _0x3aaea9;var _0x1710b2;return db[_0x3bdf('0x2a')]['findOne']({'where':{'id':_0x531420['params']['id']}})['then'](handleEntityNotFound(_0x1375f0,null))[_0x3bdf('0x22')](function(_0x44e7b0){if(_0x44e7b0){_0x3aaea9=_0x44e7b0;_0x4f1633[_0x3bdf('0x2e')]=_[_0x3bdf('0x44')](db[_0x3bdf('0x4a')][_0x3bdf('0x2b')]);_0x4f1633[_0x3bdf('0x2f')]=_[_0x3bdf('0x44')](_0x531420[_0x3bdf('0x2f')]);_0x4f1633[_0x3bdf('0x30')]=_[_0x3bdf('0x31')](_0x4f1633[_0x3bdf('0x2e')],_0x4f1633[_0x3bdf('0x2f')]);_0x2696ff[_0x3bdf('0x33')]=_['intersection'](_0x4f1633[_0x3bdf('0x2e')],qs['fields'](_0x531420['query'][_0x3bdf('0x32')]));_0x2696ff[_0x3bdf('0x33')]=_0x2696ff[_0x3bdf('0x33')][_0x3bdf('0x45')]?_0x2696ff['attributes']:_0x4f1633['model'];_0x2696ff[_0x3bdf('0x35')]=qs[_0x3bdf('0x36')](_0x531420[_0x3bdf('0x2f')][_0x3bdf('0x36')]);_0x2696ff[_0x3bdf('0x37')]=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x531420[_0x3bdf('0x2f')],_0x4f1633[_0x3bdf('0x30')]));if(_0x531420[_0x3bdf('0x2f')]['filter']){_0x2696ff[_0x3bdf('0x37')]=_['merge'](_0x2696ff[_0x3bdf('0x37')],{'$or':_[_0x3bdf('0x29')](_0x2696ff[_0x3bdf('0x33')],function(_0x2da27c){var _0x4fcf3b={};_0x4fcf3b[_0x2da27c]={'$like':'%'+_0x531420[_0x3bdf('0x2f')][_0x3bdf('0x39')]+'%'};return _0x4fcf3b;})});}_0x2696ff=_[_0x3bdf('0x3b')]({},_0x2696ff,_0x531420[_0x3bdf('0x3c')]);return _0x3aaea9[_0x3bdf('0x49')](_0x2696ff);}})[_0x3bdf('0x22')](function(_0x3b1125){if(_0x3b1125){_0x1710b2=_0x3b1125[_0x3bdf('0x45')];if(!_0x531420['query'][_0x3bdf('0x34')](_0x3bdf('0x4b'))){_0x2696ff[_0x3bdf('0x1a')]=qs[_0x3bdf('0x1a')](_0x531420[_0x3bdf('0x2f')][_0x3bdf('0x1a')]);_0x2696ff['offset']=qs[_0x3bdf('0x18')](_0x531420['query'][_0x3bdf('0x18')]);}return _0x3aaea9[_0x3bdf('0x49')](_0x2696ff);}})[_0x3bdf('0x22')](function(_0x1771e3){if(_0x1771e3){return _0x1771e3?{'count':_0x1710b2,'rows':_0x1771e3}:null;}})[_0x3bdf('0x22')](respondWithResult(_0x1375f0,null))[_0x3bdf('0x41')](handleError(_0x1375f0,null));};exports[_0x3bdf('0x4c')]=function(_0x10a936,_0x1e62c8,_0x131e9c){var _0x24c423={};var _0x13a29c={};var _0x5125ba;var _0x1ca633;return db[_0x3bdf('0x2a')][_0x3bdf('0x4d')]({'where':{'id':_0x10a936[_0x3bdf('0x43')]['id']}})[_0x3bdf('0x22')](handleEntityNotFound(_0x1e62c8,null))[_0x3bdf('0x22')](function(_0x1e38fc){if(_0x1e38fc){_0x5125ba=_0x1e38fc;_0x13a29c[_0x3bdf('0x2e')]=_[_0x3bdf('0x44')](db[_0x3bdf('0x4a')]['rawAttributes']);_0x13a29c[_0x3bdf('0x2f')]=_[_0x3bdf('0x44')](_0x10a936['query']);_0x13a29c['filters']=_['intersection'](_0x13a29c[_0x3bdf('0x2e')],_0x13a29c[_0x3bdf('0x2f')]);_0x24c423[_0x3bdf('0x33')]=_[_0x3bdf('0x31')](_0x13a29c[_0x3bdf('0x2e')],qs[_0x3bdf('0x32')](_0x10a936[_0x3bdf('0x2f')][_0x3bdf('0x32')]));_0x24c423[_0x3bdf('0x33')]=_0x24c423[_0x3bdf('0x33')][_0x3bdf('0x45')]?_0x24c423[_0x3bdf('0x33')]:_0x13a29c[_0x3bdf('0x2e')];_0x24c423[_0x3bdf('0x35')]=qs[_0x3bdf('0x36')](_0x10a936['query']['sort']);_0x24c423['where']=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x10a936[_0x3bdf('0x2f')],_0x13a29c[_0x3bdf('0x30')]));if(_0x10a936[_0x3bdf('0x2f')][_0x3bdf('0x39')]){_0x24c423[_0x3bdf('0x37')]=_[_0x3bdf('0x3b')](_0x24c423[_0x3bdf('0x37')],{'$or':_[_0x3bdf('0x29')](_0x24c423[_0x3bdf('0x33')],function(_0x2e1abc){var _0x25f6d3={};_0x25f6d3[_0x2e1abc]={'$like':'%'+_0x10a936[_0x3bdf('0x2f')][_0x3bdf('0x39')]+'%'};return _0x25f6d3;})});}_0x24c423=_[_0x3bdf('0x3b')]({},_0x24c423,_0x10a936['options']);return _0x5125ba[_0x3bdf('0x4c')](_0x24c423);}})[_0x3bdf('0x22')](function(_0x548871){if(_0x548871){_0x1ca633=_0x548871[_0x3bdf('0x45')];if(!_0x10a936[_0x3bdf('0x2f')]['hasOwnProperty'](_0x3bdf('0x4b'))){_0x24c423[_0x3bdf('0x1a')]=qs['limit'](_0x10a936[_0x3bdf('0x2f')]['limit']);_0x24c423[_0x3bdf('0x18')]=qs[_0x3bdf('0x18')](_0x10a936[_0x3bdf('0x2f')][_0x3bdf('0x18')]);}return _0x5125ba[_0x3bdf('0x4c')](_0x24c423);}})[_0x3bdf('0x22')](function(_0x10cc41){if(_0x10cc41){return _0x10cc41?{'count':_0x1ca633,'rows':_0x10cc41}:null;}})['then'](respondWithResult(_0x1e62c8,null))[_0x3bdf('0x41')](handleError(_0x1e62c8,null));};exports[_0x3bdf('0x4e')]=function(_0x2977a7,_0x14c9a8,_0x95a6dd){var _0x2470c7={};var _0x4f5fde={};var _0x533106;var _0x470ec4;return db['SalesforceConfiguration'][_0x3bdf('0x4d')]({'where':{'id':_0x2977a7[_0x3bdf('0x43')]['id']}})['then'](handleEntityNotFound(_0x14c9a8,null))[_0x3bdf('0x22')](function(_0x5b7bad){if(_0x5b7bad){_0x533106=_0x5b7bad;_0x4f5fde[_0x3bdf('0x2e')]=_[_0x3bdf('0x44')](db[_0x3bdf('0x4a')][_0x3bdf('0x2b')]);_0x4f5fde[_0x3bdf('0x2f')]=_[_0x3bdf('0x44')](_0x2977a7['query']);_0x4f5fde['filters']=_[_0x3bdf('0x31')](_0x4f5fde[_0x3bdf('0x2e')],_0x4f5fde[_0x3bdf('0x2f')]);_0x2470c7[_0x3bdf('0x33')]=_[_0x3bdf('0x31')](_0x4f5fde[_0x3bdf('0x2e')],qs[_0x3bdf('0x32')](_0x2977a7[_0x3bdf('0x2f')]['fields']));_0x2470c7[_0x3bdf('0x33')]=_0x2470c7['attributes'][_0x3bdf('0x45')]?_0x2470c7[_0x3bdf('0x33')]:_0x4f5fde[_0x3bdf('0x2e')];_0x2470c7[_0x3bdf('0x35')]=qs['sort'](_0x2977a7[_0x3bdf('0x2f')][_0x3bdf('0x36')]);_0x2470c7['where']=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x2977a7[_0x3bdf('0x2f')],_0x4f5fde['filters']));if(_0x2977a7[_0x3bdf('0x2f')][_0x3bdf('0x39')]){_0x2470c7['where']=_['merge'](_0x2470c7[_0x3bdf('0x37')],{'$or':_[_0x3bdf('0x29')](_0x2470c7[_0x3bdf('0x33')],function(_0x1a5097){var _0x4e7368={};_0x4e7368[_0x1a5097]={'$like':'%'+_0x2977a7[_0x3bdf('0x2f')]['filter']+'%'};return _0x4e7368;})});}_0x2470c7=_[_0x3bdf('0x3b')]({},_0x2470c7,_0x2977a7[_0x3bdf('0x3c')]);return _0x533106[_0x3bdf('0x4e')](_0x2470c7);}})['then'](function(_0x81975d){if(_0x81975d){_0x470ec4=_0x81975d[_0x3bdf('0x45')];if(!_0x2977a7['query'][_0x3bdf('0x34')](_0x3bdf('0x4b'))){_0x2470c7['limit']=qs[_0x3bdf('0x1a')](_0x2977a7[_0x3bdf('0x2f')][_0x3bdf('0x1a')]);_0x2470c7['offset']=qs[_0x3bdf('0x18')](_0x2977a7[_0x3bdf('0x2f')][_0x3bdf('0x18')]);}return _0x533106[_0x3bdf('0x4e')](_0x2470c7);}})[_0x3bdf('0x22')](function(_0x47c677){if(_0x47c677){return _0x47c677?{'count':_0x470ec4,'rows':_0x47c677}:null;}})[_0x3bdf('0x22')](respondWithResult(_0x14c9a8,null))[_0x3bdf('0x41')](handleError(_0x14c9a8,null));}; \ No newline at end of file +var _0x5450=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','model','include','find','catch','create','body','update','getFields','findOne','order','pick','nolimit','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x5450,0x133));var _0x0545=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5450[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require(_0x0545('0x0'));var rimraf=require(_0x0545('0x1'));var zipdir=require(_0x0545('0x2'));var jsonpatch=require(_0x0545('0x3'));var rp=require(_0x0545('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0545('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0545('0x6'));var csv=require(_0x0545('0x7'));var ejs=require(_0x0545('0x8'));var fs=require('fs');var fs_extra=require(_0x0545('0x9'));var _=require('lodash');var squel=require(_0x0545('0xa'));var crypto=require('crypto');var jsforce=require(_0x0545('0xb'));var deskjs=require(_0x0545('0xc'));var toCsv=require(_0x0545('0x7'));var querystring=require(_0x0545('0xd'));var Papa=require('papaparse');var Redis=require(_0x0545('0xe'));var authService=require(_0x0545('0xf'));var qs=require(_0x0545('0x10'));var as=require(_0x0545('0x11'));var hardwareService=require(_0x0545('0x12'));var logger=require(_0x0545('0x13'))(_0x0545('0x14'));var utils=require(_0x0545('0x15'));var config=require(_0x0545('0x16'));var licenseUtil=require(_0x0545('0x17'));var db=require(_0x0545('0x18'))['db'];function respondWithStatusCode(_0x49c5eb,_0x37f4ea){_0x37f4ea=_0x37f4ea||0xcc;return function(_0x26e9e8){if(_0x26e9e8){return _0x49c5eb['sendStatus'](_0x37f4ea);}return _0x49c5eb[_0x0545('0x19')](_0x37f4ea)[_0x0545('0x1a')]();};}function respondWithResult(_0x3c573f,_0x532bc7){_0x532bc7=_0x532bc7||0xc8;return function(_0x3d0e18){if(_0x3d0e18){return _0x3c573f[_0x0545('0x19')](_0x532bc7)[_0x0545('0x1b')](_0x3d0e18);}};}function respondWithFilteredResult(_0x57b9ea,_0x3092ca){return function(_0x4f650d){if(_0x4f650d){var _0x51c6bc=typeof _0x3092ca['offset']==='undefined'&&typeof _0x3092ca[_0x0545('0x1c')]===_0x0545('0x1d');var _0x4492c0=_0x4f650d[_0x0545('0x1e')];var _0x5bf173=_0x51c6bc?0x0:_0x3092ca[_0x0545('0x1f')];var _0x1f47ca=_0x51c6bc?_0x4f650d[_0x0545('0x1e')]:_0x3092ca['offset']+_0x3092ca[_0x0545('0x1c')];var _0x33e04f;if(_0x1f47ca>=_0x4492c0){_0x1f47ca=_0x4492c0;_0x33e04f=0xc8;}else{_0x33e04f=0xce;}_0x57b9ea[_0x0545('0x19')](_0x33e04f);return _0x57b9ea['set'](_0x0545('0x20'),_0x5bf173+'-'+_0x1f47ca+'/'+_0x4492c0)[_0x0545('0x1b')](_0x4f650d);}return null;};}function patchUpdates(_0x5d9bd4){return function(_0x2ffd51){try{jsonpatch[_0x0545('0x21')](_0x2ffd51,_0x5d9bd4,!![]);}catch(_0x1eb318){return BPromise['reject'](_0x1eb318);}return _0x2ffd51[_0x0545('0x22')]();};}function saveUpdates(_0x267d4e,_0x16a509){return function(_0x5a906c){if(_0x5a906c){return _0x5a906c['update'](_0x267d4e)['then'](function(_0xe13de3){return _0xe13de3;});}return null;};}function removeEntity(_0x432320,_0x33da86){return function(_0x26f614){if(_0x26f614){return _0x26f614[_0x0545('0x23')]()[_0x0545('0x24')](function(){_0x432320[_0x0545('0x19')](0xcc)[_0x0545('0x1a')]();});}};}function handleEntityNotFound(_0x435d2d,_0x3f2580){return function(_0x58bfc4){if(!_0x58bfc4){_0x435d2d[_0x0545('0x25')](0x194);}return _0x58bfc4;};}function handleError(_0x5232ff,_0x4ed050){_0x4ed050=_0x4ed050||0x1f4;return function(_0x4d2b8b){logger[_0x0545('0x26')](_0x4d2b8b[_0x0545('0x27')]);if(_0x4d2b8b[_0x0545('0x28')]){delete _0x4d2b8b[_0x0545('0x28')];}_0x5232ff[_0x0545('0x19')](_0x4ed050)[_0x0545('0x29')](_0x4d2b8b);};}exports[_0x0545('0x2a')]=function(_0xeaa46a,_0x384c63){var _0x1f0e0a={},_0x29f0f8={},_0xf90711={'count':0x0,'rows':[]};var _0x425829=_[_0x0545('0x2b')](db[_0x0545('0x2c')][_0x0545('0x2d')],function(_0x2b98cb){return{'name':_0x2b98cb['fieldName'],'type':_0x2b98cb['type'][_0x0545('0x2e')]};});_0x29f0f8['model']=_['map'](_0x425829,_0x0545('0x28'));_0x29f0f8[_0x0545('0x2f')]=_[_0x0545('0x30')](_0xeaa46a[_0x0545('0x2f')]);_0x29f0f8['filters']=_[_0x0545('0x31')](_0x29f0f8['model'],_0x29f0f8[_0x0545('0x2f')]);_0x1f0e0a[_0x0545('0x32')]=_[_0x0545('0x31')](_0x29f0f8['model'],qs[_0x0545('0x33')](_0xeaa46a[_0x0545('0x2f')]['fields']));_0x1f0e0a[_0x0545('0x32')]=_0x1f0e0a['attributes'][_0x0545('0x34')]?_0x1f0e0a['attributes']:_0x29f0f8['model'];if(!_0xeaa46a[_0x0545('0x2f')][_0x0545('0x35')]('nolimit')){_0x1f0e0a[_0x0545('0x1c')]=qs[_0x0545('0x1c')](_0xeaa46a[_0x0545('0x2f')][_0x0545('0x1c')]);_0x1f0e0a[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0xeaa46a[_0x0545('0x2f')]['offset']);}_0x1f0e0a['order']=qs[_0x0545('0x36')](_0xeaa46a['query']['sort']);_0x1f0e0a[_0x0545('0x37')]=qs[_0x0545('0x38')](_['pick'](_0xeaa46a['query'],_0x29f0f8[_0x0545('0x38')]),_0x425829);if(_0xeaa46a[_0x0545('0x2f')][_0x0545('0x39')]){_0x1f0e0a[_0x0545('0x37')]=_['merge'](_0x1f0e0a[_0x0545('0x37')],{'$or':_[_0x0545('0x2b')](_0x425829,function(_0x1e03c5){if(_0x1e03c5[_0x0545('0x3a')]!==_0x0545('0x3b')){var _0x25ed74={};_0x25ed74[_0x1e03c5[_0x0545('0x28')]]={'$like':'%'+_0xeaa46a[_0x0545('0x2f')][_0x0545('0x39')]+'%'};return _0x25ed74;}})});}_0x1f0e0a=_[_0x0545('0x3c')]({},_0x1f0e0a,_0xeaa46a[_0x0545('0x3d')]);var _0x57144c={'where':_0x1f0e0a[_0x0545('0x37')]};return db['SalesforceConfiguration']['count'](_0x57144c)['then'](function(_0x5e3092){_0xf90711[_0x0545('0x1e')]=_0x5e3092;if(_0xeaa46a[_0x0545('0x2f')][_0x0545('0x3e')]){_0x1f0e0a['include']=[{'all':!![]}];}return db[_0x0545('0x2c')][_0x0545('0x3f')](_0x1f0e0a);})[_0x0545('0x24')](function(_0x5ec51b){_0xf90711[_0x0545('0x40')]=_0x5ec51b;return _0xf90711;})['then'](respondWithFilteredResult(_0x384c63,_0x1f0e0a))['catch'](handleError(_0x384c63,null));};exports[_0x0545('0x41')]=function(_0x341789,_0x199617){var _0x337cf9={'raw':![],'where':{'id':_0x341789[_0x0545('0x42')]['id']}},_0x2992ab={};_0x2992ab[_0x0545('0x43')]=_[_0x0545('0x30')](db[_0x0545('0x2c')][_0x0545('0x2d')]);_0x2992ab[_0x0545('0x2f')]=_[_0x0545('0x30')](_0x341789[_0x0545('0x2f')]);_0x2992ab['filters']=_['intersection'](_0x2992ab[_0x0545('0x43')],_0x2992ab[_0x0545('0x2f')]);_0x337cf9['attributes']=_[_0x0545('0x31')](_0x2992ab[_0x0545('0x43')],qs[_0x0545('0x33')](_0x341789[_0x0545('0x2f')][_0x0545('0x33')]));_0x337cf9[_0x0545('0x32')]=_0x337cf9[_0x0545('0x32')]['length']?_0x337cf9['attributes']:_0x2992ab[_0x0545('0x43')];if(_0x341789[_0x0545('0x2f')][_0x0545('0x3e')]){_0x337cf9[_0x0545('0x44')]=[{'all':!![]}];}_0x337cf9=_[_0x0545('0x3c')]({},_0x337cf9,_0x341789['options']);return db['SalesforceConfiguration'][_0x0545('0x45')](_0x337cf9)['then'](handleEntityNotFound(_0x199617,null))[_0x0545('0x24')](respondWithResult(_0x199617,null))[_0x0545('0x46')](handleError(_0x199617,null));};exports['create']=function(_0x4a5efe,_0x40011d){return db[_0x0545('0x2c')][_0x0545('0x47')](_0x4a5efe[_0x0545('0x48')],{})[_0x0545('0x24')](respondWithResult(_0x40011d,0xc9))['catch'](handleError(_0x40011d,null));};exports[_0x0545('0x49')]=function(_0x5bf593,_0x3fc36f){if(_0x5bf593[_0x0545('0x48')]['id']){delete _0x5bf593[_0x0545('0x48')]['id'];}return db['SalesforceConfiguration'][_0x0545('0x45')]({'where':{'id':_0x5bf593[_0x0545('0x42')]['id']}})[_0x0545('0x24')](handleEntityNotFound(_0x3fc36f,null))[_0x0545('0x24')](saveUpdates(_0x5bf593['body'],null))[_0x0545('0x24')](respondWithResult(_0x3fc36f,null))[_0x0545('0x46')](handleError(_0x3fc36f,null));};exports['destroy']=function(_0x2186bb,_0x5d6c9e){return db['SalesforceConfiguration'][_0x0545('0x45')]({'where':{'id':_0x2186bb[_0x0545('0x42')]['id']}})[_0x0545('0x24')](handleEntityNotFound(_0x5d6c9e,null))[_0x0545('0x24')](removeEntity(_0x5d6c9e,null))['catch'](handleError(_0x5d6c9e,null));};exports[_0x0545('0x4a')]=function(_0x3ba711,_0x4f9a65,_0x4653ed){var _0x3de748={};var _0x52ab97={};var _0x538419;var _0x101739;return db[_0x0545('0x2c')][_0x0545('0x4b')]({'where':{'id':_0x3ba711['params']['id']}})[_0x0545('0x24')](handleEntityNotFound(_0x4f9a65,null))[_0x0545('0x24')](function(_0xcc7627){if(_0xcc7627){_0x538419=_0xcc7627;_0x52ab97['model']=_[_0x0545('0x30')](db['SalesforceField'][_0x0545('0x2d')]);_0x52ab97['query']=_[_0x0545('0x30')](_0x3ba711[_0x0545('0x2f')]);_0x52ab97[_0x0545('0x38')]=_[_0x0545('0x31')](_0x52ab97['model'],_0x52ab97['query']);_0x3de748['attributes']=_[_0x0545('0x31')](_0x52ab97[_0x0545('0x43')],qs[_0x0545('0x33')](_0x3ba711[_0x0545('0x2f')][_0x0545('0x33')]));_0x3de748[_0x0545('0x32')]=_0x3de748['attributes'][_0x0545('0x34')]?_0x3de748[_0x0545('0x32')]:_0x52ab97[_0x0545('0x43')];_0x3de748[_0x0545('0x4c')]=qs[_0x0545('0x36')](_0x3ba711[_0x0545('0x2f')]['sort']);_0x3de748[_0x0545('0x37')]=qs[_0x0545('0x38')](_[_0x0545('0x4d')](_0x3ba711[_0x0545('0x2f')],_0x52ab97[_0x0545('0x38')]));if(_0x3ba711['query'][_0x0545('0x39')]){_0x3de748[_0x0545('0x37')]=_[_0x0545('0x3c')](_0x3de748[_0x0545('0x37')],{'$or':_[_0x0545('0x2b')](_0x3de748[_0x0545('0x32')],function(_0x4f32e7){var _0x1971de={};_0x1971de[_0x4f32e7]={'$like':'%'+_0x3ba711[_0x0545('0x2f')][_0x0545('0x39')]+'%'};return _0x1971de;})});}_0x3de748=_['merge']({},_0x3de748,_0x3ba711[_0x0545('0x3d')]);return _0x538419[_0x0545('0x4a')](_0x3de748);}})['then'](function(_0x19627b){if(_0x19627b){_0x101739=_0x19627b[_0x0545('0x34')];if(!_0x3ba711[_0x0545('0x2f')][_0x0545('0x35')](_0x0545('0x4e'))){_0x3de748[_0x0545('0x1c')]=qs[_0x0545('0x1c')](_0x3ba711[_0x0545('0x2f')][_0x0545('0x1c')]);_0x3de748[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0x3ba711[_0x0545('0x2f')][_0x0545('0x1f')]);}return _0x538419[_0x0545('0x4a')](_0x3de748);}})[_0x0545('0x24')](function(_0x3e0c1c){if(_0x3e0c1c){return _0x3e0c1c?{'count':_0x101739,'rows':_0x3e0c1c}:null;}})[_0x0545('0x24')](respondWithResult(_0x4f9a65,null))['catch'](handleError(_0x4f9a65,null));};exports[_0x0545('0x4f')]=function(_0x4be5cf,_0x67316a,_0x37ac44){var _0x54e129={};var _0x588ea8={};var _0x15028d;var _0x5b5e5f;return db[_0x0545('0x2c')][_0x0545('0x4b')]({'where':{'id':_0x4be5cf[_0x0545('0x42')]['id']}})['then'](handleEntityNotFound(_0x67316a,null))[_0x0545('0x24')](function(_0x2c9969){if(_0x2c9969){_0x15028d=_0x2c9969;_0x588ea8[_0x0545('0x43')]=_[_0x0545('0x30')](db['SalesforceField'][_0x0545('0x2d')]);_0x588ea8[_0x0545('0x2f')]=_['keys'](_0x4be5cf[_0x0545('0x2f')]);_0x588ea8[_0x0545('0x38')]=_[_0x0545('0x31')](_0x588ea8['model'],_0x588ea8[_0x0545('0x2f')]);_0x54e129[_0x0545('0x32')]=_[_0x0545('0x31')](_0x588ea8['model'],qs[_0x0545('0x33')](_0x4be5cf[_0x0545('0x2f')][_0x0545('0x33')]));_0x54e129['attributes']=_0x54e129[_0x0545('0x32')][_0x0545('0x34')]?_0x54e129[_0x0545('0x32')]:_0x588ea8[_0x0545('0x43')];_0x54e129[_0x0545('0x4c')]=qs['sort'](_0x4be5cf[_0x0545('0x2f')][_0x0545('0x36')]);_0x54e129[_0x0545('0x37')]=qs[_0x0545('0x38')](_[_0x0545('0x4d')](_0x4be5cf[_0x0545('0x2f')],_0x588ea8[_0x0545('0x38')]));if(_0x4be5cf[_0x0545('0x2f')][_0x0545('0x39')]){_0x54e129['where']=_[_0x0545('0x3c')](_0x54e129['where'],{'$or':_[_0x0545('0x2b')](_0x54e129['attributes'],function(_0x1a8bc9){var _0x5d1f8a={};_0x5d1f8a[_0x1a8bc9]={'$like':'%'+_0x4be5cf['query'][_0x0545('0x39')]+'%'};return _0x5d1f8a;})});}_0x54e129=_[_0x0545('0x3c')]({},_0x54e129,_0x4be5cf[_0x0545('0x3d')]);return _0x15028d[_0x0545('0x4f')](_0x54e129);}})[_0x0545('0x24')](function(_0x5641c0){if(_0x5641c0){_0x5b5e5f=_0x5641c0[_0x0545('0x34')];if(!_0x4be5cf[_0x0545('0x2f')][_0x0545('0x35')](_0x0545('0x4e'))){_0x54e129[_0x0545('0x1c')]=qs[_0x0545('0x1c')](_0x4be5cf[_0x0545('0x2f')]['limit']);_0x54e129[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0x4be5cf[_0x0545('0x2f')][_0x0545('0x1f')]);}return _0x15028d[_0x0545('0x4f')](_0x54e129);}})['then'](function(_0x302187){if(_0x302187){return _0x302187?{'count':_0x5b5e5f,'rows':_0x302187}:null;}})[_0x0545('0x24')](respondWithResult(_0x67316a,null))[_0x0545('0x46')](handleError(_0x67316a,null));};exports['getDescriptions']=function(_0x272ee2,_0x777816,_0x9f5787){var _0x520fb8={};var _0x291aac={};var _0x581514;var _0x430837;return db[_0x0545('0x2c')][_0x0545('0x4b')]({'where':{'id':_0x272ee2[_0x0545('0x42')]['id']}})['then'](handleEntityNotFound(_0x777816,null))[_0x0545('0x24')](function(_0x4a61bf){if(_0x4a61bf){_0x581514=_0x4a61bf;_0x291aac[_0x0545('0x43')]=_[_0x0545('0x30')](db[_0x0545('0x50')][_0x0545('0x2d')]);_0x291aac['query']=_[_0x0545('0x30')](_0x272ee2[_0x0545('0x2f')]);_0x291aac[_0x0545('0x38')]=_['intersection'](_0x291aac[_0x0545('0x43')],_0x291aac[_0x0545('0x2f')]);_0x520fb8[_0x0545('0x32')]=_[_0x0545('0x31')](_0x291aac['model'],qs[_0x0545('0x33')](_0x272ee2[_0x0545('0x2f')][_0x0545('0x33')]));_0x520fb8['attributes']=_0x520fb8[_0x0545('0x32')][_0x0545('0x34')]?_0x520fb8['attributes']:_0x291aac['model'];_0x520fb8[_0x0545('0x4c')]=qs[_0x0545('0x36')](_0x272ee2[_0x0545('0x2f')][_0x0545('0x36')]);_0x520fb8[_0x0545('0x37')]=qs[_0x0545('0x38')](_[_0x0545('0x4d')](_0x272ee2['query'],_0x291aac['filters']));if(_0x272ee2['query']['filter']){_0x520fb8[_0x0545('0x37')]=_['merge'](_0x520fb8[_0x0545('0x37')],{'$or':_[_0x0545('0x2b')](_0x520fb8[_0x0545('0x32')],function(_0x104e75){var _0x427519={};_0x427519[_0x104e75]={'$like':'%'+_0x272ee2[_0x0545('0x2f')][_0x0545('0x39')]+'%'};return _0x427519;})});}_0x520fb8=_[_0x0545('0x3c')]({},_0x520fb8,_0x272ee2[_0x0545('0x3d')]);return _0x581514[_0x0545('0x51')](_0x520fb8);}})[_0x0545('0x24')](function(_0x8c90a9){if(_0x8c90a9){_0x430837=_0x8c90a9[_0x0545('0x34')];if(!_0x272ee2[_0x0545('0x2f')][_0x0545('0x35')]('nolimit')){_0x520fb8['limit']=qs[_0x0545('0x1c')](_0x272ee2[_0x0545('0x2f')][_0x0545('0x1c')]);_0x520fb8[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0x272ee2[_0x0545('0x2f')][_0x0545('0x1f')]);}return _0x581514['getDescriptions'](_0x520fb8);}})[_0x0545('0x24')](function(_0x5d075c){if(_0x5d075c){return _0x5d075c?{'count':_0x430837,'rows':_0x5d075c}:null;}})['then'](respondWithResult(_0x777816,null))['catch'](handleError(_0x777816,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b847cb5..65f1333 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 _0x3be5=['define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x20e7a5,_0x471eb4){var _0x1f36a2=function(_0x2db7f0){while(--_0x2db7f0){_0x20e7a5['push'](_0x20e7a5['shift']());}};_0x1f36a2(++_0x471eb4);}(_0x3be5,0x1e3));var _0x53be=function(_0xea492e,_0x20dea6){_0xea492e=_0xea492e-0x0;var _0x108caf=_0x3be5[_0xea492e];return _0x108caf;};'use strict';var _=require(_0x53be('0x0'));var util=require(_0x53be('0x1'));var logger=require(_0x53be('0x2'))(_0x53be('0x3'));var moment=require(_0x53be('0x4'));var BPromise=require(_0x53be('0x5'));var rp=require(_0x53be('0x6'));var fs=require('fs');var path=require(_0x53be('0x7'));var rimraf=require(_0x53be('0x8'));var config=require(_0x53be('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x53be('0xa')]=function(_0x1b9b8b,_0x47e087){return _0x1b9b8b[_0x53be('0xb')](_0x53be('0xc'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd33a=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd33a,0x1df));var _0xad33=function(_0x5103ed,_0x1ed66d){_0x5103ed=_0x5103ed-0x0;var _0xf61316=_0xd33a[_0x5103ed];return _0xf61316;};'use strict';var _=require(_0xad33('0x0'));var util=require(_0xad33('0x1'));var logger=require(_0xad33('0x2'))('api');var moment=require(_0xad33('0x3'));var BPromise=require(_0xad33('0x4'));var rp=require(_0xad33('0x5'));var fs=require('fs');var path=require(_0xad33('0x6'));var rimraf=require(_0xad33('0x7'));var config=require(_0xad33('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xad33('0x9')]=function(_0x240315,_0x1bb216){return _0x240315[_0xad33('0xa')](_0xad33('0xb'),attributes,{'tableName':_0xad33('0xc'),'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 c98b0b2..a96d0de 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 _0x65ee=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message'];(function(_0x3ed6e4,_0x4146f7){var _0x366ae7=function(_0x27c853){while(--_0x27c853){_0x3ed6e4['push'](_0x3ed6e4['shift']());}};_0x366ae7(++_0x4146f7);}(_0x65ee,0xff));var _0xe65e=function(_0x5bd1cd,_0x23e643){_0x5bd1cd=_0x5bd1cd-0x0;var _0x33879f=_0x65ee[_0x5bd1cd];return _0x33879f;};'use strict';var _=require(_0xe65e('0x0'));var util=require(_0xe65e('0x1'));var moment=require(_0xe65e('0x2'));var BPromise=require(_0xe65e('0x3'));var rs=require(_0xe65e('0x4'));var fs=require('fs');var Redis=require(_0xe65e('0x5'));var db=require(_0xe65e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe65e('0x7'))(_0xe65e('0x8'));var config=require('../../config/environment');var jayson=require(_0xe65e('0x9'));var client=jayson[_0xe65e('0xa')][_0xe65e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b815,_0x456a31,_0x19932a){return new BPromise(function(_0xab61ab,_0x683c19){return client[_0xe65e('0xc')](_0x33b815,_0x19932a)[_0xe65e('0xd')](function(_0x5bd14d){logger[_0xe65e('0xe')](_0xe65e('0xf'),_0x456a31,'request\x20sent');logger['debug'](_0xe65e('0x10'),_0x456a31,_0xe65e('0x11'),JSON['stringify'](_0x5bd14d));if(_0x5bd14d['error']){if(_0x5bd14d['error'][_0xe65e('0x12')]===0x1f4){logger[_0xe65e('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x456a31,_0x5bd14d[_0xe65e('0x13')]['message']);return _0x683c19(_0x5bd14d[_0xe65e('0x13')]['message']);}logger[_0xe65e('0x13')](_0xe65e('0xf'),_0x456a31,_0x5bd14d[_0xe65e('0x13')]['message']);return _0xab61ab(_0x5bd14d['error'][_0xe65e('0x14')]);}else{logger[_0xe65e('0xe')](_0xe65e('0xf'),_0x456a31,'request\x20sent');_0xab61ab(_0x5bd14d[_0xe65e('0x15')]['message']);}})[_0xe65e('0x16')](function(_0x5b1c21){logger[_0xe65e('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x456a31,_0x5b1c21);_0x683c19(_0x5b1c21);});});} \ No newline at end of file +var _0xb394=['debug','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','request','then','info','request\x20sent'];(function(_0x3adb1c,_0x562fb9){var _0x19e758=function(_0x28de35){while(--_0x28de35){_0x3adb1c['push'](_0x3adb1c['shift']());}};_0x19e758(++_0x562fb9);}(_0xb394,0x6c));var _0x4b39=function(_0xeb91aa,_0x11e3f6){_0xeb91aa=_0xeb91aa-0x0;var _0x42ecc7=_0xb394[_0xeb91aa];return _0x42ecc7;};'use strict';var _=require(_0x4b39('0x0'));var util=require(_0x4b39('0x1'));var moment=require(_0x4b39('0x2'));var BPromise=require(_0x4b39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b39('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4b39('0x5'))('rpc');var config=require(_0x4b39('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5638ce,_0x2ff08d,_0x3c6e65){return new BPromise(function(_0x128827,_0x22b963){return client[_0x4b39('0x7')](_0x5638ce,_0x3c6e65)[_0x4b39('0x8')](function(_0x301195){logger[_0x4b39('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2ff08d,_0x4b39('0xa'));logger[_0x4b39('0xb')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x2ff08d,'request\x20sent',JSON['stringify'](_0x301195));if(_0x301195[_0x4b39('0xc')]){if(_0x301195['error']['code']===0x1f4){logger[_0x4b39('0xc')](_0x4b39('0xd'),_0x2ff08d,_0x301195['error'][_0x4b39('0xe')]);return _0x22b963(_0x301195[_0x4b39('0xc')]['message']);}logger[_0x4b39('0xc')](_0x4b39('0xd'),_0x2ff08d,_0x301195[_0x4b39('0xc')][_0x4b39('0xe')]);return _0x128827(_0x301195[_0x4b39('0xc')][_0x4b39('0xe')]);}else{logger[_0x4b39('0x9')](_0x4b39('0xd'),_0x2ff08d,_0x4b39('0xa'));_0x128827(_0x301195[_0x4b39('0xf')][_0x4b39('0xe')]);}})[_0x4b39('0x10')](function(_0x214c8e){logger[_0x4b39('0xc')](_0x4b39('0xd'),_0x2ff08d,_0x214c8e);_0x22b963(_0x214c8e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 116eded..fd6dd35 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 _0x64b6=['multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports'];(function(_0xb4dff5,_0x5ea53f){var _0x143b59=function(_0x4ef9b1){while(--_0x4ef9b1){_0xb4dff5['push'](_0xb4dff5['shift']());}};_0x143b59(++_0x5ea53f);}(_0x64b6,0xc3));var _0x664b=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x64b6[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x664b('0x0'));var util=require('util');var path=require(_0x664b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x664b('0x2'));var interaction=require(_0x664b('0x3'));var config=require(_0x664b('0x4'));var controller=require(_0x664b('0x5'));router[_0x664b('0x6')]('/',auth[_0x664b('0x7')](),controller['index']);router[_0x664b('0x6')](_0x664b('0x8'),auth[_0x664b('0x7')](),controller['show']);router[_0x664b('0x9')]('/',auth['isAuthenticated'](),controller[_0x664b('0xa')]);router[_0x664b('0xb')](_0x664b('0x8'),auth[_0x664b('0x7')](),controller[_0x664b('0xc')]);router[_0x664b('0xd')]('/:id',auth[_0x664b('0x7')](),controller['destroy']);module[_0x664b('0xe')]=router; \ No newline at end of file +var _0xc141=['create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x2f55f0,_0xbd116b){var _0x3ef3df=function(_0x4b02a9){while(--_0x4b02a9){_0x2f55f0['push'](_0x2f55f0['shift']());}};_0x3ef3df(++_0xbd116b);}(_0xc141,0x9e));var _0x1c14=function(_0x121328,_0x2c3815){_0x121328=_0x121328-0x0;var _0x28548a=_0xc141[_0x121328];return _0x28548a;};'use strict';var multer=require(_0x1c14('0x0'));var util=require(_0x1c14('0x1'));var path=require('path');var timeout=require(_0x1c14('0x2'));var express=require(_0x1c14('0x3'));var router=express[_0x1c14('0x4')]();var fs_extra=require(_0x1c14('0x5'));var auth=require(_0x1c14('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1c14('0x7'));var controller=require('./intSalesforceField.controller');router[_0x1c14('0x8')]('/',auth[_0x1c14('0x9')](),controller[_0x1c14('0xa')]);router[_0x1c14('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1c14('0xb')]);router[_0x1c14('0xc')]('/',auth[_0x1c14('0x9')](),controller[_0x1c14('0xd')]);router[_0x1c14('0xe')](_0x1c14('0xf'),auth[_0x1c14('0x9')](),controller[_0x1c14('0x10')]);router[_0x1c14('0x11')](_0x1c14('0xf'),auth[_0x1c14('0x9')](),controller['destroy']);module[_0x1c14('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e61e481..e8f2e9b 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 _0x7bc6=['ENUM','customVariable','sequelize','string','variable','keyValue','picklist','STRING'];(function(_0x5bbc7a,_0x17eaf1){var _0x16f91a=function(_0x52f167){while(--_0x52f167){_0x5bbc7a['push'](_0x5bbc7a['shift']());}};_0x16f91a(++_0x17eaf1);}(_0x7bc6,0x11a));var _0x67bc=function(_0x5ae187,_0x8afd5c){_0x5ae187=_0x5ae187-0x0;var _0x211069=_0x7bc6[_0x5ae187];return _0x211069;};'use strict';var Sequelize=require(_0x67bc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x67bc('0x1'),_0x67bc('0x2'),'customVariable',_0x67bc('0x3'),_0x67bc('0x4')),'defaultValue':_0x67bc('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x67bc('0x5')]},'keyType':{'type':Sequelize[_0x67bc('0x6')](_0x67bc('0x1'),_0x67bc('0x2'),_0x67bc('0x7'))},'keyContent':{'type':Sequelize[_0x67bc('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x67bc('0x5')]}}; \ No newline at end of file +var _0xef85=['variable','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x428fd1,_0x22d64f){var _0x17883b=function(_0x1d5f06){while(--_0x1d5f06){_0x428fd1['push'](_0x428fd1['shift']());}};_0x17883b(++_0x22d64f);}(_0xef85,0x13c));var _0x5ef8=function(_0x4b7b79,_0x11ed7d){_0x4b7b79=_0x4b7b79-0x0;var _0x93a80c=_0xef85[_0x4b7b79];return _0x93a80c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5ef8('0x0')](_0x5ef8('0x1'),'variable',_0x5ef8('0x2'),_0x5ef8('0x3'),_0x5ef8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5ef8('0x5')]},'keyType':{'type':Sequelize[_0x5ef8('0x0')]('string',_0x5ef8('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5ef8('0x5')]},'variableName':{'type':Sequelize[_0x5ef8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6cfb39f..fbcf0e1 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 _0xefac=['show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','SalesforceField','includeAll','include','findAll','catch'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xefac,0x118));var _0xcefa=function(_0x3540bb,_0x1735ff){_0x3540bb=_0x3540bb-0x0;var _0x3ed2b6=_0xefac[_0x3540bb];return _0x3ed2b6;};'use strict';var emlformat=require(_0xcefa('0x0'));var rimraf=require(_0xcefa('0x1'));var zipdir=require(_0xcefa('0x2'));var jsonpatch=require(_0xcefa('0x3'));var rp=require('request-promise');var moment=require(_0xcefa('0x4'));var BPromise=require(_0xcefa('0x5'));var Mustache=require('mustache');var util=require(_0xcefa('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcefa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcefa('0x8'));var squel=require(_0xcefa('0x9'));var crypto=require('crypto');var jsforce=require(_0xcefa('0xa'));var deskjs=require(_0xcefa('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcefa('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcefa('0xd'));var as=require(_0xcefa('0xe'));var hardwareService=require(_0xcefa('0xf'));var logger=require('../../config/logger')(_0xcefa('0x10'));var utils=require(_0xcefa('0x11'));var config=require(_0xcefa('0x12'));var licenseUtil=require(_0xcefa('0x13'));var db=require(_0xcefa('0x14'))['db'];function respondWithStatusCode(_0x437a85,_0x36fbbf){_0x36fbbf=_0x36fbbf||0xcc;return function(_0x47c596){if(_0x47c596){return _0x437a85[_0xcefa('0x15')](_0x36fbbf);}return _0x437a85[_0xcefa('0x16')](_0x36fbbf)[_0xcefa('0x17')]();};}function respondWithResult(_0xf03992,_0x566223){_0x566223=_0x566223||0xc8;return function(_0x55d1d4){if(_0x55d1d4){return _0xf03992[_0xcefa('0x16')](_0x566223)[_0xcefa('0x18')](_0x55d1d4);}};}function respondWithFilteredResult(_0x16cd4b,_0x3ed0a3){return function(_0x39223e){if(_0x39223e){var _0x2dba15=typeof _0x3ed0a3['offset']===_0xcefa('0x19')&&typeof _0x3ed0a3[_0xcefa('0x1a')]===_0xcefa('0x19');var _0x5bbcbc=_0x39223e[_0xcefa('0x1b')];var _0x3f07a5=_0x2dba15?0x0:_0x3ed0a3[_0xcefa('0x1c')];var _0xa65d9=_0x2dba15?_0x39223e[_0xcefa('0x1b')]:_0x3ed0a3['offset']+_0x3ed0a3['limit'];var _0x51559e;if(_0xa65d9>=_0x5bbcbc){_0xa65d9=_0x5bbcbc;_0x51559e=0xc8;}else{_0x51559e=0xce;}_0x16cd4b[_0xcefa('0x16')](_0x51559e);return _0x16cd4b[_0xcefa('0x1d')](_0xcefa('0x1e'),_0x3f07a5+'-'+_0xa65d9+'/'+_0x5bbcbc)['json'](_0x39223e);}return null;};}function patchUpdates(_0x15a2aa){return function(_0x3e63c9){try{jsonpatch['apply'](_0x3e63c9,_0x15a2aa,!![]);}catch(_0x4e6eb9){return BPromise[_0xcefa('0x1f')](_0x4e6eb9);}return _0x3e63c9[_0xcefa('0x20')]();};}function saveUpdates(_0x244ddf,_0xcf3688){return function(_0x180c18){if(_0x180c18){return _0x180c18[_0xcefa('0x21')](_0x244ddf)[_0xcefa('0x22')](function(_0x3fb76f){return _0x3fb76f;});}return null;};}function removeEntity(_0x18805f,_0xcbba4){return function(_0x2f1f3b){if(_0x2f1f3b){return _0x2f1f3b[_0xcefa('0x23')]()['then'](function(){_0x18805f[_0xcefa('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47cf25,_0x504df8){return function(_0x4cb470){if(!_0x4cb470){_0x47cf25['sendStatus'](0x194);}return _0x4cb470;};}function handleError(_0x551869,_0x337c16){_0x337c16=_0x337c16||0x1f4;return function(_0x4ac32d){logger[_0xcefa('0x24')](_0x4ac32d['stack']);if(_0x4ac32d[_0xcefa('0x25')]){delete _0x4ac32d[_0xcefa('0x25')];}_0x551869[_0xcefa('0x16')](_0x337c16)[_0xcefa('0x26')](_0x4ac32d);};}exports[_0xcefa('0x27')]=function(_0x55f6de,_0x3247b4){var _0x34f98a={},_0x3940a2={},_0xeb5c42={'count':0x0,'rows':[]};var _0xedc00=_['map'](db['SalesforceField'][_0xcefa('0x28')],function(_0x25f292){return{'name':_0x25f292[_0xcefa('0x29')],'type':_0x25f292[_0xcefa('0x2a')][_0xcefa('0x2b')]};});_0x3940a2[_0xcefa('0x2c')]=_[_0xcefa('0x2d')](_0xedc00,'name');_0x3940a2['query']=_[_0xcefa('0x2e')](_0x55f6de[_0xcefa('0x2f')]);_0x3940a2[_0xcefa('0x30')]=_[_0xcefa('0x31')](_0x3940a2[_0xcefa('0x2c')],_0x3940a2['query']);_0x34f98a[_0xcefa('0x32')]=_[_0xcefa('0x31')](_0x3940a2[_0xcefa('0x2c')],qs['fields'](_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x33')]));_0x34f98a[_0xcefa('0x32')]=_0x34f98a[_0xcefa('0x32')][_0xcefa('0x34')]?_0x34f98a[_0xcefa('0x32')]:_0x3940a2[_0xcefa('0x2c')];if(!_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x35')](_0xcefa('0x36'))){_0x34f98a[_0xcefa('0x1a')]=qs[_0xcefa('0x1a')](_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x1a')]);_0x34f98a[_0xcefa('0x1c')]=qs[_0xcefa('0x1c')](_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x1c')]);}_0x34f98a['order']=qs[_0xcefa('0x37')](_0x55f6de['query'][_0xcefa('0x37')]);_0x34f98a[_0xcefa('0x38')]=qs[_0xcefa('0x30')](_['pick'](_0x55f6de[_0xcefa('0x2f')],_0x3940a2[_0xcefa('0x30')]),_0xedc00);if(_0x55f6de['query'][_0xcefa('0x39')]){_0x34f98a[_0xcefa('0x38')]=_['merge'](_0x34f98a[_0xcefa('0x38')],{'$or':_[_0xcefa('0x2d')](_0xedc00,function(_0x2223dd){if(_0x2223dd[_0xcefa('0x2a')]!==_0xcefa('0x3a')){var _0x483b15={};_0x483b15[_0x2223dd[_0xcefa('0x25')]]={'$like':'%'+_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x39')]+'%'};return _0x483b15;}})});}_0x34f98a=_['merge']({},_0x34f98a,_0x55f6de[_0xcefa('0x3b')]);var _0x4aab81={'where':_0x34f98a[_0xcefa('0x38')]};return db[_0xcefa('0x3c')][_0xcefa('0x1b')](_0x4aab81)[_0xcefa('0x22')](function(_0x5b34c6){_0xeb5c42[_0xcefa('0x1b')]=_0x5b34c6;if(_0x55f6de[_0xcefa('0x2f')][_0xcefa('0x3d')]){_0x34f98a[_0xcefa('0x3e')]=[{'all':!![]}];}return db[_0xcefa('0x3c')][_0xcefa('0x3f')](_0x34f98a);})[_0xcefa('0x22')](function(_0x5b6d77){_0xeb5c42['rows']=_0x5b6d77;return _0xeb5c42;})['then'](respondWithFilteredResult(_0x3247b4,_0x34f98a))[_0xcefa('0x40')](handleError(_0x3247b4,null));};exports[_0xcefa('0x41')]=function(_0x16bec3,_0x26ec52){var _0x5940db={'raw':!![],'where':{'id':_0x16bec3[_0xcefa('0x42')]['id']}},_0xeccad9={};_0xeccad9[_0xcefa('0x2c')]=_[_0xcefa('0x2e')](db[_0xcefa('0x3c')][_0xcefa('0x28')]);_0xeccad9[_0xcefa('0x2f')]=_['keys'](_0x16bec3['query']);_0xeccad9[_0xcefa('0x30')]=_[_0xcefa('0x31')](_0xeccad9[_0xcefa('0x2c')],_0xeccad9[_0xcefa('0x2f')]);_0x5940db[_0xcefa('0x32')]=_['intersection'](_0xeccad9['model'],qs[_0xcefa('0x33')](_0x16bec3[_0xcefa('0x2f')]['fields']));_0x5940db[_0xcefa('0x32')]=_0x5940db['attributes']['length']?_0x5940db[_0xcefa('0x32')]:_0xeccad9[_0xcefa('0x2c')];if(_0x16bec3[_0xcefa('0x2f')]['includeAll']){_0x5940db[_0xcefa('0x3e')]=[{'all':!![]}];}_0x5940db=_['merge']({},_0x5940db,_0x16bec3[_0xcefa('0x3b')]);return db[_0xcefa('0x3c')][_0xcefa('0x43')](_0x5940db)[_0xcefa('0x22')](handleEntityNotFound(_0x26ec52,null))['then'](respondWithResult(_0x26ec52,null))['catch'](handleError(_0x26ec52,null));};exports['create']=function(_0xba8022,_0x550f07){return db[_0xcefa('0x3c')]['create'](_0xba8022[_0xcefa('0x44')],{})['then'](respondWithResult(_0x550f07,0xc9))[_0xcefa('0x40')](handleError(_0x550f07,null));};exports['update']=function(_0x337b20,_0x363e9c){if(_0x337b20['body']['id']){delete _0x337b20[_0xcefa('0x44')]['id'];}return db[_0xcefa('0x3c')][_0xcefa('0x43')]({'where':{'id':_0x337b20[_0xcefa('0x42')]['id']}})[_0xcefa('0x22')](handleEntityNotFound(_0x363e9c,null))[_0xcefa('0x22')](saveUpdates(_0x337b20[_0xcefa('0x44')],null))[_0xcefa('0x22')](respondWithResult(_0x363e9c,null))[_0xcefa('0x40')](handleError(_0x363e9c,null));};exports[_0xcefa('0x23')]=function(_0x2320f8,_0x599996){return db[_0xcefa('0x3c')]['find']({'where':{'id':_0x2320f8['params']['id']}})[_0xcefa('0x22')](handleEntityNotFound(_0x599996,null))['then'](removeEntity(_0x599996,null))[_0xcefa('0x40')](handleError(_0x599996,null));}; \ No newline at end of file +var _0x1db8=['show','length','includeAll','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1db8,0xee));var _0x81db=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x1db8[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0x81db('0x0'));var rimraf=require(_0x81db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81db('0x2'));var rp=require(_0x81db('0x3'));var moment=require(_0x81db('0x4'));var BPromise=require(_0x81db('0x5'));var Mustache=require(_0x81db('0x6'));var util=require(_0x81db('0x7'));var path=require(_0x81db('0x8'));var sox=require(_0x81db('0x9'));var csv=require(_0x81db('0xa'));var ejs=require(_0x81db('0xb'));var fs=require('fs');var fs_extra=require(_0x81db('0xc'));var _=require(_0x81db('0xd'));var squel=require('squel');var crypto=require(_0x81db('0xe'));var jsforce=require(_0x81db('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x81db('0xa'));var querystring=require(_0x81db('0x10'));var Papa=require('papaparse');var Redis=require(_0x81db('0x11'));var authService=require(_0x81db('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x81db('0x13'));var hardwareService=require(_0x81db('0x14'));var logger=require(_0x81db('0x15'))(_0x81db('0x16'));var utils=require(_0x81db('0x17'));var config=require(_0x81db('0x18'));var licenseUtil=require(_0x81db('0x19'));var db=require(_0x81db('0x1a'))['db'];function respondWithStatusCode(_0x119fd8,_0x30ac4b){_0x30ac4b=_0x30ac4b||0xcc;return function(_0x6ae07a){if(_0x6ae07a){return _0x119fd8['sendStatus'](_0x30ac4b);}return _0x119fd8['status'](_0x30ac4b)[_0x81db('0x1b')]();};}function respondWithResult(_0xe59850,_0xc018af){_0xc018af=_0xc018af||0xc8;return function(_0x23d36e){if(_0x23d36e){return _0xe59850[_0x81db('0x1c')](_0xc018af)[_0x81db('0x1d')](_0x23d36e);}};}function respondWithFilteredResult(_0x593861,_0x4dd0cf){return function(_0xbc1b2b){if(_0xbc1b2b){var _0xb3f15e=typeof _0x4dd0cf[_0x81db('0x1e')]===_0x81db('0x1f')&&typeof _0x4dd0cf[_0x81db('0x20')]===_0x81db('0x1f');var _0x53dab7=_0xbc1b2b[_0x81db('0x21')];var _0x1b5600=_0xb3f15e?0x0:_0x4dd0cf['offset'];var _0x23eb98=_0xb3f15e?_0xbc1b2b[_0x81db('0x21')]:_0x4dd0cf[_0x81db('0x1e')]+_0x4dd0cf[_0x81db('0x20')];var _0x1c0d46;if(_0x23eb98>=_0x53dab7){_0x23eb98=_0x53dab7;_0x1c0d46=0xc8;}else{_0x1c0d46=0xce;}_0x593861['status'](_0x1c0d46);return _0x593861[_0x81db('0x22')](_0x81db('0x23'),_0x1b5600+'-'+_0x23eb98+'/'+_0x53dab7)[_0x81db('0x1d')](_0xbc1b2b);}return null;};}function patchUpdates(_0xf1375c){return function(_0x4d049e){try{jsonpatch['apply'](_0x4d049e,_0xf1375c,!![]);}catch(_0x456728){return BPromise[_0x81db('0x24')](_0x456728);}return _0x4d049e[_0x81db('0x25')]();};}function saveUpdates(_0x404ba5,_0x28ca03){return function(_0x4aeb6b){if(_0x4aeb6b){return _0x4aeb6b[_0x81db('0x26')](_0x404ba5)[_0x81db('0x27')](function(_0x5ba142){return _0x5ba142;});}return null;};}function removeEntity(_0x51d8bb,_0x40c99e){return function(_0x4f28d4){if(_0x4f28d4){return _0x4f28d4[_0x81db('0x28')]()['then'](function(){_0x51d8bb[_0x81db('0x1c')](0xcc)[_0x81db('0x1b')]();});}};}function handleEntityNotFound(_0x5b040f,_0x8c8312){return function(_0x470c2b){if(!_0x470c2b){_0x5b040f[_0x81db('0x29')](0x194);}return _0x470c2b;};}function handleError(_0x1bf78f,_0x42e7ca){_0x42e7ca=_0x42e7ca||0x1f4;return function(_0x2c8b94){logger[_0x81db('0x2a')](_0x2c8b94[_0x81db('0x2b')]);if(_0x2c8b94[_0x81db('0x2c')]){delete _0x2c8b94['name'];}_0x1bf78f[_0x81db('0x1c')](_0x42e7ca)[_0x81db('0x2d')](_0x2c8b94);};}exports[_0x81db('0x2e')]=function(_0x5ce46d,_0x5df8dc){var _0x561a2b={},_0x47b18d={},_0x5347b1={'count':0x0,'rows':[]};var _0x589230=_[_0x81db('0x2f')](db[_0x81db('0x30')][_0x81db('0x31')],function(_0x5bf881){return{'name':_0x5bf881[_0x81db('0x32')],'type':_0x5bf881[_0x81db('0x33')]['key']};});_0x47b18d[_0x81db('0x34')]=_['map'](_0x589230,_0x81db('0x2c'));_0x47b18d[_0x81db('0x35')]=_[_0x81db('0x36')](_0x5ce46d[_0x81db('0x35')]);_0x47b18d['filters']=_[_0x81db('0x37')](_0x47b18d[_0x81db('0x34')],_0x47b18d[_0x81db('0x35')]);_0x561a2b[_0x81db('0x38')]=_[_0x81db('0x37')](_0x47b18d[_0x81db('0x34')],qs[_0x81db('0x39')](_0x5ce46d[_0x81db('0x35')]['fields']));_0x561a2b['attributes']=_0x561a2b[_0x81db('0x38')]['length']?_0x561a2b[_0x81db('0x38')]:_0x47b18d['model'];if(!_0x5ce46d[_0x81db('0x35')]['hasOwnProperty']('nolimit')){_0x561a2b[_0x81db('0x20')]=qs[_0x81db('0x20')](_0x5ce46d[_0x81db('0x35')][_0x81db('0x20')]);_0x561a2b['offset']=qs[_0x81db('0x1e')](_0x5ce46d[_0x81db('0x35')][_0x81db('0x1e')]);}_0x561a2b[_0x81db('0x3a')]=qs[_0x81db('0x3b')](_0x5ce46d[_0x81db('0x35')][_0x81db('0x3b')]);_0x561a2b[_0x81db('0x3c')]=qs[_0x81db('0x3d')](_[_0x81db('0x3e')](_0x5ce46d['query'],_0x47b18d[_0x81db('0x3d')]),_0x589230);if(_0x5ce46d[_0x81db('0x35')][_0x81db('0x3f')]){_0x561a2b[_0x81db('0x3c')]=_[_0x81db('0x40')](_0x561a2b['where'],{'$or':_[_0x81db('0x2f')](_0x589230,function(_0x101bb7){if(_0x101bb7[_0x81db('0x33')]!==_0x81db('0x41')){var _0xa06c68={};_0xa06c68[_0x101bb7['name']]={'$like':'%'+_0x5ce46d[_0x81db('0x35')]['filter']+'%'};return _0xa06c68;}})});}_0x561a2b=_[_0x81db('0x40')]({},_0x561a2b,_0x5ce46d[_0x81db('0x42')]);var _0x5cc989={'where':_0x561a2b[_0x81db('0x3c')]};return db['SalesforceField'][_0x81db('0x21')](_0x5cc989)[_0x81db('0x27')](function(_0x33578d){_0x5347b1[_0x81db('0x21')]=_0x33578d;if(_0x5ce46d[_0x81db('0x35')]['includeAll']){_0x561a2b['include']=[{'all':!![]}];}return db[_0x81db('0x30')][_0x81db('0x43')](_0x561a2b);})[_0x81db('0x27')](function(_0x359d40){_0x5347b1[_0x81db('0x44')]=_0x359d40;return _0x5347b1;})['then'](respondWithFilteredResult(_0x5df8dc,_0x561a2b))[_0x81db('0x45')](handleError(_0x5df8dc,null));};exports[_0x81db('0x46')]=function(_0x5897af,_0x3eb708){var _0x568cbf={'raw':!![],'where':{'id':_0x5897af['params']['id']}},_0x3769a4={};_0x3769a4[_0x81db('0x34')]=_['keys'](db[_0x81db('0x30')][_0x81db('0x31')]);_0x3769a4[_0x81db('0x35')]=_['keys'](_0x5897af[_0x81db('0x35')]);_0x3769a4['filters']=_['intersection'](_0x3769a4[_0x81db('0x34')],_0x3769a4['query']);_0x568cbf['attributes']=_[_0x81db('0x37')](_0x3769a4['model'],qs[_0x81db('0x39')](_0x5897af[_0x81db('0x35')]['fields']));_0x568cbf[_0x81db('0x38')]=_0x568cbf[_0x81db('0x38')][_0x81db('0x47')]?_0x568cbf[_0x81db('0x38')]:_0x3769a4[_0x81db('0x34')];if(_0x5897af[_0x81db('0x35')][_0x81db('0x48')]){_0x568cbf['include']=[{'all':!![]}];}_0x568cbf=_[_0x81db('0x40')]({},_0x568cbf,_0x5897af[_0x81db('0x42')]);return db[_0x81db('0x30')]['find'](_0x568cbf)[_0x81db('0x27')](handleEntityNotFound(_0x3eb708,null))['then'](respondWithResult(_0x3eb708,null))[_0x81db('0x45')](handleError(_0x3eb708,null));};exports[_0x81db('0x49')]=function(_0x420dd0,_0x24f428){return db['SalesforceField']['create'](_0x420dd0['body'],{})[_0x81db('0x27')](respondWithResult(_0x24f428,0xc9))[_0x81db('0x45')](handleError(_0x24f428,null));};exports[_0x81db('0x26')]=function(_0x4da858,_0x5c2f10){if(_0x4da858[_0x81db('0x4a')]['id']){delete _0x4da858[_0x81db('0x4a')]['id'];}return db[_0x81db('0x30')][_0x81db('0x4b')]({'where':{'id':_0x4da858['params']['id']}})[_0x81db('0x27')](handleEntityNotFound(_0x5c2f10,null))[_0x81db('0x27')](saveUpdates(_0x4da858['body'],null))['then'](respondWithResult(_0x5c2f10,null))[_0x81db('0x45')](handleError(_0x5c2f10,null));};exports[_0x81db('0x28')]=function(_0x33ec0d,_0x4bc025){return db[_0x81db('0x30')][_0x81db('0x4b')]({'where':{'id':_0x33ec0d[_0x81db('0x4c')]['id']}})[_0x81db('0x27')](handleEntityNotFound(_0x4bc025,null))[_0x81db('0x27')](removeEntity(_0x4bc025,null))[_0x81db('0x45')](handleError(_0x4bc025,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7693fe6..592b88f 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 _0xda22=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xda22,0x19e));var _0x2da2=function(_0x41cbe7,_0x2173e4){_0x41cbe7=_0x41cbe7-0x0;var _0x2a699d=_0xda22[_0x41cbe7];return _0x2a699d;};'use strict';var _=require(_0x2da2('0x0'));var util=require(_0x2da2('0x1'));var logger=require(_0x2da2('0x2'))(_0x2da2('0x3'));var moment=require(_0x2da2('0x4'));var BPromise=require(_0x2da2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2da2('0x6'));var rimraf=require(_0x2da2('0x7'));var config=require(_0x2da2('0x8'));var attributes=require(_0x2da2('0x9'));module[_0x2da2('0xa')]=function(_0x581272,_0x118f45){return _0x581272['define']('SalesforceField',attributes,{'tableName':_0x2da2('0xb'),'paranoid':![],'indexes':[{'name':_0x2da2('0xc'),'fields':[_0x2da2('0xd'),_0x2da2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe844=['../../config/logger','api','moment','request-promise','rimraf','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','lodash'];(function(_0x2b55f5,_0x4e9ac4){var _0x145169=function(_0x317d22){while(--_0x317d22){_0x2b55f5['push'](_0x2b55f5['shift']());}};_0x145169(++_0x4e9ac4);}(_0xe844,0x199));var _0x4e84=function(_0x11bfe2,_0x47149a){_0x11bfe2=_0x11bfe2-0x0;var _0x57c253=_0xe844[_0x11bfe2];return _0x57c253;};'use strict';var _=require(_0x4e84('0x0'));var util=require('util');var logger=require(_0x4e84('0x1'))(_0x4e84('0x2'));var moment=require(_0x4e84('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e84('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e84('0x6'));module['exports']=function(_0x52b38e,_0x231b78){return _0x52b38e[_0x4e84('0x7')]('SalesforceField',attributes,{'tableName':_0x4e84('0x8'),'paranoid':![],'indexes':[{'name':_0x4e84('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index d101b4f..4ae0e1a 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 _0xa6d5=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6d5,0x1dc));var _0x5a6d=function(_0x241a24,_0x448a1d){_0x241a24=_0x241a24-0x0;var _0x1a1ee6=_0xa6d5[_0x241a24];return _0x1a1ee6;};'use strict';var _=require('lodash');var util=require(_0x5a6d('0x0'));var moment=require(_0x5a6d('0x1'));var BPromise=require(_0x5a6d('0x2'));var rs=require(_0x5a6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a6d('0x4'))['db'];var utils=require(_0x5a6d('0x5'));var logger=require('../../config/logger')(_0x5a6d('0x6'));var config=require('../../config/environment');var jayson=require(_0x5a6d('0x7'));var client=jayson[_0x5a6d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde0ca1,_0x449322,_0x31f0e6){return new BPromise(function(_0x2cdea5,_0x58d361){return client['request'](_0xde0ca1,_0x31f0e6)[_0x5a6d('0x9')](function(_0x3a669c){logger['info'](_0x5a6d('0xa'),_0x449322,_0x5a6d('0xb'));logger[_0x5a6d('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x449322,_0x5a6d('0xb'),JSON[_0x5a6d('0xd')](_0x3a669c));if(_0x3a669c[_0x5a6d('0xe')]){if(_0x3a669c['error'][_0x5a6d('0xf')]===0x1f4){logger[_0x5a6d('0xe')](_0x5a6d('0xa'),_0x449322,_0x3a669c['error'][_0x5a6d('0x10')]);return _0x58d361(_0x3a669c[_0x5a6d('0xe')][_0x5a6d('0x10')]);}logger[_0x5a6d('0xe')](_0x5a6d('0xa'),_0x449322,_0x3a669c[_0x5a6d('0xe')][_0x5a6d('0x10')]);return _0x2cdea5(_0x3a669c[_0x5a6d('0xe')][_0x5a6d('0x10')]);}else{logger[_0x5a6d('0x11')](_0x5a6d('0xa'),_0x449322,_0x5a6d('0xb'));_0x2cdea5(_0x3a669c[_0x5a6d('0x12')]['message']);}})[_0x5a6d('0x13')](function(_0x20cf89){logger[_0x5a6d('0xe')](_0x5a6d('0xa'),_0x449322,_0x20cf89);_0x58d361(_0x20cf89);});});} \ No newline at end of file +var _0xf5c7=['info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','ioredis','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x401c88,_0x5c9ef9){var _0x3126a0=function(_0x56f75c){while(--_0x56f75c){_0x401c88['push'](_0x401c88['shift']());}};_0x3126a0(++_0x5c9ef9);}(_0xf5c7,0x15f));var _0x7f5c=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0xf5c7[_0x1c4409];return _0x356d8f;};'use strict';var _=require(_0x7f5c('0x0'));var util=require(_0x7f5c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f5c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f5c('0x3'));var config=require(_0x7f5c('0x4'));var jayson=require(_0x7f5c('0x5'));var client=jayson['client'][_0x7f5c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x143f37,_0x25b4af,_0x333262){return new BPromise(function(_0x9b75c6,_0x5da62a){return client[_0x7f5c('0x7')](_0x143f37,_0x333262)[_0x7f5c('0x8')](function(_0x27e31b){logger[_0x7f5c('0x9')](_0x7f5c('0xa'),_0x25b4af,_0x7f5c('0xb'));logger['debug'](_0x7f5c('0xc'),_0x25b4af,_0x7f5c('0xb'),JSON[_0x7f5c('0xd')](_0x27e31b));if(_0x27e31b[_0x7f5c('0xe')]){if(_0x27e31b[_0x7f5c('0xe')][_0x7f5c('0xf')]===0x1f4){logger[_0x7f5c('0xe')](_0x7f5c('0xa'),_0x25b4af,_0x27e31b[_0x7f5c('0xe')][_0x7f5c('0x10')]);return _0x5da62a(_0x27e31b[_0x7f5c('0xe')][_0x7f5c('0x10')]);}logger[_0x7f5c('0xe')]('SalesforceField,\x20%s,\x20%s',_0x25b4af,_0x27e31b['error']['message']);return _0x9b75c6(_0x27e31b[_0x7f5c('0xe')][_0x7f5c('0x10')]);}else{logger['info'](_0x7f5c('0xa'),_0x25b4af,'request\x20sent');_0x9b75c6(_0x27e31b[_0x7f5c('0x11')][_0x7f5c('0x10')]);}})['catch'](function(_0x3cd84d){logger[_0x7f5c('0xe')](_0x7f5c('0xa'),_0x25b4af,_0x3cd84d);_0x5da62a(_0x3cd84d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9102d78..95f6ae9 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 _0x99d2=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put'];(function(_0x1b7c27,_0x38188f){var _0x19e02b=function(_0x383bb1){while(--_0x383bb1){_0x1b7c27['push'](_0x1b7c27['shift']());}};_0x19e02b(++_0x38188f);}(_0x99d2,0x88));var _0x299d=function(_0x180e84,_0x5eed6d){_0x180e84=_0x180e84-0x0;var _0x1e7d74=_0x99d2[_0x180e84];return _0x1e7d74;};'use strict';var multer=require(_0x299d('0x0'));var util=require(_0x299d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x299d('0x2'));var router=express[_0x299d('0x3')]();var fs_extra=require(_0x299d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x299d('0x5'));var config=require(_0x299d('0x6'));var controller=require(_0x299d('0x7'));router['get']('/',auth[_0x299d('0x8')](),controller['index']);router['get'](_0x299d('0x9'),auth[_0x299d('0x8')](),controller[_0x299d('0xa')]);router[_0x299d('0xb')]('/:id/configurations',auth[_0x299d('0x8')](),controller[_0x299d('0xc')]);router['get'](_0x299d('0xd'),auth[_0x299d('0x8')](),controller['getFields']);router[_0x299d('0xe')]('/',auth[_0x299d('0x8')](),controller['create']);router[_0x299d('0xe')](_0x299d('0xf'),auth[_0x299d('0x8')](),controller[_0x299d('0x10')]);router[_0x299d('0x11')](_0x299d('0x9'),auth['isAuthenticated'](),controller[_0x299d('0x12')]);router[_0x299d('0x13')]('/:id',auth[_0x299d('0x8')](),controller[_0x299d('0x14')]);module[_0x299d('0x15')]=router; \ No newline at end of file +var _0x2831=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','exports','multer','util','path'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x2831,0x189));var _0x1283=function(_0x2fecbc,_0x5e8b04){_0x2fecbc=_0x2fecbc-0x0;var _0x2bab10=_0x2831[_0x2fecbc];return _0x2bab10;};'use strict';var multer=require(_0x1283('0x0'));var util=require(_0x1283('0x1'));var path=require(_0x1283('0x2'));var timeout=require('connect-timeout');var express=require(_0x1283('0x3'));var router=express[_0x1283('0x4')]();var fs_extra=require(_0x1283('0x5'));var auth=require(_0x1283('0x6'));var interaction=require(_0x1283('0x7'));var config=require(_0x1283('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x1283('0x9')]('/',auth[_0x1283('0xa')](),controller[_0x1283('0xb')]);router[_0x1283('0x9')](_0x1283('0xc'),auth[_0x1283('0xa')](),controller[_0x1283('0xd')]);router[_0x1283('0x9')](_0x1283('0xe'),auth[_0x1283('0xa')](),controller[_0x1283('0xf')]);router['get'](_0x1283('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x1283('0x11')]('/',auth[_0x1283('0xa')](),controller[_0x1283('0x12')]);router['post'](_0x1283('0xe'),auth['isAuthenticated'](),controller[_0x1283('0x13')]);router[_0x1283('0x14')]('/:id',auth[_0x1283('0xa')](),controller['update']);router['delete'](_0x1283('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1283('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ad0ae11..75a73be 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 _0x38d9=['STRING','username','remoteUri','sequelize'];(function(_0x4ec628,_0xa0e103){var _0x598be1=function(_0x22432f){while(--_0x22432f){_0x4ec628['push'](_0x4ec628['shift']());}};_0x598be1(++_0xa0e103);}(_0x38d9,0x1b3));var _0x938d=function(_0x5b8b8f,_0x37723c){_0x5b8b8f=_0x5b8b8f-0x0;var _0x23c772=_0x38d9[_0x5b8b8f];return _0x23c772;};'use strict';var Sequelize=require(_0x938d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x938d('0x1')]},'username':{'type':Sequelize[_0x938d('0x1')],'unique':_0x938d('0x2')},'password':{'type':Sequelize[_0x938d('0x1')]},'email':{'type':Sequelize[_0x938d('0x1')]},'remoteUri':{'type':Sequelize[_0x938d('0x1')],'unique':_0x938d('0x3')},'serverUrl':{'type':Sequelize[_0x938d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x010a=['username','remoteUri','exports','STRING'];(function(_0x2ff1f6,_0x1bc588){var _0xbae96d=function(_0x505c67){while(--_0x505c67){_0x2ff1f6['push'](_0x2ff1f6['shift']());}};_0xbae96d(++_0x1bc588);}(_0x010a,0x17e));var _0xa010=function(_0x3ef7a3,_0x39dd6a){_0x3ef7a3=_0x3ef7a3-0x0;var _0x369b63=_0x010a[_0x3ef7a3];return _0x369b63;};'use strict';var Sequelize=require('sequelize');module[_0xa010('0x0')]={'name':{'type':Sequelize[_0xa010('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa010('0x1')],'unique':_0xa010('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa010('0x1')]},'remoteUri':{'type':Sequelize[_0xa010('0x1')],'unique':_0xa010('0x3')},'serverUrl':{'type':Sequelize[_0xa010('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 6535bf3..0b229c0 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 _0x3c46=['sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','GET','incident?sysparm_display_value=all','result','assign','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','ServicenowAccount','includeAll','include','rows','catch','show','params','rawAttributes','filters','find','create','body','getConfigurations','findOne','intersection','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','short_description','close_code','delivery_task','work_start','assignment_group','description','sys_class_name','close_notes','closed_by','follow_up'];(function(_0x383335,_0x5b4ed9){var _0x388a3f=function(_0x1bc98b){while(--_0x1bc98b){_0x383335['push'](_0x383335['shift']());}};_0x388a3f(++_0x5b4ed9);}(_0x3c46,0xf3));var _0x63c4=function(_0xe5aee0,_0xa220a4){_0xe5aee0=_0xe5aee0-0x0;var _0x5379b9=_0x3c46[_0xe5aee0];return _0x5379b9;};'use strict';var emlformat=require(_0x63c4('0x0'));var rimraf=require(_0x63c4('0x1'));var zipdir=require(_0x63c4('0x2'));var jsonpatch=require(_0x63c4('0x3'));var rp=require(_0x63c4('0x4'));var moment=require(_0x63c4('0x5'));var BPromise=require(_0x63c4('0x6'));var Mustache=require('mustache');var util=require(_0x63c4('0x7'));var path=require(_0x63c4('0x8'));var sox=require(_0x63c4('0x9'));var csv=require(_0x63c4('0xa'));var ejs=require(_0x63c4('0xb'));var fs=require('fs');var fs_extra=require(_0x63c4('0xc'));var _=require(_0x63c4('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x63c4('0xe'));var deskjs=require(_0x63c4('0xf'));var toCsv=require(_0x63c4('0xa'));var querystring=require(_0x63c4('0x10'));var Papa=require(_0x63c4('0x11'));var Redis=require('ioredis');var authService=require(_0x63c4('0x12'));var qs=require(_0x63c4('0x13'));var as=require(_0x63c4('0x14'));var hardwareService=require(_0x63c4('0x15'));var logger=require('../../config/logger')(_0x63c4('0x16'));var utils=require('../../config/utils');var config=require(_0x63c4('0x17'));var licenseUtil=require(_0x63c4('0x18'));var db=require(_0x63c4('0x19'))['db'];var integrations=require(_0x63c4('0x1a'));function respondWithStatusCode(_0x246f98,_0x425eef){_0x425eef=_0x425eef||0xcc;return function(_0x1dbcd7){if(_0x1dbcd7){return _0x246f98['sendStatus'](_0x425eef);}return _0x246f98[_0x63c4('0x1b')](_0x425eef)['end']();};}function respondWithResult(_0x37cc62,_0x157916){_0x157916=_0x157916||0xc8;return function(_0x47d7fc){if(_0x47d7fc){return _0x37cc62[_0x63c4('0x1b')](_0x157916)[_0x63c4('0x1c')](_0x47d7fc);}};}function respondWithFilteredResult(_0x592a63,_0x34c9c7){return function(_0x83b383){if(_0x83b383){var _0x2dc7e4=typeof _0x34c9c7[_0x63c4('0x1d')]===_0x63c4('0x1e')&&typeof _0x34c9c7['limit']===_0x63c4('0x1e');var _0x3b8f8b=_0x83b383[_0x63c4('0x1f')];var _0x1c5626=_0x2dc7e4?0x0:_0x34c9c7['offset'];var _0x127ad1=_0x2dc7e4?_0x83b383[_0x63c4('0x1f')]:_0x34c9c7[_0x63c4('0x1d')]+_0x34c9c7[_0x63c4('0x20')];var _0xc606dd;if(_0x127ad1>=_0x3b8f8b){_0x127ad1=_0x3b8f8b;_0xc606dd=0xc8;}else{_0xc606dd=0xce;}_0x592a63[_0x63c4('0x1b')](_0xc606dd);return _0x592a63[_0x63c4('0x21')](_0x63c4('0x22'),_0x1c5626+'-'+_0x127ad1+'/'+_0x3b8f8b)['json'](_0x83b383);}return null;};}function patchUpdates(_0x274e66){return function(_0x5b346e){try{jsonpatch[_0x63c4('0x23')](_0x5b346e,_0x274e66,!![]);}catch(_0x216368){return BPromise[_0x63c4('0x24')](_0x216368);}return _0x5b346e[_0x63c4('0x25')]();};}function saveUpdates(_0x4049f8,_0x569492){return function(_0x14c101){if(_0x14c101){return _0x14c101[_0x63c4('0x26')](_0x4049f8)['then'](function(_0x1140de){return _0x1140de;});}return null;};}function removeEntity(_0x897a9c,_0x59700b){return function(_0x175885){if(_0x175885){return _0x175885[_0x63c4('0x27')]()[_0x63c4('0x28')](function(){_0x897a9c['status'](0xcc)[_0x63c4('0x29')]();});}};}function handleEntityNotFound(_0x3564cb,_0x1577a7){return function(_0xb391ef){if(!_0xb391ef){_0x3564cb[_0x63c4('0x2a')](0x194);}return _0xb391ef;};}function handleError(_0x13e304,_0x26f293){_0x26f293=_0x26f293||0x1f4;return function(_0x1d2bfc){logger[_0x63c4('0x2b')](_0x1d2bfc[_0x63c4('0x2c')]);if(_0x1d2bfc[_0x63c4('0x2d')]){delete _0x1d2bfc[_0x63c4('0x2d')];}_0x13e304[_0x63c4('0x1b')](_0x26f293)[_0x63c4('0x2e')](_0x1d2bfc);};}exports[_0x63c4('0x2f')]=function(_0x300d6a,_0x5115bc){var _0x1dcbcd={},_0xf84f26={},_0x4a2135={'count':0x0,'rows':[]};var _0x43867e=_[_0x63c4('0x30')](db['ServicenowAccount']['rawAttributes'],function(_0x31bbe3){return{'name':_0x31bbe3[_0x63c4('0x31')],'type':_0x31bbe3[_0x63c4('0x32')][_0x63c4('0x33')]};});_0xf84f26[_0x63c4('0x34')]=_['map'](_0x43867e,_0x63c4('0x2d'));_0xf84f26[_0x63c4('0x35')]=_[_0x63c4('0x36')](_0x300d6a[_0x63c4('0x35')]);_0xf84f26['filters']=_['intersection'](_0xf84f26[_0x63c4('0x34')],_0xf84f26['query']);_0x1dcbcd[_0x63c4('0x37')]=_['intersection'](_0xf84f26[_0x63c4('0x34')],qs[_0x63c4('0x38')](_0x300d6a['query'][_0x63c4('0x38')]));_0x1dcbcd[_0x63c4('0x37')]=_0x1dcbcd[_0x63c4('0x37')][_0x63c4('0x39')]?_0x1dcbcd[_0x63c4('0x37')]:_0xf84f26['model'];if(!_0x300d6a[_0x63c4('0x35')][_0x63c4('0x3a')]('nolimit')){_0x1dcbcd[_0x63c4('0x20')]=qs[_0x63c4('0x20')](_0x300d6a[_0x63c4('0x35')]['limit']);_0x1dcbcd[_0x63c4('0x1d')]=qs[_0x63c4('0x1d')](_0x300d6a[_0x63c4('0x35')][_0x63c4('0x1d')]);}_0x1dcbcd[_0x63c4('0x3b')]=qs[_0x63c4('0x3c')](_0x300d6a['query'][_0x63c4('0x3c')]);_0x1dcbcd[_0x63c4('0x3d')]=qs['filters'](_[_0x63c4('0x3e')](_0x300d6a[_0x63c4('0x35')],_0xf84f26['filters']),_0x43867e);if(_0x300d6a[_0x63c4('0x35')][_0x63c4('0x3f')]){_0x1dcbcd[_0x63c4('0x3d')]=_[_0x63c4('0x40')](_0x1dcbcd[_0x63c4('0x3d')],{'$or':_[_0x63c4('0x30')](_0x43867e,function(_0x5b03a6){if(_0x5b03a6['type']!=='VIRTUAL'){var _0x24f3c0={};_0x24f3c0[_0x5b03a6[_0x63c4('0x2d')]]={'$like':'%'+_0x300d6a[_0x63c4('0x35')][_0x63c4('0x3f')]+'%'};return _0x24f3c0;}})});}_0x1dcbcd=_[_0x63c4('0x40')]({},_0x1dcbcd,_0x300d6a['options']);var _0x5c9a8c={'where':_0x1dcbcd[_0x63c4('0x3d')]};return db[_0x63c4('0x41')][_0x63c4('0x1f')](_0x5c9a8c)[_0x63c4('0x28')](function(_0xfe43e7){_0x4a2135[_0x63c4('0x1f')]=_0xfe43e7;if(_0x300d6a['query'][_0x63c4('0x42')]){_0x1dcbcd[_0x63c4('0x43')]=[{'all':!![]}];}return db[_0x63c4('0x41')]['findAll'](_0x1dcbcd);})['then'](function(_0x27d921){_0x4a2135[_0x63c4('0x44')]=_0x27d921;return _0x4a2135;})['then'](respondWithFilteredResult(_0x5115bc,_0x1dcbcd))[_0x63c4('0x45')](handleError(_0x5115bc,null));};exports[_0x63c4('0x46')]=function(_0x1c9704,_0x40a0c6){var _0x113b38={'raw':![],'where':{'id':_0x1c9704[_0x63c4('0x47')]['id']}},_0x385dee={};_0x385dee['model']=_[_0x63c4('0x36')](db[_0x63c4('0x41')][_0x63c4('0x48')]);_0x385dee[_0x63c4('0x35')]=_[_0x63c4('0x36')](_0x1c9704[_0x63c4('0x35')]);_0x385dee[_0x63c4('0x49')]=_['intersection'](_0x385dee[_0x63c4('0x34')],_0x385dee[_0x63c4('0x35')]);_0x113b38[_0x63c4('0x37')]=_['intersection'](_0x385dee[_0x63c4('0x34')],qs[_0x63c4('0x38')](_0x1c9704['query'][_0x63c4('0x38')]));_0x113b38[_0x63c4('0x37')]=_0x113b38[_0x63c4('0x37')][_0x63c4('0x39')]?_0x113b38['attributes']:_0x385dee[_0x63c4('0x34')];if(_0x1c9704[_0x63c4('0x35')][_0x63c4('0x42')]){_0x113b38[_0x63c4('0x43')]=[{'all':!![]}];}_0x113b38=_[_0x63c4('0x40')]({},_0x113b38,_0x1c9704['options']);return db[_0x63c4('0x41')][_0x63c4('0x4a')](_0x113b38)[_0x63c4('0x28')](handleEntityNotFound(_0x40a0c6,null))['then'](respondWithResult(_0x40a0c6,null))[_0x63c4('0x45')](handleError(_0x40a0c6,null));};exports[_0x63c4('0x4b')]=function(_0x38a2d1,_0x2506ad){return db[_0x63c4('0x41')][_0x63c4('0x4b')](_0x38a2d1[_0x63c4('0x4c')],{})['then'](respondWithResult(_0x2506ad,0xc9))[_0x63c4('0x45')](handleError(_0x2506ad,null));};exports['update']=function(_0x4b26c6,_0x23fe1a){if(_0x4b26c6[_0x63c4('0x4c')]['id']){delete _0x4b26c6[_0x63c4('0x4c')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x4b26c6[_0x63c4('0x47')]['id']}})[_0x63c4('0x28')](handleEntityNotFound(_0x23fe1a,null))[_0x63c4('0x28')](saveUpdates(_0x4b26c6[_0x63c4('0x4c')],null))[_0x63c4('0x28')](respondWithResult(_0x23fe1a,null))['catch'](handleError(_0x23fe1a,null));};exports[_0x63c4('0x27')]=function(_0x2af09e,_0x40aad0){return db[_0x63c4('0x41')][_0x63c4('0x4a')]({'where':{'id':_0x2af09e[_0x63c4('0x47')]['id']}})[_0x63c4('0x28')](handleEntityNotFound(_0x40aad0,null))['then'](removeEntity(_0x40aad0,null))[_0x63c4('0x45')](handleError(_0x40aad0,null));};exports[_0x63c4('0x4d')]=function(_0x20e10a,_0x337458,_0x85f0ff){var _0x3983c3={};var _0x502d87={};var _0x2c1c27;var _0x575847;return db['ServicenowAccount'][_0x63c4('0x4e')]({'where':{'id':_0x20e10a[_0x63c4('0x47')]['id']}})[_0x63c4('0x28')](handleEntityNotFound(_0x337458,null))[_0x63c4('0x28')](function(_0x1ef580){if(_0x1ef580){_0x2c1c27=_0x1ef580;_0x502d87[_0x63c4('0x34')]=_[_0x63c4('0x36')](db['ServicenowConfiguration'][_0x63c4('0x48')]);_0x502d87['query']=_[_0x63c4('0x36')](_0x20e10a[_0x63c4('0x35')]);_0x502d87['filters']=_[_0x63c4('0x4f')](_0x502d87['model'],_0x502d87[_0x63c4('0x35')]);_0x3983c3[_0x63c4('0x37')]=_[_0x63c4('0x4f')](_0x502d87[_0x63c4('0x34')],qs[_0x63c4('0x38')](_0x20e10a[_0x63c4('0x35')][_0x63c4('0x38')]));_0x3983c3[_0x63c4('0x37')]=_0x3983c3[_0x63c4('0x37')][_0x63c4('0x39')]?_0x3983c3[_0x63c4('0x37')]:_0x502d87[_0x63c4('0x34')];_0x3983c3['order']=qs[_0x63c4('0x3c')](_0x20e10a['query'][_0x63c4('0x3c')]);_0x3983c3[_0x63c4('0x3d')]=qs['filters'](_['pick'](_0x20e10a[_0x63c4('0x35')],_0x502d87[_0x63c4('0x49')]));if(_0x20e10a[_0x63c4('0x35')]['filter']){_0x3983c3[_0x63c4('0x3d')]=_['merge'](_0x3983c3[_0x63c4('0x3d')],{'$or':_['map'](_0x3983c3['attributes'],function(_0x1c2197){var _0x12faef={};_0x12faef[_0x1c2197]={'$like':'%'+_0x20e10a[_0x63c4('0x35')][_0x63c4('0x3f')]+'%'};return _0x12faef;})});}_0x3983c3=_[_0x63c4('0x40')]({},_0x3983c3,_0x20e10a['options']);return _0x2c1c27['getConfigurations'](_0x3983c3);}})['then'](function(_0x23dca2){if(_0x23dca2){_0x575847=_0x23dca2[_0x63c4('0x39')];if(!_0x20e10a[_0x63c4('0x35')][_0x63c4('0x3a')](_0x63c4('0x50'))){_0x3983c3['limit']=qs[_0x63c4('0x20')](_0x20e10a[_0x63c4('0x35')]['limit']);_0x3983c3['offset']=qs[_0x63c4('0x1d')](_0x20e10a[_0x63c4('0x35')][_0x63c4('0x1d')]);}return _0x2c1c27[_0x63c4('0x4d')](_0x3983c3);}})[_0x63c4('0x28')](function(_0x533a00){if(_0x533a00){return _0x533a00?{'count':_0x575847,'rows':_0x533a00}:null;}})[_0x63c4('0x28')](respondWithResult(_0x337458,null))[_0x63c4('0x45')](handleError(_0x337458,null));};exports[_0x63c4('0x51')]=function(_0x3d2d42,_0x58262d,_0x411edd){if(_0x3d2d42[_0x63c4('0x4c')]['id']){delete _0x3d2d42[_0x63c4('0x4c')]['id'];}return db[_0x63c4('0x41')]['findOne']({'where':{'id':_0x3d2d42[_0x63c4('0x47')]['id']}})[_0x63c4('0x28')](handleEntityNotFound(_0x58262d,null))[_0x63c4('0x28')](function(_0x1cce7f){if(_0x1cce7f){_0x3d2d42[_0x63c4('0x4c')][_0x63c4('0x52')]=_0x1cce7f['id'];_0x3d2d42[_0x63c4('0x4c')][_0x63c4('0x53')]=integrations['getSubjects'](_0x3d2d42[_0x63c4('0x4c')][_0x63c4('0x54')],_0x3d2d42[_0x63c4('0x4c')]['type']);_0x3d2d42[_0x63c4('0x4c')][_0x63c4('0x55')]=integrations[_0x63c4('0x56')](_0x3d2d42[_0x63c4('0x4c')]['channel'],_0x3d2d42[_0x63c4('0x4c')]['type']);return db['ServicenowConfiguration'][_0x63c4('0x4b')](_0x3d2d42[_0x63c4('0x4c')],{'include':[{'model':db[_0x63c4('0x57')],'as':_0x63c4('0x53')},{'model':db['ServicenowField'],'as':_0x63c4('0x55')}]});}return null;})[_0x63c4('0x28')](respondWithResult(_0x58262d,null))[_0x63c4('0x45')](handleError(_0x58262d,null));};exports['getFields']=function(_0x226ae5,_0x3c91e3,_0x4e1d02){var _0x173ec0=[_0x63c4('0x58'),_0x63c4('0x59'),_0x63c4('0x5a'),'subcategory','close_code',_0x63c4('0x5b'),_0x63c4('0x5c'),_0x63c4('0x5d'),'category'];var _0x28eada=[_0x63c4('0x5e'),_0x63c4('0x58'),_0x63c4('0x5f'),_0x63c4('0x60'),_0x63c4('0x61'),_0x63c4('0x62'),_0x63c4('0x63'),_0x63c4('0x59'),'approval_history','number',_0x63c4('0x64'),_0x63c4('0x65'),_0x63c4('0x66'),_0x63c4('0x67'),_0x63c4('0x68'),_0x63c4('0x69'),_0x63c4('0x6a'),_0x63c4('0x6b'),_0x63c4('0x5a'),_0x63c4('0x3b'),'calendar_stc',_0x63c4('0x6c'),_0x63c4('0x6d'),_0x63c4('0x6e'),'impact',_0x63c4('0x6f'),_0x63c4('0x70'),_0x63c4('0x71'),_0x63c4('0x72'),_0x63c4('0x73'),_0x63c4('0x74'),_0x63c4('0x75'),_0x63c4('0x76'),_0x63c4('0x77'),_0x63c4('0x78'),_0x63c4('0x79'),_0x63c4('0x7a'),_0x63c4('0x7b'),'resolved_at',_0x63c4('0x7c'),_0x63c4('0x7d'),_0x63c4('0x7e'),'work_notes',_0x63c4('0x7f'),_0x63c4('0x80'),'correlation_display',_0x63c4('0x81'),_0x63c4('0x82'),_0x63c4('0x83'),'business_stc','additional_assignee_list',_0x63c4('0x84'),'calendar_duration','notify',_0x63c4('0x85'),_0x63c4('0x86'),_0x63c4('0x87'),_0x63c4('0x88'),'parent_incident',_0x63c4('0x89'),_0x63c4('0x8a'),_0x63c4('0x8b'),_0x63c4('0x5c'),_0x63c4('0x8c'),_0x63c4('0x8d'),_0x63c4('0x8e'),_0x63c4('0x8f'),_0x63c4('0x90'),_0x63c4('0x91'),_0x63c4('0x5d'),_0x63c4('0x92'),_0x63c4('0x93'),_0x63c4('0x94'),_0x63c4('0x95'),_0x63c4('0x96'),_0x63c4('0x97'),_0x63c4('0x98'),_0x63c4('0x99'),_0x63c4('0x9a'),'upon_approval',_0x63c4('0x9b'),_0x63c4('0x9c'),'category'];var _0x72739f='';var _0x260baa='';var _0x166003=[];var _0x154e55='';var _0x3aa3e9='';var _0x4444c3=[];var _0xfb2a5d='';var _0x57cf7f='';var _0x4bc66e={};var _0x28c508='';return db[_0x63c4('0x41')][_0x63c4('0x4e')]({'where':{'id':_0x226ae5[_0x63c4('0x47')]['id']},'attributes':['id',_0x63c4('0x9d'),'password',_0x63c4('0x9e'),_0x63c4('0x9f'),_0x63c4('0xa0')]})['then'](handleEntityNotFound(_0x3c91e3,null))['then'](function(_0x34fc8a){if(_0x34fc8a){_0x28c508=_0x34fc8a['remoteUri'];var _0x49320f=_0x28c508[_0x63c4('0xa1')](-0x1);if(_0x49320f==='/'){_0x28c508=_0x28c508[_0x63c4('0xa2')](0x0,_0x28c508[_0x63c4('0xa3')](_0x49320f));}_0x57cf7f=util[_0x63c4('0xa4')]('%s/api/now/doc/table/schema/',_0x28c508);_0xfb2a5d=util['format']('%s/api/now/table/',_0x28c508);_0x4bc66e={'user':_0x34fc8a[_0x63c4('0x9d')],'pass':_0x34fc8a['password']};var _0x5bc5e6={'method':_0x63c4('0xa5'),'uri':_0x57cf7f+_0x63c4('0xa6'),'auth':_0x4bc66e,'json':!![]};return rp(_0x5bc5e6);}})['then'](function(_0x59b971){if(_0x59b971['result'][_0x63c4('0x39')]>0x0){_0x72739f=_0x59b971[_0x63c4('0xa7')];}console['log']('incident\x20table\x20objects',_0x72739f);_0x4444c3=[];_0x260baa=Object[_0x63c4('0xa8')]([],_0x72739f);_[_0x63c4('0xa9')](_0x260baa,function(_0x311657){return!_0x173ec0[_0x63c4('0xaa')](_0x311657[_0x63c4('0x2d')]);});_0x260baa[_0x63c4('0xab')](function(_0x481ccb){var _0x20ef4b=createFieldObject(_0xfb2a5d,_0x4bc66e,_0x481ccb[_0x63c4('0xac')],_0x481ccb[_0x63c4('0x2d')],_0x481ccb[_0x63c4('0xad')],![]);_0x4444c3[_0x63c4('0xae')](_0x20ef4b);});return Promise[_0x63c4('0xaf')](_0x4444c3);})[_0x63c4('0x28')](function(_0x1f3d01){_0x166003=_0x1f3d01;_0x154e55=Object[_0x63c4('0xa8')]([],_0x72739f);console[_0x63c4('0xb0')](_0x63c4('0xb1'),_0x72739f);_['remove'](_0x154e55,function(_0x9bb6d6){return _0x28eada[_0x63c4('0xaa')](_0x9bb6d6['name']);});console[_0x63c4('0xb0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x154e55);_0x4444c3=[];_0x154e55[_0x63c4('0xab')](function(_0x17ca9a){var _0x522252=createFieldObject(_0xfb2a5d,_0x4bc66e,_0x17ca9a[_0x63c4('0xac')],_0x17ca9a['name'],_0x17ca9a[_0x63c4('0xad')],!![]);_0x4444c3[_0x63c4('0xae')](_0x522252);});return Promise[_0x63c4('0xaf')](_0x4444c3);})['then'](function(_0xe9e4ef){_0x3aa3e9=_0xe9e4ef;var _0x55583b=_0x166003['concat'](_0x3aa3e9);return{'count':_0x55583b['length'],'rows':_0x55583b};})[_0x63c4('0x28')](respondWithResult(_0x3c91e3,null))[_0x63c4('0x45')](function(_0x2e033c){console['log'](_0x63c4('0xb2')+_0x2e033c);var _0x43f2da=_0x226ae5['query'][_0x63c4('0xb3')]?0x1f4:_0x2e033c[_0x63c4('0xb4')]||0x1f4;logger[_0x63c4('0x2b')](_0x2e033c['stack']);delete _0x2e033c[_0x63c4('0x2d')];if(_0x43f2da===0x191){_0x43f2da=0x190;}_0x3c91e3['status'](_0x43f2da)['send'](_0x226ae5[_0x63c4('0x35')][_0x63c4('0xb3')]?{'message':_0x63c4('0xb5'),'statusCode':_0x2e033c['statusCode']}:_0x2e033c);});};function createFieldObject(_0x3edbdd,_0x29c642,_0x2bf6dc,_0x2e7504,_0x53170d,_0x4f67e9){return new Promise(function(_0x213207,_0x8e0e1c){var _0x12b9f5={'id':_0x2e7504,'name':_0x53170d,'custom':_0x4f67e9};if(_0x2bf6dc===_0x63c4('0xb6')){_0x12b9f5['options']=[{'name':_0x63c4('0xb7'),'value':'true'},{'name':_0x63c4('0xb8'),'value':_0x63c4('0xb9')}];_0x213207(_0x12b9f5);}else{var _0x371f48={'method':'GET','uri':_0x3edbdd+_0x63c4('0xba')+_0x2e7504,'auth':_0x29c642,'json':!![]};return rp(_0x371f48)[_0x63c4('0x28')](function(_0x3eee30){var _0x1b4518=[];if(_0x3eee30['result'][_0x63c4('0x39')]>0x0){_0x3eee30['result'][_0x63c4('0xab')](function(_0x547105){if(_0x547105[_0x63c4('0xbb')]===_0x63c4('0xb9')){var _0x4747d4={'name':_0x547105[_0x63c4('0xad')],'value':_0x547105[_0x63c4('0xbc')]};_0x1b4518['push'](_0x4747d4);}});}_0x12b9f5[_0x63c4('0xbd')]=_0x1b4518;if(_0x12b9f5[_0x63c4('0xbd')][_0x63c4('0x39')]>0x0){_0x213207(_0x12b9f5);}else{if(_0x4f67e9==![]){_0x213207();}else{_0x213207(_0x12b9f5);}}});}});} \ No newline at end of file +var _0xf079=['Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','close_code','notify','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','username','password','email','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','request-promise','mustache','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','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','ServicenowAccount','findAll','catch','show','keys','include','options','find','create','body','params','getConfigurations','findOne','filter','nolimit','Subjects','channel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf079,0x120));var _0x9f07=function(_0x465f0b,_0x5cd467){_0x465f0b=_0x465f0b-0x0;var _0x1f4944=_0xf079[_0x465f0b];return _0x1f4944;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f07('0x0'));var zipdir=require(_0x9f07('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f07('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f07('0x3'));var util=require('util');var path=require(_0x9f07('0x4'));var sox=require(_0x9f07('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f07('0x6'));var _=require(_0x9f07('0x7'));var squel=require(_0x9f07('0x8'));var crypto=require('crypto');var jsforce=require(_0x9f07('0x9'));var deskjs=require(_0x9f07('0xa'));var toCsv=require(_0x9f07('0xb'));var querystring=require(_0x9f07('0xc'));var Papa=require(_0x9f07('0xd'));var Redis=require(_0x9f07('0xe'));var authService=require(_0x9f07('0xf'));var qs=require(_0x9f07('0x10'));var as=require(_0x9f07('0x11'));var hardwareService=require(_0x9f07('0x12'));var logger=require('../../config/logger')(_0x9f07('0x13'));var utils=require(_0x9f07('0x14'));var config=require(_0x9f07('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f07('0x16'))['db'];var integrations=require(_0x9f07('0x17'));function respondWithStatusCode(_0x10eae4,_0x5a0499){_0x5a0499=_0x5a0499||0xcc;return function(_0x3386ea){if(_0x3386ea){return _0x10eae4['sendStatus'](_0x5a0499);}return _0x10eae4[_0x9f07('0x18')](_0x5a0499)[_0x9f07('0x19')]();};}function respondWithResult(_0x1234a9,_0x1416cb){_0x1416cb=_0x1416cb||0xc8;return function(_0x10b35b){if(_0x10b35b){return _0x1234a9[_0x9f07('0x18')](_0x1416cb)['json'](_0x10b35b);}};}function respondWithFilteredResult(_0x4d40a7,_0x20aae8){return function(_0x4d60ab){if(_0x4d60ab){var _0x4f6826=typeof _0x20aae8[_0x9f07('0x1a')]===_0x9f07('0x1b')&&typeof _0x20aae8[_0x9f07('0x1c')]===_0x9f07('0x1b');var _0x402cf0=_0x4d60ab[_0x9f07('0x1d')];var _0x210f45=_0x4f6826?0x0:_0x20aae8[_0x9f07('0x1a')];var _0x3b32fd=_0x4f6826?_0x4d60ab['count']:_0x20aae8[_0x9f07('0x1a')]+_0x20aae8[_0x9f07('0x1c')];var _0x26d26c;if(_0x3b32fd>=_0x402cf0){_0x3b32fd=_0x402cf0;_0x26d26c=0xc8;}else{_0x26d26c=0xce;}_0x4d40a7['status'](_0x26d26c);return _0x4d40a7[_0x9f07('0x1e')](_0x9f07('0x1f'),_0x210f45+'-'+_0x3b32fd+'/'+_0x402cf0)['json'](_0x4d60ab);}return null;};}function patchUpdates(_0x274ad5){return function(_0x4389ba){try{jsonpatch['apply'](_0x4389ba,_0x274ad5,!![]);}catch(_0x3064d3){return BPromise[_0x9f07('0x20')](_0x3064d3);}return _0x4389ba['save']();};}function saveUpdates(_0x8c728b,_0x2a3979){return function(_0x65035d){if(_0x65035d){return _0x65035d[_0x9f07('0x21')](_0x8c728b)[_0x9f07('0x22')](function(_0x12b9b3){return _0x12b9b3;});}return null;};}function removeEntity(_0x107347,_0x479445){return function(_0x1c7e1a){if(_0x1c7e1a){return _0x1c7e1a[_0x9f07('0x23')]()['then'](function(){_0x107347['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f9585,_0x14dc74){return function(_0x58967b){if(!_0x58967b){_0x2f9585[_0x9f07('0x24')](0x194);}return _0x58967b;};}function handleError(_0x50b561,_0x5ef17f){_0x5ef17f=_0x5ef17f||0x1f4;return function(_0x57a83d){logger[_0x9f07('0x25')](_0x57a83d[_0x9f07('0x26')]);if(_0x57a83d[_0x9f07('0x27')]){delete _0x57a83d[_0x9f07('0x27')];}_0x50b561['status'](_0x5ef17f)[_0x9f07('0x28')](_0x57a83d);};}exports[_0x9f07('0x29')]=function(_0x2be010,_0x5a4655){var _0x54807c={},_0x432e40={},_0x3ab825={'count':0x0,'rows':[]};var _0xad66cc=_[_0x9f07('0x2a')](db['ServicenowAccount'][_0x9f07('0x2b')],function(_0xd13fe5){return{'name':_0xd13fe5['fieldName'],'type':_0xd13fe5[_0x9f07('0x2c')][_0x9f07('0x2d')]};});_0x432e40['model']=_[_0x9f07('0x2a')](_0xad66cc,_0x9f07('0x27'));_0x432e40[_0x9f07('0x2e')]=_['keys'](_0x2be010[_0x9f07('0x2e')]);_0x432e40[_0x9f07('0x2f')]=_[_0x9f07('0x30')](_0x432e40[_0x9f07('0x31')],_0x432e40[_0x9f07('0x2e')]);_0x54807c[_0x9f07('0x32')]=_[_0x9f07('0x30')](_0x432e40[_0x9f07('0x31')],qs[_0x9f07('0x33')](_0x2be010[_0x9f07('0x2e')]['fields']));_0x54807c['attributes']=_0x54807c[_0x9f07('0x32')][_0x9f07('0x34')]?_0x54807c[_0x9f07('0x32')]:_0x432e40[_0x9f07('0x31')];if(!_0x2be010[_0x9f07('0x2e')][_0x9f07('0x35')]('nolimit')){_0x54807c[_0x9f07('0x1c')]=qs[_0x9f07('0x1c')](_0x2be010[_0x9f07('0x2e')][_0x9f07('0x1c')]);_0x54807c['offset']=qs['offset'](_0x2be010[_0x9f07('0x2e')][_0x9f07('0x1a')]);}_0x54807c[_0x9f07('0x36')]=qs[_0x9f07('0x37')](_0x2be010['query'][_0x9f07('0x37')]);_0x54807c[_0x9f07('0x38')]=qs[_0x9f07('0x2f')](_[_0x9f07('0x39')](_0x2be010[_0x9f07('0x2e')],_0x432e40[_0x9f07('0x2f')]),_0xad66cc);if(_0x2be010[_0x9f07('0x2e')]['filter']){_0x54807c[_0x9f07('0x38')]=_[_0x9f07('0x3a')](_0x54807c['where'],{'$or':_[_0x9f07('0x2a')](_0xad66cc,function(_0x25e614){if(_0x25e614['type']!==_0x9f07('0x3b')){var _0x5f00fd={};_0x5f00fd[_0x25e614[_0x9f07('0x27')]]={'$like':'%'+_0x2be010[_0x9f07('0x2e')]['filter']+'%'};return _0x5f00fd;}})});}_0x54807c=_[_0x9f07('0x3a')]({},_0x54807c,_0x2be010['options']);var _0x2ee95a={'where':_0x54807c[_0x9f07('0x38')]};return db['ServicenowAccount'][_0x9f07('0x1d')](_0x2ee95a)[_0x9f07('0x22')](function(_0x189b41){_0x3ab825[_0x9f07('0x1d')]=_0x189b41;if(_0x2be010[_0x9f07('0x2e')][_0x9f07('0x3c')]){_0x54807c['include']=[{'all':!![]}];}return db[_0x9f07('0x3d')][_0x9f07('0x3e')](_0x54807c);})[_0x9f07('0x22')](function(_0x5eed0b){_0x3ab825['rows']=_0x5eed0b;return _0x3ab825;})[_0x9f07('0x22')](respondWithFilteredResult(_0x5a4655,_0x54807c))[_0x9f07('0x3f')](handleError(_0x5a4655,null));};exports[_0x9f07('0x40')]=function(_0x1217ff,_0x43c2ff){var _0x37d6d6={'raw':![],'where':{'id':_0x1217ff['params']['id']}},_0x22d585={};_0x22d585['model']=_[_0x9f07('0x41')](db['ServicenowAccount'][_0x9f07('0x2b')]);_0x22d585[_0x9f07('0x2e')]=_[_0x9f07('0x41')](_0x1217ff[_0x9f07('0x2e')]);_0x22d585['filters']=_[_0x9f07('0x30')](_0x22d585['model'],_0x22d585['query']);_0x37d6d6[_0x9f07('0x32')]=_[_0x9f07('0x30')](_0x22d585['model'],qs['fields'](_0x1217ff[_0x9f07('0x2e')][_0x9f07('0x33')]));_0x37d6d6[_0x9f07('0x32')]=_0x37d6d6[_0x9f07('0x32')][_0x9f07('0x34')]?_0x37d6d6[_0x9f07('0x32')]:_0x22d585[_0x9f07('0x31')];if(_0x1217ff[_0x9f07('0x2e')]['includeAll']){_0x37d6d6[_0x9f07('0x42')]=[{'all':!![]}];}_0x37d6d6=_[_0x9f07('0x3a')]({},_0x37d6d6,_0x1217ff[_0x9f07('0x43')]);return db['ServicenowAccount'][_0x9f07('0x44')](_0x37d6d6)['then'](handleEntityNotFound(_0x43c2ff,null))[_0x9f07('0x22')](respondWithResult(_0x43c2ff,null))[_0x9f07('0x3f')](handleError(_0x43c2ff,null));};exports[_0x9f07('0x45')]=function(_0x12d533,_0x5031cf){return db[_0x9f07('0x3d')]['create'](_0x12d533[_0x9f07('0x46')],{})[_0x9f07('0x22')](respondWithResult(_0x5031cf,0xc9))[_0x9f07('0x3f')](handleError(_0x5031cf,null));};exports[_0x9f07('0x21')]=function(_0x33a7c2,_0x3c029d){if(_0x33a7c2[_0x9f07('0x46')]['id']){delete _0x33a7c2[_0x9f07('0x46')]['id'];}return db[_0x9f07('0x3d')]['find']({'where':{'id':_0x33a7c2['params']['id']}})[_0x9f07('0x22')](handleEntityNotFound(_0x3c029d,null))['then'](saveUpdates(_0x33a7c2['body'],null))[_0x9f07('0x22')](respondWithResult(_0x3c029d,null))[_0x9f07('0x3f')](handleError(_0x3c029d,null));};exports['destroy']=function(_0x2ffea0,_0x336273){return db[_0x9f07('0x3d')][_0x9f07('0x44')]({'where':{'id':_0x2ffea0[_0x9f07('0x47')]['id']}})[_0x9f07('0x22')](handleEntityNotFound(_0x336273,null))[_0x9f07('0x22')](removeEntity(_0x336273,null))[_0x9f07('0x3f')](handleError(_0x336273,null));};exports[_0x9f07('0x48')]=function(_0x29a72c,_0x3e8eb9,_0x1077db){var _0x559430={};var _0x255a3b={};var _0x4f0eb0;var _0x2d2e00;return db[_0x9f07('0x3d')][_0x9f07('0x49')]({'where':{'id':_0x29a72c[_0x9f07('0x47')]['id']}})[_0x9f07('0x22')](handleEntityNotFound(_0x3e8eb9,null))[_0x9f07('0x22')](function(_0x13cba1){if(_0x13cba1){_0x4f0eb0=_0x13cba1;_0x255a3b['model']=_[_0x9f07('0x41')](db['ServicenowConfiguration'][_0x9f07('0x2b')]);_0x255a3b[_0x9f07('0x2e')]=_['keys'](_0x29a72c[_0x9f07('0x2e')]);_0x255a3b[_0x9f07('0x2f')]=_['intersection'](_0x255a3b[_0x9f07('0x31')],_0x255a3b[_0x9f07('0x2e')]);_0x559430[_0x9f07('0x32')]=_[_0x9f07('0x30')](_0x255a3b[_0x9f07('0x31')],qs[_0x9f07('0x33')](_0x29a72c['query']['fields']));_0x559430[_0x9f07('0x32')]=_0x559430[_0x9f07('0x32')][_0x9f07('0x34')]?_0x559430[_0x9f07('0x32')]:_0x255a3b['model'];_0x559430[_0x9f07('0x36')]=qs[_0x9f07('0x37')](_0x29a72c[_0x9f07('0x2e')]['sort']);_0x559430[_0x9f07('0x38')]=qs[_0x9f07('0x2f')](_[_0x9f07('0x39')](_0x29a72c[_0x9f07('0x2e')],_0x255a3b['filters']));if(_0x29a72c[_0x9f07('0x2e')][_0x9f07('0x4a')]){_0x559430['where']=_[_0x9f07('0x3a')](_0x559430['where'],{'$or':_[_0x9f07('0x2a')](_0x559430[_0x9f07('0x32')],function(_0xfaf1c3){var _0x55fc79={};_0x55fc79[_0xfaf1c3]={'$like':'%'+_0x29a72c[_0x9f07('0x2e')][_0x9f07('0x4a')]+'%'};return _0x55fc79;})});}_0x559430=_[_0x9f07('0x3a')]({},_0x559430,_0x29a72c[_0x9f07('0x43')]);return _0x4f0eb0[_0x9f07('0x48')](_0x559430);}})[_0x9f07('0x22')](function(_0x4bcc77){if(_0x4bcc77){_0x2d2e00=_0x4bcc77['length'];if(!_0x29a72c['query'][_0x9f07('0x35')](_0x9f07('0x4b'))){_0x559430['limit']=qs[_0x9f07('0x1c')](_0x29a72c[_0x9f07('0x2e')][_0x9f07('0x1c')]);_0x559430[_0x9f07('0x1a')]=qs['offset'](_0x29a72c['query'][_0x9f07('0x1a')]);}return _0x4f0eb0[_0x9f07('0x48')](_0x559430);}})['then'](function(_0x5ee4cb){if(_0x5ee4cb){return _0x5ee4cb?{'count':_0x2d2e00,'rows':_0x5ee4cb}:null;}})[_0x9f07('0x22')](respondWithResult(_0x3e8eb9,null))['catch'](handleError(_0x3e8eb9,null));};exports['addConfiguration']=function(_0x907916,_0x2eb687,_0x11aa89){if(_0x907916[_0x9f07('0x46')]['id']){delete _0x907916[_0x9f07('0x46')]['id'];}return db['ServicenowAccount'][_0x9f07('0x49')]({'where':{'id':_0x907916[_0x9f07('0x47')]['id']}})[_0x9f07('0x22')](handleEntityNotFound(_0x2eb687,null))['then'](function(_0x185aa8){if(_0x185aa8){_0x907916[_0x9f07('0x46')]['AccountId']=_0x185aa8['id'];_0x907916[_0x9f07('0x46')][_0x9f07('0x4c')]=integrations['getSubjects'](_0x907916[_0x9f07('0x46')][_0x9f07('0x4d')],_0x907916['body'][_0x9f07('0x2c')]);_0x907916[_0x9f07('0x46')][_0x9f07('0x4e')]=integrations[_0x9f07('0x4f')](_0x907916['body'][_0x9f07('0x4d')],_0x907916[_0x9f07('0x46')][_0x9f07('0x2c')]);return db['ServicenowConfiguration']['create'](_0x907916[_0x9f07('0x46')],{'include':[{'model':db[_0x9f07('0x50')],'as':_0x9f07('0x4c')},{'model':db[_0x9f07('0x50')],'as':_0x9f07('0x4e')}]});}return null;})['then'](respondWithResult(_0x2eb687,null))[_0x9f07('0x3f')](handleError(_0x2eb687,null));};exports['getFields']=function(_0x374024,_0x56bf4f,_0x1cb3a3){var _0x548e94=[_0x9f07('0x51'),_0x9f07('0x52'),'knowledge','subcategory',_0x9f07('0x53'),_0x9f07('0x54'),'incident_state','severity',_0x9f07('0x55')];var _0x3dd968=[_0x9f07('0x56'),_0x9f07('0x51'),_0x9f07('0x57'),_0x9f07('0x58'),'upon_reject',_0x9f07('0x59'),_0x9f07('0x5a'),_0x9f07('0x52'),_0x9f07('0x5b'),_0x9f07('0x5c'),_0x9f07('0x5d'),'sys_updated_by','opened_by',_0x9f07('0x5e'),_0x9f07('0x5f'),_0x9f07('0x60'),_0x9f07('0x61'),_0x9f07('0x62'),_0x9f07('0x63'),_0x9f07('0x36'),_0x9f07('0x64'),_0x9f07('0x65'),_0x9f07('0x66'),'delivery_plan',_0x9f07('0x67'),_0x9f07('0x68'),'work_notes_list',_0x9f07('0x69'),_0x9f07('0x6a'),_0x9f07('0x6b'),_0x9f07('0x6c'),_0x9f07('0x6d'),_0x9f07('0x6e'),_0x9f07('0x6f'),'business_duration',_0x9f07('0x70'),'work_end',_0x9f07('0x71'),_0x9f07('0x72'),_0x9f07('0x73'),_0x9f07('0x74'),_0x9f07('0x75'),_0x9f07('0x76'),_0x9f07('0x77'),_0x9f07('0x53'),_0x9f07('0x78'),_0x9f07('0x79'),_0x9f07('0x7a'),'assignment_group',_0x9f07('0x7b'),_0x9f07('0x7c'),'description',_0x9f07('0x7d'),'notify',_0x9f07('0x7e'),_0x9f07('0x7f'),_0x9f07('0x80'),_0x9f07('0x81'),_0x9f07('0x82'),'sys_id',_0x9f07('0x83'),_0x9f07('0x84'),_0x9f07('0x85'),_0x9f07('0x86'),_0x9f07('0x87'),_0x9f07('0x88'),_0x9f07('0x89'),_0x9f07('0x8a'),_0x9f07('0x8b'),_0x9f07('0x8c'),_0x9f07('0x8d'),'sla_due',_0x9f07('0x8e'),_0x9f07('0x8f'),_0x9f07('0x90'),_0x9f07('0x91'),_0x9f07('0x92'),_0x9f07('0x93'),_0x9f07('0x94'),_0x9f07('0x95'),'correlation_id','location',_0x9f07('0x55')];var _0x2e1ba7='';var _0x26fad7='';var _0x2e3363=[];var _0x4315e1='';var _0x1bdbc3='';var _0x2321b8=[];var _0x4994ba='';var _0x451ad6='';var _0x265f74={};var _0xa2bb91='';return db['ServicenowAccount'][_0x9f07('0x49')]({'where':{'id':_0x374024[_0x9f07('0x47')]['id']},'attributes':['id',_0x9f07('0x96'),_0x9f07('0x97'),_0x9f07('0x98'),_0x9f07('0x99'),_0x9f07('0x9a')]})[_0x9f07('0x22')](handleEntityNotFound(_0x56bf4f,null))[_0x9f07('0x22')](function(_0x352810){if(_0x352810){_0xa2bb91=_0x352810[_0x9f07('0x99')];var _0x5cb442=_0xa2bb91['slice'](-0x1);if(_0x5cb442==='/'){_0xa2bb91=_0xa2bb91['substring'](0x0,_0xa2bb91[_0x9f07('0x9b')](_0x5cb442));}_0x451ad6=util[_0x9f07('0x9c')](_0x9f07('0x9d'),_0xa2bb91);_0x4994ba=util[_0x9f07('0x9c')]('%s/api/now/table/',_0xa2bb91);_0x265f74={'user':_0x352810[_0x9f07('0x96')],'pass':_0x352810[_0x9f07('0x97')]};var _0x274990={'method':_0x9f07('0x9e'),'uri':_0x451ad6+_0x9f07('0x9f'),'auth':_0x265f74,'json':!![]};return rp(_0x274990);}})['then'](function(_0x4379c5){if(_0x4379c5['result']['length']>0x0){_0x2e1ba7=_0x4379c5[_0x9f07('0xa0')];}console[_0x9f07('0xa1')](_0x9f07('0xa2'),_0x2e1ba7);_0x2321b8=[];_0x26fad7=Object[_0x9f07('0xa3')]([],_0x2e1ba7);_[_0x9f07('0xa4')](_0x26fad7,function(_0x2fc190){return!_0x548e94['includes'](_0x2fc190[_0x9f07('0x27')]);});_0x26fad7['forEach'](function(_0x12cbb3){var _0x3bca74=createFieldObject(_0x4994ba,_0x265f74,_0x12cbb3['internalType'],_0x12cbb3[_0x9f07('0x27')],_0x12cbb3[_0x9f07('0xa5')],![]);_0x2321b8[_0x9f07('0xa6')](_0x3bca74);});return Promise[_0x9f07('0xa7')](_0x2321b8);})['then'](function(_0x5ac849){_0x2e3363=_0x5ac849;_0x4315e1=Object[_0x9f07('0xa3')]([],_0x2e1ba7);console[_0x9f07('0xa1')](_0x9f07('0xa8'),_0x2e1ba7);_['remove'](_0x4315e1,function(_0x3bdac2){return _0x3dd968[_0x9f07('0xa9')](_0x3bdac2[_0x9f07('0x27')]);});console['log'](_0x9f07('0xaa'),_0x4315e1);_0x2321b8=[];_0x4315e1[_0x9f07('0xab')](function(_0x12058e){var _0x1b275e=createFieldObject(_0x4994ba,_0x265f74,_0x12058e[_0x9f07('0xac')],_0x12058e['name'],_0x12058e[_0x9f07('0xa5')],!![]);_0x2321b8[_0x9f07('0xa6')](_0x1b275e);});return Promise[_0x9f07('0xa7')](_0x2321b8);})['then'](function(_0x195b76){_0x1bdbc3=_0x195b76;var _0x37beaf=_0x2e3363[_0x9f07('0xad')](_0x1bdbc3);return{'count':_0x37beaf['length'],'rows':_0x37beaf};})[_0x9f07('0x22')](respondWithResult(_0x56bf4f,null))[_0x9f07('0x3f')](function(_0x1d515b){console['log'](_0x9f07('0xae')+_0x1d515b);var _0x4d6878=_0x374024[_0x9f07('0x2e')][_0x9f07('0xaf')]?0x1f4:_0x1d515b['statusCode']||0x1f4;logger[_0x9f07('0x25')](_0x1d515b[_0x9f07('0x26')]);delete _0x1d515b['name'];if(_0x4d6878===0x191){_0x4d6878=0x190;}_0x56bf4f[_0x9f07('0x18')](_0x4d6878)['send'](_0x374024[_0x9f07('0x2e')][_0x9f07('0xaf')]?{'message':_0x9f07('0xb0'),'statusCode':_0x1d515b[_0x9f07('0xb1')]}:_0x1d515b);});};function createFieldObject(_0x30949a,_0x589ab2,_0xa18445,_0x3789cf,_0xeb5869,_0x3e0894){return new Promise(function(_0x5775d2,_0x546a37){var _0x384ef4={'id':_0x3789cf,'name':_0xeb5869,'custom':_0x3e0894};if(_0xa18445===_0x9f07('0xb2')){_0x384ef4[_0x9f07('0x43')]=[{'name':'True','value':'true'},{'name':_0x9f07('0xb3'),'value':'false'}];_0x5775d2(_0x384ef4);}else{var _0x531a07={'method':_0x9f07('0x9e'),'uri':_0x30949a+_0x9f07('0xb4')+_0x3789cf,'auth':_0x589ab2,'json':!![]};return rp(_0x531a07)[_0x9f07('0x22')](function(_0x379b8f){var _0x20ea7d=[];if(_0x379b8f[_0x9f07('0xa0')][_0x9f07('0x34')]>0x0){_0x379b8f[_0x9f07('0xa0')][_0x9f07('0xab')](function(_0x1d182b){if(_0x1d182b[_0x9f07('0xb5')]==='false'){var _0x24818f={'name':_0x1d182b[_0x9f07('0xa5')],'value':_0x1d182b[_0x9f07('0xb6')]};_0x20ea7d[_0x9f07('0xa6')](_0x24818f);}});}_0x384ef4[_0x9f07('0x43')]=_0x20ea7d;if(_0x384ef4[_0x9f07('0x43')][_0x9f07('0x34')]>0x0){_0x5775d2(_0x384ef4);}else{if(_0x3e0894==![]){_0x5775d2();}else{_0x5775d2(_0x384ef4);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4fad21e..b577ddf 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 _0xabce=['path','rimraf','../../config/environment','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0xabce,0x103));var _0xeabc=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xabce[_0x110c3d];return _0x226d67;};'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('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return _0x52a4d7['define'](_0xeabc('0x9'),attributes,{'tableName':_0xeabc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x4d89d7,_0x56a2e0){var _0x51b321=function(_0x224582){while(--_0x224582){_0x4d89d7['push'](_0x4d89d7['shift']());}};_0x51b321(++_0x56a2e0);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2173b8,_0x612cbb){_0x2173b8=_0x2173b8-0x0;var _0x14f729=_0xdbf5[_0x2173b8];return _0x14f729;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 430c560..fe63bcc 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 _0x472f=['../../config/environment','jayson/promise','client','http','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','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x498e33,_0x985556){var _0x80dcc1=function(_0x416e86){while(--_0x416e86){_0x498e33['push'](_0x498e33['shift']());}};_0x80dcc1(++_0x985556);}(_0x472f,0x1e5));var _0xf472=function(_0x539fc9,_0x4d414c){_0x539fc9=_0x539fc9-0x0;var _0x3824fe=_0x472f[_0x539fc9];return _0x3824fe;};'use strict';var _=require(_0xf472('0x0'));var util=require(_0xf472('0x1'));var moment=require(_0xf472('0x2'));var BPromise=require('bluebird');var rs=require(_0xf472('0x3'));var fs=require('fs');var Redis=require(_0xf472('0x4'));var db=require(_0xf472('0x5'))['db'];var utils=require(_0xf472('0x6'));var logger=require(_0xf472('0x7'))(_0xf472('0x8'));var config=require(_0xf472('0x9'));var jayson=require(_0xf472('0xa'));var client=jayson[_0xf472('0xb')][_0xf472('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2facc1,_0x386aa6,_0x317530){return new BPromise(function(_0x113643,_0x595897){return client[_0xf472('0xd')](_0x2facc1,_0x317530)[_0xf472('0xe')](function(_0x9d9a37){logger[_0xf472('0xf')](_0xf472('0x10'),_0x386aa6,_0xf472('0x11'));logger[_0xf472('0x12')](_0xf472('0x13'),_0x386aa6,_0xf472('0x11'),JSON[_0xf472('0x14')](_0x9d9a37));if(_0x9d9a37[_0xf472('0x15')]){if(_0x9d9a37['error'][_0xf472('0x16')]===0x1f4){logger[_0xf472('0x15')](_0xf472('0x10'),_0x386aa6,_0x9d9a37['error']['message']);return _0x595897(_0x9d9a37['error'][_0xf472('0x17')]);}logger['error'](_0xf472('0x10'),_0x386aa6,_0x9d9a37[_0xf472('0x15')][_0xf472('0x17')]);return _0x113643(_0x9d9a37['error']['message']);}else{logger[_0xf472('0xf')](_0xf472('0x10'),_0x386aa6,_0xf472('0x11'));_0x113643(_0x9d9a37[_0xf472('0x18')]['message']);}})[_0xf472('0x19')](function(_0x138558){logger[_0xf472('0x15')](_0xf472('0x10'),_0x386aa6,_0x138558);_0x595897(_0x138558);});});}exports[_0xf472('0x1a')]=function(_0x1b41cd){var _0x900121=this;return new Promise(function(_0x389c32,_0xe45edd){return db[_0xf472('0x1b')]['findAll']({'raw':_0x1b41cd[_0xf472('0x1c')]?_0x1b41cd[_0xf472('0x1c')][_0xf472('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b41cd[_0xf472('0x1c')]?_0x1b41cd[_0xf472('0x1c')][_0xf472('0x1e')]||null:null,'attributes':_0x1b41cd['options']?_0x1b41cd['options'][_0xf472('0x1f')]||null:null,'limit':_0x1b41cd[_0xf472('0x1c')]?_0x1b41cd[_0xf472('0x1c')][_0xf472('0x20')]||null:null,'include':_0x1b41cd[_0xf472('0x1c')]?_0x1b41cd[_0xf472('0x1c')][_0xf472('0x21')]?_[_0xf472('0x22')](_0x1b41cd[_0xf472('0x1c')][_0xf472('0x21')],function(_0x4c149c){return{'model':db[_0x4c149c['model']],'as':_0x4c149c['as'],'attributes':_0x4c149c['attributes'],'include':_0x4c149c['include']?_['map'](_0x4c149c['include'],function(_0x2ac633){return{'model':db[_0x2ac633[_0xf472('0x23')]],'as':_0x2ac633['as'],'attributes':_0x2ac633[_0xf472('0x1f')],'include':_0x2ac633[_0xf472('0x21')]?_[_0xf472('0x22')](_0x2ac633[_0xf472('0x21')],function(_0x1a3ef5){return{'model':db[_0x1a3ef5['model']],'as':_0x1a3ef5['as'],'attributes':_0x1a3ef5[_0xf472('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf472('0xe')](function(_0x53bd6d){logger[_0xf472('0xf')](_0xf472('0x1a'),_0x1b41cd);logger[_0xf472('0x12')](_0xf472('0x1a'),_0x1b41cd,JSON[_0xf472('0x14')](_0x53bd6d));_0x389c32(_0x53bd6d);})['catch'](function(_0x267f60){logger[_0xf472('0x15')](_0xf472('0x1a'),_0x267f60[_0xf472('0x17')],_0x1b41cd);_0xe45edd(_0x900121[_0xf472('0x15')](0x1f4,_0x267f60[_0xf472('0x17')]));});});};exports[_0xf472('0x24')]=function(_0x2a32e3){var _0x2d569f=this;return new Promise(function(_0x35bc6c,_0x13ded7){return db[_0xf472('0x1b')][_0xf472('0x25')]({'raw':_0x2a32e3['options']?_0x2a32e3['options'][_0xf472('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a32e3['options']?_0x2a32e3[_0xf472('0x1c')][_0xf472('0x1e')]||null:null,'attributes':_0x2a32e3[_0xf472('0x1c')]?_0x2a32e3[_0xf472('0x1c')][_0xf472('0x1f')]||null:null,'include':_0x2a32e3['options']?_0x2a32e3[_0xf472('0x1c')]['include']?_['map'](_0x2a32e3['options'][_0xf472('0x21')],function(_0x2f395b){return{'model':db[_0x2f395b[_0xf472('0x23')]],'as':_0x2f395b['as'],'attributes':_0x2f395b[_0xf472('0x1f')],'include':_0x2f395b['include']?_[_0xf472('0x22')](_0x2f395b[_0xf472('0x21')],function(_0x31634e){return{'model':db[_0x31634e[_0xf472('0x23')]],'as':_0x31634e['as'],'attributes':_0x31634e[_0xf472('0x1f')],'include':_0x31634e[_0xf472('0x21')]?_[_0xf472('0x22')](_0x31634e[_0xf472('0x21')],function(_0x31f394){return{'model':db[_0x31f394[_0xf472('0x23')]],'as':_0x31f394['as'],'attributes':_0x31f394[_0xf472('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47682a){logger[_0xf472('0xf')](_0xf472('0x24'),_0x2a32e3);logger[_0xf472('0x12')](_0xf472('0x24'),_0x2a32e3,JSON[_0xf472('0x14')](_0x47682a));_0x35bc6c(_0x47682a);})['catch'](function(_0x31c688){logger['error'](_0xf472('0x24'),_0x31c688[_0xf472('0x17')],_0x2a32e3);_0x13ded7(_0x2d569f[_0xf472('0x15')](0x1f4,_0x31c688[_0xf472('0x17')]));});});}; \ No newline at end of file +var _0xf1df=['model','attributes','map','stringify','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include'];(function(_0x2f52d0,_0x407519){var _0x305b10=function(_0x396273){while(--_0x396273){_0x2f52d0['push'](_0x2f52d0['shift']());}};_0x305b10(++_0x407519);}(_0xf1df,0x165));var _0xff1d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf1df[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xff1d('0x0'));var util=require(_0xff1d('0x1'));var moment=require(_0xff1d('0x2'));var BPromise=require(_0xff1d('0x3'));var rs=require(_0xff1d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff1d('0x6'))(_0xff1d('0x7'));var config=require(_0xff1d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xff1d('0x9')][_0xff1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20f4bf,_0x4ccbdb,_0x3e0230){return new BPromise(function(_0x4c15a1,_0x3a1cb5){return client['request'](_0x20f4bf,_0x3e0230)[_0xff1d('0xb')](function(_0x478843){logger[_0xff1d('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4ccbdb,_0xff1d('0xd'));logger[_0xff1d('0xe')](_0xff1d('0xf'),_0x4ccbdb,_0xff1d('0xd'),JSON['stringify'](_0x478843));if(_0x478843[_0xff1d('0x10')]){if(_0x478843['error'][_0xff1d('0x11')]===0x1f4){logger[_0xff1d('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4ccbdb,_0x478843['error'][_0xff1d('0x12')]);return _0x3a1cb5(_0x478843[_0xff1d('0x10')][_0xff1d('0x12')]);}logger['error'](_0xff1d('0x13'),_0x4ccbdb,_0x478843[_0xff1d('0x10')]['message']);return _0x4c15a1(_0x478843[_0xff1d('0x10')][_0xff1d('0x12')]);}else{logger[_0xff1d('0xc')](_0xff1d('0x13'),_0x4ccbdb,_0xff1d('0xd'));_0x4c15a1(_0x478843['result'][_0xff1d('0x12')]);}})[_0xff1d('0x14')](function(_0x205e18){logger[_0xff1d('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4ccbdb,_0x205e18);_0x3a1cb5(_0x205e18);});});}exports[_0xff1d('0x15')]=function(_0x27dcd8){var _0x30e578=this;return new Promise(function(_0xb98f81,_0x3a3256){return db[_0xff1d('0x16')][_0xff1d('0x17')]({'raw':_0x27dcd8[_0xff1d('0x18')]?_0x27dcd8[_0xff1d('0x18')][_0xff1d('0x19')]===undefined?!![]:![]:!![],'where':_0x27dcd8[_0xff1d('0x18')]?_0x27dcd8[_0xff1d('0x18')]['where']||null:null,'attributes':_0x27dcd8[_0xff1d('0x18')]?_0x27dcd8[_0xff1d('0x18')]['attributes']||null:null,'limit':_0x27dcd8['options']?_0x27dcd8[_0xff1d('0x18')][_0xff1d('0x1a')]||null:null,'include':_0x27dcd8['options']?_0x27dcd8[_0xff1d('0x18')][_0xff1d('0x1b')]?_['map'](_0x27dcd8[_0xff1d('0x18')][_0xff1d('0x1b')],function(_0x3c0be1){return{'model':db[_0x3c0be1[_0xff1d('0x1c')]],'as':_0x3c0be1['as'],'attributes':_0x3c0be1[_0xff1d('0x1d')],'include':_0x3c0be1[_0xff1d('0x1b')]?_[_0xff1d('0x1e')](_0x3c0be1[_0xff1d('0x1b')],function(_0x1c8e1b){return{'model':db[_0x1c8e1b['model']],'as':_0x1c8e1b['as'],'attributes':_0x1c8e1b[_0xff1d('0x1d')],'include':_0x1c8e1b[_0xff1d('0x1b')]?_[_0xff1d('0x1e')](_0x1c8e1b[_0xff1d('0x1b')],function(_0x63e302){return{'model':db[_0x63e302[_0xff1d('0x1c')]],'as':_0x63e302['as'],'attributes':_0x63e302[_0xff1d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xff1d('0xb')](function(_0xe297b8){logger[_0xff1d('0xc')](_0xff1d('0x15'),_0x27dcd8);logger[_0xff1d('0xe')](_0xff1d('0x15'),_0x27dcd8,JSON[_0xff1d('0x1f')](_0xe297b8));_0xb98f81(_0xe297b8);})[_0xff1d('0x14')](function(_0x209955){logger[_0xff1d('0x10')]('GetServicenowAccount',_0x209955[_0xff1d('0x12')],_0x27dcd8);_0x3a3256(_0x30e578[_0xff1d('0x10')](0x1f4,_0x209955[_0xff1d('0x12')]));});});};exports[_0xff1d('0x20')]=function(_0x2524dc){var _0x3a980b=this;return new Promise(function(_0x1b66af,_0x5ab79a){return db[_0xff1d('0x16')][_0xff1d('0x21')]({'raw':_0x2524dc['options']?_0x2524dc[_0xff1d('0x18')][_0xff1d('0x19')]===undefined?!![]:![]:!![],'where':_0x2524dc['options']?_0x2524dc[_0xff1d('0x18')][_0xff1d('0x22')]||null:null,'attributes':_0x2524dc[_0xff1d('0x18')]?_0x2524dc[_0xff1d('0x18')][_0xff1d('0x1d')]||null:null,'include':_0x2524dc[_0xff1d('0x18')]?_0x2524dc[_0xff1d('0x18')][_0xff1d('0x1b')]?_['map'](_0x2524dc[_0xff1d('0x18')][_0xff1d('0x1b')],function(_0x3808c3){return{'model':db[_0x3808c3[_0xff1d('0x1c')]],'as':_0x3808c3['as'],'attributes':_0x3808c3[_0xff1d('0x1d')],'include':_0x3808c3[_0xff1d('0x1b')]?_[_0xff1d('0x1e')](_0x3808c3[_0xff1d('0x1b')],function(_0x1d593a){return{'model':db[_0x1d593a[_0xff1d('0x1c')]],'as':_0x1d593a['as'],'attributes':_0x1d593a[_0xff1d('0x1d')],'include':_0x1d593a[_0xff1d('0x1b')]?_[_0xff1d('0x1e')](_0x1d593a[_0xff1d('0x1b')],function(_0xf953dd){return{'model':db[_0xf953dd[_0xff1d('0x1c')]],'as':_0xf953dd['as'],'attributes':_0xf953dd['attributes']};}):[]};}):[]};}):[]:[]})[_0xff1d('0xb')](function(_0x260abe){logger['info'](_0xff1d('0x20'),_0x2524dc);logger[_0xff1d('0xe')](_0xff1d('0x20'),_0x2524dc,JSON[_0xff1d('0x1f')](_0x260abe));_0x1b66af(_0x260abe);})[_0xff1d('0x14')](function(_0x2a72a7){logger[_0xff1d('0x10')](_0xff1d('0x20'),_0x2a72a7[_0xff1d('0x12')],_0x2524dc);_0x5ab79a(_0x3a980b[_0xff1d('0x10')](0x1f4,_0x2a72a7[_0xff1d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index cd54b70..13fc62c 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 _0x5e06=['./intServicenowConfiguration.controller','get','index','/:id','show','/:id/fields','getFields','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment'];(function(_0x2c79f5,_0x363799){var _0x154903=function(_0x4d779a){while(--_0x4d779a){_0x2c79f5['push'](_0x2c79f5['shift']());}};_0x154903(++_0x363799);}(_0x5e06,0x1dd));var _0x65e0=function(_0x2e5be5,_0x1c95fa){_0x2e5be5=_0x2e5be5-0x0;var _0x92dc0e=_0x5e06[_0x2e5be5];return _0x92dc0e;};'use strict';var multer=require(_0x65e0('0x0'));var util=require(_0x65e0('0x1'));var path=require(_0x65e0('0x2'));var timeout=require(_0x65e0('0x3'));var express=require('express');var router=express[_0x65e0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x65e0('0x5'));var controller=require(_0x65e0('0x6'));router[_0x65e0('0x7')]('/',auth['isAuthenticated'](),controller[_0x65e0('0x8')]);router[_0x65e0('0x7')](_0x65e0('0x9'),auth['isAuthenticated'](),controller[_0x65e0('0xa')]);router['get'](_0x65e0('0xb'),auth['isAuthenticated'](),controller[_0x65e0('0xc')]);router[_0x65e0('0x7')]('/:id/subjects',auth[_0x65e0('0xd')](),controller[_0x65e0('0xe')]);router[_0x65e0('0x7')](_0x65e0('0xf'),auth[_0x65e0('0xd')](),controller[_0x65e0('0x10')]);router[_0x65e0('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x65e0('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65e0('0x12')]('/:id',auth[_0x65e0('0xd')](),controller[_0x65e0('0x13')]);module[_0x65e0('0x14')]=router; \ No newline at end of file +var _0xec30=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xec30,0x70));var _0x0ec3=function(_0x16b55f,_0x301c6c){_0x16b55f=_0x16b55f-0x0;var _0x391c2f=_0xec30[_0x16b55f];return _0x391c2f;};'use strict';var multer=require(_0x0ec3('0x0'));var util=require(_0x0ec3('0x1'));var path=require(_0x0ec3('0x2'));var timeout=require(_0x0ec3('0x3'));var express=require(_0x0ec3('0x4'));var router=express[_0x0ec3('0x5')]();var fs_extra=require(_0x0ec3('0x6'));var auth=require(_0x0ec3('0x7'));var interaction=require(_0x0ec3('0x8'));var config=require('../../config/environment');var controller=require(_0x0ec3('0x9'));router[_0x0ec3('0xa')]('/',auth[_0x0ec3('0xb')](),controller[_0x0ec3('0xc')]);router[_0x0ec3('0xa')](_0x0ec3('0xd'),auth[_0x0ec3('0xb')](),controller[_0x0ec3('0xe')]);router[_0x0ec3('0xa')](_0x0ec3('0xf'),auth['isAuthenticated'](),controller[_0x0ec3('0x10')]);router['get'](_0x0ec3('0x11'),auth[_0x0ec3('0xb')](),controller[_0x0ec3('0x12')]);router[_0x0ec3('0xa')]('/:id/descriptions',auth[_0x0ec3('0xb')](),controller[_0x0ec3('0x13')]);router[_0x0ec3('0x14')]('/',auth[_0x0ec3('0xb')](),controller[_0x0ec3('0x15')]);router[_0x0ec3('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0ec3('0x17')]);router[_0x0ec3('0x18')](_0x0ec3('0xd'),auth[_0x0ec3('0xb')](),controller[_0x0ec3('0x19')]);module[_0x0ec3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2ed214a..e582ea0 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 _0xe26b=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe26b,0x166));var _0xbe26=function(_0x282468,_0x4f863f){_0x282468=_0x282468-0x0;var _0x616c6c=_0xe26b[_0x282468];return _0x616c6c;};'use strict';var Sequelize=require(_0xbe26('0x0'));module[_0xbe26('0x1')]={'name':{'type':Sequelize[_0xbe26('0x2')]},'description':{'type':Sequelize[_0xbe26('0x2')]}}; \ No newline at end of file +var _0x6597=['exports','STRING','sequelize'];(function(_0x14561d,_0x3f2ccd){var _0x57347d=function(_0x4273c1){while(--_0x4273c1){_0x14561d['push'](_0x14561d['shift']());}};_0x57347d(++_0x3f2ccd);}(_0x6597,0x116));var _0x7659=function(_0x11b17e,_0x12a7b2){_0x11b17e=_0x11b17e-0x0;var _0x135300=_0x6597[_0x11b17e];return _0x135300;};'use strict';var Sequelize=require(_0x7659('0x0'));module[_0x7659('0x1')]={'name':{'type':Sequelize[_0x7659('0x2')]},'description':{'type':Sequelize[_0x7659('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index c01188d..039a3f2 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 _0x6423=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','find','catch','create','body','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3d9755,_0x17ec01){var _0x4df845=function(_0x35a69a){while(--_0x35a69a){_0x3d9755['push'](_0x3d9755['shift']());}};_0x4df845(++_0x17ec01);}(_0x6423,0x1cd));var _0x3642=function(_0x499054,_0x2eabeb){_0x499054=_0x499054-0x0;var _0x1702cf=_0x6423[_0x499054];return _0x1702cf;};'use strict';var emlformat=require(_0x3642('0x0'));var rimraf=require(_0x3642('0x1'));var zipdir=require(_0x3642('0x2'));var jsonpatch=require(_0x3642('0x3'));var rp=require(_0x3642('0x4'));var moment=require('moment');var BPromise=require(_0x3642('0x5'));var Mustache=require(_0x3642('0x6'));var util=require(_0x3642('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3642('0x8'));var ejs=require(_0x3642('0x9'));var fs=require('fs');var fs_extra=require(_0x3642('0xa'));var _=require(_0x3642('0xb'));var squel=require(_0x3642('0xc'));var crypto=require(_0x3642('0xd'));var jsforce=require(_0x3642('0xe'));var deskjs=require(_0x3642('0xf'));var toCsv=require(_0x3642('0x8'));var querystring=require(_0x3642('0x10'));var Papa=require(_0x3642('0x11'));var Redis=require(_0x3642('0x12'));var authService=require(_0x3642('0x13'));var qs=require(_0x3642('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3642('0x15'))(_0x3642('0x16'));var utils=require(_0x3642('0x17'));var config=require(_0x3642('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3642('0x19'))['db'];function respondWithStatusCode(_0x28c9f5,_0x48ccfc){_0x48ccfc=_0x48ccfc||0xcc;return function(_0x4fdacf){if(_0x4fdacf){return _0x28c9f5[_0x3642('0x1a')](_0x48ccfc);}return _0x28c9f5['status'](_0x48ccfc)[_0x3642('0x1b')]();};}function respondWithResult(_0x21c560,_0x13fdbb){_0x13fdbb=_0x13fdbb||0xc8;return function(_0x39c5e5){if(_0x39c5e5){return _0x21c560[_0x3642('0x1c')](_0x13fdbb)[_0x3642('0x1d')](_0x39c5e5);}};}function respondWithFilteredResult(_0x4c7ff5,_0x4b6059){return function(_0x5ee3da){if(_0x5ee3da){var _0xa2ff23=typeof _0x4b6059[_0x3642('0x1e')]===_0x3642('0x1f')&&typeof _0x4b6059[_0x3642('0x20')]===_0x3642('0x1f');var _0x2f6cd1=_0x5ee3da[_0x3642('0x21')];var _0x2dab39=_0xa2ff23?0x0:_0x4b6059[_0x3642('0x1e')];var _0x203885=_0xa2ff23?_0x5ee3da['count']:_0x4b6059[_0x3642('0x1e')]+_0x4b6059['limit'];var _0x319e8d;if(_0x203885>=_0x2f6cd1){_0x203885=_0x2f6cd1;_0x319e8d=0xc8;}else{_0x319e8d=0xce;}_0x4c7ff5[_0x3642('0x1c')](_0x319e8d);return _0x4c7ff5['set'](_0x3642('0x22'),_0x2dab39+'-'+_0x203885+'/'+_0x2f6cd1)['json'](_0x5ee3da);}return null;};}function patchUpdates(_0x226534){return function(_0x4e6512){try{jsonpatch['apply'](_0x4e6512,_0x226534,!![]);}catch(_0x257831){return BPromise[_0x3642('0x23')](_0x257831);}return _0x4e6512[_0x3642('0x24')]();};}function saveUpdates(_0x18b069,_0x216bdc){return function(_0x20cf78){if(_0x20cf78){return _0x20cf78[_0x3642('0x25')](_0x18b069)[_0x3642('0x26')](function(_0xe426a9){return _0xe426a9;});}return null;};}function removeEntity(_0x37bdc3,_0x13c2a0){return function(_0x5ef78b){if(_0x5ef78b){return _0x5ef78b[_0x3642('0x27')]()[_0x3642('0x26')](function(){_0x37bdc3[_0x3642('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24dccc,_0x217112){return function(_0x382e4f){if(!_0x382e4f){_0x24dccc[_0x3642('0x1a')](0x194);}return _0x382e4f;};}function handleError(_0x9dabbc,_0x52b3b8){_0x52b3b8=_0x52b3b8||0x1f4;return function(_0x161955){logger[_0x3642('0x28')](_0x161955[_0x3642('0x29')]);if(_0x161955['name']){delete _0x161955[_0x3642('0x2a')];}_0x9dabbc[_0x3642('0x1c')](_0x52b3b8)[_0x3642('0x2b')](_0x161955);};}exports['index']=function(_0x1cbe2f,_0x219393){var _0x26e4e8={},_0x587cb4={},_0x57568a={'count':0x0,'rows':[]};var _0x11ebaf=_[_0x3642('0x2c')](db[_0x3642('0x2d')][_0x3642('0x2e')],function(_0x472c27){return{'name':_0x472c27[_0x3642('0x2f')],'type':_0x472c27[_0x3642('0x30')]['key']};});_0x587cb4['model']=_['map'](_0x11ebaf,'name');_0x587cb4['query']=_[_0x3642('0x31')](_0x1cbe2f[_0x3642('0x32')]);_0x587cb4[_0x3642('0x33')]=_[_0x3642('0x34')](_0x587cb4['model'],_0x587cb4['query']);_0x26e4e8[_0x3642('0x35')]=_['intersection'](_0x587cb4[_0x3642('0x36')],qs[_0x3642('0x37')](_0x1cbe2f[_0x3642('0x32')]['fields']));_0x26e4e8[_0x3642('0x35')]=_0x26e4e8['attributes'][_0x3642('0x38')]?_0x26e4e8[_0x3642('0x35')]:_0x587cb4[_0x3642('0x36')];if(!_0x1cbe2f[_0x3642('0x32')][_0x3642('0x39')](_0x3642('0x3a'))){_0x26e4e8['limit']=qs[_0x3642('0x20')](_0x1cbe2f[_0x3642('0x32')][_0x3642('0x20')]);_0x26e4e8[_0x3642('0x1e')]=qs[_0x3642('0x1e')](_0x1cbe2f[_0x3642('0x32')][_0x3642('0x1e')]);}_0x26e4e8[_0x3642('0x3b')]=qs[_0x3642('0x3c')](_0x1cbe2f['query'][_0x3642('0x3c')]);_0x26e4e8[_0x3642('0x3d')]=qs[_0x3642('0x33')](_[_0x3642('0x3e')](_0x1cbe2f[_0x3642('0x32')],_0x587cb4[_0x3642('0x33')]),_0x11ebaf);if(_0x1cbe2f[_0x3642('0x32')][_0x3642('0x3f')]){_0x26e4e8[_0x3642('0x3d')]=_[_0x3642('0x40')](_0x26e4e8[_0x3642('0x3d')],{'$or':_['map'](_0x11ebaf,function(_0x11ad82){if(_0x11ad82['type']!=='VIRTUAL'){var _0x318464={};_0x318464[_0x11ad82[_0x3642('0x2a')]]={'$like':'%'+_0x1cbe2f['query'][_0x3642('0x3f')]+'%'};return _0x318464;}})});}_0x26e4e8=_['merge']({},_0x26e4e8,_0x1cbe2f[_0x3642('0x41')]);var _0x26181c={'where':_0x26e4e8[_0x3642('0x3d')]};return db[_0x3642('0x2d')][_0x3642('0x21')](_0x26181c)['then'](function(_0x20a2e1){_0x57568a['count']=_0x20a2e1;if(_0x1cbe2f[_0x3642('0x32')][_0x3642('0x42')]){_0x26e4e8[_0x3642('0x43')]=[{'all':!![]}];}return db[_0x3642('0x2d')]['findAll'](_0x26e4e8);})[_0x3642('0x26')](function(_0x17a6e0){_0x57568a['rows']=_0x17a6e0;return _0x57568a;})[_0x3642('0x26')](respondWithFilteredResult(_0x219393,_0x26e4e8))['catch'](handleError(_0x219393,null));};exports[_0x3642('0x44')]=function(_0x2eb54b,_0x4bfa29){var _0xa8d223={'raw':![],'where':{'id':_0x2eb54b[_0x3642('0x45')]['id']}},_0x555f21={};_0x555f21[_0x3642('0x36')]=_['keys'](db[_0x3642('0x2d')][_0x3642('0x2e')]);_0x555f21[_0x3642('0x32')]=_[_0x3642('0x31')](_0x2eb54b[_0x3642('0x32')]);_0x555f21[_0x3642('0x33')]=_[_0x3642('0x34')](_0x555f21[_0x3642('0x36')],_0x555f21[_0x3642('0x32')]);_0xa8d223[_0x3642('0x35')]=_['intersection'](_0x555f21[_0x3642('0x36')],qs[_0x3642('0x37')](_0x2eb54b[_0x3642('0x32')][_0x3642('0x37')]));_0xa8d223[_0x3642('0x35')]=_0xa8d223[_0x3642('0x35')][_0x3642('0x38')]?_0xa8d223[_0x3642('0x35')]:_0x555f21['model'];if(_0x2eb54b[_0x3642('0x32')][_0x3642('0x42')]){_0xa8d223[_0x3642('0x43')]=[{'all':!![]}];}_0xa8d223=_[_0x3642('0x40')]({},_0xa8d223,_0x2eb54b[_0x3642('0x41')]);return db[_0x3642('0x2d')][_0x3642('0x46')](_0xa8d223)[_0x3642('0x26')](handleEntityNotFound(_0x4bfa29,null))[_0x3642('0x26')](respondWithResult(_0x4bfa29,null))[_0x3642('0x47')](handleError(_0x4bfa29,null));};exports[_0x3642('0x48')]=function(_0x11482b,_0x137a0a){return db[_0x3642('0x2d')][_0x3642('0x48')](_0x11482b['body'],{})[_0x3642('0x26')](respondWithResult(_0x137a0a,0xc9))[_0x3642('0x47')](handleError(_0x137a0a,null));};exports[_0x3642('0x25')]=function(_0x280e25,_0x3de0cb){if(_0x280e25[_0x3642('0x49')]['id']){delete _0x280e25[_0x3642('0x49')]['id'];}return db['ServicenowConfiguration'][_0x3642('0x46')]({'where':{'id':_0x280e25[_0x3642('0x45')]['id']}})[_0x3642('0x26')](handleEntityNotFound(_0x3de0cb,null))[_0x3642('0x26')](saveUpdates(_0x280e25[_0x3642('0x49')],null))[_0x3642('0x26')](respondWithResult(_0x3de0cb,null))['catch'](handleError(_0x3de0cb,null));};exports[_0x3642('0x27')]=function(_0x2629b4,_0x2123f0){return db['ServicenowConfiguration'][_0x3642('0x46')]({'where':{'id':_0x2629b4[_0x3642('0x45')]['id']}})['then'](handleEntityNotFound(_0x2123f0,null))[_0x3642('0x26')](removeEntity(_0x2123f0,null))[_0x3642('0x47')](handleError(_0x2123f0,null));};exports['getFields']=function(_0x4b85b5,_0x3d26d9,_0x106f30){var _0x234595={};var _0x744fb={};var _0x5369c2;var _0x375533;return db[_0x3642('0x2d')][_0x3642('0x4a')]({'where':{'id':_0x4b85b5['params']['id']}})['then'](handleEntityNotFound(_0x3d26d9,null))['then'](function(_0x118bea){if(_0x118bea){_0x5369c2=_0x118bea;_0x744fb['model']=_['keys'](db[_0x3642('0x4b')][_0x3642('0x2e')]);_0x744fb[_0x3642('0x32')]=_['keys'](_0x4b85b5['query']);_0x744fb['filters']=_[_0x3642('0x34')](_0x744fb[_0x3642('0x36')],_0x744fb[_0x3642('0x32')]);_0x234595[_0x3642('0x35')]=_[_0x3642('0x34')](_0x744fb[_0x3642('0x36')],qs[_0x3642('0x37')](_0x4b85b5[_0x3642('0x32')]['fields']));_0x234595[_0x3642('0x35')]=_0x234595[_0x3642('0x35')]['length']?_0x234595[_0x3642('0x35')]:_0x744fb[_0x3642('0x36')];_0x234595['order']=qs[_0x3642('0x3c')](_0x4b85b5[_0x3642('0x32')]['sort']);_0x234595[_0x3642('0x3d')]=qs[_0x3642('0x33')](_[_0x3642('0x3e')](_0x4b85b5[_0x3642('0x32')],_0x744fb[_0x3642('0x33')]));if(_0x4b85b5[_0x3642('0x32')][_0x3642('0x3f')]){_0x234595[_0x3642('0x3d')]=_[_0x3642('0x40')](_0x234595[_0x3642('0x3d')],{'$or':_[_0x3642('0x2c')](_0x234595[_0x3642('0x35')],function(_0x3e3923){var _0x5a7f97={};_0x5a7f97[_0x3e3923]={'$like':'%'+_0x4b85b5[_0x3642('0x32')][_0x3642('0x3f')]+'%'};return _0x5a7f97;})});}_0x234595=_[_0x3642('0x40')]({},_0x234595,_0x4b85b5[_0x3642('0x41')]);return _0x5369c2[_0x3642('0x4c')](_0x234595);}})[_0x3642('0x26')](function(_0x39ae92){if(_0x39ae92){_0x375533=_0x39ae92[_0x3642('0x38')];if(!_0x4b85b5[_0x3642('0x32')]['hasOwnProperty'](_0x3642('0x3a'))){_0x234595[_0x3642('0x20')]=qs[_0x3642('0x20')](_0x4b85b5[_0x3642('0x32')]['limit']);_0x234595[_0x3642('0x1e')]=qs[_0x3642('0x1e')](_0x4b85b5['query'][_0x3642('0x1e')]);}return _0x5369c2[_0x3642('0x4c')](_0x234595);}})[_0x3642('0x26')](function(_0x34a598){if(_0x34a598){return _0x34a598?{'count':_0x375533,'rows':_0x34a598}:null;}})[_0x3642('0x26')](respondWithResult(_0x3d26d9,null))[_0x3642('0x47')](handleError(_0x3d26d9,null));};exports['getSubjects']=function(_0x2739f0,_0x38c608,_0x2bc37d){var _0x2a3e40={};var _0x30592f={};var _0x2b5811;var _0x259cab;return db[_0x3642('0x2d')][_0x3642('0x4a')]({'where':{'id':_0x2739f0[_0x3642('0x45')]['id']}})[_0x3642('0x26')](handleEntityNotFound(_0x38c608,null))[_0x3642('0x26')](function(_0x494500){if(_0x494500){_0x2b5811=_0x494500;_0x30592f[_0x3642('0x36')]=_['keys'](db[_0x3642('0x4b')]['rawAttributes']);_0x30592f[_0x3642('0x32')]=_['keys'](_0x2739f0[_0x3642('0x32')]);_0x30592f['filters']=_['intersection'](_0x30592f[_0x3642('0x36')],_0x30592f[_0x3642('0x32')]);_0x2a3e40[_0x3642('0x35')]=_['intersection'](_0x30592f['model'],qs['fields'](_0x2739f0[_0x3642('0x32')][_0x3642('0x37')]));_0x2a3e40[_0x3642('0x35')]=_0x2a3e40[_0x3642('0x35')][_0x3642('0x38')]?_0x2a3e40[_0x3642('0x35')]:_0x30592f[_0x3642('0x36')];_0x2a3e40[_0x3642('0x3b')]=qs[_0x3642('0x3c')](_0x2739f0['query']['sort']);_0x2a3e40[_0x3642('0x3d')]=qs['filters'](_[_0x3642('0x3e')](_0x2739f0['query'],_0x30592f[_0x3642('0x33')]));if(_0x2739f0[_0x3642('0x32')][_0x3642('0x3f')]){_0x2a3e40[_0x3642('0x3d')]=_[_0x3642('0x40')](_0x2a3e40[_0x3642('0x3d')],{'$or':_[_0x3642('0x2c')](_0x2a3e40[_0x3642('0x35')],function(_0x4a843e){var _0x5727e6={};_0x5727e6[_0x4a843e]={'$like':'%'+_0x2739f0[_0x3642('0x32')][_0x3642('0x3f')]+'%'};return _0x5727e6;})});}_0x2a3e40=_[_0x3642('0x40')]({},_0x2a3e40,_0x2739f0[_0x3642('0x41')]);return _0x2b5811['getSubjects'](_0x2a3e40);}})['then'](function(_0x28357b){if(_0x28357b){_0x259cab=_0x28357b[_0x3642('0x38')];if(!_0x2739f0[_0x3642('0x32')][_0x3642('0x39')](_0x3642('0x3a'))){_0x2a3e40[_0x3642('0x20')]=qs[_0x3642('0x20')](_0x2739f0['query'][_0x3642('0x20')]);_0x2a3e40[_0x3642('0x1e')]=qs[_0x3642('0x1e')](_0x2739f0[_0x3642('0x32')][_0x3642('0x1e')]);}return _0x2b5811[_0x3642('0x4d')](_0x2a3e40);}})[_0x3642('0x26')](function(_0x4ba1c6){if(_0x4ba1c6){return _0x4ba1c6?{'count':_0x259cab,'rows':_0x4ba1c6}:null;}})['then'](respondWithResult(_0x38c608,null))[_0x3642('0x47')](handleError(_0x38c608,null));};exports[_0x3642('0x4e')]=function(_0x24b23f,_0x420ca2,_0x2e3efb){var _0x57cfb6={};var _0x1c98a7={};var _0x37299c;var _0x226d4e;return db[_0x3642('0x2d')]['findOne']({'where':{'id':_0x24b23f['params']['id']}})[_0x3642('0x26')](handleEntityNotFound(_0x420ca2,null))[_0x3642('0x26')](function(_0x550338){if(_0x550338){_0x37299c=_0x550338;_0x1c98a7[_0x3642('0x36')]=_[_0x3642('0x31')](db[_0x3642('0x4b')][_0x3642('0x2e')]);_0x1c98a7['query']=_[_0x3642('0x31')](_0x24b23f[_0x3642('0x32')]);_0x1c98a7[_0x3642('0x33')]=_[_0x3642('0x34')](_0x1c98a7[_0x3642('0x36')],_0x1c98a7[_0x3642('0x32')]);_0x57cfb6[_0x3642('0x35')]=_[_0x3642('0x34')](_0x1c98a7[_0x3642('0x36')],qs[_0x3642('0x37')](_0x24b23f['query'][_0x3642('0x37')]));_0x57cfb6[_0x3642('0x35')]=_0x57cfb6[_0x3642('0x35')][_0x3642('0x38')]?_0x57cfb6[_0x3642('0x35')]:_0x1c98a7['model'];_0x57cfb6[_0x3642('0x3b')]=qs[_0x3642('0x3c')](_0x24b23f['query'][_0x3642('0x3c')]);_0x57cfb6['where']=qs[_0x3642('0x33')](_[_0x3642('0x3e')](_0x24b23f['query'],_0x1c98a7[_0x3642('0x33')]));if(_0x24b23f[_0x3642('0x32')][_0x3642('0x3f')]){_0x57cfb6['where']=_[_0x3642('0x40')](_0x57cfb6[_0x3642('0x3d')],{'$or':_['map'](_0x57cfb6[_0x3642('0x35')],function(_0x36bbe5){var _0x5cca5e={};_0x5cca5e[_0x36bbe5]={'$like':'%'+_0x24b23f[_0x3642('0x32')][_0x3642('0x3f')]+'%'};return _0x5cca5e;})});}_0x57cfb6=_[_0x3642('0x40')]({},_0x57cfb6,_0x24b23f[_0x3642('0x41')]);return _0x37299c[_0x3642('0x4e')](_0x57cfb6);}})['then'](function(_0x221b83){if(_0x221b83){_0x226d4e=_0x221b83['length'];if(!_0x24b23f[_0x3642('0x32')][_0x3642('0x39')]('nolimit')){_0x57cfb6['limit']=qs[_0x3642('0x20')](_0x24b23f['query'][_0x3642('0x20')]);_0x57cfb6[_0x3642('0x1e')]=qs[_0x3642('0x1e')](_0x24b23f[_0x3642('0x32')][_0x3642('0x1e')]);}return _0x37299c['getDescriptions'](_0x57cfb6);}})['then'](function(_0x7aa9a6){if(_0x7aa9a6){return _0x7aa9a6?{'count':_0x226d4e,'rows':_0x7aa9a6}:null;}})[_0x3642('0x26')](respondWithResult(_0x420ca2,null))['catch'](handleError(_0x420ca2,null));}; \ No newline at end of file +var _0xa6db=['lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','getFields','ServicenowField','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6db,0x135));var _0xba6d=function(_0x241d9b,_0x45d294){_0x241d9b=_0x241d9b-0x0;var _0x4e5a52=_0xa6db[_0x241d9b];return _0x4e5a52;};'use strict';var emlformat=require(_0xba6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba6d('0x1'));var jsonpatch=require(_0xba6d('0x2'));var rp=require(_0xba6d('0x3'));var moment=require('moment');var BPromise=require(_0xba6d('0x4'));var Mustache=require(_0xba6d('0x5'));var util=require(_0xba6d('0x6'));var path=require(_0xba6d('0x7'));var sox=require(_0xba6d('0x8'));var csv=require('to-csv');var ejs=require(_0xba6d('0x9'));var fs=require('fs');var fs_extra=require(_0xba6d('0xa'));var _=require(_0xba6d('0xb'));var squel=require(_0xba6d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba6d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba6d('0xe'));var Redis=require(_0xba6d('0xf'));var authService=require(_0xba6d('0x10'));var qs=require(_0xba6d('0x11'));var as=require(_0xba6d('0x12'));var hardwareService=require(_0xba6d('0x13'));var logger=require(_0xba6d('0x14'))(_0xba6d('0x15'));var utils=require(_0xba6d('0x16'));var config=require(_0xba6d('0x17'));var licenseUtil=require(_0xba6d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c63cf,_0x5ca7a4){_0x5ca7a4=_0x5ca7a4||0xcc;return function(_0x8cd5cd){if(_0x8cd5cd){return _0x1c63cf['sendStatus'](_0x5ca7a4);}return _0x1c63cf[_0xba6d('0x19')](_0x5ca7a4)[_0xba6d('0x1a')]();};}function respondWithResult(_0x19e53d,_0x433ff0){_0x433ff0=_0x433ff0||0xc8;return function(_0x16f025){if(_0x16f025){return _0x19e53d[_0xba6d('0x19')](_0x433ff0)[_0xba6d('0x1b')](_0x16f025);}};}function respondWithFilteredResult(_0x205cda,_0x2b55d8){return function(_0x20a1aa){if(_0x20a1aa){var _0x22c76d=typeof _0x2b55d8['offset']===_0xba6d('0x1c')&&typeof _0x2b55d8[_0xba6d('0x1d')]==='undefined';var _0x218293=_0x20a1aa['count'];var _0x54df56=_0x22c76d?0x0:_0x2b55d8['offset'];var _0x4824ba=_0x22c76d?_0x20a1aa[_0xba6d('0x1e')]:_0x2b55d8['offset']+_0x2b55d8[_0xba6d('0x1d')];var _0x3d65b4;if(_0x4824ba>=_0x218293){_0x4824ba=_0x218293;_0x3d65b4=0xc8;}else{_0x3d65b4=0xce;}_0x205cda[_0xba6d('0x19')](_0x3d65b4);return _0x205cda[_0xba6d('0x1f')](_0xba6d('0x20'),_0x54df56+'-'+_0x4824ba+'/'+_0x218293)[_0xba6d('0x1b')](_0x20a1aa);}return null;};}function patchUpdates(_0xe6b1e1){return function(_0xc90f30){try{jsonpatch[_0xba6d('0x21')](_0xc90f30,_0xe6b1e1,!![]);}catch(_0x430c34){return BPromise[_0xba6d('0x22')](_0x430c34);}return _0xc90f30['save']();};}function saveUpdates(_0x41482a,_0x5815f3){return function(_0x23ce58){if(_0x23ce58){return _0x23ce58[_0xba6d('0x23')](_0x41482a)[_0xba6d('0x24')](function(_0x54a757){return _0x54a757;});}return null;};}function removeEntity(_0x22c893,_0x47ca96){return function(_0x17d569){if(_0x17d569){return _0x17d569['destroy']()[_0xba6d('0x24')](function(){_0x22c893[_0xba6d('0x19')](0xcc)[_0xba6d('0x1a')]();});}};}function handleEntityNotFound(_0x468361,_0x5906ac){return function(_0x4c453a){if(!_0x4c453a){_0x468361['sendStatus'](0x194);}return _0x4c453a;};}function handleError(_0x2f7cc8,_0x4d45dc){_0x4d45dc=_0x4d45dc||0x1f4;return function(_0x22848e){logger[_0xba6d('0x25')](_0x22848e[_0xba6d('0x26')]);if(_0x22848e[_0xba6d('0x27')]){delete _0x22848e[_0xba6d('0x27')];}_0x2f7cc8[_0xba6d('0x19')](_0x4d45dc)[_0xba6d('0x28')](_0x22848e);};}exports[_0xba6d('0x29')]=function(_0x4043ec,_0x22f4f3){var _0x38faa8={},_0x4a0693={},_0x20d93c={'count':0x0,'rows':[]};var _0x1d088f=_[_0xba6d('0x2a')](db[_0xba6d('0x2b')][_0xba6d('0x2c')],function(_0x1d7d07){return{'name':_0x1d7d07[_0xba6d('0x2d')],'type':_0x1d7d07[_0xba6d('0x2e')]['key']};});_0x4a0693[_0xba6d('0x2f')]=_[_0xba6d('0x2a')](_0x1d088f,'name');_0x4a0693[_0xba6d('0x30')]=_[_0xba6d('0x31')](_0x4043ec[_0xba6d('0x30')]);_0x4a0693[_0xba6d('0x32')]=_[_0xba6d('0x33')](_0x4a0693[_0xba6d('0x2f')],_0x4a0693['query']);_0x38faa8['attributes']=_[_0xba6d('0x33')](_0x4a0693[_0xba6d('0x2f')],qs[_0xba6d('0x34')](_0x4043ec[_0xba6d('0x30')][_0xba6d('0x34')]));_0x38faa8[_0xba6d('0x35')]=_0x38faa8[_0xba6d('0x35')]['length']?_0x38faa8[_0xba6d('0x35')]:_0x4a0693[_0xba6d('0x2f')];if(!_0x4043ec[_0xba6d('0x30')][_0xba6d('0x36')](_0xba6d('0x37'))){_0x38faa8[_0xba6d('0x1d')]=qs[_0xba6d('0x1d')](_0x4043ec[_0xba6d('0x30')]['limit']);_0x38faa8[_0xba6d('0x38')]=qs[_0xba6d('0x38')](_0x4043ec[_0xba6d('0x30')]['offset']);}_0x38faa8[_0xba6d('0x39')]=qs['sort'](_0x4043ec[_0xba6d('0x30')][_0xba6d('0x3a')]);_0x38faa8[_0xba6d('0x3b')]=qs[_0xba6d('0x32')](_[_0xba6d('0x3c')](_0x4043ec[_0xba6d('0x30')],_0x4a0693[_0xba6d('0x32')]),_0x1d088f);if(_0x4043ec['query'][_0xba6d('0x3d')]){_0x38faa8[_0xba6d('0x3b')]=_[_0xba6d('0x3e')](_0x38faa8['where'],{'$or':_[_0xba6d('0x2a')](_0x1d088f,function(_0x1ad88f){if(_0x1ad88f[_0xba6d('0x2e')]!==_0xba6d('0x3f')){var _0x3e42d5={};_0x3e42d5[_0x1ad88f['name']]={'$like':'%'+_0x4043ec[_0xba6d('0x30')]['filter']+'%'};return _0x3e42d5;}})});}_0x38faa8=_[_0xba6d('0x3e')]({},_0x38faa8,_0x4043ec[_0xba6d('0x40')]);var _0x71cbc4={'where':_0x38faa8['where']};return db[_0xba6d('0x2b')]['count'](_0x71cbc4)[_0xba6d('0x24')](function(_0x3fd9ca){_0x20d93c[_0xba6d('0x1e')]=_0x3fd9ca;if(_0x4043ec[_0xba6d('0x30')][_0xba6d('0x41')]){_0x38faa8[_0xba6d('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xba6d('0x43')](_0x38faa8);})[_0xba6d('0x24')](function(_0x1defac){_0x20d93c['rows']=_0x1defac;return _0x20d93c;})[_0xba6d('0x24')](respondWithFilteredResult(_0x22f4f3,_0x38faa8))[_0xba6d('0x44')](handleError(_0x22f4f3,null));};exports[_0xba6d('0x45')]=function(_0x2e40b4,_0x38b8b){var _0x3f1456={'raw':![],'where':{'id':_0x2e40b4['params']['id']}},_0x516b68={};_0x516b68[_0xba6d('0x2f')]=_[_0xba6d('0x31')](db[_0xba6d('0x2b')][_0xba6d('0x2c')]);_0x516b68['query']=_['keys'](_0x2e40b4[_0xba6d('0x30')]);_0x516b68[_0xba6d('0x32')]=_[_0xba6d('0x33')](_0x516b68[_0xba6d('0x2f')],_0x516b68['query']);_0x3f1456['attributes']=_[_0xba6d('0x33')](_0x516b68['model'],qs[_0xba6d('0x34')](_0x2e40b4[_0xba6d('0x30')][_0xba6d('0x34')]));_0x3f1456[_0xba6d('0x35')]=_0x3f1456[_0xba6d('0x35')][_0xba6d('0x46')]?_0x3f1456['attributes']:_0x516b68[_0xba6d('0x2f')];if(_0x2e40b4[_0xba6d('0x30')][_0xba6d('0x41')]){_0x3f1456['include']=[{'all':!![]}];}_0x3f1456=_[_0xba6d('0x3e')]({},_0x3f1456,_0x2e40b4['options']);return db['ServicenowConfiguration'][_0xba6d('0x47')](_0x3f1456)[_0xba6d('0x24')](handleEntityNotFound(_0x38b8b,null))[_0xba6d('0x24')](respondWithResult(_0x38b8b,null))[_0xba6d('0x44')](handleError(_0x38b8b,null));};exports[_0xba6d('0x48')]=function(_0x152bc0,_0x39df76){return db[_0xba6d('0x2b')][_0xba6d('0x48')](_0x152bc0['body'],{})['then'](respondWithResult(_0x39df76,0xc9))[_0xba6d('0x44')](handleError(_0x39df76,null));};exports['update']=function(_0x12ba3c,_0x42a17d){if(_0x12ba3c[_0xba6d('0x49')]['id']){delete _0x12ba3c['body']['id'];}return db[_0xba6d('0x2b')][_0xba6d('0x47')]({'where':{'id':_0x12ba3c['params']['id']}})[_0xba6d('0x24')](handleEntityNotFound(_0x42a17d,null))[_0xba6d('0x24')](saveUpdates(_0x12ba3c['body'],null))[_0xba6d('0x24')](respondWithResult(_0x42a17d,null))[_0xba6d('0x44')](handleError(_0x42a17d,null));};exports['destroy']=function(_0x7a7a41,_0x27257c){return db[_0xba6d('0x2b')][_0xba6d('0x47')]({'where':{'id':_0x7a7a41[_0xba6d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27257c,null))['then'](removeEntity(_0x27257c,null))[_0xba6d('0x44')](handleError(_0x27257c,null));};exports[_0xba6d('0x4b')]=function(_0x5d7a7c,_0x32d90b,_0x56622e){var _0x57c73a={};var _0x188c7f={};var _0x2b8576;var _0x546c49;return db[_0xba6d('0x2b')]['findOne']({'where':{'id':_0x5d7a7c[_0xba6d('0x4a')]['id']}})[_0xba6d('0x24')](handleEntityNotFound(_0x32d90b,null))['then'](function(_0xb9ca54){if(_0xb9ca54){_0x2b8576=_0xb9ca54;_0x188c7f[_0xba6d('0x2f')]=_[_0xba6d('0x31')](db[_0xba6d('0x4c')][_0xba6d('0x2c')]);_0x188c7f[_0xba6d('0x30')]=_[_0xba6d('0x31')](_0x5d7a7c['query']);_0x188c7f['filters']=_[_0xba6d('0x33')](_0x188c7f['model'],_0x188c7f[_0xba6d('0x30')]);_0x57c73a[_0xba6d('0x35')]=_[_0xba6d('0x33')](_0x188c7f[_0xba6d('0x2f')],qs[_0xba6d('0x34')](_0x5d7a7c['query'][_0xba6d('0x34')]));_0x57c73a[_0xba6d('0x35')]=_0x57c73a[_0xba6d('0x35')][_0xba6d('0x46')]?_0x57c73a[_0xba6d('0x35')]:_0x188c7f[_0xba6d('0x2f')];_0x57c73a[_0xba6d('0x39')]=qs[_0xba6d('0x3a')](_0x5d7a7c['query'][_0xba6d('0x3a')]);_0x57c73a['where']=qs[_0xba6d('0x32')](_[_0xba6d('0x3c')](_0x5d7a7c[_0xba6d('0x30')],_0x188c7f['filters']));if(_0x5d7a7c[_0xba6d('0x30')][_0xba6d('0x3d')]){_0x57c73a[_0xba6d('0x3b')]=_[_0xba6d('0x3e')](_0x57c73a['where'],{'$or':_['map'](_0x57c73a[_0xba6d('0x35')],function(_0x12bb8c){var _0x47b6c2={};_0x47b6c2[_0x12bb8c]={'$like':'%'+_0x5d7a7c[_0xba6d('0x30')]['filter']+'%'};return _0x47b6c2;})});}_0x57c73a=_[_0xba6d('0x3e')]({},_0x57c73a,_0x5d7a7c[_0xba6d('0x40')]);return _0x2b8576[_0xba6d('0x4b')](_0x57c73a);}})[_0xba6d('0x24')](function(_0x497172){if(_0x497172){_0x546c49=_0x497172[_0xba6d('0x46')];if(!_0x5d7a7c[_0xba6d('0x30')][_0xba6d('0x36')](_0xba6d('0x37'))){_0x57c73a[_0xba6d('0x1d')]=qs[_0xba6d('0x1d')](_0x5d7a7c[_0xba6d('0x30')][_0xba6d('0x1d')]);_0x57c73a[_0xba6d('0x38')]=qs['offset'](_0x5d7a7c[_0xba6d('0x30')]['offset']);}return _0x2b8576[_0xba6d('0x4b')](_0x57c73a);}})[_0xba6d('0x24')](function(_0x2f5be5){if(_0x2f5be5){return _0x2f5be5?{'count':_0x546c49,'rows':_0x2f5be5}:null;}})['then'](respondWithResult(_0x32d90b,null))[_0xba6d('0x44')](handleError(_0x32d90b,null));};exports['getSubjects']=function(_0x261c60,_0x8d0f97,_0x582c1f){var _0x4008e5={};var _0xe2a8d8={};var _0x1f4283;var _0x1523bc;return db[_0xba6d('0x2b')][_0xba6d('0x4d')]({'where':{'id':_0x261c60[_0xba6d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x8d0f97,null))[_0xba6d('0x24')](function(_0xa16257){if(_0xa16257){_0x1f4283=_0xa16257;_0xe2a8d8[_0xba6d('0x2f')]=_[_0xba6d('0x31')](db[_0xba6d('0x4c')][_0xba6d('0x2c')]);_0xe2a8d8[_0xba6d('0x30')]=_[_0xba6d('0x31')](_0x261c60[_0xba6d('0x30')]);_0xe2a8d8['filters']=_['intersection'](_0xe2a8d8[_0xba6d('0x2f')],_0xe2a8d8['query']);_0x4008e5[_0xba6d('0x35')]=_[_0xba6d('0x33')](_0xe2a8d8['model'],qs[_0xba6d('0x34')](_0x261c60[_0xba6d('0x30')][_0xba6d('0x34')]));_0x4008e5[_0xba6d('0x35')]=_0x4008e5[_0xba6d('0x35')][_0xba6d('0x46')]?_0x4008e5['attributes']:_0xe2a8d8[_0xba6d('0x2f')];_0x4008e5[_0xba6d('0x39')]=qs[_0xba6d('0x3a')](_0x261c60[_0xba6d('0x30')][_0xba6d('0x3a')]);_0x4008e5[_0xba6d('0x3b')]=qs[_0xba6d('0x32')](_[_0xba6d('0x3c')](_0x261c60[_0xba6d('0x30')],_0xe2a8d8[_0xba6d('0x32')]));if(_0x261c60[_0xba6d('0x30')][_0xba6d('0x3d')]){_0x4008e5['where']=_[_0xba6d('0x3e')](_0x4008e5[_0xba6d('0x3b')],{'$or':_[_0xba6d('0x2a')](_0x4008e5[_0xba6d('0x35')],function(_0x5683b7){var _0x2b6f79={};_0x2b6f79[_0x5683b7]={'$like':'%'+_0x261c60[_0xba6d('0x30')][_0xba6d('0x3d')]+'%'};return _0x2b6f79;})});}_0x4008e5=_[_0xba6d('0x3e')]({},_0x4008e5,_0x261c60[_0xba6d('0x40')]);return _0x1f4283[_0xba6d('0x4e')](_0x4008e5);}})[_0xba6d('0x24')](function(_0x5cec56){if(_0x5cec56){_0x1523bc=_0x5cec56[_0xba6d('0x46')];if(!_0x261c60['query'][_0xba6d('0x36')](_0xba6d('0x37'))){_0x4008e5['limit']=qs[_0xba6d('0x1d')](_0x261c60[_0xba6d('0x30')][_0xba6d('0x1d')]);_0x4008e5[_0xba6d('0x38')]=qs[_0xba6d('0x38')](_0x261c60['query']['offset']);}return _0x1f4283['getSubjects'](_0x4008e5);}})[_0xba6d('0x24')](function(_0x452821){if(_0x452821){return _0x452821?{'count':_0x1523bc,'rows':_0x452821}:null;}})[_0xba6d('0x24')](respondWithResult(_0x8d0f97,null))[_0xba6d('0x44')](handleError(_0x8d0f97,null));};exports['getDescriptions']=function(_0xf233f8,_0x11cc4d,_0x121426){var _0x4c92f5={};var _0x8a713b={};var _0x4a7993;var _0x3e3bbd;return db[_0xba6d('0x2b')][_0xba6d('0x4d')]({'where':{'id':_0xf233f8[_0xba6d('0x4a')]['id']}})[_0xba6d('0x24')](handleEntityNotFound(_0x11cc4d,null))[_0xba6d('0x24')](function(_0xcbf444){if(_0xcbf444){_0x4a7993=_0xcbf444;_0x8a713b['model']=_[_0xba6d('0x31')](db[_0xba6d('0x4c')][_0xba6d('0x2c')]);_0x8a713b[_0xba6d('0x30')]=_[_0xba6d('0x31')](_0xf233f8[_0xba6d('0x30')]);_0x8a713b[_0xba6d('0x32')]=_[_0xba6d('0x33')](_0x8a713b['model'],_0x8a713b['query']);_0x4c92f5['attributes']=_[_0xba6d('0x33')](_0x8a713b[_0xba6d('0x2f')],qs[_0xba6d('0x34')](_0xf233f8[_0xba6d('0x30')][_0xba6d('0x34')]));_0x4c92f5[_0xba6d('0x35')]=_0x4c92f5[_0xba6d('0x35')][_0xba6d('0x46')]?_0x4c92f5[_0xba6d('0x35')]:_0x8a713b['model'];_0x4c92f5[_0xba6d('0x39')]=qs['sort'](_0xf233f8[_0xba6d('0x30')][_0xba6d('0x3a')]);_0x4c92f5['where']=qs[_0xba6d('0x32')](_['pick'](_0xf233f8[_0xba6d('0x30')],_0x8a713b[_0xba6d('0x32')]));if(_0xf233f8[_0xba6d('0x30')][_0xba6d('0x3d')]){_0x4c92f5[_0xba6d('0x3b')]=_['merge'](_0x4c92f5['where'],{'$or':_[_0xba6d('0x2a')](_0x4c92f5[_0xba6d('0x35')],function(_0x3743e6){var _0x3922c4={};_0x3922c4[_0x3743e6]={'$like':'%'+_0xf233f8[_0xba6d('0x30')]['filter']+'%'};return _0x3922c4;})});}_0x4c92f5=_['merge']({},_0x4c92f5,_0xf233f8[_0xba6d('0x40')]);return _0x4a7993[_0xba6d('0x4f')](_0x4c92f5);}})[_0xba6d('0x24')](function(_0x5a882b){if(_0x5a882b){_0x3e3bbd=_0x5a882b[_0xba6d('0x46')];if(!_0xf233f8['query'][_0xba6d('0x36')](_0xba6d('0x37'))){_0x4c92f5['limit']=qs['limit'](_0xf233f8['query'][_0xba6d('0x1d')]);_0x4c92f5[_0xba6d('0x38')]=qs['offset'](_0xf233f8[_0xba6d('0x30')][_0xba6d('0x38')]);}return _0x4a7993[_0xba6d('0x4f')](_0x4c92f5);}})['then'](function(_0xfc32f1){if(_0xfc32f1){return _0xfc32f1?{'count':_0x3e3bbd,'rows':_0xfc32f1}:null;}})[_0xba6d('0x24')](respondWithResult(_0x11cc4d,null))[_0xba6d('0x44')](handleError(_0x11cc4d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e4364f5..82d4ae6 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 _0x594d=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x5b6d78,_0x24b5ee){var _0x1b5432=function(_0x1168d4){while(--_0x1168d4){_0x5b6d78['push'](_0x5b6d78['shift']());}};_0x1b5432(++_0x24b5ee);}(_0x594d,0x92));var _0xd594=function(_0x5f7fc0,_0x251897){_0x5f7fc0=_0x5f7fc0-0x0;var _0xa02472=_0x594d[_0x5f7fc0];return _0xa02472;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd594('0x1'));var moment=require(_0xd594('0x2'));var BPromise=require(_0xd594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd594('0x4'));var rimraf=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module['exports']=function(_0x3347cd,_0x498ef4){return _0x3347cd[_0xd594('0x8')](_0xd594('0x9'),attributes,{'tableName':_0xd594('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68a5=['define','ServicenowConfiguration','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x68a5,0xfc));var _0x568a=function(_0x33a489,_0x3616f3){_0x33a489=_0x33a489-0x0;var _0x40d215=_0x68a5[_0x33a489];return _0x40d215;};'use strict';var _=require(_0x568a('0x0'));var util=require('util');var logger=require(_0x568a('0x1'))(_0x568a('0x2'));var moment=require('moment');var BPromise=require(_0x568a('0x3'));var rp=require(_0x568a('0x4'));var fs=require('fs');var path=require(_0x568a('0x5'));var rimraf=require(_0x568a('0x6'));var config=require('../../config/environment');var attributes=require(_0x568a('0x7'));module['exports']=function(_0x26db0e,_0x467a4f){return _0x26db0e[_0x568a('0x8')](_0x568a('0x9'),attributes,{'tableName':'int_servicenow_configurations','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 5e865bb..5663afb 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 _0x6e06=['message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x1bb37d,_0x56496a){var _0x29e971=function(_0x28a5c2){while(--_0x28a5c2){_0x1bb37d['push'](_0x1bb37d['shift']());}};_0x29e971(++_0x56496a);}(_0x6e06,0x9a));var _0x66e0=function(_0x48a7b8,_0x320352){_0x48a7b8=_0x48a7b8-0x0;var _0x3ce9ca=_0x6e06[_0x48a7b8];return _0x3ce9ca;};'use strict';var _=require(_0x66e0('0x0'));var util=require(_0x66e0('0x1'));var moment=require(_0x66e0('0x2'));var BPromise=require(_0x66e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e0('0x4'))['db'];var utils=require(_0x66e0('0x5'));var logger=require(_0x66e0('0x6'))(_0x66e0('0x7'));var config=require(_0x66e0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x66e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a93f0,_0x35fbe7,_0x2a37e9){return new BPromise(function(_0x2dc4fa,_0x138fbe){return client[_0x66e0('0xa')](_0x5a93f0,_0x2a37e9)['then'](function(_0x29d28b){logger[_0x66e0('0xb')](_0x66e0('0xc'),_0x35fbe7,_0x66e0('0xd'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x35fbe7,_0x66e0('0xd'),JSON['stringify'](_0x29d28b));if(_0x29d28b[_0x66e0('0xe')]){if(_0x29d28b[_0x66e0('0xe')][_0x66e0('0xf')]===0x1f4){logger[_0x66e0('0xe')](_0x66e0('0xc'),_0x35fbe7,_0x29d28b['error'][_0x66e0('0x10')]);return _0x138fbe(_0x29d28b[_0x66e0('0xe')][_0x66e0('0x10')]);}logger[_0x66e0('0xe')](_0x66e0('0xc'),_0x35fbe7,_0x29d28b[_0x66e0('0xe')][_0x66e0('0x10')]);return _0x2dc4fa(_0x29d28b['error'][_0x66e0('0x10')]);}else{logger[_0x66e0('0xb')](_0x66e0('0xc'),_0x35fbe7,_0x66e0('0xd'));_0x2dc4fa(_0x29d28b['result'][_0x66e0('0x10')]);}})['catch'](function(_0x20f896){logger[_0x66e0('0xe')](_0x66e0('0xc'),_0x35fbe7,_0x20f896);_0x138fbe(_0x20f896);});});} \ No newline at end of file +var _0x46bc=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x6cb4dd,_0x23b89c){var _0x461fa6=function(_0x10b593){while(--_0x10b593){_0x6cb4dd['push'](_0x6cb4dd['shift']());}};_0x461fa6(++_0x23b89c);}(_0x46bc,0xca));var _0xc46b=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x46bc[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xc46b('0x0'));var util=require(_0xc46b('0x1'));var moment=require(_0xc46b('0x2'));var BPromise=require(_0xc46b('0x3'));var rs=require(_0xc46b('0x4'));var fs=require('fs');var Redis=require(_0xc46b('0x5'));var db=require(_0xc46b('0x6'))['db'];var utils=require(_0xc46b('0x7'));var logger=require(_0xc46b('0x8'))(_0xc46b('0x9'));var config=require(_0xc46b('0xa'));var jayson=require(_0xc46b('0xb'));var client=jayson['client'][_0xc46b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2da494,_0x99f390,_0x3ee460){return new BPromise(function(_0x30cb18,_0x51b8da){return client[_0xc46b('0xd')](_0x2da494,_0x3ee460)[_0xc46b('0xe')](function(_0x2def43){logger[_0xc46b('0xf')](_0xc46b('0x10'),_0x99f390,'request\x20sent');logger[_0xc46b('0x11')](_0xc46b('0x12'),_0x99f390,_0xc46b('0x13'),JSON[_0xc46b('0x14')](_0x2def43));if(_0x2def43[_0xc46b('0x15')]){if(_0x2def43[_0xc46b('0x15')]['code']===0x1f4){logger[_0xc46b('0x15')](_0xc46b('0x10'),_0x99f390,_0x2def43[_0xc46b('0x15')][_0xc46b('0x16')]);return _0x51b8da(_0x2def43[_0xc46b('0x15')][_0xc46b('0x16')]);}logger[_0xc46b('0x15')](_0xc46b('0x10'),_0x99f390,_0x2def43[_0xc46b('0x15')][_0xc46b('0x16')]);return _0x30cb18(_0x2def43[_0xc46b('0x15')][_0xc46b('0x16')]);}else{logger[_0xc46b('0xf')](_0xc46b('0x10'),_0x99f390,_0xc46b('0x13'));_0x30cb18(_0x2def43[_0xc46b('0x17')][_0xc46b('0x16')]);}})[_0xc46b('0x18')](function(_0x34f0c5){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x99f390,_0x34f0c5);_0x51b8da(_0x34f0c5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b0b473d..44c6461 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 _0x9be4=['post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0x9be4,0x116));var _0x49be=function(_0x58fe84,_0x312d3d){_0x58fe84=_0x58fe84-0x0;var _0x325362=_0x9be4[_0x58fe84];return _0x325362;};'use strict';var multer=require(_0x49be('0x0'));var util=require(_0x49be('0x1'));var path=require('path');var timeout=require(_0x49be('0x2'));var express=require(_0x49be('0x3'));var router=express[_0x49be('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x49be('0x5'));var interaction=require(_0x49be('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x49be('0x7')](),controller['index']);router[_0x49be('0x8')](_0x49be('0x9'),auth[_0x49be('0x7')](),controller['show']);router[_0x49be('0xa')]('/',auth[_0x49be('0x7')](),controller[_0x49be('0xb')]);router[_0x49be('0xc')](_0x49be('0x9'),auth[_0x49be('0x7')](),controller[_0x49be('0xd')]);router['delete'](_0x49be('0x9'),auth[_0x49be('0x7')](),controller[_0x49be('0xe')]);module[_0x49be('0xf')]=router; \ No newline at end of file +var _0x3bf7=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','update','delete','destroy'];(function(_0x23f4ad,_0xb1c02f){var _0x42e2ec=function(_0x4f39e0){while(--_0x4f39e0){_0x23f4ad['push'](_0x23f4ad['shift']());}};_0x42e2ec(++_0xb1c02f);}(_0x3bf7,0xde));var _0x73bf=function(_0x255af7,_0x5abcb3){_0x255af7=_0x255af7-0x0;var _0x7f2e1d=_0x3bf7[_0x255af7];return _0x7f2e1d;};'use strict';var multer=require('multer');var util=require(_0x73bf('0x0'));var path=require(_0x73bf('0x1'));var timeout=require(_0x73bf('0x2'));var express=require(_0x73bf('0x3'));var router=express[_0x73bf('0x4')]();var fs_extra=require(_0x73bf('0x5'));var auth=require(_0x73bf('0x6'));var interaction=require(_0x73bf('0x7'));var config=require(_0x73bf('0x8'));var controller=require('./intServicenowField.controller');router[_0x73bf('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x73bf('0x9')](_0x73bf('0xa'),auth[_0x73bf('0xb')](),controller[_0x73bf('0xc')]);router['post']('/',auth[_0x73bf('0xb')](),controller['create']);router['put'](_0x73bf('0xa'),auth[_0x73bf('0xb')](),controller[_0x73bf('0xd')]);router[_0x73bf('0xe')](_0x73bf('0xa'),auth[_0x73bf('0xb')](),controller[_0x73bf('0xf')]);module[_0x73bf('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 5329332..fb6e462 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 _0x6aa4=['ENUM','string','variable','customVariable','picklist','STRING','sequelize'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0x6aa4,0x15d));var _0x46aa=function(_0x122183,_0x30dd3a){_0x122183=_0x122183-0x0;var _0x1c919f=_0x6aa4[_0x122183];return _0x1c919f;};'use strict';var Sequelize=require(_0x46aa('0x0'));module['exports']={'type':{'type':Sequelize[_0x46aa('0x1')](_0x46aa('0x2'),_0x46aa('0x3'),_0x46aa('0x4'),'keyValue',_0x46aa('0x5')),'defaultValue':_0x46aa('0x2')},'content':{'type':Sequelize[_0x46aa('0x6')]},'key':{'type':Sequelize[_0x46aa('0x6')]},'keyType':{'type':Sequelize[_0x46aa('0x1')](_0x46aa('0x2'),_0x46aa('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x46aa('0x6')]},'idField':{'type':Sequelize[_0x46aa('0x6')]},'nameField':{'type':Sequelize[_0x46aa('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x46aa('0x6')]}}; \ No newline at end of file +var _0x4c7e=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x156ee8,_0x53bb36){var _0x18db8a=function(_0x6e41f0){while(--_0x6e41f0){_0x156ee8['push'](_0x156ee8['shift']());}};_0x18db8a(++_0x53bb36);}(_0x4c7e,0xac));var _0xe4c7=function(_0x2ccf68,_0x1d41df){_0x2ccf68=_0x2ccf68-0x0;var _0x2793f7=_0x4c7e[_0x2ccf68];return _0x2793f7;};'use strict';var Sequelize=require(_0xe4c7('0x0'));module[_0xe4c7('0x1')]={'type':{'type':Sequelize[_0xe4c7('0x2')](_0xe4c7('0x3'),_0xe4c7('0x4'),_0xe4c7('0x5'),'keyValue',_0xe4c7('0x6')),'defaultValue':_0xe4c7('0x3')},'content':{'type':Sequelize[_0xe4c7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe4c7('0x2')]('string',_0xe4c7('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe4c7('0x7')]},'nameField':{'type':Sequelize[_0xe4c7('0x7')]},'customField':{'type':Sequelize[_0xe4c7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4c7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 195d24c..589a621 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 _0xd2f5=['status','end','json','offset','limit','count','reject','save','update','destroy','then','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x46cbab,_0x1a943d){var _0x5d8f04=function(_0x227542){while(--_0x227542){_0x46cbab['push'](_0x46cbab['shift']());}};_0x5d8f04(++_0x1a943d);}(_0xd2f5,0x78));var _0x5d2f=function(_0x2073ff,_0x398943){_0x2073ff=_0x2073ff-0x0;var _0x19e7c4=_0xd2f5[_0x2073ff];return _0x19e7c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d2f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var Mustache=require(_0x5d2f('0x4'));var util=require(_0x5d2f('0x5'));var path=require(_0x5d2f('0x6'));var sox=require(_0x5d2f('0x7'));var csv=require(_0x5d2f('0x8'));var ejs=require(_0x5d2f('0x9'));var fs=require('fs');var fs_extra=require(_0x5d2f('0xa'));var _=require(_0x5d2f('0xb'));var squel=require(_0x5d2f('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d2f('0xd'));var deskjs=require(_0x5d2f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5d2f('0xf'));var Papa=require(_0x5d2f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d2f('0x11'));var hardwareService=require(_0x5d2f('0x12'));var logger=require('../../config/logger')(_0x5d2f('0x13'));var utils=require(_0x5d2f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5d2f('0x15'));var db=require(_0x5d2f('0x16'))['db'];function respondWithStatusCode(_0x6e12d6,_0x5320c9){_0x5320c9=_0x5320c9||0xcc;return function(_0x10c675){if(_0x10c675){return _0x6e12d6[_0x5d2f('0x17')](_0x5320c9);}return _0x6e12d6[_0x5d2f('0x18')](_0x5320c9)[_0x5d2f('0x19')]();};}function respondWithResult(_0x40a802,_0x53ecde){_0x53ecde=_0x53ecde||0xc8;return function(_0x22ffb3){if(_0x22ffb3){return _0x40a802['status'](_0x53ecde)[_0x5d2f('0x1a')](_0x22ffb3);}};}function respondWithFilteredResult(_0x341706,_0x31fa19){return function(_0x2bdb26){if(_0x2bdb26){var _0x2fd180=typeof _0x31fa19[_0x5d2f('0x1b')]==='undefined'&&typeof _0x31fa19[_0x5d2f('0x1c')]==='undefined';var _0xb917ff=_0x2bdb26[_0x5d2f('0x1d')];var _0x2e7d51=_0x2fd180?0x0:_0x31fa19['offset'];var _0x5736f9=_0x2fd180?_0x2bdb26[_0x5d2f('0x1d')]:_0x31fa19[_0x5d2f('0x1b')]+_0x31fa19[_0x5d2f('0x1c')];var _0x3312a6;if(_0x5736f9>=_0xb917ff){_0x5736f9=_0xb917ff;_0x3312a6=0xc8;}else{_0x3312a6=0xce;}_0x341706[_0x5d2f('0x18')](_0x3312a6);return _0x341706['set']('Content-Range',_0x2e7d51+'-'+_0x5736f9+'/'+_0xb917ff)['json'](_0x2bdb26);}return null;};}function patchUpdates(_0x416801){return function(_0x3b618a){try{jsonpatch['apply'](_0x3b618a,_0x416801,!![]);}catch(_0x4b11c7){return BPromise[_0x5d2f('0x1e')](_0x4b11c7);}return _0x3b618a[_0x5d2f('0x1f')]();};}function saveUpdates(_0x133f9d,_0x41cc56){return function(_0x4d3b89){if(_0x4d3b89){return _0x4d3b89[_0x5d2f('0x20')](_0x133f9d)['then'](function(_0x43e892){return _0x43e892;});}return null;};}function removeEntity(_0x1dde52,_0x4a93dd){return function(_0x5833a8){if(_0x5833a8){return _0x5833a8[_0x5d2f('0x21')]()[_0x5d2f('0x22')](function(){_0x1dde52[_0x5d2f('0x18')](0xcc)[_0x5d2f('0x19')]();});}};}function handleEntityNotFound(_0x2df381,_0xa1a337){return function(_0x74dbf5){if(!_0x74dbf5){_0x2df381[_0x5d2f('0x17')](0x194);}return _0x74dbf5;};}function handleError(_0x3f0712,_0x22a813){_0x22a813=_0x22a813||0x1f4;return function(_0x4e028f){logger['error'](_0x4e028f[_0x5d2f('0x23')]);if(_0x4e028f['name']){delete _0x4e028f[_0x5d2f('0x24')];}_0x3f0712[_0x5d2f('0x18')](_0x22a813)[_0x5d2f('0x25')](_0x4e028f);};}exports[_0x5d2f('0x26')]=function(_0x40533e,_0x3e38c0){var _0x25de14={},_0x9c27e3={},_0x2f4458={'count':0x0,'rows':[]};var _0x245460=_[_0x5d2f('0x27')](db[_0x5d2f('0x28')][_0x5d2f('0x29')],function(_0x2c253b){return{'name':_0x2c253b[_0x5d2f('0x2a')],'type':_0x2c253b[_0x5d2f('0x2b')][_0x5d2f('0x2c')]};});_0x9c27e3[_0x5d2f('0x2d')]=_[_0x5d2f('0x27')](_0x245460,_0x5d2f('0x24'));_0x9c27e3[_0x5d2f('0x2e')]=_[_0x5d2f('0x2f')](_0x40533e['query']);_0x9c27e3['filters']=_['intersection'](_0x9c27e3[_0x5d2f('0x2d')],_0x9c27e3['query']);_0x25de14[_0x5d2f('0x30')]=_[_0x5d2f('0x31')](_0x9c27e3[_0x5d2f('0x2d')],qs[_0x5d2f('0x32')](_0x40533e[_0x5d2f('0x2e')]['fields']));_0x25de14[_0x5d2f('0x30')]=_0x25de14[_0x5d2f('0x30')][_0x5d2f('0x33')]?_0x25de14['attributes']:_0x9c27e3[_0x5d2f('0x2d')];if(!_0x40533e[_0x5d2f('0x2e')][_0x5d2f('0x34')](_0x5d2f('0x35'))){_0x25de14[_0x5d2f('0x1c')]=qs[_0x5d2f('0x1c')](_0x40533e[_0x5d2f('0x2e')][_0x5d2f('0x1c')]);_0x25de14['offset']=qs['offset'](_0x40533e[_0x5d2f('0x2e')][_0x5d2f('0x1b')]);}_0x25de14[_0x5d2f('0x36')]=qs[_0x5d2f('0x37')](_0x40533e[_0x5d2f('0x2e')]['sort']);_0x25de14[_0x5d2f('0x38')]=qs['filters'](_[_0x5d2f('0x39')](_0x40533e[_0x5d2f('0x2e')],_0x9c27e3['filters']),_0x245460);if(_0x40533e['query']['filter']){_0x25de14['where']=_['merge'](_0x25de14[_0x5d2f('0x38')],{'$or':_[_0x5d2f('0x27')](_0x245460,function(_0x29c8f1){if(_0x29c8f1['type']!==_0x5d2f('0x3a')){var _0xc34d9c={};_0xc34d9c[_0x29c8f1[_0x5d2f('0x24')]]={'$like':'%'+_0x40533e[_0x5d2f('0x2e')]['filter']+'%'};return _0xc34d9c;}})});}_0x25de14=_[_0x5d2f('0x3b')]({},_0x25de14,_0x40533e[_0x5d2f('0x3c')]);var _0x195353={'where':_0x25de14[_0x5d2f('0x38')]};return db[_0x5d2f('0x28')][_0x5d2f('0x1d')](_0x195353)[_0x5d2f('0x22')](function(_0x4a35aa){_0x2f4458['count']=_0x4a35aa;if(_0x40533e[_0x5d2f('0x2e')][_0x5d2f('0x3d')]){_0x25de14[_0x5d2f('0x3e')]=[{'all':!![]}];}return db[_0x5d2f('0x28')][_0x5d2f('0x3f')](_0x25de14);})[_0x5d2f('0x22')](function(_0x4e462e){_0x2f4458[_0x5d2f('0x40')]=_0x4e462e;return _0x2f4458;})[_0x5d2f('0x22')](respondWithFilteredResult(_0x3e38c0,_0x25de14))[_0x5d2f('0x41')](handleError(_0x3e38c0,null));};exports[_0x5d2f('0x42')]=function(_0x1db576,_0x6d9782){var _0x3a6398={'raw':!![],'where':{'id':_0x1db576[_0x5d2f('0x43')]['id']}},_0x30e0de={};_0x30e0de['model']=_[_0x5d2f('0x2f')](db['ServicenowField'][_0x5d2f('0x29')]);_0x30e0de[_0x5d2f('0x2e')]=_['keys'](_0x1db576['query']);_0x30e0de[_0x5d2f('0x44')]=_[_0x5d2f('0x31')](_0x30e0de['model'],_0x30e0de[_0x5d2f('0x2e')]);_0x3a6398[_0x5d2f('0x30')]=_[_0x5d2f('0x31')](_0x30e0de[_0x5d2f('0x2d')],qs[_0x5d2f('0x32')](_0x1db576[_0x5d2f('0x2e')][_0x5d2f('0x32')]));_0x3a6398[_0x5d2f('0x30')]=_0x3a6398[_0x5d2f('0x30')][_0x5d2f('0x33')]?_0x3a6398['attributes']:_0x30e0de['model'];if(_0x1db576[_0x5d2f('0x2e')][_0x5d2f('0x3d')]){_0x3a6398[_0x5d2f('0x3e')]=[{'all':!![]}];}_0x3a6398=_['merge']({},_0x3a6398,_0x1db576['options']);return db[_0x5d2f('0x28')][_0x5d2f('0x45')](_0x3a6398)[_0x5d2f('0x22')](handleEntityNotFound(_0x6d9782,null))[_0x5d2f('0x22')](respondWithResult(_0x6d9782,null))[_0x5d2f('0x41')](handleError(_0x6d9782,null));};exports[_0x5d2f('0x46')]=function(_0x22790b,_0x1a5d84){return db[_0x5d2f('0x28')][_0x5d2f('0x46')](_0x22790b[_0x5d2f('0x47')],{})['then'](respondWithResult(_0x1a5d84,0xc9))[_0x5d2f('0x41')](handleError(_0x1a5d84,null));};exports[_0x5d2f('0x20')]=function(_0x2889ec,_0x5a2903){if(_0x2889ec['body']['id']){delete _0x2889ec[_0x5d2f('0x47')]['id'];}return db[_0x5d2f('0x28')][_0x5d2f('0x45')]({'where':{'id':_0x2889ec[_0x5d2f('0x43')]['id']}})[_0x5d2f('0x22')](handleEntityNotFound(_0x5a2903,null))[_0x5d2f('0x22')](saveUpdates(_0x2889ec['body'],null))[_0x5d2f('0x22')](respondWithResult(_0x5a2903,null))['catch'](handleError(_0x5a2903,null));};exports[_0x5d2f('0x21')]=function(_0xfe2cad,_0x4b399a){return db['ServicenowField'][_0x5d2f('0x45')]({'where':{'id':_0xfe2cad[_0x5d2f('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b399a,null))[_0x5d2f('0x22')](removeEntity(_0x4b399a,null))[_0x5d2f('0x41')](handleError(_0x4b399a,null));}; \ No newline at end of file +var _0x7b0c=['keys','find','create','body','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x5c8097,_0x4a26c2){var _0x590a3a=function(_0x387fff){while(--_0x387fff){_0x5c8097['push'](_0x5c8097['shift']());}};_0x590a3a(++_0x4a26c2);}(_0x7b0c,0x11e));var _0xc7b0=function(_0xd04329,_0x25bfba){_0xd04329=_0xd04329-0x0;var _0xbcc9c0=_0x7b0c[_0xd04329];return _0xbcc9c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7b0('0x0'));var zipdir=require(_0xc7b0('0x1'));var jsonpatch=require(_0xc7b0('0x2'));var rp=require(_0xc7b0('0x3'));var moment=require(_0xc7b0('0x4'));var BPromise=require(_0xc7b0('0x5'));var Mustache=require(_0xc7b0('0x6'));var util=require(_0xc7b0('0x7'));var path=require(_0xc7b0('0x8'));var sox=require(_0xc7b0('0x9'));var csv=require(_0xc7b0('0xa'));var ejs=require(_0xc7b0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc7b0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc7b0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc7b0('0xd'));var qs=require(_0xc7b0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7b0('0xf'));var logger=require(_0xc7b0('0x10'))('api');var utils=require(_0xc7b0('0x11'));var config=require(_0xc7b0('0x12'));var licenseUtil=require(_0xc7b0('0x13'));var db=require(_0xc7b0('0x14'))['db'];function respondWithStatusCode(_0x1ac24c,_0x1acc94){_0x1acc94=_0x1acc94||0xcc;return function(_0x17a493){if(_0x17a493){return _0x1ac24c[_0xc7b0('0x15')](_0x1acc94);}return _0x1ac24c[_0xc7b0('0x16')](_0x1acc94)[_0xc7b0('0x17')]();};}function respondWithResult(_0x1c86b4,_0x390b6c){_0x390b6c=_0x390b6c||0xc8;return function(_0x519d5b){if(_0x519d5b){return _0x1c86b4[_0xc7b0('0x16')](_0x390b6c)['json'](_0x519d5b);}};}function respondWithFilteredResult(_0xa9da6,_0x3911f1){return function(_0x1f57c4){if(_0x1f57c4){var _0x2220f5=typeof _0x3911f1[_0xc7b0('0x18')]===_0xc7b0('0x19')&&typeof _0x3911f1[_0xc7b0('0x1a')]==='undefined';var _0x242b48=_0x1f57c4[_0xc7b0('0x1b')];var _0x4e78c3=_0x2220f5?0x0:_0x3911f1[_0xc7b0('0x18')];var _0x2e6376=_0x2220f5?_0x1f57c4[_0xc7b0('0x1b')]:_0x3911f1[_0xc7b0('0x18')]+_0x3911f1[_0xc7b0('0x1a')];var _0x31d062;if(_0x2e6376>=_0x242b48){_0x2e6376=_0x242b48;_0x31d062=0xc8;}else{_0x31d062=0xce;}_0xa9da6[_0xc7b0('0x16')](_0x31d062);return _0xa9da6['set']('Content-Range',_0x4e78c3+'-'+_0x2e6376+'/'+_0x242b48)['json'](_0x1f57c4);}return null;};}function patchUpdates(_0x22cb1a){return function(_0x3fdfd5){try{jsonpatch[_0xc7b0('0x1c')](_0x3fdfd5,_0x22cb1a,!![]);}catch(_0x13e3ad){return BPromise['reject'](_0x13e3ad);}return _0x3fdfd5[_0xc7b0('0x1d')]();};}function saveUpdates(_0x459806,_0x4d15e1){return function(_0x1dd523){if(_0x1dd523){return _0x1dd523[_0xc7b0('0x1e')](_0x459806)[_0xc7b0('0x1f')](function(_0x383045){return _0x383045;});}return null;};}function removeEntity(_0x4744dd,_0x1e0153){return function(_0x4cc83a){if(_0x4cc83a){return _0x4cc83a[_0xc7b0('0x20')]()[_0xc7b0('0x1f')](function(){_0x4744dd[_0xc7b0('0x16')](0xcc)[_0xc7b0('0x17')]();});}};}function handleEntityNotFound(_0x1fb9df,_0x3ebb54){return function(_0x5a664f){if(!_0x5a664f){_0x1fb9df['sendStatus'](0x194);}return _0x5a664f;};}function handleError(_0x3dab2a,_0x5391ac){_0x5391ac=_0x5391ac||0x1f4;return function(_0x5d76d8){logger[_0xc7b0('0x21')](_0x5d76d8[_0xc7b0('0x22')]);if(_0x5d76d8[_0xc7b0('0x23')]){delete _0x5d76d8['name'];}_0x3dab2a[_0xc7b0('0x16')](_0x5391ac)[_0xc7b0('0x24')](_0x5d76d8);};}exports[_0xc7b0('0x25')]=function(_0x42267e,_0xe28f58){var _0x81f55d={},_0x4661bd={},_0x2554af={'count':0x0,'rows':[]};var _0xe2192b=_[_0xc7b0('0x26')](db[_0xc7b0('0x27')][_0xc7b0('0x28')],function(_0xe65017){return{'name':_0xe65017[_0xc7b0('0x29')],'type':_0xe65017['type'][_0xc7b0('0x2a')]};});_0x4661bd[_0xc7b0('0x2b')]=_[_0xc7b0('0x26')](_0xe2192b,_0xc7b0('0x23'));_0x4661bd[_0xc7b0('0x2c')]=_['keys'](_0x42267e['query']);_0x4661bd[_0xc7b0('0x2d')]=_[_0xc7b0('0x2e')](_0x4661bd['model'],_0x4661bd['query']);_0x81f55d[_0xc7b0('0x2f')]=_['intersection'](_0x4661bd[_0xc7b0('0x2b')],qs[_0xc7b0('0x30')](_0x42267e[_0xc7b0('0x2c')][_0xc7b0('0x30')]));_0x81f55d[_0xc7b0('0x2f')]=_0x81f55d[_0xc7b0('0x2f')][_0xc7b0('0x31')]?_0x81f55d[_0xc7b0('0x2f')]:_0x4661bd[_0xc7b0('0x2b')];if(!_0x42267e[_0xc7b0('0x2c')]['hasOwnProperty'](_0xc7b0('0x32'))){_0x81f55d['limit']=qs[_0xc7b0('0x1a')](_0x42267e[_0xc7b0('0x2c')]['limit']);_0x81f55d[_0xc7b0('0x18')]=qs[_0xc7b0('0x18')](_0x42267e['query'][_0xc7b0('0x18')]);}_0x81f55d['order']=qs[_0xc7b0('0x33')](_0x42267e[_0xc7b0('0x2c')][_0xc7b0('0x33')]);_0x81f55d['where']=qs[_0xc7b0('0x2d')](_[_0xc7b0('0x34')](_0x42267e[_0xc7b0('0x2c')],_0x4661bd[_0xc7b0('0x2d')]),_0xe2192b);if(_0x42267e[_0xc7b0('0x2c')][_0xc7b0('0x35')]){_0x81f55d[_0xc7b0('0x36')]=_[_0xc7b0('0x37')](_0x81f55d[_0xc7b0('0x36')],{'$or':_[_0xc7b0('0x26')](_0xe2192b,function(_0x268274){if(_0x268274[_0xc7b0('0x38')]!==_0xc7b0('0x39')){var _0x4a5aa1={};_0x4a5aa1[_0x268274['name']]={'$like':'%'+_0x42267e['query'][_0xc7b0('0x35')]+'%'};return _0x4a5aa1;}})});}_0x81f55d=_[_0xc7b0('0x37')]({},_0x81f55d,_0x42267e[_0xc7b0('0x3a')]);var _0x33daf6={'where':_0x81f55d['where']};return db[_0xc7b0('0x27')][_0xc7b0('0x1b')](_0x33daf6)['then'](function(_0xa05e65){_0x2554af[_0xc7b0('0x1b')]=_0xa05e65;if(_0x42267e[_0xc7b0('0x2c')][_0xc7b0('0x3b')]){_0x81f55d[_0xc7b0('0x3c')]=[{'all':!![]}];}return db[_0xc7b0('0x27')][_0xc7b0('0x3d')](_0x81f55d);})['then'](function(_0x362df2){_0x2554af[_0xc7b0('0x3e')]=_0x362df2;return _0x2554af;})[_0xc7b0('0x1f')](respondWithFilteredResult(_0xe28f58,_0x81f55d))['catch'](handleError(_0xe28f58,null));};exports[_0xc7b0('0x3f')]=function(_0x5007ee,_0x331960){var _0x4e22e3={'raw':!![],'where':{'id':_0x5007ee['params']['id']}},_0x1aaa05={};_0x1aaa05['model']=_[_0xc7b0('0x40')](db['ServicenowField'][_0xc7b0('0x28')]);_0x1aaa05['query']=_[_0xc7b0('0x40')](_0x5007ee[_0xc7b0('0x2c')]);_0x1aaa05[_0xc7b0('0x2d')]=_[_0xc7b0('0x2e')](_0x1aaa05['model'],_0x1aaa05['query']);_0x4e22e3[_0xc7b0('0x2f')]=_[_0xc7b0('0x2e')](_0x1aaa05[_0xc7b0('0x2b')],qs[_0xc7b0('0x30')](_0x5007ee['query'][_0xc7b0('0x30')]));_0x4e22e3[_0xc7b0('0x2f')]=_0x4e22e3[_0xc7b0('0x2f')][_0xc7b0('0x31')]?_0x4e22e3[_0xc7b0('0x2f')]:_0x1aaa05['model'];if(_0x5007ee[_0xc7b0('0x2c')][_0xc7b0('0x3b')]){_0x4e22e3[_0xc7b0('0x3c')]=[{'all':!![]}];}_0x4e22e3=_[_0xc7b0('0x37')]({},_0x4e22e3,_0x5007ee[_0xc7b0('0x3a')]);return db['ServicenowField'][_0xc7b0('0x41')](_0x4e22e3)[_0xc7b0('0x1f')](handleEntityNotFound(_0x331960,null))[_0xc7b0('0x1f')](respondWithResult(_0x331960,null))['catch'](handleError(_0x331960,null));};exports[_0xc7b0('0x42')]=function(_0x40b55a,_0x1ffc33){return db[_0xc7b0('0x27')][_0xc7b0('0x42')](_0x40b55a[_0xc7b0('0x43')],{})[_0xc7b0('0x1f')](respondWithResult(_0x1ffc33,0xc9))[_0xc7b0('0x44')](handleError(_0x1ffc33,null));};exports[_0xc7b0('0x1e')]=function(_0x1bed3a,_0x274e49){if(_0x1bed3a[_0xc7b0('0x43')]['id']){delete _0x1bed3a[_0xc7b0('0x43')]['id'];}return db['ServicenowField'][_0xc7b0('0x41')]({'where':{'id':_0x1bed3a[_0xc7b0('0x45')]['id']}})[_0xc7b0('0x1f')](handleEntityNotFound(_0x274e49,null))[_0xc7b0('0x1f')](saveUpdates(_0x1bed3a[_0xc7b0('0x43')],null))[_0xc7b0('0x1f')](respondWithResult(_0x274e49,null))[_0xc7b0('0x44')](handleError(_0x274e49,null));};exports[_0xc7b0('0x20')]=function(_0x53b420,_0x3b8093){return db[_0xc7b0('0x27')]['find']({'where':{'id':_0x53b420[_0xc7b0('0x45')]['id']}})[_0xc7b0('0x1f')](handleEntityNotFound(_0x3b8093,null))[_0xc7b0('0x1f')](removeEntity(_0x3b8093,null))[_0xc7b0('0x44')](handleError(_0x3b8093,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index afb769f..453c3fb 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 _0x0fe4=['./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x598d67,_0x16e458){var _0x193f53=function(_0xe66ed6){while(--_0xe66ed6){_0x598d67['push'](_0x598d67['shift']());}};_0x193f53(++_0x16e458);}(_0x0fe4,0x172));var _0x40fe=function(_0xf19b15,_0x4f36ca){_0xf19b15=_0xf19b15-0x0;var _0x112420=_0x0fe4[_0xf19b15];return _0x112420;};'use strict';var _=require('lodash');var util=require(_0x40fe('0x0'));var logger=require(_0x40fe('0x1'))(_0x40fe('0x2'));var moment=require(_0x40fe('0x3'));var BPromise=require(_0x40fe('0x4'));var rp=require(_0x40fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40fe('0x6'));var config=require('../../config/environment');var attributes=require(_0x40fe('0x7'));module['exports']=function(_0x41d7d0,_0x1e3e47){return _0x41d7d0['define'](_0x40fe('0x8'),attributes,{'tableName':_0x40fe('0x9'),'paranoid':![],'indexes':[{'name':_0x40fe('0xa'),'fields':[_0x40fe('0xb'),_0x40fe('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xceb9=['define','servicenow_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x220c7e,_0x41de2b){var _0xb56e6a=function(_0xcf9303){while(--_0xcf9303){_0x220c7e['push'](_0x220c7e['shift']());}};_0xb56e6a(++_0x41de2b);}(_0xceb9,0x144));var _0x9ceb=function(_0x5c0211,_0x373f42){_0x5c0211=_0x5c0211-0x0;var _0x70d7a6=_0xceb9[_0x5c0211];return _0x70d7a6;};'use strict';var _=require(_0x9ceb('0x0'));var util=require(_0x9ceb('0x1'));var logger=require(_0x9ceb('0x2'))(_0x9ceb('0x3'));var moment=require(_0x9ceb('0x4'));var BPromise=require(_0x9ceb('0x5'));var rp=require(_0x9ceb('0x6'));var fs=require('fs');var path=require(_0x9ceb('0x7'));var rimraf=require(_0x9ceb('0x8'));var config=require(_0x9ceb('0x9'));var attributes=require(_0x9ceb('0xa'));module[_0x9ceb('0xb')]=function(_0x2c5fa4,_0x3ff258){return _0x2c5fa4[_0x9ceb('0xc')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x9ceb('0xd'),'fields':['idField','FieldId'],'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 6b43fa4..3a4d5bc 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x52943f,_0x458fbf){var _0x245bf1=function(_0x3f2c6a){while(--_0x3f2c6a){_0x52943f['push'](_0x52943f['shift']());}};_0x245bf1(++_0x458fbf);}(_0xe706,0xa3));var _0x6e70=function(_0x4193fc,_0x2b7bf5){_0x4193fc=_0x4193fc-0x0;var _0x541099=_0xe706[_0x4193fc];return _0x541099;};'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']('ServicenowField,\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']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2e3dd1,_0x49e26a){var _0x53c44a=function(_0x1c29a7){while(--_0x1c29a7){_0x2e3dd1['push'](_0x2e3dd1['shift']());}};_0x53c44a(++_0x49e26a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3cd31f,_0x524bd2){_0x3cd31f=_0x3cd31f-0x0;var _0x3649e5=_0xb43b[_0x3cd31f];return _0x3649e5;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7580d6c..79bc9d1 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(_0x2f568f,_0x3a43fa){var _0x5b9c94=function(_0x1760ef){while(--_0x1760ef){_0x2f568f['push'](_0x2f568f['shift']());}};_0x5b9c94(++_0x3a43fa);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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(_0x5a51c1,_0x394c67){var _0x38f5fb=function(_0xa5d3d0){while(--_0xa5d3d0){_0x5a51c1['push'](_0x5a51c1['shift']());}};_0x38f5fb(++_0x394c67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 eb42c4d..b624de6 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(_0x3c0890,_0x568fb2){var _0x3356d5=function(_0x2a1eac){while(--_0x2a1eac){_0x3c0890['push'](_0x3c0890['shift']());}};_0x3356d5(++_0x568fb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x4c1174,_0x57eecf){var _0x3a67d0=function(_0x3d3721){while(--_0x3d3721){_0x4c1174['push'](_0x4c1174['shift']());}};_0x3a67d0(++_0x57eecf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 840972e..0b8693e 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 _0xb132=['destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmAccount','count','includeAll','include','findAll','rows','keys','fields','options','find','catch','create','body','update','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','login','JSON','stringify','POST','%s%s','get_module_fields','Calls','values','module_fields','remove','label','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save'];(function(_0x26a0c8,_0xc39418){var _0x59448b=function(_0x5e9541){while(--_0x5e9541){_0x26a0c8['push'](_0x26a0c8['shift']());}};_0x59448b(++_0xc39418);}(_0xb132,0x140));var _0x2b13=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xb132[_0x59d0cc];return _0x2ae79f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2b13('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b13('0x1'));var moment=require(_0x2b13('0x2'));var BPromise=require(_0x2b13('0x3'));var Mustache=require(_0x2b13('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2b13('0x5'));var csv=require('to-csv');var ejs=require(_0x2b13('0x6'));var fs=require('fs');var fs_extra=require(_0x2b13('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b13('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x2b13('0x9'));var toCsv=require(_0x2b13('0xa'));var querystring=require(_0x2b13('0xb'));var Papa=require(_0x2b13('0xc'));var Redis=require(_0x2b13('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b13('0xe'))('api');var utils=require(_0x2b13('0xf'));var config=require(_0x2b13('0x10'));var licenseUtil=require(_0x2b13('0x11'));var db=require(_0x2b13('0x12'))['db'];var integrations=require(_0x2b13('0x13'));function respondWithStatusCode(_0x4511c6,_0x4aa57b){_0x4aa57b=_0x4aa57b||0xcc;return function(_0x5d1234){if(_0x5d1234){return _0x4511c6['sendStatus'](_0x4aa57b);}return _0x4511c6[_0x2b13('0x14')](_0x4aa57b)[_0x2b13('0x15')]();};}function respondWithResult(_0x564307,_0x2ace3d){_0x2ace3d=_0x2ace3d||0xc8;return function(_0x11f1e1){if(_0x11f1e1){return _0x564307[_0x2b13('0x14')](_0x2ace3d)[_0x2b13('0x16')](_0x11f1e1);}};}function respondWithFilteredResult(_0x37948b,_0x467028){return function(_0x15be75){if(_0x15be75){var _0x3deb33=typeof _0x467028['offset']==='undefined'&&typeof _0x467028[_0x2b13('0x17')]===_0x2b13('0x18');var _0x334866=_0x15be75['count'];var _0x427c20=_0x3deb33?0x0:_0x467028['offset'];var _0x4662cd=_0x3deb33?_0x15be75['count']:_0x467028[_0x2b13('0x19')]+_0x467028['limit'];var _0x5dd72c;if(_0x4662cd>=_0x334866){_0x4662cd=_0x334866;_0x5dd72c=0xc8;}else{_0x5dd72c=0xce;}_0x37948b[_0x2b13('0x14')](_0x5dd72c);return _0x37948b[_0x2b13('0x1a')](_0x2b13('0x1b'),_0x427c20+'-'+_0x4662cd+'/'+_0x334866)['json'](_0x15be75);}return null;};}function patchUpdates(_0x40d9aa){return function(_0x337e9e){try{jsonpatch[_0x2b13('0x1c')](_0x337e9e,_0x40d9aa,!![]);}catch(_0x2c1413){return BPromise[_0x2b13('0x1d')](_0x2c1413);}return _0x337e9e[_0x2b13('0x1e')]();};}function saveUpdates(_0x2e661f,_0x2b1d73){return function(_0x1b2734){if(_0x1b2734){return _0x1b2734['update'](_0x2e661f)['then'](function(_0x31665b){return _0x31665b;});}return null;};}function removeEntity(_0x548b8c,_0x2f4686){return function(_0x2e57fe){if(_0x2e57fe){return _0x2e57fe[_0x2b13('0x1f')]()[_0x2b13('0x20')](function(){_0x548b8c[_0x2b13('0x14')](0xcc)[_0x2b13('0x15')]();});}};}function handleEntityNotFound(_0x460aea,_0x926cbc){return function(_0x327b10){if(!_0x327b10){_0x460aea[_0x2b13('0x21')](0x194);}return _0x327b10;};}function handleError(_0x1f190a,_0xef5ac8){_0xef5ac8=_0xef5ac8||0x1f4;return function(_0x3e83e3){logger[_0x2b13('0x22')](_0x3e83e3[_0x2b13('0x23')]);if(_0x3e83e3[_0x2b13('0x24')]){delete _0x3e83e3[_0x2b13('0x24')];}_0x1f190a[_0x2b13('0x14')](_0xef5ac8)[_0x2b13('0x25')](_0x3e83e3);};}exports[_0x2b13('0x26')]=function(_0x352d46,_0x3588c5){var _0x17d0d4={},_0x392ca4={},_0x4a24f7={'count':0x0,'rows':[]};var _0x15d25a=_[_0x2b13('0x27')](db['SugarcrmAccount'][_0x2b13('0x28')],function(_0x5780b0){return{'name':_0x5780b0[_0x2b13('0x29')],'type':_0x5780b0['type'][_0x2b13('0x2a')]};});_0x392ca4[_0x2b13('0x2b')]=_['map'](_0x15d25a,_0x2b13('0x24'));_0x392ca4[_0x2b13('0x2c')]=_['keys'](_0x352d46[_0x2b13('0x2c')]);_0x392ca4[_0x2b13('0x2d')]=_[_0x2b13('0x2e')](_0x392ca4[_0x2b13('0x2b')],_0x392ca4[_0x2b13('0x2c')]);_0x17d0d4[_0x2b13('0x2f')]=_[_0x2b13('0x2e')](_0x392ca4[_0x2b13('0x2b')],qs['fields'](_0x352d46[_0x2b13('0x2c')]['fields']));_0x17d0d4[_0x2b13('0x2f')]=_0x17d0d4['attributes'][_0x2b13('0x30')]?_0x17d0d4[_0x2b13('0x2f')]:_0x392ca4[_0x2b13('0x2b')];if(!_0x352d46['query'][_0x2b13('0x31')](_0x2b13('0x32'))){_0x17d0d4[_0x2b13('0x17')]=qs['limit'](_0x352d46[_0x2b13('0x2c')][_0x2b13('0x17')]);_0x17d0d4[_0x2b13('0x19')]=qs[_0x2b13('0x19')](_0x352d46['query'][_0x2b13('0x19')]);}_0x17d0d4[_0x2b13('0x33')]=qs[_0x2b13('0x34')](_0x352d46[_0x2b13('0x2c')][_0x2b13('0x34')]);_0x17d0d4[_0x2b13('0x35')]=qs['filters'](_[_0x2b13('0x36')](_0x352d46[_0x2b13('0x2c')],_0x392ca4[_0x2b13('0x2d')]),_0x15d25a);if(_0x352d46[_0x2b13('0x2c')][_0x2b13('0x37')]){_0x17d0d4[_0x2b13('0x35')]=_[_0x2b13('0x38')](_0x17d0d4[_0x2b13('0x35')],{'$or':_['map'](_0x15d25a,function(_0x7e5b10){if(_0x7e5b10['type']!==_0x2b13('0x39')){var _0x18a6cb={};_0x18a6cb[_0x7e5b10[_0x2b13('0x24')]]={'$like':'%'+_0x352d46[_0x2b13('0x2c')]['filter']+'%'};return _0x18a6cb;}})});}_0x17d0d4=_[_0x2b13('0x38')]({},_0x17d0d4,_0x352d46['options']);var _0x22b4dd={'where':_0x17d0d4[_0x2b13('0x35')]};return db[_0x2b13('0x3a')][_0x2b13('0x3b')](_0x22b4dd)[_0x2b13('0x20')](function(_0x3dd571){_0x4a24f7[_0x2b13('0x3b')]=_0x3dd571;if(_0x352d46[_0x2b13('0x2c')][_0x2b13('0x3c')]){_0x17d0d4[_0x2b13('0x3d')]=[{'all':!![]}];}return db[_0x2b13('0x3a')][_0x2b13('0x3e')](_0x17d0d4);})[_0x2b13('0x20')](function(_0xdb3749){_0x4a24f7[_0x2b13('0x3f')]=_0xdb3749;return _0x4a24f7;})[_0x2b13('0x20')](respondWithFilteredResult(_0x3588c5,_0x17d0d4))['catch'](handleError(_0x3588c5,null));};exports['show']=function(_0x2ed5c4,_0x1f0953){var _0x205a09={'raw':![],'where':{'id':_0x2ed5c4['params']['id']}},_0x214b8b={};_0x214b8b['model']=_['keys'](db[_0x2b13('0x3a')]['rawAttributes']);_0x214b8b[_0x2b13('0x2c')]=_[_0x2b13('0x40')](_0x2ed5c4[_0x2b13('0x2c')]);_0x214b8b['filters']=_[_0x2b13('0x2e')](_0x214b8b[_0x2b13('0x2b')],_0x214b8b[_0x2b13('0x2c')]);_0x205a09[_0x2b13('0x2f')]=_['intersection'](_0x214b8b[_0x2b13('0x2b')],qs[_0x2b13('0x41')](_0x2ed5c4[_0x2b13('0x2c')]['fields']));_0x205a09[_0x2b13('0x2f')]=_0x205a09['attributes'][_0x2b13('0x30')]?_0x205a09[_0x2b13('0x2f')]:_0x214b8b[_0x2b13('0x2b')];if(_0x2ed5c4['query']['includeAll']){_0x205a09['include']=[{'all':!![]}];}_0x205a09=_['merge']({},_0x205a09,_0x2ed5c4[_0x2b13('0x42')]);return db['SugarcrmAccount'][_0x2b13('0x43')](_0x205a09)[_0x2b13('0x20')](handleEntityNotFound(_0x1f0953,null))['then'](respondWithResult(_0x1f0953,null))[_0x2b13('0x44')](handleError(_0x1f0953,null));};exports[_0x2b13('0x45')]=function(_0x2d17a0,_0x22801d){return db[_0x2b13('0x3a')]['create'](_0x2d17a0[_0x2b13('0x46')],{})[_0x2b13('0x20')](respondWithResult(_0x22801d,0xc9))[_0x2b13('0x44')](handleError(_0x22801d,null));};exports[_0x2b13('0x47')]=function(_0x59a49a,_0xff37a3){if(_0x59a49a[_0x2b13('0x46')]['id']){delete _0x59a49a[_0x2b13('0x46')]['id'];}return db[_0x2b13('0x3a')][_0x2b13('0x43')]({'where':{'id':_0x59a49a[_0x2b13('0x48')]['id']}})['then'](handleEntityNotFound(_0xff37a3,null))['then'](saveUpdates(_0x59a49a['body'],null))[_0x2b13('0x20')](respondWithResult(_0xff37a3,null))['catch'](handleError(_0xff37a3,null));};exports[_0x2b13('0x1f')]=function(_0xf4e71d,_0xe44e8d){return db[_0x2b13('0x3a')][_0x2b13('0x43')]({'where':{'id':_0xf4e71d[_0x2b13('0x48')]['id']}})[_0x2b13('0x20')](handleEntityNotFound(_0xe44e8d,null))[_0x2b13('0x20')](removeEntity(_0xe44e8d,null))[_0x2b13('0x44')](handleError(_0xe44e8d,null));};exports[_0x2b13('0x49')]=function(_0x1acc9b,_0x2ec238,_0x74c5c5){var _0x2e1fe0={};var _0x30bdc3={};var _0x3d2972;var _0x5d217f;return db[_0x2b13('0x3a')][_0x2b13('0x4a')]({'where':{'id':_0x1acc9b[_0x2b13('0x48')]['id']}})['then'](handleEntityNotFound(_0x2ec238,null))['then'](function(_0x498415){if(_0x498415){_0x3d2972=_0x498415;_0x30bdc3['model']=_[_0x2b13('0x40')](db[_0x2b13('0x4b')]['rawAttributes']);_0x30bdc3[_0x2b13('0x2c')]=_[_0x2b13('0x40')](_0x1acc9b[_0x2b13('0x2c')]);_0x30bdc3[_0x2b13('0x2d')]=_[_0x2b13('0x2e')](_0x30bdc3[_0x2b13('0x2b')],_0x30bdc3['query']);_0x2e1fe0[_0x2b13('0x2f')]=_['intersection'](_0x30bdc3[_0x2b13('0x2b')],qs['fields'](_0x1acc9b[_0x2b13('0x2c')][_0x2b13('0x41')]));_0x2e1fe0[_0x2b13('0x2f')]=_0x2e1fe0[_0x2b13('0x2f')][_0x2b13('0x30')]?_0x2e1fe0['attributes']:_0x30bdc3[_0x2b13('0x2b')];_0x2e1fe0[_0x2b13('0x33')]=qs[_0x2b13('0x34')](_0x1acc9b[_0x2b13('0x2c')]['sort']);_0x2e1fe0['where']=qs[_0x2b13('0x2d')](_[_0x2b13('0x36')](_0x1acc9b[_0x2b13('0x2c')],_0x30bdc3[_0x2b13('0x2d')]));if(_0x1acc9b[_0x2b13('0x2c')]['filter']){_0x2e1fe0[_0x2b13('0x35')]=_['merge'](_0x2e1fe0[_0x2b13('0x35')],{'$or':_['map'](_0x2e1fe0[_0x2b13('0x2f')],function(_0x2ac244){var _0x222250={};_0x222250[_0x2ac244]={'$like':'%'+_0x1acc9b[_0x2b13('0x2c')][_0x2b13('0x37')]+'%'};return _0x222250;})});}_0x2e1fe0=_[_0x2b13('0x38')]({},_0x2e1fe0,_0x1acc9b[_0x2b13('0x42')]);return _0x3d2972[_0x2b13('0x49')](_0x2e1fe0);}})[_0x2b13('0x20')](function(_0x388f4d){if(_0x388f4d){_0x5d217f=_0x388f4d['length'];if(!_0x1acc9b[_0x2b13('0x2c')][_0x2b13('0x31')](_0x2b13('0x32'))){_0x2e1fe0[_0x2b13('0x17')]=qs[_0x2b13('0x17')](_0x1acc9b[_0x2b13('0x2c')][_0x2b13('0x17')]);_0x2e1fe0[_0x2b13('0x19')]=qs[_0x2b13('0x19')](_0x1acc9b[_0x2b13('0x2c')]['offset']);}return _0x3d2972['getConfigurations'](_0x2e1fe0);}})[_0x2b13('0x20')](function(_0x7671c){if(_0x7671c){return _0x7671c?{'count':_0x5d217f,'rows':_0x7671c}:null;}})[_0x2b13('0x20')](respondWithResult(_0x2ec238,null))[_0x2b13('0x44')](handleError(_0x2ec238,null));};exports[_0x2b13('0x4c')]=function(_0x4309c7,_0x4583ff,_0x4f7369){if(_0x4309c7['body']['id']){delete _0x4309c7['body']['id'];}return db['SugarcrmAccount'][_0x2b13('0x4a')]({'where':{'id':_0x4309c7[_0x2b13('0x48')]['id']}})[_0x2b13('0x20')](handleEntityNotFound(_0x4583ff,null))[_0x2b13('0x20')](function(_0xd8e8c){if(_0xd8e8c){_0x4309c7[_0x2b13('0x46')][_0x2b13('0x4d')]=_0xd8e8c['id'];_0x4309c7[_0x2b13('0x46')][_0x2b13('0x4e')]=integrations[_0x2b13('0x4f')](_0x4309c7[_0x2b13('0x46')][_0x2b13('0x50')],_0x4309c7[_0x2b13('0x46')][_0x2b13('0x51')]);_0x4309c7[_0x2b13('0x46')][_0x2b13('0x52')]=integrations[_0x2b13('0x53')](_0x4309c7[_0x2b13('0x46')]['channel'],_0x4309c7[_0x2b13('0x46')][_0x2b13('0x51')]);return db[_0x2b13('0x4b')][_0x2b13('0x45')](_0x4309c7[_0x2b13('0x46')],{'include':[{'model':db[_0x2b13('0x54')],'as':'Subjects'},{'model':db[_0x2b13('0x54')],'as':'Descriptions'}]});}return null;})[_0x2b13('0x20')](respondWithResult(_0x4583ff,null))[_0x2b13('0x44')](handleError(_0x4583ff,null));};exports[_0x2b13('0x55')]=function(_0x39a08e,_0x51fb11,_0x66651c){var _0x59d64c='';var _0x3f3a51=['id','name',_0x2b13('0x56'),_0x2b13('0x57'),_0x2b13('0x58'),'date_start',_0x2b13('0x59'),_0x2b13('0x5a'),'parent_id',_0x2b13('0x5b'),_0x2b13('0x5c'),_0x2b13('0x5d')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x39a08e[_0x2b13('0x48')]['id']},'attributes':['id',_0x2b13('0x5e'),_0x2b13('0x5f'),'remoteUri']})['then'](handleEntityNotFound(_0x51fb11,null))[_0x2b13('0x20')](function(_0x227c97){if(_0x227c97){_0x59d64c=_0x227c97['remoteUri'];var _0x59013d=_0x59d64c[_0x2b13('0x60')](-0x1);if(_0x59013d==='/'){_0x59d64c=_0x59d64c[_0x2b13('0x61')](0x0,_0x59d64c[_0x2b13('0x62')](_0x59013d));}return rp({'method':'POST','uri':util[_0x2b13('0x63')]('%s%s',_0x59d64c,_0x2b13('0x64')),'json':!![],'form':{'method':_0x2b13('0x65'),'input_type':_0x2b13('0x66'),'response_type':'JSON','rest_data':JSON[_0x2b13('0x67')]({'user_auth':{'user_name':_0x227c97[_0x2b13('0x5e')],'password':_0x227c97['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x2b13('0x20')](function(_0xb6dfcf){if(_0xb6dfcf&&_0xb6dfcf['name']!=='Invalid\x20Login'&&_0xb6dfcf[_0x2b13('0x24')]!=='Password\x20Expired'){return rp({'method':_0x2b13('0x68'),'uri':util[_0x2b13('0x63')](_0x2b13('0x69'),_0x59d64c,_0x2b13('0x64')),'json':!![],'form':{'method':_0x2b13('0x6a'),'input_type':_0x2b13('0x66'),'response_type':_0x2b13('0x66'),'rest_data':JSON[_0x2b13('0x67')]({'session':_0xb6dfcf['id'],'module_name':_0x2b13('0x6b')})}})['then'](function(_0x2e5d85){if(_0x2e5d85){var _0x29eda1=_[_0x2b13('0x6c')](_0x2e5d85[_0x2b13('0x6d')]);_[_0x2b13('0x6e')](_0x29eda1,function(_0x32fd96){return _0x3f3a51['includes'](_0x32fd96[_0x2b13('0x24')]);});return{'count':_0x29eda1[_0x2b13('0x30')],'rows':_[_0x2b13('0x27')](_0x29eda1,function(_0x2051ac){return{'id':_0x2051ac['name'],'name':_0x2051ac[_0x2b13('0x6f')],'custom':_['endsWith'](_0x2051ac[_0x2b13('0x24')],'_c')?!![]:![],'options':_0x2051ac[_0x2b13('0x42')]?_[_0x2b13('0x27')](_[_0x2b13('0x6c')](_0x2051ac[_0x2b13('0x42')]),function(_0x23ea68){return{'name':_0x23ea68[_0x2b13('0x70')],'value':_0x23ea68[_0x2b13('0x24')]};}):[]};})};}})['then'](respondWithResult(_0x51fb11,null))[_0x2b13('0x44')](function(_0x5ba3bd){var _0x3f2b0b=_0x39a08e['query'][_0x2b13('0x71')]?0x1f4:_0x5ba3bd['statusCode']||0x1f4;logger[_0x2b13('0x22')](_0x2b13('0x72'),_0x2b13('0x55'),_0x3f2b0b,JSON['stringify'](_0x5ba3bd));delete _0x5ba3bd[_0x2b13('0x24')];if(_0x3f2b0b===0x191){_0x3f2b0b=0x190;}_0x51fb11[_0x2b13('0x14')](_0x3f2b0b)[_0x2b13('0x25')](_0x39a08e['query'][_0x2b13('0x71')]?{'message':_0x2b13('0x73'),'statusCode':_0x5ba3bd[_0x2b13('0x74')]}:_0x5ba3bd);});}else{var _0x342a03=0x1f4;_0x51fb11[_0x2b13('0x14')](_0x342a03)[_0x2b13('0x25')]({'message':_0x2b13('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x758f=['lastIndexOf','POST','format','%s%s','login','JSON','stringify','username','password','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','includes','label','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','name','index','map','SugarcrmAccount','fieldName','type','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','body','params','getConfigurations','SugarcrmConfiguration','filter','findOne','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','duration_hours','parent_type','parent_name','direction','remoteUri','slice','substring'];(function(_0x3459ac,_0x355b64){var _0x302dbd=function(_0x2269aa){while(--_0x2269aa){_0x3459ac['push'](_0x3459ac['shift']());}};_0x302dbd(++_0x355b64);}(_0x758f,0x178));var _0xf758=function(_0x1e182d,_0x4f35c2){_0x1e182d=_0x1e182d-0x0;var _0x5627c6=_0x758f[_0x1e182d];return _0x5627c6;};'use strict';var emlformat=require(_0xf758('0x0'));var rimraf=require(_0xf758('0x1'));var zipdir=require(_0xf758('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf758('0x3'));var moment=require(_0xf758('0x4'));var BPromise=require(_0xf758('0x5'));var Mustache=require(_0xf758('0x6'));var util=require(_0xf758('0x7'));var path=require('path');var sox=require(_0xf758('0x8'));var csv=require(_0xf758('0x9'));var ejs=require(_0xf758('0xa'));var fs=require('fs');var fs_extra=require(_0xf758('0xb'));var _=require('lodash');var squel=require(_0xf758('0xc'));var crypto=require(_0xf758('0xd'));var jsforce=require(_0xf758('0xe'));var deskjs=require(_0xf758('0xf'));var toCsv=require(_0xf758('0x9'));var querystring=require(_0xf758('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf758('0x11'));var qs=require(_0xf758('0x12'));var as=require(_0xf758('0x13'));var hardwareService=require(_0xf758('0x14'));var logger=require('../../config/logger')(_0xf758('0x15'));var utils=require(_0xf758('0x16'));var config=require(_0xf758('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf758('0x18'))['db'];var integrations=require(_0xf758('0x19'));function respondWithStatusCode(_0x48f39f,_0x7d81ef){_0x7d81ef=_0x7d81ef||0xcc;return function(_0x229654){if(_0x229654){return _0x48f39f[_0xf758('0x1a')](_0x7d81ef);}return _0x48f39f[_0xf758('0x1b')](_0x7d81ef)[_0xf758('0x1c')]();};}function respondWithResult(_0xa3b1f9,_0xa8838){_0xa8838=_0xa8838||0xc8;return function(_0x2b0ab1){if(_0x2b0ab1){return _0xa3b1f9[_0xf758('0x1b')](_0xa8838)[_0xf758('0x1d')](_0x2b0ab1);}};}function respondWithFilteredResult(_0x40f07a,_0x253a68){return function(_0x329dd4){if(_0x329dd4){var _0x1f9114=typeof _0x253a68[_0xf758('0x1e')]===_0xf758('0x1f')&&typeof _0x253a68[_0xf758('0x20')]==='undefined';var _0x14251f=_0x329dd4[_0xf758('0x21')];var _0x57b3dc=_0x1f9114?0x0:_0x253a68[_0xf758('0x1e')];var _0x2eeef3=_0x1f9114?_0x329dd4[_0xf758('0x21')]:_0x253a68[_0xf758('0x1e')]+_0x253a68['limit'];var _0x1b3d86;if(_0x2eeef3>=_0x14251f){_0x2eeef3=_0x14251f;_0x1b3d86=0xc8;}else{_0x1b3d86=0xce;}_0x40f07a['status'](_0x1b3d86);return _0x40f07a['set']('Content-Range',_0x57b3dc+'-'+_0x2eeef3+'/'+_0x14251f)[_0xf758('0x1d')](_0x329dd4);}return null;};}function patchUpdates(_0x11ee8b){return function(_0xaded8d){try{jsonpatch[_0xf758('0x22')](_0xaded8d,_0x11ee8b,!![]);}catch(_0x6a1b12){return BPromise[_0xf758('0x23')](_0x6a1b12);}return _0xaded8d[_0xf758('0x24')]();};}function saveUpdates(_0x1d98cd,_0x83c403){return function(_0x1798e3){if(_0x1798e3){return _0x1798e3[_0xf758('0x25')](_0x1d98cd)['then'](function(_0x589a28){return _0x589a28;});}return null;};}function removeEntity(_0x2e66d3,_0x331981){return function(_0x318a5b){if(_0x318a5b){return _0x318a5b[_0xf758('0x26')]()[_0xf758('0x27')](function(){_0x2e66d3[_0xf758('0x1b')](0xcc)[_0xf758('0x1c')]();});}};}function handleEntityNotFound(_0x3b49f1,_0x2596a1){return function(_0x39ebe1){if(!_0x39ebe1){_0x3b49f1[_0xf758('0x1a')](0x194);}return _0x39ebe1;};}function handleError(_0x3c7278,_0x2fe9fa){_0x2fe9fa=_0x2fe9fa||0x1f4;return function(_0x2f79c6){logger['error'](_0x2f79c6['stack']);if(_0x2f79c6['name']){delete _0x2f79c6[_0xf758('0x28')];}_0x3c7278[_0xf758('0x1b')](_0x2fe9fa)['send'](_0x2f79c6);};}exports[_0xf758('0x29')]=function(_0x2df8b9,_0x14cbd4){var _0x577b82={},_0x19e96a={},_0x38b9c3={'count':0x0,'rows':[]};var _0x42596b=_[_0xf758('0x2a')](db[_0xf758('0x2b')]['rawAttributes'],function(_0x366165){return{'name':_0x366165[_0xf758('0x2c')],'type':_0x366165[_0xf758('0x2d')]['key']};});_0x19e96a[_0xf758('0x2e')]=_[_0xf758('0x2a')](_0x42596b,'name');_0x19e96a[_0xf758('0x2f')]=_[_0xf758('0x30')](_0x2df8b9[_0xf758('0x2f')]);_0x19e96a['filters']=_['intersection'](_0x19e96a[_0xf758('0x2e')],_0x19e96a[_0xf758('0x2f')]);_0x577b82['attributes']=_['intersection'](_0x19e96a[_0xf758('0x2e')],qs['fields'](_0x2df8b9[_0xf758('0x2f')][_0xf758('0x31')]));_0x577b82['attributes']=_0x577b82[_0xf758('0x32')][_0xf758('0x33')]?_0x577b82['attributes']:_0x19e96a['model'];if(!_0x2df8b9[_0xf758('0x2f')][_0xf758('0x34')](_0xf758('0x35'))){_0x577b82['limit']=qs['limit'](_0x2df8b9[_0xf758('0x2f')]['limit']);_0x577b82[_0xf758('0x1e')]=qs[_0xf758('0x1e')](_0x2df8b9[_0xf758('0x2f')][_0xf758('0x1e')]);}_0x577b82[_0xf758('0x36')]=qs['sort'](_0x2df8b9['query'][_0xf758('0x37')]);_0x577b82[_0xf758('0x38')]=qs[_0xf758('0x39')](_[_0xf758('0x3a')](_0x2df8b9[_0xf758('0x2f')],_0x19e96a[_0xf758('0x39')]),_0x42596b);if(_0x2df8b9[_0xf758('0x2f')]['filter']){_0x577b82['where']=_[_0xf758('0x3b')](_0x577b82[_0xf758('0x38')],{'$or':_[_0xf758('0x2a')](_0x42596b,function(_0x490be9){if(_0x490be9[_0xf758('0x2d')]!==_0xf758('0x3c')){var _0x488793={};_0x488793[_0x490be9[_0xf758('0x28')]]={'$like':'%'+_0x2df8b9['query']['filter']+'%'};return _0x488793;}})});}_0x577b82=_[_0xf758('0x3b')]({},_0x577b82,_0x2df8b9[_0xf758('0x3d')]);var _0x3b41a3={'where':_0x577b82[_0xf758('0x38')]};return db[_0xf758('0x2b')][_0xf758('0x21')](_0x3b41a3)[_0xf758('0x27')](function(_0xe66ed1){_0x38b9c3['count']=_0xe66ed1;if(_0x2df8b9[_0xf758('0x2f')][_0xf758('0x3e')]){_0x577b82[_0xf758('0x3f')]=[{'all':!![]}];}return db[_0xf758('0x2b')]['findAll'](_0x577b82);})[_0xf758('0x27')](function(_0x4df8bc){_0x38b9c3[_0xf758('0x40')]=_0x4df8bc;return _0x38b9c3;})[_0xf758('0x27')](respondWithFilteredResult(_0x14cbd4,_0x577b82))[_0xf758('0x41')](handleError(_0x14cbd4,null));};exports[_0xf758('0x42')]=function(_0x7c580a,_0x3c50b7){var _0x3737dc={'raw':![],'where':{'id':_0x7c580a['params']['id']}},_0x4af666={};_0x4af666['model']=_[_0xf758('0x30')](db['SugarcrmAccount'][_0xf758('0x43')]);_0x4af666['query']=_[_0xf758('0x30')](_0x7c580a['query']);_0x4af666[_0xf758('0x39')]=_[_0xf758('0x44')](_0x4af666[_0xf758('0x2e')],_0x4af666[_0xf758('0x2f')]);_0x3737dc[_0xf758('0x32')]=_[_0xf758('0x44')](_0x4af666[_0xf758('0x2e')],qs[_0xf758('0x31')](_0x7c580a[_0xf758('0x2f')]['fields']));_0x3737dc[_0xf758('0x32')]=_0x3737dc[_0xf758('0x32')][_0xf758('0x33')]?_0x3737dc['attributes']:_0x4af666[_0xf758('0x2e')];if(_0x7c580a[_0xf758('0x2f')][_0xf758('0x3e')]){_0x3737dc[_0xf758('0x3f')]=[{'all':!![]}];}_0x3737dc=_[_0xf758('0x3b')]({},_0x3737dc,_0x7c580a[_0xf758('0x3d')]);return db[_0xf758('0x2b')][_0xf758('0x45')](_0x3737dc)[_0xf758('0x27')](handleEntityNotFound(_0x3c50b7,null))[_0xf758('0x27')](respondWithResult(_0x3c50b7,null))[_0xf758('0x41')](handleError(_0x3c50b7,null));};exports[_0xf758('0x46')]=function(_0x576fce,_0x5bdb80){return db[_0xf758('0x2b')][_0xf758('0x46')](_0x576fce[_0xf758('0x47')],{})['then'](respondWithResult(_0x5bdb80,0xc9))[_0xf758('0x41')](handleError(_0x5bdb80,null));};exports[_0xf758('0x25')]=function(_0x3de3e9,_0x59105e){if(_0x3de3e9['body']['id']){delete _0x3de3e9[_0xf758('0x47')]['id'];}return db['SugarcrmAccount'][_0xf758('0x45')]({'where':{'id':_0x3de3e9[_0xf758('0x48')]['id']}})[_0xf758('0x27')](handleEntityNotFound(_0x59105e,null))[_0xf758('0x27')](saveUpdates(_0x3de3e9[_0xf758('0x47')],null))[_0xf758('0x27')](respondWithResult(_0x59105e,null))[_0xf758('0x41')](handleError(_0x59105e,null));};exports[_0xf758('0x26')]=function(_0x190e42,_0x5a9490){return db[_0xf758('0x2b')][_0xf758('0x45')]({'where':{'id':_0x190e42['params']['id']}})[_0xf758('0x27')](handleEntityNotFound(_0x5a9490,null))[_0xf758('0x27')](removeEntity(_0x5a9490,null))[_0xf758('0x41')](handleError(_0x5a9490,null));};exports[_0xf758('0x49')]=function(_0x5e5ba2,_0x347227,_0x3cdc91){var _0x10c949={};var _0x57d68c={};var _0x6d5f5f;var _0x187b78;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x5e5ba2[_0xf758('0x48')]['id']}})[_0xf758('0x27')](handleEntityNotFound(_0x347227,null))[_0xf758('0x27')](function(_0x3e1716){if(_0x3e1716){_0x6d5f5f=_0x3e1716;_0x57d68c[_0xf758('0x2e')]=_['keys'](db[_0xf758('0x4a')][_0xf758('0x43')]);_0x57d68c['query']=_[_0xf758('0x30')](_0x5e5ba2[_0xf758('0x2f')]);_0x57d68c[_0xf758('0x39')]=_[_0xf758('0x44')](_0x57d68c[_0xf758('0x2e')],_0x57d68c[_0xf758('0x2f')]);_0x10c949[_0xf758('0x32')]=_[_0xf758('0x44')](_0x57d68c[_0xf758('0x2e')],qs[_0xf758('0x31')](_0x5e5ba2[_0xf758('0x2f')][_0xf758('0x31')]));_0x10c949[_0xf758('0x32')]=_0x10c949[_0xf758('0x32')][_0xf758('0x33')]?_0x10c949[_0xf758('0x32')]:_0x57d68c[_0xf758('0x2e')];_0x10c949[_0xf758('0x36')]=qs[_0xf758('0x37')](_0x5e5ba2[_0xf758('0x2f')]['sort']);_0x10c949[_0xf758('0x38')]=qs[_0xf758('0x39')](_[_0xf758('0x3a')](_0x5e5ba2[_0xf758('0x2f')],_0x57d68c[_0xf758('0x39')]));if(_0x5e5ba2[_0xf758('0x2f')]['filter']){_0x10c949['where']=_['merge'](_0x10c949[_0xf758('0x38')],{'$or':_[_0xf758('0x2a')](_0x10c949[_0xf758('0x32')],function(_0x2909c3){var _0x327983={};_0x327983[_0x2909c3]={'$like':'%'+_0x5e5ba2[_0xf758('0x2f')][_0xf758('0x4b')]+'%'};return _0x327983;})});}_0x10c949=_['merge']({},_0x10c949,_0x5e5ba2[_0xf758('0x3d')]);return _0x6d5f5f[_0xf758('0x49')](_0x10c949);}})['then'](function(_0x2ef777){if(_0x2ef777){_0x187b78=_0x2ef777['length'];if(!_0x5e5ba2[_0xf758('0x2f')][_0xf758('0x34')](_0xf758('0x35'))){_0x10c949[_0xf758('0x20')]=qs['limit'](_0x5e5ba2[_0xf758('0x2f')][_0xf758('0x20')]);_0x10c949[_0xf758('0x1e')]=qs[_0xf758('0x1e')](_0x5e5ba2['query']['offset']);}return _0x6d5f5f[_0xf758('0x49')](_0x10c949);}})[_0xf758('0x27')](function(_0x2f1578){if(_0x2f1578){return _0x2f1578?{'count':_0x187b78,'rows':_0x2f1578}:null;}})['then'](respondWithResult(_0x347227,null))[_0xf758('0x41')](handleError(_0x347227,null));};exports['addConfiguration']=function(_0x1d2ebe,_0x23b589,_0x10b241){if(_0x1d2ebe[_0xf758('0x47')]['id']){delete _0x1d2ebe[_0xf758('0x47')]['id'];}return db[_0xf758('0x2b')][_0xf758('0x4c')]({'where':{'id':_0x1d2ebe['params']['id']}})[_0xf758('0x27')](handleEntityNotFound(_0x23b589,null))['then'](function(_0x2b9548){if(_0x2b9548){_0x1d2ebe[_0xf758('0x47')]['AccountId']=_0x2b9548['id'];_0x1d2ebe[_0xf758('0x47')][_0xf758('0x4d')]=integrations['getSubjects'](_0x1d2ebe['body'][_0xf758('0x4e')],_0x1d2ebe[_0xf758('0x47')]['type']);_0x1d2ebe[_0xf758('0x47')][_0xf758('0x4f')]=integrations[_0xf758('0x50')](_0x1d2ebe[_0xf758('0x47')][_0xf758('0x4e')],_0x1d2ebe[_0xf758('0x47')][_0xf758('0x2d')]);return db[_0xf758('0x4a')][_0xf758('0x46')](_0x1d2ebe[_0xf758('0x47')],{'include':[{'model':db['SugarcrmField'],'as':_0xf758('0x4d')},{'model':db[_0xf758('0x51')],'as':_0xf758('0x4f')}]});}return null;})['then'](respondWithResult(_0x23b589,null))['catch'](handleError(_0x23b589,null));};exports['getFields']=function(_0x140837,_0x4dffb2,_0x3a6ce7){var _0x11fa9d='';var _0x3466d4=['id',_0xf758('0x28'),_0xf758('0x52'),_0xf758('0x53'),_0xf758('0x54'),'date_start',_0xf758('0x55'),'duration_minutes','parent_id',_0xf758('0x56'),_0xf758('0x57'),_0xf758('0x58')];return db[_0xf758('0x2b')]['findOne']({'where':{'id':_0x140837[_0xf758('0x48')]['id']},'attributes':['id','username','password','remoteUri']})[_0xf758('0x27')](handleEntityNotFound(_0x4dffb2,null))[_0xf758('0x27')](function(_0x20e1f3){if(_0x20e1f3){_0x11fa9d=_0x20e1f3[_0xf758('0x59')];var _0x2b80df=_0x11fa9d[_0xf758('0x5a')](-0x1);if(_0x2b80df==='/'){_0x11fa9d=_0x11fa9d[_0xf758('0x5b')](0x0,_0x11fa9d[_0xf758('0x5c')](_0x2b80df));}return rp({'method':_0xf758('0x5d'),'uri':util[_0xf758('0x5e')](_0xf758('0x5f'),_0x11fa9d,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf758('0x60'),'input_type':_0xf758('0x61'),'response_type':_0xf758('0x61'),'rest_data':JSON[_0xf758('0x62')]({'user_auth':{'user_name':_0x20e1f3[_0xf758('0x63')],'password':_0x20e1f3[_0xf758('0x64')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xf758('0x27')](function(_0x4834ba){if(_0x4834ba&&_0x4834ba[_0xf758('0x28')]!==_0xf758('0x65')&&_0x4834ba[_0xf758('0x28')]!==_0xf758('0x66')){return rp({'method':_0xf758('0x5d'),'uri':util[_0xf758('0x5e')](_0xf758('0x5f'),_0x11fa9d,_0xf758('0x67')),'json':!![],'form':{'method':_0xf758('0x68'),'input_type':_0xf758('0x61'),'response_type':_0xf758('0x61'),'rest_data':JSON[_0xf758('0x62')]({'session':_0x4834ba['id'],'module_name':'Calls'})}})[_0xf758('0x27')](function(_0x1a36b8){if(_0x1a36b8){var _0x55fd81=_[_0xf758('0x69')](_0x1a36b8[_0xf758('0x6a')]);_[_0xf758('0x6b')](_0x55fd81,function(_0x500fdc){return _0x3466d4[_0xf758('0x6c')](_0x500fdc['name']);});return{'count':_0x55fd81[_0xf758('0x33')],'rows':_[_0xf758('0x2a')](_0x55fd81,function(_0x2def3b){return{'id':_0x2def3b[_0xf758('0x28')],'name':_0x2def3b[_0xf758('0x6d')],'custom':_[_0xf758('0x6e')](_0x2def3b[_0xf758('0x28')],'_c')?!![]:![],'options':_0x2def3b[_0xf758('0x3d')]?_[_0xf758('0x2a')](_[_0xf758('0x69')](_0x2def3b[_0xf758('0x3d')]),function(_0x49283e){return{'name':_0x49283e['value'],'value':_0x49283e['name']};}):[]};})};}})[_0xf758('0x27')](respondWithResult(_0x4dffb2,null))[_0xf758('0x41')](function(_0x5bf4f2){var _0x68c6a=_0x140837[_0xf758('0x2f')]['test']?0x1f4:_0x5bf4f2[_0xf758('0x6f')]||0x1f4;logger['error'](_0xf758('0x70'),_0xf758('0x71'),_0x68c6a,JSON[_0xf758('0x62')](_0x5bf4f2));delete _0x5bf4f2[_0xf758('0x28')];if(_0x68c6a===0x191){_0x68c6a=0x190;}_0x4dffb2[_0xf758('0x1b')](_0x68c6a)[_0xf758('0x72')](_0x140837[_0xf758('0x2f')][_0xf758('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x5bf4f2[_0xf758('0x6f')]}:_0x5bf4f2);});}else{var _0x7017e0=0x1f4;_0x4dffb2[_0xf758('0x1b')](_0x7017e0)[_0xf758('0x72')]({'message':_0xf758('0x74'),'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 c07cb73..357d8a3 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 _0x2080=['bluebird','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment'];(function(_0x476c6c,_0x434db8){var _0xbb94db=function(_0x4be12){while(--_0x4be12){_0x476c6c['push'](_0x476c6c['shift']());}};_0xbb94db(++_0x434db8);}(_0x2080,0x19f));var _0x0208=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2080[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0208('0x0'))(_0x0208('0x1'));var moment=require(_0x0208('0x2'));var BPromise=require(_0x0208('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0208('0x4'));var rimraf=require(_0x0208('0x5'));var config=require('../../config/environment');var attributes=require(_0x0208('0x6'));var integrations=require(_0x0208('0x7'));module[_0x0208('0x8')]=function(_0x115952,_0x29ab94){return _0x115952['define'](_0x0208('0x9'),attributes,{'tableName':_0x0208('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x296e=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x296e,0x9e));var _0xe296=function(_0x42c303,_0x4cee17){_0x42c303=_0x42c303-0x0;var _0x1a28bf=_0x296e[_0x42c303];return _0x1a28bf;};'use strict';var _=require(_0xe296('0x0'));var util=require(_0xe296('0x1'));var logger=require(_0xe296('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe296('0x3'));var rp=require(_0xe296('0x4'));var fs=require('fs');var path=require(_0xe296('0x5'));var rimraf=require(_0xe296('0x6'));var config=require(_0xe296('0x7'));var attributes=require(_0xe296('0x8'));var integrations=require(_0xe296('0x9'));module[_0xe296('0xa')]=function(_0x52628f,_0x3dbf02){return _0x52628f['define'](_0xe296('0xb'),attributes,{'tableName':_0xe296('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 1857fb2..851494b 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 _0x774f=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x6dc241,_0x3d6db7){var _0xac50e7=function(_0x42c8a1){while(--_0x42c8a1){_0x6dc241['push'](_0x6dc241['shift']());}};_0xac50e7(++_0x3d6db7);}(_0x774f,0x1f0));var _0xf774=function(_0x2bbf32,_0x4e63f4){_0x2bbf32=_0x2bbf32-0x0;var _0x2b9814=_0x774f[_0x2bbf32];return _0x2b9814;};'use strict';var _=require(_0xf774('0x0'));var util=require(_0xf774('0x1'));var moment=require(_0xf774('0x2'));var BPromise=require(_0xf774('0x3'));var rs=require(_0xf774('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf774('0x5'))['db'];var utils=require(_0xf774('0x6'));var logger=require(_0xf774('0x7'))(_0xf774('0x8'));var config=require(_0xf774('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf774('0xa')][_0xf774('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c6cf7,_0x97a242,_0x3b5bab){return new BPromise(function(_0x5b5a78,_0x36ef11){return client[_0xf774('0xc')](_0x5c6cf7,_0x3b5bab)[_0xf774('0xd')](function(_0x7e229c){logger[_0xf774('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x97a242,_0xf774('0xf'));logger[_0xf774('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x97a242,_0xf774('0xf'),JSON[_0xf774('0x11')](_0x7e229c));if(_0x7e229c[_0xf774('0x12')]){if(_0x7e229c[_0xf774('0x12')][_0xf774('0x13')]===0x1f4){logger[_0xf774('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x97a242,_0x7e229c['error'][_0xf774('0x14')]);return _0x36ef11(_0x7e229c['error'][_0xf774('0x14')]);}logger[_0xf774('0x12')](_0xf774('0x15'),_0x97a242,_0x7e229c[_0xf774('0x12')][_0xf774('0x14')]);return _0x5b5a78(_0x7e229c[_0xf774('0x12')][_0xf774('0x14')]);}else{logger[_0xf774('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x97a242,_0xf774('0xf'));_0x5b5a78(_0x7e229c[_0xf774('0x16')][_0xf774('0x14')]);}})[_0xf774('0x17')](function(_0x281f73){logger['error'](_0xf774('0x15'),_0x97a242,_0x281f73);_0x36ef11(_0x281f73);});});}exports[_0xf774('0x18')]=function(_0x4acef2){var _0x3e4c15=this;return new Promise(function(_0x158345,_0x37af33){return db[_0xf774('0x19')][_0xf774('0x1a')]({'raw':_0x4acef2['options']?_0x4acef2[_0xf774('0x1b')][_0xf774('0x1c')]===undefined?!![]:![]:!![],'where':_0x4acef2[_0xf774('0x1b')]?_0x4acef2['options'][_0xf774('0x1d')]||null:null,'attributes':_0x4acef2['options']?_0x4acef2['options'][_0xf774('0x1e')]||null:null,'limit':_0x4acef2[_0xf774('0x1b')]?_0x4acef2[_0xf774('0x1b')]['limit']||null:null,'include':_0x4acef2[_0xf774('0x1b')]?_0x4acef2['options'][_0xf774('0x1f')]?_[_0xf774('0x20')](_0x4acef2['options']['include'],function(_0x3d6c81){return{'model':db[_0x3d6c81['model']],'as':_0x3d6c81['as'],'attributes':_0x3d6c81[_0xf774('0x1e')],'include':_0x3d6c81[_0xf774('0x1f')]?_[_0xf774('0x20')](_0x3d6c81['include'],function(_0x4d9113){return{'model':db[_0x4d9113[_0xf774('0x21')]],'as':_0x4d9113['as'],'attributes':_0x4d9113[_0xf774('0x1e')],'include':_0x4d9113['include']?_['map'](_0x4d9113[_0xf774('0x1f')],function(_0x51698f){return{'model':db[_0x51698f[_0xf774('0x21')]],'as':_0x51698f['as'],'attributes':_0x51698f[_0xf774('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf774('0xd')](function(_0x302786){logger[_0xf774('0xe')]('GetSugarcrmAccount',_0x4acef2);logger[_0xf774('0x10')]('GetSugarcrmAccount',_0x4acef2,JSON[_0xf774('0x11')](_0x302786));_0x158345(_0x302786);})['catch'](function(_0x93ae58){logger[_0xf774('0x12')]('GetSugarcrmAccount',_0x93ae58[_0xf774('0x14')],_0x4acef2);_0x37af33(_0x3e4c15[_0xf774('0x12')](0x1f4,_0x93ae58[_0xf774('0x14')]));});});};exports[_0xf774('0x22')]=function(_0x2eb9c6){var _0x5855f8=this;return new Promise(function(_0x3b75f3,_0x29f53f){return db[_0xf774('0x19')][_0xf774('0x23')]({'raw':_0x2eb9c6[_0xf774('0x1b')]?_0x2eb9c6[_0xf774('0x1b')][_0xf774('0x1c')]===undefined?!![]:![]:!![],'where':_0x2eb9c6[_0xf774('0x1b')]?_0x2eb9c6[_0xf774('0x1b')][_0xf774('0x1d')]||null:null,'attributes':_0x2eb9c6['options']?_0x2eb9c6['options'][_0xf774('0x1e')]||null:null,'include':_0x2eb9c6[_0xf774('0x1b')]?_0x2eb9c6['options'][_0xf774('0x1f')]?_[_0xf774('0x20')](_0x2eb9c6[_0xf774('0x1b')][_0xf774('0x1f')],function(_0x1dd0bd){return{'model':db[_0x1dd0bd[_0xf774('0x21')]],'as':_0x1dd0bd['as'],'attributes':_0x1dd0bd[_0xf774('0x1e')],'include':_0x1dd0bd[_0xf774('0x1f')]?_['map'](_0x1dd0bd['include'],function(_0x212e09){return{'model':db[_0x212e09[_0xf774('0x21')]],'as':_0x212e09['as'],'attributes':_0x212e09[_0xf774('0x1e')],'include':_0x212e09[_0xf774('0x1f')]?_[_0xf774('0x20')](_0x212e09[_0xf774('0x1f')],function(_0x55f8d9){return{'model':db[_0x55f8d9[_0xf774('0x21')]],'as':_0x55f8d9['as'],'attributes':_0x55f8d9[_0xf774('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf774('0xd')](function(_0x1f2eab){logger[_0xf774('0xe')]('ShowSugarcrmAccount',_0x2eb9c6);logger[_0xf774('0x10')](_0xf774('0x22'),_0x2eb9c6,JSON[_0xf774('0x11')](_0x1f2eab));_0x3b75f3(_0x1f2eab);})[_0xf774('0x17')](function(_0x4ecf50){logger[_0xf774('0x12')]('ShowSugarcrmAccount',_0x4ecf50['message'],_0x2eb9c6);_0x29f53f(_0x5855f8[_0xf774('0x12')](0x1f4,_0x4ecf50[_0xf774('0x14')]));});});}; \ No newline at end of file +var _0xe322=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SugarcrmAccount','findAll','raw','options','where','attributes','map','include','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40df4b,_0x2267b4){var _0x1f6c38=function(_0xbe6b13){while(--_0xbe6b13){_0x40df4b['push'](_0x40df4b['shift']());}};_0x1f6c38(++_0x2267b4);}(_0xe322,0x166));var _0x2e32=function(_0xfc223a,_0x26a0c9){_0xfc223a=_0xfc223a-0x0;var _0x1fd2e3=_0xe322[_0xfc223a];return _0x1fd2e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2e32('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e32('0x1'))['db'];var utils=require(_0x2e32('0x2'));var logger=require('../../config/logger')(_0x2e32('0x3'));var config=require(_0x2e32('0x4'));var jayson=require(_0x2e32('0x5'));var client=jayson[_0x2e32('0x6')][_0x2e32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x60dbfe,_0x25d859,_0x56fa92){return new BPromise(function(_0x2261e6,_0x5d693e){return client[_0x2e32('0x8')](_0x60dbfe,_0x56fa92)[_0x2e32('0x9')](function(_0x3c6fb5){logger[_0x2e32('0xa')](_0x2e32('0xb'),_0x25d859,_0x2e32('0xc'));logger[_0x2e32('0xd')](_0x2e32('0xe'),_0x25d859,_0x2e32('0xc'),JSON[_0x2e32('0xf')](_0x3c6fb5));if(_0x3c6fb5['error']){if(_0x3c6fb5[_0x2e32('0x10')]['code']===0x1f4){logger[_0x2e32('0x10')](_0x2e32('0xb'),_0x25d859,_0x3c6fb5[_0x2e32('0x10')][_0x2e32('0x11')]);return _0x5d693e(_0x3c6fb5['error'][_0x2e32('0x11')]);}logger[_0x2e32('0x10')](_0x2e32('0xb'),_0x25d859,_0x3c6fb5[_0x2e32('0x10')][_0x2e32('0x11')]);return _0x2261e6(_0x3c6fb5[_0x2e32('0x10')][_0x2e32('0x11')]);}else{logger[_0x2e32('0xa')](_0x2e32('0xb'),_0x25d859,_0x2e32('0xc'));_0x2261e6(_0x3c6fb5['result']['message']);}})[_0x2e32('0x12')](function(_0x5c5556){logger[_0x2e32('0x10')](_0x2e32('0xb'),_0x25d859,_0x5c5556);_0x5d693e(_0x5c5556);});});}exports['GetSugarcrmAccount']=function(_0x1c8984){var _0x18bf33=this;return new Promise(function(_0x4cbe80,_0x18d50d){return db[_0x2e32('0x13')][_0x2e32('0x14')]({'raw':_0x1c8984['options']?_0x1c8984['options'][_0x2e32('0x15')]===undefined?!![]:![]:!![],'where':_0x1c8984[_0x2e32('0x16')]?_0x1c8984[_0x2e32('0x16')][_0x2e32('0x17')]||null:null,'attributes':_0x1c8984[_0x2e32('0x16')]?_0x1c8984['options'][_0x2e32('0x18')]||null:null,'limit':_0x1c8984['options']?_0x1c8984[_0x2e32('0x16')]['limit']||null:null,'include':_0x1c8984[_0x2e32('0x16')]?_0x1c8984[_0x2e32('0x16')]['include']?_[_0x2e32('0x19')](_0x1c8984[_0x2e32('0x16')][_0x2e32('0x1a')],function(_0x4ce185){return{'model':db[_0x4ce185[_0x2e32('0x1b')]],'as':_0x4ce185['as'],'attributes':_0x4ce185[_0x2e32('0x18')],'include':_0x4ce185[_0x2e32('0x1a')]?_[_0x2e32('0x19')](_0x4ce185[_0x2e32('0x1a')],function(_0x140f62){return{'model':db[_0x140f62[_0x2e32('0x1b')]],'as':_0x140f62['as'],'attributes':_0x140f62['attributes'],'include':_0x140f62['include']?_[_0x2e32('0x19')](_0x140f62[_0x2e32('0x1a')],function(_0x3a6a39){return{'model':db[_0x3a6a39[_0x2e32('0x1b')]],'as':_0x3a6a39['as'],'attributes':_0x3a6a39[_0x2e32('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c8a01){logger[_0x2e32('0xa')]('GetSugarcrmAccount',_0x1c8984);logger[_0x2e32('0xd')]('GetSugarcrmAccount',_0x1c8984,JSON[_0x2e32('0xf')](_0x3c8a01));_0x4cbe80(_0x3c8a01);})[_0x2e32('0x12')](function(_0x593d11){logger[_0x2e32('0x10')](_0x2e32('0x1c'),_0x593d11['message'],_0x1c8984);_0x18d50d(_0x18bf33[_0x2e32('0x10')](0x1f4,_0x593d11[_0x2e32('0x11')]));});});};exports[_0x2e32('0x1d')]=function(_0x1b24a4){var _0x54756f=this;return new Promise(function(_0x235a07,_0x1ef478){return db[_0x2e32('0x13')][_0x2e32('0x1e')]({'raw':_0x1b24a4[_0x2e32('0x16')]?_0x1b24a4[_0x2e32('0x16')][_0x2e32('0x15')]===undefined?!![]:![]:!![],'where':_0x1b24a4[_0x2e32('0x16')]?_0x1b24a4[_0x2e32('0x16')][_0x2e32('0x17')]||null:null,'attributes':_0x1b24a4[_0x2e32('0x16')]?_0x1b24a4[_0x2e32('0x16')][_0x2e32('0x18')]||null:null,'include':_0x1b24a4['options']?_0x1b24a4[_0x2e32('0x16')]['include']?_[_0x2e32('0x19')](_0x1b24a4[_0x2e32('0x16')][_0x2e32('0x1a')],function(_0x2acf44){return{'model':db[_0x2acf44[_0x2e32('0x1b')]],'as':_0x2acf44['as'],'attributes':_0x2acf44['attributes'],'include':_0x2acf44[_0x2e32('0x1a')]?_[_0x2e32('0x19')](_0x2acf44[_0x2e32('0x1a')],function(_0x5e402d){return{'model':db[_0x5e402d['model']],'as':_0x5e402d['as'],'attributes':_0x5e402d[_0x2e32('0x18')],'include':_0x5e402d['include']?_['map'](_0x5e402d['include'],function(_0x237eb2){return{'model':db[_0x237eb2[_0x2e32('0x1b')]],'as':_0x237eb2['as'],'attributes':_0x237eb2[_0x2e32('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31c162){logger[_0x2e32('0xa')]('ShowSugarcrmAccount',_0x1b24a4);logger[_0x2e32('0xd')](_0x2e32('0x1d'),_0x1b24a4,JSON[_0x2e32('0xf')](_0x31c162));_0x235a07(_0x31c162);})['catch'](function(_0x23817b){logger[_0x2e32('0x10')](_0x2e32('0x1d'),_0x23817b[_0x2e32('0x11')],_0x1b24a4);_0x1ef478(_0x54756f['error'](0x1f4,_0x23817b[_0x2e32('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a142d83..2778a35 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 _0xf0c5=['../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x13bf4d,_0x3f86c3){var _0x292410=function(_0x20fd8e){while(--_0x20fd8e){_0x13bf4d['push'](_0x13bf4d['shift']());}};_0x292410(++_0x3f86c3);}(_0xf0c5,0x1d5));var _0x5f0c=function(_0x52a397,_0x50af17){_0x52a397=_0x52a397-0x0;var _0x14f164=_0xf0c5[_0x52a397];return _0x14f164;};'use strict';var multer=require(_0x5f0c('0x0'));var util=require(_0x5f0c('0x1'));var path=require('path');var timeout=require(_0x5f0c('0x2'));var express=require(_0x5f0c('0x3'));var router=express[_0x5f0c('0x4')]();var fs_extra=require(_0x5f0c('0x5'));var auth=require(_0x5f0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f0c('0x7'));var controller=require(_0x5f0c('0x8'));router[_0x5f0c('0x9')]('/',auth[_0x5f0c('0xa')](),controller[_0x5f0c('0xb')]);router[_0x5f0c('0x9')]('/:id',auth[_0x5f0c('0xa')](),controller[_0x5f0c('0xc')]);router[_0x5f0c('0x9')](_0x5f0c('0xd'),auth[_0x5f0c('0xa')](),controller[_0x5f0c('0xe')]);router[_0x5f0c('0x9')](_0x5f0c('0xf'),auth[_0x5f0c('0xa')](),controller['getSubjects']);router[_0x5f0c('0x9')](_0x5f0c('0x10'),auth['isAuthenticated'](),controller[_0x5f0c('0x11')]);router[_0x5f0c('0x12')]('/',auth['isAuthenticated'](),controller[_0x5f0c('0x13')]);router[_0x5f0c('0x14')](_0x5f0c('0x15'),auth[_0x5f0c('0xa')](),controller[_0x5f0c('0x16')]);router[_0x5f0c('0x17')](_0x5f0c('0x15'),auth[_0x5f0c('0xa')](),controller[_0x5f0c('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa3ec=['show','/:id/fields','getSubjects','/:id/descriptions','create','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x27841e,_0x45435f){var _0x30d008=function(_0x2d2a60){while(--_0x2d2a60){_0x27841e['push'](_0x27841e['shift']());}};_0x30d008(++_0x45435f);}(_0xa3ec,0xfe));var _0xca3e=function(_0x17d41f,_0x28d30a){_0x17d41f=_0x17d41f-0x0;var _0x41b90f=_0xa3ec[_0x17d41f];return _0x41b90f;};'use strict';var multer=require(_0xca3e('0x0'));var util=require(_0xca3e('0x1'));var path=require(_0xca3e('0x2'));var timeout=require(_0xca3e('0x3'));var express=require(_0xca3e('0x4'));var router=express[_0xca3e('0x5')]();var fs_extra=require(_0xca3e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xca3e('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xca3e('0x8')]('/',auth[_0xca3e('0x9')](),controller[_0xca3e('0xa')]);router['get'](_0xca3e('0xb'),auth[_0xca3e('0x9')](),controller[_0xca3e('0xc')]);router[_0xca3e('0x8')](_0xca3e('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xca3e('0x8')]('/:id/subjects',auth[_0xca3e('0x9')](),controller[_0xca3e('0xe')]);router[_0xca3e('0x8')](_0xca3e('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xca3e('0x9')](),controller[_0xca3e('0x10')]);router[_0xca3e('0x11')](_0xca3e('0xb'),auth[_0xca3e('0x9')](),controller['update']);router[_0xca3e('0x12')](_0xca3e('0xb'),auth[_0xca3e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 32268cd..c821885 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 _0xd03a=['sequelize','STRING'];(function(_0xbe48a,_0x4d3ec5){var _0x3eeda0=function(_0x2d758d){while(--_0x2d758d){_0xbe48a['push'](_0xbe48a['shift']());}};_0x3eeda0(++_0x4d3ec5);}(_0xd03a,0x180));var _0xad03=function(_0x20eb01,_0x59ae21){_0x20eb01=_0x20eb01-0x0;var _0x5c5e37=_0xd03a[_0x20eb01];return _0x5c5e37;};'use strict';var Sequelize=require(_0xad03('0x0'));module['exports']={'name':{'type':Sequelize[_0xad03('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7d1=['STRING','sequelize','exports'];(function(_0x549501,_0x541ac6){var _0x229640=function(_0x5d08d7){while(--_0x5d08d7){_0x549501['push'](_0x549501['shift']());}};_0x229640(++_0x541ac6);}(_0xc7d1,0x10f));var _0x1c7d=function(_0x1d5098,_0xab456f){_0x1d5098=_0x1d5098-0x0;var _0x3463c5=_0xc7d1[_0x1d5098];return _0x3463c5;};'use strict';var Sequelize=require(_0x1c7d('0x0'));module[_0x1c7d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 0e7f99a..5cd4ff1 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 _0x86f8=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','getFields','findOne','pick','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5afbc2,_0x29aab5){var _0xe98381=function(_0x33038f){while(--_0x33038f){_0x5afbc2['push'](_0x5afbc2['shift']());}};_0xe98381(++_0x29aab5);}(_0x86f8,0x16a));var _0x886f=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x86f8[_0x28fbe3];return _0x45db6a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x886f('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x886f('0x1'));var Mustache=require('mustache');var util=require(_0x886f('0x2'));var path=require(_0x886f('0x3'));var sox=require(_0x886f('0x4'));var csv=require(_0x886f('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x886f('0x6'));var _=require(_0x886f('0x7'));var squel=require(_0x886f('0x8'));var crypto=require(_0x886f('0x9'));var jsforce=require(_0x886f('0xa'));var deskjs=require(_0x886f('0xb'));var toCsv=require(_0x886f('0x5'));var querystring=require(_0x886f('0xc'));var Papa=require('papaparse');var Redis=require(_0x886f('0xd'));var authService=require(_0x886f('0xe'));var qs=require(_0x886f('0xf'));var as=require(_0x886f('0x10'));var hardwareService=require(_0x886f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x886f('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x886f('0x13'))['db'];function respondWithStatusCode(_0x1b18b8,_0x22413e){_0x22413e=_0x22413e||0xcc;return function(_0x1a8bf1){if(_0x1a8bf1){return _0x1b18b8[_0x886f('0x14')](_0x22413e);}return _0x1b18b8[_0x886f('0x15')](_0x22413e)[_0x886f('0x16')]();};}function respondWithResult(_0x607c14,_0x5ebc84){_0x5ebc84=_0x5ebc84||0xc8;return function(_0x54f257){if(_0x54f257){return _0x607c14[_0x886f('0x15')](_0x5ebc84)['json'](_0x54f257);}};}function respondWithFilteredResult(_0x44893e,_0x5500df){return function(_0x247dd6){if(_0x247dd6){var _0x34ac5c=typeof _0x5500df[_0x886f('0x17')]===_0x886f('0x18')&&typeof _0x5500df[_0x886f('0x19')]===_0x886f('0x18');var _0x243937=_0x247dd6[_0x886f('0x1a')];var _0x1fe2dd=_0x34ac5c?0x0:_0x5500df[_0x886f('0x17')];var _0x5eae7b=_0x34ac5c?_0x247dd6[_0x886f('0x1a')]:_0x5500df['offset']+_0x5500df[_0x886f('0x19')];var _0x5651bf;if(_0x5eae7b>=_0x243937){_0x5eae7b=_0x243937;_0x5651bf=0xc8;}else{_0x5651bf=0xce;}_0x44893e['status'](_0x5651bf);return _0x44893e[_0x886f('0x1b')](_0x886f('0x1c'),_0x1fe2dd+'-'+_0x5eae7b+'/'+_0x243937)[_0x886f('0x1d')](_0x247dd6);}return null;};}function patchUpdates(_0x5bfe8d){return function(_0x3a5f17){try{jsonpatch[_0x886f('0x1e')](_0x3a5f17,_0x5bfe8d,!![]);}catch(_0x34dd13){return BPromise['reject'](_0x34dd13);}return _0x3a5f17['save']();};}function saveUpdates(_0x3ef97d,_0x49a18f){return function(_0x582ec3){if(_0x582ec3){return _0x582ec3[_0x886f('0x1f')](_0x3ef97d)[_0x886f('0x20')](function(_0x5ca85a){return _0x5ca85a;});}return null;};}function removeEntity(_0x2f24b0,_0xfa1026){return function(_0xb5ff51){if(_0xb5ff51){return _0xb5ff51[_0x886f('0x21')]()[_0x886f('0x20')](function(){_0x2f24b0[_0x886f('0x15')](0xcc)[_0x886f('0x16')]();});}};}function handleEntityNotFound(_0x1a81ae,_0x1388ab){return function(_0x2bcac6){if(!_0x2bcac6){_0x1a81ae[_0x886f('0x14')](0x194);}return _0x2bcac6;};}function handleError(_0x551c73,_0x49e91e){_0x49e91e=_0x49e91e||0x1f4;return function(_0x1e0b29){logger['error'](_0x1e0b29[_0x886f('0x22')]);if(_0x1e0b29['name']){delete _0x1e0b29[_0x886f('0x23')];}_0x551c73['status'](_0x49e91e)['send'](_0x1e0b29);};}exports[_0x886f('0x24')]=function(_0x16c06b,_0x388786){var _0xe34ee0={},_0x5b005e={},_0x169a83={'count':0x0,'rows':[]};var _0x41033d=_[_0x886f('0x25')](db[_0x886f('0x26')]['rawAttributes'],function(_0x275b36){return{'name':_0x275b36[_0x886f('0x27')],'type':_0x275b36[_0x886f('0x28')][_0x886f('0x29')]};});_0x5b005e[_0x886f('0x2a')]=_['map'](_0x41033d,_0x886f('0x23'));_0x5b005e[_0x886f('0x2b')]=_[_0x886f('0x2c')](_0x16c06b[_0x886f('0x2b')]);_0x5b005e[_0x886f('0x2d')]=_[_0x886f('0x2e')](_0x5b005e[_0x886f('0x2a')],_0x5b005e[_0x886f('0x2b')]);_0xe34ee0[_0x886f('0x2f')]=_[_0x886f('0x2e')](_0x5b005e[_0x886f('0x2a')],qs[_0x886f('0x30')](_0x16c06b[_0x886f('0x2b')][_0x886f('0x30')]));_0xe34ee0['attributes']=_0xe34ee0[_0x886f('0x2f')][_0x886f('0x31')]?_0xe34ee0[_0x886f('0x2f')]:_0x5b005e[_0x886f('0x2a')];if(!_0x16c06b['query']['hasOwnProperty'](_0x886f('0x32'))){_0xe34ee0[_0x886f('0x19')]=qs[_0x886f('0x19')](_0x16c06b['query'][_0x886f('0x19')]);_0xe34ee0[_0x886f('0x17')]=qs[_0x886f('0x17')](_0x16c06b['query'][_0x886f('0x17')]);}_0xe34ee0[_0x886f('0x33')]=qs[_0x886f('0x34')](_0x16c06b[_0x886f('0x2b')][_0x886f('0x34')]);_0xe34ee0[_0x886f('0x35')]=qs[_0x886f('0x2d')](_['pick'](_0x16c06b[_0x886f('0x2b')],_0x5b005e[_0x886f('0x2d')]),_0x41033d);if(_0x16c06b[_0x886f('0x2b')][_0x886f('0x36')]){_0xe34ee0[_0x886f('0x35')]=_[_0x886f('0x37')](_0xe34ee0['where'],{'$or':_[_0x886f('0x25')](_0x41033d,function(_0x6f76d3){if(_0x6f76d3[_0x886f('0x28')]!==_0x886f('0x38')){var _0x1c15ca={};_0x1c15ca[_0x6f76d3[_0x886f('0x23')]]={'$like':'%'+_0x16c06b['query'][_0x886f('0x36')]+'%'};return _0x1c15ca;}})});}_0xe34ee0=_[_0x886f('0x37')]({},_0xe34ee0,_0x16c06b[_0x886f('0x39')]);var _0x4617f6={'where':_0xe34ee0[_0x886f('0x35')]};return db[_0x886f('0x26')]['count'](_0x4617f6)[_0x886f('0x20')](function(_0x23077c){_0x169a83[_0x886f('0x1a')]=_0x23077c;if(_0x16c06b[_0x886f('0x2b')][_0x886f('0x3a')]){_0xe34ee0[_0x886f('0x3b')]=[{'all':!![]}];}return db[_0x886f('0x26')][_0x886f('0x3c')](_0xe34ee0);})[_0x886f('0x20')](function(_0x4b45f7){_0x169a83[_0x886f('0x3d')]=_0x4b45f7;return _0x169a83;})[_0x886f('0x20')](respondWithFilteredResult(_0x388786,_0xe34ee0))['catch'](handleError(_0x388786,null));};exports['show']=function(_0x27def1,_0x596a62){var _0xace6fa={'raw':![],'where':{'id':_0x27def1[_0x886f('0x3e')]['id']}},_0x4d090e={};_0x4d090e[_0x886f('0x2a')]=_['keys'](db[_0x886f('0x26')][_0x886f('0x3f')]);_0x4d090e[_0x886f('0x2b')]=_[_0x886f('0x2c')](_0x27def1[_0x886f('0x2b')]);_0x4d090e[_0x886f('0x2d')]=_['intersection'](_0x4d090e[_0x886f('0x2a')],_0x4d090e['query']);_0xace6fa[_0x886f('0x2f')]=_[_0x886f('0x2e')](_0x4d090e['model'],qs[_0x886f('0x30')](_0x27def1['query'][_0x886f('0x30')]));_0xace6fa[_0x886f('0x2f')]=_0xace6fa[_0x886f('0x2f')]['length']?_0xace6fa[_0x886f('0x2f')]:_0x4d090e['model'];if(_0x27def1[_0x886f('0x2b')][_0x886f('0x3a')]){_0xace6fa[_0x886f('0x3b')]=[{'all':!![]}];}_0xace6fa=_[_0x886f('0x37')]({},_0xace6fa,_0x27def1[_0x886f('0x39')]);return db[_0x886f('0x26')][_0x886f('0x40')](_0xace6fa)[_0x886f('0x20')](handleEntityNotFound(_0x596a62,null))[_0x886f('0x20')](respondWithResult(_0x596a62,null))[_0x886f('0x41')](handleError(_0x596a62,null));};exports[_0x886f('0x42')]=function(_0x58199e,_0x5b6f55){return db[_0x886f('0x26')]['create'](_0x58199e[_0x886f('0x43')],{})[_0x886f('0x20')](respondWithResult(_0x5b6f55,0xc9))['catch'](handleError(_0x5b6f55,null));};exports[_0x886f('0x1f')]=function(_0x5cde8f,_0xd00808){if(_0x5cde8f[_0x886f('0x43')]['id']){delete _0x5cde8f[_0x886f('0x43')]['id'];}return db[_0x886f('0x26')][_0x886f('0x40')]({'where':{'id':_0x5cde8f[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0xd00808,null))[_0x886f('0x20')](saveUpdates(_0x5cde8f[_0x886f('0x43')],null))[_0x886f('0x20')](respondWithResult(_0xd00808,null))[_0x886f('0x41')](handleError(_0xd00808,null));};exports[_0x886f('0x21')]=function(_0x54104e,_0x44e24d){return db[_0x886f('0x26')][_0x886f('0x40')]({'where':{'id':_0x54104e[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0x44e24d,null))[_0x886f('0x20')](removeEntity(_0x44e24d,null))[_0x886f('0x41')](handleError(_0x44e24d,null));};exports[_0x886f('0x44')]=function(_0x59985c,_0x2db05c,_0x1aeaf9){var _0x5e5412={};var _0x3190ed={};var _0x25ab17;var _0x171c63;return db[_0x886f('0x26')][_0x886f('0x45')]({'where':{'id':_0x59985c[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0x2db05c,null))['then'](function(_0x4dbc0d){if(_0x4dbc0d){_0x25ab17=_0x4dbc0d;_0x3190ed['model']=_[_0x886f('0x2c')](db['SugarcrmField'][_0x886f('0x3f')]);_0x3190ed['query']=_[_0x886f('0x2c')](_0x59985c[_0x886f('0x2b')]);_0x3190ed['filters']=_['intersection'](_0x3190ed[_0x886f('0x2a')],_0x3190ed['query']);_0x5e5412['attributes']=_[_0x886f('0x2e')](_0x3190ed[_0x886f('0x2a')],qs[_0x886f('0x30')](_0x59985c[_0x886f('0x2b')][_0x886f('0x30')]));_0x5e5412[_0x886f('0x2f')]=_0x5e5412[_0x886f('0x2f')][_0x886f('0x31')]?_0x5e5412[_0x886f('0x2f')]:_0x3190ed[_0x886f('0x2a')];_0x5e5412[_0x886f('0x33')]=qs[_0x886f('0x34')](_0x59985c[_0x886f('0x2b')][_0x886f('0x34')]);_0x5e5412[_0x886f('0x35')]=qs[_0x886f('0x2d')](_[_0x886f('0x46')](_0x59985c['query'],_0x3190ed['filters']));if(_0x59985c[_0x886f('0x2b')][_0x886f('0x36')]){_0x5e5412['where']=_[_0x886f('0x37')](_0x5e5412[_0x886f('0x35')],{'$or':_[_0x886f('0x25')](_0x5e5412[_0x886f('0x2f')],function(_0x233273){var _0x4c2edc={};_0x4c2edc[_0x233273]={'$like':'%'+_0x59985c[_0x886f('0x2b')]['filter']+'%'};return _0x4c2edc;})});}_0x5e5412=_[_0x886f('0x37')]({},_0x5e5412,_0x59985c[_0x886f('0x39')]);return _0x25ab17[_0x886f('0x44')](_0x5e5412);}})['then'](function(_0x2cca34){if(_0x2cca34){_0x171c63=_0x2cca34[_0x886f('0x31')];if(!_0x59985c['query']['hasOwnProperty']('nolimit')){_0x5e5412[_0x886f('0x19')]=qs[_0x886f('0x19')](_0x59985c[_0x886f('0x2b')][_0x886f('0x19')]);_0x5e5412[_0x886f('0x17')]=qs[_0x886f('0x17')](_0x59985c[_0x886f('0x2b')][_0x886f('0x17')]);}return _0x25ab17[_0x886f('0x44')](_0x5e5412);}})['then'](function(_0x22fbcc){if(_0x22fbcc){return _0x22fbcc?{'count':_0x171c63,'rows':_0x22fbcc}:null;}})[_0x886f('0x20')](respondWithResult(_0x2db05c,null))['catch'](handleError(_0x2db05c,null));};exports['getSubjects']=function(_0x376f3a,_0x2f4f1d,_0x523306){var _0x3b2847={};var _0x516b9b={};var _0xbbd384;var _0x42aa7a;return db[_0x886f('0x26')][_0x886f('0x45')]({'where':{'id':_0x376f3a[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0x2f4f1d,null))[_0x886f('0x20')](function(_0x3a82bd){if(_0x3a82bd){_0xbbd384=_0x3a82bd;_0x516b9b['model']=_[_0x886f('0x2c')](db[_0x886f('0x47')][_0x886f('0x3f')]);_0x516b9b[_0x886f('0x2b')]=_[_0x886f('0x2c')](_0x376f3a['query']);_0x516b9b['filters']=_[_0x886f('0x2e')](_0x516b9b['model'],_0x516b9b['query']);_0x3b2847[_0x886f('0x2f')]=_[_0x886f('0x2e')](_0x516b9b[_0x886f('0x2a')],qs[_0x886f('0x30')](_0x376f3a[_0x886f('0x2b')]['fields']));_0x3b2847[_0x886f('0x2f')]=_0x3b2847[_0x886f('0x2f')]['length']?_0x3b2847['attributes']:_0x516b9b['model'];_0x3b2847[_0x886f('0x33')]=qs[_0x886f('0x34')](_0x376f3a[_0x886f('0x2b')]['sort']);_0x3b2847[_0x886f('0x35')]=qs[_0x886f('0x2d')](_['pick'](_0x376f3a[_0x886f('0x2b')],_0x516b9b['filters']));if(_0x376f3a['query']['filter']){_0x3b2847[_0x886f('0x35')]=_[_0x886f('0x37')](_0x3b2847['where'],{'$or':_[_0x886f('0x25')](_0x3b2847[_0x886f('0x2f')],function(_0x1230c5){var _0x1c3b05={};_0x1c3b05[_0x1230c5]={'$like':'%'+_0x376f3a[_0x886f('0x2b')][_0x886f('0x36')]+'%'};return _0x1c3b05;})});}_0x3b2847=_[_0x886f('0x37')]({},_0x3b2847,_0x376f3a[_0x886f('0x39')]);return _0xbbd384['getSubjects'](_0x3b2847);}})[_0x886f('0x20')](function(_0x588c0c){if(_0x588c0c){_0x42aa7a=_0x588c0c[_0x886f('0x31')];if(!_0x376f3a[_0x886f('0x2b')][_0x886f('0x48')](_0x886f('0x32'))){_0x3b2847[_0x886f('0x19')]=qs[_0x886f('0x19')](_0x376f3a[_0x886f('0x2b')]['limit']);_0x3b2847['offset']=qs[_0x886f('0x17')](_0x376f3a[_0x886f('0x2b')][_0x886f('0x17')]);}return _0xbbd384[_0x886f('0x49')](_0x3b2847);}})[_0x886f('0x20')](function(_0x14f874){if(_0x14f874){return _0x14f874?{'count':_0x42aa7a,'rows':_0x14f874}:null;}})['then'](respondWithResult(_0x2f4f1d,null))[_0x886f('0x41')](handleError(_0x2f4f1d,null));};exports['getDescriptions']=function(_0x59db00,_0x48a633,_0x5cbfc8){var _0x58d116={};var _0xc029a7={};var _0x593162;var _0xebd5ba;return db['SugarcrmConfiguration'][_0x886f('0x45')]({'where':{'id':_0x59db00[_0x886f('0x3e')]['id']}})[_0x886f('0x20')](handleEntityNotFound(_0x48a633,null))['then'](function(_0x35a111){if(_0x35a111){_0x593162=_0x35a111;_0xc029a7['model']=_[_0x886f('0x2c')](db[_0x886f('0x47')]['rawAttributes']);_0xc029a7[_0x886f('0x2b')]=_[_0x886f('0x2c')](_0x59db00[_0x886f('0x2b')]);_0xc029a7[_0x886f('0x2d')]=_[_0x886f('0x2e')](_0xc029a7[_0x886f('0x2a')],_0xc029a7[_0x886f('0x2b')]);_0x58d116['attributes']=_[_0x886f('0x2e')](_0xc029a7[_0x886f('0x2a')],qs[_0x886f('0x30')](_0x59db00[_0x886f('0x2b')][_0x886f('0x30')]));_0x58d116[_0x886f('0x2f')]=_0x58d116[_0x886f('0x2f')][_0x886f('0x31')]?_0x58d116[_0x886f('0x2f')]:_0xc029a7[_0x886f('0x2a')];_0x58d116[_0x886f('0x33')]=qs[_0x886f('0x34')](_0x59db00[_0x886f('0x2b')]['sort']);_0x58d116[_0x886f('0x35')]=qs[_0x886f('0x2d')](_[_0x886f('0x46')](_0x59db00[_0x886f('0x2b')],_0xc029a7['filters']));if(_0x59db00['query'][_0x886f('0x36')]){_0x58d116[_0x886f('0x35')]=_[_0x886f('0x37')](_0x58d116[_0x886f('0x35')],{'$or':_[_0x886f('0x25')](_0x58d116[_0x886f('0x2f')],function(_0x3798e8){var _0x5bb9ca={};_0x5bb9ca[_0x3798e8]={'$like':'%'+_0x59db00[_0x886f('0x2b')][_0x886f('0x36')]+'%'};return _0x5bb9ca;})});}_0x58d116=_[_0x886f('0x37')]({},_0x58d116,_0x59db00[_0x886f('0x39')]);return _0x593162[_0x886f('0x4a')](_0x58d116);}})[_0x886f('0x20')](function(_0x386a0a){if(_0x386a0a){_0xebd5ba=_0x386a0a['length'];if(!_0x59db00[_0x886f('0x2b')][_0x886f('0x48')](_0x886f('0x32'))){_0x58d116[_0x886f('0x19')]=qs[_0x886f('0x19')](_0x59db00[_0x886f('0x2b')]['limit']);_0x58d116[_0x886f('0x17')]=qs['offset'](_0x59db00[_0x886f('0x2b')]['offset']);}return _0x593162[_0x886f('0x4a')](_0x58d116);}})[_0x886f('0x20')](function(_0x285d1b){if(_0x285d1b){return _0x285d1b?{'count':_0xebd5ba,'rows':_0x285d1b}:null;}})[_0x886f('0x20')](respondWithResult(_0x48a633,null))[_0x886f('0x41')](handleError(_0x48a633,null));}; \ No newline at end of file +var _0xa02f=['count','set','Content-Range','apply','save','update','destroy','then','end','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','key','map','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','length','find','create','body','catch','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa02f,0xcf));var _0xfa02=function(_0x4a17e0,_0x14cc14){_0x4a17e0=_0x4a17e0-0x0;var _0x56f015=_0xa02f[_0x4a17e0];return _0x56f015;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa02('0x0'));var zipdir=require(_0xfa02('0x1'));var jsonpatch=require(_0xfa02('0x2'));var rp=require(_0xfa02('0x3'));var moment=require(_0xfa02('0x4'));var BPromise=require(_0xfa02('0x5'));var Mustache=require('mustache');var util=require(_0xfa02('0x6'));var path=require(_0xfa02('0x7'));var sox=require(_0xfa02('0x8'));var csv=require(_0xfa02('0x9'));var ejs=require(_0xfa02('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa02('0xb'));var squel=require('squel');var crypto=require(_0xfa02('0xc'));var jsforce=require(_0xfa02('0xd'));var deskjs=require(_0xfa02('0xe'));var toCsv=require(_0xfa02('0x9'));var querystring=require(_0xfa02('0xf'));var Papa=require('papaparse');var Redis=require(_0xfa02('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfa02('0x11'));var as=require(_0xfa02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa02('0x13'))('api');var utils=require(_0xfa02('0x14'));var config=require(_0xfa02('0x15'));var licenseUtil=require(_0xfa02('0x16'));var db=require(_0xfa02('0x17'))['db'];function respondWithStatusCode(_0x270e9e,_0x51e63d){_0x51e63d=_0x51e63d||0xcc;return function(_0x2cfecf){if(_0x2cfecf){return _0x270e9e[_0xfa02('0x18')](_0x51e63d);}return _0x270e9e[_0xfa02('0x19')](_0x51e63d)['end']();};}function respondWithResult(_0x2b86e0,_0x17839e){_0x17839e=_0x17839e||0xc8;return function(_0x512966){if(_0x512966){return _0x2b86e0[_0xfa02('0x19')](_0x17839e)[_0xfa02('0x1a')](_0x512966);}};}function respondWithFilteredResult(_0x3774d1,_0x2f8e41){return function(_0xf4362){if(_0xf4362){var _0x54b5c3=typeof _0x2f8e41['offset']===_0xfa02('0x1b')&&typeof _0x2f8e41[_0xfa02('0x1c')]===_0xfa02('0x1b');var _0x248162=_0xf4362['count'];var _0x4f5a7d=_0x54b5c3?0x0:_0x2f8e41[_0xfa02('0x1d')];var _0x4de88c=_0x54b5c3?_0xf4362[_0xfa02('0x1e')]:_0x2f8e41['offset']+_0x2f8e41['limit'];var _0x1e9c3a;if(_0x4de88c>=_0x248162){_0x4de88c=_0x248162;_0x1e9c3a=0xc8;}else{_0x1e9c3a=0xce;}_0x3774d1[_0xfa02('0x19')](_0x1e9c3a);return _0x3774d1[_0xfa02('0x1f')](_0xfa02('0x20'),_0x4f5a7d+'-'+_0x4de88c+'/'+_0x248162)[_0xfa02('0x1a')](_0xf4362);}return null;};}function patchUpdates(_0x5255e1){return function(_0x4e3210){try{jsonpatch[_0xfa02('0x21')](_0x4e3210,_0x5255e1,!![]);}catch(_0x4f495d){return BPromise['reject'](_0x4f495d);}return _0x4e3210[_0xfa02('0x22')]();};}function saveUpdates(_0x4fe5ae,_0x31f575){return function(_0xcaf39e){if(_0xcaf39e){return _0xcaf39e[_0xfa02('0x23')](_0x4fe5ae)['then'](function(_0x3a6626){return _0x3a6626;});}return null;};}function removeEntity(_0x373aeb,_0x255914){return function(_0x2755d3){if(_0x2755d3){return _0x2755d3[_0xfa02('0x24')]()[_0xfa02('0x25')](function(){_0x373aeb[_0xfa02('0x19')](0xcc)[_0xfa02('0x26')]();});}};}function handleEntityNotFound(_0x406ac3,_0x184ee1){return function(_0x33a86c){if(!_0x33a86c){_0x406ac3[_0xfa02('0x18')](0x194);}return _0x33a86c;};}function handleError(_0x54a96e,_0x49053c){_0x49053c=_0x49053c||0x1f4;return function(_0x44af4b){logger['error'](_0x44af4b[_0xfa02('0x27')]);if(_0x44af4b[_0xfa02('0x28')]){delete _0x44af4b['name'];}_0x54a96e['status'](_0x49053c)[_0xfa02('0x29')](_0x44af4b);};}exports[_0xfa02('0x2a')]=function(_0x23bd39,_0x41d4a4){var _0x40d472={},_0x253b5a={},_0x461466={'count':0x0,'rows':[]};var _0x2fa9e9=_['map'](db[_0xfa02('0x2b')][_0xfa02('0x2c')],function(_0x467d3a){return{'name':_0x467d3a['fieldName'],'type':_0x467d3a[_0xfa02('0x2d')][_0xfa02('0x2e')]};});_0x253b5a['model']=_[_0xfa02('0x2f')](_0x2fa9e9,_0xfa02('0x28'));_0x253b5a['query']=_[_0xfa02('0x30')](_0x23bd39['query']);_0x253b5a[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x253b5a[_0xfa02('0x33')],_0x253b5a[_0xfa02('0x34')]);_0x40d472[_0xfa02('0x35')]=_[_0xfa02('0x32')](_0x253b5a['model'],qs[_0xfa02('0x36')](_0x23bd39[_0xfa02('0x34')][_0xfa02('0x36')]));_0x40d472[_0xfa02('0x35')]=_0x40d472[_0xfa02('0x35')]['length']?_0x40d472[_0xfa02('0x35')]:_0x253b5a[_0xfa02('0x33')];if(!_0x23bd39['query'][_0xfa02('0x37')](_0xfa02('0x38'))){_0x40d472['limit']=qs[_0xfa02('0x1c')](_0x23bd39[_0xfa02('0x34')][_0xfa02('0x1c')]);_0x40d472['offset']=qs[_0xfa02('0x1d')](_0x23bd39[_0xfa02('0x34')][_0xfa02('0x1d')]);}_0x40d472[_0xfa02('0x39')]=qs[_0xfa02('0x3a')](_0x23bd39['query'][_0xfa02('0x3a')]);_0x40d472[_0xfa02('0x3b')]=qs[_0xfa02('0x31')](_[_0xfa02('0x3c')](_0x23bd39[_0xfa02('0x34')],_0x253b5a['filters']),_0x2fa9e9);if(_0x23bd39[_0xfa02('0x34')][_0xfa02('0x3d')]){_0x40d472[_0xfa02('0x3b')]=_[_0xfa02('0x3e')](_0x40d472[_0xfa02('0x3b')],{'$or':_['map'](_0x2fa9e9,function(_0x5d9502){if(_0x5d9502['type']!==_0xfa02('0x3f')){var _0x5ca535={};_0x5ca535[_0x5d9502[_0xfa02('0x28')]]={'$like':'%'+_0x23bd39[_0xfa02('0x34')][_0xfa02('0x3d')]+'%'};return _0x5ca535;}})});}_0x40d472=_[_0xfa02('0x3e')]({},_0x40d472,_0x23bd39[_0xfa02('0x40')]);var _0x49ed66={'where':_0x40d472[_0xfa02('0x3b')]};return db[_0xfa02('0x2b')][_0xfa02('0x1e')](_0x49ed66)[_0xfa02('0x25')](function(_0x3c6dfa){_0x461466[_0xfa02('0x1e')]=_0x3c6dfa;if(_0x23bd39[_0xfa02('0x34')][_0xfa02('0x41')]){_0x40d472[_0xfa02('0x42')]=[{'all':!![]}];}return db[_0xfa02('0x2b')]['findAll'](_0x40d472);})[_0xfa02('0x25')](function(_0x15c488){_0x461466['rows']=_0x15c488;return _0x461466;})[_0xfa02('0x25')](respondWithFilteredResult(_0x41d4a4,_0x40d472))['catch'](handleError(_0x41d4a4,null));};exports[_0xfa02('0x43')]=function(_0x34d3f9,_0x5a4a67){var _0x2797d0={'raw':![],'where':{'id':_0x34d3f9[_0xfa02('0x44')]['id']}},_0x214107={};_0x214107[_0xfa02('0x33')]=_['keys'](db[_0xfa02('0x2b')][_0xfa02('0x2c')]);_0x214107[_0xfa02('0x34')]=_[_0xfa02('0x30')](_0x34d3f9[_0xfa02('0x34')]);_0x214107[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x214107[_0xfa02('0x33')],_0x214107[_0xfa02('0x34')]);_0x2797d0[_0xfa02('0x35')]=_[_0xfa02('0x32')](_0x214107['model'],qs['fields'](_0x34d3f9['query'][_0xfa02('0x36')]));_0x2797d0[_0xfa02('0x35')]=_0x2797d0['attributes'][_0xfa02('0x45')]?_0x2797d0[_0xfa02('0x35')]:_0x214107[_0xfa02('0x33')];if(_0x34d3f9[_0xfa02('0x34')][_0xfa02('0x41')]){_0x2797d0[_0xfa02('0x42')]=[{'all':!![]}];}_0x2797d0=_[_0xfa02('0x3e')]({},_0x2797d0,_0x34d3f9['options']);return db[_0xfa02('0x2b')][_0xfa02('0x46')](_0x2797d0)[_0xfa02('0x25')](handleEntityNotFound(_0x5a4a67,null))[_0xfa02('0x25')](respondWithResult(_0x5a4a67,null))['catch'](handleError(_0x5a4a67,null));};exports[_0xfa02('0x47')]=function(_0x7b49a1,_0x416793){return db[_0xfa02('0x2b')][_0xfa02('0x47')](_0x7b49a1[_0xfa02('0x48')],{})['then'](respondWithResult(_0x416793,0xc9))['catch'](handleError(_0x416793,null));};exports[_0xfa02('0x23')]=function(_0x59a724,_0x501c77){if(_0x59a724[_0xfa02('0x48')]['id']){delete _0x59a724[_0xfa02('0x48')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x59a724[_0xfa02('0x44')]['id']}})[_0xfa02('0x25')](handleEntityNotFound(_0x501c77,null))['then'](saveUpdates(_0x59a724[_0xfa02('0x48')],null))[_0xfa02('0x25')](respondWithResult(_0x501c77,null))[_0xfa02('0x49')](handleError(_0x501c77,null));};exports['destroy']=function(_0x578269,_0x8bee42){return db['SugarcrmConfiguration'][_0xfa02('0x46')]({'where':{'id':_0x578269[_0xfa02('0x44')]['id']}})[_0xfa02('0x25')](handleEntityNotFound(_0x8bee42,null))[_0xfa02('0x25')](removeEntity(_0x8bee42,null))[_0xfa02('0x49')](handleError(_0x8bee42,null));};exports[_0xfa02('0x4a')]=function(_0x151b07,_0x4cc70a,_0x891e43){var _0x516fde={};var _0x929b2e={};var _0x48ecb2;var _0x4791e7;return db[_0xfa02('0x2b')][_0xfa02('0x4b')]({'where':{'id':_0x151b07[_0xfa02('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cc70a,null))['then'](function(_0x1d3ab1){if(_0x1d3ab1){_0x48ecb2=_0x1d3ab1;_0x929b2e['model']=_['keys'](db['SugarcrmField'][_0xfa02('0x2c')]);_0x929b2e[_0xfa02('0x34')]=_[_0xfa02('0x30')](_0x151b07[_0xfa02('0x34')]);_0x929b2e[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x929b2e[_0xfa02('0x33')],_0x929b2e['query']);_0x516fde['attributes']=_[_0xfa02('0x32')](_0x929b2e[_0xfa02('0x33')],qs[_0xfa02('0x36')](_0x151b07[_0xfa02('0x34')][_0xfa02('0x36')]));_0x516fde['attributes']=_0x516fde[_0xfa02('0x35')][_0xfa02('0x45')]?_0x516fde[_0xfa02('0x35')]:_0x929b2e['model'];_0x516fde[_0xfa02('0x39')]=qs['sort'](_0x151b07[_0xfa02('0x34')][_0xfa02('0x3a')]);_0x516fde['where']=qs[_0xfa02('0x31')](_[_0xfa02('0x3c')](_0x151b07[_0xfa02('0x34')],_0x929b2e[_0xfa02('0x31')]));if(_0x151b07[_0xfa02('0x34')][_0xfa02('0x3d')]){_0x516fde[_0xfa02('0x3b')]=_[_0xfa02('0x3e')](_0x516fde['where'],{'$or':_['map'](_0x516fde['attributes'],function(_0x23aed8){var _0x15b53f={};_0x15b53f[_0x23aed8]={'$like':'%'+_0x151b07[_0xfa02('0x34')][_0xfa02('0x3d')]+'%'};return _0x15b53f;})});}_0x516fde=_[_0xfa02('0x3e')]({},_0x516fde,_0x151b07[_0xfa02('0x40')]);return _0x48ecb2[_0xfa02('0x4a')](_0x516fde);}})[_0xfa02('0x25')](function(_0x3f4a4c){if(_0x3f4a4c){_0x4791e7=_0x3f4a4c[_0xfa02('0x45')];if(!_0x151b07[_0xfa02('0x34')][_0xfa02('0x37')](_0xfa02('0x38'))){_0x516fde[_0xfa02('0x1c')]=qs['limit'](_0x151b07[_0xfa02('0x34')]['limit']);_0x516fde[_0xfa02('0x1d')]=qs['offset'](_0x151b07[_0xfa02('0x34')][_0xfa02('0x1d')]);}return _0x48ecb2[_0xfa02('0x4a')](_0x516fde);}})['then'](function(_0x5d8ae1){if(_0x5d8ae1){return _0x5d8ae1?{'count':_0x4791e7,'rows':_0x5d8ae1}:null;}})['then'](respondWithResult(_0x4cc70a,null))[_0xfa02('0x49')](handleError(_0x4cc70a,null));};exports['getSubjects']=function(_0x100ef2,_0x24b2fe,_0x275c3e){var _0x48fd0c={};var _0x20d9ca={};var _0x3c8d0d;var _0x111966;return db[_0xfa02('0x2b')][_0xfa02('0x4b')]({'where':{'id':_0x100ef2[_0xfa02('0x44')]['id']}})[_0xfa02('0x25')](handleEntityNotFound(_0x24b2fe,null))[_0xfa02('0x25')](function(_0x298619){if(_0x298619){_0x3c8d0d=_0x298619;_0x20d9ca['model']=_['keys'](db[_0xfa02('0x4c')][_0xfa02('0x2c')]);_0x20d9ca[_0xfa02('0x34')]=_[_0xfa02('0x30')](_0x100ef2[_0xfa02('0x34')]);_0x20d9ca[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x20d9ca[_0xfa02('0x33')],_0x20d9ca[_0xfa02('0x34')]);_0x48fd0c['attributes']=_['intersection'](_0x20d9ca['model'],qs[_0xfa02('0x36')](_0x100ef2[_0xfa02('0x34')][_0xfa02('0x36')]));_0x48fd0c['attributes']=_0x48fd0c[_0xfa02('0x35')][_0xfa02('0x45')]?_0x48fd0c[_0xfa02('0x35')]:_0x20d9ca[_0xfa02('0x33')];_0x48fd0c[_0xfa02('0x39')]=qs[_0xfa02('0x3a')](_0x100ef2['query'][_0xfa02('0x3a')]);_0x48fd0c[_0xfa02('0x3b')]=qs['filters'](_['pick'](_0x100ef2[_0xfa02('0x34')],_0x20d9ca[_0xfa02('0x31')]));if(_0x100ef2[_0xfa02('0x34')]['filter']){_0x48fd0c[_0xfa02('0x3b')]=_[_0xfa02('0x3e')](_0x48fd0c[_0xfa02('0x3b')],{'$or':_[_0xfa02('0x2f')](_0x48fd0c[_0xfa02('0x35')],function(_0x326c4f){var _0x776627={};_0x776627[_0x326c4f]={'$like':'%'+_0x100ef2[_0xfa02('0x34')][_0xfa02('0x3d')]+'%'};return _0x776627;})});}_0x48fd0c=_['merge']({},_0x48fd0c,_0x100ef2[_0xfa02('0x40')]);return _0x3c8d0d[_0xfa02('0x4d')](_0x48fd0c);}})[_0xfa02('0x25')](function(_0x30b653){if(_0x30b653){_0x111966=_0x30b653['length'];if(!_0x100ef2[_0xfa02('0x34')][_0xfa02('0x37')](_0xfa02('0x38'))){_0x48fd0c[_0xfa02('0x1c')]=qs['limit'](_0x100ef2['query']['limit']);_0x48fd0c['offset']=qs[_0xfa02('0x1d')](_0x100ef2[_0xfa02('0x34')][_0xfa02('0x1d')]);}return _0x3c8d0d['getSubjects'](_0x48fd0c);}})['then'](function(_0x133ba6){if(_0x133ba6){return _0x133ba6?{'count':_0x111966,'rows':_0x133ba6}:null;}})['then'](respondWithResult(_0x24b2fe,null))['catch'](handleError(_0x24b2fe,null));};exports[_0xfa02('0x4e')]=function(_0x14f319,_0x40e125,_0x209e41){var _0x53d831={};var _0x540366={};var _0x3db1be;var _0x36edc6;return db[_0xfa02('0x2b')][_0xfa02('0x4b')]({'where':{'id':_0x14f319['params']['id']}})[_0xfa02('0x25')](handleEntityNotFound(_0x40e125,null))['then'](function(_0x18bdf3){if(_0x18bdf3){_0x3db1be=_0x18bdf3;_0x540366[_0xfa02('0x33')]=_['keys'](db[_0xfa02('0x4c')][_0xfa02('0x2c')]);_0x540366['query']=_['keys'](_0x14f319['query']);_0x540366[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x540366[_0xfa02('0x33')],_0x540366[_0xfa02('0x34')]);_0x53d831[_0xfa02('0x35')]=_['intersection'](_0x540366['model'],qs['fields'](_0x14f319['query'][_0xfa02('0x36')]));_0x53d831['attributes']=_0x53d831[_0xfa02('0x35')][_0xfa02('0x45')]?_0x53d831['attributes']:_0x540366[_0xfa02('0x33')];_0x53d831[_0xfa02('0x39')]=qs['sort'](_0x14f319['query'][_0xfa02('0x3a')]);_0x53d831[_0xfa02('0x3b')]=qs[_0xfa02('0x31')](_[_0xfa02('0x3c')](_0x14f319[_0xfa02('0x34')],_0x540366[_0xfa02('0x31')]));if(_0x14f319['query'][_0xfa02('0x3d')]){_0x53d831[_0xfa02('0x3b')]=_[_0xfa02('0x3e')](_0x53d831[_0xfa02('0x3b')],{'$or':_[_0xfa02('0x2f')](_0x53d831['attributes'],function(_0x3807b4){var _0x6c9a63={};_0x6c9a63[_0x3807b4]={'$like':'%'+_0x14f319[_0xfa02('0x34')][_0xfa02('0x3d')]+'%'};return _0x6c9a63;})});}_0x53d831=_[_0xfa02('0x3e')]({},_0x53d831,_0x14f319[_0xfa02('0x40')]);return _0x3db1be['getDescriptions'](_0x53d831);}})[_0xfa02('0x25')](function(_0x345f69){if(_0x345f69){_0x36edc6=_0x345f69[_0xfa02('0x45')];if(!_0x14f319[_0xfa02('0x34')][_0xfa02('0x37')](_0xfa02('0x38'))){_0x53d831[_0xfa02('0x1c')]=qs[_0xfa02('0x1c')](_0x14f319[_0xfa02('0x34')][_0xfa02('0x1c')]);_0x53d831[_0xfa02('0x1d')]=qs[_0xfa02('0x1d')](_0x14f319['query'][_0xfa02('0x1d')]);}return _0x3db1be[_0xfa02('0x4e')](_0x53d831);}})['then'](function(_0x19a497){if(_0x19a497){return _0x19a497?{'count':_0x36edc6,'rows':_0x19a497}:null;}})['then'](respondWithResult(_0x40e125,null))[_0xfa02('0x49')](handleError(_0x40e125,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4cfcab5..4fee6f2 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 _0x3ed2=['util','api','moment','bluebird','request-promise','path','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x3af0d3,_0x4d0e1c){var _0x26de8d=function(_0x4fea55){while(--_0x4fea55){_0x3af0d3['push'](_0x3af0d3['shift']());}};_0x26de8d(++_0x4d0e1c);}(_0x3ed2,0x6b));var _0x23ed=function(_0x64a811,_0x4887b7){_0x64a811=_0x64a811-0x0;var _0x3d8099=_0x3ed2[_0x64a811];return _0x3d8099;};'use strict';var _=require(_0x23ed('0x0'));var util=require(_0x23ed('0x1'));var logger=require('../../config/logger')(_0x23ed('0x2'));var moment=require(_0x23ed('0x3'));var BPromise=require(_0x23ed('0x4'));var rp=require(_0x23ed('0x5'));var fs=require('fs');var path=require(_0x23ed('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0xfa787f,_0xcbf7cf){return _0xfa787f['define'](_0x23ed('0x7'),attributes,{'tableName':_0x23ed('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2a2=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','moment','bluebird','path'];(function(_0x55f3c6,_0x516900){var _0x25d0c2=function(_0x3741c0){while(--_0x3741c0){_0x55f3c6['push'](_0x55f3c6['shift']());}};_0x25d0c2(++_0x516900);}(_0xa2a2,0x71));var _0x2a2a=function(_0x5784f1,_0x7520ff){_0x5784f1=_0x5784f1-0x0;var _0x173e6b=_0xa2a2[_0x5784f1];return _0x173e6b;};'use strict';var _=require(_0x2a2a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2a2a('0x1'));var BPromise=require(_0x2a2a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a2a('0x3'));var rimraf=require('rimraf');var config=require(_0x2a2a('0x4'));var attributes=require(_0x2a2a('0x5'));module[_0x2a2a('0x6')]=function(_0x172ead,_0x5dc64f){return _0x172ead['define'](_0x2a2a('0x7'),attributes,{'tableName':_0x2a2a('0x8'),'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 35ea07f..a0907fd 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 _0x2565=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4daafb,_0x528f2d){var _0x3367c5=function(_0x5dfc7c){while(--_0x5dfc7c){_0x4daafb['push'](_0x4daafb['shift']());}};_0x3367c5(++_0x528f2d);}(_0x2565,0xad));var _0x5256=function(_0x576ba2,_0x1d7dbd){_0x576ba2=_0x576ba2-0x0;var _0x280387=_0x2565[_0x576ba2];return _0x280387;};'use strict';var _=require(_0x5256('0x0'));var util=require(_0x5256('0x1'));var moment=require(_0x5256('0x2'));var BPromise=require(_0x5256('0x3'));var rs=require(_0x5256('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5256('0x5'))['db'];var utils=require(_0x5256('0x6'));var logger=require('../../config/logger')(_0x5256('0x7'));var config=require('../../config/environment');var jayson=require(_0x5256('0x8'));var client=jayson['client'][_0x5256('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1353a0,_0x1b230d,_0x43001f){return new BPromise(function(_0x2b2cfa,_0x820b28){return client[_0x5256('0xa')](_0x1353a0,_0x43001f)[_0x5256('0xb')](function(_0x36076f){logger[_0x5256('0xc')](_0x5256('0xd'),_0x1b230d,'request\x20sent');logger['debug'](_0x5256('0xe'),_0x1b230d,'request\x20sent',JSON[_0x5256('0xf')](_0x36076f));if(_0x36076f[_0x5256('0x10')]){if(_0x36076f[_0x5256('0x10')]['code']===0x1f4){logger['error'](_0x5256('0xd'),_0x1b230d,_0x36076f[_0x5256('0x10')][_0x5256('0x11')]);return _0x820b28(_0x36076f[_0x5256('0x10')]['message']);}logger[_0x5256('0x10')](_0x5256('0xd'),_0x1b230d,_0x36076f['error'][_0x5256('0x11')]);return _0x2b2cfa(_0x36076f[_0x5256('0x10')]['message']);}else{logger[_0x5256('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1b230d,'request\x20sent');_0x2b2cfa(_0x36076f['result'][_0x5256('0x11')]);}})[_0x5256('0x12')](function(_0x18916d){logger['error'](_0x5256('0xd'),_0x1b230d,_0x18916d);_0x820b28(_0x18916d);});});} \ No newline at end of file +var _0xf2b6=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xf2b6,0x95));var _0x6f2b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf2b6[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6f2b('0x0'));var util=require(_0x6f2b('0x1'));var moment=require(_0x6f2b('0x2'));var BPromise=require(_0x6f2b('0x3'));var rs=require(_0x6f2b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f2b('0x6'))(_0x6f2b('0x7'));var config=require(_0x6f2b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6f2b('0x9')][_0x6f2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e3ec,_0xc2b612,_0xacac62){return new BPromise(function(_0x111ebd,_0x54dfc5){return client['request'](_0x19e3ec,_0xacac62)[_0x6f2b('0xb')](function(_0x5b160c){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0xc2b612,'request\x20sent');logger[_0x6f2b('0xc')](_0x6f2b('0xd'),_0xc2b612,_0x6f2b('0xe'),JSON[_0x6f2b('0xf')](_0x5b160c));if(_0x5b160c[_0x6f2b('0x10')]){if(_0x5b160c[_0x6f2b('0x10')][_0x6f2b('0x11')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0xc2b612,_0x5b160c['error'][_0x6f2b('0x12')]);return _0x54dfc5(_0x5b160c['error'][_0x6f2b('0x12')]);}logger[_0x6f2b('0x10')](_0x6f2b('0x13'),_0xc2b612,_0x5b160c['error']['message']);return _0x111ebd(_0x5b160c['error'][_0x6f2b('0x12')]);}else{logger[_0x6f2b('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc2b612,_0x6f2b('0xe'));_0x111ebd(_0x5b160c['result'][_0x6f2b('0x12')]);}})[_0x6f2b('0x15')](function(_0x20eae8){logger[_0x6f2b('0x10')](_0x6f2b('0x13'),_0xc2b612,_0x20eae8);_0x54dfc5(_0x20eae8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4eea7b2..9c92a04 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 _0x3866=['show','put','update','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x3866,0x7b));var _0x6386=function(_0x2bd0ad,_0x1d5726){_0x2bd0ad=_0x2bd0ad-0x0;var _0x1966b3=_0x3866[_0x2bd0ad];return _0x1966b3;};'use strict';var multer=require(_0x6386('0x0'));var util=require(_0x6386('0x1'));var path=require('path');var timeout=require(_0x6386('0x2'));var express=require(_0x6386('0x3'));var router=express['Router']();var fs_extra=require(_0x6386('0x4'));var auth=require(_0x6386('0x5'));var interaction=require(_0x6386('0x6'));var config=require(_0x6386('0x7'));var controller=require(_0x6386('0x8'));router[_0x6386('0x9')]('/',auth[_0x6386('0xa')](),controller[_0x6386('0xb')]);router[_0x6386('0x9')](_0x6386('0xc'),auth[_0x6386('0xa')](),controller[_0x6386('0xd')]);router['post']('/',auth[_0x6386('0xa')](),controller['create']);router[_0x6386('0xe')](_0x6386('0xc'),auth[_0x6386('0xa')](),controller[_0x6386('0xf')]);router[_0x6386('0x10')](_0x6386('0xc'),auth[_0x6386('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeaee=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports'];(function(_0x16252d,_0xaad177){var _0xeb5dd5=function(_0x4852fd){while(--_0x4852fd){_0x16252d['push'](_0x16252d['shift']());}};_0xeb5dd5(++_0xaad177);}(_0xeaee,0x168));var _0xeeae=function(_0xdab5cb,_0x20eb4b){_0xdab5cb=_0xdab5cb-0x0;var _0x2c14a0=_0xeaee[_0xdab5cb];return _0x2c14a0;};'use strict';var multer=require(_0xeeae('0x0'));var util=require(_0xeeae('0x1'));var path=require('path');var timeout=require(_0xeeae('0x2'));var express=require(_0xeeae('0x3'));var router=express[_0xeeae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xeeae('0x5'));var interaction=require(_0xeeae('0x6'));var config=require('../../config/environment');var controller=require(_0xeeae('0x7'));router[_0xeeae('0x8')]('/',auth[_0xeeae('0x9')](),controller[_0xeeae('0xa')]);router[_0xeeae('0x8')](_0xeeae('0xb'),auth[_0xeeae('0x9')](),controller['show']);router['post']('/',auth[_0xeeae('0x9')](),controller[_0xeeae('0xc')]);router[_0xeeae('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xeeae('0xe')]);router[_0xeeae('0xf')](_0xeeae('0xb'),auth[_0xeeae('0x9')](),controller[_0xeeae('0x10')]);module[_0xeeae('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 bf2e6ce..eb74f3b 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 _0xfab9=['string','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfab9,0x1aa));var _0x9fab=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfab9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x9fab('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9fab('0x1'),_0x9fab('0x2'),_0x9fab('0x3'),'keyValue',_0x9fab('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9fab('0x5')]},'key':{'type':Sequelize[_0x9fab('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x9fab('0x1'),'variable',_0x9fab('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9fab('0x5')]},'nameField':{'type':Sequelize[_0x9fab('0x5')]},'customField':{'type':Sequelize[_0x9fab('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9fab('0x5')]}}; \ No newline at end of file +var _0x3b3b=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x2f3738,_0x115a52){var _0x3dfa2c=function(_0x91434d){while(--_0x91434d){_0x2f3738['push'](_0x2f3738['shift']());}};_0x3dfa2c(++_0x115a52);}(_0x3b3b,0x10f));var _0xb3b3=function(_0x1e8482,_0x4fadfc){_0x1e8482=_0x1e8482-0x0;var _0x1355b2=_0x3b3b[_0x1e8482];return _0x1355b2;};'use strict';var Sequelize=require(_0xb3b3('0x0'));module[_0xb3b3('0x1')]={'type':{'type':Sequelize[_0xb3b3('0x2')](_0xb3b3('0x3'),_0xb3b3('0x4'),_0xb3b3('0x5'),'keyValue',_0xb3b3('0x6')),'defaultValue':_0xb3b3('0x3')},'content':{'type':Sequelize[_0xb3b3('0x7')]},'key':{'type':Sequelize[_0xb3b3('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb3b3('0x3'),_0xb3b3('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb3b3('0x7')]},'idField':{'type':Sequelize[_0xb3b3('0x7')]},'nameField':{'type':Sequelize[_0xb3b3('0x7')]},'customField':{'type':Sequelize[_0xb3b3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index bc7d832..d635c33 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 _0x7e17=['count','includeAll','rows','catch','show','params','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy','error','name','send','index','SugarcrmField','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0x7e17,0x121));var _0x77e1=function(_0x32d553,_0x12f5e8){_0x32d553=_0x32d553-0x0;var _0x1707a4=_0x7e17[_0x32d553];return _0x1707a4;};'use strict';var emlformat=require(_0x77e1('0x0'));var rimraf=require(_0x77e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77e1('0x2'));var moment=require(_0x77e1('0x3'));var BPromise=require(_0x77e1('0x4'));var Mustache=require(_0x77e1('0x5'));var util=require(_0x77e1('0x6'));var path=require(_0x77e1('0x7'));var sox=require('sox');var csv=require(_0x77e1('0x8'));var ejs=require(_0x77e1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77e1('0xa'));var squel=require(_0x77e1('0xb'));var crypto=require(_0x77e1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x77e1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x77e1('0xe'));var Redis=require(_0x77e1('0xf'));var authService=require(_0x77e1('0x10'));var qs=require(_0x77e1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x77e1('0x12'))(_0x77e1('0x13'));var utils=require(_0x77e1('0x14'));var config=require(_0x77e1('0x15'));var licenseUtil=require(_0x77e1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46b794,_0x29d03c){_0x29d03c=_0x29d03c||0xcc;return function(_0x4dd59a){if(_0x4dd59a){return _0x46b794[_0x77e1('0x17')](_0x29d03c);}return _0x46b794['status'](_0x29d03c)[_0x77e1('0x18')]();};}function respondWithResult(_0x2d3038,_0x12020c){_0x12020c=_0x12020c||0xc8;return function(_0x157870){if(_0x157870){return _0x2d3038[_0x77e1('0x19')](_0x12020c)[_0x77e1('0x1a')](_0x157870);}};}function respondWithFilteredResult(_0x477789,_0x338737){return function(_0x44cf79){if(_0x44cf79){var _0x1e8d22=typeof _0x338737['offset']===_0x77e1('0x1b')&&typeof _0x338737[_0x77e1('0x1c')]===_0x77e1('0x1b');var _0x3b8460=_0x44cf79['count'];var _0x5b081a=_0x1e8d22?0x0:_0x338737[_0x77e1('0x1d')];var _0x37c244=_0x1e8d22?_0x44cf79['count']:_0x338737[_0x77e1('0x1d')]+_0x338737['limit'];var _0x527ea8;if(_0x37c244>=_0x3b8460){_0x37c244=_0x3b8460;_0x527ea8=0xc8;}else{_0x527ea8=0xce;}_0x477789[_0x77e1('0x19')](_0x527ea8);return _0x477789[_0x77e1('0x1e')](_0x77e1('0x1f'),_0x5b081a+'-'+_0x37c244+'/'+_0x3b8460)['json'](_0x44cf79);}return null;};}function patchUpdates(_0xdadbaa){return function(_0xf55f59){try{jsonpatch['apply'](_0xf55f59,_0xdadbaa,!![]);}catch(_0xbaeed6){return BPromise['reject'](_0xbaeed6);}return _0xf55f59[_0x77e1('0x20')]();};}function saveUpdates(_0x20c66c,_0x33ca18){return function(_0x1e543c){if(_0x1e543c){return _0x1e543c[_0x77e1('0x21')](_0x20c66c)[_0x77e1('0x22')](function(_0x18cc9f){return _0x18cc9f;});}return null;};}function removeEntity(_0x4d21e5,_0x224ff6){return function(_0x49c140){if(_0x49c140){return _0x49c140[_0x77e1('0x23')]()[_0x77e1('0x22')](function(){_0x4d21e5['status'](0xcc)[_0x77e1('0x18')]();});}};}function handleEntityNotFound(_0x49e248,_0x1517cc){return function(_0x9da157){if(!_0x9da157){_0x49e248[_0x77e1('0x17')](0x194);}return _0x9da157;};}function handleError(_0x42107d,_0x1f4d87){_0x1f4d87=_0x1f4d87||0x1f4;return function(_0x306559){logger[_0x77e1('0x24')](_0x306559['stack']);if(_0x306559[_0x77e1('0x25')]){delete _0x306559[_0x77e1('0x25')];}_0x42107d[_0x77e1('0x19')](_0x1f4d87)[_0x77e1('0x26')](_0x306559);};}exports[_0x77e1('0x27')]=function(_0x1e2e12,_0x21c921){var _0x4021bb={},_0xc79507={},_0x11c662={'count':0x0,'rows':[]};var _0x3182f3=_['map'](db[_0x77e1('0x28')][_0x77e1('0x29')],function(_0x1096ec){return{'name':_0x1096ec[_0x77e1('0x2a')],'type':_0x1096ec[_0x77e1('0x2b')]['key']};});_0xc79507[_0x77e1('0x2c')]=_[_0x77e1('0x2d')](_0x3182f3,_0x77e1('0x25'));_0xc79507[_0x77e1('0x2e')]=_[_0x77e1('0x2f')](_0x1e2e12['query']);_0xc79507['filters']=_['intersection'](_0xc79507[_0x77e1('0x2c')],_0xc79507['query']);_0x4021bb['attributes']=_[_0x77e1('0x30')](_0xc79507['model'],qs[_0x77e1('0x31')](_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x31')]));_0x4021bb[_0x77e1('0x32')]=_0x4021bb[_0x77e1('0x32')][_0x77e1('0x33')]?_0x4021bb[_0x77e1('0x32')]:_0xc79507[_0x77e1('0x2c')];if(!_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x34')]('nolimit')){_0x4021bb[_0x77e1('0x1c')]=qs[_0x77e1('0x1c')](_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x1c')]);_0x4021bb[_0x77e1('0x1d')]=qs[_0x77e1('0x1d')](_0x1e2e12[_0x77e1('0x2e')]['offset']);}_0x4021bb['order']=qs[_0x77e1('0x35')](_0x1e2e12[_0x77e1('0x2e')]['sort']);_0x4021bb[_0x77e1('0x36')]=qs['filters'](_[_0x77e1('0x37')](_0x1e2e12['query'],_0xc79507[_0x77e1('0x38')]),_0x3182f3);if(_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x39')]){_0x4021bb[_0x77e1('0x36')]=_[_0x77e1('0x3a')](_0x4021bb[_0x77e1('0x36')],{'$or':_[_0x77e1('0x2d')](_0x3182f3,function(_0x42c93f){if(_0x42c93f[_0x77e1('0x2b')]!==_0x77e1('0x3b')){var _0x46d07f={};_0x46d07f[_0x42c93f['name']]={'$like':'%'+_0x1e2e12['query'][_0x77e1('0x39')]+'%'};return _0x46d07f;}})});}_0x4021bb=_[_0x77e1('0x3a')]({},_0x4021bb,_0x1e2e12[_0x77e1('0x3c')]);var _0x342e6c={'where':_0x4021bb[_0x77e1('0x36')]};return db[_0x77e1('0x28')][_0x77e1('0x3d')](_0x342e6c)[_0x77e1('0x22')](function(_0x5b396b){_0x11c662[_0x77e1('0x3d')]=_0x5b396b;if(_0x1e2e12[_0x77e1('0x2e')][_0x77e1('0x3e')]){_0x4021bb['include']=[{'all':!![]}];}return db[_0x77e1('0x28')]['findAll'](_0x4021bb);})['then'](function(_0x152b0e){_0x11c662[_0x77e1('0x3f')]=_0x152b0e;return _0x11c662;})[_0x77e1('0x22')](respondWithFilteredResult(_0x21c921,_0x4021bb))[_0x77e1('0x40')](handleError(_0x21c921,null));};exports[_0x77e1('0x41')]=function(_0x282373,_0x34db09){var _0x419519={'raw':!![],'where':{'id':_0x282373[_0x77e1('0x42')]['id']}},_0x27c78d={};_0x27c78d[_0x77e1('0x2c')]=_['keys'](db[_0x77e1('0x28')]['rawAttributes']);_0x27c78d[_0x77e1('0x2e')]=_['keys'](_0x282373[_0x77e1('0x2e')]);_0x27c78d[_0x77e1('0x38')]=_[_0x77e1('0x30')](_0x27c78d['model'],_0x27c78d[_0x77e1('0x2e')]);_0x419519['attributes']=_[_0x77e1('0x30')](_0x27c78d[_0x77e1('0x2c')],qs[_0x77e1('0x31')](_0x282373[_0x77e1('0x2e')]['fields']));_0x419519[_0x77e1('0x32')]=_0x419519[_0x77e1('0x32')][_0x77e1('0x33')]?_0x419519['attributes']:_0x27c78d[_0x77e1('0x2c')];if(_0x282373[_0x77e1('0x2e')][_0x77e1('0x3e')]){_0x419519['include']=[{'all':!![]}];}_0x419519=_[_0x77e1('0x3a')]({},_0x419519,_0x282373[_0x77e1('0x3c')]);return db[_0x77e1('0x28')][_0x77e1('0x43')](_0x419519)[_0x77e1('0x22')](handleEntityNotFound(_0x34db09,null))[_0x77e1('0x22')](respondWithResult(_0x34db09,null))[_0x77e1('0x40')](handleError(_0x34db09,null));};exports[_0x77e1('0x44')]=function(_0x505ea3,_0x2867eb){return db[_0x77e1('0x28')][_0x77e1('0x44')](_0x505ea3[_0x77e1('0x45')],{})['then'](respondWithResult(_0x2867eb,0xc9))[_0x77e1('0x40')](handleError(_0x2867eb,null));};exports[_0x77e1('0x21')]=function(_0x186ed5,_0x264e3a){if(_0x186ed5[_0x77e1('0x45')]['id']){delete _0x186ed5[_0x77e1('0x45')]['id'];}return db[_0x77e1('0x28')][_0x77e1('0x43')]({'where':{'id':_0x186ed5[_0x77e1('0x42')]['id']}})[_0x77e1('0x22')](handleEntityNotFound(_0x264e3a,null))[_0x77e1('0x22')](saveUpdates(_0x186ed5[_0x77e1('0x45')],null))[_0x77e1('0x22')](respondWithResult(_0x264e3a,null))[_0x77e1('0x40')](handleError(_0x264e3a,null));};exports['destroy']=function(_0xab4ed6,_0x51c878){return db[_0x77e1('0x28')][_0x77e1('0x43')]({'where':{'id':_0xab4ed6[_0x77e1('0x42')]['id']}})[_0x77e1('0x22')](handleEntityNotFound(_0x51c878,null))['then'](removeEntity(_0x51c878,null))[_0x77e1('0x40')](handleError(_0x51c878,null));}; \ No newline at end of file +var _0x29d6=['update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','filters','pick','merge','where','type','VIRTUAL','filter','options','includeAll','include','catch','show','params','create','body','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x29d6,0x70));var _0x629d=function(_0x57234a,_0x54e907){_0x57234a=_0x57234a-0x0;var _0x4b3d5f=_0x29d6[_0x57234a];return _0x4b3d5f;};'use strict';var emlformat=require(_0x629d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x629d('0x1'));var jsonpatch=require(_0x629d('0x2'));var rp=require(_0x629d('0x3'));var moment=require(_0x629d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x629d('0x5'));var util=require(_0x629d('0x6'));var path=require('path');var sox=require(_0x629d('0x7'));var csv=require(_0x629d('0x8'));var ejs=require(_0x629d('0x9'));var fs=require('fs');var fs_extra=require(_0x629d('0xa'));var _=require(_0x629d('0xb'));var squel=require(_0x629d('0xc'));var crypto=require(_0x629d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x629d('0xe'));var Papa=require(_0x629d('0xf'));var Redis=require(_0x629d('0x10'));var authService=require(_0x629d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x629d('0x12'));var hardwareService=require(_0x629d('0x13'));var logger=require(_0x629d('0x14'))('api');var utils=require(_0x629d('0x15'));var config=require(_0x629d('0x16'));var licenseUtil=require(_0x629d('0x17'));var db=require(_0x629d('0x18'))['db'];function respondWithStatusCode(_0x29dd24,_0x3ec257){_0x3ec257=_0x3ec257||0xcc;return function(_0x3a9eef){if(_0x3a9eef){return _0x29dd24[_0x629d('0x19')](_0x3ec257);}return _0x29dd24[_0x629d('0x1a')](_0x3ec257)[_0x629d('0x1b')]();};}function respondWithResult(_0x17c52f,_0x191a81){_0x191a81=_0x191a81||0xc8;return function(_0x25f29b){if(_0x25f29b){return _0x17c52f[_0x629d('0x1a')](_0x191a81)[_0x629d('0x1c')](_0x25f29b);}};}function respondWithFilteredResult(_0x22fef0,_0x14d1c8){return function(_0x1cf610){if(_0x1cf610){var _0x31ebaa=typeof _0x14d1c8[_0x629d('0x1d')]===_0x629d('0x1e')&&typeof _0x14d1c8[_0x629d('0x1f')]===_0x629d('0x1e');var _0x58c679=_0x1cf610['count'];var _0x1e9782=_0x31ebaa?0x0:_0x14d1c8[_0x629d('0x1d')];var _0x58811a=_0x31ebaa?_0x1cf610[_0x629d('0x20')]:_0x14d1c8['offset']+_0x14d1c8[_0x629d('0x1f')];var _0x3022e1;if(_0x58811a>=_0x58c679){_0x58811a=_0x58c679;_0x3022e1=0xc8;}else{_0x3022e1=0xce;}_0x22fef0['status'](_0x3022e1);return _0x22fef0[_0x629d('0x21')]('Content-Range',_0x1e9782+'-'+_0x58811a+'/'+_0x58c679)[_0x629d('0x1c')](_0x1cf610);}return null;};}function patchUpdates(_0x1fa233){return function(_0x1f6bf1){try{jsonpatch[_0x629d('0x22')](_0x1f6bf1,_0x1fa233,!![]);}catch(_0x540d70){return BPromise['reject'](_0x540d70);}return _0x1f6bf1[_0x629d('0x23')]();};}function saveUpdates(_0x2d9433,_0x1cfbd7){return function(_0x4ab5a5){if(_0x4ab5a5){return _0x4ab5a5[_0x629d('0x24')](_0x2d9433)[_0x629d('0x25')](function(_0x57e771){return _0x57e771;});}return null;};}function removeEntity(_0xbe198d,_0x448104){return function(_0x1fe0b0){if(_0x1fe0b0){return _0x1fe0b0['destroy']()[_0x629d('0x25')](function(){_0xbe198d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ba1f9,_0x3558b3){return function(_0x42ac27){if(!_0x42ac27){_0x1ba1f9['sendStatus'](0x194);}return _0x42ac27;};}function handleError(_0x19294a,_0x255315){_0x255315=_0x255315||0x1f4;return function(_0x4bb998){logger[_0x629d('0x26')](_0x4bb998[_0x629d('0x27')]);if(_0x4bb998[_0x629d('0x28')]){delete _0x4bb998['name'];}_0x19294a[_0x629d('0x1a')](_0x255315)[_0x629d('0x29')](_0x4bb998);};}exports[_0x629d('0x2a')]=function(_0x17b949,_0x434aba){var _0x31520b={},_0x1b452e={},_0x185833={'count':0x0,'rows':[]};var _0x5ac8ed=_[_0x629d('0x2b')](db[_0x629d('0x2c')][_0x629d('0x2d')],function(_0x2c0168){return{'name':_0x2c0168[_0x629d('0x2e')],'type':_0x2c0168['type']['key']};});_0x1b452e[_0x629d('0x2f')]=_[_0x629d('0x2b')](_0x5ac8ed,_0x629d('0x28'));_0x1b452e[_0x629d('0x30')]=_[_0x629d('0x31')](_0x17b949[_0x629d('0x30')]);_0x1b452e['filters']=_[_0x629d('0x32')](_0x1b452e[_0x629d('0x2f')],_0x1b452e[_0x629d('0x30')]);_0x31520b['attributes']=_[_0x629d('0x32')](_0x1b452e[_0x629d('0x2f')],qs[_0x629d('0x33')](_0x17b949['query'][_0x629d('0x33')]));_0x31520b['attributes']=_0x31520b['attributes'][_0x629d('0x34')]?_0x31520b[_0x629d('0x35')]:_0x1b452e['model'];if(!_0x17b949[_0x629d('0x30')][_0x629d('0x36')](_0x629d('0x37'))){_0x31520b['limit']=qs[_0x629d('0x1f')](_0x17b949['query'][_0x629d('0x1f')]);_0x31520b[_0x629d('0x1d')]=qs[_0x629d('0x1d')](_0x17b949[_0x629d('0x30')][_0x629d('0x1d')]);}_0x31520b['order']=qs[_0x629d('0x38')](_0x17b949[_0x629d('0x30')][_0x629d('0x38')]);_0x31520b['where']=qs[_0x629d('0x39')](_[_0x629d('0x3a')](_0x17b949[_0x629d('0x30')],_0x1b452e[_0x629d('0x39')]),_0x5ac8ed);if(_0x17b949[_0x629d('0x30')]['filter']){_0x31520b['where']=_[_0x629d('0x3b')](_0x31520b[_0x629d('0x3c')],{'$or':_['map'](_0x5ac8ed,function(_0x229968){if(_0x229968[_0x629d('0x3d')]!==_0x629d('0x3e')){var _0x42fbaf={};_0x42fbaf[_0x229968[_0x629d('0x28')]]={'$like':'%'+_0x17b949['query'][_0x629d('0x3f')]+'%'};return _0x42fbaf;}})});}_0x31520b=_[_0x629d('0x3b')]({},_0x31520b,_0x17b949[_0x629d('0x40')]);var _0x15feeb={'where':_0x31520b[_0x629d('0x3c')]};return db[_0x629d('0x2c')][_0x629d('0x20')](_0x15feeb)[_0x629d('0x25')](function(_0x357fe0){_0x185833[_0x629d('0x20')]=_0x357fe0;if(_0x17b949['query'][_0x629d('0x41')]){_0x31520b[_0x629d('0x42')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x31520b);})[_0x629d('0x25')](function(_0x334955){_0x185833['rows']=_0x334955;return _0x185833;})[_0x629d('0x25')](respondWithFilteredResult(_0x434aba,_0x31520b))[_0x629d('0x43')](handleError(_0x434aba,null));};exports[_0x629d('0x44')]=function(_0xfa5792,_0x16cc0a){var _0x2bba1b={'raw':!![],'where':{'id':_0xfa5792[_0x629d('0x45')]['id']}},_0x35b99c={};_0x35b99c[_0x629d('0x2f')]=_['keys'](db[_0x629d('0x2c')][_0x629d('0x2d')]);_0x35b99c[_0x629d('0x30')]=_[_0x629d('0x31')](_0xfa5792[_0x629d('0x30')]);_0x35b99c[_0x629d('0x39')]=_[_0x629d('0x32')](_0x35b99c[_0x629d('0x2f')],_0x35b99c['query']);_0x2bba1b[_0x629d('0x35')]=_[_0x629d('0x32')](_0x35b99c[_0x629d('0x2f')],qs['fields'](_0xfa5792[_0x629d('0x30')]['fields']));_0x2bba1b['attributes']=_0x2bba1b[_0x629d('0x35')][_0x629d('0x34')]?_0x2bba1b[_0x629d('0x35')]:_0x35b99c[_0x629d('0x2f')];if(_0xfa5792[_0x629d('0x30')][_0x629d('0x41')]){_0x2bba1b[_0x629d('0x42')]=[{'all':!![]}];}_0x2bba1b=_[_0x629d('0x3b')]({},_0x2bba1b,_0xfa5792[_0x629d('0x40')]);return db[_0x629d('0x2c')]['find'](_0x2bba1b)[_0x629d('0x25')](handleEntityNotFound(_0x16cc0a,null))[_0x629d('0x25')](respondWithResult(_0x16cc0a,null))[_0x629d('0x43')](handleError(_0x16cc0a,null));};exports[_0x629d('0x46')]=function(_0x1f931e,_0x4f2c2a){return db['SugarcrmField'][_0x629d('0x46')](_0x1f931e[_0x629d('0x47')],{})[_0x629d('0x25')](respondWithResult(_0x4f2c2a,0xc9))[_0x629d('0x43')](handleError(_0x4f2c2a,null));};exports['update']=function(_0x4cbb96,_0x8a824d){if(_0x4cbb96['body']['id']){delete _0x4cbb96[_0x629d('0x47')]['id'];}return db[_0x629d('0x2c')]['find']({'where':{'id':_0x4cbb96[_0x629d('0x45')]['id']}})['then'](handleEntityNotFound(_0x8a824d,null))[_0x629d('0x25')](saveUpdates(_0x4cbb96[_0x629d('0x47')],null))[_0x629d('0x25')](respondWithResult(_0x8a824d,null))[_0x629d('0x43')](handleError(_0x8a824d,null));};exports[_0x629d('0x48')]=function(_0x100f4b,_0x3b24ad){return db[_0x629d('0x2c')][_0x629d('0x49')]({'where':{'id':_0x100f4b['params']['id']}})['then'](handleEntityNotFound(_0x3b24ad,null))[_0x629d('0x25')](removeEntity(_0x3b24ad,null))[_0x629d('0x43')](handleError(_0x3b24ad,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index cf95446..0d8ce98 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 _0x0597=['int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x0597,0x173));var _0x7059=function(_0x4f0171,_0x1c51aa){_0x4f0171=_0x4f0171-0x0;var _0x1c0155=_0x0597[_0x4f0171];return _0x1c0155;};'use strict';var _=require(_0x7059('0x0'));var util=require(_0x7059('0x1'));var logger=require(_0x7059('0x2'))(_0x7059('0x3'));var moment=require('moment');var BPromise=require(_0x7059('0x4'));var rp=require(_0x7059('0x5'));var fs=require('fs');var path=require(_0x7059('0x6'));var rimraf=require(_0x7059('0x7'));var config=require(_0x7059('0x8'));var attributes=require(_0x7059('0x9'));module[_0x7059('0xa')]=function(_0x5c9dce,_0x2f0845){return _0x5c9dce[_0x7059('0xb')](_0x7059('0xc'),attributes,{'tableName':_0x7059('0xd'),'paranoid':![],'indexes':[{'name':_0x7059('0xe'),'fields':[_0x7059('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40b2=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x274203,_0x4b64d3){var _0xd52b29=function(_0x1d067c){while(--_0x1d067c){_0x274203['push'](_0x274203['shift']());}};_0xd52b29(++_0x4b64d3);}(_0x40b2,0x1b6));var _0x240b=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x40b2[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x240b('0x0'));var util=require('util');var logger=require(_0x240b('0x1'))('api');var moment=require(_0x240b('0x2'));var BPromise=require(_0x240b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x240b('0x4'));var rimraf=require('rimraf');var config=require(_0x240b('0x5'));var attributes=require(_0x240b('0x6'));module[_0x240b('0x7')]=function(_0x18bdc2,_0x3d838){return _0x18bdc2[_0x240b('0x8')](_0x240b('0x9'),attributes,{'tableName':_0x240b('0xa'),'paranoid':![],'indexes':[{'name':_0x240b('0xb'),'fields':[_0x240b('0xc'),_0x240b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 36ad5e5..2dcadc1 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 _0xe200=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x52876c,_0x4ba4c7){var _0x38e085=function(_0x519d3f){while(--_0x519d3f){_0x52876c['push'](_0x52876c['shift']());}};_0x38e085(++_0x4ba4c7);}(_0xe200,0xed));var _0x0e20=function(_0x4a107e,_0x4de2f8){_0x4a107e=_0x4a107e-0x0;var _0x5ba66d=_0xe200[_0x4a107e];return _0x5ba66d;};'use strict';var _=require(_0x0e20('0x0'));var util=require(_0x0e20('0x1'));var moment=require(_0x0e20('0x2'));var BPromise=require(_0x0e20('0x3'));var rs=require(_0x0e20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e20('0x5'))['db'];var utils=require(_0x0e20('0x6'));var logger=require(_0x0e20('0x7'))('rpc');var config=require(_0x0e20('0x8'));var jayson=require(_0x0e20('0x9'));var client=jayson[_0x0e20('0xa')][_0x0e20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e0699,_0x2e7e4a,_0x465ec1){return new BPromise(function(_0x50ebfd,_0x57669d){return client['request'](_0x4e0699,_0x465ec1)[_0x0e20('0xc')](function(_0x21614b){logger['info'](_0x0e20('0xd'),_0x2e7e4a,_0x0e20('0xe'));logger[_0x0e20('0xf')](_0x0e20('0x10'),_0x2e7e4a,_0x0e20('0xe'),JSON[_0x0e20('0x11')](_0x21614b));if(_0x21614b[_0x0e20('0x12')]){if(_0x21614b['error'][_0x0e20('0x13')]===0x1f4){logger[_0x0e20('0x12')](_0x0e20('0xd'),_0x2e7e4a,_0x21614b[_0x0e20('0x12')][_0x0e20('0x14')]);return _0x57669d(_0x21614b[_0x0e20('0x12')][_0x0e20('0x14')]);}logger['error'](_0x0e20('0xd'),_0x2e7e4a,_0x21614b[_0x0e20('0x12')][_0x0e20('0x14')]);return _0x50ebfd(_0x21614b[_0x0e20('0x12')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x2e7e4a,_0x0e20('0xe'));_0x50ebfd(_0x21614b['result'][_0x0e20('0x14')]);}})['catch'](function(_0x360690){logger[_0x0e20('0x12')](_0x0e20('0xd'),_0x2e7e4a,_0x360690);_0x57669d(_0x360690);});});} \ No newline at end of file +var _0x48aa=['../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x48aa,0x6c));var _0xa48a=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x48aa[_0x4fe19c];return _0x952ac7;};'use strict';var _=require(_0xa48a('0x0'));var util=require(_0xa48a('0x1'));var moment=require(_0xa48a('0x2'));var BPromise=require(_0xa48a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa48a('0x4'));var db=require(_0xa48a('0x5'))['db'];var utils=require(_0xa48a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa48a('0x7'));var jayson=require(_0xa48a('0x8'));var client=jayson[_0xa48a('0x9')][_0xa48a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ae2d2,_0x4ddbfd,_0xfde729){return new BPromise(function(_0x3f692c,_0x2346f1){return client[_0xa48a('0xb')](_0x3ae2d2,_0xfde729)[_0xa48a('0xc')](function(_0x2f6474){logger[_0xa48a('0xd')](_0xa48a('0xe'),_0x4ddbfd,_0xa48a('0xf'));logger[_0xa48a('0x10')](_0xa48a('0x11'),_0x4ddbfd,'request\x20sent',JSON[_0xa48a('0x12')](_0x2f6474));if(_0x2f6474[_0xa48a('0x13')]){if(_0x2f6474[_0xa48a('0x13')][_0xa48a('0x14')]===0x1f4){logger[_0xa48a('0x13')](_0xa48a('0xe'),_0x4ddbfd,_0x2f6474[_0xa48a('0x13')]['message']);return _0x2346f1(_0x2f6474[_0xa48a('0x13')]['message']);}logger[_0xa48a('0x13')](_0xa48a('0xe'),_0x4ddbfd,_0x2f6474[_0xa48a('0x13')][_0xa48a('0x15')]);return _0x3f692c(_0x2f6474[_0xa48a('0x13')][_0xa48a('0x15')]);}else{logger['info'](_0xa48a('0xe'),_0x4ddbfd,_0xa48a('0xf'));_0x3f692c(_0x2f6474[_0xa48a('0x16')][_0xa48a('0x15')]);}})['catch'](function(_0x2a683a){logger[_0xa48a('0x13')](_0xa48a('0xe'),_0x4ddbfd,_0x2a683a);_0x2346f1(_0x2a683a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9c86630..5efbb86 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 _0x0851=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0851,0x8a));var _0x1085=function(_0x2238fa,_0x46243c){_0x2238fa=_0x2238fa-0x0;var _0x8e1006=_0x0851[_0x2238fa];return _0x8e1006;};'use strict';var multer=require(_0x1085('0x0'));var util=require(_0x1085('0x1'));var path=require(_0x1085('0x2'));var timeout=require(_0x1085('0x3'));var express=require('express');var router=express[_0x1085('0x4')]();var fs_extra=require(_0x1085('0x5'));var auth=require(_0x1085('0x6'));var interaction=require(_0x1085('0x7'));var config=require(_0x1085('0x8'));var controller=require(_0x1085('0x9'));router[_0x1085('0xa')]('/',auth[_0x1085('0xb')](),controller[_0x1085('0xc')]);router[_0x1085('0xa')](_0x1085('0xd'),auth[_0x1085('0xb')](),controller['show']);router['get'](_0x1085('0xe'),auth[_0x1085('0xb')](),controller[_0x1085('0xf')]);router[_0x1085('0xa')](_0x1085('0x10'),auth[_0x1085('0xb')](),controller['getFields']);router[_0x1085('0x11')]('/',auth[_0x1085('0xb')](),controller[_0x1085('0x12')]);router[_0x1085('0x11')](_0x1085('0xe'),auth[_0x1085('0xb')](),controller[_0x1085('0x13')]);router[_0x1085('0x14')](_0x1085('0xd'),auth[_0x1085('0xb')](),controller[_0x1085('0x15')]);router['delete'](_0x1085('0xd'),auth['isAuthenticated'](),controller[_0x1085('0x16')]);module[_0x1085('0x17')]=router; \ No newline at end of file +var _0x2783=['isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46822d,_0x42b8b5){var _0x365a6c=function(_0x38e8be){while(--_0x38e8be){_0x46822d['push'](_0x46822d['shift']());}};_0x365a6c(++_0x42b8b5);}(_0x2783,0x1f2));var _0x3278=function(_0x591b38,_0x56a98f){_0x591b38=_0x591b38-0x0;var _0xf4b640=_0x2783[_0x591b38];return _0xf4b640;};'use strict';var multer=require(_0x3278('0x0'));var util=require('util');var path=require(_0x3278('0x1'));var timeout=require(_0x3278('0x2'));var express=require(_0x3278('0x3'));var router=express['Router']();var fs_extra=require(_0x3278('0x4'));var auth=require(_0x3278('0x5'));var interaction=require(_0x3278('0x6'));var config=require(_0x3278('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x3278('0x8')](),controller[_0x3278('0x9')]);router[_0x3278('0xa')](_0x3278('0xb'),auth['isAuthenticated'](),controller[_0x3278('0xc')]);router[_0x3278('0xa')](_0x3278('0xd'),auth[_0x3278('0x8')](),controller[_0x3278('0xe')]);router[_0x3278('0xa')](_0x3278('0xf'),auth['isAuthenticated'](),controller[_0x3278('0x10')]);router[_0x3278('0x11')]('/',auth[_0x3278('0x8')](),controller[_0x3278('0x12')]);router[_0x3278('0x11')](_0x3278('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3278('0x13')](_0x3278('0xb'),auth[_0x3278('0x8')](),controller[_0x3278('0x14')]);router[_0x3278('0x15')](_0x3278('0xb'),auth[_0x3278('0x8')](),controller['destroy']);module[_0x3278('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 95e8468..9eff2a3 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 _0xd207=['exports','STRING'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xd207,0x1ca));var _0x7d20=function(_0x5972bf,_0x3d4058){_0x5972bf=_0x5972bf-0x0;var _0x248bef=_0xd207[_0x5972bf];return _0x248bef;};'use strict';var Sequelize=require('sequelize');module[_0x7d20('0x0')]={'name':{'type':Sequelize[_0x7d20('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7d20('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7d20('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7d20('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7332=['exports','STRING','sequelize'];(function(_0x3359ad,_0x55332b){var _0x4a4fa3=function(_0x5eefcf){while(--_0x5eefcf){_0x3359ad['push'](_0x3359ad['shift']());}};_0x4a4fa3(++_0x55332b);}(_0x7332,0xb0));var _0x2733=function(_0x102e87,_0x14a9ab){_0x102e87=_0x102e87-0x0;var _0x342af0=_0x7332[_0x102e87];return _0x342af0;};'use strict';var Sequelize=require(_0x2733('0x0'));module[_0x2733('0x1')]={'name':{'type':Sequelize[_0x2733('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2733('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x2733('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2733('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2733('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 d2019b9..c8eb2dd 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 _0xfaf5=['rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','include','VtigerAccount','rows','catch','show','params','find','body','getConfigurations','VtigerConfiguration','length','hasOwnProperty','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','token','describe','result','sessionName','autogenerated','reference','remove','editable','label','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x26042f,_0x4cf1f1){var _0x10a8bf=function(_0x5ac0d6){while(--_0x5ac0d6){_0x26042f['push'](_0x26042f['shift']());}};_0x10a8bf(++_0x4cf1f1);}(_0xfaf5,0x197));var _0x5faf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaf5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5faf('0x0'));var rimraf=require(_0x5faf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5faf('0x2'));var rp=require(_0x5faf('0x3'));var moment=require(_0x5faf('0x4'));var BPromise=require(_0x5faf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5faf('0x6'));var sox=require(_0x5faf('0x7'));var csv=require('to-csv');var ejs=require(_0x5faf('0x8'));var fs=require('fs');var fs_extra=require(_0x5faf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5faf('0xa'));var jsforce=require(_0x5faf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5faf('0xc'));var querystring=require('querystring');var Papa=require(_0x5faf('0xd'));var Redis=require('ioredis');var authService=require(_0x5faf('0xe'));var qs=require(_0x5faf('0xf'));var as=require(_0x5faf('0x10'));var hardwareService=require(_0x5faf('0x11'));var logger=require(_0x5faf('0x12'))('api');var utils=require(_0x5faf('0x13'));var config=require(_0x5faf('0x14'));var licenseUtil=require(_0x5faf('0x15'));var db=require(_0x5faf('0x16'))['db'];var integrations=require(_0x5faf('0x17'));function respondWithStatusCode(_0x4a0ac1,_0x6c17ce){_0x6c17ce=_0x6c17ce||0xcc;return function(_0x189ebf){if(_0x189ebf){return _0x4a0ac1[_0x5faf('0x18')](_0x6c17ce);}return _0x4a0ac1[_0x5faf('0x19')](_0x6c17ce)['end']();};}function respondWithResult(_0x366d9e,_0x39897b){_0x39897b=_0x39897b||0xc8;return function(_0x3f8ba5){if(_0x3f8ba5){return _0x366d9e[_0x5faf('0x19')](_0x39897b)[_0x5faf('0x1a')](_0x3f8ba5);}};}function respondWithFilteredResult(_0x13066a,_0x2e9ada){return function(_0x27c8c7){if(_0x27c8c7){var _0x25a24e=typeof _0x2e9ada[_0x5faf('0x1b')]==='undefined'&&typeof _0x2e9ada['limit']==='undefined';var _0x1e194e=_0x27c8c7[_0x5faf('0x1c')];var _0x86d020=_0x25a24e?0x0:_0x2e9ada[_0x5faf('0x1b')];var _0x35af2a=_0x25a24e?_0x27c8c7['count']:_0x2e9ada[_0x5faf('0x1b')]+_0x2e9ada['limit'];var _0x3ceda8;if(_0x35af2a>=_0x1e194e){_0x35af2a=_0x1e194e;_0x3ceda8=0xc8;}else{_0x3ceda8=0xce;}_0x13066a[_0x5faf('0x19')](_0x3ceda8);return _0x13066a[_0x5faf('0x1d')]('Content-Range',_0x86d020+'-'+_0x35af2a+'/'+_0x1e194e)[_0x5faf('0x1a')](_0x27c8c7);}return null;};}function patchUpdates(_0x28925b){return function(_0x35a72f){try{jsonpatch[_0x5faf('0x1e')](_0x35a72f,_0x28925b,!![]);}catch(_0x1d3e4c){return BPromise[_0x5faf('0x1f')](_0x1d3e4c);}return _0x35a72f[_0x5faf('0x20')]();};}function saveUpdates(_0x55ee0b,_0x350213){return function(_0x23e7ea){if(_0x23e7ea){return _0x23e7ea[_0x5faf('0x21')](_0x55ee0b)[_0x5faf('0x22')](function(_0x574600){return _0x574600;});}return null;};}function removeEntity(_0xe639f9,_0x120b13){return function(_0x57b612){if(_0x57b612){return _0x57b612[_0x5faf('0x23')]()[_0x5faf('0x22')](function(){_0xe639f9[_0x5faf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff0367,_0x3b68dc){return function(_0x4b12fa){if(!_0x4b12fa){_0xff0367[_0x5faf('0x18')](0x194);}return _0x4b12fa;};}function handleError(_0x2f35f5,_0x1f4fda){_0x1f4fda=_0x1f4fda||0x1f4;return function(_0x1615f1){logger[_0x5faf('0x24')](_0x1615f1[_0x5faf('0x25')]);if(_0x1615f1[_0x5faf('0x26')]){delete _0x1615f1[_0x5faf('0x26')];}_0x2f35f5['status'](_0x1f4fda)[_0x5faf('0x27')](_0x1615f1);};}exports['index']=function(_0xa9d69e,_0x4cf80d){var _0x5f4a34={},_0x5bc064={},_0x2de228={'count':0x0,'rows':[]};var _0x529710=_[_0x5faf('0x28')](db['VtigerAccount'][_0x5faf('0x29')],function(_0x42b76c){return{'name':_0x42b76c[_0x5faf('0x2a')],'type':_0x42b76c[_0x5faf('0x2b')][_0x5faf('0x2c')]};});_0x5bc064[_0x5faf('0x2d')]=_['map'](_0x529710,'name');_0x5bc064['query']=_[_0x5faf('0x2e')](_0xa9d69e['query']);_0x5bc064['filters']=_[_0x5faf('0x2f')](_0x5bc064[_0x5faf('0x2d')],_0x5bc064[_0x5faf('0x30')]);_0x5f4a34[_0x5faf('0x31')]=_['intersection'](_0x5bc064[_0x5faf('0x2d')],qs[_0x5faf('0x32')](_0xa9d69e['query']['fields']));_0x5f4a34[_0x5faf('0x31')]=_0x5f4a34['attributes']['length']?_0x5f4a34[_0x5faf('0x31')]:_0x5bc064[_0x5faf('0x2d')];if(!_0xa9d69e[_0x5faf('0x30')]['hasOwnProperty'](_0x5faf('0x33'))){_0x5f4a34[_0x5faf('0x34')]=qs['limit'](_0xa9d69e[_0x5faf('0x30')]['limit']);_0x5f4a34[_0x5faf('0x1b')]=qs['offset'](_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x1b')]);}_0x5f4a34[_0x5faf('0x35')]=qs[_0x5faf('0x36')](_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x36')]);_0x5f4a34[_0x5faf('0x37')]=qs[_0x5faf('0x38')](_['pick'](_0xa9d69e[_0x5faf('0x30')],_0x5bc064[_0x5faf('0x38')]),_0x529710);if(_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x39')]){_0x5f4a34[_0x5faf('0x37')]=_['merge'](_0x5f4a34['where'],{'$or':_['map'](_0x529710,function(_0xaa80ec){if(_0xaa80ec[_0x5faf('0x2b')]!=='VIRTUAL'){var _0x36e072={};_0x36e072[_0xaa80ec['name']]={'$like':'%'+_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x39')]+'%'};return _0x36e072;}})});}_0x5f4a34=_[_0x5faf('0x3a')]({},_0x5f4a34,_0xa9d69e[_0x5faf('0x3b')]);var _0x254374={'where':_0x5f4a34[_0x5faf('0x37')]};return db['VtigerAccount'][_0x5faf('0x1c')](_0x254374)[_0x5faf('0x22')](function(_0xc04509){_0x2de228[_0x5faf('0x1c')]=_0xc04509;if(_0xa9d69e[_0x5faf('0x30')][_0x5faf('0x3c')]){_0x5f4a34[_0x5faf('0x3d')]=[{'all':!![]}];}return db[_0x5faf('0x3e')]['findAll'](_0x5f4a34);})[_0x5faf('0x22')](function(_0x560a45){_0x2de228[_0x5faf('0x3f')]=_0x560a45;return _0x2de228;})[_0x5faf('0x22')](respondWithFilteredResult(_0x4cf80d,_0x5f4a34))[_0x5faf('0x40')](handleError(_0x4cf80d,null));};exports[_0x5faf('0x41')]=function(_0x548cf8,_0x4b5e4b){var _0x33c72d={'raw':![],'where':{'id':_0x548cf8[_0x5faf('0x42')]['id']}},_0x3fec56={};_0x3fec56[_0x5faf('0x2d')]=_['keys'](db[_0x5faf('0x3e')][_0x5faf('0x29')]);_0x3fec56[_0x5faf('0x30')]=_[_0x5faf('0x2e')](_0x548cf8[_0x5faf('0x30')]);_0x3fec56['filters']=_['intersection'](_0x3fec56[_0x5faf('0x2d')],_0x3fec56[_0x5faf('0x30')]);_0x33c72d['attributes']=_['intersection'](_0x3fec56[_0x5faf('0x2d')],qs[_0x5faf('0x32')](_0x548cf8[_0x5faf('0x30')][_0x5faf('0x32')]));_0x33c72d[_0x5faf('0x31')]=_0x33c72d[_0x5faf('0x31')]['length']?_0x33c72d[_0x5faf('0x31')]:_0x3fec56[_0x5faf('0x2d')];if(_0x548cf8[_0x5faf('0x30')]['includeAll']){_0x33c72d[_0x5faf('0x3d')]=[{'all':!![]}];}_0x33c72d=_['merge']({},_0x33c72d,_0x548cf8['options']);return db['VtigerAccount'][_0x5faf('0x43')](_0x33c72d)[_0x5faf('0x22')](handleEntityNotFound(_0x4b5e4b,null))[_0x5faf('0x22')](respondWithResult(_0x4b5e4b,null))[_0x5faf('0x40')](handleError(_0x4b5e4b,null));};exports['create']=function(_0x579035,_0x38067b){return db[_0x5faf('0x3e')]['create'](_0x579035[_0x5faf('0x44')],{})[_0x5faf('0x22')](respondWithResult(_0x38067b,0xc9))['catch'](handleError(_0x38067b,null));};exports[_0x5faf('0x21')]=function(_0x23a183,_0x2e2aed){if(_0x23a183[_0x5faf('0x44')]['id']){delete _0x23a183[_0x5faf('0x44')]['id'];}return db[_0x5faf('0x3e')]['find']({'where':{'id':_0x23a183['params']['id']}})['then'](handleEntityNotFound(_0x2e2aed,null))[_0x5faf('0x22')](saveUpdates(_0x23a183[_0x5faf('0x44')],null))[_0x5faf('0x22')](respondWithResult(_0x2e2aed,null))['catch'](handleError(_0x2e2aed,null));};exports['destroy']=function(_0x31994d,_0x4c4061){return db[_0x5faf('0x3e')]['find']({'where':{'id':_0x31994d[_0x5faf('0x42')]['id']}})[_0x5faf('0x22')](handleEntityNotFound(_0x4c4061,null))[_0x5faf('0x22')](removeEntity(_0x4c4061,null))[_0x5faf('0x40')](handleError(_0x4c4061,null));};exports[_0x5faf('0x45')]=function(_0x3e255c,_0x2df980,_0x851750){var _0xb2dda1={};var _0x1a0146={};var _0x408b50;var _0x547b29;return db[_0x5faf('0x3e')]['findOne']({'where':{'id':_0x3e255c[_0x5faf('0x42')]['id']}})['then'](handleEntityNotFound(_0x2df980,null))[_0x5faf('0x22')](function(_0x47376c){if(_0x47376c){_0x408b50=_0x47376c;_0x1a0146[_0x5faf('0x2d')]=_[_0x5faf('0x2e')](db[_0x5faf('0x46')][_0x5faf('0x29')]);_0x1a0146[_0x5faf('0x30')]=_['keys'](_0x3e255c[_0x5faf('0x30')]);_0x1a0146[_0x5faf('0x38')]=_[_0x5faf('0x2f')](_0x1a0146[_0x5faf('0x2d')],_0x1a0146[_0x5faf('0x30')]);_0xb2dda1[_0x5faf('0x31')]=_[_0x5faf('0x2f')](_0x1a0146['model'],qs[_0x5faf('0x32')](_0x3e255c[_0x5faf('0x30')][_0x5faf('0x32')]));_0xb2dda1[_0x5faf('0x31')]=_0xb2dda1[_0x5faf('0x31')][_0x5faf('0x47')]?_0xb2dda1[_0x5faf('0x31')]:_0x1a0146[_0x5faf('0x2d')];_0xb2dda1[_0x5faf('0x35')]=qs[_0x5faf('0x36')](_0x3e255c[_0x5faf('0x30')][_0x5faf('0x36')]);_0xb2dda1[_0x5faf('0x37')]=qs['filters'](_['pick'](_0x3e255c[_0x5faf('0x30')],_0x1a0146['filters']));if(_0x3e255c[_0x5faf('0x30')][_0x5faf('0x39')]){_0xb2dda1[_0x5faf('0x37')]=_[_0x5faf('0x3a')](_0xb2dda1[_0x5faf('0x37')],{'$or':_[_0x5faf('0x28')](_0xb2dda1[_0x5faf('0x31')],function(_0x114f30){var _0x401bb7={};_0x401bb7[_0x114f30]={'$like':'%'+_0x3e255c['query']['filter']+'%'};return _0x401bb7;})});}_0xb2dda1=_[_0x5faf('0x3a')]({},_0xb2dda1,_0x3e255c[_0x5faf('0x3b')]);return _0x408b50[_0x5faf('0x45')](_0xb2dda1);}})[_0x5faf('0x22')](function(_0x11e9e4){if(_0x11e9e4){_0x547b29=_0x11e9e4['length'];if(!_0x3e255c[_0x5faf('0x30')][_0x5faf('0x48')](_0x5faf('0x33'))){_0xb2dda1[_0x5faf('0x34')]=qs[_0x5faf('0x34')](_0x3e255c[_0x5faf('0x30')][_0x5faf('0x34')]);_0xb2dda1[_0x5faf('0x1b')]=qs[_0x5faf('0x1b')](_0x3e255c[_0x5faf('0x30')][_0x5faf('0x1b')]);}return _0x408b50[_0x5faf('0x45')](_0xb2dda1);}})[_0x5faf('0x22')](function(_0x35f6dc){if(_0x35f6dc){return _0x35f6dc?{'count':_0x547b29,'rows':_0x35f6dc}:null;}})[_0x5faf('0x22')](respondWithResult(_0x2df980,null))[_0x5faf('0x40')](handleError(_0x2df980,null));};exports[_0x5faf('0x49')]=function(_0x340f8e,_0x36c746,_0x14fd08){if(_0x340f8e[_0x5faf('0x44')]['id']){delete _0x340f8e[_0x5faf('0x44')]['id'];}return db[_0x5faf('0x3e')]['findOne']({'where':{'id':_0x340f8e[_0x5faf('0x42')]['id']}})[_0x5faf('0x22')](handleEntityNotFound(_0x36c746,null))[_0x5faf('0x22')](function(_0x2b2872){if(_0x2b2872){_0x340f8e[_0x5faf('0x44')]['AccountId']=_0x2b2872['id'];_0x340f8e[_0x5faf('0x44')]['Subjects']=integrations[_0x5faf('0x4a')](_0x340f8e[_0x5faf('0x44')]['channel'],_0x340f8e[_0x5faf('0x44')][_0x5faf('0x2b')]);_0x340f8e['body'][_0x5faf('0x4b')]=integrations[_0x5faf('0x4c')](_0x340f8e['body'][_0x5faf('0x4d')],_0x340f8e[_0x5faf('0x44')][_0x5faf('0x2b')]);return db[_0x5faf('0x46')]['create'](_0x340f8e[_0x5faf('0x44')],{'include':[{'model':db[_0x5faf('0x4e')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x5faf('0x4b')}]});}return null;})[_0x5faf('0x22')](respondWithResult(_0x36c746,null))[_0x5faf('0x40')](handleError(_0x36c746,null));};var md5=require(_0x5faf('0x4f'));exports[_0x5faf('0x50')]=function(_0x3da539,_0x589911,_0x3526b1){var _0x2c204e=null;var _0x4dcb36=null;var _0x18ba53=null;var _0x5235bf=null;var _0x3a96db='';return db[_0x5faf('0x3e')]['findOne']({'where':{'id':_0x3da539[_0x5faf('0x42')]['id']},'attributes':['id',_0x5faf('0x26'),_0x5faf('0x51'),_0x5faf('0x52'),_0x5faf('0x53'),'remoteUri',_0x5faf('0x54'),'accessKey']})[_0x5faf('0x22')](handleEntityNotFound(_0x589911,null))[_0x5faf('0x22')](function(_0xacab3e){if(_0xacab3e){_0x2c204e=_0xacab3e[_0x5faf('0x51')];_0x4dcb36=_0xacab3e[_0x5faf('0x55')];_0x18ba53=_0xacab3e[_0x5faf('0x53')];_0x3a96db=_0xacab3e['remoteUri'];var _0x435016=_0x3a96db[_0x5faf('0x56')](-0x1);if(_0x435016==='/'){_0x3a96db=_0x3a96db['substring'](0x0,_0x3a96db[_0x5faf('0x57')](_0x435016));}_0x5235bf=util[_0x5faf('0x58')](_0x5faf('0x59'),_0x3a96db);var _0x295b6e={'method':_0x5faf('0x5a'),'uri':_0x5235bf,'qs':{'operation':_0x5faf('0x5b'),'username':_0xacab3e[_0x5faf('0x51')]},'json':!![]};return rp(_0x295b6e);}})[_0x5faf('0x22')](function(_0x61c1d){if(_0x61c1d[_0x5faf('0x5c')]){var _0x16246a={'method':'POST','uri':_0x5235bf,'form':{'operation':_0x5faf('0x5d'),'username':_0x2c204e,'accessKey':md5(_0x61c1d['result'][_0x5faf('0x5e')]+_0x4dcb36)},'json':!![]};return rp(_0x16246a);}})[_0x5faf('0x22')](function(_0x5411d4){if(_0x5411d4[_0x5faf('0x5c')]){var _0x66dad5={'method':'GET','uri':_0x5235bf,'qs':{'operation':_0x5faf('0x5f'),'username':_0x2c204e,'sessionName':_0x5411d4[_0x5faf('0x60')][_0x5faf('0x61')],'elementType':_0x18ba53},'json':!![]};return rp(_0x66dad5);}})['then'](function(_0x4995b3){if(_0x4995b3[_0x5faf('0x5c')]){var _0x1ad837=[_0x5faf('0x62'),_0x5faf('0x63'),'owner'];_[_0x5faf('0x64')](_0x4995b3[_0x5faf('0x60')][_0x5faf('0x32')],function(_0x262f9b){return _0x1ad837['includes'](_0x262f9b[_0x5faf('0x2b')][_0x5faf('0x26')]);});_[_0x5faf('0x64')](_0x4995b3[_0x5faf('0x60')][_0x5faf('0x32')],function(_0x1d9ca4){return _0x1d9ca4[_0x5faf('0x65')]==='false';});return{'count':_0x4995b3[_0x5faf('0x60')][_0x5faf('0x32')][_0x5faf('0x47')],'rows':_['map'](_0x4995b3[_0x5faf('0x60')][_0x5faf('0x32')],function(_0x39efc1){return{'id':_0x39efc1['name'],'name':_0x39efc1[_0x5faf('0x66')],'custom':_['startsWith'](_0x39efc1[_0x5faf('0x26')],_0x5faf('0x67'))?!![]:![],'options':_0x39efc1[_0x5faf('0x2b')][_0x5faf('0x26')]===_0x5faf('0x68')&&_0x39efc1[_0x5faf('0x2b')][_0x5faf('0x69')][_0x5faf('0x47')]>0x0?_[_0x5faf('0x28')](_0x39efc1[_0x5faf('0x2b')][_0x5faf('0x69')],function(_0x356725){return{'name':_0x356725[_0x5faf('0x66')],'value':_0x356725[_0x5faf('0x6a')]};}):[]};})};}})[_0x5faf('0x22')](respondWithResult(_0x589911,null))['catch'](function(_0x366233){console['log'](_0x5faf('0x6b')+_0x366233);var _0x41bad1=_0x3da539[_0x5faf('0x30')]['test']?0x1f4:_0x366233[_0x5faf('0x6c')]||0x1f4;logger[_0x5faf('0x24')](_0x5faf('0x6d'),'getFields',_0x41bad1,JSON[_0x5faf('0x6e')](_0x366233));delete _0x366233[_0x5faf('0x26')];if(_0x41bad1===0x191){_0x41bad1=0x190;}_0x589911['status'](_0x41bad1)[_0x5faf('0x27')](_0x3da539[_0x5faf('0x30')]['test']?{'message':_0x5faf('0x6f'),'statusCode':_0x366233['statusCode']}:_0x366233);});}; \ No newline at end of file +var _0x7454=['%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','editable','startsWith','cf_','picklist','picklistValues','label','value','log','test','statusCode','stringify','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','VtigerAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','format'];(function(_0x1050ba,_0x5ad911){var _0x5a99a5=function(_0x30e240){while(--_0x30e240){_0x1050ba['push'](_0x1050ba['shift']());}};_0x5a99a5(++_0x5ad911);}(_0x7454,0x101));var _0x4745=function(_0x3e5147,_0x33eef9){_0x3e5147=_0x3e5147-0x0;var _0x18c779=_0x7454[_0x3e5147];return _0x18c779;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4745('0x0'));var zipdir=require(_0x4745('0x1'));var jsonpatch=require(_0x4745('0x2'));var rp=require(_0x4745('0x3'));var moment=require('moment');var BPromise=require(_0x4745('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4745('0x5'));var sox=require(_0x4745('0x6'));var csv=require(_0x4745('0x7'));var ejs=require(_0x4745('0x8'));var fs=require('fs');var fs_extra=require(_0x4745('0x9'));var _=require('lodash');var squel=require(_0x4745('0xa'));var crypto=require(_0x4745('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4745('0x7'));var querystring=require(_0x4745('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4745('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4745('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4745('0xf'));var utils=require(_0x4745('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4745('0x11'));var db=require(_0x4745('0x12'))['db'];var integrations=require(_0x4745('0x13'));function respondWithStatusCode(_0x501590,_0x2d661f){_0x2d661f=_0x2d661f||0xcc;return function(_0x599363){if(_0x599363){return _0x501590[_0x4745('0x14')](_0x2d661f);}return _0x501590[_0x4745('0x15')](_0x2d661f)[_0x4745('0x16')]();};}function respondWithResult(_0x317687,_0x55d3f7){_0x55d3f7=_0x55d3f7||0xc8;return function(_0x488856){if(_0x488856){return _0x317687['status'](_0x55d3f7)[_0x4745('0x17')](_0x488856);}};}function respondWithFilteredResult(_0x297c55,_0x16162f){return function(_0x229f25){if(_0x229f25){var _0x4a503f=typeof _0x16162f[_0x4745('0x18')]===_0x4745('0x19')&&typeof _0x16162f[_0x4745('0x1a')]===_0x4745('0x19');var _0x238aad=_0x229f25[_0x4745('0x1b')];var _0x25e5a8=_0x4a503f?0x0:_0x16162f[_0x4745('0x18')];var _0x2c8db4=_0x4a503f?_0x229f25[_0x4745('0x1b')]:_0x16162f['offset']+_0x16162f[_0x4745('0x1a')];var _0x396e32;if(_0x2c8db4>=_0x238aad){_0x2c8db4=_0x238aad;_0x396e32=0xc8;}else{_0x396e32=0xce;}_0x297c55['status'](_0x396e32);return _0x297c55[_0x4745('0x1c')](_0x4745('0x1d'),_0x25e5a8+'-'+_0x2c8db4+'/'+_0x238aad)[_0x4745('0x17')](_0x229f25);}return null;};}function patchUpdates(_0x1dde34){return function(_0xb86b72){try{jsonpatch['apply'](_0xb86b72,_0x1dde34,!![]);}catch(_0x139bfb){return BPromise[_0x4745('0x1e')](_0x139bfb);}return _0xb86b72[_0x4745('0x1f')]();};}function saveUpdates(_0x60715c,_0x31e2e7){return function(_0x4f4ec4){if(_0x4f4ec4){return _0x4f4ec4[_0x4745('0x20')](_0x60715c)[_0x4745('0x21')](function(_0x42f330){return _0x42f330;});}return null;};}function removeEntity(_0x3e0b04,_0x5ce4c7){return function(_0x19f685){if(_0x19f685){return _0x19f685[_0x4745('0x22')]()[_0x4745('0x21')](function(){_0x3e0b04[_0x4745('0x15')](0xcc)[_0x4745('0x16')]();});}};}function handleEntityNotFound(_0x455637,_0x4ff8ef){return function(_0x162ff7){if(!_0x162ff7){_0x455637[_0x4745('0x14')](0x194);}return _0x162ff7;};}function handleError(_0x4db253,_0x22edd9){_0x22edd9=_0x22edd9||0x1f4;return function(_0x57cbbe){logger[_0x4745('0x23')](_0x57cbbe[_0x4745('0x24')]);if(_0x57cbbe['name']){delete _0x57cbbe[_0x4745('0x25')];}_0x4db253[_0x4745('0x15')](_0x22edd9)[_0x4745('0x26')](_0x57cbbe);};}exports['index']=function(_0xbaec95,_0x3aa3e7){var _0x103641={},_0x3dea66={},_0x5018d1={'count':0x0,'rows':[]};var _0x4f88f0=_['map'](db[_0x4745('0x27')][_0x4745('0x28')],function(_0x5d3ff7){return{'name':_0x5d3ff7['fieldName'],'type':_0x5d3ff7[_0x4745('0x29')][_0x4745('0x2a')]};});_0x3dea66[_0x4745('0x2b')]=_['map'](_0x4f88f0,'name');_0x3dea66[_0x4745('0x2c')]=_[_0x4745('0x2d')](_0xbaec95[_0x4745('0x2c')]);_0x3dea66[_0x4745('0x2e')]=_[_0x4745('0x2f')](_0x3dea66[_0x4745('0x2b')],_0x3dea66[_0x4745('0x2c')]);_0x103641[_0x4745('0x30')]=_[_0x4745('0x2f')](_0x3dea66[_0x4745('0x2b')],qs[_0x4745('0x31')](_0xbaec95[_0x4745('0x2c')]['fields']));_0x103641[_0x4745('0x30')]=_0x103641[_0x4745('0x30')][_0x4745('0x32')]?_0x103641[_0x4745('0x30')]:_0x3dea66[_0x4745('0x2b')];if(!_0xbaec95[_0x4745('0x2c')][_0x4745('0x33')](_0x4745('0x34'))){_0x103641[_0x4745('0x1a')]=qs[_0x4745('0x1a')](_0xbaec95[_0x4745('0x2c')][_0x4745('0x1a')]);_0x103641[_0x4745('0x18')]=qs[_0x4745('0x18')](_0xbaec95[_0x4745('0x2c')][_0x4745('0x18')]);}_0x103641[_0x4745('0x35')]=qs[_0x4745('0x36')](_0xbaec95['query']['sort']);_0x103641[_0x4745('0x37')]=qs[_0x4745('0x2e')](_['pick'](_0xbaec95[_0x4745('0x2c')],_0x3dea66[_0x4745('0x2e')]),_0x4f88f0);if(_0xbaec95[_0x4745('0x2c')][_0x4745('0x38')]){_0x103641[_0x4745('0x37')]=_['merge'](_0x103641[_0x4745('0x37')],{'$or':_[_0x4745('0x39')](_0x4f88f0,function(_0x494ec7){if(_0x494ec7[_0x4745('0x29')]!==_0x4745('0x3a')){var _0x1a6cb8={};_0x1a6cb8[_0x494ec7[_0x4745('0x25')]]={'$like':'%'+_0xbaec95['query'][_0x4745('0x38')]+'%'};return _0x1a6cb8;}})});}_0x103641=_[_0x4745('0x3b')]({},_0x103641,_0xbaec95['options']);var _0x2cd31d={'where':_0x103641[_0x4745('0x37')]};return db['VtigerAccount'][_0x4745('0x1b')](_0x2cd31d)[_0x4745('0x21')](function(_0x76df6){_0x5018d1['count']=_0x76df6;if(_0xbaec95[_0x4745('0x2c')][_0x4745('0x3c')]){_0x103641[_0x4745('0x3d')]=[{'all':!![]}];}return db[_0x4745('0x27')][_0x4745('0x3e')](_0x103641);})[_0x4745('0x21')](function(_0x1e3483){_0x5018d1['rows']=_0x1e3483;return _0x5018d1;})[_0x4745('0x21')](respondWithFilteredResult(_0x3aa3e7,_0x103641))[_0x4745('0x3f')](handleError(_0x3aa3e7,null));};exports[_0x4745('0x40')]=function(_0x12a505,_0x49bdc8){var _0x40b1b3={'raw':![],'where':{'id':_0x12a505['params']['id']}},_0x198cf6={};_0x198cf6[_0x4745('0x2b')]=_[_0x4745('0x2d')](db[_0x4745('0x27')][_0x4745('0x28')]);_0x198cf6[_0x4745('0x2c')]=_[_0x4745('0x2d')](_0x12a505[_0x4745('0x2c')]);_0x198cf6[_0x4745('0x2e')]=_['intersection'](_0x198cf6['model'],_0x198cf6[_0x4745('0x2c')]);_0x40b1b3[_0x4745('0x30')]=_[_0x4745('0x2f')](_0x198cf6[_0x4745('0x2b')],qs[_0x4745('0x31')](_0x12a505[_0x4745('0x2c')][_0x4745('0x31')]));_0x40b1b3[_0x4745('0x30')]=_0x40b1b3[_0x4745('0x30')][_0x4745('0x32')]?_0x40b1b3[_0x4745('0x30')]:_0x198cf6[_0x4745('0x2b')];if(_0x12a505[_0x4745('0x2c')][_0x4745('0x3c')]){_0x40b1b3[_0x4745('0x3d')]=[{'all':!![]}];}_0x40b1b3=_[_0x4745('0x3b')]({},_0x40b1b3,_0x12a505[_0x4745('0x41')]);return db[_0x4745('0x27')][_0x4745('0x42')](_0x40b1b3)[_0x4745('0x21')](handleEntityNotFound(_0x49bdc8,null))[_0x4745('0x21')](respondWithResult(_0x49bdc8,null))[_0x4745('0x3f')](handleError(_0x49bdc8,null));};exports[_0x4745('0x43')]=function(_0x581ef8,_0xc25a0d){return db[_0x4745('0x27')][_0x4745('0x43')](_0x581ef8['body'],{})['then'](respondWithResult(_0xc25a0d,0xc9))['catch'](handleError(_0xc25a0d,null));};exports[_0x4745('0x20')]=function(_0x25c8c7,_0x6ed06f){if(_0x25c8c7['body']['id']){delete _0x25c8c7[_0x4745('0x44')]['id'];}return db[_0x4745('0x27')][_0x4745('0x42')]({'where':{'id':_0x25c8c7[_0x4745('0x45')]['id']}})[_0x4745('0x21')](handleEntityNotFound(_0x6ed06f,null))['then'](saveUpdates(_0x25c8c7[_0x4745('0x44')],null))['then'](respondWithResult(_0x6ed06f,null))[_0x4745('0x3f')](handleError(_0x6ed06f,null));};exports['destroy']=function(_0x9a82b8,_0x44d4ce){return db[_0x4745('0x27')][_0x4745('0x42')]({'where':{'id':_0x9a82b8['params']['id']}})['then'](handleEntityNotFound(_0x44d4ce,null))['then'](removeEntity(_0x44d4ce,null))[_0x4745('0x3f')](handleError(_0x44d4ce,null));};exports['getConfigurations']=function(_0x3ea8f2,_0xc99fc3,_0x5ca5e5){var _0x27e6d1={};var _0x572684={};var _0x11a6fb;var _0x26913e;return db['VtigerAccount'][_0x4745('0x46')]({'where':{'id':_0x3ea8f2[_0x4745('0x45')]['id']}})[_0x4745('0x21')](handleEntityNotFound(_0xc99fc3,null))['then'](function(_0x260f00){if(_0x260f00){_0x11a6fb=_0x260f00;_0x572684[_0x4745('0x2b')]=_['keys'](db[_0x4745('0x47')]['rawAttributes']);_0x572684['query']=_['keys'](_0x3ea8f2[_0x4745('0x2c')]);_0x572684[_0x4745('0x2e')]=_[_0x4745('0x2f')](_0x572684['model'],_0x572684[_0x4745('0x2c')]);_0x27e6d1['attributes']=_[_0x4745('0x2f')](_0x572684[_0x4745('0x2b')],qs[_0x4745('0x31')](_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x31')]));_0x27e6d1[_0x4745('0x30')]=_0x27e6d1[_0x4745('0x30')][_0x4745('0x32')]?_0x27e6d1[_0x4745('0x30')]:_0x572684[_0x4745('0x2b')];_0x27e6d1[_0x4745('0x35')]=qs[_0x4745('0x36')](_0x3ea8f2['query']['sort']);_0x27e6d1[_0x4745('0x37')]=qs[_0x4745('0x2e')](_['pick'](_0x3ea8f2[_0x4745('0x2c')],_0x572684['filters']));if(_0x3ea8f2[_0x4745('0x2c')]['filter']){_0x27e6d1[_0x4745('0x37')]=_['merge'](_0x27e6d1[_0x4745('0x37')],{'$or':_['map'](_0x27e6d1[_0x4745('0x30')],function(_0x534e74){var _0x53839d={};_0x53839d[_0x534e74]={'$like':'%'+_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x38')]+'%'};return _0x53839d;})});}_0x27e6d1=_[_0x4745('0x3b')]({},_0x27e6d1,_0x3ea8f2[_0x4745('0x41')]);return _0x11a6fb[_0x4745('0x48')](_0x27e6d1);}})[_0x4745('0x21')](function(_0x15076c){if(_0x15076c){_0x26913e=_0x15076c[_0x4745('0x32')];if(!_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x33')](_0x4745('0x34'))){_0x27e6d1[_0x4745('0x1a')]=qs[_0x4745('0x1a')](_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x1a')]);_0x27e6d1[_0x4745('0x18')]=qs[_0x4745('0x18')](_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x18')]);}return _0x11a6fb[_0x4745('0x48')](_0x27e6d1);}})[_0x4745('0x21')](function(_0x43025f){if(_0x43025f){return _0x43025f?{'count':_0x26913e,'rows':_0x43025f}:null;}})['then'](respondWithResult(_0xc99fc3,null))[_0x4745('0x3f')](handleError(_0xc99fc3,null));};exports[_0x4745('0x49')]=function(_0xc5d7a4,_0x11b68b,_0xa2a145){if(_0xc5d7a4[_0x4745('0x44')]['id']){delete _0xc5d7a4['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0xc5d7a4[_0x4745('0x45')]['id']}})[_0x4745('0x21')](handleEntityNotFound(_0x11b68b,null))[_0x4745('0x21')](function(_0x386a43){if(_0x386a43){_0xc5d7a4[_0x4745('0x44')][_0x4745('0x4a')]=_0x386a43['id'];_0xc5d7a4['body'][_0x4745('0x4b')]=integrations[_0x4745('0x4c')](_0xc5d7a4[_0x4745('0x44')][_0x4745('0x4d')],_0xc5d7a4[_0x4745('0x44')]['type']);_0xc5d7a4[_0x4745('0x44')]['Descriptions']=integrations[_0x4745('0x4e')](_0xc5d7a4[_0x4745('0x44')][_0x4745('0x4d')],_0xc5d7a4['body'][_0x4745('0x29')]);return db[_0x4745('0x47')]['create'](_0xc5d7a4[_0x4745('0x44')],{'include':[{'model':db[_0x4745('0x4f')],'as':_0x4745('0x4b')},{'model':db[_0x4745('0x4f')],'as':'Descriptions'}]});}return null;})[_0x4745('0x21')](respondWithResult(_0x11b68b,null))['catch'](handleError(_0x11b68b,null));};var md5=require('md5');exports[_0x4745('0x50')]=function(_0x96563f,_0x3fe3fa,_0x4b7f3a){var _0x4cfe78=null;var _0x1f54ca=null;var _0x11e3ed=null;var _0x13f89c=null;var _0x3ebed2='';return db[_0x4745('0x27')][_0x4745('0x46')]({'where':{'id':_0x96563f[_0x4745('0x45')]['id']},'attributes':['id',_0x4745('0x25'),_0x4745('0x51'),_0x4745('0x52'),'moduleName',_0x4745('0x53'),_0x4745('0x54'),_0x4745('0x55')]})[_0x4745('0x21')](handleEntityNotFound(_0x3fe3fa,null))[_0x4745('0x21')](function(_0xc6613b){if(_0xc6613b){_0x4cfe78=_0xc6613b[_0x4745('0x51')];_0x1f54ca=_0xc6613b[_0x4745('0x55')];_0x11e3ed=_0xc6613b[_0x4745('0x56')];_0x3ebed2=_0xc6613b[_0x4745('0x53')];var _0x3fd7c9=_0x3ebed2[_0x4745('0x57')](-0x1);if(_0x3fd7c9==='/'){_0x3ebed2=_0x3ebed2[_0x4745('0x58')](0x0,_0x3ebed2[_0x4745('0x59')](_0x3fd7c9));}_0x13f89c=util[_0x4745('0x5a')](_0x4745('0x5b'),_0x3ebed2);var _0x12aa74={'method':_0x4745('0x5c'),'uri':_0x13f89c,'qs':{'operation':_0x4745('0x5d'),'username':_0xc6613b[_0x4745('0x51')]},'json':!![]};return rp(_0x12aa74);}})[_0x4745('0x21')](function(_0x104a9c){if(_0x104a9c['success']){var _0x116b5c={'method':_0x4745('0x5e'),'uri':_0x13f89c,'form':{'operation':_0x4745('0x5f'),'username':_0x4cfe78,'accessKey':md5(_0x104a9c[_0x4745('0x60')][_0x4745('0x61')]+_0x1f54ca)},'json':!![]};return rp(_0x116b5c);}})[_0x4745('0x21')](function(_0x3d9e4c){if(_0x3d9e4c[_0x4745('0x62')]){var _0xbfbca6={'method':'GET','uri':_0x13f89c,'qs':{'operation':_0x4745('0x63'),'username':_0x4cfe78,'sessionName':_0x3d9e4c[_0x4745('0x60')][_0x4745('0x64')],'elementType':_0x11e3ed},'json':!![]};return rp(_0xbfbca6);}})['then'](function(_0x17a5cb){if(_0x17a5cb[_0x4745('0x62')]){var _0x3c8112=[_0x4745('0x65'),_0x4745('0x66'),_0x4745('0x67')];_[_0x4745('0x68')](_0x17a5cb[_0x4745('0x60')][_0x4745('0x31')],function(_0x400416){return _0x3c8112['includes'](_0x400416[_0x4745('0x29')]['name']);});_['remove'](_0x17a5cb['result'][_0x4745('0x31')],function(_0x2a01b9){return _0x2a01b9[_0x4745('0x69')]==='false';});return{'count':_0x17a5cb['result'][_0x4745('0x31')]['length'],'rows':_['map'](_0x17a5cb[_0x4745('0x60')]['fields'],function(_0x15451a){return{'id':_0x15451a[_0x4745('0x25')],'name':_0x15451a['label'],'custom':_[_0x4745('0x6a')](_0x15451a[_0x4745('0x25')],_0x4745('0x6b'))?!![]:![],'options':_0x15451a['type'][_0x4745('0x25')]===_0x4745('0x6c')&&_0x15451a[_0x4745('0x29')]['picklistValues']['length']>0x0?_[_0x4745('0x39')](_0x15451a['type'][_0x4745('0x6d')],function(_0x5ec505){return{'name':_0x5ec505[_0x4745('0x6e')],'value':_0x5ec505[_0x4745('0x6f')]};}):[]};})};}})[_0x4745('0x21')](respondWithResult(_0x3fe3fa,null))[_0x4745('0x3f')](function(_0x5b8b14){console[_0x4745('0x70')]('vTiger\x20error:\x20'+_0x5b8b14);var _0x432b14=_0x96563f[_0x4745('0x2c')][_0x4745('0x71')]?0x1f4:_0x5b8b14[_0x4745('0x72')]||0x1f4;logger[_0x4745('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x4745('0x50'),_0x432b14,JSON[_0x4745('0x73')](_0x5b8b14));delete _0x5b8b14[_0x4745('0x25')];if(_0x432b14===0x191){_0x432b14=0x190;}_0x3fe3fa[_0x4745('0x15')](_0x432b14)[_0x4745('0x26')](_0x96563f[_0x4745('0x2c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5b8b14[_0x4745('0x72')]}:_0x5b8b14);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 9e67828..02c697b 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 _0xc6d7=['../../components/integrations/configuration','exports','define','int_vtiger_accounts','../../config/logger','api','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x2f46e6,_0x14c14c){var _0x17d267=function(_0x2c0c99){while(--_0x2c0c99){_0x2f46e6['push'](_0x2f46e6['shift']());}};_0x17d267(++_0x14c14c);}(_0xc6d7,0x16f));var _0x7c6d=function(_0x1e3391,_0x2098c4){_0x1e3391=_0x1e3391-0x0;var _0xed3acb=_0xc6d7[_0x1e3391];return _0xed3acb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7c6d('0x0'))(_0x7c6d('0x1'));var moment=require(_0x7c6d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c6d('0x3'));var rimraf=require(_0x7c6d('0x4'));var config=require(_0x7c6d('0x5'));var attributes=require(_0x7c6d('0x6'));var integrations=require(_0x7c6d('0x7'));module[_0x7c6d('0x8')]=function(_0x384851,_0x23fb6c){return _0x384851[_0x7c6d('0x9')]('VtigerAccount',attributes,{'tableName':_0x7c6d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6f7=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util'];(function(_0x313756,_0x2c6c29){var _0x324e4e=function(_0x37e2ce){while(--_0x37e2ce){_0x313756['push'](_0x313756['shift']());}};_0x324e4e(++_0x2c6c29);}(_0xb6f7,0x1d3));var _0x7b6f=function(_0x4511f5,_0x39164e){_0x4511f5=_0x4511f5-0x0;var _0x32c890=_0xb6f7[_0x4511f5];return _0x32c890;};'use strict';var _=require('lodash');var util=require(_0x7b6f('0x0'));var logger=require(_0x7b6f('0x1'))(_0x7b6f('0x2'));var moment=require(_0x7b6f('0x3'));var BPromise=require(_0x7b6f('0x4'));var rp=require(_0x7b6f('0x5'));var fs=require('fs');var path=require(_0x7b6f('0x6'));var rimraf=require('rimraf');var config=require(_0x7b6f('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x7b6f('0x8'));module[_0x7b6f('0x9')]=function(_0x2b5e85,_0x5020ea){return _0x2b5e85[_0x7b6f('0xa')](_0x7b6f('0xb'),attributes,{'tableName':_0x7b6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 54d9aeb..3939638 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 _0xefda=['options','raw','attributes','include','map','model','ShowVtigerAccount','VtigerAccount','find','where','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','catch','GetVtigerAccount','findAll'];(function(_0x4b7582,_0x3fb424){var _0x33b14b=function(_0x33108b){while(--_0x33108b){_0x4b7582['push'](_0x4b7582['shift']());}};_0x33b14b(++_0x3fb424);}(_0xefda,0x96));var _0xaefd=function(_0xd25e89,_0x75ff39){_0xd25e89=_0xd25e89-0x0;var _0x303c0b=_0xefda[_0xd25e89];return _0x303c0b;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});}exports[_0xaefd('0x17')]=function(_0x9748f4){var _0x1737a1=this;return new Promise(function(_0x2db61b,_0x244956){return db['VtigerAccount'][_0xaefd('0x18')]({'raw':_0x9748f4[_0xaefd('0x19')]?_0x9748f4[_0xaefd('0x19')][_0xaefd('0x1a')]===undefined?!![]:![]:!![],'where':_0x9748f4[_0xaefd('0x19')]?_0x9748f4[_0xaefd('0x19')]['where']||null:null,'attributes':_0x9748f4[_0xaefd('0x19')]?_0x9748f4[_0xaefd('0x19')][_0xaefd('0x1b')]||null:null,'limit':_0x9748f4[_0xaefd('0x19')]?_0x9748f4[_0xaefd('0x19')]['limit']||null:null,'include':_0x9748f4['options']?_0x9748f4['options'][_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x9748f4[_0xaefd('0x19')]['include'],function(_0x23060f){return{'model':db[_0x23060f['model']],'as':_0x23060f['as'],'attributes':_0x23060f[_0xaefd('0x1b')],'include':_0x23060f[_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x23060f['include'],function(_0x435413){return{'model':db[_0x435413[_0xaefd('0x1e')]],'as':_0x435413['as'],'attributes':_0x435413[_0xaefd('0x1b')],'include':_0x435413[_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x435413['include'],function(_0x2fe27e){return{'model':db[_0x2fe27e['model']],'as':_0x2fe27e['as'],'attributes':_0x2fe27e[_0xaefd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaefd('0xb')](function(_0x5470bd){logger[_0xaefd('0x14')](_0xaefd('0x17'),_0x9748f4);logger['debug'](_0xaefd('0x17'),_0x9748f4,JSON[_0xaefd('0xf')](_0x5470bd));_0x2db61b(_0x5470bd);})[_0xaefd('0x16')](function(_0x4c0898){logger[_0xaefd('0x10')]('GetVtigerAccount',_0x4c0898[_0xaefd('0x13')],_0x9748f4);_0x244956(_0x1737a1['error'](0x1f4,_0x4c0898['message']));});});};exports[_0xaefd('0x1f')]=function(_0x1b470c){var _0x4a032d=this;return new Promise(function(_0x578378,_0x4ee0c1){return db[_0xaefd('0x20')][_0xaefd('0x21')]({'raw':_0x1b470c['options']?_0x1b470c['options'][_0xaefd('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b470c[_0xaefd('0x19')]?_0x1b470c[_0xaefd('0x19')][_0xaefd('0x22')]||null:null,'attributes':_0x1b470c['options']?_0x1b470c[_0xaefd('0x19')][_0xaefd('0x1b')]||null:null,'include':_0x1b470c[_0xaefd('0x19')]?_0x1b470c[_0xaefd('0x19')][_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x1b470c[_0xaefd('0x19')][_0xaefd('0x1c')],function(_0x3e3fe2){return{'model':db[_0x3e3fe2[_0xaefd('0x1e')]],'as':_0x3e3fe2['as'],'attributes':_0x3e3fe2[_0xaefd('0x1b')],'include':_0x3e3fe2[_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x3e3fe2[_0xaefd('0x1c')],function(_0x1ffec4){return{'model':db[_0x1ffec4[_0xaefd('0x1e')]],'as':_0x1ffec4['as'],'attributes':_0x1ffec4['attributes'],'include':_0x1ffec4[_0xaefd('0x1c')]?_[_0xaefd('0x1d')](_0x1ffec4[_0xaefd('0x1c')],function(_0x59aec9){return{'model':db[_0x59aec9[_0xaefd('0x1e')]],'as':_0x59aec9['as'],'attributes':_0x59aec9['attributes']};}):[]};}):[]};}):[]:[]})[_0xaefd('0xb')](function(_0x3498d9){logger[_0xaefd('0x14')](_0xaefd('0x1f'),_0x1b470c);logger[_0xaefd('0xd')](_0xaefd('0x1f'),_0x1b470c,JSON[_0xaefd('0xf')](_0x3498d9));_0x578378(_0x3498d9);})[_0xaefd('0x16')](function(_0x407bea){logger[_0xaefd('0x10')](_0xaefd('0x1f'),_0x407bea[_0xaefd('0x13')],_0x1b470c);_0x4ee0c1(_0x4a032d[_0xaefd('0x10')](0x1f4,_0x407bea[_0xaefd('0x13')]));});});}; \ No newline at end of file +var _0x2e54=['error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','map','include','model','ShowVtigerAccount','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5cfd35,_0x245a8f){var _0x1e8ab9=function(_0x461520){while(--_0x461520){_0x5cfd35['push'](_0x5cfd35['shift']());}};_0x1e8ab9(++_0x245a8f);}(_0x2e54,0x1dd));var _0x42e5=function(_0x75c665,_0x9ecc65){_0x75c665=_0x75c665-0x0;var _0xbf13c6=_0x2e54[_0x75c665];return _0xbf13c6;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['findAll']({'raw':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1a')]||null:null,'attributes':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1b')]||null:null,'limit':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['limit']||null:null,'include':_0x38282d['options']?_0x38282d[_0x42e5('0x18')]['include']?_[_0x42e5('0x1c')](_0x38282d[_0x42e5('0x18')][_0x42e5('0x1d')],function(_0x49490f){return{'model':db[_0x49490f[_0x42e5('0x1e')]],'as':_0x49490f['as'],'attributes':_0x49490f['attributes'],'include':_0x49490f[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x49490f[_0x42e5('0x1d')],function(_0x275c80){return{'model':db[_0x275c80[_0x42e5('0x1e')]],'as':_0x275c80['as'],'attributes':_0x275c80['attributes'],'include':_0x275c80['include']?_[_0x42e5('0x1c')](_0x275c80['include'],function(_0x56f812){return{'model':db[_0x56f812[_0x42e5('0x1e')]],'as':_0x56f812['as'],'attributes':_0x56f812['attributes']};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x2d9e65){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON['stringify'](_0x2d9e65));_0x23fe09(_0x2d9e65);})[_0x42e5('0x15')](function(_0x201d9e){logger[_0x42e5('0x12')](_0x42e5('0x16'),_0x201d9e[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x201d9e[_0x42e5('0x13')]));});});};exports[_0x42e5('0x1f')]=function(_0x5a4930){var _0x2ba9ef=this;return new Promise(function(_0x2c7542,_0x3d9e8b){return db[_0x42e5('0x17')]['find']({'raw':_0x5a4930[_0x42e5('0x18')]?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options']['where']||null:null,'attributes':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options'][_0x42e5('0x1b')]||null:null,'include':_0x5a4930['options']?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x5a4930['options'][_0x42e5('0x1d')],function(_0x3a8d1c){return{'model':db[_0x3a8d1c['model']],'as':_0x3a8d1c['as'],'attributes':_0x3a8d1c[_0x42e5('0x1b')],'include':_0x3a8d1c['include']?_[_0x42e5('0x1c')](_0x3a8d1c[_0x42e5('0x1d')],function(_0x25a040){return{'model':db[_0x25a040[_0x42e5('0x1e')]],'as':_0x25a040['as'],'attributes':_0x25a040[_0x42e5('0x1b')],'include':_0x25a040[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x25a040['include'],function(_0x5a18cc){return{'model':db[_0x5a18cc[_0x42e5('0x1e')]],'as':_0x5a18cc['as'],'attributes':_0x5a18cc[_0x42e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x4a1a8a){logger['info']('ShowVtigerAccount',_0x5a4930);logger['debug'](_0x42e5('0x1f'),_0x5a4930,JSON[_0x42e5('0x20')](_0x4a1a8a));_0x2c7542(_0x4a1a8a);})[_0x42e5('0x15')](function(_0xedb7bc){logger[_0x42e5('0x12')](_0x42e5('0x1f'),_0xedb7bc[_0x42e5('0x13')],_0x5a4930);_0x3d9e8b(_0x2ba9ef[_0x42e5('0x12')](0x1f4,_0xedb7bc['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 107f08f..ed54f6a 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 _0x4b89=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','/:id/fields'];(function(_0x26a818,_0x40708a){var _0x5d8ca0=function(_0x3cc7ed){while(--_0x3cc7ed){_0x26a818['push'](_0x26a818['shift']());}};_0x5d8ca0(++_0x40708a);}(_0x4b89,0x1c1));var _0x94b8=function(_0x5bcb0f,_0x221e89){_0x5bcb0f=_0x5bcb0f-0x0;var _0x57eec2=_0x4b89[_0x5bcb0f];return _0x57eec2;};'use strict';var multer=require(_0x94b8('0x0'));var util=require(_0x94b8('0x1'));var path=require(_0x94b8('0x2'));var timeout=require(_0x94b8('0x3'));var express=require('express');var router=express[_0x94b8('0x4')]();var fs_extra=require(_0x94b8('0x5'));var auth=require(_0x94b8('0x6'));var interaction=require(_0x94b8('0x7'));var config=require('../../config/environment');var controller=require(_0x94b8('0x8'));router['get']('/',auth[_0x94b8('0x9')](),controller['index']);router[_0x94b8('0xa')](_0x94b8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x94b8('0xa')](_0x94b8('0xc'),auth['isAuthenticated'](),controller[_0x94b8('0xd')]);router[_0x94b8('0xa')](_0x94b8('0xe'),auth[_0x94b8('0x9')](),controller[_0x94b8('0xf')]);router[_0x94b8('0xa')](_0x94b8('0x10'),auth[_0x94b8('0x9')](),controller[_0x94b8('0x11')]);router[_0x94b8('0x12')]('/',auth[_0x94b8('0x9')](),controller['create']);router['put'](_0x94b8('0xb'),auth['isAuthenticated'](),controller[_0x94b8('0x13')]);router['delete'](_0x94b8('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x94b8('0x14')]=router; \ No newline at end of file +var _0xbe01=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','exports','multer'];(function(_0x1f38c6,_0x428650){var _0x259367=function(_0x22bad0){while(--_0x22bad0){_0x1f38c6['push'](_0x1f38c6['shift']());}};_0x259367(++_0x428650);}(_0xbe01,0xaf));var _0x1be0=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xbe01[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x1be0('0x0'));var util=require('util');var path=require(_0x1be0('0x1'));var timeout=require('connect-timeout');var express=require(_0x1be0('0x2'));var router=express[_0x1be0('0x3')]();var fs_extra=require(_0x1be0('0x4'));var auth=require(_0x1be0('0x5'));var interaction=require(_0x1be0('0x6'));var config=require(_0x1be0('0x7'));var controller=require(_0x1be0('0x8'));router[_0x1be0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1be0('0x9')]('/:id',auth[_0x1be0('0xa')](),controller[_0x1be0('0xb')]);router[_0x1be0('0x9')](_0x1be0('0xc'),auth['isAuthenticated'](),controller[_0x1be0('0xd')]);router[_0x1be0('0x9')](_0x1be0('0xe'),auth['isAuthenticated'](),controller[_0x1be0('0xf')]);router[_0x1be0('0x9')](_0x1be0('0x10'),auth[_0x1be0('0xa')](),controller[_0x1be0('0x11')]);router['post']('/',auth[_0x1be0('0xa')](),controller['create']);router[_0x1be0('0x12')](_0x1be0('0x13'),auth[_0x1be0('0xa')](),controller[_0x1be0('0x14')]);router['delete'](_0x1be0('0x13'),auth[_0x1be0('0xa')](),controller['destroy']);module[_0x1be0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 00521ce..4d8eacb 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 _0x55f3=['sequelize','exports','STRING'];(function(_0x2abcdd,_0x341092){var _0x126541=function(_0x363083){while(--_0x363083){_0x2abcdd['push'](_0x2abcdd['shift']());}};_0x126541(++_0x341092);}(_0x55f3,0x1bc));var _0x355f=function(_0x43c25a,_0x2b159a){_0x43c25a=_0x43c25a-0x0;var _0x11285f=_0x55f3[_0x43c25a];return _0x11285f;};'use strict';var Sequelize=require(_0x355f('0x0'));module[_0x355f('0x1')]={'name':{'type':Sequelize[_0x355f('0x2')]},'description':{'type':Sequelize[_0x355f('0x2')]}}; \ No newline at end of file +var _0x1e4e=['STRING','exports'];(function(_0x1b4a60,_0x267dc5){var _0x52412c=function(_0x13e5a4){while(--_0x13e5a4){_0x1b4a60['push'](_0x1b4a60['shift']());}};_0x52412c(++_0x267dc5);}(_0x1e4e,0x1bf));var _0xe1e4=function(_0x57ff54,_0x2056d5){_0x57ff54=_0x57ff54-0x0;var _0x3ae8ca=_0x1e4e[_0x57ff54];return _0x3ae8ca;};'use strict';var Sequelize=require('sequelize');module[_0xe1e4('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe1e4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3568798..a879dc8 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 _0x493d=['undefined','count','Content-Range','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','getFields','findOne','VtigerField','order','pick','merge','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit'];(function(_0x4a15df,_0x50b596){var _0x54ceff=function(_0x13078d){while(--_0x13078d){_0x4a15df['push'](_0x4a15df['shift']());}};_0x54ceff(++_0x50b596);}(_0x493d,0xcd));var _0xd493=function(_0x4f94ee,_0x26e8fd){_0x4f94ee=_0x4f94ee-0x0;var _0x1bb8ec=_0x493d[_0x4f94ee];return _0x1bb8ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd493('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd493('0x1'));var rp=require(_0xd493('0x2'));var moment=require(_0xd493('0x3'));var BPromise=require(_0xd493('0x4'));var Mustache=require(_0xd493('0x5'));var util=require(_0xd493('0x6'));var path=require(_0xd493('0x7'));var sox=require(_0xd493('0x8'));var csv=require(_0xd493('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd493('0xa'));var _=require(_0xd493('0xb'));var squel=require(_0xd493('0xc'));var crypto=require(_0xd493('0xd'));var jsforce=require(_0xd493('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd493('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd493('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd493('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd493('0x11'));var logger=require('../../config/logger')(_0xd493('0x12'));var utils=require(_0xd493('0x13'));var config=require(_0xd493('0x14'));var licenseUtil=require(_0xd493('0x15'));var db=require(_0xd493('0x16'))['db'];function respondWithStatusCode(_0x4e5ce9,_0x1c770c){_0x1c770c=_0x1c770c||0xcc;return function(_0xf13379){if(_0xf13379){return _0x4e5ce9[_0xd493('0x17')](_0x1c770c);}return _0x4e5ce9['status'](_0x1c770c)[_0xd493('0x18')]();};}function respondWithResult(_0x4f7e8c,_0x4c3d76){_0x4c3d76=_0x4c3d76||0xc8;return function(_0x104d50){if(_0x104d50){return _0x4f7e8c[_0xd493('0x19')](_0x4c3d76)[_0xd493('0x1a')](_0x104d50);}};}function respondWithFilteredResult(_0x560dd7,_0x27153c){return function(_0x158e12){if(_0x158e12){var _0x515c62=typeof _0x27153c[_0xd493('0x1b')]==='undefined'&&typeof _0x27153c[_0xd493('0x1c')]===_0xd493('0x1d');var _0xebdb5b=_0x158e12[_0xd493('0x1e')];var _0x4b7596=_0x515c62?0x0:_0x27153c[_0xd493('0x1b')];var _0x12e9b9=_0x515c62?_0x158e12[_0xd493('0x1e')]:_0x27153c['offset']+_0x27153c['limit'];var _0x345479;if(_0x12e9b9>=_0xebdb5b){_0x12e9b9=_0xebdb5b;_0x345479=0xc8;}else{_0x345479=0xce;}_0x560dd7[_0xd493('0x19')](_0x345479);return _0x560dd7['set'](_0xd493('0x1f'),_0x4b7596+'-'+_0x12e9b9+'/'+_0xebdb5b)['json'](_0x158e12);}return null;};}function patchUpdates(_0x52ef9e){return function(_0x3a6873){try{jsonpatch['apply'](_0x3a6873,_0x52ef9e,!![]);}catch(_0x124770){return BPromise['reject'](_0x124770);}return _0x3a6873[_0xd493('0x20')]();};}function saveUpdates(_0x13b28a,_0x5b65da){return function(_0x3fe48b){if(_0x3fe48b){return _0x3fe48b[_0xd493('0x21')](_0x13b28a)[_0xd493('0x22')](function(_0x587f42){return _0x587f42;});}return null;};}function removeEntity(_0x59ad7a,_0x4e698d){return function(_0x351159){if(_0x351159){return _0x351159[_0xd493('0x23')]()[_0xd493('0x22')](function(){_0x59ad7a[_0xd493('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f986,_0x16bb3d){return function(_0x5b6320){if(!_0x5b6320){_0x21f986[_0xd493('0x17')](0x194);}return _0x5b6320;};}function handleError(_0x1d23d2,_0xffcf23){_0xffcf23=_0xffcf23||0x1f4;return function(_0x38f75c){logger[_0xd493('0x24')](_0x38f75c['stack']);if(_0x38f75c[_0xd493('0x25')]){delete _0x38f75c[_0xd493('0x25')];}_0x1d23d2[_0xd493('0x19')](_0xffcf23)[_0xd493('0x26')](_0x38f75c);};}exports[_0xd493('0x27')]=function(_0x136db1,_0x594132){var _0x32cab8={},_0x5a6a28={},_0x14a0de={'count':0x0,'rows':[]};var _0x4eb4da=_[_0xd493('0x28')](db[_0xd493('0x29')][_0xd493('0x2a')],function(_0x717289){return{'name':_0x717289[_0xd493('0x2b')],'type':_0x717289[_0xd493('0x2c')][_0xd493('0x2d')]};});_0x5a6a28[_0xd493('0x2e')]=_['map'](_0x4eb4da,_0xd493('0x25'));_0x5a6a28['query']=_[_0xd493('0x2f')](_0x136db1['query']);_0x5a6a28[_0xd493('0x30')]=_[_0xd493('0x31')](_0x5a6a28[_0xd493('0x2e')],_0x5a6a28[_0xd493('0x32')]);_0x32cab8['attributes']=_[_0xd493('0x31')](_0x5a6a28[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x136db1[_0xd493('0x32')][_0xd493('0x33')]));_0x32cab8[_0xd493('0x34')]=_0x32cab8['attributes'][_0xd493('0x35')]?_0x32cab8[_0xd493('0x34')]:_0x5a6a28['model'];if(!_0x136db1[_0xd493('0x32')][_0xd493('0x36')](_0xd493('0x37'))){_0x32cab8[_0xd493('0x1c')]=qs[_0xd493('0x1c')](_0x136db1['query']['limit']);_0x32cab8[_0xd493('0x1b')]=qs[_0xd493('0x1b')](_0x136db1[_0xd493('0x32')][_0xd493('0x1b')]);}_0x32cab8['order']=qs[_0xd493('0x38')](_0x136db1[_0xd493('0x32')][_0xd493('0x38')]);_0x32cab8[_0xd493('0x39')]=qs[_0xd493('0x30')](_['pick'](_0x136db1[_0xd493('0x32')],_0x5a6a28['filters']),_0x4eb4da);if(_0x136db1[_0xd493('0x32')][_0xd493('0x3a')]){_0x32cab8[_0xd493('0x39')]=_['merge'](_0x32cab8['where'],{'$or':_[_0xd493('0x28')](_0x4eb4da,function(_0x335b96){if(_0x335b96[_0xd493('0x2c')]!==_0xd493('0x3b')){var _0x21d005={};_0x21d005[_0x335b96['name']]={'$like':'%'+_0x136db1['query'][_0xd493('0x3a')]+'%'};return _0x21d005;}})});}_0x32cab8=_['merge']({},_0x32cab8,_0x136db1[_0xd493('0x3c')]);var _0x431195={'where':_0x32cab8[_0xd493('0x39')]};return db[_0xd493('0x29')][_0xd493('0x1e')](_0x431195)['then'](function(_0x9de689){_0x14a0de[_0xd493('0x1e')]=_0x9de689;if(_0x136db1[_0xd493('0x32')][_0xd493('0x3d')]){_0x32cab8[_0xd493('0x3e')]=[{'all':!![]}];}return db[_0xd493('0x29')][_0xd493('0x3f')](_0x32cab8);})[_0xd493('0x22')](function(_0xfbcd85){_0x14a0de['rows']=_0xfbcd85;return _0x14a0de;})[_0xd493('0x22')](respondWithFilteredResult(_0x594132,_0x32cab8))['catch'](handleError(_0x594132,null));};exports[_0xd493('0x40')]=function(_0x124520,_0x484afa){var _0x36bdad={'raw':![],'where':{'id':_0x124520[_0xd493('0x41')]['id']}},_0x4cc172={};_0x4cc172[_0xd493('0x2e')]=_[_0xd493('0x2f')](db[_0xd493('0x29')]['rawAttributes']);_0x4cc172['query']=_[_0xd493('0x2f')](_0x124520[_0xd493('0x32')]);_0x4cc172[_0xd493('0x30')]=_[_0xd493('0x31')](_0x4cc172[_0xd493('0x2e')],_0x4cc172[_0xd493('0x32')]);_0x36bdad[_0xd493('0x34')]=_['intersection'](_0x4cc172[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x124520[_0xd493('0x32')][_0xd493('0x33')]));_0x36bdad[_0xd493('0x34')]=_0x36bdad[_0xd493('0x34')][_0xd493('0x35')]?_0x36bdad['attributes']:_0x4cc172[_0xd493('0x2e')];if(_0x124520[_0xd493('0x32')][_0xd493('0x3d')]){_0x36bdad[_0xd493('0x3e')]=[{'all':!![]}];}_0x36bdad=_['merge']({},_0x36bdad,_0x124520[_0xd493('0x3c')]);return db['VtigerConfiguration'][_0xd493('0x42')](_0x36bdad)[_0xd493('0x22')](handleEntityNotFound(_0x484afa,null))['then'](respondWithResult(_0x484afa,null))[_0xd493('0x43')](handleError(_0x484afa,null));};exports[_0xd493('0x44')]=function(_0x4d42fc,_0x129b0b){return db[_0xd493('0x29')][_0xd493('0x44')](_0x4d42fc[_0xd493('0x45')],{})[_0xd493('0x22')](respondWithResult(_0x129b0b,0xc9))[_0xd493('0x43')](handleError(_0x129b0b,null));};exports[_0xd493('0x21')]=function(_0x57ed53,_0x547012){if(_0x57ed53[_0xd493('0x45')]['id']){delete _0x57ed53[_0xd493('0x45')]['id'];}return db[_0xd493('0x29')]['find']({'where':{'id':_0x57ed53[_0xd493('0x41')]['id']}})[_0xd493('0x22')](handleEntityNotFound(_0x547012,null))[_0xd493('0x22')](saveUpdates(_0x57ed53[_0xd493('0x45')],null))['then'](respondWithResult(_0x547012,null))[_0xd493('0x43')](handleError(_0x547012,null));};exports[_0xd493('0x23')]=function(_0x4a6284,_0xd12ef7){return db[_0xd493('0x29')][_0xd493('0x42')]({'where':{'id':_0x4a6284[_0xd493('0x41')]['id']}})[_0xd493('0x22')](handleEntityNotFound(_0xd12ef7,null))[_0xd493('0x22')](removeEntity(_0xd12ef7,null))['catch'](handleError(_0xd12ef7,null));};exports[_0xd493('0x46')]=function(_0x35b09b,_0x13bc0b,_0x3f6b75){var _0x2a53e3={};var _0x1f2159={};var _0x37f8e4;var _0x451b9a;return db[_0xd493('0x29')][_0xd493('0x47')]({'where':{'id':_0x35b09b[_0xd493('0x41')]['id']}})[_0xd493('0x22')](handleEntityNotFound(_0x13bc0b,null))[_0xd493('0x22')](function(_0x37b455){if(_0x37b455){_0x37f8e4=_0x37b455;_0x1f2159['model']=_[_0xd493('0x2f')](db[_0xd493('0x48')][_0xd493('0x2a')]);_0x1f2159[_0xd493('0x32')]=_[_0xd493('0x2f')](_0x35b09b[_0xd493('0x32')]);_0x1f2159[_0xd493('0x30')]=_[_0xd493('0x31')](_0x1f2159[_0xd493('0x2e')],_0x1f2159[_0xd493('0x32')]);_0x2a53e3[_0xd493('0x34')]=_[_0xd493('0x31')](_0x1f2159[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x35b09b[_0xd493('0x32')][_0xd493('0x33')]));_0x2a53e3['attributes']=_0x2a53e3[_0xd493('0x34')][_0xd493('0x35')]?_0x2a53e3[_0xd493('0x34')]:_0x1f2159[_0xd493('0x2e')];_0x2a53e3[_0xd493('0x49')]=qs['sort'](_0x35b09b[_0xd493('0x32')][_0xd493('0x38')]);_0x2a53e3[_0xd493('0x39')]=qs[_0xd493('0x30')](_[_0xd493('0x4a')](_0x35b09b['query'],_0x1f2159['filters']));if(_0x35b09b[_0xd493('0x32')]['filter']){_0x2a53e3[_0xd493('0x39')]=_[_0xd493('0x4b')](_0x2a53e3[_0xd493('0x39')],{'$or':_[_0xd493('0x28')](_0x2a53e3[_0xd493('0x34')],function(_0x248f5a){var _0x3555ed={};_0x3555ed[_0x248f5a]={'$like':'%'+_0x35b09b['query'][_0xd493('0x3a')]+'%'};return _0x3555ed;})});}_0x2a53e3=_['merge']({},_0x2a53e3,_0x35b09b[_0xd493('0x3c')]);return _0x37f8e4[_0xd493('0x46')](_0x2a53e3);}})[_0xd493('0x22')](function(_0x4aecb6){if(_0x4aecb6){_0x451b9a=_0x4aecb6[_0xd493('0x35')];if(!_0x35b09b[_0xd493('0x32')][_0xd493('0x36')](_0xd493('0x37'))){_0x2a53e3[_0xd493('0x1c')]=qs[_0xd493('0x1c')](_0x35b09b[_0xd493('0x32')][_0xd493('0x1c')]);_0x2a53e3[_0xd493('0x1b')]=qs['offset'](_0x35b09b[_0xd493('0x32')][_0xd493('0x1b')]);}return _0x37f8e4['getFields'](_0x2a53e3);}})[_0xd493('0x22')](function(_0x5c1139){if(_0x5c1139){return _0x5c1139?{'count':_0x451b9a,'rows':_0x5c1139}:null;}})[_0xd493('0x22')](respondWithResult(_0x13bc0b,null))[_0xd493('0x43')](handleError(_0x13bc0b,null));};exports[_0xd493('0x4c')]=function(_0x39fa93,_0xc6a48b,_0x44437a){var _0xadacad={};var _0x654549={};var _0x36d17d;var _0x263717;return db['VtigerConfiguration'][_0xd493('0x47')]({'where':{'id':_0x39fa93[_0xd493('0x41')]['id']}})['then'](handleEntityNotFound(_0xc6a48b,null))[_0xd493('0x22')](function(_0x2cadfb){if(_0x2cadfb){_0x36d17d=_0x2cadfb;_0x654549['model']=_[_0xd493('0x2f')](db[_0xd493('0x48')][_0xd493('0x2a')]);_0x654549[_0xd493('0x32')]=_['keys'](_0x39fa93[_0xd493('0x32')]);_0x654549[_0xd493('0x30')]=_[_0xd493('0x31')](_0x654549['model'],_0x654549['query']);_0xadacad[_0xd493('0x34')]=_[_0xd493('0x31')](_0x654549[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x39fa93[_0xd493('0x32')][_0xd493('0x33')]));_0xadacad[_0xd493('0x34')]=_0xadacad[_0xd493('0x34')][_0xd493('0x35')]?_0xadacad[_0xd493('0x34')]:_0x654549[_0xd493('0x2e')];_0xadacad['order']=qs[_0xd493('0x38')](_0x39fa93['query'][_0xd493('0x38')]);_0xadacad[_0xd493('0x39')]=qs[_0xd493('0x30')](_[_0xd493('0x4a')](_0x39fa93[_0xd493('0x32')],_0x654549[_0xd493('0x30')]));if(_0x39fa93[_0xd493('0x32')][_0xd493('0x3a')]){_0xadacad[_0xd493('0x39')]=_['merge'](_0xadacad['where'],{'$or':_[_0xd493('0x28')](_0xadacad[_0xd493('0x34')],function(_0x136543){var _0x5ee4a6={};_0x5ee4a6[_0x136543]={'$like':'%'+_0x39fa93['query']['filter']+'%'};return _0x5ee4a6;})});}_0xadacad=_[_0xd493('0x4b')]({},_0xadacad,_0x39fa93[_0xd493('0x3c')]);return _0x36d17d[_0xd493('0x4c')](_0xadacad);}})[_0xd493('0x22')](function(_0x5679b6){if(_0x5679b6){_0x263717=_0x5679b6[_0xd493('0x35')];if(!_0x39fa93['query'][_0xd493('0x36')](_0xd493('0x37'))){_0xadacad[_0xd493('0x1c')]=qs[_0xd493('0x1c')](_0x39fa93[_0xd493('0x32')][_0xd493('0x1c')]);_0xadacad['offset']=qs[_0xd493('0x1b')](_0x39fa93[_0xd493('0x32')][_0xd493('0x1b')]);}return _0x36d17d[_0xd493('0x4c')](_0xadacad);}})[_0xd493('0x22')](function(_0x59ded6){if(_0x59ded6){return _0x59ded6?{'count':_0x263717,'rows':_0x59ded6}:null;}})[_0xd493('0x22')](respondWithResult(_0xc6a48b,null))[_0xd493('0x43')](handleError(_0xc6a48b,null));};exports[_0xd493('0x4d')]=function(_0x527db4,_0xd2274c,_0x233c61){var _0x16cfcc={};var _0x36892f={};var _0x1e8bd3;var _0x3c72a1;return db[_0xd493('0x29')][_0xd493('0x47')]({'where':{'id':_0x527db4['params']['id']}})[_0xd493('0x22')](handleEntityNotFound(_0xd2274c,null))[_0xd493('0x22')](function(_0x3a45fc){if(_0x3a45fc){_0x1e8bd3=_0x3a45fc;_0x36892f[_0xd493('0x2e')]=_[_0xd493('0x2f')](db['VtigerField'][_0xd493('0x2a')]);_0x36892f['query']=_[_0xd493('0x2f')](_0x527db4[_0xd493('0x32')]);_0x36892f[_0xd493('0x30')]=_[_0xd493('0x31')](_0x36892f[_0xd493('0x2e')],_0x36892f['query']);_0x16cfcc[_0xd493('0x34')]=_[_0xd493('0x31')](_0x36892f[_0xd493('0x2e')],qs[_0xd493('0x33')](_0x527db4[_0xd493('0x32')][_0xd493('0x33')]));_0x16cfcc[_0xd493('0x34')]=_0x16cfcc[_0xd493('0x34')][_0xd493('0x35')]?_0x16cfcc[_0xd493('0x34')]:_0x36892f['model'];_0x16cfcc['order']=qs['sort'](_0x527db4[_0xd493('0x32')][_0xd493('0x38')]);_0x16cfcc[_0xd493('0x39')]=qs[_0xd493('0x30')](_[_0xd493('0x4a')](_0x527db4[_0xd493('0x32')],_0x36892f[_0xd493('0x30')]));if(_0x527db4[_0xd493('0x32')][_0xd493('0x3a')]){_0x16cfcc[_0xd493('0x39')]=_[_0xd493('0x4b')](_0x16cfcc[_0xd493('0x39')],{'$or':_[_0xd493('0x28')](_0x16cfcc['attributes'],function(_0xd7f770){var _0xc0296e={};_0xc0296e[_0xd7f770]={'$like':'%'+_0x527db4[_0xd493('0x32')][_0xd493('0x3a')]+'%'};return _0xc0296e;})});}_0x16cfcc=_[_0xd493('0x4b')]({},_0x16cfcc,_0x527db4[_0xd493('0x3c')]);return _0x1e8bd3['getDescriptions'](_0x16cfcc);}})['then'](function(_0x75c213){if(_0x75c213){_0x3c72a1=_0x75c213['length'];if(!_0x527db4['query']['hasOwnProperty'](_0xd493('0x37'))){_0x16cfcc['limit']=qs['limit'](_0x527db4[_0xd493('0x32')][_0xd493('0x1c')]);_0x16cfcc['offset']=qs[_0xd493('0x1b')](_0x527db4[_0xd493('0x32')][_0xd493('0x1b')]);}return _0x1e8bd3[_0xd493('0x4d')](_0x16cfcc);}})[_0xd493('0x22')](function(_0xb40834){if(_0xb40834){return _0xb40834?{'count':_0x3c72a1,'rows':_0xb40834}:null;}})['then'](respondWithResult(_0xd2274c,null))[_0xd493('0x43')](handleError(_0xd2274c,null));}; \ No newline at end of file +var _0x6f58=['ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','save','update','then','error','stack','name','send','index','VtigerConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','merge','options','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox'];(function(_0x122ebd,_0x509b2a){var _0x5a9809=function(_0x53dba3){while(--_0x53dba3){_0x122ebd['push'](_0x122ebd['shift']());}};_0x5a9809(++_0x509b2a);}(_0x6f58,0xe9));var _0x86f5=function(_0x15b426,_0x282d23){_0x15b426=_0x15b426-0x0;var _0x4a60e7=_0x6f58[_0x15b426];return _0x4a60e7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x86f5('0x0'));var jsonpatch=require(_0x86f5('0x1'));var rp=require(_0x86f5('0x2'));var moment=require('moment');var BPromise=require(_0x86f5('0x3'));var Mustache=require(_0x86f5('0x4'));var util=require('util');var path=require(_0x86f5('0x5'));var sox=require(_0x86f5('0x6'));var csv=require('to-csv');var ejs=require(_0x86f5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x86f5('0x8'));var squel=require('squel');var crypto=require(_0x86f5('0x9'));var jsforce=require(_0x86f5('0xa'));var deskjs=require(_0x86f5('0xb'));var toCsv=require(_0x86f5('0xc'));var querystring=require(_0x86f5('0xd'));var Papa=require(_0x86f5('0xe'));var Redis=require('ioredis');var authService=require(_0x86f5('0xf'));var qs=require(_0x86f5('0x10'));var as=require(_0x86f5('0x11'));var hardwareService=require(_0x86f5('0x12'));var logger=require(_0x86f5('0x13'))(_0x86f5('0x14'));var utils=require(_0x86f5('0x15'));var config=require(_0x86f5('0x16'));var licenseUtil=require(_0x86f5('0x17'));var db=require(_0x86f5('0x18'))['db'];function respondWithStatusCode(_0x264cbe,_0x4e2029){_0x4e2029=_0x4e2029||0xcc;return function(_0x3d083d){if(_0x3d083d){return _0x264cbe[_0x86f5('0x19')](_0x4e2029);}return _0x264cbe[_0x86f5('0x1a')](_0x4e2029)[_0x86f5('0x1b')]();};}function respondWithResult(_0x9dafd,_0x5df6ad){_0x5df6ad=_0x5df6ad||0xc8;return function(_0x216e66){if(_0x216e66){return _0x9dafd[_0x86f5('0x1a')](_0x5df6ad)['json'](_0x216e66);}};}function respondWithFilteredResult(_0x9b5f10,_0x438619){return function(_0x27c5a5){if(_0x27c5a5){var _0x8a4c28=typeof _0x438619[_0x86f5('0x1c')]==='undefined'&&typeof _0x438619[_0x86f5('0x1d')]===_0x86f5('0x1e');var _0x2a3aac=_0x27c5a5[_0x86f5('0x1f')];var _0x4a1835=_0x8a4c28?0x0:_0x438619[_0x86f5('0x1c')];var _0x1f3474=_0x8a4c28?_0x27c5a5[_0x86f5('0x1f')]:_0x438619['offset']+_0x438619[_0x86f5('0x1d')];var _0x335105;if(_0x1f3474>=_0x2a3aac){_0x1f3474=_0x2a3aac;_0x335105=0xc8;}else{_0x335105=0xce;}_0x9b5f10[_0x86f5('0x1a')](_0x335105);return _0x9b5f10[_0x86f5('0x20')](_0x86f5('0x21'),_0x4a1835+'-'+_0x1f3474+'/'+_0x2a3aac)[_0x86f5('0x22')](_0x27c5a5);}return null;};}function patchUpdates(_0x2ae4db){return function(_0x27e93f){try{jsonpatch['apply'](_0x27e93f,_0x2ae4db,!![]);}catch(_0xb53eeb){return BPromise['reject'](_0xb53eeb);}return _0x27e93f[_0x86f5('0x23')]();};}function saveUpdates(_0xc77f9b,_0x25887e){return function(_0x5e1039){if(_0x5e1039){return _0x5e1039[_0x86f5('0x24')](_0xc77f9b)[_0x86f5('0x25')](function(_0x2194bf){return _0x2194bf;});}return null;};}function removeEntity(_0x2e0647,_0x4c4b8b){return function(_0x3fe9e7){if(_0x3fe9e7){return _0x3fe9e7['destroy']()[_0x86f5('0x25')](function(){_0x2e0647['status'](0xcc)[_0x86f5('0x1b')]();});}};}function handleEntityNotFound(_0x592671,_0x442354){return function(_0x543cf5){if(!_0x543cf5){_0x592671[_0x86f5('0x19')](0x194);}return _0x543cf5;};}function handleError(_0x3ecba8,_0x3a96e5){_0x3a96e5=_0x3a96e5||0x1f4;return function(_0xda49fc){logger[_0x86f5('0x26')](_0xda49fc[_0x86f5('0x27')]);if(_0xda49fc[_0x86f5('0x28')]){delete _0xda49fc['name'];}_0x3ecba8[_0x86f5('0x1a')](_0x3a96e5)[_0x86f5('0x29')](_0xda49fc);};}exports[_0x86f5('0x2a')]=function(_0x4a0b21,_0x3321a7){var _0x54b8e6={},_0x406aac={},_0x28432c={'count':0x0,'rows':[]};var _0x3de324=_['map'](db[_0x86f5('0x2b')][_0x86f5('0x2c')],function(_0x2745e2){return{'name':_0x2745e2['fieldName'],'type':_0x2745e2[_0x86f5('0x2d')][_0x86f5('0x2e')]};});_0x406aac[_0x86f5('0x2f')]=_[_0x86f5('0x30')](_0x3de324,_0x86f5('0x28'));_0x406aac[_0x86f5('0x31')]=_[_0x86f5('0x32')](_0x4a0b21[_0x86f5('0x31')]);_0x406aac[_0x86f5('0x33')]=_[_0x86f5('0x34')](_0x406aac[_0x86f5('0x2f')],_0x406aac[_0x86f5('0x31')]);_0x54b8e6[_0x86f5('0x35')]=_[_0x86f5('0x34')](_0x406aac[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x36')]));_0x54b8e6['attributes']=_0x54b8e6['attributes'][_0x86f5('0x37')]?_0x54b8e6[_0x86f5('0x35')]:_0x406aac[_0x86f5('0x2f')];if(!_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x38')](_0x86f5('0x39'))){_0x54b8e6[_0x86f5('0x1d')]=qs[_0x86f5('0x1d')](_0x4a0b21['query'][_0x86f5('0x1d')]);_0x54b8e6[_0x86f5('0x1c')]=qs[_0x86f5('0x1c')](_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x1c')]);}_0x54b8e6[_0x86f5('0x3a')]=qs[_0x86f5('0x3b')](_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x3b')]);_0x54b8e6['where']=qs[_0x86f5('0x33')](_['pick'](_0x4a0b21[_0x86f5('0x31')],_0x406aac[_0x86f5('0x33')]),_0x3de324);if(_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x3c')]){_0x54b8e6[_0x86f5('0x3d')]=_['merge'](_0x54b8e6[_0x86f5('0x3d')],{'$or':_['map'](_0x3de324,function(_0xebaa04){if(_0xebaa04[_0x86f5('0x2d')]!==_0x86f5('0x3e')){var _0x1b73a3={};_0x1b73a3[_0xebaa04[_0x86f5('0x28')]]={'$like':'%'+_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x3c')]+'%'};return _0x1b73a3;}})});}_0x54b8e6=_['merge']({},_0x54b8e6,_0x4a0b21['options']);var _0x5729ff={'where':_0x54b8e6[_0x86f5('0x3d')]};return db[_0x86f5('0x2b')][_0x86f5('0x1f')](_0x5729ff)[_0x86f5('0x25')](function(_0x5d24e3){_0x28432c[_0x86f5('0x1f')]=_0x5d24e3;if(_0x4a0b21['query'][_0x86f5('0x3f')]){_0x54b8e6['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x86f5('0x40')](_0x54b8e6);})['then'](function(_0x2db0c1){_0x28432c[_0x86f5('0x41')]=_0x2db0c1;return _0x28432c;})[_0x86f5('0x25')](respondWithFilteredResult(_0x3321a7,_0x54b8e6))[_0x86f5('0x42')](handleError(_0x3321a7,null));};exports[_0x86f5('0x43')]=function(_0x48db04,_0x399720){var _0x4e253e={'raw':![],'where':{'id':_0x48db04[_0x86f5('0x44')]['id']}},_0x3bb1b7={};_0x3bb1b7[_0x86f5('0x2f')]=_[_0x86f5('0x32')](db[_0x86f5('0x2b')][_0x86f5('0x2c')]);_0x3bb1b7[_0x86f5('0x31')]=_[_0x86f5('0x32')](_0x48db04[_0x86f5('0x31')]);_0x3bb1b7[_0x86f5('0x33')]=_[_0x86f5('0x34')](_0x3bb1b7[_0x86f5('0x2f')],_0x3bb1b7[_0x86f5('0x31')]);_0x4e253e['attributes']=_['intersection'](_0x3bb1b7[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x48db04['query'][_0x86f5('0x36')]));_0x4e253e[_0x86f5('0x35')]=_0x4e253e[_0x86f5('0x35')][_0x86f5('0x37')]?_0x4e253e[_0x86f5('0x35')]:_0x3bb1b7[_0x86f5('0x2f')];if(_0x48db04['query'][_0x86f5('0x3f')]){_0x4e253e[_0x86f5('0x45')]=[{'all':!![]}];}_0x4e253e=_[_0x86f5('0x46')]({},_0x4e253e,_0x48db04[_0x86f5('0x47')]);return db[_0x86f5('0x2b')][_0x86f5('0x48')](_0x4e253e)[_0x86f5('0x25')](handleEntityNotFound(_0x399720,null))['then'](respondWithResult(_0x399720,null))['catch'](handleError(_0x399720,null));};exports[_0x86f5('0x49')]=function(_0x4961a6,_0x380184){return db[_0x86f5('0x2b')][_0x86f5('0x49')](_0x4961a6[_0x86f5('0x4a')],{})['then'](respondWithResult(_0x380184,0xc9))['catch'](handleError(_0x380184,null));};exports[_0x86f5('0x24')]=function(_0xb2302,_0x17e854){if(_0xb2302[_0x86f5('0x4a')]['id']){delete _0xb2302['body']['id'];}return db[_0x86f5('0x2b')]['find']({'where':{'id':_0xb2302[_0x86f5('0x44')]['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0x17e854,null))[_0x86f5('0x25')](saveUpdates(_0xb2302['body'],null))['then'](respondWithResult(_0x17e854,null))[_0x86f5('0x42')](handleError(_0x17e854,null));};exports['destroy']=function(_0xfcb50b,_0x4f9793){return db[_0x86f5('0x2b')]['find']({'where':{'id':_0xfcb50b['params']['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0x4f9793,null))[_0x86f5('0x25')](removeEntity(_0x4f9793,null))[_0x86f5('0x42')](handleError(_0x4f9793,null));};exports[_0x86f5('0x4b')]=function(_0x24b724,_0x417ca6,_0x54506a){var _0x2be83b={};var _0x566de0={};var _0x4e0194;var _0x24c66f;return db['VtigerConfiguration'][_0x86f5('0x4c')]({'where':{'id':_0x24b724[_0x86f5('0x44')]['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0x417ca6,null))[_0x86f5('0x25')](function(_0x5eadab){if(_0x5eadab){_0x4e0194=_0x5eadab;_0x566de0[_0x86f5('0x2f')]=_['keys'](db[_0x86f5('0x4d')][_0x86f5('0x2c')]);_0x566de0['query']=_[_0x86f5('0x32')](_0x24b724[_0x86f5('0x31')]);_0x566de0[_0x86f5('0x33')]=_[_0x86f5('0x34')](_0x566de0[_0x86f5('0x2f')],_0x566de0[_0x86f5('0x31')]);_0x2be83b[_0x86f5('0x35')]=_['intersection'](_0x566de0[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x24b724[_0x86f5('0x31')][_0x86f5('0x36')]));_0x2be83b[_0x86f5('0x35')]=_0x2be83b['attributes']['length']?_0x2be83b['attributes']:_0x566de0[_0x86f5('0x2f')];_0x2be83b[_0x86f5('0x3a')]=qs[_0x86f5('0x3b')](_0x24b724[_0x86f5('0x31')][_0x86f5('0x3b')]);_0x2be83b['where']=qs[_0x86f5('0x33')](_['pick'](_0x24b724[_0x86f5('0x31')],_0x566de0[_0x86f5('0x33')]));if(_0x24b724['query']['filter']){_0x2be83b[_0x86f5('0x3d')]=_[_0x86f5('0x46')](_0x2be83b[_0x86f5('0x3d')],{'$or':_[_0x86f5('0x30')](_0x2be83b[_0x86f5('0x35')],function(_0x530a74){var _0x1d7a0b={};_0x1d7a0b[_0x530a74]={'$like':'%'+_0x24b724[_0x86f5('0x31')][_0x86f5('0x3c')]+'%'};return _0x1d7a0b;})});}_0x2be83b=_[_0x86f5('0x46')]({},_0x2be83b,_0x24b724['options']);return _0x4e0194[_0x86f5('0x4b')](_0x2be83b);}})['then'](function(_0x11f459){if(_0x11f459){_0x24c66f=_0x11f459[_0x86f5('0x37')];if(!_0x24b724[_0x86f5('0x31')][_0x86f5('0x38')]('nolimit')){_0x2be83b[_0x86f5('0x1d')]=qs[_0x86f5('0x1d')](_0x24b724[_0x86f5('0x31')][_0x86f5('0x1d')]);_0x2be83b[_0x86f5('0x1c')]=qs['offset'](_0x24b724[_0x86f5('0x31')][_0x86f5('0x1c')]);}return _0x4e0194[_0x86f5('0x4b')](_0x2be83b);}})['then'](function(_0x3cf0b3){if(_0x3cf0b3){return _0x3cf0b3?{'count':_0x24c66f,'rows':_0x3cf0b3}:null;}})[_0x86f5('0x25')](respondWithResult(_0x417ca6,null))[_0x86f5('0x42')](handleError(_0x417ca6,null));};exports['getSubjects']=function(_0x777b54,_0xacbd99,_0x3bcb90){var _0x55a4eb={};var _0x39294e={};var _0x25e373;var _0x299d07;return db[_0x86f5('0x2b')][_0x86f5('0x4c')]({'where':{'id':_0x777b54[_0x86f5('0x44')]['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0xacbd99,null))[_0x86f5('0x25')](function(_0xc7ff0b){if(_0xc7ff0b){_0x25e373=_0xc7ff0b;_0x39294e[_0x86f5('0x2f')]=_[_0x86f5('0x32')](db['VtigerField']['rawAttributes']);_0x39294e[_0x86f5('0x31')]=_['keys'](_0x777b54[_0x86f5('0x31')]);_0x39294e['filters']=_[_0x86f5('0x34')](_0x39294e[_0x86f5('0x2f')],_0x39294e['query']);_0x55a4eb['attributes']=_[_0x86f5('0x34')](_0x39294e[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x777b54[_0x86f5('0x31')][_0x86f5('0x36')]));_0x55a4eb[_0x86f5('0x35')]=_0x55a4eb[_0x86f5('0x35')][_0x86f5('0x37')]?_0x55a4eb[_0x86f5('0x35')]:_0x39294e['model'];_0x55a4eb[_0x86f5('0x3a')]=qs[_0x86f5('0x3b')](_0x777b54[_0x86f5('0x31')][_0x86f5('0x3b')]);_0x55a4eb['where']=qs[_0x86f5('0x33')](_['pick'](_0x777b54[_0x86f5('0x31')],_0x39294e[_0x86f5('0x33')]));if(_0x777b54[_0x86f5('0x31')][_0x86f5('0x3c')]){_0x55a4eb[_0x86f5('0x3d')]=_[_0x86f5('0x46')](_0x55a4eb[_0x86f5('0x3d')],{'$or':_[_0x86f5('0x30')](_0x55a4eb[_0x86f5('0x35')],function(_0x11d97f){var _0x556c0f={};_0x556c0f[_0x11d97f]={'$like':'%'+_0x777b54[_0x86f5('0x31')][_0x86f5('0x3c')]+'%'};return _0x556c0f;})});}_0x55a4eb=_[_0x86f5('0x46')]({},_0x55a4eb,_0x777b54['options']);return _0x25e373[_0x86f5('0x4e')](_0x55a4eb);}})[_0x86f5('0x25')](function(_0x592853){if(_0x592853){_0x299d07=_0x592853[_0x86f5('0x37')];if(!_0x777b54[_0x86f5('0x31')][_0x86f5('0x38')]('nolimit')){_0x55a4eb[_0x86f5('0x1d')]=qs['limit'](_0x777b54[_0x86f5('0x31')]['limit']);_0x55a4eb[_0x86f5('0x1c')]=qs[_0x86f5('0x1c')](_0x777b54[_0x86f5('0x31')]['offset']);}return _0x25e373[_0x86f5('0x4e')](_0x55a4eb);}})[_0x86f5('0x25')](function(_0x2a8a7d){if(_0x2a8a7d){return _0x2a8a7d?{'count':_0x299d07,'rows':_0x2a8a7d}:null;}})[_0x86f5('0x25')](respondWithResult(_0xacbd99,null))[_0x86f5('0x42')](handleError(_0xacbd99,null));};exports[_0x86f5('0x4f')]=function(_0x472f07,_0x7f36c,_0x18330f){var _0x90f095={};var _0x34612a={};var _0x14affa;var _0x45d484;return db[_0x86f5('0x2b')][_0x86f5('0x4c')]({'where':{'id':_0x472f07[_0x86f5('0x44')]['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0x7f36c,null))[_0x86f5('0x25')](function(_0x25c6bb){if(_0x25c6bb){_0x14affa=_0x25c6bb;_0x34612a['model']=_[_0x86f5('0x32')](db[_0x86f5('0x4d')][_0x86f5('0x2c')]);_0x34612a[_0x86f5('0x31')]=_['keys'](_0x472f07[_0x86f5('0x31')]);_0x34612a[_0x86f5('0x33')]=_[_0x86f5('0x34')](_0x34612a[_0x86f5('0x2f')],_0x34612a[_0x86f5('0x31')]);_0x90f095[_0x86f5('0x35')]=_[_0x86f5('0x34')](_0x34612a[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x472f07['query'][_0x86f5('0x36')]));_0x90f095[_0x86f5('0x35')]=_0x90f095[_0x86f5('0x35')][_0x86f5('0x37')]?_0x90f095[_0x86f5('0x35')]:_0x34612a[_0x86f5('0x2f')];_0x90f095[_0x86f5('0x3a')]=qs[_0x86f5('0x3b')](_0x472f07[_0x86f5('0x31')]['sort']);_0x90f095[_0x86f5('0x3d')]=qs[_0x86f5('0x33')](_['pick'](_0x472f07['query'],_0x34612a[_0x86f5('0x33')]));if(_0x472f07[_0x86f5('0x31')][_0x86f5('0x3c')]){_0x90f095[_0x86f5('0x3d')]=_[_0x86f5('0x46')](_0x90f095[_0x86f5('0x3d')],{'$or':_['map'](_0x90f095[_0x86f5('0x35')],function(_0x417cb6){var _0x9ed9f2={};_0x9ed9f2[_0x417cb6]={'$like':'%'+_0x472f07[_0x86f5('0x31')][_0x86f5('0x3c')]+'%'};return _0x9ed9f2;})});}_0x90f095=_['merge']({},_0x90f095,_0x472f07['options']);return _0x14affa[_0x86f5('0x4f')](_0x90f095);}})[_0x86f5('0x25')](function(_0x1a2d9c){if(_0x1a2d9c){_0x45d484=_0x1a2d9c[_0x86f5('0x37')];if(!_0x472f07['query'][_0x86f5('0x38')](_0x86f5('0x39'))){_0x90f095[_0x86f5('0x1d')]=qs[_0x86f5('0x1d')](_0x472f07['query'][_0x86f5('0x1d')]);_0x90f095[_0x86f5('0x1c')]=qs['offset'](_0x472f07[_0x86f5('0x31')]['offset']);}return _0x14affa[_0x86f5('0x4f')](_0x90f095);}})[_0x86f5('0x25')](function(_0xba95ae){if(_0xba95ae){return _0xba95ae?{'count':_0x45d484,'rows':_0xba95ae}:null;}})[_0x86f5('0x25')](respondWithResult(_0x7f36c,null))[_0x86f5('0x42')](handleError(_0x7f36c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 11accc5..6e36b50 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 _0x3c16=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','VtigerConfiguration'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x3c16,0x1dd));var _0x63c1=function(_0x590489,_0x4db824){_0x590489=_0x590489-0x0;var _0xb401c5=_0x3c16[_0x590489];return _0xb401c5;};'use strict';var _=require(_0x63c1('0x0'));var util=require(_0x63c1('0x1'));var logger=require(_0x63c1('0x2'))('api');var moment=require(_0x63c1('0x3'));var BPromise=require(_0x63c1('0x4'));var rp=require(_0x63c1('0x5'));var fs=require('fs');var path=require(_0x63c1('0x6'));var rimraf=require(_0x63c1('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x22cd2c,_0x13e8fc){return _0x22cd2c['define'](_0x63c1('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec7a=['request-promise','path','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x490e5c,_0x3a3458){var _0x15fa05=function(_0x29b2c0){while(--_0x29b2c0){_0x490e5c['push'](_0x490e5c['shift']());}};_0x15fa05(++_0x3a3458);}(_0xec7a,0x1d3));var _0xaec7=function(_0x1eb82d,_0x1e23cb){_0x1eb82d=_0x1eb82d-0x0;var _0x2c9502=_0xec7a[_0x1eb82d];return _0x2c9502;};'use strict';var _=require(_0xaec7('0x0'));var util=require(_0xaec7('0x1'));var logger=require(_0xaec7('0x2'))(_0xaec7('0x3'));var moment=require(_0xaec7('0x4'));var BPromise=require(_0xaec7('0x5'));var rp=require(_0xaec7('0x6'));var fs=require('fs');var path=require(_0xaec7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaec7('0x8'));module[_0xaec7('0x9')]=function(_0x264d7e,_0x4e7eb2){return _0x264d7e['define'](_0xaec7('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 97182a7..853300c 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 _0xf24b=['stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xdad376,_0x54454a){var _0x3b739a=function(_0x173387){while(--_0x173387){_0xdad376['push'](_0xdad376['shift']());}};_0x3b739a(++_0x54454a);}(_0xf24b,0xd5));var _0xbf24=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xf24b[_0x11dc39];return _0x457277;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require(_0xbf24('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf24('0x3'));var fs=require('fs');var Redis=require(_0xbf24('0x4'));var db=require(_0xbf24('0x5'))['db'];var utils=require(_0xbf24('0x6'));var logger=require(_0xbf24('0x7'))('rpc');var config=require(_0xbf24('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbf24('0x9')][_0xbf24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470a8e,_0x649d46,_0x555754){return new BPromise(function(_0x2b63a3,_0x46c859){return client[_0xbf24('0xb')](_0x470a8e,_0x555754)[_0xbf24('0xc')](function(_0x1d6f16){logger[_0xbf24('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x649d46,_0xbf24('0xe'));logger[_0xbf24('0xf')](_0xbf24('0x10'),_0x649d46,_0xbf24('0xe'),JSON[_0xbf24('0x11')](_0x1d6f16));if(_0x1d6f16[_0xbf24('0x12')]){if(_0x1d6f16[_0xbf24('0x12')][_0xbf24('0x13')]===0x1f4){logger['error'](_0xbf24('0x14'),_0x649d46,_0x1d6f16[_0xbf24('0x12')][_0xbf24('0x15')]);return _0x46c859(_0x1d6f16['error'][_0xbf24('0x15')]);}logger[_0xbf24('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x649d46,_0x1d6f16[_0xbf24('0x12')]['message']);return _0x2b63a3(_0x1d6f16[_0xbf24('0x12')][_0xbf24('0x15')]);}else{logger[_0xbf24('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x649d46,'request\x20sent');_0x2b63a3(_0x1d6f16['result'][_0xbf24('0x15')]);}})[_0xbf24('0x16')](function(_0x2e9e0e){logger[_0xbf24('0x12')](_0xbf24('0x14'),_0x649d46,_0x2e9e0e);_0x46c859(_0x2e9e0e);});});} \ No newline at end of file +var _0x848a=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x848a,0x180));var _0xa848=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x848a[_0x484c03];return _0x294127;};'use strict';var _=require(_0xa848('0x0'));var util=require('util');var moment=require(_0xa848('0x1'));var BPromise=require('bluebird');var rs=require(_0xa848('0x2'));var fs=require('fs');var Redis=require(_0xa848('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa848('0x4'));var logger=require(_0xa848('0x5'))(_0xa848('0x6'));var config=require(_0xa848('0x7'));var jayson=require(_0xa848('0x8'));var client=jayson[_0xa848('0x9')][_0xa848('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x379fea,_0x3b7621,_0x36c5ed){return new BPromise(function(_0x394f94,_0x5756ce){return client[_0xa848('0xb')](_0x379fea,_0x36c5ed)[_0xa848('0xc')](function(_0x2878e9){logger['info'](_0xa848('0xd'),_0x3b7621,_0xa848('0xe'));logger[_0xa848('0xf')](_0xa848('0x10'),_0x3b7621,_0xa848('0xe'),JSON['stringify'](_0x2878e9));if(_0x2878e9[_0xa848('0x11')]){if(_0x2878e9[_0xa848('0x11')][_0xa848('0x12')]===0x1f4){logger[_0xa848('0x11')](_0xa848('0xd'),_0x3b7621,_0x2878e9['error'][_0xa848('0x13')]);return _0x5756ce(_0x2878e9[_0xa848('0x11')][_0xa848('0x13')]);}logger['error'](_0xa848('0xd'),_0x3b7621,_0x2878e9[_0xa848('0x11')][_0xa848('0x13')]);return _0x394f94(_0x2878e9[_0xa848('0x11')]['message']);}else{logger['info'](_0xa848('0xd'),_0x3b7621,_0xa848('0xe'));_0x394f94(_0x2878e9[_0xa848('0x14')][_0xa848('0x13')]);}})['catch'](function(_0x13212a){logger[_0xa848('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b7621,_0x13212a);_0x5756ce(_0x13212a);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index b9bbc3a..9f38017 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 _0x2569=['index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x43b929,_0x1ce9d0){var _0x2c3c43=function(_0x43ed7e){while(--_0x43ed7e){_0x43b929['push'](_0x43b929['shift']());}};_0x2c3c43(++_0x1ce9d0);}(_0x2569,0x97));var _0x9256=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x2569[_0x3ad7ad];return _0x225a60;};'use strict';var multer=require(_0x9256('0x0'));var util=require(_0x9256('0x1'));var path=require(_0x9256('0x2'));var timeout=require(_0x9256('0x3'));var express=require(_0x9256('0x4'));var router=express[_0x9256('0x5')]();var fs_extra=require(_0x9256('0x6'));var auth=require(_0x9256('0x7'));var interaction=require(_0x9256('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x9256('0x9')]('/',auth[_0x9256('0xa')](),controller[_0x9256('0xb')]);router['get'](_0x9256('0xc'),auth[_0x9256('0xa')](),controller[_0x9256('0xd')]);router['post']('/',auth[_0x9256('0xa')](),controller['create']);router[_0x9256('0xe')](_0x9256('0xc'),auth[_0x9256('0xa')](),controller['update']);router[_0x9256('0xf')](_0x9256('0xc'),auth[_0x9256('0xa')](),controller[_0x9256('0x10')]);module[_0x9256('0x11')]=router; \ No newline at end of file +var _0x5e99=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','delete'];(function(_0x5f4d27,_0x5aed51){var _0x358041=function(_0x936cad){while(--_0x936cad){_0x5f4d27['push'](_0x5f4d27['shift']());}};_0x358041(++_0x5aed51);}(_0x5e99,0x1ef));var _0x95e9=function(_0x5c6927,_0x28ffe0){_0x5c6927=_0x5c6927-0x0;var _0x5ef7f1=_0x5e99[_0x5c6927];return _0x5ef7f1;};'use strict';var multer=require(_0x95e9('0x0'));var util=require(_0x95e9('0x1'));var path=require('path');var timeout=require(_0x95e9('0x2'));var express=require(_0x95e9('0x3'));var router=express[_0x95e9('0x4')]();var fs_extra=require(_0x95e9('0x5'));var auth=require(_0x95e9('0x6'));var interaction=require(_0x95e9('0x7'));var config=require(_0x95e9('0x8'));var controller=require('./intVtigerField.controller');router[_0x95e9('0x9')]('/',auth[_0x95e9('0xa')](),controller[_0x95e9('0xb')]);router[_0x95e9('0x9')](_0x95e9('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x95e9('0xa')](),controller[_0x95e9('0xd')]);router['put']('/:id',auth[_0x95e9('0xa')](),controller['update']);router[_0x95e9('0xe')](_0x95e9('0xc'),auth[_0x95e9('0xa')](),controller[_0x95e9('0xf')]);module[_0x95e9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index dff5bf7..9143d07 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 _0x4220=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x6c0b00,_0x29d361){var _0x4a97c0=function(_0x56063e){while(--_0x56063e){_0x6c0b00['push'](_0x6c0b00['shift']());}};_0x4a97c0(++_0x29d361);}(_0x4220,0x1f1));var _0x0422=function(_0x183830,_0x351931){_0x183830=_0x183830-0x0;var _0x219e32=_0x4220[_0x183830];return _0x219e32;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0422('0x0')](_0x0422('0x1'),'variable',_0x0422('0x2'),'keyValue',_0x0422('0x3')),'defaultValue':_0x0422('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0422('0x4')]},'keyType':{'type':Sequelize[_0x0422('0x0')]('string',_0x0422('0x5'),_0x0422('0x2'))},'keyContent':{'type':Sequelize[_0x0422('0x4')]},'idField':{'type':Sequelize[_0x0422('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0422('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0422('0x4')]}}; \ No newline at end of file +var _0x2523=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string','STRING'];(function(_0x3839ec,_0x368f64){var _0x554872=function(_0x380df9){while(--_0x380df9){_0x3839ec['push'](_0x3839ec['shift']());}};_0x554872(++_0x368f64);}(_0x2523,0x1cc));var _0x3252=function(_0x460264,_0x51ddff){_0x460264=_0x460264-0x0;var _0x2d75a1=_0x2523[_0x460264];return _0x2d75a1;};'use strict';var Sequelize=require(_0x3252('0x0'));module[_0x3252('0x1')]={'type':{'type':Sequelize[_0x3252('0x2')]('string',_0x3252('0x3'),'customVariable',_0x3252('0x4'),_0x3252('0x5')),'defaultValue':_0x3252('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3252('0x7')]},'keyType':{'type':Sequelize[_0x3252('0x2')](_0x3252('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x3252('0x7')]},'idField':{'type':Sequelize[_0x3252('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3252('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3252('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3186144..c88abaa 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 _0x5a9a=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','VtigerField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5a9a,0x7a));var _0xa5a9=function(_0x2faa8d,_0x22846c){_0x2faa8d=_0x2faa8d-0x0;var _0x3244dd=_0x5a9a[_0x2faa8d];return _0x3244dd;};'use strict';var emlformat=require(_0xa5a9('0x0'));var rimraf=require(_0xa5a9('0x1'));var zipdir=require(_0xa5a9('0x2'));var jsonpatch=require(_0xa5a9('0x3'));var rp=require(_0xa5a9('0x4'));var moment=require(_0xa5a9('0x5'));var BPromise=require(_0xa5a9('0x6'));var Mustache=require(_0xa5a9('0x7'));var util=require('util');var path=require(_0xa5a9('0x8'));var sox=require(_0xa5a9('0x9'));var csv=require(_0xa5a9('0xa'));var ejs=require(_0xa5a9('0xb'));var fs=require('fs');var fs_extra=require(_0xa5a9('0xc'));var _=require('lodash');var squel=require(_0xa5a9('0xd'));var crypto=require(_0xa5a9('0xe'));var jsforce=require(_0xa5a9('0xf'));var deskjs=require(_0xa5a9('0x10'));var toCsv=require(_0xa5a9('0xa'));var querystring=require(_0xa5a9('0x11'));var Papa=require(_0xa5a9('0x12'));var Redis=require(_0xa5a9('0x13'));var authService=require(_0xa5a9('0x14'));var qs=require(_0xa5a9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a9('0x16'))(_0xa5a9('0x17'));var utils=require('../../config/utils');var config=require(_0xa5a9('0x18'));var licenseUtil=require(_0xa5a9('0x19'));var db=require(_0xa5a9('0x1a'))['db'];function respondWithStatusCode(_0x1d5812,_0x4fb40c){_0x4fb40c=_0x4fb40c||0xcc;return function(_0x3fe994){if(_0x3fe994){return _0x1d5812[_0xa5a9('0x1b')](_0x4fb40c);}return _0x1d5812[_0xa5a9('0x1c')](_0x4fb40c)[_0xa5a9('0x1d')]();};}function respondWithResult(_0x1753dc,_0x28531d){_0x28531d=_0x28531d||0xc8;return function(_0x32e18e){if(_0x32e18e){return _0x1753dc[_0xa5a9('0x1c')](_0x28531d)[_0xa5a9('0x1e')](_0x32e18e);}};}function respondWithFilteredResult(_0x2db095,_0x2096ea){return function(_0x2d0783){if(_0x2d0783){var _0x420b22=typeof _0x2096ea['offset']===_0xa5a9('0x1f')&&typeof _0x2096ea[_0xa5a9('0x20')]===_0xa5a9('0x1f');var _0x42c985=_0x2d0783[_0xa5a9('0x21')];var _0xdb3155=_0x420b22?0x0:_0x2096ea[_0xa5a9('0x22')];var _0x104d1c=_0x420b22?_0x2d0783[_0xa5a9('0x21')]:_0x2096ea[_0xa5a9('0x22')]+_0x2096ea[_0xa5a9('0x20')];var _0x115933;if(_0x104d1c>=_0x42c985){_0x104d1c=_0x42c985;_0x115933=0xc8;}else{_0x115933=0xce;}_0x2db095[_0xa5a9('0x1c')](_0x115933);return _0x2db095['set'](_0xa5a9('0x23'),_0xdb3155+'-'+_0x104d1c+'/'+_0x42c985)[_0xa5a9('0x1e')](_0x2d0783);}return null;};}function patchUpdates(_0x402cfb){return function(_0x274a00){try{jsonpatch[_0xa5a9('0x24')](_0x274a00,_0x402cfb,!![]);}catch(_0x2e4a83){return BPromise[_0xa5a9('0x25')](_0x2e4a83);}return _0x274a00[_0xa5a9('0x26')]();};}function saveUpdates(_0xa3da8d,_0x475a68){return function(_0x4ede31){if(_0x4ede31){return _0x4ede31[_0xa5a9('0x27')](_0xa3da8d)['then'](function(_0x4630d2){return _0x4630d2;});}return null;};}function removeEntity(_0x2dae16,_0x9b0ed6){return function(_0x103734){if(_0x103734){return _0x103734[_0xa5a9('0x28')]()[_0xa5a9('0x29')](function(){_0x2dae16[_0xa5a9('0x1c')](0xcc)[_0xa5a9('0x1d')]();});}};}function handleEntityNotFound(_0x54b293,_0x4de654){return function(_0x5800d6){if(!_0x5800d6){_0x54b293[_0xa5a9('0x1b')](0x194);}return _0x5800d6;};}function handleError(_0x537881,_0x1dd99a){_0x1dd99a=_0x1dd99a||0x1f4;return function(_0x18ee08){logger['error'](_0x18ee08[_0xa5a9('0x2a')]);if(_0x18ee08[_0xa5a9('0x2b')]){delete _0x18ee08[_0xa5a9('0x2b')];}_0x537881[_0xa5a9('0x1c')](_0x1dd99a)[_0xa5a9('0x2c')](_0x18ee08);};}exports['index']=function(_0x3da8e7,_0xd41eef){var _0x2d9fa6={},_0x54711f={},_0x58c087={'count':0x0,'rows':[]};var _0x248e2d=_[_0xa5a9('0x2d')](db[_0xa5a9('0x2e')][_0xa5a9('0x2f')],function(_0x1ae2ef){return{'name':_0x1ae2ef['fieldName'],'type':_0x1ae2ef[_0xa5a9('0x30')][_0xa5a9('0x31')]};});_0x54711f[_0xa5a9('0x32')]=_[_0xa5a9('0x2d')](_0x248e2d,'name');_0x54711f[_0xa5a9('0x33')]=_[_0xa5a9('0x34')](_0x3da8e7[_0xa5a9('0x33')]);_0x54711f[_0xa5a9('0x35')]=_[_0xa5a9('0x36')](_0x54711f[_0xa5a9('0x32')],_0x54711f[_0xa5a9('0x33')]);_0x2d9fa6['attributes']=_[_0xa5a9('0x36')](_0x54711f[_0xa5a9('0x32')],qs[_0xa5a9('0x37')](_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x37')]));_0x2d9fa6[_0xa5a9('0x38')]=_0x2d9fa6[_0xa5a9('0x38')]['length']?_0x2d9fa6[_0xa5a9('0x38')]:_0x54711f[_0xa5a9('0x32')];if(!_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x39')]('nolimit')){_0x2d9fa6[_0xa5a9('0x20')]=qs[_0xa5a9('0x20')](_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x20')]);_0x2d9fa6[_0xa5a9('0x22')]=qs[_0xa5a9('0x22')](_0x3da8e7['query']['offset']);}_0x2d9fa6['order']=qs[_0xa5a9('0x3a')](_0x3da8e7[_0xa5a9('0x33')]['sort']);_0x2d9fa6[_0xa5a9('0x3b')]=qs[_0xa5a9('0x35')](_[_0xa5a9('0x3c')](_0x3da8e7[_0xa5a9('0x33')],_0x54711f[_0xa5a9('0x35')]),_0x248e2d);if(_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x3d')]){_0x2d9fa6[_0xa5a9('0x3b')]=_[_0xa5a9('0x3e')](_0x2d9fa6['where'],{'$or':_[_0xa5a9('0x2d')](_0x248e2d,function(_0x2e24af){if(_0x2e24af[_0xa5a9('0x30')]!==_0xa5a9('0x3f')){var _0x1c0c05={};_0x1c0c05[_0x2e24af[_0xa5a9('0x2b')]]={'$like':'%'+_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x3d')]+'%'};return _0x1c0c05;}})});}_0x2d9fa6=_[_0xa5a9('0x3e')]({},_0x2d9fa6,_0x3da8e7[_0xa5a9('0x40')]);var _0x5742f9={'where':_0x2d9fa6[_0xa5a9('0x3b')]};return db[_0xa5a9('0x2e')][_0xa5a9('0x21')](_0x5742f9)['then'](function(_0x4563d8){_0x58c087['count']=_0x4563d8;if(_0x3da8e7[_0xa5a9('0x33')][_0xa5a9('0x41')]){_0x2d9fa6['include']=[{'all':!![]}];}return db[_0xa5a9('0x2e')][_0xa5a9('0x42')](_0x2d9fa6);})[_0xa5a9('0x29')](function(_0x2b6eae){_0x58c087[_0xa5a9('0x43')]=_0x2b6eae;return _0x58c087;})[_0xa5a9('0x29')](respondWithFilteredResult(_0xd41eef,_0x2d9fa6))[_0xa5a9('0x44')](handleError(_0xd41eef,null));};exports['show']=function(_0x502c67,_0x1e097c){var _0x1ff359={'raw':!![],'where':{'id':_0x502c67[_0xa5a9('0x45')]['id']}},_0x5cbf74={};_0x5cbf74[_0xa5a9('0x32')]=_[_0xa5a9('0x34')](db[_0xa5a9('0x2e')][_0xa5a9('0x2f')]);_0x5cbf74[_0xa5a9('0x33')]=_[_0xa5a9('0x34')](_0x502c67[_0xa5a9('0x33')]);_0x5cbf74[_0xa5a9('0x35')]=_[_0xa5a9('0x36')](_0x5cbf74[_0xa5a9('0x32')],_0x5cbf74[_0xa5a9('0x33')]);_0x1ff359[_0xa5a9('0x38')]=_[_0xa5a9('0x36')](_0x5cbf74[_0xa5a9('0x32')],qs[_0xa5a9('0x37')](_0x502c67[_0xa5a9('0x33')][_0xa5a9('0x37')]));_0x1ff359[_0xa5a9('0x38')]=_0x1ff359[_0xa5a9('0x38')][_0xa5a9('0x46')]?_0x1ff359[_0xa5a9('0x38')]:_0x5cbf74[_0xa5a9('0x32')];if(_0x502c67['query'][_0xa5a9('0x41')]){_0x1ff359['include']=[{'all':!![]}];}_0x1ff359=_['merge']({},_0x1ff359,_0x502c67['options']);return db[_0xa5a9('0x2e')][_0xa5a9('0x47')](_0x1ff359)['then'](handleEntityNotFound(_0x1e097c,null))['then'](respondWithResult(_0x1e097c,null))[_0xa5a9('0x44')](handleError(_0x1e097c,null));};exports[_0xa5a9('0x48')]=function(_0x29cc2f,_0x3b4ca6){return db[_0xa5a9('0x2e')][_0xa5a9('0x48')](_0x29cc2f[_0xa5a9('0x49')],{})[_0xa5a9('0x29')](respondWithResult(_0x3b4ca6,0xc9))['catch'](handleError(_0x3b4ca6,null));};exports[_0xa5a9('0x27')]=function(_0x2e3d1a,_0x3e5ab0){if(_0x2e3d1a[_0xa5a9('0x49')]['id']){delete _0x2e3d1a[_0xa5a9('0x49')]['id'];}return db[_0xa5a9('0x2e')][_0xa5a9('0x47')]({'where':{'id':_0x2e3d1a[_0xa5a9('0x45')]['id']}})[_0xa5a9('0x29')](handleEntityNotFound(_0x3e5ab0,null))['then'](saveUpdates(_0x2e3d1a['body'],null))['then'](respondWithResult(_0x3e5ab0,null))['catch'](handleError(_0x3e5ab0,null));};exports[_0xa5a9('0x28')]=function(_0x4079e0,_0xe36c38){return db[_0xa5a9('0x2e')][_0xa5a9('0x47')]({'where':{'id':_0x4079e0[_0xa5a9('0x45')]['id']}})[_0xa5a9('0x29')](handleEntityNotFound(_0xe36c38,null))[_0xa5a9('0x29')](removeEntity(_0xe36c38,null))[_0xa5a9('0x44')](handleError(_0xe36c38,null));}; \ No newline at end of file +var _0xeedb=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','then','stack','name','index','map','VtigerField','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','length','nolimit','order','sort','pick','filters','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','update','body'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xeedb,0xd2));var _0xbeed=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xeedb[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xbeed('0x0'));var rimraf=require(_0xbeed('0x1'));var zipdir=require(_0xbeed('0x2'));var jsonpatch=require(_0xbeed('0x3'));var rp=require('request-promise');var moment=require(_0xbeed('0x4'));var BPromise=require(_0xbeed('0x5'));var Mustache=require('mustache');var util=require(_0xbeed('0x6'));var path=require(_0xbeed('0x7'));var sox=require('sox');var csv=require(_0xbeed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbeed('0x9'));var crypto=require(_0xbeed('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbeed('0xb'));var toCsv=require(_0xbeed('0x8'));var querystring=require('querystring');var Papa=require(_0xbeed('0xc'));var Redis=require(_0xbeed('0xd'));var authService=require(_0xbeed('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbeed('0xf'));var hardwareService=require(_0xbeed('0x10'));var logger=require(_0xbeed('0x11'))(_0xbeed('0x12'));var utils=require(_0xbeed('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbeed('0x14'))['db'];function respondWithStatusCode(_0xf834c,_0x552a3a){_0x552a3a=_0x552a3a||0xcc;return function(_0xf5b5c5){if(_0xf5b5c5){return _0xf834c[_0xbeed('0x15')](_0x552a3a);}return _0xf834c[_0xbeed('0x16')](_0x552a3a)[_0xbeed('0x17')]();};}function respondWithResult(_0x5c1ce1,_0x39fe06){_0x39fe06=_0x39fe06||0xc8;return function(_0x266cb0){if(_0x266cb0){return _0x5c1ce1[_0xbeed('0x16')](_0x39fe06)[_0xbeed('0x18')](_0x266cb0);}};}function respondWithFilteredResult(_0x44126f,_0xe73d98){return function(_0x5f5345){if(_0x5f5345){var _0x257edf=typeof _0xe73d98[_0xbeed('0x19')]==='undefined'&&typeof _0xe73d98[_0xbeed('0x1a')]===_0xbeed('0x1b');var _0x4289b6=_0x5f5345[_0xbeed('0x1c')];var _0x38de7a=_0x257edf?0x0:_0xe73d98[_0xbeed('0x19')];var _0x137d2f=_0x257edf?_0x5f5345[_0xbeed('0x1c')]:_0xe73d98[_0xbeed('0x19')]+_0xe73d98['limit'];var _0x3fcd7c;if(_0x137d2f>=_0x4289b6){_0x137d2f=_0x4289b6;_0x3fcd7c=0xc8;}else{_0x3fcd7c=0xce;}_0x44126f['status'](_0x3fcd7c);return _0x44126f[_0xbeed('0x1d')](_0xbeed('0x1e'),_0x38de7a+'-'+_0x137d2f+'/'+_0x4289b6)[_0xbeed('0x18')](_0x5f5345);}return null;};}function patchUpdates(_0xe799b9){return function(_0x5b9aad){try{jsonpatch[_0xbeed('0x1f')](_0x5b9aad,_0xe799b9,!![]);}catch(_0xe84a8d){return BPromise[_0xbeed('0x20')](_0xe84a8d);}return _0x5b9aad['save']();};}function saveUpdates(_0x195b1c,_0x5f1188){return function(_0x25011e){if(_0x25011e){return _0x25011e['update'](_0x195b1c)['then'](function(_0x2d4332){return _0x2d4332;});}return null;};}function removeEntity(_0x508b28,_0x3c413a){return function(_0x10c1d0){if(_0x10c1d0){return _0x10c1d0[_0xbeed('0x21')]()[_0xbeed('0x22')](function(){_0x508b28[_0xbeed('0x16')](0xcc)[_0xbeed('0x17')]();});}};}function handleEntityNotFound(_0x371e62,_0xa41424){return function(_0x4ab6c0){if(!_0x4ab6c0){_0x371e62[_0xbeed('0x15')](0x194);}return _0x4ab6c0;};}function handleError(_0x4c6242,_0x544039){_0x544039=_0x544039||0x1f4;return function(_0x4ae1f3){logger['error'](_0x4ae1f3[_0xbeed('0x23')]);if(_0x4ae1f3[_0xbeed('0x24')]){delete _0x4ae1f3['name'];}_0x4c6242[_0xbeed('0x16')](_0x544039)['send'](_0x4ae1f3);};}exports[_0xbeed('0x25')]=function(_0x575c63,_0x3e275a){var _0x53a7dd={},_0x798b94={},_0xa422d6={'count':0x0,'rows':[]};var _0xedaf1d=_[_0xbeed('0x26')](db[_0xbeed('0x27')][_0xbeed('0x28')],function(_0x3fff21){return{'name':_0x3fff21[_0xbeed('0x29')],'type':_0x3fff21['type'][_0xbeed('0x2a')]};});_0x798b94['model']=_[_0xbeed('0x26')](_0xedaf1d,'name');_0x798b94[_0xbeed('0x2b')]=_[_0xbeed('0x2c')](_0x575c63[_0xbeed('0x2b')]);_0x798b94['filters']=_[_0xbeed('0x2d')](_0x798b94['model'],_0x798b94['query']);_0x53a7dd[_0xbeed('0x2e')]=_['intersection'](_0x798b94[_0xbeed('0x2f')],qs['fields'](_0x575c63[_0xbeed('0x2b')]['fields']));_0x53a7dd['attributes']=_0x53a7dd['attributes'][_0xbeed('0x30')]?_0x53a7dd['attributes']:_0x798b94[_0xbeed('0x2f')];if(!_0x575c63['query']['hasOwnProperty'](_0xbeed('0x31'))){_0x53a7dd[_0xbeed('0x1a')]=qs[_0xbeed('0x1a')](_0x575c63[_0xbeed('0x2b')][_0xbeed('0x1a')]);_0x53a7dd[_0xbeed('0x19')]=qs[_0xbeed('0x19')](_0x575c63[_0xbeed('0x2b')][_0xbeed('0x19')]);}_0x53a7dd[_0xbeed('0x32')]=qs[_0xbeed('0x33')](_0x575c63[_0xbeed('0x2b')][_0xbeed('0x33')]);_0x53a7dd['where']=qs['filters'](_[_0xbeed('0x34')](_0x575c63[_0xbeed('0x2b')],_0x798b94[_0xbeed('0x35')]),_0xedaf1d);if(_0x575c63[_0xbeed('0x2b')]['filter']){_0x53a7dd[_0xbeed('0x36')]=_[_0xbeed('0x37')](_0x53a7dd[_0xbeed('0x36')],{'$or':_[_0xbeed('0x26')](_0xedaf1d,function(_0x3e4c71){if(_0x3e4c71[_0xbeed('0x38')]!==_0xbeed('0x39')){var _0x527556={};_0x527556[_0x3e4c71[_0xbeed('0x24')]]={'$like':'%'+_0x575c63[_0xbeed('0x2b')]['filter']+'%'};return _0x527556;}})});}_0x53a7dd=_[_0xbeed('0x37')]({},_0x53a7dd,_0x575c63[_0xbeed('0x3a')]);var _0xc96a93={'where':_0x53a7dd['where']};return db[_0xbeed('0x27')][_0xbeed('0x1c')](_0xc96a93)[_0xbeed('0x22')](function(_0x26eb5b){_0xa422d6[_0xbeed('0x1c')]=_0x26eb5b;if(_0x575c63['query'][_0xbeed('0x3b')]){_0x53a7dd[_0xbeed('0x3c')]=[{'all':!![]}];}return db[_0xbeed('0x27')][_0xbeed('0x3d')](_0x53a7dd);})[_0xbeed('0x22')](function(_0xa07c7b){_0xa422d6[_0xbeed('0x3e')]=_0xa07c7b;return _0xa422d6;})['then'](respondWithFilteredResult(_0x3e275a,_0x53a7dd))[_0xbeed('0x3f')](handleError(_0x3e275a,null));};exports['show']=function(_0x171a44,_0x2712dd){var _0x13b60c={'raw':!![],'where':{'id':_0x171a44[_0xbeed('0x40')]['id']}},_0x4515dd={};_0x4515dd[_0xbeed('0x2f')]=_[_0xbeed('0x2c')](db[_0xbeed('0x27')][_0xbeed('0x28')]);_0x4515dd[_0xbeed('0x2b')]=_[_0xbeed('0x2c')](_0x171a44[_0xbeed('0x2b')]);_0x4515dd[_0xbeed('0x35')]=_['intersection'](_0x4515dd['model'],_0x4515dd[_0xbeed('0x2b')]);_0x13b60c[_0xbeed('0x2e')]=_[_0xbeed('0x2d')](_0x4515dd['model'],qs[_0xbeed('0x41')](_0x171a44[_0xbeed('0x2b')][_0xbeed('0x41')]));_0x13b60c[_0xbeed('0x2e')]=_0x13b60c[_0xbeed('0x2e')][_0xbeed('0x30')]?_0x13b60c['attributes']:_0x4515dd[_0xbeed('0x2f')];if(_0x171a44[_0xbeed('0x2b')][_0xbeed('0x3b')]){_0x13b60c[_0xbeed('0x3c')]=[{'all':!![]}];}_0x13b60c=_['merge']({},_0x13b60c,_0x171a44['options']);return db['VtigerField'][_0xbeed('0x42')](_0x13b60c)[_0xbeed('0x22')](handleEntityNotFound(_0x2712dd,null))[_0xbeed('0x22')](respondWithResult(_0x2712dd,null))[_0xbeed('0x3f')](handleError(_0x2712dd,null));};exports[_0xbeed('0x43')]=function(_0xfbf819,_0x431d2d){return db[_0xbeed('0x27')][_0xbeed('0x43')](_0xfbf819['body'],{})[_0xbeed('0x22')](respondWithResult(_0x431d2d,0xc9))['catch'](handleError(_0x431d2d,null));};exports[_0xbeed('0x44')]=function(_0x4bc8af,_0x52e5c2){if(_0x4bc8af[_0xbeed('0x45')]['id']){delete _0x4bc8af['body']['id'];}return db[_0xbeed('0x27')]['find']({'where':{'id':_0x4bc8af[_0xbeed('0x40')]['id']}})[_0xbeed('0x22')](handleEntityNotFound(_0x52e5c2,null))['then'](saveUpdates(_0x4bc8af[_0xbeed('0x45')],null))[_0xbeed('0x22')](respondWithResult(_0x52e5c2,null))[_0xbeed('0x3f')](handleError(_0x52e5c2,null));};exports['destroy']=function(_0x9bc2cb,_0x5e56ae){return db[_0xbeed('0x27')]['find']({'where':{'id':_0x9bc2cb['params']['id']}})[_0xbeed('0x22')](handleEntityNotFound(_0x5e56ae,null))['then'](removeEntity(_0x5e56ae,null))['catch'](handleError(_0x5e56ae,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index aeba7f9..1d9c69a 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 _0xe886=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x5e9f06,_0x3dd75c){var _0x4c9dd5=function(_0x5dc2e1){while(--_0x5dc2e1){_0x5e9f06['push'](_0x5e9f06['shift']());}};_0x4c9dd5(++_0x3dd75c);}(_0xe886,0x1ee));var _0x6e88=function(_0x7affc1,_0x17c238){_0x7affc1=_0x7affc1-0x0;var _0x5f4941=_0xe886[_0x7affc1];return _0x5f4941;};'use strict';var _=require(_0x6e88('0x0'));var util=require(_0x6e88('0x1'));var logger=require(_0x6e88('0x2'))(_0x6e88('0x3'));var moment=require('moment');var BPromise=require(_0x6e88('0x4'));var rp=require(_0x6e88('0x5'));var fs=require('fs');var path=require(_0x6e88('0x6'));var rimraf=require(_0x6e88('0x7'));var config=require(_0x6e88('0x8'));var attributes=require(_0x6e88('0x9'));module['exports']=function(_0x5087eb,_0x5b3392){return _0x5087eb[_0x6e88('0xa')](_0x6e88('0xb'),attributes,{'tableName':_0x6e88('0xc'),'paranoid':![],'indexes':[{'name':_0x6e88('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeada=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x8c6162,_0x25acaf){var _0x36caa9=function(_0x568282){while(--_0x568282){_0x8c6162['push'](_0x8c6162['shift']());}};_0x36caa9(++_0x25acaf);}(_0xeada,0xa4));var _0xaead=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeada[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xaead('0x0'));var util=require(_0xaead('0x1'));var logger=require(_0xaead('0x2'))(_0xaead('0x3'));var moment=require(_0xaead('0x4'));var BPromise=require('bluebird');var rp=require(_0xaead('0x5'));var fs=require('fs');var path=require(_0xaead('0x6'));var rimraf=require(_0xaead('0x7'));var config=require(_0xaead('0x8'));var attributes=require(_0xaead('0x9'));module[_0xaead('0xa')]=function(_0x3366a7,_0xbcb160){return _0x3366a7['define'](_0xaead('0xb'),attributes,{'tableName':_0xaead('0xc'),'paranoid':![],'indexes':[{'name':_0xaead('0xd'),'fields':[_0xaead('0xe'),_0xaead('0xf')],'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 ff23311..0929412 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 _0x7d87=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4318e1,_0x1df511){var _0xd4f7d1=function(_0x508836){while(--_0x508836){_0x4318e1['push'](_0x4318e1['shift']());}};_0xd4f7d1(++_0x1df511);}(_0x7d87,0x14c));var _0x77d8=function(_0x573a27,_0x26d295){_0x573a27=_0x573a27-0x0;var _0x49f7c0=_0x7d87[_0x573a27];return _0x49f7c0;};'use strict';var _=require(_0x77d8('0x0'));var util=require('util');var moment=require(_0x77d8('0x1'));var BPromise=require(_0x77d8('0x2'));var rs=require(_0x77d8('0x3'));var fs=require('fs');var Redis=require(_0x77d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x77d8('0x5'))(_0x77d8('0x6'));var config=require(_0x77d8('0x7'));var jayson=require(_0x77d8('0x8'));var client=jayson[_0x77d8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34922b,_0x1449ad,_0x21b92b){return new BPromise(function(_0x256e1e,_0x5a0dbf){return client[_0x77d8('0xa')](_0x34922b,_0x21b92b)['then'](function(_0x215155){logger['info'](_0x77d8('0xb'),_0x1449ad,'request\x20sent');logger[_0x77d8('0xc')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1449ad,_0x77d8('0xd'),JSON[_0x77d8('0xe')](_0x215155));if(_0x215155[_0x77d8('0xf')]){if(_0x215155['error'][_0x77d8('0x10')]===0x1f4){logger[_0x77d8('0xf')](_0x77d8('0xb'),_0x1449ad,_0x215155[_0x77d8('0xf')][_0x77d8('0x11')]);return _0x5a0dbf(_0x215155['error'][_0x77d8('0x11')]);}logger[_0x77d8('0xf')](_0x77d8('0xb'),_0x1449ad,_0x215155['error']['message']);return _0x256e1e(_0x215155[_0x77d8('0xf')][_0x77d8('0x11')]);}else{logger[_0x77d8('0x12')]('VtigerField,\x20%s,\x20%s',_0x1449ad,_0x77d8('0xd'));_0x256e1e(_0x215155[_0x77d8('0x13')][_0x77d8('0x11')]);}})[_0x77d8('0x14')](function(_0x49ef02){logger[_0x77d8('0xf')](_0x77d8('0xb'),_0x1449ad,_0x49ef02);_0x5a0dbf(_0x49ef02);});});} \ No newline at end of file +var _0x6206=['request','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6206,0x193));var _0x6620=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6206[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6620('0x0'));var util=require(_0x6620('0x1'));var moment=require(_0x6620('0x2'));var BPromise=require(_0x6620('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6620('0x4'));var logger=require(_0x6620('0x5'))(_0x6620('0x6'));var config=require(_0x6620('0x7'));var jayson=require(_0x6620('0x8'));var client=jayson[_0x6620('0x9')][_0x6620('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x248b1d,_0x46d743,_0x3c1960){return new BPromise(function(_0x152499,_0x4dba13){return client[_0x6620('0xb')](_0x248b1d,_0x3c1960)[_0x6620('0xc')](function(_0x47745b){logger[_0x6620('0xd')]('VtigerField,\x20%s,\x20%s',_0x46d743,'request\x20sent');logger[_0x6620('0xe')](_0x6620('0xf'),_0x46d743,_0x6620('0x10'),JSON[_0x6620('0x11')](_0x47745b));if(_0x47745b[_0x6620('0x12')]){if(_0x47745b['error'][_0x6620('0x13')]===0x1f4){logger[_0x6620('0x12')](_0x6620('0x14'),_0x46d743,_0x47745b[_0x6620('0x12')]['message']);return _0x4dba13(_0x47745b['error'][_0x6620('0x15')]);}logger[_0x6620('0x12')](_0x6620('0x14'),_0x46d743,_0x47745b[_0x6620('0x12')][_0x6620('0x15')]);return _0x152499(_0x47745b[_0x6620('0x12')][_0x6620('0x15')]);}else{logger[_0x6620('0xd')](_0x6620('0x14'),_0x46d743,_0x6620('0x10'));_0x152499(_0x47745b['result'][_0x6620('0x15')]);}})[_0x6620('0x16')](function(_0x23a698){logger[_0x6620('0x12')]('VtigerField,\x20%s,\x20%s',_0x46d743,_0x23a698);_0x4dba13(_0x23a698);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index fe608b6..6beade7 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 _0x1bce=['getFields','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x1ff414,_0x12c95d){var _0x52c0fa=function(_0x57f936){while(--_0x57f936){_0x1ff414['push'](_0x1ff414['shift']());}};_0x52c0fa(++_0x12c95d);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var path=require('path');var timeout=require(_0xe1bc('0x2'));var express=require(_0xe1bc('0x3'));var router=express[_0xe1bc('0x4')]();var fs_extra=require(_0xe1bc('0x5'));var auth=require(_0xe1bc('0x6'));var interaction=require(_0xe1bc('0x7'));var config=require(_0xe1bc('0x8'));var controller=require(_0xe1bc('0x9'));router[_0xe1bc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe1bc('0xa')](_0xe1bc('0xb'),auth[_0xe1bc('0xc')](),controller[_0xe1bc('0xd')]);router[_0xe1bc('0xa')](_0xe1bc('0xe'),auth['isAuthenticated'](),controller[_0xe1bc('0xf')]);router['get'](_0xe1bc('0x10'),auth[_0xe1bc('0xc')](),controller[_0xe1bc('0x11')]);router['post']('/',auth[_0xe1bc('0xc')](),controller[_0xe1bc('0x12')]);router['post'](_0xe1bc('0xe'),auth[_0xe1bc('0xc')](),controller['addConfiguration']);router['put'](_0xe1bc('0xb'),auth[_0xe1bc('0xc')](),controller[_0xe1bc('0x13')]);router['delete']('/:id',auth[_0xe1bc('0xc')](),controller[_0xe1bc('0x14')]);module[_0xe1bc('0x15')]=router; \ No newline at end of file +var _0x609a=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','delete','multer','path','connect-timeout'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x609a,0x11d));var _0xa609=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x609a[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xa609('0x0'));var util=require('util');var path=require(_0xa609('0x1'));var timeout=require(_0xa609('0x2'));var express=require(_0xa609('0x3'));var router=express[_0xa609('0x4')]();var fs_extra=require(_0xa609('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa609('0x6'));var controller=require('./intZendeskAccount.controller');router[_0xa609('0x7')]('/',auth[_0xa609('0x8')](),controller[_0xa609('0x9')]);router[_0xa609('0x7')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0xb')]);router[_0xa609('0x7')](_0xa609('0xc'),auth[_0xa609('0x8')](),controller['getConfigurations']);router[_0xa609('0x7')](_0xa609('0xd'),auth[_0xa609('0x8')](),controller['getFields']);router[_0xa609('0xe')]('/',auth['isAuthenticated'](),controller[_0xa609('0xf')]);router[_0xa609('0xe')](_0xa609('0xc'),auth[_0xa609('0x8')](),controller[_0xa609('0x10')]);router['put']('/:id',auth[_0xa609('0x8')](),controller['update']);router[_0xa609('0x11')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f71ab66..913c960 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 _0x9af6=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9af6,0x1d7));var _0x69af=function(_0x449b6e,_0x25e5e0){_0x449b6e=_0x449b6e-0x0;var _0x467114=_0x9af6[_0x449b6e];return _0x467114;};'use strict';var Sequelize=require(_0x69af('0x0'));module[_0x69af('0x1')]={'name':{'type':Sequelize[_0x69af('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x69af('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x69af('0x2')],'unique':_0x69af('0x4')},'authType':{'type':Sequelize[_0x69af('0x5')]('password',_0x69af('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x69af('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x69af('0x5')](_0x69af('0x7'),_0x69af('0x8')),'defaultValue':_0x69af('0x7')}}; \ No newline at end of file +var _0x90b1=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username','password'];(function(_0x30ef20,_0x20c103){var _0x57ba86=function(_0x33a588){while(--_0x33a588){_0x30ef20['push'](_0x30ef20['shift']());}};_0x57ba86(++_0x20c103);}(_0x90b1,0x1bb));var _0x190b=function(_0x1db72a,_0x22f6bc){_0x1db72a=_0x1db72a-0x0;var _0x1c7ee7=_0x90b1[_0x1db72a];return _0x1c7ee7;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x190b('0x3')},'password':{'type':Sequelize[_0x190b('0x2')]},'token':{'type':Sequelize[_0x190b('0x2')]},'remoteUri':{'type':Sequelize[_0x190b('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0x190b('0x4')},'serverUrl':{'type':Sequelize[_0x190b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x190b('0x5')](_0x190b('0x6'),_0x190b('0x7')),'defaultValue':_0x190b('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2999321..75923b7 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 _0x0102=['VIRTUAL','options','ZendeskAccount','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskConfiguration','ZendeskField','getFields','password','token','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','json','apply','reject','then','sendStatus','error','stack','name','send','index','map','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','pick','filters','filter','merge'];(function(_0x17cb08,_0x386e2e){var _0x574dc5=function(_0x4a347e){while(--_0x4a347e){_0x17cb08['push'](_0x17cb08['shift']());}};_0x574dc5(++_0x386e2e);}(_0x0102,0x186));var _0x2010=function(_0x3aa522,_0x18606e){_0x3aa522=_0x3aa522-0x0;var _0x4356b2=_0x0102[_0x3aa522];return _0x4356b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];var integrations=require(_0x2010('0x18'));function respondWithStatusCode(_0x3e8624,_0x388991){_0x388991=_0x388991||0xcc;return function(_0x528a38){if(_0x528a38){return _0x3e8624['sendStatus'](_0x388991);}return _0x3e8624[_0x2010('0x19')](_0x388991)[_0x2010('0x1a')]();};}function respondWithResult(_0x2e8ec2,_0x10b587){_0x10b587=_0x10b587||0xc8;return function(_0x32d791){if(_0x32d791){return _0x2e8ec2[_0x2010('0x19')](_0x10b587)['json'](_0x32d791);}};}function respondWithFilteredResult(_0x3195fa,_0x136418){return function(_0x5ad412){if(_0x5ad412){var _0x41e267=typeof _0x136418[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x136418[_0x2010('0x1d')]===_0x2010('0x1c');var _0x11bd28=_0x5ad412[_0x2010('0x1e')];var _0x1476c0=_0x41e267?0x0:_0x136418[_0x2010('0x1b')];var _0x569de2=_0x41e267?_0x5ad412['count']:_0x136418[_0x2010('0x1b')]+_0x136418[_0x2010('0x1d')];var _0x3f9d62;if(_0x569de2>=_0x11bd28){_0x569de2=_0x11bd28;_0x3f9d62=0xc8;}else{_0x3f9d62=0xce;}_0x3195fa[_0x2010('0x19')](_0x3f9d62);return _0x3195fa['set']('Content-Range',_0x1476c0+'-'+_0x569de2+'/'+_0x11bd28)[_0x2010('0x1f')](_0x5ad412);}return null;};}function patchUpdates(_0x171e45){return function(_0x37b51b){try{jsonpatch[_0x2010('0x20')](_0x37b51b,_0x171e45,!![]);}catch(_0x103bbc){return BPromise[_0x2010('0x21')](_0x103bbc);}return _0x37b51b['save']();};}function saveUpdates(_0x3db13d,_0x1cfa57){return function(_0x58ff30){if(_0x58ff30){return _0x58ff30['update'](_0x3db13d)['then'](function(_0x424453){return _0x424453;});}return null;};}function removeEntity(_0x574719,_0x277dcc){return function(_0x5f4233){if(_0x5f4233){return _0x5f4233['destroy']()[_0x2010('0x22')](function(){_0x574719[_0x2010('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x99ebe0,_0x4cff59){return function(_0x2a12ee){if(!_0x2a12ee){_0x99ebe0[_0x2010('0x23')](0x194);}return _0x2a12ee;};}function handleError(_0x3929d9,_0x3dcea4){_0x3dcea4=_0x3dcea4||0x1f4;return function(_0x3c5862){logger[_0x2010('0x24')](_0x3c5862[_0x2010('0x25')]);if(_0x3c5862[_0x2010('0x26')]){delete _0x3c5862[_0x2010('0x26')];}_0x3929d9[_0x2010('0x19')](_0x3dcea4)[_0x2010('0x27')](_0x3c5862);};}exports[_0x2010('0x28')]=function(_0x499cbe,_0x2a4691){var _0x52fe5e={},_0x5b52fb={},_0x147a5a={'count':0x0,'rows':[]};var _0xd16c04=_[_0x2010('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x136d5f){return{'name':_0x136d5f['fieldName'],'type':_0x136d5f[_0x2010('0x2a')][_0x2010('0x2b')]};});_0x5b52fb['model']=_[_0x2010('0x29')](_0xd16c04,_0x2010('0x26'));_0x5b52fb[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x499cbe[_0x2010('0x2c')]);_0x5b52fb['filters']=_[_0x2010('0x2e')](_0x5b52fb[_0x2010('0x2f')],_0x5b52fb[_0x2010('0x2c')]);_0x52fe5e['attributes']=_['intersection'](_0x5b52fb[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x499cbe[_0x2010('0x2c')]['fields']));_0x52fe5e['attributes']=_0x52fe5e[_0x2010('0x31')][_0x2010('0x32')]?_0x52fe5e[_0x2010('0x31')]:_0x5b52fb[_0x2010('0x2f')];if(!_0x499cbe[_0x2010('0x2c')]['hasOwnProperty']('nolimit')){_0x52fe5e['limit']=qs[_0x2010('0x1d')](_0x499cbe[_0x2010('0x2c')][_0x2010('0x1d')]);_0x52fe5e['offset']=qs[_0x2010('0x1b')](_0x499cbe[_0x2010('0x2c')][_0x2010('0x1b')]);}_0x52fe5e[_0x2010('0x33')]=qs['sort'](_0x499cbe[_0x2010('0x2c')][_0x2010('0x34')]);_0x52fe5e[_0x2010('0x35')]=qs['filters'](_[_0x2010('0x36')](_0x499cbe['query'],_0x5b52fb[_0x2010('0x37')]),_0xd16c04);if(_0x499cbe[_0x2010('0x2c')][_0x2010('0x38')]){_0x52fe5e[_0x2010('0x35')]=_[_0x2010('0x39')](_0x52fe5e[_0x2010('0x35')],{'$or':_['map'](_0xd16c04,function(_0x1e4460){if(_0x1e4460['type']!==_0x2010('0x3a')){var _0x157c73={};_0x157c73[_0x1e4460[_0x2010('0x26')]]={'$like':'%'+_0x499cbe[_0x2010('0x2c')][_0x2010('0x38')]+'%'};return _0x157c73;}})});}_0x52fe5e=_[_0x2010('0x39')]({},_0x52fe5e,_0x499cbe[_0x2010('0x3b')]);var _0x36ff3e={'where':_0x52fe5e[_0x2010('0x35')]};return db[_0x2010('0x3c')][_0x2010('0x1e')](_0x36ff3e)[_0x2010('0x22')](function(_0x1c2b13){_0x147a5a[_0x2010('0x1e')]=_0x1c2b13;if(_0x499cbe['query']['includeAll']){_0x52fe5e[_0x2010('0x3d')]=[{'all':!![]}];}return db[_0x2010('0x3c')][_0x2010('0x3e')](_0x52fe5e);})[_0x2010('0x22')](function(_0x3d5906){_0x147a5a[_0x2010('0x3f')]=_0x3d5906;return _0x147a5a;})[_0x2010('0x22')](respondWithFilteredResult(_0x2a4691,_0x52fe5e))['catch'](handleError(_0x2a4691,null));};exports[_0x2010('0x40')]=function(_0x578645,_0x27fd64){var _0x3ff496={'raw':![],'where':{'id':_0x578645[_0x2010('0x41')]['id']}},_0x16db82={};_0x16db82[_0x2010('0x2f')]=_['keys'](db[_0x2010('0x3c')][_0x2010('0x42')]);_0x16db82[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x578645['query']);_0x16db82[_0x2010('0x37')]=_['intersection'](_0x16db82['model'],_0x16db82['query']);_0x3ff496[_0x2010('0x31')]=_[_0x2010('0x2e')](_0x16db82[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x578645[_0x2010('0x2c')][_0x2010('0x30')]));_0x3ff496['attributes']=_0x3ff496[_0x2010('0x31')][_0x2010('0x32')]?_0x3ff496[_0x2010('0x31')]:_0x16db82['model'];if(_0x578645['query'][_0x2010('0x43')]){_0x3ff496['include']=[{'all':!![]}];}_0x3ff496=_[_0x2010('0x39')]({},_0x3ff496,_0x578645[_0x2010('0x3b')]);return db[_0x2010('0x3c')][_0x2010('0x44')](_0x3ff496)['then'](handleEntityNotFound(_0x27fd64,null))[_0x2010('0x22')](respondWithResult(_0x27fd64,null))[_0x2010('0x45')](handleError(_0x27fd64,null));};exports[_0x2010('0x46')]=function(_0x231db7,_0x3ec24c){return db[_0x2010('0x3c')]['create'](_0x231db7[_0x2010('0x47')],{})[_0x2010('0x22')](respondWithResult(_0x3ec24c,0xc9))[_0x2010('0x45')](handleError(_0x3ec24c,null));};exports['update']=function(_0x30e5d0,_0x1dd027){if(_0x30e5d0['body']['id']){delete _0x30e5d0[_0x2010('0x47')]['id'];}return db[_0x2010('0x3c')][_0x2010('0x44')]({'where':{'id':_0x30e5d0[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x1dd027,null))[_0x2010('0x22')](saveUpdates(_0x30e5d0[_0x2010('0x47')],null))[_0x2010('0x22')](respondWithResult(_0x1dd027,null))['catch'](handleError(_0x1dd027,null));};exports['destroy']=function(_0xc9f070,_0xe1721f){return db['ZendeskAccount'][_0x2010('0x44')]({'where':{'id':_0xc9f070[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0xe1721f,null))[_0x2010('0x22')](removeEntity(_0xe1721f,null))[_0x2010('0x45')](handleError(_0xe1721f,null));};exports['getConfigurations']=function(_0x5f4e98,_0x3fca06,_0x137452){var _0x4694e7={};var _0x3b89de={};var _0x38e596;var _0x2d8164;return db[_0x2010('0x3c')][_0x2010('0x48')]({'where':{'id':_0x5f4e98[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x3fca06,null))[_0x2010('0x22')](function(_0x5313b5){if(_0x5313b5){_0x38e596=_0x5313b5;_0x3b89de[_0x2010('0x2f')]=_[_0x2010('0x2d')](db['ZendeskConfiguration'][_0x2010('0x42')]);_0x3b89de[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x5f4e98[_0x2010('0x2c')]);_0x3b89de[_0x2010('0x37')]=_[_0x2010('0x2e')](_0x3b89de[_0x2010('0x2f')],_0x3b89de[_0x2010('0x2c')]);_0x4694e7[_0x2010('0x31')]=_[_0x2010('0x2e')](_0x3b89de[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x30')]));_0x4694e7[_0x2010('0x31')]=_0x4694e7[_0x2010('0x31')][_0x2010('0x32')]?_0x4694e7[_0x2010('0x31')]:_0x3b89de[_0x2010('0x2f')];_0x4694e7[_0x2010('0x33')]=qs[_0x2010('0x34')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x34')]);_0x4694e7['where']=qs[_0x2010('0x37')](_['pick'](_0x5f4e98['query'],_0x3b89de[_0x2010('0x37')]));if(_0x5f4e98[_0x2010('0x2c')]['filter']){_0x4694e7[_0x2010('0x35')]=_[_0x2010('0x39')](_0x4694e7[_0x2010('0x35')],{'$or':_[_0x2010('0x29')](_0x4694e7['attributes'],function(_0x3c6484){var _0x44816e={};_0x44816e[_0x3c6484]={'$like':'%'+_0x5f4e98[_0x2010('0x2c')][_0x2010('0x38')]+'%'};return _0x44816e;})});}_0x4694e7=_['merge']({},_0x4694e7,_0x5f4e98[_0x2010('0x3b')]);return _0x38e596['getConfigurations'](_0x4694e7);}})[_0x2010('0x22')](function(_0x2bc708){if(_0x2bc708){_0x2d8164=_0x2bc708[_0x2010('0x32')];if(!_0x5f4e98[_0x2010('0x2c')]['hasOwnProperty']('nolimit')){_0x4694e7[_0x2010('0x1d')]=qs[_0x2010('0x1d')](_0x5f4e98['query']['limit']);_0x4694e7[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x1b')]);}return _0x38e596['getConfigurations'](_0x4694e7);}})[_0x2010('0x22')](function(_0x5a2c7e){if(_0x5a2c7e){return _0x5a2c7e?{'count':_0x2d8164,'rows':_0x5a2c7e}:null;}})[_0x2010('0x22')](respondWithResult(_0x3fca06,null))[_0x2010('0x45')](handleError(_0x3fca06,null));};exports[_0x2010('0x49')]=function(_0x1d81e1,_0x4bde43,_0x340882){if(_0x1d81e1[_0x2010('0x47')]['id']){delete _0x1d81e1['body']['id'];}return db[_0x2010('0x3c')][_0x2010('0x48')]({'where':{'id':_0x1d81e1[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x4bde43,null))[_0x2010('0x22')](function(_0x8df400){if(_0x8df400){_0x1d81e1[_0x2010('0x47')][_0x2010('0x4a')]=_0x8df400['id'];_0x1d81e1[_0x2010('0x47')][_0x2010('0x4b')]=integrations[_0x2010('0x4c')](_0x1d81e1[_0x2010('0x47')]['channel'],_0x1d81e1[_0x2010('0x47')][_0x2010('0x2a')]);_0x1d81e1[_0x2010('0x47')]['Descriptions']=integrations['getDescriptions'](_0x1d81e1[_0x2010('0x47')][_0x2010('0x4d')],_0x1d81e1[_0x2010('0x47')][_0x2010('0x2a')]);return db[_0x2010('0x4e')][_0x2010('0x46')](_0x1d81e1['body'],{'include':[{'model':db[_0x2010('0x4f')],'as':_0x2010('0x4b')},{'model':db[_0x2010('0x4f')],'as':'Descriptions'}]});}return null;})[_0x2010('0x22')](respondWithResult(_0x4bde43,null))[_0x2010('0x45')](handleError(_0x4bde43,null));};exports[_0x2010('0x50')]=function(_0x5182b2,_0x20dea1,_0x22f654){var _0x4adc1c='';return db['ZendeskAccount'][_0x2010('0x48')]({'where':{'id':_0x5182b2['params']['id']},'attributes':['id','username',_0x2010('0x51'),_0x2010('0x52'),_0x2010('0x53'),_0x2010('0x54')]})[_0x2010('0x22')](handleEntityNotFound(_0x20dea1,null))[_0x2010('0x22')](function(_0xdf6767){if(_0xdf6767){_0x4adc1c=_0xdf6767[_0x2010('0x54')];var _0xee7084=_0x4adc1c[_0x2010('0x55')](-0x1);if(_0xee7084==='/'){_0x4adc1c=_0x4adc1c['substring'](0x0,_0x4adc1c[_0x2010('0x56')](_0xee7084));}var _0x1c1373={'method':'GET','uri':util[_0x2010('0x57')](_0x2010('0x58'),_0x4adc1c,_0x2010('0x59')),'json':!![]};switch(_0xdf6767[_0x2010('0x53')]){case'password':_0x1c1373[_0x2010('0x5a')]={'Authorization':util[_0x2010('0x57')]('Basic\x20%s',new Buffer(util['format'](_0x2010('0x5b'),_0xdf6767['username'],_0xdf6767[_0x2010('0x51')]))[_0x2010('0x5c')](_0x2010('0x5d')))};break;case _0x2010('0x52'):_0x1c1373[_0x2010('0x5a')]={'Authorization':util[_0x2010('0x57')](_0x2010('0x5e'),new Buffer(util['format'](_0x2010('0x5f'),_0xdf6767[_0x2010('0x60')],_0xdf6767[_0x2010('0x52')]))['toString'](_0x2010('0x5d')))};break;default:throw new db[(_0x2010('0x61'))][(_0x2010('0x62'))](_0x2010('0x63'));}return rp(_0x1c1373);}})[_0x2010('0x22')](function(_0x41c3cc){if(_0x41c3cc){var _0x40885b=[_0x2010('0x64'),'description',_0x2010('0x65'),_0x2010('0x66')];_[_0x2010('0x67')](_0x41c3cc['ticket_fields'],function(_0xb6ba3f){return _0x40885b[_0x2010('0x68')](_0xb6ba3f['type']);});return{'count':_0x41c3cc[_0x2010('0x59')][_0x2010('0x32')],'rows':_[_0x2010('0x29')](_0x41c3cc[_0x2010('0x59')],function(_0x38e733){return{'id':_0x38e733['id'],'name':_0x38e733['position']>0x7?_0x38e733[_0x2010('0x69')]:_0x38e733[_0x2010('0x2a')],'custom':_0x38e733['position']>0x7?!![]:![],'options':_0x38e733[_0x2010('0x6a')]?_0x38e733[_0x2010('0x6a')]:_0x38e733['custom_field_options']?_0x38e733[_0x2010('0x6b')]:[]};})};}})['then'](respondWithResult(_0x20dea1,null))['catch'](function(_0x44e47e){var _0x17f7c5=_0x5182b2[_0x2010('0x2c')][_0x2010('0x6c')]?0x1f4:_0x44e47e[_0x2010('0x6d')]||0x1f4;logger[_0x2010('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x2010('0x50'),_0x17f7c5,JSON[_0x2010('0x6e')](_0x44e47e));delete _0x44e47e[_0x2010('0x26')];if(_0x17f7c5===0x191){_0x17f7c5=0x190;}_0x20dea1[_0x2010('0x19')](_0x17f7c5)['send'](_0x5182b2[_0x2010('0x2c')]['test']?{'message':_0x2010('0x6f'),'statusCode':_0x44e47e[_0x2010('0x6d')]}:_0x44e47e);});}; \ No newline at end of file +var _0xd87e=['undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x23200d,_0x15fb6e){var _0x3f8381=function(_0x3318d6){while(--_0x3318d6){_0x23200d['push'](_0x23200d['shift']());}};_0x3f8381(++_0x15fb6e);}(_0xd87e,0x1bf));var _0xed87=function(_0x364040,_0x2661d5){_0x364040=_0x364040-0x0;var _0x4328dc=_0xd87e[_0x364040];return _0x4328dc;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['ZendeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['ZendeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57'),_0xed87('0x58'),_0xed87('0x59'),'remoteUri']})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x3b6a9b){if(_0x3b6a9b){_0x5136c9=_0x3b6a9b[_0xed87('0x5a')];var _0xc35cab=_0x5136c9[_0xed87('0x5b')](-0x1);if(_0xc35cab==='/'){_0x5136c9=_0x5136c9[_0xed87('0x5c')](0x0,_0x5136c9[_0xed87('0x5d')](_0xc35cab));}var _0x116198={'method':_0xed87('0x5e'),'uri':util['format']('%s/%s',_0x5136c9,'ticket_fields'),'json':!![]};switch(_0x3b6a9b[_0xed87('0x59')]){case _0xed87('0x57'):_0x116198[_0xed87('0x5f')]={'Authorization':util[_0xed87('0x60')](_0xed87('0x61'),new Buffer(util['format'](_0xed87('0x62'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x57')]))[_0xed87('0x63')](_0xed87('0x64')))};break;case _0xed87('0x58'):_0x116198['headers']={'Authorization':util['format'](_0xed87('0x61'),new Buffer(util[_0xed87('0x60')](_0xed87('0x65'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x58')]))[_0xed87('0x63')](_0xed87('0x64')))};break;default:throw new db[(_0xed87('0x66'))][(_0xed87('0x67'))](_0xed87('0x68'));}return rp(_0x116198);}})[_0xed87('0x3f')](function(_0x1a1f95){if(_0x1a1f95){var _0x52af5c=[_0xed87('0x69'),_0xed87('0x6a'),_0xed87('0x6b'),_0xed87('0x6c')];_[_0xed87('0x6d')](_0x1a1f95[_0xed87('0x6e')],function(_0x4ae84c){return _0x52af5c[_0xed87('0x6f')](_0x4ae84c[_0xed87('0x2b')]);});return{'count':_0x1a1f95[_0xed87('0x6e')][_0xed87('0x35')],'rows':_['map'](_0x1a1f95['ticket_fields'],function(_0x4bfca0){return{'id':_0x4bfca0['id'],'name':_0x4bfca0['position']>0x7?_0x4bfca0['title']:_0x4bfca0[_0xed87('0x2b')],'custom':_0x4bfca0[_0xed87('0x70')]>0x7?!![]:![],'options':_0x4bfca0[_0xed87('0x71')]?_0x4bfca0[_0xed87('0x71')]:_0x4bfca0[_0xed87('0x72')]?_0x4bfca0[_0xed87('0x72')]:[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))[_0xed87('0x41')](function(_0x1b223b){var _0x510066=_0x2686cd['query'][_0xed87('0x73')]?0x1f4:_0x1b223b[_0xed87('0x74')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x75'),_0xed87('0x55'),_0x510066,JSON['stringify'](_0x1b223b));delete _0x1b223b['name'];if(_0x510066===0x191){_0x510066=0x190;}_0x566ace[_0xed87('0x19')](_0x510066)[_0xed87('0x76')](_0x2686cd['query'][_0xed87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1b223b[_0xed87('0x74')]}:_0x1b223b);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 38baaa0..e7910b1 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 _0x4993=['../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x53d24c,_0x559ab7){var _0x30cd58=function(_0x1ef8d7){while(--_0x1ef8d7){_0x53d24c['push'](_0x53d24c['shift']());}};_0x30cd58(++_0x559ab7);}(_0x4993,0xf4));var _0x3499=function(_0x271ace,_0x2b1999){_0x271ace=_0x271ace-0x0;var _0x48e6af=_0x4993[_0x271ace];return _0x48e6af;};'use strict';var _=require(_0x3499('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3499('0x1'));var moment=require(_0x3499('0x2'));var BPromise=require('bluebird');var rp=require(_0x3499('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3499('0x4'));var config=require(_0x3499('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3499('0x6'));module[_0x3499('0x7')]=function(_0x4cd59e,_0x30d07d){return _0x4cd59e['define'](_0x3499('0x8'),attributes,{'tableName':_0x3499('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38d4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','int_zendesk_accounts','lodash','util'];(function(_0x59ed7b,_0x47eb63){var _0x1ada9a=function(_0x377af3){while(--_0x377af3){_0x59ed7b['push'](_0x59ed7b['shift']());}};_0x1ada9a(++_0x47eb63);}(_0x38d4,0x178));var _0x438d=function(_0x245006,_0x332c26){_0x245006=_0x245006-0x0;var _0x278334=_0x38d4[_0x245006];return _0x278334;};'use strict';var _=require(_0x438d('0x0'));var util=require(_0x438d('0x1'));var logger=require(_0x438d('0x2'))(_0x438d('0x3'));var moment=require(_0x438d('0x4'));var BPromise=require(_0x438d('0x5'));var rp=require(_0x438d('0x6'));var fs=require('fs');var path=require(_0x438d('0x7'));var rimraf=require(_0x438d('0x8'));var config=require(_0x438d('0x9'));var attributes=require(_0x438d('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x438d('0xb')]=function(_0x2eedc7,_0x385bda){return _0x2eedc7[_0x438d('0xc')]('ZendeskAccount',attributes,{'tableName':_0x438d('0xd'),'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 40ab163..b50aee1 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 _0xf2c6=['error','code','message','info','catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ZendeskAccount','find','ShowZendeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2c6,0x1e6));var _0x6f2c=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xf2c6[_0xea8947];return _0x2455e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f2c('0x0'));var BPromise=require(_0x6f2c('0x1'));var rs=require(_0x6f2c('0x2'));var fs=require('fs');var Redis=require(_0x6f2c('0x3'));var db=require(_0x6f2c('0x4'))['db'];var utils=require(_0x6f2c('0x5'));var logger=require(_0x6f2c('0x6'))(_0x6f2c('0x7'));var config=require(_0x6f2c('0x8'));var jayson=require(_0x6f2c('0x9'));var client=jayson['client'][_0x6f2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d994e,_0x27eb8a,_0x5674f8){return new BPromise(function(_0x4c43ca,_0xbeb40f){return client[_0x6f2c('0xb')](_0x5d994e,_0x5674f8)[_0x6f2c('0xc')](function(_0x22e617){logger['info'](_0x6f2c('0xd'),_0x27eb8a,_0x6f2c('0xe'));logger[_0x6f2c('0xf')](_0x6f2c('0x10'),_0x27eb8a,_0x6f2c('0xe'),JSON[_0x6f2c('0x11')](_0x22e617));if(_0x22e617[_0x6f2c('0x12')]){if(_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x13')]===0x1f4){logger['error'](_0x6f2c('0xd'),_0x27eb8a,_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);return _0xbeb40f(_0x22e617[_0x6f2c('0x12')]['message']);}logger[_0x6f2c('0x12')](_0x6f2c('0xd'),_0x27eb8a,_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);return _0x4c43ca(_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);}else{logger[_0x6f2c('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x27eb8a,'request\x20sent');_0x4c43ca(_0x22e617['result']['message']);}})[_0x6f2c('0x16')](function(_0x330239){logger[_0x6f2c('0x12')](_0x6f2c('0xd'),_0x27eb8a,_0x330239);_0xbeb40f(_0x330239);});});}exports[_0x6f2c('0x17')]=function(_0x36f731){var _0x27feff=this;return new Promise(function(_0x32b039,_0x4507fc){return db['ZendeskAccount'][_0x6f2c('0x18')]({'raw':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1a')]===undefined?!![]:![]:!![],'where':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1b')]||null:null,'attributes':_0x36f731[_0x6f2c('0x19')]?_0x36f731[_0x6f2c('0x19')][_0x6f2c('0x1c')]||null:null,'limit':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1d')]||null:null,'include':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1e')]?_[_0x6f2c('0x1f')](_0x36f731[_0x6f2c('0x19')][_0x6f2c('0x1e')],function(_0x51d881){return{'model':db[_0x51d881[_0x6f2c('0x20')]],'as':_0x51d881['as'],'attributes':_0x51d881[_0x6f2c('0x1c')],'include':_0x51d881[_0x6f2c('0x1e')]?_['map'](_0x51d881[_0x6f2c('0x1e')],function(_0x2b35e1){return{'model':db[_0x2b35e1[_0x6f2c('0x20')]],'as':_0x2b35e1['as'],'attributes':_0x2b35e1[_0x6f2c('0x1c')],'include':_0x2b35e1['include']?_[_0x6f2c('0x1f')](_0x2b35e1[_0x6f2c('0x1e')],function(_0x1dcda5){return{'model':db[_0x1dcda5[_0x6f2c('0x20')]],'as':_0x1dcda5['as'],'attributes':_0x1dcda5[_0x6f2c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6f2c('0xc')](function(_0x1b1efb){logger['info'](_0x6f2c('0x17'),_0x36f731);logger[_0x6f2c('0xf')](_0x6f2c('0x17'),_0x36f731,JSON[_0x6f2c('0x11')](_0x1b1efb));_0x32b039(_0x1b1efb);})['catch'](function(_0x15582b){logger[_0x6f2c('0x12')](_0x6f2c('0x17'),_0x15582b[_0x6f2c('0x14')],_0x36f731);_0x4507fc(_0x27feff['error'](0x1f4,_0x15582b[_0x6f2c('0x14')]));});});};exports['ShowZendeskAccount']=function(_0x3fec8f){var _0xe67305=this;return new Promise(function(_0x49459b,_0x568666){return db[_0x6f2c('0x21')][_0x6f2c('0x22')]({'raw':_0x3fec8f[_0x6f2c('0x19')]?_0x3fec8f[_0x6f2c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3fec8f[_0x6f2c('0x19')]?_0x3fec8f[_0x6f2c('0x19')][_0x6f2c('0x1b')]||null:null,'attributes':_0x3fec8f[_0x6f2c('0x19')]?_0x3fec8f['options']['attributes']||null:null,'include':_0x3fec8f[_0x6f2c('0x19')]?_0x3fec8f[_0x6f2c('0x19')][_0x6f2c('0x1e')]?_[_0x6f2c('0x1f')](_0x3fec8f[_0x6f2c('0x19')][_0x6f2c('0x1e')],function(_0x53adcf){return{'model':db[_0x53adcf[_0x6f2c('0x20')]],'as':_0x53adcf['as'],'attributes':_0x53adcf[_0x6f2c('0x1c')],'include':_0x53adcf[_0x6f2c('0x1e')]?_[_0x6f2c('0x1f')](_0x53adcf[_0x6f2c('0x1e')],function(_0x2bda87){return{'model':db[_0x2bda87[_0x6f2c('0x20')]],'as':_0x2bda87['as'],'attributes':_0x2bda87['attributes'],'include':_0x2bda87[_0x6f2c('0x1e')]?_['map'](_0x2bda87[_0x6f2c('0x1e')],function(_0x50af7f){return{'model':db[_0x50af7f[_0x6f2c('0x20')]],'as':_0x50af7f['as'],'attributes':_0x50af7f[_0x6f2c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6f2c('0xc')](function(_0x33fcd7){logger[_0x6f2c('0x15')]('ShowZendeskAccount',_0x3fec8f);logger['debug'](_0x6f2c('0x23'),_0x3fec8f,JSON['stringify'](_0x33fcd7));_0x49459b(_0x33fcd7);})[_0x6f2c('0x16')](function(_0xebaea6){logger['error']('ShowZendeskAccount',_0xebaea6[_0x6f2c('0x14')],_0x3fec8f);_0x568666(_0xe67305['error'](0x1f4,_0xebaea6[_0x6f2c('0x14')]));});});}; \ No newline at end of file +var _0xca66=['map','model','catch','ShowZendeskAccount','ZendeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','info','result','GetZendeskAccount','options','raw','where','attributes','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca66,0x141));var _0x6ca6=function(_0x288064,_0x3ba1f8){_0x288064=_0x288064-0x0;var _0x1581fa=_0xca66[_0x288064];return _0x1581fa;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require(_0x6ca6('0x1'));var BPromise=require(_0x6ca6('0x2'));var rs=require(_0x6ca6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ca6('0x4'))['db'];var utils=require(_0x6ca6('0x5'));var logger=require(_0x6ca6('0x6'))(_0x6ca6('0x7'));var config=require(_0x6ca6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6ca6('0x9')][_0x6ca6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e8e30,_0x312580,_0x981bb7){return new BPromise(function(_0x435572,_0x2640b2){return client[_0x6ca6('0xb')](_0x1e8e30,_0x981bb7)[_0x6ca6('0xc')](function(_0x303df6){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x312580,_0x6ca6('0xd'));logger[_0x6ca6('0xe')](_0x6ca6('0xf'),_0x312580,_0x6ca6('0xd'),JSON[_0x6ca6('0x10')](_0x303df6));if(_0x303df6['error']){if(_0x303df6[_0x6ca6('0x11')][_0x6ca6('0x12')]===0x1f4){logger[_0x6ca6('0x11')](_0x6ca6('0x13'),_0x312580,_0x303df6[_0x6ca6('0x11')][_0x6ca6('0x14')]);return _0x2640b2(_0x303df6[_0x6ca6('0x11')][_0x6ca6('0x14')]);}logger['error'](_0x6ca6('0x13'),_0x312580,_0x303df6[_0x6ca6('0x11')]['message']);return _0x435572(_0x303df6[_0x6ca6('0x11')][_0x6ca6('0x14')]);}else{logger[_0x6ca6('0x15')](_0x6ca6('0x13'),_0x312580,_0x6ca6('0xd'));_0x435572(_0x303df6[_0x6ca6('0x16')][_0x6ca6('0x14')]);}})['catch'](function(_0x5200e5){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x312580,_0x5200e5);_0x2640b2(_0x5200e5);});});}exports[_0x6ca6('0x17')]=function(_0x30ebf2){var _0x27be27=this;return new Promise(function(_0x18547d,_0x76c5fc){return db['ZendeskAccount']['findAll']({'raw':_0x30ebf2[_0x6ca6('0x18')]?_0x30ebf2[_0x6ca6('0x18')][_0x6ca6('0x19')]===undefined?!![]:![]:!![],'where':_0x30ebf2['options']?_0x30ebf2['options'][_0x6ca6('0x1a')]||null:null,'attributes':_0x30ebf2[_0x6ca6('0x18')]?_0x30ebf2[_0x6ca6('0x18')][_0x6ca6('0x1b')]||null:null,'limit':_0x30ebf2[_0x6ca6('0x18')]?_0x30ebf2[_0x6ca6('0x18')]['limit']||null:null,'include':_0x30ebf2[_0x6ca6('0x18')]?_0x30ebf2['options'][_0x6ca6('0x1c')]?_[_0x6ca6('0x1d')](_0x30ebf2[_0x6ca6('0x18')][_0x6ca6('0x1c')],function(_0x51ddf5){return{'model':db[_0x51ddf5[_0x6ca6('0x1e')]],'as':_0x51ddf5['as'],'attributes':_0x51ddf5[_0x6ca6('0x1b')],'include':_0x51ddf5['include']?_[_0x6ca6('0x1d')](_0x51ddf5[_0x6ca6('0x1c')],function(_0x3b7d39){return{'model':db[_0x3b7d39[_0x6ca6('0x1e')]],'as':_0x3b7d39['as'],'attributes':_0x3b7d39[_0x6ca6('0x1b')],'include':_0x3b7d39[_0x6ca6('0x1c')]?_['map'](_0x3b7d39[_0x6ca6('0x1c')],function(_0x1aab37){return{'model':db[_0x1aab37[_0x6ca6('0x1e')]],'as':_0x1aab37['as'],'attributes':_0x1aab37[_0x6ca6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ca6('0xc')](function(_0x123d1f){logger[_0x6ca6('0x15')](_0x6ca6('0x17'),_0x30ebf2);logger[_0x6ca6('0xe')](_0x6ca6('0x17'),_0x30ebf2,JSON[_0x6ca6('0x10')](_0x123d1f));_0x18547d(_0x123d1f);})[_0x6ca6('0x1f')](function(_0x1d7705){logger[_0x6ca6('0x11')](_0x6ca6('0x17'),_0x1d7705[_0x6ca6('0x14')],_0x30ebf2);_0x76c5fc(_0x27be27[_0x6ca6('0x11')](0x1f4,_0x1d7705[_0x6ca6('0x14')]));});});};exports[_0x6ca6('0x20')]=function(_0x268112){var _0x49d8b2=this;return new Promise(function(_0x28f7cd,_0x11227c){return db[_0x6ca6('0x21')][_0x6ca6('0x22')]({'raw':_0x268112[_0x6ca6('0x18')]?_0x268112[_0x6ca6('0x18')][_0x6ca6('0x19')]===undefined?!![]:![]:!![],'where':_0x268112[_0x6ca6('0x18')]?_0x268112[_0x6ca6('0x18')]['where']||null:null,'attributes':_0x268112[_0x6ca6('0x18')]?_0x268112[_0x6ca6('0x18')][_0x6ca6('0x1b')]||null:null,'include':_0x268112[_0x6ca6('0x18')]?_0x268112[_0x6ca6('0x18')][_0x6ca6('0x1c')]?_[_0x6ca6('0x1d')](_0x268112[_0x6ca6('0x18')][_0x6ca6('0x1c')],function(_0x14ed22){return{'model':db[_0x14ed22[_0x6ca6('0x1e')]],'as':_0x14ed22['as'],'attributes':_0x14ed22['attributes'],'include':_0x14ed22[_0x6ca6('0x1c')]?_[_0x6ca6('0x1d')](_0x14ed22[_0x6ca6('0x1c')],function(_0xe0081f){return{'model':db[_0xe0081f[_0x6ca6('0x1e')]],'as':_0xe0081f['as'],'attributes':_0xe0081f['attributes'],'include':_0xe0081f[_0x6ca6('0x1c')]?_[_0x6ca6('0x1d')](_0xe0081f['include'],function(_0x1e764c){return{'model':db[_0x1e764c['model']],'as':_0x1e764c['as'],'attributes':_0x1e764c[_0x6ca6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ca6('0xc')](function(_0x3501c5){logger[_0x6ca6('0x15')](_0x6ca6('0x20'),_0x268112);logger[_0x6ca6('0xe')]('ShowZendeskAccount',_0x268112,JSON['stringify'](_0x3501c5));_0x28f7cd(_0x3501c5);})['catch'](function(_0x48f348){logger[_0x6ca6('0x11')](_0x6ca6('0x20'),_0x48f348[_0x6ca6('0x14')],_0x268112);_0x11227c(_0x49d8b2[_0x6ca6('0x11')](0x1f4,_0x48f348['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 93caf8b..0b3b43f 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 _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x2e650a,_0x1ba640){var _0x2fa00c=function(_0x421108){while(--_0x421108){_0x2e650a['push'](_0x2e650a['shift']());}};_0x2fa00c(++_0x1ba640);}(_0x4fc2,0x111));var _0x24fc=function(_0xeeca45,_0x5ce4af){_0xeeca45=_0xeeca45-0x0;var _0x366bcb=_0x4fc2[_0xeeca45];return _0x366bcb;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file +var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x2fb8b2,_0x515c57){var _0xd412b1=function(_0x3b51ea){while(--_0x3b51ea){_0x2fb8b2['push'](_0x2fb8b2['shift']());}};_0xd412b1(++_0x515c57);}(_0x757a,0xde));var _0xa757=function(_0x26aaa9,_0x5df5c7){_0x26aaa9=_0x26aaa9-0x0;var _0x195fed=_0x757a[_0x26aaa9];return _0x195fed;};'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('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d79eaec..07886cc 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 _0x1b8c=['exports','STRING','sequelize'];(function(_0x3ef9c1,_0x4f6406){var _0x5cb632=function(_0x5e5646){while(--_0x5e5646){_0x3ef9c1['push'](_0x3ef9c1['shift']());}};_0x5cb632(++_0x4f6406);}(_0x1b8c,0x1c4));var _0xc1b8=function(_0x2e4151,_0x57ab43){_0x2e4151=_0x2e4151-0x0;var _0x69760b=_0x1b8c[_0x2e4151];return _0x69760b;};'use strict';var Sequelize=require(_0xc1b8('0x0'));module[_0xc1b8('0x1')]={'name':{'type':Sequelize[_0xc1b8('0x2')]},'description':{'type':Sequelize[_0xc1b8('0x2')]}}; \ No newline at end of file +var _0xeb82=['STRING','sequelize','exports'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xeb82,0xa3));var _0x2eb8=function(_0x377545,_0x2b2cdc){_0x377545=_0x377545-0x0;var _0x3558cc=_0xeb82[_0x377545];return _0x3558cc;};'use strict';var Sequelize=require(_0x2eb8('0x0'));module[_0x2eb8('0x1')]={'name':{'type':Sequelize[_0x2eb8('0x2')]},'description':{'type':Sequelize[_0x2eb8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e6a1f72..cc332f5 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 _0xa058=['includeAll','find','create','body','findOne','ZendeskField','rawAttributes','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','ZendeskConfiguration','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x11f893,_0x259935){var _0x400fa8=function(_0x25933b){while(--_0x25933b){_0x11f893['push'](_0x11f893['shift']());}};_0x400fa8(++_0x259935);}(_0xa058,0x67));var _0x8a05=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0xa058[_0x36de10];return _0x58100f;};'use strict';var emlformat=require(_0x8a05('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a05('0x1'));var jsonpatch=require(_0x8a05('0x2'));var rp=require(_0x8a05('0x3'));var moment=require(_0x8a05('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a05('0x5'));var util=require(_0x8a05('0x6'));var path=require(_0x8a05('0x7'));var sox=require(_0x8a05('0x8'));var csv=require('to-csv');var ejs=require(_0x8a05('0x9'));var fs=require('fs');var fs_extra=require(_0x8a05('0xa'));var _=require(_0x8a05('0xb'));var squel=require(_0x8a05('0xc'));var crypto=require(_0x8a05('0xd'));var jsforce=require(_0x8a05('0xe'));var deskjs=require(_0x8a05('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8a05('0x10'));var Papa=require(_0x8a05('0x11'));var Redis=require(_0x8a05('0x12'));var authService=require(_0x8a05('0x13'));var qs=require(_0x8a05('0x14'));var as=require(_0x8a05('0x15'));var hardwareService=require(_0x8a05('0x16'));var logger=require(_0x8a05('0x17'))(_0x8a05('0x18'));var utils=require(_0x8a05('0x19'));var config=require(_0x8a05('0x1a'));var licenseUtil=require(_0x8a05('0x1b'));var db=require(_0x8a05('0x1c'))['db'];function respondWithStatusCode(_0x56d146,_0x20c400){_0x20c400=_0x20c400||0xcc;return function(_0x54f1b2){if(_0x54f1b2){return _0x56d146['sendStatus'](_0x20c400);}return _0x56d146['status'](_0x20c400)['end']();};}function respondWithResult(_0x14fda5,_0x37a346){_0x37a346=_0x37a346||0xc8;return function(_0x5c2448){if(_0x5c2448){return _0x14fda5[_0x8a05('0x1d')](_0x37a346)['json'](_0x5c2448);}};}function respondWithFilteredResult(_0x2237da,_0x80e4ba){return function(_0x46be07){if(_0x46be07){var _0x95b638=typeof _0x80e4ba[_0x8a05('0x1e')]==='undefined'&&typeof _0x80e4ba[_0x8a05('0x1f')]===_0x8a05('0x20');var _0x96dcf3=_0x46be07[_0x8a05('0x21')];var _0x17aac4=_0x95b638?0x0:_0x80e4ba[_0x8a05('0x1e')];var _0xf36045=_0x95b638?_0x46be07[_0x8a05('0x21')]:_0x80e4ba[_0x8a05('0x1e')]+_0x80e4ba['limit'];var _0x1982e5;if(_0xf36045>=_0x96dcf3){_0xf36045=_0x96dcf3;_0x1982e5=0xc8;}else{_0x1982e5=0xce;}_0x2237da[_0x8a05('0x1d')](_0x1982e5);return _0x2237da[_0x8a05('0x22')](_0x8a05('0x23'),_0x17aac4+'-'+_0xf36045+'/'+_0x96dcf3)[_0x8a05('0x24')](_0x46be07);}return null;};}function patchUpdates(_0x224f62){return function(_0x579142){try{jsonpatch[_0x8a05('0x25')](_0x579142,_0x224f62,!![]);}catch(_0x3fb6db){return BPromise[_0x8a05('0x26')](_0x3fb6db);}return _0x579142[_0x8a05('0x27')]();};}function saveUpdates(_0x10766d,_0x15f501){return function(_0x1a8fbc){if(_0x1a8fbc){return _0x1a8fbc[_0x8a05('0x28')](_0x10766d)[_0x8a05('0x29')](function(_0x4353e0){return _0x4353e0;});}return null;};}function removeEntity(_0x352d2c,_0x1f093c){return function(_0x6345ce){if(_0x6345ce){return _0x6345ce[_0x8a05('0x2a')]()[_0x8a05('0x29')](function(){_0x352d2c['status'](0xcc)[_0x8a05('0x2b')]();});}};}function handleEntityNotFound(_0x4e6557,_0x1ec7ea){return function(_0x2d0ff3){if(!_0x2d0ff3){_0x4e6557[_0x8a05('0x2c')](0x194);}return _0x2d0ff3;};}function handleError(_0x5a6353,_0x567026){_0x567026=_0x567026||0x1f4;return function(_0x32152e){logger[_0x8a05('0x2d')](_0x32152e['stack']);if(_0x32152e[_0x8a05('0x2e')]){delete _0x32152e[_0x8a05('0x2e')];}_0x5a6353['status'](_0x567026)[_0x8a05('0x2f')](_0x32152e);};}exports[_0x8a05('0x30')]=function(_0x5b77f7,_0x2d9c63){var _0x17a716={},_0x32bf42={},_0x132d11={'count':0x0,'rows':[]};var _0x285fac=_['map'](db[_0x8a05('0x31')]['rawAttributes'],function(_0x21076e){return{'name':_0x21076e['fieldName'],'type':_0x21076e[_0x8a05('0x32')][_0x8a05('0x33')]};});_0x32bf42['model']=_[_0x8a05('0x34')](_0x285fac,_0x8a05('0x2e'));_0x32bf42[_0x8a05('0x35')]=_[_0x8a05('0x36')](_0x5b77f7[_0x8a05('0x35')]);_0x32bf42[_0x8a05('0x37')]=_[_0x8a05('0x38')](_0x32bf42[_0x8a05('0x39')],_0x32bf42[_0x8a05('0x35')]);_0x17a716[_0x8a05('0x3a')]=_[_0x8a05('0x38')](_0x32bf42['model'],qs[_0x8a05('0x3b')](_0x5b77f7[_0x8a05('0x35')]['fields']));_0x17a716[_0x8a05('0x3a')]=_0x17a716[_0x8a05('0x3a')][_0x8a05('0x3c')]?_0x17a716[_0x8a05('0x3a')]:_0x32bf42[_0x8a05('0x39')];if(!_0x5b77f7[_0x8a05('0x35')][_0x8a05('0x3d')](_0x8a05('0x3e'))){_0x17a716[_0x8a05('0x1f')]=qs[_0x8a05('0x1f')](_0x5b77f7[_0x8a05('0x35')]['limit']);_0x17a716[_0x8a05('0x1e')]=qs[_0x8a05('0x1e')](_0x5b77f7['query'][_0x8a05('0x1e')]);}_0x17a716[_0x8a05('0x3f')]=qs[_0x8a05('0x40')](_0x5b77f7[_0x8a05('0x35')][_0x8a05('0x40')]);_0x17a716[_0x8a05('0x41')]=qs[_0x8a05('0x37')](_[_0x8a05('0x42')](_0x5b77f7[_0x8a05('0x35')],_0x32bf42[_0x8a05('0x37')]),_0x285fac);if(_0x5b77f7[_0x8a05('0x35')][_0x8a05('0x43')]){_0x17a716[_0x8a05('0x41')]=_[_0x8a05('0x44')](_0x17a716[_0x8a05('0x41')],{'$or':_['map'](_0x285fac,function(_0x1a5c89){if(_0x1a5c89['type']!==_0x8a05('0x45')){var _0x3abd54={};_0x3abd54[_0x1a5c89[_0x8a05('0x2e')]]={'$like':'%'+_0x5b77f7['query'][_0x8a05('0x43')]+'%'};return _0x3abd54;}})});}_0x17a716=_['merge']({},_0x17a716,_0x5b77f7[_0x8a05('0x46')]);var _0x37793a={'where':_0x17a716[_0x8a05('0x41')]};return db[_0x8a05('0x31')][_0x8a05('0x21')](_0x37793a)[_0x8a05('0x29')](function(_0x14199d){_0x132d11[_0x8a05('0x21')]=_0x14199d;if(_0x5b77f7['query']['includeAll']){_0x17a716[_0x8a05('0x47')]=[{'all':!![]}];}return db[_0x8a05('0x31')][_0x8a05('0x48')](_0x17a716);})[_0x8a05('0x29')](function(_0x5ffc82){_0x132d11[_0x8a05('0x49')]=_0x5ffc82;return _0x132d11;})['then'](respondWithFilteredResult(_0x2d9c63,_0x17a716))[_0x8a05('0x4a')](handleError(_0x2d9c63,null));};exports[_0x8a05('0x4b')]=function(_0x42cb4f,_0x335aec){var _0x2b0bad={'raw':![],'where':{'id':_0x42cb4f[_0x8a05('0x4c')]['id']}},_0x5d9e9a={};_0x5d9e9a[_0x8a05('0x39')]=_['keys'](db[_0x8a05('0x31')]['rawAttributes']);_0x5d9e9a[_0x8a05('0x35')]=_[_0x8a05('0x36')](_0x42cb4f[_0x8a05('0x35')]);_0x5d9e9a['filters']=_[_0x8a05('0x38')](_0x5d9e9a[_0x8a05('0x39')],_0x5d9e9a[_0x8a05('0x35')]);_0x2b0bad['attributes']=_[_0x8a05('0x38')](_0x5d9e9a[_0x8a05('0x39')],qs['fields'](_0x42cb4f[_0x8a05('0x35')][_0x8a05('0x3b')]));_0x2b0bad[_0x8a05('0x3a')]=_0x2b0bad[_0x8a05('0x3a')][_0x8a05('0x3c')]?_0x2b0bad[_0x8a05('0x3a')]:_0x5d9e9a[_0x8a05('0x39')];if(_0x42cb4f[_0x8a05('0x35')][_0x8a05('0x4d')]){_0x2b0bad[_0x8a05('0x47')]=[{'all':!![]}];}_0x2b0bad=_[_0x8a05('0x44')]({},_0x2b0bad,_0x42cb4f[_0x8a05('0x46')]);return db[_0x8a05('0x31')][_0x8a05('0x4e')](_0x2b0bad)['then'](handleEntityNotFound(_0x335aec,null))['then'](respondWithResult(_0x335aec,null))[_0x8a05('0x4a')](handleError(_0x335aec,null));};exports[_0x8a05('0x4f')]=function(_0x4302ab,_0x572074){return db[_0x8a05('0x31')]['create'](_0x4302ab['body'],{})[_0x8a05('0x29')](respondWithResult(_0x572074,0xc9))[_0x8a05('0x4a')](handleError(_0x572074,null));};exports['update']=function(_0x387ea9,_0x29a0fa){if(_0x387ea9[_0x8a05('0x50')]['id']){delete _0x387ea9[_0x8a05('0x50')]['id'];}return db[_0x8a05('0x31')][_0x8a05('0x4e')]({'where':{'id':_0x387ea9['params']['id']}})['then'](handleEntityNotFound(_0x29a0fa,null))[_0x8a05('0x29')](saveUpdates(_0x387ea9['body'],null))[_0x8a05('0x29')](respondWithResult(_0x29a0fa,null))[_0x8a05('0x4a')](handleError(_0x29a0fa,null));};exports[_0x8a05('0x2a')]=function(_0x1c195d,_0xdaf25c){return db[_0x8a05('0x31')][_0x8a05('0x4e')]({'where':{'id':_0x1c195d[_0x8a05('0x4c')]['id']}})[_0x8a05('0x29')](handleEntityNotFound(_0xdaf25c,null))[_0x8a05('0x29')](removeEntity(_0xdaf25c,null))[_0x8a05('0x4a')](handleError(_0xdaf25c,null));};exports['getFields']=function(_0x33463e,_0x31db09,_0x50004b){var _0x301ebe={};var _0x5d5641={};var _0x237061;var _0x270e6f;return db[_0x8a05('0x31')][_0x8a05('0x51')]({'where':{'id':_0x33463e[_0x8a05('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31db09,null))['then'](function(_0x45e129){if(_0x45e129){_0x237061=_0x45e129;_0x5d5641[_0x8a05('0x39')]=_['keys'](db[_0x8a05('0x52')][_0x8a05('0x53')]);_0x5d5641['query']=_['keys'](_0x33463e[_0x8a05('0x35')]);_0x5d5641[_0x8a05('0x37')]=_['intersection'](_0x5d5641[_0x8a05('0x39')],_0x5d5641['query']);_0x301ebe[_0x8a05('0x3a')]=_[_0x8a05('0x38')](_0x5d5641[_0x8a05('0x39')],qs[_0x8a05('0x3b')](_0x33463e[_0x8a05('0x35')][_0x8a05('0x3b')]));_0x301ebe['attributes']=_0x301ebe[_0x8a05('0x3a')][_0x8a05('0x3c')]?_0x301ebe[_0x8a05('0x3a')]:_0x5d5641['model'];_0x301ebe['order']=qs[_0x8a05('0x40')](_0x33463e[_0x8a05('0x35')][_0x8a05('0x40')]);_0x301ebe[_0x8a05('0x41')]=qs['filters'](_[_0x8a05('0x42')](_0x33463e[_0x8a05('0x35')],_0x5d5641[_0x8a05('0x37')]));if(_0x33463e['query']['filter']){_0x301ebe['where']=_[_0x8a05('0x44')](_0x301ebe[_0x8a05('0x41')],{'$or':_[_0x8a05('0x34')](_0x301ebe[_0x8a05('0x3a')],function(_0x1b9ac4){var _0x399396={};_0x399396[_0x1b9ac4]={'$like':'%'+_0x33463e[_0x8a05('0x35')][_0x8a05('0x43')]+'%'};return _0x399396;})});}_0x301ebe=_[_0x8a05('0x44')]({},_0x301ebe,_0x33463e[_0x8a05('0x46')]);return _0x237061[_0x8a05('0x54')](_0x301ebe);}})[_0x8a05('0x29')](function(_0x50339e){if(_0x50339e){_0x270e6f=_0x50339e['length'];if(!_0x33463e[_0x8a05('0x35')][_0x8a05('0x3d')](_0x8a05('0x3e'))){_0x301ebe[_0x8a05('0x1f')]=qs['limit'](_0x33463e[_0x8a05('0x35')][_0x8a05('0x1f')]);_0x301ebe[_0x8a05('0x1e')]=qs['offset'](_0x33463e[_0x8a05('0x35')][_0x8a05('0x1e')]);}return _0x237061[_0x8a05('0x54')](_0x301ebe);}})[_0x8a05('0x29')](function(_0x13af7d){if(_0x13af7d){return _0x13af7d?{'count':_0x270e6f,'rows':_0x13af7d}:null;}})[_0x8a05('0x29')](respondWithResult(_0x31db09,null))[_0x8a05('0x4a')](handleError(_0x31db09,null));};exports[_0x8a05('0x55')]=function(_0x4213cd,_0x1b6f92,_0x4b1627){var _0x4fbd6a={};var _0x236a28={};var _0x331a01;var _0x47330c;return db[_0x8a05('0x31')]['findOne']({'where':{'id':_0x4213cd[_0x8a05('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b6f92,null))['then'](function(_0x2e16a8){if(_0x2e16a8){_0x331a01=_0x2e16a8;_0x236a28[_0x8a05('0x39')]=_[_0x8a05('0x36')](db[_0x8a05('0x52')][_0x8a05('0x53')]);_0x236a28[_0x8a05('0x35')]=_['keys'](_0x4213cd[_0x8a05('0x35')]);_0x236a28[_0x8a05('0x37')]=_[_0x8a05('0x38')](_0x236a28[_0x8a05('0x39')],_0x236a28[_0x8a05('0x35')]);_0x4fbd6a[_0x8a05('0x3a')]=_['intersection'](_0x236a28[_0x8a05('0x39')],qs[_0x8a05('0x3b')](_0x4213cd[_0x8a05('0x35')]['fields']));_0x4fbd6a[_0x8a05('0x3a')]=_0x4fbd6a[_0x8a05('0x3a')][_0x8a05('0x3c')]?_0x4fbd6a[_0x8a05('0x3a')]:_0x236a28[_0x8a05('0x39')];_0x4fbd6a[_0x8a05('0x3f')]=qs[_0x8a05('0x40')](_0x4213cd[_0x8a05('0x35')][_0x8a05('0x40')]);_0x4fbd6a[_0x8a05('0x41')]=qs[_0x8a05('0x37')](_['pick'](_0x4213cd[_0x8a05('0x35')],_0x236a28[_0x8a05('0x37')]));if(_0x4213cd[_0x8a05('0x35')][_0x8a05('0x43')]){_0x4fbd6a[_0x8a05('0x41')]=_[_0x8a05('0x44')](_0x4fbd6a[_0x8a05('0x41')],{'$or':_['map'](_0x4fbd6a[_0x8a05('0x3a')],function(_0x2ca13f){var _0x11f221={};_0x11f221[_0x2ca13f]={'$like':'%'+_0x4213cd[_0x8a05('0x35')][_0x8a05('0x43')]+'%'};return _0x11f221;})});}_0x4fbd6a=_[_0x8a05('0x44')]({},_0x4fbd6a,_0x4213cd[_0x8a05('0x46')]);return _0x331a01[_0x8a05('0x55')](_0x4fbd6a);}})[_0x8a05('0x29')](function(_0x18f058){if(_0x18f058){_0x47330c=_0x18f058['length'];if(!_0x4213cd[_0x8a05('0x35')]['hasOwnProperty'](_0x8a05('0x3e'))){_0x4fbd6a[_0x8a05('0x1f')]=qs[_0x8a05('0x1f')](_0x4213cd[_0x8a05('0x35')][_0x8a05('0x1f')]);_0x4fbd6a[_0x8a05('0x1e')]=qs[_0x8a05('0x1e')](_0x4213cd[_0x8a05('0x35')][_0x8a05('0x1e')]);}return _0x331a01[_0x8a05('0x55')](_0x4fbd6a);}})[_0x8a05('0x29')](function(_0x37ae4b){if(_0x37ae4b){return _0x37ae4b?{'count':_0x47330c,'rows':_0x37ae4b}:null;}})[_0x8a05('0x29')](respondWithResult(_0x1b6f92,null))['catch'](handleError(_0x1b6f92,null));};exports[_0x8a05('0x56')]=function(_0x2c0104,_0x1be4d9,_0xc60d11){var _0x2ac9e3={};var _0x66e18c={};var _0x4b8216;var _0x3befe1;return db[_0x8a05('0x31')][_0x8a05('0x51')]({'where':{'id':_0x2c0104[_0x8a05('0x4c')]['id']}})[_0x8a05('0x29')](handleEntityNotFound(_0x1be4d9,null))[_0x8a05('0x29')](function(_0xc3beaf){if(_0xc3beaf){_0x4b8216=_0xc3beaf;_0x66e18c[_0x8a05('0x39')]=_[_0x8a05('0x36')](db[_0x8a05('0x52')][_0x8a05('0x53')]);_0x66e18c[_0x8a05('0x35')]=_[_0x8a05('0x36')](_0x2c0104[_0x8a05('0x35')]);_0x66e18c[_0x8a05('0x37')]=_['intersection'](_0x66e18c[_0x8a05('0x39')],_0x66e18c[_0x8a05('0x35')]);_0x2ac9e3['attributes']=_['intersection'](_0x66e18c[_0x8a05('0x39')],qs[_0x8a05('0x3b')](_0x2c0104[_0x8a05('0x35')][_0x8a05('0x3b')]));_0x2ac9e3[_0x8a05('0x3a')]=_0x2ac9e3['attributes']['length']?_0x2ac9e3[_0x8a05('0x3a')]:_0x66e18c[_0x8a05('0x39')];_0x2ac9e3[_0x8a05('0x3f')]=qs['sort'](_0x2c0104['query']['sort']);_0x2ac9e3[_0x8a05('0x41')]=qs['filters'](_[_0x8a05('0x42')](_0x2c0104['query'],_0x66e18c['filters']));if(_0x2c0104[_0x8a05('0x35')][_0x8a05('0x43')]){_0x2ac9e3['where']=_[_0x8a05('0x44')](_0x2ac9e3[_0x8a05('0x41')],{'$or':_['map'](_0x2ac9e3[_0x8a05('0x3a')],function(_0x54125c){var _0x796293={};_0x796293[_0x54125c]={'$like':'%'+_0x2c0104[_0x8a05('0x35')][_0x8a05('0x43')]+'%'};return _0x796293;})});}_0x2ac9e3=_[_0x8a05('0x44')]({},_0x2ac9e3,_0x2c0104[_0x8a05('0x46')]);return _0x4b8216['getDescriptions'](_0x2ac9e3);}})['then'](function(_0x3dc156){if(_0x3dc156){_0x3befe1=_0x3dc156[_0x8a05('0x3c')];if(!_0x2c0104[_0x8a05('0x35')][_0x8a05('0x3d')](_0x8a05('0x3e'))){_0x2ac9e3[_0x8a05('0x1f')]=qs[_0x8a05('0x1f')](_0x2c0104[_0x8a05('0x35')][_0x8a05('0x1f')]);_0x2ac9e3[_0x8a05('0x1e')]=qs['offset'](_0x2c0104['query']['offset']);}return _0x4b8216[_0x8a05('0x56')](_0x2ac9e3);}})['then'](function(_0xf07d01){if(_0xf07d01){return _0xf07d01?{'count':_0x3befe1,'rows':_0xf07d01}:null;}})[_0x8a05('0x29')](respondWithResult(_0x1be4d9,null))[_0x8a05('0x4a')](handleError(_0x1be4d9,null));};exports[_0x8a05('0x57')]=function(_0x21a8a1,_0x2a4ade,_0x3e34f2){var _0x6cfeaf={};var _0x111fb1={};var _0x1833de;var _0xb83adb;return db[_0x8a05('0x31')][_0x8a05('0x51')]({'where':{'id':_0x21a8a1[_0x8a05('0x4c')]['id']}})[_0x8a05('0x29')](handleEntityNotFound(_0x2a4ade,null))[_0x8a05('0x29')](function(_0x2ccfe1){if(_0x2ccfe1){_0x1833de=_0x2ccfe1;_0x111fb1[_0x8a05('0x39')]=_[_0x8a05('0x36')](db['Tag'][_0x8a05('0x53')]);_0x111fb1[_0x8a05('0x35')]=_['keys'](_0x21a8a1[_0x8a05('0x35')]);_0x111fb1['filters']=_[_0x8a05('0x38')](_0x111fb1['model'],_0x111fb1[_0x8a05('0x35')]);_0x6cfeaf[_0x8a05('0x3a')]=_[_0x8a05('0x38')](_0x111fb1[_0x8a05('0x39')],qs[_0x8a05('0x3b')](_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x3b')]));_0x6cfeaf[_0x8a05('0x3a')]=_0x6cfeaf[_0x8a05('0x3a')]['length']?_0x6cfeaf[_0x8a05('0x3a')]:_0x111fb1[_0x8a05('0x39')];_0x6cfeaf[_0x8a05('0x3f')]=qs['sort'](_0x21a8a1['query'][_0x8a05('0x40')]);_0x6cfeaf[_0x8a05('0x41')]=qs[_0x8a05('0x37')](_['pick'](_0x21a8a1[_0x8a05('0x35')],_0x111fb1[_0x8a05('0x37')]));if(_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x43')]){_0x6cfeaf[_0x8a05('0x41')]=_[_0x8a05('0x44')](_0x6cfeaf[_0x8a05('0x41')],{'$or':_['map'](_0x6cfeaf[_0x8a05('0x3a')],function(_0x5f5a12){var _0x1eb8dd={};_0x1eb8dd[_0x5f5a12]={'$like':'%'+_0x21a8a1[_0x8a05('0x35')]['filter']+'%'};return _0x1eb8dd;})});}_0x6cfeaf=_[_0x8a05('0x44')]({},_0x6cfeaf,_0x21a8a1['options']);return _0x1833de[_0x8a05('0x57')](_0x6cfeaf);}})[_0x8a05('0x29')](function(_0x39bc55){if(_0x39bc55){_0xb83adb=_0x39bc55[_0x8a05('0x3c')];if(!_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x3d')](_0x8a05('0x3e'))){_0x6cfeaf['limit']=qs[_0x8a05('0x1f')](_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x1f')]);_0x6cfeaf['offset']=qs[_0x8a05('0x1e')](_0x21a8a1[_0x8a05('0x35')][_0x8a05('0x1e')]);}return _0x1833de[_0x8a05('0x57')](_0x6cfeaf);}})[_0x8a05('0x29')](function(_0x247461){if(_0x247461){return _0x247461?{'count':_0xb83adb,'rows':_0x247461}:null;}})['then'](respondWithResult(_0x2a4ade,null))[_0x8a05('0x4a')](handleError(_0x2a4ade,null));};exports[_0x8a05('0x58')]=function(_0x494f7a,_0x2ea9f8,_0x1bc21a){if(_0x494f7a[_0x8a05('0x50')]['id']){delete _0x494f7a[_0x8a05('0x50')]['id'];}return db[_0x8a05('0x31')][_0x8a05('0x51')]({'where':{'id':_0x494f7a[_0x8a05('0x4c')]['id']}})[_0x8a05('0x29')](handleEntityNotFound(_0x2ea9f8,null))[_0x8a05('0x29')](function(_0x11435e){if(_0x11435e){return _0x11435e[_0x8a05('0x58')](_0x494f7a[_0x8a05('0x50')][_0x8a05('0x59')]||[]);}return null;})[_0x8a05('0x29')](respondWithResult(_0x2ea9f8,null))['catch'](handleError(_0x2ea9f8,null));}; \ No newline at end of file +var _0x3344=['type','filter','ZendeskConfiguration','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','getTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge'];(function(_0x1555fd,_0x4bfe1e){var _0x5069de=function(_0x42012c){while(--_0x42012c){_0x1555fd['push'](_0x1555fd['shift']());}};_0x5069de(++_0x4bfe1e);}(_0x3344,0x68));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4334('0x0'));var zipdir=require(_0x4334('0x1'));var jsonpatch=require(_0x4334('0x2'));var rp=require('request-promise');var moment=require(_0x4334('0x3'));var BPromise=require(_0x4334('0x4'));var Mustache=require(_0x4334('0x5'));var util=require(_0x4334('0x6'));var path=require(_0x4334('0x7'));var sox=require(_0x4334('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4334('0x9'));var squel=require(_0x4334('0xa'));var crypto=require(_0x4334('0xb'));var jsforce=require(_0x4334('0xc'));var deskjs=require(_0x4334('0xd'));var toCsv=require(_0x4334('0xe'));var querystring=require(_0x4334('0xf'));var Papa=require(_0x4334('0x10'));var Redis=require(_0x4334('0x11'));var authService=require(_0x4334('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4334('0x13'));var hardwareService=require(_0x4334('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4334('0x15'));var config=require(_0x4334('0x16'));var licenseUtil=require(_0x4334('0x17'));var db=require(_0x4334('0x18'))['db'];function respondWithStatusCode(_0x4c7c4e,_0xcda6f7){_0xcda6f7=_0xcda6f7||0xcc;return function(_0x2d5f6a){if(_0x2d5f6a){return _0x4c7c4e[_0x4334('0x19')](_0xcda6f7);}return _0x4c7c4e[_0x4334('0x1a')](_0xcda6f7)[_0x4334('0x1b')]();};}function respondWithResult(_0x4870d1,_0x1a7ab3){_0x1a7ab3=_0x1a7ab3||0xc8;return function(_0x5dde5d){if(_0x5dde5d){return _0x4870d1[_0x4334('0x1a')](_0x1a7ab3)[_0x4334('0x1c')](_0x5dde5d);}};}function respondWithFilteredResult(_0x16d07b,_0x13dc9f){return function(_0x5c3097){if(_0x5c3097){var _0x20f527=typeof _0x13dc9f[_0x4334('0x1d')]==='undefined'&&typeof _0x13dc9f[_0x4334('0x1e')]===_0x4334('0x1f');var _0x5b9229=_0x5c3097[_0x4334('0x20')];var _0x5716b7=_0x20f527?0x0:_0x13dc9f[_0x4334('0x1d')];var _0x5bf56c=_0x20f527?_0x5c3097['count']:_0x13dc9f['offset']+_0x13dc9f[_0x4334('0x1e')];var _0x16bdd9;if(_0x5bf56c>=_0x5b9229){_0x5bf56c=_0x5b9229;_0x16bdd9=0xc8;}else{_0x16bdd9=0xce;}_0x16d07b[_0x4334('0x1a')](_0x16bdd9);return _0x16d07b[_0x4334('0x21')](_0x4334('0x22'),_0x5716b7+'-'+_0x5bf56c+'/'+_0x5b9229)['json'](_0x5c3097);}return null;};}function patchUpdates(_0x2fc523){return function(_0x5eefa3){try{jsonpatch[_0x4334('0x23')](_0x5eefa3,_0x2fc523,!![]);}catch(_0xd086c9){return BPromise['reject'](_0xd086c9);}return _0x5eefa3['save']();};}function saveUpdates(_0x1a784d,_0x5dc7cc){return function(_0x62edf1){if(_0x62edf1){return _0x62edf1[_0x4334('0x24')](_0x1a784d)[_0x4334('0x25')](function(_0x1f241a){return _0x1f241a;});}return null;};}function removeEntity(_0x474a4d,_0x40320d){return function(_0x1c3006){if(_0x1c3006){return _0x1c3006['destroy']()[_0x4334('0x25')](function(){_0x474a4d[_0x4334('0x1a')](0xcc)[_0x4334('0x1b')]();});}};}function handleEntityNotFound(_0x451c8c,_0x2dbfce){return function(_0x2f3c8c){if(!_0x2f3c8c){_0x451c8c[_0x4334('0x19')](0x194);}return _0x2f3c8c;};}function handleError(_0xceca80,_0x5e4b3b){_0x5e4b3b=_0x5e4b3b||0x1f4;return function(_0xc9ff23){logger['error'](_0xc9ff23[_0x4334('0x26')]);if(_0xc9ff23[_0x4334('0x27')]){delete _0xc9ff23['name'];}_0xceca80[_0x4334('0x1a')](_0x5e4b3b)[_0x4334('0x28')](_0xc9ff23);};}exports['index']=function(_0x3e30bd,_0x546468){var _0x4e8d72={},_0x29453b={},_0x838fe7={'count':0x0,'rows':[]};var _0x513b1c=_['map'](db['ZendeskConfiguration'][_0x4334('0x29')],function(_0x25ff7f){return{'name':_0x25ff7f[_0x4334('0x2a')],'type':_0x25ff7f['type'][_0x4334('0x2b')]};});_0x29453b[_0x4334('0x2c')]=_[_0x4334('0x2d')](_0x513b1c,_0x4334('0x27'));_0x29453b[_0x4334('0x2e')]=_[_0x4334('0x2f')](_0x3e30bd['query']);_0x29453b['filters']=_['intersection'](_0x29453b[_0x4334('0x2c')],_0x29453b['query']);_0x4e8d72['attributes']=_[_0x4334('0x30')](_0x29453b['model'],qs[_0x4334('0x31')](_0x3e30bd[_0x4334('0x2e')][_0x4334('0x31')]));_0x4e8d72['attributes']=_0x4e8d72[_0x4334('0x32')][_0x4334('0x33')]?_0x4e8d72['attributes']:_0x29453b[_0x4334('0x2c')];if(!_0x3e30bd[_0x4334('0x2e')][_0x4334('0x34')](_0x4334('0x35'))){_0x4e8d72[_0x4334('0x1e')]=qs[_0x4334('0x1e')](_0x3e30bd[_0x4334('0x2e')][_0x4334('0x1e')]);_0x4e8d72[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x3e30bd[_0x4334('0x2e')]['offset']);}_0x4e8d72[_0x4334('0x36')]=qs[_0x4334('0x37')](_0x3e30bd[_0x4334('0x2e')][_0x4334('0x37')]);_0x4e8d72[_0x4334('0x38')]=qs[_0x4334('0x39')](_[_0x4334('0x3a')](_0x3e30bd['query'],_0x29453b['filters']),_0x513b1c);if(_0x3e30bd[_0x4334('0x2e')]['filter']){_0x4e8d72[_0x4334('0x38')]=_[_0x4334('0x3b')](_0x4e8d72[_0x4334('0x38')],{'$or':_['map'](_0x513b1c,function(_0x4d1a14){if(_0x4d1a14[_0x4334('0x3c')]!=='VIRTUAL'){var _0x41a3a8={};_0x41a3a8[_0x4d1a14['name']]={'$like':'%'+_0x3e30bd[_0x4334('0x2e')][_0x4334('0x3d')]+'%'};return _0x41a3a8;}})});}_0x4e8d72=_[_0x4334('0x3b')]({},_0x4e8d72,_0x3e30bd['options']);var _0x399b46={'where':_0x4e8d72[_0x4334('0x38')]};return db[_0x4334('0x3e')][_0x4334('0x20')](_0x399b46)[_0x4334('0x25')](function(_0x24d229){_0x838fe7[_0x4334('0x20')]=_0x24d229;if(_0x3e30bd[_0x4334('0x2e')]['includeAll']){_0x4e8d72[_0x4334('0x3f')]=[{'all':!![]}];}return db[_0x4334('0x3e')][_0x4334('0x40')](_0x4e8d72);})['then'](function(_0x107c26){_0x838fe7[_0x4334('0x41')]=_0x107c26;return _0x838fe7;})['then'](respondWithFilteredResult(_0x546468,_0x4e8d72))[_0x4334('0x42')](handleError(_0x546468,null));};exports[_0x4334('0x43')]=function(_0x48bdcd,_0x42fc46){var _0x265cde={'raw':![],'where':{'id':_0x48bdcd[_0x4334('0x44')]['id']}},_0xc10a3c={};_0xc10a3c[_0x4334('0x2c')]=_[_0x4334('0x2f')](db['ZendeskConfiguration'][_0x4334('0x29')]);_0xc10a3c[_0x4334('0x2e')]=_[_0x4334('0x2f')](_0x48bdcd[_0x4334('0x2e')]);_0xc10a3c[_0x4334('0x39')]=_[_0x4334('0x30')](_0xc10a3c[_0x4334('0x2c')],_0xc10a3c[_0x4334('0x2e')]);_0x265cde['attributes']=_[_0x4334('0x30')](_0xc10a3c[_0x4334('0x2c')],qs[_0x4334('0x31')](_0x48bdcd['query'][_0x4334('0x31')]));_0x265cde[_0x4334('0x32')]=_0x265cde[_0x4334('0x32')][_0x4334('0x33')]?_0x265cde['attributes']:_0xc10a3c['model'];if(_0x48bdcd[_0x4334('0x2e')]['includeAll']){_0x265cde[_0x4334('0x3f')]=[{'all':!![]}];}_0x265cde=_[_0x4334('0x3b')]({},_0x265cde,_0x48bdcd[_0x4334('0x45')]);return db[_0x4334('0x3e')][_0x4334('0x46')](_0x265cde)[_0x4334('0x25')](handleEntityNotFound(_0x42fc46,null))[_0x4334('0x25')](respondWithResult(_0x42fc46,null))[_0x4334('0x42')](handleError(_0x42fc46,null));};exports[_0x4334('0x47')]=function(_0x3d538f,_0x2a9eec){return db[_0x4334('0x3e')][_0x4334('0x47')](_0x3d538f[_0x4334('0x48')],{})[_0x4334('0x25')](respondWithResult(_0x2a9eec,0xc9))['catch'](handleError(_0x2a9eec,null));};exports[_0x4334('0x24')]=function(_0x26b464,_0x25889d){if(_0x26b464[_0x4334('0x48')]['id']){delete _0x26b464[_0x4334('0x48')]['id'];}return db[_0x4334('0x3e')]['find']({'where':{'id':_0x26b464[_0x4334('0x44')]['id']}})['then'](handleEntityNotFound(_0x25889d,null))['then'](saveUpdates(_0x26b464['body'],null))[_0x4334('0x25')](respondWithResult(_0x25889d,null))['catch'](handleError(_0x25889d,null));};exports[_0x4334('0x49')]=function(_0x426473,_0x138415){return db[_0x4334('0x3e')][_0x4334('0x46')]({'where':{'id':_0x426473[_0x4334('0x44')]['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x138415,null))[_0x4334('0x25')](removeEntity(_0x138415,null))[_0x4334('0x42')](handleError(_0x138415,null));};exports[_0x4334('0x4a')]=function(_0x99a943,_0x43958f,_0x5814dd){var _0x1c686a={};var _0x52c303={};var _0x22ed3f;var _0x44d9fe;return db[_0x4334('0x3e')][_0x4334('0x4b')]({'where':{'id':_0x99a943[_0x4334('0x44')]['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x43958f,null))['then'](function(_0xb0f251){if(_0xb0f251){_0x22ed3f=_0xb0f251;_0x52c303[_0x4334('0x2c')]=_['keys'](db[_0x4334('0x4c')]['rawAttributes']);_0x52c303[_0x4334('0x2e')]=_[_0x4334('0x2f')](_0x99a943[_0x4334('0x2e')]);_0x52c303[_0x4334('0x39')]=_['intersection'](_0x52c303[_0x4334('0x2c')],_0x52c303[_0x4334('0x2e')]);_0x1c686a[_0x4334('0x32')]=_['intersection'](_0x52c303[_0x4334('0x2c')],qs[_0x4334('0x31')](_0x99a943[_0x4334('0x2e')][_0x4334('0x31')]));_0x1c686a[_0x4334('0x32')]=_0x1c686a[_0x4334('0x32')][_0x4334('0x33')]?_0x1c686a[_0x4334('0x32')]:_0x52c303['model'];_0x1c686a[_0x4334('0x36')]=qs[_0x4334('0x37')](_0x99a943[_0x4334('0x2e')][_0x4334('0x37')]);_0x1c686a['where']=qs[_0x4334('0x39')](_[_0x4334('0x3a')](_0x99a943[_0x4334('0x2e')],_0x52c303[_0x4334('0x39')]));if(_0x99a943[_0x4334('0x2e')][_0x4334('0x3d')]){_0x1c686a[_0x4334('0x38')]=_['merge'](_0x1c686a['where'],{'$or':_['map'](_0x1c686a['attributes'],function(_0x3a31ba){var _0x249966={};_0x249966[_0x3a31ba]={'$like':'%'+_0x99a943['query'][_0x4334('0x3d')]+'%'};return _0x249966;})});}_0x1c686a=_[_0x4334('0x3b')]({},_0x1c686a,_0x99a943[_0x4334('0x45')]);return _0x22ed3f[_0x4334('0x4a')](_0x1c686a);}})[_0x4334('0x25')](function(_0x2d3670){if(_0x2d3670){_0x44d9fe=_0x2d3670[_0x4334('0x33')];if(!_0x99a943['query'][_0x4334('0x34')](_0x4334('0x35'))){_0x1c686a['limit']=qs[_0x4334('0x1e')](_0x99a943['query']['limit']);_0x1c686a[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x99a943[_0x4334('0x2e')]['offset']);}return _0x22ed3f[_0x4334('0x4a')](_0x1c686a);}})['then'](function(_0x2bd509){if(_0x2bd509){return _0x2bd509?{'count':_0x44d9fe,'rows':_0x2bd509}:null;}})[_0x4334('0x25')](respondWithResult(_0x43958f,null))['catch'](handleError(_0x43958f,null));};exports[_0x4334('0x4d')]=function(_0x4993db,_0x2f9d2d,_0x697c80){var _0x242b12={};var _0x1287d3={};var _0x541cc9;var _0x21cdf5;return db[_0x4334('0x3e')][_0x4334('0x4b')]({'where':{'id':_0x4993db[_0x4334('0x44')]['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x2f9d2d,null))[_0x4334('0x25')](function(_0x205fa3){if(_0x205fa3){_0x541cc9=_0x205fa3;_0x1287d3[_0x4334('0x2c')]=_[_0x4334('0x2f')](db[_0x4334('0x4c')][_0x4334('0x29')]);_0x1287d3[_0x4334('0x2e')]=_['keys'](_0x4993db['query']);_0x1287d3[_0x4334('0x39')]=_['intersection'](_0x1287d3[_0x4334('0x2c')],_0x1287d3[_0x4334('0x2e')]);_0x242b12[_0x4334('0x32')]=_[_0x4334('0x30')](_0x1287d3[_0x4334('0x2c')],qs[_0x4334('0x31')](_0x4993db['query'][_0x4334('0x31')]));_0x242b12[_0x4334('0x32')]=_0x242b12[_0x4334('0x32')]['length']?_0x242b12[_0x4334('0x32')]:_0x1287d3[_0x4334('0x2c')];_0x242b12[_0x4334('0x36')]=qs[_0x4334('0x37')](_0x4993db[_0x4334('0x2e')][_0x4334('0x37')]);_0x242b12[_0x4334('0x38')]=qs[_0x4334('0x39')](_[_0x4334('0x3a')](_0x4993db[_0x4334('0x2e')],_0x1287d3[_0x4334('0x39')]));if(_0x4993db[_0x4334('0x2e')][_0x4334('0x3d')]){_0x242b12[_0x4334('0x38')]=_['merge'](_0x242b12[_0x4334('0x38')],{'$or':_[_0x4334('0x2d')](_0x242b12['attributes'],function(_0x28de34){var _0x56d368={};_0x56d368[_0x28de34]={'$like':'%'+_0x4993db[_0x4334('0x2e')][_0x4334('0x3d')]+'%'};return _0x56d368;})});}_0x242b12=_[_0x4334('0x3b')]({},_0x242b12,_0x4993db[_0x4334('0x45')]);return _0x541cc9[_0x4334('0x4d')](_0x242b12);}})['then'](function(_0x3218bd){if(_0x3218bd){_0x21cdf5=_0x3218bd[_0x4334('0x33')];if(!_0x4993db[_0x4334('0x2e')][_0x4334('0x34')](_0x4334('0x35'))){_0x242b12[_0x4334('0x1e')]=qs[_0x4334('0x1e')](_0x4993db[_0x4334('0x2e')][_0x4334('0x1e')]);_0x242b12[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x4993db[_0x4334('0x2e')][_0x4334('0x1d')]);}return _0x541cc9[_0x4334('0x4d')](_0x242b12);}})['then'](function(_0x42fb59){if(_0x42fb59){return _0x42fb59?{'count':_0x21cdf5,'rows':_0x42fb59}:null;}})[_0x4334('0x25')](respondWithResult(_0x2f9d2d,null))['catch'](handleError(_0x2f9d2d,null));};exports[_0x4334('0x4e')]=function(_0x25a473,_0x3bdc48,_0x26709d){var _0x2d995f={};var _0x42c3e9={};var _0x3b4b2a;var _0x268b63;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x25a473['params']['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x3bdc48,null))[_0x4334('0x25')](function(_0x5be2cd){if(_0x5be2cd){_0x3b4b2a=_0x5be2cd;_0x42c3e9[_0x4334('0x2c')]=_[_0x4334('0x2f')](db['ZendeskField'][_0x4334('0x29')]);_0x42c3e9['query']=_[_0x4334('0x2f')](_0x25a473[_0x4334('0x2e')]);_0x42c3e9[_0x4334('0x39')]=_[_0x4334('0x30')](_0x42c3e9['model'],_0x42c3e9['query']);_0x2d995f[_0x4334('0x32')]=_['intersection'](_0x42c3e9[_0x4334('0x2c')],qs['fields'](_0x25a473[_0x4334('0x2e')][_0x4334('0x31')]));_0x2d995f['attributes']=_0x2d995f[_0x4334('0x32')][_0x4334('0x33')]?_0x2d995f[_0x4334('0x32')]:_0x42c3e9[_0x4334('0x2c')];_0x2d995f[_0x4334('0x36')]=qs['sort'](_0x25a473[_0x4334('0x2e')][_0x4334('0x37')]);_0x2d995f[_0x4334('0x38')]=qs['filters'](_[_0x4334('0x3a')](_0x25a473[_0x4334('0x2e')],_0x42c3e9[_0x4334('0x39')]));if(_0x25a473[_0x4334('0x2e')]['filter']){_0x2d995f[_0x4334('0x38')]=_[_0x4334('0x3b')](_0x2d995f['where'],{'$or':_[_0x4334('0x2d')](_0x2d995f[_0x4334('0x32')],function(_0x332254){var _0x1d8ccb={};_0x1d8ccb[_0x332254]={'$like':'%'+_0x25a473[_0x4334('0x2e')][_0x4334('0x3d')]+'%'};return _0x1d8ccb;})});}_0x2d995f=_[_0x4334('0x3b')]({},_0x2d995f,_0x25a473[_0x4334('0x45')]);return _0x3b4b2a[_0x4334('0x4e')](_0x2d995f);}})[_0x4334('0x25')](function(_0x1b14c7){if(_0x1b14c7){_0x268b63=_0x1b14c7['length'];if(!_0x25a473['query'][_0x4334('0x34')](_0x4334('0x35'))){_0x2d995f['limit']=qs[_0x4334('0x1e')](_0x25a473['query'][_0x4334('0x1e')]);_0x2d995f[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x25a473['query'][_0x4334('0x1d')]);}return _0x3b4b2a[_0x4334('0x4e')](_0x2d995f);}})[_0x4334('0x25')](function(_0x263e82){if(_0x263e82){return _0x263e82?{'count':_0x268b63,'rows':_0x263e82}:null;}})[_0x4334('0x25')](respondWithResult(_0x3bdc48,null))[_0x4334('0x42')](handleError(_0x3bdc48,null));};exports['getTags']=function(_0x3c680f,_0x4fcc12,_0x596643){var _0x5a6a10={};var _0x4e10ee={};var _0x1bd8ac;var _0xa73580;return db[_0x4334('0x3e')][_0x4334('0x4b')]({'where':{'id':_0x3c680f['params']['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x4fcc12,null))[_0x4334('0x25')](function(_0x38be57){if(_0x38be57){_0x1bd8ac=_0x38be57;_0x4e10ee[_0x4334('0x2c')]=_['keys'](db[_0x4334('0x4f')][_0x4334('0x29')]);_0x4e10ee[_0x4334('0x2e')]=_['keys'](_0x3c680f[_0x4334('0x2e')]);_0x4e10ee[_0x4334('0x39')]=_[_0x4334('0x30')](_0x4e10ee[_0x4334('0x2c')],_0x4e10ee[_0x4334('0x2e')]);_0x5a6a10[_0x4334('0x32')]=_['intersection'](_0x4e10ee['model'],qs['fields'](_0x3c680f['query']['fields']));_0x5a6a10[_0x4334('0x32')]=_0x5a6a10[_0x4334('0x32')][_0x4334('0x33')]?_0x5a6a10['attributes']:_0x4e10ee[_0x4334('0x2c')];_0x5a6a10[_0x4334('0x36')]=qs[_0x4334('0x37')](_0x3c680f['query'][_0x4334('0x37')]);_0x5a6a10[_0x4334('0x38')]=qs[_0x4334('0x39')](_[_0x4334('0x3a')](_0x3c680f[_0x4334('0x2e')],_0x4e10ee[_0x4334('0x39')]));if(_0x3c680f['query'][_0x4334('0x3d')]){_0x5a6a10[_0x4334('0x38')]=_[_0x4334('0x3b')](_0x5a6a10[_0x4334('0x38')],{'$or':_[_0x4334('0x2d')](_0x5a6a10[_0x4334('0x32')],function(_0xd8e3dd){var _0x1674b6={};_0x1674b6[_0xd8e3dd]={'$like':'%'+_0x3c680f[_0x4334('0x2e')][_0x4334('0x3d')]+'%'};return _0x1674b6;})});}_0x5a6a10=_['merge']({},_0x5a6a10,_0x3c680f[_0x4334('0x45')]);return _0x1bd8ac[_0x4334('0x50')](_0x5a6a10);}})['then'](function(_0x3134ed){if(_0x3134ed){_0xa73580=_0x3134ed[_0x4334('0x33')];if(!_0x3c680f[_0x4334('0x2e')][_0x4334('0x34')](_0x4334('0x35'))){_0x5a6a10['limit']=qs['limit'](_0x3c680f[_0x4334('0x2e')]['limit']);_0x5a6a10[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x3c680f[_0x4334('0x2e')][_0x4334('0x1d')]);}return _0x1bd8ac[_0x4334('0x50')](_0x5a6a10);}})[_0x4334('0x25')](function(_0x41b408){if(_0x41b408){return _0x41b408?{'count':_0xa73580,'rows':_0x41b408}:null;}})[_0x4334('0x25')](respondWithResult(_0x4fcc12,null))[_0x4334('0x42')](handleError(_0x4fcc12,null));};exports['setTags']=function(_0x43f3c6,_0x5040a1,_0x54dbf5){if(_0x43f3c6[_0x4334('0x48')]['id']){delete _0x43f3c6['body']['id'];}return db[_0x4334('0x3e')][_0x4334('0x4b')]({'where':{'id':_0x43f3c6[_0x4334('0x44')]['id']}})['then'](handleEntityNotFound(_0x5040a1,null))[_0x4334('0x25')](function(_0x1ad75d){if(_0x1ad75d){return _0x1ad75d['setTags'](_0x43f3c6['body'][_0x4334('0x51')]||[]);}return null;})['then'](respondWithResult(_0x5040a1,null))['catch'](handleError(_0x5040a1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c4a28f7..e7ba5d0 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 _0xef0f=['moment','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','../../config/logger','api'];(function(_0x2fe3b9,_0x5de54e){var _0xec07e3=function(_0x2841f){while(--_0x2841f){_0x2fe3b9['push'](_0x2fe3b9['shift']());}};_0xec07e3(++_0x5de54e);}(_0xef0f,0x168));var _0xfef0=function(_0x448bf4,_0x25e2ee){_0x448bf4=_0x448bf4-0x0;var _0x3faba2=_0xef0f[_0x448bf4];return _0x3faba2;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0xa22583,_0x564cdd){var _0x3e2d07=function(_0x56520a){while(--_0x56520a){_0xa22583['push'](_0xa22583['shift']());}};_0x3e2d07(++_0x564cdd);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x38fbc2,_0x54f822){_0x38fbc2=_0x38fbc2-0x0;var _0x2ae767=_0xe1e3[_0x38fbc2];return _0x2ae767;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'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 ec71fe9..92cbed1 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 _0x9893=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3fc206,_0x1fae09){var _0x411af1=function(_0x380578){while(--_0x380578){_0x3fc206['push'](_0x3fc206['shift']());}};_0x411af1(++_0x1fae09);}(_0x9893,0x162));var _0x3989=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9893[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3989('0x0'));var moment=require(_0x3989('0x1'));var BPromise=require(_0x3989('0x2'));var rs=require(_0x3989('0x3'));var fs=require('fs');var Redis=require(_0x3989('0x4'));var db=require(_0x3989('0x5'))['db'];var utils=require(_0x3989('0x6'));var logger=require('../../config/logger')(_0x3989('0x7'));var config=require(_0x3989('0x8'));var jayson=require(_0x3989('0x9'));var client=jayson['client'][_0x3989('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b62a0,_0x89c63f,_0x333ef8){return new BPromise(function(_0x4dc9b7,_0x4e173f){return client[_0x3989('0xb')](_0x1b62a0,_0x333ef8)[_0x3989('0xc')](function(_0x4688d4){logger[_0x3989('0xd')](_0x3989('0xe'),_0x89c63f,_0x3989('0xf'));logger[_0x3989('0x10')](_0x3989('0x11'),_0x89c63f,_0x3989('0xf'),JSON[_0x3989('0x12')](_0x4688d4));if(_0x4688d4[_0x3989('0x13')]){if(_0x4688d4[_0x3989('0x13')][_0x3989('0x14')]===0x1f4){logger['error'](_0x3989('0xe'),_0x89c63f,_0x4688d4[_0x3989('0x13')]['message']);return _0x4e173f(_0x4688d4[_0x3989('0x13')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x89c63f,_0x4688d4[_0x3989('0x13')][_0x3989('0x15')]);return _0x4dc9b7(_0x4688d4[_0x3989('0x13')][_0x3989('0x15')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x89c63f,'request\x20sent');_0x4dc9b7(_0x4688d4[_0x3989('0x16')][_0x3989('0x15')]);}})[_0x3989('0x17')](function(_0x19b77c){logger[_0x3989('0x13')](_0x3989('0xe'),_0x89c63f,_0x19b77c);_0x4e173f(_0x19b77c);});});} \ No newline at end of file +var _0x0c72=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash'];(function(_0x498d7b,_0x2907d7){var _0x3b78c9=function(_0x502ba6){while(--_0x502ba6){_0x498d7b['push'](_0x498d7b['shift']());}};_0x3b78c9(++_0x2907d7);}(_0x0c72,0x175));var _0x20c7=function(_0xb0cd95,_0x2f625){_0xb0cd95=_0xb0cd95-0x0;var _0x152784=_0x0c72[_0xb0cd95];return _0x152784;};'use strict';var _=require(_0x20c7('0x0'));var util=require(_0x20c7('0x1'));var moment=require(_0x20c7('0x2'));var BPromise=require(_0x20c7('0x3'));var rs=require(_0x20c7('0x4'));var fs=require('fs');var Redis=require(_0x20c7('0x5'));var db=require(_0x20c7('0x6'))['db'];var utils=require(_0x20c7('0x7'));var logger=require(_0x20c7('0x8'))(_0x20c7('0x9'));var config=require(_0x20c7('0xa'));var jayson=require(_0x20c7('0xb'));var client=jayson['client'][_0x20c7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335783,_0x3f8149,_0x4007dd){return new BPromise(function(_0x3038f3,_0xb6468e){return client[_0x20c7('0xd')](_0x335783,_0x4007dd)['then'](function(_0x5d2591){logger[_0x20c7('0xe')](_0x20c7('0xf'),_0x3f8149,'request\x20sent');logger[_0x20c7('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f8149,_0x20c7('0x11'),JSON[_0x20c7('0x12')](_0x5d2591));if(_0x5d2591[_0x20c7('0x13')]){if(_0x5d2591['error'][_0x20c7('0x14')]===0x1f4){logger[_0x20c7('0x13')](_0x20c7('0xf'),_0x3f8149,_0x5d2591[_0x20c7('0x13')]['message']);return _0xb6468e(_0x5d2591[_0x20c7('0x13')][_0x20c7('0x15')]);}logger[_0x20c7('0x13')](_0x20c7('0xf'),_0x3f8149,_0x5d2591[_0x20c7('0x13')][_0x20c7('0x15')]);return _0x3038f3(_0x5d2591[_0x20c7('0x13')]['message']);}else{logger[_0x20c7('0xe')](_0x20c7('0xf'),_0x3f8149,'request\x20sent');_0x3038f3(_0x5d2591['result'][_0x20c7('0x15')]);}})['catch'](function(_0x268791){logger['error'](_0x20c7('0xf'),_0x3f8149,_0x268791);_0xb6468e(_0x268791);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 865d71a..5d3109a 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 _0x4739=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','create','update','destroy','exports','multer','util','path'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x4739,0x18d));var _0x9473=function(_0x16a917,_0x4b31c5){_0x16a917=_0x16a917-0x0;var _0x35df6c=_0x4739[_0x16a917];return _0x35df6c;};'use strict';var multer=require(_0x9473('0x0'));var util=require(_0x9473('0x1'));var path=require(_0x9473('0x2'));var timeout=require(_0x9473('0x3'));var express=require(_0x9473('0x4'));var router=express[_0x9473('0x5')]();var fs_extra=require(_0x9473('0x6'));var auth=require(_0x9473('0x7'));var interaction=require(_0x9473('0x8'));var config=require(_0x9473('0x9'));var controller=require(_0x9473('0xa'));router['get']('/',auth[_0x9473('0xb')](),controller[_0x9473('0xc')]);router[_0x9473('0xd')](_0x9473('0xe'),auth[_0x9473('0xb')](),controller[_0x9473('0xf')]);router['post']('/',auth[_0x9473('0xb')](),controller[_0x9473('0x10')]);router['put']('/:id',auth[_0x9473('0xb')](),controller[_0x9473('0x11')]);router['delete'](_0x9473('0xe'),auth[_0x9473('0xb')](),controller[_0x9473('0x12')]);module[_0x9473('0x13')]=router; \ No newline at end of file +var _0xa96f=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','util'];(function(_0x8ccfb8,_0x31261f){var _0x5193d6=function(_0x496c5d){while(--_0x496c5d){_0x8ccfb8['push'](_0x8ccfb8['shift']());}};_0x5193d6(++_0x31261f);}(_0xa96f,0x179));var _0xfa96=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xa96f[_0x3042c5];return _0x7cd140;};'use strict';var multer=require('multer');var util=require(_0xfa96('0x0'));var path=require(_0xfa96('0x1'));var timeout=require(_0xfa96('0x2'));var express=require('express');var router=express[_0xfa96('0x3')]();var fs_extra=require(_0xfa96('0x4'));var auth=require(_0xfa96('0x5'));var interaction=require(_0xfa96('0x6'));var config=require('../../config/environment');var controller=require(_0xfa96('0x7'));router['get']('/',auth[_0xfa96('0x8')](),controller[_0xfa96('0x9')]);router[_0xfa96('0xa')](_0xfa96('0xb'),auth['isAuthenticated'](),controller[_0xfa96('0xc')]);router['post']('/',auth[_0xfa96('0x8')](),controller[_0xfa96('0xd')]);router[_0xfa96('0xe')](_0xfa96('0xb'),auth['isAuthenticated'](),controller[_0xfa96('0xf')]);router['delete'](_0xfa96('0xb'),auth['isAuthenticated'](),controller[_0xfa96('0x10')]);module[_0xfa96('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 9ff6034..4c249b5 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 _0xca71=['customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable'];(function(_0x4a9ebe,_0x453c87){var _0x185310=function(_0x1bd7cd){while(--_0x1bd7cd){_0x4a9ebe['push'](_0x4a9ebe['shift']());}};_0x185310(++_0x453c87);}(_0xca71,0x179));var _0x1ca7=function(_0x1118eb,_0x476f0a){_0x1118eb=_0x1118eb-0x0;var _0x2dbcd0=_0xca71[_0x1118eb];return _0x2dbcd0;};'use strict';var Sequelize=require(_0x1ca7('0x0'));module[_0x1ca7('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1ca7('0x2'),_0x1ca7('0x3'),_0x1ca7('0x4'),_0x1ca7('0x5')),'defaultValue':_0x1ca7('0x6')},'content':{'type':Sequelize[_0x1ca7('0x7')]},'key':{'type':Sequelize[_0x1ca7('0x7')]},'keyType':{'type':Sequelize[_0x1ca7('0x8')](_0x1ca7('0x6'),_0x1ca7('0x2'),_0x1ca7('0x3'))},'keyContent':{'type':Sequelize[_0x1ca7('0x7')]},'idField':{'type':Sequelize[_0x1ca7('0x7')]},'nameField':{'type':Sequelize[_0x1ca7('0x7')]},'customField':{'type':Sequelize[_0x1ca7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ca7('0x7')]}}; \ No newline at end of file +var _0x94d8=['exports','ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x47a66e,_0x21ce39){var _0x4e2bc6=function(_0x13aa8a){while(--_0x13aa8a){_0x47a66e['push'](_0x47a66e['shift']());}};_0x4e2bc6(++_0x21ce39);}(_0x94d8,0x10d));var _0x894d=function(_0xd39da4,_0x36bc6f){_0xd39da4=_0xd39da4-0x0;var _0x2900d6=_0x94d8[_0xd39da4];return _0x2900d6;};'use strict';var Sequelize=require(_0x894d('0x0'));module[_0x894d('0x1')]={'type':{'type':Sequelize[_0x894d('0x2')](_0x894d('0x3'),'variable',_0x894d('0x4'),'keyValue',_0x894d('0x5')),'defaultValue':_0x894d('0x3')},'content':{'type':Sequelize[_0x894d('0x6')]},'key':{'type':Sequelize[_0x894d('0x6')]},'keyType':{'type':Sequelize[_0x894d('0x2')](_0x894d('0x3'),_0x894d('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x894d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x894d('0x6')]},'customField':{'type':Sequelize[_0x894d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index fc2eb24..a64e291 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 _0xeca7=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','ZendeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0xeca7,0xba));var _0x7eca=function(_0x489250,_0x5e9468){_0x489250=_0x489250-0x0;var _0x1283e5=_0xeca7[_0x489250];return _0x1283e5;};'use strict';var emlformat=require(_0x7eca('0x0'));var rimraf=require(_0x7eca('0x1'));var zipdir=require(_0x7eca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7eca('0x3'));var moment=require(_0x7eca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7eca('0x5'));var util=require(_0x7eca('0x6'));var path=require('path');var sox=require(_0x7eca('0x7'));var csv=require(_0x7eca('0x8'));var ejs=require(_0x7eca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7eca('0xa'));var squel=require(_0x7eca('0xb'));var crypto=require(_0x7eca('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7eca('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7eca('0xe'));var Redis=require('ioredis');var authService=require(_0x7eca('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7eca('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7eca('0x11'));var utils=require(_0x7eca('0x12'));var config=require(_0x7eca('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7eca('0x14'))['db'];function respondWithStatusCode(_0x215e7b,_0x4ec732){_0x4ec732=_0x4ec732||0xcc;return function(_0x50376c){if(_0x50376c){return _0x215e7b[_0x7eca('0x15')](_0x4ec732);}return _0x215e7b[_0x7eca('0x16')](_0x4ec732)[_0x7eca('0x17')]();};}function respondWithResult(_0x4161ae,_0x3db83c){_0x3db83c=_0x3db83c||0xc8;return function(_0xe09302){if(_0xe09302){return _0x4161ae[_0x7eca('0x16')](_0x3db83c)['json'](_0xe09302);}};}function respondWithFilteredResult(_0x38b246,_0x7d640e){return function(_0x11aa7e){if(_0x11aa7e){var _0x3f70a2=typeof _0x7d640e[_0x7eca('0x18')]===_0x7eca('0x19')&&typeof _0x7d640e[_0x7eca('0x1a')]===_0x7eca('0x19');var _0x4ae0bc=_0x11aa7e['count'];var _0xc91f60=_0x3f70a2?0x0:_0x7d640e[_0x7eca('0x18')];var _0x499e44=_0x3f70a2?_0x11aa7e['count']:_0x7d640e[_0x7eca('0x18')]+_0x7d640e[_0x7eca('0x1a')];var _0x242dad;if(_0x499e44>=_0x4ae0bc){_0x499e44=_0x4ae0bc;_0x242dad=0xc8;}else{_0x242dad=0xce;}_0x38b246['status'](_0x242dad);return _0x38b246[_0x7eca('0x1b')](_0x7eca('0x1c'),_0xc91f60+'-'+_0x499e44+'/'+_0x4ae0bc)['json'](_0x11aa7e);}return null;};}function patchUpdates(_0x21a6e2){return function(_0x2b1c00){try{jsonpatch['apply'](_0x2b1c00,_0x21a6e2,!![]);}catch(_0x1b26ca){return BPromise[_0x7eca('0x1d')](_0x1b26ca);}return _0x2b1c00[_0x7eca('0x1e')]();};}function saveUpdates(_0x2ef737,_0x332d79){return function(_0x5a0970){if(_0x5a0970){return _0x5a0970[_0x7eca('0x1f')](_0x2ef737)[_0x7eca('0x20')](function(_0x42f31b){return _0x42f31b;});}return null;};}function removeEntity(_0x4de8c3,_0x1c1615){return function(_0x185021){if(_0x185021){return _0x185021[_0x7eca('0x21')]()['then'](function(){_0x4de8c3[_0x7eca('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bcd46,_0x1d0463){return function(_0x330e98){if(!_0x330e98){_0x5bcd46[_0x7eca('0x15')](0x194);}return _0x330e98;};}function handleError(_0x2171aa,_0x5df84e){_0x5df84e=_0x5df84e||0x1f4;return function(_0x4deec1){logger[_0x7eca('0x22')](_0x4deec1[_0x7eca('0x23')]);if(_0x4deec1['name']){delete _0x4deec1[_0x7eca('0x24')];}_0x2171aa['status'](_0x5df84e)[_0x7eca('0x25')](_0x4deec1);};}exports['index']=function(_0x13fdf1,_0x4019d9){var _0x32089c={},_0x1fc224={},_0x311341={'count':0x0,'rows':[]};var _0x349e0c=_[_0x7eca('0x26')](db[_0x7eca('0x27')]['rawAttributes'],function(_0x2bd8ef){return{'name':_0x2bd8ef[_0x7eca('0x28')],'type':_0x2bd8ef[_0x7eca('0x29')][_0x7eca('0x2a')]};});_0x1fc224[_0x7eca('0x2b')]=_[_0x7eca('0x26')](_0x349e0c,_0x7eca('0x24'));_0x1fc224[_0x7eca('0x2c')]=_[_0x7eca('0x2d')](_0x13fdf1[_0x7eca('0x2c')]);_0x1fc224[_0x7eca('0x2e')]=_[_0x7eca('0x2f')](_0x1fc224[_0x7eca('0x2b')],_0x1fc224[_0x7eca('0x2c')]);_0x32089c[_0x7eca('0x30')]=_['intersection'](_0x1fc224['model'],qs[_0x7eca('0x31')](_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x31')]));_0x32089c['attributes']=_0x32089c['attributes'][_0x7eca('0x32')]?_0x32089c[_0x7eca('0x30')]:_0x1fc224[_0x7eca('0x2b')];if(!_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x33')](_0x7eca('0x34'))){_0x32089c[_0x7eca('0x1a')]=qs[_0x7eca('0x1a')](_0x13fdf1['query']['limit']);_0x32089c['offset']=qs[_0x7eca('0x18')](_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x18')]);}_0x32089c[_0x7eca('0x35')]=qs['sort'](_0x13fdf1['query']['sort']);_0x32089c['where']=qs['filters'](_[_0x7eca('0x36')](_0x13fdf1[_0x7eca('0x2c')],_0x1fc224[_0x7eca('0x2e')]),_0x349e0c);if(_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x37')]){_0x32089c['where']=_['merge'](_0x32089c[_0x7eca('0x38')],{'$or':_['map'](_0x349e0c,function(_0x31805c){if(_0x31805c[_0x7eca('0x29')]!==_0x7eca('0x39')){var _0x1ec9e5={};_0x1ec9e5[_0x31805c[_0x7eca('0x24')]]={'$like':'%'+_0x13fdf1[_0x7eca('0x2c')]['filter']+'%'};return _0x1ec9e5;}})});}_0x32089c=_[_0x7eca('0x3a')]({},_0x32089c,_0x13fdf1[_0x7eca('0x3b')]);var _0x5deeb2={'where':_0x32089c['where']};return db[_0x7eca('0x27')][_0x7eca('0x3c')](_0x5deeb2)[_0x7eca('0x20')](function(_0x4c1fde){_0x311341['count']=_0x4c1fde;if(_0x13fdf1[_0x7eca('0x2c')][_0x7eca('0x3d')]){_0x32089c['include']=[{'all':!![]}];}return db['ZendeskField'][_0x7eca('0x3e')](_0x32089c);})[_0x7eca('0x20')](function(_0x20a9de){_0x311341[_0x7eca('0x3f')]=_0x20a9de;return _0x311341;})[_0x7eca('0x20')](respondWithFilteredResult(_0x4019d9,_0x32089c))[_0x7eca('0x40')](handleError(_0x4019d9,null));};exports[_0x7eca('0x41')]=function(_0xf61005,_0x3d2d7b){var _0x38b296={'raw':!![],'where':{'id':_0xf61005['params']['id']}},_0x53d0aa={};_0x53d0aa['model']=_['keys'](db[_0x7eca('0x27')][_0x7eca('0x42')]);_0x53d0aa[_0x7eca('0x2c')]=_[_0x7eca('0x2d')](_0xf61005[_0x7eca('0x2c')]);_0x53d0aa[_0x7eca('0x2e')]=_[_0x7eca('0x2f')](_0x53d0aa[_0x7eca('0x2b')],_0x53d0aa[_0x7eca('0x2c')]);_0x38b296[_0x7eca('0x30')]=_[_0x7eca('0x2f')](_0x53d0aa['model'],qs[_0x7eca('0x31')](_0xf61005[_0x7eca('0x2c')]['fields']));_0x38b296[_0x7eca('0x30')]=_0x38b296[_0x7eca('0x30')][_0x7eca('0x32')]?_0x38b296[_0x7eca('0x30')]:_0x53d0aa['model'];if(_0xf61005['query'][_0x7eca('0x3d')]){_0x38b296['include']=[{'all':!![]}];}_0x38b296=_['merge']({},_0x38b296,_0xf61005[_0x7eca('0x3b')]);return db[_0x7eca('0x27')][_0x7eca('0x43')](_0x38b296)[_0x7eca('0x20')](handleEntityNotFound(_0x3d2d7b,null))[_0x7eca('0x20')](respondWithResult(_0x3d2d7b,null))[_0x7eca('0x40')](handleError(_0x3d2d7b,null));};exports[_0x7eca('0x44')]=function(_0x61d8c0,_0x1b27d8){return db[_0x7eca('0x27')][_0x7eca('0x44')](_0x61d8c0['body'],{})[_0x7eca('0x20')](respondWithResult(_0x1b27d8,0xc9))['catch'](handleError(_0x1b27d8,null));};exports[_0x7eca('0x1f')]=function(_0x21359b,_0x4e834a){if(_0x21359b[_0x7eca('0x45')]['id']){delete _0x21359b[_0x7eca('0x45')]['id'];}return db[_0x7eca('0x27')][_0x7eca('0x43')]({'where':{'id':_0x21359b[_0x7eca('0x46')]['id']}})[_0x7eca('0x20')](handleEntityNotFound(_0x4e834a,null))[_0x7eca('0x20')](saveUpdates(_0x21359b['body'],null))[_0x7eca('0x20')](respondWithResult(_0x4e834a,null))[_0x7eca('0x40')](handleError(_0x4e834a,null));};exports['destroy']=function(_0x8a40bb,_0x59f81f){return db['ZendeskField'][_0x7eca('0x43')]({'where':{'id':_0x8a40bb[_0x7eca('0x46')]['id']}})['then'](handleEntityNotFound(_0x59f81f,null))['then'](removeEntity(_0x59f81f,null))['catch'](handleError(_0x59f81f,null));}; \ No newline at end of file +var _0xa1ab=['options','includeAll','include','rows','length','create','body','catch','find','params','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter'];(function(_0x434eb0,_0xcf2586){var _0x118459=function(_0x378240){while(--_0x378240){_0x434eb0['push'](_0x434eb0['shift']());}};_0x118459(++_0xcf2586);}(_0xa1ab,0x1ae));var _0xba1a=function(_0x5aa5cb,_0x5d785f){_0x5aa5cb=_0x5aa5cb-0x0;var _0xf6d1ef=_0xa1ab[_0x5aa5cb];return _0xf6d1ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba1a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba1a('0x1'));var moment=require(_0xba1a('0x2'));var BPromise=require(_0xba1a('0x3'));var Mustache=require('mustache');var util=require(_0xba1a('0x4'));var path=require(_0xba1a('0x5'));var sox=require('sox');var csv=require(_0xba1a('0x6'));var ejs=require(_0xba1a('0x7'));var fs=require('fs');var fs_extra=require(_0xba1a('0x8'));var _=require(_0xba1a('0x9'));var squel=require(_0xba1a('0xa'));var crypto=require(_0xba1a('0xb'));var jsforce=require(_0xba1a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba1a('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba1a('0xe'));var hardwareService=require(_0xba1a('0xf'));var logger=require(_0xba1a('0x10'))(_0xba1a('0x11'));var utils=require('../../config/utils');var config=require(_0xba1a('0x12'));var licenseUtil=require(_0xba1a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a0e0,_0x2770c5){_0x2770c5=_0x2770c5||0xcc;return function(_0x466cde){if(_0x466cde){return _0x42a0e0[_0xba1a('0x14')](_0x2770c5);}return _0x42a0e0['status'](_0x2770c5)[_0xba1a('0x15')]();};}function respondWithResult(_0x58666f,_0x1f0ffc){_0x1f0ffc=_0x1f0ffc||0xc8;return function(_0x5bc1b4){if(_0x5bc1b4){return _0x58666f[_0xba1a('0x16')](_0x1f0ffc)[_0xba1a('0x17')](_0x5bc1b4);}};}function respondWithFilteredResult(_0x5c4950,_0x16d7bf){return function(_0x4024c4){if(_0x4024c4){var _0x28a818=typeof _0x16d7bf[_0xba1a('0x18')]==='undefined'&&typeof _0x16d7bf['limit']===_0xba1a('0x19');var _0x27133c=_0x4024c4[_0xba1a('0x1a')];var _0x3434ed=_0x28a818?0x0:_0x16d7bf[_0xba1a('0x18')];var _0x5ea513=_0x28a818?_0x4024c4[_0xba1a('0x1a')]:_0x16d7bf[_0xba1a('0x18')]+_0x16d7bf[_0xba1a('0x1b')];var _0x15a068;if(_0x5ea513>=_0x27133c){_0x5ea513=_0x27133c;_0x15a068=0xc8;}else{_0x15a068=0xce;}_0x5c4950[_0xba1a('0x16')](_0x15a068);return _0x5c4950[_0xba1a('0x1c')]('Content-Range',_0x3434ed+'-'+_0x5ea513+'/'+_0x27133c)[_0xba1a('0x17')](_0x4024c4);}return null;};}function patchUpdates(_0x59b48d){return function(_0x19b17d){try{jsonpatch[_0xba1a('0x1d')](_0x19b17d,_0x59b48d,!![]);}catch(_0x3f37f7){return BPromise[_0xba1a('0x1e')](_0x3f37f7);}return _0x19b17d[_0xba1a('0x1f')]();};}function saveUpdates(_0x24d5c2,_0x4d77e2){return function(_0x11a6f2){if(_0x11a6f2){return _0x11a6f2[_0xba1a('0x20')](_0x24d5c2)[_0xba1a('0x21')](function(_0x20ff2e){return _0x20ff2e;});}return null;};}function removeEntity(_0x5a26a4,_0x5e8490){return function(_0x5ee9de){if(_0x5ee9de){return _0x5ee9de[_0xba1a('0x22')]()['then'](function(){_0x5a26a4['status'](0xcc)[_0xba1a('0x15')]();});}};}function handleEntityNotFound(_0xc8aa6b,_0x331224){return function(_0x4207cc){if(!_0x4207cc){_0xc8aa6b[_0xba1a('0x14')](0x194);}return _0x4207cc;};}function handleError(_0x545633,_0x2426d1){_0x2426d1=_0x2426d1||0x1f4;return function(_0x50069a){logger['error'](_0x50069a[_0xba1a('0x23')]);if(_0x50069a[_0xba1a('0x24')]){delete _0x50069a[_0xba1a('0x24')];}_0x545633[_0xba1a('0x16')](_0x2426d1)[_0xba1a('0x25')](_0x50069a);};}exports[_0xba1a('0x26')]=function(_0x23c8e7,_0x5bce4d){var _0x49ba65={},_0x3ddb47={},_0x297953={'count':0x0,'rows':[]};var _0x5e14ef=_[_0xba1a('0x27')](db[_0xba1a('0x28')][_0xba1a('0x29')],function(_0x1d3457){return{'name':_0x1d3457[_0xba1a('0x2a')],'type':_0x1d3457['type'][_0xba1a('0x2b')]};});_0x3ddb47[_0xba1a('0x2c')]=_[_0xba1a('0x27')](_0x5e14ef,_0xba1a('0x24'));_0x3ddb47[_0xba1a('0x2d')]=_[_0xba1a('0x2e')](_0x23c8e7[_0xba1a('0x2d')]);_0x3ddb47['filters']=_[_0xba1a('0x2f')](_0x3ddb47[_0xba1a('0x2c')],_0x3ddb47['query']);_0x49ba65[_0xba1a('0x30')]=_[_0xba1a('0x2f')](_0x3ddb47[_0xba1a('0x2c')],qs[_0xba1a('0x31')](_0x23c8e7[_0xba1a('0x2d')]['fields']));_0x49ba65[_0xba1a('0x30')]=_0x49ba65[_0xba1a('0x30')]['length']?_0x49ba65[_0xba1a('0x30')]:_0x3ddb47[_0xba1a('0x2c')];if(!_0x23c8e7[_0xba1a('0x2d')]['hasOwnProperty'](_0xba1a('0x32'))){_0x49ba65[_0xba1a('0x1b')]=qs[_0xba1a('0x1b')](_0x23c8e7[_0xba1a('0x2d')]['limit']);_0x49ba65['offset']=qs[_0xba1a('0x18')](_0x23c8e7[_0xba1a('0x2d')][_0xba1a('0x18')]);}_0x49ba65[_0xba1a('0x33')]=qs['sort'](_0x23c8e7[_0xba1a('0x2d')][_0xba1a('0x34')]);_0x49ba65[_0xba1a('0x35')]=qs[_0xba1a('0x36')](_[_0xba1a('0x37')](_0x23c8e7[_0xba1a('0x2d')],_0x3ddb47[_0xba1a('0x36')]),_0x5e14ef);if(_0x23c8e7['query']['filter']){_0x49ba65[_0xba1a('0x35')]=_[_0xba1a('0x38')](_0x49ba65[_0xba1a('0x35')],{'$or':_[_0xba1a('0x27')](_0x5e14ef,function(_0x2c0d7c){if(_0x2c0d7c[_0xba1a('0x39')]!==_0xba1a('0x3a')){var _0x1ad68f={};_0x1ad68f[_0x2c0d7c[_0xba1a('0x24')]]={'$like':'%'+_0x23c8e7[_0xba1a('0x2d')][_0xba1a('0x3b')]+'%'};return _0x1ad68f;}})});}_0x49ba65=_[_0xba1a('0x38')]({},_0x49ba65,_0x23c8e7[_0xba1a('0x3c')]);var _0x213284={'where':_0x49ba65[_0xba1a('0x35')]};return db[_0xba1a('0x28')][_0xba1a('0x1a')](_0x213284)[_0xba1a('0x21')](function(_0x4614f9){_0x297953['count']=_0x4614f9;if(_0x23c8e7[_0xba1a('0x2d')][_0xba1a('0x3d')]){_0x49ba65[_0xba1a('0x3e')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x49ba65);})[_0xba1a('0x21')](function(_0x1cf43b){_0x297953[_0xba1a('0x3f')]=_0x1cf43b;return _0x297953;})[_0xba1a('0x21')](respondWithFilteredResult(_0x5bce4d,_0x49ba65))['catch'](handleError(_0x5bce4d,null));};exports['show']=function(_0x3a7062,_0x5216de){var _0x595b45={'raw':!![],'where':{'id':_0x3a7062['params']['id']}},_0x372675={};_0x372675[_0xba1a('0x2c')]=_[_0xba1a('0x2e')](db['ZendeskField'][_0xba1a('0x29')]);_0x372675[_0xba1a('0x2d')]=_['keys'](_0x3a7062[_0xba1a('0x2d')]);_0x372675[_0xba1a('0x36')]=_[_0xba1a('0x2f')](_0x372675['model'],_0x372675[_0xba1a('0x2d')]);_0x595b45['attributes']=_[_0xba1a('0x2f')](_0x372675[_0xba1a('0x2c')],qs[_0xba1a('0x31')](_0x3a7062[_0xba1a('0x2d')]['fields']));_0x595b45[_0xba1a('0x30')]=_0x595b45[_0xba1a('0x30')][_0xba1a('0x40')]?_0x595b45[_0xba1a('0x30')]:_0x372675[_0xba1a('0x2c')];if(_0x3a7062[_0xba1a('0x2d')]['includeAll']){_0x595b45[_0xba1a('0x3e')]=[{'all':!![]}];}_0x595b45=_[_0xba1a('0x38')]({},_0x595b45,_0x3a7062[_0xba1a('0x3c')]);return db['ZendeskField']['find'](_0x595b45)[_0xba1a('0x21')](handleEntityNotFound(_0x5216de,null))[_0xba1a('0x21')](respondWithResult(_0x5216de,null))['catch'](handleError(_0x5216de,null));};exports['create']=function(_0x16a258,_0x20e925){return db['ZendeskField'][_0xba1a('0x41')](_0x16a258[_0xba1a('0x42')],{})[_0xba1a('0x21')](respondWithResult(_0x20e925,0xc9))[_0xba1a('0x43')](handleError(_0x20e925,null));};exports[_0xba1a('0x20')]=function(_0x195a64,_0x243586){if(_0x195a64[_0xba1a('0x42')]['id']){delete _0x195a64[_0xba1a('0x42')]['id'];}return db['ZendeskField'][_0xba1a('0x44')]({'where':{'id':_0x195a64[_0xba1a('0x45')]['id']}})[_0xba1a('0x21')](handleEntityNotFound(_0x243586,null))[_0xba1a('0x21')](saveUpdates(_0x195a64['body'],null))[_0xba1a('0x21')](respondWithResult(_0x243586,null))['catch'](handleError(_0x243586,null));};exports['destroy']=function(_0x4b2f24,_0x4da00d){return db['ZendeskField'][_0xba1a('0x44')]({'where':{'id':_0x4b2f24['params']['id']}})[_0xba1a('0x21')](handleEntityNotFound(_0x4da00d,null))[_0xba1a('0x21')](removeEntity(_0x4da00d,null))['catch'](handleError(_0x4da00d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 753dfb6..aefb38d 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 _0x6b97=['exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b97,0x180));var _0x76b9=function(_0x1c50d3,_0x12c737){_0x1c50d3=_0x1c50d3-0x0;var _0x281903=_0x6b97[_0x1c50d3];return _0x281903;};'use strict';var _=require(_0x76b9('0x0'));var util=require('util');var logger=require(_0x76b9('0x1'))(_0x76b9('0x2'));var moment=require('moment');var BPromise=require(_0x76b9('0x3'));var rp=require(_0x76b9('0x4'));var fs=require('fs');var path=require(_0x76b9('0x5'));var rimraf=require('rimraf');var config=require(_0x76b9('0x6'));var attributes=require(_0x76b9('0x7'));module[_0x76b9('0x8')]=function(_0x1db558,_0x146caf){return _0x1db558[_0x76b9('0x9')](_0x76b9('0xa'),attributes,{'tableName':_0x76b9('0xb'),'paranoid':![],'indexes':[{'name':_0x76b9('0xc'),'fields':['idField',_0x76b9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8269=['zendesk_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x7fa96,_0x2546be){var _0x4fea46=function(_0x208cbf){while(--_0x208cbf){_0x7fa96['push'](_0x7fa96['shift']());}};_0x4fea46(++_0x2546be);}(_0x8269,0x1d0));var _0x9826=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x8269[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x9826('0x0'));var util=require('util');var logger=require(_0x9826('0x1'))(_0x9826('0x2'));var moment=require(_0x9826('0x3'));var BPromise=require(_0x9826('0x4'));var rp=require(_0x9826('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9826('0x6'));var attributes=require(_0x9826('0x7'));module[_0x9826('0x8')]=function(_0x35871d,_0x293e72){return _0x35871d[_0x9826('0x9')](_0x9826('0xa'),attributes,{'tableName':_0x9826('0xb'),'paranoid':![],'indexes':[{'name':_0x9826('0xc'),'fields':['idField',_0x9826('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 76c437c..dd30d75 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 _0x0186=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','ZendeskField,\x20%s,\x20%s','error','message','result','lodash','util','ioredis'];(function(_0x43f338,_0x348510){var _0x3ad4c8=function(_0x3d9991){while(--_0x3d9991){_0x43f338['push'](_0x43f338['shift']());}};_0x3ad4c8(++_0x348510);}(_0x0186,0x166));var _0x6018=function(_0xdee293,_0x400066){_0xdee293=_0xdee293-0x0;var _0x266875=_0x0186[_0xdee293];return _0x266875;};'use strict';var _=require(_0x6018('0x0'));var util=require(_0x6018('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6018('0x2'));var db=require(_0x6018('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6018('0x4'))(_0x6018('0x5'));var config=require(_0x6018('0x6'));var jayson=require(_0x6018('0x7'));var client=jayson[_0x6018('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x261102,_0xe52380,_0x431675){return new BPromise(function(_0x213644,_0x5eb36e){return client[_0x6018('0x9')](_0x261102,_0x431675)['then'](function(_0x44c120){logger['info']('ZendeskField,\x20%s,\x20%s',_0xe52380,_0x6018('0xa'));logger[_0x6018('0xb')](_0x6018('0xc'),_0xe52380,_0x6018('0xa'),JSON[_0x6018('0xd')](_0x44c120));if(_0x44c120['error']){if(_0x44c120['error'][_0x6018('0xe')]===0x1f4){logger['error'](_0x6018('0xf'),_0xe52380,_0x44c120[_0x6018('0x10')][_0x6018('0x11')]);return _0x5eb36e(_0x44c120['error'][_0x6018('0x11')]);}logger[_0x6018('0x10')]('ZendeskField,\x20%s,\x20%s',_0xe52380,_0x44c120['error'][_0x6018('0x11')]);return _0x213644(_0x44c120[_0x6018('0x10')][_0x6018('0x11')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0xe52380,'request\x20sent');_0x213644(_0x44c120[_0x6018('0x12')][_0x6018('0x11')]);}})['catch'](function(_0x1eea80){logger[_0x6018('0x10')]('ZendeskField,\x20%s,\x20%s',_0xe52380,_0x1eea80);_0x5eb36e(_0x1eea80);});});} \ No newline at end of file +var _0x3495=['jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x578b8d,_0x373450){var _0x5a53ee=function(_0x5dff31){while(--_0x5dff31){_0x578b8d['push'](_0x578b8d['shift']());}};_0x5a53ee(++_0x373450);}(_0x3495,0x147));var _0x5349=function(_0x21bdba,_0x21e1fc){_0x21bdba=_0x21bdba-0x0;var _0x40daff=_0x3495[_0x21bdba];return _0x40daff;};'use strict';var _=require('lodash');var util=require(_0x5349('0x0'));var moment=require(_0x5349('0x1'));var BPromise=require('bluebird');var rs=require(_0x5349('0x2'));var fs=require('fs');var Redis=require(_0x5349('0x3'));var db=require(_0x5349('0x4'))['db'];var utils=require(_0x5349('0x5'));var logger=require(_0x5349('0x6'))(_0x5349('0x7'));var config=require(_0x5349('0x8'));var jayson=require(_0x5349('0x9'));var client=jayson[_0x5349('0xa')][_0x5349('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14e517,_0x5b5b69,_0x59a7b5){return new BPromise(function(_0xd95307,_0x1a37b4){return client[_0x5349('0xc')](_0x14e517,_0x59a7b5)[_0x5349('0xd')](function(_0x58eb18){logger[_0x5349('0xe')](_0x5349('0xf'),_0x5b5b69,'request\x20sent');logger['debug'](_0x5349('0x10'),_0x5b5b69,_0x5349('0x11'),JSON[_0x5349('0x12')](_0x58eb18));if(_0x58eb18[_0x5349('0x13')]){if(_0x58eb18['error'][_0x5349('0x14')]===0x1f4){logger['error'](_0x5349('0xf'),_0x5b5b69,_0x58eb18[_0x5349('0x13')][_0x5349('0x15')]);return _0x1a37b4(_0x58eb18[_0x5349('0x13')]['message']);}logger[_0x5349('0x13')](_0x5349('0xf'),_0x5b5b69,_0x58eb18[_0x5349('0x13')][_0x5349('0x15')]);return _0xd95307(_0x58eb18['error'][_0x5349('0x15')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x5b5b69,_0x5349('0x11'));_0xd95307(_0x58eb18[_0x5349('0x16')][_0x5349('0x15')]);}})[_0x5349('0x17')](function(_0x4d7099){logger['error'](_0x5349('0xf'),_0x5b5b69,_0x4d7099);_0x1a37b4(_0x4d7099);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 7566bfa..b4849b1 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 _0xe970=['getFields','create','post','/:id/configurations','update','destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','/:id','show','/:id/fields'];(function(_0x2af504,_0x46a924){var _0x2abb2e=function(_0x53f705){while(--_0x53f705){_0x2af504['push'](_0x2af504['shift']());}};_0x2abb2e(++_0x46a924);}(_0xe970,0x15b));var _0x0e97=function(_0x2b78d9,_0x44cb44){_0x2b78d9=_0x2b78d9-0x0;var _0x502e43=_0xe970[_0x2b78d9];return _0x502e43;};'use strict';var multer=require(_0x0e97('0x0'));var util=require(_0x0e97('0x1'));var path=require(_0x0e97('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0e97('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0e97('0x4'));var config=require(_0x0e97('0x5'));var controller=require(_0x0e97('0x6'));router['get']('/',auth[_0x0e97('0x7')](),controller[_0x0e97('0x8')]);router[_0x0e97('0x9')](_0x0e97('0xa'),auth['isAuthenticated'](),controller[_0x0e97('0xb')]);router['get']('/:id/configurations',auth[_0x0e97('0x7')](),controller['getConfigurations']);router[_0x0e97('0x9')](_0x0e97('0xc'),auth['isAuthenticated'](),controller[_0x0e97('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e97('0xe')]);router[_0x0e97('0xf')](_0x0e97('0x10'),auth[_0x0e97('0x7')](),controller['addConfiguration']);router['put'](_0x0e97('0xa'),auth[_0x0e97('0x7')](),controller[_0x0e97('0x11')]);router['delete'](_0x0e97('0xa'),auth[_0x0e97('0x7')](),controller[_0x0e97('0x12')]);module[_0x0e97('0x13')]=router; \ No newline at end of file +var _0xaf97=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf97,0x1a7));var _0x7af9=function(_0x5b0456,_0x39bd8d){_0x5b0456=_0x5b0456-0x0;var _0x591a22=_0xaf97[_0x5b0456];return _0x591a22;};'use strict';var multer=require(_0x7af9('0x0'));var util=require(_0x7af9('0x1'));var path=require(_0x7af9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7af9('0x3'));var router=express[_0x7af9('0x4')]();var fs_extra=require(_0x7af9('0x5'));var auth=require(_0x7af9('0x6'));var interaction=require(_0x7af9('0x7'));var config=require(_0x7af9('0x8'));var controller=require(_0x7af9('0x9'));router[_0x7af9('0xa')]('/',auth['isAuthenticated'](),controller[_0x7af9('0xb')]);router[_0x7af9('0xa')](_0x7af9('0xc'),auth[_0x7af9('0xd')](),controller[_0x7af9('0xe')]);router[_0x7af9('0xa')](_0x7af9('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7af9('0xa')](_0x7af9('0x10'),auth[_0x7af9('0xd')](),controller[_0x7af9('0x11')]);router[_0x7af9('0x12')]('/',auth[_0x7af9('0xd')](),controller['create']);router[_0x7af9('0x12')]('/:id/configurations',auth[_0x7af9('0xd')](),controller[_0x7af9('0x13')]);router[_0x7af9('0x14')](_0x7af9('0xc'),auth['isAuthenticated'](),controller[_0x7af9('0x15')]);router[_0x7af9('0x16')](_0x7af9('0xc'),auth[_0x7af9('0xd')](),controller[_0x7af9('0x17')]);module[_0x7af9('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index bcb10fc..5d98572 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c4e=['sequelize','STRING'];(function(_0x53d402,_0x48e1fd){var _0x5b1a32=function(_0x2b89e8){while(--_0x2b89e8){_0x53d402['push'](_0x53d402['shift']());}};_0x5b1a32(++_0x48e1fd);}(_0x4c4e,0x152));var _0xe4c4=function(_0x8edcac,_0x27c54a){_0x8edcac=_0x8edcac-0x0;var _0x390e27=_0x4c4e[_0x8edcac];return _0x390e27;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4c4('0x1')]},'description':{'type':Sequelize[_0xe4c4('0x1')]},'host':{'type':Sequelize[_0xe4c4('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe4c4('0x1')]},'clientSecret':{'type':Sequelize[_0xe4c4('0x1')]},'serverUrl':{'type':Sequelize[_0xe4c4('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xe4c4('0x1')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING'];(function(_0x466aeb,_0x3a35bf){var _0x57818e=function(_0x28ac49){while(--_0x28ac49){_0x466aeb['push'](_0x466aeb['shift']());}};_0x57818e(++_0x3a35bf);}(_0x34e8,0x12c));var _0x834e=function(_0x3c8370,_0x23f6c4){_0x3c8370=_0x3c8370-0x0;var _0x5bc64e=_0x34e8[_0x3c8370];return _0x5bc64e;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'description':{'type':Sequelize[_0x834e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x834e('0x2')]},'clientId':{'type':Sequelize[_0x834e('0x2')]},'clientSecret':{'type':Sequelize[_0x834e('0x2')]},'serverUrl':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x834e('0x2')]},'refreshToken':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ec91971..c9c3352 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 _0xbb0a=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','pick','filters','filter','where','merge','VIRTUAL','ZohoAccount','includeAll','findAll','rows','show','params','length','options','find','catch','create','body','destroy','findOne','keys','ZohoConfiguration','order','getConfigurations','AccountId','Subjects','getSubjects','channel','type','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','zoho.eu','slice','substring','lastIndexOf','GET','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0xbb0a,0x16c));var _0xabb0=function(_0x3c4a87,_0x1c03fe){_0x3c4a87=_0x3c4a87-0x0;var _0x21650a=_0xbb0a[_0x3c4a87];return _0x21650a;};'use strict';var emlformat=require(_0xabb0('0x0'));var rimraf=require(_0xabb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xabb0('0x2'));var BPromise=require(_0xabb0('0x3'));var Mustache=require(_0xabb0('0x4'));var util=require('util');var path=require(_0xabb0('0x5'));var sox=require(_0xabb0('0x6'));var csv=require('to-csv');var ejs=require(_0xabb0('0x7'));var fs=require('fs');var fs_extra=require(_0xabb0('0x8'));var _=require(_0xabb0('0x9'));var squel=require(_0xabb0('0xa'));var crypto=require(_0xabb0('0xb'));var jsforce=require(_0xabb0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xabb0('0xd'));var querystring=require(_0xabb0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabb0('0xf'));var authService=require(_0xabb0('0x10'));var qs=require(_0xabb0('0x11'));var as=require(_0xabb0('0x12'));var hardwareService=require(_0xabb0('0x13'));var logger=require(_0xabb0('0x14'))(_0xabb0('0x15'));var utils=require(_0xabb0('0x16'));var config=require(_0xabb0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xabb0('0x18'))['db'];var integrations=require(_0xabb0('0x19'));function respondWithStatusCode(_0x2bb7b6,_0x43cd63){_0x43cd63=_0x43cd63||0xcc;return function(_0xc01909){if(_0xc01909){return _0x2bb7b6[_0xabb0('0x1a')](_0x43cd63);}return _0x2bb7b6[_0xabb0('0x1b')](_0x43cd63)[_0xabb0('0x1c')]();};}function respondWithResult(_0x245d06,_0x1d1fc7){_0x1d1fc7=_0x1d1fc7||0xc8;return function(_0x5bb11b){if(_0x5bb11b){return _0x245d06[_0xabb0('0x1b')](_0x1d1fc7)[_0xabb0('0x1d')](_0x5bb11b);}};}function respondWithFilteredResult(_0x5e8eaa,_0x1961ac){return function(_0x52124d){if(_0x52124d){var _0x2de037=typeof _0x1961ac[_0xabb0('0x1e')]==='undefined'&&typeof _0x1961ac['limit']==='undefined';var _0x5d6f82=_0x52124d[_0xabb0('0x1f')];var _0x4b3505=_0x2de037?0x0:_0x1961ac[_0xabb0('0x1e')];var _0x3a7641=_0x2de037?_0x52124d[_0xabb0('0x1f')]:_0x1961ac['offset']+_0x1961ac['limit'];var _0x4bf0e4;if(_0x3a7641>=_0x5d6f82){_0x3a7641=_0x5d6f82;_0x4bf0e4=0xc8;}else{_0x4bf0e4=0xce;}_0x5e8eaa[_0xabb0('0x1b')](_0x4bf0e4);return _0x5e8eaa[_0xabb0('0x20')]('Content-Range',_0x4b3505+'-'+_0x3a7641+'/'+_0x5d6f82)[_0xabb0('0x1d')](_0x52124d);}return null;};}function patchUpdates(_0x33957d){return function(_0x176cab){try{jsonpatch[_0xabb0('0x21')](_0x176cab,_0x33957d,!![]);}catch(_0x3fd315){return BPromise[_0xabb0('0x22')](_0x3fd315);}return _0x176cab[_0xabb0('0x23')]();};}function saveUpdates(_0x185292,_0x296c67){return function(_0x168cf3){if(_0x168cf3){return _0x168cf3[_0xabb0('0x24')](_0x185292)[_0xabb0('0x25')](function(_0x1b491d){return _0x1b491d;});}return null;};}function removeEntity(_0x31bb15,_0x22a131){return function(_0x228c4a){if(_0x228c4a){return _0x228c4a['destroy']()[_0xabb0('0x25')](function(){_0x31bb15['status'](0xcc)[_0xabb0('0x1c')]();});}};}function handleEntityNotFound(_0x2863af,_0x26f2d0){return function(_0x56d296){if(!_0x56d296){_0x2863af[_0xabb0('0x1a')](0x194);}return _0x56d296;};}function handleError(_0x53feb3,_0x281d6e){_0x281d6e=_0x281d6e||0x1f4;return function(_0x54a5be){logger[_0xabb0('0x26')](_0x54a5be[_0xabb0('0x27')]);if(_0x54a5be[_0xabb0('0x28')]){delete _0x54a5be['name'];}_0x53feb3[_0xabb0('0x1b')](_0x281d6e)['send'](_0x54a5be);};}exports[_0xabb0('0x29')]=function(_0x42aedf,_0x4bf261){var _0x286232={},_0x4a0f96={},_0x1d9c5b={'count':0x0,'rows':[]};var _0x5412bf=_[_0xabb0('0x2a')](db['ZohoAccount'][_0xabb0('0x2b')],function(_0x5e12fa){return{'name':_0x5e12fa[_0xabb0('0x2c')],'type':_0x5e12fa['type']['key']};});_0x4a0f96[_0xabb0('0x2d')]=_[_0xabb0('0x2a')](_0x5412bf,_0xabb0('0x28'));_0x4a0f96[_0xabb0('0x2e')]=_['keys'](_0x42aedf[_0xabb0('0x2e')]);_0x4a0f96['filters']=_[_0xabb0('0x2f')](_0x4a0f96[_0xabb0('0x2d')],_0x4a0f96[_0xabb0('0x2e')]);_0x286232['attributes']=_[_0xabb0('0x2f')](_0x4a0f96[_0xabb0('0x2d')],qs[_0xabb0('0x30')](_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x30')]));_0x286232[_0xabb0('0x31')]=_0x286232[_0xabb0('0x31')]['length']?_0x286232['attributes']:_0x4a0f96[_0xabb0('0x2d')];if(!_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x32')](_0xabb0('0x33'))){_0x286232[_0xabb0('0x34')]=qs[_0xabb0('0x34')](_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x34')]);_0x286232[_0xabb0('0x1e')]=qs[_0xabb0('0x1e')](_0x42aedf[_0xabb0('0x2e')]['offset']);}_0x286232['order']=qs[_0xabb0('0x35')](_0x42aedf[_0xabb0('0x2e')]['sort']);_0x286232['where']=qs['filters'](_[_0xabb0('0x36')](_0x42aedf[_0xabb0('0x2e')],_0x4a0f96[_0xabb0('0x37')]),_0x5412bf);if(_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x38')]){_0x286232[_0xabb0('0x39')]=_[_0xabb0('0x3a')](_0x286232[_0xabb0('0x39')],{'$or':_[_0xabb0('0x2a')](_0x5412bf,function(_0x711105){if(_0x711105['type']!==_0xabb0('0x3b')){var _0x1c796f={};_0x1c796f[_0x711105['name']]={'$like':'%'+_0x42aedf['query'][_0xabb0('0x38')]+'%'};return _0x1c796f;}})});}_0x286232=_['merge']({},_0x286232,_0x42aedf['options']);var _0xa277d7={'where':_0x286232['where']};return db[_0xabb0('0x3c')]['count'](_0xa277d7)[_0xabb0('0x25')](function(_0x26a244){_0x1d9c5b[_0xabb0('0x1f')]=_0x26a244;if(_0x42aedf[_0xabb0('0x2e')][_0xabb0('0x3d')]){_0x286232['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xabb0('0x3e')](_0x286232);})[_0xabb0('0x25')](function(_0x128dc1){_0x1d9c5b[_0xabb0('0x3f')]=_0x128dc1;return _0x1d9c5b;})['then'](respondWithFilteredResult(_0x4bf261,_0x286232))['catch'](handleError(_0x4bf261,null));};exports[_0xabb0('0x40')]=function(_0x2da64d,_0x15861b){var _0x407534={'raw':![],'where':{'id':_0x2da64d[_0xabb0('0x41')]['id']}},_0x5892cb={};_0x5892cb[_0xabb0('0x2d')]=_['keys'](db[_0xabb0('0x3c')][_0xabb0('0x2b')]);_0x5892cb[_0xabb0('0x2e')]=_['keys'](_0x2da64d['query']);_0x5892cb['filters']=_[_0xabb0('0x2f')](_0x5892cb[_0xabb0('0x2d')],_0x5892cb['query']);_0x407534[_0xabb0('0x31')]=_[_0xabb0('0x2f')](_0x5892cb['model'],qs[_0xabb0('0x30')](_0x2da64d[_0xabb0('0x2e')]['fields']));_0x407534[_0xabb0('0x31')]=_0x407534[_0xabb0('0x31')][_0xabb0('0x42')]?_0x407534['attributes']:_0x5892cb[_0xabb0('0x2d')];if(_0x2da64d[_0xabb0('0x2e')][_0xabb0('0x3d')]){_0x407534['include']=[{'all':!![]}];}_0x407534=_['merge']({},_0x407534,_0x2da64d[_0xabb0('0x43')]);return db['ZohoAccount'][_0xabb0('0x44')](_0x407534)[_0xabb0('0x25')](handleEntityNotFound(_0x15861b,null))[_0xabb0('0x25')](respondWithResult(_0x15861b,null))[_0xabb0('0x45')](handleError(_0x15861b,null));};exports[_0xabb0('0x46')]=function(_0x2aa5e9,_0x36218b){return db[_0xabb0('0x3c')][_0xabb0('0x46')](_0x2aa5e9['body'],{})[_0xabb0('0x25')](respondWithResult(_0x36218b,0xc9))[_0xabb0('0x45')](handleError(_0x36218b,null));};exports[_0xabb0('0x24')]=function(_0x10739c,_0x7f8aed){if(_0x10739c[_0xabb0('0x47')]['id']){delete _0x10739c[_0xabb0('0x47')]['id'];}return db['ZohoAccount'][_0xabb0('0x44')]({'where':{'id':_0x10739c[_0xabb0('0x41')]['id']}})['then'](handleEntityNotFound(_0x7f8aed,null))[_0xabb0('0x25')](saveUpdates(_0x10739c[_0xabb0('0x47')],null))[_0xabb0('0x25')](respondWithResult(_0x7f8aed,null))[_0xabb0('0x45')](handleError(_0x7f8aed,null));};exports[_0xabb0('0x48')]=function(_0x4a3775,_0x105cc7){return db[_0xabb0('0x3c')]['find']({'where':{'id':_0x4a3775[_0xabb0('0x41')]['id']}})['then'](handleEntityNotFound(_0x105cc7,null))[_0xabb0('0x25')](removeEntity(_0x105cc7,null))[_0xabb0('0x45')](handleError(_0x105cc7,null));};exports['getConfigurations']=function(_0x3b1a6b,_0x2aaed6,_0x5cd986){var _0x407675={};var _0x2536e6={};var _0x479248;var _0x29c244;return db[_0xabb0('0x3c')][_0xabb0('0x49')]({'where':{'id':_0x3b1a6b[_0xabb0('0x41')]['id']}})[_0xabb0('0x25')](handleEntityNotFound(_0x2aaed6,null))[_0xabb0('0x25')](function(_0x7d0f24){if(_0x7d0f24){_0x479248=_0x7d0f24;_0x2536e6[_0xabb0('0x2d')]=_[_0xabb0('0x4a')](db[_0xabb0('0x4b')]['rawAttributes']);_0x2536e6[_0xabb0('0x2e')]=_[_0xabb0('0x4a')](_0x3b1a6b[_0xabb0('0x2e')]);_0x2536e6['filters']=_[_0xabb0('0x2f')](_0x2536e6[_0xabb0('0x2d')],_0x2536e6['query']);_0x407675[_0xabb0('0x31')]=_[_0xabb0('0x2f')](_0x2536e6[_0xabb0('0x2d')],qs['fields'](_0x3b1a6b[_0xabb0('0x2e')]['fields']));_0x407675[_0xabb0('0x31')]=_0x407675[_0xabb0('0x31')][_0xabb0('0x42')]?_0x407675[_0xabb0('0x31')]:_0x2536e6['model'];_0x407675[_0xabb0('0x4c')]=qs[_0xabb0('0x35')](_0x3b1a6b[_0xabb0('0x2e')][_0xabb0('0x35')]);_0x407675[_0xabb0('0x39')]=qs[_0xabb0('0x37')](_['pick'](_0x3b1a6b[_0xabb0('0x2e')],_0x2536e6[_0xabb0('0x37')]));if(_0x3b1a6b['query'][_0xabb0('0x38')]){_0x407675[_0xabb0('0x39')]=_[_0xabb0('0x3a')](_0x407675['where'],{'$or':_[_0xabb0('0x2a')](_0x407675['attributes'],function(_0x261802){var _0x3b0f4e={};_0x3b0f4e[_0x261802]={'$like':'%'+_0x3b1a6b['query'][_0xabb0('0x38')]+'%'};return _0x3b0f4e;})});}_0x407675=_['merge']({},_0x407675,_0x3b1a6b['options']);return _0x479248[_0xabb0('0x4d')](_0x407675);}})[_0xabb0('0x25')](function(_0x44f1d0){if(_0x44f1d0){_0x29c244=_0x44f1d0['length'];if(!_0x3b1a6b[_0xabb0('0x2e')][_0xabb0('0x32')](_0xabb0('0x33'))){_0x407675['limit']=qs[_0xabb0('0x34')](_0x3b1a6b[_0xabb0('0x2e')]['limit']);_0x407675[_0xabb0('0x1e')]=qs[_0xabb0('0x1e')](_0x3b1a6b[_0xabb0('0x2e')][_0xabb0('0x1e')]);}return _0x479248['getConfigurations'](_0x407675);}})[_0xabb0('0x25')](function(_0x3fc293){if(_0x3fc293){return _0x3fc293?{'count':_0x29c244,'rows':_0x3fc293}:null;}})[_0xabb0('0x25')](respondWithResult(_0x2aaed6,null))['catch'](handleError(_0x2aaed6,null));};exports['addConfiguration']=function(_0x1aaf94,_0x59d4fc,_0x498392){if(_0x1aaf94[_0xabb0('0x47')]['id']){delete _0x1aaf94[_0xabb0('0x47')]['id'];}return db[_0xabb0('0x3c')][_0xabb0('0x49')]({'where':{'id':_0x1aaf94[_0xabb0('0x41')]['id']}})[_0xabb0('0x25')](handleEntityNotFound(_0x59d4fc,null))['then'](function(_0x2d7dc9){if(_0x2d7dc9){_0x1aaf94[_0xabb0('0x47')][_0xabb0('0x4e')]=_0x2d7dc9['id'];_0x1aaf94[_0xabb0('0x47')][_0xabb0('0x4f')]=integrations[_0xabb0('0x50')](_0x1aaf94['body'][_0xabb0('0x51')],_0x1aaf94['body'][_0xabb0('0x52')]);_0x1aaf94[_0xabb0('0x47')][_0xabb0('0x53')]=integrations['getDescriptions'](_0x1aaf94[_0xabb0('0x47')][_0xabb0('0x51')],_0x1aaf94['body'][_0xabb0('0x52')]);return db[_0xabb0('0x4b')]['create'](_0x1aaf94[_0xabb0('0x47')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xabb0('0x54')],'as':_0xabb0('0x53')}]});}return null;})[_0xabb0('0x25')](respondWithResult(_0x59d4fc,null))[_0xabb0('0x45')](handleError(_0x59d4fc,null));};function getAccessToken(_0x522942){return new Promise(function(_0x2218c3,_0x530bfc){var _0x38d063;switch(_0x522942['zone']){case'US':_0x38d063=_0xabb0('0x55');break;case'AU':_0x38d063=_0xabb0('0x56');break;case'EU':_0x38d063=_0xabb0('0x57');break;case'IN':_0x38d063=_0xabb0('0x58');break;case'CN':_0x38d063=_0xabb0('0x59');break;default:_0x38d063=_0xabb0('0x57');break;}var _0x23591b={'method':_0xabb0('0x5a'),'uri':_0x38d063+_0xabb0('0x5b'),'qs':{'refresh_token':_0x522942[_0xabb0('0x5c')],'client_id':_0x522942[_0xabb0('0x5d')],'client_secret':_0x522942[_0xabb0('0x5e')],'grant_type':_0xabb0('0x5f')},'json':!![]};return rp(_0x23591b)['then'](function(_0x4f12a1){if(_0x4f12a1[_0xabb0('0x60')]){_0x2218c3(_0x4f12a1[_0xabb0('0x60')]);}else{_0x530bfc('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x39f3d5){_0x530bfc(_0x39f3d5);});});}exports[_0xabb0('0x61')]=function(_0x3753de,_0x335ae4,_0x1a6c13){var _0x274195,_0x524351,_0x5e2383,_0x480cf3,_0x486790;return db[_0xabb0('0x3c')]['findOne']({'where':{'id':_0x3753de[_0xabb0('0x41')]['id']},'attributes':['id',_0xabb0('0x62'),_0xabb0('0x63'),_0xabb0('0x5d'),_0xabb0('0x5e'),_0xabb0('0x64'),'code',_0xabb0('0x5c')]})[_0xabb0('0x25')](handleEntityNotFound(_0x335ae4,null))[_0xabb0('0x25')](function(_0x53d524){_0x486790=_0x53d524;_0x274195=_0x486790[_0xabb0('0x62')];_0x524351=_0x274195===_0xabb0('0x65')?'eu':'com';_0x5e2383=_0x486790[_0xabb0('0x64')];var _0x12b142=_0x5e2383[_0xabb0('0x66')](-0x1);if(_0x12b142==='/'||_0x12b142==='\x5c'||_0x12b142===':'){_0x5e2383=_0x5e2383[_0xabb0('0x67')](0x0,_0x5e2383[_0xabb0('0x68')](_0x12b142));}if(!_0x486790['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x486790);})[_0xabb0('0x25')](function(_0xd4cc89){if(_0xd4cc89){return rp({'method':_0xabb0('0x69'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x524351),'qs':{'module':'Calls'},'headers':{'Authorization':_0xabb0('0x6a')+_0xd4cc89},'json':!![]});}})['then'](function(_0xed756d){if(_0xed756d){if(_0xed756d['response']&&_0xed756d[_0xabb0('0x6b')][_0xabb0('0x26')]){throw new Error(_0xed756d[_0xabb0('0x6b')]['error'][_0xabb0('0x6c')]);}var _0x25731a=[];var _0x3db11a=[];var _0x5334da=[_0xabb0('0x6d'),_0xabb0('0x6e'),_0xabb0('0x6f'),_0xabb0('0x70'),_0xabb0('0x71'),_0xabb0('0x72'),'Call_Start_Time',_0xabb0('0x73')];_0x3db11a=_['remove'](_0xed756d['fields'],function(_0x3dbc65){return _0x5334da[_0xabb0('0x74')](_0x3dbc65['api_name']);});for(var _0x2b55a5=0x0;_0x2b55a5<_0x3db11a[_0xabb0('0x42')];_0x2b55a5++){if(_0x3db11a[_0x2b55a5]['system_mandatory']===![]){_0x25731a['push']({'id':_0x3db11a[_0x2b55a5]['id'],'name':_0x3db11a[_0x2b55a5]['display_label'],'custom':_0x3db11a[_0x2b55a5][_0xabb0('0x75')],'options':_0x3db11a[_0x2b55a5][_0xabb0('0x76')]===_0xabb0('0x77')&&_0x3db11a[_0x2b55a5][_0xabb0('0x78')][_0xabb0('0x42')]>-0x1?_[_0xabb0('0x2a')](_0x3db11a[_0x2b55a5]['pick_list_values'],function(_0x23e2a8){return{'name':_0x23e2a8,'value':_0x23e2a8};}):[]});}}return{'count':_0x25731a[_0xabb0('0x42')],'rows':_0x25731a};}else{return{'count':0x0,'rows':[]};}})[_0xabb0('0x25')](respondWithResult(_0x335ae4,null))['catch'](function(_0x4b568c){var _0x1c24a8=_0x3753de['query'][_0xabb0('0x79')]?0x1f4:_0x4b568c[_0xabb0('0x7a')]||0x1f4;logger[_0xabb0('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xabb0('0x61'),_0x1c24a8,JSON[_0xabb0('0x7b')](_0x4b568c));delete _0x4b568c['name'];if(_0x1c24a8===0x191){_0x1c24a8=0x190;}_0x335ae4[_0xabb0('0x1b')](_0x1c24a8)[_0xabb0('0x7c')](_0x3753de[_0xabb0('0x2e')][_0xabb0('0x79')]?{'message':_0xabb0('0x7d'),'statusCode':_0x4b568c['statusCode']}:_0x4b568c);});}; \ No newline at end of file +var _0x576b=['find','create','body','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','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','host','zone','serverUrl','code','refreshToken','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','ZohoAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','params','options'];(function(_0x144fd2,_0x1b9368){var _0x3453bc=function(_0x1c2c8f){while(--_0x1c2c8f){_0x144fd2['push'](_0x144fd2['shift']());}};_0x3453bc(++_0x1b9368);}(_0x576b,0x1b0));var _0xb576=function(_0x4ff36d,_0xf34292){_0x4ff36d=_0x4ff36d-0x0;var _0xec825=_0x576b[_0x4ff36d];return _0xec825;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb576('0x0'));var zipdir=require(_0xb576('0x1'));var jsonpatch=require(_0xb576('0x2'));var rp=require(_0xb576('0x3'));var moment=require(_0xb576('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb576('0x5'));var util=require('util');var path=require(_0xb576('0x6'));var sox=require(_0xb576('0x7'));var csv=require('to-csv');var ejs=require(_0xb576('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb576('0x9'));var squel=require(_0xb576('0xa'));var crypto=require(_0xb576('0xb'));var jsforce=require(_0xb576('0xc'));var deskjs=require(_0xb576('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb576('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb576('0xf'));var as=require(_0xb576('0x10'));var hardwareService=require(_0xb576('0x11'));var logger=require('../../config/logger')(_0xb576('0x12'));var utils=require('../../config/utils');var config=require(_0xb576('0x13'));var licenseUtil=require(_0xb576('0x14'));var db=require(_0xb576('0x15'))['db'];var integrations=require(_0xb576('0x16'));function respondWithStatusCode(_0x176264,_0x3b439f){_0x3b439f=_0x3b439f||0xcc;return function(_0x2cd96f){if(_0x2cd96f){return _0x176264[_0xb576('0x17')](_0x3b439f);}return _0x176264['status'](_0x3b439f)['end']();};}function respondWithResult(_0x5e5757,_0x530e24){_0x530e24=_0x530e24||0xc8;return function(_0x427ec9){if(_0x427ec9){return _0x5e5757[_0xb576('0x18')](_0x530e24)[_0xb576('0x19')](_0x427ec9);}};}function respondWithFilteredResult(_0x1fe638,_0x538622){return function(_0x27701c){if(_0x27701c){var _0x48b3d7=typeof _0x538622[_0xb576('0x1a')]==='undefined'&&typeof _0x538622[_0xb576('0x1b')]===_0xb576('0x1c');var _0x40bed8=_0x27701c[_0xb576('0x1d')];var _0x88a705=_0x48b3d7?0x0:_0x538622[_0xb576('0x1a')];var _0x7222da=_0x48b3d7?_0x27701c[_0xb576('0x1d')]:_0x538622[_0xb576('0x1a')]+_0x538622[_0xb576('0x1b')];var _0x854066;if(_0x7222da>=_0x40bed8){_0x7222da=_0x40bed8;_0x854066=0xc8;}else{_0x854066=0xce;}_0x1fe638[_0xb576('0x18')](_0x854066);return _0x1fe638[_0xb576('0x1e')](_0xb576('0x1f'),_0x88a705+'-'+_0x7222da+'/'+_0x40bed8)[_0xb576('0x19')](_0x27701c);}return null;};}function patchUpdates(_0x4c8516){return function(_0x47bb6a){try{jsonpatch[_0xb576('0x20')](_0x47bb6a,_0x4c8516,!![]);}catch(_0x445903){return BPromise[_0xb576('0x21')](_0x445903);}return _0x47bb6a[_0xb576('0x22')]();};}function saveUpdates(_0x317461,_0x1cdd41){return function(_0x173d30){if(_0x173d30){return _0x173d30[_0xb576('0x23')](_0x317461)[_0xb576('0x24')](function(_0x223c32){return _0x223c32;});}return null;};}function removeEntity(_0x48b9d3,_0x583ed8){return function(_0x5d51bf){if(_0x5d51bf){return _0x5d51bf[_0xb576('0x25')]()['then'](function(){_0x48b9d3['status'](0xcc)[_0xb576('0x26')]();});}};}function handleEntityNotFound(_0xcf0dc,_0x30e3ff){return function(_0x179848){if(!_0x179848){_0xcf0dc[_0xb576('0x17')](0x194);}return _0x179848;};}function handleError(_0x32ea0c,_0x6e8830){_0x6e8830=_0x6e8830||0x1f4;return function(_0x18c2ac){logger[_0xb576('0x27')](_0x18c2ac['stack']);if(_0x18c2ac[_0xb576('0x28')]){delete _0x18c2ac[_0xb576('0x28')];}_0x32ea0c[_0xb576('0x18')](_0x6e8830)['send'](_0x18c2ac);};}exports[_0xb576('0x29')]=function(_0x54ad79,_0x33bd17){var _0x34b618={},_0x2d39bc={},_0x5f4ad8={'count':0x0,'rows':[]};var _0x3d6972=_[_0xb576('0x2a')](db[_0xb576('0x2b')][_0xb576('0x2c')],function(_0x82013d){return{'name':_0x82013d['fieldName'],'type':_0x82013d[_0xb576('0x2d')]['key']};});_0x2d39bc[_0xb576('0x2e')]=_[_0xb576('0x2a')](_0x3d6972,_0xb576('0x28'));_0x2d39bc[_0xb576('0x2f')]=_[_0xb576('0x30')](_0x54ad79[_0xb576('0x2f')]);_0x2d39bc[_0xb576('0x31')]=_[_0xb576('0x32')](_0x2d39bc['model'],_0x2d39bc[_0xb576('0x2f')]);_0x34b618[_0xb576('0x33')]=_[_0xb576('0x32')](_0x2d39bc[_0xb576('0x2e')],qs[_0xb576('0x34')](_0x54ad79[_0xb576('0x2f')][_0xb576('0x34')]));_0x34b618[_0xb576('0x33')]=_0x34b618[_0xb576('0x33')][_0xb576('0x35')]?_0x34b618['attributes']:_0x2d39bc[_0xb576('0x2e')];if(!_0x54ad79[_0xb576('0x2f')][_0xb576('0x36')]('nolimit')){_0x34b618[_0xb576('0x1b')]=qs['limit'](_0x54ad79[_0xb576('0x2f')][_0xb576('0x1b')]);_0x34b618[_0xb576('0x1a')]=qs[_0xb576('0x1a')](_0x54ad79['query'][_0xb576('0x1a')]);}_0x34b618[_0xb576('0x37')]=qs[_0xb576('0x38')](_0x54ad79[_0xb576('0x2f')]['sort']);_0x34b618[_0xb576('0x39')]=qs['filters'](_[_0xb576('0x3a')](_0x54ad79['query'],_0x2d39bc[_0xb576('0x31')]),_0x3d6972);if(_0x54ad79[_0xb576('0x2f')][_0xb576('0x3b')]){_0x34b618['where']=_['merge'](_0x34b618[_0xb576('0x39')],{'$or':_[_0xb576('0x2a')](_0x3d6972,function(_0x14b846){if(_0x14b846[_0xb576('0x2d')]!==_0xb576('0x3c')){var _0xbf70b2={};_0xbf70b2[_0x14b846[_0xb576('0x28')]]={'$like':'%'+_0x54ad79[_0xb576('0x2f')][_0xb576('0x3b')]+'%'};return _0xbf70b2;}})});}_0x34b618=_[_0xb576('0x3d')]({},_0x34b618,_0x54ad79['options']);var _0x2f1c26={'where':_0x34b618[_0xb576('0x39')]};return db[_0xb576('0x2b')][_0xb576('0x1d')](_0x2f1c26)[_0xb576('0x24')](function(_0x36a730){_0x5f4ad8['count']=_0x36a730;if(_0x54ad79[_0xb576('0x2f')][_0xb576('0x3e')]){_0x34b618[_0xb576('0x3f')]=[{'all':!![]}];}return db[_0xb576('0x2b')][_0xb576('0x40')](_0x34b618);})[_0xb576('0x24')](function(_0x4da75b){_0x5f4ad8['rows']=_0x4da75b;return _0x5f4ad8;})[_0xb576('0x24')](respondWithFilteredResult(_0x33bd17,_0x34b618))[_0xb576('0x41')](handleError(_0x33bd17,null));};exports['show']=function(_0x13c74c,_0x4eb566){var _0x1ed7f4={'raw':![],'where':{'id':_0x13c74c[_0xb576('0x42')]['id']}},_0x5b1d7d={};_0x5b1d7d[_0xb576('0x2e')]=_['keys'](db[_0xb576('0x2b')][_0xb576('0x2c')]);_0x5b1d7d[_0xb576('0x2f')]=_['keys'](_0x13c74c[_0xb576('0x2f')]);_0x5b1d7d[_0xb576('0x31')]=_[_0xb576('0x32')](_0x5b1d7d[_0xb576('0x2e')],_0x5b1d7d[_0xb576('0x2f')]);_0x1ed7f4[_0xb576('0x33')]=_[_0xb576('0x32')](_0x5b1d7d[_0xb576('0x2e')],qs[_0xb576('0x34')](_0x13c74c[_0xb576('0x2f')][_0xb576('0x34')]));_0x1ed7f4[_0xb576('0x33')]=_0x1ed7f4['attributes']['length']?_0x1ed7f4['attributes']:_0x5b1d7d[_0xb576('0x2e')];if(_0x13c74c['query'][_0xb576('0x3e')]){_0x1ed7f4[_0xb576('0x3f')]=[{'all':!![]}];}_0x1ed7f4=_[_0xb576('0x3d')]({},_0x1ed7f4,_0x13c74c[_0xb576('0x43')]);return db[_0xb576('0x2b')][_0xb576('0x44')](_0x1ed7f4)[_0xb576('0x24')](handleEntityNotFound(_0x4eb566,null))[_0xb576('0x24')](respondWithResult(_0x4eb566,null))[_0xb576('0x41')](handleError(_0x4eb566,null));};exports[_0xb576('0x45')]=function(_0x38e1f4,_0x1072dc){return db[_0xb576('0x2b')][_0xb576('0x45')](_0x38e1f4[_0xb576('0x46')],{})['then'](respondWithResult(_0x1072dc,0xc9))['catch'](handleError(_0x1072dc,null));};exports['update']=function(_0x5a1996,_0x43095a){if(_0x5a1996[_0xb576('0x46')]['id']){delete _0x5a1996[_0xb576('0x46')]['id'];}return db['ZohoAccount'][_0xb576('0x44')]({'where':{'id':_0x5a1996[_0xb576('0x42')]['id']}})[_0xb576('0x24')](handleEntityNotFound(_0x43095a,null))['then'](saveUpdates(_0x5a1996[_0xb576('0x46')],null))[_0xb576('0x24')](respondWithResult(_0x43095a,null))[_0xb576('0x41')](handleError(_0x43095a,null));};exports[_0xb576('0x25')]=function(_0x6f75e3,_0x6754ab){return db[_0xb576('0x2b')][_0xb576('0x44')]({'where':{'id':_0x6f75e3[_0xb576('0x42')]['id']}})[_0xb576('0x24')](handleEntityNotFound(_0x6754ab,null))['then'](removeEntity(_0x6754ab,null))[_0xb576('0x41')](handleError(_0x6754ab,null));};exports[_0xb576('0x47')]=function(_0xb67484,_0x57477f,_0x160166){var _0x56be0e={};var _0x5f483b={};var _0x45e5d3;var _0x46c5bc;return db['ZohoAccount'][_0xb576('0x48')]({'where':{'id':_0xb67484[_0xb576('0x42')]['id']}})[_0xb576('0x24')](handleEntityNotFound(_0x57477f,null))[_0xb576('0x24')](function(_0xe67afa){if(_0xe67afa){_0x45e5d3=_0xe67afa;_0x5f483b['model']=_[_0xb576('0x30')](db[_0xb576('0x49')][_0xb576('0x2c')]);_0x5f483b[_0xb576('0x2f')]=_[_0xb576('0x30')](_0xb67484[_0xb576('0x2f')]);_0x5f483b[_0xb576('0x31')]=_[_0xb576('0x32')](_0x5f483b[_0xb576('0x2e')],_0x5f483b[_0xb576('0x2f')]);_0x56be0e[_0xb576('0x33')]=_['intersection'](_0x5f483b[_0xb576('0x2e')],qs[_0xb576('0x34')](_0xb67484[_0xb576('0x2f')][_0xb576('0x34')]));_0x56be0e[_0xb576('0x33')]=_0x56be0e['attributes']['length']?_0x56be0e[_0xb576('0x33')]:_0x5f483b[_0xb576('0x2e')];_0x56be0e[_0xb576('0x37')]=qs[_0xb576('0x38')](_0xb67484[_0xb576('0x2f')]['sort']);_0x56be0e[_0xb576('0x39')]=qs[_0xb576('0x31')](_[_0xb576('0x3a')](_0xb67484[_0xb576('0x2f')],_0x5f483b[_0xb576('0x31')]));if(_0xb67484[_0xb576('0x2f')][_0xb576('0x3b')]){_0x56be0e[_0xb576('0x39')]=_[_0xb576('0x3d')](_0x56be0e[_0xb576('0x39')],{'$or':_[_0xb576('0x2a')](_0x56be0e['attributes'],function(_0x1236f3){var _0x5e223b={};_0x5e223b[_0x1236f3]={'$like':'%'+_0xb67484['query']['filter']+'%'};return _0x5e223b;})});}_0x56be0e=_[_0xb576('0x3d')]({},_0x56be0e,_0xb67484[_0xb576('0x43')]);return _0x45e5d3[_0xb576('0x47')](_0x56be0e);}})[_0xb576('0x24')](function(_0x372f1b){if(_0x372f1b){_0x46c5bc=_0x372f1b[_0xb576('0x35')];if(!_0xb67484['query'][_0xb576('0x36')](_0xb576('0x4a'))){_0x56be0e[_0xb576('0x1b')]=qs['limit'](_0xb67484[_0xb576('0x2f')][_0xb576('0x1b')]);_0x56be0e[_0xb576('0x1a')]=qs[_0xb576('0x1a')](_0xb67484[_0xb576('0x2f')][_0xb576('0x1a')]);}return _0x45e5d3[_0xb576('0x47')](_0x56be0e);}})[_0xb576('0x24')](function(_0x5016ff){if(_0x5016ff){return _0x5016ff?{'count':_0x46c5bc,'rows':_0x5016ff}:null;}})['then'](respondWithResult(_0x57477f,null))[_0xb576('0x41')](handleError(_0x57477f,null));};exports[_0xb576('0x4b')]=function(_0x152f21,_0x49fe54,_0x2ee006){if(_0x152f21['body']['id']){delete _0x152f21['body']['id'];}return db[_0xb576('0x2b')][_0xb576('0x48')]({'where':{'id':_0x152f21[_0xb576('0x42')]['id']}})[_0xb576('0x24')](handleEntityNotFound(_0x49fe54,null))[_0xb576('0x24')](function(_0x23d273){if(_0x23d273){_0x152f21[_0xb576('0x46')][_0xb576('0x4c')]=_0x23d273['id'];_0x152f21['body'][_0xb576('0x4d')]=integrations[_0xb576('0x4e')](_0x152f21[_0xb576('0x46')][_0xb576('0x4f')],_0x152f21[_0xb576('0x46')][_0xb576('0x2d')]);_0x152f21[_0xb576('0x46')][_0xb576('0x50')]=integrations[_0xb576('0x51')](_0x152f21[_0xb576('0x46')][_0xb576('0x4f')],_0x152f21[_0xb576('0x46')][_0xb576('0x2d')]);return db[_0xb576('0x49')][_0xb576('0x45')](_0x152f21['body'],{'include':[{'model':db[_0xb576('0x52')],'as':_0xb576('0x4d')},{'model':db[_0xb576('0x52')],'as':_0xb576('0x50')}]});}return null;})['then'](respondWithResult(_0x49fe54,null))['catch'](handleError(_0x49fe54,null));};function getAccessToken(_0x25cd2a){return new Promise(function(_0x3b3df0,_0x105528){var _0x2b7cbe;switch(_0x25cd2a['zone']){case'US':_0x2b7cbe='https://accounts.zoho.com';break;case'AU':_0x2b7cbe=_0xb576('0x53');break;case'EU':_0x2b7cbe=_0xb576('0x54');break;case'IN':_0x2b7cbe=_0xb576('0x55');break;case'CN':_0x2b7cbe=_0xb576('0x56');break;default:_0x2b7cbe=_0xb576('0x54');break;}var _0x493bd0={'method':_0xb576('0x57'),'uri':_0x2b7cbe+_0xb576('0x58'),'qs':{'refresh_token':_0x25cd2a['refreshToken'],'client_id':_0x25cd2a[_0xb576('0x59')],'client_secret':_0x25cd2a[_0xb576('0x5a')],'grant_type':_0xb576('0x5b')},'json':!![]};return rp(_0x493bd0)[_0xb576('0x24')](function(_0x90fff8){if(_0x90fff8[_0xb576('0x5c')]){_0x3b3df0(_0x90fff8[_0xb576('0x5c')]);}else{_0x105528(_0xb576('0x5d'));}})[_0xb576('0x41')](function(_0x1a296c){_0x105528(_0x1a296c);});});}exports['getFields']=function(_0x451421,_0x241d3c,_0xa78255){var _0x116748,_0x57fc2f,_0x4f192b,_0x3a5c5d,_0x5e0028;return db['ZohoAccount'][_0xb576('0x48')]({'where':{'id':_0x451421[_0xb576('0x42')]['id']},'attributes':['id',_0xb576('0x5e'),_0xb576('0x5f'),_0xb576('0x59'),'clientSecret',_0xb576('0x60'),_0xb576('0x61'),_0xb576('0x62')]})[_0xb576('0x24')](handleEntityNotFound(_0x241d3c,null))[_0xb576('0x24')](function(_0x208fea){_0x5e0028=_0x208fea;_0x116748=_0x5e0028[_0xb576('0x5e')];_0x57fc2f=_0x116748==='zoho.eu'?'eu':_0xb576('0x63');_0x4f192b=_0x5e0028[_0xb576('0x60')];var _0x41c845=_0x4f192b['slice'](-0x1);if(_0x41c845==='/'||_0x41c845==='\x5c'||_0x41c845===':'){_0x4f192b=_0x4f192b['substring'](0x0,_0x4f192b[_0xb576('0x64')](_0x41c845));}if(!_0x5e0028[_0xb576('0x62')]){throw new Error(_0xb576('0x65'));}return getAccessToken(_0x5e0028);})[_0xb576('0x24')](function(_0x13fe54){if(_0x13fe54){return rp({'method':_0xb576('0x66'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x57fc2f),'qs':{'module':_0xb576('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x13fe54},'json':!![]});}})[_0xb576('0x24')](function(_0x25d33e){if(_0x25d33e){if(_0x25d33e[_0xb576('0x68')]&&_0x25d33e[_0xb576('0x68')][_0xb576('0x27')]){throw new Error(_0x25d33e[_0xb576('0x68')][_0xb576('0x27')][_0xb576('0x69')]);}var _0x3a03ba=[];var _0x58e1c7=[];var _0xf9f63f=[_0xb576('0x6a'),_0xb576('0x6b'),'Description',_0xb576('0x6c'),_0xb576('0x6d'),_0xb576('0x6e'),_0xb576('0x6f'),'Call_Type'];_0x58e1c7=_['remove'](_0x25d33e[_0xb576('0x34')],function(_0x558025){return _0xf9f63f[_0xb576('0x70')](_0x558025[_0xb576('0x71')]);});for(var _0x3d653a=0x0;_0x3d653a<_0x58e1c7['length'];_0x3d653a++){if(_0x58e1c7[_0x3d653a][_0xb576('0x72')]===![]){_0x3a03ba[_0xb576('0x73')]({'id':_0x58e1c7[_0x3d653a]['id'],'name':_0x58e1c7[_0x3d653a][_0xb576('0x74')],'custom':_0x58e1c7[_0x3d653a][_0xb576('0x75')],'options':_0x58e1c7[_0x3d653a][_0xb576('0x76')]==='picklist'&&_0x58e1c7[_0x3d653a]['pick_list_values'][_0xb576('0x35')]>-0x1?_[_0xb576('0x2a')](_0x58e1c7[_0x3d653a]['pick_list_values'],function(_0x5e7c49){return{'name':_0x5e7c49,'value':_0x5e7c49};}):[]});}}return{'count':_0x3a03ba[_0xb576('0x35')],'rows':_0x3a03ba};}else{return{'count':0x0,'rows':[]};}})[_0xb576('0x24')](respondWithResult(_0x241d3c,null))[_0xb576('0x41')](function(_0x3f1c57){var _0x2b00d5=_0x451421[_0xb576('0x2f')][_0xb576('0x77')]?0x1f4:_0x3f1c57[_0xb576('0x78')]||0x1f4;logger[_0xb576('0x27')](_0xb576('0x79'),_0xb576('0x7a'),_0x2b00d5,JSON[_0xb576('0x7b')](_0x3f1c57));delete _0x3f1c57['name'];if(_0x2b00d5===0x191){_0x2b00d5=0x190;}_0x241d3c[_0xb576('0x18')](_0x2b00d5)[_0xb576('0x7c')](_0x451421[_0xb576('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3f1c57[_0xb576('0x78')]}:_0x3f1c57);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4a2e93d..f4476b2 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 _0xa773=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','https://accounts.zoho.com.au','https://accounts.zoho.eu','parse','refreshToken','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa773,0x113));var _0x3a77=function(_0x1dec82,_0x4c4f21){_0x1dec82=_0x1dec82-0x0;var _0x4dd819=_0xa773[_0x1dec82];return _0x4dd819;};'use strict';var _=require(_0x3a77('0x0'));var util=require(_0x3a77('0x1'));var logger=require(_0x3a77('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3a77('0x3'));var rp=require(_0x3a77('0x4'));var fs=require('fs');var path=require(_0x3a77('0x5'));var rimraf=require(_0x3a77('0x6'));var config=require(_0x3a77('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x3a77('0x8'));module[_0x3a77('0x9')]=function(_0x290540,_0x1d77af){return _0x290540[_0x3a77('0xa')](_0x3a77('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x407e2c,_0x7f9736,_0x2976c4){if(_0x407e2c[_0x3a77('0xc')](_0x3a77('0xd'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0xe'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0xf'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0x10'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0x11'))||_0x407e2c[_0x3a77('0xc')](_0x3a77('0x12'))){var _0x42516b,_0x505e5e;_0x42516b=_0x407e2c[_0x3a77('0xe')];var _0x2b99af=_0x42516b[_0x3a77('0x13')](-0x1);if(_0x2b99af==='/'||_0x2b99af==='\x5c'||_0x2b99af===':'){_0x42516b=_0x42516b[_0x3a77('0x14')](0x0,_0x42516b['lastIndexOf'](_0x2b99af));}switch(_0x407e2c[_0x3a77('0xd')]){case'US':_0x505e5e=_0x3a77('0x15');break;case'AU':_0x505e5e='https://accounts.zoho.com.au';break;case'IN':_0x505e5e=_0x3a77('0x16');break;case'CN':_0x505e5e=_0x3a77('0x17');break;default:_0x505e5e='https://accounts.zoho.eu';break;}var _0x599285={'method':_0x3a77('0x18'),'uri':_0x505e5e+_0x3a77('0x19'),'form':{'grant_type':_0x3a77('0x1a'),'client_id':_0x407e2c[_0x3a77('0xf')],'client_secret':_0x407e2c['clientSecret'],'redirect_uri':_0x407e2c[_0x3a77('0xe')],'code':_0x407e2c[_0x3a77('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x599285)[_0x3a77('0x1b')](function(_0x11dcf0){var _0x4060e4=JSON['parse'](_0x11dcf0);if(_0x4060e4['refresh_token']){_0x407e2c['refreshToken']=_0x4060e4[_0x3a77('0x1c')];logger[_0x3a77('0x1d')](util[_0x3a77('0x1e')](_0x3a77('0x1f'),_0x407e2c[_0x3a77('0x20')],_0x407e2c['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x407e2c['name'],_0x407e2c['id']),util['inspect'](_0x4060e4,{'showHidden':![],'depth':null}));}return _0x2976c4(null,_0x7f9736);})['catch'](function(_0x57f0b1){logger[_0x3a77('0x21')](util[_0x3a77('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x407e2c['name'],_0x407e2c['id']),util[_0x3a77('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x2976c4(_0x57f0b1);});}else{return _0x2976c4(null,_0x7f9736);}},'beforeUpdate':function(_0xb1f332,_0xfff316,_0x532bee){if(_0xb1f332[_0x3a77('0xc')](_0x3a77('0xd'))||_0xb1f332[_0x3a77('0xc')](_0x3a77('0xe'))||_0xb1f332[_0x3a77('0xc')](_0x3a77('0xf'))||_0xb1f332[_0x3a77('0xc')]('clientSecret')||_0xb1f332[_0x3a77('0xc')](_0x3a77('0x11'))||_0xb1f332['changed'](_0x3a77('0x12'))){var _0x5924b5,_0x369bd4;_0x5924b5=_0xb1f332['serverUrl'];var _0x3eaf7a=_0x5924b5[_0x3a77('0x13')](-0x1);if(_0x3eaf7a==='/'||_0x3eaf7a==='\x5c'||_0x3eaf7a===':'){_0x5924b5=_0x5924b5[_0x3a77('0x14')](0x0,_0x5924b5['lastIndexOf'](_0x3eaf7a));}switch(_0xb1f332[_0x3a77('0xd')]){case'US':_0x369bd4=_0x3a77('0x15');break;case'AU':_0x369bd4=_0x3a77('0x23');break;case'IN':_0x369bd4='https://accounts.zoho.in';break;case'CN':_0x369bd4=_0x3a77('0x17');break;default:_0x369bd4=_0x3a77('0x24');break;}var _0x355773={'method':_0x3a77('0x18'),'uri':_0x369bd4+_0x3a77('0x19'),'form':{'grant_type':_0x3a77('0x1a'),'client_id':_0xb1f332['clientId'],'client_secret':_0xb1f332[_0x3a77('0x10')],'redirect_uri':_0xb1f332['serverUrl'],'code':_0xb1f332[_0x3a77('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x355773)[_0x3a77('0x1b')](function(_0x489bde){var _0x368297=JSON[_0x3a77('0x25')](_0x489bde);if(_0x368297[_0x3a77('0x1c')]){_0xb1f332[_0x3a77('0x26')]=_0x368297[_0x3a77('0x1c')];logger[_0x3a77('0x1d')](util[_0x3a77('0x1e')](_0x3a77('0x1f'),_0xb1f332['name'],_0xb1f332['id']));}else{logger['error'](util[_0x3a77('0x1e')](_0x3a77('0x27'),_0xb1f332[_0x3a77('0x20')],_0xb1f332['id']),util[_0x3a77('0x22')](_0x368297,{'showHidden':![],'depth':null}));}return _0x532bee(null,_0xfff316);})['catch'](function(_0x4b580e){logger[_0x3a77('0x21')](util['format'](_0x3a77('0x27'),_0xb1f332['name'],_0xb1f332['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x532bee(_0x4b580e);});}else{return _0x532bee(null,_0xfff316);}}}});}; \ No newline at end of file +var _0x8463=['../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','changed','clientId','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','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','https://accounts.zoho.com.cn','https://accounts.zoho.eu','parse','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e4509,_0x50f241){var _0x428ac5=function(_0x1204c8){while(--_0x1204c8){_0x3e4509['push'](_0x3e4509['shift']());}};_0x428ac5(++_0x50f241);}(_0x8463,0x15f));var _0x3846=function(_0x3ef03a,_0x5e71ba){_0x3ef03a=_0x3ef03a-0x0;var _0xac5bf3=_0x8463[_0x3ef03a];return _0xac5bf3;};'use strict';var _=require(_0x3846('0x0'));var util=require(_0x3846('0x1'));var logger=require(_0x3846('0x2'))(_0x3846('0x3'));var moment=require(_0x3846('0x4'));var BPromise=require(_0x3846('0x5'));var rp=require(_0x3846('0x6'));var fs=require('fs');var path=require(_0x3846('0x7'));var rimraf=require(_0x3846('0x8'));var config=require(_0x3846('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x3846('0xa'));module[_0x3846('0xb')]=function(_0x5413b2,_0x1597c0){return _0x5413b2[_0x3846('0xc')](_0x3846('0xd'),attributes,{'tableName':_0x3846('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x963c,_0x5befe5,_0x5542e9){if(_0x963c['changed'](_0x3846('0xf'))||_0x963c['changed'](_0x3846('0x10'))||_0x963c[_0x3846('0x11')](_0x3846('0x12'))||_0x963c['changed']('clientSecret')||_0x963c['changed']('code')||_0x963c[_0x3846('0x11')](_0x3846('0x13'))){var _0x298869,_0x1dec83;_0x298869=_0x963c['serverUrl'];var _0x47f508=_0x298869[_0x3846('0x14')](-0x1);if(_0x47f508==='/'||_0x47f508==='\x5c'||_0x47f508===':'){_0x298869=_0x298869['substring'](0x0,_0x298869[_0x3846('0x15')](_0x47f508));}switch(_0x963c[_0x3846('0xf')]){case'US':_0x1dec83=_0x3846('0x16');break;case'AU':_0x1dec83=_0x3846('0x17');break;case'IN':_0x1dec83=_0x3846('0x18');break;case'CN':_0x1dec83='https://accounts.zoho.com.cn';break;default:_0x1dec83='https://accounts.zoho.eu';break;}var _0x8879da={'method':_0x3846('0x19'),'uri':_0x1dec83+_0x3846('0x1a'),'form':{'grant_type':_0x3846('0x1b'),'client_id':_0x963c[_0x3846('0x12')],'client_secret':_0x963c[_0x3846('0x1c')],'redirect_uri':_0x963c[_0x3846('0x10')],'code':_0x963c[_0x3846('0x1d')]},'headers':{'Content-Type':_0x3846('0x1e')}};return rp(_0x8879da)[_0x3846('0x1f')](function(_0x4794b2){var _0x54cb0e=JSON['parse'](_0x4794b2);if(_0x54cb0e[_0x3846('0x20')]){_0x963c[_0x3846('0x21')]=_0x54cb0e[_0x3846('0x20')];logger[_0x3846('0x22')](util[_0x3846('0x23')](_0x3846('0x24'),_0x963c[_0x3846('0x25')],_0x963c['id']));}else{logger[_0x3846('0x26')](util[_0x3846('0x23')](_0x3846('0x27'),_0x963c[_0x3846('0x25')],_0x963c['id']),util[_0x3846('0x28')](_0x54cb0e,{'showHidden':![],'depth':null}));}return _0x5542e9(null,_0x5befe5);})[_0x3846('0x29')](function(_0x5335bc){logger['error'](util['format'](_0x3846('0x27'),_0x963c[_0x3846('0x25')],_0x963c['id']),util[_0x3846('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x5542e9(_0x5335bc);});}else{return _0x5542e9(null,_0x5befe5);}},'beforeUpdate':function(_0x3c836a,_0xc899e0,_0x177dcc){if(_0x3c836a[_0x3846('0x11')](_0x3846('0xf'))||_0x3c836a[_0x3846('0x11')](_0x3846('0x10'))||_0x3c836a[_0x3846('0x11')](_0x3846('0x12'))||_0x3c836a[_0x3846('0x11')](_0x3846('0x1c'))||_0x3c836a[_0x3846('0x11')](_0x3846('0x1d'))||_0x3c836a['changed'](_0x3846('0x13'))){var _0x37b7fb,_0x13eee0;_0x37b7fb=_0x3c836a['serverUrl'];var _0x183f59=_0x37b7fb[_0x3846('0x14')](-0x1);if(_0x183f59==='/'||_0x183f59==='\x5c'||_0x183f59===':'){_0x37b7fb=_0x37b7fb['substring'](0x0,_0x37b7fb[_0x3846('0x15')](_0x183f59));}switch(_0x3c836a['zone']){case'US':_0x13eee0=_0x3846('0x16');break;case'AU':_0x13eee0='https://accounts.zoho.com.au';break;case'IN':_0x13eee0=_0x3846('0x18');break;case'CN':_0x13eee0=_0x3846('0x2a');break;default:_0x13eee0=_0x3846('0x2b');break;}var _0x189e9f={'method':_0x3846('0x19'),'uri':_0x13eee0+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3c836a['clientId'],'client_secret':_0x3c836a['clientSecret'],'redirect_uri':_0x3c836a[_0x3846('0x10')],'code':_0x3c836a[_0x3846('0x1d')]},'headers':{'Content-Type':_0x3846('0x1e')}};return rp(_0x189e9f)[_0x3846('0x1f')](function(_0x58d372){var _0x525c26=JSON[_0x3846('0x2c')](_0x58d372);if(_0x525c26['refresh_token']){_0x3c836a[_0x3846('0x21')]=_0x525c26['refresh_token'];logger['info'](util[_0x3846('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c836a[_0x3846('0x25')],_0x3c836a['id']));}else{logger[_0x3846('0x26')](util[_0x3846('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c836a[_0x3846('0x25')],_0x3c836a['id']),util[_0x3846('0x28')](_0x525c26,{'showHidden':![],'depth':null}));}return _0x177dcc(null,_0xc899e0);})[_0x3846('0x29')](function(_0x542add){logger['error'](util[_0x3846('0x23')](_0x3846('0x27'),_0x3c836a[_0x3846('0x25')],_0x3c836a['id']),util[_0x3846('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x177dcc(_0x542add);});}else{return _0x177dcc(null,_0xc899e0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 49263a5..e74ac4c 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 _0xc6ac=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowZohoAccount','find','lodash','util','moment','bluebird'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5f88c6,_0x14213d){_0x5f88c6=_0x5f88c6-0x0;var _0x5f1e2d=_0xc6ac[_0x5f88c6];return _0x5f1e2d;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')]({'raw':_0x33079c[_0xcc6a('0x1b')]?_0x33079c['options'][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'limit':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1f')]||null:null,'include':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')]['include']?_[_0xcc6a('0x20')](_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x21')],function(_0x581aae){return{'model':db[_0x581aae[_0xcc6a('0x22')]],'as':_0x581aae['as'],'attributes':_0x581aae[_0xcc6a('0x1e')],'include':_0x581aae[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x581aae[_0xcc6a('0x21')],function(_0x5fc697){return{'model':db[_0x5fc697['model']],'as':_0x5fc697['as'],'attributes':_0x5fc697[_0xcc6a('0x1e')],'include':_0x5fc697[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x5fc697['include'],function(_0x3afb3a){return{'model':db[_0x3afb3a[_0xcc6a('0x22')]],'as':_0x3afb3a['as'],'attributes':_0x3afb3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x8b1b2b){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger['debug'](_0xcc6a('0x18'),_0x33079c,JSON[_0xcc6a('0x23')](_0x8b1b2b));_0x2d9585(_0x8b1b2b);})[_0xcc6a('0x24')](function(_0x4f176b){logger[_0xcc6a('0x15')]('GetZohoAccount',_0x4f176b['message'],_0x33079c);_0x412bc7(_0x12ef33[_0xcc6a('0x15')](0x1f4,_0x4f176b[_0xcc6a('0x17')]));});});};exports[_0xcc6a('0x25')]=function(_0x11b481){var _0x2b575d=this;return new Promise(function(_0x131138,_0x4e2de4){return db[_0xcc6a('0x19')][_0xcc6a('0x26')]({'raw':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x11b481['options']?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'include':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x11b481[_0xcc6a('0x1b')]['include'],function(_0x5d2287){return{'model':db[_0x5d2287['model']],'as':_0x5d2287['as'],'attributes':_0x5d2287['attributes'],'include':_0x5d2287['include']?_[_0xcc6a('0x20')](_0x5d2287[_0xcc6a('0x21')],function(_0x1101ec){return{'model':db[_0x1101ec[_0xcc6a('0x22')]],'as':_0x1101ec['as'],'attributes':_0x1101ec[_0xcc6a('0x1e')],'include':_0x1101ec['include']?_['map'](_0x1101ec[_0xcc6a('0x21')],function(_0x11173a){return{'model':db[_0x11173a[_0xcc6a('0x22')]],'as':_0x11173a['as'],'attributes':_0x11173a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x2207df){logger[_0xcc6a('0x10')](_0xcc6a('0x25'),_0x11b481);logger[_0xcc6a('0x12')](_0xcc6a('0x25'),_0x11b481,JSON[_0xcc6a('0x23')](_0x2207df));_0x131138(_0x2207df);})[_0xcc6a('0x24')](function(_0x2a1cd2){logger[_0xcc6a('0x15')](_0xcc6a('0x25'),_0x2a1cd2[_0xcc6a('0x17')],_0x11b481);_0x4e2de4(_0x2b575d[_0xcc6a('0x15')](0x1f4,_0x2a1cd2[_0xcc6a('0x17')]));});});}; \ No newline at end of file +var _0xf08c=['model','map','then','debug','ShowZohoAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include'];(function(_0x196ef6,_0x4ee3bd){var _0x54b1b6=function(_0x3ebdf7){while(--_0x3ebdf7){_0x196ef6['push'](_0x196ef6['shift']());}};_0x54b1b6(++_0x4ee3bd);}(_0xf08c,0xb5));var _0xcf08=function(_0x1e02c2,_0x58e891){_0x1e02c2=_0x1e02c2-0x0;var _0x2c803a=_0xf08c[_0x1e02c2];return _0x2c803a;};'use strict';var _=require(_0xcf08('0x0'));var util=require(_0xcf08('0x1'));var moment=require(_0xcf08('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf08('0x3'));var fs=require('fs');var Redis=require(_0xcf08('0x4'));var db=require(_0xcf08('0x5'))['db'];var utils=require(_0xcf08('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xcf08('0x7'));var jayson=require(_0xcf08('0x8'));var client=jayson['client'][_0xcf08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37efab,_0x13b89c,_0x42c7b0){return new BPromise(function(_0x59d6d6,_0x5044bb){return client[_0xcf08('0xa')](_0x37efab,_0x42c7b0)['then'](function(_0x1ab45d){logger[_0xcf08('0xb')](_0xcf08('0xc'),_0x13b89c,_0xcf08('0xd'));logger['debug'](_0xcf08('0xe'),_0x13b89c,_0xcf08('0xd'),JSON[_0xcf08('0xf')](_0x1ab45d));if(_0x1ab45d[_0xcf08('0x10')]){if(_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x11')]===0x1f4){logger[_0xcf08('0x10')](_0xcf08('0xc'),_0x13b89c,_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x12')]);return _0x5044bb(_0x1ab45d[_0xcf08('0x10')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x13b89c,_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x12')]);return _0x59d6d6(_0x1ab45d['error'][_0xcf08('0x12')]);}else{logger[_0xcf08('0xb')](_0xcf08('0xc'),_0x13b89c,_0xcf08('0xd'));_0x59d6d6(_0x1ab45d[_0xcf08('0x13')]['message']);}})[_0xcf08('0x14')](function(_0x5d89a7){logger['error'](_0xcf08('0xc'),_0x13b89c,_0x5d89a7);_0x5044bb(_0x5d89a7);});});}exports[_0xcf08('0x15')]=function(_0x4c4970){var _0x2e5027=this;return new Promise(function(_0x47060d,_0x2947e5){return db[_0xcf08('0x16')][_0xcf08('0x17')]({'raw':_0x4c4970[_0xcf08('0x18')]?_0x4c4970['options'][_0xcf08('0x19')]===undefined?!![]:![]:!![],'where':_0x4c4970[_0xcf08('0x18')]?_0x4c4970[_0xcf08('0x18')]['where']||null:null,'attributes':_0x4c4970[_0xcf08('0x18')]?_0x4c4970['options'][_0xcf08('0x1a')]||null:null,'limit':_0x4c4970[_0xcf08('0x18')]?_0x4c4970['options'][_0xcf08('0x1b')]||null:null,'include':_0x4c4970[_0xcf08('0x18')]?_0x4c4970[_0xcf08('0x18')][_0xcf08('0x1c')]?_['map'](_0x4c4970[_0xcf08('0x18')][_0xcf08('0x1c')],function(_0x52968a){return{'model':db[_0x52968a[_0xcf08('0x1d')]],'as':_0x52968a['as'],'attributes':_0x52968a['attributes'],'include':_0x52968a[_0xcf08('0x1c')]?_[_0xcf08('0x1e')](_0x52968a['include'],function(_0x2a4b96){return{'model':db[_0x2a4b96[_0xcf08('0x1d')]],'as':_0x2a4b96['as'],'attributes':_0x2a4b96[_0xcf08('0x1a')],'include':_0x2a4b96[_0xcf08('0x1c')]?_[_0xcf08('0x1e')](_0x2a4b96[_0xcf08('0x1c')],function(_0x4137ae){return{'model':db[_0x4137ae[_0xcf08('0x1d')]],'as':_0x4137ae['as'],'attributes':_0x4137ae[_0xcf08('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcf08('0x1f')](function(_0x4bfaad){logger['info'](_0xcf08('0x15'),_0x4c4970);logger[_0xcf08('0x20')]('GetZohoAccount',_0x4c4970,JSON[_0xcf08('0xf')](_0x4bfaad));_0x47060d(_0x4bfaad);})[_0xcf08('0x14')](function(_0x347835){logger[_0xcf08('0x10')](_0xcf08('0x15'),_0x347835[_0xcf08('0x12')],_0x4c4970);_0x2947e5(_0x2e5027[_0xcf08('0x10')](0x1f4,_0x347835[_0xcf08('0x12')]));});});};exports[_0xcf08('0x21')]=function(_0x315b96){var _0x28636b=this;return new Promise(function(_0x242edd,_0x2e6543){return db[_0xcf08('0x16')][_0xcf08('0x22')]({'raw':_0x315b96['options']?_0x315b96[_0xcf08('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x315b96['options']?_0x315b96[_0xcf08('0x18')]['where']||null:null,'attributes':_0x315b96['options']?_0x315b96['options'][_0xcf08('0x1a')]||null:null,'include':_0x315b96[_0xcf08('0x18')]?_0x315b96[_0xcf08('0x18')]['include']?_['map'](_0x315b96[_0xcf08('0x18')][_0xcf08('0x1c')],function(_0x3b9af1){return{'model':db[_0x3b9af1[_0xcf08('0x1d')]],'as':_0x3b9af1['as'],'attributes':_0x3b9af1[_0xcf08('0x1a')],'include':_0x3b9af1[_0xcf08('0x1c')]?_[_0xcf08('0x1e')](_0x3b9af1['include'],function(_0x1d680f){return{'model':db[_0x1d680f['model']],'as':_0x1d680f['as'],'attributes':_0x1d680f[_0xcf08('0x1a')],'include':_0x1d680f[_0xcf08('0x1c')]?_['map'](_0x1d680f[_0xcf08('0x1c')],function(_0x3eb970){return{'model':db[_0x3eb970[_0xcf08('0x1d')]],'as':_0x3eb970['as'],'attributes':_0x3eb970['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1aae14){logger[_0xcf08('0xb')](_0xcf08('0x21'),_0x315b96);logger[_0xcf08('0x20')](_0xcf08('0x21'),_0x315b96,JSON[_0xcf08('0xf')](_0x1aae14));_0x242edd(_0x1aae14);})[_0xcf08('0x14')](function(_0x226b89){logger[_0xcf08('0x10')](_0xcf08('0x21'),_0x226b89['message'],_0x315b96);_0x2e6543(_0x28636b['error'](0x1f4,_0x226b89[_0xcf08('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1ffff98..99df58e 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 _0xa768=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x4c7071,_0x2c707d){var _0x35e6a6=function(_0x2686f5){while(--_0x2686f5){_0x4c7071['push'](_0x4c7071['shift']());}};_0x35e6a6(++_0x2c707d);}(_0xa768,0x78));var _0x8a76=function(_0x3b447a,_0x1dc436){_0x3b447a=_0x3b447a-0x0;var _0x1189f9=_0xa768[_0x3b447a];return _0x1189f9;};'use strict';var multer=require('multer');var util=require(_0x8a76('0x0'));var path=require(_0x8a76('0x1'));var timeout=require(_0x8a76('0x2'));var express=require(_0x8a76('0x3'));var router=express['Router']();var fs_extra=require(_0x8a76('0x4'));var auth=require(_0x8a76('0x5'));var interaction=require(_0x8a76('0x6'));var config=require(_0x8a76('0x7'));var controller=require(_0x8a76('0x8'));router[_0x8a76('0x9')]('/',auth[_0x8a76('0xa')](),controller['index']);router[_0x8a76('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8a76('0xb')]);router['get'](_0x8a76('0xc'),auth[_0x8a76('0xa')](),controller[_0x8a76('0xd')]);router[_0x8a76('0x9')](_0x8a76('0xe'),auth[_0x8a76('0xa')](),controller[_0x8a76('0xf')]);router[_0x8a76('0x9')](_0x8a76('0x10'),auth[_0x8a76('0xa')](),controller[_0x8a76('0x11')]);router[_0x8a76('0x12')]('/',auth['isAuthenticated'](),controller[_0x8a76('0x13')]);router[_0x8a76('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8a76('0x15')]);router[_0x8a76('0x16')](_0x8a76('0x17'),auth[_0x8a76('0xa')](),controller[_0x8a76('0x18')]);module[_0x8a76('0x19')]=router; \ No newline at end of file +var _0xd3a2=['post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','/:id','show','/:id/fields','isAuthenticated','get','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x3996d2,_0x5b4f6d){var _0x20b13f=function(_0x30ba4b){while(--_0x30ba4b){_0x3996d2['push'](_0x3996d2['shift']());}};_0x20b13f(++_0x5b4f6d);}(_0xd3a2,0xc5));var _0x2d3a=function(_0x100e6f,_0x1f1a14){_0x100e6f=_0x100e6f-0x0;var _0xf8dfa2=_0xd3a2[_0x100e6f];return _0xf8dfa2;};'use strict';var multer=require(_0x2d3a('0x0'));var util=require(_0x2d3a('0x1'));var path=require(_0x2d3a('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d3a('0x3'));var router=express[_0x2d3a('0x4')]();var fs_extra=require(_0x2d3a('0x5'));var auth=require(_0x2d3a('0x6'));var interaction=require(_0x2d3a('0x7'));var config=require(_0x2d3a('0x8'));var controller=require(_0x2d3a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2d3a('0xa')]);router['get'](_0x2d3a('0xb'),auth['isAuthenticated'](),controller[_0x2d3a('0xc')]);router['get'](_0x2d3a('0xd'),auth[_0x2d3a('0xe')](),controller['getFields']);router[_0x2d3a('0xf')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2d3a('0x10')]);router[_0x2d3a('0xf')](_0x2d3a('0x11'),auth[_0x2d3a('0xe')](),controller[_0x2d3a('0x12')]);router[_0x2d3a('0x13')]('/',auth[_0x2d3a('0xe')](),controller['create']);router[_0x2d3a('0x14')](_0x2d3a('0xb'),auth[_0x2d3a('0xe')](),controller[_0x2d3a('0x15')]);router['delete'](_0x2d3a('0xb'),auth[_0x2d3a('0xe')](),controller[_0x2d3a('0x16')]);module[_0x2d3a('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 437f79f..1ecf7a4 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 _0xbfa4=['contact_lead','contact','sequelize','ENUM','lead'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xbfa4,0x106));var _0x4bfa=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0xbfa4[_0x57486e];return _0x5f110b;};'use strict';var Sequelize=require(_0x4bfa('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x4bfa('0x1')]('lead','contact','nothing'),'defaultValue':_0x4bfa('0x2')},'moduleSearch':{'type':Sequelize[_0x4bfa('0x1')](_0x4bfa('0x3'),_0x4bfa('0x4'),_0x4bfa('0x2')),'defaultValue':_0x4bfa('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1d9d=['lead','contact','nothing','ENUM','contact_lead','sequelize','exports','STRING'];(function(_0x55121f,_0x521213){var _0x4f6823=function(_0x890b18){while(--_0x890b18){_0x55121f['push'](_0x55121f['shift']());}};_0x4f6823(++_0x521213);}(_0x1d9d,0x6d));var _0xd1d9=function(_0x2b02f0,_0x1542cb){_0x2b02f0=_0x2b02f0-0x0;var _0xae447e=_0x1d9d[_0x2b02f0];return _0xae447e;};'use strict';var Sequelize=require(_0xd1d9('0x0'));module[_0xd1d9('0x1')]={'name':{'type':Sequelize[_0xd1d9('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xd1d9('0x3'),_0xd1d9('0x4'),_0xd1d9('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xd1d9('0x6')](_0xd1d9('0x7'),_0xd1d9('0x4'),_0xd1d9('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xd1d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index dcc6d6d..555d4a0 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 _0x0b4a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../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','name','send','index','map','ZohoConfiguration','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','hasOwnProperty','getSubjects','findOne','ZohoField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x586381,_0x2afc35){var _0x9b423b=function(_0x3fc8e8){while(--_0x3fc8e8){_0x586381['push'](_0x586381['shift']());}};_0x9b423b(++_0x2afc35);}(_0x0b4a,0x18d));var _0xa0b4=function(_0x5c8c78,_0x19fe62){_0x5c8c78=_0x5c8c78-0x0;var _0x18e46b=_0x0b4a[_0x5c8c78];return _0x18e46b;};'use strict';var emlformat=require(_0xa0b4('0x0'));var rimraf=require(_0xa0b4('0x1'));var zipdir=require(_0xa0b4('0x2'));var jsonpatch=require(_0xa0b4('0x3'));var rp=require(_0xa0b4('0x4'));var moment=require('moment');var BPromise=require(_0xa0b4('0x5'));var Mustache=require(_0xa0b4('0x6'));var util=require(_0xa0b4('0x7'));var path=require(_0xa0b4('0x8'));var sox=require(_0xa0b4('0x9'));var csv=require(_0xa0b4('0xa'));var ejs=require(_0xa0b4('0xb'));var fs=require('fs');var fs_extra=require(_0xa0b4('0xc'));var _=require(_0xa0b4('0xd'));var squel=require(_0xa0b4('0xe'));var crypto=require(_0xa0b4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa0b4('0x10'));var toCsv=require(_0xa0b4('0xa'));var querystring=require(_0xa0b4('0x11'));var Papa=require('papaparse');var Redis=require(_0xa0b4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa0b4('0x13'));var as=require(_0xa0b4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0b4('0x15'))(_0xa0b4('0x16'));var utils=require('../../config/utils');var config=require(_0xa0b4('0x17'));var licenseUtil=require(_0xa0b4('0x18'));var db=require(_0xa0b4('0x19'))['db'];function respondWithStatusCode(_0x4b0093,_0x2cd0de){_0x2cd0de=_0x2cd0de||0xcc;return function(_0x353f4e){if(_0x353f4e){return _0x4b0093[_0xa0b4('0x1a')](_0x2cd0de);}return _0x4b0093[_0xa0b4('0x1b')](_0x2cd0de)[_0xa0b4('0x1c')]();};}function respondWithResult(_0x3828e8,_0x14271b){_0x14271b=_0x14271b||0xc8;return function(_0xa555e8){if(_0xa555e8){return _0x3828e8[_0xa0b4('0x1b')](_0x14271b)[_0xa0b4('0x1d')](_0xa555e8);}};}function respondWithFilteredResult(_0x3a688e,_0x38465a){return function(_0x11f7b5){if(_0x11f7b5){var _0x43caba=typeof _0x38465a[_0xa0b4('0x1e')]===_0xa0b4('0x1f')&&typeof _0x38465a[_0xa0b4('0x20')]===_0xa0b4('0x1f');var _0x5218c9=_0x11f7b5[_0xa0b4('0x21')];var _0x20b99b=_0x43caba?0x0:_0x38465a[_0xa0b4('0x1e')];var _0x2e11ee=_0x43caba?_0x11f7b5[_0xa0b4('0x21')]:_0x38465a[_0xa0b4('0x1e')]+_0x38465a[_0xa0b4('0x20')];var _0x51f2dd;if(_0x2e11ee>=_0x5218c9){_0x2e11ee=_0x5218c9;_0x51f2dd=0xc8;}else{_0x51f2dd=0xce;}_0x3a688e[_0xa0b4('0x1b')](_0x51f2dd);return _0x3a688e['set'](_0xa0b4('0x22'),_0x20b99b+'-'+_0x2e11ee+'/'+_0x5218c9)[_0xa0b4('0x1d')](_0x11f7b5);}return null;};}function patchUpdates(_0x422690){return function(_0xb5bec5){try{jsonpatch[_0xa0b4('0x23')](_0xb5bec5,_0x422690,!![]);}catch(_0xb6cbe3){return BPromise[_0xa0b4('0x24')](_0xb6cbe3);}return _0xb5bec5[_0xa0b4('0x25')]();};}function saveUpdates(_0x2af5da,_0x23cefa){return function(_0x2ceca6){if(_0x2ceca6){return _0x2ceca6[_0xa0b4('0x26')](_0x2af5da)[_0xa0b4('0x27')](function(_0x56686c){return _0x56686c;});}return null;};}function removeEntity(_0x57b105,_0x5ce884){return function(_0x382882){if(_0x382882){return _0x382882[_0xa0b4('0x28')]()[_0xa0b4('0x27')](function(){_0x57b105[_0xa0b4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd67071,_0x3acf95){return function(_0x2d605b){if(!_0x2d605b){_0xd67071[_0xa0b4('0x1a')](0x194);}return _0x2d605b;};}function handleError(_0x227f93,_0xbab618){_0xbab618=_0xbab618||0x1f4;return function(_0x1c7154){logger[_0xa0b4('0x29')](_0x1c7154['stack']);if(_0x1c7154[_0xa0b4('0x2a')]){delete _0x1c7154['name'];}_0x227f93[_0xa0b4('0x1b')](_0xbab618)[_0xa0b4('0x2b')](_0x1c7154);};}exports[_0xa0b4('0x2c')]=function(_0x4c6c15,_0x3e54b5){var _0x970cda={},_0x4421d2={},_0x5085e3={'count':0x0,'rows':[]};var _0x5c219f=_[_0xa0b4('0x2d')](db[_0xa0b4('0x2e')][_0xa0b4('0x2f')],function(_0x461060){return{'name':_0x461060['fieldName'],'type':_0x461060['type'][_0xa0b4('0x30')]};});_0x4421d2[_0xa0b4('0x31')]=_[_0xa0b4('0x2d')](_0x5c219f,'name');_0x4421d2['query']=_[_0xa0b4('0x32')](_0x4c6c15[_0xa0b4('0x33')]);_0x4421d2[_0xa0b4('0x34')]=_[_0xa0b4('0x35')](_0x4421d2[_0xa0b4('0x31')],_0x4421d2[_0xa0b4('0x33')]);_0x970cda[_0xa0b4('0x36')]=_[_0xa0b4('0x35')](_0x4421d2['model'],qs[_0xa0b4('0x37')](_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x37')]));_0x970cda[_0xa0b4('0x36')]=_0x970cda[_0xa0b4('0x36')][_0xa0b4('0x38')]?_0x970cda[_0xa0b4('0x36')]:_0x4421d2['model'];if(!_0x4c6c15['query']['hasOwnProperty'](_0xa0b4('0x39'))){_0x970cda[_0xa0b4('0x20')]=qs[_0xa0b4('0x20')](_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x20')]);_0x970cda[_0xa0b4('0x1e')]=qs[_0xa0b4('0x1e')](_0x4c6c15['query'][_0xa0b4('0x1e')]);}_0x970cda[_0xa0b4('0x3a')]=qs[_0xa0b4('0x3b')](_0x4c6c15['query']['sort']);_0x970cda['where']=qs[_0xa0b4('0x34')](_[_0xa0b4('0x3c')](_0x4c6c15['query'],_0x4421d2[_0xa0b4('0x34')]),_0x5c219f);if(_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x3d')]){_0x970cda[_0xa0b4('0x3e')]=_['merge'](_0x970cda[_0xa0b4('0x3e')],{'$or':_['map'](_0x5c219f,function(_0x422ee9){if(_0x422ee9[_0xa0b4('0x3f')]!=='VIRTUAL'){var _0x3b1367={};_0x3b1367[_0x422ee9[_0xa0b4('0x2a')]]={'$like':'%'+_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x3d')]+'%'};return _0x3b1367;}})});}_0x970cda=_[_0xa0b4('0x40')]({},_0x970cda,_0x4c6c15['options']);var _0x2ea275={'where':_0x970cda[_0xa0b4('0x3e')]};return db[_0xa0b4('0x2e')][_0xa0b4('0x21')](_0x2ea275)[_0xa0b4('0x27')](function(_0x5b4f46){_0x5085e3[_0xa0b4('0x21')]=_0x5b4f46;if(_0x4c6c15[_0xa0b4('0x33')][_0xa0b4('0x41')]){_0x970cda[_0xa0b4('0x42')]=[{'all':!![]}];}return db[_0xa0b4('0x2e')][_0xa0b4('0x43')](_0x970cda);})[_0xa0b4('0x27')](function(_0x2aa79d){_0x5085e3[_0xa0b4('0x44')]=_0x2aa79d;return _0x5085e3;})[_0xa0b4('0x27')](respondWithFilteredResult(_0x3e54b5,_0x970cda))[_0xa0b4('0x45')](handleError(_0x3e54b5,null));};exports[_0xa0b4('0x46')]=function(_0x48a6df,_0x3f1b32){var _0x55f2c8={'raw':![],'where':{'id':_0x48a6df[_0xa0b4('0x47')]['id']}},_0x6418f5={};_0x6418f5[_0xa0b4('0x31')]=_['keys'](db[_0xa0b4('0x2e')]['rawAttributes']);_0x6418f5[_0xa0b4('0x33')]=_[_0xa0b4('0x32')](_0x48a6df['query']);_0x6418f5[_0xa0b4('0x34')]=_[_0xa0b4('0x35')](_0x6418f5[_0xa0b4('0x31')],_0x6418f5[_0xa0b4('0x33')]);_0x55f2c8[_0xa0b4('0x36')]=_[_0xa0b4('0x35')](_0x6418f5['model'],qs['fields'](_0x48a6df[_0xa0b4('0x33')][_0xa0b4('0x37')]));_0x55f2c8['attributes']=_0x55f2c8['attributes'][_0xa0b4('0x38')]?_0x55f2c8['attributes']:_0x6418f5[_0xa0b4('0x31')];if(_0x48a6df[_0xa0b4('0x33')][_0xa0b4('0x41')]){_0x55f2c8['include']=[{'all':!![]}];}_0x55f2c8=_[_0xa0b4('0x40')]({},_0x55f2c8,_0x48a6df[_0xa0b4('0x48')]);return db[_0xa0b4('0x2e')][_0xa0b4('0x49')](_0x55f2c8)['then'](handleEntityNotFound(_0x3f1b32,null))[_0xa0b4('0x27')](respondWithResult(_0x3f1b32,null))['catch'](handleError(_0x3f1b32,null));};exports[_0xa0b4('0x4a')]=function(_0x4ca1bc,_0x3bf3b9){return db[_0xa0b4('0x2e')][_0xa0b4('0x4a')](_0x4ca1bc[_0xa0b4('0x4b')],{})[_0xa0b4('0x27')](respondWithResult(_0x3bf3b9,0xc9))['catch'](handleError(_0x3bf3b9,null));};exports[_0xa0b4('0x26')]=function(_0x339536,_0x272ac5){if(_0x339536[_0xa0b4('0x4b')]['id']){delete _0x339536['body']['id'];}return db[_0xa0b4('0x2e')][_0xa0b4('0x49')]({'where':{'id':_0x339536[_0xa0b4('0x47')]['id']}})[_0xa0b4('0x27')](handleEntityNotFound(_0x272ac5,null))[_0xa0b4('0x27')](saveUpdates(_0x339536[_0xa0b4('0x4b')],null))[_0xa0b4('0x27')](respondWithResult(_0x272ac5,null))['catch'](handleError(_0x272ac5,null));};exports['destroy']=function(_0x176c4c,_0x32f4cd){return db['ZohoConfiguration'][_0xa0b4('0x49')]({'where':{'id':_0x176c4c[_0xa0b4('0x47')]['id']}})[_0xa0b4('0x27')](handleEntityNotFound(_0x32f4cd,null))[_0xa0b4('0x27')](removeEntity(_0x32f4cd,null))[_0xa0b4('0x45')](handleError(_0x32f4cd,null));};exports[_0xa0b4('0x4c')]=function(_0x49dbf1,_0x3dc1b5,_0x15cf08){var _0xdc869b={};var _0xe82baa={};var _0x5f1229;var _0x31f71c;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x49dbf1[_0xa0b4('0x47')]['id']}})[_0xa0b4('0x27')](handleEntityNotFound(_0x3dc1b5,null))[_0xa0b4('0x27')](function(_0x195ff1){if(_0x195ff1){_0x5f1229=_0x195ff1;_0xe82baa['model']=_['keys'](db['ZohoField'][_0xa0b4('0x2f')]);_0xe82baa[_0xa0b4('0x33')]=_[_0xa0b4('0x32')](_0x49dbf1[_0xa0b4('0x33')]);_0xe82baa[_0xa0b4('0x34')]=_['intersection'](_0xe82baa['model'],_0xe82baa[_0xa0b4('0x33')]);_0xdc869b['attributes']=_['intersection'](_0xe82baa['model'],qs[_0xa0b4('0x37')](_0x49dbf1['query'][_0xa0b4('0x37')]));_0xdc869b[_0xa0b4('0x36')]=_0xdc869b[_0xa0b4('0x36')][_0xa0b4('0x38')]?_0xdc869b['attributes']:_0xe82baa[_0xa0b4('0x31')];_0xdc869b['order']=qs[_0xa0b4('0x3b')](_0x49dbf1[_0xa0b4('0x33')]['sort']);_0xdc869b[_0xa0b4('0x3e')]=qs[_0xa0b4('0x34')](_[_0xa0b4('0x3c')](_0x49dbf1[_0xa0b4('0x33')],_0xe82baa[_0xa0b4('0x34')]));if(_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x3d')]){_0xdc869b['where']=_['merge'](_0xdc869b[_0xa0b4('0x3e')],{'$or':_[_0xa0b4('0x2d')](_0xdc869b['attributes'],function(_0xee2cb0){var _0x432a26={};_0x432a26[_0xee2cb0]={'$like':'%'+_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x3d')]+'%'};return _0x432a26;})});}_0xdc869b=_['merge']({},_0xdc869b,_0x49dbf1[_0xa0b4('0x48')]);return _0x5f1229[_0xa0b4('0x4c')](_0xdc869b);}})['then'](function(_0x2a54aa){if(_0x2a54aa){_0x31f71c=_0x2a54aa['length'];if(!_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x4d')](_0xa0b4('0x39'))){_0xdc869b[_0xa0b4('0x20')]=qs[_0xa0b4('0x20')](_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x20')]);_0xdc869b['offset']=qs[_0xa0b4('0x1e')](_0x49dbf1[_0xa0b4('0x33')][_0xa0b4('0x1e')]);}return _0x5f1229[_0xa0b4('0x4c')](_0xdc869b);}})[_0xa0b4('0x27')](function(_0x28dd7c){if(_0x28dd7c){return _0x28dd7c?{'count':_0x31f71c,'rows':_0x28dd7c}:null;}})[_0xa0b4('0x27')](respondWithResult(_0x3dc1b5,null))[_0xa0b4('0x45')](handleError(_0x3dc1b5,null));};exports[_0xa0b4('0x4e')]=function(_0x3ad195,_0x3d106b,_0x1d7f0f){var _0x52e0ff={};var _0x3237bb={};var _0x1c9c11;var _0x52629b;return db[_0xa0b4('0x2e')][_0xa0b4('0x4f')]({'where':{'id':_0x3ad195[_0xa0b4('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d106b,null))[_0xa0b4('0x27')](function(_0x279479){if(_0x279479){_0x1c9c11=_0x279479;_0x3237bb['model']=_['keys'](db[_0xa0b4('0x50')][_0xa0b4('0x2f')]);_0x3237bb[_0xa0b4('0x33')]=_[_0xa0b4('0x32')](_0x3ad195[_0xa0b4('0x33')]);_0x3237bb[_0xa0b4('0x34')]=_[_0xa0b4('0x35')](_0x3237bb['model'],_0x3237bb['query']);_0x52e0ff[_0xa0b4('0x36')]=_[_0xa0b4('0x35')](_0x3237bb[_0xa0b4('0x31')],qs[_0xa0b4('0x37')](_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x37')]));_0x52e0ff[_0xa0b4('0x36')]=_0x52e0ff[_0xa0b4('0x36')][_0xa0b4('0x38')]?_0x52e0ff[_0xa0b4('0x36')]:_0x3237bb[_0xa0b4('0x31')];_0x52e0ff[_0xa0b4('0x3a')]=qs[_0xa0b4('0x3b')](_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x3b')]);_0x52e0ff['where']=qs['filters'](_[_0xa0b4('0x3c')](_0x3ad195[_0xa0b4('0x33')],_0x3237bb[_0xa0b4('0x34')]));if(_0x3ad195['query'][_0xa0b4('0x3d')]){_0x52e0ff['where']=_['merge'](_0x52e0ff['where'],{'$or':_[_0xa0b4('0x2d')](_0x52e0ff[_0xa0b4('0x36')],function(_0x350f37){var _0x50a12e={};_0x50a12e[_0x350f37]={'$like':'%'+_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x3d')]+'%'};return _0x50a12e;})});}_0x52e0ff=_[_0xa0b4('0x40')]({},_0x52e0ff,_0x3ad195['options']);return _0x1c9c11[_0xa0b4('0x4e')](_0x52e0ff);}})['then'](function(_0x5c59dd){if(_0x5c59dd){_0x52629b=_0x5c59dd['length'];if(!_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x4d')](_0xa0b4('0x39'))){_0x52e0ff['limit']=qs['limit'](_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x20')]);_0x52e0ff[_0xa0b4('0x1e')]=qs[_0xa0b4('0x1e')](_0x3ad195[_0xa0b4('0x33')][_0xa0b4('0x1e')]);}return _0x1c9c11[_0xa0b4('0x4e')](_0x52e0ff);}})[_0xa0b4('0x27')](function(_0x2c8a68){if(_0x2c8a68){return _0x2c8a68?{'count':_0x52629b,'rows':_0x2c8a68}:null;}})[_0xa0b4('0x27')](respondWithResult(_0x3d106b,null))[_0xa0b4('0x45')](handleError(_0x3d106b,null));};exports['getDescriptions']=function(_0x1439f6,_0x410cf2,_0x4ecbbb){var _0xe48a42={};var _0x452b89={};var _0x3914a3;var _0x7a13ae;return db['ZohoConfiguration'][_0xa0b4('0x4f')]({'where':{'id':_0x1439f6[_0xa0b4('0x47')]['id']}})[_0xa0b4('0x27')](handleEntityNotFound(_0x410cf2,null))[_0xa0b4('0x27')](function(_0x45a8f0){if(_0x45a8f0){_0x3914a3=_0x45a8f0;_0x452b89[_0xa0b4('0x31')]=_[_0xa0b4('0x32')](db[_0xa0b4('0x50')][_0xa0b4('0x2f')]);_0x452b89[_0xa0b4('0x33')]=_['keys'](_0x1439f6[_0xa0b4('0x33')]);_0x452b89['filters']=_[_0xa0b4('0x35')](_0x452b89[_0xa0b4('0x31')],_0x452b89['query']);_0xe48a42[_0xa0b4('0x36')]=_[_0xa0b4('0x35')](_0x452b89[_0xa0b4('0x31')],qs[_0xa0b4('0x37')](_0x1439f6[_0xa0b4('0x33')][_0xa0b4('0x37')]));_0xe48a42['attributes']=_0xe48a42[_0xa0b4('0x36')]['length']?_0xe48a42[_0xa0b4('0x36')]:_0x452b89['model'];_0xe48a42['order']=qs[_0xa0b4('0x3b')](_0x1439f6['query'][_0xa0b4('0x3b')]);_0xe48a42[_0xa0b4('0x3e')]=qs[_0xa0b4('0x34')](_['pick'](_0x1439f6['query'],_0x452b89[_0xa0b4('0x34')]));if(_0x1439f6[_0xa0b4('0x33')]['filter']){_0xe48a42[_0xa0b4('0x3e')]=_[_0xa0b4('0x40')](_0xe48a42['where'],{'$or':_[_0xa0b4('0x2d')](_0xe48a42['attributes'],function(_0x3552c5){var _0x59fc05={};_0x59fc05[_0x3552c5]={'$like':'%'+_0x1439f6[_0xa0b4('0x33')]['filter']+'%'};return _0x59fc05;})});}_0xe48a42=_[_0xa0b4('0x40')]({},_0xe48a42,_0x1439f6[_0xa0b4('0x48')]);return _0x3914a3['getDescriptions'](_0xe48a42);}})[_0xa0b4('0x27')](function(_0x4085f5){if(_0x4085f5){_0x7a13ae=_0x4085f5['length'];if(!_0x1439f6[_0xa0b4('0x33')]['hasOwnProperty'](_0xa0b4('0x39'))){_0xe48a42[_0xa0b4('0x20')]=qs['limit'](_0x1439f6[_0xa0b4('0x33')][_0xa0b4('0x20')]);_0xe48a42[_0xa0b4('0x1e')]=qs[_0xa0b4('0x1e')](_0x1439f6['query'][_0xa0b4('0x1e')]);}return _0x3914a3['getDescriptions'](_0xe48a42);}})['then'](function(_0x88bd7a){if(_0x88bd7a){return _0x88bd7a?{'count':_0x7a13ae,'rows':_0x88bd7a}:null;}})[_0xa0b4('0x27')](respondWithResult(_0x410cf2,null))['catch'](handleError(_0x410cf2,null));}; \ No newline at end of file +var _0x5f10=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getFields','ZohoField','sort','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','util','path','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','reject','update','then','end','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick'];(function(_0x258cff,_0x294e15){var _0x4cb7be=function(_0x10d4a0){while(--_0x10d4a0){_0x258cff['push'](_0x258cff['shift']());}};_0x4cb7be(++_0x294e15);}(_0x5f10,0x1d8));var _0x05f1=function(_0x272d97,_0x3cb745){_0x272d97=_0x272d97-0x0;var _0x40fc01=_0x5f10[_0x272d97];return _0x40fc01;};'use strict';var emlformat=require(_0x05f1('0x0'));var rimraf=require(_0x05f1('0x1'));var zipdir=require(_0x05f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05f1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x05f1('0x4'));var path=require(_0x05f1('0x5'));var sox=require('sox');var csv=require(_0x05f1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05f1('0x7'));var _=require(_0x05f1('0x8'));var squel=require(_0x05f1('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x05f1('0x6'));var querystring=require(_0x05f1('0xa'));var Papa=require('papaparse');var Redis=require(_0x05f1('0xb'));var authService=require(_0x05f1('0xc'));var qs=require(_0x05f1('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05f1('0xe'));var logger=require(_0x05f1('0xf'))(_0x05f1('0x10'));var utils=require(_0x05f1('0x11'));var config=require(_0x05f1('0x12'));var licenseUtil=require(_0x05f1('0x13'));var db=require(_0x05f1('0x14'))['db'];function respondWithStatusCode(_0x5c81ba,_0x275d94){_0x275d94=_0x275d94||0xcc;return function(_0x232af0){if(_0x232af0){return _0x5c81ba['sendStatus'](_0x275d94);}return _0x5c81ba[_0x05f1('0x15')](_0x275d94)['end']();};}function respondWithResult(_0x13fa52,_0x43680b){_0x43680b=_0x43680b||0xc8;return function(_0x3d4c48){if(_0x3d4c48){return _0x13fa52[_0x05f1('0x15')](_0x43680b)['json'](_0x3d4c48);}};}function respondWithFilteredResult(_0x1757e6,_0x57a9c8){return function(_0xaa6457){if(_0xaa6457){var _0xbea03f=typeof _0x57a9c8[_0x05f1('0x16')]===_0x05f1('0x17')&&typeof _0x57a9c8['limit']==='undefined';var _0x187054=_0xaa6457[_0x05f1('0x18')];var _0x30cda6=_0xbea03f?0x0:_0x57a9c8[_0x05f1('0x16')];var _0x2a822e=_0xbea03f?_0xaa6457['count']:_0x57a9c8[_0x05f1('0x16')]+_0x57a9c8[_0x05f1('0x19')];var _0x2e0c92;if(_0x2a822e>=_0x187054){_0x2a822e=_0x187054;_0x2e0c92=0xc8;}else{_0x2e0c92=0xce;}_0x1757e6[_0x05f1('0x15')](_0x2e0c92);return _0x1757e6['set'](_0x05f1('0x1a'),_0x30cda6+'-'+_0x2a822e+'/'+_0x187054)[_0x05f1('0x1b')](_0xaa6457);}return null;};}function patchUpdates(_0x4c4232){return function(_0xef8310){try{jsonpatch['apply'](_0xef8310,_0x4c4232,!![]);}catch(_0x1f05ae){return BPromise[_0x05f1('0x1c')](_0x1f05ae);}return _0xef8310['save']();};}function saveUpdates(_0x40b8a4,_0x1a2a54){return function(_0x324d3a){if(_0x324d3a){return _0x324d3a[_0x05f1('0x1d')](_0x40b8a4)[_0x05f1('0x1e')](function(_0x492a07){return _0x492a07;});}return null;};}function removeEntity(_0x51cae4,_0x49ff6d){return function(_0x4af95a){if(_0x4af95a){return _0x4af95a['destroy']()['then'](function(){_0x51cae4[_0x05f1('0x15')](0xcc)[_0x05f1('0x1f')]();});}};}function handleEntityNotFound(_0x5109c6,_0x4b79c1){return function(_0x737a6c){if(!_0x737a6c){_0x5109c6['sendStatus'](0x194);}return _0x737a6c;};}function handleError(_0x72714b,_0x55eec5){_0x55eec5=_0x55eec5||0x1f4;return function(_0x18cdab){logger[_0x05f1('0x20')](_0x18cdab[_0x05f1('0x21')]);if(_0x18cdab[_0x05f1('0x22')]){delete _0x18cdab[_0x05f1('0x22')];}_0x72714b['status'](_0x55eec5)[_0x05f1('0x23')](_0x18cdab);};}exports[_0x05f1('0x24')]=function(_0x546df0,_0x567e14){var _0x4ac51c={},_0x53fb66={},_0x318142={'count':0x0,'rows':[]};var _0x152931=_[_0x05f1('0x25')](db[_0x05f1('0x26')][_0x05f1('0x27')],function(_0x546722){return{'name':_0x546722['fieldName'],'type':_0x546722['type'][_0x05f1('0x28')]};});_0x53fb66[_0x05f1('0x29')]=_[_0x05f1('0x25')](_0x152931,_0x05f1('0x22'));_0x53fb66['query']=_[_0x05f1('0x2a')](_0x546df0[_0x05f1('0x2b')]);_0x53fb66[_0x05f1('0x2c')]=_[_0x05f1('0x2d')](_0x53fb66[_0x05f1('0x29')],_0x53fb66[_0x05f1('0x2b')]);_0x4ac51c[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x53fb66['model'],qs[_0x05f1('0x2f')](_0x546df0[_0x05f1('0x2b')]['fields']));_0x4ac51c[_0x05f1('0x2e')]=_0x4ac51c[_0x05f1('0x2e')][_0x05f1('0x30')]?_0x4ac51c['attributes']:_0x53fb66[_0x05f1('0x29')];if(!_0x546df0[_0x05f1('0x2b')]['hasOwnProperty'](_0x05f1('0x31'))){_0x4ac51c['limit']=qs[_0x05f1('0x19')](_0x546df0[_0x05f1('0x2b')][_0x05f1('0x19')]);_0x4ac51c['offset']=qs[_0x05f1('0x16')](_0x546df0[_0x05f1('0x2b')][_0x05f1('0x16')]);}_0x4ac51c[_0x05f1('0x32')]=qs['sort'](_0x546df0['query']['sort']);_0x4ac51c[_0x05f1('0x33')]=qs['filters'](_[_0x05f1('0x34')](_0x546df0[_0x05f1('0x2b')],_0x53fb66[_0x05f1('0x2c')]),_0x152931);if(_0x546df0['query'][_0x05f1('0x35')]){_0x4ac51c[_0x05f1('0x33')]=_[_0x05f1('0x36')](_0x4ac51c['where'],{'$or':_[_0x05f1('0x25')](_0x152931,function(_0x5e4cb1){if(_0x5e4cb1[_0x05f1('0x37')]!==_0x05f1('0x38')){var _0x340efb={};_0x340efb[_0x5e4cb1[_0x05f1('0x22')]]={'$like':'%'+_0x546df0[_0x05f1('0x2b')][_0x05f1('0x35')]+'%'};return _0x340efb;}})});}_0x4ac51c=_[_0x05f1('0x36')]({},_0x4ac51c,_0x546df0[_0x05f1('0x39')]);var _0x19d7eb={'where':_0x4ac51c[_0x05f1('0x33')]};return db[_0x05f1('0x26')][_0x05f1('0x18')](_0x19d7eb)[_0x05f1('0x1e')](function(_0x3f184d){_0x318142[_0x05f1('0x18')]=_0x3f184d;if(_0x546df0[_0x05f1('0x2b')][_0x05f1('0x3a')]){_0x4ac51c[_0x05f1('0x3b')]=[{'all':!![]}];}return db[_0x05f1('0x26')][_0x05f1('0x3c')](_0x4ac51c);})['then'](function(_0x1f90d1){_0x318142[_0x05f1('0x3d')]=_0x1f90d1;return _0x318142;})['then'](respondWithFilteredResult(_0x567e14,_0x4ac51c))[_0x05f1('0x3e')](handleError(_0x567e14,null));};exports['show']=function(_0x176938,_0x9ea9c9){var _0x534ad9={'raw':![],'where':{'id':_0x176938[_0x05f1('0x3f')]['id']}},_0x15a5cc={};_0x15a5cc[_0x05f1('0x29')]=_['keys'](db[_0x05f1('0x26')][_0x05f1('0x27')]);_0x15a5cc[_0x05f1('0x2b')]=_[_0x05f1('0x2a')](_0x176938['query']);_0x15a5cc[_0x05f1('0x2c')]=_[_0x05f1('0x2d')](_0x15a5cc[_0x05f1('0x29')],_0x15a5cc[_0x05f1('0x2b')]);_0x534ad9[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x15a5cc['model'],qs[_0x05f1('0x2f')](_0x176938[_0x05f1('0x2b')][_0x05f1('0x2f')]));_0x534ad9['attributes']=_0x534ad9['attributes'][_0x05f1('0x30')]?_0x534ad9['attributes']:_0x15a5cc['model'];if(_0x176938[_0x05f1('0x2b')][_0x05f1('0x3a')]){_0x534ad9[_0x05f1('0x3b')]=[{'all':!![]}];}_0x534ad9=_[_0x05f1('0x36')]({},_0x534ad9,_0x176938[_0x05f1('0x39')]);return db['ZohoConfiguration'][_0x05f1('0x40')](_0x534ad9)[_0x05f1('0x1e')](handleEntityNotFound(_0x9ea9c9,null))[_0x05f1('0x1e')](respondWithResult(_0x9ea9c9,null))[_0x05f1('0x3e')](handleError(_0x9ea9c9,null));};exports[_0x05f1('0x41')]=function(_0x275b10,_0x568085){return db[_0x05f1('0x26')][_0x05f1('0x41')](_0x275b10[_0x05f1('0x42')],{})['then'](respondWithResult(_0x568085,0xc9))[_0x05f1('0x3e')](handleError(_0x568085,null));};exports[_0x05f1('0x1d')]=function(_0x59163c,_0x52a893){if(_0x59163c[_0x05f1('0x42')]['id']){delete _0x59163c[_0x05f1('0x42')]['id'];}return db[_0x05f1('0x26')][_0x05f1('0x40')]({'where':{'id':_0x59163c[_0x05f1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x52a893,null))[_0x05f1('0x1e')](saveUpdates(_0x59163c[_0x05f1('0x42')],null))[_0x05f1('0x1e')](respondWithResult(_0x52a893,null))[_0x05f1('0x3e')](handleError(_0x52a893,null));};exports[_0x05f1('0x43')]=function(_0x5a4d3c,_0x4e8e22){return db['ZohoConfiguration'][_0x05f1('0x40')]({'where':{'id':_0x5a4d3c[_0x05f1('0x3f')]['id']}})[_0x05f1('0x1e')](handleEntityNotFound(_0x4e8e22,null))[_0x05f1('0x1e')](removeEntity(_0x4e8e22,null))[_0x05f1('0x3e')](handleError(_0x4e8e22,null));};exports[_0x05f1('0x44')]=function(_0x36afed,_0xcc37b4,_0x463215){var _0x5bfff7={};var _0x43c34e={};var _0x67630;var _0x50bf5f;return db[_0x05f1('0x26')]['findOne']({'where':{'id':_0x36afed[_0x05f1('0x3f')]['id']}})[_0x05f1('0x1e')](handleEntityNotFound(_0xcc37b4,null))['then'](function(_0x180c08){if(_0x180c08){_0x67630=_0x180c08;_0x43c34e['model']=_[_0x05f1('0x2a')](db[_0x05f1('0x45')][_0x05f1('0x27')]);_0x43c34e['query']=_[_0x05f1('0x2a')](_0x36afed[_0x05f1('0x2b')]);_0x43c34e['filters']=_[_0x05f1('0x2d')](_0x43c34e[_0x05f1('0x29')],_0x43c34e[_0x05f1('0x2b')]);_0x5bfff7[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x43c34e[_0x05f1('0x29')],qs[_0x05f1('0x2f')](_0x36afed[_0x05f1('0x2b')][_0x05f1('0x2f')]));_0x5bfff7[_0x05f1('0x2e')]=_0x5bfff7[_0x05f1('0x2e')][_0x05f1('0x30')]?_0x5bfff7['attributes']:_0x43c34e['model'];_0x5bfff7[_0x05f1('0x32')]=qs[_0x05f1('0x46')](_0x36afed['query'][_0x05f1('0x46')]);_0x5bfff7[_0x05f1('0x33')]=qs[_0x05f1('0x2c')](_[_0x05f1('0x34')](_0x36afed[_0x05f1('0x2b')],_0x43c34e[_0x05f1('0x2c')]));if(_0x36afed[_0x05f1('0x2b')][_0x05f1('0x35')]){_0x5bfff7[_0x05f1('0x33')]=_[_0x05f1('0x36')](_0x5bfff7['where'],{'$or':_[_0x05f1('0x25')](_0x5bfff7['attributes'],function(_0x438ade){var _0x3eaf94={};_0x3eaf94[_0x438ade]={'$like':'%'+_0x36afed[_0x05f1('0x2b')][_0x05f1('0x35')]+'%'};return _0x3eaf94;})});}_0x5bfff7=_[_0x05f1('0x36')]({},_0x5bfff7,_0x36afed[_0x05f1('0x39')]);return _0x67630[_0x05f1('0x44')](_0x5bfff7);}})['then'](function(_0x295d6f){if(_0x295d6f){_0x50bf5f=_0x295d6f[_0x05f1('0x30')];if(!_0x36afed[_0x05f1('0x2b')][_0x05f1('0x47')]('nolimit')){_0x5bfff7[_0x05f1('0x19')]=qs[_0x05f1('0x19')](_0x36afed[_0x05f1('0x2b')][_0x05f1('0x19')]);_0x5bfff7[_0x05f1('0x16')]=qs['offset'](_0x36afed[_0x05f1('0x2b')][_0x05f1('0x16')]);}return _0x67630['getFields'](_0x5bfff7);}})[_0x05f1('0x1e')](function(_0x9bdc13){if(_0x9bdc13){return _0x9bdc13?{'count':_0x50bf5f,'rows':_0x9bdc13}:null;}})['then'](respondWithResult(_0xcc37b4,null))['catch'](handleError(_0xcc37b4,null));};exports[_0x05f1('0x48')]=function(_0x3ec4ec,_0x40208b,_0x17a5d9){var _0xb3f5cc={};var _0x23aeab={};var _0x233edc;var _0x319660;return db[_0x05f1('0x26')][_0x05f1('0x49')]({'where':{'id':_0x3ec4ec[_0x05f1('0x3f')]['id']}})[_0x05f1('0x1e')](handleEntityNotFound(_0x40208b,null))[_0x05f1('0x1e')](function(_0x2da33c){if(_0x2da33c){_0x233edc=_0x2da33c;_0x23aeab[_0x05f1('0x29')]=_[_0x05f1('0x2a')](db[_0x05f1('0x45')][_0x05f1('0x27')]);_0x23aeab[_0x05f1('0x2b')]=_[_0x05f1('0x2a')](_0x3ec4ec[_0x05f1('0x2b')]);_0x23aeab[_0x05f1('0x2c')]=_[_0x05f1('0x2d')](_0x23aeab[_0x05f1('0x29')],_0x23aeab[_0x05f1('0x2b')]);_0xb3f5cc[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x23aeab[_0x05f1('0x29')],qs['fields'](_0x3ec4ec[_0x05f1('0x2b')]['fields']));_0xb3f5cc[_0x05f1('0x2e')]=_0xb3f5cc[_0x05f1('0x2e')][_0x05f1('0x30')]?_0xb3f5cc[_0x05f1('0x2e')]:_0x23aeab[_0x05f1('0x29')];_0xb3f5cc[_0x05f1('0x32')]=qs['sort'](_0x3ec4ec[_0x05f1('0x2b')][_0x05f1('0x46')]);_0xb3f5cc[_0x05f1('0x33')]=qs[_0x05f1('0x2c')](_[_0x05f1('0x34')](_0x3ec4ec[_0x05f1('0x2b')],_0x23aeab[_0x05f1('0x2c')]));if(_0x3ec4ec[_0x05f1('0x2b')]['filter']){_0xb3f5cc[_0x05f1('0x33')]=_[_0x05f1('0x36')](_0xb3f5cc[_0x05f1('0x33')],{'$or':_[_0x05f1('0x25')](_0xb3f5cc[_0x05f1('0x2e')],function(_0x30f4b9){var _0x3bbd25={};_0x3bbd25[_0x30f4b9]={'$like':'%'+_0x3ec4ec[_0x05f1('0x2b')][_0x05f1('0x35')]+'%'};return _0x3bbd25;})});}_0xb3f5cc=_[_0x05f1('0x36')]({},_0xb3f5cc,_0x3ec4ec[_0x05f1('0x39')]);return _0x233edc['getSubjects'](_0xb3f5cc);}})['then'](function(_0x1447fc){if(_0x1447fc){_0x319660=_0x1447fc[_0x05f1('0x30')];if(!_0x3ec4ec[_0x05f1('0x2b')]['hasOwnProperty'](_0x05f1('0x31'))){_0xb3f5cc['limit']=qs[_0x05f1('0x19')](_0x3ec4ec[_0x05f1('0x2b')][_0x05f1('0x19')]);_0xb3f5cc['offset']=qs[_0x05f1('0x16')](_0x3ec4ec[_0x05f1('0x2b')][_0x05f1('0x16')]);}return _0x233edc[_0x05f1('0x48')](_0xb3f5cc);}})[_0x05f1('0x1e')](function(_0x778e6f){if(_0x778e6f){return _0x778e6f?{'count':_0x319660,'rows':_0x778e6f}:null;}})['then'](respondWithResult(_0x40208b,null))[_0x05f1('0x3e')](handleError(_0x40208b,null));};exports[_0x05f1('0x4a')]=function(_0x4ff7b8,_0x539202,_0x23f44a){var _0x7edb39={};var _0x166834={};var _0x4d1229;var _0x1b58e9;return db[_0x05f1('0x26')][_0x05f1('0x49')]({'where':{'id':_0x4ff7b8[_0x05f1('0x3f')]['id']}})[_0x05f1('0x1e')](handleEntityNotFound(_0x539202,null))[_0x05f1('0x1e')](function(_0x4e1fa7){if(_0x4e1fa7){_0x4d1229=_0x4e1fa7;_0x166834[_0x05f1('0x29')]=_['keys'](db[_0x05f1('0x45')][_0x05f1('0x27')]);_0x166834['query']=_[_0x05f1('0x2a')](_0x4ff7b8['query']);_0x166834[_0x05f1('0x2c')]=_[_0x05f1('0x2d')](_0x166834[_0x05f1('0x29')],_0x166834[_0x05f1('0x2b')]);_0x7edb39[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x166834['model'],qs[_0x05f1('0x2f')](_0x4ff7b8[_0x05f1('0x2b')][_0x05f1('0x2f')]));_0x7edb39[_0x05f1('0x2e')]=_0x7edb39[_0x05f1('0x2e')][_0x05f1('0x30')]?_0x7edb39['attributes']:_0x166834[_0x05f1('0x29')];_0x7edb39[_0x05f1('0x32')]=qs[_0x05f1('0x46')](_0x4ff7b8['query'][_0x05f1('0x46')]);_0x7edb39[_0x05f1('0x33')]=qs[_0x05f1('0x2c')](_[_0x05f1('0x34')](_0x4ff7b8[_0x05f1('0x2b')],_0x166834['filters']));if(_0x4ff7b8[_0x05f1('0x2b')]['filter']){_0x7edb39[_0x05f1('0x33')]=_[_0x05f1('0x36')](_0x7edb39[_0x05f1('0x33')],{'$or':_[_0x05f1('0x25')](_0x7edb39['attributes'],function(_0x2cb0e3){var _0x54a0f9={};_0x54a0f9[_0x2cb0e3]={'$like':'%'+_0x4ff7b8[_0x05f1('0x2b')][_0x05f1('0x35')]+'%'};return _0x54a0f9;})});}_0x7edb39=_[_0x05f1('0x36')]({},_0x7edb39,_0x4ff7b8[_0x05f1('0x39')]);return _0x4d1229[_0x05f1('0x4a')](_0x7edb39);}})[_0x05f1('0x1e')](function(_0x2d0484){if(_0x2d0484){_0x1b58e9=_0x2d0484['length'];if(!_0x4ff7b8[_0x05f1('0x2b')][_0x05f1('0x47')](_0x05f1('0x31'))){_0x7edb39[_0x05f1('0x19')]=qs[_0x05f1('0x19')](_0x4ff7b8[_0x05f1('0x2b')][_0x05f1('0x19')]);_0x7edb39[_0x05f1('0x16')]=qs[_0x05f1('0x16')](_0x4ff7b8[_0x05f1('0x2b')]['offset']);}return _0x4d1229[_0x05f1('0x4a')](_0x7edb39);}})[_0x05f1('0x1e')](function(_0x315e39){if(_0x315e39){return _0x315e39?{'count':_0x1b58e9,'rows':_0x315e39}:null;}})['then'](respondWithResult(_0x539202,null))[_0x05f1('0x3e')](handleError(_0x539202,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index a8a74fa..73fba5d 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 _0x0ead=['int_zoho_configurations','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration'];(function(_0x2cc5cb,_0x4119c5){var _0x237d11=function(_0x362d07){while(--_0x362d07){_0x2cc5cb['push'](_0x2cc5cb['shift']());}};_0x237d11(++_0x4119c5);}(_0x0ead,0x1c3));var _0xd0ea=function(_0x41d9e3,_0xe5904b){_0x41d9e3=_0x41d9e3-0x0;var _0x47305d=_0x0ead[_0x41d9e3];return _0x47305d;};'use strict';var _=require('lodash');var util=require(_0xd0ea('0x0'));var logger=require(_0xd0ea('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd0ea('0x2'));var rp=require(_0xd0ea('0x3'));var fs=require('fs');var path=require(_0xd0ea('0x4'));var rimraf=require(_0xd0ea('0x5'));var config=require(_0xd0ea('0x6'));var attributes=require(_0xd0ea('0x7'));module['exports']=function(_0x47d25c,_0x110da1){return _0x47d25c['define'](_0xd0ea('0x8'),attributes,{'tableName':_0xd0ea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3106=['exports','define','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes'];(function(_0x5543ea,_0x505218){var _0x3f47ee=function(_0x5597f4){while(--_0x5597f4){_0x5543ea['push'](_0x5543ea['shift']());}};_0x3f47ee(++_0x505218);}(_0x3106,0x84));var _0x6310=function(_0x545ed9,_0x38eac9){_0x545ed9=_0x545ed9-0x0;var _0x4c4107=_0x3106[_0x545ed9];return _0x4c4107;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6310('0x0'))(_0x6310('0x1'));var moment=require(_0x6310('0x2'));var BPromise=require(_0x6310('0x3'));var rp=require(_0x6310('0x4'));var fs=require('fs');var path=require(_0x6310('0x5'));var rimraf=require(_0x6310('0x6'));var config=require('../../config/environment');var attributes=require(_0x6310('0x7'));module[_0x6310('0x8')]=function(_0x1cd8a3,_0x382996){return _0x1cd8a3[_0x6310('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index caf87e4..d9ff475 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 _0x94a1=['../../config/logger','../../config/environment','jayson/promise','client','request','info','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x94a1,0x177));var _0x194a=function(_0x304cfa,_0x264fc0){_0x304cfa=_0x304cfa-0x0;var _0x2389d0=_0x94a1[_0x304cfa];return _0x2389d0;};'use strict';var _=require(_0x194a('0x0'));var util=require('util');var moment=require(_0x194a('0x1'));var BPromise=require(_0x194a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x194a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x194a('0x4'));var logger=require(_0x194a('0x5'))('rpc');var config=require(_0x194a('0x6'));var jayson=require(_0x194a('0x7'));var client=jayson[_0x194a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1719b1,_0x2e4488,_0x1c41da){return new BPromise(function(_0x3e8af8,_0x5c0adc){return client[_0x194a('0x9')](_0x1719b1,_0x1c41da)['then'](function(_0x13ffe0){logger[_0x194a('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x2e4488,'request\x20sent');logger['debug'](_0x194a('0xb'),_0x2e4488,'request\x20sent',JSON[_0x194a('0xc')](_0x13ffe0));if(_0x13ffe0[_0x194a('0xd')]){if(_0x13ffe0[_0x194a('0xd')][_0x194a('0xe')]===0x1f4){logger[_0x194a('0xd')](_0x194a('0xf'),_0x2e4488,_0x13ffe0[_0x194a('0xd')][_0x194a('0x10')]);return _0x5c0adc(_0x13ffe0[_0x194a('0xd')]['message']);}logger[_0x194a('0xd')](_0x194a('0xf'),_0x2e4488,_0x13ffe0['error'][_0x194a('0x10')]);return _0x3e8af8(_0x13ffe0[_0x194a('0xd')][_0x194a('0x10')]);}else{logger[_0x194a('0xa')](_0x194a('0xf'),_0x2e4488,_0x194a('0x11'));_0x3e8af8(_0x13ffe0[_0x194a('0x12')][_0x194a('0x10')]);}})[_0x194a('0x13')](function(_0x1ca074){logger[_0x194a('0xd')](_0x194a('0xf'),_0x2e4488,_0x1ca074);_0x5c0adc(_0x1ca074);});});} \ No newline at end of file +var _0x3aee=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x110230,_0x9327b4){var _0xef860f=function(_0x146037){while(--_0x146037){_0x110230['push'](_0x110230['shift']());}};_0xef860f(++_0x9327b4);}(_0x3aee,0x1c8));var _0xe3ae=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x3aee[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0xe3ae('0x0'));var util=require(_0xe3ae('0x1'));var moment=require(_0xe3ae('0x2'));var BPromise=require(_0xe3ae('0x3'));var rs=require(_0xe3ae('0x4'));var fs=require('fs');var Redis=require(_0xe3ae('0x5'));var db=require(_0xe3ae('0x6'))['db'];var utils=require(_0xe3ae('0x7'));var logger=require(_0xe3ae('0x8'))(_0xe3ae('0x9'));var config=require(_0xe3ae('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe3ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31bc7b,_0xf7c24,_0x20207){return new BPromise(function(_0x557932,_0x33d202){return client[_0xe3ae('0xc')](_0x31bc7b,_0x20207)[_0xe3ae('0xd')](function(_0x52b02e){logger['info'](_0xe3ae('0xe'),_0xf7c24,_0xe3ae('0xf'));logger[_0xe3ae('0x10')](_0xe3ae('0x11'),_0xf7c24,_0xe3ae('0xf'),JSON['stringify'](_0x52b02e));if(_0x52b02e['error']){if(_0x52b02e[_0xe3ae('0x12')][_0xe3ae('0x13')]===0x1f4){logger[_0xe3ae('0x12')](_0xe3ae('0xe'),_0xf7c24,_0x52b02e['error'][_0xe3ae('0x14')]);return _0x33d202(_0x52b02e['error'][_0xe3ae('0x14')]);}logger[_0xe3ae('0x12')](_0xe3ae('0xe'),_0xf7c24,_0x52b02e[_0xe3ae('0x12')][_0xe3ae('0x14')]);return _0x557932(_0x52b02e[_0xe3ae('0x12')][_0xe3ae('0x14')]);}else{logger[_0xe3ae('0x15')](_0xe3ae('0xe'),_0xf7c24,_0xe3ae('0xf'));_0x557932(_0x52b02e[_0xe3ae('0x16')]['message']);}})[_0xe3ae('0x17')](function(_0x3b6bdc){logger[_0xe3ae('0x12')](_0xe3ae('0xe'),_0xf7c24,_0x3b6bdc);_0x33d202(_0x3b6bdc);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 1ce7326..68bb52f 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 _0xc022=['multer','util','path','express','Router','../../components/interaction/service','./intZohoField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x4054fe,_0x18f33e){var _0x4f9bee=function(_0x3c304d){while(--_0x3c304d){_0x4054fe['push'](_0x4054fe['shift']());}};_0x4f9bee(++_0x18f33e);}(_0xc022,0x168));var _0x2c02=function(_0x2a5bb7,_0x3a0bf3){_0x2a5bb7=_0x2a5bb7-0x0;var _0x503330=_0xc022[_0x2a5bb7];return _0x503330;};'use strict';var multer=require(_0x2c02('0x0'));var util=require(_0x2c02('0x1'));var path=require(_0x2c02('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c02('0x3'));var router=express[_0x2c02('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c02('0x5'));var config=require('../../config/environment');var controller=require(_0x2c02('0x6'));router[_0x2c02('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2c02('0x8'),auth[_0x2c02('0x9')](),controller[_0x2c02('0xa')]);router[_0x2c02('0xb')]('/',auth['isAuthenticated'](),controller[_0x2c02('0xc')]);router[_0x2c02('0xd')](_0x2c02('0x8'),auth[_0x2c02('0x9')](),controller[_0x2c02('0xe')]);router[_0x2c02('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2c02('0x10')]);module[_0x2c02('0x11')]=router; \ No newline at end of file +var _0x6463=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2284bf,_0x3c614c){var _0x597431=function(_0xb7957d){while(--_0xb7957d){_0x2284bf['push'](_0x2284bf['shift']());}};_0x597431(++_0x3c614c);}(_0x6463,0xf6));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3646('0x0'));var util=require(_0x3646('0x1'));var path=require(_0x3646('0x2'));var timeout=require(_0x3646('0x3'));var express=require('express');var router=express[_0x3646('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3646('0x5'));var interaction=require(_0x3646('0x6'));var config=require(_0x3646('0x7'));var controller=require(_0x3646('0x8'));router[_0x3646('0x9')]('/',auth[_0x3646('0xa')](),controller[_0x3646('0xb')]);router[_0x3646('0x9')](_0x3646('0xc'),auth['isAuthenticated'](),controller[_0x3646('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3646('0xe')](_0x3646('0xc'),auth[_0x3646('0xa')](),controller['update']);router[_0x3646('0xf')](_0x3646('0xc'),auth[_0x3646('0xa')](),controller[_0x3646('0x10')]);module[_0x3646('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 967cf73..1dbdd0d 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 _0x466e=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x3eff21,_0x5bf36c){var _0x1945bb=function(_0x319a9e){while(--_0x319a9e){_0x3eff21['push'](_0x3eff21['shift']());}};_0x1945bb(++_0x5bf36c);}(_0x466e,0x1c5));var _0xe466=function(_0xdb2efd,_0x5b6bd0){_0xdb2efd=_0xdb2efd-0x0;var _0x117404=_0x466e[_0xdb2efd];return _0x117404;};'use strict';var Sequelize=require(_0xe466('0x0'));module[_0xe466('0x1')]={'type':{'type':Sequelize[_0xe466('0x2')](_0xe466('0x3'),'variable',_0xe466('0x4'),_0xe466('0x5'),_0xe466('0x6')),'defaultValue':_0xe466('0x3')},'content':{'type':Sequelize[_0xe466('0x7')]},'key':{'type':Sequelize[_0xe466('0x7')]},'keyType':{'type':Sequelize[_0xe466('0x2')](_0xe466('0x3'),_0xe466('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xe466('0x7')]},'idField':{'type':Sequelize[_0xe466('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe466('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbdb2=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x25076d,_0x1d442a){var _0x4486a0=function(_0x5d4ba0){while(--_0x5d4ba0){_0x25076d['push'](_0x25076d['shift']());}};_0x4486a0(++_0x1d442a);}(_0xbdb2,0xf5));var _0x2bdb=function(_0x3942e2,_0x341872){_0x3942e2=_0x3942e2-0x0;var _0x47bdc4=_0xbdb2[_0x3942e2];return _0x47bdc4;};'use strict';var Sequelize=require(_0x2bdb('0x0'));module[_0x2bdb('0x1')]={'type':{'type':Sequelize[_0x2bdb('0x2')](_0x2bdb('0x3'),_0x2bdb('0x4'),_0x2bdb('0x5'),_0x2bdb('0x6'),_0x2bdb('0x7')),'defaultValue':_0x2bdb('0x3')},'content':{'type':Sequelize[_0x2bdb('0x8')]},'key':{'type':Sequelize[_0x2bdb('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2bdb('0x4'),_0x2bdb('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2bdb('0x8')]},'nameField':{'type':Sequelize[_0x2bdb('0x8')]},'customField':{'type':Sequelize[_0x2bdb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2bdb('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 78ac736..aa83b73 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 _0x722d=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZohoField','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3d4bd8,_0x57edb9){var _0x2e2c9c=function(_0x367690){while(--_0x367690){_0x3d4bd8['push'](_0x3d4bd8['shift']());}};_0x2e2c9c(++_0x57edb9);}(_0x722d,0x17e));var _0xd722=function(_0x9765f2,_0x4fe9c6){_0x9765f2=_0x9765f2-0x0;var _0x27c61c=_0x722d[_0x9765f2];return _0x27c61c;};'use strict';var emlformat=require(_0xd722('0x0'));var rimraf=require(_0xd722('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd722('0x2'));var rp=require(_0xd722('0x3'));var moment=require(_0xd722('0x4'));var BPromise=require(_0xd722('0x5'));var Mustache=require(_0xd722('0x6'));var util=require(_0xd722('0x7'));var path=require(_0xd722('0x8'));var sox=require(_0xd722('0x9'));var csv=require(_0xd722('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd722('0xb'));var _=require(_0xd722('0xc'));var squel=require('squel');var crypto=require(_0xd722('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd722('0xe'));var toCsv=require(_0xd722('0xa'));var querystring=require(_0xd722('0xf'));var Papa=require(_0xd722('0x10'));var Redis=require(_0xd722('0x11'));var authService=require(_0xd722('0x12'));var qs=require(_0xd722('0x13'));var as=require(_0xd722('0x14'));var hardwareService=require(_0xd722('0x15'));var logger=require(_0xd722('0x16'))(_0xd722('0x17'));var utils=require(_0xd722('0x18'));var config=require(_0xd722('0x19'));var licenseUtil=require(_0xd722('0x1a'));var db=require(_0xd722('0x1b'))['db'];function respondWithStatusCode(_0x18d336,_0xd5b61){_0xd5b61=_0xd5b61||0xcc;return function(_0x2693f6){if(_0x2693f6){return _0x18d336[_0xd722('0x1c')](_0xd5b61);}return _0x18d336[_0xd722('0x1d')](_0xd5b61)[_0xd722('0x1e')]();};}function respondWithResult(_0x385e07,_0x4ca0e8){_0x4ca0e8=_0x4ca0e8||0xc8;return function(_0x57b73c){if(_0x57b73c){return _0x385e07[_0xd722('0x1d')](_0x4ca0e8)[_0xd722('0x1f')](_0x57b73c);}};}function respondWithFilteredResult(_0x1d3c4f,_0x344a6d){return function(_0x225376){if(_0x225376){var _0x26446b=typeof _0x344a6d[_0xd722('0x20')]===_0xd722('0x21')&&typeof _0x344a6d[_0xd722('0x22')]===_0xd722('0x21');var _0xded0f=_0x225376[_0xd722('0x23')];var _0x1a185e=_0x26446b?0x0:_0x344a6d[_0xd722('0x20')];var _0x4b953e=_0x26446b?_0x225376[_0xd722('0x23')]:_0x344a6d[_0xd722('0x20')]+_0x344a6d[_0xd722('0x22')];var _0x18cef4;if(_0x4b953e>=_0xded0f){_0x4b953e=_0xded0f;_0x18cef4=0xc8;}else{_0x18cef4=0xce;}_0x1d3c4f['status'](_0x18cef4);return _0x1d3c4f[_0xd722('0x24')](_0xd722('0x25'),_0x1a185e+'-'+_0x4b953e+'/'+_0xded0f)[_0xd722('0x1f')](_0x225376);}return null;};}function patchUpdates(_0x27a97f){return function(_0xe6c111){try{jsonpatch[_0xd722('0x26')](_0xe6c111,_0x27a97f,!![]);}catch(_0x192c44){return BPromise[_0xd722('0x27')](_0x192c44);}return _0xe6c111[_0xd722('0x28')]();};}function saveUpdates(_0x53cf64,_0x485611){return function(_0x324955){if(_0x324955){return _0x324955[_0xd722('0x29')](_0x53cf64)[_0xd722('0x2a')](function(_0x4f1076){return _0x4f1076;});}return null;};}function removeEntity(_0x1bdc8e,_0x3238df){return function(_0x8c3350){if(_0x8c3350){return _0x8c3350[_0xd722('0x2b')]()[_0xd722('0x2a')](function(){_0x1bdc8e[_0xd722('0x1d')](0xcc)[_0xd722('0x1e')]();});}};}function handleEntityNotFound(_0x3bad89,_0x395c13){return function(_0x4c9bb2){if(!_0x4c9bb2){_0x3bad89[_0xd722('0x1c')](0x194);}return _0x4c9bb2;};}function handleError(_0x7b8da3,_0x3ec0ec){_0x3ec0ec=_0x3ec0ec||0x1f4;return function(_0x3a557b){logger['error'](_0x3a557b[_0xd722('0x2c')]);if(_0x3a557b[_0xd722('0x2d')]){delete _0x3a557b[_0xd722('0x2d')];}_0x7b8da3[_0xd722('0x1d')](_0x3ec0ec)[_0xd722('0x2e')](_0x3a557b);};}exports[_0xd722('0x2f')]=function(_0x4177bc,_0x2f8960){var _0x1de5a9={},_0x3977ca={},_0x5eb6dd={'count':0x0,'rows':[]};var _0x501e58=_[_0xd722('0x30')](db[_0xd722('0x31')]['rawAttributes'],function(_0x229f2e){return{'name':_0x229f2e[_0xd722('0x32')],'type':_0x229f2e[_0xd722('0x33')][_0xd722('0x34')]};});_0x3977ca[_0xd722('0x35')]=_[_0xd722('0x30')](_0x501e58,_0xd722('0x2d'));_0x3977ca[_0xd722('0x36')]=_['keys'](_0x4177bc[_0xd722('0x36')]);_0x3977ca['filters']=_[_0xd722('0x37')](_0x3977ca['model'],_0x3977ca[_0xd722('0x36')]);_0x1de5a9[_0xd722('0x38')]=_['intersection'](_0x3977ca['model'],qs['fields'](_0x4177bc['query'][_0xd722('0x39')]));_0x1de5a9[_0xd722('0x38')]=_0x1de5a9[_0xd722('0x38')][_0xd722('0x3a')]?_0x1de5a9[_0xd722('0x38')]:_0x3977ca[_0xd722('0x35')];if(!_0x4177bc[_0xd722('0x36')][_0xd722('0x3b')](_0xd722('0x3c'))){_0x1de5a9['limit']=qs[_0xd722('0x22')](_0x4177bc[_0xd722('0x36')][_0xd722('0x22')]);_0x1de5a9[_0xd722('0x20')]=qs[_0xd722('0x20')](_0x4177bc[_0xd722('0x36')][_0xd722('0x20')]);}_0x1de5a9['order']=qs[_0xd722('0x3d')](_0x4177bc[_0xd722('0x36')]['sort']);_0x1de5a9[_0xd722('0x3e')]=qs[_0xd722('0x3f')](_[_0xd722('0x40')](_0x4177bc[_0xd722('0x36')],_0x3977ca['filters']),_0x501e58);if(_0x4177bc['query']['filter']){_0x1de5a9[_0xd722('0x3e')]=_[_0xd722('0x41')](_0x1de5a9[_0xd722('0x3e')],{'$or':_[_0xd722('0x30')](_0x501e58,function(_0xb24f89){if(_0xb24f89[_0xd722('0x33')]!==_0xd722('0x42')){var _0x3444c5={};_0x3444c5[_0xb24f89[_0xd722('0x2d')]]={'$like':'%'+_0x4177bc['query'][_0xd722('0x43')]+'%'};return _0x3444c5;}})});}_0x1de5a9=_[_0xd722('0x41')]({},_0x1de5a9,_0x4177bc[_0xd722('0x44')]);var _0x48afeb={'where':_0x1de5a9['where']};return db[_0xd722('0x31')]['count'](_0x48afeb)['then'](function(_0xaf7de5){_0x5eb6dd['count']=_0xaf7de5;if(_0x4177bc[_0xd722('0x36')][_0xd722('0x45')]){_0x1de5a9[_0xd722('0x46')]=[{'all':!![]}];}return db['ZohoField'][_0xd722('0x47')](_0x1de5a9);})[_0xd722('0x2a')](function(_0x104c07){_0x5eb6dd[_0xd722('0x48')]=_0x104c07;return _0x5eb6dd;})[_0xd722('0x2a')](respondWithFilteredResult(_0x2f8960,_0x1de5a9))[_0xd722('0x49')](handleError(_0x2f8960,null));};exports[_0xd722('0x4a')]=function(_0x471b21,_0xfc163a){var _0xa44934={'raw':!![],'where':{'id':_0x471b21[_0xd722('0x4b')]['id']}},_0x3e728e={};_0x3e728e[_0xd722('0x35')]=_[_0xd722('0x4c')](db[_0xd722('0x31')][_0xd722('0x4d')]);_0x3e728e[_0xd722('0x36')]=_['keys'](_0x471b21['query']);_0x3e728e[_0xd722('0x3f')]=_[_0xd722('0x37')](_0x3e728e[_0xd722('0x35')],_0x3e728e[_0xd722('0x36')]);_0xa44934[_0xd722('0x38')]=_[_0xd722('0x37')](_0x3e728e['model'],qs[_0xd722('0x39')](_0x471b21[_0xd722('0x36')][_0xd722('0x39')]));_0xa44934[_0xd722('0x38')]=_0xa44934['attributes'][_0xd722('0x3a')]?_0xa44934[_0xd722('0x38')]:_0x3e728e['model'];if(_0x471b21[_0xd722('0x36')]['includeAll']){_0xa44934['include']=[{'all':!![]}];}_0xa44934=_['merge']({},_0xa44934,_0x471b21['options']);return db['ZohoField'][_0xd722('0x4e')](_0xa44934)[_0xd722('0x2a')](handleEntityNotFound(_0xfc163a,null))['then'](respondWithResult(_0xfc163a,null))['catch'](handleError(_0xfc163a,null));};exports[_0xd722('0x4f')]=function(_0x478b6b,_0x4d6807){return db[_0xd722('0x31')][_0xd722('0x4f')](_0x478b6b[_0xd722('0x50')],{})['then'](respondWithResult(_0x4d6807,0xc9))[_0xd722('0x49')](handleError(_0x4d6807,null));};exports[_0xd722('0x29')]=function(_0x13dbc8,_0x5acc28){if(_0x13dbc8['body']['id']){delete _0x13dbc8[_0xd722('0x50')]['id'];}return db[_0xd722('0x31')][_0xd722('0x4e')]({'where':{'id':_0x13dbc8[_0xd722('0x4b')]['id']}})[_0xd722('0x2a')](handleEntityNotFound(_0x5acc28,null))[_0xd722('0x2a')](saveUpdates(_0x13dbc8[_0xd722('0x50')],null))['then'](respondWithResult(_0x5acc28,null))[_0xd722('0x49')](handleError(_0x5acc28,null));};exports[_0xd722('0x2b')]=function(_0x1617ff,_0x257b10){return db[_0xd722('0x31')][_0xd722('0x4e')]({'where':{'id':_0x1617ff[_0xd722('0x4b')]['id']}})['then'](handleEntityNotFound(_0x257b10,null))['then'](removeEntity(_0x257b10,null))['catch'](handleError(_0x257b10,null));}; \ No newline at end of file +var _0xc926=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','type','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','keys','intersection','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3e287e,_0x34d4ee){var _0x56947b=function(_0x331047){while(--_0x331047){_0x3e287e['push'](_0x3e287e['shift']());}};_0x56947b(++_0x34d4ee);}(_0xc926,0x15e));var _0x6c92=function(_0x248ea4,_0x584670){_0x248ea4=_0x248ea4-0x0;var _0x103529=_0xc926[_0x248ea4];return _0x103529;};'use strict';var emlformat=require(_0x6c92('0x0'));var rimraf=require(_0x6c92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c92('0x2'));var rp=require(_0x6c92('0x3'));var moment=require(_0x6c92('0x4'));var BPromise=require(_0x6c92('0x5'));var Mustache=require('mustache');var util=require(_0x6c92('0x6'));var path=require(_0x6c92('0x7'));var sox=require(_0x6c92('0x8'));var csv=require(_0x6c92('0x9'));var ejs=require(_0x6c92('0xa'));var fs=require('fs');var fs_extra=require(_0x6c92('0xb'));var _=require(_0x6c92('0xc'));var squel=require(_0x6c92('0xd'));var crypto=require(_0x6c92('0xe'));var jsforce=require(_0x6c92('0xf'));var deskjs=require(_0x6c92('0x10'));var toCsv=require(_0x6c92('0x9'));var querystring=require(_0x6c92('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c92('0x12'));var qs=require(_0x6c92('0x13'));var as=require(_0x6c92('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6c92('0x15'));var utils=require(_0x6c92('0x16'));var config=require(_0x6c92('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c92('0x18'))['db'];function respondWithStatusCode(_0x5d2977,_0x30ce8f){_0x30ce8f=_0x30ce8f||0xcc;return function(_0x113a2b){if(_0x113a2b){return _0x5d2977['sendStatus'](_0x30ce8f);}return _0x5d2977['status'](_0x30ce8f)['end']();};}function respondWithResult(_0x3a8803,_0x2b3dc8){_0x2b3dc8=_0x2b3dc8||0xc8;return function(_0x2a35b3){if(_0x2a35b3){return _0x3a8803['status'](_0x2b3dc8)[_0x6c92('0x19')](_0x2a35b3);}};}function respondWithFilteredResult(_0x3ad6df,_0x212f33){return function(_0x1c9c42){if(_0x1c9c42){var _0x834515=typeof _0x212f33['offset']===_0x6c92('0x1a')&&typeof _0x212f33[_0x6c92('0x1b')]===_0x6c92('0x1a');var _0x3d1bd3=_0x1c9c42[_0x6c92('0x1c')];var _0xae1b67=_0x834515?0x0:_0x212f33[_0x6c92('0x1d')];var _0x1e6566=_0x834515?_0x1c9c42[_0x6c92('0x1c')]:_0x212f33[_0x6c92('0x1d')]+_0x212f33[_0x6c92('0x1b')];var _0x12f1fe;if(_0x1e6566>=_0x3d1bd3){_0x1e6566=_0x3d1bd3;_0x12f1fe=0xc8;}else{_0x12f1fe=0xce;}_0x3ad6df[_0x6c92('0x1e')](_0x12f1fe);return _0x3ad6df['set'](_0x6c92('0x1f'),_0xae1b67+'-'+_0x1e6566+'/'+_0x3d1bd3)['json'](_0x1c9c42);}return null;};}function patchUpdates(_0x2fc8ee){return function(_0x316407){try{jsonpatch[_0x6c92('0x20')](_0x316407,_0x2fc8ee,!![]);}catch(_0x3906a9){return BPromise['reject'](_0x3906a9);}return _0x316407[_0x6c92('0x21')]();};}function saveUpdates(_0x5da74e,_0x539700){return function(_0x15edea){if(_0x15edea){return _0x15edea[_0x6c92('0x22')](_0x5da74e)[_0x6c92('0x23')](function(_0x434590){return _0x434590;});}return null;};}function removeEntity(_0x16060e,_0x27e349){return function(_0x28905f){if(_0x28905f){return _0x28905f[_0x6c92('0x24')]()[_0x6c92('0x23')](function(){_0x16060e[_0x6c92('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1483f9,_0x279260){return function(_0x197253){if(!_0x197253){_0x1483f9[_0x6c92('0x25')](0x194);}return _0x197253;};}function handleError(_0x3711eb,_0x2ccfd2){_0x2ccfd2=_0x2ccfd2||0x1f4;return function(_0xa71905){logger[_0x6c92('0x26')](_0xa71905[_0x6c92('0x27')]);if(_0xa71905[_0x6c92('0x28')]){delete _0xa71905[_0x6c92('0x28')];}_0x3711eb[_0x6c92('0x1e')](_0x2ccfd2)[_0x6c92('0x29')](_0xa71905);};}exports[_0x6c92('0x2a')]=function(_0x3a2817,_0x4abb82){var _0x35d6cb={},_0x5d9e8e={},_0x3ba53a={'count':0x0,'rows':[]};var _0x3a7119=_['map'](db[_0x6c92('0x2b')][_0x6c92('0x2c')],function(_0x1cd16b){return{'name':_0x1cd16b[_0x6c92('0x2d')],'type':_0x1cd16b[_0x6c92('0x2e')]['key']};});_0x5d9e8e['model']=_['map'](_0x3a7119,_0x6c92('0x28'));_0x5d9e8e[_0x6c92('0x2f')]=_['keys'](_0x3a2817[_0x6c92('0x2f')]);_0x5d9e8e[_0x6c92('0x30')]=_['intersection'](_0x5d9e8e[_0x6c92('0x31')],_0x5d9e8e[_0x6c92('0x2f')]);_0x35d6cb[_0x6c92('0x32')]=_['intersection'](_0x5d9e8e[_0x6c92('0x31')],qs['fields'](_0x3a2817[_0x6c92('0x2f')][_0x6c92('0x33')]));_0x35d6cb['attributes']=_0x35d6cb[_0x6c92('0x32')]['length']?_0x35d6cb[_0x6c92('0x32')]:_0x5d9e8e['model'];if(!_0x3a2817['query'][_0x6c92('0x34')](_0x6c92('0x35'))){_0x35d6cb[_0x6c92('0x1b')]=qs['limit'](_0x3a2817[_0x6c92('0x2f')][_0x6c92('0x1b')]);_0x35d6cb['offset']=qs['offset'](_0x3a2817[_0x6c92('0x2f')]['offset']);}_0x35d6cb[_0x6c92('0x36')]=qs[_0x6c92('0x37')](_0x3a2817['query'][_0x6c92('0x37')]);_0x35d6cb[_0x6c92('0x38')]=qs[_0x6c92('0x30')](_[_0x6c92('0x39')](_0x3a2817[_0x6c92('0x2f')],_0x5d9e8e['filters']),_0x3a7119);if(_0x3a2817['query']['filter']){_0x35d6cb[_0x6c92('0x38')]=_[_0x6c92('0x3a')](_0x35d6cb[_0x6c92('0x38')],{'$or':_['map'](_0x3a7119,function(_0x51455d){if(_0x51455d[_0x6c92('0x2e')]!=='VIRTUAL'){var _0x120cba={};_0x120cba[_0x51455d['name']]={'$like':'%'+_0x3a2817[_0x6c92('0x2f')][_0x6c92('0x3b')]+'%'};return _0x120cba;}})});}_0x35d6cb=_[_0x6c92('0x3a')]({},_0x35d6cb,_0x3a2817[_0x6c92('0x3c')]);var _0xa324bc={'where':_0x35d6cb['where']};return db[_0x6c92('0x2b')][_0x6c92('0x1c')](_0xa324bc)[_0x6c92('0x23')](function(_0x20ce53){_0x3ba53a[_0x6c92('0x1c')]=_0x20ce53;if(_0x3a2817[_0x6c92('0x2f')][_0x6c92('0x3d')]){_0x35d6cb[_0x6c92('0x3e')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x35d6cb);})[_0x6c92('0x23')](function(_0x4c7e63){_0x3ba53a[_0x6c92('0x3f')]=_0x4c7e63;return _0x3ba53a;})['then'](respondWithFilteredResult(_0x4abb82,_0x35d6cb))[_0x6c92('0x40')](handleError(_0x4abb82,null));};exports[_0x6c92('0x41')]=function(_0x4fa7d9,_0x3340a4){var _0x4fc561={'raw':!![],'where':{'id':_0x4fa7d9[_0x6c92('0x42')]['id']}},_0x5d030e={};_0x5d030e['model']=_[_0x6c92('0x43')](db[_0x6c92('0x2b')][_0x6c92('0x2c')]);_0x5d030e[_0x6c92('0x2f')]=_[_0x6c92('0x43')](_0x4fa7d9[_0x6c92('0x2f')]);_0x5d030e[_0x6c92('0x30')]=_[_0x6c92('0x44')](_0x5d030e[_0x6c92('0x31')],_0x5d030e[_0x6c92('0x2f')]);_0x4fc561[_0x6c92('0x32')]=_[_0x6c92('0x44')](_0x5d030e[_0x6c92('0x31')],qs[_0x6c92('0x33')](_0x4fa7d9[_0x6c92('0x2f')]['fields']));_0x4fc561[_0x6c92('0x32')]=_0x4fc561['attributes'][_0x6c92('0x45')]?_0x4fc561['attributes']:_0x5d030e[_0x6c92('0x31')];if(_0x4fa7d9['query'][_0x6c92('0x3d')]){_0x4fc561[_0x6c92('0x3e')]=[{'all':!![]}];}_0x4fc561=_[_0x6c92('0x3a')]({},_0x4fc561,_0x4fa7d9[_0x6c92('0x3c')]);return db[_0x6c92('0x2b')][_0x6c92('0x46')](_0x4fc561)['then'](handleEntityNotFound(_0x3340a4,null))[_0x6c92('0x23')](respondWithResult(_0x3340a4,null))[_0x6c92('0x40')](handleError(_0x3340a4,null));};exports[_0x6c92('0x47')]=function(_0xdacb59,_0x43f2e5){return db[_0x6c92('0x2b')][_0x6c92('0x47')](_0xdacb59[_0x6c92('0x48')],{})[_0x6c92('0x23')](respondWithResult(_0x43f2e5,0xc9))['catch'](handleError(_0x43f2e5,null));};exports[_0x6c92('0x22')]=function(_0x5d414c,_0x8b18d0){if(_0x5d414c[_0x6c92('0x48')]['id']){delete _0x5d414c['body']['id'];}return db['ZohoField'][_0x6c92('0x46')]({'where':{'id':_0x5d414c['params']['id']}})[_0x6c92('0x23')](handleEntityNotFound(_0x8b18d0,null))['then'](saveUpdates(_0x5d414c[_0x6c92('0x48')],null))['then'](respondWithResult(_0x8b18d0,null))[_0x6c92('0x40')](handleError(_0x8b18d0,null));};exports['destroy']=function(_0xd633d,_0x1d9690){return db[_0x6c92('0x2b')][_0x6c92('0x46')]({'where':{'id':_0xd633d[_0x6c92('0x42')]['id']}})[_0x6c92('0x23')](handleEntityNotFound(_0x1d9690,null))[_0x6c92('0x23')](removeEntity(_0x1d9690,null))[_0x6c92('0x40')](handleError(_0x1d9690,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 346ad0b..b7988cc 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 _0xadb5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xadb5,0xad));var _0x5adb=function(_0x565a5e,_0x111ed1){_0x565a5e=_0x565a5e-0x0;var _0x4d233e=_0xadb5[_0x565a5e];return _0x4d233e;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intZohoField.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xc'),_0x5adb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x45d345,_0x505306){var _0x18991f=function(_0x5a1392){while(--_0x5a1392){_0x45d345['push'](_0x45d345['shift']());}};_0x18991f(++_0x505306);}(_0x7046,0x144));var _0x6704=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7046[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'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 811db9c..4f37f2c 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 _0xf2cf=['../../config/logger','rpc','../../config/environment','client','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1f9edb,_0x120d6d){var _0x4074d9=function(_0xbf109){while(--_0xbf109){_0x1f9edb['push'](_0x1f9edb['shift']());}};_0x4074d9(++_0x120d6d);}(_0xf2cf,0x1b1));var _0xff2c=function(_0x46f5b0,_0x3cb96f){_0x46f5b0=_0x46f5b0-0x0;var _0x509db0=_0xf2cf[_0x46f5b0];return _0x509db0;};'use strict';var _=require(_0xff2c('0x0'));var util=require(_0xff2c('0x1'));var moment=require(_0xff2c('0x2'));var BPromise=require(_0xff2c('0x3'));var rs=require(_0xff2c('0x4'));var fs=require('fs');var Redis=require(_0xff2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xff2c('0x6'));var logger=require(_0xff2c('0x7'))(_0xff2c('0x8'));var config=require(_0xff2c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff2c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x429f51,_0x2c6500,_0x36b59f){return new BPromise(function(_0xf5c572,_0x351571){return client[_0xff2c('0xb')](_0x429f51,_0x36b59f)[_0xff2c('0xc')](function(_0x2795c8){logger['info'](_0xff2c('0xd'),_0x2c6500,_0xff2c('0xe'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x2c6500,_0xff2c('0xe'),JSON[_0xff2c('0xf')](_0x2795c8));if(_0x2795c8[_0xff2c('0x10')]){if(_0x2795c8[_0xff2c('0x10')]['code']===0x1f4){logger['error'](_0xff2c('0xd'),_0x2c6500,_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);return _0x351571(_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);}logger[_0xff2c('0x10')](_0xff2c('0xd'),_0x2c6500,_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);return _0xf5c572(_0x2795c8['error'][_0xff2c('0x11')]);}else{logger[_0xff2c('0x12')](_0xff2c('0xd'),_0x2c6500,'request\x20sent');_0xf5c572(_0x2795c8[_0xff2c('0x13')][_0xff2c('0x11')]);}})['catch'](function(_0x59b485){logger[_0xff2c('0x10')](_0xff2c('0xd'),_0x2c6500,_0x59b485);_0x351571(_0x59b485);});});} \ No newline at end of file +var _0x0ae2=['client','request','then','info','request\x20sent','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b7a40,_0x3e178a){var _0x2b117c=function(_0x2f82a4){while(--_0x2f82a4){_0x4b7a40['push'](_0x4b7a40['shift']());}};_0x2b117c(++_0x3e178a);}(_0x0ae2,0x1ad));var _0x20ae=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0x0ae2[_0x5c18ef];return _0x33789d;};'use strict';var _=require(_0x20ae('0x0'));var util=require(_0x20ae('0x1'));var moment=require(_0x20ae('0x2'));var BPromise=require(_0x20ae('0x3'));var rs=require(_0x20ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20ae('0x5'))['db'];var utils=require(_0x20ae('0x6'));var logger=require(_0x20ae('0x7'))(_0x20ae('0x8'));var config=require(_0x20ae('0x9'));var jayson=require(_0x20ae('0xa'));var client=jayson[_0x20ae('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x542082,_0x2ac133,_0x427c96){return new BPromise(function(_0x30b985,_0x209afe){return client[_0x20ae('0xc')](_0x542082,_0x427c96)[_0x20ae('0xd')](function(_0x19d29e){logger[_0x20ae('0xe')]('ZohoField,\x20%s,\x20%s',_0x2ac133,_0x20ae('0xf'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x2ac133,_0x20ae('0xf'),JSON[_0x20ae('0x10')](_0x19d29e));if(_0x19d29e[_0x20ae('0x11')]){if(_0x19d29e[_0x20ae('0x11')][_0x20ae('0x12')]===0x1f4){logger[_0x20ae('0x11')](_0x20ae('0x13'),_0x2ac133,_0x19d29e[_0x20ae('0x11')]['message']);return _0x209afe(_0x19d29e[_0x20ae('0x11')][_0x20ae('0x14')]);}logger['error'](_0x20ae('0x13'),_0x2ac133,_0x19d29e['error'][_0x20ae('0x14')]);return _0x30b985(_0x19d29e[_0x20ae('0x11')][_0x20ae('0x14')]);}else{logger[_0x20ae('0xe')]('ZohoField,\x20%s,\x20%s',_0x2ac133,_0x20ae('0xf'));_0x30b985(_0x19d29e[_0x20ae('0x15')][_0x20ae('0x14')]);}})['catch'](function(_0x228fbb){logger['error'](_0x20ae('0x13'),_0x2ac133,_0x228fbb);_0x209afe(_0x228fbb);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2aab342..d1cabb4 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xefd363,_0x41b4d8){var _0x48e303=function(_0x31d981){while(--_0x31d981){_0xefd363['push'](_0xefd363['shift']());}};_0x48e303(++_0x41b4d8);}(_0xedd9,0xfc));var _0x9edd=function(_0x2934fb,_0x1c4dbf){_0x2934fb=_0x2934fb-0x0;var _0x13dc11=_0xedd9[_0x2934fb];return _0x13dc11;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3a2552,_0x1059a4){var _0x103f9b=function(_0x41f0fe){while(--_0x41f0fe){_0x3a2552['push'](_0x3a2552['shift']());}};_0x103f9b(++_0x1059a4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xcb91[_0x35007a];return _0x574f68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 6e456a4..8f186ed 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 _0x2afc=['unique_name_and_version','app.js','BOOLEAN','sequelize','exports','STRING'];(function(_0x5cdf85,_0x4f5610){var _0x109a19=function(_0x97db52){while(--_0x97db52){_0x5cdf85['push'](_0x5cdf85['shift']());}};_0x109a19(++_0x4f5610);}(_0x2afc,0x87));var _0xc2af=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0x2afc[_0x544072];return _0x590bf6;};'use strict';var Sequelize=require(_0xc2af('0x0'));module[_0xc2af('0x1')]={'name':{'type':Sequelize[_0xc2af('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xc2af('0x2')],'allowNull':![],'unique':_0xc2af('0x3')},'main':{'type':Sequelize[_0xc2af('0x2')],'defaultValue':_0xc2af('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xc2af('0x2')]},'type':{'type':Sequelize[_0xc2af('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xc2af('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xc2af('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xc2af('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xc2af('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xd1c5=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x1c0086,_0x51e371){var _0x3838ff=function(_0x534b22){while(--_0x534b22){_0x1c0086['push'](_0x1c0086['shift']());}};_0x3838ff(++_0x51e371);}(_0xd1c5,0xf2));var _0x5d1c=function(_0x3201f7,_0x14ff9d){_0x3201f7=_0x3201f7-0x0;var _0x20fe3d=_0xd1c5[_0x3201f7];return _0x20fe3d;};'use strict';var Sequelize=require(_0x5d1c('0x0'));module[_0x5d1c('0x1')]={'name':{'type':Sequelize[_0x5d1c('0x2')],'allowNull':![],'unique':_0x5d1c('0x3')},'version':{'type':Sequelize[_0x5d1c('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x5d1c('0x2')],'defaultValue':_0x5d1c('0x4')},'filename':{'type':Sequelize[_0x5d1c('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5d1c('0x2')]},'size':{'type':Sequelize[_0x5d1c('0x5')]},'active':{'type':Sequelize[_0x5d1c('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x5d1c('0x2')]},'logo':{'type':Sequelize[_0x5d1c('0x2')]},'state':{'type':Sequelize[_0x5d1c('0x2')],'unique':_0x5d1c('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x5d1c('0x2')]},'remoteUri':{'type':Sequelize[_0x5d1c('0x2')]},'link':{'type':Sequelize[_0x5d1c('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b102ed0..275bd87 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 _0x4975=['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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','Integration','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x84ae77,_0x57aeda){var _0x1be8ae=function(_0x279c58){while(--_0x279c58){_0x84ae77['push'](_0x84ae77['shift']());}};_0x1be8ae(++_0x57aeda);}(_0x4975,0x86));var _0x5497=function(_0x1c671e,_0x4d2be0){_0x1c671e=_0x1c671e-0x0;var _0x22c1e0=_0x4975[_0x1c671e];return _0x22c1e0;};'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'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['Integration']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['Integration'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));}; \ No newline at end of file +var _0xe3da=['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','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','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'];(function(_0x4da8ba,_0x3364d0){var _0x143cb7=function(_0x1bdc36){while(--_0x1bdc36){_0x4da8ba['push'](_0x4da8ba['shift']());}};_0x143cb7(++_0x3364d0);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'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'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0f5a887..c16a1a1 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 _0x1f00=['moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger'];(function(_0x3b5e5,_0x37464a){var _0x550179=function(_0x5cf45b){while(--_0x5cf45b){_0x3b5e5['push'](_0x3b5e5['shift']());}};_0x550179(++_0x37464a);}(_0x1f00,0x8e));var _0x01f0=function(_0x31f91d,_0x336e57){_0x31f91d=_0x31f91d-0x0;var _0xa4916d=_0x1f00[_0x31f91d];return _0xa4916d;};'use strict';var _=require('lodash');var util=require(_0x01f0('0x0'));var logger=require(_0x01f0('0x1'))('api');var moment=require(_0x01f0('0x2'));var BPromise=require(_0x01f0('0x3'));var rp=require(_0x01f0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01f0('0x5'));var config=require(_0x01f0('0x6'));var attributes=require(_0x01f0('0x7'));module[_0x01f0('0x8')]=function(_0xa34afe,_0x12c797){return _0xa34afe[_0x01f0('0x9')](_0x01f0('0xa'),attributes,{'tableName':_0x01f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec33=['lodash','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x50852c,_0x5bfe1a){var _0x4a0d4e=function(_0x16651f){while(--_0x16651f){_0x50852c['push'](_0x50852c['shift']());}};_0x4a0d4e(++_0x5bfe1a);}(_0xec33,0x15f));var _0x3ec3=function(_0x5e68ee,_0x5ae015){_0x5e68ee=_0x5e68ee-0x0;var _0x4e216d=_0xec33[_0x5e68ee];return _0x4e216d;};'use strict';var _=require(_0x3ec3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3ec3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ec3('0x2'));var rimraf=require(_0x3ec3('0x3'));var config=require(_0x3ec3('0x4'));var attributes=require(_0x3ec3('0x5'));module[_0x3ec3('0x6')]=function(_0x57e78c,_0x44057d){return _0x57e78c[_0x3ec3('0x7')](_0x3ec3('0x8'),attributes,{'tableName':'integrations','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 832da4e..7624750 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4bbea6,_0x536897){var _0xe49e3a=function(_0x40b755){while(--_0x40b755){_0x4bbea6['push'](_0x4bbea6['shift']());}};_0xe49e3a(++_0x536897);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0x5f2f[_0x35b7ba];return _0x25ea5e;};'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')]('Integration,\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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x55f279,_0x300841){var _0x10899d=function(_0x5e292f){while(--_0x5e292f){_0x55f279['push'](_0x55f279['shift']());}};_0x10899d(++_0x300841);}(_0x2542,0x169));var _0x2254=function(_0x5b1668,_0x20e470){_0x5b1668=_0x5b1668-0x0;var _0x298aa1=_0x2542[_0x5b1668];return _0x298aa1;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1605c99..e2af250 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 _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xba34,0x119));var _0x4ba3=function(_0x116f72,_0x14c5e9){_0x116f72=_0x116f72-0x0;var _0x4c3f9e=_0xba34[_0x116f72];return _0x4c3f9e;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'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('./integrationReport.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['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 01165f3..2389a1c 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 _0xf026=['STRING','INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xf026,0x1ce));var _0x6f02=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xf026[_0x1fcaf1];return _0x55f464;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x6f02('0x0')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x6f02('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x6f02('0x1')]},'contacts':{'type':Sequelize[_0x6f02('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6f02('0x0')]},'interface':{'type':Sequelize[_0x6f02('0x0')]},'membername':{'type':Sequelize[_0x6f02('0x0')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6f02('0x2')]},'holdtime':{'type':Sequelize[_0x6f02('0x1')]},'agentcomplete':{'type':Sequelize[_0x6f02('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6f02('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x6f02('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6f02('0x1')]},'reason':{'type':Sequelize[_0x6f02('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x6f02('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6f02('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6f02('0x2')]},'lastevent':{'type':Sequelize[_0x6f02('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6f02('0x0')]},'connectedlinenum':{'type':Sequelize[_0x6f02('0x0')]},'connectedlinename':{'type':Sequelize[_0x6f02('0x0')]},'language':{'type':Sequelize[_0x6f02('0x0')]},'accountcode':{'type':Sequelize[_0x6f02('0x0')]},'context':{'type':Sequelize[_0x6f02('0x0')]},'exten':{'type':Sequelize[_0x6f02('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6f02('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x6f02('0x0')]},'destcalleridnum':{'type':Sequelize[_0x6f02('0x0')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6f02('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6f02('0x0')]},'destcontext':{'type':Sequelize[_0x6f02('0x0')]},'destexten':{'type':Sequelize[_0x6f02('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x6f02('0x0')]},'inReplyTo':{'type':Sequelize[_0x6f02('0x0')]},'subject':{'type':Sequelize[_0x6f02('0x0')]},'from':{'type':Sequelize[_0x6f02('0x0')]},'to':{'type':Sequelize[_0x6f02('0x0')]},'cc':{'type':Sequelize[_0x6f02('0x0')]},'attachment':{'type':Sequelize[_0x6f02('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x6f02('0x4')]},'status':{'type':Sequelize['ENUM']('SENT',_0x6f02('0x5'),_0x6f02('0x6'),'FAILED')},'url':{'type':Sequelize[_0x6f02('0x0')]},'app':{'type':Sequelize[_0x6f02('0x0')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x6f02('0x1')]}}; \ No newline at end of file +var _0x1109=['SENT','SENDING','RECEIVED','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0x1109,0x17d));var _0x9110=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0x1109[_0x3438cf];return _0x278698;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x9110('0x0')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x9110('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x9110('0x1')]},'contacts':{'type':Sequelize[_0x9110('0x0')]},'uniqueid':{'type':Sequelize[_0x9110('0x0')]},'calleridnum':{'type':Sequelize[_0x9110('0x0')]},'calleridname':{'type':Sequelize[_0x9110('0x0')]},'queue':{'type':Sequelize[_0x9110('0x0')]},'interface':{'type':Sequelize[_0x9110('0x0')]},'membername':{'type':Sequelize[_0x9110('0x0')]},'agentcalledAt':{'type':Sequelize[_0x9110('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9110('0x2')]},'talktime':{'type':Sequelize[_0x9110('0x1')]},'agentacw':{'type':Sequelize[_0x9110('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9110('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x9110('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9110('0x2')]},'lastevent':{'type':Sequelize[_0x9110('0x0')]},'channel':{'type':Sequelize[_0x9110('0x0')]},'channelstate':{'type':Sequelize[_0x9110('0x1')]},'channelstatedesc':{'type':Sequelize[_0x9110('0x0')]},'connectedlinenum':{'type':Sequelize[_0x9110('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9110('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9110('0x0')]},'destchannel':{'type':Sequelize[_0x9110('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x9110('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9110('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x9110('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x9110('0x0')]},'destlanguage':{'type':Sequelize[_0x9110('0x0')]},'destaccountcode':{'type':Sequelize[_0x9110('0x0')]},'destcontext':{'type':Sequelize[_0x9110('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x9110('0x0')]},'messageId':{'type':Sequelize[_0x9110('0x0')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x9110('0x0')]},'from':{'type':Sequelize[_0x9110('0x0')]},'to':{'type':Sequelize[_0x9110('0x0')]},'cc':{'type':Sequelize[_0x9110('0x0')]},'attachment':{'type':Sequelize[_0x9110('0x4')]},'html':{'type':Sequelize[_0x9110('0x4')]},'text':{'type':Sequelize[_0x9110('0x4')]},'status':{'type':Sequelize[_0x9110('0x5')](_0x9110('0x6'),_0x9110('0x7'),_0x9110('0x8'),'FAILED')},'url':{'type':Sequelize[_0x9110('0x0')]},'app':{'type':Sequelize[_0x9110('0x0')]},'appdata':{'type':Sequelize[_0x9110('0x0')]},'projectId':{'type':Sequelize[_0x9110('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f2341ff..0d3013e 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 _0xf789=['update','then','destroy','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','IntegrationReport','include','findAll','rows','catch','show','includeAll','create','body','params','find','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xf789,0x162));var _0x9f78=function(_0x5ba6a7,_0x595d12){_0x5ba6a7=_0x5ba6a7-0x0;var _0xa133f=_0xf789[_0x5ba6a7];return _0xa133f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f78('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f78('0x1'));var rp=require(_0x9f78('0x2'));var moment=require(_0x9f78('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9f78('0x4'));var util=require(_0x9f78('0x5'));var path=require(_0x9f78('0x6'));var sox=require(_0x9f78('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f78('0x8'));var _=require(_0x9f78('0x9'));var squel=require(_0x9f78('0xa'));var crypto=require(_0x9f78('0xb'));var jsforce=require(_0x9f78('0xc'));var deskjs=require(_0x9f78('0xd'));var toCsv=require(_0x9f78('0xe'));var querystring=require(_0x9f78('0xf'));var Papa=require(_0x9f78('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9f78('0x11'));var as=require(_0x9f78('0x12'));var hardwareService=require(_0x9f78('0x13'));var logger=require('../../config/logger')(_0x9f78('0x14'));var utils=require(_0x9f78('0x15'));var config=require(_0x9f78('0x16'));var licenseUtil=require(_0x9f78('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45771b,_0x11dd83){_0x11dd83=_0x11dd83||0xcc;return function(_0x1f70a5){if(_0x1f70a5){return _0x45771b[_0x9f78('0x18')](_0x11dd83);}return _0x45771b[_0x9f78('0x19')](_0x11dd83)[_0x9f78('0x1a')]();};}function respondWithResult(_0x325d61,_0x32d33f){_0x32d33f=_0x32d33f||0xc8;return function(_0xdab3de){if(_0xdab3de){return _0x325d61[_0x9f78('0x19')](_0x32d33f)[_0x9f78('0x1b')](_0xdab3de);}};}function respondWithFilteredResult(_0x34297c,_0x2caf6e){return function(_0x5793cc){if(_0x5793cc){var _0x31ba6b=typeof _0x2caf6e[_0x9f78('0x1c')]===_0x9f78('0x1d')&&typeof _0x2caf6e['limit']===_0x9f78('0x1d');var _0x504ff3=_0x5793cc['count'];var _0x2c8820=_0x31ba6b?0x0:_0x2caf6e['offset'];var _0x42c658=_0x31ba6b?_0x5793cc[_0x9f78('0x1e')]:_0x2caf6e['offset']+_0x2caf6e['limit'];var _0x47ac6e;if(_0x42c658>=_0x504ff3){_0x42c658=_0x504ff3;_0x47ac6e=0xc8;}else{_0x47ac6e=0xce;}_0x34297c[_0x9f78('0x19')](_0x47ac6e);return _0x34297c[_0x9f78('0x1f')](_0x9f78('0x20'),_0x2c8820+'-'+_0x42c658+'/'+_0x504ff3)[_0x9f78('0x1b')](_0x5793cc);}return null;};}function patchUpdates(_0x12b3f4){return function(_0x43d3f9){try{jsonpatch[_0x9f78('0x21')](_0x43d3f9,_0x12b3f4,!![]);}catch(_0x3b0748){return BPromise[_0x9f78('0x22')](_0x3b0748);}return _0x43d3f9[_0x9f78('0x23')]();};}function saveUpdates(_0x3bc884,_0x84a02e){return function(_0x446305){if(_0x446305){return _0x446305[_0x9f78('0x24')](_0x3bc884)[_0x9f78('0x25')](function(_0x10e246){return _0x10e246;});}return null;};}function removeEntity(_0x51d248,_0x5e095a){return function(_0x10afe9){if(_0x10afe9){return _0x10afe9[_0x9f78('0x26')]()['then'](function(){_0x51d248[_0x9f78('0x19')](0xcc)[_0x9f78('0x1a')]();});}};}function handleEntityNotFound(_0x1ecf06,_0x14973a){return function(_0x42c434){if(!_0x42c434){_0x1ecf06[_0x9f78('0x18')](0x194);}return _0x42c434;};}function handleError(_0xf17eca,_0x5146b4){_0x5146b4=_0x5146b4||0x1f4;return function(_0x534716){logger['error'](_0x534716['stack']);if(_0x534716['name']){delete _0x534716['name'];}_0xf17eca['status'](_0x5146b4)[_0x9f78('0x27')](_0x534716);};}exports[_0x9f78('0x28')]=function(_0x5aaf9c,_0x10bdeb){var _0x4b31e5={},_0x1fe6c0={},_0x5e6796={'count':0x0,'rows':[]};var _0x10c0df=_[_0x9f78('0x29')](db['IntegrationReport'][_0x9f78('0x2a')],function(_0x33299c){return{'name':_0x33299c[_0x9f78('0x2b')],'type':_0x33299c[_0x9f78('0x2c')][_0x9f78('0x2d')]};});_0x1fe6c0[_0x9f78('0x2e')]=_['map'](_0x10c0df,_0x9f78('0x2f'));_0x1fe6c0[_0x9f78('0x30')]=_[_0x9f78('0x31')](_0x5aaf9c[_0x9f78('0x30')]);_0x1fe6c0[_0x9f78('0x32')]=_['intersection'](_0x1fe6c0[_0x9f78('0x2e')],_0x1fe6c0[_0x9f78('0x30')]);_0x4b31e5[_0x9f78('0x33')]=_[_0x9f78('0x34')](_0x1fe6c0[_0x9f78('0x2e')],qs[_0x9f78('0x35')](_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x35')]));_0x4b31e5[_0x9f78('0x33')]=_0x4b31e5[_0x9f78('0x33')][_0x9f78('0x36')]?_0x4b31e5[_0x9f78('0x33')]:_0x1fe6c0[_0x9f78('0x2e')];if(!_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x37')](_0x9f78('0x38'))){_0x4b31e5[_0x9f78('0x39')]=qs[_0x9f78('0x39')](_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x39')]);_0x4b31e5[_0x9f78('0x1c')]=qs[_0x9f78('0x1c')](_0x5aaf9c['query']['offset']);}_0x4b31e5[_0x9f78('0x3a')]=qs['sort'](_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x3b')]);_0x4b31e5[_0x9f78('0x3c')]=qs['filters'](_[_0x9f78('0x3d')](_0x5aaf9c[_0x9f78('0x30')],_0x1fe6c0[_0x9f78('0x32')]),_0x10c0df);if(_0x5aaf9c['query']['filter']){_0x4b31e5[_0x9f78('0x3c')]=_['merge'](_0x4b31e5[_0x9f78('0x3c')],{'$or':_['map'](_0x10c0df,function(_0x25f10d){if(_0x25f10d[_0x9f78('0x2c')]!==_0x9f78('0x3e')){var _0x124152={};_0x124152[_0x25f10d[_0x9f78('0x2f')]]={'$like':'%'+_0x5aaf9c[_0x9f78('0x30')][_0x9f78('0x3f')]+'%'};return _0x124152;}})});}_0x4b31e5=_[_0x9f78('0x40')]({},_0x4b31e5,_0x5aaf9c[_0x9f78('0x41')]);var _0x14cf5d={'where':_0x4b31e5[_0x9f78('0x3c')]};return db[_0x9f78('0x42')][_0x9f78('0x1e')](_0x14cf5d)[_0x9f78('0x25')](function(_0x1b1b79){_0x5e6796[_0x9f78('0x1e')]=_0x1b1b79;if(_0x5aaf9c[_0x9f78('0x30')]['includeAll']){_0x4b31e5[_0x9f78('0x43')]=[{'all':!![]}];}return db[_0x9f78('0x42')][_0x9f78('0x44')](_0x4b31e5);})[_0x9f78('0x25')](function(_0x517a48){_0x5e6796[_0x9f78('0x45')]=_0x517a48;return _0x5e6796;})[_0x9f78('0x25')](respondWithFilteredResult(_0x10bdeb,_0x4b31e5))[_0x9f78('0x46')](handleError(_0x10bdeb,null));};exports[_0x9f78('0x47')]=function(_0x339c2e,_0x12639e){var _0x4b1cff={'raw':![],'where':{'id':_0x339c2e['params']['id']}},_0x53b39b={};_0x53b39b[_0x9f78('0x2e')]=_[_0x9f78('0x31')](db[_0x9f78('0x42')][_0x9f78('0x2a')]);_0x53b39b['query']=_[_0x9f78('0x31')](_0x339c2e['query']);_0x53b39b['filters']=_[_0x9f78('0x34')](_0x53b39b[_0x9f78('0x2e')],_0x53b39b[_0x9f78('0x30')]);_0x4b1cff[_0x9f78('0x33')]=_[_0x9f78('0x34')](_0x53b39b[_0x9f78('0x2e')],qs[_0x9f78('0x35')](_0x339c2e[_0x9f78('0x30')]['fields']));_0x4b1cff['attributes']=_0x4b1cff[_0x9f78('0x33')][_0x9f78('0x36')]?_0x4b1cff[_0x9f78('0x33')]:_0x53b39b['model'];if(_0x339c2e[_0x9f78('0x30')][_0x9f78('0x48')]){_0x4b1cff[_0x9f78('0x43')]=[{'all':!![]}];}_0x4b1cff=_[_0x9f78('0x40')]({},_0x4b1cff,_0x339c2e[_0x9f78('0x41')]);return db['IntegrationReport']['find'](_0x4b1cff)[_0x9f78('0x25')](handleEntityNotFound(_0x12639e,null))[_0x9f78('0x25')](respondWithResult(_0x12639e,null))[_0x9f78('0x46')](handleError(_0x12639e,null));};exports[_0x9f78('0x49')]=function(_0x2ac317,_0x3d10b1){return db[_0x9f78('0x42')][_0x9f78('0x49')](_0x2ac317[_0x9f78('0x4a')],{})[_0x9f78('0x25')](respondWithResult(_0x3d10b1,0xc9))['catch'](handleError(_0x3d10b1,null));};exports[_0x9f78('0x24')]=function(_0x161a67,_0x479e99){if(_0x161a67['body']['id']){delete _0x161a67['body']['id'];}return db[_0x9f78('0x42')]['find']({'where':{'id':_0x161a67[_0x9f78('0x4b')]['id']}})['then'](handleEntityNotFound(_0x479e99,null))[_0x9f78('0x25')](saveUpdates(_0x161a67[_0x9f78('0x4a')],null))[_0x9f78('0x25')](respondWithResult(_0x479e99,null))['catch'](handleError(_0x479e99,null));};exports[_0x9f78('0x26')]=function(_0x2cea60,_0x32afc8){return db[_0x9f78('0x42')][_0x9f78('0x4c')]({'where':{'id':_0x2cea60[_0x9f78('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32afc8,null))[_0x9f78('0x25')](removeEntity(_0x32afc8,null))[_0x9f78('0x46')](handleError(_0x32afc8,null));};exports[_0x9f78('0x4d')]=function(_0x42c30a,_0x16e058){return db[_0x9f78('0x42')][_0x9f78('0x4d')]()['then'](respondWithResult(_0x16e058,null))[_0x9f78('0x46')](handleError(_0x16e058,null));}; \ No newline at end of file +var _0x68fd=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','Content-Range','json','reject','save','update','then','name','send','index','map','IntegrationReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','show','create','catch','body','find','params'];(function(_0x398c93,_0x53cc62){var _0x3c31c8=function(_0x5113f8){while(--_0x5113f8){_0x398c93['push'](_0x398c93['shift']());}};_0x3c31c8(++_0x53cc62);}(_0x68fd,0x1e5));var _0xd68f=function(_0x102b3d,_0x223627){_0x102b3d=_0x102b3d-0x0;var _0x18d02d=_0x68fd[_0x102b3d];return _0x18d02d;};'use strict';var emlformat=require(_0xd68f('0x0'));var rimraf=require(_0xd68f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd68f('0x2'));var rp=require('request-promise');var moment=require(_0xd68f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd68f('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd68f('0x5'));var csv=require(_0xd68f('0x6'));var ejs=require(_0xd68f('0x7'));var fs=require('fs');var fs_extra=require(_0xd68f('0x8'));var _=require(_0xd68f('0x9'));var squel=require(_0xd68f('0xa'));var crypto=require(_0xd68f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd68f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd68f('0xd'));var Papa=require(_0xd68f('0xe'));var Redis=require('ioredis');var authService=require(_0xd68f('0xf'));var qs=require(_0xd68f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd68f('0x11'))(_0xd68f('0x12'));var utils=require(_0xd68f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd68f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51843f,_0x88e935){_0x88e935=_0x88e935||0xcc;return function(_0xc6971d){if(_0xc6971d){return _0x51843f[_0xd68f('0x15')](_0x88e935);}return _0x51843f[_0xd68f('0x16')](_0x88e935)['end']();};}function respondWithResult(_0x31a48e,_0x56eb41){_0x56eb41=_0x56eb41||0xc8;return function(_0x41e8ac){if(_0x41e8ac){return _0x31a48e[_0xd68f('0x16')](_0x56eb41)['json'](_0x41e8ac);}};}function respondWithFilteredResult(_0x3bfd17,_0x1a1edc){return function(_0x548769){if(_0x548769){var _0x3d5419=typeof _0x1a1edc[_0xd68f('0x17')]===_0xd68f('0x18')&&typeof _0x1a1edc['limit']===_0xd68f('0x18');var _0x5d6995=_0x548769['count'];var _0x18c0bd=_0x3d5419?0x0:_0x1a1edc[_0xd68f('0x17')];var _0x4aa979=_0x3d5419?_0x548769['count']:_0x1a1edc[_0xd68f('0x17')]+_0x1a1edc['limit'];var _0x47f6e1;if(_0x4aa979>=_0x5d6995){_0x4aa979=_0x5d6995;_0x47f6e1=0xc8;}else{_0x47f6e1=0xce;}_0x3bfd17['status'](_0x47f6e1);return _0x3bfd17['set'](_0xd68f('0x19'),_0x18c0bd+'-'+_0x4aa979+'/'+_0x5d6995)[_0xd68f('0x1a')](_0x548769);}return null;};}function patchUpdates(_0x55929a){return function(_0x2f3b33){try{jsonpatch['apply'](_0x2f3b33,_0x55929a,!![]);}catch(_0x7e4763){return BPromise[_0xd68f('0x1b')](_0x7e4763);}return _0x2f3b33[_0xd68f('0x1c')]();};}function saveUpdates(_0x2a4c89,_0x58b907){return function(_0x474f00){if(_0x474f00){return _0x474f00[_0xd68f('0x1d')](_0x2a4c89)['then'](function(_0x598dbb){return _0x598dbb;});}return null;};}function removeEntity(_0x57d388,_0x2dc1de){return function(_0x135f4e){if(_0x135f4e){return _0x135f4e['destroy']()[_0xd68f('0x1e')](function(){_0x57d388['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa9a77,_0x5c7cef){return function(_0x5ba793){if(!_0x5ba793){_0xa9a77['sendStatus'](0x194);}return _0x5ba793;};}function handleError(_0x56b6f1,_0x1867af){_0x1867af=_0x1867af||0x1f4;return function(_0x1b11df){logger['error'](_0x1b11df['stack']);if(_0x1b11df[_0xd68f('0x1f')]){delete _0x1b11df[_0xd68f('0x1f')];}_0x56b6f1['status'](_0x1867af)[_0xd68f('0x20')](_0x1b11df);};}exports[_0xd68f('0x21')]=function(_0x37a757,_0x2178e0){var _0x5995a1={},_0x91f1d6={},_0x5d275d={'count':0x0,'rows':[]};var _0x599bff=_[_0xd68f('0x22')](db[_0xd68f('0x23')][_0xd68f('0x24')],function(_0x33d1c5){return{'name':_0x33d1c5['fieldName'],'type':_0x33d1c5[_0xd68f('0x25')][_0xd68f('0x26')]};});_0x91f1d6['model']=_[_0xd68f('0x22')](_0x599bff,_0xd68f('0x1f'));_0x91f1d6[_0xd68f('0x27')]=_[_0xd68f('0x28')](_0x37a757[_0xd68f('0x27')]);_0x91f1d6[_0xd68f('0x29')]=_['intersection'](_0x91f1d6[_0xd68f('0x2a')],_0x91f1d6[_0xd68f('0x27')]);_0x5995a1[_0xd68f('0x2b')]=_[_0xd68f('0x2c')](_0x91f1d6[_0xd68f('0x2a')],qs[_0xd68f('0x2d')](_0x37a757['query'][_0xd68f('0x2d')]));_0x5995a1[_0xd68f('0x2b')]=_0x5995a1[_0xd68f('0x2b')][_0xd68f('0x2e')]?_0x5995a1['attributes']:_0x91f1d6[_0xd68f('0x2a')];if(!_0x37a757['query'][_0xd68f('0x2f')]('nolimit')){_0x5995a1[_0xd68f('0x30')]=qs[_0xd68f('0x30')](_0x37a757[_0xd68f('0x27')]['limit']);_0x5995a1[_0xd68f('0x17')]=qs[_0xd68f('0x17')](_0x37a757[_0xd68f('0x27')][_0xd68f('0x17')]);}_0x5995a1['order']=qs[_0xd68f('0x31')](_0x37a757['query']['sort']);_0x5995a1['where']=qs[_0xd68f('0x29')](_[_0xd68f('0x32')](_0x37a757[_0xd68f('0x27')],_0x91f1d6[_0xd68f('0x29')]),_0x599bff);if(_0x37a757['query'][_0xd68f('0x33')]){_0x5995a1['where']=_[_0xd68f('0x34')](_0x5995a1[_0xd68f('0x35')],{'$or':_[_0xd68f('0x22')](_0x599bff,function(_0x95be7){if(_0x95be7[_0xd68f('0x25')]!==_0xd68f('0x36')){var _0xf175bb={};_0xf175bb[_0x95be7[_0xd68f('0x1f')]]={'$like':'%'+_0x37a757['query'][_0xd68f('0x33')]+'%'};return _0xf175bb;}})});}_0x5995a1=_[_0xd68f('0x34')]({},_0x5995a1,_0x37a757[_0xd68f('0x37')]);var _0x56a228={'where':_0x5995a1[_0xd68f('0x35')]};return db['IntegrationReport'][_0xd68f('0x38')](_0x56a228)['then'](function(_0x519bc2){_0x5d275d[_0xd68f('0x38')]=_0x519bc2;if(_0x37a757['query'][_0xd68f('0x39')]){_0x5995a1[_0xd68f('0x3a')]=[{'all':!![]}];}return db[_0xd68f('0x23')][_0xd68f('0x3b')](_0x5995a1);})['then'](function(_0x26c788){_0x5d275d[_0xd68f('0x3c')]=_0x26c788;return _0x5d275d;})[_0xd68f('0x1e')](respondWithFilteredResult(_0x2178e0,_0x5995a1))['catch'](handleError(_0x2178e0,null));};exports[_0xd68f('0x3d')]=function(_0x5919fa,_0x21de98){var _0x4df3c5={'raw':![],'where':{'id':_0x5919fa['params']['id']}},_0x33966d={};_0x33966d[_0xd68f('0x2a')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x33966d[_0xd68f('0x27')]=_[_0xd68f('0x28')](_0x5919fa['query']);_0x33966d[_0xd68f('0x29')]=_[_0xd68f('0x2c')](_0x33966d[_0xd68f('0x2a')],_0x33966d['query']);_0x4df3c5[_0xd68f('0x2b')]=_[_0xd68f('0x2c')](_0x33966d[_0xd68f('0x2a')],qs[_0xd68f('0x2d')](_0x5919fa[_0xd68f('0x27')][_0xd68f('0x2d')]));_0x4df3c5[_0xd68f('0x2b')]=_0x4df3c5['attributes'][_0xd68f('0x2e')]?_0x4df3c5[_0xd68f('0x2b')]:_0x33966d[_0xd68f('0x2a')];if(_0x5919fa['query'][_0xd68f('0x39')]){_0x4df3c5[_0xd68f('0x3a')]=[{'all':!![]}];}_0x4df3c5=_[_0xd68f('0x34')]({},_0x4df3c5,_0x5919fa[_0xd68f('0x37')]);return db['IntegrationReport']['find'](_0x4df3c5)[_0xd68f('0x1e')](handleEntityNotFound(_0x21de98,null))['then'](respondWithResult(_0x21de98,null))['catch'](handleError(_0x21de98,null));};exports[_0xd68f('0x3e')]=function(_0x35ca04,_0x4b3ad1){return db[_0xd68f('0x23')][_0xd68f('0x3e')](_0x35ca04['body'],{})['then'](respondWithResult(_0x4b3ad1,0xc9))[_0xd68f('0x3f')](handleError(_0x4b3ad1,null));};exports[_0xd68f('0x1d')]=function(_0x697cd8,_0x4bd707){if(_0x697cd8[_0xd68f('0x40')]['id']){delete _0x697cd8[_0xd68f('0x40')]['id'];}return db[_0xd68f('0x23')][_0xd68f('0x41')]({'where':{'id':_0x697cd8[_0xd68f('0x42')]['id']}})[_0xd68f('0x1e')](handleEntityNotFound(_0x4bd707,null))['then'](saveUpdates(_0x697cd8['body'],null))[_0xd68f('0x1e')](respondWithResult(_0x4bd707,null))[_0xd68f('0x3f')](handleError(_0x4bd707,null));};exports[_0xd68f('0x43')]=function(_0x3785f6,_0x34b4b1){return db[_0xd68f('0x23')][_0xd68f('0x41')]({'where':{'id':_0x3785f6[_0xd68f('0x42')]['id']}})[_0xd68f('0x1e')](handleEntityNotFound(_0x34b4b1,null))[_0xd68f('0x1e')](removeEntity(_0x34b4b1,null))[_0xd68f('0x3f')](handleError(_0x34b4b1,null));};exports[_0xd68f('0x44')]=function(_0x4fbce0,_0x1aff31){return db[_0xd68f('0x23')][_0xd68f('0x44')]()[_0xd68f('0x1e')](respondWithResult(_0x1aff31,null))[_0xd68f('0x3f')](handleError(_0x1aff31,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c66a49e..c5bfa80 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 _0x011f=['rimraf','../../config/environment','./integrationReport.attributes','report_integration','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x011f,0x130));var _0xf011=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x011f[_0x46e523];return _0x5da0ee;};'use strict';var _=require('lodash');var util=require(_0xf011('0x0'));var logger=require(_0xf011('0x1'))('api');var moment=require(_0xf011('0x2'));var BPromise=require(_0xf011('0x3'));var rp=require(_0xf011('0x4'));var fs=require('fs');var path=require(_0xf011('0x5'));var rimraf=require(_0xf011('0x6'));var config=require(_0xf011('0x7'));var attributes=require(_0xf011('0x8'));module['exports']=function(_0x3035dc,_0x23f119){return _0x3035dc['define']('IntegrationReport',attributes,{'tableName':_0xf011('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd98d=['../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','api','rimraf'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xd98d,0x14f));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdd98('0x0'));var util=require(_0xdd98('0x1'));var logger=require(_0xdd98('0x2'))(_0xdd98('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdd98('0x4'));var config=require(_0xdd98('0x5'));var attributes=require(_0xdd98('0x6'));module[_0xdd98('0x7')]=function(_0x4f010e,_0xa88182){return _0x4f010e['define'](_0xdd98('0x8'),attributes,{'tableName':_0xdd98('0x9'),'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 3ae8de5..d527254 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb698c2,_0x465b07){var _0x69f6e5=function(_0x253d23){while(--_0x253d23){_0xb698c2['push'](_0xb698c2['shift']());}};_0x69f6e5(++_0x465b07);}(_0xda19,0xd5));var _0x9da1=function(_0xc301f4,_0x45f3f0){_0xc301f4=_0xc301f4-0x0;var _0x2eb61b=_0xda19[_0xc301f4];return _0x2eb61b;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0x6d38=['request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x43a3e3,_0xa5ab5e){var _0x5a35e2=function(_0x57c24c){while(--_0x57c24c){_0x43a3e3['push'](_0x43a3e3['shift']());}};_0x5a35e2(++_0xa5ab5e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6d38[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b766430..5bcd107 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 _0x7ee1=['exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','/:id/sub_intervals','create','addInterval','post','put','/:id','update','delete','destroy'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x7ee1,0x8d));var _0x17ee=function(_0x1d0869,_0x406960){_0x1d0869=_0x1d0869-0x0;var _0x2f706e=_0x7ee1[_0x1d0869];return _0x2f706e;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/:id',auth[_0x17ee('0x9')](),controller['show']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['getIntervals']);router['post']('/',auth['isAuthenticated'](),controller[_0x17ee('0xb')]);router['post'](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xc')]);router[_0x17ee('0xd')]('/:id/sub_intervals/create_many',auth[_0x17ee('0x9')](),controller['addIntervals']);router[_0x17ee('0xe')](_0x17ee('0xf'),auth[_0x17ee('0x9')](),controller[_0x17ee('0x10')]);router[_0x17ee('0x11')](_0x17ee('0xf'),auth[_0x17ee('0x9')](),controller[_0x17ee('0x12')]);module[_0x17ee('0x13')]=router; \ No newline at end of file +var _0x3989=['./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','create','addInterval','post','addIntervals','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c05fe,_0x522b60){var _0x5a5764=function(_0x39428b){while(--_0x39428b){_0x1c05fe['push'](_0x1c05fe['shift']());}};_0x5a5764(++_0x522b60);}(_0x3989,0x12f));var _0x9398=function(_0x2a54dc,_0x214c65){_0x2a54dc=_0x2a54dc-0x0;var _0x141d1b=_0x3989[_0x2a54dc];return _0x141d1b;};'use strict';var multer=require(_0x9398('0x0'));var util=require('util');var path=require(_0x9398('0x1'));var timeout=require(_0x9398('0x2'));var express=require(_0x9398('0x3'));var router=express[_0x9398('0x4')]();var fs_extra=require(_0x9398('0x5'));var auth=require(_0x9398('0x6'));var interaction=require(_0x9398('0x7'));var config=require(_0x9398('0x8'));var controller=require(_0x9398('0x9'));router[_0x9398('0xa')]('/',auth[_0x9398('0xb')](),controller[_0x9398('0xc')]);router['get']('/:id',auth[_0x9398('0xb')](),controller[_0x9398('0xd')]);router[_0x9398('0xa')](_0x9398('0xe'),auth[_0x9398('0xb')](),controller['getIntervals']);router['post']('/',auth[_0x9398('0xb')](),controller[_0x9398('0xf')]);router['post'](_0x9398('0xe'),auth[_0x9398('0xb')](),controller[_0x9398('0x10')]);router[_0x9398('0x11')]('/:id/sub_intervals/create_many',auth[_0x9398('0xb')](),controller[_0x9398('0x12')]);router[_0x9398('0x13')](_0x9398('0x14'),auth[_0x9398('0xb')](),controller['update']);router[_0x9398('0x15')]('/:id',auth[_0x9398('0xb')](),controller[_0x9398('0x16')]);module[_0x9398('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index ef020f8..e2b0533 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 _0xa18f=['sequelize','STRING'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa18f,0x12e));var _0xfa18=function(_0x48f778,_0x466b43){_0x48f778=_0x48f778-0x0;var _0x51bdd6=_0xa18f[_0x48f778];return _0x51bdd6;};'use strict';var Sequelize=require(_0xfa18('0x0'));module['exports']={'name':{'type':Sequelize[_0xfa18('0x1')]},'description':{'type':Sequelize[_0xfa18('0x1')]},'interval':{'type':Sequelize[_0xfa18('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xfbdd=['exports','STRING','sequelize'];(function(_0x1c6569,_0x4a5a27){var _0x39e6f8=function(_0x117373){while(--_0x117373){_0x1c6569['push'](_0x1c6569['shift']());}};_0x39e6f8(++_0x4a5a27);}(_0xfbdd,0x18e));var _0xdfbd=function(_0x52ae30,_0x2364fc){_0x52ae30=_0x52ae30-0x0;var _0x1a05d4=_0xfbdd[_0x52ae30];return _0x1a05d4;};'use strict';var Sequelize=require(_0xdfbd('0x0'));module[_0xdfbd('0x1')]={'name':{'type':Sequelize[_0xdfbd('0x2')]},'description':{'type':Sequelize[_0xdfbd('0x2')]},'interval':{'type':Sequelize[_0xdfbd('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 3236248..583fff8 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 _0x64a8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','getIntervals','findOne','order','hasOwnProperty','nolimit','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv'];(function(_0x4f48ff,_0x16b4ec){var _0x227dc6=function(_0x584a1e){while(--_0x584a1e){_0x4f48ff['push'](_0x4f48ff['shift']());}};_0x227dc6(++_0x16b4ec);}(_0x64a8,0xa9));var _0x864a=function(_0x192448,_0x93327c){_0x192448=_0x192448-0x0;var _0x50d759=_0x64a8[_0x192448];return _0x50d759;};'use strict';var emlformat=require(_0x864a('0x0'));var rimraf=require(_0x864a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x864a('0x2'));var rp=require(_0x864a('0x3'));var moment=require(_0x864a('0x4'));var BPromise=require(_0x864a('0x5'));var Mustache=require(_0x864a('0x6'));var util=require(_0x864a('0x7'));var path=require('path');var sox=require(_0x864a('0x8'));var csv=require('to-csv');var ejs=require(_0x864a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x864a('0xa'));var squel=require(_0x864a('0xb'));var crypto=require(_0x864a('0xc'));var jsforce=require(_0x864a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x864a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x864a('0xf'));var as=require(_0x864a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x864a('0x11'))(_0x864a('0x12'));var utils=require(_0x864a('0x13'));var config=require(_0x864a('0x14'));var licenseUtil=require(_0x864a('0x15'));var db=require(_0x864a('0x16'))['db'];var extensions=require(_0x864a('0x17'));function respondWithStatusCode(_0x2acea3,_0x4ff217){_0x4ff217=_0x4ff217||0xcc;return function(_0xe081ff){if(_0xe081ff){return _0x2acea3[_0x864a('0x18')](_0x4ff217);}return _0x2acea3[_0x864a('0x19')](_0x4ff217)[_0x864a('0x1a')]();};}function respondWithResult(_0x453788,_0x23cd91){_0x23cd91=_0x23cd91||0xc8;return function(_0x172baf){if(_0x172baf){return _0x453788[_0x864a('0x19')](_0x23cd91)[_0x864a('0x1b')](_0x172baf);}};}function respondWithFilteredResult(_0x1cb3c0,_0x15f2ef){return function(_0x247e53){if(_0x247e53){var _0x4e42e7=typeof _0x15f2ef['offset']==='undefined'&&typeof _0x15f2ef[_0x864a('0x1c')]===_0x864a('0x1d');var _0x39ffba=_0x247e53[_0x864a('0x1e')];var _0x282c30=_0x4e42e7?0x0:_0x15f2ef[_0x864a('0x1f')];var _0x58941b=_0x4e42e7?_0x247e53['count']:_0x15f2ef[_0x864a('0x1f')]+_0x15f2ef[_0x864a('0x1c')];var _0x38e7ea;if(_0x58941b>=_0x39ffba){_0x58941b=_0x39ffba;_0x38e7ea=0xc8;}else{_0x38e7ea=0xce;}_0x1cb3c0['status'](_0x38e7ea);return _0x1cb3c0['set'](_0x864a('0x20'),_0x282c30+'-'+_0x58941b+'/'+_0x39ffba)['json'](_0x247e53);}return null;};}function patchUpdates(_0x26c759){return function(_0x429d37){try{jsonpatch[_0x864a('0x21')](_0x429d37,_0x26c759,!![]);}catch(_0x14f364){return BPromise[_0x864a('0x22')](_0x14f364);}return _0x429d37[_0x864a('0x23')]();};}function saveUpdates(_0x43a4fd,_0xee19d4){return function(_0x296f7e){if(_0x296f7e){return _0x296f7e['update'](_0x43a4fd)[_0x864a('0x24')](function(_0x3086c1){return _0x3086c1;});}return null;};}function removeEntity(_0x4213c3,_0x57ffb6){return function(_0xa64b70){if(_0xa64b70){return _0xa64b70[_0x864a('0x25')]()[_0x864a('0x24')](function(){var _0x153fb3=_0xa64b70[_0x864a('0x26')]({'plain':!![]});var _0x1dc7e6=_0x864a('0x27');return db[_0x864a('0x28')][_0x864a('0x25')]({'where':{'type':_0x1dc7e6,'resourceId':_0x153fb3['id']}})[_0x864a('0x24')](function(){return _0xa64b70;});})['then'](function(){_0x4213c3[_0x864a('0x19')](0xcc)[_0x864a('0x1a')]();});}};}function handleEntityNotFound(_0x10945a,_0xa08ca6){return function(_0x4350d8){if(!_0x4350d8){_0x10945a['sendStatus'](0x194);}return _0x4350d8;};}function handleError(_0x146156,_0x1902b1){_0x1902b1=_0x1902b1||0x1f4;return function(_0x3d2d0f){logger['error'](_0x3d2d0f[_0x864a('0x29')]);if(_0x3d2d0f[_0x864a('0x2a')]){delete _0x3d2d0f[_0x864a('0x2a')];}_0x146156[_0x864a('0x19')](_0x1902b1)[_0x864a('0x2b')](_0x3d2d0f);};}exports['index']=function(_0x58e649,_0x2dc63c){var _0x566912={},_0x1d4b00={},_0x48b3ae={'count':0x0,'rows':[]};var _0x4c3f19=_[_0x864a('0x2c')](db[_0x864a('0x2d')][_0x864a('0x2e')],function(_0x2bdd27){return{'name':_0x2bdd27[_0x864a('0x2f')],'type':_0x2bdd27[_0x864a('0x30')][_0x864a('0x31')]};});_0x1d4b00['model']=_['map'](_0x4c3f19,_0x864a('0x2a'));_0x1d4b00['query']=_['keys'](_0x58e649[_0x864a('0x32')]);_0x1d4b00['filters']=_['intersection'](_0x1d4b00['model'],_0x1d4b00[_0x864a('0x32')]);_0x566912['attributes']=_[_0x864a('0x33')](_0x1d4b00[_0x864a('0x34')],qs[_0x864a('0x35')](_0x58e649[_0x864a('0x32')][_0x864a('0x35')]));_0x566912[_0x864a('0x36')]=_0x566912['attributes'][_0x864a('0x37')]?_0x566912[_0x864a('0x36')]:_0x1d4b00[_0x864a('0x34')];if(!_0x58e649[_0x864a('0x32')]['hasOwnProperty']('nolimit')){_0x566912[_0x864a('0x1c')]=qs[_0x864a('0x1c')](_0x58e649[_0x864a('0x32')][_0x864a('0x1c')]);_0x566912[_0x864a('0x1f')]=qs[_0x864a('0x1f')](_0x58e649[_0x864a('0x32')][_0x864a('0x1f')]);}_0x566912['order']=qs[_0x864a('0x38')](_0x58e649[_0x864a('0x32')][_0x864a('0x38')]);_0x566912[_0x864a('0x39')]=qs[_0x864a('0x3a')](_[_0x864a('0x3b')](_0x58e649[_0x864a('0x32')],_0x1d4b00[_0x864a('0x3a')]),_0x4c3f19);if(_0x58e649[_0x864a('0x32')]['filter']){_0x566912[_0x864a('0x39')]=_[_0x864a('0x3c')](_0x566912[_0x864a('0x39')],{'$or':_['map'](_0x4c3f19,function(_0x45def2){if(_0x45def2['type']!==_0x864a('0x3d')){var _0x4bd95a={};_0x4bd95a[_0x45def2[_0x864a('0x2a')]]={'$like':'%'+_0x58e649[_0x864a('0x32')][_0x864a('0x3e')]+'%'};return _0x4bd95a;}})});}_0x566912=_[_0x864a('0x3c')]({},_0x566912,_0x58e649[_0x864a('0x3f')]);var _0x282756={'where':_0x566912[_0x864a('0x39')]};return db[_0x864a('0x2d')][_0x864a('0x1e')](_0x282756)[_0x864a('0x24')](function(_0x20ec08){_0x48b3ae['count']=_0x20ec08;if(_0x58e649[_0x864a('0x32')][_0x864a('0x40')]){_0x566912[_0x864a('0x41')]=[{'all':!![]}];}return db[_0x864a('0x2d')][_0x864a('0x42')](_0x566912);})[_0x864a('0x24')](function(_0x451d26){_0x48b3ae['rows']=_0x451d26;return _0x48b3ae;})[_0x864a('0x24')](respondWithFilteredResult(_0x2dc63c,_0x566912))[_0x864a('0x43')](handleError(_0x2dc63c,null));};exports[_0x864a('0x44')]=function(_0xafea4b,_0x2abe65){var _0x3191b9={'raw':!![],'where':{'id':_0xafea4b[_0x864a('0x45')]['id']}},_0x58c245={};_0x58c245['model']=_[_0x864a('0x46')](db['Interval']['rawAttributes']);_0x58c245[_0x864a('0x32')]=_[_0x864a('0x46')](_0xafea4b[_0x864a('0x32')]);_0x58c245[_0x864a('0x3a')]=_[_0x864a('0x33')](_0x58c245[_0x864a('0x34')],_0x58c245[_0x864a('0x32')]);_0x3191b9[_0x864a('0x36')]=_[_0x864a('0x33')](_0x58c245[_0x864a('0x34')],qs[_0x864a('0x35')](_0xafea4b[_0x864a('0x32')]['fields']));_0x3191b9[_0x864a('0x36')]=_0x3191b9[_0x864a('0x36')][_0x864a('0x37')]?_0x3191b9[_0x864a('0x36')]:_0x58c245[_0x864a('0x34')];if(_0xafea4b[_0x864a('0x32')][_0x864a('0x40')]){_0x3191b9['include']=[{'all':!![]}];}_0x3191b9=_['merge']({},_0x3191b9,_0xafea4b['options']);return db[_0x864a('0x2d')][_0x864a('0x47')](_0x3191b9)[_0x864a('0x24')](handleEntityNotFound(_0x2abe65,null))['then'](respondWithResult(_0x2abe65,null))[_0x864a('0x43')](handleError(_0x2abe65,null));};exports[_0x864a('0x48')]=function(_0x5854c1,_0x163bf5){return db[_0x864a('0x2d')][_0x864a('0x48')](_0x5854c1[_0x864a('0x49')],{})[_0x864a('0x24')](function(_0x2ef7e4){var _0x491017=_0x5854c1[_0x864a('0x4a')][_0x864a('0x26')]({'plain':!![]});if(!_0x491017)throw new Error(_0x864a('0x4b'));if(_0x491017[_0x864a('0x4c')]===_0x864a('0x4a')){var _0x428bec=_0x2ef7e4[_0x864a('0x26')]({'plain':!![]});var _0x503096=_0x864a('0x27');return db['UserProfileSection'][_0x864a('0x47')]({'where':{'name':_0x503096,'userProfileId':_0x491017[_0x864a('0x4d')]},'raw':!![]})[_0x864a('0x24')](function(_0x10287f){if(_0x10287f&&_0x10287f[_0x864a('0x4e')]===0x0){return db[_0x864a('0x28')][_0x864a('0x48')]({'name':_0x428bec[_0x864a('0x2a')],'resourceId':_0x428bec['id'],'type':_0x10287f[_0x864a('0x2a')],'sectionId':_0x10287f['id']},{})[_0x864a('0x24')](function(){return _0x2ef7e4;});}else{return _0x2ef7e4;}})[_0x864a('0x43')](function(_0x5d381f){logger[_0x864a('0x4f')](_0x864a('0x50'),_0x5d381f);throw _0x5d381f;});}return _0x2ef7e4;})[_0x864a('0x24')](respondWithResult(_0x163bf5,0xc9))[_0x864a('0x43')](handleError(_0x163bf5,null));};exports[_0x864a('0x51')]=function(_0x338a13,_0x45be7f){if(_0x338a13[_0x864a('0x49')]['id']){delete _0x338a13['body']['id'];}return db[_0x864a('0x2d')][_0x864a('0x47')]({'where':{'id':_0x338a13[_0x864a('0x45')]['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x45be7f,null))[_0x864a('0x24')](saveUpdates(_0x338a13[_0x864a('0x49')],null))[_0x864a('0x24')](respondWithResult(_0x45be7f,null))['catch'](handleError(_0x45be7f,null));};exports[_0x864a('0x25')]=function(_0x243682,_0x56eb11){return db['Interval'][_0x864a('0x47')]({'where':{'id':_0x243682[_0x864a('0x45')]['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x56eb11,null))[_0x864a('0x24')](removeEntity(_0x56eb11,null))[_0x864a('0x43')](handleError(_0x56eb11,null));};exports[_0x864a('0x52')]=function(_0x50f668,_0x4af47a,_0x23677c){if(_0x50f668[_0x864a('0x49')]['id']){delete _0x50f668['body']['id'];}return db[_0x864a('0x2d')][_0x864a('0x47')]({'where':{'id':_0x50f668[_0x864a('0x45')]['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x4af47a,null))['then'](function(_0x36d0fb){if(_0x36d0fb){_0x50f668['body']['IntervalId']=_0x36d0fb['id'];return db[_0x864a('0x2d')][_0x864a('0x48')](_0x50f668['body']);}})['then'](respondWithResult(_0x4af47a,null))[_0x864a('0x43')](handleError(_0x4af47a,null));};exports[_0x864a('0x53')]=function(_0x3afa6e,_0x891041,_0x23b059){var _0x433c0c={};var _0x4afb8d={};var _0x479355;var _0x9a776;return db[_0x864a('0x2d')][_0x864a('0x54')]({'where':{'id':_0x3afa6e['params']['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x891041,null))[_0x864a('0x24')](function(_0x2b7d07){if(_0x2b7d07){_0x479355=_0x2b7d07;_0x4afb8d[_0x864a('0x34')]=_[_0x864a('0x46')](db[_0x864a('0x2d')][_0x864a('0x2e')]);_0x4afb8d['query']=_[_0x864a('0x46')](_0x3afa6e['query']);_0x4afb8d[_0x864a('0x3a')]=_['intersection'](_0x4afb8d[_0x864a('0x34')],_0x4afb8d[_0x864a('0x32')]);_0x433c0c[_0x864a('0x36')]=_[_0x864a('0x33')](_0x4afb8d[_0x864a('0x34')],qs[_0x864a('0x35')](_0x3afa6e[_0x864a('0x32')][_0x864a('0x35')]));_0x433c0c[_0x864a('0x36')]=_0x433c0c[_0x864a('0x36')]['length']?_0x433c0c[_0x864a('0x36')]:_0x4afb8d[_0x864a('0x34')];_0x433c0c[_0x864a('0x55')]=qs[_0x864a('0x38')](_0x3afa6e['query'][_0x864a('0x38')]);_0x433c0c['where']=qs[_0x864a('0x3a')](_[_0x864a('0x3b')](_0x3afa6e[_0x864a('0x32')],_0x4afb8d[_0x864a('0x3a')]));if(_0x3afa6e['query'][_0x864a('0x3e')]){_0x433c0c[_0x864a('0x39')]=_['merge'](_0x433c0c[_0x864a('0x39')],{'$or':_['map'](_0x433c0c['attributes'],function(_0x313ab6){var _0x220710={};_0x220710[_0x313ab6]={'$like':'%'+_0x3afa6e['query'][_0x864a('0x3e')]+'%'};return _0x220710;})});}_0x433c0c=_[_0x864a('0x3c')]({},_0x433c0c,_0x3afa6e[_0x864a('0x3f')]);return _0x479355[_0x864a('0x53')](_0x433c0c);}})[_0x864a('0x24')](function(_0x17c81c){if(_0x17c81c){_0x9a776=_0x17c81c[_0x864a('0x37')];if(!_0x3afa6e[_0x864a('0x32')][_0x864a('0x56')](_0x864a('0x57'))){_0x433c0c[_0x864a('0x1c')]=qs[_0x864a('0x1c')](_0x3afa6e[_0x864a('0x32')][_0x864a('0x1c')]);_0x433c0c['offset']=qs[_0x864a('0x1f')](_0x3afa6e[_0x864a('0x32')][_0x864a('0x1f')]);}return _0x479355['getIntervals'](_0x433c0c);}})['then'](function(_0x4ad033){if(_0x4ad033){return _0x4ad033?{'count':_0x9a776,'rows':_0x4ad033}:null;}})[_0x864a('0x24')](respondWithResult(_0x891041,null))[_0x864a('0x43')](handleError(_0x891041,null));};exports['addIntervals']=function(_0x434e8e,_0x2465b7,_0x3e233e){return db[_0x864a('0x2d')][_0x864a('0x54')]({'where':{'id':_0x434e8e[_0x864a('0x45')]['id']}})[_0x864a('0x24')](handleEntityNotFound(_0x2465b7,null))[_0x864a('0x24')](function(_0x741fdd){if(_0x741fdd){return db[_0x864a('0x58')][_0x864a('0x59')](function(_0x4b27c4){return db[_0x864a('0x2d')][_0x864a('0x25')]({'where':{'IntervalId':_0x434e8e[_0x864a('0x45')]['id']},'transaction':_0x4b27c4})[_0x864a('0x24')](function(_0x36de09){var _0x33d585=_[_0x864a('0x2c')](_0x434e8e['body'],function(_0x412881){delete _0x412881['id'];_0x412881[_0x864a('0x5a')]=_0x434e8e['params']['id'];return _0x412881;});return db[_0x864a('0x2d')][_0x864a('0x5b')](_0x33d585,{'transaction':_0x4b27c4});});})['then'](function(){return db[_0x864a('0x2d')][_0x864a('0x42')]({'where':{'IntervalId':_0x434e8e[_0x864a('0x45')]['id']}});});}})['then'](respondWithResult(_0x2465b7,null))[_0x864a('0x43')](handleError(_0x2465b7,null));}; \ No newline at end of file +var _0xeb37=['Intervals','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','hasOwnProperty','nolimit','findOne','bulkCreate','eml-format','rimraf','fast-json-patch','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy'];(function(_0xecd7c9,_0x3260b2){var _0x398372=function(_0x2e42eb){while(--_0x2e42eb){_0xecd7c9['push'](_0xecd7c9['shift']());}};_0x398372(++_0x3260b2);}(_0xeb37,0x136));var _0x7eb3=function(_0x6d0083,_0x567625){_0x6d0083=_0x6d0083-0x0;var _0xe0cf01=_0xeb37[_0x6d0083];return _0xe0cf01;};'use strict';var emlformat=require(_0x7eb3('0x0'));var rimraf=require(_0x7eb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7eb3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7eb3('0x3'));var util=require(_0x7eb3('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x7eb3('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7eb3('0x6'));var _=require(_0x7eb3('0x7'));var squel=require(_0x7eb3('0x8'));var crypto=require(_0x7eb3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7eb3('0xa'));var toCsv=require(_0x7eb3('0x5'));var querystring=require(_0x7eb3('0xb'));var Papa=require(_0x7eb3('0xc'));var Redis=require('ioredis');var authService=require(_0x7eb3('0xd'));var qs=require(_0x7eb3('0xe'));var as=require(_0x7eb3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eb3('0x10'))(_0x7eb3('0x11'));var utils=require('../../config/utils');var config=require(_0x7eb3('0x12'));var licenseUtil=require(_0x7eb3('0x13'));var db=require(_0x7eb3('0x14'))['db'];var extensions=require(_0x7eb3('0x15'));function respondWithStatusCode(_0x37e9f6,_0xc5781e){_0xc5781e=_0xc5781e||0xcc;return function(_0x36c7a3){if(_0x36c7a3){return _0x37e9f6['sendStatus'](_0xc5781e);}return _0x37e9f6[_0x7eb3('0x16')](_0xc5781e)[_0x7eb3('0x17')]();};}function respondWithResult(_0x3f136c,_0x23a148){_0x23a148=_0x23a148||0xc8;return function(_0x385fab){if(_0x385fab){return _0x3f136c[_0x7eb3('0x16')](_0x23a148)[_0x7eb3('0x18')](_0x385fab);}};}function respondWithFilteredResult(_0x106d85,_0x174cd5){return function(_0x588d5f){if(_0x588d5f){var _0x564875=typeof _0x174cd5[_0x7eb3('0x19')]===_0x7eb3('0x1a')&&typeof _0x174cd5['limit']===_0x7eb3('0x1a');var _0x460092=_0x588d5f[_0x7eb3('0x1b')];var _0xdc60fa=_0x564875?0x0:_0x174cd5[_0x7eb3('0x19')];var _0x5dd95a=_0x564875?_0x588d5f[_0x7eb3('0x1b')]:_0x174cd5['offset']+_0x174cd5[_0x7eb3('0x1c')];var _0x458f44;if(_0x5dd95a>=_0x460092){_0x5dd95a=_0x460092;_0x458f44=0xc8;}else{_0x458f44=0xce;}_0x106d85[_0x7eb3('0x16')](_0x458f44);return _0x106d85[_0x7eb3('0x1d')](_0x7eb3('0x1e'),_0xdc60fa+'-'+_0x5dd95a+'/'+_0x460092)[_0x7eb3('0x18')](_0x588d5f);}return null;};}function patchUpdates(_0x4b2705){return function(_0x17a797){try{jsonpatch[_0x7eb3('0x1f')](_0x17a797,_0x4b2705,!![]);}catch(_0x435d86){return BPromise['reject'](_0x435d86);}return _0x17a797['save']();};}function saveUpdates(_0x391cca,_0x5458a3){return function(_0x3d964f){if(_0x3d964f){return _0x3d964f['update'](_0x391cca)[_0x7eb3('0x20')](function(_0x1d887f){return _0x1d887f;});}return null;};}function removeEntity(_0x4c1d35,_0x2a4285){return function(_0xda44aa){if(_0xda44aa){return _0xda44aa[_0x7eb3('0x21')]()[_0x7eb3('0x20')](function(){var _0x489153=_0xda44aa['get']({'plain':!![]});var _0x522151=_0x7eb3('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x522151,'resourceId':_0x489153['id']}})[_0x7eb3('0x20')](function(){return _0xda44aa;});})[_0x7eb3('0x20')](function(){_0x4c1d35[_0x7eb3('0x16')](0xcc)[_0x7eb3('0x17')]();});}};}function handleEntityNotFound(_0x35284f,_0x4906ad){return function(_0x413a52){if(!_0x413a52){_0x35284f['sendStatus'](0x194);}return _0x413a52;};}function handleError(_0x1b2b6a,_0x515312){_0x515312=_0x515312||0x1f4;return function(_0x537ec5){logger[_0x7eb3('0x23')](_0x537ec5[_0x7eb3('0x24')]);if(_0x537ec5['name']){delete _0x537ec5[_0x7eb3('0x25')];}_0x1b2b6a[_0x7eb3('0x16')](_0x515312)[_0x7eb3('0x26')](_0x537ec5);};}exports[_0x7eb3('0x27')]=function(_0x17bb2c,_0x4bccc2){var _0x4bbace={},_0x2fdd35={},_0x2a9e3a={'count':0x0,'rows':[]};var _0x53b535=_[_0x7eb3('0x28')](db[_0x7eb3('0x29')][_0x7eb3('0x2a')],function(_0x214f66){return{'name':_0x214f66[_0x7eb3('0x2b')],'type':_0x214f66[_0x7eb3('0x2c')]['key']};});_0x2fdd35[_0x7eb3('0x2d')]=_[_0x7eb3('0x28')](_0x53b535,_0x7eb3('0x25'));_0x2fdd35[_0x7eb3('0x2e')]=_['keys'](_0x17bb2c['query']);_0x2fdd35[_0x7eb3('0x2f')]=_[_0x7eb3('0x30')](_0x2fdd35[_0x7eb3('0x2d')],_0x2fdd35[_0x7eb3('0x2e')]);_0x4bbace['attributes']=_[_0x7eb3('0x30')](_0x2fdd35[_0x7eb3('0x2d')],qs['fields'](_0x17bb2c[_0x7eb3('0x2e')][_0x7eb3('0x31')]));_0x4bbace[_0x7eb3('0x32')]=_0x4bbace[_0x7eb3('0x32')]['length']?_0x4bbace[_0x7eb3('0x32')]:_0x2fdd35[_0x7eb3('0x2d')];if(!_0x17bb2c['query']['hasOwnProperty']('nolimit')){_0x4bbace['limit']=qs[_0x7eb3('0x1c')](_0x17bb2c['query']['limit']);_0x4bbace[_0x7eb3('0x19')]=qs[_0x7eb3('0x19')](_0x17bb2c[_0x7eb3('0x2e')]['offset']);}_0x4bbace[_0x7eb3('0x33')]=qs[_0x7eb3('0x34')](_0x17bb2c['query'][_0x7eb3('0x34')]);_0x4bbace['where']=qs['filters'](_[_0x7eb3('0x35')](_0x17bb2c[_0x7eb3('0x2e')],_0x2fdd35[_0x7eb3('0x2f')]),_0x53b535);if(_0x17bb2c[_0x7eb3('0x2e')][_0x7eb3('0x36')]){_0x4bbace[_0x7eb3('0x37')]=_[_0x7eb3('0x38')](_0x4bbace['where'],{'$or':_[_0x7eb3('0x28')](_0x53b535,function(_0x497fdf){if(_0x497fdf[_0x7eb3('0x2c')]!=='VIRTUAL'){var _0x1c8df2={};_0x1c8df2[_0x497fdf[_0x7eb3('0x25')]]={'$like':'%'+_0x17bb2c[_0x7eb3('0x2e')][_0x7eb3('0x36')]+'%'};return _0x1c8df2;}})});}_0x4bbace=_[_0x7eb3('0x38')]({},_0x4bbace,_0x17bb2c[_0x7eb3('0x39')]);var _0x5289bb={'where':_0x4bbace['where']};return db[_0x7eb3('0x29')][_0x7eb3('0x1b')](_0x5289bb)[_0x7eb3('0x20')](function(_0x68c239){_0x2a9e3a[_0x7eb3('0x1b')]=_0x68c239;if(_0x17bb2c[_0x7eb3('0x2e')][_0x7eb3('0x3a')]){_0x4bbace[_0x7eb3('0x3b')]=[{'all':!![]}];}return db[_0x7eb3('0x29')]['findAll'](_0x4bbace);})[_0x7eb3('0x20')](function(_0x4e87f6){_0x2a9e3a[_0x7eb3('0x3c')]=_0x4e87f6;return _0x2a9e3a;})['then'](respondWithFilteredResult(_0x4bccc2,_0x4bbace))[_0x7eb3('0x3d')](handleError(_0x4bccc2,null));};exports[_0x7eb3('0x3e')]=function(_0x204672,_0x4502c4){var _0x31c673={'raw':!![],'where':{'id':_0x204672[_0x7eb3('0x3f')]['id']}},_0x17b672={};_0x17b672[_0x7eb3('0x2d')]=_[_0x7eb3('0x40')](db[_0x7eb3('0x29')]['rawAttributes']);_0x17b672[_0x7eb3('0x2e')]=_[_0x7eb3('0x40')](_0x204672[_0x7eb3('0x2e')]);_0x17b672['filters']=_[_0x7eb3('0x30')](_0x17b672[_0x7eb3('0x2d')],_0x17b672[_0x7eb3('0x2e')]);_0x31c673[_0x7eb3('0x32')]=_[_0x7eb3('0x30')](_0x17b672[_0x7eb3('0x2d')],qs[_0x7eb3('0x31')](_0x204672['query'][_0x7eb3('0x31')]));_0x31c673[_0x7eb3('0x32')]=_0x31c673[_0x7eb3('0x32')][_0x7eb3('0x41')]?_0x31c673[_0x7eb3('0x32')]:_0x17b672['model'];if(_0x204672['query'][_0x7eb3('0x3a')]){_0x31c673['include']=[{'all':!![]}];}_0x31c673=_[_0x7eb3('0x38')]({},_0x31c673,_0x204672['options']);return db['Interval'][_0x7eb3('0x42')](_0x31c673)[_0x7eb3('0x20')](handleEntityNotFound(_0x4502c4,null))[_0x7eb3('0x20')](respondWithResult(_0x4502c4,null))['catch'](handleError(_0x4502c4,null));};exports[_0x7eb3('0x43')]=function(_0x5841bc,_0x3aefdd){return db[_0x7eb3('0x29')]['create'](_0x5841bc[_0x7eb3('0x44')],{})[_0x7eb3('0x20')](function(_0x3ae97e){var _0x426310=_0x5841bc[_0x7eb3('0x45')][_0x7eb3('0x46')]({'plain':!![]});if(!_0x426310)throw new Error(_0x7eb3('0x47'));if(_0x426310[_0x7eb3('0x48')]===_0x7eb3('0x45')){var _0x110be1=_0x3ae97e[_0x7eb3('0x46')]({'plain':!![]});var _0x56a0e9=_0x7eb3('0x22');return db[_0x7eb3('0x49')][_0x7eb3('0x42')]({'where':{'name':_0x56a0e9,'userProfileId':_0x426310[_0x7eb3('0x4a')]},'raw':!![]})[_0x7eb3('0x20')](function(_0x15dcaf){if(_0x15dcaf&&_0x15dcaf[_0x7eb3('0x4b')]===0x0){return db[_0x7eb3('0x4c')][_0x7eb3('0x43')]({'name':_0x110be1[_0x7eb3('0x25')],'resourceId':_0x110be1['id'],'type':_0x15dcaf[_0x7eb3('0x25')],'sectionId':_0x15dcaf['id']},{})[_0x7eb3('0x20')](function(){return _0x3ae97e;});}else{return _0x3ae97e;}})['catch'](function(_0x4c5a2c){logger[_0x7eb3('0x23')](_0x7eb3('0x4d'),_0x4c5a2c);throw _0x4c5a2c;});}return _0x3ae97e;})[_0x7eb3('0x20')](respondWithResult(_0x3aefdd,0xc9))[_0x7eb3('0x3d')](handleError(_0x3aefdd,null));};exports[_0x7eb3('0x4e')]=function(_0x66d2e5,_0x260a86){if(_0x66d2e5[_0x7eb3('0x44')]['id']){delete _0x66d2e5[_0x7eb3('0x44')]['id'];}return db[_0x7eb3('0x29')][_0x7eb3('0x42')]({'where':{'id':_0x66d2e5['params']['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x260a86,null))[_0x7eb3('0x20')](saveUpdates(_0x66d2e5['body'],null))[_0x7eb3('0x20')](respondWithResult(_0x260a86,null))['catch'](handleError(_0x260a86,null));};exports[_0x7eb3('0x21')]=function(_0x117f3d,_0x11745b){return db['Interval']['find']({'where':{'id':_0x117f3d[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x11745b,null))[_0x7eb3('0x20')](removeEntity(_0x11745b,null))[_0x7eb3('0x3d')](handleError(_0x11745b,null));};exports[_0x7eb3('0x4f')]=function(_0xf6473d,_0x2fa035,_0x51e839){if(_0xf6473d[_0x7eb3('0x44')]['id']){delete _0xf6473d[_0x7eb3('0x44')]['id'];}return db[_0x7eb3('0x29')][_0x7eb3('0x42')]({'where':{'id':_0xf6473d[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x2fa035,null))[_0x7eb3('0x20')](function(_0x44d25a){if(_0x44d25a){_0xf6473d[_0x7eb3('0x44')][_0x7eb3('0x50')]=_0x44d25a['id'];return db[_0x7eb3('0x29')][_0x7eb3('0x43')](_0xf6473d[_0x7eb3('0x44')]);}})[_0x7eb3('0x20')](respondWithResult(_0x2fa035,null))[_0x7eb3('0x3d')](handleError(_0x2fa035,null));};exports[_0x7eb3('0x51')]=function(_0x54c870,_0x2d2b37,_0x2caf67){var _0x527c33={};var _0xc0e022={};var _0x1dcf86;var _0x28893d;return db['Interval']['findOne']({'where':{'id':_0x54c870[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x2d2b37,null))[_0x7eb3('0x20')](function(_0x4d894e){if(_0x4d894e){_0x1dcf86=_0x4d894e;_0xc0e022['model']=_[_0x7eb3('0x40')](db[_0x7eb3('0x29')][_0x7eb3('0x2a')]);_0xc0e022[_0x7eb3('0x2e')]=_[_0x7eb3('0x40')](_0x54c870[_0x7eb3('0x2e')]);_0xc0e022[_0x7eb3('0x2f')]=_[_0x7eb3('0x30')](_0xc0e022[_0x7eb3('0x2d')],_0xc0e022[_0x7eb3('0x2e')]);_0x527c33[_0x7eb3('0x32')]=_[_0x7eb3('0x30')](_0xc0e022[_0x7eb3('0x2d')],qs[_0x7eb3('0x31')](_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x31')]));_0x527c33[_0x7eb3('0x32')]=_0x527c33[_0x7eb3('0x32')]['length']?_0x527c33[_0x7eb3('0x32')]:_0xc0e022['model'];_0x527c33[_0x7eb3('0x33')]=qs[_0x7eb3('0x34')](_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x34')]);_0x527c33[_0x7eb3('0x37')]=qs[_0x7eb3('0x2f')](_[_0x7eb3('0x35')](_0x54c870[_0x7eb3('0x2e')],_0xc0e022[_0x7eb3('0x2f')]));if(_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x36')]){_0x527c33[_0x7eb3('0x37')]=_['merge'](_0x527c33[_0x7eb3('0x37')],{'$or':_['map'](_0x527c33['attributes'],function(_0x327962){var _0x2a0c49={};_0x2a0c49[_0x327962]={'$like':'%'+_0x54c870['query'][_0x7eb3('0x36')]+'%'};return _0x2a0c49;})});}_0x527c33=_[_0x7eb3('0x38')]({},_0x527c33,_0x54c870[_0x7eb3('0x39')]);return _0x1dcf86[_0x7eb3('0x51')](_0x527c33);}})[_0x7eb3('0x20')](function(_0x16579b){if(_0x16579b){_0x28893d=_0x16579b[_0x7eb3('0x41')];if(!_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x52')](_0x7eb3('0x53'))){_0x527c33[_0x7eb3('0x1c')]=qs[_0x7eb3('0x1c')](_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x1c')]);_0x527c33[_0x7eb3('0x19')]=qs[_0x7eb3('0x19')](_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x19')]);}return _0x1dcf86[_0x7eb3('0x51')](_0x527c33);}})[_0x7eb3('0x20')](function(_0x502174){if(_0x502174){return _0x502174?{'count':_0x28893d,'rows':_0x502174}:null;}})[_0x7eb3('0x20')](respondWithResult(_0x2d2b37,null))['catch'](handleError(_0x2d2b37,null));};exports['addIntervals']=function(_0xd16bb3,_0x488843,_0x406f06){return db[_0x7eb3('0x29')][_0x7eb3('0x54')]({'where':{'id':_0xd16bb3[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x488843,null))[_0x7eb3('0x20')](function(_0x49dd49){if(_0x49dd49){return db['sequelize']['transaction'](function(_0x33194f){return db['Interval'][_0x7eb3('0x21')]({'where':{'IntervalId':_0xd16bb3['params']['id']},'transaction':_0x33194f})[_0x7eb3('0x20')](function(_0x1101d3){var _0x1f53b3=_[_0x7eb3('0x28')](_0xd16bb3[_0x7eb3('0x44')],function(_0x4aaf20){delete _0x4aaf20['id'];_0x4aaf20[_0x7eb3('0x50')]=_0xd16bb3[_0x7eb3('0x3f')]['id'];return _0x4aaf20;});return db[_0x7eb3('0x29')][_0x7eb3('0x55')](_0x1f53b3,{'transaction':_0x33194f});});})[_0x7eb3('0x20')](function(){return db[_0x7eb3('0x29')]['findAll']({'where':{'IntervalId':_0xd16bb3[_0x7eb3('0x3f')]['id']}});});}})[_0x7eb3('0x20')](respondWithResult(_0x488843,null))[_0x7eb3('0x3d')](handleError(_0x488843,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7e423ee..0d352e7 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 _0x9c99=['all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','Interval','tools_intervals','rewrite','interval','string','getIntervals'];(function(_0x5581c9,_0x3792da){var _0x1a2ef7=function(_0x47ca00){while(--_0x47ca00){_0x5581c9['push'](_0x5581c9['shift']());}};_0x1a2ef7(++_0x3792da);}(_0x9c99,0xa0));var _0x99c9=function(_0x5c27b6,_0x4a3c28){_0x5c27b6=_0x5c27b6-0x0;var _0x284ce4=_0x9c99[_0x5c27b6];return _0x284ce4;};'use strict';var attributes=require(_0x99c9('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x99c9('0x1'))[_0x99c9('0x2')];module['exports']=function(_0x2f76dd){return _0x2f76dd['define'](_0x99c9('0x3'),attributes,{'tableName':_0x99c9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ebdd8){extensions[_0x99c9('0x5')](_0x2f76dd,_0x5ebdd8);},'afterBulkCreate':function(_0x3328f2,_0x5d741c,_0x2962b4){_0x2962b4();extensions[_0x99c9('0x5')](_0x2f76dd,_0x3328f2[0x0]);},'afterUpdate':function(_0x517d09){extensions[_0x99c9('0x5')](_0x2f76dd,_0x517d09);},'afterDestroy':function(_0x2f84d4){extensions[_0x99c9('0x5')](_0x2f76dd,_0x2f84d4);}},'instanceMethods':{'ifTime':function(_0x3663d4=undefined,_0x22b793=new Date()){if(typeof this[_0x99c9('0x6')]===_0x99c9('0x7')){return iftime(this[_0x99c9('0x6')],_0x3663d4,_0x22b793);}else{return this[_0x99c9('0x8')]()['then'](function(_0x1698a0){return Promise[_0x99c9('0x9')](_0x1698a0[_0x99c9('0xa')](function(_0x2f1887){return _0x2f1887[_0x99c9('0xb')](_0x3663d4,_0x22b793);}));})['then'](function(_0x3aac34){return _0x3aac34[_0x99c9('0xc')](function(_0x42dca1,_0x4d2e16){return _0x42dca1||_0x4d2e16;},![]);});}}}});}; \ No newline at end of file +var _0xaa28=['reduce','../../utils/iftime','define','rewrite','interval','string','getIntervals','all','map','ifTime','then'];(function(_0x583f54,_0x48f3d7){var _0x408356=function(_0x571936){while(--_0x571936){_0x583f54['push'](_0x583f54['shift']());}};_0x408356(++_0x48f3d7);}(_0xaa28,0xc7));var _0x8aa2=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xaa28[_0x15942a];return _0x36a9fb;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x8aa2('0x0'))['iftime'];module['exports']=function(_0x8c2520){return _0x8c2520[_0x8aa2('0x1')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54a2f9){extensions[_0x8aa2('0x2')](_0x8c2520,_0x54a2f9);},'afterBulkCreate':function(_0x5033f5,_0x331cfb,_0x10baf1){_0x10baf1();extensions['rewrite'](_0x8c2520,_0x5033f5[0x0]);},'afterUpdate':function(_0x30f2d7){extensions[_0x8aa2('0x2')](_0x8c2520,_0x30f2d7);},'afterDestroy':function(_0x56595d){extensions[_0x8aa2('0x2')](_0x8c2520,_0x56595d);}},'instanceMethods':{'ifTime':function(_0x49b571=undefined,_0x485e2f=new Date()){if(typeof this[_0x8aa2('0x3')]===_0x8aa2('0x4')){return iftime(this['interval'],_0x49b571,_0x485e2f);}else{return this[_0x8aa2('0x5')]()['then'](function(_0x5c7ff3){return Promise[_0x8aa2('0x6')](_0x5c7ff3[_0x8aa2('0x7')](function(_0x2ac184){return _0x2ac184[_0x8aa2('0x8')](_0x49b571,_0x485e2f);}));})[_0x8aa2('0x9')](function(_0x1b87e1){return _0x1b87e1[_0x8aa2('0xa')](function(_0x20ed47,_0x3729e7){return _0x20ed47||_0x3729e7;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 92d5492..69c15e1 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 _0xdeed=['Iftime','silly','reduce','IntervalIftime','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','error','message','ShowInterval','raw','catch','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdeed,0x14c));var _0xddee=function(_0x3d6055,_0x248662){_0x3d6055=_0x3d6055-0x0;var _0x51d9e2=_0xdeed[_0x3d6055];return _0x51d9e2;};'use strict';var _=require('lodash');var util=require(_0xddee('0x0'));var db=require(_0xddee('0x1'))['db'];var iftime=require(_0xddee('0x2'))[_0xddee('0x3')];var logger=require(_0xddee('0x4'))('rpc');exports[_0xddee('0x5')]=function(_0x1ced31){var _0x385b10=this;return new Promise(function(_0x2309d2,_0x5959fb){return db[_0xddee('0x6')][_0xddee('0x7')]({'raw':_0x1ced31[_0xddee('0x8')]?_0x1ced31[_0xddee('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1ced31[_0xddee('0x8')]?_0x1ced31[_0xddee('0x8')][_0xddee('0x9')]||null:null,'attributes':_0x1ced31[_0xddee('0x8')]?_0x1ced31[_0xddee('0x8')][_0xddee('0xa')]||null:null,'limit':_0x1ced31[_0xddee('0x8')]?_0x1ced31[_0xddee('0x8')]['limit']||null:null,'include':_0x1ced31['options']?_0x1ced31[_0xddee('0x8')][_0xddee('0xb')]?_[_0xddee('0xc')](_0x1ced31[_0xddee('0x8')][_0xddee('0xb')],function(_0x5a14bc){return{'model':db[_0x5a14bc[_0xddee('0xd')]],'as':_0x5a14bc['as'],'attributes':_0x5a14bc['attributes'],'include':_0x5a14bc['include']?_[_0xddee('0xc')](_0x5a14bc[_0xddee('0xb')],function(_0x16aea4){return{'model':db[_0x16aea4[_0xddee('0xd')]],'as':_0x16aea4['as'],'attributes':_0x16aea4[_0xddee('0xa')],'include':_0x16aea4['include']?_[_0xddee('0xc')](_0x16aea4[_0xddee('0xb')],function(_0x4f2400){return{'model':db[_0x4f2400[_0xddee('0xd')]],'as':_0x4f2400['as'],'attributes':_0x4f2400['attributes']};}):[]};}):[]};}):[]:[]})[_0xddee('0xe')](function(_0x564b54){logger[_0xddee('0xf')](_0xddee('0x5'),_0x1ced31);logger[_0xddee('0x10')]('GetInterval',_0x1ced31,JSON[_0xddee('0x11')](_0x564b54));_0x2309d2(_0x564b54);})['catch'](function(_0x3eae45){logger[_0xddee('0x12')]('GetInterval',_0x3eae45[_0xddee('0x13')],_0x1ced31);_0x5959fb(_0x385b10['error'](0x1f4,_0x3eae45[_0xddee('0x13')]));});});};exports[_0xddee('0x14')]=function(_0x14741e){var _0x511779=this;return new Promise(function(_0xe6c1cc,_0x4527da){return db['Interval']['find']({'raw':_0x14741e[_0xddee('0x8')]?_0x14741e[_0xddee('0x8')][_0xddee('0x15')]===undefined?!![]:![]:!![],'where':_0x14741e['options']?_0x14741e['options']['where']||null:null,'attributes':_0x14741e['options']?_0x14741e['options'][_0xddee('0xa')]||null:null,'include':_0x14741e[_0xddee('0x8')]?_0x14741e['options'][_0xddee('0xb')]?_[_0xddee('0xc')](_0x14741e[_0xddee('0x8')][_0xddee('0xb')],function(_0x176ef5){return{'model':db[_0x176ef5[_0xddee('0xd')]],'as':_0x176ef5['as'],'attributes':_0x176ef5['attributes'],'include':_0x176ef5[_0xddee('0xb')]?_[_0xddee('0xc')](_0x176ef5[_0xddee('0xb')],function(_0x1e9a94){return{'model':db[_0x1e9a94['model']],'as':_0x1e9a94['as'],'attributes':_0x1e9a94[_0xddee('0xa')],'include':_0x1e9a94[_0xddee('0xb')]?_[_0xddee('0xc')](_0x1e9a94[_0xddee('0xb')],function(_0x3a7b71){return{'model':db[_0x3a7b71[_0xddee('0xd')]],'as':_0x3a7b71['as'],'attributes':_0x3a7b71[_0xddee('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4163){logger[_0xddee('0xf')](_0xddee('0x14'),_0x14741e);logger[_0xddee('0x10')](_0xddee('0x14'),_0x14741e,JSON[_0xddee('0x11')](_0x1b4163));_0xe6c1cc(_0x1b4163);})[_0xddee('0x16')](function(_0x4b294a){logger[_0xddee('0x12')](_0xddee('0x14'),_0x4b294a[_0xddee('0x13')],_0x14741e);_0x4527da(_0x511779[_0xddee('0x12')](0x1f4,_0x4b294a[_0xddee('0x13')]));});});};function checkArrayOfIntervals(_0x2df8e5,_0x47eaa0){var _0x2bf8da=[];return db[_0xddee('0x6')]['findAll']({'where':{'id':_0x2df8e5}})[_0xddee('0xe')](function(_0x47c582){_0x2bf8da=_0x47c582;return Promise[_0xddee('0x17')](_0x2bf8da['map'](function(_0x3fafa1){return _0x3fafa1[_0xddee('0x18')](_0x47eaa0);}));})[_0xddee('0xe')](function(_0xe07188){var _0x3f5cce=_0xe07188['reduce'](function(_0x3ad52e,_0x22284b){return _0x3ad52e||_0x22284b;},![]);logger[_0xddee('0xf')](util[_0xddee('0x19')](_0xddee('0x1a'),_0x2bf8da[_0xddee('0xc')](function(_0x1420f1){return _0x1420f1[_0xddee('0x1b')];})[_0xddee('0x1c')](',\x20'),_0x2bf8da['map'](function(_0x5cf996){return _0x5cf996['id'];})[_0xddee('0x1c')](',\x20')));return _0x3f5cce;});}function checkSingleInterval(_0x34c639,_0x1d1397){return db['Interval'][_0xddee('0x1d')](_0x34c639)['then'](function(_0x1c5dfd){if(_0x1c5dfd){logger[_0xddee('0xf')](util['format'](_0xddee('0x1e'),_0x1c5dfd['name'],_0x1c5dfd['id']));return _0x1c5dfd[_0xddee('0x18')](_0x1d1397);}});}exports['IntervalIftime']=function(_0x1516a0){var _0x26e972=_0x1516a0[_0xddee('0x1f')];var _0x4ab959=Array[_0xddee('0x20')](_0x1516a0[_0xddee('0x21')])?_0x1516a0[_0xddee('0x21')]:typeof _0x1516a0[_0xddee('0x21')]===_0xddee('0x22')?[_0x1516a0['intervals']]:[];var _0x59d123=_0x1516a0['timezone']||undefined;var _0x37786a=![];if(_0x4ab959[_0xddee('0x23')]){logger[_0xddee('0xf')](util['format'](_0xddee('0x24'),_0x4ab959[_0xddee('0x1c')](';\x20')));}if(_0x59d123){logger[_0xddee('0xf')](util[_0xddee('0x19')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x59d123));}logger[_0xddee('0x10')](_0xddee('0x25'),_0x37786a);logger[_0xddee('0x26')]('IntervalIftime',_0x1516a0);return Promise['resolve']()[_0xddee('0xe')](function(){if(Array[_0xddee('0x20')](_0x26e972)){return checkArrayOfIntervals(_0x26e972,_0x59d123);}else if(_0x26e972){return checkSingleInterval(_0x26e972,_0x59d123);}})['then'](function(_0x703e38){var _0x332f78=_0x4ab959[_0xddee('0x27')](function(_0x2d955d,_0x33d19d){return _0x2d955d||iftime(_0x33d19d,_0x59d123);},![]);_0x37786a=_0x703e38||_0x332f78;return _0x37786a;})[_0xddee('0x16')](function(_0x3fcfec){logger['error'](_0xddee('0x28'),_0x1516a0,_0x3fcfec);throw this[_0xddee('0x12')](0x1f4,_0x3fcfec[_0xddee('0x13')]);});}; \ No newline at end of file +var _0xb6f7=['../../config/logger','GetInterval','options','raw','limit','include','model','attributes','map','then','info','debug','stringify','catch','error','message','Interval','where','ShowInterval','all','reduce','format','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xb6f7,0x143));var _0x7b6f=function(_0x4bf772,_0x420f76){_0x4bf772=_0x4bf772-0x0;var _0x8cd87b=_0xb6f7[_0x4bf772];return _0x8cd87b;};'use strict';var _=require(_0x7b6f('0x0'));var util=require(_0x7b6f('0x1'));var db=require(_0x7b6f('0x2'))['db'];var iftime=require(_0x7b6f('0x3'))[_0x7b6f('0x4')];var logger=require(_0x7b6f('0x5'))('rpc');exports[_0x7b6f('0x6')]=function(_0x3be43d){var _0xdf4d35=this;return new Promise(function(_0xb7a0c8,_0x36efc1){return db['Interval']['findAll']({'raw':_0x3be43d['options']?_0x3be43d[_0x7b6f('0x7')][_0x7b6f('0x8')]===undefined?!![]:![]:!![],'where':_0x3be43d[_0x7b6f('0x7')]?_0x3be43d[_0x7b6f('0x7')]['where']||null:null,'attributes':_0x3be43d[_0x7b6f('0x7')]?_0x3be43d[_0x7b6f('0x7')]['attributes']||null:null,'limit':_0x3be43d[_0x7b6f('0x7')]?_0x3be43d[_0x7b6f('0x7')][_0x7b6f('0x9')]||null:null,'include':_0x3be43d[_0x7b6f('0x7')]?_0x3be43d[_0x7b6f('0x7')][_0x7b6f('0xa')]?_['map'](_0x3be43d[_0x7b6f('0x7')][_0x7b6f('0xa')],function(_0x1826bf){return{'model':db[_0x1826bf[_0x7b6f('0xb')]],'as':_0x1826bf['as'],'attributes':_0x1826bf[_0x7b6f('0xc')],'include':_0x1826bf[_0x7b6f('0xa')]?_[_0x7b6f('0xd')](_0x1826bf['include'],function(_0x5f876){return{'model':db[_0x5f876[_0x7b6f('0xb')]],'as':_0x5f876['as'],'attributes':_0x5f876[_0x7b6f('0xc')],'include':_0x5f876[_0x7b6f('0xa')]?_[_0x7b6f('0xd')](_0x5f876[_0x7b6f('0xa')],function(_0x4a159e){return{'model':db[_0x4a159e[_0x7b6f('0xb')]],'as':_0x4a159e['as'],'attributes':_0x4a159e[_0x7b6f('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7b6f('0xe')](function(_0x3f0d2a){logger[_0x7b6f('0xf')](_0x7b6f('0x6'),_0x3be43d);logger[_0x7b6f('0x10')]('GetInterval',_0x3be43d,JSON[_0x7b6f('0x11')](_0x3f0d2a));_0xb7a0c8(_0x3f0d2a);})[_0x7b6f('0x12')](function(_0x413745){logger[_0x7b6f('0x13')](_0x7b6f('0x6'),_0x413745[_0x7b6f('0x14')],_0x3be43d);_0x36efc1(_0xdf4d35['error'](0x1f4,_0x413745[_0x7b6f('0x14')]));});});};exports['ShowInterval']=function(_0x5eeeab){var _0x5c17ce=this;return new Promise(function(_0x379044,_0x28d40f){return db[_0x7b6f('0x15')]['find']({'raw':_0x5eeeab[_0x7b6f('0x7')]?_0x5eeeab[_0x7b6f('0x7')][_0x7b6f('0x8')]===undefined?!![]:![]:!![],'where':_0x5eeeab[_0x7b6f('0x7')]?_0x5eeeab[_0x7b6f('0x7')][_0x7b6f('0x16')]||null:null,'attributes':_0x5eeeab['options']?_0x5eeeab['options'][_0x7b6f('0xc')]||null:null,'include':_0x5eeeab[_0x7b6f('0x7')]?_0x5eeeab['options'][_0x7b6f('0xa')]?_[_0x7b6f('0xd')](_0x5eeeab[_0x7b6f('0x7')][_0x7b6f('0xa')],function(_0x3a7a30){return{'model':db[_0x3a7a30[_0x7b6f('0xb')]],'as':_0x3a7a30['as'],'attributes':_0x3a7a30[_0x7b6f('0xc')],'include':_0x3a7a30['include']?_['map'](_0x3a7a30['include'],function(_0x4514da){return{'model':db[_0x4514da[_0x7b6f('0xb')]],'as':_0x4514da['as'],'attributes':_0x4514da[_0x7b6f('0xc')],'include':_0x4514da[_0x7b6f('0xa')]?_[_0x7b6f('0xd')](_0x4514da[_0x7b6f('0xa')],function(_0x14d008){return{'model':db[_0x14d008[_0x7b6f('0xb')]],'as':_0x14d008['as'],'attributes':_0x14d008[_0x7b6f('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7b6f('0xe')](function(_0x5bdb1f){logger[_0x7b6f('0xf')](_0x7b6f('0x17'),_0x5eeeab);logger['debug'](_0x7b6f('0x17'),_0x5eeeab,JSON[_0x7b6f('0x11')](_0x5bdb1f));_0x379044(_0x5bdb1f);})[_0x7b6f('0x12')](function(_0x2203d0){logger[_0x7b6f('0x13')](_0x7b6f('0x17'),_0x2203d0[_0x7b6f('0x14')],_0x5eeeab);_0x28d40f(_0x5c17ce[_0x7b6f('0x13')](0x1f4,_0x2203d0['message']));});});};function checkArrayOfIntervals(_0x1c5afe,_0x4f065a){var _0xd36398=[];return db['Interval']['findAll']({'where':{'id':_0x1c5afe}})[_0x7b6f('0xe')](function(_0x50b172){_0xd36398=_0x50b172;return Promise[_0x7b6f('0x18')](_0xd36398[_0x7b6f('0xd')](function(_0x318064){return _0x318064['ifTime'](_0x4f065a);}));})[_0x7b6f('0xe')](function(_0x117fd3){var _0x3de5bb=_0x117fd3[_0x7b6f('0x19')](function(_0x321087,_0x37d7c7){return _0x321087||_0x37d7c7;},![]);logger[_0x7b6f('0xf')](util[_0x7b6f('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0xd36398[_0x7b6f('0xd')](function(_0x2563b7){return _0x2563b7['name'];})[_0x7b6f('0x1b')](',\x20'),_0xd36398['map'](function(_0x3a8b91){return _0x3a8b91['id'];})[_0x7b6f('0x1b')](',\x20')));return _0x3de5bb;});}function checkSingleInterval(_0x159db3,_0x1c9caa){return db[_0x7b6f('0x15')][_0x7b6f('0x1c')](_0x159db3)[_0x7b6f('0xe')](function(_0x548272){if(_0x548272){logger[_0x7b6f('0xf')](util[_0x7b6f('0x1a')](_0x7b6f('0x1d'),_0x548272[_0x7b6f('0x1e')],_0x548272['id']));return _0x548272['ifTime'](_0x1c9caa);}});}exports[_0x7b6f('0x1f')]=function(_0x1a1966){var _0x53e38b=_0x1a1966[_0x7b6f('0x20')];var _0x36460c=Array[_0x7b6f('0x21')](_0x1a1966[_0x7b6f('0x22')])?_0x1a1966['intervals']:typeof _0x1a1966[_0x7b6f('0x22')]===_0x7b6f('0x23')?[_0x1a1966[_0x7b6f('0x22')]]:[];var _0x429623=_0x1a1966[_0x7b6f('0x24')]||undefined;var _0x59fd67=![];if(_0x36460c[_0x7b6f('0x25')]){logger[_0x7b6f('0xf')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x36460c['join'](';\x20')));}if(_0x429623){logger[_0x7b6f('0xf')](util[_0x7b6f('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x429623));}logger[_0x7b6f('0x10')](_0x7b6f('0x26'),_0x59fd67);logger[_0x7b6f('0x27')](_0x7b6f('0x1f'),_0x1a1966);return Promise[_0x7b6f('0x28')]()[_0x7b6f('0xe')](function(){if(Array[_0x7b6f('0x21')](_0x53e38b)){return checkArrayOfIntervals(_0x53e38b,_0x429623);}else if(_0x53e38b){return checkSingleInterval(_0x53e38b,_0x429623);}})[_0x7b6f('0xe')](function(_0x1a73a6){var _0x33050d=_0x36460c[_0x7b6f('0x19')](function(_0x46b01f,_0x49e78a){return _0x46b01f||iftime(_0x49e78a,_0x429623);},![]);_0x59fd67=_0x1a73a6||_0x33050d;return _0x59fd67;})['catch'](function(_0x6ddbb1){logger[_0x7b6f('0x13')]('IntervalIftime',_0x1a1966,_0x6ddbb1);throw this['error'](0x1f4,_0x6ddbb1['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 78d030c..948704b 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0x0b0e[_0x1f5887];return _0x21774b;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x5b3212,_0x550406){var _0x58e775=function(_0x54193c){while(--_0x54193c){_0x5b3212['push'](_0x5b3212['shift']());}};_0x58e775(++_0x550406);}(_0xdb28,0x106));var _0x8db2=function(_0xab2553,_0x2a772a){_0xab2553=_0xab2553-0x0;var _0x535e43=_0xdb28[_0xab2553];return _0x535e43;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 8cae4fa..7af4292 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 _0x6444=['POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x4cb095,_0x58da07){var _0x2b565d=function(_0x4d41b3){while(--_0x4d41b3){_0x4cb095['push'](_0x4cb095['shift']());}};_0x2b565d(++_0x58da07);}(_0x6444,0x10e));var _0x4644=function(_0x6efb33,_0x6a6f5f){_0x6efb33=_0x6efb33-0x0;var _0x30a263=_0x6444[_0x6efb33];return _0x30a263;};'use strict';var BPromise=require(_0x4644('0x0'));var https=require(_0x4644('0x1'));var logger=require(_0x4644('0x2'))(_0x4644('0x3'));var USERNAME=_0x4644('0x4');var PASSWORD=_0x4644('0x5');function openIssue(_0x2c348c,_0x4f2192){var _0x3dafcd={'fields':{'project':{'key':_0x2c348c[_0x4644('0x6')]||'MOTGUI'},'summary':(_0x2c348c[_0x4644('0x7')]||_0x4644('0x8'))+_0x4644('0x9')+_0x2c348c['ip'],'description':_0x2c348c['description']||JSON[_0x4644('0xa')](_0x2c348c),'issuetype':{'name':_0x2c348c[_0x4644('0xb')]||_0x4644('0xc')}}};_0x3dafcd[_0x4644('0xd')][_0x4644('0xe')]=_0x2c348c['email'];_0x3dafcd['fields'][_0x4644('0xf')]=_0x2c348c['oldToken'];_0x3dafcd['fields'][_0x4644('0x10')]=_0x2c348c['newToken'];_0x3dafcd[_0x4644('0xd')][_0x4644('0x11')]=_0x2c348c[_0x4644('0x12')];_0x3dafcd['fields'][_0x4644('0x13')]=_0x2c348c[_0x4644('0x14')];_0x3dafcd[_0x4644('0xd')][_0x4644('0x15')]=_0x2c348c['ip'];var _0xa73369={'host':_0x4644('0x16'),'port':0x1bb,'path':_0x4644('0x17'),'method':_0x4644('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x4644('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x4644('0x1a')](_0x4644('0x1b'))}};var _0x575820=JSON[_0x4644('0xa')](_0x3dafcd);var _0x5844cb=https[_0x4644('0x1c')](_0xa73369,function(_0x4c2919){_0x4c2919[_0x4644('0x1d')](_0x4644('0x1e'));var _0x5e71c1='';_0x4c2919['on'](_0x4644('0x1f'),function(_0x3dc775){_0x5e71c1+=_0x3dc775;});_0x4c2919['on'](_0x4644('0x20'),function(){if(_0x4f2192){return _0x4f2192[_0x4644('0x21')](_0x4c2919[_0x4644('0x22')])[_0x4644('0x23')](JSON[_0x4644('0x24')](_0x5e71c1));}});});_0x5844cb['on'](_0x4644('0x25'),function(_0x1aaf83){if(_0x4f2192){return _0x4f2192['status'](0x1f4)[_0x4644('0x23')]({'errors':[{'message':_0x4644('0x26'),'type':_0x4644('0x27')}]});}});_0x5844cb[_0x4644('0x28')](_0x575820);_0x5844cb['end']();}exports[_0x4644('0x29')]=openIssue;exports[_0x4644('0x2a')]=function(_0x3f4296,_0x1689a2){_0x3f4296[_0x4644('0x2b')]['ip']=_0x3f4296[_0x4644('0x2c')][_0x4644('0x2d')]||_0x3f4296['connection'][_0x4644('0x2e')]||_0x3f4296[_0x4644('0x2f')][_0x4644('0x2e')]||_0x3f4296[_0x4644('0x30')]['socket'][_0x4644('0x2e')];return openIssue(_0x3f4296[_0x4644('0x2b')],_0x1689a2);}; \ No newline at end of file +var _0x105b=['status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','name','customfield_11504','customfield_10102','/rest/api/2/issue','Basic\x20','toString','setEncoding','utf8','data','end'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x105b,0xb6));var _0xb105=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x105b[_0x110c3d];return _0x226d67;};'use strict';var BPromise=require(_0xb105('0x0'));var https=require(_0xb105('0x1'));var logger=require(_0xb105('0x2'))(_0xb105('0x3'));var USERNAME='support';var PASSWORD=_0xb105('0x4');function openIssue(_0x4741d8,_0x188117){var _0x2340b4={'fields':{'project':{'key':_0x4741d8[_0xb105('0x5')]||_0xb105('0x6')},'summary':(_0x4741d8[_0xb105('0x7')]||_0xb105('0x8'))+'\x20from\x20'+_0x4741d8['ip'],'description':_0x4741d8[_0xb105('0x9')]||JSON[_0xb105('0xa')](_0x4741d8),'issuetype':{'name':_0x4741d8[_0xb105('0xb')]||_0xb105('0xc')}}};_0x2340b4[_0xb105('0xd')][_0xb105('0xe')]=_0x4741d8[_0xb105('0xf')];_0x2340b4[_0xb105('0xd')]['customfield_11501']=_0x4741d8[_0xb105('0x10')];_0x2340b4[_0xb105('0xd')][_0xb105('0x11')]=_0x4741d8['newToken'];_0x2340b4[_0xb105('0xd')]['customfield_11503']=_0x4741d8[_0xb105('0x12')];_0x2340b4['fields'][_0xb105('0x13')]=_0x4741d8['reason'];_0x2340b4['fields'][_0xb105('0x14')]=_0x4741d8['ip'];var _0x131559={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xb105('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xb105('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xb105('0x17')]('base64')}};var _0x3bfd5b=JSON[_0xb105('0xa')](_0x2340b4);var _0x2525b7=https['request'](_0x131559,function(_0x421729){_0x421729[_0xb105('0x18')](_0xb105('0x19'));var _0x1032ed='';_0x421729['on'](_0xb105('0x1a'),function(_0x2cc9b9){_0x1032ed+=_0x2cc9b9;});_0x421729['on'](_0xb105('0x1b'),function(){if(_0x188117){return _0x188117[_0xb105('0x1c')](_0x421729[_0xb105('0x1d')])[_0xb105('0x1e')](JSON[_0xb105('0x1f')](_0x1032ed));}});});_0x2525b7['on'](_0xb105('0x20'),function(_0x49d709){if(_0x188117){return _0x188117[_0xb105('0x1c')](0x1f4)[_0xb105('0x1e')]({'errors':[{'message':_0xb105('0x21'),'type':_0xb105('0x22')}]});}});_0x2525b7[_0xb105('0x23')](_0x3bfd5b);_0x2525b7[_0xb105('0x1b')]();}exports[_0xb105('0x24')]=openIssue;exports['send']=function(_0x4f7458,_0x407d46){_0x4f7458[_0xb105('0x25')]['ip']=_0x4f7458['headers'][_0xb105('0x26')]||_0x4f7458[_0xb105('0x27')][_0xb105('0x28')]||_0x4f7458[_0xb105('0x29')][_0xb105('0x28')]||_0x4f7458['connection']['socket'][_0xb105('0x28')];return openIssue(_0x4f7458[_0xb105('0x25')],_0x407d46);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 4fc2302..09b1c6c 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x444cac,_0x1c0296){var _0x10eaec=function(_0x1efe6d){while(--_0x1efe6d){_0x444cac['push'](_0x444cac['shift']());}};_0x10eaec(++_0x1c0296);}(_0x1be1,0x192));var _0x11be=function(_0xd78606,_0x1b86ae){_0xd78606=_0xd78606-0x0;var _0x161fc6=_0x1be1[_0xd78606];return _0x161fc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f185cfe..2f23e32 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x2236d4,_0x1c6511){_0x2236d4=_0x2236d4-0x0;var _0x1a1892=_0x7a54[_0x2236d4];return _0x1a1892;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x503617,_0x5b7aa0){_0x503617=_0x503617-0x0;var _0x9935fa=_0x7a54[_0x503617];return _0x9935fa;};'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 504dd95..20592f4 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 _0xa566=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','update','then','destroy','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x374821,_0x36db41){var _0x2778aa=function(_0x2ceea8){while(--_0x2ceea8){_0x374821['push'](_0x374821['shift']());}};_0x2778aa(++_0x36db41);}(_0xa566,0x1c1));var _0x6a56=function(_0x2fc731,_0x52ca00){_0x2fc731=_0x2fc731-0x0;var _0xd2114b=_0xa566[_0x2fc731];return _0xd2114b;};'use strict';var emlformat=require(_0x6a56('0x0'));var rimraf=require(_0x6a56('0x1'));var zipdir=require(_0x6a56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a56('0x3'));var moment=require(_0x6a56('0x4'));var BPromise=require(_0x6a56('0x5'));var Mustache=require(_0x6a56('0x6'));var util=require('util');var path=require(_0x6a56('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a56('0x8'));var squel=require('squel');var crypto=require(_0x6a56('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6a56('0xa'));var toCsv=require(_0x6a56('0xb'));var querystring=require('querystring');var Papa=require(_0x6a56('0xc'));var Redis=require(_0x6a56('0xd'));var authService=require(_0x6a56('0xe'));var qs=require(_0x6a56('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a56('0x10'));var logger=require(_0x6a56('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6a56('0x12'));var licenseUtil=require(_0x6a56('0x13'));var db=require(_0x6a56('0x14'))['db'];function respondWithStatusCode(_0x26f443,_0x3e9389){_0x3e9389=_0x3e9389||0xcc;return function(_0x10f894){if(_0x10f894){return _0x26f443[_0x6a56('0x15')](_0x3e9389);}return _0x26f443['status'](_0x3e9389)[_0x6a56('0x16')]();};}function respondWithResult(_0x14237e,_0x46fbaa){_0x46fbaa=_0x46fbaa||0xc8;return function(_0x10fd64){if(_0x10fd64){return _0x14237e[_0x6a56('0x17')](_0x46fbaa)['json'](_0x10fd64);}};}function respondWithFilteredResult(_0x232176,_0xc0e603){return function(_0x28bb4e){if(_0x28bb4e){var _0xc5f78d=typeof _0xc0e603[_0x6a56('0x18')]==='undefined'&&typeof _0xc0e603['limit']===_0x6a56('0x19');var _0x2288b1=_0x28bb4e['count'];var _0x162c52=_0xc5f78d?0x0:_0xc0e603[_0x6a56('0x18')];var _0x4c2f9c=_0xc5f78d?_0x28bb4e[_0x6a56('0x1a')]:_0xc0e603[_0x6a56('0x18')]+_0xc0e603['limit'];var _0x26b33e;if(_0x4c2f9c>=_0x2288b1){_0x4c2f9c=_0x2288b1;_0x26b33e=0xc8;}else{_0x26b33e=0xce;}_0x232176['status'](_0x26b33e);return _0x232176[_0x6a56('0x1b')]('Content-Range',_0x162c52+'-'+_0x4c2f9c+'/'+_0x2288b1)[_0x6a56('0x1c')](_0x28bb4e);}return null;};}function patchUpdates(_0x2239ff){return function(_0x11e479){try{jsonpatch[_0x6a56('0x1d')](_0x11e479,_0x2239ff,!![]);}catch(_0x32118b){return BPromise[_0x6a56('0x1e')](_0x32118b);}return _0x11e479['save']();};}function saveUpdates(_0x2e217a,_0x148548){return function(_0x4845aa){if(_0x4845aa){return _0x4845aa[_0x6a56('0x1f')](_0x2e217a)[_0x6a56('0x20')](function(_0x3cf1b3){return _0x3cf1b3;});}return null;};}function removeEntity(_0x5a0986,_0x2a6ece){return function(_0x3e0aab){if(_0x3e0aab){return _0x3e0aab[_0x6a56('0x21')]()[_0x6a56('0x20')](function(){_0x5a0986[_0x6a56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d23a,_0x5ce125){return function(_0x302316){if(!_0x302316){_0x51d23a[_0x6a56('0x15')](0x194);}return _0x302316;};}function handleError(_0x2bd80f,_0x55e714){_0x55e714=_0x55e714||0x1f4;return function(_0x1df843){logger[_0x6a56('0x22')](_0x1df843['stack']);if(_0x1df843[_0x6a56('0x23')]){delete _0x1df843[_0x6a56('0x23')];}_0x2bd80f[_0x6a56('0x17')](_0x55e714)['send'](_0x1df843);};}exports[_0x6a56('0x24')]=function(_0x27bcd0,_0x151537){var _0xe26d09={},_0x10b1cb={},_0x51534d={'count':0x0,'rows':[]};var _0x3f0fe7=_[_0x6a56('0x25')](db[_0x6a56('0x26')][_0x6a56('0x27')],function(_0x576778){return{'name':_0x576778[_0x6a56('0x28')],'type':_0x576778[_0x6a56('0x29')][_0x6a56('0x2a')]};});_0x10b1cb['model']=_[_0x6a56('0x25')](_0x3f0fe7,'name');_0x10b1cb[_0x6a56('0x2b')]=_[_0x6a56('0x2c')](_0x27bcd0[_0x6a56('0x2b')]);_0x10b1cb[_0x6a56('0x2d')]=_[_0x6a56('0x2e')](_0x10b1cb[_0x6a56('0x2f')],_0x10b1cb[_0x6a56('0x2b')]);_0xe26d09[_0x6a56('0x30')]=_[_0x6a56('0x2e')](_0x10b1cb[_0x6a56('0x2f')],qs[_0x6a56('0x31')](_0x27bcd0['query'][_0x6a56('0x31')]));_0xe26d09[_0x6a56('0x30')]=_0xe26d09[_0x6a56('0x30')][_0x6a56('0x32')]?_0xe26d09['attributes']:_0x10b1cb[_0x6a56('0x2f')];if(!_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x33')](_0x6a56('0x34'))){_0xe26d09['limit']=qs[_0x6a56('0x35')](_0x27bcd0[_0x6a56('0x2b')]['limit']);_0xe26d09[_0x6a56('0x18')]=qs['offset'](_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x18')]);}_0xe26d09[_0x6a56('0x36')]=qs[_0x6a56('0x37')](_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x37')]);_0xe26d09[_0x6a56('0x38')]=qs['filters'](_[_0x6a56('0x39')](_0x27bcd0[_0x6a56('0x2b')],_0x10b1cb[_0x6a56('0x2d')]),_0x3f0fe7);if(_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3a')]){_0xe26d09[_0x6a56('0x38')]=_[_0x6a56('0x3b')](_0xe26d09[_0x6a56('0x38')],{'$or':_[_0x6a56('0x25')](_0x3f0fe7,function(_0x4b1f65){if(_0x4b1f65[_0x6a56('0x29')]!==_0x6a56('0x3c')){var _0x10aca9={};_0x10aca9[_0x4b1f65[_0x6a56('0x23')]]={'$like':'%'+_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3a')]+'%'};return _0x10aca9;}})});}_0xe26d09=_[_0x6a56('0x3b')]({},_0xe26d09,_0x27bcd0[_0x6a56('0x3d')]);var _0x4a75c2={'where':_0xe26d09[_0x6a56('0x38')]};return db[_0x6a56('0x26')][_0x6a56('0x1a')](_0x4a75c2)[_0x6a56('0x20')](function(_0x2af96d){_0x51534d['count']=_0x2af96d;if(_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3e')]){_0xe26d09[_0x6a56('0x3f')]=[{'all':!![]}];}return db[_0x6a56('0x26')][_0x6a56('0x40')](_0xe26d09);})['then'](function(_0x2e13b1){_0x51534d['rows']=_0x2e13b1;return _0x51534d;})[_0x6a56('0x20')](respondWithFilteredResult(_0x151537,_0xe26d09))[_0x6a56('0x41')](handleError(_0x151537,null));};exports[_0x6a56('0x42')]=function(_0x4e69fd,_0x10ced2){var _0x4ae655={'raw':!![],'where':{'id':_0x4e69fd[_0x6a56('0x43')]['id']}},_0x5a6999={};_0x5a6999[_0x6a56('0x2f')]=_[_0x6a56('0x2c')](db[_0x6a56('0x26')]['rawAttributes']);_0x5a6999['query']=_[_0x6a56('0x2c')](_0x4e69fd[_0x6a56('0x2b')]);_0x5a6999[_0x6a56('0x2d')]=_[_0x6a56('0x2e')](_0x5a6999[_0x6a56('0x2f')],_0x5a6999[_0x6a56('0x2b')]);_0x4ae655['attributes']=_[_0x6a56('0x2e')](_0x5a6999['model'],qs[_0x6a56('0x31')](_0x4e69fd[_0x6a56('0x2b')][_0x6a56('0x31')]));_0x4ae655[_0x6a56('0x30')]=_0x4ae655[_0x6a56('0x30')][_0x6a56('0x32')]?_0x4ae655[_0x6a56('0x30')]:_0x5a6999[_0x6a56('0x2f')];if(_0x4e69fd[_0x6a56('0x2b')]['includeAll']){_0x4ae655[_0x6a56('0x3f')]=[{'all':!![]}];}_0x4ae655=_['merge']({},_0x4ae655,_0x4e69fd['options']);return db['JscriptyAnswerReport'][_0x6a56('0x44')](_0x4ae655)[_0x6a56('0x20')](handleEntityNotFound(_0x10ced2,null))[_0x6a56('0x20')](respondWithResult(_0x10ced2,null))[_0x6a56('0x41')](handleError(_0x10ced2,null));};exports[_0x6a56('0x45')]=function(_0x5cef6c,_0x794424){return db[_0x6a56('0x26')][_0x6a56('0x45')](_0x5cef6c[_0x6a56('0x46')],{})['then'](respondWithResult(_0x794424,0xc9))[_0x6a56('0x41')](handleError(_0x794424,null));};exports[_0x6a56('0x1f')]=function(_0x659936,_0x371b8e){if(_0x659936['body']['id']){delete _0x659936[_0x6a56('0x46')]['id'];}return db[_0x6a56('0x26')][_0x6a56('0x44')]({'where':{'id':_0x659936['params']['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x371b8e,null))[_0x6a56('0x20')](saveUpdates(_0x659936[_0x6a56('0x46')],null))[_0x6a56('0x20')](respondWithResult(_0x371b8e,null))['catch'](handleError(_0x371b8e,null));};exports[_0x6a56('0x21')]=function(_0x56406b,_0x2487cb){return db[_0x6a56('0x26')]['find']({'where':{'id':_0x56406b[_0x6a56('0x43')]['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x2487cb,null))[_0x6a56('0x20')](removeEntity(_0x2487cb,null))[_0x6a56('0x41')](handleError(_0x2487cb,null));};exports[_0x6a56('0x47')]=function(_0x14be34,_0x175383){return db[_0x6a56('0x26')][_0x6a56('0x47')]()['then'](respondWithResult(_0x175383,null))['catch'](handleError(_0x175383,null));}; \ No newline at end of file +var _0x14f5=['limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty'];(function(_0xb324da,_0x1feac2){var _0x4f5300=function(_0x538252){while(--_0x538252){_0xb324da['push'](_0xb324da['shift']());}};_0x4f5300(++_0x1feac2);}(_0x14f5,0xae));var _0x514f=function(_0x455913,_0x2b7a92){_0x455913=_0x455913-0x0;var _0x3025b8=_0x14f5[_0x455913];return _0x3025b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x514f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x514f('0x1'));var rp=require(_0x514f('0x2'));var moment=require(_0x514f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x514f('0x4'));var util=require(_0x514f('0x5'));var path=require('path');var sox=require(_0x514f('0x6'));var csv=require(_0x514f('0x7'));var ejs=require(_0x514f('0x8'));var fs=require('fs');var fs_extra=require(_0x514f('0x9'));var _=require(_0x514f('0xa'));var squel=require(_0x514f('0xb'));var crypto=require(_0x514f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x514f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x514f('0xe'));var Papa=require(_0x514f('0xf'));var Redis=require(_0x514f('0x10'));var authService=require(_0x514f('0x11'));var qs=require(_0x514f('0x12'));var as=require(_0x514f('0x13'));var hardwareService=require(_0x514f('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x514f('0x15'));var licenseUtil=require(_0x514f('0x16'));var db=require(_0x514f('0x17'))['db'];function respondWithStatusCode(_0x321914,_0x3eed49){_0x3eed49=_0x3eed49||0xcc;return function(_0x2ed1b7){if(_0x2ed1b7){return _0x321914[_0x514f('0x18')](_0x3eed49);}return _0x321914[_0x514f('0x19')](_0x3eed49)[_0x514f('0x1a')]();};}function respondWithResult(_0x4124bf,_0x46e552){_0x46e552=_0x46e552||0xc8;return function(_0x3fc905){if(_0x3fc905){return _0x4124bf[_0x514f('0x19')](_0x46e552)[_0x514f('0x1b')](_0x3fc905);}};}function respondWithFilteredResult(_0x1694b3,_0x5865d1){return function(_0x70d2b4){if(_0x70d2b4){var _0x1f0cbe=typeof _0x5865d1['offset']===_0x514f('0x1c')&&typeof _0x5865d1['limit']===_0x514f('0x1c');var _0x309ce0=_0x70d2b4[_0x514f('0x1d')];var _0x5a5641=_0x1f0cbe?0x0:_0x5865d1[_0x514f('0x1e')];var _0x3673a4=_0x1f0cbe?_0x70d2b4[_0x514f('0x1d')]:_0x5865d1[_0x514f('0x1e')]+_0x5865d1['limit'];var _0x4f9193;if(_0x3673a4>=_0x309ce0){_0x3673a4=_0x309ce0;_0x4f9193=0xc8;}else{_0x4f9193=0xce;}_0x1694b3[_0x514f('0x19')](_0x4f9193);return _0x1694b3[_0x514f('0x1f')](_0x514f('0x20'),_0x5a5641+'-'+_0x3673a4+'/'+_0x309ce0)['json'](_0x70d2b4);}return null;};}function patchUpdates(_0x43fcf9){return function(_0x7248e8){try{jsonpatch['apply'](_0x7248e8,_0x43fcf9,!![]);}catch(_0x186417){return BPromise[_0x514f('0x21')](_0x186417);}return _0x7248e8['save']();};}function saveUpdates(_0xd093a1,_0x18a430){return function(_0xd89aa2){if(_0xd89aa2){return _0xd89aa2[_0x514f('0x22')](_0xd093a1)['then'](function(_0x58861e){return _0x58861e;});}return null;};}function removeEntity(_0x4b0245,_0x5d80cb){return function(_0x1c16f9){if(_0x1c16f9){return _0x1c16f9[_0x514f('0x23')]()[_0x514f('0x24')](function(){_0x4b0245[_0x514f('0x19')](0xcc)[_0x514f('0x1a')]();});}};}function handleEntityNotFound(_0x26df04,_0x2c6bb1){return function(_0x101742){if(!_0x101742){_0x26df04[_0x514f('0x18')](0x194);}return _0x101742;};}function handleError(_0x5f2da2,_0x8c8bdf){_0x8c8bdf=_0x8c8bdf||0x1f4;return function(_0x37b3db){logger[_0x514f('0x25')](_0x37b3db[_0x514f('0x26')]);if(_0x37b3db[_0x514f('0x27')]){delete _0x37b3db[_0x514f('0x27')];}_0x5f2da2[_0x514f('0x19')](_0x8c8bdf)[_0x514f('0x28')](_0x37b3db);};}exports[_0x514f('0x29')]=function(_0x594a50,_0x2c4c4b){var _0x488c17={},_0x2b43e0={},_0x51beda={'count':0x0,'rows':[]};var _0x40ac5e=_[_0x514f('0x2a')](db[_0x514f('0x2b')][_0x514f('0x2c')],function(_0xdc0bcc){return{'name':_0xdc0bcc['fieldName'],'type':_0xdc0bcc['type'][_0x514f('0x2d')]};});_0x2b43e0['model']=_[_0x514f('0x2a')](_0x40ac5e,_0x514f('0x27'));_0x2b43e0[_0x514f('0x2e')]=_[_0x514f('0x2f')](_0x594a50[_0x514f('0x2e')]);_0x2b43e0['filters']=_['intersection'](_0x2b43e0['model'],_0x2b43e0[_0x514f('0x2e')]);_0x488c17[_0x514f('0x30')]=_[_0x514f('0x31')](_0x2b43e0[_0x514f('0x32')],qs[_0x514f('0x33')](_0x594a50[_0x514f('0x2e')][_0x514f('0x33')]));_0x488c17[_0x514f('0x30')]=_0x488c17[_0x514f('0x30')][_0x514f('0x34')]?_0x488c17['attributes']:_0x2b43e0['model'];if(!_0x594a50['query'][_0x514f('0x35')]('nolimit')){_0x488c17[_0x514f('0x36')]=qs['limit'](_0x594a50[_0x514f('0x2e')]['limit']);_0x488c17['offset']=qs[_0x514f('0x1e')](_0x594a50['query'][_0x514f('0x1e')]);}_0x488c17[_0x514f('0x37')]=qs[_0x514f('0x38')](_0x594a50[_0x514f('0x2e')][_0x514f('0x38')]);_0x488c17['where']=qs[_0x514f('0x39')](_[_0x514f('0x3a')](_0x594a50[_0x514f('0x2e')],_0x2b43e0[_0x514f('0x39')]),_0x40ac5e);if(_0x594a50['query'][_0x514f('0x3b')]){_0x488c17[_0x514f('0x3c')]=_[_0x514f('0x3d')](_0x488c17[_0x514f('0x3c')],{'$or':_['map'](_0x40ac5e,function(_0x1c1a24){if(_0x1c1a24[_0x514f('0x3e')]!==_0x514f('0x3f')){var _0x281d39={};_0x281d39[_0x1c1a24['name']]={'$like':'%'+_0x594a50[_0x514f('0x2e')]['filter']+'%'};return _0x281d39;}})});}_0x488c17=_[_0x514f('0x3d')]({},_0x488c17,_0x594a50[_0x514f('0x40')]);var _0x18969b={'where':_0x488c17['where']};return db['JscriptyAnswerReport'][_0x514f('0x1d')](_0x18969b)['then'](function(_0x10259a){_0x51beda[_0x514f('0x1d')]=_0x10259a;if(_0x594a50[_0x514f('0x2e')][_0x514f('0x41')]){_0x488c17[_0x514f('0x42')]=[{'all':!![]}];}return db[_0x514f('0x2b')][_0x514f('0x43')](_0x488c17);})['then'](function(_0x48914e){_0x51beda[_0x514f('0x44')]=_0x48914e;return _0x51beda;})['then'](respondWithFilteredResult(_0x2c4c4b,_0x488c17))[_0x514f('0x45')](handleError(_0x2c4c4b,null));};exports[_0x514f('0x46')]=function(_0x48d82a,_0x203af2){var _0x326ea6={'raw':!![],'where':{'id':_0x48d82a[_0x514f('0x47')]['id']}},_0x51e50b={};_0x51e50b['model']=_['keys'](db[_0x514f('0x2b')][_0x514f('0x2c')]);_0x51e50b[_0x514f('0x2e')]=_[_0x514f('0x2f')](_0x48d82a[_0x514f('0x2e')]);_0x51e50b['filters']=_['intersection'](_0x51e50b[_0x514f('0x32')],_0x51e50b[_0x514f('0x2e')]);_0x326ea6[_0x514f('0x30')]=_[_0x514f('0x31')](_0x51e50b[_0x514f('0x32')],qs['fields'](_0x48d82a[_0x514f('0x2e')]['fields']));_0x326ea6['attributes']=_0x326ea6[_0x514f('0x30')]['length']?_0x326ea6[_0x514f('0x30')]:_0x51e50b['model'];if(_0x48d82a['query'][_0x514f('0x41')]){_0x326ea6[_0x514f('0x42')]=[{'all':!![]}];}_0x326ea6=_['merge']({},_0x326ea6,_0x48d82a['options']);return db[_0x514f('0x2b')][_0x514f('0x48')](_0x326ea6)[_0x514f('0x24')](handleEntityNotFound(_0x203af2,null))[_0x514f('0x24')](respondWithResult(_0x203af2,null))[_0x514f('0x45')](handleError(_0x203af2,null));};exports[_0x514f('0x49')]=function(_0xa5259e,_0x1b33b2){return db[_0x514f('0x2b')]['create'](_0xa5259e[_0x514f('0x4a')],{})[_0x514f('0x24')](respondWithResult(_0x1b33b2,0xc9))[_0x514f('0x45')](handleError(_0x1b33b2,null));};exports[_0x514f('0x22')]=function(_0x33b658,_0x2e6971){if(_0x33b658[_0x514f('0x4a')]['id']){delete _0x33b658['body']['id'];}return db[_0x514f('0x2b')]['find']({'where':{'id':_0x33b658[_0x514f('0x47')]['id']}})[_0x514f('0x24')](handleEntityNotFound(_0x2e6971,null))[_0x514f('0x24')](saveUpdates(_0x33b658[_0x514f('0x4a')],null))[_0x514f('0x24')](respondWithResult(_0x2e6971,null))['catch'](handleError(_0x2e6971,null));};exports['destroy']=function(_0x38e237,_0x5e6e97){return db[_0x514f('0x2b')]['find']({'where':{'id':_0x38e237[_0x514f('0x47')]['id']}})[_0x514f('0x24')](handleEntityNotFound(_0x5e6e97,null))[_0x514f('0x24')](removeEntity(_0x5e6e97,null))['catch'](handleError(_0x5e6e97,null));};exports[_0x514f('0x4b')]=function(_0x41cb02,_0x2171e9){return db['JscriptyAnswerReport'][_0x514f('0x4b')]()[_0x514f('0x24')](respondWithResult(_0x2171e9,null))['catch'](handleError(_0x2171e9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1ca3567..0835952 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 _0x022e=['bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api'];(function(_0x38bda1,_0x5472be){var _0x57dc98=function(_0x574cad){while(--_0x574cad){_0x38bda1['push'](_0x38bda1['shift']());}};_0x57dc98(++_0x5472be);}(_0x022e,0x11a));var _0xe022=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x022e[_0x4c6d6f];return _0x2d4478;};'use strict';var _=require(_0xe022('0x0'));var util=require(_0xe022('0x1'));var logger=require(_0xe022('0x2'))(_0xe022('0x3'));var moment=require('moment');var BPromise=require(_0xe022('0x4'));var rp=require(_0xe022('0x5'));var fs=require('fs');var path=require(_0xe022('0x6'));var rimraf=require(_0xe022('0x7'));var config=require('../../config/environment');var attributes=require(_0xe022('0x8'));module[_0xe022('0x9')]=function(_0x2be152,_0x2141e0){return _0x2be152[_0xe022('0xa')](_0xe022('0xb'),attributes,{'tableName':_0xe022('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7d7=['util','../../config/logger','api','moment','request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x156103,_0x2751ec){var _0x332051=function(_0x41c148){while(--_0x41c148){_0x156103['push'](_0x156103['shift']());}};_0x332051(++_0x2751ec);}(_0xa7d7,0x1a1));var _0x7a7d=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xa7d7[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var logger=require(_0x7a7d('0x2'))(_0x7a7d('0x3'));var moment=require(_0x7a7d('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a7d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a7d('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a7d('0x7'));module[_0x7a7d('0x8')]=function(_0x1a9e2d,_0x39e134){return _0x1a9e2d['define'](_0x7a7d('0x9'),attributes,{'tableName':_0x7a7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 57153a1..e116961 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 _0xef94=['../../mysqldb','rpc','../../config/environment','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef94,0x103));var _0x4ef9=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0xef94[_0x4bb94b];return _0x36dcc6;};'use strict';var _=require(_0x4ef9('0x0'));var util=require(_0x4ef9('0x1'));var moment=require(_0x4ef9('0x2'));var BPromise=require(_0x4ef9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ef9('0x4'));var db=require(_0x4ef9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ef9('0x6'));var config=require(_0x4ef9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4ef9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58504f,_0xec9e8,_0x2f787e){return new BPromise(function(_0x1ea9c4,_0x22f73a){return client[_0x4ef9('0x9')](_0x58504f,_0x2f787e)[_0x4ef9('0xa')](function(_0x1ee3a8){logger[_0x4ef9('0xb')](_0x4ef9('0xc'),_0xec9e8,_0x4ef9('0xd'));logger[_0x4ef9('0xe')](_0x4ef9('0xf'),_0xec9e8,_0x4ef9('0xd'),JSON[_0x4ef9('0x10')](_0x1ee3a8));if(_0x1ee3a8[_0x4ef9('0x11')]){if(_0x1ee3a8[_0x4ef9('0x11')][_0x4ef9('0x12')]===0x1f4){logger[_0x4ef9('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xec9e8,_0x1ee3a8['error'][_0x4ef9('0x13')]);return _0x22f73a(_0x1ee3a8[_0x4ef9('0x11')][_0x4ef9('0x13')]);}logger[_0x4ef9('0x11')](_0x4ef9('0xc'),_0xec9e8,_0x1ee3a8[_0x4ef9('0x11')][_0x4ef9('0x13')]);return _0x1ea9c4(_0x1ee3a8[_0x4ef9('0x11')][_0x4ef9('0x13')]);}else{logger[_0x4ef9('0xb')](_0x4ef9('0xc'),_0xec9e8,_0x4ef9('0xd'));_0x1ea9c4(_0x1ee3a8[_0x4ef9('0x14')][_0x4ef9('0x13')]);}})[_0x4ef9('0x15')](function(_0x2fb020){logger[_0x4ef9('0x11')](_0x4ef9('0xc'),_0xec9e8,_0x2fb020);_0x22f73a(_0x2fb020);});});} \ No newline at end of file +var _0x376d=['error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x20b919,_0x6d22be){var _0x529fda=function(_0x325481){while(--_0x325481){_0x20b919['push'](_0x20b919['shift']());}};_0x529fda(++_0x6d22be);}(_0x376d,0x1a9));var _0xd376=function(_0x30fb69,_0xeb0943){_0x30fb69=_0x30fb69-0x0;var _0x4edbd1=_0x376d[_0x30fb69];return _0x4edbd1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd376('0x0'));var BPromise=require(_0xd376('0x1'));var rs=require(_0xd376('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd376('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd376('0x4'));var config=require(_0xd376('0x5'));var jayson=require(_0xd376('0x6'));var client=jayson[_0xd376('0x7')][_0xd376('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43a8da,_0x4477a8,_0x312cd3){return new BPromise(function(_0x3271d6,_0x5cd6e0){return client[_0xd376('0x9')](_0x43a8da,_0x312cd3)[_0xd376('0xa')](function(_0x1aee94){logger[_0xd376('0xb')](_0xd376('0xc'),_0x4477a8,_0xd376('0xd'));logger['debug'](_0xd376('0xe'),_0x4477a8,_0xd376('0xd'),JSON['stringify'](_0x1aee94));if(_0x1aee94[_0xd376('0xf')]){if(_0x1aee94[_0xd376('0xf')][_0xd376('0x10')]===0x1f4){logger['error'](_0xd376('0xc'),_0x4477a8,_0x1aee94[_0xd376('0xf')][_0xd376('0x11')]);return _0x5cd6e0(_0x1aee94[_0xd376('0xf')][_0xd376('0x11')]);}logger[_0xd376('0xf')](_0xd376('0xc'),_0x4477a8,_0x1aee94['error'][_0xd376('0x11')]);return _0x3271d6(_0x1aee94[_0xd376('0xf')]['message']);}else{logger[_0xd376('0xb')](_0xd376('0xc'),_0x4477a8,'request\x20sent');_0x3271d6(_0x1aee94[_0xd376('0x12')][_0xd376('0x11')]);}})[_0xd376('0x13')](function(_0x578590){logger[_0xd376('0xf')](_0xd376('0xc'),_0x4477a8,_0x578590);_0x5cd6e0(_0x578590);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 02b0115..175a293 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 _0x8195=['index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','clone','put','/:id','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated'];(function(_0x123da7,_0x1da803){var _0x48b201=function(_0x1ccda1){while(--_0x1ccda1){_0x123da7['push'](_0x123da7['shift']());}};_0x48b201(++_0x1da803);}(_0x8195,0x123));var _0x5819=function(_0xbeeecd,_0x29d9b7){_0xbeeecd=_0xbeeecd-0x0;var _0x16f54c=_0x8195[_0xbeeecd];return _0x16f54c;};'use strict';var multer=require(_0x5819('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5819('0x1'));var express=require(_0x5819('0x2'));var router=express['Router']();var fs_extra=require(_0x5819('0x3'));var auth=require(_0x5819('0x4'));var interaction=require(_0x5819('0x5'));var config=require('../../config/environment');var controller=require(_0x5819('0x6'));router[_0x5819('0x7')]('/',auth[_0x5819('0x8')](),controller[_0x5819('0x9')]);router[_0x5819('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5819('0xa')]);router[_0x5819('0x7')](_0x5819('0xb'),auth[_0x5819('0x8')](),controller[_0x5819('0xc')]);router[_0x5819('0x7')](_0x5819('0xd'),auth[_0x5819('0x8')](),controller[_0x5819('0xe')]);router['get'](_0x5819('0xf'),auth[_0x5819('0x8')](),timeout(_0x5819('0x10')),controller['getSummary']);router[_0x5819('0x11')]('/',auth[_0x5819('0x8')](),controller[_0x5819('0x12')]);router[_0x5819('0x11')]('/:id/clone',auth[_0x5819('0x8')](),controller[_0x5819('0x13')]);router[_0x5819('0x14')](_0x5819('0x15'),auth[_0x5819('0x8')](),controller['update']);router[_0x5819('0x16')](_0x5819('0x15'),auth[_0x5819('0x8')](),controller[_0x5819('0x17')]);module[_0x5819('0x18')]=router; \ No newline at end of file +var _0x558e=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/answers','/:id/summary','getSummary','post','create','/:id/clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x439418,_0x245d0f){var _0x5a128f=function(_0x4a43a2){while(--_0x4a43a2){_0x439418['push'](_0x439418['shift']());}};_0x5a128f(++_0x245d0f);}(_0x558e,0x179));var _0xe558=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x558e[_0x4b7b69];return _0x173b4c;};'use strict';var multer=require(_0xe558('0x0'));var util=require(_0xe558('0x1'));var path=require(_0xe558('0x2'));var timeout=require(_0xe558('0x3'));var express=require(_0xe558('0x4'));var router=express['Router']();var fs_extra=require(_0xe558('0x5'));var auth=require(_0xe558('0x6'));var interaction=require(_0xe558('0x7'));var config=require(_0xe558('0x8'));var controller=require('./jscriptyProject.controller');router[_0xe558('0x9')]('/',auth[_0xe558('0xa')](),controller[_0xe558('0xb')]);router[_0xe558('0x9')](_0xe558('0xc'),auth[_0xe558('0xa')](),controller['show']);router[_0xe558('0x9')]('/:id/sessions',auth[_0xe558('0xa')](),controller['getSessions']);router[_0xe558('0x9')](_0xe558('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xe558('0xe'),auth['isAuthenticated'](),timeout('30s'),controller[_0xe558('0xf')]);router[_0xe558('0x10')]('/',auth[_0xe558('0xa')](),controller[_0xe558('0x11')]);router['post'](_0xe558('0x12'),auth['isAuthenticated'](),controller['clone']);router[_0xe558('0x13')]('/:id',auth[_0xe558('0xa')](),controller[_0xe558('0x14')]);router[_0xe558('0x15')](_0xe558('0xc'),auth[_0xe558('0xa')](),controller[_0xe558('0x16')]);module[_0xe558('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 13c4eef..090fd9d 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 _0x3c61=['getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0x3c61,0x15c));var _0x13c6=function(_0x1de321,_0x255db6){_0x1de321=_0x1de321-0x0;var _0x210e4f=_0x3c61[_0x1de321];return _0x210e4f;};'use strict';var Sequelize=require(_0x13c6('0x0'));var _=require('lodash');var util=require(_0x13c6('0x1'));module[_0x13c6('0x2')]={'name':{'type':Sequelize[_0x13c6('0x3')],'unique':_0x13c6('0x4')},'description':{'type':Sequelize[_0x13c6('0x3')]},'formData':{'type':Sequelize[_0x13c6('0x5')](_0x13c6('0x6')),'set':function(_0x40c620){if(_[_0x13c6('0x7')](_0x40c620)){this[_0x13c6('0x8')]('formData',JSON['stringify'](_0x40c620));}else if(_['isString'](_0x40c620)){this[_0x13c6('0x8')]('formData',_0x40c620);}else{this['setDataValue'](_0x13c6('0x9'),util[_0x13c6('0xa')](_0x13c6('0xb'),this[_0x13c6('0xc')](_0x13c6('0x4'))||'',this[_0x13c6('0xc')](_0x13c6('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x13c6('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xd11c=['name','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','exports','STRING'];(function(_0xaec629,_0x17f8d4){var _0x13cd91=function(_0xc16073){while(--_0xc16073){_0xaec629['push'](_0xaec629['shift']());}};_0x13cd91(++_0x17f8d4);}(_0xd11c,0x128));var _0xcd11=function(_0x214234,_0x3e01a2){_0x214234=_0x214234-0x0;var _0x3d6f15=_0xd11c[_0x214234];return _0x3d6f15;};'use strict';var Sequelize=require(_0xcd11('0x0'));var _=require(_0xcd11('0x1'));var util=require('util');module[_0xcd11('0x2')]={'name':{'type':Sequelize[_0xcd11('0x3')],'unique':_0xcd11('0x4')},'description':{'type':Sequelize[_0xcd11('0x3')]},'formData':{'type':Sequelize[_0xcd11('0x5')]('long'),'set':function(_0xd55ebb){if(_[_0xcd11('0x6')](_0xd55ebb)){this['setDataValue'](_0xcd11('0x7'),JSON[_0xcd11('0x8')](_0xd55ebb));}else if(_[_0xcd11('0x9')](_0xd55ebb)){this[_0xcd11('0xa')](_0xcd11('0x7'),_0xd55ebb);}else{this[_0xcd11('0xa')]('formData',util[_0xcd11('0xb')](_0xcd11('0xc'),this[_0xcd11('0xd')](_0xcd11('0x4'))||'',this[_0xcd11('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcd11('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c5b566d..df6afde 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 _0x5227=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','get','destroy','error','stack','name','send','index','map','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','userProfileId','update','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','starttime','parse','startTime','hasOwnProperty','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x5227,0x1d1));var _0x7522=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x5227[_0x1ad926];return _0x1b81dc;};'use strict';var emlformat=require(_0x7522('0x0'));var rimraf=require(_0x7522('0x1'));var zipdir=require(_0x7522('0x2'));var jsonpatch=require(_0x7522('0x3'));var rp=require(_0x7522('0x4'));var moment=require(_0x7522('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7522('0x6'));var util=require(_0x7522('0x7'));var path=require(_0x7522('0x8'));var sox=require(_0x7522('0x9'));var csv=require('to-csv');var ejs=require(_0x7522('0xa'));var fs=require('fs');var fs_extra=require(_0x7522('0xb'));var _=require(_0x7522('0xc'));var squel=require(_0x7522('0xd'));var crypto=require(_0x7522('0xe'));var jsforce=require(_0x7522('0xf'));var deskjs=require(_0x7522('0x10'));var toCsv=require(_0x7522('0x11'));var querystring=require(_0x7522('0x12'));var Papa=require(_0x7522('0x13'));var Redis=require(_0x7522('0x14'));var authService=require(_0x7522('0x15'));var qs=require(_0x7522('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7522('0x17'));var logger=require(_0x7522('0x18'))(_0x7522('0x19'));var utils=require(_0x7522('0x1a'));var config=require(_0x7522('0x1b'));var licenseUtil=require(_0x7522('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x424df5,_0x400da7){_0x400da7=_0x400da7||0xcc;return function(_0x293d1a){if(_0x293d1a){return _0x424df5[_0x7522('0x1d')](_0x400da7);}return _0x424df5[_0x7522('0x1e')](_0x400da7)[_0x7522('0x1f')]();};}function respondWithResult(_0x3b9e15,_0xd695d0){_0xd695d0=_0xd695d0||0xc8;return function(_0x387ed4){if(_0x387ed4){return _0x3b9e15[_0x7522('0x1e')](_0xd695d0)['json'](_0x387ed4);}};}function respondWithFilteredResult(_0x54ce48,_0x30952b){return function(_0x5ec046){if(_0x5ec046){var _0x1aa84c=typeof _0x30952b[_0x7522('0x20')]===_0x7522('0x21')&&typeof _0x30952b[_0x7522('0x22')]===_0x7522('0x21');var _0x189ef6=_0x5ec046['count'];var _0x305db6=_0x1aa84c?0x0:_0x30952b[_0x7522('0x20')];var _0x3311e7=_0x1aa84c?_0x5ec046['count']:_0x30952b[_0x7522('0x20')]+_0x30952b[_0x7522('0x22')];var _0x415a53;if(_0x3311e7>=_0x189ef6){_0x3311e7=_0x189ef6;_0x415a53=0xc8;}else{_0x415a53=0xce;}_0x54ce48[_0x7522('0x1e')](_0x415a53);return _0x54ce48[_0x7522('0x23')](_0x7522('0x24'),_0x305db6+'-'+_0x3311e7+'/'+_0x189ef6)[_0x7522('0x25')](_0x5ec046);}return null;};}function patchUpdates(_0x27e4f0){return function(_0x18c2a9){try{jsonpatch[_0x7522('0x26')](_0x18c2a9,_0x27e4f0,!![]);}catch(_0x519d83){return BPromise[_0x7522('0x27')](_0x519d83);}return _0x18c2a9[_0x7522('0x28')]();};}function saveUpdates(_0x2a895e,_0xb3f596){return function(_0x2adde2){if(_0x2adde2){return _0x2adde2['update'](_0x2a895e)[_0x7522('0x29')](function(_0x16c348){return _0x16c348;});}return null;};}function removeEntity(_0x119e59,_0x47b7d3){return function(_0x5c60e6){if(_0x5c60e6){return _0x5c60e6['destroy']()['then'](function(){var _0x306b29=_0x5c60e6[_0x7522('0x2a')]({'plain':!![]});var _0x4e39f8='Projects';return db['UserProfileResource'][_0x7522('0x2b')]({'where':{'type':_0x4e39f8,'resourceId':_0x306b29['id']}})[_0x7522('0x29')](function(){return _0x5c60e6;});})[_0x7522('0x29')](function(){_0x119e59[_0x7522('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cec09,_0xfb1361){return function(_0x48e300){if(!_0x48e300){_0x5cec09[_0x7522('0x1d')](0x194);}return _0x48e300;};}function handleError(_0x3b10d3,_0x17fd78){_0x17fd78=_0x17fd78||0x1f4;return function(_0x427e43){logger[_0x7522('0x2c')](_0x427e43[_0x7522('0x2d')]);if(_0x427e43[_0x7522('0x2e')]){delete _0x427e43[_0x7522('0x2e')];}_0x3b10d3[_0x7522('0x1e')](_0x17fd78)[_0x7522('0x2f')](_0x427e43);};}exports[_0x7522('0x30')]=function(_0x15844c,_0x45d541){var _0x4c80dd={},_0x43b067={},_0x2d5351={'count':0x0,'rows':[]};var _0x48bf4c=_[_0x7522('0x31')](db[_0x7522('0x32')]['rawAttributes'],function(_0xe0b104){return{'name':_0xe0b104[_0x7522('0x33')],'type':_0xe0b104[_0x7522('0x34')][_0x7522('0x35')]};});_0x43b067['model']=_[_0x7522('0x31')](_0x48bf4c,_0x7522('0x2e'));_0x43b067[_0x7522('0x36')]=_[_0x7522('0x37')](_0x15844c[_0x7522('0x36')]);_0x43b067[_0x7522('0x38')]=_[_0x7522('0x39')](_0x43b067[_0x7522('0x3a')],_0x43b067[_0x7522('0x36')]);_0x4c80dd[_0x7522('0x3b')]=_[_0x7522('0x39')](_0x43b067[_0x7522('0x3a')],qs['fields'](_0x15844c['query'][_0x7522('0x3c')]));_0x4c80dd['attributes']=_0x4c80dd[_0x7522('0x3b')]['length']?_0x4c80dd['attributes']:_0x43b067['model'];if(!_0x15844c[_0x7522('0x36')]['hasOwnProperty'](_0x7522('0x3d'))){_0x4c80dd['limit']=qs[_0x7522('0x22')](_0x15844c[_0x7522('0x36')][_0x7522('0x22')]);_0x4c80dd[_0x7522('0x20')]=qs[_0x7522('0x20')](_0x15844c[_0x7522('0x36')][_0x7522('0x20')]);}_0x4c80dd[_0x7522('0x3e')]=qs[_0x7522('0x3f')](_0x15844c[_0x7522('0x36')][_0x7522('0x3f')]);_0x4c80dd[_0x7522('0x40')]=qs[_0x7522('0x38')](_[_0x7522('0x41')](_0x15844c['query'],_0x43b067[_0x7522('0x38')]),_0x48bf4c);if(_0x15844c[_0x7522('0x36')]['filter']){_0x4c80dd[_0x7522('0x40')]=_[_0x7522('0x42')](_0x4c80dd[_0x7522('0x40')],{'$or':_['map'](_0x48bf4c,function(_0x3b2c76){if(_0x3b2c76[_0x7522('0x34')]!=='VIRTUAL'){var _0x38fb47={};_0x38fb47[_0x3b2c76['name']]={'$like':'%'+_0x15844c['query'][_0x7522('0x43')]+'%'};return _0x38fb47;}})});}_0x4c80dd=_[_0x7522('0x42')]({},_0x4c80dd,_0x15844c[_0x7522('0x44')]);var _0xfe76bb={'where':_0x4c80dd['where']};return db[_0x7522('0x32')][_0x7522('0x45')](_0xfe76bb)['then'](function(_0x2e9f9f){_0x2d5351[_0x7522('0x45')]=_0x2e9f9f;if(_0x15844c[_0x7522('0x36')][_0x7522('0x46')]){_0x4c80dd[_0x7522('0x47')]=[{'all':!![]}];}return db[_0x7522('0x32')][_0x7522('0x48')](_0x4c80dd);})[_0x7522('0x29')](function(_0x4b689d){_0x2d5351[_0x7522('0x49')]=_0x4b689d;return _0x2d5351;})[_0x7522('0x29')](respondWithFilteredResult(_0x45d541,_0x4c80dd))[_0x7522('0x4a')](handleError(_0x45d541,null));};exports['show']=function(_0x484ab8,_0x1da718){var _0x44413a={'raw':![],'where':{'id':_0x484ab8[_0x7522('0x4b')]['id']}},_0x441f83={};_0x441f83[_0x7522('0x3a')]=_['keys'](db[_0x7522('0x32')][_0x7522('0x4c')]);_0x441f83[_0x7522('0x36')]=_['keys'](_0x484ab8[_0x7522('0x36')]);_0x441f83['filters']=_[_0x7522('0x39')](_0x441f83[_0x7522('0x3a')],_0x441f83[_0x7522('0x36')]);_0x44413a['attributes']=_['intersection'](_0x441f83[_0x7522('0x3a')],qs[_0x7522('0x3c')](_0x484ab8[_0x7522('0x36')][_0x7522('0x3c')]));_0x44413a[_0x7522('0x3b')]=_0x44413a[_0x7522('0x3b')][_0x7522('0x4d')]?_0x44413a[_0x7522('0x3b')]:_0x441f83[_0x7522('0x3a')];if(_0x484ab8['query']['includeAll']){_0x44413a[_0x7522('0x47')]=[{'all':!![]}];}_0x44413a=_[_0x7522('0x42')]({},_0x44413a,_0x484ab8[_0x7522('0x44')]);return db[_0x7522('0x32')]['find'](_0x44413a)[_0x7522('0x29')](handleEntityNotFound(_0x1da718,null))['then'](respondWithResult(_0x1da718,null))[_0x7522('0x4a')](handleError(_0x1da718,null));};exports[_0x7522('0x4e')]=function(_0x31646f,_0x38a1c8){return db[_0x7522('0x32')][_0x7522('0x4e')](_0x31646f[_0x7522('0x4f')],{})[_0x7522('0x29')](function(_0x2e77ca){var _0x34eaf8=_0x31646f[_0x7522('0x50')][_0x7522('0x2a')]({'plain':!![]});if(!_0x34eaf8)throw new Error(_0x7522('0x51'));if(_0x34eaf8[_0x7522('0x52')]===_0x7522('0x50')){var _0x4e8e4a=_0x2e77ca[_0x7522('0x2a')]({'plain':!![]});var _0x2edbe8=_0x7522('0x53');return db[_0x7522('0x54')][_0x7522('0x55')]({'where':{'name':_0x2edbe8,'userProfileId':_0x34eaf8['userProfileId']},'raw':!![]})[_0x7522('0x29')](function(_0x577fc1){if(_0x577fc1&&_0x577fc1[_0x7522('0x56')]===0x0){return db['UserProfileResource'][_0x7522('0x4e')]({'name':_0x4e8e4a[_0x7522('0x2e')],'resourceId':_0x4e8e4a['id'],'type':_0x577fc1['name'],'sectionId':_0x577fc1['id']},{})[_0x7522('0x29')](function(){return _0x2e77ca;});}else{return _0x2e77ca;}})[_0x7522('0x4a')](function(_0x3308d6){logger[_0x7522('0x2c')](_0x7522('0x57'),_0x3308d6);throw _0x3308d6;});}return _0x2e77ca;})[_0x7522('0x29')](respondWithResult(_0x38a1c8,0xc9))[_0x7522('0x4a')](handleError(_0x38a1c8,null));};exports['clone']=function(_0x4d4895,_0x276148){var _0x354a39={'where':{'id':_0x4d4895[_0x7522('0x4b')]['id']}},_0x2e8737={};_0x2e8737[_0x7522('0x3a')]=_[_0x7522('0x37')](db[_0x7522('0x32')][_0x7522('0x4c')]);_0x354a39[_0x7522('0x3b')]=_['intersection'](_0x2e8737['model'],qs[_0x7522('0x3c')](_0x4d4895['query'][_0x7522('0x3c')]));_0x354a39[_0x7522('0x3b')]=_0x354a39[_0x7522('0x3b')][_0x7522('0x4d')]?_0x354a39[_0x7522('0x3b')]:_0x2e8737[_0x7522('0x3a')];if(_0x4d4895['query']['includeAll']){_0x354a39[_0x7522('0x47')]=[{'all':!![]}];}_0x354a39=_[_0x7522('0x42')]({},_0x354a39,_0x4d4895[_0x7522('0x44')]);return db['JscriptyProject'][_0x7522('0x55')](_0x354a39)[_0x7522('0x29')](handleEntityNotFound(_0x276148,null))[_0x7522('0x29')](function(_0x2b5176){if(_0x2b5176){var _0x245875=_0x2b5176[_0x7522('0x2a')]({'plain':!![]});_0x245875=qs['omit'](_0x245875,['id',_0x7522('0x58'),_0x7522('0x59')]);_0x4d4895[_0x7522('0x4f')]=_['omit'](_0x4d4895[_0x7522('0x4f')],['id',_0x7522('0x58'),_0x7522('0x59')]);return db['JscriptyProject']['create'](_['merge'](_0x245875,_0x4d4895[_0x7522('0x4f')]),{'include':_0x4d4895['query'][_0x7522('0x46')]?[{'all':!![]}]:undefined})[_0x7522('0x29')](function(_0x3dd925){var _0x16b9f4=_0x4d4895[_0x7522('0x50')]['get']({'plain':!![]});if(!_0x16b9f4)throw new Error(_0x7522('0x51'));if(_0x16b9f4['role']===_0x7522('0x50')){var _0x5b406e=_0x3dd925[_0x7522('0x2a')]({'plain':!![]});var _0x49d93a=_0x7522('0x53');return db[_0x7522('0x54')][_0x7522('0x55')]({'where':{'name':_0x49d93a,'userProfileId':_0x16b9f4[_0x7522('0x5a')]},'raw':!![]})[_0x7522('0x29')](function(_0x329f4a){if(_0x329f4a&&_0x329f4a[_0x7522('0x56')]===0x0){return db['UserProfileResource'][_0x7522('0x4e')]({'name':_0x5b406e[_0x7522('0x2e')],'resourceId':_0x5b406e['id'],'type':_0x329f4a['name'],'sectionId':_0x329f4a['id']},{})['then'](function(){return _0x3dd925;});}else{return _0x3dd925;}})[_0x7522('0x4a')](function(_0x4d4ea2){logger[_0x7522('0x2c')](_0x7522('0x57'),_0x4d4ea2);throw _0x4d4ea2;});}return _0x3dd925;});}})[_0x7522('0x29')](respondWithResult(_0x276148,0xc9))[_0x7522('0x4a')](handleError(_0x276148,null));};exports[_0x7522('0x5b')]=function(_0x5b1ed9,_0x2be254){if(_0x5b1ed9[_0x7522('0x4f')]['id']){delete _0x5b1ed9['body']['id'];}return db['JscriptyProject'][_0x7522('0x55')]({'where':{'id':_0x5b1ed9[_0x7522('0x4b')]['id']}})[_0x7522('0x29')](handleEntityNotFound(_0x2be254,null))['then'](saveUpdates(_0x5b1ed9['body'],null))['then'](respondWithResult(_0x2be254,null))[_0x7522('0x4a')](handleError(_0x2be254,null));};exports['destroy']=function(_0x18e5b5,_0x1d731b){return db[_0x7522('0x32')]['find']({'where':{'id':_0x18e5b5[_0x7522('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d731b,null))[_0x7522('0x29')](removeEntity(_0x1d731b,null))[_0x7522('0x4a')](handleError(_0x1d731b,null));};exports[_0x7522('0x5c')]=function(_0x4129cf,_0x21115e,_0xac983){var _0x2860de={'raw':!![],'where':{}};var _0x210ba8={};var _0x39974a={'count':0x0,'rows':[]};return db[_0x7522('0x32')][_0x7522('0x5d')]({'where':{'id':_0x4129cf[_0x7522('0x4b')]['id']}})[_0x7522('0x29')](handleEntityNotFound(_0x21115e,null))[_0x7522('0x29')](function(_0x24ff94){if(_0x24ff94){_0x210ba8['model']=_['keys'](db[_0x7522('0x5e')][_0x7522('0x4c')]);_0x210ba8[_0x7522('0x36')]=_[_0x7522('0x37')](_0x4129cf[_0x7522('0x36')]);_0x210ba8[_0x7522('0x38')]=_[_0x7522('0x39')](_0x210ba8[_0x7522('0x3a')],_0x210ba8['query']);_0x2860de[_0x7522('0x3b')]=_[_0x7522('0x39')](_0x210ba8['model'],qs[_0x7522('0x3c')](_0x4129cf[_0x7522('0x36')][_0x7522('0x3c')]));_0x2860de[_0x7522('0x3b')]=_0x2860de[_0x7522('0x3b')]['length']?_0x2860de[_0x7522('0x3b')]:_0x210ba8[_0x7522('0x3a')];if(!_0x4129cf[_0x7522('0x36')]['hasOwnProperty'](_0x7522('0x3d'))){_0x2860de[_0x7522('0x22')]=qs[_0x7522('0x22')](_0x4129cf[_0x7522('0x36')]['limit']);_0x2860de[_0x7522('0x20')]=qs[_0x7522('0x20')](_0x4129cf[_0x7522('0x36')]['offset']);}_0x2860de['order']=qs[_0x7522('0x3f')](_0x4129cf[_0x7522('0x36')][_0x7522('0x3f')]);_0x2860de['where']=qs[_0x7522('0x38')](_[_0x7522('0x41')](_0x4129cf[_0x7522('0x36')],_0x210ba8[_0x7522('0x38')]));_0x2860de[_0x7522('0x40')][_0x7522('0x5f')]=_0x24ff94['id'];if(_0x4129cf[_0x7522('0x36')][_0x7522('0x43')]){_0x2860de[_0x7522('0x40')]=_[_0x7522('0x42')](_0x2860de[_0x7522('0x40')],{'$or':_[_0x7522('0x31')](_0x2860de['attributes'],function(_0x4ea441){var _0x578010={};_0x578010[_0x4ea441]={'$like':'%'+_0x4129cf[_0x7522('0x36')][_0x7522('0x43')]+'%'};return _0x578010;})});}_0x2860de=_[_0x7522('0x42')]({},_0x2860de,_0x4129cf[_0x7522('0x44')]);return db[_0x7522('0x5e')]['count']({'where':_0x2860de['where']})[_0x7522('0x29')](function(_0x249c3b){_0x39974a['count']=_0x249c3b;if(_0x4129cf[_0x7522('0x36')][_0x7522('0x46')]){_0x2860de[_0x7522('0x47')]=[{'all':!![]}];}return db[_0x7522('0x5e')][_0x7522('0x48')](_0x2860de);})[_0x7522('0x29')](function(_0x11f9cd){_0x39974a['rows']=_0x11f9cd;return _0x39974a;});}})[_0x7522('0x29')](respondWithFilteredResult(_0x21115e,_0x2860de))[_0x7522('0x4a')](handleError(_0x21115e,null));};exports[_0x7522('0x60')]=function(_0x198291,_0x51a643,_0x536a04){var _0x324987={'raw':!![],'where':{}};var _0x47b595={};var _0x1346a1={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x198291['params']['id']}})[_0x7522('0x29')](handleEntityNotFound(_0x51a643,null))['then'](function(_0x2c8519){if(_0x2c8519){_0x47b595['model']=_[_0x7522('0x37')](db[_0x7522('0x61')]['rawAttributes']);_0x47b595[_0x7522('0x36')]=_[_0x7522('0x37')](_0x198291[_0x7522('0x36')]);_0x47b595['filters']=_['intersection'](_0x47b595[_0x7522('0x3a')],_0x47b595[_0x7522('0x36')]);_0x324987[_0x7522('0x3b')]=_[_0x7522('0x39')](_0x47b595[_0x7522('0x3a')],qs[_0x7522('0x3c')](_0x198291[_0x7522('0x36')]['fields']));_0x324987[_0x7522('0x3b')]=_0x324987['attributes'][_0x7522('0x4d')]?_0x324987[_0x7522('0x3b')]:_0x47b595[_0x7522('0x3a')];if(!_0x198291[_0x7522('0x36')]['hasOwnProperty'](_0x7522('0x3d'))){_0x324987[_0x7522('0x22')]=qs['limit'](_0x198291['query'][_0x7522('0x22')]);_0x324987[_0x7522('0x20')]=qs[_0x7522('0x20')](_0x198291['query'][_0x7522('0x20')]);}_0x324987[_0x7522('0x3e')]=qs[_0x7522('0x3f')](_0x198291[_0x7522('0x36')][_0x7522('0x3f')]);_0x324987['where']=qs[_0x7522('0x38')](_[_0x7522('0x41')](_0x198291['query'],_0x47b595[_0x7522('0x38')]));_0x324987[_0x7522('0x40')][_0x7522('0x5f')]=_0x2c8519['id'];if(_0x198291[_0x7522('0x36')][_0x7522('0x43')]){_0x324987['where']=_[_0x7522('0x42')](_0x324987[_0x7522('0x40')],{'$or':_[_0x7522('0x31')](_0x324987['attributes'],function(_0x388f94){var _0x1b15ed={};_0x1b15ed[_0x388f94]={'$like':'%'+_0x198291[_0x7522('0x36')][_0x7522('0x43')]+'%'};return _0x1b15ed;})});}_0x324987=_[_0x7522('0x42')]({},_0x324987,_0x198291[_0x7522('0x44')]);return db[_0x7522('0x61')][_0x7522('0x45')]({'where':_0x324987[_0x7522('0x40')]})['then'](function(_0x1a00d8){_0x1346a1[_0x7522('0x45')]=_0x1a00d8;if(_0x198291[_0x7522('0x36')][_0x7522('0x46')]){_0x324987['include']=[{'all':!![]}];}return db[_0x7522('0x61')]['findAll'](_0x324987);})[_0x7522('0x29')](function(_0x143b2){_0x1346a1[_0x7522('0x49')]=_0x143b2;return _0x1346a1;});}})[_0x7522('0x29')](respondWithFilteredResult(_0x51a643,_0x324987))[_0x7522('0x4a')](handleError(_0x51a643,null));};function char(_0x1500fe){return _0x7522('0x62')===typeof _0x1500fe?String['fromCharCode'][_0x7522('0x26')](null,arguments):_0x1500fe;}function needsEncapsulation(_0x29758a){return!!_0x29758a&&(_0x29758a[_0x7522('0x63')]()[_0x7522('0x64')](char(0xd))>=0x0||_0x29758a[_0x7522('0x63')]()[_0x7522('0x64')](char(0xa))>=0x0||_0x29758a[_0x7522('0x63')]()[_0x7522('0x64')](char(0x2c))>=0x0||_0x29758a[_0x7522('0x63')]()[_0x7522('0x64')](char(0x22))>=0x0);}function encapsulate(_0x1f1c9a){var _0x271d35=char(0x22),_0x4c44cc='\x5c'+char(0x22),_0x5de98b=_0x1f1c9a[_0x7522('0x63')]()['replace'](new RegExp(_0x271d35,'g'),_0x4c44cc);return _0x271d35+_0x5de98b+_0x271d35;}exports[_0x7522('0x65')]=function(_0x58f7db,_0x2f7983,_0x29137a){var _0xd413ab,_0x312946;var _0x1a653e={'where':{'ProjectId':_0x58f7db[_0x7522('0x4b')]['id']}};if(_0x58f7db[_0x7522('0x36')]['startTime']){_0x1a653e['where'][_0x7522('0x66')]=JSON[_0x7522('0x67')](_0x58f7db[_0x7522('0x36')][_0x7522('0x68')]);}return db['JscriptySessionReport'][_0x7522('0x48')](_0x1a653e)[_0x7522('0x29')](handleEntityNotFound(_0x2f7983,null))['then'](function(_0x3235f0){if(_0x3235f0){_0xd413ab=_0x3235f0;return db['JscriptyQuestionReport'][_0x7522('0x48')]({'where':{'SessionId':{'$in':_['map'](_0xd413ab,'id')},'ProjectId':_0x58f7db[_0x7522('0x4b')]['id']},'order':'-createdAt'});}})[_0x7522('0x29')](handleEntityNotFound(_0x2f7983,null))['then'](function(_0x5ed585){if(_0x5ed585){_0x312946=_0x5ed585;var _0x5e8476={};for(var _0x24d169=0x0,_0x178969=_0x312946[_0x7522('0x4d')];_0x24d169<_0x178969;_0x24d169++){if(!_0x5e8476[_0x7522('0x69')](_0x312946[_0x24d169][_0x7522('0x6a')])){_0x5e8476[_0x312946[_0x24d169]['questionId']]=needsEncapsulation(_0x312946[_0x24d169][_0x7522('0x6b')])?encapsulate(_0x312946[_0x24d169]['question']):_0x312946[_0x24d169]['question'];}}var _0x22d872=[],_0xf03b78={};for(var _0x500665=0x0,_0x54d5d7=_0xd413ab['length'];_0x500665<_0x54d5d7;_0x500665++){_0xf03b78={'ProjectId':_0x58f7db['params']['id'],'SessionId':_0xd413ab[_0x500665]['id'],'StartTime':moment(_0xd413ab[_0x500665][_0x7522('0x66')])[_0x7522('0x6c')](_0x7522('0x6d'))};for(var _0x49e115=0x0,_0x205c7a=_0x312946[_0x7522('0x4d')];_0x49e115<_0x205c7a;_0x49e115++){if(_0x312946[_0x49e115][_0x7522('0x6e')]==_0xd413ab[_0x500665]['id']&&_0x5e8476[_0x7522('0x69')](_0x312946[_0x49e115][_0x7522('0x6a')])){_0xf03b78[_0x5e8476[_0x312946[_0x49e115][_0x7522('0x6a')]]]=_0x312946[_0x49e115][_0x7522('0x6f')];}}for(var _0xe24c7e in _0x5e8476){if(!_0xf03b78[_0x7522('0x69')](_0x5e8476[_0xe24c7e])){_0xf03b78[_0x5e8476[_0xe24c7e]]=null;}}_0x22d872[_0x7522('0x70')](_0xf03b78);}return _0x22d872;}})['then'](function(_0x46f72c){if(!_[_0x7522('0x71')](_0x46f72c)){var _0x5e39cf=toCsv(_0x46f72c);var _0x5d876e=Date['now']();fs[_0x7522('0x72')](util[_0x7522('0x6c')](_0x7522('0x73'),_0x58f7db[_0x7522('0x4b')]['id'],_0x5d876e),_0x5e39cf);_0x2f7983[_0x7522('0x74')](_0x7522('0x75'),_0x7522('0x76')+util['format'](_0x7522('0x77'),_0x58f7db[_0x7522('0x4b')]['id'],_0x5d876e));_0x2f7983[_0x7522('0x74')](_0x7522('0x78'),'text/csv');return _0x2f7983[_0x7522('0x79')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x58f7db[_0x7522('0x4b')]['id'],_0x5d876e));}else{return _0x2f7983[_0x7522('0x1d')](0xcc);}})[_0x7522('0x4a')](handleError(_0x2f7983,null));}; \ No newline at end of file +var _0x8ba6=['catch','show','params','rawAttributes','length','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','destroy','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','nolimit','ProjectId','number','fromCharCode','apply','toString','indexOf','replace','startTime','starttime','parse','hasOwnProperty','questionId','question','format','SessionId','push','now','writeFileSync','Content-disposition','attachment;\x20filename=','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','get','UserProfileResource','then','error','stack','name','index','map','JscriptyProject','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x1d6c73,_0x29b113){var _0x66acc0=function(_0x34a6a1){while(--_0x34a6a1){_0x1d6c73['push'](_0x1d6c73['shift']());}};_0x66acc0(++_0x29b113);}(_0x8ba6,0x11b));var _0x68ba=function(_0x5773c9,_0x4c8665){_0x5773c9=_0x5773c9-0x0;var _0x28c202=_0x8ba6[_0x5773c9];return _0x28c202;};'use strict';var emlformat=require(_0x68ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68ba('0x2'));var moment=require(_0x68ba('0x3'));var BPromise=require(_0x68ba('0x4'));var Mustache=require(_0x68ba('0x5'));var util=require('util');var path=require('path');var sox=require(_0x68ba('0x6'));var csv=require(_0x68ba('0x7'));var ejs=require(_0x68ba('0x8'));var fs=require('fs');var fs_extra=require(_0x68ba('0x9'));var _=require(_0x68ba('0xa'));var squel=require(_0x68ba('0xb'));var crypto=require(_0x68ba('0xc'));var jsforce=require(_0x68ba('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x68ba('0x7'));var querystring=require(_0x68ba('0xe'));var Papa=require(_0x68ba('0xf'));var Redis=require(_0x68ba('0x10'));var authService=require(_0x68ba('0x11'));var qs=require(_0x68ba('0x12'));var as=require(_0x68ba('0x13'));var hardwareService=require(_0x68ba('0x14'));var logger=require(_0x68ba('0x15'))(_0x68ba('0x16'));var utils=require('../../config/utils');var config=require(_0x68ba('0x17'));var licenseUtil=require(_0x68ba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57ba2c,_0x1ae736){_0x1ae736=_0x1ae736||0xcc;return function(_0x577fe8){if(_0x577fe8){return _0x57ba2c[_0x68ba('0x19')](_0x1ae736);}return _0x57ba2c[_0x68ba('0x1a')](_0x1ae736)[_0x68ba('0x1b')]();};}function respondWithResult(_0x382b39,_0x96c10c){_0x96c10c=_0x96c10c||0xc8;return function(_0x29ee7a){if(_0x29ee7a){return _0x382b39[_0x68ba('0x1a')](_0x96c10c)['json'](_0x29ee7a);}};}function respondWithFilteredResult(_0x300a41,_0x1a17c2){return function(_0x1ce168){if(_0x1ce168){var _0x438dcc=typeof _0x1a17c2[_0x68ba('0x1c')]==='undefined'&&typeof _0x1a17c2[_0x68ba('0x1d')]===_0x68ba('0x1e');var _0x48d8e2=_0x1ce168['count'];var _0x33a324=_0x438dcc?0x0:_0x1a17c2[_0x68ba('0x1c')];var _0x219b7f=_0x438dcc?_0x1ce168[_0x68ba('0x1f')]:_0x1a17c2[_0x68ba('0x1c')]+_0x1a17c2[_0x68ba('0x1d')];var _0xb58385;if(_0x219b7f>=_0x48d8e2){_0x219b7f=_0x48d8e2;_0xb58385=0xc8;}else{_0xb58385=0xce;}_0x300a41[_0x68ba('0x1a')](_0xb58385);return _0x300a41[_0x68ba('0x20')](_0x68ba('0x21'),_0x33a324+'-'+_0x219b7f+'/'+_0x48d8e2)[_0x68ba('0x22')](_0x1ce168);}return null;};}function patchUpdates(_0x3bb47f){return function(_0x39862e){try{jsonpatch['apply'](_0x39862e,_0x3bb47f,!![]);}catch(_0x5b09ee){return BPromise[_0x68ba('0x23')](_0x5b09ee);}return _0x39862e['save']();};}function saveUpdates(_0x27ed6a,_0x1299e0){return function(_0xacd6b6){if(_0xacd6b6){return _0xacd6b6['update'](_0x27ed6a)['then'](function(_0x414090){return _0x414090;});}return null;};}function removeEntity(_0x3d8932,_0x4f5f5f){return function(_0x434d7a){if(_0x434d7a){return _0x434d7a['destroy']()['then'](function(){var _0x10d265=_0x434d7a[_0x68ba('0x24')]({'plain':!![]});var _0x27e4fc='Projects';return db[_0x68ba('0x25')]['destroy']({'where':{'type':_0x27e4fc,'resourceId':_0x10d265['id']}})[_0x68ba('0x26')](function(){return _0x434d7a;});})[_0x68ba('0x26')](function(){_0x3d8932[_0x68ba('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41d038,_0x4fcd25){return function(_0x4da416){if(!_0x4da416){_0x41d038[_0x68ba('0x19')](0x194);}return _0x4da416;};}function handleError(_0x58c6d6,_0x96f588){_0x96f588=_0x96f588||0x1f4;return function(_0x5f3775){logger[_0x68ba('0x27')](_0x5f3775[_0x68ba('0x28')]);if(_0x5f3775['name']){delete _0x5f3775[_0x68ba('0x29')];}_0x58c6d6['status'](_0x96f588)['send'](_0x5f3775);};}exports[_0x68ba('0x2a')]=function(_0x1fe628,_0x2c21cc){var _0x3be7fe={},_0x52f085={},_0x4bad63={'count':0x0,'rows':[]};var _0x4e47bd=_[_0x68ba('0x2b')](db[_0x68ba('0x2c')]['rawAttributes'],function(_0x4cf34c){return{'name':_0x4cf34c['fieldName'],'type':_0x4cf34c['type'][_0x68ba('0x2d')]};});_0x52f085[_0x68ba('0x2e')]=_[_0x68ba('0x2b')](_0x4e47bd,_0x68ba('0x29'));_0x52f085[_0x68ba('0x2f')]=_[_0x68ba('0x30')](_0x1fe628['query']);_0x52f085['filters']=_[_0x68ba('0x31')](_0x52f085[_0x68ba('0x2e')],_0x52f085[_0x68ba('0x2f')]);_0x3be7fe[_0x68ba('0x32')]=_[_0x68ba('0x31')](_0x52f085[_0x68ba('0x2e')],qs['fields'](_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x33')]));_0x3be7fe[_0x68ba('0x32')]=_0x3be7fe[_0x68ba('0x32')]['length']?_0x3be7fe[_0x68ba('0x32')]:_0x52f085[_0x68ba('0x2e')];if(!_0x1fe628[_0x68ba('0x2f')]['hasOwnProperty']('nolimit')){_0x3be7fe['limit']=qs[_0x68ba('0x1d')](_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x1d')]);_0x3be7fe['offset']=qs[_0x68ba('0x1c')](_0x1fe628[_0x68ba('0x2f')]['offset']);}_0x3be7fe[_0x68ba('0x34')]=qs[_0x68ba('0x35')](_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x35')]);_0x3be7fe[_0x68ba('0x36')]=qs[_0x68ba('0x37')](_[_0x68ba('0x38')](_0x1fe628[_0x68ba('0x2f')],_0x52f085[_0x68ba('0x37')]),_0x4e47bd);if(_0x1fe628[_0x68ba('0x2f')]['filter']){_0x3be7fe['where']=_[_0x68ba('0x39')](_0x3be7fe[_0x68ba('0x36')],{'$or':_[_0x68ba('0x2b')](_0x4e47bd,function(_0x247c13){if(_0x247c13[_0x68ba('0x3a')]!==_0x68ba('0x3b')){var _0x2562dd={};_0x2562dd[_0x247c13[_0x68ba('0x29')]]={'$like':'%'+_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x3c')]+'%'};return _0x2562dd;}})});}_0x3be7fe=_['merge']({},_0x3be7fe,_0x1fe628['options']);var _0x3f2e44={'where':_0x3be7fe[_0x68ba('0x36')]};return db[_0x68ba('0x2c')]['count'](_0x3f2e44)[_0x68ba('0x26')](function(_0x5cda75){_0x4bad63[_0x68ba('0x1f')]=_0x5cda75;if(_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x3d')]){_0x3be7fe[_0x68ba('0x3e')]=[{'all':!![]}];}return db[_0x68ba('0x2c')][_0x68ba('0x3f')](_0x3be7fe);})[_0x68ba('0x26')](function(_0x203246){_0x4bad63[_0x68ba('0x40')]=_0x203246;return _0x4bad63;})['then'](respondWithFilteredResult(_0x2c21cc,_0x3be7fe))[_0x68ba('0x41')](handleError(_0x2c21cc,null));};exports[_0x68ba('0x42')]=function(_0x1d769d,_0x5acabb){var _0x13c0b1={'raw':![],'where':{'id':_0x1d769d[_0x68ba('0x43')]['id']}},_0x196809={};_0x196809[_0x68ba('0x2e')]=_[_0x68ba('0x30')](db['JscriptyProject'][_0x68ba('0x44')]);_0x196809[_0x68ba('0x2f')]=_[_0x68ba('0x30')](_0x1d769d[_0x68ba('0x2f')]);_0x196809[_0x68ba('0x37')]=_[_0x68ba('0x31')](_0x196809[_0x68ba('0x2e')],_0x196809[_0x68ba('0x2f')]);_0x13c0b1['attributes']=_[_0x68ba('0x31')](_0x196809['model'],qs[_0x68ba('0x33')](_0x1d769d[_0x68ba('0x2f')][_0x68ba('0x33')]));_0x13c0b1['attributes']=_0x13c0b1[_0x68ba('0x32')][_0x68ba('0x45')]?_0x13c0b1[_0x68ba('0x32')]:_0x196809[_0x68ba('0x2e')];if(_0x1d769d['query']['includeAll']){_0x13c0b1[_0x68ba('0x3e')]=[{'all':!![]}];}_0x13c0b1=_[_0x68ba('0x39')]({},_0x13c0b1,_0x1d769d[_0x68ba('0x46')]);return db[_0x68ba('0x2c')]['find'](_0x13c0b1)[_0x68ba('0x26')](handleEntityNotFound(_0x5acabb,null))[_0x68ba('0x26')](respondWithResult(_0x5acabb,null))[_0x68ba('0x41')](handleError(_0x5acabb,null));};exports[_0x68ba('0x47')]=function(_0x388ff2,_0x223f53){return db[_0x68ba('0x2c')][_0x68ba('0x47')](_0x388ff2[_0x68ba('0x48')],{})[_0x68ba('0x26')](function(_0x4657ce){var _0x113fb9=_0x388ff2['user'][_0x68ba('0x24')]({'plain':!![]});if(!_0x113fb9)throw new Error(_0x68ba('0x49'));if(_0x113fb9[_0x68ba('0x4a')]===_0x68ba('0x4b')){var _0x158732=_0x4657ce[_0x68ba('0x24')]({'plain':!![]});var _0x551bb1=_0x68ba('0x4c');return db['UserProfileSection'][_0x68ba('0x4d')]({'where':{'name':_0x551bb1,'userProfileId':_0x113fb9[_0x68ba('0x4e')]},'raw':!![]})[_0x68ba('0x26')](function(_0x296f76){if(_0x296f76&&_0x296f76[_0x68ba('0x4f')]===0x0){return db[_0x68ba('0x25')]['create']({'name':_0x158732[_0x68ba('0x29')],'resourceId':_0x158732['id'],'type':_0x296f76[_0x68ba('0x29')],'sectionId':_0x296f76['id']},{})['then'](function(){return _0x4657ce;});}else{return _0x4657ce;}})['catch'](function(_0x375f98){logger[_0x68ba('0x27')](_0x68ba('0x50'),_0x375f98);throw _0x375f98;});}return _0x4657ce;})['then'](respondWithResult(_0x223f53,0xc9))['catch'](handleError(_0x223f53,null));};exports[_0x68ba('0x51')]=function(_0x16672a,_0x77a44){var _0x407305={'where':{'id':_0x16672a[_0x68ba('0x43')]['id']}},_0x46b6ba={};_0x46b6ba['model']=_['keys'](db[_0x68ba('0x2c')][_0x68ba('0x44')]);_0x407305['attributes']=_[_0x68ba('0x31')](_0x46b6ba[_0x68ba('0x2e')],qs[_0x68ba('0x33')](_0x16672a['query'][_0x68ba('0x33')]));_0x407305['attributes']=_0x407305[_0x68ba('0x32')][_0x68ba('0x45')]?_0x407305[_0x68ba('0x32')]:_0x46b6ba['model'];if(_0x16672a[_0x68ba('0x2f')][_0x68ba('0x3d')]){_0x407305[_0x68ba('0x3e')]=[{'all':!![]}];}_0x407305=_[_0x68ba('0x39')]({},_0x407305,_0x16672a['options']);return db[_0x68ba('0x2c')][_0x68ba('0x4d')](_0x407305)[_0x68ba('0x26')](handleEntityNotFound(_0x77a44,null))[_0x68ba('0x26')](function(_0x2d47a7){if(_0x2d47a7){var _0x463152=_0x2d47a7[_0x68ba('0x24')]({'plain':!![]});_0x463152=qs[_0x68ba('0x52')](_0x463152,['id',_0x68ba('0x53'),'updatedAt']);_0x16672a[_0x68ba('0x48')]=_[_0x68ba('0x52')](_0x16672a[_0x68ba('0x48')],['id',_0x68ba('0x53'),_0x68ba('0x54')]);return db[_0x68ba('0x2c')][_0x68ba('0x47')](_[_0x68ba('0x39')](_0x463152,_0x16672a[_0x68ba('0x48')]),{'include':_0x16672a[_0x68ba('0x2f')][_0x68ba('0x3d')]?[{'all':!![]}]:undefined})[_0x68ba('0x26')](function(_0x4367d1){var _0x192551=_0x16672a[_0x68ba('0x4b')][_0x68ba('0x24')]({'plain':!![]});if(!_0x192551)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x192551[_0x68ba('0x4a')]==='user'){var _0x573a76=_0x4367d1[_0x68ba('0x24')]({'plain':!![]});var _0x5c2c5b=_0x68ba('0x4c');return db[_0x68ba('0x55')][_0x68ba('0x4d')]({'where':{'name':_0x5c2c5b,'userProfileId':_0x192551[_0x68ba('0x4e')]},'raw':!![]})['then'](function(_0x2dfaaf){if(_0x2dfaaf&&_0x2dfaaf[_0x68ba('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x573a76['name'],'resourceId':_0x573a76['id'],'type':_0x2dfaaf[_0x68ba('0x29')],'sectionId':_0x2dfaaf['id']},{})[_0x68ba('0x26')](function(){return _0x4367d1;});}else{return _0x4367d1;}})[_0x68ba('0x41')](function(_0x29f774){logger[_0x68ba('0x27')](_0x68ba('0x50'),_0x29f774);throw _0x29f774;});}return _0x4367d1;});}})[_0x68ba('0x26')](respondWithResult(_0x77a44,0xc9))[_0x68ba('0x41')](handleError(_0x77a44,null));};exports[_0x68ba('0x56')]=function(_0x1ddf6e,_0x56fa08){if(_0x1ddf6e[_0x68ba('0x48')]['id']){delete _0x1ddf6e[_0x68ba('0x48')]['id'];}return db[_0x68ba('0x2c')]['find']({'where':{'id':_0x1ddf6e[_0x68ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x56fa08,null))[_0x68ba('0x26')](saveUpdates(_0x1ddf6e[_0x68ba('0x48')],null))[_0x68ba('0x26')](respondWithResult(_0x56fa08,null))['catch'](handleError(_0x56fa08,null));};exports[_0x68ba('0x57')]=function(_0x4b68fe,_0x35cd5c){return db['JscriptyProject']['find']({'where':{'id':_0x4b68fe[_0x68ba('0x43')]['id']}})[_0x68ba('0x26')](handleEntityNotFound(_0x35cd5c,null))[_0x68ba('0x26')](removeEntity(_0x35cd5c,null))[_0x68ba('0x41')](handleError(_0x35cd5c,null));};exports['getSessions']=function(_0x59356d,_0x31b09d,_0x181d58){var _0x1b4fb2={'raw':!![],'where':{}};var _0x37c8cd={};var _0x5d6330={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x68ba('0x58')]({'where':{'id':_0x59356d[_0x68ba('0x43')]['id']}})[_0x68ba('0x26')](handleEntityNotFound(_0x31b09d,null))[_0x68ba('0x26')](function(_0x5d2443){if(_0x5d2443){_0x37c8cd[_0x68ba('0x2e')]=_[_0x68ba('0x30')](db[_0x68ba('0x59')][_0x68ba('0x44')]);_0x37c8cd[_0x68ba('0x2f')]=_['keys'](_0x59356d['query']);_0x37c8cd[_0x68ba('0x37')]=_[_0x68ba('0x31')](_0x37c8cd[_0x68ba('0x2e')],_0x37c8cd[_0x68ba('0x2f')]);_0x1b4fb2['attributes']=_[_0x68ba('0x31')](_0x37c8cd['model'],qs[_0x68ba('0x33')](_0x59356d['query'][_0x68ba('0x33')]));_0x1b4fb2[_0x68ba('0x32')]=_0x1b4fb2['attributes'][_0x68ba('0x45')]?_0x1b4fb2[_0x68ba('0x32')]:_0x37c8cd['model'];if(!_0x59356d[_0x68ba('0x2f')]['hasOwnProperty']('nolimit')){_0x1b4fb2[_0x68ba('0x1d')]=qs['limit'](_0x59356d[_0x68ba('0x2f')][_0x68ba('0x1d')]);_0x1b4fb2[_0x68ba('0x1c')]=qs[_0x68ba('0x1c')](_0x59356d[_0x68ba('0x2f')]['offset']);}_0x1b4fb2[_0x68ba('0x34')]=qs['sort'](_0x59356d[_0x68ba('0x2f')][_0x68ba('0x35')]);_0x1b4fb2[_0x68ba('0x36')]=qs[_0x68ba('0x37')](_[_0x68ba('0x38')](_0x59356d['query'],_0x37c8cd[_0x68ba('0x37')]));_0x1b4fb2[_0x68ba('0x36')]['ProjectId']=_0x5d2443['id'];if(_0x59356d[_0x68ba('0x2f')][_0x68ba('0x3c')]){_0x1b4fb2[_0x68ba('0x36')]=_[_0x68ba('0x39')](_0x1b4fb2['where'],{'$or':_[_0x68ba('0x2b')](_0x1b4fb2[_0x68ba('0x32')],function(_0x2c9907){var _0x4779b2={};_0x4779b2[_0x2c9907]={'$like':'%'+_0x59356d[_0x68ba('0x2f')]['filter']+'%'};return _0x4779b2;})});}_0x1b4fb2=_[_0x68ba('0x39')]({},_0x1b4fb2,_0x59356d[_0x68ba('0x46')]);return db[_0x68ba('0x59')][_0x68ba('0x1f')]({'where':_0x1b4fb2[_0x68ba('0x36')]})['then'](function(_0x4df5c3){_0x5d6330[_0x68ba('0x1f')]=_0x4df5c3;if(_0x59356d[_0x68ba('0x2f')][_0x68ba('0x3d')]){_0x1b4fb2['include']=[{'all':!![]}];}return db[_0x68ba('0x59')]['findAll'](_0x1b4fb2);})[_0x68ba('0x26')](function(_0x355be6){_0x5d6330['rows']=_0x355be6;return _0x5d6330;});}})['then'](respondWithFilteredResult(_0x31b09d,_0x1b4fb2))[_0x68ba('0x41')](handleError(_0x31b09d,null));};exports[_0x68ba('0x5a')]=function(_0x52995a,_0x1e62c7,_0x3727ed){var _0x516a00={'raw':!![],'where':{}};var _0x38082f={};var _0x56dfd={'count':0x0,'rows':[]};return db[_0x68ba('0x2c')][_0x68ba('0x58')]({'where':{'id':_0x52995a[_0x68ba('0x43')]['id']}})[_0x68ba('0x26')](handleEntityNotFound(_0x1e62c7,null))[_0x68ba('0x26')](function(_0x4c467b){if(_0x4c467b){_0x38082f[_0x68ba('0x2e')]=_['keys'](db[_0x68ba('0x5b')][_0x68ba('0x44')]);_0x38082f[_0x68ba('0x2f')]=_[_0x68ba('0x30')](_0x52995a[_0x68ba('0x2f')]);_0x38082f[_0x68ba('0x37')]=_['intersection'](_0x38082f[_0x68ba('0x2e')],_0x38082f[_0x68ba('0x2f')]);_0x516a00['attributes']=_['intersection'](_0x38082f[_0x68ba('0x2e')],qs[_0x68ba('0x33')](_0x52995a[_0x68ba('0x2f')]['fields']));_0x516a00[_0x68ba('0x32')]=_0x516a00['attributes']['length']?_0x516a00[_0x68ba('0x32')]:_0x38082f[_0x68ba('0x2e')];if(!_0x52995a[_0x68ba('0x2f')]['hasOwnProperty'](_0x68ba('0x5c'))){_0x516a00[_0x68ba('0x1d')]=qs[_0x68ba('0x1d')](_0x52995a[_0x68ba('0x2f')]['limit']);_0x516a00[_0x68ba('0x1c')]=qs[_0x68ba('0x1c')](_0x52995a['query'][_0x68ba('0x1c')]);}_0x516a00[_0x68ba('0x34')]=qs[_0x68ba('0x35')](_0x52995a[_0x68ba('0x2f')][_0x68ba('0x35')]);_0x516a00[_0x68ba('0x36')]=qs[_0x68ba('0x37')](_[_0x68ba('0x38')](_0x52995a[_0x68ba('0x2f')],_0x38082f[_0x68ba('0x37')]));_0x516a00['where'][_0x68ba('0x5d')]=_0x4c467b['id'];if(_0x52995a[_0x68ba('0x2f')][_0x68ba('0x3c')]){_0x516a00['where']=_[_0x68ba('0x39')](_0x516a00[_0x68ba('0x36')],{'$or':_[_0x68ba('0x2b')](_0x516a00[_0x68ba('0x32')],function(_0x38ea80){var _0x11d397={};_0x11d397[_0x38ea80]={'$like':'%'+_0x52995a[_0x68ba('0x2f')][_0x68ba('0x3c')]+'%'};return _0x11d397;})});}_0x516a00=_[_0x68ba('0x39')]({},_0x516a00,_0x52995a[_0x68ba('0x46')]);return db[_0x68ba('0x5b')][_0x68ba('0x1f')]({'where':_0x516a00[_0x68ba('0x36')]})[_0x68ba('0x26')](function(_0x549e38){_0x56dfd[_0x68ba('0x1f')]=_0x549e38;if(_0x52995a['query']['includeAll']){_0x516a00['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x68ba('0x3f')](_0x516a00);})[_0x68ba('0x26')](function(_0x40faea){_0x56dfd[_0x68ba('0x40')]=_0x40faea;return _0x56dfd;});}})['then'](respondWithFilteredResult(_0x1e62c7,_0x516a00))[_0x68ba('0x41')](handleError(_0x1e62c7,null));};function char(_0x52c872){return _0x68ba('0x5e')===typeof _0x52c872?String[_0x68ba('0x5f')][_0x68ba('0x60')](null,arguments):_0x52c872;}function needsEncapsulation(_0x50981d){return!!_0x50981d&&(_0x50981d[_0x68ba('0x61')]()[_0x68ba('0x62')](char(0xd))>=0x0||_0x50981d[_0x68ba('0x61')]()[_0x68ba('0x62')](char(0xa))>=0x0||_0x50981d[_0x68ba('0x61')]()[_0x68ba('0x62')](char(0x2c))>=0x0||_0x50981d[_0x68ba('0x61')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x521e0a){var _0x677967=char(0x22),_0x2a02f5='\x5c'+char(0x22),_0x24a4ac=_0x521e0a[_0x68ba('0x61')]()[_0x68ba('0x63')](new RegExp(_0x677967,'g'),_0x2a02f5);return _0x677967+_0x24a4ac+_0x677967;}exports['getSummary']=function(_0x4e101f,_0x23d442,_0x5cbb8c){var _0x1f6aa8,_0x1a69a2;var _0x47ea47={'where':{'ProjectId':_0x4e101f[_0x68ba('0x43')]['id']}};if(_0x4e101f[_0x68ba('0x2f')][_0x68ba('0x64')]){_0x47ea47[_0x68ba('0x36')][_0x68ba('0x65')]=JSON[_0x68ba('0x66')](_0x4e101f[_0x68ba('0x2f')][_0x68ba('0x64')]);}return db['JscriptySessionReport'][_0x68ba('0x3f')](_0x47ea47)['then'](handleEntityNotFound(_0x23d442,null))[_0x68ba('0x26')](function(_0x5b4981){if(_0x5b4981){_0x1f6aa8=_0x5b4981;return db['JscriptyQuestionReport'][_0x68ba('0x3f')]({'where':{'SessionId':{'$in':_[_0x68ba('0x2b')](_0x1f6aa8,'id')},'ProjectId':_0x4e101f[_0x68ba('0x43')]['id']},'order':'-createdAt'});}})[_0x68ba('0x26')](handleEntityNotFound(_0x23d442,null))[_0x68ba('0x26')](function(_0x1d7413){if(_0x1d7413){_0x1a69a2=_0x1d7413;var _0x556349={};for(var _0xe549b1=0x0,_0x8072=_0x1a69a2['length'];_0xe549b1<_0x8072;_0xe549b1++){if(!_0x556349[_0x68ba('0x67')](_0x1a69a2[_0xe549b1][_0x68ba('0x68')])){_0x556349[_0x1a69a2[_0xe549b1][_0x68ba('0x68')]]=needsEncapsulation(_0x1a69a2[_0xe549b1]['question'])?encapsulate(_0x1a69a2[_0xe549b1][_0x68ba('0x69')]):_0x1a69a2[_0xe549b1]['question'];}}var _0x74bb6d=[],_0x41f316={};for(var _0x43d01b=0x0,_0x12351b=_0x1f6aa8['length'];_0x43d01b<_0x12351b;_0x43d01b++){_0x41f316={'ProjectId':_0x4e101f['params']['id'],'SessionId':_0x1f6aa8[_0x43d01b]['id'],'StartTime':moment(_0x1f6aa8[_0x43d01b][_0x68ba('0x65')])[_0x68ba('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x176cb9=0x0,_0x519d84=_0x1a69a2[_0x68ba('0x45')];_0x176cb9<_0x519d84;_0x176cb9++){if(_0x1a69a2[_0x176cb9][_0x68ba('0x6b')]==_0x1f6aa8[_0x43d01b]['id']&&_0x556349[_0x68ba('0x67')](_0x1a69a2[_0x176cb9][_0x68ba('0x68')])){_0x41f316[_0x556349[_0x1a69a2[_0x176cb9][_0x68ba('0x68')]]]=_0x1a69a2[_0x176cb9]['answer'];}}for(var _0x2f33d6 in _0x556349){if(!_0x41f316[_0x68ba('0x67')](_0x556349[_0x2f33d6])){_0x41f316[_0x556349[_0x2f33d6]]=null;}}_0x74bb6d[_0x68ba('0x6c')](_0x41f316);}return _0x74bb6d;}})['then'](function(_0x3725b3){if(!_['isEmpty'](_0x3725b3)){var _0x24c995=toCsv(_0x3725b3);var _0x405f63=Date[_0x68ba('0x6d')]();fs[_0x68ba('0x6e')](util[_0x68ba('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4e101f['params']['id'],_0x405f63),_0x24c995);_0x23d442['setHeader'](_0x68ba('0x6f'),_0x68ba('0x70')+util[_0x68ba('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x4e101f[_0x68ba('0x43')]['id'],_0x405f63));_0x23d442['setHeader'](_0x68ba('0x71'),'text/csv');return _0x23d442[_0x68ba('0x72')](util[_0x68ba('0x6a')](_0x68ba('0x73'),_0x4e101f['params']['id'],_0x405f63));}else{return _0x23d442[_0x68ba('0x19')](0xcc);}})['catch'](handleError(_0x23d442,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 356fc78..a25c9ab 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 _0xc73a=['exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xc73a,0x72));var _0xac73=function(_0x932f59,_0x26519d){_0x932f59=_0x932f59-0x0;var _0x434f2e=_0xc73a[_0x932f59];return _0x434f2e;};'use strict';var _=require('lodash');var util=require(_0xac73('0x0'));var logger=require(_0xac73('0x1'))(_0xac73('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac73('0x3'));var fs=require('fs');var path=require(_0xac73('0x4'));var rimraf=require(_0xac73('0x5'));var config=require('../../config/environment');var attributes=require(_0xac73('0x6'));module[_0xac73('0x7')]=function(_0x23fa68,_0x57992a){return _0x23fa68[_0xac73('0x8')](_0xac73('0x9'),attributes,{'tableName':_0xac73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12e9=['exports','JscriptyProject','jscripty_projects','../../config/logger','moment','bluebird','path','rimraf','./jscriptyProject.attributes'];(function(_0x37d00a,_0x1d9605){var _0x1b2d9e=function(_0x52e66d){while(--_0x52e66d){_0x37d00a['push'](_0x37d00a['shift']());}};_0x1b2d9e(++_0x1d9605);}(_0x12e9,0x66));var _0x912e=function(_0x41d19d,_0x3b520d){_0x41d19d=_0x41d19d-0x0;var _0x41cb8d=_0x12e9[_0x41d19d];return _0x41cb8d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x912e('0x0'))('api');var moment=require(_0x912e('0x1'));var BPromise=require(_0x912e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x912e('0x3'));var rimraf=require(_0x912e('0x4'));var config=require('../../config/environment');var attributes=require(_0x912e('0x5'));module[_0x912e('0x6')]=function(_0x2a15be,_0x31622c){return _0x2a15be['define'](_0x912e('0x7'),attributes,{'tableName':_0x912e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index a4545d1..fc31b42 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4511c4,_0x2da7ae){var _0x4cdc75=function(_0x3a5118){while(--_0x3a5118){_0x4511c4['push'](_0x4511c4['shift']());}};_0x4cdc75(++_0x2da7ae);}(_0x54ef,0x112));var _0xf54e=function(_0x176fb7,_0xec9697){_0x176fb7=_0x176fb7-0x0;var _0xb3cf11=_0x54ef[_0x176fb7];return _0xb3cf11;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x41e0b2,_0x43fd3b){var _0x3209fe=function(_0x4823e6){while(--_0x4823e6){_0x41e0b2['push'](_0x41e0b2['shift']());}};_0x3209fe(++_0x43fd3b);}(_0x54ef,0x112));var _0xf54e=function(_0x2f3bc7,_0x51201c){_0x2f3bc7=_0x2f3bc7-0x0;var _0x10e94f=_0x54ef[_0x2f3bc7];return _0x10e94f;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e3ba99d..034b829 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 _0xdad7=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3d09e3,_0x47abfc){var _0x3257d4=function(_0x236230){while(--_0x236230){_0x3d09e3['push'](_0x3d09e3['shift']());}};_0x3257d4(++_0x47abfc);}(_0xdad7,0x1e3));var _0x7dad=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xdad7[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x7dad('0x0'));var util=require(_0x7dad('0x1'));var path=require(_0x7dad('0x2'));var timeout=require(_0x7dad('0x3'));var express=require(_0x7dad('0x4'));var router=express[_0x7dad('0x5')]();var fs_extra=require(_0x7dad('0x6'));var auth=require(_0x7dad('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7dad('0x8'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x7dad('0x9')](),controller[_0x7dad('0xa')]);router[_0x7dad('0xb')]('/describe',auth[_0x7dad('0x9')](),controller[_0x7dad('0xc')]);router[_0x7dad('0xb')](_0x7dad('0xd'),auth[_0x7dad('0x9')](),controller[_0x7dad('0xe')]);router[_0x7dad('0xf')]('/',auth['isAuthenticated'](),controller[_0x7dad('0x10')]);router[_0x7dad('0x11')](_0x7dad('0xd'),auth[_0x7dad('0x9')](),controller[_0x7dad('0x12')]);router[_0x7dad('0x13')]('/:id',auth[_0x7dad('0x9')](),controller[_0x7dad('0x14')]);module[_0x7dad('0x15')]=router; \ No newline at end of file +var _0x2aa9=['get','index','/describe','isAuthenticated','/:id','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x2aa9,0x109));var _0x92aa=function(_0x59dfb3,_0x52e38d){_0x59dfb3=_0x59dfb3-0x0;var _0x1bf4c1=_0x2aa9[_0x59dfb3];return _0x1bf4c1;};'use strict';var multer=require('multer');var util=require(_0x92aa('0x0'));var path=require(_0x92aa('0x1'));var timeout=require(_0x92aa('0x2'));var express=require(_0x92aa('0x3'));var router=express[_0x92aa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x92aa('0x5'));var controller=require(_0x92aa('0x6'));router[_0x92aa('0x7')]('/',auth['isAuthenticated'](),controller[_0x92aa('0x8')]);router[_0x92aa('0x7')](_0x92aa('0x9'),auth[_0x92aa('0xa')](),controller['describe']);router[_0x92aa('0x7')](_0x92aa('0xb'),auth[_0x92aa('0xa')](),controller['show']);router[_0x92aa('0xc')]('/',auth[_0x92aa('0xa')](),controller['create']);router[_0x92aa('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x92aa('0xe')]);router[_0x92aa('0xf')](_0x92aa('0xb'),auth[_0x92aa('0xa')](),controller['destroy']);module[_0x92aa('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 86f5f39..dd67edb 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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x2279ef,_0x3a08db){_0x2279ef=_0x2279ef-0x0;var _0x4b7e97=_0x7a54[_0x2279ef];return _0x4b7e97;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x1a2b52,_0x156874){_0x1a2b52=_0x1a2b52-0x0;var _0x577f5f=_0x7a54[_0x1a2b52];return _0x577f5f;};'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 bc645b0..27451ad 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 _0x1f2c=['stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filters','where','VIRTUAL','merge','options','then','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','status','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f2c,0x6d));var _0xc1f2=function(_0x104e50,_0x54ac83){_0x104e50=_0x104e50-0x0;var _0x5a680d=_0x1f2c[_0x104e50];return _0x5a680d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1f2('0x1'));var rp=require(_0xc1f2('0x2'));var moment=require(_0xc1f2('0x3'));var BPromise=require(_0xc1f2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc1f2('0x5'));var csv=require(_0xc1f2('0x6'));var ejs=require(_0xc1f2('0x7'));var fs=require('fs');var fs_extra=require(_0xc1f2('0x8'));var _=require('lodash');var squel=require(_0xc1f2('0x9'));var crypto=require(_0xc1f2('0xa'));var jsforce=require(_0xc1f2('0xb'));var deskjs=require(_0xc1f2('0xc'));var toCsv=require(_0xc1f2('0x6'));var querystring=require(_0xc1f2('0xd'));var Papa=require(_0xc1f2('0xe'));var Redis=require(_0xc1f2('0xf'));var authService=require(_0xc1f2('0x10'));var qs=require(_0xc1f2('0x11'));var as=require(_0xc1f2('0x12'));var hardwareService=require(_0xc1f2('0x13'));var logger=require(_0xc1f2('0x14'))(_0xc1f2('0x15'));var utils=require('../../config/utils');var config=require(_0xc1f2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1f2('0x17'))['db'];function respondWithStatusCode(_0x34365f,_0x5941f6){_0x5941f6=_0x5941f6||0xcc;return function(_0x94e248){if(_0x94e248){return _0x34365f[_0xc1f2('0x18')](_0x5941f6);}return _0x34365f['status'](_0x5941f6)[_0xc1f2('0x19')]();};}function respondWithResult(_0x49711b,_0x230c4f){_0x230c4f=_0x230c4f||0xc8;return function(_0x290575){if(_0x290575){return _0x49711b['status'](_0x230c4f)[_0xc1f2('0x1a')](_0x290575);}};}function respondWithFilteredResult(_0x2a2de0,_0x524601){return function(_0x359758){if(_0x359758){var _0x2c7326=typeof _0x524601[_0xc1f2('0x1b')]==='undefined'&&typeof _0x524601['limit']===_0xc1f2('0x1c');var _0x232204=_0x359758[_0xc1f2('0x1d')];var _0x42722f=_0x2c7326?0x0:_0x524601[_0xc1f2('0x1b')];var _0x169a35=_0x2c7326?_0x359758[_0xc1f2('0x1d')]:_0x524601[_0xc1f2('0x1b')]+_0x524601[_0xc1f2('0x1e')];var _0x48e8c5;if(_0x169a35>=_0x232204){_0x169a35=_0x232204;_0x48e8c5=0xc8;}else{_0x48e8c5=0xce;}_0x2a2de0['status'](_0x48e8c5);return _0x2a2de0[_0xc1f2('0x1f')](_0xc1f2('0x20'),_0x42722f+'-'+_0x169a35+'/'+_0x232204)[_0xc1f2('0x1a')](_0x359758);}return null;};}function patchUpdates(_0x3b7f12){return function(_0x159557){try{jsonpatch[_0xc1f2('0x21')](_0x159557,_0x3b7f12,!![]);}catch(_0x58b592){return BPromise['reject'](_0x58b592);}return _0x159557[_0xc1f2('0x22')]();};}function saveUpdates(_0x383307,_0xb93158){return function(_0x9f45f7){if(_0x9f45f7){return _0x9f45f7[_0xc1f2('0x23')](_0x383307)['then'](function(_0x1544ed){return _0x1544ed;});}return null;};}function removeEntity(_0x382f01,_0x36aba7){return function(_0x275adf){if(_0x275adf){return _0x275adf[_0xc1f2('0x24')]()['then'](function(){_0x382f01[_0xc1f2('0x25')](0xcc)[_0xc1f2('0x19')]();});}};}function handleEntityNotFound(_0x50e9ef,_0x1d3f11){return function(_0x10d01f){if(!_0x10d01f){_0x50e9ef['sendStatus'](0x194);}return _0x10d01f;};}function handleError(_0xa1e8bc,_0x2564c0){_0x2564c0=_0x2564c0||0x1f4;return function(_0xe3f02e){logger[_0xc1f2('0x26')](_0xe3f02e[_0xc1f2('0x27')]);if(_0xe3f02e['name']){delete _0xe3f02e['name'];}_0xa1e8bc['status'](_0x2564c0)[_0xc1f2('0x28')](_0xe3f02e);};}exports[_0xc1f2('0x29')]=function(_0xa19cde,_0x29729c){var _0x2cbe3b={},_0x51fd70={},_0x23034e={'count':0x0,'rows':[]};var _0x3c44fd=_[_0xc1f2('0x2a')](db[_0xc1f2('0x2b')][_0xc1f2('0x2c')],function(_0xe33c26){return{'name':_0xe33c26[_0xc1f2('0x2d')],'type':_0xe33c26[_0xc1f2('0x2e')][_0xc1f2('0x2f')]};});_0x51fd70[_0xc1f2('0x30')]=_[_0xc1f2('0x2a')](_0x3c44fd,'name');_0x51fd70[_0xc1f2('0x31')]=_['keys'](_0xa19cde[_0xc1f2('0x31')]);_0x51fd70['filters']=_[_0xc1f2('0x32')](_0x51fd70['model'],_0x51fd70['query']);_0x2cbe3b['attributes']=_[_0xc1f2('0x32')](_0x51fd70[_0xc1f2('0x30')],qs['fields'](_0xa19cde[_0xc1f2('0x31')][_0xc1f2('0x33')]));_0x2cbe3b[_0xc1f2('0x34')]=_0x2cbe3b[_0xc1f2('0x34')][_0xc1f2('0x35')]?_0x2cbe3b['attributes']:_0x51fd70['model'];if(!_0xa19cde[_0xc1f2('0x31')][_0xc1f2('0x36')]('nolimit')){_0x2cbe3b[_0xc1f2('0x1e')]=qs[_0xc1f2('0x1e')](_0xa19cde[_0xc1f2('0x31')][_0xc1f2('0x1e')]);_0x2cbe3b[_0xc1f2('0x1b')]=qs[_0xc1f2('0x1b')](_0xa19cde[_0xc1f2('0x31')]['offset']);}_0x2cbe3b['order']=qs[_0xc1f2('0x37')](_0xa19cde[_0xc1f2('0x31')][_0xc1f2('0x37')]);_0x2cbe3b['where']=qs['filters'](_[_0xc1f2('0x38')](_0xa19cde['query'],_0x51fd70[_0xc1f2('0x39')]),_0x3c44fd);if(_0xa19cde[_0xc1f2('0x31')]['filter']){_0x2cbe3b[_0xc1f2('0x3a')]=_['merge'](_0x2cbe3b['where'],{'$or':_[_0xc1f2('0x2a')](_0x3c44fd,function(_0x53a832){if(_0x53a832[_0xc1f2('0x2e')]!==_0xc1f2('0x3b')){var _0x2d7ed8={};_0x2d7ed8[_0x53a832['name']]={'$like':'%'+_0xa19cde[_0xc1f2('0x31')]['filter']+'%'};return _0x2d7ed8;}})});}_0x2cbe3b=_[_0xc1f2('0x3c')]({},_0x2cbe3b,_0xa19cde[_0xc1f2('0x3d')]);var _0x44ae86={'where':_0x2cbe3b[_0xc1f2('0x3a')]};return db[_0xc1f2('0x2b')]['count'](_0x44ae86)[_0xc1f2('0x3e')](function(_0x2abcd4){_0x23034e[_0xc1f2('0x1d')]=_0x2abcd4;if(_0xa19cde['query']['includeAll']){_0x2cbe3b[_0xc1f2('0x3f')]=[{'all':!![]}];}return db[_0xc1f2('0x2b')]['findAll'](_0x2cbe3b);})[_0xc1f2('0x3e')](function(_0x19bef3){_0x23034e[_0xc1f2('0x40')]=_0x19bef3;return _0x23034e;})['then'](respondWithFilteredResult(_0x29729c,_0x2cbe3b))[_0xc1f2('0x41')](handleError(_0x29729c,null));};exports[_0xc1f2('0x42')]=function(_0x56c8c0,_0x383d33){var _0x2a0d26={'raw':!![],'where':{'id':_0x56c8c0[_0xc1f2('0x43')]['id']}},_0x211ff9={};_0x211ff9[_0xc1f2('0x30')]=_[_0xc1f2('0x44')](db['JscriptyQuestionReport'][_0xc1f2('0x2c')]);_0x211ff9['query']=_[_0xc1f2('0x44')](_0x56c8c0[_0xc1f2('0x31')]);_0x211ff9['filters']=_[_0xc1f2('0x32')](_0x211ff9[_0xc1f2('0x30')],_0x211ff9[_0xc1f2('0x31')]);_0x2a0d26[_0xc1f2('0x34')]=_[_0xc1f2('0x32')](_0x211ff9[_0xc1f2('0x30')],qs[_0xc1f2('0x33')](_0x56c8c0['query'][_0xc1f2('0x33')]));_0x2a0d26[_0xc1f2('0x34')]=_0x2a0d26[_0xc1f2('0x34')][_0xc1f2('0x35')]?_0x2a0d26[_0xc1f2('0x34')]:_0x211ff9[_0xc1f2('0x30')];if(_0x56c8c0['query'][_0xc1f2('0x45')]){_0x2a0d26['include']=[{'all':!![]}];}_0x2a0d26=_[_0xc1f2('0x3c')]({},_0x2a0d26,_0x56c8c0[_0xc1f2('0x3d')]);return db['JscriptyQuestionReport'][_0xc1f2('0x46')](_0x2a0d26)[_0xc1f2('0x3e')](handleEntityNotFound(_0x383d33,null))[_0xc1f2('0x3e')](respondWithResult(_0x383d33,null))[_0xc1f2('0x41')](handleError(_0x383d33,null));};exports['create']=function(_0xf4640,_0x30a7c3){return db[_0xc1f2('0x2b')][_0xc1f2('0x47')](_0xf4640[_0xc1f2('0x48')],{})[_0xc1f2('0x3e')](respondWithResult(_0x30a7c3,0xc9))[_0xc1f2('0x41')](handleError(_0x30a7c3,null));};exports['update']=function(_0x25c7de,_0x73e501){if(_0x25c7de[_0xc1f2('0x48')]['id']){delete _0x25c7de['body']['id'];}return db[_0xc1f2('0x2b')][_0xc1f2('0x46')]({'where':{'id':_0x25c7de['params']['id']}})[_0xc1f2('0x3e')](handleEntityNotFound(_0x73e501,null))[_0xc1f2('0x3e')](saveUpdates(_0x25c7de['body'],null))['then'](respondWithResult(_0x73e501,null))[_0xc1f2('0x41')](handleError(_0x73e501,null));};exports[_0xc1f2('0x24')]=function(_0x20d69c,_0x34e6bc){return db[_0xc1f2('0x2b')][_0xc1f2('0x46')]({'where':{'id':_0x20d69c['params']['id']}})['then'](handleEntityNotFound(_0x34e6bc,null))[_0xc1f2('0x3e')](removeEntity(_0x34e6bc,null))[_0xc1f2('0x41')](handleError(_0x34e6bc,null));};exports['describe']=function(_0x419a26,_0xd844f2){return db[_0xc1f2('0x2b')][_0xc1f2('0x49')]()[_0xc1f2('0x3e')](respondWithResult(_0xd844f2,null))[_0xc1f2('0x41')](handleError(_0xd844f2,null));}; \ No newline at end of file +var _0x653c=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','rows','catch','show','keys','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x653c,0x1f4));var _0xc653=function(_0x1a4bcf,_0x447e0d){_0x1a4bcf=_0x1a4bcf-0x0;var _0x389476=_0x653c[_0x1a4bcf];return _0x389476;};'use strict';var emlformat=require(_0xc653('0x0'));var rimraf=require(_0xc653('0x1'));var zipdir=require(_0xc653('0x2'));var jsonpatch=require(_0xc653('0x3'));var rp=require(_0xc653('0x4'));var moment=require('moment');var BPromise=require(_0xc653('0x5'));var Mustache=require('mustache');var util=require(_0xc653('0x6'));var path=require(_0xc653('0x7'));var sox=require('sox');var csv=require(_0xc653('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc653('0x9'));var _=require(_0xc653('0xa'));var squel=require(_0xc653('0xb'));var crypto=require('crypto');var jsforce=require(_0xc653('0xc'));var deskjs=require(_0xc653('0xd'));var toCsv=require(_0xc653('0x8'));var querystring=require('querystring');var Papa=require(_0xc653('0xe'));var Redis=require(_0xc653('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc653('0x10'));var hardwareService=require(_0xc653('0x11'));var logger=require(_0xc653('0x12'))(_0xc653('0x13'));var utils=require(_0xc653('0x14'));var config=require(_0xc653('0x15'));var licenseUtil=require(_0xc653('0x16'));var db=require(_0xc653('0x17'))['db'];function respondWithStatusCode(_0x3ea0c7,_0x4db1ff){_0x4db1ff=_0x4db1ff||0xcc;return function(_0x501eba){if(_0x501eba){return _0x3ea0c7[_0xc653('0x18')](_0x4db1ff);}return _0x3ea0c7['status'](_0x4db1ff)[_0xc653('0x19')]();};}function respondWithResult(_0x484e7f,_0x354da1){_0x354da1=_0x354da1||0xc8;return function(_0x170da0){if(_0x170da0){return _0x484e7f[_0xc653('0x1a')](_0x354da1)['json'](_0x170da0);}};}function respondWithFilteredResult(_0x35a1ca,_0x40c54f){return function(_0xda584){if(_0xda584){var _0x5aac4a=typeof _0x40c54f[_0xc653('0x1b')]===_0xc653('0x1c')&&typeof _0x40c54f[_0xc653('0x1d')]===_0xc653('0x1c');var _0x153ebe=_0xda584[_0xc653('0x1e')];var _0x16ae25=_0x5aac4a?0x0:_0x40c54f[_0xc653('0x1b')];var _0x2ab893=_0x5aac4a?_0xda584[_0xc653('0x1e')]:_0x40c54f[_0xc653('0x1b')]+_0x40c54f['limit'];var _0x191c50;if(_0x2ab893>=_0x153ebe){_0x2ab893=_0x153ebe;_0x191c50=0xc8;}else{_0x191c50=0xce;}_0x35a1ca[_0xc653('0x1a')](_0x191c50);return _0x35a1ca[_0xc653('0x1f')](_0xc653('0x20'),_0x16ae25+'-'+_0x2ab893+'/'+_0x153ebe)['json'](_0xda584);}return null;};}function patchUpdates(_0x42c6e0){return function(_0x9eced7){try{jsonpatch[_0xc653('0x21')](_0x9eced7,_0x42c6e0,!![]);}catch(_0x5af6f8){return BPromise[_0xc653('0x22')](_0x5af6f8);}return _0x9eced7[_0xc653('0x23')]();};}function saveUpdates(_0x51df19,_0x30e50c){return function(_0x12e7e8){if(_0x12e7e8){return _0x12e7e8[_0xc653('0x24')](_0x51df19)[_0xc653('0x25')](function(_0x4a7753){return _0x4a7753;});}return null;};}function removeEntity(_0x79651c,_0x507188){return function(_0xc2fee8){if(_0xc2fee8){return _0xc2fee8[_0xc653('0x26')]()['then'](function(){_0x79651c[_0xc653('0x1a')](0xcc)[_0xc653('0x19')]();});}};}function handleEntityNotFound(_0x31a754,_0x29941f){return function(_0x352abe){if(!_0x352abe){_0x31a754[_0xc653('0x18')](0x194);}return _0x352abe;};}function handleError(_0x17569a,_0xeb4c1a){_0xeb4c1a=_0xeb4c1a||0x1f4;return function(_0x2a7583){logger[_0xc653('0x27')](_0x2a7583['stack']);if(_0x2a7583['name']){delete _0x2a7583[_0xc653('0x28')];}_0x17569a['status'](_0xeb4c1a)['send'](_0x2a7583);};}exports[_0xc653('0x29')]=function(_0x3e62b5,_0x10bea7){var _0x33bcd8={},_0x5d7ccc={},_0xf69c45={'count':0x0,'rows':[]};var _0x20372d=_['map'](db[_0xc653('0x2a')][_0xc653('0x2b')],function(_0x1b21bb){return{'name':_0x1b21bb[_0xc653('0x2c')],'type':_0x1b21bb[_0xc653('0x2d')][_0xc653('0x2e')]};});_0x5d7ccc[_0xc653('0x2f')]=_[_0xc653('0x30')](_0x20372d,'name');_0x5d7ccc[_0xc653('0x31')]=_['keys'](_0x3e62b5[_0xc653('0x31')]);_0x5d7ccc['filters']=_[_0xc653('0x32')](_0x5d7ccc[_0xc653('0x2f')],_0x5d7ccc[_0xc653('0x31')]);_0x33bcd8[_0xc653('0x33')]=_[_0xc653('0x32')](_0x5d7ccc[_0xc653('0x2f')],qs[_0xc653('0x34')](_0x3e62b5[_0xc653('0x31')][_0xc653('0x34')]));_0x33bcd8['attributes']=_0x33bcd8[_0xc653('0x33')][_0xc653('0x35')]?_0x33bcd8[_0xc653('0x33')]:_0x5d7ccc[_0xc653('0x2f')];if(!_0x3e62b5[_0xc653('0x31')][_0xc653('0x36')](_0xc653('0x37'))){_0x33bcd8[_0xc653('0x1d')]=qs[_0xc653('0x1d')](_0x3e62b5[_0xc653('0x31')][_0xc653('0x1d')]);_0x33bcd8[_0xc653('0x1b')]=qs['offset'](_0x3e62b5[_0xc653('0x31')][_0xc653('0x1b')]);}_0x33bcd8[_0xc653('0x38')]=qs['sort'](_0x3e62b5[_0xc653('0x31')][_0xc653('0x39')]);_0x33bcd8[_0xc653('0x3a')]=qs['filters'](_[_0xc653('0x3b')](_0x3e62b5[_0xc653('0x31')],_0x5d7ccc[_0xc653('0x3c')]),_0x20372d);if(_0x3e62b5['query'][_0xc653('0x3d')]){_0x33bcd8[_0xc653('0x3a')]=_['merge'](_0x33bcd8['where'],{'$or':_[_0xc653('0x30')](_0x20372d,function(_0xcb7f45){if(_0xcb7f45[_0xc653('0x2d')]!=='VIRTUAL'){var _0x2bda60={};_0x2bda60[_0xcb7f45[_0xc653('0x28')]]={'$like':'%'+_0x3e62b5[_0xc653('0x31')][_0xc653('0x3d')]+'%'};return _0x2bda60;}})});}_0x33bcd8=_[_0xc653('0x3e')]({},_0x33bcd8,_0x3e62b5[_0xc653('0x3f')]);var _0x44a053={'where':_0x33bcd8[_0xc653('0x3a')]};return db['JscriptyQuestionReport'][_0xc653('0x1e')](_0x44a053)[_0xc653('0x25')](function(_0x5a0f8a){_0xf69c45[_0xc653('0x1e')]=_0x5a0f8a;if(_0x3e62b5[_0xc653('0x31')]['includeAll']){_0x33bcd8['include']=[{'all':!![]}];}return db[_0xc653('0x2a')]['findAll'](_0x33bcd8);})[_0xc653('0x25')](function(_0x996909){_0xf69c45[_0xc653('0x40')]=_0x996909;return _0xf69c45;})['then'](respondWithFilteredResult(_0x10bea7,_0x33bcd8))[_0xc653('0x41')](handleError(_0x10bea7,null));};exports[_0xc653('0x42')]=function(_0x4068a5,_0x2c4b6c){var _0x3c221c={'raw':!![],'where':{'id':_0x4068a5['params']['id']}},_0x2cc461={};_0x2cc461['model']=_[_0xc653('0x43')](db[_0xc653('0x2a')]['rawAttributes']);_0x2cc461[_0xc653('0x31')]=_[_0xc653('0x43')](_0x4068a5[_0xc653('0x31')]);_0x2cc461[_0xc653('0x3c')]=_[_0xc653('0x32')](_0x2cc461['model'],_0x2cc461[_0xc653('0x31')]);_0x3c221c[_0xc653('0x33')]=_[_0xc653('0x32')](_0x2cc461[_0xc653('0x2f')],qs[_0xc653('0x34')](_0x4068a5[_0xc653('0x31')][_0xc653('0x34')]));_0x3c221c[_0xc653('0x33')]=_0x3c221c[_0xc653('0x33')][_0xc653('0x35')]?_0x3c221c[_0xc653('0x33')]:_0x2cc461[_0xc653('0x2f')];if(_0x4068a5['query'][_0xc653('0x44')]){_0x3c221c[_0xc653('0x45')]=[{'all':!![]}];}_0x3c221c=_[_0xc653('0x3e')]({},_0x3c221c,_0x4068a5[_0xc653('0x3f')]);return db[_0xc653('0x2a')][_0xc653('0x46')](_0x3c221c)[_0xc653('0x25')](handleEntityNotFound(_0x2c4b6c,null))[_0xc653('0x25')](respondWithResult(_0x2c4b6c,null))[_0xc653('0x41')](handleError(_0x2c4b6c,null));};exports[_0xc653('0x47')]=function(_0x40d4ee,_0xda6b26){return db['JscriptyQuestionReport'][_0xc653('0x47')](_0x40d4ee[_0xc653('0x48')],{})[_0xc653('0x25')](respondWithResult(_0xda6b26,0xc9))[_0xc653('0x41')](handleError(_0xda6b26,null));};exports[_0xc653('0x24')]=function(_0x4fcc4d,_0x195f70){if(_0x4fcc4d['body']['id']){delete _0x4fcc4d[_0xc653('0x48')]['id'];}return db['JscriptyQuestionReport'][_0xc653('0x46')]({'where':{'id':_0x4fcc4d[_0xc653('0x49')]['id']}})[_0xc653('0x25')](handleEntityNotFound(_0x195f70,null))[_0xc653('0x25')](saveUpdates(_0x4fcc4d['body'],null))[_0xc653('0x25')](respondWithResult(_0x195f70,null))[_0xc653('0x41')](handleError(_0x195f70,null));};exports[_0xc653('0x26')]=function(_0x188b62,_0x57a595){return db['JscriptyQuestionReport'][_0xc653('0x46')]({'where':{'id':_0x188b62[_0xc653('0x49')]['id']}})[_0xc653('0x25')](handleEntityNotFound(_0x57a595,null))[_0xc653('0x25')](removeEntity(_0x57a595,null))[_0xc653('0x41')](handleError(_0x57a595,null));};exports[_0xc653('0x4a')]=function(_0x9c4aa3,_0x306f58){return db[_0xc653('0x2a')][_0xc653('0x4a')]()[_0xc653('0x25')](respondWithResult(_0x306f58,null))[_0xc653('0x41')](handleError(_0x306f58,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 830f835..881b12a 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 _0x1eef=['rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','util','path'];(function(_0x4e888a,_0x5d76f6){var _0x5c9c8c=function(_0x2a3a29){while(--_0x2a3a29){_0x4e888a['push'](_0x4e888a['shift']());}};_0x5c9c8c(++_0x5d76f6);}(_0x1eef,0x17f));var _0xf1ee=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0x1eef[_0x46f3f8];return _0xbc57cd;};'use strict';var _=require('lodash');var util=require(_0xf1ee('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1ee('0x1'));var rimraf=require(_0xf1ee('0x2'));var config=require('../../config/environment');var attributes=require(_0xf1ee('0x3'));module[_0xf1ee('0x4')]=function(_0x3d2a75,_0x444179){return _0x3d2a75['define'](_0xf1ee('0x5'),attributes,{'tableName':_0xf1ee('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9132=['lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define','JscriptyQuestionReport'];(function(_0x16d634,_0x5113cc){var _0x2bf99e=function(_0x385405){while(--_0x385405){_0x16d634['push'](_0x16d634['shift']());}};_0x2bf99e(++_0x5113cc);}(_0x9132,0x1b9));var _0x2913=function(_0x537cde,_0x2594d6){_0x537cde=_0x537cde-0x0;var _0x5558ae=_0x9132[_0x537cde];return _0x5558ae;};'use strict';var _=require(_0x2913('0x0'));var util=require(_0x2913('0x1'));var logger=require(_0x2913('0x2'))('api');var moment=require(_0x2913('0x3'));var BPromise=require(_0x2913('0x4'));var rp=require(_0x2913('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x2913('0x6')]=function(_0x3f0e61,_0xe936b9){return _0x3f0e61[_0x2913('0x7')](_0x2913('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 754091b..7704c0a 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 _0x4f99=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x177ecd,_0x237b49){var _0x39c5da=function(_0x507d22){while(--_0x507d22){_0x177ecd['push'](_0x177ecd['shift']());}};_0x39c5da(++_0x237b49);}(_0x4f99,0x13f));var _0x94f9=function(_0x5b086e,_0x5eb6c0){_0x5b086e=_0x5b086e-0x0;var _0x3e2c2c=_0x4f99[_0x5b086e];return _0x3e2c2c;};'use strict';var _=require(_0x94f9('0x0'));var util=require(_0x94f9('0x1'));var moment=require(_0x94f9('0x2'));var BPromise=require('bluebird');var rs=require(_0x94f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94f9('0x4'))['db'];var utils=require(_0x94f9('0x5'));var logger=require(_0x94f9('0x6'))(_0x94f9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x94f9('0x8')][_0x94f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c1d81,_0x211b60,_0x1735ab){return new BPromise(function(_0x1596cd,_0x52785d){return client['request'](_0x9c1d81,_0x1735ab)['then'](function(_0x481c52){logger[_0x94f9('0xa')](_0x94f9('0xb'),_0x211b60,_0x94f9('0xc'));logger[_0x94f9('0xd')](_0x94f9('0xe'),_0x211b60,_0x94f9('0xc'),JSON[_0x94f9('0xf')](_0x481c52));if(_0x481c52[_0x94f9('0x10')]){if(_0x481c52[_0x94f9('0x10')][_0x94f9('0x11')]===0x1f4){logger[_0x94f9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x211b60,_0x481c52[_0x94f9('0x10')]['message']);return _0x52785d(_0x481c52['error'][_0x94f9('0x12')]);}logger['error'](_0x94f9('0xb'),_0x211b60,_0x481c52[_0x94f9('0x10')][_0x94f9('0x12')]);return _0x1596cd(_0x481c52[_0x94f9('0x10')][_0x94f9('0x12')]);}else{logger[_0x94f9('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x211b60,_0x94f9('0xc'));_0x1596cd(_0x481c52[_0x94f9('0x13')][_0x94f9('0x12')]);}})[_0x94f9('0x14')](function(_0x4e6dc3){logger['error'](_0x94f9('0xb'),_0x211b60,_0x4e6dc3);_0x52785d(_0x4e6dc3);});});} \ No newline at end of file +var _0x9a24=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','moment'];(function(_0x4a161f,_0x416f0a){var _0x5c857e=function(_0x4f1a2a){while(--_0x4f1a2a){_0x4a161f['push'](_0x4a161f['shift']());}};_0x5c857e(++_0x416f0a);}(_0x9a24,0x102));var _0x49a2=function(_0x584d24,_0x1ff65c){_0x584d24=_0x584d24-0x0;var _0x18b271=_0x9a24[_0x584d24];return _0x18b271;};'use strict';var _=require(_0x49a2('0x0'));var util=require('util');var moment=require(_0x49a2('0x1'));var BPromise=require(_0x49a2('0x2'));var rs=require(_0x49a2('0x3'));var fs=require('fs');var Redis=require(_0x49a2('0x4'));var db=require(_0x49a2('0x5'))['db'];var utils=require(_0x49a2('0x6'));var logger=require(_0x49a2('0x7'))('rpc');var config=require(_0x49a2('0x8'));var jayson=require(_0x49a2('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e4faf,_0x4d1ce3,_0xb4fdd7){return new BPromise(function(_0x422ab3,_0x500214){return client[_0x49a2('0xa')](_0x2e4faf,_0xb4fdd7)['then'](function(_0x5b42ef){logger[_0x49a2('0xb')](_0x49a2('0xc'),_0x4d1ce3,_0x49a2('0xd'));logger[_0x49a2('0xe')](_0x49a2('0xf'),_0x4d1ce3,_0x49a2('0xd'),JSON['stringify'](_0x5b42ef));if(_0x5b42ef['error']){if(_0x5b42ef['error'][_0x49a2('0x10')]===0x1f4){logger['error'](_0x49a2('0xc'),_0x4d1ce3,_0x5b42ef[_0x49a2('0x11')][_0x49a2('0x12')]);return _0x500214(_0x5b42ef['error'][_0x49a2('0x12')]);}logger[_0x49a2('0x11')](_0x49a2('0xc'),_0x4d1ce3,_0x5b42ef[_0x49a2('0x11')]['message']);return _0x422ab3(_0x5b42ef[_0x49a2('0x11')][_0x49a2('0x12')]);}else{logger[_0x49a2('0xb')](_0x49a2('0xc'),_0x4d1ce3,_0x49a2('0xd'));_0x422ab3(_0x5b42ef[_0x49a2('0x13')][_0x49a2('0x12')]);}})['catch'](function(_0x37881d){logger[_0x49a2('0x11')](_0x49a2('0xc'),_0x4d1ce3,_0x37881d);_0x500214(_0x37881d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ce54036..b640a79 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 _0x95e8=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post','create','put','delete','/:id'];(function(_0x4aa7a9,_0xaed7f9){var _0x426bb8=function(_0x2ed029){while(--_0x2ed029){_0x4aa7a9['push'](_0x4aa7a9['shift']());}};_0x426bb8(++_0xaed7f9);}(_0x95e8,0x1ba));var _0x895e=function(_0x4dd83f,_0x4de8d9){_0x4dd83f=_0x4dd83f-0x0;var _0x3b22b0=_0x95e8[_0x4dd83f];return _0x3b22b0;};'use strict';var multer=require(_0x895e('0x0'));var util=require(_0x895e('0x1'));var path=require(_0x895e('0x2'));var timeout=require('connect-timeout');var express=require(_0x895e('0x3'));var router=express['Router']();var fs_extra=require(_0x895e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x895e('0x5'));var config=require(_0x895e('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x895e('0x7')]('/',auth[_0x895e('0x8')](),controller[_0x895e('0x9')]);router[_0x895e('0x7')](_0x895e('0xa'),auth['isAuthenticated'](),controller[_0x895e('0xb')]);router[_0x895e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x895e('0xc')]);router[_0x895e('0x7')](_0x895e('0xd'),auth[_0x895e('0x8')](),controller[_0x895e('0xe')]);router[_0x895e('0xf')]('/',auth[_0x895e('0x8')](),controller[_0x895e('0x10')]);router[_0x895e('0x11')]('/:id',auth[_0x895e('0x8')](),controller['update']);router[_0x895e('0x12')](_0x895e('0x13'),auth[_0x895e('0x8')](),controller['destroy']);module[_0x895e('0x14')]=router; \ No newline at end of file +var _0x5319=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','describe','/:id','show','getQuestions','post','create','put','delete','destroy','util','connect-timeout','express','Router'];(function(_0x3559c4,_0x47580b){var _0x124053=function(_0x2edf1){while(--_0x2edf1){_0x3559c4['push'](_0x3559c4['shift']());}};_0x124053(++_0x47580b);}(_0x5319,0x12c));var _0x9531=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x5319[_0x52666e];return _0x515330;};'use strict';var multer=require('multer');var util=require(_0x9531('0x0'));var path=require('path');var timeout=require(_0x9531('0x1'));var express=require(_0x9531('0x2'));var router=express[_0x9531('0x3')]();var fs_extra=require(_0x9531('0x4'));var auth=require(_0x9531('0x5'));var interaction=require(_0x9531('0x6'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x9531('0x7')](),controller[_0x9531('0x8')]);router[_0x9531('0x9')]('/describe',auth[_0x9531('0x7')](),controller[_0x9531('0xa')]);router['get'](_0x9531('0xb'),auth[_0x9531('0x7')](),controller[_0x9531('0xc')]);router['get']('/:id/questions',auth['isAuthenticated'](),controller[_0x9531('0xd')]);router[_0x9531('0xe')]('/',auth[_0x9531('0x7')](),controller[_0x9531('0xf')]);router[_0x9531('0x10')]('/:id',auth[_0x9531('0x7')](),controller['update']);router[_0x9531('0x11')](_0x9531('0xb'),auth[_0x9531('0x7')](),controller[_0x9531('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index bf38d02..276a069 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 _0xd86a=['DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2a0db0,_0x4b7061){var _0x533972=function(_0x1e257a){while(--_0x1e257a){_0x2a0db0['push'](_0x2a0db0['shift']());}};_0x533972(++_0x4b7061);}(_0xd86a,0xf3));var _0xad86=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0xd86a[_0x3e21f4];return _0x40fc49;};'use strict';var moment=require(_0xad86('0x0'));var Sequelize=require(_0xad86('0x1'));module[_0xad86('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5b9bff){this[_0xad86('0x3')](_0xad86('0x4'),_0x5b9bff);this['setDataValue']('endtime',moment()[_0xad86('0x5')](_0xad86('0x6')));}},'endtime':{'type':Sequelize[_0xad86('0x7')]},'membername':{'type':Sequelize[_0xad86('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xad86('0x8')]},'calleridnum':{'type':Sequelize[_0xad86('0x8')]},'completed':{'type':Sequelize[_0xad86('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xdde1=['STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5824f4,_0x511783){var _0x11d149=function(_0x4a588a){while(--_0x4a588a){_0x5824f4['push'](_0x5824f4['shift']());}};_0x11d149(++_0x511783);}(_0xdde1,0xf5));var _0x1dde=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xdde1[_0x24f31b];return _0x488401;};'use strict';var moment=require(_0x1dde('0x0'));var Sequelize=require(_0x1dde('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x1dde('0x2')],'set':function(_0x457478){this[_0x1dde('0x3')](_0x1dde('0x4'),_0x457478);this[_0x1dde('0x3')](_0x1dde('0x5'),moment()['format'](_0x1dde('0x6')));}},'endtime':{'type':Sequelize[_0x1dde('0x2')]},'membername':{'type':Sequelize[_0x1dde('0x7')]},'projectname':{'type':Sequelize[_0x1dde('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1dde('0x7')]},'calleridnum':{'type':Sequelize[_0x1dde('0x7')]},'completed':{'type':Sequelize[_0x1dde('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bc531d4..bbd1b36 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 _0x47d5=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','merge','VIRTUAL','JscriptySessionReport','includeAll','include','rows','catch','show','options','find','create','body','update','params','describe','getQuestions','nolimit','pick','filter','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x4e8b5c,_0x4ecd48){var _0x17a710=function(_0x1f1c89){while(--_0x1f1c89){_0x4e8b5c['push'](_0x4e8b5c['shift']());}};_0x17a710(++_0x4ecd48);}(_0x47d5,0x12b));var _0x547d=function(_0x3747b4,_0x5c18e5){_0x3747b4=_0x3747b4-0x0;var _0x31f1e1=_0x47d5[_0x3747b4];return _0x31f1e1;};'use strict';var emlformat=require(_0x547d('0x0'));var rimraf=require(_0x547d('0x1'));var zipdir=require(_0x547d('0x2'));var jsonpatch=require(_0x547d('0x3'));var rp=require(_0x547d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x547d('0x5'));var util=require(_0x547d('0x6'));var path=require('path');var sox=require(_0x547d('0x7'));var csv=require(_0x547d('0x8'));var ejs=require(_0x547d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x547d('0xa'));var crypto=require(_0x547d('0xb'));var jsforce=require(_0x547d('0xc'));var deskjs=require(_0x547d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x547d('0xe'));var Papa=require(_0x547d('0xf'));var Redis=require(_0x547d('0x10'));var authService=require(_0x547d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x547d('0x12'));var hardwareService=require(_0x547d('0x13'));var logger=require(_0x547d('0x14'))(_0x547d('0x15'));var utils=require('../../config/utils');var config=require(_0x547d('0x16'));var licenseUtil=require(_0x547d('0x17'));var db=require(_0x547d('0x18'))['db'];function respondWithStatusCode(_0x14bf5e,_0x527a5f){_0x527a5f=_0x527a5f||0xcc;return function(_0x3e815c){if(_0x3e815c){return _0x14bf5e[_0x547d('0x19')](_0x527a5f);}return _0x14bf5e[_0x547d('0x1a')](_0x527a5f)[_0x547d('0x1b')]();};}function respondWithResult(_0x55e58f,_0x355976){_0x355976=_0x355976||0xc8;return function(_0x22499e){if(_0x22499e){return _0x55e58f[_0x547d('0x1a')](_0x355976)[_0x547d('0x1c')](_0x22499e);}};}function respondWithFilteredResult(_0x1da2d4,_0xbee398){return function(_0x315203){if(_0x315203){var _0x1b0051=typeof _0xbee398['offset']===_0x547d('0x1d')&&typeof _0xbee398['limit']===_0x547d('0x1d');var _0x59456c=_0x315203[_0x547d('0x1e')];var _0x282f52=_0x1b0051?0x0:_0xbee398[_0x547d('0x1f')];var _0x4cd164=_0x1b0051?_0x315203[_0x547d('0x1e')]:_0xbee398[_0x547d('0x1f')]+_0xbee398[_0x547d('0x20')];var _0x4a1e43;if(_0x4cd164>=_0x59456c){_0x4cd164=_0x59456c;_0x4a1e43=0xc8;}else{_0x4a1e43=0xce;}_0x1da2d4['status'](_0x4a1e43);return _0x1da2d4[_0x547d('0x21')]('Content-Range',_0x282f52+'-'+_0x4cd164+'/'+_0x59456c)[_0x547d('0x1c')](_0x315203);}return null;};}function patchUpdates(_0x533842){return function(_0x127e68){try{jsonpatch[_0x547d('0x22')](_0x127e68,_0x533842,!![]);}catch(_0x303dd8){return BPromise[_0x547d('0x23')](_0x303dd8);}return _0x127e68[_0x547d('0x24')]();};}function saveUpdates(_0x3395ca,_0x1e5494){return function(_0x1fdc45){if(_0x1fdc45){return _0x1fdc45['update'](_0x3395ca)[_0x547d('0x25')](function(_0x5cc265){return _0x5cc265;});}return null;};}function removeEntity(_0x1afd83,_0x2706b6){return function(_0x250dc8){if(_0x250dc8){return _0x250dc8[_0x547d('0x26')]()[_0x547d('0x25')](function(){_0x1afd83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12fb1e,_0x50fd32){return function(_0x283f63){if(!_0x283f63){_0x12fb1e[_0x547d('0x19')](0x194);}return _0x283f63;};}function handleError(_0x5937ca,_0x4f4ca3){_0x4f4ca3=_0x4f4ca3||0x1f4;return function(_0x5f0a8a){logger[_0x547d('0x27')](_0x5f0a8a[_0x547d('0x28')]);if(_0x5f0a8a[_0x547d('0x29')]){delete _0x5f0a8a[_0x547d('0x29')];}_0x5937ca[_0x547d('0x1a')](_0x4f4ca3)[_0x547d('0x2a')](_0x5f0a8a);};}exports[_0x547d('0x2b')]=function(_0x57f087,_0x1181aa){var _0xf84790={},_0x385aa1={},_0x558223={'count':0x0,'rows':[]};var _0x306173=_['map'](db['JscriptySessionReport'][_0x547d('0x2c')],function(_0x113b6a){return{'name':_0x113b6a['fieldName'],'type':_0x113b6a['type']['key']};});_0x385aa1[_0x547d('0x2d')]=_[_0x547d('0x2e')](_0x306173,_0x547d('0x29'));_0x385aa1[_0x547d('0x2f')]=_[_0x547d('0x30')](_0x57f087[_0x547d('0x2f')]);_0x385aa1['filters']=_['intersection'](_0x385aa1['model'],_0x385aa1[_0x547d('0x2f')]);_0xf84790[_0x547d('0x31')]=_[_0x547d('0x32')](_0x385aa1[_0x547d('0x2d')],qs[_0x547d('0x33')](_0x57f087['query'][_0x547d('0x33')]));_0xf84790['attributes']=_0xf84790['attributes'][_0x547d('0x34')]?_0xf84790[_0x547d('0x31')]:_0x385aa1[_0x547d('0x2d')];if(!_0x57f087[_0x547d('0x2f')][_0x547d('0x35')]('nolimit')){_0xf84790['limit']=qs['limit'](_0x57f087['query'][_0x547d('0x20')]);_0xf84790['offset']=qs['offset'](_0x57f087['query'][_0x547d('0x1f')]);}_0xf84790['order']=qs[_0x547d('0x36')](_0x57f087[_0x547d('0x2f')][_0x547d('0x36')]);_0xf84790[_0x547d('0x37')]=qs['filters'](_['pick'](_0x57f087[_0x547d('0x2f')],_0x385aa1[_0x547d('0x38')]),_0x306173);if(_0x57f087['query']['filter']){_0xf84790[_0x547d('0x37')]=_[_0x547d('0x39')](_0xf84790[_0x547d('0x37')],{'$or':_[_0x547d('0x2e')](_0x306173,function(_0x7b524f){if(_0x7b524f['type']!==_0x547d('0x3a')){var _0x5f35e1={};_0x5f35e1[_0x7b524f['name']]={'$like':'%'+_0x57f087[_0x547d('0x2f')]['filter']+'%'};return _0x5f35e1;}})});}_0xf84790=_[_0x547d('0x39')]({},_0xf84790,_0x57f087['options']);var _0x48d44b={'where':_0xf84790[_0x547d('0x37')]};return db[_0x547d('0x3b')][_0x547d('0x1e')](_0x48d44b)[_0x547d('0x25')](function(_0x6a5e2f){_0x558223[_0x547d('0x1e')]=_0x6a5e2f;if(_0x57f087['query'][_0x547d('0x3c')]){_0xf84790[_0x547d('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xf84790);})['then'](function(_0x6edf09){_0x558223[_0x547d('0x3e')]=_0x6edf09;return _0x558223;})[_0x547d('0x25')](respondWithFilteredResult(_0x1181aa,_0xf84790))[_0x547d('0x3f')](handleError(_0x1181aa,null));};exports[_0x547d('0x40')]=function(_0x3ce809,_0x24a83b){var _0x534810={'raw':!![],'where':{'id':_0x3ce809['params']['id']}},_0x228448={};_0x228448[_0x547d('0x2d')]=_['keys'](db[_0x547d('0x3b')]['rawAttributes']);_0x228448[_0x547d('0x2f')]=_[_0x547d('0x30')](_0x3ce809[_0x547d('0x2f')]);_0x228448[_0x547d('0x38')]=_[_0x547d('0x32')](_0x228448[_0x547d('0x2d')],_0x228448[_0x547d('0x2f')]);_0x534810[_0x547d('0x31')]=_['intersection'](_0x228448['model'],qs[_0x547d('0x33')](_0x3ce809[_0x547d('0x2f')]['fields']));_0x534810['attributes']=_0x534810[_0x547d('0x31')][_0x547d('0x34')]?_0x534810['attributes']:_0x228448[_0x547d('0x2d')];if(_0x3ce809[_0x547d('0x2f')][_0x547d('0x3c')]){_0x534810[_0x547d('0x3d')]=[{'all':!![]}];}_0x534810=_[_0x547d('0x39')]({},_0x534810,_0x3ce809[_0x547d('0x41')]);return db[_0x547d('0x3b')][_0x547d('0x42')](_0x534810)[_0x547d('0x25')](handleEntityNotFound(_0x24a83b,null))[_0x547d('0x25')](respondWithResult(_0x24a83b,null))[_0x547d('0x3f')](handleError(_0x24a83b,null));};exports[_0x547d('0x43')]=function(_0x23068d,_0x5d2d2f){return db[_0x547d('0x3b')][_0x547d('0x43')](_0x23068d[_0x547d('0x44')],{})[_0x547d('0x25')](respondWithResult(_0x5d2d2f,0xc9))[_0x547d('0x3f')](handleError(_0x5d2d2f,null));};exports[_0x547d('0x45')]=function(_0xa9197c,_0x15e519){if(_0xa9197c[_0x547d('0x44')]['id']){delete _0xa9197c[_0x547d('0x44')]['id'];}return db[_0x547d('0x3b')][_0x547d('0x42')]({'where':{'id':_0xa9197c[_0x547d('0x46')]['id']}})[_0x547d('0x25')](handleEntityNotFound(_0x15e519,null))[_0x547d('0x25')](saveUpdates(_0xa9197c['body'],null))[_0x547d('0x25')](respondWithResult(_0x15e519,null))[_0x547d('0x3f')](handleError(_0x15e519,null));};exports[_0x547d('0x26')]=function(_0x368faf,_0x4993fb){return db[_0x547d('0x3b')][_0x547d('0x42')]({'where':{'id':_0x368faf[_0x547d('0x46')]['id']}})['then'](handleEntityNotFound(_0x4993fb,null))[_0x547d('0x25')](removeEntity(_0x4993fb,null))['catch'](handleError(_0x4993fb,null));};exports[_0x547d('0x47')]=function(_0x33aef4,_0x4ec2cf){return db[_0x547d('0x3b')][_0x547d('0x47')]()['then'](respondWithResult(_0x4ec2cf,null))[_0x547d('0x3f')](handleError(_0x4ec2cf,null));};exports[_0x547d('0x48')]=function(_0x2c5952,_0x147f23,_0x3cf710){var _0x512d40={'raw':!![],'where':{}};var _0x38f8be={};var _0x31bbe1={'count':0x0,'rows':[]};return db[_0x547d('0x3b')]['findOne']({'where':{'id':_0x2c5952[_0x547d('0x46')]['id']}})[_0x547d('0x25')](handleEntityNotFound(_0x147f23,null))[_0x547d('0x25')](function(_0x4f6fbf){if(_0x4f6fbf){_0x38f8be[_0x547d('0x2d')]=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x38f8be['query']=_[_0x547d('0x30')](_0x2c5952['query']);_0x38f8be[_0x547d('0x38')]=_[_0x547d('0x32')](_0x38f8be['model'],_0x38f8be[_0x547d('0x2f')]);_0x512d40[_0x547d('0x31')]=_[_0x547d('0x32')](_0x38f8be[_0x547d('0x2d')],qs[_0x547d('0x33')](_0x2c5952[_0x547d('0x2f')][_0x547d('0x33')]));_0x512d40[_0x547d('0x31')]=_0x512d40[_0x547d('0x31')]['length']?_0x512d40['attributes']:_0x38f8be['model'];if(!_0x2c5952[_0x547d('0x2f')][_0x547d('0x35')](_0x547d('0x49'))){_0x512d40[_0x547d('0x20')]=qs['limit'](_0x2c5952['query'][_0x547d('0x20')]);_0x512d40[_0x547d('0x1f')]=qs[_0x547d('0x1f')](_0x2c5952['query'][_0x547d('0x1f')]);}_0x512d40['order']=qs[_0x547d('0x36')](_0x2c5952[_0x547d('0x2f')][_0x547d('0x36')]);_0x512d40['where']=qs[_0x547d('0x38')](_[_0x547d('0x4a')](_0x2c5952[_0x547d('0x2f')],_0x38f8be[_0x547d('0x38')]));_0x512d40['where']['SessionId']=_0x4f6fbf['id'];if(_0x2c5952[_0x547d('0x2f')][_0x547d('0x4b')]){_0x512d40[_0x547d('0x37')]=_[_0x547d('0x39')](_0x512d40[_0x547d('0x37')],{'$or':_[_0x547d('0x2e')](_0x512d40[_0x547d('0x31')],function(_0x1cbcca){var _0x4615b3={};_0x4615b3[_0x1cbcca]={'$like':'%'+_0x2c5952[_0x547d('0x2f')][_0x547d('0x4b')]+'%'};return _0x4615b3;})});}_0x512d40=_[_0x547d('0x39')]({},_0x512d40,_0x2c5952[_0x547d('0x41')]);return db[_0x547d('0x4c')][_0x547d('0x1e')]({'where':_0x512d40[_0x547d('0x37')]})[_0x547d('0x25')](function(_0x1c6537){_0x31bbe1[_0x547d('0x1e')]=_0x1c6537;if(_0x2c5952[_0x547d('0x2f')][_0x547d('0x3c')]){_0x512d40['include']=[{'all':!![]}];}return db[_0x547d('0x4c')][_0x547d('0x4d')](_0x512d40);})[_0x547d('0x25')](function(_0x14e550){_0x31bbe1[_0x547d('0x3e')]=_0x14e550;return _0x31bbe1;});}})[_0x547d('0x25')](respondWithFilteredResult(_0x147f23,_0x512d40))[_0x547d('0x3f')](handleError(_0x147f23,null));}; \ No newline at end of file +var _0xdd57=['api','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','JscriptyQuestionReport','SessionId','eml-format','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x493496,_0x1ed53b){var _0x2925eb=function(_0x33752f){while(--_0x33752f){_0x493496['push'](_0x493496['shift']());}};_0x2925eb(++_0x1ed53b);}(_0xdd57,0x1ee));var _0x7dd5=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0xdd57[_0x9d1e6b];return _0x2b3070;};'use strict';var emlformat=require(_0x7dd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7dd5('0x1'));var jsonpatch=require(_0x7dd5('0x2'));var rp=require('request-promise');var moment=require(_0x7dd5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7dd5('0x4'));var csv=require(_0x7dd5('0x5'));var ejs=require(_0x7dd5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dd5('0x7'));var squel=require(_0x7dd5('0x8'));var crypto=require(_0x7dd5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7dd5('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7dd5('0xb'));var Papa=require(_0x7dd5('0xc'));var Redis=require(_0x7dd5('0xd'));var authService=require(_0x7dd5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7dd5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7dd5('0x10'))(_0x7dd5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7dd5('0x12'));var db=require(_0x7dd5('0x13'))['db'];function respondWithStatusCode(_0x2fd512,_0xdaaba2){_0xdaaba2=_0xdaaba2||0xcc;return function(_0x48abcf){if(_0x48abcf){return _0x2fd512['sendStatus'](_0xdaaba2);}return _0x2fd512['status'](_0xdaaba2)['end']();};}function respondWithResult(_0x4c4dfc,_0x3b4c65){_0x3b4c65=_0x3b4c65||0xc8;return function(_0xc09303){if(_0xc09303){return _0x4c4dfc[_0x7dd5('0x14')](_0x3b4c65)['json'](_0xc09303);}};}function respondWithFilteredResult(_0x435832,_0x2b41d9){return function(_0x268e94){if(_0x268e94){var _0x4f2857=typeof _0x2b41d9['offset']==='undefined'&&typeof _0x2b41d9['limit']===_0x7dd5('0x15');var _0x466b44=_0x268e94[_0x7dd5('0x16')];var _0x196405=_0x4f2857?0x0:_0x2b41d9[_0x7dd5('0x17')];var _0x261eb2=_0x4f2857?_0x268e94[_0x7dd5('0x16')]:_0x2b41d9['offset']+_0x2b41d9[_0x7dd5('0x18')];var _0x4e6762;if(_0x261eb2>=_0x466b44){_0x261eb2=_0x466b44;_0x4e6762=0xc8;}else{_0x4e6762=0xce;}_0x435832[_0x7dd5('0x14')](_0x4e6762);return _0x435832[_0x7dd5('0x19')](_0x7dd5('0x1a'),_0x196405+'-'+_0x261eb2+'/'+_0x466b44)['json'](_0x268e94);}return null;};}function patchUpdates(_0x40bbc0){return function(_0x42e20e){try{jsonpatch[_0x7dd5('0x1b')](_0x42e20e,_0x40bbc0,!![]);}catch(_0x39f199){return BPromise[_0x7dd5('0x1c')](_0x39f199);}return _0x42e20e[_0x7dd5('0x1d')]();};}function saveUpdates(_0x5611f6,_0x393876){return function(_0xf22b34){if(_0xf22b34){return _0xf22b34[_0x7dd5('0x1e')](_0x5611f6)[_0x7dd5('0x1f')](function(_0x39e6e0){return _0x39e6e0;});}return null;};}function removeEntity(_0x64f020,_0x3f6548){return function(_0x1ca653){if(_0x1ca653){return _0x1ca653[_0x7dd5('0x20')]()['then'](function(){_0x64f020['status'](0xcc)[_0x7dd5('0x21')]();});}};}function handleEntityNotFound(_0x30f976,_0x776c25){return function(_0x590769){if(!_0x590769){_0x30f976[_0x7dd5('0x22')](0x194);}return _0x590769;};}function handleError(_0x59d623,_0x4d1ea0){_0x4d1ea0=_0x4d1ea0||0x1f4;return function(_0x11eeda){logger[_0x7dd5('0x23')](_0x11eeda['stack']);if(_0x11eeda[_0x7dd5('0x24')]){delete _0x11eeda[_0x7dd5('0x24')];}_0x59d623['status'](_0x4d1ea0)[_0x7dd5('0x25')](_0x11eeda);};}exports[_0x7dd5('0x26')]=function(_0x21a4ad,_0x3a2749){var _0xbbc907={},_0xea6a9b={},_0x51f06c={'count':0x0,'rows':[]};var _0x4040fc=_[_0x7dd5('0x27')](db[_0x7dd5('0x28')][_0x7dd5('0x29')],function(_0x27165e){return{'name':_0x27165e[_0x7dd5('0x2a')],'type':_0x27165e['type'][_0x7dd5('0x2b')]};});_0xea6a9b[_0x7dd5('0x2c')]=_[_0x7dd5('0x27')](_0x4040fc,'name');_0xea6a9b[_0x7dd5('0x2d')]=_[_0x7dd5('0x2e')](_0x21a4ad['query']);_0xea6a9b[_0x7dd5('0x2f')]=_['intersection'](_0xea6a9b[_0x7dd5('0x2c')],_0xea6a9b[_0x7dd5('0x2d')]);_0xbbc907[_0x7dd5('0x30')]=_[_0x7dd5('0x31')](_0xea6a9b['model'],qs['fields'](_0x21a4ad['query'][_0x7dd5('0x32')]));_0xbbc907['attributes']=_0xbbc907[_0x7dd5('0x30')][_0x7dd5('0x33')]?_0xbbc907[_0x7dd5('0x30')]:_0xea6a9b[_0x7dd5('0x2c')];if(!_0x21a4ad['query']['hasOwnProperty'](_0x7dd5('0x34'))){_0xbbc907[_0x7dd5('0x18')]=qs[_0x7dd5('0x18')](_0x21a4ad[_0x7dd5('0x2d')][_0x7dd5('0x18')]);_0xbbc907[_0x7dd5('0x17')]=qs[_0x7dd5('0x17')](_0x21a4ad['query'][_0x7dd5('0x17')]);}_0xbbc907[_0x7dd5('0x35')]=qs[_0x7dd5('0x36')](_0x21a4ad[_0x7dd5('0x2d')][_0x7dd5('0x36')]);_0xbbc907[_0x7dd5('0x37')]=qs[_0x7dd5('0x2f')](_['pick'](_0x21a4ad[_0x7dd5('0x2d')],_0xea6a9b[_0x7dd5('0x2f')]),_0x4040fc);if(_0x21a4ad['query'][_0x7dd5('0x38')]){_0xbbc907[_0x7dd5('0x37')]=_['merge'](_0xbbc907[_0x7dd5('0x37')],{'$or':_['map'](_0x4040fc,function(_0x83d111){if(_0x83d111['type']!==_0x7dd5('0x39')){var _0x2c9c83={};_0x2c9c83[_0x83d111['name']]={'$like':'%'+_0x21a4ad[_0x7dd5('0x2d')][_0x7dd5('0x38')]+'%'};return _0x2c9c83;}})});}_0xbbc907=_[_0x7dd5('0x3a')]({},_0xbbc907,_0x21a4ad[_0x7dd5('0x3b')]);var _0x195cb7={'where':_0xbbc907[_0x7dd5('0x37')]};return db['JscriptySessionReport'][_0x7dd5('0x16')](_0x195cb7)[_0x7dd5('0x1f')](function(_0x11ece6){_0x51f06c[_0x7dd5('0x16')]=_0x11ece6;if(_0x21a4ad[_0x7dd5('0x2d')][_0x7dd5('0x3c')]){_0xbbc907[_0x7dd5('0x3d')]=[{'all':!![]}];}return db[_0x7dd5('0x28')][_0x7dd5('0x3e')](_0xbbc907);})['then'](function(_0x485bec){_0x51f06c[_0x7dd5('0x3f')]=_0x485bec;return _0x51f06c;})[_0x7dd5('0x1f')](respondWithFilteredResult(_0x3a2749,_0xbbc907))['catch'](handleError(_0x3a2749,null));};exports[_0x7dd5('0x40')]=function(_0x48a946,_0x566823){var _0x1e3139={'raw':!![],'where':{'id':_0x48a946[_0x7dd5('0x41')]['id']}},_0x329f9c={};_0x329f9c['model']=_['keys'](db[_0x7dd5('0x28')][_0x7dd5('0x29')]);_0x329f9c['query']=_[_0x7dd5('0x2e')](_0x48a946[_0x7dd5('0x2d')]);_0x329f9c[_0x7dd5('0x2f')]=_[_0x7dd5('0x31')](_0x329f9c[_0x7dd5('0x2c')],_0x329f9c[_0x7dd5('0x2d')]);_0x1e3139['attributes']=_[_0x7dd5('0x31')](_0x329f9c[_0x7dd5('0x2c')],qs['fields'](_0x48a946[_0x7dd5('0x2d')][_0x7dd5('0x32')]));_0x1e3139['attributes']=_0x1e3139['attributes'][_0x7dd5('0x33')]?_0x1e3139[_0x7dd5('0x30')]:_0x329f9c[_0x7dd5('0x2c')];if(_0x48a946[_0x7dd5('0x2d')][_0x7dd5('0x3c')]){_0x1e3139[_0x7dd5('0x3d')]=[{'all':!![]}];}_0x1e3139=_[_0x7dd5('0x3a')]({},_0x1e3139,_0x48a946[_0x7dd5('0x3b')]);return db[_0x7dd5('0x28')][_0x7dd5('0x42')](_0x1e3139)[_0x7dd5('0x1f')](handleEntityNotFound(_0x566823,null))[_0x7dd5('0x1f')](respondWithResult(_0x566823,null))['catch'](handleError(_0x566823,null));};exports['create']=function(_0x26143f,_0x294ea1){return db[_0x7dd5('0x28')][_0x7dd5('0x43')](_0x26143f[_0x7dd5('0x44')],{})[_0x7dd5('0x1f')](respondWithResult(_0x294ea1,0xc9))[_0x7dd5('0x45')](handleError(_0x294ea1,null));};exports[_0x7dd5('0x1e')]=function(_0x134866,_0x2c18e9){if(_0x134866[_0x7dd5('0x44')]['id']){delete _0x134866[_0x7dd5('0x44')]['id'];}return db['JscriptySessionReport'][_0x7dd5('0x42')]({'where':{'id':_0x134866[_0x7dd5('0x41')]['id']}})[_0x7dd5('0x1f')](handleEntityNotFound(_0x2c18e9,null))[_0x7dd5('0x1f')](saveUpdates(_0x134866[_0x7dd5('0x44')],null))[_0x7dd5('0x1f')](respondWithResult(_0x2c18e9,null))[_0x7dd5('0x45')](handleError(_0x2c18e9,null));};exports[_0x7dd5('0x20')]=function(_0x3cdc1d,_0x3ec033){return db[_0x7dd5('0x28')]['find']({'where':{'id':_0x3cdc1d[_0x7dd5('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ec033,null))[_0x7dd5('0x1f')](removeEntity(_0x3ec033,null))[_0x7dd5('0x45')](handleError(_0x3ec033,null));};exports[_0x7dd5('0x46')]=function(_0x6c90d7,_0x45fdde){return db[_0x7dd5('0x28')]['describe']()['then'](respondWithResult(_0x45fdde,null))[_0x7dd5('0x45')](handleError(_0x45fdde,null));};exports['getQuestions']=function(_0x1605f4,_0x2f0cf,_0x248386){var _0x400388={'raw':!![],'where':{}};var _0x36feba={};var _0x5d41a0={'count':0x0,'rows':[]};return db[_0x7dd5('0x28')]['findOne']({'where':{'id':_0x1605f4[_0x7dd5('0x41')]['id']}})[_0x7dd5('0x1f')](handleEntityNotFound(_0x2f0cf,null))[_0x7dd5('0x1f')](function(_0x365e61){if(_0x365e61){_0x36feba[_0x7dd5('0x2c')]=_['keys'](db[_0x7dd5('0x47')][_0x7dd5('0x29')]);_0x36feba[_0x7dd5('0x2d')]=_[_0x7dd5('0x2e')](_0x1605f4['query']);_0x36feba[_0x7dd5('0x2f')]=_['intersection'](_0x36feba[_0x7dd5('0x2c')],_0x36feba[_0x7dd5('0x2d')]);_0x400388[_0x7dd5('0x30')]=_[_0x7dd5('0x31')](_0x36feba[_0x7dd5('0x2c')],qs[_0x7dd5('0x32')](_0x1605f4[_0x7dd5('0x2d')][_0x7dd5('0x32')]));_0x400388[_0x7dd5('0x30')]=_0x400388['attributes'][_0x7dd5('0x33')]?_0x400388[_0x7dd5('0x30')]:_0x36feba[_0x7dd5('0x2c')];if(!_0x1605f4[_0x7dd5('0x2d')]['hasOwnProperty'](_0x7dd5('0x34'))){_0x400388['limit']=qs[_0x7dd5('0x18')](_0x1605f4[_0x7dd5('0x2d')]['limit']);_0x400388[_0x7dd5('0x17')]=qs[_0x7dd5('0x17')](_0x1605f4['query'][_0x7dd5('0x17')]);}_0x400388[_0x7dd5('0x35')]=qs[_0x7dd5('0x36')](_0x1605f4[_0x7dd5('0x2d')][_0x7dd5('0x36')]);_0x400388[_0x7dd5('0x37')]=qs[_0x7dd5('0x2f')](_['pick'](_0x1605f4['query'],_0x36feba[_0x7dd5('0x2f')]));_0x400388[_0x7dd5('0x37')][_0x7dd5('0x48')]=_0x365e61['id'];if(_0x1605f4['query']['filter']){_0x400388[_0x7dd5('0x37')]=_['merge'](_0x400388[_0x7dd5('0x37')],{'$or':_[_0x7dd5('0x27')](_0x400388[_0x7dd5('0x30')],function(_0x181252){var _0x393611={};_0x393611[_0x181252]={'$like':'%'+_0x1605f4['query'][_0x7dd5('0x38')]+'%'};return _0x393611;})});}_0x400388=_[_0x7dd5('0x3a')]({},_0x400388,_0x1605f4[_0x7dd5('0x3b')]);return db['JscriptyQuestionReport'][_0x7dd5('0x16')]({'where':_0x400388['where']})[_0x7dd5('0x1f')](function(_0x92e836){_0x5d41a0[_0x7dd5('0x16')]=_0x92e836;if(_0x1605f4[_0x7dd5('0x2d')][_0x7dd5('0x3c')]){_0x400388['include']=[{'all':!![]}];}return db[_0x7dd5('0x47')][_0x7dd5('0x3e')](_0x400388);})[_0x7dd5('0x1f')](function(_0x48e633){_0x5d41a0[_0x7dd5('0x3f')]=_0x48e633;return _0x5d41a0;});}})[_0x7dd5('0x1f')](respondWithFilteredResult(_0x2f0cf,_0x400388))[_0x7dd5('0x45')](handleError(_0x2f0cf,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 37747cb..56361ca 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 _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0xd2f345,_0x595854){var _0x308e74=function(_0x297b79){while(--_0x297b79){_0xd2f345['push'](_0xd2f345['shift']());}};_0x308e74(++_0x595854);}(_0x4745,0x1e7));var _0x5474=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x4745[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('JscriptySessionReport',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f4d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x17ede1,_0x2bc5cf){_0x17ede1=_0x17ede1-0x0;var _0x4c45e9=_0x0f4d[_0x17ede1];return _0x4c45e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_jscripty_sessions','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 2afd9ca..2fa9b74 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 _0x4325=['http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0xa26726,_0x866dec){var _0x113d77=function(_0xd9ed8){while(--_0xd9ed8){_0xa26726['push'](_0xa26726['shift']());}};_0x113d77(++_0x866dec);}(_0x4325,0x1da));var _0x5432=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4325[_0x2641f9];return _0x585741;};'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')]('JscriptySessionReport,\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);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1e9470,_0x41f5d8){var _0x3beff1=function(_0x162614){while(--_0x162614){_0x1e9470['push'](_0x1e9470['shift']());}};_0x3beff1(++_0x41f5d8);}(_0x0295,0x1f0));var _0x5029=function(_0x5d7747,_0x55c074){_0x5d7747=_0x5d7747-0x0;var _0x291142=_0x0295[_0x5d7747];return _0x291142;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5d7149e..a2f4fb1 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 _0x4d92=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put','/:id','update','get','/download_log_file','isAuthenticated','downloadLogFile','exports','util','connect-timeout'];(function(_0x2f5e13,_0xc51a47){var _0x3072a3=function(_0x338a31){while(--_0x338a31){_0x2f5e13['push'](_0x2f5e13['shift']());}};_0x3072a3(++_0xc51a47);}(_0x4d92,0x1eb));var _0x24d9=function(_0x5de8bf,_0x24e115){_0x5de8bf=_0x5de8bf-0x0;var _0x2be3e3=_0x4d92[_0x5de8bf];return _0x2be3e3;};'use strict';var multer=require('multer');var util=require(_0x24d9('0x0'));var path=require('path');var timeout=require(_0x24d9('0x1'));var express=require(_0x24d9('0x2'));var router=express[_0x24d9('0x3')]();var fs_extra=require(_0x24d9('0x4'));var auth=require(_0x24d9('0x5'));var interaction=require(_0x24d9('0x6'));var config=require(_0x24d9('0x7'));var controller=require(_0x24d9('0x8'));router['get']('/',controller['index']);router[_0x24d9('0x9')](_0x24d9('0xa'),auth['isAuthenticated'](),controller[_0x24d9('0xb')]);router[_0x24d9('0xc')](_0x24d9('0xd'),auth[_0x24d9('0xe')](),controller[_0x24d9('0xf')]);module[_0x24d9('0x10')]=router; \ No newline at end of file +var _0xb751=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','/:id','update','get','/download_log_file','exports','multer','util','path','connect-timeout'];(function(_0x18ac3f,_0x386630){var _0x4c6563=function(_0xcc161f){while(--_0xcc161f){_0x18ac3f['push'](_0x18ac3f['shift']());}};_0x4c6563(++_0x386630);}(_0xb751,0x9c));var _0x1b75=function(_0x322dc5,_0x49846c){_0x322dc5=_0x322dc5-0x0;var _0x2921f4=_0xb751[_0x322dc5];return _0x2921f4;};'use strict';var multer=require(_0x1b75('0x0'));var util=require(_0x1b75('0x1'));var path=require(_0x1b75('0x2'));var timeout=require(_0x1b75('0x3'));var express=require(_0x1b75('0x4'));var router=express['Router']();var fs_extra=require(_0x1b75('0x5'));var auth=require(_0x1b75('0x6'));var interaction=require(_0x1b75('0x7'));var config=require(_0x1b75('0x8'));var controller=require(_0x1b75('0x9'));router['get']('/',controller[_0x1b75('0xa')]);router['put'](_0x1b75('0xb'),auth['isAuthenticated'](),controller[_0x1b75('0xc')]);router[_0x1b75('0xd')](_0x1b75('0xe'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x1b75('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 7564183..65c942b 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 _0x20be=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x20be,0x8f));var _0xe20b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x20be[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xe20b('0x0'));module[_0xe20b('0x1')]={'license':{'type':Sequelize[_0xe20b('0x2')]},'data1':{'type':Sequelize[_0xe20b('0x3')]},'data2':{'type':Sequelize[_0xe20b('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xe20b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x619e=['TEXT','STRING','INTEGER','exports'];(function(_0x39eee7,_0x1f4cb7){var _0xfabfed=function(_0x3fee30){while(--_0x3fee30){_0x39eee7['push'](_0x39eee7['shift']());}};_0xfabfed(++_0x1f4cb7);}(_0x619e,0x163));var _0xe619=function(_0x17dab8,_0x19d0ec){_0x17dab8=_0x17dab8-0x0;var _0x336fb5=_0x619e[_0x17dab8];return _0x336fb5;};'use strict';var Sequelize=require('sequelize');module[_0xe619('0x0')]={'license':{'type':Sequelize[_0xe619('0x1')]},'data1':{'type':Sequelize[_0xe619('0x2')]},'data2':{'type':Sequelize[_0xe619('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe619('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 91461e6..ee7efb8 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 _0xf2b8=['License','find','get','body','key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','model','keys','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf2b8,0x1f2));var _0x8f2b=function(_0x822fb9,_0x3fc565){_0x822fb9=_0x822fb9-0x0;var _0x13f715=_0xf2b8[_0x822fb9];return _0x13f715;};'use strict';var emlformat=require(_0x8f2b('0x0'));var rimraf=require(_0x8f2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f2b('0x2'));var rp=require(_0x8f2b('0x3'));var moment=require('moment');var BPromise=require(_0x8f2b('0x4'));var Mustache=require(_0x8f2b('0x5'));var util=require(_0x8f2b('0x6'));var path=require('path');var sox=require(_0x8f2b('0x7'));var csv=require(_0x8f2b('0x8'));var ejs=require(_0x8f2b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f2b('0xa'));var squel=require(_0x8f2b('0xb'));var crypto=require(_0x8f2b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8f2b('0x8'));var querystring=require(_0x8f2b('0xd'));var Papa=require(_0x8f2b('0xe'));var Redis=require(_0x8f2b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8f2b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f2b('0x11'));var logger=require(_0x8f2b('0x12'))(_0x8f2b('0x13'));var utils=require(_0x8f2b('0x14'));var config=require(_0x8f2b('0x15'));var licenseUtil=require(_0x8f2b('0x16'));var db=require(_0x8f2b('0x17'))['db'];function respondWithStatusCode(_0x13ec7f,_0x3340ac){_0x3340ac=_0x3340ac||0xcc;return function(_0x2d6843){if(_0x2d6843){return _0x13ec7f[_0x8f2b('0x18')](_0x3340ac);}return _0x13ec7f[_0x8f2b('0x19')](_0x3340ac)[_0x8f2b('0x1a')]();};}function respondWithResult(_0x4e897f,_0x5cb97f){_0x5cb97f=_0x5cb97f||0xc8;return function(_0x1a4cca){if(_0x1a4cca){return _0x4e897f[_0x8f2b('0x19')](_0x5cb97f)[_0x8f2b('0x1b')](_0x1a4cca);}};}function respondWithFilteredResult(_0x397f01,_0x2ecceb){return function(_0x4358fe){if(_0x4358fe){var _0x4a33ca=typeof _0x2ecceb[_0x8f2b('0x1c')]==='undefined'&&typeof _0x2ecceb[_0x8f2b('0x1d')]===_0x8f2b('0x1e');var _0x2363bb=_0x4358fe['count'];var _0x3dd63a=_0x4a33ca?0x0:_0x2ecceb[_0x8f2b('0x1c')];var _0x53cd19=_0x4a33ca?_0x4358fe['count']:_0x2ecceb['offset']+_0x2ecceb[_0x8f2b('0x1d')];var _0x1c98e1;if(_0x53cd19>=_0x2363bb){_0x53cd19=_0x2363bb;_0x1c98e1=0xc8;}else{_0x1c98e1=0xce;}_0x397f01[_0x8f2b('0x19')](_0x1c98e1);return _0x397f01[_0x8f2b('0x1f')](_0x8f2b('0x20'),_0x3dd63a+'-'+_0x53cd19+'/'+_0x2363bb)['json'](_0x4358fe);}return null;};}function patchUpdates(_0x14fa30){return function(_0x1f0239){try{jsonpatch[_0x8f2b('0x21')](_0x1f0239,_0x14fa30,!![]);}catch(_0x2e5fd0){return BPromise['reject'](_0x2e5fd0);}return _0x1f0239[_0x8f2b('0x22')]();};}function saveUpdates(_0x8849ce,_0x411616){return function(_0x57c239){if(_0x57c239){return _0x57c239[_0x8f2b('0x23')](_0x8849ce)['then'](function(_0x984892){return _0x984892;});}return null;};}function removeEntity(_0x55eba4,_0x50100b){return function(_0x5bf2a5){if(_0x5bf2a5){return _0x5bf2a5[_0x8f2b('0x24')]()[_0x8f2b('0x25')](function(){_0x55eba4[_0x8f2b('0x19')](0xcc)[_0x8f2b('0x1a')]();});}};}function handleEntityNotFound(_0x39f513,_0x12b042){return function(_0x25bf00){if(!_0x25bf00){_0x39f513['sendStatus'](0x194);}return _0x25bf00;};}function handleError(_0x1d5aa3,_0x54cf2f){_0x54cf2f=_0x54cf2f||0x1f4;return function(_0x5982dd){logger[_0x8f2b('0x26')](_0x5982dd['stack']);if(_0x5982dd[_0x8f2b('0x27')]){delete _0x5982dd[_0x8f2b('0x27')];}_0x1d5aa3[_0x8f2b('0x19')](_0x54cf2f)[_0x8f2b('0x28')](_0x5982dd);};}var utilLicense=require(_0x8f2b('0x16'));exports[_0x8f2b('0x29')]=function(_0x2d4504,_0xbe26ab){var _0x4e41fb={'raw':!![],'where':{'id':0x1}},_0x476d5e={};_0x476d5e[_0x8f2b('0x2a')]=_[_0x8f2b('0x2b')](db['License']['rawAttributes']);_0x476d5e[_0x8f2b('0x2c')]=_[_0x8f2b('0x2b')](_0x2d4504[_0x8f2b('0x2c')]);_0x476d5e[_0x8f2b('0x2d')]=_[_0x8f2b('0x2e')](_0x476d5e[_0x8f2b('0x2a')],_0x476d5e['query']);_0x4e41fb[_0x8f2b('0x2f')]=_[_0x8f2b('0x2e')](_0x476d5e['model'],qs[_0x8f2b('0x30')](_0x2d4504['query'][_0x8f2b('0x30')]));_0x4e41fb[_0x8f2b('0x2f')]=_0x4e41fb[_0x8f2b('0x2f')][_0x8f2b('0x31')]?_0x4e41fb[_0x8f2b('0x2f')]:_0x476d5e[_0x8f2b('0x2a')];_0x4e41fb=_[_0x8f2b('0x32')]({},_0x4e41fb,_0x2d4504[_0x8f2b('0x33')]);return utilLicense[_0x8f2b('0x34')](_0x4e41fb)[_0x8f2b('0x25')](respondWithResult(_0xbe26ab,null))[_0x8f2b('0x35')](handleError(_0xbe26ab,null));};exports[_0x8f2b('0x23')]=function(_0x399439,_0x3bccd7){if(_0x399439['body']['id']){delete _0x399439['body']['id'];}return db[_0x8f2b('0x36')][_0x8f2b('0x37')]({'where':{'id':_0x399439['params']['id']}})[_0x8f2b('0x25')](handleEntityNotFound(_0x3bccd7,null))[_0x8f2b('0x25')](function(_0x189fcf){var _0x3faf58=_0x189fcf[_0x8f2b('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x3faf58,_0x399439[_0x8f2b('0x39')][_0x8f2b('0x3a')]);})[_0x8f2b('0x25')](function(_0x3898da){if(!_0x3898da[_0x8f2b('0x3b')]){return saveUpdates(_0x399439[_0x8f2b('0x39')],null);}return _0x3898da;})[_0x8f2b('0x25')](respondWithResult(_0x3bccd7,null))[_0x8f2b('0x35')](handleError(_0x3bccd7,null));};exports[_0x8f2b('0x3c')]=function(_0x4462b8,_0x53e3e5){var _0x2a55cf=_0x8f2b('0x3d');var _0x1e4019=path[_0x8f2b('0x3e')](_0x8f2b('0x3f'),'log',_0x8f2b('0x40'),_0x2a55cf);_0x53e3e5[_0x8f2b('0x41')]('Content-disposition','attachment;\x20filename='+_0x2a55cf);_0x53e3e5[_0x8f2b('0x1f')](_0x8f2b('0x42'),_0x8f2b('0x43'));_0x53e3e5[_0x8f2b('0x44')](_0x1e4019);}; \ No newline at end of file +var _0x8682=['name','send','index','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','merge','options','catch','body','find','params','get','checkLicense','key','demo','log','xcally','attachment;\x20filename=','Content-Type','text/plain','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','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','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x8682,0x1dc));var _0x2868=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8682[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2868('0x0'));var jsonpatch=require(_0x2868('0x1'));var rp=require(_0x2868('0x2'));var moment=require(_0x2868('0x3'));var BPromise=require(_0x2868('0x4'));var Mustache=require('mustache');var util=require(_0x2868('0x5'));var path=require(_0x2868('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2868('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2868('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2868('0x9'));var deskjs=require(_0x2868('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2868('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2868('0xc'));var qs=require(_0x2868('0xd'));var as=require(_0x2868('0xe'));var hardwareService=require(_0x2868('0xf'));var logger=require(_0x2868('0x10'))('api');var utils=require(_0x2868('0x11'));var config=require(_0x2868('0x12'));var licenseUtil=require(_0x2868('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29c69d,_0x59c8a5){_0x59c8a5=_0x59c8a5||0xcc;return function(_0x7c2fd0){if(_0x7c2fd0){return _0x29c69d['sendStatus'](_0x59c8a5);}return _0x29c69d[_0x2868('0x14')](_0x59c8a5)[_0x2868('0x15')]();};}function respondWithResult(_0x169411,_0x2b0d99){_0x2b0d99=_0x2b0d99||0xc8;return function(_0x2142f7){if(_0x2142f7){return _0x169411['status'](_0x2b0d99)[_0x2868('0x16')](_0x2142f7);}};}function respondWithFilteredResult(_0x13d58c,_0x378623){return function(_0x2b8424){if(_0x2b8424){var _0x4944d3=typeof _0x378623[_0x2868('0x17')]===_0x2868('0x18')&&typeof _0x378623['limit']===_0x2868('0x18');var _0x25d5f1=_0x2b8424['count'];var _0xe1bb6f=_0x4944d3?0x0:_0x378623[_0x2868('0x17')];var _0x26104a=_0x4944d3?_0x2b8424[_0x2868('0x19')]:_0x378623[_0x2868('0x17')]+_0x378623[_0x2868('0x1a')];var _0x5a9e95;if(_0x26104a>=_0x25d5f1){_0x26104a=_0x25d5f1;_0x5a9e95=0xc8;}else{_0x5a9e95=0xce;}_0x13d58c[_0x2868('0x14')](_0x5a9e95);return _0x13d58c[_0x2868('0x1b')]('Content-Range',_0xe1bb6f+'-'+_0x26104a+'/'+_0x25d5f1)['json'](_0x2b8424);}return null;};}function patchUpdates(_0x50bde7){return function(_0x1dbed9){try{jsonpatch[_0x2868('0x1c')](_0x1dbed9,_0x50bde7,!![]);}catch(_0x4ec44a){return BPromise[_0x2868('0x1d')](_0x4ec44a);}return _0x1dbed9['save']();};}function saveUpdates(_0x3dad87,_0x19ac95){return function(_0x1dc636){if(_0x1dc636){return _0x1dc636[_0x2868('0x1e')](_0x3dad87)[_0x2868('0x1f')](function(_0x2c5176){return _0x2c5176;});}return null;};}function removeEntity(_0x1a1069,_0x4d2991){return function(_0x279363){if(_0x279363){return _0x279363[_0x2868('0x20')]()[_0x2868('0x1f')](function(){_0x1a1069[_0x2868('0x14')](0xcc)[_0x2868('0x15')]();});}};}function handleEntityNotFound(_0x1daad7,_0x3d3aa3){return function(_0x41ea90){if(!_0x41ea90){_0x1daad7[_0x2868('0x21')](0x194);}return _0x41ea90;};}function handleError(_0x53d291,_0x286552){_0x286552=_0x286552||0x1f4;return function(_0x57aa56){logger[_0x2868('0x22')](_0x57aa56[_0x2868('0x23')]);if(_0x57aa56[_0x2868('0x24')]){delete _0x57aa56[_0x2868('0x24')];}_0x53d291[_0x2868('0x14')](_0x286552)[_0x2868('0x25')](_0x57aa56);};}var utilLicense=require(_0x2868('0x13'));exports[_0x2868('0x26')]=function(_0x47ee21,_0x2a7170){var _0x33f0d0={'raw':!![],'where':{'id':0x1}},_0x25f5bf={};_0x25f5bf['model']=_['keys'](db['License'][_0x2868('0x27')]);_0x25f5bf[_0x2868('0x28')]=_[_0x2868('0x29')](_0x47ee21[_0x2868('0x28')]);_0x25f5bf[_0x2868('0x2a')]=_[_0x2868('0x2b')](_0x25f5bf[_0x2868('0x2c')],_0x25f5bf[_0x2868('0x28')]);_0x33f0d0[_0x2868('0x2d')]=_['intersection'](_0x25f5bf[_0x2868('0x2c')],qs['fields'](_0x47ee21['query'][_0x2868('0x2e')]));_0x33f0d0[_0x2868('0x2d')]=_0x33f0d0[_0x2868('0x2d')][_0x2868('0x2f')]?_0x33f0d0['attributes']:_0x25f5bf[_0x2868('0x2c')];_0x33f0d0=_[_0x2868('0x30')]({},_0x33f0d0,_0x47ee21[_0x2868('0x31')]);return utilLicense['getLicense'](_0x33f0d0)[_0x2868('0x1f')](respondWithResult(_0x2a7170,null))[_0x2868('0x32')](handleError(_0x2a7170,null));};exports[_0x2868('0x1e')]=function(_0x46823a,_0x1e7ee8){if(_0x46823a[_0x2868('0x33')]['id']){delete _0x46823a[_0x2868('0x33')]['id'];}return db['License'][_0x2868('0x34')]({'where':{'id':_0x46823a[_0x2868('0x35')]['id']}})['then'](handleEntityNotFound(_0x1e7ee8,null))[_0x2868('0x1f')](function(_0xc865da){var _0x5386b1=_0xc865da[_0x2868('0x36')]({'plain':!![]});return utilLicense[_0x2868('0x37')](_0x5386b1,_0x46823a[_0x2868('0x33')][_0x2868('0x38')]);})[_0x2868('0x1f')](function(_0x14a17f){if(!_0x14a17f[_0x2868('0x39')]){return saveUpdates(_0x46823a[_0x2868('0x33')],null);}return _0x14a17f;})[_0x2868('0x1f')](respondWithResult(_0x1e7ee8,null))[_0x2868('0x32')](handleError(_0x1e7ee8,null));};exports['downloadLogFile']=function(_0x2ff526,_0x53c266){var _0x8d2f2f='license-info.log';var _0x5d11c3=path['join']('/var',_0x2868('0x3a'),_0x2868('0x3b'),_0x8d2f2f);_0x53c266['setHeader']('Content-disposition',_0x2868('0x3c')+_0x8d2f2f);_0x53c266['set'](_0x2868('0x3d'),_0x2868('0x3e'));_0x53c266[_0x2868('0x3f')](_0x5d11c3);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 73fc6b3..5b838bf 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 _0x072c=['util','../../config/logger','api','moment','path','rimraf','exports','define','License','license','lodash'];(function(_0x43986b,_0x30ac18){var _0x5da67f=function(_0x4949ca){while(--_0x4949ca){_0x43986b['push'](_0x43986b['shift']());}};_0x5da67f(++_0x30ac18);}(_0x072c,0x18b));var _0xc072=function(_0x4cb01a,_0xe444be){_0x4cb01a=_0x4cb01a-0x0;var _0x102f6c=_0x072c[_0x4cb01a];return _0x102f6c;};'use strict';var _=require(_0xc072('0x0'));var util=require(_0xc072('0x1'));var logger=require(_0xc072('0x2'))(_0xc072('0x3'));var moment=require(_0xc072('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc072('0x5'));var rimraf=require(_0xc072('0x6'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0xc072('0x7')]=function(_0xe0fe1d,_0x1d385e){return _0xe0fe1d[_0xc072('0x8')](_0xc072('0x9'),attributes,{'tableName':_0xc072('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x312c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','license','lodash'];(function(_0x2f21da,_0x1f2993){var _0x6fb44d=function(_0x54254d){while(--_0x54254d){_0x2f21da['push'](_0x2f21da['shift']());}};_0x6fb44d(++_0x1f2993);}(_0x312c,0xe0));var _0xc312=function(_0xde6aac,_0x590ed9){_0xde6aac=_0xde6aac-0x0;var _0x5a71a1=_0x312c[_0xde6aac];return _0x5a71a1;};'use strict';var _=require(_0xc312('0x0'));var util=require('util');var logger=require(_0xc312('0x1'))(_0xc312('0x2'));var moment=require(_0xc312('0x3'));var BPromise=require(_0xc312('0x4'));var rp=require(_0xc312('0x5'));var fs=require('fs');var path=require(_0xc312('0x6'));var rimraf=require(_0xc312('0x7'));var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x541e5d,_0x2f8226){return _0x541e5d['define']('License',attributes,{'tableName':_0xc312('0x8'),'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 94a6480..a555acd 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 _0x8a9b=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3b8d57,_0x23d21f){var _0x43a2ef=function(_0x3714e5){while(--_0x3714e5){_0x3b8d57['push'](_0x3b8d57['shift']());}};_0x43a2ef(++_0x23d21f);}(_0x8a9b,0x17e));var _0xb8a9=function(_0x1bedb3,_0xaf2b8d){_0x1bedb3=_0x1bedb3-0x0;var _0x64bc19=_0x8a9b[_0x1bedb3];return _0x64bc19;};'use strict';var _=require('lodash');var util=require(_0xb8a9('0x0'));var moment=require(_0xb8a9('0x1'));var BPromise=require(_0xb8a9('0x2'));var rs=require(_0xb8a9('0x3'));var fs=require('fs');var Redis=require(_0xb8a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8a9('0x5'));var logger=require(_0xb8a9('0x6'))('rpc');var config=require(_0xb8a9('0x7'));var jayson=require(_0xb8a9('0x8'));var client=jayson[_0xb8a9('0x9')][_0xb8a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5022e1,_0x44fc9c,_0x3a5216){return new BPromise(function(_0xd03148,_0x410903){return client[_0xb8a9('0xb')](_0x5022e1,_0x3a5216)[_0xb8a9('0xc')](function(_0x48c34b){logger[_0xb8a9('0xd')]('License,\x20%s,\x20%s',_0x44fc9c,_0xb8a9('0xe'));logger[_0xb8a9('0xf')](_0xb8a9('0x10'),_0x44fc9c,_0xb8a9('0xe'),JSON['stringify'](_0x48c34b));if(_0x48c34b[_0xb8a9('0x11')]){if(_0x48c34b[_0xb8a9('0x11')][_0xb8a9('0x12')]===0x1f4){logger[_0xb8a9('0x11')](_0xb8a9('0x13'),_0x44fc9c,_0x48c34b[_0xb8a9('0x11')]['message']);return _0x410903(_0x48c34b[_0xb8a9('0x11')][_0xb8a9('0x14')]);}logger[_0xb8a9('0x11')](_0xb8a9('0x13'),_0x44fc9c,_0x48c34b[_0xb8a9('0x11')]['message']);return _0xd03148(_0x48c34b['error'][_0xb8a9('0x14')]);}else{logger[_0xb8a9('0xd')](_0xb8a9('0x13'),_0x44fc9c,_0xb8a9('0xe'));_0xd03148(_0x48c34b[_0xb8a9('0x15')]['message']);}})['catch'](function(_0x38debf){logger[_0xb8a9('0x11')](_0xb8a9('0x13'),_0x44fc9c,_0x38debf);_0x410903(_0x38debf);});});} \ No newline at end of file +var _0x4a85=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util'];(function(_0x5443c6,_0x544e39){var _0x2a0bab=function(_0x509dbe){while(--_0x509dbe){_0x5443c6['push'](_0x5443c6['shift']());}};_0x2a0bab(++_0x544e39);}(_0x4a85,0xcd));var _0x54a8=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4a85[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x54a8('0x0'));var util=require(_0x54a8('0x1'));var moment=require(_0x54a8('0x2'));var BPromise=require(_0x54a8('0x3'));var rs=require(_0x54a8('0x4'));var fs=require('fs');var Redis=require(_0x54a8('0x5'));var db=require(_0x54a8('0x6'))['db'];var utils=require(_0x54a8('0x7'));var logger=require(_0x54a8('0x8'))(_0x54a8('0x9'));var config=require(_0x54a8('0xa'));var jayson=require(_0x54a8('0xb'));var client=jayson[_0x54a8('0xc')][_0x54a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x22ffe4,_0x135be1,_0x52ab13){return new BPromise(function(_0x11a61c,_0x6445ba){return client['request'](_0x22ffe4,_0x52ab13)[_0x54a8('0xe')](function(_0x421775){logger[_0x54a8('0xf')](_0x54a8('0x10'),_0x135be1,'request\x20sent');logger[_0x54a8('0x11')](_0x54a8('0x12'),_0x135be1,_0x54a8('0x13'),JSON['stringify'](_0x421775));if(_0x421775[_0x54a8('0x14')]){if(_0x421775['error']['code']===0x1f4){logger[_0x54a8('0x14')](_0x54a8('0x10'),_0x135be1,_0x421775[_0x54a8('0x14')][_0x54a8('0x15')]);return _0x6445ba(_0x421775['error'][_0x54a8('0x15')]);}logger[_0x54a8('0x14')](_0x54a8('0x10'),_0x135be1,_0x421775['error'][_0x54a8('0x15')]);return _0x11a61c(_0x421775[_0x54a8('0x14')][_0x54a8('0x15')]);}else{logger[_0x54a8('0xf')](_0x54a8('0x10'),_0x135be1,_0x54a8('0x13'));_0x11a61c(_0x421775[_0x54a8('0x16')][_0x54a8('0x15')]);}})['catch'](function(_0x17b144){logger[_0x54a8('0x14')](_0x54a8('0x10'),_0x135be1,_0x17b144);_0x6445ba(_0x17b144);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6469d62..ebc1326 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 _0xcaa7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports'];(function(_0x2a190f,_0x301e4b){var _0x427d0c=function(_0x4a4c6f){while(--_0x4a4c6f){_0x2a190f['push'](_0x2a190f['shift']());}};_0x427d0c(++_0x301e4b);}(_0xcaa7,0xc4));var _0x7caa=function(_0x5c1834,_0x3a0961){_0x5c1834=_0x5c1834-0x0;var _0x21294c=_0xcaa7[_0x5c1834];return _0x21294c;};'use strict';var multer=require(_0x7caa('0x0'));var util=require(_0x7caa('0x1'));var path=require(_0x7caa('0x2'));var timeout=require(_0x7caa('0x3'));var express=require(_0x7caa('0x4'));var router=express[_0x7caa('0x5')]();var fs_extra=require(_0x7caa('0x6'));var auth=require(_0x7caa('0x7'));var interaction=require(_0x7caa('0x8'));var config=require(_0x7caa('0x9'));var controller=require(_0x7caa('0xa'));router[_0x7caa('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7caa('0xb')](_0x7caa('0xc'),auth[_0x7caa('0xd')](),controller[_0x7caa('0xe')]);router['get'](_0x7caa('0xf'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x10')]);router[_0x7caa('0xb')](_0x7caa('0x11'),auth[_0x7caa('0xd')](),controller['getDispositions']);router[_0x7caa('0xb')](_0x7caa('0x12'),auth['isAuthenticated'](),controller[_0x7caa('0x13')]);router[_0x7caa('0xb')](_0x7caa('0x14'),auth['isAuthenticated'](),controller[_0x7caa('0x15')]);router[_0x7caa('0xb')](_0x7caa('0x16'),auth['isAuthenticated'](),controller[_0x7caa('0x17')]);router[_0x7caa('0xb')]('/:id/interactions',auth[_0x7caa('0xd')](),controller[_0x7caa('0x18')]);router[_0x7caa('0xb')](_0x7caa('0x19'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x1a')]);router['get']('/:id/messages',auth[_0x7caa('0xd')](),controller[_0x7caa('0x1b')]);router[_0x7caa('0xb')](_0x7caa('0x1c'),auth['isAuthenticated'](),controller[_0x7caa('0x1d')]);router[_0x7caa('0xb')](_0x7caa('0x1e'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x1f')]);router[_0x7caa('0x20')](_0x7caa('0x11'),auth[_0x7caa('0xd')](),controller['addDisposition']);router[_0x7caa('0x20')]('/:id/canned_answers',auth[_0x7caa('0xd')](),controller['addAnswer']);router[_0x7caa('0x20')]('/',auth[_0x7caa('0xd')](),controller[_0x7caa('0x21')]);router[_0x7caa('0x20')]('/:id/in_servers',auth[_0x7caa('0xd')](),controller[_0x7caa('0x22')]);router['post'](_0x7caa('0x16'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x23')]);router[_0x7caa('0x20')](_0x7caa('0x24'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x25')]);router['post']('/:id/applications',auth[_0x7caa('0xd')](),controller[_0x7caa('0x26')]);router[_0x7caa('0x20')](_0x7caa('0x27'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x28')]);router[_0x7caa('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0x7caa('0x29')]);router[_0x7caa('0x2a')](_0x7caa('0xf'),auth[_0x7caa('0xd')](),controller['update']);router[_0x7caa('0x2b')]('/:id/dispositions',auth[_0x7caa('0xd')](),controller['removeDispositions']);router[_0x7caa('0x2b')]('/:id/canned_answers',auth[_0x7caa('0xd')](),controller[_0x7caa('0x2c')]);router[_0x7caa('0x2b')](_0x7caa('0x14'),auth[_0x7caa('0xd')](),controller['removeImap']);router[_0x7caa('0x2b')](_0x7caa('0x16'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x2d')]);router[_0x7caa('0x2b')](_0x7caa('0xf'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x2e')]);router[_0x7caa('0x2b')](_0x7caa('0x1e'),auth[_0x7caa('0xd')](),controller[_0x7caa('0x2f')]);module[_0x7caa('0x30')]=router; \ No newline at end of file +var _0x0f1f=['send','put','removeAnswers','delete','removeSmtp','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send'];(function(_0x5a0dac,_0x30edd8){var _0xe0eaac=function(_0x5de0d5){while(--_0x5de0d5){_0x5a0dac['push'](_0x5a0dac['shift']());}};_0xe0eaac(++_0x30edd8);}(_0x0f1f,0x1df));var _0xf0f1=function(_0x481892,_0x347870){_0x481892=_0x481892-0x0;var _0x18f31f=_0x0f1f[_0x481892];return _0x18f31f;};'use strict';var multer=require('multer');var util=require(_0xf0f1('0x0'));var path=require(_0xf0f1('0x1'));var timeout=require(_0xf0f1('0x2'));var express=require(_0xf0f1('0x3'));var router=express[_0xf0f1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf0f1('0x5'));var config=require('../../config/environment');var controller=require(_0xf0f1('0x6'));router[_0xf0f1('0x7')]('/',auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x9')]);router['get'](_0xf0f1('0xa'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0xb')]);router[_0xf0f1('0x7')](_0xf0f1('0xc'),auth[_0xf0f1('0x8')](),controller['show']);router[_0xf0f1('0x7')](_0xf0f1('0xd'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0xe')]);router[_0xf0f1('0x7')](_0xf0f1('0xf'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x10')]);router[_0xf0f1('0x7')](_0xf0f1('0x11'),auth['isAuthenticated'](),controller[_0xf0f1('0x12')]);router['get'](_0xf0f1('0x13'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x14')]);router['get'](_0xf0f1('0x15'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x16')]);router[_0xf0f1('0x7')]('/:id/applications',auth[_0xf0f1('0x8')](),controller['getApplications']);router[_0xf0f1('0x7')](_0xf0f1('0x17'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xf0f1('0x18'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x19')]);router[_0xf0f1('0x7')](_0xf0f1('0x1a'),auth['isAuthenticated'](),controller[_0xf0f1('0x1b')]);router[_0xf0f1('0x1c')](_0xf0f1('0xd'),auth['isAuthenticated'](),controller[_0xf0f1('0x1d')]);router[_0xf0f1('0x1c')](_0xf0f1('0xf'),auth['isAuthenticated'](),controller[_0xf0f1('0x1e')]);router[_0xf0f1('0x1c')]('/',auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x1f')]);router[_0xf0f1('0x1c')](_0xf0f1('0x11'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x20')]);router[_0xf0f1('0x1c')](_0xf0f1('0x13'),auth[_0xf0f1('0x8')](),controller['addSmtp']);router[_0xf0f1('0x1c')](_0xf0f1('0x15'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x21')]);router[_0xf0f1('0x1c')](_0xf0f1('0x22'),auth['isAuthenticated'](),controller[_0xf0f1('0x23')]);router[_0xf0f1('0x1c')](_0xf0f1('0x24'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x25')]);router[_0xf0f1('0x1c')](_0xf0f1('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf0f1('0x26')](_0xf0f1('0xc'),auth[_0xf0f1('0x8')](),controller['update']);router['delete'](_0xf0f1('0xd'),auth[_0xf0f1('0x8')](),controller['removeDispositions']);router['delete'](_0xf0f1('0xf'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x27')]);router[_0xf0f1('0x28')](_0xf0f1('0x11'),auth[_0xf0f1('0x8')](),controller['removeImap']);router['delete'](_0xf0f1('0x13'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x29')]);router[_0xf0f1('0x28')](_0xf0f1('0xc'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x2a')]);router[_0xf0f1('0x28')]('/:id/users',auth[_0xf0f1('0x8')](),controller['removeAgents']);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 f59a781..771297e 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 _0x8f38=['INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x4d2a96,_0x17e3ca){var _0x3dcb7c=function(_0x157956){while(--_0x157956){_0x4d2a96['push'](_0x4d2a96['shift']());}};_0x3dcb7c(++_0x17e3ca);}(_0x8f38,0x10c));var _0x88f3=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x8f38[_0x10b48a];return _0x2c4533;};'use strict';var Sequelize=require(_0x88f3('0x0'));module['exports']={'description':{'type':Sequelize[_0x88f3('0x1')]},'name':{'type':Sequelize[_0x88f3('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x88f3('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x88f3('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x88f3('0x3')]},'markAsUnread':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x88f3('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x88f3('0x3')],'defaultValue':function(){return _0x88f3('0x5');}},'notificationSound':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x88f3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x88f3('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x88f3('0x2')],'defaultValue':![],'comment':_0x88f3('0x6'),'set':function(_0x24db75){if(!_0x24db75)this[_0x88f3('0x7')]('mandatoryDispositionPauseId',null);this[_0x88f3('0x7')](_0x88f3('0x8'),_0x24db75);}},'provider':{'type':Sequelize['ENUM'](_0x88f3('0x9'),_0x88f3('0xa'),_0x88f3('0xb'),_0x88f3('0xc')),'defaultValue':null,'get':function(){if(!this[_0x88f3('0xd')](_0x88f3('0xe')))return _0x88f3('0xf');return this[_0x88f3('0xd')](_0x88f3('0xe'));},'set':function(_0x12b7d6){if(_0x12b7d6==='custom')_0x12b7d6=null;return this[_0x88f3('0x7')](_0x88f3('0xe'),_0x12b7d6);}}}; \ No newline at end of file +var _0xdc9e=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x10f80a,_0x3fca40){var _0x13d794=function(_0x4e6ca4){while(--_0x4e6ca4){_0x10f80a['push'](_0x10f80a['shift']());}};_0x13d794(++_0x3fca40);}(_0xdc9e,0xdf));var _0xedc9=function(_0xa363e5,_0x14c9ed){_0xa363e5=_0xa363e5-0x0;var _0x4c38a3=_0xdc9e[_0xa363e5];return _0x4c38a3;};'use strict';var Sequelize=require(_0xedc9('0x0'));module[_0xedc9('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xedc9('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0xedc9('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xedc9('0x3')],'allowNull':![],'defaultValue':_0xedc9('0x5')},'fontSize':{'type':Sequelize[_0xedc9('0x6')](0x2)[_0xedc9('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xedc9('0x4')],'defaultValue':function(){return _0xedc9('0x8');}},'notificationSound':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xedc9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xedc9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xedc9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xedc9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xedc9('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x207bf5){if(!_0x207bf5)this[_0xedc9('0xa')](_0xedc9('0xb'),null);this[_0xedc9('0xa')](_0xedc9('0xc'),_0x207bf5);}},'provider':{'type':Sequelize[_0xedc9('0xd')](_0xedc9('0xe'),_0xedc9('0xf'),_0xedc9('0x10'),_0xedc9('0x11')),'defaultValue':null,'get':function(){if(!this[_0xedc9('0x12')](_0xedc9('0x13')))return _0xedc9('0x14');return this[_0xedc9('0x12')]('provider');},'set':function(_0x3a2222){if(_0x3a2222===_0xedc9('0x14'))_0x3a2222=null;return this[_0xedc9('0xa')]('provider',_0x3a2222);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 6775d7b..6eb73b9 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 _0x432a=['You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','./mailAccount.socket','jayson/promise','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','index','MailServerIn','Pause','map','MailAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','MailServerOut','Smtp','mandatoryDispositionPause','rawAttributes','includeAll','body','provider','find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','pick','removeDispositions','addAnswer','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','custom','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','ids','MailInteraction','CmContact','User','Owner','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','MailApplication','priority','finally','getApplications','getMessages','MailMessage','$gte','format','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','email','attachments','join','root','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize'];(function(_0x1b506e,_0x1f9720){var _0x391a5e=function(_0x376f6b){while(--_0x376f6b){_0x1b506e['push'](_0x1b506e['shift']());}};_0x391a5e(++_0x1f9720);}(_0x432a,0x18f));var _0xa432=function(_0x48040f,_0x364690){_0x48040f=_0x48040f-0x0;var _0x5dfad0=_0x432a[_0x48040f];return _0x5dfad0;};'use strict';var moment=require(_0xa432('0x0'));var BPromise=require(_0xa432('0x1'));var util=require(_0xa432('0x2'));var path=require(_0xa432('0x3'));var _=require(_0xa432('0x4'));var juice=require(_0xa432('0x5'));var Redis=require(_0xa432('0x6'));var qs=require(_0xa432('0x7'));var logger=require(_0xa432('0x8'))(_0xa432('0x9'));var config=require('../../config/environment');var db=require(_0xa432('0xa'))['db'];config[_0xa432('0xb')]=_['defaults'](config[_0xa432('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa432('0xb')]));require(_0xa432('0xc'))['register'](socket);var jayson=require(_0xa432('0xd'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x1bf845,_0x3ee712,_0x44af9f,_0x521227){return new BPromise(function(_0x4ebb03,_0xfb5c5a){var _0x7d84e3=_0x521227||client;return _0x7d84e3['request'](_0x1bf845,_0x44af9f)[_0xa432('0xe')](function(_0x426da8){logger[_0xa432('0xf')](_0xa432('0x10'),_0x3ee712,_0xa432('0x11'));logger[_0xa432('0x12')](_0xa432('0x13'),_0x3ee712,_0xa432('0x11'),JSON[_0xa432('0x14')](_0x426da8));if(_0x426da8['error']){if(_0x426da8[_0xa432('0x15')]['code']===0x1f4){logger['error'](_0xa432('0x10'),_0x3ee712,_0x426da8[_0xa432('0x15')]['message']);return _0xfb5c5a(_0x426da8[_0xa432('0x15')][_0xa432('0x16')]);}logger[_0xa432('0x15')](_0xa432('0x10'),_0x3ee712,_0x426da8[_0xa432('0x15')][_0xa432('0x16')]);return _0x4ebb03(_0x426da8[_0xa432('0x15')][_0xa432('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x3ee712,_0xa432('0x11'));_0x4ebb03(_0x426da8['result']['message']);}})[_0xa432('0x17')](function(_0x4ccf01){logger['error']('MailAccount,\x20%s,\x20%s',_0x3ee712,_0x4ccf01);_0xfb5c5a(_0x4ccf01);});});}function respondWithStatusCode(_0x1a6d1b,_0x3aa242){_0x3aa242=_0x3aa242||0xcc;return function(_0x3e6a42){if(_0x3e6a42){return _0x1a6d1b['sendStatus'](_0x3aa242);}return _0x1a6d1b[_0xa432('0x18')](_0x3aa242)['end']();};}function respondWithResult(_0x34813c,_0x29313f){_0x29313f=_0x29313f||0xc8;return function(_0x23dcad){if(_0x23dcad){return _0x34813c[_0xa432('0x18')](_0x29313f)[_0xa432('0x19')](_0x23dcad);}};}function respondWithFilteredResult(_0x395b50,_0x2367d5){return function(_0x21015d){if(_0x21015d){var _0x4209fd=typeof _0x2367d5[_0xa432('0x1a')]===_0xa432('0x1b')&&typeof _0x2367d5[_0xa432('0x1c')]==='undefined';var _0x1ce203=_0x21015d[_0xa432('0x1d')];var _0x58eb62=_0x4209fd?0x0:_0x2367d5[_0xa432('0x1a')];var _0x349576=_0x4209fd?_0x21015d[_0xa432('0x1d')]:_0x2367d5[_0xa432('0x1a')]+_0x2367d5['limit'];var _0x5b8fc6;if(_0x349576>=_0x1ce203){_0x349576=_0x1ce203;_0x5b8fc6=0xc8;}else{_0x5b8fc6=0xce;}_0x395b50[_0xa432('0x18')](_0x5b8fc6);return _0x395b50[_0xa432('0x1e')](_0xa432('0x1f'),_0x58eb62+'-'+_0x349576+'/'+_0x1ce203)[_0xa432('0x19')](_0x21015d);}return null;};}function saveUpdates(_0x262158){return function(_0xb8c588){if(_0xb8c588){return _0xb8c588[_0xa432('0x20')](_0x262158)[_0xa432('0xe')](function(_0x16b71a){return _0x16b71a;});}return null;};}function removeEntity(_0xfcd2b7){return function(_0x5b26fa){if(_0x5b26fa){return _0x5b26fa[_0xa432('0x21')]()[_0xa432('0xe')](function(){var _0x51744d=_0x5b26fa[_0xa432('0x22')]({'plain':!![]});var _0x442ef8=_0xa432('0x23');return db[_0xa432('0x24')]['destroy']({'where':{'type':_0x442ef8,'resourceId':_0x51744d['id']}})[_0xa432('0xe')](function(){return _0x5b26fa;});})[_0xa432('0xe')](function(){_0xfcd2b7[_0xa432('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xea7da3){return function(_0x1978b7){if(!_0x1978b7){_0xea7da3[_0xa432('0x25')](0x194);}return _0x1978b7;};}function handleError(_0x4681b0,_0x3529e3){_0x3529e3=_0x3529e3||0x1f4;return function(_0x1a0d23){logger[_0xa432('0x15')](_0x1a0d23[_0xa432('0x26')]);if(_0x1a0d23[_0xa432('0x27')]){delete _0x1a0d23['name'];}_0x4681b0[_0xa432('0x18')](_0x3529e3)[_0xa432('0x28')](_0x1a0d23);};}function getImapHost(_0x54dc47){switch(_0x54dc47){case _0xa432('0x29'):return _0xa432('0x2a');case _0xa432('0x2b'):return _0xa432('0x2c');case _0xa432('0x2d'):return _0xa432('0x2e');case _0xa432('0x2f'):return _0xa432('0x30');}throw new Error(_0xa432('0x31'),_0x54dc47);}function getSmtpHost(_0x5f2137){switch(_0x5f2137){case _0xa432('0x29'):return _0xa432('0x32');case _0xa432('0x2b'):return _0xa432('0x33');case _0xa432('0x2d'):return _0xa432('0x34');case _0xa432('0x2f'):return _0xa432('0x35');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5f2137);}function getAuthenticationOptions(_0x4dc989,_0x2a4f10){var _0x789eef={};var _0x533ac6={};if(_0x4dc989){_0x789eef[_0xa432('0x36')]=_0x533ac6['user']=_0x2a4f10['username'];_0x789eef[_0xa432('0x37')]=_0x533ac6[_0xa432('0x38')]=_0x2a4f10[_0xa432('0x37')];if(_0x2a4f10[_0xa432('0x39')]){_0x789eef['modernAuthentication']=_0x533ac6[_0xa432('0x39')]=!![];_0x789eef[_0xa432('0x3a')]=_0x533ac6[_0xa432('0x3a')]=_0x2a4f10[_0xa432('0x3a')];_0x789eef[_0xa432('0x37')]=_0x533ac6['pass']=null;}else{_0x789eef['CloudProviderId']=_0x533ac6[_0xa432('0x3a')]=null;}_0x789eef[_0xa432('0x3b')]=getImapHost(_0x4dc989);_0x789eef[_0xa432('0x3c')]=0x3e1;_0x533ac6[_0xa432('0x3b')]=getSmtpHost(_0x4dc989);_0x533ac6[_0xa432('0x3c')]=0x24b;_0x533ac6[_0xa432('0x3d')]=![];_0x789eef[_0xa432('0x3e')]=_0x533ac6['service']=null;}else{if(_0x2a4f10[_0xa432('0x3f')]){_0x789eef['user']=_0x533ac6[_0xa432('0x36')]=_0x2a4f10[_0xa432('0x40')];_0x789eef[_0xa432('0x37')]=_0x533ac6['pass']=_0x2a4f10[_0xa432('0x37')];}else{_0x789eef[_0xa432('0x3f')]=_0x533ac6[_0xa432('0x3f')]=![];_0x789eef[_0xa432('0x36')]=_0x533ac6['user']=null;_0x789eef[_0xa432('0x37')]=_0x533ac6[_0xa432('0x38')]=null;}_0x789eef[_0xa432('0x3b')]=_0x2a4f10[_0xa432('0x41')][_0xa432('0x3b')];_0x789eef[_0xa432('0x3c')]=_0x2a4f10[_0xa432('0x41')][_0xa432('0x3c')];_0x533ac6['host']=_0x2a4f10['Smtp'][_0xa432('0x3b')];_0x533ac6['port']=_0x2a4f10['Smtp'][_0xa432('0x3c')];}return{'Imap':_0x789eef,'Smtp':_0x533ac6};}exports[_0xa432('0x42')]=function(_0x1ed05b,_0x553383){var _0x559ddd={'include':[{'model':db[_0xa432('0x43')],'as':_0xa432('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xa432('0x44')],'as':'mandatoryDispositionPause'}]},_0x76876c={},_0x1b44db={'count':0x0,'rows':[]};var _0x2d4680=_[_0xa432('0x45')](db[_0xa432('0x46')]['rawAttributes'],function(_0x147ca6){return{'name':_0x147ca6[_0xa432('0x47')],'type':_0x147ca6[_0xa432('0x48')][_0xa432('0x49')]};});_0x76876c['model']=_[_0xa432('0x45')](_0x2d4680,_0xa432('0x27'));_0x76876c[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x1ed05b[_0xa432('0x4a')]);_0x76876c[_0xa432('0x4c')]=_[_0xa432('0x4d')](_0x76876c[_0xa432('0x4e')],_0x76876c['query']);_0x559ddd['attributes']=_['intersection'](_0x76876c[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x1ed05b[_0xa432('0x4a')]['fields']));_0x559ddd[_0xa432('0x50')]=_0x559ddd[_0xa432('0x50')][_0xa432('0x51')]?_0x559ddd['attributes']:_0x76876c[_0xa432('0x4e')];if(!_0x1ed05b[_0xa432('0x4a')]['hasOwnProperty']('nolimit')){_0x559ddd[_0xa432('0x1c')]=qs[_0xa432('0x1c')](_0x1ed05b[_0xa432('0x4a')][_0xa432('0x1c')]);_0x559ddd['offset']=qs[_0xa432('0x1a')](_0x1ed05b['query'][_0xa432('0x1a')]);}_0x559ddd[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x1ed05b[_0xa432('0x4a')]['sort']);_0x559ddd['where']=qs[_0xa432('0x4c')](_['pick'](_0x1ed05b[_0xa432('0x4a')],_0x76876c[_0xa432('0x4c')]),_0x2d4680);if(_0x1ed05b[_0xa432('0x4a')]['filter']){_0x559ddd[_0xa432('0x54')]=_['merge'](_0x559ddd[_0xa432('0x54')],{'$or':_['map'](_0x2d4680,function(_0xf9bcba){if(_0xf9bcba['type']!==_0xa432('0x55')){var _0x16758d={};_0x16758d[_0xf9bcba[_0xa432('0x27')]]={'$like':'%'+_0x1ed05b[_0xa432('0x4a')][_0xa432('0x56')]+'%'};return _0x16758d;}})});}_0x559ddd=_[_0xa432('0x57')]({},_0x559ddd,_0x1ed05b[_0xa432('0x58')]);var _0x40924f={'where':_0x559ddd[_0xa432('0x54')]};return db[_0xa432('0x46')][_0xa432('0x1d')](_0x40924f)[_0xa432('0xe')](function(_0x571e2a){_0x1b44db['count']=_0x571e2a;if(_0x1ed05b['query']['includeAll']){_0x559ddd[_0xa432('0x59')]=[{'all':!![]}];}return db[_0xa432('0x46')][_0xa432('0x5a')](_0x559ddd);})[_0xa432('0xe')](function(_0xa5ae58){_0x1b44db[_0xa432('0x5b')]=_0xa5ae58;return _0x1b44db;})[_0xa432('0xe')](respondWithFilteredResult(_0x553383,_0x559ddd))[_0xa432('0x17')](handleError(_0x553383,null));};exports[_0xa432('0x5c')]=function(_0x443920,_0x194bbb){var _0x266655={'raw':![],'where':{'id':_0x443920[_0xa432('0x5d')]['id']},'include':[{'model':db[_0xa432('0x43')],'as':_0xa432('0x41')},{'model':db[_0xa432('0x5e')],'as':_0xa432('0x5f')},{'model':db[_0xa432('0x44')],'as':_0xa432('0x60')}]},_0x437a3b={};_0x437a3b[_0xa432('0x4e')]=_[_0xa432('0x4b')](db['MailAccount'][_0xa432('0x61')]);_0x437a3b[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x443920[_0xa432('0x4a')]);_0x437a3b['filters']=_['intersection'](_0x437a3b[_0xa432('0x4e')],_0x437a3b['query']);_0x266655[_0xa432('0x50')]=_['intersection'](_0x437a3b[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x443920[_0xa432('0x4a')][_0xa432('0x4f')]));_0x266655[_0xa432('0x50')]=_0x266655['attributes'][_0xa432('0x51')]?_0x266655[_0xa432('0x50')]:_0x437a3b[_0xa432('0x4e')];if(_0x443920[_0xa432('0x4a')][_0xa432('0x62')]){_0x266655[_0xa432('0x59')]=[{'all':!![]}];}_0x266655=_['merge']({},_0x266655,_0x443920[_0xa432('0x58')]);return db[_0xa432('0x46')]['find'](_0x266655)[_0xa432('0xe')](handleEntityNotFound(_0x194bbb,null))[_0xa432('0xe')](respondWithResult(_0x194bbb,null))[_0xa432('0x17')](handleError(_0x194bbb,null));};exports[_0xa432('0x20')]=function(_0x281142,_0x381399){if(_0x281142[_0xa432('0x63')]['id']){delete _0x281142['body']['id'];}var _0x25447a=_0x281142[_0xa432('0x63')][_0xa432('0x64')]==='custom'?null:_0x281142[_0xa432('0x63')]['provider'];var _0x20fcec=_0x281142['body'][_0xa432('0x41')]||{};var _0x5a0f42=_0x281142[_0xa432('0x63')]['Smtp']||{};if(_0x25447a){_0x20fcec['host']=getImapHost(_0x25447a);_0x20fcec['port']=0x3e1;_0x5a0f42[_0xa432('0x3b')]=getSmtpHost(_0x25447a);_0x5a0f42[_0xa432('0x3c')]=0x24b;_0x5a0f42[_0xa432('0x3d')]=![];}if(_0x5a0f42[_0xa432('0x39')]){_0x5a0f42['secure']=![];}else{_0x5a0f42['CloudProviderId']=null;}if(!_0x20fcec[_0xa432('0x39')])_0x20fcec['CloudProviderId']=null;_0x281142[_0xa432('0x63')][_0xa432('0x41')]=_0x20fcec;_0x281142[_0xa432('0x63')][_0xa432('0x5f')]=_0x5a0f42;return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x281142['params']['id']},'include':[{'model':db[_0xa432('0x43')],'as':'Imap'},{'model':db[_0xa432('0x5e')],'as':_0xa432('0x5f')},{'model':db[_0xa432('0x44')],'as':_0xa432('0x60')}]})['then'](handleEntityNotFound(_0x381399,null))['then'](function(_0x118a84){if(!_0x118a84)throw new Error(_0xa432('0x66'));if(_0x118a84['service'])delete _0x281142[_0xa432('0x63')][_0xa432('0x41')];return _0x118a84;})['then'](saveUpdates(_0x281142[_0xa432('0x63')],null))[_0xa432('0xe')](function(_0x50973b){if(!_0x281142[_0xa432('0x63')][_0xa432('0x41')])return _0x50973b;return db[_0xa432('0x43')][_0xa432('0x20')](_0x281142[_0xa432('0x63')][_0xa432('0x41')],{'where':{'MailAccountId':_0x50973b['id']}})[_0xa432('0xe')](function(){return _0x50973b;});})[_0xa432('0xe')](function(_0x12836d){if(!_0x281142['body']['Smtp'])return _0x12836d;return db[_0xa432('0x5e')][_0xa432('0x20')](_0x281142[_0xa432('0x63')][_0xa432('0x5f')],{'where':{'MailAccountId':_0x12836d['id']}})[_0xa432('0xe')](function(){return _0x12836d;});})['then'](respondWithResult(_0x381399,null))[_0xa432('0x17')](handleError(_0x381399,null));};exports['describe']=function(_0x41c862,_0x179f98){return db[_0xa432('0x46')][_0xa432('0x67')]()[_0xa432('0xe')](respondWithResult(_0x179f98,null))[_0xa432('0x17')](handleError(_0x179f98,null));};exports[_0xa432('0x68')]=function(_0x466dcb,_0x2985ff){if(_0x466dcb['body']['id']){delete _0x466dcb[_0xa432('0x63')]['id'];}return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x466dcb[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x2985ff,null))[_0xa432('0xe')](function(_0x1f18a5){if(_0x1f18a5){_0x466dcb[_0xa432('0x63')][_0xa432('0x69')]=_0x1f18a5['id'];return db[_0xa432('0x6a')][_0xa432('0x6b')](_0x466dcb[_0xa432('0x63')]);}})[_0xa432('0xe')](respondWithResult(_0x2985ff,null))['catch'](handleError(_0x2985ff,null));};exports[_0xa432('0x6c')]=function(_0x357a9d,_0x568d89){var _0x2d7a86={'raw':![],'where':{}};var _0x302263={};var _0x2e6a65={'count':0x0,'rows':[]};return db['MailAccount'][_0xa432('0x6d')]({'where':{'id':_0x357a9d[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x568d89,null))[_0xa432('0xe')](function(_0xd040ae){if(_0xd040ae){_0x302263['model']=_[_0xa432('0x4b')](db[_0xa432('0x6a')][_0xa432('0x61')]);_0x302263['query']=_['keys'](_0x357a9d[_0xa432('0x4a')]);_0x302263[_0xa432('0x4c')]=_['intersection'](_0x302263['model'],_0x302263['query']);_0x2d7a86[_0xa432('0x50')]=_[_0xa432('0x4d')](_0x302263[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x357a9d[_0xa432('0x4a')][_0xa432('0x4f')]));_0x2d7a86['attributes']=_0x2d7a86['attributes'][_0xa432('0x51')]?_0x2d7a86[_0xa432('0x50')]:_0x302263[_0xa432('0x4e')];if(!_0x357a9d[_0xa432('0x4a')]['hasOwnProperty'](_0xa432('0x6e'))){_0x2d7a86[_0xa432('0x1c')]=qs['limit'](_0x357a9d[_0xa432('0x4a')][_0xa432('0x1c')]);_0x2d7a86['offset']=qs[_0xa432('0x1a')](_0x357a9d[_0xa432('0x4a')]['offset']);}_0x2d7a86[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x357a9d[_0xa432('0x4a')][_0xa432('0x53')]);_0x2d7a86[_0xa432('0x54')]=qs[_0xa432('0x4c')](_[_0xa432('0x6f')](_0x357a9d[_0xa432('0x4a')],_0x302263[_0xa432('0x4c')]));_0x2d7a86[_0xa432('0x54')][_0xa432('0x69')]=_0xd040ae['id'];if(_0x357a9d[_0xa432('0x4a')][_0xa432('0x56')]){_0x2d7a86[_0xa432('0x54')]=_['merge'](_0x2d7a86['where'],{'$or':_['map'](_0x2d7a86['attributes'],function(_0x181a84){var _0x45c1ba={};_0x45c1ba[_0x181a84]={'$like':'%'+_0x357a9d['query'][_0xa432('0x56')]+'%'};return _0x45c1ba;})});}_0x2d7a86=_['merge']({},_0x2d7a86,_0x357a9d[_0xa432('0x58')]);return db[_0xa432('0x6a')][_0xa432('0x1d')]({'where':_0x2d7a86[_0xa432('0x54')]})[_0xa432('0xe')](function(_0x6bc9e8){_0x2e6a65[_0xa432('0x1d')]=_0x6bc9e8;if(_0x357a9d[_0xa432('0x4a')]['includeAll']){_0x2d7a86['include']=[{'all':!![]}];}return db[_0xa432('0x6a')]['findAll'](_0x2d7a86);})[_0xa432('0xe')](function(_0x395160){_0x2e6a65[_0xa432('0x5b')]=_0x395160;return _0x2e6a65;});}})[_0xa432('0xe')](respondWithFilteredResult(_0x568d89,_0x2d7a86))[_0xa432('0x17')](handleError(_0x568d89,null));};exports[_0xa432('0x70')]=function(_0x21537d,_0x4f09ca){return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x21537d['params']['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x4f09ca,null))['then'](function(_0x49c176){if(_0x49c176){return _0x49c176[_0xa432('0x70')](_0x21537d['query']['ids']);}})['then'](respondWithStatusCode(_0x4f09ca,null))[_0xa432('0x17')](handleError(_0x4f09ca,null));};exports[_0xa432('0x71')]=function(_0x307e47,_0x2b4018){if(_0x307e47['body']['id']){delete _0x307e47[_0xa432('0x63')]['id'];}return db['MailAccount'][_0xa432('0x65')]({'where':{'id':_0x307e47[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x2b4018,null))[_0xa432('0xe')](function(_0x3a9c73){if(_0x3a9c73){_0x307e47[_0xa432('0x63')]['MailAccountId']=_0x3a9c73['id'];return db['CannedAnswer'][_0xa432('0x6b')](_0x307e47[_0xa432('0x63')]);}})[_0xa432('0xe')](respondWithResult(_0x2b4018,null))[_0xa432('0x17')](handleError(_0x2b4018,null));};exports[_0xa432('0x72')]=function(_0x51a27c,_0x487190){var _0x4988ff={'raw':![],'where':{}};var _0x39fe54={};var _0x331790={'count':0x0,'rows':[]};return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0x51a27c[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x487190,null))[_0xa432('0xe')](function(_0x3ae03e){if(_0x3ae03e){_0x39fe54[_0xa432('0x4e')]=_['keys'](db[_0xa432('0x73')][_0xa432('0x61')]);_0x39fe54[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x51a27c[_0xa432('0x4a')]);_0x39fe54[_0xa432('0x4c')]=_['intersection'](_0x39fe54[_0xa432('0x4e')],_0x39fe54[_0xa432('0x4a')]);_0x4988ff[_0xa432('0x50')]=_[_0xa432('0x4d')](_0x39fe54['model'],qs['fields'](_0x51a27c[_0xa432('0x4a')][_0xa432('0x4f')]));_0x4988ff[_0xa432('0x50')]=_0x4988ff[_0xa432('0x50')][_0xa432('0x51')]?_0x4988ff['attributes']:_0x39fe54[_0xa432('0x4e')];if(!_0x51a27c[_0xa432('0x4a')][_0xa432('0x74')]('nolimit')){_0x4988ff[_0xa432('0x1c')]=qs['limit'](_0x51a27c[_0xa432('0x4a')][_0xa432('0x1c')]);_0x4988ff[_0xa432('0x1a')]=qs[_0xa432('0x1a')](_0x51a27c['query'][_0xa432('0x1a')]);}_0x4988ff[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x51a27c[_0xa432('0x4a')][_0xa432('0x53')]);_0x4988ff[_0xa432('0x54')]=qs[_0xa432('0x4c')](_[_0xa432('0x6f')](_0x51a27c[_0xa432('0x4a')],_0x39fe54[_0xa432('0x4c')]));_0x4988ff[_0xa432('0x54')][_0xa432('0x69')]=_0x3ae03e['id'];if(_0x51a27c['query'][_0xa432('0x56')]){_0x4988ff[_0xa432('0x54')]=_[_0xa432('0x57')](_0x4988ff[_0xa432('0x54')],{'$or':_[_0xa432('0x45')](_0x4988ff[_0xa432('0x50')],function(_0x4d2dee){var _0x352174={};_0x352174[_0x4d2dee]={'$like':'%'+_0x51a27c[_0xa432('0x4a')][_0xa432('0x56')]+'%'};return _0x352174;})});}_0x4988ff=_[_0xa432('0x57')]({},_0x4988ff,_0x51a27c[_0xa432('0x58')]);return db[_0xa432('0x73')][_0xa432('0x1d')]({'where':_0x4988ff[_0xa432('0x54')]})[_0xa432('0xe')](function(_0x3633ca){_0x331790[_0xa432('0x1d')]=_0x3633ca;if(_0x51a27c[_0xa432('0x4a')][_0xa432('0x62')]){_0x4988ff[_0xa432('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa432('0x5a')](_0x4988ff);})[_0xa432('0xe')](function(_0x1341b1){_0x331790[_0xa432('0x5b')]=_0x1341b1;return _0x331790;});}})[_0xa432('0xe')](respondWithFilteredResult(_0x487190,_0x4988ff))[_0xa432('0x17')](handleError(_0x487190,null));};exports[_0xa432('0x75')]=function(_0x374d75,_0xcb22bc){return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x374d75['params']['id']}})[_0xa432('0xe')](handleEntityNotFound(_0xcb22bc,null))[_0xa432('0xe')](function(_0x4b1911){if(_0x4b1911){return _0x4b1911[_0xa432('0x75')](_0x374d75[_0xa432('0x4a')]['ids']);}})[_0xa432('0xe')](respondWithStatusCode(_0xcb22bc,null))[_0xa432('0x17')](handleError(_0xcb22bc,null));};exports[_0xa432('0x6b')]=function(_0x166f0e,_0x34a83d){var _0x558c01={'name':_0x166f0e[_0xa432('0x63')][_0xa432('0x27')],'key':_0x166f0e[_0xa432('0x63')][_0xa432('0x49')],'provider':_0x166f0e[_0xa432('0x63')][_0xa432('0x64')]===_0xa432('0x76')?null:_0x166f0e[_0xa432('0x63')][_0xa432('0x64')],'email':_0x166f0e[_0xa432('0x63')]['email'],'ListId':_0x166f0e[_0xa432('0x63')][_0xa432('0x77')],'active':!_[_0xa432('0x78')](_0x166f0e[_0xa432('0x63')][_0xa432('0x79')])?_0x166f0e[_0xa432('0x63')][_0xa432('0x79')]:!![],'description':_0x166f0e[_0xa432('0x63')][_0xa432('0x7a')]||null};var _0x2dcb4f=getAuthenticationOptions(_0x558c01[_0xa432('0x64')],_0x166f0e[_0xa432('0x63')]);_0x558c01[_0xa432('0x41')]=_0x2dcb4f[_0xa432('0x41')];_0x558c01['Smtp']=_0x2dcb4f[_0xa432('0x5f')];return db[_0xa432('0x46')][_0xa432('0x6b')](_0x558c01,{'include':[{'model':db[_0xa432('0x5e')],'as':_0xa432('0x5f')},{'model':db['MailServerIn'],'as':_0xa432('0x41')}]})['then'](function(_0x5a5249){var _0xee999a=_0x166f0e[_0xa432('0x36')][_0xa432('0x22')]({'plain':!![]});if(!_0xee999a)throw new Error(_0xa432('0x7b'));if(_0xee999a[_0xa432('0x7c')]===_0xa432('0x36')){var _0x421a87=_0x5a5249['get']({'plain':!![]});return db[_0xa432('0x7d')][_0xa432('0x65')]({'where':{'name':'MailAccounts','userProfileId':_0xee999a['userProfileId']},'raw':!![]})[_0xa432('0xe')](function(_0x2df20c){if(_0x2df20c&&_0x2df20c[_0xa432('0x7e')]===0x0){return db[_0xa432('0x24')]['create']({'name':_0x421a87[_0xa432('0x27')],'resourceId':_0x421a87['id'],'type':_0x2df20c['name'],'sectionId':_0x2df20c['id']},{})[_0xa432('0xe')](function(){return _0x5a5249;});}else{return _0x5a5249;}})[_0xa432('0x17')](function(_0x1ffb3b){logger[_0xa432('0x15')](_0xa432('0x7f'),_0x1ffb3b);throw _0x1ffb3b;});}return _0x5a5249;})[_0xa432('0xe')](respondWithResult(_0x34a83d,0xc9))[_0xa432('0x17')](handleError(_0x34a83d,null));};exports[_0xa432('0x80')]=function(_0x4ce041,_0x15c630){return db[_0xa432('0x46')]['findOne']({'where':{'id':_0x4ce041[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x15c630,null))[_0xa432('0xe')](function(_0x3fe5e4){if(_0x3fe5e4){return _0x3fe5e4[_0xa432('0x80')]();}return null;})[_0xa432('0xe')](respondWithResult(_0x15c630,null))['catch'](handleError(_0x15c630,null));};exports[_0xa432('0x81')]=function(_0x32cfb5,_0x2f870e){if(_0x32cfb5[_0xa432('0x63')]['id']){delete _0x32cfb5['body']['id'];}return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x32cfb5[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x2f870e,null))['then'](function(_0x198a59){if(_0x198a59){_0x32cfb5[_0xa432('0x63')][_0xa432('0x69')]=_0x198a59['id'];return db[_0xa432('0x43')]['create'](_0x32cfb5[_0xa432('0x63')]);}})[_0xa432('0xe')](respondWithResult(_0x2f870e,null))[_0xa432('0x17')](handleError(_0x2f870e,null));};exports[_0xa432('0x82')]=function(_0x6e8f99,_0xd8d3b1){return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0x6e8f99[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0xd8d3b1,null))[_0xa432('0xe')](function(_0x2212b9){if(_0x2212b9){return _0x2212b9[_0xa432('0x83')](null);}return null;})[_0xa432('0xe')](respondWithStatusCode(_0xd8d3b1,null))['catch'](handleError(_0xd8d3b1,null));};exports[_0xa432('0x84')]=function(_0x2dbff,_0x34cca8){return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0x2dbff['params']['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x34cca8,null))[_0xa432('0xe')](function(_0x2ce501){if(_0x2ce501){return _0x2ce501[_0xa432('0x84')]();}return null;})[_0xa432('0xe')](respondWithResult(_0x34cca8,null))[_0xa432('0x17')](handleError(_0x34cca8,null));};exports[_0xa432('0x85')]=function(_0x21c18c,_0xbc0360){if(_0x21c18c['body']['id']){delete _0x21c18c[_0xa432('0x63')]['id'];}return db['MailAccount'][_0xa432('0x65')]({'where':{'id':_0x21c18c[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0xbc0360,null))['then'](function(_0x556e0c){if(_0x556e0c){_0x21c18c['body'][_0xa432('0x69')]=_0x556e0c['id'];return db[_0xa432('0x5e')]['create'](_0x21c18c[_0xa432('0x63')]);}})[_0xa432('0xe')](respondWithResult(_0xbc0360,null))['catch'](handleError(_0xbc0360,null));};exports['removeSmtp']=function(_0x1d2a44,_0xe71824){return db[_0xa432('0x46')]['findOne']({'where':{'id':_0x1d2a44[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0xe71824,null))[_0xa432('0xe')](function(_0x5930ce){if(_0x5930ce){return _0x5930ce[_0xa432('0x86')](null);}return null;})[_0xa432('0xe')](respondWithStatusCode(_0xe71824,null))[_0xa432('0x17')](handleError(_0xe71824,null));};exports[_0xa432('0x87')]=function(_0x138c55,_0x3cbb5f){return db['MailInteraction'][_0xa432('0x65')]({'where':{'id':_0x138c55[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x3cbb5f,null))[_0xa432('0xe')](function(_0x339367){if(_0x339367){return _0x339367[_0xa432('0x87')](_0x138c55['body']['ids'],_[_0xa432('0x88')](_0x138c55['body'],[_0xa432('0x89'),'id'])||{});}})['then'](respondWithResult(_0x3cbb5f,null))['catch'](handleError(_0x3cbb5f,null));};exports['getInteractions']=function(_0x900ec6,_0x150e59){var _0x11a894={'raw':![],'where':{}};var _0x1e8ce5={};var _0x5481eb={'count':0x0,'rows':[]};return db[_0xa432('0x46')]['findOne']({'where':{'id':_0x900ec6[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x150e59,null))[_0xa432('0xe')](function(_0x48c783){if(_0x48c783){_0x1e8ce5['model']=_[_0xa432('0x4b')](db['MailInteraction'][_0xa432('0x61')]);_0x1e8ce5['query']=_[_0xa432('0x4b')](_0x900ec6[_0xa432('0x4a')]);_0x1e8ce5[_0xa432('0x4c')]=_[_0xa432('0x4d')](_0x1e8ce5[_0xa432('0x4e')],_0x1e8ce5[_0xa432('0x4a')]);_0x11a894[_0xa432('0x50')]=_[_0xa432('0x4d')](_0x1e8ce5[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x900ec6[_0xa432('0x4a')][_0xa432('0x4f')]));_0x11a894['attributes']=_0x11a894[_0xa432('0x50')]['length']?_0x11a894[_0xa432('0x50')]:_0x1e8ce5[_0xa432('0x4e')];if(!_0x900ec6[_0xa432('0x4a')][_0xa432('0x74')](_0xa432('0x6e'))){_0x11a894[_0xa432('0x1c')]=qs[_0xa432('0x1c')](_0x900ec6[_0xa432('0x4a')][_0xa432('0x1c')]);_0x11a894[_0xa432('0x1a')]=qs['offset'](_0x900ec6[_0xa432('0x4a')][_0xa432('0x1a')]);}_0x11a894[_0xa432('0x52')]=qs['sort'](_0x900ec6[_0xa432('0x4a')][_0xa432('0x53')]);_0x11a894[_0xa432('0x54')]=qs['filters'](_['pick'](_0x900ec6[_0xa432('0x4a')],_0x1e8ce5['filters']));_0x11a894['where']['MailAccountId']=_0x48c783['id'];if(_0x900ec6[_0xa432('0x4a')]['filter']){_0x11a894[_0xa432('0x54')]=_[_0xa432('0x57')](_0x11a894[_0xa432('0x54')],{'$or':_[_0xa432('0x45')](_0x11a894[_0xa432('0x50')],function(_0x3ad386){var _0x72e26d={};_0x72e26d[_0x3ad386]={'$like':'%'+_0x900ec6[_0xa432('0x4a')]['filter']+'%'};return _0x72e26d;})});}_0x11a894=_['merge']({},_0x11a894,_0x900ec6['options']);return db[_0xa432('0x8a')][_0xa432('0x1d')]({'where':_0x11a894[_0xa432('0x54')]})[_0xa432('0xe')](function(_0x46bd4e){_0x5481eb[_0xa432('0x1d')]=_0x46bd4e;if(_0x900ec6[_0xa432('0x4a')]['includeAll']){_0x11a894[_0xa432('0x59')]=[{'model':db[_0xa432('0x8b')],'as':'Contact','required':![]},{'model':db[_0xa432('0x8c')],'as':_0xa432('0x8d'),'attributes':[_0xa432('0x27'),'fullname','internal'],'required':![]},{'model':db[_0xa432('0x8e')],'as':_0xa432('0x8f'),'attributes':['id','name','color'],'where':_0x900ec6[_0xa432('0x4a')]['tag']?{'id':_0x900ec6[_0xa432('0x4a')][_0xa432('0x90')]}:undefined,'required':_0x900ec6[_0xa432('0x4a')][_0xa432('0x90')]?!![]:![]}];}return db[_0xa432('0x8a')][_0xa432('0x5a')](_0x11a894);})[_0xa432('0xe')](function(_0x4be26c){_0x5481eb['rows']=_0x4be26c;return _0x5481eb;});}})[_0xa432('0xe')](respondWithFilteredResult(_0x150e59,_0x11a894))[_0xa432('0x17')](handleError(_0x150e59,null));};exports[_0xa432('0x91')]=function addApplications(_0x3aad0d,_0x3766c6){var _0x16f502=_0x3aad0d['params']['id'];var _0x5c48c5=_0x3aad0d['body'];var _0xcb315a=0xc8;var _0x31dadb=null;return db[_0xa432('0x92')][_0xa432('0x93')]({'isolationLevel':db[_0xa432('0x92')][_0xa432('0x94')][_0xa432('0x95')]['READ_COMMITTED']},function(_0x3249b5){return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0x16f502},'transaction':_0x3249b5})[_0xa432('0xe')](function(_0x52a128){if(_0x52a128){return db['MailApplication'][_0xa432('0x21')]({'where':{'MailAccountId':_0x16f502},'transaction':_0x3249b5})[_0xa432('0xe')](function(){var _0x52218c=_[_0xa432('0x45')](_0x5c48c5,function(_0x129da7){_0x129da7['MailAccountId']=_0x16f502;return _0x129da7;});return db['MailApplication'][_0xa432('0x96')](_0x52218c,{'transaction':_0x3249b5});});}else{_0xcb315a=0x194;_0x31dadb=[];}});})[_0xa432('0xe')](function(){if(_0xcb315a!==0x194){return db[_0xa432('0x97')]['findAndCountAll']({'where':{'MailAccountId':_0x16f502},'order':_0xa432('0x98')})[_0xa432('0xe')](function(_0x286806){_0x31dadb=_0x286806;});}})[_0xa432('0x17')](function(_0x1e13cc){_0xcb315a=0x1f4;logger['error'](_0x1e13cc[_0xa432('0x26')]);if(_0x1e13cc[_0xa432('0x27')]){delete _0x1e13cc['name'];}_0x31dadb=_0x1e13cc;})[_0xa432('0x99')](function(){if(_0x31dadb===null){_0x3766c6[_0xa432('0x25')](_0xcb315a);}else{if(_0xcb315a===0x1f4){_0x3766c6[_0xa432('0x18')](_0xcb315a)['send'](_0x31dadb);}else{_0x3766c6[_0xa432('0x18')](_0xcb315a)[_0xa432('0x19')](_0x31dadb);}}});};exports['getApplications']=function(_0x7c33c4,_0x289de8){var _0x3c1231={};var _0x122121={};var _0x5c29dc;var _0xda8041;return db['MailAccount'][_0xa432('0x6d')]({'where':{'id':_0x7c33c4[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x289de8,null))[_0xa432('0xe')](function(_0x1b1d22){if(_0x1b1d22){_0x5c29dc=_0x1b1d22;_0x122121['model']=_[_0xa432('0x4b')](db[_0xa432('0x97')][_0xa432('0x61')]);_0x122121[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x7c33c4[_0xa432('0x4a')]);_0x122121[_0xa432('0x4c')]=_['intersection'](_0x122121[_0xa432('0x4e')],_0x122121['query']);_0x3c1231[_0xa432('0x50')]=_[_0xa432('0x4d')](_0x122121[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x7c33c4['query'][_0xa432('0x4f')]));_0x3c1231[_0xa432('0x50')]=_0x3c1231['attributes'][_0xa432('0x51')]?_0x3c1231[_0xa432('0x50')]:_0x122121['model'];_0x3c1231[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x7c33c4[_0xa432('0x4a')][_0xa432('0x53')]);_0x3c1231[_0xa432('0x54')]=qs[_0xa432('0x4c')](_[_0xa432('0x6f')](_0x7c33c4[_0xa432('0x4a')],_0x122121[_0xa432('0x4c')]));if(_0x7c33c4[_0xa432('0x4a')][_0xa432('0x56')]){_0x3c1231[_0xa432('0x54')]=_[_0xa432('0x57')](_0x3c1231[_0xa432('0x54')],{'$or':_['map'](_0x3c1231['attributes'],function(_0x933a3b){var _0x869492={};_0x869492[_0x933a3b]={'$like':'%'+_0x7c33c4['query'][_0xa432('0x56')]+'%'};return _0x869492;})});}_0x3c1231=_['merge']({},_0x3c1231,_0x7c33c4[_0xa432('0x58')]);return _0x5c29dc[_0xa432('0x9a')](_0x3c1231);}})[_0xa432('0xe')](function(_0x45d944){if(_0x45d944){_0xda8041=_0x45d944[_0xa432('0x51')];if(!_0x7c33c4['query']['hasOwnProperty'](_0xa432('0x6e'))){_0x3c1231[_0xa432('0x1c')]=qs[_0xa432('0x1c')](_0x7c33c4['query']['limit']);_0x3c1231['offset']=qs[_0xa432('0x1a')](_0x7c33c4[_0xa432('0x4a')][_0xa432('0x1a')]);}return _0x5c29dc[_0xa432('0x9a')](_0x3c1231);}})['then'](function(_0xd1a1d3){if(_0xd1a1d3){return _0xd1a1d3?{'count':_0xda8041,'rows':_0xd1a1d3}:null;}})[_0xa432('0xe')](respondWithResult(_0x289de8,null))[_0xa432('0x17')](handleError(_0x289de8,null));};exports[_0xa432('0x9b')]=function(_0x11a85d,_0x17da16){var _0x18651b={'raw':!![],'where':{}};var _0x2cc97b={};var _0x2757b8={'count':0x0,'rows':[]};return db[_0xa432('0x46')]['findOne']({'where':{'id':_0x11a85d[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x17da16,null))[_0xa432('0xe')](function(_0x5a6b8f){if(_0x5a6b8f){_0x2cc97b[_0xa432('0x4e')]=_['keys'](db[_0xa432('0x9c')]['rawAttributes']);_0x2cc97b[_0xa432('0x4a')]=_[_0xa432('0x4b')](_0x11a85d['query']);_0x2cc97b['filters']=_[_0xa432('0x4d')](_0x2cc97b[_0xa432('0x4e')],_0x2cc97b[_0xa432('0x4a')]);_0x18651b['attributes']=_['intersection'](_0x2cc97b[_0xa432('0x4e')],qs[_0xa432('0x4f')](_0x11a85d[_0xa432('0x4a')]['fields']));_0x18651b[_0xa432('0x50')]=_0x18651b[_0xa432('0x50')][_0xa432('0x51')]?_0x18651b[_0xa432('0x50')]:_0x2cc97b[_0xa432('0x4e')];if(!_0x11a85d[_0xa432('0x4a')][_0xa432('0x74')]('nolimit')){_0x18651b[_0xa432('0x1c')]=qs[_0xa432('0x1c')](_0x11a85d[_0xa432('0x4a')][_0xa432('0x1c')]);_0x18651b[_0xa432('0x1a')]=qs[_0xa432('0x1a')](_0x11a85d['query'][_0xa432('0x1a')]);}_0x18651b[_0xa432('0x52')]=qs[_0xa432('0x53')](_0x11a85d[_0xa432('0x4a')][_0xa432('0x53')]);_0x18651b[_0xa432('0x54')]=qs['filters'](_[_0xa432('0x6f')](_0x11a85d[_0xa432('0x4a')],_0x2cc97b['filters']));_0x18651b[_0xa432('0x54')][_0xa432('0x69')]=_0x5a6b8f['id'];if(_0x11a85d[_0xa432('0x4a')]['filter']){_0x18651b[_0xa432('0x54')]=_[_0xa432('0x57')](_0x18651b[_0xa432('0x54')],{'$or':_[_0xa432('0x45')](_0x18651b[_0xa432('0x50')],function(_0x3f70fc){var _0x17988f={};_0x17988f[_0x3f70fc]={'$like':'%'+_0x11a85d[_0xa432('0x4a')]['filter']+'%'};return _0x17988f;})});}if(_0x11a85d['query'][_0xa432('0x9d')]){var _0x3d2046=_0x11a85d['query'][_0xa432('0x9d')]['split'](',');var _0x3c292d={};_0x3c292d[_0x3d2046[0x0]]={'$gte':moment(_0x3d2046[0x1])[_0xa432('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x18651b[_0xa432('0x54')]=_[_0xa432('0x57')](_0x18651b[_0xa432('0x54')],_0x3c292d);}_0x18651b=_[_0xa432('0x57')]({},_0x18651b,_0x11a85d['options']);return db['MailMessage'][_0xa432('0x1d')]({'where':_0x18651b['where']})[_0xa432('0xe')](function(_0x35cf3a){_0x2757b8[_0xa432('0x1d')]=_0x35cf3a;if(_0x11a85d[_0xa432('0x4a')]['includeAll']){_0x18651b['include']=[{'all':!![]}];}return db[_0xa432('0x9c')][_0xa432('0x5a')](_0x18651b);})[_0xa432('0xe')](function(_0x1b3000){if(_0x11a85d[_0xa432('0x4a')][_0xa432('0x9f')]===_0xa432('0xa0')){for(var _0x44f0f1=0x0;_0x44f0f1<_0x1b3000[_0xa432('0x51')];_0x44f0f1++){_0x1b3000[_0x44f0f1][_0xa432('0x63')]=juice(_0x1b3000[_0x44f0f1][_0xa432('0x63')]);}}_0x2757b8['rows']=_0x1b3000;return _0x2757b8;});}})[_0xa432('0xe')](respondWithFilteredResult(_0x17da16,_0x18651b))[_0xa432('0x17')](handleError(_0x17da16,null));};exports[_0xa432('0x28')]=function(_0x2bbba1,_0x5a9124){var _0x2188a0,_0x169d6d={},_0x2a2e2f;if(_0x2bbba1[_0xa432('0x63')]['to']){_0x2a2e2f=_0x2bbba1[_0xa432('0x63')]['to'][_0xa432('0xa1')](',')[0x0];}return db[_0xa432('0x46')]['find']({'where':{'id':_0x2bbba1[_0xa432('0x5d')]['id']},'include':[{'model':db[_0xa432('0xa2')],'as':_0xa432('0xa3'),'include':[{'model':db[_0xa432('0x8b')],'as':_0xa432('0xa4'),'where':{'email':_0x2a2e2f},'limit':0x1,'order':[[_0xa432('0xa5'),_0xa432('0xa6')]]}]},{'model':db[_0xa432('0x5e')],'as':_0xa432('0x5f'),'raw':!![],'include':[{'model':db[_0xa432('0xa7')],'as':_0xa432('0xa7'),'raw':!![]}]}]})[_0xa432('0xe')](handleEntityNotFound(_0x5a9124,null))[_0xa432('0xe')](function(_0x156ed4){if(!_0x156ed4)return;_0x2188a0=_0x156ed4;if(!_0x156ed4[_0xa432('0x5f')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xa432('0x78')](_0x2bbba1[_0xa432('0x63')]['from'])){_0x2bbba1['body'][_0xa432('0xa8')]=util[_0xa432('0x9e')]('%s\x20<%s>',_0x156ed4[_0xa432('0x27')],_0x156ed4[_0xa432('0xa9')]||_0x156ed4['Smtp'][_0xa432('0x36')]);}if(_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')]&&_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')]['length']){for(var _0x335e39=0x0;_0x335e39<_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')][_0xa432('0x51')];_0x335e39+=0x1){_0x2bbba1['body'][_0xa432('0xaa')][_0x335e39]={'filename':_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')][_0x335e39][_0xa432('0x27')],'path':path[_0xa432('0xab')](config[_0xa432('0xac')],'server/files/attachments',_0x2bbba1[_0xa432('0x63')][_0xa432('0xaa')][_0x335e39]['basename'])};}}var _0x1d3976=_0x156ed4[_0xa432('0xad')]();return respondWithRpcPromise(_0xa432('0xae'),_0xa432('0xaf'),{'account':_0x1d3976,'message':_0x2bbba1[_0xa432('0x63')]});})[_0xa432('0xe')](function(_0x1da3e9){if(!_0x1da3e9)return;_0x169d6d=_0x1da3e9;if(!_0x2188a0[_0xa432('0xa3')])throw new Error(_0xa432('0xb0'));if(_0x2188a0[_0xa432('0xa3')]['Contacts']['length'])return _0x2188a0[_0xa432('0xa3')][_0xa432('0xa4')][0x0];return db['CmContact']['create'](_[_0xa432('0xb1')](_0x2bbba1[_0xa432('0x63')],{'firstName':_0x2bbba1['body']['to'],'email':_0x2bbba1[_0xa432('0x63')]['to'],'phone':_0x2bbba1['body']['to'],'ListId':_0x2188a0[_0xa432('0x77')]}));})[_0xa432('0xe')](function(_0x317576){if(!_0x317576)return;var _0x21769c={'UserId':_0x2bbba1[_0xa432('0x36')]['id'],'ContactId':_0x317576['id'],'MailAccountId':_0x2188a0['id'],'inReplyTo':_0x169d6d[_0xa432('0xb2')],'to':_0x2bbba1['body']['from'],'cc':_0x2bbba1[_0xa432('0x63')]['cc'],'subject':_0x2bbba1[_0xa432('0x63')]['subject'],'attach':_0x2bbba1['body']['attach'],'firstMsgDirection':_0xa432('0xb3'),'lastMsgAt':moment()['format'](_0xa432('0xb4')),'lastMsgDirection':_0xa432('0xb3'),'Messages':[_['merge'](_0x2bbba1[_0xa432('0x63')],{'messageId':_0x169d6d[_0xa432('0xb2')],'sentAt':moment()[_0xa432('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2188a0['id'],'UserId':_0x2bbba1[_0xa432('0x36')]['id'],'ContactId':_0x317576['id']})]};if(_0x2bbba1['body'][_0xa432('0xb5')]){_0x21769c=_['merge'](_0x21769c,_0x2bbba1[_0xa432('0x63')][_0xa432('0xb5')]);}return db[_0xa432('0x8a')][_0xa432('0x6b')](_0x21769c,{'include':[{'model':db['MailMessage'],'as':_0xa432('0xb6')}]});})[_0xa432('0xe')](respondWithResult(_0x5a9124,null))['catch'](handleError(_0x5a9124,null));};exports[_0xa432('0xb7')]=function(_0x1f7d69,_0x4b1ad1){return db['MailAccount'][_0xa432('0x65')]({'where':{'id':_0x1f7d69[_0xa432('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xa432('0x5f'),'raw':!![],'include':[{'model':db[_0xa432('0xa7')],'as':_0xa432('0xa7'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4b1ad1,null))[_0xa432('0xe')](function(_0x130a6a){if(!_0x130a6a[_0xa432('0x5f')])return;var _0x56abe6=_0x130a6a[_0xa432('0xad')]();return respondWithRpcPromise(_0xa432('0xb8'),_0xa432('0xb7'),{'account':_0x56abe6});})[_0xa432('0xe')](respondWithResult(_0x4b1ad1,null))['catch'](handleError(_0x4b1ad1,null));};exports[_0xa432('0x21')]=function(_0x320533,_0x375080){return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x320533[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x375080,null))['then'](function(_0x27b7dd){if(_0x27b7dd&&_0x27b7dd[_0xa432('0x3e')]){throw new db[(_0xa432('0xb9'))]['ValidationError'](_0xa432('0xba'));}return _0x27b7dd;})[_0xa432('0xe')](removeEntity(_0x375080,null))[_0xa432('0x17')](handleError(_0x375080,null));};exports[_0xa432('0xbb')]=function(_0x3686af,_0x342230){return db[_0xa432('0x46')][_0xa432('0x65')]({'where':{'id':_0x3686af[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x342230,null))['then'](function(_0xb4ce76){if(_0xb4ce76){return _0xb4ce76[_0xa432('0xbb')](_0x3686af[_0xa432('0x63')][_0xa432('0x89')],_[_0xa432('0x88')](_0x3686af['body'],[_0xa432('0x89'),'id'])||{})[_0xa432('0xbc')](function(_0x522424){for(var _0x12e619=0x0;_0x12e619<_0x3686af[_0xa432('0x63')][_0xa432('0x89')][_0xa432('0x51')];_0x12e619+=0x1){socket[_0xa432('0xbd')](_0xa432('0xbe'),{'UserId':Number(_0x3686af['body'][_0xa432('0x89')][_0x12e619]),'MailAccountId':Number(_0x3686af[_0xa432('0x5d')]['id'])});}return _0x522424;});}})[_0xa432('0xe')](respondWithResult(_0x342230,null))[_0xa432('0x17')](handleError(_0x342230,null));};exports[_0xa432('0xbf')]=function(_0x55c11f,_0x4abf36){return db['MailAccount'][_0xa432('0x65')]({'where':{'id':_0x55c11f[_0xa432('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4abf36,null))['then'](function(_0x10148c){if(_0x10148c){return _0x10148c[_0xa432('0xbf')](_0x55c11f[_0xa432('0x4a')][_0xa432('0x89')])['then'](function(){if(_[_0xa432('0xc0')](_0x55c11f['query'][_0xa432('0x89')])){for(var _0x4980d4=0x0;_0x4980d4<_0x55c11f[_0xa432('0x4a')][_0xa432('0x89')][_0xa432('0x51')];_0x4980d4+=0x1){socket['emit'](_0xa432('0xc1'),{'UserId':Number(_0x55c11f[_0xa432('0x4a')][_0xa432('0x89')][_0x4980d4]),'MailAccountId':Number(_0x55c11f[_0xa432('0x5d')]['id'])});}}else{socket['emit'](_0xa432('0xc1'),{'UserId':Number(_0x55c11f[_0xa432('0x4a')][_0xa432('0x89')]),'MailAccountId':Number(_0x55c11f[_0xa432('0x5d')]['id'])});}});}})[_0xa432('0xe')](respondWithStatusCode(_0x4abf36,null))[_0xa432('0x17')](handleError(_0x4abf36,null));};exports[_0xa432('0xc2')]=function(_0xc04acb,_0x2ac657){var _0x3c4815={};var _0xc98608={};var _0x299d01;var _0x491d8f;return db[_0xa432('0x46')][_0xa432('0x6d')]({'where':{'id':_0xc04acb[_0xa432('0x5d')]['id']}})[_0xa432('0xe')](handleEntityNotFound(_0x2ac657,null))[_0xa432('0xe')](function(_0x4f0f18){if(_0x4f0f18){_0x299d01=_0x4f0f18;_0xc98608['model']=_['keys'](db['User'][_0xa432('0x61')]);_0xc98608['query']=_['keys'](_0xc04acb[_0xa432('0x4a')]);_0xc98608[_0xa432('0x4c')]=_[_0xa432('0x4d')](_0xc98608[_0xa432('0x4e')],_0xc98608[_0xa432('0x4a')]);_0x3c4815['attributes']=_[_0xa432('0x4d')](_0xc98608['model'],qs['fields'](_0xc04acb[_0xa432('0x4a')]['fields']));_0x3c4815['attributes']=_0x3c4815[_0xa432('0x50')]['length']?_0x3c4815[_0xa432('0x50')]:_0xc98608[_0xa432('0x4e')];_0x3c4815[_0xa432('0x52')]=qs['sort'](_0xc04acb[_0xa432('0x4a')][_0xa432('0x53')]);_0x3c4815[_0xa432('0x54')]=qs[_0xa432('0x4c')](_['pick'](_0xc04acb[_0xa432('0x4a')],_0xc98608[_0xa432('0x4c')]));if(_0xc04acb[_0xa432('0x4a')][_0xa432('0x56')]){_0x3c4815[_0xa432('0x54')]=_['merge'](_0x3c4815['where'],{'$or':_['map'](_0x3c4815[_0xa432('0x50')],function(_0x37ffea){var _0x140843={};_0x140843[_0x37ffea]={'$like':'%'+_0xc04acb[_0xa432('0x4a')][_0xa432('0x56')]+'%'};return _0x140843;})});}_0x3c4815=_[_0xa432('0x57')]({},_0x3c4815,_0xc04acb[_0xa432('0x58')]);return _0x299d01['getAgents'](_0x3c4815);}})[_0xa432('0xe')](function(_0x5ebeb6){if(_0x5ebeb6){_0x491d8f=_0x5ebeb6['length'];if(!_0xc04acb[_0xa432('0x4a')][_0xa432('0x74')](_0xa432('0x6e'))){_0x3c4815[_0xa432('0x1c')]=qs['limit'](_0xc04acb[_0xa432('0x4a')][_0xa432('0x1c')]);_0x3c4815[_0xa432('0x1a')]=qs[_0xa432('0x1a')](_0xc04acb[_0xa432('0x4a')][_0xa432('0x1a')]);}return _0x299d01['getAgents'](_0x3c4815);}})[_0xa432('0xe')](function(_0x5527e5){if(_0x5527e5){return _0x5527e5?{'count':_0x491d8f,'rows':_0x5527e5}:null;}})['then'](respondWithResult(_0x2ac657,null))[_0xa432('0x17')](handleError(_0x2ac657,null));}; \ No newline at end of file +var _0x439d=['includeAll','include','findAll','rows','params','Pause','intersection','fields','length','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','filter','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','key','custom','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','moment','util','path','lodash','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','destroy','get','MailAccounts','name','gmail','imap.mail.yahoo.com','hotmail','outlook365','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','keys','query','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x439d,0x6f));var _0xd439=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x439d[_0x20c9b2];return _0x2c6030;};'use strict';var moment=require(_0xd439('0x0'));var BPromise=require('bluebird');var util=require(_0xd439('0x1'));var path=require(_0xd439('0x2'));var _=require(_0xd439('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xd439('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xd439('0x5'))['db'];config[_0xd439('0x6')]=_[_0xd439('0x7')](config[_0xd439('0x6')],{'host':_0xd439('0x8'),'port':0x18eb});var socket=require(_0xd439('0x9'))(new Redis(config['redis']));require(_0xd439('0xa'))[_0xd439('0xb')](socket);var jayson=require(_0xd439('0xc'));var client=jayson['client'][_0xd439('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x50afff,_0x52288f,_0x3c1291,_0x2c6992){return new BPromise(function(_0xea7818,_0x5b9fdd){var _0x3bb0fc=_0x2c6992||client;return _0x3bb0fc[_0xd439('0xe')](_0x50afff,_0x3c1291)[_0xd439('0xf')](function(_0x5f12d4){logger[_0xd439('0x10')](_0xd439('0x11'),_0x52288f,'request\x20sent');logger[_0xd439('0x12')](_0xd439('0x13'),_0x52288f,_0xd439('0x14'),JSON['stringify'](_0x5f12d4));if(_0x5f12d4[_0xd439('0x15')]){if(_0x5f12d4[_0xd439('0x15')][_0xd439('0x16')]===0x1f4){logger['error'](_0xd439('0x11'),_0x52288f,_0x5f12d4[_0xd439('0x15')]['message']);return _0x5b9fdd(_0x5f12d4[_0xd439('0x15')][_0xd439('0x17')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x52288f,_0x5f12d4['error'][_0xd439('0x17')]);return _0xea7818(_0x5f12d4['error'][_0xd439('0x17')]);}else{logger[_0xd439('0x10')](_0xd439('0x11'),_0x52288f,_0xd439('0x14'));_0xea7818(_0x5f12d4['result'][_0xd439('0x17')]);}})[_0xd439('0x18')](function(_0x29d296){logger['error']('MailAccount,\x20%s,\x20%s',_0x52288f,_0x29d296);_0x5b9fdd(_0x29d296);});});}function respondWithStatusCode(_0x27ec02,_0x6f9e06){_0x6f9e06=_0x6f9e06||0xcc;return function(_0x24d5e5){if(_0x24d5e5){return _0x27ec02[_0xd439('0x19')](_0x6f9e06);}return _0x27ec02[_0xd439('0x1a')](_0x6f9e06)[_0xd439('0x1b')]();};}function respondWithResult(_0x87c003,_0x485bc9){_0x485bc9=_0x485bc9||0xc8;return function(_0x39cfbd){if(_0x39cfbd){return _0x87c003['status'](_0x485bc9)['json'](_0x39cfbd);}};}function respondWithFilteredResult(_0x150b69,_0x1ae7a6){return function(_0x54714a){if(_0x54714a){var _0x44aa7a=typeof _0x1ae7a6['offset']===_0xd439('0x1c')&&typeof _0x1ae7a6[_0xd439('0x1d')]===_0xd439('0x1c');var _0x5ca223=_0x54714a[_0xd439('0x1e')];var _0x26760f=_0x44aa7a?0x0:_0x1ae7a6[_0xd439('0x1f')];var _0x1bcee4=_0x44aa7a?_0x54714a[_0xd439('0x1e')]:_0x1ae7a6['offset']+_0x1ae7a6[_0xd439('0x1d')];var _0x404959;if(_0x1bcee4>=_0x5ca223){_0x1bcee4=_0x5ca223;_0x404959=0xc8;}else{_0x404959=0xce;}_0x150b69[_0xd439('0x1a')](_0x404959);return _0x150b69[_0xd439('0x20')](_0xd439('0x21'),_0x26760f+'-'+_0x1bcee4+'/'+_0x5ca223)[_0xd439('0x22')](_0x54714a);}return null;};}function saveUpdates(_0x54675f){return function(_0x447052){if(_0x447052){return _0x447052[_0xd439('0x23')](_0x54675f)[_0xd439('0xf')](function(_0x2b220e){return _0x2b220e;});}return null;};}function removeEntity(_0xedd2cd){return function(_0x25c699){if(_0x25c699){return _0x25c699[_0xd439('0x24')]()['then'](function(){var _0x1614f9=_0x25c699[_0xd439('0x25')]({'plain':!![]});var _0x241f62=_0xd439('0x26');return db['UserProfileResource'][_0xd439('0x24')]({'where':{'type':_0x241f62,'resourceId':_0x1614f9['id']}})[_0xd439('0xf')](function(){return _0x25c699;});})[_0xd439('0xf')](function(){_0xedd2cd[_0xd439('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9381){return function(_0x540b94){if(!_0x540b94){_0x5b9381['sendStatus'](0x194);}return _0x540b94;};}function handleError(_0xc10481,_0x12b5f0){_0x12b5f0=_0x12b5f0||0x1f4;return function(_0x2cb34a){logger[_0xd439('0x15')](_0x2cb34a['stack']);if(_0x2cb34a['name']){delete _0x2cb34a[_0xd439('0x27')];}_0xc10481[_0xd439('0x1a')](_0x12b5f0)['send'](_0x2cb34a);};}function getImapHost(_0x1d70ab){switch(_0x1d70ab){case _0xd439('0x28'):return'imap.gmail.com';case'yahoo':return _0xd439('0x29');case _0xd439('0x2a'):return'imap-mail.outlook.com';case _0xd439('0x2b'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x1d70ab);}function getSmtpHost(_0x4f5dc6){switch(_0x4f5dc6){case _0xd439('0x28'):return _0xd439('0x2c');case _0xd439('0x2d'):return _0xd439('0x2e');case'hotmail':return _0xd439('0x2f');case _0xd439('0x2b'):return _0xd439('0x30');}throw new Error(_0xd439('0x31'),_0x4f5dc6);}function getAuthenticationOptions(_0x4bb311,_0x30b80e){var _0x247360={};var _0x18707b={};if(_0x4bb311){_0x247360[_0xd439('0x32')]=_0x18707b[_0xd439('0x32')]=_0x30b80e[_0xd439('0x33')];_0x247360[_0xd439('0x34')]=_0x18707b[_0xd439('0x35')]=_0x30b80e['password'];if(_0x30b80e[_0xd439('0x36')]){_0x247360[_0xd439('0x36')]=_0x18707b[_0xd439('0x36')]=!![];_0x247360[_0xd439('0x37')]=_0x18707b[_0xd439('0x37')]=_0x30b80e['CloudProviderId'];_0x247360['password']=_0x18707b[_0xd439('0x35')]=null;}else{_0x247360[_0xd439('0x37')]=_0x18707b[_0xd439('0x37')]=null;}_0x247360[_0xd439('0x38')]=getImapHost(_0x4bb311);_0x247360[_0xd439('0x39')]=0x3e1;_0x18707b[_0xd439('0x38')]=getSmtpHost(_0x4bb311);_0x18707b[_0xd439('0x39')]=0x24b;_0x18707b[_0xd439('0x3a')]=![];_0x247360['service']=_0x18707b[_0xd439('0x3b')]=null;}else{if(_0x30b80e[_0xd439('0x3c')]){_0x247360[_0xd439('0x32')]=_0x18707b[_0xd439('0x32')]=_0x30b80e[_0xd439('0x33')];_0x247360[_0xd439('0x34')]=_0x18707b[_0xd439('0x35')]=_0x30b80e['password'];}else{_0x247360[_0xd439('0x3c')]=_0x18707b[_0xd439('0x3c')]=![];_0x247360['user']=_0x18707b['user']=null;_0x247360[_0xd439('0x34')]=_0x18707b[_0xd439('0x35')]=null;}_0x247360[_0xd439('0x38')]=_0x30b80e[_0xd439('0x3d')][_0xd439('0x38')];_0x247360[_0xd439('0x39')]=_0x30b80e[_0xd439('0x3d')][_0xd439('0x39')];_0x18707b[_0xd439('0x38')]=_0x30b80e['Smtp'][_0xd439('0x38')];_0x18707b[_0xd439('0x39')]=_0x30b80e[_0xd439('0x3e')][_0xd439('0x39')];}return{'Imap':_0x247360,'Smtp':_0x18707b};}exports[_0xd439('0x3f')]=function(_0x5dc341,_0xf884b){var _0x20e436={'include':[{'model':db[_0xd439('0x40')],'as':_0xd439('0x3d')},{'model':db[_0xd439('0x41')],'as':_0xd439('0x3e')},{'model':db['Pause'],'as':_0xd439('0x42')}]},_0x193b0f={},_0x516ade={'count':0x0,'rows':[]};var _0x46599c=_[_0xd439('0x43')](db[_0xd439('0x44')][_0xd439('0x45')],function(_0x5ec6df){return{'name':_0x5ec6df['fieldName'],'type':_0x5ec6df[_0xd439('0x46')]['key']};});_0x193b0f['model']=_[_0xd439('0x43')](_0x46599c,_0xd439('0x27'));_0x193b0f['query']=_[_0xd439('0x47')](_0x5dc341[_0xd439('0x48')]);_0x193b0f['filters']=_['intersection'](_0x193b0f[_0xd439('0x49')],_0x193b0f[_0xd439('0x48')]);_0x20e436[_0xd439('0x4a')]=_['intersection'](_0x193b0f[_0xd439('0x49')],qs['fields'](_0x5dc341[_0xd439('0x48')]['fields']));_0x20e436[_0xd439('0x4a')]=_0x20e436[_0xd439('0x4a')]['length']?_0x20e436[_0xd439('0x4a')]:_0x193b0f[_0xd439('0x49')];if(!_0x5dc341['query'][_0xd439('0x4b')](_0xd439('0x4c'))){_0x20e436[_0xd439('0x1d')]=qs[_0xd439('0x1d')](_0x5dc341['query'][_0xd439('0x1d')]);_0x20e436[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0x5dc341[_0xd439('0x48')]['offset']);}_0x20e436[_0xd439('0x4d')]=qs['sort'](_0x5dc341[_0xd439('0x48')][_0xd439('0x4e')]);_0x20e436[_0xd439('0x4f')]=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x5dc341[_0xd439('0x48')],_0x193b0f[_0xd439('0x50')]),_0x46599c);if(_0x5dc341[_0xd439('0x48')]['filter']){_0x20e436[_0xd439('0x4f')]=_[_0xd439('0x52')](_0x20e436[_0xd439('0x4f')],{'$or':_['map'](_0x46599c,function(_0x9da4a1){if(_0x9da4a1[_0xd439('0x46')]!=='VIRTUAL'){var _0x588302={};_0x588302[_0x9da4a1[_0xd439('0x27')]]={'$like':'%'+_0x5dc341['query']['filter']+'%'};return _0x588302;}})});}_0x20e436=_[_0xd439('0x52')]({},_0x20e436,_0x5dc341['options']);var _0x47666a={'where':_0x20e436[_0xd439('0x4f')]};return db[_0xd439('0x44')][_0xd439('0x1e')](_0x47666a)[_0xd439('0xf')](function(_0x1cfd36){_0x516ade[_0xd439('0x1e')]=_0x1cfd36;if(_0x5dc341['query'][_0xd439('0x53')]){_0x20e436[_0xd439('0x54')]=[{'all':!![]}];}return db['MailAccount'][_0xd439('0x55')](_0x20e436);})[_0xd439('0xf')](function(_0x26dd37){_0x516ade[_0xd439('0x56')]=_0x26dd37;return _0x516ade;})[_0xd439('0xf')](respondWithFilteredResult(_0xf884b,_0x20e436))[_0xd439('0x18')](handleError(_0xf884b,null));};exports['show']=function(_0x3c1e8f,_0x43c262){var _0x524e44={'raw':![],'where':{'id':_0x3c1e8f[_0xd439('0x57')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xd439('0x3d')},{'model':db['MailServerOut'],'as':_0xd439('0x3e')},{'model':db[_0xd439('0x58')],'as':_0xd439('0x42')}]},_0x162947={};_0x162947[_0xd439('0x49')]=_[_0xd439('0x47')](db['MailAccount'][_0xd439('0x45')]);_0x162947[_0xd439('0x48')]=_['keys'](_0x3c1e8f['query']);_0x162947['filters']=_['intersection'](_0x162947[_0xd439('0x49')],_0x162947[_0xd439('0x48')]);_0x524e44[_0xd439('0x4a')]=_[_0xd439('0x59')](_0x162947['model'],qs[_0xd439('0x5a')](_0x3c1e8f[_0xd439('0x48')]['fields']));_0x524e44[_0xd439('0x4a')]=_0x524e44['attributes'][_0xd439('0x5b')]?_0x524e44[_0xd439('0x4a')]:_0x162947['model'];if(_0x3c1e8f[_0xd439('0x48')][_0xd439('0x53')]){_0x524e44['include']=[{'all':!![]}];}_0x524e44=_['merge']({},_0x524e44,_0x3c1e8f[_0xd439('0x5c')]);return db[_0xd439('0x44')][_0xd439('0x5d')](_0x524e44)[_0xd439('0xf')](handleEntityNotFound(_0x43c262,null))[_0xd439('0xf')](respondWithResult(_0x43c262,null))[_0xd439('0x18')](handleError(_0x43c262,null));};exports[_0xd439('0x23')]=function(_0x153a8e,_0xe89427){if(_0x153a8e[_0xd439('0x5e')]['id']){delete _0x153a8e[_0xd439('0x5e')]['id'];}var _0x29026b=_0x153a8e['body'][_0xd439('0x5f')]==='custom'?null:_0x153a8e[_0xd439('0x5e')]['provider'];var _0x776448=_0x153a8e['body'][_0xd439('0x3d')]||{};var _0x2327d4=_0x153a8e[_0xd439('0x5e')]['Smtp']||{};if(_0x29026b){_0x776448['host']=getImapHost(_0x29026b);_0x776448[_0xd439('0x39')]=0x3e1;_0x2327d4['host']=getSmtpHost(_0x29026b);_0x2327d4[_0xd439('0x39')]=0x24b;_0x2327d4[_0xd439('0x3a')]=![];}if(_0x2327d4[_0xd439('0x36')]){_0x2327d4[_0xd439('0x3a')]=![];}else{_0x2327d4[_0xd439('0x37')]=null;}if(!_0x776448[_0xd439('0x36')])_0x776448[_0xd439('0x37')]=null;_0x153a8e[_0xd439('0x5e')][_0xd439('0x3d')]=_0x776448;_0x153a8e['body'][_0xd439('0x3e')]=_0x2327d4;return db[_0xd439('0x44')]['find']({'where':{'id':_0x153a8e['params']['id']},'include':[{'model':db[_0xd439('0x40')],'as':_0xd439('0x3d')},{'model':db['MailServerOut'],'as':_0xd439('0x3e')},{'model':db[_0xd439('0x58')],'as':_0xd439('0x42')}]})['then'](handleEntityNotFound(_0xe89427,null))[_0xd439('0xf')](function(_0x14091e){if(!_0x14091e)throw new Error(_0xd439('0x60'));if(_0x14091e[_0xd439('0x3b')])delete _0x153a8e[_0xd439('0x5e')][_0xd439('0x3d')];return _0x14091e;})['then'](saveUpdates(_0x153a8e[_0xd439('0x5e')],null))[_0xd439('0xf')](function(_0x10e292){if(!_0x153a8e[_0xd439('0x5e')][_0xd439('0x3d')])return _0x10e292;return db[_0xd439('0x40')][_0xd439('0x23')](_0x153a8e['body'][_0xd439('0x3d')],{'where':{'MailAccountId':_0x10e292['id']}})[_0xd439('0xf')](function(){return _0x10e292;});})[_0xd439('0xf')](function(_0x44ee81){if(!_0x153a8e[_0xd439('0x5e')][_0xd439('0x3e')])return _0x44ee81;return db[_0xd439('0x41')][_0xd439('0x23')](_0x153a8e[_0xd439('0x5e')][_0xd439('0x3e')],{'where':{'MailAccountId':_0x44ee81['id']}})[_0xd439('0xf')](function(){return _0x44ee81;});})[_0xd439('0xf')](respondWithResult(_0xe89427,null))[_0xd439('0x18')](handleError(_0xe89427,null));};exports[_0xd439('0x61')]=function(_0x2180a2,_0x2655cc){return db['MailAccount']['describe']()[_0xd439('0xf')](respondWithResult(_0x2655cc,null))[_0xd439('0x18')](handleError(_0x2655cc,null));};exports[_0xd439('0x62')]=function(_0x33dc4e,_0x322682){if(_0x33dc4e[_0xd439('0x5e')]['id']){delete _0x33dc4e[_0xd439('0x5e')]['id'];}return db['MailAccount'][_0xd439('0x5d')]({'where':{'id':_0x33dc4e['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x322682,null))['then'](function(_0x21c10e){if(_0x21c10e){_0x33dc4e[_0xd439('0x5e')][_0xd439('0x63')]=_0x21c10e['id'];return db[_0xd439('0x64')][_0xd439('0x65')](_0x33dc4e[_0xd439('0x5e')]);}})[_0xd439('0xf')](respondWithResult(_0x322682,null))[_0xd439('0x18')](handleError(_0x322682,null));};exports[_0xd439('0x66')]=function(_0x255ad6,_0x547af7){var _0x50e915={'raw':![],'where':{}};var _0x20ff04={};var _0x4a7c8c={'count':0x0,'rows':[]};return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x255ad6['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x547af7,null))[_0xd439('0xf')](function(_0x298dcd){if(_0x298dcd){_0x20ff04[_0xd439('0x49')]=_['keys'](db[_0xd439('0x64')][_0xd439('0x45')]);_0x20ff04[_0xd439('0x48')]=_['keys'](_0x255ad6[_0xd439('0x48')]);_0x20ff04[_0xd439('0x50')]=_[_0xd439('0x59')](_0x20ff04[_0xd439('0x49')],_0x20ff04['query']);_0x50e915[_0xd439('0x4a')]=_['intersection'](_0x20ff04['model'],qs['fields'](_0x255ad6[_0xd439('0x48')][_0xd439('0x5a')]));_0x50e915['attributes']=_0x50e915[_0xd439('0x4a')][_0xd439('0x5b')]?_0x50e915['attributes']:_0x20ff04['model'];if(!_0x255ad6[_0xd439('0x48')][_0xd439('0x4b')]('nolimit')){_0x50e915['limit']=qs[_0xd439('0x1d')](_0x255ad6[_0xd439('0x48')][_0xd439('0x1d')]);_0x50e915['offset']=qs[_0xd439('0x1f')](_0x255ad6['query'][_0xd439('0x1f')]);}_0x50e915[_0xd439('0x4d')]=qs['sort'](_0x255ad6['query']['sort']);_0x50e915[_0xd439('0x4f')]=qs[_0xd439('0x50')](_['pick'](_0x255ad6[_0xd439('0x48')],_0x20ff04[_0xd439('0x50')]));_0x50e915[_0xd439('0x4f')][_0xd439('0x63')]=_0x298dcd['id'];if(_0x255ad6[_0xd439('0x48')][_0xd439('0x68')]){_0x50e915['where']=_[_0xd439('0x52')](_0x50e915[_0xd439('0x4f')],{'$or':_[_0xd439('0x43')](_0x50e915['attributes'],function(_0x4dd2f3){var _0x48ca1e={};_0x48ca1e[_0x4dd2f3]={'$like':'%'+_0x255ad6[_0xd439('0x48')][_0xd439('0x68')]+'%'};return _0x48ca1e;})});}_0x50e915=_[_0xd439('0x52')]({},_0x50e915,_0x255ad6[_0xd439('0x5c')]);return db['Disposition'][_0xd439('0x1e')]({'where':_0x50e915[_0xd439('0x4f')]})[_0xd439('0xf')](function(_0xc7cca9){_0x4a7c8c[_0xd439('0x1e')]=_0xc7cca9;if(_0x255ad6['query']['includeAll']){_0x50e915['include']=[{'all':!![]}];}return db['Disposition'][_0xd439('0x55')](_0x50e915);})[_0xd439('0xf')](function(_0x516fe3){_0x4a7c8c[_0xd439('0x56')]=_0x516fe3;return _0x4a7c8c;});}})[_0xd439('0xf')](respondWithFilteredResult(_0x547af7,_0x50e915))[_0xd439('0x18')](handleError(_0x547af7,null));};exports[_0xd439('0x69')]=function(_0x3a4ca5,_0x1e70c5){return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x3a4ca5[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x1e70c5,null))[_0xd439('0xf')](function(_0x44e20c){if(_0x44e20c){return _0x44e20c['removeDispositions'](_0x3a4ca5[_0xd439('0x48')][_0xd439('0x6a')]);}})['then'](respondWithStatusCode(_0x1e70c5,null))['catch'](handleError(_0x1e70c5,null));};exports['addAnswer']=function(_0x2587f1,_0x2c20dd){if(_0x2587f1[_0xd439('0x5e')]['id']){delete _0x2587f1[_0xd439('0x5e')]['id'];}return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x2587f1[_0xd439('0x57')]['id']}})['then'](handleEntityNotFound(_0x2c20dd,null))[_0xd439('0xf')](function(_0x81c2d4){if(_0x81c2d4){_0x2587f1[_0xd439('0x5e')][_0xd439('0x63')]=_0x81c2d4['id'];return db[_0xd439('0x6b')][_0xd439('0x65')](_0x2587f1['body']);}})[_0xd439('0xf')](respondWithResult(_0x2c20dd,null))[_0xd439('0x18')](handleError(_0x2c20dd,null));};exports[_0xd439('0x6c')]=function(_0x1b2ed6,_0x54688c){var _0x55eff0={'raw':![],'where':{}};var _0x5d5674={};var _0x105c81={'count':0x0,'rows':[]};return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x1b2ed6['params']['id']}})['then'](handleEntityNotFound(_0x54688c,null))['then'](function(_0x5c36d5){if(_0x5c36d5){_0x5d5674[_0xd439('0x49')]=_[_0xd439('0x47')](db[_0xd439('0x6b')]['rawAttributes']);_0x5d5674[_0xd439('0x48')]=_[_0xd439('0x47')](_0x1b2ed6['query']);_0x5d5674[_0xd439('0x50')]=_['intersection'](_0x5d5674[_0xd439('0x49')],_0x5d5674[_0xd439('0x48')]);_0x55eff0[_0xd439('0x4a')]=_[_0xd439('0x59')](_0x5d5674[_0xd439('0x49')],qs[_0xd439('0x5a')](_0x1b2ed6[_0xd439('0x48')][_0xd439('0x5a')]));_0x55eff0['attributes']=_0x55eff0[_0xd439('0x4a')][_0xd439('0x5b')]?_0x55eff0[_0xd439('0x4a')]:_0x5d5674['model'];if(!_0x1b2ed6[_0xd439('0x48')][_0xd439('0x4b')](_0xd439('0x4c'))){_0x55eff0[_0xd439('0x1d')]=qs[_0xd439('0x1d')](_0x1b2ed6[_0xd439('0x48')]['limit']);_0x55eff0['offset']=qs['offset'](_0x1b2ed6[_0xd439('0x48')][_0xd439('0x1f')]);}_0x55eff0['order']=qs[_0xd439('0x4e')](_0x1b2ed6['query']['sort']);_0x55eff0['where']=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x1b2ed6['query'],_0x5d5674[_0xd439('0x50')]));_0x55eff0['where'][_0xd439('0x63')]=_0x5c36d5['id'];if(_0x1b2ed6['query'][_0xd439('0x68')]){_0x55eff0['where']=_[_0xd439('0x52')](_0x55eff0[_0xd439('0x4f')],{'$or':_['map'](_0x55eff0[_0xd439('0x4a')],function(_0x80b3c8){var _0x3a27d7={};_0x3a27d7[_0x80b3c8]={'$like':'%'+_0x1b2ed6[_0xd439('0x48')]['filter']+'%'};return _0x3a27d7;})});}_0x55eff0=_[_0xd439('0x52')]({},_0x55eff0,_0x1b2ed6[_0xd439('0x5c')]);return db[_0xd439('0x6b')][_0xd439('0x1e')]({'where':_0x55eff0['where']})[_0xd439('0xf')](function(_0x215643){_0x105c81[_0xd439('0x1e')]=_0x215643;if(_0x1b2ed6[_0xd439('0x48')][_0xd439('0x53')]){_0x55eff0[_0xd439('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x55eff0);})[_0xd439('0xf')](function(_0x52f770){_0x105c81[_0xd439('0x56')]=_0x52f770;return _0x105c81;});}})[_0xd439('0xf')](respondWithFilteredResult(_0x54688c,_0x55eff0))[_0xd439('0x18')](handleError(_0x54688c,null));};exports[_0xd439('0x6d')]=function(_0x293b05,_0x25b4fa){return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x293b05[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x25b4fa,null))[_0xd439('0xf')](function(_0x42c6ab){if(_0x42c6ab){return _0x42c6ab['removeAnswers'](_0x293b05[_0xd439('0x48')][_0xd439('0x6a')]);}})[_0xd439('0xf')](respondWithStatusCode(_0x25b4fa,null))[_0xd439('0x18')](handleError(_0x25b4fa,null));};exports['create']=function(_0xd5023b,_0x37cdb5){var _0x4dbd93={'name':_0xd5023b[_0xd439('0x5e')][_0xd439('0x27')],'key':_0xd5023b[_0xd439('0x5e')][_0xd439('0x6e')],'provider':_0xd5023b[_0xd439('0x5e')][_0xd439('0x5f')]===_0xd439('0x6f')?null:_0xd5023b['body'][_0xd439('0x5f')],'email':_0xd5023b[_0xd439('0x5e')][_0xd439('0x70')],'ListId':_0xd5023b[_0xd439('0x5e')][_0xd439('0x71')],'active':!_[_0xd439('0x72')](_0xd5023b['body'][_0xd439('0x73')])?_0xd5023b[_0xd439('0x5e')][_0xd439('0x73')]:!![],'description':_0xd5023b[_0xd439('0x5e')]['description']||null};var _0x8532ed=getAuthenticationOptions(_0x4dbd93[_0xd439('0x5f')],_0xd5023b[_0xd439('0x5e')]);_0x4dbd93['Imap']=_0x8532ed[_0xd439('0x3d')];_0x4dbd93[_0xd439('0x3e')]=_0x8532ed[_0xd439('0x3e')];return db['MailAccount'][_0xd439('0x65')](_0x4dbd93,{'include':[{'model':db[_0xd439('0x41')],'as':_0xd439('0x3e')},{'model':db[_0xd439('0x40')],'as':_0xd439('0x3d')}]})[_0xd439('0xf')](function(_0x4a8101){var _0x123821=_0xd5023b[_0xd439('0x32')][_0xd439('0x25')]({'plain':!![]});if(!_0x123821)throw new Error(_0xd439('0x74'));if(_0x123821[_0xd439('0x75')]===_0xd439('0x32')){var _0x57cef7=_0x4a8101[_0xd439('0x25')]({'plain':!![]});return db[_0xd439('0x76')][_0xd439('0x5d')]({'where':{'name':_0xd439('0x26'),'userProfileId':_0x123821['userProfileId']},'raw':!![]})[_0xd439('0xf')](function(_0x566ba7){if(_0x566ba7&&_0x566ba7['autoAssociation']===0x0){return db[_0xd439('0x77')][_0xd439('0x65')]({'name':_0x57cef7[_0xd439('0x27')],'resourceId':_0x57cef7['id'],'type':_0x566ba7[_0xd439('0x27')],'sectionId':_0x566ba7['id']},{})[_0xd439('0xf')](function(){return _0x4a8101;});}else{return _0x4a8101;}})[_0xd439('0x18')](function(_0x27fa1b){logger[_0xd439('0x15')](_0xd439('0x78'),_0x27fa1b);throw _0x27fa1b;});}return _0x4a8101;})['then'](respondWithResult(_0x37cdb5,0xc9))[_0xd439('0x18')](handleError(_0x37cdb5,null));};exports[_0xd439('0x79')]=function(_0x3a7b0a,_0x2c9ad8){return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x3a7b0a[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x2c9ad8,null))[_0xd439('0xf')](function(_0x11ce7f){if(_0x11ce7f){return _0x11ce7f['getImap']();}return null;})[_0xd439('0xf')](respondWithResult(_0x2c9ad8,null))['catch'](handleError(_0x2c9ad8,null));};exports['addImap']=function(_0x18f12e,_0x30138d){if(_0x18f12e[_0xd439('0x5e')]['id']){delete _0x18f12e['body']['id'];}return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x18f12e['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x30138d,null))[_0xd439('0xf')](function(_0x17c019){if(_0x17c019){_0x18f12e['body'][_0xd439('0x63')]=_0x17c019['id'];return db[_0xd439('0x40')]['create'](_0x18f12e[_0xd439('0x5e')]);}})[_0xd439('0xf')](respondWithResult(_0x30138d,null))[_0xd439('0x18')](handleError(_0x30138d,null));};exports[_0xd439('0x7a')]=function(_0x235299,_0x10e1f7){return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x235299[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x10e1f7,null))['then'](function(_0x39bed9){if(_0x39bed9){return _0x39bed9['setImap'](null);}return null;})[_0xd439('0xf')](respondWithStatusCode(_0x10e1f7,null))[_0xd439('0x18')](handleError(_0x10e1f7,null));};exports[_0xd439('0x7b')]=function(_0x5a99ab,_0x1a4bc1){return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x5a99ab['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x1a4bc1,null))['then'](function(_0x42c0ed){if(_0x42c0ed){return _0x42c0ed[_0xd439('0x7b')]();}return null;})['then'](respondWithResult(_0x1a4bc1,null))[_0xd439('0x18')](handleError(_0x1a4bc1,null));};exports[_0xd439('0x7c')]=function(_0x313d2a,_0x3c37d7){if(_0x313d2a[_0xd439('0x5e')]['id']){delete _0x313d2a['body']['id'];}return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x313d2a[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x3c37d7,null))[_0xd439('0xf')](function(_0x343e8b){if(_0x343e8b){_0x313d2a[_0xd439('0x5e')]['MailAccountId']=_0x343e8b['id'];return db[_0xd439('0x41')]['create'](_0x313d2a[_0xd439('0x5e')]);}})[_0xd439('0xf')](respondWithResult(_0x3c37d7,null))['catch'](handleError(_0x3c37d7,null));};exports['removeSmtp']=function(_0x20c63c,_0xbeb9c7){return db['MailAccount'][_0xd439('0x67')]({'where':{'id':_0x20c63c['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0xbeb9c7,null))[_0xd439('0xf')](function(_0x47811c){if(_0x47811c){return _0x47811c[_0xd439('0x7d')](null);}return null;})[_0xd439('0xf')](respondWithStatusCode(_0xbeb9c7,null))[_0xd439('0x18')](handleError(_0xbeb9c7,null));};exports['addInteraction']=function(_0x449c43,_0x427c03){return db[_0xd439('0x7e')][_0xd439('0x5d')]({'where':{'id':_0x449c43[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x427c03,null))[_0xd439('0xf')](function(_0x2b5dde){if(_0x2b5dde){return _0x2b5dde[_0xd439('0x7f')](_0x449c43['body'][_0xd439('0x6a')],_[_0xd439('0x80')](_0x449c43[_0xd439('0x5e')],[_0xd439('0x6a'),'id'])||{});}})[_0xd439('0xf')](respondWithResult(_0x427c03,null))[_0xd439('0x18')](handleError(_0x427c03,null));};exports[_0xd439('0x81')]=function(_0x1bdad5,_0x127285){var _0x399bb5={'raw':![],'where':{}};var _0x241dc6={};var _0x57cc18={'count':0x0,'rows':[]};return db[_0xd439('0x44')]['findOne']({'where':{'id':_0x1bdad5[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x127285,null))[_0xd439('0xf')](function(_0x18ec9c){if(_0x18ec9c){_0x241dc6[_0xd439('0x49')]=_[_0xd439('0x47')](db[_0xd439('0x7e')]['rawAttributes']);_0x241dc6[_0xd439('0x48')]=_[_0xd439('0x47')](_0x1bdad5[_0xd439('0x48')]);_0x241dc6['filters']=_[_0xd439('0x59')](_0x241dc6[_0xd439('0x49')],_0x241dc6['query']);_0x399bb5[_0xd439('0x4a')]=_[_0xd439('0x59')](_0x241dc6[_0xd439('0x49')],qs['fields'](_0x1bdad5[_0xd439('0x48')][_0xd439('0x5a')]));_0x399bb5[_0xd439('0x4a')]=_0x399bb5[_0xd439('0x4a')][_0xd439('0x5b')]?_0x399bb5[_0xd439('0x4a')]:_0x241dc6[_0xd439('0x49')];if(!_0x1bdad5[_0xd439('0x48')]['hasOwnProperty'](_0xd439('0x4c'))){_0x399bb5['limit']=qs['limit'](_0x1bdad5[_0xd439('0x48')][_0xd439('0x1d')]);_0x399bb5[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0x1bdad5[_0xd439('0x48')][_0xd439('0x1f')]);}_0x399bb5[_0xd439('0x4d')]=qs[_0xd439('0x4e')](_0x1bdad5['query']['sort']);_0x399bb5[_0xd439('0x4f')]=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x1bdad5['query'],_0x241dc6[_0xd439('0x50')]));_0x399bb5[_0xd439('0x4f')][_0xd439('0x63')]=_0x18ec9c['id'];if(_0x1bdad5[_0xd439('0x48')][_0xd439('0x68')]){_0x399bb5[_0xd439('0x4f')]=_[_0xd439('0x52')](_0x399bb5[_0xd439('0x4f')],{'$or':_['map'](_0x399bb5[_0xd439('0x4a')],function(_0x4d461e){var _0x1ffc58={};_0x1ffc58[_0x4d461e]={'$like':'%'+_0x1bdad5[_0xd439('0x48')][_0xd439('0x68')]+'%'};return _0x1ffc58;})});}_0x399bb5=_[_0xd439('0x52')]({},_0x399bb5,_0x1bdad5[_0xd439('0x5c')]);return db[_0xd439('0x7e')][_0xd439('0x1e')]({'where':_0x399bb5[_0xd439('0x4f')]})[_0xd439('0xf')](function(_0x3357d2){_0x57cc18[_0xd439('0x1e')]=_0x3357d2;if(_0x1bdad5[_0xd439('0x48')]['includeAll']){_0x399bb5[_0xd439('0x54')]=[{'model':db[_0xd439('0x82')],'as':_0xd439('0x83'),'required':![]},{'model':db[_0xd439('0x84')],'as':_0xd439('0x85'),'attributes':[_0xd439('0x27'),_0xd439('0x86'),_0xd439('0x87')],'required':![]},{'model':db[_0xd439('0x88')],'as':_0xd439('0x89'),'attributes':['id',_0xd439('0x27'),_0xd439('0x8a')],'where':_0x1bdad5['query'][_0xd439('0x8b')]?{'id':_0x1bdad5[_0xd439('0x48')][_0xd439('0x8b')]}:undefined,'required':_0x1bdad5[_0xd439('0x48')][_0xd439('0x8b')]?!![]:![]}];}return db['MailInteraction'][_0xd439('0x55')](_0x399bb5);})['then'](function(_0x493b3d){_0x57cc18[_0xd439('0x56')]=_0x493b3d;return _0x57cc18;});}})[_0xd439('0xf')](respondWithFilteredResult(_0x127285,_0x399bb5))[_0xd439('0x18')](handleError(_0x127285,null));};exports[_0xd439('0x8c')]=function addApplications(_0xd0bbbd,_0x49ce06){var _0x27e091=_0xd0bbbd[_0xd439('0x57')]['id'];var _0x439625=_0xd0bbbd[_0xd439('0x5e')];var _0x12dea5=0xc8;var _0x3c68a2=null;return db[_0xd439('0x8d')][_0xd439('0x8e')]({'isolationLevel':db[_0xd439('0x8d')][_0xd439('0x8f')][_0xd439('0x90')][_0xd439('0x91')]},function(_0x1204e1){return db['MailAccount'][_0xd439('0x67')]({'where':{'id':_0x27e091},'transaction':_0x1204e1})[_0xd439('0xf')](function(_0x3faa59){if(_0x3faa59){return db[_0xd439('0x92')][_0xd439('0x24')]({'where':{'MailAccountId':_0x27e091},'transaction':_0x1204e1})[_0xd439('0xf')](function(){var _0x594c23=_[_0xd439('0x43')](_0x439625,function(_0xddc35e){_0xddc35e[_0xd439('0x63')]=_0x27e091;return _0xddc35e;});return db[_0xd439('0x92')]['bulkCreate'](_0x594c23,{'transaction':_0x1204e1});});}else{_0x12dea5=0x194;_0x3c68a2=[];}});})[_0xd439('0xf')](function(){if(_0x12dea5!==0x194){return db[_0xd439('0x92')][_0xd439('0x93')]({'where':{'MailAccountId':_0x27e091},'order':_0xd439('0x94')})[_0xd439('0xf')](function(_0x2d98c7){_0x3c68a2=_0x2d98c7;});}})[_0xd439('0x18')](function(_0x25b776){_0x12dea5=0x1f4;logger[_0xd439('0x15')](_0x25b776[_0xd439('0x95')]);if(_0x25b776['name']){delete _0x25b776[_0xd439('0x27')];}_0x3c68a2=_0x25b776;})['finally'](function(){if(_0x3c68a2===null){_0x49ce06[_0xd439('0x19')](_0x12dea5);}else{if(_0x12dea5===0x1f4){_0x49ce06[_0xd439('0x1a')](_0x12dea5)[_0xd439('0x96')](_0x3c68a2);}else{_0x49ce06[_0xd439('0x1a')](_0x12dea5)[_0xd439('0x22')](_0x3c68a2);}}});};exports['getApplications']=function(_0xce66f4,_0x3f1668){var _0x2448b5={};var _0x160926={};var _0x258b22;var _0x36ee40;return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0xce66f4[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x3f1668,null))[_0xd439('0xf')](function(_0xae1575){if(_0xae1575){_0x258b22=_0xae1575;_0x160926['model']=_['keys'](db[_0xd439('0x92')]['rawAttributes']);_0x160926[_0xd439('0x48')]=_[_0xd439('0x47')](_0xce66f4[_0xd439('0x48')]);_0x160926[_0xd439('0x50')]=_[_0xd439('0x59')](_0x160926['model'],_0x160926[_0xd439('0x48')]);_0x2448b5['attributes']=_[_0xd439('0x59')](_0x160926[_0xd439('0x49')],qs[_0xd439('0x5a')](_0xce66f4[_0xd439('0x48')][_0xd439('0x5a')]));_0x2448b5['attributes']=_0x2448b5[_0xd439('0x4a')][_0xd439('0x5b')]?_0x2448b5[_0xd439('0x4a')]:_0x160926[_0xd439('0x49')];_0x2448b5[_0xd439('0x4d')]=qs[_0xd439('0x4e')](_0xce66f4[_0xd439('0x48')][_0xd439('0x4e')]);_0x2448b5[_0xd439('0x4f')]=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0xce66f4[_0xd439('0x48')],_0x160926['filters']));if(_0xce66f4[_0xd439('0x48')][_0xd439('0x68')]){_0x2448b5['where']=_[_0xd439('0x52')](_0x2448b5[_0xd439('0x4f')],{'$or':_[_0xd439('0x43')](_0x2448b5[_0xd439('0x4a')],function(_0xf572a){var _0x26444c={};_0x26444c[_0xf572a]={'$like':'%'+_0xce66f4[_0xd439('0x48')][_0xd439('0x68')]+'%'};return _0x26444c;})});}_0x2448b5=_[_0xd439('0x52')]({},_0x2448b5,_0xce66f4[_0xd439('0x5c')]);return _0x258b22[_0xd439('0x97')](_0x2448b5);}})[_0xd439('0xf')](function(_0x1c5d3d){if(_0x1c5d3d){_0x36ee40=_0x1c5d3d[_0xd439('0x5b')];if(!_0xce66f4[_0xd439('0x48')][_0xd439('0x4b')](_0xd439('0x4c'))){_0x2448b5['limit']=qs[_0xd439('0x1d')](_0xce66f4[_0xd439('0x48')][_0xd439('0x1d')]);_0x2448b5[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0xce66f4[_0xd439('0x48')][_0xd439('0x1f')]);}return _0x258b22[_0xd439('0x97')](_0x2448b5);}})[_0xd439('0xf')](function(_0x55acbc){if(_0x55acbc){return _0x55acbc?{'count':_0x36ee40,'rows':_0x55acbc}:null;}})[_0xd439('0xf')](respondWithResult(_0x3f1668,null))['catch'](handleError(_0x3f1668,null));};exports[_0xd439('0x98')]=function(_0x66f156,_0x1358ae){var _0x23a2ef={'raw':!![],'where':{}};var _0x2c27fd={};var _0x4175e3={'count':0x0,'rows':[]};return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x66f156[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x1358ae,null))[_0xd439('0xf')](function(_0x96b34){if(_0x96b34){_0x2c27fd[_0xd439('0x49')]=_[_0xd439('0x47')](db[_0xd439('0x99')][_0xd439('0x45')]);_0x2c27fd[_0xd439('0x48')]=_[_0xd439('0x47')](_0x66f156['query']);_0x2c27fd[_0xd439('0x50')]=_[_0xd439('0x59')](_0x2c27fd[_0xd439('0x49')],_0x2c27fd[_0xd439('0x48')]);_0x23a2ef[_0xd439('0x4a')]=_[_0xd439('0x59')](_0x2c27fd['model'],qs[_0xd439('0x5a')](_0x66f156['query']['fields']));_0x23a2ef[_0xd439('0x4a')]=_0x23a2ef[_0xd439('0x4a')][_0xd439('0x5b')]?_0x23a2ef[_0xd439('0x4a')]:_0x2c27fd[_0xd439('0x49')];if(!_0x66f156[_0xd439('0x48')][_0xd439('0x4b')]('nolimit')){_0x23a2ef[_0xd439('0x1d')]=qs[_0xd439('0x1d')](_0x66f156[_0xd439('0x48')][_0xd439('0x1d')]);_0x23a2ef[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0x66f156[_0xd439('0x48')][_0xd439('0x1f')]);}_0x23a2ef[_0xd439('0x4d')]=qs['sort'](_0x66f156['query']['sort']);_0x23a2ef[_0xd439('0x4f')]=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x66f156[_0xd439('0x48')],_0x2c27fd['filters']));_0x23a2ef[_0xd439('0x4f')][_0xd439('0x63')]=_0x96b34['id'];if(_0x66f156[_0xd439('0x48')][_0xd439('0x68')]){_0x23a2ef[_0xd439('0x4f')]=_['merge'](_0x23a2ef[_0xd439('0x4f')],{'$or':_['map'](_0x23a2ef[_0xd439('0x4a')],function(_0x306715){var _0x4d572d={};_0x4d572d[_0x306715]={'$like':'%'+_0x66f156['query']['filter']+'%'};return _0x4d572d;})});}if(_0x66f156['query'][_0xd439('0x9a')]){var _0x54886e=_0x66f156[_0xd439('0x48')]['$gte'][_0xd439('0x9b')](',');var _0x3bdf8e={};_0x3bdf8e[_0x54886e[0x0]]={'$gte':moment(_0x54886e[0x1])[_0xd439('0x9c')](_0xd439('0x9d'))};_0x23a2ef[_0xd439('0x4f')]=_[_0xd439('0x52')](_0x23a2ef[_0xd439('0x4f')],_0x3bdf8e);}_0x23a2ef=_[_0xd439('0x52')]({},_0x23a2ef,_0x66f156[_0xd439('0x5c')]);return db[_0xd439('0x99')][_0xd439('0x1e')]({'where':_0x23a2ef[_0xd439('0x4f')]})[_0xd439('0xf')](function(_0x231298){_0x4175e3['count']=_0x231298;if(_0x66f156[_0xd439('0x48')][_0xd439('0x53')]){_0x23a2ef[_0xd439('0x54')]=[{'all':!![]}];}return db[_0xd439('0x99')][_0xd439('0x55')](_0x23a2ef);})[_0xd439('0xf')](function(_0x43d282){if(_0x66f156[_0xd439('0x48')][_0xd439('0x9e')]===_0xd439('0x9f')){for(var _0xe4d9ef=0x0;_0xe4d9ef<_0x43d282[_0xd439('0x5b')];_0xe4d9ef++){_0x43d282[_0xe4d9ef][_0xd439('0x5e')]=juice(_0x43d282[_0xe4d9ef]['body']);}}_0x4175e3[_0xd439('0x56')]=_0x43d282;return _0x4175e3;});}})[_0xd439('0xf')](respondWithFilteredResult(_0x1358ae,_0x23a2ef))['catch'](handleError(_0x1358ae,null));};exports[_0xd439('0x96')]=function(_0x5b6838,_0x6d5799){var _0x1174af,_0x45d4a5={},_0x13918c;if(_0x5b6838[_0xd439('0x5e')]['to']){_0x13918c=_0x5b6838['body']['to'][_0xd439('0x9b')](',')[0x0];}return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x5b6838[_0xd439('0x57')]['id']},'include':[{'model':db[_0xd439('0xa0')],'as':_0xd439('0xa1'),'include':[{'model':db[_0xd439('0x82')],'as':_0xd439('0xa2'),'where':{'email':_0x13918c},'limit':0x1,'order':[[_0xd439('0xa3'),_0xd439('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0xd439('0x3e'),'raw':!![],'include':[{'model':db[_0xd439('0xa5')],'as':_0xd439('0xa5'),'raw':!![]}]}]})[_0xd439('0xf')](handleEntityNotFound(_0x6d5799,null))[_0xd439('0xf')](function(_0x527a77){if(!_0x527a77)return;_0x1174af=_0x527a77;if(!_0x527a77['Smtp'])throw new Error(_0xd439('0xa6'));if(_[_0xd439('0x72')](_0x5b6838[_0xd439('0x5e')][_0xd439('0xa7')])){_0x5b6838[_0xd439('0x5e')][_0xd439('0xa7')]=util[_0xd439('0x9c')](_0xd439('0xa8'),_0x527a77[_0xd439('0x27')],_0x527a77[_0xd439('0x70')]||_0x527a77[_0xd439('0x3e')][_0xd439('0x32')]);}if(_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')]&&_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')][_0xd439('0x5b')]){for(var _0x32a467=0x0;_0x32a467<_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')][_0xd439('0x5b')];_0x32a467+=0x1){_0x5b6838['body']['attachments'][_0x32a467]={'filename':_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')][_0x32a467]['name'],'path':path[_0xd439('0xaa')](config[_0xd439('0xab')],_0xd439('0xac'),_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')][_0x32a467][_0xd439('0xad')])};}}var _0x13d5d6=_0x527a77[_0xd439('0xae')]();return respondWithRpcPromise(_0xd439('0xaf'),_0xd439('0xb0'),{'account':_0x13d5d6,'message':_0x5b6838[_0xd439('0x5e')]});})['then'](function(_0x1eee24){if(!_0x1eee24)return;_0x45d4a5=_0x1eee24;if(!_0x1174af[_0xd439('0xa1')])throw new Error('List\x20not\x20found');if(_0x1174af[_0xd439('0xa1')][_0xd439('0xa2')][_0xd439('0x5b')])return _0x1174af[_0xd439('0xa1')]['Contacts'][0x0];return db[_0xd439('0x82')][_0xd439('0x65')](_[_0xd439('0x7')](_0x5b6838[_0xd439('0x5e')],{'firstName':_0x5b6838['body']['to'],'email':_0x5b6838[_0xd439('0x5e')]['to'],'phone':_0x5b6838[_0xd439('0x5e')]['to'],'ListId':_0x1174af[_0xd439('0x71')]}));})[_0xd439('0xf')](function(_0x41f4f8){if(!_0x41f4f8)return;var _0x2e8d0c={'UserId':_0x5b6838[_0xd439('0x32')]['id'],'ContactId':_0x41f4f8['id'],'MailAccountId':_0x1174af['id'],'inReplyTo':_0x45d4a5['messageId'],'to':_0x5b6838[_0xd439('0x5e')][_0xd439('0xa7')],'cc':_0x5b6838[_0xd439('0x5e')]['cc'],'subject':_0x5b6838[_0xd439('0x5e')][_0xd439('0xb1')],'attach':_0x5b6838[_0xd439('0x5e')][_0xd439('0xb2')],'firstMsgDirection':_0xd439('0xb3'),'lastMsgAt':moment()[_0xd439('0x9c')](_0xd439('0x9d')),'lastMsgDirection':_0xd439('0xb3'),'Messages':[_[_0xd439('0x52')](_0x5b6838[_0xd439('0x5e')],{'messageId':_0x45d4a5['messageId'],'sentAt':moment()['format'](_0xd439('0x9d')),'read':!![],'MailAccountId':_0x1174af['id'],'UserId':_0x5b6838['user']['id'],'ContactId':_0x41f4f8['id']})]};if(_0x5b6838[_0xd439('0x5e')][_0xd439('0xb4')]){_0x2e8d0c=_[_0xd439('0x52')](_0x2e8d0c,_0x5b6838[_0xd439('0x5e')][_0xd439('0xb4')]);}return db[_0xd439('0x7e')][_0xd439('0x65')](_0x2e8d0c,{'include':[{'model':db[_0xd439('0x99')],'as':_0xd439('0xb5')}]});})[_0xd439('0xf')](respondWithResult(_0x6d5799,null))[_0xd439('0x18')](handleError(_0x6d5799,null));};exports[_0xd439('0xb6')]=function(_0xcbf6ba,_0x287c4d){return db[_0xd439('0x44')]['find']({'where':{'id':_0xcbf6ba[_0xd439('0x57')]['id']},'include':[{'model':db[_0xd439('0x41')],'as':_0xd439('0x3e'),'raw':!![],'include':[{'model':db[_0xd439('0xa5')],'as':_0xd439('0xa5'),'raw':!![]}]}]})[_0xd439('0xf')](handleEntityNotFound(_0x287c4d,null))[_0xd439('0xf')](function(_0x396528){if(!_0x396528[_0xd439('0x3e')])return;var _0x4e676a=_0x396528[_0xd439('0xae')]();return respondWithRpcPromise(_0xd439('0xb7'),'verifySmtp',{'account':_0x4e676a});})['then'](respondWithResult(_0x287c4d,null))[_0xd439('0x18')](handleError(_0x287c4d,null));};exports['destroy']=function(_0x3678e0,_0x55f06b){return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x3678e0['params']['id']}})['then'](handleEntityNotFound(_0x55f06b,null))['then'](function(_0x270784){if(_0x270784&&_0x270784[_0xd439('0x3b')]){throw new db[(_0xd439('0xb8'))][(_0xd439('0xb9'))](_0xd439('0xba'));}return _0x270784;})['then'](removeEntity(_0x55f06b,null))[_0xd439('0x18')](handleError(_0x55f06b,null));};exports[_0xd439('0xbb')]=function(_0x16ccfe,_0x2c2c7f){return db['MailAccount'][_0xd439('0x5d')]({'where':{'id':_0x16ccfe[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x2c2c7f,null))['then'](function(_0x245bc6){if(_0x245bc6){return _0x245bc6['addAgents'](_0x16ccfe[_0xd439('0x5e')][_0xd439('0x6a')],_['omit'](_0x16ccfe[_0xd439('0x5e')],[_0xd439('0x6a'),'id'])||{})[_0xd439('0xbc')](function(_0x55d44d){for(var _0x5c0222=0x0;_0x5c0222<_0x16ccfe[_0xd439('0x5e')][_0xd439('0x6a')][_0xd439('0x5b')];_0x5c0222+=0x1){socket['emit'](_0xd439('0xbd'),{'UserId':Number(_0x16ccfe[_0xd439('0x5e')][_0xd439('0x6a')][_0x5c0222]),'MailAccountId':Number(_0x16ccfe[_0xd439('0x57')]['id'])});}return _0x55d44d;});}})['then'](respondWithResult(_0x2c2c7f,null))[_0xd439('0x18')](handleError(_0x2c2c7f,null));};exports['removeAgents']=function(_0x4a5b8f,_0x54a9a0){return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x4a5b8f[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x54a9a0,null))[_0xd439('0xf')](function(_0x2a35f7){if(_0x2a35f7){return _0x2a35f7[_0xd439('0xbe')](_0x4a5b8f['query'][_0xd439('0x6a')])['then'](function(){if(_['isArray'](_0x4a5b8f[_0xd439('0x48')]['ids'])){for(var _0x58d173=0x0;_0x58d173<_0x4a5b8f['query'][_0xd439('0x6a')][_0xd439('0x5b')];_0x58d173+=0x1){socket[_0xd439('0xbf')](_0xd439('0xc0'),{'UserId':Number(_0x4a5b8f[_0xd439('0x48')][_0xd439('0x6a')][_0x58d173]),'MailAccountId':Number(_0x4a5b8f[_0xd439('0x57')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x4a5b8f[_0xd439('0x48')][_0xd439('0x6a')]),'MailAccountId':Number(_0x4a5b8f[_0xd439('0x57')]['id'])});}});}})[_0xd439('0xf')](respondWithStatusCode(_0x54a9a0,null))[_0xd439('0x18')](handleError(_0x54a9a0,null));};exports[_0xd439('0xc1')]=function(_0x52fa26,_0x1dd535){var _0x5f0a37={};var _0x57be36={};var _0x1a3e0e;var _0x1093a8;return db[_0xd439('0x44')]['findOne']({'where':{'id':_0x52fa26['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x1dd535,null))[_0xd439('0xf')](function(_0x32b857){if(_0x32b857){_0x1a3e0e=_0x32b857;_0x57be36['model']=_[_0xd439('0x47')](db[_0xd439('0x84')][_0xd439('0x45')]);_0x57be36['query']=_[_0xd439('0x47')](_0x52fa26[_0xd439('0x48')]);_0x57be36[_0xd439('0x50')]=_[_0xd439('0x59')](_0x57be36[_0xd439('0x49')],_0x57be36[_0xd439('0x48')]);_0x5f0a37['attributes']=_['intersection'](_0x57be36[_0xd439('0x49')],qs[_0xd439('0x5a')](_0x52fa26[_0xd439('0x48')][_0xd439('0x5a')]));_0x5f0a37[_0xd439('0x4a')]=_0x5f0a37[_0xd439('0x4a')][_0xd439('0x5b')]?_0x5f0a37[_0xd439('0x4a')]:_0x57be36[_0xd439('0x49')];_0x5f0a37[_0xd439('0x4d')]=qs[_0xd439('0x4e')](_0x52fa26[_0xd439('0x48')][_0xd439('0x4e')]);_0x5f0a37['where']=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x52fa26[_0xd439('0x48')],_0x57be36['filters']));if(_0x52fa26['query']['filter']){_0x5f0a37[_0xd439('0x4f')]=_['merge'](_0x5f0a37[_0xd439('0x4f')],{'$or':_['map'](_0x5f0a37[_0xd439('0x4a')],function(_0x40d9de){var _0x378884={};_0x378884[_0x40d9de]={'$like':'%'+_0x52fa26[_0xd439('0x48')][_0xd439('0x68')]+'%'};return _0x378884;})});}_0x5f0a37=_[_0xd439('0x52')]({},_0x5f0a37,_0x52fa26['options']);return _0x1a3e0e[_0xd439('0xc1')](_0x5f0a37);}})[_0xd439('0xf')](function(_0x19c568){if(_0x19c568){_0x1093a8=_0x19c568[_0xd439('0x5b')];if(!_0x52fa26[_0xd439('0x48')][_0xd439('0x4b')](_0xd439('0x4c'))){_0x5f0a37[_0xd439('0x1d')]=qs[_0xd439('0x1d')](_0x52fa26['query']['limit']);_0x5f0a37[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0x52fa26[_0xd439('0x48')]['offset']);}return _0x1a3e0e[_0xd439('0xc1')](_0x5f0a37);}})[_0xd439('0xf')](function(_0x3e8922){if(_0x3e8922){return _0x3e8922?{'count':_0x1093a8,'rows':_0x3e8922}:null;}})[_0xd439('0xf')](respondWithResult(_0x1dd535,null))[_0xd439('0x18')](handleError(_0x1dd535,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1398093..748a006 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 _0xf7f7=['hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners','remove','emit'];(function(_0x11a62d,_0x5c35eb){var _0x1f320e=function(_0x1cc7b3){while(--_0x1cc7b3){_0x11a62d['push'](_0x11a62d['shift']());}};_0x1f320e(++_0x5c35eb);}(_0xf7f7,0x192));var _0x7f7f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xf7f7[_0x9cd4c3];return _0x4c9025;};'use strict';var EventEmitter=require(_0x7f7f('0x0'));var MailAccount=require(_0x7f7f('0x1'))['db'][_0x7f7f('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7f7f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7f7f('0x4')};function emitEvent(_0x309eac){return function(_0x5cc4bf,_0x452c5f,_0x5d01b9){MailAccountEvents[_0x7f7f('0x5')](_0x309eac+':'+_0x5cc4bf['id'],_0x5cc4bf);MailAccountEvents[_0x7f7f('0x5')](_0x309eac,_0x5cc4bf);_0x5d01b9(null);};}for(var e in events){if(events[_0x7f7f('0x6')](e)){var event=events[e];MailAccount[_0x7f7f('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xa751=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa751,0x175));var _0x1a75=function(_0x4c09f4,_0x341594){_0x4c09f4=_0x4c09f4-0x0;var _0x3bc5aa=_0xa751[_0x4c09f4];return _0x3bc5aa;};'use strict';var EventEmitter=require(_0x1a75('0x0'));var MailAccount=require(_0x1a75('0x1'))['db'][_0x1a75('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1a75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a75('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31db55){return function(_0x95fa7,_0x2ea393,_0x4ebf37){MailAccountEvents[_0x1a75('0x5')](_0x31db55+':'+_0x95fa7['id'],_0x95fa7);MailAccountEvents[_0x1a75('0x5')](_0x31db55,_0x95fa7);_0x4ebf37(null);};}for(var e in events){if(events[_0x1a75('0x6')](e)){var event=events[e];MailAccount[_0x1a75('0x7')](e,emitEvent(event));}}module[_0x1a75('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index fd52833..5b5071c 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 _0x5573=['secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','CloudProvider','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','service','provider','host','port','Smtp'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x5573,0xa1));var _0x3557=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x5573[_0x580b15];return _0x1adb1b;};'use strict';var attributes=require(_0x3557('0x0'));module[_0x3557('0x1')]=function(_0x4ace85){return _0x4ace85['define'](_0x3557('0x2'),attributes,{'tableName':_0x3557('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1e1f9b=this;var _0x513660={'id':_0x1e1f9b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1e1f9b['provider']!=='custom'){_0x513660[_0x3557('0x4')]=_0x1e1f9b[_0x3557('0x5')];}else{_0x513660[_0x3557('0x6')]=_0x1e1f9b['Smtp'][_0x3557('0x6')];_0x513660[_0x3557('0x7')]=_0x1e1f9b[_0x3557('0x8')][_0x3557('0x7')];_0x513660[_0x3557('0x9')]=_0x1e1f9b[_0x3557('0x8')][_0x3557('0x9')];}if(_0x1e1f9b[_0x3557('0x8')][_0x3557('0xa')]){if(_0x1e1f9b[_0x3557('0x8')][_0x3557('0xb')]){if(!_0x1e1f9b[_0x3557('0x8')]['CloudProvider'])throw new Error(_0x3557('0xc'));_0x513660[_0x3557('0xd')]={'type':_0x3557('0xe'),'user':_0x1e1f9b['Smtp']['user'],'accessToken':_0x1e1f9b[_0x3557('0x8')][_0x3557('0xf')]['data5']};}else{_0x513660[_0x3557('0xd')]={'user':_0x1e1f9b[_0x3557('0x8')]['user'],'pass':_0x1e1f9b['Smtp'][_0x3557('0x10')]};}}return _0x513660;}}});}; \ No newline at end of file +var _0xbef7=['mail_accounts','provider','service','Smtp','host','port','secure','authentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbef7,0x1ea));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x7bef('0x0'));module[_0x7bef('0x1')]=function(_0x2b57d7){return _0x2b57d7[_0x7bef('0x2')](_0x7bef('0x3'),attributes,{'tableName':_0x7bef('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2e23b8=this;var _0x192ad9={'id':_0x2e23b8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e23b8[_0x7bef('0x5')]!=='custom'){_0x192ad9[_0x7bef('0x6')]=_0x2e23b8[_0x7bef('0x5')];}else{_0x192ad9['host']=_0x2e23b8[_0x7bef('0x7')][_0x7bef('0x8')];_0x192ad9[_0x7bef('0x9')]=_0x2e23b8[_0x7bef('0x7')]['port'];_0x192ad9['secure']=_0x2e23b8[_0x7bef('0x7')][_0x7bef('0xa')];}if(_0x2e23b8[_0x7bef('0x7')][_0x7bef('0xb')]){if(_0x2e23b8[_0x7bef('0x7')]['modernAuthentication']){if(!_0x2e23b8[_0x7bef('0x7')]['CloudProvider'])throw new Error(_0x7bef('0xc'));_0x192ad9[_0x7bef('0xd')]={'type':_0x7bef('0xe'),'user':_0x2e23b8[_0x7bef('0x7')][_0x7bef('0xf')],'accessToken':_0x2e23b8[_0x7bef('0x7')][_0x7bef('0x10')][_0x7bef('0x11')]};}else{_0x192ad9['auth']={'user':_0x2e23b8[_0x7bef('0x7')][_0x7bef('0xf')],'pass':_0x2e23b8['Smtp'][_0x7bef('0x12')]};}}return _0x192ad9;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 4a3b1e3..3732ce7 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 _0x31f0=['map','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','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','Contacts','DESC','MailApplication','Applications','Smtp','CloudProvider','orderBy','applications','asc','autoclose','push','length','close','*,*,*,*','defaults','ListId','create','List\x20not\x20found','contact','messageId','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','update','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','attachments','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','MailQueue','queueId','unshift','queue','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','include'];(function(_0x27d106,_0x1226fb){var _0x3f10c7=function(_0x129b68){while(--_0x129b68){_0x27d106['push'](_0x27d106['shift']());}};_0x3f10c7(++_0x1226fb);}(_0x31f0,0xb7));var _0x031f=function(_0x34cb2f,_0x4744fe){_0x34cb2f=_0x34cb2f-0x0;var _0x5b84c5=_0x31f0[_0x34cb2f];return _0x5b84c5;};'use strict';var _=require(_0x031f('0x0'));var moment=require('moment');var BPromise=require(_0x031f('0x1'));var rs=require('randomstring');var Redis=require(_0x031f('0x2'));var db=require(_0x031f('0x3'))['db'];var logger=require(_0x031f('0x4'))(_0x031f('0x5'));var config=require('../../config/environment');var jayson=require(_0x031f('0x6'));var client=jayson[_0x031f('0x7')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x031f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x031f('0x9'))(new Redis(config[_0x031f('0x8')]));require(_0x031f('0xa'))[_0x031f('0xb')](socket);function respondWithRpcPromise(_0x4d47c5,_0x2e5624,_0x24145f){return new BPromise(function(_0x327f11,_0x439940){return client[_0x031f('0xc')](_0x4d47c5,_0x24145f)[_0x031f('0xd')](function(_0x2202dc){logger[_0x031f('0xe')]('MailAccount,\x20%s,\x20%s',_0x2e5624,_0x031f('0xf'));logger[_0x031f('0x10')](_0x031f('0x11'),_0x2e5624,_0x031f('0xf'),JSON[_0x031f('0x12')](_0x2202dc));if(_0x2202dc[_0x031f('0x13')]){if(_0x2202dc[_0x031f('0x13')]['code']===0x1f4){logger[_0x031f('0x13')](_0x031f('0x14'),_0x2e5624,_0x2202dc[_0x031f('0x13')][_0x031f('0x15')]);return _0x439940(_0x2202dc[_0x031f('0x13')]['message']);}logger['error'](_0x031f('0x14'),_0x2e5624,_0x2202dc[_0x031f('0x13')][_0x031f('0x15')]);return _0x327f11(_0x2202dc[_0x031f('0x13')]['message']);}else{logger[_0x031f('0xe')](_0x031f('0x14'),_0x2e5624,'request\x20sent');_0x327f11(_0x2202dc[_0x031f('0x16')]['message']);}})[_0x031f('0x17')](function(_0x5f2199){logger[_0x031f('0x13')](_0x031f('0x14'),_0x2e5624,_0x5f2199);_0x439940(_0x5f2199);});});}exports[_0x031f('0x18')]=function(_0x26cb5e){var _0x1b76d6=this;return new Promise(function(_0x2825ef,_0xf76f1b){return db[_0x031f('0x19')][_0x031f('0x1a')]({'raw':_0x26cb5e['options']?_0x26cb5e[_0x031f('0x1b')][_0x031f('0x1c')]===undefined?!![]:![]:!![],'where':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e['options']['where']||null:null,'attributes':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e['options'][_0x031f('0x1d')]||null:null,'limit':_0x26cb5e['options']?_0x26cb5e['options']['limit']||null:null,'include':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e[_0x031f('0x1b')][_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x26cb5e['options'][_0x031f('0x1e')],function(_0x5a64c0){return{'model':db[_0x5a64c0[_0x031f('0x20')]],'as':_0x5a64c0['as'],'attributes':_0x5a64c0[_0x031f('0x1d')],'include':_0x5a64c0[_0x031f('0x1e')]?_['map'](_0x5a64c0[_0x031f('0x1e')],function(_0x3b2a51){return{'model':db[_0x3b2a51['model']],'as':_0x3b2a51['as'],'attributes':_0x3b2a51[_0x031f('0x1d')],'include':_0x3b2a51[_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x3b2a51['include'],function(_0xa308b){return{'model':db[_0xa308b[_0x031f('0x20')]],'as':_0xa308b['as'],'attributes':_0xa308b[_0x031f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x031f('0xd')](function(_0xfaa36){logger[_0x031f('0xe')]('GetMailAccount',_0x26cb5e);logger[_0x031f('0x10')](_0x031f('0x18'),_0x26cb5e,JSON[_0x031f('0x12')](_0xfaa36));_0x2825ef(_0xfaa36);})[_0x031f('0x17')](function(_0x428ec4){logger[_0x031f('0x13')](_0x031f('0x18'),_0x428ec4[_0x031f('0x15')],_0x26cb5e);_0xf76f1b(_0x1b76d6[_0x031f('0x13')](0x1f4,_0x428ec4[_0x031f('0x15')]));});});};exports[_0x031f('0x21')]=function(_0x5ec564){var _0xced6ff=this;return new Promise(function(_0xe5f11c,_0xb3a6bd){return db[_0x031f('0x19')][_0x031f('0x22')]({'raw':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')][_0x031f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')][_0x031f('0x23')]||null:null,'attributes':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')]['attributes']||null:null,'include':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')]['include']?_[_0x031f('0x1f')](_0x5ec564[_0x031f('0x1b')]['include'],function(_0x17b93c){return{'model':db[_0x17b93c[_0x031f('0x20')]],'as':_0x17b93c['as'],'attributes':_0x17b93c[_0x031f('0x1d')],'include':_0x17b93c[_0x031f('0x1e')]?_['map'](_0x17b93c['include'],function(_0x36ab13){return{'model':db[_0x36ab13['model']],'as':_0x36ab13['as'],'attributes':_0x36ab13[_0x031f('0x1d')],'include':_0x36ab13[_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x36ab13['include'],function(_0x5c33c5){return{'model':db[_0x5c33c5[_0x031f('0x20')]],'as':_0x5c33c5['as'],'attributes':_0x5c33c5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d489a){if(_0x5ec564[_0x031f('0x1b')][_0x031f('0x24')]===!![])_0x2d489a[_0x031f('0x25')](_0x031f('0x26'),_0x2d489a[_0x031f('0x27')]());logger[_0x031f('0xe')]('ShowMailAccount',_0x5ec564);logger[_0x031f('0x10')](_0x031f('0x21'),_0x5ec564,JSON[_0x031f('0x12')](_0x2d489a));_0xe5f11c(_0x2d489a);})[_0x031f('0x17')](function(_0x58daa2){logger[_0x031f('0x13')](_0x031f('0x21'),_0x58daa2[_0x031f('0x15')],_0x5ec564);_0xb3a6bd(_0xced6ff['error'](0x1f4,_0x58daa2[_0x031f('0x15')]));});});};exports[_0x031f('0x28')]=function(_0x5d6826){var _0x36bafa=this;return new Promise(function(_0x268dc7,_0x56a8f3){var _0x4c50b2={'body':_0x5d6826[_0x031f('0x29')],'channel':_0x031f('0x2a')};var _0x9efbc4=_[_0x031f('0x2b')](_[_0x031f('0x2c')](db[_0x031f('0x2d')][_0x031f('0x2e')]),['createdAt',_0x031f('0x2f'),_0x031f('0x30'),'ListId']);var _0x12279a=![];if(_0x5d6826['body']['id']){delete _0x5d6826[_0x031f('0x29')]['id'];}if(_[_0x031f('0x31')](_0x5d6826['body'][_0x031f('0x32')])){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x33')));}if(_['isNil'](_0x5d6826[_0x031f('0x29')][_0x031f('0x29')])||_0x5d6826[_0x031f('0x29')][_0x031f('0x29')]===''){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x34')));}if(_[_0x031f('0x31')](_0x5d6826[_0x031f('0x29')][_0x031f('0x35')])){return _0x56a8f3(_0x36bafa['error'](0x1f4,_0x031f('0x36')+_0x9efbc4));}if(!_[_0x031f('0x37')](_0x9efbc4,_0x5d6826[_0x031f('0x29')][_0x031f('0x35')])){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x38')+_0x9efbc4));}var _0x2111c5={};_0x2111c5[_0x5d6826[_0x031f('0x29')][_0x031f('0x35')]]=_0x5d6826['body'][_0x031f('0x32')];return db['MailAccount']['find']({'where':{'id':_0x5d6826[_0x031f('0x39')]['id']},'include':[{'model':db[_0x031f('0x3a')],'as':_0x031f('0x3b'),'include':[{'model':db[_0x031f('0x2d')],'as':_0x031f('0x3c'),'where':_0x2111c5,'limit':0x1,'order':[['updatedAt',_0x031f('0x3d')]]}]},{'model':db[_0x031f('0x3e')],'as':_0x031f('0x3f')},{'model':db['MailServerOut'],'as':_0x031f('0x40'),'include':[{'model':db[_0x031f('0x41')],'as':_0x031f('0x41')}]}]})[_0x031f('0xd')](function(_0x2c93ea){if(_0x2c93ea&&_0x2c93ea[_0x031f('0x3b')]){var _0x5caeb5=_0x2c93ea['get']({'plain':!![]});_0x4c50b2[_0x031f('0x39')]=_['omit'](_0x5caeb5,[_0x031f('0x3f'),_0x031f('0x3b')]);_0x4c50b2['account'][_0x031f('0x26')]=_0x2c93ea['getSmtpOptions']();_0x4c50b2['applications']=_0x5caeb5[_0x031f('0x3f')];_0x4c50b2['list']=_0x5caeb5[_0x031f('0x3b')];_0x4c50b2['applications']=_[_0x031f('0x42')](_0x4c50b2[_0x031f('0x43')],['priority'],[_0x031f('0x44')]);if(_0x4c50b2[_0x031f('0x39')]&&_0x4c50b2['account'][_0x031f('0x45')]){_0x4c50b2['applications'][_0x031f('0x46')]({'id':0x0,'priority':_0x4c50b2['applications'][_0x031f('0x47')]+0x1,'app':_0x031f('0x48'),'appdata':_0x031f('0x45'),'interval':_0x031f('0x49')});}if(_0x4c50b2[_0x031f('0x39')]['Applications']){delete _0x4c50b2[_0x031f('0x39')]['Applications'];}if(_0x4c50b2[_0x031f('0x39')][_0x031f('0x3b')]){delete _0x4c50b2['account'][_0x031f('0x3b')];}if(_0x5caeb5[_0x031f('0x3b')]['Contacts'][_0x031f('0x47')]){return _0x5caeb5[_0x031f('0x3b')][_0x031f('0x3c')][0x0];}var _0x55b9cf=_[_0x031f('0x4a')](_0x5d6826['body'],{'firstName':_0x5d6826[_0x031f('0x29')]['from'],'ListId':_0x5caeb5[_0x031f('0x4b')]});_0x55b9cf[_0x5d6826['body'][_0x031f('0x35')]]=_0x5d6826[_0x031f('0x29')]['from'];return db['CmContact'][_0x031f('0x4c')](_0x55b9cf);}else{throw new Error(_0x031f('0x4d'));}})['then'](function(_0x434c0f){_0x4c50b2[_0x031f('0x4e')]=_0x434c0f;if(_0x434c0f){if(!_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')]){_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')]=rs['generate']()+'\x20'+_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x32')];}var _0x5db3c7={'ContactId':_0x434c0f['id'],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id'],'inReplyTo':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x4f')],'to':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x32')],'cc':_0x5d6826['body']['message']['cc'],'subject':_0x5d6826['body']['message'][_0x031f('0x50')],'attach':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x51')],'lastMsgAt':moment()[_0x031f('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x031f('0x53')][_0x031f('0x22')]({'where':{'closed':![],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id']},'include':[{'model':db[_0x031f('0x54')],'as':_0x031f('0x55'),'attributes':[_0x031f('0x4f')],'where':{'messageId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x56')]}}]})['then'](function(_0x138e0d){if(_0x138e0d){return[_0x138e0d,![]];}return db['MailInteraction'][_0x031f('0x4c')](_0x5db3c7)[_0x031f('0xd')](function(_0x3d27d6){return[_0x3d27d6,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xdb3d45,_0x46af33){if(_0xdb3d45){_0x12279a=_0x46af33;if(!_0x46af33){return _0xdb3d45[_0x031f('0x57')]({'inReplyTo':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x4f')],'to':_0x5d6826['body']['message'][_0x031f('0x32')],'cc':_0x5d6826['body']['message']['cc'],'subject':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x50')],'attach':_0xdb3d45[_0x031f('0x51')]?_0xdb3d45[_0x031f('0x51')]:_0x5d6826['body']['message'][_0x031f('0x51')],'substatus':null,'substatusAt':moment()['format'](_0x031f('0x58')),'lastMsgAt':moment()[_0x031f('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0xdb3d45;}}})[_0x031f('0xd')](function(_0xee136c){_0x4c50b2[_0x031f('0x59')]=_0xee136c[_0x031f('0x5a')]({'plain':!![]});_0x4c50b2[_0x031f('0x59')][_0x031f('0x5b')]=_0x12279a;return db['MailMessage']['create']({'body':_0x5d6826[_0x031f('0x29')][_0x031f('0x29')],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id'],'MailInteractionId':_0xee136c['id'],'direction':'in','ContactId':_0x4c50b2[_0x031f('0x4e')]['id'],'messageId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')],'from':_0x5d6826['body']['message']['from'],'to':_0x5d6826['body'][_0x031f('0x15')]['to'],'cc':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['cc'],'subject':_0x5d6826['body'][_0x031f('0x15')][_0x031f('0x50')],'attach':_0x5d6826['body'][_0x031f('0x15')][_0x031f('0x51')],'Attachments':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x5c')],'originTo':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['originTo'],'originCc':_0x5d6826['body'][_0x031f('0x15')]['originCc'],'bcc':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x5d')],'ChatWebsiteId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['ChatWebsiteId']||null,'originChannel':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x5e')]||_0x031f('0x5f'),'ChatOfflineMessageId':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x60')]||null},{'include':[{'model':db[_0x031f('0x61')],'as':_0x031f('0x62')}]});})[_0x031f('0xd')](function(_0x45330f){_0x4c50b2['message']=_0x45330f;if(!_0x4c50b2['interaction'][_0x031f('0x63')]){return;}return db[_0x031f('0x64')]['find']({'attributes':['id',_0x031f('0x65')],'where':{'id':_0x4c50b2['interaction'][_0x031f('0x63')]}});})[_0x031f('0xd')](function(_0x142310){if(_0x142310){_0x4c50b2[_0x031f('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x031f('0x66'),'appdata':_0x142310[_0x031f('0x65')]+','+(_0x4c50b2[_0x031f('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x031f('0x49')});}if(!_0x4c50b2[_0x031f('0x59')]['queueId']){return;}return db[_0x031f('0x67')][_0x031f('0x22')]({'attributes':['id',_0x031f('0x65')],'where':{'id':_0x4c50b2[_0x031f('0x59')][_0x031f('0x68')]}});})[_0x031f('0xd')](function(_0x3f3582){if(_0x3f3582){_0x4c50b2['applications'][_0x031f('0x69')]({'id':0x0,'priority':0x1,'app':_0x031f('0x6a'),'appdata':_0x3f3582[_0x031f('0x65')]+','+(_0x4c50b2['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x031f('0x49')});}return respondWithRpcPromise('Start','startRouting',_0x4c50b2);})[_0x031f('0xd')](function(_0x184bbd){_0x268dc7(_0x184bbd);})[_0x031f('0x17')](function(_0x1d6aca){_0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x1d6aca[_0x031f('0x15')]));});});}; \ No newline at end of file +var _0x7278=['User','unshift','agent','name','queueId','MailQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','GetMailAccount','findAll','options','raw','where','attributes','include','map','model','stringify','ShowMailAccount','MailAccount','find','smtp','smtpOptions','getSmtpOptions','catch','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','account','omit','Applications','list','applications','priority','asc','autoclose','push','length','close','defaults','List\x20not\x20found','messageId','generate','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','Attachment','Attachments','UserId'];(function(_0x494fed,_0x52030c){var _0x14ba95=function(_0x3db26f){while(--_0x3db26f){_0x494fed['push'](_0x494fed['shift']());}};_0x14ba95(++_0x52030c);}(_0x7278,0x161));var _0x8727=function(_0x10f05e,_0x54f4f3){_0x10f05e=_0x10f05e-0x0;var _0x6b9477=_0x7278[_0x10f05e];return _0x6b9477;};'use strict';var _=require(_0x8727('0x0'));var moment=require(_0x8727('0x1'));var BPromise=require(_0x8727('0x2'));var rs=require(_0x8727('0x3'));var Redis=require(_0x8727('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x8727('0x5'))(_0x8727('0x6'));var config=require(_0x8727('0x7'));var jayson=require(_0x8727('0x8'));var client=jayson[_0x8727('0x9')][_0x8727('0xa')]({'port':0x232c});config[_0x8727('0xb')]=_['defaults'](config[_0x8727('0xb')],{'host':_0x8727('0xc'),'port':0x18eb});var socket=require(_0x8727('0xd'))(new Redis(config[_0x8727('0xb')]));require(_0x8727('0xe'))['register'](socket);function respondWithRpcPromise(_0x4b1985,_0x4df6f8,_0xb575a3){return new BPromise(function(_0x336193,_0x3a6c9b){return client[_0x8727('0xf')](_0x4b1985,_0xb575a3)[_0x8727('0x10')](function(_0x344490){logger[_0x8727('0x11')](_0x8727('0x12'),_0x4df6f8,'request\x20sent');logger[_0x8727('0x13')](_0x8727('0x14'),_0x4df6f8,_0x8727('0x15'),JSON['stringify'](_0x344490));if(_0x344490[_0x8727('0x16')]){if(_0x344490[_0x8727('0x16')]['code']===0x1f4){logger[_0x8727('0x16')](_0x8727('0x12'),_0x4df6f8,_0x344490[_0x8727('0x16')][_0x8727('0x17')]);return _0x3a6c9b(_0x344490[_0x8727('0x16')][_0x8727('0x17')]);}logger[_0x8727('0x16')](_0x8727('0x12'),_0x4df6f8,_0x344490[_0x8727('0x16')][_0x8727('0x17')]);return _0x336193(_0x344490['error'][_0x8727('0x17')]);}else{logger[_0x8727('0x11')](_0x8727('0x12'),_0x4df6f8,_0x8727('0x15'));_0x336193(_0x344490[_0x8727('0x18')][_0x8727('0x17')]);}})['catch'](function(_0x575d29){logger[_0x8727('0x16')]('MailAccount,\x20%s,\x20%s',_0x4df6f8,_0x575d29);_0x3a6c9b(_0x575d29);});});}exports[_0x8727('0x19')]=function(_0xfd266f){var _0x32cabe=this;return new Promise(function(_0x22e6c9,_0x2dae91){return db['MailAccount'][_0x8727('0x1a')]({'raw':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')][_0x8727('0x1c')]===undefined?!![]:![]:!![],'where':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')][_0x8727('0x1d')]||null:null,'attributes':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')][_0x8727('0x1e')]||null:null,'limit':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')]['limit']||null:null,'include':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')]['include']?_['map'](_0xfd266f[_0x8727('0x1b')][_0x8727('0x1f')],function(_0x15e8bf){return{'model':db[_0x15e8bf['model']],'as':_0x15e8bf['as'],'attributes':_0x15e8bf[_0x8727('0x1e')],'include':_0x15e8bf[_0x8727('0x1f')]?_[_0x8727('0x20')](_0x15e8bf[_0x8727('0x1f')],function(_0x2c8cd5){return{'model':db[_0x2c8cd5[_0x8727('0x21')]],'as':_0x2c8cd5['as'],'attributes':_0x2c8cd5[_0x8727('0x1e')],'include':_0x2c8cd5[_0x8727('0x1f')]?_['map'](_0x2c8cd5[_0x8727('0x1f')],function(_0x307055){return{'model':db[_0x307055['model']],'as':_0x307055['as'],'attributes':_0x307055[_0x8727('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x10')](function(_0x3ecd6a){logger[_0x8727('0x11')](_0x8727('0x19'),_0xfd266f);logger[_0x8727('0x13')]('GetMailAccount',_0xfd266f,JSON[_0x8727('0x22')](_0x3ecd6a));_0x22e6c9(_0x3ecd6a);})['catch'](function(_0x34c58e){logger['error'](_0x8727('0x19'),_0x34c58e[_0x8727('0x17')],_0xfd266f);_0x2dae91(_0x32cabe[_0x8727('0x16')](0x1f4,_0x34c58e[_0x8727('0x17')]));});});};exports[_0x8727('0x23')]=function(_0x431b24){var _0x382be3=this;return new Promise(function(_0x4b6162,_0x3ac06a){return db[_0x8727('0x24')][_0x8727('0x25')]({'raw':_0x431b24[_0x8727('0x1b')]?_0x431b24[_0x8727('0x1b')][_0x8727('0x1c')]===undefined?!![]:![]:!![],'where':_0x431b24[_0x8727('0x1b')]?_0x431b24[_0x8727('0x1b')][_0x8727('0x1d')]||null:null,'attributes':_0x431b24[_0x8727('0x1b')]?_0x431b24[_0x8727('0x1b')][_0x8727('0x1e')]||null:null,'include':_0x431b24['options']?_0x431b24['options'][_0x8727('0x1f')]?_[_0x8727('0x20')](_0x431b24[_0x8727('0x1b')][_0x8727('0x1f')],function(_0x52220f){return{'model':db[_0x52220f[_0x8727('0x21')]],'as':_0x52220f['as'],'attributes':_0x52220f[_0x8727('0x1e')],'include':_0x52220f[_0x8727('0x1f')]?_[_0x8727('0x20')](_0x52220f[_0x8727('0x1f')],function(_0x5b96cc){return{'model':db[_0x5b96cc[_0x8727('0x21')]],'as':_0x5b96cc['as'],'attributes':_0x5b96cc[_0x8727('0x1e')],'include':_0x5b96cc[_0x8727('0x1f')]?_[_0x8727('0x20')](_0x5b96cc[_0x8727('0x1f')],function(_0x3b1022){return{'model':db[_0x3b1022[_0x8727('0x21')]],'as':_0x3b1022['as'],'attributes':_0x3b1022[_0x8727('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x10')](function(_0x1a607a){if(_0x431b24[_0x8727('0x1b')][_0x8727('0x26')]===!![])_0x1a607a['setDataValue'](_0x8727('0x27'),_0x1a607a[_0x8727('0x28')]());logger[_0x8727('0x11')](_0x8727('0x23'),_0x431b24);logger[_0x8727('0x13')](_0x8727('0x23'),_0x431b24,JSON[_0x8727('0x22')](_0x1a607a));_0x4b6162(_0x1a607a);})[_0x8727('0x29')](function(_0x42d767){logger[_0x8727('0x16')](_0x8727('0x23'),_0x42d767[_0x8727('0x17')],_0x431b24);_0x3ac06a(_0x382be3[_0x8727('0x16')](0x1f4,_0x42d767[_0x8727('0x17')]));});});};exports['NotifyMailAccount']=function(_0x15fbe6){var _0x332c87=this;return new Promise(function(_0x19d08a,_0x4ac9d2){var _0x2a506f={'body':_0x15fbe6[_0x8727('0x2a')],'channel':_0x8727('0x2b')};var _0x641064=_['difference'](_[_0x8727('0x2c')](db[_0x8727('0x2d')][_0x8727('0x2e')]),[_0x8727('0x2f'),_0x8727('0x30'),_0x8727('0x31'),_0x8727('0x32')]);var _0x15b764=![];if(_0x15fbe6[_0x8727('0x2a')]['id']){delete _0x15fbe6[_0x8727('0x2a')]['id'];}if(_['isNil'](_0x15fbe6[_0x8727('0x2a')][_0x8727('0x33')])){return _0x4ac9d2(_0x332c87[_0x8727('0x16')](0x1f4,_0x8727('0x34')));}if(_[_0x8727('0x35')](_0x15fbe6['body'][_0x8727('0x2a')])||_0x15fbe6[_0x8727('0x2a')][_0x8727('0x2a')]===''){return _0x4ac9d2(_0x332c87['error'](0x1f4,_0x8727('0x36')));}if(_[_0x8727('0x35')](_0x15fbe6[_0x8727('0x2a')][_0x8727('0x37')])){return _0x4ac9d2(_0x332c87[_0x8727('0x16')](0x1f4,_0x8727('0x38')+_0x641064));}if(!_['includes'](_0x641064,_0x15fbe6[_0x8727('0x2a')][_0x8727('0x37')])){return _0x4ac9d2(_0x332c87[_0x8727('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x641064));}var _0xc19ba5={};_0xc19ba5[_0x15fbe6[_0x8727('0x2a')][_0x8727('0x37')]]=_0x15fbe6[_0x8727('0x2a')][_0x8727('0x33')];return db[_0x8727('0x24')][_0x8727('0x25')]({'where':{'id':_0x15fbe6['account']['id']},'include':[{'model':db[_0x8727('0x39')],'as':_0x8727('0x3a'),'include':[{'model':db[_0x8727('0x2d')],'as':_0x8727('0x3b'),'where':_0xc19ba5,'limit':0x1,'order':[[_0x8727('0x30'),_0x8727('0x3c')]]}]},{'model':db[_0x8727('0x3d')],'as':'Applications'},{'model':db[_0x8727('0x3e')],'as':_0x8727('0x3f'),'include':[{'model':db[_0x8727('0x40')],'as':'CloudProvider'}]}]})[_0x8727('0x10')](function(_0x22cd31){if(_0x22cd31&&_0x22cd31[_0x8727('0x3a')]){var _0x4367e8=_0x22cd31[_0x8727('0x41')]({'plain':!![]});_0x2a506f[_0x8727('0x42')]=_[_0x8727('0x43')](_0x4367e8,['Applications',_0x8727('0x3a')]);_0x2a506f['account'][_0x8727('0x27')]=_0x22cd31[_0x8727('0x28')]();_0x2a506f['applications']=_0x4367e8[_0x8727('0x44')];_0x2a506f[_0x8727('0x45')]=_0x4367e8[_0x8727('0x3a')];_0x2a506f['applications']=_['orderBy'](_0x2a506f[_0x8727('0x46')],[_0x8727('0x47')],[_0x8727('0x48')]);if(_0x2a506f['account']&&_0x2a506f[_0x8727('0x42')][_0x8727('0x49')]){_0x2a506f[_0x8727('0x46')][_0x8727('0x4a')]({'id':0x0,'priority':_0x2a506f[_0x8727('0x46')][_0x8727('0x4b')]+0x1,'app':_0x8727('0x4c'),'appdata':_0x8727('0x49'),'interval':'*,*,*,*'});}if(_0x2a506f[_0x8727('0x42')][_0x8727('0x44')]){delete _0x2a506f[_0x8727('0x42')][_0x8727('0x44')];}if(_0x2a506f['account'][_0x8727('0x3a')]){delete _0x2a506f[_0x8727('0x42')][_0x8727('0x3a')];}if(_0x4367e8[_0x8727('0x3a')][_0x8727('0x3b')][_0x8727('0x4b')]){return _0x4367e8[_0x8727('0x3a')][_0x8727('0x3b')][0x0];}var _0x508cb2=_[_0x8727('0x4d')](_0x15fbe6[_0x8727('0x2a')],{'firstName':_0x15fbe6[_0x8727('0x2a')]['from'],'ListId':_0x4367e8[_0x8727('0x32')]});_0x508cb2[_0x15fbe6['body'][_0x8727('0x37')]]=_0x15fbe6['body'][_0x8727('0x33')];return db[_0x8727('0x2d')]['create'](_0x508cb2);}else{throw new Error(_0x8727('0x4e'));}})[_0x8727('0x10')](function(_0x105a9d){_0x2a506f['contact']=_0x105a9d;if(_0x105a9d){if(!_0x15fbe6['body']['message']['messageId']){_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x4f')]=rs[_0x8727('0x50')]()+'\x20'+_0x15fbe6[_0x8727('0x2a')]['message']['from'];}var _0x23e24d={'ContactId':_0x105a9d['id'],'MailAccountId':_0x15fbe6[_0x8727('0x42')]['id'],'inReplyTo':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x4f')],'to':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x33')],'cc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['cc'],'subject':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['subject'],'attach':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['attach'],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x8727('0x25')]({'where':{'closed':![],'MailAccountId':_0x15fbe6[_0x8727('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':_0x8727('0x51'),'attributes':[_0x8727('0x4f')],'where':{'messageId':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x52')]}}]})['then'](function(_0x375f34){if(_0x375f34){return[_0x375f34,![]];}return db[_0x8727('0x53')][_0x8727('0x54')](_0x23e24d)[_0x8727('0x10')](function(_0x2b8a7c){return[_0x2b8a7c,!![]];});});}else{throw new Error(_0x8727('0x55'));}})[_0x8727('0x56')](function(_0x190f0d,_0x1f0338){if(_0x190f0d){_0x15b764=_0x1f0338;if(!_0x1f0338){return _0x190f0d['update']({'inReplyTo':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x4f')],'to':_0x15fbe6['body'][_0x8727('0x17')]['from'],'cc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['cc'],'subject':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x57')],'attach':_0x190f0d['attach']?_0x190f0d['attach']:_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x58')],'substatus':null,'substatusAt':moment()[_0x8727('0x59')](_0x8727('0x5a')),'lastMsgAt':moment()['format'](_0x8727('0x5a')),'lastMsgDirection':'in'});}else{return _0x190f0d;}}})['then'](function(_0x24196b){_0x2a506f['interaction']=_0x24196b['get']({'plain':!![]});_0x2a506f[_0x8727('0x5b')][_0x8727('0x5c')]=_0x15b764;return db[_0x8727('0x5d')][_0x8727('0x54')]({'body':_0x15fbe6[_0x8727('0x2a')]['body'],'MailAccountId':_0x15fbe6['account']['id'],'MailInteractionId':_0x24196b['id'],'direction':'in','ContactId':_0x2a506f[_0x8727('0x5e')]['id'],'messageId':_0x15fbe6[_0x8727('0x2a')]['message'][_0x8727('0x4f')],'from':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x33')],'to':_0x15fbe6['body'][_0x8727('0x17')]['to'],'cc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['cc'],'subject':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x57')],'attach':_0x15fbe6[_0x8727('0x2a')]['message']['attach'],'Attachments':_0x15fbe6['body'][_0x8727('0x17')][_0x8727('0x5f')],'originTo':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x60')],'originCc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x61')],'bcc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x62')],'ChatWebsiteId':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x63')]||null,'originChannel':_0x15fbe6[_0x8727('0x2a')]['message']['originChannel']||'Email','ChatOfflineMessageId':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x8727('0x64')],'as':_0x8727('0x65')}]});})[_0x8727('0x10')](function(_0x4afe0b){_0x2a506f[_0x8727('0x17')]=_0x4afe0b;if(!_0x2a506f['interaction'][_0x8727('0x66')]){return;}return db[_0x8727('0x67')][_0x8727('0x25')]({'attributes':['id','name'],'where':{'id':_0x2a506f['interaction'][_0x8727('0x66')]}});})[_0x8727('0x10')](function(_0x7f71d9){if(_0x7f71d9){_0x2a506f[_0x8727('0x46')][_0x8727('0x68')]({'id':0x0,'priority':0x0,'app':_0x8727('0x69'),'appdata':_0x7f71d9[_0x8727('0x6a')]+','+(_0x2a506f[_0x8727('0x42')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x2a506f['interaction'][_0x8727('0x6b')]){return;}return db[_0x8727('0x6c')][_0x8727('0x25')]({'attributes':['id','name'],'where':{'id':_0x2a506f[_0x8727('0x5b')][_0x8727('0x6b')]}});})['then'](function(_0x1474ba){if(_0x1474ba){_0x2a506f[_0x8727('0x46')][_0x8727('0x68')]({'id':0x0,'priority':0x1,'app':_0x8727('0x6d'),'appdata':_0x1474ba[_0x8727('0x6a')]+','+(_0x2a506f[_0x8727('0x42')][_0x8727('0x6e')]||0x12c),'interval':_0x8727('0x6f')});}return respondWithRpcPromise(_0x8727('0x70'),_0x8727('0x71'),_0x2a506f);})['then'](function(_0x3ae045){_0x19d08a(_0x3ae045);})[_0x8727('0x29')](function(_0x46c573){_0x4ac9d2(_0x332c87[_0x8727('0x16')](0x1f4,_0x46c573[_0x8727('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 82f3e97..aa6fb04 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 _0x243b=['emit','removeListener','register','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0x243b,0x9c));var _0xb243=function(_0x2bfc93,_0x7cdb79){_0x2bfc93=_0x2bfc93-0x0;var _0x22ae6c=_0x243b[_0x2bfc93];return _0x22ae6c;};'use strict';var MailAccountEvents=require(_0xb243('0x0'));var events=[_0xb243('0x1'),_0xb243('0x2'),_0xb243('0x3')];function createListener(_0xc389c1,_0x38e1cd){return function(_0x48ceca){_0x38e1cd[_0xb243('0x4')](_0xc389c1,_0x48ceca);};}function removeListener(_0x53d2e2,_0x42e226){return function(){MailAccountEvents[_0xb243('0x5')](_0x53d2e2,_0x42e226);};}exports[_0xb243('0x6')]=function(_0x1e9d7d){for(var _0x121054=0x0,_0x8c8cc=events['length'];_0x121054<_0x8c8cc;_0x121054++){var _0x3e794c=events[_0x121054];var _0x4b196c=createListener(_0xb243('0x7')+_0x3e794c,_0x1e9d7d);MailAccountEvents['on'](_0x3e794c,_0x4b196c);}}; \ No newline at end of file +var _0x00b8=['register','length','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x50ead6,_0x5c4780){var _0xc69ae1=function(_0x3d5387){while(--_0x3d5387){_0x50ead6['push'](_0x50ead6['shift']());}};_0xc69ae1(++_0x5c4780);}(_0x00b8,0x1e0));var _0x800b=function(_0x248561,_0x3527ec){_0x248561=_0x248561-0x0;var _0x3386a6=_0x00b8[_0x248561];return _0x3386a6;};'use strict';var MailAccountEvents=require(_0x800b('0x0'));var events=[_0x800b('0x1'),_0x800b('0x2'),_0x800b('0x3')];function createListener(_0x2d9c40,_0x126755){return function(_0x5e380e){_0x126755[_0x800b('0x4')](_0x2d9c40,_0x5e380e);};}function removeListener(_0x54a4c5,_0x412185){return function(){MailAccountEvents[_0x800b('0x5')](_0x54a4c5,_0x412185);};}exports[_0x800b('0x6')]=function(_0xf9a2c7){for(var _0x695ff3=0x0,_0x41ad65=events[_0x800b('0x7')];_0x695ff3<_0x41ad65;_0x695ff3++){var _0xd2e393=events[_0x695ff3];var _0x2d72ec=createListener(_0x800b('0x8')+_0xd2e393,_0xf9a2c7);MailAccountEvents['on'](_0xd2e393,_0x2d72ec);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9ff24dc..358372c 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 _0xb478=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','delete','exports'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0xb478,0x96));var _0x8b47=function(_0x33c797,_0x430c30){_0x33c797=_0x33c797-0x0;var _0x514ff7=_0xb478[_0x33c797];return _0x514ff7;};'use strict';var multer=require(_0x8b47('0x0'));var util=require(_0x8b47('0x1'));var path=require(_0x8b47('0x2'));var timeout=require(_0x8b47('0x3'));var express=require('express');var router=express[_0x8b47('0x4')]();var fs_extra=require(_0x8b47('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b47('0x6'));var config=require(_0x8b47('0x7'));var controller=require('./mailApplication.controller');router[_0x8b47('0x8')](_0x8b47('0x9'),auth[_0x8b47('0xa')](),controller[_0x8b47('0xb')]);router[_0x8b47('0xc')](_0x8b47('0x9'),auth[_0x8b47('0xa')](),controller['update']);router[_0x8b47('0xd')]('/:id',auth[_0x8b47('0xa')](),controller['destroy']);module[_0x8b47('0xe')]=router; \ No newline at end of file +var _0x1c85=['put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./mailApplication.controller','/:id','isAuthenticated','show'];(function(_0x2f0641,_0x32253b){var _0x129bb2=function(_0x14975b){while(--_0x14975b){_0x2f0641['push'](_0x2f0641['shift']());}};_0x129bb2(++_0x32253b);}(_0x1c85,0xad));var _0x51c8=function(_0x528595,_0x88ed8c){_0x528595=_0x528595-0x0;var _0x17103c=_0x1c85[_0x528595];return _0x17103c;};'use strict';var multer=require(_0x51c8('0x0'));var util=require('util');var path=require(_0x51c8('0x1'));var timeout=require('connect-timeout');var express=require(_0x51c8('0x2'));var router=express['Router']();var fs_extra=require(_0x51c8('0x3'));var auth=require(_0x51c8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x51c8('0x5'));router['get'](_0x51c8('0x6'),auth[_0x51c8('0x7')](),controller[_0x51c8('0x8')]);router[_0x51c8('0x9')](_0x51c8('0x6'),auth[_0x51c8('0x7')](),controller[_0x51c8('0xa')]);router[_0x51c8('0xb')](_0x51c8('0x6'),auth[_0x51c8('0x7')](),controller[_0x51c8('0xc')]);module[_0x51c8('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0870228..761b07c 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 _0xef7a=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xef7a,0x1dc));var _0xaef7=function(_0x593885,_0x2bda25){_0x593885=_0x593885-0x0;var _0x547ee0=_0xef7a[_0x593885];return _0x547ee0;};'use strict';var Sequelize=require(_0xaef7('0x0'));module[_0xaef7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xaef7('0x2')],'allowNull':![],'defaultValue':_0xaef7('0x3')},'appdata':{'type':Sequelize[_0xaef7('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xaef7('0x2')],'defaultValue':_0xaef7('0x5')}}; \ No newline at end of file +var _0x6633=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x29e2e6,_0xf7ef8c){var _0xb6bd20=function(_0x10dd27){while(--_0x10dd27){_0x29e2e6['push'](_0x29e2e6['shift']());}};_0xb6bd20(++_0xf7ef8c);}(_0x6633,0x1ce));var _0x3663=function(_0x4913b1,_0x4a115e){_0x4913b1=_0x4913b1-0x0;var _0x1b39a6=_0x6633[_0x4913b1];return _0x1b39a6;};'use strict';var Sequelize=require(_0x3663('0x0'));module[_0x3663('0x1')]={'priority':{'type':Sequelize[_0x3663('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3663('0x3')],'allowNull':![],'defaultValue':_0x3663('0x4')},'appdata':{'type':Sequelize[_0x3663('0x5')]()},'description':{'type':Sequelize[_0x3663('0x3')]},'interval':{'type':Sequelize[_0x3663('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index aaa2e18..20b0113 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x464e1f,_0x2aa86f){var _0x1c1ce2=function(_0x543c79){while(--_0x543c79){_0x464e1f['push'](_0x464e1f['shift']());}};_0x1c1ce2(++_0x2aa86f);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x175fe5,_0xeba8c0){var _0x3432c3=function(_0x40ef01){while(--_0x40ef01){_0x175fe5['push'](_0x175fe5['shift']());}};_0x3432c3(++_0xeba8c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9a4f89d..f1d7ff1 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 _0x7f95=['./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x1a8a79,_0x57182d){var _0x436f4c=function(_0x4cc5c2){while(--_0x4cc5c2){_0x1a8a79['push'](_0x1a8a79['shift']());}};_0x436f4c(++_0x57182d);}(_0x7f95,0x1d5));var _0x57f9=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x7f95[_0x279d37];return _0x530173;};'use strict';var _=require(_0x57f9('0x0'));var util=require(_0x57f9('0x1'));var logger=require(_0x57f9('0x2'))(_0x57f9('0x3'));var moment=require('moment');var BPromise=require(_0x57f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57f9('0x5'));var config=require(_0x57f9('0x6'));var attributes=require(_0x57f9('0x7'));module[_0x57f9('0x8')]=function(_0x211975,_0x5ddc23){return _0x211975[_0x57f9('0x9')](_0x57f9('0xa'),attributes,{'tableName':_0x57f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x57f9('0xc'),'collate':_0x57f9('0xd')});}; \ No newline at end of file +var _0x587f=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','define'];(function(_0x2d7cca,_0x104977){var _0x347b84=function(_0xfda4ea){while(--_0xfda4ea){_0x2d7cca['push'](_0x2d7cca['shift']());}};_0x347b84(++_0x104977);}(_0x587f,0x18c));var _0xf587=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x587f[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0xf587('0x0'));var util=require(_0xf587('0x1'));var logger=require(_0xf587('0x2'))('api');var moment=require(_0xf587('0x3'));var BPromise=require(_0xf587('0x4'));var rp=require(_0xf587('0x5'));var fs=require('fs');var path=require(_0xf587('0x6'));var rimraf=require('rimraf');var config=require(_0xf587('0x7'));var attributes=require(_0xf587('0x8'));module['exports']=function(_0x3de3d9,_0x37c313){return _0x3de3d9[_0xf587('0x9')](_0xf587('0xa'),attributes,{'tableName':_0xf587('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf587('0xc'),'collate':_0xf587('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index acf05c4..8b0a045 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 _0xa2cf=['MailApplication,\x20%s,\x20%s','message','info','MailApplication','update','body','options','where','attributes','limit','debug','UpdateMailApplication','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code'];(function(_0x473046,_0x32fb02){var _0x31d10e=function(_0x178ea4){while(--_0x178ea4){_0x473046['push'](_0x473046['shift']());}};_0x31d10e(++_0x32fb02);}(_0xa2cf,0xbb));var _0xfa2c=function(_0x9bd1ca,_0x1060a0){_0x9bd1ca=_0x9bd1ca-0x0;var _0x198bbd=_0xa2cf[_0x9bd1ca];return _0x198bbd;};'use strict';var _=require('lodash');var util=require(_0xfa2c('0x0'));var moment=require(_0xfa2c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa2c('0x2'))['db'];var utils=require(_0xfa2c('0x3'));var logger=require(_0xfa2c('0x4'))(_0xfa2c('0x5'));var config=require(_0xfa2c('0x6'));var jayson=require(_0xfa2c('0x7'));var client=jayson[_0xfa2c('0x8')][_0xfa2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24433f,_0x195ea0,_0x33a030){return new BPromise(function(_0x1dd06e,_0xfb1dcb){return client[_0xfa2c('0xa')](_0x24433f,_0x33a030)[_0xfa2c('0xb')](function(_0x4491db){logger['info']('MailApplication,\x20%s,\x20%s',_0x195ea0,_0xfa2c('0xc'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x195ea0,_0xfa2c('0xc'),JSON[_0xfa2c('0xd')](_0x4491db));if(_0x4491db[_0xfa2c('0xe')]){if(_0x4491db[_0xfa2c('0xe')][_0xfa2c('0xf')]===0x1f4){logger[_0xfa2c('0xe')](_0xfa2c('0x10'),_0x195ea0,_0x4491db[_0xfa2c('0xe')][_0xfa2c('0x11')]);return _0xfb1dcb(_0x4491db['error'][_0xfa2c('0x11')]);}logger[_0xfa2c('0xe')](_0xfa2c('0x10'),_0x195ea0,_0x4491db[_0xfa2c('0xe')][_0xfa2c('0x11')]);return _0x1dd06e(_0x4491db['error'][_0xfa2c('0x11')]);}else{logger[_0xfa2c('0x12')](_0xfa2c('0x10'),_0x195ea0,_0xfa2c('0xc'));_0x1dd06e(_0x4491db['result'][_0xfa2c('0x11')]);}})['catch'](function(_0x30d205){logger[_0xfa2c('0xe')](_0xfa2c('0x10'),_0x195ea0,_0x30d205);_0xfb1dcb(_0x30d205);});});}exports['UpdateMailApplication']=function(_0x1d692d){var _0x439602=this;return new Promise(function(_0x43b7df,_0xa74140){return db[_0xfa2c('0x13')][_0xfa2c('0x14')](_0x1d692d[_0xfa2c('0x15')],{'raw':_0x1d692d[_0xfa2c('0x16')]?_0x1d692d[_0xfa2c('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d692d[_0xfa2c('0x16')]?_0x1d692d[_0xfa2c('0x16')][_0xfa2c('0x17')]||null:null,'attributes':_0x1d692d['options']?_0x1d692d['options'][_0xfa2c('0x18')]||null:null,'limit':_0x1d692d[_0xfa2c('0x16')]?_0x1d692d[_0xfa2c('0x16')][_0xfa2c('0x19')]||null:null})[_0xfa2c('0xb')](function(_0x513ef2){logger[_0xfa2c('0x12')]('UpdateMailApplication',_0x1d692d);logger[_0xfa2c('0x1a')](_0xfa2c('0x1b'),_0x1d692d,JSON[_0xfa2c('0xd')](_0x513ef2));_0x43b7df(_0x513ef2);})[_0xfa2c('0x1c')](function(_0x46ff6b){logger[_0xfa2c('0xe')](_0xfa2c('0x1b'),_0x46ff6b[_0xfa2c('0x11')],_0x1d692d);_0xa74140(_0x439602[_0xfa2c('0xe')](0x1f4,_0x46ff6b[_0xfa2c('0x11')]));});});}; \ No newline at end of file +var _0xb8e3=['code','message','info','catch','MailApplication,\x20%s,\x20%s','MailApplication','body','options','raw','where','limit','UpdateMailApplication','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3c1df4,_0x2079a2){var _0x3d5ed7=function(_0x1a9c6e){while(--_0x1a9c6e){_0x3c1df4['push'](_0x3c1df4['shift']());}};_0x3d5ed7(++_0x2079a2);}(_0xb8e3,0xa2));var _0x3b8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b8e('0x0'));var util=require('util');var moment=require(_0x3b8e('0x1'));var BPromise=require(_0x3b8e('0x2'));var rs=require(_0x3b8e('0x3'));var fs=require('fs');var Redis=require(_0x3b8e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b8e('0x5'));var logger=require(_0x3b8e('0x6'))(_0x3b8e('0x7'));var config=require(_0x3b8e('0x8'));var jayson=require(_0x3b8e('0x9'));var client=jayson['client'][_0x3b8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ab09,_0x2d26bc,_0x3f31e8){return new BPromise(function(_0x1227e4,_0x40cfdb){return client[_0x3b8e('0xb')](_0x54ab09,_0x3f31e8)[_0x3b8e('0xc')](function(_0x5ae8a9){logger['info']('MailApplication,\x20%s,\x20%s',_0x2d26bc,_0x3b8e('0xd'));logger[_0x3b8e('0xe')](_0x3b8e('0xf'),_0x2d26bc,'request\x20sent',JSON[_0x3b8e('0x10')](_0x5ae8a9));if(_0x5ae8a9[_0x3b8e('0x11')]){if(_0x5ae8a9['error'][_0x3b8e('0x12')]===0x1f4){logger[_0x3b8e('0x11')]('MailApplication,\x20%s,\x20%s',_0x2d26bc,_0x5ae8a9[_0x3b8e('0x11')][_0x3b8e('0x13')]);return _0x40cfdb(_0x5ae8a9['error'][_0x3b8e('0x13')]);}logger[_0x3b8e('0x11')]('MailApplication,\x20%s,\x20%s',_0x2d26bc,_0x5ae8a9[_0x3b8e('0x11')][_0x3b8e('0x13')]);return _0x1227e4(_0x5ae8a9['error'][_0x3b8e('0x13')]);}else{logger[_0x3b8e('0x14')]('MailApplication,\x20%s,\x20%s',_0x2d26bc,_0x3b8e('0xd'));_0x1227e4(_0x5ae8a9['result'][_0x3b8e('0x13')]);}})[_0x3b8e('0x15')](function(_0x361c4e){logger[_0x3b8e('0x11')](_0x3b8e('0x16'),_0x2d26bc,_0x361c4e);_0x40cfdb(_0x361c4e);});});}exports['UpdateMailApplication']=function(_0x22c655){var _0x4de2f0=this;return new Promise(function(_0x5f1464,_0x528ebe){return db[_0x3b8e('0x17')]['update'](_0x22c655[_0x3b8e('0x18')],{'raw':_0x22c655[_0x3b8e('0x19')]?_0x22c655[_0x3b8e('0x19')][_0x3b8e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22c655['options']?_0x22c655[_0x3b8e('0x19')][_0x3b8e('0x1b')]||null:null,'attributes':_0x22c655['options']?_0x22c655['options']['attributes']||null:null,'limit':_0x22c655['options']?_0x22c655[_0x3b8e('0x19')][_0x3b8e('0x1c')]||null:null})['then'](function(_0x5a6d0d){logger['info'](_0x3b8e('0x1d'),_0x22c655);logger[_0x3b8e('0xe')](_0x3b8e('0x1d'),_0x22c655,JSON[_0x3b8e('0x10')](_0x5a6d0d));_0x5f1464(_0x5a6d0d);})['catch'](function(_0x5b969e){logger[_0x3b8e('0x11')](_0x3b8e('0x1d'),_0x5b969e[_0x3b8e('0x13')],_0x22c655);_0x528ebe(_0x4de2f0[_0x3b8e('0x11')](0x1f4,_0x5b969e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3464df8..1c9f5ad 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 _0x0c28=['update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','describe','/:id','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x0c28,0x17a));var _0x80c2=function(_0x5f2156,_0xb141e2){_0x5f2156=_0x5f2156-0x0;var _0x315d72=_0x0c28[_0x5f2156];return _0x315d72;};'use strict';var express=require(_0x80c2('0x0'));var router=express[_0x80c2('0x1')]();var auth=require(_0x80c2('0x2'));var interaction=require(_0x80c2('0x3'));var controller=require(_0x80c2('0x4'));router[_0x80c2('0x5')]('/',auth['isAuthenticated'](),controller[_0x80c2('0x6')]);router[_0x80c2('0x5')](_0x80c2('0x7'),auth['isAuthenticated'](),controller[_0x80c2('0x8')]);router['get'](_0x80c2('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x80c2('0xa'),auth[_0x80c2('0xb')](),controller[_0x80c2('0xc')]);router[_0x80c2('0x5')](_0x80c2('0xd'),auth[_0x80c2('0xb')](),controller[_0x80c2('0xe')]);router[_0x80c2('0xf')]('/',auth[_0x80c2('0xb')](),controller[_0x80c2('0x10')]);router[_0x80c2('0xf')](_0x80c2('0xa'),auth[_0x80c2('0xb')](),controller[_0x80c2('0x11')]);router[_0x80c2('0xf')](_0x80c2('0x12'),auth[_0x80c2('0xb')](),interaction[_0x80c2('0x13')](_0x80c2('0x14'),_0x80c2('0x15')),controller[_0x80c2('0x16')]);router[_0x80c2('0x17')](_0x80c2('0x9'),auth['isAuthenticated'](),interaction[_0x80c2('0x13')](_0x80c2('0x14'),_0x80c2('0x18')),controller[_0x80c2('0x19')]);router[_0x80c2('0x1a')](_0x80c2('0x9'),auth['isAuthenticated'](),interaction[_0x80c2('0x13')](_0x80c2('0x14'),_0x80c2('0x1b')),controller[_0x80c2('0x1c')]);router[_0x80c2('0x1a')]('/:id/tags',auth[_0x80c2('0xb')](),controller[_0x80c2('0x1d')]);module[_0x80c2('0x1e')]=router; \ No newline at end of file +var _0x7746=['express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','tracked','mail','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports'];(function(_0x517cd7,_0x4eed1a){var _0x557e73=function(_0x54ab86){while(--_0x54ab86){_0x517cd7['push'](_0x517cd7['shift']());}};_0x557e73(++_0x4eed1a);}(_0x7746,0x1e0));var _0x6774=function(_0x41abab,_0x3b6cc4){_0x41abab=_0x41abab-0x0;var _0x259af5=_0x7746[_0x41abab];return _0x259af5;};'use strict';var express=require(_0x6774('0x0'));var router=express['Router']();var auth=require(_0x6774('0x1'));var interaction=require(_0x6774('0x2'));var controller=require(_0x6774('0x3'));router[_0x6774('0x4')]('/',auth[_0x6774('0x5')](),controller[_0x6774('0x6')]);router[_0x6774('0x4')]('/describe',auth[_0x6774('0x5')](),controller[_0x6774('0x7')]);router['get'](_0x6774('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x6774('0x4')](_0x6774('0x9'),auth[_0x6774('0x5')](),controller[_0x6774('0xa')]);router[_0x6774('0x4')](_0x6774('0xb'),auth[_0x6774('0x5')](),controller['download']);router[_0x6774('0xc')]('/',auth[_0x6774('0x5')](),controller[_0x6774('0xd')]);router[_0x6774('0xc')](_0x6774('0x9'),auth['isAuthenticated'](),controller['addMessage']);router[_0x6774('0xc')]('/:id/tags',auth[_0x6774('0x5')](),interaction[_0x6774('0xe')](_0x6774('0xf'),'mailinteraction:addtags'),controller[_0x6774('0x10')]);router['put'](_0x6774('0x8'),auth['isAuthenticated'](),interaction['tracked'](_0x6774('0xf'),_0x6774('0x11')),controller[_0x6774('0x12')]);router[_0x6774('0x13')](_0x6774('0x8'),auth['isAuthenticated'](),interaction[_0x6774('0xe')](_0x6774('0xf'),_0x6774('0x14')),controller[_0x6774('0x15')]);router['delete'](_0x6774('0x16'),auth[_0x6774('0x5')](),controller['removeTags']);module[_0x6774('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 87532cf..2856251 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 _0xc8fd=['TEXT','ENUM','out','INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc8fd,0x1ab));var _0xdc8f=function(_0x23d3ba,_0x32fada){_0x23d3ba=_0x23d3ba-0x0;var _0x2afe1b=_0xc8fd[_0x23d3ba];return _0x2afe1b;};'use strict';var Sequelize=require(_0xdc8f('0x0'));var iconv=require(_0xdc8f('0x1'));module['exports']={'closed':{'type':Sequelize[_0xdc8f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdc8f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xdc8f('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdc8f('0x4')]},'note':{'type':Sequelize[_0xdc8f('0x4')]},'inReplyTo':{'type':Sequelize[_0xdc8f('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdc8f('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xdc8f('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xdc8f('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xdc8f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdc8f('0x6')]('in',_0xdc8f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdc8f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdc8f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdc8f('0x8')]}}; \ No newline at end of file +var _0x079f=['ENUM','out','sequelize','exports','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x1f6559,_0x5dc12a){var _0x3d57d1=function(_0x202a95){while(--_0x202a95){_0x1f6559['push'](_0x1f6559['shift']());}};_0x3d57d1(++_0x5dc12a);}(_0x079f,0x122));var _0xf079=function(_0x22d153,_0x4f6dbf){_0x22d153=_0x22d153-0x0;var _0x5c4ade=_0x079f[_0x22d153];return _0x5c4ade;};'use strict';var Sequelize=require(_0xf079('0x0'));var iconv=require('iconv');module[_0xf079('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf079('0x2')]},'disposition':{'type':Sequelize[_0xf079('0x3')]},'secondDisposition':{'type':Sequelize[_0xf079('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf079('0x3')]},'note':{'type':Sequelize[_0xf079('0x3')]},'inReplyTo':{'type':Sequelize[_0xf079('0x3')](0x1fe)},'to':{'type':Sequelize[_0xf079('0x3')]},'cc':{'type':Sequelize[_0xf079('0x4')](_0xf079('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xf079('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf079('0x2')]},'substatus':{'type':Sequelize[_0xf079('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xf079('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf079('0x7')]('in',_0xf079('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf079('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf079('0x7')]('in',_0xf079('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 079600a..08ab48e 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 _0x4965=['readFileSync','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','path','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','error','stack','name','send','index','map','MailInteraction','fieldName','type','key','getOptions','findAll','mail','show','params','keys','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','merge','catch','create','update','body','find','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','true','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','subject','get','each','missing.recipient@your.company.com','createdAt','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync'];(function(_0x1e5f76,_0x38b1c1){var _0xb5b961=function(_0x159ce9){while(--_0x159ce9){_0x1e5f76['push'](_0x1e5f76['shift']());}};_0xb5b961(++_0x38b1c1);}(_0x4965,0x163));var _0x5496=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x4965[_0x506172];return _0x2723c0;};'use strict';var emlformat=require(_0x5496('0x0'));var rimraf=require(_0x5496('0x1'));var zipdir=require(_0x5496('0x2'));var moment=require(_0x5496('0x3'));var BPromise=require(_0x5496('0x4'));var util=require('util');var path=require(_0x5496('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0x5496('0x6'));var Redis=require('ioredis');var interaction=require(_0x5496('0x7'));var qs=require(_0x5496('0x8'));var logger=require(_0x5496('0x9'))(_0x5496('0xa'));var config=require('../../config/environment');var db=require(_0x5496('0xb'))['db'];var htmlEntities=require(_0x5496('0xc'));config[_0x5496('0xd')]=_[_0x5496('0xe')](config[_0x5496('0xd')],{'host':_0x5496('0xf'),'port':0x18eb});var socket=require(_0x5496('0x10'))(new Redis(config[_0x5496('0xd')]));require(_0x5496('0x11'))[_0x5496('0x12')](socket);function respondWithStatusCode(_0x5d5d1e,_0x2deaab){_0x2deaab=_0x2deaab||0xcc;return function(_0x365acf){if(_0x365acf){return _0x5d5d1e[_0x5496('0x13')](_0x2deaab);}return _0x5d5d1e[_0x5496('0x14')](_0x2deaab)[_0x5496('0x15')]();};}function respondWithResult(_0x56859a,_0x44e98d){_0x44e98d=_0x44e98d||0xc8;return function(_0x5b9cdf){if(_0x5b9cdf){return _0x56859a[_0x5496('0x14')](_0x44e98d)[_0x5496('0x16')](_0x5b9cdf);}};}function respondWithFilteredResult(_0x53eb8f,_0xbf5d54){return function(_0x3cafae){if(_0x3cafae){var _0x33e98f=typeof _0xbf5d54[_0x5496('0x17')]==='undefined'&&typeof _0xbf5d54[_0x5496('0x18')]===_0x5496('0x19');var _0x56f3ec=_0x3cafae[_0x5496('0x1a')];var _0x2041b2=_0x33e98f?0x0:_0xbf5d54['offset'];var _0xcadb44=_0x33e98f?_0x3cafae[_0x5496('0x1a')]:_0xbf5d54['offset']+_0xbf5d54['limit'];var _0x713942;if(_0xcadb44>=_0x56f3ec){_0xcadb44=_0x56f3ec;_0x713942=0xc8;}else{_0x713942=0xce;}_0x53eb8f[_0x5496('0x14')](_0x713942);return _0x53eb8f[_0x5496('0x1b')](_0x5496('0x1c'),_0x2041b2+'-'+_0xcadb44+'/'+_0x56f3ec)['json'](_0x3cafae);}return null;};}function saveUpdates(_0x393a67){return function(_0x45bdb9){if(_0x45bdb9){return _0x45bdb9['update'](_0x393a67)[_0x5496('0x1d')](function(_0x268d7d){return _0x268d7d;});}return null;};}function removeEntity(_0xefd4){return function(_0xd6a7a2){if(_0xd6a7a2){return _0xd6a7a2['destroy']()[_0x5496('0x1d')](function(){_0xefd4[_0x5496('0x14')](0xcc)[_0x5496('0x15')]();});}};}function handleEntityNotFound(_0x1944ea){return function(_0x5e48a2){if(!_0x5e48a2){_0x1944ea[_0x5496('0x13')](0x194);}return _0x5e48a2;};}function handleError(_0xb7df09,_0x3e1e18){_0x3e1e18=_0x3e1e18||0x1f4;return function(_0xa8ed30){logger[_0x5496('0x1e')](_0xa8ed30[_0x5496('0x1f')]);if(_0xa8ed30[_0x5496('0x20')]){delete _0xa8ed30[_0x5496('0x20')];}_0xb7df09[_0x5496('0x14')](_0x3e1e18)[_0x5496('0x21')](_0xa8ed30);};}exports[_0x5496('0x22')]=function(_0x4b4df2,_0x65a547){var _0x9df44d={};var _0x43f60f=_[_0x5496('0x23')](db[_0x5496('0x24')]['rawAttributes'],function(_0x1eb91d){return{'name':_0x1eb91d[_0x5496('0x25')],'type':_0x1eb91d[_0x5496('0x26')][_0x5496('0x27')]};});_0x9df44d=qs[_0x5496('0x28')](_0x43f60f,_0x4b4df2);return interaction[_0x5496('0x29')](_0x5496('0x2a'),_0x4b4df2['query'],_0x4b4df2['user'],_0x9df44d,_0x43f60f)[_0x5496('0x1d')](respondWithFilteredResult(_0x65a547,_0x9df44d))['catch'](handleError(_0x65a547,null));};exports[_0x5496('0x2b')]=function(_0x3ccec0,_0x3a6f8a){var _0x445bb8={'raw':![],'where':{'id':_0x3ccec0[_0x5496('0x2c')]['id']}},_0x51ae14={};_0x51ae14['model']=_[_0x5496('0x2d')](db[_0x5496('0x24')][_0x5496('0x2e')]);_0x51ae14[_0x5496('0x2f')]=_[_0x5496('0x2d')](_0x3ccec0['query']);_0x51ae14['filters']=_[_0x5496('0x30')](_0x51ae14[_0x5496('0x31')],_0x51ae14[_0x5496('0x2f')]);_0x445bb8[_0x5496('0x32')]=_['intersection'](_0x51ae14[_0x5496('0x31')],qs[_0x5496('0x33')](_0x3ccec0[_0x5496('0x2f')][_0x5496('0x33')]));_0x445bb8[_0x5496('0x32')]=_0x445bb8[_0x5496('0x32')][_0x5496('0x34')]?_0x445bb8[_0x5496('0x32')]:_0x51ae14[_0x5496('0x31')];if(_0x3ccec0[_0x5496('0x2f')][_0x5496('0x35')]){_0x445bb8['include']=[{'all':!![]}];}_0x445bb8=_[_0x5496('0x36')]({},_0x445bb8,_0x3ccec0['options']);return db['MailInteraction']['find'](_0x445bb8)[_0x5496('0x1d')](handleEntityNotFound(_0x3a6f8a,null))[_0x5496('0x1d')](respondWithResult(_0x3a6f8a,null))[_0x5496('0x37')](handleError(_0x3a6f8a,null));};exports[_0x5496('0x38')]=function(_0x1be6fa,_0x27d778){return db[_0x5496('0x24')][_0x5496('0x38')](_0x1be6fa['body'],{})[_0x5496('0x1d')](respondWithResult(_0x27d778,0xc9))[_0x5496('0x37')](handleError(_0x27d778,null));};exports[_0x5496('0x39')]=function(_0x4dbd97,_0x5682f9){if(_0x4dbd97[_0x5496('0x3a')]['id']){delete _0x4dbd97[_0x5496('0x3a')]['id'];}return db[_0x5496('0x24')]['find']({'where':{'id':_0x4dbd97[_0x5496('0x2c')]['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x5682f9,null))[_0x5496('0x1d')](saveUpdates(_0x4dbd97['body'],null))[_0x5496('0x1d')](respondWithResult(_0x5682f9,null))[_0x5496('0x37')](handleError(_0x5682f9,null));};exports['destroy']=function(_0x86f1b4,_0x2c0020){return db[_0x5496('0x24')][_0x5496('0x3b')]({'where':{'id':_0x86f1b4[_0x5496('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2c0020,null))[_0x5496('0x1d')](removeEntity(_0x2c0020,null))['catch'](handleError(_0x2c0020,null));};exports['describe']=function(_0x32aef9,_0x371e99){return db[_0x5496('0x24')][_0x5496('0x3c')]()[_0x5496('0x1d')](respondWithResult(_0x371e99,null))['catch'](handleError(_0x371e99,null));};exports[_0x5496('0x3d')]=function(_0x5391ce,_0x1dacb5){return db[_0x5496('0x3e')][_0x5496('0x3b')]({'where':{'id':_0x5391ce['params']['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x1dacb5,null))['then'](function(_0x16f183){if(_0x16f183){return _0x16f183['addMessage'](_0x5391ce[_0x5496('0x3a')][_0x5496('0x3f')],_[_0x5496('0x40')](_0x5391ce[_0x5496('0x3a')],[_0x5496('0x3f'),'id'])||{});}})[_0x5496('0x1d')](respondWithResult(_0x1dacb5,null))[_0x5496('0x37')](handleError(_0x1dacb5,null));};exports[_0x5496('0x41')]=function(_0x4e75c2,_0x5cf87f){var _0x2dd4b5={'raw':![],'where':{}};var _0x2cec4f={};var _0x4db470={'count':0x0,'rows':[]};return db[_0x5496('0x24')][_0x5496('0x42')]({'where':{'id':_0x4e75c2['params']['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x5cf87f,null))[_0x5496('0x1d')](function(_0xaec6be){if(_0xaec6be){_0x2cec4f[_0x5496('0x31')]=_['keys'](db[_0x5496('0x3e')][_0x5496('0x2e')]);_0x2cec4f['query']=_['keys'](_0x4e75c2[_0x5496('0x2f')]);_0x2cec4f[_0x5496('0x43')]=_[_0x5496('0x30')](_0x2cec4f[_0x5496('0x31')],_0x2cec4f[_0x5496('0x2f')]);_0x2dd4b5[_0x5496('0x32')]=_[_0x5496('0x30')](_0x2cec4f['model'],qs[_0x5496('0x33')](_0x4e75c2[_0x5496('0x2f')][_0x5496('0x33')]));_0x2dd4b5[_0x5496('0x32')]=_0x2dd4b5['attributes'][_0x5496('0x34')]?_0x2dd4b5[_0x5496('0x32')]:_0x2cec4f[_0x5496('0x31')];if(!_0x4e75c2[_0x5496('0x2f')][_0x5496('0x44')]('nolimit')){_0x2dd4b5[_0x5496('0x18')]=qs['limit'](_0x4e75c2[_0x5496('0x2f')][_0x5496('0x18')]);_0x2dd4b5['offset']=qs[_0x5496('0x17')](_0x4e75c2['query']['offset']);}_0x2dd4b5['order']=qs[_0x5496('0x45')](_0x4e75c2[_0x5496('0x2f')][_0x5496('0x45')]);_0x2dd4b5[_0x5496('0x46')]=qs[_0x5496('0x43')](_[_0x5496('0x47')](_0x4e75c2['query'],_0x2cec4f[_0x5496('0x43')]));_0x2dd4b5['where']['MailInteractionId']=_0xaec6be['id'];if(_0x4e75c2[_0x5496('0x2f')][_0x5496('0x48')]){_0x2dd4b5[_0x5496('0x46')]=_[_0x5496('0x36')](_0x2dd4b5[_0x5496('0x46')],{'$or':_[_0x5496('0x23')](_0x2dd4b5['attributes'],function(_0x17cd8b){var _0x3e0138={};_0x3e0138[_0x17cd8b]={'$like':'%'+_0x4e75c2['query'][_0x5496('0x48')]+'%'};return _0x3e0138;})});}if(_0x4e75c2[_0x5496('0x2f')][_0x5496('0x49')]){var _0x35e6f5=_0x4e75c2[_0x5496('0x2f')][_0x5496('0x49')][_0x5496('0x4a')](',');var _0x3be0fb={};_0x3be0fb[_0x35e6f5[0x0]]={'$gte':moment(_0x35e6f5[0x1])['format'](_0x5496('0x4b'))};_0x2dd4b5[_0x5496('0x46')]=_['merge'](_0x2dd4b5[_0x5496('0x46')],_0x3be0fb);}_0x2dd4b5=_[_0x5496('0x36')]({},_0x2dd4b5,_0x4e75c2['options']);return db[_0x5496('0x3e')][_0x5496('0x1a')]({'where':_0x2dd4b5[_0x5496('0x46')]})[_0x5496('0x1d')](function(_0x27e730){_0x4db470[_0x5496('0x1a')]=_0x27e730;if(_0x4e75c2[_0x5496('0x2f')][_0x5496('0x35')]){_0x2dd4b5[_0x5496('0x4c')]=[{'all':!![]}];}return db['MailMessage'][_0x5496('0x29')](_0x2dd4b5);})['then'](function(_0x1f8f53){if(_0x4e75c2[_0x5496('0x2f')]['inlineCss']===_0x5496('0x4d')){for(var _0x333a6e=0x0;_0x333a6e<_0x1f8f53[_0x5496('0x34')];_0x333a6e++){_0x1f8f53[_0x333a6e][_0x5496('0x3a')]=juice(_0x1f8f53[_0x333a6e][_0x5496('0x3a')]);}}_0x4db470[_0x5496('0x4e')]=_0x1f8f53;return _0x4db470;});}})[_0x5496('0x1d')](respondWithFilteredResult(_0x5cf87f,_0x2dd4b5))['catch'](handleError(_0x5cf87f,null));};exports[_0x5496('0x4f')]=function(_0x53fb31,_0x3cceb7){return db[_0x5496('0x24')]['find']({'where':{'id':_0x53fb31['params']['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x3cceb7,null))['then'](function(_0x334dbc){if(_0x334dbc){return _0x334dbc[_0x5496('0x50')](_0x53fb31['body'][_0x5496('0x3f')],_[_0x5496('0x40')](_0x53fb31[_0x5496('0x3a')],['ids','id'])||{})['spread'](function(){return db[_0x5496('0x51')][_0x5496('0x29')]({'attributes':['id',_0x5496('0x20'),_0x5496('0x52')],'where':{'id':_0x53fb31[_0x5496('0x3a')][_0x5496('0x3f')]}});})[_0x5496('0x1d')](function(_0xd85b47){socket[_0x5496('0x53')](_0x5496('0x54'),{'id':Number(_0x53fb31['params']['id']),'tags':_0xd85b47||[]});return{'id':Number(_0x53fb31[_0x5496('0x2c')]['id']),'tags':_0xd85b47||[]};});}})['then'](respondWithResult(_0x3cceb7,null))[_0x5496('0x37')](handleError(_0x3cceb7,null));};exports[_0x5496('0x55')]=function(_0x31a13f,_0x2f6b02){return db[_0x5496('0x24')][_0x5496('0x3b')]({'where':{'id':_0x31a13f[_0x5496('0x2c')]['id']}})[_0x5496('0x1d')](handleEntityNotFound(_0x2f6b02,null))['then'](function(_0x2f0ffc){if(_0x2f0ffc){return _0x2f0ffc[_0x5496('0x55')](_0x31a13f[_0x5496('0x2f')][_0x5496('0x3f')]);}})[_0x5496('0x1d')](respondWithStatusCode(_0x2f6b02,null))[_0x5496('0x37')](handleError(_0x2f6b02,null));};exports[_0x5496('0x56')]=function(_0x3b6c27,_0x298cef){var _0x24cf90=moment()[_0x5496('0x57')]()[_0x5496('0x58')]();var _0x5536d4=path[_0x5496('0x59')](config[_0x5496('0x5a')],_0x5496('0x5b'),_0x5496('0x5c'),_0x5496('0x5d'));var _0x10787b=path[_0x5496('0x59')](config[_0x5496('0x5a')],'server','files',_0x5496('0x5e'));var _0x169b71=path[_0x5496('0x59')](_0x5536d4,_0x24cf90);var _0x28c96c=util['format'](_0x5496('0x5f'),_0x3b6c27[_0x5496('0x2c')]['id'],_0x24cf90);var _0x3ef212=path[_0x5496('0x59')](_0x5536d4,_0x28c96c);var _0x557c00=[];if(_0x3b6c27[_0x5496('0x2f')][_0x5496('0x5e')]){_0x557c00[_0x5496('0x60')]({'model':db[_0x5496('0x61')],'as':_0x5496('0x62'),'raw':!![]});}var _0x1705bf=[{'model':db[_0x5496('0x3e')],'as':_0x5496('0x63'),'attributes':['id',_0x5496('0x3a'),_0x5496('0x64'),'to','cc','bcc',_0x5496('0x65'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x557c00}];return db[_0x5496('0x24')][_0x5496('0x3b')]({'where':{'id':_0x3b6c27['params']['id']},'include':_0x1705bf})[_0x5496('0x1d')](handleEntityNotFound(_0x298cef,null))[_0x5496('0x1d')](function(_0x4a3992){if(_0x4a3992&&_0x4a3992['Messages']){var _0x1217be=_0x4a3992[_0x5496('0x66')]({'plain':!![]});fs['mkdirSync'](_0x169b71);return BPromise[_0x5496('0x67')](_0x1217be[_0x5496('0x63')],function(_0xbb0baf,_0x4b8f18){var _0x1e3131={'from':_0xbb0baf['from'],'to':_0xbb0baf['to']||_0x5496('0x68'),'subject':_0xbb0baf[_0x5496('0x65')],'html':htmlEntities['decode'](_0xbb0baf[_0x5496('0x3a')]),'headers':{'Date':moment(_0xbb0baf[_0x5496('0x69')])[_0x5496('0x6a')](_0x5496('0x6b'))},'attachments':[]};if(_0xbb0baf['cc']){_0x1e3131[_0x5496('0x6c')]['Cc']=_0xbb0baf['cc'];}if(_0xbb0baf[_0x5496('0x6d')]){_0x1e3131['headers'][_0x5496('0x6e')]=_0xbb0baf[_0x5496('0x6d')];}return new BPromise(function(_0x151da3,_0x3cd80b){if(_0xbb0baf[_0x5496('0x62')]){for(var _0x295761=0x0;_0x295761<_0xbb0baf[_0x5496('0x62')]['length'];_0x295761++){var _0x29771d=_0xbb0baf[_0x5496('0x62')][_0x295761];var _0x1bc680=path[_0x5496('0x59')](_0x10787b,_0x29771d[_0x5496('0x6f')]);if(fs[_0x5496('0x70')](_0x1bc680)){_0x1e3131[_0x5496('0x5e')][_0x5496('0x60')]({'name':_0x29771d[_0x5496('0x20')],'contentType':_0x29771d['type'],'data':fs[_0x5496('0x71')](_0x1bc680)});}}}emlformat[_0x5496('0x72')](_0x1e3131,function(_0x597314,_0x417d36){if(_0x597314)return _0x3cd80b(_0x597314);fs[_0x5496('0x73')](path['join'](_0x169b71,util['format'](_0x5496('0x74'),_0x4b8f18)),_0x417d36);return _0x151da3(_0x417d36);});});})[_0x5496('0x1d')](function(){return new BPromise(function(_0x32fb9e,_0x1705c8){zipdir(_0x169b71,{'saveTo':_0x3ef212},function(_0x223ae1,_0x382e38){if(_0x223ae1)return _0x1705c8(_0x223ae1);return _0x32fb9e(_0x382e38);});})['then'](function(){return new BPromise(function(_0x594a59,_0x520e33){rimraf(_0x169b71,function(_0x2a6f4b){if(_0x2a6f4b)_0x520e33(_0x2a6f4b);return _0x594a59();});});})[_0x5496('0x1d')](function(){return _0x298cef[_0x5496('0x56')](_0x3ef212,_0x28c96c,function(_0x4acb09){if(!_0x4acb09)fs['unlinkSync'](_0x3ef212);});});});}else{return _0x298cef['sendStatus'](0xc8);}})[_0x5496('0x37')](handleError(_0x298cef,null));}; \ No newline at end of file +var _0x2cdb=['from','missing.recipient@your.company.com','subject','headers','basename','existsSync','push','type','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','zip-dir','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','then','destroy','stack','name','send','map','MailInteraction','rawAttributes','fieldName','key','findAll','user','show','params','keys','query','filters','intersection','model','fields','attributes','length','include','merge','options','create','body','find','catch','describe','addMessage','MailMessage','ids','omit','getMessages','nolimit','order','sort','pick','MailInteractionId','filter','where','$gte','split','includeAll','inlineCss','rows','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','format','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','createdAt','get','mkdirSync','each'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2cdb,0x1c9));var _0xb2cd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2cdb[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb2cd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xb2cd('0x1'));var path=require(_0xb2cd('0x2'));var fs=require('fs');var _=require(_0xb2cd('0x3'));var juice=require(_0xb2cd('0x4'));var Redis=require(_0xb2cd('0x5'));var interaction=require(_0xb2cd('0x6'));var qs=require(_0xb2cd('0x7'));var logger=require(_0xb2cd('0x8'))('api');var config=require(_0xb2cd('0x9'));var db=require(_0xb2cd('0xa'))['db'];var htmlEntities=require(_0xb2cd('0xb'));config[_0xb2cd('0xc')]=_[_0xb2cd('0xd')](config[_0xb2cd('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2cd('0xe'))(new Redis(config[_0xb2cd('0xc')]));require(_0xb2cd('0xf'))[_0xb2cd('0x10')](socket);function respondWithStatusCode(_0x289699,_0x55b72d){_0x55b72d=_0x55b72d||0xcc;return function(_0x35f635){if(_0x35f635){return _0x289699[_0xb2cd('0x11')](_0x55b72d);}return _0x289699[_0xb2cd('0x12')](_0x55b72d)[_0xb2cd('0x13')]();};}function respondWithResult(_0x104078,_0x129a1d){_0x129a1d=_0x129a1d||0xc8;return function(_0x49578b){if(_0x49578b){return _0x104078['status'](_0x129a1d)[_0xb2cd('0x14')](_0x49578b);}};}function respondWithFilteredResult(_0x1912ab,_0x58b4c1){return function(_0x4b32d3){if(_0x4b32d3){var _0x93ff10=typeof _0x58b4c1[_0xb2cd('0x15')]===_0xb2cd('0x16')&&typeof _0x58b4c1['limit']===_0xb2cd('0x16');var _0x434cd7=_0x4b32d3[_0xb2cd('0x17')];var _0x556e59=_0x93ff10?0x0:_0x58b4c1[_0xb2cd('0x15')];var _0x258570=_0x93ff10?_0x4b32d3['count']:_0x58b4c1['offset']+_0x58b4c1[_0xb2cd('0x18')];var _0x10ef0a;if(_0x258570>=_0x434cd7){_0x258570=_0x434cd7;_0x10ef0a=0xc8;}else{_0x10ef0a=0xce;}_0x1912ab[_0xb2cd('0x12')](_0x10ef0a);return _0x1912ab[_0xb2cd('0x19')]('Content-Range',_0x556e59+'-'+_0x258570+'/'+_0x434cd7)['json'](_0x4b32d3);}return null;};}function saveUpdates(_0x33b41b){return function(_0x2fde45){if(_0x2fde45){return _0x2fde45['update'](_0x33b41b)[_0xb2cd('0x1a')](function(_0x43a92c){return _0x43a92c;});}return null;};}function removeEntity(_0x36c21f){return function(_0x1cecd4){if(_0x1cecd4){return _0x1cecd4[_0xb2cd('0x1b')]()[_0xb2cd('0x1a')](function(){_0x36c21f[_0xb2cd('0x12')](0xcc)[_0xb2cd('0x13')]();});}};}function handleEntityNotFound(_0x469827){return function(_0x4c35ef){if(!_0x4c35ef){_0x469827['sendStatus'](0x194);}return _0x4c35ef;};}function handleError(_0x47d6ae,_0x190d4c){_0x190d4c=_0x190d4c||0x1f4;return function(_0x210617){logger['error'](_0x210617[_0xb2cd('0x1c')]);if(_0x210617[_0xb2cd('0x1d')]){delete _0x210617['name'];}_0x47d6ae[_0xb2cd('0x12')](_0x190d4c)[_0xb2cd('0x1e')](_0x210617);};}exports['index']=function(_0x343bbb,_0x5e0f72){var _0xd78709={};var _0x5341e1=_[_0xb2cd('0x1f')](db[_0xb2cd('0x20')][_0xb2cd('0x21')],function(_0x1c1787){return{'name':_0x1c1787[_0xb2cd('0x22')],'type':_0x1c1787['type'][_0xb2cd('0x23')]};});_0xd78709=qs['getOptions'](_0x5341e1,_0x343bbb);return interaction[_0xb2cd('0x24')]('mail',_0x343bbb['query'],_0x343bbb[_0xb2cd('0x25')],_0xd78709,_0x5341e1)[_0xb2cd('0x1a')](respondWithFilteredResult(_0x5e0f72,_0xd78709))['catch'](handleError(_0x5e0f72,null));};exports[_0xb2cd('0x26')]=function(_0x29a139,_0x36c04b){var _0x271f1a={'raw':![],'where':{'id':_0x29a139[_0xb2cd('0x27')]['id']}},_0x50ae4b={};_0x50ae4b['model']=_[_0xb2cd('0x28')](db[_0xb2cd('0x20')][_0xb2cd('0x21')]);_0x50ae4b[_0xb2cd('0x29')]=_[_0xb2cd('0x28')](_0x29a139['query']);_0x50ae4b[_0xb2cd('0x2a')]=_[_0xb2cd('0x2b')](_0x50ae4b[_0xb2cd('0x2c')],_0x50ae4b[_0xb2cd('0x29')]);_0x271f1a['attributes']=_[_0xb2cd('0x2b')](_0x50ae4b[_0xb2cd('0x2c')],qs[_0xb2cd('0x2d')](_0x29a139['query'][_0xb2cd('0x2d')]));_0x271f1a[_0xb2cd('0x2e')]=_0x271f1a[_0xb2cd('0x2e')][_0xb2cd('0x2f')]?_0x271f1a[_0xb2cd('0x2e')]:_0x50ae4b[_0xb2cd('0x2c')];if(_0x29a139[_0xb2cd('0x29')]['includeAll']){_0x271f1a[_0xb2cd('0x30')]=[{'all':!![]}];}_0x271f1a=_[_0xb2cd('0x31')]({},_0x271f1a,_0x29a139[_0xb2cd('0x32')]);return db[_0xb2cd('0x20')]['find'](_0x271f1a)['then'](handleEntityNotFound(_0x36c04b,null))[_0xb2cd('0x1a')](respondWithResult(_0x36c04b,null))['catch'](handleError(_0x36c04b,null));};exports['create']=function(_0x4eb843,_0x4ccfaf){return db[_0xb2cd('0x20')][_0xb2cd('0x33')](_0x4eb843[_0xb2cd('0x34')],{})[_0xb2cd('0x1a')](respondWithResult(_0x4ccfaf,0xc9))['catch'](handleError(_0x4ccfaf,null));};exports['update']=function(_0x12ecf0,_0x1136bd){if(_0x12ecf0[_0xb2cd('0x34')]['id']){delete _0x12ecf0[_0xb2cd('0x34')]['id'];}return db[_0xb2cd('0x20')][_0xb2cd('0x35')]({'where':{'id':_0x12ecf0['params']['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x1136bd,null))[_0xb2cd('0x1a')](saveUpdates(_0x12ecf0['body'],null))[_0xb2cd('0x1a')](respondWithResult(_0x1136bd,null))[_0xb2cd('0x36')](handleError(_0x1136bd,null));};exports[_0xb2cd('0x1b')]=function(_0x50b530,_0x95ead6){return db['MailInteraction'][_0xb2cd('0x35')]({'where':{'id':_0x50b530[_0xb2cd('0x27')]['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x95ead6,null))['then'](removeEntity(_0x95ead6,null))[_0xb2cd('0x36')](handleError(_0x95ead6,null));};exports[_0xb2cd('0x37')]=function(_0x30970c,_0x4793ba){return db[_0xb2cd('0x20')]['describe']()[_0xb2cd('0x1a')](respondWithResult(_0x4793ba,null))[_0xb2cd('0x36')](handleError(_0x4793ba,null));};exports[_0xb2cd('0x38')]=function(_0x10602f,_0x420d80){return db[_0xb2cd('0x39')][_0xb2cd('0x35')]({'where':{'id':_0x10602f[_0xb2cd('0x27')]['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x420d80,null))[_0xb2cd('0x1a')](function(_0xf7f84){if(_0xf7f84){return _0xf7f84[_0xb2cd('0x38')](_0x10602f['body'][_0xb2cd('0x3a')],_[_0xb2cd('0x3b')](_0x10602f['body'],[_0xb2cd('0x3a'),'id'])||{});}})[_0xb2cd('0x1a')](respondWithResult(_0x420d80,null))[_0xb2cd('0x36')](handleError(_0x420d80,null));};exports[_0xb2cd('0x3c')]=function(_0x1ded9a,_0x27ab65){var _0x1667f4={'raw':![],'where':{}};var _0x7eabd7={};var _0x2fa54a={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x1ded9a['params']['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x27ab65,null))[_0xb2cd('0x1a')](function(_0x46e3c0){if(_0x46e3c0){_0x7eabd7[_0xb2cd('0x2c')]=_[_0xb2cd('0x28')](db[_0xb2cd('0x39')][_0xb2cd('0x21')]);_0x7eabd7['query']=_[_0xb2cd('0x28')](_0x1ded9a[_0xb2cd('0x29')]);_0x7eabd7[_0xb2cd('0x2a')]=_[_0xb2cd('0x2b')](_0x7eabd7['model'],_0x7eabd7[_0xb2cd('0x29')]);_0x1667f4['attributes']=_[_0xb2cd('0x2b')](_0x7eabd7[_0xb2cd('0x2c')],qs[_0xb2cd('0x2d')](_0x1ded9a['query'][_0xb2cd('0x2d')]));_0x1667f4[_0xb2cd('0x2e')]=_0x1667f4[_0xb2cd('0x2e')][_0xb2cd('0x2f')]?_0x1667f4[_0xb2cd('0x2e')]:_0x7eabd7[_0xb2cd('0x2c')];if(!_0x1ded9a[_0xb2cd('0x29')]['hasOwnProperty'](_0xb2cd('0x3d'))){_0x1667f4[_0xb2cd('0x18')]=qs[_0xb2cd('0x18')](_0x1ded9a['query']['limit']);_0x1667f4[_0xb2cd('0x15')]=qs['offset'](_0x1ded9a[_0xb2cd('0x29')][_0xb2cd('0x15')]);}_0x1667f4[_0xb2cd('0x3e')]=qs[_0xb2cd('0x3f')](_0x1ded9a[_0xb2cd('0x29')]['sort']);_0x1667f4['where']=qs[_0xb2cd('0x2a')](_[_0xb2cd('0x40')](_0x1ded9a['query'],_0x7eabd7[_0xb2cd('0x2a')]));_0x1667f4['where'][_0xb2cd('0x41')]=_0x46e3c0['id'];if(_0x1ded9a[_0xb2cd('0x29')][_0xb2cd('0x42')]){_0x1667f4[_0xb2cd('0x43')]=_[_0xb2cd('0x31')](_0x1667f4['where'],{'$or':_[_0xb2cd('0x1f')](_0x1667f4[_0xb2cd('0x2e')],function(_0x1d7c80){var _0x162ae8={};_0x162ae8[_0x1d7c80]={'$like':'%'+_0x1ded9a[_0xb2cd('0x29')][_0xb2cd('0x42')]+'%'};return _0x162ae8;})});}if(_0x1ded9a['query'][_0xb2cd('0x44')]){var _0x416846=_0x1ded9a[_0xb2cd('0x29')][_0xb2cd('0x44')][_0xb2cd('0x45')](',');var _0x2e4bf3={};_0x2e4bf3[_0x416846[0x0]]={'$gte':moment(_0x416846[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1667f4[_0xb2cd('0x43')]=_[_0xb2cd('0x31')](_0x1667f4[_0xb2cd('0x43')],_0x2e4bf3);}_0x1667f4=_[_0xb2cd('0x31')]({},_0x1667f4,_0x1ded9a[_0xb2cd('0x32')]);return db[_0xb2cd('0x39')][_0xb2cd('0x17')]({'where':_0x1667f4[_0xb2cd('0x43')]})[_0xb2cd('0x1a')](function(_0x463977){_0x2fa54a[_0xb2cd('0x17')]=_0x463977;if(_0x1ded9a['query'][_0xb2cd('0x46')]){_0x1667f4[_0xb2cd('0x30')]=[{'all':!![]}];}return db[_0xb2cd('0x39')][_0xb2cd('0x24')](_0x1667f4);})['then'](function(_0x61fd96){if(_0x1ded9a['query'][_0xb2cd('0x47')]==='true'){for(var _0x364abb=0x0;_0x364abb<_0x61fd96[_0xb2cd('0x2f')];_0x364abb++){_0x61fd96[_0x364abb]['body']=juice(_0x61fd96[_0x364abb][_0xb2cd('0x34')]);}}_0x2fa54a[_0xb2cd('0x48')]=_0x61fd96;return _0x2fa54a;});}})[_0xb2cd('0x1a')](respondWithFilteredResult(_0x27ab65,_0x1667f4))[_0xb2cd('0x36')](handleError(_0x27ab65,null));};exports[_0xb2cd('0x49')]=function(_0x18547a,_0x2c9f29){return db['MailInteraction']['find']({'where':{'id':_0x18547a[_0xb2cd('0x27')]['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x2c9f29,null))[_0xb2cd('0x1a')](function(_0x11a912){if(_0x11a912){return _0x11a912[_0xb2cd('0x4a')](_0x18547a['body'][_0xb2cd('0x3a')],_['omit'](_0x18547a['body'],[_0xb2cd('0x3a'),'id'])||{})[_0xb2cd('0x4b')](function(){return db['Tag'][_0xb2cd('0x24')]({'attributes':['id',_0xb2cd('0x1d'),'color'],'where':{'id':_0x18547a[_0xb2cd('0x34')]['ids']}});})[_0xb2cd('0x1a')](function(_0x49f711){socket[_0xb2cd('0x4c')](_0xb2cd('0x4d'),{'id':Number(_0x18547a[_0xb2cd('0x27')]['id']),'tags':_0x49f711||[]});return{'id':Number(_0x18547a[_0xb2cd('0x27')]['id']),'tags':_0x49f711||[]};});}})[_0xb2cd('0x1a')](respondWithResult(_0x2c9f29,null))[_0xb2cd('0x36')](handleError(_0x2c9f29,null));};exports['removeTags']=function(_0x1105f0,_0x1ba3d4){return db[_0xb2cd('0x20')][_0xb2cd('0x35')]({'where':{'id':_0x1105f0[_0xb2cd('0x27')]['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x1ba3d4,null))[_0xb2cd('0x1a')](function(_0x4c0b22){if(_0x4c0b22){return _0x4c0b22[_0xb2cd('0x4e')](_0x1105f0[_0xb2cd('0x29')][_0xb2cd('0x3a')]);}})[_0xb2cd('0x1a')](respondWithStatusCode(_0x1ba3d4,null))[_0xb2cd('0x36')](handleError(_0x1ba3d4,null));};exports[_0xb2cd('0x4f')]=function(_0x8d0d7d,_0x1299e2){var _0x17394c=moment()[_0xb2cd('0x50')]()[_0xb2cd('0x51')]();var _0x59f252=path['join'](config[_0xb2cd('0x52')],_0xb2cd('0x53'),_0xb2cd('0x54'),_0xb2cd('0x55'));var _0x2b7497=path[_0xb2cd('0x56')](config[_0xb2cd('0x52')],_0xb2cd('0x53'),'files','attachments');var _0x224545=path['join'](_0x59f252,_0x17394c);var _0x1ae9f0=util[_0xb2cd('0x57')](_0xb2cd('0x58'),_0x8d0d7d[_0xb2cd('0x27')]['id'],_0x17394c);var _0x539aef=path['join'](_0x59f252,_0x1ae9f0);var _0x5548b0=[];if(_0x8d0d7d[_0xb2cd('0x29')][_0xb2cd('0x59')]){_0x5548b0['push']({'model':db[_0xb2cd('0x5a')],'as':_0xb2cd('0x5b'),'raw':!![]});}var _0x3ccb04=[{'model':db[_0xb2cd('0x39')],'as':_0xb2cd('0x5c'),'attributes':['id',_0xb2cd('0x34'),'from','to','cc',_0xb2cd('0x5d'),'subject',_0xb2cd('0x5e')],'where':{'secret':![]},'order':qs[_0xb2cd('0x3f')]('id'),'include':_0x5548b0}];return db[_0xb2cd('0x20')][_0xb2cd('0x35')]({'where':{'id':_0x8d0d7d[_0xb2cd('0x27')]['id']},'include':_0x3ccb04})['then'](handleEntityNotFound(_0x1299e2,null))[_0xb2cd('0x1a')](function(_0x53b260){if(_0x53b260&&_0x53b260[_0xb2cd('0x5c')]){var _0xdd5aab=_0x53b260[_0xb2cd('0x5f')]({'plain':!![]});fs[_0xb2cd('0x60')](_0x224545);return BPromise[_0xb2cd('0x61')](_0xdd5aab[_0xb2cd('0x5c')],function(_0x32149d,_0xa4d136){var _0x219a19={'from':_0x32149d[_0xb2cd('0x62')],'to':_0x32149d['to']||_0xb2cd('0x63'),'subject':_0x32149d[_0xb2cd('0x64')],'html':htmlEntities['decode'](_0x32149d['body']),'headers':{'Date':moment(_0x32149d[_0xb2cd('0x5e')])[_0xb2cd('0x57')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x32149d['cc']){_0x219a19[_0xb2cd('0x65')]['Cc']=_0x32149d['cc'];}if(_0x32149d['bcc']){_0x219a19[_0xb2cd('0x65')]['Bcc']=_0x32149d['bcc'];}return new BPromise(function(_0xd6aa54,_0x203765){if(_0x32149d[_0xb2cd('0x5b')]){for(var _0x19345e=0x0;_0x19345e<_0x32149d['Attachments'][_0xb2cd('0x2f')];_0x19345e++){var _0x587e3d=_0x32149d[_0xb2cd('0x5b')][_0x19345e];var _0x4413fe=path[_0xb2cd('0x56')](_0x2b7497,_0x587e3d[_0xb2cd('0x66')]);if(fs[_0xb2cd('0x67')](_0x4413fe)){_0x219a19[_0xb2cd('0x59')][_0xb2cd('0x68')]({'name':_0x587e3d[_0xb2cd('0x1d')],'contentType':_0x587e3d[_0xb2cd('0x69')],'data':fs[_0xb2cd('0x6a')](_0x4413fe)});}}}emlformat[_0xb2cd('0x6b')](_0x219a19,function(_0x22de47,_0x30139c){if(_0x22de47)return _0x203765(_0x22de47);fs[_0xb2cd('0x6c')](path[_0xb2cd('0x56')](_0x224545,util[_0xb2cd('0x57')](_0xb2cd('0x6d'),_0xa4d136)),_0x30139c);return _0xd6aa54(_0x30139c);});});})[_0xb2cd('0x1a')](function(){return new BPromise(function(_0x52ca3b,_0x57962d){zipdir(_0x224545,{'saveTo':_0x539aef},function(_0x1a5bd3,_0x264341){if(_0x1a5bd3)return _0x57962d(_0x1a5bd3);return _0x52ca3b(_0x264341);});})[_0xb2cd('0x1a')](function(){return new BPromise(function(_0xf4b9b0,_0x4a445d){rimraf(_0x224545,function(_0x46f454){if(_0x46f454)_0x4a445d(_0x46f454);return _0xf4b9b0();});});})[_0xb2cd('0x1a')](function(){return _0x1299e2[_0xb2cd('0x4f')](_0x539aef,_0x1ae9f0,function(_0x4322cd){if(!_0x4322cd)fs[_0xb2cd('0x6e')](_0x539aef);});});});}else{return _0x1299e2[_0xb2cd('0x11')](0xc8);}})['catch'](handleError(_0x1299e2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 4e214a8..8d38727 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 _0x15f3=['MailMessage','save','update','setDataValue','then','unreadMessages','catch','hook','exports','events','../../mysqldb'];(function(_0x3fbbf2,_0x436a2f){var _0x427e5c=function(_0x1a12be){while(--_0x1a12be){_0x3fbbf2['push'](_0x3fbbf2['shift']());}};_0x427e5c(++_0x436a2f);}(_0x15f3,0x1e2));var _0x315f=function(_0x5706c4,_0x5bb0cd){_0x5706c4=_0x5706c4-0x0;var _0x4be9eb=_0x15f3[_0x5706c4];return _0x4be9eb;};'use strict';var EventEmitter=require(_0x315f('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x315f('0x1'))['db'][_0x315f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x315f('0x3'),'afterUpdate':_0x315f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x373102){return function(_0x318ad4,_0x4f23c0,_0x71d727){_0x318ad4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x408cd7){_0x318ad4[_0x315f('0x5')]('Users',_0x408cd7['map'](function(_0x7e65ef){return{'id':_0x7e65ef['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x318ad4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x315f('0x6')](function(_0x251bc6){_0x318ad4[_0x315f('0x5')](_0x315f('0x7'),_0x251bc6['length']);MailInteractionEvents['emit'](_0x373102+':'+_0x318ad4['id'],_0x318ad4);MailInteractionEvents['emit'](_0x373102,_0x318ad4);_0x71d727(null);})[_0x315f('0x8')](_0x71d727(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x315f('0x9')](e,emitEvent(event));}}module[_0x315f('0xa')]=MailInteractionEvents; \ No newline at end of file +var _0x7efe=['catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','getUsers','then','setDataValue','map','unreadMessages','length','emit'];(function(_0x365bf8,_0x4fba55){var _0x1a7275=function(_0x32eb37){while(--_0x32eb37){_0x365bf8['push'](_0x365bf8['shift']());}};_0x1a7275(++_0x4fba55);}(_0x7efe,0x123));var _0xe7ef=function(_0x386f01,_0x23cccc){_0x386f01=_0x386f01-0x0;var _0x5082c7=_0x7efe[_0x386f01];return _0x5082c7;};'use strict';var EventEmitter=require(_0xe7ef('0x0'));var MailInteraction=require(_0xe7ef('0x1'))['db'][_0xe7ef('0x2')];var MailMessage=require(_0xe7ef('0x1'))['db'][_0xe7ef('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe7ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe7ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a3652){return function(_0x3323bd,_0xfe066a,_0x11e23e){_0x3323bd[_0xe7ef('0x6')]({'attributes':['id'],'raw':!![]})[_0xe7ef('0x7')](function(_0x16633f){_0x3323bd[_0xe7ef('0x8')]('Users',_0x16633f[_0xe7ef('0x9')](function(_0x15c580){return{'id':_0x15c580['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3323bd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5d52cd){_0x3323bd['setDataValue'](_0xe7ef('0xa'),_0x5d52cd[_0xe7ef('0xb')]);MailInteractionEvents['emit'](_0x2a3652+':'+_0x3323bd['id'],_0x3323bd);MailInteractionEvents[_0xe7ef('0xc')](_0x2a3652,_0x3323bd);_0x11e23e(null);})[_0xe7ef('0xd')](_0x11e23e(null));};}for(var e in events){if(events[_0xe7ef('0xe')](e)){var event=events[e];MailInteraction[_0xe7ef('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 389d7de..f834612 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 _0x3533=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','format','models','MailMessage','update'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x3533,0xbf));var _0x3353=function(_0x3dd29c,_0x35c9bb){_0x3dd29c=_0x3dd29c-0x0;var _0x21c9e7=_0x3533[_0x3dd29c];return _0x21c9e7;};'use strict';var _=require(_0x3353('0x0'));var util=require(_0x3353('0x1'));var logger=require(_0x3353('0x2'))('api');var moment=require(_0x3353('0x3'));var BPromise=require(_0x3353('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3353('0x5'));var rimraf=require(_0x3353('0x6'));var config=require('../../config/environment');var attributes=require(_0x3353('0x7'));module[_0x3353('0x8')]=function(_0xbca700,_0x5cc249){return _0xbca700[_0x3353('0x9')](_0x3353('0xa'),attributes,{'tableName':_0x3353('0xb'),'paranoid':![],'indexes':[{'name':_0x3353('0xc'),'fields':[_0x3353('0xd'),'to'],'type':_0x3353('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xee3296,_0x5c6dcc,_0x1df6af){if(_0xee3296[_0x3353('0xf')]){_0xee3296['substatusAt']=moment()['format'](_0x3353('0x10'));}if(_0xee3296[_0x3353('0x11')]){_0xee3296[_0x3353('0x12')]=moment()['format'](_0x3353('0x10'));}_0x1df6af(null,_0x5c6dcc);},'beforeUpdate':function(_0x354182,_0x3341e3,_0x2a54fc){if(_0x354182[_0x3353('0x13')](_0x3353('0xf'))){_0x354182[_0x3353('0x14')]=_0x354182['substatus']?moment()[_0x3353('0x15')](_0x3353('0x10')):null;}if(_0x354182[_0x3353('0x13')]('closed')){_0x354182['closedAt']=moment()[_0x3353('0x15')](_0x3353('0x10'));_0x354182[_0x3353('0xf')]=null;_0x354182['substatusAt']=null;}_0x2a54fc(null,_0x354182);},'afterUpdate':function(_0x3f6552,_0x164320,_0x44118d){var _0x3df942=_0xbca700[_0x3353('0x16')];var _0x338d88=_0x3f6552['get']({'plain':!![]});if(_0x338d88[_0x3353('0x11')]){return _0x3df942[_0x3353('0x17')][_0x3353('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x338d88['id']}})['then'](function(){_0x44118d();})['catch'](function(_0x2c394a){_0x44118d(_0x2c394a);});}else{_0x44118d();}}},'charset':_0x3353('0x19'),'collate':_0x3353('0x1a')});}; \ No newline at end of file +var _0xd7b2=['models','get','update','then','catch','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format'];(function(_0x2665a3,_0x1bd09e){var _0x4f8fb0=function(_0x255207){while(--_0x255207){_0x2665a3['push'](_0x2665a3['shift']());}};_0x4f8fb0(++_0x1bd09e);}(_0xd7b2,0xf9));var _0x2d7b=function(_0x4081aa,_0x26f620){_0x4081aa=_0x4081aa-0x0;var _0x3c69c7=_0xd7b2[_0x4081aa];return _0x3c69c7;};'use strict';var _=require('lodash');var util=require(_0x2d7b('0x0'));var logger=require(_0x2d7b('0x1'))(_0x2d7b('0x2'));var moment=require(_0x2d7b('0x3'));var BPromise=require(_0x2d7b('0x4'));var rp=require(_0x2d7b('0x5'));var fs=require('fs');var path=require(_0x2d7b('0x6'));var rimraf=require(_0x2d7b('0x7'));var config=require(_0x2d7b('0x8'));var attributes=require(_0x2d7b('0x9'));module[_0x2d7b('0xa')]=function(_0x25879c,_0x2383f8){return _0x25879c[_0x2d7b('0xb')]('MailInteraction',attributes,{'tableName':_0x2d7b('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x2d7b('0xd'),'to'],'type':_0x2d7b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2afd4a,_0x47ebd7,_0x4157fa){if(_0x2afd4a[_0x2d7b('0xf')]){_0x2afd4a[_0x2d7b('0x10')]=moment()['format'](_0x2d7b('0x11'));}if(_0x2afd4a[_0x2d7b('0x12')]){_0x2afd4a[_0x2d7b('0x13')]=moment()[_0x2d7b('0x14')](_0x2d7b('0x11'));}_0x4157fa(null,_0x47ebd7);},'beforeUpdate':function(_0x3dfab0,_0x89760a,_0x4dba59){if(_0x3dfab0['changed'](_0x2d7b('0xf'))){_0x3dfab0[_0x2d7b('0x10')]=_0x3dfab0[_0x2d7b('0xf')]?moment()[_0x2d7b('0x14')](_0x2d7b('0x11')):null;}if(_0x3dfab0['changed'](_0x2d7b('0x12'))){_0x3dfab0[_0x2d7b('0x13')]=moment()[_0x2d7b('0x14')](_0x2d7b('0x11'));_0x3dfab0['substatus']=null;_0x3dfab0[_0x2d7b('0x10')]=null;}_0x4dba59(null,_0x3dfab0);},'afterUpdate':function(_0x1f885b,_0x2ed554,_0xbe9833){var _0x33c10e=_0x25879c[_0x2d7b('0x15')];var _0x16ca17=_0x1f885b[_0x2d7b('0x16')]({'plain':!![]});if(_0x16ca17[_0x2d7b('0x12')]){return _0x33c10e['MailMessage'][_0x2d7b('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x16ca17['id']}})[_0x2d7b('0x18')](function(){_0xbe9833();})[_0x2d7b('0x19')](function(_0x13ff68){_0xbe9833(_0x13ff68);});}else{_0xbe9833();}}},'charset':_0x2d7b('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index cf68162..9e14462 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 _0x7676=['then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','update','options','raw','where','attributes','limit','UpdateMailInteraction','debug','catch','AddTagsToMailInteraction','MailInteraction','find','body','ids','spread','AddTags','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x7676,0xb8));var _0x6767=function(_0x256f53,_0x382d25){_0x256f53=_0x256f53-0x0;var _0x4a0a3b=_0x7676[_0x256f53];return _0x4a0a3b;};'use strict';var _=require(_0x6767('0x0'));var util=require(_0x6767('0x1'));var moment=require(_0x6767('0x2'));var BPromise=require('bluebird');var rs=require(_0x6767('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6767('0x4'));var logger=require('../../config/logger')(_0x6767('0x5'));var config=require(_0x6767('0x6'));var jayson=require(_0x6767('0x7'));var client=jayson['client'][_0x6767('0x8')]({'port':0x232a});config[_0x6767('0x9')]=_[_0x6767('0xa')](config['redis'],{'host':_0x6767('0xb'),'port':0x18eb});var socket=require(_0x6767('0xc'))(new Redis(config[_0x6767('0x9')]));require(_0x6767('0xd'))[_0x6767('0xe')](socket);function respondWithRpcPromise(_0x336315,_0x2d5260,_0x94cf0d){return new BPromise(function(_0x36b8bb,_0x10a98f){return client[_0x6767('0xf')](_0x336315,_0x94cf0d)[_0x6767('0x10')](function(_0x47b7a4){logger[_0x6767('0x11')](_0x6767('0x12'),_0x2d5260,_0x6767('0x13'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2d5260,_0x6767('0x13'),JSON[_0x6767('0x14')](_0x47b7a4));if(_0x47b7a4['error']){if(_0x47b7a4[_0x6767('0x15')][_0x6767('0x16')]===0x1f4){logger['error'](_0x6767('0x12'),_0x2d5260,_0x47b7a4[_0x6767('0x15')][_0x6767('0x17')]);return _0x10a98f(_0x47b7a4[_0x6767('0x15')]['message']);}logger[_0x6767('0x15')]('MailInteraction,\x20%s,\x20%s',_0x2d5260,_0x47b7a4[_0x6767('0x15')][_0x6767('0x17')]);return _0x36b8bb(_0x47b7a4[_0x6767('0x15')]['message']);}else{logger[_0x6767('0x11')]('MailInteraction,\x20%s,\x20%s',_0x2d5260,_0x6767('0x13'));_0x36b8bb(_0x47b7a4['result'][_0x6767('0x17')]);}})['catch'](function(_0x47e032){logger[_0x6767('0x15')](_0x6767('0x12'),_0x2d5260,_0x47e032);_0x10a98f(_0x47e032);});});}exports['UpdateMailInteraction']=function(_0x1287c3){var _0x234676=this;return new Promise(function(_0x58a483,_0x2f5350){return db['MailInteraction'][_0x6767('0x18')](_0x1287c3['body'],{'raw':_0x1287c3['options']?_0x1287c3[_0x6767('0x19')][_0x6767('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1287c3[_0x6767('0x19')]?_0x1287c3['options'][_0x6767('0x1b')]||null:null,'attributes':_0x1287c3[_0x6767('0x19')]?_0x1287c3[_0x6767('0x19')][_0x6767('0x1c')]||null:null,'limit':_0x1287c3[_0x6767('0x19')]?_0x1287c3[_0x6767('0x19')][_0x6767('0x1d')]||null:null})[_0x6767('0x10')](function(_0x136122){logger[_0x6767('0x11')](_0x6767('0x1e'),_0x1287c3);logger[_0x6767('0x1f')]('UpdateMailInteraction',_0x1287c3,JSON[_0x6767('0x14')](_0x136122));_0x58a483(_0x136122);})[_0x6767('0x20')](function(_0xc06b4e){logger['error'](_0x6767('0x1e'),_0xc06b4e[_0x6767('0x17')],_0x1287c3);_0x2f5350(_0x234676['error'](0x1f4,_0xc06b4e[_0x6767('0x17')]));});});};exports[_0x6767('0x21')]=function(_0x40f691){return new Promise(function(_0x5885ac,_0x373da7){return db[_0x6767('0x22')][_0x6767('0x23')]({'where':_0x40f691[_0x6767('0x19')]?_0x40f691['options'][_0x6767('0x1b')]||null:null})[_0x6767('0x10')](function(_0x163b46){if(_0x163b46){return _0x163b46['addTags'](_0x40f691[_0x6767('0x24')][_0x6767('0x25')],_['omit'](_0x40f691[_0x6767('0x24')],['ids','id'])||{});}})[_0x6767('0x26')](function(_0x40bb22){logger[_0x6767('0x11')]('AddTags',_0x40f691);logger[_0x6767('0x1f')](_0x6767('0x27'),_0x40f691,JSON[_0x6767('0x14')](_0x40bb22));_0x5885ac(_0x40bb22);})[_0x6767('0x20')](function(_0x470c84){logger[_0x6767('0x15')](_0x6767('0x27'),_0x470c84[_0x6767('0x17')],_0x40f691);_0x373da7(_this[_0x6767('0x15')](0x1f4,_0x470c84['message']));});});}; \ No newline at end of file +var _0xfb65=['AddTagsToMailInteraction','addTags','omit','body','ids','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','limit'];(function(_0x54ffe2,_0x27c17c){var _0x30f4f2=function(_0x26a131){while(--_0x26a131){_0x54ffe2['push'](_0x54ffe2['shift']());}};_0x30f4f2(++_0x27c17c);}(_0xfb65,0x82));var _0x5fb6=function(_0x15eb17,_0x3bd3c1){_0x15eb17=_0x15eb17-0x0;var _0x283076=_0xfb65[_0x15eb17];return _0x283076;};'use strict';var _=require('lodash');var util=require(_0x5fb6('0x0'));var moment=require(_0x5fb6('0x1'));var BPromise=require('bluebird');var rs=require(_0x5fb6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fb6('0x3'))['db'];var utils=require(_0x5fb6('0x4'));var logger=require(_0x5fb6('0x5'))(_0x5fb6('0x6'));var config=require(_0x5fb6('0x7'));var jayson=require(_0x5fb6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5fb6('0x9')]=_[_0x5fb6('0xa')](config[_0x5fb6('0x9')],{'host':_0x5fb6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5fb6('0x9')]));require(_0x5fb6('0xc'))[_0x5fb6('0xd')](socket);function respondWithRpcPromise(_0x21e613,_0x4ff5d2,_0x2b63fd){return new BPromise(function(_0xcf0402,_0x491bb6){return client[_0x5fb6('0xe')](_0x21e613,_0x2b63fd)[_0x5fb6('0xf')](function(_0x160070){logger[_0x5fb6('0x10')](_0x5fb6('0x11'),_0x4ff5d2,'request\x20sent');logger[_0x5fb6('0x12')](_0x5fb6('0x13'),_0x4ff5d2,_0x5fb6('0x14'),JSON[_0x5fb6('0x15')](_0x160070));if(_0x160070[_0x5fb6('0x16')]){if(_0x160070[_0x5fb6('0x16')][_0x5fb6('0x17')]===0x1f4){logger[_0x5fb6('0x16')]('MailInteraction,\x20%s,\x20%s',_0x4ff5d2,_0x160070['error'][_0x5fb6('0x18')]);return _0x491bb6(_0x160070[_0x5fb6('0x16')]['message']);}logger[_0x5fb6('0x16')](_0x5fb6('0x11'),_0x4ff5d2,_0x160070[_0x5fb6('0x16')]['message']);return _0xcf0402(_0x160070[_0x5fb6('0x16')][_0x5fb6('0x18')]);}else{logger[_0x5fb6('0x10')](_0x5fb6('0x11'),_0x4ff5d2,_0x5fb6('0x14'));_0xcf0402(_0x160070[_0x5fb6('0x19')]['message']);}})[_0x5fb6('0x1a')](function(_0x5aeb08){logger[_0x5fb6('0x16')]('MailInteraction,\x20%s,\x20%s',_0x4ff5d2,_0x5aeb08);_0x491bb6(_0x5aeb08);});});}exports[_0x5fb6('0x1b')]=function(_0x3ec3b0){var _0x402e8a=this;return new Promise(function(_0x1c5891,_0x5885f1){return db[_0x5fb6('0x1c')][_0x5fb6('0x1d')](_0x3ec3b0['body'],{'raw':_0x3ec3b0['options']?_0x3ec3b0[_0x5fb6('0x1e')][_0x5fb6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ec3b0['options']?_0x3ec3b0[_0x5fb6('0x1e')][_0x5fb6('0x20')]||null:null,'attributes':_0x3ec3b0[_0x5fb6('0x1e')]?_0x3ec3b0[_0x5fb6('0x1e')]['attributes']||null:null,'limit':_0x3ec3b0[_0x5fb6('0x1e')]?_0x3ec3b0[_0x5fb6('0x1e')][_0x5fb6('0x21')]||null:null})[_0x5fb6('0xf')](function(_0x1b6953){logger[_0x5fb6('0x10')]('UpdateMailInteraction',_0x3ec3b0);logger['debug'](_0x5fb6('0x1b'),_0x3ec3b0,JSON[_0x5fb6('0x15')](_0x1b6953));_0x1c5891(_0x1b6953);})[_0x5fb6('0x1a')](function(_0x3ce22f){logger[_0x5fb6('0x16')](_0x5fb6('0x1b'),_0x3ce22f[_0x5fb6('0x18')],_0x3ec3b0);_0x5885f1(_0x402e8a['error'](0x1f4,_0x3ce22f[_0x5fb6('0x18')]));});});};exports[_0x5fb6('0x22')]=function(_0xac9a34){return new Promise(function(_0x5a1f0d,_0x2afc08){return db[_0x5fb6('0x1c')]['find']({'where':_0xac9a34[_0x5fb6('0x1e')]?_0xac9a34[_0x5fb6('0x1e')]['where']||null:null})[_0x5fb6('0xf')](function(_0x4856d9){if(_0x4856d9){return _0x4856d9[_0x5fb6('0x23')](_0xac9a34['body']['ids'],_[_0x5fb6('0x24')](_0xac9a34[_0x5fb6('0x25')],[_0x5fb6('0x26'),'id'])||{});}})[_0x5fb6('0x27')](function(_0x36fc09){logger[_0x5fb6('0x10')]('AddTags',_0xac9a34);logger[_0x5fb6('0x12')](_0x5fb6('0x28'),_0xac9a34,JSON[_0x5fb6('0x15')](_0x36fc09));_0x5a1f0d(_0x36fc09);})[_0x5fb6('0x1a')](function(_0x6531fe){logger[_0x5fb6('0x16')](_0x5fb6('0x28'),_0x6531fe[_0x5fb6('0x18')],_0xac9a34);_0x2afc08(_this[_0x5fb6('0x16')](0x1f4,_0x6531fe[_0x5fb6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 089996c..dd31913 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 _0xe2c4=['./mailInteraction.events','save','remove','update','removeListener','register','length','mailInteraction:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2c4,0x88));var _0x4e2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe2c4[_0x59ee6f];return _0x4c0979;};'use strict';var MailInteractionEvents=require(_0x4e2c('0x0'));var events=[_0x4e2c('0x1'),_0x4e2c('0x2'),_0x4e2c('0x3')];function createListener(_0x2c90f8,_0x56f91e){return function(_0x47b6bd){_0x56f91e['emit'](_0x2c90f8,_0x47b6bd);};}function removeListener(_0x404223,_0x7adfad){return function(){MailInteractionEvents[_0x4e2c('0x4')](_0x404223,_0x7adfad);};}exports[_0x4e2c('0x5')]=function(_0x33dabf){for(var _0x4f8624=0x0,_0x3c563f=events[_0x4e2c('0x6')];_0x4f8624<_0x3c563f;_0x4f8624++){var _0x77a629=events[_0x4f8624];var _0x116aa9=createListener(_0x4e2c('0x7')+_0x77a629,_0x33dabf);MailInteractionEvents['on'](_0x77a629,_0x116aa9);}}; \ No newline at end of file +var _0x5662=['register','length','./mailInteraction.events','remove','emit'];(function(_0x21b0a2,_0x6ff36f){var _0x9aaa7f=function(_0x2ba2ba){while(--_0x2ba2ba){_0x21b0a2['push'](_0x21b0a2['shift']());}};_0x9aaa7f(++_0x6ff36f);}(_0x5662,0x12e));var _0x2566=function(_0x489fd4,_0x479f16){_0x489fd4=_0x489fd4-0x0;var _0x2b3bcb=_0x5662[_0x489fd4];return _0x2b3bcb;};'use strict';var MailInteractionEvents=require(_0x2566('0x0'));var events=['save',_0x2566('0x1'),'update'];function createListener(_0x1e34a3,_0x49bf34){return function(_0x34d735){_0x49bf34[_0x2566('0x2')](_0x1e34a3,_0x34d735);};}function removeListener(_0x4f95da,_0x52f15a){return function(){MailInteractionEvents['removeListener'](_0x4f95da,_0x52f15a);};}exports[_0x2566('0x3')]=function(_0xb8a5b7){for(var _0x47486c=0x0,_0x15098d=events[_0x2566('0x4')];_0x47486c<_0x15098d;_0x47486c++){var _0xbaf2f8=events[_0x47486c];var _0xe8794d=createListener('mailInteraction:'+_0xbaf2f8,_0xb8a5b7);MailInteractionEvents['on'](_0xbaf2f8,_0xe8794d);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 0c95efc..308072c 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 _0xc263=['get','/describe','describe','show','/:id/download','download','post','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0xd53918,_0x44cf40){var _0x32e15a=function(_0x3e4606){while(--_0x3e4606){_0xd53918['push'](_0xd53918['shift']());}};_0x32e15a(++_0x44cf40);}(_0xc263,0x171));var _0x3c26=function(_0x18b686,_0xa4e0f3){_0x18b686=_0x18b686-0x0;var _0x2f23d8=_0xc263[_0x18b686];return _0x2f23d8;};'use strict';var multer=require(_0x3c26('0x0'));var util=require('util');var path=require(_0x3c26('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c26('0x2'));var router=express[_0x3c26('0x3')]();var fs_extra=require(_0x3c26('0x4'));var auth=require(_0x3c26('0x5'));var interaction=require(_0x3c26('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router['get']('/',auth[_0x3c26('0x7')](),controller[_0x3c26('0x8')]);router[_0x3c26('0x9')](_0x3c26('0xa'),auth[_0x3c26('0x7')](),controller[_0x3c26('0xb')]);router[_0x3c26('0x9')]('/:id',auth[_0x3c26('0x7')](),controller[_0x3c26('0xc')]);router[_0x3c26('0x9')](_0x3c26('0xd'),auth[_0x3c26('0x7')](),controller[_0x3c26('0xe')]);router[_0x3c26('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3c26('0x10'),_0x3c26('0x11')),controller[_0x3c26('0x12')]);router[_0x3c26('0x13')](_0x3c26('0x14'),auth[_0x3c26('0x7')](),controller[_0x3c26('0x15')]);router[_0x3c26('0x13')](_0x3c26('0x16'),auth[_0x3c26('0x7')](),controller[_0x3c26('0x17')]);router[_0x3c26('0x13')]('/:id/reject',auth[_0x3c26('0x7')](),controller[_0x3c26('0x18')]);router['delete'](_0x3c26('0x14'),auth['isAuthenticated'](),controller[_0x3c26('0x19')]);module[_0x3c26('0x1a')]=router; \ No newline at end of file +var _0x4dd3=['isAuthenticated','index','/describe','/:id','/:id/download','download','post','mail','mailmessage:create','create','put','/:id/accept','reject','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x20752f,_0x2202a6){var _0x13b9c2=function(_0x79cb0c){while(--_0x79cb0c){_0x20752f['push'](_0x20752f['shift']());}};_0x13b9c2(++_0x2202a6);}(_0x4dd3,0xf5));var _0x34dd=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x4dd3[_0x202d24];return _0x2b3a8e;};'use strict';var multer=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var path=require(_0x34dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x34dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x34dd('0x4'));var interaction=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var controller=require('./mailMessage.controller');router[_0x34dd('0x7')]('/',auth[_0x34dd('0x8')](),controller[_0x34dd('0x9')]);router[_0x34dd('0x7')](_0x34dd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x34dd('0x7')](_0x34dd('0xb'),auth[_0x34dd('0x8')](),controller['show']);router[_0x34dd('0x7')](_0x34dd('0xc'),auth[_0x34dd('0x8')](),controller[_0x34dd('0xd')]);router[_0x34dd('0xe')]('/',auth[_0x34dd('0x8')](),interaction['tracked'](_0x34dd('0xf'),_0x34dd('0x10')),controller[_0x34dd('0x11')]);router[_0x34dd('0x12')](_0x34dd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x34dd('0x12')](_0x34dd('0x13'),auth[_0x34dd('0x8')](),controller['accept']);router[_0x34dd('0x12')]('/:id/reject',auth[_0x34dd('0x8')](),controller[_0x34dd('0x14')]);router[_0x34dd('0x15')](_0x34dd('0xb'),auth[_0x34dd('0x8')](),controller[_0x34dd('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1fc58ad..2644a37 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 _0x9238=['BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','lodash','TEXT','long'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9238,0x11f));var _0x8923=function(_0x1a1412,_0x58c658){_0x1a1412=_0x1a1412-0x0;var _0x51c2a1=_0x9238[_0x1a1412];return _0x51c2a1;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8923('0x0'));module['exports']={'body':{'type':Sequelize[_0x8923('0x1')](_0x8923('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8923('0x1')]('medium')},'read':{'type':Sequelize[_0x8923('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8923('0x4')]('in',_0x8923('0x5')),'defaultValue':_0x8923('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x8923('0x6')]},'to':{'type':Sequelize[_0x8923('0x1')](_0x8923('0x2'))},'cc':{'type':Sequelize[_0x8923('0x1')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x8923('0x2'))},'subject':{'type':Sequelize[_0x8923('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x8923('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8923('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8923('0x8')]},'originTo':{'type':Sequelize[_0x8923('0x1')](_0x8923('0x2'))},'originCc':{'type':Sequelize[_0x8923('0x1')](_0x8923('0x2'))},'originChannel':{'type':Sequelize[_0x8923('0x4')](_0x8923('0x9'),'Chat'),'defaultValue':_0x8923('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0xd6cb=['DATE','BOOLEAN','Chat','sequelize','lodash','exports','TEXT','long','medium','ENUM','STRING'];(function(_0x1e52ac,_0x23314b){var _0x19c1c7=function(_0x45b4f6){while(--_0x45b4f6){_0x1e52ac['push'](_0x1e52ac['shift']());}};_0x19c1c7(++_0x23314b);}(_0xd6cb,0x9d));var _0xbd6c=function(_0x3f4d7c,_0x2f1184){_0x3f4d7c=_0x3f4d7c-0x0;var _0x47bf26=_0xd6cb[_0x3f4d7c];return _0x47bf26;};'use strict';var Sequelize=require(_0xbd6c('0x0'));var _=require(_0xbd6c('0x1'));module[_0xbd6c('0x2')]={'body':{'type':Sequelize[_0xbd6c('0x3')](_0xbd6c('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbd6c('0x3')](_0xbd6c('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbd6c('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbd6c('0x7')](0x1fe)},'from':{'type':Sequelize[_0xbd6c('0x7')]},'to':{'type':Sequelize[_0xbd6c('0x3')]('long')},'cc':{'type':Sequelize[_0xbd6c('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xbd6c('0x4'))},'subject':{'type':Sequelize[_0xbd6c('0x3')]},'sentAt':{'type':Sequelize[_0xbd6c('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xbd6c('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xbd6c('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xbd6c('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xbd6c('0x4'))},'originChannel':{'type':Sequelize[_0xbd6c('0x6')]('Email',_0xbd6c('0xa')),'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 f37bc9f..17365c1 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 _0x551e=['join','root','server/files/attachments','basename','Contacts','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','read','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','event','accept','fromString','EventManager','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','channel','motionChannel','download','unix','toString','server','tmp','from','bcc','subject','createdAt','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','build','writeFileSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','offset','count','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','body','describe','create','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments'];(function(_0x346df3,_0x5b978e){var _0x352f88=function(_0x6bf70c){while(--_0x6bf70c){_0x346df3['push'](_0x346df3['shift']());}};_0x352f88(++_0x5b978e);}(_0x551e,0x188));var _0xe551=function(_0x5a5959,_0x524912){_0x5a5959=_0x5a5959-0x0;var _0x18e650=_0x551e[_0x5a5959];return _0x18e650;};'use strict';var emlformat=require(_0xe551('0x0'));var moment=require(_0xe551('0x1'));var BPromise=require(_0xe551('0x2'));var util=require(_0xe551('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xe551('0x4'));var Redis=require(_0xe551('0x5'));var htmlToText=require(_0xe551('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xe551('0x7'))(_0xe551('0x8'));var interaction_log=require(_0xe551('0x7'))(_0xe551('0x9'));var config=require(_0xe551('0xa'));var db=require('../../mysqldb')['db'];config[_0xe551('0xb')]=_[_0xe551('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0xe551('0xd'));require(_0xe551('0xe'))[_0xe551('0xf')](socket);var jayson=require(_0xe551('0x10'));var client=jayson[_0xe551('0x11')][_0xe551('0x12')]({'port':0x232c});var client9003=jayson[_0xe551('0x11')][_0xe551('0x12')]({'port':0x232b});var client9002=jayson[_0xe551('0x11')][_0xe551('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x2cd63e,_0x5b4cc6,_0x4e78b0,_0x55f508){return new BPromise(function(_0x46fb77,_0x2b4c7e){var _0x39adfb=_0x55f508||client;return _0x39adfb['request'](_0x2cd63e,_0x4e78b0)[_0xe551('0x13')](function(_0x5e7bf7){logger['info'](_0xe551('0x14'),_0x5b4cc6,_0xe551('0x15'));logger[_0xe551('0x16')](_0xe551('0x17'),_0x5b4cc6,_0xe551('0x15'),JSON[_0xe551('0x18')](_0x5e7bf7));if(_0x5e7bf7[_0xe551('0x19')]){if(_0x5e7bf7[_0xe551('0x19')][_0xe551('0x1a')]===0x1f4){logger[_0xe551('0x19')](_0xe551('0x14'),_0x5b4cc6,_0x5e7bf7['error'][_0xe551('0x1b')]);return _0x2b4c7e(_0x5e7bf7[_0xe551('0x19')][_0xe551('0x1b')]);}logger[_0xe551('0x19')](_0xe551('0x14'),_0x5b4cc6,_0x5e7bf7[_0xe551('0x19')]['message']);return _0x46fb77(_0x5e7bf7[_0xe551('0x19')][_0xe551('0x1b')]);}else{logger['info'](_0xe551('0x14'),_0x5b4cc6,'request\x20sent');_0x46fb77(_0x5e7bf7[_0xe551('0x1c')][_0xe551('0x1b')]);}})[_0xe551('0x1d')](function(_0x36fc84){logger['error'](_0xe551('0x14'),_0x5b4cc6,_0x36fc84);_0x2b4c7e(_0x36fc84);});});}function respondWithResult(_0x58858f,_0x25d9b1){_0x25d9b1=_0x25d9b1||0xc8;return function(_0x31fdae){if(_0x31fdae){return _0x58858f[_0xe551('0x1e')](_0x25d9b1)[_0xe551('0x1f')](_0x31fdae);}};}function respondWithFilteredResult(_0x20c0ad,_0x329469){return function(_0x1c7fb4){if(_0x1c7fb4){var _0x595d2d=typeof _0x329469['offset']===_0xe551('0x20')&&typeof _0x329469[_0xe551('0x21')]==='undefined';var _0x4c99ff=_0x1c7fb4['count'];var _0x5f364b=_0x595d2d?0x0:_0x329469[_0xe551('0x22')];var _0x2662ad=_0x595d2d?_0x1c7fb4[_0xe551('0x23')]:_0x329469[_0xe551('0x22')]+_0x329469[_0xe551('0x21')];var _0x2bc0c9;if(_0x2662ad>=_0x4c99ff){_0x2662ad=_0x4c99ff;_0x2bc0c9=0xc8;}else{_0x2bc0c9=0xce;}_0x20c0ad[_0xe551('0x1e')](_0x2bc0c9);return _0x20c0ad['set'](_0xe551('0x24'),_0x5f364b+'-'+_0x2662ad+'/'+_0x4c99ff)[_0xe551('0x1f')](_0x1c7fb4);}return null;};}function saveUpdates(_0x3adb71){return function(_0x2aba46){if(_0x2aba46){return _0x2aba46[_0xe551('0x25')](_0x3adb71)['then'](function(_0x56ec6c){return _0x56ec6c;});}return null;};}function removeEntity(_0x15724a){return function(_0x2f4d8e){if(_0x2f4d8e){return _0x2f4d8e[_0xe551('0x26')]()[_0xe551('0x13')](function(){_0x15724a[_0xe551('0x1e')](0xcc)[_0xe551('0x27')]();});}};}function handleEntityNotFound(_0x2e51a5){return function(_0x5119ed){if(!_0x5119ed){_0x2e51a5[_0xe551('0x28')](0x194);}return _0x5119ed;};}function handleError(_0x3f443d,_0x209397){_0x209397=_0x209397||0x1f4;return function(_0x3d3c2c){logger[_0xe551('0x19')](_0x3d3c2c[_0xe551('0x29')]);if(_0x3d3c2c[_0xe551('0x2a')]){delete _0x3d3c2c[_0xe551('0x2a')];}_0x3f443d[_0xe551('0x1e')](_0x209397)[_0xe551('0x2b')](_0x3d3c2c);};}exports[_0xe551('0x2c')]=function(_0x4b6b04,_0x54df31){var _0x21c597={},_0x4ac6bd={},_0x10154d={'count':0x0,'rows':[]};var _0x3cee14=_['map'](db[_0xe551('0x2d')][_0xe551('0x2e')],function(_0x17cfbd){return{'name':_0x17cfbd[_0xe551('0x2f')],'type':_0x17cfbd[_0xe551('0x30')][_0xe551('0x31')]};});_0x4ac6bd[_0xe551('0x32')]=_[_0xe551('0x33')](_0x3cee14,_0xe551('0x2a'));_0x4ac6bd[_0xe551('0x34')]=_['keys'](_0x4b6b04[_0xe551('0x34')]);_0x4ac6bd[_0xe551('0x35')]=_['intersection'](_0x4ac6bd[_0xe551('0x32')],_0x4ac6bd[_0xe551('0x34')]);_0x21c597[_0xe551('0x36')]=_[_0xe551('0x37')](_0x4ac6bd[_0xe551('0x32')],qs[_0xe551('0x38')](_0x4b6b04[_0xe551('0x34')][_0xe551('0x38')]));_0x21c597[_0xe551('0x36')]=_0x21c597['attributes'][_0xe551('0x39')]?_0x21c597['attributes']:_0x4ac6bd['model'];if(!_0x4b6b04['query'][_0xe551('0x3a')](_0xe551('0x3b'))){_0x21c597['limit']=qs[_0xe551('0x21')](_0x4b6b04[_0xe551('0x34')]['limit']);_0x21c597['offset']=qs[_0xe551('0x22')](_0x4b6b04['query']['offset']);}_0x21c597[_0xe551('0x3c')]=qs['sort'](_0x4b6b04[_0xe551('0x34')]['sort']);_0x21c597[_0xe551('0x3d')]=qs[_0xe551('0x35')](_[_0xe551('0x3e')](_0x4b6b04[_0xe551('0x34')],_0x4ac6bd[_0xe551('0x35')]),_0x3cee14);if(_0x4b6b04[_0xe551('0x34')][_0xe551('0x3f')]){_0x21c597['where']=_[_0xe551('0x40')](_0x21c597[_0xe551('0x3d')],{'$or':_[_0xe551('0x33')](_0x3cee14,function(_0x3a9b63){if(_0x3a9b63[_0xe551('0x30')]!=='VIRTUAL'){var _0x26df30={};_0x26df30[_0x3a9b63['name']]={'$like':'%'+_0x4b6b04[_0xe551('0x34')][_0xe551('0x3f')]+'%'};return _0x26df30;}})});}_0x21c597=_[_0xe551('0x40')]({},_0x21c597,_0x4b6b04[_0xe551('0x41')]);var _0x55a01e={'where':_0x21c597['where']};return db[_0xe551('0x2d')][_0xe551('0x23')](_0x55a01e)['then'](function(_0x25690d){_0x10154d['count']=_0x25690d;if(_0x4b6b04[_0xe551('0x34')][_0xe551('0x42')]){_0x21c597[_0xe551('0x43')]=[{'all':!![]}];}return db[_0xe551('0x2d')][_0xe551('0x44')](_0x21c597);})['then'](function(_0x40f54d){_0x10154d[_0xe551('0x45')]=_0x40f54d;return _0x10154d;})[_0xe551('0x13')](respondWithFilteredResult(_0x54df31,_0x21c597))['catch'](handleError(_0x54df31,null));};exports[_0xe551('0x46')]=function(_0x109bd3,_0x37d192){var _0x3956ca={'raw':!![],'where':{'id':_0x109bd3[_0xe551('0x47')]['id']}},_0x4309d5={};_0x4309d5[_0xe551('0x32')]=_[_0xe551('0x48')](db[_0xe551('0x2d')][_0xe551('0x2e')]);_0x4309d5[_0xe551('0x34')]=_[_0xe551('0x48')](_0x109bd3[_0xe551('0x34')]);_0x4309d5[_0xe551('0x35')]=_['intersection'](_0x4309d5['model'],_0x4309d5['query']);_0x3956ca['attributes']=_[_0xe551('0x37')](_0x4309d5[_0xe551('0x32')],qs[_0xe551('0x38')](_0x109bd3[_0xe551('0x34')][_0xe551('0x38')]));_0x3956ca['attributes']=_0x3956ca['attributes'][_0xe551('0x39')]?_0x3956ca[_0xe551('0x36')]:_0x4309d5[_0xe551('0x32')];if(_0x109bd3[_0xe551('0x34')][_0xe551('0x42')]){_0x3956ca[_0xe551('0x43')]=[{'all':!![]}];}_0x3956ca=_[_0xe551('0x40')]({},_0x3956ca,_0x109bd3[_0xe551('0x41')]);return db[_0xe551('0x2d')][_0xe551('0x49')](_0x3956ca)[_0xe551('0x13')](handleEntityNotFound(_0x37d192,null))[_0xe551('0x13')](respondWithResult(_0x37d192,null))[_0xe551('0x1d')](handleError(_0x37d192,null));};exports[_0xe551('0x25')]=function(_0x1305d5,_0x32dcc0){if(_0x1305d5[_0xe551('0x4a')]['id']){delete _0x1305d5[_0xe551('0x4a')]['id'];}return db[_0xe551('0x2d')][_0xe551('0x49')]({'where':{'id':_0x1305d5[_0xe551('0x47')]['id']}})[_0xe551('0x13')](handleEntityNotFound(_0x32dcc0,null))[_0xe551('0x13')](saveUpdates(_0x1305d5['body'],null))[_0xe551('0x13')](respondWithResult(_0x32dcc0,null))[_0xe551('0x1d')](handleError(_0x32dcc0,null));};exports['destroy']=function(_0x56e467,_0x4b4e8e){return db[_0xe551('0x2d')][_0xe551('0x49')]({'where':{'id':_0x56e467[_0xe551('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b4e8e,null))['then'](removeEntity(_0x4b4e8e,null))[_0xe551('0x1d')](handleError(_0x4b4e8e,null));};exports[_0xe551('0x4b')]=function(_0x2088df,_0x943d38){return db['MailMessage'][_0xe551('0x4b')]()[_0xe551('0x13')](respondWithResult(_0x943d38,null))[_0xe551('0x1d')](handleError(_0x943d38,null));};exports[_0xe551('0x4c')]=function(_0x167af3,_0x15b40d){return db[_0xe551('0x2d')]['create'](_0x167af3[_0xe551('0x4a')])[_0xe551('0x13')](function(_0x4d599f){if(_0x4d599f){if(_0x4d599f['direction']===_0xe551('0x4d')&&!_0x4d599f[_0xe551('0x4e')]){var _0x4becdf,_0x86703e,_0x511e88;if(_0x167af3[_0xe551('0x4a')]['to']){_0x86703e=_0x167af3[_0xe551('0x4a')]['to'][_0xe551('0x4f')](',')[0x0];}return db[_0xe551('0x50')]['findOne']({'where':{'id':_0x4d599f[_0xe551('0x51')]},'include':[{'model':db[_0xe551('0x52')],'as':_0xe551('0x53'),'include':[{'model':db[_0xe551('0x54')],'as':'Contacts','where':{'email':_0x86703e},'limit':0x1,'order':[[_0xe551('0x55'),_0xe551('0x56')]]}]},{'model':db[_0xe551('0x57')],'as':_0xe551('0x58'),'raw':!![],'include':[{'model':db[_0xe551('0x59')],'as':'CloudProvider','raw':!![]}]}]})[_0xe551('0x13')](function(_0x508567){_0x4becdf=_0x508567;if(!_0x4becdf||!_0x4becdf['Smtp'])return;var _0x28d6cd=_0x4becdf['getSmtpOptions']();if(_0x167af3[_0xe551('0x4a')][_0xe551('0x5a')]&&_0x167af3[_0xe551('0x4a')][_0xe551('0x5a')]['length']){for(var _0x2ba225=0x0;_0x2ba225<_0x167af3['body']['attachments'][_0xe551('0x39')];_0x2ba225+=0x1){_0x167af3[_0xe551('0x4a')][_0xe551('0x5a')][_0x2ba225]={'filename':_0x167af3[_0xe551('0x4a')]['attachments'][_0x2ba225][_0xe551('0x2a')],'path':path[_0xe551('0x5b')](config[_0xe551('0x5c')],_0xe551('0x5d'),_0x167af3['body'][_0xe551('0x5a')][_0x2ba225][_0xe551('0x5e')])};}}_0x511e88={'account':_0x28d6cd,'message':_0x167af3[_0xe551('0x4a')]};return;})[_0xe551('0x13')](function(){if(_0x4becdf[_0xe551('0x53')]){if(_0x4becdf[_0xe551('0x53')][_0xe551('0x5f')][_0xe551('0x39')]){return _0x4becdf[_0xe551('0x53')][_0xe551('0x5f')][0x0];}else{return db[_0xe551('0x54')][_0xe551('0x4c')](_[_0xe551('0xc')](_0x167af3[_0xe551('0x4a')],{'firstName':_0x167af3[_0xe551('0x4a')]['to'],'email':_0x167af3['body']['to'],'phone':_0x167af3[_0xe551('0x4a')]['to'],'ListId':_0x4becdf[_0xe551('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xe551('0x13')](function(){if(_0x511e88){return respondWithRpcPromise(_0xe551('0x61'),_0xe551('0x62'),_0x511e88,client9003)['then'](function(_0x127116){return _0x4d599f[_0xe551('0x25')]({'read':!![],'messageId':_0x127116[_0xe551('0x63')],'sentAt':moment()['format'](_0xe551('0x64'))});})[_0xe551('0x1d')](function(_0x53fa9a){logger[_0xe551('0x19')]('%s',JSON['stringify'](_0x53fa9a));return _0x4d599f;});}return _0x4d599f;});}return _0x4d599f;}})[_0xe551('0x13')](respondWithResult(_0x15b40d,0xc9))[_0xe551('0x1d')](handleError(_0x15b40d,null));};exports['accept']=function(_0x43d456,_0x11a96a){var _0x374cf8={'agent':{},'channel':'mail'};if(_0x43d456['body']['id']){delete _0x43d456[_0xe551('0x4a')]['id'];}_0x43d456[_0xe551('0x4a')][_0xe551('0x65')]=!![];_0x43d456['body'][_0xe551('0x66')]=moment()[_0xe551('0x67')](_0xe551('0x64'));_0x43d456[_0xe551('0x4a')][_0xe551('0x68')]=_0x43d456['body']['UserId']||_0x43d456[_0xe551('0x69')]['id'];_0x374cf8[_0xe551('0x6a')]['id']=_0x43d456[_0xe551('0x4a')][_0xe551('0x68')];return db[_0xe551('0x2d')]['find']({'where':{'id':_0x43d456[_0xe551('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11a96a,null))[_0xe551('0x13')](saveUpdates(_0x43d456['body'],null))[_0xe551('0x13')](function(_0x22ac86){if(_0x22ac86){_0x374cf8[_0xe551('0x1b')]=_0x22ac86[_0xe551('0x6b')]({'plain':!![]});return db[_0xe551('0x6c')][_0xe551('0x49')]({'where':{'id':_0x22ac86[_0xe551('0x6d')]}});}return null;})[_0xe551('0x13')](handleEntityNotFound(_0x11a96a,null))[_0xe551('0x13')](function(_0x4ec7cf){if(_0x4ec7cf){return _0x4ec7cf[_0xe551('0x25')]({'UserId':_0x43d456['body']['UserId'],'read1stAt':_[_0xe551('0x6e')](_0x4ec7cf[_0xe551('0x6f')])?moment()[_0xe551('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe551('0x13')](function(_0x5e6898){if(_0x5e6898){_0x374cf8[_0xe551('0x70')]=_0x5e6898[_0xe551('0x6b')]({'plain':!![]});interaction_log[_0xe551('0x71')](_0xe551('0x72'),_0x43d456[_0xe551('0x69')]['id'],_0x43d456[_0xe551('0x69')][_0xe551('0x2a')],_0x43d456[_0xe551('0x69')][_0xe551('0x73')],_0x374cf8[_0xe551('0x70')]['id'],_0x43d456[_0xe551('0x4a')]?JSON['stringify'](_0x43d456['body']):_0xe551('0x74'));return respondWithRpcPromise(_0xe551('0x75'),_0xe551('0x76'),_0x374cf8);}return null;})[_0xe551('0x13')](function(_0x3db257){var _0x11b327=_0xe551('0x77')+_0x3db257[_0xe551('0x1b')][_0xe551('0x78')];return db[_0xe551('0x79')][_0xe551('0x34')](_0x11b327,{'type':db[_0xe551('0x7a')][_0xe551('0x7b')][_0xe551('0x7c')],'raw':!![]})[_0xe551('0x13')](function(_0x417f6f){return _0x417f6f;});})[_0xe551('0x13')](function(_0x539c0e){if(_0x539c0e){_0x374cf8[_0xe551('0x1b')][_0xe551('0x7d')]=_0x539c0e[0x0];if(!_0x43d456[_0xe551('0x4a')][_0xe551('0x68')])return;return db[_0xe551('0x7e')][_0xe551('0x49')]({'where':{'id':_0x43d456[_0xe551('0x4a')][_0xe551('0x68')],'role':'agent'},'attributes':['id',_0xe551('0x2a'),'fullname',_0xe551('0x7f'),'internal'],'raw':!![]});}return null;})[_0xe551('0x13')](function(_0x553003){if(!_0x553003)return null;_0x374cf8[_0xe551('0x1b')]['agent']=_0x553003;return _0x374cf8;})[_0xe551('0x13')](function(_0x4c21e2){if(_0x4c21e2){if(_0x43d456[_0xe551('0x4a')][_0xe551('0x80')]){_0x374cf8[_0xe551('0x1b')][_0xe551('0x81')]=util[_0xe551('0x67')](_0xe551('0x82'),_0x43d456[_0xe551('0x69')]['name']);_0x374cf8[_0xe551('0x1b')]['channel']=_0x374cf8['channel'];_0x374cf8['message']['motionChannel']=_0x374cf8['channel'];_0x374cf8[_0xe551('0x1b')][_0xe551('0x83')]=_0xe551('0x84');_0x374cf8[_0xe551('0x1b')][_0xe551('0x4a')]=htmlToText[_0xe551('0x85')](_0x374cf8['message'][_0xe551('0x4a')]);return respondWithRpcPromise(_0xe551('0x86'),'EventManager',{'event':'acceptmessage','message':_0x374cf8[_0xe551('0x1b')]},client9002)[_0xe551('0x13')](function(){return _0x374cf8;});}return _0x374cf8;}return null;})[_0xe551('0x13')](respondWithResult(_0x11a96a,null))[_0xe551('0x1d')](handleError(_0x11a96a,null));};exports[_0xe551('0x87')]=function(_0x24b2ed,_0x16869c){var _0x545727={'agent':{},'channel':_0xe551('0x88')};if(_0x24b2ed[_0xe551('0x4a')]['id']){delete _0x24b2ed[_0xe551('0x4a')]['id'];}_0x24b2ed['body']['UserId']=_0x24b2ed[_0xe551('0x4a')]['UserId']||_0x24b2ed[_0xe551('0x69')]['id'];_0x545727[_0xe551('0x6a')]['id']=_0x24b2ed[_0xe551('0x4a')][_0xe551('0x68')];return db[_0xe551('0x2d')][_0xe551('0x49')]({'where':{'id':_0x24b2ed['params']['id'],'UserId':null}})[_0xe551('0x13')](handleEntityNotFound(_0x16869c,null))[_0xe551('0x13')](function(_0x3f002d){if(_0x3f002d){_0x545727['message']=_0x3f002d[_0xe551('0x6b')]({'plain':!![]});return db[_0xe551('0x6c')]['find']({'where':{'id':_0x3f002d['MailInteractionId']}});}return null;})[_0xe551('0x13')](handleEntityNotFound(_0x16869c,null))['then'](function(_0x50046a){if(_0x50046a){_0x545727['interaction']=_0x50046a[_0xe551('0x6b')]({'plain':!![]});interaction_log[_0xe551('0x71')](_0xe551('0x89'),_0x24b2ed[_0xe551('0x69')]['id'],_0x24b2ed[_0xe551('0x69')][_0xe551('0x2a')],_0x24b2ed['user']['role'],_0x545727[_0xe551('0x70')]['id'],_0x24b2ed[_0xe551('0x4a')]?JSON[_0xe551('0x18')](_0x24b2ed[_0xe551('0x4a')]):_0xe551('0x74'));return respondWithRpcPromise(_0xe551('0x8a'),_0xe551('0x8b'),_0x545727);}return null;})['then'](function(_0x117d3d){var _0x52512a=_0xe551('0x77')+_0x117d3d[_0xe551('0x1b')][_0xe551('0x78')];return db[_0xe551('0x79')]['query'](_0x52512a,{'type':db['Sequelize'][_0xe551('0x7b')][_0xe551('0x7c')],'raw':!![]})[_0xe551('0x13')](function(_0x2c37a9){return _0x2c37a9;});})['then'](function(_0x1f6888){if(_0x1f6888){_0x545727[_0xe551('0x1b')][_0xe551('0x7d')]=_0x1f6888[0x0];if(!_0x24b2ed[_0xe551('0x4a')][_0xe551('0x68')])return;return db[_0xe551('0x7e')][_0xe551('0x49')]({'where':{'id':_0x24b2ed[_0xe551('0x4a')]['UserId'],'role':_0xe551('0x6a')},'attributes':['id',_0xe551('0x2a'),_0xe551('0x8c'),_0xe551('0x7f'),'internal'],'raw':!![]});}return null;})[_0xe551('0x13')](function(_0x2c793b){if(!_0x2c793b)return null;_0x545727['message'][_0xe551('0x6a')]=_0x2c793b;return _0x545727;})[_0xe551('0x13')](function(_0x3203ed){if(_0x3203ed){_0x3203ed['message'][_0xe551('0x81')]=util['format'](_0xe551('0x82'),_0x24b2ed[_0xe551('0x69')][_0xe551('0x2a')]);_0x3203ed[_0xe551('0x1b')][_0xe551('0x8d')]=_0x545727[_0xe551('0x8d')];_0x3203ed[_0xe551('0x1b')][_0xe551('0x8e')]=_0x545727['channel'];_0x3203ed[_0xe551('0x1b')]['event']='reject';_0x3203ed[_0xe551('0x1b')]['body']=htmlToText[_0xe551('0x85')](_0x545727[_0xe551('0x1b')]['body']);respondWithRpcPromise('EventManager',_0xe551('0x86'),{'event':'rejectmessage','message':_0x3203ed['message']},client9002);return _0x545727;}return null;})[_0xe551('0x13')](respondWithResult(_0x16869c,null))[_0xe551('0x1d')](handleError(_0x16869c,null));};exports[_0xe551('0x8f')]=function(_0x195095,_0x56c888){var _0x5a2c83=moment()[_0xe551('0x90')]()[_0xe551('0x91')]();var _0x2bb3fd=path['join'](config['root'],_0xe551('0x92'),'files',_0xe551('0x93'));var _0x1d8168=path[_0xe551('0x5b')](config['root'],_0xe551('0x92'),'files',_0xe551('0x5a'));var _0xde90c=util[_0xe551('0x67')]('message-%s.eml',_0x5a2c83);return db[_0xe551('0x2d')][_0xe551('0x49')]({'where':{'id':_0x195095['params']['id']},'attributes':['id',_0xe551('0x4a'),_0xe551('0x94'),'to','cc',_0xe551('0x95'),_0xe551('0x96'),_0xe551('0x97')],'include':_0x195095[_0xe551('0x34')][_0xe551('0x5a')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0xe551('0x13')](handleEntityNotFound(_0x56c888,null))[_0xe551('0x13')](function(_0x28e108){if(_0x28e108){var _0x556fce=_0x28e108;var _0x171f85={'from':_0x556fce[_0xe551('0x94')],'to':_0x556fce['to'],'subject':_0x556fce[_0xe551('0x96')],'html':htmlEntities[_0xe551('0x98')](_0x556fce['body']),'headers':{'Date':moment(_0x556fce[_0xe551('0x97')])[_0xe551('0x67')](_0xe551('0x99'))},'attachments':[]};if(_0x28e108['cc']){_0x171f85['headers']['Cc']=_0x28e108['cc'];}if(_0x28e108['bcc']){_0x171f85[_0xe551('0x9a')][_0xe551('0x9b')]=_0x28e108['bcc'];}return new BPromise(function(_0x15ac2a,_0x5b123e){if(_0x28e108[_0xe551('0x9c')]){for(var _0x2ed947=0x0;_0x2ed947<_0x28e108[_0xe551('0x9c')][_0xe551('0x39')];_0x2ed947++){var _0x3f91bb=_0x28e108[_0xe551('0x9c')][_0x2ed947];var _0x371f3a=path[_0xe551('0x5b')](_0x1d8168,_0x3f91bb[_0xe551('0x5e')]);if(fs[_0xe551('0x9d')](_0x371f3a)){_0x171f85[_0xe551('0x5a')][_0xe551('0x9e')]({'name':_0x3f91bb['name'],'contentType':_0x3f91bb['type'],'data':fs['readFileSync'](_0x371f3a)});}}}emlformat[_0xe551('0x9f')](_0x171f85,function(_0x1e0a98,_0xea3a92){if(_0x1e0a98)return _0x5b123e(_0x1e0a98);fs[_0xe551('0xa0')](path['join'](_0x2bb3fd,_0xde90c),_0xea3a92);return _0x15ac2a(_0xea3a92);});});}})['then'](function(_0x3c7ef4){if(_0x3c7ef4){return _0x56c888[_0xe551('0x8f')](path[_0xe551('0x5b')](_0x2bb3fd,_0xde90c),_0xde90c,function(_0x1731f0){if(!_0x1731f0)fs['unlinkSync'](path[_0xe551('0x5b')](_0x2bb3fd,_0xde90c));});}})['catch'](handleError(_0x56c888,null));}; \ No newline at end of file +var _0xe17d=['get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SELECT','fromString','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','offset','undefined','limit','count','Content-Range','update','destroy','stack','name','send','index','map','MailMessage','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','type','merge','options','includeAll','include','findAll','catch','show','params','length','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','defaults','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent'];(function(_0x2d1f93,_0x1ac50f){var _0x2df8c5=function(_0x38aa34){while(--_0x38aa34){_0x2d1f93['push'](_0x2d1f93['shift']());}};_0x2df8c5(++_0x1ac50f);}(_0xe17d,0x17a));var _0xde17=function(_0x2e9262,_0x46320d){_0x2e9262=_0x2e9262-0x0;var _0x2bb358=_0xe17d[_0x2e9262];return _0x2bb358;};'use strict';var emlformat=require('eml-format');var moment=require(_0xde17('0x0'));var BPromise=require(_0xde17('0x1'));var util=require('util');var path=require(_0xde17('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xde17('0x3'));var htmlToText=require(_0xde17('0x4'));var qs=require(_0xde17('0x5'));var logger=require(_0xde17('0x6'))('api');var interaction_log=require(_0xde17('0x6'))(_0xde17('0x7'));var config=require('../../config/environment');var db=require(_0xde17('0x8'))['db'];config[_0xde17('0x9')]=_['defaults'](config[_0xde17('0x9')],{'host':_0xde17('0xa'),'port':0x18eb});var socket=require(_0xde17('0xb'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xde17('0xc'))[_0xde17('0xd')](socket);var jayson=require(_0xde17('0xe'));var client=jayson[_0xde17('0xf')][_0xde17('0x10')]({'port':0x232c});var client9003=jayson['client'][_0xde17('0x10')]({'port':0x232b});var client9002=jayson[_0xde17('0xf')][_0xde17('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x35eda5,_0x365cd4,_0x1cd82b,_0x180698){return new BPromise(function(_0x1c09fd,_0x3698ae){var _0x3761e9=_0x180698||client;return _0x3761e9[_0xde17('0x11')](_0x35eda5,_0x1cd82b)[_0xde17('0x12')](function(_0x41d482){logger[_0xde17('0x13')](_0xde17('0x14'),_0x365cd4,_0xde17('0x15'));logger[_0xde17('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x365cd4,'request\x20sent',JSON[_0xde17('0x17')](_0x41d482));if(_0x41d482[_0xde17('0x18')]){if(_0x41d482['error'][_0xde17('0x19')]===0x1f4){logger[_0xde17('0x18')](_0xde17('0x14'),_0x365cd4,_0x41d482[_0xde17('0x18')][_0xde17('0x1a')]);return _0x3698ae(_0x41d482[_0xde17('0x18')][_0xde17('0x1a')]);}logger[_0xde17('0x18')](_0xde17('0x14'),_0x365cd4,_0x41d482[_0xde17('0x18')][_0xde17('0x1a')]);return _0x1c09fd(_0x41d482[_0xde17('0x18')][_0xde17('0x1a')]);}else{logger[_0xde17('0x13')](_0xde17('0x14'),_0x365cd4,_0xde17('0x15'));_0x1c09fd(_0x41d482[_0xde17('0x1b')][_0xde17('0x1a')]);}})['catch'](function(_0x3bd98e){logger[_0xde17('0x18')]('MailMessage,\x20%s,\x20%s',_0x365cd4,_0x3bd98e);_0x3698ae(_0x3bd98e);});});}function respondWithResult(_0x6fe42d,_0x1cb2e7){_0x1cb2e7=_0x1cb2e7||0xc8;return function(_0xb0f31e){if(_0xb0f31e){return _0x6fe42d[_0xde17('0x1c')](_0x1cb2e7)[_0xde17('0x1d')](_0xb0f31e);}};}function respondWithFilteredResult(_0x440c52,_0x37f959){return function(_0x4480b2){if(_0x4480b2){var _0x433597=typeof _0x37f959[_0xde17('0x1e')]===_0xde17('0x1f')&&typeof _0x37f959[_0xde17('0x20')]===_0xde17('0x1f');var _0x18d594=_0x4480b2[_0xde17('0x21')];var _0x4b94de=_0x433597?0x0:_0x37f959[_0xde17('0x1e')];var _0x20d7a9=_0x433597?_0x4480b2[_0xde17('0x21')]:_0x37f959[_0xde17('0x1e')]+_0x37f959[_0xde17('0x20')];var _0x79ef8a;if(_0x20d7a9>=_0x18d594){_0x20d7a9=_0x18d594;_0x79ef8a=0xc8;}else{_0x79ef8a=0xce;}_0x440c52[_0xde17('0x1c')](_0x79ef8a);return _0x440c52['set'](_0xde17('0x22'),_0x4b94de+'-'+_0x20d7a9+'/'+_0x18d594)[_0xde17('0x1d')](_0x4480b2);}return null;};}function saveUpdates(_0x46eec7){return function(_0x25b225){if(_0x25b225){return _0x25b225[_0xde17('0x23')](_0x46eec7)['then'](function(_0x3d279e){return _0x3d279e;});}return null;};}function removeEntity(_0x24fc66){return function(_0x2f3d17){if(_0x2f3d17){return _0x2f3d17[_0xde17('0x24')]()['then'](function(){_0x24fc66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132842){return function(_0x1593b4){if(!_0x1593b4){_0x132842['sendStatus'](0x194);}return _0x1593b4;};}function handleError(_0x2acab3,_0x3accd0){_0x3accd0=_0x3accd0||0x1f4;return function(_0x20ca73){logger[_0xde17('0x18')](_0x20ca73[_0xde17('0x25')]);if(_0x20ca73[_0xde17('0x26')]){delete _0x20ca73[_0xde17('0x26')];}_0x2acab3['status'](_0x3accd0)[_0xde17('0x27')](_0x20ca73);};}exports[_0xde17('0x28')]=function(_0x1ef8a5,_0x2edc0c){var _0x482d2a={},_0x593989={},_0x1491ca={'count':0x0,'rows':[]};var _0x362bde=_[_0xde17('0x29')](db[_0xde17('0x2a')][_0xde17('0x2b')],function(_0x25db90){return{'name':_0x25db90['fieldName'],'type':_0x25db90['type'][_0xde17('0x2c')]};});_0x593989['model']=_['map'](_0x362bde,_0xde17('0x26'));_0x593989[_0xde17('0x2d')]=_[_0xde17('0x2e')](_0x1ef8a5[_0xde17('0x2d')]);_0x593989[_0xde17('0x2f')]=_[_0xde17('0x30')](_0x593989[_0xde17('0x31')],_0x593989[_0xde17('0x2d')]);_0x482d2a[_0xde17('0x32')]=_['intersection'](_0x593989[_0xde17('0x31')],qs['fields'](_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x33')]));_0x482d2a[_0xde17('0x32')]=_0x482d2a[_0xde17('0x32')]['length']?_0x482d2a[_0xde17('0x32')]:_0x593989['model'];if(!_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x34')](_0xde17('0x35'))){_0x482d2a['limit']=qs[_0xde17('0x20')](_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x20')]);_0x482d2a[_0xde17('0x1e')]=qs[_0xde17('0x1e')](_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x1e')]);}_0x482d2a[_0xde17('0x36')]=qs[_0xde17('0x37')](_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x37')]);_0x482d2a['where']=qs['filters'](_['pick'](_0x1ef8a5[_0xde17('0x2d')],_0x593989[_0xde17('0x2f')]),_0x362bde);if(_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x38')]){_0x482d2a[_0xde17('0x39')]=_['merge'](_0x482d2a[_0xde17('0x39')],{'$or':_[_0xde17('0x29')](_0x362bde,function(_0x2a1eb4){if(_0x2a1eb4[_0xde17('0x3a')]!=='VIRTUAL'){var _0x558d2d={};_0x558d2d[_0x2a1eb4['name']]={'$like':'%'+_0x1ef8a5[_0xde17('0x2d')]['filter']+'%'};return _0x558d2d;}})});}_0x482d2a=_[_0xde17('0x3b')]({},_0x482d2a,_0x1ef8a5[_0xde17('0x3c')]);var _0x5c7938={'where':_0x482d2a[_0xde17('0x39')]};return db['MailMessage'][_0xde17('0x21')](_0x5c7938)[_0xde17('0x12')](function(_0x5ea11f){_0x1491ca[_0xde17('0x21')]=_0x5ea11f;if(_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x3d')]){_0x482d2a[_0xde17('0x3e')]=[{'all':!![]}];}return db[_0xde17('0x2a')][_0xde17('0x3f')](_0x482d2a);})['then'](function(_0x44d0f3){_0x1491ca['rows']=_0x44d0f3;return _0x1491ca;})[_0xde17('0x12')](respondWithFilteredResult(_0x2edc0c,_0x482d2a))[_0xde17('0x40')](handleError(_0x2edc0c,null));};exports[_0xde17('0x41')]=function(_0x139406,_0x13bf87){var _0x45977f={'raw':!![],'where':{'id':_0x139406[_0xde17('0x42')]['id']}},_0x16a7b4={};_0x16a7b4[_0xde17('0x31')]=_[_0xde17('0x2e')](db['MailMessage'][_0xde17('0x2b')]);_0x16a7b4[_0xde17('0x2d')]=_[_0xde17('0x2e')](_0x139406['query']);_0x16a7b4[_0xde17('0x2f')]=_[_0xde17('0x30')](_0x16a7b4[_0xde17('0x31')],_0x16a7b4[_0xde17('0x2d')]);_0x45977f[_0xde17('0x32')]=_['intersection'](_0x16a7b4[_0xde17('0x31')],qs['fields'](_0x139406[_0xde17('0x2d')][_0xde17('0x33')]));_0x45977f[_0xde17('0x32')]=_0x45977f[_0xde17('0x32')][_0xde17('0x43')]?_0x45977f[_0xde17('0x32')]:_0x16a7b4[_0xde17('0x31')];if(_0x139406[_0xde17('0x2d')][_0xde17('0x3d')]){_0x45977f[_0xde17('0x3e')]=[{'all':!![]}];}_0x45977f=_[_0xde17('0x3b')]({},_0x45977f,_0x139406['options']);return db[_0xde17('0x2a')][_0xde17('0x44')](_0x45977f)[_0xde17('0x12')](handleEntityNotFound(_0x13bf87,null))[_0xde17('0x12')](respondWithResult(_0x13bf87,null))[_0xde17('0x40')](handleError(_0x13bf87,null));};exports[_0xde17('0x23')]=function(_0x3f80de,_0x583285){if(_0x3f80de['body']['id']){delete _0x3f80de[_0xde17('0x45')]['id'];}return db['MailMessage'][_0xde17('0x44')]({'where':{'id':_0x3f80de[_0xde17('0x42')]['id']}})['then'](handleEntityNotFound(_0x583285,null))['then'](saveUpdates(_0x3f80de[_0xde17('0x45')],null))[_0xde17('0x12')](respondWithResult(_0x583285,null))['catch'](handleError(_0x583285,null));};exports['destroy']=function(_0x300d55,_0x2065d1){return db['MailMessage'][_0xde17('0x44')]({'where':{'id':_0x300d55[_0xde17('0x42')]['id']}})['then'](handleEntityNotFound(_0x2065d1,null))['then'](removeEntity(_0x2065d1,null))['catch'](handleError(_0x2065d1,null));};exports[_0xde17('0x46')]=function(_0x43b481,_0x2bd326){return db[_0xde17('0x2a')][_0xde17('0x46')]()[_0xde17('0x12')](respondWithResult(_0x2bd326,null))[_0xde17('0x40')](handleError(_0x2bd326,null));};exports[_0xde17('0x47')]=function(_0x554b80,_0x1afc35){return db[_0xde17('0x2a')]['create'](_0x554b80[_0xde17('0x45')])[_0xde17('0x12')](function(_0x4ad3f2){if(_0x4ad3f2){if(_0x4ad3f2[_0xde17('0x48')]===_0xde17('0x49')&&!_0x4ad3f2[_0xde17('0x4a')]){var _0x33511d,_0x420ec0,_0x2b2b30;if(_0x554b80[_0xde17('0x45')]['to']){_0x420ec0=_0x554b80[_0xde17('0x45')]['to'][_0xde17('0x4b')](',')[0x0];}return db[_0xde17('0x4c')][_0xde17('0x4d')]({'where':{'id':_0x4ad3f2[_0xde17('0x4e')]},'include':[{'model':db[_0xde17('0x4f')],'as':_0xde17('0x50'),'include':[{'model':db[_0xde17('0x51')],'as':_0xde17('0x52'),'where':{'email':_0x420ec0},'limit':0x1,'order':[[_0xde17('0x53'),_0xde17('0x54')]]}]},{'model':db[_0xde17('0x55')],'as':_0xde17('0x56'),'raw':!![],'include':[{'model':db[_0xde17('0x57')],'as':_0xde17('0x57'),'raw':!![]}]}]})['then'](function(_0x432138){_0x33511d=_0x432138;if(!_0x33511d||!_0x33511d[_0xde17('0x56')])return;var _0x16668a=_0x33511d[_0xde17('0x58')]();if(_0x554b80[_0xde17('0x45')]['attachments']&&_0x554b80[_0xde17('0x45')][_0xde17('0x59')]['length']){for(var _0x16cf82=0x0;_0x16cf82<_0x554b80[_0xde17('0x45')][_0xde17('0x59')][_0xde17('0x43')];_0x16cf82+=0x1){_0x554b80['body'][_0xde17('0x59')][_0x16cf82]={'filename':_0x554b80[_0xde17('0x45')][_0xde17('0x59')][_0x16cf82]['name'],'path':path[_0xde17('0x5a')](config['root'],_0xde17('0x5b'),_0x554b80[_0xde17('0x45')]['attachments'][_0x16cf82][_0xde17('0x5c')])};}}_0x2b2b30={'account':_0x16668a,'message':_0x554b80[_0xde17('0x45')]};return;})[_0xde17('0x12')](function(){if(_0x33511d[_0xde17('0x50')]){if(_0x33511d[_0xde17('0x50')][_0xde17('0x52')][_0xde17('0x43')]){return _0x33511d['List'][_0xde17('0x52')][0x0];}else{return db[_0xde17('0x51')][_0xde17('0x47')](_[_0xde17('0x5d')](_0x554b80[_0xde17('0x45')],{'firstName':_0x554b80['body']['to'],'email':_0x554b80[_0xde17('0x45')]['to'],'phone':_0x554b80[_0xde17('0x45')]['to'],'ListId':_0x33511d[_0xde17('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x2b2b30){return respondWithRpcPromise(_0xde17('0x5f'),_0xde17('0x60'),_0x2b2b30,client9003)[_0xde17('0x12')](function(_0x2410aa){return _0x4ad3f2[_0xde17('0x23')]({'read':!![],'messageId':_0x2410aa['messageId'],'sentAt':moment()[_0xde17('0x61')](_0xde17('0x62'))});})[_0xde17('0x40')](function(_0x23c7f1){logger['error']('%s',JSON[_0xde17('0x17')](_0x23c7f1));return _0x4ad3f2;});}return _0x4ad3f2;});}return _0x4ad3f2;}})[_0xde17('0x12')](respondWithResult(_0x1afc35,0xc9))[_0xde17('0x40')](handleError(_0x1afc35,null));};exports[_0xde17('0x63')]=function(_0x3c59e8,_0x386054){var _0xc7c4bf={'agent':{},'channel':_0xde17('0x64')};if(_0x3c59e8[_0xde17('0x45')]['id']){delete _0x3c59e8['body']['id'];}_0x3c59e8['body'][_0xde17('0x65')]=!![];_0x3c59e8[_0xde17('0x45')][_0xde17('0x66')]=moment()[_0xde17('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c59e8[_0xde17('0x45')][_0xde17('0x67')]=_0x3c59e8['body'][_0xde17('0x67')]||_0x3c59e8['user']['id'];_0xc7c4bf[_0xde17('0x68')]['id']=_0x3c59e8[_0xde17('0x45')][_0xde17('0x67')];return db[_0xde17('0x2a')][_0xde17('0x44')]({'where':{'id':_0x3c59e8[_0xde17('0x42')]['id'],'UserId':null}})[_0xde17('0x12')](handleEntityNotFound(_0x386054,null))['then'](saveUpdates(_0x3c59e8[_0xde17('0x45')],null))[_0xde17('0x12')](function(_0xb5bcd7){if(_0xb5bcd7){_0xc7c4bf[_0xde17('0x1a')]=_0xb5bcd7[_0xde17('0x69')]({'plain':!![]});return db[_0xde17('0x6a')][_0xde17('0x44')]({'where':{'id':_0xb5bcd7[_0xde17('0x6b')]}});}return null;})[_0xde17('0x12')](handleEntityNotFound(_0x386054,null))['then'](function(_0x46febb){if(_0x46febb){return _0x46febb[_0xde17('0x23')]({'UserId':_0x3c59e8['body'][_0xde17('0x67')],'read1stAt':_[_0xde17('0x6c')](_0x46febb['read1stAt'])?moment()[_0xde17('0x61')](_0xde17('0x62')):undefined});}return null;})['then'](function(_0x3b7b95){if(_0x3b7b95){_0xc7c4bf[_0xde17('0x6d')]=_0x3b7b95[_0xde17('0x69')]({'plain':!![]});interaction_log[_0xde17('0x13')](_0xde17('0x6e'),_0x3c59e8[_0xde17('0x6f')]['id'],_0x3c59e8[_0xde17('0x6f')][_0xde17('0x26')],_0x3c59e8[_0xde17('0x6f')]['role'],_0xc7c4bf['interaction']['id'],_0x3c59e8[_0xde17('0x45')]?JSON[_0xde17('0x17')](_0x3c59e8[_0xde17('0x45')]):_0xde17('0x70'));return respondWithRpcPromise(_0xde17('0x71'),_0xde17('0x72'),_0xc7c4bf);}return null;})[_0xde17('0x12')](function(_0x1746f9){var _0x4b338c=_0xde17('0x73')+_0x1746f9[_0xde17('0x1a')]['ContactId'];return db[_0xde17('0x74')][_0xde17('0x2d')](_0x4b338c,{'type':db[_0xde17('0x75')][_0xde17('0x76')]['SELECT'],'raw':!![]})['then'](function(_0x336a8a){return _0x336a8a;});})['then'](function(_0x3f3784){if(_0x3f3784){_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x77')]=_0x3f3784[0x0];if(!_0x3c59e8['body'][_0xde17('0x67')])return;return db[_0xde17('0x78')][_0xde17('0x44')]({'where':{'id':_0x3c59e8['body'][_0xde17('0x67')],'role':_0xde17('0x68')},'attributes':['id',_0xde17('0x26'),_0xde17('0x79'),_0xde17('0x7a'),_0xde17('0x7b')],'raw':!![]});}return null;})[_0xde17('0x12')](function(_0xd2b8ab){if(!_0xd2b8ab)return null;_0xc7c4bf[_0xde17('0x1a')]['agent']=_0xd2b8ab;return _0xc7c4bf;})['then'](function(_0x453ae3){if(_0x453ae3){if(_0x3c59e8[_0xde17('0x45')]['manual']){_0xc7c4bf['message'][_0xde17('0x7c')]=util[_0xde17('0x61')](_0xde17('0x7d'),_0x3c59e8[_0xde17('0x6f')]['name']);_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x7e')]=_0xc7c4bf[_0xde17('0x7e')];_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x7f')]=_0xc7c4bf['channel'];_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x80')]=_0xde17('0x63');_0xc7c4bf['message'][_0xde17('0x45')]=htmlToText['fromString'](_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x45')]);return respondWithRpcPromise(_0xde17('0x81'),_0xde17('0x81'),{'event':_0xde17('0x82'),'message':_0xc7c4bf[_0xde17('0x1a')]},client9002)[_0xde17('0x12')](function(){return _0xc7c4bf;});}return _0xc7c4bf;}return null;})[_0xde17('0x12')](respondWithResult(_0x386054,null))[_0xde17('0x40')](handleError(_0x386054,null));};exports[_0xde17('0x83')]=function(_0x13a344,_0xf56495){var _0x3e7412={'agent':{},'channel':_0xde17('0x64')};if(_0x13a344[_0xde17('0x45')]['id']){delete _0x13a344[_0xde17('0x45')]['id'];}_0x13a344[_0xde17('0x45')]['UserId']=_0x13a344[_0xde17('0x45')]['UserId']||_0x13a344['user']['id'];_0x3e7412[_0xde17('0x68')]['id']=_0x13a344[_0xde17('0x45')][_0xde17('0x67')];return db[_0xde17('0x2a')][_0xde17('0x44')]({'where':{'id':_0x13a344[_0xde17('0x42')]['id'],'UserId':null}})[_0xde17('0x12')](handleEntityNotFound(_0xf56495,null))[_0xde17('0x12')](function(_0x5cfc83){if(_0x5cfc83){_0x3e7412[_0xde17('0x1a')]=_0x5cfc83['get']({'plain':!![]});return db[_0xde17('0x6a')][_0xde17('0x44')]({'where':{'id':_0x5cfc83[_0xde17('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0xf56495,null))['then'](function(_0x481bc7){if(_0x481bc7){_0x3e7412['interaction']=_0x481bc7[_0xde17('0x69')]({'plain':!![]});interaction_log[_0xde17('0x13')](_0xde17('0x84'),_0x13a344[_0xde17('0x6f')]['id'],_0x13a344[_0xde17('0x6f')][_0xde17('0x26')],_0x13a344['user'][_0xde17('0x85')],_0x3e7412[_0xde17('0x6d')]['id'],_0x13a344[_0xde17('0x45')]?JSON[_0xde17('0x17')](_0x13a344[_0xde17('0x45')]):_0xde17('0x70'));return respondWithRpcPromise(_0xde17('0x86'),'rejectMessage',_0x3e7412);}return null;})['then'](function(_0x5c0978){var _0x528cd1=_0xde17('0x73')+_0x5c0978[_0xde17('0x1a')]['ContactId'];return db[_0xde17('0x74')][_0xde17('0x2d')](_0x528cd1,{'type':db[_0xde17('0x75')]['QueryTypes'][_0xde17('0x87')],'raw':!![]})[_0xde17('0x12')](function(_0xbb71a9){return _0xbb71a9;});})['then'](function(_0x457eee){if(_0x457eee){_0x3e7412['message'][_0xde17('0x77')]=_0x457eee[0x0];if(!_0x13a344[_0xde17('0x45')][_0xde17('0x67')])return;return db[_0xde17('0x78')][_0xde17('0x44')]({'where':{'id':_0x13a344[_0xde17('0x45')][_0xde17('0x67')],'role':_0xde17('0x68')},'attributes':['id','name',_0xde17('0x79'),'email',_0xde17('0x7b')],'raw':!![]});}return null;})['then'](function(_0x796ca0){if(!_0x796ca0)return null;_0x3e7412[_0xde17('0x1a')][_0xde17('0x68')]=_0x796ca0;return _0x3e7412;})[_0xde17('0x12')](function(_0x339d46){if(_0x339d46){_0x339d46['message'][_0xde17('0x7c')]=util[_0xde17('0x61')](_0xde17('0x7d'),_0x13a344['user'][_0xde17('0x26')]);_0x339d46['message']['channel']=_0x3e7412[_0xde17('0x7e')];_0x339d46[_0xde17('0x1a')][_0xde17('0x7f')]=_0x3e7412[_0xde17('0x7e')];_0x339d46[_0xde17('0x1a')][_0xde17('0x80')]='reject';_0x339d46[_0xde17('0x1a')]['body']=htmlToText[_0xde17('0x88')](_0x3e7412['message'][_0xde17('0x45')]);respondWithRpcPromise(_0xde17('0x81'),_0xde17('0x81'),{'event':_0xde17('0x89'),'message':_0x339d46['message']},client9002);return _0x3e7412;}return null;})[_0xde17('0x12')](respondWithResult(_0xf56495,null))['catch'](handleError(_0xf56495,null));};exports[_0xde17('0x8a')]=function(_0x12d2a3,_0x13d57d){var _0x3bd35f=moment()[_0xde17('0x8b')]()[_0xde17('0x8c')]();var _0x1eac89=path['join'](config[_0xde17('0x8d')],_0xde17('0x8e'),_0xde17('0x8f'),_0xde17('0x90'));var _0x35aefa=path[_0xde17('0x5a')](config[_0xde17('0x8d')],_0xde17('0x8e'),'files',_0xde17('0x59'));var _0x230391=util[_0xde17('0x61')](_0xde17('0x91'),_0x3bd35f);return db[_0xde17('0x2a')]['find']({'where':{'id':_0x12d2a3[_0xde17('0x42')]['id']},'attributes':['id',_0xde17('0x45'),_0xde17('0x92'),'to','cc',_0xde17('0x93'),_0xde17('0x94'),_0xde17('0x95')],'include':_0x12d2a3[_0xde17('0x2d')][_0xde17('0x59')]?[{'model':db[_0xde17('0x96')],'as':'Attachments'}]:undefined})[_0xde17('0x12')](handleEntityNotFound(_0x13d57d,null))[_0xde17('0x12')](function(_0x4b9d39){if(_0x4b9d39){var _0x42e356=_0x4b9d39;var _0xe42c14={'from':_0x42e356[_0xde17('0x92')],'to':_0x42e356['to'],'subject':_0x42e356[_0xde17('0x94')],'html':htmlEntities[_0xde17('0x97')](_0x42e356[_0xde17('0x45')]),'headers':{'Date':moment(_0x42e356[_0xde17('0x95')])[_0xde17('0x61')](_0xde17('0x98'))},'attachments':[]};if(_0x4b9d39['cc']){_0xe42c14[_0xde17('0x99')]['Cc']=_0x4b9d39['cc'];}if(_0x4b9d39['bcc']){_0xe42c14[_0xde17('0x99')][_0xde17('0x9a')]=_0x4b9d39[_0xde17('0x93')];}return new BPromise(function(_0x262ae5,_0x1a9420){if(_0x4b9d39[_0xde17('0x9b')]){for(var _0x4b6ca2=0x0;_0x4b6ca2<_0x4b9d39[_0xde17('0x9b')][_0xde17('0x43')];_0x4b6ca2++){var _0xf3531c=_0x4b9d39[_0xde17('0x9b')][_0x4b6ca2];var _0x5a4993=path[_0xde17('0x5a')](_0x35aefa,_0xf3531c[_0xde17('0x5c')]);if(fs['existsSync'](_0x5a4993)){_0xe42c14[_0xde17('0x59')][_0xde17('0x9c')]({'name':_0xf3531c[_0xde17('0x26')],'contentType':_0xf3531c[_0xde17('0x3a')],'data':fs[_0xde17('0x9d')](_0x5a4993)});}}}emlformat[_0xde17('0x9e')](_0xe42c14,function(_0x20bb8f,_0x3386fd){if(_0x20bb8f)return _0x1a9420(_0x20bb8f);fs[_0xde17('0x9f')](path[_0xde17('0x5a')](_0x1eac89,_0x230391),_0x3386fd);return _0x262ae5(_0x3386fd);});});}})[_0xde17('0x12')](function(_0x528ab1){if(_0x528ab1){return _0x13d57d[_0xde17('0x8a')](path['join'](_0x1eac89,_0x230391),_0x230391,function(_0x6c404d){if(!_0x6c404d)fs[_0xde17('0xa0')](path[_0xde17('0x5a')](_0x1eac89,_0x230391));});}})['catch'](handleError(_0x13d57d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e12241d..93aca7e 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 _0x9a46=['remove','emit','hook','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x9a46,0x96));var _0x69a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9a46[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x69a4('0x0'))['db'][_0x69a4('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x69a4('0x2')](0x0);var events={'afterCreate':_0x69a4('0x3'),'afterUpdate':'update','afterDestroy':_0x69a4('0x4')};function emitEvent(_0x8d071f){return function(_0xa4dbb3,_0x3cd7fa,_0x1b157e){MailMessageEvents[_0x69a4('0x5')](_0x8d071f+':'+_0xa4dbb3['id'],_0xa4dbb3);MailMessageEvents[_0x69a4('0x5')](_0x8d071f,_0xa4dbb3);_0x1b157e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x69a4('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xc1e2=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','save'];(function(_0xee076a,_0x1ae9c7){var _0x3705ff=function(_0x39a8ff){while(--_0x39a8ff){_0xee076a['push'](_0xee076a['shift']());}};_0x3705ff(++_0x1ae9c7);}(_0xc1e2,0x1c5));var _0x2c1e=function(_0x53bcd4,_0x25ceba){_0x53bcd4=_0x53bcd4-0x0;var _0x259b9e=_0xc1e2[_0x53bcd4];return _0x259b9e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x2c1e('0x0'))['db'][_0x2c1e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c1e('0x2'),'afterUpdate':'update','afterDestroy':_0x2c1e('0x3')};function emitEvent(_0x2bee5e){return function(_0x19da8f,_0x5d8eef,_0x4a7096){MailMessageEvents[_0x2c1e('0x4')](_0x2bee5e+':'+_0x19da8f['id'],_0x19da8f);MailMessageEvents[_0x2c1e('0x4')](_0x2bee5e,_0x19da8f);_0x4a7096(null);};}for(var e in events){if(events[_0x2c1e('0x5')](e)){var event=events[e];MailMessage[_0x2c1e('0x6')](e,emitEvent(event));}}module[_0x2c1e('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 8752077..9231db6 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 _0x30b6=['api','moment','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger'];(function(_0x270379,_0x9447a6){var _0x27c093=function(_0x45afbf){while(--_0x45afbf){_0x270379['push'](_0x270379['shift']());}};_0x27c093(++_0x9447a6);}(_0x30b6,0x15d));var _0x630b=function(_0x573ace,_0x5f5c56){_0x573ace=_0x573ace-0x0;var _0x6059c1=_0x30b6[_0x573ace];return _0x6059c1;};'use strict';var _=require(_0x630b('0x0'));var util=require(_0x630b('0x1'));var logger=require(_0x630b('0x2'))(_0x630b('0x3'));var moment=require(_0x630b('0x4'));var BPromise=require('bluebird');var rp=require(_0x630b('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x630b('0x6'));var rimraf=require('rimraf');var config=require(_0x630b('0x7'));var attributes=require(_0x630b('0x8'));module[_0x630b('0x9')]=function(_0x29a465,_0x5eef57){return _0x29a465[_0x630b('0xa')](_0x630b('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x630b('0xc'),'fields':['messageId']},{'name':_0x630b('0xd'),'fields':['plainBody','subject'],'type':_0x630b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x184922,_0x431e32,_0x2f9bb7){if(_0x184922[_0x630b('0xf')]){_0x184922['plainBody']=htmlToText[_0x630b('0x10')](_0x184922['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2f9bb7(null,_0x431e32);},'afterCreate':function(_0x109c3c,_0x47cac1,_0x4f611f){var _0x5426fd=_0x29a465[_0x630b('0x11')];var _0x3b5181=_0x109c3c[_0x630b('0x12')]({'plain':!![]});if(_0x3b5181['direction']['toLowerCase']()==='in'||_0x3b5181[_0x630b('0x13')][_0x630b('0x14')]()===_0x630b('0x15')&&!_0x3b5181[_0x630b('0x16')]&&!_[_0x630b('0x17')](_0x3b5181[_0x630b('0x18')])){_0x5426fd[_0x630b('0x19')]['findOne']({'where':{'id':_0x3b5181[_0x630b('0x1a')]}})[_0x630b('0x1b')](function(_0x2e8596){if(_0x2e8596){_0x2e8596['update']({'lastMsgAt':_0x3b5181[_0x630b('0x1c')],'lastMsgDirection':_0x3b5181[_0x630b('0x13')]['toLowerCase']()});}})[_0x630b('0x1d')](function(_0x494e22){console[_0x630b('0x1e')](_0x494e22);});}_0x4f611f();}},'charset':_0x630b('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3bcb=['moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','FULLTEXT','body','plainBody','models','get','direction','toLowerCase','out','secret','findOne','catch','utf8mb4','lodash','../../config/logger','api'];(function(_0x30133e,_0x241e57){var _0x3fe39b=function(_0x1e0ea8){while(--_0x1e0ea8){_0x30133e['push'](_0x30133e['shift']());}};_0x3fe39b(++_0x241e57);}(_0x3bcb,0x1eb));var _0xb3bc=function(_0x54abae,_0x154d8f){_0x54abae=_0x54abae-0x0;var _0x297e50=_0x3bcb[_0x54abae];return _0x297e50;};'use strict';var _=require(_0xb3bc('0x0'));var util=require('util');var logger=require(_0xb3bc('0x1'))(_0xb3bc('0x2'));var moment=require(_0xb3bc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0xb3bc('0x4'));var fs=require('fs');var path=require(_0xb3bc('0x5'));var rimraf=require(_0xb3bc('0x6'));var config=require(_0xb3bc('0x7'));var attributes=require(_0xb3bc('0x8'));module[_0xb3bc('0x9')]=function(_0x12645b,_0x10266d){return _0x12645b[_0xb3bc('0xa')](_0xb3bc('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xb3bc('0xc'),'fields':[_0xb3bc('0xc')]},{'name':_0xb3bc('0xd'),'fields':['plainBody','subject'],'type':_0xb3bc('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x194fec,_0x1cfb70,_0xf24ea6){if(_0x194fec[_0xb3bc('0xf')]){_0x194fec[_0xb3bc('0x10')]=htmlToText['fromString'](_0x194fec[_0xb3bc('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xf24ea6(null,_0x1cfb70);},'afterCreate':function(_0x5806d3,_0x98d655,_0x30fe17){var _0x42bee4=_0x12645b[_0xb3bc('0x11')];var _0x5666a1=_0x5806d3[_0xb3bc('0x12')]({'plain':!![]});if(_0x5666a1[_0xb3bc('0x13')][_0xb3bc('0x14')]()==='in'||_0x5666a1[_0xb3bc('0x13')][_0xb3bc('0x14')]()===_0xb3bc('0x15')&&!_0x5666a1[_0xb3bc('0x16')]&&!_['isNil'](_0x5666a1['UserId'])){_0x42bee4['MailInteraction'][_0xb3bc('0x17')]({'where':{'id':_0x5666a1['MailInteractionId']}})['then'](function(_0x32465d){if(_0x32465d){_0x32465d['update']({'lastMsgAt':_0x5666a1['createdAt'],'lastMsgDirection':_0x5666a1[_0xb3bc('0x13')][_0xb3bc('0x14')]()});}})[_0xb3bc('0x18')](function(_0x177ee8){console['error'](_0x177ee8);});}_0x30fe17();}},'charset':_0xb3bc('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ccee61f..b99dfd2 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 _0xc900=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','body','options','raw','debug','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc900,0xb3));var _0x0c90=function(_0x1cde46,_0x33ea78){_0x1cde46=_0x1cde46-0x0;var _0x2e8466=_0xc900[_0x1cde46];return _0x2e8466;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});config[_0x0c90('0xa')]=_['defaults'](config[_0x0c90('0xa')],{'host':_0x0c90('0xb'),'port':0x18eb});var socket=require(_0x0c90('0xc'))(new Redis(config[_0x0c90('0xa')]));require(_0x0c90('0xd'))[_0x0c90('0xe')](socket);function respondWithRpcPromise(_0x313ce9,_0x18d9fd,_0x3e0df6){return new BPromise(function(_0x34456e,_0x10daeb){return client[_0x0c90('0xf')](_0x313ce9,_0x3e0df6)[_0x0c90('0x10')](function(_0x57917b){logger[_0x0c90('0x11')]('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x0c90('0x12'));logger['debug'](_0x0c90('0x13'),_0x18d9fd,_0x0c90('0x12'),JSON[_0x0c90('0x14')](_0x57917b));if(_0x57917b[_0x0c90('0x15')]){if(_0x57917b[_0x0c90('0x15')]['code']===0x1f4){logger[_0x0c90('0x15')](_0x0c90('0x16'),_0x18d9fd,_0x57917b['error'][_0x0c90('0x17')]);return _0x10daeb(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);return _0x34456e(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}else{logger[_0x0c90('0x11')](_0x0c90('0x16'),_0x18d9fd,_0x0c90('0x12'));_0x34456e(_0x57917b['result'][_0x0c90('0x17')]);}})[_0x0c90('0x18')](function(_0x462d49){logger[_0x0c90('0x15')]('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x462d49);_0x10daeb(_0x462d49);});});}exports[_0x0c90('0x19')]=function(_0xd129ca){var _0x143047=this;return new Promise(function(_0x1241a9,_0x315932){return db[_0x0c90('0x1a')]['create'](_0xd129ca[_0x0c90('0x1b')],{'raw':_0xd129ca['options']?_0xd129ca[_0x0c90('0x1c')][_0x0c90('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2a053a){logger[_0x0c90('0x11')](_0x0c90('0x19'),_0xd129ca);logger[_0x0c90('0x1e')](_0x0c90('0x19'),_0xd129ca,JSON[_0x0c90('0x14')](_0x2a053a));_0x1241a9(_0x2a053a);})['catch'](function(_0x26f0a3){logger[_0x0c90('0x15')]('CreateMailMessage',_0x26f0a3['message'],_0xd129ca);_0x315932(_0x143047[_0x0c90('0x15')](0x1f4,_0x26f0a3[_0x0c90('0x17')]));});});}; \ No newline at end of file +var _0x1c9a=['raw','CreateMailMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','MailMessage','create','options'];(function(_0x54c1da,_0x5e991e){var _0x25ddaa=function(_0x4d06cf){while(--_0x4d06cf){_0x54c1da['push'](_0x54c1da['shift']());}};_0x25ddaa(++_0x5e991e);}(_0x1c9a,0x98));var _0xa1c9=function(_0x17520a,_0x5cda84){_0x17520a=_0x17520a-0x0;var _0x590728=_0x1c9a[_0x17520a];return _0x590728;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});config['redis']=_[_0xa1c9('0xa')](config[_0xa1c9('0xb')],{'host':_0xa1c9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1c9('0xb')]));require(_0xa1c9('0xd'))[_0xa1c9('0xe')](socket);function respondWithRpcPromise(_0x1efbab,_0x493cf6,_0x27b020){return new BPromise(function(_0x4437f2,_0x29e24a){return client[_0xa1c9('0xf')](_0x1efbab,_0x27b020)[_0xa1c9('0x10')](function(_0xbb76ef){logger[_0xa1c9('0x11')](_0xa1c9('0x12'),_0x493cf6,_0xa1c9('0x13'));logger[_0xa1c9('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x493cf6,_0xa1c9('0x13'),JSON[_0xa1c9('0x15')](_0xbb76ef));if(_0xbb76ef[_0xa1c9('0x16')]){if(_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x17')]===0x1f4){logger['error'](_0xa1c9('0x12'),_0x493cf6,_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);return _0x29e24a(_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);}logger[_0xa1c9('0x16')](_0xa1c9('0x12'),_0x493cf6,_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);return _0x4437f2(_0xbb76ef[_0xa1c9('0x16')]['message']);}else{logger[_0xa1c9('0x11')](_0xa1c9('0x12'),_0x493cf6,_0xa1c9('0x13'));_0x4437f2(_0xbb76ef['result'][_0xa1c9('0x18')]);}})['catch'](function(_0x21cd35){logger[_0xa1c9('0x16')](_0xa1c9('0x12'),_0x493cf6,_0x21cd35);_0x29e24a(_0x21cd35);});});}exports['CreateMailMessage']=function(_0x3a1110){var _0x46b1e4=this;return new Promise(function(_0x128732,_0x4edf37){return db[_0xa1c9('0x19')][_0xa1c9('0x1a')](_0x3a1110['body'],{'raw':_0x3a1110[_0xa1c9('0x1b')]?_0x3a1110[_0xa1c9('0x1b')][_0xa1c9('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x29f1b1){logger[_0xa1c9('0x11')](_0xa1c9('0x1d'),_0x3a1110);logger[_0xa1c9('0x14')](_0xa1c9('0x1d'),_0x3a1110,JSON['stringify'](_0x29f1b1));_0x128732(_0x29f1b1);})['catch'](function(_0x200749){logger['error'](_0xa1c9('0x1d'),_0x200749[_0xa1c9('0x18')],_0x3a1110);_0x4edf37(_0x46b1e4[_0xa1c9('0x16')](0x1f4,_0x200749[_0xa1c9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 31abb3a..ea57d55 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 _0x4ecf=['update','emit','removeListener','length','mailMessage:','./mailMessage.events','save'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x4ecf,0x186));var _0xf4ec=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x4ecf[_0x11005e];return _0x29338f;};'use strict';var MailMessageEvents=require(_0xf4ec('0x0'));var events=[_0xf4ec('0x1'),'remove',_0xf4ec('0x2')];function createListener(_0x5466d7,_0x4f2642){return function(_0x3d18ef){_0x4f2642[_0xf4ec('0x3')](_0x5466d7,_0x3d18ef);};}function removeListener(_0x544e14,_0x1da580){return function(){MailMessageEvents[_0xf4ec('0x4')](_0x544e14,_0x1da580);};}exports['register']=function(_0x124633){for(var _0x50aa86=0x0,_0x2a8988=events[_0xf4ec('0x5')];_0x50aa86<_0x2a8988;_0x50aa86++){var _0x213f0a=events[_0x50aa86];var _0x313c1e=createListener(_0xf4ec('0x6')+_0x213f0a,_0x124633);MailMessageEvents['on'](_0x213f0a,_0x313c1e);}}; \ No newline at end of file +var _0x727a=['update','emit','register','mailMessage:','./mailMessage.events','remove'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x727a,0x1f0));var _0xa727=function(_0x28a196,_0x349ebf){_0x28a196=_0x28a196-0x0;var _0x4ccb77=_0x727a[_0x28a196];return _0x4ccb77;};'use strict';var MailMessageEvents=require(_0xa727('0x0'));var events=['save',_0xa727('0x1'),_0xa727('0x2')];function createListener(_0x40adb8,_0x109975){return function(_0x2f3ab2){_0x109975[_0xa727('0x3')](_0x40adb8,_0x2f3ab2);};}function removeListener(_0x30b260,_0x18489c){return function(){MailMessageEvents['removeListener'](_0x30b260,_0x18489c);};}exports[_0xa727('0x4')]=function(_0x36b79a){for(var _0x18a608=0x0,_0x223816=events['length'];_0x18a608<_0x223816;_0x18a608++){var _0x4a616f=events[_0x18a608];var _0x269161=createListener(_0xa727('0x5')+_0x4a616f,_0x36b79a);MailMessageEvents['on'](_0x4a616f,_0x269161);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9e5bef1..463b35c 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 _0xd154=['index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated'];(function(_0x1f3218,_0x565766){var _0x1970fd=function(_0x4b873f){while(--_0x4b873f){_0x1f3218['push'](_0x1f3218['shift']());}};_0x1970fd(++_0x565766);}(_0xd154,0x1d6));var _0x4d15=function(_0xefb7bc,_0x561d9e){_0xefb7bc=_0xefb7bc-0x0;var _0x1abb1e=_0xd154[_0xefb7bc];return _0x1abb1e;};'use strict';var multer=require(_0x4d15('0x0'));var util=require('util');var path=require(_0x4d15('0x1'));var timeout=require(_0x4d15('0x2'));var express=require(_0x4d15('0x3'));var router=express[_0x4d15('0x4')]();var fs_extra=require(_0x4d15('0x5'));var auth=require(_0x4d15('0x6'));var interaction=require(_0x4d15('0x7'));var config=require('../../config/environment');var controller=require(_0x4d15('0x8'));router['get']('/',auth[_0x4d15('0x9')](),controller[_0x4d15('0xa')]);router[_0x4d15('0xb')](_0x4d15('0xc'),auth[_0x4d15('0x9')](),controller[_0x4d15('0xd')]);router[_0x4d15('0xb')](_0x4d15('0xe'),auth[_0x4d15('0x9')](),controller[_0x4d15('0xf')]);router['get'](_0x4d15('0x10'),auth['isAuthenticated'](),controller[_0x4d15('0x11')]);router[_0x4d15('0xb')](_0x4d15('0x12'),auth['isAuthenticated'](),controller[_0x4d15('0x13')]);router[_0x4d15('0xb')](_0x4d15('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4d15('0x15')]('/',auth[_0x4d15('0x9')](),controller[_0x4d15('0x16')]);router['post'](_0x4d15('0x12'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x17')]);router[_0x4d15('0x15')](_0x4d15('0x14'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x18')]);router[_0x4d15('0x19')](_0x4d15('0xe'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x1a')]);router[_0x4d15('0x1b')](_0x4d15('0xe'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x1c')]);router[_0x4d15('0x1b')](_0x4d15('0x12'),auth[_0x4d15('0x9')](),controller[_0x4d15('0x1d')]);router[_0x4d15('0x1b')](_0x4d15('0x14'),auth[_0x4d15('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4f9b=['put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents'];(function(_0x1a7774,_0x426640){var _0x3347d2=function(_0x4ce6ac){while(--_0x4ce6ac){_0x1a7774['push'](_0x1a7774['shift']());}};_0x3347d2(++_0x426640);}(_0x4f9b,0xdf));var _0xb4f9=function(_0x16578c,_0x24fa12){_0x16578c=_0x16578c-0x0;var _0x7a6990=_0x4f9b[_0x16578c];return _0x7a6990;};'use strict';var multer=require(_0xb4f9('0x0'));var util=require(_0xb4f9('0x1'));var path=require(_0xb4f9('0x2'));var timeout=require(_0xb4f9('0x3'));var express=require('express');var router=express[_0xb4f9('0x4')]();var fs_extra=require(_0xb4f9('0x5'));var auth=require(_0xb4f9('0x6'));var interaction=require(_0xb4f9('0x7'));var config=require(_0xb4f9('0x8'));var controller=require(_0xb4f9('0x9'));router[_0xb4f9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb4f9('0xa')](_0xb4f9('0xb'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0xd')]);router['get'](_0xb4f9('0xe'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0xf')]);router['get'](_0xb4f9('0x10'),auth[_0xb4f9('0xc')](),controller['getMembers']);router[_0xb4f9('0xa')](_0xb4f9('0x11'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x12')]);router[_0xb4f9('0xa')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x14')]);router[_0xb4f9('0x15')]('/',auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x16')]);router[_0xb4f9('0x15')]('/:id/teams',auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x17')]);router[_0xb4f9('0x15')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x18')]);router[_0xb4f9('0x19')](_0xb4f9('0xe'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x1a')]);router[_0xb4f9('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xb4f9('0x1c')]);router[_0xb4f9('0x1b')](_0xb4f9('0x11'),auth['isAuthenticated'](),controller[_0xb4f9('0x1d')]);router[_0xb4f9('0x1b')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7e72194..23e1b6c 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 _0x5f9e=['ENUM','rrmemory','sequelize','exports','STRING','name','INTEGER'];(function(_0x5d1e86,_0x171397){var _0x3c9c68=function(_0x5eabde){while(--_0x5eabde){_0x5d1e86['push'](_0x5d1e86['shift']());}};_0x3c9c68(++_0x171397);}(_0x5f9e,0xaa));var _0xe5f9=function(_0x295a92,_0x7d70dc){_0x295a92=_0x295a92-0x0;var _0x3f5dac=_0x5f9e[_0x295a92];return _0x3f5dac;};'use strict';var Sequelize=require(_0xe5f9('0x0'));module[_0xe5f9('0x1')]={'name':{'type':Sequelize[_0xe5f9('0x2')],'unique':_0xe5f9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe5f9('0x2')]},'timeout':{'type':Sequelize[_0xe5f9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe5f9('0x5')](_0xe5f9('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xa043=['exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x3ef314,_0x4a3afd){var _0x4a6455=function(_0x479be9){while(--_0x479be9){_0x3ef314['push'](_0x3ef314['shift']());}};_0x4a6455(++_0x4a3afd);}(_0xa043,0x72));var _0x3a04=function(_0x6f942d,_0xd9244d){_0x6f942d=_0x6f942d-0x0;var _0x547805=_0xa043[_0x6f942d];return _0x547805;};'use strict';var Sequelize=require('sequelize');module[_0x3a04('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x3a04('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3a04('0x2')]},'timeout':{'type':Sequelize[_0x3a04('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3a04('0x4')](_0x3a04('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 3ed03d8..8238fdf 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 _0x9bbc=['sort','pick','MailQueueId','filter','options','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','addTeams','ids','Team','Agents','online','interface','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','UserProfileResource','end','error','name','send','map','MailQueue','rawAttributes','type','key','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','get','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','nolimit','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bbc,0x19d));var _0xc9bb=function(_0x145cdb,_0x5ecbe9){_0x145cdb=_0x145cdb-0x0;var _0x8ecb0b=_0x9bbc[_0x145cdb];return _0x8ecb0b;};'use strict';var BPromise=require('bluebird');var util=require(_0xc9bb('0x0'));var _=require(_0xc9bb('0x1'));var squel=require(_0xc9bb('0x2'));var Redis=require(_0xc9bb('0x3'));var qs=require(_0xc9bb('0x4'));var logger=require(_0xc9bb('0x5'))(_0xc9bb('0x6'));var config=require(_0xc9bb('0x7'));var db=require(_0xc9bb('0x8'))['db'];config['redis']=_[_0xc9bb('0x9')](config[_0xc9bb('0xa')],{'host':_0xc9bb('0xb'),'port':0x18eb});var socket=require(_0xc9bb('0xc'))(new Redis(config[_0xc9bb('0xa')]));require(_0xc9bb('0xd'))[_0xc9bb('0xe')](socket);function respondWithStatusCode(_0x34a868,_0x43ff07){_0x43ff07=_0x43ff07||0xcc;return function(_0x546c63){if(_0x546c63){return _0x34a868[_0xc9bb('0xf')](_0x43ff07);}return _0x34a868[_0xc9bb('0x10')](_0x43ff07)['end']();};}function respondWithResult(_0x1ebcbe,_0x4ac979){_0x4ac979=_0x4ac979||0xc8;return function(_0x250618){if(_0x250618){return _0x1ebcbe[_0xc9bb('0x10')](_0x4ac979)[_0xc9bb('0x11')](_0x250618);}};}function respondWithFilteredResult(_0xf33d9b,_0x52eff6){return function(_0x3ba670){if(_0x3ba670){var _0x160008=typeof _0x52eff6['offset']==='undefined'&&typeof _0x52eff6[_0xc9bb('0x12')]===_0xc9bb('0x13');var _0x3adf84=_0x3ba670[_0xc9bb('0x14')];var _0x8e5d02=_0x160008?0x0:_0x52eff6[_0xc9bb('0x15')];var _0x3c0eda=_0x160008?_0x3ba670['count']:_0x52eff6[_0xc9bb('0x15')]+_0x52eff6[_0xc9bb('0x12')];var _0x2b088d;if(_0x3c0eda>=_0x3adf84){_0x3c0eda=_0x3adf84;_0x2b088d=0xc8;}else{_0x2b088d=0xce;}_0xf33d9b[_0xc9bb('0x10')](_0x2b088d);return _0xf33d9b[_0xc9bb('0x16')](_0xc9bb('0x17'),_0x8e5d02+'-'+_0x3c0eda+'/'+_0x3adf84)[_0xc9bb('0x11')](_0x3ba670);}return null;};}function saveUpdates(_0x18e0fb){return function(_0x493ad9){if(_0x493ad9){return _0x493ad9[_0xc9bb('0x18')](_0x18e0fb)[_0xc9bb('0x19')](function(_0x4fd1c7){return _0x4fd1c7;});}return null;};}function removeEntity(_0x237332){return function(_0x306aad){if(_0x306aad){return _0x306aad[_0xc9bb('0x1a')]()[_0xc9bb('0x19')](function(){var _0x1a64e6=_0x306aad['get']({'plain':!![]});var _0x42ccfd='MailQueues';return db[_0xc9bb('0x1b')][_0xc9bb('0x1a')]({'where':{'type':_0x42ccfd,'resourceId':_0x1a64e6['id']}})[_0xc9bb('0x19')](function(){return _0x306aad;});})[_0xc9bb('0x19')](function(){_0x237332[_0xc9bb('0x10')](0xcc)[_0xc9bb('0x1c')]();});}};}function handleEntityNotFound(_0x2948a4){return function(_0x4fed30){if(!_0x4fed30){_0x2948a4[_0xc9bb('0xf')](0x194);}return _0x4fed30;};}function handleError(_0x4c8b95,_0x36d47d){_0x36d47d=_0x36d47d||0x1f4;return function(_0x41f3a3){logger[_0xc9bb('0x1d')](_0x41f3a3['stack']);if(_0x41f3a3['name']){delete _0x41f3a3[_0xc9bb('0x1e')];}_0x4c8b95[_0xc9bb('0x10')](_0x36d47d)[_0xc9bb('0x1f')](_0x41f3a3);};}exports['index']=function(_0x594459,_0x47aefc){var _0x36531b={};var _0x22d279={'count':0x0,'rows':[]};var _0x4dea71=_[_0xc9bb('0x20')](db[_0xc9bb('0x21')][_0xc9bb('0x22')],function(_0x5c8792){return{'name':_0x5c8792['fieldName'],'type':_0x5c8792[_0xc9bb('0x23')][_0xc9bb('0x24')]};});_0x36531b=qs['getOptions'](_0x4dea71,_0x594459);var _0x38c850={'where':_0x36531b[_0xc9bb('0x25')]};return db[_0xc9bb('0x21')]['count'](_0x38c850)['then'](function(_0x9a4d29){_0x22d279[_0xc9bb('0x14')]=_0x9a4d29;_0x36531b['include']=qs[_0xc9bb('0x26')](_0x594459[_0xc9bb('0x27')]);return db[_0xc9bb('0x21')][_0xc9bb('0x28')](_0x36531b);})[_0xc9bb('0x19')](function(_0x17d481){_0x22d279[_0xc9bb('0x29')]=_0x17d481;return _0x22d279;})['then'](respondWithFilteredResult(_0x47aefc,_0x36531b))[_0xc9bb('0x2a')](handleError(_0x47aefc,null));};exports[_0xc9bb('0x2b')]=function(_0x851256,_0x81a376){var _0x52aae9={'raw':!![],'where':{'id':_0x851256[_0xc9bb('0x2c')]['id']}},_0x4f6f16={};_0x4f6f16[_0xc9bb('0x2d')]=_[_0xc9bb('0x2e')](db['MailQueue'][_0xc9bb('0x22')]);_0x4f6f16['query']=_[_0xc9bb('0x2e')](_0x851256[_0xc9bb('0x27')]);_0x4f6f16[_0xc9bb('0x2f')]=_[_0xc9bb('0x30')](_0x4f6f16[_0xc9bb('0x2d')],_0x4f6f16[_0xc9bb('0x27')]);_0x52aae9[_0xc9bb('0x31')]=_[_0xc9bb('0x30')](_0x4f6f16['model'],qs['fields'](_0x851256[_0xc9bb('0x27')][_0xc9bb('0x32')]));_0x52aae9[_0xc9bb('0x31')]=_0x52aae9[_0xc9bb('0x31')][_0xc9bb('0x33')]?_0x52aae9[_0xc9bb('0x31')]:_0x4f6f16['model'];if(_0x851256[_0xc9bb('0x27')][_0xc9bb('0x34')]){_0x52aae9[_0xc9bb('0x26')]=[{'all':!![]}];}_0x52aae9=_[_0xc9bb('0x35')]({},_0x52aae9,_0x851256['options']);return db[_0xc9bb('0x21')][_0xc9bb('0x36')](_0x52aae9)[_0xc9bb('0x19')](handleEntityNotFound(_0x81a376,null))[_0xc9bb('0x19')](respondWithResult(_0x81a376,null))[_0xc9bb('0x2a')](handleError(_0x81a376,null));};exports[_0xc9bb('0x37')]=function(_0x4eb9b9,_0xdc37ee){return db['MailQueue'][_0xc9bb('0x37')](_0x4eb9b9[_0xc9bb('0x38')],{})[_0xc9bb('0x19')](function(_0x2e44bd){var _0x496042=_0x4eb9b9[_0xc9bb('0x39')][_0xc9bb('0x3a')]({'plain':!![]});if(!_0x496042)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x496042[_0xc9bb('0x3b')]===_0xc9bb('0x39')){var _0x47ce76=_0x2e44bd[_0xc9bb('0x3a')]({'plain':!![]});var _0x5d02ec=_0xc9bb('0x3c');return db[_0xc9bb('0x3d')][_0xc9bb('0x36')]({'where':{'name':_0x5d02ec,'userProfileId':_0x496042[_0xc9bb('0x3e')]},'raw':!![]})[_0xc9bb('0x19')](function(_0x58fccf){if(_0x58fccf&&_0x58fccf[_0xc9bb('0x3f')]===0x0){return db[_0xc9bb('0x1b')][_0xc9bb('0x37')]({'name':_0x47ce76[_0xc9bb('0x1e')],'resourceId':_0x47ce76['id'],'type':_0x58fccf[_0xc9bb('0x1e')],'sectionId':_0x58fccf['id']},{})[_0xc9bb('0x19')](function(){return _0x2e44bd;});}else{return _0x2e44bd;}})[_0xc9bb('0x2a')](function(_0xe92073){logger[_0xc9bb('0x1d')](_0xc9bb('0x40'),_0xe92073);throw _0xe92073;});}return _0x2e44bd;})[_0xc9bb('0x19')](respondWithResult(_0xdc37ee,0xc9))[_0xc9bb('0x2a')](handleError(_0xdc37ee,null));};exports['update']=function(_0x3cff06,_0x3ca141){if(_0x3cff06[_0xc9bb('0x38')]['id']){delete _0x3cff06['body']['id'];}return db[_0xc9bb('0x21')][_0xc9bb('0x36')]({'where':{'id':_0x3cff06[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x3ca141,null))[_0xc9bb('0x19')](saveUpdates(_0x3cff06[_0xc9bb('0x38')],null))[_0xc9bb('0x19')](respondWithResult(_0x3ca141,null))['catch'](handleError(_0x3ca141,null));};exports[_0xc9bb('0x1a')]=function(_0x416587,_0x41b4a1){return db[_0xc9bb('0x21')]['find']({'where':{'id':_0x416587[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x41b4a1,null))[_0xc9bb('0x19')](removeEntity(_0x41b4a1,null))[_0xc9bb('0x2a')](handleError(_0x41b4a1,null));};exports[_0xc9bb('0x41')]=function(_0x54f170,_0x147b41){return db[_0xc9bb('0x21')][_0xc9bb('0x41')]()['then'](respondWithResult(_0x147b41,null))[_0xc9bb('0x2a')](handleError(_0x147b41,null));};exports[_0xc9bb('0x42')]=function(_0x3ef9bb,_0x17c050){var _0xe97116={'raw':!![],'where':{}},_0x1e06fc={},_0x216020;return db[_0xc9bb('0x21')][_0xc9bb('0x43')]({'where':{'id':_0x3ef9bb[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x17c050,null))['then'](function(_0x55e247){if(_0x55e247){_0x216020=_0x55e247[_0xc9bb('0x3a')]({'plain':!![]});_0x1e06fc[_0xc9bb('0x2d')]=_[_0xc9bb('0x2e')](db[_0xc9bb('0x44')]['rawAttributes']);_0x1e06fc[_0xc9bb('0x27')]=_[_0xc9bb('0x2e')](_0x3ef9bb[_0xc9bb('0x27')]);_0x1e06fc[_0xc9bb('0x2f')]=_[_0xc9bb('0x30')](_0x1e06fc[_0xc9bb('0x2d')],_0x1e06fc[_0xc9bb('0x27')]);_0xe97116['attributes']=_[_0xc9bb('0x30')](_0x1e06fc['model'],qs['fields'](_0x3ef9bb[_0xc9bb('0x27')]['fields']));_0xe97116[_0xc9bb('0x31')]=_0xe97116[_0xc9bb('0x31')][_0xc9bb('0x33')]?_0xe97116['attributes']:_0x1e06fc['model'];if(!_0x3ef9bb[_0xc9bb('0x27')]['hasOwnProperty'](_0xc9bb('0x45'))){_0xe97116[_0xc9bb('0x12')]=qs['limit'](_0x3ef9bb[_0xc9bb('0x27')][_0xc9bb('0x12')]);_0xe97116['offset']=qs[_0xc9bb('0x15')](_0x3ef9bb[_0xc9bb('0x27')][_0xc9bb('0x15')]);}_0xe97116[_0xc9bb('0x46')]=qs[_0xc9bb('0x47')](_0x3ef9bb[_0xc9bb('0x27')][_0xc9bb('0x47')]);_0xe97116[_0xc9bb('0x25')]=qs['filters'](_[_0xc9bb('0x48')](_0x3ef9bb['query'],_0x1e06fc['filters']));_0xe97116[_0xc9bb('0x25')][_0xc9bb('0x49')]=_0x55e247['id'];if(_0x3ef9bb[_0xc9bb('0x27')]['filter']){_0xe97116[_0xc9bb('0x25')]=_[_0xc9bb('0x35')](_0xe97116['where'],{'$or':_[_0xc9bb('0x20')](_0xe97116[_0xc9bb('0x31')],function(_0x58e11f){var _0x482bce={};_0x482bce[_0x58e11f]={'$like':'%'+_0x3ef9bb[_0xc9bb('0x27')][_0xc9bb('0x4a')]+'%'};return _0x482bce;})});}_0xe97116=_[_0xc9bb('0x35')]({},_0xe97116,_0x3ef9bb[_0xc9bb('0x4b')]);return db[_0xc9bb('0x44')][_0xc9bb('0x28')](_0xe97116);}})['then'](function(_0x30021d){if(_0x30021d){return db[_0xc9bb('0x4c')][_0xc9bb('0x4d')]({'where':{'id':_[_0xc9bb('0x20')](_0x30021d,_0xc9bb('0x4e')),'role':'agent'},'attributes':['id',_0xc9bb('0x1e'),_0xc9bb('0x4f'),_0xc9bb('0x50'),_0xc9bb('0x51')]});}})['then'](function(_0x15ff7c){if(_0x15ff7c){return{'count':_0x15ff7c[_0xc9bb('0x14')],'rows':_[_0xc9bb('0x20')](_0x15ff7c[_0xc9bb('0x29')],function(_0x20c3cf){return{'membername':_0x20c3cf[_0xc9bb('0x1e')],'UserId':_0x20c3cf['id'],'queue_name':_0x216020['name'],'MailQueueId':_0x216020['id'],'interface':util[_0xc9bb('0x52')]('%s/%s',_0xc9bb('0x53'),_0x20c3cf[_0xc9bb('0x1e')]),'penalty':0x0,'paused':_0x20c3cf[_0xc9bb('0x4f')],'createdAt':_0x20c3cf[_0xc9bb('0x51')],'updatedAt':_0x20c3cf['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc9bb('0x19')](respondWithFilteredResult(_0x17c050,_0xe97116))[_0xc9bb('0x2a')](handleError(_0x17c050,null));};exports['getTeams']=function(_0x2e7eef,_0x14afc7){var _0x904ee3={};var _0x3458b9={};var _0x5caac8;var _0x2c14c2;return db['MailQueue'][_0xc9bb('0x43')]({'where':{'id':_0x2e7eef[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x14afc7,null))[_0xc9bb('0x19')](function(_0x5b98e4){if(_0x5b98e4){_0x5caac8=_0x5b98e4;_0x3458b9[_0xc9bb('0x2d')]=_[_0xc9bb('0x2e')](db['Team'][_0xc9bb('0x22')]);_0x3458b9['query']=_['keys'](_0x2e7eef[_0xc9bb('0x27')]);_0x3458b9[_0xc9bb('0x2f')]=_['intersection'](_0x3458b9[_0xc9bb('0x2d')],_0x3458b9['query']);_0x904ee3[_0xc9bb('0x31')]=_['intersection'](_0x3458b9[_0xc9bb('0x2d')],qs[_0xc9bb('0x32')](_0x2e7eef[_0xc9bb('0x27')][_0xc9bb('0x32')]));_0x904ee3['attributes']=_0x904ee3[_0xc9bb('0x31')][_0xc9bb('0x33')]?_0x904ee3[_0xc9bb('0x31')]:_0x3458b9[_0xc9bb('0x2d')];_0x904ee3[_0xc9bb('0x46')]=qs['sort'](_0x2e7eef[_0xc9bb('0x27')][_0xc9bb('0x47')]);_0x904ee3[_0xc9bb('0x25')]=qs['filters'](_[_0xc9bb('0x48')](_0x2e7eef[_0xc9bb('0x27')],_0x3458b9[_0xc9bb('0x2f')]));if(_0x2e7eef[_0xc9bb('0x27')]['filter']){_0x904ee3[_0xc9bb('0x25')]=_['merge'](_0x904ee3[_0xc9bb('0x25')],{'$or':_['map'](_0x904ee3[_0xc9bb('0x31')],function(_0x15056f){var _0x52917f={};_0x52917f[_0x15056f]={'$like':'%'+_0x2e7eef['query']['filter']+'%'};return _0x52917f;})});}_0x904ee3=_[_0xc9bb('0x35')]({},_0x904ee3,_0x2e7eef['options']);return _0x5caac8['getTeams'](_0x904ee3);}})[_0xc9bb('0x19')](function(_0x584c21){if(_0x584c21){_0x2c14c2=_0x584c21['length'];if(!_0x2e7eef[_0xc9bb('0x27')]['hasOwnProperty']('nolimit')){_0x904ee3['limit']=qs['limit'](_0x2e7eef[_0xc9bb('0x27')][_0xc9bb('0x12')]);_0x904ee3[_0xc9bb('0x15')]=qs[_0xc9bb('0x15')](_0x2e7eef[_0xc9bb('0x27')][_0xc9bb('0x15')]);}return _0x5caac8['getTeams'](_0x904ee3);}})[_0xc9bb('0x19')](function(_0xd81297){if(_0xd81297){return _0xd81297?{'count':_0x2c14c2,'rows':_0xd81297}:null;}})[_0xc9bb('0x19')](respondWithResult(_0x14afc7,null))['catch'](handleError(_0x14afc7,null));};exports[_0xc9bb('0x54')]=function(_0x360e88,_0x135c49){var _0x3d6752=_0x360e88[_0xc9bb('0x38')][_0xc9bb('0x55')];return db[_0xc9bb('0x56')][_0xc9bb('0x28')]({'where':{'id':_0x3d6752},'attributes':['id'],'include':[{'model':db[_0xc9bb('0x4c')],'as':_0xc9bb('0x57'),'attributes':['id',_0xc9bb('0x1e'),_0xc9bb('0x58'),'voicePause',_0xc9bb('0x59')],'raw':!![]}]})[_0xc9bb('0x19')](function(_0x4ecc95){if(_0x4ecc95){var _0x43ce3b=_['flatMap'](_0x4ecc95,function(_0x4d803d){var _0x21edd6=_0x4d803d[_0xc9bb('0x3a')]({'plain':!![]});return _0x21edd6['Agents'];});return db[_0xc9bb('0x21')][_0xc9bb('0x36')]({'where':{'id':_0x360e88['params']['id']}})[_0xc9bb('0x19')](function(_0x514bd2){return db[_0xc9bb('0x5a')][_0xc9bb('0x5b')](function(_0x14f4b5){return _0x514bd2[_0xc9bb('0x54')](_0x3d6752,{'transaction':_0x14f4b5})['then'](function(){return BPromise['each'](_0x43ce3b,function(_0x4654d6){return db[_0xc9bb('0x44')][_0xc9bb('0x5c')]({'where':{'UserId':_0x4654d6['id'],'MailQueueId':_0x360e88['params']['id']},'transaction':_0x14f4b5});});})['then'](function(){_0x43ce3b[_0xc9bb('0x5d')](function(_0x506af2){socket[_0xc9bb('0x5e')](_0xc9bb('0x5f'),{'UserId':_0x506af2['id'],'MailQueueId':_0x514bd2['id']});});});});});}})[_0xc9bb('0x19')](respondWithStatusCode(_0x135c49,null))[_0xc9bb('0x2a')](handleError(_0x135c49,null));};exports[_0xc9bb('0x60')]=function(_0x59fb4c,_0x37855b){return db[_0xc9bb('0x56')][_0xc9bb('0x28')]({'where':{'id':_0x59fb4c[_0xc9bb('0x27')][_0xc9bb('0x55')]},'attributes':['id'],'include':[{'model':db[_0xc9bb('0x4c')],'as':_0xc9bb('0x57'),'attributes':['id'],'raw':!![]}]})[_0xc9bb('0x19')](handleEntityNotFound(_0x37855b,null))[_0xc9bb('0x19')](function(_0x4a362e){var _0x56863a=_['map'](_0x4a362e,'id');var _0x198d54=[];var _0x2d81be=[];var _0x5bcc79=squel['select']();_0x5bcc79[_0xc9bb('0x61')]('tq.TeamId')[_0xc9bb('0x62')](_0xc9bb('0x63'),'tq')[_0xc9bb('0x64')](_0xc9bb('0x65'),'ut',_0xc9bb('0x66'))[_0xc9bb('0x25')](_0xc9bb('0x67'),_0x59fb4c['params']['id']);for(var _0x388756=0x0;_0x388756<_0x4a362e['length'];_0x388756+=0x1){let _0x46eb51=_0x4a362e[_0x388756];for(var _0xfd5d37=0x0;_0xfd5d37<_0x46eb51[_0xc9bb('0x57')][_0xc9bb('0x33')];_0xfd5d37+=0x1){let _0x2257ab=_0x46eb51[_0xc9bb('0x57')][_0xfd5d37];var _0xd93236=_0x5bcc79['clone']();_0xd93236[_0xc9bb('0x25')](_0xc9bb('0x68'),_0x2257ab['id']);_0x2d81be[_0xc9bb('0x69')](db[_0xc9bb('0x5a')][_0xc9bb('0x27')](_0xd93236[_0xc9bb('0x6a')](),{'type':db[_0xc9bb('0x5a')][_0xc9bb('0x6b')][_0xc9bb('0x6c')]})['then'](function(_0x3d4075){if(_0x3d4075['length']===0x1){return _0x2257ab['id'];}else{var _0x4ed7bb=_[_0xc9bb('0x6d')](_['map'](_0x3d4075,_0xc9bb('0x6e')),function(_0x27b539){return _[_0xc9bb('0x6f')](_0x56863a,_0x27b539);});if(_0x4ed7bb){return _0x2257ab['id'];}}}));}}return BPromise['all'](_0x2d81be)[_0xc9bb('0x19')](function(_0x3f104d){_0x198d54=_(_0x198d54)['union'](_0x3f104d)[_0xc9bb('0x70')]()[_0xc9bb('0x71')]();return db[_0xc9bb('0x21')][_0xc9bb('0x36')]({'where':{'id':_0x59fb4c[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](function(_0x4a7a07){return db[_0xc9bb('0x5a')][_0xc9bb('0x5b')](function(_0x282993){return _0x4a7a07[_0xc9bb('0x60')](_0x59fb4c['query']['ids'],{'transaction':_0x282993})['then'](function(){if(!_[_0xc9bb('0x72')](_0x198d54)){return _0x4a7a07[_0xc9bb('0x73')](_0x198d54,{'transaction':_0x282993});}})[_0xc9bb('0x19')](function(){_0x198d54[_0xc9bb('0x5d')](function(_0x4ecdbd){socket[_0xc9bb('0x5e')](_0xc9bb('0x74'),{'UserId':_0x4ecdbd,'MailQueueId':_0x4a7a07['id']});});});});});});})[_0xc9bb('0x19')](respondWithStatusCode(_0x37855b,null))['catch'](handleError(_0x37855b,null));};exports[_0xc9bb('0x75')]=function(_0x3a7c9e,_0x1da6f3){return db['MailQueue'][_0xc9bb('0x36')]({'where':{'id':_0x3a7c9e[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x1da6f3,null))[_0xc9bb('0x19')](function(_0x118416){if(_0x118416){return _0x118416[_0xc9bb('0x75')](_0x3a7c9e[_0xc9bb('0x38')][_0xc9bb('0x55')],_['omit'](_0x3a7c9e[_0xc9bb('0x38')],['ids','id'])||{})[_0xc9bb('0x76')](function(_0x3531f1){for(var _0x1fc5a1=0x0;_0x1fc5a1<_0x3a7c9e[_0xc9bb('0x38')][_0xc9bb('0x55')][_0xc9bb('0x33')];_0x1fc5a1+=0x1){socket[_0xc9bb('0x5e')](_0xc9bb('0x5f'),{'UserId':Number(_0x3a7c9e['body'][_0xc9bb('0x55')][_0x1fc5a1]),'MailQueueId':Number(_0x3a7c9e[_0xc9bb('0x2c')]['id'])});}return _0x3531f1;});}})['then'](respondWithResult(_0x1da6f3,null))[_0xc9bb('0x2a')](handleError(_0x1da6f3,null));};exports[_0xc9bb('0x73')]=function(_0x32d47e,_0xd54973){return db['MailQueue'][_0xc9bb('0x36')]({'where':{'id':_0x32d47e[_0xc9bb('0x2c')]['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0xd54973,null))[_0xc9bb('0x19')](function(_0x58a996){if(_0x58a996){return _0x58a996[_0xc9bb('0x73')](_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')])[_0xc9bb('0x19')](function(){if(_[_0xc9bb('0x77')](_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')])){for(var _0x2ead35=0x0;_0x2ead35<_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')][_0xc9bb('0x33')];_0x2ead35+=0x1){socket[_0xc9bb('0x5e')]('userMailQueue:remove',{'UserId':Number(_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')][_0x2ead35]),'MailQueueId':Number(_0x32d47e['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x32d47e[_0xc9bb('0x27')][_0xc9bb('0x55')]),'MailQueueId':Number(_0x32d47e[_0xc9bb('0x2c')]['id'])});}});}})[_0xc9bb('0x19')](respondWithStatusCode(_0xd54973,null))['catch'](handleError(_0xd54973,null));};exports[_0xc9bb('0x78')]=function(_0xb7c3f0,_0x55fea4){var _0xb9c28b={};var _0x44c0ff={};var _0x57c090;var _0x57800e;return db['MailQueue'][_0xc9bb('0x43')]({'where':{'id':_0xb7c3f0['params']['id']}})[_0xc9bb('0x19')](handleEntityNotFound(_0x55fea4,null))[_0xc9bb('0x19')](function(_0x330e08){if(_0x330e08){_0x57c090=_0x330e08;_0x44c0ff['model']=_['keys'](db[_0xc9bb('0x4c')][_0xc9bb('0x22')]);_0x44c0ff['query']=_[_0xc9bb('0x2e')](_0xb7c3f0[_0xc9bb('0x27')]);_0x44c0ff[_0xc9bb('0x2f')]=_[_0xc9bb('0x30')](_0x44c0ff['model'],_0x44c0ff[_0xc9bb('0x27')]);_0xb9c28b[_0xc9bb('0x31')]=_[_0xc9bb('0x30')](_0x44c0ff[_0xc9bb('0x2d')],qs[_0xc9bb('0x32')](_0xb7c3f0[_0xc9bb('0x27')]['fields']));_0xb9c28b[_0xc9bb('0x31')]=_0xb9c28b[_0xc9bb('0x31')][_0xc9bb('0x33')]?_0xb9c28b['attributes']:_0x44c0ff[_0xc9bb('0x2d')];_0xb9c28b[_0xc9bb('0x46')]=qs[_0xc9bb('0x47')](_0xb7c3f0['query'][_0xc9bb('0x47')]);_0xb9c28b['where']=qs[_0xc9bb('0x2f')](_[_0xc9bb('0x48')](_0xb7c3f0[_0xc9bb('0x27')],_0x44c0ff['filters']));if(_0xb7c3f0[_0xc9bb('0x27')][_0xc9bb('0x4a')]){_0xb9c28b[_0xc9bb('0x25')]=_[_0xc9bb('0x35')](_0xb9c28b[_0xc9bb('0x25')],{'$or':_['map'](_0xb9c28b[_0xc9bb('0x31')],function(_0x473912){var _0x5c269a={};_0x5c269a[_0x473912]={'$like':'%'+_0xb7c3f0['query']['filter']+'%'};return _0x5c269a;})});}_0xb9c28b=_[_0xc9bb('0x35')]({},_0xb9c28b,_0xb7c3f0[_0xc9bb('0x4b')]);return _0x57c090[_0xc9bb('0x78')](_0xb9c28b);}})['then'](function(_0x133aa1){if(_0x133aa1){_0x57800e=_0x133aa1[_0xc9bb('0x33')];if(!_0xb7c3f0[_0xc9bb('0x27')]['hasOwnProperty'](_0xc9bb('0x45'))){_0xb9c28b['limit']=qs[_0xc9bb('0x12')](_0xb7c3f0[_0xc9bb('0x27')]['limit']);_0xb9c28b[_0xc9bb('0x15')]=qs['offset'](_0xb7c3f0[_0xc9bb('0x27')][_0xc9bb('0x15')]);}return _0x57c090['getAgents'](_0xb9c28b);}})[_0xc9bb('0x19')](function(_0x33fddf){if(_0x33fddf){return _0x33fddf?{'count':_0x57800e,'rows':_0x33fddf}:null;}})['then'](respondWithResult(_0x55fea4,null))[_0xc9bb('0x2a')](handleError(_0x55fea4,null));}; \ No newline at end of file +var _0x3c03=['addTeams','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','includes','all','union','compact','value','transaction','isEmpty','userMailQueue:remove','addAgents','omit','removeAgents','isArray','bluebird','util','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','undefined','limit','offset','set','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','count','include','query','findAll','catch','show','params','model','keys','MailQueue','filters','intersection','attributes','fields','length','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','find','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','sort','where','pick','MailQueueId','filter','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','rows','format','SIP','Team','getTeams','nolimit'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x3c03,0x114));var _0x33c0=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x3c03[_0x1477ef];return _0x164acd;};'use strict';var BPromise=require(_0x33c0('0x0'));var util=require(_0x33c0('0x1'));var _=require(_0x33c0('0x2'));var squel=require(_0x33c0('0x3'));var Redis=require(_0x33c0('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x33c0('0x5'));var config=require(_0x33c0('0x6'));var db=require(_0x33c0('0x7'))['db'];config['redis']=_[_0x33c0('0x8')](config[_0x33c0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x33c0('0xa'))(new Redis(config['redis']));require(_0x33c0('0xb'))[_0x33c0('0xc')](socket);function respondWithStatusCode(_0x447511,_0x259832){_0x259832=_0x259832||0xcc;return function(_0x6c41d4){if(_0x6c41d4){return _0x447511[_0x33c0('0xd')](_0x259832);}return _0x447511[_0x33c0('0xe')](_0x259832)['end']();};}function respondWithResult(_0x583659,_0x467aef){_0x467aef=_0x467aef||0xc8;return function(_0x340923){if(_0x340923){return _0x583659['status'](_0x467aef)[_0x33c0('0xf')](_0x340923);}};}function respondWithFilteredResult(_0x1362d6,_0x228ef3){return function(_0x31c838){if(_0x31c838){var _0xac3320=typeof _0x228ef3['offset']===_0x33c0('0x10')&&typeof _0x228ef3[_0x33c0('0x11')]===_0x33c0('0x10');var _0x2b94ba=_0x31c838['count'];var _0x34d1ad=_0xac3320?0x0:_0x228ef3[_0x33c0('0x12')];var _0x5d499e=_0xac3320?_0x31c838['count']:_0x228ef3[_0x33c0('0x12')]+_0x228ef3[_0x33c0('0x11')];var _0x2f2248;if(_0x5d499e>=_0x2b94ba){_0x5d499e=_0x2b94ba;_0x2f2248=0xc8;}else{_0x2f2248=0xce;}_0x1362d6['status'](_0x2f2248);return _0x1362d6[_0x33c0('0x13')]('Content-Range',_0x34d1ad+'-'+_0x5d499e+'/'+_0x2b94ba)[_0x33c0('0xf')](_0x31c838);}return null;};}function saveUpdates(_0x365483){return function(_0x33bcd0){if(_0x33bcd0){return _0x33bcd0[_0x33c0('0x14')](_0x365483)[_0x33c0('0x15')](function(_0x44a3ce){return _0x44a3ce;});}return null;};}function removeEntity(_0x8cbe6c){return function(_0x2f0962){if(_0x2f0962){return _0x2f0962[_0x33c0('0x16')]()[_0x33c0('0x15')](function(){var _0x3d15d7=_0x2f0962[_0x33c0('0x17')]({'plain':!![]});var _0x14c639='MailQueues';return db[_0x33c0('0x18')][_0x33c0('0x16')]({'where':{'type':_0x14c639,'resourceId':_0x3d15d7['id']}})[_0x33c0('0x15')](function(){return _0x2f0962;});})[_0x33c0('0x15')](function(){_0x8cbe6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x499295){return function(_0x3e170c){if(!_0x3e170c){_0x499295[_0x33c0('0xd')](0x194);}return _0x3e170c;};}function handleError(_0x4e9cc,_0x16f066){_0x16f066=_0x16f066||0x1f4;return function(_0x2b2b91){logger[_0x33c0('0x19')](_0x2b2b91['stack']);if(_0x2b2b91[_0x33c0('0x1a')]){delete _0x2b2b91['name'];}_0x4e9cc['status'](_0x16f066)[_0x33c0('0x1b')](_0x2b2b91);};}exports[_0x33c0('0x1c')]=function(_0x3699d2,_0x59754d){var _0x1269ce={};var _0x43e77c={'count':0x0,'rows':[]};var _0x475df8=_[_0x33c0('0x1d')](db['MailQueue'][_0x33c0('0x1e')],function(_0x1c65ff){return{'name':_0x1c65ff[_0x33c0('0x1f')],'type':_0x1c65ff[_0x33c0('0x20')][_0x33c0('0x21')]};});_0x1269ce=qs['getOptions'](_0x475df8,_0x3699d2);var _0x59fb11={'where':_0x1269ce['where']};return db['MailQueue']['count'](_0x59fb11)['then'](function(_0x2b8998){_0x43e77c[_0x33c0('0x22')]=_0x2b8998;_0x1269ce[_0x33c0('0x23')]=qs['include'](_0x3699d2[_0x33c0('0x24')]);return db['MailQueue'][_0x33c0('0x25')](_0x1269ce);})['then'](function(_0x2abc3d){_0x43e77c['rows']=_0x2abc3d;return _0x43e77c;})[_0x33c0('0x15')](respondWithFilteredResult(_0x59754d,_0x1269ce))[_0x33c0('0x26')](handleError(_0x59754d,null));};exports[_0x33c0('0x27')]=function(_0x282620,_0x4d86d1){var _0x55aff8={'raw':!![],'where':{'id':_0x282620[_0x33c0('0x28')]['id']}},_0x37f6a2={};_0x37f6a2[_0x33c0('0x29')]=_[_0x33c0('0x2a')](db[_0x33c0('0x2b')][_0x33c0('0x1e')]);_0x37f6a2[_0x33c0('0x24')]=_[_0x33c0('0x2a')](_0x282620[_0x33c0('0x24')]);_0x37f6a2[_0x33c0('0x2c')]=_[_0x33c0('0x2d')](_0x37f6a2['model'],_0x37f6a2[_0x33c0('0x24')]);_0x55aff8[_0x33c0('0x2e')]=_[_0x33c0('0x2d')](_0x37f6a2[_0x33c0('0x29')],qs[_0x33c0('0x2f')](_0x282620[_0x33c0('0x24')]['fields']));_0x55aff8[_0x33c0('0x2e')]=_0x55aff8[_0x33c0('0x2e')][_0x33c0('0x30')]?_0x55aff8[_0x33c0('0x2e')]:_0x37f6a2[_0x33c0('0x29')];if(_0x282620[_0x33c0('0x24')]['includeAll']){_0x55aff8[_0x33c0('0x23')]=[{'all':!![]}];}_0x55aff8=_[_0x33c0('0x31')]({},_0x55aff8,_0x282620[_0x33c0('0x32')]);return db['MailQueue']['find'](_0x55aff8)['then'](handleEntityNotFound(_0x4d86d1,null))['then'](respondWithResult(_0x4d86d1,null))[_0x33c0('0x26')](handleError(_0x4d86d1,null));};exports[_0x33c0('0x33')]=function(_0x320c08,_0x5b7f31){return db['MailQueue']['create'](_0x320c08['body'],{})[_0x33c0('0x15')](function(_0x5f540c){var _0x5a3497=_0x320c08[_0x33c0('0x34')]['get']({'plain':!![]});if(!_0x5a3497)throw new Error(_0x33c0('0x35'));if(_0x5a3497[_0x33c0('0x36')]===_0x33c0('0x34')){var _0xda4637=_0x5f540c[_0x33c0('0x17')]({'plain':!![]});var _0x46abef=_0x33c0('0x37');return db[_0x33c0('0x38')][_0x33c0('0x39')]({'where':{'name':_0x46abef,'userProfileId':_0x5a3497[_0x33c0('0x3a')]},'raw':!![]})['then'](function(_0x4fe1c6){if(_0x4fe1c6&&_0x4fe1c6[_0x33c0('0x3b')]===0x0){return db[_0x33c0('0x18')][_0x33c0('0x33')]({'name':_0xda4637['name'],'resourceId':_0xda4637['id'],'type':_0x4fe1c6['name'],'sectionId':_0x4fe1c6['id']},{})[_0x33c0('0x15')](function(){return _0x5f540c;});}else{return _0x5f540c;}})['catch'](function(_0x4c484d){logger[_0x33c0('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c484d);throw _0x4c484d;});}return _0x5f540c;})[_0x33c0('0x15')](respondWithResult(_0x5b7f31,0xc9))[_0x33c0('0x26')](handleError(_0x5b7f31,null));};exports[_0x33c0('0x14')]=function(_0x2f2c54,_0x34ed00){if(_0x2f2c54['body']['id']){delete _0x2f2c54['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0x2f2c54['params']['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x34ed00,null))[_0x33c0('0x15')](saveUpdates(_0x2f2c54[_0x33c0('0x3c')],null))['then'](respondWithResult(_0x34ed00,null))[_0x33c0('0x26')](handleError(_0x34ed00,null));};exports[_0x33c0('0x16')]=function(_0x411877,_0x1e327a){return db[_0x33c0('0x2b')][_0x33c0('0x39')]({'where':{'id':_0x411877[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x1e327a,null))['then'](removeEntity(_0x1e327a,null))[_0x33c0('0x26')](handleError(_0x1e327a,null));};exports[_0x33c0('0x3d')]=function(_0x35cf4d,_0x5c5b5c){return db[_0x33c0('0x2b')][_0x33c0('0x3d')]()[_0x33c0('0x15')](respondWithResult(_0x5c5b5c,null))['catch'](handleError(_0x5c5b5c,null));};exports[_0x33c0('0x3e')]=function(_0x4d26ba,_0x592e55){var _0x4e783f={'raw':!![],'where':{}},_0x1a67b9={},_0x225ed5;return db['MailQueue'][_0x33c0('0x3f')]({'where':{'id':_0x4d26ba['params']['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x592e55,null))[_0x33c0('0x15')](function(_0x145e76){if(_0x145e76){_0x225ed5=_0x145e76['get']({'plain':!![]});_0x1a67b9['model']=_[_0x33c0('0x2a')](db[_0x33c0('0x40')][_0x33c0('0x1e')]);_0x1a67b9[_0x33c0('0x24')]=_[_0x33c0('0x2a')](_0x4d26ba[_0x33c0('0x24')]);_0x1a67b9['filters']=_['intersection'](_0x1a67b9[_0x33c0('0x29')],_0x1a67b9[_0x33c0('0x24')]);_0x4e783f[_0x33c0('0x2e')]=_[_0x33c0('0x2d')](_0x1a67b9[_0x33c0('0x29')],qs[_0x33c0('0x2f')](_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x2f')]));_0x4e783f['attributes']=_0x4e783f['attributes'][_0x33c0('0x30')]?_0x4e783f['attributes']:_0x1a67b9[_0x33c0('0x29')];if(!_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x41')]('nolimit')){_0x4e783f['limit']=qs[_0x33c0('0x11')](_0x4d26ba['query']['limit']);_0x4e783f[_0x33c0('0x12')]=qs[_0x33c0('0x12')](_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x12')]);}_0x4e783f[_0x33c0('0x42')]=qs[_0x33c0('0x43')](_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x43')]);_0x4e783f[_0x33c0('0x44')]=qs[_0x33c0('0x2c')](_[_0x33c0('0x45')](_0x4d26ba['query'],_0x1a67b9[_0x33c0('0x2c')]));_0x4e783f[_0x33c0('0x44')][_0x33c0('0x46')]=_0x145e76['id'];if(_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x47')]){_0x4e783f['where']=_[_0x33c0('0x31')](_0x4e783f['where'],{'$or':_[_0x33c0('0x1d')](_0x4e783f[_0x33c0('0x2e')],function(_0x939360){var _0x701b91={};_0x701b91[_0x939360]={'$like':'%'+_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x47')]+'%'};return _0x701b91;})});}_0x4e783f=_[_0x33c0('0x31')]({},_0x4e783f,_0x4d26ba[_0x33c0('0x32')]);return db[_0x33c0('0x40')][_0x33c0('0x25')](_0x4e783f);}})[_0x33c0('0x15')](function(_0x9bc402){if(_0x9bc402){return db[_0x33c0('0x48')][_0x33c0('0x49')]({'where':{'id':_[_0x33c0('0x1d')](_0x9bc402,_0x33c0('0x4a')),'role':'agent'},'attributes':['id',_0x33c0('0x1a'),_0x33c0('0x4b'),_0x33c0('0x4c'),_0x33c0('0x4d')]});}})[_0x33c0('0x15')](function(_0x124fb7){if(_0x124fb7){return{'count':_0x124fb7[_0x33c0('0x22')],'rows':_[_0x33c0('0x1d')](_0x124fb7[_0x33c0('0x4e')],function(_0xad1edf){return{'membername':_0xad1edf[_0x33c0('0x1a')],'UserId':_0xad1edf['id'],'queue_name':_0x225ed5[_0x33c0('0x1a')],'MailQueueId':_0x225ed5['id'],'interface':util[_0x33c0('0x4f')]('%s/%s',_0x33c0('0x50'),_0xad1edf[_0x33c0('0x1a')]),'penalty':0x0,'paused':_0xad1edf['mailPause'],'createdAt':_0xad1edf[_0x33c0('0x4d')],'updatedAt':_0xad1edf[_0x33c0('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x33c0('0x15')](respondWithFilteredResult(_0x592e55,_0x4e783f))['catch'](handleError(_0x592e55,null));};exports['getTeams']=function(_0x45d190,_0x319f09){var _0x5e6a3f={};var _0xe3ad90={};var _0x2c4294;var _0x155cc6;return db['MailQueue'][_0x33c0('0x3f')]({'where':{'id':_0x45d190[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x319f09,null))[_0x33c0('0x15')](function(_0x9734bd){if(_0x9734bd){_0x2c4294=_0x9734bd;_0xe3ad90[_0x33c0('0x29')]=_[_0x33c0('0x2a')](db[_0x33c0('0x51')][_0x33c0('0x1e')]);_0xe3ad90['query']=_[_0x33c0('0x2a')](_0x45d190[_0x33c0('0x24')]);_0xe3ad90['filters']=_[_0x33c0('0x2d')](_0xe3ad90[_0x33c0('0x29')],_0xe3ad90[_0x33c0('0x24')]);_0x5e6a3f['attributes']=_[_0x33c0('0x2d')](_0xe3ad90[_0x33c0('0x29')],qs[_0x33c0('0x2f')](_0x45d190[_0x33c0('0x24')][_0x33c0('0x2f')]));_0x5e6a3f[_0x33c0('0x2e')]=_0x5e6a3f[_0x33c0('0x2e')]['length']?_0x5e6a3f[_0x33c0('0x2e')]:_0xe3ad90[_0x33c0('0x29')];_0x5e6a3f[_0x33c0('0x42')]=qs[_0x33c0('0x43')](_0x45d190['query']['sort']);_0x5e6a3f['where']=qs[_0x33c0('0x2c')](_[_0x33c0('0x45')](_0x45d190[_0x33c0('0x24')],_0xe3ad90[_0x33c0('0x2c')]));if(_0x45d190['query'][_0x33c0('0x47')]){_0x5e6a3f[_0x33c0('0x44')]=_[_0x33c0('0x31')](_0x5e6a3f['where'],{'$or':_['map'](_0x5e6a3f[_0x33c0('0x2e')],function(_0x166f66){var _0x422fbe={};_0x422fbe[_0x166f66]={'$like':'%'+_0x45d190['query'][_0x33c0('0x47')]+'%'};return _0x422fbe;})});}_0x5e6a3f=_[_0x33c0('0x31')]({},_0x5e6a3f,_0x45d190[_0x33c0('0x32')]);return _0x2c4294[_0x33c0('0x52')](_0x5e6a3f);}})[_0x33c0('0x15')](function(_0x4d3cfc){if(_0x4d3cfc){_0x155cc6=_0x4d3cfc['length'];if(!_0x45d190[_0x33c0('0x24')][_0x33c0('0x41')](_0x33c0('0x53'))){_0x5e6a3f[_0x33c0('0x11')]=qs[_0x33c0('0x11')](_0x45d190[_0x33c0('0x24')][_0x33c0('0x11')]);_0x5e6a3f[_0x33c0('0x12')]=qs['offset'](_0x45d190[_0x33c0('0x24')][_0x33c0('0x12')]);}return _0x2c4294['getTeams'](_0x5e6a3f);}})[_0x33c0('0x15')](function(_0x105a3b){if(_0x105a3b){return _0x105a3b?{'count':_0x155cc6,'rows':_0x105a3b}:null;}})[_0x33c0('0x15')](respondWithResult(_0x319f09,null))[_0x33c0('0x26')](handleError(_0x319f09,null));};exports[_0x33c0('0x54')]=function(_0x2128db,_0x4a4c67){var _0x944b79=_0x2128db[_0x33c0('0x3c')]['ids'];return db['Team']['findAll']({'where':{'id':_0x944b79},'attributes':['id'],'include':[{'model':db[_0x33c0('0x48')],'as':_0x33c0('0x55'),'attributes':['id','name',_0x33c0('0x56'),_0x33c0('0x57'),_0x33c0('0x58')],'raw':!![]}]})[_0x33c0('0x15')](function(_0x56f43d){if(_0x56f43d){var _0x33988f=_[_0x33c0('0x59')](_0x56f43d,function(_0x59e3cf){var _0x26c715=_0x59e3cf[_0x33c0('0x17')]({'plain':!![]});return _0x26c715[_0x33c0('0x55')];});return db[_0x33c0('0x2b')]['find']({'where':{'id':_0x2128db[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](function(_0x154d6b){return db['sequelize']['transaction'](function(_0x4ad841){return _0x154d6b['addTeams'](_0x944b79,{'transaction':_0x4ad841})[_0x33c0('0x15')](function(){return BPromise[_0x33c0('0x5a')](_0x33988f,function(_0x393f7b){return db[_0x33c0('0x40')][_0x33c0('0x5b')]({'where':{'UserId':_0x393f7b['id'],'MailQueueId':_0x2128db[_0x33c0('0x28')]['id']},'transaction':_0x4ad841});});})[_0x33c0('0x15')](function(){_0x33988f[_0x33c0('0x5c')](function(_0x409b5c){socket[_0x33c0('0x5d')](_0x33c0('0x5e'),{'UserId':_0x409b5c['id'],'MailQueueId':_0x154d6b['id']});});});});});}})['then'](respondWithStatusCode(_0x4a4c67,null))[_0x33c0('0x26')](handleError(_0x4a4c67,null));};exports[_0x33c0('0x5f')]=function(_0x1a53b9,_0x505e9b){return db['Team'][_0x33c0('0x25')]({'where':{'id':_0x1a53b9[_0x33c0('0x24')][_0x33c0('0x60')]},'attributes':['id'],'include':[{'model':db[_0x33c0('0x48')],'as':_0x33c0('0x55'),'attributes':['id'],'raw':!![]}]})[_0x33c0('0x15')](handleEntityNotFound(_0x505e9b,null))[_0x33c0('0x15')](function(_0x4901d9){var _0x2b98e3=_[_0x33c0('0x1d')](_0x4901d9,'id');var _0x46ec59=[];var _0x262b26=[];var _0x5746f4=squel[_0x33c0('0x61')]();_0x5746f4['field'](_0x33c0('0x62'))['from']('team_has_mail_queues','tq')[_0x33c0('0x63')](_0x33c0('0x64'),'ut',_0x33c0('0x65'))[_0x33c0('0x44')](_0x33c0('0x66'),_0x1a53b9[_0x33c0('0x28')]['id']);for(var _0x55b363=0x0;_0x55b363<_0x4901d9['length'];_0x55b363+=0x1){let _0x4604db=_0x4901d9[_0x55b363];for(var _0xd6e114=0x0;_0xd6e114<_0x4604db[_0x33c0('0x55')][_0x33c0('0x30')];_0xd6e114+=0x1){let _0x238e80=_0x4604db['Agents'][_0xd6e114];var _0x1d767e=_0x5746f4[_0x33c0('0x67')]();_0x1d767e[_0x33c0('0x44')](_0x33c0('0x68'),_0x238e80['id']);_0x262b26[_0x33c0('0x69')](db[_0x33c0('0x6a')]['query'](_0x1d767e['toString'](),{'type':db['sequelize'][_0x33c0('0x6b')]['SELECT']})[_0x33c0('0x15')](function(_0x5c16b8){if(_0x5c16b8[_0x33c0('0x30')]===0x1){return _0x238e80['id'];}else{var _0x3f6ee3=_['every'](_[_0x33c0('0x1d')](_0x5c16b8,'TeamId'),function(_0x5abc8d){return _[_0x33c0('0x6c')](_0x2b98e3,_0x5abc8d);});if(_0x3f6ee3){return _0x238e80['id'];}}}));}}return BPromise[_0x33c0('0x6d')](_0x262b26)[_0x33c0('0x15')](function(_0x2d0fc1){_0x46ec59=_(_0x46ec59)[_0x33c0('0x6e')](_0x2d0fc1)[_0x33c0('0x6f')]()[_0x33c0('0x70')]();return db['MailQueue'][_0x33c0('0x39')]({'where':{'id':_0x1a53b9['params']['id']}})['then'](function(_0x5477b0){return db[_0x33c0('0x6a')][_0x33c0('0x71')](function(_0x355f6d){return _0x5477b0[_0x33c0('0x5f')](_0x1a53b9[_0x33c0('0x24')]['ids'],{'transaction':_0x355f6d})[_0x33c0('0x15')](function(){if(!_[_0x33c0('0x72')](_0x46ec59)){return _0x5477b0['removeAgents'](_0x46ec59,{'transaction':_0x355f6d});}})['then'](function(){_0x46ec59[_0x33c0('0x5c')](function(_0x59e4fd){socket['emit'](_0x33c0('0x73'),{'UserId':_0x59e4fd,'MailQueueId':_0x5477b0['id']});});});});});});})[_0x33c0('0x15')](respondWithStatusCode(_0x505e9b,null))[_0x33c0('0x26')](handleError(_0x505e9b,null));};exports['addAgents']=function(_0x41e604,_0x3459e2){return db[_0x33c0('0x2b')][_0x33c0('0x39')]({'where':{'id':_0x41e604[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x3459e2,null))[_0x33c0('0x15')](function(_0x2bd186){if(_0x2bd186){return _0x2bd186[_0x33c0('0x74')](_0x41e604['body'][_0x33c0('0x60')],_[_0x33c0('0x75')](_0x41e604[_0x33c0('0x3c')],[_0x33c0('0x60'),'id'])||{})['spread'](function(_0x4e629e){for(var _0x126bbe=0x0;_0x126bbe<_0x41e604[_0x33c0('0x3c')]['ids'][_0x33c0('0x30')];_0x126bbe+=0x1){socket[_0x33c0('0x5d')](_0x33c0('0x5e'),{'UserId':Number(_0x41e604[_0x33c0('0x3c')][_0x33c0('0x60')][_0x126bbe]),'MailQueueId':Number(_0x41e604['params']['id'])});}return _0x4e629e;});}})[_0x33c0('0x15')](respondWithResult(_0x3459e2,null))[_0x33c0('0x26')](handleError(_0x3459e2,null));};exports[_0x33c0('0x76')]=function(_0x2ebe90,_0x7a0786){return db[_0x33c0('0x2b')][_0x33c0('0x39')]({'where':{'id':_0x2ebe90['params']['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x7a0786,null))[_0x33c0('0x15')](function(_0x14184c){if(_0x14184c){return _0x14184c['removeAgents'](_0x2ebe90['query']['ids'])[_0x33c0('0x15')](function(){if(_[_0x33c0('0x77')](_0x2ebe90[_0x33c0('0x24')][_0x33c0('0x60')])){for(var _0x17e736=0x0;_0x17e736<_0x2ebe90[_0x33c0('0x24')][_0x33c0('0x60')][_0x33c0('0x30')];_0x17e736+=0x1){socket[_0x33c0('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x2ebe90['query'][_0x33c0('0x60')][_0x17e736]),'MailQueueId':Number(_0x2ebe90[_0x33c0('0x28')]['id'])});}}else{socket['emit'](_0x33c0('0x73'),{'UserId':Number(_0x2ebe90[_0x33c0('0x24')][_0x33c0('0x60')]),'MailQueueId':Number(_0x2ebe90[_0x33c0('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x7a0786,null))[_0x33c0('0x26')](handleError(_0x7a0786,null));};exports['getAgents']=function(_0x339066,_0x344e04){var _0x1fb8e7={};var _0x483a6f={};var _0x2d93be;var _0x4a55e4;return db['MailQueue'][_0x33c0('0x3f')]({'where':{'id':_0x339066[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x344e04,null))[_0x33c0('0x15')](function(_0x3a2b72){if(_0x3a2b72){_0x2d93be=_0x3a2b72;_0x483a6f['model']=_[_0x33c0('0x2a')](db[_0x33c0('0x48')][_0x33c0('0x1e')]);_0x483a6f[_0x33c0('0x24')]=_[_0x33c0('0x2a')](_0x339066[_0x33c0('0x24')]);_0x483a6f[_0x33c0('0x2c')]=_[_0x33c0('0x2d')](_0x483a6f[_0x33c0('0x29')],_0x483a6f[_0x33c0('0x24')]);_0x1fb8e7[_0x33c0('0x2e')]=_[_0x33c0('0x2d')](_0x483a6f[_0x33c0('0x29')],qs[_0x33c0('0x2f')](_0x339066['query'][_0x33c0('0x2f')]));_0x1fb8e7['attributes']=_0x1fb8e7[_0x33c0('0x2e')]['length']?_0x1fb8e7['attributes']:_0x483a6f[_0x33c0('0x29')];_0x1fb8e7[_0x33c0('0x42')]=qs['sort'](_0x339066[_0x33c0('0x24')][_0x33c0('0x43')]);_0x1fb8e7[_0x33c0('0x44')]=qs[_0x33c0('0x2c')](_['pick'](_0x339066['query'],_0x483a6f[_0x33c0('0x2c')]));if(_0x339066[_0x33c0('0x24')]['filter']){_0x1fb8e7[_0x33c0('0x44')]=_[_0x33c0('0x31')](_0x1fb8e7['where'],{'$or':_['map'](_0x1fb8e7[_0x33c0('0x2e')],function(_0x419ba8){var _0x4fedcb={};_0x4fedcb[_0x419ba8]={'$like':'%'+_0x339066['query']['filter']+'%'};return _0x4fedcb;})});}_0x1fb8e7=_[_0x33c0('0x31')]({},_0x1fb8e7,_0x339066[_0x33c0('0x32')]);return _0x2d93be['getAgents'](_0x1fb8e7);}})[_0x33c0('0x15')](function(_0x153168){if(_0x153168){_0x4a55e4=_0x153168[_0x33c0('0x30')];if(!_0x339066[_0x33c0('0x24')]['hasOwnProperty'](_0x33c0('0x53'))){_0x1fb8e7[_0x33c0('0x11')]=qs[_0x33c0('0x11')](_0x339066['query'][_0x33c0('0x11')]);_0x1fb8e7['offset']=qs['offset'](_0x339066[_0x33c0('0x24')][_0x33c0('0x12')]);}return _0x2d93be['getAgents'](_0x1fb8e7);}})[_0x33c0('0x15')](function(_0x387ad2){if(_0x387ad2){return _0x387ad2?{'count':_0x4a55e4,'rows':_0x387ad2}:null;}})[_0x33c0('0x15')](respondWithResult(_0x344e04,null))['catch'](handleError(_0x344e04,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 41a6cea..38a6632 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 _0xf616=['remove','emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x136c6f,_0xc147b0){var _0x2ec4b1=function(_0x1b5024){while(--_0x1b5024){_0x136c6f['push'](_0x136c6f['shift']());}};_0x2ec4b1(++_0xc147b0);}(_0xf616,0xd6));var _0x6f61=function(_0xdd90ef,_0x361c65){_0xdd90ef=_0xdd90ef-0x0;var _0x2f4143=_0xf616[_0xdd90ef];return _0x2f4143;};'use strict';var EventEmitter=require(_0x6f61('0x0'));var MailQueue=require(_0x6f61('0x1'))['db'][_0x6f61('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6f61('0x3')](0x0);var events={'afterCreate':_0x6f61('0x4'),'afterUpdate':_0x6f61('0x5'),'afterDestroy':_0x6f61('0x6')};function emitEvent(_0x784bd8){return function(_0x58b799,_0x231d7a,_0x1f0fe8){MailQueueEvents[_0x6f61('0x7')](_0x784bd8+':'+_0x58b799['id'],_0x58b799);MailQueueEvents['emit'](_0x784bd8,_0x58b799);_0x1f0fe8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x6f61('0x8')](e,emitEvent(event));}}module[_0x6f61('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x0097=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x50b3fa,_0x322c75){var _0x3318fe=function(_0x316bd5){while(--_0x316bd5){_0x50b3fa['push'](_0x50b3fa['shift']());}};_0x3318fe(++_0x322c75);}(_0x0097,0x1e7));var _0x7009=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0097[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7009('0x0'));var MailQueue=require(_0x7009('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7009('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7009('0x3'),'afterDestroy':_0x7009('0x4')};function emitEvent(_0xdcdeb4){return function(_0x2bf1af,_0x1ee7e8,_0x41e047){MailQueueEvents['emit'](_0xdcdeb4+':'+_0x2bf1af['id'],_0x2bf1af);MailQueueEvents[_0x7009('0x5')](_0xdcdeb4,_0x2bf1af);_0x41e047(null);};}for(var e in events){if(events[_0x7009('0x6')](e)){var event=events[e];MailQueue[_0x7009('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d1ddd1b..2fe5b39 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 _0x6fd2=['exports','define','MailQueue','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0xfd5a9c,_0x1b081e){var _0x2b88b9=function(_0x450f61){while(--_0x450f61){_0xfd5a9c['push'](_0xfd5a9c['shift']());}};_0x2b88b9(++_0x1b081e);}(_0x6fd2,0x66));var _0x26fd=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x6fd2[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x26fd('0x0'));var util=require('util');var logger=require(_0x26fd('0x1'))(_0x26fd('0x2'));var moment=require('moment');var BPromise=require(_0x26fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26fd('0x4'));var rimraf=require(_0x26fd('0x5'));var config=require(_0x26fd('0x6'));var attributes=require(_0x26fd('0x7'));module[_0x26fd('0x8')]=function(_0x1dad71,_0x48822f){return _0x1dad71[_0x26fd('0x9')](_0x26fd('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe982=['lodash','util','../../config/logger','api','moment','request-promise','path','./mailQueue.attributes','exports','mail_queues'];(function(_0x32ee51,_0x26d577){var _0x57d860=function(_0x55b534){while(--_0x55b534){_0x32ee51['push'](_0x32ee51['shift']());}};_0x57d860(++_0x26d577);}(_0xe982,0xb4));var _0x2e98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe982[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x2e98('0x0'));var util=require(_0x2e98('0x1'));var logger=require(_0x2e98('0x2'))(_0x2e98('0x3'));var moment=require(_0x2e98('0x4'));var BPromise=require('bluebird');var rp=require(_0x2e98('0x5'));var fs=require('fs');var path=require(_0x2e98('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e98('0x7'));module[_0x2e98('0x8')]=function(_0x22b335,_0x28f9d1){return _0x22b335['define']('MailQueue',attributes,{'tableName':_0x2e98('0x9'),'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 113a53f..0ad75e9 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 _0x9f29=['ShowMailQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','attributes','limit','include','map','model','then'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x9f29,0x1b1));var _0x99f2=function(_0x1f4eca,_0x204969){_0x1f4eca=_0x1f4eca-0x0;var _0x25c7d1=_0x9f29[_0x1f4eca];return _0x25c7d1;};'use strict';var _=require(_0x99f2('0x0'));var util=require('util');var moment=require(_0x99f2('0x1'));var BPromise=require(_0x99f2('0x2'));var rs=require(_0x99f2('0x3'));var fs=require('fs');var Redis=require(_0x99f2('0x4'));var db=require(_0x99f2('0x5'))['db'];var utils=require(_0x99f2('0x6'));var logger=require(_0x99f2('0x7'))(_0x99f2('0x8'));var config=require(_0x99f2('0x9'));var jayson=require(_0x99f2('0xa'));var client=jayson[_0x99f2('0xb')][_0x99f2('0xc')]({'port':0x232a});config[_0x99f2('0xd')]=_[_0x99f2('0xe')](config['redis'],{'host':_0x99f2('0xf'),'port':0x18eb});var socket=require(_0x99f2('0x10'))(new Redis(config[_0x99f2('0xd')]));require(_0x99f2('0x11'))[_0x99f2('0x12')](socket);function respondWithRpcPromise(_0xf1ae9e,_0x482bb7,_0x2d4d29){return new BPromise(function(_0x43f8bf,_0x26c244){return client[_0x99f2('0x13')](_0xf1ae9e,_0x2d4d29)['then'](function(_0x3a9d49){logger[_0x99f2('0x14')](_0x99f2('0x15'),_0x482bb7,'request\x20sent');logger[_0x99f2('0x16')](_0x99f2('0x17'),_0x482bb7,_0x99f2('0x18'),JSON[_0x99f2('0x19')](_0x3a9d49));if(_0x3a9d49[_0x99f2('0x1a')]){if(_0x3a9d49[_0x99f2('0x1a')][_0x99f2('0x1b')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x482bb7,_0x3a9d49[_0x99f2('0x1a')][_0x99f2('0x1c')]);return _0x26c244(_0x3a9d49[_0x99f2('0x1a')][_0x99f2('0x1c')]);}logger[_0x99f2('0x1a')](_0x99f2('0x15'),_0x482bb7,_0x3a9d49[_0x99f2('0x1a')][_0x99f2('0x1c')]);return _0x43f8bf(_0x3a9d49['error'][_0x99f2('0x1c')]);}else{logger[_0x99f2('0x14')](_0x99f2('0x15'),_0x482bb7,_0x99f2('0x18'));_0x43f8bf(_0x3a9d49[_0x99f2('0x1d')]['message']);}})[_0x99f2('0x1e')](function(_0x513612){logger[_0x99f2('0x1a')]('MailQueue,\x20%s,\x20%s',_0x482bb7,_0x513612);_0x26c244(_0x513612);});});}exports[_0x99f2('0x1f')]=function(_0x720d65){var _0x222d55=this;return new Promise(function(_0x2fced3,_0x3103c1){return db[_0x99f2('0x20')]['findAll']({'raw':_0x720d65[_0x99f2('0x21')]?_0x720d65[_0x99f2('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x720d65[_0x99f2('0x21')]?_0x720d65[_0x99f2('0x21')]['where']||null:null,'attributes':_0x720d65[_0x99f2('0x21')]?_0x720d65[_0x99f2('0x21')][_0x99f2('0x22')]||null:null,'limit':_0x720d65[_0x99f2('0x21')]?_0x720d65[_0x99f2('0x21')][_0x99f2('0x23')]||null:null,'include':_0x720d65['options']?_0x720d65[_0x99f2('0x21')][_0x99f2('0x24')]?_[_0x99f2('0x25')](_0x720d65[_0x99f2('0x21')][_0x99f2('0x24')],function(_0x44afe0){return{'model':db[_0x44afe0[_0x99f2('0x26')]],'as':_0x44afe0['as'],'attributes':_0x44afe0[_0x99f2('0x22')],'include':_0x44afe0[_0x99f2('0x24')]?_[_0x99f2('0x25')](_0x44afe0[_0x99f2('0x24')],function(_0x325362){return{'model':db[_0x325362[_0x99f2('0x26')]],'as':_0x325362['as'],'attributes':_0x325362['attributes'],'include':_0x325362[_0x99f2('0x24')]?_[_0x99f2('0x25')](_0x325362['include'],function(_0x1021b5){return{'model':db[_0x1021b5[_0x99f2('0x26')]],'as':_0x1021b5['as'],'attributes':_0x1021b5[_0x99f2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x99f2('0x27')](function(_0x434eea){logger[_0x99f2('0x14')]('GetMailQueue',_0x720d65);logger[_0x99f2('0x16')]('GetMailQueue',_0x720d65,JSON['stringify'](_0x434eea));_0x2fced3(_0x434eea);})[_0x99f2('0x1e')](function(_0x303349){logger[_0x99f2('0x1a')](_0x99f2('0x1f'),_0x303349[_0x99f2('0x1c')],_0x720d65);_0x3103c1(_0x222d55[_0x99f2('0x1a')](0x1f4,_0x303349[_0x99f2('0x1c')]));});});};exports[_0x99f2('0x28')]=function(_0x2d6c2e){var _0x1b673a=this;return new Promise(function(_0x176d2c,_0x32790b){return db['MailQueue'][_0x99f2('0x29')]({'raw':_0x2d6c2e[_0x99f2('0x21')]?_0x2d6c2e[_0x99f2('0x21')][_0x99f2('0x2a')]===undefined?!![]:![]:!![],'where':_0x2d6c2e[_0x99f2('0x21')]?_0x2d6c2e['options']['where']||null:null,'attributes':_0x2d6c2e[_0x99f2('0x21')]?_0x2d6c2e[_0x99f2('0x21')][_0x99f2('0x22')]||null:null,'include':_0x2d6c2e[_0x99f2('0x21')]?_0x2d6c2e[_0x99f2('0x21')][_0x99f2('0x24')]?_['map'](_0x2d6c2e[_0x99f2('0x21')]['include'],function(_0x36b4c2){return{'model':db[_0x36b4c2[_0x99f2('0x26')]],'as':_0x36b4c2['as'],'attributes':_0x36b4c2['attributes'],'include':_0x36b4c2[_0x99f2('0x24')]?_['map'](_0x36b4c2[_0x99f2('0x24')],function(_0x1d3faf){return{'model':db[_0x1d3faf['model']],'as':_0x1d3faf['as'],'attributes':_0x1d3faf[_0x99f2('0x22')],'include':_0x1d3faf[_0x99f2('0x24')]?_[_0x99f2('0x25')](_0x1d3faf[_0x99f2('0x24')],function(_0x1b3e98){return{'model':db[_0x1b3e98[_0x99f2('0x26')]],'as':_0x1b3e98['as'],'attributes':_0x1b3e98[_0x99f2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x99f2('0x27')](function(_0x4cde5c){logger[_0x99f2('0x14')](_0x99f2('0x28'),_0x2d6c2e);logger[_0x99f2('0x16')](_0x99f2('0x28'),_0x2d6c2e,JSON[_0x99f2('0x19')](_0x4cde5c));_0x176d2c(_0x4cde5c);})[_0x99f2('0x1e')](function(_0x11ffc9){logger[_0x99f2('0x1a')](_0x99f2('0x28'),_0x11ffc9[_0x99f2('0x1c')],_0x2d6c2e);_0x32790b(_0x1b673a[_0x99f2('0x1a')](0x1f4,_0x11ffc9[_0x99f2('0x1c')]));});});}; \ No newline at end of file +var _0x04f1=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','map','include','model','attributes','debug','stringify','ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x04f1,0xc1));var _0x104f=function(_0x1ae0ea,_0x5c0919){_0x1ae0ea=_0x1ae0ea-0x0;var _0x404277=_0x04f1[_0x1ae0ea];return _0x404277;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var moment=require(_0x104f('0x2'));var BPromise=require(_0x104f('0x3'));var rs=require(_0x104f('0x4'));var fs=require('fs');var Redis=require(_0x104f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x104f('0x6'));var logger=require(_0x104f('0x7'))(_0x104f('0x8'));var config=require(_0x104f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x104f('0xa')]['http']({'port':0x232a});config[_0x104f('0xb')]=_[_0x104f('0xc')](config[_0x104f('0xb')],{'host':_0x104f('0xd'),'port':0x18eb});var socket=require(_0x104f('0xe'))(new Redis(config[_0x104f('0xb')]));require(_0x104f('0xf'))['register'](socket);function respondWithRpcPromise(_0x4e4872,_0xfc1f05,_0x1b3d82){return new BPromise(function(_0x536288,_0x41244b){return client[_0x104f('0x10')](_0x4e4872,_0x1b3d82)[_0x104f('0x11')](function(_0x478b56){logger[_0x104f('0x12')](_0x104f('0x13'),_0xfc1f05,_0x104f('0x14'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0xfc1f05,_0x104f('0x14'),JSON['stringify'](_0x478b56));if(_0x478b56['error']){if(_0x478b56[_0x104f('0x15')][_0x104f('0x16')]===0x1f4){logger[_0x104f('0x15')]('MailQueue,\x20%s,\x20%s',_0xfc1f05,_0x478b56[_0x104f('0x15')][_0x104f('0x17')]);return _0x41244b(_0x478b56[_0x104f('0x15')][_0x104f('0x17')]);}logger['error'](_0x104f('0x13'),_0xfc1f05,_0x478b56[_0x104f('0x15')][_0x104f('0x17')]);return _0x536288(_0x478b56[_0x104f('0x15')][_0x104f('0x17')]);}else{logger[_0x104f('0x12')](_0x104f('0x13'),_0xfc1f05,_0x104f('0x14'));_0x536288(_0x478b56['result']['message']);}})[_0x104f('0x18')](function(_0x5e69bc){logger[_0x104f('0x15')]('MailQueue,\x20%s,\x20%s',_0xfc1f05,_0x5e69bc);_0x41244b(_0x5e69bc);});});}exports[_0x104f('0x19')]=function(_0x1a012c){var _0x1bca00=this;return new Promise(function(_0x2e776c,_0x2a29fb){return db[_0x104f('0x1a')][_0x104f('0x1b')]({'raw':_0x1a012c['options']?_0x1a012c[_0x104f('0x1c')][_0x104f('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a012c[_0x104f('0x1c')]?_0x1a012c['options']['where']||null:null,'attributes':_0x1a012c[_0x104f('0x1c')]?_0x1a012c['options']['attributes']||null:null,'limit':_0x1a012c[_0x104f('0x1c')]?_0x1a012c[_0x104f('0x1c')][_0x104f('0x1e')]||null:null,'include':_0x1a012c[_0x104f('0x1c')]?_0x1a012c[_0x104f('0x1c')]['include']?_[_0x104f('0x1f')](_0x1a012c[_0x104f('0x1c')][_0x104f('0x20')],function(_0x445877){return{'model':db[_0x445877[_0x104f('0x21')]],'as':_0x445877['as'],'attributes':_0x445877['attributes'],'include':_0x445877['include']?_[_0x104f('0x1f')](_0x445877[_0x104f('0x20')],function(_0x4fd984){return{'model':db[_0x4fd984[_0x104f('0x21')]],'as':_0x4fd984['as'],'attributes':_0x4fd984[_0x104f('0x22')],'include':_0x4fd984[_0x104f('0x20')]?_[_0x104f('0x1f')](_0x4fd984['include'],function(_0x1f91dd){return{'model':db[_0x1f91dd[_0x104f('0x21')]],'as':_0x1f91dd['as'],'attributes':_0x1f91dd[_0x104f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x104f('0x11')](function(_0xf6b117){logger[_0x104f('0x12')](_0x104f('0x19'),_0x1a012c);logger[_0x104f('0x23')](_0x104f('0x19'),_0x1a012c,JSON[_0x104f('0x24')](_0xf6b117));_0x2e776c(_0xf6b117);})[_0x104f('0x18')](function(_0x179a51){logger[_0x104f('0x15')]('GetMailQueue',_0x179a51['message'],_0x1a012c);_0x2a29fb(_0x1bca00[_0x104f('0x15')](0x1f4,_0x179a51[_0x104f('0x17')]));});});};exports[_0x104f('0x25')]=function(_0x319bf0){var _0x1c97d7=this;return new Promise(function(_0x4108b0,_0x330476){return db[_0x104f('0x1a')][_0x104f('0x26')]({'raw':_0x319bf0['options']?_0x319bf0[_0x104f('0x1c')][_0x104f('0x1d')]===undefined?!![]:![]:!![],'where':_0x319bf0[_0x104f('0x1c')]?_0x319bf0[_0x104f('0x1c')][_0x104f('0x27')]||null:null,'attributes':_0x319bf0[_0x104f('0x1c')]?_0x319bf0[_0x104f('0x1c')][_0x104f('0x22')]||null:null,'include':_0x319bf0['options']?_0x319bf0[_0x104f('0x1c')][_0x104f('0x20')]?_['map'](_0x319bf0[_0x104f('0x1c')]['include'],function(_0xa177ac){return{'model':db[_0xa177ac['model']],'as':_0xa177ac['as'],'attributes':_0xa177ac['attributes'],'include':_0xa177ac['include']?_['map'](_0xa177ac['include'],function(_0x14e65d){return{'model':db[_0x14e65d[_0x104f('0x21')]],'as':_0x14e65d['as'],'attributes':_0x14e65d['attributes'],'include':_0x14e65d[_0x104f('0x20')]?_[_0x104f('0x1f')](_0x14e65d[_0x104f('0x20')],function(_0x88c569){return{'model':db[_0x88c569['model']],'as':_0x88c569['as'],'attributes':_0x88c569['attributes']};}):[]};}):[]};}):[]:[]})[_0x104f('0x11')](function(_0x205a15){logger[_0x104f('0x12')]('ShowMailQueue',_0x319bf0);logger[_0x104f('0x23')](_0x104f('0x25'),_0x319bf0,JSON[_0x104f('0x24')](_0x205a15));_0x4108b0(_0x205a15);})[_0x104f('0x18')](function(_0x43252b){logger['error'](_0x104f('0x25'),_0x43252b[_0x104f('0x17')],_0x319bf0);_0x330476(_0x1c97d7['error'](0x1f4,_0x43252b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index aab5f7f..582d658 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 _0xf17b=['./mailQueue.events','update','emit','register','length','mailQueue:'];(function(_0x5e5e86,_0x3b74a5){var _0x3eae90=function(_0x119f84){while(--_0x119f84){_0x5e5e86['push'](_0x5e5e86['shift']());}};_0x3eae90(++_0x3b74a5);}(_0xf17b,0x13e));var _0xbf17=function(_0xd365a8,_0x36b21b){_0xd365a8=_0xd365a8-0x0;var _0x57234a=_0xf17b[_0xd365a8];return _0x57234a;};'use strict';var MailQueueEvents=require(_0xbf17('0x0'));var events=['save','remove',_0xbf17('0x1')];function createListener(_0x3d6aa4,_0x4955d5){return function(_0x4726cf){_0x4955d5[_0xbf17('0x2')](_0x3d6aa4,_0x4726cf);};}function removeListener(_0x3fe926,_0x52e318){return function(){MailQueueEvents['removeListener'](_0x3fe926,_0x52e318);};}exports[_0xbf17('0x3')]=function(_0x2dccf5){for(var _0x280b6d=0x0,_0x26b75c=events[_0xbf17('0x4')];_0x280b6d<_0x26b75c;_0x280b6d++){var _0x3e484a=events[_0x280b6d];var _0x59ac90=createListener(_0xbf17('0x5')+_0x3e484a,_0x2dccf5);MailQueueEvents['on'](_0x3e484a,_0x59ac90);}}; \ No newline at end of file +var _0xb01c=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','remove'];(function(_0x3b08b9,_0x3da8ae){var _0x4e4221=function(_0x4dfa91){while(--_0x4dfa91){_0x3b08b9['push'](_0x3b08b9['shift']());}};_0x4e4221(++_0x3da8ae);}(_0xb01c,0xbe));var _0xcb01=function(_0x542042,_0x532c69){_0x542042=_0x542042-0x0;var _0x15b140=_0xb01c[_0x542042];return _0x15b140;};'use strict';var MailQueueEvents=require(_0xcb01('0x0'));var events=['save',_0xcb01('0x1'),_0xcb01('0x2')];function createListener(_0x304172,_0xd9bf38){return function(_0x2cd85b){_0xd9bf38[_0xcb01('0x3')](_0x304172,_0x2cd85b);};}function removeListener(_0x106c60,_0x47dee2){return function(){MailQueueEvents[_0xcb01('0x4')](_0x106c60,_0x47dee2);};}exports[_0xcb01('0x5')]=function(_0x16b993){for(var _0x1b8ca8=0x0,_0x357bf9=events[_0xcb01('0x6')];_0x1b8ca8<_0x357bf9;_0x1b8ca8++){var _0x370bf7=events[_0x1b8ca8];var _0x57f028=createListener(_0xcb01('0x7')+_0x370bf7,_0x16b993);MailQueueEvents['on'](_0x370bf7,_0x57f028);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0029879..b06e687 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 _0x5c30=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x4bf373,_0x28e2da){var _0x5c8717=function(_0x5e2634){while(--_0x5e2634){_0x4bf373['push'](_0x4bf373['shift']());}};_0x5c8717(++_0x28e2da);}(_0x5c30,0x93));var _0x05c3=function(_0x2899bf,_0xcb834b){_0x2899bf=_0x2899bf-0x0;var _0x4dbade=_0x5c30[_0x2899bf];return _0x4dbade;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x05c3('0x0'));var timeout=require(_0x05c3('0x1'));var express=require(_0x05c3('0x2'));var router=express[_0x05c3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x05c3('0x4'));var interaction=require(_0x05c3('0x5'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x05c3('0x6')]);router[_0x05c3('0x7')]('/describe',auth[_0x05c3('0x8')](),controller[_0x05c3('0x9')]);router['get'](_0x05c3('0xa'),auth['isAuthenticated'](),controller[_0x05c3('0xb')]);router[_0x05c3('0xc')]('/',auth[_0x05c3('0x8')](),controller['create']);router[_0x05c3('0xd')](_0x05c3('0xa'),auth[_0x05c3('0x8')](),controller[_0x05c3('0xe')]);router[_0x05c3('0xf')](_0x05c3('0xa'),auth['isAuthenticated'](),controller[_0x05c3('0x10')]);module[_0x05c3('0x11')]=router; \ No newline at end of file +var _0x8aea=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x8aea,0x121));var _0xa8ae=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8aea[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xa8ae('0x0'));var util=require('util');var path=require(_0xa8ae('0x1'));var timeout=require(_0xa8ae('0x2'));var express=require(_0xa8ae('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa8ae('0x4'));var controller=require('./mailQueueReport.controller');router[_0xa8ae('0x5')]('/',auth[_0xa8ae('0x6')](),controller[_0xa8ae('0x7')]);router[_0xa8ae('0x5')](_0xa8ae('0x8'),auth[_0xa8ae('0x6')](),controller[_0xa8ae('0x9')]);router[_0xa8ae('0x5')](_0xa8ae('0xa'),auth[_0xa8ae('0x6')](),controller[_0xa8ae('0xb')]);router[_0xa8ae('0xc')]('/',auth['isAuthenticated'](),controller[_0xa8ae('0xd')]);router[_0xa8ae('0xe')](_0xa8ae('0xa'),auth[_0xa8ae('0x6')](),controller[_0xa8ae('0xf')]);router[_0xa8ae('0x10')](_0xa8ae('0xa'),auth['isAuthenticated'](),controller[_0xa8ae('0x11')]);module[_0xa8ae('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index d854118..30d7cde 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 _0x0b7a=['DATE','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b7a,0x141));var _0xa0b7=function(_0x2bdb7e,_0x1b48a5){_0x2bdb7e=_0x2bdb7e-0x0;var _0x13cbd6=_0x0b7a[_0x2bdb7e];return _0x13cbd6;};'use strict';var moment=require('moment');var Sequelize=require(_0xa0b7('0x0'));module[_0xa0b7('0x1')]={'uniqueid':{'type':Sequelize[_0xa0b7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa0b7('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa0b7('0x3')]},'exitAt':{'type':Sequelize[_0xa0b7('0x3')]},'reason':{'type':Sequelize[_0xa0b7('0x2')]}}; \ No newline at end of file +var _0x702c=['sequelize','exports','STRING','DATE','moment'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x702c,0x1e4));var _0xc702=function(_0x4e300e,_0x2ecc96){_0x4e300e=_0x4e300e-0x0;var _0x49386b=_0x702c[_0x4e300e];return _0x49386b;};'use strict';var moment=require(_0xc702('0x0'));var Sequelize=require(_0xc702('0x1'));module[_0xc702('0x2')]={'uniqueid':{'type':Sequelize[_0xc702('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc702('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc702('0x4')]},'acceptAt':{'type':Sequelize[_0xc702('0x4')]},'exitAt':{'type':Sequelize[_0xc702('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 510c415..b75c3ea 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 _0xcaf2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x307d80,_0x2b74e7){var _0x47b263=function(_0x3a0986){while(--_0x3a0986){_0x307d80['push'](_0x307d80['shift']());}};_0x47b263(++_0x2b74e7);}(_0xcaf2,0x8a));var _0x2caf=function(_0x12a0a3,_0x2652d1){_0x12a0a3=_0x12a0a3-0x0;var _0x1c47c4=_0xcaf2[_0x12a0a3];return _0x1c47c4;};'use strict';var emlformat=require(_0x2caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2caf('0x1'));var jsonpatch=require(_0x2caf('0x2'));var rp=require('request-promise');var moment=require(_0x2caf('0x3'));var BPromise=require(_0x2caf('0x4'));var Mustache=require('mustache');var util=require(_0x2caf('0x5'));var path=require('path');var sox=require(_0x2caf('0x6'));var csv=require(_0x2caf('0x7'));var ejs=require(_0x2caf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2caf('0x9'));var squel=require(_0x2caf('0xa'));var crypto=require(_0x2caf('0xb'));var jsforce=require(_0x2caf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2caf('0x7'));var querystring=require(_0x2caf('0xd'));var Papa=require(_0x2caf('0xe'));var Redis=require(_0x2caf('0xf'));var authService=require(_0x2caf('0x10'));var qs=require(_0x2caf('0x11'));var as=require(_0x2caf('0x12'));var hardwareService=require(_0x2caf('0x13'));var logger=require(_0x2caf('0x14'))('api');var utils=require(_0x2caf('0x15'));var config=require(_0x2caf('0x16'));var licenseUtil=require(_0x2caf('0x17'));var db=require(_0x2caf('0x18'))['db'];function respondWithStatusCode(_0x1dda08,_0x31c0e7){_0x31c0e7=_0x31c0e7||0xcc;return function(_0x252147){if(_0x252147){return _0x1dda08[_0x2caf('0x19')](_0x31c0e7);}return _0x1dda08['status'](_0x31c0e7)[_0x2caf('0x1a')]();};}function respondWithResult(_0xec8192,_0x502033){_0x502033=_0x502033||0xc8;return function(_0x4c47b8){if(_0x4c47b8){return _0xec8192['status'](_0x502033)[_0x2caf('0x1b')](_0x4c47b8);}};}function respondWithFilteredResult(_0x4da5ba,_0x388e05){return function(_0xa75896){if(_0xa75896){var _0x3b8b67=typeof _0x388e05[_0x2caf('0x1c')]==='undefined'&&typeof _0x388e05[_0x2caf('0x1d')]==='undefined';var _0x2d5b64=_0xa75896['count'];var _0x4a33fc=_0x3b8b67?0x0:_0x388e05[_0x2caf('0x1c')];var _0x58047b=_0x3b8b67?_0xa75896[_0x2caf('0x1e')]:_0x388e05[_0x2caf('0x1c')]+_0x388e05['limit'];var _0x12624b;if(_0x58047b>=_0x2d5b64){_0x58047b=_0x2d5b64;_0x12624b=0xc8;}else{_0x12624b=0xce;}_0x4da5ba[_0x2caf('0x1f')](_0x12624b);return _0x4da5ba[_0x2caf('0x20')](_0x2caf('0x21'),_0x4a33fc+'-'+_0x58047b+'/'+_0x2d5b64)[_0x2caf('0x1b')](_0xa75896);}return null;};}function patchUpdates(_0x595f2f){return function(_0xfa426f){try{jsonpatch[_0x2caf('0x22')](_0xfa426f,_0x595f2f,!![]);}catch(_0x2b4d16){return BPromise[_0x2caf('0x23')](_0x2b4d16);}return _0xfa426f[_0x2caf('0x24')]();};}function saveUpdates(_0x9d6bae,_0x4092ba){return function(_0x256cc4){if(_0x256cc4){return _0x256cc4[_0x2caf('0x25')](_0x9d6bae)[_0x2caf('0x26')](function(_0x6814bc){return _0x6814bc;});}return null;};}function removeEntity(_0x5231fc,_0x296305){return function(_0x14bfd2){if(_0x14bfd2){return _0x14bfd2[_0x2caf('0x27')]()[_0x2caf('0x26')](function(){_0x5231fc[_0x2caf('0x1f')](0xcc)[_0x2caf('0x1a')]();});}};}function handleEntityNotFound(_0x392196,_0x164da){return function(_0x2e0a75){if(!_0x2e0a75){_0x392196[_0x2caf('0x19')](0x194);}return _0x2e0a75;};}function handleError(_0x5ad211,_0x6a32ac){_0x6a32ac=_0x6a32ac||0x1f4;return function(_0x325eda){logger[_0x2caf('0x28')](_0x325eda[_0x2caf('0x29')]);if(_0x325eda[_0x2caf('0x2a')]){delete _0x325eda[_0x2caf('0x2a')];}_0x5ad211[_0x2caf('0x1f')](_0x6a32ac)[_0x2caf('0x2b')](_0x325eda);};}exports[_0x2caf('0x2c')]=function(_0x2304f1,_0x30da75){var _0x1f477={},_0x158d60={},_0x48b5f7={'count':0x0,'rows':[]};var _0xb944cc=_[_0x2caf('0x2d')](db[_0x2caf('0x2e')][_0x2caf('0x2f')],function(_0xa8523b){return{'name':_0xa8523b[_0x2caf('0x30')],'type':_0xa8523b[_0x2caf('0x31')]['key']};});_0x158d60[_0x2caf('0x32')]=_[_0x2caf('0x2d')](_0xb944cc,'name');_0x158d60[_0x2caf('0x33')]=_[_0x2caf('0x34')](_0x2304f1[_0x2caf('0x33')]);_0x158d60['filters']=_[_0x2caf('0x35')](_0x158d60['model'],_0x158d60['query']);_0x1f477[_0x2caf('0x36')]=_[_0x2caf('0x35')](_0x158d60[_0x2caf('0x32')],qs[_0x2caf('0x37')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1f477[_0x2caf('0x36')]=_0x1f477[_0x2caf('0x36')][_0x2caf('0x38')]?_0x1f477['attributes']:_0x158d60[_0x2caf('0x32')];if(!_0x2304f1[_0x2caf('0x33')][_0x2caf('0x39')](_0x2caf('0x3a'))){_0x1f477[_0x2caf('0x1d')]=qs[_0x2caf('0x1d')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x1d')]);_0x1f477[_0x2caf('0x1c')]=qs[_0x2caf('0x1c')](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x1c')]);}_0x1f477['order']=qs['sort'](_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3b')]);_0x1f477[_0x2caf('0x3c')]=qs[_0x2caf('0x3d')](_['pick'](_0x2304f1[_0x2caf('0x33')],_0x158d60[_0x2caf('0x3d')]),_0xb944cc);if(_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3e')]){_0x1f477[_0x2caf('0x3c')]=_[_0x2caf('0x3f')](_0x1f477[_0x2caf('0x3c')],{'$or':_[_0x2caf('0x2d')](_0xb944cc,function(_0x5c133c){if(_0x5c133c['type']!==_0x2caf('0x40')){var _0x863fca={};_0x863fca[_0x5c133c[_0x2caf('0x2a')]]={'$like':'%'+_0x2304f1[_0x2caf('0x33')][_0x2caf('0x3e')]+'%'};return _0x863fca;}})});}_0x1f477=_[_0x2caf('0x3f')]({},_0x1f477,_0x2304f1[_0x2caf('0x41')]);var _0xf93228={'where':_0x1f477[_0x2caf('0x3c')]};return db[_0x2caf('0x2e')][_0x2caf('0x1e')](_0xf93228)['then'](function(_0x35ad7f){_0x48b5f7[_0x2caf('0x1e')]=_0x35ad7f;if(_0x2304f1[_0x2caf('0x33')]['includeAll']){_0x1f477[_0x2caf('0x42')]=[{'all':!![]}];}return db[_0x2caf('0x2e')][_0x2caf('0x43')](_0x1f477);})['then'](function(_0x40cb18){_0x48b5f7[_0x2caf('0x44')]=_0x40cb18;return _0x48b5f7;})['then'](respondWithFilteredResult(_0x30da75,_0x1f477))[_0x2caf('0x45')](handleError(_0x30da75,null));};exports[_0x2caf('0x46')]=function(_0x4e57b0,_0xe5fcbf){var _0x1348d8={'raw':!![],'where':{'id':_0x4e57b0[_0x2caf('0x47')]['id']}},_0x2e4126={};_0x2e4126[_0x2caf('0x32')]=_[_0x2caf('0x34')](db[_0x2caf('0x2e')][_0x2caf('0x2f')]);_0x2e4126['query']=_[_0x2caf('0x34')](_0x4e57b0['query']);_0x2e4126[_0x2caf('0x3d')]=_[_0x2caf('0x35')](_0x2e4126[_0x2caf('0x32')],_0x2e4126['query']);_0x1348d8['attributes']=_[_0x2caf('0x35')](_0x2e4126['model'],qs[_0x2caf('0x37')](_0x4e57b0[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1348d8[_0x2caf('0x36')]=_0x1348d8[_0x2caf('0x36')][_0x2caf('0x38')]?_0x1348d8[_0x2caf('0x36')]:_0x2e4126[_0x2caf('0x32')];if(_0x4e57b0[_0x2caf('0x33')][_0x2caf('0x48')]){_0x1348d8[_0x2caf('0x42')]=[{'all':!![]}];}_0x1348d8=_[_0x2caf('0x3f')]({},_0x1348d8,_0x4e57b0[_0x2caf('0x41')]);return db[_0x2caf('0x2e')][_0x2caf('0x49')](_0x1348d8)[_0x2caf('0x26')](handleEntityNotFound(_0xe5fcbf,null))[_0x2caf('0x26')](respondWithResult(_0xe5fcbf,null))[_0x2caf('0x45')](handleError(_0xe5fcbf,null));};exports[_0x2caf('0x4a')]=function(_0x3a598b,_0x136dc9){return db['MailQueueReport'][_0x2caf('0x4a')](_0x3a598b[_0x2caf('0x4b')],{})['then'](respondWithResult(_0x136dc9,0xc9))['catch'](handleError(_0x136dc9,null));};exports[_0x2caf('0x25')]=function(_0x6f0a2a,_0x5a822d){if(_0x6f0a2a[_0x2caf('0x4b')]['id']){delete _0x6f0a2a[_0x2caf('0x4b')]['id'];}return db[_0x2caf('0x2e')][_0x2caf('0x49')]({'where':{'id':_0x6f0a2a[_0x2caf('0x47')]['id']}})[_0x2caf('0x26')](handleEntityNotFound(_0x5a822d,null))[_0x2caf('0x26')](saveUpdates(_0x6f0a2a[_0x2caf('0x4b')],null))[_0x2caf('0x26')](respondWithResult(_0x5a822d,null))[_0x2caf('0x45')](handleError(_0x5a822d,null));};exports[_0x2caf('0x27')]=function(_0x2b318a,_0x41b7b2){return db['MailQueueReport'][_0x2caf('0x49')]({'where':{'id':_0x2b318a[_0x2caf('0x47')]['id']}})[_0x2caf('0x26')](handleEntityNotFound(_0x41b7b2,null))['then'](removeEntity(_0x41b7b2,null))[_0x2caf('0x45')](handleError(_0x41b7b2,null));};exports[_0x2caf('0x4c')]=function(_0x28d8bd,_0x20bf52){return db[_0x2caf('0x2e')][_0x2caf('0x4c')]()[_0x2caf('0x26')](respondWithResult(_0x20bf52,null))[_0x2caf('0x45')](handleError(_0x20bf52,null));}; \ No newline at end of file +var _0x583c=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format'];(function(_0x3ff02b,_0x40ff09){var _0x108016=function(_0x532a52){while(--_0x532a52){_0x3ff02b['push'](_0x3ff02b['shift']());}};_0x108016(++_0x40ff09);}(_0x583c,0x12b));var _0xc583=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0x583c[_0x1fd9e7];return _0x1781f2;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];function respondWithStatusCode(_0x87632d,_0x24343b){_0x24343b=_0x24343b||0xcc;return function(_0x267da0){if(_0x267da0){return _0x87632d[_0xc583('0x18')](_0x24343b);}return _0x87632d[_0xc583('0x19')](_0x24343b)[_0xc583('0x1a')]();};}function respondWithResult(_0xf81809,_0x1c6b79){_0x1c6b79=_0x1c6b79||0xc8;return function(_0x5403a3){if(_0x5403a3){return _0xf81809[_0xc583('0x19')](_0x1c6b79)['json'](_0x5403a3);}};}function respondWithFilteredResult(_0x19f46a,_0x299fa1){return function(_0x510090){if(_0x510090){var _0x263552=typeof _0x299fa1[_0xc583('0x1b')]==='undefined'&&typeof _0x299fa1[_0xc583('0x1c')]===_0xc583('0x1d');var _0x5127fa=_0x510090[_0xc583('0x1e')];var _0x8a2d84=_0x263552?0x0:_0x299fa1[_0xc583('0x1b')];var _0x36e0fd=_0x263552?_0x510090['count']:_0x299fa1[_0xc583('0x1b')]+_0x299fa1['limit'];var _0x227ec2;if(_0x36e0fd>=_0x5127fa){_0x36e0fd=_0x5127fa;_0x227ec2=0xc8;}else{_0x227ec2=0xce;}_0x19f46a[_0xc583('0x19')](_0x227ec2);return _0x19f46a[_0xc583('0x1f')](_0xc583('0x20'),_0x8a2d84+'-'+_0x36e0fd+'/'+_0x5127fa)[_0xc583('0x21')](_0x510090);}return null;};}function patchUpdates(_0x12b910){return function(_0x3ce81b){try{jsonpatch[_0xc583('0x22')](_0x3ce81b,_0x12b910,!![]);}catch(_0x37fcd4){return BPromise[_0xc583('0x23')](_0x37fcd4);}return _0x3ce81b[_0xc583('0x24')]();};}function saveUpdates(_0x3b31bc,_0x21466f){return function(_0x478ee1){if(_0x478ee1){return _0x478ee1['update'](_0x3b31bc)[_0xc583('0x25')](function(_0x3e075c){return _0x3e075c;});}return null;};}function removeEntity(_0x8443dc,_0x5ceef1){return function(_0x1521e2){if(_0x1521e2){return _0x1521e2[_0xc583('0x26')]()[_0xc583('0x25')](function(){_0x8443dc[_0xc583('0x19')](0xcc)[_0xc583('0x1a')]();});}};}function handleEntityNotFound(_0x48c95e,_0x4cad36){return function(_0x45871c){if(!_0x45871c){_0x48c95e['sendStatus'](0x194);}return _0x45871c;};}function handleError(_0x45ef74,_0xcbe9b2){_0xcbe9b2=_0xcbe9b2||0x1f4;return function(_0xbabf24){logger[_0xc583('0x27')](_0xbabf24[_0xc583('0x28')]);if(_0xbabf24['name']){delete _0xbabf24[_0xc583('0x29')];}_0x45ef74[_0xc583('0x19')](_0xcbe9b2)['send'](_0xbabf24);};}exports[_0xc583('0x2a')]=function(_0x483357,_0x2c9088){var _0x8d4ecb={},_0x1c80b1={},_0x3ed083={'count':0x0,'rows':[]};var _0x1b2b49=_[_0xc583('0x2b')](db[_0xc583('0x2c')]['rawAttributes'],function(_0x529dbe){return{'name':_0x529dbe[_0xc583('0x2d')],'type':_0x529dbe[_0xc583('0x2e')][_0xc583('0x2f')]};});_0x1c80b1[_0xc583('0x30')]=_[_0xc583('0x2b')](_0x1b2b49,'name');_0x1c80b1[_0xc583('0x31')]=_['keys'](_0x483357['query']);_0x1c80b1[_0xc583('0x32')]=_[_0xc583('0x33')](_0x1c80b1[_0xc583('0x30')],_0x1c80b1[_0xc583('0x31')]);_0x8d4ecb[_0xc583('0x34')]=_['intersection'](_0x1c80b1[_0xc583('0x30')],qs[_0xc583('0x35')](_0x483357[_0xc583('0x31')]['fields']));_0x8d4ecb[_0xc583('0x34')]=_0x8d4ecb['attributes'][_0xc583('0x36')]?_0x8d4ecb[_0xc583('0x34')]:_0x1c80b1[_0xc583('0x30')];if(!_0x483357[_0xc583('0x31')][_0xc583('0x37')]('nolimit')){_0x8d4ecb[_0xc583('0x1c')]=qs['limit'](_0x483357[_0xc583('0x31')]['limit']);_0x8d4ecb[_0xc583('0x1b')]=qs[_0xc583('0x1b')](_0x483357[_0xc583('0x31')][_0xc583('0x1b')]);}_0x8d4ecb[_0xc583('0x38')]=qs[_0xc583('0x39')](_0x483357['query']['sort']);_0x8d4ecb[_0xc583('0x3a')]=qs[_0xc583('0x32')](_['pick'](_0x483357[_0xc583('0x31')],_0x1c80b1[_0xc583('0x32')]),_0x1b2b49);if(_0x483357[_0xc583('0x31')][_0xc583('0x3b')]){_0x8d4ecb[_0xc583('0x3a')]=_[_0xc583('0x3c')](_0x8d4ecb['where'],{'$or':_[_0xc583('0x2b')](_0x1b2b49,function(_0x595351){if(_0x595351[_0xc583('0x2e')]!==_0xc583('0x3d')){var _0x39bed4={};_0x39bed4[_0x595351['name']]={'$like':'%'+_0x483357['query']['filter']+'%'};return _0x39bed4;}})});}_0x8d4ecb=_[_0xc583('0x3c')]({},_0x8d4ecb,_0x483357[_0xc583('0x3e')]);var _0x2b957d={'where':_0x8d4ecb[_0xc583('0x3a')]};return db['MailQueueReport'][_0xc583('0x1e')](_0x2b957d)[_0xc583('0x25')](function(_0x594a0b){_0x3ed083['count']=_0x594a0b;if(_0x483357[_0xc583('0x31')]['includeAll']){_0x8d4ecb[_0xc583('0x3f')]=[{'all':!![]}];}return db[_0xc583('0x2c')][_0xc583('0x40')](_0x8d4ecb);})[_0xc583('0x25')](function(_0x58553e){_0x3ed083[_0xc583('0x41')]=_0x58553e;return _0x3ed083;})[_0xc583('0x25')](respondWithFilteredResult(_0x2c9088,_0x8d4ecb))[_0xc583('0x42')](handleError(_0x2c9088,null));};exports[_0xc583('0x43')]=function(_0x2c1c22,_0x5e6e7e){var _0x3ffeb7={'raw':!![],'where':{'id':_0x2c1c22['params']['id']}},_0x5f5a97={};_0x5f5a97[_0xc583('0x30')]=_[_0xc583('0x44')](db['MailQueueReport']['rawAttributes']);_0x5f5a97[_0xc583('0x31')]=_[_0xc583('0x44')](_0x2c1c22[_0xc583('0x31')]);_0x5f5a97[_0xc583('0x32')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],_0x5f5a97['query']);_0x3ffeb7[_0xc583('0x34')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],qs[_0xc583('0x35')](_0x2c1c22[_0xc583('0x31')][_0xc583('0x35')]));_0x3ffeb7[_0xc583('0x34')]=_0x3ffeb7['attributes'][_0xc583('0x36')]?_0x3ffeb7[_0xc583('0x34')]:_0x5f5a97[_0xc583('0x30')];if(_0x2c1c22['query']['includeAll']){_0x3ffeb7['include']=[{'all':!![]}];}_0x3ffeb7=_[_0xc583('0x3c')]({},_0x3ffeb7,_0x2c1c22['options']);return db[_0xc583('0x2c')][_0xc583('0x45')](_0x3ffeb7)[_0xc583('0x25')](handleEntityNotFound(_0x5e6e7e,null))[_0xc583('0x25')](respondWithResult(_0x5e6e7e,null))[_0xc583('0x42')](handleError(_0x5e6e7e,null));};exports[_0xc583('0x46')]=function(_0x302038,_0x32cfbf){return db[_0xc583('0x2c')][_0xc583('0x46')](_0x302038[_0xc583('0x47')],{})['then'](respondWithResult(_0x32cfbf,0xc9))[_0xc583('0x42')](handleError(_0x32cfbf,null));};exports[_0xc583('0x48')]=function(_0x453df7,_0x230a45){if(_0x453df7['body']['id']){delete _0x453df7[_0xc583('0x47')]['id'];}return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x453df7[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x230a45,null))[_0xc583('0x25')](saveUpdates(_0x453df7[_0xc583('0x47')],null))[_0xc583('0x25')](respondWithResult(_0x230a45,null))[_0xc583('0x42')](handleError(_0x230a45,null));};exports['destroy']=function(_0x1f4901,_0x1919fa){return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x1f4901[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x1919fa,null))[_0xc583('0x25')](removeEntity(_0x1919fa,null))[_0xc583('0x42')](handleError(_0x1919fa,null));};exports[_0xc583('0x4a')]=function(_0xa03d53,_0x1a0f91){return db[_0xc583('0x2c')][_0xc583('0x4a')]()['then'](respondWithResult(_0x1a0f91,null))[_0xc583('0x42')](handleError(_0x1a0f91,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a02fd58..cc6ed8f 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 _0x4bc7=['MailQueueReport','report_mail_queue','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define'];(function(_0x108a76,_0x3b93b4){var _0x2bd802=function(_0x53b84e){while(--_0x53b84e){_0x108a76['push'](_0x108a76['shift']());}};_0x2bd802(++_0x3b93b4);}(_0x4bc7,0x188));var _0x74bc=function(_0x4f8cba,_0x51d42b){_0x4f8cba=_0x4f8cba-0x0;var _0xe240a6=_0x4bc7[_0x4f8cba];return _0xe240a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x74bc('0x0'))(_0x74bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74bc('0x2'));var fs=require('fs');var path=require(_0x74bc('0x3'));var rimraf=require(_0x74bc('0x4'));var config=require(_0x74bc('0x5'));var attributes=require(_0x74bc('0x6'));module['exports']=function(_0x340e2f,_0x59fbe1){return _0x340e2f[_0x74bc('0x7')](_0x74bc('0x8'),attributes,{'tableName':_0x74bc('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c5a=['uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','define','MailQueueReport'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x7c5a,0xa3));var _0xa7c5=function(_0x2c46d2,_0x4d6258){_0x2c46d2=_0x2c46d2-0x0;var _0x4e1e11=_0x7c5a[_0x2c46d2];return _0x4e1e11;};'use strict';var _=require(_0xa7c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa7c5('0x1'));var BPromise=require(_0xa7c5('0x2'));var rp=require(_0xa7c5('0x3'));var fs=require('fs');var path=require(_0xa7c5('0x4'));var rimraf=require(_0xa7c5('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x57ec7a,_0xb9f2a7){return _0x57ec7a[_0xa7c5('0x6')](_0xa7c5('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xa7c5('0x8'),'fields':[_0xa7c5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 804153a..018afe7 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x2c9101,_0x5ba7e6){var _0x3e64bf=function(_0x4caa3b){while(--_0x4caa3b){_0x2c9101['push'](_0x2c9101['shift']());}};_0x3e64bf(++_0x5ba7e6);}(_0x7a54,0x106));var _0x47a5=function(_0x5b3ffe,_0x50c128){_0x5b3ffe=_0x5b3ffe-0x0;var _0x4fd215=_0x7a54[_0x5b3ffe];return _0x4fd215;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x231a00,_0x3637c2){var _0x21f4b8=function(_0x3c9db1){while(--_0x3c9db1){_0x231a00['push'](_0x231a00['shift']());}};_0x21f4b8(++_0x3637c2);}(_0x7a54,0x106));var _0x47a5=function(_0x110932,_0x155796){_0x110932=_0x110932-0x0;var _0x4899d4=_0x7a54[_0x110932];return _0x4899d4;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 0c38c99..c9d3048 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xad1145,_0x211d99){var _0x4a5998=function(_0x5bff2c){while(--_0x5bff2c){_0xad1145['push'](_0xad1145['shift']());}};_0x4a5998(++_0x211d99);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0xcb91[_0x4164f2];return _0x2575c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2233f6,_0x14c6a2){var _0x5b5ad1=function(_0x558393){while(--_0x558393){_0x2233f6['push'](_0x2233f6['shift']());}};_0x5b5ad1(++_0x14c6a2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xcb91[_0x398294];return _0x2a872d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 5e300f7..f79e89f 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 _0x5b3d=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x5b3d,0xbf));var _0xd5b3=function(_0x2d604b,_0x4f1748){_0x2d604b=_0x2d604b-0x0;var _0x504857=_0x5b3d[_0x2d604b];return _0x504857;};'use strict';var Sequelize=require(_0xd5b3('0x0'));module[_0xd5b3('0x1')]={'description':{'type':Sequelize[_0xd5b3('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd5b3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd5b3('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd5b3('0x4')]},'tls':{'type':Sequelize[_0xd5b3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd5b3('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xd5b3('0x2')]},'modernAuthentication':{'type':Sequelize[_0xd5b3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x970d=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x545d6a,_0xe83bfa){var _0x554e15=function(_0x46329e){while(--_0x46329e){_0x545d6a['push'](_0x545d6a['shift']());}};_0x554e15(++_0xe83bfa);}(_0x970d,0xfd));var _0xd970=function(_0x1193ea,_0xc04ef0){_0x1193ea=_0x1193ea-0x0;var _0x5e4000=_0x970d[_0x1193ea];return _0x5e4000;};'use strict';var Sequelize=require(_0xd970('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd970('0x1')]},'authentication':{'type':Sequelize[_0xd970('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd970('0x1')]},'port':{'type':Sequelize[_0xd970('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd970('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xd970('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd970('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd970('0x1')]},'modernAuthentication':{'type':Sequelize[_0xd970('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5af5053..cb32634 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 _0x3b3c=['moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger'];(function(_0x2049fa,_0x1234ed){var _0x506e96=function(_0x4cd4ee){while(--_0x4cd4ee){_0x2049fa['push'](_0x2049fa['shift']());}};_0x506e96(++_0x1234ed);}(_0x3b3c,0x17e));var _0xc3b3=function(_0xd2dfeb,_0x51aa27){_0xd2dfeb=_0xd2dfeb-0x0;var _0x313172=_0x3b3c[_0xd2dfeb];return _0x313172;};'use strict';var _=require(_0xc3b3('0x0'));var util=require('util');var logger=require(_0xc3b3('0x1'))('api');var moment=require(_0xc3b3('0x2'));var BPromise=require(_0xc3b3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3b3('0x4'));var rimraf=require(_0xc3b3('0x5'));var config=require(_0xc3b3('0x6'));var attributes=require(_0xc3b3('0x7'));module[_0xc3b3('0x8')]=function(_0x1a4cb0,_0x29f4a1){return _0x1a4cb0[_0xc3b3('0x9')](_0xc3b3('0xa'),attributes,{'tableName':_0xc3b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e15=['../../config/environment','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x46e1dc,_0x4c5b22){var _0x30bee6=function(_0x4b65ad){while(--_0x4b65ad){_0x46e1dc['push'](_0x46e1dc['shift']());}};_0x30bee6(++_0x4c5b22);}(_0x3e15,0x124));var _0x53e1=function(_0x118a07,_0x261e28){_0x118a07=_0x118a07-0x0;var _0x59c811=_0x3e15[_0x118a07];return _0x59c811;};'use strict';var _=require(_0x53e1('0x0'));var util=require(_0x53e1('0x1'));var logger=require(_0x53e1('0x2'))(_0x53e1('0x3'));var moment=require(_0x53e1('0x4'));var BPromise=require(_0x53e1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53e1('0x6'));var rimraf=require(_0x53e1('0x7'));var config=require(_0x53e1('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x53e1('0x9')]=function(_0x21b9e3,_0x225ac9){return _0x21b9e3['define'](_0x53e1('0xa'),attributes,{'tableName':_0x53e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 23c95d4..4579970 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 _0x4e4d=['result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2cfa8b,_0x10830c){var _0x5b1032=function(_0x223f9f){while(--_0x223f9f){_0x2cfa8b['push'](_0x2cfa8b['shift']());}};_0x5b1032(++_0x10830c);}(_0x4e4d,0xd7));var _0xd4e4=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x4e4d[_0x163040];return _0x364667;};'use strict';var _=require(_0xd4e4('0x0'));var util=require(_0xd4e4('0x1'));var moment=require(_0xd4e4('0x2'));var BPromise=require(_0xd4e4('0x3'));var rs=require(_0xd4e4('0x4'));var fs=require('fs');var Redis=require(_0xd4e4('0x5'));var db=require(_0xd4e4('0x6'))['db'];var utils=require(_0xd4e4('0x7'));var logger=require(_0xd4e4('0x8'))(_0xd4e4('0x9'));var config=require(_0xd4e4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd4e4('0xb')][_0xd4e4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c35bd,_0x536990,_0x2e73c2){return new BPromise(function(_0x418698,_0x56bf24){return client['request'](_0x5c35bd,_0x2e73c2)[_0xd4e4('0xd')](function(_0x159faa){logger[_0xd4e4('0xe')](_0xd4e4('0xf'),_0x536990,_0xd4e4('0x10'));logger[_0xd4e4('0x11')](_0xd4e4('0x12'),_0x536990,_0xd4e4('0x10'),JSON[_0xd4e4('0x13')](_0x159faa));if(_0x159faa[_0xd4e4('0x14')]){if(_0x159faa['error'][_0xd4e4('0x15')]===0x1f4){logger[_0xd4e4('0x14')](_0xd4e4('0xf'),_0x536990,_0x159faa[_0xd4e4('0x14')]['message']);return _0x56bf24(_0x159faa['error'][_0xd4e4('0x16')]);}logger[_0xd4e4('0x14')]('MailServerIn,\x20%s,\x20%s',_0x536990,_0x159faa['error']['message']);return _0x418698(_0x159faa[_0xd4e4('0x14')][_0xd4e4('0x16')]);}else{logger[_0xd4e4('0xe')](_0xd4e4('0xf'),_0x536990,_0xd4e4('0x10'));_0x418698(_0x159faa[_0xd4e4('0x17')][_0xd4e4('0x16')]);}})[_0xd4e4('0x18')](function(_0x497e00){logger[_0xd4e4('0x14')]('MailServerIn,\x20%s,\x20%s',_0x536990,_0x497e00);_0x56bf24(_0x497e00);});});}exports[_0xd4e4('0x19')]=function(_0x4ed0e4){var _0x45ff82=this;return new Promise(function(_0x1413fc,_0x1da896){return db[_0xd4e4('0x1a')][_0xd4e4('0x1b')]({'raw':_0x4ed0e4['options']?_0x4ed0e4[_0xd4e4('0x1c')][_0xd4e4('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ed0e4[_0xd4e4('0x1c')]?_0x4ed0e4[_0xd4e4('0x1c')][_0xd4e4('0x1e')]||null:null,'attributes':_0x4ed0e4['options']?_0x4ed0e4[_0xd4e4('0x1c')][_0xd4e4('0x1f')]||null:null,'limit':_0x4ed0e4[_0xd4e4('0x1c')]?_0x4ed0e4[_0xd4e4('0x1c')]['limit']||null:null,'include':_0x4ed0e4[_0xd4e4('0x1c')]?_0x4ed0e4[_0xd4e4('0x1c')][_0xd4e4('0x20')]?_[_0xd4e4('0x21')](_0x4ed0e4['options'][_0xd4e4('0x20')],function(_0x2ecaf9){return{'model':db[_0x2ecaf9['model']],'as':_0x2ecaf9['as'],'attributes':_0x2ecaf9[_0xd4e4('0x1f')],'include':_0x2ecaf9[_0xd4e4('0x20')]?_[_0xd4e4('0x21')](_0x2ecaf9[_0xd4e4('0x20')],function(_0x436d20){return{'model':db[_0x436d20['model']],'as':_0x436d20['as'],'attributes':_0x436d20[_0xd4e4('0x1f')],'include':_0x436d20[_0xd4e4('0x20')]?_[_0xd4e4('0x21')](_0x436d20[_0xd4e4('0x20')],function(_0x31cca7){return{'model':db[_0x31cca7['model']],'as':_0x31cca7['as'],'attributes':_0x31cca7[_0xd4e4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x432186){logger[_0xd4e4('0xe')](_0xd4e4('0x19'),_0x4ed0e4);logger[_0xd4e4('0x11')](_0xd4e4('0x19'),_0x4ed0e4,JSON[_0xd4e4('0x13')](_0x432186));_0x1413fc(_0x432186);})[_0xd4e4('0x18')](function(_0x318f0b){logger[_0xd4e4('0x14')]('GetMailServerIn',_0x318f0b[_0xd4e4('0x16')],_0x4ed0e4);_0x1da896(_0x45ff82['error'](0x1f4,_0x318f0b[_0xd4e4('0x16')]));});});}; \ No newline at end of file +var _0x8305=['model','GetMailServerIn','stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','MailServerIn,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','catch','MailServerIn','options','raw','where','attributes','include','map'];(function(_0x363239,_0x269287){var _0x5b5c95=function(_0x38c3bc){while(--_0x38c3bc){_0x363239['push'](_0x363239['shift']());}};_0x5b5c95(++_0x269287);}(_0x8305,0x1d3));var _0x5830=function(_0x1f1ef5,_0x271f2a){_0x1f1ef5=_0x1f1ef5-0x0;var _0x3971e6=_0x8305[_0x1f1ef5];return _0x3971e6;};'use strict';var _=require(_0x5830('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5830('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5830('0x2'));var db=require(_0x5830('0x3'))['db'];var utils=require(_0x5830('0x4'));var logger=require(_0x5830('0x5'))(_0x5830('0x6'));var config=require(_0x5830('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5830('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5298fb,_0x51e44f,_0x1dc85c){return new BPromise(function(_0x34809a,_0x4bb686){return client[_0x5830('0x9')](_0x5298fb,_0x1dc85c)[_0x5830('0xa')](function(_0x19b969){logger['info'](_0x5830('0xb'),_0x51e44f,'request\x20sent');logger[_0x5830('0xc')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x51e44f,'request\x20sent',JSON['stringify'](_0x19b969));if(_0x19b969[_0x5830('0xd')]){if(_0x19b969[_0x5830('0xd')][_0x5830('0xe')]===0x1f4){logger[_0x5830('0xd')](_0x5830('0xb'),_0x51e44f,_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);return _0x4bb686(_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);}logger[_0x5830('0xd')](_0x5830('0xb'),_0x51e44f,_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);return _0x34809a(_0x19b969[_0x5830('0xd')]['message']);}else{logger[_0x5830('0x10')]('MailServerIn,\x20%s,\x20%s',_0x51e44f,_0x5830('0x11'));_0x34809a(_0x19b969['result'][_0x5830('0xf')]);}})[_0x5830('0x12')](function(_0x37a8e2){logger['error'](_0x5830('0xb'),_0x51e44f,_0x37a8e2);_0x4bb686(_0x37a8e2);});});}exports['GetMailServerIn']=function(_0x1d3450){var _0x55f311=this;return new Promise(function(_0x3e5ae3,_0x28b58f){return db[_0x5830('0x13')]['findAll']({'raw':_0x1d3450[_0x5830('0x14')]?_0x1d3450[_0x5830('0x14')][_0x5830('0x15')]===undefined?!![]:![]:!![],'where':_0x1d3450[_0x5830('0x14')]?_0x1d3450[_0x5830('0x14')][_0x5830('0x16')]||null:null,'attributes':_0x1d3450[_0x5830('0x14')]?_0x1d3450[_0x5830('0x14')][_0x5830('0x17')]||null:null,'limit':_0x1d3450[_0x5830('0x14')]?_0x1d3450['options']['limit']||null:null,'include':_0x1d3450[_0x5830('0x14')]?_0x1d3450[_0x5830('0x14')][_0x5830('0x18')]?_[_0x5830('0x19')](_0x1d3450[_0x5830('0x14')][_0x5830('0x18')],function(_0x41c7ec){return{'model':db[_0x41c7ec[_0x5830('0x1a')]],'as':_0x41c7ec['as'],'attributes':_0x41c7ec[_0x5830('0x17')],'include':_0x41c7ec[_0x5830('0x18')]?_[_0x5830('0x19')](_0x41c7ec[_0x5830('0x18')],function(_0xcc13ca){return{'model':db[_0xcc13ca[_0x5830('0x1a')]],'as':_0xcc13ca['as'],'attributes':_0xcc13ca[_0x5830('0x17')],'include':_0xcc13ca[_0x5830('0x18')]?_[_0x5830('0x19')](_0xcc13ca['include'],function(_0x30d9e8){return{'model':db[_0x30d9e8[_0x5830('0x1a')]],'as':_0x30d9e8['as'],'attributes':_0x30d9e8[_0x5830('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5830('0xa')](function(_0x12041c){logger[_0x5830('0x10')](_0x5830('0x1b'),_0x1d3450);logger[_0x5830('0xc')]('GetMailServerIn',_0x1d3450,JSON[_0x5830('0x1c')](_0x12041c));_0x3e5ae3(_0x12041c);})[_0x5830('0x12')](function(_0x172b01){logger['error']('GetMailServerIn',_0x172b01[_0x5830('0xf')],_0x1d3450);_0x28b58f(_0x55f311['error'](0x1f4,_0x172b01[_0x5830('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index daa0db6..76f6e1d 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(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x447d98,_0x2b7c25){_0x447d98=_0x447d98-0x0;var _0x4b1ace=_0x7a54[_0x447d98];return _0x4b1ace;};'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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 240944c..2a88c13 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 _0x8f59=['BOOLEAN','sequelize','exports','STRING'];(function(_0x23e207,_0x34850b){var _0x2e25fa=function(_0x41bf81){while(--_0x41bf81){_0x23e207['push'](_0x23e207['shift']());}};_0x2e25fa(++_0x34850b);}(_0x8f59,0x11d));var _0x98f5=function(_0x3770c8,_0x4c3e51){_0x3770c8=_0x3770c8-0x0;var _0x33d6ff=_0x8f59[_0x3770c8];return _0x33d6ff;};'use strict';var Sequelize=require(_0x98f5('0x0'));module[_0x98f5('0x1')]={'description':{'type':Sequelize[_0x98f5('0x2')]},'host':{'type':Sequelize[_0x98f5('0x2')]},'user':{'type':Sequelize[_0x98f5('0x2')]},'pass':{'type':Sequelize[_0x98f5('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x98f5('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x98f5('0x2')]},'authentication':{'type':Sequelize[_0x98f5('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x98f5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x80ed=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x80ed,0x11c));var _0xd80e=function(_0x5589f2,_0x3dec91){_0x5589f2=_0x5589f2-0x0;var _0x4ad62d=_0x80ed[_0x5589f2];return _0x4ad62d;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'description':{'type':Sequelize[_0xd80e('0x1')]},'host':{'type':Sequelize[_0xd80e('0x1')]},'user':{'type':Sequelize[_0xd80e('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd80e('0x2')]},'secure':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd80e('0x1')]},'authentication':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 083ff45..90bae71 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 _0xeba8=['MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','name','send','index','map'];(function(_0x29ba3c,_0x2e5f88){var _0x4018c8=function(_0x289c0c){while(--_0x289c0c){_0x29ba3c['push'](_0x29ba3c['shift']());}};_0x4018c8(++_0x2e5f88);}(_0xeba8,0x1a0));var _0x8eba=function(_0x56e32e,_0x9eb2f6){_0x56e32e=_0x56e32e-0x0;var _0x2a757b=_0xeba8[_0x56e32e];return _0x2a757b;};'use strict';var emlformat=require(_0x8eba('0x0'));var rimraf=require(_0x8eba('0x1'));var zipdir=require(_0x8eba('0x2'));var jsonpatch=require(_0x8eba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8eba('0x4'));var Mustache=require('mustache');var util=require(_0x8eba('0x5'));var path=require(_0x8eba('0x6'));var sox=require(_0x8eba('0x7'));var csv=require(_0x8eba('0x8'));var ejs=require(_0x8eba('0x9'));var fs=require('fs');var fs_extra=require(_0x8eba('0xa'));var _=require(_0x8eba('0xb'));var squel=require(_0x8eba('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eba('0xd'));var deskjs=require(_0x8eba('0xe'));var toCsv=require(_0x8eba('0x8'));var querystring=require(_0x8eba('0xf'));var Papa=require('papaparse');var Redis=require(_0x8eba('0x10'));var authService=require(_0x8eba('0x11'));var qs=require(_0x8eba('0x12'));var as=require(_0x8eba('0x13'));var hardwareService=require(_0x8eba('0x14'));var logger=require(_0x8eba('0x15'))(_0x8eba('0x16'));var utils=require('../../config/utils');var config=require(_0x8eba('0x17'));var licenseUtil=require(_0x8eba('0x18'));var db=require(_0x8eba('0x19'))['db'];function respondWithStatusCode(_0x55d590,_0x225d82){_0x225d82=_0x225d82||0xcc;return function(_0xe0cccb){if(_0xe0cccb){return _0x55d590[_0x8eba('0x1a')](_0x225d82);}return _0x55d590[_0x8eba('0x1b')](_0x225d82)['end']();};}function respondWithResult(_0x280219,_0x57afc7){_0x57afc7=_0x57afc7||0xc8;return function(_0x306c09){if(_0x306c09){return _0x280219['status'](_0x57afc7)['json'](_0x306c09);}};}function respondWithFilteredResult(_0x68201c,_0xbbacc){return function(_0x1e5b21){if(_0x1e5b21){var _0x39a2c9=typeof _0xbbacc[_0x8eba('0x1c')]===_0x8eba('0x1d')&&typeof _0xbbacc[_0x8eba('0x1e')]===_0x8eba('0x1d');var _0xd1ae8b=_0x1e5b21[_0x8eba('0x1f')];var _0xd61d1e=_0x39a2c9?0x0:_0xbbacc['offset'];var _0x552b1d=_0x39a2c9?_0x1e5b21[_0x8eba('0x1f')]:_0xbbacc[_0x8eba('0x1c')]+_0xbbacc[_0x8eba('0x1e')];var _0x745925;if(_0x552b1d>=_0xd1ae8b){_0x552b1d=_0xd1ae8b;_0x745925=0xc8;}else{_0x745925=0xce;}_0x68201c[_0x8eba('0x1b')](_0x745925);return _0x68201c[_0x8eba('0x20')](_0x8eba('0x21'),_0xd61d1e+'-'+_0x552b1d+'/'+_0xd1ae8b)[_0x8eba('0x22')](_0x1e5b21);}return null;};}function patchUpdates(_0x3c8319){return function(_0x4b765d){try{jsonpatch[_0x8eba('0x23')](_0x4b765d,_0x3c8319,!![]);}catch(_0x6cc440){return BPromise[_0x8eba('0x24')](_0x6cc440);}return _0x4b765d[_0x8eba('0x25')]();};}function saveUpdates(_0x165670,_0x424616){return function(_0x3c8126){if(_0x3c8126){return _0x3c8126[_0x8eba('0x26')](_0x165670)['then'](function(_0x3f1af7){return _0x3f1af7;});}return null;};}function removeEntity(_0x212169,_0x57e63b){return function(_0x2b8c87){if(_0x2b8c87){return _0x2b8c87[_0x8eba('0x27')]()[_0x8eba('0x28')](function(){_0x212169[_0x8eba('0x1b')](0xcc)[_0x8eba('0x29')]();});}};}function handleEntityNotFound(_0xeadf0b,_0x161dea){return function(_0x4f158c){if(!_0x4f158c){_0xeadf0b[_0x8eba('0x1a')](0x194);}return _0x4f158c;};}function handleError(_0x3e7f54,_0x572234){_0x572234=_0x572234||0x1f4;return function(_0x47f3a5){logger['error'](_0x47f3a5['stack']);if(_0x47f3a5[_0x8eba('0x2a')]){delete _0x47f3a5['name'];}_0x3e7f54[_0x8eba('0x1b')](_0x572234)[_0x8eba('0x2b')](_0x47f3a5);};}exports[_0x8eba('0x2c')]=function(_0x461433,_0x5537f6){var _0x28ed2a={},_0x5eaa92={},_0x48717b={'count':0x0,'rows':[]};var _0x40ddd8=_[_0x8eba('0x2d')](db[_0x8eba('0x2e')][_0x8eba('0x2f')],function(_0x264fa2){return{'name':_0x264fa2[_0x8eba('0x30')],'type':_0x264fa2[_0x8eba('0x31')][_0x8eba('0x32')]};});_0x5eaa92['model']=_['map'](_0x40ddd8,_0x8eba('0x2a'));_0x5eaa92[_0x8eba('0x33')]=_[_0x8eba('0x34')](_0x461433[_0x8eba('0x33')]);_0x5eaa92[_0x8eba('0x35')]=_['intersection'](_0x5eaa92[_0x8eba('0x36')],_0x5eaa92[_0x8eba('0x33')]);_0x28ed2a[_0x8eba('0x37')]=_[_0x8eba('0x38')](_0x5eaa92[_0x8eba('0x36')],qs[_0x8eba('0x39')](_0x461433[_0x8eba('0x33')][_0x8eba('0x39')]));_0x28ed2a[_0x8eba('0x37')]=_0x28ed2a['attributes'][_0x8eba('0x3a')]?_0x28ed2a['attributes']:_0x5eaa92[_0x8eba('0x36')];if(!_0x461433['query'][_0x8eba('0x3b')]('nolimit')){_0x28ed2a[_0x8eba('0x1e')]=qs['limit'](_0x461433['query']['limit']);_0x28ed2a[_0x8eba('0x1c')]=qs[_0x8eba('0x1c')](_0x461433['query']['offset']);}_0x28ed2a[_0x8eba('0x3c')]=qs[_0x8eba('0x3d')](_0x461433[_0x8eba('0x33')][_0x8eba('0x3d')]);_0x28ed2a['where']=qs[_0x8eba('0x35')](_[_0x8eba('0x3e')](_0x461433['query'],_0x5eaa92[_0x8eba('0x35')]),_0x40ddd8);if(_0x461433[_0x8eba('0x33')][_0x8eba('0x3f')]){_0x28ed2a[_0x8eba('0x40')]=_[_0x8eba('0x41')](_0x28ed2a[_0x8eba('0x40')],{'$or':_['map'](_0x40ddd8,function(_0x3843f5){if(_0x3843f5[_0x8eba('0x31')]!==_0x8eba('0x42')){var _0x108534={};_0x108534[_0x3843f5[_0x8eba('0x2a')]]={'$like':'%'+_0x461433['query']['filter']+'%'};return _0x108534;}})});}_0x28ed2a=_[_0x8eba('0x41')]({},_0x28ed2a,_0x461433[_0x8eba('0x43')]);var _0x5c0f29={'where':_0x28ed2a[_0x8eba('0x40')]};return db[_0x8eba('0x2e')][_0x8eba('0x1f')](_0x5c0f29)[_0x8eba('0x28')](function(_0x4f7be2){_0x48717b[_0x8eba('0x1f')]=_0x4f7be2;if(_0x461433['query'][_0x8eba('0x44')]){_0x28ed2a[_0x8eba('0x45')]=[{'all':!![]}];}return db[_0x8eba('0x2e')]['findAll'](_0x28ed2a);})[_0x8eba('0x28')](function(_0x49dce3){_0x48717b[_0x8eba('0x46')]=_0x49dce3;return _0x48717b;})['then'](respondWithFilteredResult(_0x5537f6,_0x28ed2a))[_0x8eba('0x47')](handleError(_0x5537f6,null));};exports[_0x8eba('0x48')]=function(_0x2e5591,_0x407fff){var _0x258210={'raw':!![],'where':{'id':_0x2e5591[_0x8eba('0x49')]['id']}},_0xbe6e11={};_0xbe6e11[_0x8eba('0x36')]=_[_0x8eba('0x34')](db[_0x8eba('0x2e')][_0x8eba('0x2f')]);_0xbe6e11[_0x8eba('0x33')]=_['keys'](_0x2e5591['query']);_0xbe6e11[_0x8eba('0x35')]=_[_0x8eba('0x38')](_0xbe6e11[_0x8eba('0x36')],_0xbe6e11['query']);_0x258210[_0x8eba('0x37')]=_[_0x8eba('0x38')](_0xbe6e11[_0x8eba('0x36')],qs[_0x8eba('0x39')](_0x2e5591[_0x8eba('0x33')][_0x8eba('0x39')]));_0x258210['attributes']=_0x258210[_0x8eba('0x37')][_0x8eba('0x3a')]?_0x258210[_0x8eba('0x37')]:_0xbe6e11[_0x8eba('0x36')];if(_0x2e5591[_0x8eba('0x33')][_0x8eba('0x44')]){_0x258210[_0x8eba('0x45')]=[{'all':!![]}];}_0x258210=_[_0x8eba('0x41')]({},_0x258210,_0x2e5591[_0x8eba('0x43')]);return db[_0x8eba('0x2e')][_0x8eba('0x4a')](_0x258210)[_0x8eba('0x28')](handleEntityNotFound(_0x407fff,null))[_0x8eba('0x28')](respondWithResult(_0x407fff,null))[_0x8eba('0x47')](handleError(_0x407fff,null));};exports[_0x8eba('0x4b')]=function(_0x38f626,_0x2ef15a){return db[_0x8eba('0x2e')][_0x8eba('0x4b')](_0x38f626['body'],{})[_0x8eba('0x28')](respondWithResult(_0x2ef15a,0xc9))['catch'](handleError(_0x2ef15a,null));};exports[_0x8eba('0x26')]=function(_0x2a50c7,_0x5b8575){if(_0x2a50c7[_0x8eba('0x4c')]['id']){delete _0x2a50c7[_0x8eba('0x4c')]['id'];}return db[_0x8eba('0x2e')][_0x8eba('0x4a')]({'where':{'id':_0x2a50c7[_0x8eba('0x49')]['id']}})[_0x8eba('0x28')](handleEntityNotFound(_0x5b8575,null))['then'](saveUpdates(_0x2a50c7[_0x8eba('0x4c')],null))[_0x8eba('0x28')](respondWithResult(_0x5b8575,null))['catch'](handleError(_0x5b8575,null));};exports['destroy']=function(_0x244874,_0x1c8c8f){return db['MailServerOut'][_0x8eba('0x4a')]({'where':{'id':_0x244874[_0x8eba('0x49')]['id']}})[_0x8eba('0x28')](handleEntityNotFound(_0x1c8c8f,null))[_0x8eba('0x28')](removeEntity(_0x1c8c8f,null))[_0x8eba('0x47')](handleError(_0x1c8c8f,null));}; \ No newline at end of file +var _0x054c=['save','update','then','destroy','sendStatus','error','stack','name','send','MailServerOut','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0x227839,_0x530c9e){var _0x32b9bc=function(_0x1cebfe){while(--_0x1cebfe){_0x227839['push'](_0x227839['shift']());}};_0x32b9bc(++_0x530c9e);}(_0x054c,0x1de));var _0xc054=function(_0x35f7d2,_0x28a49e){_0x35f7d2=_0x35f7d2-0x0;var _0x4c9429=_0x054c[_0x35f7d2];return _0x4c9429;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc054('0x0'));var rp=require('request-promise');var moment=require(_0xc054('0x1'));var BPromise=require(_0xc054('0x2'));var Mustache=require(_0xc054('0x3'));var util=require(_0xc054('0x4'));var path=require(_0xc054('0x5'));var sox=require(_0xc054('0x6'));var csv=require(_0xc054('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc054('0x8'));var _=require(_0xc054('0x9'));var squel=require(_0xc054('0xa'));var crypto=require('crypto');var jsforce=require(_0xc054('0xb'));var deskjs=require(_0xc054('0xc'));var toCsv=require(_0xc054('0x7'));var querystring=require(_0xc054('0xd'));var Papa=require(_0xc054('0xe'));var Redis=require(_0xc054('0xf'));var authService=require(_0xc054('0x10'));var qs=require(_0xc054('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc054('0x12'))(_0xc054('0x13'));var utils=require(_0xc054('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc054('0x15'));var db=require(_0xc054('0x16'))['db'];function respondWithStatusCode(_0x239576,_0x145bb3){_0x145bb3=_0x145bb3||0xcc;return function(_0x50e1a2){if(_0x50e1a2){return _0x239576['sendStatus'](_0x145bb3);}return _0x239576[_0xc054('0x17')](_0x145bb3)[_0xc054('0x18')]();};}function respondWithResult(_0x1ce8c2,_0x3567d2){_0x3567d2=_0x3567d2||0xc8;return function(_0x4ebb3e){if(_0x4ebb3e){return _0x1ce8c2[_0xc054('0x17')](_0x3567d2)[_0xc054('0x19')](_0x4ebb3e);}};}function respondWithFilteredResult(_0x266430,_0x3e02fc){return function(_0x43a2cc){if(_0x43a2cc){var _0x40d519=typeof _0x3e02fc[_0xc054('0x1a')]==='undefined'&&typeof _0x3e02fc['limit']===_0xc054('0x1b');var _0x58aceb=_0x43a2cc['count'];var _0x399463=_0x40d519?0x0:_0x3e02fc[_0xc054('0x1a')];var _0x378ee9=_0x40d519?_0x43a2cc[_0xc054('0x1c')]:_0x3e02fc[_0xc054('0x1a')]+_0x3e02fc['limit'];var _0x19bf0d;if(_0x378ee9>=_0x58aceb){_0x378ee9=_0x58aceb;_0x19bf0d=0xc8;}else{_0x19bf0d=0xce;}_0x266430['status'](_0x19bf0d);return _0x266430[_0xc054('0x1d')](_0xc054('0x1e'),_0x399463+'-'+_0x378ee9+'/'+_0x58aceb)[_0xc054('0x19')](_0x43a2cc);}return null;};}function patchUpdates(_0x3fef53){return function(_0x557d6f){try{jsonpatch[_0xc054('0x1f')](_0x557d6f,_0x3fef53,!![]);}catch(_0x30d5a1){return BPromise[_0xc054('0x20')](_0x30d5a1);}return _0x557d6f[_0xc054('0x21')]();};}function saveUpdates(_0x4d9206,_0x1a75e6){return function(_0x513c08){if(_0x513c08){return _0x513c08[_0xc054('0x22')](_0x4d9206)[_0xc054('0x23')](function(_0x426238){return _0x426238;});}return null;};}function removeEntity(_0x5fed37,_0x17f4d9){return function(_0xb9b7cb){if(_0xb9b7cb){return _0xb9b7cb[_0xc054('0x24')]()[_0xc054('0x23')](function(){_0x5fed37[_0xc054('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c56f4,_0x3f151d){return function(_0x5184f9){if(!_0x5184f9){_0x3c56f4[_0xc054('0x25')](0x194);}return _0x5184f9;};}function handleError(_0xfc0e38,_0x4a08a5){_0x4a08a5=_0x4a08a5||0x1f4;return function(_0x29d153){logger[_0xc054('0x26')](_0x29d153[_0xc054('0x27')]);if(_0x29d153[_0xc054('0x28')]){delete _0x29d153['name'];}_0xfc0e38['status'](_0x4a08a5)[_0xc054('0x29')](_0x29d153);};}exports['index']=function(_0x5b3e5c,_0x1f0a6){var _0x3bf42d={},_0x47688b={},_0x2c5266={'count':0x0,'rows':[]};var _0x5058f1=_['map'](db[_0xc054('0x2a')]['rawAttributes'],function(_0x294d7f){return{'name':_0x294d7f['fieldName'],'type':_0x294d7f[_0xc054('0x2b')][_0xc054('0x2c')]};});_0x47688b['model']=_[_0xc054('0x2d')](_0x5058f1,'name');_0x47688b['query']=_[_0xc054('0x2e')](_0x5b3e5c[_0xc054('0x2f')]);_0x47688b[_0xc054('0x30')]=_[_0xc054('0x31')](_0x47688b[_0xc054('0x32')],_0x47688b[_0xc054('0x2f')]);_0x3bf42d[_0xc054('0x33')]=_['intersection'](_0x47688b[_0xc054('0x32')],qs[_0xc054('0x34')](_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x34')]));_0x3bf42d['attributes']=_0x3bf42d[_0xc054('0x33')][_0xc054('0x35')]?_0x3bf42d['attributes']:_0x47688b[_0xc054('0x32')];if(!_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x36')](_0xc054('0x37'))){_0x3bf42d[_0xc054('0x38')]=qs['limit'](_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x38')]);_0x3bf42d['offset']=qs[_0xc054('0x1a')](_0x5b3e5c['query'][_0xc054('0x1a')]);}_0x3bf42d[_0xc054('0x39')]=qs[_0xc054('0x3a')](_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x3a')]);_0x3bf42d[_0xc054('0x3b')]=qs['filters'](_[_0xc054('0x3c')](_0x5b3e5c[_0xc054('0x2f')],_0x47688b[_0xc054('0x30')]),_0x5058f1);if(_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x3d')]){_0x3bf42d[_0xc054('0x3b')]=_[_0xc054('0x3e')](_0x3bf42d[_0xc054('0x3b')],{'$or':_[_0xc054('0x2d')](_0x5058f1,function(_0x36f0b2){if(_0x36f0b2[_0xc054('0x2b')]!=='VIRTUAL'){var _0x2b1acf={};_0x2b1acf[_0x36f0b2[_0xc054('0x28')]]={'$like':'%'+_0x5b3e5c['query'][_0xc054('0x3d')]+'%'};return _0x2b1acf;}})});}_0x3bf42d=_[_0xc054('0x3e')]({},_0x3bf42d,_0x5b3e5c[_0xc054('0x3f')]);var _0x36224={'where':_0x3bf42d[_0xc054('0x3b')]};return db[_0xc054('0x2a')]['count'](_0x36224)[_0xc054('0x23')](function(_0x102f2c){_0x2c5266[_0xc054('0x1c')]=_0x102f2c;if(_0x5b3e5c[_0xc054('0x2f')]['includeAll']){_0x3bf42d['include']=[{'all':!![]}];}return db[_0xc054('0x2a')][_0xc054('0x40')](_0x3bf42d);})['then'](function(_0x67d4e1){_0x2c5266['rows']=_0x67d4e1;return _0x2c5266;})[_0xc054('0x23')](respondWithFilteredResult(_0x1f0a6,_0x3bf42d))[_0xc054('0x41')](handleError(_0x1f0a6,null));};exports[_0xc054('0x42')]=function(_0x16e09b,_0x34bccf){var _0x5f70ba={'raw':!![],'where':{'id':_0x16e09b[_0xc054('0x43')]['id']}},_0x39ffe5={};_0x39ffe5[_0xc054('0x32')]=_[_0xc054('0x2e')](db[_0xc054('0x2a')][_0xc054('0x44')]);_0x39ffe5[_0xc054('0x2f')]=_[_0xc054('0x2e')](_0x16e09b[_0xc054('0x2f')]);_0x39ffe5[_0xc054('0x30')]=_[_0xc054('0x31')](_0x39ffe5[_0xc054('0x32')],_0x39ffe5['query']);_0x5f70ba[_0xc054('0x33')]=_[_0xc054('0x31')](_0x39ffe5[_0xc054('0x32')],qs[_0xc054('0x34')](_0x16e09b[_0xc054('0x2f')]['fields']));_0x5f70ba[_0xc054('0x33')]=_0x5f70ba['attributes'][_0xc054('0x35')]?_0x5f70ba['attributes']:_0x39ffe5[_0xc054('0x32')];if(_0x16e09b['query'][_0xc054('0x45')]){_0x5f70ba['include']=[{'all':!![]}];}_0x5f70ba=_[_0xc054('0x3e')]({},_0x5f70ba,_0x16e09b[_0xc054('0x3f')]);return db[_0xc054('0x2a')][_0xc054('0x46')](_0x5f70ba)[_0xc054('0x23')](handleEntityNotFound(_0x34bccf,null))[_0xc054('0x23')](respondWithResult(_0x34bccf,null))[_0xc054('0x41')](handleError(_0x34bccf,null));};exports[_0xc054('0x47')]=function(_0x47b83b,_0x41e3c8){return db[_0xc054('0x2a')][_0xc054('0x47')](_0x47b83b[_0xc054('0x48')],{})[_0xc054('0x23')](respondWithResult(_0x41e3c8,0xc9))[_0xc054('0x41')](handleError(_0x41e3c8,null));};exports[_0xc054('0x22')]=function(_0x4f1173,_0xb053eb){if(_0x4f1173[_0xc054('0x48')]['id']){delete _0x4f1173[_0xc054('0x48')]['id'];}return db[_0xc054('0x2a')][_0xc054('0x46')]({'where':{'id':_0x4f1173[_0xc054('0x43')]['id']}})[_0xc054('0x23')](handleEntityNotFound(_0xb053eb,null))['then'](saveUpdates(_0x4f1173[_0xc054('0x48')],null))[_0xc054('0x23')](respondWithResult(_0xb053eb,null))['catch'](handleError(_0xb053eb,null));};exports[_0xc054('0x24')]=function(_0xb3b2d,_0xe836b0){return db[_0xc054('0x2a')][_0xc054('0x46')]({'where':{'id':_0xb3b2d[_0xc054('0x43')]['id']}})['then'](handleEntityNotFound(_0xe836b0,null))[_0xc054('0x23')](removeEntity(_0xe836b0,null))[_0xc054('0x41')](handleError(_0xe836b0,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 688b7b5..547bb59 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 _0x96f7=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','mail_servers_out','lodash'];(function(_0x4af2ef,_0x575f31){var _0x230332=function(_0x29793d){while(--_0x29793d){_0x4af2ef['push'](_0x4af2ef['shift']());}};_0x230332(++_0x575f31);}(_0x96f7,0x180));var _0x796f=function(_0x399131,_0x2db855){_0x399131=_0x399131-0x0;var _0xce76e2=_0x96f7[_0x399131];return _0xce76e2;};'use strict';var _=require(_0x796f('0x0'));var util=require(_0x796f('0x1'));var logger=require(_0x796f('0x2'))(_0x796f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x796f('0x4'));var fs=require('fs');var path=require(_0x796f('0x5'));var rimraf=require(_0x796f('0x6'));var config=require(_0x796f('0x7'));var attributes=require(_0x796f('0x8'));module[_0x796f('0x9')]=function(_0x31c635,_0x1311a5){return _0x31c635['define']('MailServerOut',attributes,{'tableName':_0x796f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb110=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xb110,0xc8));var _0x0b11=function(_0x597a77,_0x36501d){_0x597a77=_0x597a77-0x0;var _0x28259a=_0xb110[_0x597a77];return _0x28259a;};'use strict';var _=require(_0x0b11('0x0'));var util=require(_0x0b11('0x1'));var logger=require(_0x0b11('0x2'))(_0x0b11('0x3'));var moment=require(_0x0b11('0x4'));var BPromise=require(_0x0b11('0x5'));var rp=require(_0x0b11('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0b11('0x7'));var attributes=require(_0x0b11('0x8'));module[_0x0b11('0x9')]=function(_0x3b6b6c,_0x2bbbab){return _0x3b6b6c[_0x0b11('0xa')](_0x0b11('0xb'),attributes,{'tableName':_0x0b11('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 6b3cdef..0f92908 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x5d4ee7,_0x43961b){_0x5d4ee7=_0x5d4ee7-0x0;var _0x501cbb=_0x7a54[_0x5d4ee7];return _0x501cbb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x276b3f,_0x38ba13){var _0x4a60b0=function(_0x3fb651){while(--_0x3fb651){_0x276b3f['push'](_0x276b3f['shift']());}};_0x4a60b0(++_0x38ba13);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ffbdab5..17a1886 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 _0x8e47=['describe','/:id','show','post','create','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe'];(function(_0x20ba62,_0x539a35){var _0x4cf2d0=function(_0x4686db){while(--_0x4686db){_0x20ba62['push'](_0x20ba62['shift']());}};_0x4cf2d0(++_0x539a35);}(_0x8e47,0x1b8));var _0x78e4=function(_0x21c09f,_0x6ce866){_0x21c09f=_0x21c09f-0x0;var _0x164d58=_0x8e47[_0x21c09f];return _0x164d58;};'use strict';var multer=require(_0x78e4('0x0'));var util=require('util');var path=require(_0x78e4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78e4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x78e4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x78e4('0x4'));var controller=require(_0x78e4('0x5'));router['get']('/',auth[_0x78e4('0x6')](),controller[_0x78e4('0x7')]);router[_0x78e4('0x8')](_0x78e4('0x9'),auth[_0x78e4('0x6')](),controller[_0x78e4('0xa')]);router['get'](_0x78e4('0xb'),auth[_0x78e4('0x6')](),controller[_0x78e4('0xc')]);router[_0x78e4('0xd')]('/',auth[_0x78e4('0x6')](),controller[_0x78e4('0xe')]);router['put']('/:id',auth[_0x78e4('0x6')](),controller['update']);router[_0x78e4('0xf')](_0x78e4('0xb'),auth[_0x78e4('0x6')](),controller[_0x78e4('0x10')]);module[_0x78e4('0x11')]=router; \ No newline at end of file +var _0x7b16=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x163053,_0x27ddb9){var _0x5e09b9=function(_0x24c395){while(--_0x24c395){_0x163053['push'](_0x163053['shift']());}};_0x5e09b9(++_0x27ddb9);}(_0x7b16,0xdb));var _0x67b1=function(_0x19abc7,_0x5aadb6){_0x19abc7=_0x19abc7-0x0;var _0xc24f10=_0x7b16[_0x19abc7];return _0xc24f10;};'use strict';var multer=require(_0x67b1('0x0'));var util=require(_0x67b1('0x1'));var path=require(_0x67b1('0x2'));var timeout=require(_0x67b1('0x3'));var express=require(_0x67b1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x67b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x67b1('0x6'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x67b1('0x7')](),controller[_0x67b1('0x8')]);router[_0x67b1('0x9')](_0x67b1('0xa'),auth[_0x67b1('0x7')](),controller[_0x67b1('0xb')]);router[_0x67b1('0x9')](_0x67b1('0xc'),auth[_0x67b1('0x7')](),controller[_0x67b1('0xd')]);router[_0x67b1('0xe')]('/',auth[_0x67b1('0x7')](),controller[_0x67b1('0xf')]);router['put'](_0x67b1('0xc'),auth[_0x67b1('0x7')](),controller[_0x67b1('0x10')]);router[_0x67b1('0x11')](_0x67b1('0xc'),auth['isAuthenticated'](),controller[_0x67b1('0x12')]);module[_0x67b1('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1a8fd64..f73e45f 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 _0xef17=['STRING','name','sequelize','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xef17,0x136));var _0x7ef1=function(_0x17a98d,_0x124be4){_0x17a98d=_0x17a98d-0x0;var _0x4c2c6c=_0xef17[_0x17a98d];return _0x4c2c6c;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')],'unique':_0x7ef1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7ef1('0x2')]}}; \ No newline at end of file +var _0x8506=['exports','name'];(function(_0x4cf475,_0x28d90c){var _0x5e7871=function(_0x5186c6){while(--_0x5186c6){_0x4cf475['push'](_0x4cf475['shift']());}};_0x5e7871(++_0x28d90c);}(_0x8506,0xe8));var _0x6850=function(_0x40d37b,_0x2734db){_0x40d37b=_0x40d37b-0x0;var _0x55d2be=_0x8506[_0x40d37b];return _0x55d2be;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6850('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a1f5859..e0f92ef 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 _0xe915=['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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','map','rawAttributes','fieldName','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','type','options','MailSubstatus','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2dedfa,_0x1fb9d6){var _0x10c65d=function(_0x23bb50){while(--_0x23bb50){_0x2dedfa['push'](_0x2dedfa['shift']());}};_0x10c65d(++_0x1fb9d6);}(_0xe915,0x1c6));var _0x5e91=function(_0x5ab9da,_0x572d7d){_0x5ab9da=_0x5ab9da-0x0;var _0x1aa487=_0xe915[_0x5ab9da];return _0x1aa487;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e91('0x0'));var zipdir=require(_0x5e91('0x1'));var jsonpatch=require(_0x5e91('0x2'));var rp=require(_0x5e91('0x3'));var moment=require(_0x5e91('0x4'));var BPromise=require(_0x5e91('0x5'));var Mustache=require(_0x5e91('0x6'));var util=require(_0x5e91('0x7'));var path=require('path');var sox=require(_0x5e91('0x8'));var csv=require('to-csv');var ejs=require(_0x5e91('0x9'));var fs=require('fs');var fs_extra=require(_0x5e91('0xa'));var _=require(_0x5e91('0xb'));var squel=require(_0x5e91('0xc'));var crypto=require(_0x5e91('0xd'));var jsforce=require(_0x5e91('0xe'));var deskjs=require(_0x5e91('0xf'));var toCsv=require(_0x5e91('0x10'));var querystring=require(_0x5e91('0x11'));var Papa=require('papaparse');var Redis=require(_0x5e91('0x12'));var authService=require(_0x5e91('0x13'));var qs=require(_0x5e91('0x14'));var as=require(_0x5e91('0x15'));var hardwareService=require(_0x5e91('0x16'));var logger=require(_0x5e91('0x17'))(_0x5e91('0x18'));var utils=require(_0x5e91('0x19'));var config=require(_0x5e91('0x1a'));var licenseUtil=require(_0x5e91('0x1b'));var db=require(_0x5e91('0x1c'))['db'];function respondWithStatusCode(_0x326a06,_0x4c271a){_0x4c271a=_0x4c271a||0xcc;return function(_0x1a8f63){if(_0x1a8f63){return _0x326a06['sendStatus'](_0x4c271a);}return _0x326a06[_0x5e91('0x1d')](_0x4c271a)[_0x5e91('0x1e')]();};}function respondWithResult(_0x58c6ec,_0x4f0aa4){_0x4f0aa4=_0x4f0aa4||0xc8;return function(_0x67449d){if(_0x67449d){return _0x58c6ec[_0x5e91('0x1d')](_0x4f0aa4)[_0x5e91('0x1f')](_0x67449d);}};}function respondWithFilteredResult(_0x5e6a07,_0x4b802e){return function(_0x4564e6){if(_0x4564e6){var _0x1b2f23=typeof _0x4b802e[_0x5e91('0x20')]===_0x5e91('0x21')&&typeof _0x4b802e[_0x5e91('0x22')]==='undefined';var _0x13cd5f=_0x4564e6['count'];var _0x14bdb6=_0x1b2f23?0x0:_0x4b802e[_0x5e91('0x20')];var _0x20dece=_0x1b2f23?_0x4564e6[_0x5e91('0x23')]:_0x4b802e['offset']+_0x4b802e[_0x5e91('0x22')];var _0x427400;if(_0x20dece>=_0x13cd5f){_0x20dece=_0x13cd5f;_0x427400=0xc8;}else{_0x427400=0xce;}_0x5e6a07[_0x5e91('0x1d')](_0x427400);return _0x5e6a07[_0x5e91('0x24')]('Content-Range',_0x14bdb6+'-'+_0x20dece+'/'+_0x13cd5f)[_0x5e91('0x1f')](_0x4564e6);}return null;};}function patchUpdates(_0x950d76){return function(_0x474679){try{jsonpatch[_0x5e91('0x25')](_0x474679,_0x950d76,!![]);}catch(_0x425e86){return BPromise[_0x5e91('0x26')](_0x425e86);}return _0x474679[_0x5e91('0x27')]();};}function saveUpdates(_0x403112,_0x210676){return function(_0x3e6c6d){if(_0x3e6c6d){return _0x3e6c6d[_0x5e91('0x28')](_0x403112)[_0x5e91('0x29')](function(_0x1f2258){return _0x1f2258;});}return null;};}function removeEntity(_0x4208ad,_0xc069b1){return function(_0xb67307){if(_0xb67307){return _0xb67307['destroy']()[_0x5e91('0x29')](function(){_0x4208ad[_0x5e91('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x528cba,_0x1fbcb3){return function(_0x57c0ea){if(!_0x57c0ea){_0x528cba['sendStatus'](0x194);}return _0x57c0ea;};}function handleError(_0x5c0803,_0x3c79a0){_0x3c79a0=_0x3c79a0||0x1f4;return function(_0x2a6f0a){logger[_0x5e91('0x2a')](_0x2a6f0a[_0x5e91('0x2b')]);if(_0x2a6f0a[_0x5e91('0x2c')]){delete _0x2a6f0a[_0x5e91('0x2c')];}_0x5c0803['status'](_0x3c79a0)['send'](_0x2a6f0a);};}exports['index']=function(_0x3c2be6,_0x97526){var _0x673d41={},_0x349d94={},_0x415af4={'count':0x0,'rows':[]};var _0x4c15fc=_[_0x5e91('0x2d')](db['MailSubstatus'][_0x5e91('0x2e')],function(_0x5073b9){return{'name':_0x5073b9[_0x5e91('0x2f')],'type':_0x5073b9['type']['key']};});_0x349d94[_0x5e91('0x30')]=_['map'](_0x4c15fc,_0x5e91('0x2c'));_0x349d94['query']=_[_0x5e91('0x31')](_0x3c2be6['query']);_0x349d94['filters']=_['intersection'](_0x349d94[_0x5e91('0x30')],_0x349d94[_0x5e91('0x32')]);_0x673d41['attributes']=_[_0x5e91('0x33')](_0x349d94[_0x5e91('0x30')],qs[_0x5e91('0x34')](_0x3c2be6['query'][_0x5e91('0x34')]));_0x673d41[_0x5e91('0x35')]=_0x673d41[_0x5e91('0x35')][_0x5e91('0x36')]?_0x673d41[_0x5e91('0x35')]:_0x349d94[_0x5e91('0x30')];if(!_0x3c2be6[_0x5e91('0x32')]['hasOwnProperty'](_0x5e91('0x37'))){_0x673d41[_0x5e91('0x22')]=qs['limit'](_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x22')]);_0x673d41[_0x5e91('0x20')]=qs[_0x5e91('0x20')](_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x20')]);}_0x673d41[_0x5e91('0x38')]=qs['sort'](_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x39')]);_0x673d41['where']=qs[_0x5e91('0x3a')](_[_0x5e91('0x3b')](_0x3c2be6[_0x5e91('0x32')],_0x349d94[_0x5e91('0x3a')]),_0x4c15fc);if(_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x3c')]){_0x673d41[_0x5e91('0x3d')]=_[_0x5e91('0x3e')](_0x673d41[_0x5e91('0x3d')],{'$or':_[_0x5e91('0x2d')](_0x4c15fc,function(_0x5785cf){if(_0x5785cf[_0x5e91('0x3f')]!=='VIRTUAL'){var _0x566b9c={};_0x566b9c[_0x5785cf[_0x5e91('0x2c')]]={'$like':'%'+_0x3c2be6[_0x5e91('0x32')][_0x5e91('0x3c')]+'%'};return _0x566b9c;}})});}_0x673d41=_[_0x5e91('0x3e')]({},_0x673d41,_0x3c2be6[_0x5e91('0x40')]);var _0x364be7={'where':_0x673d41[_0x5e91('0x3d')]};return db[_0x5e91('0x41')][_0x5e91('0x23')](_0x364be7)[_0x5e91('0x29')](function(_0x35a470){_0x415af4[_0x5e91('0x23')]=_0x35a470;if(_0x3c2be6['query'][_0x5e91('0x42')]){_0x673d41[_0x5e91('0x43')]=[{'all':!![]}];}return db[_0x5e91('0x41')][_0x5e91('0x44')](_0x673d41);})[_0x5e91('0x29')](function(_0x59582f){_0x415af4[_0x5e91('0x45')]=_0x59582f;return _0x415af4;})[_0x5e91('0x29')](respondWithFilteredResult(_0x97526,_0x673d41))[_0x5e91('0x46')](handleError(_0x97526,null));};exports[_0x5e91('0x47')]=function(_0x31d059,_0x20d4a3){var _0x18855e={'raw':!![],'where':{'id':_0x31d059[_0x5e91('0x48')]['id']}},_0x50ba9a={};_0x50ba9a[_0x5e91('0x30')]=_[_0x5e91('0x31')](db[_0x5e91('0x41')][_0x5e91('0x2e')]);_0x50ba9a[_0x5e91('0x32')]=_[_0x5e91('0x31')](_0x31d059[_0x5e91('0x32')]);_0x50ba9a[_0x5e91('0x3a')]=_[_0x5e91('0x33')](_0x50ba9a[_0x5e91('0x30')],_0x50ba9a[_0x5e91('0x32')]);_0x18855e['attributes']=_[_0x5e91('0x33')](_0x50ba9a[_0x5e91('0x30')],qs[_0x5e91('0x34')](_0x31d059['query']['fields']));_0x18855e['attributes']=_0x18855e['attributes']['length']?_0x18855e[_0x5e91('0x35')]:_0x50ba9a[_0x5e91('0x30')];if(_0x31d059[_0x5e91('0x32')]['includeAll']){_0x18855e['include']=[{'all':!![]}];}_0x18855e=_[_0x5e91('0x3e')]({},_0x18855e,_0x31d059[_0x5e91('0x40')]);return db[_0x5e91('0x41')]['find'](_0x18855e)[_0x5e91('0x29')](handleEntityNotFound(_0x20d4a3,null))[_0x5e91('0x29')](respondWithResult(_0x20d4a3,null))[_0x5e91('0x46')](handleError(_0x20d4a3,null));};exports['create']=function(_0x749ed4,_0x3bfe33){return db[_0x5e91('0x41')][_0x5e91('0x49')](_0x749ed4['body'],{})[_0x5e91('0x29')](respondWithResult(_0x3bfe33,0xc9))[_0x5e91('0x46')](handleError(_0x3bfe33,null));};exports[_0x5e91('0x28')]=function(_0x160138,_0x2845b2){if(_0x160138[_0x5e91('0x4a')]['id']){delete _0x160138['body']['id'];}return db['MailSubstatus'][_0x5e91('0x4b')]({'where':{'id':_0x160138['params']['id']}})[_0x5e91('0x29')](handleEntityNotFound(_0x2845b2,null))[_0x5e91('0x29')](saveUpdates(_0x160138[_0x5e91('0x4a')],null))['then'](respondWithResult(_0x2845b2,null))[_0x5e91('0x46')](handleError(_0x2845b2,null));};exports['destroy']=function(_0x2d4e33,_0x22b7d8){return db[_0x5e91('0x41')][_0x5e91('0x4b')]({'where':{'id':_0x2d4e33[_0x5e91('0x48')]['id']}})[_0x5e91('0x29')](handleEntityNotFound(_0x22b7d8,null))['then'](removeEntity(_0x22b7d8,null))[_0x5e91('0x46')](handleError(_0x22b7d8,null));};exports[_0x5e91('0x4c')]=function(_0x41f553,_0x9cf299){return db[_0x5e91('0x41')][_0x5e91('0x4c')]()['then'](respondWithResult(_0x9cf299,null))[_0x5e91('0x46')](handleError(_0x9cf299,null));}; \ No newline at end of file +var _0x7442=['json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','MailSubstatus','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x456424,_0x5cd8b4){var _0x1f925f=function(_0x544553){while(--_0x544553){_0x456424['push'](_0x456424['shift']());}};_0x1f925f(++_0x5cd8b4);}(_0x7442,0x115));var _0x2744=function(_0xabb8a1,_0x5ed479){_0xabb8a1=_0xabb8a1-0x0;var _0x9a4673=_0x7442[_0xabb8a1];return _0x9a4673;};'use strict';var emlformat=require(_0x2744('0x0'));var rimraf=require(_0x2744('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2744('0x2'));var rp=require(_0x2744('0x3'));var moment=require(_0x2744('0x4'));var BPromise=require(_0x2744('0x5'));var Mustache=require(_0x2744('0x6'));var util=require('util');var path=require(_0x2744('0x7'));var sox=require('sox');var csv=require(_0x2744('0x8'));var ejs=require(_0x2744('0x9'));var fs=require('fs');var fs_extra=require(_0x2744('0xa'));var _=require(_0x2744('0xb'));var squel=require(_0x2744('0xc'));var crypto=require('crypto');var jsforce=require(_0x2744('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2744('0x8'));var querystring=require(_0x2744('0xe'));var Papa=require(_0x2744('0xf'));var Redis=require(_0x2744('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2744('0x11'));var as=require(_0x2744('0x12'));var hardwareService=require(_0x2744('0x13'));var logger=require(_0x2744('0x14'))(_0x2744('0x15'));var utils=require('../../config/utils');var config=require(_0x2744('0x16'));var licenseUtil=require(_0x2744('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23ec3b,_0x485186){_0x485186=_0x485186||0xcc;return function(_0x146564){if(_0x146564){return _0x23ec3b[_0x2744('0x18')](_0x485186);}return _0x23ec3b[_0x2744('0x19')](_0x485186)[_0x2744('0x1a')]();};}function respondWithResult(_0x3d9686,_0x520aa3){_0x520aa3=_0x520aa3||0xc8;return function(_0x106223){if(_0x106223){return _0x3d9686[_0x2744('0x19')](_0x520aa3)[_0x2744('0x1b')](_0x106223);}};}function respondWithFilteredResult(_0xa38d52,_0x262102){return function(_0x774914){if(_0x774914){var _0x385a19=typeof _0x262102[_0x2744('0x1c')]==='undefined'&&typeof _0x262102['limit']===_0x2744('0x1d');var _0x5249c9=_0x774914[_0x2744('0x1e')];var _0x3e3aba=_0x385a19?0x0:_0x262102[_0x2744('0x1c')];var _0x1e7711=_0x385a19?_0x774914[_0x2744('0x1e')]:_0x262102['offset']+_0x262102['limit'];var _0x50dea4;if(_0x1e7711>=_0x5249c9){_0x1e7711=_0x5249c9;_0x50dea4=0xc8;}else{_0x50dea4=0xce;}_0xa38d52[_0x2744('0x19')](_0x50dea4);return _0xa38d52[_0x2744('0x1f')](_0x2744('0x20'),_0x3e3aba+'-'+_0x1e7711+'/'+_0x5249c9)['json'](_0x774914);}return null;};}function patchUpdates(_0x421bdb){return function(_0x53a1cc){try{jsonpatch[_0x2744('0x21')](_0x53a1cc,_0x421bdb,!![]);}catch(_0x160dad){return BPromise[_0x2744('0x22')](_0x160dad);}return _0x53a1cc[_0x2744('0x23')]();};}function saveUpdates(_0x2b0a31,_0x2f37e7){return function(_0x4b326c){if(_0x4b326c){return _0x4b326c[_0x2744('0x24')](_0x2b0a31)[_0x2744('0x25')](function(_0x3d3ddb){return _0x3d3ddb;});}return null;};}function removeEntity(_0x1168f1,_0x6f586c){return function(_0x16d110){if(_0x16d110){return _0x16d110['destroy']()[_0x2744('0x25')](function(){_0x1168f1[_0x2744('0x19')](0xcc)[_0x2744('0x1a')]();});}};}function handleEntityNotFound(_0x46861e,_0x1b5bc7){return function(_0x4e3f7f){if(!_0x4e3f7f){_0x46861e[_0x2744('0x18')](0x194);}return _0x4e3f7f;};}function handleError(_0x36e870,_0x4c7b2f){_0x4c7b2f=_0x4c7b2f||0x1f4;return function(_0x8cc17e){logger[_0x2744('0x26')](_0x8cc17e['stack']);if(_0x8cc17e[_0x2744('0x27')]){delete _0x8cc17e[_0x2744('0x27')];}_0x36e870['status'](_0x4c7b2f)[_0x2744('0x28')](_0x8cc17e);};}exports['index']=function(_0x4bca8d,_0xcfc572){var _0x3580e0={},_0x900cc2={},_0x3245ff={'count':0x0,'rows':[]};var _0x438466=_[_0x2744('0x29')](db['MailSubstatus'][_0x2744('0x2a')],function(_0x1d1507){return{'name':_0x1d1507[_0x2744('0x2b')],'type':_0x1d1507['type'][_0x2744('0x2c')]};});_0x900cc2[_0x2744('0x2d')]=_['map'](_0x438466,'name');_0x900cc2[_0x2744('0x2e')]=_[_0x2744('0x2f')](_0x4bca8d[_0x2744('0x2e')]);_0x900cc2[_0x2744('0x30')]=_['intersection'](_0x900cc2[_0x2744('0x2d')],_0x900cc2[_0x2744('0x2e')]);_0x3580e0[_0x2744('0x31')]=_[_0x2744('0x32')](_0x900cc2[_0x2744('0x2d')],qs['fields'](_0x4bca8d[_0x2744('0x2e')][_0x2744('0x33')]));_0x3580e0[_0x2744('0x31')]=_0x3580e0[_0x2744('0x31')][_0x2744('0x34')]?_0x3580e0[_0x2744('0x31')]:_0x900cc2[_0x2744('0x2d')];if(!_0x4bca8d[_0x2744('0x2e')][_0x2744('0x35')](_0x2744('0x36'))){_0x3580e0[_0x2744('0x37')]=qs[_0x2744('0x37')](_0x4bca8d['query'][_0x2744('0x37')]);_0x3580e0[_0x2744('0x1c')]=qs['offset'](_0x4bca8d[_0x2744('0x2e')][_0x2744('0x1c')]);}_0x3580e0[_0x2744('0x38')]=qs[_0x2744('0x39')](_0x4bca8d[_0x2744('0x2e')]['sort']);_0x3580e0[_0x2744('0x3a')]=qs[_0x2744('0x30')](_[_0x2744('0x3b')](_0x4bca8d['query'],_0x900cc2[_0x2744('0x30')]),_0x438466);if(_0x4bca8d['query'][_0x2744('0x3c')]){_0x3580e0[_0x2744('0x3a')]=_[_0x2744('0x3d')](_0x3580e0['where'],{'$or':_[_0x2744('0x29')](_0x438466,function(_0x210ace){if(_0x210ace['type']!==_0x2744('0x3e')){var _0x246236={};_0x246236[_0x210ace[_0x2744('0x27')]]={'$like':'%'+_0x4bca8d[_0x2744('0x2e')][_0x2744('0x3c')]+'%'};return _0x246236;}})});}_0x3580e0=_[_0x2744('0x3d')]({},_0x3580e0,_0x4bca8d['options']);var _0x4aa69a={'where':_0x3580e0['where']};return db[_0x2744('0x3f')][_0x2744('0x1e')](_0x4aa69a)[_0x2744('0x25')](function(_0x4ca6bd){_0x3245ff['count']=_0x4ca6bd;if(_0x4bca8d[_0x2744('0x2e')][_0x2744('0x40')]){_0x3580e0[_0x2744('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0x2744('0x42')](_0x3580e0);})[_0x2744('0x25')](function(_0x4f876){_0x3245ff[_0x2744('0x43')]=_0x4f876;return _0x3245ff;})['then'](respondWithFilteredResult(_0xcfc572,_0x3580e0))[_0x2744('0x44')](handleError(_0xcfc572,null));};exports[_0x2744('0x45')]=function(_0xb6135e,_0x59564d){var _0x262095={'raw':!![],'where':{'id':_0xb6135e['params']['id']}},_0x1f65e6={};_0x1f65e6[_0x2744('0x2d')]=_[_0x2744('0x2f')](db['MailSubstatus'][_0x2744('0x2a')]);_0x1f65e6['query']=_[_0x2744('0x2f')](_0xb6135e[_0x2744('0x2e')]);_0x1f65e6[_0x2744('0x30')]=_[_0x2744('0x32')](_0x1f65e6[_0x2744('0x2d')],_0x1f65e6[_0x2744('0x2e')]);_0x262095[_0x2744('0x31')]=_[_0x2744('0x32')](_0x1f65e6[_0x2744('0x2d')],qs[_0x2744('0x33')](_0xb6135e[_0x2744('0x2e')][_0x2744('0x33')]));_0x262095['attributes']=_0x262095[_0x2744('0x31')][_0x2744('0x34')]?_0x262095['attributes']:_0x1f65e6[_0x2744('0x2d')];if(_0xb6135e[_0x2744('0x2e')][_0x2744('0x40')]){_0x262095[_0x2744('0x41')]=[{'all':!![]}];}_0x262095=_['merge']({},_0x262095,_0xb6135e[_0x2744('0x46')]);return db[_0x2744('0x3f')][_0x2744('0x47')](_0x262095)[_0x2744('0x25')](handleEntityNotFound(_0x59564d,null))['then'](respondWithResult(_0x59564d,null))[_0x2744('0x44')](handleError(_0x59564d,null));};exports[_0x2744('0x48')]=function(_0x133339,_0x928c3c){return db['MailSubstatus'][_0x2744('0x48')](_0x133339[_0x2744('0x49')],{})[_0x2744('0x25')](respondWithResult(_0x928c3c,0xc9))[_0x2744('0x44')](handleError(_0x928c3c,null));};exports[_0x2744('0x24')]=function(_0xb5776b,_0x48df83){if(_0xb5776b['body']['id']){delete _0xb5776b['body']['id'];}return db[_0x2744('0x3f')][_0x2744('0x47')]({'where':{'id':_0xb5776b[_0x2744('0x4a')]['id']}})[_0x2744('0x25')](handleEntityNotFound(_0x48df83,null))[_0x2744('0x25')](saveUpdates(_0xb5776b[_0x2744('0x49')],null))[_0x2744('0x25')](respondWithResult(_0x48df83,null))['catch'](handleError(_0x48df83,null));};exports['destroy']=function(_0x8cfc0c,_0x9a23f1){return db[_0x2744('0x3f')]['find']({'where':{'id':_0x8cfc0c['params']['id']}})['then'](handleEntityNotFound(_0x9a23f1,null))['then'](removeEntity(_0x9a23f1,null))[_0x2744('0x44')](handleError(_0x9a23f1,null));};exports[_0x2744('0x4b')]=function(_0xbcdd91,_0x1b8711){return db[_0x2744('0x3f')][_0x2744('0x4b')]()[_0x2744('0x25')](respondWithResult(_0x1b8711,null))['catch'](handleError(_0x1b8711,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 627714c..0e1bbae 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 _0x36bb=['hasOwnProperty','hook','events','update','emit'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x36bb,0x70));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb36b('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xb36b('0x1')};function emitEvent(_0x338152){return function(_0x4ff8c6,_0x3fe00e,_0x11d241){MailSubstatusEvents[_0xb36b('0x2')](_0x338152+':'+_0x4ff8c6['id'],_0x4ff8c6);MailSubstatusEvents[_0xb36b('0x2')](_0x338152,_0x4ff8c6);_0x11d241(null);};}for(var e in events){if(events[_0xb36b('0x3')](e)){var event=events[e];MailSubstatus[_0xb36b('0x4')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x38fb=['MailSubstatus','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5372ec,_0x22d7a5){var _0x25cb86=function(_0x2680ed){while(--_0x2680ed){_0x5372ec['push'](_0x5372ec['shift']());}};_0x25cb86(++_0x22d7a5);}(_0x38fb,0x76));var _0xb38f=function(_0x8fb092,_0x883290){_0x8fb092=_0x8fb092-0x0;var _0xd63883=_0x38fb[_0x8fb092];return _0xd63883;};'use strict';var EventEmitter=require(_0xb38f('0x0'));var MailSubstatus=require(_0xb38f('0x1'))['db'][_0xb38f('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xb38f('0x3')};function emitEvent(_0xfa9f5b){return function(_0x26f673,_0xe1cc86,_0x4a743f){MailSubstatusEvents[_0xb38f('0x4')](_0xfa9f5b+':'+_0x26f673['id'],_0x26f673);MailSubstatusEvents[_0xb38f('0x4')](_0xfa9f5b,_0x26f673);_0x4a743f(null);};}for(var e in events){if(events[_0xb38f('0x5')](e)){var event=events[e];MailSubstatus[_0xb38f('0x6')](e,emitEvent(event));}}module[_0xb38f('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f02d1c9..a138111 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 _0x9ccd=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','MailSubstatus','Condition','update'];(function(_0x13c304,_0x4791de){var _0x12696e=function(_0x2070d4){while(--_0x2070d4){_0x13c304['push'](_0x13c304['shift']());}};_0x12696e(++_0x4791de);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xd9cc('0x0'));module['exports']=function(_0x29ce42){var _0x3ad6c4=_0x29ce42['models'];return _0x29ce42['define'](_0xd9cc('0x1'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xe2426f,_0x296228,_0x425ab8){return _0x3ad6c4[_0xd9cc('0x2')][_0xd9cc('0x3')]({'value':_0xe2426f[_0xd9cc('0x4')]},{'where':{'field':_0xd9cc('0x5'),'value':_0xe2426f[_0xd9cc('0x6')][_0xd9cc('0x4')]}})[_0xd9cc('0x7')](function(){_0x425ab8();})[_0xd9cc('0x8')](function(_0x25b38e){_0x425ab8(_0x25b38e);});}}});}; \ No newline at end of file +var _0x31f5=['define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','then','catch','./mailSubstatus.attributes','models'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31f5,0x1ac));var _0x531f=function(_0x1bb026,_0x1053b5){_0x1bb026=_0x1bb026-0x0;var _0x1c72f8=_0x31f5[_0x1bb026];return _0x1c72f8;};'use strict';var attributes=require(_0x531f('0x0'));module['exports']=function(_0x35d6d2){var _0x333793=_0x35d6d2[_0x531f('0x1')];return _0x35d6d2[_0x531f('0x2')](_0x531f('0x3'),attributes,{'tableName':_0x531f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x51e566,_0x581d1a,_0x429451){return _0x333793[_0x531f('0x5')]['update']({'value':_0x51e566[_0x531f('0x6')]},{'where':{'field':_0x531f('0x7'),'value':_0x51e566['_previousDataValues']['name']}})[_0x531f('0x8')](function(){_0x429451();})[_0x531f('0x9')](function(_0xce9d79){_0x429451(_0xce9d79);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 47aa786..07c2de6 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 _0x7502=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x369c69,_0x1fc38c){var _0x193bd8=function(_0x5ec181){while(--_0x5ec181){_0x369c69['push'](_0x369c69['shift']());}};_0x193bd8(++_0x1fc38c);}(_0x7502,0x128));var _0x2750=function(_0x19365e,_0x5f440d){_0x19365e=_0x19365e-0x0;var _0x31302a=_0x7502[_0x19365e];return _0x31302a;};'use strict';var _=require(_0x2750('0x0'));var util=require(_0x2750('0x1'));var moment=require(_0x2750('0x2'));var BPromise=require(_0x2750('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2750('0x4'));var db=require(_0x2750('0x5'))['db'];var utils=require(_0x2750('0x6'));var logger=require(_0x2750('0x7'))(_0x2750('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2750('0x9')][_0x2750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53f520,_0x25aefd,_0x3dec11){return new BPromise(function(_0x45870d,_0x556d74){return client[_0x2750('0xb')](_0x53f520,_0x3dec11)['then'](function(_0x1f98de){logger[_0x2750('0xc')](_0x2750('0xd'),_0x25aefd,_0x2750('0xe'));logger[_0x2750('0xf')](_0x2750('0x10'),_0x25aefd,'request\x20sent',JSON['stringify'](_0x1f98de));if(_0x1f98de[_0x2750('0x11')]){if(_0x1f98de[_0x2750('0x11')][_0x2750('0x12')]===0x1f4){logger[_0x2750('0x11')](_0x2750('0xd'),_0x25aefd,_0x1f98de[_0x2750('0x11')][_0x2750('0x13')]);return _0x556d74(_0x1f98de['error'][_0x2750('0x13')]);}logger[_0x2750('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x25aefd,_0x1f98de[_0x2750('0x11')][_0x2750('0x13')]);return _0x45870d(_0x1f98de[_0x2750('0x11')][_0x2750('0x13')]);}else{logger[_0x2750('0xc')](_0x2750('0xd'),_0x25aefd,_0x2750('0xe'));_0x45870d(_0x1f98de[_0x2750('0x14')]['message']);}})[_0x2750('0x15')](function(_0x38fc88){logger[_0x2750('0x11')](_0x2750('0xd'),_0x25aefd,_0x38fc88);_0x556d74(_0x38fc88);});});} \ No newline at end of file +var _0xa4f1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','MailSubstatus,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa4f1,0xe2));var _0x1a4f=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa4f1[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a4f('0x0'));var BPromise=require(_0x1a4f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a4f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a4f('0x3'));var logger=require(_0x1a4f('0x4'))(_0x1a4f('0x5'));var config=require(_0x1a4f('0x6'));var jayson=require(_0x1a4f('0x7'));var client=jayson[_0x1a4f('0x8')][_0x1a4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e9c19,_0x238e7d,_0x1d9fd5){return new BPromise(function(_0x29808c,_0x3accad){return client[_0x1a4f('0xa')](_0x1e9c19,_0x1d9fd5)[_0x1a4f('0xb')](function(_0x356cfd){logger[_0x1a4f('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x238e7d,_0x1a4f('0xd'));logger[_0x1a4f('0xe')](_0x1a4f('0xf'),_0x238e7d,_0x1a4f('0xd'),JSON[_0x1a4f('0x10')](_0x356cfd));if(_0x356cfd['error']){if(_0x356cfd[_0x1a4f('0x11')]['code']===0x1f4){logger[_0x1a4f('0x11')](_0x1a4f('0x12'),_0x238e7d,_0x356cfd[_0x1a4f('0x11')][_0x1a4f('0x13')]);return _0x3accad(_0x356cfd['error'][_0x1a4f('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x238e7d,_0x356cfd[_0x1a4f('0x11')][_0x1a4f('0x13')]);return _0x29808c(_0x356cfd['error'][_0x1a4f('0x13')]);}else{logger[_0x1a4f('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x238e7d,_0x1a4f('0xd'));_0x29808c(_0x356cfd['result'][_0x1a4f('0x13')]);}})[_0x1a4f('0x14')](function(_0x51ead7){logger[_0x1a4f('0x11')](_0x1a4f('0x12'),_0x238e7d,_0x51ead7);_0x3accad(_0x51ead7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 384e2de..128d819 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 _0x3a88=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x532a32,_0x54eff1){var _0x3535cc=function(_0x4af8ff){while(--_0x4af8ff){_0x532a32['push'](_0x532a32['shift']());}};_0x3535cc(++_0x54eff1);}(_0x3a88,0x1bc));var _0x83a8=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x3a88[_0x1e172a];return _0x96338b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83a8('0x0'));var timeout=require(_0x83a8('0x1'));var express=require(_0x83a8('0x2'));var router=express[_0x83a8('0x3')]();var fs_extra=require(_0x83a8('0x4'));var auth=require(_0x83a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x83a8('0x6'));var controller=require('./mailTransferReport.controller');router[_0x83a8('0x7')]('/',auth[_0x83a8('0x8')](),controller[_0x83a8('0x9')]);router['get'](_0x83a8('0xa'),auth[_0x83a8('0x8')](),controller['describe']);router['get'](_0x83a8('0xb'),auth[_0x83a8('0x8')](),controller[_0x83a8('0xc')]);router['post']('/',auth[_0x83a8('0x8')](),controller[_0x83a8('0xd')]);router[_0x83a8('0xe')](_0x83a8('0xb'),auth[_0x83a8('0x8')](),controller[_0x83a8('0xf')]);router['delete']('/:id',auth[_0x83a8('0x8')](),controller[_0x83a8('0x10')]);module[_0x83a8('0x11')]=router; \ No newline at end of file +var _0x8a2a=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a2a,0x136));var _0xa8a2=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x8a2a[_0x622035];return _0x326cf2;};'use strict';var multer=require(_0xa8a2('0x0'));var util=require(_0xa8a2('0x1'));var path=require(_0xa8a2('0x2'));var timeout=require(_0xa8a2('0x3'));var express=require(_0xa8a2('0x4'));var router=express[_0xa8a2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa8a2('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xa8a2('0x7')]('/',auth[_0xa8a2('0x8')](),controller[_0xa8a2('0x9')]);router[_0xa8a2('0x7')]('/describe',auth[_0xa8a2('0x8')](),controller['describe']);router[_0xa8a2('0x7')](_0xa8a2('0xa'),auth[_0xa8a2('0x8')](),controller[_0xa8a2('0xb')]);router['post']('/',auth[_0xa8a2('0x8')](),controller[_0xa8a2('0xc')]);router[_0xa8a2('0xd')](_0xa8a2('0xa'),auth[_0xa8a2('0x8')](),controller[_0xa8a2('0xe')]);router[_0xa8a2('0xf')](_0xa8a2('0xa'),auth[_0xa8a2('0x8')](),controller['destroy']);module[_0xa8a2('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 444aa5c..1684f17 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x10a557,_0x409d8d){var _0xc64f73=function(_0x56e137){while(--_0x56e137){_0x10a557['push'](_0x10a557['shift']());}};_0xc64f73(++_0x409d8d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x00bb[_0x1e7b16];return _0x37fadc;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4050bc,_0x31882c){var _0x524b78=function(_0x26f06e){while(--_0x26f06e){_0x4050bc['push'](_0x4050bc['shift']());}};_0x524b78(++_0x31882c);}(_0x00bb,0x1d8));var _0xb00b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x00bb[_0xb0f7c3];return _0x28ea68;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 07db85d..2b7b8c4 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 _0xe60d=['fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes'];(function(_0x220e84,_0x58a759){var _0x3dfbed=function(_0x1ef06b){while(--_0x1ef06b){_0x220e84['push'](_0x220e84['shift']());}};_0x3dfbed(++_0x58a759);}(_0xe60d,0x1e4));var _0xde60=function(_0x54177e,_0x44595e){_0x54177e=_0x54177e-0x0;var _0x4e6f9d=_0xe60d[_0x54177e];return _0x4e6f9d;};'use strict';var emlformat=require(_0xde60('0x0'));var rimraf=require(_0xde60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde60('0x2'));var rp=require('request-promise');var moment=require(_0xde60('0x3'));var BPromise=require(_0xde60('0x4'));var Mustache=require('mustache');var util=require(_0xde60('0x5'));var path=require(_0xde60('0x6'));var sox=require(_0xde60('0x7'));var csv=require('to-csv');var ejs=require(_0xde60('0x8'));var fs=require('fs');var fs_extra=require(_0xde60('0x9'));var _=require(_0xde60('0xa'));var squel=require(_0xde60('0xb'));var crypto=require(_0xde60('0xc'));var jsforce=require(_0xde60('0xd'));var deskjs=require(_0xde60('0xe'));var toCsv=require(_0xde60('0xf'));var querystring=require(_0xde60('0x10'));var Papa=require(_0xde60('0x11'));var Redis=require('ioredis');var authService=require(_0xde60('0x12'));var qs=require(_0xde60('0x13'));var as=require(_0xde60('0x14'));var hardwareService=require(_0xde60('0x15'));var logger=require('../../config/logger')(_0xde60('0x16'));var utils=require(_0xde60('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2064f5,_0x4ce4a1){_0x4ce4a1=_0x4ce4a1||0xcc;return function(_0x61b50){if(_0x61b50){return _0x2064f5[_0xde60('0x19')](_0x4ce4a1);}return _0x2064f5[_0xde60('0x1a')](_0x4ce4a1)[_0xde60('0x1b')]();};}function respondWithResult(_0x4cea97,_0xd86875){_0xd86875=_0xd86875||0xc8;return function(_0x3a576d){if(_0x3a576d){return _0x4cea97[_0xde60('0x1a')](_0xd86875)['json'](_0x3a576d);}};}function respondWithFilteredResult(_0x27c2a4,_0x5e7a3b){return function(_0x543585){if(_0x543585){var _0x384cf1=typeof _0x5e7a3b['offset']===_0xde60('0x1c')&&typeof _0x5e7a3b[_0xde60('0x1d')]===_0xde60('0x1c');var _0x245cb6=_0x543585[_0xde60('0x1e')];var _0x47c299=_0x384cf1?0x0:_0x5e7a3b[_0xde60('0x1f')];var _0x1df2ab=_0x384cf1?_0x543585[_0xde60('0x1e')]:_0x5e7a3b['offset']+_0x5e7a3b[_0xde60('0x1d')];var _0x59f97d;if(_0x1df2ab>=_0x245cb6){_0x1df2ab=_0x245cb6;_0x59f97d=0xc8;}else{_0x59f97d=0xce;}_0x27c2a4[_0xde60('0x1a')](_0x59f97d);return _0x27c2a4[_0xde60('0x20')](_0xde60('0x21'),_0x47c299+'-'+_0x1df2ab+'/'+_0x245cb6)[_0xde60('0x22')](_0x543585);}return null;};}function patchUpdates(_0x185e4c){return function(_0x348ec7){try{jsonpatch[_0xde60('0x23')](_0x348ec7,_0x185e4c,!![]);}catch(_0x32f5cc){return BPromise[_0xde60('0x24')](_0x32f5cc);}return _0x348ec7[_0xde60('0x25')]();};}function saveUpdates(_0x147dd6,_0x175b4e){return function(_0xb08bf7){if(_0xb08bf7){return _0xb08bf7[_0xde60('0x26')](_0x147dd6)['then'](function(_0x304d9c){return _0x304d9c;});}return null;};}function removeEntity(_0x143cec,_0x3909cb){return function(_0x3460d2){if(_0x3460d2){return _0x3460d2[_0xde60('0x27')]()['then'](function(){_0x143cec[_0xde60('0x1a')](0xcc)[_0xde60('0x1b')]();});}};}function handleEntityNotFound(_0xe69dbb,_0x49d355){return function(_0x2595e4){if(!_0x2595e4){_0xe69dbb['sendStatus'](0x194);}return _0x2595e4;};}function handleError(_0x52d8a,_0x31f674){_0x31f674=_0x31f674||0x1f4;return function(_0x4c6643){logger[_0xde60('0x28')](_0x4c6643[_0xde60('0x29')]);if(_0x4c6643[_0xde60('0x2a')]){delete _0x4c6643[_0xde60('0x2a')];}_0x52d8a[_0xde60('0x1a')](_0x31f674)[_0xde60('0x2b')](_0x4c6643);};}exports[_0xde60('0x2c')]=function(_0x3193cb,_0x2de8c1){var _0x5780bf={},_0x18bcff={},_0x5efe7e={'count':0x0,'rows':[]};var _0x55e82e=_[_0xde60('0x2d')](db[_0xde60('0x2e')][_0xde60('0x2f')],function(_0x2c9224){return{'name':_0x2c9224[_0xde60('0x30')],'type':_0x2c9224['type']['key']};});_0x18bcff[_0xde60('0x31')]=_[_0xde60('0x2d')](_0x55e82e,'name');_0x18bcff[_0xde60('0x32')]=_[_0xde60('0x33')](_0x3193cb[_0xde60('0x32')]);_0x18bcff[_0xde60('0x34')]=_[_0xde60('0x35')](_0x18bcff[_0xde60('0x31')],_0x18bcff[_0xde60('0x32')]);_0x5780bf[_0xde60('0x36')]=_[_0xde60('0x35')](_0x18bcff[_0xde60('0x31')],qs['fields'](_0x3193cb[_0xde60('0x32')][_0xde60('0x37')]));_0x5780bf[_0xde60('0x36')]=_0x5780bf[_0xde60('0x36')][_0xde60('0x38')]?_0x5780bf['attributes']:_0x18bcff[_0xde60('0x31')];if(!_0x3193cb[_0xde60('0x32')][_0xde60('0x39')](_0xde60('0x3a'))){_0x5780bf[_0xde60('0x1d')]=qs[_0xde60('0x1d')](_0x3193cb['query']['limit']);_0x5780bf[_0xde60('0x1f')]=qs['offset'](_0x3193cb[_0xde60('0x32')][_0xde60('0x1f')]);}_0x5780bf[_0xde60('0x3b')]=qs[_0xde60('0x3c')](_0x3193cb[_0xde60('0x32')][_0xde60('0x3c')]);_0x5780bf[_0xde60('0x3d')]=qs[_0xde60('0x34')](_['pick'](_0x3193cb['query'],_0x18bcff['filters']),_0x55e82e);if(_0x3193cb[_0xde60('0x32')]['filter']){_0x5780bf[_0xde60('0x3d')]=_[_0xde60('0x3e')](_0x5780bf['where'],{'$or':_[_0xde60('0x2d')](_0x55e82e,function(_0x23b5c6){if(_0x23b5c6[_0xde60('0x3f')]!==_0xde60('0x40')){var _0x4fa78d={};_0x4fa78d[_0x23b5c6['name']]={'$like':'%'+_0x3193cb[_0xde60('0x32')]['filter']+'%'};return _0x4fa78d;}})});}_0x5780bf=_[_0xde60('0x3e')]({},_0x5780bf,_0x3193cb['options']);var _0x4021e5={'where':_0x5780bf[_0xde60('0x3d')]};return db['MailTransferReport'][_0xde60('0x1e')](_0x4021e5)[_0xde60('0x41')](function(_0x1fe92d){_0x5efe7e[_0xde60('0x1e')]=_0x1fe92d;if(_0x3193cb[_0xde60('0x32')][_0xde60('0x42')]){_0x5780bf[_0xde60('0x43')]=[{'all':!![]}];}return db['MailTransferReport'][_0xde60('0x44')](_0x5780bf);})[_0xde60('0x41')](function(_0x4f8186){_0x5efe7e[_0xde60('0x45')]=_0x4f8186;return _0x5efe7e;})[_0xde60('0x41')](respondWithFilteredResult(_0x2de8c1,_0x5780bf))[_0xde60('0x46')](handleError(_0x2de8c1,null));};exports['show']=function(_0x3d9a9f,_0xe01a3a){var _0x349e04={'raw':!![],'where':{'id':_0x3d9a9f['params']['id']}},_0x48d9f6={};_0x48d9f6[_0xde60('0x31')]=_[_0xde60('0x33')](db[_0xde60('0x2e')][_0xde60('0x2f')]);_0x48d9f6[_0xde60('0x32')]=_['keys'](_0x3d9a9f['query']);_0x48d9f6[_0xde60('0x34')]=_[_0xde60('0x35')](_0x48d9f6[_0xde60('0x31')],_0x48d9f6[_0xde60('0x32')]);_0x349e04[_0xde60('0x36')]=_[_0xde60('0x35')](_0x48d9f6[_0xde60('0x31')],qs['fields'](_0x3d9a9f[_0xde60('0x32')][_0xde60('0x37')]));_0x349e04[_0xde60('0x36')]=_0x349e04[_0xde60('0x36')][_0xde60('0x38')]?_0x349e04[_0xde60('0x36')]:_0x48d9f6[_0xde60('0x31')];if(_0x3d9a9f[_0xde60('0x32')]['includeAll']){_0x349e04[_0xde60('0x43')]=[{'all':!![]}];}_0x349e04=_['merge']({},_0x349e04,_0x3d9a9f['options']);return db[_0xde60('0x2e')][_0xde60('0x47')](_0x349e04)[_0xde60('0x41')](handleEntityNotFound(_0xe01a3a,null))[_0xde60('0x41')](respondWithResult(_0xe01a3a,null))[_0xde60('0x46')](handleError(_0xe01a3a,null));};exports['create']=function(_0x5b92a4,_0x31e13d){return db[_0xde60('0x2e')][_0xde60('0x48')](_0x5b92a4[_0xde60('0x49')],{})[_0xde60('0x41')](respondWithResult(_0x31e13d,0xc9))[_0xde60('0x46')](handleError(_0x31e13d,null));};exports[_0xde60('0x26')]=function(_0x43cc33,_0x4f68f8){if(_0x43cc33[_0xde60('0x49')]['id']){delete _0x43cc33[_0xde60('0x49')]['id'];}return db[_0xde60('0x2e')]['find']({'where':{'id':_0x43cc33[_0xde60('0x4a')]['id']}})[_0xde60('0x41')](handleEntityNotFound(_0x4f68f8,null))[_0xde60('0x41')](saveUpdates(_0x43cc33[_0xde60('0x49')],null))[_0xde60('0x41')](respondWithResult(_0x4f68f8,null))[_0xde60('0x46')](handleError(_0x4f68f8,null));};exports[_0xde60('0x27')]=function(_0x42e52b,_0x5b3a1a){return db[_0xde60('0x2e')][_0xde60('0x47')]({'where':{'id':_0x42e52b[_0xde60('0x4a')]['id']}})[_0xde60('0x41')](handleEntityNotFound(_0x5b3a1a,null))[_0xde60('0x41')](removeEntity(_0x5b3a1a,null))[_0xde60('0x46')](handleError(_0x5b3a1a,null));};exports[_0xde60('0x4b')]=function(_0x117a72,_0x15f526){return db[_0xde60('0x2e')][_0xde60('0x4b')]()[_0xde60('0x41')](respondWithResult(_0x15f526,null))['catch'](handleError(_0x15f526,null));}; \ No newline at end of file +var _0xcf8d=['sort','where','pick','filter','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','merge','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcf8d,0x1db));var _0xdcf8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xcf8d[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0xdcf8('0x0'));var rimraf=require(_0xdcf8('0x1'));var zipdir=require(_0xdcf8('0x2'));var jsonpatch=require(_0xdcf8('0x3'));var rp=require(_0xdcf8('0x4'));var moment=require(_0xdcf8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdcf8('0x6'));var path=require(_0xdcf8('0x7'));var sox=require('sox');var csv=require(_0xdcf8('0x8'));var ejs=require(_0xdcf8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdcf8('0xa'));var crypto=require(_0xdcf8('0xb'));var jsforce=require(_0xdcf8('0xc'));var deskjs=require(_0xdcf8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdcf8('0xe'));var Papa=require(_0xdcf8('0xf'));var Redis=require(_0xdcf8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdcf8('0x11'));var as=require(_0xdcf8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcf8('0x13'))(_0xdcf8('0x14'));var utils=require(_0xdcf8('0x15'));var config=require(_0xdcf8('0x16'));var licenseUtil=require(_0xdcf8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e0d16,_0x2a9c06){_0x2a9c06=_0x2a9c06||0xcc;return function(_0x4074af){if(_0x4074af){return _0x4e0d16[_0xdcf8('0x18')](_0x2a9c06);}return _0x4e0d16[_0xdcf8('0x19')](_0x2a9c06)['end']();};}function respondWithResult(_0x3c6515,_0x8dca75){_0x8dca75=_0x8dca75||0xc8;return function(_0x12db81){if(_0x12db81){return _0x3c6515[_0xdcf8('0x19')](_0x8dca75)[_0xdcf8('0x1a')](_0x12db81);}};}function respondWithFilteredResult(_0x4da562,_0x4a398c){return function(_0x4ac303){if(_0x4ac303){var _0x118554=typeof _0x4a398c[_0xdcf8('0x1b')]==='undefined'&&typeof _0x4a398c[_0xdcf8('0x1c')]==='undefined';var _0x3eb13e=_0x4ac303[_0xdcf8('0x1d')];var _0x56c433=_0x118554?0x0:_0x4a398c[_0xdcf8('0x1b')];var _0x30126b=_0x118554?_0x4ac303[_0xdcf8('0x1d')]:_0x4a398c['offset']+_0x4a398c['limit'];var _0x2679ed;if(_0x30126b>=_0x3eb13e){_0x30126b=_0x3eb13e;_0x2679ed=0xc8;}else{_0x2679ed=0xce;}_0x4da562[_0xdcf8('0x19')](_0x2679ed);return _0x4da562[_0xdcf8('0x1e')]('Content-Range',_0x56c433+'-'+_0x30126b+'/'+_0x3eb13e)[_0xdcf8('0x1a')](_0x4ac303);}return null;};}function patchUpdates(_0x5415d5){return function(_0x5a82b3){try{jsonpatch[_0xdcf8('0x1f')](_0x5a82b3,_0x5415d5,!![]);}catch(_0x334068){return BPromise[_0xdcf8('0x20')](_0x334068);}return _0x5a82b3[_0xdcf8('0x21')]();};}function saveUpdates(_0x1a7542,_0x17d137){return function(_0x237c50){if(_0x237c50){return _0x237c50['update'](_0x1a7542)['then'](function(_0x547a8f){return _0x547a8f;});}return null;};}function removeEntity(_0x36c432,_0x1776e6){return function(_0x441b1b){if(_0x441b1b){return _0x441b1b[_0xdcf8('0x22')]()[_0xdcf8('0x23')](function(){_0x36c432[_0xdcf8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x182293,_0xe1178e){return function(_0x4570c3){if(!_0x4570c3){_0x182293[_0xdcf8('0x18')](0x194);}return _0x4570c3;};}function handleError(_0x49d742,_0x1a03d4){_0x1a03d4=_0x1a03d4||0x1f4;return function(_0x3401ae){logger[_0xdcf8('0x24')](_0x3401ae[_0xdcf8('0x25')]);if(_0x3401ae[_0xdcf8('0x26')]){delete _0x3401ae['name'];}_0x49d742[_0xdcf8('0x19')](_0x1a03d4)[_0xdcf8('0x27')](_0x3401ae);};}exports[_0xdcf8('0x28')]=function(_0x52a9fb,_0x332a1f){var _0x296052={},_0x4da31b={},_0x2e03e7={'count':0x0,'rows':[]};var _0x1b08ae=_['map'](db[_0xdcf8('0x29')][_0xdcf8('0x2a')],function(_0x218466){return{'name':_0x218466[_0xdcf8('0x2b')],'type':_0x218466[_0xdcf8('0x2c')][_0xdcf8('0x2d')]};});_0x4da31b[_0xdcf8('0x2e')]=_[_0xdcf8('0x2f')](_0x1b08ae,'name');_0x4da31b[_0xdcf8('0x30')]=_[_0xdcf8('0x31')](_0x52a9fb['query']);_0x4da31b[_0xdcf8('0x32')]=_[_0xdcf8('0x33')](_0x4da31b['model'],_0x4da31b[_0xdcf8('0x30')]);_0x296052['attributes']=_['intersection'](_0x4da31b[_0xdcf8('0x2e')],qs['fields'](_0x52a9fb[_0xdcf8('0x30')][_0xdcf8('0x34')]));_0x296052[_0xdcf8('0x35')]=_0x296052['attributes']['length']?_0x296052[_0xdcf8('0x35')]:_0x4da31b[_0xdcf8('0x2e')];if(!_0x52a9fb['query'][_0xdcf8('0x36')](_0xdcf8('0x37'))){_0x296052['limit']=qs['limit'](_0x52a9fb['query'][_0xdcf8('0x1c')]);_0x296052[_0xdcf8('0x1b')]=qs['offset'](_0x52a9fb['query'][_0xdcf8('0x1b')]);}_0x296052[_0xdcf8('0x38')]=qs[_0xdcf8('0x39')](_0x52a9fb[_0xdcf8('0x30')]['sort']);_0x296052[_0xdcf8('0x3a')]=qs[_0xdcf8('0x32')](_[_0xdcf8('0x3b')](_0x52a9fb[_0xdcf8('0x30')],_0x4da31b[_0xdcf8('0x32')]),_0x1b08ae);if(_0x52a9fb[_0xdcf8('0x30')][_0xdcf8('0x3c')]){_0x296052['where']=_['merge'](_0x296052[_0xdcf8('0x3a')],{'$or':_[_0xdcf8('0x2f')](_0x1b08ae,function(_0x330414){if(_0x330414['type']!==_0xdcf8('0x3d')){var _0x1ec211={};_0x1ec211[_0x330414[_0xdcf8('0x26')]]={'$like':'%'+_0x52a9fb['query']['filter']+'%'};return _0x1ec211;}})});}_0x296052=_['merge']({},_0x296052,_0x52a9fb[_0xdcf8('0x3e')]);var _0x245e7d={'where':_0x296052[_0xdcf8('0x3a')]};return db[_0xdcf8('0x29')]['count'](_0x245e7d)[_0xdcf8('0x23')](function(_0x31f7d5){_0x2e03e7['count']=_0x31f7d5;if(_0x52a9fb[_0xdcf8('0x30')][_0xdcf8('0x3f')]){_0x296052['include']=[{'all':!![]}];}return db[_0xdcf8('0x29')]['findAll'](_0x296052);})[_0xdcf8('0x23')](function(_0x2a39d5){_0x2e03e7[_0xdcf8('0x40')]=_0x2a39d5;return _0x2e03e7;})['then'](respondWithFilteredResult(_0x332a1f,_0x296052))[_0xdcf8('0x41')](handleError(_0x332a1f,null));};exports[_0xdcf8('0x42')]=function(_0x3bf87e,_0x402a0d){var _0x164ebf={'raw':!![],'where':{'id':_0x3bf87e[_0xdcf8('0x43')]['id']}},_0x89deed={};_0x89deed[_0xdcf8('0x2e')]=_[_0xdcf8('0x31')](db[_0xdcf8('0x29')][_0xdcf8('0x2a')]);_0x89deed['query']=_[_0xdcf8('0x31')](_0x3bf87e['query']);_0x89deed[_0xdcf8('0x32')]=_[_0xdcf8('0x33')](_0x89deed[_0xdcf8('0x2e')],_0x89deed[_0xdcf8('0x30')]);_0x164ebf['attributes']=_[_0xdcf8('0x33')](_0x89deed['model'],qs[_0xdcf8('0x34')](_0x3bf87e[_0xdcf8('0x30')][_0xdcf8('0x34')]));_0x164ebf[_0xdcf8('0x35')]=_0x164ebf[_0xdcf8('0x35')][_0xdcf8('0x44')]?_0x164ebf[_0xdcf8('0x35')]:_0x89deed[_0xdcf8('0x2e')];if(_0x3bf87e[_0xdcf8('0x30')]['includeAll']){_0x164ebf[_0xdcf8('0x45')]=[{'all':!![]}];}_0x164ebf=_[_0xdcf8('0x46')]({},_0x164ebf,_0x3bf87e[_0xdcf8('0x3e')]);return db[_0xdcf8('0x29')]['find'](_0x164ebf)[_0xdcf8('0x23')](handleEntityNotFound(_0x402a0d,null))[_0xdcf8('0x23')](respondWithResult(_0x402a0d,null))[_0xdcf8('0x41')](handleError(_0x402a0d,null));};exports[_0xdcf8('0x47')]=function(_0x1256b2,_0x174584){return db[_0xdcf8('0x29')][_0xdcf8('0x47')](_0x1256b2[_0xdcf8('0x48')],{})[_0xdcf8('0x23')](respondWithResult(_0x174584,0xc9))[_0xdcf8('0x41')](handleError(_0x174584,null));};exports[_0xdcf8('0x49')]=function(_0x5b8bf0,_0x2adfb3){if(_0x5b8bf0[_0xdcf8('0x48')]['id']){delete _0x5b8bf0['body']['id'];}return db['MailTransferReport'][_0xdcf8('0x4a')]({'where':{'id':_0x5b8bf0['params']['id']}})['then'](handleEntityNotFound(_0x2adfb3,null))[_0xdcf8('0x23')](saveUpdates(_0x5b8bf0[_0xdcf8('0x48')],null))[_0xdcf8('0x23')](respondWithResult(_0x2adfb3,null))[_0xdcf8('0x41')](handleError(_0x2adfb3,null));};exports[_0xdcf8('0x22')]=function(_0x121487,_0x1f5205){return db[_0xdcf8('0x29')][_0xdcf8('0x4a')]({'where':{'id':_0x121487[_0xdcf8('0x43')]['id']}})[_0xdcf8('0x23')](handleEntityNotFound(_0x1f5205,null))[_0xdcf8('0x23')](removeEntity(_0x1f5205,null))['catch'](handleError(_0x1f5205,null));};exports[_0xdcf8('0x4b')]=function(_0x5eb832,_0x5c22e4){return db[_0xdcf8('0x29')][_0xdcf8('0x4b')]()[_0xdcf8('0x23')](respondWithResult(_0x5c22e4,null))['catch'](handleError(_0x5c22e4,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d108294..ef5683d 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 _0x82f5=['uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82f5,0x15d));var _0x582f=function(_0x244832,_0x417374){_0x244832=_0x244832-0x0;var _0x284be4=_0x82f5[_0x244832];return _0x284be4;};'use strict';var _=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var logger=require(_0x582f('0x2'))(_0x582f('0x3'));var moment=require(_0x582f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x582f('0x5'));var rimraf=require(_0x582f('0x6'));var config=require(_0x582f('0x7'));var attributes=require(_0x582f('0x8'));module[_0x582f('0x9')]=function(_0x15d332,_0x459755){return _0x15d332['define'](_0x582f('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x582f('0xb'),'fields':[_0x582f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ca8=['define','MailTransferReport','report_mail_transfer','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9ca8,0x123));var _0x89ca=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x9ca8[_0x31c19c];return _0x1a87f7;};'use strict';var _=require('lodash');var util=require(_0x89ca('0x0'));var logger=require('../../config/logger')(_0x89ca('0x1'));var moment=require(_0x89ca('0x2'));var BPromise=require(_0x89ca('0x3'));var rp=require(_0x89ca('0x4'));var fs=require('fs');var path=require(_0x89ca('0x5'));var rimraf=require('rimraf');var config=require(_0x89ca('0x6'));var attributes=require(_0x89ca('0x7'));module[_0x89ca('0x8')]=function(_0x1464be,_0x348f76){return _0x1464be[_0x89ca('0x9')](_0x89ca('0xa'),attributes,{'tableName':_0x89ca('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7ac11a6..e21cafe 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 _0x1bb6=['request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','MailTransferReport,\x20%s,\x20%s'];(function(_0x49cb92,_0x3c31a6){var _0x16ee5a=function(_0x48e0c6){while(--_0x48e0c6){_0x49cb92['push'](_0x49cb92['shift']());}};_0x16ee5a(++_0x3c31a6);}(_0x1bb6,0xcd));var _0x61bb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1bb6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x61bb('0x0'));var util=require(_0x61bb('0x1'));var moment=require('moment');var BPromise=require(_0x61bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61bb('0x3'));var db=require(_0x61bb('0x4'))['db'];var utils=require(_0x61bb('0x5'));var logger=require(_0x61bb('0x6'))('rpc');var config=require(_0x61bb('0x7'));var jayson=require(_0x61bb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5015,_0x1bef4f,_0x3bf3f1){return new BPromise(function(_0x5bdbdb,_0x20d3b9){return client[_0x61bb('0x9')](_0x4d5015,_0x3bf3f1)['then'](function(_0x36a19d){logger['info'](_0x61bb('0xa'),_0x1bef4f,_0x61bb('0xb'));logger['debug'](_0x61bb('0xc'),_0x1bef4f,_0x61bb('0xb'),JSON[_0x61bb('0xd')](_0x36a19d));if(_0x36a19d['error']){if(_0x36a19d[_0x61bb('0xe')][_0x61bb('0xf')]===0x1f4){logger[_0x61bb('0xe')](_0x61bb('0xa'),_0x1bef4f,_0x36a19d['error']['message']);return _0x20d3b9(_0x36a19d[_0x61bb('0xe')][_0x61bb('0x10')]);}logger[_0x61bb('0xe')](_0x61bb('0xa'),_0x1bef4f,_0x36a19d[_0x61bb('0xe')]['message']);return _0x5bdbdb(_0x36a19d[_0x61bb('0xe')][_0x61bb('0x10')]);}else{logger['info'](_0x61bb('0xa'),_0x1bef4f,_0x61bb('0xb'));_0x5bdbdb(_0x36a19d['result'][_0x61bb('0x10')]);}})[_0x61bb('0x11')](function(_0x411ea8){logger[_0x61bb('0xe')](_0x61bb('0xa'),_0x1bef4f,_0x411ea8);_0x20d3b9(_0x411ea8);});});} \ No newline at end of file +var _0xdf70=['message','result','catch','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x531ec6,_0x3bbd29){var _0x4b6ec5=function(_0x6c4373){while(--_0x6c4373){_0x531ec6['push'](_0x531ec6['shift']());}};_0x4b6ec5(++_0x3bbd29);}(_0xdf70,0x12f));var _0x0df7=function(_0x32a606,_0x1c3058){_0x32a606=_0x32a606-0x0;var _0xeb176=_0xdf70[_0x32a606];return _0xeb176;};'use strict';var _=require('lodash');var util=require(_0x0df7('0x0'));var moment=require('moment');var BPromise=require(_0x0df7('0x1'));var rs=require(_0x0df7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0df7('0x3'))(_0x0df7('0x4'));var config=require(_0x0df7('0x5'));var jayson=require(_0x0df7('0x6'));var client=jayson[_0x0df7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x218ed7,_0x191df0,_0x49ad34){return new BPromise(function(_0x38bcaf,_0x24e511){return client[_0x0df7('0x8')](_0x218ed7,_0x49ad34)[_0x0df7('0x9')](function(_0x4cbe38){logger[_0x0df7('0xa')](_0x0df7('0xb'),_0x191df0,_0x0df7('0xc'));logger[_0x0df7('0xd')](_0x0df7('0xe'),_0x191df0,'request\x20sent',JSON['stringify'](_0x4cbe38));if(_0x4cbe38[_0x0df7('0xf')]){if(_0x4cbe38['error'][_0x0df7('0x10')]===0x1f4){logger[_0x0df7('0xf')](_0x0df7('0xb'),_0x191df0,_0x4cbe38[_0x0df7('0xf')]['message']);return _0x24e511(_0x4cbe38[_0x0df7('0xf')]['message']);}logger[_0x0df7('0xf')](_0x0df7('0xb'),_0x191df0,_0x4cbe38['error'][_0x0df7('0x11')]);return _0x38bcaf(_0x4cbe38['error'][_0x0df7('0x11')]);}else{logger[_0x0df7('0xa')](_0x0df7('0xb'),_0x191df0,_0x0df7('0xc'));_0x38bcaf(_0x4cbe38[_0x0df7('0x12')]['message']);}})[_0x0df7('0x13')](function(_0x4db98c){logger[_0x0df7('0xf')](_0x0df7('0xb'),_0x191df0,_0x4db98c);_0x24e511(_0x4db98c);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 500e583..03c5846 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 _0x41df=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x41df,0xbc));var _0xf41d=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x41df[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0xf41d('0x0'));var util=require(_0xf41d('0x1'));var path=require(_0xf41d('0x2'));var timeout=require(_0xf41d('0x3'));var express=require('express');var router=express[_0xf41d('0x4')]();var fs_extra=require(_0xf41d('0x5'));var auth=require(_0xf41d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf41d('0x7'));var controller=require(_0xf41d('0x8'));router[_0xf41d('0x9')]('/',auth[_0xf41d('0xa')](),controller[_0xf41d('0xb')]);router[_0xf41d('0x9')](_0xf41d('0xc'),auth[_0xf41d('0xa')](),controller[_0xf41d('0xd')]);router[_0xf41d('0x9')](_0xf41d('0xe'),auth[_0xf41d('0xa')](),controller[_0xf41d('0xf')]);router[_0xf41d('0x10')]('/',auth['isAuthenticated'](),controller[_0xf41d('0x11')]);router[_0xf41d('0x12')](_0xf41d('0xe'),auth['isAuthenticated'](),controller[_0xf41d('0x13')]);router[_0xf41d('0x14')]('/:id',auth[_0xf41d('0xa')](),controller[_0xf41d('0x15')]);module[_0xf41d('0x16')]=router; \ No newline at end of file +var _0x8e8a=['create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x4b06ad,_0x1c8583){var _0x24f38e=function(_0x545fdc){while(--_0x545fdc){_0x4b06ad['push'](_0x4b06ad['shift']());}};_0x24f38e(++_0x1c8583);}(_0x8e8a,0x10f));var _0xa8e8=function(_0x4e35af,_0x46514d){_0x4e35af=_0x4e35af-0x0;var _0x164e55=_0x8e8a[_0x4e35af];return _0x164e55;};'use strict';var multer=require('multer');var util=require(_0xa8e8('0x0'));var path=require(_0xa8e8('0x1'));var timeout=require(_0xa8e8('0x2'));var express=require('express');var router=express[_0xa8e8('0x3')]();var fs_extra=require(_0xa8e8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa8e8('0x5'));var controller=require(_0xa8e8('0x6'));router[_0xa8e8('0x7')]('/',auth[_0xa8e8('0x8')](),controller[_0xa8e8('0x9')]);router[_0xa8e8('0x7')]('/describe',auth[_0xa8e8('0x8')](),controller[_0xa8e8('0xa')]);router[_0xa8e8('0x7')](_0xa8e8('0xb'),auth[_0xa8e8('0x8')](),controller[_0xa8e8('0xc')]);router[_0xa8e8('0xd')]('/',auth[_0xa8e8('0x8')](),controller[_0xa8e8('0xe')]);router[_0xa8e8('0xf')](_0xa8e8('0xb'),auth[_0xa8e8('0x8')](),controller['update']);router[_0xa8e8('0x10')](_0xa8e8('0xb'),auth['isAuthenticated'](),controller[_0xa8e8('0x11')]);module[_0xa8e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index d704329..726553c 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 _0x7802=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x344d08,_0x1bad64){var _0x2270c1=function(_0x3ecffa){while(--_0x3ecffa){_0x344d08['push'](_0x344d08['shift']());}};_0x2270c1(++_0x1bad64);}(_0x7802,0x105));var _0x2780=function(_0x2ac84e,_0x3d8931){_0x2ac84e=_0x2ac84e-0x0;var _0x481a04=_0x7802[_0x2ac84e];return _0x481a04;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2780('0x0'));module[_0x2780('0x1')]={'channel':{'type':Sequelize[_0x2780('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2780('0x2')]},'type':{'type':Sequelize[_0x2780('0x2')],'defaultValue':_0x2780('0x3'),'comment':_0x2780('0x4')},'duration':{'type':Sequelize[_0x2780('0x5')]},'enterAt':{'type':Sequelize[_0x2780('0x6')]},'exitAt':{'type':Sequelize[_0x2780('0x6')],'set':function(_0xb0e30e){var _0x2c2665=moment(_0xb0e30e);var _0x5b9f0a=moment(this[_0x2780('0x7')](_0x2780('0x8')));var _0x4b786c=_0x2c2665[_0x2780('0x9')](_0x5b9f0a,_0x2780('0xa'));this[_0x2780('0xb')](_0x2780('0xc'),_0xb0e30e);this[_0x2780('0xb')](_0x2780('0xd'),_0x4b786c>=0x0?_0x4b786c:null);}},'data1':{'type':Sequelize[_0x2780('0x2')],'comment':_0x2780('0xe')},'data2':{'type':Sequelize[_0x2780('0x2')],'comment':_0x2780('0xf')},'data3':{'type':Sequelize[_0x2780('0x2')],'comment':_0x2780('0x10')},'data4':{'type':Sequelize['STRING'],'comment':_0x2780('0x11')},'data5':{'type':Sequelize[_0x2780('0x2')],'comment':_0x2780('0x12')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x2780('0x5')]},'uniqueid':{'type':Sequelize[_0x2780('0x2')]}}; \ No newline at end of file +var _0x88c9=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','setDataValue'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x88c9,0x177));var _0x988c=function(_0x5c7018,_0x122a48){_0x5c7018=_0x5c7018-0x0;var _0x468d7a=_0x88c9[_0x5c7018];return _0x468d7a;};'use strict';var Sequelize=require(_0x988c('0x0'));var moment=require(_0x988c('0x1'));module[_0x988c('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x988c('0x3')],'defaultValue':_0x988c('0x4'),'comment':_0x988c('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x988c('0x6')]},'exitAt':{'type':Sequelize[_0x988c('0x6')],'set':function(_0xf63387){var _0x1d15e9=moment(_0xf63387);var _0x2eaf15=moment(this['getDataValue'](_0x988c('0x7')));var _0x565c86=_0x1d15e9['diff'](_0x2eaf15,'seconds');this[_0x988c('0x8')]('exitAt',_0xf63387);this[_0x988c('0x8')](_0x988c('0x9'),_0x565c86>=0x0?_0x565c86:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x988c('0xa')},'data2':{'type':Sequelize[_0x988c('0x3')],'comment':_0x988c('0xb')},'data3':{'type':Sequelize[_0x988c('0x3')],'comment':_0x988c('0xc')},'data4':{'type':Sequelize[_0x988c('0x3')],'comment':_0x988c('0xd')},'data5':{'type':Sequelize[_0x988c('0x3')],'comment':_0x988c('0xe')},'role':{'type':Sequelize[_0x988c('0x3')]},'internal':{'type':Sequelize[_0x988c('0xf')]},'uniqueid':{'type':Sequelize[_0x988c('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 97c3732..5bbae97 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x34e8,0x12c));var _0x834e=function(_0x28214e,_0x54f40c){_0x28214e=_0x28214e-0x0;var _0x158317=_0x34e8[_0x28214e];return _0x158317;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x34e8,0x12c));var _0x834e=function(_0x463787,_0x485ec9){_0x463787=_0x463787-0x0;var _0x26062d=_0x34e8[_0x463787];return _0x26062d;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 68b939d..23c4b94 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 _0x2f78=['api','moment','path','rimraf','../../config/environment','./memberReport.attributes','report_member','membername','lodash','../../config/logger'];(function(_0xae272d,_0x1f0b3b){var _0x2ce089=function(_0x52f4ff){while(--_0x52f4ff){_0xae272d['push'](_0xae272d['shift']());}};_0x2ce089(++_0x1f0b3b);}(_0x2f78,0xa8));var _0x82f7=function(_0x460ec1,_0x509a70){_0x460ec1=_0x460ec1-0x0;var _0x311e94=_0x2f78[_0x460ec1];return _0x311e94;};'use strict';var _=require(_0x82f7('0x0'));var util=require('util');var logger=require(_0x82f7('0x1'))(_0x82f7('0x2'));var moment=require(_0x82f7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f7('0x4'));var rimraf=require(_0x82f7('0x5'));var config=require(_0x82f7('0x6'));var attributes=require(_0x82f7('0x7'));module['exports']=function(_0x375b6d,_0x28c04){return _0x375b6d['define']('MemberReport',attributes,{'tableName':_0x82f7('0x8'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x82f7('0x9'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe585=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername','interface'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xe585,0x9a));var _0x5e58=function(_0x447006,_0x5d4600){_0x447006=_0x447006-0x0;var _0x1260f2=_0xe585[_0x447006];return _0x1260f2;};'use strict';var _=require(_0x5e58('0x0'));var util=require('util');var logger=require(_0x5e58('0x1'))('api');var moment=require(_0x5e58('0x2'));var BPromise=require(_0x5e58('0x3'));var rp=require(_0x5e58('0x4'));var fs=require('fs');var path=require(_0x5e58('0x5'));var rimraf=require(_0x5e58('0x6'));var config=require(_0x5e58('0x7'));var attributes=require(_0x5e58('0x8'));module['exports']=function(_0xc44f82,_0x159698){return _0xc44f82[_0x5e58('0x9')](_0x5e58('0xa'),attributes,{'tableName':_0x5e58('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x5e58('0xc'),_0x5e58('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 336d3e0..4d947b3 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 _0x5d59=['raw','attributes','limit','include','map','model','catch','CreateMemberReport','create','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options'];(function(_0x247a5e,_0x40b75d){var _0x16e004=function(_0x4e38c7){while(--_0x4e38c7){_0x247a5e['push'](_0x247a5e['shift']());}};_0x16e004(++_0x40b75d);}(_0x5d59,0x15f));var _0x95d5=function(_0x40b7fc,_0x51c685){_0x40b7fc=_0x40b7fc-0x0;var _0xe7387a=_0x5d59[_0x40b7fc];return _0xe7387a;};'use strict';var _=require('lodash');var util=require(_0x95d5('0x0'));var moment=require(_0x95d5('0x1'));var BPromise=require(_0x95d5('0x2'));var rs=require(_0x95d5('0x3'));var fs=require('fs');var Redis=require(_0x95d5('0x4'));var db=require(_0x95d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95d5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x95d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfe94c,_0x11b2d4,_0x121537){return new BPromise(function(_0x489fab,_0x179d43){return client['request'](_0xfe94c,_0x121537)[_0x95d5('0x8')](function(_0x55249d){logger[_0x95d5('0x9')](_0x95d5('0xa'),_0x11b2d4,_0x95d5('0xb'));logger[_0x95d5('0xc')](_0x95d5('0xd'),_0x11b2d4,_0x95d5('0xb'),JSON[_0x95d5('0xe')](_0x55249d));if(_0x55249d[_0x95d5('0xf')]){if(_0x55249d['error'][_0x95d5('0x10')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x11b2d4,_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);return _0x179d43(_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);}logger['error'](_0x95d5('0xa'),_0x11b2d4,_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);return _0x489fab(_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);}else{logger[_0x95d5('0x9')](_0x95d5('0xa'),_0x11b2d4,_0x95d5('0xb'));_0x489fab(_0x55249d[_0x95d5('0x12')]['message']);}})['catch'](function(_0x1747f2){logger['error'](_0x95d5('0xa'),_0x11b2d4,_0x1747f2);_0x179d43(_0x1747f2);});});}exports[_0x95d5('0x13')]=function(_0x5bdf14){var _0x1fe609=this;return new Promise(function(_0x3793eb,_0x233a32){return db[_0x95d5('0x14')][_0x95d5('0x15')]({'raw':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14['options'][_0x95d5('0x17')]===undefined?!![]:![]:!![],'where':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14[_0x95d5('0x16')]['where']||null:null,'attributes':_0x5bdf14['options']?_0x5bdf14[_0x95d5('0x16')][_0x95d5('0x18')]||null:null,'limit':_0x5bdf14['options']?_0x5bdf14[_0x95d5('0x16')][_0x95d5('0x19')]||null:null,'include':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14['options'][_0x95d5('0x1a')]?_['map'](_0x5bdf14['options']['include'],function(_0x554f4d){return{'model':db[_0x554f4d['model']],'as':_0x554f4d['as'],'attributes':_0x554f4d['attributes'],'include':_0x554f4d[_0x95d5('0x1a')]?_[_0x95d5('0x1b')](_0x554f4d[_0x95d5('0x1a')],function(_0x260582){return{'model':db[_0x260582['model']],'as':_0x260582['as'],'attributes':_0x260582[_0x95d5('0x18')],'include':_0x260582[_0x95d5('0x1a')]?_[_0x95d5('0x1b')](_0x260582[_0x95d5('0x1a')],function(_0xe12a95){return{'model':db[_0xe12a95[_0x95d5('0x1c')]],'as':_0xe12a95['as'],'attributes':_0xe12a95[_0x95d5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x95d5('0x8')](function(_0x3fde81){logger[_0x95d5('0x9')]('GetMemberReport',_0x5bdf14);logger['debug'](_0x95d5('0x13'),_0x5bdf14,JSON[_0x95d5('0xe')](_0x3fde81));_0x3793eb(_0x3fde81);})[_0x95d5('0x1d')](function(_0x5dfe00){logger[_0x95d5('0xf')]('GetMemberReport',_0x5dfe00[_0x95d5('0x11')],_0x5bdf14);_0x233a32(_0x1fe609['error'](0x1f4,_0x5dfe00[_0x95d5('0x11')]));});});};exports[_0x95d5('0x1e')]=function(_0x333459){var _0x21d4ff=this;return new Promise(function(_0x44d803,_0x362b8){return db[_0x95d5('0x14')][_0x95d5('0x1f')](_0x333459['body'],{'raw':_0x333459['options']?_0x333459['options'][_0x95d5('0x17')]===undefined?!![]:![]:!![]})[_0x95d5('0x8')](function(_0x243210){logger[_0x95d5('0x9')](_0x95d5('0x1e'),_0x333459);logger[_0x95d5('0xc')]('CreateMemberReport',_0x333459,JSON[_0x95d5('0xe')](_0x243210));_0x44d803(_0x243210);})[_0x95d5('0x1d')](function(_0x37c8c4){logger[_0x95d5('0xf')](_0x95d5('0x1e'),_0x37c8c4[_0x95d5('0x11')],_0x333459);_0x362b8(_0x21d4ff[_0x95d5('0xf')](0x1f4,_0x37c8c4[_0x95d5('0x11')]));});});};exports[_0x95d5('0x20')]=function(_0x47d034){var _0x5031cd=this;return new Promise(function(_0x294314,_0x3201dc){return db[_0x95d5('0x14')][_0x95d5('0x21')](_0x47d034['body'],{'raw':_0x47d034[_0x95d5('0x16')]?_0x47d034['options'][_0x95d5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d034[_0x95d5('0x16')]?_0x47d034[_0x95d5('0x16')]['where']||null:null,'attributes':_0x47d034[_0x95d5('0x16')]?_0x47d034[_0x95d5('0x16')][_0x95d5('0x18')]||null:null,'limit':_0x47d034[_0x95d5('0x16')]?_0x47d034[_0x95d5('0x16')][_0x95d5('0x19')]||null:null})['then'](function(_0x1b1b0e){logger[_0x95d5('0x9')](_0x95d5('0x20'),_0x47d034);logger[_0x95d5('0xc')](_0x95d5('0x20'),_0x47d034,JSON[_0x95d5('0xe')](_0x1b1b0e));_0x294314(_0x1b1b0e);})[_0x95d5('0x1d')](function(_0x459059){logger[_0x95d5('0xf')](_0x95d5('0x20'),_0x459059['message'],_0x47d034);_0x3201dc(_0x5031cd['error'](0x1f4,_0x459059[_0x95d5('0x11')]));});});}; \ No newline at end of file +var _0xe55d=['MemberReport,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMemberReport','MemberReport','options','raw','where','limit','include','map','model','attributes','then','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x10e4c9,_0x577767){var _0x799009=function(_0x4f8223){while(--_0x4f8223){_0x10e4c9['push'](_0x10e4c9['shift']());}};_0x799009(++_0x577767);}(_0xe55d,0x126));var _0xde55=function(_0x3eaa29,_0x24a06e){_0x3eaa29=_0x3eaa29-0x0;var _0x4518c7=_0xe55d[_0x3eaa29];return _0x4518c7;};'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});function respondWithRpcPromise(_0x1e7b53,_0x1468f2,_0x1e342e){return new BPromise(function(_0x2094bb,_0x22cbd8){return client[_0xde55('0xb')](_0x1e7b53,_0x1e342e)['then'](function(_0x11aa16){logger[_0xde55('0xc')]('MemberReport,\x20%s,\x20%s',_0x1468f2,'request\x20sent');logger[_0xde55('0xd')](_0xde55('0xe'),_0x1468f2,'request\x20sent',JSON[_0xde55('0xf')](_0x11aa16));if(_0x11aa16[_0xde55('0x10')]){if(_0x11aa16['error'][_0xde55('0x11')]===0x1f4){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16['error'][_0xde55('0x13')]);return _0x22cbd8(_0x11aa16[_0xde55('0x10')][_0xde55('0x13')]);}logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16[_0xde55('0x10')]['message']);return _0x2094bb(_0x11aa16['error'][_0xde55('0x13')]);}else{logger[_0xde55('0xc')]('MemberReport,\x20%s,\x20%s',_0x1468f2,_0xde55('0x14'));_0x2094bb(_0x11aa16[_0xde55('0x15')][_0xde55('0x13')]);}})[_0xde55('0x16')](function(_0x2f4a77){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x2f4a77);_0x22cbd8(_0x2f4a77);});});}exports[_0xde55('0x17')]=function(_0x4a97e2){var _0x1abffb=this;return new Promise(function(_0x42b6e4,_0x13551d){return db[_0xde55('0x18')]['findAll']({'raw':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1b')]||null:null,'attributes':_0x4a97e2['options']?_0x4a97e2[_0xde55('0x19')]['attributes']||null:null,'limit':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1c')]||null:null,'include':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2[_0xde55('0x19')][_0xde55('0x1d')]?_[_0xde55('0x1e')](_0x4a97e2[_0xde55('0x19')][_0xde55('0x1d')],function(_0x2e7607){return{'model':db[_0x2e7607[_0xde55('0x1f')]],'as':_0x2e7607['as'],'attributes':_0x2e7607['attributes'],'include':_0x2e7607['include']?_[_0xde55('0x1e')](_0x2e7607[_0xde55('0x1d')],function(_0x15a04b){return{'model':db[_0x15a04b[_0xde55('0x1f')]],'as':_0x15a04b['as'],'attributes':_0x15a04b[_0xde55('0x20')],'include':_0x15a04b[_0xde55('0x1d')]?_[_0xde55('0x1e')](_0x15a04b[_0xde55('0x1d')],function(_0x35f246){return{'model':db[_0x35f246[_0xde55('0x1f')]],'as':_0x35f246['as'],'attributes':_0x35f246[_0xde55('0x20')]};}):[]};}):[]};}):[]:[]})[_0xde55('0x21')](function(_0x43c1f4){logger['info']('GetMemberReport',_0x4a97e2);logger[_0xde55('0xd')]('GetMemberReport',_0x4a97e2,JSON[_0xde55('0xf')](_0x43c1f4));_0x42b6e4(_0x43c1f4);})[_0xde55('0x16')](function(_0x2c42a2){logger['error'](_0xde55('0x17'),_0x2c42a2[_0xde55('0x13')],_0x4a97e2);_0x13551d(_0x1abffb['error'](0x1f4,_0x2c42a2[_0xde55('0x13')]));});});};exports[_0xde55('0x22')]=function(_0x76b11f){var _0x513eb5=this;return new Promise(function(_0x586008,_0x2629ea){return db[_0xde55('0x18')][_0xde55('0x23')](_0x76b11f[_0xde55('0x24')],{'raw':_0x76b11f[_0xde55('0x19')]?_0x76b11f[_0xde55('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xde55('0x21')](function(_0x4b92d8){logger[_0xde55('0xc')]('CreateMemberReport',_0x76b11f);logger[_0xde55('0xd')](_0xde55('0x22'),_0x76b11f,JSON[_0xde55('0xf')](_0x4b92d8));_0x586008(_0x4b92d8);})[_0xde55('0x16')](function(_0x12efc3){logger[_0xde55('0x10')](_0xde55('0x22'),_0x12efc3['message'],_0x76b11f);_0x2629ea(_0x513eb5[_0xde55('0x10')](0x1f4,_0x12efc3[_0xde55('0x13')]));});});};exports[_0xde55('0x25')]=function(_0x557097){var _0x17a0c5=this;return new Promise(function(_0x4e50dd,_0x196af8){return db['MemberReport'][_0xde55('0x26')](_0x557097[_0xde55('0x24')],{'raw':_0x557097['options']?_0x557097['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x557097[_0xde55('0x19')]?_0x557097[_0xde55('0x19')][_0xde55('0x1b')]||null:null,'attributes':_0x557097[_0xde55('0x19')]?_0x557097[_0xde55('0x19')][_0xde55('0x20')]||null:null,'limit':_0x557097[_0xde55('0x19')]?_0x557097[_0xde55('0x19')]['limit']||null:null})['then'](function(_0x1d0178){logger[_0xde55('0xc')](_0xde55('0x25'),_0x557097);logger[_0xde55('0xd')](_0xde55('0x25'),_0x557097,JSON[_0xde55('0xf')](_0x1d0178));_0x4e50dd(_0x1d0178);})[_0xde55('0x16')](function(_0x3ba8ed){logger[_0xde55('0x10')](_0xde55('0x25'),_0x3ba8ed[_0xde55('0x13')],_0x557097);_0x196af8(_0x17a0c5[_0xde55('0x10')](0x1f4,_0x3ba8ed[_0xde55('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index ee0e5ce..f41f623 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 _0x8169=['../../components/auth/service','./migration.controller','get','exports','multer','path','Router','fs-extra'];(function(_0x36dc1d,_0x248a85){var _0x1541b5=function(_0x2b92b1){while(--_0x2b92b1){_0x36dc1d['push'](_0x36dc1d['shift']());}};_0x1541b5(++_0x248a85);}(_0x8169,0xd4));var _0x9816=function(_0x30d568,_0x3c9f9b){_0x30d568=_0x30d568-0x0;var _0x10e8ff=_0x8169[_0x30d568];return _0x10e8ff;};'use strict';var multer=require(_0x9816('0x0'));var util=require('util');var path=require(_0x9816('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9816('0x2')]();var fs_extra=require(_0x9816('0x3'));var auth=require(_0x9816('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9816('0x5'));router[_0x9816('0x6')]('/',controller['index']);module[_0x9816('0x7')]=router; \ No newline at end of file +var _0x7a22=['fs-extra','../../components/interaction/service','./migration.controller','index','exports','multer','path','express'];(function(_0x3ed6ea,_0x3d28c9){var _0x3af06e=function(_0x48572f){while(--_0x48572f){_0x3ed6ea['push'](_0x3ed6ea['shift']());}};_0x3af06e(++_0x3d28c9);}(_0x7a22,0x1cd));var _0x27a2=function(_0x1fe200,_0x2aeacb){_0x1fe200=_0x1fe200-0x0;var _0x561a92=_0x7a22[_0x1fe200];return _0x561a92;};'use strict';var multer=require(_0x27a2('0x0'));var util=require('util');var path=require(_0x27a2('0x1'));var timeout=require('connect-timeout');var express=require(_0x27a2('0x2'));var router=express['Router']();var fs_extra=require(_0x27a2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x27a2('0x4'));var config=require('../../config/environment');var controller=require(_0x27a2('0x5'));router['get']('/',controller[_0x27a2('0x6')]);module[_0x27a2('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index a8ab491..325769e 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 _0xe1ba=['sequelize','exports','STRING','version'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xe1ba,0x1b0));var _0xae1b=function(_0x2a1ff7,_0x4e44cb){_0x2a1ff7=_0x2a1ff7-0x0;var _0x168537=_0xe1ba[_0x2a1ff7];return _0x168537;};'use strict';var Sequelize=require(_0xae1b('0x0'));module[_0xae1b('0x1')]={'version':{'type':Sequelize[_0xae1b('0x2')],'unique':_0xae1b('0x3')}}; \ No newline at end of file +var _0x646d=['sequelize','version'];(function(_0x1284e2,_0x149240){var _0x4f19bb=function(_0x312fd5){while(--_0x312fd5){_0x1284e2['push'](_0x1284e2['shift']());}};_0x4f19bb(++_0x149240);}(_0x646d,0x1c8));var _0xd646=function(_0x75f7c6,_0x32f25d){_0x75f7c6=_0x75f7c6-0x0;var _0x33137c=_0x646d[_0x75f7c6];return _0x33137c;};'use strict';var Sequelize=require(_0xd646('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xd646('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6673232..3fe3af5 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 _0xdc6f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xdc6f,0x8c));var _0xfdc6=function(_0x9c5512,_0x5651f1){_0x9c5512=_0x9c5512-0x0;var _0x5c4f5d=_0xdc6f[_0x9c5512];return _0x5c4f5d;};'use strict';var emlformat=require(_0xfdc6('0x0'));var rimraf=require(_0xfdc6('0x1'));var zipdir=require(_0xfdc6('0x2'));var jsonpatch=require(_0xfdc6('0x3'));var rp=require(_0xfdc6('0x4'));var moment=require(_0xfdc6('0x5'));var BPromise=require(_0xfdc6('0x6'));var Mustache=require(_0xfdc6('0x7'));var util=require(_0xfdc6('0x8'));var path=require(_0xfdc6('0x9'));var sox=require(_0xfdc6('0xa'));var csv=require(_0xfdc6('0xb'));var ejs=require(_0xfdc6('0xc'));var fs=require('fs');var fs_extra=require(_0xfdc6('0xd'));var _=require('lodash');var squel=require(_0xfdc6('0xe'));var crypto=require(_0xfdc6('0xf'));var jsforce=require(_0xfdc6('0x10'));var deskjs=require(_0xfdc6('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfdc6('0x12'));var hardwareService=require(_0xfdc6('0x13'));var logger=require(_0xfdc6('0x14'))(_0xfdc6('0x15'));var utils=require(_0xfdc6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfdc6('0x17'));var db=require(_0xfdc6('0x18'))['db'];function respondWithStatusCode(_0x3142f2,_0x202330){_0x202330=_0x202330||0xcc;return function(_0x3be1d4){if(_0x3be1d4){return _0x3142f2[_0xfdc6('0x19')](_0x202330);}return _0x3142f2[_0xfdc6('0x1a')](_0x202330)['end']();};}function respondWithResult(_0x3c9774,_0x489c6e){_0x489c6e=_0x489c6e||0xc8;return function(_0x743a44){if(_0x743a44){return _0x3c9774[_0xfdc6('0x1a')](_0x489c6e)['json'](_0x743a44);}};}function respondWithFilteredResult(_0x39d7ed,_0x46ad4b){return function(_0x67735e){if(_0x67735e){var _0x528d83=typeof _0x46ad4b[_0xfdc6('0x1b')]===_0xfdc6('0x1c')&&typeof _0x46ad4b[_0xfdc6('0x1d')]===_0xfdc6('0x1c');var _0xedeed5=_0x67735e[_0xfdc6('0x1e')];var _0x5ed3f9=_0x528d83?0x0:_0x46ad4b[_0xfdc6('0x1b')];var _0x29b8f0=_0x528d83?_0x67735e[_0xfdc6('0x1e')]:_0x46ad4b[_0xfdc6('0x1b')]+_0x46ad4b[_0xfdc6('0x1d')];var _0x1915eb;if(_0x29b8f0>=_0xedeed5){_0x29b8f0=_0xedeed5;_0x1915eb=0xc8;}else{_0x1915eb=0xce;}_0x39d7ed[_0xfdc6('0x1a')](_0x1915eb);return _0x39d7ed[_0xfdc6('0x1f')](_0xfdc6('0x20'),_0x5ed3f9+'-'+_0x29b8f0+'/'+_0xedeed5)[_0xfdc6('0x21')](_0x67735e);}return null;};}function patchUpdates(_0x4058c3){return function(_0x3d2f57){try{jsonpatch[_0xfdc6('0x22')](_0x3d2f57,_0x4058c3,!![]);}catch(_0x2cbd5c){return BPromise['reject'](_0x2cbd5c);}return _0x3d2f57[_0xfdc6('0x23')]();};}function saveUpdates(_0x13c630,_0x3828b4){return function(_0x17b55c){if(_0x17b55c){return _0x17b55c[_0xfdc6('0x24')](_0x13c630)[_0xfdc6('0x25')](function(_0x214a8d){return _0x214a8d;});}return null;};}function removeEntity(_0x25086d,_0x576916){return function(_0x2f1713){if(_0x2f1713){return _0x2f1713[_0xfdc6('0x26')]()['then'](function(){_0x25086d[_0xfdc6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf46d9,_0x37ed25){return function(_0x42257c){if(!_0x42257c){_0xbf46d9[_0xfdc6('0x19')](0x194);}return _0x42257c;};}function handleError(_0x5bf0ff,_0x2a9156){_0x2a9156=_0x2a9156||0x1f4;return function(_0x2a2c26){logger['error'](_0x2a2c26[_0xfdc6('0x27')]);if(_0x2a2c26[_0xfdc6('0x28')]){delete _0x2a2c26[_0xfdc6('0x28')];}_0x5bf0ff[_0xfdc6('0x1a')](_0x2a9156)[_0xfdc6('0x29')](_0x2a2c26);};}exports[_0xfdc6('0x2a')]=function(_0x2a7c69,_0x48ad97){var _0x18a398={},_0x4f5991={},_0x1b55ee={'count':0x0,'rows':[]};var _0x234639=_[_0xfdc6('0x2b')](db[_0xfdc6('0x2c')][_0xfdc6('0x2d')],function(_0x2166bb){return{'name':_0x2166bb[_0xfdc6('0x2e')],'type':_0x2166bb[_0xfdc6('0x2f')][_0xfdc6('0x30')]};});_0x4f5991[_0xfdc6('0x31')]=_[_0xfdc6('0x2b')](_0x234639,_0xfdc6('0x28'));_0x4f5991[_0xfdc6('0x32')]=_[_0xfdc6('0x33')](_0x2a7c69[_0xfdc6('0x32')]);_0x4f5991[_0xfdc6('0x34')]=_[_0xfdc6('0x35')](_0x4f5991['model'],_0x4f5991[_0xfdc6('0x32')]);_0x18a398[_0xfdc6('0x36')]=_['intersection'](_0x4f5991['model'],qs[_0xfdc6('0x37')](_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x37')]));_0x18a398['attributes']=_0x18a398[_0xfdc6('0x36')]['length']?_0x18a398[_0xfdc6('0x36')]:_0x4f5991['model'];if(!_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x38')]('nolimit')){_0x18a398[_0xfdc6('0x1d')]=qs[_0xfdc6('0x1d')](_0x2a7c69[_0xfdc6('0x32')]['limit']);_0x18a398[_0xfdc6('0x1b')]=qs['offset'](_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x1b')]);}_0x18a398[_0xfdc6('0x39')]=qs[_0xfdc6('0x3a')](_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x3a')]);_0x18a398[_0xfdc6('0x3b')]=qs[_0xfdc6('0x34')](_[_0xfdc6('0x3c')](_0x2a7c69[_0xfdc6('0x32')],_0x4f5991['filters']),_0x234639);if(_0x2a7c69[_0xfdc6('0x32')]['filter']){_0x18a398['where']=_[_0xfdc6('0x3d')](_0x18a398[_0xfdc6('0x3b')],{'$or':_['map'](_0x234639,function(_0x183231){if(_0x183231[_0xfdc6('0x2f')]!==_0xfdc6('0x3e')){var _0x79bb0d={};_0x79bb0d[_0x183231[_0xfdc6('0x28')]]={'$like':'%'+_0x2a7c69[_0xfdc6('0x32')][_0xfdc6('0x3f')]+'%'};return _0x79bb0d;}})});}_0x18a398=_[_0xfdc6('0x3d')]({},_0x18a398,_0x2a7c69[_0xfdc6('0x40')]);var _0xb58fdc={'where':_0x18a398[_0xfdc6('0x3b')]};return db['Migration'][_0xfdc6('0x1e')](_0xb58fdc)[_0xfdc6('0x25')](function(_0x49c52e){_0x1b55ee['count']=_0x49c52e;if(_0x2a7c69['query'][_0xfdc6('0x41')]){_0x18a398[_0xfdc6('0x42')]=[{'all':!![]}];}return db[_0xfdc6('0x2c')][_0xfdc6('0x43')](_0x18a398);})['then'](function(_0x5c57a9){_0x1b55ee[_0xfdc6('0x44')]=_0x5c57a9;return _0x1b55ee;})['then'](respondWithFilteredResult(_0x48ad97,_0x18a398))[_0xfdc6('0x45')](handleError(_0x48ad97,null));}; \ No newline at end of file +var _0xcc8e=['status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','Migration','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','where','merge','map','VIRTUAL','filter','options','include','findAll','catch','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x49d280,_0x33d68f){var _0x25274a=function(_0x8ace90){while(--_0x8ace90){_0x49d280['push'](_0x49d280['shift']());}};_0x25274a(++_0x33d68f);}(_0xcc8e,0xa3));var _0xecc8=function(_0x24b614,_0x214193){_0x24b614=_0x24b614-0x0;var _0x2bf294=_0xcc8e[_0x24b614];return _0x2bf294;};'use strict';var emlformat=require(_0xecc8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecc8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecc8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xecc8('0x3'));var util=require(_0xecc8('0x4'));var path=require('path');var sox=require(_0xecc8('0x5'));var csv=require(_0xecc8('0x6'));var ejs=require(_0xecc8('0x7'));var fs=require('fs');var fs_extra=require(_0xecc8('0x8'));var _=require(_0xecc8('0x9'));var squel=require(_0xecc8('0xa'));var crypto=require(_0xecc8('0xb'));var jsforce=require(_0xecc8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecc8('0x6'));var querystring=require(_0xecc8('0xd'));var Papa=require(_0xecc8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xecc8('0xf'));var hardwareService=require(_0xecc8('0x10'));var logger=require(_0xecc8('0x11'))(_0xecc8('0x12'));var utils=require(_0xecc8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xecc8('0x14'));var db=require(_0xecc8('0x15'))['db'];function respondWithStatusCode(_0x334687,_0x3398e1){_0x3398e1=_0x3398e1||0xcc;return function(_0xd415d3){if(_0xd415d3){return _0x334687[_0xecc8('0x16')](_0x3398e1);}return _0x334687['status'](_0x3398e1)['end']();};}function respondWithResult(_0x14edcd,_0x3d3ee2){_0x3d3ee2=_0x3d3ee2||0xc8;return function(_0x177e45){if(_0x177e45){return _0x14edcd[_0xecc8('0x17')](_0x3d3ee2)[_0xecc8('0x18')](_0x177e45);}};}function respondWithFilteredResult(_0x54f892,_0x14fd07){return function(_0x1b214c){if(_0x1b214c){var _0x565805=typeof _0x14fd07[_0xecc8('0x19')]===_0xecc8('0x1a')&&typeof _0x14fd07[_0xecc8('0x1b')]==='undefined';var _0xad217c=_0x1b214c[_0xecc8('0x1c')];var _0x284d4b=_0x565805?0x0:_0x14fd07[_0xecc8('0x19')];var _0x39d53d=_0x565805?_0x1b214c['count']:_0x14fd07[_0xecc8('0x19')]+_0x14fd07['limit'];var _0x5bbc11;if(_0x39d53d>=_0xad217c){_0x39d53d=_0xad217c;_0x5bbc11=0xc8;}else{_0x5bbc11=0xce;}_0x54f892[_0xecc8('0x17')](_0x5bbc11);return _0x54f892[_0xecc8('0x1d')]('Content-Range',_0x284d4b+'-'+_0x39d53d+'/'+_0xad217c)[_0xecc8('0x18')](_0x1b214c);}return null;};}function patchUpdates(_0xd190){return function(_0x3584ee){try{jsonpatch[_0xecc8('0x1e')](_0x3584ee,_0xd190,!![]);}catch(_0x327c17){return BPromise[_0xecc8('0x1f')](_0x327c17);}return _0x3584ee[_0xecc8('0x20')]();};}function saveUpdates(_0x23191b,_0x33576b){return function(_0x22cfe5){if(_0x22cfe5){return _0x22cfe5['update'](_0x23191b)[_0xecc8('0x21')](function(_0x2e2ce0){return _0x2e2ce0;});}return null;};}function removeEntity(_0x281b60,_0x12238f){return function(_0x2eb891){if(_0x2eb891){return _0x2eb891[_0xecc8('0x22')]()[_0xecc8('0x21')](function(){_0x281b60[_0xecc8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462926,_0x4afb87){return function(_0x4e267c){if(!_0x4e267c){_0x462926['sendStatus'](0x194);}return _0x4e267c;};}function handleError(_0x51fa48,_0x2d22dc){_0x2d22dc=_0x2d22dc||0x1f4;return function(_0x2b2272){logger[_0xecc8('0x23')](_0x2b2272[_0xecc8('0x24')]);if(_0x2b2272['name']){delete _0x2b2272['name'];}_0x51fa48[_0xecc8('0x17')](_0x2d22dc)['send'](_0x2b2272);};}exports['index']=function(_0x4b2f00,_0x1bd89c){var _0x2987e9={},_0xd51beb={},_0x1bf822={'count':0x0,'rows':[]};var _0x88b2c0=_['map'](db[_0xecc8('0x25')][_0xecc8('0x26')],function(_0x259b92){return{'name':_0x259b92[_0xecc8('0x27')],'type':_0x259b92[_0xecc8('0x28')]['key']};});_0xd51beb[_0xecc8('0x29')]=_['map'](_0x88b2c0,_0xecc8('0x2a'));_0xd51beb[_0xecc8('0x2b')]=_[_0xecc8('0x2c')](_0x4b2f00['query']);_0xd51beb[_0xecc8('0x2d')]=_['intersection'](_0xd51beb[_0xecc8('0x29')],_0xd51beb['query']);_0x2987e9[_0xecc8('0x2e')]=_[_0xecc8('0x2f')](_0xd51beb[_0xecc8('0x29')],qs[_0xecc8('0x30')](_0x4b2f00[_0xecc8('0x2b')][_0xecc8('0x30')]));_0x2987e9[_0xecc8('0x2e')]=_0x2987e9[_0xecc8('0x2e')]['length']?_0x2987e9[_0xecc8('0x2e')]:_0xd51beb[_0xecc8('0x29')];if(!_0x4b2f00[_0xecc8('0x2b')][_0xecc8('0x31')]('nolimit')){_0x2987e9[_0xecc8('0x1b')]=qs[_0xecc8('0x1b')](_0x4b2f00['query'][_0xecc8('0x1b')]);_0x2987e9[_0xecc8('0x19')]=qs['offset'](_0x4b2f00[_0xecc8('0x2b')][_0xecc8('0x19')]);}_0x2987e9[_0xecc8('0x32')]=qs[_0xecc8('0x33')](_0x4b2f00[_0xecc8('0x2b')][_0xecc8('0x33')]);_0x2987e9['where']=qs[_0xecc8('0x2d')](_[_0xecc8('0x34')](_0x4b2f00[_0xecc8('0x2b')],_0xd51beb[_0xecc8('0x2d')]),_0x88b2c0);if(_0x4b2f00[_0xecc8('0x2b')]['filter']){_0x2987e9[_0xecc8('0x35')]=_[_0xecc8('0x36')](_0x2987e9[_0xecc8('0x35')],{'$or':_[_0xecc8('0x37')](_0x88b2c0,function(_0x2f1bc3){if(_0x2f1bc3[_0xecc8('0x28')]!==_0xecc8('0x38')){var _0xa981c9={};_0xa981c9[_0x2f1bc3[_0xecc8('0x2a')]]={'$like':'%'+_0x4b2f00['query'][_0xecc8('0x39')]+'%'};return _0xa981c9;}})});}_0x2987e9=_[_0xecc8('0x36')]({},_0x2987e9,_0x4b2f00[_0xecc8('0x3a')]);var _0x3f420a={'where':_0x2987e9[_0xecc8('0x35')]};return db[_0xecc8('0x25')][_0xecc8('0x1c')](_0x3f420a)[_0xecc8('0x21')](function(_0x4b66e3){_0x1bf822[_0xecc8('0x1c')]=_0x4b66e3;if(_0x4b2f00[_0xecc8('0x2b')]['includeAll']){_0x2987e9[_0xecc8('0x3b')]=[{'all':!![]}];}return db['Migration'][_0xecc8('0x3c')](_0x2987e9);})[_0xecc8('0x21')](function(_0x2643f5){_0x1bf822['rows']=_0x2643f5;return _0x1bf822;})['then'](respondWithFilteredResult(_0x1bd89c,_0x2987e9))[_0xecc8('0x3d')](handleError(_0x1bd89c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 21b1b78..d29d850 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 _0xe918=['../../config/logger','moment','bluebird','rimraf','./migration.attributes','exports','migrations','lodash','util'];(function(_0x465c18,_0x5c2a07){var _0x4907df=function(_0x5d2217){while(--_0x5d2217){_0x465c18['push'](_0x465c18['shift']());}};_0x4907df(++_0x5c2a07);}(_0xe918,0x1c0));var _0x8e91=function(_0x310870,_0x5d4149){_0x310870=_0x310870-0x0;var _0x5f2b2a=_0xe918[_0x310870];return _0x5f2b2a;};'use strict';var _=require(_0x8e91('0x0'));var util=require(_0x8e91('0x1'));var logger=require(_0x8e91('0x2'))('api');var moment=require(_0x8e91('0x3'));var BPromise=require(_0x8e91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e91('0x5'));var config=require('../../config/environment');var attributes=require(_0x8e91('0x6'));module[_0x8e91('0x7')]=function(_0x495e38,_0x1f98f2){return _0x495e38['define']('Migration',attributes,{'tableName':_0x8e91('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc04=['../../config/environment','./migration.attributes','exports','define','Migration','lodash','util','../../config/logger','api','bluebird'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xbc04,0xaf));var _0x4bc0=function(_0x4b5398,_0x1ded36){_0x4b5398=_0x4b5398-0x0;var _0x3c1039=_0xbc04[_0x4b5398];return _0x3c1039;};'use strict';var _=require(_0x4bc0('0x0'));var util=require(_0x4bc0('0x1'));var logger=require(_0x4bc0('0x2'))(_0x4bc0('0x3'));var moment=require('moment');var BPromise=require(_0x4bc0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4bc0('0x5'));var attributes=require(_0x4bc0('0x6'));module[_0x4bc0('0x7')]=function(_0x5d51f6,_0x286f13){return _0x5d51f6[_0x4bc0('0x8')](_0x4bc0('0x9'),attributes,{'tableName':'migrations','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 d88b1af..a14fe25 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 _0x1339=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x101d87,_0x2c2297){var _0x391e89=function(_0xe41c85){while(--_0xe41c85){_0x101d87['push'](_0x101d87['shift']());}};_0x391e89(++_0x2c2297);}(_0x1339,0x1bf));var _0x9133=function(_0x155e20,_0x5b2b32){_0x155e20=_0x155e20-0x0;var _0x306192=_0x1339[_0x155e20];return _0x306192;};'use strict';var _=require(_0x9133('0x0'));var util=require(_0x9133('0x1'));var moment=require('moment');var BPromise=require(_0x9133('0x2'));var rs=require(_0x9133('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9133('0x4'));var logger=require(_0x9133('0x5'))('rpc');var config=require(_0x9133('0x6'));var jayson=require(_0x9133('0x7'));var client=jayson[_0x9133('0x8')][_0x9133('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x81460c,_0x524719,_0x4c7852){return new BPromise(function(_0x2c37ce,_0x5762bc){return client[_0x9133('0xa')](_0x81460c,_0x4c7852)['then'](function(_0x41af31){logger['info'](_0x9133('0xb'),_0x524719,_0x9133('0xc'));logger[_0x9133('0xd')](_0x9133('0xe'),_0x524719,'request\x20sent',JSON['stringify'](_0x41af31));if(_0x41af31['error']){if(_0x41af31[_0x9133('0xf')][_0x9133('0x10')]===0x1f4){logger[_0x9133('0xf')]('Migration,\x20%s,\x20%s',_0x524719,_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);return _0x5762bc(_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);}logger[_0x9133('0xf')](_0x9133('0xb'),_0x524719,_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);return _0x2c37ce(_0x41af31[_0x9133('0xf')]['message']);}else{logger[_0x9133('0x12')]('Migration,\x20%s,\x20%s',_0x524719,'request\x20sent');_0x2c37ce(_0x41af31[_0x9133('0x13')][_0x9133('0x11')]);}})[_0x9133('0x14')](function(_0x34432e){logger[_0x9133('0xf')](_0x9133('0xb'),_0x524719,_0x34432e);_0x5762bc(_0x34432e);});});} \ No newline at end of file +var _0xa477=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1a2067,_0x3b141b){var _0x4a76ce=function(_0x5870d7){while(--_0x5870d7){_0x1a2067['push'](_0x1a2067['shift']());}};_0x4a76ce(++_0x3b141b);}(_0xa477,0xe6));var _0x7a47=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa477[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 79703c3..15c8da4 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 _0x1fa9=['put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','post','create'];(function(_0x5e9e76,_0x26fd08){var _0x4ea855=function(_0xfc7b83){while(--_0xfc7b83){_0x5e9e76['push'](_0x5e9e76['shift']());}};_0x4ea855(++_0x26fd08);}(_0x1fa9,0x136));var _0x91fa=function(_0x44833c,_0x20394d){_0x44833c=_0x44833c-0x0;var _0x503434=_0x1fa9[_0x44833c];return _0x503434;};'use strict';var multer=require(_0x91fa('0x0'));var util=require('util');var path=require(_0x91fa('0x1'));var timeout=require('connect-timeout');var express=require(_0x91fa('0x2'));var router=express[_0x91fa('0x3')]();var fs_extra=require(_0x91fa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x91fa('0x5'));var config=require(_0x91fa('0x6'));var controller=require(_0x91fa('0x7'));router[_0x91fa('0x8')]('/',auth[_0x91fa('0x9')](),controller['index']);router[_0x91fa('0x8')](_0x91fa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x91fa('0xb')]('/',auth[_0x91fa('0x9')](),controller[_0x91fa('0xc')]);router[_0x91fa('0xd')](_0x91fa('0xa'),auth[_0x91fa('0x9')](),controller[_0x91fa('0xe')]);router['delete']('/:id',auth[_0x91fa('0x9')](),controller[_0x91fa('0xf')]);module[_0x91fa('0x10')]=router; \ No newline at end of file +var _0x6d11=['util','path','express','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer'];(function(_0x365c61,_0x42532d){var _0x894d1=function(_0x240171){while(--_0x240171){_0x365c61['push'](_0x365c61['shift']());}};_0x894d1(++_0x42532d);}(_0x6d11,0xbf));var _0x16d1=function(_0x12c43b,_0x2197f6){_0x12c43b=_0x12c43b-0x0;var _0x1ffd81=_0x6d11[_0x12c43b];return _0x1ffd81;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var fs_extra=require(_0x16d1('0x4'));var auth=require(_0x16d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x16d1('0x6'));router[_0x16d1('0x7')]('/',auth[_0x16d1('0x8')](),controller[_0x16d1('0x9')]);router[_0x16d1('0x7')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x16d1('0xb')]);router[_0x16d1('0xc')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['update']);router[_0x16d1('0xd')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0xe')]);module[_0x16d1('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2fbea45..88676a3 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 _0xa586=['ENUM','externip','stun','turn','STRING'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xa586,0x136));var _0x6a58=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa586[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6a58('0x0')]('localnet',_0x6a58('0x1'),_0x6a58('0x2'),_0x6a58('0x3'))},'value':{'type':Sequelize[_0x6a58('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1dcf=['turn','STRING','sequelize','externip','stun'];(function(_0x5a66c3,_0x96b255){var _0xa2028d=function(_0x40bfc2){while(--_0x40bfc2){_0x5a66c3['push'](_0x5a66c3['shift']());}};_0xa2028d(++_0x96b255);}(_0x1dcf,0x1d8));var _0xf1dc=function(_0x4e924f,_0x2b7e01){_0x4e924f=_0x4e924f-0x0;var _0xb9a6a2=_0x1dcf[_0x4e924f];return _0xb9a6a2;};'use strict';var Sequelize=require(_0xf1dc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('localnet',_0xf1dc('0x1'),_0xf1dc('0x2'),_0xf1dc('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf1dc('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 63acaa3..129a545 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 _0x5a30=['../../config/logger','api','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','json','offset','limit','count','set','Content-Range','update','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','merge','options','Network','include','findAll','rows','show','params','length','includeAll','find','create','type','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','body','toLowerCase','chan_sip.so','res_stun_monitor.so','TURN','/etc/asterisk/sip_xcally_%s.conf','destroy','path','ejs','lodash','../../components/parsers/qs'];(function(_0x302ebd,_0x75a305){var _0xead486=function(_0x29168d){while(--_0x29168d){_0x302ebd['push'](_0x302ebd['shift']());}};_0xead486(++_0x75a305);}(_0x5a30,0xf8));var _0x05a3=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0x5a30[_0x16dbfd];return _0x382254;};'use strict';var util=require('util');var path=require(_0x05a3('0x0'));var ejs=require(_0x05a3('0x1'));var fs=require('fs');var _=require(_0x05a3('0x2'));var qs=require(_0x05a3('0x3'));var logger=require(_0x05a3('0x4'))(_0x05a3('0x5'));var config=require('../../config/environment');var db=require(_0x05a3('0x6'))['db'];var jayson=require(_0x05a3('0x7'));var client=jayson['client'][_0x05a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52ccbd,_0x3b488b,_0xbc5213,_0x134ba8){return new Promise(function(_0x58732d,_0x871cb){var _0x3cb8f6=_0x134ba8||client;return _0x3cb8f6[_0x05a3('0x9')](_0x52ccbd,_0xbc5213)[_0x05a3('0xa')](function(_0x207bab){logger[_0x05a3('0xb')](_0x05a3('0xc'),_0x3b488b,'request\x20sent');logger['debug'](_0x05a3('0xd'),_0x3b488b,_0x05a3('0xe'),JSON[_0x05a3('0xf')](_0x207bab));if(_0x207bab[_0x05a3('0x10')]){if(_0x207bab[_0x05a3('0x10')][_0x05a3('0x11')]===0x1f4){logger[_0x05a3('0x10')](_0x05a3('0xc'),_0x3b488b,_0x207bab[_0x05a3('0x10')][_0x05a3('0x12')]);return _0x871cb(_0x207bab[_0x05a3('0x10')][_0x05a3('0x12')]);}logger[_0x05a3('0x10')](_0x05a3('0xc'),_0x3b488b,_0x207bab[_0x05a3('0x10')]['message']);return _0x58732d(_0x207bab[_0x05a3('0x10')][_0x05a3('0x12')]);}else{logger[_0x05a3('0xb')](_0x05a3('0xc'),_0x3b488b,_0x05a3('0xe'));_0x58732d(_0x207bab[_0x05a3('0x13')][_0x05a3('0x12')]);}})[_0x05a3('0x14')](function(_0x303a99){logger[_0x05a3('0x10')](_0x05a3('0xc'),_0x3b488b,_0x303a99);_0x871cb(_0x303a99);});});}function respondWithResult(_0x4f0d45,_0x5ec078){_0x5ec078=_0x5ec078||0xc8;return function(_0x9680af){if(_0x9680af){return _0x4f0d45['status'](_0x5ec078)[_0x05a3('0x15')](_0x9680af);}};}function respondWithFilteredResult(_0x19f3ef,_0x5edd30){return function(_0x2a8526){if(_0x2a8526){var _0x574e3c=typeof _0x5edd30[_0x05a3('0x16')]==='undefined'&&typeof _0x5edd30[_0x05a3('0x17')]==='undefined';var _0x28b7d3=_0x2a8526[_0x05a3('0x18')];var _0x1b0e19=_0x574e3c?0x0:_0x5edd30[_0x05a3('0x16')];var _0x1f6502=_0x574e3c?_0x2a8526[_0x05a3('0x18')]:_0x5edd30[_0x05a3('0x16')]+_0x5edd30['limit'];var _0x469e09;if(_0x1f6502>=_0x28b7d3){_0x1f6502=_0x28b7d3;_0x469e09=0xc8;}else{_0x469e09=0xce;}_0x19f3ef['status'](_0x469e09);return _0x19f3ef[_0x05a3('0x19')](_0x05a3('0x1a'),_0x1b0e19+'-'+_0x1f6502+'/'+_0x28b7d3)[_0x05a3('0x15')](_0x2a8526);}return null;};}function saveUpdates(_0x19b449){return function(_0x30b8eb){if(_0x30b8eb){return _0x30b8eb[_0x05a3('0x1b')](_0x19b449)[_0x05a3('0xa')](function(_0x34ede8){return _0x34ede8;});}return null;};}function removeEntity(_0x37352c){return function(_0x3a56ab){if(_0x3a56ab){return _0x3a56ab['destroy']()[_0x05a3('0xa')](function(){_0x37352c['status'](0xcc)[_0x05a3('0x1c')]();});}};}function handleEntityNotFound(_0x46f6a4){return function(_0x20e6db){if(!_0x20e6db){_0x46f6a4[_0x05a3('0x1d')](0x194);}return _0x20e6db;};}function handleError(_0x5d0a68,_0x2472fe){_0x2472fe=_0x2472fe||0x1f4;return function(_0x427b99){logger[_0x05a3('0x10')](_0x427b99[_0x05a3('0x1e')]);if(_0x427b99[_0x05a3('0x1f')]){delete _0x427b99[_0x05a3('0x1f')];}_0x5d0a68['status'](_0x2472fe)[_0x05a3('0x20')](_0x427b99);};}exports[_0x05a3('0x21')]=function(_0x41cfd6,_0x1d2e85){var _0x163495={},_0x225c78={},_0x44fc33={'count':0x0,'rows':[]};var _0x21775f=_[_0x05a3('0x22')](db['Network'][_0x05a3('0x23')],function(_0x1847bd){return{'name':_0x1847bd[_0x05a3('0x24')],'type':_0x1847bd['type'][_0x05a3('0x25')]};});_0x225c78['model']=_[_0x05a3('0x22')](_0x21775f,_0x05a3('0x1f'));_0x225c78[_0x05a3('0x26')]=_[_0x05a3('0x27')](_0x41cfd6[_0x05a3('0x26')]);_0x225c78[_0x05a3('0x28')]=_[_0x05a3('0x29')](_0x225c78[_0x05a3('0x2a')],_0x225c78[_0x05a3('0x26')]);_0x163495[_0x05a3('0x2b')]=_['intersection'](_0x225c78['model'],qs[_0x05a3('0x2c')](_0x41cfd6[_0x05a3('0x26')]['fields']));_0x163495[_0x05a3('0x2b')]=_0x163495['attributes']['length']?_0x163495[_0x05a3('0x2b')]:_0x225c78['model'];if(!_0x41cfd6[_0x05a3('0x26')]['hasOwnProperty'](_0x05a3('0x2d'))){_0x163495[_0x05a3('0x17')]=qs[_0x05a3('0x17')](_0x41cfd6[_0x05a3('0x26')][_0x05a3('0x17')]);_0x163495['offset']=qs['offset'](_0x41cfd6[_0x05a3('0x26')][_0x05a3('0x16')]);}_0x163495[_0x05a3('0x2e')]=qs[_0x05a3('0x2f')](_0x41cfd6[_0x05a3('0x26')][_0x05a3('0x2f')]);_0x163495[_0x05a3('0x30')]=qs['filters'](_['pick'](_0x41cfd6['query'],_0x225c78[_0x05a3('0x28')]),_0x21775f);if(_0x41cfd6[_0x05a3('0x26')]['filter']){_0x163495[_0x05a3('0x30')]=_[_0x05a3('0x31')](_0x163495[_0x05a3('0x30')],{'$or':_[_0x05a3('0x22')](_0x21775f,function(_0x591830){if(_0x591830['type']!=='VIRTUAL'){var _0x8da496={};_0x8da496[_0x591830[_0x05a3('0x1f')]]={'$like':'%'+_0x41cfd6[_0x05a3('0x26')]['filter']+'%'};return _0x8da496;}})});}_0x163495=_['merge']({},_0x163495,_0x41cfd6[_0x05a3('0x32')]);var _0x447182={'where':_0x163495[_0x05a3('0x30')]};return db[_0x05a3('0x33')]['count'](_0x447182)[_0x05a3('0xa')](function(_0x11c396){_0x44fc33[_0x05a3('0x18')]=_0x11c396;if(_0x41cfd6[_0x05a3('0x26')]['includeAll']){_0x163495[_0x05a3('0x34')]=[{'all':!![]}];}return db[_0x05a3('0x33')][_0x05a3('0x35')](_0x163495);})[_0x05a3('0xa')](function(_0x59870d){_0x44fc33[_0x05a3('0x36')]=_0x59870d;return _0x44fc33;})[_0x05a3('0xa')](respondWithFilteredResult(_0x1d2e85,_0x163495))[_0x05a3('0x14')](handleError(_0x1d2e85,null));};exports[_0x05a3('0x37')]=function(_0x531da8,_0x874081){var _0x1650f9={'raw':!![],'where':{'id':_0x531da8[_0x05a3('0x38')]['id']}},_0x9441c3={};_0x9441c3[_0x05a3('0x2a')]=_[_0x05a3('0x27')](db['Network']['rawAttributes']);_0x9441c3[_0x05a3('0x26')]=_[_0x05a3('0x27')](_0x531da8[_0x05a3('0x26')]);_0x9441c3[_0x05a3('0x28')]=_[_0x05a3('0x29')](_0x9441c3['model'],_0x9441c3[_0x05a3('0x26')]);_0x1650f9[_0x05a3('0x2b')]=_['intersection'](_0x9441c3[_0x05a3('0x2a')],qs['fields'](_0x531da8[_0x05a3('0x26')][_0x05a3('0x2c')]));_0x1650f9['attributes']=_0x1650f9[_0x05a3('0x2b')][_0x05a3('0x39')]?_0x1650f9['attributes']:_0x9441c3[_0x05a3('0x2a')];if(_0x531da8[_0x05a3('0x26')][_0x05a3('0x3a')]){_0x1650f9[_0x05a3('0x34')]=[{'all':!![]}];}_0x1650f9=_[_0x05a3('0x31')]({},_0x1650f9,_0x531da8[_0x05a3('0x32')]);return db[_0x05a3('0x33')][_0x05a3('0x3b')](_0x1650f9)[_0x05a3('0xa')](handleEntityNotFound(_0x874081,null))[_0x05a3('0xa')](respondWithResult(_0x874081,null))[_0x05a3('0x14')](handleError(_0x874081,null));};exports[_0x05a3('0x3c')]=function(_0x2301b8,_0x44fc8c){var _0x9f2c5e;return db[_0x05a3('0x33')][_0x05a3('0x3c')](_0x2301b8['body'],{'raw':!![]})['then'](function(_0x142fe3){_0x9f2c5e=_0x142fe3;return db['Network']['findAll']({'where':{'type':_0x2301b8['body'][_0x05a3('0x3d')]},'raw':!![]});})[_0x05a3('0xa')](function(_0x3cc249){if(_0x9f2c5e[_0x05a3('0x3d')]['toUpperCase']()==_0x05a3('0x3e')){var _0x473fbd=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x42')),_0x05a3('0x43'));var _0x48bee6=ejs['render'](_0x473fbd,{'networks':_0x3cc249||[]});fs[_0x05a3('0x44')](_0x05a3('0x45'),_0x48bee6);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x3c'),{'module':'res_stun_monitor.so'});}else if(_0x9f2c5e[_0x05a3('0x3d')][_0x05a3('0x47')]()=='TURN'){var _0x55560c=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x48')),_0x05a3('0x43'));var _0x193f5f=ejs[_0x05a3('0x49')](_0x55560c,{'networks':_0x3cc249||[]});fs['writeFileSync'](_0x05a3('0x4a'),_0x193f5f);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x3229df=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x4b')),'utf8');var _0x196670=ejs['render'](_0x3229df,{'networks':_0x3cc249||[]});fs[_0x05a3('0x44')](util[_0x05a3('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x2301b8[_0x05a3('0x4d')][_0x05a3('0x3d')][_0x05a3('0x4e')]()),_0x196670);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x3c'),{'module':_0x05a3('0x4f')});}})[_0x05a3('0xa')](function(){return _0x9f2c5e;})[_0x05a3('0xa')](respondWithResult(_0x44fc8c,0xc9))[_0x05a3('0x14')](handleError(_0x44fc8c,null));};exports[_0x05a3('0x1b')]=function(_0x2e1896,_0x3a672c){var _0x23acf5;return db['Network'][_0x05a3('0x3b')]({'where':{'id':_0x2e1896['params']['id']}})[_0x05a3('0xa')](handleEntityNotFound(_0x3a672c,null))[_0x05a3('0xa')](saveUpdates(_0x2e1896['body'],null))[_0x05a3('0xa')](function(_0x50a0fb){if(_0x50a0fb){_0x23acf5=_0x50a0fb;return db['Network']['findAll']({'where':{'type':_0x23acf5[_0x05a3('0x3d')]},'raw':!![]});}return null;})[_0x05a3('0xa')](function(_0x1f5ad1){if(_0x23acf5[_0x05a3('0x3d')][_0x05a3('0x47')]()==_0x05a3('0x3e')){var _0x31d6f5=fs['readFileSync'](path['join'](config[_0x05a3('0x41')],_0x05a3('0x42')),_0x05a3('0x43'));var _0x1f10e1=ejs[_0x05a3('0x49')](_0x31d6f5,{'networks':_0x1f5ad1||[]});fs[_0x05a3('0x44')]('/etc/asterisk/stun_xcally.conf',_0x1f10e1);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x1b'),{'module':_0x05a3('0x50')});}else if(_0x23acf5[_0x05a3('0x3d')][_0x05a3('0x47')]()==_0x05a3('0x51')){var _0x3ee985=fs['readFileSync'](path[_0x05a3('0x40')](config[_0x05a3('0x41')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2b1b38=ejs['render'](_0x3ee985,{'networks':_0x1f5ad1||[]});fs[_0x05a3('0x44')](_0x05a3('0x4a'),_0x2b1b38);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x1b'),{'module':_0x05a3('0x50')});}else{var _0x35d653=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x4b')),_0x05a3('0x43'));var _0x1f30f6=ejs[_0x05a3('0x49')](_0x35d653,{'networks':_0x1f5ad1||[]});fs[_0x05a3('0x44')](util[_0x05a3('0x4c')](_0x05a3('0x52'),_0x2e1896[_0x05a3('0x4d')]['type'][_0x05a3('0x4e')]()),_0x1f30f6);return respondWithRpcPromise(_0x05a3('0x46'),'update',{'module':'chan_sip.so'});}})['then'](function(_0x2387e2){if(_0x2387e2){return _0x23acf5;}return null;})['then'](respondWithResult(_0x3a672c,null))[_0x05a3('0x14')](handleError(_0x3a672c,null));};exports[_0x05a3('0x53')]=function(_0x40fa49,_0x175827){var _0x4b0b2e;return db['Network'][_0x05a3('0x3b')]({'where':{'id':_0x40fa49[_0x05a3('0x38')]['id']}})[_0x05a3('0xa')](function(_0x44cfee){_0x4b0b2e=_0x44cfee;return _0x44cfee;})[_0x05a3('0xa')](handleEntityNotFound(_0x175827,null))[_0x05a3('0xa')](removeEntity(_0x175827,null))[_0x05a3('0xa')](function(){if(_0x4b0b2e){return db[_0x05a3('0x33')][_0x05a3('0x35')]({'where':{'type':_0x4b0b2e['type']},'raw':!![]});}})['then'](function(_0x3fdcd6){if(_0x4b0b2e[_0x05a3('0x3d')][_0x05a3('0x47')]()=='STUN'){var _0x4092d7=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x42')),'utf8');var _0x35d9ee=ejs[_0x05a3('0x49')](_0x4092d7,{'networks':_0x3fdcd6||[]});fs[_0x05a3('0x44')](_0x05a3('0x45'),_0x35d9ee);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x53'),{'module':_0x05a3('0x50')});}else if(_0x4b0b2e[_0x05a3('0x3d')][_0x05a3('0x47')]()==_0x05a3('0x51')){var _0x254df1=fs[_0x05a3('0x3f')](path['join'](config[_0x05a3('0x41')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x29581b=ejs[_0x05a3('0x49')](_0x254df1,{'networks':_0x3fdcd6||[]});fs[_0x05a3('0x44')](_0x05a3('0x4a'),_0x29581b);return respondWithRpcPromise(_0x05a3('0x46'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x4c9303=fs[_0x05a3('0x3f')](path[_0x05a3('0x40')](config[_0x05a3('0x41')],_0x05a3('0x4b')),_0x05a3('0x43'));var _0x213bc9=ejs['render'](_0x4c9303,{'networks':_0x3fdcd6||[]});fs[_0x05a3('0x44')](util[_0x05a3('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x4b0b2e['type']['toLowerCase']()),_0x213bc9);return respondWithRpcPromise(_0x05a3('0x46'),_0x05a3('0x53'),{'module':_0x05a3('0x4f')});}})[_0x05a3('0x14')](handleError(_0x175827,null));}; \ No newline at end of file +var _0xd2f3=['rows','show','params','rawAttributes','fields','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','offset','undefined','limit','count','set','json','update','then','destroy','send','Network','fieldName','type','key','map','name','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','includeAll','include','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd2f3,0x6d));var _0x3d2f=function(_0x43cf91,_0x197109){_0x43cf91=_0x43cf91-0x0;var _0x1f0fdb=_0xd2f3[_0x43cf91];return _0x1f0fdb;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x3d2f('0x0'));var fs=require('fs');var _=require(_0x3d2f('0x1'));var qs=require(_0x3d2f('0x2'));var logger=require(_0x3d2f('0x3'))(_0x3d2f('0x4'));var config=require(_0x3d2f('0x5'));var db=require(_0x3d2f('0x6'))['db'];var jayson=require(_0x3d2f('0x7'));var client=jayson[_0x3d2f('0x8')][_0x3d2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d0684,_0x1fee7d,_0x59c640,_0x4b6e90){return new Promise(function(_0x187ea0,_0x3a981d){var _0x1c6de4=_0x4b6e90||client;return _0x1c6de4[_0x3d2f('0xa')](_0x1d0684,_0x59c640)['then'](function(_0x50fa9b){logger['info'](_0x3d2f('0xb'),_0x1fee7d,_0x3d2f('0xc'));logger['debug'](_0x3d2f('0xd'),_0x1fee7d,_0x3d2f('0xc'),JSON[_0x3d2f('0xe')](_0x50fa9b));if(_0x50fa9b['error']){if(_0x50fa9b[_0x3d2f('0xf')]['code']===0x1f4){logger[_0x3d2f('0xf')](_0x3d2f('0xb'),_0x1fee7d,_0x50fa9b[_0x3d2f('0xf')][_0x3d2f('0x10')]);return _0x3a981d(_0x50fa9b[_0x3d2f('0xf')][_0x3d2f('0x10')]);}logger[_0x3d2f('0xf')](_0x3d2f('0xb'),_0x1fee7d,_0x50fa9b[_0x3d2f('0xf')][_0x3d2f('0x10')]);return _0x187ea0(_0x50fa9b['error']['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x1fee7d,_0x3d2f('0xc'));_0x187ea0(_0x50fa9b['result'][_0x3d2f('0x10')]);}})[_0x3d2f('0x11')](function(_0x1e96fd){logger[_0x3d2f('0xf')](_0x3d2f('0xb'),_0x1fee7d,_0x1e96fd);_0x3a981d(_0x1e96fd);});});}function respondWithResult(_0xbb7995,_0x1d5bad){_0x1d5bad=_0x1d5bad||0xc8;return function(_0x3a4b56){if(_0x3a4b56){return _0xbb7995[_0x3d2f('0x12')](_0x1d5bad)['json'](_0x3a4b56);}};}function respondWithFilteredResult(_0x2610a5,_0x93b790){return function(_0x1abe6d){if(_0x1abe6d){var _0x4aefc9=typeof _0x93b790[_0x3d2f('0x13')]===_0x3d2f('0x14')&&typeof _0x93b790[_0x3d2f('0x15')]===_0x3d2f('0x14');var _0x45b8c8=_0x1abe6d[_0x3d2f('0x16')];var _0x1eb758=_0x4aefc9?0x0:_0x93b790[_0x3d2f('0x13')];var _0x4b694a=_0x4aefc9?_0x1abe6d[_0x3d2f('0x16')]:_0x93b790[_0x3d2f('0x13')]+_0x93b790[_0x3d2f('0x15')];var _0x382527;if(_0x4b694a>=_0x45b8c8){_0x4b694a=_0x45b8c8;_0x382527=0xc8;}else{_0x382527=0xce;}_0x2610a5[_0x3d2f('0x12')](_0x382527);return _0x2610a5[_0x3d2f('0x17')]('Content-Range',_0x1eb758+'-'+_0x4b694a+'/'+_0x45b8c8)[_0x3d2f('0x18')](_0x1abe6d);}return null;};}function saveUpdates(_0xf482d0){return function(_0x5daefc){if(_0x5daefc){return _0x5daefc[_0x3d2f('0x19')](_0xf482d0)[_0x3d2f('0x1a')](function(_0x547a02){return _0x547a02;});}return null;};}function removeEntity(_0x568942){return function(_0x377113){if(_0x377113){return _0x377113[_0x3d2f('0x1b')]()[_0x3d2f('0x1a')](function(){_0x568942[_0x3d2f('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4accab){return function(_0x570df8){if(!_0x570df8){_0x4accab['sendStatus'](0x194);}return _0x570df8;};}function handleError(_0xa80fb0,_0x5b4009){_0x5b4009=_0x5b4009||0x1f4;return function(_0x2875e2){logger['error'](_0x2875e2['stack']);if(_0x2875e2['name']){delete _0x2875e2['name'];}_0xa80fb0[_0x3d2f('0x12')](_0x5b4009)[_0x3d2f('0x1c')](_0x2875e2);};}exports['index']=function(_0x39bea0,_0x40fd3e){var _0x13b7fd={},_0x352951={},_0x8d4b6a={'count':0x0,'rows':[]};var _0x16bff1=_['map'](db[_0x3d2f('0x1d')]['rawAttributes'],function(_0x51f2c2){return{'name':_0x51f2c2[_0x3d2f('0x1e')],'type':_0x51f2c2[_0x3d2f('0x1f')][_0x3d2f('0x20')]};});_0x352951['model']=_[_0x3d2f('0x21')](_0x16bff1,_0x3d2f('0x22'));_0x352951[_0x3d2f('0x23')]=_[_0x3d2f('0x24')](_0x39bea0[_0x3d2f('0x23')]);_0x352951['filters']=_[_0x3d2f('0x25')](_0x352951[_0x3d2f('0x26')],_0x352951['query']);_0x13b7fd[_0x3d2f('0x27')]=_[_0x3d2f('0x25')](_0x352951[_0x3d2f('0x26')],qs['fields'](_0x39bea0[_0x3d2f('0x23')]['fields']));_0x13b7fd[_0x3d2f('0x27')]=_0x13b7fd[_0x3d2f('0x27')][_0x3d2f('0x28')]?_0x13b7fd[_0x3d2f('0x27')]:_0x352951['model'];if(!_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x29')](_0x3d2f('0x2a'))){_0x13b7fd[_0x3d2f('0x15')]=qs['limit'](_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x15')]);_0x13b7fd['offset']=qs['offset'](_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x13')]);}_0x13b7fd[_0x3d2f('0x2b')]=qs['sort'](_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x2c')]);_0x13b7fd['where']=qs[_0x3d2f('0x2d')](_['pick'](_0x39bea0[_0x3d2f('0x23')],_0x352951[_0x3d2f('0x2d')]),_0x16bff1);if(_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x2e')]){_0x13b7fd[_0x3d2f('0x2f')]=_['merge'](_0x13b7fd[_0x3d2f('0x2f')],{'$or':_[_0x3d2f('0x21')](_0x16bff1,function(_0x42e0c1){if(_0x42e0c1['type']!==_0x3d2f('0x30')){var _0x5ce5f7={};_0x5ce5f7[_0x42e0c1[_0x3d2f('0x22')]]={'$like':'%'+_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x2e')]+'%'};return _0x5ce5f7;}})});}_0x13b7fd=_[_0x3d2f('0x31')]({},_0x13b7fd,_0x39bea0['options']);var _0x415bd8={'where':_0x13b7fd[_0x3d2f('0x2f')]};return db[_0x3d2f('0x1d')][_0x3d2f('0x16')](_0x415bd8)[_0x3d2f('0x1a')](function(_0x529627){_0x8d4b6a[_0x3d2f('0x16')]=_0x529627;if(_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x32')]){_0x13b7fd[_0x3d2f('0x33')]=[{'all':!![]}];}return db[_0x3d2f('0x1d')][_0x3d2f('0x34')](_0x13b7fd);})[_0x3d2f('0x1a')](function(_0x6baa64){_0x8d4b6a[_0x3d2f('0x35')]=_0x6baa64;return _0x8d4b6a;})[_0x3d2f('0x1a')](respondWithFilteredResult(_0x40fd3e,_0x13b7fd))['catch'](handleError(_0x40fd3e,null));};exports[_0x3d2f('0x36')]=function(_0xba403d,_0x444c09){var _0x178963={'raw':!![],'where':{'id':_0xba403d[_0x3d2f('0x37')]['id']}},_0x1931b8={};_0x1931b8[_0x3d2f('0x26')]=_[_0x3d2f('0x24')](db[_0x3d2f('0x1d')][_0x3d2f('0x38')]);_0x1931b8['query']=_['keys'](_0xba403d[_0x3d2f('0x23')]);_0x1931b8['filters']=_[_0x3d2f('0x25')](_0x1931b8[_0x3d2f('0x26')],_0x1931b8[_0x3d2f('0x23')]);_0x178963[_0x3d2f('0x27')]=_['intersection'](_0x1931b8[_0x3d2f('0x26')],qs['fields'](_0xba403d[_0x3d2f('0x23')][_0x3d2f('0x39')]));_0x178963['attributes']=_0x178963[_0x3d2f('0x27')][_0x3d2f('0x28')]?_0x178963[_0x3d2f('0x27')]:_0x1931b8[_0x3d2f('0x26')];if(_0xba403d[_0x3d2f('0x23')][_0x3d2f('0x32')]){_0x178963[_0x3d2f('0x33')]=[{'all':!![]}];}_0x178963=_[_0x3d2f('0x31')]({},_0x178963,_0xba403d['options']);return db['Network'][_0x3d2f('0x3a')](_0x178963)[_0x3d2f('0x1a')](handleEntityNotFound(_0x444c09,null))[_0x3d2f('0x1a')](respondWithResult(_0x444c09,null))[_0x3d2f('0x11')](handleError(_0x444c09,null));};exports[_0x3d2f('0x3b')]=function(_0x585004,_0x4d5872){var _0x274fc6;return db[_0x3d2f('0x1d')][_0x3d2f('0x3b')](_0x585004[_0x3d2f('0x3c')],{'raw':!![]})[_0x3d2f('0x1a')](function(_0x27d0fb){_0x274fc6=_0x27d0fb;return db[_0x3d2f('0x1d')]['findAll']({'where':{'type':_0x585004['body']['type']},'raw':!![]});})[_0x3d2f('0x1a')](function(_0x47b1df){if(_0x274fc6[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x3e')){var _0x3e658e=fs['readFileSync'](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x41')),_0x3d2f('0x42'));var _0x530562=ejs['render'](_0x3e658e,{'networks':_0x47b1df||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x44'),_0x530562);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x3b'),{'module':_0x3d2f('0x46')});}else if(_0x274fc6['type'][_0x3d2f('0x3d')]()==_0x3d2f('0x47')){var _0x4b2d3b=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x49')),_0x3d2f('0x42'));var _0x472638=ejs[_0x3d2f('0x4a')](_0x4b2d3b,{'networks':_0x47b1df||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x4b'),_0x472638);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x3b'),{'module':_0x3d2f('0x46')});}else{var _0x320748=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x4c')),_0x3d2f('0x42'));var _0x568ff6=ejs['render'](_0x320748,{'networks':_0x47b1df||[]});fs[_0x3d2f('0x43')](util[_0x3d2f('0x4d')](_0x3d2f('0x4e'),_0x585004[_0x3d2f('0x3c')][_0x3d2f('0x1f')][_0x3d2f('0x4f')]()),_0x568ff6);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}})['then'](function(){return _0x274fc6;})[_0x3d2f('0x1a')](respondWithResult(_0x4d5872,0xc9))[_0x3d2f('0x11')](handleError(_0x4d5872,null));};exports['update']=function(_0xa1c675,_0x4aa102){var _0x19efb4;return db[_0x3d2f('0x1d')]['find']({'where':{'id':_0xa1c675[_0x3d2f('0x37')]['id']}})['then'](handleEntityNotFound(_0x4aa102,null))['then'](saveUpdates(_0xa1c675[_0x3d2f('0x3c')],null))['then'](function(_0x466591){if(_0x466591){_0x19efb4=_0x466591;return db[_0x3d2f('0x1d')][_0x3d2f('0x34')]({'where':{'type':_0x19efb4[_0x3d2f('0x1f')]},'raw':!![]});}return null;})['then'](function(_0xda4bcc){if(_0x19efb4[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x3e')){var _0x5a403e=fs['readFileSync'](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],'server/files/templates/stun_multiple.ejs'),_0x3d2f('0x42'));var _0x3d6d04=ejs[_0x3d2f('0x4a')](_0x5a403e,{'networks':_0xda4bcc||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x44'),_0x3d6d04);return respondWithRpcPromise('Reload',_0x3d2f('0x19'),{'module':_0x3d2f('0x46')});}else if(_0x19efb4[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x47')){var _0xacc87d=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config['root'],_0x3d2f('0x49')),_0x3d2f('0x42'));var _0x5f26fa=ejs[_0x3d2f('0x4a')](_0xacc87d,{'networks':_0xda4bcc||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x4b'),_0x5f26fa);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x19'),{'module':_0x3d2f('0x46')});}else{var _0x1094a7=fs[_0x3d2f('0x48')](path['join'](config[_0x3d2f('0x40')],_0x3d2f('0x4c')),'utf8');var _0x33f00a=ejs['render'](_0x1094a7,{'networks':_0xda4bcc||[]});fs['writeFileSync'](util[_0x3d2f('0x4d')](_0x3d2f('0x4e'),_0xa1c675[_0x3d2f('0x3c')][_0x3d2f('0x1f')][_0x3d2f('0x4f')]()),_0x33f00a);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x19'),{'module':'chan_sip.so'});}})['then'](function(_0x1686c8){if(_0x1686c8){return _0x19efb4;}return null;})[_0x3d2f('0x1a')](respondWithResult(_0x4aa102,null))['catch'](handleError(_0x4aa102,null));};exports[_0x3d2f('0x1b')]=function(_0x574999,_0x5d45bb){var _0x51857b;return db[_0x3d2f('0x1d')][_0x3d2f('0x3a')]({'where':{'id':_0x574999[_0x3d2f('0x37')]['id']}})['then'](function(_0x2fb7e2){_0x51857b=_0x2fb7e2;return _0x2fb7e2;})[_0x3d2f('0x1a')](handleEntityNotFound(_0x5d45bb,null))['then'](removeEntity(_0x5d45bb,null))[_0x3d2f('0x1a')](function(){if(_0x51857b){return db[_0x3d2f('0x1d')]['findAll']({'where':{'type':_0x51857b[_0x3d2f('0x1f')]},'raw':!![]});}})[_0x3d2f('0x1a')](function(_0x671a55){if(_0x51857b[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x3e')){var _0x2d3744=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x41')),_0x3d2f('0x42'));var _0x33f972=ejs[_0x3d2f('0x4a')](_0x2d3744,{'networks':_0x671a55||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x44'),_0x33f972);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x51857b[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x47')){var _0x8cc563=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x49')),'utf8');var _0x1b3d34=ejs[_0x3d2f('0x4a')](_0x8cc563,{'networks':_0x671a55||[]});fs[_0x3d2f('0x43')]('/etc/asterisk/turn_xcally.conf',_0x1b3d34);return respondWithRpcPromise('Reload',_0x3d2f('0x1b'),{'module':_0x3d2f('0x46')});}else{var _0x52c4d2=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x4c')),_0x3d2f('0x42'));var _0x1511d6=ejs['render'](_0x52c4d2,{'networks':_0x671a55||[]});fs[_0x3d2f('0x43')](util[_0x3d2f('0x4d')](_0x3d2f('0x4e'),_0x51857b['type'][_0x3d2f('0x4f')]()),_0x1511d6);return respondWithRpcPromise(_0x3d2f('0x45'),'destroy',{'module':_0x3d2f('0x50')});}})[_0x3d2f('0x11')](handleError(_0x5d45bb,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8630fef..b39c597 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 _0x702d=['exports','define','Network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5a9fb1,_0x189a98){var _0x578e36=function(_0x3daeac){while(--_0x3daeac){_0x5a9fb1['push'](_0x5a9fb1['shift']());}};_0x578e36(++_0x189a98);}(_0x702d,0x147));var _0xd702=function(_0x3ce71c,_0x2dee52){_0x3ce71c=_0x3ce71c-0x0;var _0xa256a1=_0x702d[_0x3ce71c];return _0xa256a1;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./network.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9567=['lodash','util','../../config/logger','api','moment','path','rimraf','./network.attributes','define','Network'];(function(_0x403702,_0x180d17){var _0x41b93e=function(_0x152c67){while(--_0x152c67){_0x403702['push'](_0x403702['shift']());}};_0x41b93e(++_0x180d17);}(_0x9567,0xdc));var _0x7956=function(_0x27dcc9,_0x1f5b5b){_0x27dcc9=_0x27dcc9-0x0;var _0xaa0fd9=_0x9567[_0x27dcc9];return _0xaa0fd9;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var logger=require(_0x7956('0x2'))(_0x7956('0x3'));var moment=require(_0x7956('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7956('0x5'));var rimraf=require(_0x7956('0x6'));var config=require('../../config/environment');var attributes=require(_0x7956('0x7'));module['exports']=function(_0x12c09e,_0x48c4b6){return _0x12c09e[_0x7956('0x8')](_0x7956('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index f4fc747..d49479f 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14f91a,_0x45952f){var _0x5dd50f=function(_0x935e80){while(--_0x935e80){_0x14f91a['push'](_0x14f91a['shift']());}};_0x5dd50f(++_0x45952f);}(_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 +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(_0x1e5703,_0xfaacdc){var _0x202a30=function(_0x533e42){while(--_0x533e42){_0x1e5703['push'](_0x1e5703['shift']());}};_0x202a30(++_0xfaacdc);}(_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 2aa4425..c7be67b 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 _0x88ec=['path','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','/:id/users','removeAgents','exports','multer'];(function(_0x378a46,_0x51a5db){var _0x2e9a87=function(_0x35d12b){while(--_0x35d12b){_0x378a46['push'](_0x378a46['shift']());}};_0x2e9a87(++_0x51a5db);}(_0x88ec,0x143));var _0xc88e=function(_0x1ff7cc,_0x788745){_0x1ff7cc=_0x1ff7cc-0x0;var _0x4dec99=_0x88ec[_0x1ff7cc];return _0x4dec99;};'use strict';var multer=require(_0xc88e('0x0'));var util=require('util');var path=require(_0xc88e('0x1'));var timeout=require('connect-timeout');var express=require(_0xc88e('0x2'));var router=express[_0xc88e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc88e('0x4'));var config=require(_0xc88e('0x5'));var controller=require(_0xc88e('0x6'));router[_0xc88e('0x7')]('/',auth[_0xc88e('0x8')](),controller['index']);router[_0xc88e('0x7')](_0xc88e('0x9'),auth[_0xc88e('0x8')](),controller[_0xc88e('0xa')]);router[_0xc88e('0x7')](_0xc88e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc88e('0x7')](_0xc88e('0xc'),auth[_0xc88e('0x8')](),controller['getDispositions']);router[_0xc88e('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc88e('0xd')]);router[_0xc88e('0x7')](_0xc88e('0xe'),auth[_0xc88e('0x8')](),controller[_0xc88e('0xf')]);router[_0xc88e('0x7')]('/:id/interactions',auth[_0xc88e('0x8')](),controller[_0xc88e('0x10')]);router['get']('/:id/users',auth[_0xc88e('0x8')](),controller[_0xc88e('0x11')]);router[_0xc88e('0x12')]('/',auth[_0xc88e('0x8')](),controller['create']);router[_0xc88e('0x12')]('/:id/dispositions',auth[_0xc88e('0x8')](),controller[_0xc88e('0x13')]);router[_0xc88e('0x12')](_0xc88e('0x14'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x15')]);router[_0xc88e('0x12')](_0xc88e('0x16'),controller[_0xc88e('0x17')]);router[_0xc88e('0x12')](_0xc88e('0xe'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x18')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xc88e('0x19')]);router['post'](_0xc88e('0x1a'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x1b')]);router[_0xc88e('0x1c')]('/:id',auth[_0xc88e('0x8')](),controller[_0xc88e('0x1d')]);router[_0xc88e('0x1e')](_0xc88e('0xb'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x1f')]);router['delete']('/:id/dispositions',auth[_0xc88e('0x8')](),controller['removeDispositions']);router['delete'](_0xc88e('0x14'),auth[_0xc88e('0x8')](),controller[_0xc88e('0x20')]);router[_0xc88e('0x1e')](_0xc88e('0x21'),auth['isAuthenticated'](),controller[_0xc88e('0x22')]);module[_0xc88e('0x23')]=router; \ No newline at end of file +var _0x9e11=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update'];(function(_0x272d8a,_0x45184b){var _0x26286e=function(_0x93beaa){while(--_0x93beaa){_0x272d8a['push'](_0x272d8a['shift']());}};_0x26286e(++_0x45184b);}(_0x9e11,0x6c));var _0x19e1=function(_0x48b64e,_0x234c05){_0x48b64e=_0x48b64e-0x0;var _0x528ca7=_0x9e11[_0x48b64e];return _0x528ca7;};'use strict';var multer=require('multer');var util=require(_0x19e1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x19e1('0x1')]();var fs_extra=require(_0x19e1('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19e1('0x3'));var controller=require(_0x19e1('0x4'));router[_0x19e1('0x5')]('/',auth[_0x19e1('0x6')](),controller[_0x19e1('0x7')]);router[_0x19e1('0x5')]('/describe',auth[_0x19e1('0x6')](),controller[_0x19e1('0x8')]);router[_0x19e1('0x5')](_0x19e1('0x9'),auth[_0x19e1('0x6')](),controller['show']);router[_0x19e1('0x5')](_0x19e1('0xa'),auth[_0x19e1('0x6')](),controller['getDispositions']);router['get'](_0x19e1('0xb'),auth[_0x19e1('0x6')](),controller['getAnswers']);router[_0x19e1('0x5')]('/:id/applications',auth[_0x19e1('0x6')](),controller[_0x19e1('0xc')]);router[_0x19e1('0x5')](_0x19e1('0xd'),auth[_0x19e1('0x6')](),controller[_0x19e1('0xe')]);router[_0x19e1('0x5')](_0x19e1('0xf'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x10')]);router[_0x19e1('0x11')]('/',auth[_0x19e1('0x6')](),controller[_0x19e1('0x12')]);router[_0x19e1('0x11')](_0x19e1('0xa'),auth[_0x19e1('0x6')](),controller['addDisposition']);router[_0x19e1('0x11')](_0x19e1('0xb'),auth['isAuthenticated'](),controller[_0x19e1('0x13')]);router[_0x19e1('0x11')](_0x19e1('0x14'),controller[_0x19e1('0x15')]);router[_0x19e1('0x11')]('/:id/applications',auth[_0x19e1('0x6')](),controller[_0x19e1('0x16')]);router[_0x19e1('0x11')](_0x19e1('0xf'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x17')]);router[_0x19e1('0x11')](_0x19e1('0x18'),auth['isAuthenticated'](),controller[_0x19e1('0x19')]);router[_0x19e1('0x1a')](_0x19e1('0x9'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x1b')]);router[_0x19e1('0x1c')](_0x19e1('0x9'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x1d')]);router[_0x19e1('0x1c')](_0x19e1('0xa'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x1e')]);router[_0x19e1('0x1c')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x19e1('0x1f')]);router[_0x19e1('0x1c')](_0x19e1('0xf'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x20')]);module[_0x19e1('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 62b1e33..9c21ead 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 _0x8a19=['exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x4d1850,_0x3bbc66){var _0x34fe25=function(_0x4bb8d1){while(--_0x4bb8d1){_0x4d1850['push'](_0x4d1850['shift']());}};_0x34fe25(++_0x3bbc66);}(_0x8a19,0xa7));var _0x98a1=function(_0x41563e,_0x378ce1){_0x41563e=_0x41563e-0x0;var _0x1cbaff=_0x8a19[_0x41563e];return _0x1cbaff;};'use strict';var Sequelize=require(_0x98a1('0x0'));var rs=require('randomstring');module[_0x98a1('0x1')]={'name':{'type':Sequelize[_0x98a1('0x2')],'unique':_0x98a1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x98a1('0x2')]},'token':{'type':Sequelize[_0x98a1('0x2')],'defaultValue':function(){return rs[_0x98a1('0x4')]();}},'replyUri':{'type':Sequelize[_0x98a1('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x98a1('0x5')],'defaultValue':function(){return _0x98a1('0x6');}},'notificationSound':{'type':Sequelize[_0x98a1('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x98a1('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x98a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x98a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x98a1('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x98a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x98a1('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x98a1('0x7')],'defaultValue':![],'comment':_0x98a1('0xa'),'set':function(_0x57b676){if(!_0x57b676)this[_0x98a1('0xb')](_0x98a1('0xc'),null);this['setDataValue'](_0x98a1('0xd'),_0x57b676);}}}; \ No newline at end of file +var _0x5054=['randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x1fe508,_0x679e49){var _0x22fac4=function(_0x922cd8){while(--_0x922cd8){_0x1fe508['push'](_0x1fe508['shift']());}};_0x22fac4(++_0x679e49);}(_0x5054,0x195));var _0x4505=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5054[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4505('0x0'));var rs=require(_0x4505('0x1'));module[_0x4505('0x2')]={'name':{'type':Sequelize[_0x4505('0x3')],'unique':_0x4505('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4505('0x3')],'defaultValue':function(){return rs[_0x4505('0x5')]();}},'replyUri':{'type':Sequelize[_0x4505('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4505('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4505('0x6')],'defaultValue':function(){return _0x4505('0x7');}},'notificationSound':{'type':Sequelize[_0x4505('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4505('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4505('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4505('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4505('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4505('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4505('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4505('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x4505('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x4505('0x8')],'defaultValue':![],'comment':_0x4505('0xb'),'set':function(_0x58bcfc){if(!_0x58bcfc)this['setDataValue'](_0x4505('0xc'),null);this['setDataValue'](_0x4505('0xd'),_0x58bcfc);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 9a3cfee..08c031d 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 _0x5fc3=['defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','http','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','params','addDisposition','OpenchannelAccountId','Disposition','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','notify','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','list','applications','priority','asc','account','firstName','threadId','OpenchannelInteraction','ContactId','contact','lastName','messageId','interaction','created','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','queueId','queue','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x348c93,_0x83937e){var _0x4e696f=function(_0x2345fa){while(--_0x2345fa){_0x348c93['push'](_0x348c93['shift']());}};_0x4e696f(++_0x83937e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x5fc3[_0x49fcfb];return _0x964926;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x35fc('0x17')](config['redis'],{'host':_0x35fc('0x18'),'port':0x18eb});var socket=require(_0x35fc('0x19'))(new Redis(config[_0x35fc('0x1a')]));require(_0x35fc('0x1b'))[_0x35fc('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x35fc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x229d56,_0x53b898,_0x154958,_0x227a49){return new BPromise(function(_0x1121fa,_0x480851){var _0x26ba54=_0x227a49||client;return _0x26ba54[_0x35fc('0x1e')](_0x229d56,_0x154958)['then'](function(_0x41e165){logger[_0x35fc('0x1f')](_0x35fc('0x20'),_0x53b898,'request\x20sent');logger[_0x35fc('0x21')](_0x35fc('0x22'),_0x53b898,_0x35fc('0x23'),JSON['stringify'](_0x41e165));if(_0x41e165[_0x35fc('0x24')]){if(_0x41e165[_0x35fc('0x24')][_0x35fc('0x25')]===0x1f4){logger[_0x35fc('0x24')](_0x35fc('0x20'),_0x53b898,_0x41e165[_0x35fc('0x24')][_0x35fc('0x26')]);return _0x480851(_0x41e165[_0x35fc('0x24')][_0x35fc('0x26')]);}logger[_0x35fc('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x53b898,_0x41e165[_0x35fc('0x24')][_0x35fc('0x26')]);return _0x1121fa(_0x41e165[_0x35fc('0x24')][_0x35fc('0x26')]);}else{logger[_0x35fc('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x53b898,_0x35fc('0x23'));_0x1121fa(_0x41e165[_0x35fc('0x27')]['message']);}})[_0x35fc('0x28')](function(_0x5a93df){logger[_0x35fc('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x53b898,_0x5a93df);_0x480851(_0x5a93df);});});}function respondWithStatusCode(_0x4086e9,_0x598d7a){_0x598d7a=_0x598d7a||0xcc;return function(_0x1bf180){if(_0x1bf180){return _0x4086e9[_0x35fc('0x29')](_0x598d7a);}return _0x4086e9['status'](_0x598d7a)['end']();};}function respondWithResult(_0x47774c,_0x58edb6){_0x58edb6=_0x58edb6||0xc8;return function(_0x274208){if(_0x274208){return _0x47774c[_0x35fc('0x2a')](_0x58edb6)['json'](_0x274208);}};}function respondWithFilteredResult(_0x26b7cb,_0x645eac){return function(_0x383837){if(_0x383837){var _0x9f3c8a=typeof _0x645eac[_0x35fc('0x2b')]===_0x35fc('0x2c')&&typeof _0x645eac[_0x35fc('0x2d')]===_0x35fc('0x2c');var _0x54aedc=_0x383837[_0x35fc('0x2e')];var _0x220931=_0x9f3c8a?0x0:_0x645eac[_0x35fc('0x2b')];var _0x52acc5=_0x9f3c8a?_0x383837[_0x35fc('0x2e')]:_0x645eac[_0x35fc('0x2b')]+_0x645eac[_0x35fc('0x2d')];var _0xe6e4ba;if(_0x52acc5>=_0x54aedc){_0x52acc5=_0x54aedc;_0xe6e4ba=0xc8;}else{_0xe6e4ba=0xce;}_0x26b7cb[_0x35fc('0x2a')](_0xe6e4ba);return _0x26b7cb[_0x35fc('0x2f')](_0x35fc('0x30'),_0x220931+'-'+_0x52acc5+'/'+_0x54aedc)[_0x35fc('0x31')](_0x383837);}return null;};}function patchUpdates(_0xf4dfab){return function(_0x127bfc){try{jsonpatch['apply'](_0x127bfc,_0xf4dfab,!![]);}catch(_0x5e0313){return BPromise[_0x35fc('0x32')](_0x5e0313);}return _0x127bfc['save']();};}function saveUpdates(_0x37b394,_0x39454e){return function(_0x1c4b8b){if(_0x1c4b8b){return _0x1c4b8b[_0x35fc('0x33')](_0x37b394)[_0x35fc('0x34')](function(_0x12e78f){return _0x12e78f;});}return null;};}function removeEntity(_0x4e43b4,_0x3fe193){return function(_0x330a14){if(_0x330a14){return _0x330a14[_0x35fc('0x35')]()[_0x35fc('0x34')](function(){var _0x2bbd36=_0x330a14[_0x35fc('0x36')]({'plain':!![]});var _0x553597=_0x35fc('0x37');return db[_0x35fc('0x38')][_0x35fc('0x35')]({'where':{'type':_0x553597,'resourceId':_0x2bbd36['id']}})['then'](function(){return _0x330a14;});})[_0x35fc('0x34')](function(){_0x4e43b4['status'](0xcc)[_0x35fc('0x39')]();});}};}function handleEntityNotFound(_0x33a377,_0x266a11){return function(_0x2e00e3){if(!_0x2e00e3){_0x33a377['sendStatus'](0x194);}return _0x2e00e3;};}function handleError(_0x54fcf1,_0x59e4fb){_0x59e4fb=_0x59e4fb||0x1f4;return function(_0x20f5fe){logger['error'](_0x20f5fe[_0x35fc('0x3a')]);if(_0x20f5fe['name']){delete _0x20f5fe[_0x35fc('0x3b')];}_0x54fcf1[_0x35fc('0x2a')](_0x59e4fb)[_0x35fc('0x3c')](_0x20f5fe);};}exports[_0x35fc('0x3d')]=function(_0x1c10e0,_0x3313fa){var _0x9fe7d6={'include':[{'model':db[_0x35fc('0x3e')],'as':'mandatoryDispositionPause'}]},_0x4ec0dc={},_0x4467f8={'count':0x0,'rows':[]};var _0x1feda5=_[_0x35fc('0x3f')](db[_0x35fc('0x40')][_0x35fc('0x41')],function(_0x813866){return{'name':_0x813866[_0x35fc('0x42')],'type':_0x813866['type'][_0x35fc('0x43')]};});_0x4ec0dc[_0x35fc('0x44')]=_[_0x35fc('0x3f')](_0x1feda5,'name');_0x4ec0dc[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x1c10e0['query']);_0x4ec0dc[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x4ec0dc[_0x35fc('0x44')],_0x4ec0dc[_0x35fc('0x45')]);_0x9fe7d6[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x4ec0dc[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x1c10e0['query']['fields']));_0x9fe7d6[_0x35fc('0x49')]=_0x9fe7d6[_0x35fc('0x49')]['length']?_0x9fe7d6['attributes']:_0x4ec0dc['model'];if(!_0x1c10e0[_0x35fc('0x45')][_0x35fc('0x4b')]('nolimit')){_0x9fe7d6[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x1c10e0[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x9fe7d6['offset']=qs['offset'](_0x1c10e0['query']['offset']);}_0x9fe7d6['order']=qs[_0x35fc('0x4c')](_0x1c10e0[_0x35fc('0x45')]['sort']);_0x9fe7d6[_0x35fc('0x4d')]=qs['filters'](_[_0x35fc('0x4e')](_0x1c10e0[_0x35fc('0x45')],_0x4ec0dc[_0x35fc('0x47')]),_0x1feda5);if(_0x1c10e0[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x9fe7d6['where']=_[_0x35fc('0x50')](_0x9fe7d6[_0x35fc('0x4d')],{'$or':_['map'](_0x1feda5,function(_0x18181b){if(_0x18181b[_0x35fc('0x51')]!==_0x35fc('0x52')){var _0x211746={};_0x211746[_0x18181b['name']]={'$like':'%'+_0x1c10e0[_0x35fc('0x45')]['filter']+'%'};return _0x211746;}})});}_0x9fe7d6=_['merge']({},_0x9fe7d6,_0x1c10e0[_0x35fc('0x53')]);var _0x9db7e8={'where':_0x9fe7d6[_0x35fc('0x4d')]};return db[_0x35fc('0x40')][_0x35fc('0x2e')](_0x9db7e8)[_0x35fc('0x34')](function(_0x405320){_0x4467f8[_0x35fc('0x2e')]=_0x405320;if(_0x1c10e0['query'][_0x35fc('0x54')]){_0x9fe7d6[_0x35fc('0x55')]=[{'all':!![]}];}return db[_0x35fc('0x40')][_0x35fc('0x56')](_0x9fe7d6);})[_0x35fc('0x34')](function(_0x1e3221){_0x4467f8[_0x35fc('0x57')]=_0x1e3221;return _0x4467f8;})[_0x35fc('0x34')](respondWithFilteredResult(_0x3313fa,_0x9fe7d6))[_0x35fc('0x28')](handleError(_0x3313fa,null));};exports[_0x35fc('0x58')]=function(_0xa42409,_0x224079){var _0x221f6f={'raw':![],'where':{'id':_0xa42409['params']['id']},'include':[{'model':db['Pause'],'as':_0x35fc('0x59')}]},_0x3146e2={};_0x3146e2[_0x35fc('0x44')]=_[_0x35fc('0x46')](db[_0x35fc('0x40')][_0x35fc('0x41')]);_0x3146e2[_0x35fc('0x45')]=_['keys'](_0xa42409['query']);_0x3146e2[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x3146e2[_0x35fc('0x44')],_0x3146e2[_0x35fc('0x45')]);_0x221f6f['attributes']=_[_0x35fc('0x48')](_0x3146e2[_0x35fc('0x44')],qs['fields'](_0xa42409[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x221f6f['attributes']=_0x221f6f[_0x35fc('0x49')][_0x35fc('0x5a')]?_0x221f6f[_0x35fc('0x49')]:_0x3146e2[_0x35fc('0x44')];if(_0xa42409['query']['includeAll']){_0x221f6f['include']=[{'all':!![]}];}_0x221f6f=_[_0x35fc('0x50')]({},_0x221f6f,_0xa42409[_0x35fc('0x53')]);return db['OpenchannelAccount'][_0x35fc('0x5b')](_0x221f6f)[_0x35fc('0x34')](handleEntityNotFound(_0x224079,null))[_0x35fc('0x34')](respondWithResult(_0x224079,null))[_0x35fc('0x28')](handleError(_0x224079,null));};exports[_0x35fc('0x5c')]=function(_0x538be0,_0x2d9d45){return db[_0x35fc('0x40')][_0x35fc('0x5c')](_0x538be0['body'],{})[_0x35fc('0x34')](function(_0x1dbf5a){var _0x47fb1a=_0x538be0[_0x35fc('0x5d')][_0x35fc('0x36')]({'plain':!![]});if(!_0x47fb1a)throw new Error(_0x35fc('0x5e'));if(_0x47fb1a[_0x35fc('0x5f')]===_0x35fc('0x5d')){var _0x41453b=_0x1dbf5a[_0x35fc('0x36')]({'plain':!![]});var _0x998fd9='OpenchannelAccounts';return db[_0x35fc('0x60')][_0x35fc('0x5b')]({'where':{'name':_0x998fd9,'userProfileId':_0x47fb1a[_0x35fc('0x61')]},'raw':!![]})['then'](function(_0x243871){if(_0x243871&&_0x243871['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x41453b[_0x35fc('0x3b')],'resourceId':_0x41453b['id'],'type':_0x243871[_0x35fc('0x3b')],'sectionId':_0x243871['id']},{})[_0x35fc('0x34')](function(){return _0x1dbf5a;});}else{return _0x1dbf5a;}})[_0x35fc('0x28')](function(_0x3d06b8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d06b8);throw _0x3d06b8;});}return _0x1dbf5a;})['then'](respondWithResult(_0x2d9d45,0xc9))['catch'](handleError(_0x2d9d45,null));};exports['update']=function(_0x331fe6,_0x44250b){if(_0x331fe6[_0x35fc('0x62')]['id']){delete _0x331fe6[_0x35fc('0x62')]['id'];}return db['OpenchannelAccount'][_0x35fc('0x5b')]({'where':{'id':_0x331fe6[_0x35fc('0x63')]['id']},'include':[{'model':db[_0x35fc('0x3e')],'as':_0x35fc('0x59')}]})[_0x35fc('0x34')](handleEntityNotFound(_0x44250b,null))[_0x35fc('0x34')](saveUpdates(_0x331fe6[_0x35fc('0x62')],null))[_0x35fc('0x34')](respondWithResult(_0x44250b,null))[_0x35fc('0x28')](handleError(_0x44250b,null));};exports['destroy']=function(_0x35d7c8,_0x47c75f){return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x35d7c8[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x47c75f,null))['then'](removeEntity(_0x47c75f,null))[_0x35fc('0x28')](handleError(_0x47c75f,null));};exports['describe']=function(_0x4e2835,_0x5f1d4a){return db[_0x35fc('0x40')]['describe']()[_0x35fc('0x34')](respondWithResult(_0x5f1d4a,null))['catch'](handleError(_0x5f1d4a,null));};exports[_0x35fc('0x64')]=function(_0x583ffd,_0x42a53a,_0x455b84){if(_0x583ffd[_0x35fc('0x62')]['id']){delete _0x583ffd[_0x35fc('0x62')]['id'];}return db['OpenchannelAccount'][_0x35fc('0x5b')]({'where':{'id':_0x583ffd[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x42a53a,null))['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x583ffd[_0x35fc('0x62')][_0x35fc('0x65')]=_0x3aa7fa['id'];return db[_0x35fc('0x66')][_0x35fc('0x5c')](_0x583ffd[_0x35fc('0x62')]);}})[_0x35fc('0x34')](respondWithResult(_0x42a53a,null))[_0x35fc('0x28')](handleError(_0x42a53a,null));};exports['getDispositions']=function(_0x28a44b,_0x2008b3,_0x2600d2){var _0x4a926d={'raw':![],'where':{}};var _0x1c88d8={};var _0x1b76f0={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x28a44b[_0x35fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x2008b3,null))[_0x35fc('0x34')](function(_0x2dbc81){if(_0x2dbc81){_0x1c88d8[_0x35fc('0x44')]=_[_0x35fc('0x46')](db[_0x35fc('0x66')][_0x35fc('0x41')]);_0x1c88d8[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x28a44b[_0x35fc('0x45')]);_0x1c88d8[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x1c88d8[_0x35fc('0x44')],_0x1c88d8[_0x35fc('0x45')]);_0x4a926d[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x1c88d8[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x28a44b[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x4a926d[_0x35fc('0x49')]=_0x4a926d['attributes'][_0x35fc('0x5a')]?_0x4a926d['attributes']:_0x1c88d8[_0x35fc('0x44')];if(!_0x28a44b[_0x35fc('0x45')][_0x35fc('0x4b')](_0x35fc('0x67'))){_0x4a926d[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x28a44b[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x4a926d[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x28a44b[_0x35fc('0x45')]['offset']);}_0x4a926d[_0x35fc('0x68')]=qs[_0x35fc('0x4c')](_0x28a44b[_0x35fc('0x45')][_0x35fc('0x4c')]);_0x4a926d[_0x35fc('0x4d')]=qs[_0x35fc('0x47')](_['pick'](_0x28a44b[_0x35fc('0x45')],_0x1c88d8[_0x35fc('0x47')]));_0x4a926d[_0x35fc('0x4d')][_0x35fc('0x65')]=_0x2dbc81['id'];if(_0x28a44b[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x4a926d[_0x35fc('0x4d')]=_[_0x35fc('0x50')](_0x4a926d[_0x35fc('0x4d')],{'$or':_['map'](_0x4a926d[_0x35fc('0x49')],function(_0x5539f0){var _0x1c7d01={};_0x1c7d01[_0x5539f0]={'$like':'%'+_0x28a44b[_0x35fc('0x45')]['filter']+'%'};return _0x1c7d01;})});}_0x4a926d=_[_0x35fc('0x50')]({},_0x4a926d,_0x28a44b[_0x35fc('0x53')]);return db[_0x35fc('0x66')][_0x35fc('0x2e')]({'where':_0x4a926d[_0x35fc('0x4d')]})[_0x35fc('0x34')](function(_0x42f87e){_0x1b76f0[_0x35fc('0x2e')]=_0x42f87e;if(_0x28a44b[_0x35fc('0x45')]['includeAll']){_0x4a926d['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4a926d);})[_0x35fc('0x34')](function(_0x23cf84){_0x1b76f0[_0x35fc('0x57')]=_0x23cf84;return _0x1b76f0;});}})[_0x35fc('0x34')](respondWithFilteredResult(_0x2008b3,_0x4a926d))[_0x35fc('0x28')](handleError(_0x2008b3,null));};exports['removeDispositions']=function(_0x226fdf,_0x19682e,_0x8e12ff){return db[_0x35fc('0x40')]['find']({'where':{'id':_0x226fdf[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x19682e,null))[_0x35fc('0x34')](function(_0x595a89){if(_0x595a89){return _0x595a89[_0x35fc('0x69')](_0x226fdf[_0x35fc('0x45')][_0x35fc('0x6a')]);}})[_0x35fc('0x34')](respondWithStatusCode(_0x19682e,null))[_0x35fc('0x28')](handleError(_0x19682e,null));};exports[_0x35fc('0x6b')]=function(_0x3722af,_0x13fc47,_0x4b6c03){if(_0x3722af[_0x35fc('0x62')]['id']){delete _0x3722af[_0x35fc('0x62')]['id'];}return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x3722af[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x13fc47,null))['then'](function(_0x495cf6){if(_0x495cf6){_0x3722af['body']['OpenchannelAccountId']=_0x495cf6['id'];return db[_0x35fc('0x6c')]['create'](_0x3722af[_0x35fc('0x62')]);}})[_0x35fc('0x34')](respondWithResult(_0x13fc47,null))[_0x35fc('0x28')](handleError(_0x13fc47,null));};exports['getAnswers']=function(_0x205ee9,_0x2b3edc,_0x3dcf62){var _0x1beb46={'raw':![],'where':{}};var _0x21f7e6={};var _0x5abdf9={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x205ee9[_0x35fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x2b3edc,null))[_0x35fc('0x34')](function(_0x1824c2){if(_0x1824c2){_0x21f7e6[_0x35fc('0x44')]=_[_0x35fc('0x46')](db['CannedAnswer'][_0x35fc('0x41')]);_0x21f7e6[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x205ee9['query']);_0x21f7e6[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x21f7e6[_0x35fc('0x44')],_0x21f7e6['query']);_0x1beb46['attributes']=_['intersection'](_0x21f7e6[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x1beb46['attributes']=_0x1beb46[_0x35fc('0x49')][_0x35fc('0x5a')]?_0x1beb46['attributes']:_0x21f7e6['model'];if(!_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4b')](_0x35fc('0x67'))){_0x1beb46['limit']=qs['limit'](_0x205ee9[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x1beb46['offset']=qs[_0x35fc('0x2b')](_0x205ee9[_0x35fc('0x45')][_0x35fc('0x2b')]);}_0x1beb46['order']=qs[_0x35fc('0x4c')](_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4c')]);_0x1beb46[_0x35fc('0x4d')]=qs['filters'](_[_0x35fc('0x4e')](_0x205ee9[_0x35fc('0x45')],_0x21f7e6[_0x35fc('0x47')]));_0x1beb46['where'][_0x35fc('0x65')]=_0x1824c2['id'];if(_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x1beb46['where']=_[_0x35fc('0x50')](_0x1beb46[_0x35fc('0x4d')],{'$or':_['map'](_0x1beb46[_0x35fc('0x49')],function(_0xa15c80){var _0x19bfd3={};_0x19bfd3[_0xa15c80]={'$like':'%'+_0x205ee9[_0x35fc('0x45')][_0x35fc('0x4f')]+'%'};return _0x19bfd3;})});}_0x1beb46=_[_0x35fc('0x50')]({},_0x1beb46,_0x205ee9[_0x35fc('0x53')]);return db[_0x35fc('0x6c')][_0x35fc('0x2e')]({'where':_0x1beb46['where']})[_0x35fc('0x34')](function(_0x3fc6cc){_0x5abdf9[_0x35fc('0x2e')]=_0x3fc6cc;if(_0x205ee9[_0x35fc('0x45')]['includeAll']){_0x1beb46[_0x35fc('0x55')]=[{'all':!![]}];}return db[_0x35fc('0x6c')][_0x35fc('0x56')](_0x1beb46);})[_0x35fc('0x34')](function(_0x4684b6){_0x5abdf9[_0x35fc('0x57')]=_0x4684b6;return _0x5abdf9;});}})[_0x35fc('0x34')](respondWithFilteredResult(_0x2b3edc,_0x1beb46))[_0x35fc('0x28')](handleError(_0x2b3edc,null));};exports['removeAnswers']=function(_0x4e3b32,_0x3ee301,_0xafa771){return db[_0x35fc('0x40')]['find']({'where':{'id':_0x4e3b32[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x3ee301,null))[_0x35fc('0x34')](function(_0xf1f222){if(_0xf1f222){return _0xf1f222['removeAnswers'](_0x4e3b32['query'][_0x35fc('0x6a')]);}})['then'](respondWithStatusCode(_0x3ee301,null))[_0x35fc('0x28')](handleError(_0x3ee301,null));};exports[_0x35fc('0x6d')]=function(_0x5d005a,_0x52712e,_0x471c59){var _0x1338a4={'body':_0x5d005a[_0x35fc('0x62')],'channel':'openchannel'};var _0x1bafe6=[];var _0x177088=[];var _0x2f3571={};var _0x4cb4be=![];return db[_0x35fc('0x6e')][_0x35fc('0x6f')]()[_0x35fc('0x34')](function(_0x328e90){if(!_0x328e90){throw new db['Sequelize'][(_0x35fc('0x70'))](_0x35fc('0x71'));}_0x1bafe6=_[_0x35fc('0x72')](_[_0x35fc('0x46')](_0x328e90),[_0x35fc('0x73'),_0x35fc('0x74')]);_0x177088=_['difference'](_[_0x35fc('0x46')](_0x328e90),[_0x35fc('0x73'),'updatedAt',_0x35fc('0x75'),_0x35fc('0x76')]);if(_0x5d005a['body']['id']){delete _0x5d005a[_0x35fc('0x62')]['id'];}if(_[_0x35fc('0x77')](_0x5d005a[_0x35fc('0x62')][_0x35fc('0x78')])){throw new db[(_0x35fc('0x79'))]['ValidationError'](_0x35fc('0x7a'));}if(_[_0x35fc('0x77')](_0x5d005a[_0x35fc('0x62')]['body'])||_0x5d005a[_0x35fc('0x62')]['body']===''){throw new db['Sequelize'][(_0x35fc('0x70'))](_0x35fc('0x7b'));}if(_[_0x35fc('0x77')](_0x5d005a[_0x35fc('0x62')][_0x35fc('0x7c')])){throw new db['Sequelize'][(_0x35fc('0x70'))](_0x35fc('0x7d')+_0x177088);}if(!_[_0x35fc('0x7e')](_0x177088,_0x5d005a['body'][_0x35fc('0x7c')])){throw new db[(_0x35fc('0x79'))][(_0x35fc('0x70'))](_0x35fc('0x7f')+_0x177088);}_0x2f3571[_0x5d005a[_0x35fc('0x62')]['mapKey']]=_0x5d005a[_0x35fc('0x62')][_0x35fc('0x78')];})['then'](function(){return db['OpenchannelAccount'][_0x35fc('0x5b')]({'where':{'id':_0x5d005a[_0x35fc('0x63')]['id']},'include':[{'model':db[_0x35fc('0x80')],'as':_0x35fc('0x81'),'include':[{'model':db[_0x35fc('0x6e')],'as':_0x35fc('0x82'),'where':_0x2f3571,'limit':0x1,'order':[[_0x35fc('0x74'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x35fc('0x83')}]});})[_0x35fc('0x34')](handleEntityNotFound(_0x52712e,null))[_0x35fc('0x34')](function(_0x1a92fa){if(_0x1a92fa&&_0x1a92fa[_0x35fc('0x81')]){_0x1338a4['account']=_0x1a92fa;_0x1338a4['applications']=_0x1a92fa[_0x35fc('0x83')];_0x1338a4[_0x35fc('0x84')]=_0x1a92fa[_0x35fc('0x81')];_0x1338a4[_0x35fc('0x85')]=_['orderBy'](_0x1338a4['applications'],[_0x35fc('0x86')],[_0x35fc('0x87')]);if(_0x1338a4[_0x35fc('0x88')][_0x35fc('0x83')]){delete _0x1338a4['account']['Applications'];}if(_0x1338a4[_0x35fc('0x88')][_0x35fc('0x81')]&&_0x1338a4['account'][_0x35fc('0x81')][_0x35fc('0x82')][_0x35fc('0x5a')]){return _0x1338a4[_0x35fc('0x88')][_0x35fc('0x81')][_0x35fc('0x82')][0x0];}var _0x32d827=_[_0x35fc('0x17')](_0x5d005a[_0x35fc('0x62')],{'firstName':_0x5d005a[_0x35fc('0x62')][_0x35fc('0x78')],'ListId':_0x1a92fa[_0x35fc('0x76')]});_0x32d827[_0x5d005a[_0x35fc('0x62')][_0x35fc('0x7c')]]=_0x5d005a[_0x35fc('0x62')][_0x35fc('0x78')];return db['CmContact'][_0x35fc('0x5c')](_0x32d827,{'fields':_0x1bafe6,'raw':!![]});}})['then'](handleEntityNotFound(_0x52712e,null))[_0x35fc('0x34')](function(_0x5d677a){_0x1338a4['contact']=_0x5d677a;if(_0x5d677a){var _0x3c96ef={'ContactId':_0x5d677a['id'],'OpenchannelAccountId':_0x5d005a[_0x35fc('0x63')]['id'],'from':(_0x5d677a[_0x35fc('0x89')]||'')+'\x20'+(_0x5d677a['lastName']||'')};var _0x93d968={'OpenchannelAccountId':_0x5d005a[_0x35fc('0x63')]['id'],'closed':![]};if(_0x5d005a[_0x35fc('0x62')][_0x35fc('0x8a')]){_0x93d968[_0x35fc('0x8a')]=_0x5d005a[_0x35fc('0x62')]['threadId'];return db['OpenchannelInteraction'][_0x35fc('0x5b')]({'where':_0x93d968})['then'](function(_0x5b03dd){if(_0x5b03dd){return[_0x5b03dd,![]];}_0x3c96ef[_0x35fc('0x8a')]=_0x5d005a['body']['threadId'];_0x3c96ef['externalUrl']=_0x5d005a[_0x35fc('0x62')]['externalUrl'];return db[_0x35fc('0x8b')][_0x35fc('0x5c')](_0x3c96ef)[_0x35fc('0x34')](function(_0x4d4cf){return[_0x4d4cf,!![]];});});}else{_0x93d968[_0x35fc('0x8a')]=null;}_0x93d968[_0x35fc('0x8c')]=_0x5d677a['id'];return db['OpenchannelInteraction']['find']({'where':_0x93d968})[_0x35fc('0x34')](function(_0x5994ec){if(_0x5994ec){return[_0x5994ec,![]];}return db[_0x35fc('0x8b')][_0x35fc('0x5c')](_0x3c96ef)['then'](function(_0x4b0d98){return[_0x4b0d98,!![]];});});}})['spread'](function(_0x1769c2,_0x1e5084){if(_0x1769c2){_0x4cb4be=_0x1e5084;if(!_0x1e5084){var _0x406548={'from':(_0x1338a4[_0x35fc('0x8d')][_0x35fc('0x89')]||'')+'\x20'+(_0x1338a4[_0x35fc('0x8d')][_0x35fc('0x8e')]||'')};if(_0x5d005a[_0x35fc('0x62')]['threadId']&&_0x5d005a['body']['messageId']&&_0x5d005a['body'][_0x35fc('0x8a')]!=_0x5d005a['body'][_0x35fc('0x8f')]){_0x406548['threadId']=_0x5d005a[_0x35fc('0x62')][_0x35fc('0x8f')];}return _0x1769c2['update'](_0x406548);}else{return _0x1769c2;}}})['then'](function(_0x3cab00){_0x1338a4[_0x35fc('0x90')]=_0x3cab00[_0x35fc('0x36')]({'plain':!![]});_0x1338a4[_0x35fc('0x90')][_0x35fc('0x91')]=_0x4cb4be;if(_0x1338a4['interaction']['created']){if(_0x1338a4[_0x35fc('0x88')]['autoclose']){_0x1338a4[_0x35fc('0x85')]['push']({'id':0x0,'priority':_0x1338a4[_0x35fc('0x85')][_0x35fc('0x5a')]+0x1,'app':_0x35fc('0x92'),'appdata':_0x35fc('0x93'),'interval':'*,*,*,*'});}}return db[_0x35fc('0x94')]['create']({'body':_0x5d005a[_0x35fc('0x62')]['body'],'OpenchannelAccountId':_0x5d005a['params']['id'],'OpenchannelInteractionId':_0x3cab00['id'],'direction':'in','ContactId':_0x1338a4[_0x35fc('0x8d')]['id'],'AttachmentId':_0x5d005a['body'][_0x35fc('0x95')]});})[_0x35fc('0x34')](function(_0x3b3a04){_0x1338a4[_0x35fc('0x26')]=_0x3b3a04;if(!_0x1338a4[_0x35fc('0x90')][_0x35fc('0x96')])return;return db[_0x35fc('0x97')][_0x35fc('0x5b')]({'attributes':['id',_0x35fc('0x3b')],'where':{'id':_0x1338a4['interaction'][_0x35fc('0x96')]}});})[_0x35fc('0x34')](function(_0x149e79){if(_0x149e79){_0x1338a4[_0x35fc('0x85')][_0x35fc('0x98')]({'id':0x0,'priority':0x0,'app':_0x35fc('0x99'),'appdata':_0x149e79[_0x35fc('0x3b')]+','+(_0x1338a4[_0x35fc('0x88')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1338a4['interaction']['queueId'])return;return db['OpenchannelQueue'][_0x35fc('0x5b')]({'attributes':['id',_0x35fc('0x3b')],'where':{'id':_0x1338a4[_0x35fc('0x90')][_0x35fc('0x9a')]}});})[_0x35fc('0x34')](function(_0x531710){if(_0x531710){_0x1338a4[_0x35fc('0x85')][_0x35fc('0x98')]({'id':0x0,'priority':0x1,'app':_0x35fc('0x9b'),'appdata':_0x531710[_0x35fc('0x3b')]+','+(_0x1338a4[_0x35fc('0x88')]['waitForTheAssignedQueue']||0x12c),'interval':_0x35fc('0x9c')});}return respondWithRpcPromise(_0x35fc('0x9d'),_0x35fc('0x9e'),_0x1338a4);})['then'](function(_0x471711){respondWithRpcPromise(_0x35fc('0x9f'),_0x35fc('0x9f'),{'event':_0x35fc('0x6d'),'message':_0x471711},client9002);return _0x471711;})[_0x35fc('0x34')](respondWithResult(_0x52712e,null))[_0x35fc('0x28')](handleError(_0x52712e,null));};exports[_0x35fc('0xa0')]=function(_0x45df88,_0x1eaab6){var _0x2f53e0=_0x45df88[_0x35fc('0x63')]['id'];var _0x7b98b0=_0x45df88[_0x35fc('0x62')];var _0x206f0b=0xc8;var _0x3e7663=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x35fc('0xa1')][_0x35fc('0xa2')][_0x35fc('0xa3')][_0x35fc('0xa4')]},function(_0x219be6){return db[_0x35fc('0x40')][_0x35fc('0xa5')]({'where':{'id':_0x2f53e0},'transaction':_0x219be6})[_0x35fc('0x34')](function(_0x295121){if(_0x295121){return db[_0x35fc('0xa6')][_0x35fc('0x35')]({'where':{'OpenchannelAccountId':_0x2f53e0},'transaction':_0x219be6})[_0x35fc('0x34')](function(){var _0x3148f3=_[_0x35fc('0x3f')](_0x7b98b0,function(_0x253ec2){_0x253ec2['OpenchannelAccountId']=_0x2f53e0;return _0x253ec2;});return db[_0x35fc('0xa6')][_0x35fc('0xa7')](_0x3148f3,{'transaction':_0x219be6});});}else{_0x206f0b=0x194;_0x3e7663=[];}});})[_0x35fc('0x34')](function(){if(_0x206f0b!==0x194){return db[_0x35fc('0xa6')][_0x35fc('0xa8')]({'where':{'OpenchannelAccountId':_0x2f53e0},'order':_0x35fc('0x86')})[_0x35fc('0x34')](function(_0xa4c51a){_0x3e7663=_0xa4c51a;});}})['catch'](function(_0x4964d7){_0x206f0b=0x1f4;logger[_0x35fc('0x24')](_0x4964d7[_0x35fc('0x3a')]);if(_0x4964d7['name']){delete _0x4964d7[_0x35fc('0x3b')];}_0x3e7663=_0x4964d7;})[_0x35fc('0xa9')](function(){if(_0x3e7663===null){_0x1eaab6[_0x35fc('0x29')](_0x206f0b);}else{if(_0x206f0b===0x1f4){_0x1eaab6[_0x35fc('0x2a')](_0x206f0b)['send'](_0x3e7663);}else{_0x1eaab6[_0x35fc('0x2a')](_0x206f0b)[_0x35fc('0x31')](_0x3e7663);}}});};exports[_0x35fc('0xaa')]=function(_0x295a64,_0x54f353,_0x49ed6b){var _0x2ff4ba={};var _0x4bf9a5={};var _0x25c92e;var _0x3a1a0e;return db[_0x35fc('0x40')]['findOne']({'where':{'id':_0x295a64[_0x35fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x54f353,null))[_0x35fc('0x34')](function(_0xe25a3a){if(_0xe25a3a){_0x25c92e=_0xe25a3a;_0x4bf9a5['model']=_[_0x35fc('0x46')](db[_0x35fc('0xa6')][_0x35fc('0x41')]);_0x4bf9a5[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x295a64[_0x35fc('0x45')]);_0x4bf9a5[_0x35fc('0x47')]=_['intersection'](_0x4bf9a5['model'],_0x4bf9a5[_0x35fc('0x45')]);_0x2ff4ba[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x4bf9a5[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x295a64[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x2ff4ba['attributes']=_0x2ff4ba[_0x35fc('0x49')][_0x35fc('0x5a')]?_0x2ff4ba[_0x35fc('0x49')]:_0x4bf9a5['model'];_0x2ff4ba[_0x35fc('0x68')]=qs[_0x35fc('0x4c')](_0x295a64[_0x35fc('0x45')][_0x35fc('0x4c')]);_0x2ff4ba[_0x35fc('0x4d')]=qs[_0x35fc('0x47')](_[_0x35fc('0x4e')](_0x295a64[_0x35fc('0x45')],_0x4bf9a5[_0x35fc('0x47')]));if(_0x295a64[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x2ff4ba[_0x35fc('0x4d')]=_[_0x35fc('0x50')](_0x2ff4ba[_0x35fc('0x4d')],{'$or':_[_0x35fc('0x3f')](_0x2ff4ba[_0x35fc('0x49')],function(_0x26987e){var _0x18ffc2={};_0x18ffc2[_0x26987e]={'$like':'%'+_0x295a64[_0x35fc('0x45')]['filter']+'%'};return _0x18ffc2;})});}_0x2ff4ba=_[_0x35fc('0x50')]({},_0x2ff4ba,_0x295a64['options']);return _0x25c92e[_0x35fc('0xaa')](_0x2ff4ba);}})[_0x35fc('0x34')](function(_0x4dd4a2){if(_0x4dd4a2){_0x3a1a0e=_0x4dd4a2[_0x35fc('0x5a')];if(!_0x295a64[_0x35fc('0x45')][_0x35fc('0x4b')](_0x35fc('0x67'))){_0x2ff4ba[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x295a64[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x2ff4ba['offset']=qs[_0x35fc('0x2b')](_0x295a64[_0x35fc('0x45')][_0x35fc('0x2b')]);}return _0x25c92e[_0x35fc('0xaa')](_0x2ff4ba);}})['then'](function(_0x4dc276){if(_0x4dc276){return _0x4dc276?{'count':_0x3a1a0e,'rows':_0x4dc276}:null;}})['then'](respondWithResult(_0x54f353,null))['catch'](handleError(_0x54f353,null));};exports[_0x35fc('0xab')]=function(_0x572d83,_0xcbabdf,_0x2475d6){var _0x3909bf={'raw':![],'where':{}};var _0x1cccd8={};var _0x1b9e94={'count':0x0,'rows':[]};return db[_0x35fc('0x40')][_0x35fc('0xa5')]({'where':{'id':_0x572d83[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0xcbabdf,null))[_0x35fc('0x34')](function(_0x5bfd4d){if(_0x5bfd4d){_0x1cccd8[_0x35fc('0x44')]=_[_0x35fc('0x46')](db['OpenchannelInteraction'][_0x35fc('0x41')]);_0x1cccd8[_0x35fc('0x45')]=_[_0x35fc('0x46')](_0x572d83[_0x35fc('0x45')]);_0x1cccd8['filters']=_[_0x35fc('0x48')](_0x1cccd8[_0x35fc('0x44')],_0x1cccd8[_0x35fc('0x45')]);_0x3909bf[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x1cccd8[_0x35fc('0x44')],qs[_0x35fc('0x4a')](_0x572d83[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x3909bf[_0x35fc('0x49')]=_0x3909bf[_0x35fc('0x49')][_0x35fc('0x5a')]?_0x3909bf[_0x35fc('0x49')]:_0x1cccd8[_0x35fc('0x44')];if(!_0x572d83[_0x35fc('0x45')][_0x35fc('0x4b')](_0x35fc('0x67'))){_0x3909bf[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x572d83[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x3909bf[_0x35fc('0x2b')]=qs['offset'](_0x572d83[_0x35fc('0x45')][_0x35fc('0x2b')]);}_0x3909bf[_0x35fc('0x68')]=qs[_0x35fc('0x4c')](_0x572d83[_0x35fc('0x45')]['sort']);_0x3909bf[_0x35fc('0x4d')]=qs['filters'](_[_0x35fc('0x4e')](_0x572d83[_0x35fc('0x45')],_0x1cccd8[_0x35fc('0x47')]));_0x3909bf[_0x35fc('0x4d')][_0x35fc('0x65')]=_0x5bfd4d['id'];if(_0x572d83[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x3909bf[_0x35fc('0x4d')]=_[_0x35fc('0x50')](_0x3909bf[_0x35fc('0x4d')],{'$or':_[_0x35fc('0x3f')](_0x3909bf[_0x35fc('0x49')],function(_0x26d42e){var _0x201c0e={};_0x201c0e[_0x26d42e]={'$like':'%'+_0x572d83[_0x35fc('0x45')][_0x35fc('0x4f')]+'%'};return _0x201c0e;})});}_0x3909bf=_[_0x35fc('0x50')]({},_0x3909bf,_0x572d83[_0x35fc('0x53')]);return db[_0x35fc('0x8b')][_0x35fc('0x2e')]({'where':_0x3909bf['where']})[_0x35fc('0x34')](function(_0xb3afed){_0x1b9e94[_0x35fc('0x2e')]=_0xb3afed;if(_0x572d83['query'][_0x35fc('0x54')]){_0x3909bf[_0x35fc('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x35fc('0xac'),'attributes':[_0x35fc('0x3b'),'fullname',_0x35fc('0xad')],'required':![]},{'model':db[_0x35fc('0xae')],'as':_0x35fc('0xaf'),'attributes':['id',_0x35fc('0x3b'),_0x35fc('0xb0')],'where':_0x572d83[_0x35fc('0x45')]['tag']?{'id':_0x572d83[_0x35fc('0x45')][_0x35fc('0xb1')]}:undefined,'required':_0x572d83[_0x35fc('0x45')][_0x35fc('0xb1')]?!![]:![]}];}return db[_0x35fc('0x8b')]['findAll'](_0x3909bf);})[_0x35fc('0x34')](function(_0x387417){_0x1b9e94['rows']=_0x387417;return _0x1b9e94;});}})[_0x35fc('0x34')](respondWithFilteredResult(_0xcbabdf,_0x3909bf))[_0x35fc('0x28')](handleError(_0xcbabdf,null));};exports[_0x35fc('0xb2')]=function(_0x2e3674,_0x158e72,_0xb0ba1e){return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x2e3674[_0x35fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x158e72,null))[_0x35fc('0x34')](function(_0x371e7d){if(_0x371e7d){return _0x371e7d['addAgents'](_0x2e3674[_0x35fc('0x62')]['ids'],_[_0x35fc('0xb3')](_0x2e3674[_0x35fc('0x62')],[_0x35fc('0x6a'),'id'])||{})[_0x35fc('0xb4')](function(_0x536837){for(var _0x3cfbd4=0x0;_0x3cfbd4<_0x2e3674[_0x35fc('0x62')][_0x35fc('0x6a')]['length'];_0x3cfbd4+=0x1){socket[_0x35fc('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x2e3674[_0x35fc('0x62')][_0x35fc('0x6a')][_0x3cfbd4]),'OpenchannelAccountId':Number(_0x2e3674[_0x35fc('0x63')]['id'])});}return _0x536837;});}})[_0x35fc('0x34')](respondWithResult(_0x158e72,null))[_0x35fc('0x28')](handleError(_0x158e72,null));};exports[_0x35fc('0xb6')]=function(_0x38b8e8,_0x2c0010,_0x37be5b){return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x38b8e8[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x2c0010,null))[_0x35fc('0x34')](function(_0x324c56){if(_0x324c56){return _0x324c56['removeAgents'](_0x38b8e8[_0x35fc('0x45')][_0x35fc('0x6a')])[_0x35fc('0x34')](function(){if(_[_0x35fc('0xb7')](_0x38b8e8[_0x35fc('0x45')][_0x35fc('0x6a')])){for(var _0x2138f4=0x0;_0x2138f4<_0x38b8e8['query']['ids']['length'];_0x2138f4+=0x1){socket['emit'](_0x35fc('0xb8'),{'UserId':Number(_0x38b8e8['query'][_0x35fc('0x6a')][_0x2138f4]),'OpenchannelAccountId':Number(_0x38b8e8[_0x35fc('0x63')]['id'])});}}else{socket[_0x35fc('0xb5')](_0x35fc('0xb8'),{'UserId':Number(_0x38b8e8[_0x35fc('0x45')][_0x35fc('0x6a')]),'OpenchannelAccountId':Number(_0x38b8e8['params']['id'])});}});}})[_0x35fc('0x34')](respondWithStatusCode(_0x2c0010,null))['catch'](handleError(_0x2c0010,null));};exports[_0x35fc('0xb9')]=function(_0x4cd30d,_0x5e680a,_0x132d58){var _0x472e13={};var _0x2d0512={};var _0x4f837c;var _0x54a183;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4cd30d[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x5e680a,null))[_0x35fc('0x34')](function(_0x546a61){if(_0x546a61){_0x4f837c=_0x546a61;_0x2d0512[_0x35fc('0x44')]=_[_0x35fc('0x46')](db[_0x35fc('0x97')][_0x35fc('0x41')]);_0x2d0512[_0x35fc('0x45')]=_['keys'](_0x4cd30d['query']);_0x2d0512[_0x35fc('0x47')]=_[_0x35fc('0x48')](_0x2d0512[_0x35fc('0x44')],_0x2d0512[_0x35fc('0x45')]);_0x472e13[_0x35fc('0x49')]=_[_0x35fc('0x48')](_0x2d0512['model'],qs[_0x35fc('0x4a')](_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x4a')]));_0x472e13['attributes']=_0x472e13['attributes'][_0x35fc('0x5a')]?_0x472e13[_0x35fc('0x49')]:_0x2d0512[_0x35fc('0x44')];_0x472e13['order']=qs[_0x35fc('0x4c')](_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x4c')]);_0x472e13['where']=qs[_0x35fc('0x47')](_['pick'](_0x4cd30d[_0x35fc('0x45')],_0x2d0512['filters']));if(_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x4f')]){_0x472e13['where']=_[_0x35fc('0x50')](_0x472e13[_0x35fc('0x4d')],{'$or':_['map'](_0x472e13[_0x35fc('0x49')],function(_0x102fc6){var _0x4420fb={};_0x4420fb[_0x102fc6]={'$like':'%'+_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x4f')]+'%'};return _0x4420fb;})});}_0x472e13=_[_0x35fc('0x50')]({},_0x472e13,_0x4cd30d['options']);return _0x4f837c[_0x35fc('0xb9')](_0x472e13);}})[_0x35fc('0x34')](function(_0x168427){if(_0x168427){_0x54a183=_0x168427[_0x35fc('0x5a')];if(!_0x4cd30d[_0x35fc('0x45')]['hasOwnProperty'](_0x35fc('0x67'))){_0x472e13[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x2d')]);_0x472e13[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x4cd30d[_0x35fc('0x45')][_0x35fc('0x2b')]);}return _0x4f837c['getAgents'](_0x472e13);}})[_0x35fc('0x34')](function(_0x465314){if(_0x465314){return _0x465314?{'count':_0x54a183,'rows':_0x465314}:null;}})[_0x35fc('0x34')](respondWithResult(_0x5e680a,null))['catch'](handleError(_0x5e680a,null));};exports[_0x35fc('0x3c')]=function(_0x4b6115,_0x2ceac9,_0x413a4b){var _0x599121,_0x311670,_0x10eb08;if(_[_0x35fc('0x77')](_0x4b6115[_0x35fc('0x62')][_0x35fc('0x62')])||_0x4b6115[_0x35fc('0x62')][_0x35fc('0x62')]===''){throw new db['Sequelize'][(_0x35fc('0x70'))](_0x35fc('0x7b'));}if(_[_0x35fc('0x77')](_0x4b6115['body']['to'])){}_0x599121=_0x4b6115['body']['to'];return db[_0x35fc('0x40')][_0x35fc('0xa5')]({'where':{'id':_0x4b6115[_0x35fc('0x63')]['id']}})[_0x35fc('0x34')](handleEntityNotFound(_0x2ceac9,null))[_0x35fc('0x34')](function(_0x76e209){if(_0x76e209){return db[_0x35fc('0x40')][_0x35fc('0x5b')]({'where':{'id':_0x76e209['id']},'include':[{'model':db[_0x35fc('0x80')],'as':_0x35fc('0x81'),'include':[{'model':db[_0x35fc('0x6e')],'as':_0x35fc('0x82'),'where':{[_0x76e209[_0x35fc('0x7c')]]:_0x599121},'limit':0x1,'order':[[_0x35fc('0x74'),_0x35fc('0xba')]]}]}]})[_0x35fc('0x34')](handleEntityNotFound(_0x2ceac9,null))[_0x35fc('0x34')](function(_0x605f3b){if(_0x605f3b&&_0x605f3b[_0x35fc('0x81')]){_0x311670=_0x605f3b['get']({'plain':!![]});if(_0x311670[_0x35fc('0x81')]&&_0x311670['List']['Contacts'][_0x35fc('0x5a')]){return _0x311670[_0x35fc('0x81')][_0x35fc('0x82')][0x0];}return db[_0x35fc('0x6e')][_0x35fc('0x5c')](_[_0x35fc('0x17')](_0x4b6115[_0x35fc('0x62')],{'firstName':_0x599121,[_0x605f3b[_0x35fc('0x7c')]]:_0x599121,'phone':_0x599121,'ListId':_0x311670[_0x35fc('0x76')]}));}})[_0x35fc('0x34')](handleEntityNotFound(_0x2ceac9,null))[_0x35fc('0x34')](function(_0x3033a0){if(_0x3033a0){_0x10eb08=_0x3033a0;return db[_0x35fc('0x8b')][_0x35fc('0x5b')]({'where':{'ContactId':_0x10eb08['id'],'closed':![],'OpenchannelAccountId':_0x311670['id']}})[_0x35fc('0x34')](function(_0x3155a6){if(_0x3155a6){return[_0x3155a6,![]];}return db[_0x35fc('0x8b')][_0x35fc('0x5c')]({'UserId':_0x4b6115[_0x35fc('0x5d')]['id'],'ContactId':_0x10eb08['id'],'OpenchannelAccountId':_0x311670['id'],'lastMsgDirection':_0x35fc('0xbb'),'firstMsgDirection':'out','Messages':[_[_0x35fc('0x50')](_0x4b6115[_0x35fc('0x62')],{'read':![],'body':_0x4b6115[_0x35fc('0x62')]['body'],'OpenchannelAccountId':_0x311670['id'],'UserId':_0x4b6115[_0x35fc('0x5d')]['id'],'ContactId':_0x10eb08['id']})]},{'include':[{'model':db[_0x35fc('0x94')],'as':_0x35fc('0xbc')}]})['then'](function(_0x103046){return[_0x103046,!![]];});});}})[_0x35fc('0xb4')](function(_0x24ce43,_0x5318f5){if(_0x5318f5){return _0x24ce43;}return db[_0x35fc('0x94')][_0x35fc('0x5c')](_['merge'](_0x4b6115[_0x35fc('0x62')],{'read':![],'body':_0x4b6115[_0x35fc('0x62')][_0x35fc('0x62')],'OpenchannelAccountId':_0x311670['id'],'OpenchannelInteractionId':_0x24ce43['id'],'UserId':_0x4b6115[_0x35fc('0x5d')]['id'],'ContactId':_0x10eb08['id']}))['then'](function(_0x59faad){_0x24ce43['dataValues'][_0x35fc('0xbc')]=[];_0x24ce43[_0x35fc('0xbd')]['Messages'][_0x35fc('0xbe')](_0x59faad[_0x35fc('0xbd')]);return _0x24ce43;});});}})[_0x35fc('0x34')](respondWithResult(_0x2ceac9,null))[_0x35fc('0x28')](handleError(_0x2ceac9,null));}; \ No newline at end of file +var _0xe98c=['emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','OpenchannelMessage','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','jayson/promise','http','client','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','then','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','ListId','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit'];(function(_0x1dabc3,_0x48377c){var _0x328c2f=function(_0x290daf){while(--_0x290daf){_0x1dabc3['push'](_0x1dabc3['shift']());}};_0x328c2f(++_0x48377c);}(_0xe98c,0xd3));var _0xce98=function(_0x1263cc,_0x34b0a6){_0x1263cc=_0x1263cc-0x0;var _0x4132a0=_0xe98c[_0x1263cc];return _0x4132a0;};'use strict';var emlformat=require(_0xce98('0x0'));var rimraf=require(_0xce98('0x1'));var zipdir=require(_0xce98('0x2'));var jsonpatch=require(_0xce98('0x3'));var rp=require(_0xce98('0x4'));var moment=require('moment');var BPromise=require(_0xce98('0x5'));var Mustache=require(_0xce98('0x6'));var util=require(_0xce98('0x7'));var path=require(_0xce98('0x8'));var sox=require(_0xce98('0x9'));var csv=require(_0xce98('0xa'));var ejs=require(_0xce98('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce98('0xc'));var squel=require(_0xce98('0xd'));var crypto=require(_0xce98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xce98('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce98('0x10'));var Papa=require('papaparse');var Redis=require(_0xce98('0x11'));var authService=require(_0xce98('0x12'));var qs=require(_0xce98('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce98('0x14'));var logger=require(_0xce98('0x15'))(_0xce98('0x16'));var utils=require('../../config/utils');var config=require(_0xce98('0x17'));var licenseUtil=require(_0xce98('0x18'));var db=require(_0xce98('0x19'))['db'];config[_0xce98('0x1a')]=_[_0xce98('0x1b')](config[_0xce98('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce98('0x1a')]));require(_0xce98('0x1c'))['register'](socket);var jayson=require(_0xce98('0x1d'));var client=jayson['client'][_0xce98('0x1e')]({'port':0x232c});var client9002=jayson[_0xce98('0x1f')][_0xce98('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xd68d7d,_0x176b15,_0x3460f5,_0x2613b0){return new BPromise(function(_0x1944e2,_0x147392){var _0x4d69a1=_0x2613b0||client;return _0x4d69a1[_0xce98('0x20')](_0xd68d7d,_0x3460f5)['then'](function(_0xd0ef6e){logger[_0xce98('0x21')](_0xce98('0x22'),_0x176b15,'request\x20sent');logger[_0xce98('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x176b15,_0xce98('0x24'),JSON[_0xce98('0x25')](_0xd0ef6e));if(_0xd0ef6e['error']){if(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x27')]===0x1f4){logger[_0xce98('0x26')](_0xce98('0x22'),_0x176b15,_0xd0ef6e[_0xce98('0x26')]['message']);return _0x147392(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x28')]);}logger[_0xce98('0x26')](_0xce98('0x22'),_0x176b15,_0xd0ef6e[_0xce98('0x26')]['message']);return _0x1944e2(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x28')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x176b15,_0xce98('0x24'));_0x1944e2(_0xd0ef6e[_0xce98('0x29')][_0xce98('0x28')]);}})[_0xce98('0x2a')](function(_0x21b681){logger['error'](_0xce98('0x22'),_0x176b15,_0x21b681);_0x147392(_0x21b681);});});}function respondWithStatusCode(_0x4368f4,_0x5ccc1f){_0x5ccc1f=_0x5ccc1f||0xcc;return function(_0x163eb6){if(_0x163eb6){return _0x4368f4['sendStatus'](_0x5ccc1f);}return _0x4368f4[_0xce98('0x2b')](_0x5ccc1f)[_0xce98('0x2c')]();};}function respondWithResult(_0x3987aa,_0x53d3ef){_0x53d3ef=_0x53d3ef||0xc8;return function(_0x422677){if(_0x422677){return _0x3987aa[_0xce98('0x2b')](_0x53d3ef)['json'](_0x422677);}};}function respondWithFilteredResult(_0x3849e8,_0x54132b){return function(_0x50a3c5){if(_0x50a3c5){var _0x12f180=typeof _0x54132b['offset']===_0xce98('0x2d')&&typeof _0x54132b[_0xce98('0x2e')]===_0xce98('0x2d');var _0xb80887=_0x50a3c5[_0xce98('0x2f')];var _0x3df91d=_0x12f180?0x0:_0x54132b[_0xce98('0x30')];var _0x2e6b4a=_0x12f180?_0x50a3c5[_0xce98('0x2f')]:_0x54132b[_0xce98('0x30')]+_0x54132b[_0xce98('0x2e')];var _0x1af843;if(_0x2e6b4a>=_0xb80887){_0x2e6b4a=_0xb80887;_0x1af843=0xc8;}else{_0x1af843=0xce;}_0x3849e8[_0xce98('0x2b')](_0x1af843);return _0x3849e8[_0xce98('0x31')](_0xce98('0x32'),_0x3df91d+'-'+_0x2e6b4a+'/'+_0xb80887)[_0xce98('0x33')](_0x50a3c5);}return null;};}function patchUpdates(_0x2559e9){return function(_0x200647){try{jsonpatch['apply'](_0x200647,_0x2559e9,!![]);}catch(_0x15685e){return BPromise[_0xce98('0x34')](_0x15685e);}return _0x200647['save']();};}function saveUpdates(_0x389a2a,_0x27cebc){return function(_0x4f7d44){if(_0x4f7d44){return _0x4f7d44['update'](_0x389a2a)['then'](function(_0x517efa){return _0x517efa;});}return null;};}function removeEntity(_0x297384,_0x414c8b){return function(_0xdc7f88){if(_0xdc7f88){return _0xdc7f88['destroy']()[_0xce98('0x35')](function(){var _0x2507b0=_0xdc7f88[_0xce98('0x36')]({'plain':!![]});var _0x102e79=_0xce98('0x37');return db[_0xce98('0x38')]['destroy']({'where':{'type':_0x102e79,'resourceId':_0x2507b0['id']}})[_0xce98('0x35')](function(){return _0xdc7f88;});})[_0xce98('0x35')](function(){_0x297384[_0xce98('0x2b')](0xcc)[_0xce98('0x2c')]();});}};}function handleEntityNotFound(_0x208436,_0x4d3185){return function(_0x208731){if(!_0x208731){_0x208436[_0xce98('0x39')](0x194);}return _0x208731;};}function handleError(_0x53b0b4,_0x335908){_0x335908=_0x335908||0x1f4;return function(_0xc25a4d){logger[_0xce98('0x26')](_0xc25a4d[_0xce98('0x3a')]);if(_0xc25a4d[_0xce98('0x3b')]){delete _0xc25a4d['name'];}_0x53b0b4[_0xce98('0x2b')](_0x335908)['send'](_0xc25a4d);};}exports[_0xce98('0x3c')]=function(_0x57a818,_0x530d0d){var _0x41ae6e={'include':[{'model':db[_0xce98('0x3d')],'as':_0xce98('0x3e')}]},_0x401b75={},_0x4359cf={'count':0x0,'rows':[]};var _0x2f9143=_['map'](db[_0xce98('0x3f')][_0xce98('0x40')],function(_0x1f1de3){return{'name':_0x1f1de3[_0xce98('0x41')],'type':_0x1f1de3[_0xce98('0x42')][_0xce98('0x43')]};});_0x401b75[_0xce98('0x44')]=_[_0xce98('0x45')](_0x2f9143,_0xce98('0x3b'));_0x401b75['query']=_[_0xce98('0x46')](_0x57a818['query']);_0x401b75[_0xce98('0x47')]=_[_0xce98('0x48')](_0x401b75[_0xce98('0x44')],_0x401b75['query']);_0x41ae6e['attributes']=_['intersection'](_0x401b75[_0xce98('0x44')],qs[_0xce98('0x49')](_0x57a818[_0xce98('0x4a')]['fields']));_0x41ae6e[_0xce98('0x4b')]=_0x41ae6e[_0xce98('0x4b')]['length']?_0x41ae6e['attributes']:_0x401b75[_0xce98('0x44')];if(!_0x57a818[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x41ae6e[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x57a818['query'][_0xce98('0x2e')]);_0x41ae6e['offset']=qs[_0xce98('0x30')](_0x57a818[_0xce98('0x4a')]['offset']);}_0x41ae6e[_0xce98('0x4e')]=qs['sort'](_0x57a818[_0xce98('0x4a')][_0xce98('0x4f')]);_0x41ae6e[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x57a818[_0xce98('0x4a')],_0x401b75[_0xce98('0x47')]),_0x2f9143);if(_0x57a818['query'][_0xce98('0x52')]){_0x41ae6e['where']=_[_0xce98('0x53')](_0x41ae6e[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x2f9143,function(_0x49f4b0){if(_0x49f4b0[_0xce98('0x42')]!==_0xce98('0x54')){var _0x45bb93={};_0x45bb93[_0x49f4b0['name']]={'$like':'%'+_0x57a818[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x45bb93;}})});}_0x41ae6e=_[_0xce98('0x53')]({},_0x41ae6e,_0x57a818[_0xce98('0x55')]);var _0x2a279d={'where':_0x41ae6e[_0xce98('0x50')]};return db[_0xce98('0x3f')][_0xce98('0x2f')](_0x2a279d)['then'](function(_0x41eacc){_0x4359cf['count']=_0x41eacc;if(_0x57a818[_0xce98('0x4a')][_0xce98('0x56')]){_0x41ae6e[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x3f')][_0xce98('0x58')](_0x41ae6e);})[_0xce98('0x35')](function(_0x294115){_0x4359cf[_0xce98('0x59')]=_0x294115;return _0x4359cf;})['then'](respondWithFilteredResult(_0x530d0d,_0x41ae6e))[_0xce98('0x2a')](handleError(_0x530d0d,null));};exports[_0xce98('0x5a')]=function(_0x2c1790,_0x372d66){var _0x11e7cc={'raw':![],'where':{'id':_0x2c1790[_0xce98('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xce98('0x3e')}]},_0x1c5bf0={};_0x1c5bf0[_0xce98('0x44')]=_['keys'](db['OpenchannelAccount'][_0xce98('0x40')]);_0x1c5bf0[_0xce98('0x4a')]=_['keys'](_0x2c1790[_0xce98('0x4a')]);_0x1c5bf0[_0xce98('0x47')]=_[_0xce98('0x48')](_0x1c5bf0[_0xce98('0x44')],_0x1c5bf0['query']);_0x11e7cc[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x1c5bf0[_0xce98('0x44')],qs['fields'](_0x2c1790[_0xce98('0x4a')][_0xce98('0x49')]));_0x11e7cc[_0xce98('0x4b')]=_0x11e7cc[_0xce98('0x4b')][_0xce98('0x5c')]?_0x11e7cc[_0xce98('0x4b')]:_0x1c5bf0[_0xce98('0x44')];if(_0x2c1790[_0xce98('0x4a')]['includeAll']){_0x11e7cc[_0xce98('0x57')]=[{'all':!![]}];}_0x11e7cc=_[_0xce98('0x53')]({},_0x11e7cc,_0x2c1790[_0xce98('0x55')]);return db[_0xce98('0x3f')][_0xce98('0x5d')](_0x11e7cc)[_0xce98('0x35')](handleEntityNotFound(_0x372d66,null))['then'](respondWithResult(_0x372d66,null))[_0xce98('0x2a')](handleError(_0x372d66,null));};exports[_0xce98('0x5e')]=function(_0x4da32f,_0x456f58){return db[_0xce98('0x3f')]['create'](_0x4da32f[_0xce98('0x5f')],{})[_0xce98('0x35')](function(_0x5792b9){var _0x280911=_0x4da32f[_0xce98('0x60')][_0xce98('0x36')]({'plain':!![]});if(!_0x280911)throw new Error(_0xce98('0x61'));if(_0x280911[_0xce98('0x62')]===_0xce98('0x60')){var _0x3305ed=_0x5792b9[_0xce98('0x36')]({'plain':!![]});var _0x912e38=_0xce98('0x37');return db[_0xce98('0x63')]['find']({'where':{'name':_0x912e38,'userProfileId':_0x280911[_0xce98('0x64')]},'raw':!![]})['then'](function(_0x569641){if(_0x569641&&_0x569641[_0xce98('0x65')]===0x0){return db[_0xce98('0x38')]['create']({'name':_0x3305ed[_0xce98('0x3b')],'resourceId':_0x3305ed['id'],'type':_0x569641[_0xce98('0x3b')],'sectionId':_0x569641['id']},{})[_0xce98('0x35')](function(){return _0x5792b9;});}else{return _0x5792b9;}})[_0xce98('0x2a')](function(_0x3c3a0f){logger[_0xce98('0x26')](_0xce98('0x66'),_0x3c3a0f);throw _0x3c3a0f;});}return _0x5792b9;})[_0xce98('0x35')](respondWithResult(_0x456f58,0xc9))['catch'](handleError(_0x456f58,null));};exports[_0xce98('0x67')]=function(_0x3614b6,_0xc39d70){if(_0x3614b6['body']['id']){delete _0x3614b6[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x3614b6['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xc39d70,null))['then'](saveUpdates(_0x3614b6[_0xce98('0x5f')],null))['then'](respondWithResult(_0xc39d70,null))[_0xce98('0x2a')](handleError(_0xc39d70,null));};exports[_0xce98('0x68')]=function(_0x61ceb6,_0x24e661){return db['OpenchannelAccount']['find']({'where':{'id':_0x61ceb6['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x24e661,null))[_0xce98('0x35')](removeEntity(_0x24e661,null))[_0xce98('0x2a')](handleError(_0x24e661,null));};exports[_0xce98('0x69')]=function(_0x4d93de,_0x3123ba){return db[_0xce98('0x3f')][_0xce98('0x69')]()[_0xce98('0x35')](respondWithResult(_0x3123ba,null))[_0xce98('0x2a')](handleError(_0x3123ba,null));};exports[_0xce98('0x6a')]=function(_0x31b85f,_0x1b38af,_0x27ba23){if(_0x31b85f['body']['id']){delete _0x31b85f[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x31b85f[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1b38af,null))['then'](function(_0x2a866d){if(_0x2a866d){_0x31b85f['body']['OpenchannelAccountId']=_0x2a866d['id'];return db[_0xce98('0x6b')][_0xce98('0x5e')](_0x31b85f['body']);}})['then'](respondWithResult(_0x1b38af,null))[_0xce98('0x2a')](handleError(_0x1b38af,null));};exports[_0xce98('0x6c')]=function(_0x5e4470,_0x669d9f,_0x5b6d94){var _0xde593f={'raw':![],'where':{}};var _0x4ee8e8={};var _0x1590e5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xce98('0x6d')]({'where':{'id':_0x5e4470[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x669d9f,null))[_0xce98('0x35')](function(_0x368aa5){if(_0x368aa5){_0x4ee8e8['model']=_[_0xce98('0x46')](db[_0xce98('0x6b')]['rawAttributes']);_0x4ee8e8[_0xce98('0x4a')]=_[_0xce98('0x46')](_0x5e4470['query']);_0x4ee8e8['filters']=_[_0xce98('0x48')](_0x4ee8e8[_0xce98('0x44')],_0x4ee8e8[_0xce98('0x4a')]);_0xde593f[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x4ee8e8[_0xce98('0x44')],qs[_0xce98('0x49')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x49')]));_0xde593f[_0xce98('0x4b')]=_0xde593f['attributes'][_0xce98('0x5c')]?_0xde593f['attributes']:_0x4ee8e8[_0xce98('0x44')];if(!_0x5e4470[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0xde593f[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x2e')]);_0xde593f[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x30')]);}_0xde593f[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x5e4470['query'][_0xce98('0x4f')]);_0xde593f['where']=qs['filters'](_[_0xce98('0x51')](_0x5e4470['query'],_0x4ee8e8[_0xce98('0x47')]));_0xde593f[_0xce98('0x50')][_0xce98('0x6e')]=_0x368aa5['id'];if(_0x5e4470[_0xce98('0x4a')][_0xce98('0x52')]){_0xde593f['where']=_[_0xce98('0x53')](_0xde593f['where'],{'$or':_[_0xce98('0x45')](_0xde593f['attributes'],function(_0xad52f5){var _0x3490b3={};_0x3490b3[_0xad52f5]={'$like':'%'+_0x5e4470[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x3490b3;})});}_0xde593f=_[_0xce98('0x53')]({},_0xde593f,_0x5e4470[_0xce98('0x55')]);return db[_0xce98('0x6b')]['count']({'where':_0xde593f[_0xce98('0x50')]})[_0xce98('0x35')](function(_0x40b0b1){_0x1590e5[_0xce98('0x2f')]=_0x40b0b1;if(_0x5e4470['query'][_0xce98('0x56')]){_0xde593f[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x6b')][_0xce98('0x58')](_0xde593f);})[_0xce98('0x35')](function(_0x4f94b0){_0x1590e5[_0xce98('0x59')]=_0x4f94b0;return _0x1590e5;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x669d9f,_0xde593f))[_0xce98('0x2a')](handleError(_0x669d9f,null));};exports[_0xce98('0x6f')]=function(_0x58575d,_0x25b4da,_0x5b7584){return db[_0xce98('0x3f')]['find']({'where':{'id':_0x58575d[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x25b4da,null))[_0xce98('0x35')](function(_0x44ab41){if(_0x44ab41){return _0x44ab41[_0xce98('0x6f')](_0x58575d[_0xce98('0x4a')]['ids']);}})[_0xce98('0x35')](respondWithStatusCode(_0x25b4da,null))[_0xce98('0x2a')](handleError(_0x25b4da,null));};exports['addAnswer']=function(_0x42cc85,_0x5de60c,_0x1b4983){if(_0x42cc85[_0xce98('0x5f')]['id']){delete _0x42cc85[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x42cc85[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x5de60c,null))[_0xce98('0x35')](function(_0x1c5104){if(_0x1c5104){_0x42cc85[_0xce98('0x5f')][_0xce98('0x6e')]=_0x1c5104['id'];return db[_0xce98('0x70')][_0xce98('0x5e')](_0x42cc85[_0xce98('0x5f')]);}})[_0xce98('0x35')](respondWithResult(_0x5de60c,null))[_0xce98('0x2a')](handleError(_0x5de60c,null));};exports[_0xce98('0x71')]=function(_0x184562,_0x4a5a2b,_0x17aef0){var _0x1db888={'raw':![],'where':{}};var _0x389e44={};var _0x3dd867={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x184562[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x4a5a2b,null))[_0xce98('0x35')](function(_0x20968f){if(_0x20968f){_0x389e44[_0xce98('0x44')]=_[_0xce98('0x46')](db[_0xce98('0x70')][_0xce98('0x40')]);_0x389e44['query']=_['keys'](_0x184562[_0xce98('0x4a')]);_0x389e44[_0xce98('0x47')]=_[_0xce98('0x48')](_0x389e44[_0xce98('0x44')],_0x389e44[_0xce98('0x4a')]);_0x1db888['attributes']=_[_0xce98('0x48')](_0x389e44[_0xce98('0x44')],qs[_0xce98('0x49')](_0x184562[_0xce98('0x4a')][_0xce98('0x49')]));_0x1db888[_0xce98('0x4b')]=_0x1db888[_0xce98('0x4b')]['length']?_0x1db888['attributes']:_0x389e44['model'];if(!_0x184562[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x1db888[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x184562[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1db888[_0xce98('0x30')]=qs['offset'](_0x184562['query'][_0xce98('0x30')]);}_0x1db888['order']=qs[_0xce98('0x4f')](_0x184562['query'][_0xce98('0x4f')]);_0x1db888[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x184562['query'],_0x389e44[_0xce98('0x47')]));_0x1db888[_0xce98('0x50')]['OpenchannelAccountId']=_0x20968f['id'];if(_0x184562[_0xce98('0x4a')]['filter']){_0x1db888[_0xce98('0x50')]=_['merge'](_0x1db888[_0xce98('0x50')],{'$or':_['map'](_0x1db888[_0xce98('0x4b')],function(_0x11a533){var _0x24d8ea={};_0x24d8ea[_0x11a533]={'$like':'%'+_0x184562[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x24d8ea;})});}_0x1db888=_[_0xce98('0x53')]({},_0x1db888,_0x184562['options']);return db['CannedAnswer'][_0xce98('0x2f')]({'where':_0x1db888['where']})[_0xce98('0x35')](function(_0x363b8e){_0x3dd867[_0xce98('0x2f')]=_0x363b8e;if(_0x184562[_0xce98('0x4a')][_0xce98('0x56')]){_0x1db888[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x70')]['findAll'](_0x1db888);})[_0xce98('0x35')](function(_0x279553){_0x3dd867[_0xce98('0x59')]=_0x279553;return _0x3dd867;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x4a5a2b,_0x1db888))[_0xce98('0x2a')](handleError(_0x4a5a2b,null));};exports[_0xce98('0x72')]=function(_0x43b565,_0x252895,_0x486995){return db['OpenchannelAccount'][_0xce98('0x5d')]({'where':{'id':_0x43b565[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x252895,null))[_0xce98('0x35')](function(_0x2ebc3c){if(_0x2ebc3c){return _0x2ebc3c[_0xce98('0x72')](_0x43b565[_0xce98('0x4a')][_0xce98('0x73')]);}})[_0xce98('0x35')](respondWithStatusCode(_0x252895,null))[_0xce98('0x2a')](handleError(_0x252895,null));};exports[_0xce98('0x74')]=function(_0x4f190b,_0x3b2015,_0x409dd9){var _0x1a3ac7={'body':_0x4f190b[_0xce98('0x5f')],'channel':_0xce98('0x75')};var _0x556feb=[];var _0xa4516f=[];var _0x169057={};var _0x10d69c=![];return db[_0xce98('0x76')]['describe']()['then'](function(_0x3cf63b){if(!_0x3cf63b){throw new db[(_0xce98('0x77'))]['ValidationError'](_0xce98('0x78'));}_0x556feb=_[_0xce98('0x79')](_[_0xce98('0x46')](_0x3cf63b),[_0xce98('0x7a'),_0xce98('0x7b')]);_0xa4516f=_[_0xce98('0x79')](_[_0xce98('0x46')](_0x3cf63b),['createdAt',_0xce98('0x7b'),_0xce98('0x7c'),'ListId']);if(_0x4f190b[_0xce98('0x5f')]['id']){delete _0x4f190b[_0xce98('0x5f')]['id'];}if(_['isNil'](_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')])){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0x7f'));}if(_[_0xce98('0x80')](_0x4f190b[_0xce98('0x5f')]['body'])||_0x4f190b[_0xce98('0x5f')]['body']===''){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4f190b[_0xce98('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0xce98('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa4516f);}if(!_['includes'](_0xa4516f,_0x4f190b['body'][_0xce98('0x81')])){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0x82')+_0xa4516f);}_0x169057[_0x4f190b[_0xce98('0x5f')][_0xce98('0x81')]]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')];})[_0xce98('0x35')](function(){return db[_0xce98('0x3f')]['find']({'where':{'id':_0x4f190b[_0xce98('0x5b')]['id']},'include':[{'model':db[_0xce98('0x83')],'as':_0xce98('0x84'),'include':[{'model':db['CmContact'],'as':_0xce98('0x85'),'where':_0x169057,'limit':0x1,'order':[[_0xce98('0x7b'),_0xce98('0x86')]]}]},{'model':db[_0xce98('0x87')],'as':_0xce98('0x88')}]});})[_0xce98('0x35')](handleEntityNotFound(_0x3b2015,null))[_0xce98('0x35')](function(_0x164912){if(_0x164912&&_0x164912[_0xce98('0x84')]){_0x1a3ac7[_0xce98('0x89')]=_0x164912;_0x1a3ac7['applications']=_0x164912[_0xce98('0x88')];_0x1a3ac7['list']=_0x164912[_0xce98('0x84')];_0x1a3ac7['applications']=_['orderBy'](_0x1a3ac7[_0xce98('0x8a')],[_0xce98('0x8b')],[_0xce98('0x8c')]);if(_0x1a3ac7[_0xce98('0x89')]['Applications']){delete _0x1a3ac7[_0xce98('0x89')][_0xce98('0x88')];}if(_0x1a3ac7[_0xce98('0x89')][_0xce98('0x84')]&&_0x1a3ac7[_0xce98('0x89')]['List'][_0xce98('0x85')][_0xce98('0x5c')]){return _0x1a3ac7[_0xce98('0x89')][_0xce98('0x84')][_0xce98('0x85')][0x0];}var _0x134ea1=_[_0xce98('0x1b')](_0x4f190b[_0xce98('0x5f')],{'firstName':_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')],'ListId':_0x164912[_0xce98('0x8d')]});_0x134ea1[_0x4f190b['body']['mapKey']]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')];return db['CmContact'][_0xce98('0x5e')](_0x134ea1,{'fields':_0x556feb,'raw':!![]});}})[_0xce98('0x35')](handleEntityNotFound(_0x3b2015,null))[_0xce98('0x35')](function(_0x6de7a0){_0x1a3ac7[_0xce98('0x8e')]=_0x6de7a0;if(_0x6de7a0){var _0x5b7b02={'ContactId':_0x6de7a0['id'],'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'from':(_0x6de7a0[_0xce98('0x8f')]||'')+'\x20'+(_0x6de7a0[_0xce98('0x90')]||'')};var _0x4f5a3b={'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'closed':![]};if(_0x4f190b['body']['threadId']){_0x4f5a3b[_0xce98('0x91')]=_0x4f190b['body'][_0xce98('0x91')];return db['OpenchannelInteraction'][_0xce98('0x5d')]({'where':_0x4f5a3b})[_0xce98('0x35')](function(_0x567e03){if(_0x567e03){return[_0x567e03,![]];}_0x5b7b02[_0xce98('0x91')]=_0x4f190b[_0xce98('0x5f')]['threadId'];_0x5b7b02[_0xce98('0x92')]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x92')];return db['OpenchannelInteraction'][_0xce98('0x5e')](_0x5b7b02)[_0xce98('0x35')](function(_0x51242a){return[_0x51242a,!![]];});});}else{_0x4f5a3b[_0xce98('0x91')]=null;}_0x4f5a3b[_0xce98('0x93')]=_0x6de7a0['id'];return db['OpenchannelInteraction']['find']({'where':_0x4f5a3b})['then'](function(_0x4abca9){if(_0x4abca9){return[_0x4abca9,![]];}return db[_0xce98('0x94')][_0xce98('0x5e')](_0x5b7b02)[_0xce98('0x35')](function(_0x3dc9d3){return[_0x3dc9d3,!![]];});});}})[_0xce98('0x95')](function(_0x53afae,_0x15dc41){if(_0x53afae){_0x10d69c=_0x15dc41;if(!_0x15dc41){var _0x1fd29d={'from':(_0x1a3ac7[_0xce98('0x8e')]['firstName']||'')+'\x20'+(_0x1a3ac7[_0xce98('0x8e')]['lastName']||'')};if(_0x4f190b[_0xce98('0x5f')][_0xce98('0x91')]&&_0x4f190b['body'][_0xce98('0x96')]&&_0x4f190b['body'][_0xce98('0x91')]!=_0x4f190b[_0xce98('0x5f')][_0xce98('0x96')]){_0x1fd29d[_0xce98('0x91')]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x96')];}return _0x53afae['update'](_0x1fd29d);}else{return _0x53afae;}}})[_0xce98('0x35')](function(_0xf76ca3){_0x1a3ac7[_0xce98('0x97')]=_0xf76ca3[_0xce98('0x36')]({'plain':!![]});_0x1a3ac7[_0xce98('0x97')][_0xce98('0x98')]=_0x10d69c;if(_0x1a3ac7[_0xce98('0x97')]['created']){if(_0x1a3ac7[_0xce98('0x89')][_0xce98('0x99')]){_0x1a3ac7[_0xce98('0x8a')][_0xce98('0x9a')]({'id':0x0,'priority':_0x1a3ac7['applications']['length']+0x1,'app':_0xce98('0x9b'),'appdata':_0xce98('0x9c'),'interval':_0xce98('0x9d')});}}return db['OpenchannelMessage'][_0xce98('0x5e')]({'body':_0x4f190b[_0xce98('0x5f')][_0xce98('0x5f')],'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'OpenchannelInteractionId':_0xf76ca3['id'],'direction':'in','ContactId':_0x1a3ac7[_0xce98('0x8e')]['id'],'AttachmentId':_0x4f190b['body'][_0xce98('0x9e')]});})[_0xce98('0x35')](function(_0x212f3a){_0x1a3ac7[_0xce98('0x28')]=_0x212f3a;if(!_0x1a3ac7[_0xce98('0x97')][_0xce98('0x9f')])return;return db[_0xce98('0xa0')][_0xce98('0x5d')]({'attributes':['id',_0xce98('0x3b')],'where':{'id':_0x1a3ac7[_0xce98('0x97')][_0xce98('0x9f')]}});})[_0xce98('0x35')](function(_0x24b268){if(_0x24b268){_0x1a3ac7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xce98('0xa1'),'appdata':_0x24b268[_0xce98('0x3b')]+','+(_0x1a3ac7[_0xce98('0x89')][_0xce98('0xa2')]||0xa),'interval':_0xce98('0x9d')});}if(!_0x1a3ac7[_0xce98('0x97')][_0xce98('0xa3')])return;return db[_0xce98('0xa4')][_0xce98('0x5d')]({'attributes':['id','name'],'where':{'id':_0x1a3ac7[_0xce98('0x97')][_0xce98('0xa3')]}});})[_0xce98('0x35')](function(_0x5ab34d){if(_0x5ab34d){_0x1a3ac7[_0xce98('0x8a')]['unshift']({'id':0x0,'priority':0x1,'app':_0xce98('0xa5'),'appdata':_0x5ab34d['name']+','+(_0x1a3ac7['account'][_0xce98('0xa6')]||0x12c),'interval':_0xce98('0x9d')});}return respondWithRpcPromise(_0xce98('0xa7'),_0xce98('0xa8'),_0x1a3ac7);})['then'](function(_0x354c90){respondWithRpcPromise(_0xce98('0xa9'),_0xce98('0xa9'),{'event':'notify','message':_0x354c90},client9002);return _0x354c90;})[_0xce98('0x35')](respondWithResult(_0x3b2015,null))[_0xce98('0x2a')](handleError(_0x3b2015,null));};exports[_0xce98('0xaa')]=function(_0x3dde8f,_0x10bb3e){var _0x6c5bf7=_0x3dde8f[_0xce98('0x5b')]['id'];var _0x4c8182=_0x3dde8f[_0xce98('0x5f')];var _0x3daf5b=0xc8;var _0x4c7317=null;return db[_0xce98('0xab')][_0xce98('0xac')]({'isolationLevel':db[_0xce98('0xab')]['Transaction'][_0xce98('0xad')][_0xce98('0xae')]},function(_0x7a86c0){return db[_0xce98('0x3f')]['findOne']({'where':{'id':_0x6c5bf7},'transaction':_0x7a86c0})[_0xce98('0x35')](function(_0x18e852){if(_0x18e852){return db[_0xce98('0x87')][_0xce98('0x68')]({'where':{'OpenchannelAccountId':_0x6c5bf7},'transaction':_0x7a86c0})[_0xce98('0x35')](function(){var _0x4afb7e=_[_0xce98('0x45')](_0x4c8182,function(_0x3cedd7){_0x3cedd7[_0xce98('0x6e')]=_0x6c5bf7;return _0x3cedd7;});return db[_0xce98('0x87')][_0xce98('0xaf')](_0x4afb7e,{'transaction':_0x7a86c0});});}else{_0x3daf5b=0x194;_0x4c7317=[];}});})[_0xce98('0x35')](function(){if(_0x3daf5b!==0x194){return db[_0xce98('0x87')][_0xce98('0xb0')]({'where':{'OpenchannelAccountId':_0x6c5bf7},'order':_0xce98('0x8b')})[_0xce98('0x35')](function(_0x4ee73f){_0x4c7317=_0x4ee73f;});}})['catch'](function(_0x23c9df){_0x3daf5b=0x1f4;logger[_0xce98('0x26')](_0x23c9df[_0xce98('0x3a')]);if(_0x23c9df[_0xce98('0x3b')]){delete _0x23c9df[_0xce98('0x3b')];}_0x4c7317=_0x23c9df;})[_0xce98('0xb1')](function(){if(_0x4c7317===null){_0x10bb3e[_0xce98('0x39')](_0x3daf5b);}else{if(_0x3daf5b===0x1f4){_0x10bb3e['status'](_0x3daf5b)[_0xce98('0xb2')](_0x4c7317);}else{_0x10bb3e[_0xce98('0x2b')](_0x3daf5b)[_0xce98('0x33')](_0x4c7317);}}});};exports[_0xce98('0xb3')]=function(_0x354744,_0x86011d,_0x269042){var _0x38c893={};var _0x4b22ca={};var _0x14a6c0;var _0x5388d9;return db[_0xce98('0x3f')][_0xce98('0x6d')]({'where':{'id':_0x354744['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x86011d,null))[_0xce98('0x35')](function(_0x1d0327){if(_0x1d0327){_0x14a6c0=_0x1d0327;_0x4b22ca[_0xce98('0x44')]=_[_0xce98('0x46')](db['OpenchannelApplication']['rawAttributes']);_0x4b22ca['query']=_[_0xce98('0x46')](_0x354744[_0xce98('0x4a')]);_0x4b22ca[_0xce98('0x47')]=_[_0xce98('0x48')](_0x4b22ca[_0xce98('0x44')],_0x4b22ca[_0xce98('0x4a')]);_0x38c893[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x4b22ca[_0xce98('0x44')],qs[_0xce98('0x49')](_0x354744[_0xce98('0x4a')][_0xce98('0x49')]));_0x38c893[_0xce98('0x4b')]=_0x38c893[_0xce98('0x4b')][_0xce98('0x5c')]?_0x38c893[_0xce98('0x4b')]:_0x4b22ca[_0xce98('0x44')];_0x38c893[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x354744[_0xce98('0x4a')][_0xce98('0x4f')]);_0x38c893[_0xce98('0x50')]=qs[_0xce98('0x47')](_['pick'](_0x354744[_0xce98('0x4a')],_0x4b22ca[_0xce98('0x47')]));if(_0x354744['query'][_0xce98('0x52')]){_0x38c893[_0xce98('0x50')]=_[_0xce98('0x53')](_0x38c893[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x38c893[_0xce98('0x4b')],function(_0x515a2b){var _0x171e8c={};_0x171e8c[_0x515a2b]={'$like':'%'+_0x354744[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x171e8c;})});}_0x38c893=_[_0xce98('0x53')]({},_0x38c893,_0x354744[_0xce98('0x55')]);return _0x14a6c0['getApplications'](_0x38c893);}})[_0xce98('0x35')](function(_0x1a1d46){if(_0x1a1d46){_0x5388d9=_0x1a1d46[_0xce98('0x5c')];if(!_0x354744[_0xce98('0x4a')][_0xce98('0x4c')]('nolimit')){_0x38c893['limit']=qs['limit'](_0x354744[_0xce98('0x4a')][_0xce98('0x2e')]);_0x38c893[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x354744[_0xce98('0x4a')][_0xce98('0x30')]);}return _0x14a6c0[_0xce98('0xb3')](_0x38c893);}})[_0xce98('0x35')](function(_0xa1287){if(_0xa1287){return _0xa1287?{'count':_0x5388d9,'rows':_0xa1287}:null;}})[_0xce98('0x35')](respondWithResult(_0x86011d,null))[_0xce98('0x2a')](handleError(_0x86011d,null));};exports[_0xce98('0xb4')]=function(_0x5d16ae,_0x322ff5,_0x20968e){var _0x1317c9={'raw':![],'where':{}};var _0x422f8={};var _0x526ed8={'count':0x0,'rows':[]};return db[_0xce98('0x3f')][_0xce98('0x6d')]({'where':{'id':_0x5d16ae[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x322ff5,null))[_0xce98('0x35')](function(_0x2ed6df){if(_0x2ed6df){_0x422f8['model']=_['keys'](db[_0xce98('0x94')][_0xce98('0x40')]);_0x422f8[_0xce98('0x4a')]=_[_0xce98('0x46')](_0x5d16ae[_0xce98('0x4a')]);_0x422f8[_0xce98('0x47')]=_[_0xce98('0x48')](_0x422f8['model'],_0x422f8['query']);_0x1317c9['attributes']=_[_0xce98('0x48')](_0x422f8[_0xce98('0x44')],qs[_0xce98('0x49')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x49')]));_0x1317c9[_0xce98('0x4b')]=_0x1317c9[_0xce98('0x4b')][_0xce98('0x5c')]?_0x1317c9[_0xce98('0x4b')]:_0x422f8[_0xce98('0x44')];if(!_0x5d16ae[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x1317c9[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1317c9[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x5d16ae['query'][_0xce98('0x30')]);}_0x1317c9['order']=qs[_0xce98('0x4f')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x4f')]);_0x1317c9[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x5d16ae[_0xce98('0x4a')],_0x422f8[_0xce98('0x47')]));_0x1317c9[_0xce98('0x50')]['OpenchannelAccountId']=_0x2ed6df['id'];if(_0x5d16ae[_0xce98('0x4a')][_0xce98('0x52')]){_0x1317c9['where']=_[_0xce98('0x53')](_0x1317c9[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x1317c9[_0xce98('0x4b')],function(_0x4c6f2b){var _0x2874be={};_0x2874be[_0x4c6f2b]={'$like':'%'+_0x5d16ae[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x2874be;})});}_0x1317c9=_[_0xce98('0x53')]({},_0x1317c9,_0x5d16ae[_0xce98('0x55')]);return db[_0xce98('0x94')][_0xce98('0x2f')]({'where':_0x1317c9[_0xce98('0x50')]})[_0xce98('0x35')](function(_0x28348d){_0x526ed8[_0xce98('0x2f')]=_0x28348d;if(_0x5d16ae[_0xce98('0x4a')][_0xce98('0x56')]){_0x1317c9[_0xce98('0x57')]=[{'model':db['CmContact'],'as':_0xce98('0xb5'),'required':![]},{'model':db[_0xce98('0xa0')],'as':'Owner','attributes':[_0xce98('0x3b'),_0xce98('0xb6'),_0xce98('0xb7')],'required':![]},{'model':db[_0xce98('0xb8')],'as':_0xce98('0xb9'),'attributes':['id',_0xce98('0x3b'),'color'],'where':_0x5d16ae[_0xce98('0x4a')][_0xce98('0xba')]?{'id':_0x5d16ae['query'][_0xce98('0xba')]}:undefined,'required':_0x5d16ae['query'][_0xce98('0xba')]?!![]:![]}];}return db[_0xce98('0x94')][_0xce98('0x58')](_0x1317c9);})['then'](function(_0x48f7c9){_0x526ed8[_0xce98('0x59')]=_0x48f7c9;return _0x526ed8;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x322ff5,_0x1317c9))['catch'](handleError(_0x322ff5,null));};exports[_0xce98('0xbb')]=function(_0x57d489,_0x432123,_0x598346){return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x57d489['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x432123,null))[_0xce98('0x35')](function(_0x120c24){if(_0x120c24){return _0x120c24['addAgents'](_0x57d489[_0xce98('0x5f')]['ids'],_[_0xce98('0xbc')](_0x57d489['body'],['ids','id'])||{})['spread'](function(_0x41c752){for(var _0x49d2a6=0x0;_0x49d2a6<_0x57d489[_0xce98('0x5f')][_0xce98('0x73')][_0xce98('0x5c')];_0x49d2a6+=0x1){socket[_0xce98('0xbd')](_0xce98('0xbe'),{'UserId':Number(_0x57d489[_0xce98('0x5f')]['ids'][_0x49d2a6]),'OpenchannelAccountId':Number(_0x57d489[_0xce98('0x5b')]['id'])});}return _0x41c752;});}})[_0xce98('0x35')](respondWithResult(_0x432123,null))['catch'](handleError(_0x432123,null));};exports[_0xce98('0xbf')]=function(_0xe4445,_0x372799,_0x2fac50){return db['OpenchannelAccount']['find']({'where':{'id':_0xe4445[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x372799,null))[_0xce98('0x35')](function(_0x437f41){if(_0x437f41){return _0x437f41[_0xce98('0xbf')](_0xe4445[_0xce98('0x4a')][_0xce98('0x73')])[_0xce98('0x35')](function(){if(_[_0xce98('0xc0')](_0xe4445[_0xce98('0x4a')][_0xce98('0x73')])){for(var _0x232ddf=0x0;_0x232ddf<_0xe4445[_0xce98('0x4a')][_0xce98('0x73')][_0xce98('0x5c')];_0x232ddf+=0x1){socket[_0xce98('0xbd')](_0xce98('0xc1'),{'UserId':Number(_0xe4445['query']['ids'][_0x232ddf]),'OpenchannelAccountId':Number(_0xe4445[_0xce98('0x5b')]['id'])});}}else{socket['emit'](_0xce98('0xc1'),{'UserId':Number(_0xe4445[_0xce98('0x4a')][_0xce98('0x73')]),'OpenchannelAccountId':Number(_0xe4445[_0xce98('0x5b')]['id'])});}});}})[_0xce98('0x35')](respondWithStatusCode(_0x372799,null))[_0xce98('0x2a')](handleError(_0x372799,null));};exports[_0xce98('0xc2')]=function(_0x4dccdf,_0x141d6e,_0x4c7232){var _0x1ba7b9={};var _0xca4942={};var _0x4a35fd;var _0x5c4590;return db[_0xce98('0x3f')]['findOne']({'where':{'id':_0x4dccdf[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x141d6e,null))[_0xce98('0x35')](function(_0x5b97d4){if(_0x5b97d4){_0x4a35fd=_0x5b97d4;_0xca4942[_0xce98('0x44')]=_[_0xce98('0x46')](db[_0xce98('0xa0')][_0xce98('0x40')]);_0xca4942['query']=_[_0xce98('0x46')](_0x4dccdf[_0xce98('0x4a')]);_0xca4942['filters']=_['intersection'](_0xca4942[_0xce98('0x44')],_0xca4942[_0xce98('0x4a')]);_0x1ba7b9[_0xce98('0x4b')]=_[_0xce98('0x48')](_0xca4942[_0xce98('0x44')],qs[_0xce98('0x49')](_0x4dccdf['query']['fields']));_0x1ba7b9[_0xce98('0x4b')]=_0x1ba7b9[_0xce98('0x4b')][_0xce98('0x5c')]?_0x1ba7b9[_0xce98('0x4b')]:_0xca4942[_0xce98('0x44')];_0x1ba7b9[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x4f')]);_0x1ba7b9['where']=qs[_0xce98('0x47')](_['pick'](_0x4dccdf[_0xce98('0x4a')],_0xca4942[_0xce98('0x47')]));if(_0x4dccdf[_0xce98('0x4a')][_0xce98('0x52')]){_0x1ba7b9['where']=_[_0xce98('0x53')](_0x1ba7b9['where'],{'$or':_[_0xce98('0x45')](_0x1ba7b9[_0xce98('0x4b')],function(_0x48afd8){var _0x17c0df={};_0x17c0df[_0x48afd8]={'$like':'%'+_0x4dccdf[_0xce98('0x4a')]['filter']+'%'};return _0x17c0df;})});}_0x1ba7b9=_[_0xce98('0x53')]({},_0x1ba7b9,_0x4dccdf[_0xce98('0x55')]);return _0x4a35fd[_0xce98('0xc2')](_0x1ba7b9);}})[_0xce98('0x35')](function(_0x1da763){if(_0x1da763){_0x5c4590=_0x1da763['length'];if(!_0x4dccdf[_0xce98('0x4a')]['hasOwnProperty']('nolimit')){_0x1ba7b9[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1ba7b9['offset']=qs[_0xce98('0x30')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x30')]);}return _0x4a35fd[_0xce98('0xc2')](_0x1ba7b9);}})[_0xce98('0x35')](function(_0x10c6b1){if(_0x10c6b1){return _0x10c6b1?{'count':_0x5c4590,'rows':_0x10c6b1}:null;}})['then'](respondWithResult(_0x141d6e,null))[_0xce98('0x2a')](handleError(_0x141d6e,null));};exports[_0xce98('0xb2')]=function(_0x1595e9,_0x2058ee,_0x39b1f5){var _0x2d0320,_0x309a24,_0x145a85;if(_['isNil'](_0x1595e9[_0xce98('0x5f')]['body'])||_0x1595e9[_0xce98('0x5f')]['body']===''){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0xc3'));}if(_[_0xce98('0x80')](_0x1595e9[_0xce98('0x5f')]['to'])){}_0x2d0320=_0x1595e9[_0xce98('0x5f')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1595e9[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x5d8515){if(_0x5d8515){return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x5d8515['id']},'include':[{'model':db[_0xce98('0x83')],'as':_0xce98('0x84'),'include':[{'model':db[_0xce98('0x76')],'as':_0xce98('0x85'),'where':{[_0x5d8515[_0xce98('0x81')]]:_0x2d0320},'limit':0x1,'order':[[_0xce98('0x7b'),_0xce98('0x86')]]}]}]})[_0xce98('0x35')](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x571483){if(_0x571483&&_0x571483[_0xce98('0x84')]){_0x309a24=_0x571483[_0xce98('0x36')]({'plain':!![]});if(_0x309a24[_0xce98('0x84')]&&_0x309a24['List']['Contacts'][_0xce98('0x5c')]){return _0x309a24[_0xce98('0x84')]['Contacts'][0x0];}return db[_0xce98('0x76')][_0xce98('0x5e')](_[_0xce98('0x1b')](_0x1595e9['body'],{'firstName':_0x2d0320,[_0x571483[_0xce98('0x81')]]:_0x2d0320,'phone':_0x2d0320,'ListId':_0x309a24[_0xce98('0x8d')]}));}})[_0xce98('0x35')](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x7f98c){if(_0x7f98c){_0x145a85=_0x7f98c;return db[_0xce98('0x94')][_0xce98('0x5d')]({'where':{'ContactId':_0x145a85['id'],'closed':![],'OpenchannelAccountId':_0x309a24['id']}})[_0xce98('0x35')](function(_0x486d58){if(_0x486d58){return[_0x486d58,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id'],'OpenchannelAccountId':_0x309a24['id'],'lastMsgDirection':_0xce98('0xc4'),'firstMsgDirection':_0xce98('0xc4'),'Messages':[_[_0xce98('0x53')](_0x1595e9[_0xce98('0x5f')],{'read':![],'body':_0x1595e9[_0xce98('0x5f')][_0xce98('0x5f')],'OpenchannelAccountId':_0x309a24['id'],'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xce98('0xc5')}]})['then'](function(_0x49db6b){return[_0x49db6b,!![]];});});}})[_0xce98('0x95')](function(_0x5aad5b,_0x4fc9c7){if(_0x4fc9c7){return _0x5aad5b;}return db[_0xce98('0xc6')][_0xce98('0x5e')](_[_0xce98('0x53')](_0x1595e9['body'],{'read':![],'body':_0x1595e9[_0xce98('0x5f')]['body'],'OpenchannelAccountId':_0x309a24['id'],'OpenchannelInteractionId':_0x5aad5b['id'],'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id']}))[_0xce98('0x35')](function(_0xa14a8d){_0x5aad5b[_0xce98('0xc7')][_0xce98('0xc5')]=[];_0x5aad5b[_0xce98('0xc7')][_0xce98('0xc5')][_0xce98('0x9a')](_0xa14a8d[_0xce98('0xc7')]);return _0x5aad5b;});});}})['then'](respondWithResult(_0x2058ee,null))[_0xce98('0x2a')](handleError(_0x2058ee,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 479383b..70fa0c1 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['OpenchannelAccount','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_0xb821,0xa7));var _0x1b82=function(_0xb5d594,_0x3a3e65){_0xb5d594=_0xb5d594-0x0;var _0x20344e=_0xb821[_0xb5d594];return _0x20344e;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x1b82('0x0'))['db'][_0x1b82('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b82('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b1809){return function(_0x3b1d14,_0x1403ab,_0x3fadf0){OpenchannelAccountEvents[_0x1b82('0x3')](_0x4b1809+':'+_0x3b1d14['id'],_0x3b1d14);OpenchannelAccountEvents['emit'](_0x4b1809,_0x3b1d14);_0x3fadf0(null);};}for(var e in events){if(events[_0x1b82('0x4')](e)){var event=events[e];OpenchannelAccount[_0x1b82('0x5')](e,emitEvent(event));}}module[_0x1b82('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xda55=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda55,0x6d));var _0x5da5=function(_0x16f475,_0x22b4b4){_0x16f475=_0x16f475-0x0;var _0x53372e=_0xda55[_0x16f475];return _0x53372e;};'use strict';var EventEmitter=require(_0x5da5('0x0'));var OpenchannelAccount=require(_0x5da5('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5da5('0x2'),'afterUpdate':_0x5da5('0x3'),'afterDestroy':_0x5da5('0x4')};function emitEvent(_0x50cf9f){return function(_0x1c3afd,_0x5da254,_0x3400e9){OpenchannelAccountEvents['emit'](_0x50cf9f+':'+_0x1c3afd['id'],_0x1c3afd);OpenchannelAccountEvents[_0x5da5('0x5')](_0x50cf9f,_0x1c3afd);_0x3400e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x5da5('0x6')](e,emitEvent(event));}}module[_0x5da5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 898d31c..3618cc5 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(_0x5298a0,_0x3a6696){var _0x3b359e=function(_0x52ea75){while(--_0x52ea75){_0x5298a0['push'](_0x5298a0['shift']());}};_0x3b359e(++_0x3a6696);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x5765de,_0x4966f3){var _0x76fc79=function(_0x2687d0){while(--_0x2687d0){_0x5765de['push'](_0x5765de['shift']());}};_0x76fc79(++_0x4966f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 8172c21..49e4d6e 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 _0xa902=['client','http','redis','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x5d4cb5,_0x22025e){var _0x25561e=function(_0x4d792a){while(--_0x4d792a){_0x5d4cb5['push'](_0x5d4cb5['shift']());}};_0x25561e(++_0x22025e);}(_0xa902,0x8d));var _0x2a90=function(_0x520b59,_0x46ba85){_0x520b59=_0x520b59-0x0;var _0x4491dc=_0xa902[_0x520b59];return _0x4491dc;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});config[_0x2a90('0xb')]=_['defaults'](config[_0x2a90('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a90('0xb')]));require(_0x2a90('0xc'))[_0x2a90('0xd')](socket);function respondWithRpcPromise(_0x2b0a20,_0x18a60e,_0x56550f){return new BPromise(function(_0x361571,_0x3dadc2){return client[_0x2a90('0xe')](_0x2b0a20,_0x56550f)[_0x2a90('0xf')](function(_0x541e22){logger[_0x2a90('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x18a60e,_0x2a90('0x11'));logger['debug'](_0x2a90('0x12'),_0x18a60e,'request\x20sent',JSON[_0x2a90('0x13')](_0x541e22));if(_0x541e22[_0x2a90('0x14')]){if(_0x541e22[_0x2a90('0x14')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x3dadc2(_0x541e22['error'][_0x2a90('0x15')]);}logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x361571(_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);}else{logger[_0x2a90('0x10')](_0x2a90('0x16'),_0x18a60e,'request\x20sent');_0x361571(_0x541e22[_0x2a90('0x17')][_0x2a90('0x15')]);}})[_0x2a90('0x18')](function(_0x52622c){logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x52622c);_0x3dadc2(_0x52622c);});});} \ No newline at end of file +var _0x765e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x765e,0x131));var _0xe765=function(_0x28693e,_0xcdbedf){_0x28693e=_0x28693e-0x0;var _0x32b0bf=_0x765e[_0x28693e];return _0x32b0bf;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});config[_0xe765('0xe')]=_['defaults'](config[_0xe765('0xe')],{'host':_0xe765('0xf'),'port':0x18eb});var socket=require(_0xe765('0x10'))(new Redis(config[_0xe765('0xe')]));require(_0xe765('0x11'))[_0xe765('0x12')](socket);function respondWithRpcPromise(_0x89a285,_0x53b110,_0x42953c){return new BPromise(function(_0x37db1b,_0x31114a){return client['request'](_0x89a285,_0x42953c)[_0xe765('0x13')](function(_0x57edaf){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x53b110,_0xe765('0x14'));logger[_0xe765('0x15')](_0xe765('0x16'),_0x53b110,_0xe765('0x14'),JSON[_0xe765('0x17')](_0x57edaf));if(_0x57edaf['error']){if(_0x57edaf[_0xe765('0x18')][_0xe765('0x19')]===0x1f4){logger[_0xe765('0x18')](_0xe765('0x1a'),_0x53b110,_0x57edaf[_0xe765('0x18')]['message']);return _0x31114a(_0x57edaf['error'][_0xe765('0x1b')]);}logger[_0xe765('0x18')](_0xe765('0x1a'),_0x53b110,_0x57edaf['error'][_0xe765('0x1b')]);return _0x37db1b(_0x57edaf[_0xe765('0x18')][_0xe765('0x1b')]);}else{logger[_0xe765('0x1c')](_0xe765('0x1a'),_0x53b110,_0xe765('0x14'));_0x37db1b(_0x57edaf[_0xe765('0x1d')][_0xe765('0x1b')]);}})[_0xe765('0x1e')](function(_0x57fb61){logger[_0xe765('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x53b110,_0x57fb61);_0x31114a(_0x57fb61);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2ed4600..9751f70 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 _0xe706=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','emit','removeListener'];(function(_0x4ab4a2,_0x41b416){var _0x57f331=function(_0xa67444){while(--_0xa67444){_0x4ab4a2['push'](_0x4ab4a2['shift']());}};_0x57f331(++_0x41b416);}(_0xe706,0xa3));var _0x6e70=function(_0x3a1972,_0x194511){_0x3a1972=_0x3a1972-0x0;var _0xc7e0b5=_0xe706[_0x3a1972];return _0xc7e0b5;};'use strict';var OpenchannelAccountEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelAccountEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelAccountEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file +var _0xa37e=['openchannelAccount:','remove','update','emit','removeListener','register'];(function(_0x56fbd4,_0x2f6661){var _0x545ada=function(_0x527666){while(--_0x527666){_0x56fbd4['push'](_0x56fbd4['shift']());}};_0x545ada(++_0x2f6661);}(_0xa37e,0x97));var _0xea37=function(_0x43de36,_0x25147e){_0x43de36=_0x43de36-0x0;var _0x2c34fe=_0xa37e[_0x43de36];return _0x2c34fe;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xea37('0x0'),_0xea37('0x1')];function createListener(_0x204a22,_0x475c71){return function(_0x5430aa){_0x475c71[_0xea37('0x2')](_0x204a22,_0x5430aa);};}function removeListener(_0x537c5a,_0x360ed5){return function(){OpenchannelAccountEvents[_0xea37('0x3')](_0x537c5a,_0x360ed5);};}exports[_0xea37('0x4')]=function(_0x4d380b){for(var _0x57135b=0x0,_0x36c489=events['length'];_0x57135b<_0x36c489;_0x57135b++){var _0x4ae081=events[_0x57135b];var _0x2c2890=createListener(_0xea37('0x5')+_0x4ae081,_0x4d380b);OpenchannelAccountEvents['on'](_0x4ae081,_0x2c2890);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index dd8cbd3..472945d 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 _0xc066=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','create','put','/:id','destroy','exports','multer','util'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xc066,0x12a));var _0x6c06=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc066[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x6c06('0x0'));var util=require(_0x6c06('0x1'));var path=require(_0x6c06('0x2'));var timeout=require(_0x6c06('0x3'));var express=require(_0x6c06('0x4'));var router=express[_0x6c06('0x5')]();var fs_extra=require(_0x6c06('0x6'));var auth=require(_0x6c06('0x7'));var interaction=require(_0x6c06('0x8'));var config=require(_0x6c06('0x9'));var controller=require(_0x6c06('0xa'));router[_0x6c06('0xb')]('/',auth[_0x6c06('0xc')](),controller[_0x6c06('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6c06('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6c06('0xf')]);router[_0x6c06('0x10')](_0x6c06('0x11'),auth[_0x6c06('0xc')](),controller['update']);router['delete'](_0x6c06('0x11'),auth[_0x6c06('0xc')](),controller[_0x6c06('0x12')]);module[_0x6c06('0x13')]=router; \ No newline at end of file +var _0x5416=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create'];(function(_0x3b5a15,_0x13a661){var _0x119ee9=function(_0x476fde){while(--_0x476fde){_0x3b5a15['push'](_0x3b5a15['shift']());}};_0x119ee9(++_0x13a661);}(_0x5416,0x101));var _0x6541=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0x5416[_0x5e2b34];return _0x4859f9;};'use strict';var multer=require(_0x6541('0x0'));var util=require(_0x6541('0x1'));var path=require(_0x6541('0x2'));var timeout=require(_0x6541('0x3'));var express=require('express');var router=express[_0x6541('0x4')]();var fs_extra=require(_0x6541('0x5'));var auth=require(_0x6541('0x6'));var interaction=require(_0x6541('0x7'));var config=require('../../config/environment');var controller=require(_0x6541('0x8'));router[_0x6541('0x9')]('/',auth[_0x6541('0xa')](),controller[_0x6541('0xb')]);router['get']('/:id',auth[_0x6541('0xa')](),controller[_0x6541('0xc')]);router[_0x6541('0xd')]('/',auth[_0x6541('0xa')](),controller[_0x6541('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6541('0xf')]);router[_0x6541('0x10')]('/:id',auth[_0x6541('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9cb7ab1..8ad2182 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 _0xc64d=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x4a1d7e,_0xf9ec90){var _0x5ef508=function(_0x567e96){while(--_0x567e96){_0x4a1d7e['push'](_0x4a1d7e['shift']());}};_0x5ef508(++_0xf9ec90);}(_0xc64d,0x6f));var _0xdc64=function(_0x3b5d1b,_0x1e2707){_0x3b5d1b=_0x3b5d1b-0x0;var _0x26c2a4=_0xc64d[_0x3b5d1b];return _0x26c2a4;};'use strict';var Sequelize=require(_0xdc64('0x0'));module['exports']={'priority':{'type':Sequelize[_0xdc64('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdc64('0x2')],'allowNull':![],'defaultValue':_0xdc64('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xdc64('0x2')]},'interval':{'type':Sequelize[_0xdc64('0x2')],'defaultValue':_0xdc64('0x4')}}; \ No newline at end of file +var _0x13bf=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xaeb7b7,_0x5f3512){var _0x4b8a7e=function(_0x51bba5){while(--_0x51bba5){_0xaeb7b7['push'](_0xaeb7b7['shift']());}};_0x4b8a7e(++_0x5f3512);}(_0x13bf,0x1ae));var _0xf13b=function(_0x618bfb,_0x3ba7f0){_0x618bfb=_0x618bfb-0x0;var _0x39760c=_0x13bf[_0x618bfb];return _0x39760c;};'use strict';var Sequelize=require(_0xf13b('0x0'));module[_0xf13b('0x1')]={'priority':{'type':Sequelize[_0xf13b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf13b('0x3')],'allowNull':![],'defaultValue':_0xf13b('0x4')},'appdata':{'type':Sequelize[_0xf13b('0x5')]()},'description':{'type':Sequelize[_0xf13b('0x3')]},'interval':{'type':Sequelize[_0xf13b('0x3')],'defaultValue':_0xf13b('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index f799948..d663558 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 _0x0d72=['update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body'];(function(_0xf37274,_0x4fc7b1){var _0x49d199=function(_0x2ace04){while(--_0x2ace04){_0xf37274['push'](_0xf37274['shift']());}};_0x49d199(++_0x4fc7b1);}(_0x0d72,0x1ac));var _0x20d7=function(_0x399af3,_0x49100b){_0x399af3=_0x399af3-0x0;var _0x4cfdb4=_0x0d72[_0x399af3];return _0x4cfdb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20d7('0x0'));var zipdir=require(_0x20d7('0x1'));var jsonpatch=require(_0x20d7('0x2'));var rp=require(_0x20d7('0x3'));var moment=require(_0x20d7('0x4'));var BPromise=require(_0x20d7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x20d7('0x6'));var sox=require('sox');var csv=require(_0x20d7('0x7'));var ejs=require(_0x20d7('0x8'));var fs=require('fs');var fs_extra=require(_0x20d7('0x9'));var _=require(_0x20d7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x20d7('0xb'));var deskjs=require(_0x20d7('0xc'));var toCsv=require(_0x20d7('0x7'));var querystring=require(_0x20d7('0xd'));var Papa=require('papaparse');var Redis=require(_0x20d7('0xe'));var authService=require(_0x20d7('0xf'));var qs=require(_0x20d7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20d7('0x11'));var logger=require(_0x20d7('0x12'))(_0x20d7('0x13'));var utils=require('../../config/utils');var config=require(_0x20d7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bebb8,_0x184c50){_0x184c50=_0x184c50||0xcc;return function(_0x45ccdb){if(_0x45ccdb){return _0x1bebb8['sendStatus'](_0x184c50);}return _0x1bebb8[_0x20d7('0x15')](_0x184c50)['end']();};}function respondWithResult(_0x4fba4b,_0x506bdb){_0x506bdb=_0x506bdb||0xc8;return function(_0x3499a8){if(_0x3499a8){return _0x4fba4b['status'](_0x506bdb)['json'](_0x3499a8);}};}function respondWithFilteredResult(_0x11a829,_0x5cb968){return function(_0x1931eb){if(_0x1931eb){var _0x5061a5=typeof _0x5cb968['offset']===_0x20d7('0x16')&&typeof _0x5cb968[_0x20d7('0x17')]==='undefined';var _0x3e18ff=_0x1931eb[_0x20d7('0x18')];var _0x286215=_0x5061a5?0x0:_0x5cb968[_0x20d7('0x19')];var _0x1ee105=_0x5061a5?_0x1931eb[_0x20d7('0x18')]:_0x5cb968[_0x20d7('0x19')]+_0x5cb968['limit'];var _0x1c9170;if(_0x1ee105>=_0x3e18ff){_0x1ee105=_0x3e18ff;_0x1c9170=0xc8;}else{_0x1c9170=0xce;}_0x11a829[_0x20d7('0x15')](_0x1c9170);return _0x11a829['set'](_0x20d7('0x1a'),_0x286215+'-'+_0x1ee105+'/'+_0x3e18ff)[_0x20d7('0x1b')](_0x1931eb);}return null;};}function patchUpdates(_0x59ff90){return function(_0x2b573f){try{jsonpatch[_0x20d7('0x1c')](_0x2b573f,_0x59ff90,!![]);}catch(_0x16d97e){return BPromise[_0x20d7('0x1d')](_0x16d97e);}return _0x2b573f[_0x20d7('0x1e')]();};}function saveUpdates(_0x1ff1f9,_0xb81d0d){return function(_0x1dfe3a){if(_0x1dfe3a){return _0x1dfe3a['update'](_0x1ff1f9)[_0x20d7('0x1f')](function(_0x133fbe){return _0x133fbe;});}return null;};}function removeEntity(_0x3af1f9,_0x5b0a94){return function(_0x47bb53){if(_0x47bb53){return _0x47bb53['destroy']()['then'](function(){_0x3af1f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e76bd,_0x19671b){return function(_0x100195){if(!_0x100195){_0x2e76bd[_0x20d7('0x20')](0x194);}return _0x100195;};}function handleError(_0x31a6b5,_0xcdb01d){_0xcdb01d=_0xcdb01d||0x1f4;return function(_0x30ee8c){logger[_0x20d7('0x21')](_0x30ee8c[_0x20d7('0x22')]);if(_0x30ee8c[_0x20d7('0x23')]){delete _0x30ee8c['name'];}_0x31a6b5[_0x20d7('0x15')](_0xcdb01d)[_0x20d7('0x24')](_0x30ee8c);};}exports['index']=function(_0x1368e8,_0x217181){var _0x2eb5a1={},_0x246ab1={},_0x1fa4c3={'count':0x0,'rows':[]};var _0xc86b56=_[_0x20d7('0x25')](db[_0x20d7('0x26')][_0x20d7('0x27')],function(_0x1f8afa){return{'name':_0x1f8afa[_0x20d7('0x28')],'type':_0x1f8afa[_0x20d7('0x29')][_0x20d7('0x2a')]};});_0x246ab1[_0x20d7('0x2b')]=_[_0x20d7('0x25')](_0xc86b56,'name');_0x246ab1[_0x20d7('0x2c')]=_[_0x20d7('0x2d')](_0x1368e8[_0x20d7('0x2c')]);_0x246ab1[_0x20d7('0x2e')]=_[_0x20d7('0x2f')](_0x246ab1[_0x20d7('0x2b')],_0x246ab1[_0x20d7('0x2c')]);_0x2eb5a1[_0x20d7('0x30')]=_[_0x20d7('0x2f')](_0x246ab1[_0x20d7('0x2b')],qs[_0x20d7('0x31')](_0x1368e8[_0x20d7('0x2c')]['fields']));_0x2eb5a1[_0x20d7('0x30')]=_0x2eb5a1['attributes'][_0x20d7('0x32')]?_0x2eb5a1[_0x20d7('0x30')]:_0x246ab1['model'];if(!_0x1368e8[_0x20d7('0x2c')]['hasOwnProperty'](_0x20d7('0x33'))){_0x2eb5a1[_0x20d7('0x17')]=qs['limit'](_0x1368e8[_0x20d7('0x2c')][_0x20d7('0x17')]);_0x2eb5a1[_0x20d7('0x19')]=qs[_0x20d7('0x19')](_0x1368e8['query'][_0x20d7('0x19')]);}_0x2eb5a1[_0x20d7('0x34')]=qs[_0x20d7('0x35')](_0x1368e8[_0x20d7('0x2c')]['sort']);_0x2eb5a1[_0x20d7('0x36')]=qs[_0x20d7('0x2e')](_[_0x20d7('0x37')](_0x1368e8[_0x20d7('0x2c')],_0x246ab1[_0x20d7('0x2e')]),_0xc86b56);if(_0x1368e8[_0x20d7('0x2c')][_0x20d7('0x38')]){_0x2eb5a1[_0x20d7('0x36')]=_[_0x20d7('0x39')](_0x2eb5a1[_0x20d7('0x36')],{'$or':_[_0x20d7('0x25')](_0xc86b56,function(_0x240205){if(_0x240205['type']!=='VIRTUAL'){var _0x3fc289={};_0x3fc289[_0x240205['name']]={'$like':'%'+_0x1368e8['query'][_0x20d7('0x38')]+'%'};return _0x3fc289;}})});}_0x2eb5a1=_['merge']({},_0x2eb5a1,_0x1368e8[_0x20d7('0x3a')]);var _0x2eb6f9={'where':_0x2eb5a1[_0x20d7('0x36')]};return db['OpenchannelApplication'][_0x20d7('0x18')](_0x2eb6f9)[_0x20d7('0x1f')](function(_0x4bd7f7){_0x1fa4c3['count']=_0x4bd7f7;if(_0x1368e8[_0x20d7('0x2c')][_0x20d7('0x3b')]){_0x2eb5a1['include']=[{'all':!![]}];}return db[_0x20d7('0x26')][_0x20d7('0x3c')](_0x2eb5a1);})[_0x20d7('0x1f')](function(_0x2f7e84){_0x1fa4c3[_0x20d7('0x3d')]=_0x2f7e84;return _0x1fa4c3;})['then'](respondWithFilteredResult(_0x217181,_0x2eb5a1))[_0x20d7('0x3e')](handleError(_0x217181,null));};exports[_0x20d7('0x3f')]=function(_0xec060c,_0x386dc8){var _0x39b1d3={'raw':!![],'where':{'id':_0xec060c[_0x20d7('0x40')]['id']}},_0x5d5c31={};_0x5d5c31[_0x20d7('0x2b')]=_[_0x20d7('0x2d')](db[_0x20d7('0x26')][_0x20d7('0x27')]);_0x5d5c31[_0x20d7('0x2c')]=_[_0x20d7('0x2d')](_0xec060c[_0x20d7('0x2c')]);_0x5d5c31['filters']=_['intersection'](_0x5d5c31[_0x20d7('0x2b')],_0x5d5c31[_0x20d7('0x2c')]);_0x39b1d3['attributes']=_[_0x20d7('0x2f')](_0x5d5c31[_0x20d7('0x2b')],qs['fields'](_0xec060c[_0x20d7('0x2c')]['fields']));_0x39b1d3[_0x20d7('0x30')]=_0x39b1d3[_0x20d7('0x30')][_0x20d7('0x32')]?_0x39b1d3[_0x20d7('0x30')]:_0x5d5c31['model'];if(_0xec060c[_0x20d7('0x2c')][_0x20d7('0x3b')]){_0x39b1d3[_0x20d7('0x41')]=[{'all':!![]}];}_0x39b1d3=_[_0x20d7('0x39')]({},_0x39b1d3,_0xec060c[_0x20d7('0x3a')]);return db[_0x20d7('0x26')][_0x20d7('0x42')](_0x39b1d3)[_0x20d7('0x1f')](handleEntityNotFound(_0x386dc8,null))[_0x20d7('0x1f')](respondWithResult(_0x386dc8,null))['catch'](handleError(_0x386dc8,null));};exports['create']=function(_0x1260fb,_0xf57f11){return db['OpenchannelApplication'][_0x20d7('0x43')](_0x1260fb[_0x20d7('0x44')],{})[_0x20d7('0x1f')](respondWithResult(_0xf57f11,0xc9))[_0x20d7('0x3e')](handleError(_0xf57f11,null));};exports[_0x20d7('0x45')]=function(_0x547184,_0x278467){if(_0x547184[_0x20d7('0x44')]['id']){delete _0x547184['body']['id'];}return db[_0x20d7('0x26')][_0x20d7('0x42')]({'where':{'id':_0x547184[_0x20d7('0x40')]['id']}})[_0x20d7('0x1f')](handleEntityNotFound(_0x278467,null))[_0x20d7('0x1f')](saveUpdates(_0x547184[_0x20d7('0x44')],null))[_0x20d7('0x1f')](respondWithResult(_0x278467,null))[_0x20d7('0x3e')](handleError(_0x278467,null));};exports[_0x20d7('0x46')]=function(_0x2871f4,_0x426c0e){return db['OpenchannelApplication']['find']({'where':{'id':_0x2871f4['params']['id']}})[_0x20d7('0x1f')](handleEntityNotFound(_0x426c0e,null))[_0x20d7('0x1f')](removeEntity(_0x426c0e,null))[_0x20d7('0x3e')](handleError(_0x426c0e,null));}; \ No newline at end of file +var _0x39c7=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','intersection','find','create','body','params','catch','destroy','eml-format'];(function(_0x471268,_0x5ce885){var _0x1298f3=function(_0x3f5110){while(--_0x3f5110){_0x471268['push'](_0x471268['shift']());}};_0x1298f3(++_0x5ce885);}(_0x39c7,0xe9));var _0x739c=function(_0xbbb6ff,_0x5b9ef8){_0xbbb6ff=_0xbbb6ff-0x0;var _0x5eb766=_0x39c7[_0xbbb6ff];return _0x5eb766;};'use strict';var emlformat=require(_0x739c('0x0'));var rimraf=require(_0x739c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x739c('0x2'));var rp=require(_0x739c('0x3'));var moment=require(_0x739c('0x4'));var BPromise=require(_0x739c('0x5'));var Mustache=require(_0x739c('0x6'));var util=require(_0x739c('0x7'));var path=require(_0x739c('0x8'));var sox=require(_0x739c('0x9'));var csv=require(_0x739c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x739c('0xb'));var _=require(_0x739c('0xc'));var squel=require(_0x739c('0xd'));var crypto=require(_0x739c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x739c('0xf'));var toCsv=require(_0x739c('0xa'));var querystring=require(_0x739c('0x10'));var Papa=require(_0x739c('0x11'));var Redis=require(_0x739c('0x12'));var authService=require(_0x739c('0x13'));var qs=require(_0x739c('0x14'));var as=require(_0x739c('0x15'));var hardwareService=require(_0x739c('0x16'));var logger=require(_0x739c('0x17'))('api');var utils=require(_0x739c('0x18'));var config=require(_0x739c('0x19'));var licenseUtil=require(_0x739c('0x1a'));var db=require(_0x739c('0x1b'))['db'];function respondWithStatusCode(_0x3003cd,_0x51724d){_0x51724d=_0x51724d||0xcc;return function(_0x499004){if(_0x499004){return _0x3003cd[_0x739c('0x1c')](_0x51724d);}return _0x3003cd[_0x739c('0x1d')](_0x51724d)[_0x739c('0x1e')]();};}function respondWithResult(_0x1888f7,_0x39d609){_0x39d609=_0x39d609||0xc8;return function(_0x1ca9f6){if(_0x1ca9f6){return _0x1888f7['status'](_0x39d609)[_0x739c('0x1f')](_0x1ca9f6);}};}function respondWithFilteredResult(_0x5c4b42,_0x5dda4a){return function(_0x442bda){if(_0x442bda){var _0x19072b=typeof _0x5dda4a[_0x739c('0x20')]==='undefined'&&typeof _0x5dda4a[_0x739c('0x21')]===_0x739c('0x22');var _0x2276dc=_0x442bda[_0x739c('0x23')];var _0x54fef1=_0x19072b?0x0:_0x5dda4a[_0x739c('0x20')];var _0x278719=_0x19072b?_0x442bda[_0x739c('0x23')]:_0x5dda4a[_0x739c('0x20')]+_0x5dda4a[_0x739c('0x21')];var _0x3e8c34;if(_0x278719>=_0x2276dc){_0x278719=_0x2276dc;_0x3e8c34=0xc8;}else{_0x3e8c34=0xce;}_0x5c4b42[_0x739c('0x1d')](_0x3e8c34);return _0x5c4b42[_0x739c('0x24')](_0x739c('0x25'),_0x54fef1+'-'+_0x278719+'/'+_0x2276dc)[_0x739c('0x1f')](_0x442bda);}return null;};}function patchUpdates(_0x31d722){return function(_0x3487ac){try{jsonpatch[_0x739c('0x26')](_0x3487ac,_0x31d722,!![]);}catch(_0x340309){return BPromise[_0x739c('0x27')](_0x340309);}return _0x3487ac['save']();};}function saveUpdates(_0x11ad24,_0x1ecf78){return function(_0x10bb42){if(_0x10bb42){return _0x10bb42[_0x739c('0x28')](_0x11ad24)[_0x739c('0x29')](function(_0xfbb35e){return _0xfbb35e;});}return null;};}function removeEntity(_0x39ac42,_0x2e3916){return function(_0x2ca016){if(_0x2ca016){return _0x2ca016['destroy']()[_0x739c('0x29')](function(){_0x39ac42['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x767212,_0x44b78d){return function(_0x5274a9){if(!_0x5274a9){_0x767212['sendStatus'](0x194);}return _0x5274a9;};}function handleError(_0xc04d5b,_0x27bd35){_0x27bd35=_0x27bd35||0x1f4;return function(_0x21a701){logger['error'](_0x21a701[_0x739c('0x2a')]);if(_0x21a701[_0x739c('0x2b')]){delete _0x21a701['name'];}_0xc04d5b[_0x739c('0x1d')](_0x27bd35)[_0x739c('0x2c')](_0x21a701);};}exports[_0x739c('0x2d')]=function(_0x3c1615,_0x167d89){var _0x3aa6c4={},_0x555be6={},_0x414a21={'count':0x0,'rows':[]};var _0x1d2d60=_['map'](db[_0x739c('0x2e')][_0x739c('0x2f')],function(_0x1edbb1){return{'name':_0x1edbb1[_0x739c('0x30')],'type':_0x1edbb1[_0x739c('0x31')]['key']};});_0x555be6[_0x739c('0x32')]=_['map'](_0x1d2d60,'name');_0x555be6[_0x739c('0x33')]=_[_0x739c('0x34')](_0x3c1615[_0x739c('0x33')]);_0x555be6[_0x739c('0x35')]=_['intersection'](_0x555be6[_0x739c('0x32')],_0x555be6[_0x739c('0x33')]);_0x3aa6c4['attributes']=_['intersection'](_0x555be6[_0x739c('0x32')],qs['fields'](_0x3c1615[_0x739c('0x33')][_0x739c('0x36')]));_0x3aa6c4[_0x739c('0x37')]=_0x3aa6c4[_0x739c('0x37')][_0x739c('0x38')]?_0x3aa6c4[_0x739c('0x37')]:_0x555be6[_0x739c('0x32')];if(!_0x3c1615[_0x739c('0x33')][_0x739c('0x39')]('nolimit')){_0x3aa6c4[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x3c1615[_0x739c('0x33')]['limit']);_0x3aa6c4[_0x739c('0x20')]=qs['offset'](_0x3c1615[_0x739c('0x33')][_0x739c('0x20')]);}_0x3aa6c4[_0x739c('0x3a')]=qs[_0x739c('0x3b')](_0x3c1615[_0x739c('0x33')][_0x739c('0x3b')]);_0x3aa6c4[_0x739c('0x3c')]=qs[_0x739c('0x35')](_[_0x739c('0x3d')](_0x3c1615[_0x739c('0x33')],_0x555be6[_0x739c('0x35')]),_0x1d2d60);if(_0x3c1615[_0x739c('0x33')][_0x739c('0x3e')]){_0x3aa6c4[_0x739c('0x3c')]=_[_0x739c('0x3f')](_0x3aa6c4[_0x739c('0x3c')],{'$or':_[_0x739c('0x40')](_0x1d2d60,function(_0x4b4b77){if(_0x4b4b77[_0x739c('0x31')]!==_0x739c('0x41')){var _0x2d7846={};_0x2d7846[_0x4b4b77[_0x739c('0x2b')]]={'$like':'%'+_0x3c1615[_0x739c('0x33')][_0x739c('0x3e')]+'%'};return _0x2d7846;}})});}_0x3aa6c4=_[_0x739c('0x3f')]({},_0x3aa6c4,_0x3c1615[_0x739c('0x42')]);var _0x9b3e63={'where':_0x3aa6c4[_0x739c('0x3c')]};return db['OpenchannelApplication'][_0x739c('0x23')](_0x9b3e63)[_0x739c('0x29')](function(_0x377b02){_0x414a21['count']=_0x377b02;if(_0x3c1615[_0x739c('0x33')][_0x739c('0x43')]){_0x3aa6c4[_0x739c('0x44')]=[{'all':!![]}];}return db[_0x739c('0x2e')]['findAll'](_0x3aa6c4);})[_0x739c('0x29')](function(_0x1800a6){_0x414a21[_0x739c('0x45')]=_0x1800a6;return _0x414a21;})[_0x739c('0x29')](respondWithFilteredResult(_0x167d89,_0x3aa6c4))['catch'](handleError(_0x167d89,null));};exports[_0x739c('0x46')]=function(_0x3c946c,_0x1b08a7){var _0x169513={'raw':!![],'where':{'id':_0x3c946c['params']['id']}},_0x11e4c0={};_0x11e4c0[_0x739c('0x32')]=_[_0x739c('0x34')](db[_0x739c('0x2e')][_0x739c('0x2f')]);_0x11e4c0['query']=_[_0x739c('0x34')](_0x3c946c[_0x739c('0x33')]);_0x11e4c0[_0x739c('0x35')]=_[_0x739c('0x47')](_0x11e4c0[_0x739c('0x32')],_0x11e4c0[_0x739c('0x33')]);_0x169513[_0x739c('0x37')]=_[_0x739c('0x47')](_0x11e4c0[_0x739c('0x32')],qs[_0x739c('0x36')](_0x3c946c[_0x739c('0x33')][_0x739c('0x36')]));_0x169513[_0x739c('0x37')]=_0x169513[_0x739c('0x37')][_0x739c('0x38')]?_0x169513['attributes']:_0x11e4c0[_0x739c('0x32')];if(_0x3c946c[_0x739c('0x33')][_0x739c('0x43')]){_0x169513[_0x739c('0x44')]=[{'all':!![]}];}_0x169513=_[_0x739c('0x3f')]({},_0x169513,_0x3c946c['options']);return db[_0x739c('0x2e')][_0x739c('0x48')](_0x169513)[_0x739c('0x29')](handleEntityNotFound(_0x1b08a7,null))[_0x739c('0x29')](respondWithResult(_0x1b08a7,null))['catch'](handleError(_0x1b08a7,null));};exports[_0x739c('0x49')]=function(_0x5dfee8,_0x57a609){return db[_0x739c('0x2e')][_0x739c('0x49')](_0x5dfee8[_0x739c('0x4a')],{})[_0x739c('0x29')](respondWithResult(_0x57a609,0xc9))['catch'](handleError(_0x57a609,null));};exports[_0x739c('0x28')]=function(_0x43e9de,_0x3a276e){if(_0x43e9de[_0x739c('0x4a')]['id']){delete _0x43e9de[_0x739c('0x4a')]['id'];}return db[_0x739c('0x2e')]['find']({'where':{'id':_0x43e9de[_0x739c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a276e,null))[_0x739c('0x29')](saveUpdates(_0x43e9de[_0x739c('0x4a')],null))[_0x739c('0x29')](respondWithResult(_0x3a276e,null))[_0x739c('0x4c')](handleError(_0x3a276e,null));};exports[_0x739c('0x4d')]=function(_0x3c0656,_0x58e0ac){return db[_0x739c('0x2e')]['find']({'where':{'id':_0x3c0656[_0x739c('0x4b')]['id']}})[_0x739c('0x29')](handleEntityNotFound(_0x58e0ac,null))[_0x739c('0x29')](removeEntity(_0x58e0ac,null))[_0x739c('0x4c')](handleError(_0x58e0ac,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e1f5ecd..99cc09d 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 _0xbf46=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x1b4003,_0x3a009f){var _0x4762fc=function(_0x4939e5){while(--_0x4939e5){_0x1b4003['push'](_0x1b4003['shift']());}};_0x4762fc(++_0x3a009f);}(_0xbf46,0x1a4));var _0x6bf4=function(_0x1fa290,_0x2ff3e4){_0x1fa290=_0x1fa290-0x0;var _0x3cdd42=_0xbf46[_0x1fa290];return _0x3cdd42;};'use strict';var _=require('lodash');var util=require(_0x6bf4('0x0'));var logger=require(_0x6bf4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6bf4('0x2'));var rp=require(_0x6bf4('0x3'));var fs=require('fs');var path=require(_0x6bf4('0x4'));var rimraf=require(_0x6bf4('0x5'));var config=require(_0x6bf4('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x6bf4('0x7')]=function(_0x39613c,_0xef1967){return _0x39613c[_0x6bf4('0x8')](_0x6bf4('0x9'),attributes,{'tableName':_0x6bf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6bf4('0xb')});}; \ No newline at end of file +var _0xdb1f=['exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelApplication.attributes'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0xdb1f,0x70));var _0xfdb1=function(_0x27f6f1,_0x4b7b19){_0x27f6f1=_0x27f6f1-0x0;var _0x51fd31=_0xdb1f[_0x27f6f1];return _0x51fd31;};'use strict';var _=require(_0xfdb1('0x0'));var util=require(_0xfdb1('0x1'));var logger=require(_0xfdb1('0x2'))(_0xfdb1('0x3'));var moment=require(_0xfdb1('0x4'));var BPromise=require(_0xfdb1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfdb1('0x6'));var attributes=require(_0xfdb1('0x7'));module[_0xfdb1('0x8')]=function(_0x2a05e4,_0x5b91a3){return _0x2a05e4[_0xfdb1('0x9')](_0xfdb1('0xa'),attributes,{'tableName':_0xfdb1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 57865fc..7da3ff8 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 _0x35c1=['raw','where','attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options'];(function(_0x5acf1d,_0x17f4d3){var _0x380572=function(_0x887ebe){while(--_0x887ebe){_0x5acf1d['push'](_0x5acf1d['shift']());}};_0x380572(++_0x17f4d3);}(_0x35c1,0x7d));var _0x135c=function(_0x477f1a,_0x4999d3){_0x477f1a=_0x477f1a-0x0;var _0x1cf352=_0x35c1[_0x477f1a];return _0x1cf352;};'use strict';var _=require(_0x135c('0x0'));var util=require(_0x135c('0x1'));var moment=require('moment');var BPromise=require(_0x135c('0x2'));var rs=require(_0x135c('0x3'));var fs=require('fs');var Redis=require(_0x135c('0x4'));var db=require(_0x135c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x135c('0x6'));var config=require(_0x135c('0x7'));var jayson=require(_0x135c('0x8'));var client=jayson['client'][_0x135c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d5387,_0x560cec,_0x2565fb){return new BPromise(function(_0x4b03df,_0x259cd0){return client['request'](_0x5d5387,_0x2565fb)[_0x135c('0xa')](function(_0xcbb5eb){logger[_0x135c('0xb')](_0x135c('0xc'),_0x560cec,_0x135c('0xd'));logger['debug'](_0x135c('0xe'),_0x560cec,_0x135c('0xd'),JSON[_0x135c('0xf')](_0xcbb5eb));if(_0xcbb5eb[_0x135c('0x10')]){if(_0xcbb5eb[_0x135c('0x10')][_0x135c('0x11')]===0x1f4){logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0xcbb5eb['error'][_0x135c('0x12')]);return _0x259cd0(_0xcbb5eb[_0x135c('0x10')]['message']);}logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0xcbb5eb[_0x135c('0x10')]['message']);return _0x4b03df(_0xcbb5eb[_0x135c('0x10')]['message']);}else{logger[_0x135c('0xb')](_0x135c('0xc'),_0x560cec,_0x135c('0xd'));_0x4b03df(_0xcbb5eb['result']['message']);}})[_0x135c('0x13')](function(_0x2c962c){logger[_0x135c('0x10')](_0x135c('0xc'),_0x560cec,_0x2c962c);_0x259cd0(_0x2c962c);});});}exports[_0x135c('0x14')]=function(_0x152168){var _0x3e71e6=this;return new Promise(function(_0x12378a,_0xf59ec6){return db[_0x135c('0x15')][_0x135c('0x16')](_0x152168[_0x135c('0x17')],{'raw':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x1a')]||null:null,'attributes':_0x152168[_0x135c('0x18')]?_0x152168['options'][_0x135c('0x1b')]||null:null,'limit':_0x152168[_0x135c('0x18')]?_0x152168[_0x135c('0x18')][_0x135c('0x1c')]||null:null})[_0x135c('0xa')](function(_0x51e3b8){logger[_0x135c('0xb')](_0x135c('0x14'),_0x152168);logger[_0x135c('0x1d')](_0x135c('0x14'),_0x152168,JSON[_0x135c('0xf')](_0x51e3b8));_0x12378a(_0x51e3b8);})[_0x135c('0x13')](function(_0xaaa87b){logger[_0x135c('0x10')](_0x135c('0x14'),_0xaaa87b[_0x135c('0x12')],_0x152168);_0xf59ec6(_0x3e71e6[_0x135c('0x10')](0x1f4,_0xaaa87b[_0x135c('0x12')]));});});}; \ No newline at end of file +var _0xed0c=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x384ead,_0x296dec){var _0x50b15c=function(_0xdffd32){while(--_0xdffd32){_0x384ead['push'](_0x384ead['shift']());}};_0x50b15c(++_0x296dec);}(_0xed0c,0x175));var _0xced0=function(_0x4dd580,_0xadaefc){_0x4dd580=_0x4dd580-0x0;var _0x3380d1=_0xed0c[_0x4dd580];return _0x3380d1;};'use strict';var _=require(_0xced0('0x0'));var util=require(_0xced0('0x1'));var moment=require('moment');var BPromise=require(_0xced0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xced0('0x4'))(_0xced0('0x5'));var config=require(_0xced0('0x6'));var jayson=require(_0xced0('0x7'));var client=jayson[_0xced0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x597c1d,_0x3f465b,_0xc70968){return new BPromise(function(_0x41b888,_0x515caa){return client[_0xced0('0x9')](_0x597c1d,_0xc70968)[_0xced0('0xa')](function(_0x2b5220){logger[_0xced0('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x3f465b,_0xced0('0xc'));logger[_0xced0('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3f465b,_0xced0('0xc'),JSON[_0xced0('0xe')](_0x2b5220));if(_0x2b5220[_0xced0('0xf')]){if(_0x2b5220[_0xced0('0xf')]['code']===0x1f4){logger[_0xced0('0xf')](_0xced0('0x10'),_0x3f465b,_0x2b5220[_0xced0('0xf')]['message']);return _0x515caa(_0x2b5220['error']['message']);}logger['error'](_0xced0('0x10'),_0x3f465b,_0x2b5220[_0xced0('0xf')][_0xced0('0x11')]);return _0x41b888(_0x2b5220[_0xced0('0xf')][_0xced0('0x11')]);}else{logger['info'](_0xced0('0x10'),_0x3f465b,_0xced0('0xc'));_0x41b888(_0x2b5220['result'][_0xced0('0x11')]);}})[_0xced0('0x12')](function(_0x157fd2){logger[_0xced0('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x3f465b,_0x157fd2);_0x515caa(_0x157fd2);});});}exports[_0xced0('0x13')]=function(_0x32e468){var _0x1ab3aa=this;return new Promise(function(_0x4795ac,_0x15797f){return db[_0xced0('0x14')][_0xced0('0x15')](_0x32e468[_0xced0('0x16')],{'raw':_0x32e468[_0xced0('0x17')]?_0x32e468[_0xced0('0x17')][_0xced0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e468[_0xced0('0x17')]?_0x32e468[_0xced0('0x17')]['where']||null:null,'attributes':_0x32e468['options']?_0x32e468['options'][_0xced0('0x19')]||null:null,'limit':_0x32e468[_0xced0('0x17')]?_0x32e468[_0xced0('0x17')][_0xced0('0x1a')]||null:null})[_0xced0('0xa')](function(_0x23930e){logger[_0xced0('0xb')](_0xced0('0x13'),_0x32e468);logger['debug'](_0xced0('0x13'),_0x32e468,JSON[_0xced0('0xe')](_0x23930e));_0x4795ac(_0x23930e);})[_0xced0('0x12')](function(_0x545eaf){logger[_0xced0('0xf')]('UpdateOpenchannelApplication',_0x545eaf[_0xced0('0x11')],_0x32e468);_0x15797f(_0x1ab3aa['error'](0x1f4,_0x545eaf[_0xced0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 2cfc883..eb5f501 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 _0x3488=['Router','fs-extra','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','util','path','express'];(function(_0x190fb4,_0x39cb47){var _0x2245fd=function(_0x56d55a){while(--_0x56d55a){_0x190fb4['push'](_0x190fb4['shift']());}};_0x2245fd(++_0x39cb47);}(_0x3488,0xd6));var _0x8348=function(_0x2f6413,_0x9a71cc){_0x2f6413=_0x2f6413-0x0;var _0x2b03a5=_0x3488[_0x2f6413];return _0x2b03a5;};'use strict';var multer=require('multer');var util=require(_0x8348('0x0'));var path=require(_0x8348('0x1'));var timeout=require('connect-timeout');var express=require(_0x8348('0x2'));var router=express[_0x8348('0x3')]();var fs_extra=require(_0x8348('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8348('0x5'));var config=require('../../config/environment');var controller=require(_0x8348('0x6'));router[_0x8348('0x7')]('/',auth[_0x8348('0x8')](),controller[_0x8348('0x9')]);router[_0x8348('0x7')]('/describe',auth[_0x8348('0x8')](),controller[_0x8348('0xa')]);router['get'](_0x8348('0xb'),auth[_0x8348('0x8')](),controller[_0x8348('0xc')]);router['get'](_0x8348('0xd'),auth['isAuthenticated'](),controller[_0x8348('0xe')]);router[_0x8348('0x7')](_0x8348('0xf'),auth[_0x8348('0x8')](),controller['download']);router['post']('/',auth[_0x8348('0x8')](),controller[_0x8348('0x10')]);router[_0x8348('0x11')](_0x8348('0xd'),auth['isAuthenticated'](),controller[_0x8348('0x12')]);router[_0x8348('0x11')](_0x8348('0x13'),auth['isAuthenticated'](),interaction[_0x8348('0x14')]('openchannel',_0x8348('0x15')),controller[_0x8348('0x16')]);router[_0x8348('0x17')](_0x8348('0xb'),auth[_0x8348('0x8')](),interaction['tracked'](_0x8348('0x18'),_0x8348('0x19')),controller[_0x8348('0x1a')]);router[_0x8348('0x1b')](_0x8348('0xb'),auth[_0x8348('0x8')](),interaction[_0x8348('0x14')](_0x8348('0x18'),_0x8348('0x1c')),controller[_0x8348('0x1d')]);router[_0x8348('0x1b')](_0x8348('0x13'),auth[_0x8348('0x8')](),controller[_0x8348('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x32db=['/:id/messages','/:id/download','post','create','/:id/tags','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','tracked','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x122f4c,_0x2ff141){var _0x4d4c19=function(_0x8016e9){while(--_0x8016e9){_0x122f4c['push'](_0x122f4c['shift']());}};_0x4d4c19(++_0x2ff141);}(_0x32db,0x197));var _0xb32d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x32db[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xb32d('0x0'));var path=require(_0xb32d('0x1'));var timeout=require(_0xb32d('0x2'));var express=require('express');var router=express[_0xb32d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb32d('0x4'));var interaction=require(_0xb32d('0x5'));var config=require(_0xb32d('0x6'));var controller=require(_0xb32d('0x7'));router[_0xb32d('0x8')]('/',auth[_0xb32d('0x9')](),controller['index']);router[_0xb32d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xb32d('0xa')]);router[_0xb32d('0x8')](_0xb32d('0xb'),auth[_0xb32d('0x9')](),controller[_0xb32d('0xc')]);router[_0xb32d('0x8')](_0xb32d('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xb32d('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xb32d('0xf')]('/',auth[_0xb32d('0x9')](),controller[_0xb32d('0x10')]);router[_0xb32d('0xf')](_0xb32d('0xd'),auth[_0xb32d('0x9')](),controller['addMessage']);router['post'](_0xb32d('0x11'),auth[_0xb32d('0x9')](),interaction['tracked']('openchannel',_0xb32d('0x12')),controller[_0xb32d('0x13')]);router[_0xb32d('0x14')](_0xb32d('0xb'),auth[_0xb32d('0x9')](),interaction['tracked'](_0xb32d('0x15'),_0xb32d('0x16')),controller[_0xb32d('0x17')]);router[_0xb32d('0x18')](_0xb32d('0xb'),auth['isAuthenticated'](),interaction[_0xb32d('0x19')](_0xb32d('0x15'),_0xb32d('0x1a')),controller[_0xb32d('0x1b')]);router[_0xb32d('0x18')](_0xb32d('0x11'),auth[_0xb32d('0x9')](),controller[_0xb32d('0x1c')]);module[_0xb32d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d4ee04d..f5cfda1 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 _0x86f5=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x451659,_0xbe141d){var _0x5565ef=function(_0xcd388c){while(--_0xcd388c){_0x451659['push'](_0x451659['shift']());}};_0x5565ef(++_0xbe141d);}(_0x86f5,0x178));var _0x586f=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x86f5[_0x5c6244];return _0x5800ce;};'use strict';var Sequelize=require(_0x586f('0x0'));module['exports']={'closed':{'type':Sequelize[_0x586f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x586f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x586f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x586f('0x3')]},'note':{'type':Sequelize[_0x586f('0x3')]},'read1stAt':{'type':Sequelize[_0x586f('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x586f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x586f('0x4')]('in',_0x586f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x586f('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x586f('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x586f('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xaaf7=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x7daa20,_0x54639b){var _0x396bb3=function(_0x49ee54){while(--_0x49ee54){_0x7daa20['push'](_0x7daa20['shift']());}};_0x396bb3(++_0x54639b);}(_0xaaf7,0x79));var _0x7aaf=function(_0x221524,_0x5837e8){_0x221524=_0x221524-0x0;var _0x40e5e6=_0xaaf7[_0x221524];return _0x40e5e6;};'use strict';var Sequelize=require(_0x7aaf('0x0'));module[_0x7aaf('0x1')]={'closed':{'type':Sequelize[_0x7aaf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7aaf('0x3')]},'disposition':{'type':Sequelize[_0x7aaf('0x4')]},'secondDisposition':{'type':Sequelize[_0x7aaf('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7aaf('0x4')]},'read1stAt':{'type':Sequelize[_0x7aaf('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7aaf('0x4')]},'lastMsgAt':{'type':Sequelize[_0x7aaf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7aaf('0x5')]('in',_0x7aaf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7aaf('0x5')]('in',_0x7aaf('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7aaf('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x7aaf('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7aaf('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6a90562..a954622 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 _0xbf89=['rimraf','moment','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','error','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','query','user','catch','show','from','params','model','keys','filters','attributes','fields','length','include','options','find','create','body','describe','addMessage','ids','OpenchannelMessage','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','$gte','split','format','includeAll','findAll','rows','addTags','omit','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','attachments','transcript-%d-%s.zip','join','User','fullname','push','CmContact','Contact','Attachment','createdAt','read','OpenchannelAccount','get','mkdirSync','Openchannel','Account','Owner','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString','disposition','Private','Messages','existsSync','createReadStream','pipe','basename','direction','out','System','firstName','lastName','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file'];(function(_0x12eb0b,_0x1b7c44){var _0x801aa1=function(_0x6785e3){while(--_0x6785e3){_0x12eb0b['push'](_0x12eb0b['shift']());}};_0x801aa1(++_0x1b7c44);}(_0xbf89,0xfc));var _0x9bf8=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0xbf89[_0x3cec45];return _0x51d691;};'use strict';var rimraf=require(_0x9bf8('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9bf8('0x1'));var util=require('util');var path=require(_0x9bf8('0x2'));var ejs=require(_0x9bf8('0x3'));var fs=require('fs');var _=require(_0x9bf8('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x9bf8('0x5'));var pdf=require(_0x9bf8('0x6'));var logger=require(_0x9bf8('0x7'))(_0x9bf8('0x8'));var config=require(_0x9bf8('0x9'));var db=require(_0x9bf8('0xa'))['db'];config[_0x9bf8('0xb')]=_[_0x9bf8('0xc')](config[_0x9bf8('0xb')],{'host':_0x9bf8('0xd'),'port':0x18eb});var socket=require(_0x9bf8('0xe'))(new Redis(config[_0x9bf8('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3bd25f,_0x591d9d){_0x591d9d=_0x591d9d||0xcc;return function(_0x437372){if(_0x437372){return _0x3bd25f[_0x9bf8('0xf')](_0x591d9d);}return _0x3bd25f[_0x9bf8('0x10')](_0x591d9d)[_0x9bf8('0x11')]();};}function respondWithResult(_0x2ca1fe,_0x243650){_0x243650=_0x243650||0xc8;return function(_0x5c0ea9){if(_0x5c0ea9){return _0x2ca1fe[_0x9bf8('0x10')](_0x243650)['json'](_0x5c0ea9);}};}function respondWithFilteredResult(_0x5d7b40,_0x5d1ce3){return function(_0x43f95c){if(_0x43f95c){var _0x36b639=typeof _0x5d1ce3[_0x9bf8('0x12')]===_0x9bf8('0x13')&&typeof _0x5d1ce3[_0x9bf8('0x14')]===_0x9bf8('0x13');var _0x264fcd=_0x43f95c[_0x9bf8('0x15')];var _0x24d8a8=_0x36b639?0x0:_0x5d1ce3[_0x9bf8('0x12')];var _0x4eb5a4=_0x36b639?_0x43f95c[_0x9bf8('0x15')]:_0x5d1ce3[_0x9bf8('0x12')]+_0x5d1ce3[_0x9bf8('0x14')];var _0x14e9ac;if(_0x4eb5a4>=_0x264fcd){_0x4eb5a4=_0x264fcd;_0x14e9ac=0xc8;}else{_0x14e9ac=0xce;}_0x5d7b40[_0x9bf8('0x10')](_0x14e9ac);return _0x5d7b40[_0x9bf8('0x16')](_0x9bf8('0x17'),_0x24d8a8+'-'+_0x4eb5a4+'/'+_0x264fcd)[_0x9bf8('0x18')](_0x43f95c);}return null;};}function saveUpdates(_0x18d27d){return function(_0x3cad90){if(_0x3cad90){return _0x3cad90[_0x9bf8('0x19')](_0x18d27d)['then'](function(_0x4af3bb){return _0x4af3bb;});}return null;};}function removeEntity(_0x23dcd5){return function(_0x41b9df){if(_0x41b9df){return _0x41b9df[_0x9bf8('0x1a')]()[_0x9bf8('0x1b')](function(){_0x23dcd5['status'](0xcc)[_0x9bf8('0x11')]();});}};}function handleEntityNotFound(_0x5d17f4){return function(_0x1dc404){if(!_0x1dc404){_0x5d17f4[_0x9bf8('0xf')](0x194);}return _0x1dc404;};}function handleError(_0x5ca959,_0x4737b4){_0x4737b4=_0x4737b4||0x1f4;return function(_0x572401){logger[_0x9bf8('0x1c')](_0x572401['stack']);if(_0x572401['name']){delete _0x572401[_0x9bf8('0x1d')];}_0x5ca959['status'](_0x4737b4)[_0x9bf8('0x1e')](_0x572401);};}exports[_0x9bf8('0x1f')]=function(_0x40dece,_0x4f6e41){var _0x4a8e21={};var _0xc73487=_[_0x9bf8('0x20')](db[_0x9bf8('0x21')][_0x9bf8('0x22')],function(_0x3703bf){return{'name':_0x3703bf[_0x9bf8('0x23')],'type':_0x3703bf[_0x9bf8('0x24')][_0x9bf8('0x25')]};});_0x4a8e21=qs[_0x9bf8('0x26')](_0xc73487,_0x40dece);return interaction['findAll']('openchannel',_0x40dece[_0x9bf8('0x27')],_0x40dece[_0x9bf8('0x28')],_0x4a8e21,_0xc73487)[_0x9bf8('0x1b')](respondWithFilteredResult(_0x4f6e41,_0x4a8e21))[_0x9bf8('0x29')](handleError(_0x4f6e41,null));};exports[_0x9bf8('0x2a')]=function(_0x12f05f,_0x3aa99f){var _0x1532cf={};if(_0x12f05f['query'][_0x9bf8('0x24')]&&_0x12f05f[_0x9bf8('0x27')][_0x9bf8('0x24')]===_0x9bf8('0x2b')){_0x1532cf['from']=_0x12f05f[_0x9bf8('0x2c')]['id'];}else{_0x1532cf['id']=_0x12f05f[_0x9bf8('0x2c')]['id'];}var _0x3f5fb4={'raw':![],'where':_0x1532cf},_0x27c7cb={};_0x27c7cb[_0x9bf8('0x2d')]=_[_0x9bf8('0x2e')](db[_0x9bf8('0x21')][_0x9bf8('0x22')]);_0x27c7cb[_0x9bf8('0x27')]=_[_0x9bf8('0x2e')](_0x12f05f[_0x9bf8('0x27')]);_0x27c7cb[_0x9bf8('0x2f')]=_['intersection'](_0x27c7cb[_0x9bf8('0x2d')],_0x27c7cb['query']);_0x3f5fb4[_0x9bf8('0x30')]=_['intersection'](_0x27c7cb[_0x9bf8('0x2d')],qs[_0x9bf8('0x31')](_0x12f05f[_0x9bf8('0x27')][_0x9bf8('0x31')]));_0x3f5fb4[_0x9bf8('0x30')]=_0x3f5fb4[_0x9bf8('0x30')][_0x9bf8('0x32')]?_0x3f5fb4[_0x9bf8('0x30')]:_0x27c7cb[_0x9bf8('0x2d')];if(_0x12f05f['query']['includeAll']){_0x3f5fb4[_0x9bf8('0x33')]=[{'all':!![]}];}_0x3f5fb4=_['merge']({},_0x3f5fb4,_0x12f05f[_0x9bf8('0x34')]);return db[_0x9bf8('0x21')][_0x9bf8('0x35')](_0x3f5fb4)[_0x9bf8('0x1b')](handleEntityNotFound(_0x3aa99f,null))[_0x9bf8('0x1b')](respondWithResult(_0x3aa99f,null))[_0x9bf8('0x29')](handleError(_0x3aa99f,null));};exports[_0x9bf8('0x36')]=function(_0xbb451,_0xf4f791){return db['OpenchannelInteraction']['create'](_0xbb451[_0x9bf8('0x37')],{})[_0x9bf8('0x1b')](respondWithResult(_0xf4f791,0xc9))[_0x9bf8('0x29')](handleError(_0xf4f791,null));};exports[_0x9bf8('0x19')]=function(_0x5747cc,_0x339bbd){if(_0x5747cc[_0x9bf8('0x37')]['id']){delete _0x5747cc[_0x9bf8('0x37')]['id'];}return db[_0x9bf8('0x21')][_0x9bf8('0x35')]({'where':{'id':_0x5747cc[_0x9bf8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x339bbd,null))['then'](saveUpdates(_0x5747cc[_0x9bf8('0x37')],null))[_0x9bf8('0x1b')](respondWithResult(_0x339bbd,null))[_0x9bf8('0x29')](handleError(_0x339bbd,null));};exports['destroy']=function(_0x3cd163,_0x30b3ea){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3cd163[_0x9bf8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x30b3ea,null))[_0x9bf8('0x1b')](removeEntity(_0x30b3ea,null))[_0x9bf8('0x29')](handleError(_0x30b3ea,null));};exports[_0x9bf8('0x38')]=function(_0x1cc403,_0x2d4198){return db[_0x9bf8('0x21')]['describe']()['then'](respondWithResult(_0x2d4198,null))[_0x9bf8('0x29')](handleError(_0x2d4198,null));};exports[_0x9bf8('0x39')]=function(_0x1e5cb9,_0x59668d){return db['OpenchannelMessage'][_0x9bf8('0x35')]({'where':{'id':_0x1e5cb9[_0x9bf8('0x2c')]['id']}})[_0x9bf8('0x1b')](handleEntityNotFound(_0x59668d,null))[_0x9bf8('0x1b')](function(_0x1965e7){if(_0x1965e7){return _0x1965e7[_0x9bf8('0x39')](_0x1e5cb9[_0x9bf8('0x37')]['ids'],_['omit'](_0x1e5cb9[_0x9bf8('0x37')],[_0x9bf8('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x59668d,null))[_0x9bf8('0x29')](handleError(_0x59668d,null));};exports['getMessages']=function(_0x4fc18a,_0x4576db){var _0x183e8c={'raw':![],'where':{}};var _0x5b9975={};var _0x3d92dc={'count':0x0,'rows':[]};return db[_0x9bf8('0x21')]['findOne']({'where':{'id':_0x4fc18a[_0x9bf8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4576db,null))[_0x9bf8('0x1b')](function(_0x2ec63e){if(_0x2ec63e){_0x5b9975[_0x9bf8('0x2d')]=_[_0x9bf8('0x2e')](db[_0x9bf8('0x3b')][_0x9bf8('0x22')]);_0x5b9975[_0x9bf8('0x27')]=_[_0x9bf8('0x2e')](_0x4fc18a['query']);_0x5b9975[_0x9bf8('0x2f')]=_[_0x9bf8('0x3c')](_0x5b9975[_0x9bf8('0x2d')],_0x5b9975[_0x9bf8('0x27')]);_0x183e8c[_0x9bf8('0x30')]=_[_0x9bf8('0x3c')](_0x5b9975[_0x9bf8('0x2d')],qs[_0x9bf8('0x31')](_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x31')]));_0x183e8c['attributes']=_0x183e8c[_0x9bf8('0x30')][_0x9bf8('0x32')]?_0x183e8c['attributes']:_0x5b9975[_0x9bf8('0x2d')];if(!_0x4fc18a['query'][_0x9bf8('0x3d')](_0x9bf8('0x3e'))){_0x183e8c[_0x9bf8('0x14')]=qs[_0x9bf8('0x14')](_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x14')]);_0x183e8c[_0x9bf8('0x12')]=qs[_0x9bf8('0x12')](_0x4fc18a['query']['offset']);}_0x183e8c[_0x9bf8('0x3f')]=qs[_0x9bf8('0x40')](_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x40')]);_0x183e8c[_0x9bf8('0x41')]=qs[_0x9bf8('0x2f')](_[_0x9bf8('0x42')](_0x4fc18a['query'],_0x5b9975[_0x9bf8('0x2f')]));_0x183e8c['where']['OpenchannelInteractionId']=_0x2ec63e['id'];if(_0x4fc18a[_0x9bf8('0x27')]['filter']){_0x183e8c[_0x9bf8('0x41')]=_[_0x9bf8('0x43')](_0x183e8c['where'],{'$or':_['map'](_0x183e8c[_0x9bf8('0x30')],function(_0x4dabef){var _0x5b0667={};_0x5b0667[_0x4dabef]={'$like':'%'+_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x44')]+'%'};return _0x5b0667;})});}if(_0x4fc18a['query']['$gte']){var _0x33599f=_0x4fc18a[_0x9bf8('0x27')][_0x9bf8('0x45')][_0x9bf8('0x46')](',');var _0x616be={};_0x616be[_0x33599f[0x0]]={'$gte':moment(_0x33599f[0x1])[_0x9bf8('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x183e8c['where']=_['merge'](_0x183e8c[_0x9bf8('0x41')],_0x616be);}_0x183e8c=_[_0x9bf8('0x43')]({},_0x183e8c,_0x4fc18a[_0x9bf8('0x34')]);return db[_0x9bf8('0x3b')]['count']({'where':_0x183e8c[_0x9bf8('0x41')]})[_0x9bf8('0x1b')](function(_0x5bdf51){_0x3d92dc['count']=_0x5bdf51;if(_0x4fc18a['query'][_0x9bf8('0x48')]){_0x183e8c[_0x9bf8('0x33')]=[{'all':!![]}];}return db[_0x9bf8('0x3b')][_0x9bf8('0x49')](_0x183e8c);})[_0x9bf8('0x1b')](function(_0x3d536c){_0x3d92dc[_0x9bf8('0x4a')]=_0x3d536c;return _0x3d92dc;});}})[_0x9bf8('0x1b')](respondWithFilteredResult(_0x4576db,_0x183e8c))[_0x9bf8('0x29')](handleError(_0x4576db,null));};exports[_0x9bf8('0x4b')]=function(_0x2fd646,_0x7737a6){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2fd646[_0x9bf8('0x2c')]['id']}})[_0x9bf8('0x1b')](handleEntityNotFound(_0x7737a6,null))[_0x9bf8('0x1b')](function(_0x524656){if(_0x524656){return _0x524656['setTags'](_0x2fd646[_0x9bf8('0x37')][_0x9bf8('0x3a')],_[_0x9bf8('0x4c')](_0x2fd646[_0x9bf8('0x37')],[_0x9bf8('0x3a'),'id'])||{})[_0x9bf8('0x4d')](function(){return db['Tag'][_0x9bf8('0x49')]({'attributes':['id',_0x9bf8('0x1d'),_0x9bf8('0x4e')],'where':{'id':_0x2fd646[_0x9bf8('0x37')][_0x9bf8('0x3a')]}});})[_0x9bf8('0x1b')](function(_0x52af5f){socket[_0x9bf8('0x4f')](_0x9bf8('0x50'),{'id':Number(_0x2fd646['params']['id']),'tags':_0x52af5f||[]});return{'id':Number(_0x2fd646[_0x9bf8('0x2c')]['id']),'tags':_0x52af5f||[]};});}})[_0x9bf8('0x1b')](respondWithResult(_0x7737a6,null))['catch'](handleError(_0x7737a6,null));};exports['removeTags']=function(_0x174d2a,_0x37bbc3){return db[_0x9bf8('0x21')]['find']({'where':{'id':_0x174d2a[_0x9bf8('0x2c')]['id']}})[_0x9bf8('0x1b')](handleEntityNotFound(_0x37bbc3,null))[_0x9bf8('0x1b')](function(_0x5c6f94){if(_0x5c6f94){return _0x5c6f94[_0x9bf8('0x51')](_0x174d2a[_0x9bf8('0x27')][_0x9bf8('0x3a')]);}})['then'](respondWithStatusCode(_0x37bbc3,null))['catch'](handleError(_0x37bbc3,null));};exports[_0x9bf8('0x52')]=function(_0x30a230,_0x251b8f){var _0x42f8dc=moment()[_0x9bf8('0x53')]()['toString']();var _0x3945fb=path['join'](config[_0x9bf8('0x54')],_0x9bf8('0x55'),'files','tmp');var _0x266533=path['join'](config[_0x9bf8('0x54')],_0x9bf8('0x55'),'files',_0x9bf8('0x56'));var _0x14087e=path['join'](_0x3945fb,_0x42f8dc);var _0x373134=util[_0x9bf8('0x47')](_0x9bf8('0x57'),_0x30a230[_0x9bf8('0x2c')]['id'],_0x42f8dc);var _0x3082a9=path[_0x9bf8('0x58')](_0x3945fb,_0x373134);var _0x4102b0=[];_0x4102b0['push']({'model':db[_0x9bf8('0x59')],'as':_0x9bf8('0x59'),'attributes':['id',_0x9bf8('0x5a')],'raw':!![]});_0x4102b0[_0x9bf8('0x5b')]({'model':db[_0x9bf8('0x5c')],'as':_0x9bf8('0x5d'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x30a230['query']['attachments']){_0x4102b0[_0x9bf8('0x5b')]({'model':db[_0x9bf8('0x5e')],'as':_0x9bf8('0x5e'),'raw':!![]});}var _0x513527=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x9bf8('0x37'),_0x9bf8('0x5f'),'direction','secret',_0x9bf8('0x60')],'include':_0x4102b0}];_0x513527['push']({'model':db[_0x9bf8('0x61')],'as':'Account','attributes':['id',_0x9bf8('0x1d')]});_0x513527[_0x9bf8('0x5b')]({'model':db[_0x9bf8('0x59')],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction']['find']({'where':{'id':_0x30a230[_0x9bf8('0x2c')]['id']},'include':_0x513527})['then'](handleEntityNotFound(_0x251b8f,null))['then'](function(_0x2a0747){if(_0x2a0747){var _0x1293c5=_0x2a0747[_0x9bf8('0x62')]({'plain':!![]});fs[_0x9bf8('0x63')](_0x14087e);var _0x57f1bc={'channel':_0x9bf8('0x64'),'account':_0x1293c5[_0x9bf8('0x65')][_0x9bf8('0x1d')],'agent':_0x1293c5['Owner']?_0x1293c5[_0x9bf8('0x66')][_0x9bf8('0x5a')]:_0x9bf8('0x67'),'createdAt':moment(_0x1293c5['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1293c5[_0x9bf8('0x68')]?moment(_0x1293c5[_0x9bf8('0x69')])[_0x9bf8('0x47')](_0x9bf8('0x6a'))[_0x9bf8('0x6b')]():'','disposition':_0x1293c5[_0x9bf8('0x6c')],'visibility':_0x1293c5['threadId']?'Public':_0x9bf8('0x6d'),'messages':_(_0x1293c5[_0x9bf8('0x6e')])[_0x9bf8('0x44')]({'secret':![]})['map'](function(_0x3cf7ee){if(_0x3cf7ee['Attachment']){var _0x20aa9d=path[_0x9bf8('0x58')](_0x266533,_0x3cf7ee[_0x9bf8('0x5e')]['basename']);if(fs[_0x9bf8('0x6f')](_0x20aa9d)){fs[_0x9bf8('0x70')](_0x20aa9d)[_0x9bf8('0x71')](fs['createWriteStream'](path[_0x9bf8('0x58')](_0x14087e,_0x3cf7ee[_0x9bf8('0x5e')][_0x9bf8('0x72')])));}}return{'date':moment(_0x3cf7ee[_0x9bf8('0x5f')])[_0x9bf8('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9bf8('0x6b')](),'sender':_0x3cf7ee[_0x9bf8('0x73')]===_0x9bf8('0x74')?_0x3cf7ee['User']?_0x3cf7ee[_0x9bf8('0x59')][_0x9bf8('0x5a')]:_0x9bf8('0x75'):_0x3cf7ee[_0x9bf8('0x5d')][_0x9bf8('0x76')]+(_0x3cf7ee['Contact'][_0x9bf8('0x77')]?'\x20'+_0x3cf7ee[_0x9bf8('0x5d')][_0x9bf8('0x77')]:''),'body':_0x3cf7ee['Attachment']?_0x3cf7ee[_0x9bf8('0x5e')][_0x9bf8('0x72')]:_0x3cf7ee[_0x9bf8('0x37')],'direction':_0x3cf7ee[_0x9bf8('0x73')]==='out'?'A':'C','secret':_0x3cf7ee['secret'],'read':_0x3cf7ee['read'],'attachment':_0x3cf7ee['Attachment']};})[_0x9bf8('0x78')]()};return ejs['renderFile'](path['join'](config[_0x9bf8('0x54')],_0x9bf8('0x55'),_0x9bf8('0x79'),_0x9bf8('0x7a')),{'interaction':_0x57f1bc})[_0x9bf8('0x1b')](function(_0x3a516d){var _0x588731=path[_0x9bf8('0x58')](_0x14087e,_0x9bf8('0x7b')+_0x1293c5['id']+'-'+_0x42f8dc+'.pdf');var _0x53ad0e={'path':_0x588731,'channel':_0x9bf8('0x64'),'interactionId':_0x1293c5['id']};return pdf[_0x9bf8('0x7c')](_0x3a516d,_0x53ad0e);})[_0x9bf8('0x1b')](function(){return new Promise(function(_0x1cc3e6,_0x547ec6){zipdir(_0x14087e,{'saveTo':_0x3082a9},function(_0x4e2ee8,_0xdda4aa){if(_0x4e2ee8)return _0x547ec6(_0x4e2ee8);return _0x1cc3e6(_0xdda4aa);});})[_0x9bf8('0x1b')](function(){return new Promise(function(_0x411982,_0x3bdbed){rimraf(_0x14087e,function(_0x304d67){if(_0x304d67)_0x3bdbed(_0x304d67);return _0x411982();});});})[_0x9bf8('0x1b')](function(){return _0x251b8f[_0x9bf8('0x52')](_0x3082a9,_0x373134,function(_0x63a019){if(_0x63a019){logger[_0x9bf8('0x1c')](_0x9bf8('0x7d'),_0x63a019);}else{fs['unlinkSync'](_0x3082a9);}});});});}else{return _0x251b8f[_0x9bf8('0xf')](0xc8);}})[_0x9bf8('0x29')](handleError(_0x251b8f,null));}; \ No newline at end of file +var _0x0a41=['OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','spread','Tag','color','emit','download','toString','join','root','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','System','lastName','secret','read','renderFile','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','update','destroy','then','error','stack','name','index','OpenchannelInteraction','rawAttributes','type','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage'];(function(_0x2f379a,_0x53382d){var _0x305249=function(_0x318d5f){while(--_0x318d5f){_0x2f379a['push'](_0x2f379a['shift']());}};_0x305249(++_0x53382d);}(_0x0a41,0x1b8));var _0x10a4=function(_0x53f740,_0x1c689c){_0x53f740=_0x53f740-0x0;var _0x50636a=_0x0a41[_0x53f740];return _0x50636a;};'use strict';var rimraf=require(_0x10a4('0x0'));var zipdir=require(_0x10a4('0x1'));var moment=require(_0x10a4('0x2'));var util=require('util');var path=require(_0x10a4('0x3'));var ejs=require(_0x10a4('0x4'));var fs=require('fs');var _=require(_0x10a4('0x5'));var Redis=require(_0x10a4('0x6'));var interaction=require(_0x10a4('0x7'));var qs=require(_0x10a4('0x8'));var pdf=require(_0x10a4('0x9'));var logger=require(_0x10a4('0xa'))(_0x10a4('0xb'));var config=require(_0x10a4('0xc'));var db=require(_0x10a4('0xd'))['db'];config[_0x10a4('0xe')]=_[_0x10a4('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x10a4('0x10')](socket);function respondWithStatusCode(_0x2d91e6,_0x359035){_0x359035=_0x359035||0xcc;return function(_0x9bde84){if(_0x9bde84){return _0x2d91e6[_0x10a4('0x11')](_0x359035);}return _0x2d91e6['status'](_0x359035)[_0x10a4('0x12')]();};}function respondWithResult(_0x55d855,_0x5f7df3){_0x5f7df3=_0x5f7df3||0xc8;return function(_0x747841){if(_0x747841){return _0x55d855[_0x10a4('0x13')](_0x5f7df3)[_0x10a4('0x14')](_0x747841);}};}function respondWithFilteredResult(_0x348951,_0x104ee8){return function(_0xbeeca3){if(_0xbeeca3){var _0x2ac96f=typeof _0x104ee8['offset']===_0x10a4('0x15')&&typeof _0x104ee8[_0x10a4('0x16')]==='undefined';var _0xa951ff=_0xbeeca3[_0x10a4('0x17')];var _0x3777fa=_0x2ac96f?0x0:_0x104ee8[_0x10a4('0x18')];var _0x29c089=_0x2ac96f?_0xbeeca3[_0x10a4('0x17')]:_0x104ee8[_0x10a4('0x18')]+_0x104ee8[_0x10a4('0x16')];var _0xd5b0;if(_0x29c089>=_0xa951ff){_0x29c089=_0xa951ff;_0xd5b0=0xc8;}else{_0xd5b0=0xce;}_0x348951['status'](_0xd5b0);return _0x348951['set'](_0x10a4('0x19'),_0x3777fa+'-'+_0x29c089+'/'+_0xa951ff)[_0x10a4('0x14')](_0xbeeca3);}return null;};}function saveUpdates(_0x2fb95e){return function(_0x4e28dc){if(_0x4e28dc){return _0x4e28dc[_0x10a4('0x1a')](_0x2fb95e)['then'](function(_0x482dc6){return _0x482dc6;});}return null;};}function removeEntity(_0x4a85fb){return function(_0x22729b){if(_0x22729b){return _0x22729b[_0x10a4('0x1b')]()[_0x10a4('0x1c')](function(){_0x4a85fb[_0x10a4('0x13')](0xcc)[_0x10a4('0x12')]();});}};}function handleEntityNotFound(_0x3b1c8f){return function(_0x2c5e90){if(!_0x2c5e90){_0x3b1c8f[_0x10a4('0x11')](0x194);}return _0x2c5e90;};}function handleError(_0x30c253,_0x3f04dc){_0x3f04dc=_0x3f04dc||0x1f4;return function(_0x43656e){logger[_0x10a4('0x1d')](_0x43656e[_0x10a4('0x1e')]);if(_0x43656e[_0x10a4('0x1f')]){delete _0x43656e[_0x10a4('0x1f')];}_0x30c253[_0x10a4('0x13')](_0x3f04dc)['send'](_0x43656e);};}exports[_0x10a4('0x20')]=function(_0x4d7a47,_0xb702b){var _0x4b5879={};var _0x36dbc2=_['map'](db[_0x10a4('0x21')][_0x10a4('0x22')],function(_0x1eeafc){return{'name':_0x1eeafc['fieldName'],'type':_0x1eeafc[_0x10a4('0x23')]['key']};});_0x4b5879=qs[_0x10a4('0x24')](_0x36dbc2,_0x4d7a47);return interaction[_0x10a4('0x25')](_0x10a4('0x26'),_0x4d7a47[_0x10a4('0x27')],_0x4d7a47[_0x10a4('0x28')],_0x4b5879,_0x36dbc2)[_0x10a4('0x1c')](respondWithFilteredResult(_0xb702b,_0x4b5879))[_0x10a4('0x29')](handleError(_0xb702b,null));};exports[_0x10a4('0x2a')]=function(_0x37fe05,_0x3aee03){var _0x40bf93={};if(_0x37fe05[_0x10a4('0x27')][_0x10a4('0x23')]&&_0x37fe05[_0x10a4('0x27')][_0x10a4('0x23')]===_0x10a4('0x2b')){_0x40bf93[_0x10a4('0x2b')]=_0x37fe05[_0x10a4('0x2c')]['id'];}else{_0x40bf93['id']=_0x37fe05['params']['id'];}var _0xef1c94={'raw':![],'where':_0x40bf93},_0x544fa7={};_0x544fa7[_0x10a4('0x2d')]=_[_0x10a4('0x2e')](db['OpenchannelInteraction'][_0x10a4('0x22')]);_0x544fa7[_0x10a4('0x27')]=_[_0x10a4('0x2e')](_0x37fe05['query']);_0x544fa7[_0x10a4('0x2f')]=_[_0x10a4('0x30')](_0x544fa7[_0x10a4('0x2d')],_0x544fa7[_0x10a4('0x27')]);_0xef1c94[_0x10a4('0x31')]=_[_0x10a4('0x30')](_0x544fa7[_0x10a4('0x2d')],qs[_0x10a4('0x32')](_0x37fe05['query'][_0x10a4('0x32')]));_0xef1c94[_0x10a4('0x31')]=_0xef1c94[_0x10a4('0x31')][_0x10a4('0x33')]?_0xef1c94[_0x10a4('0x31')]:_0x544fa7['model'];if(_0x37fe05[_0x10a4('0x27')]['includeAll']){_0xef1c94[_0x10a4('0x34')]=[{'all':!![]}];}_0xef1c94=_[_0x10a4('0x35')]({},_0xef1c94,_0x37fe05[_0x10a4('0x36')]);return db[_0x10a4('0x21')][_0x10a4('0x37')](_0xef1c94)['then'](handleEntityNotFound(_0x3aee03,null))[_0x10a4('0x1c')](respondWithResult(_0x3aee03,null))['catch'](handleError(_0x3aee03,null));};exports[_0x10a4('0x38')]=function(_0x5ef74b,_0x3573fc){return db['OpenchannelInteraction'][_0x10a4('0x38')](_0x5ef74b['body'],{})[_0x10a4('0x1c')](respondWithResult(_0x3573fc,0xc9))['catch'](handleError(_0x3573fc,null));};exports['update']=function(_0x580d17,_0xb52b97){if(_0x580d17[_0x10a4('0x39')]['id']){delete _0x580d17[_0x10a4('0x39')]['id'];}return db['OpenchannelInteraction'][_0x10a4('0x37')]({'where':{'id':_0x580d17['params']['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0xb52b97,null))[_0x10a4('0x1c')](saveUpdates(_0x580d17['body'],null))[_0x10a4('0x1c')](respondWithResult(_0xb52b97,null))[_0x10a4('0x29')](handleError(_0xb52b97,null));};exports[_0x10a4('0x1b')]=function(_0x1f23d8,_0x296262){return db[_0x10a4('0x21')][_0x10a4('0x37')]({'where':{'id':_0x1f23d8[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0x296262,null))[_0x10a4('0x1c')](removeEntity(_0x296262,null))[_0x10a4('0x29')](handleError(_0x296262,null));};exports[_0x10a4('0x3a')]=function(_0x84b940,_0x5a3628){return db['OpenchannelInteraction']['describe']()[_0x10a4('0x1c')](respondWithResult(_0x5a3628,null))[_0x10a4('0x29')](handleError(_0x5a3628,null));};exports[_0x10a4('0x3b')]=function(_0x152f94,_0x1d7300){return db[_0x10a4('0x3c')]['find']({'where':{'id':_0x152f94[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0x1d7300,null))['then'](function(_0x267c09){if(_0x267c09){return _0x267c09[_0x10a4('0x3b')](_0x152f94[_0x10a4('0x39')][_0x10a4('0x3d')],_[_0x10a4('0x3e')](_0x152f94[_0x10a4('0x39')],[_0x10a4('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x1d7300,null))['catch'](handleError(_0x1d7300,null));};exports[_0x10a4('0x3f')]=function(_0x90ab0a,_0x18f510){var _0xca7ea2={'raw':![],'where':{}};var _0x4b776f={};var _0x411d8f={'count':0x0,'rows':[]};return db[_0x10a4('0x21')][_0x10a4('0x40')]({'where':{'id':_0x90ab0a[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0x18f510,null))[_0x10a4('0x1c')](function(_0x3eddcb){if(_0x3eddcb){_0x4b776f[_0x10a4('0x2d')]=_[_0x10a4('0x2e')](db[_0x10a4('0x3c')]['rawAttributes']);_0x4b776f[_0x10a4('0x27')]=_[_0x10a4('0x2e')](_0x90ab0a[_0x10a4('0x27')]);_0x4b776f[_0x10a4('0x2f')]=_[_0x10a4('0x30')](_0x4b776f['model'],_0x4b776f[_0x10a4('0x27')]);_0xca7ea2[_0x10a4('0x31')]=_['intersection'](_0x4b776f[_0x10a4('0x2d')],qs[_0x10a4('0x32')](_0x90ab0a['query']['fields']));_0xca7ea2[_0x10a4('0x31')]=_0xca7ea2[_0x10a4('0x31')][_0x10a4('0x33')]?_0xca7ea2[_0x10a4('0x31')]:_0x4b776f['model'];if(!_0x90ab0a[_0x10a4('0x27')]['hasOwnProperty'](_0x10a4('0x41'))){_0xca7ea2[_0x10a4('0x16')]=qs['limit'](_0x90ab0a['query'][_0x10a4('0x16')]);_0xca7ea2['offset']=qs['offset'](_0x90ab0a['query']['offset']);}_0xca7ea2[_0x10a4('0x42')]=qs[_0x10a4('0x43')](_0x90ab0a[_0x10a4('0x27')][_0x10a4('0x43')]);_0xca7ea2[_0x10a4('0x44')]=qs[_0x10a4('0x2f')](_['pick'](_0x90ab0a[_0x10a4('0x27')],_0x4b776f[_0x10a4('0x2f')]));_0xca7ea2[_0x10a4('0x44')]['OpenchannelInteractionId']=_0x3eddcb['id'];if(_0x90ab0a[_0x10a4('0x27')][_0x10a4('0x45')]){_0xca7ea2['where']=_[_0x10a4('0x35')](_0xca7ea2[_0x10a4('0x44')],{'$or':_[_0x10a4('0x46')](_0xca7ea2[_0x10a4('0x31')],function(_0x8fee0){var _0x41b743={};_0x41b743[_0x8fee0]={'$like':'%'+_0x90ab0a[_0x10a4('0x27')][_0x10a4('0x45')]+'%'};return _0x41b743;})});}if(_0x90ab0a[_0x10a4('0x27')][_0x10a4('0x47')]){var _0x4c90dd=_0x90ab0a['query'][_0x10a4('0x47')][_0x10a4('0x48')](',');var _0x48b56b={};_0x48b56b[_0x4c90dd[0x0]]={'$gte':moment(_0x4c90dd[0x1])[_0x10a4('0x49')](_0x10a4('0x4a'))};_0xca7ea2['where']=_['merge'](_0xca7ea2[_0x10a4('0x44')],_0x48b56b);}_0xca7ea2=_[_0x10a4('0x35')]({},_0xca7ea2,_0x90ab0a[_0x10a4('0x36')]);return db[_0x10a4('0x3c')]['count']({'where':_0xca7ea2[_0x10a4('0x44')]})[_0x10a4('0x1c')](function(_0x181d8b){_0x411d8f['count']=_0x181d8b;if(_0x90ab0a['query'][_0x10a4('0x4b')]){_0xca7ea2[_0x10a4('0x34')]=[{'all':!![]}];}return db[_0x10a4('0x3c')]['findAll'](_0xca7ea2);})['then'](function(_0x545f32){_0x411d8f['rows']=_0x545f32;return _0x411d8f;});}})[_0x10a4('0x1c')](respondWithFilteredResult(_0x18f510,_0xca7ea2))[_0x10a4('0x29')](handleError(_0x18f510,null));};exports['addTags']=function(_0x255d56,_0xbf1007){return db['OpenchannelInteraction'][_0x10a4('0x37')]({'where':{'id':_0x255d56[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0xbf1007,null))['then'](function(_0x2930cd){if(_0x2930cd){return _0x2930cd['setTags'](_0x255d56['body'][_0x10a4('0x3d')],_[_0x10a4('0x3e')](_0x255d56[_0x10a4('0x39')],[_0x10a4('0x3d'),'id'])||{})[_0x10a4('0x4c')](function(){return db[_0x10a4('0x4d')]['findAll']({'attributes':['id','name',_0x10a4('0x4e')],'where':{'id':_0x255d56[_0x10a4('0x39')][_0x10a4('0x3d')]}});})[_0x10a4('0x1c')](function(_0x17a359){socket[_0x10a4('0x4f')]('openchannelInteractionTags:save',{'id':Number(_0x255d56[_0x10a4('0x2c')]['id']),'tags':_0x17a359||[]});return{'id':Number(_0x255d56[_0x10a4('0x2c')]['id']),'tags':_0x17a359||[]};});}})[_0x10a4('0x1c')](respondWithResult(_0xbf1007,null))[_0x10a4('0x29')](handleError(_0xbf1007,null));};exports['removeTags']=function(_0x489264,_0x33b10e){return db[_0x10a4('0x21')][_0x10a4('0x37')]({'where':{'id':_0x489264[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0x33b10e,null))[_0x10a4('0x1c')](function(_0x4530cc){if(_0x4530cc){return _0x4530cc['removeTags'](_0x489264[_0x10a4('0x27')][_0x10a4('0x3d')]);}})[_0x10a4('0x1c')](respondWithStatusCode(_0x33b10e,null))[_0x10a4('0x29')](handleError(_0x33b10e,null));};exports[_0x10a4('0x50')]=function(_0x26ef8b,_0xa05143){var _0x50d910=moment()['unix']()[_0x10a4('0x51')]();var _0x17b0d1=path[_0x10a4('0x52')](config[_0x10a4('0x53')],'server',_0x10a4('0x54'),_0x10a4('0x55'));var _0x2c7312=path[_0x10a4('0x52')](config[_0x10a4('0x53')],'server',_0x10a4('0x54'),_0x10a4('0x56'));var _0x5bb3a3=path['join'](_0x17b0d1,_0x50d910);var _0x514050=util[_0x10a4('0x49')](_0x10a4('0x57'),_0x26ef8b[_0x10a4('0x2c')]['id'],_0x50d910);var _0x4ef705=path[_0x10a4('0x52')](_0x17b0d1,_0x514050);var _0x5e6754=[];_0x5e6754['push']({'model':db[_0x10a4('0x58')],'as':_0x10a4('0x58'),'attributes':['id',_0x10a4('0x59')],'raw':!![]});_0x5e6754[_0x10a4('0x5a')]({'model':db['CmContact'],'as':_0x10a4('0x5b'),'attributes':['id',_0x10a4('0x5c'),'lastName'],'raw':!![]});if(_0x26ef8b[_0x10a4('0x27')]['attachments']){_0x5e6754[_0x10a4('0x5a')]({'model':db[_0x10a4('0x5d')],'as':_0x10a4('0x5d'),'raw':!![]});}var _0xb09804=[{'model':db[_0x10a4('0x3c')],'as':_0x10a4('0x5e'),'attributes':['id','body',_0x10a4('0x5f'),_0x10a4('0x60'),'secret','read'],'include':_0x5e6754}];_0xb09804['push']({'model':db[_0x10a4('0x61')],'as':_0x10a4('0x62'),'attributes':['id','name']});_0xb09804[_0x10a4('0x5a')]({'model':db[_0x10a4('0x58')],'as':'Owner','attributes':['id','fullname']});return db[_0x10a4('0x21')]['find']({'where':{'id':_0x26ef8b[_0x10a4('0x2c')]['id']},'include':_0xb09804})[_0x10a4('0x1c')](handleEntityNotFound(_0xa05143,null))['then'](function(_0x446ad9){if(_0x446ad9){var _0x9cd77f=_0x446ad9['get']({'plain':!![]});fs[_0x10a4('0x63')](_0x5bb3a3);var _0x45e0bd={'channel':_0x10a4('0x64'),'account':_0x9cd77f[_0x10a4('0x62')][_0x10a4('0x1f')],'agent':_0x9cd77f[_0x10a4('0x65')]?_0x9cd77f['Owner']['fullname']:_0x10a4('0x66'),'createdAt':moment(_0x9cd77f['createdAt'])['format'](_0x10a4('0x4a'))[_0x10a4('0x51')](),'closedAt':_0x9cd77f[_0x10a4('0x67')]?moment(_0x9cd77f[_0x10a4('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x10a4('0x51')]():'','disposition':_0x9cd77f[_0x10a4('0x69')],'visibility':_0x9cd77f[_0x10a4('0x6a')]?_0x10a4('0x6b'):_0x10a4('0x6c'),'messages':_(_0x9cd77f[_0x10a4('0x5e')])[_0x10a4('0x45')]({'secret':![]})[_0x10a4('0x46')](function(_0x39dc4f){if(_0x39dc4f['Attachment']){var _0x15d3b4=path[_0x10a4('0x52')](_0x2c7312,_0x39dc4f[_0x10a4('0x5d')][_0x10a4('0x6d')]);if(fs[_0x10a4('0x6e')](_0x15d3b4)){fs['createReadStream'](_0x15d3b4)[_0x10a4('0x6f')](fs[_0x10a4('0x70')](path[_0x10a4('0x52')](_0x5bb3a3,_0x39dc4f['Attachment'][_0x10a4('0x6d')])));}}return{'date':moment(_0x39dc4f[_0x10a4('0x5f')])[_0x10a4('0x49')](_0x10a4('0x4a'))['toString'](),'sender':_0x39dc4f['direction']==='out'?_0x39dc4f[_0x10a4('0x58')]?_0x39dc4f[_0x10a4('0x58')][_0x10a4('0x59')]:_0x10a4('0x71'):_0x39dc4f[_0x10a4('0x5b')][_0x10a4('0x5c')]+(_0x39dc4f[_0x10a4('0x5b')][_0x10a4('0x72')]?'\x20'+_0x39dc4f[_0x10a4('0x5b')][_0x10a4('0x72')]:''),'body':_0x39dc4f[_0x10a4('0x5d')]?_0x39dc4f['Attachment']['basename']:_0x39dc4f[_0x10a4('0x39')],'direction':_0x39dc4f[_0x10a4('0x60')]==='out'?'A':'C','secret':_0x39dc4f[_0x10a4('0x73')],'read':_0x39dc4f[_0x10a4('0x74')],'attachment':_0x39dc4f[_0x10a4('0x5d')]};})['value']()};return ejs[_0x10a4('0x75')](path['join'](config['root'],_0x10a4('0x76'),_0x10a4('0x77'),_0x10a4('0x78')),{'interaction':_0x45e0bd})[_0x10a4('0x1c')](function(_0x1092d5){var _0x1911b1=path[_0x10a4('0x52')](_0x5bb3a3,'transcript-'+_0x9cd77f['id']+'-'+_0x50d910+_0x10a4('0x79'));var _0x260c22={'path':_0x1911b1,'channel':_0x10a4('0x64'),'interactionId':_0x9cd77f['id']};return pdf[_0x10a4('0x7a')](_0x1092d5,_0x260c22);})[_0x10a4('0x1c')](function(){return new Promise(function(_0x5259a4,_0x3c1154){zipdir(_0x5bb3a3,{'saveTo':_0x4ef705},function(_0x50d928,_0x70fb48){if(_0x50d928)return _0x3c1154(_0x50d928);return _0x5259a4(_0x70fb48);});})['then'](function(){return new Promise(function(_0x31c09d,_0x35833f){rimraf(_0x5bb3a3,function(_0x43ab2d){if(_0x43ab2d)_0x35833f(_0x43ab2d);return _0x31c09d();});});})[_0x10a4('0x1c')](function(){return _0xa05143[_0x10a4('0x50')](_0x4ef705,_0x514050,function(_0x407f88){if(_0x407f88){logger[_0x10a4('0x1d')](_0x10a4('0x7b'),_0x407f88);}else{fs[_0x10a4('0x7c')](_0x4ef705);}});});});}else{return _0xa05143[_0x10a4('0x11')](0xc8);}})[_0x10a4('0x29')](handleError(_0xa05143,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 1c6ff7d..626a30a 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 _0xc2b0=['setDataValue','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then'];(function(_0x3fda3,_0x28f527){var _0x59e823=function(_0x2b95ce){while(--_0x2b95ce){_0x3fda3['push'](_0x3fda3['shift']());}};_0x59e823(++_0x28f527);}(_0xc2b0,0x80));var _0x0c2b=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xc2b0[_0x68ee8b];return _0x5148f7;};'use strict';var EventEmitter=require(_0x0c2b('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x0c2b('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0c2b('0x2')](0x0);var events={'afterCreate':_0x0c2b('0x3'),'afterUpdate':'update','afterDestroy':_0x0c2b('0x4')};function emitEvent(_0x6a6aa9){return function(_0x403cb6,_0x52247c,_0x8aaeba){_0x403cb6[_0x0c2b('0x5')]({'attributes':['id'],'raw':!![]})[_0x0c2b('0x6')](function(_0xaf6431){_0x403cb6[_0x0c2b('0x7')]('Users',_0xaf6431[_0x0c2b('0x8')](function(_0x326abe){return{'id':_0x326abe['id']};}));return OpenchannelMessage[_0x0c2b('0x9')]({'where':{'OpenchannelInteractionId':_0x403cb6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0c2b('0x6')](function(_0x4400df){_0x403cb6['setDataValue']('unreadMessages',_0x4400df[_0x0c2b('0xa')]);OpenchannelInteractionEvents[_0x0c2b('0xb')](_0x6a6aa9+':'+_0x403cb6['id'],_0x403cb6);OpenchannelInteractionEvents[_0x0c2b('0xb')](_0x6a6aa9,_0x403cb6);_0x8aaeba(null);})[_0x0c2b('0xc')](_0x8aaeba(null));};}for(var e in events){if(events[_0x0c2b('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x0c2b('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x8709=['OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','map','length','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x8709,0xee));var _0x9870=function(_0x8e6c5b,_0x33e4df){_0x8e6c5b=_0x8e6c5b-0x0;var _0x39e9d3=_0x8709[_0x8e6c5b];return _0x39e9d3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x9870('0x0'))['db'][_0x9870('0x1')];var OpenchannelMessage=require(_0x9870('0x0'))['db'][_0x9870('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9870('0x3'),'afterUpdate':_0x9870('0x4'),'afterDestroy':_0x9870('0x5')};function emitEvent(_0x5762d9){return function(_0x189caa,_0x45b966,_0x3ae2da){_0x189caa[_0x9870('0x6')]({'attributes':['id'],'raw':!![]})[_0x9870('0x7')](function(_0x4ee41b){_0x189caa[_0x9870('0x8')]('Users',_0x4ee41b[_0x9870('0x9')](function(_0x5ebd04){return{'id':_0x5ebd04['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x189caa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9870('0x7')](function(_0x24a792){_0x189caa[_0x9870('0x8')]('unreadMessages',_0x24a792[_0x9870('0xa')]);OpenchannelInteractionEvents[_0x9870('0xb')](_0x5762d9+':'+_0x189caa['id'],_0x189caa);OpenchannelInteractionEvents[_0x9870('0xb')](_0x5762d9,_0x189caa);_0x3ae2da(null);})['catch'](_0x3ae2da(null));};}for(var e in events){if(events[_0x9870('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x9870('0xd')](e,emitEvent(event));}}module[_0x9870('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 52e24a7..935a79f 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 _0x3423=['OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x5bea24,_0x2f0a27){var _0x49f0ab=function(_0x1d201e){while(--_0x1d201e){_0x5bea24['push'](_0x5bea24['shift']());}};_0x49f0ab(++_0x2f0a27);}(_0x3423,0x127));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var logger=require('../../config/logger')(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var rp=require(_0x3342('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x307e9f,_0xebafc4){return _0x307e9f[_0x3342('0x8')](_0x3342('0x9'),attributes,{'tableName':_0x3342('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3342('0xb'),'collate':_0x3342('0xc'),'hooks':{'beforeUpdate':function(_0x137079,_0x2b37c3,_0xbeee6f){if(_0x137079[_0x3342('0xd')]('closed')){_0x137079[_0x3342('0xe')]=moment()['format'](_0x3342('0xf'));}_0xbeee6f(null,_0x137079);}}});}; \ No newline at end of file +var _0x7fbc=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt'];(function(_0x12287a,_0x22f00c){var _0x2141a0=function(_0xeb3b07){while(--_0xeb3b07){_0x12287a['push'](_0x12287a['shift']());}};_0x2141a0(++_0x22f00c);}(_0x7fbc,0xdf));var _0xc7fb=function(_0x5766bc,_0x32a8a0){_0x5766bc=_0x5766bc-0x0;var _0x43d553=_0x7fbc[_0x5766bc];return _0x43d553;};'use strict';var _=require(_0xc7fb('0x0'));var util=require(_0xc7fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc7fb('0x2'));var BPromise=require('bluebird');var rp=require(_0xc7fb('0x3'));var fs=require('fs');var path=require(_0xc7fb('0x4'));var rimraf=require(_0xc7fb('0x5'));var config=require('../../config/environment');var attributes=require(_0xc7fb('0x6'));module[_0xc7fb('0x7')]=function(_0x465ebf,_0x35bc3f){return _0x465ebf['define'](_0xc7fb('0x8'),attributes,{'tableName':_0xc7fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc7fb('0xa'),'collate':_0xc7fb('0xb'),'hooks':{'beforeUpdate':function(_0x1dd905,_0x18fca9,_0x3a1c56){if(_0x1dd905[_0xc7fb('0xc')](_0xc7fb('0xd'))){_0x1dd905[_0xc7fb('0xe')]=moment()[_0xc7fb('0xf')](_0xc7fb('0x10'));}_0x3a1c56(null,_0x1dd905);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 2ff760f..e80ae3b 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 _0x2e6a=['AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','debug'];(function(_0x3caecd,_0x53e0b2){var _0x13961b=function(_0x428715){while(--_0x428715){_0x3caecd['push'](_0x3caecd['shift']());}};_0x13961b(++_0x53e0b2);}(_0x2e6a,0xfd));var _0xa2e6=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x2e6a[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xa2e6('0x0'));var util=require(_0xa2e6('0x1'));var moment=require(_0xa2e6('0x2'));var BPromise=require('bluebird');var rs=require(_0xa2e6('0x3'));var fs=require('fs');var Redis=require(_0xa2e6('0x4'));var db=require(_0xa2e6('0x5'))['db'];var utils=require(_0xa2e6('0x6'));var logger=require(_0xa2e6('0x7'))(_0xa2e6('0x8'));var config=require(_0xa2e6('0x9'));var jayson=require(_0xa2e6('0xa'));var client=jayson['client'][_0xa2e6('0xb')]({'port':0x232a});config[_0xa2e6('0xc')]=_[_0xa2e6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa2e6('0xe'))(new Redis(config[_0xa2e6('0xc')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2e5a2b,_0x2696d4,_0x1c0629){return new BPromise(function(_0x15b345,_0xc9af92){return client[_0xa2e6('0xf')](_0x2e5a2b,_0x1c0629)[_0xa2e6('0x10')](function(_0x5aaaf2){logger['info'](_0xa2e6('0x11'),_0x2696d4,_0xa2e6('0x12'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2696d4,'request\x20sent',JSON[_0xa2e6('0x13')](_0x5aaaf2));if(_0x5aaaf2['error']){if(_0x5aaaf2[_0xa2e6('0x14')]['code']===0x1f4){logger[_0xa2e6('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2696d4,_0x5aaaf2['error']['message']);return _0xc9af92(_0x5aaaf2['error'][_0xa2e6('0x15')]);}logger[_0xa2e6('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2696d4,_0x5aaaf2[_0xa2e6('0x14')][_0xa2e6('0x15')]);return _0x15b345(_0x5aaaf2[_0xa2e6('0x14')]['message']);}else{logger[_0xa2e6('0x16')](_0xa2e6('0x11'),_0x2696d4,_0xa2e6('0x12'));_0x15b345(_0x5aaaf2[_0xa2e6('0x17')][_0xa2e6('0x15')]);}})[_0xa2e6('0x18')](function(_0x45809f){logger[_0xa2e6('0x14')](_0xa2e6('0x11'),_0x2696d4,_0x45809f);_0xc9af92(_0x45809f);});});}exports[_0xa2e6('0x19')]=function(_0x31bdb5){var _0x43d705=this;return new Promise(function(_0x73c35f,_0x559a8c){return db['OpenchannelInteraction'][_0xa2e6('0x1a')](_0x31bdb5[_0xa2e6('0x1b')],{'raw':_0x31bdb5[_0xa2e6('0x1c')]?_0x31bdb5['options'][_0xa2e6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31bdb5['options']?_0x31bdb5[_0xa2e6('0x1c')][_0xa2e6('0x1e')]||null:null,'attributes':_0x31bdb5[_0xa2e6('0x1c')]?_0x31bdb5[_0xa2e6('0x1c')][_0xa2e6('0x1f')]||null:null,'limit':_0x31bdb5[_0xa2e6('0x1c')]?_0x31bdb5['options'][_0xa2e6('0x20')]||null:null})[_0xa2e6('0x10')](function(_0x362bbe){logger[_0xa2e6('0x16')](_0xa2e6('0x19'),_0x31bdb5);logger[_0xa2e6('0x21')](_0xa2e6('0x19'),_0x31bdb5,JSON['stringify'](_0x362bbe));_0x73c35f(_0x362bbe);})[_0xa2e6('0x18')](function(_0x302b83){logger[_0xa2e6('0x14')](_0xa2e6('0x19'),_0x302b83[_0xa2e6('0x15')],_0x31bdb5);_0x559a8c(_0x43d705[_0xa2e6('0x14')](0x1f4,_0x302b83[_0xa2e6('0x15')]));});});};exports[_0xa2e6('0x22')]=function(_0x42ca1c){return new Promise(function(_0xa20e38,_0x24308f){return db[_0xa2e6('0x23')][_0xa2e6('0x24')]({'where':_0x42ca1c[_0xa2e6('0x1c')]?_0x42ca1c[_0xa2e6('0x1c')][_0xa2e6('0x1e')]||null:null})[_0xa2e6('0x10')](function(_0x20188b){if(_0x20188b){return _0x20188b[_0xa2e6('0x25')](_0x42ca1c['body'][_0xa2e6('0x26')],_['omit'](_0x42ca1c[_0xa2e6('0x1b')],[_0xa2e6('0x26'),'id'])||{});}})[_0xa2e6('0x27')](function(_0x1ebaf9){logger[_0xa2e6('0x16')](_0xa2e6('0x28'),_0x42ca1c);logger[_0xa2e6('0x21')](_0xa2e6('0x28'),_0x42ca1c,JSON[_0xa2e6('0x13')](_0x1ebaf9));_0xa20e38(_0x1ebaf9);})[_0xa2e6('0x18')](function(_0x18f4d2){logger[_0xa2e6('0x14')](_0xa2e6('0x28'),_0x18f4d2[_0xa2e6('0x15')],_0x42ca1c);_0x24308f(_this[_0xa2e6('0x14')](0x1f4,_0x18f4d2[_0xa2e6('0x15')]));});});}; \ No newline at end of file +var _0x8e52=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','stringify','find','addTags','omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2d5457,_0x25ba33){var _0x3be1c3=function(_0x3db825){while(--_0x3db825){_0x2d5457['push'](_0x2d5457['shift']());}};_0x3be1c3(++_0x25ba33);}(_0x8e52,0x1c6));var _0x28e5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8e52[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x28e5('0x0'));var util=require(_0x28e5('0x1'));var moment=require(_0x28e5('0x2'));var BPromise=require(_0x28e5('0x3'));var rs=require(_0x28e5('0x4'));var fs=require('fs');var Redis=require(_0x28e5('0x5'));var db=require(_0x28e5('0x6'))['db'];var utils=require(_0x28e5('0x7'));var logger=require(_0x28e5('0x8'))(_0x28e5('0x9'));var config=require(_0x28e5('0xa'));var jayson=require(_0x28e5('0xb'));var client=jayson[_0x28e5('0xc')]['http']({'port':0x232a});config[_0x28e5('0xd')]=_[_0x28e5('0xe')](config[_0x28e5('0xd')],{'host':_0x28e5('0xf'),'port':0x18eb});var socket=require(_0x28e5('0x10'))(new Redis(config[_0x28e5('0xd')]));require(_0x28e5('0x11'))[_0x28e5('0x12')](socket);function respondWithRpcPromise(_0x78134e,_0x4489c0,_0x4101c5){return new BPromise(function(_0x13e552,_0x256dbd){return client[_0x28e5('0x13')](_0x78134e,_0x4101c5)[_0x28e5('0x14')](function(_0x141c72){logger['info'](_0x28e5('0x15'),_0x4489c0,_0x28e5('0x16'));logger[_0x28e5('0x17')](_0x28e5('0x18'),_0x4489c0,_0x28e5('0x16'),JSON['stringify'](_0x141c72));if(_0x141c72['error']){if(_0x141c72[_0x28e5('0x19')][_0x28e5('0x1a')]===0x1f4){logger[_0x28e5('0x19')](_0x28e5('0x15'),_0x4489c0,_0x141c72[_0x28e5('0x19')][_0x28e5('0x1b')]);return _0x256dbd(_0x141c72[_0x28e5('0x19')]['message']);}logger[_0x28e5('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4489c0,_0x141c72['error'][_0x28e5('0x1b')]);return _0x13e552(_0x141c72[_0x28e5('0x19')][_0x28e5('0x1b')]);}else{logger['info'](_0x28e5('0x15'),_0x4489c0,'request\x20sent');_0x13e552(_0x141c72[_0x28e5('0x1c')]['message']);}})[_0x28e5('0x1d')](function(_0x69c588){logger[_0x28e5('0x19')](_0x28e5('0x15'),_0x4489c0,_0x69c588);_0x256dbd(_0x69c588);});});}exports['UpdateOpenchannelInteraction']=function(_0x46e2e3){var _0x4c5968=this;return new Promise(function(_0x2bca13,_0x427430){return db[_0x28e5('0x1e')][_0x28e5('0x1f')](_0x46e2e3[_0x28e5('0x20')],{'raw':_0x46e2e3[_0x28e5('0x21')]?_0x46e2e3['options'][_0x28e5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46e2e3[_0x28e5('0x21')]?_0x46e2e3[_0x28e5('0x21')][_0x28e5('0x23')]||null:null,'attributes':_0x46e2e3[_0x28e5('0x21')]?_0x46e2e3[_0x28e5('0x21')][_0x28e5('0x24')]||null:null,'limit':_0x46e2e3['options']?_0x46e2e3[_0x28e5('0x21')][_0x28e5('0x25')]||null:null})[_0x28e5('0x14')](function(_0x8061f){logger['info'](_0x28e5('0x26'),_0x46e2e3);logger[_0x28e5('0x17')](_0x28e5('0x26'),_0x46e2e3,JSON[_0x28e5('0x27')](_0x8061f));_0x2bca13(_0x8061f);})[_0x28e5('0x1d')](function(_0x2287fb){logger['error']('UpdateOpenchannelInteraction',_0x2287fb['message'],_0x46e2e3);_0x427430(_0x4c5968[_0x28e5('0x19')](0x1f4,_0x2287fb[_0x28e5('0x1b')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xc8d977){return new Promise(function(_0x3f616b,_0x2c7e59){return db[_0x28e5('0x1e')][_0x28e5('0x28')]({'where':_0xc8d977[_0x28e5('0x21')]?_0xc8d977[_0x28e5('0x21')][_0x28e5('0x23')]||null:null})['then'](function(_0x336f36){if(_0x336f36){return _0x336f36[_0x28e5('0x29')](_0xc8d977[_0x28e5('0x20')]['ids'],_[_0x28e5('0x2a')](_0xc8d977[_0x28e5('0x20')],['ids','id'])||{});}})[_0x28e5('0x2b')](function(_0x29927f){logger[_0x28e5('0x2c')](_0x28e5('0x2d'),_0xc8d977);logger[_0x28e5('0x17')](_0x28e5('0x2d'),_0xc8d977,JSON[_0x28e5('0x27')](_0x29927f));_0x3f616b(_0x29927f);})['catch'](function(_0x149db9){logger[_0x28e5('0x19')](_0x28e5('0x2d'),_0x149db9[_0x28e5('0x1b')],_0xc8d977);_0x2c7e59(_this[_0x28e5('0x19')](0x1f4,_0x149db9[_0x28e5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8912c88..da47f01 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 _0xb7d3=['emit','removeListener','register','length','openchannelInteraction:','save','update'];(function(_0xb6df6e,_0x5e3e7a){var _0x39dc4f=function(_0x3b8b6a){while(--_0x3b8b6a){_0xb6df6e['push'](_0xb6df6e['shift']());}};_0x39dc4f(++_0x5e3e7a);}(_0xb7d3,0x1b7));var _0x3b7d=function(_0x21065c,_0x23839c){_0x21065c=_0x21065c-0x0;var _0x3500c0=_0xb7d3[_0x21065c];return _0x3500c0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x3b7d('0x0'),'remove',_0x3b7d('0x1')];function createListener(_0x5a13da,_0x21bba6){return function(_0x1550f6){_0x21bba6[_0x3b7d('0x2')](_0x5a13da,_0x1550f6);};}function removeListener(_0xf6f60f,_0x38182c){return function(){OpenchannelInteractionEvents[_0x3b7d('0x3')](_0xf6f60f,_0x38182c);};}exports[_0x3b7d('0x4')]=function(_0x18da98){for(var _0x46ab6f=0x0,_0x21afc1=events[_0x3b7d('0x5')];_0x46ab6f<_0x21afc1;_0x46ab6f++){var _0x1faf52=events[_0x46ab6f];var _0x456d33=createListener(_0x3b7d('0x6')+_0x1faf52,_0x18da98);OpenchannelInteractionEvents['on'](_0x1faf52,_0x456d33);}}; \ No newline at end of file +var _0xa114=['openchannelInteraction:','./openchannelInteraction.events','remove','emit','length'];(function(_0x1bb0b0,_0x2e56ba){var _0xb3573b=function(_0x55b4c8){while(--_0x55b4c8){_0x1bb0b0['push'](_0x1bb0b0['shift']());}};_0xb3573b(++_0x2e56ba);}(_0xa114,0x164));var _0x4a11=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xa114[_0x3ba924];return _0x4cc1df;};'use strict';var OpenchannelInteractionEvents=require(_0x4a11('0x0'));var events=['save',_0x4a11('0x1'),'update'];function createListener(_0x16f1de,_0xd0fd06){return function(_0x1a8bb3){_0xd0fd06[_0x4a11('0x2')](_0x16f1de,_0x1a8bb3);};}function removeListener(_0xc081e0,_0x225f25){return function(){OpenchannelInteractionEvents['removeListener'](_0xc081e0,_0x225f25);};}exports['register']=function(_0x50d174){for(var _0x3f396e=0x0,_0x4231d4=events[_0x4a11('0x3')];_0x3f396e<_0x4231d4;_0x3f396e++){var _0x54e8d6=events[_0x3f396e];var _0xf143ac=createListener(_0x4a11('0x4')+_0x54e8d6,_0x50d174);OpenchannelInteractionEvents['on'](_0x54e8d6,_0xf143ac);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 612cb78..9d812fa 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 _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(_0xd38a8a,_0x303834){var _0xdb71fc=function(_0x1c3c06){while(--_0x1c3c06){_0xd38a8a['push'](_0xd38a8a['shift']());}};_0xdb71fc(++_0x303834);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 +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(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3b4acb6..c48ebad 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 _0x777d=['TEXT','medium','BOOLEAN','ENUM','STRING','exports'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x777d,0xe9));var _0xd777=function(_0x2ad1b8,_0x1ea09b){_0x2ad1b8=_0x2ad1b8-0x0;var _0x52547d=_0x777d[_0x2ad1b8];return _0x52547d;};'use strict';var Sequelize=require('sequelize');module[_0xd777('0x0')]={'body':{'type':Sequelize[_0xd777('0x1')](_0xd777('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd777('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd777('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xd777('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe3d4=['out','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x110339,_0xded8c7){var _0x2cb138=function(_0xd25efd){while(--_0xd25efd){_0x110339['push'](_0x110339['shift']());}};_0x2cb138(++_0xded8c7);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x43db86,_0x34184b){_0x43db86=_0x43db86-0x0;var _0x27bda2=_0xe3d4[_0x43db86];return _0x27bda2;};'use strict';var Sequelize=require('sequelize');module[_0x4e3d('0x0')]={'body':{'type':Sequelize[_0x4e3d('0x1')](_0x4e3d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4e3d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e3d('0x4')]('in','out'),'defaultValue':_0x4e3d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4e3d('0x6')]},'providerResponse':{'type':Sequelize[_0x4e3d('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 547a0b1..f93cf70 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 _0x662a=['pick','options','includeAll','findAll','rows','show','params','keys','include','merge','find','body','destroy','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','reject','save','update','then','name','index','map','OpenchannelMessage','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1fdc70,_0x3ae40e){var _0x30328c=function(_0x2edb35){while(--_0x2edb35){_0x1fdc70['push'](_0x1fdc70['shift']());}};_0x30328c(++_0x3ae40e);}(_0x662a,0xae));var _0xa662=function(_0x57bb3d,_0x994b5a){_0x57bb3d=_0x57bb3d-0x0;var _0x5b0497=_0x662a[_0x57bb3d];return _0x5b0497;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa662('0x0'));var zipdir=require(_0xa662('0x1'));var jsonpatch=require(_0xa662('0x2'));var rp=require(_0xa662('0x3'));var moment=require('moment');var BPromise=require(_0xa662('0x4'));var Mustache=require(_0xa662('0x5'));var util=require(_0xa662('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa662('0x7'));var ejs=require(_0xa662('0x8'));var fs=require('fs');var fs_extra=require(_0xa662('0x9'));var _=require(_0xa662('0xa'));var squel=require(_0xa662('0xb'));var crypto=require(_0xa662('0xc'));var jsforce=require(_0xa662('0xd'));var deskjs=require(_0xa662('0xe'));var toCsv=require(_0xa662('0x7'));var querystring=require('querystring');var Papa=require(_0xa662('0xf'));var Redis=require('ioredis');var authService=require(_0xa662('0x10'));var qs=require(_0xa662('0x11'));var as=require(_0xa662('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa662('0x13'))(_0xa662('0x14'));var utils=require('../../config/utils');var config=require(_0xa662('0x15'));var licenseUtil=require(_0xa662('0x16'));var db=require(_0xa662('0x17'))['db'];config[_0xa662('0x18')]=_[_0xa662('0x19')](config[_0xa662('0x18')],{'host':_0xa662('0x1a'),'port':0x18eb});var socket=require(_0xa662('0x1b'))(new Redis(config['redis']));require(_0xa662('0x1c'))[_0xa662('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa662('0x1e')][_0xa662('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xa662('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x22516f,_0x1cd9cd,_0xb511bb,_0x46ca3a){return new BPromise(function(_0x3b8d8c,_0x4d806b){var _0x121f86=_0x46ca3a||client;return _0x121f86[_0xa662('0x20')](_0x22516f,_0xb511bb)['then'](function(_0x1a53a7){logger[_0xa662('0x21')](_0xa662('0x22'),_0x1cd9cd,_0xa662('0x23'));logger['debug'](_0xa662('0x24'),_0x1cd9cd,_0xa662('0x23'),JSON[_0xa662('0x25')](_0x1a53a7));if(_0x1a53a7[_0xa662('0x26')]){if(_0x1a53a7[_0xa662('0x26')][_0xa662('0x27')]===0x1f4){logger[_0xa662('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x1cd9cd,_0x1a53a7['error'][_0xa662('0x28')]);return _0x4d806b(_0x1a53a7['error'][_0xa662('0x28')]);}logger['error'](_0xa662('0x22'),_0x1cd9cd,_0x1a53a7['error']['message']);return _0x3b8d8c(_0x1a53a7[_0xa662('0x26')]['message']);}else{logger[_0xa662('0x21')](_0xa662('0x22'),_0x1cd9cd,'request\x20sent');_0x3b8d8c(_0x1a53a7['result'][_0xa662('0x28')]);}})[_0xa662('0x29')](function(_0x406699){logger[_0xa662('0x26')](_0xa662('0x22'),_0x1cd9cd,_0x406699);_0x4d806b(_0x406699);});});}function respondWithStatusCode(_0x531c4f,_0x4da8ea){_0x4da8ea=_0x4da8ea||0xcc;return function(_0x37369d){if(_0x37369d){return _0x531c4f['sendStatus'](_0x4da8ea);}return _0x531c4f[_0xa662('0x2a')](_0x4da8ea)[_0xa662('0x2b')]();};}function respondWithResult(_0x1e133d,_0x507e06){_0x507e06=_0x507e06||0xc8;return function(_0x405c24){if(_0x405c24){return _0x1e133d[_0xa662('0x2a')](_0x507e06)[_0xa662('0x2c')](_0x405c24);}};}function respondWithFilteredResult(_0x4c45cc,_0x4299fd){return function(_0x10a0e6){if(_0x10a0e6){var _0x1dc05b=typeof _0x4299fd[_0xa662('0x2d')]===_0xa662('0x2e')&&typeof _0x4299fd[_0xa662('0x2f')]===_0xa662('0x2e');var _0x34b89f=_0x10a0e6[_0xa662('0x30')];var _0x190185=_0x1dc05b?0x0:_0x4299fd[_0xa662('0x2d')];var _0x2b2996=_0x1dc05b?_0x10a0e6[_0xa662('0x30')]:_0x4299fd[_0xa662('0x2d')]+_0x4299fd[_0xa662('0x2f')];var _0x4dfe1a;if(_0x2b2996>=_0x34b89f){_0x2b2996=_0x34b89f;_0x4dfe1a=0xc8;}else{_0x4dfe1a=0xce;}_0x4c45cc[_0xa662('0x2a')](_0x4dfe1a);return _0x4c45cc['set']('Content-Range',_0x190185+'-'+_0x2b2996+'/'+_0x34b89f)['json'](_0x10a0e6);}return null;};}function patchUpdates(_0x374392){return function(_0x3d7eb3){try{jsonpatch['apply'](_0x3d7eb3,_0x374392,!![]);}catch(_0xcd096b){return BPromise[_0xa662('0x31')](_0xcd096b);}return _0x3d7eb3[_0xa662('0x32')]();};}function saveUpdates(_0x5e57a7,_0x4feead){return function(_0x29c298){if(_0x29c298){return _0x29c298[_0xa662('0x33')](_0x5e57a7)[_0xa662('0x34')](function(_0x2a446b){return _0x2a446b;});}return null;};}function removeEntity(_0x582316,_0x247cef){return function(_0x547704){if(_0x547704){return _0x547704['destroy']()['then'](function(){_0x582316[_0xa662('0x2a')](0xcc)[_0xa662('0x2b')]();});}};}function handleEntityNotFound(_0x5591c5,_0x3efb01){return function(_0xd29448){if(!_0xd29448){_0x5591c5['sendStatus'](0x194);}return _0xd29448;};}function handleError(_0x4ae624,_0x2268d7){_0x2268d7=_0x2268d7||0x1f4;return function(_0x3e8359){logger[_0xa662('0x26')](_0x3e8359['stack']);if(_0x3e8359[_0xa662('0x35')]){delete _0x3e8359[_0xa662('0x35')];}_0x4ae624['status'](_0x2268d7)['send'](_0x3e8359);};}exports[_0xa662('0x36')]=function(_0x1b3329,_0x562379){var _0x54b3d4={},_0x2eaa4f={},_0x285894={'count':0x0,'rows':[]};var _0x18a1cf=_[_0xa662('0x37')](db[_0xa662('0x38')]['rawAttributes'],function(_0x5c640e){return{'name':_0x5c640e['fieldName'],'type':_0x5c640e[_0xa662('0x39')]['key']};});_0x2eaa4f[_0xa662('0x3a')]=_['map'](_0x18a1cf,_0xa662('0x35'));_0x2eaa4f['query']=_['keys'](_0x1b3329[_0xa662('0x3b')]);_0x2eaa4f[_0xa662('0x3c')]=_[_0xa662('0x3d')](_0x2eaa4f[_0xa662('0x3a')],_0x2eaa4f[_0xa662('0x3b')]);_0x54b3d4[_0xa662('0x3e')]=_[_0xa662('0x3d')](_0x2eaa4f['model'],qs[_0xa662('0x3f')](_0x1b3329[_0xa662('0x3b')]['fields']));_0x54b3d4[_0xa662('0x3e')]=_0x54b3d4[_0xa662('0x3e')][_0xa662('0x40')]?_0x54b3d4[_0xa662('0x3e')]:_0x2eaa4f['model'];if(!_0x1b3329[_0xa662('0x3b')][_0xa662('0x41')](_0xa662('0x42'))){_0x54b3d4[_0xa662('0x2f')]=qs[_0xa662('0x2f')](_0x1b3329[_0xa662('0x3b')][_0xa662('0x2f')]);_0x54b3d4[_0xa662('0x2d')]=qs[_0xa662('0x2d')](_0x1b3329[_0xa662('0x3b')]['offset']);}_0x54b3d4[_0xa662('0x43')]=qs[_0xa662('0x44')](_0x1b3329['query'][_0xa662('0x44')]);_0x54b3d4[_0xa662('0x45')]=qs[_0xa662('0x3c')](_[_0xa662('0x46')](_0x1b3329[_0xa662('0x3b')],_0x2eaa4f[_0xa662('0x3c')]),_0x18a1cf);if(_0x1b3329['query']['filter']){_0x54b3d4[_0xa662('0x45')]=_['merge'](_0x54b3d4[_0xa662('0x45')],{'$or':_[_0xa662('0x37')](_0x18a1cf,function(_0x5eabb5){if(_0x5eabb5[_0xa662('0x39')]!=='VIRTUAL'){var _0x20c358={};_0x20c358[_0x5eabb5[_0xa662('0x35')]]={'$like':'%'+_0x1b3329[_0xa662('0x3b')]['filter']+'%'};return _0x20c358;}})});}_0x54b3d4=_['merge']({},_0x54b3d4,_0x1b3329[_0xa662('0x47')]);var _0x11b387={'where':_0x54b3d4[_0xa662('0x45')]};return db['OpenchannelMessage']['count'](_0x11b387)[_0xa662('0x34')](function(_0x243ba4){_0x285894[_0xa662('0x30')]=_0x243ba4;if(_0x1b3329['query'][_0xa662('0x48')]){_0x54b3d4['include']=[{'all':!![]}];}return db[_0xa662('0x38')][_0xa662('0x49')](_0x54b3d4);})[_0xa662('0x34')](function(_0x47ad86){_0x285894[_0xa662('0x4a')]=_0x47ad86;return _0x285894;})[_0xa662('0x34')](respondWithFilteredResult(_0x562379,_0x54b3d4))[_0xa662('0x29')](handleError(_0x562379,null));};exports[_0xa662('0x4b')]=function(_0x2f0ddb,_0x187ce8){var _0x587d81={'raw':!![],'where':{'id':_0x2f0ddb[_0xa662('0x4c')]['id']}},_0x211b42={};_0x211b42[_0xa662('0x3a')]=_[_0xa662('0x4d')](db[_0xa662('0x38')]['rawAttributes']);_0x211b42['query']=_[_0xa662('0x4d')](_0x2f0ddb[_0xa662('0x3b')]);_0x211b42[_0xa662('0x3c')]=_[_0xa662('0x3d')](_0x211b42[_0xa662('0x3a')],_0x211b42[_0xa662('0x3b')]);_0x587d81[_0xa662('0x3e')]=_['intersection'](_0x211b42[_0xa662('0x3a')],qs['fields'](_0x2f0ddb[_0xa662('0x3b')][_0xa662('0x3f')]));_0x587d81[_0xa662('0x3e')]=_0x587d81[_0xa662('0x3e')][_0xa662('0x40')]?_0x587d81[_0xa662('0x3e')]:_0x211b42[_0xa662('0x3a')];if(_0x2f0ddb[_0xa662('0x3b')][_0xa662('0x48')]){_0x587d81[_0xa662('0x4e')]=[{'all':!![]}];}_0x587d81=_[_0xa662('0x4f')]({},_0x587d81,_0x2f0ddb[_0xa662('0x47')]);return db[_0xa662('0x38')][_0xa662('0x50')](_0x587d81)[_0xa662('0x34')](handleEntityNotFound(_0x187ce8,null))[_0xa662('0x34')](respondWithResult(_0x187ce8,null))[_0xa662('0x29')](handleError(_0x187ce8,null));};exports['create']=function(_0xa3bfb9,_0x362980){return db['OpenchannelMessage']['create'](_0xa3bfb9[_0xa662('0x51')],{})[_0xa662('0x34')](respondWithResult(_0x362980,0xc9))[_0xa662('0x29')](handleError(_0x362980,null));};exports[_0xa662('0x33')]=function(_0x229066,_0x16fb07){if(_0x229066[_0xa662('0x51')]['id']){delete _0x229066[_0xa662('0x51')]['id'];}return db[_0xa662('0x38')][_0xa662('0x50')]({'where':{'id':_0x229066[_0xa662('0x4c')]['id']}})[_0xa662('0x34')](handleEntityNotFound(_0x16fb07,null))[_0xa662('0x34')](saveUpdates(_0x229066[_0xa662('0x51')],null))['then'](respondWithResult(_0x16fb07,null))[_0xa662('0x29')](handleError(_0x16fb07,null));};exports[_0xa662('0x52')]=function(_0x188a29,_0x357b18){return db[_0xa662('0x38')][_0xa662('0x50')]({'where':{'id':_0x188a29[_0xa662('0x4c')]['id']}})[_0xa662('0x34')](handleEntityNotFound(_0x357b18,null))[_0xa662('0x34')](removeEntity(_0x357b18,null))[_0xa662('0x29')](handleError(_0x357b18,null));};exports['describe']=function(_0x5e78b8,_0x5645d6){return db[_0xa662('0x38')]['describe']()[_0xa662('0x34')](respondWithResult(_0x5645d6,null))[_0xa662('0x29')](handleError(_0x5645d6,null));};var interaction_log=require(_0xa662('0x13'))('openchannel-interactions');exports['accept']=function(_0x4487a6,_0x5eabd5,_0x26808c){var _0x537e5a={'agent':{},'channel':'openchannel'};if(_0x4487a6[_0xa662('0x51')]['id']){delete _0x4487a6['body']['id'];}_0x4487a6[_0xa662('0x51')][_0xa662('0x53')]=!![];_0x4487a6['body']['readAt']=moment()[_0xa662('0x54')](_0xa662('0x55'));_0x4487a6[_0xa662('0x51')][_0xa662('0x56')]=_0x4487a6[_0xa662('0x51')][_0xa662('0x56')]||_0x4487a6[_0xa662('0x57')]['id'];_0x537e5a[_0xa662('0x58')]['id']=_0x4487a6[_0xa662('0x51')][_0xa662('0x56')];return db[_0xa662('0x38')][_0xa662('0x50')]({'where':{'id':_0x4487a6[_0xa662('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5eabd5,null))[_0xa662('0x34')](saveUpdates(_0x4487a6[_0xa662('0x51')],null))[_0xa662('0x34')](function(_0x12230e){if(_0x12230e){_0x537e5a[_0xa662('0x28')]=_0x12230e[_0xa662('0x59')]({'plain':!![]});return db[_0xa662('0x5a')][_0xa662('0x50')]({'where':{'id':_0x12230e[_0xa662('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x5eabd5,null))[_0xa662('0x34')](function(_0x1eefc8){if(_0x1eefc8){return _0x1eefc8['update']({'UserId':_0x4487a6[_0xa662('0x51')][_0xa662('0x56')],'read1stAt':_[_0xa662('0x5c')](_0x1eefc8[_0xa662('0x5d')])?moment()[_0xa662('0x54')](_0xa662('0x55')):undefined});}return null;})[_0xa662('0x34')](function(_0x3a1024){if(_0x3a1024){_0x537e5a[_0xa662('0x5e')]=_0x3a1024[_0xa662('0x59')]({'plain':!![]});interaction_log[_0xa662('0x21')](_0xa662('0x5f'),_0x4487a6[_0xa662('0x57')]['id'],_0x4487a6[_0xa662('0x57')][_0xa662('0x35')],_0x4487a6['user'][_0xa662('0x60')],_0x537e5a[_0xa662('0x5e')]['id'],_0x4487a6[_0xa662('0x51')]?JSON[_0xa662('0x25')](_0x4487a6[_0xa662('0x51')]):_0xa662('0x61'));return respondWithRpcPromise('AcceptMessage',_0xa662('0x62'),_0x537e5a);}return null;})['then'](function(_0x2b43ec){var _0x5b1231='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b43ec['message'][_0xa662('0x63')];return db[_0xa662('0x64')]['query'](_0x5b1231,{'type':db[_0xa662('0x65')][_0xa662('0x66')][_0xa662('0x67')],'raw':!![]})[_0xa662('0x34')](function(_0x1b0778){return _0x1b0778;});})[_0xa662('0x34')](function(_0x32ed1c){if(_0x32ed1c){_0x537e5a[_0xa662('0x28')][_0xa662('0x68')]=_0x32ed1c[0x0];if(!_0x4487a6[_0xa662('0x51')][_0xa662('0x56')])return;return db[_0xa662('0x69')][_0xa662('0x50')]({'where':{'id':_0x4487a6[_0xa662('0x51')][_0xa662('0x56')],'role':_0xa662('0x58')},'attributes':['id','name',_0xa662('0x6a'),_0xa662('0x6b'),_0xa662('0x6c')],'raw':!![]});}return null;})[_0xa662('0x34')](function(_0x29102b){if(!_0x29102b)return null;_0x537e5a['message'][_0xa662('0x58')]=_0x29102b;return _0x537e5a;})[_0xa662('0x34')](function(_0xc25de5){if(_0xc25de5){if(_0x4487a6[_0xa662('0x51')][_0xa662('0x6d')]){_0x537e5a['message'][_0xa662('0x6e')]=util[_0xa662('0x54')]('SIP/%s',_0x4487a6[_0xa662('0x57')][_0xa662('0x35')]);_0x537e5a[_0xa662('0x28')][_0xa662('0x6f')]=_0x537e5a['channel'];_0x537e5a[_0xa662('0x28')][_0xa662('0x70')]=_0x537e5a[_0xa662('0x6f')];_0x537e5a[_0xa662('0x28')][_0xa662('0x71')]=_0xa662('0x72');return respondWithRpcPromise(_0xa662('0x73'),_0xa662('0x73'),{'event':_0xa662('0x74'),'message':_0x537e5a[_0xa662('0x28')]},client9002)[_0xa662('0x34')](function(){return _0x537e5a;});}return _0x537e5a;}return null;})[_0xa662('0x34')](respondWithResult(_0x5eabd5,null))['catch'](handleError(_0x5eabd5,null));};var interaction_log=require('../../config/logger')(_0xa662('0x75'));exports[_0xa662('0x31')]=function(_0xf6bb79,_0x4ebddb,_0x5c4469){var _0x2398fd={'agent':{},'channel':'openchannel'};if(_0xf6bb79['body']['id']){delete _0xf6bb79[_0xa662('0x51')]['id'];}_0xf6bb79[_0xa662('0x51')][_0xa662('0x56')]=_0xf6bb79[_0xa662('0x51')][_0xa662('0x56')]||_0xf6bb79[_0xa662('0x57')]['id'];_0x2398fd['agent']['id']=_0xf6bb79[_0xa662('0x51')]['UserId'];return db[_0xa662('0x38')]['find']({'where':{'id':_0xf6bb79['params']['id'],'UserId':null}})[_0xa662('0x34')](handleEntityNotFound(_0x4ebddb,null))[_0xa662('0x34')](function(_0x2f4215){if(_0x2f4215){_0x2398fd[_0xa662('0x28')]=_0x2f4215[_0xa662('0x59')]({'plain':!![]});return db[_0xa662('0x5a')]['find']({'where':{'id':_0x2f4215['OpenchannelInteractionId']}});}return null;})[_0xa662('0x34')](handleEntityNotFound(_0x4ebddb,null))[_0xa662('0x34')](function(_0x17f935){if(_0x17f935){_0x2398fd[_0xa662('0x5e')]=_0x17f935[_0xa662('0x59')]({'plain':!![]});interaction_log[_0xa662('0x21')](_0xa662('0x76'),_0xf6bb79[_0xa662('0x57')]['id'],_0xf6bb79['user']['name'],_0xf6bb79['user'][_0xa662('0x60')],_0x2398fd[_0xa662('0x5e')]['id'],_0xf6bb79[_0xa662('0x51')]?JSON[_0xa662('0x25')](_0xf6bb79[_0xa662('0x51')]):'null');return respondWithRpcPromise('RejectMessage',_0xa662('0x77'),_0x2398fd);}return null;})[_0xa662('0x34')](function(_0x413026){var _0x4bf9db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x413026[_0xa662('0x28')]['ContactId'];return db['sequelize']['query'](_0x4bf9db,{'type':db[_0xa662('0x65')][_0xa662('0x66')][_0xa662('0x67')],'raw':!![]})[_0xa662('0x34')](function(_0x2eec0a){return _0x2eec0a;});})[_0xa662('0x34')](function(_0x3e5764){if(_0x3e5764){_0x2398fd[_0xa662('0x28')]['contact']=_0x3e5764[0x0];if(!_0xf6bb79[_0xa662('0x51')][_0xa662('0x56')])return;return db[_0xa662('0x69')]['find']({'where':{'id':_0xf6bb79[_0xa662('0x51')][_0xa662('0x56')],'role':_0xa662('0x58')},'attributes':['id',_0xa662('0x35'),_0xa662('0x6a'),_0xa662('0x6b'),_0xa662('0x6c')],'raw':!![]});}return null;})[_0xa662('0x34')](function(_0x329781){if(!_0x329781)return null;_0x2398fd['message'][_0xa662('0x58')]=_0x329781;return _0x2398fd;})[_0xa662('0x34')](function(_0x11a98f){if(_0x11a98f){_0x11a98f['message'][_0xa662('0x6e')]=util['format'](_0xa662('0x78'),_0xf6bb79['user'][_0xa662('0x35')]);_0x11a98f[_0xa662('0x28')][_0xa662('0x6f')]=_0x2398fd['channel'];_0x11a98f[_0xa662('0x28')][_0xa662('0x70')]=_0x2398fd['channel'];_0x11a98f[_0xa662('0x28')][_0xa662('0x71')]=_0xa662('0x31');respondWithRpcPromise(_0xa662('0x73'),'EventManager',{'event':_0xa662('0x79'),'message':_0x11a98f['message']},client9002);return _0x2398fd;}return null;})[_0xa662('0x34')](respondWithResult(_0x4ebddb,null))[_0xa662('0x29')](handleError(_0x4ebddb,null));}; \ No newline at end of file +var _0x2fa9=['path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','OpenchannelMessage,\x20%s,\x20%s','info','result','status','undefined','limit','count','offset','json','apply','save','update','destroy','sendStatus','stack','name','index','OpenchannelMessage','rawAttributes','fieldName','type','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','reject','OpenchannelInteraction','role','RejectMessage','rejectMessage','ContactId','Sequelize','EventManager','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x25fb1f,_0x4c2230){var _0x3f2dce=function(_0x236993){while(--_0x236993){_0x25fb1f['push'](_0x25fb1f['shift']());}};_0x3f2dce(++_0x4c2230);}(_0x2fa9,0x1e9));var _0x92fa=function(_0x381961,_0x297382){_0x381961=_0x381961-0x0;var _0x1a2de0=_0x2fa9[_0x381961];return _0x1a2de0;};'use strict';var emlformat=require(_0x92fa('0x0'));var rimraf=require(_0x92fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x92fa('0x2'));var moment=require(_0x92fa('0x3'));var BPromise=require(_0x92fa('0x4'));var Mustache=require(_0x92fa('0x5'));var util=require(_0x92fa('0x6'));var path=require(_0x92fa('0x7'));var sox=require('sox');var csv=require(_0x92fa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92fa('0x9'));var _=require('lodash');var squel=require(_0x92fa('0xa'));var crypto=require(_0x92fa('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x92fa('0x8'));var querystring=require(_0x92fa('0xc'));var Papa=require(_0x92fa('0xd'));var Redis=require(_0x92fa('0xe'));var authService=require(_0x92fa('0xf'));var qs=require(_0x92fa('0x10'));var as=require(_0x92fa('0x11'));var hardwareService=require(_0x92fa('0x12'));var logger=require('../../config/logger')(_0x92fa('0x13'));var utils=require(_0x92fa('0x14'));var config=require(_0x92fa('0x15'));var licenseUtil=require(_0x92fa('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x92fa('0x17')](config[_0x92fa('0x18')],{'host':_0x92fa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92fa('0x18')]));require(_0x92fa('0x1a'))[_0x92fa('0x1b')](socket);var jayson=require(_0x92fa('0x1c'));var client=jayson['client'][_0x92fa('0x1d')]({'port':0x232c});var client9002=jayson[_0x92fa('0x1e')][_0x92fa('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5dadd1,_0x2be260,_0x25ce5f,_0x1ab39d){return new BPromise(function(_0x4820a7,_0x5afd8c){var _0x16317f=_0x1ab39d||client;return _0x16317f[_0x92fa('0x1f')](_0x5dadd1,_0x25ce5f)[_0x92fa('0x20')](function(_0x20ba47){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2be260,_0x92fa('0x21'));logger[_0x92fa('0x22')](_0x92fa('0x23'),_0x2be260,_0x92fa('0x21'),JSON['stringify'](_0x20ba47));if(_0x20ba47[_0x92fa('0x24')]){if(_0x20ba47[_0x92fa('0x24')]['code']===0x1f4){logger[_0x92fa('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x2be260,_0x20ba47[_0x92fa('0x24')][_0x92fa('0x25')]);return _0x5afd8c(_0x20ba47['error'][_0x92fa('0x25')]);}logger[_0x92fa('0x24')](_0x92fa('0x26'),_0x2be260,_0x20ba47['error']['message']);return _0x4820a7(_0x20ba47[_0x92fa('0x24')][_0x92fa('0x25')]);}else{logger[_0x92fa('0x27')](_0x92fa('0x26'),_0x2be260,_0x92fa('0x21'));_0x4820a7(_0x20ba47[_0x92fa('0x28')][_0x92fa('0x25')]);}})['catch'](function(_0x57196f){logger[_0x92fa('0x24')](_0x92fa('0x26'),_0x2be260,_0x57196f);_0x5afd8c(_0x57196f);});});}function respondWithStatusCode(_0x34f6d0,_0x2a14eb){_0x2a14eb=_0x2a14eb||0xcc;return function(_0x44c334){if(_0x44c334){return _0x34f6d0['sendStatus'](_0x2a14eb);}return _0x34f6d0[_0x92fa('0x29')](_0x2a14eb)['end']();};}function respondWithResult(_0x4da957,_0x4095e3){_0x4095e3=_0x4095e3||0xc8;return function(_0x5b5786){if(_0x5b5786){return _0x4da957[_0x92fa('0x29')](_0x4095e3)['json'](_0x5b5786);}};}function respondWithFilteredResult(_0x47b327,_0x32e207){return function(_0x3d2860){if(_0x3d2860){var _0x5215e4=typeof _0x32e207['offset']===_0x92fa('0x2a')&&typeof _0x32e207[_0x92fa('0x2b')]==='undefined';var _0x1bd4f1=_0x3d2860[_0x92fa('0x2c')];var _0x2d4247=_0x5215e4?0x0:_0x32e207[_0x92fa('0x2d')];var _0x4a82c7=_0x5215e4?_0x3d2860[_0x92fa('0x2c')]:_0x32e207[_0x92fa('0x2d')]+_0x32e207[_0x92fa('0x2b')];var _0x4d8a7c;if(_0x4a82c7>=_0x1bd4f1){_0x4a82c7=_0x1bd4f1;_0x4d8a7c=0xc8;}else{_0x4d8a7c=0xce;}_0x47b327['status'](_0x4d8a7c);return _0x47b327['set']('Content-Range',_0x2d4247+'-'+_0x4a82c7+'/'+_0x1bd4f1)[_0x92fa('0x2e')](_0x3d2860);}return null;};}function patchUpdates(_0x5edee9){return function(_0x54e88d){try{jsonpatch[_0x92fa('0x2f')](_0x54e88d,_0x5edee9,!![]);}catch(_0xcc91a5){return BPromise['reject'](_0xcc91a5);}return _0x54e88d[_0x92fa('0x30')]();};}function saveUpdates(_0x297d26,_0x3b18af){return function(_0x53b2dc){if(_0x53b2dc){return _0x53b2dc[_0x92fa('0x31')](_0x297d26)[_0x92fa('0x20')](function(_0x57450b){return _0x57450b;});}return null;};}function removeEntity(_0x485997,_0x44f058){return function(_0x34100d){if(_0x34100d){return _0x34100d[_0x92fa('0x32')]()[_0x92fa('0x20')](function(){_0x485997[_0x92fa('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b70d8,_0x15362e){return function(_0xa6c117){if(!_0xa6c117){_0x2b70d8[_0x92fa('0x33')](0x194);}return _0xa6c117;};}function handleError(_0x62cd67,_0x568696){_0x568696=_0x568696||0x1f4;return function(_0x34a898){logger[_0x92fa('0x24')](_0x34a898[_0x92fa('0x34')]);if(_0x34a898[_0x92fa('0x35')]){delete _0x34a898[_0x92fa('0x35')];}_0x62cd67[_0x92fa('0x29')](_0x568696)['send'](_0x34a898);};}exports[_0x92fa('0x36')]=function(_0x5aaa0b,_0x5caf75){var _0x2a3df0={},_0xe1c0a2={},_0x530f33={'count':0x0,'rows':[]};var _0x5404f0=_['map'](db[_0x92fa('0x37')][_0x92fa('0x38')],function(_0x4fdf22){return{'name':_0x4fdf22[_0x92fa('0x39')],'type':_0x4fdf22[_0x92fa('0x3a')]['key']};});_0xe1c0a2['model']=_['map'](_0x5404f0,_0x92fa('0x35'));_0xe1c0a2[_0x92fa('0x3b')]=_['keys'](_0x5aaa0b[_0x92fa('0x3b')]);_0xe1c0a2[_0x92fa('0x3c')]=_['intersection'](_0xe1c0a2[_0x92fa('0x3d')],_0xe1c0a2[_0x92fa('0x3b')]);_0x2a3df0[_0x92fa('0x3e')]=_['intersection'](_0xe1c0a2[_0x92fa('0x3d')],qs[_0x92fa('0x3f')](_0x5aaa0b[_0x92fa('0x3b')]['fields']));_0x2a3df0[_0x92fa('0x3e')]=_0x2a3df0[_0x92fa('0x3e')]['length']?_0x2a3df0[_0x92fa('0x3e')]:_0xe1c0a2[_0x92fa('0x3d')];if(!_0x5aaa0b['query'][_0x92fa('0x40')](_0x92fa('0x41'))){_0x2a3df0['limit']=qs[_0x92fa('0x2b')](_0x5aaa0b[_0x92fa('0x3b')]['limit']);_0x2a3df0[_0x92fa('0x2d')]=qs[_0x92fa('0x2d')](_0x5aaa0b[_0x92fa('0x3b')][_0x92fa('0x2d')]);}_0x2a3df0[_0x92fa('0x42')]=qs['sort'](_0x5aaa0b[_0x92fa('0x3b')][_0x92fa('0x43')]);_0x2a3df0[_0x92fa('0x44')]=qs[_0x92fa('0x3c')](_[_0x92fa('0x45')](_0x5aaa0b[_0x92fa('0x3b')],_0xe1c0a2['filters']),_0x5404f0);if(_0x5aaa0b[_0x92fa('0x3b')]['filter']){_0x2a3df0[_0x92fa('0x44')]=_[_0x92fa('0x46')](_0x2a3df0[_0x92fa('0x44')],{'$or':_['map'](_0x5404f0,function(_0x51489c){if(_0x51489c[_0x92fa('0x3a')]!=='VIRTUAL'){var _0x4681ba={};_0x4681ba[_0x51489c[_0x92fa('0x35')]]={'$like':'%'+_0x5aaa0b[_0x92fa('0x3b')][_0x92fa('0x47')]+'%'};return _0x4681ba;}})});}_0x2a3df0=_[_0x92fa('0x46')]({},_0x2a3df0,_0x5aaa0b[_0x92fa('0x48')]);var _0x3d4b64={'where':_0x2a3df0[_0x92fa('0x44')]};return db['OpenchannelMessage'][_0x92fa('0x2c')](_0x3d4b64)[_0x92fa('0x20')](function(_0x3e49e8){_0x530f33[_0x92fa('0x2c')]=_0x3e49e8;if(_0x5aaa0b['query'][_0x92fa('0x49')]){_0x2a3df0[_0x92fa('0x4a')]=[{'all':!![]}];}return db[_0x92fa('0x37')][_0x92fa('0x4b')](_0x2a3df0);})['then'](function(_0x227ec0){_0x530f33[_0x92fa('0x4c')]=_0x227ec0;return _0x530f33;})['then'](respondWithFilteredResult(_0x5caf75,_0x2a3df0))[_0x92fa('0x4d')](handleError(_0x5caf75,null));};exports['show']=function(_0x14307e,_0x469ead){var _0x20ff92={'raw':!![],'where':{'id':_0x14307e[_0x92fa('0x4e')]['id']}},_0x36bbd7={};_0x36bbd7['model']=_[_0x92fa('0x4f')](db[_0x92fa('0x37')][_0x92fa('0x38')]);_0x36bbd7[_0x92fa('0x3b')]=_['keys'](_0x14307e['query']);_0x36bbd7[_0x92fa('0x3c')]=_['intersection'](_0x36bbd7['model'],_0x36bbd7[_0x92fa('0x3b')]);_0x20ff92[_0x92fa('0x3e')]=_['intersection'](_0x36bbd7[_0x92fa('0x3d')],qs[_0x92fa('0x3f')](_0x14307e[_0x92fa('0x3b')][_0x92fa('0x3f')]));_0x20ff92[_0x92fa('0x3e')]=_0x20ff92[_0x92fa('0x3e')]['length']?_0x20ff92[_0x92fa('0x3e')]:_0x36bbd7[_0x92fa('0x3d')];if(_0x14307e['query'][_0x92fa('0x49')]){_0x20ff92[_0x92fa('0x4a')]=[{'all':!![]}];}_0x20ff92=_[_0x92fa('0x46')]({},_0x20ff92,_0x14307e['options']);return db[_0x92fa('0x37')][_0x92fa('0x50')](_0x20ff92)['then'](handleEntityNotFound(_0x469ead,null))[_0x92fa('0x20')](respondWithResult(_0x469ead,null))[_0x92fa('0x4d')](handleError(_0x469ead,null));};exports[_0x92fa('0x51')]=function(_0x55acc9,_0x1d470c){return db[_0x92fa('0x37')][_0x92fa('0x51')](_0x55acc9[_0x92fa('0x52')],{})[_0x92fa('0x20')](respondWithResult(_0x1d470c,0xc9))[_0x92fa('0x4d')](handleError(_0x1d470c,null));};exports[_0x92fa('0x31')]=function(_0x35ab86,_0x1894f8){if(_0x35ab86[_0x92fa('0x52')]['id']){delete _0x35ab86[_0x92fa('0x52')]['id'];}return db['OpenchannelMessage'][_0x92fa('0x50')]({'where':{'id':_0x35ab86[_0x92fa('0x4e')]['id']}})[_0x92fa('0x20')](handleEntityNotFound(_0x1894f8,null))[_0x92fa('0x20')](saveUpdates(_0x35ab86[_0x92fa('0x52')],null))[_0x92fa('0x20')](respondWithResult(_0x1894f8,null))[_0x92fa('0x4d')](handleError(_0x1894f8,null));};exports[_0x92fa('0x32')]=function(_0x52fda7,_0x1a960f){return db[_0x92fa('0x37')][_0x92fa('0x50')]({'where':{'id':_0x52fda7['params']['id']}})[_0x92fa('0x20')](handleEntityNotFound(_0x1a960f,null))[_0x92fa('0x20')](removeEntity(_0x1a960f,null))[_0x92fa('0x4d')](handleError(_0x1a960f,null));};exports[_0x92fa('0x53')]=function(_0x50508d,_0x4833dc){return db['OpenchannelMessage'][_0x92fa('0x53')]()['then'](respondWithResult(_0x4833dc,null))[_0x92fa('0x4d')](handleError(_0x4833dc,null));};var interaction_log=require(_0x92fa('0x54'))(_0x92fa('0x55'));exports[_0x92fa('0x56')]=function(_0x445300,_0x1c28ac,_0x268a51){var _0x5b583c={'agent':{},'channel':_0x92fa('0x57')};if(_0x445300[_0x92fa('0x52')]['id']){delete _0x445300['body']['id'];}_0x445300['body'][_0x92fa('0x58')]=!![];_0x445300[_0x92fa('0x52')][_0x92fa('0x59')]=moment()[_0x92fa('0x5a')](_0x92fa('0x5b'));_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')]=_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')]||_0x445300[_0x92fa('0x5d')]['id'];_0x5b583c[_0x92fa('0x5e')]['id']=_0x445300[_0x92fa('0x52')]['UserId'];return db['OpenchannelMessage'][_0x92fa('0x50')]({'where':{'id':_0x445300['params']['id'],'UserId':null}})[_0x92fa('0x20')](handleEntityNotFound(_0x1c28ac,null))[_0x92fa('0x20')](saveUpdates(_0x445300[_0x92fa('0x52')],null))['then'](function(_0x384e39){if(_0x384e39){_0x5b583c[_0x92fa('0x25')]=_0x384e39[_0x92fa('0x5f')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x384e39[_0x92fa('0x60')]}});}return null;})[_0x92fa('0x20')](handleEntityNotFound(_0x1c28ac,null))[_0x92fa('0x20')](function(_0x4aafb9){if(_0x4aafb9){return _0x4aafb9['update']({'UserId':_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')],'read1stAt':_['isNil'](_0x4aafb9[_0x92fa('0x61')])?moment()[_0x92fa('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x92fa('0x20')](function(_0x36b35a){if(_0x36b35a){_0x5b583c[_0x92fa('0x62')]=_0x36b35a[_0x92fa('0x5f')]({'plain':!![]});interaction_log[_0x92fa('0x27')](_0x92fa('0x63'),_0x445300[_0x92fa('0x5d')]['id'],_0x445300[_0x92fa('0x5d')][_0x92fa('0x35')],_0x445300[_0x92fa('0x5d')]['role'],_0x5b583c['interaction']['id'],_0x445300[_0x92fa('0x52')]?JSON[_0x92fa('0x64')](_0x445300[_0x92fa('0x52')]):_0x92fa('0x65'));return respondWithRpcPromise('AcceptMessage',_0x92fa('0x66'),_0x5b583c);}return null;})[_0x92fa('0x20')](function(_0x2d88f1){var _0x448ba9=_0x92fa('0x67')+_0x2d88f1[_0x92fa('0x25')]['ContactId'];return db[_0x92fa('0x68')][_0x92fa('0x3b')](_0x448ba9,{'type':db['Sequelize'][_0x92fa('0x69')][_0x92fa('0x6a')],'raw':!![]})['then'](function(_0x483bcb){return _0x483bcb;});})['then'](function(_0x321546){if(_0x321546){_0x5b583c['message'][_0x92fa('0x6b')]=_0x321546[0x0];if(!_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')])return;return db['User']['find']({'where':{'id':_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')],'role':_0x92fa('0x5e')},'attributes':['id',_0x92fa('0x35'),_0x92fa('0x6c'),'email',_0x92fa('0x6d')],'raw':!![]});}return null;})['then'](function(_0x5a09cc){if(!_0x5a09cc)return null;_0x5b583c['message']['agent']=_0x5a09cc;return _0x5b583c;})['then'](function(_0x13bf6b){if(_0x13bf6b){if(_0x445300['body'][_0x92fa('0x6e')]){_0x5b583c[_0x92fa('0x25')][_0x92fa('0x6f')]=util['format'](_0x92fa('0x70'),_0x445300[_0x92fa('0x5d')][_0x92fa('0x35')]);_0x5b583c[_0x92fa('0x25')][_0x92fa('0x71')]=_0x5b583c[_0x92fa('0x71')];_0x5b583c[_0x92fa('0x25')][_0x92fa('0x72')]=_0x5b583c[_0x92fa('0x71')];_0x5b583c[_0x92fa('0x25')][_0x92fa('0x73')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5b583c[_0x92fa('0x25')]},client9002)['then'](function(){return _0x5b583c;});}return _0x5b583c;}return null;})['then'](respondWithResult(_0x1c28ac,null))[_0x92fa('0x4d')](handleError(_0x1c28ac,null));};var interaction_log=require('../../config/logger')(_0x92fa('0x55'));exports[_0x92fa('0x74')]=function(_0x5acdf8,_0x16c08b,_0xc1be4e){var _0x2877e4={'agent':{},'channel':'openchannel'};if(_0x5acdf8[_0x92fa('0x52')]['id']){delete _0x5acdf8['body']['id'];}_0x5acdf8['body'][_0x92fa('0x5c')]=_0x5acdf8[_0x92fa('0x52')]['UserId']||_0x5acdf8[_0x92fa('0x5d')]['id'];_0x2877e4[_0x92fa('0x5e')]['id']=_0x5acdf8[_0x92fa('0x52')][_0x92fa('0x5c')];return db[_0x92fa('0x37')][_0x92fa('0x50')]({'where':{'id':_0x5acdf8[_0x92fa('0x4e')]['id'],'UserId':null}})[_0x92fa('0x20')](handleEntityNotFound(_0x16c08b,null))[_0x92fa('0x20')](function(_0x4e1fd1){if(_0x4e1fd1){_0x2877e4[_0x92fa('0x25')]=_0x4e1fd1[_0x92fa('0x5f')]({'plain':!![]});return db[_0x92fa('0x75')][_0x92fa('0x50')]({'where':{'id':_0x4e1fd1[_0x92fa('0x60')]}});}return null;})[_0x92fa('0x20')](handleEntityNotFound(_0x16c08b,null))[_0x92fa('0x20')](function(_0x37973d){if(_0x37973d){_0x2877e4['interaction']=_0x37973d[_0x92fa('0x5f')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5acdf8[_0x92fa('0x5d')]['id'],_0x5acdf8[_0x92fa('0x5d')][_0x92fa('0x35')],_0x5acdf8['user'][_0x92fa('0x76')],_0x2877e4['interaction']['id'],_0x5acdf8[_0x92fa('0x52')]?JSON['stringify'](_0x5acdf8[_0x92fa('0x52')]):'null');return respondWithRpcPromise(_0x92fa('0x77'),_0x92fa('0x78'),_0x2877e4);}return null;})[_0x92fa('0x20')](function(_0x298728){var _0x34e6fd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x298728[_0x92fa('0x25')][_0x92fa('0x79')];return db[_0x92fa('0x68')]['query'](_0x34e6fd,{'type':db[_0x92fa('0x7a')][_0x92fa('0x69')][_0x92fa('0x6a')],'raw':!![]})[_0x92fa('0x20')](function(_0x45101a){return _0x45101a;});})['then'](function(_0x3ced12){if(_0x3ced12){_0x2877e4['message'][_0x92fa('0x6b')]=_0x3ced12[0x0];if(!_0x5acdf8[_0x92fa('0x52')][_0x92fa('0x5c')])return;return db['User'][_0x92fa('0x50')]({'where':{'id':_0x5acdf8[_0x92fa('0x52')][_0x92fa('0x5c')],'role':'agent'},'attributes':['id',_0x92fa('0x35'),_0x92fa('0x6c'),'email',_0x92fa('0x6d')],'raw':!![]});}return null;})['then'](function(_0x17dd05){if(!_0x17dd05)return null;_0x2877e4[_0x92fa('0x25')][_0x92fa('0x5e')]=_0x17dd05;return _0x2877e4;})[_0x92fa('0x20')](function(_0x253ad1){if(_0x253ad1){_0x253ad1[_0x92fa('0x25')][_0x92fa('0x6f')]=util[_0x92fa('0x5a')](_0x92fa('0x70'),_0x5acdf8['user']['name']);_0x253ad1[_0x92fa('0x25')][_0x92fa('0x71')]=_0x2877e4[_0x92fa('0x71')];_0x253ad1[_0x92fa('0x25')]['motionChannel']=_0x2877e4[_0x92fa('0x71')];_0x253ad1[_0x92fa('0x25')][_0x92fa('0x73')]=_0x92fa('0x74');respondWithRpcPromise('EventManager',_0x92fa('0x7b'),{'event':'rejectmessage','message':_0x253ad1[_0x92fa('0x25')]},client9002);return _0x2877e4;}return null;})[_0x92fa('0x20')](respondWithResult(_0x16c08b,null))[_0x92fa('0x4d')](handleError(_0x16c08b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e6a6402..422a084 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 _0xfcf6=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2aa018,_0x57caab){var _0x1363f4=function(_0x1a33b6){while(--_0x1a33b6){_0x2aa018['push'](_0x2aa018['shift']());}};_0x1363f4(++_0x57caab);}(_0xfcf6,0x77));var _0x6fcf=function(_0x3e1fd6,_0x4b4d3f){_0x3e1fd6=_0x3e1fd6-0x0;var _0x340a20=_0xfcf6[_0x3e1fd6];return _0x340a20;};'use strict';var EventEmitter=require(_0x6fcf('0x0'));var OpenchannelMessage=require(_0x6fcf('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6fcf('0x2')](0x0);var events={'afterCreate':_0x6fcf('0x3'),'afterUpdate':_0x6fcf('0x4'),'afterDestroy':_0x6fcf('0x5')};function emitEvent(_0x2011e4){return function(_0x5bcb0b,_0x294481,_0x491ca5){OpenchannelMessageEvents['emit'](_0x2011e4+':'+_0x5bcb0b['id'],_0x5bcb0b);OpenchannelMessageEvents[_0x6fcf('0x6')](_0x2011e4,_0x5bcb0b);_0x491ca5(null);};}for(var e in events){if(events[_0x6fcf('0x7')](e)){var event=events[e];OpenchannelMessage[_0x6fcf('0x8')](e,emitEvent(event));}}module[_0x6fcf('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xe30d=['exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0x407867,_0x126b05){var _0x17e975=function(_0x366ce4){while(--_0x366ce4){_0x407867['push'](_0x407867['shift']());}};_0x17e975(++_0x126b05);}(_0xe30d,0x7f));var _0xde30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe30d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xde30('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xde30('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xde30('0x2')](0x0);var events={'afterCreate':_0xde30('0x3'),'afterUpdate':_0xde30('0x4'),'afterDestroy':_0xde30('0x5')};function emitEvent(_0x56ba60){return function(_0x3ef50f,_0x2b4d35,_0x28d6ed){OpenchannelMessageEvents['emit'](_0x56ba60+':'+_0x3ef50f['id'],_0x3ef50f);OpenchannelMessageEvents[_0xde30('0x6')](_0x56ba60,_0x3ef50f);_0x28d6ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xde30('0x7')](e,emitEvent(event));}}module[_0xde30('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 928d27a..13c093e 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 _0x41d1=['FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','Contact','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','body'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x41d1,0x90));var _0x141d=function(_0x152ea8,_0x3fb53f){_0x152ea8=_0x152ea8-0x0;var _0x4c0ebe=_0x41d1[_0x152ea8];return _0x4c0ebe;};'use strict';var _=require(_0x141d('0x0'));var util=require(_0x141d('0x1'));var logger=require('../../config/logger')(_0x141d('0x2'));var moment=require(_0x141d('0x3'));var BPromise=require('bluebird');var rp=require(_0x141d('0x4'));var fs=require('fs');var path=require(_0x141d('0x5'));var rimraf=require('rimraf');var config=require(_0x141d('0x6'));var attributes=require(_0x141d('0x7'));module['exports']=function(_0x5e97d8,_0x5ba6dc){return _0x5e97d8[_0x141d('0x8')](_0x141d('0x9'),attributes,{'tableName':_0x141d('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x141d('0xb')],'type':_0x141d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb3dcac,_0x141320,_0x4d3375){var _0x2af953=_0x5e97d8[_0x141d('0xd')];var _0x34ffcf=_0xb3dcac[_0x141d('0xe')]({'plain':!![]});if(_0x34ffcf[_0x141d('0xf')]['toLowerCase']()==='in'||_0x34ffcf[_0x141d('0xf')][_0x141d('0x10')]()===_0x141d('0x11')&&!_0x34ffcf[_0x141d('0x12')]&&!_[_0x141d('0x13')](_0x34ffcf['UserId'])){_0x2af953[_0x141d('0x14')][_0x141d('0x15')]({'where':{'id':_0x34ffcf[_0x141d('0x16')]}})['then'](function(_0x49b434){if(_0x49b434){_0x49b434[_0x141d('0x17')]({'lastMsgAt':_0x34ffcf[_0x141d('0x18')],'lastMsgDirection':_0x34ffcf['direction'][_0x141d('0x10')]()});}})[_0x141d('0x19')](function(_0x16d178){console[_0x141d('0x1a')](_0x16d178);});}if(_0x34ffcf['direction']===_0x141d('0x11')&&!_0x34ffcf['secret']){var _0x389ce3;_0x2af953[_0x141d('0x1b')][_0x141d('0x1c')]()[_0x141d('0x1d')](function(_0x360c4e){return _0x2af953[_0x141d('0x1e')][_0x141d('0x1f')]({'where':{'id':_0x34ffcf[_0x141d('0x20')]},'include':[{'model':_0x2af953[_0x141d('0x14')],'as':'Interactions','where':{'id':_0x34ffcf[_0x141d('0x16')]},'limit':0x1,'include':[{'model':_0x2af953['CmContact'],'as':'Contact','attributes':_[_0x141d('0x21')](_0x360c4e)}]}]});})[_0x141d('0x1d')](function(_0x58f7f6){_0x389ce3=_0x58f7f6[_0x141d('0xe')]({'plain':!![]});if(_0x389ce3&&_0x389ce3[_0x141d('0x22')]){logger[_0x141d('0x23')](_0x141d('0x24'),_0x141d('0x25'),util[_0x141d('0x26')](_0x141d('0x27'),_0x34ffcf['id'],_0x389ce3[_0x141d('0x22')]));if(_0x389ce3[_0x141d('0x28')]&&_0x389ce3[_0x141d('0x28')][_0x141d('0x29')]){_0x34ffcf[_0x141d('0x2a')]=_['omit'](_0x389ce3['Interactions'][0x0],_0x141d('0x2b'));_0x34ffcf['Contact']=_0x389ce3[_0x141d('0x28')][0x0]['Contact'];}var _0x141320={'method':'POST','uri':encodeURI(_0x389ce3[_0x141d('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x141320['method']){case _0x141d('0x2c'):_0x141320['qs']=_0x34ffcf;break;case _0x141d('0x2d'):_0x141320[_0x141d('0xb')]=_0x34ffcf;break;}return rp(_0x141320)['then'](function(_0x11f1fa){logger[_0x141d('0x23')](_0x141d('0x24'),_0x141d('0x25'),util['format'](_0x141d('0x2e'),_0x34ffcf['id'],_0x389ce3[_0x141d('0x22')]));if(_0x11f1fa[_0x141d('0xb')][_0x141d('0x2f')]&&_0x11f1fa['body']['threadId']!=_0x34ffcf[_0x141d('0x2a')][_0x141d('0x2f')]){return _0x2af953[_0x141d('0x14')][_0x141d('0x17')]({'threadId':_0x11f1fa[_0x141d('0xb')][_0x141d('0x2f')]},{'where':{'id':_0x34ffcf[_0x141d('0x2a')]['id']}});}else{return;}})['then'](function(){return _0xb3dcac[_0x141d('0x17')]({'read':!![]});})[_0x141d('0x19')](function(_0x2a316f){logger[_0x141d('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x141d('0x25'),util[_0x141d('0x30')](_0x2a316f,{'showHidden':![],'depth':null}));_0x4d3375();});}else{_0x4d3375();}})[_0x141d('0x31')](function(){_0x4d3375();});}else{_0x4d3375();}}},'charset':_0x141d('0x32'),'collate':_0x141d('0x33')});}; \ No newline at end of file +var _0x957c=['out','isNil','findOne','then','createdAt','error','secret','CmContact','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId','keys','replyUri','info','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','inspect','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','models','get','direction','toLowerCase'];(function(_0x501f76,_0x291b7e){var _0x15fbe4=function(_0x3c3504){while(--_0x3c3504){_0x501f76['push'](_0x501f76['shift']());}};_0x15fbe4(++_0x291b7e);}(_0x957c,0xf1));var _0xc957=function(_0x15211f,_0x37c029){_0x15211f=_0x15211f-0x0;var _0x2c9af1=_0x957c[_0x15211f];return _0x2c9af1;};'use strict';var _=require(_0xc957('0x0'));var util=require(_0xc957('0x1'));var logger=require(_0xc957('0x2'))(_0xc957('0x3'));var moment=require(_0xc957('0x4'));var BPromise=require(_0xc957('0x5'));var rp=require(_0xc957('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc957('0x7'));var config=require(_0xc957('0x8'));var attributes=require(_0xc957('0x9'));module[_0xc957('0xa')]=function(_0x3adcfa,_0x4b1c4b){return _0x3adcfa[_0xc957('0xb')](_0xc957('0xc'),attributes,{'tableName':_0xc957('0xd'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xc957('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x207ffe,_0x51353c,_0x41ab84){var _0x5c27c2=_0x3adcfa[_0xc957('0xf')];var _0x284231=_0x207ffe[_0xc957('0x10')]({'plain':!![]});if(_0x284231[_0xc957('0x11')][_0xc957('0x12')]()==='in'||_0x284231[_0xc957('0x11')]['toLowerCase']()===_0xc957('0x13')&&!_0x284231['secret']&&!_[_0xc957('0x14')](_0x284231['UserId'])){_0x5c27c2['OpenchannelInteraction'][_0xc957('0x15')]({'where':{'id':_0x284231['OpenchannelInteractionId']}})[_0xc957('0x16')](function(_0x50da96){if(_0x50da96){_0x50da96['update']({'lastMsgAt':_0x284231[_0xc957('0x17')],'lastMsgDirection':_0x284231[_0xc957('0x11')][_0xc957('0x12')]()});}})['catch'](function(_0x1d8056){console[_0xc957('0x18')](_0x1d8056);});}if(_0x284231[_0xc957('0x11')]===_0xc957('0x13')&&!_0x284231[_0xc957('0x19')]){var _0x20d79b;_0x5c27c2[_0xc957('0x1a')]['describe']()[_0xc957('0x16')](function(_0x4aab71){return _0x5c27c2[_0xc957('0x1b')][_0xc957('0x1c')]({'where':{'id':_0x284231[_0xc957('0x1d')]},'include':[{'model':_0x5c27c2[_0xc957('0x1e')],'as':_0xc957('0x1f'),'where':{'id':_0x284231[_0xc957('0x20')]},'limit':0x1,'include':[{'model':_0x5c27c2['CmContact'],'as':'Contact','attributes':_[_0xc957('0x21')](_0x4aab71)}]}]});})[_0xc957('0x16')](function(_0x1ca044){_0x20d79b=_0x1ca044[_0xc957('0x10')]({'plain':!![]});if(_0x20d79b&&_0x20d79b[_0xc957('0x22')]){logger[_0xc957('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0xc957('0x24'),_0x284231['id'],_0x20d79b[_0xc957('0x22')]));if(_0x20d79b[_0xc957('0x1f')]&&_0x20d79b[_0xc957('0x1f')][_0xc957('0x25')]){_0x284231[_0xc957('0x26')]=_[_0xc957('0x27')](_0x20d79b[_0xc957('0x1f')][0x0],_0xc957('0x28'));_0x284231[_0xc957('0x28')]=_0x20d79b[_0xc957('0x1f')][0x0][_0xc957('0x28')];}var _0x51353c={'method':_0xc957('0x29'),'uri':encodeURI(_0x20d79b[_0xc957('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x51353c[_0xc957('0x2a')]){case _0xc957('0x2b'):_0x51353c['qs']=_0x284231;break;case _0xc957('0x29'):_0x51353c['body']=_0x284231;break;}return rp(_0x51353c)[_0xc957('0x16')](function(_0x1fdedb){logger['info'](_0xc957('0x2c'),'afterCreate',util[_0xc957('0x2d')](_0xc957('0x2e'),_0x284231['id'],_0x20d79b[_0xc957('0x22')]));if(_0x1fdedb[_0xc957('0xe')]['threadId']&&_0x1fdedb[_0xc957('0xe')][_0xc957('0x2f')]!=_0x284231[_0xc957('0x26')]['threadId']){return _0x5c27c2[_0xc957('0x1e')][_0xc957('0x30')]({'threadId':_0x1fdedb[_0xc957('0xe')][_0xc957('0x2f')]},{'where':{'id':_0x284231[_0xc957('0x26')]['id']}});}else{return;}})['then'](function(){return _0x207ffe[_0xc957('0x30')]({'read':!![]});})[_0xc957('0x31')](function(_0x37db4e){logger[_0xc957('0x18')](_0xc957('0x2c'),'afterCreate',util[_0xc957('0x32')](_0x37db4e,{'showHidden':![],'depth':null}));_0x41ab84();});}else{_0x41ab84();}})['finally'](function(){_0x41ab84();});}else{_0x41ab84();}}},'charset':_0xc957('0x33'),'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 d91eabb..de944e1 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37e742,_0x3bad29){var _0x595965=function(_0x5d7f5f){while(--_0x5d7f5f){_0x37e742['push'](_0x37e742['shift']());}};_0x595965(++_0x3bad29);}(_0x1261,0x144));var _0x1126=function(_0x34f8ba,_0x2bb6a8){_0x34f8ba=_0x34f8ba-0x0;var _0xa5ed05=_0x1261[_0x34f8ba];return _0xa5ed05;};'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});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x36d57f,_0x2f9118){var _0x3f93fb=function(_0x567b58){while(--_0x567b58){_0x36d57f['push'](_0x36d57f['shift']());}};_0x3f93fb(++_0x2f9118);}(_0xdb28,0x106));var _0x8db2=function(_0x27aa81,_0x2e8750){_0x27aa81=_0x27aa81-0x0;var _0x559a99=_0xdb28[_0x27aa81];return _0x559a99;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8bc6b1b..b26b70e 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 _0x475e=['openchannelMessage:','./openchannelMessage.events','emit','removeListener','register','length'];(function(_0x4309d9,_0x5b0b57){var _0x1af166=function(_0x20d871){while(--_0x20d871){_0x4309d9['push'](_0x4309d9['shift']());}};_0x1af166(++_0x5b0b57);}(_0x475e,0x8b));var _0xe475=function(_0x4c0573,_0x234938){_0x4c0573=_0x4c0573-0x0;var _0xcd1707=_0x475e[_0x4c0573];return _0xcd1707;};'use strict';var OpenchannelMessageEvents=require(_0xe475('0x0'));var events=['save','remove','update'];function createListener(_0x129291,_0x490249){return function(_0x11bc3b){_0x490249[_0xe475('0x1')](_0x129291,_0x11bc3b);};}function removeListener(_0x164f02,_0x2dfec4){return function(){OpenchannelMessageEvents[_0xe475('0x2')](_0x164f02,_0x2dfec4);};}exports[_0xe475('0x3')]=function(_0x308359){for(var _0x4a6517=0x0,_0x15b08b=events[_0xe475('0x4')];_0x4a6517<_0x15b08b;_0x4a6517++){var _0x5c9c70=events[_0x4a6517];var _0x3be177=createListener(_0xe475('0x5')+_0x5c9c70,_0x308359);OpenchannelMessageEvents['on'](_0x5c9c70,_0x3be177);}}; \ No newline at end of file +var _0x15b2=['openchannelMessage:','save','update','emit','register','length'];(function(_0x48ccc4,_0x4045e4){var _0x49d8bd=function(_0x25fc2b){while(--_0x25fc2b){_0x48ccc4['push'](_0x48ccc4['shift']());}};_0x49d8bd(++_0x4045e4);}(_0x15b2,0x145));var _0x215b=function(_0x2141ee,_0x4181e5){_0x2141ee=_0x2141ee-0x0;var _0x5bdc07=_0x15b2[_0x2141ee];return _0x5bdc07;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x215b('0x0'),'remove',_0x215b('0x1')];function createListener(_0x2ffbd3,_0x57263a){return function(_0x31ce87){_0x57263a[_0x215b('0x2')](_0x2ffbd3,_0x31ce87);};}function removeListener(_0x62c5ce,_0x506d00){return function(){OpenchannelMessageEvents['removeListener'](_0x62c5ce,_0x506d00);};}exports[_0x215b('0x3')]=function(_0x4ffb8e){for(var _0x2d8ea5=0x0,_0x3a5a4b=events[_0x215b('0x4')];_0x2d8ea5<_0x3a5a4b;_0x2d8ea5++){var _0x1a8033=events[_0x2d8ea5];var _0x2b64dc=createListener(_0x215b('0x5')+_0x1a8033,_0x4ffb8e);OpenchannelMessageEvents['on'](_0x1a8033,_0x2b64dc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 488da00..18cd3be 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 _0x995a=['../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','update','destroy','delete','removeTeams','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x7d48be,_0x18a3a3){var _0x1bd822=function(_0x2587f8){while(--_0x2587f8){_0x7d48be['push'](_0x7d48be['shift']());}};_0x1bd822(++_0x18a3a3);}(_0x995a,0x1ef));var _0xa995=function(_0x13f379,_0x5e7415){_0x13f379=_0x13f379-0x0;var _0x2bc237=_0x995a[_0x13f379];return _0x2bc237;};'use strict';var multer=require('multer');var util=require(_0xa995('0x0'));var path=require(_0xa995('0x1'));var timeout=require(_0xa995('0x2'));var express=require('express');var router=express[_0xa995('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa995('0x4'));var interaction=require(_0xa995('0x5'));var config=require('../../config/environment');var controller=require(_0xa995('0x6'));router[_0xa995('0x7')]('/',auth[_0xa995('0x8')](),controller[_0xa995('0x9')]);router[_0xa995('0x7')](_0xa995('0xa'),auth['isAuthenticated'](),controller[_0xa995('0xb')]);router[_0xa995('0x7')](_0xa995('0xc'),auth[_0xa995('0x8')](),controller[_0xa995('0xd')]);router['get'](_0xa995('0xe'),auth[_0xa995('0x8')](),controller[_0xa995('0xf')]);router[_0xa995('0x7')](_0xa995('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0xa995('0x7')](_0xa995('0x11'),auth[_0xa995('0x8')](),controller[_0xa995('0x12')]);router[_0xa995('0x13')]('/',auth['isAuthenticated'](),controller[_0xa995('0x14')]);router[_0xa995('0x13')](_0xa995('0x10'),auth[_0xa995('0x8')](),controller['addTeams']);router[_0xa995('0x13')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xa995('0xc'),auth[_0xa995('0x8')](),controller[_0xa995('0x15')]);router['delete'](_0xa995('0xc'),auth['isAuthenticated'](),controller[_0xa995('0x16')]);router[_0xa995('0x17')]('/:id/teams',auth[_0xa995('0x8')](),controller[_0xa995('0x18')]);router[_0xa995('0x17')](_0xa995('0x11'),auth[_0xa995('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe9b6=['show','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xe9b6,0x177));var _0x6e9b=function(_0x18464f,_0xd2987){_0x18464f=_0x18464f-0x0;var _0x217a71=_0xe9b6[_0x18464f];return _0x217a71;};'use strict';var multer=require(_0x6e9b('0x0'));var util=require(_0x6e9b('0x1'));var path=require(_0x6e9b('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e9b('0x3'));var router=express[_0x6e9b('0x4')]();var fs_extra=require(_0x6e9b('0x5'));var auth=require(_0x6e9b('0x6'));var interaction=require(_0x6e9b('0x7'));var config=require(_0x6e9b('0x8'));var controller=require(_0x6e9b('0x9'));router[_0x6e9b('0xa')]('/',auth[_0x6e9b('0xb')](),controller[_0x6e9b('0xc')]);router[_0x6e9b('0xa')](_0x6e9b('0xd'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0xe')]);router['get']('/:id',auth[_0x6e9b('0xb')](),controller[_0x6e9b('0xf')]);router[_0x6e9b('0xa')]('/:id/members',auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x10')]);router[_0x6e9b('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6e9b('0x11')]);router[_0x6e9b('0xa')](_0x6e9b('0x12'),auth[_0x6e9b('0xb')](),controller['getAgents']);router[_0x6e9b('0x13')]('/',auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x14')]);router[_0x6e9b('0x13')](_0x6e9b('0x15'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x16')]);router['post'](_0x6e9b('0x12'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x17')]);router[_0x6e9b('0x18')](_0x6e9b('0x19'),auth[_0x6e9b('0xb')](),controller['update']);router[_0x6e9b('0x1a')](_0x6e9b('0x19'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x1b')]);router[_0x6e9b('0x1a')]('/:id/teams',auth[_0x6e9b('0xb')](),controller['removeTeams']);router[_0x6e9b('0x1a')](_0x6e9b('0x12'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x1c')]);module[_0x6e9b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9673f06..f4ce859 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 _0xce11=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x51ce35,_0x2b333a){var _0x2a60cf=function(_0x883508){while(--_0x883508){_0x51ce35['push'](_0x51ce35['shift']());}};_0x2a60cf(++_0x2b333a);}(_0xce11,0xf0));var _0x1ce1=function(_0x1db7ec,_0x55f012){_0x1db7ec=_0x1db7ec-0x0;var _0x4632a6=_0xce11[_0x1db7ec];return _0x4632a6;};'use strict';var Sequelize=require(_0x1ce1('0x0'));module[_0x1ce1('0x1')]={'name':{'type':Sequelize[_0x1ce1('0x2')],'unique':_0x1ce1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1ce1('0x2')]},'timeout':{'type':Sequelize[_0x1ce1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ce1('0x5')](_0x1ce1('0x6'),_0x1ce1('0x7'),_0x1ce1('0x8'))}}; \ No newline at end of file +var _0x9331=['name','STRING','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0xbf1132,_0x176b34){var _0xe63ce4=function(_0x52d8ed){while(--_0x52d8ed){_0xbf1132['push'](_0xbf1132['shift']());}};_0xe63ce4(++_0x176b34);}(_0x9331,0xde));var _0x1933=function(_0x235d85,_0x2db080){_0x235d85=_0x235d85-0x0;var _0x559ead=_0x9331[_0x235d85];return _0x559ead;};'use strict';var Sequelize=require(_0x1933('0x0'));module[_0x1933('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1933('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1933('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1933('0x4')](_0x1933('0x5'),_0x1933('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index bf80e19..15e7ee1 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 _0x284d=['keys','filters','attributes','fields','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','intersection','nolimit','order','sort','pick','OpenchannelQueueId','filter','User','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','userOpenchannelQueue:save','ids','select','field','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','show','params','model'];(function(_0x352760,_0xe57f42){var _0x38ec16=function(_0x3f4433){while(--_0x3f4433){_0x352760['push'](_0x352760['shift']());}};_0x38ec16(++_0xe57f42);}(_0x284d,0x1b0));var _0xd284=function(_0x189aa8,_0xfb11c3){_0x189aa8=_0x189aa8-0x0;var _0xe29e44=_0x284d[_0x189aa8];return _0xe29e44;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xd284('0x0'));var squel=require('squel');var Redis=require(_0xd284('0x1'));var qs=require(_0xd284('0x2'));var logger=require(_0xd284('0x3'))('api');var config=require(_0xd284('0x4'));var db=require(_0xd284('0x5'))['db'];config['redis']=_[_0xd284('0x6')](config[_0xd284('0x7')],{'host':_0xd284('0x8'),'port':0x18eb});var socket=require(_0xd284('0x9'))(new Redis(config[_0xd284('0x7')]));require(_0xd284('0xa'))['register'](socket);function respondWithStatusCode(_0x5c7eec,_0x3ca3cc){_0x3ca3cc=_0x3ca3cc||0xcc;return function(_0x3b520e){if(_0x3b520e){return _0x5c7eec[_0xd284('0xb')](_0x3ca3cc);}return _0x5c7eec['status'](_0x3ca3cc)['end']();};}function respondWithResult(_0x9a64c8,_0x575daa){_0x575daa=_0x575daa||0xc8;return function(_0x3cabcc){if(_0x3cabcc){return _0x9a64c8['status'](_0x575daa)[_0xd284('0xc')](_0x3cabcc);}};}function respondWithFilteredResult(_0x402565,_0x34429f){return function(_0x375de7){if(_0x375de7){var _0x387477=typeof _0x34429f['offset']===_0xd284('0xd')&&typeof _0x34429f[_0xd284('0xe')]===_0xd284('0xd');var _0x1342d9=_0x375de7[_0xd284('0xf')];var _0x170ac7=_0x387477?0x0:_0x34429f[_0xd284('0x10')];var _0x1862db=_0x387477?_0x375de7[_0xd284('0xf')]:_0x34429f[_0xd284('0x10')]+_0x34429f[_0xd284('0xe')];var _0x3e1536;if(_0x1862db>=_0x1342d9){_0x1862db=_0x1342d9;_0x3e1536=0xc8;}else{_0x3e1536=0xce;}_0x402565[_0xd284('0x11')](_0x3e1536);return _0x402565[_0xd284('0x12')](_0xd284('0x13'),_0x170ac7+'-'+_0x1862db+'/'+_0x1342d9)[_0xd284('0xc')](_0x375de7);}return null;};}function saveUpdates(_0x1938ef){return function(_0x5385b4){if(_0x5385b4){return _0x5385b4[_0xd284('0x14')](_0x1938ef)['then'](function(_0x8134e2){return _0x8134e2;});}return null;};}function removeEntity(_0x42cac4){return function(_0x12b34c){if(_0x12b34c){return _0x12b34c[_0xd284('0x15')]()[_0xd284('0x16')](function(){var _0x2a4f15=_0x12b34c[_0xd284('0x17')]({'plain':!![]});var _0x3fd9d7=_0xd284('0x18');return db[_0xd284('0x19')][_0xd284('0x15')]({'where':{'type':_0x3fd9d7,'resourceId':_0x2a4f15['id']}})[_0xd284('0x16')](function(){return _0x12b34c;});})['then'](function(){_0x42cac4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x147671){return function(_0x2f1205){if(!_0x2f1205){_0x147671[_0xd284('0xb')](0x194);}return _0x2f1205;};}function handleError(_0x3c13c6,_0x13f731){_0x13f731=_0x13f731||0x1f4;return function(_0x1c7c8b){logger[_0xd284('0x1a')](_0x1c7c8b[_0xd284('0x1b')]);if(_0x1c7c8b[_0xd284('0x1c')]){delete _0x1c7c8b[_0xd284('0x1c')];}_0x3c13c6['status'](_0x13f731)['send'](_0x1c7c8b);};}exports[_0xd284('0x1d')]=function(_0x3d1cc2,_0x8045b5){var _0x5d0ebf={};var _0x3b8ef6={'count':0x0,'rows':[]};var _0x3a28d5=_[_0xd284('0x1e')](db[_0xd284('0x1f')][_0xd284('0x20')],function(_0x5ec642){return{'name':_0x5ec642['fieldName'],'type':_0x5ec642[_0xd284('0x21')][_0xd284('0x22')]};});_0x5d0ebf=qs[_0xd284('0x23')](_0x3a28d5,_0x3d1cc2);var _0x4609ce={'where':_0x5d0ebf[_0xd284('0x24')]};return db[_0xd284('0x1f')]['count'](_0x4609ce)[_0xd284('0x16')](function(_0x14dec6){_0x3b8ef6['count']=_0x14dec6;_0x5d0ebf['include']=qs[_0xd284('0x25')](_0x3d1cc2[_0xd284('0x26')]);return db[_0xd284('0x1f')][_0xd284('0x27')](_0x5d0ebf);})['then'](function(_0x5a2df1){_0x3b8ef6[_0xd284('0x28')]=_0x5a2df1;return _0x3b8ef6;})[_0xd284('0x16')](respondWithFilteredResult(_0x8045b5,_0x5d0ebf))['catch'](handleError(_0x8045b5,null));};exports[_0xd284('0x29')]=function(_0x29ab9e,_0x79f2c4){var _0x1a19c4={'raw':!![],'where':{'id':_0x29ab9e[_0xd284('0x2a')]['id']}},_0x178400={};_0x178400[_0xd284('0x2b')]=_[_0xd284('0x2c')](db['OpenchannelQueue']['rawAttributes']);_0x178400[_0xd284('0x26')]=_[_0xd284('0x2c')](_0x29ab9e[_0xd284('0x26')]);_0x178400[_0xd284('0x2d')]=_['intersection'](_0x178400[_0xd284('0x2b')],_0x178400[_0xd284('0x26')]);_0x1a19c4[_0xd284('0x2e')]=_['intersection'](_0x178400['model'],qs[_0xd284('0x2f')](_0x29ab9e[_0xd284('0x26')][_0xd284('0x2f')]));_0x1a19c4[_0xd284('0x2e')]=_0x1a19c4[_0xd284('0x2e')][_0xd284('0x30')]?_0x1a19c4[_0xd284('0x2e')]:_0x178400[_0xd284('0x2b')];if(_0x29ab9e[_0xd284('0x26')][_0xd284('0x31')]){_0x1a19c4[_0xd284('0x25')]=[{'all':!![]}];}_0x1a19c4=_[_0xd284('0x32')]({},_0x1a19c4,_0x29ab9e[_0xd284('0x33')]);return db[_0xd284('0x1f')][_0xd284('0x34')](_0x1a19c4)['then'](handleEntityNotFound(_0x79f2c4,null))['then'](respondWithResult(_0x79f2c4,null))[_0xd284('0x35')](handleError(_0x79f2c4,null));};exports[_0xd284('0x36')]=function(_0x2f1615,_0x97cd2f){return db[_0xd284('0x1f')]['create'](_0x2f1615[_0xd284('0x37')],{})[_0xd284('0x16')](function(_0x1acb17){var _0x324a91=_0x2f1615['user']['get']({'plain':!![]});if(!_0x324a91)throw new Error(_0xd284('0x38'));if(_0x324a91['role']==='user'){var _0x1ddf04=_0x1acb17[_0xd284('0x17')]({'plain':!![]});var _0x5c81ec=_0xd284('0x18');return db[_0xd284('0x39')][_0xd284('0x34')]({'where':{'name':_0x5c81ec,'userProfileId':_0x324a91['userProfileId']},'raw':!![]})[_0xd284('0x16')](function(_0x4c9c3d){if(_0x4c9c3d&&_0x4c9c3d['autoAssociation']===0x0){return db[_0xd284('0x19')][_0xd284('0x36')]({'name':_0x1ddf04[_0xd284('0x1c')],'resourceId':_0x1ddf04['id'],'type':_0x4c9c3d['name'],'sectionId':_0x4c9c3d['id']},{})[_0xd284('0x16')](function(){return _0x1acb17;});}else{return _0x1acb17;}})[_0xd284('0x35')](function(_0x3aa864){logger[_0xd284('0x1a')](_0xd284('0x3a'),_0x3aa864);throw _0x3aa864;});}return _0x1acb17;})[_0xd284('0x16')](respondWithResult(_0x97cd2f,0xc9))[_0xd284('0x35')](handleError(_0x97cd2f,null));};exports[_0xd284('0x14')]=function(_0x18f010,_0x5e3873){if(_0x18f010[_0xd284('0x37')]['id']){delete _0x18f010[_0xd284('0x37')]['id'];}return db[_0xd284('0x1f')][_0xd284('0x34')]({'where':{'id':_0x18f010[_0xd284('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5e3873,null))[_0xd284('0x16')](saveUpdates(_0x18f010['body'],null))[_0xd284('0x16')](respondWithResult(_0x5e3873,null))[_0xd284('0x35')](handleError(_0x5e3873,null));};exports[_0xd284('0x15')]=function(_0x4925fd,_0x546ff1){return db[_0xd284('0x1f')]['find']({'where':{'id':_0x4925fd['params']['id']}})[_0xd284('0x16')](handleEntityNotFound(_0x546ff1,null))['then'](removeEntity(_0x546ff1,null))[_0xd284('0x35')](handleError(_0x546ff1,null));};exports[_0xd284('0x3b')]=function(_0x418d7f,_0xf7c4f){return db[_0xd284('0x1f')]['describe']()[_0xd284('0x16')](respondWithResult(_0xf7c4f,null))[_0xd284('0x35')](handleError(_0xf7c4f,null));};exports[_0xd284('0x3c')]=function(_0x482afa,_0x4d3e70){var _0x2c3309={'raw':!![],'where':{}},_0x222717={},_0x4cab5e;return db[_0xd284('0x1f')][_0xd284('0x3d')]({'where':{'id':_0x482afa[_0xd284('0x2a')]['id']}})[_0xd284('0x16')](handleEntityNotFound(_0x4d3e70,null))[_0xd284('0x16')](function(_0x499412){if(_0x499412){_0x4cab5e=_0x499412[_0xd284('0x17')]({'plain':!![]});_0x222717['model']=_[_0xd284('0x2c')](db[_0xd284('0x3e')][_0xd284('0x20')]);_0x222717[_0xd284('0x26')]=_[_0xd284('0x2c')](_0x482afa[_0xd284('0x26')]);_0x222717['filters']=_['intersection'](_0x222717[_0xd284('0x2b')],_0x222717['query']);_0x2c3309[_0xd284('0x2e')]=_[_0xd284('0x3f')](_0x222717[_0xd284('0x2b')],qs[_0xd284('0x2f')](_0x482afa[_0xd284('0x26')]['fields']));_0x2c3309[_0xd284('0x2e')]=_0x2c3309['attributes'][_0xd284('0x30')]?_0x2c3309['attributes']:_0x222717['model'];if(!_0x482afa[_0xd284('0x26')]['hasOwnProperty'](_0xd284('0x40'))){_0x2c3309[_0xd284('0xe')]=qs[_0xd284('0xe')](_0x482afa[_0xd284('0x26')]['limit']);_0x2c3309['offset']=qs[_0xd284('0x10')](_0x482afa['query'][_0xd284('0x10')]);}_0x2c3309[_0xd284('0x41')]=qs[_0xd284('0x42')](_0x482afa[_0xd284('0x26')][_0xd284('0x42')]);_0x2c3309['where']=qs[_0xd284('0x2d')](_[_0xd284('0x43')](_0x482afa[_0xd284('0x26')],_0x222717['filters']));_0x2c3309[_0xd284('0x24')][_0xd284('0x44')]=_0x499412['id'];if(_0x482afa[_0xd284('0x26')][_0xd284('0x45')]){_0x2c3309[_0xd284('0x24')]=_[_0xd284('0x32')](_0x2c3309[_0xd284('0x24')],{'$or':_[_0xd284('0x1e')](_0x2c3309['attributes'],function(_0x1e4332){var _0x46ecca={};_0x46ecca[_0x1e4332]={'$like':'%'+_0x482afa[_0xd284('0x26')]['filter']+'%'};return _0x46ecca;})});}_0x2c3309=_[_0xd284('0x32')]({},_0x2c3309,_0x482afa['options']);return db[_0xd284('0x3e')][_0xd284('0x27')](_0x2c3309);}})[_0xd284('0x16')](function(_0x1af730){if(_0x1af730){return db[_0xd284('0x46')]['findAndCountAll']({'where':{'id':_[_0xd284('0x1e')](_0x1af730,'UserId'),'role':_0xd284('0x47')},'attributes':['id',_0xd284('0x1c'),_0xd284('0x48'),_0xd284('0x49'),_0xd284('0x4a')]});}})['then'](function(_0x24a92b){if(_0x24a92b){return{'count':_0x24a92b[_0xd284('0xf')],'rows':_[_0xd284('0x1e')](_0x24a92b[_0xd284('0x28')],function(_0x4061c5){return{'membername':_0x4061c5['name'],'UserId':_0x4061c5['id'],'queue_name':_0x4cab5e[_0xd284('0x1c')],'OpenchannelQueueId':_0x4cab5e['id'],'interface':util['format'](_0xd284('0x4b'),_0xd284('0x4c'),_0x4061c5['name']),'penalty':0x0,'paused':_0x4061c5[_0xd284('0x48')],'createdAt':_0x4061c5[_0xd284('0x4a')],'updatedAt':_0x4061c5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d3e70,_0x2c3309))[_0xd284('0x35')](handleError(_0x4d3e70,null));};exports[_0xd284('0x4d')]=function(_0x29f8ef,_0x5af997){var _0x4ce99a={};var _0x3c589c={};var _0x59effd;var _0x560edb;return db[_0xd284('0x1f')][_0xd284('0x3d')]({'where':{'id':_0x29f8ef[_0xd284('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5af997,null))[_0xd284('0x16')](function(_0xd8d82){if(_0xd8d82){_0x59effd=_0xd8d82;_0x3c589c[_0xd284('0x2b')]=_['keys'](db[_0xd284('0x4e')][_0xd284('0x20')]);_0x3c589c['query']=_['keys'](_0x29f8ef['query']);_0x3c589c[_0xd284('0x2d')]=_[_0xd284('0x3f')](_0x3c589c[_0xd284('0x2b')],_0x3c589c['query']);_0x4ce99a[_0xd284('0x2e')]=_[_0xd284('0x3f')](_0x3c589c[_0xd284('0x2b')],qs[_0xd284('0x2f')](_0x29f8ef[_0xd284('0x26')][_0xd284('0x2f')]));_0x4ce99a[_0xd284('0x2e')]=_0x4ce99a[_0xd284('0x2e')][_0xd284('0x30')]?_0x4ce99a['attributes']:_0x3c589c['model'];_0x4ce99a[_0xd284('0x41')]=qs[_0xd284('0x42')](_0x29f8ef[_0xd284('0x26')]['sort']);_0x4ce99a['where']=qs[_0xd284('0x2d')](_[_0xd284('0x43')](_0x29f8ef[_0xd284('0x26')],_0x3c589c[_0xd284('0x2d')]));if(_0x29f8ef['query'][_0xd284('0x45')]){_0x4ce99a[_0xd284('0x24')]=_['merge'](_0x4ce99a['where'],{'$or':_['map'](_0x4ce99a[_0xd284('0x2e')],function(_0x3394d0){var _0x7bc73a={};_0x7bc73a[_0x3394d0]={'$like':'%'+_0x29f8ef[_0xd284('0x26')][_0xd284('0x45')]+'%'};return _0x7bc73a;})});}_0x4ce99a=_[_0xd284('0x32')]({},_0x4ce99a,_0x29f8ef[_0xd284('0x33')]);return _0x59effd[_0xd284('0x4d')](_0x4ce99a);}})['then'](function(_0xe6c284){if(_0xe6c284){_0x560edb=_0xe6c284[_0xd284('0x30')];if(!_0x29f8ef[_0xd284('0x26')][_0xd284('0x4f')](_0xd284('0x40'))){_0x4ce99a[_0xd284('0xe')]=qs[_0xd284('0xe')](_0x29f8ef[_0xd284('0x26')][_0xd284('0xe')]);_0x4ce99a[_0xd284('0x10')]=qs[_0xd284('0x10')](_0x29f8ef['query'][_0xd284('0x10')]);}return _0x59effd[_0xd284('0x4d')](_0x4ce99a);}})['then'](function(_0xc36d56){if(_0xc36d56){return _0xc36d56?{'count':_0x560edb,'rows':_0xc36d56}:null;}})[_0xd284('0x16')](respondWithResult(_0x5af997,null))[_0xd284('0x35')](handleError(_0x5af997,null));};exports[_0xd284('0x50')]=function(_0x8e7d4,_0x56859d){var _0x5af4dc=_0x8e7d4[_0xd284('0x37')]['ids'];return db[_0xd284('0x4e')][_0xd284('0x27')]({'where':{'id':_0x5af4dc},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd284('0x51'),'attributes':['id',_0xd284('0x1c'),_0xd284('0x52'),_0xd284('0x53'),_0xd284('0x54')],'raw':!![]}]})[_0xd284('0x16')](function(_0x21b9d7){if(_0x21b9d7){var _0x557463=_[_0xd284('0x55')](_0x21b9d7,function(_0x14063f){var _0xc05b9=_0x14063f[_0xd284('0x17')]({'plain':!![]});return _0xc05b9[_0xd284('0x51')];});return db['OpenchannelQueue'][_0xd284('0x34')]({'where':{'id':_0x8e7d4['params']['id']}})['then'](function(_0x2d3df2){return db['sequelize'][_0xd284('0x56')](function(_0x37c155){return _0x2d3df2[_0xd284('0x50')](_0x5af4dc,{'transaction':_0x37c155})['then'](function(){return BPromise[_0xd284('0x57')](_0x557463,function(_0xfe1421){return db[_0xd284('0x3e')]['findOrCreate']({'where':{'UserId':_0xfe1421['id'],'OpenchannelQueueId':_0x8e7d4['params']['id']},'transaction':_0x37c155});});})[_0xd284('0x16')](function(){_0x557463[_0xd284('0x58')](function(_0x1ba200){socket[_0xd284('0x59')](_0xd284('0x5a'),{'UserId':_0x1ba200['id'],'OpenchannelQueueId':_0x2d3df2['id']});});});});});}})[_0xd284('0x16')](respondWithStatusCode(_0x56859d,null))[_0xd284('0x35')](handleError(_0x56859d,null));};exports['removeTeams']=function(_0x7b2964,_0x210a72){return db[_0xd284('0x4e')]['findAll']({'where':{'id':_0x7b2964[_0xd284('0x26')][_0xd284('0x5b')]},'attributes':['id'],'include':[{'model':db[_0xd284('0x46')],'as':_0xd284('0x51'),'attributes':['id'],'raw':!![]}]})[_0xd284('0x16')](handleEntityNotFound(_0x210a72,null))[_0xd284('0x16')](function(_0x440453){var _0x5cca05=_[_0xd284('0x1e')](_0x440453,'id');var _0x164b1c=[];var _0x5a5dea=[];var _0x371874=squel[_0xd284('0x5c')]();_0x371874[_0xd284('0x5d')]('tq.TeamId')[_0xd284('0x5e')](_0xd284('0x5f'),'tq')[_0xd284('0x60')]('user_has_teams','ut',_0xd284('0x61'))[_0xd284('0x24')](_0xd284('0x62'),_0x7b2964[_0xd284('0x2a')]['id']);for(var _0x1f5d41=0x0;_0x1f5d41<_0x440453[_0xd284('0x30')];_0x1f5d41+=0x1){let _0x1ba1bd=_0x440453[_0x1f5d41];for(var _0x3bccd1=0x0;_0x3bccd1<_0x1ba1bd[_0xd284('0x51')][_0xd284('0x30')];_0x3bccd1+=0x1){let _0x58d26b=_0x1ba1bd[_0xd284('0x51')][_0x3bccd1];var _0x266dd2=_0x371874[_0xd284('0x63')]();_0x266dd2[_0xd284('0x24')]('ut.UserId\x20=\x20?',_0x58d26b['id']);_0x5a5dea[_0xd284('0x64')](db[_0xd284('0x65')][_0xd284('0x26')](_0x266dd2[_0xd284('0x66')](),{'type':db['sequelize'][_0xd284('0x67')]['SELECT']})[_0xd284('0x16')](function(_0x1a1b0f){if(_0x1a1b0f['length']===0x1){return _0x58d26b['id'];}else{var _0x11cde3=_[_0xd284('0x68')](_[_0xd284('0x1e')](_0x1a1b0f,_0xd284('0x69')),function(_0x2801c9){return _[_0xd284('0x6a')](_0x5cca05,_0x2801c9);});if(_0x11cde3){return _0x58d26b['id'];}}}));}}return BPromise[_0xd284('0x6b')](_0x5a5dea)['then'](function(_0x24f9a7){_0x164b1c=_(_0x164b1c)[_0xd284('0x6c')](_0x24f9a7)[_0xd284('0x6d')]()[_0xd284('0x6e')]();return db['OpenchannelQueue'][_0xd284('0x34')]({'where':{'id':_0x7b2964['params']['id']}})[_0xd284('0x16')](function(_0x4ca317){return db['sequelize']['transaction'](function(_0x5130b2){return _0x4ca317[_0xd284('0x6f')](_0x7b2964[_0xd284('0x26')][_0xd284('0x5b')],{'transaction':_0x5130b2})[_0xd284('0x16')](function(){if(!_[_0xd284('0x70')](_0x164b1c)){return _0x4ca317[_0xd284('0x71')](_0x164b1c,{'transaction':_0x5130b2});}})['then'](function(){_0x164b1c[_0xd284('0x58')](function(_0x561736){socket[_0xd284('0x59')](_0xd284('0x72'),{'UserId':_0x561736,'OpenchannelQueueId':_0x4ca317['id']});});});});});});})['then'](respondWithStatusCode(_0x210a72,null))[_0xd284('0x35')](handleError(_0x210a72,null));};exports[_0xd284('0x73')]=function(_0xc878a3,_0x16ac03){return db['OpenchannelQueue'][_0xd284('0x34')]({'where':{'id':_0xc878a3[_0xd284('0x2a')]['id']}})[_0xd284('0x16')](handleEntityNotFound(_0x16ac03,null))[_0xd284('0x16')](function(_0x1b5dc3){if(_0x1b5dc3){return _0x1b5dc3[_0xd284('0x73')](_0xc878a3[_0xd284('0x37')]['ids'],_[_0xd284('0x74')](_0xc878a3[_0xd284('0x37')],[_0xd284('0x5b'),'id'])||{})[_0xd284('0x75')](function(_0x1f7b37){for(var _0x197843=0x0;_0x197843<_0xc878a3[_0xd284('0x37')][_0xd284('0x5b')][_0xd284('0x30')];_0x197843+=0x1){socket[_0xd284('0x59')](_0xd284('0x5a'),{'UserId':Number(_0xc878a3[_0xd284('0x37')]['ids'][_0x197843]),'OpenchannelQueueId':Number(_0xc878a3['params']['id'])});}return _0x1f7b37;});}})[_0xd284('0x16')](respondWithResult(_0x16ac03,null))[_0xd284('0x35')](handleError(_0x16ac03,null));};exports[_0xd284('0x71')]=function(_0x1688fa,_0xcb137f){return db[_0xd284('0x1f')][_0xd284('0x34')]({'where':{'id':_0x1688fa[_0xd284('0x2a')]['id']}})[_0xd284('0x16')](handleEntityNotFound(_0xcb137f,null))[_0xd284('0x16')](function(_0x3e02d5){if(_0x3e02d5){return _0x3e02d5[_0xd284('0x71')](_0x1688fa[_0xd284('0x26')][_0xd284('0x5b')])['then'](function(){if(_['isArray'](_0x1688fa[_0xd284('0x26')][_0xd284('0x5b')])){for(var _0xb31390=0x0;_0xb31390<_0x1688fa[_0xd284('0x26')][_0xd284('0x5b')][_0xd284('0x30')];_0xb31390+=0x1){socket[_0xd284('0x59')](_0xd284('0x72'),{'UserId':Number(_0x1688fa['query']['ids'][_0xb31390]),'OpenchannelQueueId':Number(_0x1688fa[_0xd284('0x2a')]['id'])});}}else{socket[_0xd284('0x59')](_0xd284('0x72'),{'UserId':Number(_0x1688fa[_0xd284('0x26')][_0xd284('0x5b')]),'OpenchannelQueueId':Number(_0x1688fa['params']['id'])});}});}})[_0xd284('0x16')](respondWithStatusCode(_0xcb137f,null))[_0xd284('0x35')](handleError(_0xcb137f,null));};exports[_0xd284('0x76')]=function(_0x457a46,_0x43eb24){var _0x584091={};var _0x42111c={};var _0x272b2e;var _0x40875b;return db[_0xd284('0x1f')][_0xd284('0x3d')]({'where':{'id':_0x457a46[_0xd284('0x2a')]['id']}})['then'](handleEntityNotFound(_0x43eb24,null))[_0xd284('0x16')](function(_0x569382){if(_0x569382){_0x272b2e=_0x569382;_0x42111c[_0xd284('0x2b')]=_['keys'](db['User']['rawAttributes']);_0x42111c['query']=_[_0xd284('0x2c')](_0x457a46[_0xd284('0x26')]);_0x42111c[_0xd284('0x2d')]=_['intersection'](_0x42111c['model'],_0x42111c[_0xd284('0x26')]);_0x584091['attributes']=_[_0xd284('0x3f')](_0x42111c[_0xd284('0x2b')],qs[_0xd284('0x2f')](_0x457a46['query'][_0xd284('0x2f')]));_0x584091[_0xd284('0x2e')]=_0x584091[_0xd284('0x2e')]['length']?_0x584091[_0xd284('0x2e')]:_0x42111c[_0xd284('0x2b')];_0x584091['order']=qs[_0xd284('0x42')](_0x457a46[_0xd284('0x26')][_0xd284('0x42')]);_0x584091[_0xd284('0x24')]=qs[_0xd284('0x2d')](_[_0xd284('0x43')](_0x457a46['query'],_0x42111c[_0xd284('0x2d')]));if(_0x457a46[_0xd284('0x26')]['filter']){_0x584091[_0xd284('0x24')]=_[_0xd284('0x32')](_0x584091['where'],{'$or':_[_0xd284('0x1e')](_0x584091[_0xd284('0x2e')],function(_0x2e1783){var _0x28eca5={};_0x28eca5[_0x2e1783]={'$like':'%'+_0x457a46[_0xd284('0x26')][_0xd284('0x45')]+'%'};return _0x28eca5;})});}_0x584091=_['merge']({},_0x584091,_0x457a46[_0xd284('0x33')]);return _0x272b2e[_0xd284('0x76')](_0x584091);}})[_0xd284('0x16')](function(_0x30cf14){if(_0x30cf14){_0x40875b=_0x30cf14[_0xd284('0x30')];if(!_0x457a46[_0xd284('0x26')][_0xd284('0x4f')](_0xd284('0x40'))){_0x584091['limit']=qs[_0xd284('0xe')](_0x457a46[_0xd284('0x26')][_0xd284('0xe')]);_0x584091[_0xd284('0x10')]=qs['offset'](_0x457a46[_0xd284('0x26')][_0xd284('0x10')]);}return _0x272b2e[_0xd284('0x76')](_0x584091);}})[_0xd284('0x16')](function(_0x2f18d9){if(_0x2f18d9){return _0x2f18d9?{'count':_0x40875b,'rows':_0x2f18d9}:null;}})[_0xd284('0x16')](respondWithResult(_0x43eb24,null))[_0xd284('0x35')](handleError(_0x43eb24,null));}; \ No newline at end of file +var _0x382c=['describe','getMembers','findOne','UserOpenchannelQueue','intersection','length','hasOwnProperty','nolimit','sort','where','OpenchannelQueueId','filter','merge','findAll','findAndCountAll','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','userOpenchannelQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','order','util','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','offset','count','Content-Range','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','name','index','map','OpenchannelQueue','fieldName','type','key','include','query','rows','catch','show','params','model','rawAttributes','keys','filters','attributes','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3ff58b,_0x5f4e9b){var _0x521dde=function(_0x3af056){while(--_0x3af056){_0x3ff58b['push'](_0x3ff58b['shift']());}};_0x521dde(++_0x5f4e9b);}(_0x382c,0x1b4));var _0xc382=function(_0x4e54e9,_0x40a2b7){_0x4e54e9=_0x4e54e9-0x0;var _0x32be8f=_0x382c[_0x4e54e9];return _0x32be8f;};'use strict';var BPromise=require('bluebird');var util=require(_0xc382('0x0'));var _=require('lodash');var squel=require(_0xc382('0x1'));var Redis=require('ioredis');var qs=require(_0xc382('0x2'));var logger=require('../../config/logger')(_0xc382('0x3'));var config=require(_0xc382('0x4'));var db=require(_0xc382('0x5'))['db'];config[_0xc382('0x6')]=_[_0xc382('0x7')](config[_0xc382('0x6')],{'host':_0xc382('0x8'),'port':0x18eb});var socket=require(_0xc382('0x9'))(new Redis(config[_0xc382('0x6')]));require('./openchannelQueue.socket')[_0xc382('0xa')](socket);function respondWithStatusCode(_0x552815,_0x6b2c0){_0x6b2c0=_0x6b2c0||0xcc;return function(_0x4de362){if(_0x4de362){return _0x552815[_0xc382('0xb')](_0x6b2c0);}return _0x552815[_0xc382('0xc')](_0x6b2c0)['end']();};}function respondWithResult(_0x114ee3,_0x41fe6a){_0x41fe6a=_0x41fe6a||0xc8;return function(_0x1d9be5){if(_0x1d9be5){return _0x114ee3[_0xc382('0xc')](_0x41fe6a)[_0xc382('0xd')](_0x1d9be5);}};}function respondWithFilteredResult(_0x1ffdde,_0x1ea32c){return function(_0x861924){if(_0x861924){var _0x46af87=typeof _0x1ea32c['offset']===_0xc382('0xe')&&typeof _0x1ea32c[_0xc382('0xf')]===_0xc382('0xe');var _0x19f1f1=_0x861924['count'];var _0xb334ac=_0x46af87?0x0:_0x1ea32c[_0xc382('0x10')];var _0x5a52ce=_0x46af87?_0x861924[_0xc382('0x11')]:_0x1ea32c[_0xc382('0x10')]+_0x1ea32c[_0xc382('0xf')];var _0x570d58;if(_0x5a52ce>=_0x19f1f1){_0x5a52ce=_0x19f1f1;_0x570d58=0xc8;}else{_0x570d58=0xce;}_0x1ffdde['status'](_0x570d58);return _0x1ffdde['set'](_0xc382('0x12'),_0xb334ac+'-'+_0x5a52ce+'/'+_0x19f1f1)[_0xc382('0xd')](_0x861924);}return null;};}function saveUpdates(_0x47c770){return function(_0x56eecd){if(_0x56eecd){return _0x56eecd[_0xc382('0x13')](_0x47c770)['then'](function(_0x4cf260){return _0x4cf260;});}return null;};}function removeEntity(_0x247f48){return function(_0x23d7a4){if(_0x23d7a4){return _0x23d7a4[_0xc382('0x14')]()[_0xc382('0x15')](function(){var _0x5512e0=_0x23d7a4[_0xc382('0x16')]({'plain':!![]});var _0x5d00fe=_0xc382('0x17');return db[_0xc382('0x18')]['destroy']({'where':{'type':_0x5d00fe,'resourceId':_0x5512e0['id']}})[_0xc382('0x15')](function(){return _0x23d7a4;});})[_0xc382('0x15')](function(){_0x247f48[_0xc382('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x139e75){return function(_0xc41c76){if(!_0xc41c76){_0x139e75[_0xc382('0xb')](0x194);}return _0xc41c76;};}function handleError(_0xc1ebe3,_0x25f1d5){_0x25f1d5=_0x25f1d5||0x1f4;return function(_0x1affb6){logger[_0xc382('0x19')](_0x1affb6['stack']);if(_0x1affb6['name']){delete _0x1affb6[_0xc382('0x1a')];}_0xc1ebe3[_0xc382('0xc')](_0x25f1d5)['send'](_0x1affb6);};}exports[_0xc382('0x1b')]=function(_0xabb5a3,_0x244899){var _0xc9ae4a={};var _0x3f1196={'count':0x0,'rows':[]};var _0x2ee87b=_[_0xc382('0x1c')](db[_0xc382('0x1d')]['rawAttributes'],function(_0x4b9051){return{'name':_0x4b9051[_0xc382('0x1e')],'type':_0x4b9051[_0xc382('0x1f')][_0xc382('0x20')]};});_0xc9ae4a=qs['getOptions'](_0x2ee87b,_0xabb5a3);var _0x24dfdc={'where':_0xc9ae4a['where']};return db[_0xc382('0x1d')][_0xc382('0x11')](_0x24dfdc)[_0xc382('0x15')](function(_0x3e4faa){_0x3f1196[_0xc382('0x11')]=_0x3e4faa;_0xc9ae4a[_0xc382('0x21')]=qs['include'](_0xabb5a3[_0xc382('0x22')]);return db[_0xc382('0x1d')]['findAll'](_0xc9ae4a);})[_0xc382('0x15')](function(_0x59713a){_0x3f1196[_0xc382('0x23')]=_0x59713a;return _0x3f1196;})[_0xc382('0x15')](respondWithFilteredResult(_0x244899,_0xc9ae4a))[_0xc382('0x24')](handleError(_0x244899,null));};exports[_0xc382('0x25')]=function(_0x1a927e,_0x33164c){var _0x7cf22a={'raw':!![],'where':{'id':_0x1a927e[_0xc382('0x26')]['id']}},_0x480040={};_0x480040[_0xc382('0x27')]=_['keys'](db[_0xc382('0x1d')][_0xc382('0x28')]);_0x480040['query']=_[_0xc382('0x29')](_0x1a927e['query']);_0x480040[_0xc382('0x2a')]=_['intersection'](_0x480040[_0xc382('0x27')],_0x480040[_0xc382('0x22')]);_0x7cf22a[_0xc382('0x2b')]=_['intersection'](_0x480040[_0xc382('0x27')],qs[_0xc382('0x2c')](_0x1a927e['query']['fields']));_0x7cf22a[_0xc382('0x2b')]=_0x7cf22a[_0xc382('0x2b')]['length']?_0x7cf22a['attributes']:_0x480040[_0xc382('0x27')];if(_0x1a927e['query']['includeAll']){_0x7cf22a[_0xc382('0x21')]=[{'all':!![]}];}_0x7cf22a=_['merge']({},_0x7cf22a,_0x1a927e[_0xc382('0x2d')]);return db[_0xc382('0x1d')][_0xc382('0x2e')](_0x7cf22a)[_0xc382('0x15')](handleEntityNotFound(_0x33164c,null))[_0xc382('0x15')](respondWithResult(_0x33164c,null))['catch'](handleError(_0x33164c,null));};exports[_0xc382('0x2f')]=function(_0x43cda0,_0x16b48c){return db[_0xc382('0x1d')][_0xc382('0x2f')](_0x43cda0[_0xc382('0x30')],{})['then'](function(_0x28297a){var _0x5812f7=_0x43cda0[_0xc382('0x31')][_0xc382('0x16')]({'plain':!![]});if(!_0x5812f7)throw new Error(_0xc382('0x32'));if(_0x5812f7[_0xc382('0x33')]===_0xc382('0x31')){var _0x5e5499=_0x28297a[_0xc382('0x16')]({'plain':!![]});var _0x54ad0b=_0xc382('0x17');return db[_0xc382('0x34')][_0xc382('0x2e')]({'where':{'name':_0x54ad0b,'userProfileId':_0x5812f7[_0xc382('0x35')]},'raw':!![]})[_0xc382('0x15')](function(_0x4a0157){if(_0x4a0157&&_0x4a0157[_0xc382('0x36')]===0x0){return db[_0xc382('0x18')][_0xc382('0x2f')]({'name':_0x5e5499[_0xc382('0x1a')],'resourceId':_0x5e5499['id'],'type':_0x4a0157[_0xc382('0x1a')],'sectionId':_0x4a0157['id']},{})[_0xc382('0x15')](function(){return _0x28297a;});}else{return _0x28297a;}})[_0xc382('0x24')](function(_0x5c7055){logger['error'](_0xc382('0x37'),_0x5c7055);throw _0x5c7055;});}return _0x28297a;})[_0xc382('0x15')](respondWithResult(_0x16b48c,0xc9))[_0xc382('0x24')](handleError(_0x16b48c,null));};exports['update']=function(_0x469732,_0x1793e8){if(_0x469732[_0xc382('0x30')]['id']){delete _0x469732['body']['id'];}return db[_0xc382('0x1d')][_0xc382('0x2e')]({'where':{'id':_0x469732[_0xc382('0x26')]['id']}})['then'](handleEntityNotFound(_0x1793e8,null))[_0xc382('0x15')](saveUpdates(_0x469732[_0xc382('0x30')],null))[_0xc382('0x15')](respondWithResult(_0x1793e8,null))[_0xc382('0x24')](handleError(_0x1793e8,null));};exports[_0xc382('0x14')]=function(_0x1e2e14,_0x271467){return db[_0xc382('0x1d')][_0xc382('0x2e')]({'where':{'id':_0x1e2e14[_0xc382('0x26')]['id']}})[_0xc382('0x15')](handleEntityNotFound(_0x271467,null))[_0xc382('0x15')](removeEntity(_0x271467,null))[_0xc382('0x24')](handleError(_0x271467,null));};exports[_0xc382('0x38')]=function(_0x4922ea,_0x23a8df){return db[_0xc382('0x1d')][_0xc382('0x38')]()[_0xc382('0x15')](respondWithResult(_0x23a8df,null))[_0xc382('0x24')](handleError(_0x23a8df,null));};exports[_0xc382('0x39')]=function(_0x4b9063,_0x4e698b){var _0x6550dc={'raw':!![],'where':{}},_0x4a5596={},_0x1b6764;return db['OpenchannelQueue'][_0xc382('0x3a')]({'where':{'id':_0x4b9063[_0xc382('0x26')]['id']}})[_0xc382('0x15')](handleEntityNotFound(_0x4e698b,null))[_0xc382('0x15')](function(_0x32bc80){if(_0x32bc80){_0x1b6764=_0x32bc80[_0xc382('0x16')]({'plain':!![]});_0x4a5596['model']=_[_0xc382('0x29')](db[_0xc382('0x3b')][_0xc382('0x28')]);_0x4a5596['query']=_[_0xc382('0x29')](_0x4b9063[_0xc382('0x22')]);_0x4a5596[_0xc382('0x2a')]=_[_0xc382('0x3c')](_0x4a5596['model'],_0x4a5596[_0xc382('0x22')]);_0x6550dc[_0xc382('0x2b')]=_[_0xc382('0x3c')](_0x4a5596[_0xc382('0x27')],qs[_0xc382('0x2c')](_0x4b9063['query'][_0xc382('0x2c')]));_0x6550dc[_0xc382('0x2b')]=_0x6550dc['attributes'][_0xc382('0x3d')]?_0x6550dc[_0xc382('0x2b')]:_0x4a5596[_0xc382('0x27')];if(!_0x4b9063['query'][_0xc382('0x3e')](_0xc382('0x3f'))){_0x6550dc[_0xc382('0xf')]=qs['limit'](_0x4b9063[_0xc382('0x22')][_0xc382('0xf')]);_0x6550dc[_0xc382('0x10')]=qs['offset'](_0x4b9063[_0xc382('0x22')][_0xc382('0x10')]);}_0x6550dc['order']=qs[_0xc382('0x40')](_0x4b9063['query'][_0xc382('0x40')]);_0x6550dc[_0xc382('0x41')]=qs[_0xc382('0x2a')](_['pick'](_0x4b9063['query'],_0x4a5596[_0xc382('0x2a')]));_0x6550dc[_0xc382('0x41')][_0xc382('0x42')]=_0x32bc80['id'];if(_0x4b9063['query'][_0xc382('0x43')]){_0x6550dc[_0xc382('0x41')]=_[_0xc382('0x44')](_0x6550dc[_0xc382('0x41')],{'$or':_['map'](_0x6550dc[_0xc382('0x2b')],function(_0x384c5e){var _0x4cd1bb={};_0x4cd1bb[_0x384c5e]={'$like':'%'+_0x4b9063['query'][_0xc382('0x43')]+'%'};return _0x4cd1bb;})});}_0x6550dc=_[_0xc382('0x44')]({},_0x6550dc,_0x4b9063[_0xc382('0x2d')]);return db['UserOpenchannelQueue'][_0xc382('0x45')](_0x6550dc);}})[_0xc382('0x15')](function(_0x17c671){if(_0x17c671){return db['User'][_0xc382('0x46')]({'where':{'id':_[_0xc382('0x1c')](_0x17c671,'UserId'),'role':'agent'},'attributes':['id',_0xc382('0x1a'),_0xc382('0x47'),_0xc382('0x48'),_0xc382('0x49')]});}})[_0xc382('0x15')](function(_0x15337d){if(_0x15337d){return{'count':_0x15337d[_0xc382('0x11')],'rows':_['map'](_0x15337d[_0xc382('0x23')],function(_0x1d83b4){return{'membername':_0x1d83b4['name'],'UserId':_0x1d83b4['id'],'queue_name':_0x1b6764[_0xc382('0x1a')],'OpenchannelQueueId':_0x1b6764['id'],'interface':util[_0xc382('0x4a')](_0xc382('0x4b'),_0xc382('0x4c'),_0x1d83b4[_0xc382('0x1a')]),'penalty':0x0,'paused':_0x1d83b4[_0xc382('0x47')],'createdAt':_0x1d83b4[_0xc382('0x49')],'updatedAt':_0x1d83b4[_0xc382('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4e698b,_0x6550dc))[_0xc382('0x24')](handleError(_0x4e698b,null));};exports[_0xc382('0x4d')]=function(_0x1ac6b8,_0x11bb23){var _0x521378={};var _0x5ece5c={};var _0x320c0f;var _0x20fe09;return db[_0xc382('0x1d')][_0xc382('0x3a')]({'where':{'id':_0x1ac6b8[_0xc382('0x26')]['id']}})['then'](handleEntityNotFound(_0x11bb23,null))[_0xc382('0x15')](function(_0x2d83c4){if(_0x2d83c4){_0x320c0f=_0x2d83c4;_0x5ece5c[_0xc382('0x27')]=_[_0xc382('0x29')](db[_0xc382('0x4e')][_0xc382('0x28')]);_0x5ece5c[_0xc382('0x22')]=_[_0xc382('0x29')](_0x1ac6b8['query']);_0x5ece5c[_0xc382('0x2a')]=_[_0xc382('0x3c')](_0x5ece5c['model'],_0x5ece5c[_0xc382('0x22')]);_0x521378[_0xc382('0x2b')]=_[_0xc382('0x3c')](_0x5ece5c[_0xc382('0x27')],qs[_0xc382('0x2c')](_0x1ac6b8[_0xc382('0x22')][_0xc382('0x2c')]));_0x521378[_0xc382('0x2b')]=_0x521378['attributes']['length']?_0x521378[_0xc382('0x2b')]:_0x5ece5c[_0xc382('0x27')];_0x521378['order']=qs[_0xc382('0x40')](_0x1ac6b8['query'][_0xc382('0x40')]);_0x521378[_0xc382('0x41')]=qs['filters'](_[_0xc382('0x4f')](_0x1ac6b8[_0xc382('0x22')],_0x5ece5c[_0xc382('0x2a')]));if(_0x1ac6b8[_0xc382('0x22')][_0xc382('0x43')]){_0x521378[_0xc382('0x41')]=_[_0xc382('0x44')](_0x521378['where'],{'$or':_[_0xc382('0x1c')](_0x521378['attributes'],function(_0x4a0117){var _0xd570cb={};_0xd570cb[_0x4a0117]={'$like':'%'+_0x1ac6b8[_0xc382('0x22')]['filter']+'%'};return _0xd570cb;})});}_0x521378=_[_0xc382('0x44')]({},_0x521378,_0x1ac6b8['options']);return _0x320c0f[_0xc382('0x4d')](_0x521378);}})[_0xc382('0x15')](function(_0x54bda5){if(_0x54bda5){_0x20fe09=_0x54bda5[_0xc382('0x3d')];if(!_0x1ac6b8[_0xc382('0x22')][_0xc382('0x3e')](_0xc382('0x3f'))){_0x521378[_0xc382('0xf')]=qs[_0xc382('0xf')](_0x1ac6b8['query']['limit']);_0x521378['offset']=qs[_0xc382('0x10')](_0x1ac6b8['query']['offset']);}return _0x320c0f['getTeams'](_0x521378);}})[_0xc382('0x15')](function(_0x1159e4){if(_0x1159e4){return _0x1159e4?{'count':_0x20fe09,'rows':_0x1159e4}:null;}})['then'](respondWithResult(_0x11bb23,null))[_0xc382('0x24')](handleError(_0x11bb23,null));};exports[_0xc382('0x50')]=function(_0x40b61b,_0x1eb665){var _0x23ae05=_0x40b61b['body'][_0xc382('0x51')];return db[_0xc382('0x4e')][_0xc382('0x45')]({'where':{'id':_0x23ae05},'attributes':['id'],'include':[{'model':db[_0xc382('0x52')],'as':_0xc382('0x53'),'attributes':['id',_0xc382('0x1a'),_0xc382('0x54'),_0xc382('0x55'),_0xc382('0x56')],'raw':!![]}]})[_0xc382('0x15')](function(_0x5a8553){if(_0x5a8553){var _0x336d42=_[_0xc382('0x57')](_0x5a8553,function(_0x42f3ef){var _0x4d8194=_0x42f3ef['get']({'plain':!![]});return _0x4d8194[_0xc382('0x53')];});return db[_0xc382('0x1d')]['find']({'where':{'id':_0x40b61b[_0xc382('0x26')]['id']}})[_0xc382('0x15')](function(_0x2dc81b){return db[_0xc382('0x58')][_0xc382('0x59')](function(_0x28d86a){return _0x2dc81b[_0xc382('0x50')](_0x23ae05,{'transaction':_0x28d86a})[_0xc382('0x15')](function(){return BPromise[_0xc382('0x5a')](_0x336d42,function(_0x3cfcee){return db[_0xc382('0x3b')][_0xc382('0x5b')]({'where':{'UserId':_0x3cfcee['id'],'OpenchannelQueueId':_0x40b61b['params']['id']},'transaction':_0x28d86a});});})[_0xc382('0x15')](function(){_0x336d42[_0xc382('0x5c')](function(_0x915ea5){socket[_0xc382('0x5d')](_0xc382('0x5e'),{'UserId':_0x915ea5['id'],'OpenchannelQueueId':_0x2dc81b['id']});});});});});}})[_0xc382('0x15')](respondWithStatusCode(_0x1eb665,null))['catch'](handleError(_0x1eb665,null));};exports[_0xc382('0x5f')]=function(_0x202f7a,_0x322526){return db[_0xc382('0x4e')][_0xc382('0x45')]({'where':{'id':_0x202f7a[_0xc382('0x22')][_0xc382('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc382('0x15')](handleEntityNotFound(_0x322526,null))[_0xc382('0x15')](function(_0x311143){var _0x4577fe=_['map'](_0x311143,'id');var _0xbba8cf=[];var _0x4ff55a=[];var _0x522afe=squel[_0xc382('0x60')]();_0x522afe['field'](_0xc382('0x61'))[_0xc382('0x62')](_0xc382('0x63'),'tq')[_0xc382('0x64')](_0xc382('0x65'),'ut',_0xc382('0x66'))['where'](_0xc382('0x67'),_0x202f7a[_0xc382('0x26')]['id']);for(var _0x5579d5=0x0;_0x5579d5<_0x311143[_0xc382('0x3d')];_0x5579d5+=0x1){let _0x34bc52=_0x311143[_0x5579d5];for(var _0x41723d=0x0;_0x41723d<_0x34bc52['Agents'][_0xc382('0x3d')];_0x41723d+=0x1){let _0x4228f1=_0x34bc52[_0xc382('0x53')][_0x41723d];var _0x446566=_0x522afe[_0xc382('0x68')]();_0x446566[_0xc382('0x41')](_0xc382('0x69'),_0x4228f1['id']);_0x4ff55a[_0xc382('0x6a')](db['sequelize'][_0xc382('0x22')](_0x446566['toString'](),{'type':db[_0xc382('0x58')][_0xc382('0x6b')][_0xc382('0x6c')]})[_0xc382('0x15')](function(_0x2f6b84){if(_0x2f6b84[_0xc382('0x3d')]===0x1){return _0x4228f1['id'];}else{var _0x4bf520=_[_0xc382('0x6d')](_[_0xc382('0x1c')](_0x2f6b84,_0xc382('0x6e')),function(_0x2c8232){return _[_0xc382('0x6f')](_0x4577fe,_0x2c8232);});if(_0x4bf520){return _0x4228f1['id'];}}}));}}return BPromise[_0xc382('0x70')](_0x4ff55a)['then'](function(_0x59b909){_0xbba8cf=_(_0xbba8cf)[_0xc382('0x71')](_0x59b909)[_0xc382('0x72')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x202f7a[_0xc382('0x26')]['id']}})[_0xc382('0x15')](function(_0x140567){return db[_0xc382('0x58')][_0xc382('0x59')](function(_0x53c1f0){return _0x140567['removeTeams'](_0x202f7a[_0xc382('0x22')]['ids'],{'transaction':_0x53c1f0})[_0xc382('0x15')](function(){if(!_[_0xc382('0x73')](_0xbba8cf)){return _0x140567['removeAgents'](_0xbba8cf,{'transaction':_0x53c1f0});}})[_0xc382('0x15')](function(){_0xbba8cf[_0xc382('0x5c')](function(_0x5032eb){socket['emit'](_0xc382('0x74'),{'UserId':_0x5032eb,'OpenchannelQueueId':_0x140567['id']});});});});});});})[_0xc382('0x15')](respondWithStatusCode(_0x322526,null))['catch'](handleError(_0x322526,null));};exports['addAgents']=function(_0x50ab81,_0x275b4c){return db[_0xc382('0x1d')]['find']({'where':{'id':_0x50ab81['params']['id']}})['then'](handleEntityNotFound(_0x275b4c,null))[_0xc382('0x15')](function(_0x39bece){if(_0x39bece){return _0x39bece[_0xc382('0x75')](_0x50ab81['body'][_0xc382('0x51')],_['omit'](_0x50ab81['body'],['ids','id'])||{})[_0xc382('0x76')](function(_0x47cbfe){for(var _0x1c0bdc=0x0;_0x1c0bdc<_0x50ab81[_0xc382('0x30')][_0xc382('0x51')][_0xc382('0x3d')];_0x1c0bdc+=0x1){socket[_0xc382('0x5d')](_0xc382('0x5e'),{'UserId':Number(_0x50ab81[_0xc382('0x30')][_0xc382('0x51')][_0x1c0bdc]),'OpenchannelQueueId':Number(_0x50ab81[_0xc382('0x26')]['id'])});}return _0x47cbfe;});}})[_0xc382('0x15')](respondWithResult(_0x275b4c,null))['catch'](handleError(_0x275b4c,null));};exports['removeAgents']=function(_0x3b13e4,_0x552d09){return db[_0xc382('0x1d')][_0xc382('0x2e')]({'where':{'id':_0x3b13e4['params']['id']}})[_0xc382('0x15')](handleEntityNotFound(_0x552d09,null))['then'](function(_0x2d271d){if(_0x2d271d){return _0x2d271d[_0xc382('0x77')](_0x3b13e4[_0xc382('0x22')][_0xc382('0x51')])[_0xc382('0x15')](function(){if(_[_0xc382('0x78')](_0x3b13e4[_0xc382('0x22')]['ids'])){for(var _0x15911e=0x0;_0x15911e<_0x3b13e4[_0xc382('0x22')][_0xc382('0x51')][_0xc382('0x3d')];_0x15911e+=0x1){socket[_0xc382('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3b13e4[_0xc382('0x22')]['ids'][_0x15911e]),'OpenchannelQueueId':Number(_0x3b13e4[_0xc382('0x26')]['id'])});}}else{socket[_0xc382('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3b13e4[_0xc382('0x22')][_0xc382('0x51')]),'OpenchannelQueueId':Number(_0x3b13e4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x552d09,null))[_0xc382('0x24')](handleError(_0x552d09,null));};exports[_0xc382('0x79')]=function(_0x2fda70,_0x18e3f9){var _0x1e7cfc={};var _0x50a8ed={};var _0x349a0d;var _0x46d4ae;return db[_0xc382('0x1d')][_0xc382('0x3a')]({'where':{'id':_0x2fda70[_0xc382('0x26')]['id']}})[_0xc382('0x15')](handleEntityNotFound(_0x18e3f9,null))[_0xc382('0x15')](function(_0x100476){if(_0x100476){_0x349a0d=_0x100476;_0x50a8ed['model']=_[_0xc382('0x29')](db['User'][_0xc382('0x28')]);_0x50a8ed['query']=_[_0xc382('0x29')](_0x2fda70['query']);_0x50a8ed[_0xc382('0x2a')]=_[_0xc382('0x3c')](_0x50a8ed['model'],_0x50a8ed['query']);_0x1e7cfc['attributes']=_['intersection'](_0x50a8ed[_0xc382('0x27')],qs[_0xc382('0x2c')](_0x2fda70[_0xc382('0x22')][_0xc382('0x2c')]));_0x1e7cfc[_0xc382('0x2b')]=_0x1e7cfc[_0xc382('0x2b')][_0xc382('0x3d')]?_0x1e7cfc[_0xc382('0x2b')]:_0x50a8ed['model'];_0x1e7cfc[_0xc382('0x7a')]=qs[_0xc382('0x40')](_0x2fda70[_0xc382('0x22')][_0xc382('0x40')]);_0x1e7cfc[_0xc382('0x41')]=qs['filters'](_[_0xc382('0x4f')](_0x2fda70[_0xc382('0x22')],_0x50a8ed[_0xc382('0x2a')]));if(_0x2fda70['query']['filter']){_0x1e7cfc[_0xc382('0x41')]=_[_0xc382('0x44')](_0x1e7cfc[_0xc382('0x41')],{'$or':_['map'](_0x1e7cfc['attributes'],function(_0x55c275){var _0x1c622f={};_0x1c622f[_0x55c275]={'$like':'%'+_0x2fda70[_0xc382('0x22')][_0xc382('0x43')]+'%'};return _0x1c622f;})});}_0x1e7cfc=_['merge']({},_0x1e7cfc,_0x2fda70[_0xc382('0x2d')]);return _0x349a0d[_0xc382('0x79')](_0x1e7cfc);}})[_0xc382('0x15')](function(_0x5c7090){if(_0x5c7090){_0x46d4ae=_0x5c7090[_0xc382('0x3d')];if(!_0x2fda70[_0xc382('0x22')]['hasOwnProperty'](_0xc382('0x3f'))){_0x1e7cfc['limit']=qs[_0xc382('0xf')](_0x2fda70['query']['limit']);_0x1e7cfc[_0xc382('0x10')]=qs[_0xc382('0x10')](_0x2fda70[_0xc382('0x22')][_0xc382('0x10')]);}return _0x349a0d[_0xc382('0x79')](_0x1e7cfc);}})[_0xc382('0x15')](function(_0xc84812){if(_0xc84812){return _0xc84812?{'count':_0x46d4ae,'rows':_0xc84812}:null;}})[_0xc382('0x15')](respondWithResult(_0x18e3f9,null))[_0xc382('0x24')](handleError(_0x18e3f9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 40202c1..51d7f70 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 _0x6130=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6130,0x1be));var _0x0613=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x6130[_0x9cd4c3];return _0x4c9025;};'use strict';var EventEmitter=require(_0x0613('0x0'));var OpenchannelQueue=require(_0x0613('0x1'))['db'][_0x0613('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0613('0x3')](0x0);var events={'afterCreate':_0x0613('0x4'),'afterUpdate':_0x0613('0x5'),'afterDestroy':_0x0613('0x6')};function emitEvent(_0xcf7d0d){return function(_0xb13d09,_0x2fe21f,_0x217d12){OpenchannelQueueEvents['emit'](_0xcf7d0d+':'+_0xb13d09['id'],_0xb13d09);OpenchannelQueueEvents['emit'](_0xcf7d0d,_0xb13d09);_0x217d12(null);};}for(var e in events){if(events[_0x0613('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0613('0x8')](e,emitEvent(event));}}module[_0x0613('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xcf51=['../../mysqldb','OpenchannelQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xcf51,0x182));var _0x1cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf51[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x1cf5('0x0'));var OpenchannelQueue=require(_0x1cf5('0x1'))['db'][_0x1cf5('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1cf5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cf5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x19a7c5){return function(_0x5353db,_0x960f0f,_0x2824e3){OpenchannelQueueEvents[_0x1cf5('0x5')](_0x19a7c5+':'+_0x5353db['id'],_0x5353db);OpenchannelQueueEvents[_0x1cf5('0x5')](_0x19a7c5,_0x5353db);_0x2824e3(null);};}for(var e in events){if(events[_0x1cf5('0x6')](e)){var event=events[e];OpenchannelQueue[_0x1cf5('0x7')](e,emitEvent(event));}}module[_0x1cf5('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index e74d8d1..2ca5083 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 _0x69b1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x1f2f54,_0x2110f1){var _0x30bed5=function(_0x4258f7){while(--_0x4258f7){_0x1f2f54['push'](_0x1f2f54['shift']());}};_0x30bed5(++_0x2110f1);}(_0x69b1,0x196));var _0x169b=function(_0x3588c3,_0x5e4eed){_0x3588c3=_0x3588c3-0x0;var _0x96d818=_0x69b1[_0x3588c3];return _0x96d818;};'use strict';var _=require(_0x169b('0x0'));var util=require(_0x169b('0x1'));var logger=require(_0x169b('0x2'))(_0x169b('0x3'));var moment=require(_0x169b('0x4'));var BPromise=require(_0x169b('0x5'));var rp=require(_0x169b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x169b('0x7'));var config=require(_0x169b('0x8'));var attributes=require(_0x169b('0x9'));module[_0x169b('0xa')]=function(_0x3f0596,_0x1d8b83){return _0x3f0596[_0x169b('0xb')](_0x169b('0xc'),attributes,{'tableName':_0x169b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeba=['api','moment','path','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','lodash','util','../../config/logger'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0xbeba,0x15b));var _0xabeb=function(_0x49fcb7,_0x3b7b25){_0x49fcb7=_0x49fcb7-0x0;var _0x4156fa=_0xbeba[_0x49fcb7];return _0x4156fa;};'use strict';var _=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var logger=require(_0xabeb('0x2'))(_0xabeb('0x3'));var moment=require(_0xabeb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabeb('0x5'));var rimraf=require(_0xabeb('0x6'));var config=require(_0xabeb('0x7'));var attributes=require(_0xabeb('0x8'));module['exports']=function(_0x27369f,_0x2f5de3){return _0x27369f['define'](_0xabeb('0x9'),attributes,{'tableName':'openchannel_queues','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 7caab9d..465260c 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 _0x6cc4=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','then','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5c52a3,_0x13c8d5){var _0x5537b9=function(_0x469e93){while(--_0x469e93){_0x5c52a3['push'](_0x5c52a3['shift']());}};_0x5537b9(++_0x13c8d5);}(_0x6cc4,0x1e7));var _0x46cc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6cc4[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x46cc('0x0'));var util=require(_0x46cc('0x1'));var moment=require('moment');var BPromise=require(_0x46cc('0x2'));var rs=require(_0x46cc('0x3'));var fs=require('fs');var Redis=require(_0x46cc('0x4'));var db=require(_0x46cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46cc('0x6'))(_0x46cc('0x7'));var config=require(_0x46cc('0x8'));var jayson=require(_0x46cc('0x9'));var client=jayson[_0x46cc('0xa')][_0x46cc('0xb')]({'port':0x232a});config[_0x46cc('0xc')]=_[_0x46cc('0xd')](config[_0x46cc('0xc')],{'host':_0x46cc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46cc('0xc')]));require(_0x46cc('0xf'))[_0x46cc('0x10')](socket);function respondWithRpcPromise(_0x1e66e3,_0x16486b,_0x2e1ea8){return new BPromise(function(_0x562633,_0x4a2cc0){return client[_0x46cc('0x11')](_0x1e66e3,_0x2e1ea8)['then'](function(_0x5a4f0f){logger[_0x46cc('0x12')](_0x46cc('0x13'),_0x16486b,_0x46cc('0x14'));logger[_0x46cc('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x16486b,_0x46cc('0x14'),JSON[_0x46cc('0x16')](_0x5a4f0f));if(_0x5a4f0f['error']){if(_0x5a4f0f[_0x46cc('0x17')][_0x46cc('0x18')]===0x1f4){logger[_0x46cc('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x16486b,_0x5a4f0f[_0x46cc('0x17')]['message']);return _0x4a2cc0(_0x5a4f0f['error']['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x16486b,_0x5a4f0f[_0x46cc('0x17')][_0x46cc('0x19')]);return _0x562633(_0x5a4f0f[_0x46cc('0x17')][_0x46cc('0x19')]);}else{logger[_0x46cc('0x12')](_0x46cc('0x13'),_0x16486b,_0x46cc('0x14'));_0x562633(_0x5a4f0f['result'][_0x46cc('0x19')]);}})[_0x46cc('0x1a')](function(_0x6391a7){logger[_0x46cc('0x17')](_0x46cc('0x13'),_0x16486b,_0x6391a7);_0x4a2cc0(_0x6391a7);});});}exports[_0x46cc('0x1b')]=function(_0x27334d){var _0x38e93e=this;return new Promise(function(_0xa29892,_0x320479){return db[_0x46cc('0x1c')][_0x46cc('0x1d')]({'raw':_0x27334d[_0x46cc('0x1e')]?_0x27334d[_0x46cc('0x1e')][_0x46cc('0x1f')]===undefined?!![]:![]:!![],'where':_0x27334d['options']?_0x27334d[_0x46cc('0x1e')][_0x46cc('0x20')]||null:null,'attributes':_0x27334d[_0x46cc('0x1e')]?_0x27334d[_0x46cc('0x1e')][_0x46cc('0x21')]||null:null,'limit':_0x27334d['options']?_0x27334d[_0x46cc('0x1e')][_0x46cc('0x22')]||null:null,'include':_0x27334d['options']?_0x27334d['options'][_0x46cc('0x23')]?_[_0x46cc('0x24')](_0x27334d[_0x46cc('0x1e')][_0x46cc('0x23')],function(_0x153c10){return{'model':db[_0x153c10['model']],'as':_0x153c10['as'],'attributes':_0x153c10['attributes'],'include':_0x153c10[_0x46cc('0x23')]?_[_0x46cc('0x24')](_0x153c10[_0x46cc('0x23')],function(_0x528225){return{'model':db[_0x528225[_0x46cc('0x25')]],'as':_0x528225['as'],'attributes':_0x528225[_0x46cc('0x21')],'include':_0x528225[_0x46cc('0x23')]?_[_0x46cc('0x24')](_0x528225[_0x46cc('0x23')],function(_0x390a11){return{'model':db[_0x390a11[_0x46cc('0x25')]],'as':_0x390a11['as'],'attributes':_0x390a11[_0x46cc('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x595f53){logger[_0x46cc('0x12')](_0x46cc('0x1b'),_0x27334d);logger[_0x46cc('0x15')](_0x46cc('0x1b'),_0x27334d,JSON[_0x46cc('0x16')](_0x595f53));_0xa29892(_0x595f53);})[_0x46cc('0x1a')](function(_0x2b342d){logger[_0x46cc('0x17')](_0x46cc('0x1b'),_0x2b342d['message'],_0x27334d);_0x320479(_0x38e93e[_0x46cc('0x17')](0x1f4,_0x2b342d[_0x46cc('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x4bae95){var _0x1c0153=this;return new Promise(function(_0x2f1d1c,_0x93ac4c){return db[_0x46cc('0x1c')][_0x46cc('0x26')]({'raw':_0x4bae95[_0x46cc('0x1e')]?_0x4bae95[_0x46cc('0x1e')][_0x46cc('0x1f')]===undefined?!![]:![]:!![],'where':_0x4bae95[_0x46cc('0x1e')]?_0x4bae95['options'][_0x46cc('0x20')]||null:null,'attributes':_0x4bae95[_0x46cc('0x1e')]?_0x4bae95[_0x46cc('0x1e')]['attributes']||null:null,'include':_0x4bae95[_0x46cc('0x1e')]?_0x4bae95[_0x46cc('0x1e')]['include']?_['map'](_0x4bae95[_0x46cc('0x1e')][_0x46cc('0x23')],function(_0x324743){return{'model':db[_0x324743[_0x46cc('0x25')]],'as':_0x324743['as'],'attributes':_0x324743[_0x46cc('0x21')],'include':_0x324743[_0x46cc('0x23')]?_[_0x46cc('0x24')](_0x324743[_0x46cc('0x23')],function(_0x2b2445){return{'model':db[_0x2b2445[_0x46cc('0x25')]],'as':_0x2b2445['as'],'attributes':_0x2b2445[_0x46cc('0x21')],'include':_0x2b2445['include']?_[_0x46cc('0x24')](_0x2b2445[_0x46cc('0x23')],function(_0x27790c){return{'model':db[_0x27790c[_0x46cc('0x25')]],'as':_0x27790c['as'],'attributes':_0x27790c[_0x46cc('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46cc('0x27')](function(_0x4a0133){logger[_0x46cc('0x12')]('ShowOpenchannelQueue',_0x4bae95);logger[_0x46cc('0x15')](_0x46cc('0x28'),_0x4bae95,JSON[_0x46cc('0x16')](_0x4a0133));_0x2f1d1c(_0x4a0133);})[_0x46cc('0x1a')](function(_0x3813f3){logger[_0x46cc('0x17')]('ShowOpenchannelQueue',_0x3813f3[_0x46cc('0x19')],_0x4bae95);_0x93ac4c(_0x1c0153['error'](0x1f4,_0x3813f3[_0x46cc('0x19')]));});});}; \ No newline at end of file +var _0x3c2d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','debug','stringify','ShowOpenchannelQueue','find','map','util'];(function(_0x41055a,_0x535849){var _0x3c1db5=function(_0xdef392){while(--_0xdef392){_0x41055a['push'](_0x41055a['shift']());}};_0x3c1db5(++_0x535849);}(_0x3c2d,0xc2));var _0xd3c2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3c2d[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xd3c2('0x0'));var moment=require('moment');var BPromise=require(_0xd3c2('0x1'));var rs=require(_0xd3c2('0x2'));var fs=require('fs');var Redis=require(_0xd3c2('0x3'));var db=require(_0xd3c2('0x4'))['db'];var utils=require(_0xd3c2('0x5'));var logger=require(_0xd3c2('0x6'))('rpc');var config=require(_0xd3c2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd3c2('0x8')][_0xd3c2('0x9')]({'port':0x232a});config[_0xd3c2('0xa')]=_['defaults'](config[_0xd3c2('0xa')],{'host':_0xd3c2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd3c2('0xa')]));require(_0xd3c2('0xc'))[_0xd3c2('0xd')](socket);function respondWithRpcPromise(_0x26c13e,_0x25c1d0,_0x36719d){return new BPromise(function(_0x3115d5,_0x5a95ac){return client[_0xd3c2('0xe')](_0x26c13e,_0x36719d)[_0xd3c2('0xf')](function(_0x1b18ca){logger[_0xd3c2('0x10')](_0xd3c2('0x11'),_0x25c1d0,_0xd3c2('0x12'));logger['debug'](_0xd3c2('0x13'),_0x25c1d0,'request\x20sent',JSON['stringify'](_0x1b18ca));if(_0x1b18ca[_0xd3c2('0x14')]){if(_0x1b18ca['error']['code']===0x1f4){logger[_0xd3c2('0x14')](_0xd3c2('0x11'),_0x25c1d0,_0x1b18ca[_0xd3c2('0x14')]['message']);return _0x5a95ac(_0x1b18ca[_0xd3c2('0x14')][_0xd3c2('0x15')]);}logger[_0xd3c2('0x14')](_0xd3c2('0x11'),_0x25c1d0,_0x1b18ca[_0xd3c2('0x14')]['message']);return _0x3115d5(_0x1b18ca[_0xd3c2('0x14')]['message']);}else{logger['info'](_0xd3c2('0x11'),_0x25c1d0,'request\x20sent');_0x3115d5(_0x1b18ca[_0xd3c2('0x16')][_0xd3c2('0x15')]);}})[_0xd3c2('0x17')](function(_0x4a6ff5){logger[_0xd3c2('0x14')](_0xd3c2('0x11'),_0x25c1d0,_0x4a6ff5);_0x5a95ac(_0x4a6ff5);});});}exports[_0xd3c2('0x18')]=function(_0x3b7c79){var _0x270d02=this;return new Promise(function(_0x23b033,_0x42a058){return db[_0xd3c2('0x19')][_0xd3c2('0x1a')]({'raw':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79[_0xd3c2('0x1b')][_0xd3c2('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79['options'][_0xd3c2('0x1d')]||null:null,'attributes':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79[_0xd3c2('0x1b')][_0xd3c2('0x1e')]||null:null,'limit':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79[_0xd3c2('0x1b')][_0xd3c2('0x1f')]||null:null,'include':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79[_0xd3c2('0x1b')]['include']?_['map'](_0x3b7c79['options'][_0xd3c2('0x20')],function(_0xc3954b){return{'model':db[_0xc3954b['model']],'as':_0xc3954b['as'],'attributes':_0xc3954b[_0xd3c2('0x1e')],'include':_0xc3954b[_0xd3c2('0x20')]?_['map'](_0xc3954b[_0xd3c2('0x20')],function(_0x3b42ad){return{'model':db[_0x3b42ad[_0xd3c2('0x21')]],'as':_0x3b42ad['as'],'attributes':_0x3b42ad[_0xd3c2('0x1e')],'include':_0x3b42ad[_0xd3c2('0x20')]?_['map'](_0x3b42ad[_0xd3c2('0x20')],function(_0x374dd4){return{'model':db[_0x374dd4[_0xd3c2('0x21')]],'as':_0x374dd4['as'],'attributes':_0x374dd4[_0xd3c2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x262b3f){logger[_0xd3c2('0x10')]('GetOpenchannelQueue',_0x3b7c79);logger[_0xd3c2('0x22')](_0xd3c2('0x18'),_0x3b7c79,JSON[_0xd3c2('0x23')](_0x262b3f));_0x23b033(_0x262b3f);})[_0xd3c2('0x17')](function(_0x1da133){logger[_0xd3c2('0x14')](_0xd3c2('0x18'),_0x1da133['message'],_0x3b7c79);_0x42a058(_0x270d02[_0xd3c2('0x14')](0x1f4,_0x1da133[_0xd3c2('0x15')]));});});};exports[_0xd3c2('0x24')]=function(_0x536473){var _0x245b73=this;return new Promise(function(_0x1c8342,_0x593de1){return db[_0xd3c2('0x19')][_0xd3c2('0x25')]({'raw':_0x536473[_0xd3c2('0x1b')]?_0x536473[_0xd3c2('0x1b')][_0xd3c2('0x1c')]===undefined?!![]:![]:!![],'where':_0x536473[_0xd3c2('0x1b')]?_0x536473[_0xd3c2('0x1b')][_0xd3c2('0x1d')]||null:null,'attributes':_0x536473[_0xd3c2('0x1b')]?_0x536473[_0xd3c2('0x1b')][_0xd3c2('0x1e')]||null:null,'include':_0x536473[_0xd3c2('0x1b')]?_0x536473[_0xd3c2('0x1b')][_0xd3c2('0x20')]?_[_0xd3c2('0x26')](_0x536473['options'][_0xd3c2('0x20')],function(_0x529c42){return{'model':db[_0x529c42[_0xd3c2('0x21')]],'as':_0x529c42['as'],'attributes':_0x529c42[_0xd3c2('0x1e')],'include':_0x529c42['include']?_[_0xd3c2('0x26')](_0x529c42[_0xd3c2('0x20')],function(_0x38de0d){return{'model':db[_0x38de0d[_0xd3c2('0x21')]],'as':_0x38de0d['as'],'attributes':_0x38de0d[_0xd3c2('0x1e')],'include':_0x38de0d[_0xd3c2('0x20')]?_[_0xd3c2('0x26')](_0x38de0d[_0xd3c2('0x20')],function(_0x3ae55f){return{'model':db[_0x3ae55f['model']],'as':_0x3ae55f['as'],'attributes':_0x3ae55f[_0xd3c2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd3c2('0xf')](function(_0x5d620e){logger[_0xd3c2('0x10')]('ShowOpenchannelQueue',_0x536473);logger[_0xd3c2('0x22')]('ShowOpenchannelQueue',_0x536473,JSON[_0xd3c2('0x23')](_0x5d620e));_0x1c8342(_0x5d620e);})[_0xd3c2('0x17')](function(_0x4bae4f){logger['error']('ShowOpenchannelQueue',_0x4bae4f['message'],_0x536473);_0x593de1(_0x245b73['error'](0x1f4,_0x4bae4f[_0xd3c2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 402e0f7..3d325f3 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 _0x5539=['emit','register','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x27367a,_0x84a95c){var _0x3306f1=function(_0x1cbb6b){while(--_0x1cbb6b){_0x27367a['push'](_0x27367a['shift']());}};_0x3306f1(++_0x84a95c);}(_0x5539,0x141));var _0x9553=function(_0x2db148,_0x23a294){_0x2db148=_0x2db148-0x0;var _0x563a87=_0x5539[_0x2db148];return _0x563a87;};'use strict';var OpenchannelQueueEvents=require(_0x9553('0x0'));var events=[_0x9553('0x1'),_0x9553('0x2'),'update'];function createListener(_0x5309b0,_0x5f3698){return function(_0x1d2cc4){_0x5f3698[_0x9553('0x3')](_0x5309b0,_0x1d2cc4);};}function removeListener(_0x9c4bb1,_0x1999a0){return function(){OpenchannelQueueEvents['removeListener'](_0x9c4bb1,_0x1999a0);};}exports[_0x9553('0x4')]=function(_0x38bc9e){for(var _0x11135c=0x0,_0x19da57=events['length'];_0x11135c<_0x19da57;_0x11135c++){var _0x5e78bc=events[_0x11135c];var _0x3e3d45=createListener(_0x9553('0x5')+_0x5e78bc,_0x38bc9e);OpenchannelQueueEvents['on'](_0x5e78bc,_0x3e3d45);}}; \ No newline at end of file +var _0xd026=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xe99253,_0x3a3b1e){var _0x2b5bd7=function(_0x1151b2){while(--_0x1151b2){_0xe99253['push'](_0xe99253['shift']());}};_0x2b5bd7(++_0x3a3b1e);}(_0xd026,0x17f));var _0x6d02=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xd026[_0xbb091];return _0x467a04;};'use strict';var OpenchannelQueueEvents=require(_0x6d02('0x0'));var events=[_0x6d02('0x1'),'remove','update'];function createListener(_0xf3e257,_0x1d4e36){return function(_0x110f3a){_0x1d4e36[_0x6d02('0x2')](_0xf3e257,_0x110f3a);};}function removeListener(_0x5e08f3,_0x431119){return function(){OpenchannelQueueEvents[_0x6d02('0x3')](_0x5e08f3,_0x431119);};}exports[_0x6d02('0x4')]=function(_0x5c4d32){for(var _0x30e6b0=0x0,_0x25cce9=events[_0x6d02('0x5')];_0x30e6b0<_0x25cce9;_0x30e6b0++){var _0x2d997f=events[_0x30e6b0];var _0x4d37dc=createListener(_0x6d02('0x6')+_0x2d997f,_0x5c4d32);OpenchannelQueueEvents['on'](_0x2d997f,_0x4d37dc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e1da914..22093b3 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 _0x15a4=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x15a4,0x1c4));var _0x415a=function(_0x1fc0f2,_0x557517){_0x1fc0f2=_0x1fc0f2-0x0;var _0x5a3eef=_0x15a4[_0x1fc0f2];return _0x5a3eef;};'use strict';var multer=require(_0x415a('0x0'));var util=require(_0x415a('0x1'));var path=require(_0x415a('0x2'));var timeout=require(_0x415a('0x3'));var express=require(_0x415a('0x4'));var router=express['Router']();var fs_extra=require(_0x415a('0x5'));var auth=require(_0x415a('0x6'));var interaction=require(_0x415a('0x7'));var config=require(_0x415a('0x8'));var controller=require(_0x415a('0x9'));router[_0x415a('0xa')]('/',auth[_0x415a('0xb')](),controller[_0x415a('0xc')]);router[_0x415a('0xa')](_0x415a('0xd'),auth[_0x415a('0xb')](),controller[_0x415a('0xe')]);router['get'](_0x415a('0xf'),auth[_0x415a('0xb')](),controller[_0x415a('0x10')]);router['post']('/',auth[_0x415a('0xb')](),controller[_0x415a('0x11')]);router[_0x415a('0x12')](_0x415a('0xf'),auth[_0x415a('0xb')](),controller['update']);router['delete'](_0x415a('0xf'),auth[_0x415a('0xb')](),controller[_0x415a('0x13')]);module[_0x415a('0x14')]=router; \ No newline at end of file +var _0xf7a5=['connect-timeout','express','fs-extra','./openchannelQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7a5,0xa1));var _0x5f7a=function(_0x48ea38,_0xb5b397){_0x48ea38=_0x48ea38-0x0;var _0xa6780=_0xf7a5[_0x48ea38];return _0xa6780;};'use strict';var multer=require(_0x5f7a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f7a('0x1'));var express=require(_0x5f7a('0x2'));var router=express['Router']();var fs_extra=require(_0x5f7a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5f7a('0x4'));router[_0x5f7a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5f7a('0x5')](_0x5f7a('0x6'),auth[_0x5f7a('0x7')](),controller[_0x5f7a('0x8')]);router[_0x5f7a('0x5')](_0x5f7a('0x9'),auth[_0x5f7a('0x7')](),controller[_0x5f7a('0xa')]);router[_0x5f7a('0xb')]('/',auth[_0x5f7a('0x7')](),controller[_0x5f7a('0xc')]);router[_0x5f7a('0xd')](_0x5f7a('0x9'),auth[_0x5f7a('0x7')](),controller[_0x5f7a('0xe')]);router[_0x5f7a('0xf')]('/:id',auth[_0x5f7a('0x7')](),controller[_0x5f7a('0x10')]);module[_0x5f7a('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index feb8d44..c6d2bad 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 _0x3b85=['moment','sequelize','exports','STRING','DATE'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x3b85,0x14a));var _0x53b8=function(_0xac2804,_0x4b22b8){_0xac2804=_0xac2804-0x0;var _0x1f1c66=_0x3b85[_0xac2804];return _0x1f1c66;};'use strict';var moment=require(_0x53b8('0x0'));var Sequelize=require(_0x53b8('0x1'));module[_0x53b8('0x2')]={'uniqueid':{'type':Sequelize[_0x53b8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x53b8('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x53b8('0x4')]},'acceptAt':{'type':Sequelize[_0x53b8('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x53b8('0x3')]}}; \ No newline at end of file +var _0x3ea4=['sequelize','exports','STRING','DATE','moment'];(function(_0x25ce4f,_0xad7194){var _0x3de67c=function(_0x573309){while(--_0x573309){_0x25ce4f['push'](_0x25ce4f['shift']());}};_0x3de67c(++_0xad7194);}(_0x3ea4,0xd6));var _0x43ea=function(_0x377743,_0x584cab){_0x377743=_0x377743-0x0;var _0x30ae30=_0x3ea4[_0x377743];return _0x30ae30;};'use strict';var moment=require(_0x43ea('0x0'));var Sequelize=require(_0x43ea('0x1'));module[_0x43ea('0x2')]={'uniqueid':{'type':Sequelize[_0x43ea('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x43ea('0x4')]},'leaveAt':{'type':Sequelize[_0x43ea('0x4')]},'acceptAt':{'type':Sequelize[_0x43ea('0x4')]},'exitAt':{'type':Sequelize[_0x43ea('0x4')]},'reason':{'type':Sequelize[_0x43ea('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f177c55..e02747d 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 _0x4d83=['rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','catch','create','find','params','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','save','update','destroy','error','name','send','index','map','OpenchannelQueueReport'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x4d83,0x1ba));var _0x34d8=function(_0x448f04,_0xa951e9){_0x448f04=_0x448f04-0x0;var _0x37641f=_0x4d83[_0x448f04];return _0x37641f;};'use strict';var emlformat=require(_0x34d8('0x0'));var rimraf=require(_0x34d8('0x1'));var zipdir=require(_0x34d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34d8('0x3'));var moment=require(_0x34d8('0x4'));var BPromise=require(_0x34d8('0x5'));var Mustache=require(_0x34d8('0x6'));var util=require(_0x34d8('0x7'));var path=require(_0x34d8('0x8'));var sox=require(_0x34d8('0x9'));var csv=require('to-csv');var ejs=require(_0x34d8('0xa'));var fs=require('fs');var fs_extra=require(_0x34d8('0xb'));var _=require(_0x34d8('0xc'));var squel=require(_0x34d8('0xd'));var crypto=require(_0x34d8('0xe'));var jsforce=require(_0x34d8('0xf'));var deskjs=require(_0x34d8('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x34d8('0x11'));var Redis=require(_0x34d8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x34d8('0x13'));var as=require(_0x34d8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x34d8('0x15'));var config=require(_0x34d8('0x16'));var licenseUtil=require(_0x34d8('0x17'));var db=require(_0x34d8('0x18'))['db'];function respondWithStatusCode(_0x252c38,_0x41b68b){_0x41b68b=_0x41b68b||0xcc;return function(_0x325d73){if(_0x325d73){return _0x252c38['sendStatus'](_0x41b68b);}return _0x252c38[_0x34d8('0x19')](_0x41b68b)['end']();};}function respondWithResult(_0x1d070f,_0x534268){_0x534268=_0x534268||0xc8;return function(_0x5a79e8){if(_0x5a79e8){return _0x1d070f[_0x34d8('0x19')](_0x534268)[_0x34d8('0x1a')](_0x5a79e8);}};}function respondWithFilteredResult(_0x301493,_0x2163cc){return function(_0xd1ed78){if(_0xd1ed78){var _0x287895=typeof _0x2163cc[_0x34d8('0x1b')]===_0x34d8('0x1c')&&typeof _0x2163cc[_0x34d8('0x1d')]==='undefined';var _0x41ba64=_0xd1ed78[_0x34d8('0x1e')];var _0x11c224=_0x287895?0x0:_0x2163cc[_0x34d8('0x1b')];var _0x11cac4=_0x287895?_0xd1ed78[_0x34d8('0x1e')]:_0x2163cc[_0x34d8('0x1b')]+_0x2163cc[_0x34d8('0x1d')];var _0x5f1e7e;if(_0x11cac4>=_0x41ba64){_0x11cac4=_0x41ba64;_0x5f1e7e=0xc8;}else{_0x5f1e7e=0xce;}_0x301493[_0x34d8('0x19')](_0x5f1e7e);return _0x301493[_0x34d8('0x1f')]('Content-Range',_0x11c224+'-'+_0x11cac4+'/'+_0x41ba64)[_0x34d8('0x1a')](_0xd1ed78);}return null;};}function patchUpdates(_0x1d010e){return function(_0xb16c66){try{jsonpatch['apply'](_0xb16c66,_0x1d010e,!![]);}catch(_0x3e7991){return BPromise['reject'](_0x3e7991);}return _0xb16c66[_0x34d8('0x20')]();};}function saveUpdates(_0x24f6a3,_0xfe97d1){return function(_0xfb5345){if(_0xfb5345){return _0xfb5345[_0x34d8('0x21')](_0x24f6a3)['then'](function(_0xdb1eb4){return _0xdb1eb4;});}return null;};}function removeEntity(_0x2e2c80,_0x54f0fb){return function(_0x33b397){if(_0x33b397){return _0x33b397[_0x34d8('0x22')]()['then'](function(){_0x2e2c80[_0x34d8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb4e9,_0x31d327){return function(_0x1beb35){if(!_0x1beb35){_0x3fb4e9['sendStatus'](0x194);}return _0x1beb35;};}function handleError(_0xbaa3de,_0x1cb520){_0x1cb520=_0x1cb520||0x1f4;return function(_0x4b3485){logger[_0x34d8('0x23')](_0x4b3485['stack']);if(_0x4b3485['name']){delete _0x4b3485[_0x34d8('0x24')];}_0xbaa3de['status'](_0x1cb520)[_0x34d8('0x25')](_0x4b3485);};}exports[_0x34d8('0x26')]=function(_0x351529,_0x37efff){var _0x160f3a={},_0x502422={},_0xbbcf4d={'count':0x0,'rows':[]};var _0x290f66=_[_0x34d8('0x27')](db[_0x34d8('0x28')][_0x34d8('0x29')],function(_0x414177){return{'name':_0x414177[_0x34d8('0x2a')],'type':_0x414177[_0x34d8('0x2b')][_0x34d8('0x2c')]};});_0x502422[_0x34d8('0x2d')]=_[_0x34d8('0x27')](_0x290f66,_0x34d8('0x24'));_0x502422['query']=_[_0x34d8('0x2e')](_0x351529[_0x34d8('0x2f')]);_0x502422[_0x34d8('0x30')]=_['intersection'](_0x502422[_0x34d8('0x2d')],_0x502422[_0x34d8('0x2f')]);_0x160f3a[_0x34d8('0x31')]=_[_0x34d8('0x32')](_0x502422[_0x34d8('0x2d')],qs[_0x34d8('0x33')](_0x351529['query'][_0x34d8('0x33')]));_0x160f3a[_0x34d8('0x31')]=_0x160f3a[_0x34d8('0x31')][_0x34d8('0x34')]?_0x160f3a[_0x34d8('0x31')]:_0x502422['model'];if(!_0x351529[_0x34d8('0x2f')]['hasOwnProperty']('nolimit')){_0x160f3a[_0x34d8('0x1d')]=qs['limit'](_0x351529['query'][_0x34d8('0x1d')]);_0x160f3a[_0x34d8('0x1b')]=qs['offset'](_0x351529[_0x34d8('0x2f')][_0x34d8('0x1b')]);}_0x160f3a[_0x34d8('0x35')]=qs['sort'](_0x351529[_0x34d8('0x2f')]['sort']);_0x160f3a[_0x34d8('0x36')]=qs['filters'](_['pick'](_0x351529[_0x34d8('0x2f')],_0x502422['filters']),_0x290f66);if(_0x351529[_0x34d8('0x2f')][_0x34d8('0x37')]){_0x160f3a['where']=_[_0x34d8('0x38')](_0x160f3a['where'],{'$or':_['map'](_0x290f66,function(_0x43d9fb){if(_0x43d9fb[_0x34d8('0x2b')]!==_0x34d8('0x39')){var _0x60ff56={};_0x60ff56[_0x43d9fb[_0x34d8('0x24')]]={'$like':'%'+_0x351529[_0x34d8('0x2f')][_0x34d8('0x37')]+'%'};return _0x60ff56;}})});}_0x160f3a=_[_0x34d8('0x38')]({},_0x160f3a,_0x351529[_0x34d8('0x3a')]);var _0xf52e4f={'where':_0x160f3a[_0x34d8('0x36')]};return db[_0x34d8('0x28')]['count'](_0xf52e4f)['then'](function(_0x42102b){_0xbbcf4d[_0x34d8('0x1e')]=_0x42102b;if(_0x351529['query'][_0x34d8('0x3b')]){_0x160f3a[_0x34d8('0x3c')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x34d8('0x3d')](_0x160f3a);})[_0x34d8('0x3e')](function(_0x5093a3){_0xbbcf4d['rows']=_0x5093a3;return _0xbbcf4d;})[_0x34d8('0x3e')](respondWithFilteredResult(_0x37efff,_0x160f3a))[_0x34d8('0x3f')](handleError(_0x37efff,null));};exports['show']=function(_0x4a901d,_0x4f2e03){var _0x4217a4={'raw':!![],'where':{'id':_0x4a901d['params']['id']}},_0x1bcd76={};_0x1bcd76['model']=_[_0x34d8('0x2e')](db[_0x34d8('0x28')][_0x34d8('0x29')]);_0x1bcd76[_0x34d8('0x2f')]=_[_0x34d8('0x2e')](_0x4a901d[_0x34d8('0x2f')]);_0x1bcd76['filters']=_['intersection'](_0x1bcd76[_0x34d8('0x2d')],_0x1bcd76['query']);_0x4217a4[_0x34d8('0x31')]=_[_0x34d8('0x32')](_0x1bcd76[_0x34d8('0x2d')],qs[_0x34d8('0x33')](_0x4a901d['query'][_0x34d8('0x33')]));_0x4217a4[_0x34d8('0x31')]=_0x4217a4[_0x34d8('0x31')]['length']?_0x4217a4[_0x34d8('0x31')]:_0x1bcd76[_0x34d8('0x2d')];if(_0x4a901d['query'][_0x34d8('0x3b')]){_0x4217a4[_0x34d8('0x3c')]=[{'all':!![]}];}_0x4217a4=_[_0x34d8('0x38')]({},_0x4217a4,_0x4a901d[_0x34d8('0x3a')]);return db[_0x34d8('0x28')]['find'](_0x4217a4)[_0x34d8('0x3e')](handleEntityNotFound(_0x4f2e03,null))[_0x34d8('0x3e')](respondWithResult(_0x4f2e03,null))['catch'](handleError(_0x4f2e03,null));};exports[_0x34d8('0x40')]=function(_0x3b1b9a,_0x321234){return db[_0x34d8('0x28')]['create'](_0x3b1b9a['body'],{})[_0x34d8('0x3e')](respondWithResult(_0x321234,0xc9))['catch'](handleError(_0x321234,null));};exports[_0x34d8('0x21')]=function(_0x5c9450,_0x421dc7){if(_0x5c9450['body']['id']){delete _0x5c9450['body']['id'];}return db['OpenchannelQueueReport'][_0x34d8('0x41')]({'where':{'id':_0x5c9450[_0x34d8('0x42')]['id']}})[_0x34d8('0x3e')](handleEntityNotFound(_0x421dc7,null))[_0x34d8('0x3e')](saveUpdates(_0x5c9450[_0x34d8('0x43')],null))[_0x34d8('0x3e')](respondWithResult(_0x421dc7,null))[_0x34d8('0x3f')](handleError(_0x421dc7,null));};exports[_0x34d8('0x22')]=function(_0x25fc04,_0x4bb1af){return db['OpenchannelQueueReport'][_0x34d8('0x41')]({'where':{'id':_0x25fc04[_0x34d8('0x42')]['id']}})[_0x34d8('0x3e')](handleEntityNotFound(_0x4bb1af,null))[_0x34d8('0x3e')](removeEntity(_0x4bb1af,null))[_0x34d8('0x3f')](handleError(_0x4bb1af,null));};exports[_0x34d8('0x44')]=function(_0x3c304d,_0x23d13d){return db[_0x34d8('0x28')][_0x34d8('0x44')]()[_0x34d8('0x3e')](respondWithResult(_0x23d13d,null))[_0x34d8('0x3f')](handleError(_0x23d13d,null));}; \ No newline at end of file +var _0x5249=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','VIRTUAL','filter','options','includeAll','rows','show','params','include','merge','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','mustache','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'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x5249,0xc3));var _0x9524=function(_0x494ad2,_0x5840fb){_0x494ad2=_0x494ad2-0x0;var _0x636790=_0x5249[_0x494ad2];return _0x636790;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9524('0x0'));var zipdir=require(_0x9524('0x1'));var jsonpatch=require(_0x9524('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9524('0x3'));var util=require('util');var path=require(_0x9524('0x4'));var sox=require(_0x9524('0x5'));var csv=require(_0x9524('0x6'));var ejs=require(_0x9524('0x7'));var fs=require('fs');var fs_extra=require(_0x9524('0x8'));var _=require(_0x9524('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9524('0xa'));var deskjs=require(_0x9524('0xb'));var toCsv=require(_0x9524('0x6'));var querystring=require(_0x9524('0xc'));var Papa=require(_0x9524('0xd'));var Redis=require(_0x9524('0xe'));var authService=require(_0x9524('0xf'));var qs=require(_0x9524('0x10'));var as=require(_0x9524('0x11'));var hardwareService=require(_0x9524('0x12'));var logger=require(_0x9524('0x13'))(_0x9524('0x14'));var utils=require(_0x9524('0x15'));var config=require(_0x9524('0x16'));var licenseUtil=require(_0x9524('0x17'));var db=require(_0x9524('0x18'))['db'];function respondWithStatusCode(_0x50cb07,_0x233806){_0x233806=_0x233806||0xcc;return function(_0x32f0dc){if(_0x32f0dc){return _0x50cb07[_0x9524('0x19')](_0x233806);}return _0x50cb07[_0x9524('0x1a')](_0x233806)['end']();};}function respondWithResult(_0xed8c30,_0x4be4bc){_0x4be4bc=_0x4be4bc||0xc8;return function(_0x42711c){if(_0x42711c){return _0xed8c30['status'](_0x4be4bc)['json'](_0x42711c);}};}function respondWithFilteredResult(_0xd1bf09,_0x4dc0cf){return function(_0x26b9be){if(_0x26b9be){var _0x117f77=typeof _0x4dc0cf[_0x9524('0x1b')]===_0x9524('0x1c')&&typeof _0x4dc0cf[_0x9524('0x1d')]===_0x9524('0x1c');var _0xfdf6b8=_0x26b9be[_0x9524('0x1e')];var _0x520a5c=_0x117f77?0x0:_0x4dc0cf[_0x9524('0x1b')];var _0x5307a3=_0x117f77?_0x26b9be['count']:_0x4dc0cf[_0x9524('0x1b')]+_0x4dc0cf[_0x9524('0x1d')];var _0x4f8baf;if(_0x5307a3>=_0xfdf6b8){_0x5307a3=_0xfdf6b8;_0x4f8baf=0xc8;}else{_0x4f8baf=0xce;}_0xd1bf09['status'](_0x4f8baf);return _0xd1bf09[_0x9524('0x1f')](_0x9524('0x20'),_0x520a5c+'-'+_0x5307a3+'/'+_0xfdf6b8)[_0x9524('0x21')](_0x26b9be);}return null;};}function patchUpdates(_0x544ac6){return function(_0x5ed3a0){try{jsonpatch['apply'](_0x5ed3a0,_0x544ac6,!![]);}catch(_0x549086){return BPromise[_0x9524('0x22')](_0x549086);}return _0x5ed3a0[_0x9524('0x23')]();};}function saveUpdates(_0x46ef92,_0x221fc1){return function(_0x48f208){if(_0x48f208){return _0x48f208[_0x9524('0x24')](_0x46ef92)[_0x9524('0x25')](function(_0x45e3fb){return _0x45e3fb;});}return null;};}function removeEntity(_0x2c3773,_0x1957a3){return function(_0x4fe93a){if(_0x4fe93a){return _0x4fe93a[_0x9524('0x26')]()[_0x9524('0x25')](function(){_0x2c3773['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x399ce6,_0x48bc6d){return function(_0x21df90){if(!_0x21df90){_0x399ce6[_0x9524('0x19')](0x194);}return _0x21df90;};}function handleError(_0x16b47b,_0x224b9e){_0x224b9e=_0x224b9e||0x1f4;return function(_0x29beac){logger[_0x9524('0x27')](_0x29beac[_0x9524('0x28')]);if(_0x29beac[_0x9524('0x29')]){delete _0x29beac['name'];}_0x16b47b['status'](_0x224b9e)['send'](_0x29beac);};}exports[_0x9524('0x2a')]=function(_0x1c9b79,_0xd3bf14){var _0x477a51={},_0x37db0b={},_0x4c3ecc={'count':0x0,'rows':[]};var _0x5040b5=_[_0x9524('0x2b')](db[_0x9524('0x2c')][_0x9524('0x2d')],function(_0x569cb3){return{'name':_0x569cb3['fieldName'],'type':_0x569cb3[_0x9524('0x2e')]['key']};});_0x37db0b[_0x9524('0x2f')]=_['map'](_0x5040b5,_0x9524('0x29'));_0x37db0b['query']=_[_0x9524('0x30')](_0x1c9b79[_0x9524('0x31')]);_0x37db0b[_0x9524('0x32')]=_['intersection'](_0x37db0b['model'],_0x37db0b[_0x9524('0x31')]);_0x477a51['attributes']=_[_0x9524('0x33')](_0x37db0b['model'],qs[_0x9524('0x34')](_0x1c9b79[_0x9524('0x31')][_0x9524('0x34')]));_0x477a51[_0x9524('0x35')]=_0x477a51['attributes'][_0x9524('0x36')]?_0x477a51[_0x9524('0x35')]:_0x37db0b[_0x9524('0x2f')];if(!_0x1c9b79['query']['hasOwnProperty'](_0x9524('0x37'))){_0x477a51[_0x9524('0x1d')]=qs[_0x9524('0x1d')](_0x1c9b79[_0x9524('0x31')][_0x9524('0x1d')]);_0x477a51[_0x9524('0x1b')]=qs[_0x9524('0x1b')](_0x1c9b79[_0x9524('0x31')]['offset']);}_0x477a51['order']=qs[_0x9524('0x38')](_0x1c9b79[_0x9524('0x31')]['sort']);_0x477a51[_0x9524('0x39')]=qs[_0x9524('0x32')](_['pick'](_0x1c9b79['query'],_0x37db0b[_0x9524('0x32')]),_0x5040b5);if(_0x1c9b79[_0x9524('0x31')]['filter']){_0x477a51[_0x9524('0x39')]=_['merge'](_0x477a51['where'],{'$or':_['map'](_0x5040b5,function(_0x4aeb49){if(_0x4aeb49[_0x9524('0x2e')]!==_0x9524('0x3a')){var _0x1ad152={};_0x1ad152[_0x4aeb49['name']]={'$like':'%'+_0x1c9b79[_0x9524('0x31')][_0x9524('0x3b')]+'%'};return _0x1ad152;}})});}_0x477a51=_['merge']({},_0x477a51,_0x1c9b79[_0x9524('0x3c')]);var _0x5637fe={'where':_0x477a51['where']};return db[_0x9524('0x2c')][_0x9524('0x1e')](_0x5637fe)[_0x9524('0x25')](function(_0x32bf9d){_0x4c3ecc[_0x9524('0x1e')]=_0x32bf9d;if(_0x1c9b79[_0x9524('0x31')][_0x9524('0x3d')]){_0x477a51['include']=[{'all':!![]}];}return db[_0x9524('0x2c')]['findAll'](_0x477a51);})[_0x9524('0x25')](function(_0x329fdc){_0x4c3ecc[_0x9524('0x3e')]=_0x329fdc;return _0x4c3ecc;})[_0x9524('0x25')](respondWithFilteredResult(_0xd3bf14,_0x477a51))['catch'](handleError(_0xd3bf14,null));};exports[_0x9524('0x3f')]=function(_0x414c1b,_0x1d7ff8){var _0x2e0093={'raw':!![],'where':{'id':_0x414c1b[_0x9524('0x40')]['id']}},_0x215e45={};_0x215e45[_0x9524('0x2f')]=_[_0x9524('0x30')](db[_0x9524('0x2c')]['rawAttributes']);_0x215e45[_0x9524('0x31')]=_[_0x9524('0x30')](_0x414c1b[_0x9524('0x31')]);_0x215e45['filters']=_[_0x9524('0x33')](_0x215e45[_0x9524('0x2f')],_0x215e45[_0x9524('0x31')]);_0x2e0093[_0x9524('0x35')]=_[_0x9524('0x33')](_0x215e45[_0x9524('0x2f')],qs[_0x9524('0x34')](_0x414c1b[_0x9524('0x31')][_0x9524('0x34')]));_0x2e0093[_0x9524('0x35')]=_0x2e0093[_0x9524('0x35')][_0x9524('0x36')]?_0x2e0093[_0x9524('0x35')]:_0x215e45[_0x9524('0x2f')];if(_0x414c1b[_0x9524('0x31')]['includeAll']){_0x2e0093[_0x9524('0x41')]=[{'all':!![]}];}_0x2e0093=_[_0x9524('0x42')]({},_0x2e0093,_0x414c1b[_0x9524('0x3c')]);return db[_0x9524('0x2c')][_0x9524('0x43')](_0x2e0093)[_0x9524('0x25')](handleEntityNotFound(_0x1d7ff8,null))['then'](respondWithResult(_0x1d7ff8,null))[_0x9524('0x44')](handleError(_0x1d7ff8,null));};exports[_0x9524('0x45')]=function(_0x2079e4,_0x129600){return db[_0x9524('0x2c')][_0x9524('0x45')](_0x2079e4[_0x9524('0x46')],{})[_0x9524('0x25')](respondWithResult(_0x129600,0xc9))[_0x9524('0x44')](handleError(_0x129600,null));};exports[_0x9524('0x24')]=function(_0x4c1712,_0x248c14){if(_0x4c1712[_0x9524('0x46')]['id']){delete _0x4c1712[_0x9524('0x46')]['id'];}return db[_0x9524('0x2c')][_0x9524('0x43')]({'where':{'id':_0x4c1712[_0x9524('0x40')]['id']}})['then'](handleEntityNotFound(_0x248c14,null))[_0x9524('0x25')](saveUpdates(_0x4c1712['body'],null))[_0x9524('0x25')](respondWithResult(_0x248c14,null))[_0x9524('0x44')](handleError(_0x248c14,null));};exports[_0x9524('0x26')]=function(_0x30c34a,_0x2dd2c4){return db['OpenchannelQueueReport'][_0x9524('0x43')]({'where':{'id':_0x30c34a[_0x9524('0x40')]['id']}})['then'](handleEntityNotFound(_0x2dd2c4,null))['then'](removeEntity(_0x2dd2c4,null))[_0x9524('0x44')](handleError(_0x2dd2c4,null));};exports[_0x9524('0x47')]=function(_0x167d4b,_0xffe51b){return db[_0x9524('0x2c')][_0x9524('0x47')]()['then'](respondWithResult(_0xffe51b,null))[_0x9524('0x44')](handleError(_0xffe51b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7ad19b3..b2fa107 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x58e4eb,_0x4e9a11){var _0x3c8177=function(_0x2b17ba){while(--_0x2b17ba){_0x58e4eb['push'](_0x58e4eb['shift']());}};_0x3c8177(++_0x4e9a11);}(_0x7a54,0x106));var _0x47a5=function(_0x302d12,_0x529be4){_0x302d12=_0x302d12-0x0;var _0xab27a1=_0x7a54[_0x302d12];return _0xab27a1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0x814b,0x1a2));var _0xb814=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x814b[_0x2962d5];return _0x273406;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 3caf262..037f05a 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 _0x2884=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','attributes','limit','lodash','moment'];(function(_0x4cc31e,_0x480830){var _0x5cae79=function(_0x3a1b6a){while(--_0x3a1b6a){_0x4cc31e['push'](_0x4cc31e['shift']());}};_0x5cae79(++_0x480830);}(_0x2884,0x1eb));var _0x4288=function(_0x5aea3e,_0x20d237){_0x5aea3e=_0x5aea3e-0x0;var _0x558b7b=_0x2884[_0x5aea3e];return _0x558b7b;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526a07,_0x3a930e,_0x5e4cfc){return new BPromise(function(_0x25023a,_0x237b02){return client['request'](_0x526a07,_0x5e4cfc)[_0x4288('0x9')](function(_0x3c8d6e){logger[_0x4288('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a930e,'request\x20sent');logger[_0x4288('0xb')](_0x4288('0xc'),_0x3a930e,_0x4288('0xd'),JSON[_0x4288('0xe')](_0x3c8d6e));if(_0x3c8d6e[_0x4288('0xf')]){if(_0x3c8d6e[_0x4288('0xf')][_0x4288('0x10')]===0x1f4){logger['error'](_0x4288('0x11'),_0x3a930e,_0x3c8d6e[_0x4288('0xf')][_0x4288('0x12')]);return _0x237b02(_0x3c8d6e[_0x4288('0xf')]['message']);}logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x3c8d6e['error'][_0x4288('0x12')]);return _0x25023a(_0x3c8d6e['error'][_0x4288('0x12')]);}else{logger['info'](_0x4288('0x11'),_0x3a930e,_0x4288('0xd'));_0x25023a(_0x3c8d6e[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0x1db33b){logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x1db33b);_0x237b02(_0x1db33b);});});}exports[_0x4288('0x15')]=function(_0x53fb81){var _0x199919=this;return new Promise(function(_0xde03f4,_0x5e6de1){return db['OpenchannelQueueReport']['create'](_0x53fb81[_0x4288('0x16')],{'raw':_0x53fb81[_0x4288('0x17')]?_0x53fb81['options'][_0x4288('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x865365){logger[_0x4288('0xa')](_0x4288('0x15'),_0x53fb81);logger['debug'](_0x4288('0x15'),_0x53fb81,JSON[_0x4288('0xe')](_0x865365));_0xde03f4(_0x865365);})[_0x4288('0x14')](function(_0x4b9cda){logger['error'](_0x4288('0x15'),_0x4b9cda[_0x4288('0x12')],_0x53fb81);_0x5e6de1(_0x199919[_0x4288('0xf')](0x1f4,_0x4b9cda[_0x4288('0x12')]));});});};exports[_0x4288('0x19')]=function(_0x292e74){var _0x500c1e=this;return new Promise(function(_0x5f0c29,_0x1ff415){return db[_0x4288('0x1a')]['update'](_0x292e74[_0x4288('0x16')],{'raw':_0x292e74['options']?_0x292e74['options'][_0x4288('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')]['where']||null:null,'attributes':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')][_0x4288('0x1b')]||null:null,'limit':_0x292e74[_0x4288('0x17')]?_0x292e74[_0x4288('0x17')][_0x4288('0x1c')]||null:null})['then'](function(_0x3a8e3e){logger[_0x4288('0xa')](_0x4288('0x19'),_0x292e74);logger[_0x4288('0xb')](_0x4288('0x19'),_0x292e74,JSON[_0x4288('0xe')](_0x3a8e3e));_0x5f0c29(_0x3a8e3e);})[_0x4288('0x14')](function(_0x5bca41){logger[_0x4288('0xf')](_0x4288('0x19'),_0x5bca41[_0x4288('0x12')],_0x292e74);_0x1ff415(_0x500c1e[_0x4288('0xf')](0x1f4,_0x5bca41[_0x4288('0x12')]));});});}; \ No newline at end of file +var _0x235b=['code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','where','limit','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x417025,_0x36b36e){var _0x16ca0c=function(_0x25d07f){while(--_0x25d07f){_0x417025['push'](_0x417025['shift']());}};_0x16ca0c(++_0x36b36e);}(_0x235b,0x1ed));var _0xb235=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x235b[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb235('0x1'));var rs=require(_0xb235('0x2'));var fs=require('fs');var Redis=require(_0xb235('0x3'));var db=require(_0xb235('0x4'))['db'];var utils=require(_0xb235('0x5'));var logger=require(_0xb235('0x6'))('rpc');var config=require(_0xb235('0x7'));var jayson=require(_0xb235('0x8'));var client=jayson[_0xb235('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d0ae,_0x44559a,_0x2affe8){return new BPromise(function(_0x436d63,_0x3241b4){return client['request'](_0x12d0ae,_0x2affe8)['then'](function(_0xecf759){logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));logger[_0xb235('0xd')](_0xb235('0xe'),_0x44559a,_0xb235('0xc'),JSON[_0xb235('0xf')](_0xecf759));if(_0xecf759['error']){if(_0xecf759[_0xb235('0x10')][_0xb235('0x11')]===0x1f4){logger[_0xb235('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x44559a,_0xecf759[_0xb235('0x10')]['message']);return _0x3241b4(_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);}logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);return _0x436d63(_0xecf759[_0xb235('0x10')]['message']);}else{logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));_0x436d63(_0xecf759[_0xb235('0x13')][_0xb235('0x12')]);}})[_0xb235('0x14')](function(_0x16f044){logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0x16f044);_0x3241b4(_0x16f044);});});}exports[_0xb235('0x15')]=function(_0x2f1c46){var _0x1b9eae=this;return new Promise(function(_0x1f7cb9,_0x55a479){return db[_0xb235('0x16')]['create'](_0x2f1c46[_0xb235('0x17')],{'raw':_0x2f1c46['options']?_0x2f1c46[_0xb235('0x18')][_0xb235('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x447ec6){logger[_0xb235('0xa')](_0xb235('0x15'),_0x2f1c46);logger[_0xb235('0xd')](_0xb235('0x15'),_0x2f1c46,JSON['stringify'](_0x447ec6));_0x1f7cb9(_0x447ec6);})[_0xb235('0x14')](function(_0x12f787){logger[_0xb235('0x10')](_0xb235('0x15'),_0x12f787[_0xb235('0x12')],_0x2f1c46);_0x55a479(_0x1b9eae[_0xb235('0x10')](0x1f4,_0x12f787['message']));});});};exports[_0xb235('0x1a')]=function(_0x57d7f5){var _0x2b5c93=this;return new Promise(function(_0x1d7122,_0xb97b29){return db['OpenchannelQueueReport']['update'](_0x57d7f5['body'],{'raw':_0x57d7f5[_0xb235('0x18')]?_0x57d7f5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d7f5[_0xb235('0x18')]?_0x57d7f5[_0xb235('0x18')][_0xb235('0x1b')]||null:null,'attributes':_0x57d7f5['options']?_0x57d7f5[_0xb235('0x18')]['attributes']||null:null,'limit':_0x57d7f5['options']?_0x57d7f5[_0xb235('0x18')][_0xb235('0x1c')]||null:null})[_0xb235('0x1d')](function(_0x4fe640){logger[_0xb235('0xa')](_0xb235('0x1a'),_0x57d7f5);logger[_0xb235('0xd')]('UpdateOpenchannelQueueReport',_0x57d7f5,JSON['stringify'](_0x4fe640));_0x1d7122(_0x4fe640);})[_0xb235('0x14')](function(_0x4871b7){logger[_0xb235('0x10')]('UpdateOpenchannelQueueReport',_0x4871b7['message'],_0x57d7f5);_0xb97b29(_0x2b5c93[_0xb235('0x10')](0x1f4,_0x4871b7[_0xb235('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f2ecbeb..7c71029 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 _0x4951=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','util','path','express'];(function(_0x34978d,_0x4fa165){var _0x2820f7=function(_0x374749){while(--_0x374749){_0x34978d['push'](_0x34978d['shift']());}};_0x2820f7(++_0x4fa165);}(_0x4951,0xe1));var _0x1495=function(_0x16b6e2,_0x24b2a5){_0x16b6e2=_0x16b6e2-0x0;var _0xad9cda=_0x4951[_0x16b6e2];return _0xad9cda;};'use strict';var multer=require('multer');var util=require(_0x1495('0x0'));var path=require(_0x1495('0x1'));var timeout=require('connect-timeout');var express=require(_0x1495('0x2'));var router=express[_0x1495('0x3')]();var fs_extra=require(_0x1495('0x4'));var auth=require(_0x1495('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1495('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0x1495('0x7')]('/',auth[_0x1495('0x8')](),controller[_0x1495('0x9')]);router['get'](_0x1495('0xa'),auth[_0x1495('0x8')](),controller[_0x1495('0xb')]);router[_0x1495('0x7')](_0x1495('0xc'),auth['isAuthenticated'](),controller[_0x1495('0xd')]);router[_0x1495('0xe')]('/',auth[_0x1495('0x8')](),controller['create']);router[_0x1495('0xf')](_0x1495('0xc'),auth[_0x1495('0x8')](),controller[_0x1495('0x10')]);router[_0x1495('0x11')](_0x1495('0xc'),auth[_0x1495('0x8')](),controller['destroy']);module[_0x1495('0x12')]=router; \ No newline at end of file +var _0xf70f=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0xf70f,0x1e4));var _0xff70=function(_0x41b133,_0x114320){_0x41b133=_0x41b133-0x0;var _0x844201=_0xf70f[_0x41b133];return _0x844201;};'use strict';var multer=require(_0xff70('0x0'));var util=require(_0xff70('0x1'));var path=require('path');var timeout=require(_0xff70('0x2'));var express=require(_0xff70('0x3'));var router=express[_0xff70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff70('0x5'));var interaction=require(_0xff70('0x6'));var config=require(_0xff70('0x7'));var controller=require(_0xff70('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xff70('0x9')]);router[_0xff70('0xa')]('/describe',auth[_0xff70('0xb')](),controller[_0xff70('0xc')]);router['get'](_0xff70('0xd'),auth[_0xff70('0xb')](),controller[_0xff70('0xe')]);router[_0xff70('0xf')]('/',auth['isAuthenticated'](),controller[_0xff70('0x10')]);router[_0xff70('0x11')]('/:id',auth[_0xff70('0xb')](),controller[_0xff70('0x12')]);router[_0xff70('0x13')]('/:id',auth[_0xff70('0xb')](),controller[_0xff70('0x14')]);module[_0xff70('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d94014c..4167b49 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x265721,_0x1503f2){var _0x11ec95=function(_0x907b1e){while(--_0x907b1e){_0x265721['push'](_0x265721['shift']());}};_0x11ec95(++_0x1503f2);}(_0x54ef,0x112));var _0xf54e=function(_0x26dc14,_0x4e223a){_0x26dc14=_0x26dc14-0x0;var _0x164cd0=_0x54ef[_0x26dc14];return _0x164cd0;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x589a09,_0x3f1377){var _0x5d6642=function(_0x1eee12){while(--_0x1eee12){_0x589a09['push'](_0x589a09['shift']());}};_0x5d6642(++_0x3f1377);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xcb91[_0x2b305c];return _0x5d8c85;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 56a664b..4ec63ef 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 _0xbf46=['../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','describe','eml-format','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3de13f,_0x303c12){var _0x1211c1=function(_0x213faa){while(--_0x213faa){_0x3de13f['push'](_0x3de13f['shift']());}};_0x1211c1(++_0x303c12);}(_0xbf46,0x107));var _0x6bf4=function(_0x9e5574,_0x41bf88){_0x9e5574=_0x9e5574-0x0;var _0x21bac1=_0xbf46[_0x9e5574];return _0x21bac1;};'use strict';var emlformat=require(_0x6bf4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bf4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6bf4('0x2'));var util=require(_0x6bf4('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x6bf4('0x4'));var ejs=require(_0x6bf4('0x5'));var fs=require('fs');var fs_extra=require(_0x6bf4('0x6'));var _=require(_0x6bf4('0x7'));var squel=require(_0x6bf4('0x8'));var crypto=require('crypto');var jsforce=require(_0x6bf4('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6bf4('0xa'));var Papa=require(_0x6bf4('0xb'));var Redis=require(_0x6bf4('0xc'));var authService=require(_0x6bf4('0xd'));var qs=require(_0x6bf4('0xe'));var as=require(_0x6bf4('0xf'));var hardwareService=require(_0x6bf4('0x10'));var logger=require(_0x6bf4('0x11'))(_0x6bf4('0x12'));var utils=require(_0x6bf4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8f683f,_0x3ee992){_0x3ee992=_0x3ee992||0xcc;return function(_0x46c4e0){if(_0x46c4e0){return _0x8f683f[_0x6bf4('0x14')](_0x3ee992);}return _0x8f683f[_0x6bf4('0x15')](_0x3ee992)[_0x6bf4('0x16')]();};}function respondWithResult(_0x58fbf3,_0x475a86){_0x475a86=_0x475a86||0xc8;return function(_0x37d9f9){if(_0x37d9f9){return _0x58fbf3[_0x6bf4('0x15')](_0x475a86)[_0x6bf4('0x17')](_0x37d9f9);}};}function respondWithFilteredResult(_0x544a5b,_0x2cd73b){return function(_0x45e945){if(_0x45e945){var _0x280e33=typeof _0x2cd73b['offset']===_0x6bf4('0x18')&&typeof _0x2cd73b[_0x6bf4('0x19')]==='undefined';var _0x1b3561=_0x45e945[_0x6bf4('0x1a')];var _0x24c2c9=_0x280e33?0x0:_0x2cd73b[_0x6bf4('0x1b')];var _0x43edfe=_0x280e33?_0x45e945['count']:_0x2cd73b[_0x6bf4('0x1b')]+_0x2cd73b[_0x6bf4('0x19')];var _0x50067e;if(_0x43edfe>=_0x1b3561){_0x43edfe=_0x1b3561;_0x50067e=0xc8;}else{_0x50067e=0xce;}_0x544a5b[_0x6bf4('0x15')](_0x50067e);return _0x544a5b[_0x6bf4('0x1c')](_0x6bf4('0x1d'),_0x24c2c9+'-'+_0x43edfe+'/'+_0x1b3561)[_0x6bf4('0x17')](_0x45e945);}return null;};}function patchUpdates(_0x520529){return function(_0x6edf13){try{jsonpatch[_0x6bf4('0x1e')](_0x6edf13,_0x520529,!![]);}catch(_0x179d94){return BPromise[_0x6bf4('0x1f')](_0x179d94);}return _0x6edf13[_0x6bf4('0x20')]();};}function saveUpdates(_0x3c4a89,_0xea5aba){return function(_0x369544){if(_0x369544){return _0x369544[_0x6bf4('0x21')](_0x3c4a89)[_0x6bf4('0x22')](function(_0x5c68e2){return _0x5c68e2;});}return null;};}function removeEntity(_0x329bdd,_0x48e4af){return function(_0x1619c5){if(_0x1619c5){return _0x1619c5[_0x6bf4('0x23')]()['then'](function(){_0x329bdd[_0x6bf4('0x15')](0xcc)[_0x6bf4('0x16')]();});}};}function handleEntityNotFound(_0x5bcd81,_0x29a751){return function(_0x191656){if(!_0x191656){_0x5bcd81['sendStatus'](0x194);}return _0x191656;};}function handleError(_0x402ad3,_0x406a65){_0x406a65=_0x406a65||0x1f4;return function(_0x47bf55){logger[_0x6bf4('0x24')](_0x47bf55['stack']);if(_0x47bf55[_0x6bf4('0x25')]){delete _0x47bf55[_0x6bf4('0x25')];}_0x402ad3[_0x6bf4('0x15')](_0x406a65)[_0x6bf4('0x26')](_0x47bf55);};}exports['index']=function(_0x7ea8f0,_0x1e2f26){var _0x21868a={},_0x329272={},_0x4c90a7={'count':0x0,'rows':[]};var _0xfb4168=_[_0x6bf4('0x27')](db[_0x6bf4('0x28')][_0x6bf4('0x29')],function(_0x227ced){return{'name':_0x227ced[_0x6bf4('0x2a')],'type':_0x227ced[_0x6bf4('0x2b')][_0x6bf4('0x2c')]};});_0x329272['model']=_[_0x6bf4('0x27')](_0xfb4168,'name');_0x329272[_0x6bf4('0x2d')]=_[_0x6bf4('0x2e')](_0x7ea8f0[_0x6bf4('0x2d')]);_0x329272[_0x6bf4('0x2f')]=_['intersection'](_0x329272[_0x6bf4('0x30')],_0x329272[_0x6bf4('0x2d')]);_0x21868a['attributes']=_[_0x6bf4('0x31')](_0x329272[_0x6bf4('0x30')],qs[_0x6bf4('0x32')](_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x32')]));_0x21868a[_0x6bf4('0x33')]=_0x21868a[_0x6bf4('0x33')][_0x6bf4('0x34')]?_0x21868a[_0x6bf4('0x33')]:_0x329272[_0x6bf4('0x30')];if(!_0x7ea8f0[_0x6bf4('0x2d')]['hasOwnProperty'](_0x6bf4('0x35'))){_0x21868a[_0x6bf4('0x19')]=qs[_0x6bf4('0x19')](_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x19')]);_0x21868a['offset']=qs[_0x6bf4('0x1b')](_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x1b')]);}_0x21868a[_0x6bf4('0x36')]=qs[_0x6bf4('0x37')](_0x7ea8f0['query'][_0x6bf4('0x37')]);_0x21868a[_0x6bf4('0x38')]=qs[_0x6bf4('0x2f')](_[_0x6bf4('0x39')](_0x7ea8f0[_0x6bf4('0x2d')],_0x329272[_0x6bf4('0x2f')]),_0xfb4168);if(_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x3a')]){_0x21868a[_0x6bf4('0x38')]=_[_0x6bf4('0x3b')](_0x21868a[_0x6bf4('0x38')],{'$or':_[_0x6bf4('0x27')](_0xfb4168,function(_0x21c0aa){if(_0x21c0aa['type']!=='VIRTUAL'){var _0x10f5cf={};_0x10f5cf[_0x21c0aa[_0x6bf4('0x25')]]={'$like':'%'+_0x7ea8f0[_0x6bf4('0x2d')][_0x6bf4('0x3a')]+'%'};return _0x10f5cf;}})});}_0x21868a=_[_0x6bf4('0x3b')]({},_0x21868a,_0x7ea8f0[_0x6bf4('0x3c')]);var _0x239300={'where':_0x21868a[_0x6bf4('0x38')]};return db[_0x6bf4('0x28')][_0x6bf4('0x1a')](_0x239300)[_0x6bf4('0x22')](function(_0x4791af){_0x4c90a7[_0x6bf4('0x1a')]=_0x4791af;if(_0x7ea8f0['query'][_0x6bf4('0x3d')]){_0x21868a[_0x6bf4('0x3e')]=[{'all':!![]}];}return db[_0x6bf4('0x28')][_0x6bf4('0x3f')](_0x21868a);})[_0x6bf4('0x22')](function(_0x3463f2){_0x4c90a7[_0x6bf4('0x40')]=_0x3463f2;return _0x4c90a7;})[_0x6bf4('0x22')](respondWithFilteredResult(_0x1e2f26,_0x21868a))[_0x6bf4('0x41')](handleError(_0x1e2f26,null));};exports['show']=function(_0xa0be5e,_0x487b91){var _0x26905f={'raw':!![],'where':{'id':_0xa0be5e[_0x6bf4('0x42')]['id']}},_0xcb9ac6={};_0xcb9ac6[_0x6bf4('0x30')]=_[_0x6bf4('0x2e')](db[_0x6bf4('0x28')][_0x6bf4('0x29')]);_0xcb9ac6[_0x6bf4('0x2d')]=_[_0x6bf4('0x2e')](_0xa0be5e[_0x6bf4('0x2d')]);_0xcb9ac6[_0x6bf4('0x2f')]=_[_0x6bf4('0x31')](_0xcb9ac6[_0x6bf4('0x30')],_0xcb9ac6[_0x6bf4('0x2d')]);_0x26905f['attributes']=_['intersection'](_0xcb9ac6[_0x6bf4('0x30')],qs[_0x6bf4('0x32')](_0xa0be5e[_0x6bf4('0x2d')][_0x6bf4('0x32')]));_0x26905f[_0x6bf4('0x33')]=_0x26905f[_0x6bf4('0x33')]['length']?_0x26905f[_0x6bf4('0x33')]:_0xcb9ac6[_0x6bf4('0x30')];if(_0xa0be5e[_0x6bf4('0x2d')][_0x6bf4('0x3d')]){_0x26905f[_0x6bf4('0x3e')]=[{'all':!![]}];}_0x26905f=_['merge']({},_0x26905f,_0xa0be5e[_0x6bf4('0x3c')]);return db[_0x6bf4('0x28')]['find'](_0x26905f)[_0x6bf4('0x22')](handleEntityNotFound(_0x487b91,null))[_0x6bf4('0x22')](respondWithResult(_0x487b91,null))[_0x6bf4('0x41')](handleError(_0x487b91,null));};exports[_0x6bf4('0x43')]=function(_0x4291f6,_0x2efd61){return db[_0x6bf4('0x28')][_0x6bf4('0x43')](_0x4291f6[_0x6bf4('0x44')],{})[_0x6bf4('0x22')](respondWithResult(_0x2efd61,0xc9))[_0x6bf4('0x41')](handleError(_0x2efd61,null));};exports[_0x6bf4('0x21')]=function(_0x3f1cdb,_0xee135b){if(_0x3f1cdb[_0x6bf4('0x44')]['id']){delete _0x3f1cdb[_0x6bf4('0x44')]['id'];}return db[_0x6bf4('0x28')]['find']({'where':{'id':_0x3f1cdb['params']['id']}})[_0x6bf4('0x22')](handleEntityNotFound(_0xee135b,null))[_0x6bf4('0x22')](saveUpdates(_0x3f1cdb[_0x6bf4('0x44')],null))[_0x6bf4('0x22')](respondWithResult(_0xee135b,null))[_0x6bf4('0x41')](handleError(_0xee135b,null));};exports[_0x6bf4('0x23')]=function(_0x3a87f8,_0x1fc487){return db[_0x6bf4('0x28')]['find']({'where':{'id':_0x3a87f8[_0x6bf4('0x42')]['id']}})[_0x6bf4('0x22')](handleEntityNotFound(_0x1fc487,null))[_0x6bf4('0x22')](removeEntity(_0x1fc487,null))[_0x6bf4('0x41')](handleError(_0x1fc487,null));};exports[_0x6bf4('0x45')]=function(_0xc75939,_0x327f51){return db['OpenchannelTransferReport'][_0x6bf4('0x45')]()['then'](respondWithResult(_0x327f51,null))['catch'](handleError(_0x327f51,null));}; \ No newline at end of file +var _0x14f8=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','catch','create','body','find','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse'];(function(_0x3a6d22,_0x18f734){var _0x2c12f8=function(_0x2df71f){while(--_0x2df71f){_0x3a6d22['push'](_0x3a6d22['shift']());}};_0x2c12f8(++_0x18f734);}(_0x14f8,0x7f));var _0x814f=function(_0xb2e201,_0x3bdc08){_0xb2e201=_0xb2e201-0x0;var _0xa380b=_0x14f8[_0xb2e201];return _0xa380b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x814f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x814f('0x1'));var rp=require(_0x814f('0x2'));var moment=require('moment');var BPromise=require(_0x814f('0x3'));var Mustache=require(_0x814f('0x4'));var util=require('util');var path=require(_0x814f('0x5'));var sox=require(_0x814f('0x6'));var csv=require('to-csv');var ejs=require(_0x814f('0x7'));var fs=require('fs');var fs_extra=require(_0x814f('0x8'));var _=require(_0x814f('0x9'));var squel=require(_0x814f('0xa'));var crypto=require(_0x814f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x814f('0xc'));var toCsv=require(_0x814f('0xd'));var querystring=require('querystring');var Papa=require(_0x814f('0xe'));var Redis=require(_0x814f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x814f('0x10'));var as=require(_0x814f('0x11'));var hardwareService=require(_0x814f('0x12'));var logger=require(_0x814f('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x814f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x565d42,_0x273533){_0x273533=_0x273533||0xcc;return function(_0x202ed2){if(_0x202ed2){return _0x565d42[_0x814f('0x15')](_0x273533);}return _0x565d42[_0x814f('0x16')](_0x273533)[_0x814f('0x17')]();};}function respondWithResult(_0x2a343e,_0x4c2467){_0x4c2467=_0x4c2467||0xc8;return function(_0x4858aa){if(_0x4858aa){return _0x2a343e[_0x814f('0x16')](_0x4c2467)[_0x814f('0x18')](_0x4858aa);}};}function respondWithFilteredResult(_0x4b2189,_0x28dbda){return function(_0x34ba84){if(_0x34ba84){var _0x1d8970=typeof _0x28dbda[_0x814f('0x19')]===_0x814f('0x1a')&&typeof _0x28dbda['limit']===_0x814f('0x1a');var _0x23dd9d=_0x34ba84[_0x814f('0x1b')];var _0x49a266=_0x1d8970?0x0:_0x28dbda['offset'];var _0x44877b=_0x1d8970?_0x34ba84[_0x814f('0x1b')]:_0x28dbda[_0x814f('0x19')]+_0x28dbda[_0x814f('0x1c')];var _0x824c4e;if(_0x44877b>=_0x23dd9d){_0x44877b=_0x23dd9d;_0x824c4e=0xc8;}else{_0x824c4e=0xce;}_0x4b2189[_0x814f('0x16')](_0x824c4e);return _0x4b2189[_0x814f('0x1d')](_0x814f('0x1e'),_0x49a266+'-'+_0x44877b+'/'+_0x23dd9d)[_0x814f('0x18')](_0x34ba84);}return null;};}function patchUpdates(_0x4db27a){return function(_0x44899){try{jsonpatch['apply'](_0x44899,_0x4db27a,!![]);}catch(_0x36ec5d){return BPromise[_0x814f('0x1f')](_0x36ec5d);}return _0x44899['save']();};}function saveUpdates(_0x95648d,_0x299dfe){return function(_0x233bdd){if(_0x233bdd){return _0x233bdd['update'](_0x95648d)[_0x814f('0x20')](function(_0x2eddf2){return _0x2eddf2;});}return null;};}function removeEntity(_0x26f95b,_0x2fbfd3){return function(_0x27a479){if(_0x27a479){return _0x27a479['destroy']()[_0x814f('0x20')](function(){_0x26f95b[_0x814f('0x16')](0xcc)[_0x814f('0x17')]();});}};}function handleEntityNotFound(_0x1fb85d,_0x2bc625){return function(_0x48143d){if(!_0x48143d){_0x1fb85d[_0x814f('0x15')](0x194);}return _0x48143d;};}function handleError(_0x10981b,_0x240711){_0x240711=_0x240711||0x1f4;return function(_0x19f682){logger[_0x814f('0x21')](_0x19f682[_0x814f('0x22')]);if(_0x19f682[_0x814f('0x23')]){delete _0x19f682['name'];}_0x10981b[_0x814f('0x16')](_0x240711)[_0x814f('0x24')](_0x19f682);};}exports[_0x814f('0x25')]=function(_0x5ed51b,_0x1296d6){var _0x284981={},_0x156ae9={},_0x364490={'count':0x0,'rows':[]};var _0x3c80f6=_['map'](db[_0x814f('0x26')][_0x814f('0x27')],function(_0x34a73e){return{'name':_0x34a73e[_0x814f('0x28')],'type':_0x34a73e[_0x814f('0x29')][_0x814f('0x2a')]};});_0x156ae9[_0x814f('0x2b')]=_[_0x814f('0x2c')](_0x3c80f6,_0x814f('0x23'));_0x156ae9['query']=_[_0x814f('0x2d')](_0x5ed51b['query']);_0x156ae9[_0x814f('0x2e')]=_['intersection'](_0x156ae9[_0x814f('0x2b')],_0x156ae9[_0x814f('0x2f')]);_0x284981[_0x814f('0x30')]=_[_0x814f('0x31')](_0x156ae9[_0x814f('0x2b')],qs[_0x814f('0x32')](_0x5ed51b['query']['fields']));_0x284981[_0x814f('0x30')]=_0x284981['attributes'][_0x814f('0x33')]?_0x284981[_0x814f('0x30')]:_0x156ae9['model'];if(!_0x5ed51b[_0x814f('0x2f')][_0x814f('0x34')](_0x814f('0x35'))){_0x284981['limit']=qs['limit'](_0x5ed51b[_0x814f('0x2f')]['limit']);_0x284981[_0x814f('0x19')]=qs['offset'](_0x5ed51b[_0x814f('0x2f')][_0x814f('0x19')]);}_0x284981[_0x814f('0x36')]=qs[_0x814f('0x37')](_0x5ed51b[_0x814f('0x2f')][_0x814f('0x37')]);_0x284981[_0x814f('0x38')]=qs[_0x814f('0x2e')](_[_0x814f('0x39')](_0x5ed51b['query'],_0x156ae9['filters']),_0x3c80f6);if(_0x5ed51b['query'][_0x814f('0x3a')]){_0x284981['where']=_[_0x814f('0x3b')](_0x284981[_0x814f('0x38')],{'$or':_[_0x814f('0x2c')](_0x3c80f6,function(_0x340701){if(_0x340701[_0x814f('0x29')]!=='VIRTUAL'){var _0x1d75c4={};_0x1d75c4[_0x340701['name']]={'$like':'%'+_0x5ed51b[_0x814f('0x2f')][_0x814f('0x3a')]+'%'};return _0x1d75c4;}})});}_0x284981=_[_0x814f('0x3b')]({},_0x284981,_0x5ed51b[_0x814f('0x3c')]);var _0xa45e74={'where':_0x284981['where']};return db[_0x814f('0x26')]['count'](_0xa45e74)[_0x814f('0x20')](function(_0x5f18a3){_0x364490[_0x814f('0x1b')]=_0x5f18a3;if(_0x5ed51b[_0x814f('0x2f')][_0x814f('0x3d')]){_0x284981[_0x814f('0x3e')]=[{'all':!![]}];}return db[_0x814f('0x26')][_0x814f('0x3f')](_0x284981);})['then'](function(_0x5ac318){_0x364490['rows']=_0x5ac318;return _0x364490;})[_0x814f('0x20')](respondWithFilteredResult(_0x1296d6,_0x284981))['catch'](handleError(_0x1296d6,null));};exports[_0x814f('0x40')]=function(_0x2459b2,_0x392b5c){var _0x81f494={'raw':!![],'where':{'id':_0x2459b2['params']['id']}},_0x3fecb3={};_0x3fecb3['model']=_[_0x814f('0x2d')](db[_0x814f('0x26')][_0x814f('0x27')]);_0x3fecb3[_0x814f('0x2f')]=_['keys'](_0x2459b2[_0x814f('0x2f')]);_0x3fecb3[_0x814f('0x2e')]=_[_0x814f('0x31')](_0x3fecb3['model'],_0x3fecb3[_0x814f('0x2f')]);_0x81f494[_0x814f('0x30')]=_['intersection'](_0x3fecb3[_0x814f('0x2b')],qs[_0x814f('0x32')](_0x2459b2[_0x814f('0x2f')][_0x814f('0x32')]));_0x81f494[_0x814f('0x30')]=_0x81f494[_0x814f('0x30')][_0x814f('0x33')]?_0x81f494[_0x814f('0x30')]:_0x3fecb3[_0x814f('0x2b')];if(_0x2459b2[_0x814f('0x2f')][_0x814f('0x3d')]){_0x81f494[_0x814f('0x3e')]=[{'all':!![]}];}_0x81f494=_[_0x814f('0x3b')]({},_0x81f494,_0x2459b2[_0x814f('0x3c')]);return db[_0x814f('0x26')]['find'](_0x81f494)[_0x814f('0x20')](handleEntityNotFound(_0x392b5c,null))[_0x814f('0x20')](respondWithResult(_0x392b5c,null))[_0x814f('0x41')](handleError(_0x392b5c,null));};exports['create']=function(_0x55fd4b,_0x2e7659){return db[_0x814f('0x26')][_0x814f('0x42')](_0x55fd4b[_0x814f('0x43')],{})[_0x814f('0x20')](respondWithResult(_0x2e7659,0xc9))[_0x814f('0x41')](handleError(_0x2e7659,null));};exports['update']=function(_0x232aa6,_0x387f24){if(_0x232aa6[_0x814f('0x43')]['id']){delete _0x232aa6['body']['id'];}return db[_0x814f('0x26')][_0x814f('0x44')]({'where':{'id':_0x232aa6['params']['id']}})['then'](handleEntityNotFound(_0x387f24,null))[_0x814f('0x20')](saveUpdates(_0x232aa6[_0x814f('0x43')],null))['then'](respondWithResult(_0x387f24,null))[_0x814f('0x41')](handleError(_0x387f24,null));};exports['destroy']=function(_0x3595f5,_0x56811e){return db[_0x814f('0x26')][_0x814f('0x44')]({'where':{'id':_0x3595f5[_0x814f('0x45')]['id']}})[_0x814f('0x20')](handleEntityNotFound(_0x56811e,null))[_0x814f('0x20')](removeEntity(_0x56811e,null))['catch'](handleError(_0x56811e,null));};exports[_0x814f('0x46')]=function(_0xb1d8f,_0x31c2d1){return db[_0x814f('0x26')][_0x814f('0x46')]()[_0x814f('0x20')](respondWithResult(_0x31c2d1,null))[_0x814f('0x41')](handleError(_0x31c2d1,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c11adbe..7d2fe08 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 _0x17d7=['../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3b8c47,_0x554d82){var _0x4422a5=function(_0x1637cc){while(--_0x1637cc){_0x3b8c47['push'](_0x3b8c47['shift']());}};_0x4422a5(++_0x554d82);}(_0x17d7,0x88));var _0x717d=function(_0x1ac292,_0x4912bc){_0x1ac292=_0x1ac292-0x0;var _0x1ef8ae=_0x17d7[_0x1ac292];return _0x1ef8ae;};'use strict';var _=require(_0x717d('0x0'));var util=require('util');var logger=require(_0x717d('0x1'))(_0x717d('0x2'));var moment=require(_0x717d('0x3'));var BPromise=require(_0x717d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x717d('0x5'));var rimraf=require(_0x717d('0x6'));var config=require(_0x717d('0x7'));var attributes=require(_0x717d('0x8'));module['exports']=function(_0x537dea,_0x43b087){return _0x537dea[_0x717d('0x9')](_0x717d('0xa'),attributes,{'tableName':_0x717d('0xb'),'paranoid':![],'indexes':[{'name':_0x717d('0xc'),'fields':[_0x717d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeaba=['../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x57454b,_0x563920){var _0x39623b=function(_0x1e94a5){while(--_0x1e94a5){_0x57454b['push'](_0x57454b['shift']());}};_0x39623b(++_0x563920);}(_0xeaba,0x1b2));var _0xaeab=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeaba[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xaeab('0x0'));var logger=require(_0xaeab('0x1'))('api');var moment=require(_0xaeab('0x2'));var BPromise=require('bluebird');var rp=require(_0xaeab('0x3'));var fs=require('fs');var path=require(_0xaeab('0x4'));var rimraf=require(_0xaeab('0x5'));var config=require(_0xaeab('0x6'));var attributes=require(_0xaeab('0x7'));module[_0xaeab('0x8')]=function(_0x5194e4,_0x40c64b){return _0x5194e4['define'](_0xaeab('0x9'),attributes,{'tableName':_0xaeab('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8d3ef8f..5fe2873 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 _0xa0a1=['request\x20sent','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4fcaf1,_0x59fa8b){var _0x509afb=function(_0x3019c1){while(--_0x3019c1){_0x4fcaf1['push'](_0x4fcaf1['shift']());}};_0x509afb(++_0x59fa8b);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x178cc7,_0x129249){_0x178cc7=_0x178cc7-0x0;var _0x5ca149=_0xa0a1[_0x178cc7];return _0x5ca149;};'use strict';var _=require(_0x1a0a('0x0'));var util=require('util');var moment=require(_0x1a0a('0x1'));var BPromise=require(_0x1a0a('0x2'));var rs=require(_0x1a0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a0a('0x4'));var logger=require(_0x1a0a('0x5'))('rpc');var config=require(_0x1a0a('0x6'));var jayson=require(_0x1a0a('0x7'));var client=jayson['client'][_0x1a0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe59f97,_0x3fe29f,_0x245f3d){return new BPromise(function(_0x9da67c,_0x48d604){return client[_0x1a0a('0x9')](_0xe59f97,_0x245f3d)[_0x1a0a('0xa')](function(_0x8165a1){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3fe29f,'request\x20sent');logger[_0x1a0a('0xb')](_0x1a0a('0xc'),_0x3fe29f,_0x1a0a('0xd'),JSON['stringify'](_0x8165a1));if(_0x8165a1[_0x1a0a('0xe')]){if(_0x8165a1['error'][_0x1a0a('0xf')]===0x1f4){logger[_0x1a0a('0xe')](_0x1a0a('0x10'),_0x3fe29f,_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);return _0x48d604(_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);}logger['error'](_0x1a0a('0x10'),_0x3fe29f,_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);return _0x9da67c(_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);}else{logger['info'](_0x1a0a('0x10'),_0x3fe29f,_0x1a0a('0xd'));_0x9da67c(_0x8165a1[_0x1a0a('0x12')]['message']);}})[_0x1a0a('0x13')](function(_0x57c942){logger[_0x1a0a('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3fe29f,_0x57c942);_0x48d604(_0x57c942);});});} \ No newline at end of file +var _0x23f4=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x1ca9b7,_0x58e6be){var _0x21fa2d=function(_0x3d5661){while(--_0x3d5661){_0x1ca9b7['push'](_0x1ca9b7['shift']());}};_0x21fa2d(++_0x58e6be);}(_0x23f4,0x1ee));var _0x423f=function(_0x4ed1d8,_0x559671){_0x4ed1d8=_0x4ed1d8-0x0;var _0x2e5a71=_0x23f4[_0x4ed1d8];return _0x2e5a71;};'use strict';var _=require('lodash');var util=require(_0x423f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x423f('0x1'));var fs=require('fs');var Redis=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];var utils=require(_0x423f('0x4'));var logger=require(_0x423f('0x5'))(_0x423f('0x6'));var config=require(_0x423f('0x7'));var jayson=require(_0x423f('0x8'));var client=jayson[_0x423f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x260eae,_0x47716d,_0x55258d){return new BPromise(function(_0x727b4e,_0x416fb1){return client[_0x423f('0xa')](_0x260eae,_0x55258d)['then'](function(_0x5b5ee6){logger['info'](_0x423f('0xb'),_0x47716d,'request\x20sent');logger[_0x423f('0xc')](_0x423f('0xd'),_0x47716d,_0x423f('0xe'),JSON[_0x423f('0xf')](_0x5b5ee6));if(_0x5b5ee6['error']){if(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x11')]===0x1f4){logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x5b5ee6[_0x423f('0x10')]['message']);return _0x416fb1(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);}logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);return _0x727b4e(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);}else{logger[_0x423f('0x13')](_0x423f('0xb'),_0x47716d,_0x423f('0xe'));_0x727b4e(_0x5b5ee6[_0x423f('0x14')][_0x423f('0x12')]);}})[_0x423f('0x15')](function(_0x9d1487){logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x9d1487);_0x416fb1(_0x9d1487);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 5ab6c2a..c06675d 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 _0x005d=['get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x005d,0x64));var _0xd005=function(_0x12dc8d,_0x5037e9){_0x12dc8d=_0x12dc8d-0x0;var _0xa9f23=_0x005d[_0x12dc8d];return _0xa9f23;};'use strict';var multer=require(_0xd005('0x0'));var util=require('util');var path=require(_0xd005('0x1'));var timeout=require(_0xd005('0x2'));var express=require(_0xd005('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd005('0x4'));var interaction=require(_0xd005('0x5'));var config=require(_0xd005('0x6'));var controller=require(_0xd005('0x7'));router[_0xd005('0x8')]('/',auth[_0xd005('0x9')](),controller[_0xd005('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd005('0xb')]);router[_0xd005('0xc')]('/',auth[_0xd005('0x9')](),controller['create']);router[_0xd005('0xd')](_0xd005('0xe'),auth[_0xd005('0x9')](),controller[_0xd005('0xf')]);router[_0xd005('0x10')](_0xd005('0xe'),auth[_0xd005('0x9')](),controller[_0xd005('0x11')]);module['exports']=router; \ No newline at end of file +var _0x66ef=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x1373f8,_0x3102e3){var _0x588833=function(_0x51b547){while(--_0x51b547){_0x1373f8['push'](_0x1373f8['shift']());}};_0x588833(++_0x3102e3);}(_0x66ef,0x145));var _0xf66e=function(_0x28f9cd,_0x4141fa){_0x28f9cd=_0x28f9cd-0x0;var _0x23ca51=_0x66ef[_0x28f9cd];return _0x23ca51;};'use strict';var multer=require(_0xf66e('0x0'));var util=require(_0xf66e('0x1'));var path=require(_0xf66e('0x2'));var timeout=require(_0xf66e('0x3'));var express=require(_0xf66e('0x4'));var router=express[_0xf66e('0x5')]();var fs_extra=require(_0xf66e('0x6'));var auth=require(_0xf66e('0x7'));var interaction=require(_0xf66e('0x8'));var config=require('../../config/environment');var controller=require(_0xf66e('0x9'));router[_0xf66e('0xa')]('/',auth[_0xf66e('0xb')](),controller['index']);router[_0xf66e('0xa')](_0xf66e('0xc'),auth[_0xf66e('0xb')](),controller[_0xf66e('0xd')]);router['post']('/',auth[_0xf66e('0xb')](),controller[_0xf66e('0xe')]);router[_0xf66e('0xf')]('/:id',auth[_0xf66e('0xb')](),controller[_0xf66e('0x10')]);router[_0xf66e('0x11')]('/:id',auth[_0xf66e('0xb')](),controller[_0xf66e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9bef1dd..617418b 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 _0x9943=['exports','STRING','sequelize'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x9943,0x17f));var _0x3994=function(_0x192ac5,_0x308bad){_0x192ac5=_0x192ac5-0x0;var _0x2073f8=_0x9943[_0x192ac5];return _0x2073f8;};'use strict';var Sequelize=require(_0x3994('0x0'));module[_0x3994('0x1')]={'name':{'type':Sequelize[_0x3994('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3994('0x2')]}}; \ No newline at end of file +var _0xec6a=['exports','name','STRING','sequelize'];(function(_0xf3d95e,_0x4034b7){var _0x2e0ca7=function(_0x3bf02c){while(--_0x3bf02c){_0xf3d95e['push'](_0xf3d95e['shift']());}};_0x2e0ca7(++_0x4034b7);}(_0xec6a,0x127));var _0xaec6=function(_0x2dc513,_0x38f3e0){_0x2dc513=_0x2dc513-0x0;var _0x3ded47=_0xec6a[_0x2dc513];return _0x3ded47;};'use strict';var Sequelize=require(_0xaec6('0x0'));module[_0xaec6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaec6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xaec6('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9825520..064aaa4 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 _0x3977=['body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','end','sendStatus','error','name','send','index','map','Pause','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','rawAttributes','length','find','create'];(function(_0x43d265,_0x6fc83d){var _0x361f7d=function(_0x44617d){while(--_0x44617d){_0x43d265['push'](_0x43d265['shift']());}};_0x361f7d(++_0x6fc83d);}(_0x3977,0x143));var _0x7397=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3977[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7397('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7397('0x1'));var rp=require(_0x7397('0x2'));var moment=require(_0x7397('0x3'));var BPromise=require(_0x7397('0x4'));var Mustache=require(_0x7397('0x5'));var util=require(_0x7397('0x6'));var path=require(_0x7397('0x7'));var sox=require(_0x7397('0x8'));var csv=require(_0x7397('0x9'));var ejs=require(_0x7397('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7397('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7397('0xc'));var deskjs=require(_0x7397('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7397('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7397('0xf'));var qs=require(_0x7397('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7397('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7397('0x12'))['db'];function respondWithStatusCode(_0x75d7b7,_0x5e6028){_0x5e6028=_0x5e6028||0xcc;return function(_0x49a6f5){if(_0x49a6f5){return _0x75d7b7['sendStatus'](_0x5e6028);}return _0x75d7b7[_0x7397('0x13')](_0x5e6028)['end']();};}function respondWithResult(_0x496f23,_0x2cb800){_0x2cb800=_0x2cb800||0xc8;return function(_0x33d83d){if(_0x33d83d){return _0x496f23['status'](_0x2cb800)[_0x7397('0x14')](_0x33d83d);}};}function respondWithFilteredResult(_0x465c7b,_0x37c7f){return function(_0x2184e5){if(_0x2184e5){var _0x2f31e0=typeof _0x37c7f['offset']===_0x7397('0x15')&&typeof _0x37c7f[_0x7397('0x16')]===_0x7397('0x15');var _0x228008=_0x2184e5[_0x7397('0x17')];var _0x4efe0b=_0x2f31e0?0x0:_0x37c7f[_0x7397('0x18')];var _0x233aa4=_0x2f31e0?_0x2184e5[_0x7397('0x17')]:_0x37c7f[_0x7397('0x18')]+_0x37c7f['limit'];var _0x1bc3c7;if(_0x233aa4>=_0x228008){_0x233aa4=_0x228008;_0x1bc3c7=0xc8;}else{_0x1bc3c7=0xce;}_0x465c7b[_0x7397('0x13')](_0x1bc3c7);return _0x465c7b[_0x7397('0x19')](_0x7397('0x1a'),_0x4efe0b+'-'+_0x233aa4+'/'+_0x228008)[_0x7397('0x14')](_0x2184e5);}return null;};}function patchUpdates(_0x2b5924){return function(_0x28eaa9){try{jsonpatch[_0x7397('0x1b')](_0x28eaa9,_0x2b5924,!![]);}catch(_0x4a3a33){return BPromise[_0x7397('0x1c')](_0x4a3a33);}return _0x28eaa9[_0x7397('0x1d')]();};}function saveUpdates(_0x3fe2b9,_0x57b846){return function(_0x38a4c8){if(_0x38a4c8){return _0x38a4c8[_0x7397('0x1e')](_0x3fe2b9)[_0x7397('0x1f')](function(_0x40b057){return _0x40b057;});}return null;};}function removeEntity(_0x3c400b,_0x266683){return function(_0x120f76){if(_0x120f76){return _0x120f76['destroy']()[_0x7397('0x1f')](function(){var _0x1d54b8=_0x120f76[_0x7397('0x20')]({'plain':!![]});var _0x3a5598=_0x7397('0x21');return db[_0x7397('0x22')][_0x7397('0x23')]({'where':{'type':_0x3a5598,'resourceId':_0x1d54b8['id']}})[_0x7397('0x1f')](function(){return _0x120f76;});})[_0x7397('0x1f')](function(){_0x3c400b[_0x7397('0x13')](0xcc)[_0x7397('0x24')]();});}};}function handleEntityNotFound(_0x4b8856,_0xe5010d){return function(_0x4526f4){if(!_0x4526f4){_0x4b8856[_0x7397('0x25')](0x194);}return _0x4526f4;};}function handleError(_0x5dd377,_0x3a263b){_0x3a263b=_0x3a263b||0x1f4;return function(_0x12c226){logger[_0x7397('0x26')](_0x12c226['stack']);if(_0x12c226[_0x7397('0x27')]){delete _0x12c226[_0x7397('0x27')];}_0x5dd377['status'](_0x3a263b)[_0x7397('0x28')](_0x12c226);};}exports[_0x7397('0x29')]=function(_0x45e7d4,_0x30fb32){var _0x7e94c8={},_0x3e290b={},_0x47be80={'count':0x0,'rows':[]};var _0x462e7b=_[_0x7397('0x2a')](db[_0x7397('0x2b')]['rawAttributes'],function(_0x273ba9){return{'name':_0x273ba9[_0x7397('0x2c')],'type':_0x273ba9[_0x7397('0x2d')]['key']};});_0x3e290b[_0x7397('0x2e')]=_[_0x7397('0x2a')](_0x462e7b,_0x7397('0x27'));_0x3e290b[_0x7397('0x2f')]=_['keys'](_0x45e7d4[_0x7397('0x2f')]);_0x3e290b[_0x7397('0x30')]=_[_0x7397('0x31')](_0x3e290b[_0x7397('0x2e')],_0x3e290b[_0x7397('0x2f')]);_0x7e94c8['attributes']=_['intersection'](_0x3e290b[_0x7397('0x2e')],qs[_0x7397('0x32')](_0x45e7d4['query']['fields']));_0x7e94c8['attributes']=_0x7e94c8[_0x7397('0x33')]['length']?_0x7e94c8['attributes']:_0x3e290b['model'];if(!_0x45e7d4[_0x7397('0x2f')][_0x7397('0x34')](_0x7397('0x35'))){_0x7e94c8['limit']=qs[_0x7397('0x16')](_0x45e7d4[_0x7397('0x2f')][_0x7397('0x16')]);_0x7e94c8[_0x7397('0x18')]=qs[_0x7397('0x18')](_0x45e7d4[_0x7397('0x2f')]['offset']);}_0x7e94c8[_0x7397('0x36')]=qs['sort'](_0x45e7d4[_0x7397('0x2f')][_0x7397('0x37')]);_0x7e94c8[_0x7397('0x38')]=qs[_0x7397('0x30')](_[_0x7397('0x39')](_0x45e7d4[_0x7397('0x2f')],_0x3e290b[_0x7397('0x30')]),_0x462e7b);if(_0x45e7d4['query'][_0x7397('0x3a')]){_0x7e94c8[_0x7397('0x38')]=_[_0x7397('0x3b')](_0x7e94c8[_0x7397('0x38')],{'$or':_[_0x7397('0x2a')](_0x462e7b,function(_0x4358ba){if(_0x4358ba['type']!==_0x7397('0x3c')){var _0x2842a6={};_0x2842a6[_0x4358ba['name']]={'$like':'%'+_0x45e7d4[_0x7397('0x2f')][_0x7397('0x3a')]+'%'};return _0x2842a6;}})});}_0x7e94c8=_['merge']({},_0x7e94c8,_0x45e7d4[_0x7397('0x3d')]);var _0x2d4f11={'where':_0x7e94c8[_0x7397('0x38')]};return db[_0x7397('0x2b')][_0x7397('0x17')](_0x2d4f11)[_0x7397('0x1f')](function(_0x1bea25){_0x47be80['count']=_0x1bea25;if(_0x45e7d4[_0x7397('0x2f')][_0x7397('0x3e')]){_0x7e94c8[_0x7397('0x3f')]=[{'all':!![]}];}return db[_0x7397('0x2b')]['findAll'](_0x7e94c8);})['then'](function(_0x59943f){_0x47be80[_0x7397('0x40')]=_0x59943f;return _0x47be80;})[_0x7397('0x1f')](respondWithFilteredResult(_0x30fb32,_0x7e94c8))[_0x7397('0x41')](handleError(_0x30fb32,null));};exports['show']=function(_0x58d1ad,_0x1c9c54){var _0xdac6c7={'raw':!![],'where':{'id':_0x58d1ad[_0x7397('0x42')]['id']}},_0x459110={};_0x459110['model']=_[_0x7397('0x43')](db[_0x7397('0x2b')][_0x7397('0x44')]);_0x459110['query']=_[_0x7397('0x43')](_0x58d1ad[_0x7397('0x2f')]);_0x459110[_0x7397('0x30')]=_[_0x7397('0x31')](_0x459110[_0x7397('0x2e')],_0x459110['query']);_0xdac6c7[_0x7397('0x33')]=_['intersection'](_0x459110['model'],qs[_0x7397('0x32')](_0x58d1ad[_0x7397('0x2f')]['fields']));_0xdac6c7[_0x7397('0x33')]=_0xdac6c7[_0x7397('0x33')][_0x7397('0x45')]?_0xdac6c7['attributes']:_0x459110[_0x7397('0x2e')];if(_0x58d1ad[_0x7397('0x2f')]['includeAll']){_0xdac6c7[_0x7397('0x3f')]=[{'all':!![]}];}_0xdac6c7=_['merge']({},_0xdac6c7,_0x58d1ad[_0x7397('0x3d')]);return db['Pause'][_0x7397('0x46')](_0xdac6c7)[_0x7397('0x1f')](handleEntityNotFound(_0x1c9c54,null))[_0x7397('0x1f')](respondWithResult(_0x1c9c54,null))[_0x7397('0x41')](handleError(_0x1c9c54,null));};exports['create']=function(_0x3c4cd0,_0x5b7dd3){return db[_0x7397('0x2b')][_0x7397('0x47')](_0x3c4cd0[_0x7397('0x48')],{})['then'](function(_0x32eaa6){var _0x5cc896=_0x3c4cd0[_0x7397('0x49')]['get']({'plain':!![]});if(!_0x5cc896)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc896[_0x7397('0x4a')]==='user'){var _0x3082c8=_0x32eaa6[_0x7397('0x20')]({'plain':!![]});var _0x25587d='Pauses';return db[_0x7397('0x4b')][_0x7397('0x46')]({'where':{'name':_0x25587d,'userProfileId':_0x5cc896[_0x7397('0x4c')]},'raw':!![]})[_0x7397('0x1f')](function(_0x295872){if(_0x295872&&_0x295872[_0x7397('0x4d')]===0x0){return db[_0x7397('0x22')][_0x7397('0x47')]({'name':_0x3082c8[_0x7397('0x27')],'resourceId':_0x3082c8['id'],'type':_0x295872[_0x7397('0x27')],'sectionId':_0x295872['id']},{})[_0x7397('0x1f')](function(){return _0x32eaa6;});}else{return _0x32eaa6;}})[_0x7397('0x41')](function(_0x5dcffc){logger['error'](_0x7397('0x4e'),_0x5dcffc);throw _0x5dcffc;});}return _0x32eaa6;})[_0x7397('0x1f')](respondWithResult(_0x5b7dd3,0xc9))[_0x7397('0x41')](handleError(_0x5b7dd3,null));};exports[_0x7397('0x1e')]=function(_0x17c5f6,_0x227f89){if(_0x17c5f6['body']['id']){delete _0x17c5f6[_0x7397('0x48')]['id'];}return db[_0x7397('0x2b')][_0x7397('0x46')]({'where':{'id':_0x17c5f6[_0x7397('0x42')]['id']}})[_0x7397('0x1f')](handleEntityNotFound(_0x227f89,null))['then'](saveUpdates(_0x17c5f6[_0x7397('0x48')],null))[_0x7397('0x1f')](respondWithResult(_0x227f89,null))['catch'](handleError(_0x227f89,null));};exports[_0x7397('0x23')]=function(_0x109e3c,_0x25fa2f){return db[_0x7397('0x2b')][_0x7397('0x46')]({'where':{'id':_0x109e3c['params']['id']}})[_0x7397('0x1f')](handleEntityNotFound(_0x25fa2f,null))[_0x7397('0x1f')](removeEntity(_0x25fa2f,null))[_0x7397('0x41')](handleError(_0x25fa2f,null));}; \ No newline at end of file +var _0x1b74=['destroy','get','Pauses','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Pause','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x2ebee7,_0x333543){var _0xd8485=function(_0x5d3d3a){while(--_0x5d3d3a){_0x2ebee7['push'](_0x2ebee7['shift']());}};_0xd8485(++_0x333543);}(_0x1b74,0xe5));var _0x41b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1b74[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x41b7('0x0'));var rimraf=require(_0x41b7('0x1'));var zipdir=require(_0x41b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41b7('0x3'));var moment=require(_0x41b7('0x4'));var BPromise=require(_0x41b7('0x5'));var Mustache=require(_0x41b7('0x6'));var util=require(_0x41b7('0x7'));var path=require('path');var sox=require(_0x41b7('0x8'));var csv=require(_0x41b7('0x9'));var ejs=require(_0x41b7('0xa'));var fs=require('fs');var fs_extra=require(_0x41b7('0xb'));var _=require(_0x41b7('0xc'));var squel=require('squel');var crypto=require(_0x41b7('0xd'));var jsforce=require(_0x41b7('0xe'));var deskjs=require(_0x41b7('0xf'));var toCsv=require(_0x41b7('0x9'));var querystring=require(_0x41b7('0x10'));var Papa=require('papaparse');var Redis=require(_0x41b7('0x11'));var authService=require(_0x41b7('0x12'));var qs=require(_0x41b7('0x13'));var as=require(_0x41b7('0x14'));var hardwareService=require(_0x41b7('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x41b7('0x16'));var config=require(_0x41b7('0x17'));var licenseUtil=require(_0x41b7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426c0a,_0x5e1942){_0x5e1942=_0x5e1942||0xcc;return function(_0x5e1b92){if(_0x5e1b92){return _0x426c0a['sendStatus'](_0x5e1942);}return _0x426c0a[_0x41b7('0x19')](_0x5e1942)['end']();};}function respondWithResult(_0xafd39e,_0x39a915){_0x39a915=_0x39a915||0xc8;return function(_0xa9a09e){if(_0xa9a09e){return _0xafd39e[_0x41b7('0x19')](_0x39a915)['json'](_0xa9a09e);}};}function respondWithFilteredResult(_0x3c1793,_0x3bd0b7){return function(_0x22c387){if(_0x22c387){var _0x57eedb=typeof _0x3bd0b7[_0x41b7('0x1a')]===_0x41b7('0x1b')&&typeof _0x3bd0b7[_0x41b7('0x1c')]===_0x41b7('0x1b');var _0x524789=_0x22c387[_0x41b7('0x1d')];var _0x4d684d=_0x57eedb?0x0:_0x3bd0b7['offset'];var _0x320177=_0x57eedb?_0x22c387[_0x41b7('0x1d')]:_0x3bd0b7[_0x41b7('0x1a')]+_0x3bd0b7[_0x41b7('0x1c')];var _0x1051d9;if(_0x320177>=_0x524789){_0x320177=_0x524789;_0x1051d9=0xc8;}else{_0x1051d9=0xce;}_0x3c1793[_0x41b7('0x19')](_0x1051d9);return _0x3c1793[_0x41b7('0x1e')](_0x41b7('0x1f'),_0x4d684d+'-'+_0x320177+'/'+_0x524789)[_0x41b7('0x20')](_0x22c387);}return null;};}function patchUpdates(_0xde98d7){return function(_0x2a934c){try{jsonpatch[_0x41b7('0x21')](_0x2a934c,_0xde98d7,!![]);}catch(_0x1e8a20){return BPromise[_0x41b7('0x22')](_0x1e8a20);}return _0x2a934c[_0x41b7('0x23')]();};}function saveUpdates(_0x5603d2,_0x57673e){return function(_0x45e61f){if(_0x45e61f){return _0x45e61f[_0x41b7('0x24')](_0x5603d2)[_0x41b7('0x25')](function(_0xa2eb5b){return _0xa2eb5b;});}return null;};}function removeEntity(_0x5ef02e,_0x51816d){return function(_0x2fb010){if(_0x2fb010){return _0x2fb010[_0x41b7('0x26')]()['then'](function(){var _0x48a1ad=_0x2fb010[_0x41b7('0x27')]({'plain':!![]});var _0x186376=_0x41b7('0x28');return db[_0x41b7('0x29')][_0x41b7('0x26')]({'where':{'type':_0x186376,'resourceId':_0x48a1ad['id']}})[_0x41b7('0x25')](function(){return _0x2fb010;});})['then'](function(){_0x5ef02e['status'](0xcc)[_0x41b7('0x2a')]();});}};}function handleEntityNotFound(_0x2fe000,_0x28e0f6){return function(_0x509f88){if(!_0x509f88){_0x2fe000['sendStatus'](0x194);}return _0x509f88;};}function handleError(_0xd05b45,_0x1d5b5c){_0x1d5b5c=_0x1d5b5c||0x1f4;return function(_0x36db0d){logger[_0x41b7('0x2b')](_0x36db0d[_0x41b7('0x2c')]);if(_0x36db0d[_0x41b7('0x2d')]){delete _0x36db0d['name'];}_0xd05b45['status'](_0x1d5b5c)[_0x41b7('0x2e')](_0x36db0d);};}exports[_0x41b7('0x2f')]=function(_0x46c7a2,_0xa5628a){var _0x44ba31={},_0x12dec9={},_0x47a0aa={'count':0x0,'rows':[]};var _0x441fd4=_[_0x41b7('0x30')](db['Pause'][_0x41b7('0x31')],function(_0x2e14ed){return{'name':_0x2e14ed[_0x41b7('0x32')],'type':_0x2e14ed[_0x41b7('0x33')][_0x41b7('0x34')]};});_0x12dec9[_0x41b7('0x35')]=_[_0x41b7('0x30')](_0x441fd4,'name');_0x12dec9[_0x41b7('0x36')]=_[_0x41b7('0x37')](_0x46c7a2[_0x41b7('0x36')]);_0x12dec9[_0x41b7('0x38')]=_[_0x41b7('0x39')](_0x12dec9[_0x41b7('0x35')],_0x12dec9['query']);_0x44ba31[_0x41b7('0x3a')]=_[_0x41b7('0x39')](_0x12dec9['model'],qs[_0x41b7('0x3b')](_0x46c7a2[_0x41b7('0x36')][_0x41b7('0x3b')]));_0x44ba31[_0x41b7('0x3a')]=_0x44ba31[_0x41b7('0x3a')]['length']?_0x44ba31[_0x41b7('0x3a')]:_0x12dec9[_0x41b7('0x35')];if(!_0x46c7a2['query'][_0x41b7('0x3c')](_0x41b7('0x3d'))){_0x44ba31['limit']=qs[_0x41b7('0x1c')](_0x46c7a2['query']['limit']);_0x44ba31[_0x41b7('0x1a')]=qs[_0x41b7('0x1a')](_0x46c7a2[_0x41b7('0x36')][_0x41b7('0x1a')]);}_0x44ba31[_0x41b7('0x3e')]=qs[_0x41b7('0x3f')](_0x46c7a2[_0x41b7('0x36')][_0x41b7('0x3f')]);_0x44ba31[_0x41b7('0x40')]=qs[_0x41b7('0x38')](_[_0x41b7('0x41')](_0x46c7a2[_0x41b7('0x36')],_0x12dec9[_0x41b7('0x38')]),_0x441fd4);if(_0x46c7a2[_0x41b7('0x36')][_0x41b7('0x42')]){_0x44ba31[_0x41b7('0x40')]=_[_0x41b7('0x43')](_0x44ba31[_0x41b7('0x40')],{'$or':_[_0x41b7('0x30')](_0x441fd4,function(_0x20872f){if(_0x20872f['type']!==_0x41b7('0x44')){var _0x18fe2c={};_0x18fe2c[_0x20872f[_0x41b7('0x2d')]]={'$like':'%'+_0x46c7a2[_0x41b7('0x36')]['filter']+'%'};return _0x18fe2c;}})});}_0x44ba31=_[_0x41b7('0x43')]({},_0x44ba31,_0x46c7a2[_0x41b7('0x45')]);var _0xb6a7d8={'where':_0x44ba31[_0x41b7('0x40')]};return db[_0x41b7('0x46')][_0x41b7('0x1d')](_0xb6a7d8)[_0x41b7('0x25')](function(_0x57081c){_0x47a0aa[_0x41b7('0x1d')]=_0x57081c;if(_0x46c7a2[_0x41b7('0x36')]['includeAll']){_0x44ba31[_0x41b7('0x47')]=[{'all':!![]}];}return db[_0x41b7('0x46')][_0x41b7('0x48')](_0x44ba31);})[_0x41b7('0x25')](function(_0x333d14){_0x47a0aa[_0x41b7('0x49')]=_0x333d14;return _0x47a0aa;})[_0x41b7('0x25')](respondWithFilteredResult(_0xa5628a,_0x44ba31))[_0x41b7('0x4a')](handleError(_0xa5628a,null));};exports[_0x41b7('0x4b')]=function(_0x1e688d,_0x21a2ce){var _0x295b3d={'raw':!![],'where':{'id':_0x1e688d[_0x41b7('0x4c')]['id']}},_0x117e81={};_0x117e81[_0x41b7('0x35')]=_[_0x41b7('0x37')](db['Pause']['rawAttributes']);_0x117e81['query']=_['keys'](_0x1e688d[_0x41b7('0x36')]);_0x117e81[_0x41b7('0x38')]=_[_0x41b7('0x39')](_0x117e81['model'],_0x117e81[_0x41b7('0x36')]);_0x295b3d[_0x41b7('0x3a')]=_[_0x41b7('0x39')](_0x117e81['model'],qs[_0x41b7('0x3b')](_0x1e688d[_0x41b7('0x36')]['fields']));_0x295b3d[_0x41b7('0x3a')]=_0x295b3d[_0x41b7('0x3a')][_0x41b7('0x4d')]?_0x295b3d[_0x41b7('0x3a')]:_0x117e81['model'];if(_0x1e688d[_0x41b7('0x36')][_0x41b7('0x4e')]){_0x295b3d[_0x41b7('0x47')]=[{'all':!![]}];}_0x295b3d=_[_0x41b7('0x43')]({},_0x295b3d,_0x1e688d[_0x41b7('0x45')]);return db[_0x41b7('0x46')][_0x41b7('0x4f')](_0x295b3d)[_0x41b7('0x25')](handleEntityNotFound(_0x21a2ce,null))[_0x41b7('0x25')](respondWithResult(_0x21a2ce,null))[_0x41b7('0x4a')](handleError(_0x21a2ce,null));};exports[_0x41b7('0x50')]=function(_0x1324a7,_0x50d365){return db[_0x41b7('0x46')][_0x41b7('0x50')](_0x1324a7[_0x41b7('0x51')],{})[_0x41b7('0x25')](function(_0x8cf175){var _0x520dc8=_0x1324a7[_0x41b7('0x52')][_0x41b7('0x27')]({'plain':!![]});if(!_0x520dc8)throw new Error(_0x41b7('0x53'));if(_0x520dc8[_0x41b7('0x54')]==='user'){var _0x293df9=_0x8cf175[_0x41b7('0x27')]({'plain':!![]});var _0x230065='Pauses';return db[_0x41b7('0x55')][_0x41b7('0x4f')]({'where':{'name':_0x230065,'userProfileId':_0x520dc8[_0x41b7('0x56')]},'raw':!![]})['then'](function(_0x765e13){if(_0x765e13&&_0x765e13[_0x41b7('0x57')]===0x0){return db[_0x41b7('0x29')][_0x41b7('0x50')]({'name':_0x293df9[_0x41b7('0x2d')],'resourceId':_0x293df9['id'],'type':_0x765e13[_0x41b7('0x2d')],'sectionId':_0x765e13['id']},{})[_0x41b7('0x25')](function(){return _0x8cf175;});}else{return _0x8cf175;}})[_0x41b7('0x4a')](function(_0x1c63a9){logger[_0x41b7('0x2b')](_0x41b7('0x58'),_0x1c63a9);throw _0x1c63a9;});}return _0x8cf175;})['then'](respondWithResult(_0x50d365,0xc9))[_0x41b7('0x4a')](handleError(_0x50d365,null));};exports['update']=function(_0x267167,_0x25c69a){if(_0x267167[_0x41b7('0x51')]['id']){delete _0x267167['body']['id'];}return db['Pause'][_0x41b7('0x4f')]({'where':{'id':_0x267167[_0x41b7('0x4c')]['id']}})[_0x41b7('0x25')](handleEntityNotFound(_0x25c69a,null))[_0x41b7('0x25')](saveUpdates(_0x267167[_0x41b7('0x51')],null))['then'](respondWithResult(_0x25c69a,null))[_0x41b7('0x4a')](handleError(_0x25c69a,null));};exports['destroy']=function(_0x382c4a,_0x23d333){return db[_0x41b7('0x46')]['find']({'where':{'id':_0x382c4a[_0x41b7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23d333,null))[_0x41b7('0x25')](removeEntity(_0x23d333,null))[_0x41b7('0x4a')](handleError(_0x23d333,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5922039..7ea2dfe 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x161a9a,_0x4f2072){var _0x163385=function(_0x27fc4d){while(--_0x27fc4d){_0x161a9a['push'](_0x161a9a['shift']());}};_0x163385(++_0x4f2072);}(_0x814b,0x1a2));var _0xb814=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x814b[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x215b81,_0x2e5b6d){_0x215b81=_0x215b81-0x0;var _0x52177b=_0x7fbe[_0x215b81];return _0x52177b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1445ce7..61c625e 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x401d1a,_0x584ee0){var _0x2b9dc0=function(_0x512e48){while(--_0x512e48){_0x401d1a['push'](_0x401d1a['shift']());}};_0x2b9dc0(++_0x584ee0);}(_0xb10b,0x12a));var _0xbb10=function(_0x45aca3,_0x2dc880){_0x45aca3=_0x45aca3-0x0;var _0x540d06=_0xb10b[_0x45aca3];return _0x540d06;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1b0618,_0x2590aa){var _0x480841=function(_0x38b15a){while(--_0x38b15a){_0x1b0618['push'](_0x1b0618['shift']());}};_0x480841(++_0x2590aa);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a94b1,_0x4f2518){_0x4a94b1=_0x4a94b1-0x0;var _0x20949f=_0xb10b[_0x4a94b1];return _0x20949f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d75e51e..35560f6 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 _0x4b84=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/webhook','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','now','extname','upload','webhookPost','/:id','isAuthenticated','delete'];(function(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0x4b84,0x1cc));var _0x44b8=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x4b84[_0x265003];return _0x33c743;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),controller['webhookGet']);router[_0x44b8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0x8')](_0x44b8('0xa'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);var upload=multer({'storage':multer[_0x44b8('0xc')]({'destination':function(_0x4315f6,_0x9b6048,_0x24dd10){_0x24dd10(null,path[_0x44b8('0xd')](config[_0x44b8('0xe')],'server/files/plugins'));},'filename':function(_0x147529,_0x4301a6,_0x4bcc43){_0x4301a6[_0x44b8('0xf')]=_0x4301a6['originalname'][_0x44b8('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bcc43(null,util[_0x44b8('0x11')]('%s-%s%s',path[_0x44b8('0x12')](_0x4301a6['originalname'],path['extname'](_0x4301a6[_0x44b8('0xf')])),Date[_0x44b8('0x13')](),path[_0x44b8('0x14')](_0x4301a6[_0x44b8('0xf')])));}})});router['post']('/',upload['single']('file'),controller[_0x44b8('0x15')]);router['post'](_0x44b8('0x7'),controller[_0x44b8('0x16')]);router['put'](_0x44b8('0x17'),auth[_0x44b8('0x18')](),controller['update']);router[_0x44b8('0x19')](_0x44b8('0x17'),auth['isAuthenticated'](),controller[_0x44b8('0x19')]);module[_0x44b8('0x1a')]=router; \ No newline at end of file +var _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','webhookGet','/:id','show','/:id/download','download','diskStorage','root','format','%s-%s%s','basename','originalname','extname','post','file','webhookPost','put','update','delete'];(function(_0x31af8c,_0x2be236){var _0x35d49b=function(_0x32d8ae){while(--_0x32d8ae){_0x31af8c['push'](_0x31af8c['shift']());}};_0x35d49b(++_0x2be236);}(_0x98a8,0x12c));var _0x898a=function(_0xe271e2,_0x54fd70){_0xe271e2=_0xe271e2-0x0;var _0x1bd00=_0x98a8[_0xe271e2];return _0x1bd00;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/webhook',controller[_0x898a('0xc')]);router['get'](_0x898a('0xd'),auth[_0x898a('0xb')](),controller[_0x898a('0xe')]);router[_0x898a('0xa')](_0x898a('0xf'),auth[_0x898a('0xb')](),controller[_0x898a('0x10')]);var upload=multer({'storage':multer[_0x898a('0x11')]({'destination':function(_0x3806cb,_0x5d2de4,_0x3e1867){_0x3e1867(null,path['join'](config[_0x898a('0x12')],'server/files/plugins'));},'filename':function(_0x25d7f2,_0x2c76b7,_0x364a23){_0x2c76b7['originalname']=_0x2c76b7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x364a23(null,util[_0x898a('0x13')](_0x898a('0x14'),path[_0x898a('0x15')](_0x2c76b7[_0x898a('0x16')],path[_0x898a('0x17')](_0x2c76b7[_0x898a('0x16')])),Date['now'](),path[_0x898a('0x17')](_0x2c76b7['originalname'])));}})});router[_0x898a('0x18')]('/',upload['single'](_0x898a('0x19')),controller['upload']);router[_0x898a('0x18')]('/webhook',controller[_0x898a('0x1a')]);router[_0x898a('0x1b')](_0x898a('0xd'),auth['isAuthenticated'](),controller[_0x898a('0x1c')]);router['delete']('/:id',auth[_0x898a('0xb')](),controller[_0x898a('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6a94966..468af27 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 _0x63da=['never','sequelize','STRING','ENUM','html','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x5340fb,_0x53d5a2){var _0x35701e=function(_0x47ce2f){while(--_0x47ce2f){_0x5340fb['push'](_0x5340fb['shift']());}};_0x35701e(++_0x53d5a2);}(_0x63da,0x1af));var _0xa63d=function(_0x111ccc,_0x4f5094){_0x111ccc=_0x111ccc-0x0;var _0x5bd2a5=_0x63da[_0x111ccc];return _0x5bd2a5;};'use strict';var Sequelize=require(_0xa63d('0x0'));module['exports']={'name':{'type':Sequelize[_0xa63d('0x1')]},'type':{'type':Sequelize[_0xa63d('0x2')](_0xa63d('0x3'),'script')},'description':{'type':Sequelize[_0xa63d('0x4')]},'version':{'type':Sequelize[_0xa63d('0x4')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa63d('0x5')},'sidebar':{'type':Sequelize['ENUM'](_0xa63d('0x6'),_0xa63d('0x7'),_0xa63d('0x8'),_0xa63d('0x9')),'defaultValue':_0xa63d('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xa63d('0x1')]},'agentUrl':{'type':Sequelize[_0xa63d('0x1')]},'scriptName':{'type':Sequelize[_0xa63d('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb401=['ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','sequelize','exports','STRING'];(function(_0x5cbc60,_0xef6bb4){var _0xc11013=function(_0x570477){while(--_0x570477){_0x5cbc60['push'](_0x5cbc60['shift']());}};_0xc11013(++_0xef6bb4);}(_0xb401,0xe3));var _0x1b40=function(_0x4f9ff3,_0x108236){_0x4f9ff3=_0x4f9ff3-0x0;var _0x1a6c55=_0xb401[_0x4f9ff3];return _0x1a6c55;};'use strict';var Sequelize=require(_0x1b40('0x0'));module[_0x1b40('0x1')]={'name':{'type':Sequelize[_0x1b40('0x2')]},'type':{'type':Sequelize[_0x1b40('0x3')](_0x1b40('0x4'),_0x1b40('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x1b40('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1b40('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x1b40('0x8'),_0x1b40('0x9'),'always','never'),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x1b40('0x2')]},'adminUrl':{'type':Sequelize[_0x1b40('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1b40('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f87321f..9bca2a7 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 _0x5ec0=['\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','method','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','get','Plugins','destroy','end','error','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','download','join','root','server/files/plugins','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','dirname','basename','node_modules/**/*','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','html','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0x5ec0,0xb3));var _0x05ec=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5ec0[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x05ec('0x0'));var rimraf=require(_0x05ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05ec('0x2'));var rp=require(_0x05ec('0x3'));var moment=require('moment');var BPromise=require(_0x05ec('0x4'));var Mustache=require('mustache');var util=require(_0x05ec('0x5'));var path=require(_0x05ec('0x6'));var sox=require(_0x05ec('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05ec('0x8'));var _=require(_0x05ec('0x9'));var squel=require(_0x05ec('0xa'));var crypto=require('crypto');var jsforce=require(_0x05ec('0xb'));var deskjs=require(_0x05ec('0xc'));var toCsv=require(_0x05ec('0xd'));var querystring=require(_0x05ec('0xe'));var Papa=require(_0x05ec('0xf'));var extract=require('extract-zip');var rimraf=require(_0x05ec('0x1'));var archiver=require(_0x05ec('0x10'));var Redis=require(_0x05ec('0x11'));var authService=require(_0x05ec('0x12'));var qs=require(_0x05ec('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05ec('0x14'));var logger=require(_0x05ec('0x15'))(_0x05ec('0x16'));var utils=require(_0x05ec('0x17'));var config=require(_0x05ec('0x18'));var licenseUtil=require(_0x05ec('0x19'));var db=require(_0x05ec('0x1a'))['db'];config[_0x05ec('0x1b')]=_['defaults'](config[_0x05ec('0x1b')],{'host':_0x05ec('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05ec('0x1b')]));require(_0x05ec('0x1d'))['register'](socket);function respondWithStatusCode(_0x2500ad,_0x4fe7ce){_0x4fe7ce=_0x4fe7ce||0xcc;return function(_0x40c5d0){if(_0x40c5d0){return _0x2500ad[_0x05ec('0x1e')](_0x4fe7ce);}return _0x2500ad['status'](_0x4fe7ce)['end']();};}function respondWithResult(_0x264dbe,_0x25ce8c){_0x25ce8c=_0x25ce8c||0xc8;return function(_0x2f05a2){if(_0x2f05a2){return _0x264dbe[_0x05ec('0x1f')](_0x25ce8c)[_0x05ec('0x20')](_0x2f05a2);}};}function respondWithFilteredResult(_0x21a49d,_0x44a244){return function(_0x5a0faf){if(_0x5a0faf){var _0x187cbe=typeof _0x44a244['offset']===_0x05ec('0x21')&&typeof _0x44a244[_0x05ec('0x22')]===_0x05ec('0x21');var _0x22dd63=_0x5a0faf['count'];var _0x20eb98=_0x187cbe?0x0:_0x44a244[_0x05ec('0x23')];var _0x48c9dc=_0x187cbe?_0x5a0faf[_0x05ec('0x24')]:_0x44a244[_0x05ec('0x23')]+_0x44a244[_0x05ec('0x22')];var _0x9fd5cc;if(_0x48c9dc>=_0x22dd63){_0x48c9dc=_0x22dd63;_0x9fd5cc=0xc8;}else{_0x9fd5cc=0xce;}_0x21a49d[_0x05ec('0x1f')](_0x9fd5cc);return _0x21a49d[_0x05ec('0x25')](_0x05ec('0x26'),_0x20eb98+'-'+_0x48c9dc+'/'+_0x22dd63)['json'](_0x5a0faf);}return null;};}function patchUpdates(_0x985bdc){return function(_0x385208){try{jsonpatch['apply'](_0x385208,_0x985bdc,!![]);}catch(_0x5812ea){return BPromise[_0x05ec('0x27')](_0x5812ea);}return _0x385208[_0x05ec('0x28')]();};}function saveUpdates(_0x2ce975,_0x30803f){return function(_0x42cb34){if(_0x42cb34){return _0x42cb34['update'](_0x2ce975)[_0x05ec('0x29')](function(_0x23648a){return _0x23648a;});}return null;};}function removeEntity(_0x30156b,_0x1adfe8){return function(_0x2086a9){if(_0x2086a9){return _0x2086a9['destroy']()['then'](function(){var _0x3789b1=_0x2086a9[_0x05ec('0x2a')]({'plain':!![]});var _0x81fe3a=_0x05ec('0x2b');return db['UserProfileResource'][_0x05ec('0x2c')]({'where':{'type':_0x81fe3a,'resourceId':_0x3789b1['id']}})[_0x05ec('0x29')](function(){return _0x2086a9;});})[_0x05ec('0x29')](function(){_0x30156b['status'](0xcc)[_0x05ec('0x2d')]();});}};}function handleEntityNotFound(_0x2966d0,_0x286f20){return function(_0x2620b7){if(!_0x2620b7){_0x2966d0[_0x05ec('0x1e')](0x194);}return _0x2620b7;};}function handleError(_0x29497e,_0x4f539c){_0x4f539c=_0x4f539c||0x1f4;return function(_0x294626){logger[_0x05ec('0x2e')](_0x294626['stack']);if(_0x294626[_0x05ec('0x2f')]){delete _0x294626['name'];}_0x29497e[_0x05ec('0x1f')](_0x4f539c)[_0x05ec('0x30')](_0x294626);};}exports['index']=function(_0x34c3a8,_0x90296d){var _0x44fe85={},_0x5a029e={},_0x389b66={'count':0x0,'rows':[]};var _0xf77997=_[_0x05ec('0x31')](db[_0x05ec('0x32')][_0x05ec('0x33')],function(_0x6e8bc9){return{'name':_0x6e8bc9[_0x05ec('0x34')],'type':_0x6e8bc9[_0x05ec('0x35')][_0x05ec('0x36')]};});_0x5a029e[_0x05ec('0x37')]=_['map'](_0xf77997,_0x05ec('0x2f'));_0x5a029e[_0x05ec('0x38')]=_[_0x05ec('0x39')](_0x34c3a8['query']);_0x5a029e[_0x05ec('0x3a')]=_[_0x05ec('0x3b')](_0x5a029e[_0x05ec('0x37')],_0x5a029e[_0x05ec('0x38')]);_0x44fe85[_0x05ec('0x3c')]=_[_0x05ec('0x3b')](_0x5a029e['model'],qs['fields'](_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x3d')]));_0x44fe85[_0x05ec('0x3c')]=_0x44fe85[_0x05ec('0x3c')][_0x05ec('0x3e')]?_0x44fe85['attributes']:_0x5a029e[_0x05ec('0x37')];if(!_0x34c3a8[_0x05ec('0x38')]['hasOwnProperty'](_0x05ec('0x3f'))){_0x44fe85[_0x05ec('0x22')]=qs[_0x05ec('0x22')](_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x22')]);_0x44fe85[_0x05ec('0x23')]=qs['offset'](_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x23')]);}_0x44fe85[_0x05ec('0x40')]=qs[_0x05ec('0x41')](_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x41')]);_0x44fe85[_0x05ec('0x42')]=qs[_0x05ec('0x3a')](_[_0x05ec('0x43')](_0x34c3a8['query'],_0x5a029e[_0x05ec('0x3a')]),_0xf77997);if(_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x44')]){_0x44fe85[_0x05ec('0x42')]=_[_0x05ec('0x45')](_0x44fe85['where'],{'$or':_[_0x05ec('0x31')](_0xf77997,function(_0x4205aa){if(_0x4205aa[_0x05ec('0x35')]!==_0x05ec('0x46')){var _0x2df5bf={};_0x2df5bf[_0x4205aa[_0x05ec('0x2f')]]={'$like':'%'+_0x34c3a8['query'][_0x05ec('0x44')]+'%'};return _0x2df5bf;}})});}_0x44fe85=_[_0x05ec('0x45')]({},_0x44fe85,_0x34c3a8[_0x05ec('0x47')]);var _0x5c714c={'where':_0x44fe85['where']};return db[_0x05ec('0x32')]['count'](_0x5c714c)[_0x05ec('0x29')](function(_0x2cd398){_0x389b66[_0x05ec('0x24')]=_0x2cd398;if(_0x34c3a8[_0x05ec('0x38')][_0x05ec('0x48')]){_0x44fe85[_0x05ec('0x49')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x44fe85);})[_0x05ec('0x29')](function(_0x2b9e62){_0x389b66['rows']=_0x2b9e62;return _0x389b66;})[_0x05ec('0x29')](respondWithFilteredResult(_0x90296d,_0x44fe85))[_0x05ec('0x4a')](handleError(_0x90296d,null));};exports[_0x05ec('0x4b')]=function(_0x25f97e,_0x3a447c){var _0x571189={'raw':!![],'where':{'id':_0x25f97e[_0x05ec('0x4c')]['id']}},_0x2eede2={};_0x2eede2[_0x05ec('0x37')]=_['keys'](db['Plugin']['rawAttributes']);_0x2eede2[_0x05ec('0x38')]=_[_0x05ec('0x39')](_0x25f97e[_0x05ec('0x38')]);_0x2eede2[_0x05ec('0x3a')]=_[_0x05ec('0x3b')](_0x2eede2[_0x05ec('0x37')],_0x2eede2[_0x05ec('0x38')]);_0x571189['attributes']=_[_0x05ec('0x3b')](_0x2eede2[_0x05ec('0x37')],qs[_0x05ec('0x3d')](_0x25f97e[_0x05ec('0x38')]['fields']));_0x571189[_0x05ec('0x3c')]=_0x571189[_0x05ec('0x3c')][_0x05ec('0x3e')]?_0x571189[_0x05ec('0x3c')]:_0x2eede2[_0x05ec('0x37')];if(_0x25f97e[_0x05ec('0x38')][_0x05ec('0x48')]){_0x571189['include']=[{'all':!![]}];}_0x571189=_['merge']({},_0x571189,_0x25f97e[_0x05ec('0x47')]);return db[_0x05ec('0x32')][_0x05ec('0x4d')](_0x571189)['then'](handleEntityNotFound(_0x3a447c,null))[_0x05ec('0x29')](respondWithResult(_0x3a447c,null))['catch'](handleError(_0x3a447c,null));};exports[_0x05ec('0x4e')]=function(_0x1bcf7f,_0x34985f,_0x15316d){return db[_0x05ec('0x32')][_0x05ec('0x4d')]({'where':{'id':_0x1bcf7f[_0x05ec('0x4c')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0x34985f,null))[_0x05ec('0x29')](function(_0x521136){if(_0x521136){var _0xe5d605=path[_0x05ec('0x4f')](config[_0x05ec('0x50')],_0x05ec('0x51'),util['format']('%s.zip',path['basename'](_0x521136[_0x05ec('0x6')])));var _0x5984f7=fs[_0x05ec('0x52')](_0xe5d605);var _0x465493=archiver(_0x05ec('0x53'),{'zlib':{'level':0x9}});_0x465493['on'](_0x05ec('0x54'),function(_0x377cec){if(_0x377cec[_0x05ec('0x55')]===_0x05ec('0x56')){logger[_0x05ec('0x2e')](_0x377cec);}else{throw new db['Sequelize'][(_0x05ec('0x57'))](_0x05ec('0x58'));}});_0x465493['on'](_0x05ec('0x2e'),function(_0x13e618){throw new db[(_0x05ec('0x59'))][(_0x05ec('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x465493[_0x05ec('0x5a')](_0x5984f7);_0x465493[_0x05ec('0x5b')]('**/*',{'cwd':path['join'](config[_0x05ec('0x50')],_0x05ec('0x51'),path[_0x05ec('0x5c')](_0x521136[_0x05ec('0x6')])),'ignore':[path[_0x05ec('0x4f')](path[_0x05ec('0x5d')](_0x521136[_0x05ec('0x6')]),_0x05ec('0x5e')),path['join'](path[_0x05ec('0x5d')](_0x521136[_0x05ec('0x6')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x5984f7['on']('close',function(){if(!fs['existsSync'](_0xe5d605)){throw new db[(_0x05ec('0x59'))][(_0x05ec('0x57'))]('Plugin\x20not\x20found');}return _0x34985f[_0x05ec('0x4e')](_0xe5d605,util[_0x05ec('0x5f')](_0x05ec('0x60'),path[_0x05ec('0x5d')](_0x521136[_0x05ec('0x6')])),function(_0x542148){if(_0x542148){throw new db[(_0x05ec('0x59'))][(_0x05ec('0x57'))](_0x05ec('0x61'));}fs[_0x05ec('0x62')](_0xe5d605);logger['info'](_0x05ec('0x63'));logger[_0x05ec('0x64')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x34985f,null));};exports['upload']=function(_0x3c73bf,_0x39ff27,_0xfc0989){var _0x15c3a2=path[_0x05ec('0x5d')](_0x3c73bf['file'][_0x05ec('0x65')],path['extname'](_0x3c73bf['file'][_0x05ec('0x65')]));var _0x41b725=path[_0x05ec('0x4f')](config['root'],_0x05ec('0x51'),_0x3c73bf[_0x05ec('0x66')][_0x05ec('0x65')]);var _0x32de88=path[_0x05ec('0x4f')](config[_0x05ec('0x50')],'server/files/plugins',_0x15c3a2);logger[_0x05ec('0x64')](_0x05ec('0x67'),_0x41b725);logger['info'](_0x05ec('0x68'),_0x32de88);try{fs[_0x05ec('0x69')](_0x41b725,parseInt('0777',0x8));extract(_0x41b725,{'dir':_0x32de88},function(_0xc897fe){if(_0xc897fe){logger['error'](_0xc897fe);handleError(_0xc897fe,!![]);};var _0x4203fd=fs[_0x05ec('0x6a')](_0x32de88);if(_0x4203fd[_0x05ec('0x3e')]>0x1){removeReferences(_0x41b725,_0x32de88);logger['error'](_0x05ec('0x6b'));return _0xfc0989(new Error(_0x05ec('0x6b')));}var _0x4de288=fs[_0x05ec('0x6c')](path[_0x05ec('0x4f')](_0x32de88,_0x4203fd[0x0]));if(_0x4de288[_0x05ec('0x6d')]()){removeReferences(_0x41b725,_0x32de88);logger[_0x05ec('0x2e')](_0x05ec('0x6b'));return _0xfc0989(new Error(_0x05ec('0x6b')));}if(_0x4de288[_0x05ec('0x6e')]()){var _0x344087=fs[_0x05ec('0x6a')](path['join'](_0x32de88,_0x4203fd[0x0]));if(_0x344087[_0x05ec('0x3e')]===0x0){removeReferences(_0x41b725,_0x32de88);logger[_0x05ec('0x2e')](_0x05ec('0x6b'));return _0xfc0989(new Error(_0x05ec('0x6b')));}var _0x4fe84f=_0x344087[_0x05ec('0x6f')](function(_0x4a85de){return _0x4a85de===_0x05ec('0x70');});if(!_0x4fe84f){return _0xfc0989(new Error(_0x05ec('0x71')));}var _0x64ab1a=fs[_0x05ec('0x72')](path[_0x05ec('0x4f')](_0x32de88,_0x4203fd[0x0],_0x05ec('0x70')));var _0x209cd9=JSON[_0x05ec('0x73')](_0x64ab1a);if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x2f')]){return _0xfc0989(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x35')]){return _0xfc0989(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x05ec('0x21')==typeof _0x209cd9['version']){return _0xfc0989(new Error(_0x05ec('0x74')));}if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x75')]){return _0xfc0989(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x209cd9['type']==='html'){if('undefined'==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')]){return _0xfc0989(new Error(_0x05ec('0x77')));}if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')]['admin']&&'undefined'==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')][_0x05ec('0x78')]){return _0xfc0989(new Error(_0x05ec('0x79')));}}else if(_0x209cd9[_0x05ec('0x35')]===_0x05ec('0x7a')){if('undefined'==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x7b')]){return _0xfc0989(new Error(_0x05ec('0x7c')));}if(_0x05ec('0x21')==typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x7d')]){return _0xfc0989(new Error(_0x05ec('0x7e')));}}else{return _0xfc0989(new Error(_0x05ec('0x7f')));}var _0x3ba93e=_0x209cd9[_0x05ec('0x2f')];var _0x460ebc=_0x209cd9[_0x05ec('0x80')];var _0x265115=_0x209cd9[_0x05ec('0x35')];var _0x22428e=_0x209cd9[_0x05ec('0x81')]?_0x209cd9[_0x05ec('0x81')]:'always';var _0x3046ff=_0x209cd9[_0x05ec('0x82')]?_0x209cd9[_0x05ec('0x82')]:_0x05ec('0x83');var _0x467692='';var _0xd97dc8='';var _0xd3f4d9='';var _0x5327a8='';var _0xc18127=_0x209cd9['version'];if(_0x265115===_0x05ec('0x84')){if(_0x05ec('0x21')!=typeof _0x209cd9['parameters'][_0x05ec('0x76')][_0x05ec('0x85')]){var _0x23ca48=_0x209cd9[_0x05ec('0x75')]['views'][_0x05ec('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x23ca48)){_0x467692=path['join'](_0x05ec('0x86'),_0x15c3a2,_0x4203fd[0x0],_0x23ca48);}else{_0x467692=_0x23ca48;}}else{logger['info'](_0x05ec('0x87'));}if(_0x05ec('0x21')!=typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')][_0x05ec('0x78')]){var _0x44506b=_0x209cd9['parameters']['views'][_0x05ec('0x78')];if(!/^(f|ht)tps?:\/\//i['test'](_0x44506b)){_0xd97dc8=path[_0x05ec('0x4f')](_0x05ec('0x86'),_0x15c3a2,_0x4203fd[0x0],_0x44506b);}else{_0xd97dc8=_0x44506b;}}else{logger[_0x05ec('0x64')](_0x05ec('0x88'));}}else if(_0x265115===_0x05ec('0x7a')){_0xd3f4d9=_0x209cd9[_0x05ec('0x75')][_0x05ec('0x7b')];_0x5327a8=_0x209cd9[_0x05ec('0x75')]['scriptPath'];if(_0x05ec('0x21')!=typeof _0x209cd9[_0x05ec('0x75')]['views']){if(_0x05ec('0x21')!=typeof _0x209cd9['parameters']['views'][_0x05ec('0x85')]){var _0x23ca48=_0x209cd9[_0x05ec('0x75')]['views'][_0x05ec('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x89')](_0x23ca48)){_0x467692=path[_0x05ec('0x4f')](_0x05ec('0x86'),_0x15c3a2,_0x4203fd[0x0],_0x23ca48);}else{_0x467692=_0x23ca48;}}if(_0x05ec('0x21')!=typeof _0x209cd9[_0x05ec('0x75')][_0x05ec('0x76')][_0x05ec('0x78')]){var _0x44506b=_0x209cd9[_0x05ec('0x75')]['views'][_0x05ec('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x89')](_0x44506b)){_0xd97dc8=path[_0x05ec('0x4f')]('plugins',_0x15c3a2,_0x4203fd[0x0],_0x44506b);}else{_0xd97dc8=_0x44506b;}}}}var _0x3db196={'name':_0x3ba93e,'description':_0x460ebc,'path':path[_0x05ec('0x4f')](_0x15c3a2,_0x4203fd[0x0]),'type':_0x265115,'sidebar':_0x22428e,'icon':_0x3046ff,'adminUrl':_0x467692,'agentUrl':_0xd97dc8,'scriptName':_0xd3f4d9,'scriptPath':_0x5327a8,'version':_0xc18127};removeReferences(_0x41b725,null);return db[_0x05ec('0x32')]['create'](_0x3db196)[_0x05ec('0x29')](function(_0x560cdf){var _0x201030={'role':_0x3c73bf[_0x05ec('0x8a')][_0x05ec('0x8b')],'userProfileId':_0x3c73bf[_0x05ec('0x8a')][_0x05ec('0x8c')]};if(!_0x201030)throw new Error(_0x05ec('0x8d'));if(_0x201030[_0x05ec('0x8b')]===_0x05ec('0x8e')){var _0x537af7=_0x560cdf[_0x05ec('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x05ec('0x4d')]({'where':{'name':_0x05ec('0x2b'),'userProfileId':_0x201030[_0x05ec('0x8c')]},'raw':!![]})['then'](function(_0x53ab9e){if(_0x53ab9e&&_0x53ab9e['autoAssociation']===0x0){return db[_0x05ec('0x8f')]['create']({'name':_0x537af7[_0x05ec('0x2f')],'resourceId':_0x537af7['id'],'type':_0x53ab9e[_0x05ec('0x2f')],'sectionId':_0x53ab9e['id']},{})[_0x05ec('0x29')](function(){return _0x560cdf;});}else{return _0x560cdf;}})[_0x05ec('0x4a')](function(_0x32b838){logger['error'](_0x05ec('0x90'),_0x32b838);throw _0x32b838;});}return _0x560cdf;})[_0x05ec('0x29')](respondWithResult(_0x39ff27,null))[_0x05ec('0x4a')](handleError(_0x39ff27,null));}});}catch(_0x10ffb3){_0x39ff27[_0x05ec('0x1f')](0x1f4)['send'](_0x10ffb3);}};function removeReferences(_0x5d8770,_0x2d54da){try{if(_0x5d8770){fs[_0x05ec('0x62')](_0x5d8770);logger['info'](_0x05ec('0x91'));}if(_0x2d54da){rimraf(_0x2d54da,function(){});logger[_0x05ec('0x64')](_0x05ec('0x92'));}}catch(_0x1b8861){logger[_0x05ec('0x2e')](_0x1b8861);}}exports[_0x05ec('0x93')]=function(_0x359bc0,_0x206499,_0x48ea13){return db['Plugin'][_0x05ec('0x4d')]({'where':{'id':_0x359bc0['params']['id']}})[_0x05ec('0x29')](handleEntityNotFound(_0x206499,null))['then'](saveUpdates(_0x359bc0[_0x05ec('0x8a')],null))[_0x05ec('0x29')](respondWithResult(_0x206499,null))['catch'](handleError(_0x206499,null));};exports['delete']=function(_0x521363,_0x353144,_0x504da1){return db['Plugin'][_0x05ec('0x4d')]({'where':{'id':_0x521363[_0x05ec('0x4c')]['id']}})[_0x05ec('0x29')](function(_0x4f9a36){if(_0x4f9a36){return _0x4f9a36['destroy']();}})[_0x05ec('0x29')](function(_0x3b7f5f){rimraf(path[_0x05ec('0x4f')](config['root'],_0x05ec('0x51'),path['dirname'](_0x3b7f5f[_0x05ec('0x6')])),function(){});return _0x3b7f5f;})['then'](handleEntityNotFound(_0x353144,null))[_0x05ec('0x29')](respondWithStatusCode(_0x353144,null))[_0x05ec('0x4a')](handleError(_0x353144,null));};exports[_0x05ec('0x94')]=function(_0x14c217,_0x4be229,_0x4244cb){return BPromise['resolve']()['then'](function(){if(!_0x14c217[_0x05ec('0x38')][_0x05ec('0x6')]){throw new Error(_0x05ec('0x95'));}if(!_0x14c217['query'][_0x05ec('0x96')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x53bf86=_0x14c217[_0x05ec('0x38')][_0x05ec('0x97')]?_0x14c217[_0x05ec('0x38')][_0x05ec('0x97')]+':'+_0x14c217[_0x05ec('0x38')][_0x05ec('0x96')]:_0x05ec('0x98')+_0x14c217['query'][_0x05ec('0x96')];var _0x40afd5=_0x14c217[_0x05ec('0x38')][_0x05ec('0x20')]?_0x14c217['query'][_0x05ec('0x20')]:!![];var _0x3f91eb=_0x14c217['query']['encoding']?_0x14c217[_0x05ec('0x38')]['encoding']:null;var _0x6b1f0b={'method':_0x14c217['method'],'uri':util[_0x05ec('0x5f')](_0x05ec('0x99'),_0x53bf86,_0x14c217[_0x05ec('0x38')][_0x05ec('0x6')]),'json':_0x40afd5,'resolveWithFullResponse':!![],'encoding':_0x3f91eb,'qs':_0x14c217['query']};if(_0x14c217[_0x05ec('0x9a')]){_0x6b1f0b[_0x05ec('0x9a')]=_0x14c217['headers'];if(_0x6b1f0b[_0x05ec('0x9a')][_0x05ec('0x9b')]){delete _0x6b1f0b[_0x05ec('0x9a')][_0x05ec('0x9b')];}}if(_0x6b1f0b[_0x05ec('0x9a')][_0x05ec('0x9c')]){delete _0x6b1f0b['headers'][_0x05ec('0x9c')];}return rp(_0x6b1f0b);})['then'](function(_0x250154){if(_0x250154){_0x4be229[_0x05ec('0x25')](_0x250154['headers']);logger[_0x05ec('0x64')](_0x250154[_0x05ec('0x8a')]);if(_[_0x05ec('0x9d')](_0x14c217[_0x05ec('0x38')][_0x05ec('0x6')],_0x05ec('0x4e'))&&_0x250154[_0x05ec('0x9e')]==0x1f4){return _0x4be229[_0x05ec('0x1e')](_0x250154[_0x05ec('0x9e')]);}else{return _0x4be229[_0x05ec('0x1f')](_0x250154['statusCode'])['send'](_0x250154[_0x05ec('0x8a')]);}}else{return _0x4be229[_0x05ec('0x1e')](0xc8);}})[_0x05ec('0x4a')](handleError(_0x4be229,null));};exports[_0x05ec('0x9f')]=function(_0x2270c3,_0x8e32c0,_0x4aeb44){return BPromise[_0x05ec('0xa0')]()[_0x05ec('0x29')](function(){if(!_0x2270c3[_0x05ec('0x38')][_0x05ec('0x6')]){throw new Error(_0x05ec('0x95'));}if(!_0x2270c3[_0x05ec('0x38')][_0x05ec('0x96')]){throw new Error(_0x05ec('0xa1'));}var _0x127727=_0x2270c3['query'][_0x05ec('0x97')]?_0x2270c3[_0x05ec('0x38')][_0x05ec('0x97')]+':'+_0x2270c3[_0x05ec('0x38')][_0x05ec('0x96')]:_0x05ec('0x98')+_0x2270c3['query'][_0x05ec('0x96')];var _0x284d6f=_0x2270c3[_0x05ec('0x38')][_0x05ec('0x20')]?_0x2270c3[_0x05ec('0x38')]['json']:!![];var _0x58f455=_0x2270c3[_0x05ec('0x38')][_0x05ec('0xa2')]?_0x2270c3[_0x05ec('0x38')][_0x05ec('0xa2')]:null;var _0x2dfda3={'method':_0x2270c3[_0x05ec('0xa3')],'uri':util[_0x05ec('0x5f')](_0x05ec('0x99'),_0x127727,_0x2270c3['query']['path']),'json':_0x284d6f,'resolveWithFullResponse':!![],'encoding':_0x58f455,'body':_0x2270c3[_0x05ec('0x8a')]};if(_0x2270c3['headers']){_0x2dfda3[_0x05ec('0x9a')]=_0x2270c3['headers'];if(_0x2dfda3[_0x05ec('0x9a')][_0x05ec('0x9b')]){delete _0x2dfda3['headers']['content-length'];}}if(_0x2dfda3[_0x05ec('0x9a')][_0x05ec('0x9c')]){delete _0x2dfda3[_0x05ec('0x9a')][_0x05ec('0x9c')];}return rp(_0x2dfda3);})[_0x05ec('0x29')](function(_0x85363e){if(_0x85363e){_0x8e32c0[_0x05ec('0x25')](_0x85363e[_0x05ec('0x9a')]);logger[_0x05ec('0x64')](_0x85363e[_0x05ec('0x8a')]);return _0x8e32c0[_0x05ec('0x1f')](_0x85363e[_0x05ec('0x9e')])[_0x05ec('0x30')](_0x85363e[_0x05ec('0x8a')]);}else{return _0x8e32c0[_0x05ec('0x1e')](0xc8);}})['catch'](handleError(_0x8e32c0,null));}; \ No newline at end of file +var _0x6f91=['plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptPath','body','userProfileId','role','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','then','destroy','Plugins','UserProfileResource','name','send','index','map','Plugin','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','rawAttributes','length','includeAll','find','path','root','basename','warning','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','join','dirname','node_modules/**/*','attachments/**/*','close','download','format','%s.zip','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test'];(function(_0x111165,_0x4f9303){var _0x64f7b6=function(_0x400882){while(--_0x400882){_0x111165['push'](_0x111165['shift']());}};_0x64f7b6(++_0x4f9303);}(_0x6f91,0xbf));var _0x16f9=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x6f91[_0x596f6e];return _0x1e0803;};'use strict';var emlformat=require(_0x16f9('0x0'));var rimraf=require(_0x16f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16f9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16f9('0x3'));var Mustache=require(_0x16f9('0x4'));var util=require(_0x16f9('0x5'));var path=require('path');var sox=require(_0x16f9('0x6'));var csv=require(_0x16f9('0x7'));var ejs=require(_0x16f9('0x8'));var fs=require('fs');var fs_extra=require(_0x16f9('0x9'));var _=require(_0x16f9('0xa'));var squel=require(_0x16f9('0xb'));var crypto=require(_0x16f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x16f9('0xd'));var toCsv=require(_0x16f9('0x7'));var querystring=require(_0x16f9('0xe'));var Papa=require('papaparse');var extract=require(_0x16f9('0xf'));var rimraf=require(_0x16f9('0x1'));var archiver=require(_0x16f9('0x10'));var Redis=require('ioredis');var authService=require(_0x16f9('0x11'));var qs=require(_0x16f9('0x12'));var as=require(_0x16f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16f9('0x14'))(_0x16f9('0x15'));var utils=require('../../config/utils');var config=require(_0x16f9('0x16'));var licenseUtil=require(_0x16f9('0x17'));var db=require('../../mysqldb')['db'];config[_0x16f9('0x18')]=_[_0x16f9('0x19')](config['redis'],{'host':_0x16f9('0x1a'),'port':0x18eb});var socket=require(_0x16f9('0x1b'))(new Redis(config['redis']));require(_0x16f9('0x1c'))[_0x16f9('0x1d')](socket);function respondWithStatusCode(_0x23b42b,_0x1c49d4){_0x1c49d4=_0x1c49d4||0xcc;return function(_0x52638d){if(_0x52638d){return _0x23b42b[_0x16f9('0x1e')](_0x1c49d4);}return _0x23b42b['status'](_0x1c49d4)['end']();};}function respondWithResult(_0x4024bb,_0x402634){_0x402634=_0x402634||0xc8;return function(_0xce3838){if(_0xce3838){return _0x4024bb[_0x16f9('0x1f')](_0x402634)[_0x16f9('0x20')](_0xce3838);}};}function respondWithFilteredResult(_0x1735d4,_0x4771ab){return function(_0x2c0d9b){if(_0x2c0d9b){var _0x48ecd5=typeof _0x4771ab[_0x16f9('0x21')]===_0x16f9('0x22')&&typeof _0x4771ab[_0x16f9('0x23')]===_0x16f9('0x22');var _0x16efd9=_0x2c0d9b['count'];var _0x3f85db=_0x48ecd5?0x0:_0x4771ab[_0x16f9('0x21')];var _0x5eff47=_0x48ecd5?_0x2c0d9b[_0x16f9('0x24')]:_0x4771ab[_0x16f9('0x21')]+_0x4771ab[_0x16f9('0x23')];var _0x5753c2;if(_0x5eff47>=_0x16efd9){_0x5eff47=_0x16efd9;_0x5753c2=0xc8;}else{_0x5753c2=0xce;}_0x1735d4[_0x16f9('0x1f')](_0x5753c2);return _0x1735d4[_0x16f9('0x25')]('Content-Range',_0x3f85db+'-'+_0x5eff47+'/'+_0x16efd9)[_0x16f9('0x20')](_0x2c0d9b);}return null;};}function patchUpdates(_0x34f220){return function(_0x1932dc){try{jsonpatch['apply'](_0x1932dc,_0x34f220,!![]);}catch(_0x38bc4a){return BPromise[_0x16f9('0x26')](_0x38bc4a);}return _0x1932dc['save']();};}function saveUpdates(_0x12704b,_0x49286d){return function(_0x8b09f){if(_0x8b09f){return _0x8b09f[_0x16f9('0x27')](_0x12704b)[_0x16f9('0x28')](function(_0x9ea0d7){return _0x9ea0d7;});}return null;};}function removeEntity(_0xa7c9fc,_0x26d629){return function(_0x159dde){if(_0x159dde){return _0x159dde[_0x16f9('0x29')]()[_0x16f9('0x28')](function(){var _0x3bb6e2=_0x159dde['get']({'plain':!![]});var _0x4c9bb9=_0x16f9('0x2a');return db[_0x16f9('0x2b')]['destroy']({'where':{'type':_0x4c9bb9,'resourceId':_0x3bb6e2['id']}})[_0x16f9('0x28')](function(){return _0x159dde;});})[_0x16f9('0x28')](function(){_0xa7c9fc[_0x16f9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ce0dc,_0x509053){return function(_0x252c5a){if(!_0x252c5a){_0x5ce0dc['sendStatus'](0x194);}return _0x252c5a;};}function handleError(_0x511694,_0x40bde1){_0x40bde1=_0x40bde1||0x1f4;return function(_0x5f433b){logger['error'](_0x5f433b['stack']);if(_0x5f433b[_0x16f9('0x2c')]){delete _0x5f433b[_0x16f9('0x2c')];}_0x511694[_0x16f9('0x1f')](_0x40bde1)[_0x16f9('0x2d')](_0x5f433b);};}exports[_0x16f9('0x2e')]=function(_0xec6d32,_0x299db2){var _0x54a58f={},_0x3b6eec={},_0x53f44f={'count':0x0,'rows':[]};var _0x493418=_[_0x16f9('0x2f')](db[_0x16f9('0x30')]['rawAttributes'],function(_0x276c6f){return{'name':_0x276c6f[_0x16f9('0x31')],'type':_0x276c6f[_0x16f9('0x32')][_0x16f9('0x33')]};});_0x3b6eec[_0x16f9('0x34')]=_['map'](_0x493418,'name');_0x3b6eec['query']=_['keys'](_0xec6d32[_0x16f9('0x35')]);_0x3b6eec['filters']=_[_0x16f9('0x36')](_0x3b6eec[_0x16f9('0x34')],_0x3b6eec[_0x16f9('0x35')]);_0x54a58f['attributes']=_[_0x16f9('0x36')](_0x3b6eec['model'],qs[_0x16f9('0x37')](_0xec6d32[_0x16f9('0x35')][_0x16f9('0x37')]));_0x54a58f['attributes']=_0x54a58f[_0x16f9('0x38')]['length']?_0x54a58f[_0x16f9('0x38')]:_0x3b6eec[_0x16f9('0x34')];if(!_0xec6d32[_0x16f9('0x35')][_0x16f9('0x39')]('nolimit')){_0x54a58f[_0x16f9('0x23')]=qs[_0x16f9('0x23')](_0xec6d32[_0x16f9('0x35')][_0x16f9('0x23')]);_0x54a58f[_0x16f9('0x21')]=qs[_0x16f9('0x21')](_0xec6d32[_0x16f9('0x35')][_0x16f9('0x21')]);}_0x54a58f['order']=qs[_0x16f9('0x3a')](_0xec6d32[_0x16f9('0x35')][_0x16f9('0x3a')]);_0x54a58f[_0x16f9('0x3b')]=qs[_0x16f9('0x3c')](_['pick'](_0xec6d32[_0x16f9('0x35')],_0x3b6eec['filters']),_0x493418);if(_0xec6d32[_0x16f9('0x35')][_0x16f9('0x3d')]){_0x54a58f[_0x16f9('0x3b')]=_['merge'](_0x54a58f[_0x16f9('0x3b')],{'$or':_[_0x16f9('0x2f')](_0x493418,function(_0x58e9bb){if(_0x58e9bb[_0x16f9('0x32')]!==_0x16f9('0x3e')){var _0x4123ee={};_0x4123ee[_0x58e9bb[_0x16f9('0x2c')]]={'$like':'%'+_0xec6d32[_0x16f9('0x35')][_0x16f9('0x3d')]+'%'};return _0x4123ee;}})});}_0x54a58f=_[_0x16f9('0x3f')]({},_0x54a58f,_0xec6d32[_0x16f9('0x40')]);var _0x342867={'where':_0x54a58f[_0x16f9('0x3b')]};return db[_0x16f9('0x30')][_0x16f9('0x24')](_0x342867)[_0x16f9('0x28')](function(_0x38f5ee){_0x53f44f[_0x16f9('0x24')]=_0x38f5ee;if(_0xec6d32['query']['includeAll']){_0x54a58f[_0x16f9('0x41')]=[{'all':!![]}];}return db[_0x16f9('0x30')][_0x16f9('0x42')](_0x54a58f);})[_0x16f9('0x28')](function(_0x70bdbd){_0x53f44f['rows']=_0x70bdbd;return _0x53f44f;})[_0x16f9('0x28')](respondWithFilteredResult(_0x299db2,_0x54a58f))[_0x16f9('0x43')](handleError(_0x299db2,null));};exports[_0x16f9('0x44')]=function(_0x1a9592,_0x17a0e5){var _0x493640={'raw':!![],'where':{'id':_0x1a9592[_0x16f9('0x45')]['id']}},_0x92e3a7={};_0x92e3a7[_0x16f9('0x34')]=_[_0x16f9('0x46')](db[_0x16f9('0x30')][_0x16f9('0x47')]);_0x92e3a7['query']=_[_0x16f9('0x46')](_0x1a9592[_0x16f9('0x35')]);_0x92e3a7[_0x16f9('0x3c')]=_[_0x16f9('0x36')](_0x92e3a7[_0x16f9('0x34')],_0x92e3a7[_0x16f9('0x35')]);_0x493640[_0x16f9('0x38')]=_[_0x16f9('0x36')](_0x92e3a7[_0x16f9('0x34')],qs[_0x16f9('0x37')](_0x1a9592[_0x16f9('0x35')][_0x16f9('0x37')]));_0x493640[_0x16f9('0x38')]=_0x493640[_0x16f9('0x38')][_0x16f9('0x48')]?_0x493640[_0x16f9('0x38')]:_0x92e3a7[_0x16f9('0x34')];if(_0x1a9592['query'][_0x16f9('0x49')]){_0x493640[_0x16f9('0x41')]=[{'all':!![]}];}_0x493640=_[_0x16f9('0x3f')]({},_0x493640,_0x1a9592[_0x16f9('0x40')]);return db[_0x16f9('0x30')]['find'](_0x493640)[_0x16f9('0x28')](handleEntityNotFound(_0x17a0e5,null))['then'](respondWithResult(_0x17a0e5,null))[_0x16f9('0x43')](handleError(_0x17a0e5,null));};exports['download']=function(_0x50c1dd,_0x369354,_0x1e710b){return db[_0x16f9('0x30')][_0x16f9('0x4a')]({'where':{'id':_0x50c1dd[_0x16f9('0x45')]['id']},'attributes':[_0x16f9('0x2c'),_0x16f9('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x369354,null))[_0x16f9('0x28')](function(_0x5d11b1){if(_0x5d11b1){var _0x4c5638=path['join'](config[_0x16f9('0x4c')],'server/files/plugins',util['format']('%s.zip',path[_0x16f9('0x4d')](_0x5d11b1[_0x16f9('0x4b')])));var _0x50a6ae=fs['createWriteStream'](_0x4c5638);var _0x16ba49=archiver('zip',{'zlib':{'level':0x9}});_0x16ba49['on'](_0x16f9('0x4e'),function(_0x1bd410){if(_0x1bd410['code']==='ENOENT'){logger[_0x16f9('0x4f')](_0x1bd410);}else{throw new db[(_0x16f9('0x50'))]['Error'](_0x16f9('0x51'));}});_0x16ba49['on'](_0x16f9('0x4f'),function(_0x4ac727){throw new db[(_0x16f9('0x50'))][(_0x16f9('0x52'))](_0x16f9('0x51'));});_0x16ba49[_0x16f9('0x53')](_0x50a6ae);_0x16ba49[_0x16f9('0x54')]('**/*',{'cwd':path[_0x16f9('0x55')](config[_0x16f9('0x4c')],'server/files/plugins',path[_0x16f9('0x56')](_0x5d11b1[_0x16f9('0x4b')])),'ignore':[path[_0x16f9('0x55')](path[_0x16f9('0x4d')](_0x5d11b1['path']),_0x16f9('0x57')),path['join'](path[_0x16f9('0x4d')](_0x5d11b1[_0x16f9('0x4b')]),_0x16f9('0x58'))],'nodir':!![]})['finalize']();_0x50a6ae['on'](_0x16f9('0x59'),function(){if(!fs['existsSync'](_0x4c5638)){throw new db['Sequelize'][(_0x16f9('0x52'))]('Plugin\x20not\x20found');}return _0x369354[_0x16f9('0x5a')](_0x4c5638,util[_0x16f9('0x5b')](_0x16f9('0x5c'),path['basename'](_0x5d11b1[_0x16f9('0x4b')])),function(_0x2584e0){if(_0x2584e0){throw new db['Sequelize'][(_0x16f9('0x52'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x16f9('0x5d')](_0x4c5638);logger[_0x16f9('0x5e')](_0x16f9('0x5f'));logger[_0x16f9('0x5e')](_0x16f9('0x60'));});});}return null;})[_0x16f9('0x43')](handleError(_0x369354,null));};exports[_0x16f9('0x61')]=function(_0x24c3e3,_0x1e18b1,_0x5670c7){var _0x5097ce=path[_0x16f9('0x4d')](_0x24c3e3['file'][_0x16f9('0x62')],path[_0x16f9('0x63')](_0x24c3e3[_0x16f9('0x64')][_0x16f9('0x62')]));var _0x58f738=path[_0x16f9('0x55')](config[_0x16f9('0x4c')],_0x16f9('0x65'),_0x24c3e3[_0x16f9('0x64')][_0x16f9('0x62')]);var _0x2d0941=path[_0x16f9('0x55')](config[_0x16f9('0x4c')],_0x16f9('0x65'),_0x5097ce);logger['info'](_0x16f9('0x66'),_0x58f738);logger['info'](_0x16f9('0x67'),_0x2d0941);try{fs[_0x16f9('0x68')](_0x58f738,parseInt(_0x16f9('0x69'),0x8));extract(_0x58f738,{'dir':_0x2d0941},function(_0x5cb38e){if(_0x5cb38e){logger[_0x16f9('0x4f')](_0x5cb38e);handleError(_0x5cb38e,!![]);};var _0x34331b=fs[_0x16f9('0x6a')](_0x2d0941);if(_0x34331b['length']>0x1){removeReferences(_0x58f738,_0x2d0941);logger['error'](_0x16f9('0x6b'));return _0x5670c7(new Error('Invalid\x20plugin\x20structure'));}var _0x3e9814=fs[_0x16f9('0x6c')](path[_0x16f9('0x55')](_0x2d0941,_0x34331b[0x0]));if(_0x3e9814[_0x16f9('0x6d')]()){removeReferences(_0x58f738,_0x2d0941);logger['error'](_0x16f9('0x6b'));return _0x5670c7(new Error(_0x16f9('0x6b')));}if(_0x3e9814[_0x16f9('0x6e')]()){var _0x516929=fs[_0x16f9('0x6a')](path[_0x16f9('0x55')](_0x2d0941,_0x34331b[0x0]));if(_0x516929['length']===0x0){removeReferences(_0x58f738,_0x2d0941);logger[_0x16f9('0x4f')](_0x16f9('0x6b'));return _0x5670c7(new Error(_0x16f9('0x6b')));}var _0xbf839c=_0x516929[_0x16f9('0x6f')](function(_0x44ea09){return _0x44ea09===_0x16f9('0x70');});if(!_0xbf839c){return _0x5670c7(new Error(_0x16f9('0x71')));}var _0x498f15=fs[_0x16f9('0x72')](path[_0x16f9('0x55')](_0x2d0941,_0x34331b[0x0],_0x16f9('0x70')));var _0x32f448=JSON['parse'](_0x498f15);if('undefined'==typeof _0x32f448[_0x16f9('0x2c')]){return _0x5670c7(new Error(_0x16f9('0x73')));}if(_0x16f9('0x22')==typeof _0x32f448['type']){return _0x5670c7(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x32f448[_0x16f9('0x74')]){return _0x5670c7(new Error(_0x16f9('0x75')));}if(_0x16f9('0x22')==typeof _0x32f448[_0x16f9('0x76')]){return _0x5670c7(new Error(_0x16f9('0x77')));}if(_0x32f448['type']===_0x16f9('0x78')){if(_0x16f9('0x22')==typeof _0x32f448['parameters'][_0x16f9('0x79')]){return _0x5670c7(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x16f9('0x22')==typeof _0x32f448['parameters'][_0x16f9('0x79')][_0x16f9('0x7a')]&&_0x16f9('0x22')==typeof _0x32f448[_0x16f9('0x76')][_0x16f9('0x79')]['agent']){return _0x5670c7(new Error(_0x16f9('0x7b')));}}else if(_0x32f448[_0x16f9('0x32')]==='script'){if('undefined'==typeof _0x32f448['parameters'][_0x16f9('0x7c')]){return _0x5670c7(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x32f448[_0x16f9('0x76')]['scriptPath']){return _0x5670c7(new Error(_0x16f9('0x7d')));}}else{return _0x5670c7(new Error(_0x16f9('0x7e')));}var _0x186f1f=_0x32f448[_0x16f9('0x2c')];var _0x1384d6=_0x32f448[_0x16f9('0x7f')];var _0x5d8cc1=_0x32f448[_0x16f9('0x32')];var _0x2e5029=_0x32f448['sidebar']?_0x32f448[_0x16f9('0x80')]:_0x16f9('0x81');var _0x49dc2d=_0x32f448['icon']?_0x32f448[_0x16f9('0x82')]:_0x16f9('0x83');var _0x4ca2ae='';var _0x34408d='';var _0x38f238='';var _0x395424='';var _0x1bf55f=_0x32f448['version'];if(_0x5d8cc1===_0x16f9('0x78')){if('undefined'!=typeof _0x32f448[_0x16f9('0x76')][_0x16f9('0x79')][_0x16f9('0x7a')]){var _0x482b14=_0x32f448[_0x16f9('0x76')]['views'][_0x16f9('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x16f9('0x84')](_0x482b14)){_0x4ca2ae=path[_0x16f9('0x55')](_0x16f9('0x85'),_0x5097ce,_0x34331b[0x0],_0x482b14);}else{_0x4ca2ae=_0x482b14;}}else{logger[_0x16f9('0x5e')](_0x16f9('0x86'));}if(_0x16f9('0x22')!=typeof _0x32f448['parameters'][_0x16f9('0x79')][_0x16f9('0x87')]){var _0x1bde1b=_0x32f448['parameters'][_0x16f9('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x16f9('0x84')](_0x1bde1b)){_0x34408d=path[_0x16f9('0x55')](_0x16f9('0x85'),_0x5097ce,_0x34331b[0x0],_0x1bde1b);}else{_0x34408d=_0x1bde1b;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5d8cc1==='script'){_0x38f238=_0x32f448[_0x16f9('0x76')][_0x16f9('0x7c')];_0x395424=_0x32f448[_0x16f9('0x76')][_0x16f9('0x88')];if(_0x16f9('0x22')!=typeof _0x32f448[_0x16f9('0x76')]['views']){if(_0x16f9('0x22')!=typeof _0x32f448[_0x16f9('0x76')][_0x16f9('0x79')][_0x16f9('0x7a')]){var _0x482b14=_0x32f448[_0x16f9('0x76')][_0x16f9('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x16f9('0x84')](_0x482b14)){_0x4ca2ae=path['join'](_0x16f9('0x85'),_0x5097ce,_0x34331b[0x0],_0x482b14);}else{_0x4ca2ae=_0x482b14;}}if(_0x16f9('0x22')!=typeof _0x32f448[_0x16f9('0x76')][_0x16f9('0x79')]['agent']){var _0x1bde1b=_0x32f448[_0x16f9('0x76')]['views'][_0x16f9('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1bde1b)){_0x34408d=path[_0x16f9('0x55')](_0x16f9('0x85'),_0x5097ce,_0x34331b[0x0],_0x1bde1b);}else{_0x34408d=_0x1bde1b;}}}}var _0x555564={'name':_0x186f1f,'description':_0x1384d6,'path':path['join'](_0x5097ce,_0x34331b[0x0]),'type':_0x5d8cc1,'sidebar':_0x2e5029,'icon':_0x49dc2d,'adminUrl':_0x4ca2ae,'agentUrl':_0x34408d,'scriptName':_0x38f238,'scriptPath':_0x395424,'version':_0x1bf55f};removeReferences(_0x58f738,null);return db[_0x16f9('0x30')]['create'](_0x555564)[_0x16f9('0x28')](function(_0x35c4a0){var _0x35571d={'role':_0x24c3e3[_0x16f9('0x89')]['role'],'userProfileId':_0x24c3e3[_0x16f9('0x89')][_0x16f9('0x8a')]};if(!_0x35571d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35571d[_0x16f9('0x8b')]===_0x16f9('0x8c')){var _0x289cd4=_0x35c4a0[_0x16f9('0x8d')]({'plain':!![]});return db[_0x16f9('0x8e')][_0x16f9('0x4a')]({'where':{'name':_0x16f9('0x2a'),'userProfileId':_0x35571d[_0x16f9('0x8a')]},'raw':!![]})[_0x16f9('0x28')](function(_0x4db9a4){if(_0x4db9a4&&_0x4db9a4['autoAssociation']===0x0){return db[_0x16f9('0x2b')][_0x16f9('0x8f')]({'name':_0x289cd4[_0x16f9('0x2c')],'resourceId':_0x289cd4['id'],'type':_0x4db9a4[_0x16f9('0x2c')],'sectionId':_0x4db9a4['id']},{})[_0x16f9('0x28')](function(){return _0x35c4a0;});}else{return _0x35c4a0;}})['catch'](function(_0x367b7f){logger['error'](_0x16f9('0x90'),_0x367b7f);throw _0x367b7f;});}return _0x35c4a0;})[_0x16f9('0x28')](respondWithResult(_0x1e18b1,null))[_0x16f9('0x43')](handleError(_0x1e18b1,null));}});}catch(_0x5134c7){_0x1e18b1[_0x16f9('0x1f')](0x1f4)[_0x16f9('0x2d')](_0x5134c7);}};function removeReferences(_0x8afe55,_0x570c43){try{if(_0x8afe55){fs[_0x16f9('0x5d')](_0x8afe55);logger[_0x16f9('0x5e')](_0x16f9('0x91'));}if(_0x570c43){rimraf(_0x570c43,function(){});logger['info'](_0x16f9('0x92'));}}catch(_0x156a54){logger[_0x16f9('0x4f')](_0x156a54);}}exports['update']=function(_0xea4e39,_0x495d36,_0x2b8e5c){return db[_0x16f9('0x30')][_0x16f9('0x4a')]({'where':{'id':_0xea4e39['params']['id']}})['then'](handleEntityNotFound(_0x495d36,null))[_0x16f9('0x28')](saveUpdates(_0xea4e39[_0x16f9('0x89')],null))[_0x16f9('0x28')](respondWithResult(_0x495d36,null))['catch'](handleError(_0x495d36,null));};exports['delete']=function(_0x280405,_0xb8aca2,_0x1bead6){return db[_0x16f9('0x30')][_0x16f9('0x4a')]({'where':{'id':_0x280405[_0x16f9('0x45')]['id']}})['then'](function(_0x3b4d99){if(_0x3b4d99){return _0x3b4d99[_0x16f9('0x29')]();}})[_0x16f9('0x28')](function(_0x2c92b1){rimraf(path['join'](config[_0x16f9('0x4c')],_0x16f9('0x65'),path['dirname'](_0x2c92b1['path'])),function(){});return _0x2c92b1;})[_0x16f9('0x28')](handleEntityNotFound(_0xb8aca2,null))[_0x16f9('0x28')](respondWithStatusCode(_0xb8aca2,null))[_0x16f9('0x43')](handleError(_0xb8aca2,null));};exports[_0x16f9('0x93')]=function(_0x30be6a,_0x4ef0e2,_0x5c781b){return BPromise[_0x16f9('0x94')]()[_0x16f9('0x28')](function(){if(!_0x30be6a['query']['path']){throw new Error(_0x16f9('0x95'));}if(!_0x30be6a[_0x16f9('0x35')][_0x16f9('0x96')]){throw new Error(_0x16f9('0x97'));}var _0x1e9f73=_0x30be6a['query'][_0x16f9('0x98')]?_0x30be6a[_0x16f9('0x35')][_0x16f9('0x98')]+':'+_0x30be6a[_0x16f9('0x35')]['port']:'http://localhost:'+_0x30be6a[_0x16f9('0x35')]['port'];var _0x360dff=_0x30be6a['query'][_0x16f9('0x20')]?_0x30be6a[_0x16f9('0x35')][_0x16f9('0x20')]:!![];var _0x483f0d=_0x30be6a[_0x16f9('0x35')][_0x16f9('0x99')]?_0x30be6a[_0x16f9('0x35')][_0x16f9('0x99')]:null;var _0x2c1707={'method':_0x30be6a[_0x16f9('0x9a')],'uri':util[_0x16f9('0x5b')](_0x16f9('0x9b'),_0x1e9f73,_0x30be6a[_0x16f9('0x35')]['path']),'json':_0x360dff,'resolveWithFullResponse':!![],'encoding':_0x483f0d,'qs':_0x30be6a[_0x16f9('0x35')]};if(_0x30be6a[_0x16f9('0x9c')]){_0x2c1707[_0x16f9('0x9c')]=_0x30be6a[_0x16f9('0x9c')];if(_0x2c1707[_0x16f9('0x9c')][_0x16f9('0x9d')]){delete _0x2c1707[_0x16f9('0x9c')][_0x16f9('0x9d')];}}if(_0x2c1707[_0x16f9('0x9c')][_0x16f9('0x9e')]){delete _0x2c1707[_0x16f9('0x9c')][_0x16f9('0x9e')];}return rp(_0x2c1707);})['then'](function(_0x37bb2f){if(_0x37bb2f){_0x4ef0e2[_0x16f9('0x25')](_0x37bb2f[_0x16f9('0x9c')]);logger[_0x16f9('0x5e')](_0x37bb2f['body']);if(_[_0x16f9('0x9f')](_0x30be6a[_0x16f9('0x35')][_0x16f9('0x4b')],_0x16f9('0x5a'))&&_0x37bb2f[_0x16f9('0xa0')]==0x1f4){return _0x4ef0e2['sendStatus'](_0x37bb2f[_0x16f9('0xa0')]);}else{return _0x4ef0e2[_0x16f9('0x1f')](_0x37bb2f[_0x16f9('0xa0')])[_0x16f9('0x2d')](_0x37bb2f[_0x16f9('0x89')]);}}else{return _0x4ef0e2[_0x16f9('0x1e')](0xc8);}})[_0x16f9('0x43')](handleError(_0x4ef0e2,null));};exports[_0x16f9('0xa1')]=function(_0x371269,_0x7865ee,_0x544d56){return BPromise[_0x16f9('0x94')]()[_0x16f9('0x28')](function(){if(!_0x371269[_0x16f9('0x35')][_0x16f9('0x4b')]){throw new Error(_0x16f9('0x95'));}if(!_0x371269['query'][_0x16f9('0x96')]){throw new Error(_0x16f9('0x97'));}var _0x4e1975=_0x371269[_0x16f9('0x35')]['hostname']?_0x371269[_0x16f9('0x35')][_0x16f9('0x98')]+':'+_0x371269['query']['port']:'http://localhost:'+_0x371269['query'][_0x16f9('0x96')];var _0x50e666=_0x371269[_0x16f9('0x35')]['json']?_0x371269[_0x16f9('0x35')][_0x16f9('0x20')]:!![];var _0x50e88c=_0x371269[_0x16f9('0x35')]['encoding']?_0x371269[_0x16f9('0x35')]['encoding']:null;var _0x237a3f={'method':_0x371269[_0x16f9('0x9a')],'uri':util['format'](_0x16f9('0x9b'),_0x4e1975,_0x371269['query'][_0x16f9('0x4b')]),'json':_0x50e666,'resolveWithFullResponse':!![],'encoding':_0x50e88c,'body':_0x371269['body']};if(_0x371269['headers']){_0x237a3f[_0x16f9('0x9c')]=_0x371269[_0x16f9('0x9c')];if(_0x237a3f[_0x16f9('0x9c')][_0x16f9('0x9d')]){delete _0x237a3f[_0x16f9('0x9c')][_0x16f9('0x9d')];}}if(_0x237a3f['headers'][_0x16f9('0x9e')]){delete _0x237a3f[_0x16f9('0x9c')][_0x16f9('0x9e')];}return rp(_0x237a3f);})['then'](function(_0x10f833){if(_0x10f833){_0x7865ee[_0x16f9('0x25')](_0x10f833['headers']);logger[_0x16f9('0x5e')](_0x10f833[_0x16f9('0x89')]);return _0x7865ee['status'](_0x10f833[_0x16f9('0xa0')])[_0x16f9('0x2d')](_0x10f833['body']);}else{return _0x7865ee['sendStatus'](0xc8);}})[_0x16f9('0x43')](handleError(_0x7865ee,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 17d2e61..1ef224f 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 _0x979e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update'];(function(_0x529a2d,_0xc0dc7){var _0x388e94=function(_0x54b87f){while(--_0x54b87f){_0x529a2d['push'](_0x529a2d['shift']());}};_0x388e94(++_0xc0dc7);}(_0x979e,0x195));var _0xe979=function(_0x533da3,_0x24b542){_0x533da3=_0x533da3-0x0;var _0x18354d=_0x979e[_0x533da3];return _0x18354d;};'use strict';var EventEmitter=require(_0xe979('0x0'));var Plugin=require(_0xe979('0x1'))['db'][_0xe979('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe979('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe979('0x4'),'afterDestroy':_0xe979('0x5')};function emitEvent(_0x386036){return function(_0x3b4b06,_0x2d62dd,_0x5afb7f){PluginEvents[_0xe979('0x6')](_0x386036+':'+_0x3b4b06['id'],_0x3b4b06);PluginEvents['emit'](_0x386036,_0x3b4b06);_0x5afb7f(null);};}for(var e in events){if(events[_0xe979('0x7')](e)){var event=events[e];Plugin[_0xe979('0x8')](e,emitEvent(event));}}module[_0xe979('0x9')]=PluginEvents; \ No newline at end of file +var _0xcbd3=['save','update','remove','emit','hook','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x4ac2ff,_0x51838d){var _0x463521=function(_0x246f23){while(--_0x246f23){_0x4ac2ff['push'](_0x4ac2ff['shift']());}};_0x463521(++_0x51838d);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x1134b9,_0x1a0e66){_0x1134b9=_0x1134b9-0x0;var _0x59ed49=_0xcbd3[_0x1134b9];return _0x59ed49;};'use strict';var EventEmitter=require(_0x3cbd('0x0'));var Plugin=require(_0x3cbd('0x1'))['db'][_0x3cbd('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3cbd('0x3')](0x0);var events={'afterCreate':_0x3cbd('0x4'),'afterUpdate':_0x3cbd('0x5'),'afterDestroy':_0x3cbd('0x6')};function emitEvent(_0x3c40e5){return function(_0x2f4854,_0x32a914,_0x5484ce){PluginEvents[_0x3cbd('0x7')](_0x3c40e5+':'+_0x2f4854['id'],_0x2f4854);PluginEvents[_0x3cbd('0x7')](_0x3c40e5,_0x2f4854);_0x5484ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x3cbd('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4368241..9875449 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 _0x13f6=['plugins','util','api','moment','path','rimraf'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x13f6,0xaf));var _0x613f=function(_0xa6ff4,_0x19bc12){_0xa6ff4=_0xa6ff4-0x0;var _0x6affe6=_0x13f6[_0xa6ff4];return _0x6affe6;};'use strict';var _=require('lodash');var util=require(_0x613f('0x0'));var logger=require('../../config/logger')(_0x613f('0x1'));var moment=require(_0x613f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x613f('0x3'));var rimraf=require(_0x613f('0x4'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x48618b,_0x389d76){return _0x48618b['define']('Plugin',attributes,{'tableName':_0x613f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d8d=['path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird'];(function(_0x412b93,_0x2cc773){var _0x5b984c=function(_0x1b8ad9){while(--_0x1b8ad9){_0x412b93['push'](_0x412b93['shift']());}};_0x5b984c(++_0x2cc773);}(_0x1d8d,0x1e7));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1d8('0x0'));var util=require('util');var logger=require(_0xd1d8('0x1'))(_0xd1d8('0x2'));var moment=require(_0xd1d8('0x3'));var BPromise=require(_0xd1d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1d8('0x5'));var rimraf=require('rimraf');var config=require(_0xd1d8('0x6'));var attributes=require(_0xd1d8('0x7'));module[_0xd1d8('0x8')]=function(_0x4e5ce3,_0x3402cd){return _0x4e5ce3[_0xd1d8('0x9')](_0xd1d8('0xa'),attributes,{'tableName':_0xd1d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 9d8ab30..6f238f0 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 _0x97bb=['client','http','defaults','redis','./plugin.socket','request','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','create','body','options','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x17bfbe,_0x83257f){var _0x3666e2=function(_0x41fb6b){while(--_0x41fb6b){_0x17bfbe['push'](_0x17bfbe['shift']());}};_0x3666e2(++_0x83257f);}(_0x97bb,0x1c2));var _0xb97b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x97bb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb97b('0x0'));var util=require(_0xb97b('0x1'));var moment=require(_0xb97b('0x2'));var BPromise=require(_0xb97b('0x3'));var rs=require(_0xb97b('0x4'));var fs=require('fs');var Redis=require(_0xb97b('0x5'));var db=require(_0xb97b('0x6'))['db'];var utils=require(_0xb97b('0x7'));var logger=require(_0xb97b('0x8'))(_0xb97b('0x9'));var config=require(_0xb97b('0xa'));var jayson=require(_0xb97b('0xb'));var client=jayson[_0xb97b('0xc')][_0xb97b('0xd')]({'port':0x232a});config['redis']=_[_0xb97b('0xe')](config[_0xb97b('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb97b('0xf')]));require(_0xb97b('0x10'))['register'](socket);function respondWithRpcPromise(_0x124c42,_0x31e692,_0x4be741){return new BPromise(function(_0x307e41,_0x4611e4){return client[_0xb97b('0x11')](_0x124c42,_0x4be741)['then'](function(_0x2d84c9){logger['info'](_0xb97b('0x12'),_0x31e692,'request\x20sent');logger[_0xb97b('0x13')](_0xb97b('0x14'),_0x31e692,_0xb97b('0x15'),JSON[_0xb97b('0x16')](_0x2d84c9));if(_0x2d84c9['error']){if(_0x2d84c9[_0xb97b('0x17')][_0xb97b('0x18')]===0x1f4){logger[_0xb97b('0x17')](_0xb97b('0x12'),_0x31e692,_0x2d84c9['error'][_0xb97b('0x19')]);return _0x4611e4(_0x2d84c9['error'][_0xb97b('0x19')]);}logger[_0xb97b('0x17')](_0xb97b('0x12'),_0x31e692,_0x2d84c9[_0xb97b('0x17')][_0xb97b('0x19')]);return _0x307e41(_0x2d84c9[_0xb97b('0x17')][_0xb97b('0x19')]);}else{logger[_0xb97b('0x1a')](_0xb97b('0x12'),_0x31e692,'request\x20sent');_0x307e41(_0x2d84c9[_0xb97b('0x1b')][_0xb97b('0x19')]);}})[_0xb97b('0x1c')](function(_0x71ed08){logger[_0xb97b('0x17')](_0xb97b('0x12'),_0x31e692,_0x71ed08);_0x4611e4(_0x71ed08);});});}exports['CreatePlugin']=function(_0x1900ab){var _0x2756f0=this;return new Promise(function(_0x44946f,_0x21dcf6){return db['Plugin'][_0xb97b('0x1d')](_0x1900ab[_0xb97b('0x1e')],{'raw':_0x1900ab['options']?_0x1900ab[_0xb97b('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5871fe){logger['info'](_0xb97b('0x20'),_0x1900ab);logger[_0xb97b('0x13')](_0xb97b('0x20'),_0x1900ab,JSON[_0xb97b('0x16')](_0x5871fe));_0x44946f(_0x5871fe);})[_0xb97b('0x1c')](function(_0x54d8b3){logger[_0xb97b('0x17')]('CreatePlugin',_0x54d8b3[_0xb97b('0x19')],_0x1900ab);_0x21dcf6(_0x2756f0[_0xb97b('0x17')](0x1f4,_0x54d8b3[_0xb97b('0x19')]));});});}; \ No newline at end of file +var _0x3353=['./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x516d26,_0x43b1b1){var _0x2f2da2=function(_0xdeee91){while(--_0xdeee91){_0x516d26['push'](_0x516d26['shift']());}};_0x2f2da2(++_0x43b1b1);}(_0x3353,0x1ef));var _0x3335=function(_0x3d9290,_0x14602a){_0x3d9290=_0x3d9290-0x0;var _0x32ca9f=_0x3353[_0x3d9290];return _0x32ca9f;};'use strict';var _=require('lodash');var util=require(_0x3335('0x0'));var moment=require(_0x3335('0x1'));var BPromise=require('bluebird');var rs=require(_0x3335('0x2'));var fs=require('fs');var Redis=require(_0x3335('0x3'));var db=require(_0x3335('0x4'))['db'];var utils=require(_0x3335('0x5'));var logger=require(_0x3335('0x6'))(_0x3335('0x7'));var config=require(_0x3335('0x8'));var jayson=require(_0x3335('0x9'));var client=jayson[_0x3335('0xa')][_0x3335('0xb')]({'port':0x232a});config[_0x3335('0xc')]=_[_0x3335('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3335('0xe'))(new Redis(config[_0x3335('0xc')]));require(_0x3335('0xf'))[_0x3335('0x10')](socket);function respondWithRpcPromise(_0x337d98,_0x1afd05,_0x4d9420){return new BPromise(function(_0x2c1441,_0x946456){return client['request'](_0x337d98,_0x4d9420)[_0x3335('0x11')](function(_0x494ae7){logger[_0x3335('0x12')](_0x3335('0x13'),_0x1afd05,_0x3335('0x14'));logger[_0x3335('0x15')](_0x3335('0x16'),_0x1afd05,_0x3335('0x14'),JSON[_0x3335('0x17')](_0x494ae7));if(_0x494ae7['error']){if(_0x494ae7[_0x3335('0x18')][_0x3335('0x19')]===0x1f4){logger['error'](_0x3335('0x13'),_0x1afd05,_0x494ae7[_0x3335('0x18')][_0x3335('0x1a')]);return _0x946456(_0x494ae7['error'][_0x3335('0x1a')]);}logger[_0x3335('0x18')](_0x3335('0x13'),_0x1afd05,_0x494ae7[_0x3335('0x18')][_0x3335('0x1a')]);return _0x2c1441(_0x494ae7[_0x3335('0x18')][_0x3335('0x1a')]);}else{logger['info'](_0x3335('0x13'),_0x1afd05,_0x3335('0x14'));_0x2c1441(_0x494ae7[_0x3335('0x1b')][_0x3335('0x1a')]);}})[_0x3335('0x1c')](function(_0x5e4c72){logger[_0x3335('0x18')](_0x3335('0x13'),_0x1afd05,_0x5e4c72);_0x946456(_0x5e4c72);});});}exports[_0x3335('0x1d')]=function(_0xc491e6){var _0x55ef42=this;return new Promise(function(_0xcdb437,_0xb08d00){return db[_0x3335('0x1e')][_0x3335('0x1f')](_0xc491e6[_0x3335('0x20')],{'raw':_0xc491e6[_0x3335('0x21')]?_0xc491e6[_0x3335('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x3335('0x11')](function(_0x2fc85b){logger['info'](_0x3335('0x1d'),_0xc491e6);logger['debug'](_0x3335('0x1d'),_0xc491e6,JSON['stringify'](_0x2fc85b));_0xcdb437(_0x2fc85b);})[_0x3335('0x1c')](function(_0x2d17eb){logger[_0x3335('0x18')](_0x3335('0x1d'),_0x2d17eb['message'],_0xc491e6);_0xb08d00(_0x55ef42[_0x3335('0x18')](0x1f4,_0x2d17eb['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0846611..1066c28 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 _0x34af=['plugin:','save','remove','update','emit','removeListener','register','length'];(function(_0x36f37b,_0x36ea03){var _0x249634=function(_0x1cde21){while(--_0x1cde21){_0x36f37b['push'](_0x36f37b['shift']());}};_0x249634(++_0x36ea03);}(_0x34af,0x111));var _0xf34a=function(_0x152f25,_0x4d21d4){_0x152f25=_0x152f25-0x0;var _0x49d957=_0x34af[_0x152f25];return _0x49d957;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xf34a('0x0'),_0xf34a('0x1'),_0xf34a('0x2')];function createListener(_0x427c41,_0x4164de){return function(_0x4e0072){_0x4164de[_0xf34a('0x3')](_0x427c41,_0x4e0072);};}function removeListener(_0x90db31,_0x109903){return function(){PluginEvents[_0xf34a('0x4')](_0x90db31,_0x109903);};}exports[_0xf34a('0x5')]=function(_0x5ab794){for(var _0x3ae062=0x0,_0x5dc980=events[_0xf34a('0x6')];_0x3ae062<_0x5dc980;_0x3ae062++){var _0x155a70=events[_0x3ae062];var _0x5c3486=createListener(_0xf34a('0x7')+_0x155a70,_0x5ab794);PluginEvents['on'](_0x155a70,_0x5c3486);}}; \ No newline at end of file +var _0x8cef=['./plugin.events','remove','update','emit','length','plugin:'];(function(_0x7e6fd4,_0x1368b5){var _0x4b7c2f=function(_0x20a152){while(--_0x20a152){_0x7e6fd4['push'](_0x7e6fd4['shift']());}};_0x4b7c2f(++_0x1368b5);}(_0x8cef,0x14a));var _0xf8ce=function(_0x1d2fb6,_0x1ccb03){_0x1d2fb6=_0x1d2fb6-0x0;var _0x22d8a7=_0x8cef[_0x1d2fb6];return _0x22d8a7;};'use strict';var PluginEvents=require(_0xf8ce('0x0'));var events=['save',_0xf8ce('0x1'),_0xf8ce('0x2')];function createListener(_0x4962ba,_0x5bd31e){return function(_0x149002){_0x5bd31e[_0xf8ce('0x3')](_0x4962ba,_0x149002);};}function removeListener(_0x30168d,_0x484418){return function(){PluginEvents['removeListener'](_0x30168d,_0x484418);};}exports['register']=function(_0x1f52b2){for(var _0x40de30=0x0,_0x474be4=events[_0xf8ce('0x4')];_0x40de30<_0x474be4;_0x40de30++){var _0x253303=events[_0x40de30];var _0x4c9ed1=createListener(_0xf8ce('0x5')+_0x253303,_0x1f52b2);PluginEvents['on'](_0x253303,_0x4c9ed1);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 90e5472..de34614 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(_0x174d5f,_0xbc80c3){var _0x6b2305=function(_0x40e5f6){while(--_0x40e5f6){_0x174d5f['push'](_0x174d5f['shift']());}};_0x6b2305(++_0xbc80c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x46db0d,_0x283fae){var _0x4a8c25=function(_0x55481b){while(--_0x55481b){_0x46db0d['push'](_0x46db0d['shift']());}};_0x4a8c25(++_0x283fae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 ddd9b50..861c935 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 _0xe5b5=['../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','then','reject','motion2','length','show','describe','catch','body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x513ee5,_0x4bcd35){var _0x293713=function(_0x1610b8){while(--_0x1610b8){_0x513ee5['push'](_0x513ee5['shift']());}};_0x293713(++_0x4bcd35);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0xe5b5[_0x2e76a7];return _0x454cde;};'use strict';var _=require(_0x5e5b('0x0'));var pm2=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var path=require(_0x5e5b('0x4'));var exec=require(_0x5e5b('0x5'))[_0x5e5b('0x6')];var BPromise=require(_0x5e5b('0x7'));function handleEntityNotFound(_0xf20c6a,_0x20a50c){return function(_0xdc6616){if(!_0xdc6616){_0xf20c6a[_0x5e5b('0x8')](0x194);;}return _0xdc6616;};}function respondWithResult(_0xf1fbe2,_0x11e0e0){_0x11e0e0=_0x11e0e0||0xc8;return function(_0x545eb3){if(_0x545eb3){return _0xf1fbe2[_0x5e5b('0x9')](_0x11e0e0)[_0x5e5b('0xa')](_0x545eb3);}return null;};}function handleError(_0xcbd478,_0x258414){_0x258414=_0x258414||0x1f4;return function(_0xb9d72b){logger[_0x5e5b('0xb')](_0xb9d72b[_0x5e5b('0xc')]);if(_0xb9d72b[_0x5e5b('0xd')]){delete _0xb9d72b['name'];}_0xcbd478[_0x5e5b('0x9')](_0x258414)['send'](_0xb9d72b);};}function execChildProcess(){return new BPromise(function(_0x108c34,_0x58185){exec(_0x5e5b('0xe'),function(_0x3f64b6,_0x55c974,_0x4a1424){logger['info'](_0x55c974);logger[_0x5e5b('0xf')](_0x4a1424);if(_0x3f64b6){logger[_0x5e5b('0xb')](_0x3f64b6);return _0x58185(_0x3f64b6);}return _0x108c34(_0x55c974);});});}exports[_0x5e5b('0x10')]=function(_0x1694ff,_0x13a01e){return pm2[_0x5e5b('0x11')]()[_0x5e5b('0x12')](function(_0x49edd0){if(_0x49edd0){var _0x2b37fa=_[_0x5e5b('0x13')](_0x49edd0,function(_0x4ff37b){return _0x4ff37b[_0x5e5b('0xd')]==='express'||_0x4ff37b['name']===_0x5e5b('0x14');});return{'rows':_0x2b37fa,'count':_0x2b37fa[_0x5e5b('0x15')]};}return null;})[_0x5e5b('0x12')](respondWithResult(_0x13a01e,null))['catch'](handleError(_0x13a01e,null));};exports[_0x5e5b('0x16')]=function(_0x4d490c,_0x1796af){return pm2[_0x5e5b('0x17')](_0x4d490c['params']['id'])[_0x5e5b('0x12')](respondWithResult(_0x1796af,null))[_0x5e5b('0x12')](handleEntityNotFound(_0x1796af,null))[_0x5e5b('0x18')](handleError(_0x1796af,null));};exports['create']=function(_0x2bf0b7,_0x3f1103){if(_0x2bf0b7['body'][_0x5e5b('0xd')]&&_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]){var _0x2d8252=path[_0x5e5b('0x1b')](__dirname,_0x5e5b('0x1c'),_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]);var _0x4a78e3=process['cwd']();process[_0x5e5b('0x1d')](path[_0x5e5b('0x1e')](_0x2d8252));return execChildProcess()[_0x5e5b('0x12')](function(_0xe1c268){process[_0x5e5b('0x1d')](_0x4a78e3);return pm2[_0x5e5b('0x1f')]({'name':_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0xd')],'script':_0x2d8252});})[_0x5e5b('0x12')](function(_0x26bc02){pm2[_0x5e5b('0x20')]();return _0x26bc02[0x0];})['then'](respondWithResult(_0x3f1103,0xc9))[_0x5e5b('0x18')](handleError(_0x3f1103,null));}else{return _0x3f1103[_0x5e5b('0x9')](0x1f4)[_0x5e5b('0x21')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5e5b('0x22')]=function(_0xdb2863,_0x5ee866){if(_0xdb2863[_0x5e5b('0x19')]['id']){delete _0xdb2863[_0x5e5b('0x19')]['id'];}var _0x39ce16={'online':_0x5e5b('0x23'),'stopped':_0x5e5b('0x24')};if(_0x39ce16[_0x5e5b('0x25')](_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')])){return pm2[_0x39ce16[_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')]]](_0xdb2863[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](respondWithResult(_0x5ee866,0xc8))['catch'](handleError(_0x5ee866,null));}else{return _0x5ee866['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x27')});}};exports[_0x5e5b('0x28')]=function(_0x3dcdab,_0x12f1ee){if(_0x3dcdab['body']['id']){delete _0x3dcdab[_0x5e5b('0x19')]['id'];}if(_0x3dcdab['params']['id']){return pm2[_0x5e5b('0x29')](_0x3dcdab[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](function(_0xc2bc09){pm2['dump']();return _0xc2bc09[0x0];})[_0x5e5b('0x12')](respondWithResult(_0x12f1ee,null))[_0x5e5b('0x18')](handleError(_0x12f1ee,null));}else{return _0x12f1ee['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x2a')});}}; \ No newline at end of file +var _0xd8b0=['info','index','list','then','reject','express','motion2','length','show','describe','params','catch','body','script','join','dirname','chdir','start','update','restart','hasOwnProperty','Unknown\x20status','destroy','dump','Unknown\x20id','lodash','../../config/pm2','child_process','exec','bluebird','json','error','stack','name','status','send','npm\x20install'];(function(_0x4cfd0f,_0x1eb109){var _0x42aaf0=function(_0x3bdfee){while(--_0x3bdfee){_0x4cfd0f['push'](_0x4cfd0f['shift']());}};_0x42aaf0(++_0x1eb109);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var pm2=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0x0d8b('0x2'))[_0x0d8b('0x3')];var BPromise=require(_0x0d8b('0x4'));function handleEntityNotFound(_0x364286,_0x8196ed){return function(_0x577834){if(!_0x577834){_0x364286['sendStatus'](0x194);;}return _0x577834;};}function respondWithResult(_0x3f8b6f,_0x227c63){_0x227c63=_0x227c63||0xc8;return function(_0x39f43a){if(_0x39f43a){return _0x3f8b6f['status'](_0x227c63)[_0x0d8b('0x5')](_0x39f43a);}return null;};}function handleError(_0x284169,_0x58e4e2){_0x58e4e2=_0x58e4e2||0x1f4;return function(_0x129310){logger[_0x0d8b('0x6')](_0x129310[_0x0d8b('0x7')]);if(_0x129310[_0x0d8b('0x8')]){delete _0x129310[_0x0d8b('0x8')];}_0x284169[_0x0d8b('0x9')](_0x58e4e2)[_0x0d8b('0xa')](_0x129310);};}function execChildProcess(){return new BPromise(function(_0x28f87c,_0x48fa16){exec(_0x0d8b('0xb'),function(_0x4e0269,_0x4225c4,_0xc574a3){logger[_0x0d8b('0xc')](_0x4225c4);logger[_0x0d8b('0xc')](_0xc574a3);if(_0x4e0269){logger[_0x0d8b('0x6')](_0x4e0269);return _0x48fa16(_0x4e0269);}return _0x28f87c(_0x4225c4);});});}exports[_0x0d8b('0xd')]=function(_0x15dd0f,_0x31a8cc){return pm2[_0x0d8b('0xe')]()[_0x0d8b('0xf')](function(_0x5ad086){if(_0x5ad086){var _0xe65334=_[_0x0d8b('0x10')](_0x5ad086,function(_0x2d4e1c){return _0x2d4e1c['name']===_0x0d8b('0x11')||_0x2d4e1c[_0x0d8b('0x8')]===_0x0d8b('0x12');});return{'rows':_0xe65334,'count':_0xe65334[_0x0d8b('0x13')]};}return null;})[_0x0d8b('0xf')](respondWithResult(_0x31a8cc,null))['catch'](handleError(_0x31a8cc,null));};exports[_0x0d8b('0x14')]=function(_0x4586c2,_0x2fd0fc){return pm2[_0x0d8b('0x15')](_0x4586c2[_0x0d8b('0x16')]['id'])[_0x0d8b('0xf')](respondWithResult(_0x2fd0fc,null))[_0x0d8b('0xf')](handleEntityNotFound(_0x2fd0fc,null))[_0x0d8b('0x17')](handleError(_0x2fd0fc,null));};exports['create']=function(_0x27512e,_0x23d58f){if(_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x8')]&&_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x19')]){var _0x393beb=path[_0x0d8b('0x1a')](__dirname,'../../files/plugins',_0x27512e['body'][_0x0d8b('0x19')]);var _0x54a9a7=process['cwd']();process['chdir'](path[_0x0d8b('0x1b')](_0x393beb));return execChildProcess()[_0x0d8b('0xf')](function(_0x214778){process[_0x0d8b('0x1c')](_0x54a9a7);return pm2[_0x0d8b('0x1d')]({'name':_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x8')],'script':_0x393beb});})[_0x0d8b('0xf')](function(_0x27b695){pm2['dump']();return _0x27b695[0x0];})[_0x0d8b('0xf')](respondWithResult(_0x23d58f,0xc9))[_0x0d8b('0x17')](handleError(_0x23d58f,null));}else{return _0x23d58f['status'](0x1f4)[_0x0d8b('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x0d8b('0x1e')]=function(_0x234bdd,_0xa2af02){if(_0x234bdd['body']['id']){delete _0x234bdd['body']['id'];}var _0x28f639={'online':_0x0d8b('0x1f'),'stopped':'stop'};if(_0x28f639[_0x0d8b('0x20')](_0x234bdd['body'][_0x0d8b('0x9')])){return pm2[_0x28f639[_0x234bdd['body'][_0x0d8b('0x9')]]](_0x234bdd['params']['id'])[_0x0d8b('0xf')](respondWithResult(_0xa2af02,0xc8))['catch'](handleError(_0xa2af02,null));}else{return _0xa2af02[_0x0d8b('0x9')](0x1f4)['send']({'message':_0x0d8b('0x21')});}};exports[_0x0d8b('0x22')]=function(_0x2c058d,_0x56120a){if(_0x2c058d['body']['id']){delete _0x2c058d['body']['id'];}if(_0x2c058d[_0x0d8b('0x16')]['id']){return pm2['delete'](_0x2c058d[_0x0d8b('0x16')]['id'])['then'](function(_0x5d05fc){pm2[_0x0d8b('0x23')]();return _0x5d05fc[0x0];})[_0x0d8b('0xf')](respondWithResult(_0x56120a,null))[_0x0d8b('0x17')](handleError(_0x56120a,null));}else{return _0x56120a[_0x0d8b('0x9')](0x1f4)[_0x0d8b('0xa')]({'message':_0x0d8b('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 43cfa21..cdca47d 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 _0x7354=['./realtime.controller','isAuthenticated','getAgents','get','/queues','getQueues','exports','express','../../components/auth/service'];(function(_0x3e23f6,_0x5e2c5d){var _0x461c10=function(_0xa5ca53){while(--_0xa5ca53){_0x3e23f6['push'](_0x3e23f6['shift']());}};_0x461c10(++_0x5e2c5d);}(_0x7354,0x15d));var _0x4735=function(_0x204c59,_0x5614ee){_0x204c59=_0x204c59-0x0;var _0x4cd35b=_0x7354[_0x204c59];return _0x4cd35b;};'use strict';var express=require(_0x4735('0x0'));var router=express['Router']();var auth=require(_0x4735('0x1'));var controller=require(_0x4735('0x2'));router['get']('/agents',auth[_0x4735('0x3')](),controller[_0x4735('0x4')]);router[_0x4735('0x5')](_0x4735('0x6'),auth['isAuthenticated'](),controller[_0x4735('0x7')]);module[_0x4735('0x8')]=router; \ No newline at end of file +var _0x5144=['getQueues','express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x168392,_0x126016){var _0x31c66d=function(_0x513826){while(--_0x513826){_0x168392['push'](_0x168392['shift']());}};_0x31c66d(++_0x126016);}(_0x5144,0xa9));var _0x4514=function(_0x4a8636,_0x30e1db){_0x4a8636=_0x4a8636-0x0;var _0x2c7a55=_0x5144[_0x4a8636];return _0x2c7a55;};'use strict';var express=require(_0x4514('0x0'));var router=express['Router']();var auth=require(_0x4514('0x1'));var controller=require(_0x4514('0x2'));router[_0x4514('0x3')](_0x4514('0x4'),auth[_0x4514('0x5')](),controller[_0x4514('0x6')]);router[_0x4514('0x3')]('/queues',auth['isAuthenticated'](),controller[_0x4514('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 85311eb..f1a1dc0 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x4fa4e8,_0x45e204){var _0x8a08b9=function(_0xddcbb9){while(--_0xddcbb9){_0x4fa4e8['push'](_0x4fa4e8['shift']());}};_0x8a08b9(++_0x45e204);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x2d5b37,_0x51612e){var _0x167f72=function(_0x3a706f){while(--_0x3a706f){_0x2d5b37['push'](_0x2d5b37['shift']());}};_0x167f72(++_0x51612e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 289de6f..2427c6c 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x228025,_0x139f58){var _0x36f26f=function(_0x334026){while(--_0x334026){_0x228025['push'](_0x228025['shift']());}};_0x36f26f(++_0x139f58);}(_0xedd9,0xfc));var _0x9edd=function(_0x247402,_0x269fc8){_0x247402=_0x247402-0x0;var _0x438ef9=_0xedd9[_0x247402];return _0x438ef9;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x183678,_0x3a89fa){var _0x4816a0=function(_0x596563){while(--_0x596563){_0x183678['push'](_0x183678['shift']());}};_0x4816a0(++_0x3a89fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 520af59..0d8a170 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 _0xbfe8=['INTEGER','exports','STRING','DATE'];(function(_0x395fed,_0x553d31){var _0x32a854=function(_0x4ba6e4){while(--_0x4ba6e4){_0x395fed['push'](_0x395fed['shift']());}};_0x32a854(++_0x553d31);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x4894d3,_0x576c0c){_0x4894d3=_0x4894d3-0x0;var _0x4b0b87=_0xbfe8[_0x4894d3];return _0x4b0b87;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8bfe('0x1')]},'scheduledat':{'type':Sequelize[_0x8bfe('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8bfe('0x2')]},'ringtime':{'type':Sequelize[_0x8bfe('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8bfe('0x1')]},'membername':{'type':Sequelize[_0x8bfe('0x1')]}}; \ No newline at end of file +var _0x5a4f=['STRING','sequelize','INTEGER','DATE'];(function(_0x4af563,_0x2b2308){var _0x7deac1=function(_0x20deca){while(--_0x20deca){_0x4af563['push'](_0x4af563['shift']());}};_0x7deac1(++_0x2b2308);}(_0x5a4f,0x10d));var _0xf5a4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x5a4f[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0xf5a4('0x0'));module['exports']={'state':{'type':Sequelize[_0xf5a4('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf5a4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf5a4('0x2')]},'responsetime':{'type':Sequelize[_0xf5a4('0x2')]},'ringtime':{'type':Sequelize[_0xf5a4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf5a4('0x3')]},'campaigntype':{'type':Sequelize[_0xf5a4('0x3')]},'membername':{'type':Sequelize[_0xf5a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 473f0a8..c180b54 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 _0x7b1e=['define','ReportAgentPreview','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x47daa1,_0x456720){var _0xf6c149=function(_0x2b929f){while(--_0x2b929f){_0x47daa1['push'](_0x47daa1['shift']());}};_0xf6c149(++_0x456720);}(_0x7b1e,0x1e2));var _0xe7b1=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x7b1e[_0xf51c06];return _0x1d5420;};'use strict';var _=require(_0xe7b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe7b1('0x1'));var moment=require('moment');var BPromise=require(_0xe7b1('0x2'));var rp=require(_0xe7b1('0x3'));var fs=require('fs');var path=require(_0xe7b1('0x4'));var rimraf=require(_0xe7b1('0x5'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x55f371,_0x2f79cd){return _0x55f371[_0xe7b1('0x6')](_0xe7b1('0x7'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4568=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','define','lodash'];(function(_0x2c4a46,_0x38bea3){var _0x4ddfd8=function(_0x12f2d7){while(--_0x12f2d7){_0x2c4a46['push'](_0x2c4a46['shift']());}};_0x4ddfd8(++_0x38bea3);}(_0x4568,0xb3));var _0x8456=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4568[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8456('0x0'));var util=require(_0x8456('0x1'));var logger=require(_0x8456('0x2'))(_0x8456('0x3'));var moment=require('moment');var BPromise=require(_0x8456('0x4'));var rp=require(_0x8456('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8456('0x6'));var attributes=require(_0x8456('0x7'));module['exports']=function(_0x29fe18,_0x5e5026){return _0x29fe18[_0x8456('0x8')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 916f0e9..b18033b 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 _0xcffa=['code','message','result','create','body','options','raw','CreateReportAgentPreview','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error'];(function(_0xd6db21,_0x1d08f3){var _0x3b96a0=function(_0x157017){while(--_0x157017){_0xd6db21['push'](_0xd6db21['shift']());}};_0x3b96a0(++_0x1d08f3);}(_0xcffa,0x96));var _0xacff=function(_0x59305b,_0x3002e5){_0x59305b=_0x59305b-0x0;var _0x47c604=_0xcffa[_0x59305b];return _0x47c604;};'use strict';var _=require(_0xacff('0x0'));var util=require(_0xacff('0x1'));var moment=require(_0xacff('0x2'));var BPromise=require('bluebird');var rs=require(_0xacff('0x3'));var fs=require('fs');var Redis=require(_0xacff('0x4'));var db=require(_0xacff('0x5'))['db'];var utils=require(_0xacff('0x6'));var logger=require('../../config/logger')(_0xacff('0x7'));var config=require(_0xacff('0x8'));var jayson=require(_0xacff('0x9'));var client=jayson[_0xacff('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29cad6,_0x4d8eed,_0x2822dc){return new BPromise(function(_0x502f17,_0x1c8927){return client['request'](_0x29cad6,_0x2822dc)[_0xacff('0xb')](function(_0x138335){logger[_0xacff('0xc')](_0xacff('0xd'),_0x4d8eed,_0xacff('0xe'));logger[_0xacff('0xf')](_0xacff('0x10'),_0x4d8eed,_0xacff('0xe'),JSON['stringify'](_0x138335));if(_0x138335[_0xacff('0x11')]){if(_0x138335['error'][_0xacff('0x12')]===0x1f4){logger[_0xacff('0x11')](_0xacff('0xd'),_0x4d8eed,_0x138335[_0xacff('0x11')]['message']);return _0x1c8927(_0x138335[_0xacff('0x11')][_0xacff('0x13')]);}logger['error'](_0xacff('0xd'),_0x4d8eed,_0x138335[_0xacff('0x11')][_0xacff('0x13')]);return _0x502f17(_0x138335['error']['message']);}else{logger[_0xacff('0xc')](_0xacff('0xd'),_0x4d8eed,_0xacff('0xe'));_0x502f17(_0x138335[_0xacff('0x14')][_0xacff('0x13')]);}})['catch'](function(_0x64768d){logger['error'](_0xacff('0xd'),_0x4d8eed,_0x64768d);_0x1c8927(_0x64768d);});});}exports['CreateReportAgentPreview']=function(_0x5954b7){var _0x64542c=this;return new Promise(function(_0x17e240,_0x334829){return db['ReportAgentPreview'][_0xacff('0x15')](_0x5954b7[_0xacff('0x16')],{'raw':_0x5954b7[_0xacff('0x17')]?_0x5954b7[_0xacff('0x17')][_0xacff('0x18')]===undefined?!![]:![]:!![]})[_0xacff('0xb')](function(_0x28a95d){logger['info'](_0xacff('0x19'),_0x5954b7);logger['debug']('CreateReportAgentPreview',_0x5954b7,JSON[_0xacff('0x1a')](_0x28a95d));_0x17e240(_0x28a95d);})[_0xacff('0x1b')](function(_0x478da6){logger[_0xacff('0x11')](_0xacff('0x19'),_0x478da6[_0xacff('0x13')],_0x5954b7);_0x334829(_0x64542c[_0xacff('0x11')](0x1f4,_0x478da6['message']));});});}; \ No newline at end of file +var _0x32ce=['debug','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','ReportAgentPreview','create','body','options','CreateReportAgentPreview','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x27aafd,_0x15b25){var _0x4eeb27=function(_0x777c9b){while(--_0x777c9b){_0x27aafd['push'](_0x27aafd['shift']());}};_0x4eeb27(++_0x15b25);}(_0x32ce,0xc3));var _0xe32c=function(_0xa1afdd,_0x545768){_0xa1afdd=_0xa1afdd-0x0;var _0x4a9722=_0x32ce[_0xa1afdd];return _0x4a9722;};'use strict';var _=require(_0xe32c('0x0'));var util=require(_0xe32c('0x1'));var moment=require(_0xe32c('0x2'));var BPromise=require(_0xe32c('0x3'));var rs=require(_0xe32c('0x4'));var fs=require('fs');var Redis=require(_0xe32c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe32c('0x6'));var logger=require(_0xe32c('0x7'))(_0xe32c('0x8'));var config=require(_0xe32c('0x9'));var jayson=require(_0xe32c('0xa'));var client=jayson[_0xe32c('0xb')][_0xe32c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1958ee,_0x28bcba,_0x33f3c0){return new BPromise(function(_0x42dc2d,_0x101ab5){return client[_0xe32c('0xd')](_0x1958ee,_0x33f3c0)[_0xe32c('0xe')](function(_0x330809){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x28bcba,'request\x20sent');logger[_0xe32c('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x28bcba,_0xe32c('0x10'),JSON[_0xe32c('0x11')](_0x330809));if(_0x330809['error']){if(_0x330809[_0xe32c('0x12')][_0xe32c('0x13')]===0x1f4){logger[_0xe32c('0x12')](_0xe32c('0x14'),_0x28bcba,_0x330809[_0xe32c('0x12')][_0xe32c('0x15')]);return _0x101ab5(_0x330809['error'][_0xe32c('0x15')]);}logger[_0xe32c('0x12')](_0xe32c('0x14'),_0x28bcba,_0x330809[_0xe32c('0x12')][_0xe32c('0x15')]);return _0x42dc2d(_0x330809['error'][_0xe32c('0x15')]);}else{logger[_0xe32c('0x16')]('ReportAgentPreview,\x20%s,\x20%s',_0x28bcba,'request\x20sent');_0x42dc2d(_0x330809[_0xe32c('0x17')][_0xe32c('0x15')]);}})['catch'](function(_0x17e65a){logger[_0xe32c('0x12')](_0xe32c('0x14'),_0x28bcba,_0x17e65a);_0x101ab5(_0x17e65a);});});}exports['CreateReportAgentPreview']=function(_0x202513){var _0x1a271b=this;return new Promise(function(_0x534bf6,_0x338ff6){return db[_0xe32c('0x18')][_0xe32c('0x19')](_0x202513[_0xe32c('0x1a')],{'raw':_0x202513[_0xe32c('0x1b')]?_0x202513['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x76d3f8){logger[_0xe32c('0x16')](_0xe32c('0x1c'),_0x202513);logger[_0xe32c('0xf')]('CreateReportAgentPreview',_0x202513,JSON[_0xe32c('0x11')](_0x76d3f8));_0x534bf6(_0x76d3f8);})[_0xe32c('0x1d')](function(_0x39efe7){logger[_0xe32c('0x12')](_0xe32c('0x1c'),_0x39efe7[_0xe32c('0x15')],_0x202513);_0x338ff6(_0x1a271b[_0xe32c('0x12')](0x1f4,_0x39efe7[_0xe32c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 06daed0..3ae39a2 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 _0x2f17=['/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts'];(function(_0xa599e2,_0x3046be){var _0x122f49=function(_0x4f3d6d){while(--_0x4f3d6d){_0xa599e2['push'](_0xa599e2['shift']());}};_0x122f49(++_0x3046be);}(_0x2f17,0xb9));var _0x72f1=function(_0x81e56f,_0x26c5a2){_0x81e56f=_0x81e56f-0x0;var _0x384f8b=_0x2f17[_0x81e56f];return _0x384f8b;};'use strict';var multer=require(_0x72f1('0x0'));var util=require(_0x72f1('0x1'));var path=require(_0x72f1('0x2'));var express=require(_0x72f1('0x3'));var router=express[_0x72f1('0x4')]();var auth=require(_0x72f1('0x5'));var controller=require('./rpc.controller');router[_0x72f1('0x6')](_0x72f1('0x7'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x9')]);router['get'](_0x72f1('0xa'),auth[_0x72f1('0x8')](),controller[_0x72f1('0xb')]);router[_0x72f1('0x6')](_0x72f1('0xc'),auth['isAuthenticated'](),controller[_0x72f1('0xd')]);router[_0x72f1('0x6')](_0x72f1('0xe'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x72f1('0x6')](_0x72f1('0xf'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x10')]);router['get'](_0x72f1('0x11'),auth['isAuthenticated'](),controller[_0x72f1('0x12')]);router[_0x72f1('0x6')](_0x72f1('0x13'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x14')]);router['get'](_0x72f1('0x15'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x16')]);router[_0x72f1('0x6')](_0x72f1('0x17'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x18')]);router[_0x72f1('0x6')](_0x72f1('0x19'),auth['isAuthenticated'](),controller[_0x72f1('0x1a')]);router['get'](_0x72f1('0x1b'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x1c')]);router[_0x72f1('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x72f1('0x6')]('/voice/queues/channels',auth[_0x72f1('0x8')](),controller[_0x72f1('0x1d')]);router[_0x72f1('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x72f1('0x8')](),controller['voiceQueuesChannel']);router['get'](_0x72f1('0x1e'),auth[_0x72f1('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0x72f1('0x1f'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x20')]);router['get']('/voice/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x21')]);router[_0x72f1('0x22')]('/voice/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x23')]);router[_0x72f1('0x6')](_0x72f1('0x24'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x25')]);router[_0x72f1('0x6')](_0x72f1('0x26'),auth['isAuthenticated'](),controller[_0x72f1('0x27')]);router[_0x72f1('0x6')]('/agents',auth[_0x72f1('0x8')](),controller[_0x72f1('0x28')]);router[_0x72f1('0x22')](_0x72f1('0x29'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x2a')]);router[_0x72f1('0x6')](_0x72f1('0x2b'),auth[_0x72f1('0x8')](),controller['telephones']);router[_0x72f1('0x6')](_0x72f1('0x2c'),auth[_0x72f1('0x8')](),controller['trunks']);router[_0x72f1('0x6')](_0x72f1('0x2d'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x2e')]);router[_0x72f1('0x6')](_0x72f1('0x2f'),auth['isAuthenticated'](),controller[_0x72f1('0x30')]);router[_0x72f1('0x6')](_0x72f1('0x31'),auth[_0x72f1('0x8')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x72f1('0x32'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x33')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x72f1('0x34'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x35')]);router[_0x72f1('0x6')](_0x72f1('0x36'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x37')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x72f1('0x8')](),controller[_0x72f1('0x38')]);router['get'](_0x72f1('0x39'),auth['isAuthenticated'](),controller[_0x72f1('0x3a')]);router['post'](_0x72f1('0x3b'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x3c')]('mail'));router[_0x72f1('0x6')](_0x72f1('0x3d'),auth[_0x72f1('0x8')](),controller['showMailQueues']);router[_0x72f1('0x3e')](_0x72f1('0x3f'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x3c')](_0x72f1('0x40')));router[_0x72f1('0x6')]('/chat/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x41')]);router[_0x72f1('0x3e')](_0x72f1('0x42'),auth['isAuthenticated'](),controller[_0x72f1('0x3c')](_0x72f1('0x43')));router[_0x72f1('0x6')]('/fax/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x44')]);router[_0x72f1('0x3e')](_0x72f1('0x45'),auth[_0x72f1('0x8')](),controller['queueNotify'](_0x72f1('0x46')));router[_0x72f1('0x6')]('/openchannel/queues/:id',auth[_0x72f1('0x8')](),controller[_0x72f1('0x47')]);router[_0x72f1('0x3e')](_0x72f1('0x48'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x3c')]('sms'));router[_0x72f1('0x3e')](_0x72f1('0x49'),auth['isAuthenticated'](),controller[_0x72f1('0x3c')]('whatsapp'));router['get'](_0x72f1('0x4a'),auth['isAuthenticated'](),controller[_0x72f1('0x4b')]);router[_0x72f1('0x6')](_0x72f1('0x4c'),auth[_0x72f1('0x8')](),controller[_0x72f1('0x4d')]);router[_0x72f1('0x3e')]('/agents/:id/notify',auth[_0x72f1('0x8')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xe802=['voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','telephones','trunks','/fax/accounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated'];(function(_0x2a1257,_0x181d87){var _0x4f8bff=function(_0x4d7e32){while(--_0x4d7e32){_0x2a1257['push'](_0x2a1257['shift']());}};_0x4f8bff(++_0x181d87);}(_0xe802,0x97));var _0x2e80=function(_0x548f36,_0x61ba79){_0x548f36=_0x548f36-0x0;var _0xb41361=_0xe802[_0x548f36];return _0xb41361;};'use strict';var multer=require('multer');var util=require(_0x2e80('0x0'));var path=require('path');var express=require(_0x2e80('0x1'));var router=express[_0x2e80('0x2')]();var auth=require(_0x2e80('0x3'));var controller=require(_0x2e80('0x4'));router['get'](_0x2e80('0x5'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x7')]);router['get'](_0x2e80('0x8'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x9')]);router[_0x2e80('0xa')](_0x2e80('0xb'),auth[_0x2e80('0x6')](),controller[_0x2e80('0xc')]);router[_0x2e80('0xa')](_0x2e80('0xd'),auth['isAuthenticated'](),controller[_0x2e80('0xe')]);router[_0x2e80('0xa')]('/chat/queues',auth[_0x2e80('0x6')](),controller[_0x2e80('0xf')]);router[_0x2e80('0xa')](_0x2e80('0x10'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x11')]);router[_0x2e80('0xa')](_0x2e80('0x12'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x13')]);router[_0x2e80('0xa')](_0x2e80('0x14'),auth['isAuthenticated'](),controller[_0x2e80('0x15')]);router[_0x2e80('0xa')]('/sms/queues',auth['isAuthenticated'](),controller[_0x2e80('0x16')]);router[_0x2e80('0xa')](_0x2e80('0x17'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x18')]);router['get'](_0x2e80('0x19'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x1a')]);router[_0x2e80('0xa')]('/voice/queues/preview/:id',auth[_0x2e80('0x6')](),controller[_0x2e80('0x1b')]);router[_0x2e80('0xa')]('/voice/queues/channels',auth[_0x2e80('0x6')](),controller['voiceQueuesChannels']);router[_0x2e80('0xa')](_0x2e80('0x1c'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x1d')]);router[_0x2e80('0xa')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x2e80('0x1e')]);router['get'](_0x2e80('0x1f'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x20')]);router[_0x2e80('0xa')]('/voice/queues/:id',auth[_0x2e80('0x6')](),controller[_0x2e80('0x21')]);router['put'](_0x2e80('0x22'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x23')]);router['get'](_0x2e80('0x24'),auth[_0x2e80('0x6')](),controller['outbound']);router['get'](_0x2e80('0x25'),auth[_0x2e80('0x6')](),controller['outboundChannels']);router[_0x2e80('0xa')](_0x2e80('0x26'),auth['isAuthenticated'](),controller[_0x2e80('0x27')]);router[_0x2e80('0x28')]('/agents/:id/capacity',auth[_0x2e80('0x6')](),controller[_0x2e80('0x29')]);router[_0x2e80('0xa')](_0x2e80('0x2a'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x2b')]);router['get']('/trunks',auth[_0x2e80('0x6')](),controller[_0x2e80('0x2c')]);router[_0x2e80('0xa')]('/campaigns',auth[_0x2e80('0x6')](),controller['campaigns']);router[_0x2e80('0xa')](_0x2e80('0x2d'),auth[_0x2e80('0x6')](),controller['faxAccounts']);router[_0x2e80('0xa')](_0x2e80('0x2e'),auth[_0x2e80('0x6')](),controller['chatQueuesWaitingInteractions']);router['get']('/mail/queues/waitinginteractions',auth[_0x2e80('0x6')](),controller[_0x2e80('0x2f')]);router[_0x2e80('0xa')](_0x2e80('0x30'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x31')]);router[_0x2e80('0xa')](_0x2e80('0x32'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x33')]);router[_0x2e80('0xa')](_0x2e80('0x34'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x35')]);router[_0x2e80('0xa')]('/whatsapp/queues/waitinginteractions',auth[_0x2e80('0x6')](),controller[_0x2e80('0x36')]);router['get']('/fax/queues/waitinginteractions',auth[_0x2e80('0x6')](),controller[_0x2e80('0x37')]);router[_0x2e80('0x38')](_0x2e80('0x39'),auth['isAuthenticated'](),controller[_0x2e80('0x3a')]('mail'));router[_0x2e80('0xa')](_0x2e80('0x3b'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x3c')]);router[_0x2e80('0x38')](_0x2e80('0x3d'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x3a')](_0x2e80('0x3e')));router['get'](_0x2e80('0x3f'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x2e80('0x38')]('/fax/queues/:id/notify',auth[_0x2e80('0x6')](),controller['queueNotify'](_0x2e80('0x40')));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x2e80('0x41')]);router[_0x2e80('0x38')](_0x2e80('0x42'),auth[_0x2e80('0x6')](),controller['queueNotify'](_0x2e80('0x43')));router[_0x2e80('0xa')](_0x2e80('0x44'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x45')]);router[_0x2e80('0x38')](_0x2e80('0x46'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x3a')](_0x2e80('0x47')));router[_0x2e80('0x38')](_0x2e80('0x48'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x3a')](_0x2e80('0x49')));router[_0x2e80('0xa')]('/sms/queues/:id',auth[_0x2e80('0x6')](),controller[_0x2e80('0x4a')]);router[_0x2e80('0xa')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x2e80('0x4b')]);router['post'](_0x2e80('0x4c'),auth['isAuthenticated'](),controller[_0x2e80('0x4d')]);module[_0x2e80('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f25da82..89956a7 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 _0x903c=['faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','Interaction','Account','\x20Message\x20not\x20found','MessageId','InteractionId','From','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','messageId','update','agent','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','code','message','error','result','catch','sendStatus','stack','name','status','send','isNil','find','rows','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','then','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','internal','AgentCapacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','whatsappQueuesWaitingInteractions'];(function(_0x447aab,_0x3146fe){var _0x1c8ec2=function(_0x4860e3){while(--_0x4860e3){_0x447aab['push'](_0x447aab['shift']());}};_0x1c8ec2(++_0x3146fe);}(_0x903c,0x19a));var _0xc903=function(_0x8f43ee,_0x3faae2){_0x8f43ee=_0x8f43ee-0x0;var _0x29e4ba=_0x903c[_0x8f43ee];return _0x29e4ba;};'use strict';var BPromise=require(_0xc903('0x0'));var moment=require(_0xc903('0x1'));var _=require(_0xc903('0x2'));var util=require(_0xc903('0x3'));var db=require(_0xc903('0x4'))['db'];var logger=require(_0xc903('0x5'))(_0xc903('0x6'));var jayson=require(_0xc903('0x7'));var amiClient=jayson[_0xc903('0x8')]['http']({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0xc903('0x9')]({'port':0x232c});function respondWithRpcPromise(_0xcba790,_0xf62f51,_0x1ea54a){return new BPromise(function(_0x568e7e,_0x4a523d){var _0x35bf79=_0x1ea54a?_0x1ea54a:amiClient;return _0x35bf79[_0xc903('0xa')](_0xcba790,_0xf62f51)['then'](function(_0x1edf52){if(_0x1edf52['error']){if(_0x1edf52['error'][_0xc903('0xb')]===0x1f4){return _0x4a523d(_0x1edf52['error'][_0xc903('0xc')]);}return _0x568e7e(_0x1edf52[_0xc903('0xd')][_0xc903('0xc')]);}else{_0x568e7e(_0x1edf52[_0xc903('0xe')]);}})[_0xc903('0xf')](function(_0x4a0258){_0x4a523d(_0x4a0258);});});}function respondWithResult(_0x7761af,_0xdcd20a){_0xdcd20a=_0xdcd20a||0xc8;return function(_0x26bcdf){if(_0x26bcdf){return _0x7761af['status'](_0xdcd20a)['json'](_0x26bcdf);}return _0x7761af[_0xc903('0x10')](0x194);};}function handleError(_0x37caac,_0x592478){_0x592478=_0x592478||0x1f4;return function(_0x4236ed){logger[_0xc903('0xd')](_0x4236ed[_0xc903('0x11')]);if(_0x4236ed[_0xc903('0x12')]){delete _0x4236ed['name'];}_0x37caac[_0xc903('0x13')](_0x592478)[_0xc903('0x14')](_0x4236ed);};}function findById(_0x52e546){return function(_0xdb775b){if(!_[_0xc903('0x15')](_0x52e546)&&!_[_0xc903('0x15')](_0xdb775b)&&!_[_0xc903('0x15')](_0xdb775b['rows'])){return _[_0xc903('0x16')](_0xdb775b[_0xc903('0x17')],function(_0x11ea64){return _0x11ea64['id']==_0x52e546;});}return null;};}exports['voiceChannels']=function(_0x1b7d17,_0x1f51f7){return respondWithRpcPromise('VoiceChannels',_0x1b7d17[_0xc903('0x18')])['then'](respondWithResult(_0x1f51f7,null))['catch'](handleError(_0x1f51f7,null));};exports[_0xc903('0x19')]=function(_0x125dd0,_0x2b8fbd){return respondWithRpcPromise(_0xc903('0x1a'),_[_0xc903('0x1b')](_0x125dd0[_0xc903('0x18')],_0x125dd0[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x2b8fbd,null))[_0xc903('0xf')](handleError(_0x2b8fbd,null));};exports[_0xc903('0x1e')]=function(_0x50ddc5,_0x304b8c){return respondWithRpcPromise(_0xc903('0x1f'),_[_0xc903('0x1b')](_0x50ddc5[_0xc903('0x18')],_0x50ddc5[_0xc903('0x1c')]))['then'](respondWithResult(_0x304b8c,null))['catch'](handleError(_0x304b8c,null));};exports[_0xc903('0x20')]=function(_0x47f7f2,_0x281046){return respondWithRpcPromise(_0xc903('0x21'),_0x47f7f2[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x281046,null))[_0xc903('0xf')](handleError(_0x281046,null));};exports[_0xc903('0x22')]=function(_0x14a51f,_0x9495c7){return respondWithRpcPromise(_0xc903('0x21'),_0x14a51f[_0xc903('0x18')])[_0xc903('0x1d')](findById(_0x14a51f[_0xc903('0x1c')]['id']))[_0xc903('0x1d')](respondWithResult(_0x9495c7,null))['catch'](handleError(_0x9495c7,null));};exports['updateVoiceQueue']=function(_0x4a70b2,_0x4f18fa){return respondWithRpcPromise(_0xc903('0x23'),_[_0xc903('0x1b')](_0x4a70b2['body'],_0x4a70b2[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x4f18fa,null))[_0xc903('0xf')](handleError(_0x4f18fa,null));};exports[_0xc903('0x24')]=function(_0x5f2f39,_0x59ef05){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x5f2f39[_0xc903('0x18')],_0x5f2f39[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x59ef05,null))[_0xc903('0xf')](handleError(_0x59ef05,null));};exports[_0xc903('0x25')]=function(_0x5c8183,_0x4d4792){return respondWithRpcPromise(_0xc903('0x26'),_0x5c8183[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x4d4792,null))[_0xc903('0xf')](handleError(_0x4d4792,null));};exports[_0xc903('0x27')]=function(_0x1d42fd,_0x284f9f){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x1d42fd['query'],_0x1d42fd[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x284f9f,null))[_0xc903('0xf')](handleError(_0x284f9f,null));};exports[_0xc903('0x28')]=function(_0x2a612b,_0x247ea0){return respondWithRpcPromise(_0xc903('0x29'),_['merge'](_0x2a612b['query'],_0x2a612b[_0xc903('0x1c')]))[_0xc903('0x1d')](respondWithResult(_0x247ea0,null))[_0xc903('0xf')](handleError(_0x247ea0,null));};exports[_0xc903('0x2a')]=function(_0x101f9b,_0x57a793){return respondWithRpcPromise(_0xc903('0x2b'),_[_0xc903('0x1b')](_0x101f9b[_0xc903('0x18')],_0x101f9b['params']))[_0xc903('0x1d')](respondWithResult(_0x57a793,null))['catch'](handleError(_0x57a793,null));};exports['outbound']=function(_0x583375,_0xf4a2fc){return respondWithRpcPromise(_0xc903('0x2c'),_0x583375[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0xf4a2fc,null))['catch'](handleError(_0xf4a2fc,null));};exports[_0xc903('0x2d')]=function(_0x58c41a,_0x38d461){return respondWithRpcPromise(_0xc903('0x2e'),_0x58c41a[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x38d461,null))[_0xc903('0xf')](handleError(_0x38d461,null));};exports[_0xc903('0x2f')]=function(_0x4d720d,_0x3de8e5){var _0x1e67e6;return respondWithRpcPromise(_0xc903('0x30'),_0x4d720d[_0xc903('0x18')])[_0xc903('0x1d')](function(_0x396f8c){_0x1e67e6=_0x396f8c;return respondWithRpcPromise(_0xc903('0x30'),_0x4d720d[_0xc903('0x18')],routingClient);})[_0xc903('0x1d')](function(_0x489609){return _[_0xc903('0x1b')]({},_0x489609,_0x1e67e6);})[_0xc903('0x1d')](respondWithResult(_0x3de8e5,null))[_0xc903('0xf')](handleError(_0x3de8e5,null));};exports['agentCapacity']=function(_0x5ee41e,_0x26aab5){if(_0x5ee41e[_0xc903('0x31')]&&_0x5ee41e[_0xc903('0x31')]['interaction']&&_0x5ee41e['user']&&_0x5ee41e[_0xc903('0x32')]['name']){for(var _0x5befed in _0x5ee41e[_0xc903('0x31')][_0xc903('0x33')]){if(_0x5ee41e[_0xc903('0x31')]['interaction'][_0xc903('0x34')](_0x5befed)){db[_0xc903('0x35')]['findAll']({'where':{'channel':_0x5befed,'membername':_0x5ee41e[_0xc903('0x32')]['name'],'type':_0xc903('0x36'),'exitAt':null,'uniqueid':_0x5ee41e[_0xc903('0x31')][_0xc903('0x33')][_0x5befed]&&_0x5ee41e[_0xc903('0x31')][_0xc903('0x33')][_0x5befed][_0xc903('0x37')]?{'$notIn':_0x5ee41e['body'][_0xc903('0x33')][_0x5befed]}:{'$ne':null}}})['then'](function(_0x1c7874){var _0x4d0432=moment()[_0xc903('0x38')](_0xc903('0x39'));for(var _0x5b9eb0=0x0,_0x50059d=_0x1c7874[_0xc903('0x37')];_0x5b9eb0<_0x50059d;_0x5b9eb0+=0x1){_0x1c7874[_0x5b9eb0][_0xc903('0x3a')]({'exitAt':_0x4d0432});}});for(var _0x421847=0x0;_0x421847<_0x5ee41e['body'][_0xc903('0x33')][_0x5befed]['length'];_0x421847+=0x1){db[_0xc903('0x35')][_0xc903('0x3b')]({'where':{'channel':_0x5befed,'membername':_0x5ee41e[_0xc903('0x32')][_0xc903('0x12')],'type':_0xc903('0x36'),'uniqueid':_0x5ee41e[_0xc903('0x31')][_0xc903('0x33')][_0x5befed][_0x421847],'exitAt':null},'defaults':{'channel':_0x5befed,'membername':_0x5ee41e[_0xc903('0x32')][_0xc903('0x12')],'interface':_[_0xc903('0x15')](_0x5ee41e[_0xc903('0x32')][_0xc903('0x3c')])?util[_0xc903('0x38')](_0xc903('0x3d'),_0x5ee41e[_0xc903('0x32')][_0xc903('0x12')]):_0x5ee41e[_0xc903('0x32')][_0xc903('0x3c')],'type':_0xc903('0x36'),'enterAt':moment()[_0xc903('0x38')](_0xc903('0x39')),'role':'agent','internal':_0x5ee41e[_0xc903('0x32')][_0xc903('0x3e')],'uniqueid':_0x5ee41e[_0xc903('0x31')][_0xc903('0x33')][_0x5befed][_0x421847]}});}}}}return respondWithRpcPromise(_0xc903('0x3f'),{'id':_0x5ee41e[_0xc903('0x1c')]['id'],'capacity':_0x5ee41e['body']['capacity']},routingClient)['then'](respondWithResult(_0x26aab5,null))[_0xc903('0xf')](handleError(_0x26aab5,null));};exports['telephones']=function(_0x31f0fe,_0x2e18ef){return respondWithRpcPromise(_0xc903('0x40'),_0x31f0fe[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x2e18ef,null))[_0xc903('0xf')](handleError(_0x2e18ef,null));};exports[_0xc903('0x41')]=function(_0x1e1f21,_0x416412){return respondWithRpcPromise(_0xc903('0x42'),_0x1e1f21['query'])[_0xc903('0x1d')](respondWithResult(_0x416412,null))[_0xc903('0xf')](handleError(_0x416412,null));};exports[_0xc903('0x43')]=function(_0x410ec9,_0x500080){return respondWithRpcPromise(_0xc903('0x44'),_0x410ec9[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x500080,null))[_0xc903('0xf')](handleError(_0x500080,null));};exports[_0xc903('0x45')]=function(_0x25c72e,_0x54f948){return respondWithRpcPromise(_0xc903('0x46'),_0x25c72e['query'],routingClient)[_0xc903('0x1d')](respondWithResult(_0x54f948,null))['catch'](handleError(_0x54f948,null));};exports['showChatQueues']=function(_0x49d624,_0x2665ba){return respondWithRpcPromise(_0xc903('0x46'),_0x49d624[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x49d624[_0xc903('0x1c')]['id']))['then'](respondWithResult(_0x2665ba,null))[_0xc903('0xf')](handleError(_0x2665ba,null));};exports[_0xc903('0x47')]=function(_0x57ba44,_0x2ffb7e){return respondWithRpcPromise(_0xc903('0x48'),_0x57ba44[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x2ffb7e,null))[_0xc903('0xf')](handleError(_0x2ffb7e,null));};exports[_0xc903('0x49')]=function(_0x13a9a3,_0x2858bd){return respondWithRpcPromise(_0xc903('0x48'),_0x13a9a3[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x13a9a3['params']['id']))[_0xc903('0x1d')](respondWithResult(_0x2858bd,null))[_0xc903('0xf')](handleError(_0x2858bd,null));};exports[_0xc903('0x4a')]=function(_0xc11cd7,_0x3056ef){return respondWithRpcPromise(_0xc903('0x4b'),_0xc11cd7[_0xc903('0x18')],mailClient)['then'](respondWithResult(_0x3056ef,null))[_0xc903('0xf')](handleError(_0x3056ef,null));};exports[_0xc903('0x4c')]=function(_0x55d38d,_0x26f70d){return respondWithRpcPromise(_0xc903('0x4d'),_0x55d38d['query'],routingClient)[_0xc903('0x1d')](respondWithResult(_0x26f70d,null))[_0xc903('0xf')](handleError(_0x26f70d,null));};exports[_0xc903('0x4e')]=function(_0x1fda4d,_0x8b13c6){return respondWithRpcPromise('OpenchannelQueues',_0x1fda4d['query'],routingClient)[_0xc903('0x1d')](findById(_0x1fda4d[_0xc903('0x1c')]['id']))['then'](respondWithResult(_0x8b13c6,null))[_0xc903('0xf')](handleError(_0x8b13c6,null));};exports[_0xc903('0x4f')]=function(_0x3ea3bc,_0x5127f4){return respondWithRpcPromise('SmsQueues',_0x3ea3bc['query'],routingClient)['then'](respondWithResult(_0x5127f4,null))[_0xc903('0xf')](handleError(_0x5127f4,null));};exports[_0xc903('0x50')]=function(_0x561fcf,_0x426f37){return respondWithRpcPromise(_0xc903('0x51'),_0x561fcf[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x561fcf['params']['id']))[_0xc903('0x1d')](respondWithResult(_0x426f37,null))[_0xc903('0xf')](handleError(_0x426f37,null));};exports[_0xc903('0x52')]=function(_0x190954,_0x297346){return respondWithRpcPromise('WhatsappQueues',_0x190954['query'],routingClient)['then'](respondWithResult(_0x297346,null))[_0xc903('0xf')](handleError(_0x297346,null));};exports[_0xc903('0x53')]=function(_0x370917,_0x3a3280){return respondWithRpcPromise(_0xc903('0x54'),_0x370917[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x370917['params']['id']))[_0xc903('0x1d')](respondWithResult(_0x3a3280,null))[_0xc903('0xf')](handleError(_0x3a3280,null));};exports[_0xc903('0x55')]=function(_0x1d3933,_0x5e93ef){return respondWithRpcPromise('FaxQueues',_0x1d3933[_0xc903('0x18')],routingClient)['then'](respondWithResult(_0x5e93ef,null))['catch'](handleError(_0x5e93ef,null));};exports[_0xc903('0x56')]=function(_0x121163,_0x56d8d1){return respondWithRpcPromise(_0xc903('0x57'),_0x121163[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](findById(_0x121163[_0xc903('0x1c')]['id']))[_0xc903('0x1d')](respondWithResult(_0x56d8d1,null))[_0xc903('0xf')](handleError(_0x56d8d1,null));};exports[_0xc903('0x58')]=function(_0x37a6eb,_0x5bdcd2){return respondWithRpcPromise(_0xc903('0x59'),_0x37a6eb[_0xc903('0x18')])[_0xc903('0x1d')](respondWithResult(_0x5bdcd2,null))[_0xc903('0xf')](handleError(_0x5bdcd2,null));};exports[_0xc903('0x5a')]=function(_0x3de80d,_0x4c19b2){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3de80d[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x4c19b2,null))[_0xc903('0xf')](handleError(_0x4c19b2,null));};exports['mailQueuesWaitingInteractions']=function(_0x3a8d61,_0x280f50){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x3a8d61['query'],routingClient)[_0xc903('0x1d')](respondWithResult(_0x280f50,null))[_0xc903('0xf')](handleError(_0x280f50,null));};exports[_0xc903('0x5b')]=function(_0x37ccb5,_0x5e9f61){return respondWithRpcPromise(_0xc903('0x5c'),_0x37ccb5[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x5e9f61,null))[_0xc903('0xf')](handleError(_0x5e9f61,null));};exports[_0xc903('0x5d')]=function(_0x4ef00a,_0x5b9ce3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ef00a['query'],routingClient)[_0xc903('0x1d')](function(_0x518c2c){if(_0x4ef00a['query'][_0xc903('0x5e')]!==undefined){var _0x49b54b=_(_0x518c2c[_0xc903('0x17')])[_0xc903('0x5f')]([_0x4ef00a[_0xc903('0x18')]['type'],_0x4ef00a[_0xc903('0x1c')]['id']])[_0xc903('0x60')](_0xc903('0x61'))[_0xc903('0x62')]()[_0xc903('0x63')]();return _0x518c2c[_0xc903('0x17')]['filter'](function(_0x54e6dd){return _0x49b54b[_0xc903('0x64')](_0x54e6dd[_0xc903('0x61')])>-0x1;});}else{return _0x518c2c[_0xc903('0x17')][_0xc903('0x5f')](function(_0x314c6a){return _0x314c6a[_0xc903('0x61')]===parseInt(_0x4ef00a[_0xc903('0x1c')]['id']);});}})['then'](respondWithResult(_0x5b9ce3,null))[_0xc903('0xf')](handleError(_0x5b9ce3,null));};exports['smsQueuesWaitingInteractions']=function(_0x1688c0,_0x3dc4c8){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1688c0[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x3dc4c8,null))[_0xc903('0xf')](handleError(_0x3dc4c8,null));};exports[_0xc903('0x65')]=function(_0x1ca558,_0x5fa80b){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x1ca558[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x5fa80b,null))[_0xc903('0xf')](handleError(_0x5fa80b,null));};exports[_0xc903('0x66')]=function(_0x188054,_0x11de16){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x188054[_0xc903('0x18')],routingClient)[_0xc903('0x1d')](respondWithResult(_0x11de16,null))['catch'](handleError(_0x11de16,null));};exports[_0xc903('0x67')]=function(_0x8c49b3){return function(_0xff199a,_0x428961){var _0x247369,_0x107a16;var _0x1a6da9=_[_0xc903('0x68')](_0x8c49b3);var _0x5d5184=_0x8c49b3==='chat'?_0xc903('0x69'):'Account';return db[_0x1a6da9+_0xc903('0x6a')]['findOne']({'raw':!![],'where':{'id':_0xff199a[_0xc903('0x1c')]['id']}})[_0xc903('0x1d')](function(_0x29ecd2){if(_[_0xc903('0x15')](_0x29ecd2)){throw new Error(_0x1a6da9+_0xc903('0x6b'));}_0x247369=_0x29ecd2;return db[_0x1a6da9+_0xc903('0x6c')]['findOne']({'where':{'id':_0xff199a[_0xc903('0x31')]['messageId']},'include':[{'model':db[_0x1a6da9+_0xc903('0x6d')],'as':_0xc903('0x6d')},{'model':db[_0x1a6da9+_0x5d5184],'as':_0xc903('0x6e')}]});})[_0xc903('0x1d')](function(_0x302313){if(_[_0xc903('0x15')](_0x302313)){throw new Error(_0x1a6da9+_0xc903('0x6f'));}_0x107a16=_0x302313;return _0x302313['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xc903('0x1d')](function(){var _0x336d8e={'uniqueid':_0x8c49b3+'.'+_0x107a16['id']+'.'+_0x107a16[_0xc903('0x6d')]['id'],'FromUserId':_0xff199a['user']['id'],'type':'queue'};_0x336d8e[_0x1a6da9+_0xc903('0x70')]=_0x107a16['id'];_0x336d8e[_0x1a6da9+_0xc903('0x71')]=_0x107a16[_0xc903('0x6d')]['id'];_0x336d8e[_0xc903('0x72')+_0x1a6da9+_0x5d5184+'Id']=_0x107a16[_0xc903('0x6e')]['id'];_0x336d8e['To'+_0x1a6da9+'QueueId']=_0x247369['id'];return db[_0x1a6da9+_0xc903('0x73')][_0xc903('0x74')](_0x336d8e);})[_0xc903('0x1d')](function(){return respondWithRpcPromise('Start',{'channel':_0x8c49b3,'interaction':_0x107a16[_0xc903('0x6d')],'message':_0x107a16,'account':_0x107a16['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xc903('0x75'),'appdata':_0x247369[_0xc903('0x12')]+','+(_0x107a16[_0xc903('0x6e')][_0xc903('0x76')]||0x12c),'interval':_0xc903('0x77')}]},routingClient);})[_0xc903('0x1d')](respondWithResult(_0x428961,null))['catch'](handleError(_0x428961,null));};};exports[_0xc903('0x78')]=function(_0x464bf0,_0x48fa23){var _0x323eba,_0x4847e6;if(_[_0xc903('0x15')](_0x464bf0[_0xc903('0x31')][_0xc903('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x560e16=_0x464bf0[_0xc903('0x31')][_0xc903('0x79')];var _0x3cc7f5=_[_0xc903('0x68')](_0x560e16);var _0x61c2ba=_0x560e16==='chat'?'Website':'Account';return db[_0xc903('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x464bf0[_0xc903('0x1c')]['id'],'role':'agent'}})[_0xc903('0x1d')](function(_0x24fc15){if(_[_0xc903('0x15')](_0x24fc15)){throw new Error(_0xc903('0x7b'));}_0x323eba=_0x24fc15;return db[_0x3cc7f5+_0xc903('0x6c')]['findOne']({'where':{'id':_0x464bf0[_0xc903('0x31')][_0xc903('0x7c')]},'include':[{'model':db[_0x3cc7f5+_0xc903('0x6d')],'as':_0xc903('0x6d')},{'model':db[_0x3cc7f5+_0x61c2ba],'as':'Account'}]});})[_0xc903('0x1d')](function(_0x18dc95){if(_[_0xc903('0x15')](_0x18dc95)){throw new Error(_0x3cc7f5+'\x20Message\x20not\x20found');}_0x4847e6=_0x18dc95;return _0x18dc95[_0xc903('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3be2bc={'uniqueid':_0x560e16+'.'+_0x4847e6['id']+'.'+_0x4847e6[_0xc903('0x6d')]['id'],'FromUserId':_0x464bf0[_0xc903('0x32')]['id'],'type':_0xc903('0x7e'),'ToUserId':_0x323eba['id']};_0x3be2bc[_0x3cc7f5+_0xc903('0x70')]=_0x4847e6['id'];_0x3be2bc[_0x3cc7f5+_0xc903('0x71')]=_0x4847e6[_0xc903('0x6d')]['id'];_0x3be2bc[_0xc903('0x72')+_0x3cc7f5+_0x61c2ba+'Id']=_0x4847e6[_0xc903('0x6e')]['id'];return db[_0x3cc7f5+_0xc903('0x73')][_0xc903('0x74')](_0x3be2bc);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x560e16,'interaction':_0x4847e6[_0xc903('0x6d')],'message':_0x4847e6,'account':_0x4847e6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xc903('0x7e'),'appdata':_0x323eba[_0xc903('0x12')]+','+(_0x4847e6['Account'][_0xc903('0x7f')]||0x12c),'interval':_0xc903('0x77')}]},routingClient);})[_0xc903('0x1d')](respondWithResult(_0x48fa23,null))[_0xc903('0xf')](handleError(_0x48fa23,null));}; \ No newline at end of file +var _0x1e02=['merge','voiceChannelStopMixMonitor','params','voiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','body','user','interaction','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','Trunks','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','findOne','MessageId','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','http','client','then','error','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','query','VoiceChannelMixMonitor'];(function(_0x308f0e,_0x108910){var _0x13167a=function(_0x2b8692){while(--_0x2b8692){_0x308f0e['push'](_0x308f0e['shift']());}};_0x13167a(++_0x108910);}(_0x1e02,0x1bd));var _0x21e0=function(_0xc8fc2d,_0x388076){_0xc8fc2d=_0xc8fc2d-0x0;var _0x324170=_0x1e02[_0xc8fc2d];return _0x324170;};'use strict';var BPromise=require('bluebird');var moment=require(_0x21e0('0x0'));var _=require(_0x21e0('0x1'));var util=require(_0x21e0('0x2'));var db=require(_0x21e0('0x3'))['db'];var logger=require(_0x21e0('0x4'))('api');var jayson=require(_0x21e0('0x5'));var amiClient=jayson['client'][_0x21e0('0x6')]({'port':0x232a});var mailClient=jayson[_0x21e0('0x7')][_0x21e0('0x6')]({'port':0x232b});var routingClient=jayson[_0x21e0('0x7')][_0x21e0('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x3eb3ae,_0x5559c7,_0xda8af9){return new BPromise(function(_0x507510,_0x1e404c){var _0x1d2ea7=_0xda8af9?_0xda8af9:amiClient;return _0x1d2ea7['request'](_0x3eb3ae,_0x5559c7)[_0x21e0('0x8')](function(_0x3d02df){if(_0x3d02df[_0x21e0('0x9')]){if(_0x3d02df[_0x21e0('0x9')]['code']===0x1f4){return _0x1e404c(_0x3d02df[_0x21e0('0x9')]['message']);}return _0x507510(_0x3d02df[_0x21e0('0x9')]['message']);}else{_0x507510(_0x3d02df[_0x21e0('0xa')]);}})[_0x21e0('0xb')](function(_0x5e7638){_0x1e404c(_0x5e7638);});});}function respondWithResult(_0x2b8fbd,_0xbb6dc2){_0xbb6dc2=_0xbb6dc2||0xc8;return function(_0x57ba59){if(_0x57ba59){return _0x2b8fbd[_0x21e0('0xc')](_0xbb6dc2)[_0x21e0('0xd')](_0x57ba59);}return _0x2b8fbd[_0x21e0('0xe')](0x194);};}function handleError(_0x9d8bbe,_0x21c1a6){_0x21c1a6=_0x21c1a6||0x1f4;return function(_0x420901){logger[_0x21e0('0x9')](_0x420901[_0x21e0('0xf')]);if(_0x420901[_0x21e0('0x10')]){delete _0x420901[_0x21e0('0x10')];}_0x9d8bbe[_0x21e0('0xc')](_0x21c1a6)[_0x21e0('0x11')](_0x420901);};}function findById(_0x4ae831){return function(_0x13e0e4){if(!_[_0x21e0('0x12')](_0x4ae831)&&!_['isNil'](_0x13e0e4)&&!_[_0x21e0('0x12')](_0x13e0e4[_0x21e0('0x13')])){return _[_0x21e0('0x14')](_0x13e0e4['rows'],function(_0x2e640a){return _0x2e640a['id']==_0x4ae831;});}return null;};}exports['voiceChannels']=function(_0x5bcc8b,_0xd70f48){return respondWithRpcPromise('VoiceChannels',_0x5bcc8b[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0xd70f48,null))[_0x21e0('0xb')](handleError(_0xd70f48,null));};exports['voiceChannelMixMonitor']=function(_0x3ed209,_0x4338bd){return respondWithRpcPromise(_0x21e0('0x16'),_[_0x21e0('0x17')](_0x3ed209[_0x21e0('0x15')],_0x3ed209['params']))[_0x21e0('0x8')](respondWithResult(_0x4338bd,null))[_0x21e0('0xb')](handleError(_0x4338bd,null));};exports[_0x21e0('0x18')]=function(_0x4ae1fc,_0x3686ec){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x21e0('0x17')](_0x4ae1fc['query'],_0x4ae1fc[_0x21e0('0x19')]))[_0x21e0('0x8')](respondWithResult(_0x3686ec,null))[_0x21e0('0xb')](handleError(_0x3686ec,null));};exports[_0x21e0('0x1a')]=function(_0x2b83ef,_0x4c6e8c){return respondWithRpcPromise('VoiceQueues',_0x2b83ef[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x4c6e8c,null))[_0x21e0('0xb')](handleError(_0x4c6e8c,null));};exports['showVoiceQueues']=function(_0x211ad3,_0xe3bda2){return respondWithRpcPromise('VoiceQueues',_0x211ad3['query'])[_0x21e0('0x8')](findById(_0x211ad3[_0x21e0('0x19')]['id']))['then'](respondWithResult(_0xe3bda2,null))['catch'](handleError(_0xe3bda2,null));};exports[_0x21e0('0x1b')]=function(_0x10968a,_0xc0e0e5){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x21e0('0x17')](_0x10968a['body'],_0x10968a['params']))[_0x21e0('0x8')](respondWithResult(_0xc0e0e5,null))['catch'](handleError(_0xc0e0e5,null));};exports[_0x21e0('0x1c')]=function(_0x55a8d6,_0x147860){return respondWithRpcPromise(_0x21e0('0x1d'),_['merge'](_0x55a8d6['query'],_0x55a8d6[_0x21e0('0x19')]))[_0x21e0('0x8')](respondWithResult(_0x147860,null))[_0x21e0('0xb')](handleError(_0x147860,null));};exports[_0x21e0('0x1e')]=function(_0x19c997,_0xfa071f){return respondWithRpcPromise(_0x21e0('0x1f'),_0x19c997[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0xfa071f,null))[_0x21e0('0xb')](handleError(_0xfa071f,null));};exports[_0x21e0('0x20')]=function(_0x4b2aea,_0x2c3b8a){return respondWithRpcPromise(_0x21e0('0x21'),_['merge'](_0x4b2aea[_0x21e0('0x15')],_0x4b2aea[_0x21e0('0x19')]))['then'](respondWithResult(_0x2c3b8a,null))[_0x21e0('0xb')](handleError(_0x2c3b8a,null));};exports['voiceQueuesChannelHangup']=function(_0x5c1780,_0x52bd20){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x21e0('0x17')](_0x5c1780[_0x21e0('0x15')],_0x5c1780[_0x21e0('0x19')]))[_0x21e0('0x8')](respondWithResult(_0x52bd20,null))['catch'](handleError(_0x52bd20,null));};exports['voiceQueuesChannelRedirect']=function(_0x430e0a,_0x593d04){return respondWithRpcPromise(_0x21e0('0x22'),_['merge'](_0x430e0a[_0x21e0('0x15')],_0x430e0a[_0x21e0('0x19')]))[_0x21e0('0x8')](respondWithResult(_0x593d04,null))[_0x21e0('0xb')](handleError(_0x593d04,null));};exports[_0x21e0('0x23')]=function(_0x15f86a,_0x5f5778){return respondWithRpcPromise('Outbound',_0x15f86a[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x5f5778,null))[_0x21e0('0xb')](handleError(_0x5f5778,null));};exports[_0x21e0('0x24')]=function(_0x53c58b,_0x3d3568){return respondWithRpcPromise('OutboundChannels',_0x53c58b[_0x21e0('0x15')])['then'](respondWithResult(_0x3d3568,null))[_0x21e0('0xb')](handleError(_0x3d3568,null));};exports[_0x21e0('0x25')]=function(_0x3901fa,_0xea51f7){var _0x4624d9;return respondWithRpcPromise('Agents',_0x3901fa[_0x21e0('0x15')])['then'](function(_0x10e109){_0x4624d9=_0x10e109;return respondWithRpcPromise('Agents',_0x3901fa[_0x21e0('0x15')],routingClient);})[_0x21e0('0x8')](function(_0x5646bf){return _[_0x21e0('0x17')]({},_0x5646bf,_0x4624d9);})[_0x21e0('0x8')](respondWithResult(_0xea51f7,null))[_0x21e0('0xb')](handleError(_0xea51f7,null));};exports['agentCapacity']=function(_0x356e17,_0x32d586){if(_0x356e17['body']&&_0x356e17[_0x21e0('0x26')]['interaction']&&_0x356e17[_0x21e0('0x27')]&&_0x356e17[_0x21e0('0x27')][_0x21e0('0x10')]){for(var _0xe7ff26 in _0x356e17[_0x21e0('0x26')]['interaction']){if(_0x356e17[_0x21e0('0x26')][_0x21e0('0x28')][_0x21e0('0x29')](_0xe7ff26)){db['MemberReport'][_0x21e0('0x2a')]({'where':{'channel':_0xe7ff26,'membername':_0x356e17[_0x21e0('0x27')][_0x21e0('0x10')],'type':_0x21e0('0x2b'),'exitAt':null,'uniqueid':_0x356e17['body'][_0x21e0('0x28')][_0xe7ff26]&&_0x356e17[_0x21e0('0x26')][_0x21e0('0x28')][_0xe7ff26][_0x21e0('0x2c')]?{'$notIn':_0x356e17['body']['interaction'][_0xe7ff26]}:{'$ne':null}}})[_0x21e0('0x8')](function(_0x36f5d7){var _0x32675b=moment()['format'](_0x21e0('0x2d'));for(var _0x593c85=0x0,_0x15d607=_0x36f5d7['length'];_0x593c85<_0x15d607;_0x593c85+=0x1){_0x36f5d7[_0x593c85][_0x21e0('0x2e')]({'exitAt':_0x32675b});}});for(var _0xc00f0e=0x0;_0xc00f0e<_0x356e17[_0x21e0('0x26')][_0x21e0('0x28')][_0xe7ff26]['length'];_0xc00f0e+=0x1){db['MemberReport'][_0x21e0('0x2f')]({'where':{'channel':_0xe7ff26,'membername':_0x356e17[_0x21e0('0x27')][_0x21e0('0x10')],'type':_0x21e0('0x2b'),'uniqueid':_0x356e17['body']['interaction'][_0xe7ff26][_0xc00f0e],'exitAt':null},'defaults':{'channel':_0xe7ff26,'membername':_0x356e17[_0x21e0('0x27')][_0x21e0('0x10')],'interface':_[_0x21e0('0x12')](_0x356e17[_0x21e0('0x27')][_0x21e0('0x30')])?util[_0x21e0('0x31')](_0x21e0('0x32'),_0x356e17['user']['name']):_0x356e17['user']['interface'],'type':'INTERACTION','enterAt':moment()[_0x21e0('0x31')](_0x21e0('0x2d')),'role':_0x21e0('0x33'),'internal':_0x356e17['user'][_0x21e0('0x34')],'uniqueid':_0x356e17[_0x21e0('0x26')][_0x21e0('0x28')][_0xe7ff26][_0xc00f0e]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x356e17[_0x21e0('0x19')]['id'],'capacity':_0x356e17[_0x21e0('0x26')][_0x21e0('0x35')]},routingClient)[_0x21e0('0x8')](respondWithResult(_0x32d586,null))[_0x21e0('0xb')](handleError(_0x32d586,null));};exports[_0x21e0('0x36')]=function(_0x5a6808,_0x582a25){return respondWithRpcPromise(_0x21e0('0x37'),_0x5a6808[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x582a25,null))[_0x21e0('0xb')](handleError(_0x582a25,null));};exports[_0x21e0('0x38')]=function(_0xc3c08f,_0x4413fb){return respondWithRpcPromise(_0x21e0('0x39'),_0xc3c08f[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x4413fb,null))[_0x21e0('0xb')](handleError(_0x4413fb,null));};exports['campaigns']=function(_0xac0579,_0x12e014){return respondWithRpcPromise('Campaigns',_0xac0579[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x12e014,null))[_0x21e0('0xb')](handleError(_0x12e014,null));};exports[_0x21e0('0x3a')]=function(_0x5064f2,_0xb0f666){return respondWithRpcPromise(_0x21e0('0x3b'),_0x5064f2[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0xb0f666,null))[_0x21e0('0xb')](handleError(_0xb0f666,null));};exports[_0x21e0('0x3c')]=function(_0x21ad39,_0x1bf257){return respondWithRpcPromise(_0x21e0('0x3b'),_0x21ad39[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](findById(_0x21ad39['params']['id']))[_0x21e0('0x8')](respondWithResult(_0x1bf257,null))[_0x21e0('0xb')](handleError(_0x1bf257,null));};exports['mailQueues']=function(_0xcc04ff,_0x349c53){return respondWithRpcPromise('MailQueues',_0xcc04ff[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x349c53,null))[_0x21e0('0xb')](handleError(_0x349c53,null));};exports[_0x21e0('0x3d')]=function(_0x10525b,_0xb8f99c){return respondWithRpcPromise(_0x21e0('0x3e'),_0x10525b[_0x21e0('0x15')],routingClient)['then'](findById(_0x10525b[_0x21e0('0x19')]['id']))[_0x21e0('0x8')](respondWithResult(_0xb8f99c,null))['catch'](handleError(_0xb8f99c,null));};exports[_0x21e0('0x3f')]=function(_0x1ee7e8,_0x589839){return respondWithRpcPromise(_0x21e0('0x40'),_0x1ee7e8[_0x21e0('0x15')],mailClient)['then'](respondWithResult(_0x589839,null))[_0x21e0('0xb')](handleError(_0x589839,null));};exports['openchannelQueues']=function(_0x352773,_0x54fa71){return respondWithRpcPromise(_0x21e0('0x41'),_0x352773[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x54fa71,null))[_0x21e0('0xb')](handleError(_0x54fa71,null));};exports[_0x21e0('0x42')]=function(_0x5a2698,_0x37c1b2){return respondWithRpcPromise(_0x21e0('0x41'),_0x5a2698[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](findById(_0x5a2698[_0x21e0('0x19')]['id']))[_0x21e0('0x8')](respondWithResult(_0x37c1b2,null))[_0x21e0('0xb')](handleError(_0x37c1b2,null));};exports[_0x21e0('0x43')]=function(_0x2976ea,_0x34f111){return respondWithRpcPromise(_0x21e0('0x44'),_0x2976ea['query'],routingClient)[_0x21e0('0x8')](respondWithResult(_0x34f111,null))[_0x21e0('0xb')](handleError(_0x34f111,null));};exports[_0x21e0('0x45')]=function(_0x12539c,_0x58abc6){return respondWithRpcPromise('SmsQueues',_0x12539c[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](findById(_0x12539c[_0x21e0('0x19')]['id']))['then'](respondWithResult(_0x58abc6,null))[_0x21e0('0xb')](handleError(_0x58abc6,null));};exports[_0x21e0('0x46')]=function(_0x55a5c2,_0x26e675){return respondWithRpcPromise('WhatsappQueues',_0x55a5c2[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x26e675,null))[_0x21e0('0xb')](handleError(_0x26e675,null));};exports['showWhatsappQueues']=function(_0x222f6a,_0x17086f){return respondWithRpcPromise(_0x21e0('0x47'),_0x222f6a[_0x21e0('0x15')],routingClient)['then'](findById(_0x222f6a[_0x21e0('0x19')]['id']))[_0x21e0('0x8')](respondWithResult(_0x17086f,null))[_0x21e0('0xb')](handleError(_0x17086f,null));};exports['faxQueues']=function(_0x162994,_0x1f93e7){return respondWithRpcPromise(_0x21e0('0x48'),_0x162994[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x1f93e7,null))['catch'](handleError(_0x1f93e7,null));};exports[_0x21e0('0x49')]=function(_0x3bf3e2,_0x1a7d97){return respondWithRpcPromise(_0x21e0('0x48'),_0x3bf3e2['query'],routingClient)[_0x21e0('0x8')](findById(_0x3bf3e2['params']['id']))[_0x21e0('0x8')](respondWithResult(_0x1a7d97,null))['catch'](handleError(_0x1a7d97,null));};exports[_0x21e0('0x4a')]=function(_0x1475ae,_0x481495){return respondWithRpcPromise(_0x21e0('0x4b'),_0x1475ae[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x481495,null))[_0x21e0('0xb')](handleError(_0x481495,null));};exports[_0x21e0('0x4c')]=function(_0x552e28,_0x1ac360){return respondWithRpcPromise(_0x21e0('0x4d'),_0x552e28[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x1ac360,null))['catch'](handleError(_0x1ac360,null));};exports[_0x21e0('0x4e')]=function(_0x50fcac,_0x529bf7){return respondWithRpcPromise(_0x21e0('0x4f'),_0x50fcac[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x529bf7,null))[_0x21e0('0xb')](handleError(_0x529bf7,null));};exports[_0x21e0('0x50')]=function(_0xf1abd2,_0x5a9737){return respondWithRpcPromise(_0x21e0('0x51'),_0xf1abd2[_0x21e0('0x15')],routingClient)['then'](respondWithResult(_0x5a9737,null))['catch'](handleError(_0x5a9737,null));};exports[_0x21e0('0x52')]=function(_0x435951,_0x2e9ec9){return respondWithRpcPromise(_0x21e0('0x51'),_0x435951[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](function(_0x5eff4a){if(_0x435951['query'][_0x21e0('0x53')]!==undefined){var _0x28fe08=_(_0x5eff4a[_0x21e0('0x13')])[_0x21e0('0x54')]([_0x435951[_0x21e0('0x15')]['type'],_0x435951['params']['id']])[_0x21e0('0x55')](_0x21e0('0x56'))[_0x21e0('0x57')]()[_0x21e0('0x58')]();return _0x5eff4a[_0x21e0('0x13')][_0x21e0('0x54')](function(_0x3f2ab9){return _0x28fe08['indexOf'](_0x3f2ab9['queue_id'])>-0x1;});}else{return _0x5eff4a['rows']['filter'](function(_0x3c73ca){return _0x3c73ca[_0x21e0('0x56')]===parseInt(_0x435951[_0x21e0('0x19')]['id']);});}})[_0x21e0('0x8')](respondWithResult(_0x2e9ec9,null))[_0x21e0('0xb')](handleError(_0x2e9ec9,null));};exports['smsQueuesWaitingInteractions']=function(_0x122fcc,_0x56ce1c){return respondWithRpcPromise(_0x21e0('0x59'),_0x122fcc[_0x21e0('0x15')],routingClient)['then'](respondWithResult(_0x56ce1c,null))[_0x21e0('0xb')](handleError(_0x56ce1c,null));};exports[_0x21e0('0x5a')]=function(_0x1bcfc6,_0x493031){return respondWithRpcPromise(_0x21e0('0x5b'),_0x1bcfc6['query'],routingClient)['then'](respondWithResult(_0x493031,null))[_0x21e0('0xb')](handleError(_0x493031,null));};exports[_0x21e0('0x5c')]=function(_0x5c6dcb,_0x4ddeba){return respondWithRpcPromise(_0x21e0('0x5d'),_0x5c6dcb[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x4ddeba,null))[_0x21e0('0xb')](handleError(_0x4ddeba,null));};exports[_0x21e0('0x5e')]=function(_0x2f6982){return function(_0x1c1151,_0x3936e9){var _0x13c639,_0x223a74;var _0x38533e=_[_0x21e0('0x5f')](_0x2f6982);var _0x468ddd=_0x2f6982===_0x21e0('0x60')?_0x21e0('0x61'):_0x21e0('0x62');return db[_0x38533e+'Queue']['findOne']({'raw':!![],'where':{'id':_0x1c1151['params']['id']}})[_0x21e0('0x8')](function(_0x3bfd2f){if(_[_0x21e0('0x12')](_0x3bfd2f)){throw new Error(_0x38533e+'\x20Queue\x20not\x20found');}_0x13c639=_0x3bfd2f;return db[_0x38533e+_0x21e0('0x63')]['findOne']({'where':{'id':_0x1c1151[_0x21e0('0x26')][_0x21e0('0x64')]},'include':[{'model':db[_0x38533e+'Interaction'],'as':_0x21e0('0x65')},{'model':db[_0x38533e+_0x468ddd],'as':'Account'}]});})[_0x21e0('0x8')](function(_0x557fda){if(_[_0x21e0('0x12')](_0x557fda)){throw new Error(_0x38533e+_0x21e0('0x66'));}_0x223a74=_0x557fda;return _0x557fda['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x21e0('0x8')](function(){var _0x54a4f0={'uniqueid':_0x2f6982+'.'+_0x223a74['id']+'.'+_0x223a74[_0x21e0('0x65')]['id'],'FromUserId':_0x1c1151[_0x21e0('0x27')]['id'],'type':_0x21e0('0x67')};_0x54a4f0[_0x38533e+'MessageId']=_0x223a74['id'];_0x54a4f0[_0x38533e+_0x21e0('0x68')]=_0x223a74['Interaction']['id'];_0x54a4f0[_0x21e0('0x69')+_0x38533e+_0x468ddd+'Id']=_0x223a74['Account']['id'];_0x54a4f0['To'+_0x38533e+_0x21e0('0x6a')]=_0x13c639['id'];return db[_0x38533e+_0x21e0('0x6b')][_0x21e0('0x6c')](_0x54a4f0);})[_0x21e0('0x8')](function(){return respondWithRpcPromise(_0x21e0('0x6d'),{'channel':_0x2f6982,'interaction':_0x223a74[_0x21e0('0x65')],'message':_0x223a74,'account':_0x223a74[_0x21e0('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x13c639['name']+','+(_0x223a74['Account'][_0x21e0('0x6e')]||0x12c),'interval':_0x21e0('0x6f')}]},routingClient);})[_0x21e0('0x8')](respondWithResult(_0x3936e9,null))[_0x21e0('0xb')](handleError(_0x3936e9,null));};};exports['agentNotify']=function(_0x59a4ac,_0x15fbfd){var _0x5b3346,_0x2ab809;if(_[_0x21e0('0x12')](_0x59a4ac[_0x21e0('0x26')][_0x21e0('0x70')])){throw new Error(_0x21e0('0x71'));}var _0x1a0ad9=_0x59a4ac[_0x21e0('0x26')][_0x21e0('0x70')];var _0x2bf49a=_[_0x21e0('0x5f')](_0x1a0ad9);var _0x1c6987=_0x1a0ad9===_0x21e0('0x60')?_0x21e0('0x61'):'Account';return db[_0x21e0('0x72')][_0x21e0('0x73')]({'raw':!![],'where':{'id':_0x59a4ac[_0x21e0('0x19')]['id'],'role':_0x21e0('0x33')}})[_0x21e0('0x8')](function(_0x1f6c7d){if(_[_0x21e0('0x12')](_0x1f6c7d)){throw new Error('Agent\x20not\x20found');}_0x5b3346=_0x1f6c7d;return db[_0x2bf49a+'Message'][_0x21e0('0x73')]({'where':{'id':_0x59a4ac[_0x21e0('0x26')][_0x21e0('0x64')]},'include':[{'model':db[_0x2bf49a+_0x21e0('0x65')],'as':'Interaction'},{'model':db[_0x2bf49a+_0x1c6987],'as':_0x21e0('0x62')}]});})[_0x21e0('0x8')](function(_0x2ba57c){if(_['isNil'](_0x2ba57c)){throw new Error(_0x2bf49a+_0x21e0('0x66'));}_0x2ab809=_0x2ba57c;return _0x2ba57c['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x37da0b={'uniqueid':_0x1a0ad9+'.'+_0x2ab809['id']+'.'+_0x2ab809['Interaction']['id'],'FromUserId':_0x59a4ac[_0x21e0('0x27')]['id'],'type':_0x21e0('0x33'),'ToUserId':_0x5b3346['id']};_0x37da0b[_0x2bf49a+_0x21e0('0x74')]=_0x2ab809['id'];_0x37da0b[_0x2bf49a+'InteractionId']=_0x2ab809['Interaction']['id'];_0x37da0b['From'+_0x2bf49a+_0x1c6987+'Id']=_0x2ab809[_0x21e0('0x62')]['id'];return db[_0x2bf49a+'TransferReport']['create'](_0x37da0b);})[_0x21e0('0x8')](function(){return respondWithRpcPromise(_0x21e0('0x6d'),{'channel':_0x1a0ad9,'interaction':_0x2ab809[_0x21e0('0x65')],'message':_0x2ab809,'account':_0x2ab809[_0x21e0('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x21e0('0x33'),'appdata':_0x5b3346['name']+','+(_0x2ab809[_0x21e0('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x21e0('0x6f')}]},routingClient);})[_0x21e0('0x8')](respondWithResult(_0x15fbfd,null))[_0x21e0('0xb')](handleError(_0x15fbfd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 74afa0a..ab5b613 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 _0x457f=['create','put','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','/:id/run','run'];(function(_0x10a35c,_0x3275b7){var _0x18eff2=function(_0x3e0d0c){while(--_0x3e0d0c){_0x10a35c['push'](_0x10a35c['shift']());}};_0x18eff2(++_0x3275b7);}(_0x457f,0x163));var _0xf457=function(_0x18a8e8,_0x2fa2b0){_0x18a8e8=_0x18a8e8-0x0;var _0x49fdac=_0x457f[_0x18a8e8];return _0x49fdac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf457('0x0'));var timeout=require(_0xf457('0x1'));var express=require(_0xf457('0x2'));var router=express['Router']();var fs_extra=require(_0xf457('0x3'));var auth=require(_0xf457('0x4'));var interaction=require(_0xf457('0x5'));var config=require('../../config/environment');var controller=require(_0xf457('0x6'));router[_0xf457('0x7')]('/',auth['isAuthenticated'](),controller[_0xf457('0x8')]);router[_0xf457('0x7')](_0xf457('0x9'),auth[_0xf457('0xa')](),controller['show']);router['get'](_0xf457('0xb'),auth['isAuthenticated'](),controller[_0xf457('0xc')]);router['post']('/',auth[_0xf457('0xa')](),controller[_0xf457('0xd')]);router[_0xf457('0xe')](_0xf457('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xf457('0xf')](_0xf457('0x9'),auth[_0xf457('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x16c2=['delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','/:id','/:id/run','run','post','update'];(function(_0x1244a1,_0x2e7359){var _0x278f3d=function(_0x1a4fd7){while(--_0x1a4fd7){_0x1244a1['push'](_0x1244a1['shift']());}};_0x278f3d(++_0x2e7359);}(_0x16c2,0x171));var _0x216c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16c2[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x216c('0x0'));var util=require('util');var path=require(_0x216c('0x1'));var timeout=require(_0x216c('0x2'));var express=require('express');var router=express[_0x216c('0x3')]();var fs_extra=require(_0x216c('0x4'));var auth=require(_0x216c('0x5'));var interaction=require(_0x216c('0x6'));var config=require('../../config/environment');var controller=require(_0x216c('0x7'));router[_0x216c('0x8')]('/',auth[_0x216c('0x9')](),controller['index']);router[_0x216c('0x8')](_0x216c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x216c('0x8')](_0x216c('0xb'),auth[_0x216c('0x9')](),controller[_0x216c('0xc')]);router[_0x216c('0xd')]('/',auth[_0x216c('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x216c('0xe')]);router[_0x216c('0xf')](_0x216c('0xa'),auth[_0x216c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e8a254d..d9270eb 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 _0xb82c=['hours','csv','pdf','xlsx','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','weeks','days'];(function(_0xa633e2,_0xc85ba8){var _0x57e2dd=function(_0xa3ecb7){while(--_0xa3ecb7){_0xa633e2['push'](_0xa633e2['shift']());}};_0x57e2dd(++_0xc85ba8);}(_0xb82c,0xf4));var _0xcb82=function(_0x552d53,_0x56ced2){_0x552d53=_0x552d53-0x0;var _0x2cc575=_0xb82c[_0x552d53];return _0x2cc575;};'use strict';var Sequelize=require(_0xcb82('0x0'));module[_0xcb82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcb82('0x2')]},'active':{'type':Sequelize[_0xcb82('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xcb82('0x2')],'allowNull':![],'defaultValue':_0xcb82('0x4')},'startAt':{'type':Sequelize[_0xcb82('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcb82('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xcb82('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcb82('0x7')]('years',_0xcb82('0x8'),'months',_0xcb82('0x9'),_0xcb82('0xa'),_0xcb82('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xcb82('0xa')},'output':{'type':Sequelize[_0xcb82('0x7')](_0xcb82('0xc'),_0xcb82('0xd'),_0xcb82('0xe')),'allowNull':![],'defaultValue':_0xcb82('0xc')},'type':{'type':Sequelize[_0xcb82('0x7')]('custom',_0xcb82('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xcb82('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xcb82('0x10')]},'bcc':{'type':Sequelize[_0xcb82('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xcb82('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa8e8=['xlsx','default','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf'];(function(_0x8fbc60,_0x2b1dd5){var _0x44e6dd=function(_0x2dd901){while(--_0x2dd901){_0x8fbc60['push'](_0x8fbc60['shift']());}};_0x44e6dd(++_0x2b1dd5);}(_0xa8e8,0x101));var _0x8a8e=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xa8e8[_0x30cd7e];return _0x462a02;};'use strict';var Sequelize=require(_0x8a8e('0x0'));module[_0x8a8e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8a8e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8a8e('0x3')},'startAt':{'type':Sequelize[_0x8a8e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8a8e('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8a8e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8a8e('0x6')](_0x8a8e('0x7'),_0x8a8e('0x8'),_0x8a8e('0x9'),_0x8a8e('0xa'),'days',_0x8a8e('0xb'),_0x8a8e('0xc')),'allowNull':![],'defaultValue':_0x8a8e('0xd')},'output':{'type':Sequelize[_0x8a8e('0x6')](_0x8a8e('0xe'),_0x8a8e('0xf'),_0x8a8e('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom',_0x8a8e('0x11')),'allowNull':![],'defaultValue':_0x8a8e('0x12')},'sendMail':{'type':Sequelize[_0x8a8e('0x13')],'defaultValue':![]},'email':{'type':Sequelize[_0x8a8e('0x2')]},'cc':{'type':Sequelize[_0x8a8e('0x14')]},'bcc':{'type':Sequelize[_0x8a8e('0x14')]},'sendIfEmpty':{'type':Sequelize[_0x8a8e('0x13')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d815e88..b7c6ec1 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 _0x06bd=['role','Scheduler','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','status','error','stack','name','send','map','Schedule','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1241db,_0x4c1b73){var _0x11d9ec=function(_0x149d46){while(--_0x149d46){_0x1241db['push'](_0x1241db['shift']());}};_0x11d9ec(++_0x4c1b73);}(_0x06bd,0xb2));var _0xd06b=function(_0x3c8499,_0x1e052e){_0x3c8499=_0x3c8499-0x0;var _0x51d346=_0x06bd[_0x3c8499];return _0x51d346;};'use strict';var emlformat=require(_0xd06b('0x0'));var rimraf=require(_0xd06b('0x1'));var zipdir=require(_0xd06b('0x2'));var jsonpatch=require(_0xd06b('0x3'));var rp=require(_0xd06b('0x4'));var moment=require('moment');var BPromise=require(_0xd06b('0x5'));var Mustache=require(_0xd06b('0x6'));var util=require(_0xd06b('0x7'));var path=require(_0xd06b('0x8'));var sox=require(_0xd06b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd06b('0xa'));var squel=require(_0xd06b('0xb'));var crypto=require(_0xd06b('0xc'));var jsforce=require(_0xd06b('0xd'));var deskjs=require(_0xd06b('0xe'));var toCsv=require(_0xd06b('0xf'));var querystring=require(_0xd06b('0x10'));var Papa=require('papaparse');var Redis=require(_0xd06b('0x11'));var authService=require(_0xd06b('0x12'));var qs=require(_0xd06b('0x13'));var as=require(_0xd06b('0x14'));var hardwareService=require(_0xd06b('0x15'));var logger=require('../../config/logger')(_0xd06b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd06b('0x17'))['db'];function respondWithStatusCode(_0x1c5f86,_0x584371){_0x584371=_0x584371||0xcc;return function(_0xabe3a6){if(_0xabe3a6){return _0x1c5f86[_0xd06b('0x18')](_0x584371);}return _0x1c5f86['status'](_0x584371)[_0xd06b('0x19')]();};}function respondWithResult(_0x2206b8,_0x1ca9e3){_0x1ca9e3=_0x1ca9e3||0xc8;return function(_0x145fb4){if(_0x145fb4){return _0x2206b8['status'](_0x1ca9e3)[_0xd06b('0x1a')](_0x145fb4);}};}function respondWithFilteredResult(_0xd65fed,_0x48b799){return function(_0x3b1f10){if(_0x3b1f10){var _0x2a8b72=typeof _0x48b799[_0xd06b('0x1b')]===_0xd06b('0x1c')&&typeof _0x48b799[_0xd06b('0x1d')]===_0xd06b('0x1c');var _0x3eaa6e=_0x3b1f10[_0xd06b('0x1e')];var _0x44ebea=_0x2a8b72?0x0:_0x48b799[_0xd06b('0x1b')];var _0x32b368=_0x2a8b72?_0x3b1f10['count']:_0x48b799[_0xd06b('0x1b')]+_0x48b799[_0xd06b('0x1d')];var _0x2bbeac;if(_0x32b368>=_0x3eaa6e){_0x32b368=_0x3eaa6e;_0x2bbeac=0xc8;}else{_0x2bbeac=0xce;}_0xd65fed['status'](_0x2bbeac);return _0xd65fed[_0xd06b('0x1f')](_0xd06b('0x20'),_0x44ebea+'-'+_0x32b368+'/'+_0x3eaa6e)['json'](_0x3b1f10);}return null;};}function patchUpdates(_0x46de31){return function(_0x3f6868){try{jsonpatch[_0xd06b('0x21')](_0x3f6868,_0x46de31,!![]);}catch(_0x4840c8){return BPromise[_0xd06b('0x22')](_0x4840c8);}return _0x3f6868[_0xd06b('0x23')]();};}function saveUpdates(_0x20b8ab,_0x5c1568){return function(_0x4dd9b5){if(_0x4dd9b5){return _0x4dd9b5[_0xd06b('0x24')](_0x20b8ab)[_0xd06b('0x25')](function(_0x5cab2f){return _0x5cab2f;});}return null;};}function removeEntity(_0xc4f212,_0x2ccdb5){return function(_0x5e3284){if(_0x5e3284){return _0x5e3284[_0xd06b('0x26')]()[_0xd06b('0x25')](function(){var _0x5c9567=_0x5e3284[_0xd06b('0x27')]({'plain':!![]});var _0x270324='Scheduler';return db[_0xd06b('0x28')][_0xd06b('0x26')]({'where':{'type':_0x270324,'resourceId':_0x5c9567['id']}})['then'](function(){return _0x5e3284;});})[_0xd06b('0x25')](function(){_0xc4f212[_0xd06b('0x29')](0xcc)[_0xd06b('0x19')]();});}};}function handleEntityNotFound(_0x53601d,_0x49fc71){return function(_0x270843){if(!_0x270843){_0x53601d[_0xd06b('0x18')](0x194);}return _0x270843;};}function handleError(_0x76d251,_0x234e1b){_0x234e1b=_0x234e1b||0x1f4;return function(_0x322cd7){logger[_0xd06b('0x2a')](_0x322cd7[_0xd06b('0x2b')]);if(_0x322cd7[_0xd06b('0x2c')]){delete _0x322cd7[_0xd06b('0x2c')];}_0x76d251['status'](_0x234e1b)[_0xd06b('0x2d')](_0x322cd7);};}exports['index']=function(_0x145931,_0x2f30bb){var _0x1541b1={},_0x14e570={},_0x51611b={'count':0x0,'rows':[]};var _0x43d2a7=_[_0xd06b('0x2e')](db[_0xd06b('0x2f')]['rawAttributes'],function(_0x287594){return{'name':_0x287594[_0xd06b('0x30')],'type':_0x287594[_0xd06b('0x31')][_0xd06b('0x32')]};});_0x14e570[_0xd06b('0x33')]=_[_0xd06b('0x2e')](_0x43d2a7,_0xd06b('0x2c'));_0x14e570[_0xd06b('0x34')]=_[_0xd06b('0x35')](_0x145931[_0xd06b('0x34')]);_0x14e570['filters']=_[_0xd06b('0x36')](_0x14e570['model'],_0x14e570['query']);_0x1541b1[_0xd06b('0x37')]=_['intersection'](_0x14e570[_0xd06b('0x33')],qs[_0xd06b('0x38')](_0x145931[_0xd06b('0x34')]['fields']));_0x1541b1['attributes']=_0x1541b1[_0xd06b('0x37')][_0xd06b('0x39')]?_0x1541b1[_0xd06b('0x37')]:_0x14e570[_0xd06b('0x33')];if(!_0x145931[_0xd06b('0x34')][_0xd06b('0x3a')]('nolimit')){_0x1541b1[_0xd06b('0x1d')]=qs[_0xd06b('0x1d')](_0x145931[_0xd06b('0x34')]['limit']);_0x1541b1[_0xd06b('0x1b')]=qs['offset'](_0x145931[_0xd06b('0x34')][_0xd06b('0x1b')]);}_0x1541b1[_0xd06b('0x3b')]=qs[_0xd06b('0x3c')](_0x145931[_0xd06b('0x34')][_0xd06b('0x3c')]);_0x1541b1[_0xd06b('0x3d')]=qs[_0xd06b('0x3e')](_['pick'](_0x145931[_0xd06b('0x34')],_0x14e570['filters']),_0x43d2a7);if(_0x145931[_0xd06b('0x34')][_0xd06b('0x3f')]){_0x1541b1[_0xd06b('0x3d')]=_['merge'](_0x1541b1['where'],{'$or':_[_0xd06b('0x2e')](_0x43d2a7,function(_0x1edebb){if(_0x1edebb[_0xd06b('0x31')]!==_0xd06b('0x40')){var _0x14ae5a={};_0x14ae5a[_0x1edebb[_0xd06b('0x2c')]]={'$like':'%'+_0x145931[_0xd06b('0x34')]['filter']+'%'};return _0x14ae5a;}})});}_0x1541b1=_[_0xd06b('0x41')]({},_0x1541b1,_0x145931['options']);var _0xf9a40b={'where':_0x1541b1['where']};return db[_0xd06b('0x2f')][_0xd06b('0x1e')](_0xf9a40b)[_0xd06b('0x25')](function(_0x3e9558){_0x51611b[_0xd06b('0x1e')]=_0x3e9558;if(_0x145931['query'][_0xd06b('0x42')]){_0x1541b1[_0xd06b('0x43')]=[{'all':!![]}];}return db['Schedule'][_0xd06b('0x44')](_0x1541b1);})[_0xd06b('0x25')](function(_0x561f76){_0x51611b[_0xd06b('0x45')]=_0x561f76;return _0x51611b;})[_0xd06b('0x25')](respondWithFilteredResult(_0x2f30bb,_0x1541b1))[_0xd06b('0x46')](handleError(_0x2f30bb,null));};exports[_0xd06b('0x47')]=function(_0x58afeb,_0x27ef96){var _0x1b5ed9={'raw':![],'where':{'id':_0x58afeb[_0xd06b('0x48')]['id']}},_0x1515c7={};_0x1515c7[_0xd06b('0x33')]=_[_0xd06b('0x35')](db[_0xd06b('0x2f')]['rawAttributes']);_0x1515c7[_0xd06b('0x34')]=_[_0xd06b('0x35')](_0x58afeb[_0xd06b('0x34')]);_0x1515c7[_0xd06b('0x3e')]=_[_0xd06b('0x36')](_0x1515c7[_0xd06b('0x33')],_0x1515c7['query']);_0x1b5ed9[_0xd06b('0x37')]=_[_0xd06b('0x36')](_0x1515c7['model'],qs[_0xd06b('0x38')](_0x58afeb[_0xd06b('0x34')][_0xd06b('0x38')]));_0x1b5ed9['attributes']=_0x1b5ed9[_0xd06b('0x37')][_0xd06b('0x39')]?_0x1b5ed9['attributes']:_0x1515c7[_0xd06b('0x33')];if(_0x58afeb[_0xd06b('0x34')][_0xd06b('0x42')]){_0x1b5ed9['include']=[{'all':!![]}];}_0x1b5ed9=_[_0xd06b('0x41')]({},_0x1b5ed9,_0x58afeb['options']);return db[_0xd06b('0x2f')]['find'](_0x1b5ed9)[_0xd06b('0x25')](handleEntityNotFound(_0x27ef96,null))[_0xd06b('0x25')](respondWithResult(_0x27ef96,null))[_0xd06b('0x46')](handleError(_0x27ef96,null));};exports[_0xd06b('0x49')]=function(_0x6180c7,_0x3f39cf){return db[_0xd06b('0x2f')][_0xd06b('0x49')](_0x6180c7[_0xd06b('0x4a')],{})['then'](function(_0x1e4858){var _0x587059=_0x6180c7[_0xd06b('0x4b')]['get']({'plain':!![]});if(!_0x587059)throw new Error(_0xd06b('0x4c'));if(_0x587059[_0xd06b('0x4d')]===_0xd06b('0x4b')){var _0x477b12=_0x1e4858[_0xd06b('0x27')]({'plain':!![]});var _0x5c7e17=_0xd06b('0x4e');return db[_0xd06b('0x4f')][_0xd06b('0x50')]({'where':{'name':_0x5c7e17,'userProfileId':_0x587059[_0xd06b('0x51')]},'raw':!![]})[_0xd06b('0x25')](function(_0x3a6437){if(_0x3a6437&&_0x3a6437['autoAssociation']===0x0){return db[_0xd06b('0x28')][_0xd06b('0x49')]({'name':_0x477b12[_0xd06b('0x2c')],'resourceId':_0x477b12['id'],'type':_0x3a6437[_0xd06b('0x2c')],'sectionId':_0x3a6437['id']},{})[_0xd06b('0x25')](function(){return _0x1e4858;});}else{return _0x1e4858;}})[_0xd06b('0x46')](function(_0x15d6e3){logger[_0xd06b('0x2a')](_0xd06b('0x52'),_0x15d6e3);throw _0x15d6e3;});}return _0x1e4858;})[_0xd06b('0x25')](respondWithResult(_0x3f39cf,0xc9))['catch'](handleError(_0x3f39cf,null));};exports[_0xd06b('0x24')]=function(_0x1c3d56,_0x3eb112){if(_0x1c3d56[_0xd06b('0x4a')]['id']){delete _0x1c3d56[_0xd06b('0x4a')]['id'];}return db['Schedule'][_0xd06b('0x50')]({'where':{'id':_0x1c3d56[_0xd06b('0x48')]['id']}})[_0xd06b('0x25')](handleEntityNotFound(_0x3eb112,null))['then'](saveUpdates(_0x1c3d56[_0xd06b('0x4a')],null))[_0xd06b('0x25')](respondWithResult(_0x3eb112,null))['catch'](handleError(_0x3eb112,null));};exports[_0xd06b('0x26')]=function(_0x1eedf3,_0x541cb4){return db[_0xd06b('0x2f')][_0xd06b('0x50')]({'where':{'id':_0x1eedf3[_0xd06b('0x48')]['id']}})[_0xd06b('0x25')](handleEntityNotFound(_0x541cb4,null))[_0xd06b('0x25')](removeEntity(_0x541cb4,null))['catch'](handleError(_0x541cb4,null));};exports[_0xd06b('0x53')]=function(_0x548764,_0x4b3043,_0x34fce3){var _0x2a0446=require(_0xd06b('0x54'));return db['Schedule'][_0xd06b('0x50')]({'where':{'id':_0x548764[_0xd06b('0x48')]['id']},'raw':!![]})[_0xd06b('0x25')](handleEntityNotFound(_0x4b3043,null))['then'](function(){_0x2a0446[_0xd06b('0x53')](_0x548764[_0xd06b('0x48')]['id']);})['then'](respondWithStatusCode(_0x4b3043,null))[_0xd06b('0x46')](handleError(_0x4b3043,null));}; \ No newline at end of file +var _0xfbba=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Scheduler','UserProfileSection','find','UserProfileResource','run','../../config/schedule','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5e54e4,_0x1e9219){var _0x8a9935=function(_0x49206e){while(--_0x49206e){_0x5e54e4['push'](_0x5e54e4['shift']());}};_0x8a9935(++_0x1e9219);}(_0xfbba,0x191));var _0xafbb=function(_0x4cc0ab,_0x2c62ae){_0x4cc0ab=_0x4cc0ab-0x0;var _0x3eba37=_0xfbba[_0x4cc0ab];return _0x3eba37;};'use strict';var emlformat=require(_0xafbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafbb('0x1'));var rp=require(_0xafbb('0x2'));var moment=require('moment');var BPromise=require(_0xafbb('0x3'));var Mustache=require(_0xafbb('0x4'));var util=require(_0xafbb('0x5'));var path=require(_0xafbb('0x6'));var sox=require(_0xafbb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafbb('0x8'));var _=require(_0xafbb('0x9'));var squel=require(_0xafbb('0xa'));var crypto=require(_0xafbb('0xb'));var jsforce=require(_0xafbb('0xc'));var deskjs=require(_0xafbb('0xd'));var toCsv=require(_0xafbb('0xe'));var querystring=require(_0xafbb('0xf'));var Papa=require(_0xafbb('0x10'));var Redis=require(_0xafbb('0x11'));var authService=require(_0xafbb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xafbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xafbb('0x14'));var utils=require(_0xafbb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xafbb('0x16'));var db=require(_0xafbb('0x17'))['db'];function respondWithStatusCode(_0x2937d1,_0x689da7){_0x689da7=_0x689da7||0xcc;return function(_0x333d8d){if(_0x333d8d){return _0x2937d1[_0xafbb('0x18')](_0x689da7);}return _0x2937d1[_0xafbb('0x19')](_0x689da7)[_0xafbb('0x1a')]();};}function respondWithResult(_0x257d51,_0x3c2934){_0x3c2934=_0x3c2934||0xc8;return function(_0x4a0b23){if(_0x4a0b23){return _0x257d51[_0xafbb('0x19')](_0x3c2934)[_0xafbb('0x1b')](_0x4a0b23);}};}function respondWithFilteredResult(_0x3da567,_0xd6fc1b){return function(_0x4283de){if(_0x4283de){var _0x466ec6=typeof _0xd6fc1b[_0xafbb('0x1c')]==='undefined'&&typeof _0xd6fc1b[_0xafbb('0x1d')]===_0xafbb('0x1e');var _0x1983e2=_0x4283de[_0xafbb('0x1f')];var _0x460256=_0x466ec6?0x0:_0xd6fc1b[_0xafbb('0x1c')];var _0x3b5d88=_0x466ec6?_0x4283de['count']:_0xd6fc1b['offset']+_0xd6fc1b['limit'];var _0x5d0634;if(_0x3b5d88>=_0x1983e2){_0x3b5d88=_0x1983e2;_0x5d0634=0xc8;}else{_0x5d0634=0xce;}_0x3da567[_0xafbb('0x19')](_0x5d0634);return _0x3da567[_0xafbb('0x20')](_0xafbb('0x21'),_0x460256+'-'+_0x3b5d88+'/'+_0x1983e2)[_0xafbb('0x1b')](_0x4283de);}return null;};}function patchUpdates(_0x502136){return function(_0xb03cdb){try{jsonpatch['apply'](_0xb03cdb,_0x502136,!![]);}catch(_0x37d0a7){return BPromise[_0xafbb('0x22')](_0x37d0a7);}return _0xb03cdb[_0xafbb('0x23')]();};}function saveUpdates(_0x155267,_0x8b5bfd){return function(_0x58a0ec){if(_0x58a0ec){return _0x58a0ec[_0xafbb('0x24')](_0x155267)[_0xafbb('0x25')](function(_0x479e1c){return _0x479e1c;});}return null;};}function removeEntity(_0x4ffa5b,_0x2211e7){return function(_0x2b4ed6){if(_0x2b4ed6){return _0x2b4ed6[_0xafbb('0x26')]()[_0xafbb('0x25')](function(){var _0x246dd9=_0x2b4ed6['get']({'plain':!![]});var _0xe5a8a0='Scheduler';return db['UserProfileResource'][_0xafbb('0x26')]({'where':{'type':_0xe5a8a0,'resourceId':_0x246dd9['id']}})['then'](function(){return _0x2b4ed6;});})[_0xafbb('0x25')](function(){_0x4ffa5b[_0xafbb('0x19')](0xcc)[_0xafbb('0x1a')]();});}};}function handleEntityNotFound(_0x134ae7,_0x196e9f){return function(_0x1f68bf){if(!_0x1f68bf){_0x134ae7[_0xafbb('0x18')](0x194);}return _0x1f68bf;};}function handleError(_0x38e747,_0x43559b){_0x43559b=_0x43559b||0x1f4;return function(_0x47c012){logger[_0xafbb('0x27')](_0x47c012[_0xafbb('0x28')]);if(_0x47c012['name']){delete _0x47c012[_0xafbb('0x29')];}_0x38e747[_0xafbb('0x19')](_0x43559b)['send'](_0x47c012);};}exports[_0xafbb('0x2a')]=function(_0x22eae6,_0x2f2a01){var _0x2aea3f={},_0x1c887c={},_0x8d730c={'count':0x0,'rows':[]};var _0x326501=_[_0xafbb('0x2b')](db[_0xafbb('0x2c')][_0xafbb('0x2d')],function(_0x5894a0){return{'name':_0x5894a0[_0xafbb('0x2e')],'type':_0x5894a0[_0xafbb('0x2f')][_0xafbb('0x30')]};});_0x1c887c[_0xafbb('0x31')]=_['map'](_0x326501,'name');_0x1c887c[_0xafbb('0x32')]=_[_0xafbb('0x33')](_0x22eae6[_0xafbb('0x32')]);_0x1c887c[_0xafbb('0x34')]=_[_0xafbb('0x35')](_0x1c887c[_0xafbb('0x31')],_0x1c887c[_0xafbb('0x32')]);_0x2aea3f[_0xafbb('0x36')]=_[_0xafbb('0x35')](_0x1c887c['model'],qs[_0xafbb('0x37')](_0x22eae6['query']['fields']));_0x2aea3f[_0xafbb('0x36')]=_0x2aea3f[_0xafbb('0x36')]['length']?_0x2aea3f[_0xafbb('0x36')]:_0x1c887c[_0xafbb('0x31')];if(!_0x22eae6[_0xafbb('0x32')][_0xafbb('0x38')](_0xafbb('0x39'))){_0x2aea3f[_0xafbb('0x1d')]=qs['limit'](_0x22eae6[_0xafbb('0x32')][_0xafbb('0x1d')]);_0x2aea3f[_0xafbb('0x1c')]=qs['offset'](_0x22eae6[_0xafbb('0x32')]['offset']);}_0x2aea3f['order']=qs[_0xafbb('0x3a')](_0x22eae6[_0xafbb('0x32')][_0xafbb('0x3a')]);_0x2aea3f[_0xafbb('0x3b')]=qs[_0xafbb('0x34')](_['pick'](_0x22eae6[_0xafbb('0x32')],_0x1c887c[_0xafbb('0x34')]),_0x326501);if(_0x22eae6['query'][_0xafbb('0x3c')]){_0x2aea3f[_0xafbb('0x3b')]=_[_0xafbb('0x3d')](_0x2aea3f['where'],{'$or':_[_0xafbb('0x2b')](_0x326501,function(_0x33bfbd){if(_0x33bfbd[_0xafbb('0x2f')]!==_0xafbb('0x3e')){var _0x3859f8={};_0x3859f8[_0x33bfbd[_0xafbb('0x29')]]={'$like':'%'+_0x22eae6['query'][_0xafbb('0x3c')]+'%'};return _0x3859f8;}})});}_0x2aea3f=_[_0xafbb('0x3d')]({},_0x2aea3f,_0x22eae6[_0xafbb('0x3f')]);var _0x479c24={'where':_0x2aea3f['where']};return db[_0xafbb('0x2c')][_0xafbb('0x1f')](_0x479c24)['then'](function(_0x15dd24){_0x8d730c[_0xafbb('0x1f')]=_0x15dd24;if(_0x22eae6[_0xafbb('0x32')][_0xafbb('0x40')]){_0x2aea3f[_0xafbb('0x41')]=[{'all':!![]}];}return db[_0xafbb('0x2c')]['findAll'](_0x2aea3f);})['then'](function(_0x27c3aa){_0x8d730c[_0xafbb('0x42')]=_0x27c3aa;return _0x8d730c;})[_0xafbb('0x25')](respondWithFilteredResult(_0x2f2a01,_0x2aea3f))[_0xafbb('0x43')](handleError(_0x2f2a01,null));};exports[_0xafbb('0x44')]=function(_0x4221d3,_0x48acc1){var _0x57f58f={'raw':![],'where':{'id':_0x4221d3[_0xafbb('0x45')]['id']}},_0x5b9ee6={};_0x5b9ee6['model']=_[_0xafbb('0x33')](db[_0xafbb('0x2c')]['rawAttributes']);_0x5b9ee6[_0xafbb('0x32')]=_['keys'](_0x4221d3['query']);_0x5b9ee6[_0xafbb('0x34')]=_[_0xafbb('0x35')](_0x5b9ee6[_0xafbb('0x31')],_0x5b9ee6[_0xafbb('0x32')]);_0x57f58f[_0xafbb('0x36')]=_[_0xafbb('0x35')](_0x5b9ee6[_0xafbb('0x31')],qs[_0xafbb('0x37')](_0x4221d3[_0xafbb('0x32')][_0xafbb('0x37')]));_0x57f58f[_0xafbb('0x36')]=_0x57f58f[_0xafbb('0x36')][_0xafbb('0x46')]?_0x57f58f['attributes']:_0x5b9ee6[_0xafbb('0x31')];if(_0x4221d3[_0xafbb('0x32')][_0xafbb('0x40')]){_0x57f58f[_0xafbb('0x41')]=[{'all':!![]}];}_0x57f58f=_[_0xafbb('0x3d')]({},_0x57f58f,_0x4221d3[_0xafbb('0x3f')]);return db['Schedule']['find'](_0x57f58f)[_0xafbb('0x25')](handleEntityNotFound(_0x48acc1,null))['then'](respondWithResult(_0x48acc1,null))[_0xafbb('0x43')](handleError(_0x48acc1,null));};exports[_0xafbb('0x47')]=function(_0x1e098f,_0x357c50){return db[_0xafbb('0x2c')]['create'](_0x1e098f[_0xafbb('0x48')],{})[_0xafbb('0x25')](function(_0x557745){var _0xd1cc9=_0x1e098f[_0xafbb('0x49')]['get']({'plain':!![]});if(!_0xd1cc9)throw new Error(_0xafbb('0x4a'));if(_0xd1cc9[_0xafbb('0x4b')]===_0xafbb('0x49')){var _0x4a58e5=_0x557745[_0xafbb('0x4c')]({'plain':!![]});var _0x5eadc8=_0xafbb('0x4d');return db[_0xafbb('0x4e')][_0xafbb('0x4f')]({'where':{'name':_0x5eadc8,'userProfileId':_0xd1cc9['userProfileId']},'raw':!![]})[_0xafbb('0x25')](function(_0x1abc56){if(_0x1abc56&&_0x1abc56['autoAssociation']===0x0){return db[_0xafbb('0x50')]['create']({'name':_0x4a58e5[_0xafbb('0x29')],'resourceId':_0x4a58e5['id'],'type':_0x1abc56['name'],'sectionId':_0x1abc56['id']},{})[_0xafbb('0x25')](function(){return _0x557745;});}else{return _0x557745;}})[_0xafbb('0x43')](function(_0x1640fe){logger[_0xafbb('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1640fe);throw _0x1640fe;});}return _0x557745;})['then'](respondWithResult(_0x357c50,0xc9))[_0xafbb('0x43')](handleError(_0x357c50,null));};exports[_0xafbb('0x24')]=function(_0x51e409,_0x3a8004){if(_0x51e409['body']['id']){delete _0x51e409[_0xafbb('0x48')]['id'];}return db[_0xafbb('0x2c')][_0xafbb('0x4f')]({'where':{'id':_0x51e409[_0xafbb('0x45')]['id']}})[_0xafbb('0x25')](handleEntityNotFound(_0x3a8004,null))[_0xafbb('0x25')](saveUpdates(_0x51e409[_0xafbb('0x48')],null))[_0xafbb('0x25')](respondWithResult(_0x3a8004,null))[_0xafbb('0x43')](handleError(_0x3a8004,null));};exports[_0xafbb('0x26')]=function(_0x648d13,_0x4c5dad){return db[_0xafbb('0x2c')][_0xafbb('0x4f')]({'where':{'id':_0x648d13[_0xafbb('0x45')]['id']}})[_0xafbb('0x25')](handleEntityNotFound(_0x4c5dad,null))['then'](removeEntity(_0x4c5dad,null))[_0xafbb('0x43')](handleError(_0x4c5dad,null));};exports[_0xafbb('0x51')]=function(_0x315218,_0x3b5b36,_0x36467f){var _0x237e70=require(_0xafbb('0x52'));return db['Schedule'][_0xafbb('0x4f')]({'where':{'id':_0x315218[_0xafbb('0x45')]['id']},'raw':!![]})[_0xafbb('0x25')](handleEntityNotFound(_0x3b5b36,null))[_0xafbb('0x25')](function(){_0x237e70[_0xafbb('0x51')](_0x315218[_0xafbb('0x45')]['id']);})['then'](respondWithStatusCode(_0x3b5b36,null))[_0xafbb('0x43')](handleError(_0x3b5b36,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 641d9df..109611b 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 _0x3c5f=['util','../../config/logger','api','moment','request-promise','exports','define','tools_schedules'];(function(_0xf2c25d,_0x2c3260){var _0x2c2291=function(_0x1c2028){while(--_0x1c2028){_0xf2c25d['push'](_0xf2c25d['shift']());}};_0x2c2291(++_0x2c3260);}(_0x3c5f,0x110));var _0xf3c5=function(_0x199f7b,_0x5ab14b){_0x199f7b=_0x199f7b-0x0;var _0x546b95=_0x3c5f[_0x199f7b];return _0x546b95;};'use strict';var _=require('lodash');var util=require(_0xf3c5('0x0'));var logger=require(_0xf3c5('0x1'))(_0xf3c5('0x2'));var moment=require(_0xf3c5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf3c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xf3c5('0x5')]=function(_0x4dd86b,_0x35bc85){return _0x4dd86b[_0xf3c5('0x6')]('Schedule',attributes,{'tableName':_0xf3c5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4518=['path','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','api','moment','bluebird'];(function(_0x17a7a9,_0x35d809){var _0x4280ab=function(_0x4bdf58){while(--_0x4bdf58){_0x17a7a9['push'](_0x17a7a9['shift']());}};_0x4280ab(++_0x35d809);}(_0x4518,0xd7));var _0x8451=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x4518[_0x5cbace];return _0x6de5b8;};'use strict';var _=require(_0x8451('0x0'));var util=require(_0x8451('0x1'));var logger=require('../../config/logger')(_0x8451('0x2'));var moment=require(_0x8451('0x3'));var BPromise=require(_0x8451('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8451('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8451('0x6'));module[_0x8451('0x7')]=function(_0x1185bf,_0xd112cd){return _0x1185bf[_0x8451('0x8')](_0x8451('0x9'),attributes,{'tableName':_0x8451('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 0179fca..81984e7 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 _0x321d=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x321d,0xca));var _0xd321=function(_0x20865b,_0x54cd35){_0x20865b=_0x20865b-0x0;var _0x272305=_0x321d[_0x20865b];return _0x272305;};'use strict';var _=require(_0xd321('0x0'));var util=require(_0xd321('0x1'));var moment=require(_0xd321('0x2'));var BPromise=require('bluebird');var rs=require(_0xd321('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd321('0x4'))['db'];var utils=require(_0xd321('0x5'));var logger=require(_0xd321('0x6'))(_0xd321('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd321('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x370baa,_0x44b443,_0x25e555){return new BPromise(function(_0x121756,_0x286304){return client[_0xd321('0x9')](_0x370baa,_0x25e555)[_0xd321('0xa')](function(_0x1223a5){logger[_0xd321('0xb')](_0xd321('0xc'),_0x44b443,'request\x20sent');logger[_0xd321('0xd')](_0xd321('0xe'),_0x44b443,'request\x20sent',JSON[_0xd321('0xf')](_0x1223a5));if(_0x1223a5['error']){if(_0x1223a5[_0xd321('0x10')][_0xd321('0x11')]===0x1f4){logger[_0xd321('0x10')]('Schedule,\x20%s,\x20%s',_0x44b443,_0x1223a5['error'][_0xd321('0x12')]);return _0x286304(_0x1223a5[_0xd321('0x10')]['message']);}logger[_0xd321('0x10')]('Schedule,\x20%s,\x20%s',_0x44b443,_0x1223a5[_0xd321('0x10')][_0xd321('0x12')]);return _0x121756(_0x1223a5[_0xd321('0x10')][_0xd321('0x12')]);}else{logger[_0xd321('0xb')](_0xd321('0xc'),_0x44b443,'request\x20sent');_0x121756(_0x1223a5['result'][_0xd321('0x12')]);}})[_0xd321('0x13')](function(_0x131304){logger[_0xd321('0x10')](_0xd321('0xc'),_0x44b443,_0x131304);_0x286304(_0x131304);});});} \ No newline at end of file +var _0xb4ee=['debug','error','code','message','info','request\x20sent','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','Schedule,\x20%s,\x20%s'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xb4ee,0x1e6));var _0xeb4e=function(_0x1af3be,_0x594198){_0x1af3be=_0x1af3be-0x0;var _0x374a3b=_0xb4ee[_0x1af3be];return _0x374a3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeb4e('0x0'));var BPromise=require(_0xeb4e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb4e('0x2'))['db'];var utils=require(_0xeb4e('0x3'));var logger=require(_0xeb4e('0x4'))(_0xeb4e('0x5'));var config=require(_0xeb4e('0x6'));var jayson=require(_0xeb4e('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b861e,_0x3df20d,_0x376f75){return new BPromise(function(_0x4d4711,_0x5f436e){return client['request'](_0x3b861e,_0x376f75)[_0xeb4e('0x8')](function(_0x1e00c8){logger['info'](_0xeb4e('0x9'),_0x3df20d,'request\x20sent');logger[_0xeb4e('0xa')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3df20d,'request\x20sent',JSON['stringify'](_0x1e00c8));if(_0x1e00c8[_0xeb4e('0xb')]){if(_0x1e00c8['error'][_0xeb4e('0xc')]===0x1f4){logger[_0xeb4e('0xb')](_0xeb4e('0x9'),_0x3df20d,_0x1e00c8[_0xeb4e('0xb')]['message']);return _0x5f436e(_0x1e00c8[_0xeb4e('0xb')][_0xeb4e('0xd')]);}logger[_0xeb4e('0xb')](_0xeb4e('0x9'),_0x3df20d,_0x1e00c8[_0xeb4e('0xb')][_0xeb4e('0xd')]);return _0x4d4711(_0x1e00c8[_0xeb4e('0xb')][_0xeb4e('0xd')]);}else{logger[_0xeb4e('0xe')](_0xeb4e('0x9'),_0x3df20d,_0xeb4e('0xf'));_0x4d4711(_0x1e00c8['result'][_0xeb4e('0xd')]);}})['catch'](function(_0x309362){logger[_0xeb4e('0xb')](_0xeb4e('0x9'),_0x3df20d,_0x309362);_0x5f436e(_0x309362);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 070b849..391985e 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 _0xf54b=['get','isAuthenticated','index','/describe','describe','/:id','show','download','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x16f88c,_0x2aad29){var _0x20ab2e=function(_0x438525){while(--_0x438525){_0x16f88c['push'](_0x16f88c['shift']());}};_0x20ab2e(++_0x2aad29);}(_0xf54b,0xb4));var _0xbf54=function(_0x1fb6e2,_0x3a22ce){_0x1fb6e2=_0x1fb6e2-0x0;var _0x354690=_0xf54b[_0x1fb6e2];return _0x354690;};'use strict';var multer=require(_0xbf54('0x0'));var util=require(_0xbf54('0x1'));var path=require(_0xbf54('0x2'));var timeout=require(_0xbf54('0x3'));var express=require(_0xbf54('0x4'));var router=express[_0xbf54('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf54('0x6'));var config=require(_0xbf54('0x7'));var controller=require(_0xbf54('0x8'));router[_0xbf54('0x9')]('/',auth[_0xbf54('0xa')](),controller[_0xbf54('0xb')]);router[_0xbf54('0x9')](_0xbf54('0xc'),auth[_0xbf54('0xa')](),controller[_0xbf54('0xd')]);router[_0xbf54('0x9')](_0xbf54('0xe'),auth[_0xbf54('0xa')](),controller[_0xbf54('0xf')]);router[_0xbf54('0x9')]('/:id/download',auth[_0xbf54('0xa')](),controller[_0xbf54('0x10')]);router[_0xbf54('0x11')]('/',auth['isAuthenticated'](),controller[_0xbf54('0x12')]);router['put']('/:id',auth[_0xbf54('0xa')](),controller['update']);router[_0xbf54('0x13')](_0xbf54('0xe'),auth['isAuthenticated'](),controller[_0xbf54('0x14')]);module['exports']=router; \ No newline at end of file +var _0x33dd=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','put','delete','destroy'];(function(_0x4740b6,_0x375080){var _0x499e31=function(_0x5b553b){while(--_0x5b553b){_0x4740b6['push'](_0x4740b6['shift']());}};_0x499e31(++_0x375080);}(_0x33dd,0xc6));var _0xd33d=function(_0x4fba63,_0x2345fc){_0x4fba63=_0x4fba63-0x0;var _0x55a7dd=_0x33dd[_0x4fba63];return _0x55a7dd;};'use strict';var multer=require(_0xd33d('0x0'));var util=require(_0xd33d('0x1'));var path=require('path');var timeout=require(_0xd33d('0x2'));var express=require('express');var router=express[_0xd33d('0x3')]();var fs_extra=require(_0xd33d('0x4'));var auth=require(_0xd33d('0x5'));var interaction=require(_0xd33d('0x6'));var config=require('../../config/environment');var controller=require(_0xd33d('0x7'));router[_0xd33d('0x8')]('/',auth[_0xd33d('0x9')](),controller[_0xd33d('0xa')]);router[_0xd33d('0x8')](_0xd33d('0xb'),auth[_0xd33d('0x9')](),controller['describe']);router['get'](_0xd33d('0xc'),auth[_0xd33d('0x9')](),controller[_0xd33d('0xd')]);router['get']('/:id/download',auth[_0xd33d('0x9')](),controller[_0xd33d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd33d('0xf')](_0xd33d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd33d('0x10')](_0xd33d('0xc'),auth['isAuthenticated'](),controller[_0xd33d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index ae5d4ae..cd35b99 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 _0x1f81=['setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','../../config/environment','exports','getDataValue','value','extname','STRING','replace'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x1f81,0xab));var _0x11f8=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x1f81[_0x20cb20];return _0x2fcf4b;};'use strict';var Sequelize=require(_0x11f8('0x0'));var moment=require(_0x11f8('0x1'));var path=require('path');var config=require(_0x11f8('0x2'));module[_0x11f8('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x11f8('0x4')](_0x11f8('0x5'))?path[_0x11f8('0x6')](this[_0x11f8('0x4')](_0x11f8('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x11f8('0x7')]},'channel':{'type':Sequelize[_0x11f8('0x7')]},'value':{'type':Sequelize[_0x11f8('0x7')],'set':function(_0x4fd0cf){var _0x1d899d=_0x4fd0cf[_0x11f8('0x8')](/\\/g,'/');this[_0x11f8('0x9')](_0x11f8('0x5'),_0x1d899d);}},'rating':{'type':Sequelize[_0x11f8('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x11f8('0xa')],'set':function(_0x5ec20c){this[_0x11f8('0x9')](_0x11f8('0xb'),moment()[_0x11f8('0xc')](_0x5ec20c,'ms'));this[_0x11f8('0x9')]('closedAt',moment());this[_0x11f8('0x9')](_0x11f8('0xd'),_0x5ec20c);}},'startedAt':{'type':Sequelize[_0x11f8('0xe')],'get':function(){return moment(this[_0x11f8('0x4')](_0x11f8('0xb')))[_0x11f8('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x11f8('0x10')]();}},'closedAt':{'type':Sequelize[_0x11f8('0xe')],'get':function(){return moment(this[_0x11f8('0x4')]('closedAt'))[_0x11f8('0xf')](_0x11f8('0x11'))[_0x11f8('0x10')]();}},'createdAt':{'type':Sequelize[_0x11f8('0xe')],'get':function(){return moment(this['getDataValue'](_0x11f8('0x12')))[_0x11f8('0xf')](_0x11f8('0x11'))[_0x11f8('0x10')]();}},'updatedAt':{'type':Sequelize[_0x11f8('0xe')],'get':function(){return moment(this['getDataValue'](_0x11f8('0x13')))[_0x11f8('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x11f8('0x10')]();}}}; \ No newline at end of file +var _0x7382=['DATE','createdAt','updatedAt','moment','value','extname','getDataValue','STRING','setDataValue','INTEGER','startedAt','closedAt','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x7382,0x111));var _0x2738=function(_0x63c9d,_0x5269ef){_0x63c9d=_0x63c9d-0x0;var _0x4c4abe=_0x7382[_0x63c9d];return _0x4c4abe;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2738('0x0'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x2738('0x1'))?path[_0x2738('0x2')](this[_0x2738('0x3')](_0x2738('0x1'))):undefined;}},'interactionid':{'type':Sequelize[_0x2738('0x4')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x2738('0x4')],'set':function(_0x2bc38a){var _0xd74b07=_0x2bc38a['replace'](/\\/g,'/');this[_0x2738('0x5')](_0x2738('0x1'),_0xd74b07);}},'rating':{'type':Sequelize[_0x2738('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x476864){this[_0x2738('0x5')](_0x2738('0x7'),moment()['subtract'](_0x476864,'ms'));this[_0x2738('0x5')](_0x2738('0x8'),moment());this[_0x2738('0x5')]('duration',_0x476864);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2738('0x3')](_0x2738('0x7')))[_0x2738('0x9')](_0x2738('0xa'))[_0x2738('0xb')]();}},'closedAt':{'type':Sequelize[_0x2738('0xc')],'get':function(){return moment(this[_0x2738('0x3')](_0x2738('0x8')))[_0x2738('0x9')](_0x2738('0xa'))[_0x2738('0xb')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2738('0x3')](_0x2738('0xd')))['format'](_0x2738('0xa'))['toString']();}},'updatedAt':{'type':Sequelize[_0x2738('0xc')],'get':function(){return moment(this['getDataValue'](_0x2738('0xe')))['format'](_0x2738('0xa'))[_0x2738('0xb')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5c43a80..747574a 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 _0x55ca=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','util','path'];(function(_0x53ed1a,_0x8a6e77){var _0x317cb5=function(_0x291af3){while(--_0x291af3){_0x53ed1a['push'](_0x53ed1a['shift']());}};_0x317cb5(++_0x8a6e77);}(_0x55ca,0x126));var _0xa55c=function(_0x546c68,_0x5c0116){_0x546c68=_0x546c68-0x0;var _0x4a2389=_0x55ca[_0x546c68];return _0x4a2389;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_['map'](_0x201941,_0xa55c('0x25')),[_0xa55c('0x2e')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x906caa[_0xa55c('0x2f')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2f')]);_0x1377b0[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x22f6b6['model'],qs['fields'](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x1377b0['attributes']=_0x1377b0[_0xa55c('0x33')][_0xa55c('0x35')]?_0x1377b0[_0xa55c('0x33')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2f')][_0xa55c('0x36')](_0xa55c('0x37'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa['query']['limit']);_0x1377b0['offset']=qs[_0xa55c('0x1a')](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x1a')]);}_0x1377b0['order']=qs[_0xa55c('0x38')](_0x906caa['query'][_0xa55c('0x38')]);_0x1377b0['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x39')](_0x906caa[_0xa55c('0x2f')],_0x22f6b6['filters']),_0x201941);if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3a')]){_0x1377b0['where']=_[_0xa55c('0x3b')](_0x1377b0[_0xa55c('0x3c')],{'$or':_['map'](_0x201941,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x2a')]!=='VIRTUAL'){var _0x1e75dc={};_0x1e75dc[_0x529ff8[_0xa55c('0x25')]]={'$like':'%'+_0x906caa['query']['filter']+'%'};return _0x1e75dc;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x3b3308={'where':_0x1377b0[_0xa55c('0x3c')]};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x3b3308)[_0xa55c('0x20')](function(_0x56d17c){_0x1b8388[_0xa55c('0x1d')]=_0x56d17c;if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3d')]){_0x1377b0[_0xa55c('0x3e')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0x1377b0);})['then'](function(_0x386e34){_0x1b8388['rows']=_0x386e34;return _0x1b8388;})['then'](respondWithFilteredResult(_0x5d940d,_0x1377b0))[_0xa55c('0x40')](handleError(_0x5d940d,null));};exports[_0xa55c('0x41')]=function(_0x496920,_0x2bd98b){var _0x508bd3={'raw':![],'where':{'id':_0x496920[_0xa55c('0x42')]['id']}},_0x5f25f7={};_0x5f25f7[_0xa55c('0x2c')]=_[_0xa55c('0x30')](db['ScreenRecording'][_0xa55c('0x43')]);_0x5f25f7[_0xa55c('0x2f')]=_['keys'](_0x496920[_0xa55c('0x2f')]);_0x5f25f7['filters']=_[_0xa55c('0x32')](_0x5f25f7[_0xa55c('0x2c')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5f25f7['model'],qs[_0xa55c('0x34')](_0x496920[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x508bd3['attributes']=_0x508bd3[_0xa55c('0x33')]['length']?_0x508bd3[_0xa55c('0x33')]:_0x5f25f7[_0xa55c('0x2c')];if(_0x496920[_0xa55c('0x2f')]['includeAll']){_0x508bd3[_0xa55c('0x3e')]=[{'all':!![]}];}_0x508bd3=_[_0xa55c('0x3b')]({},_0x508bd3,_0x496920['options']);return db[_0xa55c('0x29')][_0xa55c('0x44')](_0x508bd3)['then'](handleEntityNotFound(_0x2bd98b,null))[_0xa55c('0x20')](respondWithResult(_0x2bd98b,null))[_0xa55c('0x40')](handleError(_0x2bd98b,null));};exports['create']=function(_0x46f839,_0x81cee8){return db[_0xa55c('0x29')][_0xa55c('0x45')](_0x46f839['body'],{})[_0xa55c('0x20')](respondWithResult(_0x81cee8,0xc9))['catch'](handleError(_0x81cee8,null));};exports[_0xa55c('0x1f')]=function(_0x213100,_0x194a79){if(_0x213100['body']['id']){delete _0x213100[_0xa55c('0x46')]['id'];}delete _0x213100[_0xa55c('0x46')]['duration'];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x47')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x48')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x49')];return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x213100[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x194a79,null))['then'](saveUpdates(_0x213100[_0xa55c('0x46')],null))[_0xa55c('0x20')](respondWithResult(_0x194a79,null))[_0xa55c('0x40')](handleError(_0x194a79,null));};exports['describe']=function(_0x4c3095,_0x35bf0a){return db['ScreenRecording'][_0xa55c('0x4a')]()['then'](respondWithResult(_0x35bf0a,null))[_0xa55c('0x40')](handleError(_0x35bf0a,null));};exports[_0xa55c('0x4b')]=function(_0x181802,_0x3f9313,_0x2ecf79){var _0x5b1cf3=require(_0xa55c('0x4c'));var _0x4607ca=![];var _0x4b85cc={};if(_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]&&_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]==='uniqueid'){_0x4b85cc['uniqueid']=_0x181802[_0xa55c('0x42')]['id'];}else{_0x4b85cc['id']=_0x181802[_0xa55c('0x42')]['id'];}return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':_0x4b85cc,'attributes':['id','value'],'raw':!![]})[_0xa55c('0x20')](handleEntityNotFound(_0x3f9313,null))['then'](function(_0x2742e4){if(_0x2742e4){var _0x437ced=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x2742e4['value']);var _0x1cb73b=util['format'](_0xa55c('0x50'),_0x437ced);if(fs[_0xa55c('0x51')](_0x1cb73b)){_0x4607ca=!![];return _0x5b1cf3[_0xa55c('0x52')](_0x1cb73b,_0x437ced,config[_0xa55c('0x53')][_0xa55c('0x54')])[_0xa55c('0x20')](function(){return _0x2742e4;});}return _0x2742e4;}})[_0xa55c('0x20')](function(_0x53e2be){if(_0x53e2be){var _0x450567=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x53e2be[_0xa55c('0x49')]);if(!fs['existsSync'](_0x450567)){throw new db[(_0xa55c('0x55'))][(_0xa55c('0x56'))](_0xa55c('0x57'));}if(_0x53e2be[_0xa55c('0x58')]){return _0x3f9313[_0xa55c('0x4b')](_0x450567,_0x53e2be['filename']+path[_0xa55c('0x59')](_0x450567),function(){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}else{return _0x3f9313[_0xa55c('0x4b')](_0x450567,function(_0x16d9b2){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}}})['catch'](function(_0x419fc3){if(_0x419fc3['message']===_0xa55c('0x57')){_0x3f9313['status'](0x194)[_0xa55c('0x26')]('Not\x20found');}else{return handleError(_0x3f9313,null);}});};exports[_0xa55c('0x5b')]=function(_0x1333da,_0x21d6b4){return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x1333da[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](function(_0x2f2226){if(_[_0xa55c('0x5c')](_0x2f2226)){throw new ReferenceError(_0xa55c('0x5d'));}return _0x2f2226;})['then'](function(_0x150a07){var _0x311bb9=path['join'](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x150a07[_0xa55c('0x49')]);logger[_0xa55c('0x5e')](_0xa55c('0x5f'),_0x311bb9);if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger['info'](_0xa55c('0x60')+_0x311bb9+_0xa55c('0x61'));fs[_0xa55c('0x62')](_0x311bb9);}_0x311bb9=_0x311bb9+_0xa55c('0x63');if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger[_0xa55c('0x5e')](_0xa55c('0x60')+_0x311bb9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa55c('0x62')](_0x311bb9);}return _0x150a07;})[_0xa55c('0x20')](function(_0x40c56a){if(!_0x40c56a)throw new InternalError();return _0x40c56a[_0xa55c('0x5b')]();})[_0xa55c('0x20')](function(){_0x21d6b4[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();})[_0xa55c('0x40')](handleError(_0x21d6b4,null));}; \ No newline at end of file +var _0x7bae=['zip-dir','fast-json-patch','moment','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','find','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x3d6a00,_0x41f7f6){var _0xaeb4d5=function(_0x4ef862){while(--_0x4ef862){_0x3d6a00['push'](_0x3d6a00['shift']());}};_0xaeb4d5(++_0x41f7f6);}(_0x7bae,0x13b));var _0xe7ba=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7bae[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['differenceBy'](_[_0xe7ba('0x2b')](_0x587c7d,'name'),['format']);_0x369451[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x31')]);_0x369451['filters']=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7[_0xe7ba('0x34')]=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x48c869['query'][_0xe7ba('0x35')]));_0x92fe7[_0xe7ba('0x34')]=_0x92fe7['attributes'][_0xe7ba('0x36')]?_0x92fe7[_0xe7ba('0x34')]:_0x369451[_0xe7ba('0x30')];if(!_0x48c869['query'][_0xe7ba('0x37')](_0xe7ba('0x38'))){_0x92fe7['limit']=qs[_0xe7ba('0x1e')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x92fe7['offset']=qs[_0xe7ba('0x20')](_0x48c869[_0xe7ba('0x31')]['offset']);}_0x92fe7[_0xe7ba('0x39')]=qs[_0xe7ba('0x3a')](_0x48c869[_0xe7ba('0x31')]['sort']);_0x92fe7['where']=qs[_0xe7ba('0x3b')](_[_0xe7ba('0x3c')](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x3b')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')]['filter']){_0x92fe7[_0xe7ba('0x3d')]=_[_0xe7ba('0x3e')](_0x92fe7[_0xe7ba('0x3d')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x5e9619){if(_0x5e9619[_0xe7ba('0x3f')]!==_0xe7ba('0x40')){var _0x46e31a={};_0x46e31a[_0x5e9619[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x41')]+'%'};return _0x46e31a;}})});}_0x92fe7=_[_0xe7ba('0x3e')]({},_0x92fe7,_0x48c869['options']);var _0x3429fa={'where':_0x92fe7[_0xe7ba('0x3d')]};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x3429fa)[_0xe7ba('0x26')](function(_0x3b3abe){_0x4bf5f9[_0xe7ba('0x1f')]=_0x3b3abe;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x42')]){_0x92fe7['include']=[{'all':!![]}];}return db[_0xe7ba('0x2c')][_0xe7ba('0x43')](_0x92fe7);})['then'](function(_0x5dae52){_0x4bf5f9[_0xe7ba('0x44')]=_0x5dae52;return _0x4bf5f9;})[_0xe7ba('0x26')](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x45')](handleError(_0x102925,null));};exports['show']=function(_0x249e1d,_0x82246e){var _0x3569b6={'raw':![],'where':{'id':_0x249e1d[_0xe7ba('0x46')]['id']}},_0x12770d={};_0x12770d['model']=_[_0xe7ba('0x32')](db['ScreenRecording'][_0xe7ba('0x2d')]);_0x12770d[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x249e1d[_0xe7ba('0x31')]);_0x12770d[_0xe7ba('0x3b')]=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],_0x12770d[_0xe7ba('0x31')]);_0x3569b6['attributes']=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x249e1d[_0xe7ba('0x31')][_0xe7ba('0x35')]));_0x3569b6[_0xe7ba('0x34')]=_0x3569b6[_0xe7ba('0x34')][_0xe7ba('0x36')]?_0x3569b6[_0xe7ba('0x34')]:_0x12770d[_0xe7ba('0x30')];if(_0x249e1d['query'][_0xe7ba('0x42')]){_0x3569b6['include']=[{'all':!![]}];}_0x3569b6=_[_0xe7ba('0x3e')]({},_0x3569b6,_0x249e1d[_0xe7ba('0x47')]);return db[_0xe7ba('0x2c')][_0xe7ba('0x48')](_0x3569b6)[_0xe7ba('0x26')](handleEntityNotFound(_0x82246e,null))[_0xe7ba('0x26')](respondWithResult(_0x82246e,null))['catch'](handleError(_0x82246e,null));};exports[_0xe7ba('0x49')]=function(_0x1cc668,_0x3f17ed){return db[_0xe7ba('0x2c')][_0xe7ba('0x49')](_0x1cc668[_0xe7ba('0x4a')],{})[_0xe7ba('0x26')](respondWithResult(_0x3f17ed,0xc9))[_0xe7ba('0x45')](handleError(_0x3f17ed,null));};exports[_0xe7ba('0x25')]=function(_0x1189bd,_0xbe2a32){if(_0x1189bd['body']['id']){delete _0x1189bd[_0xe7ba('0x4a')]['id'];}delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4b')];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4c')];delete _0x1189bd[_0xe7ba('0x4a')]['closedAt'];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4d')];return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x1189bd[_0xe7ba('0x46')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0xbe2a32,null))[_0xe7ba('0x26')](saveUpdates(_0x1189bd['body'],null))['then'](respondWithResult(_0xbe2a32,null))[_0xe7ba('0x45')](handleError(_0xbe2a32,null));};exports[_0xe7ba('0x4e')]=function(_0x285743,_0x5af106){return db[_0xe7ba('0x2c')][_0xe7ba('0x4e')]()[_0xe7ba('0x26')](respondWithResult(_0x5af106,null))[_0xe7ba('0x45')](handleError(_0x5af106,null));};exports[_0xe7ba('0x4f')]=function(_0x6b6f1,_0xf3a41f,_0x5e6612){var _0x2a6fdd=require(_0xe7ba('0x50'));var _0x316b51=![];var _0x5863c8={};if(_0x6b6f1[_0xe7ba('0x31')][_0xe7ba('0x3f')]&&_0x6b6f1['query'][_0xe7ba('0x3f')]===_0xe7ba('0x51')){_0x5863c8['uniqueid']=_0x6b6f1[_0xe7ba('0x46')]['id'];}else{_0x5863c8['id']=_0x6b6f1['params']['id'];}return db[_0xe7ba('0x2c')][_0xe7ba('0x48')]({'where':_0x5863c8,'attributes':['id',_0xe7ba('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xf3a41f,null))[_0xe7ba('0x26')](function(_0x1128be){if(_0x1128be){var _0x314549=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],'server/files/screen_recordings',_0x1128be[_0xe7ba('0x4d')]);var _0x455e50=util[_0xe7ba('0x54')](_0xe7ba('0x55'),_0x314549);if(fs[_0xe7ba('0x56')](_0x455e50)){_0x316b51=!![];return _0x2a6fdd['decryptFile'](_0x455e50,_0x314549,config[_0xe7ba('0x57')][_0xe7ba('0x58')])[_0xe7ba('0x26')](function(){return _0x1128be;});}return _0x1128be;}})[_0xe7ba('0x26')](function(_0x57b23e){if(_0x57b23e){var _0x3e31c1=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],_0xe7ba('0x59'),_0x57b23e[_0xe7ba('0x4d')]);if(!fs[_0xe7ba('0x56')](_0x3e31c1)){throw new db['Sequelize'][(_0xe7ba('0x5a'))](_0xe7ba('0x5b'));}if(_0x57b23e[_0xe7ba('0x5c')]){return _0xf3a41f['download'](_0x3e31c1,_0x57b23e[_0xe7ba('0x5c')]+path[_0xe7ba('0x5d')](_0x3e31c1),function(){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}else{return _0xf3a41f[_0xe7ba('0x4f')](_0x3e31c1,function(_0x45fb0f){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}}})[_0xe7ba('0x45')](function(_0x3351d5){if(_0x3351d5[_0xe7ba('0x5f')]===_0xe7ba('0x5b')){_0xf3a41f[_0xe7ba('0x1b')](0x194)[_0xe7ba('0x60')]('Not\x20found');}else{return handleError(_0xf3a41f,null);}});};exports[_0xe7ba('0x61')]=function(_0x384cea,_0x357af4){return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x384cea['params']['id']}})[_0xe7ba('0x26')](function(_0x194dff){if(_[_0xe7ba('0x62')](_0x194dff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x194dff;})['then'](function(_0x46d06e){var _0x2812af=path[_0xe7ba('0x52')](config['root'],_0xe7ba('0x59'),_0x46d06e[_0xe7ba('0x4d')]);logger[_0xe7ba('0x63')](_0xe7ba('0x64'),_0x2812af);if(!_[_0xe7ba('0x62')](_0x46d06e['value'])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7ba('0x66')](_0x2812af);}_0x2812af=_0x2812af+_0xe7ba('0x67');if(!_[_0xe7ba('0x62')](_0x46d06e[_0xe7ba('0x4d')])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+_0xe7ba('0x68'));fs[_0xe7ba('0x66')](_0x2812af);}return _0x46d06e;})[_0xe7ba('0x26')](function(_0x5a5394){if(!_0x5a5394)throw new InternalError();return _0x5a5394[_0xe7ba('0x61')]();})[_0xe7ba('0x26')](function(){_0x357af4[_0xe7ba('0x1b')](0xcc)[_0xe7ba('0x1c')]();})['catch'](handleError(_0x357af4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 946bd69..5de5be5 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 _0x60e8=['moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','interactionid','lodash','util','../../config/logger'];(function(_0x1aba9c,_0x465976){var _0x414891=function(_0x179f91){while(--_0x179f91){_0x1aba9c['push'](_0x1aba9c['shift']());}};_0x414891(++_0x465976);}(_0x60e8,0x81));var _0x860e=function(_0x47f31b,_0xbbd26d){_0x47f31b=_0x47f31b-0x0;var _0x28623b=_0x60e8[_0x47f31b];return _0x28623b;};'use strict';var _=require(_0x860e('0x0'));var util=require(_0x860e('0x1'));var logger=require(_0x860e('0x2'))('api');var moment=require(_0x860e('0x3'));var BPromise=require(_0x860e('0x4'));var rp=require(_0x860e('0x5'));var fs=require('fs');var path=require(_0x860e('0x6'));var rimraf=require('rimraf');var config=require(_0x860e('0x7'));var attributes=require(_0x860e('0x8'));module[_0x860e('0x9')]=function(_0x2e384a,_0x4206fc){return _0x2e384a['define']('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x860e('0xa'),'fields':[_0x860e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa779=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x1d291d,_0x17314a){var _0x44cc4e=function(_0x38d29f){while(--_0x38d29f){_0x1d291d['push'](_0x1d291d['shift']());}};_0x44cc4e(++_0x17314a);}(_0xa779,0x195));var _0x9a77=function(_0x1ca347,_0x17f0f4){_0x1ca347=_0x1ca347-0x0;var _0x2aec46=_0xa779[_0x1ca347];return _0x2aec46;};'use strict';var _=require(_0x9a77('0x0'));var util=require(_0x9a77('0x1'));var logger=require(_0x9a77('0x2'))(_0x9a77('0x3'));var moment=require('moment');var BPromise=require(_0x9a77('0x4'));var rp=require(_0x9a77('0x5'));var fs=require('fs');var path=require(_0x9a77('0x6'));var rimraf=require(_0x9a77('0x7'));var config=require(_0x9a77('0x8'));var attributes=require(_0x9a77('0x9'));module[_0x9a77('0xa')]=function(_0x578a4f,_0x4c340){return _0x578a4f[_0x9a77('0xb')](_0x9a77('0xc'),attributes,{'tableName':_0x9a77('0xd'),'paranoid':![],'indexes':[{'name':_0x9a77('0xe'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 971ea9c..9b87802 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 _0x1ae9=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util'];(function(_0x50166f,_0x4f3444){var _0x349931=function(_0x5f4236){while(--_0x5f4236){_0x50166f['push'](_0x50166f['shift']());}};_0x349931(++_0x4f3444);}(_0x1ae9,0x152));var _0x91ae=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x1ae9[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0x91ae('0x0'));var util=require(_0x91ae('0x1'));var moment=require(_0x91ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x91ae('0x3'));var fs=require('fs');var Redis=require(_0x91ae('0x4'));var db=require(_0x91ae('0x5'))['db'];var utils=require(_0x91ae('0x6'));var logger=require('../../config/logger')(_0x91ae('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x91ae('0x8')][_0x91ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f8aab,_0x381fa0,_0x2ab8d3){return new BPromise(function(_0x306a9e,_0x354db0){return client[_0x91ae('0xa')](_0x4f8aab,_0x2ab8d3)[_0x91ae('0xb')](function(_0x224e78){logger[_0x91ae('0xc')](_0x91ae('0xd'),_0x381fa0,_0x91ae('0xe'));logger['debug'](_0x91ae('0xf'),_0x381fa0,_0x91ae('0xe'),JSON['stringify'](_0x224e78));if(_0x224e78['error']){if(_0x224e78[_0x91ae('0x10')][_0x91ae('0x11')]===0x1f4){logger[_0x91ae('0x10')](_0x91ae('0xd'),_0x381fa0,_0x224e78[_0x91ae('0x10')][_0x91ae('0x12')]);return _0x354db0(_0x224e78[_0x91ae('0x10')][_0x91ae('0x12')]);}logger[_0x91ae('0x10')](_0x91ae('0xd'),_0x381fa0,_0x224e78[_0x91ae('0x10')][_0x91ae('0x12')]);return _0x306a9e(_0x224e78[_0x91ae('0x10')][_0x91ae('0x12')]);}else{logger[_0x91ae('0xc')](_0x91ae('0xd'),_0x381fa0,'request\x20sent');_0x306a9e(_0x224e78[_0x91ae('0x13')][_0x91ae('0x12')]);}})['catch'](function(_0xabff8){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x381fa0,_0xabff8);_0x354db0(_0xabff8);});});} \ No newline at end of file +var _0xdd9e=['client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3a04a5,_0x101026){var _0x4e3298=function(_0x3549a4){while(--_0x3549a4){_0x3a04a5['push'](_0x3a04a5['shift']());}};_0x4e3298(++_0x101026);}(_0xdd9e,0x92));var _0xedd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xedd9('0x0'));var moment=require(_0xedd9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedd9('0x2'));var db=require(_0xedd9('0x3'))['db'];var utils=require(_0xedd9('0x4'));var logger=require(_0xedd9('0x5'))(_0xedd9('0x6'));var config=require('../../config/environment');var jayson=require(_0xedd9('0x7'));var client=jayson[_0xedd9('0x8')][_0xedd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a8095,_0x51e479,_0x214faa){return new BPromise(function(_0x214d96,_0x525d85){return client[_0xedd9('0xa')](_0x2a8095,_0x214faa)[_0xedd9('0xb')](function(_0x9c702f){logger[_0xedd9('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x51e479,_0xedd9('0xd'));logger[_0xedd9('0xe')](_0xedd9('0xf'),_0x51e479,_0xedd9('0xd'),JSON[_0xedd9('0x10')](_0x9c702f));if(_0x9c702f['error']){if(_0x9c702f['error']['code']===0x1f4){logger[_0xedd9('0x11')](_0xedd9('0x12'),_0x51e479,_0x9c702f[_0xedd9('0x11')][_0xedd9('0x13')]);return _0x525d85(_0x9c702f[_0xedd9('0x11')]['message']);}logger[_0xedd9('0x11')](_0xedd9('0x12'),_0x51e479,_0x9c702f['error'][_0xedd9('0x13')]);return _0x214d96(_0x9c702f['error'][_0xedd9('0x13')]);}else{logger[_0xedd9('0xc')](_0xedd9('0x12'),_0x51e479,'request\x20sent');_0x214d96(_0x9c702f[_0xedd9('0x14')]['message']);}})[_0xedd9('0x15')](function(_0x20098a){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x51e479,_0x20098a);_0x525d85(_0x20098a);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 90eb726..6f99d73 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 _0x6058=['/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','file','join','format','logologin','single','addLogoLogin','preferred','addPreferred','favicon','put','update','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/now','getDate','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6058,0x6c));var _0x8605=function(_0x5182f9,_0x4acf0c){_0x5182f9=_0x5182f9-0x0;var _0x4c9fad=_0x6058[_0x5182f9];return _0x4c9fad;};'use strict';var multer=require('multer');var util=require(_0x8605('0x0'));var path=require(_0x8605('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8605('0x2')]();var fs_extra=require(_0x8605('0x3'));var auth=require(_0x8605('0x4'));var interaction=require(_0x8605('0x5'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x8605('0x6')]('/',auth['isAuthenticated'](),controller[_0x8605('0x7')]);router[_0x8605('0x6')](_0x8605('0x8'),controller[_0x8605('0x9')]);router['get'](_0x8605('0xa'),controller[_0x8605('0xb')]);router[_0x8605('0x6')](_0x8605('0xc'),controller[_0x8605('0xd')]);router['get'](_0x8605('0xe'),controller['getLogoLogin']);router[_0x8605('0x6')](_0x8605('0xf'),controller[_0x8605('0x10')]);router[_0x8605('0x6')](_0x8605('0x11'),controller[_0x8605('0x12')]);router[_0x8605('0x6')](_0x8605('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x4ff686,_0x357704,_0x24fd88){_0x24fd88(null,path['join'](config[_0x8605('0x15')],_0x8605('0x16')));},'filename':function(_0x4f59b1,_0xebbb49,_0x41694a){_0x41694a(null,util['format'](_0x8605('0x17'),_0x8605('0x18'),path[_0x8605('0x19')](_0xebbb49[_0x8605('0x1a')])));}})});router[_0x8605('0x1b')](_0x8605('0xc'),upload['single'](_0x8605('0x1c')),controller['addLogo']);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x373e9e,_0x498c6a,_0x54d370){_0x54d370(null,path[_0x8605('0x1d')](config[_0x8605('0x15')],'server/files/images/logos/'));},'filename':function(_0x36646a,_0x1dc64e,_0x51ac48){_0x51ac48(null,util[_0x8605('0x1e')](_0x8605('0x17'),_0x8605('0x1f'),path['extname'](_0x1dc64e['originalname'])));}})});router[_0x8605('0x1b')](_0x8605('0xe'),upload[_0x8605('0x20')]('file'),controller[_0x8605('0x21')]);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x1c733c,_0x2de8cb,_0x3b8d76){_0x3b8d76(null,path[_0x8605('0x1d')](config[_0x8605('0x15')],_0x8605('0x16')));},'filename':function(_0x3e717c,_0x1ef22a,_0x1e9ccd){_0x1e9ccd(null,util[_0x8605('0x1e')](_0x8605('0x17'),_0x8605('0x22'),path['extname'](_0x1ef22a['originalname'])));}})});router['post'](_0x8605('0x11'),upload[_0x8605('0x20')]('file'),controller[_0x8605('0x23')]);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x29345f,_0x4f1ee6,_0x54a57e){_0x54a57e(null,path[_0x8605('0x1d')](config[_0x8605('0x15')],'server/files/images/logos/'));},'filename':function(_0x345aff,_0x245d79,_0x3f9184){_0x3f9184(null,util[_0x8605('0x1e')](_0x8605('0x17'),_0x8605('0x24'),path[_0x8605('0x19')](_0x245d79[_0x8605('0x1a')])));}})});router[_0x8605('0x1b')]('/:id/favicon',upload[_0x8605('0x20')]('file'),controller['addFavicon']);router[_0x8605('0x25')](_0x8605('0xa'),auth['isAuthenticated'](),controller[_0x8605('0x26')]);module[_0x8605('0x27')]=router; \ No newline at end of file +var _0x2e6c=['post','single','file','addLogo','diskStorage','format','%s%s','addLogoLogin','/:id/favicon','addFavicon','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','join','root','server/files/images/logos/','logo','extname','originalname'];(function(_0x2b7f6c,_0x21af82){var _0x1a2983=function(_0x508d96){while(--_0x508d96){_0x2b7f6c['push'](_0x2b7f6c['shift']());}};_0x1a2983(++_0x21af82);}(_0x2e6c,0xd3));var _0xc2e6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2e6c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xc2e6('0x0'));var util=require(_0xc2e6('0x1'));var path=require(_0xc2e6('0x2'));var timeout=require(_0xc2e6('0x3'));var express=require(_0xc2e6('0x4'));var router=express['Router']();var fs_extra=require(_0xc2e6('0x5'));var auth=require(_0xc2e6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc2e6('0x7'));var controller=require(_0xc2e6('0x8'));router[_0xc2e6('0x9')]('/',auth[_0xc2e6('0xa')](),controller[_0xc2e6('0xb')]);router[_0xc2e6('0x9')](_0xc2e6('0xc'),controller[_0xc2e6('0xd')]);router['get']('/:id',controller[_0xc2e6('0xe')]);router[_0xc2e6('0x9')](_0xc2e6('0xf'),controller[_0xc2e6('0x10')]);router[_0xc2e6('0x9')](_0xc2e6('0x11'),controller[_0xc2e6('0x12')]);router[_0xc2e6('0x9')](_0xc2e6('0x13'),controller['gdpr']);router[_0xc2e6('0x9')](_0xc2e6('0x14'),controller[_0xc2e6('0x15')]);router['get']('/:id/favicon',controller[_0xc2e6('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2aa7ee,_0x7890b2,_0x5a5025){_0x5a5025(null,path[_0xc2e6('0x17')](config[_0xc2e6('0x18')],_0xc2e6('0x19')));},'filename':function(_0x54484a,_0x295d58,_0x8e479a){_0x8e479a(null,util['format']('%s%s',_0xc2e6('0x1a'),path[_0xc2e6('0x1b')](_0x295d58[_0xc2e6('0x1c')])));}})});router[_0xc2e6('0x1d')](_0xc2e6('0xf'),upload[_0xc2e6('0x1e')](_0xc2e6('0x1f')),controller[_0xc2e6('0x20')]);var upload=multer({'storage':multer[_0xc2e6('0x21')]({'destination':function(_0x132891,_0x35919e,_0x548a5d){_0x548a5d(null,path[_0xc2e6('0x17')](config[_0xc2e6('0x18')],_0xc2e6('0x19')));},'filename':function(_0x2b041a,_0x276b45,_0x256bea){_0x256bea(null,util[_0xc2e6('0x22')](_0xc2e6('0x23'),'logologin',path['extname'](_0x276b45[_0xc2e6('0x1c')])));}})});router[_0xc2e6('0x1d')]('/:id/logo_login',upload[_0xc2e6('0x1e')](_0xc2e6('0x1f')),controller[_0xc2e6('0x24')]);var upload=multer({'storage':multer[_0xc2e6('0x21')]({'destination':function(_0x495fd9,_0x529350,_0x490fb6){_0x490fb6(null,path[_0xc2e6('0x17')](config['root'],_0xc2e6('0x19')));},'filename':function(_0x356f69,_0x1a15f0,_0x1d1965){_0x1d1965(null,util['format'](_0xc2e6('0x23'),'preferred',path['extname'](_0x1a15f0['originalname'])));}})});router['post'](_0xc2e6('0x14'),upload[_0xc2e6('0x1e')](_0xc2e6('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22ec39,_0x467257,_0x124496){_0x124496(null,path[_0xc2e6('0x17')](config[_0xc2e6('0x18')],_0xc2e6('0x19')));},'filename':function(_0x117afa,_0x429cb6,_0x235622){_0x235622(null,util[_0xc2e6('0x22')](_0xc2e6('0x23'),'favicon',path['extname'](_0x429cb6[_0xc2e6('0x1c')])));}})});router[_0xc2e6('0x1d')](_0xc2e6('0x25'),upload['single'](_0xc2e6('0x1f')),controller[_0xc2e6('0x26')]);router['put']('/:id',auth[_0xc2e6('0xa')](),controller[_0xc2e6('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b19b420..5b4d1d0 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x402639,_0x1e1991){var _0x37633e=function(_0x44b094){while(--_0x44b094){_0x402639['push'](_0x402639['shift']());}};_0x37633e(++_0x1e1991);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x4bbb6f,_0x5edc17){var _0x3582f4=function(_0x4c9d52){while(--_0x4c9d52){_0x4bbb6f['push'](_0x4bbb6f['shift']());}};_0x3582f4(++_0x5edc17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6c5bd39..e79a99b 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 _0xe8a4=['bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','end','json','undefined','limit','count','offset','save','destroy','status','stack','name','map','Setting','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','filter','where','merge','options','findAll','rows','catch','params','fields','includeAll','include','body','find','file','filename','loginLogo','getLogo','server/files/images/logos','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','request-promise','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe8a4,0x158));var _0x4e8a=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xe8a4[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0x4e8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e8a('0x2'));var moment=require(_0x4e8a('0x3'));var BPromise=require(_0x4e8a('0x4'));var Mustache=require('mustache');var util=require(_0x4e8a('0x5'));var path=require(_0x4e8a('0x6'));var sox=require('sox');var csv=require(_0x4e8a('0x7'));var ejs=require(_0x4e8a('0x8'));var fs=require('fs');var fs_extra=require(_0x4e8a('0x9'));var _=require(_0x4e8a('0xa'));var squel=require(_0x4e8a('0xb'));var crypto=require(_0x4e8a('0xc'));var jsforce=require(_0x4e8a('0xd'));var deskjs=require(_0x4e8a('0xe'));var toCsv=require(_0x4e8a('0x7'));var querystring=require(_0x4e8a('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e8a('0x10'));var authService=require(_0x4e8a('0x11'));var qs=require(_0x4e8a('0x12'));var as=require(_0x4e8a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e8a('0x14'))(_0x4e8a('0x15'));var utils=require('../../config/utils');var config=require(_0x4e8a('0x16'));var licenseUtil=require(_0x4e8a('0x17'));var db=require(_0x4e8a('0x18'))['db'];var jayson=require(_0x4e8a('0x19'));var client=jayson['client'][_0x4e8a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4f04d5,_0x39be1d,_0x25a431,_0x4270fb){return new BPromise(function(_0x4e5e38,_0x6e7291){var _0x4d342c=_0x4270fb||client;return _0x4d342c[_0x4e8a('0x1b')](_0x4f04d5,_0x25a431)[_0x4e8a('0x1c')](function(_0x61acb9){logger['info'](_0x4e8a('0x1d'),_0x39be1d,_0x4e8a('0x1e'));logger[_0x4e8a('0x1f')](_0x4e8a('0x20'),_0x39be1d,'request\x20sent',JSON[_0x4e8a('0x21')](_0x61acb9));if(_0x61acb9['error']){if(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x23')]===0x1f4){logger[_0x4e8a('0x22')](_0x4e8a('0x1d'),_0x39be1d,_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);return _0x6e7291(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);}logger[_0x4e8a('0x22')]('Setting,\x20%s,\x20%s',_0x39be1d,_0x61acb9['error']['message']);return _0x4e5e38(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);}else{logger[_0x4e8a('0x25')](_0x4e8a('0x1d'),_0x39be1d,_0x4e8a('0x1e'));_0x4e5e38(_0x61acb9['result']['message']);}})['catch'](function(_0x4955f9){logger[_0x4e8a('0x22')](_0x4e8a('0x1d'),_0x39be1d,_0x4955f9);_0x6e7291(_0x4955f9);});});}function respondWithStatusCode(_0x2a8948,_0x590b58){_0x590b58=_0x590b58||0xcc;return function(_0x1c2ce7){if(_0x1c2ce7){return _0x2a8948[_0x4e8a('0x26')](_0x590b58);}return _0x2a8948['status'](_0x590b58)[_0x4e8a('0x27')]();};}function respondWithResult(_0x3c80de,_0x50a80a){_0x50a80a=_0x50a80a||0xc8;return function(_0x1c6598){if(_0x1c6598){return _0x3c80de['status'](_0x50a80a)[_0x4e8a('0x28')](_0x1c6598);}};}function respondWithFilteredResult(_0x34b531,_0x3a9d32){return function(_0x690b4f){if(_0x690b4f){var _0x4a664f=typeof _0x3a9d32['offset']===_0x4e8a('0x29')&&typeof _0x3a9d32[_0x4e8a('0x2a')]==='undefined';var _0x3339ee=_0x690b4f['count'];var _0x1d22d5=_0x4a664f?0x0:_0x3a9d32['offset'];var _0x2d1e63=_0x4a664f?_0x690b4f[_0x4e8a('0x2b')]:_0x3a9d32[_0x4e8a('0x2c')]+_0x3a9d32[_0x4e8a('0x2a')];var _0x47190d;if(_0x2d1e63>=_0x3339ee){_0x2d1e63=_0x3339ee;_0x47190d=0xc8;}else{_0x47190d=0xce;}_0x34b531['status'](_0x47190d);return _0x34b531['set']('Content-Range',_0x1d22d5+'-'+_0x2d1e63+'/'+_0x3339ee)[_0x4e8a('0x28')](_0x690b4f);}return null;};}function patchUpdates(_0x2473b5){return function(_0x2a3703){try{jsonpatch['apply'](_0x2a3703,_0x2473b5,!![]);}catch(_0x3ebc0c){return BPromise['reject'](_0x3ebc0c);}return _0x2a3703[_0x4e8a('0x2d')]();};}function saveUpdates(_0x539b96,_0x4f8161){return function(_0x4c4c22){if(_0x4c4c22){return _0x4c4c22['update'](_0x539b96)[_0x4e8a('0x1c')](function(_0x3647df){return _0x3647df;});}return null;};}function removeEntity(_0x2177ed,_0x9331dd){return function(_0x2337ae){if(_0x2337ae){return _0x2337ae[_0x4e8a('0x2e')]()[_0x4e8a('0x1c')](function(){_0x2177ed[_0x4e8a('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x409fc8,_0x4b5f1e){return function(_0x3d9dd2){if(!_0x3d9dd2){_0x409fc8[_0x4e8a('0x26')](0x194);}return _0x3d9dd2;};}function handleError(_0x52ef06,_0x3fd5b9){_0x3fd5b9=_0x3fd5b9||0x1f4;return function(_0x5168b2){logger[_0x4e8a('0x22')](_0x5168b2[_0x4e8a('0x30')]);if(_0x5168b2[_0x4e8a('0x31')]){delete _0x5168b2[_0x4e8a('0x31')];}_0x52ef06['status'](_0x3fd5b9)['send'](_0x5168b2);};}exports['index']=function(_0x17340f,_0x5e79ea){var _0x4693ac={},_0xc4e355={},_0x37ca6e={'count':0x0,'rows':[]};var _0x5564df=_[_0x4e8a('0x32')](db[_0x4e8a('0x33')][_0x4e8a('0x34')],function(_0x297dfb){return{'name':_0x297dfb[_0x4e8a('0x35')],'type':_0x297dfb[_0x4e8a('0x36')]['key']};});_0xc4e355['model']=_['map'](_0x5564df,_0x4e8a('0x31'));_0xc4e355[_0x4e8a('0x37')]=_[_0x4e8a('0x38')](_0x17340f[_0x4e8a('0x37')]);_0xc4e355[_0x4e8a('0x39')]=_[_0x4e8a('0x3a')](_0xc4e355[_0x4e8a('0x3b')],_0xc4e355[_0x4e8a('0x37')]);_0x4693ac['attributes']=_['intersection'](_0xc4e355['model'],qs['fields'](_0x17340f[_0x4e8a('0x37')]['fields']));_0x4693ac[_0x4e8a('0x3c')]=_0x4693ac[_0x4e8a('0x3c')][_0x4e8a('0x3d')]?_0x4693ac['attributes']:_0xc4e355[_0x4e8a('0x3b')];if(!_0x17340f[_0x4e8a('0x37')]['hasOwnProperty'](_0x4e8a('0x3e'))){_0x4693ac[_0x4e8a('0x2a')]=qs['limit'](_0x17340f['query'][_0x4e8a('0x2a')]);_0x4693ac[_0x4e8a('0x2c')]=qs['offset'](_0x17340f[_0x4e8a('0x37')][_0x4e8a('0x2c')]);}_0x4693ac[_0x4e8a('0x3f')]=qs[_0x4e8a('0x40')](_0x17340f[_0x4e8a('0x37')][_0x4e8a('0x40')]);_0x4693ac['where']=qs[_0x4e8a('0x39')](_['pick'](_0x17340f[_0x4e8a('0x37')],_0xc4e355[_0x4e8a('0x39')]),_0x5564df);if(_0x17340f['query'][_0x4e8a('0x41')]){_0x4693ac[_0x4e8a('0x42')]=_[_0x4e8a('0x43')](_0x4693ac[_0x4e8a('0x42')],{'$or':_[_0x4e8a('0x32')](_0x5564df,function(_0x58916c){if(_0x58916c[_0x4e8a('0x36')]!=='VIRTUAL'){var _0x1309bd={};_0x1309bd[_0x58916c['name']]={'$like':'%'+_0x17340f[_0x4e8a('0x37')]['filter']+'%'};return _0x1309bd;}})});}_0x4693ac=_[_0x4e8a('0x43')]({},_0x4693ac,_0x17340f[_0x4e8a('0x44')]);var _0x1d92bb={'where':_0x4693ac['where']};return db[_0x4e8a('0x33')]['count'](_0x1d92bb)['then'](function(_0x3c700c){_0x37ca6e[_0x4e8a('0x2b')]=_0x3c700c;if(_0x17340f['query']['includeAll']){_0x4693ac['include']=[{'all':!![]}];}return db[_0x4e8a('0x33')][_0x4e8a('0x45')](_0x4693ac);})[_0x4e8a('0x1c')](function(_0x3a4f2b){_0x37ca6e[_0x4e8a('0x46')]=_0x3a4f2b;return _0x37ca6e;})['then'](respondWithFilteredResult(_0x5e79ea,_0x4693ac))[_0x4e8a('0x47')](handleError(_0x5e79ea,null));};exports['show']=function(_0x4c2c1b,_0xc0c96b){var _0xfeb06a={'raw':![],'where':{'id':_0x4c2c1b[_0x4e8a('0x48')]['id']}},_0x40b53f={};_0x40b53f[_0x4e8a('0x3b')]=_[_0x4e8a('0x38')](db[_0x4e8a('0x33')][_0x4e8a('0x34')]);_0x40b53f[_0x4e8a('0x37')]=_[_0x4e8a('0x38')](_0x4c2c1b[_0x4e8a('0x37')]);_0x40b53f[_0x4e8a('0x39')]=_['intersection'](_0x40b53f[_0x4e8a('0x3b')],_0x40b53f[_0x4e8a('0x37')]);_0xfeb06a['attributes']=_[_0x4e8a('0x3a')](_0x40b53f[_0x4e8a('0x3b')],qs[_0x4e8a('0x49')](_0x4c2c1b['query'][_0x4e8a('0x49')]));_0xfeb06a[_0x4e8a('0x3c')]=_0xfeb06a[_0x4e8a('0x3c')][_0x4e8a('0x3d')]?_0xfeb06a[_0x4e8a('0x3c')]:_0x40b53f['model'];if(_0x4c2c1b[_0x4e8a('0x37')][_0x4e8a('0x4a')]){_0xfeb06a[_0x4e8a('0x4b')]=[{'all':!![]}];}_0xfeb06a=_[_0x4e8a('0x43')]({},_0xfeb06a,_0x4c2c1b[_0x4e8a('0x44')]);return db[_0x4e8a('0x33')]['find'](_0xfeb06a)[_0x4e8a('0x1c')](handleEntityNotFound(_0xc0c96b,null))[_0x4e8a('0x1c')](respondWithResult(_0xc0c96b,null))[_0x4e8a('0x47')](handleError(_0xc0c96b,null));};exports['update']=function(_0x11ca60,_0x4515f5){if(_0x11ca60[_0x4e8a('0x4c')]['id']){delete _0x11ca60[_0x4e8a('0x4c')]['id'];}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x11ca60[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4515f5,null))[_0x4e8a('0x1c')](saveUpdates(_0x11ca60[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x4515f5,null))['catch'](handleError(_0x4515f5,null));};exports['addLogo']=function(_0x571ad7,_0x1ab43a,_0x1caa6d){if(_0x571ad7[_0x4e8a('0x4e')]&&_0x571ad7['file']['filename']){_0x571ad7[_0x4e8a('0x4c')]['logo']=_0x571ad7['file'][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x571ad7[_0x4e8a('0x48')]['id']}})[_0x4e8a('0x1c')](handleEntityNotFound(_0x1ab43a,null))[_0x4e8a('0x1c')](saveUpdates(_0x571ad7[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x1ab43a,null))[_0x4e8a('0x47')](handleError(_0x1ab43a,null));};exports['addLogoLogin']=function(_0x3d3a51,_0x234efe,_0xe91845){if(_0x3d3a51['file']&&_0x3d3a51['file'][_0x4e8a('0x4f')]){_0x3d3a51[_0x4e8a('0x4c')][_0x4e8a('0x50')]=_0x3d3a51[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x3d3a51[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x234efe,null))[_0x4e8a('0x1c')](saveUpdates(_0x3d3a51[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x234efe,null))['catch'](handleError(_0x234efe,null));};var utilLicense=require('../../config/license/util');exports[_0x4e8a('0x51')]=function(_0x3b3f87,_0x5c1c44,_0x20fb1c){var _0x47857e=_0x4e8a('0x52');var _0x4b418b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4aed87){if(_0x4aed87){_0x4b418b=_0x4aed87;}return db['Setting']['find']({'where':{'id':_0x3b3f87[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),'favicon',_0x4e8a('0x55'),_0x4e8a('0x56'),_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x5c1c44,null))[_0x4e8a('0x1c')](function(_0x1a807a){if(_0x1a807a){var _0x182c57=_0x1a807a['logo']&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_[_0x4e8a('0x5c')](_0x1a807a[_0x4e8a('0x53')])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_['toLower'](_0x1a807a[_0x4e8a('0x53')])):path['join'](config['root'],_0x47857e,_[_0x4e8a('0x5c')]('default_logo.svg'));var _0x48be64=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')](_0x4e8a('0x53'));if(_0x1a807a[_0x48be64]||!_0x4b418b[_0x4e8a('0x5f')]){_0x182c57=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_[_0x4e8a('0x5c')]('default_logo.svg'));}if(!fs[_0x4e8a('0x59')](_0x182c57)){throw new db[(_0x4e8a('0x60'))][(_0x4e8a('0x61'))](_[_0x4e8a('0x5e')](_0x4e8a('0x53'))+_0x4e8a('0x62'));}return _0x5c1c44[_0x4e8a('0x63')](_0x182c57);}})[_0x4e8a('0x47')](handleError(_0x5c1c44,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x64')]=function(_0x269e2f,_0x4d87ea,_0xd64425){var _0x5085d7='server/files/images/logos';var _0x272c72={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x24d1cd){if(_0x24d1cd){_0x272c72=_0x24d1cd;}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x269e2f['params']['id']},'attributes':[_0x4e8a('0x53'),'loginLogo',_0x4e8a('0x54'),_0x4e8a('0x65'),_0x4e8a('0x55'),'defaultLoginLogo',_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x4d87ea,null))[_0x4e8a('0x1c')](function(_0x5cdda){if(_0x5cdda){var _0x11db8f=_0x5cdda[_0x4e8a('0x50')]&&fs['existsSync'](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_[_0x4e8a('0x5c')](_0x5cdda[_0x4e8a('0x50')])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_['toLower'](_0x5cdda['loginLogo'])):path[_0x4e8a('0x5a')](config['root'],_0x5085d7,_[_0x4e8a('0x5c')](_0x4e8a('0x66')));var _0x3fd6e2=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')]('loginLogo');if(_0x5cdda[_0x3fd6e2]||!_0x272c72[_0x4e8a('0x5f')]){_0x11db8f=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_[_0x4e8a('0x5c')](_0x4e8a('0x66')));}if(!fs[_0x4e8a('0x59')](_0x11db8f)){throw new db['Sequelize'][(_0x4e8a('0x61'))](_[_0x4e8a('0x5e')](_0x4e8a('0x50'))+'\x20not\x20found');}return _0x4d87ea[_0x4e8a('0x63')](_0x11db8f);}})[_0x4e8a('0x47')](handleError(_0x4d87ea,null));};exports[_0x4e8a('0x67')]=function(_0x2a1bee,_0x36124d){return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x2a1bee[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x68')]})[_0x4e8a('0x1c')](respondWithResult(_0x36124d,null))[_0x4e8a('0x47')](handleError(_0x36124d,null));};exports[_0x4e8a('0x69')]=function(_0x4ea640,_0x340f39,_0x59c499){if(_0x4ea640[_0x4e8a('0x4e')]&&_0x4ea640[_0x4e8a('0x4e')][_0x4e8a('0x4f')]){_0x4ea640[_0x4e8a('0x4c')]['preferred']=_0x4ea640[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db['Setting'][_0x4e8a('0x4d')]({'where':{'id':_0x4ea640[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x340f39,null))[_0x4e8a('0x1c')](saveUpdates(_0x4ea640[_0x4e8a('0x4c')],null))['then'](respondWithResult(_0x340f39,null))[_0x4e8a('0x47')](handleError(_0x340f39,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x6a')]=function(_0x3a1902,_0xf8d79,_0x2047da){var _0x2b4220=_0x4e8a('0x52');var _0x52ef93={'custom':![]};return utilLicense[_0x4e8a('0x6b')]()['then'](function(_0x4feedd){if(_0x4feedd){_0x52ef93=_0x4feedd;}return db['Setting']['find']({'where':{'id':_0x3a1902[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),_0x4e8a('0x65'),'defaultLogo',_0x4e8a('0x56'),_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0xf8d79,null))['then'](function(_0x20503a){if(_0x20503a){var _0x1f7929=_0x20503a[_0x4e8a('0x54')]&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')](_0x20503a['preferred'])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_['toLower'](_0x20503a['preferred'])):path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')](_0x4e8a('0x6c')));var _0x1fbfcb=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')](_0x4e8a('0x54'));if(_0x20503a[_0x1fbfcb]||!_0x52ef93[_0x4e8a('0x5f')]||!_0x52ef93[_0x4e8a('0x54')]){_0x1f7929=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')]('default_preferred.png'));}if(!fs['existsSync'](_0x1f7929)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x4e8a('0x54'))+_0x4e8a('0x62'));}return _0xf8d79[_0x4e8a('0x63')](_0x1f7929);}})[_0x4e8a('0x47')](handleError(_0xf8d79,null));};exports[_0x4e8a('0x6d')]=function(_0xbc556b,_0x3f7720,_0x2f73e3){if(_0xbc556b[_0x4e8a('0x4e')]&&_0xbc556b['file']['filename']){_0xbc556b[_0x4e8a('0x4c')][_0x4e8a('0x65')]=_0xbc556b[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0xbc556b[_0x4e8a('0x48')]['id']}})[_0x4e8a('0x1c')](handleEntityNotFound(_0x3f7720,null))[_0x4e8a('0x1c')](saveUpdates(_0xbc556b['body'],null))[_0x4e8a('0x1c')](respondWithResult(_0x3f7720,null))[_0x4e8a('0x47')](handleError(_0x3f7720,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x6e')]=function(_0x3fd30d,_0x10c80f,_0x2aaf19){var _0x36366e=_0x4e8a('0x52');var _0x19cd89={'custom':![]};return utilLicense[_0x4e8a('0x6b')]()[_0x4e8a('0x1c')](function(_0xd095e7){if(_0xd095e7){_0x19cd89=_0xd095e7;}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x3fd30d[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),'favicon','defaultLogo',_0x4e8a('0x56'),_0x4e8a('0x57'),'defaultFavicon'],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x10c80f,null))[_0x4e8a('0x1c')](function(_0x35a8bd){if(_0x35a8bd){var _0x63d11a=_0x35a8bd[_0x4e8a('0x65')]&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config['root'],_0x36366e,_['toLower'](_0x35a8bd[_0x4e8a('0x65')])))?path[_0x4e8a('0x5a')](config['root'],_0x36366e,_[_0x4e8a('0x5c')](_0x35a8bd['favicon'])):path['join'](config[_0x4e8a('0x5b')],_0x36366e,_['toLower'](_0x4e8a('0x6f')));var _0x5eeb9d=_0x4e8a('0x5d')+_['upperFirst'](_0x4e8a('0x65'));if(_0x35a8bd[_0x5eeb9d]||!_0x19cd89['custom']){_0x63d11a=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x36366e,_[_0x4e8a('0x5c')](_0x4e8a('0x6f')));}if(!fs[_0x4e8a('0x59')](_0x63d11a)){throw new db[(_0x4e8a('0x60'))][(_0x4e8a('0x61'))](_['upperFirst'](_0x4e8a('0x65'))+_0x4e8a('0x62'));}return _0x10c80f[_0x4e8a('0x63')](_0x63d11a);}})['catch'](handleError(_0x10c80f,null));};exports[_0x4e8a('0x70')]=function(_0x4122e8,_0x18248e){var _0x1a245={'offset':moment()[_0x4e8a('0x71')]()};_0x1a245['now']=moment()['utcOffset'](_0x1a245[_0x4e8a('0x2c')])['format'](_0x4e8a('0x72'));return _0x18248e['status'](0xc8)[_0x4e8a('0x73')](_0x1a245);}; \ No newline at end of file +var _0xecd9=['reject','then','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','find','update','body','addLogo','file','logo','filename','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','default','default_loginLogo.svg','securePassword','preferred','getPreferred','defaultPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x1ae93b,_0x5a91df){var _0x4c3c22=function(_0x47370d){while(--_0x47370d){_0x1ae93b['push'](_0x1ae93b['shift']());}};_0x4c3c22(++_0x5a91df);}(_0xecd9,0x13f));var _0x9ecd=function(_0x448f39,_0x34f2bb){_0x448f39=_0x448f39-0x0;var _0x30da64=_0xecd9[_0x448f39];return _0x30da64;};'use strict';var emlformat=require(_0x9ecd('0x0'));var rimraf=require(_0x9ecd('0x1'));var zipdir=require(_0x9ecd('0x2'));var jsonpatch=require(_0x9ecd('0x3'));var rp=require(_0x9ecd('0x4'));var moment=require(_0x9ecd('0x5'));var BPromise=require(_0x9ecd('0x6'));var Mustache=require(_0x9ecd('0x7'));var util=require('util');var path=require(_0x9ecd('0x8'));var sox=require(_0x9ecd('0x9'));var csv=require(_0x9ecd('0xa'));var ejs=require(_0x9ecd('0xb'));var fs=require('fs');var fs_extra=require(_0x9ecd('0xc'));var _=require('lodash');var squel=require(_0x9ecd('0xd'));var crypto=require(_0x9ecd('0xe'));var jsforce=require(_0x9ecd('0xf'));var deskjs=require(_0x9ecd('0x10'));var toCsv=require(_0x9ecd('0xa'));var querystring=require(_0x9ecd('0x11'));var Papa=require(_0x9ecd('0x12'));var Redis=require(_0x9ecd('0x13'));var authService=require(_0x9ecd('0x14'));var qs=require(_0x9ecd('0x15'));var as=require(_0x9ecd('0x16'));var hardwareService=require(_0x9ecd('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x9ecd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9ecd('0x19'));var db=require(_0x9ecd('0x1a'))['db'];var jayson=require(_0x9ecd('0x1b'));var client=jayson[_0x9ecd('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ff91c,_0x2907e8,_0x1ff37c,_0x24270c){return new BPromise(function(_0x4f2ef4,_0x294067){var _0x11dce2=_0x24270c||client;return _0x11dce2[_0x9ecd('0x1d')](_0x5ff91c,_0x1ff37c)['then'](function(_0x3e8ce1){logger[_0x9ecd('0x1e')](_0x9ecd('0x1f'),_0x2907e8,_0x9ecd('0x20'));logger[_0x9ecd('0x21')]('Setting,\x20%s,\x20%s,\x20%s',_0x2907e8,_0x9ecd('0x20'),JSON[_0x9ecd('0x22')](_0x3e8ce1));if(_0x3e8ce1[_0x9ecd('0x23')]){if(_0x3e8ce1[_0x9ecd('0x23')][_0x9ecd('0x24')]===0x1f4){logger[_0x9ecd('0x23')](_0x9ecd('0x1f'),_0x2907e8,_0x3e8ce1[_0x9ecd('0x23')][_0x9ecd('0x25')]);return _0x294067(_0x3e8ce1[_0x9ecd('0x23')][_0x9ecd('0x25')]);}logger[_0x9ecd('0x23')]('Setting,\x20%s,\x20%s',_0x2907e8,_0x3e8ce1[_0x9ecd('0x23')][_0x9ecd('0x25')]);return _0x4f2ef4(_0x3e8ce1['error'][_0x9ecd('0x25')]);}else{logger[_0x9ecd('0x1e')](_0x9ecd('0x1f'),_0x2907e8,'request\x20sent');_0x4f2ef4(_0x3e8ce1[_0x9ecd('0x26')][_0x9ecd('0x25')]);}})[_0x9ecd('0x27')](function(_0x275a94){logger[_0x9ecd('0x23')](_0x9ecd('0x1f'),_0x2907e8,_0x275a94);_0x294067(_0x275a94);});});}function respondWithStatusCode(_0x2485cf,_0x284341){_0x284341=_0x284341||0xcc;return function(_0x575ec4){if(_0x575ec4){return _0x2485cf[_0x9ecd('0x28')](_0x284341);}return _0x2485cf[_0x9ecd('0x29')](_0x284341)['end']();};}function respondWithResult(_0x3a4e2a,_0x28e541){_0x28e541=_0x28e541||0xc8;return function(_0x6d44cf){if(_0x6d44cf){return _0x3a4e2a[_0x9ecd('0x29')](_0x28e541)['json'](_0x6d44cf);}};}function respondWithFilteredResult(_0x1522ab,_0x52be78){return function(_0x54d9ae){if(_0x54d9ae){var _0x1df783=typeof _0x52be78[_0x9ecd('0x2a')]===_0x9ecd('0x2b')&&typeof _0x52be78[_0x9ecd('0x2c')]===_0x9ecd('0x2b');var _0x504784=_0x54d9ae[_0x9ecd('0x2d')];var _0x2de3b1=_0x1df783?0x0:_0x52be78[_0x9ecd('0x2a')];var _0x5b7e6d=_0x1df783?_0x54d9ae[_0x9ecd('0x2d')]:_0x52be78[_0x9ecd('0x2a')]+_0x52be78[_0x9ecd('0x2c')];var _0x4c6401;if(_0x5b7e6d>=_0x504784){_0x5b7e6d=_0x504784;_0x4c6401=0xc8;}else{_0x4c6401=0xce;}_0x1522ab[_0x9ecd('0x29')](_0x4c6401);return _0x1522ab[_0x9ecd('0x2e')](_0x9ecd('0x2f'),_0x2de3b1+'-'+_0x5b7e6d+'/'+_0x504784)[_0x9ecd('0x30')](_0x54d9ae);}return null;};}function patchUpdates(_0x4f0471){return function(_0x4a94ad){try{jsonpatch[_0x9ecd('0x31')](_0x4a94ad,_0x4f0471,!![]);}catch(_0x44de61){return BPromise[_0x9ecd('0x32')](_0x44de61);}return _0x4a94ad['save']();};}function saveUpdates(_0x35e9b6,_0x5e7fde){return function(_0x28f965){if(_0x28f965){return _0x28f965['update'](_0x35e9b6)[_0x9ecd('0x33')](function(_0x195145){return _0x195145;});}return null;};}function removeEntity(_0x4c614b,_0x57f1bb){return function(_0x29b0ed){if(_0x29b0ed){return _0x29b0ed['destroy']()[_0x9ecd('0x33')](function(){_0x4c614b[_0x9ecd('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x538991,_0x51cc82){return function(_0x4ca56d){if(!_0x4ca56d){_0x538991[_0x9ecd('0x28')](0x194);}return _0x4ca56d;};}function handleError(_0x467f99,_0x2a1f12){_0x2a1f12=_0x2a1f12||0x1f4;return function(_0x5bcdae){logger[_0x9ecd('0x23')](_0x5bcdae['stack']);if(_0x5bcdae[_0x9ecd('0x34')]){delete _0x5bcdae[_0x9ecd('0x34')];}_0x467f99[_0x9ecd('0x29')](_0x2a1f12)[_0x9ecd('0x35')](_0x5bcdae);};}exports[_0x9ecd('0x36')]=function(_0x376a70,_0x42cede){var _0x50aafb={},_0x5a2e19={},_0x1ffb23={'count':0x0,'rows':[]};var _0x4b1d67=_[_0x9ecd('0x37')](db[_0x9ecd('0x38')][_0x9ecd('0x39')],function(_0x173d6c){return{'name':_0x173d6c[_0x9ecd('0x3a')],'type':_0x173d6c['type'][_0x9ecd('0x3b')]};});_0x5a2e19[_0x9ecd('0x3c')]=_[_0x9ecd('0x37')](_0x4b1d67,_0x9ecd('0x34'));_0x5a2e19[_0x9ecd('0x3d')]=_[_0x9ecd('0x3e')](_0x376a70[_0x9ecd('0x3d')]);_0x5a2e19[_0x9ecd('0x3f')]=_[_0x9ecd('0x40')](_0x5a2e19['model'],_0x5a2e19[_0x9ecd('0x3d')]);_0x50aafb[_0x9ecd('0x41')]=_[_0x9ecd('0x40')](_0x5a2e19['model'],qs[_0x9ecd('0x42')](_0x376a70[_0x9ecd('0x3d')][_0x9ecd('0x42')]));_0x50aafb[_0x9ecd('0x41')]=_0x50aafb['attributes'][_0x9ecd('0x43')]?_0x50aafb[_0x9ecd('0x41')]:_0x5a2e19[_0x9ecd('0x3c')];if(!_0x376a70[_0x9ecd('0x3d')]['hasOwnProperty'](_0x9ecd('0x44'))){_0x50aafb['limit']=qs[_0x9ecd('0x2c')](_0x376a70['query'][_0x9ecd('0x2c')]);_0x50aafb['offset']=qs['offset'](_0x376a70[_0x9ecd('0x3d')][_0x9ecd('0x2a')]);}_0x50aafb[_0x9ecd('0x45')]=qs['sort'](_0x376a70[_0x9ecd('0x3d')][_0x9ecd('0x46')]);_0x50aafb[_0x9ecd('0x47')]=qs[_0x9ecd('0x3f')](_[_0x9ecd('0x48')](_0x376a70[_0x9ecd('0x3d')],_0x5a2e19[_0x9ecd('0x3f')]),_0x4b1d67);if(_0x376a70['query'][_0x9ecd('0x49')]){_0x50aafb[_0x9ecd('0x47')]=_[_0x9ecd('0x4a')](_0x50aafb[_0x9ecd('0x47')],{'$or':_[_0x9ecd('0x37')](_0x4b1d67,function(_0x310f3b){if(_0x310f3b[_0x9ecd('0x4b')]!==_0x9ecd('0x4c')){var _0x1089bc={};_0x1089bc[_0x310f3b['name']]={'$like':'%'+_0x376a70[_0x9ecd('0x3d')]['filter']+'%'};return _0x1089bc;}})});}_0x50aafb=_[_0x9ecd('0x4a')]({},_0x50aafb,_0x376a70[_0x9ecd('0x4d')]);var _0x265177={'where':_0x50aafb[_0x9ecd('0x47')]};return db['Setting'][_0x9ecd('0x2d')](_0x265177)['then'](function(_0x578e7f){_0x1ffb23['count']=_0x578e7f;if(_0x376a70[_0x9ecd('0x3d')][_0x9ecd('0x4e')]){_0x50aafb['include']=[{'all':!![]}];}return db[_0x9ecd('0x38')][_0x9ecd('0x4f')](_0x50aafb);})['then'](function(_0x31c294){_0x1ffb23[_0x9ecd('0x50')]=_0x31c294;return _0x1ffb23;})['then'](respondWithFilteredResult(_0x42cede,_0x50aafb))['catch'](handleError(_0x42cede,null));};exports[_0x9ecd('0x51')]=function(_0x4b9a16,_0x2c4fd8){var _0x5b8315={'raw':![],'where':{'id':_0x4b9a16[_0x9ecd('0x52')]['id']}},_0x9c5563={};_0x9c5563['model']=_[_0x9ecd('0x3e')](db['Setting'][_0x9ecd('0x39')]);_0x9c5563[_0x9ecd('0x3d')]=_['keys'](_0x4b9a16[_0x9ecd('0x3d')]);_0x9c5563[_0x9ecd('0x3f')]=_[_0x9ecd('0x40')](_0x9c5563[_0x9ecd('0x3c')],_0x9c5563['query']);_0x5b8315[_0x9ecd('0x41')]=_['intersection'](_0x9c5563[_0x9ecd('0x3c')],qs[_0x9ecd('0x42')](_0x4b9a16['query'][_0x9ecd('0x42')]));_0x5b8315[_0x9ecd('0x41')]=_0x5b8315[_0x9ecd('0x41')]['length']?_0x5b8315[_0x9ecd('0x41')]:_0x9c5563[_0x9ecd('0x3c')];if(_0x4b9a16[_0x9ecd('0x3d')][_0x9ecd('0x4e')]){_0x5b8315['include']=[{'all':!![]}];}_0x5b8315=_[_0x9ecd('0x4a')]({},_0x5b8315,_0x4b9a16[_0x9ecd('0x4d')]);return db[_0x9ecd('0x38')][_0x9ecd('0x53')](_0x5b8315)[_0x9ecd('0x33')](handleEntityNotFound(_0x2c4fd8,null))[_0x9ecd('0x33')](respondWithResult(_0x2c4fd8,null))[_0x9ecd('0x27')](handleError(_0x2c4fd8,null));};exports[_0x9ecd('0x54')]=function(_0xc1e84d,_0x3a7ebc){if(_0xc1e84d[_0x9ecd('0x55')]['id']){delete _0xc1e84d[_0x9ecd('0x55')]['id'];}return db[_0x9ecd('0x38')]['find']({'where':{'id':_0xc1e84d[_0x9ecd('0x52')]['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x3a7ebc,null))[_0x9ecd('0x33')](saveUpdates(_0xc1e84d['body'],null))[_0x9ecd('0x33')](respondWithResult(_0x3a7ebc,null))[_0x9ecd('0x27')](handleError(_0x3a7ebc,null));};exports[_0x9ecd('0x56')]=function(_0x3367,_0x1d3d63,_0x399c3c){if(_0x3367[_0x9ecd('0x57')]&&_0x3367[_0x9ecd('0x57')]['filename']){_0x3367[_0x9ecd('0x55')][_0x9ecd('0x58')]=_0x3367['file'][_0x9ecd('0x59')];}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x3367['params']['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x1d3d63,null))['then'](saveUpdates(_0x3367[_0x9ecd('0x55')],null))[_0x9ecd('0x33')](respondWithResult(_0x1d3d63,null))[_0x9ecd('0x27')](handleError(_0x1d3d63,null));};exports['addLogoLogin']=function(_0x35b61b,_0x181479,_0x477b04){if(_0x35b61b['file']&&_0x35b61b['file'][_0x9ecd('0x59')]){_0x35b61b['body'][_0x9ecd('0x5a')]=_0x35b61b[_0x9ecd('0x57')][_0x9ecd('0x59')];}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x35b61b['params']['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x181479,null))[_0x9ecd('0x33')](saveUpdates(_0x35b61b[_0x9ecd('0x55')],null))[_0x9ecd('0x33')](respondWithResult(_0x181479,null))[_0x9ecd('0x27')](handleError(_0x181479,null));};var utilLicense=require(_0x9ecd('0x19'));exports[_0x9ecd('0x5b')]=function(_0x37a8a0,_0x36c081,_0x1b4ac6){var _0x39aac5=_0x9ecd('0x5c');var _0x935814={'custom':![]};return utilLicense[_0x9ecd('0x5d')]()[_0x9ecd('0x33')](function(_0x11fe5a){if(_0x11fe5a){_0x935814=_0x11fe5a;}return db[_0x9ecd('0x38')]['find']({'where':{'id':_0x37a8a0[_0x9ecd('0x52')]['id']},'attributes':[_0x9ecd('0x58'),_0x9ecd('0x5a'),'preferred',_0x9ecd('0x5e'),_0x9ecd('0x5f'),'defaultLoginLogo','defaultPreferred',_0x9ecd('0x60')],'raw':!![]});})[_0x9ecd('0x33')](handleEntityNotFound(_0x36c081,null))['then'](function(_0x14fda6){if(_0x14fda6){var _0x29c962=_0x14fda6[_0x9ecd('0x58')]&&fs[_0x9ecd('0x61')](path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x39aac5,_[_0x9ecd('0x64')](_0x14fda6[_0x9ecd('0x58')])))?path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x39aac5,_[_0x9ecd('0x64')](_0x14fda6[_0x9ecd('0x58')])):path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x39aac5,_[_0x9ecd('0x64')](_0x9ecd('0x65')));var _0x5ddd4f='default'+_[_0x9ecd('0x66')](_0x9ecd('0x58'));if(_0x14fda6[_0x5ddd4f]||!_0x935814[_0x9ecd('0x67')]){_0x29c962=path['join'](config[_0x9ecd('0x63')],_0x39aac5,_[_0x9ecd('0x64')](_0x9ecd('0x65')));}if(!fs[_0x9ecd('0x61')](_0x29c962)){throw new db[(_0x9ecd('0x68'))][(_0x9ecd('0x69'))](_[_0x9ecd('0x66')](_0x9ecd('0x58'))+_0x9ecd('0x6a'));}return _0x36c081[_0x9ecd('0x6b')](_0x29c962);}})['catch'](handleError(_0x36c081,null));};var utilLicense=require(_0x9ecd('0x19'));exports[_0x9ecd('0x6c')]=function(_0x3e1375,_0x1d2fb6,_0x426cf4){var _0x1a0e7d='server/files/images/logos';var _0x21c605={'custom':![]};return utilLicense[_0x9ecd('0x5d')]()['then'](function(_0x59b8c4){if(_0x59b8c4){_0x21c605=_0x59b8c4;}return db[_0x9ecd('0x38')]['find']({'where':{'id':_0x3e1375['params']['id']},'attributes':['logo',_0x9ecd('0x5a'),'preferred',_0x9ecd('0x5e'),'defaultLogo',_0x9ecd('0x6d'),'defaultPreferred',_0x9ecd('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x1d2fb6,null))[_0x9ecd('0x33')](function(_0x4749a8){if(_0x4749a8){var _0x4f793a=_0x4749a8['loginLogo']&&fs[_0x9ecd('0x61')](path['join'](config['root'],_0x1a0e7d,_[_0x9ecd('0x64')](_0x4749a8[_0x9ecd('0x5a')])))?path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x1a0e7d,_[_0x9ecd('0x64')](_0x4749a8['loginLogo'])):path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x1a0e7d,_['toLower']('default_loginLogo.svg'));var _0x597815=_0x9ecd('0x6e')+_[_0x9ecd('0x66')](_0x9ecd('0x5a'));if(_0x4749a8[_0x597815]||!_0x21c605[_0x9ecd('0x67')]){_0x4f793a=path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x1a0e7d,_[_0x9ecd('0x64')](_0x9ecd('0x6f')));}if(!fs[_0x9ecd('0x61')](_0x4f793a)){throw new db[(_0x9ecd('0x68'))]['ValidationError'](_[_0x9ecd('0x66')](_0x9ecd('0x5a'))+_0x9ecd('0x6a'));}return _0x1d2fb6['download'](_0x4f793a);}})[_0x9ecd('0x27')](handleError(_0x1d2fb6,null));};exports['gdpr']=function(_0x10b7a3,_0x4d815d){return db[_0x9ecd('0x38')]['find']({'where':{'id':_0x10b7a3[_0x9ecd('0x52')]['id']},'attributes':[_0x9ecd('0x70')]})['then'](respondWithResult(_0x4d815d,null))[_0x9ecd('0x27')](handleError(_0x4d815d,null));};exports['addPreferred']=function(_0x497e5d,_0x12e826,_0xd7091f){if(_0x497e5d[_0x9ecd('0x57')]&&_0x497e5d['file'][_0x9ecd('0x59')]){_0x497e5d[_0x9ecd('0x55')][_0x9ecd('0x71')]=_0x497e5d[_0x9ecd('0x57')][_0x9ecd('0x59')];}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x497e5d[_0x9ecd('0x52')]['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x12e826,null))[_0x9ecd('0x33')](saveUpdates(_0x497e5d['body'],null))['then'](respondWithResult(_0x12e826,null))[_0x9ecd('0x27')](handleError(_0x12e826,null));};var utilLicense=require(_0x9ecd('0x19'));exports[_0x9ecd('0x72')]=function(_0x1e9a6c,_0x5d91c1,_0x3f93c5){var _0x47893b=_0x9ecd('0x5c');var _0x3a56c4={'custom':![]};return utilLicense[_0x9ecd('0x5d')]()['then'](function(_0x10f78c){if(_0x10f78c){_0x3a56c4=_0x10f78c;}return db[_0x9ecd('0x38')]['find']({'where':{'id':_0x1e9a6c[_0x9ecd('0x52')]['id']},'attributes':[_0x9ecd('0x58'),_0x9ecd('0x5a'),_0x9ecd('0x71'),_0x9ecd('0x5e'),'defaultLogo',_0x9ecd('0x6d'),_0x9ecd('0x73'),_0x9ecd('0x60')],'raw':!![]});})[_0x9ecd('0x33')](handleEntityNotFound(_0x5d91c1,null))[_0x9ecd('0x33')](function(_0x14cddb){if(_0x14cddb){var _0x7aee1c=_0x14cddb[_0x9ecd('0x71')]&&fs[_0x9ecd('0x61')](path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x47893b,_[_0x9ecd('0x64')](_0x14cddb[_0x9ecd('0x71')])))?path['join'](config['root'],_0x47893b,_[_0x9ecd('0x64')](_0x14cddb[_0x9ecd('0x71')])):path['join'](config[_0x9ecd('0x63')],_0x47893b,_[_0x9ecd('0x64')](_0x9ecd('0x74')));var _0x3f3206=_0x9ecd('0x6e')+_[_0x9ecd('0x66')](_0x9ecd('0x71'));if(_0x14cddb[_0x3f3206]||!_0x3a56c4[_0x9ecd('0x67')]||!_0x3a56c4[_0x9ecd('0x71')]){_0x7aee1c=path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x47893b,_['toLower']('default_preferred.png'));}if(!fs[_0x9ecd('0x61')](_0x7aee1c)){throw new db[(_0x9ecd('0x68'))][(_0x9ecd('0x69'))](_[_0x9ecd('0x66')](_0x9ecd('0x71'))+'\x20not\x20found');}return _0x5d91c1[_0x9ecd('0x6b')](_0x7aee1c);}})[_0x9ecd('0x27')](handleError(_0x5d91c1,null));};exports[_0x9ecd('0x75')]=function(_0x562d2c,_0x4513e4,_0x38fcef){if(_0x562d2c[_0x9ecd('0x57')]&&_0x562d2c[_0x9ecd('0x57')][_0x9ecd('0x59')]){_0x562d2c[_0x9ecd('0x55')]['favicon']=_0x562d2c[_0x9ecd('0x57')]['filename'];}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x562d2c[_0x9ecd('0x52')]['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x4513e4,null))['then'](saveUpdates(_0x562d2c['body'],null))['then'](respondWithResult(_0x4513e4,null))[_0x9ecd('0x27')](handleError(_0x4513e4,null));};var utilLicense=require('../../config/license/util');exports[_0x9ecd('0x76')]=function(_0x329e47,_0x266d87,_0x72e355){var _0x49c16c=_0x9ecd('0x5c');var _0x375be6={'custom':![]};return utilLicense[_0x9ecd('0x5d')]()[_0x9ecd('0x33')](function(_0xa67126){if(_0xa67126){_0x375be6=_0xa67126;}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x329e47[_0x9ecd('0x52')]['id']},'attributes':[_0x9ecd('0x58'),_0x9ecd('0x5a'),_0x9ecd('0x71'),_0x9ecd('0x5e'),_0x9ecd('0x5f'),_0x9ecd('0x6d'),_0x9ecd('0x73'),'defaultFavicon'],'raw':!![]});})[_0x9ecd('0x33')](handleEntityNotFound(_0x266d87,null))[_0x9ecd('0x33')](function(_0x31e247){if(_0x31e247){var _0x129677=_0x31e247['favicon']&&fs[_0x9ecd('0x61')](path['join'](config[_0x9ecd('0x63')],_0x49c16c,_[_0x9ecd('0x64')](_0x31e247[_0x9ecd('0x5e')])))?path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x49c16c,_[_0x9ecd('0x64')](_0x31e247[_0x9ecd('0x5e')])):path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x49c16c,_[_0x9ecd('0x64')](_0x9ecd('0x77')));var _0x112231='default'+_[_0x9ecd('0x66')](_0x9ecd('0x5e'));if(_0x31e247[_0x112231]||!_0x375be6[_0x9ecd('0x67')]){_0x129677=path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x49c16c,_['toLower'](_0x9ecd('0x77')));}if(!fs['existsSync'](_0x129677)){throw new db[(_0x9ecd('0x68'))][(_0x9ecd('0x69'))](_[_0x9ecd('0x66')](_0x9ecd('0x5e'))+_0x9ecd('0x6a'));}return _0x266d87['download'](_0x129677);}})[_0x9ecd('0x27')](handleError(_0x266d87,null));};exports['getDate']=function(_0x54d341,_0x25258e){var _0x285468={'offset':moment()[_0x9ecd('0x78')]()};_0x285468[_0x9ecd('0x79')]=moment()[_0x9ecd('0x78')](_0x285468[_0x9ecd('0x2a')])['format'](_0x9ecd('0x7a'));return _0x25258e['status'](0xc8)[_0x9ecd('0x35')](_0x285468);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5bb2479..8c2228a 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0xf859b3,_0x250f40){var _0x156c5b=function(_0x15f63d){while(--_0x15f63d){_0xf859b3['push'](_0xf859b3['shift']());}};_0x156c5b(++_0x250f40);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f8da5,_0x1d703b){_0x3f8da5=_0x3f8da5-0x0;var _0x5c19cf=_0xedd9[_0x3f8da5];return _0x5c19cf;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f1b3dc2..005aad5 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 _0x3581=['map','include','model','ShowSetting','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','find','options','raw','where','attributes'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x3581,0x11b));var _0x1358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1358('0x0'));var rs=require(_0x1358('0x1'));var fs=require('fs');var Redis=require(_0x1358('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1358('0x3'));var logger=require(_0x1358('0x4'))('rpc');var config=require(_0x1358('0x5'));var jayson=require(_0x1358('0x6'));var client=jayson[_0x1358('0x7')][_0x1358('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58f1b9,_0x122608,_0x18ec68){return new BPromise(function(_0x3f4ccf,_0x16a9df){return client[_0x1358('0x9')](_0x58f1b9,_0x18ec68)[_0x1358('0xa')](function(_0x257338){logger[_0x1358('0xb')](_0x1358('0xc'),_0x122608,'request\x20sent');logger[_0x1358('0xd')](_0x1358('0xe'),_0x122608,_0x1358('0xf'),JSON[_0x1358('0x10')](_0x257338));if(_0x257338[_0x1358('0x11')]){if(_0x257338['error'][_0x1358('0x12')]===0x1f4){logger[_0x1358('0x11')]('Setting,\x20%s,\x20%s',_0x122608,_0x257338['error']['message']);return _0x16a9df(_0x257338['error'][_0x1358('0x13')]);}logger[_0x1358('0x11')](_0x1358('0xc'),_0x122608,_0x257338[_0x1358('0x11')][_0x1358('0x13')]);return _0x3f4ccf(_0x257338[_0x1358('0x11')]['message']);}else{logger[_0x1358('0xb')](_0x1358('0xc'),_0x122608,_0x1358('0xf'));_0x3f4ccf(_0x257338[_0x1358('0x14')][_0x1358('0x13')]);}})[_0x1358('0x15')](function(_0x1b041c){logger[_0x1358('0x11')](_0x1358('0xc'),_0x122608,_0x1b041c);_0x16a9df(_0x1b041c);});});}exports['ShowSetting']=function(_0xb80d86){var _0x5a6e73=this;return new Promise(function(_0x30cdc8,_0x5664d9){return db['Setting'][_0x1358('0x16')]({'raw':_0xb80d86[_0x1358('0x17')]?_0xb80d86[_0x1358('0x17')][_0x1358('0x18')]===undefined?!![]:![]:!![],'where':_0xb80d86[_0x1358('0x17')]?_0xb80d86['options'][_0x1358('0x19')]||null:null,'attributes':_0xb80d86[_0x1358('0x17')]?_0xb80d86[_0x1358('0x17')][_0x1358('0x1a')]||null:null,'include':_0xb80d86['options']?_0xb80d86['options']['include']?_[_0x1358('0x1b')](_0xb80d86[_0x1358('0x17')][_0x1358('0x1c')],function(_0x4740c){return{'model':db[_0x4740c[_0x1358('0x1d')]],'as':_0x4740c['as'],'attributes':_0x4740c[_0x1358('0x1a')],'include':_0x4740c['include']?_[_0x1358('0x1b')](_0x4740c[_0x1358('0x1c')],function(_0x4368c8){return{'model':db[_0x4368c8[_0x1358('0x1d')]],'as':_0x4368c8['as'],'attributes':_0x4368c8['attributes'],'include':_0x4368c8[_0x1358('0x1c')]?_[_0x1358('0x1b')](_0x4368c8[_0x1358('0x1c')],function(_0x4da13c){return{'model':db[_0x4da13c[_0x1358('0x1d')]],'as':_0x4da13c['as'],'attributes':_0x4da13c[_0x1358('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb0bfa4){logger[_0x1358('0xb')]('ShowSetting',_0xb80d86);logger[_0x1358('0xd')](_0x1358('0x1e'),_0xb80d86,JSON['stringify'](_0xb0bfa4));_0x30cdc8(_0xb0bfa4);})[_0x1358('0x15')](function(_0x201f24){logger[_0x1358('0x11')](_0x1358('0x1e'),_0x201f24[_0x1358('0x13')],_0xb80d86);_0x5664d9(_0x5a6e73[_0x1358('0x11')](0x1f4,_0x201f24[_0x1358('0x13')]));});});}; \ No newline at end of file +var _0x410f=['Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Setting','find','options','attributes','include','model','map','ShowSetting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x2b0b61,_0x170827){var _0x2ae144=function(_0x4f0459){while(--_0x4f0459){_0x2b0b61['push'](_0x2b0b61['shift']());}};_0x2ae144(++_0x170827);}(_0x410f,0x1c5));var _0xf410=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x410f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf410('0x0'));var util=require('util');var moment=require(_0xf410('0x1'));var BPromise=require(_0xf410('0x2'));var rs=require(_0xf410('0x3'));var fs=require('fs');var Redis=require(_0xf410('0x4'));var db=require(_0xf410('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf410('0x6'))(_0xf410('0x7'));var config=require('../../config/environment');var jayson=require(_0xf410('0x8'));var client=jayson[_0xf410('0x9')][_0xf410('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1152ea,_0x3f74e2,_0x3cda28){return new BPromise(function(_0x38701b,_0x5a577c){return client['request'](_0x1152ea,_0x3cda28)[_0xf410('0xb')](function(_0x3018e0){logger['info'](_0xf410('0xc'),_0x3f74e2,_0xf410('0xd'));logger[_0xf410('0xe')](_0xf410('0xf'),_0x3f74e2,'request\x20sent',JSON[_0xf410('0x10')](_0x3018e0));if(_0x3018e0[_0xf410('0x11')]){if(_0x3018e0[_0xf410('0x11')][_0xf410('0x12')]===0x1f4){logger[_0xf410('0x11')](_0xf410('0xc'),_0x3f74e2,_0x3018e0[_0xf410('0x11')][_0xf410('0x13')]);return _0x5a577c(_0x3018e0['error']['message']);}logger[_0xf410('0x11')](_0xf410('0xc'),_0x3f74e2,_0x3018e0[_0xf410('0x11')][_0xf410('0x13')]);return _0x38701b(_0x3018e0[_0xf410('0x11')]['message']);}else{logger[_0xf410('0x14')](_0xf410('0xc'),_0x3f74e2,_0xf410('0xd'));_0x38701b(_0x3018e0[_0xf410('0x15')][_0xf410('0x13')]);}})[_0xf410('0x16')](function(_0x1045f7){logger[_0xf410('0x11')](_0xf410('0xc'),_0x3f74e2,_0x1045f7);_0x5a577c(_0x1045f7);});});}exports['ShowSetting']=function(_0xdd7fe1){var _0x409749=this;return new Promise(function(_0x4c27e9,_0x596ec3){return db[_0xf410('0x17')][_0xf410('0x18')]({'raw':_0xdd7fe1['options']?_0xdd7fe1[_0xf410('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xdd7fe1[_0xf410('0x19')]?_0xdd7fe1[_0xf410('0x19')]['where']||null:null,'attributes':_0xdd7fe1[_0xf410('0x19')]?_0xdd7fe1[_0xf410('0x19')][_0xf410('0x1a')]||null:null,'include':_0xdd7fe1[_0xf410('0x19')]?_0xdd7fe1[_0xf410('0x19')][_0xf410('0x1b')]?_['map'](_0xdd7fe1[_0xf410('0x19')][_0xf410('0x1b')],function(_0x519186){return{'model':db[_0x519186[_0xf410('0x1c')]],'as':_0x519186['as'],'attributes':_0x519186[_0xf410('0x1a')],'include':_0x519186[_0xf410('0x1b')]?_[_0xf410('0x1d')](_0x519186['include'],function(_0x1b9819){return{'model':db[_0x1b9819[_0xf410('0x1c')]],'as':_0x1b9819['as'],'attributes':_0x1b9819[_0xf410('0x1a')],'include':_0x1b9819['include']?_[_0xf410('0x1d')](_0x1b9819[_0xf410('0x1b')],function(_0x3c331c){return{'model':db[_0x3c331c['model']],'as':_0x3c331c['as'],'attributes':_0x3c331c[_0xf410('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf410('0xb')](function(_0x233329){logger['info'](_0xf410('0x1e'),_0xdd7fe1);logger[_0xf410('0xe')](_0xf410('0x1e'),_0xdd7fe1,JSON[_0xf410('0x10')](_0x233329));_0x4c27e9(_0x233329);})[_0xf410('0x16')](function(_0x3304e1){logger[_0xf410('0x11')](_0xf410('0x1e'),_0x3304e1[_0xf410('0x13')],_0xdd7fe1);_0x596ec3(_0x409749[_0xf410('0x11')](0x1f4,_0x3304e1[_0xf410('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 31fcc05..7f7cf6b 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x381cbe,_0x17511b){var _0x1a615d=function(_0x2433d4){while(--_0x2433d4){_0x381cbe['push'](_0x381cbe['shift']());}};_0x1a615d(++_0x17511b);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x2223be,_0x4e4034){var _0x453496=function(_0x18f9ee){while(--_0x18f9ee){_0x2223be['push'](_0x2223be['shift']());}};_0x453496(++_0x4e4034);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 553b374..8d27055 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 _0x26be=['randomstring','exports','name','STRING','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x26be,0x15f));var _0xe26b=function(_0x260d37,_0xa7355e){_0x260d37=_0x260d37-0x0;var _0x1a2d8b=_0x26be[_0x260d37];return _0x1a2d8b;};'use strict';var Sequelize=require(_0xe26b('0x0'));var rs=require(_0xe26b('0x1'));module[_0xe26b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xe26b('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xe26b('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xe26b('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe26b('0x5')](_0xe26b('0x6'),_0xe26b('0x7'),'connectel',_0xe26b('0x8'),_0xe26b('0x9'),_0xe26b('0xa'),_0xe26b('0xb'),_0xe26b('0xc'),'infobip',_0xe26b('0xd'))},'accountSid':{'type':Sequelize[_0xe26b('0x4')]},'authId':{'type':Sequelize[_0xe26b('0x4')]},'authToken':{'type':Sequelize[_0xe26b('0x4')]},'smsMethod':{'type':Sequelize[_0xe26b('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe26b('0x4')]},'password':{'type':Sequelize[_0xe26b('0x4')]},'apiKey':{'type':Sequelize[_0xe26b('0x4')]},'applicationId':{'type':Sequelize[_0xe26b('0x4')]},'accountId':{'type':Sequelize[_0xe26b('0x4')]},'senderString':{'type':Sequelize[_0xe26b('0x4')]},'deliveryReport':{'type':Sequelize[_0xe26b('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xe26b('0x4')]},'notificationTemplate':{'type':Sequelize[_0xe26b('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe26b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe26b('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe26b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe26b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe26b('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe26b('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe26b('0x12'),'set':function(_0x23187a){if(!_0x23187a)this[_0xe26b('0x13')](_0xe26b('0x14'),null);this[_0xe26b('0x13')](_0xe26b('0x15'),_0x23187a);}}}; \ No newline at end of file +var _0xe89a=['connectel','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','skebby'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe89a,0xad));var _0xae89=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xe89a[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xae89('0x0'));module[_0xae89('0x1')]={'name':{'type':Sequelize[_0xae89('0x2')],'unique':_0xae89('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xae89('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xae89('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xae89('0x2')]},'type':{'type':Sequelize[_0xae89('0x4')](_0xae89('0x5'),_0xae89('0x6'),_0xae89('0x7'),'clicksend',_0xae89('0x8'),_0xae89('0x9'),'bandwidth',_0xae89('0xa'),_0xae89('0xb'),_0xae89('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xae89('0x2')]},'authToken':{'type':Sequelize[_0xae89('0x2')]},'smsMethod':{'type':Sequelize[_0xae89('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xae89('0x2')]},'password':{'type':Sequelize[_0xae89('0x2')]},'apiKey':{'type':Sequelize[_0xae89('0x2')]},'applicationId':{'type':Sequelize[_0xae89('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xae89('0x2')]},'deliveryReport':{'type':Sequelize[_0xae89('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xae89('0xe');}},'notificationSound':{'type':Sequelize[_0xae89('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xae89('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xae89('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xae89('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xae89('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xae89('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae89('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae89('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xae89('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae89('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xae89('0x10'),'set':function(_0x3336b1){if(!_0x3336b1)this[_0xae89('0x11')](_0xae89('0x12'),null);this['setDataValue'](_0xae89('0x13'),_0x3336b1);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 702fe22..77fa413 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 _0x2892=['SmsApplication','Applications','account','applications','orderBy','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','from','message_id','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','mapKey','includes','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','SmsMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','stringify','Content-Type','text/xml','send','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','Contact','fullname','internal','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','csc','state','message-id','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','findOne','ids','addAnswer','CannedAnswer','getAnswers','length','removeAnswers','notify'];(function(_0x25787e,_0x12c583){var _0x3b4a65=function(_0x3473a7){while(--_0x3473a7){_0x25787e['push'](_0x25787e['shift']());}};_0x3b4a65(++_0x12c583);}(_0x2892,0x74));var _0x2289=function(_0x1e95b6,_0xf75a82){_0x1e95b6=_0x1e95b6-0x0;var _0x3982c6=_0x2892[_0x1e95b6];return _0x3982c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2289('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2289('0x1'));var moment=require(_0x2289('0x2'));var BPromise=require(_0x2289('0x3'));var Mustache=require('mustache');var util=require(_0x2289('0x4'));var path=require(_0x2289('0x5'));var sox=require(_0x2289('0x6'));var csv=require(_0x2289('0x7'));var ejs=require(_0x2289('0x8'));var fs=require('fs');var fs_extra=require(_0x2289('0x9'));var _=require(_0x2289('0xa'));var squel=require('squel');var crypto=require(_0x2289('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2289('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2289('0xd'));var Redis=require('ioredis');var authService=require(_0x2289('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2289('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2289('0x10'));var utils=require(_0x2289('0x11'));var config=require(_0x2289('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x2289('0x13'))['db'];config[_0x2289('0x14')]=_[_0x2289('0x15')](config[_0x2289('0x14')],{'host':_0x2289('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2289('0x14')]));require(_0x2289('0x17'))[_0x2289('0x18')](socket);var jayson=require(_0x2289('0x19'));var client=jayson['client'][_0x2289('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x1e188c,_0x2fe899,_0x370a0d,_0x38ccd0){return new BPromise(function(_0xa2ceb4,_0x2d1281){var _0x51b1c3=_0x38ccd0||client;return _0x51b1c3[_0x2289('0x1b')](_0x1e188c,_0x370a0d)[_0x2289('0x1c')](function(_0x2ccfae){logger[_0x2289('0x1d')](_0x2289('0x1e'),_0x2fe899,'request\x20sent');logger[_0x2289('0x1f')](_0x2289('0x20'),_0x2fe899,_0x2289('0x21'),JSON['stringify'](_0x2ccfae));if(_0x2ccfae['error']){if(_0x2ccfae[_0x2289('0x22')][_0x2289('0x23')]===0x1f4){logger[_0x2289('0x22')](_0x2289('0x1e'),_0x2fe899,_0x2ccfae[_0x2289('0x22')]['message']);return _0x2d1281(_0x2ccfae[_0x2289('0x22')]['message']);}logger['error'](_0x2289('0x1e'),_0x2fe899,_0x2ccfae[_0x2289('0x22')][_0x2289('0x24')]);return _0xa2ceb4(_0x2ccfae[_0x2289('0x22')]['message']);}else{logger['info'](_0x2289('0x1e'),_0x2fe899,'request\x20sent');_0xa2ceb4(_0x2ccfae[_0x2289('0x25')][_0x2289('0x24')]);}})['catch'](function(_0x1be522){logger[_0x2289('0x22')](_0x2289('0x1e'),_0x2fe899,_0x1be522);_0x2d1281(_0x1be522);});});}function respondWithStatusCode(_0x27fe5c,_0x56eb81){_0x56eb81=_0x56eb81||0xcc;return function(_0x1626d7){if(_0x1626d7){return _0x27fe5c[_0x2289('0x26')](_0x56eb81);}return _0x27fe5c[_0x2289('0x27')](_0x56eb81)['end']();};}function respondWithResult(_0x327540,_0x115c7b){_0x115c7b=_0x115c7b||0xc8;return function(_0x219352){if(_0x219352){return _0x327540[_0x2289('0x27')](_0x115c7b)['json'](_0x219352);}};}function respondWithFilteredResult(_0x24b9e9,_0x15d300){return function(_0x18cf4d){if(_0x18cf4d){var _0x1082c3=typeof _0x15d300[_0x2289('0x28')]===_0x2289('0x29')&&typeof _0x15d300[_0x2289('0x2a')]===_0x2289('0x29');var _0x387653=_0x18cf4d[_0x2289('0x2b')];var _0x88f73b=_0x1082c3?0x0:_0x15d300[_0x2289('0x28')];var _0x58e00a=_0x1082c3?_0x18cf4d['count']:_0x15d300['offset']+_0x15d300[_0x2289('0x2a')];var _0x4a11a1;if(_0x58e00a>=_0x387653){_0x58e00a=_0x387653;_0x4a11a1=0xc8;}else{_0x4a11a1=0xce;}_0x24b9e9['status'](_0x4a11a1);return _0x24b9e9[_0x2289('0x2c')](_0x2289('0x2d'),_0x88f73b+'-'+_0x58e00a+'/'+_0x387653)[_0x2289('0x2e')](_0x18cf4d);}return null;};}function patchUpdates(_0x19729b){return function(_0x218ae9){try{jsonpatch[_0x2289('0x2f')](_0x218ae9,_0x19729b,!![]);}catch(_0x18ad40){return BPromise[_0x2289('0x30')](_0x18ad40);}return _0x218ae9['save']();};}function saveUpdates(_0x36fe2a,_0x864350){return function(_0x2818da){if(_0x2818da){return _0x2818da[_0x2289('0x31')](_0x36fe2a)['then'](function(_0x35a98a){return _0x35a98a;});}return null;};}function removeEntity(_0x37c6d7,_0x485106){return function(_0x3eb0ce){if(_0x3eb0ce){return _0x3eb0ce['destroy']()[_0x2289('0x1c')](function(){var _0x9e2a6f=_0x3eb0ce[_0x2289('0x32')]({'plain':!![]});var _0x2a8b70=_0x2289('0x33');return db[_0x2289('0x34')][_0x2289('0x35')]({'where':{'type':_0x2a8b70,'resourceId':_0x9e2a6f['id']}})[_0x2289('0x1c')](function(){return _0x3eb0ce;});})[_0x2289('0x1c')](function(){_0x37c6d7[_0x2289('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cedc6,_0x14a509){return function(_0x1ae824){if(!_0x1ae824){_0x1cedc6['sendStatus'](0x194);}return _0x1ae824;};}function handleError(_0x2db333,_0x47a724){_0x47a724=_0x47a724||0x1f4;return function(_0x279f57){logger[_0x2289('0x22')](_0x279f57[_0x2289('0x36')]);if(_0x279f57[_0x2289('0x37')]){delete _0x279f57[_0x2289('0x37')];}_0x2db333['status'](_0x47a724)['send'](_0x279f57);};}exports['index']=function(_0x4277f5,_0x448197){var _0x1341bd={'include':[{'model':db[_0x2289('0x38')],'as':_0x2289('0x39')}]},_0x3b4cfd={},_0x4c5fd9={'count':0x0,'rows':[]};var _0x1d2b38=_[_0x2289('0x3a')](db[_0x2289('0x3b')]['rawAttributes'],function(_0x108597){return{'name':_0x108597[_0x2289('0x3c')],'type':_0x108597[_0x2289('0x3d')][_0x2289('0x3e')]};});_0x3b4cfd['model']=_[_0x2289('0x3a')](_0x1d2b38,'name');_0x3b4cfd[_0x2289('0x3f')]=_['keys'](_0x4277f5[_0x2289('0x3f')]);_0x3b4cfd['filters']=_['intersection'](_0x3b4cfd[_0x2289('0x40')],_0x3b4cfd[_0x2289('0x3f')]);_0x1341bd[_0x2289('0x41')]=_[_0x2289('0x42')](_0x3b4cfd['model'],qs[_0x2289('0x43')](_0x4277f5[_0x2289('0x3f')][_0x2289('0x43')]));_0x1341bd['attributes']=_0x1341bd[_0x2289('0x41')]['length']?_0x1341bd[_0x2289('0x41')]:_0x3b4cfd[_0x2289('0x40')];if(!_0x4277f5['query'][_0x2289('0x44')](_0x2289('0x45'))){_0x1341bd[_0x2289('0x2a')]=qs['limit'](_0x4277f5[_0x2289('0x3f')][_0x2289('0x2a')]);_0x1341bd[_0x2289('0x28')]=qs[_0x2289('0x28')](_0x4277f5[_0x2289('0x3f')][_0x2289('0x28')]);}_0x1341bd[_0x2289('0x46')]=qs[_0x2289('0x47')](_0x4277f5[_0x2289('0x3f')][_0x2289('0x47')]);_0x1341bd[_0x2289('0x48')]=qs[_0x2289('0x49')](_[_0x2289('0x4a')](_0x4277f5['query'],_0x3b4cfd['filters']),_0x1d2b38);if(_0x4277f5[_0x2289('0x3f')][_0x2289('0x4b')]){_0x1341bd[_0x2289('0x48')]=_[_0x2289('0x4c')](_0x1341bd['where'],{'$or':_[_0x2289('0x3a')](_0x1d2b38,function(_0x332adf){if(_0x332adf[_0x2289('0x3d')]!==_0x2289('0x4d')){var _0x334813={};_0x334813[_0x332adf[_0x2289('0x37')]]={'$like':'%'+_0x4277f5['query'][_0x2289('0x4b')]+'%'};return _0x334813;}})});}_0x1341bd=_[_0x2289('0x4c')]({},_0x1341bd,_0x4277f5[_0x2289('0x4e')]);var _0x54c2b6={'where':_0x1341bd[_0x2289('0x48')]};return db[_0x2289('0x3b')][_0x2289('0x2b')](_0x54c2b6)['then'](function(_0x497344){_0x4c5fd9[_0x2289('0x2b')]=_0x497344;if(_0x4277f5[_0x2289('0x3f')][_0x2289('0x4f')]){_0x1341bd[_0x2289('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0x2289('0x51')](_0x1341bd);})[_0x2289('0x1c')](function(_0xa27876){_0x4c5fd9[_0x2289('0x52')]=_0xa27876;return _0x4c5fd9;})[_0x2289('0x1c')](respondWithFilteredResult(_0x448197,_0x1341bd))[_0x2289('0x53')](handleError(_0x448197,null));};exports['show']=function(_0x1a2840,_0x7578f){var _0x24abf3={'raw':![],'where':{'id':_0x1a2840[_0x2289('0x54')]['id']},'include':[{'model':db[_0x2289('0x38')],'as':_0x2289('0x39')}]},_0x50144e={};_0x50144e['model']=_[_0x2289('0x55')](db[_0x2289('0x3b')][_0x2289('0x56')]);_0x50144e['query']=_[_0x2289('0x55')](_0x1a2840[_0x2289('0x3f')]);_0x50144e['filters']=_[_0x2289('0x42')](_0x50144e[_0x2289('0x40')],_0x50144e[_0x2289('0x3f')]);_0x24abf3[_0x2289('0x41')]=_[_0x2289('0x42')](_0x50144e[_0x2289('0x40')],qs[_0x2289('0x43')](_0x1a2840['query'][_0x2289('0x43')]));_0x24abf3['attributes']=_0x24abf3[_0x2289('0x41')]['length']?_0x24abf3[_0x2289('0x41')]:_0x50144e[_0x2289('0x40')];if(_0x1a2840['query'][_0x2289('0x4f')]){_0x24abf3[_0x2289('0x50')]=[{'all':!![]}];}_0x24abf3=_['merge']({},_0x24abf3,_0x1a2840[_0x2289('0x4e')]);return db['SmsAccount'][_0x2289('0x57')](_0x24abf3)[_0x2289('0x1c')](handleEntityNotFound(_0x7578f,null))[_0x2289('0x1c')](respondWithResult(_0x7578f,null))['catch'](handleError(_0x7578f,null));};exports[_0x2289('0x58')]=function(_0x13dbbc,_0x24d8cf){return db['SmsAccount']['create'](_0x13dbbc['body'],{})[_0x2289('0x1c')](function(_0xc82cd9){var _0x20b20b=_0x13dbbc[_0x2289('0x59')][_0x2289('0x32')]({'plain':!![]});if(!_0x20b20b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20b20b[_0x2289('0x5a')]==='user'){var _0x1171a0=_0xc82cd9[_0x2289('0x32')]({'plain':!![]});var _0x214c79=_0x2289('0x33');return db[_0x2289('0x5b')]['find']({'where':{'name':_0x214c79,'userProfileId':_0x20b20b[_0x2289('0x5c')]},'raw':!![]})['then'](function(_0x7b4cf5){if(_0x7b4cf5&&_0x7b4cf5[_0x2289('0x5d')]===0x0){return db[_0x2289('0x34')][_0x2289('0x58')]({'name':_0x1171a0[_0x2289('0x37')],'resourceId':_0x1171a0['id'],'type':_0x7b4cf5['name'],'sectionId':_0x7b4cf5['id']},{})['then'](function(){return _0xc82cd9;});}else{return _0xc82cd9;}})[_0x2289('0x53')](function(_0x25d193){logger[_0x2289('0x22')](_0x2289('0x5e'),_0x25d193);throw _0x25d193;});}return _0xc82cd9;})[_0x2289('0x1c')](respondWithResult(_0x24d8cf,0xc9))[_0x2289('0x53')](handleError(_0x24d8cf,null));};exports[_0x2289('0x31')]=function(_0xca7a62,_0x492691){if(_0xca7a62['body']['id']){delete _0xca7a62[_0x2289('0x5f')]['id'];}return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0xca7a62[_0x2289('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x2289('0x39')}]})[_0x2289('0x1c')](handleEntityNotFound(_0x492691,null))['then'](saveUpdates(_0xca7a62[_0x2289('0x5f')],null))[_0x2289('0x1c')](respondWithResult(_0x492691,null))[_0x2289('0x53')](handleError(_0x492691,null));};exports[_0x2289('0x35')]=function(_0x4386e9,_0x4cb688){return db[_0x2289('0x3b')]['find']({'where':{'id':_0x4386e9[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x4cb688,null))[_0x2289('0x1c')](removeEntity(_0x4cb688,null))[_0x2289('0x53')](handleError(_0x4cb688,null));};exports['describe']=function(_0x20ac25,_0x8bb334){return db[_0x2289('0x3b')][_0x2289('0x60')]()['then'](respondWithResult(_0x8bb334,null))[_0x2289('0x53')](handleError(_0x8bb334,null));};exports[_0x2289('0x61')]=function(_0x564044,_0x47f1fb,_0x3024c5){if(_0x564044[_0x2289('0x5f')]['id']){delete _0x564044[_0x2289('0x5f')]['id'];}return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x564044[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x47f1fb,null))[_0x2289('0x1c')](function(_0x4a9e65){if(_0x4a9e65){_0x564044['body'][_0x2289('0x62')]=_0x4a9e65['id'];return db[_0x2289('0x63')][_0x2289('0x58')](_0x564044[_0x2289('0x5f')]);}})['then'](respondWithResult(_0x47f1fb,null))['catch'](handleError(_0x47f1fb,null));};exports['getDispositions']=function(_0x339b82,_0x157409,_0x562867){var _0xb0b134={'raw':![],'where':{}};var _0x18dc8d={};var _0x2ac880={'count':0x0,'rows':[]};return db[_0x2289('0x3b')][_0x2289('0x64')]({'where':{'id':_0x339b82[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x157409,null))[_0x2289('0x1c')](function(_0x1d366d){if(_0x1d366d){_0x18dc8d[_0x2289('0x40')]=_[_0x2289('0x55')](db['Disposition']['rawAttributes']);_0x18dc8d[_0x2289('0x3f')]=_[_0x2289('0x55')](_0x339b82[_0x2289('0x3f')]);_0x18dc8d[_0x2289('0x49')]=_[_0x2289('0x42')](_0x18dc8d[_0x2289('0x40')],_0x18dc8d[_0x2289('0x3f')]);_0xb0b134[_0x2289('0x41')]=_[_0x2289('0x42')](_0x18dc8d[_0x2289('0x40')],qs['fields'](_0x339b82[_0x2289('0x3f')]['fields']));_0xb0b134[_0x2289('0x41')]=_0xb0b134[_0x2289('0x41')]['length']?_0xb0b134[_0x2289('0x41')]:_0x18dc8d[_0x2289('0x40')];if(!_0x339b82[_0x2289('0x3f')][_0x2289('0x44')]('nolimit')){_0xb0b134[_0x2289('0x2a')]=qs[_0x2289('0x2a')](_0x339b82[_0x2289('0x3f')][_0x2289('0x2a')]);_0xb0b134[_0x2289('0x28')]=qs[_0x2289('0x28')](_0x339b82[_0x2289('0x3f')][_0x2289('0x28')]);}_0xb0b134[_0x2289('0x46')]=qs[_0x2289('0x47')](_0x339b82[_0x2289('0x3f')][_0x2289('0x47')]);_0xb0b134[_0x2289('0x48')]=qs[_0x2289('0x49')](_[_0x2289('0x4a')](_0x339b82['query'],_0x18dc8d[_0x2289('0x49')]));_0xb0b134[_0x2289('0x48')][_0x2289('0x62')]=_0x1d366d['id'];if(_0x339b82[_0x2289('0x3f')][_0x2289('0x4b')]){_0xb0b134[_0x2289('0x48')]=_[_0x2289('0x4c')](_0xb0b134['where'],{'$or':_[_0x2289('0x3a')](_0xb0b134[_0x2289('0x41')],function(_0x1671ab){var _0x58dfe6={};_0x58dfe6[_0x1671ab]={'$like':'%'+_0x339b82[_0x2289('0x3f')][_0x2289('0x4b')]+'%'};return _0x58dfe6;})});}_0xb0b134=_['merge']({},_0xb0b134,_0x339b82[_0x2289('0x4e')]);return db['Disposition']['count']({'where':_0xb0b134['where']})[_0x2289('0x1c')](function(_0x55e608){_0x2ac880[_0x2289('0x2b')]=_0x55e608;if(_0x339b82[_0x2289('0x3f')][_0x2289('0x4f')]){_0xb0b134[_0x2289('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xb0b134);})['then'](function(_0x50ad36){_0x2ac880['rows']=_0x50ad36;return _0x2ac880;});}})[_0x2289('0x1c')](respondWithFilteredResult(_0x157409,_0xb0b134))['catch'](handleError(_0x157409,null));};exports['removeDispositions']=function(_0x52b4ae,_0x46d8ea,_0x3aecc4){return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x52b4ae[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x46d8ea,null))[_0x2289('0x1c')](function(_0x4b15fd){if(_0x4b15fd){return _0x4b15fd['removeDispositions'](_0x52b4ae['query'][_0x2289('0x65')]);}})[_0x2289('0x1c')](respondWithStatusCode(_0x46d8ea,null))['catch'](handleError(_0x46d8ea,null));};exports[_0x2289('0x66')]=function(_0x1b1290,_0x181e43,_0x36a988){if(_0x1b1290[_0x2289('0x5f')]['id']){delete _0x1b1290[_0x2289('0x5f')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x1b1290[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x181e43,null))[_0x2289('0x1c')](function(_0xcaa317){if(_0xcaa317){_0x1b1290['body'][_0x2289('0x62')]=_0xcaa317['id'];return db[_0x2289('0x67')][_0x2289('0x58')](_0x1b1290[_0x2289('0x5f')]);}})[_0x2289('0x1c')](respondWithResult(_0x181e43,null))[_0x2289('0x53')](handleError(_0x181e43,null));};exports[_0x2289('0x68')]=function(_0x26c472,_0x293e73,_0x133d1c){var _0x4215cd={'raw':![],'where':{}};var _0x3b34de={};var _0x162c53={'count':0x0,'rows':[]};return db[_0x2289('0x3b')]['findOne']({'where':{'id':_0x26c472[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x293e73,null))[_0x2289('0x1c')](function(_0x2d425d){if(_0x2d425d){_0x3b34de[_0x2289('0x40')]=_[_0x2289('0x55')](db[_0x2289('0x67')]['rawAttributes']);_0x3b34de[_0x2289('0x3f')]=_[_0x2289('0x55')](_0x26c472[_0x2289('0x3f')]);_0x3b34de['filters']=_[_0x2289('0x42')](_0x3b34de[_0x2289('0x40')],_0x3b34de[_0x2289('0x3f')]);_0x4215cd[_0x2289('0x41')]=_[_0x2289('0x42')](_0x3b34de[_0x2289('0x40')],qs['fields'](_0x26c472[_0x2289('0x3f')]['fields']));_0x4215cd[_0x2289('0x41')]=_0x4215cd[_0x2289('0x41')][_0x2289('0x69')]?_0x4215cd['attributes']:_0x3b34de['model'];if(!_0x26c472[_0x2289('0x3f')][_0x2289('0x44')]('nolimit')){_0x4215cd[_0x2289('0x2a')]=qs[_0x2289('0x2a')](_0x26c472[_0x2289('0x3f')][_0x2289('0x2a')]);_0x4215cd[_0x2289('0x28')]=qs[_0x2289('0x28')](_0x26c472[_0x2289('0x3f')]['offset']);}_0x4215cd[_0x2289('0x46')]=qs[_0x2289('0x47')](_0x26c472[_0x2289('0x3f')][_0x2289('0x47')]);_0x4215cd[_0x2289('0x48')]=qs['filters'](_[_0x2289('0x4a')](_0x26c472[_0x2289('0x3f')],_0x3b34de[_0x2289('0x49')]));_0x4215cd[_0x2289('0x48')][_0x2289('0x62')]=_0x2d425d['id'];if(_0x26c472[_0x2289('0x3f')][_0x2289('0x4b')]){_0x4215cd['where']=_['merge'](_0x4215cd[_0x2289('0x48')],{'$or':_['map'](_0x4215cd[_0x2289('0x41')],function(_0x396fc7){var _0x1e8072={};_0x1e8072[_0x396fc7]={'$like':'%'+_0x26c472[_0x2289('0x3f')][_0x2289('0x4b')]+'%'};return _0x1e8072;})});}_0x4215cd=_[_0x2289('0x4c')]({},_0x4215cd,_0x26c472[_0x2289('0x4e')]);return db[_0x2289('0x67')][_0x2289('0x2b')]({'where':_0x4215cd[_0x2289('0x48')]})[_0x2289('0x1c')](function(_0x5e2bef){_0x162c53[_0x2289('0x2b')]=_0x5e2bef;if(_0x26c472[_0x2289('0x3f')][_0x2289('0x4f')]){_0x4215cd[_0x2289('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2289('0x51')](_0x4215cd);})[_0x2289('0x1c')](function(_0x57e9bd){_0x162c53[_0x2289('0x52')]=_0x57e9bd;return _0x162c53;});}})['then'](respondWithFilteredResult(_0x293e73,_0x4215cd))[_0x2289('0x53')](handleError(_0x293e73,null));};exports[_0x2289('0x6a')]=function(_0x1c81d9,_0x35523f,_0x11f49f){return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x1c81d9[_0x2289('0x54')]['id']}})['then'](handleEntityNotFound(_0x35523f,null))['then'](function(_0x20e31e){if(_0x20e31e){return _0x20e31e['removeAnswers'](_0x1c81d9['query'][_0x2289('0x65')]);}})['then'](respondWithStatusCode(_0x35523f,null))['catch'](handleError(_0x35523f,null));};exports[_0x2289('0x6b')]=function(_0x207e4a,_0x17bcbb,_0x3b8574){var _0x2e820c={'channel':'sms'};var _0x3af2d1=[];var _0x14b3de=[];var _0x5bc69c={};return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x207e4a['params']['id']},'include':[{'model':db[_0x2289('0x6c')],'as':_0x2289('0x6d')}]})[_0x2289('0x1c')](handleEntityNotFound(_0x17bcbb,null))[_0x2289('0x1c')](function(_0x1e0d28){_0x2e820c[_0x2289('0x6e')]=_0x1e0d28;_0x2e820c[_0x2289('0x6f')]=_[_0x2289('0x70')](_0x1e0d28['Applications'],[_0x2289('0x71')],['asc']);if(_0x2e820c[_0x2289('0x6e')][_0x2289('0x6d')]){delete _0x2e820c[_0x2289('0x6e')][_0x2289('0x6d')];}return db[_0x2289('0x72')]['describe']();})[_0x2289('0x1c')](function(_0x28c73f){if(!_0x28c73f){throw new db['Sequelize']['ValidationError'](_0x2289('0x73'));}_0x3af2d1=_[_0x2289('0x74')](_['keys'](_0x28c73f),[_0x2289('0x75'),_0x2289('0x76')]);_0x14b3de=_[_0x2289('0x74')](_[_0x2289('0x55')](_0x28c73f),[_0x2289('0x75'),_0x2289('0x76'),_0x2289('0x77'),'ListId']);_0x2e820c[_0x2289('0x5f')]={'mapKey':_0x2289('0x78')};if(_0x2e820c[_0x2289('0x6e')][_0x2289('0x3d')]){switch(_0x2e820c[_0x2289('0x6e')][_0x2289('0x3d')]){case _0x2289('0x79'):_0x2e820c[_0x2289('0x5f')]['from']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x7a')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x7b')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x7c')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x7d')];break;case _0x2289('0x7e'):_0x2e820c['body']['from']='+'+_0x207e4a[_0x2289('0x5f')][_0x2289('0x7f')];_0x2e820c[_0x2289('0x5f')]['body']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x80')];break;case _0x2289('0x81'):_0x2e820c['body']['from']=_0x207e4a[_0x2289('0x5f')]['from'];_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x24')];break;case _0x2289('0x82'):_0x2e820c[_0x2289('0x5f')]['from']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x83')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x5f')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x7c')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x84')];break;case'plivo':_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')]=_0x207e4a['body'][_0x2289('0x7a')];_0x2e820c['body'][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x85')];_0x2e820c[_0x2289('0x5f')]['messageId']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x86')];break;case _0x2289('0x87'):_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')]='+'+_0x207e4a[_0x2289('0x5f')][_0x2289('0x88')][0x0][_0x2289('0x83')];_0x2e820c['body']['body']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x88')][0x0][_0x2289('0x80')];_0x2e820c[_0x2289('0x5f')]['messageId']=_0x207e4a[_0x2289('0x5f')][_0x2289('0x88')][0x0]['messageId'];break;case'csc':_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x89')];_0x2e820c['body'][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x8a')]['message'];break;case _0x2289('0x8b'):_0x2e820c['body'][_0x2289('0x83')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x8c')];_0x2e820c['body'][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x80')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x7c')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x8d')];break;case _0x2289('0x8e'):_0x2e820c['body'][_0x2289('0x7c')]=_0x207e4a[_0x2289('0x5f')][0x0]['message']['id'];_0x2e820c['body'][_0x2289('0x83')]=_0x207e4a[_0x2289('0x5f')][0x0][_0x2289('0x24')][_0x2289('0x83')];_0x2e820c[_0x2289('0x5f')]['body']=_0x207e4a[_0x2289('0x5f')][0x0][_0x2289('0x24')][_0x2289('0x80')];break;case _0x2289('0x8f'):_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x83')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]=_0x207e4a[_0x2289('0x5f')][_0x2289('0x24')];_0x2e820c[_0x2289('0x5f')][_0x2289('0x7c')]=_0x207e4a['body'][_0x2289('0x90')];break;}}if(_0x2e820c[_0x2289('0x5f')]['id']){delete _0x2e820c['body']['id'];}if(_['isNil'](_0x2e820c['body'][_0x2289('0x83')])){throw new db[(_0x2289('0x91'))][(_0x2289('0x92'))](_0x2289('0x93'));}if(_[_0x2289('0x94')](_0x2e820c[_0x2289('0x5f')]['body'])||_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')]===''){throw new db[(_0x2289('0x91'))][(_0x2289('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2e820c[_0x2289('0x5f')][_0x2289('0x95')])){throw new db['Sequelize'][(_0x2289('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14b3de);}if(!_[_0x2289('0x96')](_0x14b3de,_0x2e820c[_0x2289('0x5f')][_0x2289('0x95')])){throw new db['Sequelize'][(_0x2289('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14b3de);}_0x5bc69c[_0x2e820c[_0x2289('0x5f')]['mapKey']]=_0x2e820c['body']['from'];return db[_0x2289('0x97')]['find']({'where':{'id':_0x2e820c[_0x2289('0x6e')][_0x2289('0x98')]},'include':[{'model':db[_0x2289('0x72')],'as':_0x2289('0x99'),'where':_0x5bc69c,'limit':0x1,'order':[['updatedAt',_0x2289('0x9a')]]}]});})[_0x2289('0x1c')](handleEntityNotFound(_0x17bcbb,null))[_0x2289('0x1c')](function(_0x5be3d9){if(_0x5be3d9){_0x2e820c[_0x2289('0x9b')]=_[_0x2289('0x9c')](_0x5be3d9,[_0x2289('0x99')]);if(_0x5be3d9[_0x2289('0x99')][_0x2289('0x69')]){return _0x5be3d9['Contacts'][0x0];}var _0x509bf2=_[_0x2289('0x15')](_0x2e820c[_0x2289('0x5f')],{'firstName':_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')],'ListId':_0x5be3d9['id']});_0x509bf2[_0x2e820c[_0x2289('0x5f')]['mapKey']]=_0x2e820c[_0x2289('0x5f')][_0x2289('0x83')];return db[_0x2289('0x72')][_0x2289('0x58')](_0x509bf2,{'fields':_0x3af2d1,'raw':!![]});}})[_0x2289('0x1c')](handleEntityNotFound(_0x17bcbb,null))['then'](function(_0x5bf00d){if(_0x5bf00d){_0x2e820c[_0x2289('0x9d')]=_0x5bf00d;var _0x30a217={'ContactId':_0x5bf00d['id'],'phone':_0x2e820c[_0x2289('0x5f')]['from'],'SmsAccountId':_0x207e4a['params']['id']};var _0x54e06d={'ContactId':_0x5bf00d['id'],'SmsAccountId':_0x207e4a[_0x2289('0x54')]['id'],'closed':![]};return db[_0x2289('0x9e')]['find']({'where':_0x54e06d})[_0x2289('0x1c')](function(_0x52c5fa){if(_0x52c5fa){return[_0x52c5fa,![]];}return db[_0x2289('0x9e')][_0x2289('0x58')](_0x30a217)['then'](function(_0x143c72){return[_0x143c72,!![]];});});}})[_0x2289('0x9f')](function(_0xbfd34e,_0x555899){_0x2e820c[_0x2289('0xa0')]=_0xbfd34e[_0x2289('0x32')]({'plain':!![]});_0x2e820c[_0x2289('0xa0')][_0x2289('0xa1')]=![];if(_0x555899){if(_0x2e820c['account'][_0x2289('0xa2')]){_0x2e820c['applications'][_0x2289('0xa3')]({'id':0x0,'priority':_0x2e820c[_0x2289('0x6f')][_0x2289('0x69')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x2e820c['interaction'][_0x2289('0xa1')]=!![];}return db[_0x2289('0xa4')][_0x2289('0x58')]({'phone':_0x2e820c['body']['from'],'messageId':_0x2e820c[_0x2289('0x5f')]['messageId'],'body':_0x2e820c[_0x2289('0x5f')][_0x2289('0x5f')],'SmsAccountId':_0x207e4a[_0x2289('0x54')]['id'],'SmsInteractionId':_0xbfd34e['id'],'direction':'in','ContactId':_0xbfd34e['ContactId'],'AttachmentId':_0x2e820c[_0x2289('0x5f')][_0x2289('0xa5')]});})['then'](function(_0x168f30){_0x2e820c[_0x2289('0x24')]=_0x168f30;if(!_0x2e820c[_0x2289('0xa0')]['UserId'])return;return db[_0x2289('0xa6')][_0x2289('0x57')]({'attributes':['id','name'],'where':{'id':_0x2e820c[_0x2289('0xa0')][_0x2289('0xa7')]}});})['then'](function(_0x4cfe92){if(_0x4cfe92){_0x2e820c['applications'][_0x2289('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4cfe92[_0x2289('0x37')]+','+(_0x2e820c[_0x2289('0x6e')][_0x2289('0xa9')]||0xa),'interval':_0x2289('0xaa')});}if(!_0x2e820c[_0x2289('0xa0')][_0x2289('0xab')])return;return db[_0x2289('0xac')]['find']({'attributes':['id','name'],'where':{'id':_0x2e820c['interaction']['queueId']}});})[_0x2289('0x1c')](function(_0x5f46d2){if(_0x5f46d2){_0x2e820c[_0x2289('0x6f')]['unshift']({'id':0x0,'priority':0x1,'app':_0x2289('0xad'),'appdata':_0x5f46d2['name']+','+(_0x2e820c[_0x2289('0x6e')][_0x2289('0xae')]||0x12c),'interval':_0x2289('0xaa')});}return respondWithRpcPromise(_0x2289('0xaf'),'startRouting',_0x2e820c);})[_0x2289('0x1c')](function(_0x26fcba){if(_0x26fcba){var _0x1000cd=0xc8;var _0x577b8d=_0x2289('0xb0');logger[_0x2289('0x1d')](_0x2289('0x20'),_0x577b8d,_0x1000cd,_0x2289('0xb1'));logger[_0x2289('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x577b8d,_0x1000cd,_0x2289('0xb1'),JSON[_0x2289('0xb2')](_0x26fcba));if(_0x2e820c[_0x2289('0x6e')][_0x2289('0x3d')]==='twilio'){return _0x17bcbb[_0x2289('0x27')](_0x1000cd)[_0x2289('0x2c')](_0x2289('0xb3'),_0x2289('0xb4'))[_0x2289('0xb5')](_0x2289('0xb6'));}else{return _0x17bcbb[_0x2289('0x27')](_0x1000cd)['json'](_0x26fcba);}}})[_0x2289('0x53')](handleError(_0x17bcbb,null));};exports[_0x2289('0xb7')]=function(_0x5d6457,_0x1cfdd0){var _0x2d20e=_0x5d6457['params']['id'];var _0x2c21d4=_0x5d6457[_0x2289('0x5f')];var _0x41213e=0xc8;var _0x51c5a7=null;return db['sequelize'][_0x2289('0xb8')]({'isolationLevel':db[_0x2289('0xb9')][_0x2289('0xba')][_0x2289('0xbb')]['READ_COMMITTED']},function(_0x3f1e69){return db[_0x2289('0x3b')]['findOne']({'where':{'id':_0x2d20e},'transaction':_0x3f1e69})[_0x2289('0x1c')](function(_0x54b906){if(_0x54b906){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x2d20e},'transaction':_0x3f1e69})['then'](function(){var _0x55c386=_[_0x2289('0x3a')](_0x2c21d4,function(_0x4c98c5){_0x4c98c5[_0x2289('0x62')]=_0x2d20e;return _0x4c98c5;});return db[_0x2289('0x6c')][_0x2289('0xbc')](_0x55c386,{'transaction':_0x3f1e69});});}else{_0x41213e=0x194;_0x51c5a7=[];}});})[_0x2289('0x1c')](function(){if(_0x41213e!==0x194){return db['SmsApplication'][_0x2289('0xbd')]({'where':{'SmsAccountId':_0x2d20e},'order':'priority'})['then'](function(_0x8deca6){_0x51c5a7=_0x8deca6;});}})['catch'](function(_0x371849){_0x41213e=0x1f4;logger[_0x2289('0x22')](_0x371849[_0x2289('0x36')]);if(_0x371849[_0x2289('0x37')]){delete _0x371849['name'];}_0x51c5a7=_0x371849;})[_0x2289('0xbe')](function(){if(_0x51c5a7===null){_0x1cfdd0[_0x2289('0x26')](_0x41213e);}else{if(_0x41213e===0x1f4){_0x1cfdd0[_0x2289('0x27')](_0x41213e)[_0x2289('0xb5')](_0x51c5a7);}else{_0x1cfdd0['status'](_0x41213e)[_0x2289('0x2e')](_0x51c5a7);}}});};exports[_0x2289('0xbf')]=function(_0x180455,_0x170b8d,_0x2f62fe){var _0x69673f={};var _0x4bf93e={};var _0x143949;var _0x323000;return db[_0x2289('0x3b')]['findOne']({'where':{'id':_0x180455['params']['id']}})['then'](handleEntityNotFound(_0x170b8d,null))[_0x2289('0x1c')](function(_0x44b7da){if(_0x44b7da){_0x143949=_0x44b7da;_0x4bf93e[_0x2289('0x40')]=_[_0x2289('0x55')](db[_0x2289('0x6c')][_0x2289('0x56')]);_0x4bf93e[_0x2289('0x3f')]=_[_0x2289('0x55')](_0x180455[_0x2289('0x3f')]);_0x4bf93e[_0x2289('0x49')]=_[_0x2289('0x42')](_0x4bf93e[_0x2289('0x40')],_0x4bf93e[_0x2289('0x3f')]);_0x69673f[_0x2289('0x41')]=_[_0x2289('0x42')](_0x4bf93e[_0x2289('0x40')],qs[_0x2289('0x43')](_0x180455[_0x2289('0x3f')][_0x2289('0x43')]));_0x69673f['attributes']=_0x69673f['attributes'][_0x2289('0x69')]?_0x69673f[_0x2289('0x41')]:_0x4bf93e['model'];_0x69673f[_0x2289('0x46')]=qs['sort'](_0x180455['query'][_0x2289('0x47')]);_0x69673f[_0x2289('0x48')]=qs[_0x2289('0x49')](_['pick'](_0x180455[_0x2289('0x3f')],_0x4bf93e[_0x2289('0x49')]));if(_0x180455[_0x2289('0x3f')][_0x2289('0x4b')]){_0x69673f[_0x2289('0x48')]=_['merge'](_0x69673f[_0x2289('0x48')],{'$or':_[_0x2289('0x3a')](_0x69673f[_0x2289('0x41')],function(_0x30a37c){var _0x1fa00b={};_0x1fa00b[_0x30a37c]={'$like':'%'+_0x180455[_0x2289('0x3f')][_0x2289('0x4b')]+'%'};return _0x1fa00b;})});}_0x69673f=_[_0x2289('0x4c')]({},_0x69673f,_0x180455['options']);return _0x143949[_0x2289('0xbf')](_0x69673f);}})[_0x2289('0x1c')](function(_0x14545d){if(_0x14545d){_0x323000=_0x14545d[_0x2289('0x69')];if(!_0x180455[_0x2289('0x3f')][_0x2289('0x44')](_0x2289('0x45'))){_0x69673f[_0x2289('0x2a')]=qs[_0x2289('0x2a')](_0x180455[_0x2289('0x3f')][_0x2289('0x2a')]);_0x69673f[_0x2289('0x28')]=qs['offset'](_0x180455[_0x2289('0x3f')]['offset']);}return _0x143949[_0x2289('0xbf')](_0x69673f);}})['then'](function(_0x4d2898){if(_0x4d2898){return _0x4d2898?{'count':_0x323000,'rows':_0x4d2898}:null;}})[_0x2289('0x1c')](respondWithResult(_0x170b8d,null))[_0x2289('0x53')](handleError(_0x170b8d,null));};exports['getInteractions']=function(_0x4e7765,_0x5a8c94,_0x29f189){var _0x535204={'raw':![],'where':{}};var _0x13dbac={};var _0x3efd4d={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x4e7765[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x5a8c94,null))[_0x2289('0x1c')](function(_0x17434a){if(_0x17434a){_0x13dbac[_0x2289('0x40')]=_[_0x2289('0x55')](db[_0x2289('0x9e')][_0x2289('0x56')]);_0x13dbac[_0x2289('0x3f')]=_['keys'](_0x4e7765['query']);_0x13dbac[_0x2289('0x49')]=_[_0x2289('0x42')](_0x13dbac[_0x2289('0x40')],_0x13dbac['query']);_0x535204['attributes']=_['intersection'](_0x13dbac['model'],qs[_0x2289('0x43')](_0x4e7765[_0x2289('0x3f')][_0x2289('0x43')]));_0x535204['attributes']=_0x535204['attributes'][_0x2289('0x69')]?_0x535204[_0x2289('0x41')]:_0x13dbac[_0x2289('0x40')];if(!_0x4e7765[_0x2289('0x3f')]['hasOwnProperty']('nolimit')){_0x535204[_0x2289('0x2a')]=qs[_0x2289('0x2a')](_0x4e7765[_0x2289('0x3f')]['limit']);_0x535204['offset']=qs[_0x2289('0x28')](_0x4e7765[_0x2289('0x3f')][_0x2289('0x28')]);}_0x535204['order']=qs[_0x2289('0x47')](_0x4e7765['query'][_0x2289('0x47')]);_0x535204[_0x2289('0x48')]=qs[_0x2289('0x49')](_['pick'](_0x4e7765['query'],_0x13dbac[_0x2289('0x49')]));_0x535204[_0x2289('0x48')][_0x2289('0x62')]=_0x17434a['id'];if(_0x4e7765[_0x2289('0x3f')][_0x2289('0x4b')]){_0x535204[_0x2289('0x48')]=_[_0x2289('0x4c')](_0x535204['where'],{'$or':_[_0x2289('0x3a')](_0x535204['attributes'],function(_0x57ded7){var _0x30c63c={};_0x30c63c[_0x57ded7]={'$like':'%'+_0x4e7765['query']['filter']+'%'};return _0x30c63c;})});}_0x535204=_['merge']({},_0x535204,_0x4e7765['options']);return db[_0x2289('0x9e')][_0x2289('0x2b')]({'where':_0x535204[_0x2289('0x48')]})[_0x2289('0x1c')](function(_0x1bcbc6){_0x3efd4d[_0x2289('0x2b')]=_0x1bcbc6;if(_0x4e7765['query'][_0x2289('0x4f')]){_0x535204[_0x2289('0x50')]=[{'model':db[_0x2289('0x72')],'as':_0x2289('0xc0'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x2289('0x37'),_0x2289('0xc1'),_0x2289('0xc2')],'required':![]},{'model':db['Tag'],'as':_0x2289('0xc3'),'attributes':['id',_0x2289('0x37'),'color'],'where':_0x4e7765[_0x2289('0x3f')][_0x2289('0xc4')]?{'id':_0x4e7765['query'][_0x2289('0xc4')]}:undefined,'required':_0x4e7765['query']['tag']?!![]:![]}];}return db[_0x2289('0x9e')][_0x2289('0x51')](_0x535204);})[_0x2289('0x1c')](function(_0x1f74f3){_0x3efd4d[_0x2289('0x52')]=_0x1f74f3;return _0x3efd4d;});}})[_0x2289('0x1c')](respondWithFilteredResult(_0x5a8c94,_0x535204))['catch'](handleError(_0x5a8c94,null));};exports[_0x2289('0xb5')]=function(_0x49b038,_0x47420e,_0x37d211){var _0x2b0c6f,_0x2b750c,_0x4b4a6b;if(_[_0x2289('0x94')](_0x49b038[_0x2289('0x5f')][_0x2289('0x5f')])||_0x49b038['body'][_0x2289('0x5f')]===''){throw new db['Sequelize'][(_0x2289('0x92'))](_0x2289('0xc5'));}if(_['isNil'](_0x49b038['body']['to'])){throw new db[(_0x2289('0x91'))]['ValidationError'](_0x2289('0xc6'));}_0x2b0c6f=_0x49b038[_0x2289('0x5f')]['to'];return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x49b038[_0x2289('0x54')]['id']},'include':[{'model':db[_0x2289('0x97')],'as':'List','include':[{'model':db['CmContact'],'as':_0x2289('0x99'),'where':{'mobile':_0x2b0c6f},'limit':0x1,'order':[['updatedAt',_0x2289('0x9a')]]}]}]})[_0x2289('0x1c')](handleEntityNotFound(_0x47420e,null))['then'](function(_0x39684a){if(_0x39684a&&_0x39684a[_0x2289('0xc7')]){_0x2b750c=_0x39684a[_0x2289('0x32')]({'plain':!![]});if(_0x2b750c['List']&&_0x2b750c[_0x2289('0xc7')][_0x2289('0x99')]['length']){return _0x2b750c['List'][_0x2289('0x99')][0x0];}return db[_0x2289('0x72')][_0x2289('0x58')](_[_0x2289('0x15')](_0x49b038['body'],{'firstName':_0x2b0c6f,'mobile':_0x2b0c6f,'phone':_0x2b0c6f,'ListId':_0x2b750c[_0x2289('0x98')]}));}})[_0x2289('0x1c')](handleEntityNotFound(_0x47420e,null))[_0x2289('0x1c')](function(_0x4dba75){if(_0x4dba75){_0x4b4a6b=_0x4dba75;return db[_0x2289('0x9e')]['find']({'where':{'ContactId':_0x4b4a6b['id'],'closed':![],'SmsAccountId':_0x2b750c['id']}})[_0x2289('0x1c')](function(_0x3dbfb7){if(_0x3dbfb7){return[_0x3dbfb7,![]];}return db[_0x2289('0x9e')]['create']({'UserId':_0x49b038[_0x2289('0x59')]['id'],'ContactId':_0x4b4a6b['id'],'SmsAccountId':_0x2b750c['id'],'phone':_0x2b0c6f,'firstMsgDirection':_0x2289('0xc8'),'Messages':[_[_0x2289('0x4c')](_0x49b038[_0x2289('0x5f')],{'read':![],'body':_0x49b038[_0x2289('0x5f')]['body'],'phone':_0x2b0c6f,'SmsAccountId':_0x2b750c['id'],'UserId':_0x49b038[_0x2289('0x59')]['id'],'ContactId':_0x4b4a6b['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x2289('0xc9')}]})['then'](function(_0x4b12d9){return[_0x4b12d9,!![]];});});}})[_0x2289('0x9f')](function(_0x2c795c,_0x7ed0f8){if(_0x7ed0f8){return _0x2c795c;}return db[_0x2289('0xa4')][_0x2289('0x58')](_['merge'](_0x49b038[_0x2289('0x5f')],{'read':![],'body':_0x49b038[_0x2289('0x5f')][_0x2289('0x5f')],'phone':_0x2b0c6f,'SmsAccountId':_0x2b750c['id'],'SmsInteractionId':_0x2c795c['id'],'UserId':_0x49b038[_0x2289('0x59')]['id'],'ContactId':_0x4b4a6b['id']}))['then'](function(_0xc6a789){_0x2c795c[_0x2289('0xca')]['Messages']=[];_0x2c795c['dataValues']['Messages'][_0x2289('0xa3')](_0xc6a789[_0x2289('0xca')]);return _0x2c795c;});})['then'](respondWithResult(_0x47420e,null))[_0x2289('0x53')](handleError(_0x47420e,null));};exports['status']=function(_0x30fe16,_0x556a3d,_0x4000eb){if(_0x30fe16[_0x2289('0x5f')]['id']){delete _0x30fe16[_0x2289('0x5f')]['id'];}var _0x1e3d1f,_0x1e8636,_0x1a6cd6;return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x30fe16[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x556a3d,null))[_0x2289('0x1c')](function(_0x57c013){if(_0x57c013){_0x1a6cd6=_0x57c013;logger[_0x2289('0x1f')](_0x2289('0x20'),'status',_0x2289('0xcb'),_0x57c013[_0x2289('0x3d')],util[_0x2289('0xcc')](_0x30fe16['body'],{'showHidden':![],'depth':null}));switch(_0x57c013[_0x2289('0x3d')]){case _0x2289('0x7e'):if(_0x30fe16[_0x2289('0x5f')][_0x2289('0xcd')]&&_0x30fe16[_0x2289('0x5f')][_0x2289('0x27')]){_0x1e8636=_0x30fe16[_0x2289('0x5f')][_0x2289('0x27')];return db[_0x2289('0xa4')][_0x2289('0x57')]({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][_0x2289('0xcd')]}});}break;case _0x2289('0x81'):if(_0x30fe16[_0x2289('0x5f')][_0x2289('0xce')]&&_0x30fe16[_0x2289('0x5f')][_0x2289('0xcf')]){_0x1e8636=_0x30fe16[_0x2289('0x5f')][_0x2289('0xcf')];return db['SmsMessage'][_0x2289('0x57')]({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][_0x2289('0xce')]}});}break;case'clicksend':if(_0x30fe16[_0x2289('0x5f')]['message_id']&&_0x30fe16['body'][_0x2289('0xd0')]){_0x1e8636=_0x30fe16['body'][_0x2289('0xd0')];return db['SmsMessage'][_0x2289('0x57')]({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][_0x2289('0x84')]}});}break;case _0x2289('0x87'):var _0x5757d3=_0x30fe16[_0x2289('0x5f')][_0x2289('0x88')][0x0];if(_0x5757d3[_0x2289('0x7c')]&&_0x5757d3[_0x2289('0x27')][_0x2289('0xd1')]===_0x2289('0xd2')){_0x1e8636=_0x5757d3[_0x2289('0x27')][_0x2289('0xd1')];return db[_0x2289('0xa4')][_0x2289('0x57')]({'where':{'messageId':_0x5757d3[_0x2289('0x7c')]}});}break;case _0x2289('0x8b'):if(_0x30fe16[_0x2289('0x5f')]['messageId']&&_0x30fe16['body']['status']){_0x1e8636=_0x30fe16['body'][_0x2289('0x27')];return db['SmsMessage']['find']({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][_0x2289('0x7c')]}});}break;case _0x2289('0x8e'):if(_0x30fe16[_0x2289('0x5f')][0x0]['message']['id']){_0x1e8636=_0x30fe16[_0x2289('0x5f')][0x0][_0x2289('0x3d')];return db[_0x2289('0xa4')][_0x2289('0x57')]({'where':{'messageId':_0x30fe16[_0x2289('0x5f')][0x0][_0x2289('0x24')]['id']}});}break;case _0x2289('0x8f'):if(_0x30fe16[_0x2289('0x5f')][_0x2289('0xd3')]&&_0x30fe16[_0x2289('0x5f')][_0x2289('0x27')]){_0x1e8636=_0x30fe16[_0x2289('0x5f')][_0x2289('0x27')];return db['SmsMessage']['find']({'where':{'messageId':_0x30fe16['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x556a3d,null))[_0x2289('0x1c')](function(_0x46d027){if(_0x46d027){_0x1e3d1f=_0x46d027;switch(_0x1a6cd6['type']){case _0x2289('0x7e'):if(_0x1e8636===_0x2289('0xd2')){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger[_0x2289('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0x2289('0xcc')](_0x30fe16['body'],{'showHidden':![],'depth':null}));}break;case _0x2289('0x81'):if(_0x1e8636==='1'){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger[_0x2289('0x22')](_0x2289('0x20'),_0x2289('0x27'),_0x2289('0x7e'),util[_0x2289('0xcc')](_0x30fe16[_0x2289('0x5f')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x30fe16[_0x2289('0x5f')]['error_code']&&_0x1e8636>=0xc8&&_0x1e8636<=0xce){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2289('0x27'),_0x2289('0x82'),util[_0x2289('0xcc')](_0x30fe16[_0x2289('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xe6c17f=_0x30fe16['body'][_0x2289('0x88')][0x0];if(_0xe6c17f[_0x2289('0x27')]['groupName']===_0x2289('0xd2')){return _0x1e3d1f['update']({'read':!![]});}else{logger[_0x2289('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2289('0x27'),_0x2289('0x87'),util[_0x2289('0xcc')](_0x30fe16['body'],{'showHidden':![],'depth':null}));}break;case _0x2289('0x8b'):if(_0x1e8636==_0x2289('0xd4')||_0x1e8636==_0x2289('0xd5')){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger[_0x2289('0x22')](_0x2289('0x20'),'status',_0x2289('0x8b'),util['inspect'](_0x30fe16['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1e8636==_0x2289('0xd6')){return _0x1e3d1f['update']({'read':!![]});}else{logger['error'](_0x2289('0x20'),_0x2289('0x27'),_0x2289('0x8e'),util['inspect'](_0x30fe16[_0x2289('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2289('0x8f'):if(_0x1e8636==='DELIVRD'||_0x1e8636==='ACCEPTD'){return _0x1e3d1f[_0x2289('0x31')]({'read':!![]});}else{logger[_0x2289('0x22')](_0x2289('0x20'),_0x2289('0x27'),_0x2289('0x8f'),util['inspect'](_0x30fe16[_0x2289('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x1e3d1f;}})['then'](respondWithResult(_0x556a3d,null))['catch'](handleError(_0x556a3d,null));};exports['statusGet']=function(_0x2bbcdc,_0x5ce7c3,_0x4b2639){var _0x19c2ab,_0x3c50c4,_0x2d5588;return db['SmsAccount']['find']({'where':{'id':_0x2bbcdc[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x5ce7c3,null))[_0x2289('0x1c')](function(_0x1a1a0c){if(_0x1a1a0c){_0x2d5588=_0x1a1a0c;logger[_0x2289('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2289('0x27'),'received\x20delivery\x20report\x20from',_0x1a1a0c[_0x2289('0x3d')],util[_0x2289('0xcc')](_0x2bbcdc[_0x2289('0x3f')],{'showHidden':![],'depth':null}));switch(_0x1a1a0c[_0x2289('0x3d')]){case _0x2289('0xd7'):if(_0x2bbcdc[_0x2289('0x3f')]['message-id']&&_0x2bbcdc[_0x2289('0x3f')]['state']){_0x3c50c4=_0x2bbcdc[_0x2289('0x3f')][_0x2289('0xd8')];return db[_0x2289('0xa4')]['find']({'where':{'messageId':_0x2bbcdc[_0x2289('0x3f')][_0x2289('0xd9')]}});}break;}}})[_0x2289('0x1c')](handleEntityNotFound(_0x5ce7c3,null))[_0x2289('0x1c')](function(_0x2ccc41){if(_0x2ccc41){_0x19c2ab=_0x2ccc41;switch(_0x2d5588[_0x2289('0x3d')]){case _0x2289('0xd7'):if(_0x3c50c4==='2'||_0x3c50c4==='6'){return _0x19c2ab[_0x2289('0x31')]({'read':!![]});}else{logger['error'](_0x2289('0x20'),_0x2289('0x27'),_0x2289('0xd7'),util['inspect'](_0x2bbcdc['query'],{'showHidden':![],'depth':null}));};break;}return _0x19c2ab;}})[_0x2289('0x1c')](respondWithResult(_0x5ce7c3,null))[_0x2289('0x53')](handleError(_0x5ce7c3,null));};exports['addAgents']=function(_0x571a65,_0x1b838c,_0x4ea123){return db[_0x2289('0x3b')][_0x2289('0x57')]({'where':{'id':_0x571a65[_0x2289('0x54')]['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x1b838c,null))[_0x2289('0x1c')](function(_0x174936){if(_0x174936){return _0x174936['addAgents'](_0x571a65['body'][_0x2289('0x65')],_[_0x2289('0x9c')](_0x571a65[_0x2289('0x5f')],[_0x2289('0x65'),'id'])||{})['spread'](function(_0x2463cd){for(var _0x106498=0x0;_0x106498<_0x571a65[_0x2289('0x5f')][_0x2289('0x65')][_0x2289('0x69')];_0x106498+=0x1){socket[_0x2289('0xda')](_0x2289('0xdb'),{'UserId':Number(_0x571a65['body'][_0x2289('0x65')][_0x106498]),'SmsAccountId':Number(_0x571a65[_0x2289('0x54')]['id'])});}return _0x2463cd;});}})[_0x2289('0x1c')](respondWithResult(_0x1b838c,null))[_0x2289('0x53')](handleError(_0x1b838c,null));};exports['removeAgents']=function(_0xcc27da,_0x18397c,_0x9cfc87){return db[_0x2289('0x3b')]['find']({'where':{'id':_0xcc27da['params']['id']}})[_0x2289('0x1c')](handleEntityNotFound(_0x18397c,null))['then'](function(_0x43138d){if(_0x43138d){return _0x43138d[_0x2289('0xdc')](_0xcc27da['query']['ids'])['then'](function(){if(_[_0x2289('0xdd')](_0xcc27da[_0x2289('0x3f')][_0x2289('0x65')])){for(var _0x5e8e60=0x0;_0x5e8e60<_0xcc27da[_0x2289('0x3f')][_0x2289('0x65')][_0x2289('0x69')];_0x5e8e60+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0xcc27da['query'][_0x2289('0x65')][_0x5e8e60]),'SmsAccountId':Number(_0xcc27da[_0x2289('0x54')]['id'])});}}else{socket[_0x2289('0xda')](_0x2289('0xde'),{'UserId':Number(_0xcc27da['query'][_0x2289('0x65')]),'SmsAccountId':Number(_0xcc27da[_0x2289('0x54')]['id'])});}});}})[_0x2289('0x1c')](respondWithStatusCode(_0x18397c,null))[_0x2289('0x53')](handleError(_0x18397c,null));};exports[_0x2289('0xdf')]=function(_0x5536e4,_0x4b0ebc,_0x5e2eeb){var _0x3dd541={};var _0x30895d={};var _0x34ee61;var _0x21fa19;return db[_0x2289('0x3b')]['findOne']({'where':{'id':_0x5536e4[_0x2289('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b0ebc,null))[_0x2289('0x1c')](function(_0x4156e1){if(_0x4156e1){_0x34ee61=_0x4156e1;_0x30895d[_0x2289('0x40')]=_['keys'](db[_0x2289('0xa6')]['rawAttributes']);_0x30895d[_0x2289('0x3f')]=_[_0x2289('0x55')](_0x5536e4[_0x2289('0x3f')]);_0x30895d['filters']=_[_0x2289('0x42')](_0x30895d['model'],_0x30895d['query']);_0x3dd541[_0x2289('0x41')]=_['intersection'](_0x30895d[_0x2289('0x40')],qs[_0x2289('0x43')](_0x5536e4[_0x2289('0x3f')][_0x2289('0x43')]));_0x3dd541[_0x2289('0x41')]=_0x3dd541[_0x2289('0x41')][_0x2289('0x69')]?_0x3dd541[_0x2289('0x41')]:_0x30895d[_0x2289('0x40')];_0x3dd541[_0x2289('0x46')]=qs[_0x2289('0x47')](_0x5536e4[_0x2289('0x3f')][_0x2289('0x47')]);_0x3dd541[_0x2289('0x48')]=qs[_0x2289('0x49')](_[_0x2289('0x4a')](_0x5536e4[_0x2289('0x3f')],_0x30895d[_0x2289('0x49')]));if(_0x5536e4[_0x2289('0x3f')][_0x2289('0x4b')]){_0x3dd541[_0x2289('0x48')]=_[_0x2289('0x4c')](_0x3dd541[_0x2289('0x48')],{'$or':_[_0x2289('0x3a')](_0x3dd541[_0x2289('0x41')],function(_0x337819){var _0x544884={};_0x544884[_0x337819]={'$like':'%'+_0x5536e4[_0x2289('0x3f')][_0x2289('0x4b')]+'%'};return _0x544884;})});}_0x3dd541=_[_0x2289('0x4c')]({},_0x3dd541,_0x5536e4['options']);return _0x34ee61[_0x2289('0xdf')](_0x3dd541);}})[_0x2289('0x1c')](function(_0xdd1caf){if(_0xdd1caf){_0x21fa19=_0xdd1caf[_0x2289('0x69')];if(!_0x5536e4[_0x2289('0x3f')][_0x2289('0x44')]('nolimit')){_0x3dd541['limit']=qs[_0x2289('0x2a')](_0x5536e4[_0x2289('0x3f')][_0x2289('0x2a')]);_0x3dd541[_0x2289('0x28')]=qs[_0x2289('0x28')](_0x5536e4['query'][_0x2289('0x28')]);}return _0x34ee61[_0x2289('0xdf')](_0x3dd541);}})['then'](function(_0x115f50){if(_0x115f50){return _0x115f50?{'count':_0x21fa19,'rows':_0x115f50}:null;}})['then'](respondWithResult(_0x4b0ebc,null))[_0x2289('0x53')](handleError(_0x4b0ebc,null));}; \ No newline at end of file +var _0xa4fb=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','type','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','SmsAccount','includeAll','include','findAll','rows','show','params','Pause','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','getDispositions','findOne','SmsAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','notify','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','MessageSid','sender','text','connectel','clicksend','messageId','message_id','plivo','MessageUUID','results','csc','originatingAddress','clickatell','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','defaults','contact','SmsInteraction','spread','interaction','applications','close','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','User','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','DESC','ListId','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','statusInt','status_code','groupName','DELIVERED','bandwidth','intelepeer','redif','error_code','infobip','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x553035,_0x211a8f){var _0x25248b=function(_0x2d1e06){while(--_0x2d1e06){_0x553035['push'](_0x553035['shift']());}};_0x25248b(++_0x211a8f);}(_0xa4fb,0x1b9));var _0xba4f=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0xa4fb[_0x59162a];return _0x35e50d;};'use strict';var emlformat=require(_0xba4f('0x0'));var rimraf=require(_0xba4f('0x1'));var zipdir=require(_0xba4f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba4f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xba4f('0x4'));var util=require('util');var path=require(_0xba4f('0x5'));var sox=require(_0xba4f('0x6'));var csv=require(_0xba4f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba4f('0x8'));var _=require(_0xba4f('0x9'));var squel=require('squel');var crypto=require(_0xba4f('0xa'));var jsforce=require(_0xba4f('0xb'));var deskjs=require(_0xba4f('0xc'));var toCsv=require(_0xba4f('0x7'));var querystring=require(_0xba4f('0xd'));var Papa=require('papaparse');var Redis=require(_0xba4f('0xe'));var authService=require(_0xba4f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba4f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba4f('0x11'))(_0xba4f('0x12'));var utils=require(_0xba4f('0x13'));var config=require(_0xba4f('0x14'));var licenseUtil=require(_0xba4f('0x15'));var db=require('../../mysqldb')['db'];config[_0xba4f('0x16')]=_['defaults'](config[_0xba4f('0x16')],{'host':_0xba4f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba4f('0x16')]));require(_0xba4f('0x18'))[_0xba4f('0x19')](socket);var jayson=require(_0xba4f('0x1a'));var client=jayson['client'][_0xba4f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x255474,_0x3cadff,_0x3eb06e,_0x1727a9){return new BPromise(function(_0x2ec3c9,_0x3e8932){var _0x21c206=_0x1727a9||client;return _0x21c206[_0xba4f('0x1c')](_0x255474,_0x3eb06e)[_0xba4f('0x1d')](function(_0x41abc8){logger[_0xba4f('0x1e')](_0xba4f('0x1f'),_0x3cadff,_0xba4f('0x20'));logger[_0xba4f('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3cadff,'request\x20sent',JSON[_0xba4f('0x22')](_0x41abc8));if(_0x41abc8['error']){if(_0x41abc8['error'][_0xba4f('0x23')]===0x1f4){logger['error'](_0xba4f('0x1f'),_0x3cadff,_0x41abc8[_0xba4f('0x24')][_0xba4f('0x25')]);return _0x3e8932(_0x41abc8[_0xba4f('0x24')][_0xba4f('0x25')]);}logger[_0xba4f('0x24')](_0xba4f('0x1f'),_0x3cadff,_0x41abc8[_0xba4f('0x24')][_0xba4f('0x25')]);return _0x2ec3c9(_0x41abc8['error'][_0xba4f('0x25')]);}else{logger[_0xba4f('0x1e')](_0xba4f('0x1f'),_0x3cadff,_0xba4f('0x20'));_0x2ec3c9(_0x41abc8[_0xba4f('0x26')][_0xba4f('0x25')]);}})[_0xba4f('0x27')](function(_0x192c56){logger[_0xba4f('0x24')](_0xba4f('0x1f'),_0x3cadff,_0x192c56);_0x3e8932(_0x192c56);});});}function respondWithStatusCode(_0x3c54e6,_0x4da41a){_0x4da41a=_0x4da41a||0xcc;return function(_0x137328){if(_0x137328){return _0x3c54e6[_0xba4f('0x28')](_0x4da41a);}return _0x3c54e6[_0xba4f('0x29')](_0x4da41a)[_0xba4f('0x2a')]();};}function respondWithResult(_0x2b5447,_0x2a3273){_0x2a3273=_0x2a3273||0xc8;return function(_0x59b6cd){if(_0x59b6cd){return _0x2b5447['status'](_0x2a3273)[_0xba4f('0x2b')](_0x59b6cd);}};}function respondWithFilteredResult(_0xc9f9b9,_0x3ed3e8){return function(_0x3973e9){if(_0x3973e9){var _0xe62b08=typeof _0x3ed3e8['offset']==='undefined'&&typeof _0x3ed3e8['limit']===_0xba4f('0x2c');var _0x13c4b9=_0x3973e9['count'];var _0x197822=_0xe62b08?0x0:_0x3ed3e8[_0xba4f('0x2d')];var _0x348c47=_0xe62b08?_0x3973e9[_0xba4f('0x2e')]:_0x3ed3e8[_0xba4f('0x2d')]+_0x3ed3e8[_0xba4f('0x2f')];var _0x4b5b51;if(_0x348c47>=_0x13c4b9){_0x348c47=_0x13c4b9;_0x4b5b51=0xc8;}else{_0x4b5b51=0xce;}_0xc9f9b9[_0xba4f('0x29')](_0x4b5b51);return _0xc9f9b9[_0xba4f('0x30')](_0xba4f('0x31'),_0x197822+'-'+_0x348c47+'/'+_0x13c4b9)[_0xba4f('0x2b')](_0x3973e9);}return null;};}function patchUpdates(_0x434285){return function(_0x4ad9e7){try{jsonpatch['apply'](_0x4ad9e7,_0x434285,!![]);}catch(_0x487d3f){return BPromise[_0xba4f('0x32')](_0x487d3f);}return _0x4ad9e7[_0xba4f('0x33')]();};}function saveUpdates(_0x5bb6b0,_0xe7e9d1){return function(_0x4ec43d){if(_0x4ec43d){return _0x4ec43d[_0xba4f('0x34')](_0x5bb6b0)[_0xba4f('0x1d')](function(_0x2b52c3){return _0x2b52c3;});}return null;};}function removeEntity(_0xb9518c,_0xa4ada2){return function(_0x431a72){if(_0x431a72){return _0x431a72[_0xba4f('0x35')]()[_0xba4f('0x1d')](function(){var _0x1e527c=_0x431a72[_0xba4f('0x36')]({'plain':!![]});var _0x142b6d=_0xba4f('0x37');return db[_0xba4f('0x38')][_0xba4f('0x35')]({'where':{'type':_0x142b6d,'resourceId':_0x1e527c['id']}})['then'](function(){return _0x431a72;});})[_0xba4f('0x1d')](function(){_0xb9518c[_0xba4f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4116f7,_0x58c55e){return function(_0x60434c){if(!_0x60434c){_0x4116f7[_0xba4f('0x28')](0x194);}return _0x60434c;};}function handleError(_0x3d344a,_0x3607f4){_0x3607f4=_0x3607f4||0x1f4;return function(_0x505459){logger[_0xba4f('0x24')](_0x505459[_0xba4f('0x39')]);if(_0x505459[_0xba4f('0x3a')]){delete _0x505459[_0xba4f('0x3a')];}_0x3d344a[_0xba4f('0x29')](_0x3607f4)[_0xba4f('0x3b')](_0x505459);};}exports[_0xba4f('0x3c')]=function(_0x281a4d,_0x1550d3){var _0x2ffd84={'include':[{'model':db['Pause'],'as':_0xba4f('0x3d')}]},_0xf5e231={},_0x6d635={'count':0x0,'rows':[]};var _0x2199f1=_[_0xba4f('0x3e')](db['SmsAccount'][_0xba4f('0x3f')],function(_0xda5a1c){return{'name':_0xda5a1c['fieldName'],'type':_0xda5a1c[_0xba4f('0x40')]['key']};});_0xf5e231['model']=_[_0xba4f('0x3e')](_0x2199f1,_0xba4f('0x3a'));_0xf5e231[_0xba4f('0x41')]=_['keys'](_0x281a4d['query']);_0xf5e231['filters']=_['intersection'](_0xf5e231[_0xba4f('0x42')],_0xf5e231[_0xba4f('0x41')]);_0x2ffd84['attributes']=_[_0xba4f('0x43')](_0xf5e231['model'],qs[_0xba4f('0x44')](_0x281a4d[_0xba4f('0x41')][_0xba4f('0x44')]));_0x2ffd84[_0xba4f('0x45')]=_0x2ffd84['attributes'][_0xba4f('0x46')]?_0x2ffd84[_0xba4f('0x45')]:_0xf5e231[_0xba4f('0x42')];if(!_0x281a4d['query'][_0xba4f('0x47')](_0xba4f('0x48'))){_0x2ffd84[_0xba4f('0x2f')]=qs['limit'](_0x281a4d[_0xba4f('0x41')][_0xba4f('0x2f')]);_0x2ffd84['offset']=qs[_0xba4f('0x2d')](_0x281a4d[_0xba4f('0x41')][_0xba4f('0x2d')]);}_0x2ffd84[_0xba4f('0x49')]=qs[_0xba4f('0x4a')](_0x281a4d['query']['sort']);_0x2ffd84['where']=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x281a4d[_0xba4f('0x41')],_0xf5e231['filters']),_0x2199f1);if(_0x281a4d[_0xba4f('0x41')][_0xba4f('0x4d')]){_0x2ffd84[_0xba4f('0x4e')]=_[_0xba4f('0x4f')](_0x2ffd84[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x2199f1,function(_0x5aad95){if(_0x5aad95[_0xba4f('0x40')]!=='VIRTUAL'){var _0x2aa902={};_0x2aa902[_0x5aad95['name']]={'$like':'%'+_0x281a4d[_0xba4f('0x41')]['filter']+'%'};return _0x2aa902;}})});}_0x2ffd84=_['merge']({},_0x2ffd84,_0x281a4d[_0xba4f('0x50')]);var _0x2d2039={'where':_0x2ffd84[_0xba4f('0x4e')]};return db[_0xba4f('0x51')]['count'](_0x2d2039)[_0xba4f('0x1d')](function(_0x349bb5){_0x6d635['count']=_0x349bb5;if(_0x281a4d['query'][_0xba4f('0x52')]){_0x2ffd84[_0xba4f('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0xba4f('0x54')](_0x2ffd84);})[_0xba4f('0x1d')](function(_0x523280){_0x6d635[_0xba4f('0x55')]=_0x523280;return _0x6d635;})['then'](respondWithFilteredResult(_0x1550d3,_0x2ffd84))['catch'](handleError(_0x1550d3,null));};exports[_0xba4f('0x56')]=function(_0x7c3726,_0x2de2d8){var _0x5ccf65={'raw':![],'where':{'id':_0x7c3726[_0xba4f('0x57')]['id']},'include':[{'model':db[_0xba4f('0x58')],'as':_0xba4f('0x3d')}]},_0x1869e0={};_0x1869e0[_0xba4f('0x42')]=_[_0xba4f('0x59')](db[_0xba4f('0x51')][_0xba4f('0x3f')]);_0x1869e0[_0xba4f('0x41')]=_[_0xba4f('0x59')](_0x7c3726['query']);_0x1869e0[_0xba4f('0x4b')]=_[_0xba4f('0x43')](_0x1869e0['model'],_0x1869e0[_0xba4f('0x41')]);_0x5ccf65['attributes']=_['intersection'](_0x1869e0[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x7c3726[_0xba4f('0x41')][_0xba4f('0x44')]));_0x5ccf65[_0xba4f('0x45')]=_0x5ccf65['attributes'][_0xba4f('0x46')]?_0x5ccf65['attributes']:_0x1869e0[_0xba4f('0x42')];if(_0x7c3726['query'][_0xba4f('0x52')]){_0x5ccf65['include']=[{'all':!![]}];}_0x5ccf65=_['merge']({},_0x5ccf65,_0x7c3726[_0xba4f('0x50')]);return db[_0xba4f('0x51')][_0xba4f('0x5a')](_0x5ccf65)[_0xba4f('0x1d')](handleEntityNotFound(_0x2de2d8,null))['then'](respondWithResult(_0x2de2d8,null))[_0xba4f('0x27')](handleError(_0x2de2d8,null));};exports[_0xba4f('0x5b')]=function(_0x4cd1f9,_0x1559ab){return db[_0xba4f('0x51')][_0xba4f('0x5b')](_0x4cd1f9['body'],{})[_0xba4f('0x1d')](function(_0x52a91c){var _0x13a1b1=_0x4cd1f9[_0xba4f('0x5c')][_0xba4f('0x36')]({'plain':!![]});if(!_0x13a1b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13a1b1['role']==='user'){var _0x162fa8=_0x52a91c[_0xba4f('0x36')]({'plain':!![]});var _0x48b472=_0xba4f('0x37');return db[_0xba4f('0x5d')][_0xba4f('0x5a')]({'where':{'name':_0x48b472,'userProfileId':_0x13a1b1[_0xba4f('0x5e')]},'raw':!![]})[_0xba4f('0x1d')](function(_0x36fab2){if(_0x36fab2&&_0x36fab2[_0xba4f('0x5f')]===0x0){return db[_0xba4f('0x38')][_0xba4f('0x5b')]({'name':_0x162fa8[_0xba4f('0x3a')],'resourceId':_0x162fa8['id'],'type':_0x36fab2[_0xba4f('0x3a')],'sectionId':_0x36fab2['id']},{})[_0xba4f('0x1d')](function(){return _0x52a91c;});}else{return _0x52a91c;}})['catch'](function(_0x144393){logger[_0xba4f('0x24')](_0xba4f('0x60'),_0x144393);throw _0x144393;});}return _0x52a91c;})['then'](respondWithResult(_0x1559ab,0xc9))[_0xba4f('0x27')](handleError(_0x1559ab,null));};exports['update']=function(_0x1d34b0,_0x46cd82){if(_0x1d34b0[_0xba4f('0x61')]['id']){delete _0x1d34b0[_0xba4f('0x61')]['id'];}return db[_0xba4f('0x51')][_0xba4f('0x5a')]({'where':{'id':_0x1d34b0[_0xba4f('0x57')]['id']},'include':[{'model':db[_0xba4f('0x58')],'as':_0xba4f('0x3d')}]})[_0xba4f('0x1d')](handleEntityNotFound(_0x46cd82,null))[_0xba4f('0x1d')](saveUpdates(_0x1d34b0['body'],null))[_0xba4f('0x1d')](respondWithResult(_0x46cd82,null))[_0xba4f('0x27')](handleError(_0x46cd82,null));};exports[_0xba4f('0x35')]=function(_0x5911ea,_0x508af5){return db[_0xba4f('0x51')]['find']({'where':{'id':_0x5911ea[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x508af5,null))[_0xba4f('0x1d')](removeEntity(_0x508af5,null))[_0xba4f('0x27')](handleError(_0x508af5,null));};exports['describe']=function(_0x57463c,_0x374b0f){return db['SmsAccount']['describe']()[_0xba4f('0x1d')](respondWithResult(_0x374b0f,null))[_0xba4f('0x27')](handleError(_0x374b0f,null));};exports[_0xba4f('0x62')]=function(_0x17756d,_0x3da0af,_0x1b12d8){if(_0x17756d[_0xba4f('0x61')]['id']){delete _0x17756d[_0xba4f('0x61')]['id'];}return db['SmsAccount'][_0xba4f('0x5a')]({'where':{'id':_0x17756d['params']['id']}})['then'](handleEntityNotFound(_0x3da0af,null))[_0xba4f('0x1d')](function(_0x5d98ad){if(_0x5d98ad){_0x17756d[_0xba4f('0x61')]['SmsAccountId']=_0x5d98ad['id'];return db['Disposition'][_0xba4f('0x5b')](_0x17756d[_0xba4f('0x61')]);}})[_0xba4f('0x1d')](respondWithResult(_0x3da0af,null))[_0xba4f('0x27')](handleError(_0x3da0af,null));};exports[_0xba4f('0x63')]=function(_0x1326cf,_0x59b7ca,_0x1ed6f0){var _0x1f652e={'raw':![],'where':{}};var _0x291b3a={};var _0x21e4f4={'count':0x0,'rows':[]};return db['SmsAccount'][_0xba4f('0x64')]({'where':{'id':_0x1326cf[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x59b7ca,null))[_0xba4f('0x1d')](function(_0x2d07db){if(_0x2d07db){_0x291b3a[_0xba4f('0x42')]=_['keys'](db['Disposition'][_0xba4f('0x3f')]);_0x291b3a[_0xba4f('0x41')]=_['keys'](_0x1326cf[_0xba4f('0x41')]);_0x291b3a['filters']=_[_0xba4f('0x43')](_0x291b3a['model'],_0x291b3a['query']);_0x1f652e[_0xba4f('0x45')]=_[_0xba4f('0x43')](_0x291b3a[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x1326cf[_0xba4f('0x41')][_0xba4f('0x44')]));_0x1f652e[_0xba4f('0x45')]=_0x1f652e['attributes'][_0xba4f('0x46')]?_0x1f652e[_0xba4f('0x45')]:_0x291b3a['model'];if(!_0x1326cf[_0xba4f('0x41')]['hasOwnProperty']('nolimit')){_0x1f652e['limit']=qs[_0xba4f('0x2f')](_0x1326cf[_0xba4f('0x41')][_0xba4f('0x2f')]);_0x1f652e[_0xba4f('0x2d')]=qs[_0xba4f('0x2d')](_0x1326cf['query']['offset']);}_0x1f652e[_0xba4f('0x49')]=qs[_0xba4f('0x4a')](_0x1326cf[_0xba4f('0x41')][_0xba4f('0x4a')]);_0x1f652e[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x1326cf[_0xba4f('0x41')],_0x291b3a[_0xba4f('0x4b')]));_0x1f652e['where'][_0xba4f('0x65')]=_0x2d07db['id'];if(_0x1326cf[_0xba4f('0x41')]['filter']){_0x1f652e['where']=_[_0xba4f('0x4f')](_0x1f652e[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x1f652e['attributes'],function(_0x5161db){var _0x5df981={};_0x5df981[_0x5161db]={'$like':'%'+_0x1326cf['query'][_0xba4f('0x4d')]+'%'};return _0x5df981;})});}_0x1f652e=_['merge']({},_0x1f652e,_0x1326cf['options']);return db['Disposition'][_0xba4f('0x2e')]({'where':_0x1f652e['where']})[_0xba4f('0x1d')](function(_0x82653e){_0x21e4f4[_0xba4f('0x2e')]=_0x82653e;if(_0x1326cf[_0xba4f('0x41')]['includeAll']){_0x1f652e[_0xba4f('0x53')]=[{'all':!![]}];}return db[_0xba4f('0x66')][_0xba4f('0x54')](_0x1f652e);})[_0xba4f('0x1d')](function(_0x738bf9){_0x21e4f4['rows']=_0x738bf9;return _0x21e4f4;});}})[_0xba4f('0x1d')](respondWithFilteredResult(_0x59b7ca,_0x1f652e))['catch'](handleError(_0x59b7ca,null));};exports[_0xba4f('0x67')]=function(_0x38e89c,_0x37b7b5,_0x8d8a7a){return db[_0xba4f('0x51')]['find']({'where':{'id':_0x38e89c['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x37b7b5,null))['then'](function(_0x4a592d){if(_0x4a592d){return _0x4a592d['removeDispositions'](_0x38e89c[_0xba4f('0x41')][_0xba4f('0x68')]);}})[_0xba4f('0x1d')](respondWithStatusCode(_0x37b7b5,null))[_0xba4f('0x27')](handleError(_0x37b7b5,null));};exports['addAnswer']=function(_0x59c6f7,_0x4c39ab,_0x1686dd){if(_0x59c6f7[_0xba4f('0x61')]['id']){delete _0x59c6f7[_0xba4f('0x61')]['id'];}return db['SmsAccount'][_0xba4f('0x5a')]({'where':{'id':_0x59c6f7[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4c39ab,null))[_0xba4f('0x1d')](function(_0x5c1b52){if(_0x5c1b52){_0x59c6f7[_0xba4f('0x61')][_0xba4f('0x65')]=_0x5c1b52['id'];return db[_0xba4f('0x69')][_0xba4f('0x5b')](_0x59c6f7[_0xba4f('0x61')]);}})[_0xba4f('0x1d')](respondWithResult(_0x4c39ab,null))[_0xba4f('0x27')](handleError(_0x4c39ab,null));};exports[_0xba4f('0x6a')]=function(_0x19f8f4,_0x45ebd4,_0x1e00ae){var _0x5a6df6={'raw':![],'where':{}};var _0x4e665d={};var _0x399a4c={'count':0x0,'rows':[]};return db[_0xba4f('0x51')]['findOne']({'where':{'id':_0x19f8f4[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x45ebd4,null))['then'](function(_0x1f2d2a){if(_0x1f2d2a){_0x4e665d[_0xba4f('0x42')]=_['keys'](db[_0xba4f('0x69')]['rawAttributes']);_0x4e665d[_0xba4f('0x41')]=_[_0xba4f('0x59')](_0x19f8f4[_0xba4f('0x41')]);_0x4e665d[_0xba4f('0x4b')]=_['intersection'](_0x4e665d[_0xba4f('0x42')],_0x4e665d['query']);_0x5a6df6[_0xba4f('0x45')]=_['intersection'](_0x4e665d[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x44')]));_0x5a6df6[_0xba4f('0x45')]=_0x5a6df6[_0xba4f('0x45')]['length']?_0x5a6df6[_0xba4f('0x45')]:_0x4e665d[_0xba4f('0x42')];if(!_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x47')]('nolimit')){_0x5a6df6[_0xba4f('0x2f')]=qs[_0xba4f('0x2f')](_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x2f')]);_0x5a6df6[_0xba4f('0x2d')]=qs[_0xba4f('0x2d')](_0x19f8f4['query'][_0xba4f('0x2d')]);}_0x5a6df6[_0xba4f('0x49')]=qs[_0xba4f('0x4a')](_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x4a')]);_0x5a6df6[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x19f8f4['query'],_0x4e665d['filters']));_0x5a6df6[_0xba4f('0x4e')][_0xba4f('0x65')]=_0x1f2d2a['id'];if(_0x19f8f4['query'][_0xba4f('0x4d')]){_0x5a6df6['where']=_['merge'](_0x5a6df6[_0xba4f('0x4e')],{'$or':_['map'](_0x5a6df6[_0xba4f('0x45')],function(_0x116ca6){var _0x5d6e20={};_0x5d6e20[_0x116ca6]={'$like':'%'+_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x4d')]+'%'};return _0x5d6e20;})});}_0x5a6df6=_['merge']({},_0x5a6df6,_0x19f8f4[_0xba4f('0x50')]);return db['CannedAnswer'][_0xba4f('0x2e')]({'where':_0x5a6df6[_0xba4f('0x4e')]})[_0xba4f('0x1d')](function(_0x2e1a55){_0x399a4c['count']=_0x2e1a55;if(_0x19f8f4[_0xba4f('0x41')]['includeAll']){_0x5a6df6['include']=[{'all':!![]}];}return db[_0xba4f('0x69')]['findAll'](_0x5a6df6);})['then'](function(_0x39a903){_0x399a4c[_0xba4f('0x55')]=_0x39a903;return _0x399a4c;});}})['then'](respondWithFilteredResult(_0x45ebd4,_0x5a6df6))[_0xba4f('0x27')](handleError(_0x45ebd4,null));};exports['removeAnswers']=function(_0x3a29f1,_0x42beaa,_0x3835bc){return db['SmsAccount']['find']({'where':{'id':_0x3a29f1[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x42beaa,null))[_0xba4f('0x1d')](function(_0x2e4c4c){if(_0x2e4c4c){return _0x2e4c4c['removeAnswers'](_0x3a29f1['query'][_0xba4f('0x68')]);}})['then'](respondWithStatusCode(_0x42beaa,null))[_0xba4f('0x27')](handleError(_0x42beaa,null));};exports[_0xba4f('0x6b')]=function(_0x349416,_0x4b6f1f,_0x4391c5){var _0x378167={'channel':'sms'};var _0x5d6bfd=[];var _0x19242d=[];var _0x19c8f1={};return db[_0xba4f('0x51')][_0xba4f('0x5a')]({'where':{'id':_0x349416['params']['id']},'include':[{'model':db[_0xba4f('0x6c')],'as':_0xba4f('0x6d')}]})[_0xba4f('0x1d')](handleEntityNotFound(_0x4b6f1f,null))[_0xba4f('0x1d')](function(_0x1f7dde){_0x378167[_0xba4f('0x6e')]=_0x1f7dde;_0x378167['applications']=_[_0xba4f('0x6f')](_0x1f7dde[_0xba4f('0x6d')],[_0xba4f('0x70')],[_0xba4f('0x71')]);if(_0x378167[_0xba4f('0x6e')][_0xba4f('0x6d')]){delete _0x378167[_0xba4f('0x6e')][_0xba4f('0x6d')];}return db[_0xba4f('0x72')][_0xba4f('0x73')]();})[_0xba4f('0x1d')](function(_0x3c6203){if(!_0x3c6203){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))](_0xba4f('0x76'));}_0x5d6bfd=_[_0xba4f('0x77')](_[_0xba4f('0x59')](_0x3c6203),[_0xba4f('0x78'),'updatedAt']);_0x19242d=_[_0xba4f('0x77')](_['keys'](_0x3c6203),['createdAt',_0xba4f('0x79'),_0xba4f('0x7a'),'ListId']);_0x378167[_0xba4f('0x61')]={'mapKey':_0xba4f('0x7b')};if(_0x378167[_0xba4f('0x6e')]['type']){switch(_0x378167[_0xba4f('0x6e')][_0xba4f('0x40')]){case _0xba4f('0x7c'):_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x7e')];_0x378167[_0xba4f('0x61')]['body']=_0x349416[_0xba4f('0x61')]['Body'];_0x378167[_0xba4f('0x61')]['messageId']=_0x349416[_0xba4f('0x61')][_0xba4f('0x7f')];break;case'skebby':_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]='+'+_0x349416['body'][_0xba4f('0x80')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x81')];break;case _0xba4f('0x82'):_0x378167[_0xba4f('0x61')]['from']=_0x349416[_0xba4f('0x61')]['from'];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')]['message'];break;case _0xba4f('0x83'):_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416['body'][_0xba4f('0x7d')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x61')];_0x378167[_0xba4f('0x61')][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x85')];break;case _0xba4f('0x86'):_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416[_0xba4f('0x61')]['From'];_0x378167['body'][_0xba4f('0x61')]=_0x349416['body']['Text'];_0x378167[_0xba4f('0x61')][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x87')];break;case'infobip':_0x378167['body'][_0xba4f('0x7d')]='+'+_0x349416[_0xba4f('0x61')][_0xba4f('0x88')][0x0]['from'];_0x378167['body'][_0xba4f('0x61')]=_0x349416['body'][_0xba4f('0x88')][0x0][_0xba4f('0x81')];_0x378167['body'][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')]['results'][0x0]['messageId'];break;case _0xba4f('0x89'):_0x378167[_0xba4f('0x61')]['from']=_0x349416[_0xba4f('0x61')][_0xba4f('0x8a')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416['body']['segmentedMessage'][_0xba4f('0x25')];break;case _0xba4f('0x8b'):_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416['body']['fromNumber'];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')]['text'];_0x378167['body'][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')]['replyMessageId'];break;case'bandwidth':_0x378167[_0xba4f('0x61')][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')][0x0][_0xba4f('0x25')]['id'];_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416[_0xba4f('0x61')][0x0]['message'][_0xba4f('0x7d')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416['body'][0x0][_0xba4f('0x25')]['text'];break;case'intelepeer':_0x378167['body']['from']=_0x349416[_0xba4f('0x61')][_0xba4f('0x7d')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x25')];_0x378167[_0xba4f('0x61')][_0xba4f('0x84')]=_0x349416['body'][_0xba4f('0x8c')];break;}}if(_0x378167[_0xba4f('0x61')]['id']){delete _0x378167[_0xba4f('0x61')]['id'];}if(_[_0xba4f('0x8d')](_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')])){throw new db['Sequelize'][(_0xba4f('0x75'))](_0xba4f('0x8e'));}if(_[_0xba4f('0x8d')](_0x378167[_0xba4f('0x61')][_0xba4f('0x61')])||_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]===''){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))](_0xba4f('0x8f'));}if(_[_0xba4f('0x8d')](_0x378167[_0xba4f('0x61')]['mapKey'])){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))](_0xba4f('0x90')+_0x19242d);}if(!_[_0xba4f('0x91')](_0x19242d,_0x378167[_0xba4f('0x61')][_0xba4f('0x92')])){throw new db[(_0xba4f('0x74'))]['ValidationError'](_0xba4f('0x93')+_0x19242d);}_0x19c8f1[_0x378167[_0xba4f('0x61')][_0xba4f('0x92')]]=_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')];return db[_0xba4f('0x94')]['find']({'where':{'id':_0x378167[_0xba4f('0x6e')]['ListId']},'include':[{'model':db[_0xba4f('0x72')],'as':_0xba4f('0x95'),'where':_0x19c8f1,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xba4f('0x1d')](handleEntityNotFound(_0x4b6f1f,null))[_0xba4f('0x1d')](function(_0x2f7b12){if(_0x2f7b12){_0x378167[_0xba4f('0x96')]=_['omit'](_0x2f7b12,['Contacts']);if(_0x2f7b12[_0xba4f('0x95')][_0xba4f('0x46')]){return _0x2f7b12[_0xba4f('0x95')][0x0];}var _0x48966c=_[_0xba4f('0x97')](_0x378167[_0xba4f('0x61')],{'firstName':_0x378167[_0xba4f('0x61')]['from'],'ListId':_0x2f7b12['id']});_0x48966c[_0x378167['body']['mapKey']]=_0x378167['body'][_0xba4f('0x7d')];return db[_0xba4f('0x72')][_0xba4f('0x5b')](_0x48966c,{'fields':_0x5d6bfd,'raw':!![]});}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4b6f1f,null))[_0xba4f('0x1d')](function(_0x204597){if(_0x204597){_0x378167[_0xba4f('0x98')]=_0x204597;var _0xffdffe={'ContactId':_0x204597['id'],'phone':_0x378167['body'][_0xba4f('0x7d')],'SmsAccountId':_0x349416[_0xba4f('0x57')]['id']};var _0x1f86bd={'ContactId':_0x204597['id'],'SmsAccountId':_0x349416[_0xba4f('0x57')]['id'],'closed':![]};return db[_0xba4f('0x99')][_0xba4f('0x5a')]({'where':_0x1f86bd})[_0xba4f('0x1d')](function(_0x1b5073){if(_0x1b5073){return[_0x1b5073,![]];}return db[_0xba4f('0x99')][_0xba4f('0x5b')](_0xffdffe)['then'](function(_0x5d2d0d){return[_0x5d2d0d,!![]];});});}})[_0xba4f('0x9a')](function(_0x1dbd4a,_0x1efac1){_0x378167[_0xba4f('0x9b')]=_0x1dbd4a[_0xba4f('0x36')]({'plain':!![]});_0x378167[_0xba4f('0x9b')]['created']=![];if(_0x1efac1){if(_0x378167[_0xba4f('0x6e')]['autoclose']){_0x378167[_0xba4f('0x9c')]['push']({'id':0x0,'priority':_0x378167[_0xba4f('0x9c')][_0xba4f('0x46')]+0x1,'app':_0xba4f('0x9d'),'appdata':'unmanaged','interval':_0xba4f('0x9e')});}_0x378167[_0xba4f('0x9b')][_0xba4f('0x9f')]=!![];}return db[_0xba4f('0xa0')][_0xba4f('0x5b')]({'phone':_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')],'messageId':_0x378167[_0xba4f('0x61')][_0xba4f('0x84')],'body':_0x378167[_0xba4f('0x61')][_0xba4f('0x61')],'SmsAccountId':_0x349416[_0xba4f('0x57')]['id'],'SmsInteractionId':_0x1dbd4a['id'],'direction':'in','ContactId':_0x1dbd4a[_0xba4f('0xa1')],'AttachmentId':_0x378167['body'][_0xba4f('0xa2')]});})[_0xba4f('0x1d')](function(_0x5419f8){_0x378167[_0xba4f('0x25')]=_0x5419f8;if(!_0x378167[_0xba4f('0x9b')]['UserId'])return;return db[_0xba4f('0xa3')][_0xba4f('0x5a')]({'attributes':['id',_0xba4f('0x3a')],'where':{'id':_0x378167[_0xba4f('0x9b')]['UserId']}});})['then'](function(_0x1db1ee){if(_0x1db1ee){_0x378167[_0xba4f('0x9c')][_0xba4f('0xa4')]({'id':0x0,'priority':0x0,'app':_0xba4f('0xa5'),'appdata':_0x1db1ee[_0xba4f('0x3a')]+','+(_0x378167['account']['waitForTheAssignedAgent']||0xa),'interval':_0xba4f('0x9e')});}if(!_0x378167[_0xba4f('0x9b')]['queueId'])return;return db['SmsQueue'][_0xba4f('0x5a')]({'attributes':['id',_0xba4f('0x3a')],'where':{'id':_0x378167[_0xba4f('0x9b')][_0xba4f('0xa6')]}});})[_0xba4f('0x1d')](function(_0xc6e7a6){if(_0xc6e7a6){_0x378167[_0xba4f('0x9c')][_0xba4f('0xa4')]({'id':0x0,'priority':0x1,'app':_0xba4f('0xa7'),'appdata':_0xc6e7a6[_0xba4f('0x3a')]+','+(_0x378167[_0xba4f('0x6e')][_0xba4f('0xa8')]||0x12c),'interval':_0xba4f('0x9e')});}return respondWithRpcPromise(_0xba4f('0xa9'),_0xba4f('0xaa'),_0x378167);})[_0xba4f('0x1d')](function(_0x49a550){if(_0x49a550){var _0x2e58af=0xc8;var _0x4b6338=_0xba4f('0xab');logger[_0xba4f('0x1e')](_0xba4f('0xac'),_0x4b6338,_0x2e58af,_0xba4f('0xad'));logger[_0xba4f('0x21')](_0xba4f('0xae'),_0x4b6338,_0x2e58af,_0xba4f('0xad'),JSON['stringify'](_0x49a550));if(_0x378167['account'][_0xba4f('0x40')]===_0xba4f('0x7c')){return _0x4b6f1f[_0xba4f('0x29')](_0x2e58af)['set'](_0xba4f('0xaf'),_0xba4f('0xb0'))[_0xba4f('0x3b')](_0xba4f('0xb1'));}else{return _0x4b6f1f[_0xba4f('0x29')](_0x2e58af)[_0xba4f('0x2b')](_0x49a550);}}})[_0xba4f('0x27')](handleError(_0x4b6f1f,null));};exports['addApplications']=function(_0x3e28a,_0x2f70c2){var _0x41ae18=_0x3e28a[_0xba4f('0x57')]['id'];var _0x8ede43=_0x3e28a[_0xba4f('0x61')];var _0x2b076d=0xc8;var _0x3aa781=null;return db[_0xba4f('0xb2')][_0xba4f('0xb3')]({'isolationLevel':db[_0xba4f('0xb2')][_0xba4f('0xb4')][_0xba4f('0xb5')][_0xba4f('0xb6')]},function(_0x128e62){return db[_0xba4f('0x51')][_0xba4f('0x64')]({'where':{'id':_0x41ae18},'transaction':_0x128e62})[_0xba4f('0x1d')](function(_0x5181c7){if(_0x5181c7){return db[_0xba4f('0x6c')][_0xba4f('0x35')]({'where':{'SmsAccountId':_0x41ae18},'transaction':_0x128e62})[_0xba4f('0x1d')](function(){var _0x40ba95=_[_0xba4f('0x3e')](_0x8ede43,function(_0x17125e){_0x17125e[_0xba4f('0x65')]=_0x41ae18;return _0x17125e;});return db['SmsApplication'][_0xba4f('0xb7')](_0x40ba95,{'transaction':_0x128e62});});}else{_0x2b076d=0x194;_0x3aa781=[];}});})[_0xba4f('0x1d')](function(){if(_0x2b076d!==0x194){return db[_0xba4f('0x6c')]['findAndCountAll']({'where':{'SmsAccountId':_0x41ae18},'order':'priority'})[_0xba4f('0x1d')](function(_0x2d6b72){_0x3aa781=_0x2d6b72;});}})[_0xba4f('0x27')](function(_0x171880){_0x2b076d=0x1f4;logger['error'](_0x171880[_0xba4f('0x39')]);if(_0x171880[_0xba4f('0x3a')]){delete _0x171880[_0xba4f('0x3a')];}_0x3aa781=_0x171880;})[_0xba4f('0xb8')](function(){if(_0x3aa781===null){_0x2f70c2[_0xba4f('0x28')](_0x2b076d);}else{if(_0x2b076d===0x1f4){_0x2f70c2[_0xba4f('0x29')](_0x2b076d)[_0xba4f('0x3b')](_0x3aa781);}else{_0x2f70c2['status'](_0x2b076d)[_0xba4f('0x2b')](_0x3aa781);}}});};exports['getApplications']=function(_0x3f76d0,_0x80ac82,_0x1533cb){var _0x1fd2e3={};var _0x130cdb={};var _0x5dd119;var _0x246b4a;return db['SmsAccount']['findOne']({'where':{'id':_0x3f76d0['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x80ac82,null))['then'](function(_0x3f773d){if(_0x3f773d){_0x5dd119=_0x3f773d;_0x130cdb[_0xba4f('0x42')]=_[_0xba4f('0x59')](db[_0xba4f('0x6c')][_0xba4f('0x3f')]);_0x130cdb[_0xba4f('0x41')]=_['keys'](_0x3f76d0[_0xba4f('0x41')]);_0x130cdb[_0xba4f('0x4b')]=_[_0xba4f('0x43')](_0x130cdb[_0xba4f('0x42')],_0x130cdb[_0xba4f('0x41')]);_0x1fd2e3[_0xba4f('0x45')]=_['intersection'](_0x130cdb[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x44')]));_0x1fd2e3[_0xba4f('0x45')]=_0x1fd2e3[_0xba4f('0x45')][_0xba4f('0x46')]?_0x1fd2e3['attributes']:_0x130cdb[_0xba4f('0x42')];_0x1fd2e3['order']=qs[_0xba4f('0x4a')](_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x4a')]);_0x1fd2e3[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x3f76d0['query'],_0x130cdb['filters']));if(_0x3f76d0['query'][_0xba4f('0x4d')]){_0x1fd2e3[_0xba4f('0x4e')]=_['merge'](_0x1fd2e3[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x1fd2e3[_0xba4f('0x45')],function(_0x52e2a5){var _0xa4e9b1={};_0xa4e9b1[_0x52e2a5]={'$like':'%'+_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x4d')]+'%'};return _0xa4e9b1;})});}_0x1fd2e3=_[_0xba4f('0x4f')]({},_0x1fd2e3,_0x3f76d0['options']);return _0x5dd119['getApplications'](_0x1fd2e3);}})['then'](function(_0xd90d23){if(_0xd90d23){_0x246b4a=_0xd90d23[_0xba4f('0x46')];if(!_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x47')](_0xba4f('0x48'))){_0x1fd2e3[_0xba4f('0x2f')]=qs[_0xba4f('0x2f')](_0x3f76d0['query'][_0xba4f('0x2f')]);_0x1fd2e3[_0xba4f('0x2d')]=qs[_0xba4f('0x2d')](_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x2d')]);}return _0x5dd119[_0xba4f('0xb9')](_0x1fd2e3);}})['then'](function(_0x5e62df){if(_0x5e62df){return _0x5e62df?{'count':_0x246b4a,'rows':_0x5e62df}:null;}})['then'](respondWithResult(_0x80ac82,null))['catch'](handleError(_0x80ac82,null));};exports['getInteractions']=function(_0x4289bb,_0x17f6bf,_0x1d21fc){var _0x59efb5={'raw':![],'where':{}};var _0x3c3d07={};var _0x5d0b3e={'count':0x0,'rows':[]};return db['SmsAccount'][_0xba4f('0x64')]({'where':{'id':_0x4289bb['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x17f6bf,null))['then'](function(_0x2d91fc){if(_0x2d91fc){_0x3c3d07['model']=_[_0xba4f('0x59')](db[_0xba4f('0x99')][_0xba4f('0x3f')]);_0x3c3d07[_0xba4f('0x41')]=_['keys'](_0x4289bb[_0xba4f('0x41')]);_0x3c3d07[_0xba4f('0x4b')]=_['intersection'](_0x3c3d07[_0xba4f('0x42')],_0x3c3d07[_0xba4f('0x41')]);_0x59efb5[_0xba4f('0x45')]=_[_0xba4f('0x43')](_0x3c3d07[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x4289bb[_0xba4f('0x41')][_0xba4f('0x44')]));_0x59efb5[_0xba4f('0x45')]=_0x59efb5['attributes']['length']?_0x59efb5[_0xba4f('0x45')]:_0x3c3d07[_0xba4f('0x42')];if(!_0x4289bb[_0xba4f('0x41')]['hasOwnProperty'](_0xba4f('0x48'))){_0x59efb5[_0xba4f('0x2f')]=qs[_0xba4f('0x2f')](_0x4289bb['query']['limit']);_0x59efb5[_0xba4f('0x2d')]=qs[_0xba4f('0x2d')](_0x4289bb[_0xba4f('0x41')][_0xba4f('0x2d')]);}_0x59efb5[_0xba4f('0x49')]=qs[_0xba4f('0x4a')](_0x4289bb[_0xba4f('0x41')][_0xba4f('0x4a')]);_0x59efb5[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x4289bb[_0xba4f('0x41')],_0x3c3d07[_0xba4f('0x4b')]));_0x59efb5[_0xba4f('0x4e')]['SmsAccountId']=_0x2d91fc['id'];if(_0x4289bb['query']['filter']){_0x59efb5[_0xba4f('0x4e')]=_[_0xba4f('0x4f')](_0x59efb5[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x59efb5[_0xba4f('0x45')],function(_0x2912fb){var _0xea33ac={};_0xea33ac[_0x2912fb]={'$like':'%'+_0x4289bb[_0xba4f('0x41')][_0xba4f('0x4d')]+'%'};return _0xea33ac;})});}_0x59efb5=_[_0xba4f('0x4f')]({},_0x59efb5,_0x4289bb[_0xba4f('0x50')]);return db['SmsInteraction'][_0xba4f('0x2e')]({'where':_0x59efb5[_0xba4f('0x4e')]})[_0xba4f('0x1d')](function(_0x2c62f7){_0x5d0b3e[_0xba4f('0x2e')]=_0x2c62f7;if(_0x4289bb[_0xba4f('0x41')][_0xba4f('0x52')]){_0x59efb5['include']=[{'model':db[_0xba4f('0x72')],'as':_0xba4f('0xba'),'required':![]},{'model':db[_0xba4f('0xa3')],'as':'Owner','attributes':[_0xba4f('0x3a'),_0xba4f('0xbb'),_0xba4f('0xbc')],'required':![]},{'model':db[_0xba4f('0xbd')],'as':'Tags','attributes':['id',_0xba4f('0x3a'),_0xba4f('0xbe')],'where':_0x4289bb[_0xba4f('0x41')]['tag']?{'id':_0x4289bb[_0xba4f('0x41')][_0xba4f('0xbf')]}:undefined,'required':_0x4289bb[_0xba4f('0x41')][_0xba4f('0xbf')]?!![]:![]}];}return db[_0xba4f('0x99')]['findAll'](_0x59efb5);})[_0xba4f('0x1d')](function(_0x49281b){_0x5d0b3e[_0xba4f('0x55')]=_0x49281b;return _0x5d0b3e;});}})[_0xba4f('0x1d')](respondWithFilteredResult(_0x17f6bf,_0x59efb5))['catch'](handleError(_0x17f6bf,null));};exports[_0xba4f('0x3b')]=function(_0x49f2e7,_0x4cb674,_0x346ae2){var _0x1de21f,_0x418c70,_0x4ee370;if(_[_0xba4f('0x8d')](_0x49f2e7[_0xba4f('0x61')][_0xba4f('0x61')])||_0x49f2e7[_0xba4f('0x61')][_0xba4f('0x61')]===''){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xba4f('0x8d')](_0x49f2e7[_0xba4f('0x61')]['to'])){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))](_0xba4f('0xc0'));}_0x1de21f=_0x49f2e7[_0xba4f('0x61')]['to'];return db[_0xba4f('0x51')][_0xba4f('0x5a')]({'where':{'id':_0x49f2e7[_0xba4f('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xba4f('0xc1'),'include':[{'model':db['CmContact'],'as':_0xba4f('0x95'),'where':{'mobile':_0x1de21f},'limit':0x1,'order':[['updatedAt',_0xba4f('0xc2')]]}]}]})[_0xba4f('0x1d')](handleEntityNotFound(_0x4cb674,null))['then'](function(_0x36c515){if(_0x36c515&&_0x36c515[_0xba4f('0xc1')]){_0x418c70=_0x36c515[_0xba4f('0x36')]({'plain':!![]});if(_0x418c70['List']&&_0x418c70[_0xba4f('0xc1')][_0xba4f('0x95')][_0xba4f('0x46')]){return _0x418c70[_0xba4f('0xc1')][_0xba4f('0x95')][0x0];}return db[_0xba4f('0x72')]['create'](_[_0xba4f('0x97')](_0x49f2e7[_0xba4f('0x61')],{'firstName':_0x1de21f,'mobile':_0x1de21f,'phone':_0x1de21f,'ListId':_0x418c70[_0xba4f('0xc3')]}));}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4cb674,null))[_0xba4f('0x1d')](function(_0x1e5282){if(_0x1e5282){_0x4ee370=_0x1e5282;return db[_0xba4f('0x99')][_0xba4f('0x5a')]({'where':{'ContactId':_0x4ee370['id'],'closed':![],'SmsAccountId':_0x418c70['id']}})[_0xba4f('0x1d')](function(_0x1bdce8){if(_0x1bdce8){return[_0x1bdce8,![]];}return db['SmsInteraction'][_0xba4f('0x5b')]({'UserId':_0x49f2e7[_0xba4f('0x5c')]['id'],'ContactId':_0x4ee370['id'],'SmsAccountId':_0x418c70['id'],'phone':_0x1de21f,'firstMsgDirection':_0xba4f('0xc4'),'Messages':[_['merge'](_0x49f2e7['body'],{'read':![],'body':_0x49f2e7[_0xba4f('0x61')][_0xba4f('0x61')],'phone':_0x1de21f,'SmsAccountId':_0x418c70['id'],'UserId':_0x49f2e7['user']['id'],'ContactId':_0x4ee370['id']})]},{'include':[{'model':db[_0xba4f('0xa0')],'as':_0xba4f('0xc5')}]})['then'](function(_0x2762f8){return[_0x2762f8,!![]];});});}})[_0xba4f('0x9a')](function(_0x448963,_0x6433b5){if(_0x6433b5){return _0x448963;}return db[_0xba4f('0xa0')][_0xba4f('0x5b')](_[_0xba4f('0x4f')](_0x49f2e7[_0xba4f('0x61')],{'read':![],'body':_0x49f2e7[_0xba4f('0x61')][_0xba4f('0x61')],'phone':_0x1de21f,'SmsAccountId':_0x418c70['id'],'SmsInteractionId':_0x448963['id'],'UserId':_0x49f2e7[_0xba4f('0x5c')]['id'],'ContactId':_0x4ee370['id']}))[_0xba4f('0x1d')](function(_0x3f603c){_0x448963[_0xba4f('0xc6')][_0xba4f('0xc5')]=[];_0x448963[_0xba4f('0xc6')][_0xba4f('0xc5')]['push'](_0x3f603c[_0xba4f('0xc6')]);return _0x448963;});})[_0xba4f('0x1d')](respondWithResult(_0x4cb674,null))[_0xba4f('0x27')](handleError(_0x4cb674,null));};exports[_0xba4f('0x29')]=function(_0x3361ea,_0x399a7a,_0x1a0ade){if(_0x3361ea[_0xba4f('0x61')]['id']){delete _0x3361ea['body']['id'];}var _0x1da220,_0x5e9f64,_0x49b828;return db['SmsAccount'][_0xba4f('0x5a')]({'where':{'id':_0x3361ea['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x399a7a,null))[_0xba4f('0x1d')](function(_0xdf716e){if(_0xdf716e){_0x49b828=_0xdf716e;logger[_0xba4f('0x21')](_0xba4f('0xac'),_0xba4f('0x29'),'received\x20delivery\x20report\x20from',_0xdf716e[_0xba4f('0x40')],util[_0xba4f('0xc7')](_0x3361ea['body'],{'showHidden':![],'depth':null}));switch(_0xdf716e[_0xba4f('0x40')]){case _0xba4f('0xc8'):if(_0x3361ea[_0xba4f('0x61')][_0xba4f('0xc9')]&&_0x3361ea[_0xba4f('0x61')][_0xba4f('0x29')]){_0x5e9f64=_0x3361ea[_0xba4f('0x61')][_0xba4f('0x29')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea['body'][_0xba4f('0xc9')]}});}break;case _0xba4f('0x82'):if(_0x3361ea[_0xba4f('0x61')]['requestid']&&_0x3361ea[_0xba4f('0x61')][_0xba4f('0xca')]){_0x5e9f64=_0x3361ea[_0xba4f('0x61')][_0xba4f('0xca')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea[_0xba4f('0x61')]['requestid']}});}break;case'clicksend':if(_0x3361ea[_0xba4f('0x61')][_0xba4f('0x85')]&&_0x3361ea[_0xba4f('0x61')][_0xba4f('0xcb')]){_0x5e9f64=_0x3361ea[_0xba4f('0x61')][_0xba4f('0xcb')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea[_0xba4f('0x61')][_0xba4f('0x85')]}});}break;case'infobip':var _0x5d0b5f=_0x3361ea['body'][_0xba4f('0x88')][0x0];if(_0x5d0b5f[_0xba4f('0x84')]&&_0x5d0b5f['status'][_0xba4f('0xcc')]===_0xba4f('0xcd')){_0x5e9f64=_0x5d0b5f[_0xba4f('0x29')][_0xba4f('0xcc')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x5d0b5f[_0xba4f('0x84')]}});}break;case'clickatell':if(_0x3361ea[_0xba4f('0x61')]['messageId']&&_0x3361ea['body']['status']){_0x5e9f64=_0x3361ea['body'][_0xba4f('0x29')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea['body']['messageId']}});}break;case _0xba4f('0xce'):if(_0x3361ea[_0xba4f('0x61')][0x0][_0xba4f('0x25')]['id']){_0x5e9f64=_0x3361ea['body'][0x0]['type'];return db['SmsMessage'][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea[_0xba4f('0x61')][0x0]['message']['id']}});}break;case _0xba4f('0xcf'):if(_0x3361ea[_0xba4f('0x61')][_0xba4f('0xd0')]&&_0x3361ea[_0xba4f('0x61')][_0xba4f('0x29')]){_0x5e9f64=_0x3361ea[_0xba4f('0x61')]['status'];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea[_0xba4f('0x61')][_0xba4f('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x399a7a,null))['then'](function(_0x7d94d1){if(_0x7d94d1){_0x1da220=_0x7d94d1;switch(_0x49b828[_0xba4f('0x40')]){case _0xba4f('0xc8'):if(_0x5e9f64===_0xba4f('0xcd')){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),'status',_0xba4f('0xc8'),util[_0xba4f('0xc7')](_0x3361ea['body'],{'showHidden':![],'depth':null}));}break;case _0xba4f('0x82'):if(_0x5e9f64==='1'){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),'status',_0xba4f('0xc8'),util['inspect'](_0x3361ea[_0xba4f('0x61')],{'showHidden':![],'depth':null}));}break;case _0xba4f('0x83'):if(!_0x3361ea[_0xba4f('0x61')][_0xba4f('0xd1')]&&_0x5e9f64>=0xc8&&_0x5e9f64<=0xce){return _0x1da220['update']({'read':!![]});}else{logger['error'](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0x83'),util[_0xba4f('0xc7')](_0x3361ea[_0xba4f('0x61')],{'showHidden':![],'depth':null}));}break;case _0xba4f('0xd2'):var _0xa1d59=_0x3361ea[_0xba4f('0x61')]['results'][0x0];if(_0xa1d59[_0xba4f('0x29')]['groupName']==='DELIVERED'){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0xd2'),util['inspect'](_0x3361ea[_0xba4f('0x61')],{'showHidden':![],'depth':null}));}break;case _0xba4f('0x8b'):if(_0x5e9f64=='DELIVERED_TO_GATEWAY'||_0x5e9f64==_0xba4f('0xd3')){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger['error'](_0xba4f('0xac'),'status',_0xba4f('0x8b'),util['inspect'](_0x3361ea['body'],{'showHidden':![],'depth':null}));}break;case _0xba4f('0xce'):if(_0x5e9f64==_0xba4f('0xd4')){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0xce'),util['inspect'](_0x3361ea[_0xba4f('0x61')],{'showHidden':![],'depth':null}));}break;case _0xba4f('0xcf'):if(_0x5e9f64===_0xba4f('0xd5')||_0x5e9f64===_0xba4f('0xd6')){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0xcf'),util[_0xba4f('0xc7')](_0x3361ea['body'],{'showHidden':![],'depth':null}));}break;}return _0x1da220;}})['then'](respondWithResult(_0x399a7a,null))[_0xba4f('0x27')](handleError(_0x399a7a,null));};exports[_0xba4f('0xd7')]=function(_0x3147a9,_0x2e8117,_0x21e61d){var _0x2ce1ed,_0x1cb6f2,_0x198ba4;return db[_0xba4f('0x51')][_0xba4f('0x5a')]({'where':{'id':_0x3147a9[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x2e8117,null))[_0xba4f('0x1d')](function(_0x20c1ef){if(_0x20c1ef){_0x198ba4=_0x20c1ef;logger[_0xba4f('0x21')](_0xba4f('0xac'),'status',_0xba4f('0xd8'),_0x20c1ef[_0xba4f('0x40')],util[_0xba4f('0xc7')](_0x3147a9['query'],{'showHidden':![],'depth':null}));switch(_0x20c1ef[_0xba4f('0x40')]){case _0xba4f('0x89'):if(_0x3147a9[_0xba4f('0x41')][_0xba4f('0xd9')]&&_0x3147a9[_0xba4f('0x41')]['state']){_0x1cb6f2=_0x3147a9[_0xba4f('0x41')][_0xba4f('0xda')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3147a9[_0xba4f('0x41')][_0xba4f('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x2e8117,null))[_0xba4f('0x1d')](function(_0x4810f6){if(_0x4810f6){_0x2ce1ed=_0x4810f6;switch(_0x198ba4[_0xba4f('0x40')]){case'csc':if(_0x1cb6f2==='2'||_0x1cb6f2==='6'){return _0x2ce1ed[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0x89'),util[_0xba4f('0xc7')](_0x3147a9[_0xba4f('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x2ce1ed;}})['then'](respondWithResult(_0x2e8117,null))[_0xba4f('0x27')](handleError(_0x2e8117,null));};exports['addAgents']=function(_0x17f149,_0x4bd79d,_0x406323){return db['SmsAccount'][_0xba4f('0x5a')]({'where':{'id':_0x17f149[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4bd79d,null))[_0xba4f('0x1d')](function(_0x5e8bb0){if(_0x5e8bb0){return _0x5e8bb0[_0xba4f('0xdb')](_0x17f149[_0xba4f('0x61')][_0xba4f('0x68')],_['omit'](_0x17f149['body'],[_0xba4f('0x68'),'id'])||{})[_0xba4f('0x9a')](function(_0x96523e){for(var _0x37c589=0x0;_0x37c589<_0x17f149[_0xba4f('0x61')][_0xba4f('0x68')][_0xba4f('0x46')];_0x37c589+=0x1){socket[_0xba4f('0xdc')](_0xba4f('0xdd'),{'UserId':Number(_0x17f149[_0xba4f('0x61')][_0xba4f('0x68')][_0x37c589]),'SmsAccountId':Number(_0x17f149['params']['id'])});}return _0x96523e;});}})[_0xba4f('0x1d')](respondWithResult(_0x4bd79d,null))[_0xba4f('0x27')](handleError(_0x4bd79d,null));};exports[_0xba4f('0xde')]=function(_0x2de21d,_0x4c6ced,_0x42b892){return db[_0xba4f('0x51')]['find']({'where':{'id':_0x2de21d[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4c6ced,null))[_0xba4f('0x1d')](function(_0x23ec91){if(_0x23ec91){return _0x23ec91['removeAgents'](_0x2de21d[_0xba4f('0x41')][_0xba4f('0x68')])['then'](function(){if(_[_0xba4f('0xdf')](_0x2de21d[_0xba4f('0x41')][_0xba4f('0x68')])){for(var _0x45d690=0x0;_0x45d690<_0x2de21d[_0xba4f('0x41')][_0xba4f('0x68')][_0xba4f('0x46')];_0x45d690+=0x1){socket[_0xba4f('0xdc')](_0xba4f('0xe0'),{'UserId':Number(_0x2de21d['query'][_0xba4f('0x68')][_0x45d690]),'SmsAccountId':Number(_0x2de21d[_0xba4f('0x57')]['id'])});}}else{socket[_0xba4f('0xdc')](_0xba4f('0xe0'),{'UserId':Number(_0x2de21d[_0xba4f('0x41')]['ids']),'SmsAccountId':Number(_0x2de21d['params']['id'])});}});}})[_0xba4f('0x1d')](respondWithStatusCode(_0x4c6ced,null))[_0xba4f('0x27')](handleError(_0x4c6ced,null));};exports[_0xba4f('0xe1')]=function(_0x20dbd5,_0x263a2c,_0x285b0f){var _0x3b8933={};var _0x9a26bb={};var _0x287bed;var _0xd10bff;return db[_0xba4f('0x51')]['findOne']({'where':{'id':_0x20dbd5['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x263a2c,null))[_0xba4f('0x1d')](function(_0x5e2193){if(_0x5e2193){_0x287bed=_0x5e2193;_0x9a26bb[_0xba4f('0x42')]=_[_0xba4f('0x59')](db[_0xba4f('0xa3')][_0xba4f('0x3f')]);_0x9a26bb['query']=_[_0xba4f('0x59')](_0x20dbd5[_0xba4f('0x41')]);_0x9a26bb['filters']=_[_0xba4f('0x43')](_0x9a26bb[_0xba4f('0x42')],_0x9a26bb[_0xba4f('0x41')]);_0x3b8933[_0xba4f('0x45')]=_['intersection'](_0x9a26bb[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x20dbd5[_0xba4f('0x41')][_0xba4f('0x44')]));_0x3b8933[_0xba4f('0x45')]=_0x3b8933[_0xba4f('0x45')]['length']?_0x3b8933['attributes']:_0x9a26bb['model'];_0x3b8933[_0xba4f('0x49')]=qs['sort'](_0x20dbd5['query'][_0xba4f('0x4a')]);_0x3b8933[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x20dbd5[_0xba4f('0x41')],_0x9a26bb[_0xba4f('0x4b')]));if(_0x20dbd5[_0xba4f('0x41')][_0xba4f('0x4d')]){_0x3b8933[_0xba4f('0x4e')]=_['merge'](_0x3b8933[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x3b8933[_0xba4f('0x45')],function(_0x2b62fa){var _0x368aa1={};_0x368aa1[_0x2b62fa]={'$like':'%'+_0x20dbd5['query'][_0xba4f('0x4d')]+'%'};return _0x368aa1;})});}_0x3b8933=_['merge']({},_0x3b8933,_0x20dbd5['options']);return _0x287bed[_0xba4f('0xe1')](_0x3b8933);}})[_0xba4f('0x1d')](function(_0x5e9e09){if(_0x5e9e09){_0xd10bff=_0x5e9e09['length'];if(!_0x20dbd5[_0xba4f('0x41')]['hasOwnProperty'](_0xba4f('0x48'))){_0x3b8933[_0xba4f('0x2f')]=qs[_0xba4f('0x2f')](_0x20dbd5[_0xba4f('0x41')][_0xba4f('0x2f')]);_0x3b8933['offset']=qs['offset'](_0x20dbd5['query'][_0xba4f('0x2d')]);}return _0x287bed[_0xba4f('0xe1')](_0x3b8933);}})[_0xba4f('0x1d')](function(_0x2d8cf6){if(_0x2d8cf6){return _0x2d8cf6?{'count':_0xd10bff,'rows':_0x2d8cf6}:null;}})[_0xba4f('0x1d')](respondWithResult(_0x263a2c,null))[_0xba4f('0x27')](handleError(_0x263a2c,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index fd49814..fbc7b62 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 _0x0585=['emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','remove'];(function(_0x4a27f8,_0x2657ed){var _0x5b1119=function(_0x226eb9){while(--_0x226eb9){_0x4a27f8['push'](_0x4a27f8['shift']());}};_0x5b1119(++_0x2657ed);}(_0x0585,0xcc));var _0x5058=function(_0x41c00f,_0x199897){_0x41c00f=_0x41c00f-0x0;var _0x2bfa66=_0x0585[_0x41c00f];return _0x2bfa66;};'use strict';var EventEmitter=require(_0x5058('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x5058('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5058('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5058('0x3')};function emitEvent(_0x331e38){return function(_0x1a7c7a,_0x4d1920,_0x53a47f){SmsAccountEvents[_0x5058('0x4')](_0x331e38+':'+_0x1a7c7a['id'],_0x1a7c7a);SmsAccountEvents['emit'](_0x331e38,_0x1a7c7a);_0x53a47f(null);};}for(var e in events){if(events[_0x5058('0x5')](e)){var event=events[e];SmsAccount[_0x5058('0x6')](e,emitEvent(event));}}module[_0x5058('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x9b58=['events','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x39abaf,_0x264258){var _0x2f7166=function(_0x1bc01e){while(--_0x1bc01e){_0x39abaf['push'](_0x39abaf['shift']());}};_0x2f7166(++_0x264258);}(_0x9b58,0x1b0));var _0x89b5=function(_0xeb7891,_0x4771f7){_0xeb7891=_0xeb7891-0x0;var _0x11cc19=_0x9b58[_0xeb7891];return _0x11cc19;};'use strict';var EventEmitter=require(_0x89b5('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x89b5('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x89b5('0x2')](0x0);var events={'afterCreate':_0x89b5('0x3'),'afterUpdate':_0x89b5('0x4'),'afterDestroy':_0x89b5('0x5')};function emitEvent(_0x415939){return function(_0x419b1f,_0x3139a7,_0x1ce5e2){SmsAccountEvents['emit'](_0x415939+':'+_0x419b1f['id'],_0x419b1f);SmsAccountEvents[_0x89b5('0x6')](_0x415939,_0x419b1f);_0x1ce5e2(null);};}for(var e in events){if(events[_0x89b5('0x7')](e)){var event=events[e];SmsAccount['hook'](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 37620b7..daab530 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 _0xfdec=['path','exports','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment'];(function(_0x1e4f9e,_0x20d717){var _0x5715cc=function(_0x21fcc2){while(--_0x21fcc2){_0x1e4f9e['push'](_0x1e4f9e['shift']());}};_0x5715cc(++_0x20d717);}(_0xfdec,0xdc));var _0xcfde=function(_0x43709e,_0x2c3b45){_0x43709e=_0x43709e-0x0;var _0x452820=_0xfdec[_0x43709e];return _0x452820;};'use strict';var _=require(_0xcfde('0x0'));var util=require('util');var logger=require(_0xcfde('0x1'))(_0xcfde('0x2'));var moment=require(_0xcfde('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfde('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xcfde('0x5')]=function(_0x504566,_0x3c358e){return _0x504566['define'](_0xcfde('0x6'),attributes,{'tableName':_0xcfde('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee81=['./smsAccount.attributes','define','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x1318c2,_0x16e0c1){var _0x28c62e=function(_0x16f068){while(--_0x16f068){_0x1318c2['push'](_0x1318c2['shift']());}};_0x28c62e(++_0x16e0c1);}(_0xee81,0x17c));var _0x1ee8=function(_0x14cc95,_0x42b2bc){_0x14cc95=_0x14cc95-0x0;var _0x12c064=_0xee81[_0x14cc95];return _0x12c064;};'use strict';var _=require(_0x1ee8('0x0'));var util=require(_0x1ee8('0x1'));var logger=require(_0x1ee8('0x2'))('api');var moment=require(_0x1ee8('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ee8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ee8('0x5'));var config=require(_0x1ee8('0x6'));var attributes=require(_0x1ee8('0x7'));module['exports']=function(_0x2e5751,_0x53c26c){return _0x2e5751[_0x1ee8('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 3b54b3e..a65546a 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 _0xcccb=['include','map','model','ShowSmsAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes'];(function(_0x2e3386,_0x1aefbd){var _0x493420=function(_0x508b2d){while(--_0x508b2d){_0x2e3386['push'](_0x2e3386['shift']());}};_0x493420(++_0x1aefbd);}(_0xcccb,0xa0));var _0xbccc=function(_0x3df625,_0x4255dc){_0x3df625=_0x3df625-0x0;var _0x2430b6=_0xcccb[_0x3df625];return _0x2430b6;};'use strict';var _=require(_0xbccc('0x0'));var util=require(_0xbccc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbccc('0x2'));var fs=require('fs');var Redis=require(_0xbccc('0x3'));var db=require(_0xbccc('0x4'))['db'];var utils=require(_0xbccc('0x5'));var logger=require(_0xbccc('0x6'))('rpc');var config=require(_0xbccc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbccc('0x8')][_0xbccc('0x9')]({'port':0x232a});config[_0xbccc('0xa')]=_[_0xbccc('0xb')](config[_0xbccc('0xa')],{'host':_0xbccc('0xc'),'port':0x18eb});var socket=require(_0xbccc('0xd'))(new Redis(config[_0xbccc('0xa')]));require(_0xbccc('0xe'))[_0xbccc('0xf')](socket);function respondWithRpcPromise(_0x5da234,_0x4d5d30,_0x55231f){return new BPromise(function(_0x141e40,_0x19a993){return client[_0xbccc('0x10')](_0x5da234,_0x55231f)[_0xbccc('0x11')](function(_0x202666){logger[_0xbccc('0x12')](_0xbccc('0x13'),_0x4d5d30,_0xbccc('0x14'));logger[_0xbccc('0x15')](_0xbccc('0x16'),_0x4d5d30,_0xbccc('0x14'),JSON[_0xbccc('0x17')](_0x202666));if(_0x202666[_0xbccc('0x18')]){if(_0x202666[_0xbccc('0x18')][_0xbccc('0x19')]===0x1f4){logger['error'](_0xbccc('0x13'),_0x4d5d30,_0x202666[_0xbccc('0x18')]['message']);return _0x19a993(_0x202666[_0xbccc('0x18')][_0xbccc('0x1a')]);}logger[_0xbccc('0x18')](_0xbccc('0x13'),_0x4d5d30,_0x202666['error']['message']);return _0x141e40(_0x202666[_0xbccc('0x18')][_0xbccc('0x1a')]);}else{logger[_0xbccc('0x12')](_0xbccc('0x13'),_0x4d5d30,'request\x20sent');_0x141e40(_0x202666[_0xbccc('0x1b')][_0xbccc('0x1a')]);}})[_0xbccc('0x1c')](function(_0x26e5e3){logger[_0xbccc('0x18')](_0xbccc('0x13'),_0x4d5d30,_0x26e5e3);_0x19a993(_0x26e5e3);});});}exports['ShowSmsAccount']=function(_0x547755){var _0x42cdf8=this;return new Promise(function(_0x178b2d,_0x366d64){return db[_0xbccc('0x1d')][_0xbccc('0x1e')]({'raw':_0x547755[_0xbccc('0x1f')]?_0x547755[_0xbccc('0x1f')][_0xbccc('0x20')]===undefined?!![]:![]:!![],'where':_0x547755[_0xbccc('0x1f')]?_0x547755[_0xbccc('0x1f')][_0xbccc('0x21')]||null:null,'attributes':_0x547755['options']?_0x547755[_0xbccc('0x1f')][_0xbccc('0x22')]||null:null,'include':_0x547755['options']?_0x547755[_0xbccc('0x1f')][_0xbccc('0x23')]?_['map'](_0x547755[_0xbccc('0x1f')][_0xbccc('0x23')],function(_0x1a6e92){return{'model':db[_0x1a6e92['model']],'as':_0x1a6e92['as'],'attributes':_0x1a6e92[_0xbccc('0x22')],'include':_0x1a6e92[_0xbccc('0x23')]?_[_0xbccc('0x24')](_0x1a6e92['include'],function(_0x20c6fd){return{'model':db[_0x20c6fd[_0xbccc('0x25')]],'as':_0x20c6fd['as'],'attributes':_0x20c6fd[_0xbccc('0x22')],'include':_0x20c6fd[_0xbccc('0x23')]?_[_0xbccc('0x24')](_0x20c6fd[_0xbccc('0x23')],function(_0x1df68d){return{'model':db[_0x1df68d[_0xbccc('0x25')]],'as':_0x1df68d['as'],'attributes':_0x1df68d[_0xbccc('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbccc('0x11')](function(_0x2306d1){logger[_0xbccc('0x12')](_0xbccc('0x26'),_0x547755);logger[_0xbccc('0x15')](_0xbccc('0x26'),_0x547755,JSON['stringify'](_0x2306d1));_0x178b2d(_0x2306d1);})['catch'](function(_0x39f0fa){logger[_0xbccc('0x18')](_0xbccc('0x26'),_0x39f0fa[_0xbccc('0x1a')],_0x547755);_0x366d64(_0x42cdf8[_0xbccc('0x18')](0x1f4,_0x39f0fa['message']));});});}; \ No newline at end of file +var _0x187c=['http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsAccount,\x20%s,\x20%s','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x595aad,_0x535031){var _0x3140f6=function(_0x26e97f){while(--_0x26e97f){_0x595aad['push'](_0x595aad['shift']());}};_0x3140f6(++_0x535031);}(_0x187c,0x1be));var _0xc187=function(_0x3d4643,_0x11ee58){_0x3d4643=_0x3d4643-0x0;var _0x1d139e=_0x187c[_0x3d4643];return _0x1d139e;};'use strict';var _=require(_0xc187('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc187('0x1'));var fs=require('fs');var Redis=require(_0xc187('0x2'));var db=require(_0xc187('0x3'))['db'];var utils=require(_0xc187('0x4'));var logger=require(_0xc187('0x5'))('rpc');var config=require(_0xc187('0x6'));var jayson=require(_0xc187('0x7'));var client=jayson[_0xc187('0x8')][_0xc187('0x9')]({'port':0x232a});config['redis']=_[_0xc187('0xa')](config[_0xc187('0xb')],{'host':_0xc187('0xc'),'port':0x18eb});var socket=require(_0xc187('0xd'))(new Redis(config[_0xc187('0xb')]));require(_0xc187('0xe'))['register'](socket);function respondWithRpcPromise(_0x36551c,_0x22a0c3,_0x13fb5a){return new BPromise(function(_0x281523,_0x4acb12){return client[_0xc187('0xf')](_0x36551c,_0x13fb5a)[_0xc187('0x10')](function(_0x36dead){logger[_0xc187('0x11')]('SmsAccount,\x20%s,\x20%s',_0x22a0c3,'request\x20sent');logger[_0xc187('0x12')](_0xc187('0x13'),_0x22a0c3,_0xc187('0x14'),JSON[_0xc187('0x15')](_0x36dead));if(_0x36dead['error']){if(_0x36dead['error']['code']===0x1f4){logger[_0xc187('0x16')]('SmsAccount,\x20%s,\x20%s',_0x22a0c3,_0x36dead[_0xc187('0x16')][_0xc187('0x17')]);return _0x4acb12(_0x36dead[_0xc187('0x16')][_0xc187('0x17')]);}logger[_0xc187('0x16')]('SmsAccount,\x20%s,\x20%s',_0x22a0c3,_0x36dead[_0xc187('0x16')][_0xc187('0x17')]);return _0x281523(_0x36dead[_0xc187('0x16')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x22a0c3,_0xc187('0x14'));_0x281523(_0x36dead['result'][_0xc187('0x17')]);}})['catch'](function(_0x5552a5){logger['error'](_0xc187('0x18'),_0x22a0c3,_0x5552a5);_0x4acb12(_0x5552a5);});});}exports[_0xc187('0x19')]=function(_0x588915){var _0x3160f1=this;return new Promise(function(_0x242805,_0x35411e){return db[_0xc187('0x1a')][_0xc187('0x1b')]({'raw':_0x588915[_0xc187('0x1c')]?_0x588915[_0xc187('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x588915['options']?_0x588915[_0xc187('0x1c')][_0xc187('0x1d')]||null:null,'attributes':_0x588915[_0xc187('0x1c')]?_0x588915[_0xc187('0x1c')][_0xc187('0x1e')]||null:null,'include':_0x588915[_0xc187('0x1c')]?_0x588915[_0xc187('0x1c')][_0xc187('0x1f')]?_[_0xc187('0x20')](_0x588915[_0xc187('0x1c')][_0xc187('0x1f')],function(_0x2ee9ea){return{'model':db[_0x2ee9ea[_0xc187('0x21')]],'as':_0x2ee9ea['as'],'attributes':_0x2ee9ea[_0xc187('0x1e')],'include':_0x2ee9ea[_0xc187('0x1f')]?_['map'](_0x2ee9ea['include'],function(_0x51a4d4){return{'model':db[_0x51a4d4[_0xc187('0x21')]],'as':_0x51a4d4['as'],'attributes':_0x51a4d4[_0xc187('0x1e')],'include':_0x51a4d4['include']?_[_0xc187('0x20')](_0x51a4d4['include'],function(_0x205fd8){return{'model':db[_0x205fd8[_0xc187('0x21')]],'as':_0x205fd8['as'],'attributes':_0x205fd8[_0xc187('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc187('0x10')](function(_0x10292a){logger[_0xc187('0x11')](_0xc187('0x19'),_0x588915);logger['debug'](_0xc187('0x19'),_0x588915,JSON['stringify'](_0x10292a));_0x242805(_0x10292a);})[_0xc187('0x22')](function(_0x1df78c){logger[_0xc187('0x16')](_0xc187('0x19'),_0x1df78c[_0xc187('0x17')],_0x588915);_0x35411e(_0x3160f1[_0xc187('0x16')](0x1f4,_0x1df78c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7a4e942..595af56 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 573eec9..dacf8cb 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x9d1102,_0x5c55c9){var _0x2c668e=function(_0x4ed3ba){while(--_0x4ed3ba){_0x9d1102['push'](_0x9d1102['shift']());}};_0x2c668e(++_0x5c55c9);}(_0x3e74,0x175));var _0x43e7=function(_0x2f10aa,_0x40f519){_0x2f10aa=_0x2f10aa-0x0;var _0xa7dc31=_0x3e74[_0x2f10aa];return _0xa7dc31;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x306646,_0xdc2e1b){var _0x40bd8d=function(_0x397d05){while(--_0x397d05){_0x306646['push'](_0x306646['shift']());}};_0x40bd8d(++_0xdc2e1b);}(_0x3e74,0x175));var _0x43e7=function(_0x126aa6,_0x372048){_0x126aa6=_0x126aa6-0x0;var _0x16a90a=_0x3e74[_0x126aa6];return _0x16a90a;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index bba0ffb..00b186b 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 _0x1692=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1692,0x1e7));var _0x2169=function(_0x599be2,_0x101b71){_0x599be2=_0x599be2-0x0;var _0x13dba4=_0x1692[_0x599be2];return _0x13dba4;};'use strict';var Sequelize=require(_0x2169('0x0'));module[_0x2169('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2169('0x2')},'appdata':{'type':Sequelize[_0x2169('0x3')]()},'description':{'type':Sequelize[_0x2169('0x4')]},'interval':{'type':Sequelize[_0x2169('0x4')],'defaultValue':_0x2169('0x5')}}; \ No newline at end of file +var _0x3a8b=['STRING','noop','TEXT','sequelize','exports'];(function(_0x16aa3f,_0xadb524){var _0x3a98e8=function(_0x1c7cc8){while(--_0x1c7cc8){_0x16aa3f['push'](_0x16aa3f['shift']());}};_0x3a98e8(++_0xadb524);}(_0x3a8b,0x9e));var _0xb3a8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x3a8b[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0xb3a8('0x0'));module[_0xb3a8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb3a8('0x2')],'allowNull':![],'defaultValue':_0xb3a8('0x3')},'appdata':{'type':Sequelize[_0xb3a8('0x4')]()},'description':{'type':Sequelize[_0xb3a8('0x2')]},'interval':{'type':Sequelize[_0xb3a8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 24a8f8e..a1c1aae 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 _0xe77e=['api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','send','index','fieldName','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','SmsApplication','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','eml-format','zip-dir','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2bb9d6,_0x3e1050){var _0x48e0b4=function(_0x1f4c60){while(--_0x1f4c60){_0x2bb9d6['push'](_0x2bb9d6['shift']());}};_0x48e0b4(++_0x3e1050);}(_0xe77e,0xca));var _0xee77=function(_0x1b1bfd,_0x567608){_0x1b1bfd=_0x1b1bfd-0x0;var _0x1fc165=_0xe77e[_0x1b1bfd];return _0x1fc165;};'use strict';var emlformat=require(_0xee77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee77('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee77('0x3'));var path=require('path');var sox=require(_0xee77('0x4'));var csv=require(_0xee77('0x5'));var ejs=require(_0xee77('0x6'));var fs=require('fs');var fs_extra=require(_0xee77('0x7'));var _=require(_0xee77('0x8'));var squel=require(_0xee77('0x9'));var crypto=require(_0xee77('0xa'));var jsforce=require(_0xee77('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee77('0x5'));var querystring=require(_0xee77('0xc'));var Papa=require(_0xee77('0xd'));var Redis=require(_0xee77('0xe'));var authService=require(_0xee77('0xf'));var qs=require(_0xee77('0x10'));var as=require(_0xee77('0x11'));var hardwareService=require(_0xee77('0x12'));var logger=require(_0xee77('0x13'))(_0xee77('0x14'));var utils=require(_0xee77('0x15'));var config=require(_0xee77('0x16'));var licenseUtil=require(_0xee77('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2899e5,_0x2ee7fe){_0x2ee7fe=_0x2ee7fe||0xcc;return function(_0x5ad7b2){if(_0x5ad7b2){return _0x2899e5['sendStatus'](_0x2ee7fe);}return _0x2899e5[_0xee77('0x18')](_0x2ee7fe)[_0xee77('0x19')]();};}function respondWithResult(_0x20e985,_0x3ae5fa){_0x3ae5fa=_0x3ae5fa||0xc8;return function(_0x3baaa2){if(_0x3baaa2){return _0x20e985[_0xee77('0x18')](_0x3ae5fa)[_0xee77('0x1a')](_0x3baaa2);}};}function respondWithFilteredResult(_0x40e7ec,_0x268764){return function(_0x592a90){if(_0x592a90){var _0x22a15f=typeof _0x268764[_0xee77('0x1b')]===_0xee77('0x1c')&&typeof _0x268764[_0xee77('0x1d')]===_0xee77('0x1c');var _0x458fab=_0x592a90[_0xee77('0x1e')];var _0x3339d5=_0x22a15f?0x0:_0x268764[_0xee77('0x1b')];var _0x2df20c=_0x22a15f?_0x592a90['count']:_0x268764['offset']+_0x268764['limit'];var _0xe045bf;if(_0x2df20c>=_0x458fab){_0x2df20c=_0x458fab;_0xe045bf=0xc8;}else{_0xe045bf=0xce;}_0x40e7ec[_0xee77('0x18')](_0xe045bf);return _0x40e7ec['set'](_0xee77('0x1f'),_0x3339d5+'-'+_0x2df20c+'/'+_0x458fab)[_0xee77('0x1a')](_0x592a90);}return null;};}function patchUpdates(_0x2efb3c){return function(_0x12b52f){try{jsonpatch[_0xee77('0x20')](_0x12b52f,_0x2efb3c,!![]);}catch(_0x15e98b){return BPromise[_0xee77('0x21')](_0x15e98b);}return _0x12b52f[_0xee77('0x22')]();};}function saveUpdates(_0x1cc44b,_0x42fced){return function(_0x22ca34){if(_0x22ca34){return _0x22ca34[_0xee77('0x23')](_0x1cc44b)[_0xee77('0x24')](function(_0xb901fb){return _0xb901fb;});}return null;};}function removeEntity(_0xf87a9a,_0x5376bb){return function(_0x50d983){if(_0x50d983){return _0x50d983[_0xee77('0x25')]()[_0xee77('0x24')](function(){_0xf87a9a[_0xee77('0x18')](0xcc)[_0xee77('0x19')]();});}};}function handleEntityNotFound(_0x1d6911,_0x1d38e4){return function(_0x2e1449){if(!_0x2e1449){_0x1d6911[_0xee77('0x26')](0x194);}return _0x2e1449;};}function handleError(_0x5b3a6f,_0x452d0c){_0x452d0c=_0x452d0c||0x1f4;return function(_0x4167f7){logger[_0xee77('0x27')](_0x4167f7['stack']);if(_0x4167f7['name']){delete _0x4167f7['name'];}_0x5b3a6f[_0xee77('0x18')](_0x452d0c)[_0xee77('0x28')](_0x4167f7);};}exports[_0xee77('0x29')]=function(_0xa2590f,_0x4c5086){var _0x36cd43={},_0x1684af={},_0x3d423b={'count':0x0,'rows':[]};var _0x10caa1=_['map'](db['SmsApplication']['rawAttributes'],function(_0x312eba){return{'name':_0x312eba[_0xee77('0x2a')],'type':_0x312eba['type'][_0xee77('0x2b')]};});_0x1684af[_0xee77('0x2c')]=_[_0xee77('0x2d')](_0x10caa1,_0xee77('0x2e'));_0x1684af[_0xee77('0x2f')]=_[_0xee77('0x30')](_0xa2590f[_0xee77('0x2f')]);_0x1684af['filters']=_[_0xee77('0x31')](_0x1684af['model'],_0x1684af['query']);_0x36cd43[_0xee77('0x32')]=_[_0xee77('0x31')](_0x1684af['model'],qs['fields'](_0xa2590f[_0xee77('0x2f')][_0xee77('0x33')]));_0x36cd43[_0xee77('0x32')]=_0x36cd43['attributes']['length']?_0x36cd43[_0xee77('0x32')]:_0x1684af['model'];if(!_0xa2590f[_0xee77('0x2f')][_0xee77('0x34')](_0xee77('0x35'))){_0x36cd43[_0xee77('0x1d')]=qs['limit'](_0xa2590f[_0xee77('0x2f')][_0xee77('0x1d')]);_0x36cd43[_0xee77('0x1b')]=qs[_0xee77('0x1b')](_0xa2590f[_0xee77('0x2f')][_0xee77('0x1b')]);}_0x36cd43[_0xee77('0x36')]=qs['sort'](_0xa2590f[_0xee77('0x2f')]['sort']);_0x36cd43[_0xee77('0x37')]=qs['filters'](_[_0xee77('0x38')](_0xa2590f[_0xee77('0x2f')],_0x1684af[_0xee77('0x39')]),_0x10caa1);if(_0xa2590f[_0xee77('0x2f')][_0xee77('0x3a')]){_0x36cd43['where']=_[_0xee77('0x3b')](_0x36cd43[_0xee77('0x37')],{'$or':_[_0xee77('0x2d')](_0x10caa1,function(_0x47426e){if(_0x47426e['type']!==_0xee77('0x3c')){var _0x3eeddf={};_0x3eeddf[_0x47426e[_0xee77('0x2e')]]={'$like':'%'+_0xa2590f[_0xee77('0x2f')]['filter']+'%'};return _0x3eeddf;}})});}_0x36cd43=_[_0xee77('0x3b')]({},_0x36cd43,_0xa2590f['options']);var _0x45f614={'where':_0x36cd43[_0xee77('0x37')]};return db[_0xee77('0x3d')][_0xee77('0x1e')](_0x45f614)[_0xee77('0x24')](function(_0x57f3f0){_0x3d423b['count']=_0x57f3f0;if(_0xa2590f[_0xee77('0x2f')][_0xee77('0x3e')]){_0x36cd43[_0xee77('0x3f')]=[{'all':!![]}];}return db[_0xee77('0x3d')][_0xee77('0x40')](_0x36cd43);})[_0xee77('0x24')](function(_0x46888c){_0x3d423b[_0xee77('0x41')]=_0x46888c;return _0x3d423b;})[_0xee77('0x24')](respondWithFilteredResult(_0x4c5086,_0x36cd43))[_0xee77('0x42')](handleError(_0x4c5086,null));};exports['show']=function(_0x4865ea,_0x36d5c1){var _0x507ae6={'raw':!![],'where':{'id':_0x4865ea[_0xee77('0x43')]['id']}},_0xa22471={};_0xa22471[_0xee77('0x2c')]=_['keys'](db['SmsApplication'][_0xee77('0x44')]);_0xa22471['query']=_[_0xee77('0x30')](_0x4865ea[_0xee77('0x2f')]);_0xa22471['filters']=_[_0xee77('0x31')](_0xa22471[_0xee77('0x2c')],_0xa22471[_0xee77('0x2f')]);_0x507ae6[_0xee77('0x32')]=_[_0xee77('0x31')](_0xa22471[_0xee77('0x2c')],qs[_0xee77('0x33')](_0x4865ea[_0xee77('0x2f')][_0xee77('0x33')]));_0x507ae6[_0xee77('0x32')]=_0x507ae6['attributes'][_0xee77('0x45')]?_0x507ae6[_0xee77('0x32')]:_0xa22471[_0xee77('0x2c')];if(_0x4865ea['query']['includeAll']){_0x507ae6[_0xee77('0x3f')]=[{'all':!![]}];}_0x507ae6=_[_0xee77('0x3b')]({},_0x507ae6,_0x4865ea[_0xee77('0x46')]);return db[_0xee77('0x3d')][_0xee77('0x47')](_0x507ae6)[_0xee77('0x24')](handleEntityNotFound(_0x36d5c1,null))[_0xee77('0x24')](respondWithResult(_0x36d5c1,null))[_0xee77('0x42')](handleError(_0x36d5c1,null));};exports[_0xee77('0x48')]=function(_0x22915a,_0x413c9d){return db['SmsApplication'][_0xee77('0x48')](_0x22915a[_0xee77('0x49')],{})[_0xee77('0x24')](respondWithResult(_0x413c9d,0xc9))['catch'](handleError(_0x413c9d,null));};exports[_0xee77('0x23')]=function(_0x146fe6,_0x2367cd){if(_0x146fe6[_0xee77('0x49')]['id']){delete _0x146fe6[_0xee77('0x49')]['id'];}return db[_0xee77('0x3d')][_0xee77('0x47')]({'where':{'id':_0x146fe6[_0xee77('0x43')]['id']}})['then'](handleEntityNotFound(_0x2367cd,null))[_0xee77('0x24')](saveUpdates(_0x146fe6[_0xee77('0x49')],null))[_0xee77('0x24')](respondWithResult(_0x2367cd,null))[_0xee77('0x42')](handleError(_0x2367cd,null));};exports[_0xee77('0x25')]=function(_0x3a2a44,_0x206014){return db[_0xee77('0x3d')][_0xee77('0x47')]({'where':{'id':_0x3a2a44['params']['id']}})[_0xee77('0x24')](handleEntityNotFound(_0x206014,null))[_0xee77('0x24')](removeEntity(_0x206014,null))['catch'](handleError(_0x206014,null));}; \ No newline at end of file +var _0x21cf=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','create','body','find','params','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x1f69b9,_0x5ae69a){var _0xf13c03=function(_0x40133f){while(--_0x40133f){_0x1f69b9['push'](_0x1f69b9['shift']());}};_0xf13c03(++_0x5ae69a);}(_0x21cf,0xab));var _0xf21c=function(_0x3613d9,_0x266ce5){_0x3613d9=_0x3613d9-0x0;var _0x376f9a=_0x21cf[_0x3613d9];return _0x376f9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf21c('0x0'));var zipdir=require(_0xf21c('0x1'));var jsonpatch=require(_0xf21c('0x2'));var rp=require('request-promise');var moment=require(_0xf21c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf21c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf21c('0x5'));var csv=require(_0xf21c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf21c('0x7'));var _=require('lodash');var squel=require(_0xf21c('0x8'));var crypto=require(_0xf21c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf21c('0xa'));var toCsv=require(_0xf21c('0x6'));var querystring=require(_0xf21c('0xb'));var Papa=require(_0xf21c('0xc'));var Redis=require(_0xf21c('0xd'));var authService=require(_0xf21c('0xe'));var qs=require(_0xf21c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf21c('0x10'))(_0xf21c('0x11'));var utils=require(_0xf21c('0x12'));var config=require(_0xf21c('0x13'));var licenseUtil=require(_0xf21c('0x14'));var db=require(_0xf21c('0x15'))['db'];function respondWithStatusCode(_0x1d911d,_0x3a2a20){_0x3a2a20=_0x3a2a20||0xcc;return function(_0x12cfb6){if(_0x12cfb6){return _0x1d911d[_0xf21c('0x16')](_0x3a2a20);}return _0x1d911d[_0xf21c('0x17')](_0x3a2a20)[_0xf21c('0x18')]();};}function respondWithResult(_0x5128ba,_0x59b512){_0x59b512=_0x59b512||0xc8;return function(_0x4fef5a){if(_0x4fef5a){return _0x5128ba[_0xf21c('0x17')](_0x59b512)[_0xf21c('0x19')](_0x4fef5a);}};}function respondWithFilteredResult(_0x2794ff,_0x39dd91){return function(_0x68123f){if(_0x68123f){var _0x3a680d=typeof _0x39dd91[_0xf21c('0x1a')]===_0xf21c('0x1b')&&typeof _0x39dd91[_0xf21c('0x1c')]===_0xf21c('0x1b');var _0x45bea6=_0x68123f[_0xf21c('0x1d')];var _0x339c2d=_0x3a680d?0x0:_0x39dd91['offset'];var _0x4af461=_0x3a680d?_0x68123f[_0xf21c('0x1d')]:_0x39dd91[_0xf21c('0x1a')]+_0x39dd91[_0xf21c('0x1c')];var _0x4a6af2;if(_0x4af461>=_0x45bea6){_0x4af461=_0x45bea6;_0x4a6af2=0xc8;}else{_0x4a6af2=0xce;}_0x2794ff[_0xf21c('0x17')](_0x4a6af2);return _0x2794ff[_0xf21c('0x1e')](_0xf21c('0x1f'),_0x339c2d+'-'+_0x4af461+'/'+_0x45bea6)[_0xf21c('0x19')](_0x68123f);}return null;};}function patchUpdates(_0x4e2c61){return function(_0x37c5e1){try{jsonpatch['apply'](_0x37c5e1,_0x4e2c61,!![]);}catch(_0x254484){return BPromise['reject'](_0x254484);}return _0x37c5e1[_0xf21c('0x20')]();};}function saveUpdates(_0x422d0f,_0x203427){return function(_0x1232f3){if(_0x1232f3){return _0x1232f3[_0xf21c('0x21')](_0x422d0f)[_0xf21c('0x22')](function(_0x372a42){return _0x372a42;});}return null;};}function removeEntity(_0x185290,_0x15d8b6){return function(_0x1369e5){if(_0x1369e5){return _0x1369e5[_0xf21c('0x23')]()[_0xf21c('0x22')](function(){_0x185290[_0xf21c('0x17')](0xcc)[_0xf21c('0x18')]();});}};}function handleEntityNotFound(_0x45a2bc,_0x48eab0){return function(_0x31dfa9){if(!_0x31dfa9){_0x45a2bc[_0xf21c('0x16')](0x194);}return _0x31dfa9;};}function handleError(_0x5c5d5d,_0x5bdf98){_0x5bdf98=_0x5bdf98||0x1f4;return function(_0x1c38d9){logger[_0xf21c('0x24')](_0x1c38d9['stack']);if(_0x1c38d9['name']){delete _0x1c38d9['name'];}_0x5c5d5d['status'](_0x5bdf98)[_0xf21c('0x25')](_0x1c38d9);};}exports[_0xf21c('0x26')]=function(_0x100b86,_0xb2e277){var _0x585d87={},_0x255627={},_0xdc1900={'count':0x0,'rows':[]};var _0x15f713=_[_0xf21c('0x27')](db[_0xf21c('0x28')][_0xf21c('0x29')],function(_0x1fb0f8){return{'name':_0x1fb0f8[_0xf21c('0x2a')],'type':_0x1fb0f8[_0xf21c('0x2b')][_0xf21c('0x2c')]};});_0x255627[_0xf21c('0x2d')]=_[_0xf21c('0x27')](_0x15f713,_0xf21c('0x2e'));_0x255627[_0xf21c('0x2f')]=_[_0xf21c('0x30')](_0x100b86['query']);_0x255627['filters']=_[_0xf21c('0x31')](_0x255627['model'],_0x255627['query']);_0x585d87[_0xf21c('0x32')]=_[_0xf21c('0x31')](_0x255627['model'],qs[_0xf21c('0x33')](_0x100b86[_0xf21c('0x2f')][_0xf21c('0x33')]));_0x585d87[_0xf21c('0x32')]=_0x585d87[_0xf21c('0x32')][_0xf21c('0x34')]?_0x585d87[_0xf21c('0x32')]:_0x255627[_0xf21c('0x2d')];if(!_0x100b86[_0xf21c('0x2f')][_0xf21c('0x35')](_0xf21c('0x36'))){_0x585d87[_0xf21c('0x1c')]=qs['limit'](_0x100b86[_0xf21c('0x2f')][_0xf21c('0x1c')]);_0x585d87['offset']=qs[_0xf21c('0x1a')](_0x100b86[_0xf21c('0x2f')][_0xf21c('0x1a')]);}_0x585d87[_0xf21c('0x37')]=qs['sort'](_0x100b86[_0xf21c('0x2f')][_0xf21c('0x38')]);_0x585d87[_0xf21c('0x39')]=qs[_0xf21c('0x3a')](_['pick'](_0x100b86['query'],_0x255627[_0xf21c('0x3a')]),_0x15f713);if(_0x100b86['query'][_0xf21c('0x3b')]){_0x585d87[_0xf21c('0x39')]=_[_0xf21c('0x3c')](_0x585d87[_0xf21c('0x39')],{'$or':_[_0xf21c('0x27')](_0x15f713,function(_0x48cccd){if(_0x48cccd[_0xf21c('0x2b')]!==_0xf21c('0x3d')){var _0x3a5f3a={};_0x3a5f3a[_0x48cccd[_0xf21c('0x2e')]]={'$like':'%'+_0x100b86[_0xf21c('0x2f')][_0xf21c('0x3b')]+'%'};return _0x3a5f3a;}})});}_0x585d87=_[_0xf21c('0x3c')]({},_0x585d87,_0x100b86['options']);var _0x4d89fb={'where':_0x585d87[_0xf21c('0x39')]};return db[_0xf21c('0x28')][_0xf21c('0x1d')](_0x4d89fb)['then'](function(_0xa3745){_0xdc1900[_0xf21c('0x1d')]=_0xa3745;if(_0x100b86[_0xf21c('0x2f')]['includeAll']){_0x585d87[_0xf21c('0x3e')]=[{'all':!![]}];}return db[_0xf21c('0x28')][_0xf21c('0x3f')](_0x585d87);})[_0xf21c('0x22')](function(_0x5aa362){_0xdc1900[_0xf21c('0x40')]=_0x5aa362;return _0xdc1900;})[_0xf21c('0x22')](respondWithFilteredResult(_0xb2e277,_0x585d87))[_0xf21c('0x41')](handleError(_0xb2e277,null));};exports[_0xf21c('0x42')]=function(_0x653083,_0x4c6e51){var _0x189856={'raw':!![],'where':{'id':_0x653083['params']['id']}},_0x5434b8={};_0x5434b8[_0xf21c('0x2d')]=_[_0xf21c('0x30')](db[_0xf21c('0x28')]['rawAttributes']);_0x5434b8[_0xf21c('0x2f')]=_['keys'](_0x653083[_0xf21c('0x2f')]);_0x5434b8[_0xf21c('0x3a')]=_[_0xf21c('0x31')](_0x5434b8['model'],_0x5434b8[_0xf21c('0x2f')]);_0x189856['attributes']=_['intersection'](_0x5434b8[_0xf21c('0x2d')],qs[_0xf21c('0x33')](_0x653083['query'][_0xf21c('0x33')]));_0x189856[_0xf21c('0x32')]=_0x189856[_0xf21c('0x32')][_0xf21c('0x34')]?_0x189856[_0xf21c('0x32')]:_0x5434b8[_0xf21c('0x2d')];if(_0x653083[_0xf21c('0x2f')][_0xf21c('0x43')]){_0x189856[_0xf21c('0x3e')]=[{'all':!![]}];}_0x189856=_[_0xf21c('0x3c')]({},_0x189856,_0x653083[_0xf21c('0x44')]);return db[_0xf21c('0x28')]['find'](_0x189856)[_0xf21c('0x22')](handleEntityNotFound(_0x4c6e51,null))[_0xf21c('0x22')](respondWithResult(_0x4c6e51,null))[_0xf21c('0x41')](handleError(_0x4c6e51,null));};exports[_0xf21c('0x45')]=function(_0x54e2ee,_0x1ae848){return db['SmsApplication'][_0xf21c('0x45')](_0x54e2ee[_0xf21c('0x46')],{})[_0xf21c('0x22')](respondWithResult(_0x1ae848,0xc9))['catch'](handleError(_0x1ae848,null));};exports[_0xf21c('0x21')]=function(_0x5f4a14,_0x408cb8){if(_0x5f4a14[_0xf21c('0x46')]['id']){delete _0x5f4a14[_0xf21c('0x46')]['id'];}return db[_0xf21c('0x28')][_0xf21c('0x47')]({'where':{'id':_0x5f4a14[_0xf21c('0x48')]['id']}})[_0xf21c('0x22')](handleEntityNotFound(_0x408cb8,null))[_0xf21c('0x22')](saveUpdates(_0x5f4a14[_0xf21c('0x46')],null))[_0xf21c('0x22')](respondWithResult(_0x408cb8,null))[_0xf21c('0x41')](handleError(_0x408cb8,null));};exports['destroy']=function(_0x15ecc7,_0x511f53){return db['SmsApplication'][_0xf21c('0x47')]({'where':{'id':_0x15ecc7['params']['id']}})['then'](handleEntityNotFound(_0x511f53,null))[_0xf21c('0x22')](removeEntity(_0x511f53,null))[_0xf21c('0x41')](handleError(_0x511f53,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index be1bbf9..f820611 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 _0xc15b=['moment','bluebird','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','lodash','../../config/logger','api'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xc15b,0xe4));var _0xbc15=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xc15b[_0x35da42];return _0x370035;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var logger=require(_0xbc15('0x1'))(_0xbc15('0x2'));var moment=require(_0xbc15('0x3'));var BPromise=require(_0xbc15('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc15('0x5'));var config=require(_0xbc15('0x6'));var attributes=require(_0xbc15('0x7'));module['exports']=function(_0x55885f,_0x54f394){return _0x55885f[_0xbc15('0x8')](_0xbc15('0x9'),attributes,{'tableName':_0xbc15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5e6d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','lodash'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x5e6d,0x1e9));var _0xd5e6=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x5e6d[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0xd5e6('0x0'));var util=require(_0xd5e6('0x1'));var logger=require(_0xd5e6('0x2'))(_0xd5e6('0x3'));var moment=require(_0xd5e6('0x4'));var BPromise=require(_0xd5e6('0x5'));var rp=require(_0xd5e6('0x6'));var fs=require('fs');var path=require(_0xd5e6('0x7'));var rimraf=require(_0xd5e6('0x8'));var config=require(_0xd5e6('0x9'));var attributes=require(_0xd5e6('0xa'));module['exports']=function(_0x9ab464,_0x23d6e1){return _0x9ab464['define'](_0xd5e6('0xb'),attributes,{'tableName':_0xd5e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd5e6('0xd'),'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 d687591..2496cb6 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 _0xd2f5=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','stringify','error','code','SmsApplication,\x20%s,\x20%s','message'];(function(_0x514c23,_0x2453d0){var _0x46a240=function(_0xb443d7){while(--_0xb443d7){_0x514c23['push'](_0x514c23['shift']());}};_0x46a240(++_0x2453d0);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x2946cf,_0x1114b5){_0x2946cf=_0x2946cf-0x0;var _0x3243f8=_0xd2f5[_0x2946cf];return _0x3243f8;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d2f('0x8')][_0x5d2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf53b,_0x57673f,_0x3062bf){return new BPromise(function(_0x72bf9f,_0x330195){return client['request'](_0xbf53b,_0x3062bf)['then'](function(_0x43293d){logger[_0x5d2f('0xa')]('SmsApplication,\x20%s,\x20%s',_0x57673f,_0x5d2f('0xb'));logger[_0x5d2f('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x57673f,'request\x20sent',JSON[_0x5d2f('0xd')](_0x43293d));if(_0x43293d[_0x5d2f('0xe')]){if(_0x43293d['error'][_0x5d2f('0xf')]===0x1f4){logger[_0x5d2f('0xe')](_0x5d2f('0x10'),_0x57673f,_0x43293d[_0x5d2f('0xe')][_0x5d2f('0x11')]);return _0x330195(_0x43293d[_0x5d2f('0xe')][_0x5d2f('0x11')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x57673f,_0x43293d['error']['message']);return _0x72bf9f(_0x43293d[_0x5d2f('0xe')]['message']);}else{logger[_0x5d2f('0xa')](_0x5d2f('0x10'),_0x57673f,_0x5d2f('0xb'));_0x72bf9f(_0x43293d[_0x5d2f('0x12')]['message']);}})[_0x5d2f('0x13')](function(_0x875750){logger['error'](_0x5d2f('0x10'),_0x57673f,_0x875750);_0x330195(_0x875750);});});} \ No newline at end of file +var _0xbca0=['stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0xbca0,0x8b));var _0x0bca=function(_0x3da912,_0x40d8ae){_0x3da912=_0x3da912-0x0;var _0x569755=_0xbca0[_0x3da912];return _0x569755;};'use strict';var _=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bca('0x2'));var db=require(_0x0bca('0x3'))['db'];var utils=require(_0x0bca('0x4'));var logger=require(_0x0bca('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0bca('0x6'));var client=jayson[_0x0bca('0x7')][_0x0bca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x454627,_0x4dcba6,_0x48260c){return new BPromise(function(_0x55fbf0,_0x241ca5){return client[_0x0bca('0x9')](_0x454627,_0x48260c)[_0x0bca('0xa')](function(_0x206194){logger[_0x0bca('0xb')]('SmsApplication,\x20%s,\x20%s',_0x4dcba6,'request\x20sent');logger[_0x0bca('0xc')](_0x0bca('0xd'),_0x4dcba6,_0x0bca('0xe'),JSON[_0x0bca('0xf')](_0x206194));if(_0x206194[_0x0bca('0x10')]){if(_0x206194[_0x0bca('0x10')][_0x0bca('0x11')]===0x1f4){logger[_0x0bca('0x10')](_0x0bca('0x12'),_0x4dcba6,_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);return _0x241ca5(_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);}logger[_0x0bca('0x10')](_0x0bca('0x12'),_0x4dcba6,_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);return _0x55fbf0(_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);}else{logger['info'](_0x0bca('0x12'),_0x4dcba6,_0x0bca('0xe'));_0x55fbf0(_0x206194[_0x0bca('0x14')][_0x0bca('0x13')]);}})[_0x0bca('0x15')](function(_0x2ed970){logger[_0x0bca('0x10')]('SmsApplication,\x20%s,\x20%s',_0x4dcba6,_0x2ed970);_0x241ca5(_0x2ed970);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 0cf1a55..7f3175a 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 _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x313535,_0x28e960){var _0x48c033=function(_0x543de2){while(--_0x543de2){_0x313535['push'](_0x313535['shift']());}};_0x48c033(++_0x28e960);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file +var _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x3c8fc7,_0x2eaa2c){var _0x2bf49e=function(_0x2dd676){while(--_0x2dd676){_0x3c8fc7['push'](_0x3c8fc7['shift']());}};_0x2bf49e(++_0x2eaa2c);}(_0x13f6,0x124));var _0x613f=function(_0x415280,_0x28ea89){_0x415280=_0x415280-0x0;var _0x40ee89=_0x13f6[_0x415280];return _0x40ee89;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);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 d648ee7..0b07523 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 _0x45c2=['STRING','DATE','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x552544,_0x110fd2){var _0x25f09f=function(_0x718046){while(--_0x718046){_0x552544['push'](_0x552544['shift']());}};_0x25f09f(++_0x110fd2);}(_0x45c2,0x68));var _0x245c=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x45c2[_0x4b4f24];return _0x1c13d4;};'use strict';var Sequelize=require(_0x245c('0x0'));var moment=require(_0x245c('0x1'));module[_0x245c('0x2')]={'closed':{'type':Sequelize[_0x245c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x245c('0x4')]},'secondDisposition':{'type':Sequelize[_0x245c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x245c('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x245c('0x4')]},'read1stAt':{'type':Sequelize[_0x245c('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x245c('0x6')]('in',_0x245c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x245c('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x245c('0x6')]('in',_0x245c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x245c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x245c('0x8')]}}; \ No newline at end of file +var _0xc19f=['BOOLEAN','STRING','DATE','ENUM','out','INTEGER','exports'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xc19f,0x164));var _0xfc19=function(_0x88d45a,_0x521cee){_0x88d45a=_0x88d45a-0x0;var _0x3d9ed2=_0xc19f[_0x88d45a];return _0x3d9ed2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xfc19('0x0')]={'closed':{'type':Sequelize[_0xfc19('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfc19('0x2')]},'thirdDisposition':{'type':Sequelize[_0xfc19('0x2')]},'note':{'type':Sequelize[_0xfc19('0x2')]},'phone':{'type':Sequelize[_0xfc19('0x2')]},'read1stAt':{'type':Sequelize[_0xfc19('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfc19('0x4')]('in',_0xfc19('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfc19('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfc19('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 8dc30a0..4677ba4 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 _0xf98e=['filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','describe','addMessage','SmsMessage','ids','omit','findOne','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','Messages','createdAt','direction','secret','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','format','closed','closedAt','map','out','System','firstName','lastName','value','views','downloadInteraction.ejs','transcript-','download','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','getOptions','sms','query','user','catch','show','params','model','keys'];(function(_0x32d8a8,_0x1b2e34){var _0x5d8934=function(_0x55dd45){while(--_0x55dd45){_0x32d8a8['push'](_0x32d8a8['shift']());}};_0x5d8934(++_0x1b2e34);}(_0xf98e,0x136));var _0xef98=function(_0x12833e,_0x302abb){_0x12833e=_0x12833e-0x0;var _0xe6208a=_0xf98e[_0x12833e];return _0xe6208a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xef98('0x0'));var moment=require(_0xef98('0x1'));var BPromise=require('bluebird');var util=require(_0xef98('0x2'));var path=require(_0xef98('0x3'));var ejs=require(_0xef98('0x4'));var fs=require('fs');var _=require(_0xef98('0x5'));var Redis=require('ioredis');var interaction=require(_0xef98('0x6'));var qs=require(_0xef98('0x7'));var pdf=require(_0xef98('0x8'));var logger=require(_0xef98('0x9'))(_0xef98('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xef98('0xb')](config[_0xef98('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xef98('0xd'))(new Redis(config[_0xef98('0xc')]));require(_0xef98('0xe'))[_0xef98('0xf')](socket);function respondWithStatusCode(_0x56b3a5,_0x165984){_0x165984=_0x165984||0xcc;return function(_0x3f9556){if(_0x3f9556){return _0x56b3a5['sendStatus'](_0x165984);}return _0x56b3a5[_0xef98('0x10')](_0x165984)['end']();};}function respondWithResult(_0x2a2a28,_0x3fe127){_0x3fe127=_0x3fe127||0xc8;return function(_0x7ad3c4){if(_0x7ad3c4){return _0x2a2a28[_0xef98('0x10')](_0x3fe127)[_0xef98('0x11')](_0x7ad3c4);}};}function respondWithFilteredResult(_0x37ee0b,_0x3575b3){return function(_0x197c09){if(_0x197c09){var _0x1548bb=typeof _0x3575b3[_0xef98('0x12')]===_0xef98('0x13')&&typeof _0x3575b3['limit']===_0xef98('0x13');var _0x569726=_0x197c09[_0xef98('0x14')];var _0x431b80=_0x1548bb?0x0:_0x3575b3[_0xef98('0x12')];var _0x4a9676=_0x1548bb?_0x197c09[_0xef98('0x14')]:_0x3575b3[_0xef98('0x12')]+_0x3575b3[_0xef98('0x15')];var _0x2ac47a;if(_0x4a9676>=_0x569726){_0x4a9676=_0x569726;_0x2ac47a=0xc8;}else{_0x2ac47a=0xce;}_0x37ee0b['status'](_0x2ac47a);return _0x37ee0b[_0xef98('0x16')](_0xef98('0x17'),_0x431b80+'-'+_0x4a9676+'/'+_0x569726)[_0xef98('0x11')](_0x197c09);}return null;};}function saveUpdates(_0x5579b0){return function(_0x4f43d3){if(_0x4f43d3){return _0x4f43d3[_0xef98('0x18')](_0x5579b0)[_0xef98('0x19')](function(_0x5e185e){return _0x5e185e;});}return null;};}function removeEntity(_0x340cf0){return function(_0x4e3ad8){if(_0x4e3ad8){return _0x4e3ad8[_0xef98('0x1a')]()[_0xef98('0x19')](function(){_0x340cf0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x407f80){return function(_0x58bc0f){if(!_0x58bc0f){_0x407f80[_0xef98('0x1b')](0x194);}return _0x58bc0f;};}function handleError(_0x41c8cf,_0x174ba4){_0x174ba4=_0x174ba4||0x1f4;return function(_0x1a046e){logger['error'](_0x1a046e[_0xef98('0x1c')]);if(_0x1a046e[_0xef98('0x1d')]){delete _0x1a046e[_0xef98('0x1d')];}_0x41c8cf[_0xef98('0x10')](_0x174ba4)[_0xef98('0x1e')](_0x1a046e);};}exports[_0xef98('0x1f')]=function(_0x34d691,_0x4a70cc){var _0x1d856b={};var _0x14cee0=_['map'](db[_0xef98('0x20')][_0xef98('0x21')],function(_0x1b2132){return{'name':_0x1b2132[_0xef98('0x22')],'type':_0x1b2132['type']['key']};});_0x1d856b=qs[_0xef98('0x23')](_0x14cee0,_0x34d691);return interaction['findAll'](_0xef98('0x24'),_0x34d691[_0xef98('0x25')],_0x34d691[_0xef98('0x26')],_0x1d856b,_0x14cee0)[_0xef98('0x19')](respondWithFilteredResult(_0x4a70cc,_0x1d856b))[_0xef98('0x27')](handleError(_0x4a70cc,null));};exports[_0xef98('0x28')]=function(_0x1e8d73,_0xea9c66){var _0x1ce2b9={'raw':![],'where':{'id':_0x1e8d73[_0xef98('0x29')]['id']}},_0x9c91ff={};_0x9c91ff[_0xef98('0x2a')]=_['keys'](db[_0xef98('0x20')]['rawAttributes']);_0x9c91ff[_0xef98('0x25')]=_[_0xef98('0x2b')](_0x1e8d73[_0xef98('0x25')]);_0x9c91ff[_0xef98('0x2c')]=_[_0xef98('0x2d')](_0x9c91ff[_0xef98('0x2a')],_0x9c91ff[_0xef98('0x25')]);_0x1ce2b9[_0xef98('0x2e')]=_[_0xef98('0x2d')](_0x9c91ff['model'],qs[_0xef98('0x2f')](_0x1e8d73['query'][_0xef98('0x2f')]));_0x1ce2b9[_0xef98('0x2e')]=_0x1ce2b9['attributes'][_0xef98('0x30')]?_0x1ce2b9[_0xef98('0x2e')]:_0x9c91ff[_0xef98('0x2a')];if(_0x1e8d73[_0xef98('0x25')][_0xef98('0x31')]){_0x1ce2b9[_0xef98('0x32')]=[{'all':!![]}];}_0x1ce2b9=_[_0xef98('0x33')]({},_0x1ce2b9,_0x1e8d73[_0xef98('0x34')]);return db['SmsInteraction'][_0xef98('0x35')](_0x1ce2b9)[_0xef98('0x19')](handleEntityNotFound(_0xea9c66,null))[_0xef98('0x19')](respondWithResult(_0xea9c66,null))[_0xef98('0x27')](handleError(_0xea9c66,null));};exports['create']=function(_0x5ca39f,_0x5558bd){return db[_0xef98('0x20')]['create'](_0x5ca39f['body'],{})[_0xef98('0x19')](respondWithResult(_0x5558bd,0xc9))[_0xef98('0x27')](handleError(_0x5558bd,null));};exports['update']=function(_0x2c13ef,_0x356764){if(_0x2c13ef[_0xef98('0x36')]['id']){delete _0x2c13ef[_0xef98('0x36')]['id'];}return db['SmsInteraction'][_0xef98('0x35')]({'where':{'id':_0x2c13ef['params']['id']}})['then'](handleEntityNotFound(_0x356764,null))[_0xef98('0x19')](saveUpdates(_0x2c13ef['body'],null))[_0xef98('0x19')](respondWithResult(_0x356764,null))[_0xef98('0x27')](handleError(_0x356764,null));};exports[_0xef98('0x1a')]=function(_0x4d83d8,_0x518ab2){return db[_0xef98('0x20')][_0xef98('0x35')]({'where':{'id':_0x4d83d8[_0xef98('0x29')]['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x518ab2,null))[_0xef98('0x19')](removeEntity(_0x518ab2,null))[_0xef98('0x27')](handleError(_0x518ab2,null));};exports[_0xef98('0x37')]=function(_0x5c9dee,_0xd86cc2){return db[_0xef98('0x20')][_0xef98('0x37')]()[_0xef98('0x19')](respondWithResult(_0xd86cc2,null))['catch'](handleError(_0xd86cc2,null));};exports[_0xef98('0x38')]=function(_0x3fac75,_0x314cec){return db[_0xef98('0x39')][_0xef98('0x35')]({'where':{'id':_0x3fac75['params']['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x314cec,null))[_0xef98('0x19')](function(_0x2b4ca0){if(_0x2b4ca0){return _0x2b4ca0[_0xef98('0x38')](_0x3fac75[_0xef98('0x36')][_0xef98('0x3a')],_[_0xef98('0x3b')](_0x3fac75[_0xef98('0x36')],[_0xef98('0x3a'),'id'])||{});}})[_0xef98('0x19')](respondWithResult(_0x314cec,null))[_0xef98('0x27')](handleError(_0x314cec,null));};exports['getMessages']=function(_0x3d4d02,_0x4cca5c){var _0x498718={'raw':![],'where':{}};var _0x56b5ef={};var _0x4df7f7={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xef98('0x3c')]({'where':{'id':_0x3d4d02['params']['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x4cca5c,null))[_0xef98('0x19')](function(_0x376852){if(_0x376852){_0x56b5ef[_0xef98('0x2a')]=_[_0xef98('0x2b')](db[_0xef98('0x39')][_0xef98('0x21')]);_0x56b5ef[_0xef98('0x25')]=_[_0xef98('0x2b')](_0x3d4d02[_0xef98('0x25')]);_0x56b5ef['filters']=_[_0xef98('0x2d')](_0x56b5ef['model'],_0x56b5ef[_0xef98('0x25')]);_0x498718[_0xef98('0x2e')]=_[_0xef98('0x2d')](_0x56b5ef[_0xef98('0x2a')],qs['fields'](_0x3d4d02['query']['fields']));_0x498718[_0xef98('0x2e')]=_0x498718['attributes'][_0xef98('0x30')]?_0x498718[_0xef98('0x2e')]:_0x56b5ef[_0xef98('0x2a')];if(!_0x3d4d02['query']['hasOwnProperty'](_0xef98('0x3d'))){_0x498718[_0xef98('0x15')]=qs['limit'](_0x3d4d02[_0xef98('0x25')][_0xef98('0x15')]);_0x498718['offset']=qs[_0xef98('0x12')](_0x3d4d02[_0xef98('0x25')][_0xef98('0x12')]);}_0x498718[_0xef98('0x3e')]=qs['sort'](_0x3d4d02[_0xef98('0x25')][_0xef98('0x3f')]);_0x498718['where']=qs[_0xef98('0x2c')](_[_0xef98('0x40')](_0x3d4d02[_0xef98('0x25')],_0x56b5ef[_0xef98('0x2c')]));_0x498718[_0xef98('0x41')][_0xef98('0x42')]=_0x376852['id'];if(_0x3d4d02[_0xef98('0x25')][_0xef98('0x43')]){_0x498718[_0xef98('0x41')]=_[_0xef98('0x33')](_0x498718[_0xef98('0x41')],{'$or':_['map'](_0x498718[_0xef98('0x2e')],function(_0xe69aa6){var _0x45ca74={};_0x45ca74[_0xe69aa6]={'$like':'%'+_0x3d4d02[_0xef98('0x25')][_0xef98('0x43')]+'%'};return _0x45ca74;})});}if(_0x3d4d02[_0xef98('0x25')][_0xef98('0x44')]){var _0x28e894=_0x3d4d02['query'][_0xef98('0x44')][_0xef98('0x45')](',');var _0x23b0e2={};_0x23b0e2[_0x28e894[0x0]]={'$gte':moment(_0x28e894[0x1])['format'](_0xef98('0x46'))};_0x498718['where']=_[_0xef98('0x33')](_0x498718['where'],_0x23b0e2);}_0x498718=_['merge']({},_0x498718,_0x3d4d02['options']);return db[_0xef98('0x39')]['count']({'where':_0x498718['where']})[_0xef98('0x19')](function(_0x3e1334){_0x4df7f7[_0xef98('0x14')]=_0x3e1334;if(_0x3d4d02[_0xef98('0x25')][_0xef98('0x31')]){_0x498718[_0xef98('0x32')]=[{'all':!![]}];}return db[_0xef98('0x39')][_0xef98('0x47')](_0x498718);})[_0xef98('0x19')](function(_0xb847fc){_0x4df7f7[_0xef98('0x48')]=_0xb847fc;return _0x4df7f7;});}})[_0xef98('0x19')](respondWithFilteredResult(_0x4cca5c,_0x498718))[_0xef98('0x27')](handleError(_0x4cca5c,null));};exports[_0xef98('0x49')]=function(_0x39ad79,_0x4fe8eb){return db[_0xef98('0x20')]['find']({'where':{'id':_0x39ad79[_0xef98('0x29')]['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x4fe8eb,null))[_0xef98('0x19')](function(_0x31e628){if(_0x31e628){return _0x31e628[_0xef98('0x4a')](_0x39ad79[_0xef98('0x36')][_0xef98('0x3a')],_[_0xef98('0x3b')](_0x39ad79[_0xef98('0x36')],[_0xef98('0x3a'),'id'])||{})[_0xef98('0x4b')](function(){return db[_0xef98('0x4c')][_0xef98('0x47')]({'attributes':['id',_0xef98('0x1d'),_0xef98('0x4d')],'where':{'id':_0x39ad79[_0xef98('0x36')][_0xef98('0x3a')]}});})[_0xef98('0x19')](function(_0x1eecfb){socket['emit'](_0xef98('0x4e'),{'id':Number(_0x39ad79[_0xef98('0x29')]['id']),'tags':_0x1eecfb||[]});return{'id':Number(_0x39ad79[_0xef98('0x29')]['id']),'tags':_0x1eecfb||[]};});}})[_0xef98('0x19')](respondWithResult(_0x4fe8eb,null))[_0xef98('0x27')](handleError(_0x4fe8eb,null));};exports[_0xef98('0x4f')]=function(_0x254f9c,_0x125967){return db['SmsInteraction'][_0xef98('0x35')]({'where':{'id':_0x254f9c[_0xef98('0x29')]['id']}})[_0xef98('0x19')](handleEntityNotFound(_0x125967,null))[_0xef98('0x19')](function(_0x79c562){if(_0x79c562){return _0x79c562[_0xef98('0x4f')](_0x254f9c[_0xef98('0x25')][_0xef98('0x3a')]);}})[_0xef98('0x19')](respondWithStatusCode(_0x125967,null))[_0xef98('0x27')](handleError(_0x125967,null));};exports['download']=function(_0x1164b0,_0xc362c8){var _0x59cd74=moment()[_0xef98('0x50')]()[_0xef98('0x51')]();var _0x5e2b45=path[_0xef98('0x52')](config[_0xef98('0x53')],_0xef98('0x54'),_0xef98('0x55'),_0xef98('0x56'));var _0x1a86fe=path[_0xef98('0x52')](_0x5e2b45,_0x59cd74);var _0x246949=util['format'](_0xef98('0x57'),_0x1164b0[_0xef98('0x29')]['id'],_0x59cd74);var _0x3d3316=path['join'](_0x5e2b45,_0x246949);var _0x5f54b8=[];_0x5f54b8['push']({'model':db[_0xef98('0x58')],'as':_0xef98('0x58'),'attributes':['id',_0xef98('0x59')],'raw':!![]});_0x5f54b8[_0xef98('0x5a')]({'model':db[_0xef98('0x5b')],'as':_0xef98('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x2621e8=[{'model':db['SmsMessage'],'as':_0xef98('0x5d'),'attributes':['id','body',_0xef98('0x5e'),_0xef98('0x5f'),_0xef98('0x60'),_0xef98('0x61')],'include':_0x5f54b8}];_0x2621e8[_0xef98('0x5a')]({'model':db[_0xef98('0x62')],'as':_0xef98('0x63'),'attributes':['id','name']});_0x2621e8[_0xef98('0x5a')]({'model':db['User'],'as':'Owner','attributes':['id',_0xef98('0x59')]});return db[_0xef98('0x20')][_0xef98('0x35')]({'where':{'id':_0x1164b0[_0xef98('0x29')]['id']},'include':_0x2621e8})[_0xef98('0x19')](handleEntityNotFound(_0xc362c8,null))[_0xef98('0x19')](function(_0x138c96){if(_0x138c96){var _0xb0643b=_0x138c96[_0xef98('0x64')]({'plain':!![]});fs[_0xef98('0x65')](_0x1a86fe);var _0x10d74e={'channel':_0xef98('0x66'),'account':_0xb0643b[_0xef98('0x63')]['name'],'agent':_0xb0643b[_0xef98('0x67')]?_0xb0643b['Owner'][_0xef98('0x59')]:_0xef98('0x68'),'createdAt':moment(_0xb0643b[_0xef98('0x5e')])[_0xef98('0x69')](_0xef98('0x46'))[_0xef98('0x51')](),'closedAt':_0xb0643b[_0xef98('0x6a')]?moment(_0xb0643b[_0xef98('0x6b')])[_0xef98('0x69')](_0xef98('0x46'))[_0xef98('0x51')]():'','disposition':_0xb0643b['disposition'],'messages':_(_0xb0643b[_0xef98('0x5d')])[_0xef98('0x43')]({'secret':![]})[_0xef98('0x6c')](function(_0x315a67){return{'date':moment(_0x315a67[_0xef98('0x5e')])[_0xef98('0x69')](_0xef98('0x46'))[_0xef98('0x51')](),'sender':_0x315a67['direction']===_0xef98('0x6d')?_0x315a67[_0xef98('0x58')]?_0x315a67[_0xef98('0x58')]['fullname']:_0xef98('0x6e'):_0x315a67[_0xef98('0x5c')][_0xef98('0x6f')]+(_0x315a67[_0xef98('0x5c')][_0xef98('0x70')]?'\x20'+_0x315a67[_0xef98('0x5c')][_0xef98('0x70')]:''),'body':_0x315a67[_0xef98('0x36')],'direction':_0x315a67[_0xef98('0x5f')]==='out'?'A':'C','secret':_0x315a67[_0xef98('0x60')],'read':_0x315a67[_0xef98('0x61')]};})[_0xef98('0x71')]()};return ejs['renderFile'](path['join'](config['root'],'server',_0xef98('0x72'),_0xef98('0x73')),{'interaction':_0x10d74e})[_0xef98('0x19')](function(_0x1ec9ad){var _0x1cd0bf=path[_0xef98('0x52')](_0x1a86fe,_0xef98('0x74')+_0xb0643b['id']+'-'+_0x59cd74+'.pdf');var _0x54ee6b={'path':_0x1cd0bf,'channel':'Sms','interactionId':_0xb0643b['id']};return pdf['createPdfFromHTML'](_0x1ec9ad,_0x54ee6b);})[_0xef98('0x19')](function(){return new BPromise(function(_0x3974de,_0x54825f){zipdir(_0x1a86fe,{'saveTo':_0x3d3316},function(_0x114e39,_0x343ded){if(_0x114e39)return _0x54825f(_0x114e39);return _0x3974de(_0x343ded);});})[_0xef98('0x19')](function(){return new BPromise(function(_0x52b152,_0x57754a){rimraf(_0x1a86fe,function(_0x1e2919){if(_0x1e2919)_0x57754a(_0x1e2919);return _0x52b152();});});})[_0xef98('0x19')](function(){return _0xc362c8[_0xef98('0x75')](_0x3d3316,_0x246949,function(_0x5a655a){if(_0x5a655a){console['log']('err',_0x5a655a);}else{fs['unlinkSync'](_0x3d3316);}});});});}else{return _0xc362c8[_0xef98('0x1b')](0xc8);}})[_0xef98('0x27')](handleError(_0xc362c8,null));}; \ No newline at end of file +var _0xd10f=['attributes','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','SmsMessage','ids','getMessages','findOne','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','emit','smsInteractionTags:save','removeTags','download','toString','root','server','files','tmp','format','push','User','fullname','CmContact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','closed','closedAt','disposition','out','System','Contact','read','value','renderFile','join','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection'];(function(_0x1d17a6,_0x11e005){var _0x10387a=function(_0x407003){while(--_0x407003){_0x1d17a6['push'](_0x1d17a6['shift']());}};_0x10387a(++_0x11e005);}(_0xd10f,0xc9));var _0xfd10=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd10f[_0x3b380d];return _0x54502b;};'use strict';var rimraf=require(_0xfd10('0x0'));var zipdir=require(_0xfd10('0x1'));var moment=require(_0xfd10('0x2'));var BPromise=require(_0xfd10('0x3'));var util=require(_0xfd10('0x4'));var path=require(_0xfd10('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd10('0x6'));var Redis=require(_0xfd10('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xfd10('0x8'));var pdf=require(_0xfd10('0x9'));var logger=require('../../config/logger')(_0xfd10('0xa'));var config=require(_0xfd10('0xb'));var db=require('../../mysqldb')['db'];config[_0xfd10('0xc')]=_['defaults'](config[_0xfd10('0xc')],{'host':_0xfd10('0xd'),'port':0x18eb});var socket=require(_0xfd10('0xe'))(new Redis(config[_0xfd10('0xc')]));require(_0xfd10('0xf'))[_0xfd10('0x10')](socket);function respondWithStatusCode(_0x10fece,_0x4bc1da){_0x4bc1da=_0x4bc1da||0xcc;return function(_0xde7c2c){if(_0xde7c2c){return _0x10fece['sendStatus'](_0x4bc1da);}return _0x10fece[_0xfd10('0x11')](_0x4bc1da)[_0xfd10('0x12')]();};}function respondWithResult(_0x2d9483,_0x141922){_0x141922=_0x141922||0xc8;return function(_0x4f0629){if(_0x4f0629){return _0x2d9483[_0xfd10('0x11')](_0x141922)[_0xfd10('0x13')](_0x4f0629);}};}function respondWithFilteredResult(_0x157f8,_0x5f5ad7){return function(_0x2740c7){if(_0x2740c7){var _0xe5d0e2=typeof _0x5f5ad7[_0xfd10('0x14')]===_0xfd10('0x15')&&typeof _0x5f5ad7['limit']===_0xfd10('0x15');var _0x8ebaf6=_0x2740c7[_0xfd10('0x16')];var _0x26a0a0=_0xe5d0e2?0x0:_0x5f5ad7[_0xfd10('0x14')];var _0x3adc1b=_0xe5d0e2?_0x2740c7[_0xfd10('0x16')]:_0x5f5ad7['offset']+_0x5f5ad7[_0xfd10('0x17')];var _0x3c9b3e;if(_0x3adc1b>=_0x8ebaf6){_0x3adc1b=_0x8ebaf6;_0x3c9b3e=0xc8;}else{_0x3c9b3e=0xce;}_0x157f8[_0xfd10('0x11')](_0x3c9b3e);return _0x157f8[_0xfd10('0x18')](_0xfd10('0x19'),_0x26a0a0+'-'+_0x3adc1b+'/'+_0x8ebaf6)[_0xfd10('0x13')](_0x2740c7);}return null;};}function saveUpdates(_0x4f7f0c){return function(_0x48fd4d){if(_0x48fd4d){return _0x48fd4d[_0xfd10('0x1a')](_0x4f7f0c)['then'](function(_0x16f35b){return _0x16f35b;});}return null;};}function removeEntity(_0x5c6f11){return function(_0x99db2e){if(_0x99db2e){return _0x99db2e['destroy']()[_0xfd10('0x1b')](function(){_0x5c6f11[_0xfd10('0x11')](0xcc)[_0xfd10('0x12')]();});}};}function handleEntityNotFound(_0x94e656){return function(_0x31aa3b){if(!_0x31aa3b){_0x94e656[_0xfd10('0x1c')](0x194);}return _0x31aa3b;};}function handleError(_0x5b5ec7,_0x10c160){_0x10c160=_0x10c160||0x1f4;return function(_0x58d9d4){logger[_0xfd10('0x1d')](_0x58d9d4[_0xfd10('0x1e')]);if(_0x58d9d4[_0xfd10('0x1f')]){delete _0x58d9d4[_0xfd10('0x1f')];}_0x5b5ec7[_0xfd10('0x11')](_0x10c160)[_0xfd10('0x20')](_0x58d9d4);};}exports[_0xfd10('0x21')]=function(_0x11085b,_0x4a2ba5){var _0x144ba6={};var _0x5dc4cb=_[_0xfd10('0x22')](db[_0xfd10('0x23')][_0xfd10('0x24')],function(_0x1182ff){return{'name':_0x1182ff[_0xfd10('0x25')],'type':_0x1182ff[_0xfd10('0x26')][_0xfd10('0x27')]};});_0x144ba6=qs['getOptions'](_0x5dc4cb,_0x11085b);return interaction[_0xfd10('0x28')](_0xfd10('0x29'),_0x11085b[_0xfd10('0x2a')],_0x11085b[_0xfd10('0x2b')],_0x144ba6,_0x5dc4cb)[_0xfd10('0x1b')](respondWithFilteredResult(_0x4a2ba5,_0x144ba6))[_0xfd10('0x2c')](handleError(_0x4a2ba5,null));};exports[_0xfd10('0x2d')]=function(_0x4e149c,_0x3902d2){var _0x2b3c08={'raw':![],'where':{'id':_0x4e149c[_0xfd10('0x2e')]['id']}},_0x2d8ce2={};_0x2d8ce2[_0xfd10('0x2f')]=_[_0xfd10('0x30')](db[_0xfd10('0x23')]['rawAttributes']);_0x2d8ce2[_0xfd10('0x2a')]=_['keys'](_0x4e149c[_0xfd10('0x2a')]);_0x2d8ce2[_0xfd10('0x31')]=_[_0xfd10('0x32')](_0x2d8ce2['model'],_0x2d8ce2['query']);_0x2b3c08[_0xfd10('0x33')]=_[_0xfd10('0x32')](_0x2d8ce2[_0xfd10('0x2f')],qs['fields'](_0x4e149c['query']['fields']));_0x2b3c08['attributes']=_0x2b3c08[_0xfd10('0x33')]['length']?_0x2b3c08['attributes']:_0x2d8ce2[_0xfd10('0x2f')];if(_0x4e149c['query'][_0xfd10('0x34')]){_0x2b3c08[_0xfd10('0x35')]=[{'all':!![]}];}_0x2b3c08=_[_0xfd10('0x36')]({},_0x2b3c08,_0x4e149c[_0xfd10('0x37')]);return db[_0xfd10('0x23')][_0xfd10('0x38')](_0x2b3c08)[_0xfd10('0x1b')](handleEntityNotFound(_0x3902d2,null))[_0xfd10('0x1b')](respondWithResult(_0x3902d2,null))[_0xfd10('0x2c')](handleError(_0x3902d2,null));};exports[_0xfd10('0x39')]=function(_0x268273,_0x35d04d){return db[_0xfd10('0x23')][_0xfd10('0x39')](_0x268273[_0xfd10('0x3a')],{})[_0xfd10('0x1b')](respondWithResult(_0x35d04d,0xc9))[_0xfd10('0x2c')](handleError(_0x35d04d,null));};exports[_0xfd10('0x1a')]=function(_0x2d5282,_0x37c4d9){if(_0x2d5282[_0xfd10('0x3a')]['id']){delete _0x2d5282[_0xfd10('0x3a')]['id'];}return db[_0xfd10('0x23')][_0xfd10('0x38')]({'where':{'id':_0x2d5282[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x37c4d9,null))[_0xfd10('0x1b')](saveUpdates(_0x2d5282[_0xfd10('0x3a')],null))[_0xfd10('0x1b')](respondWithResult(_0x37c4d9,null))[_0xfd10('0x2c')](handleError(_0x37c4d9,null));};exports[_0xfd10('0x3b')]=function(_0x30dfaf,_0x31f992){return db['SmsInteraction'][_0xfd10('0x38')]({'where':{'id':_0x30dfaf['params']['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x31f992,null))[_0xfd10('0x1b')](removeEntity(_0x31f992,null))[_0xfd10('0x2c')](handleError(_0x31f992,null));};exports[_0xfd10('0x3c')]=function(_0x3a481c,_0x4a70a6){return db['SmsInteraction'][_0xfd10('0x3c')]()[_0xfd10('0x1b')](respondWithResult(_0x4a70a6,null))[_0xfd10('0x2c')](handleError(_0x4a70a6,null));};exports[_0xfd10('0x3d')]=function(_0x2a6609,_0x5dabd1){return db[_0xfd10('0x3e')][_0xfd10('0x38')]({'where':{'id':_0x2a6609[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x5dabd1,null))[_0xfd10('0x1b')](function(_0x130096){if(_0x130096){return _0x130096[_0xfd10('0x3d')](_0x2a6609[_0xfd10('0x3a')][_0xfd10('0x3f')],_['omit'](_0x2a6609[_0xfd10('0x3a')],[_0xfd10('0x3f'),'id'])||{});}})[_0xfd10('0x1b')](respondWithResult(_0x5dabd1,null))[_0xfd10('0x2c')](handleError(_0x5dabd1,null));};exports[_0xfd10('0x40')]=function(_0x56c973,_0x51e8a1){var _0x12ea46={'raw':![],'where':{}};var _0x46b24a={};var _0x22ce6c={'count':0x0,'rows':[]};return db[_0xfd10('0x23')][_0xfd10('0x41')]({'where':{'id':_0x56c973[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x51e8a1,null))[_0xfd10('0x1b')](function(_0x2f864b){if(_0x2f864b){_0x46b24a[_0xfd10('0x2f')]=_[_0xfd10('0x30')](db['SmsMessage'][_0xfd10('0x24')]);_0x46b24a[_0xfd10('0x2a')]=_[_0xfd10('0x30')](_0x56c973[_0xfd10('0x2a')]);_0x46b24a[_0xfd10('0x31')]=_[_0xfd10('0x32')](_0x46b24a[_0xfd10('0x2f')],_0x46b24a[_0xfd10('0x2a')]);_0x12ea46[_0xfd10('0x33')]=_[_0xfd10('0x32')](_0x46b24a[_0xfd10('0x2f')],qs[_0xfd10('0x42')](_0x56c973[_0xfd10('0x2a')]['fields']));_0x12ea46[_0xfd10('0x33')]=_0x12ea46['attributes'][_0xfd10('0x43')]?_0x12ea46[_0xfd10('0x33')]:_0x46b24a[_0xfd10('0x2f')];if(!_0x56c973['query'][_0xfd10('0x44')](_0xfd10('0x45'))){_0x12ea46[_0xfd10('0x17')]=qs['limit'](_0x56c973[_0xfd10('0x2a')][_0xfd10('0x17')]);_0x12ea46['offset']=qs['offset'](_0x56c973[_0xfd10('0x2a')][_0xfd10('0x14')]);}_0x12ea46[_0xfd10('0x46')]=qs[_0xfd10('0x47')](_0x56c973[_0xfd10('0x2a')][_0xfd10('0x47')]);_0x12ea46[_0xfd10('0x48')]=qs[_0xfd10('0x31')](_[_0xfd10('0x49')](_0x56c973[_0xfd10('0x2a')],_0x46b24a[_0xfd10('0x31')]));_0x12ea46[_0xfd10('0x48')]['SmsInteractionId']=_0x2f864b['id'];if(_0x56c973['query']['filter']){_0x12ea46['where']=_[_0xfd10('0x36')](_0x12ea46['where'],{'$or':_['map'](_0x12ea46[_0xfd10('0x33')],function(_0x4248e3){var _0x3c81ab={};_0x3c81ab[_0x4248e3]={'$like':'%'+_0x56c973[_0xfd10('0x2a')][_0xfd10('0x4a')]+'%'};return _0x3c81ab;})});}if(_0x56c973[_0xfd10('0x2a')][_0xfd10('0x4b')]){var _0x48af17=_0x56c973[_0xfd10('0x2a')][_0xfd10('0x4b')][_0xfd10('0x4c')](',');var _0x5908cd={};_0x5908cd[_0x48af17[0x0]]={'$gte':moment(_0x48af17[0x1])['format'](_0xfd10('0x4d'))};_0x12ea46[_0xfd10('0x48')]=_[_0xfd10('0x36')](_0x12ea46['where'],_0x5908cd);}_0x12ea46=_[_0xfd10('0x36')]({},_0x12ea46,_0x56c973[_0xfd10('0x37')]);return db[_0xfd10('0x3e')][_0xfd10('0x16')]({'where':_0x12ea46['where']})[_0xfd10('0x1b')](function(_0x24111b){_0x22ce6c['count']=_0x24111b;if(_0x56c973[_0xfd10('0x2a')]['includeAll']){_0x12ea46[_0xfd10('0x35')]=[{'all':!![]}];}return db[_0xfd10('0x3e')][_0xfd10('0x28')](_0x12ea46);})['then'](function(_0x18b008){_0x22ce6c[_0xfd10('0x4e')]=_0x18b008;return _0x22ce6c;});}})[_0xfd10('0x1b')](respondWithFilteredResult(_0x51e8a1,_0x12ea46))[_0xfd10('0x2c')](handleError(_0x51e8a1,null));};exports[_0xfd10('0x4f')]=function(_0x22bb49,_0x3f7375){return db[_0xfd10('0x23')][_0xfd10('0x38')]({'where':{'id':_0x22bb49[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x3f7375,null))[_0xfd10('0x1b')](function(_0x4a5b48){if(_0x4a5b48){return _0x4a5b48[_0xfd10('0x50')](_0x22bb49['body'][_0xfd10('0x3f')],_[_0xfd10('0x51')](_0x22bb49[_0xfd10('0x3a')],['ids','id'])||{})[_0xfd10('0x52')](function(){return db['Tag'][_0xfd10('0x28')]({'attributes':['id',_0xfd10('0x1f'),_0xfd10('0x53')],'where':{'id':_0x22bb49[_0xfd10('0x3a')][_0xfd10('0x3f')]}});})[_0xfd10('0x1b')](function(_0x111870){socket[_0xfd10('0x54')](_0xfd10('0x55'),{'id':Number(_0x22bb49[_0xfd10('0x2e')]['id']),'tags':_0x111870||[]});return{'id':Number(_0x22bb49[_0xfd10('0x2e')]['id']),'tags':_0x111870||[]};});}})[_0xfd10('0x1b')](respondWithResult(_0x3f7375,null))[_0xfd10('0x2c')](handleError(_0x3f7375,null));};exports[_0xfd10('0x56')]=function(_0x18e421,_0x3e9a74){return db[_0xfd10('0x23')][_0xfd10('0x38')]({'where':{'id':_0x18e421[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x3e9a74,null))[_0xfd10('0x1b')](function(_0x4cd777){if(_0x4cd777){return _0x4cd777['removeTags'](_0x18e421['query']['ids']);}})[_0xfd10('0x1b')](respondWithStatusCode(_0x3e9a74,null))[_0xfd10('0x2c')](handleError(_0x3e9a74,null));};exports[_0xfd10('0x57')]=function(_0x27ee09,_0x22cd96){var _0x4335d8=moment()['unix']()[_0xfd10('0x58')]();var _0x22ca48=path['join'](config[_0xfd10('0x59')],_0xfd10('0x5a'),_0xfd10('0x5b'),_0xfd10('0x5c'));var _0xbe6409=path['join'](_0x22ca48,_0x4335d8);var _0x2dcb4a=util[_0xfd10('0x5d')]('transcript-%d-%s.zip',_0x27ee09[_0xfd10('0x2e')]['id'],_0x4335d8);var _0x3e7f9b=path['join'](_0x22ca48,_0x2dcb4a);var _0x598acd=[];_0x598acd[_0xfd10('0x5e')]({'model':db['User'],'as':_0xfd10('0x5f'),'attributes':['id',_0xfd10('0x60')],'raw':!![]});_0x598acd[_0xfd10('0x5e')]({'model':db[_0xfd10('0x61')],'as':'Contact','attributes':['id',_0xfd10('0x62'),_0xfd10('0x63')],'raw':!![]});var _0x113172=[{'model':db[_0xfd10('0x3e')],'as':_0xfd10('0x64'),'attributes':['id',_0xfd10('0x3a'),_0xfd10('0x65'),_0xfd10('0x66'),_0xfd10('0x67'),'read'],'include':_0x598acd}];_0x113172['push']({'model':db[_0xfd10('0x68')],'as':_0xfd10('0x69'),'attributes':['id',_0xfd10('0x1f')]});_0x113172[_0xfd10('0x5e')]({'model':db[_0xfd10('0x5f')],'as':_0xfd10('0x6a'),'attributes':['id',_0xfd10('0x60')]});return db[_0xfd10('0x23')]['find']({'where':{'id':_0x27ee09['params']['id']},'include':_0x113172})[_0xfd10('0x1b')](handleEntityNotFound(_0x22cd96,null))[_0xfd10('0x1b')](function(_0x450949){if(_0x450949){var _0x5f099b=_0x450949['get']({'plain':!![]});fs[_0xfd10('0x6b')](_0xbe6409);var _0xff5508={'channel':_0xfd10('0x6c'),'account':_0x5f099b[_0xfd10('0x69')][_0xfd10('0x1f')],'agent':_0x5f099b[_0xfd10('0x6a')]?_0x5f099b[_0xfd10('0x6a')][_0xfd10('0x60')]:'N.A.','createdAt':moment(_0x5f099b['createdAt'])['format'](_0xfd10('0x4d'))['toString'](),'closedAt':_0x5f099b[_0xfd10('0x6d')]?moment(_0x5f099b[_0xfd10('0x6e')])['format'](_0xfd10('0x4d'))[_0xfd10('0x58')]():'','disposition':_0x5f099b[_0xfd10('0x6f')],'messages':_(_0x5f099b[_0xfd10('0x64')])[_0xfd10('0x4a')]({'secret':![]})[_0xfd10('0x22')](function(_0x54cbdb){return{'date':moment(_0x54cbdb[_0xfd10('0x65')])[_0xfd10('0x5d')](_0xfd10('0x4d'))[_0xfd10('0x58')](),'sender':_0x54cbdb[_0xfd10('0x66')]===_0xfd10('0x70')?_0x54cbdb['User']?_0x54cbdb[_0xfd10('0x5f')][_0xfd10('0x60')]:_0xfd10('0x71'):_0x54cbdb[_0xfd10('0x72')][_0xfd10('0x62')]+(_0x54cbdb[_0xfd10('0x72')][_0xfd10('0x63')]?'\x20'+_0x54cbdb[_0xfd10('0x72')][_0xfd10('0x63')]:''),'body':_0x54cbdb[_0xfd10('0x3a')],'direction':_0x54cbdb[_0xfd10('0x66')]===_0xfd10('0x70')?'A':'C','secret':_0x54cbdb[_0xfd10('0x67')],'read':_0x54cbdb[_0xfd10('0x73')]};})[_0xfd10('0x74')]()};return ejs[_0xfd10('0x75')](path[_0xfd10('0x76')](config[_0xfd10('0x59')],_0xfd10('0x5a'),_0xfd10('0x77'),_0xfd10('0x78')),{'interaction':_0xff5508})[_0xfd10('0x1b')](function(_0x577fda){var _0x1ab463=path[_0xfd10('0x76')](_0xbe6409,_0xfd10('0x79')+_0x5f099b['id']+'-'+_0x4335d8+_0xfd10('0x7a'));var _0x2ad8aa={'path':_0x1ab463,'channel':_0xfd10('0x6c'),'interactionId':_0x5f099b['id']};return pdf['createPdfFromHTML'](_0x577fda,_0x2ad8aa);})[_0xfd10('0x1b')](function(){return new BPromise(function(_0x280289,_0x2553e2){zipdir(_0xbe6409,{'saveTo':_0x3e7f9b},function(_0x34ba13,_0x489b0f){if(_0x34ba13)return _0x2553e2(_0x34ba13);return _0x280289(_0x489b0f);});})[_0xfd10('0x1b')](function(){return new BPromise(function(_0x403ed1,_0x433e9c){rimraf(_0xbe6409,function(_0x3bba75){if(_0x3bba75)_0x433e9c(_0x3bba75);return _0x403ed1();});});})['then'](function(){return _0x22cd96[_0xfd10('0x57')](_0x3e7f9b,_0x2dcb4a,function(_0x209d95){if(_0x209d95){console[_0xfd10('0x7b')](_0xfd10('0x7c'),_0x209d95);}else{fs[_0xfd10('0x7d')](_0x3e7f9b);}});});});}else{return _0x22cd96[_0xfd10('0x1c')](0xc8);}})[_0xfd10('0x2c')](handleError(_0x22cd96,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 075cb4c..047cf78 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 _0x2da6=['setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2da6,0x1dd));var _0x62da=function(_0x4b71fd,_0x3540c6){_0x4b71fd=_0x4b71fd-0x0;var _0x281ab5=_0x2da6[_0x4b71fd];return _0x281ab5;};'use strict';var EventEmitter=require(_0x62da('0x0'));var SmsInteraction=require(_0x62da('0x1'))['db'][_0x62da('0x2')];var SmsMessage=require(_0x62da('0x1'))['db'][_0x62da('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x62da('0x4')](0x0);var events={'afterCreate':_0x62da('0x5'),'afterUpdate':_0x62da('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4a8428){return function(_0xe28204,_0x3163df,_0x3a59f8){_0xe28204[_0x62da('0x7')]({'attributes':['id'],'raw':!![]})[_0x62da('0x8')](function(_0x9d9139){_0xe28204[_0x62da('0x9')](_0x62da('0xa'),_0x9d9139[_0x62da('0xb')](function(_0x4cfc5d){return{'id':_0x4cfc5d['id']};}));return SmsMessage[_0x62da('0xc')]({'where':{'SmsInteractionId':_0xe28204['id'],'direction':'in','read':![]},'raw':!![]});})[_0x62da('0x8')](function(_0x2a3d7c){_0xe28204[_0x62da('0x9')]('unreadMessages',_0x2a3d7c[_0x62da('0xd')]);SmsInteractionEvents[_0x62da('0xe')](_0x4a8428+':'+_0xe28204['id'],_0xe28204);SmsInteractionEvents[_0x62da('0xe')](_0x4a8428,_0xe28204);_0x3a59f8(null);})[_0x62da('0xf')](_0x3a59f8(null));};}for(var e in events){if(events[_0x62da('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x62da('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x236c=['length','emit','catch','hasOwnProperty','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','findAll','unreadMessages'];(function(_0x7e637c,_0x4a409f){var _0x14d7bb=function(_0x62beee){while(--_0x62beee){_0x7e637c['push'](_0x7e637c['shift']());}};_0x14d7bb(++_0x4a409f);}(_0x236c,0x155));var _0xc236=function(_0x42c06c,_0x1ced12){_0x42c06c=_0x42c06c-0x0;var _0x2ac08c=_0x236c[_0x42c06c];return _0x2ac08c;};'use strict';var EventEmitter=require(_0xc236('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xc236('0x1')];var SmsMessage=require(_0xc236('0x2'))['db'][_0xc236('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc236('0x4')](0x0);var events={'afterCreate':_0xc236('0x5'),'afterUpdate':'update','afterDestroy':_0xc236('0x6')};function emitEvent(_0x36e87d){return function(_0x33bc57,_0xd582f6,_0x23d3cc){_0x33bc57[_0xc236('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd612c6){_0x33bc57[_0xc236('0x8')]('Users',_0xd612c6['map'](function(_0x5cdee5){return{'id':_0x5cdee5['id']};}));return SmsMessage[_0xc236('0x9')]({'where':{'SmsInteractionId':_0x33bc57['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30a28d){_0x33bc57[_0xc236('0x8')](_0xc236('0xa'),_0x30a28d[_0xc236('0xb')]);SmsInteractionEvents[_0xc236('0xc')](_0x36e87d+':'+_0x33bc57['id'],_0x33bc57);SmsInteractionEvents['emit'](_0x36e87d,_0x33bc57);_0x23d3cc(null);})[_0xc236('0xd')](_0x23d3cc(null));};}for(var e in events){if(events[_0xc236('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc236('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 317ef01..5e0190f 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 _0x0d6c=['bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','lodash','../../config/logger','api'];(function(_0x3bafa0,_0x5075fb){var _0x35dcfa=function(_0x1746d2){while(--_0x1746d2){_0x3bafa0['push'](_0x3bafa0['shift']());}};_0x35dcfa(++_0x5075fb);}(_0x0d6c,0xde));var _0xc0d6=function(_0x5948fe,_0x18d3d2){_0x5948fe=_0x5948fe-0x0;var _0x1be901=_0x0d6c[_0x5948fe];return _0x1be901;};'use strict';var _=require(_0xc0d6('0x0'));var util=require('util');var logger=require(_0xc0d6('0x1'))(_0xc0d6('0x2'));var moment=require('moment');var BPromise=require(_0xc0d6('0x3'));var rp=require(_0xc0d6('0x4'));var fs=require('fs');var path=require(_0xc0d6('0x5'));var rimraf=require(_0xc0d6('0x6'));var config=require(_0xc0d6('0x7'));var attributes=require(_0xc0d6('0x8'));module[_0xc0d6('0x9')]=function(_0x29ed46,_0x520a84){return _0x29ed46[_0xc0d6('0xa')](_0xc0d6('0xb'),attributes,{'tableName':_0xc0d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcc4a82,_0x5dbc51,_0x21b516){if(_0xcc4a82[_0xc0d6('0xd')](_0xc0d6('0xe'))){_0xcc4a82['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x21b516(null,_0xcc4a82);}}});}; \ No newline at end of file +var _0x85a3=['format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt'];(function(_0x5a0357,_0x83e3af){var _0x54769f=function(_0x92a59e){while(--_0x92a59e){_0x5a0357['push'](_0x5a0357['shift']());}};_0x54769f(++_0x83e3af);}(_0x85a3,0x199));var _0x385a=function(_0x31f3e6,_0x5462dc){_0x31f3e6=_0x31f3e6-0x0;var _0x3a1f86=_0x85a3[_0x31f3e6];return _0x3a1f86;};'use strict';var _=require('lodash');var util=require(_0x385a('0x0'));var logger=require(_0x385a('0x1'))(_0x385a('0x2'));var moment=require(_0x385a('0x3'));var BPromise=require(_0x385a('0x4'));var rp=require(_0x385a('0x5'));var fs=require('fs');var path=require(_0x385a('0x6'));var rimraf=require(_0x385a('0x7'));var config=require(_0x385a('0x8'));var attributes=require(_0x385a('0x9'));module[_0x385a('0xa')]=function(_0x6f8c3d,_0x292f47){return _0x6f8c3d[_0x385a('0xb')](_0x385a('0xc'),attributes,{'tableName':_0x385a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57a480,_0x592f5c,_0x58c268){if(_0x57a480['changed'](_0x385a('0xe'))){_0x57a480[_0x385a('0xf')]=moment()[_0x385a('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x58c268(null,_0x57a480);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 77e48a3..ec4705e 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 _0x7de4=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','attributes','limit','then','stringify','AddTagsToSmsInteraction','find','where','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7de4,0x1b2));var _0x47de=function(_0x54487b,_0x5b4b8a){_0x54487b=_0x54487b-0x0;var _0x2105e8=_0x7de4[_0x54487b];return _0x2105e8;};'use strict';var _=require(_0x47de('0x0'));var util=require(_0x47de('0x1'));var moment=require(_0x47de('0x2'));var BPromise=require(_0x47de('0x3'));var rs=require(_0x47de('0x4'));var fs=require('fs');var Redis=require(_0x47de('0x5'));var db=require(_0x47de('0x6'))['db'];var utils=require(_0x47de('0x7'));var logger=require(_0x47de('0x8'))(_0x47de('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x47de('0xa')]['http']({'port':0x232a});config[_0x47de('0xb')]=_[_0x47de('0xc')](config['redis'],{'host':_0x47de('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47de('0xb')]));require(_0x47de('0xe'))[_0x47de('0xf')](socket);function respondWithRpcPromise(_0x3d0777,_0x18d467,_0x315a1d){return new BPromise(function(_0x216813,_0x4703cf){return client[_0x47de('0x10')](_0x3d0777,_0x315a1d)['then'](function(_0x54bf4d){logger[_0x47de('0x11')](_0x47de('0x12'),_0x18d467,_0x47de('0x13'));logger[_0x47de('0x14')](_0x47de('0x15'),_0x18d467,_0x47de('0x13'),JSON['stringify'](_0x54bf4d));if(_0x54bf4d[_0x47de('0x16')]){if(_0x54bf4d[_0x47de('0x16')][_0x47de('0x17')]===0x1f4){logger[_0x47de('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x18d467,_0x54bf4d['error'][_0x47de('0x18')]);return _0x4703cf(_0x54bf4d[_0x47de('0x16')][_0x47de('0x18')]);}logger[_0x47de('0x16')](_0x47de('0x12'),_0x18d467,_0x54bf4d['error'][_0x47de('0x18')]);return _0x216813(_0x54bf4d[_0x47de('0x16')][_0x47de('0x18')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x18d467,_0x47de('0x13'));_0x216813(_0x54bf4d[_0x47de('0x19')][_0x47de('0x18')]);}})['catch'](function(_0x20b766){logger[_0x47de('0x16')](_0x47de('0x12'),_0x18d467,_0x20b766);_0x4703cf(_0x20b766);});});}exports[_0x47de('0x1a')]=function(_0x1aa4d4){var _0x57bf1c=this;return new Promise(function(_0x5706af,_0x2dc44a){return db[_0x47de('0x1b')][_0x47de('0x1c')](_0x1aa4d4[_0x47de('0x1d')],{'raw':_0x1aa4d4[_0x47de('0x1e')]?_0x1aa4d4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1aa4d4['options']?_0x1aa4d4[_0x47de('0x1e')]['where']||null:null,'attributes':_0x1aa4d4[_0x47de('0x1e')]?_0x1aa4d4[_0x47de('0x1e')][_0x47de('0x1f')]||null:null,'limit':_0x1aa4d4['options']?_0x1aa4d4[_0x47de('0x1e')][_0x47de('0x20')]||null:null})[_0x47de('0x21')](function(_0x4cce2d){logger[_0x47de('0x11')]('UpdateSmsInteraction',_0x1aa4d4);logger[_0x47de('0x14')](_0x47de('0x1a'),_0x1aa4d4,JSON[_0x47de('0x22')](_0x4cce2d));_0x5706af(_0x4cce2d);})['catch'](function(_0x5f49e9){logger['error'](_0x47de('0x1a'),_0x5f49e9['message'],_0x1aa4d4);_0x2dc44a(_0x57bf1c['error'](0x1f4,_0x5f49e9[_0x47de('0x18')]));});});};exports[_0x47de('0x23')]=function(_0x4761c7){return new Promise(function(_0x310f35,_0x7afaf4){return db[_0x47de('0x1b')][_0x47de('0x24')]({'where':_0x4761c7['options']?_0x4761c7['options'][_0x47de('0x25')]||null:null})['then'](function(_0x4436ca){if(_0x4436ca){return _0x4436ca[_0x47de('0x26')](_0x4761c7[_0x47de('0x1d')][_0x47de('0x27')],_[_0x47de('0x28')](_0x4761c7[_0x47de('0x1d')],[_0x47de('0x27'),'id'])||{});}})[_0x47de('0x29')](function(_0x1e42b6){logger[_0x47de('0x11')](_0x47de('0x2a'),_0x4761c7);logger[_0x47de('0x14')](_0x47de('0x2a'),_0x4761c7,JSON[_0x47de('0x22')](_0x1e42b6));_0x310f35(_0x1e42b6);})['catch'](function(_0x57769a){logger[_0x47de('0x16')](_0x47de('0x2a'),_0x57769a['message'],_0x4761c7);_0x7afaf4(_this[_0x47de('0x16')](0x1f4,_0x57769a[_0x47de('0x18')]));});});}; \ No newline at end of file +var _0x20b3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','then','addTags','body','ids','omit','spread','AddTags','stringify','lodash','util'];(function(_0x2c4bc3,_0x34f08b){var _0x31ca59=function(_0x2190f0){while(--_0x2190f0){_0x2c4bc3['push'](_0x2c4bc3['shift']());}};_0x31ca59(++_0x34f08b);}(_0x20b3,0x112));var _0x320b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x320b('0x0'));var util=require(_0x320b('0x1'));var moment=require(_0x320b('0x2'));var BPromise=require(_0x320b('0x3'));var rs=require(_0x320b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x320b('0x5'))['db'];var utils=require(_0x320b('0x6'));var logger=require(_0x320b('0x7'))(_0x320b('0x8'));var config=require(_0x320b('0x9'));var jayson=require(_0x320b('0xa'));var client=jayson['client'][_0x320b('0xb')]({'port':0x232a});config[_0x320b('0xc')]=_[_0x320b('0xd')](config['redis'],{'host':_0x320b('0xe'),'port':0x18eb});var socket=require(_0x320b('0xf'))(new Redis(config['redis']));require(_0x320b('0x10'))[_0x320b('0x11')](socket);function respondWithRpcPromise(_0x21c280,_0x2d8055,_0x3210a3){return new BPromise(function(_0x1e2ea7,_0xb54238){return client[_0x320b('0x12')](_0x21c280,_0x3210a3)['then'](function(_0x480dd9){logger['info'](_0x320b('0x13'),_0x2d8055,'request\x20sent');logger[_0x320b('0x14')](_0x320b('0x15'),_0x2d8055,_0x320b('0x16'),JSON['stringify'](_0x480dd9));if(_0x480dd9['error']){if(_0x480dd9[_0x320b('0x17')][_0x320b('0x18')]===0x1f4){logger[_0x320b('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x2d8055,_0x480dd9['error'][_0x320b('0x19')]);return _0xb54238(_0x480dd9['error'][_0x320b('0x19')]);}logger[_0x320b('0x17')](_0x320b('0x13'),_0x2d8055,_0x480dd9[_0x320b('0x17')]['message']);return _0x1e2ea7(_0x480dd9['error'][_0x320b('0x19')]);}else{logger[_0x320b('0x1a')](_0x320b('0x13'),_0x2d8055,_0x320b('0x16'));_0x1e2ea7(_0x480dd9['result'][_0x320b('0x19')]);}})[_0x320b('0x1b')](function(_0x40a9b3){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2d8055,_0x40a9b3);_0xb54238(_0x40a9b3);});});}exports[_0x320b('0x1c')]=function(_0x229492){var _0x25c8ce=this;return new Promise(function(_0x52f4c2,_0x2227dc){return db[_0x320b('0x1d')][_0x320b('0x1e')](_0x229492['body'],{'raw':_0x229492[_0x320b('0x1f')]?_0x229492[_0x320b('0x1f')][_0x320b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x229492[_0x320b('0x1f')]?_0x229492['options'][_0x320b('0x21')]||null:null,'attributes':_0x229492['options']?_0x229492[_0x320b('0x1f')][_0x320b('0x22')]||null:null,'limit':_0x229492[_0x320b('0x1f')]?_0x229492[_0x320b('0x1f')][_0x320b('0x23')]||null:null})['then'](function(_0x3ea22a){logger[_0x320b('0x1a')](_0x320b('0x1c'),_0x229492);logger[_0x320b('0x14')]('UpdateSmsInteraction',_0x229492,JSON['stringify'](_0x3ea22a));_0x52f4c2(_0x3ea22a);})[_0x320b('0x1b')](function(_0xddd352){logger['error'](_0x320b('0x1c'),_0xddd352['message'],_0x229492);_0x2227dc(_0x25c8ce[_0x320b('0x17')](0x1f4,_0xddd352['message']));});});};exports[_0x320b('0x24')]=function(_0x3e9c1d){return new Promise(function(_0x3385d4,_0x33c5c7){return db[_0x320b('0x1d')][_0x320b('0x25')]({'where':_0x3e9c1d[_0x320b('0x1f')]?_0x3e9c1d[_0x320b('0x1f')][_0x320b('0x21')]||null:null})[_0x320b('0x26')](function(_0x494531){if(_0x494531){return _0x494531[_0x320b('0x27')](_0x3e9c1d[_0x320b('0x28')][_0x320b('0x29')],_[_0x320b('0x2a')](_0x3e9c1d['body'],[_0x320b('0x29'),'id'])||{});}})[_0x320b('0x2b')](function(_0x12382e){logger[_0x320b('0x1a')](_0x320b('0x2c'),_0x3e9c1d);logger['debug']('AddTags',_0x3e9c1d,JSON[_0x320b('0x2d')](_0x12382e));_0x3385d4(_0x12382e);})[_0x320b('0x1b')](function(_0x586c10){logger['error'](_0x320b('0x2c'),_0x586c10[_0x320b('0x19')],_0x3e9c1d);_0x33c5c7(_this[_0x320b('0x17')](0x1f4,_0x586c10['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 828dc85..7d484c1 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 _0x101c=['smsInteraction:','save','update','length'];(function(_0xaa226c,_0x15f41e){var _0x2c1068=function(_0xcb1a5f){while(--_0xcb1a5f){_0xaa226c['push'](_0xaa226c['shift']());}};_0x2c1068(++_0x15f41e);}(_0x101c,0x171));var _0xc101=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x101c[_0x28f32c];return _0x355402;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xc101('0x0'),'remove',_0xc101('0x1')];function createListener(_0x4ce991,_0x345e59){return function(_0x1b45bb){_0x345e59['emit'](_0x4ce991,_0x1b45bb);};}function removeListener(_0x3d30c8,_0x32def3){return function(){SmsInteractionEvents['removeListener'](_0x3d30c8,_0x32def3);};}exports['register']=function(_0x56c0b8){for(var _0x598275=0x0,_0x245e62=events[_0xc101('0x2')];_0x598275<_0x245e62;_0x598275++){var _0x524abb=events[_0x598275];var _0x2e1348=createListener(_0xc101('0x3')+_0x524abb,_0x56c0b8);SmsInteractionEvents['on'](_0x524abb,_0x2e1348);}}; \ No newline at end of file +var _0x5888=['removeListener','register','length','./smsInteraction.events','remove','update'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x5888,0x1cb));var _0x8588=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x5888[_0x15876a];return _0xbd900f;};'use strict';var SmsInteractionEvents=require(_0x8588('0x0'));var events=['save',_0x8588('0x1'),_0x8588('0x2')];function createListener(_0x58d84c,_0xd1c01){return function(_0x420e1d){_0xd1c01['emit'](_0x58d84c,_0x420e1d);};}function removeListener(_0x209b22,_0x46f9db){return function(){SmsInteractionEvents[_0x8588('0x3')](_0x209b22,_0x46f9db);};}exports[_0x8588('0x4')]=function(_0x435c3f){for(var _0x46465b=0x0,_0x419a3c=events[_0x8588('0x5')];_0x46465b<_0x419a3c;_0x46465b++){var _0x382119=events[_0x46465b];var _0x4c92a1=createListener('smsInteraction:'+_0x382119,_0x435c3f);SmsInteractionEvents['on'](_0x382119,_0x4c92a1);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5b9dcdd..b60e4d0 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 _0xc2ff=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','delete','destroy','multer'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc2ff,0x195));var _0xfc2f=function(_0x20d295,_0x17b857){_0x20d295=_0x20d295-0x0;var _0x46a5fd=_0xc2ff[_0x20d295];return _0x46a5fd;};'use strict';var multer=require(_0xfc2f('0x0'));var util=require(_0xfc2f('0x1'));var path=require(_0xfc2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc2f('0x3'));var router=express[_0xfc2f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfc2f('0x5'));var interaction=require(_0xfc2f('0x6'));var config=require(_0xfc2f('0x7'));var controller=require(_0xfc2f('0x8'));router[_0xfc2f('0x9')]('/',auth[_0xfc2f('0xa')](),controller[_0xfc2f('0xb')]);router[_0xfc2f('0x9')](_0xfc2f('0xc'),auth['isAuthenticated'](),controller[_0xfc2f('0xd')]);router[_0xfc2f('0x9')](_0xfc2f('0xe'),auth[_0xfc2f('0xa')](),controller[_0xfc2f('0xf')]);router[_0xfc2f('0x10')]('/',auth[_0xfc2f('0xa')](),interaction[_0xfc2f('0x11')](_0xfc2f('0x12'),_0xfc2f('0x13')),controller[_0xfc2f('0x14')]);router[_0xfc2f('0x10')](_0xfc2f('0x15'),controller[_0xfc2f('0x16')]);router[_0xfc2f('0x17')](_0xfc2f('0xe'),auth['isAuthenticated'](),controller[_0xfc2f('0x18')]);router['put'](_0xfc2f('0x19'),auth[_0xfc2f('0xa')](),controller[_0xfc2f('0x1a')]);router[_0xfc2f('0x17')]('/:id/reject',auth[_0xfc2f('0xa')](),controller['reject']);router[_0xfc2f('0x1b')](_0xfc2f('0xe'),auth[_0xfc2f('0xa')](),controller[_0xfc2f('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x6a3c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','/:id/reject','delete','destroy','util','path'];(function(_0x3d3e5e,_0x5d2920){var _0x391dc9=function(_0x2185e0){while(--_0x2185e0){_0x3d3e5e['push'](_0x3d3e5e['shift']());}};_0x391dc9(++_0x5d2920);}(_0x6a3c,0x106));var _0xc6a3=function(_0x250bc3,_0x1b022a){_0x250bc3=_0x250bc3-0x0;var _0x1953a2=_0x6a3c[_0x250bc3];return _0x1953a2;};'use strict';var multer=require('multer');var util=require(_0xc6a3('0x0'));var path=require(_0xc6a3('0x1'));var timeout=require(_0xc6a3('0x2'));var express=require(_0xc6a3('0x3'));var router=express[_0xc6a3('0x4')]();var fs_extra=require(_0xc6a3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc6a3('0x6'));var config=require('../../config/environment');var controller=require(_0xc6a3('0x7'));router[_0xc6a3('0x8')]('/',auth[_0xc6a3('0x9')](),controller['index']);router[_0xc6a3('0x8')](_0xc6a3('0xa'),auth[_0xc6a3('0x9')](),controller['describe']);router[_0xc6a3('0x8')]('/:id',auth[_0xc6a3('0x9')](),controller['show']);router[_0xc6a3('0xb')]('/',auth[_0xc6a3('0x9')](),interaction[_0xc6a3('0xc')](_0xc6a3('0xd'),_0xc6a3('0xe')),controller[_0xc6a3('0xf')]);router[_0xc6a3('0xb')](_0xc6a3('0x10'),controller[_0xc6a3('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc6a3('0x12')]);router[_0xc6a3('0x13')](_0xc6a3('0x14'),auth[_0xc6a3('0x9')](),controller['accept']);router[_0xc6a3('0x13')](_0xc6a3('0x15'),auth[_0xc6a3('0x9')](),controller['reject']);router[_0xc6a3('0x16')]('/:id',auth[_0xc6a3('0x9')](),controller[_0xc6a3('0x17')]);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 64a99aa..0c2a19a 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 _0xc305=['out','STRING','DATE','TEXT','sequelize','medium','BOOLEAN'];(function(_0x24930c,_0xf01ff1){var _0x3ff362=function(_0x36f83b){while(--_0x36f83b){_0x24930c['push'](_0x24930c['shift']());}};_0x3ff362(++_0xf01ff1);}(_0xc305,0xcf));var _0x5c30=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xc305[_0x178f52];return _0x556f99;};'use strict';var Sequelize=require(_0x5c30('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5c30('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5c30('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5c30('0x3')),'defaultValue':_0x5c30('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c30('0x4')](0xbe)},'phone':{'type':Sequelize[_0x5c30('0x4')]},'readAt':{'type':Sequelize[_0x5c30('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5c30('0x4')]},'providerResponse':{'type':Sequelize[_0x5c30('0x6')]}}; \ No newline at end of file +var _0x864a=['BOOLEAN','STRING','sequelize','exports','TEXT','medium','out','DATE'];(function(_0x5c5409,_0x237ce5){var _0x29b7f1=function(_0x2407f8){while(--_0x2407f8){_0x5c5409['push'](_0x5c5409['shift']());}};_0x29b7f1(++_0x237ce5);}(_0x864a,0x8a));var _0xa864=function(_0x57b6e5,_0x5a8580){_0x57b6e5=_0x57b6e5-0x0;var _0x110145=_0x864a[_0x57b6e5];return _0x110145;};'use strict';var Sequelize=require(_0xa864('0x0'));module[_0xa864('0x1')]={'body':{'type':Sequelize[_0xa864('0x2')](_0xa864('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa864('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa864('0x5')]},'secret':{'type':Sequelize[_0xa864('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa864('0x7')]},'providerResponse':{'type':Sequelize[_0xa864('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3a02098..cfc7e22 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 _0x91ed=['indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','filters','query','fields','attributes','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','SmsMessage','include','findAll','rows','show','params','keys','intersection','includeAll','find','create','body','sms-interactions','accept','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[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','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','User','interface','SmsAccountId','inspect','twilio','MessageSid','messageId','plivo','MessageUUID'];(function(_0x4733d0,_0x19e1a4){var _0x4bffbf=function(_0x3d5808){while(--_0x3d5808){_0x4733d0['push'](_0x4733d0['shift']());}};_0x4bffbf(++_0x19e1a4);}(_0x91ed,0x99));var _0xd91e=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x91ed[_0x344a3f];return _0x264712;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd91e('0x0'));var jsonpatch=require(_0xd91e('0x1'));var rp=require('request-promise');var moment=require(_0xd91e('0x2'));var BPromise=require(_0xd91e('0x3'));var Mustache=require(_0xd91e('0x4'));var util=require('util');var path=require(_0xd91e('0x5'));var sox=require('sox');var csv=require(_0xd91e('0x6'));var ejs=require(_0xd91e('0x7'));var fs=require('fs');var fs_extra=require(_0xd91e('0x8'));var _=require('lodash');var squel=require(_0xd91e('0x9'));var crypto=require(_0xd91e('0xa'));var jsforce=require(_0xd91e('0xb'));var deskjs=require(_0xd91e('0xc'));var toCsv=require(_0xd91e('0x6'));var querystring=require(_0xd91e('0xd'));var Papa=require('papaparse');var Redis=require(_0xd91e('0xe'));var authService=require(_0xd91e('0xf'));var qs=require(_0xd91e('0x10'));var as=require(_0xd91e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd91e('0x12'))(_0xd91e('0x13'));var utils=require(_0xd91e('0x14'));var config=require(_0xd91e('0x15'));var licenseUtil=require(_0xd91e('0x16'));var db=require(_0xd91e('0x17'))['db'];config[_0xd91e('0x18')]=_['defaults'](config[_0xd91e('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd91e('0x18')]));require(_0xd91e('0x19'))[_0xd91e('0x1a')](socket);var jayson=require(_0xd91e('0x1b'));var client=jayson[_0xd91e('0x1c')][_0xd91e('0x1d')]({'port':0x232c});var client9002=jayson[_0xd91e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387cf2,_0x609dba,_0x1be080,_0x41fe6f){return new BPromise(function(_0xfb8207,_0x7d5aee){var _0x3f58f=_0x41fe6f||client;return _0x3f58f[_0xd91e('0x1e')](_0x387cf2,_0x1be080)[_0xd91e('0x1f')](function(_0x604957){logger['info'](_0xd91e('0x20'),_0x609dba,_0xd91e('0x21'));logger[_0xd91e('0x22')](_0xd91e('0x23'),_0x609dba,_0xd91e('0x21'),JSON[_0xd91e('0x24')](_0x604957));if(_0x604957[_0xd91e('0x25')]){if(_0x604957[_0xd91e('0x25')][_0xd91e('0x26')]===0x1f4){logger[_0xd91e('0x25')](_0xd91e('0x20'),_0x609dba,_0x604957[_0xd91e('0x25')]['message']);return _0x7d5aee(_0x604957[_0xd91e('0x25')]['message']);}logger[_0xd91e('0x25')]('SmsMessage,\x20%s,\x20%s',_0x609dba,_0x604957[_0xd91e('0x25')][_0xd91e('0x27')]);return _0xfb8207(_0x604957[_0xd91e('0x25')]['message']);}else{logger['info'](_0xd91e('0x20'),_0x609dba,_0xd91e('0x21'));_0xfb8207(_0x604957[_0xd91e('0x28')][_0xd91e('0x27')]);}})[_0xd91e('0x29')](function(_0x19a814){logger['error'](_0xd91e('0x20'),_0x609dba,_0x19a814);_0x7d5aee(_0x19a814);});});}function respondWithStatusCode(_0x103c5b,_0x3a0165){_0x3a0165=_0x3a0165||0xcc;return function(_0x5edf8b){if(_0x5edf8b){return _0x103c5b[_0xd91e('0x2a')](_0x3a0165);}return _0x103c5b[_0xd91e('0x2b')](_0x3a0165)['end']();};}function respondWithResult(_0x39f93a,_0x5b60bb){_0x5b60bb=_0x5b60bb||0xc8;return function(_0x322723){if(_0x322723){return _0x39f93a[_0xd91e('0x2b')](_0x5b60bb)[_0xd91e('0x2c')](_0x322723);}};}function respondWithFilteredResult(_0x72706a,_0x5eddf5){return function(_0x284978){if(_0x284978){var _0x11d248=typeof _0x5eddf5[_0xd91e('0x2d')]===_0xd91e('0x2e')&&typeof _0x5eddf5['limit']===_0xd91e('0x2e');var _0x193136=_0x284978[_0xd91e('0x2f')];var _0x168134=_0x11d248?0x0:_0x5eddf5[_0xd91e('0x2d')];var _0x2f0511=_0x11d248?_0x284978[_0xd91e('0x2f')]:_0x5eddf5[_0xd91e('0x2d')]+_0x5eddf5[_0xd91e('0x30')];var _0x4eac70;if(_0x2f0511>=_0x193136){_0x2f0511=_0x193136;_0x4eac70=0xc8;}else{_0x4eac70=0xce;}_0x72706a['status'](_0x4eac70);return _0x72706a[_0xd91e('0x31')](_0xd91e('0x32'),_0x168134+'-'+_0x2f0511+'/'+_0x193136)['json'](_0x284978);}return null;};}function patchUpdates(_0xd1437e){return function(_0x433c9e){try{jsonpatch[_0xd91e('0x33')](_0x433c9e,_0xd1437e,!![]);}catch(_0x15f71e){return BPromise[_0xd91e('0x34')](_0x15f71e);}return _0x433c9e[_0xd91e('0x35')]();};}function saveUpdates(_0x36a7df,_0x5ab138){return function(_0x330bc4){if(_0x330bc4){return _0x330bc4[_0xd91e('0x36')](_0x36a7df)[_0xd91e('0x1f')](function(_0x6ce756){return _0x6ce756;});}return null;};}function removeEntity(_0x12fe05,_0x45fbc2){return function(_0x1a3dbb){if(_0x1a3dbb){return _0x1a3dbb[_0xd91e('0x37')]()[_0xd91e('0x1f')](function(){_0x12fe05['status'](0xcc)[_0xd91e('0x38')]();});}};}function handleEntityNotFound(_0x3198f9,_0x21ce29){return function(_0x2f938e){if(!_0x2f938e){_0x3198f9[_0xd91e('0x2a')](0x194);}return _0x2f938e;};}function handleError(_0x2438e3,_0x29910b){_0x29910b=_0x29910b||0x1f4;return function(_0xc9e2d5){logger[_0xd91e('0x25')](_0xc9e2d5[_0xd91e('0x39')]);if(_0xc9e2d5['name']){delete _0xc9e2d5[_0xd91e('0x3a')];}_0x2438e3[_0xd91e('0x2b')](_0x29910b)[_0xd91e('0x3b')](_0xc9e2d5);};}exports[_0xd91e('0x3c')]=function(_0x303132,_0x3c4ef3){var _0x312bcc={},_0x382cf7={},_0x18c3ee={'count':0x0,'rows':[]};var _0x493725=_[_0xd91e('0x3d')](db['SmsMessage'][_0xd91e('0x3e')],function(_0x2b5b0e){return{'name':_0x2b5b0e[_0xd91e('0x3f')],'type':_0x2b5b0e[_0xd91e('0x40')]['key']};});_0x382cf7[_0xd91e('0x41')]=_['map'](_0x493725,_0xd91e('0x3a'));_0x382cf7['query']=_['keys'](_0x303132['query']);_0x382cf7[_0xd91e('0x42')]=_['intersection'](_0x382cf7[_0xd91e('0x41')],_0x382cf7[_0xd91e('0x43')]);_0x312bcc['attributes']=_['intersection'](_0x382cf7['model'],qs[_0xd91e('0x44')](_0x303132['query'][_0xd91e('0x44')]));_0x312bcc[_0xd91e('0x45')]=_0x312bcc[_0xd91e('0x45')]['length']?_0x312bcc[_0xd91e('0x45')]:_0x382cf7[_0xd91e('0x41')];if(!_0x303132[_0xd91e('0x43')]['hasOwnProperty'](_0xd91e('0x46'))){_0x312bcc['limit']=qs[_0xd91e('0x30')](_0x303132[_0xd91e('0x43')][_0xd91e('0x30')]);_0x312bcc[_0xd91e('0x2d')]=qs['offset'](_0x303132[_0xd91e('0x43')][_0xd91e('0x2d')]);}_0x312bcc[_0xd91e('0x47')]=qs[_0xd91e('0x48')](_0x303132[_0xd91e('0x43')][_0xd91e('0x48')]);_0x312bcc['where']=qs[_0xd91e('0x42')](_[_0xd91e('0x49')](_0x303132[_0xd91e('0x43')],_0x382cf7['filters']),_0x493725);if(_0x303132[_0xd91e('0x43')]['filter']){_0x312bcc[_0xd91e('0x4a')]=_['merge'](_0x312bcc[_0xd91e('0x4a')],{'$or':_[_0xd91e('0x3d')](_0x493725,function(_0x2acd7d){if(_0x2acd7d[_0xd91e('0x40')]!==_0xd91e('0x4b')){var _0x55b89e={};_0x55b89e[_0x2acd7d[_0xd91e('0x3a')]]={'$like':'%'+_0x303132['query'][_0xd91e('0x4c')]+'%'};return _0x55b89e;}})});}_0x312bcc=_[_0xd91e('0x4d')]({},_0x312bcc,_0x303132[_0xd91e('0x4e')]);var _0x48b749={'where':_0x312bcc[_0xd91e('0x4a')]};return db[_0xd91e('0x4f')][_0xd91e('0x2f')](_0x48b749)[_0xd91e('0x1f')](function(_0x28fd4e){_0x18c3ee[_0xd91e('0x2f')]=_0x28fd4e;if(_0x303132[_0xd91e('0x43')]['includeAll']){_0x312bcc[_0xd91e('0x50')]=[{'all':!![]}];}return db[_0xd91e('0x4f')][_0xd91e('0x51')](_0x312bcc);})['then'](function(_0x23520a){_0x18c3ee[_0xd91e('0x52')]=_0x23520a;return _0x18c3ee;})[_0xd91e('0x1f')](respondWithFilteredResult(_0x3c4ef3,_0x312bcc))[_0xd91e('0x29')](handleError(_0x3c4ef3,null));};exports[_0xd91e('0x53')]=function(_0x1ffabf,_0x4404b7){var _0x596821={'raw':!![],'where':{'id':_0x1ffabf[_0xd91e('0x54')]['id']}},_0x4087ea={};_0x4087ea[_0xd91e('0x41')]=_[_0xd91e('0x55')](db[_0xd91e('0x4f')][_0xd91e('0x3e')]);_0x4087ea[_0xd91e('0x43')]=_[_0xd91e('0x55')](_0x1ffabf['query']);_0x4087ea[_0xd91e('0x42')]=_[_0xd91e('0x56')](_0x4087ea[_0xd91e('0x41')],_0x4087ea[_0xd91e('0x43')]);_0x596821['attributes']=_['intersection'](_0x4087ea[_0xd91e('0x41')],qs[_0xd91e('0x44')](_0x1ffabf['query']['fields']));_0x596821[_0xd91e('0x45')]=_0x596821[_0xd91e('0x45')]['length']?_0x596821[_0xd91e('0x45')]:_0x4087ea[_0xd91e('0x41')];if(_0x1ffabf[_0xd91e('0x43')][_0xd91e('0x57')]){_0x596821['include']=[{'all':!![]}];}_0x596821=_[_0xd91e('0x4d')]({},_0x596821,_0x1ffabf[_0xd91e('0x4e')]);return db[_0xd91e('0x4f')][_0xd91e('0x58')](_0x596821)[_0xd91e('0x1f')](handleEntityNotFound(_0x4404b7,null))[_0xd91e('0x1f')](respondWithResult(_0x4404b7,null))['catch'](handleError(_0x4404b7,null));};exports[_0xd91e('0x59')]=function(_0x230922,_0xe8a6b6){return db[_0xd91e('0x4f')][_0xd91e('0x59')](_0x230922[_0xd91e('0x5a')],{})[_0xd91e('0x1f')](respondWithResult(_0xe8a6b6,0xc9))[_0xd91e('0x29')](handleError(_0xe8a6b6,null));};exports['update']=function(_0x5183fb,_0x9b6677){if(_0x5183fb['body']['id']){delete _0x5183fb[_0xd91e('0x5a')]['id'];}return db[_0xd91e('0x4f')][_0xd91e('0x58')]({'where':{'id':_0x5183fb[_0xd91e('0x54')]['id']}})['then'](handleEntityNotFound(_0x9b6677,null))[_0xd91e('0x1f')](saveUpdates(_0x5183fb['body'],null))[_0xd91e('0x1f')](respondWithResult(_0x9b6677,null))[_0xd91e('0x29')](handleError(_0x9b6677,null));};exports['destroy']=function(_0xd8a995,_0x374026){return db['SmsMessage'][_0xd91e('0x58')]({'where':{'id':_0xd8a995[_0xd91e('0x54')]['id']}})[_0xd91e('0x1f')](handleEntityNotFound(_0x374026,null))[_0xd91e('0x1f')](removeEntity(_0x374026,null))['catch'](handleError(_0x374026,null));};exports['describe']=function(_0x55300f,_0xffeee0){return db['SmsMessage']['describe']()['then'](respondWithResult(_0xffeee0,null))[_0xd91e('0x29')](handleError(_0xffeee0,null));};var interaction_log=require(_0xd91e('0x12'))(_0xd91e('0x5b'));exports[_0xd91e('0x5c')]=function(_0x1717a6,_0x185ab1,_0x4fbe68){var _0x2b0c8f={'agent':{},'channel':'sms'};if(_0x1717a6[_0xd91e('0x5a')]['id']){delete _0x1717a6[_0xd91e('0x5a')]['id'];}_0x1717a6['body']['read']=!![];_0x1717a6[_0xd91e('0x5a')]['readAt']=moment()[_0xd91e('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1717a6[_0xd91e('0x5a')]['UserId']=_0x1717a6[_0xd91e('0x5a')][_0xd91e('0x5e')]||_0x1717a6[_0xd91e('0x5f')]['id'];_0x2b0c8f[_0xd91e('0x60')]['id']=_0x1717a6[_0xd91e('0x5a')]['UserId'];return db[_0xd91e('0x4f')]['find']({'where':{'id':_0x1717a6[_0xd91e('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x185ab1,null))[_0xd91e('0x1f')](saveUpdates(_0x1717a6['body'],null))[_0xd91e('0x1f')](function(_0x273131){if(_0x273131){_0x2b0c8f['message']=_0x273131[_0xd91e('0x61')]({'plain':!![]});return db[_0xd91e('0x62')]['find']({'where':{'id':_0x273131[_0xd91e('0x63')]}});}return null;})[_0xd91e('0x1f')](handleEntityNotFound(_0x185ab1,null))['then'](function(_0x18f3e8){if(_0x18f3e8){return _0x18f3e8[_0xd91e('0x36')]({'UserId':_0x1717a6[_0xd91e('0x5a')]['UserId'],'read1stAt':_[_0xd91e('0x64')](_0x18f3e8[_0xd91e('0x65')])?moment()[_0xd91e('0x5d')](_0xd91e('0x66')):undefined});}return null;})['then'](function(_0x9e0fa8){if(_0x9e0fa8){_0x2b0c8f[_0xd91e('0x67')]=_0x9e0fa8['get']({'plain':!![]});interaction_log[_0xd91e('0x68')](_0xd91e('0x69'),_0x1717a6[_0xd91e('0x5f')]['id'],_0x1717a6[_0xd91e('0x5f')][_0xd91e('0x3a')],_0x1717a6[_0xd91e('0x5f')]['role'],_0x2b0c8f[_0xd91e('0x67')]['id'],_0x1717a6[_0xd91e('0x5a')]?JSON[_0xd91e('0x24')](_0x1717a6['body']):_0xd91e('0x6a'));return respondWithRpcPromise(_0xd91e('0x6b'),_0xd91e('0x6c'),_0x2b0c8f);}return null;})['then'](function(_0x195300){var _0x294028=_0xd91e('0x6d')+_0x195300[_0xd91e('0x27')]['ContactId'];return db[_0xd91e('0x6e')]['query'](_0x294028,{'type':db[_0xd91e('0x6f')][_0xd91e('0x70')][_0xd91e('0x71')],'raw':!![]})[_0xd91e('0x1f')](function(_0x3a7a86){return _0x3a7a86;});})[_0xd91e('0x1f')](function(_0x4cfcf3){if(_0x4cfcf3){_0x2b0c8f[_0xd91e('0x27')][_0xd91e('0x72')]=_0x4cfcf3[0x0];if(!_0x1717a6[_0xd91e('0x5a')][_0xd91e('0x5e')])return;return db['User'][_0xd91e('0x58')]({'where':{'id':_0x1717a6[_0xd91e('0x5a')][_0xd91e('0x5e')],'role':'agent'},'attributes':['id',_0xd91e('0x3a'),_0xd91e('0x73'),_0xd91e('0x74'),_0xd91e('0x75')],'raw':!![]});}return null;})[_0xd91e('0x1f')](function(_0x422331){if(!_0x422331)return null;_0x2b0c8f['message'][_0xd91e('0x60')]=_0x422331;return _0x2b0c8f;})[_0xd91e('0x1f')](function(_0x3678d3){if(_0x3678d3){if(_0x1717a6['body'][_0xd91e('0x76')]){_0x2b0c8f[_0xd91e('0x27')]['interface']=util[_0xd91e('0x5d')](_0xd91e('0x77'),_0x1717a6[_0xd91e('0x5f')][_0xd91e('0x3a')]);_0x2b0c8f[_0xd91e('0x27')][_0xd91e('0x78')]=_0x2b0c8f[_0xd91e('0x78')];_0x2b0c8f[_0xd91e('0x27')][_0xd91e('0x79')]=_0x2b0c8f[_0xd91e('0x78')];_0x2b0c8f[_0xd91e('0x27')][_0xd91e('0x7a')]=_0xd91e('0x5c');return respondWithRpcPromise(_0xd91e('0x7b'),_0xd91e('0x7b'),{'event':'acceptmessage','message':_0x2b0c8f['message']},client9002)[_0xd91e('0x1f')](function(){return _0x2b0c8f;});}return _0x2b0c8f;}return null;})[_0xd91e('0x1f')](respondWithResult(_0x185ab1,null))[_0xd91e('0x29')](handleError(_0x185ab1,null));};var interaction_log=require(_0xd91e('0x12'))(_0xd91e('0x5b'));exports[_0xd91e('0x34')]=function(_0x2af71e,_0x132f2f,_0x4d48d9){var _0x228625={'agent':{},'channel':_0xd91e('0x7c')};if(_0x2af71e['body']['id']){delete _0x2af71e[_0xd91e('0x5a')]['id'];}_0x2af71e['body'][_0xd91e('0x5e')]=_0x2af71e['body'][_0xd91e('0x5e')]||_0x2af71e[_0xd91e('0x5f')]['id'];_0x228625[_0xd91e('0x60')]['id']=_0x2af71e[_0xd91e('0x5a')][_0xd91e('0x5e')];return db['SmsMessage']['find']({'where':{'id':_0x2af71e[_0xd91e('0x54')]['id'],'UserId':null}})[_0xd91e('0x1f')](handleEntityNotFound(_0x132f2f,null))[_0xd91e('0x1f')](function(_0x398bcc){if(_0x398bcc){_0x228625[_0xd91e('0x27')]=_0x398bcc[_0xd91e('0x61')]({'plain':!![]});return db[_0xd91e('0x62')][_0xd91e('0x58')]({'where':{'id':_0x398bcc['SmsInteractionId']}});}return null;})[_0xd91e('0x1f')](handleEntityNotFound(_0x132f2f,null))[_0xd91e('0x1f')](function(_0xa0e152){if(_0xa0e152){_0x228625[_0xd91e('0x67')]=_0xa0e152[_0xd91e('0x61')]({'plain':!![]});interaction_log[_0xd91e('0x68')](_0xd91e('0x7d'),_0x2af71e[_0xd91e('0x5f')]['id'],_0x2af71e['user']['name'],_0x2af71e[_0xd91e('0x5f')][_0xd91e('0x7e')],_0x228625[_0xd91e('0x67')]['id'],_0x2af71e['body']?JSON[_0xd91e('0x24')](_0x2af71e[_0xd91e('0x5a')]):_0xd91e('0x6a'));return respondWithRpcPromise(_0xd91e('0x7f'),'rejectMessage',_0x228625);}return null;})['then'](function(_0x46812b){var _0x4d1bab=_0xd91e('0x6d')+_0x46812b[_0xd91e('0x27')]['ContactId'];return db[_0xd91e('0x6e')][_0xd91e('0x43')](_0x4d1bab,{'type':db[_0xd91e('0x6f')][_0xd91e('0x70')][_0xd91e('0x71')],'raw':!![]})[_0xd91e('0x1f')](function(_0x20baed){return _0x20baed;});})[_0xd91e('0x1f')](function(_0x2ed142){if(_0x2ed142){_0x228625[_0xd91e('0x27')]['contact']=_0x2ed142[0x0];if(!_0x2af71e['body'][_0xd91e('0x5e')])return;return db[_0xd91e('0x80')][_0xd91e('0x58')]({'where':{'id':_0x2af71e[_0xd91e('0x5a')][_0xd91e('0x5e')],'role':_0xd91e('0x60')},'attributes':['id',_0xd91e('0x3a'),'fullname',_0xd91e('0x74'),_0xd91e('0x75')],'raw':!![]});}return null;})[_0xd91e('0x1f')](function(_0x13c465){if(!_0x13c465)return null;_0x228625[_0xd91e('0x27')][_0xd91e('0x60')]=_0x13c465;return _0x228625;})[_0xd91e('0x1f')](function(_0x28de8e){if(_0x28de8e){_0x28de8e[_0xd91e('0x27')][_0xd91e('0x81')]=util[_0xd91e('0x5d')]('SIP/%s',_0x2af71e['user'][_0xd91e('0x3a')]);_0x28de8e[_0xd91e('0x27')][_0xd91e('0x78')]=_0x228625[_0xd91e('0x78')];_0x28de8e[_0xd91e('0x27')][_0xd91e('0x79')]=_0x228625[_0xd91e('0x78')];_0x28de8e[_0xd91e('0x27')]['event']=_0xd91e('0x34');respondWithRpcPromise(_0xd91e('0x7b'),_0xd91e('0x7b'),{'event':'rejectmessage','message':_0x28de8e[_0xd91e('0x27')]},client9002);return _0x228625;}return null;})[_0xd91e('0x1f')](respondWithResult(_0x132f2f,null))[_0xd91e('0x29')](handleError(_0x132f2f,null));};exports[_0xd91e('0x2b')]=function(_0x5169da,_0x4d88e9,_0x335a59){if(_0x5169da['body']['id']){delete _0x5169da[_0xd91e('0x5a')]['id'];}var _0xc6070e;return db[_0xd91e('0x4f')][_0xd91e('0x58')]({'where':{'id':_0x5169da[_0xd91e('0x54')]['id']}})[_0xd91e('0x1f')](handleEntityNotFound(_0x4d88e9,null))['then'](function(_0x3ff47d){if(_0x3ff47d){_0xc6070e=_0x3ff47d;return db['SmsAccount'][_0xd91e('0x58')]({'where':{'id':_0x3ff47d[_0xd91e('0x82')]}});}})[_0xd91e('0x1f')](handleEntityNotFound(_0x4d88e9,null))[_0xd91e('0x1f')](function(_0x2fc99e){if(_0x2fc99e){logger[_0xd91e('0x22')](_0xd91e('0x23'),'status','received\x20delivery\x20report\x20from',_0x2fc99e[_0xd91e('0x40')],util[_0xd91e('0x83')](_0x5169da['body'],{'showHidden':![],'depth':null}));switch(_0x2fc99e[_0xd91e('0x40')]){case _0xd91e('0x84'):if(_0x5169da[_0xd91e('0x5a')][_0xd91e('0x85')]&&_0x5169da[_0xd91e('0x5a')][_0xd91e('0x85')]===_0xc6070e[_0xd91e('0x86')]){return _0xc6070e[_0xd91e('0x36')]({'read':!![]});}else{logger[_0xd91e('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd91e('0x2b'),_0xd91e('0x84'),util[_0xd91e('0x83')](_0x5169da[_0xd91e('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xd91e('0x87'):if(_0x5169da[_0xd91e('0x5a')][_0xd91e('0x88')]&&_0x5169da[_0xd91e('0x5a')][_0xd91e('0x88')]===_0xc6070e[_0xd91e('0x86')]&&_[_0xd91e('0x89')]([_0xd91e('0x8a'),_0xd91e('0x8b')],_0x5169da[_0xd91e('0x5a')][_0xd91e('0x8c')])>=0x0){return _0xc6070e[_0xd91e('0x36')]({'read':!![]});}else{logger['error'](_0xd91e('0x8d'),_0xd91e('0x2b'),_0xd91e('0x8e'),util[_0xd91e('0x83')](_0x5169da[_0xd91e('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xd91e('0x8f'):var _0x3690ed=_0x5169da[_0xd91e('0x5a')]['results'][0x0];if(_0x3690ed[_0xd91e('0x2b')][_0xd91e('0x90')]==='DELIVERED'){return _0xc6070e['update']({'read':!![]});}else{logger[_0xd91e('0x25')](_0xd91e('0x8d'),_0xd91e('0x2b'),_0xd91e('0x8f'),util['inspect'](_0x5169da[_0xd91e('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xc6070e;}})[_0xd91e('0x1f')](respondWithResult(_0x4d88e9,null))[_0xd91e('0x29')](handleError(_0x4d88e9,null));}; \ No newline at end of file +var _0xd4ad=['UserId','user','agent','get','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','event','EventManager','acceptmessage','sms-interactions','reject','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','fullname','SIP/%s','motionChannel','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','client','request','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','stack','name','index','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SmsMessage','then','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x236f3d,_0x74a251){var _0xc45c34=function(_0x1bd75b){while(--_0x1bd75b){_0x236f3d['push'](_0x236f3d['shift']());}};_0xc45c34(++_0x74a251);}(_0xd4ad,0x158));var _0xdd4a=function(_0x18fc78,_0x53d72b){_0x18fc78=_0x18fc78-0x0;var _0x23d2b4=_0xd4ad[_0x18fc78];return _0x23d2b4;};'use strict';var emlformat=require(_0xdd4a('0x0'));var rimraf=require(_0xdd4a('0x1'));var zipdir=require(_0xdd4a('0x2'));var jsonpatch=require(_0xdd4a('0x3'));var rp=require('request-promise');var moment=require(_0xdd4a('0x4'));var BPromise=require(_0xdd4a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd4a('0x6'));var sox=require(_0xdd4a('0x7'));var csv=require('to-csv');var ejs=require(_0xdd4a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd4a('0x9'));var squel=require(_0xdd4a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdd4a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd4a('0xc'));var querystring=require(_0xdd4a('0xd'));var Papa=require(_0xdd4a('0xe'));var Redis=require(_0xdd4a('0xf'));var authService=require(_0xdd4a('0x10'));var qs=require(_0xdd4a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd4a('0x12'))('api');var utils=require(_0xdd4a('0x13'));var config=require(_0xdd4a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd4a('0x15'))['db'];config[_0xdd4a('0x16')]=_['defaults'](config[_0xdd4a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd4a('0x17'))(new Redis(config['redis']));require(_0xdd4a('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdd4a('0x19')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2971b6,_0x898d87,_0xe41bc0,_0x2bdd14){return new BPromise(function(_0x37d755,_0x335bb6){var _0x154364=_0x2bdd14||client;return _0x154364[_0xdd4a('0x1a')](_0x2971b6,_0xe41bc0)['then'](function(_0x3c3fdd){logger[_0xdd4a('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x898d87,_0xdd4a('0x1c'));logger[_0xdd4a('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x898d87,_0xdd4a('0x1c'),JSON[_0xdd4a('0x1e')](_0x3c3fdd));if(_0x3c3fdd[_0xdd4a('0x1f')]){if(_0x3c3fdd[_0xdd4a('0x1f')][_0xdd4a('0x20')]===0x1f4){logger[_0xdd4a('0x1f')](_0xdd4a('0x21'),_0x898d87,_0x3c3fdd['error']['message']);return _0x335bb6(_0x3c3fdd['error']['message']);}logger[_0xdd4a('0x1f')](_0xdd4a('0x21'),_0x898d87,_0x3c3fdd[_0xdd4a('0x1f')][_0xdd4a('0x22')]);return _0x37d755(_0x3c3fdd[_0xdd4a('0x1f')]['message']);}else{logger[_0xdd4a('0x1b')](_0xdd4a('0x21'),_0x898d87,_0xdd4a('0x1c'));_0x37d755(_0x3c3fdd[_0xdd4a('0x23')]['message']);}})['catch'](function(_0x5301ee){logger['error'](_0xdd4a('0x21'),_0x898d87,_0x5301ee);_0x335bb6(_0x5301ee);});});}function respondWithStatusCode(_0x516667,_0x537099){_0x537099=_0x537099||0xcc;return function(_0x26846d){if(_0x26846d){return _0x516667[_0xdd4a('0x24')](_0x537099);}return _0x516667[_0xdd4a('0x25')](_0x537099)[_0xdd4a('0x26')]();};}function respondWithResult(_0x6eaea3,_0x28e499){_0x28e499=_0x28e499||0xc8;return function(_0x4d2b89){if(_0x4d2b89){return _0x6eaea3[_0xdd4a('0x25')](_0x28e499)[_0xdd4a('0x27')](_0x4d2b89);}};}function respondWithFilteredResult(_0x540597,_0x10cf52){return function(_0x48cd1e){if(_0x48cd1e){var _0x5f1a9e=typeof _0x10cf52[_0xdd4a('0x28')]===_0xdd4a('0x29')&&typeof _0x10cf52[_0xdd4a('0x2a')]==='undefined';var _0x117d2a=_0x48cd1e[_0xdd4a('0x2b')];var _0x292d67=_0x5f1a9e?0x0:_0x10cf52['offset'];var _0x2b6d01=_0x5f1a9e?_0x48cd1e['count']:_0x10cf52[_0xdd4a('0x28')]+_0x10cf52[_0xdd4a('0x2a')];var _0x87a9a7;if(_0x2b6d01>=_0x117d2a){_0x2b6d01=_0x117d2a;_0x87a9a7=0xc8;}else{_0x87a9a7=0xce;}_0x540597['status'](_0x87a9a7);return _0x540597[_0xdd4a('0x2c')](_0xdd4a('0x2d'),_0x292d67+'-'+_0x2b6d01+'/'+_0x117d2a)['json'](_0x48cd1e);}return null;};}function patchUpdates(_0x40c826){return function(_0x456627){try{jsonpatch['apply'](_0x456627,_0x40c826,!![]);}catch(_0x17f253){return BPromise['reject'](_0x17f253);}return _0x456627[_0xdd4a('0x2e')]();};}function saveUpdates(_0x20c9d5,_0x122d4a){return function(_0x342182){if(_0x342182){return _0x342182[_0xdd4a('0x2f')](_0x20c9d5)['then'](function(_0x1bc986){return _0x1bc986;});}return null;};}function removeEntity(_0xff5437,_0x32abdd){return function(_0x18777b){if(_0x18777b){return _0x18777b[_0xdd4a('0x30')]()['then'](function(){_0xff5437['status'](0xcc)[_0xdd4a('0x26')]();});}};}function handleEntityNotFound(_0x19b9df,_0x50c38d){return function(_0x187660){if(!_0x187660){_0x19b9df['sendStatus'](0x194);}return _0x187660;};}function handleError(_0x1fd026,_0x14b9b0){_0x14b9b0=_0x14b9b0||0x1f4;return function(_0x52abd1){logger[_0xdd4a('0x1f')](_0x52abd1[_0xdd4a('0x31')]);if(_0x52abd1['name']){delete _0x52abd1[_0xdd4a('0x32')];}_0x1fd026['status'](_0x14b9b0)['send'](_0x52abd1);};}exports[_0xdd4a('0x33')]=function(_0x26cb9e,_0x1d4eed){var _0x441646={},_0x2b2cc6={},_0x72710b={'count':0x0,'rows':[]};var _0x3f676e=_['map'](db['SmsMessage'][_0xdd4a('0x34')],function(_0x2f4417){return{'name':_0x2f4417['fieldName'],'type':_0x2f4417[_0xdd4a('0x35')][_0xdd4a('0x36')]};});_0x2b2cc6[_0xdd4a('0x37')]=_[_0xdd4a('0x38')](_0x3f676e,'name');_0x2b2cc6['query']=_[_0xdd4a('0x39')](_0x26cb9e[_0xdd4a('0x3a')]);_0x2b2cc6[_0xdd4a('0x3b')]=_['intersection'](_0x2b2cc6[_0xdd4a('0x37')],_0x2b2cc6[_0xdd4a('0x3a')]);_0x441646[_0xdd4a('0x3c')]=_[_0xdd4a('0x3d')](_0x2b2cc6[_0xdd4a('0x37')],qs['fields'](_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x3e')]));_0x441646[_0xdd4a('0x3c')]=_0x441646[_0xdd4a('0x3c')][_0xdd4a('0x3f')]?_0x441646['attributes']:_0x2b2cc6[_0xdd4a('0x37')];if(!_0x26cb9e[_0xdd4a('0x3a')]['hasOwnProperty'](_0xdd4a('0x40'))){_0x441646[_0xdd4a('0x2a')]=qs[_0xdd4a('0x2a')](_0x26cb9e[_0xdd4a('0x3a')]['limit']);_0x441646['offset']=qs[_0xdd4a('0x28')](_0x26cb9e['query'][_0xdd4a('0x28')]);}_0x441646[_0xdd4a('0x41')]=qs[_0xdd4a('0x42')](_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x42')]);_0x441646[_0xdd4a('0x43')]=qs[_0xdd4a('0x3b')](_['pick'](_0x26cb9e[_0xdd4a('0x3a')],_0x2b2cc6[_0xdd4a('0x3b')]),_0x3f676e);if(_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x44')]){_0x441646[_0xdd4a('0x43')]=_['merge'](_0x441646[_0xdd4a('0x43')],{'$or':_[_0xdd4a('0x38')](_0x3f676e,function(_0x3572fb){if(_0x3572fb[_0xdd4a('0x35')]!==_0xdd4a('0x45')){var _0x235f1b={};_0x235f1b[_0x3572fb[_0xdd4a('0x32')]]={'$like':'%'+_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x44')]+'%'};return _0x235f1b;}})});}_0x441646=_[_0xdd4a('0x46')]({},_0x441646,_0x26cb9e[_0xdd4a('0x47')]);var _0x2e1544={'where':_0x441646[_0xdd4a('0x43')]};return db[_0xdd4a('0x48')][_0xdd4a('0x2b')](_0x2e1544)[_0xdd4a('0x49')](function(_0x583cfb){_0x72710b[_0xdd4a('0x2b')]=_0x583cfb;if(_0x26cb9e['query'][_0xdd4a('0x4a')]){_0x441646[_0xdd4a('0x4b')]=[{'all':!![]}];}return db[_0xdd4a('0x48')][_0xdd4a('0x4c')](_0x441646);})[_0xdd4a('0x49')](function(_0x543b31){_0x72710b[_0xdd4a('0x4d')]=_0x543b31;return _0x72710b;})['then'](respondWithFilteredResult(_0x1d4eed,_0x441646))['catch'](handleError(_0x1d4eed,null));};exports[_0xdd4a('0x4e')]=function(_0x24da0c,_0x1df8ee){var _0x5ef072={'raw':!![],'where':{'id':_0x24da0c[_0xdd4a('0x4f')]['id']}},_0x36d033={};_0x36d033['model']=_[_0xdd4a('0x39')](db[_0xdd4a('0x48')]['rawAttributes']);_0x36d033[_0xdd4a('0x3a')]=_[_0xdd4a('0x39')](_0x24da0c['query']);_0x36d033[_0xdd4a('0x3b')]=_[_0xdd4a('0x3d')](_0x36d033['model'],_0x36d033[_0xdd4a('0x3a')]);_0x5ef072[_0xdd4a('0x3c')]=_[_0xdd4a('0x3d')](_0x36d033[_0xdd4a('0x37')],qs[_0xdd4a('0x3e')](_0x24da0c['query']['fields']));_0x5ef072[_0xdd4a('0x3c')]=_0x5ef072[_0xdd4a('0x3c')][_0xdd4a('0x3f')]?_0x5ef072[_0xdd4a('0x3c')]:_0x36d033[_0xdd4a('0x37')];if(_0x24da0c['query'][_0xdd4a('0x4a')]){_0x5ef072[_0xdd4a('0x4b')]=[{'all':!![]}];}_0x5ef072=_[_0xdd4a('0x46')]({},_0x5ef072,_0x24da0c[_0xdd4a('0x47')]);return db[_0xdd4a('0x48')]['find'](_0x5ef072)['then'](handleEntityNotFound(_0x1df8ee,null))[_0xdd4a('0x49')](respondWithResult(_0x1df8ee,null))['catch'](handleError(_0x1df8ee,null));};exports[_0xdd4a('0x50')]=function(_0x303f3b,_0xc5b22){return db[_0xdd4a('0x48')][_0xdd4a('0x50')](_0x303f3b[_0xdd4a('0x51')],{})['then'](respondWithResult(_0xc5b22,0xc9))[_0xdd4a('0x52')](handleError(_0xc5b22,null));};exports[_0xdd4a('0x2f')]=function(_0xa71a66,_0x5f097e){if(_0xa71a66[_0xdd4a('0x51')]['id']){delete _0xa71a66['body']['id'];}return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0xa71a66['params']['id']}})['then'](handleEntityNotFound(_0x5f097e,null))[_0xdd4a('0x49')](saveUpdates(_0xa71a66[_0xdd4a('0x51')],null))[_0xdd4a('0x49')](respondWithResult(_0x5f097e,null))['catch'](handleError(_0x5f097e,null));};exports[_0xdd4a('0x30')]=function(_0x419c1f,_0x5dcfe1){return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x419c1f[_0xdd4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5dcfe1,null))['then'](removeEntity(_0x5dcfe1,null))[_0xdd4a('0x52')](handleError(_0x5dcfe1,null));};exports[_0xdd4a('0x54')]=function(_0x2cdcff,_0x36a6d3){return db[_0xdd4a('0x48')][_0xdd4a('0x54')]()['then'](respondWithResult(_0x36a6d3,null))[_0xdd4a('0x52')](handleError(_0x36a6d3,null));};var interaction_log=require(_0xdd4a('0x12'))('sms-interactions');exports[_0xdd4a('0x55')]=function(_0x5040b4,_0x342d4f,_0x14fbb9){var _0x371ca3={'agent':{},'channel':_0xdd4a('0x56')};if(_0x5040b4[_0xdd4a('0x51')]['id']){delete _0x5040b4[_0xdd4a('0x51')]['id'];}_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x57')]=!![];_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x58')]=moment()[_0xdd4a('0x59')](_0xdd4a('0x5a'));_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')]=_0x5040b4['body'][_0xdd4a('0x5b')]||_0x5040b4[_0xdd4a('0x5c')]['id'];_0x371ca3[_0xdd4a('0x5d')]['id']=_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')];return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x5040b4[_0xdd4a('0x4f')]['id'],'UserId':null}})[_0xdd4a('0x49')](handleEntityNotFound(_0x342d4f,null))[_0xdd4a('0x49')](saveUpdates(_0x5040b4[_0xdd4a('0x51')],null))['then'](function(_0x12a3d3){if(_0x12a3d3){_0x371ca3[_0xdd4a('0x22')]=_0x12a3d3[_0xdd4a('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0xdd4a('0x53')]({'where':{'id':_0x12a3d3['SmsInteractionId']}});}return null;})[_0xdd4a('0x49')](handleEntityNotFound(_0x342d4f,null))['then'](function(_0x549933){if(_0x549933){return _0x549933[_0xdd4a('0x2f')]({'UserId':_0x5040b4[_0xdd4a('0x51')]['UserId'],'read1stAt':_[_0xdd4a('0x5f')](_0x549933[_0xdd4a('0x60')])?moment()[_0xdd4a('0x59')](_0xdd4a('0x5a')):undefined});}return null;})[_0xdd4a('0x49')](function(_0x52136f){if(_0x52136f){_0x371ca3['interaction']=_0x52136f[_0xdd4a('0x5e')]({'plain':!![]});interaction_log[_0xdd4a('0x1b')](_0xdd4a('0x61'),_0x5040b4[_0xdd4a('0x5c')]['id'],_0x5040b4[_0xdd4a('0x5c')]['name'],_0x5040b4[_0xdd4a('0x5c')][_0xdd4a('0x62')],_0x371ca3[_0xdd4a('0x63')]['id'],_0x5040b4[_0xdd4a('0x51')]?JSON[_0xdd4a('0x1e')](_0x5040b4['body']):_0xdd4a('0x64'));return respondWithRpcPromise(_0xdd4a('0x65'),_0xdd4a('0x66'),_0x371ca3);}return null;})[_0xdd4a('0x49')](function(_0x17ffb2){var _0x1a96f2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17ffb2[_0xdd4a('0x22')]['ContactId'];return db[_0xdd4a('0x67')][_0xdd4a('0x3a')](_0x1a96f2,{'type':db['Sequelize'][_0xdd4a('0x68')][_0xdd4a('0x69')],'raw':!![]})[_0xdd4a('0x49')](function(_0x52ea04){return _0x52ea04;});})[_0xdd4a('0x49')](function(_0x4b5202){if(_0x4b5202){_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x6a')]=_0x4b5202[0x0];if(!_0x5040b4['body'][_0xdd4a('0x5b')])return;return db[_0xdd4a('0x6b')]['find']({'where':{'id':_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')],'role':'agent'},'attributes':['id',_0xdd4a('0x32'),'fullname',_0xdd4a('0x6c'),_0xdd4a('0x6d')],'raw':!![]});}return null;})[_0xdd4a('0x49')](function(_0x31ee1e){if(!_0x31ee1e)return null;_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x5d')]=_0x31ee1e;return _0x371ca3;})[_0xdd4a('0x49')](function(_0x7e6e50){if(_0x7e6e50){if(_0x5040b4['body'][_0xdd4a('0x6e')]){_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x6f')]=util['format']('SIP/%s',_0x5040b4[_0xdd4a('0x5c')][_0xdd4a('0x32')]);_0x371ca3[_0xdd4a('0x22')]['channel']=_0x371ca3['channel'];_0x371ca3[_0xdd4a('0x22')]['motionChannel']=_0x371ca3[_0xdd4a('0x70')];_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x71')]=_0xdd4a('0x55');return respondWithRpcPromise(_0xdd4a('0x72'),'EventManager',{'event':_0xdd4a('0x73'),'message':_0x371ca3[_0xdd4a('0x22')]},client9002)['then'](function(){return _0x371ca3;});}return _0x371ca3;}return null;})['then'](respondWithResult(_0x342d4f,null))['catch'](handleError(_0x342d4f,null));};var interaction_log=require(_0xdd4a('0x12'))(_0xdd4a('0x74'));exports[_0xdd4a('0x75')]=function(_0x51d996,_0x2715e0,_0x1a1e12){var _0x23ffe7={'agent':{},'channel':'sms'};if(_0x51d996[_0xdd4a('0x51')]['id']){delete _0x51d996[_0xdd4a('0x51')]['id'];}_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')]=_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')]||_0x51d996['user']['id'];_0x23ffe7['agent']['id']=_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')];return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x51d996[_0xdd4a('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2715e0,null))[_0xdd4a('0x49')](function(_0xb957be){if(_0xb957be){_0x23ffe7[_0xdd4a('0x22')]=_0xb957be[_0xdd4a('0x5e')]({'plain':!![]});return db[_0xdd4a('0x76')][_0xdd4a('0x53')]({'where':{'id':_0xb957be[_0xdd4a('0x77')]}});}return null;})[_0xdd4a('0x49')](handleEntityNotFound(_0x2715e0,null))[_0xdd4a('0x49')](function(_0x2ece25){if(_0x2ece25){_0x23ffe7[_0xdd4a('0x63')]=_0x2ece25[_0xdd4a('0x5e')]({'plain':!![]});interaction_log['info'](_0xdd4a('0x78'),_0x51d996[_0xdd4a('0x5c')]['id'],_0x51d996[_0xdd4a('0x5c')][_0xdd4a('0x32')],_0x51d996[_0xdd4a('0x5c')][_0xdd4a('0x62')],_0x23ffe7[_0xdd4a('0x63')]['id'],_0x51d996[_0xdd4a('0x51')]?JSON['stringify'](_0x51d996['body']):_0xdd4a('0x64'));return respondWithRpcPromise(_0xdd4a('0x79'),_0xdd4a('0x7a'),_0x23ffe7);}return null;})[_0xdd4a('0x49')](function(_0x1bca5f){var _0x61e573=_0xdd4a('0x7b')+_0x1bca5f['message'][_0xdd4a('0x7c')];return db[_0xdd4a('0x67')][_0xdd4a('0x3a')](_0x61e573,{'type':db[_0xdd4a('0x7d')][_0xdd4a('0x68')]['SELECT'],'raw':!![]})[_0xdd4a('0x49')](function(_0x4a29da){return _0x4a29da;});})[_0xdd4a('0x49')](function(_0x471d4f){if(_0x471d4f){_0x23ffe7[_0xdd4a('0x22')]['contact']=_0x471d4f[0x0];if(!_0x51d996['body']['UserId'])return;return db[_0xdd4a('0x6b')][_0xdd4a('0x53')]({'where':{'id':_0x51d996[_0xdd4a('0x51')]['UserId'],'role':_0xdd4a('0x5d')},'attributes':['id','name',_0xdd4a('0x7e'),'email',_0xdd4a('0x6d')],'raw':!![]});}return null;})[_0xdd4a('0x49')](function(_0x10097f){if(!_0x10097f)return null;_0x23ffe7[_0xdd4a('0x22')][_0xdd4a('0x5d')]=_0x10097f;return _0x23ffe7;})[_0xdd4a('0x49')](function(_0x147732){if(_0x147732){_0x147732[_0xdd4a('0x22')][_0xdd4a('0x6f')]=util[_0xdd4a('0x59')](_0xdd4a('0x7f'),_0x51d996['user']['name']);_0x147732['message'][_0xdd4a('0x70')]=_0x23ffe7[_0xdd4a('0x70')];_0x147732[_0xdd4a('0x22')][_0xdd4a('0x80')]=_0x23ffe7[_0xdd4a('0x70')];_0x147732[_0xdd4a('0x22')]['event']=_0xdd4a('0x75');respondWithRpcPromise(_0xdd4a('0x72'),'EventManager',{'event':_0xdd4a('0x81'),'message':_0x147732[_0xdd4a('0x22')]},client9002);return _0x23ffe7;}return null;})['then'](respondWithResult(_0x2715e0,null))[_0xdd4a('0x52')](handleError(_0x2715e0,null));};exports[_0xdd4a('0x25')]=function(_0x1fba0e,_0x2f86dd,_0x530eab){if(_0x1fba0e[_0xdd4a('0x51')]['id']){delete _0x1fba0e[_0xdd4a('0x51')]['id'];}var _0x326df2;return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x1fba0e[_0xdd4a('0x4f')]['id']}})[_0xdd4a('0x49')](handleEntityNotFound(_0x2f86dd,null))[_0xdd4a('0x49')](function(_0x5acb5b){if(_0x5acb5b){_0x326df2=_0x5acb5b;return db['SmsAccount'][_0xdd4a('0x53')]({'where':{'id':_0x5acb5b[_0xdd4a('0x82')]}});}})[_0xdd4a('0x49')](handleEntityNotFound(_0x2f86dd,null))[_0xdd4a('0x49')](function(_0x2f5e23){if(_0x2f5e23){logger[_0xdd4a('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdd4a('0x25'),_0xdd4a('0x83'),_0x2f5e23[_0xdd4a('0x35')],util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));switch(_0x2f5e23[_0xdd4a('0x35')]){case _0xdd4a('0x85'):if(_0x1fba0e['body'][_0xdd4a('0x86')]&&_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x86')]===_0x326df2[_0xdd4a('0x87')]){return _0x326df2[_0xdd4a('0x2f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdd4a('0x25'),_0xdd4a('0x85'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x88')]&&_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x88')]===_0x326df2[_0xdd4a('0x87')]&&_['indexOf']([_0xdd4a('0x89'),_0xdd4a('0x8a')],_0x1fba0e[_0xdd4a('0x51')]['Status'])>=0x0){return _0x326df2['update']({'read':!![]});}else{logger[_0xdd4a('0x1f')](_0xdd4a('0x8b'),'status',_0xdd4a('0x8c'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;case _0xdd4a('0x8d'):var _0x21db59=_0x1fba0e['body'][_0xdd4a('0x8e')][0x0];if(_0x21db59['status'][_0xdd4a('0x8f')]===_0xdd4a('0x90')){return _0x326df2[_0xdd4a('0x2f')]({'read':!![]});}else{logger['error'](_0xdd4a('0x8b'),_0xdd4a('0x25'),_0xdd4a('0x8d'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x326df2;}})[_0xdd4a('0x49')](respondWithResult(_0x2f86dd,null))['catch'](handleError(_0x2f86dd,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index bc04971..b6412ef 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 _0x369d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x4f9118,_0x2df1f7){var _0x497377=function(_0x4d3f12){while(--_0x4d3f12){_0x4f9118['push'](_0x4f9118['shift']());}};_0x497377(++_0x2df1f7);}(_0x369d,0x13c));var _0xd369=function(_0x3cc6f2,_0x5e2d9f){_0x3cc6f2=_0x3cc6f2-0x0;var _0x574ee7=_0x369d[_0x3cc6f2];return _0x574ee7;};'use strict';var EventEmitter=require(_0xd369('0x0'));var SmsMessage=require(_0xd369('0x1'))['db'][_0xd369('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd369('0x3')](0x0);var events={'afterCreate':_0xd369('0x4'),'afterUpdate':_0xd369('0x5'),'afterDestroy':_0xd369('0x6')};function emitEvent(_0x145300){return function(_0x4618bd,_0x129781,_0xa11ce){SmsMessageEvents[_0xd369('0x7')](_0x145300+':'+_0x4618bd['id'],_0x4618bd);SmsMessageEvents[_0xd369('0x7')](_0x145300,_0x4618bd);_0xa11ce(null);};}for(var e in events){if(events[_0xd369('0x8')](e)){var event=events[e];SmsMessage[_0xd369('0x9')](e,emitEvent(event));}}module[_0xd369('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0xea9b=['setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsMessage'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0xea9b,0x1e8));var _0xbea9=function(_0x4cb9aa,_0x58b44f){_0x4cb9aa=_0x4cb9aa-0x0;var _0x2eff51=_0xea9b[_0x4cb9aa];return _0x2eff51;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xbea9('0x0'))['db'][_0xbea9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xbea9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbea9('0x3')};function emitEvent(_0x406f3e){return function(_0x3cb029,_0x54e166,_0x46f67b){SmsMessageEvents[_0xbea9('0x4')](_0x406f3e+':'+_0x3cb029['id'],_0x3cb029);SmsMessageEvents[_0xbea9('0x4')](_0x406f3e,_0x3cb029);_0x46f67b(null);};}for(var e in events){if(events[_0xbea9('0x5')](e)){var event=events[e];SmsMessage[_0xbea9('0x6')](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 87ed549..b8cd504 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 _0x292b=['SmsInteraction','update','createdAt','catch','error','find','SmsAccountId','then','type','twilio','accountSid','authToken','messages','create','phone','remote','token','sid','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','split','sms','POST','user_key','afterCreate','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','clicksend','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','message_id','clickSend','plivo','/api/sms/messages/','/status?token=','authId','format','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','csc','crypto','apiKey','text','timestamp','createHash','md5','digest','signature=','GET','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId'];(function(_0x265ff6,_0x4f4949){var _0x344a70=function(_0x1b5ef4){while(--_0x1b5ef4){_0x265ff6['push'](_0x265ff6['shift']());}};_0x344a70(++_0x4f4949);}(_0x292b,0x14f));var _0xb292=function(_0x4b5075,_0xee1fb9){_0x4b5075=_0x4b5075-0x0;var _0x234617=_0x292b[_0x4b5075];return _0x234617;};'use strict';var _=require('lodash');var util=require(_0xb292('0x0'));var logger=require(_0xb292('0x1'))(_0xb292('0x2'));var moment=require(_0xb292('0x3'));var BPromise=require('bluebird');var rp=require(_0xb292('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb292('0x5'));var config=require(_0xb292('0x6'));var attributes=require(_0xb292('0x7'));module[_0xb292('0x8')]=function(_0x52ee95,_0x45fcfd){return _0x52ee95[_0xb292('0x9')]('SmsMessage',attributes,{'tableName':_0xb292('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb292('0xb')]},{'name':_0xb292('0xc'),'fields':[_0xb292('0xd')],'type':_0xb292('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59b858,_0x463ce9,_0x40ac7b){var _0x535b0b=_0x52ee95['models'];var _0x5bb7e4=_0x59b858[_0xb292('0xf')]({'plain':!![]});if(_0x5bb7e4[_0xb292('0x10')][_0xb292('0x11')]()==='in'||_0x5bb7e4[_0xb292('0x10')][_0xb292('0x11')]()===_0xb292('0x12')&&!_0x5bb7e4[_0xb292('0x13')]&&!_['isNil'](_0x5bb7e4['UserId'])&&!_[_0xb292('0x14')](_0x5bb7e4[_0xb292('0x15')])){_0x535b0b[_0xb292('0x16')]['findOne']({'where':{'id':_0x5bb7e4[_0xb292('0x15')]}})['then'](function(_0x327de3){if(_0x327de3){_0x327de3[_0xb292('0x17')]({'lastMsgAt':_0x5bb7e4[_0xb292('0x18')],'lastMsgDirection':_0x5bb7e4['direction']['toLowerCase']()});}})[_0xb292('0x19')](function(_0x4978a5){console[_0xb292('0x1a')](_0x4978a5);});}if(_0x5bb7e4[_0xb292('0x10')]===_0xb292('0x12')&&!_0x5bb7e4[_0xb292('0x13')]){var _0x3819f9;_0x535b0b['SmsAccount'][_0xb292('0x1b')]({'where':{'id':_0x5bb7e4[_0xb292('0x1c')]},'raw':!![]})[_0xb292('0x1d')](function(_0x66624f){_0x3819f9=_0x66624f;if(_0x3819f9&&_0x3819f9[_0xb292('0x1e')]){switch(_0x3819f9[_0xb292('0x1e')]){case _0xb292('0x1f'):var _0x3ecd22=require(_0xb292('0x1f'));if(_0x3819f9[_0xb292('0x20')]&&_0x3819f9[_0xb292('0x21')]&&_0x3819f9['phone']){var _0x1a13d1=new _0x3ecd22(_0x3819f9[_0xb292('0x20')],_0x3819f9[_0xb292('0x21')]);_0x1a13d1[_0xb292('0x22')][_0xb292('0x23')]({'body':_0x5bb7e4[_0xb292('0xd')],'to':_0x5bb7e4[_0xb292('0x24')],'from':_0x3819f9['phone'],'statusCallback':_0x3819f9[_0xb292('0x25')]+'/api/sms/messages/'+_0x5bb7e4['id']+'/status?token='+_0x3819f9[_0xb292('0x26')]})['then'](function(_0x3a8c78){if(_0x3a8c78['sid']){return _0x59b858[_0xb292('0x17')]({'messageId':_0x3a8c78[_0xb292('0x27')]});}})[_0xb292('0x19')](function(_0x4df524){logger[_0xb292('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb292('0x1f'),util[_0xb292('0x28')](_0x4df524,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),'afterCreate','twilio',_0xb292('0x2a'));}break;case'skebby':var _0xa9782f=_0xb292('0x2b');if(_0x3819f9[_0xb292('0x2c')]&&_0x3819f9['password']){var _0x128e2b={'recipient':[_0x5bb7e4[_0xb292('0x24')]],'message':_0x5bb7e4[_0xb292('0xd')],'message_type':_0x3819f9[_0xb292('0x2d')]};if(_0x3819f9[_0xb292('0x2d')]&&_0x3819f9[_0xb292('0x2d')]!=='SI'){_0x128e2b[_0xb292('0x2e')]=_0x3819f9['phone'];}var _0x1271fa={'url':_0xa9782f+_0xb292('0x2f')+_0x3819f9[_0xb292('0x2c')]+_0xb292('0x30')+_0x3819f9[_0xb292('0x31')],'method':'GET'};rp(_0x1271fa)[_0xb292('0x1d')](function(_0x35f5be){var _0x1d58d8=_0x35f5be[_0xb292('0x32')](';');var _0x49c87a={'user_key':_0x1d58d8[0x0],'session_key':_0x1d58d8[0x1]};_0x1271fa={'url':_0xa9782f+_0xb292('0x33'),'method':_0xb292('0x34'),'headers':{'user_key':_0x49c87a[_0xb292('0x35')],'Session_key':_0x49c87a['session_key']},'json':!![],'body':_0x128e2b};return rp(_0x1271fa);})['then'](function(_0xb8af1a){if(_0xb8af1a['total_sent']>=0x1){var _0x167010={'messageId':_0xb8af1a['internal_order_id']};if(_0x3819f9[_0xb292('0x2d')]!=='GP'||!_0x3819f9['deliveryReport']){_0x167010['read']=!![];}return _0x59b858[_0xb292('0x17')](_0x167010);}else{return logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),'skebby',util[_0xb292('0x28')](_0xb8af1a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x437df8){return logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),'skebby',util[_0xb292('0x28')](_0x437df8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),'afterCreate',_0xb292('0x37'),_0xb292('0x38'));}break;case _0xb292('0x39'):if(_0x3819f9[_0xb292('0x21')]){var _0x17f9f9={'recipient':_0x5bb7e4[_0xb292('0x24')],'message':_0x5bb7e4[_0xb292('0xd')],'sender':_0x3819f9[_0xb292('0x3a')]||_0x3819f9['phone'],'authorization':_0x3819f9['authToken']};var _0x463ce9={'method':_0xb292('0x34'),'uri':_0xb292('0x3b'),'body':_0x17f9f9,'json':!![]};rp(_0x463ce9)[_0xb292('0x1d')](function(_0x40ed6d){var _0x50b1ee={'messageId':_0x40ed6d[_0xb292('0x3c')]};if(!_0x3819f9[_0xb292('0x3d')]){_0x50b1ee[_0xb292('0x3e')]=!![];}return _0x59b858[_0xb292('0x17')](_0x50b1ee);})['catch'](function(_0x85e5ef){logger['error'](_0xb292('0x29'),_0xb292('0x36'),'connectel',util['inspect'](_0x85e5ef,{'showHidden':![],'depth':null}));});}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x39'),'Missing\x20parameters:\x20authToken');}break;case _0xb292('0x3f'):if(_0x3819f9[_0xb292('0x2c')]&&_0x3819f9['password']){var _0x17f9f9={'messages':[{'source':'xCALLY\x20Motion','to':_0x5bb7e4[_0xb292('0x24')],'body':_0x5bb7e4[_0xb292('0xd')],'from':_0x3819f9['senderString']||_0x3819f9[_0xb292('0x24')]}]};var _0x382255=util['format'](_0xb292('0x40'),_0x3819f9['username'],_0x3819f9[_0xb292('0x31')]);var _0x463ce9={'method':_0xb292('0x34'),'uri':_0xb292('0x41'),'body':_0x17f9f9,'headers':{'Authorization':util['format'](_0xb292('0x42'),new Buffer(_0x382255)['toString'](_0xb292('0x43')))},'json':!![]};rp(_0x463ce9)[_0xb292('0x1d')](function(_0x2d9020){if(_0x2d9020[_0xb292('0x44')]>=0xc8&&_0x2d9020['http_code']<=0xce){if(_0x2d9020[_0xb292('0x45')]&&_0x2d9020[_0xb292('0x45')]['queued_count']>0x0){var _0x339df5=_['head'](_0x2d9020[_0xb292('0x45')][_0xb292('0x22')]);var _0x4b618c={'messageId':_0x339df5[_0xb292('0x46')]};if(!_0x3819f9[_0xb292('0x3d')]){_0x4b618c['read']=!![];}return _0x59b858['update'](_0x4b618c);}else{logger['error'](_0xb292('0x29'),'afterCreate',_0xb292('0x47'),util[_0xb292('0x28')](_0x2d9020,{'showHidden':![],'depth':null}));}}else{logger[_0xb292('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb292('0x47'),util[_0xb292('0x28')](_0x2d9020,{'showHidden':![],'depth':null}));}})[_0xb292('0x19')](function(_0x3c998b){logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x47'),util[_0xb292('0x28')](_0x3c998b,{'showHidden':![],'depth':null}));});}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),'clickSend',_0xb292('0x38'));}break;case _0xb292('0x48'):if(_0x3819f9['authId']&&_0x3819f9[_0xb292('0x21')]){var _0x17f9f9={'dst':_0x5bb7e4['phone'],'text':_0x5bb7e4[_0xb292('0xd')],'src':_0x3819f9[_0xb292('0x3a')]||_0x3819f9['phone'],'url':_0x3819f9['remote']+_0xb292('0x49')+_0x5bb7e4['id']+_0xb292('0x4a')+_0x3819f9[_0xb292('0x26')]};var _0x382255=util['format'](_0xb292('0x40'),_0x3819f9[_0xb292('0x4b')],_0x3819f9[_0xb292('0x21')]);var _0x463ce9={'method':_0xb292('0x34'),'uri':util[_0xb292('0x4c')](_0xb292('0x4d'),_0x3819f9[_0xb292('0x4b')]),'body':_0x17f9f9,'headers':{'Authorization':util[_0xb292('0x4c')]('Basic\x20%s',new Buffer(_0x382255)[_0xb292('0x4e')](_0xb292('0x43')))},'json':!![]};rp(_0x463ce9)[_0xb292('0x1d')](function(_0x47baf2){var _0x52b242={'messageId':_0x47baf2[_0xb292('0x4f')][0x0]};return _0x59b858[_0xb292('0x17')](_0x52b242);})[_0xb292('0x19')](function(_0x2e5de8){logger[_0xb292('0x1a')](_0xb292('0x29'),'afterCreate',_0xb292('0x48'),util[_0xb292('0x28')](_0x2e5de8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),_0xb292('0x36'),'plivo',_0xb292('0x50'));}break;case _0xb292('0x51'):if(_0x3819f9[_0xb292('0x2c')]&&_0x3819f9[_0xb292('0x31')]){if(_0x3819f9[_0xb292('0x52')]){var _0xc99681={'method':'POST','uri':_0x3819f9[_0xb292('0x52')]+_0xb292('0x53'),'body':{'username':_0x3819f9[_0xb292('0x2c')],'password':_0x3819f9['password']},'json':!![]};return rp(_0xc99681)[_0xb292('0x1d')](function(_0x2caef9){var _0x4d9c8d={'method':_0xb292('0x34'),'uri':_0x3819f9[_0xb292('0x52')]+_0xb292('0x54'),'body':{'messages':[{'from':_0x3819f9['phone'],'destinations':[{'to':_0x5bb7e4[_0xb292('0x24')]}],'text':_0x5bb7e4[_0xb292('0xd')],'notifyUrl':_0x3819f9[_0xb292('0x25')]+_0xb292('0x49')+_0x5bb7e4['id']+_0xb292('0x4a')+_0x3819f9['token'],'notifyContentType':_0xb292('0x55'),'callbackData':_0x3819f9['phone']+';'+_0x5bb7e4['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x2caef9[_0xb292('0x26')]},'json':!![]};return rp(_0x4d9c8d)[_0xb292('0x1d')](function(_0x373e53){if(_0x373e53[_0xb292('0x22')]){var _0x535b8b={'messageId':_0x373e53[_0xb292('0x22')][0x0][_0xb292('0xb')]};if(!_0x3819f9['deliveryReport']){_0x535b8b[_0xb292('0x3e')]=!![];}return _0x59b858[_0xb292('0x17')](_0x535b8b);}else{return logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x51'),util[_0xb292('0x28')](_0x373e53,{'showHidden':![],'depth':null}));}});})[_0xb292('0x19')](function(_0x557c50){return logger[_0xb292('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb292('0x51'),util[_0xb292('0x28')](_0x557c50,{'showHidden':![],'depth':null}));});}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x51'),_0xb292('0x38'));}break;case _0xb292('0x56'):var _0x239fa0=require(_0xb292('0x57'));if(_0x3819f9[_0xb292('0x58')]){var _0x49e19d={};_0x49e19d['login']=_0x3819f9[_0xb292('0x2c')];_0x49e19d['phone']=_0x5bb7e4[_0xb292('0x24')];_0x49e19d['sender']=_0x3819f9[_0xb292('0x24')];_0x49e19d[_0xb292('0x59')]=_0x5bb7e4['body'];_0x49e19d[_0xb292('0x5a')]=+new Date();var _0x17846e='';var _0x1d06c4='';var _0x4fc0d5=Object['keys'](_0x49e19d);_0x4fc0d5['sort']();for(var _0x21f93f=0x0;_0x21f93f<_0x4fc0d5['length'];_0x21f93f++){if(_0x17846e!=''){_0x17846e+='&';}_0x17846e+=_0x4fc0d5[_0x21f93f]+'='+encodeURIComponent(_0x49e19d[_0x4fc0d5[_0x21f93f]]);_0x1d06c4+=_0x49e19d[_0x4fc0d5[_0x21f93f]];}_0x1d06c4+=_0x3819f9[_0xb292('0x58')];_0x1d06c4=_0x239fa0[_0xb292('0x5b')](_0xb292('0x5c'))['update'](_0x1d06c4)[_0xb292('0x5d')]('hex');if(_0x17846e!==''){_0x17846e+='&';}_0x17846e+=_0xb292('0x5e')+_0x1d06c4;var _0x1271fa={'method':_0xb292('0x5f'),'uri':_0x3819f9[_0xb292('0x52')]+'/external/get/send.php?'+_0x17846e,'json':!![]};return rp(_0x1271fa)[_0xb292('0x1d')](function(_0x2ffaf4){var _0x2c525e=Object[_0xb292('0x60')](_0x2ffaf4);if(_0x2ffaf4[_0x2c525e[0x0]]['error']&&parseInt(_0x2ffaf4[_0x2c525e[0x0]][_0xb292('0x1a')])===0x0){var _0x56c361={'messageId':_0x2ffaf4[_0x2c525e[0x0]][_0xb292('0x61')]};if(!_0x3819f9[_0xb292('0x3d')]){_0x56c361['read']=!![];}return _0x59b858[_0xb292('0x17')](_0x56c361);}else{return logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x56'),util[_0xb292('0x28')](_0x2ffaf4['error'],{'showHidden':![],'depth':null}));}})[_0xb292('0x19')](function(_0xc32b78){return logger[_0xb292('0x1a')](_0xb292('0x29'),'afterCreate',_0xb292('0x56'),util[_0xb292('0x28')](_0xc32b78,{'showHidden':![],'depth':null}));});}else{logger[_0xb292('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb292('0x36'),_0xb292('0x56'),_0xb292('0x62'));}break;case _0xb292('0x63'):if(_0x3819f9[_0xb292('0x58')]){var _0x19f534={'method':_0xb292('0x34'),'uri':_0xb292('0x64'),'headers':{'Authorization':_0x3819f9[_0xb292('0x58')]},'body':{'content':_0x5bb7e4['body'],'to':[_0x5bb7e4['phone']],'from':_0x3819f9[_0xb292('0x24')],'binary':![],'clientMessageId':_0xb292('0x65'),'charset':_0xb292('0x66')},'json':!![]};rp(_0x19f534)[_0xb292('0x1d')](function(_0x3ea449){if(!_0x3ea449[_0xb292('0x1a')]){var _0x3cc124={'messageId':_0x3ea449[_0xb292('0x22')][0x0][_0xb292('0x67')]};if(!_0x3819f9[_0xb292('0x3d')]){_0x3cc124[_0xb292('0x3e')]=!![];}return _0x59b858[_0xb292('0x17')](_0x3cc124);}else{return logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x63'),util[_0xb292('0x28')](_0x3ea449[_0xb292('0x1a')],{'showHidden':![],'depth':null}));}})[_0xb292('0x19')](function(_0x4e0635){return logger[_0xb292('0x1a')](_0xb292('0x29'),'afterCreate','clickatell',util['inspect'](_0x4e0635,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x63'),'Missing\x20parameters:\x20apiKey');}break;case _0xb292('0x68'):if(_0x3819f9[_0xb292('0x2c')]&&_0x3819f9[_0xb292('0x31')]){var _0x382255=util[_0xb292('0x4c')]('%s:%s',_0x3819f9[_0xb292('0x2c')],_0x3819f9[_0xb292('0x31')]);var _0x463ce9={'method':_0xb292('0x34'),'uri':_0xb292('0x69')+_0x3819f9[_0xb292('0x6a')]+_0xb292('0x6b'),'body':{'to':[_0x5bb7e4[_0xb292('0x24')]],'text':_0x5bb7e4[_0xb292('0xd')],'from':_0x3819f9[_0xb292('0x24')],'applicationId':_0x3819f9[_0xb292('0x6c')]},'headers':{'Authorization':util[_0xb292('0x4c')](_0xb292('0x42'),new Buffer(_0x382255)[_0xb292('0x4e')]('base64'))},'json':!![]};rp(_0x463ce9)[_0xb292('0x1d')](function(_0x39931d){if(_0x39931d['id']){var _0x40b5c9={'messageId':_0x39931d['id']};return _0x59b858[_0xb292('0x17')](_0x40b5c9);}else{logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x68'),util['inspect'](_0x39931d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c3f78){logger[_0xb292('0x1a')](_0xb292('0x29'),'afterCreate',_0xb292('0x68'),util['inspect'](_0x3c3f78,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb292('0x29'),_0xb292('0x36'),'bandwidth',_0xb292('0x38'));}break;case _0xb292('0x6d'):if(_0x3819f9[_0xb292('0x58')]){var _0x333454={};var _0x1271fa={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xb292('0x6e')+_0x3819f9[_0xb292('0x58')],'Content-Type':_0xb292('0x55')},'body':{'from':_0x3819f9[_0xb292('0x24')],'to':_0x5bb7e4['phone'],'text':_0x5bb7e4[_0xb292('0xd')]},'json':!![]};return rp(_0x1271fa)[_0xb292('0x1d')](function(_0x5c445b){if(_0x5c445b[_0xb292('0x6f')]==0xca){_0x333454['message']=_0x5c445b;var _0x10a777={'method':_0xb292('0x34'),'uri':_0xb292('0x70'),'headers':{'Authorization':_0xb292('0x6e')+_0x3819f9[_0xb292('0x58')],'Content-Type':_0xb292('0x55')},'body':{'refid':_0x333454['message'][_0xb292('0x71')]},'json':!![]};return rp(_0x10a777)['then'](function(_0x540f73){_0x333454[_0xb292('0x72')]=_0x540f73;var _0x265c1a={'messageId':_0x333454[_0xb292('0x73')][_0xb292('0x71')],'read':!![]};return _0x59b858[_0xb292('0x17')](_0x265c1a);});}else{return logger['error'](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x6d'),util[_0xb292('0x28')](_0x5c445b,{'showHidden':![],'depth':null}));}})[_0xb292('0x19')](function(_0x5885aa){return logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x6d'),util[_0xb292('0x28')](_0x5885aa,{'showHidden':![],'depth':null}));});}else{return logger[_0xb292('0x1a')](_0xb292('0x29'),_0xb292('0x36'),_0xb292('0x6d'),'Token\x20not\x20received');}break;}}})[_0xb292('0x74')](function(){_0x40ac7b();});}else{_0x40ac7b();}}},'charset':_0xb292('0x75'),'collate':_0xb292('0x76')});}; \ No newline at end of file +var _0xea4f=['SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','sender','password','GET','split','sms','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','toString','http_code','data','head','message_id','clickSend','authId','/api/sms/messages/','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','out'];(function(_0x3b3750,_0x28f3b8){var _0x1b9e8b=function(_0xaf75c3){while(--_0xaf75c3){_0x3b3750['push'](_0x3b3750['shift']());}};_0x1b9e8b(++_0x28f3b8);}(_0xea4f,0x1d0));var _0xfea4=function(_0x5d4a12,_0x5a335d){_0x5d4a12=_0x5d4a12-0x0;var _0x5a7d8f=_0xea4f[_0x5d4a12];return _0x5a7d8f;};'use strict';var _=require(_0xfea4('0x0'));var util=require('util');var logger=require(_0xfea4('0x1'))(_0xfea4('0x2'));var moment=require(_0xfea4('0x3'));var BPromise=require('bluebird');var rp=require(_0xfea4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfea4('0x5'));var attributes=require(_0xfea4('0x6'));module[_0xfea4('0x7')]=function(_0x1c2658,_0x56fa85){return _0x1c2658['define'](_0xfea4('0x8'),attributes,{'tableName':_0xfea4('0x9'),'paranoid':![],'indexes':[{'name':_0xfea4('0xa'),'fields':[_0xfea4('0xa')]},{'name':_0xfea4('0xb'),'fields':[_0xfea4('0xc')],'type':_0xfea4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x326f78,_0x4d1fc8,_0x5566c5){var _0x2c3b21=_0x1c2658[_0xfea4('0xe')];var _0x6e2065=_0x326f78['get']({'plain':!![]});if(_0x6e2065[_0xfea4('0xf')][_0xfea4('0x10')]()==='in'||_0x6e2065[_0xfea4('0xf')][_0xfea4('0x10')]()==='out'&&!_0x6e2065[_0xfea4('0x11')]&&!_[_0xfea4('0x12')](_0x6e2065['UserId'])&&!_[_0xfea4('0x12')](_0x6e2065[_0xfea4('0x13')])){_0x2c3b21[_0xfea4('0x14')][_0xfea4('0x15')]({'where':{'id':_0x6e2065[_0xfea4('0x13')]}})[_0xfea4('0x16')](function(_0x12fd27){if(_0x12fd27){_0x12fd27[_0xfea4('0x17')]({'lastMsgAt':_0x6e2065[_0xfea4('0x18')],'lastMsgDirection':_0x6e2065[_0xfea4('0xf')]['toLowerCase']()});}})[_0xfea4('0x19')](function(_0x3fe001){console[_0xfea4('0x1a')](_0x3fe001);});}if(_0x6e2065[_0xfea4('0xf')]===_0xfea4('0x1b')&&!_0x6e2065[_0xfea4('0x11')]){var _0x34d877;_0x2c3b21[_0xfea4('0x1c')][_0xfea4('0x1d')]({'where':{'id':_0x6e2065[_0xfea4('0x1e')]},'raw':!![]})[_0xfea4('0x16')](function(_0x102480){_0x34d877=_0x102480;if(_0x34d877&&_0x34d877[_0xfea4('0x1f')]){switch(_0x34d877[_0xfea4('0x1f')]){case _0xfea4('0x20'):var _0x1bd2ca=require(_0xfea4('0x20'));if(_0x34d877[_0xfea4('0x21')]&&_0x34d877[_0xfea4('0x22')]&&_0x34d877[_0xfea4('0x23')]){var _0x225b25=new _0x1bd2ca(_0x34d877['accountSid'],_0x34d877['authToken']);_0x225b25[_0xfea4('0x24')][_0xfea4('0x25')]({'body':_0x6e2065[_0xfea4('0xc')],'to':_0x6e2065[_0xfea4('0x23')],'from':_0x34d877[_0xfea4('0x23')],'statusCallback':_0x34d877[_0xfea4('0x26')]+'/api/sms/messages/'+_0x6e2065['id']+_0xfea4('0x27')+_0x34d877[_0xfea4('0x28')]})[_0xfea4('0x16')](function(_0x362413){if(_0x362413[_0xfea4('0x29')]){return _0x326f78[_0xfea4('0x17')]({'messageId':_0x362413['sid']});}})[_0xfea4('0x19')](function(_0x5189a2){logger['error'](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x20'),util['inspect'](_0x5189a2,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xfea4('0x2c'):var _0x1249a6=_0xfea4('0x2d');if(_0x34d877[_0xfea4('0x2e')]&&_0x34d877['password']){var _0x462da1={'recipient':[_0x6e2065['phone']],'message':_0x6e2065[_0xfea4('0xc')],'message_type':_0x34d877['smsMethod']};if(_0x34d877['smsMethod']&&_0x34d877['smsMethod']!=='SI'){_0x462da1[_0xfea4('0x2f')]=_0x34d877[_0xfea4('0x23')];}var _0x286f93={'url':_0x1249a6+'login?username='+_0x34d877[_0xfea4('0x2e')]+'&password='+_0x34d877[_0xfea4('0x30')],'method':_0xfea4('0x31')};rp(_0x286f93)[_0xfea4('0x16')](function(_0x559e91){var _0x559f1d=_0x559e91[_0xfea4('0x32')](';');var _0x41209c={'user_key':_0x559f1d[0x0],'session_key':_0x559f1d[0x1]};_0x286f93={'url':_0x1249a6+_0xfea4('0x33'),'method':'POST','headers':{'user_key':_0x41209c['user_key'],'Session_key':_0x41209c[_0xfea4('0x34')]},'json':!![],'body':_0x462da1};return rp(_0x286f93);})[_0xfea4('0x16')](function(_0x3f8cca){if(_0x3f8cca[_0xfea4('0x35')]>=0x1){var _0xe7bdb5={'messageId':_0x3f8cca[_0xfea4('0x36')]};if(_0x34d877['smsMethod']!=='GP'||!_0x34d877[_0xfea4('0x37')]){_0xe7bdb5[_0xfea4('0x38')]=!![];}return _0x326f78[_0xfea4('0x17')](_0xe7bdb5);}else{return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),'skebby',util[_0xfea4('0x39')](_0x3f8cca,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1b81d7){return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0xfea4('0x39')](_0x1b81d7,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x2c'),_0xfea4('0x3a'));}break;case _0xfea4('0x3b'):if(_0x34d877[_0xfea4('0x22')]){var _0x6d6b74={'recipient':_0x6e2065[_0xfea4('0x23')],'message':_0x6e2065['body'],'sender':_0x34d877['senderString']||_0x34d877[_0xfea4('0x23')],'authorization':_0x34d877[_0xfea4('0x22')]};var _0x4d1fc8={'method':_0xfea4('0x3c'),'uri':_0xfea4('0x3d'),'body':_0x6d6b74,'json':!![]};rp(_0x4d1fc8)[_0xfea4('0x16')](function(_0x6396fb){var _0x36f0b7={'messageId':_0x6396fb[_0xfea4('0x3e')]};if(!_0x34d877[_0xfea4('0x37')]){_0x36f0b7[_0xfea4('0x38')]=!![];}return _0x326f78[_0xfea4('0x17')](_0x36f0b7);})['catch'](function(_0x2cff73){logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),'connectel',util[_0xfea4('0x39')](_0x2cff73,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),'connectel',_0xfea4('0x3f'));}break;case'clicksend':if(_0x34d877['username']&&_0x34d877[_0xfea4('0x30')]){var _0x6d6b74={'messages':[{'source':_0xfea4('0x40'),'to':_0x6e2065[_0xfea4('0x23')],'body':_0x6e2065[_0xfea4('0xc')],'from':_0x34d877[_0xfea4('0x41')]||_0x34d877[_0xfea4('0x23')]}]};var _0x16a10b=util[_0xfea4('0x42')](_0xfea4('0x43'),_0x34d877[_0xfea4('0x2e')],_0x34d877['password']);var _0x4d1fc8={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x6d6b74,'headers':{'Authorization':util[_0xfea4('0x42')](_0xfea4('0x44'),new Buffer(_0x16a10b)[_0xfea4('0x45')]('base64'))},'json':!![]};rp(_0x4d1fc8)[_0xfea4('0x16')](function(_0x49a1ab){if(_0x49a1ab[_0xfea4('0x46')]>=0xc8&&_0x49a1ab[_0xfea4('0x46')]<=0xce){if(_0x49a1ab[_0xfea4('0x47')]&&_0x49a1ab[_0xfea4('0x47')]['queued_count']>0x0){var _0x2b1299=_[_0xfea4('0x48')](_0x49a1ab['data'][_0xfea4('0x24')]);var _0x264217={'messageId':_0x2b1299[_0xfea4('0x49')]};if(!_0x34d877['deliveryReport']){_0x264217[_0xfea4('0x38')]=!![];}return _0x326f78['update'](_0x264217);}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x4a'),util[_0xfea4('0x39')](_0x49a1ab,{'showHidden':![],'depth':null}));}}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),'clickSend',util[_0xfea4('0x39')](_0x49a1ab,{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x2c8849){logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),'clickSend',util[_0xfea4('0x39')](_0x2c8849,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x34d877[_0xfea4('0x4b')]&&_0x34d877[_0xfea4('0x22')]){var _0x6d6b74={'dst':_0x6e2065[_0xfea4('0x23')],'text':_0x6e2065[_0xfea4('0xc')],'src':_0x34d877[_0xfea4('0x41')]||_0x34d877[_0xfea4('0x23')],'url':_0x34d877[_0xfea4('0x26')]+_0xfea4('0x4c')+_0x6e2065['id']+_0xfea4('0x27')+_0x34d877[_0xfea4('0x28')]};var _0x16a10b=util[_0xfea4('0x42')](_0xfea4('0x43'),_0x34d877[_0xfea4('0x4b')],_0x34d877[_0xfea4('0x22')]);var _0x4d1fc8={'method':_0xfea4('0x3c'),'uri':util[_0xfea4('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x34d877['authId']),'body':_0x6d6b74,'headers':{'Authorization':util[_0xfea4('0x42')]('Basic\x20%s',new Buffer(_0x16a10b)['toString'](_0xfea4('0x4d')))},'json':!![]};rp(_0x4d1fc8)[_0xfea4('0x16')](function(_0x30c685){var _0x347ed0={'messageId':_0x30c685[_0xfea4('0x4e')][0x0]};return _0x326f78[_0xfea4('0x17')](_0x347ed0);})['catch'](function(_0x29c180){logger['error'](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x4f'),util[_0xfea4('0x39')](_0x29c180,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x4f'),_0xfea4('0x50'));}break;case'infobip':if(_0x34d877['username']&&_0x34d877['password']){if(_0x34d877[_0xfea4('0x51')]){var _0x20626a={'method':_0xfea4('0x3c'),'uri':_0x34d877[_0xfea4('0x51')]+_0xfea4('0x52'),'body':{'username':_0x34d877[_0xfea4('0x2e')],'password':_0x34d877['password']},'json':!![]};return rp(_0x20626a)[_0xfea4('0x16')](function(_0x3e25f5){var _0x24ad52={'method':'POST','uri':_0x34d877[_0xfea4('0x51')]+_0xfea4('0x53'),'body':{'messages':[{'from':_0x34d877[_0xfea4('0x23')],'destinations':[{'to':_0x6e2065[_0xfea4('0x23')]}],'text':_0x6e2065[_0xfea4('0xc')],'notifyUrl':_0x34d877[_0xfea4('0x26')]+_0xfea4('0x4c')+_0x6e2065['id']+_0xfea4('0x27')+_0x34d877[_0xfea4('0x28')],'notifyContentType':_0xfea4('0x54'),'callbackData':_0x34d877[_0xfea4('0x23')]+';'+_0x6e2065[_0xfea4('0xc')]}]},'headers':{'Authorization':_0xfea4('0x55')+_0x3e25f5[_0xfea4('0x28')]},'json':!![]};return rp(_0x24ad52)[_0xfea4('0x16')](function(_0x5d4ff8){if(_0x5d4ff8[_0xfea4('0x24')]){var _0x468874={'messageId':_0x5d4ff8['messages'][0x0][_0xfea4('0xa')]};if(!_0x34d877[_0xfea4('0x37')]){_0x468874[_0xfea4('0x38')]=!![];}return _0x326f78[_0xfea4('0x17')](_0x468874);}else{return logger['error'](_0xfea4('0x2a'),_0xfea4('0x2b'),'infobip',util[_0xfea4('0x39')](_0x5d4ff8,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x14aa34){return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),_0xfea4('0x56'),util['inspect'](_0x14aa34,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x56'),_0xfea4('0x57'));}}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x56'),_0xfea4('0x3a'));}break;case'csc':var _0x31fc70=require(_0xfea4('0x58'));if(_0x34d877[_0xfea4('0x59')]){var _0x2e284a={};_0x2e284a[_0xfea4('0x5a')]=_0x34d877[_0xfea4('0x2e')];_0x2e284a[_0xfea4('0x23')]=_0x6e2065[_0xfea4('0x23')];_0x2e284a[_0xfea4('0x2f')]=_0x34d877[_0xfea4('0x23')];_0x2e284a['text']=_0x6e2065[_0xfea4('0xc')];_0x2e284a[_0xfea4('0x5b')]=+new Date();var _0x278229='';var _0x3d1d03='';var _0xcf90cf=Object[_0xfea4('0x5c')](_0x2e284a);_0xcf90cf[_0xfea4('0x5d')]();for(var _0x5c750d=0x0;_0x5c750d<_0xcf90cf[_0xfea4('0x5e')];_0x5c750d++){if(_0x278229!=''){_0x278229+='&';}_0x278229+=_0xcf90cf[_0x5c750d]+'='+encodeURIComponent(_0x2e284a[_0xcf90cf[_0x5c750d]]);_0x3d1d03+=_0x2e284a[_0xcf90cf[_0x5c750d]];}_0x3d1d03+=_0x34d877[_0xfea4('0x59')];_0x3d1d03=_0x31fc70[_0xfea4('0x5f')](_0xfea4('0x60'))[_0xfea4('0x17')](_0x3d1d03)[_0xfea4('0x61')](_0xfea4('0x62'));if(_0x278229!==''){_0x278229+='&';}_0x278229+='signature='+_0x3d1d03;var _0x286f93={'method':_0xfea4('0x31'),'uri':_0x34d877[_0xfea4('0x51')]+_0xfea4('0x63')+_0x278229,'json':!![]};return rp(_0x286f93)[_0xfea4('0x16')](function(_0x29692e){var _0x66bc16=Object['keys'](_0x29692e);if(_0x29692e[_0x66bc16[0x0]][_0xfea4('0x1a')]&&parseInt(_0x29692e[_0x66bc16[0x0]][_0xfea4('0x1a')])===0x0){var _0x41536c={'messageId':_0x29692e[_0x66bc16[0x0]][_0xfea4('0x64')]};if(!_0x34d877[_0xfea4('0x37')]){_0x41536c[_0xfea4('0x38')]=!![];}return _0x326f78[_0xfea4('0x17')](_0x41536c);}else{return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x65'),util[_0xfea4('0x39')](_0x29692e[_0xfea4('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x59bb3f){return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x65'),util[_0xfea4('0x39')](_0x59bb3f,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x65'),_0xfea4('0x66'));}break;case _0xfea4('0x67'):if(_0x34d877[_0xfea4('0x59')]){var _0x13c9c0={'method':_0xfea4('0x3c'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x34d877[_0xfea4('0x59')]},'body':{'content':_0x6e2065[_0xfea4('0xc')],'to':[_0x6e2065[_0xfea4('0x23')]],'from':_0x34d877[_0xfea4('0x23')],'binary':![],'clientMessageId':_0xfea4('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x13c9c0)[_0xfea4('0x16')](function(_0x55d2d6){if(!_0x55d2d6['error']){var _0x37629e={'messageId':_0x55d2d6[_0xfea4('0x24')][0x0][_0xfea4('0x69')]};if(!_0x34d877[_0xfea4('0x37')]){_0x37629e['read']=!![];}return _0x326f78[_0xfea4('0x17')](_0x37629e);}else{return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x67'),util['inspect'](_0x55d2d6[_0xfea4('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x1d8bb0){return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),_0xfea4('0x67'),util[_0xfea4('0x39')](_0x1d8bb0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x67'),'Missing\x20parameters:\x20apiKey');}break;case _0xfea4('0x6a'):if(_0x34d877['username']&&_0x34d877['password']){var _0x16a10b=util['format'](_0xfea4('0x43'),_0x34d877['username'],_0x34d877[_0xfea4('0x30')]);var _0x4d1fc8={'method':_0xfea4('0x3c'),'uri':_0xfea4('0x6b')+_0x34d877[_0xfea4('0x6c')]+_0xfea4('0x6d'),'body':{'to':[_0x6e2065['phone']],'text':_0x6e2065['body'],'from':_0x34d877[_0xfea4('0x23')],'applicationId':_0x34d877[_0xfea4('0x6e')]},'headers':{'Authorization':util[_0xfea4('0x42')]('Basic\x20%s',new Buffer(_0x16a10b)[_0xfea4('0x45')](_0xfea4('0x4d')))},'json':!![]};rp(_0x4d1fc8)['then'](function(_0x5191a8){if(_0x5191a8['id']){var _0x9e3d68={'messageId':_0x5191a8['id']};return _0x326f78['update'](_0x9e3d68);}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x6a'),util[_0xfea4('0x39')](_0x5191a8,{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x14cf68){logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),'bandwidth',util[_0xfea4('0x39')](_0x14cf68,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfea4('0x6a'),_0xfea4('0x3a'));}break;case'intelepeer':if(_0x34d877['apiKey']){var _0x36b1b4={};var _0x286f93={'method':'POST','uri':_0xfea4('0x6f'),'headers':{'Authorization':_0xfea4('0x70')+_0x34d877[_0xfea4('0x59')],'Content-Type':_0xfea4('0x54')},'body':{'from':_0x34d877[_0xfea4('0x23')],'to':_0x6e2065[_0xfea4('0x23')],'text':_0x6e2065[_0xfea4('0xc')]},'json':!![]};return rp(_0x286f93)[_0xfea4('0x16')](function(_0x35e3d6){if(_0x35e3d6[_0xfea4('0x71')]==0xca){_0x36b1b4[_0xfea4('0x72')]=_0x35e3d6;var _0x17b1ef={'method':_0xfea4('0x3c'),'uri':_0xfea4('0x73'),'headers':{'Authorization':_0xfea4('0x70')+_0x34d877[_0xfea4('0x59')],'Content-Type':_0xfea4('0x54')},'body':{'refid':_0x36b1b4['message'][_0xfea4('0x74')]},'json':!![]};return rp(_0x17b1ef)['then'](function(_0x5947e7){_0x36b1b4[_0xfea4('0x75')]=_0x5947e7;var _0x33e445={'messageId':_0x36b1b4['message'][_0xfea4('0x74')],'read':!![]};return _0x326f78['update'](_0x33e445);});}else{return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x76'),util[_0xfea4('0x39')](_0x35e3d6,{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x3f6721){return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),_0xfea4('0x76'),util[_0xfea4('0x39')](_0x3f6721,{'showHidden':![],'depth':null}));});}else{return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x76'),_0xfea4('0x77'));}break;}}})[_0xfea4('0x78')](function(){_0x5566c5();});}else{_0x5566c5();}}},'charset':_0xfea4('0x79'),'collate':_0xfea4('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fa7b082..9dec601 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 _0xc13d=['./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x57b52b,_0xfc0b50){var _0x3c4fcb=function(_0x598f90){while(--_0x598f90){_0x57b52b['push'](_0x57b52b['shift']());}};_0x3c4fcb(++_0xfc0b50);}(_0xc13d,0xb3));var _0xdc13=function(_0x96a4d,_0x35188e){_0x96a4d=_0x96a4d-0x0;var _0x2b768d=_0xc13d[_0x96a4d];return _0x2b768d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdc13('0x0'));var BPromise=require(_0xdc13('0x1'));var rs=require(_0xdc13('0x2'));var fs=require('fs');var Redis=require(_0xdc13('0x3'));var db=require(_0xdc13('0x4'))['db'];var utils=require(_0xdc13('0x5'));var logger=require(_0xdc13('0x6'))(_0xdc13('0x7'));var config=require(_0xdc13('0x8'));var jayson=require(_0xdc13('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xdc13('0xa')]=_[_0xdc13('0xb')](config[_0xdc13('0xa')],{'host':_0xdc13('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdc13('0xd'))['register'](socket);function respondWithRpcPromise(_0x47a9a0,_0xfdfbd7,_0x2862bc){return new BPromise(function(_0x292874,_0x20f27a){return client[_0xdc13('0xe')](_0x47a9a0,_0x2862bc)[_0xdc13('0xf')](function(_0x3ecdd8){logger[_0xdc13('0x10')](_0xdc13('0x11'),_0xfdfbd7,'request\x20sent');logger[_0xdc13('0x12')](_0xdc13('0x13'),_0xfdfbd7,_0xdc13('0x14'),JSON['stringify'](_0x3ecdd8));if(_0x3ecdd8[_0xdc13('0x15')]){if(_0x3ecdd8[_0xdc13('0x15')]['code']===0x1f4){logger[_0xdc13('0x15')](_0xdc13('0x11'),_0xfdfbd7,_0x3ecdd8['error'][_0xdc13('0x16')]);return _0x20f27a(_0x3ecdd8[_0xdc13('0x15')][_0xdc13('0x16')]);}logger[_0xdc13('0x15')]('SmsMessage,\x20%s,\x20%s',_0xfdfbd7,_0x3ecdd8['error'][_0xdc13('0x16')]);return _0x292874(_0x3ecdd8['error'][_0xdc13('0x16')]);}else{logger[_0xdc13('0x10')](_0xdc13('0x11'),_0xfdfbd7,_0xdc13('0x14'));_0x292874(_0x3ecdd8[_0xdc13('0x17')][_0xdc13('0x16')]);}})[_0xdc13('0x18')](function(_0x13630a){logger[_0xdc13('0x15')](_0xdc13('0x11'),_0xfdfbd7,_0x13630a);_0x20f27a(_0x13630a);});});}exports[_0xdc13('0x19')]=function(_0x40c55b){var _0x3101e4=this;return new Promise(function(_0x12486f,_0x37d9eb){return db[_0xdc13('0x1a')][_0xdc13('0x1b')](_0x40c55b[_0xdc13('0x1c')],{'raw':_0x40c55b[_0xdc13('0x1d')]?_0x40c55b[_0xdc13('0x1d')][_0xdc13('0x1e')]===undefined?!![]:![]:!![]})[_0xdc13('0xf')](function(_0x9206e2){logger['info']('CreateSmsMessage',_0x40c55b);logger[_0xdc13('0x12')](_0xdc13('0x19'),_0x40c55b,JSON[_0xdc13('0x1f')](_0x9206e2));_0x12486f(_0x9206e2);})[_0xdc13('0x18')](function(_0x1e025f){logger[_0xdc13('0x15')]('CreateSmsMessage',_0x1e025f[_0xdc13('0x16')],_0x40c55b);_0x37d9eb(_0x3101e4[_0xdc13('0x15')](0x1f4,_0x1e025f[_0xdc13('0x16')]));});});}; \ No newline at end of file +var _0x9dd8=['options','raw','info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','body'];(function(_0x528e4e,_0x42e9f6){var _0x48d1a3=function(_0x24de1c){while(--_0x24de1c){_0x528e4e['push'](_0x528e4e['shift']());}};_0x48d1a3(++_0x42e9f6);}(_0x9dd8,0x8c));var _0x89dd=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x9dd8[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x89dd('0x0'));var util=require(_0x89dd('0x1'));var moment=require(_0x89dd('0x2'));var BPromise=require(_0x89dd('0x3'));var rs=require(_0x89dd('0x4'));var fs=require('fs');var Redis=require(_0x89dd('0x5'));var db=require(_0x89dd('0x6'))['db'];var utils=require(_0x89dd('0x7'));var logger=require(_0x89dd('0x8'))('rpc');var config=require(_0x89dd('0x9'));var jayson=require(_0x89dd('0xa'));var client=jayson[_0x89dd('0xb')][_0x89dd('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x89dd('0xd')],{'host':_0x89dd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x89dd('0xd')]));require(_0x89dd('0xf'))[_0x89dd('0x10')](socket);function respondWithRpcPromise(_0x4a7bc5,_0x218552,_0x29bbd2){return new BPromise(function(_0x5ce1cf,_0x1a9f8c){return client[_0x89dd('0x11')](_0x4a7bc5,_0x29bbd2)[_0x89dd('0x12')](function(_0x4ab8a7){logger['info'](_0x89dd('0x13'),_0x218552,'request\x20sent');logger['debug'](_0x89dd('0x14'),_0x218552,_0x89dd('0x15'),JSON[_0x89dd('0x16')](_0x4ab8a7));if(_0x4ab8a7['error']){if(_0x4ab8a7[_0x89dd('0x17')][_0x89dd('0x18')]===0x1f4){logger['error'](_0x89dd('0x13'),_0x218552,_0x4ab8a7[_0x89dd('0x17')]['message']);return _0x1a9f8c(_0x4ab8a7['error'][_0x89dd('0x19')]);}logger[_0x89dd('0x17')]('SmsMessage,\x20%s,\x20%s',_0x218552,_0x4ab8a7[_0x89dd('0x17')]['message']);return _0x5ce1cf(_0x4ab8a7['error'][_0x89dd('0x19')]);}else{logger['info'](_0x89dd('0x13'),_0x218552,_0x89dd('0x15'));_0x5ce1cf(_0x4ab8a7[_0x89dd('0x1a')][_0x89dd('0x19')]);}})[_0x89dd('0x1b')](function(_0xd5db73){logger[_0x89dd('0x17')]('SmsMessage,\x20%s,\x20%s',_0x218552,_0xd5db73);_0x1a9f8c(_0xd5db73);});});}exports[_0x89dd('0x1c')]=function(_0x2ac984){var _0x4b025e=this;return new Promise(function(_0x4b57db,_0xffbcd0){return db['SmsMessage']['create'](_0x2ac984[_0x89dd('0x1d')],{'raw':_0x2ac984[_0x89dd('0x1e')]?_0x2ac984['options'][_0x89dd('0x1f')]===undefined?!![]:![]:!![]})[_0x89dd('0x12')](function(_0x1b844a){logger[_0x89dd('0x20')]('CreateSmsMessage',_0x2ac984);logger[_0x89dd('0x21')](_0x89dd('0x1c'),_0x2ac984,JSON[_0x89dd('0x16')](_0x1b844a));_0x4b57db(_0x1b844a);})[_0x89dd('0x1b')](function(_0x50b5ae){logger[_0x89dd('0x17')](_0x89dd('0x1c'),_0x50b5ae[_0x89dd('0x19')],_0x2ac984);_0xffbcd0(_0x4b025e[_0x89dd('0x17')](0x1f4,_0x50b5ae[_0x89dd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 5280616..faf58c2 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 _0xc30d=['emit','removeListener','register','length','./smsMessage.events'];(function(_0x2d2f56,_0x4e201e){var _0x588535=function(_0x402f12){while(--_0x402f12){_0x2d2f56['push'](_0x2d2f56['shift']());}};_0x588535(++_0x4e201e);}(_0xc30d,0x185));var _0xdc30=function(_0x105045,_0x2e471e){_0x105045=_0x105045-0x0;var _0x2487d0=_0xc30d[_0x105045];return _0x2487d0;};'use strict';var SmsMessageEvents=require(_0xdc30('0x0'));var events=['save','remove','update'];function createListener(_0x1b1158,_0x48bf86){return function(_0x5bc1e6){_0x48bf86[_0xdc30('0x1')](_0x1b1158,_0x5bc1e6);};}function removeListener(_0x5c5987,_0x1a976b){return function(){SmsMessageEvents[_0xdc30('0x2')](_0x5c5987,_0x1a976b);};}exports[_0xdc30('0x3')]=function(_0x59e30c){for(var _0x230880=0x0,_0x3e33d9=events[_0xdc30('0x4')];_0x230880<_0x3e33d9;_0x230880++){var _0x4aafde=events[_0x230880];var _0x31039a=createListener('smsMessage:'+_0x4aafde,_0x59e30c);SmsMessageEvents['on'](_0x4aafde,_0x31039a);}}; \ No newline at end of file +var _0xbdc2=['update','removeListener','register','length','save'];(function(_0x274f66,_0x3f9e72){var _0x5af856=function(_0xe9b23e){while(--_0xe9b23e){_0x274f66['push'](_0x274f66['shift']());}};_0x5af856(++_0x3f9e72);}(_0xbdc2,0x1e9));var _0x2bdc=function(_0x5e1fb6,_0xf3495b){_0x5e1fb6=_0x5e1fb6-0x0;var _0x2cf20e=_0xbdc2[_0x5e1fb6];return _0x2cf20e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x2bdc('0x0'),'remove',_0x2bdc('0x1')];function createListener(_0x1a81f9,_0x43c0a8){return function(_0x6eaf73){_0x43c0a8['emit'](_0x1a81f9,_0x6eaf73);};}function removeListener(_0x13c46d,_0x4a4946){return function(){SmsMessageEvents[_0x2bdc('0x2')](_0x13c46d,_0x4a4946);};}exports[_0x2bdc('0x3')]=function(_0x20f611){for(var _0x19d373=0x0,_0x227db8=events[_0x2bdc('0x4')];_0x19d373<_0x227db8;_0x19d373++){var _0x2f3748=events[_0x19d373];var _0x5a206e=createListener('smsMessage:'+_0x2f3748,_0x20f611);SmsMessageEvents['on'](_0x2f3748,_0x5a206e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6d1c02e..76c618f 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 _0x4aca=['update','delete','removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put'];(function(_0x38c184,_0x16203b){var _0x14fd0a=function(_0x48c232){while(--_0x48c232){_0x38c184['push'](_0x38c184['shift']());}};_0x14fd0a(++_0x16203b);}(_0x4aca,0xf7));var _0xa4ac=function(_0x1487f8,_0x5d6076){_0x1487f8=_0x1487f8-0x0;var _0x535f01=_0x4aca[_0x1487f8];return _0x535f01;};'use strict';var multer=require(_0xa4ac('0x0'));var util=require(_0xa4ac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa4ac('0x2'));var router=express[_0xa4ac('0x3')]();var fs_extra=require(_0xa4ac('0x4'));var auth=require(_0xa4ac('0x5'));var interaction=require(_0xa4ac('0x6'));var config=require(_0xa4ac('0x7'));var controller=require(_0xa4ac('0x8'));router[_0xa4ac('0x9')]('/',auth[_0xa4ac('0xa')](),controller[_0xa4ac('0xb')]);router['get']('/describe',auth[_0xa4ac('0xa')](),controller['describe']);router['get'](_0xa4ac('0xc'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0xd')]);router[_0xa4ac('0x9')](_0xa4ac('0xe'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0xf')]);router[_0xa4ac('0x9')](_0xa4ac('0x10'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x11')]);router['get'](_0xa4ac('0x12'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x13')]);router[_0xa4ac('0x14')]('/',auth[_0xa4ac('0xa')](),controller['create']);router['post'](_0xa4ac('0x10'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x15')]);router[_0xa4ac('0x14')](_0xa4ac('0x12'),auth[_0xa4ac('0xa')](),controller['addAgents']);router[_0xa4ac('0x16')](_0xa4ac('0xc'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x17')]);router['delete'](_0xa4ac('0xc'),auth[_0xa4ac('0xa')](),controller['destroy']);router[_0xa4ac('0x18')]('/:id/teams',auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x19')]);router['delete'](_0xa4ac('0x12'),auth[_0xa4ac('0xa')](),controller[_0xa4ac('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x2c0a=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5492b1,_0xe58672){var _0x3cf29d=function(_0x240f05){while(--_0x240f05){_0x5492b1['push'](_0x5492b1['shift']());}};_0x3cf29d(++_0xe58672);}(_0x2c0a,0x1f1));var _0xa2c0=function(_0x4cba56,_0x5b2c44){_0x4cba56=_0x4cba56-0x0;var _0x3cc9f3=_0x2c0a[_0x4cba56];return _0x3cc9f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa2c0('0x0'));var timeout=require(_0xa2c0('0x1'));var express=require(_0xa2c0('0x2'));var router=express[_0xa2c0('0x3')]();var fs_extra=require(_0xa2c0('0x4'));var auth=require(_0xa2c0('0x5'));var interaction=require(_0xa2c0('0x6'));var config=require('../../config/environment');var controller=require(_0xa2c0('0x7'));router[_0xa2c0('0x8')]('/',auth[_0xa2c0('0x9')](),controller[_0xa2c0('0xa')]);router[_0xa2c0('0x8')](_0xa2c0('0xb'),auth['isAuthenticated'](),controller[_0xa2c0('0xc')]);router['get'](_0xa2c0('0xd'),auth['isAuthenticated'](),controller[_0xa2c0('0xe')]);router[_0xa2c0('0x8')](_0xa2c0('0xf'),auth['isAuthenticated'](),controller[_0xa2c0('0x10')]);router[_0xa2c0('0x8')](_0xa2c0('0x11'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x12')]);router[_0xa2c0('0x8')](_0xa2c0('0x13'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x14')]);router[_0xa2c0('0x15')]('/',auth[_0xa2c0('0x9')](),controller['create']);router[_0xa2c0('0x15')](_0xa2c0('0x11'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x16')]);router[_0xa2c0('0x15')](_0xa2c0('0x13'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x17')]);router[_0xa2c0('0x18')](_0xa2c0('0xd'),auth['isAuthenticated'](),controller[_0xa2c0('0x19')]);router[_0xa2c0('0x1a')](_0xa2c0('0xd'),auth['isAuthenticated'](),controller[_0xa2c0('0x1b')]);router[_0xa2c0('0x1a')]('/:id/teams',auth[_0xa2c0('0x9')](),controller['removeTeams']);router['delete'](_0xa2c0('0x13'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x1c')]);module[_0xa2c0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 1053522..5ae5c4a 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 _0x54e8=['ENUM','rrmemory','exports','STRING','INTEGER'];(function(_0x2255dd,_0xcfe792){var _0x4acd1d=function(_0x45e53e){while(--_0x45e53e){_0x2255dd['push'](_0x2255dd['shift']());}};_0x4acd1d(++_0xcfe792);}(_0x54e8,0x138));var _0x854e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x54e8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x854e('0x0')]={'name':{'type':Sequelize[_0x854e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x854e('0x1')]},'timeout':{'type':Sequelize[_0x854e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x854e('0x3')](_0x854e('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x9597=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x27d26d,_0x337726){var _0x355be9=function(_0x6bb9fe){while(--_0x6bb9fe){_0x27d26d['push'](_0x27d26d['shift']());}};_0x355be9(++_0x337726);}(_0x9597,0x14d));var _0x7959=function(_0x5ecb54,_0x2c98ed){_0x5ecb54=_0x5ecb54-0x0;var _0x41a24b=_0x9597[_0x5ecb54];return _0x41a24b;};'use strict';var Sequelize=require('sequelize');module[_0x7959('0x0')]={'name':{'type':Sequelize[_0x7959('0x1')],'unique':_0x7959('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7959('0x1')]},'timeout':{'type':Sequelize[_0x7959('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7959('0x4')](_0x7959('0x5'),_0x7959('0x6'),_0x7959('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 860a34b..9de69e2 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 _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x442189,_0x435e08){var _0x4e0612=function(_0x1a5658){while(--_0x1a5658){_0x442189['push'](_0x442189['shift']());}};_0x4e0612(++_0x435e08);}(_0x2ef3,0xba));var _0x32ef=function(_0x32f272,_0x2350d6){_0x32f272=_0x32f272-0x0;var _0x208060=_0x2ef3[_0x32f272];return _0x208060;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0xadb5,0xad));var _0x5adb=function(_0x5593fb,_0x167972){_0x5593fb=_0x5593fb-0x0;var _0x5592b4=_0xadb5[_0x5593fb];return _0x5592b4;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 0a41560..0af3af1 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 _0xa0ee=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0ee,0xdc));var _0xea0e=function(_0x9105f4,_0x3bf6f7){_0x9105f4=_0x9105f4-0x0;var _0x57a818=_0xa0ee[_0x9105f4];return _0x57a818;};'use strict';var EventEmitter=require(_0xea0e('0x0'));var SmsQueue=require(_0xea0e('0x1'))['db'][_0xea0e('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xea0e('0x3')](0x0);var events={'afterCreate':_0xea0e('0x4'),'afterUpdate':_0xea0e('0x5'),'afterDestroy':_0xea0e('0x6')};function emitEvent(_0x11ce72){return function(_0x425733,_0x3fdf3a,_0x4a617a){SmsQueueEvents[_0xea0e('0x7')](_0x11ce72+':'+_0x425733['id'],_0x425733);SmsQueueEvents[_0xea0e('0x7')](_0x11ce72,_0x425733);_0x4a617a(null);};}for(var e in events){if(events[_0xea0e('0x8')](e)){var event=events[e];SmsQueue[_0xea0e('0x9')](e,emitEvent(event));}}module[_0xea0e('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0xcf69=['save','update','remove','emit','hook','exports','SmsQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf69,0xbe));var _0x9cf6=function(_0x538633,_0x212f1b){_0x538633=_0x538633-0x0;var _0x211be9=_0xcf69[_0x538633];return _0x211be9;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x9cf6('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9cf6('0x1')](0x0);var events={'afterCreate':_0x9cf6('0x2'),'afterUpdate':_0x9cf6('0x3'),'afterDestroy':_0x9cf6('0x4')};function emitEvent(_0x27e1cc){return function(_0x339188,_0xbdedcd,_0x3667a3){SmsQueueEvents[_0x9cf6('0x5')](_0x27e1cc+':'+_0x339188['id'],_0x339188);SmsQueueEvents['emit'](_0x27e1cc,_0x339188);_0x3667a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x9cf6('0x6')](e,emitEvent(event));}}module[_0x9cf6('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9c7d88c..e924ce3 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 _0x61cf=['../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61cf,0x130));var _0xf61c=function(_0xd41404,_0x37b3ec){_0xd41404=_0xd41404-0x0;var _0xe91dfe=_0x61cf[_0xd41404];return _0xe91dfe;};'use strict';var _=require(_0xf61c('0x0'));var util=require(_0xf61c('0x1'));var logger=require(_0xf61c('0x2'))('api');var moment=require(_0xf61c('0x3'));var BPromise=require(_0xf61c('0x4'));var rp=require(_0xf61c('0x5'));var fs=require('fs');var path=require(_0xf61c('0x6'));var rimraf=require(_0xf61c('0x7'));var config=require(_0xf61c('0x8'));var attributes=require(_0xf61c('0x9'));module['exports']=function(_0x2970be,_0xcfca27){return _0x2970be[_0xf61c('0xa')](_0xf61c('0xb'),attributes,{'tableName':_0xf61c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe99=['exports','define','SmsQueue','sms_queues','lodash','util','api','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes'];(function(_0x5ab4cd,_0x5e3220){var _0x353331=function(_0x697a){while(--_0x697a){_0x5ab4cd['push'](_0x5ab4cd['shift']());}};_0x353331(++_0x5e3220);}(_0xbe99,0x190));var _0x9be9=function(_0x3d7c58,_0x5113cb){_0x3d7c58=_0x3d7c58-0x0;var _0x330b65=_0xbe99[_0x3d7c58];return _0x330b65;};'use strict';var _=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var logger=require('../../config/logger')(_0x9be9('0x2'));var moment=require('moment');var BPromise=require(_0x9be9('0x3'));var rp=require(_0x9be9('0x4'));var fs=require('fs');var path=require(_0x9be9('0x5'));var rimraf=require('rimraf');var config=require(_0x9be9('0x6'));var attributes=require(_0x9be9('0x7'));module[_0x9be9('0x8')]=function(_0x47594f,_0x163909){return _0x47594f[_0x9be9('0x9')](_0x9be9('0xa'),attributes,{'tableName':_0x9be9('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 44c3c46..5b5f64e 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 _0x8835=['error','code','message','result','catch','SmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetSmsQueue','stringify','ShowSmsQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x8835,0x1f3));var _0x5883=function(_0x2df60e,_0x3e23b2){_0x2df60e=_0x2df60e-0x0;var _0x152ebe=_0x8835[_0x2df60e];return _0x152ebe;};'use strict';var _=require(_0x5883('0x0'));var util=require('util');var moment=require(_0x5883('0x1'));var BPromise=require('bluebird');var rs=require(_0x5883('0x2'));var fs=require('fs');var Redis=require(_0x5883('0x3'));var db=require(_0x5883('0x4'))['db'];var utils=require(_0x5883('0x5'));var logger=require(_0x5883('0x6'))('rpc');var config=require(_0x5883('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5883('0x8')]({'port':0x232a});config[_0x5883('0x9')]=_[_0x5883('0xa')](config[_0x5883('0x9')],{'host':_0x5883('0xb'),'port':0x18eb});var socket=require(_0x5883('0xc'))(new Redis(config[_0x5883('0x9')]));require(_0x5883('0xd'))[_0x5883('0xe')](socket);function respondWithRpcPromise(_0x3409f7,_0x19eca1,_0xb47c1c){return new BPromise(function(_0x4ec1f8,_0x5c95ef){return client['request'](_0x3409f7,_0xb47c1c)[_0x5883('0xf')](function(_0x4b57c2){logger[_0x5883('0x10')](_0x5883('0x11'),_0x19eca1,_0x5883('0x12'));logger[_0x5883('0x13')](_0x5883('0x14'),_0x19eca1,_0x5883('0x12'),JSON['stringify'](_0x4b57c2));if(_0x4b57c2[_0x5883('0x15')]){if(_0x4b57c2[_0x5883('0x15')][_0x5883('0x16')]===0x1f4){logger['error'](_0x5883('0x11'),_0x19eca1,_0x4b57c2[_0x5883('0x15')][_0x5883('0x17')]);return _0x5c95ef(_0x4b57c2[_0x5883('0x15')][_0x5883('0x17')]);}logger[_0x5883('0x15')](_0x5883('0x11'),_0x19eca1,_0x4b57c2[_0x5883('0x15')][_0x5883('0x17')]);return _0x4ec1f8(_0x4b57c2[_0x5883('0x15')][_0x5883('0x17')]);}else{logger['info'](_0x5883('0x11'),_0x19eca1,_0x5883('0x12'));_0x4ec1f8(_0x4b57c2[_0x5883('0x18')][_0x5883('0x17')]);}})[_0x5883('0x19')](function(_0x3f09d9){logger[_0x5883('0x15')](_0x5883('0x11'),_0x19eca1,_0x3f09d9);_0x5c95ef(_0x3f09d9);});});}exports['GetSmsQueue']=function(_0x1589be){var _0x3ca34c=this;return new Promise(function(_0x26229d,_0x5be9bd){return db[_0x5883('0x1a')][_0x5883('0x1b')]({'raw':_0x1589be[_0x5883('0x1c')]?_0x1589be[_0x5883('0x1c')][_0x5883('0x1d')]===undefined?!![]:![]:!![],'where':_0x1589be[_0x5883('0x1c')]?_0x1589be[_0x5883('0x1c')][_0x5883('0x1e')]||null:null,'attributes':_0x1589be['options']?_0x1589be['options'][_0x5883('0x1f')]||null:null,'limit':_0x1589be[_0x5883('0x1c')]?_0x1589be['options'][_0x5883('0x20')]||null:null,'include':_0x1589be['options']?_0x1589be[_0x5883('0x1c')]['include']?_[_0x5883('0x21')](_0x1589be[_0x5883('0x1c')][_0x5883('0x22')],function(_0x295388){return{'model':db[_0x295388[_0x5883('0x23')]],'as':_0x295388['as'],'attributes':_0x295388['attributes'],'include':_0x295388['include']?_['map'](_0x295388[_0x5883('0x22')],function(_0x33b3d5){return{'model':db[_0x33b3d5[_0x5883('0x23')]],'as':_0x33b3d5['as'],'attributes':_0x33b3d5[_0x5883('0x1f')],'include':_0x33b3d5[_0x5883('0x22')]?_[_0x5883('0x21')](_0x33b3d5[_0x5883('0x22')],function(_0x39084e){return{'model':db[_0x39084e['model']],'as':_0x39084e['as'],'attributes':_0x39084e[_0x5883('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5883('0xf')](function(_0x15bc4b){logger[_0x5883('0x10')](_0x5883('0x24'),_0x1589be);logger[_0x5883('0x13')](_0x5883('0x24'),_0x1589be,JSON[_0x5883('0x25')](_0x15bc4b));_0x26229d(_0x15bc4b);})[_0x5883('0x19')](function(_0x55f270){logger['error'](_0x5883('0x24'),_0x55f270['message'],_0x1589be);_0x5be9bd(_0x3ca34c[_0x5883('0x15')](0x1f4,_0x55f270['message']));});});};exports[_0x5883('0x26')]=function(_0x1eb72e){var _0x3c81a1=this;return new Promise(function(_0x3c3e54,_0x1e8a94){return db['SmsQueue'][_0x5883('0x27')]({'raw':_0x1eb72e['options']?_0x1eb72e['options'][_0x5883('0x1d')]===undefined?!![]:![]:!![],'where':_0x1eb72e['options']?_0x1eb72e[_0x5883('0x1c')]['where']||null:null,'attributes':_0x1eb72e['options']?_0x1eb72e[_0x5883('0x1c')]['attributes']||null:null,'include':_0x1eb72e['options']?_0x1eb72e[_0x5883('0x1c')][_0x5883('0x22')]?_['map'](_0x1eb72e[_0x5883('0x1c')]['include'],function(_0x90aff3){return{'model':db[_0x90aff3['model']],'as':_0x90aff3['as'],'attributes':_0x90aff3[_0x5883('0x1f')],'include':_0x90aff3[_0x5883('0x22')]?_[_0x5883('0x21')](_0x90aff3[_0x5883('0x22')],function(_0x4970c2){return{'model':db[_0x4970c2[_0x5883('0x23')]],'as':_0x4970c2['as'],'attributes':_0x4970c2['attributes'],'include':_0x4970c2[_0x5883('0x22')]?_[_0x5883('0x21')](_0x4970c2['include'],function(_0x2c406e){return{'model':db[_0x2c406e[_0x5883('0x23')]],'as':_0x2c406e['as'],'attributes':_0x2c406e[_0x5883('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5883('0xf')](function(_0x1d5d84){logger[_0x5883('0x10')](_0x5883('0x26'),_0x1eb72e);logger['debug'](_0x5883('0x26'),_0x1eb72e,JSON[_0x5883('0x25')](_0x1d5d84));_0x3c3e54(_0x1d5d84);})['catch'](function(_0x47e6d1){logger[_0x5883('0x15')](_0x5883('0x26'),_0x47e6d1[_0x5883('0x17')],_0x1eb72e);_0x1e8a94(_0x3c81a1['error'](0x1f4,_0x47e6d1[_0x5883('0x17')]));});});}; \ No newline at end of file +var _0x1a3d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','result','SmsQueue','findAll','options','where','attributes','limit','include','map','model','GetSmsQueue','catch','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3f6ec6,_0x370a00){var _0x42ccb6=function(_0x52e0ac){while(--_0x52e0ac){_0x3f6ec6['push'](_0x3f6ec6['shift']());}};_0x42ccb6(++_0x370a00);}(_0x1a3d,0x19e));var _0xd1a3=function(_0xadc85b,_0x2cf6c5){_0xadc85b=_0xadc85b-0x0;var _0x5be2ad=_0x1a3d[_0xadc85b];return _0x5be2ad;};'use strict';var _=require(_0xd1a3('0x0'));var util=require(_0xd1a3('0x1'));var moment=require(_0xd1a3('0x2'));var BPromise=require(_0xd1a3('0x3'));var rs=require(_0xd1a3('0x4'));var fs=require('fs');var Redis=require(_0xd1a3('0x5'));var db=require(_0xd1a3('0x6'))['db'];var utils=require(_0xd1a3('0x7'));var logger=require(_0xd1a3('0x8'))(_0xd1a3('0x9'));var config=require(_0xd1a3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd1a3('0xb')][_0xd1a3('0xc')]({'port':0x232a});config[_0xd1a3('0xd')]=_[_0xd1a3('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd1a3('0xf'))(new Redis(config[_0xd1a3('0xd')]));require(_0xd1a3('0x10'))[_0xd1a3('0x11')](socket);function respondWithRpcPromise(_0x247c92,_0x2ba999,_0x3ef424){return new BPromise(function(_0x337884,_0x68646c){return client['request'](_0x247c92,_0x3ef424)[_0xd1a3('0x12')](function(_0x32b78b){logger[_0xd1a3('0x13')]('SmsQueue,\x20%s,\x20%s',_0x2ba999,_0xd1a3('0x14'));logger[_0xd1a3('0x15')](_0xd1a3('0x16'),_0x2ba999,_0xd1a3('0x14'),JSON['stringify'](_0x32b78b));if(_0x32b78b[_0xd1a3('0x17')]){if(_0x32b78b[_0xd1a3('0x17')][_0xd1a3('0x18')]===0x1f4){logger['error'](_0xd1a3('0x19'),_0x2ba999,_0x32b78b['error'][_0xd1a3('0x1a')]);return _0x68646c(_0x32b78b['error'][_0xd1a3('0x1a')]);}logger[_0xd1a3('0x17')](_0xd1a3('0x19'),_0x2ba999,_0x32b78b['error'][_0xd1a3('0x1a')]);return _0x337884(_0x32b78b[_0xd1a3('0x17')][_0xd1a3('0x1a')]);}else{logger[_0xd1a3('0x13')](_0xd1a3('0x19'),_0x2ba999,_0xd1a3('0x14'));_0x337884(_0x32b78b[_0xd1a3('0x1b')][_0xd1a3('0x1a')]);}})['catch'](function(_0x386ce6){logger[_0xd1a3('0x17')](_0xd1a3('0x19'),_0x2ba999,_0x386ce6);_0x68646c(_0x386ce6);});});}exports['GetSmsQueue']=function(_0x4cc94e){var _0x2198dd=this;return new Promise(function(_0x2d4fa8,_0xdda45){return db[_0xd1a3('0x1c')][_0xd1a3('0x1d')]({'raw':_0x4cc94e[_0xd1a3('0x1e')]?_0x4cc94e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4cc94e['options']?_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x1f')]||null:null,'attributes':_0x4cc94e[_0xd1a3('0x1e')]?_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x20')]||null:null,'limit':_0x4cc94e[_0xd1a3('0x1e')]?_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x21')]||null:null,'include':_0x4cc94e[_0xd1a3('0x1e')]?_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x22')],function(_0x524923){return{'model':db[_0x524923[_0xd1a3('0x24')]],'as':_0x524923['as'],'attributes':_0x524923[_0xd1a3('0x20')],'include':_0x524923[_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0x524923['include'],function(_0x469002){return{'model':db[_0x469002[_0xd1a3('0x24')]],'as':_0x469002['as'],'attributes':_0x469002['attributes'],'include':_0x469002[_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0x469002[_0xd1a3('0x22')],function(_0x12d12d){return{'model':db[_0x12d12d[_0xd1a3('0x24')]],'as':_0x12d12d['as'],'attributes':_0x12d12d[_0xd1a3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd1a3('0x12')](function(_0x1d90a5){logger[_0xd1a3('0x13')](_0xd1a3('0x25'),_0x4cc94e);logger['debug'](_0xd1a3('0x25'),_0x4cc94e,JSON['stringify'](_0x1d90a5));_0x2d4fa8(_0x1d90a5);})[_0xd1a3('0x26')](function(_0x345c0e){logger[_0xd1a3('0x17')](_0xd1a3('0x25'),_0x345c0e[_0xd1a3('0x1a')],_0x4cc94e);_0xdda45(_0x2198dd[_0xd1a3('0x17')](0x1f4,_0x345c0e[_0xd1a3('0x1a')]));});});};exports[_0xd1a3('0x27')]=function(_0xbc7ef8){var _0x59e660=this;return new Promise(function(_0x18082e,_0x27a17f){return db[_0xd1a3('0x1c')][_0xd1a3('0x28')]({'raw':_0xbc7ef8[_0xd1a3('0x1e')]?_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x29')]===undefined?!![]:![]:!![],'where':_0xbc7ef8['options']?_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x1f')]||null:null,'attributes':_0xbc7ef8[_0xd1a3('0x1e')]?_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x20')]||null:null,'include':_0xbc7ef8['options']?_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x22')],function(_0x3ecd2a){return{'model':db[_0x3ecd2a[_0xd1a3('0x24')]],'as':_0x3ecd2a['as'],'attributes':_0x3ecd2a[_0xd1a3('0x20')],'include':_0x3ecd2a[_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0x3ecd2a[_0xd1a3('0x22')],function(_0xcaae28){return{'model':db[_0xcaae28[_0xd1a3('0x24')]],'as':_0xcaae28['as'],'attributes':_0xcaae28[_0xd1a3('0x20')],'include':_0xcaae28[_0xd1a3('0x22')]?_['map'](_0xcaae28[_0xd1a3('0x22')],function(_0x489ae7){return{'model':db[_0x489ae7[_0xd1a3('0x24')]],'as':_0x489ae7['as'],'attributes':_0x489ae7['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1a3('0x12')](function(_0x477d12){logger[_0xd1a3('0x13')]('ShowSmsQueue',_0xbc7ef8);logger[_0xd1a3('0x15')](_0xd1a3('0x27'),_0xbc7ef8,JSON['stringify'](_0x477d12));_0x18082e(_0x477d12);})[_0xd1a3('0x26')](function(_0x54f638){logger[_0xd1a3('0x17')](_0xd1a3('0x27'),_0x54f638['message'],_0xbc7ef8);_0x27a17f(_0x59e660[_0xd1a3('0x17')](0x1f4,_0x54f638[_0xd1a3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 51efeda..12df08b 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 _0x0195=['update','emit','register','./smsQueue.events','save','remove'];(function(_0x49df98,_0x3ddb49){var _0x3e69be=function(_0x113570){while(--_0x113570){_0x49df98['push'](_0x49df98['shift']());}};_0x3e69be(++_0x3ddb49);}(_0x0195,0x1ef));var _0x5019=function(_0x3a6552,_0x4a646f){_0x3a6552=_0x3a6552-0x0;var _0x39e40=_0x0195[_0x3a6552];return _0x39e40;};'use strict';var SmsQueueEvents=require(_0x5019('0x0'));var events=[_0x5019('0x1'),_0x5019('0x2'),_0x5019('0x3')];function createListener(_0x2b90d1,_0x145545){return function(_0x43894d){_0x145545[_0x5019('0x4')](_0x2b90d1,_0x43894d);};}function removeListener(_0x2fef59,_0x32109f){return function(){SmsQueueEvents['removeListener'](_0x2fef59,_0x32109f);};}exports[_0x5019('0x5')]=function(_0x11c40a){for(var _0x5182da=0x0,_0xcc336c=events['length'];_0x5182da<_0xcc336c;_0x5182da++){var _0x35f5a8=events[_0x5182da];var _0x3388cf=createListener('smsQueue:'+_0x35f5a8,_0x11c40a);SmsQueueEvents['on'](_0x35f5a8,_0x3388cf);}}; \ No newline at end of file +var _0x6815=['update','emit','register','length','smsQueue:','./smsQueue.events','remove'];(function(_0x5cdc52,_0x33ce72){var _0x455283=function(_0x54070d){while(--_0x54070d){_0x5cdc52['push'](_0x5cdc52['shift']());}};_0x455283(++_0x33ce72);}(_0x6815,0x10f));var _0x5681=function(_0x1bd465,_0x5b5b1a){_0x1bd465=_0x1bd465-0x0;var _0x1a7aaa=_0x6815[_0x1bd465];return _0x1a7aaa;};'use strict';var SmsQueueEvents=require(_0x5681('0x0'));var events=['save',_0x5681('0x1'),_0x5681('0x2')];function createListener(_0x1305a6,_0x56af64){return function(_0x301603){_0x56af64[_0x5681('0x3')](_0x1305a6,_0x301603);};}function removeListener(_0x345385,_0x48431f){return function(){SmsQueueEvents['removeListener'](_0x345385,_0x48431f);};}exports[_0x5681('0x4')]=function(_0x2950be){for(var _0x233b25=0x0,_0x51a5c5=events[_0x5681('0x5')];_0x233b25<_0x51a5c5;_0x233b25++){var _0xee5234=events[_0x233b25];var _0xfcc182=createListener(_0x5681('0x6')+_0xee5234,_0x2950be);SmsQueueEvents['on'](_0xee5234,_0xfcc182);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 69e0e07..85fbacd 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 _0x081c=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','Router','fs-extra','../../components/interaction/service','get'];(function(_0x1ccb95,_0x1b3be8){var _0x1a9725=function(_0x1a6bf7){while(--_0x1a6bf7){_0x1ccb95['push'](_0x1ccb95['shift']());}};_0x1a9725(++_0x1b3be8);}(_0x081c,0xeb));var _0xc081=function(_0x2bbb3d,_0x400061){_0x2bbb3d=_0x2bbb3d-0x0;var _0x5739f0=_0x081c[_0x2bbb3d];return _0x5739f0;};'use strict';var multer=require(_0xc081('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc081('0x1')]();var fs_extra=require(_0xc081('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc081('0x3'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xc081('0x4')]('/',auth[_0xc081('0x5')](),controller[_0xc081('0x6')]);router['get'](_0xc081('0x7'),auth['isAuthenticated'](),controller[_0xc081('0x8')]);router['get'](_0xc081('0x9'),auth[_0xc081('0x5')](),controller[_0xc081('0xa')]);router['post']('/',auth[_0xc081('0x5')](),controller[_0xc081('0xb')]);router[_0xc081('0xc')](_0xc081('0x9'),auth['isAuthenticated'](),controller[_0xc081('0xd')]);router[_0xc081('0xe')](_0xc081('0x9'),auth[_0xc081('0x5')](),controller[_0xc081('0xf')]);module['exports']=router; \ No newline at end of file +var _0xabd7=['/:id','post','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe'];(function(_0x21b62a,_0x592986){var _0x35e8ce=function(_0x278b73){while(--_0x278b73){_0x21b62a['push'](_0x21b62a['shift']());}};_0x35e8ce(++_0x592986);}(_0xabd7,0x6b));var _0x7abd=function(_0x4482b7,_0x2e4f0e){_0x4482b7=_0x4482b7-0x0;var _0x2aef2f=_0xabd7[_0x4482b7];return _0x2aef2f;};'use strict';var multer=require('multer');var util=require(_0x7abd('0x0'));var path=require(_0x7abd('0x1'));var timeout=require(_0x7abd('0x2'));var express=require(_0x7abd('0x3'));var router=express[_0x7abd('0x4')]();var fs_extra=require(_0x7abd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7abd('0x6'));var config=require(_0x7abd('0x7'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x7abd('0x8')](),controller['index']);router[_0x7abd('0x9')](_0x7abd('0xa'),auth[_0x7abd('0x8')](),controller[_0x7abd('0xb')]);router['get'](_0x7abd('0xc'),auth[_0x7abd('0x8')](),controller['show']);router[_0x7abd('0xd')]('/',auth[_0x7abd('0x8')](),controller['create']);router[_0x7abd('0xe')](_0x7abd('0xc'),auth['isAuthenticated'](),controller[_0x7abd('0xf')]);router[_0x7abd('0x10')](_0x7abd('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index abc24f1..c0db0c0 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 _0xa514=['sequelize','exports','DATE','moment'];(function(_0x3eb298,_0x2031db){var _0x4ace45=function(_0x2ede33){while(--_0x2ede33){_0x3eb298['push'](_0x3eb298['shift']());}};_0x4ace45(++_0x2031db);}(_0xa514,0xaf));var _0x4a51=function(_0x21848c,_0x1053ed){_0x21848c=_0x21848c-0x0;var _0x15f148=_0xa514[_0x21848c];return _0x15f148;};'use strict';var moment=require(_0x4a51('0x0'));var Sequelize=require(_0x4a51('0x1'));module[_0x4a51('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4a51('0x3')]},'leaveAt':{'type':Sequelize[_0x4a51('0x3')]},'acceptAt':{'type':Sequelize[_0x4a51('0x3')]},'exitAt':{'type':Sequelize[_0x4a51('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b35=['STRING','DATE','moment','sequelize','exports'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x6b35,0x1f1));var _0x56b3=function(_0x980451,_0x38ac25){_0x980451=_0x980451-0x0;var _0x471258=_0x6b35[_0x980451];return _0x471258;};'use strict';var moment=require(_0x56b3('0x0'));var Sequelize=require(_0x56b3('0x1'));module[_0x56b3('0x2')]={'uniqueid':{'type':Sequelize[_0x56b3('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x56b3('0x4')]},'leaveAt':{'type':Sequelize[_0x56b3('0x4')]},'acceptAt':{'type':Sequelize[_0x56b3('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x56b3('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1d088f9..306101b 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 _0xe05c=['create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','then','destroy','end','error','name','send','index','SmsQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x5c4e10,_0x210d3a){var _0x3eef36=function(_0x3d59e4){while(--_0x3d59e4){_0x5c4e10['push'](_0x5c4e10['shift']());}};_0x3eef36(++_0x210d3a);}(_0xe05c,0x1bf));var _0xce05=function(_0x38db1d,_0x15f165){_0x38db1d=_0x38db1d-0x0;var _0x24077f=_0xe05c[_0x38db1d];return _0x24077f;};'use strict';var emlformat=require(_0xce05('0x0'));var rimraf=require(_0xce05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce05('0x2'));var rp=require('request-promise');var moment=require(_0xce05('0x3'));var BPromise=require(_0xce05('0x4'));var Mustache=require(_0xce05('0x5'));var util=require(_0xce05('0x6'));var path=require(_0xce05('0x7'));var sox=require(_0xce05('0x8'));var csv=require('to-csv');var ejs=require(_0xce05('0x9'));var fs=require('fs');var fs_extra=require(_0xce05('0xa'));var _=require(_0xce05('0xb'));var squel=require('squel');var crypto=require(_0xce05('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce05('0xd'));var querystring=require(_0xce05('0xe'));var Papa=require('papaparse');var Redis=require(_0xce05('0xf'));var authService=require(_0xce05('0x10'));var qs=require(_0xce05('0x11'));var as=require(_0xce05('0x12'));var hardwareService=require(_0xce05('0x13'));var logger=require(_0xce05('0x14'))(_0xce05('0x15'));var utils=require(_0xce05('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xce05('0x17'));var db=require(_0xce05('0x18'))['db'];function respondWithStatusCode(_0x37f17d,_0x5d3c0d){_0x5d3c0d=_0x5d3c0d||0xcc;return function(_0x577005){if(_0x577005){return _0x37f17d[_0xce05('0x19')](_0x5d3c0d);}return _0x37f17d[_0xce05('0x1a')](_0x5d3c0d)['end']();};}function respondWithResult(_0x4d3132,_0xf58ac5){_0xf58ac5=_0xf58ac5||0xc8;return function(_0x17cacd){if(_0x17cacd){return _0x4d3132[_0xce05('0x1a')](_0xf58ac5)[_0xce05('0x1b')](_0x17cacd);}};}function respondWithFilteredResult(_0x3dc602,_0x32c149){return function(_0x392c4d){if(_0x392c4d){var _0x1562ff=typeof _0x32c149[_0xce05('0x1c')]==='undefined'&&typeof _0x32c149[_0xce05('0x1d')]===_0xce05('0x1e');var _0x212d9e=_0x392c4d[_0xce05('0x1f')];var _0xf7d6e4=_0x1562ff?0x0:_0x32c149[_0xce05('0x1c')];var _0x377f4c=_0x1562ff?_0x392c4d['count']:_0x32c149[_0xce05('0x1c')]+_0x32c149[_0xce05('0x1d')];var _0x52be76;if(_0x377f4c>=_0x212d9e){_0x377f4c=_0x212d9e;_0x52be76=0xc8;}else{_0x52be76=0xce;}_0x3dc602[_0xce05('0x1a')](_0x52be76);return _0x3dc602[_0xce05('0x20')]('Content-Range',_0xf7d6e4+'-'+_0x377f4c+'/'+_0x212d9e)[_0xce05('0x1b')](_0x392c4d);}return null;};}function patchUpdates(_0x5ed3c8){return function(_0x2ce6ab){try{jsonpatch['apply'](_0x2ce6ab,_0x5ed3c8,!![]);}catch(_0x58d3a5){return BPromise[_0xce05('0x21')](_0x58d3a5);}return _0x2ce6ab['save']();};}function saveUpdates(_0x56e947,_0x2bb3cc){return function(_0x3ff2ca){if(_0x3ff2ca){return _0x3ff2ca[_0xce05('0x22')](_0x56e947)[_0xce05('0x23')](function(_0xd65733){return _0xd65733;});}return null;};}function removeEntity(_0xd90d34,_0x54ed72){return function(_0x507d43){if(_0x507d43){return _0x507d43[_0xce05('0x24')]()[_0xce05('0x23')](function(){_0xd90d34[_0xce05('0x1a')](0xcc)[_0xce05('0x25')]();});}};}function handleEntityNotFound(_0x4460a5,_0x16897e){return function(_0x5cda03){if(!_0x5cda03){_0x4460a5[_0xce05('0x19')](0x194);}return _0x5cda03;};}function handleError(_0x3030ad,_0x57ad3f){_0x57ad3f=_0x57ad3f||0x1f4;return function(_0x55a412){logger[_0xce05('0x26')](_0x55a412['stack']);if(_0x55a412[_0xce05('0x27')]){delete _0x55a412[_0xce05('0x27')];}_0x3030ad[_0xce05('0x1a')](_0x57ad3f)[_0xce05('0x28')](_0x55a412);};}exports[_0xce05('0x29')]=function(_0x2ddf83,_0x372ece){var _0x22b52c={},_0x1bd150={},_0x15a545={'count':0x0,'rows':[]};var _0x667b4c=_['map'](db[_0xce05('0x2a')][_0xce05('0x2b')],function(_0x38da2f){return{'name':_0x38da2f['fieldName'],'type':_0x38da2f['type'][_0xce05('0x2c')]};});_0x1bd150[_0xce05('0x2d')]=_['map'](_0x667b4c,_0xce05('0x27'));_0x1bd150[_0xce05('0x2e')]=_[_0xce05('0x2f')](_0x2ddf83[_0xce05('0x2e')]);_0x1bd150[_0xce05('0x30')]=_[_0xce05('0x31')](_0x1bd150[_0xce05('0x2d')],_0x1bd150[_0xce05('0x2e')]);_0x22b52c[_0xce05('0x32')]=_[_0xce05('0x31')](_0x1bd150['model'],qs[_0xce05('0x33')](_0x2ddf83[_0xce05('0x2e')][_0xce05('0x33')]));_0x22b52c[_0xce05('0x32')]=_0x22b52c[_0xce05('0x32')]['length']?_0x22b52c[_0xce05('0x32')]:_0x1bd150[_0xce05('0x2d')];if(!_0x2ddf83[_0xce05('0x2e')][_0xce05('0x34')]('nolimit')){_0x22b52c[_0xce05('0x1d')]=qs[_0xce05('0x1d')](_0x2ddf83[_0xce05('0x2e')]['limit']);_0x22b52c[_0xce05('0x1c')]=qs[_0xce05('0x1c')](_0x2ddf83[_0xce05('0x2e')][_0xce05('0x1c')]);}_0x22b52c[_0xce05('0x35')]=qs[_0xce05('0x36')](_0x2ddf83[_0xce05('0x2e')][_0xce05('0x36')]);_0x22b52c[_0xce05('0x37')]=qs['filters'](_[_0xce05('0x38')](_0x2ddf83['query'],_0x1bd150[_0xce05('0x30')]),_0x667b4c);if(_0x2ddf83[_0xce05('0x2e')][_0xce05('0x39')]){_0x22b52c[_0xce05('0x37')]=_[_0xce05('0x3a')](_0x22b52c[_0xce05('0x37')],{'$or':_[_0xce05('0x3b')](_0x667b4c,function(_0x3a190a){if(_0x3a190a[_0xce05('0x3c')]!==_0xce05('0x3d')){var _0xfaeb9c={};_0xfaeb9c[_0x3a190a[_0xce05('0x27')]]={'$like':'%'+_0x2ddf83[_0xce05('0x2e')][_0xce05('0x39')]+'%'};return _0xfaeb9c;}})});}_0x22b52c=_[_0xce05('0x3a')]({},_0x22b52c,_0x2ddf83[_0xce05('0x3e')]);var _0x132efb={'where':_0x22b52c[_0xce05('0x37')]};return db[_0xce05('0x2a')][_0xce05('0x1f')](_0x132efb)['then'](function(_0x2dfbcd){_0x15a545[_0xce05('0x1f')]=_0x2dfbcd;if(_0x2ddf83[_0xce05('0x2e')][_0xce05('0x3f')]){_0x22b52c['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0xce05('0x40')](_0x22b52c);})[_0xce05('0x23')](function(_0x19f13b){_0x15a545[_0xce05('0x41')]=_0x19f13b;return _0x15a545;})[_0xce05('0x23')](respondWithFilteredResult(_0x372ece,_0x22b52c))[_0xce05('0x42')](handleError(_0x372ece,null));};exports[_0xce05('0x43')]=function(_0x55babc,_0x503b32){var _0x4e1893={'raw':!![],'where':{'id':_0x55babc[_0xce05('0x44')]['id']}},_0x595a65={};_0x595a65[_0xce05('0x2d')]=_[_0xce05('0x2f')](db[_0xce05('0x2a')]['rawAttributes']);_0x595a65['query']=_[_0xce05('0x2f')](_0x55babc[_0xce05('0x2e')]);_0x595a65[_0xce05('0x30')]=_[_0xce05('0x31')](_0x595a65[_0xce05('0x2d')],_0x595a65[_0xce05('0x2e')]);_0x4e1893['attributes']=_['intersection'](_0x595a65[_0xce05('0x2d')],qs[_0xce05('0x33')](_0x55babc[_0xce05('0x2e')]['fields']));_0x4e1893[_0xce05('0x32')]=_0x4e1893[_0xce05('0x32')]['length']?_0x4e1893[_0xce05('0x32')]:_0x595a65[_0xce05('0x2d')];if(_0x55babc['query'][_0xce05('0x3f')]){_0x4e1893[_0xce05('0x45')]=[{'all':!![]}];}_0x4e1893=_[_0xce05('0x3a')]({},_0x4e1893,_0x55babc['options']);return db[_0xce05('0x2a')][_0xce05('0x46')](_0x4e1893)['then'](handleEntityNotFound(_0x503b32,null))['then'](respondWithResult(_0x503b32,null))[_0xce05('0x42')](handleError(_0x503b32,null));};exports[_0xce05('0x47')]=function(_0x4a98a7,_0x5e24d1){return db[_0xce05('0x2a')][_0xce05('0x47')](_0x4a98a7['body'],{})[_0xce05('0x23')](respondWithResult(_0x5e24d1,0xc9))['catch'](handleError(_0x5e24d1,null));};exports[_0xce05('0x22')]=function(_0x3d3f17,_0x46306c){if(_0x3d3f17[_0xce05('0x48')]['id']){delete _0x3d3f17[_0xce05('0x48')]['id'];}return db['SmsQueueReport'][_0xce05('0x46')]({'where':{'id':_0x3d3f17['params']['id']}})[_0xce05('0x23')](handleEntityNotFound(_0x46306c,null))['then'](saveUpdates(_0x3d3f17[_0xce05('0x48')],null))[_0xce05('0x23')](respondWithResult(_0x46306c,null))['catch'](handleError(_0x46306c,null));};exports[_0xce05('0x24')]=function(_0x431732,_0x36dedb){return db['SmsQueueReport'][_0xce05('0x46')]({'where':{'id':_0x431732[_0xce05('0x44')]['id']}})[_0xce05('0x23')](handleEntityNotFound(_0x36dedb,null))[_0xce05('0x23')](removeEntity(_0x36dedb,null))[_0xce05('0x42')](handleError(_0x36dedb,null));};exports[_0xce05('0x49')]=function(_0x43ce55,_0x3dfbf4){return db[_0xce05('0x2a')][_0xce05('0x49')]()[_0xce05('0x23')](respondWithResult(_0x3dfbf4,null))[_0xce05('0x42')](handleError(_0x3dfbf4,null));}; \ No newline at end of file +var _0x34e3=['findAll','rows','catch','params','rawAttributes','includeAll','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','map','SmsQueueReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x366195,_0x50da84){var _0xf37646=function(_0x53a253){while(--_0x53a253){_0x366195['push'](_0x366195['shift']());}};_0xf37646(++_0x50da84);}(_0x34e3,0x97));var _0x334e=function(_0x43918d,_0x255ee2){_0x43918d=_0x43918d-0x0;var _0xdf6288=_0x34e3[_0x43918d];return _0xdf6288;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x334e('0x0'));var jsonpatch=require(_0x334e('0x1'));var rp=require(_0x334e('0x2'));var moment=require(_0x334e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x334e('0x4'));var path=require(_0x334e('0x5'));var sox=require(_0x334e('0x6'));var csv=require(_0x334e('0x7'));var ejs=require(_0x334e('0x8'));var fs=require('fs');var fs_extra=require(_0x334e('0x9'));var _=require(_0x334e('0xa'));var squel=require(_0x334e('0xb'));var crypto=require(_0x334e('0xc'));var jsforce=require(_0x334e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x334e('0x7'));var querystring=require('querystring');var Papa=require(_0x334e('0xe'));var Redis=require(_0x334e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x334e('0x10'));var as=require(_0x334e('0x11'));var hardwareService=require(_0x334e('0x12'));var logger=require(_0x334e('0x13'))(_0x334e('0x14'));var utils=require('../../config/utils');var config=require(_0x334e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x334e('0x16'))['db'];function respondWithStatusCode(_0x1c2b47,_0xc26f23){_0xc26f23=_0xc26f23||0xcc;return function(_0x3131aa){if(_0x3131aa){return _0x1c2b47[_0x334e('0x17')](_0xc26f23);}return _0x1c2b47[_0x334e('0x18')](_0xc26f23)[_0x334e('0x19')]();};}function respondWithResult(_0x4081fd,_0x381e8d){_0x381e8d=_0x381e8d||0xc8;return function(_0x10a55b){if(_0x10a55b){return _0x4081fd[_0x334e('0x18')](_0x381e8d)[_0x334e('0x1a')](_0x10a55b);}};}function respondWithFilteredResult(_0xd392a1,_0x1e04e0){return function(_0x3a23c6){if(_0x3a23c6){var _0x1f1c07=typeof _0x1e04e0[_0x334e('0x1b')]===_0x334e('0x1c')&&typeof _0x1e04e0[_0x334e('0x1d')]==='undefined';var _0x58f967=_0x3a23c6[_0x334e('0x1e')];var _0x1aaf37=_0x1f1c07?0x0:_0x1e04e0[_0x334e('0x1b')];var _0x2d02a5=_0x1f1c07?_0x3a23c6[_0x334e('0x1e')]:_0x1e04e0[_0x334e('0x1b')]+_0x1e04e0['limit'];var _0x2fdd29;if(_0x2d02a5>=_0x58f967){_0x2d02a5=_0x58f967;_0x2fdd29=0xc8;}else{_0x2fdd29=0xce;}_0xd392a1['status'](_0x2fdd29);return _0xd392a1[_0x334e('0x1f')]('Content-Range',_0x1aaf37+'-'+_0x2d02a5+'/'+_0x58f967)['json'](_0x3a23c6);}return null;};}function patchUpdates(_0x36ad5b){return function(_0x5b0fa3){try{jsonpatch[_0x334e('0x20')](_0x5b0fa3,_0x36ad5b,!![]);}catch(_0x4d09e8){return BPromise[_0x334e('0x21')](_0x4d09e8);}return _0x5b0fa3[_0x334e('0x22')]();};}function saveUpdates(_0x4ac0b8,_0x4c2144){return function(_0x153d47){if(_0x153d47){return _0x153d47['update'](_0x4ac0b8)[_0x334e('0x23')](function(_0x44eb09){return _0x44eb09;});}return null;};}function removeEntity(_0x4d6c92,_0x155ef6){return function(_0x22da1e){if(_0x22da1e){return _0x22da1e[_0x334e('0x24')]()[_0x334e('0x23')](function(){_0x4d6c92[_0x334e('0x18')](0xcc)[_0x334e('0x19')]();});}};}function handleEntityNotFound(_0x192744,_0x342a0a){return function(_0x23be11){if(!_0x23be11){_0x192744[_0x334e('0x17')](0x194);}return _0x23be11;};}function handleError(_0x34337a,_0x486f77){_0x486f77=_0x486f77||0x1f4;return function(_0x27ea67){logger[_0x334e('0x25')](_0x27ea67[_0x334e('0x26')]);if(_0x27ea67[_0x334e('0x27')]){delete _0x27ea67[_0x334e('0x27')];}_0x34337a[_0x334e('0x18')](_0x486f77)[_0x334e('0x28')](_0x27ea67);};}exports['index']=function(_0x1894ec,_0x5bfc12){var _0x5d8d74={},_0x36ac3f={},_0x57b457={'count':0x0,'rows':[]};var _0x4d198e=_[_0x334e('0x29')](db[_0x334e('0x2a')]['rawAttributes'],function(_0x3eeb59){return{'name':_0x3eeb59['fieldName'],'type':_0x3eeb59[_0x334e('0x2b')][_0x334e('0x2c')]};});_0x36ac3f[_0x334e('0x2d')]=_[_0x334e('0x29')](_0x4d198e,_0x334e('0x27'));_0x36ac3f[_0x334e('0x2e')]=_[_0x334e('0x2f')](_0x1894ec['query']);_0x36ac3f[_0x334e('0x30')]=_['intersection'](_0x36ac3f['model'],_0x36ac3f[_0x334e('0x2e')]);_0x5d8d74['attributes']=_[_0x334e('0x31')](_0x36ac3f[_0x334e('0x2d')],qs[_0x334e('0x32')](_0x1894ec['query'][_0x334e('0x32')]));_0x5d8d74[_0x334e('0x33')]=_0x5d8d74['attributes'][_0x334e('0x34')]?_0x5d8d74['attributes']:_0x36ac3f[_0x334e('0x2d')];if(!_0x1894ec['query'][_0x334e('0x35')]('nolimit')){_0x5d8d74[_0x334e('0x1d')]=qs[_0x334e('0x1d')](_0x1894ec[_0x334e('0x2e')][_0x334e('0x1d')]);_0x5d8d74[_0x334e('0x1b')]=qs[_0x334e('0x1b')](_0x1894ec[_0x334e('0x2e')][_0x334e('0x1b')]);}_0x5d8d74['order']=qs[_0x334e('0x36')](_0x1894ec['query']['sort']);_0x5d8d74[_0x334e('0x37')]=qs[_0x334e('0x30')](_[_0x334e('0x38')](_0x1894ec[_0x334e('0x2e')],_0x36ac3f['filters']),_0x4d198e);if(_0x1894ec['query'][_0x334e('0x39')]){_0x5d8d74[_0x334e('0x37')]=_[_0x334e('0x3a')](_0x5d8d74[_0x334e('0x37')],{'$or':_[_0x334e('0x29')](_0x4d198e,function(_0x2eccd9){if(_0x2eccd9['type']!==_0x334e('0x3b')){var _0x4c34aa={};_0x4c34aa[_0x2eccd9[_0x334e('0x27')]]={'$like':'%'+_0x1894ec['query'][_0x334e('0x39')]+'%'};return _0x4c34aa;}})});}_0x5d8d74=_[_0x334e('0x3a')]({},_0x5d8d74,_0x1894ec[_0x334e('0x3c')]);var _0x2f56bf={'where':_0x5d8d74[_0x334e('0x37')]};return db[_0x334e('0x2a')][_0x334e('0x1e')](_0x2f56bf)['then'](function(_0x3f08c0){_0x57b457[_0x334e('0x1e')]=_0x3f08c0;if(_0x1894ec[_0x334e('0x2e')]['includeAll']){_0x5d8d74[_0x334e('0x3d')]=[{'all':!![]}];}return db[_0x334e('0x2a')][_0x334e('0x3e')](_0x5d8d74);})[_0x334e('0x23')](function(_0x18f4be){_0x57b457[_0x334e('0x3f')]=_0x18f4be;return _0x57b457;})[_0x334e('0x23')](respondWithFilteredResult(_0x5bfc12,_0x5d8d74))[_0x334e('0x40')](handleError(_0x5bfc12,null));};exports['show']=function(_0x36c682,_0x55456e){var _0x48759d={'raw':!![],'where':{'id':_0x36c682[_0x334e('0x41')]['id']}},_0x3d745c={};_0x3d745c[_0x334e('0x2d')]=_[_0x334e('0x2f')](db['SmsQueueReport'][_0x334e('0x42')]);_0x3d745c[_0x334e('0x2e')]=_[_0x334e('0x2f')](_0x36c682[_0x334e('0x2e')]);_0x3d745c[_0x334e('0x30')]=_[_0x334e('0x31')](_0x3d745c[_0x334e('0x2d')],_0x3d745c[_0x334e('0x2e')]);_0x48759d[_0x334e('0x33')]=_['intersection'](_0x3d745c[_0x334e('0x2d')],qs[_0x334e('0x32')](_0x36c682[_0x334e('0x2e')][_0x334e('0x32')]));_0x48759d[_0x334e('0x33')]=_0x48759d[_0x334e('0x33')]['length']?_0x48759d['attributes']:_0x3d745c['model'];if(_0x36c682[_0x334e('0x2e')][_0x334e('0x43')]){_0x48759d[_0x334e('0x3d')]=[{'all':!![]}];}_0x48759d=_[_0x334e('0x3a')]({},_0x48759d,_0x36c682[_0x334e('0x3c')]);return db[_0x334e('0x2a')]['find'](_0x48759d)[_0x334e('0x23')](handleEntityNotFound(_0x55456e,null))[_0x334e('0x23')](respondWithResult(_0x55456e,null))[_0x334e('0x40')](handleError(_0x55456e,null));};exports[_0x334e('0x44')]=function(_0x3cbe6c,_0x1af8aa){return db[_0x334e('0x2a')][_0x334e('0x44')](_0x3cbe6c[_0x334e('0x45')],{})[_0x334e('0x23')](respondWithResult(_0x1af8aa,0xc9))[_0x334e('0x40')](handleError(_0x1af8aa,null));};exports['update']=function(_0xaebe7,_0x51e203){if(_0xaebe7[_0x334e('0x45')]['id']){delete _0xaebe7[_0x334e('0x45')]['id'];}return db[_0x334e('0x2a')]['find']({'where':{'id':_0xaebe7[_0x334e('0x41')]['id']}})['then'](handleEntityNotFound(_0x51e203,null))['then'](saveUpdates(_0xaebe7['body'],null))[_0x334e('0x23')](respondWithResult(_0x51e203,null))[_0x334e('0x40')](handleError(_0x51e203,null));};exports[_0x334e('0x24')]=function(_0x3233ed,_0x3c6b09){return db[_0x334e('0x2a')]['find']({'where':{'id':_0x3233ed[_0x334e('0x41')]['id']}})[_0x334e('0x23')](handleEntityNotFound(_0x3c6b09,null))[_0x334e('0x23')](removeEntity(_0x3c6b09,null))['catch'](handleError(_0x3c6b09,null));};exports['describe']=function(_0x4374ad,_0x3dfbd2){return db['SmsQueueReport'][_0x334e('0x46')]()['then'](respondWithResult(_0x3dfbd2,null))[_0x334e('0x40')](handleError(_0x3dfbd2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 2e1a9a1..754abf5 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x13315d,_0x1d9044){var _0x51d04e=function(_0xc25963){while(--_0xc25963){_0x13315d['push'](_0x13315d['shift']());}};_0x51d04e(++_0x1d9044);}(_0xb7e7,0x121));var _0x7b7e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xb7e7[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var 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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0889861..686ad31 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 _0x7741=['SmsQueueReport,\x20%s,\x20%s','info','result','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','catch','UpdateSmsQueueReport','where','attributes','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x6bdba0,_0x2bccfd){var _0x4afe03=function(_0x1e68aa){while(--_0x1e68aa){_0x6bdba0['push'](_0x6bdba0['shift']());}};_0x4afe03(++_0x2bccfd);}(_0x7741,0x182));var _0x1774=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7741[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1774('0x0'));var util=require(_0x1774('0x1'));var moment=require(_0x1774('0x2'));var BPromise=require('bluebird');var rs=require(_0x1774('0x3'));var fs=require('fs');var Redis=require(_0x1774('0x4'));var db=require(_0x1774('0x5'))['db'];var utils=require(_0x1774('0x6'));var logger=require('../../config/logger')(_0x1774('0x7'));var config=require(_0x1774('0x8'));var jayson=require(_0x1774('0x9'));var client=jayson['client'][_0x1774('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36a599,_0x3ce4d5,_0x573582){return new BPromise(function(_0x2971f5,_0x12d616){return client['request'](_0x36a599,_0x573582)['then'](function(_0x1f3ec4){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x3ce4d5,'request\x20sent');logger[_0x1774('0xb')](_0x1774('0xc'),_0x3ce4d5,_0x1774('0xd'),JSON['stringify'](_0x1f3ec4));if(_0x1f3ec4[_0x1774('0xe')]){if(_0x1f3ec4['error'][_0x1774('0xf')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3ce4d5,_0x1f3ec4['error'][_0x1774('0x10')]);return _0x12d616(_0x1f3ec4[_0x1774('0xe')][_0x1774('0x10')]);}logger[_0x1774('0xe')](_0x1774('0x11'),_0x3ce4d5,_0x1f3ec4[_0x1774('0xe')][_0x1774('0x10')]);return _0x2971f5(_0x1f3ec4[_0x1774('0xe')][_0x1774('0x10')]);}else{logger[_0x1774('0x12')](_0x1774('0x11'),_0x3ce4d5,'request\x20sent');_0x2971f5(_0x1f3ec4[_0x1774('0x13')][_0x1774('0x10')]);}})['catch'](function(_0xd70268){logger[_0x1774('0xe')](_0x1774('0x11'),_0x3ce4d5,_0xd70268);_0x12d616(_0xd70268);});});}exports[_0x1774('0x14')]=function(_0x497ef8){var _0x285741=this;return new Promise(function(_0x1451fd,_0x2fcc59){return db[_0x1774('0x15')]['create'](_0x497ef8[_0x1774('0x16')],{'raw':_0x497ef8[_0x1774('0x17')]?_0x497ef8['options'][_0x1774('0x18')]===undefined?!![]:![]:!![]})[_0x1774('0x19')](function(_0x4d62ba){logger[_0x1774('0x12')](_0x1774('0x14'),_0x497ef8);logger[_0x1774('0xb')](_0x1774('0x14'),_0x497ef8,JSON['stringify'](_0x4d62ba));_0x1451fd(_0x4d62ba);})[_0x1774('0x1a')](function(_0x26df3d){logger[_0x1774('0xe')](_0x1774('0x14'),_0x26df3d[_0x1774('0x10')],_0x497ef8);_0x2fcc59(_0x285741[_0x1774('0xe')](0x1f4,_0x26df3d['message']));});});};exports[_0x1774('0x1b')]=function(_0x1be5d6){var _0x3b951c=this;return new Promise(function(_0x2a446a,_0x53d73b){return db[_0x1774('0x15')]['update'](_0x1be5d6[_0x1774('0x16')],{'raw':_0x1be5d6[_0x1774('0x17')]?_0x1be5d6[_0x1774('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1be5d6[_0x1774('0x17')]?_0x1be5d6['options'][_0x1774('0x1c')]||null:null,'attributes':_0x1be5d6[_0x1774('0x17')]?_0x1be5d6['options'][_0x1774('0x1d')]||null:null,'limit':_0x1be5d6[_0x1774('0x17')]?_0x1be5d6[_0x1774('0x17')]['limit']||null:null})[_0x1774('0x19')](function(_0x45ce10){logger[_0x1774('0x12')](_0x1774('0x1b'),_0x1be5d6);logger[_0x1774('0xb')](_0x1774('0x1b'),_0x1be5d6,JSON[_0x1774('0x1e')](_0x45ce10));_0x2a446a(_0x45ce10);})['catch'](function(_0x51a3ab){logger['error'](_0x1774('0x1b'),_0x51a3ab[_0x1774('0x10')],_0x1be5d6);_0x53d73b(_0x3b951c['error'](0x1f4,_0x51a3ab[_0x1774('0x10')]));});});}; \ No newline at end of file +var _0x4f22=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','update','attributes','limit','UpdateSmsQueueReport','debug','catch','lodash','util','moment'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x4f22,0x1aa));var _0x24f2=function(_0x1e9bd9,_0x18a90a){_0x1e9bd9=_0x1e9bd9-0x0;var _0x2076d6=_0x4f22[_0x1e9bd9];return _0x2076d6;};'use strict';var _=require(_0x24f2('0x0'));var util=require(_0x24f2('0x1'));var moment=require(_0x24f2('0x2'));var BPromise=require(_0x24f2('0x3'));var rs=require(_0x24f2('0x4'));var fs=require('fs');var Redis=require(_0x24f2('0x5'));var db=require(_0x24f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x24f2('0x7'));var config=require('../../config/environment');var jayson=require(_0x24f2('0x8'));var client=jayson[_0x24f2('0x9')][_0x24f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32cbba,_0x11948f,_0x4ce78f){return new BPromise(function(_0x3cbedb,_0x359191){return client[_0x24f2('0xb')](_0x32cbba,_0x4ce78f)[_0x24f2('0xc')](function(_0x495456){logger[_0x24f2('0xd')](_0x24f2('0xe'),_0x11948f,_0x24f2('0xf'));logger['debug'](_0x24f2('0x10'),_0x11948f,'request\x20sent',JSON[_0x24f2('0x11')](_0x495456));if(_0x495456['error']){if(_0x495456[_0x24f2('0x12')][_0x24f2('0x13')]===0x1f4){logger[_0x24f2('0x12')](_0x24f2('0xe'),_0x11948f,_0x495456[_0x24f2('0x12')][_0x24f2('0x14')]);return _0x359191(_0x495456[_0x24f2('0x12')][_0x24f2('0x14')]);}logger[_0x24f2('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x11948f,_0x495456[_0x24f2('0x12')][_0x24f2('0x14')]);return _0x3cbedb(_0x495456[_0x24f2('0x12')][_0x24f2('0x14')]);}else{logger['info'](_0x24f2('0xe'),_0x11948f,_0x24f2('0xf'));_0x3cbedb(_0x495456[_0x24f2('0x15')][_0x24f2('0x14')]);}})['catch'](function(_0x8acbd4){logger[_0x24f2('0x12')](_0x24f2('0xe'),_0x11948f,_0x8acbd4);_0x359191(_0x8acbd4);});});}exports[_0x24f2('0x16')]=function(_0x12dde9){var _0x462b64=this;return new Promise(function(_0x3087bf,_0x35902a){return db[_0x24f2('0x17')][_0x24f2('0x18')](_0x12dde9[_0x24f2('0x19')],{'raw':_0x12dde9['options']?_0x12dde9[_0x24f2('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x24f2('0xc')](function(_0x46c4e3){logger[_0x24f2('0xd')](_0x24f2('0x16'),_0x12dde9);logger['debug']('CreateSmsQueueReport',_0x12dde9,JSON[_0x24f2('0x11')](_0x46c4e3));_0x3087bf(_0x46c4e3);})['catch'](function(_0x42e5a0){logger[_0x24f2('0x12')]('CreateSmsQueueReport',_0x42e5a0[_0x24f2('0x14')],_0x12dde9);_0x35902a(_0x462b64['error'](0x1f4,_0x42e5a0['message']));});});};exports['UpdateSmsQueueReport']=function(_0x5e3d2a){var _0x68c497=this;return new Promise(function(_0x2592c2,_0x5f24a0){return db[_0x24f2('0x17')][_0x24f2('0x1b')](_0x5e3d2a[_0x24f2('0x19')],{'raw':_0x5e3d2a['options']?_0x5e3d2a[_0x24f2('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3d2a[_0x24f2('0x1a')]?_0x5e3d2a[_0x24f2('0x1a')]['where']||null:null,'attributes':_0x5e3d2a[_0x24f2('0x1a')]?_0x5e3d2a['options'][_0x24f2('0x1c')]||null:null,'limit':_0x5e3d2a[_0x24f2('0x1a')]?_0x5e3d2a[_0x24f2('0x1a')][_0x24f2('0x1d')]||null:null})[_0x24f2('0xc')](function(_0x2a4175){logger[_0x24f2('0xd')](_0x24f2('0x1e'),_0x5e3d2a);logger[_0x24f2('0x1f')](_0x24f2('0x1e'),_0x5e3d2a,JSON['stringify'](_0x2a4175));_0x2592c2(_0x2a4175);})[_0x24f2('0x20')](function(_0x4ed972){logger['error'](_0x24f2('0x1e'),_0x4ed972[_0x24f2('0x14')],_0x5e3d2a);_0x5f24a0(_0x68c497[_0x24f2('0x12')](0x1f4,_0x4ed972['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index bc138dd..11e660a 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 _0xf987=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5b860b,_0x6be88){var _0x6ce22c=function(_0x4bdf70){while(--_0x4bdf70){_0x5b860b['push'](_0x5b860b['shift']());}};_0x6ce22c(++_0x6be88);}(_0xf987,0x18a));var _0x7f98=function(_0x3c3b2e,_0x1a864e){_0x3c3b2e=_0x3c3b2e-0x0;var _0x454a21=_0xf987[_0x3c3b2e];return _0x454a21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f98('0x0'));var timeout=require(_0x7f98('0x1'));var express=require('express');var router=express[_0x7f98('0x2')]();var fs_extra=require(_0x7f98('0x3'));var auth=require(_0x7f98('0x4'));var interaction=require(_0x7f98('0x5'));var config=require(_0x7f98('0x6'));var controller=require(_0x7f98('0x7'));router[_0x7f98('0x8')]('/',auth[_0x7f98('0x9')](),controller[_0x7f98('0xa')]);router[_0x7f98('0x8')](_0x7f98('0xb'),auth[_0x7f98('0x9')](),controller['describe']);router[_0x7f98('0x8')](_0x7f98('0xc'),auth[_0x7f98('0x9')](),controller[_0x7f98('0xd')]);router[_0x7f98('0xe')]('/',auth['isAuthenticated'](),controller[_0x7f98('0xf')]);router['put']('/:id',auth[_0x7f98('0x9')](),controller[_0x7f98('0x10')]);router[_0x7f98('0x11')](_0x7f98('0xc'),auth['isAuthenticated'](),controller[_0x7f98('0x12')]);module['exports']=router; \ No newline at end of file +var _0x02a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','post','put','update','destroy','exports','util','express','Router','fs-extra'];(function(_0x12aeb7,_0xd624eb){var _0x54e761=function(_0x412ea1){while(--_0x412ea1){_0x12aeb7['push'](_0x12aeb7['shift']());}};_0x54e761(++_0xd624eb);}(_0x02a7,0x7a));var _0x702a=function(_0x814142,_0x4ff597){_0x814142=_0x814142-0x0;var _0x274bb1=_0x02a7[_0x814142];return _0x274bb1;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var fs_extra=require(_0x702a('0x3'));var auth=require(_0x702a('0x4'));var interaction=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var controller=require(_0x702a('0x7'));router['get']('/',auth[_0x702a('0x8')](),controller['index']);router[_0x702a('0x9')](_0x702a('0xa'),auth[_0x702a('0x8')](),controller[_0x702a('0xb')]);router[_0x702a('0x9')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller['show']);router[_0x702a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x702a('0xe')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0xf')]);router['delete'](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0x10')]);module[_0x702a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5bbb9b0..407ac39 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(_0x178499,_0x4cf30e){var _0x33a278=function(_0x1ef7b5){while(--_0x1ef7b5){_0x178499['push'](_0x178499['shift']());}};_0x33a278(++_0x4cf30e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0xcb91[_0x466bc5];return _0x138952;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4eef4f,_0xb516a7){var _0x2feb83=function(_0x1eddf2){while(--_0x1eddf2){_0x4eef4f['push'](_0x4eef4f['shift']());}};_0x2feb83(++_0xb516a7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x908c3d,_0x1a4509){_0x908c3d=_0x908c3d-0x0;var _0x9b7445=_0xf4eb[_0x908c3d];return _0x9b7445;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d175c21..b15fd2d 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 _0x53ee=['sendStatus','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x20049d,_0x2b30e6){var _0xa3e9bf=function(_0x35ad86){while(--_0x35ad86){_0x20049d['push'](_0x20049d['shift']());}};_0xa3e9bf(++_0x2b30e6);}(_0x53ee,0x73));var _0xe53e=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x53ee[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0xe53e('0x0'));var rimraf=require(_0xe53e('0x1'));var zipdir=require(_0xe53e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe53e('0x3'));var moment=require(_0xe53e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe53e('0x5'));var util=require(_0xe53e('0x6'));var path=require('path');var sox=require(_0xe53e('0x7'));var csv=require('to-csv');var ejs=require(_0xe53e('0x8'));var fs=require('fs');var fs_extra=require(_0xe53e('0x9'));var _=require('lodash');var squel=require(_0xe53e('0xa'));var crypto=require(_0xe53e('0xb'));var jsforce=require(_0xe53e('0xc'));var deskjs=require(_0xe53e('0xd'));var toCsv=require(_0xe53e('0xe'));var querystring=require(_0xe53e('0xf'));var Papa=require(_0xe53e('0x10'));var Redis=require(_0xe53e('0x11'));var authService=require(_0xe53e('0x12'));var qs=require(_0xe53e('0x13'));var as=require(_0xe53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe53e('0x15'))(_0xe53e('0x16'));var utils=require(_0xe53e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe53e('0x18'))['db'];function respondWithStatusCode(_0x1e6e16,_0x267bf4){_0x267bf4=_0x267bf4||0xcc;return function(_0x4e4e1e){if(_0x4e4e1e){return _0x1e6e16['sendStatus'](_0x267bf4);}return _0x1e6e16[_0xe53e('0x19')](_0x267bf4)[_0xe53e('0x1a')]();};}function respondWithResult(_0x21d7c8,_0x50859d){_0x50859d=_0x50859d||0xc8;return function(_0x375317){if(_0x375317){return _0x21d7c8[_0xe53e('0x19')](_0x50859d)[_0xe53e('0x1b')](_0x375317);}};}function respondWithFilteredResult(_0x2940b6,_0x17c40d){return function(_0x4391d4){if(_0x4391d4){var _0x54e3c3=typeof _0x17c40d[_0xe53e('0x1c')]==='undefined'&&typeof _0x17c40d[_0xe53e('0x1d')]==='undefined';var _0x5eb54f=_0x4391d4['count'];var _0x4b600f=_0x54e3c3?0x0:_0x17c40d[_0xe53e('0x1c')];var _0x50b937=_0x54e3c3?_0x4391d4[_0xe53e('0x1e')]:_0x17c40d['offset']+_0x17c40d[_0xe53e('0x1d')];var _0x596163;if(_0x50b937>=_0x5eb54f){_0x50b937=_0x5eb54f;_0x596163=0xc8;}else{_0x596163=0xce;}_0x2940b6[_0xe53e('0x19')](_0x596163);return _0x2940b6[_0xe53e('0x1f')](_0xe53e('0x20'),_0x4b600f+'-'+_0x50b937+'/'+_0x5eb54f)[_0xe53e('0x1b')](_0x4391d4);}return null;};}function patchUpdates(_0x156b97){return function(_0x4e8604){try{jsonpatch[_0xe53e('0x21')](_0x4e8604,_0x156b97,!![]);}catch(_0x396967){return BPromise['reject'](_0x396967);}return _0x4e8604[_0xe53e('0x22')]();};}function saveUpdates(_0x5b5337,_0x1b1de0){return function(_0x4d3811){if(_0x4d3811){return _0x4d3811[_0xe53e('0x23')](_0x5b5337)[_0xe53e('0x24')](function(_0x4d68a2){return _0x4d68a2;});}return null;};}function removeEntity(_0x43d467,_0x5d8634){return function(_0x2e6981){if(_0x2e6981){return _0x2e6981['destroy']()['then'](function(){_0x43d467[_0xe53e('0x19')](0xcc)[_0xe53e('0x1a')]();});}};}function handleEntityNotFound(_0x558104,_0x2ef856){return function(_0xebe081){if(!_0xebe081){_0x558104[_0xe53e('0x25')](0x194);}return _0xebe081;};}function handleError(_0x2ce2ea,_0x1f0822){_0x1f0822=_0x1f0822||0x1f4;return function(_0x4eb87b){logger['error'](_0x4eb87b[_0xe53e('0x26')]);if(_0x4eb87b['name']){delete _0x4eb87b[_0xe53e('0x27')];}_0x2ce2ea[_0xe53e('0x19')](_0x1f0822)[_0xe53e('0x28')](_0x4eb87b);};}exports[_0xe53e('0x29')]=function(_0x17e445,_0x515e34){var _0x1517d3={},_0x380b03={},_0x24a83d={'count':0x0,'rows':[]};var _0x43e499=_[_0xe53e('0x2a')](db[_0xe53e('0x2b')][_0xe53e('0x2c')],function(_0x35bc29){return{'name':_0x35bc29[_0xe53e('0x2d')],'type':_0x35bc29[_0xe53e('0x2e')][_0xe53e('0x2f')]};});_0x380b03['model']=_[_0xe53e('0x2a')](_0x43e499,_0xe53e('0x27'));_0x380b03[_0xe53e('0x30')]=_[_0xe53e('0x31')](_0x17e445[_0xe53e('0x30')]);_0x380b03['filters']=_[_0xe53e('0x32')](_0x380b03[_0xe53e('0x33')],_0x380b03[_0xe53e('0x30')]);_0x1517d3[_0xe53e('0x34')]=_[_0xe53e('0x32')](_0x380b03[_0xe53e('0x33')],qs[_0xe53e('0x35')](_0x17e445['query'][_0xe53e('0x35')]));_0x1517d3[_0xe53e('0x34')]=_0x1517d3[_0xe53e('0x34')][_0xe53e('0x36')]?_0x1517d3[_0xe53e('0x34')]:_0x380b03[_0xe53e('0x33')];if(!_0x17e445[_0xe53e('0x30')]['hasOwnProperty'](_0xe53e('0x37'))){_0x1517d3[_0xe53e('0x1d')]=qs[_0xe53e('0x1d')](_0x17e445['query'][_0xe53e('0x1d')]);_0x1517d3['offset']=qs[_0xe53e('0x1c')](_0x17e445[_0xe53e('0x30')][_0xe53e('0x1c')]);}_0x1517d3[_0xe53e('0x38')]=qs[_0xe53e('0x39')](_0x17e445['query'][_0xe53e('0x39')]);_0x1517d3[_0xe53e('0x3a')]=qs[_0xe53e('0x3b')](_[_0xe53e('0x3c')](_0x17e445['query'],_0x380b03[_0xe53e('0x3b')]),_0x43e499);if(_0x17e445[_0xe53e('0x30')]['filter']){_0x1517d3[_0xe53e('0x3a')]=_[_0xe53e('0x3d')](_0x1517d3[_0xe53e('0x3a')],{'$or':_[_0xe53e('0x2a')](_0x43e499,function(_0x3b4ba0){if(_0x3b4ba0[_0xe53e('0x2e')]!==_0xe53e('0x3e')){var _0x44d444={};_0x44d444[_0x3b4ba0[_0xe53e('0x27')]]={'$like':'%'+_0x17e445[_0xe53e('0x30')][_0xe53e('0x3f')]+'%'};return _0x44d444;}})});}_0x1517d3=_[_0xe53e('0x3d')]({},_0x1517d3,_0x17e445['options']);var _0x4eb10f={'where':_0x1517d3['where']};return db['SmsTransferReport']['count'](_0x4eb10f)[_0xe53e('0x24')](function(_0x20be58){_0x24a83d['count']=_0x20be58;if(_0x17e445[_0xe53e('0x30')][_0xe53e('0x40')]){_0x1517d3[_0xe53e('0x41')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xe53e('0x42')](_0x1517d3);})[_0xe53e('0x24')](function(_0x2783b4){_0x24a83d[_0xe53e('0x43')]=_0x2783b4;return _0x24a83d;})[_0xe53e('0x24')](respondWithFilteredResult(_0x515e34,_0x1517d3))[_0xe53e('0x44')](handleError(_0x515e34,null));};exports['show']=function(_0xa0c54e,_0x579dd9){var _0x1bf6d6={'raw':!![],'where':{'id':_0xa0c54e[_0xe53e('0x45')]['id']}},_0x334a98={};_0x334a98[_0xe53e('0x33')]=_[_0xe53e('0x31')](db[_0xe53e('0x2b')][_0xe53e('0x2c')]);_0x334a98[_0xe53e('0x30')]=_['keys'](_0xa0c54e[_0xe53e('0x30')]);_0x334a98[_0xe53e('0x3b')]=_[_0xe53e('0x32')](_0x334a98[_0xe53e('0x33')],_0x334a98[_0xe53e('0x30')]);_0x1bf6d6[_0xe53e('0x34')]=_[_0xe53e('0x32')](_0x334a98['model'],qs['fields'](_0xa0c54e[_0xe53e('0x30')][_0xe53e('0x35')]));_0x1bf6d6[_0xe53e('0x34')]=_0x1bf6d6[_0xe53e('0x34')][_0xe53e('0x36')]?_0x1bf6d6[_0xe53e('0x34')]:_0x334a98[_0xe53e('0x33')];if(_0xa0c54e['query']['includeAll']){_0x1bf6d6[_0xe53e('0x41')]=[{'all':!![]}];}_0x1bf6d6=_[_0xe53e('0x3d')]({},_0x1bf6d6,_0xa0c54e[_0xe53e('0x46')]);return db[_0xe53e('0x2b')][_0xe53e('0x47')](_0x1bf6d6)[_0xe53e('0x24')](handleEntityNotFound(_0x579dd9,null))[_0xe53e('0x24')](respondWithResult(_0x579dd9,null))['catch'](handleError(_0x579dd9,null));};exports[_0xe53e('0x48')]=function(_0x4fa639,_0x4e4e9d){return db[_0xe53e('0x2b')][_0xe53e('0x48')](_0x4fa639[_0xe53e('0x49')],{})[_0xe53e('0x24')](respondWithResult(_0x4e4e9d,0xc9))[_0xe53e('0x44')](handleError(_0x4e4e9d,null));};exports[_0xe53e('0x23')]=function(_0x11126f,_0x34e04e){if(_0x11126f[_0xe53e('0x49')]['id']){delete _0x11126f[_0xe53e('0x49')]['id'];}return db[_0xe53e('0x2b')][_0xe53e('0x47')]({'where':{'id':_0x11126f['params']['id']}})[_0xe53e('0x24')](handleEntityNotFound(_0x34e04e,null))[_0xe53e('0x24')](saveUpdates(_0x11126f['body'],null))[_0xe53e('0x24')](respondWithResult(_0x34e04e,null))[_0xe53e('0x44')](handleError(_0x34e04e,null));};exports[_0xe53e('0x4a')]=function(_0x2ba8ad,_0x1ca960){return db[_0xe53e('0x2b')]['find']({'where':{'id':_0x2ba8ad[_0xe53e('0x45')]['id']}})[_0xe53e('0x24')](handleEntityNotFound(_0x1ca960,null))[_0xe53e('0x24')](removeEntity(_0x1ca960,null))[_0xe53e('0x44')](handleError(_0x1ca960,null));};exports[_0xe53e('0x4b')]=function(_0x3ac2c3,_0x5dfc8d){return db[_0xe53e('0x2b')][_0xe53e('0x4b')]()['then'](respondWithResult(_0x5dfc8d,null))[_0xe53e('0x44')](handleError(_0x5dfc8d,null));}; \ No newline at end of file +var _0x33c8=['../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','options','SmsTransferReport','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x33c8,0x1be));var _0x833c=function(_0x4da18b,_0x3a46f6){_0x4da18b=_0x4da18b-0x0;var _0x749fcf=_0x33c8[_0x4da18b];return _0x749fcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x833c('0x0'));var zipdir=require(_0x833c('0x1'));var jsonpatch=require(_0x833c('0x2'));var rp=require(_0x833c('0x3'));var moment=require(_0x833c('0x4'));var BPromise=require(_0x833c('0x5'));var Mustache=require('mustache');var util=require(_0x833c('0x6'));var path=require(_0x833c('0x7'));var sox=require('sox');var csv=require(_0x833c('0x8'));var ejs=require(_0x833c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x833c('0xa'));var squel=require(_0x833c('0xb'));var crypto=require(_0x833c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x833c('0xd'));var toCsv=require(_0x833c('0x8'));var querystring=require(_0x833c('0xe'));var Papa=require(_0x833c('0xf'));var Redis=require('ioredis');var authService=require(_0x833c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x833c('0x11'));var logger=require('../../config/logger')(_0x833c('0x12'));var utils=require(_0x833c('0x13'));var config=require(_0x833c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f77a6,_0x5c7c84){_0x5c7c84=_0x5c7c84||0xcc;return function(_0x1fa667){if(_0x1fa667){return _0x1f77a6[_0x833c('0x15')](_0x5c7c84);}return _0x1f77a6[_0x833c('0x16')](_0x5c7c84)[_0x833c('0x17')]();};}function respondWithResult(_0x4c1363,_0x380d8c){_0x380d8c=_0x380d8c||0xc8;return function(_0x2f1eee){if(_0x2f1eee){return _0x4c1363['status'](_0x380d8c)[_0x833c('0x18')](_0x2f1eee);}};}function respondWithFilteredResult(_0x14784f,_0x4246b6){return function(_0x13a3ce){if(_0x13a3ce){var _0x3af5e4=typeof _0x4246b6[_0x833c('0x19')]===_0x833c('0x1a')&&typeof _0x4246b6[_0x833c('0x1b')]==='undefined';var _0x40699d=_0x13a3ce[_0x833c('0x1c')];var _0x593ed5=_0x3af5e4?0x0:_0x4246b6['offset'];var _0xa7aece=_0x3af5e4?_0x13a3ce[_0x833c('0x1c')]:_0x4246b6[_0x833c('0x19')]+_0x4246b6[_0x833c('0x1b')];var _0x47a263;if(_0xa7aece>=_0x40699d){_0xa7aece=_0x40699d;_0x47a263=0xc8;}else{_0x47a263=0xce;}_0x14784f[_0x833c('0x16')](_0x47a263);return _0x14784f[_0x833c('0x1d')]('Content-Range',_0x593ed5+'-'+_0xa7aece+'/'+_0x40699d)[_0x833c('0x18')](_0x13a3ce);}return null;};}function patchUpdates(_0x216e18){return function(_0x3e33c9){try{jsonpatch[_0x833c('0x1e')](_0x3e33c9,_0x216e18,!![]);}catch(_0x60a4ab){return BPromise['reject'](_0x60a4ab);}return _0x3e33c9['save']();};}function saveUpdates(_0x265acd,_0x50bdd6){return function(_0x52652a){if(_0x52652a){return _0x52652a[_0x833c('0x1f')](_0x265acd)[_0x833c('0x20')](function(_0x4cb422){return _0x4cb422;});}return null;};}function removeEntity(_0x3b0a98,_0x2c7296){return function(_0x1844e0){if(_0x1844e0){return _0x1844e0[_0x833c('0x21')]()['then'](function(){_0x3b0a98[_0x833c('0x16')](0xcc)[_0x833c('0x17')]();});}};}function handleEntityNotFound(_0x266e81,_0x543036){return function(_0x10c948){if(!_0x10c948){_0x266e81[_0x833c('0x15')](0x194);}return _0x10c948;};}function handleError(_0x1f106,_0x384133){_0x384133=_0x384133||0x1f4;return function(_0x371c0d){logger[_0x833c('0x22')](_0x371c0d['stack']);if(_0x371c0d[_0x833c('0x23')]){delete _0x371c0d['name'];}_0x1f106['status'](_0x384133)[_0x833c('0x24')](_0x371c0d);};}exports[_0x833c('0x25')]=function(_0x51e4ec,_0x5b740f){var _0x3d95a9={},_0x3ecaa3={},_0x392931={'count':0x0,'rows':[]};var _0x1f4b09=_[_0x833c('0x26')](db['SmsTransferReport']['rawAttributes'],function(_0x116ef2){return{'name':_0x116ef2['fieldName'],'type':_0x116ef2[_0x833c('0x27')][_0x833c('0x28')]};});_0x3ecaa3[_0x833c('0x29')]=_[_0x833c('0x26')](_0x1f4b09,_0x833c('0x23'));_0x3ecaa3[_0x833c('0x2a')]=_['keys'](_0x51e4ec['query']);_0x3ecaa3[_0x833c('0x2b')]=_[_0x833c('0x2c')](_0x3ecaa3[_0x833c('0x29')],_0x3ecaa3[_0x833c('0x2a')]);_0x3d95a9[_0x833c('0x2d')]=_['intersection'](_0x3ecaa3[_0x833c('0x29')],qs[_0x833c('0x2e')](_0x51e4ec[_0x833c('0x2a')][_0x833c('0x2e')]));_0x3d95a9[_0x833c('0x2d')]=_0x3d95a9[_0x833c('0x2d')]['length']?_0x3d95a9[_0x833c('0x2d')]:_0x3ecaa3[_0x833c('0x29')];if(!_0x51e4ec[_0x833c('0x2a')][_0x833c('0x2f')](_0x833c('0x30'))){_0x3d95a9[_0x833c('0x1b')]=qs[_0x833c('0x1b')](_0x51e4ec[_0x833c('0x2a')]['limit']);_0x3d95a9[_0x833c('0x19')]=qs[_0x833c('0x19')](_0x51e4ec[_0x833c('0x2a')][_0x833c('0x19')]);}_0x3d95a9['order']=qs['sort'](_0x51e4ec[_0x833c('0x2a')][_0x833c('0x31')]);_0x3d95a9['where']=qs[_0x833c('0x2b')](_['pick'](_0x51e4ec[_0x833c('0x2a')],_0x3ecaa3['filters']),_0x1f4b09);if(_0x51e4ec[_0x833c('0x2a')][_0x833c('0x32')]){_0x3d95a9[_0x833c('0x33')]=_[_0x833c('0x34')](_0x3d95a9[_0x833c('0x33')],{'$or':_[_0x833c('0x26')](_0x1f4b09,function(_0x1f04f5){if(_0x1f04f5[_0x833c('0x27')]!=='VIRTUAL'){var _0x46ff1d={};_0x46ff1d[_0x1f04f5[_0x833c('0x23')]]={'$like':'%'+_0x51e4ec[_0x833c('0x2a')]['filter']+'%'};return _0x46ff1d;}})});}_0x3d95a9=_[_0x833c('0x34')]({},_0x3d95a9,_0x51e4ec[_0x833c('0x35')]);var _0x86dab1={'where':_0x3d95a9[_0x833c('0x33')]};return db[_0x833c('0x36')]['count'](_0x86dab1)['then'](function(_0x1b8668){_0x392931[_0x833c('0x1c')]=_0x1b8668;if(_0x51e4ec[_0x833c('0x2a')][_0x833c('0x37')]){_0x3d95a9[_0x833c('0x38')]=[{'all':!![]}];}return db[_0x833c('0x36')][_0x833c('0x39')](_0x3d95a9);})[_0x833c('0x20')](function(_0x1e3c05){_0x392931[_0x833c('0x3a')]=_0x1e3c05;return _0x392931;})[_0x833c('0x20')](respondWithFilteredResult(_0x5b740f,_0x3d95a9))['catch'](handleError(_0x5b740f,null));};exports['show']=function(_0x136fb9,_0x2f30af){var _0x425444={'raw':!![],'where':{'id':_0x136fb9[_0x833c('0x3b')]['id']}},_0x4db310={};_0x4db310[_0x833c('0x29')]=_['keys'](db[_0x833c('0x36')]['rawAttributes']);_0x4db310[_0x833c('0x2a')]=_[_0x833c('0x3c')](_0x136fb9[_0x833c('0x2a')]);_0x4db310[_0x833c('0x2b')]=_[_0x833c('0x2c')](_0x4db310[_0x833c('0x29')],_0x4db310[_0x833c('0x2a')]);_0x425444[_0x833c('0x2d')]=_[_0x833c('0x2c')](_0x4db310[_0x833c('0x29')],qs[_0x833c('0x2e')](_0x136fb9[_0x833c('0x2a')][_0x833c('0x2e')]));_0x425444[_0x833c('0x2d')]=_0x425444[_0x833c('0x2d')]['length']?_0x425444[_0x833c('0x2d')]:_0x4db310['model'];if(_0x136fb9[_0x833c('0x2a')][_0x833c('0x37')]){_0x425444['include']=[{'all':!![]}];}_0x425444=_[_0x833c('0x34')]({},_0x425444,_0x136fb9[_0x833c('0x35')]);return db['SmsTransferReport'][_0x833c('0x3d')](_0x425444)['then'](handleEntityNotFound(_0x2f30af,null))[_0x833c('0x20')](respondWithResult(_0x2f30af,null))[_0x833c('0x3e')](handleError(_0x2f30af,null));};exports[_0x833c('0x3f')]=function(_0x4dc63f,_0x41f335){return db[_0x833c('0x36')]['create'](_0x4dc63f['body'],{})['then'](respondWithResult(_0x41f335,0xc9))[_0x833c('0x3e')](handleError(_0x41f335,null));};exports['update']=function(_0x443e60,_0x1db07b){if(_0x443e60[_0x833c('0x40')]['id']){delete _0x443e60[_0x833c('0x40')]['id'];}return db[_0x833c('0x36')]['find']({'where':{'id':_0x443e60[_0x833c('0x3b')]['id']}})[_0x833c('0x20')](handleEntityNotFound(_0x1db07b,null))[_0x833c('0x20')](saveUpdates(_0x443e60[_0x833c('0x40')],null))[_0x833c('0x20')](respondWithResult(_0x1db07b,null))[_0x833c('0x3e')](handleError(_0x1db07b,null));};exports[_0x833c('0x21')]=function(_0x25ff36,_0x82afd2){return db['SmsTransferReport'][_0x833c('0x3d')]({'where':{'id':_0x25ff36['params']['id']}})['then'](handleEntityNotFound(_0x82afd2,null))[_0x833c('0x20')](removeEntity(_0x82afd2,null))[_0x833c('0x3e')](handleError(_0x82afd2,null));};exports[_0x833c('0x41')]=function(_0x5a1dc2,_0x495241){return db[_0x833c('0x36')][_0x833c('0x41')]()[_0x833c('0x20')](respondWithResult(_0x495241,null))[_0x833c('0x3e')](handleError(_0x495241,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e27daf7..0d0b980 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 _0xca9a=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xca9a,0x181));var _0xaca9=function(_0x4ce054,_0x452660){_0x4ce054=_0x4ce054-0x0;var _0x16bde7=_0xca9a[_0x4ce054];return _0x16bde7;};'use strict';var _=require(_0xaca9('0x0'));var util=require(_0xaca9('0x1'));var logger=require(_0xaca9('0x2'))('api');var moment=require(_0xaca9('0x3'));var BPromise=require(_0xaca9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaca9('0x5'));var rimraf=require(_0xaca9('0x6'));var config=require(_0xaca9('0x7'));var attributes=require(_0xaca9('0x8'));module[_0xaca9('0x9')]=function(_0x23bbbe,_0x372aeb){return _0x23bbbe[_0xaca9('0xa')](_0xaca9('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xaca9('0xc'),'fields':[_0xaca9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49c2=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','report_sms_transfer','uniqueid'];(function(_0x4b7886,_0x304059){var _0x1332fd=function(_0x2867bd){while(--_0x2867bd){_0x4b7886['push'](_0x4b7886['shift']());}};_0x1332fd(++_0x304059);}(_0x49c2,0x176));var _0x249c=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x49c2[_0x5f42f1];return _0x5534ee;};'use strict';var _=require(_0x249c('0x0'));var util=require(_0x249c('0x1'));var logger=require(_0x249c('0x2'))(_0x249c('0x3'));var moment=require('moment');var BPromise=require(_0x249c('0x4'));var rp=require(_0x249c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x249c('0x6'));var config=require(_0x249c('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x249c('0x8')]=function(_0x4c0c15,_0x5c5f30){return _0x4c0c15['define']('SmsTransferReport',attributes,{'tableName':_0x249c('0x9'),'paranoid':![],'indexes':[{'name':_0x249c('0xa'),'fields':[_0x249c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d938723..8379591 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 _0x5af0=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','debug'];(function(_0x542c84,_0x47c8c7){var _0x5e8c15=function(_0x58349c){while(--_0x58349c){_0x542c84['push'](_0x542c84['shift']());}};_0x5e8c15(++_0x47c8c7);}(_0x5af0,0x1eb));var _0x05af=function(_0x4d6ffa,_0xd3146c){_0x4d6ffa=_0x4d6ffa-0x0;var _0x214d37=_0x5af0[_0x4d6ffa];return _0x214d37;};'use strict';var _=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var moment=require(_0x05af('0x2'));var BPromise=require(_0x05af('0x3'));var rs=require(_0x05af('0x4'));var fs=require('fs');var Redis=require(_0x05af('0x5'));var db=require(_0x05af('0x6'))['db'];var utils=require(_0x05af('0x7'));var logger=require('../../config/logger')(_0x05af('0x8'));var config=require('../../config/environment');var jayson=require(_0x05af('0x9'));var client=jayson[_0x05af('0xa')][_0x05af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a963b,_0xfbaa9a,_0x4e120b){return new BPromise(function(_0x1cbd46,_0x27a9dc){return client[_0x05af('0xc')](_0x4a963b,_0x4e120b)['then'](function(_0x5e5e02){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xfbaa9a,_0x05af('0xd'));logger[_0x05af('0xe')](_0x05af('0xf'),_0xfbaa9a,'request\x20sent',JSON[_0x05af('0x10')](_0x5e5e02));if(_0x5e5e02['error']){if(_0x5e5e02['error'][_0x05af('0x11')]===0x1f4){logger[_0x05af('0x12')](_0x05af('0x13'),_0xfbaa9a,_0x5e5e02[_0x05af('0x12')][_0x05af('0x14')]);return _0x27a9dc(_0x5e5e02[_0x05af('0x12')][_0x05af('0x14')]);}logger[_0x05af('0x12')](_0x05af('0x13'),_0xfbaa9a,_0x5e5e02[_0x05af('0x12')][_0x05af('0x14')]);return _0x1cbd46(_0x5e5e02[_0x05af('0x12')][_0x05af('0x14')]);}else{logger[_0x05af('0x15')](_0x05af('0x13'),_0xfbaa9a,_0x05af('0xd'));_0x1cbd46(_0x5e5e02[_0x05af('0x16')]['message']);}})['catch'](function(_0x1fc2d3){logger[_0x05af('0x12')](_0x05af('0x13'),_0xfbaa9a,_0x1fc2d3);_0x27a9dc(_0x1fc2d3);});});} \ No newline at end of file +var _0x3eea=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x3cbd1a,_0x5143a0){var _0x370fd1=function(_0x285950){while(--_0x285950){_0x3cbd1a['push'](_0x3cbd1a['shift']());}};_0x370fd1(++_0x5143a0);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1e25e1,_0x7bc914){_0x1e25e1=_0x1e25e1-0x0;var _0x496d82=_0x3eea[_0x1e25e1];return _0x496d82;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))(_0xa3ee('0x8'));var config=require(_0xa3ee('0x9'));var jayson=require(_0xa3ee('0xa'));var client=jayson[_0xa3ee('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538bf9,_0x4183ee,_0x4e4588){return new BPromise(function(_0x37a3f0,_0x56f37b){return client[_0xa3ee('0xc')](_0x538bf9,_0x4e4588)['then'](function(_0xb1b96d){logger['info'](_0xa3ee('0xd'),_0x4183ee,_0xa3ee('0xe'));logger[_0xa3ee('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x4183ee,_0xa3ee('0xe'),JSON[_0xa3ee('0x10')](_0xb1b96d));if(_0xb1b96d['error']){if(_0xb1b96d['error'][_0xa3ee('0x11')]===0x1f4){logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')]['message']);return _0x56f37b(_0xb1b96d[_0xa3ee('0x12')]['message']);}logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')][_0xa3ee('0x13')]);return _0x37a3f0(_0xb1b96d['error'][_0xa3ee('0x13')]);}else{logger[_0xa3ee('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4183ee,'request\x20sent');_0x37a3f0(_0xb1b96d['result'][_0xa3ee('0x13')]);}})[_0xa3ee('0x15')](function(_0x354dd5){logger[_0xa3ee('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x4183ee,_0x354dd5);_0x56f37b(_0x354dd5);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 99038a1..0e0ead7 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 _0x7ea2=['format','basename','now','extname','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace'];(function(_0x212627,_0x12d6ee){var _0x4af35b=function(_0x576504){while(--_0x576504){_0x212627['push'](_0x212627['shift']());}};_0x4af35b(++_0x12d6ee);}(_0x7ea2,0x11c));var _0x27ea=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0x7ea2[_0x5bd1a9];return _0x2ba345;};'use strict';var multer=require(_0x27ea('0x0'));var util=require(_0x27ea('0x1'));var path=require(_0x27ea('0x2'));var timeout=require(_0x27ea('0x3'));var express=require(_0x27ea('0x4'));var router=express[_0x27ea('0x5')]();var fs_extra=require(_0x27ea('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x27ea('0x7'));var config=require(_0x27ea('0x8'));var controller=require(_0x27ea('0x9'));router[_0x27ea('0xa')]('/',auth['isAuthenticated'](),controller[_0x27ea('0xb')]);router[_0x27ea('0xa')](_0x27ea('0xc'),auth[_0x27ea('0xd')](),controller[_0x27ea('0xe')]);router[_0x27ea('0xa')](_0x27ea('0xf'),auth[_0x27ea('0xd')](),controller[_0x27ea('0x10')]);var upload=multer({'storage':multer[_0x27ea('0x11')]({'destination':function(_0x31ae3c,_0x2f6075,_0x3c9c14){_0x3c9c14(null,path['join'](config[_0x27ea('0x12')],_0x27ea('0x13')));},'filename':function(_0x30af80,_0xc0398d,_0x1c8485){_0xc0398d['originalname']=_0xc0398d[_0x27ea('0x14')][_0x27ea('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c8485(null,util[_0x27ea('0x16')]('%s-%s%s',path[_0x27ea('0x17')](_0xc0398d['originalname'],path['extname'](_0xc0398d[_0x27ea('0x14')])),Date[_0x27ea('0x18')](),path[_0x27ea('0x19')](_0xc0398d[_0x27ea('0x14')])));}})});router[_0x27ea('0x1a')]('/',upload[_0x27ea('0x1b')](_0x27ea('0x1c')),controller[_0x27ea('0x1d')]);router[_0x27ea('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x27ea('0x1f')]);router[_0x27ea('0x20')](_0x27ea('0xc'),auth['isAuthenticated'](),controller[_0x27ea('0x20')]);module[_0x27ea('0x21')]=router; \ No newline at end of file +var _0xaea8=['../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4996b8,_0x3a099b){var _0x12162d=function(_0x32467e){while(--_0x32467e){_0x4996b8['push'](_0x4996b8['shift']());}};_0x12162d(++_0x3a099b);}(_0xaea8,0x1ea));var _0x8aea=function(_0x4b8c6b,_0x887ecc){_0x4b8c6b=_0x4b8c6b-0x0;var _0x247bfb=_0xaea8[_0x4b8c6b];return _0x247bfb;};'use strict';var multer=require(_0x8aea('0x0'));var util=require('util');var path=require(_0x8aea('0x1'));var timeout=require(_0x8aea('0x2'));var express=require('express');var router=express[_0x8aea('0x3')]();var fs_extra=require(_0x8aea('0x4'));var auth=require(_0x8aea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8aea('0x6'));var controller=require(_0x8aea('0x7'));router[_0x8aea('0x8')]('/',auth[_0x8aea('0x9')](),controller['index']);router[_0x8aea('0x8')](_0x8aea('0xa'),auth[_0x8aea('0x9')](),controller[_0x8aea('0xb')]);router['get'](_0x8aea('0xc'),auth['isAuthenticated'](),controller[_0x8aea('0xd')]);var upload=multer({'storage':multer[_0x8aea('0xe')]({'destination':function(_0x10e0ce,_0x4a061f,_0x2a09b8){_0x2a09b8(null,path[_0x8aea('0xf')](config[_0x8aea('0x10')],_0x8aea('0x11')));},'filename':function(_0x528f34,_0x5bfb8d,_0x3a5338){_0x5bfb8d[_0x8aea('0x12')]=_0x5bfb8d[_0x8aea('0x12')][_0x8aea('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a5338(null,util[_0x8aea('0x14')](_0x8aea('0x15'),path[_0x8aea('0x16')](_0x5bfb8d['originalname'],path[_0x8aea('0x17')](_0x5bfb8d['originalname'])),Date['now'](),path[_0x8aea('0x17')](_0x5bfb8d[_0x8aea('0x12')])));}})});router[_0x8aea('0x18')]('/',upload[_0x8aea('0x19')]('file'),controller[_0x8aea('0x1a')]);router[_0x8aea('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x8aea('0x1c')]);router[_0x8aea('0x1d')](_0x8aea('0xa'),auth[_0x8aea('0x9')](),controller[_0x8aea('0x1d')]);module[_0x8aea('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1c9c7b8..6229a92 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 _0x8e35=['sequelize','name','STRING','BIGINT','INTEGER','FLOAT'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8e35,0xa2));var _0x58e3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8e35[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x58e3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x58e3('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x58e3('0x2')]},'display_name':{'type':Sequelize[_0x58e3('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x58e3('0x2')]},'original_format':{'type':Sequelize[_0x58e3('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x58e3('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x58e3('0x3')]},'original_sampleRate':{'type':Sequelize[_0x58e3('0x4')]},'converted_format':{'type':Sequelize[_0x58e3('0x2')]},'converted_duration':{'type':Sequelize[_0x58e3('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x58e3('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x58e3('0x4')]}}; \ No newline at end of file +var _0xf03c=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x42b47f,_0x438d12){var _0x35b220=function(_0x1fae8a){while(--_0x1fae8a){_0x42b47f['push'](_0x42b47f['shift']());}};_0x35b220(++_0x438d12);}(_0xf03c,0x1eb));var _0xcf03=function(_0x4375ea,_0xf214ad){_0x4375ea=_0x4375ea-0x0;var _0x15dcda=_0xf03c[_0x4375ea];return _0x15dcda;};'use strict';var Sequelize=require(_0xcf03('0x0'));module[_0xcf03('0x1')]={'name':{'type':Sequelize[_0xcf03('0x2')],'unique':_0xcf03('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcf03('0x2')]},'display_name':{'type':Sequelize[_0xcf03('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xcf03('0x2')]},'original_format':{'type':Sequelize[_0xcf03('0x2')]},'original_duration':{'type':Sequelize[_0xcf03('0x4')]},'original_sampleCount':{'type':Sequelize[_0xcf03('0x5')]},'original_channelCount':{'type':Sequelize[_0xcf03('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xcf03('0x6')]},'converted_format':{'type':Sequelize[_0xcf03('0x2')]},'converted_duration':{'type':Sequelize[_0xcf03('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xcf03('0x5')]},'converted_channelCount':{'type':Sequelize[_0xcf03('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xcf03('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 3e03dfc..f058480 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 _0x807f=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','params','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','originalname','filename','extname','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','start','find','description','delete','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','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','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Sounds','error','name','send','index','map','Sound','rawAttributes','type','key','query','keys','filters','model','attributes'];(function(_0x5e4c44,_0x49b6fa){var _0x4482ea=function(_0x2f866f){while(--_0x2f866f){_0x5e4c44['push'](_0x5e4c44['shift']());}};_0x4482ea(++_0x49b6fa);}(_0x807f,0x1ad));var _0xf807=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x807f[_0x59befa];return _0x1dd63d;};'use strict';var emlformat=require(_0xf807('0x0'));var rimraf=require(_0xf807('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf807('0x2'));var rp=require(_0xf807('0x3'));var moment=require(_0xf807('0x4'));var BPromise=require(_0xf807('0x5'));var Mustache=require('mustache');var util=require(_0xf807('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf807('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf807('0x8'));var jsforce=require(_0xf807('0x9'));var deskjs=require(_0xf807('0xa'));var toCsv=require(_0xf807('0xb'));var querystring=require(_0xf807('0xc'));var Papa=require(_0xf807('0xd'));var Redis=require(_0xf807('0xe'));var authService=require(_0xf807('0xf'));var qs=require(_0xf807('0x10'));var as=require(_0xf807('0x11'));var hardwareService=require(_0xf807('0x12'));var logger=require(_0xf807('0x13'))(_0xf807('0x14'));var utils=require('../../config/utils');var config=require(_0xf807('0x15'));var licenseUtil=require(_0xf807('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14751f,_0x170eaf){_0x170eaf=_0x170eaf||0xcc;return function(_0x83a546){if(_0x83a546){return _0x14751f[_0xf807('0x17')](_0x170eaf);}return _0x14751f[_0xf807('0x18')](_0x170eaf)[_0xf807('0x19')]();};}function respondWithResult(_0x202b1f,_0x450a79){_0x450a79=_0x450a79||0xc8;return function(_0x2dacfd){if(_0x2dacfd){return _0x202b1f[_0xf807('0x18')](_0x450a79)['json'](_0x2dacfd);}};}function respondWithFilteredResult(_0x4d49cf,_0x11c900){return function(_0x2746b0){if(_0x2746b0){var _0x124957=typeof _0x11c900[_0xf807('0x1a')]===_0xf807('0x1b')&&typeof _0x11c900['limit']===_0xf807('0x1b');var _0x4d6729=_0x2746b0[_0xf807('0x1c')];var _0x20ee13=_0x124957?0x0:_0x11c900[_0xf807('0x1a')];var _0x228a18=_0x124957?_0x2746b0[_0xf807('0x1c')]:_0x11c900[_0xf807('0x1a')]+_0x11c900[_0xf807('0x1d')];var _0x9db93d;if(_0x228a18>=_0x4d6729){_0x228a18=_0x4d6729;_0x9db93d=0xc8;}else{_0x9db93d=0xce;}_0x4d49cf[_0xf807('0x18')](_0x9db93d);return _0x4d49cf[_0xf807('0x1e')](_0xf807('0x1f'),_0x20ee13+'-'+_0x228a18+'/'+_0x4d6729)[_0xf807('0x20')](_0x2746b0);}return null;};}function patchUpdates(_0x564a82){return function(_0x5e0c01){try{jsonpatch[_0xf807('0x21')](_0x5e0c01,_0x564a82,!![]);}catch(_0x3c5185){return BPromise[_0xf807('0x22')](_0x3c5185);}return _0x5e0c01[_0xf807('0x23')]();};}function saveUpdates(_0x1b9611,_0x4f99a8){return function(_0x29c565){if(_0x29c565){return _0x29c565[_0xf807('0x24')](_0x1b9611)[_0xf807('0x25')](function(_0xfee807){return _0xfee807;});}return null;};}function removeEntity(_0x593912,_0x158200){return function(_0x51f865){if(_0x51f865){return _0x51f865[_0xf807('0x26')]()[_0xf807('0x25')](function(){var _0x1bf5f6=_0x51f865[_0xf807('0x27')]({'plain':!![]});var _0x4e7e59=_0xf807('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e7e59,'resourceId':_0x1bf5f6['id']}})[_0xf807('0x25')](function(){return _0x51f865;});})[_0xf807('0x25')](function(){_0x593912[_0xf807('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26da23,_0x1ee6b0){return function(_0x1b5f8f){if(!_0x1b5f8f){_0x26da23[_0xf807('0x17')](0x194);}return _0x1b5f8f;};}function handleError(_0x811395,_0x3cce86){_0x3cce86=_0x3cce86||0x1f4;return function(_0x35e882){logger[_0xf807('0x29')](_0x35e882['stack']);if(_0x35e882[_0xf807('0x2a')]){delete _0x35e882[_0xf807('0x2a')];}_0x811395[_0xf807('0x18')](_0x3cce86)[_0xf807('0x2b')](_0x35e882);};}exports[_0xf807('0x2c')]=function(_0x37ab8f,_0x539376){var _0x2afaf1={},_0x5b304b={},_0x4706ec={'count':0x0,'rows':[]};var _0x32cdd1=_[_0xf807('0x2d')](db[_0xf807('0x2e')][_0xf807('0x2f')],function(_0x198132){return{'name':_0x198132['fieldName'],'type':_0x198132[_0xf807('0x30')][_0xf807('0x31')]};});_0x5b304b['model']=_[_0xf807('0x2d')](_0x32cdd1,_0xf807('0x2a'));_0x5b304b[_0xf807('0x32')]=_[_0xf807('0x33')](_0x37ab8f[_0xf807('0x32')]);_0x5b304b[_0xf807('0x34')]=_['intersection'](_0x5b304b[_0xf807('0x35')],_0x5b304b[_0xf807('0x32')]);_0x2afaf1[_0xf807('0x36')]=_[_0xf807('0x37')](_0x5b304b[_0xf807('0x35')],qs[_0xf807('0x38')](_0x37ab8f[_0xf807('0x32')][_0xf807('0x38')]));_0x2afaf1[_0xf807('0x36')]=_0x2afaf1[_0xf807('0x36')][_0xf807('0x39')]?_0x2afaf1[_0xf807('0x36')]:_0x5b304b[_0xf807('0x35')];if(!_0x37ab8f[_0xf807('0x32')][_0xf807('0x3a')](_0xf807('0x3b'))){_0x2afaf1[_0xf807('0x1d')]=qs[_0xf807('0x1d')](_0x37ab8f[_0xf807('0x32')][_0xf807('0x1d')]);_0x2afaf1['offset']=qs[_0xf807('0x1a')](_0x37ab8f[_0xf807('0x32')][_0xf807('0x1a')]);}_0x2afaf1[_0xf807('0x3c')]=qs[_0xf807('0x3d')](_0x37ab8f[_0xf807('0x32')][_0xf807('0x3d')]);_0x2afaf1[_0xf807('0x3e')]=qs[_0xf807('0x34')](_[_0xf807('0x3f')](_0x37ab8f[_0xf807('0x32')],_0x5b304b[_0xf807('0x34')]),_0x32cdd1);if(_0x37ab8f[_0xf807('0x32')][_0xf807('0x40')]){_0x2afaf1['where']=_[_0xf807('0x41')](_0x2afaf1[_0xf807('0x3e')],{'$or':_[_0xf807('0x2d')](_0x32cdd1,function(_0x20f898){if(_0x20f898['type']!=='VIRTUAL'){var _0x529d74={};_0x529d74[_0x20f898[_0xf807('0x2a')]]={'$like':'%'+_0x37ab8f[_0xf807('0x32')][_0xf807('0x40')]+'%'};return _0x529d74;}})});}_0x2afaf1=_[_0xf807('0x41')]({},_0x2afaf1,_0x37ab8f[_0xf807('0x42')]);var _0x484702={'where':_0x2afaf1['where']};return db[_0xf807('0x2e')][_0xf807('0x1c')](_0x484702)[_0xf807('0x25')](function(_0x51656a){_0x4706ec['count']=_0x51656a;if(_0x37ab8f[_0xf807('0x32')][_0xf807('0x43')]){_0x2afaf1[_0xf807('0x44')]=[{'all':!![]}];}return db[_0xf807('0x2e')]['findAll'](_0x2afaf1);})[_0xf807('0x25')](function(_0x38e226){_0x4706ec['rows']=_0x38e226;return _0x4706ec;})[_0xf807('0x25')](respondWithFilteredResult(_0x539376,_0x2afaf1))[_0xf807('0x45')](handleError(_0x539376,null));};exports['show']=function(_0x3fbdb7,_0x4e2102){var _0x59a6a0={'raw':!![],'where':{'id':_0x3fbdb7[_0xf807('0x46')]['id']}},_0x4e9718={};_0x4e9718[_0xf807('0x35')]=_[_0xf807('0x33')](db[_0xf807('0x2e')]['rawAttributes']);_0x4e9718[_0xf807('0x32')]=_[_0xf807('0x33')](_0x3fbdb7[_0xf807('0x32')]);_0x4e9718[_0xf807('0x34')]=_[_0xf807('0x37')](_0x4e9718['model'],_0x4e9718[_0xf807('0x32')]);_0x59a6a0[_0xf807('0x36')]=_['intersection'](_0x4e9718[_0xf807('0x35')],qs['fields'](_0x3fbdb7[_0xf807('0x32')]['fields']));_0x59a6a0[_0xf807('0x36')]=_0x59a6a0[_0xf807('0x36')]['length']?_0x59a6a0[_0xf807('0x36')]:_0x4e9718[_0xf807('0x35')];if(_0x3fbdb7[_0xf807('0x32')][_0xf807('0x43')]){_0x59a6a0[_0xf807('0x44')]=[{'all':!![]}];}_0x59a6a0=_[_0xf807('0x41')]({},_0x59a6a0,_0x3fbdb7[_0xf807('0x42')]);return db[_0xf807('0x2e')]['find'](_0x59a6a0)['then'](handleEntityNotFound(_0x4e2102,null))['then'](respondWithResult(_0x4e2102,null))[_0xf807('0x45')](handleError(_0x4e2102,null));};exports[_0xf807('0x47')]=function(_0x30ff4a,_0x91118a,_0x593645){return db[_0xf807('0x2e')]['find']({'where':{'id':_0x30ff4a[_0xf807('0x46')]['id']},'attributes':[_0xf807('0x2a'),_0xf807('0x48'),'converted_format'],'raw':!![]})[_0xf807('0x25')](handleEntityNotFound(_0x91118a,null))[_0xf807('0x25')](function(_0x111adc){if(_0x111adc){if(!fs[_0xf807('0x49')](path[_0xf807('0x4a')](config[_0xf807('0x4b')],_0xf807('0x4c'),_0x111adc[_0xf807('0x48')]+'.'+_0x111adc[_0xf807('0x4d')]))){throw new db['Sequelize'][(_0xf807('0x4e'))](_0xf807('0x4f'));}return _0x91118a[_0xf807('0x47')](path[_0xf807('0x4a')](config[_0xf807('0x4b')],_0xf807('0x4c'),util['format'](_0xf807('0x50'),_0x111adc[_0xf807('0x48')],_0x111adc[_0xf807('0x4d')])),util[_0xf807('0x51')](_0xf807('0x50'),_0x111adc[_0xf807('0x2a')],_0x111adc[_0xf807('0x4d')]));}return null;})[_0xf807('0x45')](handleError(_0x91118a,null));};exports[_0xf807('0x52')]=function(_0x23d349,_0x33eb6b,_0x264971){var _0x1b2d4e={'name':path[_0xf807('0x53')](_0x23d349[_0xf807('0x54')][_0xf807('0x55')],path['extname'](_0x23d349[_0xf807('0x54')][_0xf807('0x55')])),'save_name':path['basename'](_0x23d349[_0xf807('0x54')][_0xf807('0x56')],path[_0xf807('0x57')](_0x23d349[_0xf807('0x54')]['filename'])),'original_format':path[_0xf807('0x57')](_0x23d349['file'][_0xf807('0x55')])['substring'](0x1),'converted_format':_0xf807('0x58')};var _0x1582c5=path['join'](config[_0xf807('0x4b')],_0xf807('0x59'),_0x23d349['file'][_0xf807('0x56')]);var _0x36100e=path[_0xf807('0x4a')](config[_0xf807('0x4b')],_0xf807('0x4c'),util['format'](_0xf807('0x50'),path[_0xf807('0x53')](_0x23d349['file'][_0xf807('0x56')],path['extname'](_0x23d349[_0xf807('0x54')]['filename'])),_0x1b2d4e[_0xf807('0x4d')]));logger['info'](_0xf807('0x5a'),_0x1582c5);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x36100e);try{fs[_0xf807('0x5b')](_0x1582c5,parseInt('0777',0x8));var _0x307618=sox[_0xf807('0x5c')](_0x1582c5,_0x36100e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x307618['on']('error',function(_0x4022c2){fs['unlinkSync'](_0x1582c5);_0x33eb6b[_0xf807('0x18')](0x1f4)[_0xf807('0x2b')](_0x4022c2);});_0x307618['on'](_0xf807('0x5d'),function(_0xf182f2){_0x1b2d4e[_0xf807('0x5e')]=isNaN(_0xf182f2[_0xf807('0x5f')])?null:_0xf182f2[_0xf807('0x5f')]*0x3e8;_0x1b2d4e[_0xf807('0x60')]=isNaN(_0xf182f2[_0xf807('0x61')])?null:_0xf182f2[_0xf807('0x61')];_0x1b2d4e[_0xf807('0x62')]=isNaN(_0xf182f2[_0xf807('0x63')])?null:_0xf182f2[_0xf807('0x63')];_0x1b2d4e['original_bitRate']=isNaN(_0xf182f2['bitRate'])?null:_0xf182f2[_0xf807('0x64')];_0x1b2d4e[_0xf807('0x65')]=isNaN(_0xf182f2[_0xf807('0x66')])?null:_0xf182f2[_0xf807('0x66')];});_0x307618['on'](_0xf807('0x67'),function(_0xccb204){_0x1b2d4e[_0xf807('0x68')]=isNaN(_0xccb204['duration'])?null:_0xccb204[_0xf807('0x5f')]*0x3e8;_0x1b2d4e[_0xf807('0x69')]=isNaN(_0xccb204[_0xf807('0x61')])?null:_0xccb204[_0xf807('0x61')];_0x1b2d4e[_0xf807('0x6a')]=isNaN(_0xccb204['channelCount'])?null:_0xccb204[_0xf807('0x63')];_0x1b2d4e[_0xf807('0x6b')]=isNaN(_0xccb204[_0xf807('0x64')])?null:_0xccb204[_0xf807('0x64')];_0x1b2d4e[_0xf807('0x6c')]=isNaN(_0xccb204[_0xf807('0x66')])?null:_0xccb204[_0xf807('0x66')];});_0x307618['on'](_0xf807('0x19'),function(){fs['chmodSync'](_0x36100e,parseInt(_0xf807('0x6d'),0x8));return db[_0xf807('0x2e')][_0xf807('0x52')](_0x1b2d4e)[_0xf807('0x25')](function(_0x239c7b){var _0x58dc58={'role':_0x23d349['body'][_0xf807('0x6e')],'userProfileId':_0x23d349['body'][_0xf807('0x6f')]};if(!_0x58dc58)throw new Error(_0xf807('0x70'));if(_0x58dc58[_0xf807('0x6e')]==='user'){var _0x451804=_0x239c7b[_0xf807('0x27')]({'plain':!![]});return db[_0xf807('0x71')]['find']({'where':{'name':_0xf807('0x28'),'userProfileId':_0x58dc58[_0xf807('0x6f')]},'raw':!![]})[_0xf807('0x25')](function(_0x3fb9f1){if(_0x3fb9f1&&_0x3fb9f1[_0xf807('0x72')]===0x0){return db[_0xf807('0x73')][_0xf807('0x52')]({'name':_0x451804[_0xf807('0x2a')],'resourceId':_0x451804['id'],'type':_0x3fb9f1[_0xf807('0x2a')],'sectionId':_0x3fb9f1['id']},{})[_0xf807('0x25')](function(){return _0x239c7b;});}else{return _0x239c7b;}})[_0xf807('0x45')](function(_0xfed184){logger[_0xf807('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfed184);throw _0xfed184;});}return _0x239c7b;})[_0xf807('0x25')](respondWithResult(_0x33eb6b,null))[_0xf807('0x45')](handleError(_0x33eb6b,null));});_0x307618[_0xf807('0x74')]();}catch(_0x6741db){_0x33eb6b['status'](0x1f4)[_0xf807('0x2b')](_0x6741db);}};exports['update']=function(_0x56d147,_0x8a220b,_0x2a4427){return db['Sound'][_0xf807('0x75')]({'where':{'id':_0x56d147['params']['id']}})[_0xf807('0x25')](handleEntityNotFound(_0x8a220b,null))['then'](saveUpdates(_[_0xf807('0x3f')](_0x56d147['body'],[_0xf807('0x2a'),_0xf807('0x76')]),null))['then'](respondWithResult(_0x8a220b,null))[_0xf807('0x45')](handleError(_0x8a220b,null));};exports[_0xf807('0x77')]=function(_0x2b1865,_0x41dba5,_0x338908){return db['Sound'][_0xf807('0x75')]({'where':{'id':_0x2b1865[_0xf807('0x46')]['id']}})[_0xf807('0x25')](function(_0x1dbf75){if(_0x1dbf75){return _0x1dbf75[_0xf807('0x26')]();}})[_0xf807('0x25')](function(_0x2435a6){var _0x14e236=path['join'](config[_0xf807('0x4b')],_0xf807('0x59'),util[_0xf807('0x51')](_0xf807('0x50'),_0x2435a6[_0xf807('0x48')],_0x2435a6['original_format']));var _0x1a8698=path[_0xf807('0x4a')](config[_0xf807('0x4b')],_0xf807('0x4c'),util[_0xf807('0x51')]('%s.%s',_0x2435a6['save_name'],_0x2435a6[_0xf807('0x4d')]));fs[_0xf807('0x78')](_0x14e236);fs[_0xf807('0x78')](_0x1a8698);return _0x2435a6;})['then'](function(_0x4a4b34){if(_0x4a4b34){return _0x41dba5[_0xf807('0x18')](0xcc)[_0xf807('0x19')]();}})['then'](handleEntityNotFound(_0x41dba5,null))['catch'](handleError(_0x41dba5,null));}; \ No newline at end of file +var _0xfb2d=['limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','Sound','includeAll','include','findAll','rows','catch','show','params','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','info','chmodSync','error','send','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','server/files/sounds/original','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb2d,0x1d5));var _0xdfb2=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xfb2d[_0x5e8c32];return _0x595f7b;};'use strict';var emlformat=require(_0xdfb2('0x0'));var rimraf=require(_0xdfb2('0x1'));var zipdir=require(_0xdfb2('0x2'));var jsonpatch=require(_0xdfb2('0x3'));var rp=require(_0xdfb2('0x4'));var moment=require(_0xdfb2('0x5'));var BPromise=require(_0xdfb2('0x6'));var Mustache=require(_0xdfb2('0x7'));var util=require('util');var path=require(_0xdfb2('0x8'));var sox=require(_0xdfb2('0x9'));var csv=require(_0xdfb2('0xa'));var ejs=require(_0xdfb2('0xb'));var fs=require('fs');var fs_extra=require(_0xdfb2('0xc'));var _=require(_0xdfb2('0xd'));var squel=require(_0xdfb2('0xe'));var crypto=require(_0xdfb2('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdfb2('0xa'));var querystring=require(_0xdfb2('0x10'));var Papa=require(_0xdfb2('0x11'));var Redis=require(_0xdfb2('0x12'));var authService=require(_0xdfb2('0x13'));var qs=require(_0xdfb2('0x14'));var as=require(_0xdfb2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfb2('0x16'))(_0xdfb2('0x17'));var utils=require('../../config/utils');var config=require(_0xdfb2('0x18'));var licenseUtil=require(_0xdfb2('0x19'));var db=require(_0xdfb2('0x1a'))['db'];function respondWithStatusCode(_0x1450be,_0x628e4c){_0x628e4c=_0x628e4c||0xcc;return function(_0x27ec13){if(_0x27ec13){return _0x1450be['sendStatus'](_0x628e4c);}return _0x1450be[_0xdfb2('0x1b')](_0x628e4c)[_0xdfb2('0x1c')]();};}function respondWithResult(_0x84f83,_0x13d2cc){_0x13d2cc=_0x13d2cc||0xc8;return function(_0x1c46fa){if(_0x1c46fa){return _0x84f83[_0xdfb2('0x1b')](_0x13d2cc)[_0xdfb2('0x1d')](_0x1c46fa);}};}function respondWithFilteredResult(_0x1c9bd9,_0x396f64){return function(_0x311143){if(_0x311143){var _0xd17b5d=typeof _0x396f64[_0xdfb2('0x1e')]==='undefined'&&typeof _0x396f64[_0xdfb2('0x1f')]===_0xdfb2('0x20');var _0x26112a=_0x311143[_0xdfb2('0x21')];var _0x2a6be4=_0xd17b5d?0x0:_0x396f64['offset'];var _0x56726d=_0xd17b5d?_0x311143['count']:_0x396f64[_0xdfb2('0x1e')]+_0x396f64[_0xdfb2('0x1f')];var _0x268ae3;if(_0x56726d>=_0x26112a){_0x56726d=_0x26112a;_0x268ae3=0xc8;}else{_0x268ae3=0xce;}_0x1c9bd9[_0xdfb2('0x1b')](_0x268ae3);return _0x1c9bd9['set'](_0xdfb2('0x22'),_0x2a6be4+'-'+_0x56726d+'/'+_0x26112a)[_0xdfb2('0x1d')](_0x311143);}return null;};}function patchUpdates(_0x2ba354){return function(_0x12bbc6){try{jsonpatch[_0xdfb2('0x23')](_0x12bbc6,_0x2ba354,!![]);}catch(_0x29cc95){return BPromise[_0xdfb2('0x24')](_0x29cc95);}return _0x12bbc6[_0xdfb2('0x25')]();};}function saveUpdates(_0xb66e2f,_0x4e0e85){return function(_0x248032){if(_0x248032){return _0x248032[_0xdfb2('0x26')](_0xb66e2f)[_0xdfb2('0x27')](function(_0x1e4f72){return _0x1e4f72;});}return null;};}function removeEntity(_0x8d33a0,_0x34e3d5){return function(_0xe1c653){if(_0xe1c653){return _0xe1c653[_0xdfb2('0x28')]()['then'](function(){var _0x46e57c=_0xe1c653['get']({'plain':!![]});var _0x351ac0='Sounds';return db[_0xdfb2('0x29')][_0xdfb2('0x28')]({'where':{'type':_0x351ac0,'resourceId':_0x46e57c['id']}})[_0xdfb2('0x27')](function(){return _0xe1c653;});})['then'](function(){_0x8d33a0['status'](0xcc)[_0xdfb2('0x1c')]();});}};}function handleEntityNotFound(_0x571db2,_0x1fc190){return function(_0x238cd8){if(!_0x238cd8){_0x571db2[_0xdfb2('0x2a')](0x194);}return _0x238cd8;};}function handleError(_0x135589,_0x184fd9){_0x184fd9=_0x184fd9||0x1f4;return function(_0x4fe6b4){logger['error'](_0x4fe6b4[_0xdfb2('0x2b')]);if(_0x4fe6b4[_0xdfb2('0x2c')]){delete _0x4fe6b4[_0xdfb2('0x2c')];}_0x135589[_0xdfb2('0x1b')](_0x184fd9)['send'](_0x4fe6b4);};}exports[_0xdfb2('0x2d')]=function(_0x21b371,_0x341081){var _0x17d776={},_0x502115={},_0x56c11f={'count':0x0,'rows':[]};var _0xb0d97b=_[_0xdfb2('0x2e')](db['Sound'][_0xdfb2('0x2f')],function(_0x297b4d){return{'name':_0x297b4d[_0xdfb2('0x30')],'type':_0x297b4d[_0xdfb2('0x31')]['key']};});_0x502115[_0xdfb2('0x32')]=_[_0xdfb2('0x2e')](_0xb0d97b,_0xdfb2('0x2c'));_0x502115['query']=_[_0xdfb2('0x33')](_0x21b371[_0xdfb2('0x34')]);_0x502115[_0xdfb2('0x35')]=_[_0xdfb2('0x36')](_0x502115[_0xdfb2('0x32')],_0x502115['query']);_0x17d776[_0xdfb2('0x37')]=_[_0xdfb2('0x36')](_0x502115[_0xdfb2('0x32')],qs[_0xdfb2('0x38')](_0x21b371[_0xdfb2('0x34')][_0xdfb2('0x38')]));_0x17d776[_0xdfb2('0x37')]=_0x17d776[_0xdfb2('0x37')][_0xdfb2('0x39')]?_0x17d776[_0xdfb2('0x37')]:_0x502115[_0xdfb2('0x32')];if(!_0x21b371[_0xdfb2('0x34')][_0xdfb2('0x3a')](_0xdfb2('0x3b'))){_0x17d776['limit']=qs[_0xdfb2('0x1f')](_0x21b371[_0xdfb2('0x34')][_0xdfb2('0x1f')]);_0x17d776[_0xdfb2('0x1e')]=qs[_0xdfb2('0x1e')](_0x21b371['query']['offset']);}_0x17d776['order']=qs[_0xdfb2('0x3c')](_0x21b371[_0xdfb2('0x34')][_0xdfb2('0x3c')]);_0x17d776[_0xdfb2('0x3d')]=qs[_0xdfb2('0x35')](_[_0xdfb2('0x3e')](_0x21b371[_0xdfb2('0x34')],_0x502115['filters']),_0xb0d97b);if(_0x21b371[_0xdfb2('0x34')]['filter']){_0x17d776[_0xdfb2('0x3d')]=_['merge'](_0x17d776[_0xdfb2('0x3d')],{'$or':_['map'](_0xb0d97b,function(_0x58db75){if(_0x58db75['type']!==_0xdfb2('0x3f')){var _0x12e6b8={};_0x12e6b8[_0x58db75[_0xdfb2('0x2c')]]={'$like':'%'+_0x21b371['query'][_0xdfb2('0x40')]+'%'};return _0x12e6b8;}})});}_0x17d776=_[_0xdfb2('0x41')]({},_0x17d776,_0x21b371[_0xdfb2('0x42')]);var _0x23ba04={'where':_0x17d776[_0xdfb2('0x3d')]};return db[_0xdfb2('0x43')][_0xdfb2('0x21')](_0x23ba04)['then'](function(_0x3b27be){_0x56c11f[_0xdfb2('0x21')]=_0x3b27be;if(_0x21b371['query'][_0xdfb2('0x44')]){_0x17d776[_0xdfb2('0x45')]=[{'all':!![]}];}return db[_0xdfb2('0x43')][_0xdfb2('0x46')](_0x17d776);})[_0xdfb2('0x27')](function(_0x3f50ba){_0x56c11f[_0xdfb2('0x47')]=_0x3f50ba;return _0x56c11f;})[_0xdfb2('0x27')](respondWithFilteredResult(_0x341081,_0x17d776))[_0xdfb2('0x48')](handleError(_0x341081,null));};exports[_0xdfb2('0x49')]=function(_0x320182,_0x37f7b7){var _0x4f6d84={'raw':!![],'where':{'id':_0x320182[_0xdfb2('0x4a')]['id']}},_0x160636={};_0x160636[_0xdfb2('0x32')]=_[_0xdfb2('0x33')](db['Sound'][_0xdfb2('0x2f')]);_0x160636[_0xdfb2('0x34')]=_[_0xdfb2('0x33')](_0x320182[_0xdfb2('0x34')]);_0x160636[_0xdfb2('0x35')]=_[_0xdfb2('0x36')](_0x160636[_0xdfb2('0x32')],_0x160636[_0xdfb2('0x34')]);_0x4f6d84[_0xdfb2('0x37')]=_[_0xdfb2('0x36')](_0x160636[_0xdfb2('0x32')],qs[_0xdfb2('0x38')](_0x320182['query'][_0xdfb2('0x38')]));_0x4f6d84[_0xdfb2('0x37')]=_0x4f6d84[_0xdfb2('0x37')]['length']?_0x4f6d84[_0xdfb2('0x37')]:_0x160636[_0xdfb2('0x32')];if(_0x320182[_0xdfb2('0x34')][_0xdfb2('0x44')]){_0x4f6d84[_0xdfb2('0x45')]=[{'all':!![]}];}_0x4f6d84=_[_0xdfb2('0x41')]({},_0x4f6d84,_0x320182[_0xdfb2('0x42')]);return db[_0xdfb2('0x43')][_0xdfb2('0x4b')](_0x4f6d84)['then'](handleEntityNotFound(_0x37f7b7,null))['then'](respondWithResult(_0x37f7b7,null))['catch'](handleError(_0x37f7b7,null));};exports['download']=function(_0x35aff7,_0x196776,_0x49c546){return db[_0xdfb2('0x43')][_0xdfb2('0x4b')]({'where':{'id':_0x35aff7[_0xdfb2('0x4a')]['id']},'attributes':[_0xdfb2('0x2c'),_0xdfb2('0x4c'),_0xdfb2('0x4d')],'raw':!![]})[_0xdfb2('0x27')](handleEntityNotFound(_0x196776,null))['then'](function(_0x4539bc){if(_0x4539bc){if(!fs[_0xdfb2('0x4e')](path['join'](config[_0xdfb2('0x4f')],_0xdfb2('0x50'),_0x4539bc[_0xdfb2('0x4c')]+'.'+_0x4539bc['converted_format']))){throw new db[(_0xdfb2('0x51'))][(_0xdfb2('0x52'))](_0xdfb2('0x53'));}return _0x196776['download'](path[_0xdfb2('0x54')](config[_0xdfb2('0x4f')],_0xdfb2('0x50'),util[_0xdfb2('0x55')](_0xdfb2('0x56'),_0x4539bc[_0xdfb2('0x4c')],_0x4539bc[_0xdfb2('0x4d')])),util[_0xdfb2('0x55')](_0xdfb2('0x56'),_0x4539bc[_0xdfb2('0x2c')],_0x4539bc[_0xdfb2('0x4d')]));}return null;})[_0xdfb2('0x48')](handleError(_0x196776,null));};exports[_0xdfb2('0x57')]=function(_0x320c13,_0x3eeba8,_0x287158){var _0x36299c={'name':path[_0xdfb2('0x58')](_0x320c13['file'][_0xdfb2('0x59')],path[_0xdfb2('0x5a')](_0x320c13[_0xdfb2('0x5b')]['originalname'])),'save_name':path[_0xdfb2('0x58')](_0x320c13[_0xdfb2('0x5b')]['filename'],path[_0xdfb2('0x5a')](_0x320c13[_0xdfb2('0x5b')][_0xdfb2('0x5c')])),'original_format':path['extname'](_0x320c13['file'][_0xdfb2('0x59')])[_0xdfb2('0x5d')](0x1),'converted_format':_0xdfb2('0x5e')};var _0x4bc265=path['join'](config[_0xdfb2('0x4f')],'server/files/sounds/original',_0x320c13[_0xdfb2('0x5b')]['filename']);var _0x55d8e9=path['join'](config['root'],_0xdfb2('0x50'),util['format']('%s.%s',path[_0xdfb2('0x58')](_0x320c13[_0xdfb2('0x5b')][_0xdfb2('0x5c')],path['extname'](_0x320c13['file'][_0xdfb2('0x5c')])),_0x36299c['converted_format']));logger[_0xdfb2('0x5f')]('Sound\x20upload\x20filepath:\x20%s',_0x4bc265);logger[_0xdfb2('0x5f')]('Sound\x20upload\x20destination:\x20%s',_0x55d8e9);try{fs[_0xdfb2('0x60')](_0x4bc265,parseInt('0777',0x8));var _0x450045=sox['transcode'](_0x4bc265,_0x55d8e9,{'sampleRate':0x1f40,'format':_0xdfb2('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x450045['on'](_0xdfb2('0x61'),function(_0x41800f){fs['unlinkSync'](_0x4bc265);_0x3eeba8[_0xdfb2('0x1b')](0x1f4)[_0xdfb2('0x62')](_0x41800f);});_0x450045['on']('src',function(_0x19872d){_0x36299c[_0xdfb2('0x63')]=isNaN(_0x19872d[_0xdfb2('0x64')])?null:_0x19872d[_0xdfb2('0x64')]*0x3e8;_0x36299c['original_sampleCount']=isNaN(_0x19872d[_0xdfb2('0x65')])?null:_0x19872d[_0xdfb2('0x65')];_0x36299c[_0xdfb2('0x66')]=isNaN(_0x19872d['channelCount'])?null:_0x19872d[_0xdfb2('0x67')];_0x36299c[_0xdfb2('0x68')]=isNaN(_0x19872d[_0xdfb2('0x69')])?null:_0x19872d[_0xdfb2('0x69')];_0x36299c[_0xdfb2('0x6a')]=isNaN(_0x19872d[_0xdfb2('0x6b')])?null:_0x19872d[_0xdfb2('0x6b')];});_0x450045['on'](_0xdfb2('0x6c'),function(_0xda21d7){_0x36299c['converted_duration']=isNaN(_0xda21d7[_0xdfb2('0x64')])?null:_0xda21d7['duration']*0x3e8;_0x36299c[_0xdfb2('0x6d')]=isNaN(_0xda21d7[_0xdfb2('0x65')])?null:_0xda21d7[_0xdfb2('0x65')];_0x36299c[_0xdfb2('0x6e')]=isNaN(_0xda21d7[_0xdfb2('0x67')])?null:_0xda21d7[_0xdfb2('0x67')];_0x36299c['converted_bitRate']=isNaN(_0xda21d7[_0xdfb2('0x69')])?null:_0xda21d7[_0xdfb2('0x69')];_0x36299c['converted_sampleRate']=isNaN(_0xda21d7[_0xdfb2('0x6b')])?null:_0xda21d7[_0xdfb2('0x6b')];});_0x450045['on'](_0xdfb2('0x1c'),function(){fs[_0xdfb2('0x60')](_0x55d8e9,parseInt(_0xdfb2('0x6f'),0x8));return db[_0xdfb2('0x43')][_0xdfb2('0x57')](_0x36299c)[_0xdfb2('0x27')](function(_0x4c4cb8){var _0x2bc230={'role':_0x320c13[_0xdfb2('0x70')][_0xdfb2('0x71')],'userProfileId':_0x320c13[_0xdfb2('0x70')][_0xdfb2('0x72')]};if(!_0x2bc230)throw new Error(_0xdfb2('0x73'));if(_0x2bc230[_0xdfb2('0x71')]==='user'){var _0x42abcd=_0x4c4cb8[_0xdfb2('0x74')]({'plain':!![]});return db[_0xdfb2('0x75')][_0xdfb2('0x4b')]({'where':{'name':_0xdfb2('0x76'),'userProfileId':_0x2bc230[_0xdfb2('0x72')]},'raw':!![]})[_0xdfb2('0x27')](function(_0x50a1ca){if(_0x50a1ca&&_0x50a1ca[_0xdfb2('0x77')]===0x0){return db['UserProfileResource'][_0xdfb2('0x57')]({'name':_0x42abcd[_0xdfb2('0x2c')],'resourceId':_0x42abcd['id'],'type':_0x50a1ca[_0xdfb2('0x2c')],'sectionId':_0x50a1ca['id']},{})[_0xdfb2('0x27')](function(){return _0x4c4cb8;});}else{return _0x4c4cb8;}})[_0xdfb2('0x48')](function(_0x41a74c){logger[_0xdfb2('0x61')](_0xdfb2('0x78'),_0x41a74c);throw _0x41a74c;});}return _0x4c4cb8;})[_0xdfb2('0x27')](respondWithResult(_0x3eeba8,null))['catch'](handleError(_0x3eeba8,null));});_0x450045['start']();}catch(_0x4ac3d9){_0x3eeba8[_0xdfb2('0x1b')](0x1f4)[_0xdfb2('0x62')](_0x4ac3d9);}};exports[_0xdfb2('0x26')]=function(_0x139786,_0xd06d20,_0x3181cf){return db[_0xdfb2('0x43')][_0xdfb2('0x4b')]({'where':{'id':_0x139786[_0xdfb2('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd06d20,null))['then'](saveUpdates(_['pick'](_0x139786[_0xdfb2('0x70')],[_0xdfb2('0x2c'),_0xdfb2('0x79')]),null))[_0xdfb2('0x27')](respondWithResult(_0xd06d20,null))[_0xdfb2('0x48')](handleError(_0xd06d20,null));};exports[_0xdfb2('0x7a')]=function(_0x4fd92f,_0x514490,_0x5bbaa2){return db[_0xdfb2('0x43')][_0xdfb2('0x4b')]({'where':{'id':_0x4fd92f[_0xdfb2('0x4a')]['id']}})['then'](function(_0x33550b){if(_0x33550b){return _0x33550b[_0xdfb2('0x28')]();}})['then'](function(_0x3b69af){var _0x45cfd4=path[_0xdfb2('0x54')](config[_0xdfb2('0x4f')],_0xdfb2('0x7b'),util[_0xdfb2('0x55')]('%s.%s',_0x3b69af[_0xdfb2('0x4c')],_0x3b69af['original_format']));var _0x5b4a9b=path[_0xdfb2('0x54')](config['root'],_0xdfb2('0x50'),util[_0xdfb2('0x55')](_0xdfb2('0x56'),_0x3b69af[_0xdfb2('0x4c')],_0x3b69af[_0xdfb2('0x4d')]));fs[_0xdfb2('0x7c')](_0x45cfd4);fs[_0xdfb2('0x7c')](_0x5b4a9b);return _0x3b69af;})[_0xdfb2('0x27')](function(_0x385530){if(_0x385530){return _0x514490[_0xdfb2('0x1b')](0xcc)['end']();}})[_0xdfb2('0x27')](handleEntityNotFound(_0x514490,null))[_0xdfb2('0x48')](handleError(_0x514490,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 113bbd7..92b9bde 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 _0x4764=['./sound.attributes','exports','define','tools_sounds','util','api','moment','rimraf','../../config/environment'];(function(_0x238202,_0x10da07){var _0x217367=function(_0x34f6d0){while(--_0x34f6d0){_0x238202['push'](_0x238202['shift']());}};_0x217367(++_0x10da07);}(_0x4764,0x16c));var _0x4476=function(_0x32f680,_0x4158c4){_0x32f680=_0x32f680-0x0;var _0x5e3ce6=_0x4764[_0x32f680];return _0x5e3ce6;};'use strict';var _=require('lodash');var util=require(_0x4476('0x0'));var logger=require('../../config/logger')(_0x4476('0x1'));var moment=require(_0x4476('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4476('0x3'));var config=require(_0x4476('0x4'));var attributes=require(_0x4476('0x5'));module[_0x4476('0x6')]=function(_0x84e7d,_0x265f90){return _0x84e7d[_0x4476('0x7')]('Sound',attributes,{'tableName':_0x4476('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b61=['./sound.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x20ebaf,_0x2e737f){var _0x3fa8d7=function(_0x4d72f1){while(--_0x4d72f1){_0x20ebaf['push'](_0x20ebaf['shift']());}};_0x3fa8d7(++_0x2e737f);}(_0x3b61,0xa8));var _0x13b6=function(_0x58cff3,_0x52ed33){_0x58cff3=_0x58cff3-0x0;var _0x3a2cb0=_0x3b61[_0x58cff3];return _0x3a2cb0;};'use strict';var _=require(_0x13b6('0x0'));var util=require(_0x13b6('0x1'));var logger=require(_0x13b6('0x2'))(_0x13b6('0x3'));var moment=require('moment');var BPromise=require(_0x13b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13b6('0x5'));var rimraf=require(_0x13b6('0x6'));var config=require(_0x13b6('0x7'));var attributes=require(_0x13b6('0x8'));module[_0x13b6('0x9')]=function(_0x17f1ab,_0x3fa2a2){return _0x17f1ab[_0x13b6('0xa')]('Sound',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 98210e1..78765b8 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 _0xfe6a=['Sound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','ShowSound'];(function(_0x25df8b,_0x7766c9){var _0xd8b05f=function(_0xb20df2){while(--_0xb20df2){_0x25df8b['push'](_0x25df8b['shift']());}};_0xd8b05f(++_0x7766c9);}(_0xfe6a,0x117));var _0xafe6=function(_0x420b45,_0x20cd1b){_0x420b45=_0x420b45-0x0;var _0x2ce16d=_0xfe6a[_0x420b45];return _0x2ce16d;};'use strict';var _=require(_0xafe6('0x0'));var util=require(_0xafe6('0x1'));var moment=require(_0xafe6('0x2'));var BPromise=require(_0xafe6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafe6('0x4'));var logger=require(_0xafe6('0x5'))(_0xafe6('0x6'));var config=require(_0xafe6('0x7'));var jayson=require(_0xafe6('0x8'));var client=jayson['client'][_0xafe6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c768c,_0xf25e6c,_0x29c505){return new BPromise(function(_0x1e289e,_0x3b85b6){return client[_0xafe6('0xa')](_0x5c768c,_0x29c505)[_0xafe6('0xb')](function(_0x2b1202){logger[_0xafe6('0xc')](_0xafe6('0xd'),_0xf25e6c,_0xafe6('0xe'));logger[_0xafe6('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0xf25e6c,'request\x20sent',JSON[_0xafe6('0x10')](_0x2b1202));if(_0x2b1202[_0xafe6('0x11')]){if(_0x2b1202[_0xafe6('0x11')]['code']===0x1f4){logger[_0xafe6('0x11')](_0xafe6('0xd'),_0xf25e6c,_0x2b1202[_0xafe6('0x11')][_0xafe6('0x12')]);return _0x3b85b6(_0x2b1202[_0xafe6('0x11')]['message']);}logger[_0xafe6('0x11')](_0xafe6('0xd'),_0xf25e6c,_0x2b1202[_0xafe6('0x11')][_0xafe6('0x12')]);return _0x1e289e(_0x2b1202['error']['message']);}else{logger[_0xafe6('0xc')](_0xafe6('0xd'),_0xf25e6c,'request\x20sent');_0x1e289e(_0x2b1202['result']['message']);}})[_0xafe6('0x13')](function(_0xd805a7){logger[_0xafe6('0x11')]('Sound,\x20%s,\x20%s',_0xf25e6c,_0xd805a7);_0x3b85b6(_0xd805a7);});});}exports[_0xafe6('0x14')]=function(_0x278733){var _0xfbbf55=this;return new Promise(function(_0x318665,_0x108ec7){return db[_0xafe6('0x15')][_0xafe6('0x16')]({'raw':_0x278733[_0xafe6('0x17')]?_0x278733[_0xafe6('0x17')][_0xafe6('0x18')]===undefined?!![]:![]:!![],'where':_0x278733['options']?_0x278733[_0xafe6('0x17')][_0xafe6('0x19')]||null:null,'attributes':_0x278733[_0xafe6('0x17')]?_0x278733[_0xafe6('0x17')][_0xafe6('0x1a')]||null:null,'include':_0x278733['options']?_0x278733['options'][_0xafe6('0x1b')]?_[_0xafe6('0x1c')](_0x278733[_0xafe6('0x17')]['include'],function(_0x2662b1){return{'model':db[_0x2662b1[_0xafe6('0x1d')]],'as':_0x2662b1['as'],'attributes':_0x2662b1['attributes'],'include':_0x2662b1['include']?_[_0xafe6('0x1c')](_0x2662b1['include'],function(_0x480d7f){return{'model':db[_0x480d7f[_0xafe6('0x1d')]],'as':_0x480d7f['as'],'attributes':_0x480d7f[_0xafe6('0x1a')],'include':_0x480d7f[_0xafe6('0x1b')]?_['map'](_0x480d7f[_0xafe6('0x1b')],function(_0x1409ef){return{'model':db[_0x1409ef['model']],'as':_0x1409ef['as'],'attributes':_0x1409ef[_0xafe6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafe6('0xb')](function(_0x2f5a1c){logger[_0xafe6('0xc')](_0xafe6('0x14'),_0x278733);logger[_0xafe6('0xf')](_0xafe6('0x14'),_0x278733,JSON[_0xafe6('0x10')](_0x2f5a1c));_0x318665(_0x2f5a1c);})[_0xafe6('0x13')](function(_0x10c623){logger[_0xafe6('0x11')]('ShowSound',_0x10c623['message'],_0x278733);_0x108ec7(_0xfbbf55['error'](0x1f4,_0x10c623[_0xafe6('0x12')]));});});}; \ No newline at end of file +var _0xe7b6=['rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','Sound','options','raw','where','attributes','map','include','model','then','ShowSound','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x2f481c,_0x4ca48e){var _0x4d5f90=function(_0x1972ac){while(--_0x1972ac){_0x2f481c['push'](_0x2f481c['shift']());}};_0x4d5f90(++_0x4ca48e);}(_0xe7b6,0x144));var _0x6e7b=function(_0x301c75,_0x597c15){_0x301c75=_0x301c75-0x0;var _0x36cfc4=_0xe7b6[_0x301c75];return _0x36cfc4;};'use strict';var _=require(_0x6e7b('0x0'));var util=require(_0x6e7b('0x1'));var moment=require('moment');var BPromise=require(_0x6e7b('0x2'));var rs=require(_0x6e7b('0x3'));var fs=require('fs');var Redis=require(_0x6e7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6e7b('0x5'))(_0x6e7b('0x6'));var config=require(_0x6e7b('0x7'));var jayson=require(_0x6e7b('0x8'));var client=jayson[_0x6e7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36ddb7,_0x203770,_0x3add4e){return new BPromise(function(_0x13cf01,_0x2b0d1e){return client[_0x6e7b('0xa')](_0x36ddb7,_0x3add4e)['then'](function(_0x308d08){logger[_0x6e7b('0xb')](_0x6e7b('0xc'),_0x203770,_0x6e7b('0xd'));logger[_0x6e7b('0xe')](_0x6e7b('0xf'),_0x203770,_0x6e7b('0xd'),JSON[_0x6e7b('0x10')](_0x308d08));if(_0x308d08[_0x6e7b('0x11')]){if(_0x308d08[_0x6e7b('0x11')]['code']===0x1f4){logger[_0x6e7b('0x11')](_0x6e7b('0xc'),_0x203770,_0x308d08[_0x6e7b('0x11')]['message']);return _0x2b0d1e(_0x308d08[_0x6e7b('0x11')][_0x6e7b('0x12')]);}logger['error'](_0x6e7b('0xc'),_0x203770,_0x308d08[_0x6e7b('0x11')][_0x6e7b('0x12')]);return _0x13cf01(_0x308d08[_0x6e7b('0x11')]['message']);}else{logger[_0x6e7b('0xb')](_0x6e7b('0xc'),_0x203770,_0x6e7b('0xd'));_0x13cf01(_0x308d08['result'][_0x6e7b('0x12')]);}})['catch'](function(_0x106c84){logger[_0x6e7b('0x11')](_0x6e7b('0xc'),_0x203770,_0x106c84);_0x2b0d1e(_0x106c84);});});}exports['ShowSound']=function(_0x1c1949){var _0x4b7e96=this;return new Promise(function(_0x28212f,_0x32ec5d){return db[_0x6e7b('0x13')]['find']({'raw':_0x1c1949[_0x6e7b('0x14')]?_0x1c1949[_0x6e7b('0x14')][_0x6e7b('0x15')]===undefined?!![]:![]:!![],'where':_0x1c1949[_0x6e7b('0x14')]?_0x1c1949['options'][_0x6e7b('0x16')]||null:null,'attributes':_0x1c1949[_0x6e7b('0x14')]?_0x1c1949[_0x6e7b('0x14')][_0x6e7b('0x17')]||null:null,'include':_0x1c1949['options']?_0x1c1949[_0x6e7b('0x14')]['include']?_[_0x6e7b('0x18')](_0x1c1949[_0x6e7b('0x14')]['include'],function(_0x583722){return{'model':db[_0x583722['model']],'as':_0x583722['as'],'attributes':_0x583722['attributes'],'include':_0x583722[_0x6e7b('0x19')]?_['map'](_0x583722[_0x6e7b('0x19')],function(_0xdd2371){return{'model':db[_0xdd2371[_0x6e7b('0x1a')]],'as':_0xdd2371['as'],'attributes':_0xdd2371[_0x6e7b('0x17')],'include':_0xdd2371[_0x6e7b('0x19')]?_[_0x6e7b('0x18')](_0xdd2371[_0x6e7b('0x19')],function(_0x23b820){return{'model':db[_0x23b820[_0x6e7b('0x1a')]],'as':_0x23b820['as'],'attributes':_0x23b820[_0x6e7b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6e7b('0x1b')](function(_0x3f3291){logger[_0x6e7b('0xb')](_0x6e7b('0x1c'),_0x1c1949);logger[_0x6e7b('0xe')](_0x6e7b('0x1c'),_0x1c1949,JSON[_0x6e7b('0x10')](_0x3f3291));_0x28212f(_0x3f3291);})[_0x6e7b('0x1d')](function(_0x50f553){logger['error'](_0x6e7b('0x1c'),_0x50f553[_0x6e7b('0x12')],_0x1c1949);_0x32ec5d(_0x4b7e96[_0x6e7b('0x11')](0x1f4,_0x50f553[_0x6e7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e1ca07f..89dc7b8 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x9ed781,_0x1d1fcb){var _0x354572=function(_0x4ac4ea){while(--_0x4ac4ea){_0x9ed781['push'](_0x9ed781['shift']());}};_0x354572(++_0x1d1fcb);}(_0x14a0,0x8e));var _0x014a=function(_0x3dffb5,_0x1964ac){_0x3dffb5=_0x3dffb5-0x0;var _0x252404=_0x14a0[_0x3dffb5];return _0x252404;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x478266,_0x262b6c){var _0xba35eb=function(_0x1a20e4){while(--_0x1a20e4){_0x478266['push'](_0x478266['shift']());}};_0xba35eb(++_0x262b6c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 7bb5002..0d3f18a 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 _0x0aa0=['TEXT','ENUM','out','sequelize','exports','STRING'];(function(_0x4c3f70,_0x53ac7e){var _0x4445b4=function(_0x53da94){while(--_0x53da94){_0x4c3f70['push'](_0x4c3f70['shift']());}};_0x4445b4(++_0x53ac7e);}(_0x0aa0,0x189));var _0x00aa=function(_0xf93b19,_0x1881f4){_0xf93b19=_0xf93b19-0x0;var _0x53cf20=_0x0aa0[_0xf93b19];return _0x53cf20;};'use strict';var Sequelize=require(_0x00aa('0x0'));module[_0x00aa('0x1')]={'uniqueid':{'type':Sequelize[_0x00aa('0x2')]},'body':{'type':Sequelize[_0x00aa('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x00aa('0x4')]('in','out'),'defaultValue':_0x00aa('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x00aa('0x2')]},'providerResponse':{'type':Sequelize[_0x00aa('0x3')]}}; \ No newline at end of file +var _0x8a7b=['sequelize','exports','medium','ENUM','out','STRING','TEXT'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x8a7b,0x150));var _0xb8a7=function(_0x4c9915,_0x406b1a){_0x4c9915=_0x4c9915-0x0;var _0x473218=_0x8a7b[_0x4c9915];return _0x473218;};'use strict';var Sequelize=require(_0xb8a7('0x0'));module[_0xb8a7('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xb8a7('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xb8a7('0x3')]('in',_0xb8a7('0x4')),'defaultValue':_0xb8a7('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xb8a7('0x5')]},'providerResponse':{'type':Sequelize[_0xb8a7('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 90a6a78..f400e22 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 _0x0f8e=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','index','SquareMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','map','include','findAll','show','params','merge','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0x0f8e,0x7a));var _0xe0f8=function(_0x58bf72,_0x270672){_0x58bf72=_0x58bf72-0x0;var _0x5ac3aa=_0x0f8e[_0x58bf72];return _0x5ac3aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0f8('0x0'));var zipdir=require(_0xe0f8('0x1'));var jsonpatch=require(_0xe0f8('0x2'));var rp=require(_0xe0f8('0x3'));var moment=require('moment');var BPromise=require(_0xe0f8('0x4'));var Mustache=require(_0xe0f8('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe0f8('0x6'));var ejs=require(_0xe0f8('0x7'));var fs=require('fs');var fs_extra=require(_0xe0f8('0x8'));var _=require(_0xe0f8('0x9'));var squel=require('squel');var crypto=require(_0xe0f8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe0f8('0xb'));var toCsv=require(_0xe0f8('0x6'));var querystring=require(_0xe0f8('0xc'));var Papa=require(_0xe0f8('0xd'));var Redis=require(_0xe0f8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe0f8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe0f8('0x10'));var utils=require('../../config/utils');var config=require(_0xe0f8('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xae46f8,_0x331aea){_0x331aea=_0x331aea||0xcc;return function(_0x116a4c){if(_0x116a4c){return _0xae46f8[_0xe0f8('0x12')](_0x331aea);}return _0xae46f8[_0xe0f8('0x13')](_0x331aea)[_0xe0f8('0x14')]();};}function respondWithResult(_0x54b2c8,_0x1793e7){_0x1793e7=_0x1793e7||0xc8;return function(_0x2b18b5){if(_0x2b18b5){return _0x54b2c8['status'](_0x1793e7)[_0xe0f8('0x15')](_0x2b18b5);}};}function respondWithFilteredResult(_0x12b40f,_0xc10e61){return function(_0x4e5a44){if(_0x4e5a44){var _0x123f27=typeof _0xc10e61[_0xe0f8('0x16')]===_0xe0f8('0x17')&&typeof _0xc10e61[_0xe0f8('0x18')]===_0xe0f8('0x17');var _0x3c95fd=_0x4e5a44[_0xe0f8('0x19')];var _0x46256b=_0x123f27?0x0:_0xc10e61['offset'];var _0x4ceb06=_0x123f27?_0x4e5a44['count']:_0xc10e61[_0xe0f8('0x16')]+_0xc10e61[_0xe0f8('0x18')];var _0x232877;if(_0x4ceb06>=_0x3c95fd){_0x4ceb06=_0x3c95fd;_0x232877=0xc8;}else{_0x232877=0xce;}_0x12b40f[_0xe0f8('0x13')](_0x232877);return _0x12b40f[_0xe0f8('0x1a')](_0xe0f8('0x1b'),_0x46256b+'-'+_0x4ceb06+'/'+_0x3c95fd)[_0xe0f8('0x15')](_0x4e5a44);}return null;};}function patchUpdates(_0x1ef604){return function(_0x32b360){try{jsonpatch[_0xe0f8('0x1c')](_0x32b360,_0x1ef604,!![]);}catch(_0x44f467){return BPromise[_0xe0f8('0x1d')](_0x44f467);}return _0x32b360['save']();};}function saveUpdates(_0x17f7e9,_0x3f03eb){return function(_0x2b8bce){if(_0x2b8bce){return _0x2b8bce[_0xe0f8('0x1e')](_0x17f7e9)[_0xe0f8('0x1f')](function(_0x2228be){return _0x2228be;});}return null;};}function removeEntity(_0xcb9c36,_0x360355){return function(_0x341882){if(_0x341882){return _0x341882['destroy']()[_0xe0f8('0x1f')](function(){_0xcb9c36[_0xe0f8('0x13')](0xcc)[_0xe0f8('0x14')]();});}};}function handleEntityNotFound(_0x56422c,_0x2b0bba){return function(_0x16bc49){if(!_0x16bc49){_0x56422c[_0xe0f8('0x12')](0x194);}return _0x16bc49;};}function handleError(_0x4de625,_0x32dbe7){_0x32dbe7=_0x32dbe7||0x1f4;return function(_0x146629){logger['error'](_0x146629['stack']);if(_0x146629[_0xe0f8('0x20')]){delete _0x146629[_0xe0f8('0x20')];}_0x4de625[_0xe0f8('0x13')](_0x32dbe7)['send'](_0x146629);};}exports[_0xe0f8('0x21')]=function(_0x440a29,_0x4d8b25){var _0x1379fc={},_0x28bd10={},_0x42aed4={'count':0x0,'rows':[]};var _0x36da82=_['map'](db[_0xe0f8('0x22')][_0xe0f8('0x23')],function(_0x3e545c){return{'name':_0x3e545c[_0xe0f8('0x24')],'type':_0x3e545c[_0xe0f8('0x25')][_0xe0f8('0x26')]};});_0x28bd10[_0xe0f8('0x27')]=_['map'](_0x36da82,'name');_0x28bd10['query']=_[_0xe0f8('0x28')](_0x440a29[_0xe0f8('0x29')]);_0x28bd10[_0xe0f8('0x2a')]=_[_0xe0f8('0x2b')](_0x28bd10['model'],_0x28bd10[_0xe0f8('0x29')]);_0x1379fc[_0xe0f8('0x2c')]=_[_0xe0f8('0x2b')](_0x28bd10[_0xe0f8('0x27')],qs['fields'](_0x440a29[_0xe0f8('0x29')][_0xe0f8('0x2d')]));_0x1379fc['attributes']=_0x1379fc['attributes'][_0xe0f8('0x2e')]?_0x1379fc['attributes']:_0x28bd10[_0xe0f8('0x27')];if(!_0x440a29[_0xe0f8('0x29')]['hasOwnProperty'](_0xe0f8('0x2f'))){_0x1379fc[_0xe0f8('0x18')]=qs[_0xe0f8('0x18')](_0x440a29[_0xe0f8('0x29')][_0xe0f8('0x18')]);_0x1379fc[_0xe0f8('0x16')]=qs['offset'](_0x440a29[_0xe0f8('0x29')]['offset']);}_0x1379fc['order']=qs[_0xe0f8('0x30')](_0x440a29[_0xe0f8('0x29')]['sort']);_0x1379fc['where']=qs[_0xe0f8('0x2a')](_[_0xe0f8('0x31')](_0x440a29[_0xe0f8('0x29')],_0x28bd10['filters']),_0x36da82);if(_0x440a29[_0xe0f8('0x29')][_0xe0f8('0x32')]){_0x1379fc[_0xe0f8('0x33')]=_['merge'](_0x1379fc[_0xe0f8('0x33')],{'$or':_[_0xe0f8('0x34')](_0x36da82,function(_0x525e72){if(_0x525e72[_0xe0f8('0x25')]!=='VIRTUAL'){var _0x249c5e={};_0x249c5e[_0x525e72[_0xe0f8('0x20')]]={'$like':'%'+_0x440a29['query'][_0xe0f8('0x32')]+'%'};return _0x249c5e;}})});}_0x1379fc=_['merge']({},_0x1379fc,_0x440a29['options']);var _0x49b136={'where':_0x1379fc[_0xe0f8('0x33')]};return db[_0xe0f8('0x22')][_0xe0f8('0x19')](_0x49b136)['then'](function(_0x5e2010){_0x42aed4['count']=_0x5e2010;if(_0x440a29[_0xe0f8('0x29')]['includeAll']){_0x1379fc[_0xe0f8('0x35')]=[{'all':!![]}];}return db[_0xe0f8('0x22')][_0xe0f8('0x36')](_0x1379fc);})[_0xe0f8('0x1f')](function(_0x303a80){_0x42aed4['rows']=_0x303a80;return _0x42aed4;})[_0xe0f8('0x1f')](respondWithFilteredResult(_0x4d8b25,_0x1379fc))['catch'](handleError(_0x4d8b25,null));};exports[_0xe0f8('0x37')]=function(_0x2aa761,_0x2ec05a){var _0x594ec6={'raw':!![],'where':{'id':_0x2aa761[_0xe0f8('0x38')]['id']}},_0x377b55={};_0x377b55[_0xe0f8('0x27')]=_[_0xe0f8('0x28')](db[_0xe0f8('0x22')][_0xe0f8('0x23')]);_0x377b55[_0xe0f8('0x29')]=_[_0xe0f8('0x28')](_0x2aa761[_0xe0f8('0x29')]);_0x377b55[_0xe0f8('0x2a')]=_[_0xe0f8('0x2b')](_0x377b55['model'],_0x377b55[_0xe0f8('0x29')]);_0x594ec6[_0xe0f8('0x2c')]=_[_0xe0f8('0x2b')](_0x377b55[_0xe0f8('0x27')],qs[_0xe0f8('0x2d')](_0x2aa761[_0xe0f8('0x29')][_0xe0f8('0x2d')]));_0x594ec6['attributes']=_0x594ec6[_0xe0f8('0x2c')][_0xe0f8('0x2e')]?_0x594ec6[_0xe0f8('0x2c')]:_0x377b55['model'];if(_0x2aa761[_0xe0f8('0x29')]['includeAll']){_0x594ec6['include']=[{'all':!![]}];}_0x594ec6=_[_0xe0f8('0x39')]({},_0x594ec6,_0x2aa761[_0xe0f8('0x3a')]);return db[_0xe0f8('0x22')][_0xe0f8('0x3b')](_0x594ec6)[_0xe0f8('0x1f')](handleEntityNotFound(_0x2ec05a,null))[_0xe0f8('0x1f')](respondWithResult(_0x2ec05a,null))[_0xe0f8('0x3c')](handleError(_0x2ec05a,null));};exports['create']=function(_0x4db5ef,_0x15cdb4){return db[_0xe0f8('0x22')][_0xe0f8('0x3d')](_0x4db5ef['body'],{})[_0xe0f8('0x1f')](respondWithResult(_0x15cdb4,0xc9))[_0xe0f8('0x3c')](handleError(_0x15cdb4,null));};exports[_0xe0f8('0x1e')]=function(_0x3b88b7,_0xe9bea8){if(_0x3b88b7['body']['id']){delete _0x3b88b7['body']['id'];}return db[_0xe0f8('0x22')][_0xe0f8('0x3b')]({'where':{'id':_0x3b88b7[_0xe0f8('0x38')]['id']}})[_0xe0f8('0x1f')](handleEntityNotFound(_0xe9bea8,null))[_0xe0f8('0x1f')](saveUpdates(_0x3b88b7[_0xe0f8('0x3e')],null))['then'](respondWithResult(_0xe9bea8,null))['catch'](handleError(_0xe9bea8,null));};exports[_0xe0f8('0x3f')]=function(_0x1c9caa,_0x54307f){return db[_0xe0f8('0x22')]['find']({'where':{'id':_0x1c9caa[_0xe0f8('0x38')]['id']}})[_0xe0f8('0x1f')](handleEntityNotFound(_0x54307f,null))['then'](removeEntity(_0x54307f,null))[_0xe0f8('0x3c')](handleError(_0x54307f,null));}; \ No newline at end of file +var _0x72ec=['end','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x46a75f,_0x491882){var _0x268d0f=function(_0x5fc6af){while(--_0x5fc6af){_0x46a75f['push'](_0x46a75f['shift']());}};_0x268d0f(++_0x491882);}(_0x72ec,0xc3));var _0xc72e=function(_0x2e2720,_0x1ae995){_0x2e2720=_0x2e2720-0x0;var _0x3f9d2d=_0x72ec[_0x2e2720];return _0x3f9d2d;};'use strict';var emlformat=require(_0xc72e('0x0'));var rimraf=require(_0xc72e('0x1'));var zipdir=require(_0xc72e('0x2'));var jsonpatch=require(_0xc72e('0x3'));var rp=require(_0xc72e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc72e('0x5'));var util=require(_0xc72e('0x6'));var path=require(_0xc72e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc72e('0x8'));var fs=require('fs');var fs_extra=require(_0xc72e('0x9'));var _=require(_0xc72e('0xa'));var squel=require(_0xc72e('0xb'));var crypto=require(_0xc72e('0xc'));var jsforce=require(_0xc72e('0xd'));var deskjs=require(_0xc72e('0xe'));var toCsv=require(_0xc72e('0xf'));var querystring=require(_0xc72e('0x10'));var Papa=require(_0xc72e('0x11'));var Redis=require(_0xc72e('0x12'));var authService=require(_0xc72e('0x13'));var qs=require(_0xc72e('0x14'));var as=require(_0xc72e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc72e('0x16'))('api');var utils=require(_0xc72e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc72e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10cbc7,_0xe637f2){_0xe637f2=_0xe637f2||0xcc;return function(_0x2fb526){if(_0x2fb526){return _0x10cbc7[_0xc72e('0x19')](_0xe637f2);}return _0x10cbc7[_0xc72e('0x1a')](_0xe637f2)[_0xc72e('0x1b')]();};}function respondWithResult(_0x52ca51,_0x1406a0){_0x1406a0=_0x1406a0||0xc8;return function(_0x1a6dcc){if(_0x1a6dcc){return _0x52ca51['status'](_0x1406a0)['json'](_0x1a6dcc);}};}function respondWithFilteredResult(_0x5ed8df,_0x97062d){return function(_0x6e66b5){if(_0x6e66b5){var _0x5294ca=typeof _0x97062d['offset']===_0xc72e('0x1c')&&typeof _0x97062d['limit']===_0xc72e('0x1c');var _0x407758=_0x6e66b5['count'];var _0x1bc6c6=_0x5294ca?0x0:_0x97062d[_0xc72e('0x1d')];var _0x27df1f=_0x5294ca?_0x6e66b5[_0xc72e('0x1e')]:_0x97062d['offset']+_0x97062d[_0xc72e('0x1f')];var _0x4e64cc;if(_0x27df1f>=_0x407758){_0x27df1f=_0x407758;_0x4e64cc=0xc8;}else{_0x4e64cc=0xce;}_0x5ed8df[_0xc72e('0x1a')](_0x4e64cc);return _0x5ed8df['set'](_0xc72e('0x20'),_0x1bc6c6+'-'+_0x27df1f+'/'+_0x407758)['json'](_0x6e66b5);}return null;};}function patchUpdates(_0x2f7329){return function(_0x295a43){try{jsonpatch[_0xc72e('0x21')](_0x295a43,_0x2f7329,!![]);}catch(_0x5a4e77){return BPromise[_0xc72e('0x22')](_0x5a4e77);}return _0x295a43[_0xc72e('0x23')]();};}function saveUpdates(_0x1a900c,_0x14463f){return function(_0x4c7627){if(_0x4c7627){return _0x4c7627[_0xc72e('0x24')](_0x1a900c)[_0xc72e('0x25')](function(_0xef0027){return _0xef0027;});}return null;};}function removeEntity(_0x5060c5,_0x4290d0){return function(_0x2a8513){if(_0x2a8513){return _0x2a8513[_0xc72e('0x26')]()['then'](function(){_0x5060c5[_0xc72e('0x1a')](0xcc)[_0xc72e('0x1b')]();});}};}function handleEntityNotFound(_0x373cbb,_0xb53460){return function(_0x40d7bb){if(!_0x40d7bb){_0x373cbb['sendStatus'](0x194);}return _0x40d7bb;};}function handleError(_0x2d30cd,_0x5c1764){_0x5c1764=_0x5c1764||0x1f4;return function(_0x13ca95){logger[_0xc72e('0x27')](_0x13ca95[_0xc72e('0x28')]);if(_0x13ca95[_0xc72e('0x29')]){delete _0x13ca95[_0xc72e('0x29')];}_0x2d30cd['status'](_0x5c1764)['send'](_0x13ca95);};}exports[_0xc72e('0x2a')]=function(_0x3f70a5,_0xbaba51){var _0x4dc45d={},_0x56c97a={},_0x4ae320={'count':0x0,'rows':[]};var _0x350353=_[_0xc72e('0x2b')](db[_0xc72e('0x2c')][_0xc72e('0x2d')],function(_0x161d8a){return{'name':_0x161d8a[_0xc72e('0x2e')],'type':_0x161d8a[_0xc72e('0x2f')][_0xc72e('0x30')]};});_0x56c97a['model']=_['map'](_0x350353,'name');_0x56c97a[_0xc72e('0x31')]=_[_0xc72e('0x32')](_0x3f70a5[_0xc72e('0x31')]);_0x56c97a['filters']=_[_0xc72e('0x33')](_0x56c97a[_0xc72e('0x34')],_0x56c97a[_0xc72e('0x31')]);_0x4dc45d[_0xc72e('0x35')]=_[_0xc72e('0x33')](_0x56c97a[_0xc72e('0x34')],qs['fields'](_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x36')]));_0x4dc45d[_0xc72e('0x35')]=_0x4dc45d[_0xc72e('0x35')][_0xc72e('0x37')]?_0x4dc45d[_0xc72e('0x35')]:_0x56c97a[_0xc72e('0x34')];if(!_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x38')]('nolimit')){_0x4dc45d['limit']=qs['limit'](_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x1f')]);_0x4dc45d[_0xc72e('0x1d')]=qs[_0xc72e('0x1d')](_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x1d')]);}_0x4dc45d['order']=qs[_0xc72e('0x39')](_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x39')]);_0x4dc45d[_0xc72e('0x3a')]=qs[_0xc72e('0x3b')](_[_0xc72e('0x3c')](_0x3f70a5['query'],_0x56c97a[_0xc72e('0x3b')]),_0x350353);if(_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x3d')]){_0x4dc45d[_0xc72e('0x3a')]=_[_0xc72e('0x3e')](_0x4dc45d[_0xc72e('0x3a')],{'$or':_[_0xc72e('0x2b')](_0x350353,function(_0x5be347){if(_0x5be347[_0xc72e('0x2f')]!=='VIRTUAL'){var _0x1da176={};_0x1da176[_0x5be347[_0xc72e('0x29')]]={'$like':'%'+_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x3d')]+'%'};return _0x1da176;}})});}_0x4dc45d=_[_0xc72e('0x3e')]({},_0x4dc45d,_0x3f70a5[_0xc72e('0x3f')]);var _0x217a7a={'where':_0x4dc45d[_0xc72e('0x3a')]};return db[_0xc72e('0x2c')][_0xc72e('0x1e')](_0x217a7a)[_0xc72e('0x25')](function(_0x4f1f5c){_0x4ae320['count']=_0x4f1f5c;if(_0x3f70a5[_0xc72e('0x31')]['includeAll']){_0x4dc45d[_0xc72e('0x40')]=[{'all':!![]}];}return db[_0xc72e('0x2c')][_0xc72e('0x41')](_0x4dc45d);})[_0xc72e('0x25')](function(_0x2cbdf1){_0x4ae320[_0xc72e('0x42')]=_0x2cbdf1;return _0x4ae320;})[_0xc72e('0x25')](respondWithFilteredResult(_0xbaba51,_0x4dc45d))[_0xc72e('0x43')](handleError(_0xbaba51,null));};exports[_0xc72e('0x44')]=function(_0x129f5f,_0x200929){var _0x392661={'raw':!![],'where':{'id':_0x129f5f[_0xc72e('0x45')]['id']}},_0x4ba7b4={};_0x4ba7b4[_0xc72e('0x34')]=_['keys'](db[_0xc72e('0x2c')][_0xc72e('0x2d')]);_0x4ba7b4['query']=_[_0xc72e('0x32')](_0x129f5f[_0xc72e('0x31')]);_0x4ba7b4[_0xc72e('0x3b')]=_[_0xc72e('0x33')](_0x4ba7b4[_0xc72e('0x34')],_0x4ba7b4['query']);_0x392661[_0xc72e('0x35')]=_[_0xc72e('0x33')](_0x4ba7b4[_0xc72e('0x34')],qs['fields'](_0x129f5f[_0xc72e('0x31')][_0xc72e('0x36')]));_0x392661['attributes']=_0x392661[_0xc72e('0x35')][_0xc72e('0x37')]?_0x392661['attributes']:_0x4ba7b4[_0xc72e('0x34')];if(_0x129f5f[_0xc72e('0x31')][_0xc72e('0x46')]){_0x392661['include']=[{'all':!![]}];}_0x392661=_['merge']({},_0x392661,_0x129f5f['options']);return db[_0xc72e('0x2c')][_0xc72e('0x47')](_0x392661)['then'](handleEntityNotFound(_0x200929,null))[_0xc72e('0x25')](respondWithResult(_0x200929,null))[_0xc72e('0x43')](handleError(_0x200929,null));};exports[_0xc72e('0x48')]=function(_0x597e8b,_0x4a9a6e){return db['SquareMessage'][_0xc72e('0x48')](_0x597e8b[_0xc72e('0x49')],{})[_0xc72e('0x25')](respondWithResult(_0x4a9a6e,0xc9))[_0xc72e('0x43')](handleError(_0x4a9a6e,null));};exports[_0xc72e('0x24')]=function(_0xb7ec1,_0x3a1ac2){if(_0xb7ec1[_0xc72e('0x49')]['id']){delete _0xb7ec1[_0xc72e('0x49')]['id'];}return db['SquareMessage'][_0xc72e('0x47')]({'where':{'id':_0xb7ec1[_0xc72e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a1ac2,null))[_0xc72e('0x25')](saveUpdates(_0xb7ec1[_0xc72e('0x49')],null))[_0xc72e('0x25')](respondWithResult(_0x3a1ac2,null))['catch'](handleError(_0x3a1ac2,null));};exports['destroy']=function(_0x3e5f60,_0x490e60){return db['SquareMessage']['find']({'where':{'id':_0x3e5f60[_0xc72e('0x45')]['id']}})[_0xc72e('0x25')](handleEntityNotFound(_0x490e60,null))[_0xc72e('0x25')](removeEntity(_0x490e60,null))['catch'](handleError(_0x490e60,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index afb44ed..d4ead4a 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 _0x6dcd=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x276465,_0x43ebbb){var _0x47a772=function(_0x123a48){while(--_0x123a48){_0x276465['push'](_0x276465['shift']());}};_0x47a772(++_0x43ebbb);}(_0x6dcd,0xa2));var _0xd6dc=function(_0x1240f3,_0x5b66b5){_0x1240f3=_0x1240f3-0x0;var _0x4166a2=_0x6dcd[_0x1240f3];return _0x4166a2;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var logger=require('../../config/logger')(_0xd6dc('0x1'));var moment=require(_0xd6dc('0x2'));var BPromise=require(_0xd6dc('0x3'));var rp=require(_0xd6dc('0x4'));var fs=require('fs');var path=require(_0xd6dc('0x5'));var rimraf=require(_0xd6dc('0x6'));var config=require(_0xd6dc('0x7'));var attributes=require(_0xd6dc('0x8'));module[_0xd6dc('0x9')]=function(_0x18277f,_0x311f22){return _0x18277f[_0xd6dc('0xa')](_0xd6dc('0xb'),attributes,{'tableName':_0xd6dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8744=['SquareMessage','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x4c25df,_0x22ddfb){var _0xface=function(_0x213f5e){while(--_0x213f5e){_0x4c25df['push'](_0x4c25df['shift']());}};_0xface(++_0x22ddfb);}(_0x8744,0x79));var _0x4874=function(_0x3501f1,_0x403c9c){_0x3501f1=_0x3501f1-0x0;var _0x21c1ab=_0x8744[_0x3501f1];return _0x21c1ab;};'use strict';var _=require(_0x4874('0x0'));var util=require(_0x4874('0x1'));var logger=require(_0x4874('0x2'))('api');var moment=require(_0x4874('0x3'));var BPromise=require(_0x4874('0x4'));var rp=require(_0x4874('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4874('0x6'));var config=require(_0x4874('0x7'));var attributes=require(_0x4874('0x8'));module[_0x4874('0x9')]=function(_0x1c26cb,_0x5a6306){return _0x1c26cb[_0x4874('0xa')](_0x4874('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 0afde8a..ca643e3 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 _0xdc22=['jayson/promise','http','request','then','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','create','body','options','raw','info','CreateSquareMessage','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x3c94bc,_0x2ebad1){var _0x4f0ef3=function(_0x38fb16){while(--_0x38fb16){_0x3c94bc['push'](_0x3c94bc['shift']());}};_0x4f0ef3(++_0x2ebad1);}(_0xdc22,0x199));var _0x2dc2=function(_0x47c038,_0x1f7096){_0x47c038=_0x47c038-0x0;var _0x1e0f88=_0xdc22[_0x47c038];return _0x1e0f88;};'use strict';var _=require(_0x2dc2('0x0'));var util=require(_0x2dc2('0x1'));var moment=require(_0x2dc2('0x2'));var BPromise=require('bluebird');var rs=require(_0x2dc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2dc2('0x4'))(_0x2dc2('0x5'));var config=require(_0x2dc2('0x6'));var jayson=require(_0x2dc2('0x7'));var client=jayson['client'][_0x2dc2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa21545,_0x2478e6,_0x5d6900){return new BPromise(function(_0xc56b54,_0x9f127e){return client[_0x2dc2('0x9')](_0xa21545,_0x5d6900)[_0x2dc2('0xa')](function(_0x10341d){logger['info']('SquareMessage,\x20%s,\x20%s',_0x2478e6,_0x2dc2('0xb'));logger[_0x2dc2('0xc')](_0x2dc2('0xd'),_0x2478e6,_0x2dc2('0xb'),JSON[_0x2dc2('0xe')](_0x10341d));if(_0x10341d[_0x2dc2('0xf')]){if(_0x10341d['error'][_0x2dc2('0x10')]===0x1f4){logger[_0x2dc2('0xf')](_0x2dc2('0x11'),_0x2478e6,_0x10341d[_0x2dc2('0xf')][_0x2dc2('0x12')]);return _0x9f127e(_0x10341d[_0x2dc2('0xf')][_0x2dc2('0x12')]);}logger[_0x2dc2('0xf')](_0x2dc2('0x11'),_0x2478e6,_0x10341d[_0x2dc2('0xf')]['message']);return _0xc56b54(_0x10341d[_0x2dc2('0xf')][_0x2dc2('0x12')]);}else{logger['info'](_0x2dc2('0x11'),_0x2478e6,'request\x20sent');_0xc56b54(_0x10341d['result']['message']);}})[_0x2dc2('0x13')](function(_0x572b88){logger[_0x2dc2('0xf')]('SquareMessage,\x20%s,\x20%s',_0x2478e6,_0x572b88);_0x9f127e(_0x572b88);});});}exports['CreateSquareMessage']=function(_0x402f3f){var _0x328d73=this;return new Promise(function(_0x211862,_0x234d1c){return db['SquareMessage'][_0x2dc2('0x14')](_0x402f3f[_0x2dc2('0x15')],{'raw':_0x402f3f[_0x2dc2('0x16')]?_0x402f3f['options'][_0x2dc2('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4c0499){logger[_0x2dc2('0x18')](_0x2dc2('0x19'),_0x402f3f);logger['debug'](_0x2dc2('0x19'),_0x402f3f,JSON[_0x2dc2('0xe')](_0x4c0499));_0x211862(_0x4c0499);})[_0x2dc2('0x13')](function(_0x161e54){logger[_0x2dc2('0xf')](_0x2dc2('0x19'),_0x161e54['message'],_0x402f3f);_0x234d1c(_0x328d73[_0x2dc2('0xf')](0x1f4,_0x161e54[_0x2dc2('0x12')]));});});}; \ No newline at end of file +var _0x2210=['../../config/utils','../../config/environment','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','create','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x37dcf8,_0x50437b){var _0x1d121c=function(_0x5bf87f){while(--_0x5bf87f){_0x37dcf8['push'](_0x37dcf8['shift']());}};_0x1d121c(++_0x50437b);}(_0x2210,0x1cf));var _0x0221=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2210[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0221('0x0'));var moment=require(_0x0221('0x1'));var BPromise=require(_0x0221('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0221('0x3'));var db=require(_0x0221('0x4'))['db'];var utils=require(_0x0221('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0221('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0221('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38f3c3,_0x43e4aa,_0x1bd88b){return new BPromise(function(_0x140efc,_0x21cf3f){return client[_0x0221('0x8')](_0x38f3c3,_0x1bd88b)[_0x0221('0x9')](function(_0x295a10){logger['info'](_0x0221('0xa'),_0x43e4aa,_0x0221('0xb'));logger[_0x0221('0xc')](_0x0221('0xd'),_0x43e4aa,'request\x20sent',JSON[_0x0221('0xe')](_0x295a10));if(_0x295a10[_0x0221('0xf')]){if(_0x295a10[_0x0221('0xf')][_0x0221('0x10')]===0x1f4){logger[_0x0221('0xf')](_0x0221('0xa'),_0x43e4aa,_0x295a10[_0x0221('0xf')][_0x0221('0x11')]);return _0x21cf3f(_0x295a10[_0x0221('0xf')]['message']);}logger[_0x0221('0xf')](_0x0221('0xa'),_0x43e4aa,_0x295a10[_0x0221('0xf')][_0x0221('0x11')]);return _0x140efc(_0x295a10[_0x0221('0xf')][_0x0221('0x11')]);}else{logger[_0x0221('0x12')](_0x0221('0xa'),_0x43e4aa,_0x0221('0xb'));_0x140efc(_0x295a10[_0x0221('0x13')][_0x0221('0x11')]);}})[_0x0221('0x14')](function(_0x59ce64){logger['error'](_0x0221('0xa'),_0x43e4aa,_0x59ce64);_0x21cf3f(_0x59ce64);});});}exports[_0x0221('0x15')]=function(_0x3c1c1a){var _0x22e915=this;return new Promise(function(_0x34f55b,_0x58a26b){return db['SquareMessage'][_0x0221('0x16')](_0x3c1c1a[_0x0221('0x17')],{'raw':_0x3c1c1a['options']?_0x3c1c1a[_0x0221('0x18')][_0x0221('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3af285){logger[_0x0221('0x12')]('CreateSquareMessage',_0x3c1c1a);logger['debug'](_0x0221('0x15'),_0x3c1c1a,JSON[_0x0221('0xe')](_0x3af285));_0x34f55b(_0x3af285);})[_0x0221('0x14')](function(_0x35fb54){logger[_0x0221('0xf')]('CreateSquareMessage',_0x35fb54[_0x0221('0x11')],_0x3c1c1a);_0x58a26b(_0x22e915[_0x0221('0xf')](0x1f4,_0x35fb54[_0x0221('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 82b428a..f012a5f 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 _0xf0b7=['update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/test','15s','test','create'];(function(_0x1a6475,_0x31fd7e){var _0x4fabc4=function(_0x130766){while(--_0x130766){_0x1a6475['push'](_0x1a6475['shift']());}};_0x4fabc4(++_0x31fd7e);}(_0xf0b7,0x192));var _0x7f0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0b7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x7f0b('0x0'));var path=require(_0x7f0b('0x1'));var timeout=require(_0x7f0b('0x2'));var express=require(_0x7f0b('0x3'));var router=express['Router']();var fs_extra=require(_0x7f0b('0x4'));var auth=require(_0x7f0b('0x5'));var interaction=require(_0x7f0b('0x6'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x7f0b('0x7')]('/',auth['isAuthenticated'](),controller[_0x7f0b('0x8')]);router[_0x7f0b('0x7')](_0x7f0b('0x9'),auth[_0x7f0b('0xa')](),controller[_0x7f0b('0xb')]);router['get'](_0x7f0b('0xc'),auth[_0x7f0b('0xa')](),timeout(_0x7f0b('0xd')),controller[_0x7f0b('0xe')]);router['post']('/',auth[_0x7f0b('0xa')](),controller[_0x7f0b('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7f0b('0x10')]);router[_0x7f0b('0x11')]('/:id',auth[_0x7f0b('0xa')](),controller[_0x7f0b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2fc6=['/:id','show','/:id/test','test','post','create','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x56260c,_0x3594bc){var _0x3293b9=function(_0x3e1744){while(--_0x3e1744){_0x56260c['push'](_0x56260c['shift']());}};_0x3293b9(++_0x3594bc);}(_0x2fc6,0x121));var _0x62fc=function(_0x54d617,_0x5190a9){_0x54d617=_0x54d617-0x0;var _0x1d3ef3=_0x2fc6[_0x54d617];return _0x1d3ef3;};'use strict';var multer=require(_0x62fc('0x0'));var util=require(_0x62fc('0x1'));var path=require(_0x62fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x62fc('0x3'));var router=express['Router']();var fs_extra=require(_0x62fc('0x4'));var auth=require(_0x62fc('0x5'));var interaction=require(_0x62fc('0x6'));var config=require('../../config/environment');var controller=require(_0x62fc('0x7'));router[_0x62fc('0x8')]('/',auth[_0x62fc('0x9')](),controller[_0x62fc('0xa')]);router['get'](_0x62fc('0xb'),auth['isAuthenticated'](),controller[_0x62fc('0xc')]);router[_0x62fc('0x8')](_0x62fc('0xd'),auth[_0x62fc('0x9')](),timeout('15s'),controller[_0x62fc('0xe')]);router[_0x62fc('0xf')]('/',auth[_0x62fc('0x9')](),controller[_0x62fc('0x10')]);router['put'](_0x62fc('0xb'),auth[_0x62fc('0x9')](),controller[_0x62fc('0x11')]);router[_0x62fc('0x12')](_0x62fc('0xb'),auth[_0x62fc('0x9')](),controller['destroy']);module[_0x62fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d1568dd..06dd570 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 _0x601d=['name','sequelize','exports','STRING'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0x601d,0xe1));var _0xd601=function(_0x17ad4d,_0xc5b92){_0x17ad4d=_0x17ad4d-0x0;var _0x361d3c=_0x601d[_0x17ad4d];return _0x361d3c;};'use strict';var Sequelize=require(_0xd601('0x0'));module[_0xd601('0x1')]={'name':{'type':Sequelize[_0xd601('0x2')],'unique':_0xd601('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd601('0x2')]},'description':{'type':Sequelize[_0xd601('0x2')]}}; \ No newline at end of file +var _0x3fc5=['exports','name','STRING','sequelize'];(function(_0x1ed82a,_0x275bfd){var _0x4effc8=function(_0x52c94b){while(--_0x52c94b){_0x1ed82a['push'](_0x1ed82a['shift']());}};_0x4effc8(++_0x275bfd);}(_0x3fc5,0xb7));var _0x53fc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3fc5[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x53fc('0x0'));module[_0x53fc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x53fc('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x53fc('0x3')]},'description':{'type':Sequelize[_0x53fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5323aea..6fc7d85 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 _0x3fcc=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x3fcc,0x1da));var _0xc3fc=function(_0x19ccae,_0x5aebc6){_0x19ccae=_0x19ccae-0x0;var _0x7ea497=_0x3fcc[_0x19ccae];return _0x7ea497;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3fc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3fc('0x1'));var moment=require('moment');var BPromise=require(_0xc3fc('0x2'));var Mustache=require(_0xc3fc('0x3'));var util=require(_0xc3fc('0x4'));var path=require(_0xc3fc('0x5'));var sox=require(_0xc3fc('0x6'));var csv=require('to-csv');var ejs=require(_0xc3fc('0x7'));var fs=require('fs');var fs_extra=require(_0xc3fc('0x8'));var _=require(_0xc3fc('0x9'));var squel=require('squel');var crypto=require(_0xc3fc('0xa'));var jsforce=require(_0xc3fc('0xb'));var deskjs=require(_0xc3fc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc3fc('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3fc('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3fc('0xf'));var logger=require(_0xc3fc('0x10'))(_0xc3fc('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d43a3,_0x4ad6be){_0x4ad6be=_0x4ad6be||0xcc;return function(_0x195aa1){if(_0x195aa1){return _0x1d43a3[_0xc3fc('0x12')](_0x4ad6be);}return _0x1d43a3[_0xc3fc('0x13')](_0x4ad6be)[_0xc3fc('0x14')]();};}function respondWithResult(_0x504dde,_0xee74dc){_0xee74dc=_0xee74dc||0xc8;return function(_0xe6c605){if(_0xe6c605){return _0x504dde['status'](_0xee74dc)[_0xc3fc('0x15')](_0xe6c605);}};}function respondWithFilteredResult(_0x1e759f,_0xe6803f){return function(_0x5979ca){if(_0x5979ca){var _0x1aca20=typeof _0xe6803f[_0xc3fc('0x16')]===_0xc3fc('0x17')&&typeof _0xe6803f[_0xc3fc('0x18')]===_0xc3fc('0x17');var _0x59968f=_0x5979ca[_0xc3fc('0x19')];var _0x216956=_0x1aca20?0x0:_0xe6803f[_0xc3fc('0x16')];var _0xe78ab1=_0x1aca20?_0x5979ca[_0xc3fc('0x19')]:_0xe6803f[_0xc3fc('0x16')]+_0xe6803f[_0xc3fc('0x18')];var _0x5d3324;if(_0xe78ab1>=_0x59968f){_0xe78ab1=_0x59968f;_0x5d3324=0xc8;}else{_0x5d3324=0xce;}_0x1e759f['status'](_0x5d3324);return _0x1e759f[_0xc3fc('0x1a')](_0xc3fc('0x1b'),_0x216956+'-'+_0xe78ab1+'/'+_0x59968f)['json'](_0x5979ca);}return null;};}function patchUpdates(_0x26a7bc){return function(_0x2c5109){try{jsonpatch[_0xc3fc('0x1c')](_0x2c5109,_0x26a7bc,!![]);}catch(_0x2adddb){return BPromise[_0xc3fc('0x1d')](_0x2adddb);}return _0x2c5109['save']();};}function saveUpdates(_0x354931,_0x2d62af){return function(_0x58f0ba){if(_0x58f0ba){return _0x58f0ba[_0xc3fc('0x1e')](_0x354931)[_0xc3fc('0x1f')](function(_0x292aaa){return _0x292aaa;});}return null;};}function removeEntity(_0x3fcf73,_0x5c0f3a){return function(_0x2e3d76){if(_0x2e3d76){return _0x2e3d76[_0xc3fc('0x20')]()[_0xc3fc('0x1f')](function(){var _0x54ff70=_0x2e3d76[_0xc3fc('0x21')]({'plain':!![]});var _0x2439e3=_0xc3fc('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x2439e3,'resourceId':_0x54ff70['id']}})[_0xc3fc('0x1f')](function(){return _0x2e3d76;});})[_0xc3fc('0x1f')](function(){_0x3fcf73['status'](0xcc)[_0xc3fc('0x14')]();});}};}function handleEntityNotFound(_0x21d994,_0x2db699){return function(_0x5841b9){if(!_0x5841b9){_0x21d994[_0xc3fc('0x12')](0x194);}return _0x5841b9;};}function handleError(_0x3dec9f,_0xb7b544){_0xb7b544=_0xb7b544||0x1f4;return function(_0x2ad455){logger['error'](_0x2ad455[_0xc3fc('0x23')]);if(_0x2ad455[_0xc3fc('0x24')]){delete _0x2ad455['name'];}_0x3dec9f[_0xc3fc('0x13')](_0xb7b544)[_0xc3fc('0x25')](_0x2ad455);};}exports['index']=function(_0x347b8a,_0x43b5fa){var _0x32ec4d={},_0x57bcb6={},_0x587e4b={'count':0x0,'rows':[]};var _0x5c329a=_[_0xc3fc('0x26')](db[_0xc3fc('0x27')][_0xc3fc('0x28')],function(_0x5e4ec2){return{'name':_0x5e4ec2[_0xc3fc('0x29')],'type':_0x5e4ec2[_0xc3fc('0x2a')]['key']};});_0x57bcb6[_0xc3fc('0x2b')]=_['map'](_0x5c329a,_0xc3fc('0x24'));_0x57bcb6[_0xc3fc('0x2c')]=_['keys'](_0x347b8a['query']);_0x57bcb6[_0xc3fc('0x2d')]=_[_0xc3fc('0x2e')](_0x57bcb6[_0xc3fc('0x2b')],_0x57bcb6[_0xc3fc('0x2c')]);_0x32ec4d[_0xc3fc('0x2f')]=_[_0xc3fc('0x2e')](_0x57bcb6['model'],qs['fields'](_0x347b8a['query'][_0xc3fc('0x30')]));_0x32ec4d['attributes']=_0x32ec4d[_0xc3fc('0x2f')]['length']?_0x32ec4d['attributes']:_0x57bcb6[_0xc3fc('0x2b')];if(!_0x347b8a['query'][_0xc3fc('0x31')](_0xc3fc('0x32'))){_0x32ec4d[_0xc3fc('0x18')]=qs[_0xc3fc('0x18')](_0x347b8a[_0xc3fc('0x2c')][_0xc3fc('0x18')]);_0x32ec4d[_0xc3fc('0x16')]=qs['offset'](_0x347b8a[_0xc3fc('0x2c')][_0xc3fc('0x16')]);}_0x32ec4d['order']=qs['sort'](_0x347b8a['query'][_0xc3fc('0x33')]);_0x32ec4d[_0xc3fc('0x34')]=qs[_0xc3fc('0x2d')](_[_0xc3fc('0x35')](_0x347b8a['query'],_0x57bcb6[_0xc3fc('0x2d')]),_0x5c329a);if(_0x347b8a[_0xc3fc('0x2c')][_0xc3fc('0x36')]){_0x32ec4d[_0xc3fc('0x34')]=_[_0xc3fc('0x37')](_0x32ec4d[_0xc3fc('0x34')],{'$or':_[_0xc3fc('0x26')](_0x5c329a,function(_0x511e6d){if(_0x511e6d[_0xc3fc('0x2a')]!==_0xc3fc('0x38')){var _0x51fc97={};_0x51fc97[_0x511e6d['name']]={'$like':'%'+_0x347b8a[_0xc3fc('0x2c')][_0xc3fc('0x36')]+'%'};return _0x51fc97;}})});}_0x32ec4d=_[_0xc3fc('0x37')]({},_0x32ec4d,_0x347b8a['options']);var _0x56a029={'where':_0x32ec4d[_0xc3fc('0x34')]};return db[_0xc3fc('0x27')][_0xc3fc('0x19')](_0x56a029)['then'](function(_0x522e96){_0x587e4b[_0xc3fc('0x19')]=_0x522e96;if(_0x347b8a['query'][_0xc3fc('0x39')]){_0x32ec4d[_0xc3fc('0x3a')]=[{'all':!![]}];}return db[_0xc3fc('0x27')]['findAll'](_0x32ec4d);})['then'](function(_0x2ddf21){_0x587e4b[_0xc3fc('0x3b')]=_0x2ddf21;return _0x587e4b;})[_0xc3fc('0x1f')](respondWithFilteredResult(_0x43b5fa,_0x32ec4d))[_0xc3fc('0x3c')](handleError(_0x43b5fa,null));};exports[_0xc3fc('0x3d')]=function(_0x5d4ffc,_0x10607c){var _0x3b018b={'raw':!![],'where':{'id':_0x5d4ffc[_0xc3fc('0x3e')]['id']}},_0x4fd09c={};_0x4fd09c[_0xc3fc('0x2b')]=_[_0xc3fc('0x3f')](db['SquareOdbc'][_0xc3fc('0x28')]);_0x4fd09c[_0xc3fc('0x2c')]=_[_0xc3fc('0x3f')](_0x5d4ffc[_0xc3fc('0x2c')]);_0x4fd09c[_0xc3fc('0x2d')]=_[_0xc3fc('0x2e')](_0x4fd09c['model'],_0x4fd09c[_0xc3fc('0x2c')]);_0x3b018b[_0xc3fc('0x2f')]=_[_0xc3fc('0x2e')](_0x4fd09c['model'],qs[_0xc3fc('0x30')](_0x5d4ffc[_0xc3fc('0x2c')][_0xc3fc('0x30')]));_0x3b018b['attributes']=_0x3b018b[_0xc3fc('0x2f')][_0xc3fc('0x40')]?_0x3b018b[_0xc3fc('0x2f')]:_0x4fd09c[_0xc3fc('0x2b')];if(_0x5d4ffc[_0xc3fc('0x2c')][_0xc3fc('0x39')]){_0x3b018b[_0xc3fc('0x3a')]=[{'all':!![]}];}_0x3b018b=_[_0xc3fc('0x37')]({},_0x3b018b,_0x5d4ffc[_0xc3fc('0x41')]);return db[_0xc3fc('0x27')][_0xc3fc('0x42')](_0x3b018b)[_0xc3fc('0x1f')](handleEntityNotFound(_0x10607c,null))[_0xc3fc('0x1f')](respondWithResult(_0x10607c,null))[_0xc3fc('0x3c')](handleError(_0x10607c,null));};exports[_0xc3fc('0x43')]=function(_0x213cd6,_0x4deff1){return db['SquareOdbc'][_0xc3fc('0x43')](_0x213cd6[_0xc3fc('0x44')],{})[_0xc3fc('0x1f')](function(_0x4fa608){var _0x529f60=_0x213cd6['user'][_0xc3fc('0x21')]({'plain':!![]});if(!_0x529f60)throw new Error(_0xc3fc('0x45'));if(_0x529f60['role']===_0xc3fc('0x46')){var _0x218681=_0x4fa608[_0xc3fc('0x21')]({'plain':!![]});var _0x5c2eb4=_0xc3fc('0x22');return db['UserProfileSection'][_0xc3fc('0x42')]({'where':{'name':_0x5c2eb4,'userProfileId':_0x529f60['userProfileId']},'raw':!![]})[_0xc3fc('0x1f')](function(_0xa3089b){if(_0xa3089b&&_0xa3089b[_0xc3fc('0x47')]===0x0){return db['UserProfileResource'][_0xc3fc('0x43')]({'name':_0x218681[_0xc3fc('0x24')],'resourceId':_0x218681['id'],'type':_0xa3089b[_0xc3fc('0x24')],'sectionId':_0xa3089b['id']},{})[_0xc3fc('0x1f')](function(){return _0x4fa608;});}else{return _0x4fa608;}})[_0xc3fc('0x3c')](function(_0x377398){logger[_0xc3fc('0x48')](_0xc3fc('0x49'),_0x377398);throw _0x377398;});}return _0x4fa608;})[_0xc3fc('0x1f')](respondWithResult(_0x4deff1,0xc9))[_0xc3fc('0x3c')](handleError(_0x4deff1,null));};exports[_0xc3fc('0x1e')]=function(_0x3eafd5,_0x43cd22){if(_0x3eafd5[_0xc3fc('0x44')]['id']){delete _0x3eafd5['body']['id'];}return db[_0xc3fc('0x27')][_0xc3fc('0x42')]({'where':{'id':_0x3eafd5[_0xc3fc('0x3e')]['id']}})[_0xc3fc('0x1f')](handleEntityNotFound(_0x43cd22,null))[_0xc3fc('0x1f')](saveUpdates(_0x3eafd5['body'],null))[_0xc3fc('0x1f')](respondWithResult(_0x43cd22,null))[_0xc3fc('0x3c')](handleError(_0x43cd22,null));};exports['destroy']=function(_0x1d8955,_0x5a7645){return db[_0xc3fc('0x27')][_0xc3fc('0x42')]({'where':{'id':_0x1d8955[_0xc3fc('0x3e')]['id']}})[_0xc3fc('0x1f')](handleEntityNotFound(_0x5a7645,null))[_0xc3fc('0x1f')](removeEntity(_0x5a7645,null))[_0xc3fc('0x3c')](handleError(_0x5a7645,null));};exports[_0xc3fc('0x4a')]=function(_0x24ff1c,_0xb4f1bd,_0x5965fa){var _0xc6a999;return db[_0xc3fc('0x27')]['find']({'where':{'id':_0x24ff1c[_0xc3fc('0x3e')]['id']},'attributes':['id',_0xc3fc('0x4b')]})[_0xc3fc('0x1f')](handleEntityNotFound(_0xb4f1bd,null))['then'](function(_0x26d5bf){if(_0x26d5bf){var _0x496072=require('odbc')();_0x496072[_0xc3fc('0x4c')](_0x26d5bf[_0xc3fc('0x4b')]);_0x496072[_0xc3fc('0x4d')]();return _0x26d5bf;}})['then'](respondWithResult(_0xb4f1bd,null))[_0xc3fc('0x3c')](handleError(_0xb4f1bd,null));}; \ No newline at end of file +var _0xace8=['merge','includeAll','include','findAll','catch','keys','options','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where'];(function(_0x4e9959,_0x3db753){var _0xed0734=function(_0x20318e){while(--_0x20318e){_0x4e9959['push'](_0x4e9959['shift']());}};_0xed0734(++_0x3db753);}(_0xace8,0x6b));var _0x8ace=function(_0xef9edb,_0x406d7b){_0xef9edb=_0xef9edb-0x0;var _0x3583e3=_0xace8[_0xef9edb];return _0x3583e3;};'use strict';var emlformat=require(_0x8ace('0x0'));var rimraf=require(_0x8ace('0x1'));var zipdir=require(_0x8ace('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ace('0x3'));var moment=require(_0x8ace('0x4'));var BPromise=require(_0x8ace('0x5'));var Mustache=require(_0x8ace('0x6'));var util=require(_0x8ace('0x7'));var path=require(_0x8ace('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ace('0x9'));var fs=require('fs');var fs_extra=require(_0x8ace('0xa'));var _=require('lodash');var squel=require(_0x8ace('0xb'));var crypto=require(_0x8ace('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8ace('0xd'));var toCsv=require(_0x8ace('0xe'));var querystring=require(_0x8ace('0xf'));var Papa=require('papaparse');var Redis=require(_0x8ace('0x10'));var authService=require(_0x8ace('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8ace('0x12'));var hardwareService=require(_0x8ace('0x13'));var logger=require(_0x8ace('0x14'))(_0x8ace('0x15'));var utils=require(_0x8ace('0x16'));var config=require(_0x8ace('0x17'));var licenseUtil=require(_0x8ace('0x18'));var db=require(_0x8ace('0x19'))['db'];function respondWithStatusCode(_0x6a1565,_0x220bfe){_0x220bfe=_0x220bfe||0xcc;return function(_0x2ef4a5){if(_0x2ef4a5){return _0x6a1565[_0x8ace('0x1a')](_0x220bfe);}return _0x6a1565[_0x8ace('0x1b')](_0x220bfe)[_0x8ace('0x1c')]();};}function respondWithResult(_0x22d165,_0x2871cf){_0x2871cf=_0x2871cf||0xc8;return function(_0x5bec17){if(_0x5bec17){return _0x22d165[_0x8ace('0x1b')](_0x2871cf)[_0x8ace('0x1d')](_0x5bec17);}};}function respondWithFilteredResult(_0x2b2a65,_0x428480){return function(_0x52acfe){if(_0x52acfe){var _0x2fc9c3=typeof _0x428480[_0x8ace('0x1e')]===_0x8ace('0x1f')&&typeof _0x428480[_0x8ace('0x20')]===_0x8ace('0x1f');var _0x203c23=_0x52acfe[_0x8ace('0x21')];var _0x6718e4=_0x2fc9c3?0x0:_0x428480[_0x8ace('0x1e')];var _0x234d90=_0x2fc9c3?_0x52acfe[_0x8ace('0x21')]:_0x428480[_0x8ace('0x1e')]+_0x428480['limit'];var _0x1e0325;if(_0x234d90>=_0x203c23){_0x234d90=_0x203c23;_0x1e0325=0xc8;}else{_0x1e0325=0xce;}_0x2b2a65[_0x8ace('0x1b')](_0x1e0325);return _0x2b2a65[_0x8ace('0x22')](_0x8ace('0x23'),_0x6718e4+'-'+_0x234d90+'/'+_0x203c23)[_0x8ace('0x1d')](_0x52acfe);}return null;};}function patchUpdates(_0x1d3441){return function(_0x43ab3a){try{jsonpatch[_0x8ace('0x24')](_0x43ab3a,_0x1d3441,!![]);}catch(_0x11978a){return BPromise[_0x8ace('0x25')](_0x11978a);}return _0x43ab3a['save']();};}function saveUpdates(_0x4e18b0,_0x429fe1){return function(_0x4297e6){if(_0x4297e6){return _0x4297e6[_0x8ace('0x26')](_0x4e18b0)[_0x8ace('0x27')](function(_0x1d4bbb){return _0x1d4bbb;});}return null;};}function removeEntity(_0x11f77a,_0x3f8591){return function(_0x587050){if(_0x587050){return _0x587050[_0x8ace('0x28')]()[_0x8ace('0x27')](function(){var _0x181c06=_0x587050[_0x8ace('0x29')]({'plain':!![]});var _0x31b8d1=_0x8ace('0x2a');return db[_0x8ace('0x2b')][_0x8ace('0x28')]({'where':{'type':_0x31b8d1,'resourceId':_0x181c06['id']}})[_0x8ace('0x27')](function(){return _0x587050;});})[_0x8ace('0x27')](function(){_0x11f77a[_0x8ace('0x1b')](0xcc)[_0x8ace('0x1c')]();});}};}function handleEntityNotFound(_0x10048c,_0x29e539){return function(_0x426187){if(!_0x426187){_0x10048c[_0x8ace('0x1a')](0x194);}return _0x426187;};}function handleError(_0x496547,_0x2781fe){_0x2781fe=_0x2781fe||0x1f4;return function(_0x5ddc2a){logger[_0x8ace('0x2c')](_0x5ddc2a[_0x8ace('0x2d')]);if(_0x5ddc2a[_0x8ace('0x2e')]){delete _0x5ddc2a['name'];}_0x496547[_0x8ace('0x1b')](_0x2781fe)[_0x8ace('0x2f')](_0x5ddc2a);};}exports['index']=function(_0xd5bb6a,_0x4b033a){var _0x198513={},_0x23ada7={},_0x56fdf1={'count':0x0,'rows':[]};var _0x419906=_['map'](db[_0x8ace('0x30')][_0x8ace('0x31')],function(_0x3e673c){return{'name':_0x3e673c[_0x8ace('0x32')],'type':_0x3e673c[_0x8ace('0x33')]['key']};});_0x23ada7[_0x8ace('0x34')]=_[_0x8ace('0x35')](_0x419906,_0x8ace('0x2e'));_0x23ada7[_0x8ace('0x36')]=_['keys'](_0xd5bb6a[_0x8ace('0x36')]);_0x23ada7[_0x8ace('0x37')]=_[_0x8ace('0x38')](_0x23ada7['model'],_0x23ada7['query']);_0x198513['attributes']=_['intersection'](_0x23ada7[_0x8ace('0x34')],qs[_0x8ace('0x39')](_0xd5bb6a['query']['fields']));_0x198513['attributes']=_0x198513[_0x8ace('0x3a')][_0x8ace('0x3b')]?_0x198513['attributes']:_0x23ada7[_0x8ace('0x34')];if(!_0xd5bb6a[_0x8ace('0x36')][_0x8ace('0x3c')]('nolimit')){_0x198513[_0x8ace('0x20')]=qs[_0x8ace('0x20')](_0xd5bb6a[_0x8ace('0x36')]['limit']);_0x198513['offset']=qs[_0x8ace('0x1e')](_0xd5bb6a[_0x8ace('0x36')]['offset']);}_0x198513['order']=qs['sort'](_0xd5bb6a['query'][_0x8ace('0x3d')]);_0x198513['where']=qs[_0x8ace('0x37')](_[_0x8ace('0x3e')](_0xd5bb6a[_0x8ace('0x36')],_0x23ada7[_0x8ace('0x37')]),_0x419906);if(_0xd5bb6a['query'][_0x8ace('0x3f')]){_0x198513[_0x8ace('0x40')]=_['merge'](_0x198513[_0x8ace('0x40')],{'$or':_['map'](_0x419906,function(_0x55a31f){if(_0x55a31f['type']!=='VIRTUAL'){var _0x11b401={};_0x11b401[_0x55a31f[_0x8ace('0x2e')]]={'$like':'%'+_0xd5bb6a[_0x8ace('0x36')][_0x8ace('0x3f')]+'%'};return _0x11b401;}})});}_0x198513=_[_0x8ace('0x41')]({},_0x198513,_0xd5bb6a['options']);var _0x11efc2={'where':_0x198513[_0x8ace('0x40')]};return db[_0x8ace('0x30')]['count'](_0x11efc2)[_0x8ace('0x27')](function(_0x5b8e4f){_0x56fdf1[_0x8ace('0x21')]=_0x5b8e4f;if(_0xd5bb6a[_0x8ace('0x36')][_0x8ace('0x42')]){_0x198513[_0x8ace('0x43')]=[{'all':!![]}];}return db[_0x8ace('0x30')][_0x8ace('0x44')](_0x198513);})['then'](function(_0x11536d){_0x56fdf1['rows']=_0x11536d;return _0x56fdf1;})[_0x8ace('0x27')](respondWithFilteredResult(_0x4b033a,_0x198513))[_0x8ace('0x45')](handleError(_0x4b033a,null));};exports['show']=function(_0x34e51a,_0x1f2940){var _0x50cc23={'raw':!![],'where':{'id':_0x34e51a['params']['id']}},_0x344986={};_0x344986['model']=_[_0x8ace('0x46')](db['SquareOdbc']['rawAttributes']);_0x344986['query']=_[_0x8ace('0x46')](_0x34e51a[_0x8ace('0x36')]);_0x344986[_0x8ace('0x37')]=_[_0x8ace('0x38')](_0x344986[_0x8ace('0x34')],_0x344986['query']);_0x50cc23[_0x8ace('0x3a')]=_['intersection'](_0x344986[_0x8ace('0x34')],qs['fields'](_0x34e51a[_0x8ace('0x36')][_0x8ace('0x39')]));_0x50cc23[_0x8ace('0x3a')]=_0x50cc23[_0x8ace('0x3a')][_0x8ace('0x3b')]?_0x50cc23[_0x8ace('0x3a')]:_0x344986[_0x8ace('0x34')];if(_0x34e51a[_0x8ace('0x36')][_0x8ace('0x42')]){_0x50cc23[_0x8ace('0x43')]=[{'all':!![]}];}_0x50cc23=_['merge']({},_0x50cc23,_0x34e51a[_0x8ace('0x47')]);return db[_0x8ace('0x30')]['find'](_0x50cc23)['then'](handleEntityNotFound(_0x1f2940,null))[_0x8ace('0x27')](respondWithResult(_0x1f2940,null))['catch'](handleError(_0x1f2940,null));};exports[_0x8ace('0x48')]=function(_0x2ade44,_0x414b3e){return db['SquareOdbc']['create'](_0x2ade44[_0x8ace('0x49')],{})[_0x8ace('0x27')](function(_0x50e0d1){var _0x44da48=_0x2ade44[_0x8ace('0x4a')][_0x8ace('0x29')]({'plain':!![]});if(!_0x44da48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44da48[_0x8ace('0x4b')]===_0x8ace('0x4a')){var _0x339061=_0x50e0d1[_0x8ace('0x29')]({'plain':!![]});var _0x972c50=_0x8ace('0x2a');return db[_0x8ace('0x4c')]['find']({'where':{'name':_0x972c50,'userProfileId':_0x44da48[_0x8ace('0x4d')]},'raw':!![]})[_0x8ace('0x27')](function(_0x319658){if(_0x319658&&_0x319658[_0x8ace('0x4e')]===0x0){return db[_0x8ace('0x2b')][_0x8ace('0x48')]({'name':_0x339061[_0x8ace('0x2e')],'resourceId':_0x339061['id'],'type':_0x319658[_0x8ace('0x2e')],'sectionId':_0x319658['id']},{})[_0x8ace('0x27')](function(){return _0x50e0d1;});}else{return _0x50e0d1;}})[_0x8ace('0x45')](function(_0x1e038c){logger['error'](_0x8ace('0x4f'),_0x1e038c);throw _0x1e038c;});}return _0x50e0d1;})[_0x8ace('0x27')](respondWithResult(_0x414b3e,0xc9))[_0x8ace('0x45')](handleError(_0x414b3e,null));};exports[_0x8ace('0x26')]=function(_0xaee7d3,_0x2d7288){if(_0xaee7d3['body']['id']){delete _0xaee7d3['body']['id'];}return db[_0x8ace('0x30')]['find']({'where':{'id':_0xaee7d3['params']['id']}})[_0x8ace('0x27')](handleEntityNotFound(_0x2d7288,null))['then'](saveUpdates(_0xaee7d3[_0x8ace('0x49')],null))[_0x8ace('0x27')](respondWithResult(_0x2d7288,null))[_0x8ace('0x45')](handleError(_0x2d7288,null));};exports['destroy']=function(_0x251311,_0x3e3f6d){return db[_0x8ace('0x30')][_0x8ace('0x50')]({'where':{'id':_0x251311[_0x8ace('0x51')]['id']}})[_0x8ace('0x27')](handleEntityNotFound(_0x3e3f6d,null))[_0x8ace('0x27')](removeEntity(_0x3e3f6d,null))[_0x8ace('0x45')](handleError(_0x3e3f6d,null));};exports['test']=function(_0x3b7a14,_0x49c096,_0x5b51be){var _0x17f0fe;return db[_0x8ace('0x30')][_0x8ace('0x50')]({'where':{'id':_0x3b7a14[_0x8ace('0x51')]['id']},'attributes':['id',_0x8ace('0x52')]})[_0x8ace('0x27')](handleEntityNotFound(_0x49c096,null))[_0x8ace('0x27')](function(_0x34639b){if(_0x34639b){var _0x5b1bfb=require(_0x8ace('0x53'))();_0x5b1bfb[_0x8ace('0x54')](_0x34639b[_0x8ace('0x52')]);_0x5b1bfb[_0x8ace('0x55')]();return _0x34639b;}})[_0x8ace('0x27')](respondWithResult(_0x49c096,null))[_0x8ace('0x45')](handleError(_0x49c096,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1ec52f2..99c0d73 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 _0x0056=['bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0056,0x188));var _0x6005=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x0056[_0x52096b];return _0x2b1cc7;};'use strict';var _=require(_0x6005('0x0'));var util=require(_0x6005('0x1'));var logger=require(_0x6005('0x2'))('api');var moment=require(_0x6005('0x3'));var BPromise=require(_0x6005('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6005('0x5'));var rimraf=require(_0x6005('0x6'));var config=require(_0x6005('0x7'));var attributes=require(_0x6005('0x8'));module[_0x6005('0x9')]=function(_0x1f7c48,_0x46d6ab){return _0x1f7c48[_0x6005('0xa')](_0x6005('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5bb=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc'];(function(_0xa223ad,_0x5a574b){var _0x306d47=function(_0x4b19ab){while(--_0x4b19ab){_0xa223ad['push'](_0xa223ad['shift']());}};_0x306d47(++_0x5a574b);}(_0xe5bb,0x15f));var _0xbe5b=function(_0x4385f6,_0x59db64){_0x4385f6=_0x4385f6-0x0;var _0x28f5da=_0xe5bb[_0x4385f6];return _0x28f5da;};'use strict';var _=require(_0xbe5b('0x0'));var util=require(_0xbe5b('0x1'));var logger=require(_0xbe5b('0x2'))(_0xbe5b('0x3'));var moment=require(_0xbe5b('0x4'));var BPromise=require(_0xbe5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe5b('0x6'));var rimraf=require(_0xbe5b('0x7'));var config=require(_0xbe5b('0x8'));var attributes=require('./squareOdbc.attributes');module[_0xbe5b('0x9')]=function(_0x4f3e1a,_0x267cdf){return _0x4f3e1a[_0xbe5b('0xa')](_0xbe5b('0xb'),attributes,{'tableName':_0xbe5b('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 966d565..da81a71 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 _0xa4db=['client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','error','message','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','stringify','catch','util','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0xe4c9a3,_0x4cf555){var _0x5caba0=function(_0x2eacc0){while(--_0x2eacc0){_0xe4c9a3['push'](_0xe4c9a3['shift']());}};_0x5caba0(++_0x4cf555);}(_0xa4db,0x1d6));var _0xba4d=function(_0xd473bf,_0x3cbbe3){_0xd473bf=_0xd473bf-0x0;var _0x64e977=_0xa4db[_0xd473bf];return _0x64e977;};'use strict';var _=require('lodash');var util=require(_0xba4d('0x0'));var moment=require('moment');var BPromise=require(_0xba4d('0x1'));var rs=require(_0xba4d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xba4d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xba4d('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xba4d('0x5')][_0xba4d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x246056,_0x331b3c,_0xdb7bc0){return new BPromise(function(_0x141e37,_0x451407){return client[_0xba4d('0x7')](_0x246056,_0xdb7bc0)[_0xba4d('0x8')](function(_0x3212c7){logger[_0xba4d('0x9')](_0xba4d('0xa'),_0x331b3c,_0xba4d('0xb'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x331b3c,_0xba4d('0xb'),JSON['stringify'](_0x3212c7));if(_0x3212c7[_0xba4d('0xc')]){if(_0x3212c7[_0xba4d('0xc')]['code']===0x1f4){logger[_0xba4d('0xc')](_0xba4d('0xa'),_0x331b3c,_0x3212c7['error'][_0xba4d('0xd')]);return _0x451407(_0x3212c7[_0xba4d('0xc')][_0xba4d('0xd')]);}logger[_0xba4d('0xc')](_0xba4d('0xa'),_0x331b3c,_0x3212c7[_0xba4d('0xc')][_0xba4d('0xd')]);return _0x141e37(_0x3212c7['error']['message']);}else{logger[_0xba4d('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x331b3c,_0xba4d('0xb'));_0x141e37(_0x3212c7['result'][_0xba4d('0xd')]);}})['catch'](function(_0x3ce35f){logger[_0xba4d('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x331b3c,_0x3ce35f);_0x451407(_0x3ce35f);});});}exports[_0xba4d('0xe')]=function(_0x57fa62){var _0x8da823=this;return new Promise(function(_0x13fe20,_0x4213ad){return db[_0xba4d('0xf')]['find']({'raw':_0x57fa62[_0xba4d('0x10')]?_0x57fa62[_0xba4d('0x10')][_0xba4d('0x11')]===undefined?!![]:![]:!![],'where':_0x57fa62['options']?_0x57fa62[_0xba4d('0x10')][_0xba4d('0x12')]||null:null,'attributes':_0x57fa62['options']?_0x57fa62[_0xba4d('0x10')][_0xba4d('0x13')]||null:null,'include':_0x57fa62[_0xba4d('0x10')]?_0x57fa62['options'][_0xba4d('0x14')]?_[_0xba4d('0x15')](_0x57fa62[_0xba4d('0x10')][_0xba4d('0x14')],function(_0x23f2af){return{'model':db[_0x23f2af[_0xba4d('0x16')]],'as':_0x23f2af['as'],'attributes':_0x23f2af[_0xba4d('0x13')],'include':_0x23f2af[_0xba4d('0x14')]?_[_0xba4d('0x15')](_0x23f2af[_0xba4d('0x14')],function(_0x8d3fa7){return{'model':db[_0x8d3fa7[_0xba4d('0x16')]],'as':_0x8d3fa7['as'],'attributes':_0x8d3fa7[_0xba4d('0x13')],'include':_0x8d3fa7[_0xba4d('0x14')]?_['map'](_0x8d3fa7[_0xba4d('0x14')],function(_0x86d72f){return{'model':db[_0x86d72f[_0xba4d('0x16')]],'as':_0x86d72f['as'],'attributes':_0x86d72f[_0xba4d('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfeb1a4){logger[_0xba4d('0x9')](_0xba4d('0xe'),_0x57fa62);logger['debug'](_0xba4d('0xe'),_0x57fa62,JSON[_0xba4d('0x17')](_0xfeb1a4));_0x13fe20(_0xfeb1a4);})[_0xba4d('0x18')](function(_0x324bae){logger[_0xba4d('0xc')](_0xba4d('0xe'),_0x324bae[_0xba4d('0xd')],_0x57fa62);_0x4213ad(_0x8da823[_0xba4d('0xc')](0x1f4,_0x324bae[_0xba4d('0xd')]));});});}; \ No newline at end of file +var _0xb4c1=['rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','options','raw','where','attributes','include','model','map','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xb4c1,0x14a));var _0x1b4c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb4c1[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x1b4c('0x0'));var moment=require(_0x1b4c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b4c('0x2'));var db=require(_0x1b4c('0x3'))['db'];var utils=require(_0x1b4c('0x4'));var logger=require(_0x1b4c('0x5'))(_0x1b4c('0x6'));var config=require(_0x1b4c('0x7'));var jayson=require(_0x1b4c('0x8'));var client=jayson[_0x1b4c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5498f3,_0x342731,_0x3157c3){return new BPromise(function(_0x21331d,_0x4e5000){return client['request'](_0x5498f3,_0x3157c3)[_0x1b4c('0xa')](function(_0xffebe){logger[_0x1b4c('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x342731,_0x1b4c('0xc'));logger[_0x1b4c('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x342731,_0x1b4c('0xc'),JSON[_0x1b4c('0xe')](_0xffebe));if(_0xffebe[_0x1b4c('0xf')]){if(_0xffebe['error']['code']===0x1f4){logger[_0x1b4c('0xf')](_0x1b4c('0x10'),_0x342731,_0xffebe[_0x1b4c('0xf')][_0x1b4c('0x11')]);return _0x4e5000(_0xffebe[_0x1b4c('0xf')][_0x1b4c('0x11')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x342731,_0xffebe['error']['message']);return _0x21331d(_0xffebe[_0x1b4c('0xf')][_0x1b4c('0x11')]);}else{logger['info'](_0x1b4c('0x10'),_0x342731,'request\x20sent');_0x21331d(_0xffebe[_0x1b4c('0x12')]['message']);}})[_0x1b4c('0x13')](function(_0xf97459){logger[_0x1b4c('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x342731,_0xf97459);_0x4e5000(_0xf97459);});});}exports[_0x1b4c('0x14')]=function(_0x188062){var _0x261c39=this;return new Promise(function(_0x2372a2,_0x11c051){return db['SquareOdbc']['find']({'raw':_0x188062[_0x1b4c('0x15')]?_0x188062[_0x1b4c('0x15')][_0x1b4c('0x16')]===undefined?!![]:![]:!![],'where':_0x188062[_0x1b4c('0x15')]?_0x188062[_0x1b4c('0x15')][_0x1b4c('0x17')]||null:null,'attributes':_0x188062[_0x1b4c('0x15')]?_0x188062['options'][_0x1b4c('0x18')]||null:null,'include':_0x188062[_0x1b4c('0x15')]?_0x188062[_0x1b4c('0x15')][_0x1b4c('0x19')]?_['map'](_0x188062[_0x1b4c('0x15')]['include'],function(_0x589396){return{'model':db[_0x589396[_0x1b4c('0x1a')]],'as':_0x589396['as'],'attributes':_0x589396['attributes'],'include':_0x589396[_0x1b4c('0x19')]?_[_0x1b4c('0x1b')](_0x589396[_0x1b4c('0x19')],function(_0x6b665a){return{'model':db[_0x6b665a['model']],'as':_0x6b665a['as'],'attributes':_0x6b665a['attributes'],'include':_0x6b665a[_0x1b4c('0x19')]?_[_0x1b4c('0x1b')](_0x6b665a['include'],function(_0x739639){return{'model':db[_0x739639['model']],'as':_0x739639['as'],'attributes':_0x739639[_0x1b4c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1b4c('0xa')](function(_0x4538db){logger[_0x1b4c('0xb')](_0x1b4c('0x14'),_0x188062);logger[_0x1b4c('0xd')](_0x1b4c('0x14'),_0x188062,JSON[_0x1b4c('0xe')](_0x4538db));_0x2372a2(_0x4538db);})['catch'](function(_0x4f2d78){logger[_0x1b4c('0xf')](_0x1b4c('0x14'),_0x4f2d78[_0x1b4c('0x11')],_0x188062);_0x11c051(_0x261c39[_0x1b4c('0xf')](0x1f4,_0x4f2d78[_0x1b4c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b2300d2..cc74166 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 _0x3178=['Router','fs-extra','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','express'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x3178,0x196));var _0x8317=function(_0x131f28,_0xadc7ab){_0x131f28=_0x131f28-0x0;var _0x223641=_0x3178[_0x131f28];return _0x223641;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8317('0x0'));var timeout=require('connect-timeout');var express=require(_0x8317('0x1'));var router=express[_0x8317('0x2')]();var fs_extra=require(_0x8317('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8317('0x4'));var controller=require(_0x8317('0x5'));router[_0x8317('0x6')]('/',auth[_0x8317('0x7')](),controller[_0x8317('0x8')]);router[_0x8317('0x6')](_0x8317('0x9'),auth[_0x8317('0x7')](),controller[_0x8317('0xa')]);router[_0x8317('0xb')]('/',auth[_0x8317('0x7')](),controller[_0x8317('0xc')]);router[_0x8317('0xd')](_0x8317('0x9'),auth[_0x8317('0x7')](),controller['update']);router[_0x8317('0xe')](_0x8317('0x9'),auth['isAuthenticated'](),controller[_0x8317('0xf')]);module[_0x8317('0x10')]=router; \ No newline at end of file +var _0x1842=['index','/:id','show','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x1842,0xa1));var _0x2184=function(_0x57c073,_0x33e1ba){_0x57c073=_0x57c073-0x0;var _0x1155ab=_0x1842[_0x57c073];return _0x1155ab;};'use strict';var multer=require('multer');var util=require(_0x2184('0x0'));var path=require(_0x2184('0x1'));var timeout=require('connect-timeout');var express=require(_0x2184('0x2'));var router=express[_0x2184('0x3')]();var fs_extra=require(_0x2184('0x4'));var auth=require(_0x2184('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2184('0x6'));var controller=require('./squareProject.controller');router[_0x2184('0x7')]('/',auth[_0x2184('0x8')](),controller[_0x2184('0x9')]);router[_0x2184('0x7')](_0x2184('0xa'),auth[_0x2184('0x8')](),controller[_0x2184('0xb')]);router['post']('/',auth[_0x2184('0x8')](),controller[_0x2184('0xc')]);router[_0x2184('0xd')](_0x2184('0xa'),auth[_0x2184('0x8')](),controller[_0x2184('0xe')]);router[_0x2184('0xf')](_0x2184('0xa'),auth[_0x2184('0x8')](),controller['destroy']);module[_0x2184('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9415fa4..fc2c6a1 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 _0xec36=['production','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long'];(function(_0x377570,_0xfd20e1){var _0x43e675=function(_0x4596f5){while(--_0x4596f5){_0x377570['push'](_0x377570['shift']());}};_0x43e675(++_0xfd20e1);}(_0xec36,0xda));var _0x6ec3=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xec36[_0x3ba924];return _0x4cc1df;};'use strict';var Sequelize=require(_0x6ec3('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ec3('0x1')],'unique':_0x6ec3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6ec3('0x1')]},'notes':{'type':Sequelize[_0x6ec3('0x3')]},'preproduction':{'type':Sequelize[_0x6ec3('0x4')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x6ec3('0x5')](_0x6ec3('0x6'))[_0x6ec3('0x7')](_0x6ec3('0x8'));}}},'production':{'type':Sequelize[_0x6ec3('0x4')](_0x6ec3('0x9')),'get':function(){if(this['getDataValue'](_0x6ec3('0xa'))){return this['getDataValue'](_0x6ec3('0xa'))[_0x6ec3('0x7')](_0x6ec3('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x6ec3('0xb')]}}; \ No newline at end of file +var _0xef3f=['long','getDataValue','preproduction','toString','production','DATE','sequelize','exports','name','STRING','BLOB'];(function(_0x2edb9f,_0x36fad0){var _0x4e5979=function(_0x425f9f){while(--_0x425f9f){_0x2edb9f['push'](_0x2edb9f['shift']());}};_0x4e5979(++_0x36fad0);}(_0xef3f,0xe2));var _0xfef3=function(_0x2d5910,_0x376c4e){_0x2d5910=_0x2d5910-0x0;var _0x1aa5b8=_0xef3f[_0x2d5910];return _0x1aa5b8;};'use strict';var Sequelize=require(_0xfef3('0x0'));module[_0xfef3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfef3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xfef3('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xfef3('0x4')](_0xfef3('0x5')),'get':function(){if(this[_0xfef3('0x6')](_0xfef3('0x7'))){return this['getDataValue'](_0xfef3('0x7'))[_0xfef3('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0xfef3('0x9'))){return this[_0xfef3('0x6')](_0xfef3('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xfef3('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index f1b84d4..05fb63a 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 _0x5c55=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','production','lodash','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','json','offset','limit','undefined','count','status','set','Content-Range','then','destroy','get','UserProfileResource','publish','stringify','end','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map'];(function(_0x123e7a,_0x557878){var _0x398c86=function(_0x69aba4){while(--_0x69aba4){_0x123e7a['push'](_0x123e7a['shift']());}};_0x398c86(++_0x557878);}(_0x5c55,0x6a));var _0x55c5=function(_0xd5a842,_0x3bef1f){_0xd5a842=_0xd5a842-0x0;var _0xcedd84=_0x5c55[_0xd5a842];return _0xcedd84;};'use strict';var _=require(_0x55c5('0x0'));var Redis=require(_0x55c5('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x55c5('0x2'))(_0x55c5('0x3'));var config=require('../../config/environment');var db=require(_0x55c5('0x4'))['db'];config['redis']=_[_0x55c5('0x5')](config[_0x55c5('0x6')],{'host':_0x55c5('0x7'),'port':0x18eb});var socket=require(_0x55c5('0x8'))(new Redis(config['redis']));require(_0x55c5('0x9'))['register'](socket);function respondWithResult(_0x36e7a0,_0x50f201){_0x50f201=_0x50f201||0xc8;return function(_0x54f80a){if(_0x54f80a){return _0x36e7a0['status'](_0x50f201)[_0x55c5('0xa')](_0x54f80a);}};}function respondWithFilteredResult(_0x241e95,_0x3a1569){return function(_0x526f31){if(_0x526f31){var _0x1848d3=typeof _0x3a1569[_0x55c5('0xb')]==='undefined'&&typeof _0x3a1569[_0x55c5('0xc')]===_0x55c5('0xd');var _0x3628b7=_0x526f31[_0x55c5('0xe')];var _0x4aff35=_0x1848d3?0x0:_0x3a1569[_0x55c5('0xb')];var _0x3c7266=_0x1848d3?_0x526f31[_0x55c5('0xe')]:_0x3a1569[_0x55c5('0xb')]+_0x3a1569[_0x55c5('0xc')];var _0x58b8f8;if(_0x3c7266>=_0x3628b7){_0x3c7266=_0x3628b7;_0x58b8f8=0xc8;}else{_0x58b8f8=0xce;}_0x241e95[_0x55c5('0xf')](_0x58b8f8);return _0x241e95[_0x55c5('0x10')](_0x55c5('0x11'),_0x4aff35+'-'+_0x3c7266+'/'+_0x3628b7)[_0x55c5('0xa')](_0x526f31);}return null;};}function saveUpdates(_0xa91378){return function(_0x29e726){if(_0x29e726){return _0x29e726['update'](_0xa91378)[_0x55c5('0x12')](function(_0x557f1b){return _0x557f1b;});}return null;};}function removeEntity(_0x44fadb){return function(_0x5b8145){if(_0x5b8145){return _0x5b8145[_0x55c5('0x13')]()[_0x55c5('0x12')](function(){var _0x4154e5=_0x5b8145[_0x55c5('0x14')]({'plain':!![]});var _0xd2fdde='SquareProjects';return db[_0x55c5('0x15')]['destroy']({'where':{'type':_0xd2fdde,'resourceId':_0x4154e5['id']}})[_0x55c5('0x12')](function(){return _0x5b8145;});})[_0x55c5('0x12')](function(){var _0x1141e4=new Redis(config[_0x55c5('0x6')]);_0x1141e4[_0x55c5('0x16')]('agi',JSON[_0x55c5('0x17')]({'id':_0x5b8145['id'],'deleted':!![]}));})[_0x55c5('0x12')](function(){_0x44fadb[_0x55c5('0xf')](0xcc)[_0x55c5('0x18')]();});}};}function handleEntityNotFound(_0x577643){return function(_0x5c22c3){if(!_0x5c22c3){_0x577643[_0x55c5('0x19')](0x194);}return _0x5c22c3;};}function handleError(_0x33bee6,_0xf56c65){_0xf56c65=_0xf56c65||0x1f4;return function(_0x48274e){logger[_0x55c5('0x1a')](_0x48274e[_0x55c5('0x1b')]);if(_0x48274e[_0x55c5('0x1c')]){delete _0x48274e[_0x55c5('0x1c')];}_0x33bee6[_0x55c5('0xf')](_0xf56c65)[_0x55c5('0x1d')](_0x48274e);};}exports[_0x55c5('0x1e')]=function(_0x267ca6,_0x21a8bc){var _0x3d9d3b={},_0x1f3d5f={},_0x2d9db5={'count':0x0,'rows':[]};var _0x38a8b7=_['map'](db[_0x55c5('0x1f')][_0x55c5('0x20')],function(_0x18f404){return{'name':_0x18f404[_0x55c5('0x21')],'type':_0x18f404[_0x55c5('0x22')][_0x55c5('0x23')]};});_0x1f3d5f[_0x55c5('0x24')]=_[_0x55c5('0x25')](_0x38a8b7,'name');_0x1f3d5f[_0x55c5('0x26')]=_[_0x55c5('0x27')](_0x267ca6[_0x55c5('0x26')]);_0x1f3d5f[_0x55c5('0x28')]=_[_0x55c5('0x29')](_0x1f3d5f['model'],_0x1f3d5f['query']);_0x3d9d3b[_0x55c5('0x2a')]=_['intersection'](_0x1f3d5f[_0x55c5('0x24')],qs[_0x55c5('0x2b')](_0x267ca6['query'][_0x55c5('0x2b')]));_0x3d9d3b['attributes']=_0x3d9d3b['attributes'][_0x55c5('0x2c')]?_0x3d9d3b[_0x55c5('0x2a')]:_0x1f3d5f[_0x55c5('0x24')];if(!_0x267ca6[_0x55c5('0x26')][_0x55c5('0x2d')](_0x55c5('0x2e'))){_0x3d9d3b[_0x55c5('0xc')]=qs[_0x55c5('0xc')](_0x267ca6[_0x55c5('0x26')][_0x55c5('0xc')]);_0x3d9d3b['offset']=qs[_0x55c5('0xb')](_0x267ca6[_0x55c5('0x26')][_0x55c5('0xb')]);}_0x3d9d3b[_0x55c5('0x2f')]=qs[_0x55c5('0x30')](_0x267ca6[_0x55c5('0x26')][_0x55c5('0x30')]);_0x3d9d3b[_0x55c5('0x31')]=qs[_0x55c5('0x28')](_[_0x55c5('0x32')](_0x267ca6['query'],_0x1f3d5f[_0x55c5('0x28')]),_0x38a8b7);if(_0x267ca6[_0x55c5('0x26')][_0x55c5('0x33')]){_0x3d9d3b[_0x55c5('0x31')]=_[_0x55c5('0x34')](_0x3d9d3b[_0x55c5('0x31')],{'$or':_['map'](_0x38a8b7,function(_0x51ae49){if(_0x51ae49[_0x55c5('0x22')]!==_0x55c5('0x35')){var _0x2fa854={};_0x2fa854[_0x51ae49[_0x55c5('0x1c')]]={'$like':'%'+_0x267ca6[_0x55c5('0x26')]['filter']+'%'};return _0x2fa854;}})});}_0x3d9d3b=_[_0x55c5('0x34')]({},_0x3d9d3b,_0x267ca6[_0x55c5('0x36')]);var _0x199fb6={'where':_0x3d9d3b[_0x55c5('0x31')]};return db[_0x55c5('0x1f')]['count'](_0x199fb6)[_0x55c5('0x12')](function(_0x28c26d){_0x2d9db5['count']=_0x28c26d;if(_0x267ca6[_0x55c5('0x26')]['includeAll']){_0x3d9d3b[_0x55c5('0x37')]=[{'all':!![]}];}return db[_0x55c5('0x1f')][_0x55c5('0x38')](_0x3d9d3b);})['then'](function(_0x2ea152){_0x2d9db5[_0x55c5('0x39')]=_0x2ea152;return _0x2d9db5;})[_0x55c5('0x12')](respondWithFilteredResult(_0x21a8bc,_0x3d9d3b))[_0x55c5('0x3a')](handleError(_0x21a8bc,null));};exports['show']=function(_0x58e843,_0x520617){var _0x15a3b4={'raw':![],'where':{'id':_0x58e843[_0x55c5('0x3b')]['id']}},_0x577e8d={};_0x577e8d[_0x55c5('0x24')]=_[_0x55c5('0x27')](db[_0x55c5('0x1f')][_0x55c5('0x20')]);_0x577e8d[_0x55c5('0x26')]=_[_0x55c5('0x27')](_0x58e843[_0x55c5('0x26')]);_0x577e8d['filters']=_['intersection'](_0x577e8d[_0x55c5('0x24')],_0x577e8d[_0x55c5('0x26')]);_0x15a3b4[_0x55c5('0x2a')]=_[_0x55c5('0x29')](_0x577e8d[_0x55c5('0x24')],qs['fields'](_0x58e843[_0x55c5('0x26')][_0x55c5('0x2b')]));_0x15a3b4['attributes']=_0x15a3b4[_0x55c5('0x2a')]['length']?_0x15a3b4[_0x55c5('0x2a')]:_0x577e8d['model'];if(_0x58e843[_0x55c5('0x26')][_0x55c5('0x3c')]){_0x15a3b4[_0x55c5('0x37')]=[{'all':!![]}];}_0x15a3b4=_[_0x55c5('0x34')]({},_0x15a3b4,_0x58e843[_0x55c5('0x36')]);return db[_0x55c5('0x1f')][_0x55c5('0x3d')](_0x15a3b4)[_0x55c5('0x12')](handleEntityNotFound(_0x520617,null))['then'](respondWithResult(_0x520617,null))[_0x55c5('0x3a')](handleError(_0x520617,null));};exports['create']=function(_0xb598c0,_0x1f300c){return db['SquareProject']['create'](_0xb598c0[_0x55c5('0x3e')],{})[_0x55c5('0x12')](function(_0x178f20){var _0x42a311=_0xb598c0[_0x55c5('0x3f')][_0x55c5('0x14')]({'plain':!![]});if(!_0x42a311)throw new Error(_0x55c5('0x40'));if(_0x42a311['role']===_0x55c5('0x3f')){var _0x1b4c22=_0x178f20[_0x55c5('0x14')]({'plain':!![]});var _0x2ce6a8='SquareProjects';return db[_0x55c5('0x41')][_0x55c5('0x3d')]({'where':{'name':_0x2ce6a8,'userProfileId':_0x42a311[_0x55c5('0x42')]},'raw':!![]})['then'](function(_0x30fbef){if(_0x30fbef&&_0x30fbef[_0x55c5('0x43')]===0x0){return db[_0x55c5('0x15')][_0x55c5('0x44')]({'name':_0x1b4c22[_0x55c5('0x1c')],'resourceId':_0x1b4c22['id'],'type':_0x30fbef[_0x55c5('0x1c')],'sectionId':_0x30fbef['id']},{})[_0x55c5('0x12')](function(){return _0x178f20;});}else{return _0x178f20;}})['catch'](function(_0x2069c4){logger[_0x55c5('0x1a')](_0x55c5('0x45'),_0x2069c4);throw _0x2069c4;});}return _0x178f20;})[_0x55c5('0x12')](respondWithResult(_0x1f300c,0xc9))[_0x55c5('0x3a')](handleError(_0x1f300c,null));};exports['update']=function(_0x1cbec0,_0x4e20f7){if(_0x1cbec0[_0x55c5('0x3e')]['id']){delete _0x1cbec0[_0x55c5('0x3e')]['id'];}return db['SquareProject'][_0x55c5('0x3d')]({'where':{'id':_0x1cbec0[_0x55c5('0x3b')]['id']}})[_0x55c5('0x12')](handleEntityNotFound(_0x4e20f7,null))[_0x55c5('0x12')](saveUpdates(_0x1cbec0[_0x55c5('0x3e')],null))['then'](function(_0xa81fc6){if(!_0xa81fc6)return;var _0x41db20=_0xa81fc6[_0x55c5('0x14')]({'plain':!![]});return _0x41db20;})[_0x55c5('0x12')](function(_0x363a84){var _0x19ba77=new Redis(config['redis']);_0x19ba77[_0x55c5('0x16')](_0x55c5('0x46'),JSON[_0x55c5('0x17')](_[_0x55c5('0x32')](_0x363a84,['id',_0x55c5('0x1c'),_0x55c5('0x47')])));return _0x363a84;})[_0x55c5('0x12')](respondWithResult(_0x4e20f7,null))[_0x55c5('0x3a')](handleError(_0x4e20f7,null));};exports[_0x55c5('0x13')]=function(_0x1a87a6,_0x24f281){return db[_0x55c5('0x1f')][_0x55c5('0x3d')]({'where':{'id':_0x1a87a6[_0x55c5('0x3b')]['id']}})[_0x55c5('0x12')](handleEntityNotFound(_0x24f281,null))[_0x55c5('0x12')](removeEntity(_0x24f281,null))['catch'](handleError(_0x24f281,null));}; \ No newline at end of file +var _0xeb02=['key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','production','destroy','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','undefined','limit','count','offset','Content-Range','then','get','SquareProjects','publish','stringify','end','error','name','SquareProject','fieldName','type'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xeb02,0x1b8));var _0x2eb0=function(_0x2ccfa0,_0x5c9186){_0x2ccfa0=_0x2ccfa0-0x0;var _0xf34a17=_0xeb02[_0x2ccfa0];return _0xf34a17;};'use strict';var _=require(_0x2eb0('0x0'));var Redis=require(_0x2eb0('0x1'));var qs=require(_0x2eb0('0x2'));var logger=require('../../config/logger')(_0x2eb0('0x3'));var config=require(_0x2eb0('0x4'));var db=require(_0x2eb0('0x5'))['db'];config[_0x2eb0('0x6')]=_[_0x2eb0('0x7')](config['redis'],{'host':_0x2eb0('0x8'),'port':0x18eb});var socket=require(_0x2eb0('0x9'))(new Redis(config[_0x2eb0('0x6')]));require('./squareProject.socket')[_0x2eb0('0xa')](socket);function respondWithResult(_0x2cc42c,_0x40e4df){_0x40e4df=_0x40e4df||0xc8;return function(_0x535f9f){if(_0x535f9f){return _0x2cc42c[_0x2eb0('0xb')](_0x40e4df)[_0x2eb0('0xc')](_0x535f9f);}};}function respondWithFilteredResult(_0x4d7544,_0x1aa95f){return function(_0x210b6c){if(_0x210b6c){var _0x2fa52c=typeof _0x1aa95f['offset']===_0x2eb0('0xd')&&typeof _0x1aa95f[_0x2eb0('0xe')]===_0x2eb0('0xd');var _0x4894ac=_0x210b6c[_0x2eb0('0xf')];var _0x6c25b2=_0x2fa52c?0x0:_0x1aa95f[_0x2eb0('0x10')];var _0x54e0d7=_0x2fa52c?_0x210b6c[_0x2eb0('0xf')]:_0x1aa95f[_0x2eb0('0x10')]+_0x1aa95f[_0x2eb0('0xe')];var _0x7fb935;if(_0x54e0d7>=_0x4894ac){_0x54e0d7=_0x4894ac;_0x7fb935=0xc8;}else{_0x7fb935=0xce;}_0x4d7544['status'](_0x7fb935);return _0x4d7544['set'](_0x2eb0('0x11'),_0x6c25b2+'-'+_0x54e0d7+'/'+_0x4894ac)[_0x2eb0('0xc')](_0x210b6c);}return null;};}function saveUpdates(_0x36aaa1){return function(_0x17f9e9){if(_0x17f9e9){return _0x17f9e9['update'](_0x36aaa1)['then'](function(_0x2ff7dc){return _0x2ff7dc;});}return null;};}function removeEntity(_0x219f8d){return function(_0x2c99d4){if(_0x2c99d4){return _0x2c99d4['destroy']()[_0x2eb0('0x12')](function(){var _0x3d94e7=_0x2c99d4[_0x2eb0('0x13')]({'plain':!![]});var _0x225692=_0x2eb0('0x14');return db['UserProfileResource']['destroy']({'where':{'type':_0x225692,'resourceId':_0x3d94e7['id']}})['then'](function(){return _0x2c99d4;});})['then'](function(){var _0x2ef22a=new Redis(config[_0x2eb0('0x6')]);_0x2ef22a[_0x2eb0('0x15')]('agi',JSON[_0x2eb0('0x16')]({'id':_0x2c99d4['id'],'deleted':!![]}));})[_0x2eb0('0x12')](function(){_0x219f8d[_0x2eb0('0xb')](0xcc)[_0x2eb0('0x17')]();});}};}function handleEntityNotFound(_0x5f111e){return function(_0x1a341b){if(!_0x1a341b){_0x5f111e['sendStatus'](0x194);}return _0x1a341b;};}function handleError(_0x53a483,_0x41e0d3){_0x41e0d3=_0x41e0d3||0x1f4;return function(_0x20a8e5){logger[_0x2eb0('0x18')](_0x20a8e5['stack']);if(_0x20a8e5[_0x2eb0('0x19')]){delete _0x20a8e5[_0x2eb0('0x19')];}_0x53a483[_0x2eb0('0xb')](_0x41e0d3)['send'](_0x20a8e5);};}exports['index']=function(_0x4b43d7,_0x59f2cc){var _0x5f336e={},_0x209d51={},_0x4e6b46={'count':0x0,'rows':[]};var _0x2ae2f8=_['map'](db[_0x2eb0('0x1a')]['rawAttributes'],function(_0x26485d){return{'name':_0x26485d[_0x2eb0('0x1b')],'type':_0x26485d[_0x2eb0('0x1c')][_0x2eb0('0x1d')]};});_0x209d51[_0x2eb0('0x1e')]=_[_0x2eb0('0x1f')](_0x2ae2f8,'name');_0x209d51[_0x2eb0('0x20')]=_[_0x2eb0('0x21')](_0x4b43d7['query']);_0x209d51[_0x2eb0('0x22')]=_['intersection'](_0x209d51[_0x2eb0('0x1e')],_0x209d51[_0x2eb0('0x20')]);_0x5f336e[_0x2eb0('0x23')]=_[_0x2eb0('0x24')](_0x209d51[_0x2eb0('0x1e')],qs[_0x2eb0('0x25')](_0x4b43d7['query'][_0x2eb0('0x25')]));_0x5f336e[_0x2eb0('0x23')]=_0x5f336e[_0x2eb0('0x23')]['length']?_0x5f336e[_0x2eb0('0x23')]:_0x209d51[_0x2eb0('0x1e')];if(!_0x4b43d7['query'][_0x2eb0('0x26')](_0x2eb0('0x27'))){_0x5f336e[_0x2eb0('0xe')]=qs[_0x2eb0('0xe')](_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0xe')]);_0x5f336e[_0x2eb0('0x10')]=qs[_0x2eb0('0x10')](_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0x10')]);}_0x5f336e[_0x2eb0('0x28')]=qs[_0x2eb0('0x29')](_0x4b43d7['query'][_0x2eb0('0x29')]);_0x5f336e[_0x2eb0('0x2a')]=qs[_0x2eb0('0x22')](_[_0x2eb0('0x2b')](_0x4b43d7['query'],_0x209d51[_0x2eb0('0x22')]),_0x2ae2f8);if(_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0x2c')]){_0x5f336e[_0x2eb0('0x2a')]=_[_0x2eb0('0x2d')](_0x5f336e['where'],{'$or':_[_0x2eb0('0x1f')](_0x2ae2f8,function(_0x6fa152){if(_0x6fa152[_0x2eb0('0x1c')]!==_0x2eb0('0x2e')){var _0x4a2c3c={};_0x4a2c3c[_0x6fa152[_0x2eb0('0x19')]]={'$like':'%'+_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0x2c')]+'%'};return _0x4a2c3c;}})});}_0x5f336e=_[_0x2eb0('0x2d')]({},_0x5f336e,_0x4b43d7['options']);var _0x29edd5={'where':_0x5f336e[_0x2eb0('0x2a')]};return db['SquareProject'][_0x2eb0('0xf')](_0x29edd5)[_0x2eb0('0x12')](function(_0x22b9bb){_0x4e6b46['count']=_0x22b9bb;if(_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0x2f')]){_0x5f336e['include']=[{'all':!![]}];}return db[_0x2eb0('0x1a')][_0x2eb0('0x30')](_0x5f336e);})[_0x2eb0('0x12')](function(_0x52ea6d){_0x4e6b46['rows']=_0x52ea6d;return _0x4e6b46;})['then'](respondWithFilteredResult(_0x59f2cc,_0x5f336e))[_0x2eb0('0x31')](handleError(_0x59f2cc,null));};exports['show']=function(_0x7cb55c,_0x30ec25){var _0x57f758={'raw':![],'where':{'id':_0x7cb55c['params']['id']}},_0x49cf53={};_0x49cf53[_0x2eb0('0x1e')]=_[_0x2eb0('0x21')](db['SquareProject']['rawAttributes']);_0x49cf53[_0x2eb0('0x20')]=_['keys'](_0x7cb55c['query']);_0x49cf53[_0x2eb0('0x22')]=_[_0x2eb0('0x24')](_0x49cf53['model'],_0x49cf53[_0x2eb0('0x20')]);_0x57f758['attributes']=_[_0x2eb0('0x24')](_0x49cf53['model'],qs['fields'](_0x7cb55c[_0x2eb0('0x20')]['fields']));_0x57f758[_0x2eb0('0x23')]=_0x57f758[_0x2eb0('0x23')][_0x2eb0('0x32')]?_0x57f758[_0x2eb0('0x23')]:_0x49cf53[_0x2eb0('0x1e')];if(_0x7cb55c[_0x2eb0('0x20')][_0x2eb0('0x2f')]){_0x57f758[_0x2eb0('0x33')]=[{'all':!![]}];}_0x57f758=_[_0x2eb0('0x2d')]({},_0x57f758,_0x7cb55c[_0x2eb0('0x34')]);return db[_0x2eb0('0x1a')][_0x2eb0('0x35')](_0x57f758)[_0x2eb0('0x12')](handleEntityNotFound(_0x30ec25,null))[_0x2eb0('0x12')](respondWithResult(_0x30ec25,null))['catch'](handleError(_0x30ec25,null));};exports[_0x2eb0('0x36')]=function(_0x49fff8,_0x5628ad){return db[_0x2eb0('0x1a')]['create'](_0x49fff8[_0x2eb0('0x37')],{})[_0x2eb0('0x12')](function(_0x3130c9){var _0xb6830e=_0x49fff8[_0x2eb0('0x38')][_0x2eb0('0x13')]({'plain':!![]});if(!_0xb6830e)throw new Error(_0x2eb0('0x39'));if(_0xb6830e[_0x2eb0('0x3a')]===_0x2eb0('0x38')){var _0x5e5a21=_0x3130c9[_0x2eb0('0x13')]({'plain':!![]});var _0x4f7bd8='SquareProjects';return db[_0x2eb0('0x3b')]['find']({'where':{'name':_0x4f7bd8,'userProfileId':_0xb6830e[_0x2eb0('0x3c')]},'raw':!![]})[_0x2eb0('0x12')](function(_0x4bc5e2){if(_0x4bc5e2&&_0x4bc5e2['autoAssociation']===0x0){return db[_0x2eb0('0x3d')][_0x2eb0('0x36')]({'name':_0x5e5a21[_0x2eb0('0x19')],'resourceId':_0x5e5a21['id'],'type':_0x4bc5e2[_0x2eb0('0x19')],'sectionId':_0x4bc5e2['id']},{})['then'](function(){return _0x3130c9;});}else{return _0x3130c9;}})[_0x2eb0('0x31')](function(_0x3aa43f){logger[_0x2eb0('0x18')](_0x2eb0('0x3e'),_0x3aa43f);throw _0x3aa43f;});}return _0x3130c9;})['then'](respondWithResult(_0x5628ad,0xc9))[_0x2eb0('0x31')](handleError(_0x5628ad,null));};exports[_0x2eb0('0x3f')]=function(_0x571efe,_0x1359f2){if(_0x571efe[_0x2eb0('0x37')]['id']){delete _0x571efe[_0x2eb0('0x37')]['id'];}return db[_0x2eb0('0x1a')][_0x2eb0('0x35')]({'where':{'id':_0x571efe[_0x2eb0('0x40')]['id']}})[_0x2eb0('0x12')](handleEntityNotFound(_0x1359f2,null))['then'](saveUpdates(_0x571efe[_0x2eb0('0x37')],null))['then'](function(_0x5bcdba){if(!_0x5bcdba)return;var _0x45afd4=_0x5bcdba[_0x2eb0('0x13')]({'plain':!![]});return _0x45afd4;})[_0x2eb0('0x12')](function(_0x14c273){var _0x206ba1=new Redis(config[_0x2eb0('0x6')]);_0x206ba1[_0x2eb0('0x15')]('agi',JSON[_0x2eb0('0x16')](_[_0x2eb0('0x2b')](_0x14c273,['id',_0x2eb0('0x19'),_0x2eb0('0x41')])));return _0x14c273;})[_0x2eb0('0x12')](respondWithResult(_0x1359f2,null))['catch'](handleError(_0x1359f2,null));};exports[_0x2eb0('0x42')]=function(_0x5d0ea3,_0x50682a){return db[_0x2eb0('0x1a')][_0x2eb0('0x35')]({'where':{'id':_0x5d0ea3[_0x2eb0('0x40')]['id']}})[_0x2eb0('0x12')](handleEntityNotFound(_0x50682a,null))['then'](removeEntity(_0x50682a,null))['catch'](handleError(_0x50682a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d9d821b..acbc8cf 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 _0x64da=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x5b7b9c,_0x1b7f14){var _0x134213=function(_0x11726b){while(--_0x11726b){_0x5b7b9c['push'](_0x5b7b9c['shift']());}};_0x134213(++_0x1b7f14);}(_0x64da,0x1ad));var _0xa64d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x64da[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xa64d('0x0'))['db'][_0xa64d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa64d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa64d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3b36d7){return function(_0x1affde,_0x4f100a,_0x3f912b){SquareProjectEvents[_0xa64d('0x4')](_0x3b36d7+':'+_0x1affde['id'],_0x1affde);SquareProjectEvents[_0xa64d('0x4')](_0x3b36d7,_0x1affde);_0x3f912b(null);};}for(var e in events){if(events[_0xa64d('0x5')](e)){var event=events[e];SquareProject[_0xa64d('0x6')](e,emitEvent(event));}}module[_0xa64d('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x0195=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xeb6f8d,_0x1138f1){var _0x41f045=function(_0x2e8f0e){while(--_0x2e8f0e){_0xeb6f8d['push'](_0xeb6f8d['shift']());}};_0x41f045(++_0x1138f1);}(_0x0195,0x8d));var _0x5019=function(_0x2ca357,_0x4b938a){_0x2ca357=_0x2ca357-0x0;var _0x397f40=_0x0195[_0x2ca357];return _0x397f40;};'use strict';var EventEmitter=require(_0x5019('0x0'));var SquareProject=require(_0x5019('0x1'))['db'][_0x5019('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5019('0x3')](0x0);var events={'afterCreate':_0x5019('0x4'),'afterUpdate':_0x5019('0x5'),'afterDestroy':_0x5019('0x6')};function emitEvent(_0x252c1b){return function(_0x4c2c24,_0x523c6c,_0x32f709){SquareProjectEvents[_0x5019('0x7')](_0x252c1b+':'+_0x4c2c24['id'],_0x4c2c24);SquareProjectEvents['emit'](_0x252c1b,_0x4c2c24);_0x32f709(null);};}for(var e in events){if(events[_0x5019('0x8')](e)){var event=events[e];SquareProject[_0x5019('0x9')](e,emitEvent(event));}}module[_0x5019('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 4763c0f..4819ca7 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 _0xa886=['production','publishedAt','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5cb76d,_0x47d11a){var _0x34a1f2=function(_0x189bc8){while(--_0x189bc8){_0x5cb76d['push'](_0x5cb76d['shift']());}};_0x34a1f2(++_0x47d11a);}(_0xa886,0x112));var _0x6a88=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa886[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x6a88('0x0'));var util=require('util');var logger=require(_0x6a88('0x1'))(_0x6a88('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a88('0x4'));var config=require(_0x6a88('0x5'));var attributes=require(_0x6a88('0x6'));module['exports']=function(_0x1c8618,_0x364704){return _0x1c8618[_0x6a88('0x7')](_0x6a88('0x8'),attributes,{'tableName':_0x6a88('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fb3df,_0x11b39f,_0x2c08c2){if(_0x2fb3df[_0x6a88('0xa')](_0x6a88('0xb'))){_0x2fb3df[_0x6a88('0xc')]=moment()[_0x6a88('0xd')](_0x6a88('0xe'));}if(_0x2fb3df[_0x6a88('0xa')](_0x6a88('0xf'))){_0x2fb3df[_0x6a88('0x10')]=moment()[_0x6a88('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2c08c2(null,_0x2fb3df);}}});}; \ No newline at end of file +var _0x67af=['changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x67af,0x123));var _0xf67a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x67af[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xf67a('0x0'));var util=require(_0xf67a('0x1'));var logger=require(_0xf67a('0x2'))(_0xf67a('0x3'));var moment=require(_0xf67a('0x4'));var BPromise=require('bluebird');var rp=require(_0xf67a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf67a('0x6'));var config=require(_0xf67a('0x7'));var attributes=require(_0xf67a('0x8'));module[_0xf67a('0x9')]=function(_0x57b06f,_0xee5407){return _0x57b06f[_0xf67a('0xa')](_0xf67a('0xb'),attributes,{'tableName':_0xf67a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5190a4,_0x202e72,_0x3ba1bf){if(_0x5190a4[_0xf67a('0xd')](_0xf67a('0xe'))){_0x5190a4['savedAt']=moment()[_0xf67a('0xf')](_0xf67a('0x10'));}if(_0x5190a4['changed'](_0xf67a('0x11'))){_0x5190a4[_0xf67a('0x12')]=moment()[_0xf67a('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3ba1bf(null,_0x5190a4);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 137c1c8..eae1388 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=['stringify','catch','error','message','ShowSquareProject','find','info','lodash','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','then','debug'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5388,0x17b));var _0x8538=function(_0xd63b06,_0x34850f){_0xd63b06=_0xd63b06-0x0;var _0x343035=_0x5388[_0xd63b06];return _0x343035;};'use strict';var _=require(_0x8538('0x0'));var Redis=require(_0x8538('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x8538('0x2'))(_0x8538('0x3'));var config=require(_0x8538('0x4'));config[_0x8538('0x5')]=_[_0x8538('0x6')](config[_0x8538('0x5')],{'host':_0x8538('0x7'),'port':0x18eb});var socket=require(_0x8538('0x8'))(new Redis(config['redis']));require(_0x8538('0x9'))[_0x8538('0xa')](socket);exports[_0x8538('0xb')]=function(_0x5dc823){var _0x5c36a8=this;return new Promise(function(_0x4e04d5,_0x3edcc1){return db[_0x8538('0xc')][_0x8538('0xd')]({'raw':_0x5dc823[_0x8538('0xe')]?_0x5dc823[_0x8538('0xe')][_0x8538('0xf')]===undefined?!![]:![]:!![],'where':_0x5dc823[_0x8538('0xe')]?_0x5dc823[_0x8538('0xe')][_0x8538('0x10')]||null:null,'attributes':_0x5dc823[_0x8538('0xe')]?_0x5dc823[_0x8538('0xe')][_0x8538('0x11')]||null:null,'limit':_0x5dc823[_0x8538('0xe')]?_0x5dc823[_0x8538('0xe')][_0x8538('0x12')]||null:null,'include':_0x5dc823['options']?_0x5dc823[_0x8538('0xe')][_0x8538('0x13')]?_['map'](_0x5dc823[_0x8538('0xe')]['include'],function(_0x1ae1e1){return{'model':db[_0x1ae1e1[_0x8538('0x14')]],'as':_0x1ae1e1['as'],'attributes':_0x1ae1e1[_0x8538('0x11')],'include':_0x1ae1e1['include']?_[_0x8538('0x15')](_0x1ae1e1['include'],function(_0x305001){return{'model':db[_0x305001['model']],'as':_0x305001['as'],'attributes':_0x305001[_0x8538('0x11')],'include':_0x305001[_0x8538('0x13')]?_['map'](_0x305001[_0x8538('0x13')],function(_0x4e7cd4){return{'model':db[_0x4e7cd4[_0x8538('0x14')]],'as':_0x4e7cd4['as'],'attributes':_0x4e7cd4['attributes']};}):[]};}):[]};}):[]:[]})[_0x8538('0x16')](function(_0x455cf2){logger['info']('GetSquareProjects',_0x5dc823);logger[_0x8538('0x17')](_0x8538('0xb'),_0x5dc823,JSON[_0x8538('0x18')](_0x455cf2));_0x4e04d5(_0x455cf2);})[_0x8538('0x19')](function(_0x47ea8b){logger[_0x8538('0x1a')](_0x8538('0xb'),_0x47ea8b[_0x8538('0x1b')],_0x5dc823);_0x3edcc1(_0x5c36a8[_0x8538('0x1a')](0x1f4,_0x47ea8b[_0x8538('0x1b')]));});});};exports[_0x8538('0x1c')]=function(_0x2f43ff){var _0x563466=this;return new Promise(function(_0x221dc7,_0xebb50f){return db[_0x8538('0xc')][_0x8538('0x1d')]({'raw':_0x2f43ff[_0x8538('0xe')]?_0x2f43ff[_0x8538('0xe')][_0x8538('0xf')]===undefined?!![]:![]:!![],'where':_0x2f43ff['options']?_0x2f43ff[_0x8538('0xe')]['where']||null:null,'attributes':_0x2f43ff[_0x8538('0xe')]?_0x2f43ff[_0x8538('0xe')][_0x8538('0x11')]||null:null,'include':_0x2f43ff[_0x8538('0xe')]?_0x2f43ff[_0x8538('0xe')][_0x8538('0x13')]?_[_0x8538('0x15')](_0x2f43ff['options'][_0x8538('0x13')],function(_0x50dda4){return{'model':db[_0x50dda4[_0x8538('0x14')]],'as':_0x50dda4['as'],'attributes':_0x50dda4['attributes'],'include':_0x50dda4[_0x8538('0x13')]?_[_0x8538('0x15')](_0x50dda4[_0x8538('0x13')],function(_0xa57909){return{'model':db[_0xa57909['model']],'as':_0xa57909['as'],'attributes':_0xa57909[_0x8538('0x11')],'include':_0xa57909[_0x8538('0x13')]?_['map'](_0xa57909[_0x8538('0x13')],function(_0x35b440){return{'model':db[_0x35b440['model']],'as':_0x35b440['as'],'attributes':_0x35b440[_0x8538('0x11')]};}):[]};}):[]};}):[]:[]})[_0x8538('0x16')](function(_0x3a0748){logger[_0x8538('0x1e')](_0x8538('0x1c'),_0x2f43ff);logger['debug'](_0x8538('0x1c'),_0x2f43ff,JSON[_0x8538('0x18')](_0x3a0748));_0x221dc7(_0x3a0748);})[_0x8538('0x19')](function(_0x517714){logger[_0x8538('0x1a')](_0x8538('0x1c'),_0x517714[_0x8538('0x1b')],_0x2f43ff);_0xebb50f(_0x563466[_0x8538('0x1a')](0x1f4,_0x517714[_0x8538('0x1b')]));});});}; \ No newline at end of file +var _0x5744=['findAll','options','raw','where','attributes','map','include','model','then','info','stringify','catch','message','error','find','debug','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects'];(function(_0x4804a0,_0x2ecc6c){var _0x118114=function(_0x5595e5){while(--_0x5595e5){_0x4804a0['push'](_0x4804a0['shift']());}};_0x118114(++_0x2ecc6c);}(_0x5744,0x129));var _0x4574=function(_0x23a97c,_0x2d19e7){_0x23a97c=_0x23a97c-0x0;var _0xe5e1df=_0x5744[_0x23a97c];return _0xe5e1df;};'use strict';var _=require(_0x4574('0x0'));var Redis=require(_0x4574('0x1'));var db=require(_0x4574('0x2'))['db'];var logger=require(_0x4574('0x3'))('rpc');var config=require(_0x4574('0x4'));config[_0x4574('0x5')]=_[_0x4574('0x6')](config[_0x4574('0x5')],{'host':_0x4574('0x7'),'port':0x18eb});var socket=require(_0x4574('0x8'))(new Redis(config[_0x4574('0x5')]));require(_0x4574('0x9'))['register'](socket);exports[_0x4574('0xa')]=function(_0x552122){var _0x3aa488=this;return new Promise(function(_0x3ff7f0,_0x3cb9fc){return db['SquareProject'][_0x4574('0xb')]({'raw':_0x552122[_0x4574('0xc')]?_0x552122['options'][_0x4574('0xd')]===undefined?!![]:![]:!![],'where':_0x552122[_0x4574('0xc')]?_0x552122[_0x4574('0xc')][_0x4574('0xe')]||null:null,'attributes':_0x552122[_0x4574('0xc')]?_0x552122[_0x4574('0xc')][_0x4574('0xf')]||null:null,'limit':_0x552122[_0x4574('0xc')]?_0x552122[_0x4574('0xc')]['limit']||null:null,'include':_0x552122[_0x4574('0xc')]?_0x552122[_0x4574('0xc')]['include']?_[_0x4574('0x10')](_0x552122['options'][_0x4574('0x11')],function(_0x2c793c){return{'model':db[_0x2c793c[_0x4574('0x12')]],'as':_0x2c793c['as'],'attributes':_0x2c793c[_0x4574('0xf')],'include':_0x2c793c[_0x4574('0x11')]?_[_0x4574('0x10')](_0x2c793c[_0x4574('0x11')],function(_0x485bc6){return{'model':db[_0x485bc6[_0x4574('0x12')]],'as':_0x485bc6['as'],'attributes':_0x485bc6[_0x4574('0xf')],'include':_0x485bc6['include']?_['map'](_0x485bc6[_0x4574('0x11')],function(_0x17d56e){return{'model':db[_0x17d56e['model']],'as':_0x17d56e['as'],'attributes':_0x17d56e[_0x4574('0xf')]};}):[]};}):[]};}):[]:[]})[_0x4574('0x13')](function(_0x4c5671){logger[_0x4574('0x14')](_0x4574('0xa'),_0x552122);logger['debug'](_0x4574('0xa'),_0x552122,JSON[_0x4574('0x15')](_0x4c5671));_0x3ff7f0(_0x4c5671);})[_0x4574('0x16')](function(_0x2bf8d7){logger['error'](_0x4574('0xa'),_0x2bf8d7[_0x4574('0x17')],_0x552122);_0x3cb9fc(_0x3aa488[_0x4574('0x18')](0x1f4,_0x2bf8d7['message']));});});};exports['ShowSquareProject']=function(_0xac9200){var _0x4b3f26=this;return new Promise(function(_0x26cc21,_0x313223){return db['SquareProject'][_0x4574('0x19')]({'raw':_0xac9200['options']?_0xac9200['options'][_0x4574('0xd')]===undefined?!![]:![]:!![],'where':_0xac9200[_0x4574('0xc')]?_0xac9200[_0x4574('0xc')]['where']||null:null,'attributes':_0xac9200[_0x4574('0xc')]?_0xac9200[_0x4574('0xc')][_0x4574('0xf')]||null:null,'include':_0xac9200[_0x4574('0xc')]?_0xac9200['options'][_0x4574('0x11')]?_[_0x4574('0x10')](_0xac9200['options'][_0x4574('0x11')],function(_0x26053f){return{'model':db[_0x26053f[_0x4574('0x12')]],'as':_0x26053f['as'],'attributes':_0x26053f[_0x4574('0xf')],'include':_0x26053f[_0x4574('0x11')]?_[_0x4574('0x10')](_0x26053f[_0x4574('0x11')],function(_0x3827e7){return{'model':db[_0x3827e7[_0x4574('0x12')]],'as':_0x3827e7['as'],'attributes':_0x3827e7[_0x4574('0xf')],'include':_0x3827e7[_0x4574('0x11')]?_[_0x4574('0x10')](_0x3827e7[_0x4574('0x11')],function(_0x3a8cce){return{'model':db[_0x3a8cce[_0x4574('0x12')]],'as':_0x3a8cce['as'],'attributes':_0x3a8cce[_0x4574('0xf')]};}):[]};}):[]};}):[]:[]})[_0x4574('0x13')](function(_0x2d0fea){logger['info']('ShowSquareProject',_0xac9200);logger[_0x4574('0x1a')](_0x4574('0x1b'),_0xac9200,JSON[_0x4574('0x15')](_0x2d0fea));_0x26cc21(_0x2d0fea);})[_0x4574('0x16')](function(_0x4d086a){logger[_0x4574('0x18')]('ShowSquareProject',_0x4d086a[_0x4574('0x17')],_0xac9200);_0x313223(_0x4b3f26[_0x4574('0x18')](0x1f4,_0x4d086a[_0x4574('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c4543d2..9f93e19 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 _0x64f9=['register','length','./squareProject.events','save','remove'];(function(_0x53ca5e,_0x10e2e0){var _0x3bfcd5=function(_0x31b43f){while(--_0x31b43f){_0x53ca5e['push'](_0x53ca5e['shift']());}};_0x3bfcd5(++_0x10e2e0);}(_0x64f9,0x1e7));var _0x964f=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x64f9[_0x2fd69d];return _0x5d5ef3;};'use strict';var SquareProjectEvents=require(_0x964f('0x0'));var events=[_0x964f('0x1'),_0x964f('0x2'),'update'];function createListener(_0x26d647,_0x51c8e2){return function(_0x47f68a){_0x51c8e2['emit'](_0x26d647,_0x47f68a);};}function removeListener(_0xacafbe,_0x5cf361){return function(){SquareProjectEvents['removeListener'](_0xacafbe,_0x5cf361);};}exports[_0x964f('0x3')]=function(_0x4729b4){for(var _0x378a94=0x0,_0x13ada2=events[_0x964f('0x4')];_0x378a94<_0x13ada2;_0x378a94++){var _0x589005=events[_0x378a94];var _0x38b057=createListener('squareProject:'+_0x589005,_0x4729b4);SquareProjectEvents['on'](_0x589005,_0x38b057);}}; \ No newline at end of file +var _0x4306=['./squareProject.events','remove','emit','removeListener','length'];(function(_0x4f6e3b,_0x179b8c){var _0x1073b2=function(_0x536c0a){while(--_0x536c0a){_0x4f6e3b['push'](_0x4f6e3b['shift']());}};_0x1073b2(++_0x179b8c);}(_0x4306,0x172));var _0x6430=function(_0x281be2,_0x5db43){_0x281be2=_0x281be2-0x0;var _0x59830a=_0x4306[_0x281be2];return _0x59830a;};'use strict';var SquareProjectEvents=require(_0x6430('0x0'));var events=['save',_0x6430('0x1'),'update'];function createListener(_0xf21284,_0x2266a9){return function(_0x1c4bc8){_0x2266a9[_0x6430('0x2')](_0xf21284,_0x1c4bc8);};}function removeListener(_0x503e75,_0x7bf85b){return function(){SquareProjectEvents[_0x6430('0x3')](_0x503e75,_0x7bf85b);};}exports['register']=function(_0x271c77){for(var _0x1105ae=0x0,_0x1e715b=events[_0x6430('0x4')];_0x1105ae<_0x1e715b;_0x1105ae++){var _0x4fa45a=events[_0x1105ae];var _0x2f452f=createListener('squareProject:'+_0x4fa45a,_0x271c77);SquareProjectEvents['on'](_0x4fa45a,_0x2f452f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ce06fcc..742da2c 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(_0x1e0590,_0x3447b0){var _0x90460=function(_0x108a33){while(--_0x108a33){_0x1e0590['push'](_0x1e0590['shift']());}};_0x90460(++_0x3447b0);}(_0xf494,0x1c6));var _0x4f49=function(_0xd9fc71,_0x3cd9ee){_0xd9fc71=_0xd9fc71-0x0;var _0x3a03aa=_0xf494[_0xd9fc71];return _0x3a03aa;};'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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x38683c,_0x1d522f){var _0x41a2b2=function(_0x47b0a4){while(--_0x47b0a4){_0x38683c['push'](_0x38683c['shift']());}};_0x41a2b2(++_0x1d522f);}(_0x53ec,0x192));var _0xc53e=function(_0x46800d,_0x588500){_0x46800d=_0x46800d-0x0;var _0x3824cd=_0x53ec[_0x46800d];return _0x3824cd;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 2241cb1..694bca0 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 _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x43bacf,_0x241269){var _0x1f358b=function(_0x3dca79){while(--_0x3dca79){_0x43bacf['push'](_0x43bacf['shift']());}};_0x1f358b(++_0x241269);}(_0x6f47,0xc7));var _0x76f4=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x6f47[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file +var _0xae24=['VIRTUAL','savePath','sequelize','STRING'];(function(_0x51add7,_0x449f37){var _0x35a81e=function(_0xbf9e04){while(--_0xbf9e04){_0x51add7['push'](_0x51add7['shift']());}};_0x35a81e(++_0x449f37);}(_0xae24,0x182));var _0x4ae2=function(_0x4d6b0a,_0x102a14){_0x4d6b0a=_0x4d6b0a-0x0;var _0x44adac=_0xae24[_0x4d6b0a];return _0x44adac;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ae2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4ae2('0x1')]},'context':{'type':Sequelize[_0x4ae2('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ae2('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4ae2('0x1')]},'saveName':{'type':Sequelize[_0x4ae2('0x1')]},'filename':{'type':Sequelize[_0x4ae2('0x1')]},'savePath':{'type':Sequelize[_0x4ae2('0x1')]},'format':{'type':Sequelize[_0x4ae2('0x2')],'get':function(){var _0x307247='';var _0x4f2e84=this['getDataValue'](_0x4ae2('0x3'));if(_0x4f2e84){_0x307247=_0x4f2e84['substring'](_0x4f2e84['lastIndexOf']('.'));}return _0x307247;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 0a188ca..085b61c 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 _0x7fb3=['decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','SquareRecording','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','length','options','find','create','body','params','download','savePath','filename','format','%s.cypher'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7fb3,0xd5));var _0x37fb=function(_0x367816,_0x35633c){_0x367816=_0x367816-0x0;var _0x2cdde2=_0x7fb3[_0x367816];return _0x2cdde2;};'use strict';var emlformat=require(_0x37fb('0x0'));var rimraf=require(_0x37fb('0x1'));var zipdir=require(_0x37fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37fb('0x3'));var moment=require('moment');var BPromise=require(_0x37fb('0x4'));var Mustache=require(_0x37fb('0x5'));var util=require(_0x37fb('0x6'));var path=require(_0x37fb('0x7'));var sox=require(_0x37fb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37fb('0x9'));var squel=require(_0x37fb('0xa'));var crypto=require(_0x37fb('0xb'));var jsforce=require(_0x37fb('0xc'));var deskjs=require(_0x37fb('0xd'));var toCsv=require(_0x37fb('0xe'));var querystring=require(_0x37fb('0xf'));var Papa=require(_0x37fb('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x37fb('0x11'));var as=require(_0x37fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x37fb('0x13'));var utils=require(_0x37fb('0x14'));var config=require(_0x37fb('0x15'));var licenseUtil=require(_0x37fb('0x16'));var db=require(_0x37fb('0x17'))['db'];function respondWithStatusCode(_0x5cd0df,_0x599a21){_0x599a21=_0x599a21||0xcc;return function(_0x385b40){if(_0x385b40){return _0x5cd0df[_0x37fb('0x18')](_0x599a21);}return _0x5cd0df[_0x37fb('0x19')](_0x599a21)[_0x37fb('0x1a')]();};}function respondWithResult(_0x22c928,_0x5f492f){_0x5f492f=_0x5f492f||0xc8;return function(_0x20ac35){if(_0x20ac35){return _0x22c928[_0x37fb('0x19')](_0x5f492f)[_0x37fb('0x1b')](_0x20ac35);}};}function respondWithFilteredResult(_0x54e5cc,_0x5c44b1){return function(_0x114eb9){if(_0x114eb9){var _0x344b14=typeof _0x5c44b1['offset']==='undefined'&&typeof _0x5c44b1['limit']===_0x37fb('0x1c');var _0x427230=_0x114eb9[_0x37fb('0x1d')];var _0x3dc88f=_0x344b14?0x0:_0x5c44b1[_0x37fb('0x1e')];var _0x18f1f0=_0x344b14?_0x114eb9[_0x37fb('0x1d')]:_0x5c44b1['offset']+_0x5c44b1[_0x37fb('0x1f')];var _0x456dc0;if(_0x18f1f0>=_0x427230){_0x18f1f0=_0x427230;_0x456dc0=0xc8;}else{_0x456dc0=0xce;}_0x54e5cc[_0x37fb('0x19')](_0x456dc0);return _0x54e5cc[_0x37fb('0x20')](_0x37fb('0x21'),_0x3dc88f+'-'+_0x18f1f0+'/'+_0x427230)[_0x37fb('0x1b')](_0x114eb9);}return null;};}function patchUpdates(_0x15bc94){return function(_0x517024){try{jsonpatch[_0x37fb('0x22')](_0x517024,_0x15bc94,!![]);}catch(_0x26805a){return BPromise['reject'](_0x26805a);}return _0x517024[_0x37fb('0x23')]();};}function saveUpdates(_0x3afaad,_0xf9d2a6){return function(_0x3d14c9){if(_0x3d14c9){return _0x3d14c9[_0x37fb('0x24')](_0x3afaad)[_0x37fb('0x25')](function(_0xc43f22){return _0xc43f22;});}return null;};}function removeEntity(_0x55ca42,_0x85f376){return function(_0x3eaaa9){if(_0x3eaaa9){return _0x3eaaa9[_0x37fb('0x26')]()[_0x37fb('0x25')](function(){_0x55ca42[_0x37fb('0x19')](0xcc)[_0x37fb('0x1a')]();});}};}function handleEntityNotFound(_0x50847a,_0x58c928){return function(_0x3113ce){if(!_0x3113ce){_0x50847a[_0x37fb('0x18')](0x194);}return _0x3113ce;};}function handleError(_0x20bfcc,_0x29cadb){_0x29cadb=_0x29cadb||0x1f4;return function(_0xb3184c){logger['error'](_0xb3184c[_0x37fb('0x27')]);if(_0xb3184c['name']){delete _0xb3184c[_0x37fb('0x28')];}_0x20bfcc[_0x37fb('0x19')](_0x29cadb)['send'](_0xb3184c);};}exports[_0x37fb('0x29')]=function(_0x1df120,_0x3b4ddf){var _0x553a56={},_0x3f6bfc={},_0x189ea8={'count':0x0,'rows':[]};var _0x3f65f7=_[_0x37fb('0x2a')](db[_0x37fb('0x2b')][_0x37fb('0x2c')],function(_0x215dad){return{'name':_0x215dad['fieldName'],'type':_0x215dad[_0x37fb('0x2d')][_0x37fb('0x2e')]};});_0x3f6bfc['model']=_[_0x37fb('0x2a')](_0x3f65f7,_0x37fb('0x28'));_0x3f6bfc[_0x37fb('0x2f')]=_['keys'](_0x1df120[_0x37fb('0x2f')]);_0x3f6bfc[_0x37fb('0x30')]=_[_0x37fb('0x31')](_0x3f6bfc['model'],_0x3f6bfc[_0x37fb('0x2f')]);_0x553a56[_0x37fb('0x32')]=_['intersection'](_0x3f6bfc[_0x37fb('0x33')],qs[_0x37fb('0x34')](_0x1df120['query'][_0x37fb('0x34')]));_0x553a56[_0x37fb('0x32')]=_0x553a56[_0x37fb('0x32')]['length']?_0x553a56[_0x37fb('0x32')]:_0x3f6bfc[_0x37fb('0x33')];if(!_0x1df120[_0x37fb('0x2f')]['hasOwnProperty'](_0x37fb('0x35'))){_0x553a56[_0x37fb('0x1f')]=qs[_0x37fb('0x1f')](_0x1df120[_0x37fb('0x2f')]['limit']);_0x553a56[_0x37fb('0x1e')]=qs['offset'](_0x1df120[_0x37fb('0x2f')][_0x37fb('0x1e')]);}_0x553a56['order']=qs['sort'](_0x1df120[_0x37fb('0x2f')][_0x37fb('0x36')]);_0x553a56[_0x37fb('0x37')]=qs['filters'](_[_0x37fb('0x38')](_0x1df120[_0x37fb('0x2f')],_0x3f6bfc[_0x37fb('0x30')]),_0x3f65f7);if(_0x1df120[_0x37fb('0x2f')]['filter']){_0x553a56[_0x37fb('0x37')]=_[_0x37fb('0x39')](_0x553a56[_0x37fb('0x37')],{'$or':_['map'](_0x3f65f7,function(_0x511016){if(_0x511016['type']!==_0x37fb('0x3a')){var _0x18e25d={};_0x18e25d[_0x511016[_0x37fb('0x28')]]={'$like':'%'+_0x1df120[_0x37fb('0x2f')][_0x37fb('0x3b')]+'%'};return _0x18e25d;}})});}_0x553a56=_['merge']({},_0x553a56,_0x1df120['options']);var _0x315d1f={'where':_0x553a56[_0x37fb('0x37')]};return db[_0x37fb('0x2b')][_0x37fb('0x1d')](_0x315d1f)[_0x37fb('0x25')](function(_0x2741cf){_0x189ea8['count']=_0x2741cf;if(_0x1df120[_0x37fb('0x2f')][_0x37fb('0x3c')]){_0x553a56[_0x37fb('0x3d')]=[{'all':!![]}];}return db['SquareRecording'][_0x37fb('0x3e')](_0x553a56);})[_0x37fb('0x25')](function(_0x53a9e5){_0x189ea8[_0x37fb('0x3f')]=_0x53a9e5;return _0x189ea8;})[_0x37fb('0x25')](respondWithFilteredResult(_0x3b4ddf,_0x553a56))[_0x37fb('0x40')](handleError(_0x3b4ddf,null));};exports[_0x37fb('0x41')]=function(_0x234a80,_0x4769c4){var _0xe85eb6={'raw':!![],'where':{'id':_0x234a80['params']['id']}},_0x11b25e={};_0x11b25e['model']=_[_0x37fb('0x42')](db[_0x37fb('0x2b')]['rawAttributes']);_0x11b25e[_0x37fb('0x2f')]=_['keys'](_0x234a80[_0x37fb('0x2f')]);_0x11b25e[_0x37fb('0x30')]=_['intersection'](_0x11b25e[_0x37fb('0x33')],_0x11b25e['query']);_0xe85eb6['attributes']=_[_0x37fb('0x31')](_0x11b25e['model'],qs['fields'](_0x234a80[_0x37fb('0x2f')][_0x37fb('0x34')]));_0xe85eb6['attributes']=_0xe85eb6[_0x37fb('0x32')][_0x37fb('0x43')]?_0xe85eb6[_0x37fb('0x32')]:_0x11b25e[_0x37fb('0x33')];if(_0x234a80[_0x37fb('0x2f')][_0x37fb('0x3c')]){_0xe85eb6[_0x37fb('0x3d')]=[{'all':!![]}];}_0xe85eb6=_['merge']({},_0xe85eb6,_0x234a80[_0x37fb('0x44')]);return db['SquareRecording'][_0x37fb('0x45')](_0xe85eb6)[_0x37fb('0x25')](handleEntityNotFound(_0x4769c4,null))[_0x37fb('0x25')](respondWithResult(_0x4769c4,null))[_0x37fb('0x40')](handleError(_0x4769c4,null));};exports[_0x37fb('0x46')]=function(_0x7c518c,_0x291207){return db['SquareRecording'][_0x37fb('0x46')](_0x7c518c[_0x37fb('0x47')],{})['then'](respondWithResult(_0x291207,0xc9))[_0x37fb('0x40')](handleError(_0x291207,null));};exports['update']=function(_0x1378a1,_0x2b1df9){if(_0x1378a1[_0x37fb('0x47')]['id']){delete _0x1378a1['body']['id'];}return db['SquareRecording'][_0x37fb('0x45')]({'where':{'id':_0x1378a1[_0x37fb('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b1df9,null))[_0x37fb('0x25')](saveUpdates(_0x1378a1[_0x37fb('0x47')],null))[_0x37fb('0x25')](respondWithResult(_0x2b1df9,null))[_0x37fb('0x40')](handleError(_0x2b1df9,null));};exports[_0x37fb('0x49')]=function(_0x4b263f,_0x34586a,_0x395d3c){var _0x4022e8=require('../../components/encryptor');var _0x19526d=![];var _0x349751={};if(_0x4b263f[_0x37fb('0x2f')][_0x37fb('0x2d')]&&_0x4b263f[_0x37fb('0x2f')][_0x37fb('0x2d')]==='uniqueid'){_0x349751['uniqueid']=_0x4b263f[_0x37fb('0x48')]['id'];}else{_0x349751['id']=_0x4b263f[_0x37fb('0x48')]['id'];}return db['SquareRecording'][_0x37fb('0x45')]({'where':_0x349751,'attributes':['id',_0x37fb('0x4a'),_0x37fb('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x34586a,null))[_0x37fb('0x25')](function(_0xdd9b89){if(_0xdd9b89){var _0x1c8400=_0xdd9b89[_0x37fb('0x4a')];var _0x23893b=util[_0x37fb('0x4c')](_0x37fb('0x4d'),_0x1c8400);if(fs['existsSync'](_0x23893b)){_0x19526d=!![];return _0x4022e8[_0x37fb('0x4e')](_0x23893b,_0x1c8400,config[_0x37fb('0x4f')][_0x37fb('0x50')])[_0x37fb('0x25')](function(){return _0xdd9b89;});}return _0xdd9b89;}})[_0x37fb('0x25')](function(_0x16f2d5){if(_0x16f2d5){var _0x3f3193=_0x16f2d5[_0x37fb('0x4a')];if(!fs[_0x37fb('0x51')](_0x3f3193)){throw new db[(_0x37fb('0x52'))]['ValidationError'](_0x37fb('0x53'));}if(_0x16f2d5[_0x37fb('0x4b')]){return _0x34586a['download'](_0x3f3193,_0x16f2d5[_0x37fb('0x4b')]+path[_0x37fb('0x54')](_0x3f3193),function(){if(_0x19526d){fs[_0x37fb('0x55')](_0x3f3193);}});}else{return _0x34586a[_0x37fb('0x49')](_0x3f3193,function(_0x1aed14){if(_0x19526d){fs['unlink'](_0x3f3193);}});}}})[_0x37fb('0x40')](function(_0x20f4a5){if(_0x20f4a5[_0x37fb('0x56')]==='SquareRecording\x20not\x20found'){_0x34586a[_0x37fb('0x19')](0x194)[_0x37fb('0x57')](_0x37fb('0x58'));}else{return handleError(_0x34586a,null);}});};exports['destroy']=function(_0x95f949,_0x38f9c2){return db[_0x37fb('0x2b')]['find']({'where':{'id':_0x95f949[_0x37fb('0x48')]['id']}})[_0x37fb('0x25')](function(_0x51e91c){if(_[_0x37fb('0x59')](_0x51e91c)){throw new ReferenceError(_0x37fb('0x5a'));}return _0x51e91c;})[_0x37fb('0x25')](function(_0x1e1d26){var _0x46fc30=_0x1e1d26['savePath'];logger['info'](_0x37fb('0x5b'),_0x46fc30);if(!_[_0x37fb('0x59')](_0x1e1d26[_0x37fb('0x4a')])&&fs[_0x37fb('0x51')](_0x46fc30)){logger[_0x37fb('0x5c')](_0x37fb('0x5d')+_0x46fc30+_0x37fb('0x5e'));fs['unlinkSync'](_0x46fc30);}_0x46fc30=_0x46fc30+_0x37fb('0x5f');if(!_[_0x37fb('0x59')](_0x1e1d26[_0x37fb('0x4a')])&&fs['existsSync'](_0x46fc30)){logger['info'](_0x37fb('0x5d')+_0x46fc30+_0x37fb('0x5e'));fs[_0x37fb('0x60')](_0x46fc30);}return _0x1e1d26;})[_0x37fb('0x25')](function(_0x483fbe){if(!_0x483fbe)throw new InternalError();return _0x483fbe[_0x37fb('0x26')]();})[_0x37fb('0x25')](function(){_0x38f9c2[_0x37fb('0x19')](0xcc)['end']();})['catch'](handleError(_0x38f9c2,null));}; \ No newline at end of file +var _0x146a=['format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','find','download','../../components/encryptor','uniqueid','savePath'];(function(_0x1f4c26,_0x1071f2){var _0x30a853=function(_0x3e3cac){while(--_0x3e3cac){_0x1f4c26['push'](_0x1f4c26['shift']());}};_0x30a853(++_0x1071f2);}(_0x146a,0x195));var _0xa146=function(_0x5a427c,_0x1c7b6f){_0x5a427c=_0x5a427c-0x0;var _0xc17e0d=_0x146a[_0x5a427c];return _0xc17e0d;};'use strict';var emlformat=require(_0xa146('0x0'));var rimraf=require(_0xa146('0x1'));var zipdir=require(_0xa146('0x2'));var jsonpatch=require(_0xa146('0x3'));var rp=require(_0xa146('0x4'));var moment=require('moment');var BPromise=require(_0xa146('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa146('0x6'));var sox=require(_0xa146('0x7'));var csv=require(_0xa146('0x8'));var ejs=require(_0xa146('0x9'));var fs=require('fs');var fs_extra=require(_0xa146('0xa'));var _=require('lodash');var squel=require(_0xa146('0xb'));var crypto=require(_0xa146('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa146('0x8'));var querystring=require(_0xa146('0xd'));var Papa=require(_0xa146('0xe'));var Redis=require(_0xa146('0xf'));var authService=require(_0xa146('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa146('0x11'));var logger=require('../../config/logger')(_0xa146('0x12'));var utils=require(_0xa146('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa146('0x14'));var db=require(_0xa146('0x15'))['db'];function respondWithStatusCode(_0x3273c7,_0xddf866){_0xddf866=_0xddf866||0xcc;return function(_0x4219de){if(_0x4219de){return _0x3273c7[_0xa146('0x16')](_0xddf866);}return _0x3273c7[_0xa146('0x17')](_0xddf866)[_0xa146('0x18')]();};}function respondWithResult(_0x221b41,_0x1fb931){_0x1fb931=_0x1fb931||0xc8;return function(_0x4716b9){if(_0x4716b9){return _0x221b41[_0xa146('0x17')](_0x1fb931)[_0xa146('0x19')](_0x4716b9);}};}function respondWithFilteredResult(_0x1ca248,_0x3cf623){return function(_0x29c86e){if(_0x29c86e){var _0x93f2d2=typeof _0x3cf623['offset']===_0xa146('0x1a')&&typeof _0x3cf623[_0xa146('0x1b')]==='undefined';var _0x272eee=_0x29c86e[_0xa146('0x1c')];var _0x534bec=_0x93f2d2?0x0:_0x3cf623[_0xa146('0x1d')];var _0x492cf7=_0x93f2d2?_0x29c86e['count']:_0x3cf623[_0xa146('0x1d')]+_0x3cf623[_0xa146('0x1b')];var _0x35ddfc;if(_0x492cf7>=_0x272eee){_0x492cf7=_0x272eee;_0x35ddfc=0xc8;}else{_0x35ddfc=0xce;}_0x1ca248[_0xa146('0x17')](_0x35ddfc);return _0x1ca248['set'](_0xa146('0x1e'),_0x534bec+'-'+_0x492cf7+'/'+_0x272eee)[_0xa146('0x19')](_0x29c86e);}return null;};}function patchUpdates(_0x111a16){return function(_0x8c4b03){try{jsonpatch[_0xa146('0x1f')](_0x8c4b03,_0x111a16,!![]);}catch(_0x1ba68a){return BPromise['reject'](_0x1ba68a);}return _0x8c4b03['save']();};}function saveUpdates(_0x8b4e3f,_0x2aa589){return function(_0x99b0b7){if(_0x99b0b7){return _0x99b0b7[_0xa146('0x20')](_0x8b4e3f)[_0xa146('0x21')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x114c5c,_0x191fc4){return function(_0x113f27){if(_0x113f27){return _0x113f27[_0xa146('0x22')]()[_0xa146('0x21')](function(){_0x114c5c[_0xa146('0x17')](0xcc)[_0xa146('0x18')]();});}};}function handleEntityNotFound(_0x1d84e2,_0x3b3e04){return function(_0x1ed01c){if(!_0x1ed01c){_0x1d84e2['sendStatus'](0x194);}return _0x1ed01c;};}function handleError(_0xd2528b,_0x4af532){_0x4af532=_0x4af532||0x1f4;return function(_0x2fe115){logger[_0xa146('0x23')](_0x2fe115[_0xa146('0x24')]);if(_0x2fe115[_0xa146('0x25')]){delete _0x2fe115[_0xa146('0x25')];}_0xd2528b[_0xa146('0x17')](_0x4af532)[_0xa146('0x26')](_0x2fe115);};}exports[_0xa146('0x27')]=function(_0x40594e,_0x13ff97){var _0x4a2762={},_0xcaaee9={},_0x2e709c={'count':0x0,'rows':[]};var _0x39f066=_[_0xa146('0x28')](db[_0xa146('0x29')][_0xa146('0x2a')],function(_0x25c4c5){return{'name':_0x25c4c5[_0xa146('0x2b')],'type':_0x25c4c5['type'][_0xa146('0x2c')]};});_0xcaaee9['model']=_[_0xa146('0x28')](_0x39f066,'name');_0xcaaee9['query']=_[_0xa146('0x2d')](_0x40594e[_0xa146('0x2e')]);_0xcaaee9[_0xa146('0x2f')]=_[_0xa146('0x30')](_0xcaaee9['model'],_0xcaaee9['query']);_0x4a2762['attributes']=_[_0xa146('0x30')](_0xcaaee9[_0xa146('0x31')],qs[_0xa146('0x32')](_0x40594e['query'][_0xa146('0x32')]));_0x4a2762[_0xa146('0x33')]=_0x4a2762[_0xa146('0x33')][_0xa146('0x34')]?_0x4a2762[_0xa146('0x33')]:_0xcaaee9[_0xa146('0x31')];if(!_0x40594e[_0xa146('0x2e')]['hasOwnProperty'](_0xa146('0x35'))){_0x4a2762['limit']=qs[_0xa146('0x1b')](_0x40594e[_0xa146('0x2e')][_0xa146('0x1b')]);_0x4a2762[_0xa146('0x1d')]=qs['offset'](_0x40594e['query'][_0xa146('0x1d')]);}_0x4a2762['order']=qs[_0xa146('0x36')](_0x40594e[_0xa146('0x2e')][_0xa146('0x36')]);_0x4a2762['where']=qs[_0xa146('0x2f')](_[_0xa146('0x37')](_0x40594e[_0xa146('0x2e')],_0xcaaee9[_0xa146('0x2f')]),_0x39f066);if(_0x40594e['query'][_0xa146('0x38')]){_0x4a2762[_0xa146('0x39')]=_[_0xa146('0x3a')](_0x4a2762[_0xa146('0x39')],{'$or':_['map'](_0x39f066,function(_0x46e99d){if(_0x46e99d[_0xa146('0x3b')]!==_0xa146('0x3c')){var _0x1530f7={};_0x1530f7[_0x46e99d[_0xa146('0x25')]]={'$like':'%'+_0x40594e[_0xa146('0x2e')][_0xa146('0x38')]+'%'};return _0x1530f7;}})});}_0x4a2762=_['merge']({},_0x4a2762,_0x40594e[_0xa146('0x3d')]);var _0x22b458={'where':_0x4a2762['where']};return db[_0xa146('0x29')][_0xa146('0x1c')](_0x22b458)[_0xa146('0x21')](function(_0x357d28){_0x2e709c[_0xa146('0x1c')]=_0x357d28;if(_0x40594e[_0xa146('0x2e')][_0xa146('0x3e')]){_0x4a2762[_0xa146('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0xa146('0x40')](_0x4a2762);})[_0xa146('0x21')](function(_0x5a83e){_0x2e709c['rows']=_0x5a83e;return _0x2e709c;})[_0xa146('0x21')](respondWithFilteredResult(_0x13ff97,_0x4a2762))['catch'](handleError(_0x13ff97,null));};exports[_0xa146('0x41')]=function(_0x39762c,_0x2c39e3){var _0x2e809f={'raw':!![],'where':{'id':_0x39762c[_0xa146('0x42')]['id']}},_0x38270d={};_0x38270d['model']=_[_0xa146('0x2d')](db[_0xa146('0x29')][_0xa146('0x2a')]);_0x38270d['query']=_[_0xa146('0x2d')](_0x39762c[_0xa146('0x2e')]);_0x38270d[_0xa146('0x2f')]=_[_0xa146('0x30')](_0x38270d[_0xa146('0x31')],_0x38270d[_0xa146('0x2e')]);_0x2e809f[_0xa146('0x33')]=_[_0xa146('0x30')](_0x38270d[_0xa146('0x31')],qs[_0xa146('0x32')](_0x39762c[_0xa146('0x2e')][_0xa146('0x32')]));_0x2e809f[_0xa146('0x33')]=_0x2e809f['attributes'][_0xa146('0x34')]?_0x2e809f[_0xa146('0x33')]:_0x38270d[_0xa146('0x31')];if(_0x39762c['query'][_0xa146('0x3e')]){_0x2e809f[_0xa146('0x3f')]=[{'all':!![]}];}_0x2e809f=_['merge']({},_0x2e809f,_0x39762c[_0xa146('0x3d')]);return db[_0xa146('0x29')]['find'](_0x2e809f)[_0xa146('0x21')](handleEntityNotFound(_0x2c39e3,null))['then'](respondWithResult(_0x2c39e3,null))[_0xa146('0x43')](handleError(_0x2c39e3,null));};exports[_0xa146('0x44')]=function(_0x55249d,_0x22a464){return db['SquareRecording'][_0xa146('0x44')](_0x55249d['body'],{})[_0xa146('0x21')](respondWithResult(_0x22a464,0xc9))[_0xa146('0x43')](handleError(_0x22a464,null));};exports['update']=function(_0x324c92,_0x4eedb7){if(_0x324c92['body']['id']){delete _0x324c92[_0xa146('0x45')]['id'];}return db[_0xa146('0x29')][_0xa146('0x46')]({'where':{'id':_0x324c92[_0xa146('0x42')]['id']}})['then'](handleEntityNotFound(_0x4eedb7,null))['then'](saveUpdates(_0x324c92['body'],null))['then'](respondWithResult(_0x4eedb7,null))[_0xa146('0x43')](handleError(_0x4eedb7,null));};exports[_0xa146('0x47')]=function(_0x3371c3,_0x18bdd5,_0x26dc17){var _0x5f28d0=require(_0xa146('0x48'));var _0x3959ff=![];var _0x15db47={};if(_0x3371c3[_0xa146('0x2e')][_0xa146('0x3b')]&&_0x3371c3['query']['type']===_0xa146('0x49')){_0x15db47['uniqueid']=_0x3371c3['params']['id'];}else{_0x15db47['id']=_0x3371c3[_0xa146('0x42')]['id'];}return db['SquareRecording'][_0xa146('0x46')]({'where':_0x15db47,'attributes':['id',_0xa146('0x4a'),'filename'],'raw':!![]})[_0xa146('0x21')](handleEntityNotFound(_0x18bdd5,null))[_0xa146('0x21')](function(_0xefd4ca){if(_0xefd4ca){var _0x3b2577=_0xefd4ca['savePath'];var _0x10b045=util[_0xa146('0x4b')](_0xa146('0x4c'),_0x3b2577);if(fs[_0xa146('0x4d')](_0x10b045)){_0x3959ff=!![];return _0x5f28d0[_0xa146('0x4e')](_0x10b045,_0x3b2577,config[_0xa146('0x4f')][_0xa146('0x50')])[_0xa146('0x21')](function(){return _0xefd4ca;});}return _0xefd4ca;}})['then'](function(_0x38736f){if(_0x38736f){var _0x493956=_0x38736f[_0xa146('0x4a')];if(!fs[_0xa146('0x4d')](_0x493956)){throw new db[(_0xa146('0x51'))]['ValidationError'](_0xa146('0x52'));}if(_0x38736f[_0xa146('0x53')]){return _0x18bdd5[_0xa146('0x47')](_0x493956,_0x38736f[_0xa146('0x53')]+path[_0xa146('0x54')](_0x493956),function(){if(_0x3959ff){fs[_0xa146('0x55')](_0x493956);}});}else{return _0x18bdd5[_0xa146('0x47')](_0x493956,function(_0x754ddf){if(_0x3959ff){fs[_0xa146('0x55')](_0x493956);}});}}})[_0xa146('0x43')](function(_0x122f00){if(_0x122f00[_0xa146('0x56')]===_0xa146('0x52')){_0x18bdd5['status'](0x194)[_0xa146('0x26')](_0xa146('0x57'));}else{return handleError(_0x18bdd5,null);}});};exports[_0xa146('0x22')]=function(_0x429230,_0x3f36d9){return db['SquareRecording'][_0xa146('0x46')]({'where':{'id':_0x429230[_0xa146('0x42')]['id']}})[_0xa146('0x21')](function(_0x464bf1){if(_[_0xa146('0x58')](_0x464bf1)){throw new ReferenceError(_0xa146('0x59'));}return _0x464bf1;})['then'](function(_0x12a4d8){var _0x26ebaa=_0x12a4d8[_0xa146('0x4a')];logger[_0xa146('0x5a')](_0xa146('0x5b'),_0x26ebaa);if(!_[_0xa146('0x58')](_0x12a4d8['savePath'])&&fs[_0xa146('0x4d')](_0x26ebaa)){logger['info'](_0xa146('0x5c')+_0x26ebaa+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa146('0x5d')](_0x26ebaa);}_0x26ebaa=_0x26ebaa+_0xa146('0x5e');if(!_['isNil'](_0x12a4d8[_0xa146('0x4a')])&&fs[_0xa146('0x4d')](_0x26ebaa)){logger[_0xa146('0x5a')](_0xa146('0x5c')+_0x26ebaa+_0xa146('0x5f'));fs[_0xa146('0x5d')](_0x26ebaa);}return _0x12a4d8;})['then'](function(_0x2aefe2){if(!_0x2aefe2)throw new InternalError();return _0x2aefe2[_0xa146('0x22')]();})['then'](function(){_0x3f36d9[_0xa146('0x17')](0xcc)[_0xa146('0x18')]();})[_0xa146('0x43')](handleError(_0x3f36d9,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1f2b7e6..dd60f7c 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 _0xed20=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x32fcaa,_0xb7d04){var _0xae52a4=function(_0x7bf594){while(--_0x7bf594){_0x32fcaa['push'](_0x32fcaa['shift']());}};_0xae52a4(++_0xb7d04);}(_0xed20,0xce));var _0x0ed2=function(_0x12d9c1,_0x5da90d){_0x12d9c1=_0x12d9c1-0x0;var _0x5360f7=_0xed20[_0x12d9c1];return _0x5360f7;};'use strict';var _=require(_0x0ed2('0x0'));var util=require(_0x0ed2('0x1'));var logger=require(_0x0ed2('0x2'))('api');var moment=require(_0x0ed2('0x3'));var BPromise=require(_0x0ed2('0x4'));var rp=require(_0x0ed2('0x5'));var fs=require('fs');var path=require(_0x0ed2('0x6'));var rimraf=require(_0x0ed2('0x7'));var config=require(_0x0ed2('0x8'));var attributes=require('./squareRecording.attributes');module[_0x0ed2('0x9')]=function(_0x88640a,_0x5c686a){return _0x88640a[_0x0ed2('0xa')](_0x0ed2('0xb'),attributes,{'tableName':_0x0ed2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb61=['rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x437545,_0x4ab48b){var _0x408060=function(_0x564586){while(--_0x564586){_0x437545['push'](_0x437545['shift']());}};_0x408060(++_0x4ab48b);}(_0xbb61,0x131));var _0x1bb6=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xbb61[_0x270adf];return _0x29eda9;};'use strict';var _=require(_0x1bb6('0x0'));var util=require('util');var logger=require(_0x1bb6('0x1'))(_0x1bb6('0x2'));var moment=require(_0x1bb6('0x3'));var BPromise=require(_0x1bb6('0x4'));var rp=require(_0x1bb6('0x5'));var fs=require('fs');var path=require(_0x1bb6('0x6'));var rimraf=require(_0x1bb6('0x7'));var config=require('../../config/environment');var attributes=require(_0x1bb6('0x8'));module[_0x1bb6('0x9')]=function(_0x2d59c2,_0x4e4b01){return _0x2d59c2[_0x1bb6('0xa')](_0x1bb6('0xb'),attributes,{'tableName':_0x1bb6('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 fde11c0..038a7f9 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 _0x2032=['stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then'];(function(_0x1434df,_0x3bbb32){var _0x260317=function(_0x34c365){while(--_0x34c365){_0x1434df['push'](_0x1434df['shift']());}};_0x260317(++_0x3bbb32);}(_0x2032,0xd9));var _0x2203=function(_0x3a4d46,_0xbdc3e6){_0x3a4d46=_0x3a4d46-0x0;var _0x2a5506=_0x2032[_0x3a4d46];return _0x2a5506;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SquareRecording,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SquareRecording,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['create'](_0x4893ff[_0x2203('0x16')],{'raw':_0x4893ff[_0x2203('0x17')]?_0x4893ff[_0x2203('0x17')][_0x2203('0x18')]===undefined?!![]:![]:!![]})[_0x2203('0x19')](function(_0x449039){logger['info'](_0x2203('0x14'),_0x4893ff);logger['debug']('CreateSquareRecording',_0x4893ff,JSON[_0x2203('0x1a')](_0x449039));_0x8906e1(_0x449039);})['catch'](function(_0x3b8ef9){logger[_0x2203('0xe')]('CreateSquareRecording',_0x3b8ef9[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6['error'](0x1f4,_0x3b8ef9['message']));});});}; \ No newline at end of file +var _0x9334=['result','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','stringify','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5c496d,_0x46795c){var _0x230b83=function(_0x4e1040){while(--_0x4e1040){_0x5c496d['push'](_0x5c496d['shift']());}};_0x230b83(++_0x46795c);}(_0x9334,0xd1));var _0x4933=function(_0xeb36e4,_0x2faa0c){_0xeb36e4=_0xeb36e4-0x0;var _0x5233b1=_0x9334[_0xeb36e4];return _0x5233b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4933('0x0'));var BPromise=require('bluebird');var rs=require(_0x4933('0x1'));var fs=require('fs');var Redis=require(_0x4933('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4933('0x3'))(_0x4933('0x4'));var config=require(_0x4933('0x5'));var jayson=require(_0x4933('0x6'));var client=jayson['client'][_0x4933('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd5bc6,_0x3d6500,_0x6ff0b8){return new BPromise(function(_0x42b495,_0x45f284){return client[_0x4933('0x8')](_0xd5bc6,_0x6ff0b8)[_0x4933('0x9')](function(_0x1b1cbc){logger[_0x4933('0xa')](_0x4933('0xb'),_0x3d6500,_0x4933('0xc'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3d6500,'request\x20sent',JSON['stringify'](_0x1b1cbc));if(_0x1b1cbc[_0x4933('0xd')]){if(_0x1b1cbc[_0x4933('0xd')][_0x4933('0xe')]===0x1f4){logger[_0x4933('0xd')](_0x4933('0xb'),_0x3d6500,_0x1b1cbc[_0x4933('0xd')]['message']);return _0x45f284(_0x1b1cbc[_0x4933('0xd')]['message']);}logger[_0x4933('0xd')](_0x4933('0xb'),_0x3d6500,_0x1b1cbc[_0x4933('0xd')][_0x4933('0xf')]);return _0x42b495(_0x1b1cbc[_0x4933('0xd')][_0x4933('0xf')]);}else{logger[_0x4933('0xa')](_0x4933('0xb'),_0x3d6500,_0x4933('0xc'));_0x42b495(_0x1b1cbc[_0x4933('0x10')][_0x4933('0xf')]);}})['catch'](function(_0x2aa2d5){logger['error'](_0x4933('0xb'),_0x3d6500,_0x2aa2d5);_0x45f284(_0x2aa2d5);});});}exports[_0x4933('0x11')]=function(_0x5ccf87){var _0x4c05b8=this;return new Promise(function(_0x264553,_0x2b24e3){return db[_0x4933('0x12')][_0x4933('0x13')](_0x5ccf87[_0x4933('0x14')],{'raw':_0x5ccf87['options']?_0x5ccf87[_0x4933('0x15')][_0x4933('0x16')]===undefined?!![]:![]:!![]})[_0x4933('0x9')](function(_0x42865f){logger['info'](_0x4933('0x11'),_0x5ccf87);logger[_0x4933('0x17')](_0x4933('0x11'),_0x5ccf87,JSON[_0x4933('0x18')](_0x42865f));_0x264553(_0x42865f);})['catch'](function(_0x3eb0bb){logger[_0x4933('0xd')](_0x4933('0x11'),_0x3eb0bb[_0x4933('0xf')],_0x5ccf87);_0x2b24e3(_0x4c05b8[_0x4933('0xd')](0x1f4,_0x3eb0bb['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 004fb5f..72c7f36 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xb4aa51,_0x1f7f1a){var _0x4fde40=function(_0x2a60f9){while(--_0x2a60f9){_0xb4aa51['push'](_0xb4aa51['shift']());}};_0x4fde40(++_0x1f7f1a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 44d4bcb..a740a40 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 _0x9afd=['BOOLEAN','exports','STRING','DATE'];(function(_0x438dad,_0x35c476){var _0x39e84d=function(_0x3be8d0){while(--_0x3be8d0){_0x438dad['push'](_0x438dad['shift']());}};_0x39e84d(++_0x35c476);}(_0x9afd,0xf9));var _0xd9af=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x9afd[_0x104e21];return _0x605b37;};'use strict';var Sequelize=require('sequelize');module[_0xd9af('0x0')]={'network':{'type':Sequelize[_0xd9af('0x1')]},'network_script':{'type':Sequelize[_0xd9af('0x1')]},'request':{'type':Sequelize[_0xd9af('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd9af('0x1')]},'type':{'type':Sequelize[_0xd9af('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xd9af('0x1')]},'callerid':{'type':Sequelize[_0xd9af('0x1')]},'calleridname':{'type':Sequelize[_0xd9af('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xd9af('0x1')]},'callington':{'type':Sequelize[_0xd9af('0x1')]},'callingtns':{'type':Sequelize[_0xd9af('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xd9af('0x1')]},'context':{'type':Sequelize[_0xd9af('0x1')]},'extension':{'type':Sequelize[_0xd9af('0x1')]},'priority':{'type':Sequelize[_0xd9af('0x1')]},'enhanced':{'type':Sequelize[_0xd9af('0x1')]},'accountcode':{'type':Sequelize[_0xd9af('0x1')]},'threadid':{'type':Sequelize[_0xd9af('0x1')]},'project_name':{'type':Sequelize[_0xd9af('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd9af('0x2')]},'bot':{'type':Sequelize[_0xd9af('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5a4d=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2da33e,_0x4c3d69){var _0xee9d45=function(_0x2da6d1){while(--_0x2da6d1){_0x2da33e['push'](_0x2da33e['shift']());}};_0xee9d45(++_0x4c3d69);}(_0x5a4d,0x1c2));var _0xd5a4=function(_0x68b568,_0x1a04e8){_0x68b568=_0x68b568-0x0;var _0xdc8cc4=_0x5a4d[_0x68b568];return _0xdc8cc4;};'use strict';var Sequelize=require(_0xd5a4('0x0'));module[_0xd5a4('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xd5a4('0x2')]},'request':{'type':Sequelize[_0xd5a4('0x2')]},'channel':{'type':Sequelize[_0xd5a4('0x2')]},'language':{'type':Sequelize[_0xd5a4('0x2')]},'type':{'type':Sequelize[_0xd5a4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd5a4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xd5a4('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xd5a4('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xd5a4('0x2')]},'context':{'type':Sequelize[_0xd5a4('0x2')]},'extension':{'type':Sequelize[_0xd5a4('0x2')]},'priority':{'type':Sequelize[_0xd5a4('0x2')]},'enhanced':{'type':Sequelize[_0xd5a4('0x2')]},'accountcode':{'type':Sequelize[_0xd5a4('0x2')]},'threadid':{'type':Sequelize[_0xd5a4('0x2')]},'project_name':{'type':Sequelize[_0xd5a4('0x2')]},'joinAt':{'type':Sequelize[_0xd5a4('0x3')]},'leaveAt':{'type':Sequelize[_0xd5a4('0x3')]},'bot':{'type':Sequelize[_0xd5a4('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b9cef62..d7ce33b 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 _0x4324=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','type','key','model','filters','attributes','intersection','query','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x2a15e5,_0x251c18){var _0x317590=function(_0x5484a8){while(--_0x5484a8){_0x2a15e5['push'](_0x2a15e5['shift']());}};_0x317590(++_0x251c18);}(_0x4324,0x113));var _0x4432=function(_0x597eb2,_0x165f5c){_0x597eb2=_0x597eb2-0x0;var _0x56875f=_0x4324[_0x597eb2];return _0x56875f;};'use strict';var emlformat=require(_0x4432('0x0'));var rimraf=require(_0x4432('0x1'));var zipdir=require(_0x4432('0x2'));var jsonpatch=require(_0x4432('0x3'));var rp=require(_0x4432('0x4'));var moment=require(_0x4432('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4432('0x6'));var path=require('path');var sox=require(_0x4432('0x7'));var csv=require(_0x4432('0x8'));var ejs=require(_0x4432('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4432('0xa'));var squel=require(_0x4432('0xb'));var crypto=require(_0x4432('0xc'));var jsforce=require(_0x4432('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4432('0x8'));var querystring=require('querystring');var Papa=require(_0x4432('0xe'));var Redis=require(_0x4432('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4432('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4432('0x11'));var logger=require('../../config/logger')(_0x4432('0x12'));var utils=require(_0x4432('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4432('0x14'));var db=require(_0x4432('0x15'))['db'];function respondWithStatusCode(_0x37e052,_0x5a5630){_0x5a5630=_0x5a5630||0xcc;return function(_0x4ee7e4){if(_0x4ee7e4){return _0x37e052[_0x4432('0x16')](_0x5a5630);}return _0x37e052[_0x4432('0x17')](_0x5a5630)[_0x4432('0x18')]();};}function respondWithResult(_0x436aa6,_0x22a9d){_0x22a9d=_0x22a9d||0xc8;return function(_0x59b7e6){if(_0x59b7e6){return _0x436aa6[_0x4432('0x17')](_0x22a9d)[_0x4432('0x19')](_0x59b7e6);}};}function respondWithFilteredResult(_0x1cdbb5,_0x5313af){return function(_0x21b83b){if(_0x21b83b){var _0x57d0b1=typeof _0x5313af[_0x4432('0x1a')]===_0x4432('0x1b')&&typeof _0x5313af[_0x4432('0x1c')]===_0x4432('0x1b');var _0x328707=_0x21b83b['count'];var _0x619810=_0x57d0b1?0x0:_0x5313af[_0x4432('0x1a')];var _0x5011bc=_0x57d0b1?_0x21b83b[_0x4432('0x1d')]:_0x5313af['offset']+_0x5313af[_0x4432('0x1c')];var _0x3e3b6a;if(_0x5011bc>=_0x328707){_0x5011bc=_0x328707;_0x3e3b6a=0xc8;}else{_0x3e3b6a=0xce;}_0x1cdbb5[_0x4432('0x17')](_0x3e3b6a);return _0x1cdbb5[_0x4432('0x1e')](_0x4432('0x1f'),_0x619810+'-'+_0x5011bc+'/'+_0x328707)[_0x4432('0x19')](_0x21b83b);}return null;};}function patchUpdates(_0x4d0824){return function(_0x598f82){try{jsonpatch['apply'](_0x598f82,_0x4d0824,!![]);}catch(_0x7716e2){return BPromise[_0x4432('0x20')](_0x7716e2);}return _0x598f82[_0x4432('0x21')]();};}function saveUpdates(_0x46d057,_0x447b51){return function(_0x2c28a1){if(_0x2c28a1){return _0x2c28a1[_0x4432('0x22')](_0x46d057)[_0x4432('0x23')](function(_0x57636c){return _0x57636c;});}return null;};}function removeEntity(_0x3d54e0,_0x8aed9){return function(_0x325dbf){if(_0x325dbf){return _0x325dbf[_0x4432('0x24')]()[_0x4432('0x23')](function(){_0x3d54e0[_0x4432('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34168a,_0x6238c0){return function(_0x286b4b){if(!_0x286b4b){_0x34168a[_0x4432('0x16')](0x194);}return _0x286b4b;};}function handleError(_0x548cee,_0x3efca0){_0x3efca0=_0x3efca0||0x1f4;return function(_0x50a8c5){logger[_0x4432('0x25')](_0x50a8c5['stack']);if(_0x50a8c5[_0x4432('0x26')]){delete _0x50a8c5[_0x4432('0x26')];}_0x548cee[_0x4432('0x17')](_0x3efca0)['send'](_0x50a8c5);};}exports[_0x4432('0x27')]=function(_0x4db3c8,_0x1175ca){var _0x26ca66={},_0x5d56ac={},_0x211c90={'count':0x0,'rows':[]};var _0x53c7ed=_[_0x4432('0x28')](db['SquareReport']['rawAttributes'],function(_0x14357e){return{'name':_0x14357e['fieldName'],'type':_0x14357e[_0x4432('0x29')][_0x4432('0x2a')]};});_0x5d56ac[_0x4432('0x2b')]=_[_0x4432('0x28')](_0x53c7ed,_0x4432('0x26'));_0x5d56ac['query']=_['keys'](_0x4db3c8['query']);_0x5d56ac[_0x4432('0x2c')]=_['intersection'](_0x5d56ac[_0x4432('0x2b')],_0x5d56ac['query']);_0x26ca66[_0x4432('0x2d')]=_[_0x4432('0x2e')](_0x5d56ac[_0x4432('0x2b')],qs['fields'](_0x4db3c8[_0x4432('0x2f')][_0x4432('0x30')]));_0x26ca66[_0x4432('0x2d')]=_0x26ca66[_0x4432('0x2d')]['length']?_0x26ca66['attributes']:_0x5d56ac['model'];if(!_0x4db3c8[_0x4432('0x2f')][_0x4432('0x31')](_0x4432('0x32'))){_0x26ca66[_0x4432('0x1c')]=qs[_0x4432('0x1c')](_0x4db3c8[_0x4432('0x2f')][_0x4432('0x1c')]);_0x26ca66[_0x4432('0x1a')]=qs[_0x4432('0x1a')](_0x4db3c8['query']['offset']);}_0x26ca66[_0x4432('0x33')]=qs['sort'](_0x4db3c8['query'][_0x4432('0x34')]);_0x26ca66[_0x4432('0x35')]=qs[_0x4432('0x2c')](_[_0x4432('0x36')](_0x4db3c8[_0x4432('0x2f')],_0x5d56ac[_0x4432('0x2c')]),_0x53c7ed);if(_0x4db3c8[_0x4432('0x2f')][_0x4432('0x37')]){_0x26ca66[_0x4432('0x35')]=_[_0x4432('0x38')](_0x26ca66[_0x4432('0x35')],{'$or':_[_0x4432('0x28')](_0x53c7ed,function(_0x4d3fa7){if(_0x4d3fa7[_0x4432('0x29')]!==_0x4432('0x39')){var _0x46cec5={};_0x46cec5[_0x4d3fa7[_0x4432('0x26')]]={'$like':'%'+_0x4db3c8['query']['filter']+'%'};return _0x46cec5;}})});}_0x26ca66=_['merge']({},_0x26ca66,_0x4db3c8[_0x4432('0x3a')]);var _0x2f9ace={'where':_0x26ca66[_0x4432('0x35')]};return db[_0x4432('0x3b')][_0x4432('0x1d')](_0x2f9ace)['then'](function(_0x40ca44){_0x211c90[_0x4432('0x1d')]=_0x40ca44;if(_0x4db3c8[_0x4432('0x2f')][_0x4432('0x3c')]){_0x26ca66[_0x4432('0x3d')]=[{'all':!![]}];}return db[_0x4432('0x3b')][_0x4432('0x3e')](_0x26ca66);})['then'](function(_0x42869f){_0x211c90[_0x4432('0x3f')]=_0x42869f;return _0x211c90;})[_0x4432('0x23')](respondWithFilteredResult(_0x1175ca,_0x26ca66))[_0x4432('0x40')](handleError(_0x1175ca,null));};exports[_0x4432('0x41')]=function(_0x15bac5,_0x2583e5){var _0x75fdcf={'raw':!![],'where':{'id':_0x15bac5['params']['id']}},_0x24cb14={};_0x24cb14[_0x4432('0x2b')]=_[_0x4432('0x42')](db[_0x4432('0x3b')][_0x4432('0x43')]);_0x24cb14[_0x4432('0x2f')]=_[_0x4432('0x42')](_0x15bac5[_0x4432('0x2f')]);_0x24cb14['filters']=_[_0x4432('0x2e')](_0x24cb14[_0x4432('0x2b')],_0x24cb14[_0x4432('0x2f')]);_0x75fdcf[_0x4432('0x2d')]=_[_0x4432('0x2e')](_0x24cb14['model'],qs[_0x4432('0x30')](_0x15bac5[_0x4432('0x2f')][_0x4432('0x30')]));_0x75fdcf[_0x4432('0x2d')]=_0x75fdcf[_0x4432('0x2d')][_0x4432('0x44')]?_0x75fdcf[_0x4432('0x2d')]:_0x24cb14[_0x4432('0x2b')];if(_0x15bac5[_0x4432('0x2f')][_0x4432('0x3c')]){_0x75fdcf[_0x4432('0x3d')]=[{'all':!![]}];}_0x75fdcf=_[_0x4432('0x38')]({},_0x75fdcf,_0x15bac5['options']);return db[_0x4432('0x3b')][_0x4432('0x45')](_0x75fdcf)[_0x4432('0x23')](handleEntityNotFound(_0x2583e5,null))[_0x4432('0x23')](respondWithResult(_0x2583e5,null))[_0x4432('0x40')](handleError(_0x2583e5,null));};exports[_0x4432('0x46')]=function(_0x1e48a4,_0x158a63){return db[_0x4432('0x3b')][_0x4432('0x46')](_0x1e48a4['body'],{})['then'](respondWithResult(_0x158a63,0xc9))['catch'](handleError(_0x158a63,null));};exports[_0x4432('0x22')]=function(_0x1a9786,_0x459730){if(_0x1a9786[_0x4432('0x47')]['id']){delete _0x1a9786[_0x4432('0x47')]['id'];}return db[_0x4432('0x3b')][_0x4432('0x45')]({'where':{'id':_0x1a9786[_0x4432('0x48')]['id']}})[_0x4432('0x23')](handleEntityNotFound(_0x459730,null))[_0x4432('0x23')](saveUpdates(_0x1a9786[_0x4432('0x47')],null))[_0x4432('0x23')](respondWithResult(_0x459730,null))[_0x4432('0x40')](handleError(_0x459730,null));};exports[_0x4432('0x24')]=function(_0x5ef119,_0x119bac){return db['SquareReport'][_0x4432('0x45')]({'where':{'id':_0x5ef119['params']['id']}})[_0x4432('0x23')](handleEntityNotFound(_0x119bac,null))['then'](removeEntity(_0x119bac,null))[_0x4432('0x40')](handleError(_0x119bac,null));};exports[_0x4432('0x49')]=function(_0x806485,_0xee3d7e){return db[_0x4432('0x3b')][_0x4432('0x49')]()[_0x4432('0x23')](respondWithResult(_0xee3d7e,null))['catch'](handleError(_0xee3d7e,null));}; \ No newline at end of file +var _0x00d4=['params','keys','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','SquareReport','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','filter','where','map','merge','includeAll','include','rows','show'];(function(_0x1ad119,_0x5bcfac){var _0xe6b725=function(_0x2ca853){while(--_0x2ca853){_0x1ad119['push'](_0x1ad119['shift']());}};_0xe6b725(++_0x5bcfac);}(_0x00d4,0x161));var _0x400d=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x00d4[_0x19b3f9];return _0x18c3f6;};'use strict';var emlformat=require(_0x400d('0x0'));var rimraf=require(_0x400d('0x1'));var zipdir=require(_0x400d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x400d('0x3'));var moment=require(_0x400d('0x4'));var BPromise=require(_0x400d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x400d('0x6'));var sox=require(_0x400d('0x7'));var csv=require(_0x400d('0x8'));var ejs=require(_0x400d('0x9'));var fs=require('fs');var fs_extra=require(_0x400d('0xa'));var _=require('lodash');var squel=require(_0x400d('0xb'));var crypto=require('crypto');var jsforce=require(_0x400d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x400d('0x8'));var querystring=require('querystring');var Papa=require(_0x400d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x400d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x400d('0xf'))(_0x400d('0x10'));var utils=require(_0x400d('0x11'));var config=require(_0x400d('0x12'));var licenseUtil=require(_0x400d('0x13'));var db=require(_0x400d('0x14'))['db'];function respondWithStatusCode(_0xa92cf0,_0x2c5260){_0x2c5260=_0x2c5260||0xcc;return function(_0x59db86){if(_0x59db86){return _0xa92cf0[_0x400d('0x15')](_0x2c5260);}return _0xa92cf0[_0x400d('0x16')](_0x2c5260)[_0x400d('0x17')]();};}function respondWithResult(_0x3b21c6,_0x5d6fee){_0x5d6fee=_0x5d6fee||0xc8;return function(_0xb4a131){if(_0xb4a131){return _0x3b21c6[_0x400d('0x16')](_0x5d6fee)[_0x400d('0x18')](_0xb4a131);}};}function respondWithFilteredResult(_0x57b20e,_0x5cb006){return function(_0x420e97){if(_0x420e97){var _0x29b40b=typeof _0x5cb006[_0x400d('0x19')]==='undefined'&&typeof _0x5cb006[_0x400d('0x1a')]===_0x400d('0x1b');var _0x46cde3=_0x420e97[_0x400d('0x1c')];var _0x3305ed=_0x29b40b?0x0:_0x5cb006[_0x400d('0x19')];var _0x30d145=_0x29b40b?_0x420e97[_0x400d('0x1c')]:_0x5cb006['offset']+_0x5cb006['limit'];var _0xa60483;if(_0x30d145>=_0x46cde3){_0x30d145=_0x46cde3;_0xa60483=0xc8;}else{_0xa60483=0xce;}_0x57b20e[_0x400d('0x16')](_0xa60483);return _0x57b20e[_0x400d('0x1d')](_0x400d('0x1e'),_0x3305ed+'-'+_0x30d145+'/'+_0x46cde3)[_0x400d('0x18')](_0x420e97);}return null;};}function patchUpdates(_0x13a971){return function(_0xe72e61){try{jsonpatch[_0x400d('0x1f')](_0xe72e61,_0x13a971,!![]);}catch(_0x431303){return BPromise[_0x400d('0x20')](_0x431303);}return _0xe72e61[_0x400d('0x21')]();};}function saveUpdates(_0xf50632,_0x462e07){return function(_0x3700c1){if(_0x3700c1){return _0x3700c1[_0x400d('0x22')](_0xf50632)[_0x400d('0x23')](function(_0x30db3e){return _0x30db3e;});}return null;};}function removeEntity(_0x3723ac,_0x4409bf){return function(_0x16ea02){if(_0x16ea02){return _0x16ea02[_0x400d('0x24')]()[_0x400d('0x23')](function(){_0x3723ac[_0x400d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c2d0,_0x388b99){return function(_0xd2a347){if(!_0xd2a347){_0x14c2d0[_0x400d('0x15')](0x194);}return _0xd2a347;};}function handleError(_0xf524,_0x11316e){_0x11316e=_0x11316e||0x1f4;return function(_0x3fdc70){logger[_0x400d('0x25')](_0x3fdc70[_0x400d('0x26')]);if(_0x3fdc70[_0x400d('0x27')]){delete _0x3fdc70[_0x400d('0x27')];}_0xf524[_0x400d('0x16')](_0x11316e)['send'](_0x3fdc70);};}exports[_0x400d('0x28')]=function(_0x17ef97,_0x24626d){var _0x39b5fa={},_0x44536d={},_0x2b2834={'count':0x0,'rows':[]};var _0x4e41f2=_['map'](db[_0x400d('0x29')][_0x400d('0x2a')],function(_0x2b32ee){return{'name':_0x2b32ee[_0x400d('0x2b')],'type':_0x2b32ee['type']['key']};});_0x44536d['model']=_['map'](_0x4e41f2,'name');_0x44536d[_0x400d('0x2c')]=_['keys'](_0x17ef97[_0x400d('0x2c')]);_0x44536d[_0x400d('0x2d')]=_[_0x400d('0x2e')](_0x44536d[_0x400d('0x2f')],_0x44536d[_0x400d('0x2c')]);_0x39b5fa[_0x400d('0x30')]=_[_0x400d('0x2e')](_0x44536d[_0x400d('0x2f')],qs[_0x400d('0x31')](_0x17ef97['query'][_0x400d('0x31')]));_0x39b5fa[_0x400d('0x30')]=_0x39b5fa[_0x400d('0x30')]['length']?_0x39b5fa[_0x400d('0x30')]:_0x44536d[_0x400d('0x2f')];if(!_0x17ef97[_0x400d('0x2c')][_0x400d('0x32')]('nolimit')){_0x39b5fa['limit']=qs[_0x400d('0x1a')](_0x17ef97[_0x400d('0x2c')][_0x400d('0x1a')]);_0x39b5fa[_0x400d('0x19')]=qs[_0x400d('0x19')](_0x17ef97[_0x400d('0x2c')][_0x400d('0x19')]);}_0x39b5fa[_0x400d('0x33')]=qs[_0x400d('0x34')](_0x17ef97['query'][_0x400d('0x34')]);_0x39b5fa['where']=qs[_0x400d('0x2d')](_['pick'](_0x17ef97[_0x400d('0x2c')],_0x44536d[_0x400d('0x2d')]),_0x4e41f2);if(_0x17ef97[_0x400d('0x2c')][_0x400d('0x35')]){_0x39b5fa['where']=_['merge'](_0x39b5fa[_0x400d('0x36')],{'$or':_[_0x400d('0x37')](_0x4e41f2,function(_0x86c29d){if(_0x86c29d['type']!=='VIRTUAL'){var _0x289823={};_0x289823[_0x86c29d['name']]={'$like':'%'+_0x17ef97[_0x400d('0x2c')][_0x400d('0x35')]+'%'};return _0x289823;}})});}_0x39b5fa=_[_0x400d('0x38')]({},_0x39b5fa,_0x17ef97['options']);var _0xf148f8={'where':_0x39b5fa[_0x400d('0x36')]};return db[_0x400d('0x29')][_0x400d('0x1c')](_0xf148f8)['then'](function(_0x563dc7){_0x2b2834[_0x400d('0x1c')]=_0x563dc7;if(_0x17ef97[_0x400d('0x2c')][_0x400d('0x39')]){_0x39b5fa[_0x400d('0x3a')]=[{'all':!![]}];}return db[_0x400d('0x29')]['findAll'](_0x39b5fa);})[_0x400d('0x23')](function(_0x428b75){_0x2b2834[_0x400d('0x3b')]=_0x428b75;return _0x2b2834;})[_0x400d('0x23')](respondWithFilteredResult(_0x24626d,_0x39b5fa))['catch'](handleError(_0x24626d,null));};exports[_0x400d('0x3c')]=function(_0x101d84,_0x3c3181){var _0x480056={'raw':!![],'where':{'id':_0x101d84[_0x400d('0x3d')]['id']}},_0x56e2e4={};_0x56e2e4[_0x400d('0x2f')]=_[_0x400d('0x3e')](db[_0x400d('0x29')]['rawAttributes']);_0x56e2e4['query']=_[_0x400d('0x3e')](_0x101d84[_0x400d('0x2c')]);_0x56e2e4['filters']=_[_0x400d('0x2e')](_0x56e2e4['model'],_0x56e2e4[_0x400d('0x2c')]);_0x480056[_0x400d('0x30')]=_['intersection'](_0x56e2e4[_0x400d('0x2f')],qs[_0x400d('0x31')](_0x101d84['query'][_0x400d('0x31')]));_0x480056['attributes']=_0x480056[_0x400d('0x30')][_0x400d('0x3f')]?_0x480056[_0x400d('0x30')]:_0x56e2e4[_0x400d('0x2f')];if(_0x101d84[_0x400d('0x2c')][_0x400d('0x39')]){_0x480056['include']=[{'all':!![]}];}_0x480056=_[_0x400d('0x38')]({},_0x480056,_0x101d84['options']);return db[_0x400d('0x29')]['find'](_0x480056)[_0x400d('0x23')](handleEntityNotFound(_0x3c3181,null))[_0x400d('0x23')](respondWithResult(_0x3c3181,null))[_0x400d('0x40')](handleError(_0x3c3181,null));};exports[_0x400d('0x41')]=function(_0x39c1a3,_0x52115d){return db[_0x400d('0x29')][_0x400d('0x41')](_0x39c1a3[_0x400d('0x42')],{})[_0x400d('0x23')](respondWithResult(_0x52115d,0xc9))['catch'](handleError(_0x52115d,null));};exports[_0x400d('0x22')]=function(_0xec0163,_0x34a15a){if(_0xec0163[_0x400d('0x42')]['id']){delete _0xec0163['body']['id'];}return db['SquareReport'][_0x400d('0x43')]({'where':{'id':_0xec0163[_0x400d('0x3d')]['id']}})[_0x400d('0x23')](handleEntityNotFound(_0x34a15a,null))[_0x400d('0x23')](saveUpdates(_0xec0163['body'],null))[_0x400d('0x23')](respondWithResult(_0x34a15a,null))['catch'](handleError(_0x34a15a,null));};exports[_0x400d('0x24')]=function(_0x41c67a,_0x498a16){return db[_0x400d('0x29')]['find']({'where':{'id':_0x41c67a[_0x400d('0x3d')]['id']}})[_0x400d('0x23')](handleEntityNotFound(_0x498a16,null))[_0x400d('0x23')](removeEntity(_0x498a16,null))['catch'](handleError(_0x498a16,null));};exports[_0x400d('0x44')]=function(_0x347038,_0x239f23){return db['SquareReport'][_0x400d('0x44')]()[_0x400d('0x23')](respondWithResult(_0x239f23,null))['catch'](handleError(_0x239f23,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9ebaa9c..e82f550 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 _0x7f44=['uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x7f44,0x173));var _0x47f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x47f4('0x0'));var util=require(_0x47f4('0x1'));var logger=require('../../config/logger')(_0x47f4('0x2'));var moment=require(_0x47f4('0x3'));var BPromise=require(_0x47f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47f4('0x5'));var rimraf=require(_0x47f4('0x6'));var config=require(_0x47f4('0x7'));var attributes=require('./squareReport.attributes');module[_0x47f4('0x8')]=function(_0x289671,_0x2a473a){return _0x289671[_0x47f4('0x9')](_0x47f4('0xa'),attributes,{'tableName':_0x47f4('0xb'),'paranoid':![],'indexes':[{'name':_0x47f4('0xc'),'fields':[_0x47f4('0xd'),_0x47f4('0xe')]},{'name':_0x47f4('0xf'),'fields':[_0x47f4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2a4=['SquareReport','report_square','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x155e84,_0x1ffffa){var _0x14a727=function(_0x378203){while(--_0x378203){_0x155e84['push'](_0x155e84['shift']());}};_0x14a727(++_0x1ffffa);}(_0xd2a4,0x164));var _0x4d2a=function(_0x3c698e,_0x56c906){_0x3c698e=_0x3c698e-0x0;var _0x2a779c=_0xd2a4[_0x3c698e];return _0x2a779c;};'use strict';var _=require(_0x4d2a('0x0'));var util=require(_0x4d2a('0x1'));var logger=require(_0x4d2a('0x2'))(_0x4d2a('0x3'));var moment=require(_0x4d2a('0x4'));var BPromise=require(_0x4d2a('0x5'));var rp=require(_0x4d2a('0x6'));var fs=require('fs');var path=require(_0x4d2a('0x7'));var rimraf=require(_0x4d2a('0x8'));var config=require(_0x4d2a('0x9'));var attributes=require('./squareReport.attributes');module[_0x4d2a('0xa')]=function(_0x5acc77,_0x4f984a){return _0x5acc77[_0x4d2a('0xb')](_0x4d2a('0xc'),attributes,{'tableName':_0x4d2a('0xd'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x4d2a('0xe'),'project_name']},{'name':_0x4d2a('0xf'),'fields':[_0x4d2a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 07da29f..c5ee8f9 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 _0xae40=['jayson/promise','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','where','UpdateSquareReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xae40,0xab));var _0x0ae4=function(_0x7738c0,_0x40ee7a){_0x7738c0=_0x7738c0-0x0;var _0x3d4d97=_0xae40[_0x7738c0];return _0x3d4d97;};'use strict';var _=require('lodash');var util=require(_0x0ae4('0x0'));var moment=require(_0x0ae4('0x1'));var BPromise=require(_0x0ae4('0x2'));var rs=require(_0x0ae4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ae4('0x4'))['db'];var utils=require(_0x0ae4('0x5'));var logger=require(_0x0ae4('0x6'))(_0x0ae4('0x7'));var config=require(_0x0ae4('0x8'));var jayson=require(_0x0ae4('0x9'));var client=jayson['client'][_0x0ae4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x235218,_0xcec1f5,_0x4024e6){return new BPromise(function(_0x14a8a6,_0x459304){return client['request'](_0x235218,_0x4024e6)[_0x0ae4('0xb')](function(_0x4ad27f){logger['info'](_0x0ae4('0xc'),_0xcec1f5,_0x0ae4('0xd'));logger[_0x0ae4('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0xcec1f5,_0x0ae4('0xd'),JSON[_0x0ae4('0xf')](_0x4ad27f));if(_0x4ad27f[_0x0ae4('0x10')]){if(_0x4ad27f[_0x0ae4('0x10')][_0x0ae4('0x11')]===0x1f4){logger[_0x0ae4('0x10')](_0x0ae4('0xc'),_0xcec1f5,_0x4ad27f[_0x0ae4('0x10')]['message']);return _0x459304(_0x4ad27f[_0x0ae4('0x10')][_0x0ae4('0x12')]);}logger[_0x0ae4('0x10')]('SquareReport,\x20%s,\x20%s',_0xcec1f5,_0x4ad27f[_0x0ae4('0x10')][_0x0ae4('0x12')]);return _0x14a8a6(_0x4ad27f[_0x0ae4('0x10')][_0x0ae4('0x12')]);}else{logger[_0x0ae4('0x13')](_0x0ae4('0xc'),_0xcec1f5,_0x0ae4('0xd'));_0x14a8a6(_0x4ad27f[_0x0ae4('0x14')][_0x0ae4('0x12')]);}})[_0x0ae4('0x15')](function(_0x19525a){logger[_0x0ae4('0x10')](_0x0ae4('0xc'),_0xcec1f5,_0x19525a);_0x459304(_0x19525a);});});}exports['CreateSquareReport']=function(_0xe7708e){var _0x87893e=this;return new Promise(function(_0x5c4347,_0x529d16){return db[_0x0ae4('0x16')][_0x0ae4('0x17')](_0xe7708e[_0x0ae4('0x18')],{'raw':_0xe7708e[_0x0ae4('0x19')]?_0xe7708e[_0x0ae4('0x19')][_0x0ae4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5bce1e){logger['info'](_0x0ae4('0x1b'),_0xe7708e);logger[_0x0ae4('0xe')]('CreateSquareReport',_0xe7708e,JSON['stringify'](_0x5bce1e));_0x5c4347(_0x5bce1e);})[_0x0ae4('0x15')](function(_0x2a8004){logger['error'](_0x0ae4('0x1b'),_0x2a8004[_0x0ae4('0x12')],_0xe7708e);_0x529d16(_0x87893e[_0x0ae4('0x10')](0x1f4,_0x2a8004[_0x0ae4('0x12')]));});});};exports['UpdateSquareReport']=function(_0x577548){var _0x50b70b=this;return new Promise(function(_0x3dd321,_0x3d942a){return db[_0x0ae4('0x16')]['update'](_0x577548[_0x0ae4('0x18')],{'raw':_0x577548[_0x0ae4('0x19')]?_0x577548[_0x0ae4('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x577548[_0x0ae4('0x19')]?_0x577548[_0x0ae4('0x19')][_0x0ae4('0x1c')]||null:null,'attributes':_0x577548['options']?_0x577548[_0x0ae4('0x19')]['attributes']||null:null,'limit':_0x577548[_0x0ae4('0x19')]?_0x577548[_0x0ae4('0x19')]['limit']||null:null})['then'](function(_0x3d3222){logger['info']('UpdateSquareReport',_0x577548);logger[_0x0ae4('0xe')](_0x0ae4('0x1d'),_0x577548,JSON['stringify'](_0x3d3222));_0x3dd321(_0x3d3222);})['catch'](function(_0x3b66b8){logger[_0x0ae4('0x10')](_0x0ae4('0x1d'),_0x3b66b8[_0x0ae4('0x12')],_0x577548);_0x3d942a(_0x50b70b[_0x0ae4('0x10')](0x1f4,_0x3b66b8[_0x0ae4('0x12')]));});});}; \ No newline at end of file +var _0x3452=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSquareReport','SquareReport','create','body','raw','UpdateSquareReport','update','options','where','limit'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3452,0x10e));var _0x2345=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3452[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x2345('0x0'));var moment=require(_0x2345('0x1'));var BPromise=require('bluebird');var rs=require(_0x2345('0x2'));var fs=require('fs');var Redis=require(_0x2345('0x3'));var db=require(_0x2345('0x4'))['db'];var utils=require(_0x2345('0x5'));var logger=require(_0x2345('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2345('0x7')][_0x2345('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b5bdb,_0x146445,_0x32316d){return new BPromise(function(_0x24bbbe,_0x13efd3){return client['request'](_0x4b5bdb,_0x32316d)[_0x2345('0x9')](function(_0x483d07){logger['info'](_0x2345('0xa'),_0x146445,_0x2345('0xb'));logger[_0x2345('0xc')](_0x2345('0xd'),_0x146445,_0x2345('0xb'),JSON[_0x2345('0xe')](_0x483d07));if(_0x483d07['error']){if(_0x483d07[_0x2345('0xf')]['code']===0x1f4){logger[_0x2345('0xf')](_0x2345('0xa'),_0x146445,_0x483d07[_0x2345('0xf')][_0x2345('0x10')]);return _0x13efd3(_0x483d07['error'][_0x2345('0x10')]);}logger[_0x2345('0xf')](_0x2345('0xa'),_0x146445,_0x483d07[_0x2345('0xf')][_0x2345('0x10')]);return _0x24bbbe(_0x483d07[_0x2345('0xf')]['message']);}else{logger[_0x2345('0x11')](_0x2345('0xa'),_0x146445,_0x2345('0xb'));_0x24bbbe(_0x483d07[_0x2345('0x12')][_0x2345('0x10')]);}})[_0x2345('0x13')](function(_0x8198a3){logger[_0x2345('0xf')](_0x2345('0xa'),_0x146445,_0x8198a3);_0x13efd3(_0x8198a3);});});}exports[_0x2345('0x14')]=function(_0x5ccf20){var _0x58f6a3=this;return new Promise(function(_0x284e97,_0x308d2e){return db[_0x2345('0x15')][_0x2345('0x16')](_0x5ccf20[_0x2345('0x17')],{'raw':_0x5ccf20['options']?_0x5ccf20['options'][_0x2345('0x18')]===undefined?!![]:![]:!![]})[_0x2345('0x9')](function(_0x221442){logger[_0x2345('0x11')](_0x2345('0x14'),_0x5ccf20);logger[_0x2345('0xc')](_0x2345('0x14'),_0x5ccf20,JSON[_0x2345('0xe')](_0x221442));_0x284e97(_0x221442);})['catch'](function(_0x22b679){logger['error'](_0x2345('0x14'),_0x22b679[_0x2345('0x10')],_0x5ccf20);_0x308d2e(_0x58f6a3[_0x2345('0xf')](0x1f4,_0x22b679['message']));});});};exports[_0x2345('0x19')]=function(_0x145822){var _0x3d748a=this;return new Promise(function(_0x18a2b0,_0x26fad7){return db[_0x2345('0x15')][_0x2345('0x1a')](_0x145822[_0x2345('0x17')],{'raw':_0x145822[_0x2345('0x1b')]?_0x145822[_0x2345('0x1b')][_0x2345('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145822[_0x2345('0x1b')]?_0x145822[_0x2345('0x1b')][_0x2345('0x1c')]||null:null,'attributes':_0x145822[_0x2345('0x1b')]?_0x145822[_0x2345('0x1b')]['attributes']||null:null,'limit':_0x145822[_0x2345('0x1b')]?_0x145822[_0x2345('0x1b')][_0x2345('0x1d')]||null:null})[_0x2345('0x9')](function(_0x512a64){logger['info'](_0x2345('0x19'),_0x145822);logger['debug'](_0x2345('0x19'),_0x145822,JSON[_0x2345('0xe')](_0x512a64));_0x18a2b0(_0x512a64);})[_0x2345('0x13')](function(_0x2c534b){logger[_0x2345('0xf')]('UpdateSquareReport',_0x2c534b[_0x2345('0x10')],_0x145822);_0x26fad7(_0x3d748a[_0x2345('0xf')](0x1f4,_0x2c534b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7b5893d..216e81a 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 _0x3f71=['/:id','post','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe'];(function(_0xc0cbf,_0x22f493){var _0x24a0ac=function(_0x33e3c9){while(--_0x33e3c9){_0xc0cbf['push'](_0xc0cbf['shift']());}};_0x24a0ac(++_0x22f493);}(_0x3f71,0x9d));var _0x13f7=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x3f71[_0x5cbf0e];return _0x1c76f8;};'use strict';var multer=require('multer');var util=require(_0x13f7('0x0'));var path=require(_0x13f7('0x1'));var timeout=require(_0x13f7('0x2'));var express=require(_0x13f7('0x3'));var router=express[_0x13f7('0x4')]();var fs_extra=require(_0x13f7('0x5'));var auth=require(_0x13f7('0x6'));var interaction=require(_0x13f7('0x7'));var config=require(_0x13f7('0x8'));var controller=require(_0x13f7('0x9'));router[_0x13f7('0xa')]('/',auth[_0x13f7('0xb')](),controller['index']);router[_0x13f7('0xa')](_0x13f7('0xc'),auth[_0x13f7('0xb')](),controller[_0x13f7('0xd')]);router[_0x13f7('0xa')](_0x13f7('0xe'),auth[_0x13f7('0xb')](),controller['show']);router[_0x13f7('0xf')]('/',auth[_0x13f7('0xb')](),controller['create']);router[_0x13f7('0x10')]('/:id',auth[_0x13f7('0xb')](),controller['update']);router[_0x13f7('0x11')](_0x13f7('0xe'),auth[_0x13f7('0xb')](),controller[_0x13f7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0800=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','/:id','show','post','put','delete','destroy','exports'];(function(_0x89fffe,_0x1ef3ba){var _0x4a9fad=function(_0x8690eb){while(--_0x8690eb){_0x89fffe['push'](_0x89fffe['shift']());}};_0x4a9fad(++_0x1ef3ba);}(_0x0800,0xa0));var _0x0080=function(_0x708913,_0x5f7b3b){_0x708913=_0x708913-0x0;var _0x2e0632=_0x0800[_0x708913];return _0x2e0632;};'use strict';var multer=require('multer');var util=require(_0x0080('0x0'));var path=require('path');var timeout=require(_0x0080('0x1'));var express=require(_0x0080('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0080('0x3'));var config=require(_0x0080('0x4'));var controller=require(_0x0080('0x5'));router[_0x0080('0x6')]('/',auth[_0x0080('0x7')](),controller['index']);router[_0x0080('0x6')](_0x0080('0x8'),auth[_0x0080('0x7')](),controller['describe']);router[_0x0080('0x6')](_0x0080('0x9'),auth[_0x0080('0x7')](),controller[_0x0080('0xa')]);router[_0x0080('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0080('0xc')](_0x0080('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x0080('0xd')](_0x0080('0x9'),auth[_0x0080('0x7')](),controller[_0x0080('0xe')]);module[_0x0080('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index a1b5e7b..d4cff53 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 _0x604e=['exports','STRING','TEXT','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x604e,0x143));var _0xe604=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x604e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe604('0x0'));module[_0xe604('0x1')]={'uniqueid':{'type':Sequelize[_0xe604('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xe604('0x2')]},'data':{'type':Sequelize[_0xe604('0x3')]},'project_name':{'type':Sequelize[_0xe604('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc5fc=['exports','STRING','TEXT','sequelize'];(function(_0x447f6d,_0x36fc29){var _0x56a9b8=function(_0x16444e){while(--_0x16444e){_0x447f6d['push'](_0x447f6d['shift']());}};_0x56a9b8(++_0x36fc29);}(_0xc5fc,0x16f));var _0xcc5f=function(_0x1991e1,_0x2c6945){_0x1991e1=_0x1991e1-0x0;var _0xba7b97=_0xc5fc[_0x1991e1];return _0xba7b97;};'use strict';var Sequelize=require(_0xcc5f('0x0'));module[_0xcc5f('0x1')]={'uniqueid':{'type':Sequelize[_0xcc5f('0x2')]},'node':{'type':Sequelize[_0xcc5f('0x2')]},'application':{'type':Sequelize[_0xcc5f('0x2')]},'data':{'type':Sequelize[_0xcc5f('0x3')]},'project_name':{'type':Sequelize[_0xcc5f('0x2')]},'callerid':{'type':Sequelize[_0xcc5f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 39d25f4..627eb3e 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 _0xe499=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','params','length','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x597bf3,_0x3a2bd8){var _0x4db0db=function(_0x4d5983){while(--_0x4d5983){_0x597bf3['push'](_0x597bf3['shift']());}};_0x4db0db(++_0x3a2bd8);}(_0xe499,0xfb));var _0x9e49=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xe499[_0x11e05d];return _0x335588;};'use strict';var emlformat=require(_0x9e49('0x0'));var rimraf=require(_0x9e49('0x1'));var zipdir=require(_0x9e49('0x2'));var jsonpatch=require(_0x9e49('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e49('0x4'));var Mustache=require(_0x9e49('0x5'));var util=require(_0x9e49('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9e49('0x7'));var ejs=require(_0x9e49('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e49('0x9'));var squel=require(_0x9e49('0xa'));var crypto=require(_0x9e49('0xb'));var jsforce=require(_0x9e49('0xc'));var deskjs=require(_0x9e49('0xd'));var toCsv=require(_0x9e49('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9e49('0xe'));var authService=require(_0x9e49('0xf'));var qs=require(_0x9e49('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e49('0x11'));var logger=require(_0x9e49('0x12'))(_0x9e49('0x13'));var utils=require(_0x9e49('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9e49('0x15'));var db=require(_0x9e49('0x16'))['db'];function respondWithStatusCode(_0x38ddd4,_0x45127f){_0x45127f=_0x45127f||0xcc;return function(_0x4b73d6){if(_0x4b73d6){return _0x38ddd4[_0x9e49('0x17')](_0x45127f);}return _0x38ddd4[_0x9e49('0x18')](_0x45127f)[_0x9e49('0x19')]();};}function respondWithResult(_0x432208,_0x4ba5a2){_0x4ba5a2=_0x4ba5a2||0xc8;return function(_0x35f9fa){if(_0x35f9fa){return _0x432208[_0x9e49('0x18')](_0x4ba5a2)[_0x9e49('0x1a')](_0x35f9fa);}};}function respondWithFilteredResult(_0x357cfa,_0x2d16d5){return function(_0x31dab6){if(_0x31dab6){var _0x3e21ba=typeof _0x2d16d5[_0x9e49('0x1b')]===_0x9e49('0x1c')&&typeof _0x2d16d5['limit']===_0x9e49('0x1c');var _0x2df3b5=_0x31dab6[_0x9e49('0x1d')];var _0x456b58=_0x3e21ba?0x0:_0x2d16d5[_0x9e49('0x1b')];var _0x5e3bbc=_0x3e21ba?_0x31dab6[_0x9e49('0x1d')]:_0x2d16d5[_0x9e49('0x1b')]+_0x2d16d5['limit'];var _0xeb4c05;if(_0x5e3bbc>=_0x2df3b5){_0x5e3bbc=_0x2df3b5;_0xeb4c05=0xc8;}else{_0xeb4c05=0xce;}_0x357cfa['status'](_0xeb4c05);return _0x357cfa[_0x9e49('0x1e')](_0x9e49('0x1f'),_0x456b58+'-'+_0x5e3bbc+'/'+_0x2df3b5)[_0x9e49('0x1a')](_0x31dab6);}return null;};}function patchUpdates(_0x5eaefa){return function(_0x2e2c71){try{jsonpatch['apply'](_0x2e2c71,_0x5eaefa,!![]);}catch(_0x4b480d){return BPromise[_0x9e49('0x20')](_0x4b480d);}return _0x2e2c71[_0x9e49('0x21')]();};}function saveUpdates(_0x51f8ac,_0xa9cd6f){return function(_0x19e63e){if(_0x19e63e){return _0x19e63e[_0x9e49('0x22')](_0x51f8ac)['then'](function(_0x2130b8){return _0x2130b8;});}return null;};}function removeEntity(_0x4a6171,_0x3211f9){return function(_0x1f627b){if(_0x1f627b){return _0x1f627b['destroy']()[_0x9e49('0x23')](function(){_0x4a6171[_0x9e49('0x18')](0xcc)[_0x9e49('0x19')]();});}};}function handleEntityNotFound(_0x31a706,_0x548778){return function(_0x277b77){if(!_0x277b77){_0x31a706['sendStatus'](0x194);}return _0x277b77;};}function handleError(_0x462d9a,_0x292569){_0x292569=_0x292569||0x1f4;return function(_0x428de9){logger['error'](_0x428de9['stack']);if(_0x428de9[_0x9e49('0x24')]){delete _0x428de9[_0x9e49('0x24')];}_0x462d9a[_0x9e49('0x18')](_0x292569)[_0x9e49('0x25')](_0x428de9);};}exports[_0x9e49('0x26')]=function(_0x139675,_0x50ef5a){var _0x561976={},_0xbc9903={},_0x9ca6af={'count':0x0,'rows':[]};var _0x35c96e=_[_0x9e49('0x27')](db['SquareDetailsReport'][_0x9e49('0x28')],function(_0x207900){return{'name':_0x207900[_0x9e49('0x29')],'type':_0x207900['type'][_0x9e49('0x2a')]};});_0xbc9903[_0x9e49('0x2b')]=_[_0x9e49('0x27')](_0x35c96e,_0x9e49('0x24'));_0xbc9903[_0x9e49('0x2c')]=_[_0x9e49('0x2d')](_0x139675[_0x9e49('0x2c')]);_0xbc9903[_0x9e49('0x2e')]=_[_0x9e49('0x2f')](_0xbc9903[_0x9e49('0x2b')],_0xbc9903[_0x9e49('0x2c')]);_0x561976['attributes']=_[_0x9e49('0x2f')](_0xbc9903[_0x9e49('0x2b')],qs[_0x9e49('0x30')](_0x139675[_0x9e49('0x2c')][_0x9e49('0x30')]));_0x561976[_0x9e49('0x31')]=_0x561976[_0x9e49('0x31')]['length']?_0x561976[_0x9e49('0x31')]:_0xbc9903['model'];if(!_0x139675[_0x9e49('0x2c')][_0x9e49('0x32')](_0x9e49('0x33'))){_0x561976[_0x9e49('0x34')]=qs['limit'](_0x139675[_0x9e49('0x2c')][_0x9e49('0x34')]);_0x561976[_0x9e49('0x1b')]=qs[_0x9e49('0x1b')](_0x139675['query'][_0x9e49('0x1b')]);}_0x561976[_0x9e49('0x35')]=qs[_0x9e49('0x36')](_0x139675['query']['sort']);_0x561976[_0x9e49('0x37')]=qs[_0x9e49('0x2e')](_[_0x9e49('0x38')](_0x139675[_0x9e49('0x2c')],_0xbc9903[_0x9e49('0x2e')]),_0x35c96e);if(_0x139675[_0x9e49('0x2c')]['filter']){_0x561976[_0x9e49('0x37')]=_[_0x9e49('0x39')](_0x561976['where'],{'$or':_['map'](_0x35c96e,function(_0x1e4e1d){if(_0x1e4e1d[_0x9e49('0x3a')]!==_0x9e49('0x3b')){var _0x39d09c={};_0x39d09c[_0x1e4e1d[_0x9e49('0x24')]]={'$like':'%'+_0x139675['query'][_0x9e49('0x3c')]+'%'};return _0x39d09c;}})});}_0x561976=_[_0x9e49('0x39')]({},_0x561976,_0x139675[_0x9e49('0x3d')]);var _0x5f4aec={'where':_0x561976[_0x9e49('0x37')]};return db[_0x9e49('0x3e')]['count'](_0x5f4aec)[_0x9e49('0x23')](function(_0x1b6e7f){_0x9ca6af['count']=_0x1b6e7f;if(_0x139675[_0x9e49('0x2c')][_0x9e49('0x3f')]){_0x561976[_0x9e49('0x40')]=[{'all':!![]}];}return db[_0x9e49('0x3e')][_0x9e49('0x41')](_0x561976);})[_0x9e49('0x23')](function(_0xabe71d){_0x9ca6af[_0x9e49('0x42')]=_0xabe71d;return _0x9ca6af;})[_0x9e49('0x23')](respondWithFilteredResult(_0x50ef5a,_0x561976))[_0x9e49('0x43')](handleError(_0x50ef5a,null));};exports[_0x9e49('0x44')]=function(_0x16b04a,_0x5aa5ac){var _0x2547ce={'raw':!![],'where':{'id':_0x16b04a[_0x9e49('0x45')]['id']}},_0x5eba35={};_0x5eba35[_0x9e49('0x2b')]=_[_0x9e49('0x2d')](db[_0x9e49('0x3e')][_0x9e49('0x28')]);_0x5eba35[_0x9e49('0x2c')]=_[_0x9e49('0x2d')](_0x16b04a[_0x9e49('0x2c')]);_0x5eba35['filters']=_[_0x9e49('0x2f')](_0x5eba35[_0x9e49('0x2b')],_0x5eba35[_0x9e49('0x2c')]);_0x2547ce[_0x9e49('0x31')]=_['intersection'](_0x5eba35['model'],qs[_0x9e49('0x30')](_0x16b04a[_0x9e49('0x2c')][_0x9e49('0x30')]));_0x2547ce[_0x9e49('0x31')]=_0x2547ce[_0x9e49('0x31')][_0x9e49('0x46')]?_0x2547ce[_0x9e49('0x31')]:_0x5eba35[_0x9e49('0x2b')];if(_0x16b04a[_0x9e49('0x2c')][_0x9e49('0x3f')]){_0x2547ce[_0x9e49('0x40')]=[{'all':!![]}];}_0x2547ce=_[_0x9e49('0x39')]({},_0x2547ce,_0x16b04a[_0x9e49('0x3d')]);return db['SquareDetailsReport'][_0x9e49('0x47')](_0x2547ce)[_0x9e49('0x23')](handleEntityNotFound(_0x5aa5ac,null))['then'](respondWithResult(_0x5aa5ac,null))[_0x9e49('0x43')](handleError(_0x5aa5ac,null));};exports['create']=function(_0x54dc14,_0x5c8777){return db[_0x9e49('0x3e')]['create'](_0x54dc14[_0x9e49('0x48')],{})[_0x9e49('0x23')](respondWithResult(_0x5c8777,0xc9))[_0x9e49('0x43')](handleError(_0x5c8777,null));};exports[_0x9e49('0x22')]=function(_0x1632f8,_0x4f7bf0){if(_0x1632f8[_0x9e49('0x48')]['id']){delete _0x1632f8[_0x9e49('0x48')]['id'];}return db[_0x9e49('0x3e')][_0x9e49('0x47')]({'where':{'id':_0x1632f8[_0x9e49('0x45')]['id']}})[_0x9e49('0x23')](handleEntityNotFound(_0x4f7bf0,null))[_0x9e49('0x23')](saveUpdates(_0x1632f8['body'],null))[_0x9e49('0x23')](respondWithResult(_0x4f7bf0,null))['catch'](handleError(_0x4f7bf0,null));};exports[_0x9e49('0x49')]=function(_0x49d233,_0x22b178){return db['SquareDetailsReport']['find']({'where':{'id':_0x49d233['params']['id']}})[_0x9e49('0x23')](handleEntityNotFound(_0x22b178,null))[_0x9e49('0x23')](removeEntity(_0x22b178,null))[_0x9e49('0x43')](handleError(_0x22b178,null));};exports['describe']=function(_0x24ef88,_0x6803d8){return db[_0x9e49('0x3e')]['describe']()[_0x9e49('0x23')](respondWithResult(_0x6803d8,null))[_0x9e49('0x43')](handleError(_0x6803d8,null));}; \ No newline at end of file +var _0xcb3c=['error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','show','find','create','catch','body','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0xcb3c,0xc4));var _0xccb3=function(_0x3174d2,_0x4dbb8a){_0x3174d2=_0x3174d2-0x0;var _0x28519a=_0xcb3c[_0x3174d2];return _0x28519a;};'use strict';var emlformat=require(_0xccb3('0x0'));var rimraf=require(_0xccb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccb3('0x2'));var rp=require(_0xccb3('0x3'));var moment=require(_0xccb3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccb3('0x5'));var util=require(_0xccb3('0x6'));var path=require(_0xccb3('0x7'));var sox=require(_0xccb3('0x8'));var csv=require('to-csv');var ejs=require(_0xccb3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xccb3('0xa'));var crypto=require(_0xccb3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xccb3('0xc'));var querystring=require(_0xccb3('0xd'));var Papa=require(_0xccb3('0xe'));var Redis=require(_0xccb3('0xf'));var authService=require(_0xccb3('0x10'));var qs=require(_0xccb3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xccb3('0x12'));var logger=require(_0xccb3('0x13'))('api');var utils=require(_0xccb3('0x14'));var config=require(_0xccb3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xccb3('0x16'))['db'];function respondWithStatusCode(_0xfdb0fa,_0x4f8302){_0x4f8302=_0x4f8302||0xcc;return function(_0x3cba58){if(_0x3cba58){return _0xfdb0fa[_0xccb3('0x17')](_0x4f8302);}return _0xfdb0fa[_0xccb3('0x18')](_0x4f8302)[_0xccb3('0x19')]();};}function respondWithResult(_0x42fa8d,_0x5f3dbb){_0x5f3dbb=_0x5f3dbb||0xc8;return function(_0x138a1d){if(_0x138a1d){return _0x42fa8d[_0xccb3('0x18')](_0x5f3dbb)[_0xccb3('0x1a')](_0x138a1d);}};}function respondWithFilteredResult(_0x2d45e1,_0x47f6b7){return function(_0xe7c06f){if(_0xe7c06f){var _0x5c6211=typeof _0x47f6b7[_0xccb3('0x1b')]==='undefined'&&typeof _0x47f6b7[_0xccb3('0x1c')]==='undefined';var _0x3f1912=_0xe7c06f[_0xccb3('0x1d')];var _0x3ba69c=_0x5c6211?0x0:_0x47f6b7[_0xccb3('0x1b')];var _0x2b7bb3=_0x5c6211?_0xe7c06f[_0xccb3('0x1d')]:_0x47f6b7[_0xccb3('0x1b')]+_0x47f6b7['limit'];var _0x446915;if(_0x2b7bb3>=_0x3f1912){_0x2b7bb3=_0x3f1912;_0x446915=0xc8;}else{_0x446915=0xce;}_0x2d45e1[_0xccb3('0x18')](_0x446915);return _0x2d45e1[_0xccb3('0x1e')](_0xccb3('0x1f'),_0x3ba69c+'-'+_0x2b7bb3+'/'+_0x3f1912)[_0xccb3('0x1a')](_0xe7c06f);}return null;};}function patchUpdates(_0x29c127){return function(_0x4e4864){try{jsonpatch['apply'](_0x4e4864,_0x29c127,!![]);}catch(_0x3e8f8d){return BPromise[_0xccb3('0x20')](_0x3e8f8d);}return _0x4e4864[_0xccb3('0x21')]();};}function saveUpdates(_0x575aa1,_0x2dc7fb){return function(_0x3a4289){if(_0x3a4289){return _0x3a4289[_0xccb3('0x22')](_0x575aa1)['then'](function(_0x3ab6b3){return _0x3ab6b3;});}return null;};}function removeEntity(_0x129325,_0x3c8974){return function(_0xd7224a){if(_0xd7224a){return _0xd7224a['destroy']()['then'](function(){_0x129325[_0xccb3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bca27,_0x5bc027){return function(_0x2d4cb0){if(!_0x2d4cb0){_0x5bca27[_0xccb3('0x17')](0x194);}return _0x2d4cb0;};}function handleError(_0x58623b,_0x1a6f11){_0x1a6f11=_0x1a6f11||0x1f4;return function(_0x308547){logger[_0xccb3('0x23')](_0x308547[_0xccb3('0x24')]);if(_0x308547[_0xccb3('0x25')]){delete _0x308547[_0xccb3('0x25')];}_0x58623b[_0xccb3('0x18')](_0x1a6f11)[_0xccb3('0x26')](_0x308547);};}exports[_0xccb3('0x27')]=function(_0x3a6cc7,_0x35235f){var _0x290bf7={},_0x542046={},_0x15bc68={'count':0x0,'rows':[]};var _0x3ccdf5=_['map'](db[_0xccb3('0x28')][_0xccb3('0x29')],function(_0x2bfa5d){return{'name':_0x2bfa5d[_0xccb3('0x2a')],'type':_0x2bfa5d[_0xccb3('0x2b')][_0xccb3('0x2c')]};});_0x542046[_0xccb3('0x2d')]=_[_0xccb3('0x2e')](_0x3ccdf5,_0xccb3('0x25'));_0x542046[_0xccb3('0x2f')]=_[_0xccb3('0x30')](_0x3a6cc7[_0xccb3('0x2f')]);_0x542046[_0xccb3('0x31')]=_[_0xccb3('0x32')](_0x542046[_0xccb3('0x2d')],_0x542046[_0xccb3('0x2f')]);_0x290bf7['attributes']=_[_0xccb3('0x32')](_0x542046[_0xccb3('0x2d')],qs[_0xccb3('0x33')](_0x3a6cc7['query']['fields']));_0x290bf7[_0xccb3('0x34')]=_0x290bf7[_0xccb3('0x34')][_0xccb3('0x35')]?_0x290bf7[_0xccb3('0x34')]:_0x542046[_0xccb3('0x2d')];if(!_0x3a6cc7['query'][_0xccb3('0x36')](_0xccb3('0x37'))){_0x290bf7[_0xccb3('0x1c')]=qs[_0xccb3('0x1c')](_0x3a6cc7[_0xccb3('0x2f')][_0xccb3('0x1c')]);_0x290bf7[_0xccb3('0x1b')]=qs[_0xccb3('0x1b')](_0x3a6cc7['query']['offset']);}_0x290bf7[_0xccb3('0x38')]=qs[_0xccb3('0x39')](_0x3a6cc7['query'][_0xccb3('0x39')]);_0x290bf7[_0xccb3('0x3a')]=qs['filters'](_[_0xccb3('0x3b')](_0x3a6cc7[_0xccb3('0x2f')],_0x542046[_0xccb3('0x31')]),_0x3ccdf5);if(_0x3a6cc7[_0xccb3('0x2f')][_0xccb3('0x3c')]){_0x290bf7['where']=_[_0xccb3('0x3d')](_0x290bf7['where'],{'$or':_['map'](_0x3ccdf5,function(_0x48adf4){if(_0x48adf4[_0xccb3('0x2b')]!==_0xccb3('0x3e')){var _0x45ee1c={};_0x45ee1c[_0x48adf4[_0xccb3('0x25')]]={'$like':'%'+_0x3a6cc7['query']['filter']+'%'};return _0x45ee1c;}})});}_0x290bf7=_[_0xccb3('0x3d')]({},_0x290bf7,_0x3a6cc7[_0xccb3('0x3f')]);var _0x2337a0={'where':_0x290bf7['where']};return db[_0xccb3('0x28')][_0xccb3('0x1d')](_0x2337a0)['then'](function(_0x1be7fe){_0x15bc68[_0xccb3('0x1d')]=_0x1be7fe;if(_0x3a6cc7[_0xccb3('0x2f')][_0xccb3('0x40')]){_0x290bf7[_0xccb3('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xccb3('0x42')](_0x290bf7);})['then'](function(_0x545947){_0x15bc68[_0xccb3('0x43')]=_0x545947;return _0x15bc68;})[_0xccb3('0x44')](respondWithFilteredResult(_0x35235f,_0x290bf7))['catch'](handleError(_0x35235f,null));};exports[_0xccb3('0x45')]=function(_0x3ac04c,_0x296193){var _0x2f02dc={'raw':!![],'where':{'id':_0x3ac04c['params']['id']}},_0x56537f={};_0x56537f[_0xccb3('0x2d')]=_[_0xccb3('0x30')](db[_0xccb3('0x28')]['rawAttributes']);_0x56537f['query']=_[_0xccb3('0x30')](_0x3ac04c[_0xccb3('0x2f')]);_0x56537f[_0xccb3('0x31')]=_[_0xccb3('0x32')](_0x56537f[_0xccb3('0x2d')],_0x56537f[_0xccb3('0x2f')]);_0x2f02dc['attributes']=_[_0xccb3('0x32')](_0x56537f[_0xccb3('0x2d')],qs[_0xccb3('0x33')](_0x3ac04c[_0xccb3('0x2f')][_0xccb3('0x33')]));_0x2f02dc[_0xccb3('0x34')]=_0x2f02dc[_0xccb3('0x34')]['length']?_0x2f02dc[_0xccb3('0x34')]:_0x56537f[_0xccb3('0x2d')];if(_0x3ac04c['query'][_0xccb3('0x40')]){_0x2f02dc[_0xccb3('0x41')]=[{'all':!![]}];}_0x2f02dc=_[_0xccb3('0x3d')]({},_0x2f02dc,_0x3ac04c[_0xccb3('0x3f')]);return db['SquareDetailsReport'][_0xccb3('0x46')](_0x2f02dc)[_0xccb3('0x44')](handleEntityNotFound(_0x296193,null))[_0xccb3('0x44')](respondWithResult(_0x296193,null))['catch'](handleError(_0x296193,null));};exports[_0xccb3('0x47')]=function(_0x41a951,_0x880ba1){return db[_0xccb3('0x28')][_0xccb3('0x47')](_0x41a951['body'],{})[_0xccb3('0x44')](respondWithResult(_0x880ba1,0xc9))[_0xccb3('0x48')](handleError(_0x880ba1,null));};exports['update']=function(_0x7833bf,_0x485d32){if(_0x7833bf[_0xccb3('0x49')]['id']){delete _0x7833bf[_0xccb3('0x49')]['id'];}return db['SquareDetailsReport'][_0xccb3('0x46')]({'where':{'id':_0x7833bf['params']['id']}})[_0xccb3('0x44')](handleEntityNotFound(_0x485d32,null))[_0xccb3('0x44')](saveUpdates(_0x7833bf[_0xccb3('0x49')],null))[_0xccb3('0x44')](respondWithResult(_0x485d32,null))[_0xccb3('0x48')](handleError(_0x485d32,null));};exports[_0xccb3('0x4a')]=function(_0x311cc9,_0x38a6c0){return db[_0xccb3('0x28')][_0xccb3('0x46')]({'where':{'id':_0x311cc9[_0xccb3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38a6c0,null))['then'](removeEntity(_0x38a6c0,null))[_0xccb3('0x48')](handleError(_0x38a6c0,null));};exports[_0xccb3('0x4c')]=function(_0x5f09b1,_0x33374a){return db[_0xccb3('0x28')]['describe']()['then'](respondWithResult(_0x33374a,null))['catch'](handleError(_0x33374a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 8137c0a..a8d958e 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 _0x9f0b=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x487537,_0x2e1bc7){var _0x49aa6e=function(_0x920988){while(--_0x920988){_0x487537['push'](_0x487537['shift']());}};_0x49aa6e(++_0x2e1bc7);}(_0x9f0b,0x1ee));var _0xb9f0=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x9f0b[_0xa990b7];return _0x52c99c;};'use strict';var _=require('lodash');var util=require(_0xb9f0('0x0'));var logger=require(_0xb9f0('0x1'))(_0xb9f0('0x2'));var moment=require(_0xb9f0('0x3'));var BPromise=require(_0xb9f0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb9f0('0x5'));var attributes=require(_0xb9f0('0x6'));module['exports']=function(_0x51be85,_0x46986d){return _0x51be85[_0xb9f0('0x7')](_0xb9f0('0x8'),attributes,{'tableName':_0xb9f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e58=['report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x564360,_0x54364f){var _0x1af12e=function(_0xf4dbed){while(--_0xf4dbed){_0x564360['push'](_0x564360['shift']());}};_0x1af12e(++_0x54364f);}(_0x9e58,0x197));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89e5('0x0'));var util=require(_0x89e5('0x1'));var logger=require(_0x89e5('0x2'))(_0x89e5('0x3'));var moment=require(_0x89e5('0x4'));var BPromise=require(_0x89e5('0x5'));var rp=require(_0x89e5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89e5('0x7'));var config=require(_0x89e5('0x8'));var attributes=require(_0x89e5('0x9'));module[_0x89e5('0xa')]=function(_0x6ccc9a,_0x1523a0){return _0x6ccc9a[_0x89e5('0xb')](_0x89e5('0xc'),attributes,{'tableName':_0x89e5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index cfb4710..92aff66 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 _0x8f4c=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x502376,_0x4bf302){var _0x4724f9=function(_0xe17f00){while(--_0xe17f00){_0x502376['push'](_0x502376['shift']());}};_0x4724f9(++_0x4bf302);}(_0x8f4c,0x113));var _0xc8f4=function(_0x46d02b,_0x32be3f){_0x46d02b=_0x46d02b-0x0;var _0x5c2ecc=_0x8f4c[_0x46d02b];return _0x5c2ecc;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateSquareDetailsReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});}; \ No newline at end of file +var _0xa5fa=['../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xa5fa[_0x4063a4];return _0x17908d;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')](_0x3d874f[_0xaa5f('0x19')],{'raw':_0x3d874f[_0xaa5f('0x1a')]?_0x3d874f[_0xaa5f('0x1a')][_0xaa5f('0x1b')]===undefined?!![]:![]:!![]})[_0xaa5f('0x1c')](function(_0x194691){logger[_0xaa5f('0xc')](_0xaa5f('0x16'),_0x3d874f);logger[_0xaa5f('0xd')](_0xaa5f('0x16'),_0x3d874f,JSON[_0xaa5f('0xe')](_0x194691));_0x1019e8(_0x194691);})['catch'](function(_0x1e917d){logger['error'](_0xaa5f('0x16'),_0x1e917d[_0xaa5f('0x12')],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x1e917d[_0xaa5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 60da89a..84ca64d 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 _0xb384=['express','get','index','isAuthenticated','killProcess'];(function(_0x4e7d34,_0x5261c5){var _0x106b88=function(_0x1bd89d){while(--_0x1bd89d){_0x4e7d34['push'](_0x4e7d34['shift']());}};_0x106b88(++_0x5261c5);}(_0xb384,0xc8));var _0x4b38=function(_0x4e9986,_0x1635f7){_0x4e9986=_0x4e9986-0x0;var _0x53fce2=_0xb384[_0x4e9986];return _0x53fce2;};'use strict';var express=require(_0x4b38('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x4b38('0x1')]('/',auth['isAuthenticated'](),controller[_0x4b38('0x2')]);router['get']('/process/:pid/kill',auth[_0x4b38('0x3')](),controller[_0x4b38('0x4')]);module['exports']=router; \ No newline at end of file +var _0x9b67=['/process/:pid/kill','killProcess','exports','Router','./system.controller','get'];(function(_0x5f0ea6,_0x4245c7){var _0x324271=function(_0x443494){while(--_0x443494){_0x5f0ea6['push'](_0x5f0ea6['shift']());}};_0x324271(++_0x4245c7);}(_0x9b67,0x189));var _0x79b6=function(_0x5ee1bc,_0x40eafd){_0x5ee1bc=_0x5ee1bc-0x0;var _0x456616=_0x9b67[_0x5ee1bc];return _0x456616;};'use strict';var express=require('express');var router=express[_0x79b6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x79b6('0x1'));router[_0x79b6('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0x79b6('0x2')](_0x79b6('0x3'),auth['isAuthenticated'](),controller[_0x79b6('0x4')]);module[_0x79b6('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d7d2dcb..a16c1a0 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 _0xe19f=['catch','killProcess','components/import/cm','format','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','systeminformation','child_process','exec','api','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json'];(function(_0x51f21d,_0xef3ec0){var _0x1077c2=function(_0x1afc5f){while(--_0x1afc5f){_0x51f21d['push'](_0x51f21d['shift']());}};_0x1077c2(++_0xef3ec0);}(_0xe19f,0x169));var _0xfe19=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe19f[_0x19950b];return _0x3c6b41;};'use strict';var info=require(_0xfe19('0x0'));var exec=require(_0xfe19('0x1'))[_0xfe19('0x2')];var logger=require('../../config/logger')(_0xfe19('0x3'));var util=require('util');var BPromise=require(_0xfe19('0x4'));var _=require(_0xfe19('0x5'));function handleError(_0x135c68,_0x5726e9,_0x27e691){_0x5726e9=_0x5726e9||0x1f4;return function(_0x355c68){logger['error'](_0xfe19('0x6'),_0x27e691,_0x5726e9,util[_0xfe19('0x7')](_0x355c68,{'showHidden':![],'depth':null}));delete _0x355c68[_0xfe19('0x8')];_0x135c68[_0xfe19('0x9')](_0x5726e9)[_0xfe19('0xa')](_0x355c68);};}exports[_0xfe19('0xb')]=function(_0x2b9857,_0x4a9341){return info['getAllData']()[_0xfe19('0xc')](function(_0x54abaf){return _0x4a9341[_0xfe19('0x9')](0xc8)[_0xfe19('0xd')](_0x54abaf);})[_0xfe19('0xe')](function(_0x3b716e){return _0x4a9341[_0xfe19('0x9')](0x1f4)[_0xfe19('0xd')](_0x3b716e);});};exports[_0xfe19('0xf')]=function(_0x492f3f,_0x24dee8){var _0x1b3ef0=[_0xfe19('0x10')];return new BPromise(function(_0x5e41bf,_0xb5bc9a){return exec(util[_0xfe19('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x492f3f['params'][_0xfe19('0x12')]),function(_0x251cb9,_0x38f130,_0x20405c){if(_0x251cb9){return _0xb5bc9a(_0x251cb9);}return _0x5e41bf(_0x38f130);});})[_0xfe19('0xc')](function(_0x2d36d2){var _0x1dc570=![];var _0x2b9b60=_0x2d36d2[_0xfe19('0x13')](/\n/);for(var _0x55083e=0x0,_0x4a68d4=_0x1b3ef0[_0xfe19('0x14')];_0x55083e<_0x4a68d4,_0x1dc570===![];_0x55083e+=0x1){if(_0x2d36d2[_0xfe19('0x15')](_0x1b3ef0[_0x55083e])>=0x0){_0x1dc570=!![];}}if(!_0x1dc570){throw new Error(util[_0xfe19('0x11')](_0xfe19('0x16'),_0x492f3f[_0xfe19('0x17')][_0xfe19('0x12')]));}process['kill'](_0x492f3f[_0xfe19('0x17')][_0xfe19('0x12')],_0xfe19('0x18'));return _0x24dee8['status'](0xc8)['json']({'message':util[_0xfe19('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x492f3f[_0xfe19('0x17')][_0xfe19('0x12')])});})[_0xfe19('0xe')](handleError(_0x24dee8,null,_0xfe19('0xf')));}; \ No newline at end of file +var _0x6979=['then','status','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','index'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6979,0x117));var _0x9697=function(_0x2e6f19,_0x448c24){_0x2e6f19=_0x2e6f19-0x0;var _0x33f0fc=_0x6979[_0x2e6f19];return _0x33f0fc;};'use strict';var info=require('systeminformation');var exec=require(_0x9697('0x0'))['exec'];var logger=require(_0x9697('0x1'))(_0x9697('0x2'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x9697('0x3'));function handleError(_0x226af5,_0x437e97,_0x4c1860){_0x437e97=_0x437e97||0x1f4;return function(_0x6c812e){logger[_0x9697('0x4')](_0x9697('0x5'),_0x4c1860,_0x437e97,util['inspect'](_0x6c812e,{'showHidden':![],'depth':null}));delete _0x6c812e['name'];_0x226af5['status'](_0x437e97)['send'](_0x6c812e);};}exports[_0x9697('0x6')]=function(_0x1f58e7,_0x5c10e4){return info['getAllData']()[_0x9697('0x7')](function(_0x376e8b){return _0x5c10e4[_0x9697('0x8')](0xc8)[_0x9697('0x9')](_0x376e8b);})[_0x9697('0xa')](function(_0x4851b5){return _0x5c10e4[_0x9697('0x8')](0x1f4)[_0x9697('0x9')](_0x4851b5);});};exports[_0x9697('0xb')]=function(_0x24afcc,_0x36d618){var _0x2bd6ee=[_0x9697('0xc')];return new BPromise(function(_0x999a59,_0x2f5e07){return exec(util['format'](_0x9697('0xd'),_0x24afcc[_0x9697('0xe')][_0x9697('0xf')]),function(_0xe74c64,_0x5c213a,_0x5caac4){if(_0xe74c64){return _0x2f5e07(_0xe74c64);}return _0x999a59(_0x5c213a);});})[_0x9697('0x7')](function(_0x543c0c){var _0x1d0901=![];var _0x4a51c5=_0x543c0c['split'](/\n/);for(var _0x5c76c4=0x0,_0x346e84=_0x2bd6ee[_0x9697('0x10')];_0x5c76c4<_0x346e84,_0x1d0901===![];_0x5c76c4+=0x1){if(_0x543c0c['indexOf'](_0x2bd6ee[_0x5c76c4])>=0x0){_0x1d0901=!![];}}if(!_0x1d0901){throw new Error(util[_0x9697('0x11')](_0x9697('0x12'),_0x24afcc['params'][_0x9697('0xf')]));}process[_0x9697('0x13')](_0x24afcc['params'][_0x9697('0xf')],_0x9697('0x14'));return _0x36d618['status'](0xc8)[_0x9697('0x9')]({'message':util['format'](_0x9697('0x15'),_0x24afcc[_0x9697('0xe')][_0x9697('0xf')])});})[_0x9697('0xa')](handleError(_0x36d618,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ea619d5..7ff6cbe 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 _0x558c=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete'];(function(_0x12b09c,_0x235ce6){var _0x54b03e=function(_0x39cf0d){while(--_0x39cf0d){_0x12b09c['push'](_0x12b09c['shift']());}};_0x54b03e(++_0x235ce6);}(_0x558c,0xbc));var _0xc558=function(_0x3f2859,_0x41049b){_0x3f2859=_0x3f2859-0x0;var _0x54a661=_0x558c[_0x3f2859];return _0x54a661;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc558('0x0'));var timeout=require(_0xc558('0x1'));var express=require(_0xc558('0x2'));var router=express[_0xc558('0x3')]();var fs_extra=require(_0xc558('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc558('0x5'));var config=require('../../config/environment');var controller=require(_0xc558('0x6'));router['get']('/',auth[_0xc558('0x7')](),controller[_0xc558('0x8')]);router[_0xc558('0x9')](_0xc558('0xa'),auth[_0xc558('0x7')](),controller[_0xc558('0xb')]);router[_0xc558('0xc')]('/',auth[_0xc558('0x7')](),controller['create']);router[_0xc558('0xd')]('/:id',auth[_0xc558('0x7')](),controller[_0xc558('0xe')]);router[_0xc558('0xf')](_0xc558('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc558('0x10')]=router; \ No newline at end of file +var _0x8374=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x436ecb,_0x3fb837){var _0x3930a5=function(_0x38b928){while(--_0x38b928){_0x436ecb['push'](_0x436ecb['shift']());}};_0x3930a5(++_0x3fb837);}(_0x8374,0x174));var _0x4837=function(_0x7a4905,_0x553600){_0x7a4905=_0x7a4905-0x0;var _0x44b80b=_0x8374[_0x7a4905];return _0x44b80b;};'use strict';var multer=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var path=require(_0x4837('0x2'));var timeout=require(_0x4837('0x3'));var express=require(_0x4837('0x4'));var router=express[_0x4837('0x5')]();var fs_extra=require(_0x4837('0x6'));var auth=require(_0x4837('0x7'));var interaction=require(_0x4837('0x8'));var config=require(_0x4837('0x9'));var controller=require(_0x4837('0xa'));router[_0x4837('0xb')]('/',auth[_0x4837('0xc')](),controller[_0x4837('0xd')]);router['get'](_0x4837('0xe'),auth['isAuthenticated'](),controller[_0x4837('0xf')]);router[_0x4837('0x10')]('/',auth[_0x4837('0xc')](),controller[_0x4837('0x11')]);router[_0x4837('0x12')](_0x4837('0xe'),auth[_0x4837('0xc')](),controller[_0x4837('0x13')]);router[_0x4837('0x14')](_0x4837('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4837('0x15')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index faf9b4f..ae44504 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 _0x8c50=['#0091EA','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8c50,0xcd));var _0x08c5=function(_0x43ba2e,_0x32253d){_0x43ba2e=_0x43ba2e-0x0;var _0x377348=_0x8c50[_0x43ba2e];return _0x377348;};'use strict';var Sequelize=require('sequelize');module[_0x08c5('0x0')]={'name':{'type':Sequelize[_0x08c5('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x08c5('0x1')],'defaultValue':_0x08c5('0x2')},'description':{'type':Sequelize[_0x08c5('0x1')]}}; \ No newline at end of file +var _0xb5fb=['sequelize','exports','STRING','name','#0091EA'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb5fb,0x172));var _0xbb5f=function(_0x477b78,_0x302499){_0x477b78=_0x477b78-0x0;var _0x2f3f99=_0xb5fb[_0x477b78];return _0x2f3f99;};'use strict';var Sequelize=require(_0xbb5f('0x0'));module[_0xbb5f('0x1')]={'name':{'type':Sequelize[_0xbb5f('0x2')],'unique':_0xbb5f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xbb5f('0x2')],'defaultValue':_0xbb5f('0x4')},'description':{'type':Sequelize[_0xbb5f('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 2a12090..a925059 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 _0x6c76=['to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','apply','reject','save','then','destroy','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path'];(function(_0x5442a5,_0x4110f1){var _0x130af0=function(_0x457ec2){while(--_0x457ec2){_0x5442a5['push'](_0x5442a5['shift']());}};_0x130af0(++_0x4110f1);}(_0x6c76,0x184));var _0x66c7=function(_0xecdc7c,_0x197f32){_0xecdc7c=_0xecdc7c-0x0;var _0x4a7142=_0x6c76[_0xecdc7c];return _0x4a7142;};'use strict';var emlformat=require(_0x66c7('0x0'));var rimraf=require(_0x66c7('0x1'));var zipdir=require(_0x66c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66c7('0x5'));var path=require(_0x66c7('0x6'));var sox=require('sox');var csv=require(_0x66c7('0x7'));var ejs=require(_0x66c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x7'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];function respondWithStatusCode(_0x5176a3,_0x18c309){_0x18c309=_0x18c309||0xcc;return function(_0x760e36){if(_0x760e36){return _0x5176a3[_0x66c7('0x17')](_0x18c309);}return _0x5176a3[_0x66c7('0x18')](_0x18c309)[_0x66c7('0x19')]();};}function respondWithResult(_0x1e91d1,_0x618bd7){_0x618bd7=_0x618bd7||0xc8;return function(_0xf3b04){if(_0xf3b04){return _0x1e91d1[_0x66c7('0x18')](_0x618bd7)['json'](_0xf3b04);}};}function respondWithFilteredResult(_0x110f6d,_0x4dd902){return function(_0x208010){if(_0x208010){var _0x39f951=typeof _0x4dd902[_0x66c7('0x1a')]===_0x66c7('0x1b')&&typeof _0x4dd902[_0x66c7('0x1c')]==='undefined';var _0x5cf913=_0x208010['count'];var _0x5129f6=_0x39f951?0x0:_0x4dd902[_0x66c7('0x1a')];var _0x19f29d=_0x39f951?_0x208010['count']:_0x4dd902['offset']+_0x4dd902[_0x66c7('0x1c')];var _0x9b65cf;if(_0x19f29d>=_0x5cf913){_0x19f29d=_0x5cf913;_0x9b65cf=0xc8;}else{_0x9b65cf=0xce;}_0x110f6d[_0x66c7('0x18')](_0x9b65cf);return _0x110f6d[_0x66c7('0x1d')]('Content-Range',_0x5129f6+'-'+_0x19f29d+'/'+_0x5cf913)['json'](_0x208010);}return null;};}function patchUpdates(_0x1853b2){return function(_0x237177){try{jsonpatch[_0x66c7('0x1e')](_0x237177,_0x1853b2,!![]);}catch(_0x1c43c4){return BPromise[_0x66c7('0x1f')](_0x1c43c4);}return _0x237177[_0x66c7('0x20')]();};}function saveUpdates(_0x4804cf,_0x4ddbd2){return function(_0x366e9b){if(_0x366e9b){return _0x366e9b['update'](_0x4804cf)[_0x66c7('0x21')](function(_0x8b96b1){return _0x8b96b1;});}return null;};}function removeEntity(_0x44bdef,_0x1fc9d3){return function(_0x5bfaf6){if(_0x5bfaf6){return _0x5bfaf6[_0x66c7('0x22')]()[_0x66c7('0x21')](function(){var _0x5b28e6=_0x5bfaf6[_0x66c7('0x23')]({'plain':!![]});var _0x11a6b9=_0x66c7('0x24');return db[_0x66c7('0x25')][_0x66c7('0x22')]({'where':{'type':_0x11a6b9,'resourceId':_0x5b28e6['id']}})['then'](function(){return _0x5bfaf6;});})['then'](function(){_0x44bdef['status'](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x542ff1,_0x5c5e42){return function(_0x9afd50){if(!_0x9afd50){_0x542ff1[_0x66c7('0x17')](0x194);}return _0x9afd50;};}function handleError(_0x205b7e,_0xb4b65b){_0xb4b65b=_0xb4b65b||0x1f4;return function(_0x36a830){logger[_0x66c7('0x26')](_0x36a830['stack']);if(_0x36a830[_0x66c7('0x27')]){delete _0x36a830[_0x66c7('0x27')];}_0x205b7e[_0x66c7('0x18')](_0xb4b65b)[_0x66c7('0x28')](_0x36a830);};}exports[_0x66c7('0x29')]=function(_0x592f0e,_0x263b48){var _0x4f1a34={},_0xfbd97={},_0x543fbf={'count':0x0,'rows':[]};var _0x296875=_[_0x66c7('0x2a')](db[_0x66c7('0x2b')][_0x66c7('0x2c')],function(_0xb26028){return{'name':_0xb26028[_0x66c7('0x2d')],'type':_0xb26028['type']['key']};});_0xfbd97[_0x66c7('0x2e')]=_[_0x66c7('0x2a')](_0x296875,_0x66c7('0x27'));_0xfbd97[_0x66c7('0x2f')]=_[_0x66c7('0x30')](_0x592f0e[_0x66c7('0x2f')]);_0xfbd97[_0x66c7('0x31')]=_[_0x66c7('0x32')](_0xfbd97[_0x66c7('0x2e')],_0xfbd97[_0x66c7('0x2f')]);_0x4f1a34[_0x66c7('0x33')]=_[_0x66c7('0x32')](_0xfbd97['model'],qs['fields'](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x34')]));_0x4f1a34[_0x66c7('0x33')]=_0x4f1a34[_0x66c7('0x33')][_0x66c7('0x35')]?_0x4f1a34[_0x66c7('0x33')]:_0xfbd97[_0x66c7('0x2e')];if(!_0x592f0e['query'][_0x66c7('0x36')](_0x66c7('0x37'))){_0x4f1a34[_0x66c7('0x1c')]=qs[_0x66c7('0x1c')](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x1c')]);_0x4f1a34[_0x66c7('0x1a')]=qs[_0x66c7('0x1a')](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x1a')]);}_0x4f1a34[_0x66c7('0x38')]=qs['sort'](_0x592f0e['query'][_0x66c7('0x39')]);_0x4f1a34[_0x66c7('0x3a')]=qs[_0x66c7('0x31')](_['pick'](_0x592f0e['query'],_0xfbd97[_0x66c7('0x31')]),_0x296875);if(_0x592f0e[_0x66c7('0x2f')]['filter']){_0x4f1a34[_0x66c7('0x3a')]=_[_0x66c7('0x3b')](_0x4f1a34[_0x66c7('0x3a')],{'$or':_['map'](_0x296875,function(_0x20374a){if(_0x20374a[_0x66c7('0x3c')]!==_0x66c7('0x3d')){var _0x14d59c={};_0x14d59c[_0x20374a[_0x66c7('0x27')]]={'$like':'%'+_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x3e')]+'%'};return _0x14d59c;}})});}_0x4f1a34=_[_0x66c7('0x3b')]({},_0x4f1a34,_0x592f0e[_0x66c7('0x3f')]);var _0x5f34ed={'where':_0x4f1a34[_0x66c7('0x3a')]};return db[_0x66c7('0x2b')][_0x66c7('0x40')](_0x5f34ed)[_0x66c7('0x21')](function(_0x3f169e){_0x543fbf[_0x66c7('0x40')]=_0x3f169e;if(_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x41')]){_0x4f1a34[_0x66c7('0x42')]=[{'all':!![]}];}return db[_0x66c7('0x2b')]['findAll'](_0x4f1a34);})['then'](function(_0x528f5c){_0x543fbf[_0x66c7('0x43')]=_0x528f5c;return _0x543fbf;})[_0x66c7('0x21')](respondWithFilteredResult(_0x263b48,_0x4f1a34))['catch'](handleError(_0x263b48,null));};exports['show']=function(_0x34d002,_0x3cd3ab){var _0x44d637={'raw':!![],'where':{'id':_0x34d002[_0x66c7('0x44')]['id']}},_0x900ee7={};_0x900ee7['model']=_[_0x66c7('0x30')](db['Tag']['rawAttributes']);_0x900ee7[_0x66c7('0x2f')]=_[_0x66c7('0x30')](_0x34d002[_0x66c7('0x2f')]);_0x900ee7[_0x66c7('0x31')]=_['intersection'](_0x900ee7['model'],_0x900ee7[_0x66c7('0x2f')]);_0x44d637['attributes']=_['intersection'](_0x900ee7[_0x66c7('0x2e')],qs[_0x66c7('0x34')](_0x34d002[_0x66c7('0x2f')][_0x66c7('0x34')]));_0x44d637['attributes']=_0x44d637[_0x66c7('0x33')][_0x66c7('0x35')]?_0x44d637[_0x66c7('0x33')]:_0x900ee7['model'];if(_0x34d002[_0x66c7('0x2f')][_0x66c7('0x41')]){_0x44d637[_0x66c7('0x42')]=[{'all':!![]}];}_0x44d637=_[_0x66c7('0x3b')]({},_0x44d637,_0x34d002[_0x66c7('0x3f')]);return db[_0x66c7('0x2b')][_0x66c7('0x45')](_0x44d637)[_0x66c7('0x21')](handleEntityNotFound(_0x3cd3ab,null))['then'](respondWithResult(_0x3cd3ab,null))[_0x66c7('0x46')](handleError(_0x3cd3ab,null));};exports[_0x66c7('0x47')]=function(_0x23d0eb,_0x1386a2){return db[_0x66c7('0x2b')][_0x66c7('0x47')](_0x23d0eb[_0x66c7('0x48')],{})[_0x66c7('0x21')](function(_0x1b3dc2){var _0x2d8eeb=_0x23d0eb[_0x66c7('0x49')][_0x66c7('0x23')]({'plain':!![]});if(!_0x2d8eeb)throw new Error(_0x66c7('0x4a'));if(_0x2d8eeb[_0x66c7('0x4b')]==='user'){var _0x43d4db=_0x1b3dc2[_0x66c7('0x23')]({'plain':!![]});var _0x27070b=_0x66c7('0x24');return db['UserProfileSection'][_0x66c7('0x45')]({'where':{'name':_0x27070b,'userProfileId':_0x2d8eeb[_0x66c7('0x4c')]},'raw':!![]})['then'](function(_0x275a20){if(_0x275a20&&_0x275a20[_0x66c7('0x4d')]===0x0){return db[_0x66c7('0x25')][_0x66c7('0x47')]({'name':_0x43d4db[_0x66c7('0x27')],'resourceId':_0x43d4db['id'],'type':_0x275a20[_0x66c7('0x27')],'sectionId':_0x275a20['id']},{})[_0x66c7('0x21')](function(){return _0x1b3dc2;});}else{return _0x1b3dc2;}})['catch'](function(_0x933dd6){logger[_0x66c7('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x933dd6);throw _0x933dd6;});}return _0x1b3dc2;})[_0x66c7('0x21')](respondWithResult(_0x1386a2,0xc9))[_0x66c7('0x46')](handleError(_0x1386a2,null));};exports[_0x66c7('0x4e')]=function(_0x5df6d1,_0x382a48){if(_0x5df6d1[_0x66c7('0x48')]['id']){delete _0x5df6d1[_0x66c7('0x48')]['id'];}return db[_0x66c7('0x2b')][_0x66c7('0x45')]({'where':{'id':_0x5df6d1[_0x66c7('0x44')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x382a48,null))[_0x66c7('0x21')](saveUpdates(_0x5df6d1['body'],null))[_0x66c7('0x21')](respondWithResult(_0x382a48,null))[_0x66c7('0x46')](handleError(_0x382a48,null));};exports['destroy']=function(_0x23f865,_0x167968){return db[_0x66c7('0x2b')]['find']({'where':{'id':_0x23f865['params']['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x167968,null))['then'](removeEntity(_0x167968,null))[_0x66c7('0x46')](handleError(_0x167968,null));}; \ No newline at end of file +var _0xe600=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Tag','includeAll','include','catch','show','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','fast-json-patch','request-promise'];(function(_0x14f6fa,_0x44743d){var _0x2c62a5=function(_0x398da0){while(--_0x398da0){_0x14f6fa['push'](_0x14f6fa['shift']());}};_0x2c62a5(++_0x44743d);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e60('0x1'));var rp=require(_0x0e60('0x2'));var moment=require(_0x0e60('0x3'));var BPromise=require(_0x0e60('0x4'));var Mustache=require(_0x0e60('0x5'));var util=require(_0x0e60('0x6'));var path=require(_0x0e60('0x7'));var sox=require(_0x0e60('0x8'));var csv=require(_0x0e60('0x9'));var ejs=require(_0x0e60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0x9'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e60('0x14'));var logger=require(_0x0e60('0x15'))(_0x0e60('0x16'));var utils=require(_0x0e60('0x17'));var config=require(_0x0e60('0x18'));var licenseUtil=require(_0x0e60('0x19'));var db=require(_0x0e60('0x1a'))['db'];function respondWithStatusCode(_0x2f5ee4,_0x540411){_0x540411=_0x540411||0xcc;return function(_0x2d848f){if(_0x2d848f){return _0x2f5ee4[_0x0e60('0x1b')](_0x540411);}return _0x2f5ee4[_0x0e60('0x1c')](_0x540411)[_0x0e60('0x1d')]();};}function respondWithResult(_0x45328b,_0x37bf95){_0x37bf95=_0x37bf95||0xc8;return function(_0x5d7f84){if(_0x5d7f84){return _0x45328b[_0x0e60('0x1c')](_0x37bf95)['json'](_0x5d7f84);}};}function respondWithFilteredResult(_0x91cd1,_0x128887){return function(_0x170890){if(_0x170890){var _0x5ab4ba=typeof _0x128887[_0x0e60('0x1e')]===_0x0e60('0x1f')&&typeof _0x128887[_0x0e60('0x20')]===_0x0e60('0x1f');var _0x2e6270=_0x170890['count'];var _0x992490=_0x5ab4ba?0x0:_0x128887[_0x0e60('0x1e')];var _0x599c1d=_0x5ab4ba?_0x170890[_0x0e60('0x21')]:_0x128887[_0x0e60('0x1e')]+_0x128887[_0x0e60('0x20')];var _0x504b31;if(_0x599c1d>=_0x2e6270){_0x599c1d=_0x2e6270;_0x504b31=0xc8;}else{_0x504b31=0xce;}_0x91cd1[_0x0e60('0x1c')](_0x504b31);return _0x91cd1['set'](_0x0e60('0x22'),_0x992490+'-'+_0x599c1d+'/'+_0x2e6270)[_0x0e60('0x23')](_0x170890);}return null;};}function patchUpdates(_0xb9f037){return function(_0xabf953){try{jsonpatch[_0x0e60('0x24')](_0xabf953,_0xb9f037,!![]);}catch(_0x31a63e){return BPromise[_0x0e60('0x25')](_0x31a63e);}return _0xabf953[_0x0e60('0x26')]();};}function saveUpdates(_0x352633,_0x10f875){return function(_0x22c0e0){if(_0x22c0e0){return _0x22c0e0[_0x0e60('0x27')](_0x352633)[_0x0e60('0x28')](function(_0x16985f){return _0x16985f;});}return null;};}function removeEntity(_0x4702f,_0x33f9f3){return function(_0x41642c){if(_0x41642c){return _0x41642c[_0x0e60('0x29')]()[_0x0e60('0x28')](function(){var _0x4ba1a8=_0x41642c[_0x0e60('0x2a')]({'plain':!![]});var _0x41ad9a='Tags';return db[_0x0e60('0x2b')]['destroy']({'where':{'type':_0x41ad9a,'resourceId':_0x4ba1a8['id']}})[_0x0e60('0x28')](function(){return _0x41642c;});})['then'](function(){_0x4702f['status'](0xcc)[_0x0e60('0x1d')]();});}};}function handleEntityNotFound(_0x39dae2,_0x526aaa){return function(_0x4eb9b8){if(!_0x4eb9b8){_0x39dae2[_0x0e60('0x1b')](0x194);}return _0x4eb9b8;};}function handleError(_0x54d7ce,_0x73e732){_0x73e732=_0x73e732||0x1f4;return function(_0x548919){logger['error'](_0x548919[_0x0e60('0x2c')]);if(_0x548919[_0x0e60('0x2d')]){delete _0x548919[_0x0e60('0x2d')];}_0x54d7ce['status'](_0x73e732)[_0x0e60('0x2e')](_0x548919);};}exports['index']=function(_0x2e22eb,_0x1d54c0){var _0x5beb5f={},_0x540c2c={},_0xc4a74c={'count':0x0,'rows':[]};var _0x1de60a=_[_0x0e60('0x2f')](db['Tag'][_0x0e60('0x30')],function(_0x3ea4ac){return{'name':_0x3ea4ac[_0x0e60('0x31')],'type':_0x3ea4ac[_0x0e60('0x32')][_0x0e60('0x33')]};});_0x540c2c['model']=_[_0x0e60('0x2f')](_0x1de60a,'name');_0x540c2c[_0x0e60('0x34')]=_['keys'](_0x2e22eb[_0x0e60('0x34')]);_0x540c2c[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x540c2c['model'],_0x540c2c[_0x0e60('0x34')]);_0x5beb5f[_0x0e60('0x37')]=_[_0x0e60('0x36')](_0x540c2c[_0x0e60('0x38')],qs[_0x0e60('0x39')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x39')]));_0x5beb5f[_0x0e60('0x37')]=_0x5beb5f[_0x0e60('0x37')][_0x0e60('0x3a')]?_0x5beb5f[_0x0e60('0x37')]:_0x540c2c[_0x0e60('0x38')];if(!_0x2e22eb['query'][_0x0e60('0x3b')](_0x0e60('0x3c'))){_0x5beb5f[_0x0e60('0x20')]=qs[_0x0e60('0x20')](_0x2e22eb['query']['limit']);_0x5beb5f[_0x0e60('0x1e')]=qs['offset'](_0x2e22eb[_0x0e60('0x34')]['offset']);}_0x5beb5f[_0x0e60('0x3d')]=qs[_0x0e60('0x3e')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x3e')]);_0x5beb5f[_0x0e60('0x3f')]=qs[_0x0e60('0x35')](_[_0x0e60('0x40')](_0x2e22eb[_0x0e60('0x34')],_0x540c2c[_0x0e60('0x35')]),_0x1de60a);if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x41')]){_0x5beb5f[_0x0e60('0x3f')]=_['merge'](_0x5beb5f[_0x0e60('0x3f')],{'$or':_['map'](_0x1de60a,function(_0x345a12){if(_0x345a12[_0x0e60('0x32')]!=='VIRTUAL'){var _0x482583={};_0x482583[_0x345a12[_0x0e60('0x2d')]]={'$like':'%'+_0x2e22eb[_0x0e60('0x34')]['filter']+'%'};return _0x482583;}})});}_0x5beb5f=_[_0x0e60('0x42')]({},_0x5beb5f,_0x2e22eb[_0x0e60('0x43')]);var _0x50090c={'where':_0x5beb5f[_0x0e60('0x3f')]};return db[_0x0e60('0x44')][_0x0e60('0x21')](_0x50090c)[_0x0e60('0x28')](function(_0x3ac0f0){_0xc4a74c[_0x0e60('0x21')]=_0x3ac0f0;if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x45')]){_0x5beb5f[_0x0e60('0x46')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x5beb5f);})['then'](function(_0x39c7d4){_0xc4a74c['rows']=_0x39c7d4;return _0xc4a74c;})[_0x0e60('0x28')](respondWithFilteredResult(_0x1d54c0,_0x5beb5f))[_0x0e60('0x47')](handleError(_0x1d54c0,null));};exports[_0x0e60('0x48')]=function(_0x4bfebf,_0x2b2354){var _0x2432a8={'raw':!![],'where':{'id':_0x4bfebf['params']['id']}},_0x4ce029={};_0x4ce029[_0x0e60('0x38')]=_[_0x0e60('0x49')](db[_0x0e60('0x44')][_0x0e60('0x30')]);_0x4ce029[_0x0e60('0x34')]=_[_0x0e60('0x49')](_0x4bfebf['query']);_0x4ce029[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x4ce029[_0x0e60('0x38')],_0x4ce029[_0x0e60('0x34')]);_0x2432a8[_0x0e60('0x37')]=_['intersection'](_0x4ce029['model'],qs['fields'](_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x39')]));_0x2432a8[_0x0e60('0x37')]=_0x2432a8[_0x0e60('0x37')]['length']?_0x2432a8['attributes']:_0x4ce029['model'];if(_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x45')]){_0x2432a8[_0x0e60('0x46')]=[{'all':!![]}];}_0x2432a8=_[_0x0e60('0x42')]({},_0x2432a8,_0x4bfebf[_0x0e60('0x43')]);return db['Tag']['find'](_0x2432a8)[_0x0e60('0x28')](handleEntityNotFound(_0x2b2354,null))[_0x0e60('0x28')](respondWithResult(_0x2b2354,null))[_0x0e60('0x47')](handleError(_0x2b2354,null));};exports[_0x0e60('0x4a')]=function(_0x4ad156,_0x36a999){return db[_0x0e60('0x44')][_0x0e60('0x4a')](_0x4ad156['body'],{})[_0x0e60('0x28')](function(_0xc6cee0){var _0x5e710d=_0x4ad156[_0x0e60('0x4b')]['get']({'plain':!![]});if(!_0x5e710d)throw new Error(_0x0e60('0x4c'));if(_0x5e710d[_0x0e60('0x4d')]===_0x0e60('0x4b')){var _0x2e887c=_0xc6cee0[_0x0e60('0x2a')]({'plain':!![]});var _0x4caeed=_0x0e60('0x4e');return db[_0x0e60('0x4f')][_0x0e60('0x50')]({'where':{'name':_0x4caeed,'userProfileId':_0x5e710d[_0x0e60('0x51')]},'raw':!![]})['then'](function(_0x19d7bc){if(_0x19d7bc&&_0x19d7bc[_0x0e60('0x52')]===0x0){return db[_0x0e60('0x2b')][_0x0e60('0x4a')]({'name':_0x2e887c['name'],'resourceId':_0x2e887c['id'],'type':_0x19d7bc[_0x0e60('0x2d')],'sectionId':_0x19d7bc['id']},{})['then'](function(){return _0xc6cee0;});}else{return _0xc6cee0;}})[_0x0e60('0x47')](function(_0x707dc6){logger[_0x0e60('0x53')](_0x0e60('0x54'),_0x707dc6);throw _0x707dc6;});}return _0xc6cee0;})[_0x0e60('0x28')](respondWithResult(_0x36a999,0xc9))[_0x0e60('0x47')](handleError(_0x36a999,null));};exports[_0x0e60('0x27')]=function(_0x49daf6,_0x124b8e){if(_0x49daf6['body']['id']){delete _0x49daf6[_0x0e60('0x55')]['id'];}return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x49daf6[_0x0e60('0x56')]['id']}})['then'](handleEntityNotFound(_0x124b8e,null))['then'](saveUpdates(_0x49daf6[_0x0e60('0x55')],null))['then'](respondWithResult(_0x124b8e,null))[_0x0e60('0x47')](handleError(_0x124b8e,null));};exports[_0x0e60('0x29')]=function(_0x313dd2,_0x24ada9){return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x313dd2[_0x0e60('0x56')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x24ada9,null))['then'](removeEntity(_0x24ada9,null))[_0x0e60('0x47')](handleError(_0x24ada9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9ff2439..0f3c8d7 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 _0xf7b4=['define','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0xf7b4,0x16e));var _0x4f7b=function(_0x2722bc,_0x221dd9){_0x2722bc=_0x2722bc-0x0;var _0x5ac515=_0xf7b4[_0x2722bc];return _0x5ac515;};'use strict';var _=require(_0x4f7b('0x0'));var util=require(_0x4f7b('0x1'));var logger=require(_0x4f7b('0x2'))(_0x4f7b('0x3'));var moment=require(_0x4f7b('0x4'));var BPromise=require(_0x4f7b('0x5'));var rp=require(_0x4f7b('0x6'));var fs=require('fs');var path=require(_0x4f7b('0x7'));var rimraf=require(_0x4f7b('0x8'));var config=require(_0x4f7b('0x9'));var attributes=require(_0x4f7b('0xa'));module[_0x4f7b('0xb')]=function(_0x11171c,_0x30717b){return _0x11171c[_0x4f7b('0xc')]('Tag',attributes,{'tableName':_0x4f7b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a4=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','util'];(function(_0x27c24d,_0x2b50f1){var _0x14e722=function(_0x2422ad){while(--_0x2422ad){_0x27c24d['push'](_0x27c24d['shift']());}};_0x14e722(++_0x2b50f1);}(_0xb8a4,0x83));var _0x4b8a=function(_0x4f2dfa,_0x2be505){_0x4f2dfa=_0x4f2dfa-0x0;var _0x1eebd2=_0xb8a4[_0x4f2dfa];return _0x1eebd2;};'use strict';var _=require('lodash');var util=require(_0x4b8a('0x0'));var logger=require(_0x4b8a('0x1'))(_0x4b8a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4b8a('0x3'));var fs=require('fs');var path=require(_0x4b8a('0x4'));var rimraf=require(_0x4b8a('0x5'));var config=require(_0x4b8a('0x6'));var attributes=require(_0x4b8a('0x7'));module[_0x4b8a('0x8')]=function(_0x149596,_0x269cd7){return _0x149596[_0x4b8a('0x9')]('Tag',attributes,{'tableName':_0x4b8a('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 d9578ea..33db51a 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 _0x07c3=['code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x07c3,0x1bf));var _0x307c=function(_0x395667,_0x45593a){_0x395667=_0x395667-0x0;var _0x5cdb8f=_0x07c3[_0x395667];return _0x5cdb8f;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var moment=require(_0x307c('0x2'));var BPromise=require(_0x307c('0x3'));var rs=require(_0x307c('0x4'));var fs=require('fs');var Redis=require(_0x307c('0x5'));var db=require(_0x307c('0x6'))['db'];var utils=require(_0x307c('0x7'));var logger=require('../../config/logger')(_0x307c('0x8'));var config=require(_0x307c('0x9'));var jayson=require(_0x307c('0xa'));var client=jayson[_0x307c('0xb')][_0x307c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x410ae8,_0x39af52,_0x3f5d08){return new BPromise(function(_0xfb14bf,_0x166467){return client[_0x307c('0xd')](_0x410ae8,_0x3f5d08)[_0x307c('0xe')](function(_0x1af97f){logger[_0x307c('0xf')](_0x307c('0x10'),_0x39af52,'request\x20sent');logger[_0x307c('0x11')](_0x307c('0x12'),_0x39af52,_0x307c('0x13'),JSON[_0x307c('0x14')](_0x1af97f));if(_0x1af97f['error']){if(_0x1af97f['error'][_0x307c('0x15')]===0x1f4){logger['error'](_0x307c('0x10'),_0x39af52,_0x1af97f[_0x307c('0x16')]['message']);return _0x166467(_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);}logger[_0x307c('0x16')](_0x307c('0x10'),_0x39af52,_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);return _0xfb14bf(_0x1af97f[_0x307c('0x16')][_0x307c('0x17')]);}else{logger[_0x307c('0xf')](_0x307c('0x10'),_0x39af52,_0x307c('0x13'));_0xfb14bf(_0x1af97f[_0x307c('0x18')]['message']);}})[_0x307c('0x19')](function(_0x364441){logger[_0x307c('0x16')](_0x307c('0x10'),_0x39af52,_0x364441);_0x166467(_0x364441);});});} \ No newline at end of file +var _0x32ef=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x2742bc,_0x4286ad){var _0x38f8c2=function(_0x1ae199){while(--_0x1ae199){_0x2742bc['push'](_0x2742bc['shift']());}};_0x38f8c2(++_0x4286ad);}(_0x32ef,0xf9));var _0xf32e=function(_0x1e3c4a,_0x1c35cc){_0x1e3c4a=_0x1e3c4a-0x0;var _0x439074=_0x32ef[_0x1e3c4a];return _0x439074;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var moment=require(_0xf32e('0x2'));var BPromise=require(_0xf32e('0x3'));var rs=require(_0xf32e('0x4'));var fs=require('fs');var Redis=require(_0xf32e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf32e('0x6'));var logger=require(_0xf32e('0x7'))('rpc');var config=require(_0xf32e('0x8'));var jayson=require(_0xf32e('0x9'));var client=jayson[_0xf32e('0xa')][_0xf32e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xefc0a7,_0x899efc,_0x5aa5c8){return new BPromise(function(_0xdac5e,_0x5b3463){return client[_0xf32e('0xc')](_0xefc0a7,_0x5aa5c8)[_0xf32e('0xd')](function(_0xc37ea7){logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,'request\x20sent');logger[_0xf32e('0x10')](_0xf32e('0x11'),_0x899efc,_0xf32e('0x12'),JSON[_0xf32e('0x13')](_0xc37ea7));if(_0xc37ea7[_0xf32e('0x14')]){if(_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x15')]===0x1f4){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0x5b3463(_0xc37ea7['error'][_0xf32e('0x16')]);}logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0xdac5e(_0xc37ea7[_0xf32e('0x14')]['message']);}else{logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,_0xf32e('0x12'));_0xdac5e(_0xc37ea7[_0xf32e('0x17')][_0xf32e('0x16')]);}})[_0xf32e('0x18')](function(_0x6a0231){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0x6a0231);_0x5b3463(_0x6a0231);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index c6ca3c7..3d99412 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 203e174..73a1a5f 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 _0x2032=['name','exports','STRING'];(function(_0x2a8321,_0x180b7c){var _0x274e75=function(_0x111f7c){while(--_0x111f7c){_0x2a8321['push'](_0x2a8321['shift']());}};_0x274e75(++_0x180b7c);}(_0x2032,0xd9));var _0x2203=function(_0x31d231,_0x1be633){_0x31d231=_0x31d231-0x0;var _0x440bff=_0x2032[_0x31d231];return _0x440bff;};'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 +var _0x757a=['exports','STRING'];(function(_0x49f601,_0x4d7500){var _0x1b73b9=function(_0x2282c5){while(--_0x2282c5){_0x49f601['push'](_0x49f601['shift']());}};_0x1b73b9(++_0x4d7500);}(_0x757a,0xde));var _0xa757=function(_0x25b482,_0xc0818c){_0x25b482=_0x25b482-0x0;var _0x8670b1=_0x757a[_0x25b482];return _0x8670b1;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 6b172ac..119d926 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 _0x8dd8=['Queue','findOne','add','removeQueues','ids','addAgents','isArray','Voice','Chat','Sms','Whatsapp','through','penalty','Queues','QueueId','TeamVoiceQueue','User','findOrCreate','findAll','online','voicePause','interface','upsert','format','SIP/%s','all','spread','removeAgents','transaction','Queue:remove','UserVoiceQueueRt','getAgents','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./team.socket','register','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','Team','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','find','create','body','user','get','role','Teams','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase'];(function(_0x2dea5e,_0x1e4c75){var _0x4e7c1c=function(_0x233244){while(--_0x233244){_0x2dea5e['push'](_0x2dea5e['shift']());}};_0x4e7c1c(++_0x1e4c75);}(_0x8dd8,0xb2));var _0x88dd=function(_0x24210a,_0x2c5597){_0x24210a=_0x24210a-0x0;var _0x248eab=_0x8dd8[_0x24210a];return _0x248eab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x88dd('0x0'));var jsonpatch=require(_0x88dd('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x88dd('0x2'));var util=require(_0x88dd('0x3'));var path=require(_0x88dd('0x4'));var sox=require(_0x88dd('0x5'));var csv=require(_0x88dd('0x6'));var ejs=require(_0x88dd('0x7'));var fs=require('fs');var fs_extra=require(_0x88dd('0x8'));var _=require('lodash');var squel=require(_0x88dd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x88dd('0xa'));var toCsv=require(_0x88dd('0x6'));var querystring=require(_0x88dd('0xb'));var Papa=require(_0x88dd('0xc'));var Redis=require('ioredis');var authService=require(_0x88dd('0xd'));var qs=require(_0x88dd('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x88dd('0xf'))('api');var utils=require(_0x88dd('0x10'));var config=require(_0x88dd('0x11'));var licenseUtil=require(_0x88dd('0x12'));var db=require(_0x88dd('0x13'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x88dd('0x14'),'port':0x18eb});var socket=require(_0x88dd('0x15'))(new Redis(config[_0x88dd('0x16')]));require(_0x88dd('0x17'))[_0x88dd('0x18')](socket);function respondWithStatusCode(_0x4c5640,_0xa43322){_0xa43322=_0xa43322||0xcc;return function(_0x410659){if(_0x410659){return _0x4c5640[_0x88dd('0x19')](_0xa43322);}return _0x4c5640['status'](_0xa43322)[_0x88dd('0x1a')]();};}function respondWithResult(_0x5490c2,_0x3e6250){_0x3e6250=_0x3e6250||0xc8;return function(_0x1a0eed){if(_0x1a0eed){return _0x5490c2[_0x88dd('0x1b')](_0x3e6250)['json'](_0x1a0eed);}};}function respondWithFilteredResult(_0x478dfe,_0x409a0a){return function(_0x445efe){if(_0x445efe){var _0x208f44=typeof _0x409a0a['offset']===_0x88dd('0x1c')&&typeof _0x409a0a['limit']===_0x88dd('0x1c');var _0x4a5c1c=_0x445efe[_0x88dd('0x1d')];var _0x351684=_0x208f44?0x0:_0x409a0a[_0x88dd('0x1e')];var _0x5b01da=_0x208f44?_0x445efe[_0x88dd('0x1d')]:_0x409a0a[_0x88dd('0x1e')]+_0x409a0a[_0x88dd('0x1f')];var _0x17c440;if(_0x5b01da>=_0x4a5c1c){_0x5b01da=_0x4a5c1c;_0x17c440=0xc8;}else{_0x17c440=0xce;}_0x478dfe[_0x88dd('0x1b')](_0x17c440);return _0x478dfe[_0x88dd('0x20')](_0x88dd('0x21'),_0x351684+'-'+_0x5b01da+'/'+_0x4a5c1c)[_0x88dd('0x22')](_0x445efe);}return null;};}function patchUpdates(_0x539cd4){return function(_0x4609ce){try{jsonpatch[_0x88dd('0x23')](_0x4609ce,_0x539cd4,!![]);}catch(_0x5264b3){return BPromise[_0x88dd('0x24')](_0x5264b3);}return _0x4609ce[_0x88dd('0x25')]();};}function saveUpdates(_0x1453ad,_0x571ac6){return function(_0x4028d0){if(_0x4028d0){return _0x4028d0[_0x88dd('0x26')](_0x1453ad)[_0x88dd('0x27')](function(_0xc9b40d){return _0xc9b40d;});}return null;};}function handleEntityNotFound(_0xd34d0c,_0x1a2131){return function(_0x39ccba){if(!_0x39ccba){_0xd34d0c['sendStatus'](0x194);}return _0x39ccba;};}function handleError(_0x3492b9,_0x175f5e){_0x175f5e=_0x175f5e||0x1f4;return function(_0x466eda){logger[_0x88dd('0x28')](_0x466eda['stack']);if(_0x466eda[_0x88dd('0x29')]){delete _0x466eda[_0x88dd('0x29')];}_0x3492b9[_0x88dd('0x1b')](_0x175f5e)[_0x88dd('0x2a')](_0x466eda);};}exports[_0x88dd('0x2b')]=function(_0x25fa09,_0x26f008){var _0xf60931={},_0xdd9985={},_0x61c45e={'count':0x0,'rows':[]};var _0xd508a9=_[_0x88dd('0x2c')](db[_0x88dd('0x2d')]['rawAttributes'],function(_0x2ab924){return{'name':_0x2ab924[_0x88dd('0x2e')],'type':_0x2ab924[_0x88dd('0x2f')]['key']};});_0xdd9985['model']=_[_0x88dd('0x2c')](_0xd508a9,_0x88dd('0x29'));_0xdd9985[_0x88dd('0x30')]=_[_0x88dd('0x31')](_0x25fa09['query']);_0xdd9985[_0x88dd('0x32')]=_[_0x88dd('0x33')](_0xdd9985[_0x88dd('0x34')],_0xdd9985['query']);_0xf60931['attributes']=_[_0x88dd('0x33')](_0xdd9985['model'],qs[_0x88dd('0x35')](_0x25fa09[_0x88dd('0x30')][_0x88dd('0x35')]));_0xf60931[_0x88dd('0x36')]=_0xf60931['attributes'][_0x88dd('0x37')]?_0xf60931[_0x88dd('0x36')]:_0xdd9985[_0x88dd('0x34')];if(!_0x25fa09[_0x88dd('0x30')][_0x88dd('0x38')](_0x88dd('0x39'))){_0xf60931[_0x88dd('0x1f')]=qs['limit'](_0x25fa09[_0x88dd('0x30')][_0x88dd('0x1f')]);_0xf60931[_0x88dd('0x1e')]=qs['offset'](_0x25fa09[_0x88dd('0x30')][_0x88dd('0x1e')]);}_0xf60931[_0x88dd('0x3a')]=qs[_0x88dd('0x3b')](_0x25fa09[_0x88dd('0x30')][_0x88dd('0x3b')]);_0xf60931[_0x88dd('0x3c')]=qs[_0x88dd('0x32')](_[_0x88dd('0x3d')](_0x25fa09[_0x88dd('0x30')],_0xdd9985['filters']),_0xd508a9);if(_0x25fa09['query']['filter']){_0xf60931[_0x88dd('0x3c')]=_[_0x88dd('0x3e')](_0xf60931[_0x88dd('0x3c')],{'$or':_[_0x88dd('0x2c')](_0xd508a9,function(_0x515bba){if(_0x515bba[_0x88dd('0x2f')]!==_0x88dd('0x3f')){var _0x57d744={};_0x57d744[_0x515bba[_0x88dd('0x29')]]={'$like':'%'+_0x25fa09['query'][_0x88dd('0x40')]+'%'};return _0x57d744;}})});}_0xf60931=_[_0x88dd('0x3e')]({},_0xf60931,_0x25fa09[_0x88dd('0x41')]);var _0x28c181={'where':_0xf60931[_0x88dd('0x3c')]};return db['Team']['count'](_0x28c181)[_0x88dd('0x27')](function(_0x49232d){_0x61c45e[_0x88dd('0x1d')]=_0x49232d;if(_0x25fa09[_0x88dd('0x30')]['includeAll']){_0xf60931[_0x88dd('0x42')]=[{'all':!![]}];}return db['Team']['findAll'](_0xf60931);})[_0x88dd('0x27')](function(_0x59d472){_0x61c45e[_0x88dd('0x43')]=_0x59d472;return _0x61c45e;})[_0x88dd('0x27')](respondWithFilteredResult(_0x26f008,_0xf60931))['catch'](handleError(_0x26f008,null));};exports[_0x88dd('0x44')]=function(_0x5611c2,_0x18f364){var _0x3fa77e={'raw':![],'where':{'id':_0x5611c2[_0x88dd('0x45')]['id']}},_0x4aad74={};_0x4aad74['model']=_[_0x88dd('0x31')](db[_0x88dd('0x2d')][_0x88dd('0x46')]);_0x4aad74[_0x88dd('0x30')]=_['keys'](_0x5611c2['query']);_0x4aad74[_0x88dd('0x32')]=_[_0x88dd('0x33')](_0x4aad74['model'],_0x4aad74[_0x88dd('0x30')]);_0x3fa77e[_0x88dd('0x36')]=_[_0x88dd('0x33')](_0x4aad74[_0x88dd('0x34')],qs[_0x88dd('0x35')](_0x5611c2[_0x88dd('0x30')][_0x88dd('0x35')]));_0x3fa77e[_0x88dd('0x36')]=_0x3fa77e[_0x88dd('0x36')][_0x88dd('0x37')]?_0x3fa77e[_0x88dd('0x36')]:_0x4aad74['model'];if(_0x5611c2[_0x88dd('0x30')][_0x88dd('0x47')]){_0x3fa77e['include']=[{'all':!![]}];}_0x3fa77e=_[_0x88dd('0x3e')]({},_0x3fa77e,_0x5611c2[_0x88dd('0x41')]);return db[_0x88dd('0x2d')][_0x88dd('0x48')](_0x3fa77e)[_0x88dd('0x27')](handleEntityNotFound(_0x18f364,null))[_0x88dd('0x27')](respondWithResult(_0x18f364,null))['catch'](handleError(_0x18f364,null));};exports[_0x88dd('0x49')]=function(_0x32994e,_0x1d4a45){return db[_0x88dd('0x2d')][_0x88dd('0x49')](_0x32994e[_0x88dd('0x4a')],{})['then'](function(_0xbae55b){var _0x3a9c7c=_0x32994e[_0x88dd('0x4b')][_0x88dd('0x4c')]({'plain':!![]});if(!_0x3a9c7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a9c7c[_0x88dd('0x4d')]===_0x88dd('0x4b')){var _0x5ba143=_0xbae55b['get']({'plain':!![]});var _0x236abf=_0x88dd('0x4e');return db['UserProfileSection'][_0x88dd('0x48')]({'where':{'name':_0x236abf,'userProfileId':_0x3a9c7c['userProfileId']},'raw':!![]})[_0x88dd('0x27')](function(_0x34f5b7){if(_0x34f5b7&&_0x34f5b7[_0x88dd('0x4f')]===0x0){return db[_0x88dd('0x50')][_0x88dd('0x49')]({'name':_0x5ba143['name'],'resourceId':_0x5ba143['id'],'type':_0x34f5b7[_0x88dd('0x29')],'sectionId':_0x34f5b7['id']},{})[_0x88dd('0x27')](function(){return _0xbae55b;});}else{return _0xbae55b;}})[_0x88dd('0x51')](function(_0x2f56fa){logger[_0x88dd('0x28')](_0x88dd('0x52'),_0x2f56fa);throw _0x2f56fa;});}return _0xbae55b;})['then'](respondWithResult(_0x1d4a45,0xc9))['catch'](handleError(_0x1d4a45,null));};exports[_0x88dd('0x26')]=function(_0x10cf68,_0x543a68){if(_0x10cf68[_0x88dd('0x4a')]['id']){delete _0x10cf68[_0x88dd('0x4a')]['id'];}return db[_0x88dd('0x2d')][_0x88dd('0x48')]({'where':{'id':_0x10cf68[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](handleEntityNotFound(_0x543a68,null))[_0x88dd('0x27')](saveUpdates(_0x10cf68['body'],null))[_0x88dd('0x27')](respondWithResult(_0x543a68,null))[_0x88dd('0x51')](handleError(_0x543a68,null));};exports[_0x88dd('0x53')]=function(_0x46756e,_0x530594){var _0x17cab9=_0x46756e[_0x88dd('0x45')]['id'];var _0x506950=[];return db[_0x88dd('0x54')]['transaction'](function(_0x727169){var _0x27a108=_0x88dd('0x55')+_0x17cab9;return db[_0x88dd('0x54')]['query'](_0x27a108,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')]['SELECT'],'raw':!![],'transaction':_0x727169})['then'](function(_0x15a68f){_0x506950=_[_0x88dd('0x2c')](_0x15a68f,function(_0x2f68be){return Number(_0x2f68be['UserId']);});})['then'](function(){var _0x14926e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17cab9;return db['sequelize'][_0x88dd('0x30')](_0x14926e,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x2a63d4){var _0x4effa2=_[_0x88dd('0x2c')](_0x2a63d4,function(_0x4208fe){return Number(_0x4208fe[_0x88dd('0x59')]);});return db[_0x88dd('0x5a')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'VoiceQueueId':{'$in':_0x4effa2}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x454efd=_0x88dd('0x5b')+_0x17cab9;return db['sequelize'][_0x88dd('0x30')](_0x454efd,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x40d1a4){var _0x58b05e=_[_0x88dd('0x2c')](_0x40d1a4,function(_0x2c9831){return Number(_0x2c9831[_0x88dd('0x5c')]);});return db[_0x88dd('0x5d')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'MailQueueId':{'$in':_0x58b05e}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x9831a7=_0x88dd('0x5e')+_0x17cab9;return db[_0x88dd('0x54')][_0x88dd('0x30')](_0x9831a7,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x4a1423){var _0x1d821e=_[_0x88dd('0x2c')](_0x4a1423,function(_0x47fe49){return Number(_0x47fe49[_0x88dd('0x5f')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x506950},'SmsQueueId':{'$in':_0x1d821e}},'transaction':_0x727169});})['then'](function(){var _0x36e643=_0x88dd('0x60')+_0x17cab9;return db['sequelize']['query'](_0x36e643,{'type':db[_0x88dd('0x56')][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x476462){var _0xebdca=_[_0x88dd('0x2c')](_0x476462,function(_0x25a676){return Number(_0x25a676['ChatQueueId']);});return db[_0x88dd('0x61')]['destroy']({'where':{'UserId':{'$in':_0x506950},'ChatQueueId':{'$in':_0xebdca}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x92fb96=_0x88dd('0x62')+_0x17cab9;return db['sequelize'][_0x88dd('0x30')](_0x92fb96,{'type':db['Sequelize']['QueryTypes'][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x89e347){var _0x4db659=_[_0x88dd('0x2c')](_0x89e347,function(_0x820681){return Number(_0x820681['FaxQueueId']);});return db[_0x88dd('0x63')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'FaxQueueId':{'$in':_0x4db659}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x5565e5=_0x88dd('0x64')+_0x17cab9;return db[_0x88dd('0x54')][_0x88dd('0x30')](_0x5565e5,{'type':db['Sequelize'][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x276be0){var _0x1fca80=_['map'](_0x276be0,function(_0x4ce9d8){return Number(_0x4ce9d8[_0x88dd('0x65')]);});return db['UserOpenchannelQueue'][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'OpenchannelQueueId':{'$in':_0x1fca80}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){var _0x57371e=_0x88dd('0x66')+_0x17cab9;return db[_0x88dd('0x54')][_0x88dd('0x30')](_0x57371e,{'type':db['Sequelize'][_0x88dd('0x57')][_0x88dd('0x58')],'raw':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x10aecb){var _0x393d93=_[_0x88dd('0x2c')](_0x10aecb,function(_0x39d804){return Number(_0x39d804[_0x88dd('0x67')]);});return db[_0x88dd('0x68')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'WhatsappQueueId':{'$in':_0x393d93}},'transaction':_0x727169});})[_0x88dd('0x27')](function(){return db[_0x88dd('0x69')][_0x88dd('0x48')]({'where':{'TeamId':_0x17cab9}});})[_0x88dd('0x27')](function(_0x353938){if(_0x353938===null){return;}return db[_0x88dd('0x6a')][_0x88dd('0x53')]({'where':{'UserId':{'$in':_0x506950},'VoicePrefixId':_0x353938[_0x88dd('0x6b')]},'transaction':_0x727169});})[_0x88dd('0x27')](function(){return db['Team'][_0x88dd('0x53')]({'where':{'id':_0x17cab9},'cascade':!![],'transaction':_0x727169});})[_0x88dd('0x27')](function(_0x32ee1b){if(_0x32ee1b===0x0){_0x530594['sendStatus'](0x194);}else{return db[_0x88dd('0x50')][_0x88dd('0x53')]({'where':{'type':_0x88dd('0x4e'),'resourceId':_0x17cab9},'cascade':!![],'transaction':_0x727169})[_0x88dd('0x27')](function(){_0x530594[_0x88dd('0x1b')](0xcc)[_0x88dd('0x1a')]();});}})[_0x88dd('0x51')](function(_0x3d12d8){_0x530594[_0x88dd('0x1b')](0x1f4)[_0x88dd('0x2a')](_0x3d12d8);});});};exports['getQueues']=function(_0x485c0a,_0x3de463,_0x4d74b6){return db['Team']['findOne']({'where':{'id':_0x485c0a[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](handleEntityNotFound(_0x3de463,null))['then'](function(_0x2d2faf){if(!_0x485c0a[_0x88dd('0x30')][_0x88dd('0x6c')]||!utils[_0x88dd('0x6d')](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x6c')])){throw new db['Sequelize'][(_0x88dd('0x6e'))](_0x88dd('0x6f'));}var _0x567696={};var _0x3d5c08={};_0x3d5c08[_0x88dd('0x34')]=_[_0x88dd('0x31')](db[_[_0x88dd('0x70')](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x6c')][_0x88dd('0x71')]())+_0x88dd('0x72')][_0x88dd('0x46')]);_0x3d5c08['query']=_['keys'](_0x485c0a['query']);_0x3d5c08[_0x88dd('0x32')]=_['intersection'](_0x3d5c08[_0x88dd('0x34')],_0x3d5c08[_0x88dd('0x30')]);_0x567696[_0x88dd('0x36')]=_[_0x88dd('0x33')](_0x3d5c08[_0x88dd('0x34')],qs[_0x88dd('0x35')](_0x485c0a[_0x88dd('0x30')]['fields']));_0x567696[_0x88dd('0x36')]=_0x567696[_0x88dd('0x36')][_0x88dd('0x37')]?_0x567696[_0x88dd('0x36')]:_0x3d5c08[_0x88dd('0x34')];_0x567696[_0x88dd('0x1f')]=qs['limit'](_0x485c0a['query'][_0x88dd('0x1f')]);_0x567696[_0x88dd('0x1e')]=qs['offset'](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x1e')]);_0x567696['order']=qs[_0x88dd('0x3b')](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x3b')]);_0x567696[_0x88dd('0x3c')]=qs['filters'](_[_0x88dd('0x3d')](_0x485c0a['query'],_0x3d5c08[_0x88dd('0x32')]));_0x567696=_[_0x88dd('0x3e')]({},_0x567696,_0x485c0a[_0x88dd('0x41')]);return _0x2d2faf[_0x88dd('0x4c')+_[_0x88dd('0x70')](_0x485c0a[_0x88dd('0x30')][_0x88dd('0x6c')][_0x88dd('0x71')]())+'Queues'](_0x567696);})[_0x88dd('0x27')](respondWithResult(_0x3de463,null))[_0x88dd('0x51')](handleError(_0x3de463,null));};exports['addQueues']=function(_0x52e328,_0x40e2be,_0x1d88ae){return db[_0x88dd('0x2d')][_0x88dd('0x73')]({'where':{'id':_0x52e328[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](function(_0x51b3a4){if(_0x51b3a4){if(!_0x52e328[_0x88dd('0x4a')]['channel']||!utils['isValidChannel'](_0x52e328[_0x88dd('0x4a')]['channel'])){throw new db[(_0x88dd('0x56'))][(_0x88dd('0x6e'))]('Unknown\x20channel');}return _0x51b3a4[_0x88dd('0x74')+_[_0x88dd('0x70')](_0x52e328[_0x88dd('0x4a')][_0x88dd('0x6c')]['toLowerCase']())+'Queues'](_0x52e328[_0x88dd('0x4a')]['ids']);}return null;})[_0x88dd('0x27')](handleEntityNotFound(_0x40e2be,null))[_0x88dd('0x27')](respondWithStatusCode(_0x40e2be,null))[_0x88dd('0x51')](handleError(_0x40e2be,null));};exports[_0x88dd('0x75')]=function(_0x193714,_0x37ecff,_0x238a0e){return db['Team'][_0x88dd('0x73')]({'where':{'id':_0x193714[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](function(_0x5429b1){if(_0x5429b1){if(!_0x193714['query'][_0x88dd('0x6c')]||!utils[_0x88dd('0x6d')](_0x193714[_0x88dd('0x30')]['channel'])){throw new db[(_0x88dd('0x56'))][(_0x88dd('0x6e'))](_0x88dd('0x6f'));}return _0x5429b1['remove'+_['capitalize'](_0x193714['query'][_0x88dd('0x6c')][_0x88dd('0x71')]())+'Queues'](_0x193714['query'][_0x88dd('0x76')]);}return null;})[_0x88dd('0x27')](handleEntityNotFound(_0x37ecff,null))[_0x88dd('0x27')](respondWithStatusCode(_0x37ecff,null))[_0x88dd('0x51')](handleError(_0x37ecff,null));};exports[_0x88dd('0x77')]=function(_0x1c3644,_0x3f5cbd){var _0x4f86ff=_[_0x88dd('0x78')](_0x1c3644[_0x88dd('0x4a')][_0x88dd('0x76')])?_0x1c3644[_0x88dd('0x4a')][_0x88dd('0x76')]:[_0x1c3644[_0x88dd('0x4a')][_0x88dd('0x76')]];var _0x5a0524=_0x1c3644[_0x88dd('0x45')]['id'];return db[_0x88dd('0x2d')][_0x88dd('0x48')]({'where':{'id':_0x5a0524}})[_0x88dd('0x27')](handleEntityNotFound(_0x3f5cbd,null))[_0x88dd('0x27')](function(_0x433ba5){if(_0x433ba5){var _0x3cd9d1=[_0x88dd('0x79'),_0x88dd('0x7a'),'Mail',_0x88dd('0x7b'),'Fax','Openchannel',_0x88dd('0x7c')];return db[_0x88dd('0x54')]['transaction'](function(_0x1c0f57){var _0x1e495c=_[_0x88dd('0x2c')](_0x3cd9d1,function(_0x4eb550){var _0x398194={'attributes':['id',_0x88dd('0x29')]};if(_0x4eb550===_0x88dd('0x79')){_0x398194[_0x88dd('0x7d')]={'attributes':[_0x88dd('0x7e')]};}return _0x433ba5['get'+_0x4eb550+_0x88dd('0x7f')](_0x398194)['then'](function(_0x4324bf){var _0x381e2d=_[_0x88dd('0x2c')](_0x4324bf,function(_0x5ac938){var _0x50ce5d=_['map'](_0x4f86ff,function(_0x17d0a6){var _0x4ab669={'where':{'UserId':_0x17d0a6,[_0x4eb550+_0x88dd('0x80')]:_0x5ac938['id']},'transaction':_0x1c0f57};if(_0x4eb550===_0x88dd('0x79')){_0x4ab669['defaults']={'penalty':_0x5ac938[_0x88dd('0x81')][_0x88dd('0x7e')]};}return db[_0x88dd('0x82')+_0x4eb550+_0x88dd('0x72')][_0x88dd('0x83')](_0x4ab669)[_0x88dd('0x27')](function(){socket['emit']('user'+_0x4eb550+'Queue:save',{'UserId':_0x17d0a6,[_0x4eb550+'QueueId']:_0x5ac938['id']});if(_0x4eb550!==_0x88dd('0x79')){return;}return db['User'][_0x88dd('0x84')]({'where':{'id':_0x4f86ff,'online':0x1},'attributes':['id','name',_0x88dd('0x85'),_0x88dd('0x86'),_0x88dd('0x87')],'raw':!![]})[_0x88dd('0x27')](function(_0x1226d2){var _0x23a219=_[_0x88dd('0x2c')](_0x1226d2,function(_0x4fc936){return db['UserVoiceQueueRt'][_0x88dd('0x88')]({'membername':_0x4fc936[_0x88dd('0x29')],'UserId':_0x4fc936['id'],'queue_name':_0x5ac938['name'],'VoiceQueueId':_0x5ac938['id'],'interface':_['isNil'](_0x4fc936['interface'])?util[_0x88dd('0x89')](_0x88dd('0x8a'),_0x4fc936[_0x88dd('0x29')]):_0x4fc936[_0x88dd('0x87')],'paused':_0x4fc936[_0x88dd('0x86')]||![],'penalty':_0x5ac938[_0x88dd('0x81')][_0x88dd('0x7e')]},{'transaction':_0x1c0f57});});return Promise[_0x88dd('0x8b')](_0x23a219);});});});return Promise[_0x88dd('0x8b')](_0x50ce5d);});return Promise[_0x88dd('0x8b')](_0x381e2d);})[_0x88dd('0x27')](function(){return db[_0x88dd('0x69')]['findOne']({'where':{'teamId':_0x5a0524}})[_0x88dd('0x27')](function(_0x1d532c){if(_0x1d532c){var _0x1d1d01=_[_0x88dd('0x2c')](_0x4f86ff,function(_0x1e958e){db[_0x88dd('0x6a')]['upsert']({'UserId':_0x1e958e,'VoicePrefixId':_0x1d532c[_0x88dd('0x6b')]});});return Promise[_0x88dd('0x8b')](_0x1d1d01);}});});});return Promise['all'](_0x1e495c)[_0x88dd('0x27')](function(){return _0x433ba5[_0x88dd('0x77')](_0x4f86ff,{'transaction':_0x1c0f57})[_0x88dd('0x8c')](function(_0x192278){return _0x192278;});});});}})[_0x88dd('0x27')](respondWithResult(_0x3f5cbd,null))[_0x88dd('0x51')](handleError(_0x3f5cbd,null));};exports[_0x88dd('0x8d')]=function(_0x429369,_0x55ce45){var _0x1acdd3=_[_0x88dd('0x78')](_0x429369['query'][_0x88dd('0x76')])?_0x429369[_0x88dd('0x30')][_0x88dd('0x76')]:[_0x429369[_0x88dd('0x30')][_0x88dd('0x76')]];var _0x29b25f=_0x429369[_0x88dd('0x45')]['id'];return db[_0x88dd('0x2d')][_0x88dd('0x48')]({'where':{'id':_0x29b25f}})[_0x88dd('0x27')](handleEntityNotFound(_0x55ce45,null))['then'](function(_0x1d02f7){if(_0x1d02f7){var _0x5277c2=[_0x88dd('0x79'),'Chat','Mail',_0x88dd('0x7b'),'Fax','Openchannel','Whatsapp'];return db[_0x88dd('0x54')][_0x88dd('0x8e')](function(_0x5a368f){var _0x447719=_[_0x88dd('0x2c')](_0x5277c2,function(_0x16cabc){var _0x45db59={'attributes':['id',_0x88dd('0x29')]};return _0x1d02f7[_0x88dd('0x4c')+_0x16cabc+_0x88dd('0x7f')](_0x45db59)[_0x88dd('0x27')](function(_0x476d9f){var _0x3bf0b0=_[_0x88dd('0x2c')](_0x476d9f,function(_0x51154f){return _0x51154f[_0x88dd('0x8d')](_0x1acdd3,{'transaction':_0x5a368f})[_0x88dd('0x27')](function(){var _0x30c3f1=_[_0x88dd('0x2c')](_0x1acdd3,function(_0x4903ed){socket['emit']('user'+_0x16cabc+_0x88dd('0x8f'),{'UserId':Number(_0x4903ed),[_0x16cabc+_0x88dd('0x80')]:_0x51154f['id']});if(_0x16cabc!==_0x88dd('0x79')){return;}return db[_0x88dd('0x90')][_0x88dd('0x53')]({'where':{'VoiceQueueId':_0x51154f['id'],'UserId':_0x4903ed},'transaction':_0x5a368f});});return Promise[_0x88dd('0x8b')](_0x30c3f1);});});return Promise[_0x88dd('0x8b')](_0x3bf0b0);});});return Promise[_0x88dd('0x8b')](_0x447719)[_0x88dd('0x27')](function(){return _0x1d02f7[_0x88dd('0x8d')](_0x1acdd3,{'transaction':_0x5a368f});})[_0x88dd('0x27')](function(){return db[_0x88dd('0x69')][_0x88dd('0x73')]({'where':{'teamId':_0x29b25f}})[_0x88dd('0x27')](function(_0x3fed4b){if(_0x3fed4b){var _0x5b9d1f=_[_0x88dd('0x2c')](_0x1acdd3,function(_0x5cc152){db['UserVoicePrefix'][_0x88dd('0x53')]({'where':{'UserId':_0x5cc152,'VoicePrefixId':_0x3fed4b['VoicePrefixId']}});});return Promise[_0x88dd('0x8b')](_0x5b9d1f);}});});});}})[_0x88dd('0x27')](respondWithStatusCode(_0x55ce45,null))[_0x88dd('0x51')](handleError(_0x55ce45,null));};exports[_0x88dd('0x91')]=function(_0x160cce,_0xb594e6,_0x45b57b){var _0x17e7b9={};var _0x4e76ea={};var _0x3e74a9;var _0xb92a8b;return db[_0x88dd('0x2d')][_0x88dd('0x73')]({'where':{'id':_0x160cce[_0x88dd('0x45')]['id']}})[_0x88dd('0x27')](handleEntityNotFound(_0xb594e6,null))[_0x88dd('0x27')](function(_0x2af858){if(_0x2af858){_0x3e74a9=_0x2af858;_0x4e76ea[_0x88dd('0x34')]=_[_0x88dd('0x31')](db[_0x88dd('0x82')][_0x88dd('0x46')]);_0x4e76ea[_0x88dd('0x30')]=_[_0x88dd('0x31')](_0x160cce[_0x88dd('0x30')]);_0x4e76ea[_0x88dd('0x32')]=_[_0x88dd('0x33')](_0x4e76ea[_0x88dd('0x34')],_0x4e76ea['query']);_0x17e7b9[_0x88dd('0x36')]=_[_0x88dd('0x33')](_0x4e76ea[_0x88dd('0x34')],qs[_0x88dd('0x35')](_0x160cce[_0x88dd('0x30')][_0x88dd('0x35')]));_0x17e7b9['attributes']=_0x17e7b9[_0x88dd('0x36')][_0x88dd('0x37')]?_0x17e7b9['attributes']:_0x4e76ea[_0x88dd('0x34')];_0x17e7b9[_0x88dd('0x3a')]=qs[_0x88dd('0x3b')](_0x160cce[_0x88dd('0x30')][_0x88dd('0x3b')]);_0x17e7b9[_0x88dd('0x3c')]=qs[_0x88dd('0x32')](_[_0x88dd('0x3d')](_0x160cce[_0x88dd('0x30')],_0x4e76ea[_0x88dd('0x32')]));if(_0x160cce['query'][_0x88dd('0x40')]){_0x17e7b9[_0x88dd('0x3c')]=_[_0x88dd('0x3e')](_0x17e7b9[_0x88dd('0x3c')],{'$or':_[_0x88dd('0x2c')](_0x17e7b9[_0x88dd('0x36')],function(_0x37bfc0){var _0x127260={};_0x127260[_0x37bfc0]={'$like':'%'+_0x160cce['query'][_0x88dd('0x40')]+'%'};return _0x127260;})});}_0x17e7b9=_['merge']({},_0x17e7b9,_0x160cce['options']);return _0x3e74a9[_0x88dd('0x91')](_0x17e7b9);}})[_0x88dd('0x27')](function(_0x4b716b){if(_0x4b716b){_0xb92a8b=_0x4b716b[_0x88dd('0x37')];if(!_0x160cce['query'][_0x88dd('0x38')](_0x88dd('0x39'))){_0x17e7b9['limit']=qs[_0x88dd('0x1f')](_0x160cce[_0x88dd('0x30')]['limit']);_0x17e7b9['offset']=qs[_0x88dd('0x1e')](_0x160cce['query'][_0x88dd('0x1e')]);}return _0x3e74a9[_0x88dd('0x91')](_0x17e7b9);}})[_0x88dd('0x27')](function(_0x3d459c){if(_0x3d459c){return _0x3d459c?{'count':_0xb92a8b,'rows':_0x3d459c}:null;}})['then'](respondWithResult(_0xb594e6,null))['catch'](handleError(_0xb594e6,null));}; \ No newline at end of file +var _0x394d=['Mail','Sms','Fax','Openchannel','Whatsapp','transaction','TeamVoiceQueue','penalty','User','findOrCreate','QueueId','online','voicePause','UserVoiceQueueRt','upsert','interface','format','SIP/%s','all','UserVoicePrefix','addAgents','removeAgents','emit','VoicePrefixId','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','Team','findAll','rows','catch','show','params','keys','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','find','autoAssociation','UserProfileResource','body','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','getQueues','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ValidationError','add','remove','isArray','ids','Voice','Chat'];(function(_0x4165de,_0x12b90d){var _0x1852f9=function(_0x15535f){while(--_0x15535f){_0x4165de['push'](_0x4165de['shift']());}};_0x1852f9(++_0x12b90d);}(_0x394d,0x1ee));var _0xd394=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x394d[_0x1deb03];return _0x189fe7;};'use strict';var emlformat=require(_0xd394('0x0'));var rimraf=require(_0xd394('0x1'));var zipdir=require(_0xd394('0x2'));var jsonpatch=require(_0xd394('0x3'));var rp=require(_0xd394('0x4'));var moment=require(_0xd394('0x5'));var BPromise=require(_0xd394('0x6'));var Mustache=require('mustache');var util=require(_0xd394('0x7'));var path=require(_0xd394('0x8'));var sox=require(_0xd394('0x9'));var csv=require(_0xd394('0xa'));var ejs=require(_0xd394('0xb'));var fs=require('fs');var fs_extra=require(_0xd394('0xc'));var _=require(_0xd394('0xd'));var squel=require(_0xd394('0xe'));var crypto=require('crypto');var jsforce=require(_0xd394('0xf'));var deskjs=require(_0xd394('0x10'));var toCsv=require(_0xd394('0xa'));var querystring=require(_0xd394('0x11'));var Papa=require(_0xd394('0x12'));var Redis=require(_0xd394('0x13'));var authService=require(_0xd394('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd394('0x15'));var logger=require('../../config/logger')(_0xd394('0x16'));var utils=require(_0xd394('0x17'));var config=require(_0xd394('0x18'));var licenseUtil=require(_0xd394('0x19'));var db=require(_0xd394('0x1a'))['db'];config[_0xd394('0x1b')]=_[_0xd394('0x1c')](config['redis'],{'host':_0xd394('0x1d'),'port':0x18eb});var socket=require(_0xd394('0x1e'))(new Redis(config[_0xd394('0x1b')]));require(_0xd394('0x1f'))[_0xd394('0x20')](socket);function respondWithStatusCode(_0x1f0359,_0x5b95ef){_0x5b95ef=_0x5b95ef||0xcc;return function(_0x455d33){if(_0x455d33){return _0x1f0359['sendStatus'](_0x5b95ef);}return _0x1f0359[_0xd394('0x21')](_0x5b95ef)[_0xd394('0x22')]();};}function respondWithResult(_0x580590,_0x28cde1){_0x28cde1=_0x28cde1||0xc8;return function(_0x2e83fe){if(_0x2e83fe){return _0x580590['status'](_0x28cde1)[_0xd394('0x23')](_0x2e83fe);}};}function respondWithFilteredResult(_0x559839,_0x44f01f){return function(_0x46c917){if(_0x46c917){var _0x45d1d8=typeof _0x44f01f[_0xd394('0x24')]==='undefined'&&typeof _0x44f01f['limit']===_0xd394('0x25');var _0x1f4cc1=_0x46c917[_0xd394('0x26')];var _0x539ee4=_0x45d1d8?0x0:_0x44f01f[_0xd394('0x24')];var _0x5a13c8=_0x45d1d8?_0x46c917[_0xd394('0x26')]:_0x44f01f[_0xd394('0x24')]+_0x44f01f[_0xd394('0x27')];var _0x13ee6;if(_0x5a13c8>=_0x1f4cc1){_0x5a13c8=_0x1f4cc1;_0x13ee6=0xc8;}else{_0x13ee6=0xce;}_0x559839[_0xd394('0x21')](_0x13ee6);return _0x559839[_0xd394('0x28')]('Content-Range',_0x539ee4+'-'+_0x5a13c8+'/'+_0x1f4cc1)['json'](_0x46c917);}return null;};}function patchUpdates(_0x5d0fd2){return function(_0x152c1c){try{jsonpatch['apply'](_0x152c1c,_0x5d0fd2,!![]);}catch(_0xea00ed){return BPromise[_0xd394('0x29')](_0xea00ed);}return _0x152c1c[_0xd394('0x2a')]();};}function saveUpdates(_0x2f5280,_0x1cf3be){return function(_0xd70f0){if(_0xd70f0){return _0xd70f0[_0xd394('0x2b')](_0x2f5280)[_0xd394('0x2c')](function(_0x2494d2){return _0x2494d2;});}return null;};}function handleEntityNotFound(_0x4220c0,_0x375ead){return function(_0x232496){if(!_0x232496){_0x4220c0[_0xd394('0x2d')](0x194);}return _0x232496;};}function handleError(_0x126f44,_0x15ac5e){_0x15ac5e=_0x15ac5e||0x1f4;return function(_0x5a32cc){logger[_0xd394('0x2e')](_0x5a32cc['stack']);if(_0x5a32cc[_0xd394('0x2f')]){delete _0x5a32cc[_0xd394('0x2f')];}_0x126f44[_0xd394('0x21')](_0x15ac5e)[_0xd394('0x30')](_0x5a32cc);};}exports[_0xd394('0x31')]=function(_0x5af372,_0x3399e0){var _0x251ebf={},_0x3f8671={},_0x212e48={'count':0x0,'rows':[]};var _0x1af9fc=_[_0xd394('0x32')](db['Team'][_0xd394('0x33')],function(_0xca59fe){return{'name':_0xca59fe[_0xd394('0x34')],'type':_0xca59fe[_0xd394('0x35')]['key']};});_0x3f8671['model']=_[_0xd394('0x32')](_0x1af9fc,'name');_0x3f8671[_0xd394('0x36')]=_['keys'](_0x5af372[_0xd394('0x36')]);_0x3f8671[_0xd394('0x37')]=_[_0xd394('0x38')](_0x3f8671[_0xd394('0x39')],_0x3f8671[_0xd394('0x36')]);_0x251ebf[_0xd394('0x3a')]=_['intersection'](_0x3f8671[_0xd394('0x39')],qs[_0xd394('0x3b')](_0x5af372['query'][_0xd394('0x3b')]));_0x251ebf['attributes']=_0x251ebf[_0xd394('0x3a')][_0xd394('0x3c')]?_0x251ebf[_0xd394('0x3a')]:_0x3f8671['model'];if(!_0x5af372['query']['hasOwnProperty'](_0xd394('0x3d'))){_0x251ebf[_0xd394('0x27')]=qs[_0xd394('0x27')](_0x5af372['query']['limit']);_0x251ebf[_0xd394('0x24')]=qs[_0xd394('0x24')](_0x5af372[_0xd394('0x36')]['offset']);}_0x251ebf[_0xd394('0x3e')]=qs[_0xd394('0x3f')](_0x5af372[_0xd394('0x36')][_0xd394('0x3f')]);_0x251ebf[_0xd394('0x40')]=qs[_0xd394('0x37')](_['pick'](_0x5af372[_0xd394('0x36')],_0x3f8671[_0xd394('0x37')]),_0x1af9fc);if(_0x5af372[_0xd394('0x36')][_0xd394('0x41')]){_0x251ebf[_0xd394('0x40')]=_[_0xd394('0x42')](_0x251ebf[_0xd394('0x40')],{'$or':_[_0xd394('0x32')](_0x1af9fc,function(_0x38a079){if(_0x38a079[_0xd394('0x35')]!==_0xd394('0x43')){var _0x487d7d={};_0x487d7d[_0x38a079[_0xd394('0x2f')]]={'$like':'%'+_0x5af372['query'][_0xd394('0x41')]+'%'};return _0x487d7d;}})});}_0x251ebf=_[_0xd394('0x42')]({},_0x251ebf,_0x5af372[_0xd394('0x44')]);var _0x3ab8f1={'where':_0x251ebf[_0xd394('0x40')]};return db['Team'][_0xd394('0x26')](_0x3ab8f1)['then'](function(_0x3bc328){_0x212e48[_0xd394('0x26')]=_0x3bc328;if(_0x5af372[_0xd394('0x36')][_0xd394('0x45')]){_0x251ebf['include']=[{'all':!![]}];}return db[_0xd394('0x46')][_0xd394('0x47')](_0x251ebf);})[_0xd394('0x2c')](function(_0x1b662b){_0x212e48[_0xd394('0x48')]=_0x1b662b;return _0x212e48;})[_0xd394('0x2c')](respondWithFilteredResult(_0x3399e0,_0x251ebf))[_0xd394('0x49')](handleError(_0x3399e0,null));};exports[_0xd394('0x4a')]=function(_0x780602,_0x15064d){var _0xdfa2ef={'raw':![],'where':{'id':_0x780602[_0xd394('0x4b')]['id']}},_0x2508c1={};_0x2508c1[_0xd394('0x39')]=_[_0xd394('0x4c')](db['Team'][_0xd394('0x33')]);_0x2508c1['query']=_[_0xd394('0x4c')](_0x780602[_0xd394('0x36')]);_0x2508c1[_0xd394('0x37')]=_[_0xd394('0x38')](_0x2508c1[_0xd394('0x39')],_0x2508c1[_0xd394('0x36')]);_0xdfa2ef['attributes']=_[_0xd394('0x38')](_0x2508c1[_0xd394('0x39')],qs['fields'](_0x780602[_0xd394('0x36')]['fields']));_0xdfa2ef[_0xd394('0x3a')]=_0xdfa2ef[_0xd394('0x3a')]['length']?_0xdfa2ef[_0xd394('0x3a')]:_0x2508c1[_0xd394('0x39')];if(_0x780602[_0xd394('0x36')][_0xd394('0x45')]){_0xdfa2ef['include']=[{'all':!![]}];}_0xdfa2ef=_['merge']({},_0xdfa2ef,_0x780602[_0xd394('0x44')]);return db[_0xd394('0x46')]['find'](_0xdfa2ef)[_0xd394('0x2c')](handleEntityNotFound(_0x15064d,null))['then'](respondWithResult(_0x15064d,null))[_0xd394('0x49')](handleError(_0x15064d,null));};exports[_0xd394('0x4d')]=function(_0x161d1a,_0x2673e6){return db[_0xd394('0x46')][_0xd394('0x4d')](_0x161d1a['body'],{})['then'](function(_0x316e49){var _0x430e48=_0x161d1a['user'][_0xd394('0x4e')]({'plain':!![]});if(!_0x430e48)throw new Error(_0xd394('0x4f'));if(_0x430e48[_0xd394('0x50')]===_0xd394('0x51')){var _0x4f8fed=_0x316e49[_0xd394('0x4e')]({'plain':!![]});var _0x250bf8=_0xd394('0x52');return db[_0xd394('0x53')][_0xd394('0x54')]({'where':{'name':_0x250bf8,'userProfileId':_0x430e48['userProfileId']},'raw':!![]})['then'](function(_0x27c31b){if(_0x27c31b&&_0x27c31b[_0xd394('0x55')]===0x0){return db[_0xd394('0x56')]['create']({'name':_0x4f8fed['name'],'resourceId':_0x4f8fed['id'],'type':_0x27c31b[_0xd394('0x2f')],'sectionId':_0x27c31b['id']},{})[_0xd394('0x2c')](function(){return _0x316e49;});}else{return _0x316e49;}})[_0xd394('0x49')](function(_0xb4f236){logger[_0xd394('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb4f236);throw _0xb4f236;});}return _0x316e49;})[_0xd394('0x2c')](respondWithResult(_0x2673e6,0xc9))['catch'](handleError(_0x2673e6,null));};exports[_0xd394('0x2b')]=function(_0x438c04,_0x58b318){if(_0x438c04[_0xd394('0x57')]['id']){delete _0x438c04[_0xd394('0x57')]['id'];}return db[_0xd394('0x46')][_0xd394('0x54')]({'where':{'id':_0x438c04['params']['id']}})[_0xd394('0x2c')](handleEntityNotFound(_0x58b318,null))['then'](saveUpdates(_0x438c04[_0xd394('0x57')],null))[_0xd394('0x2c')](respondWithResult(_0x58b318,null))[_0xd394('0x49')](handleError(_0x58b318,null));};exports['destroy']=function(_0x22f584,_0x6cbe1b){var _0x577ee9=_0x22f584[_0xd394('0x4b')]['id'];var _0x5e2350=[];return db[_0xd394('0x58')]['transaction'](function(_0x3c8825){var _0x38c0c3=_0xd394('0x59')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0x38c0c3,{'type':db['Sequelize']['QueryTypes'][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825})[_0xd394('0x2c')](function(_0x3c1243){_0x5e2350=_[_0xd394('0x32')](_0x3c1243,function(_0x3b70b8){return Number(_0x3b70b8[_0xd394('0x5b')]);});})[_0xd394('0x2c')](function(){var _0x22f33b=_0xd394('0x5c')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0x22f33b,{'type':db[_0xd394('0x5d')][_0xd394('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x49c976){var _0x334f45=_[_0xd394('0x32')](_0x49c976,function(_0x557fe8){return Number(_0x557fe8[_0xd394('0x5f')]);});return db[_0xd394('0x60')][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'VoiceQueueId':{'$in':_0x334f45}},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){var _0x4b326f=_0xd394('0x62')+_0x577ee9;return db[_0xd394('0x58')]['query'](_0x4b326f,{'type':db[_0xd394('0x5d')]['QueryTypes'][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x5c12d7){var _0x173815=_[_0xd394('0x32')](_0x5c12d7,function(_0x3f1e07){return Number(_0x3f1e07[_0xd394('0x63')]);});return db[_0xd394('0x64')][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'MailQueueId':{'$in':_0x173815}},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){var _0xb5cd07=_0xd394('0x65')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0xb5cd07,{'type':db[_0xd394('0x5d')][_0xd394('0x5e')][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})['then'](function(_0x2e06f3){var _0x149199=_[_0xd394('0x32')](_0x2e06f3,function(_0xac79a4){return Number(_0xac79a4['SmsQueueId']);});return db[_0xd394('0x66')][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'SmsQueueId':{'$in':_0x149199}},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){var _0x5df391='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x577ee9;return db['sequelize']['query'](_0x5df391,{'type':db[_0xd394('0x5d')][_0xd394('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x5b4e67){var _0x2bd875=_['map'](_0x5b4e67,function(_0x49e41e){return Number(_0x49e41e[_0xd394('0x67')]);});return db[_0xd394('0x68')]['destroy']({'where':{'UserId':{'$in':_0x5e2350},'ChatQueueId':{'$in':_0x2bd875}},'transaction':_0x3c8825});})['then'](function(){var _0xb19ea0=_0xd394('0x69')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0xb19ea0,{'type':db['Sequelize'][_0xd394('0x5e')][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x446321){var _0x2dd8f0=_[_0xd394('0x32')](_0x446321,function(_0x19491c){return Number(_0x19491c['FaxQueueId']);});return db[_0xd394('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x5e2350},'FaxQueueId':{'$in':_0x2dd8f0}},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){var _0xc7e6d8='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0xc7e6d8,{'type':db['Sequelize'][_0xd394('0x5e')][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x305747){var _0x106a45=_[_0xd394('0x32')](_0x305747,function(_0x4f8057){return Number(_0x4f8057[_0xd394('0x6b')]);});return db[_0xd394('0x6c')][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'OpenchannelQueueId':{'$in':_0x106a45}},'transaction':_0x3c8825});})['then'](function(){var _0x418fcc=_0xd394('0x6d')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0x418fcc,{'type':db[_0xd394('0x5d')][_0xd394('0x5e')][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x544d03){var _0x1c4277=_['map'](_0x544d03,function(_0x101692){return Number(_0x101692[_0xd394('0x6e')]);});return db[_0xd394('0x6f')]['destroy']({'where':{'UserId':{'$in':_0x5e2350},'WhatsappQueueId':{'$in':_0x1c4277}},'transaction':_0x3c8825});})['then'](function(){return db[_0xd394('0x70')]['find']({'where':{'TeamId':_0x577ee9}});})[_0xd394('0x2c')](function(_0x201680){if(_0x201680===null){return;}return db['UserVoicePrefix'][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'VoicePrefixId':_0x201680['VoicePrefixId']},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){return db[_0xd394('0x46')][_0xd394('0x61')]({'where':{'id':_0x577ee9},'cascade':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x1d857d){if(_0x1d857d===0x0){_0x6cbe1b[_0xd394('0x2d')](0x194);}else{return db[_0xd394('0x56')][_0xd394('0x61')]({'where':{'type':_0xd394('0x52'),'resourceId':_0x577ee9},'cascade':!![],'transaction':_0x3c8825})[_0xd394('0x2c')](function(){_0x6cbe1b[_0xd394('0x21')](0xcc)[_0xd394('0x22')]();});}})[_0xd394('0x49')](function(_0x19a1e0){_0x6cbe1b[_0xd394('0x21')](0x1f4)['send'](_0x19a1e0);});});};exports[_0xd394('0x71')]=function(_0xa03ce6,_0x562941,_0x2d77cd){return db['Team'][_0xd394('0x72')]({'where':{'id':_0xa03ce6[_0xd394('0x4b')]['id']}})['then'](handleEntityNotFound(_0x562941,null))[_0xd394('0x2c')](function(_0x5dfa39){if(!_0xa03ce6['query'][_0xd394('0x73')]||!utils['isValidChannel'](_0xa03ce6[_0xd394('0x36')]['channel'])){throw new db[(_0xd394('0x5d'))]['ValidationError'](_0xd394('0x74'));}var _0x1a1990={};var _0x4c6588={};_0x4c6588['model']=_[_0xd394('0x4c')](db[_[_0xd394('0x75')](_0xa03ce6[_0xd394('0x36')]['channel'][_0xd394('0x76')]())+_0xd394('0x77')][_0xd394('0x33')]);_0x4c6588[_0xd394('0x36')]=_[_0xd394('0x4c')](_0xa03ce6['query']);_0x4c6588[_0xd394('0x37')]=_[_0xd394('0x38')](_0x4c6588[_0xd394('0x39')],_0x4c6588[_0xd394('0x36')]);_0x1a1990['attributes']=_[_0xd394('0x38')](_0x4c6588['model'],qs['fields'](_0xa03ce6[_0xd394('0x36')][_0xd394('0x3b')]));_0x1a1990[_0xd394('0x3a')]=_0x1a1990[_0xd394('0x3a')][_0xd394('0x3c')]?_0x1a1990[_0xd394('0x3a')]:_0x4c6588[_0xd394('0x39')];_0x1a1990[_0xd394('0x27')]=qs[_0xd394('0x27')](_0xa03ce6[_0xd394('0x36')][_0xd394('0x27')]);_0x1a1990[_0xd394('0x24')]=qs[_0xd394('0x24')](_0xa03ce6[_0xd394('0x36')][_0xd394('0x24')]);_0x1a1990[_0xd394('0x3e')]=qs[_0xd394('0x3f')](_0xa03ce6[_0xd394('0x36')][_0xd394('0x3f')]);_0x1a1990['where']=qs['filters'](_['pick'](_0xa03ce6[_0xd394('0x36')],_0x4c6588[_0xd394('0x37')]));_0x1a1990=_[_0xd394('0x42')]({},_0x1a1990,_0xa03ce6['options']);return _0x5dfa39[_0xd394('0x4e')+_['capitalize'](_0xa03ce6['query']['channel']['toLowerCase']())+_0xd394('0x78')](_0x1a1990);})[_0xd394('0x2c')](respondWithResult(_0x562941,null))[_0xd394('0x49')](handleError(_0x562941,null));};exports[_0xd394('0x79')]=function(_0x59157d,_0x12c5c9,_0xae6302){return db[_0xd394('0x46')][_0xd394('0x72')]({'where':{'id':_0x59157d['params']['id']}})[_0xd394('0x2c')](function(_0x4deeef){if(_0x4deeef){if(!_0x59157d['body'][_0xd394('0x73')]||!utils[_0xd394('0x7a')](_0x59157d[_0xd394('0x57')][_0xd394('0x73')])){throw new db[(_0xd394('0x5d'))][(_0xd394('0x7b'))](_0xd394('0x74'));}return _0x4deeef[_0xd394('0x7c')+_[_0xd394('0x75')](_0x59157d[_0xd394('0x57')][_0xd394('0x73')]['toLowerCase']())+'Queues'](_0x59157d[_0xd394('0x57')]['ids']);}return null;})[_0xd394('0x2c')](handleEntityNotFound(_0x12c5c9,null))[_0xd394('0x2c')](respondWithStatusCode(_0x12c5c9,null))[_0xd394('0x49')](handleError(_0x12c5c9,null));};exports['removeQueues']=function(_0x4329c6,_0x2ec4d8,_0x145c28){return db['Team'][_0xd394('0x72')]({'where':{'id':_0x4329c6['params']['id']}})['then'](function(_0x373ffa){if(_0x373ffa){if(!_0x4329c6[_0xd394('0x36')][_0xd394('0x73')]||!utils[_0xd394('0x7a')](_0x4329c6[_0xd394('0x36')]['channel'])){throw new db['Sequelize'][(_0xd394('0x7b'))](_0xd394('0x74'));}return _0x373ffa[_0xd394('0x7d')+_['capitalize'](_0x4329c6[_0xd394('0x36')][_0xd394('0x73')][_0xd394('0x76')]())+_0xd394('0x78')](_0x4329c6[_0xd394('0x36')]['ids']);}return null;})[_0xd394('0x2c')](handleEntityNotFound(_0x2ec4d8,null))[_0xd394('0x2c')](respondWithStatusCode(_0x2ec4d8,null))[_0xd394('0x49')](handleError(_0x2ec4d8,null));};exports['addAgents']=function(_0x2659ae,_0x1a80d5){var _0x45c12e=_[_0xd394('0x7e')](_0x2659ae['body']['ids'])?_0x2659ae[_0xd394('0x57')][_0xd394('0x7f')]:[_0x2659ae[_0xd394('0x57')]['ids']];var _0x279c0a=_0x2659ae['params']['id'];return db[_0xd394('0x46')]['find']({'where':{'id':_0x279c0a}})['then'](handleEntityNotFound(_0x1a80d5,null))[_0xd394('0x2c')](function(_0xeaa6d3){if(_0xeaa6d3){var _0xfcd9cb=[_0xd394('0x80'),_0xd394('0x81'),_0xd394('0x82'),_0xd394('0x83'),_0xd394('0x84'),_0xd394('0x85'),_0xd394('0x86')];return db[_0xd394('0x58')][_0xd394('0x87')](function(_0x85bf29){var _0x48b81d=_[_0xd394('0x32')](_0xfcd9cb,function(_0x5d1db1){var _0x3b11b={'attributes':['id','name']};if(_0x5d1db1==='Voice'){_0x3b11b['through']={'attributes':['penalty']};}return _0xeaa6d3[_0xd394('0x4e')+_0x5d1db1+_0xd394('0x78')](_0x3b11b)[_0xd394('0x2c')](function(_0x4faa6b){var _0x2f4f40=_[_0xd394('0x32')](_0x4faa6b,function(_0x4c1f0b){var _0x2ca999=_[_0xd394('0x32')](_0x45c12e,function(_0x1e03a7){var _0x7fb2e6={'where':{'UserId':_0x1e03a7,[_0x5d1db1+'QueueId']:_0x4c1f0b['id']},'transaction':_0x85bf29};if(_0x5d1db1===_0xd394('0x80')){_0x7fb2e6[_0xd394('0x1c')]={'penalty':_0x4c1f0b[_0xd394('0x88')][_0xd394('0x89')]};}return db[_0xd394('0x8a')+_0x5d1db1+_0xd394('0x77')][_0xd394('0x8b')](_0x7fb2e6)['then'](function(){socket['emit'](_0xd394('0x51')+_0x5d1db1+'Queue:save',{'UserId':_0x1e03a7,[_0x5d1db1+_0xd394('0x8c')]:_0x4c1f0b['id']});if(_0x5d1db1!==_0xd394('0x80')){return;}return db[_0xd394('0x8a')]['findAll']({'where':{'id':_0x45c12e,'online':0x1},'attributes':['id',_0xd394('0x2f'),_0xd394('0x8d'),_0xd394('0x8e'),'interface'],'raw':!![]})[_0xd394('0x2c')](function(_0x7527d8){var _0x1ff76c=_[_0xd394('0x32')](_0x7527d8,function(_0x1f02c6){return db[_0xd394('0x8f')][_0xd394('0x90')]({'membername':_0x1f02c6[_0xd394('0x2f')],'UserId':_0x1f02c6['id'],'queue_name':_0x4c1f0b[_0xd394('0x2f')],'VoiceQueueId':_0x4c1f0b['id'],'interface':_['isNil'](_0x1f02c6[_0xd394('0x91')])?util[_0xd394('0x92')](_0xd394('0x93'),_0x1f02c6['name']):_0x1f02c6[_0xd394('0x91')],'paused':_0x1f02c6[_0xd394('0x8e')]||![],'penalty':_0x4c1f0b[_0xd394('0x88')][_0xd394('0x89')]},{'transaction':_0x85bf29});});return Promise[_0xd394('0x94')](_0x1ff76c);});});});return Promise['all'](_0x2ca999);});return Promise[_0xd394('0x94')](_0x2f4f40);})[_0xd394('0x2c')](function(){return db[_0xd394('0x70')][_0xd394('0x72')]({'where':{'teamId':_0x279c0a}})[_0xd394('0x2c')](function(_0x404cbf){if(_0x404cbf){var _0x5066b3=_[_0xd394('0x32')](_0x45c12e,function(_0x354e5f){db[_0xd394('0x95')][_0xd394('0x90')]({'UserId':_0x354e5f,'VoicePrefixId':_0x404cbf['VoicePrefixId']});});return Promise[_0xd394('0x94')](_0x5066b3);}});});});return Promise[_0xd394('0x94')](_0x48b81d)[_0xd394('0x2c')](function(){return _0xeaa6d3[_0xd394('0x96')](_0x45c12e,{'transaction':_0x85bf29})['spread'](function(_0x2a867c){return _0x2a867c;});});});}})[_0xd394('0x2c')](respondWithResult(_0x1a80d5,null))[_0xd394('0x49')](handleError(_0x1a80d5,null));};exports[_0xd394('0x97')]=function(_0x14e5a4,_0x480439){var _0x40b198=_['isArray'](_0x14e5a4[_0xd394('0x36')][_0xd394('0x7f')])?_0x14e5a4[_0xd394('0x36')][_0xd394('0x7f')]:[_0x14e5a4[_0xd394('0x36')]['ids']];var _0x30c3b7=_0x14e5a4[_0xd394('0x4b')]['id'];return db['Team']['find']({'where':{'id':_0x30c3b7}})[_0xd394('0x2c')](handleEntityNotFound(_0x480439,null))[_0xd394('0x2c')](function(_0x197ba8){if(_0x197ba8){var _0x43fed1=[_0xd394('0x80'),_0xd394('0x81'),'Mail','Sms',_0xd394('0x84'),_0xd394('0x85'),_0xd394('0x86')];return db['sequelize'][_0xd394('0x87')](function(_0x3cfba8){var _0x571ebe=_[_0xd394('0x32')](_0x43fed1,function(_0x22afb4){var _0x99d357={'attributes':['id',_0xd394('0x2f')]};return _0x197ba8[_0xd394('0x4e')+_0x22afb4+_0xd394('0x78')](_0x99d357)[_0xd394('0x2c')](function(_0x58b404){var _0x449b3d=_[_0xd394('0x32')](_0x58b404,function(_0x51c6b0){return _0x51c6b0[_0xd394('0x97')](_0x40b198,{'transaction':_0x3cfba8})[_0xd394('0x2c')](function(){var _0x22ac60=_[_0xd394('0x32')](_0x40b198,function(_0x1a3b85){socket[_0xd394('0x98')](_0xd394('0x51')+_0x22afb4+'Queue:remove',{'UserId':Number(_0x1a3b85),[_0x22afb4+_0xd394('0x8c')]:_0x51c6b0['id']});if(_0x22afb4!==_0xd394('0x80')){return;}return db[_0xd394('0x8f')][_0xd394('0x61')]({'where':{'VoiceQueueId':_0x51c6b0['id'],'UserId':_0x1a3b85},'transaction':_0x3cfba8});});return Promise[_0xd394('0x94')](_0x22ac60);});});return Promise[_0xd394('0x94')](_0x449b3d);});});return Promise[_0xd394('0x94')](_0x571ebe)[_0xd394('0x2c')](function(){return _0x197ba8[_0xd394('0x97')](_0x40b198,{'transaction':_0x3cfba8});})['then'](function(){return db[_0xd394('0x70')][_0xd394('0x72')]({'where':{'teamId':_0x30c3b7}})[_0xd394('0x2c')](function(_0x54aeac){if(_0x54aeac){var _0x51ce0d=_[_0xd394('0x32')](_0x40b198,function(_0x3c9357){db['UserVoicePrefix'][_0xd394('0x61')]({'where':{'UserId':_0x3c9357,'VoicePrefixId':_0x54aeac[_0xd394('0x99')]}});});return Promise[_0xd394('0x94')](_0x51ce0d);}});});});}})['then'](respondWithStatusCode(_0x480439,null))[_0xd394('0x49')](handleError(_0x480439,null));};exports[_0xd394('0x9a')]=function(_0x4d2af0,_0x599148,_0x444e0e){var _0x31f905={};var _0x49d583={};var _0x49d825;var _0x370d45;return db[_0xd394('0x46')][_0xd394('0x72')]({'where':{'id':_0x4d2af0[_0xd394('0x4b')]['id']}})[_0xd394('0x2c')](handleEntityNotFound(_0x599148,null))[_0xd394('0x2c')](function(_0x3bfd94){if(_0x3bfd94){_0x49d825=_0x3bfd94;_0x49d583[_0xd394('0x39')]=_[_0xd394('0x4c')](db[_0xd394('0x8a')][_0xd394('0x33')]);_0x49d583[_0xd394('0x36')]=_['keys'](_0x4d2af0[_0xd394('0x36')]);_0x49d583[_0xd394('0x37')]=_[_0xd394('0x38')](_0x49d583['model'],_0x49d583[_0xd394('0x36')]);_0x31f905[_0xd394('0x3a')]=_[_0xd394('0x38')](_0x49d583['model'],qs['fields'](_0x4d2af0[_0xd394('0x36')][_0xd394('0x3b')]));_0x31f905['attributes']=_0x31f905[_0xd394('0x3a')][_0xd394('0x3c')]?_0x31f905[_0xd394('0x3a')]:_0x49d583[_0xd394('0x39')];_0x31f905[_0xd394('0x3e')]=qs[_0xd394('0x3f')](_0x4d2af0[_0xd394('0x36')][_0xd394('0x3f')]);_0x31f905[_0xd394('0x40')]=qs[_0xd394('0x37')](_[_0xd394('0x9b')](_0x4d2af0[_0xd394('0x36')],_0x49d583[_0xd394('0x37')]));if(_0x4d2af0['query'][_0xd394('0x41')]){_0x31f905[_0xd394('0x40')]=_['merge'](_0x31f905[_0xd394('0x40')],{'$or':_['map'](_0x31f905['attributes'],function(_0x18b77d){var _0x41c55e={};_0x41c55e[_0x18b77d]={'$like':'%'+_0x4d2af0[_0xd394('0x36')]['filter']+'%'};return _0x41c55e;})});}_0x31f905=_[_0xd394('0x42')]({},_0x31f905,_0x4d2af0[_0xd394('0x44')]);return _0x49d825['getAgents'](_0x31f905);}})[_0xd394('0x2c')](function(_0x3ac6a6){if(_0x3ac6a6){_0x370d45=_0x3ac6a6[_0xd394('0x3c')];if(!_0x4d2af0[_0xd394('0x36')]['hasOwnProperty'](_0xd394('0x3d'))){_0x31f905[_0xd394('0x27')]=qs[_0xd394('0x27')](_0x4d2af0[_0xd394('0x36')][_0xd394('0x27')]);_0x31f905[_0xd394('0x24')]=qs[_0xd394('0x24')](_0x4d2af0[_0xd394('0x36')][_0xd394('0x24')]);}return _0x49d825[_0xd394('0x9a')](_0x31f905);}})[_0xd394('0x2c')](function(_0xc0321f){if(_0xc0321f){return _0xc0321f?{'count':_0x370d45,'rows':_0xc0321f}:null;}})['then'](respondWithResult(_0x599148,null))[_0xd394('0x49')](handleError(_0x599148,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7cb6f41..7b4459b 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 _0x6882=['Team','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xd2e079,_0x10f572){var _0x35d5fc=function(_0x15a084){while(--_0x15a084){_0xd2e079['push'](_0xd2e079['shift']());}};_0x35d5fc(++_0x10f572);}(_0x6882,0x1ae));var _0x2688=function(_0x3d7b9f,_0x3f97a5){_0x3d7b9f=_0x3d7b9f-0x0;var _0x2e4acd=_0x6882[_0x3d7b9f];return _0x2e4acd;};'use strict';var EventEmitter=require(_0x2688('0x0'));var Team=require(_0x2688('0x1'))['db'][_0x2688('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2688('0x3'),'afterUpdate':_0x2688('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54ef51){return function(_0x49be44,_0x39863e,_0x22de76){TeamEvents[_0x2688('0x5')](_0x54ef51+':'+_0x49be44['id'],_0x49be44);TeamEvents['emit'](_0x54ef51,_0x49be44);_0x22de76(null);};}for(var e in events){if(events[_0x2688('0x6')](e)){var event=events[e];Team[_0x2688('0x7')](e,emitEvent(event));}}module[_0x2688('0x8')]=TeamEvents; \ No newline at end of file +var _0x56cb=['Team','setMaxListeners','hasOwnProperty','events','../../mysqldb'];(function(_0x3b5dfe,_0x1f46b7){var _0x21bf8e=function(_0x24b3ba){while(--_0x24b3ba){_0x3b5dfe['push'](_0x3b5dfe['shift']());}};_0x21bf8e(++_0x1f46b7);}(_0x56cb,0xee));var _0xb56c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x56cb[_0x4ff09b];return _0x3f5c2e;};'use strict';var EventEmitter=require(_0xb56c('0x0'));var Team=require(_0xb56c('0x1'))['db'][_0xb56c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb56c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x205dad){return function(_0x5184f4,_0xd1fcc9,_0x579025){TeamEvents['emit'](_0x205dad+':'+_0x5184f4['id'],_0x5184f4);TeamEvents['emit'](_0x205dad,_0x5184f4);_0x579025(null);};}for(var e in events){if(events[_0xb56c('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 441b450..6bc5496 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 _0xbf21=['resolve','all','lodash','./team.attributes','get','Queues','map','channel','catch','define','Team','teams','Mail','Sms','Whatsapp'];(function(_0x1fc26d,_0x42ff6c){var _0x373e68=function(_0x4a6407){while(--_0x4a6407){_0x1fc26d['push'](_0x1fc26d['shift']());}};_0x373e68(++_0x42ff6c);}(_0xbf21,0x188));var _0x1bf2=function(_0x115aa3,_0x4c8ba3){_0x115aa3=_0x115aa3-0x0;var _0x125165=_0xbf21[_0x115aa3];return _0x125165;};'use strict';var _=require(_0x1bf2('0x0'));var attributes=require(_0x1bf2('0x1'));function getQueuesByChannel(_0x2c82ce,_0x15679a){var _0x3ef9be=_0x1bf2('0x2')+_0x15679a+_0x1bf2('0x3');return _0x2c82ce[_0x3ef9be]()['then'](function(_0x3c19ca){return _[_0x1bf2('0x4')](_0x3c19ca,function(_0x4c52d5){_0x4c52d5['setDataValue'](_0x1bf2('0x5'),_0x15679a);return _0x4c52d5;});})[_0x1bf2('0x6')](function(_0x1d21eb){throw _0x1d21eb;});}module['exports']=function(_0x775b2d){return _0x775b2d[_0x1bf2('0x7')](_0x1bf2('0x8'),attributes,{'tableName':_0x1bf2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x332a29=this;var _0x25fc1d=['Chat','Fax',_0x1bf2('0xa'),'Openchannel',_0x1bf2('0xb'),'Voice',_0x1bf2('0xc')];return Promise[_0x1bf2('0xd')]()['then'](function(){var _0xafb2d9=_[_0x1bf2('0x4')](_0x25fc1d,function(_0x1568e3){return getQueuesByChannel(_0x332a29,_0x1568e3);});return Promise[_0x1bf2('0xe')](_0xafb2d9);})['catch'](function(_0x45449d){throw _0x45449d;});}}});}; \ No newline at end of file +var _0xb0bf=['get','then','map','setDataValue','channel','catch','exports','define','teams','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','lodash','./team.attributes'];(function(_0x6ae37,_0x50e951){var _0x4a16c2=function(_0x1dcaae){while(--_0x1dcaae){_0x6ae37['push'](_0x6ae37['shift']());}};_0x4a16c2(++_0x50e951);}(_0xb0bf,0x19c));var _0xfb0b=function(_0x2a55b5,_0x3c75ea){_0x2a55b5=_0x2a55b5-0x0;var _0x5b25a4=_0xb0bf[_0x2a55b5];return _0x5b25a4;};'use strict';var _=require(_0xfb0b('0x0'));var attributes=require(_0xfb0b('0x1'));function getQueuesByChannel(_0x2b7313,_0x436004){var _0x57abef=_0xfb0b('0x2')+_0x436004+'Queues';return _0x2b7313[_0x57abef]()[_0xfb0b('0x3')](function(_0x44637d){return _[_0xfb0b('0x4')](_0x44637d,function(_0x130808){_0x130808[_0xfb0b('0x5')](_0xfb0b('0x6'),_0x436004);return _0x130808;});})[_0xfb0b('0x7')](function(_0x4f2498){throw _0x4f2498;});}module[_0xfb0b('0x8')]=function(_0x200d31){return _0x200d31[_0xfb0b('0x9')]('Team',attributes,{'tableName':_0xfb0b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5c277b=this;var _0x1774dc=[_0xfb0b('0xb'),_0xfb0b('0xc'),'Mail',_0xfb0b('0xd'),_0xfb0b('0xe'),_0xfb0b('0xf'),_0xfb0b('0x10')];return Promise[_0xfb0b('0x11')]()[_0xfb0b('0x3')](function(){var _0x3aba25=_['map'](_0x1774dc,function(_0x51c27a){return getQueuesByChannel(_0x5c277b,_0x51c27a);});return Promise['all'](_0x3aba25);})[_0xfb0b('0x7')](function(_0x1af645){throw _0x1af645;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 15a03dd..6dd608e 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 _0x56f4=['Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then'];(function(_0x154b56,_0x37dfab){var _0x5c7f31=function(_0x17046d){while(--_0x17046d){_0x154b56['push'](_0x154b56['shift']());}};_0x5c7f31(++_0x37dfab);}(_0x56f4,0xe2));var _0x456f=function(_0x1cdebf,_0x5d5554){_0x1cdebf=_0x1cdebf-0x0;var _0x335f58=_0x56f4[_0x1cdebf];return _0x335f58;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x456f('0x0'));var BPromise=require(_0x456f('0x1'));var rs=require(_0x456f('0x2'));var fs=require('fs');var Redis=require(_0x456f('0x3'));var db=require(_0x456f('0x4'))['db'];var utils=require(_0x456f('0x5'));var logger=require(_0x456f('0x6'))('rpc');var config=require(_0x456f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x456f('0x8')][_0x456f('0x9')]({'port':0x232a});config[_0x456f('0xa')]=_[_0x456f('0xb')](config[_0x456f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x456f('0xc'))(new Redis(config['redis']));require(_0x456f('0xd'))[_0x456f('0xe')](socket);function respondWithRpcPromise(_0x49757b,_0x56a696,_0x5513d6){return new BPromise(function(_0x5a2e69,_0x5442a6){return client[_0x456f('0xf')](_0x49757b,_0x5513d6)[_0x456f('0x10')](function(_0x478895){logger['info']('Team,\x20%s,\x20%s',_0x56a696,'request\x20sent');logger['debug'](_0x456f('0x11'),_0x56a696,_0x456f('0x12'),JSON[_0x456f('0x13')](_0x478895));if(_0x478895[_0x456f('0x14')]){if(_0x478895[_0x456f('0x14')][_0x456f('0x15')]===0x1f4){logger['error'](_0x456f('0x16'),_0x56a696,_0x478895[_0x456f('0x14')][_0x456f('0x17')]);return _0x5442a6(_0x478895[_0x456f('0x14')][_0x456f('0x17')]);}logger[_0x456f('0x14')](_0x456f('0x16'),_0x56a696,_0x478895[_0x456f('0x14')][_0x456f('0x17')]);return _0x5a2e69(_0x478895[_0x456f('0x14')][_0x456f('0x17')]);}else{logger[_0x456f('0x18')](_0x456f('0x16'),_0x56a696,_0x456f('0x12'));_0x5a2e69(_0x478895[_0x456f('0x19')][_0x456f('0x17')]);}})[_0x456f('0x1a')](function(_0x1c4f35){logger[_0x456f('0x14')](_0x456f('0x16'),_0x56a696,_0x1c4f35);_0x5442a6(_0x1c4f35);});});} \ No newline at end of file +var _0xde9c=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','bluebird','randomstring','../../config/logger','rpc'];(function(_0x233921,_0x24a0a6){var _0xa81f85=function(_0xfd0f3){while(--_0xfd0f3){_0x233921['push'](_0x233921['shift']());}};_0xa81f85(++_0x24a0a6);}(_0xde9c,0x15c));var _0xcde9=function(_0x387106,_0x510f30){_0x387106=_0x387106-0x0;var _0x5ba67c=_0xde9c[_0x387106];return _0x5ba67c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcde9('0x0'));var rs=require(_0xcde9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcde9('0x2'))(_0xcde9('0x3'));var config=require(_0xcde9('0x4'));var jayson=require(_0xcde9('0x5'));var client=jayson[_0xcde9('0x6')][_0xcde9('0x7')]({'port':0x232a});config[_0xcde9('0x8')]=_['defaults'](config[_0xcde9('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xcde9('0x9'))(new Redis(config['redis']));require(_0xcde9('0xa'))[_0xcde9('0xb')](socket);function respondWithRpcPromise(_0x3b8bbe,_0x3727b8,_0x3def0c){return new BPromise(function(_0x3a3dcc,_0x5d57e1){return client[_0xcde9('0xc')](_0x3b8bbe,_0x3def0c)['then'](function(_0xf162f){logger[_0xcde9('0xd')](_0xcde9('0xe'),_0x3727b8,'request\x20sent');logger['debug'](_0xcde9('0xf'),_0x3727b8,_0xcde9('0x10'),JSON['stringify'](_0xf162f));if(_0xf162f[_0xcde9('0x11')]){if(_0xf162f['error'][_0xcde9('0x12')]===0x1f4){logger[_0xcde9('0x11')]('Team,\x20%s,\x20%s',_0x3727b8,_0xf162f['error'][_0xcde9('0x13')]);return _0x5d57e1(_0xf162f['error'][_0xcde9('0x13')]);}logger['error'](_0xcde9('0xe'),_0x3727b8,_0xf162f[_0xcde9('0x11')]['message']);return _0x3a3dcc(_0xf162f[_0xcde9('0x11')][_0xcde9('0x13')]);}else{logger[_0xcde9('0xd')](_0xcde9('0xe'),_0x3727b8,_0xcde9('0x10'));_0x3a3dcc(_0xf162f[_0xcde9('0x14')][_0xcde9('0x13')]);}})[_0xcde9('0x15')](function(_0x1e7c35){logger[_0xcde9('0x11')]('Team,\x20%s,\x20%s',_0x3727b8,_0x1e7c35);_0x5d57e1(_0x1e7c35);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a4a34a7..5a1a633 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 _0x4849=['save','remove','update','emit','register','length','team:'];(function(_0x50d8b2,_0x46f88d){var _0x2f9972=function(_0x4f728b){while(--_0x4f728b){_0x50d8b2['push'](_0x50d8b2['shift']());}};_0x2f9972(++_0x46f88d);}(_0x4849,0x181));var _0x9484=function(_0x1bb6a3,_0x200fe0){_0x1bb6a3=_0x1bb6a3-0x0;var _0x47624f=_0x4849[_0x1bb6a3];return _0x47624f;};'use strict';var TeamEvents=require('./team.events');var events=[_0x9484('0x0'),_0x9484('0x1'),_0x9484('0x2')];function createListener(_0x22e8eb,_0x530a18){return function(_0x337903){_0x530a18[_0x9484('0x3')](_0x22e8eb,_0x337903);};}function removeListener(_0xecde47,_0x95b89e){return function(){TeamEvents['removeListener'](_0xecde47,_0x95b89e);};}exports[_0x9484('0x4')]=function(_0x555b70){for(var _0x521217=0x0,_0x4e7b02=events[_0x9484('0x5')];_0x521217<_0x4e7b02;_0x521217++){var _0x515733=events[_0x521217];var _0x2952ea=createListener(_0x9484('0x6')+_0x515733,_0x555b70);TeamEvents['on'](_0x515733,_0x2952ea);}}; \ No newline at end of file +var _0x4046=['remove','update','removeListener','register','save'];(function(_0x4a9a17,_0x273a09){var _0x30e831=function(_0xabbcbd){while(--_0xabbcbd){_0x4a9a17['push'](_0x4a9a17['shift']());}};_0x30e831(++_0x273a09);}(_0x4046,0x126));var _0x6404=function(_0xc1ca27,_0x47dd84){_0xc1ca27=_0xc1ca27-0x0;var _0x4857b6=_0x4046[_0xc1ca27];return _0x4857b6;};'use strict';var TeamEvents=require('./team.events');var events=[_0x6404('0x0'),_0x6404('0x1'),_0x6404('0x2')];function createListener(_0x285d0d,_0x15ac05){return function(_0x4e2695){_0x15ac05['emit'](_0x285d0d,_0x4e2695);};}function removeListener(_0x54bd4a,_0x522e47){return function(){TeamEvents[_0x6404('0x3')](_0x54bd4a,_0x522e47);};}exports[_0x6404('0x4')]=function(_0x4136af){for(var _0x21e34e=0x0,_0x2eba27=events['length'];_0x21e34e<_0x2eba27;_0x21e34e++){var _0x4cbc18=events[_0x21e34e];var _0x21b3d6=createListener('team:'+_0x4cbc18,_0x4136af);TeamEvents['on'](_0x4cbc18,_0x21b3d6);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 62b2a94..db58b29 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 _0x48fb=['sequelize','exports','INTEGER'];(function(_0x18bb25,_0xcd1457){var _0x27d5d7=function(_0x53755b){while(--_0x53755b){_0x18bb25['push'](_0x18bb25['shift']());}};_0x27d5d7(++_0xcd1457);}(_0x48fb,0x114));var _0xb48f=function(_0x1ce8bc,_0x2cbe8f){_0x1ce8bc=_0x1ce8bc-0x0;var _0x1d2b4e=_0x48fb[_0x1ce8bc];return _0x1d2b4e;};'use strict';var Sequelize=require(_0xb48f('0x0'));module[_0xb48f('0x1')]={'TeamId':{'type':Sequelize[_0xb48f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb48f('0x2')]}}; \ No newline at end of file +var _0x12dc=['sequelize','exports','INTEGER'];(function(_0x88a98e,_0x56668b){var _0x23eede=function(_0x165899){while(--_0x165899){_0x88a98e['push'](_0x88a98e['shift']());}};_0x23eede(++_0x56668b);}(_0x12dc,0xb4));var _0xc12d=function(_0x55493b,_0xbf3600){_0x55493b=_0x55493b-0x0;var _0x3946e7=_0x12dc[_0x55493b];return _0x3946e7;};'use strict';var Sequelize=require(_0xc12d('0x0'));module[_0xc12d('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xc12d('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5611c56..9c45842 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 _0x93e6=['api','bluebird','path','rimraf','../../config/environment','exports','lodash'];(function(_0x56669f,_0x5defab){var _0x16441a=function(_0x232b5b){while(--_0x232b5b){_0x56669f['push'](_0x56669f['shift']());}};_0x16441a(++_0x5defab);}(_0x93e6,0x11e));var _0x693e=function(_0x34dd23,_0x50ce42){_0x34dd23=_0x34dd23-0x0;var _0x18a648=_0x93e6[_0x34dd23];return _0x18a648;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x693e('0x1'));var moment=require('moment');var BPromise=require(_0x693e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x693e('0x3'));var rimraf=require(_0x693e('0x4'));var config=require(_0x693e('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x693e('0x6')]=function(_0x388eb6,_0x2569a4){return _0x388eb6['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ffd=['TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','define'];(function(_0x8ce99,_0xe40fa0){var _0x186ca7=function(_0xa277bc){while(--_0xa277bc){_0x8ce99['push'](_0x8ce99['shift']());}};_0x186ca7(++_0xe40fa0);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x7ff57e,_0x6faea2){_0x7ff57e=_0x7ff57e-0x0;var _0x2ed07a=_0x9ffd[_0x7ff57e];return _0x2ed07a;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 44d6732..1cae50e 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x56adea,_0x289c86){var _0x185ee5=function(_0x349841){while(--_0x349841){_0x56adea['push'](_0x56adea['shift']());}};_0x185ee5(++_0x289c86);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x952069,_0x95198f){var _0x5e8273=function(_0xcd0a8){while(--_0xcd0a8){_0x952069['push'](_0x952069['shift']());}};_0x5e8273(++_0x95198f);}(_0x70e0,0x17b));var _0x070e=function(_0x479255,_0x1bad8c){_0x479255=_0x479255-0x0;var _0x30815f=_0x70e0[_0x479255];return _0x30815f;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 51742f6..7963aa0 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 _0x9364=['sequelize','exports','INTEGER'];(function(_0x28d2e4,_0x542000){var _0x46c577=function(_0x108ec0){while(--_0x108ec0){_0x28d2e4['push'](_0x28d2e4['shift']());}};_0x46c577(++_0x542000);}(_0x9364,0x141));var _0x4936=function(_0x14015d,_0x5c0d80){_0x14015d=_0x14015d-0x0;var _0x3bc2b7=_0x9364[_0x14015d];return _0x3bc2b7;};'use strict';var Sequelize=require(_0x4936('0x0'));module[_0x4936('0x1')]={'penalty':{'type':Sequelize[_0x4936('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcd28=['exports','INTEGER'];(function(_0x5e5d0f,_0x11c528){var _0xab96bf=function(_0x1fd5da){while(--_0x1fd5da){_0x5e5d0f['push'](_0x5e5d0f['shift']());}};_0xab96bf(++_0x11c528);}(_0xcd28,0x18c));var _0x8cd2=function(_0x17b9af,_0xa33811){_0x17b9af=_0x17b9af-0x0;var _0x461cd0=_0xcd28[_0x17b9af];return _0x461cd0;};'use strict';var Sequelize=require('sequelize');module[_0x8cd2('0x0')]={'penalty':{'type':Sequelize[_0x8cd2('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 862e404..2d4c819 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 _0xcea5=['api','moment','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xcea5,0xed));var _0x5cea=function(_0x4bb9e8,_0x5e8598){_0x4bb9e8=_0x4bb9e8-0x0;var _0x32648e=_0xcea5[_0x4bb9e8];return _0x32648e;};'use strict';var _=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var logger=require(_0x5cea('0x2'))(_0x5cea('0x3'));var moment=require(_0x5cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x5cea('0x5'));var fs=require('fs');var path=require(_0x5cea('0x6'));var rimraf=require(_0x5cea('0x7'));var config=require(_0x5cea('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x5cea('0x9')]=function(_0x31e6f3,_0x599bc5){return _0x31e6f3['define']('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fb=['define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports'];(function(_0x495927,_0x4e7c43){var _0xae37d=function(_0xac03ed){while(--_0xac03ed){_0x495927['push'](_0x495927['shift']());}};_0xae37d(++_0x4e7c43);}(_0xf6fb,0x111));var _0xbf6f=function(_0x459467,_0x161bbd){_0x459467=_0x459467-0x0;var _0x10eba5=_0xf6fb[_0x459467];return _0x10eba5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf6f('0x0'))(_0xbf6f('0x1'));var moment=require('moment');var BPromise=require(_0xbf6f('0x2'));var rp=require(_0xbf6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf6f('0x4'));var config=require('../../config/environment');var attributes=require(_0xbf6f('0x5'));module[_0xbf6f('0x6')]=function(_0x2d8ffb,_0x370983){return _0x2d8ffb[_0xbf6f('0x7')](_0xbf6f('0x8'),attributes,{'tableName':_0xbf6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 8bfc18a..053ac95 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 _0x4fd9=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x4fd9,0xf1));var _0x94fd=function(_0x2213eb,_0x1bce8d){_0x2213eb=_0x2213eb-0x0;var _0x4606bb=_0x4fd9[_0x2213eb];return _0x4606bb;};'use strict';var _=require(_0x94fd('0x0'));var util=require(_0x94fd('0x1'));var moment=require(_0x94fd('0x2'));var BPromise=require(_0x94fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94fd('0x4'));var db=require(_0x94fd('0x5'))['db'];var utils=require(_0x94fd('0x6'));var logger=require(_0x94fd('0x7'))(_0x94fd('0x8'));var config=require(_0x94fd('0x9'));var jayson=require(_0x94fd('0xa'));var client=jayson[_0x94fd('0xb')][_0x94fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x347e0b,_0x9c75f1,_0x32b88e){return new BPromise(function(_0x52cee7,_0x51ccfc){return client[_0x94fd('0xd')](_0x347e0b,_0x32b88e)['then'](function(_0x275b82){logger['info'](_0x94fd('0xe'),_0x9c75f1,'request\x20sent');logger[_0x94fd('0xf')](_0x94fd('0x10'),_0x9c75f1,'request\x20sent',JSON[_0x94fd('0x11')](_0x275b82));if(_0x275b82[_0x94fd('0x12')]){if(_0x275b82[_0x94fd('0x12')][_0x94fd('0x13')]===0x1f4){logger[_0x94fd('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x9c75f1,_0x275b82[_0x94fd('0x12')][_0x94fd('0x14')]);return _0x51ccfc(_0x275b82[_0x94fd('0x12')][_0x94fd('0x14')]);}logger[_0x94fd('0x12')](_0x94fd('0xe'),_0x9c75f1,_0x275b82[_0x94fd('0x12')][_0x94fd('0x14')]);return _0x52cee7(_0x275b82[_0x94fd('0x12')]['message']);}else{logger[_0x94fd('0x15')](_0x94fd('0xe'),_0x9c75f1,_0x94fd('0x16'));_0x52cee7(_0x275b82[_0x94fd('0x17')][_0x94fd('0x14')]);}})['catch'](function(_0x141d5e){logger[_0x94fd('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x9c75f1,_0x141d5e);_0x51ccfc(_0x141d5e);});});} \ No newline at end of file +var _0xb9da=['TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info'];(function(_0x4ad323,_0x40e25e){var _0xe4b67d=function(_0x993c26){while(--_0x993c26){_0x4ad323['push'](_0x4ad323['shift']());}};_0xe4b67d(++_0x40e25e);}(_0xb9da,0x1d6));var _0xab9d=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0xb9da[_0x3be2e2];return _0x53b9c5;};'use strict';var _=require(_0xab9d('0x0'));var util=require(_0xab9d('0x1'));var moment=require(_0xab9d('0x2'));var BPromise=require(_0xab9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab9d('0x4'));var db=require(_0xab9d('0x5'))['db'];var utils=require(_0xab9d('0x6'));var logger=require(_0xab9d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab9d('0x8'));var client=jayson[_0xab9d('0x9')][_0xab9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1146fc,_0xd4a6c,_0x6caba6){return new BPromise(function(_0x46fb17,_0x59e162){return client[_0xab9d('0xb')](_0x1146fc,_0x6caba6)['then'](function(_0x20b703){logger[_0xab9d('0xc')](_0xab9d('0xd'),_0xd4a6c,'request\x20sent');logger[_0xab9d('0xe')](_0xab9d('0xf'),_0xd4a6c,_0xab9d('0x10'),JSON[_0xab9d('0x11')](_0x20b703));if(_0x20b703['error']){if(_0x20b703['error'][_0xab9d('0x12')]===0x1f4){logger[_0xab9d('0x13')](_0xab9d('0xd'),_0xd4a6c,_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);return _0x59e162(_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);}logger[_0xab9d('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0xd4a6c,_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);return _0x46fb17(_0x20b703['error'][_0xab9d('0x14')]);}else{logger['info'](_0xab9d('0xd'),_0xd4a6c,_0xab9d('0x10'));_0x46fb17(_0x20b703[_0xab9d('0x15')]['message']);}})[_0xab9d('0x16')](function(_0x3616ad){logger[_0xab9d('0x13')](_0xab9d('0xd'),_0xd4a6c,_0x3616ad);_0x59e162(_0x3616ad);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f7abef8..c1f3760 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 _0x186d=['delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','index','get','/:id','show','post','isAuthenticated','put','update'];(function(_0x2a97f7,_0x465e0c){var _0x13c258=function(_0x1b043d){while(--_0x1b043d){_0x2a97f7['push'](_0x2a97f7['shift']());}};_0x13c258(++_0x465e0c);}(_0x186d,0x1ca));var _0xd186=function(_0x4864f0,_0x5da8c5){_0x4864f0=_0x4864f0-0x0;var _0x55445a=_0x186d[_0x4864f0];return _0x55445a;};'use strict';var multer=require('multer');var util=require(_0xd186('0x0'));var path=require(_0xd186('0x1'));var timeout=require(_0xd186('0x2'));var express=require(_0xd186('0x3'));var router=express[_0xd186('0x4')]();var fs_extra=require(_0xd186('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd186('0x6'));var config=require(_0xd186('0x7'));var controller=require(_0xd186('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd186('0x9')]);router[_0xd186('0xa')](_0xd186('0xb'),auth['isAuthenticated'](),controller[_0xd186('0xc')]);router[_0xd186('0xd')]('/',auth[_0xd186('0xe')](),controller['create']);router[_0xd186('0xf')](_0xd186('0xb'),auth[_0xd186('0xe')](),controller[_0xd186('0x10')]);router[_0xd186('0x11')](_0xd186('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd186('0x12')]=router; \ No newline at end of file +var _0x9f0e=['../../config/environment','./template.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5503c1,_0x59a45f){_0x5503c1=_0x5503c1-0x0;var _0x352e10=_0x9f0e[_0x5503c1];return _0x352e10;};'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['show']);router[_0xe9f0('0xc')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);module[_0xe9f0('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 73810f2..e1223bf 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 _0xc801=['TEXT','exports','STRING'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xc801,0xb2));var _0x1c80=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xc801[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require('sequelize');module[_0x1c80('0x0')]={'name':{'type':Sequelize[_0x1c80('0x1')]},'description':{'type':Sequelize[_0x1c80('0x1')]},'html':{'type':Sequelize[_0x1c80('0x2')]}}; \ No newline at end of file +var _0x6a87=['sequelize','STRING','TEXT'];(function(_0x170a93,_0x69bda0){var _0x4adb1a=function(_0xe8c940){while(--_0xe8c940){_0x170a93['push'](_0x170a93['shift']());}};_0x4adb1a(++_0x69bda0);}(_0x6a87,0x1bc));var _0x76a8=function(_0x42abcf,_0x2ceadc){_0x42abcf=_0x42abcf-0x0;var _0x5d13b5=_0x6a87[_0x42abcf];return _0x5d13b5;};'use strict';var Sequelize=require(_0x76a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x76a8('0x1')]},'description':{'type':Sequelize[_0x76a8('0x1')]},'html':{'type':Sequelize[_0x76a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a50291b..a229583 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 _0x6012=['rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Templates','UserProfileResource','end','error','name','send','index','map','Template'];(function(_0x49e0d4,_0x1b7d6c){var _0x4fe3a0=function(_0x1c9ca3){while(--_0x1c9ca3){_0x49e0d4['push'](_0x49e0d4['shift']());}};_0x4fe3a0(++_0x1b7d6c);}(_0x6012,0x122));var _0x2601=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x6012[_0xed4881];return _0x7fcbd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2601('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2601('0x1'));var rp=require(_0x2601('0x2'));var moment=require(_0x2601('0x3'));var BPromise=require(_0x2601('0x4'));var Mustache=require(_0x2601('0x5'));var util=require(_0x2601('0x6'));var path=require(_0x2601('0x7'));var sox=require(_0x2601('0x8'));var csv=require(_0x2601('0x9'));var ejs=require(_0x2601('0xa'));var fs=require('fs');var fs_extra=require(_0x2601('0xb'));var _=require('lodash');var squel=require(_0x2601('0xc'));var crypto=require(_0x2601('0xd'));var jsforce=require(_0x2601('0xe'));var deskjs=require(_0x2601('0xf'));var toCsv=require(_0x2601('0x9'));var querystring=require(_0x2601('0x10'));var Papa=require('papaparse');var Redis=require(_0x2601('0x11'));var authService=require(_0x2601('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2601('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2601('0x14'))(_0x2601('0x15'));var utils=require(_0x2601('0x16'));var config=require(_0x2601('0x17'));var licenseUtil=require(_0x2601('0x18'));var db=require(_0x2601('0x19'))['db'];function respondWithStatusCode(_0x5d4db6,_0xce7837){_0xce7837=_0xce7837||0xcc;return function(_0x5f55f2){if(_0x5f55f2){return _0x5d4db6[_0x2601('0x1a')](_0xce7837);}return _0x5d4db6[_0x2601('0x1b')](_0xce7837)['end']();};}function respondWithResult(_0x4068f1,_0x32aa09){_0x32aa09=_0x32aa09||0xc8;return function(_0x44d4f8){if(_0x44d4f8){return _0x4068f1[_0x2601('0x1b')](_0x32aa09)[_0x2601('0x1c')](_0x44d4f8);}};}function respondWithFilteredResult(_0x3ce7eb,_0x3f0cbd){return function(_0x319a1d){if(_0x319a1d){var _0x12b606=typeof _0x3f0cbd[_0x2601('0x1d')]===_0x2601('0x1e')&&typeof _0x3f0cbd[_0x2601('0x1f')]===_0x2601('0x1e');var _0x325d2d=_0x319a1d[_0x2601('0x20')];var _0x11a2b5=_0x12b606?0x0:_0x3f0cbd[_0x2601('0x1d')];var _0x1d97f2=_0x12b606?_0x319a1d[_0x2601('0x20')]:_0x3f0cbd['offset']+_0x3f0cbd[_0x2601('0x1f')];var _0x589d6e;if(_0x1d97f2>=_0x325d2d){_0x1d97f2=_0x325d2d;_0x589d6e=0xc8;}else{_0x589d6e=0xce;}_0x3ce7eb[_0x2601('0x1b')](_0x589d6e);return _0x3ce7eb[_0x2601('0x21')](_0x2601('0x22'),_0x11a2b5+'-'+_0x1d97f2+'/'+_0x325d2d)[_0x2601('0x1c')](_0x319a1d);}return null;};}function patchUpdates(_0x372403){return function(_0x1f6c88){try{jsonpatch[_0x2601('0x23')](_0x1f6c88,_0x372403,!![]);}catch(_0x267938){return BPromise[_0x2601('0x24')](_0x267938);}return _0x1f6c88['save']();};}function saveUpdates(_0xa6dc34,_0x552c7c){return function(_0x5a80fc){if(_0x5a80fc){return _0x5a80fc[_0x2601('0x25')](_0xa6dc34)[_0x2601('0x26')](function(_0x3d30e9){return _0x3d30e9;});}return null;};}function removeEntity(_0xaced97,_0x23c7e8){return function(_0x4ed662){if(_0x4ed662){return _0x4ed662[_0x2601('0x27')]()[_0x2601('0x26')](function(){var _0x1f728a=_0x4ed662[_0x2601('0x28')]({'plain':!![]});var _0x3050e3=_0x2601('0x29');return db[_0x2601('0x2a')][_0x2601('0x27')]({'where':{'type':_0x3050e3,'resourceId':_0x1f728a['id']}})[_0x2601('0x26')](function(){return _0x4ed662;});})[_0x2601('0x26')](function(){_0xaced97[_0x2601('0x1b')](0xcc)[_0x2601('0x2b')]();});}};}function handleEntityNotFound(_0x36447,_0xb7a5fb){return function(_0x2bf8a3){if(!_0x2bf8a3){_0x36447['sendStatus'](0x194);}return _0x2bf8a3;};}function handleError(_0x243de1,_0x265b0f){_0x265b0f=_0x265b0f||0x1f4;return function(_0x3cf10a){logger[_0x2601('0x2c')](_0x3cf10a['stack']);if(_0x3cf10a[_0x2601('0x2d')]){delete _0x3cf10a[_0x2601('0x2d')];}_0x243de1['status'](_0x265b0f)[_0x2601('0x2e')](_0x3cf10a);};}exports[_0x2601('0x2f')]=function(_0x3a8d36,_0x153f29){var _0x29445d={},_0x1043a8={},_0x16e149={'count':0x0,'rows':[]};var _0x412adf=_[_0x2601('0x30')](db[_0x2601('0x31')][_0x2601('0x32')],function(_0x3bdd81){return{'name':_0x3bdd81[_0x2601('0x33')],'type':_0x3bdd81['type']['key']};});_0x1043a8['model']=_[_0x2601('0x30')](_0x412adf,_0x2601('0x2d'));_0x1043a8['query']=_[_0x2601('0x34')](_0x3a8d36[_0x2601('0x35')]);_0x1043a8[_0x2601('0x36')]=_[_0x2601('0x37')](_0x1043a8[_0x2601('0x38')],_0x1043a8[_0x2601('0x35')]);_0x29445d['attributes']=_['intersection'](_0x1043a8[_0x2601('0x38')],qs[_0x2601('0x39')](_0x3a8d36[_0x2601('0x35')][_0x2601('0x39')]));_0x29445d['attributes']=_0x29445d[_0x2601('0x3a')][_0x2601('0x3b')]?_0x29445d[_0x2601('0x3a')]:_0x1043a8[_0x2601('0x38')];if(!_0x3a8d36[_0x2601('0x35')][_0x2601('0x3c')](_0x2601('0x3d'))){_0x29445d[_0x2601('0x1f')]=qs['limit'](_0x3a8d36[_0x2601('0x35')][_0x2601('0x1f')]);_0x29445d[_0x2601('0x1d')]=qs[_0x2601('0x1d')](_0x3a8d36[_0x2601('0x35')]['offset']);}_0x29445d[_0x2601('0x3e')]=qs[_0x2601('0x3f')](_0x3a8d36[_0x2601('0x35')][_0x2601('0x3f')]);_0x29445d[_0x2601('0x40')]=qs[_0x2601('0x36')](_['pick'](_0x3a8d36['query'],_0x1043a8[_0x2601('0x36')]),_0x412adf);if(_0x3a8d36[_0x2601('0x35')][_0x2601('0x41')]){_0x29445d[_0x2601('0x40')]=_[_0x2601('0x42')](_0x29445d['where'],{'$or':_[_0x2601('0x30')](_0x412adf,function(_0x35d092){if(_0x35d092['type']!==_0x2601('0x43')){var _0x535957={};_0x535957[_0x35d092['name']]={'$like':'%'+_0x3a8d36[_0x2601('0x35')][_0x2601('0x41')]+'%'};return _0x535957;}})});}_0x29445d=_[_0x2601('0x42')]({},_0x29445d,_0x3a8d36[_0x2601('0x44')]);var _0x10bce9={'where':_0x29445d[_0x2601('0x40')]};return db[_0x2601('0x31')][_0x2601('0x20')](_0x10bce9)[_0x2601('0x26')](function(_0x3fc64b){_0x16e149['count']=_0x3fc64b;if(_0x3a8d36['query'][_0x2601('0x45')]){_0x29445d[_0x2601('0x46')]=[{'all':!![]}];}return db[_0x2601('0x31')][_0x2601('0x47')](_0x29445d);})[_0x2601('0x26')](function(_0x27fe04){_0x16e149[_0x2601('0x48')]=_0x27fe04;return _0x16e149;})['then'](respondWithFilteredResult(_0x153f29,_0x29445d))[_0x2601('0x49')](handleError(_0x153f29,null));};exports[_0x2601('0x4a')]=function(_0x54202d,_0x75b3e9){var _0x1ba0af={'raw':!![],'where':{'id':_0x54202d[_0x2601('0x4b')]['id']}},_0x22158f={};_0x22158f[_0x2601('0x38')]=_[_0x2601('0x34')](db[_0x2601('0x31')][_0x2601('0x32')]);_0x22158f[_0x2601('0x35')]=_['keys'](_0x54202d[_0x2601('0x35')]);_0x22158f[_0x2601('0x36')]=_[_0x2601('0x37')](_0x22158f['model'],_0x22158f[_0x2601('0x35')]);_0x1ba0af[_0x2601('0x3a')]=_[_0x2601('0x37')](_0x22158f['model'],qs['fields'](_0x54202d[_0x2601('0x35')][_0x2601('0x39')]));_0x1ba0af[_0x2601('0x3a')]=_0x1ba0af['attributes']['length']?_0x1ba0af[_0x2601('0x3a')]:_0x22158f[_0x2601('0x38')];if(_0x54202d[_0x2601('0x35')][_0x2601('0x45')]){_0x1ba0af[_0x2601('0x46')]=[{'all':!![]}];}_0x1ba0af=_[_0x2601('0x42')]({},_0x1ba0af,_0x54202d[_0x2601('0x44')]);return db['Template']['find'](_0x1ba0af)[_0x2601('0x26')](handleEntityNotFound(_0x75b3e9,null))[_0x2601('0x26')](respondWithResult(_0x75b3e9,null))['catch'](handleError(_0x75b3e9,null));};exports[_0x2601('0x4c')]=function(_0xd19ca2,_0xdd656e){return db[_0x2601('0x31')][_0x2601('0x4c')](_0xd19ca2[_0x2601('0x4d')],{})['then'](function(_0x3596c0){var _0x249cca=_0xd19ca2[_0x2601('0x4e')][_0x2601('0x28')]({'plain':!![]});if(!_0x249cca)throw new Error(_0x2601('0x4f'));if(_0x249cca[_0x2601('0x50')]===_0x2601('0x4e')){var _0x11d796=_0x3596c0['get']({'plain':!![]});var _0x15151e=_0x2601('0x29');return db['UserProfileSection'][_0x2601('0x51')]({'where':{'name':_0x15151e,'userProfileId':_0x249cca[_0x2601('0x52')]},'raw':!![]})['then'](function(_0x30fac2){if(_0x30fac2&&_0x30fac2[_0x2601('0x53')]===0x0){return db[_0x2601('0x2a')][_0x2601('0x4c')]({'name':_0x11d796[_0x2601('0x2d')],'resourceId':_0x11d796['id'],'type':_0x30fac2[_0x2601('0x2d')],'sectionId':_0x30fac2['id']},{})[_0x2601('0x26')](function(){return _0x3596c0;});}else{return _0x3596c0;}})[_0x2601('0x49')](function(_0x3f7807){logger[_0x2601('0x2c')](_0x2601('0x54'),_0x3f7807);throw _0x3f7807;});}return _0x3596c0;})[_0x2601('0x26')](respondWithResult(_0xdd656e,0xc9))[_0x2601('0x49')](handleError(_0xdd656e,null));};exports[_0x2601('0x25')]=function(_0x15c880,_0x22cee8){if(_0x15c880[_0x2601('0x4d')]['id']){delete _0x15c880[_0x2601('0x4d')]['id'];}return db[_0x2601('0x31')][_0x2601('0x51')]({'where':{'id':_0x15c880[_0x2601('0x4b')]['id']}})[_0x2601('0x26')](handleEntityNotFound(_0x22cee8,null))[_0x2601('0x26')](saveUpdates(_0x15c880[_0x2601('0x4d')],null))['then'](respondWithResult(_0x22cee8,null))[_0x2601('0x49')](handleError(_0x22cee8,null));};exports[_0x2601('0x27')]=function(_0x31081d,_0x4ce8de){return db['Template'][_0x2601('0x51')]({'where':{'id':_0x31081d[_0x2601('0x4b')]['id']}})[_0x2601('0x26')](handleEntityNotFound(_0x4ce8de,null))[_0x2601('0x26')](removeEntity(_0x4ce8de,null))[_0x2601('0x49')](handleError(_0x4ce8de,null));}; \ No newline at end of file +var _0xa0a2=['stack','name','status','send','map','Template','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','get','Templates','UserProfileResource','then','error'];(function(_0x3e7336,_0x3fe25e){var _0x31357c=function(_0x5d1eaf){while(--_0x5d1eaf){_0x3e7336['push'](_0x3e7336['shift']());}};_0x31357c(++_0x3fe25e);}(_0xa0a2,0x81));var _0x2a0a=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0xa0a2[_0x591a90];return _0x551587;};'use strict';var emlformat=require(_0x2a0a('0x0'));var rimraf=require(_0x2a0a('0x1'));var zipdir=require(_0x2a0a('0x2'));var jsonpatch=require(_0x2a0a('0x3'));var rp=require(_0x2a0a('0x4'));var moment=require(_0x2a0a('0x5'));var BPromise=require(_0x2a0a('0x6'));var Mustache=require('mustache');var util=require(_0x2a0a('0x7'));var path=require(_0x2a0a('0x8'));var sox=require(_0x2a0a('0x9'));var csv=require(_0x2a0a('0xa'));var ejs=require(_0x2a0a('0xb'));var fs=require('fs');var fs_extra=require(_0x2a0a('0xc'));var _=require(_0x2a0a('0xd'));var squel=require(_0x2a0a('0xe'));var crypto=require(_0x2a0a('0xf'));var jsforce=require(_0x2a0a('0x10'));var deskjs=require(_0x2a0a('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2a0a('0x12'));var Papa=require(_0x2a0a('0x13'));var Redis=require('ioredis');var authService=require(_0x2a0a('0x14'));var qs=require(_0x2a0a('0x15'));var as=require(_0x2a0a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a0a('0x17'))(_0x2a0a('0x18'));var utils=require(_0x2a0a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2a0a('0x1a'));var db=require(_0x2a0a('0x1b'))['db'];function respondWithStatusCode(_0x204546,_0xaf0759){_0xaf0759=_0xaf0759||0xcc;return function(_0x1f6c69){if(_0x1f6c69){return _0x204546[_0x2a0a('0x1c')](_0xaf0759);}return _0x204546['status'](_0xaf0759)[_0x2a0a('0x1d')]();};}function respondWithResult(_0x2d82a7,_0xfff64c){_0xfff64c=_0xfff64c||0xc8;return function(_0x32bed9){if(_0x32bed9){return _0x2d82a7['status'](_0xfff64c)[_0x2a0a('0x1e')](_0x32bed9);}};}function respondWithFilteredResult(_0xa92b45,_0x14a8dd){return function(_0x5e07fe){if(_0x5e07fe){var _0x35f8c8=typeof _0x14a8dd[_0x2a0a('0x1f')]===_0x2a0a('0x20')&&typeof _0x14a8dd[_0x2a0a('0x21')]===_0x2a0a('0x20');var _0x1e5f9f=_0x5e07fe['count'];var _0xfc4dcb=_0x35f8c8?0x0:_0x14a8dd['offset'];var _0x14bef2=_0x35f8c8?_0x5e07fe['count']:_0x14a8dd[_0x2a0a('0x1f')]+_0x14a8dd[_0x2a0a('0x21')];var _0xd0b07f;if(_0x14bef2>=_0x1e5f9f){_0x14bef2=_0x1e5f9f;_0xd0b07f=0xc8;}else{_0xd0b07f=0xce;}_0xa92b45['status'](_0xd0b07f);return _0xa92b45['set'](_0x2a0a('0x22'),_0xfc4dcb+'-'+_0x14bef2+'/'+_0x1e5f9f)[_0x2a0a('0x1e')](_0x5e07fe);}return null;};}function patchUpdates(_0x3b5fe7){return function(_0x342e8b){try{jsonpatch[_0x2a0a('0x23')](_0x342e8b,_0x3b5fe7,!![]);}catch(_0x528844){return BPromise[_0x2a0a('0x24')](_0x528844);}return _0x342e8b[_0x2a0a('0x25')]();};}function saveUpdates(_0x4753be,_0x48034e){return function(_0x40b763){if(_0x40b763){return _0x40b763[_0x2a0a('0x26')](_0x4753be)['then'](function(_0x5db923){return _0x5db923;});}return null;};}function removeEntity(_0x5c20c3,_0x3277bf){return function(_0x2f2db2){if(_0x2f2db2){return _0x2f2db2[_0x2a0a('0x27')]()['then'](function(){var _0x4b1d32=_0x2f2db2[_0x2a0a('0x28')]({'plain':!![]});var _0x56d626=_0x2a0a('0x29');return db[_0x2a0a('0x2a')][_0x2a0a('0x27')]({'where':{'type':_0x56d626,'resourceId':_0x4b1d32['id']}})[_0x2a0a('0x2b')](function(){return _0x2f2db2;});})[_0x2a0a('0x2b')](function(){_0x5c20c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5666bb,_0x149e61){return function(_0x203706){if(!_0x203706){_0x5666bb[_0x2a0a('0x1c')](0x194);}return _0x203706;};}function handleError(_0x1fc2d8,_0x5720c8){_0x5720c8=_0x5720c8||0x1f4;return function(_0x132e74){logger[_0x2a0a('0x2c')](_0x132e74[_0x2a0a('0x2d')]);if(_0x132e74[_0x2a0a('0x2e')]){delete _0x132e74[_0x2a0a('0x2e')];}_0x1fc2d8[_0x2a0a('0x2f')](_0x5720c8)[_0x2a0a('0x30')](_0x132e74);};}exports['index']=function(_0x5066e4,_0x535c16){var _0x1ac046={},_0x274be2={},_0x280f54={'count':0x0,'rows':[]};var _0x1c1414=_[_0x2a0a('0x31')](db[_0x2a0a('0x32')]['rawAttributes'],function(_0xb787a6){return{'name':_0xb787a6[_0x2a0a('0x33')],'type':_0xb787a6['type'][_0x2a0a('0x34')]};});_0x274be2['model']=_[_0x2a0a('0x31')](_0x1c1414,_0x2a0a('0x2e'));_0x274be2[_0x2a0a('0x35')]=_[_0x2a0a('0x36')](_0x5066e4[_0x2a0a('0x35')]);_0x274be2[_0x2a0a('0x37')]=_[_0x2a0a('0x38')](_0x274be2[_0x2a0a('0x39')],_0x274be2[_0x2a0a('0x35')]);_0x1ac046[_0x2a0a('0x3a')]=_[_0x2a0a('0x38')](_0x274be2['model'],qs['fields'](_0x5066e4['query'][_0x2a0a('0x3b')]));_0x1ac046[_0x2a0a('0x3a')]=_0x1ac046[_0x2a0a('0x3a')][_0x2a0a('0x3c')]?_0x1ac046[_0x2a0a('0x3a')]:_0x274be2[_0x2a0a('0x39')];if(!_0x5066e4[_0x2a0a('0x35')]['hasOwnProperty'](_0x2a0a('0x3d'))){_0x1ac046[_0x2a0a('0x21')]=qs[_0x2a0a('0x21')](_0x5066e4[_0x2a0a('0x35')][_0x2a0a('0x21')]);_0x1ac046[_0x2a0a('0x1f')]=qs[_0x2a0a('0x1f')](_0x5066e4[_0x2a0a('0x35')][_0x2a0a('0x1f')]);}_0x1ac046[_0x2a0a('0x3e')]=qs[_0x2a0a('0x3f')](_0x5066e4['query'][_0x2a0a('0x3f')]);_0x1ac046[_0x2a0a('0x40')]=qs[_0x2a0a('0x37')](_[_0x2a0a('0x41')](_0x5066e4['query'],_0x274be2['filters']),_0x1c1414);if(_0x5066e4['query'][_0x2a0a('0x42')]){_0x1ac046[_0x2a0a('0x40')]=_[_0x2a0a('0x43')](_0x1ac046[_0x2a0a('0x40')],{'$or':_['map'](_0x1c1414,function(_0x1352ca){if(_0x1352ca['type']!==_0x2a0a('0x44')){var _0x4262a3={};_0x4262a3[_0x1352ca['name']]={'$like':'%'+_0x5066e4[_0x2a0a('0x35')][_0x2a0a('0x42')]+'%'};return _0x4262a3;}})});}_0x1ac046=_['merge']({},_0x1ac046,_0x5066e4['options']);var _0x485f42={'where':_0x1ac046[_0x2a0a('0x40')]};return db[_0x2a0a('0x32')][_0x2a0a('0x45')](_0x485f42)[_0x2a0a('0x2b')](function(_0xca67c1){_0x280f54[_0x2a0a('0x45')]=_0xca67c1;if(_0x5066e4['query'][_0x2a0a('0x46')]){_0x1ac046[_0x2a0a('0x47')]=[{'all':!![]}];}return db[_0x2a0a('0x32')]['findAll'](_0x1ac046);})[_0x2a0a('0x2b')](function(_0x13545a){_0x280f54[_0x2a0a('0x48')]=_0x13545a;return _0x280f54;})[_0x2a0a('0x2b')](respondWithFilteredResult(_0x535c16,_0x1ac046))[_0x2a0a('0x49')](handleError(_0x535c16,null));};exports[_0x2a0a('0x4a')]=function(_0x5a15b5,_0x4d9ff9){var _0x52370c={'raw':!![],'where':{'id':_0x5a15b5[_0x2a0a('0x4b')]['id']}},_0x49c0b1={};_0x49c0b1[_0x2a0a('0x39')]=_[_0x2a0a('0x36')](db['Template'][_0x2a0a('0x4c')]);_0x49c0b1[_0x2a0a('0x35')]=_[_0x2a0a('0x36')](_0x5a15b5[_0x2a0a('0x35')]);_0x49c0b1[_0x2a0a('0x37')]=_[_0x2a0a('0x38')](_0x49c0b1['model'],_0x49c0b1[_0x2a0a('0x35')]);_0x52370c[_0x2a0a('0x3a')]=_[_0x2a0a('0x38')](_0x49c0b1[_0x2a0a('0x39')],qs[_0x2a0a('0x3b')](_0x5a15b5[_0x2a0a('0x35')][_0x2a0a('0x3b')]));_0x52370c[_0x2a0a('0x3a')]=_0x52370c[_0x2a0a('0x3a')][_0x2a0a('0x3c')]?_0x52370c[_0x2a0a('0x3a')]:_0x49c0b1[_0x2a0a('0x39')];if(_0x5a15b5[_0x2a0a('0x35')][_0x2a0a('0x46')]){_0x52370c[_0x2a0a('0x47')]=[{'all':!![]}];}_0x52370c=_[_0x2a0a('0x43')]({},_0x52370c,_0x5a15b5['options']);return db[_0x2a0a('0x32')]['find'](_0x52370c)[_0x2a0a('0x2b')](handleEntityNotFound(_0x4d9ff9,null))[_0x2a0a('0x2b')](respondWithResult(_0x4d9ff9,null))[_0x2a0a('0x49')](handleError(_0x4d9ff9,null));};exports[_0x2a0a('0x4d')]=function(_0x227b10,_0x50332f){return db['Template']['create'](_0x227b10[_0x2a0a('0x4e')],{})[_0x2a0a('0x2b')](function(_0x504568){var _0x5857dd=_0x227b10[_0x2a0a('0x4f')]['get']({'plain':!![]});if(!_0x5857dd)throw new Error(_0x2a0a('0x50'));if(_0x5857dd[_0x2a0a('0x51')]==='user'){var _0x599d95=_0x504568[_0x2a0a('0x28')]({'plain':!![]});var _0x2aa4be=_0x2a0a('0x29');return db[_0x2a0a('0x52')]['find']({'where':{'name':_0x2aa4be,'userProfileId':_0x5857dd[_0x2a0a('0x53')]},'raw':!![]})['then'](function(_0x1549be){if(_0x1549be&&_0x1549be[_0x2a0a('0x54')]===0x0){return db[_0x2a0a('0x2a')][_0x2a0a('0x4d')]({'name':_0x599d95[_0x2a0a('0x2e')],'resourceId':_0x599d95['id'],'type':_0x1549be[_0x2a0a('0x2e')],'sectionId':_0x1549be['id']},{})[_0x2a0a('0x2b')](function(){return _0x504568;});}else{return _0x504568;}})[_0x2a0a('0x49')](function(_0x4b5560){logger[_0x2a0a('0x2c')](_0x2a0a('0x55'),_0x4b5560);throw _0x4b5560;});}return _0x504568;})[_0x2a0a('0x2b')](respondWithResult(_0x50332f,0xc9))[_0x2a0a('0x49')](handleError(_0x50332f,null));};exports[_0x2a0a('0x26')]=function(_0x11f7da,_0x3571c0){if(_0x11f7da[_0x2a0a('0x4e')]['id']){delete _0x11f7da[_0x2a0a('0x4e')]['id'];}return db[_0x2a0a('0x32')][_0x2a0a('0x56')]({'where':{'id':_0x11f7da[_0x2a0a('0x4b')]['id']}})[_0x2a0a('0x2b')](handleEntityNotFound(_0x3571c0,null))['then'](saveUpdates(_0x11f7da[_0x2a0a('0x4e')],null))['then'](respondWithResult(_0x3571c0,null))[_0x2a0a('0x49')](handleError(_0x3571c0,null));};exports['destroy']=function(_0x732bb9,_0x1feb71){return db[_0x2a0a('0x32')]['find']({'where':{'id':_0x732bb9['params']['id']}})['then'](handleEntityNotFound(_0x1feb71,null))['then'](removeEntity(_0x1feb71,null))[_0x2a0a('0x49')](handleError(_0x1feb71,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b6e390f..6332880 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 _0xd1a4=['bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','api','moment'];(function(_0x587bc3,_0x28ff63){var _0x587b59=function(_0x2a95aa){while(--_0x2a95aa){_0x587bc3['push'](_0x587bc3['shift']());}};_0x587b59(++_0x28ff63);}(_0xd1a4,0x19c));var _0x4d1a=function(_0x5b4f0f,_0x18e653){_0x5b4f0f=_0x5b4f0f-0x0;var _0xb1a86=_0xd1a4[_0x5b4f0f];return _0xb1a86;};'use strict';var _=require(_0x4d1a('0x0'));var util=require(_0x4d1a('0x1'));var logger=require('../../config/logger')(_0x4d1a('0x2'));var moment=require(_0x4d1a('0x3'));var BPromise=require(_0x4d1a('0x4'));var rp=require(_0x4d1a('0x5'));var fs=require('fs');var path=require(_0x4d1a('0x6'));var rimraf=require('rimraf');var config=require(_0x4d1a('0x7'));var attributes=require(_0x4d1a('0x8'));module[_0x4d1a('0x9')]=function(_0x5a8555,_0x39e455){return _0x5a8555[_0x4d1a('0xa')](_0x4d1a('0xb'),attributes,{'tableName':_0x4d1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b09=['lodash','util','moment','path','rimraf','../../config/environment','Template','tools_templates'];(function(_0xd899ea,_0x29dcdc){var _0x3e254f=function(_0x48c89f){while(--_0x48c89f){_0xd899ea['push'](_0xd899ea['shift']());}};_0x3e254f(++_0x29dcdc);}(_0x9b09,0x1d0));var _0x99b0=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0x9b09[_0x35e75a];return _0xb23c7f;};'use strict';var _=require(_0x99b0('0x0'));var util=require(_0x99b0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x99b0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x99b0('0x3'));var rimraf=require(_0x99b0('0x4'));var config=require(_0x99b0('0x5'));var attributes=require('./template.attributes');module['exports']=function(_0x2fc78a,_0x5a5298){return _0x2fc78a['define'](_0x99b0('0x6'),attributes,{'tableName':_0x99b0('0x7'),'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 301814f..5823efa 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 _0x475f=['model','util','moment','randomstring','ioredis','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map'];(function(_0x12496f,_0x2b9479){var _0x3b482a=function(_0x38ec37){while(--_0x38ec37){_0x12496f['push'](_0x12496f['shift']());}};_0x3b482a(++_0x2b9479);}(_0x475f,0x187));var _0xf475=function(_0x54fa97,_0x25bb8b){_0x54fa97=_0x54fa97-0x0;var _0x1acd9b=_0x475f[_0x54fa97];return _0x1acd9b;};'use strict';var _=require('lodash');var util=require(_0xf475('0x0'));var moment=require(_0xf475('0x1'));var BPromise=require('bluebird');var rs=require(_0xf475('0x2'));var fs=require('fs');var Redis=require(_0xf475('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf475('0x4'));var config=require('../../config/environment');var jayson=require(_0xf475('0x5'));var client=jayson[_0xf475('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56c96e,_0x20e5eb,_0x118803){return new BPromise(function(_0x348ab7,_0x24e6d2){return client[_0xf475('0x7')](_0x56c96e,_0x118803)[_0xf475('0x8')](function(_0x793f50){logger[_0xf475('0x9')]('Template,\x20%s,\x20%s',_0x20e5eb,_0xf475('0xa'));logger[_0xf475('0xb')](_0xf475('0xc'),_0x20e5eb,_0xf475('0xa'),JSON[_0xf475('0xd')](_0x793f50));if(_0x793f50[_0xf475('0xe')]){if(_0x793f50[_0xf475('0xe')][_0xf475('0xf')]===0x1f4){logger[_0xf475('0xe')](_0xf475('0x10'),_0x20e5eb,_0x793f50[_0xf475('0xe')]['message']);return _0x24e6d2(_0x793f50['error']['message']);}logger[_0xf475('0xe')](_0xf475('0x10'),_0x20e5eb,_0x793f50[_0xf475('0xe')][_0xf475('0x11')]);return _0x348ab7(_0x793f50[_0xf475('0xe')]['message']);}else{logger[_0xf475('0x9')](_0xf475('0x10'),_0x20e5eb,_0xf475('0xa'));_0x348ab7(_0x793f50[_0xf475('0x12')][_0xf475('0x11')]);}})[_0xf475('0x13')](function(_0x235fe8){logger['error'](_0xf475('0x10'),_0x20e5eb,_0x235fe8);_0x24e6d2(_0x235fe8);});});}exports[_0xf475('0x14')]=function(_0x526bf3){var _0x377b1b=this;return new Promise(function(_0x5a37ee,_0x4e8518){return db[_0xf475('0x15')]['findAll']({'raw':_0x526bf3[_0xf475('0x16')]?_0x526bf3[_0xf475('0x16')][_0xf475('0x17')]===undefined?!![]:![]:!![],'where':_0x526bf3['options']?_0x526bf3[_0xf475('0x16')][_0xf475('0x18')]||null:null,'attributes':_0x526bf3[_0xf475('0x16')]?_0x526bf3['options'][_0xf475('0x19')]||null:null,'limit':_0x526bf3[_0xf475('0x16')]?_0x526bf3[_0xf475('0x16')][_0xf475('0x1a')]||null:null,'include':_0x526bf3[_0xf475('0x16')]?_0x526bf3[_0xf475('0x16')][_0xf475('0x1b')]?_[_0xf475('0x1c')](_0x526bf3[_0xf475('0x16')][_0xf475('0x1b')],function(_0x52cf06){return{'model':db[_0x52cf06[_0xf475('0x1d')]],'as':_0x52cf06['as'],'attributes':_0x52cf06[_0xf475('0x19')],'include':_0x52cf06['include']?_[_0xf475('0x1c')](_0x52cf06[_0xf475('0x1b')],function(_0x58eb7a){return{'model':db[_0x58eb7a['model']],'as':_0x58eb7a['as'],'attributes':_0x58eb7a[_0xf475('0x19')],'include':_0x58eb7a[_0xf475('0x1b')]?_[_0xf475('0x1c')](_0x58eb7a['include'],function(_0x4ecc73){return{'model':db[_0x4ecc73[_0xf475('0x1d')]],'as':_0x4ecc73['as'],'attributes':_0x4ecc73[_0xf475('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf475('0x8')](function(_0x51992d){logger[_0xf475('0x9')]('GetTemplate',_0x526bf3);logger[_0xf475('0xb')]('GetTemplate',_0x526bf3,JSON[_0xf475('0xd')](_0x51992d));_0x5a37ee(_0x51992d);})['catch'](function(_0x5504d9){logger[_0xf475('0xe')](_0xf475('0x14'),_0x5504d9[_0xf475('0x11')],_0x526bf3);_0x4e8518(_0x377b1b[_0xf475('0xe')](0x1f4,_0x5504d9['message']));});});}; \ No newline at end of file +var _0x0915=['options','raw','where','limit','map','model','attributes','include','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetTemplate','Template','findAll'];(function(_0x5e6d65,_0x5db89c){var _0x5e1f75=function(_0x3729a1){while(--_0x3729a1){_0x5e6d65['push'](_0x5e6d65['shift']());}};_0x5e1f75(++_0x5db89c);}(_0x0915,0x1c5));var _0x5091=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0915[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x5091('0x0'));var util=require(_0x5091('0x1'));var moment=require(_0x5091('0x2'));var BPromise=require(_0x5091('0x3'));var rs=require(_0x5091('0x4'));var fs=require('fs');var Redis=require(_0x5091('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5091('0x6'));var config=require(_0x5091('0x7'));var jayson=require(_0x5091('0x8'));var client=jayson[_0x5091('0x9')][_0x5091('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecd7f,_0x22a17e,_0x24bd12){return new BPromise(function(_0x4357fb,_0x1d8341){return client[_0x5091('0xb')](_0x5ecd7f,_0x24bd12)['then'](function(_0x4af6c3){logger[_0x5091('0xc')](_0x5091('0xd'),_0x22a17e,_0x5091('0xe'));logger['debug'](_0x5091('0xf'),_0x22a17e,_0x5091('0xe'),JSON[_0x5091('0x10')](_0x4af6c3));if(_0x4af6c3['error']){if(_0x4af6c3[_0x5091('0x11')]['code']===0x1f4){logger[_0x5091('0x11')](_0x5091('0xd'),_0x22a17e,_0x4af6c3[_0x5091('0x11')][_0x5091('0x12')]);return _0x1d8341(_0x4af6c3['error']['message']);}logger[_0x5091('0x11')](_0x5091('0xd'),_0x22a17e,_0x4af6c3[_0x5091('0x11')][_0x5091('0x12')]);return _0x4357fb(_0x4af6c3[_0x5091('0x11')][_0x5091('0x12')]);}else{logger['info'](_0x5091('0xd'),_0x22a17e,'request\x20sent');_0x4357fb(_0x4af6c3[_0x5091('0x13')][_0x5091('0x12')]);}})['catch'](function(_0x3c8d00){logger['error']('Template,\x20%s,\x20%s',_0x22a17e,_0x3c8d00);_0x1d8341(_0x3c8d00);});});}exports[_0x5091('0x14')]=function(_0x189ac6){var _0x5c8729=this;return new Promise(function(_0x36fadd,_0x397657){return db[_0x5091('0x15')][_0x5091('0x16')]({'raw':_0x189ac6[_0x5091('0x17')]?_0x189ac6[_0x5091('0x17')][_0x5091('0x18')]===undefined?!![]:![]:!![],'where':_0x189ac6[_0x5091('0x17')]?_0x189ac6[_0x5091('0x17')][_0x5091('0x19')]||null:null,'attributes':_0x189ac6['options']?_0x189ac6[_0x5091('0x17')]['attributes']||null:null,'limit':_0x189ac6[_0x5091('0x17')]?_0x189ac6[_0x5091('0x17')][_0x5091('0x1a')]||null:null,'include':_0x189ac6[_0x5091('0x17')]?_0x189ac6[_0x5091('0x17')]['include']?_[_0x5091('0x1b')](_0x189ac6[_0x5091('0x17')]['include'],function(_0x35ac42){return{'model':db[_0x35ac42[_0x5091('0x1c')]],'as':_0x35ac42['as'],'attributes':_0x35ac42[_0x5091('0x1d')],'include':_0x35ac42[_0x5091('0x1e')]?_[_0x5091('0x1b')](_0x35ac42[_0x5091('0x1e')],function(_0x483a40){return{'model':db[_0x483a40[_0x5091('0x1c')]],'as':_0x483a40['as'],'attributes':_0x483a40['attributes'],'include':_0x483a40[_0x5091('0x1e')]?_[_0x5091('0x1b')](_0x483a40[_0x5091('0x1e')],function(_0x748ee0){return{'model':db[_0x748ee0[_0x5091('0x1c')]],'as':_0x748ee0['as'],'attributes':_0x748ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5091('0x1f')](function(_0x4adfc2){logger[_0x5091('0xc')](_0x5091('0x14'),_0x189ac6);logger[_0x5091('0x20')](_0x5091('0x14'),_0x189ac6,JSON[_0x5091('0x10')](_0x4adfc2));_0x36fadd(_0x4adfc2);})[_0x5091('0x21')](function(_0x3a38d3){logger[_0x5091('0x11')]('GetTemplate',_0x3a38d3['message'],_0x189ac6);_0x397657(_0x5c8729[_0x5091('0x11')](0x1f4,_0x3a38d3[_0x5091('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index d474236..9e8de99 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 _0xf4d4=['create','post','addAllCondition','addAnyCondition','/:id/actions','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','getAllConditions','/:id/any_conditions','isAuthenticated','getAnyConditions'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xf4d4,0xf3));var _0x4f4d=function(_0x168c2b,_0x294e03){_0x168c2b=_0x168c2b-0x0;var _0x310e11=_0xf4d4[_0x168c2b];return _0x310e11;};'use strict';var multer=require(_0x4f4d('0x0'));var util=require(_0x4f4d('0x1'));var path=require(_0x4f4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f4d('0x3'));var router=express[_0x4f4d('0x4')]();var fs_extra=require(_0x4f4d('0x5'));var auth=require(_0x4f4d('0x6'));var interaction=require(_0x4f4d('0x7'));var config=require(_0x4f4d('0x8'));var controller=require(_0x4f4d('0x9'));router[_0x4f4d('0xa')]('/',auth['isAuthenticated'](),controller[_0x4f4d('0xb')]);router['get'](_0x4f4d('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x4f4d('0xd')]);router['get'](_0x4f4d('0xe'),auth[_0x4f4d('0xf')](),controller[_0x4f4d('0x10')]);router[_0x4f4d('0xa')]('/:id/actions',auth[_0x4f4d('0xf')](),controller['getActions']);router['post']('/',auth[_0x4f4d('0xf')](),controller[_0x4f4d('0x11')]);router[_0x4f4d('0x12')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x4f4d('0x13')]);router[_0x4f4d('0x12')]('/:id/any_conditions',auth[_0x4f4d('0xf')](),controller[_0x4f4d('0x14')]);router[_0x4f4d('0x12')](_0x4f4d('0x15'),auth[_0x4f4d('0xf')](),controller['addAction']);router[_0x4f4d('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4f4d('0x17')](_0x4f4d('0xc'),auth[_0x4f4d('0xf')](),controller[_0x4f4d('0x18')]);module[_0x4f4d('0x19')]=router; \ No newline at end of file +var _0x60d7=['get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','addAction','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x490417,_0xd287e2){var _0x2b9524=function(_0x23a118){while(--_0x23a118){_0x490417['push'](_0x490417['shift']());}};_0x2b9524(++_0xd287e2);}(_0x60d7,0x149));var _0x760d=function(_0x36f6f0,_0x17d022){_0x36f6f0=_0x36f6f0-0x0;var _0xefa562=_0x60d7[_0x36f6f0];return _0xefa562;};'use strict';var multer=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var path=require(_0x760d('0x2'));var timeout=require(_0x760d('0x3'));var express=require(_0x760d('0x4'));var router=express[_0x760d('0x5')]();var fs_extra=require(_0x760d('0x6'));var auth=require(_0x760d('0x7'));var interaction=require(_0x760d('0x8'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x760d('0x9')]('/',auth[_0x760d('0xa')](),controller[_0x760d('0xb')]);router[_0x760d('0x9')](_0x760d('0xc'),auth[_0x760d('0xa')](),controller[_0x760d('0xd')]);router[_0x760d('0x9')](_0x760d('0xe'),auth[_0x760d('0xa')](),controller[_0x760d('0xf')]);router[_0x760d('0x9')](_0x760d('0x10'),auth['isAuthenticated'](),controller[_0x760d('0x11')]);router[_0x760d('0x9')](_0x760d('0x12'),auth[_0x760d('0xa')](),controller[_0x760d('0x13')]);router['post']('/',auth[_0x760d('0xa')](),controller[_0x760d('0x14')]);router[_0x760d('0x15')](_0x760d('0xe'),auth[_0x760d('0xa')](),controller[_0x760d('0x16')]);router[_0x760d('0x15')](_0x760d('0x10'),auth[_0x760d('0xa')](),controller['addAnyCondition']);router['post'](_0x760d('0x12'),auth['isAuthenticated'](),controller[_0x760d('0x17')]);router['put'](_0x760d('0xc'),auth['isAuthenticated'](),controller[_0x760d('0x18')]);router['delete'](_0x760d('0xc'),auth[_0x760d('0xa')](),controller[_0x760d('0x19')]);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 1118ee4..bdc0e18 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 _0x06bb=['sequelize','STRING','BOOLEAN'];(function(_0x4d6cc1,_0x3750ed){var _0x5e4cf3=function(_0x13504e){while(--_0x13504e){_0x4d6cc1['push'](_0x4d6cc1['shift']());}};_0x5e4cf3(++_0x3750ed);}(_0x06bb,0x1bc));var _0xb06b=function(_0x22cf3b,_0x43d357){_0x22cf3b=_0x22cf3b-0x0;var _0x36ac8a=_0x06bb[_0x22cf3b];return _0x36ac8a;};'use strict';var Sequelize=require(_0xb06b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb06b('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb06b('0x1')]},'status':{'type':Sequelize[_0xb06b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe4a3=['exports','STRING'];(function(_0x43c594,_0x5adeb3){var _0x2c2e87=function(_0x10df52){while(--_0x10df52){_0x43c594['push'](_0x43c594['shift']());}};_0x2c2e87(++_0x5adeb3);}(_0xe4a3,0x1ae));var _0x3e4a=function(_0x3f872a,_0x3ec864){_0x3f872a=_0x3f872a-0x0;var _0x13e5fd=_0xe4a3[_0x3f872a];return _0x13e5fd;};'use strict';var Sequelize=require('sequelize');module[_0x3e4a('0x0')]={'name':{'type':Sequelize[_0x3e4a('0x1')]},'channel':{'type':Sequelize[_0x3e4a('0x1')]},'description':{'type':Sequelize[_0x3e4a('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 951505c..3da9e15 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 _0x6f66=['update','then','destroy','Triggers','UserProfileResource','end','stack','name','send','index','map','Trigger','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','catch','intersection','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','findOne','order','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','reject','save'];(function(_0x37e8e8,_0x1be63e){var _0x2c3c9e=function(_0x4e3a54){while(--_0x4e3a54){_0x37e8e8['push'](_0x37e8e8['shift']());}};_0x2c3c9e(++_0x1be63e);}(_0x6f66,0x1ed));var _0x66f6=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x6f66[_0x3bab09];return _0x164376;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x66f6('0x0'));var rp=require(_0x66f6('0x1'));var moment=require(_0x66f6('0x2'));var BPromise=require(_0x66f6('0x3'));var Mustache=require(_0x66f6('0x4'));var util=require(_0x66f6('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66f6('0x6'));var _=require(_0x66f6('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66f6('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x66f6('0x9'));var authService=require(_0x66f6('0xa'));var qs=require(_0x66f6('0xb'));var as=require(_0x66f6('0xc'));var hardwareService=require(_0x66f6('0xd'));var logger=require(_0x66f6('0xe'))(_0x66f6('0xf'));var utils=require(_0x66f6('0x10'));var config=require(_0x66f6('0x11'));var licenseUtil=require(_0x66f6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3691ab,_0x499b17){_0x499b17=_0x499b17||0xcc;return function(_0x142461){if(_0x142461){return _0x3691ab[_0x66f6('0x13')](_0x499b17);}return _0x3691ab['status'](_0x499b17)['end']();};}function respondWithResult(_0xcf818,_0x5435d9){_0x5435d9=_0x5435d9||0xc8;return function(_0x59dad4){if(_0x59dad4){return _0xcf818[_0x66f6('0x14')](_0x5435d9)[_0x66f6('0x15')](_0x59dad4);}};}function respondWithFilteredResult(_0x3228d2,_0x30f649){return function(_0x7f07da){if(_0x7f07da){var _0x1ababd=typeof _0x30f649['offset']==='undefined'&&typeof _0x30f649[_0x66f6('0x16')]===_0x66f6('0x17');var _0x3f5bb5=_0x7f07da[_0x66f6('0x18')];var _0x142eb4=_0x1ababd?0x0:_0x30f649[_0x66f6('0x19')];var _0x53ebbb=_0x1ababd?_0x7f07da[_0x66f6('0x18')]:_0x30f649['offset']+_0x30f649[_0x66f6('0x16')];var _0x3e7dbd;if(_0x53ebbb>=_0x3f5bb5){_0x53ebbb=_0x3f5bb5;_0x3e7dbd=0xc8;}else{_0x3e7dbd=0xce;}_0x3228d2[_0x66f6('0x14')](_0x3e7dbd);return _0x3228d2[_0x66f6('0x1a')]('Content-Range',_0x142eb4+'-'+_0x53ebbb+'/'+_0x3f5bb5)[_0x66f6('0x15')](_0x7f07da);}return null;};}function patchUpdates(_0x43453a){return function(_0x5ef05b){try{jsonpatch['apply'](_0x5ef05b,_0x43453a,!![]);}catch(_0x3dbf2a){return BPromise[_0x66f6('0x1b')](_0x3dbf2a);}return _0x5ef05b[_0x66f6('0x1c')]();};}function saveUpdates(_0xc9419c,_0x39ca18){return function(_0x5b6176){if(_0x5b6176){return _0x5b6176[_0x66f6('0x1d')](_0xc9419c)[_0x66f6('0x1e')](function(_0x5de321){return _0x5de321;});}return null;};}function removeEntity(_0x558af0,_0x39d623){return function(_0x5e3d2d){if(_0x5e3d2d){return _0x5e3d2d[_0x66f6('0x1f')]()['then'](function(){var _0x278537=_0x5e3d2d['get']({'plain':!![]});var _0x4acad0=_0x66f6('0x20');return db[_0x66f6('0x21')][_0x66f6('0x1f')]({'where':{'type':_0x4acad0,'resourceId':_0x278537['id']}})[_0x66f6('0x1e')](function(){return _0x5e3d2d;});})[_0x66f6('0x1e')](function(){_0x558af0[_0x66f6('0x14')](0xcc)[_0x66f6('0x22')]();});}};}function handleEntityNotFound(_0x495b86,_0x5d708e){return function(_0x2e162f){if(!_0x2e162f){_0x495b86[_0x66f6('0x13')](0x194);}return _0x2e162f;};}function handleError(_0x2f1a0f,_0x73c0ce){_0x73c0ce=_0x73c0ce||0x1f4;return function(_0x297e19){logger['error'](_0x297e19[_0x66f6('0x23')]);if(_0x297e19[_0x66f6('0x24')]){delete _0x297e19[_0x66f6('0x24')];}_0x2f1a0f[_0x66f6('0x14')](_0x73c0ce)[_0x66f6('0x25')](_0x297e19);};}exports[_0x66f6('0x26')]=function(_0x3cb934,_0x482df8){var _0x10c55e={},_0x3cce62={},_0x474b6f={'count':0x0,'rows':[]};var _0x1d30d1=_[_0x66f6('0x27')](db[_0x66f6('0x28')][_0x66f6('0x29')],function(_0x55d1d1){return{'name':_0x55d1d1[_0x66f6('0x2a')],'type':_0x55d1d1['type']['key']};});_0x3cce62[_0x66f6('0x2b')]=_[_0x66f6('0x27')](_0x1d30d1,_0x66f6('0x24'));_0x3cce62[_0x66f6('0x2c')]=_[_0x66f6('0x2d')](_0x3cb934[_0x66f6('0x2c')]);_0x3cce62[_0x66f6('0x2e')]=_['intersection'](_0x3cce62[_0x66f6('0x2b')],_0x3cce62[_0x66f6('0x2c')]);_0x10c55e[_0x66f6('0x2f')]=_['intersection'](_0x3cce62[_0x66f6('0x2b')],qs[_0x66f6('0x30')](_0x3cb934[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x10c55e[_0x66f6('0x2f')]=_0x10c55e['attributes'][_0x66f6('0x31')]?_0x10c55e[_0x66f6('0x2f')]:_0x3cce62[_0x66f6('0x2b')];if(!_0x3cb934['query'][_0x66f6('0x32')](_0x66f6('0x33'))){_0x10c55e[_0x66f6('0x16')]=qs[_0x66f6('0x16')](_0x3cb934[_0x66f6('0x2c')]['limit']);_0x10c55e['offset']=qs[_0x66f6('0x19')](_0x3cb934[_0x66f6('0x2c')][_0x66f6('0x19')]);}_0x10c55e['order']=qs[_0x66f6('0x34')](_0x3cb934['query'][_0x66f6('0x34')]);_0x10c55e[_0x66f6('0x35')]=qs['filters'](_[_0x66f6('0x36')](_0x3cb934['query'],_0x3cce62[_0x66f6('0x2e')]),_0x1d30d1);if(_0x3cb934[_0x66f6('0x2c')][_0x66f6('0x37')]){_0x10c55e[_0x66f6('0x35')]=_[_0x66f6('0x38')](_0x10c55e['where'],{'$or':_[_0x66f6('0x27')](_0x1d30d1,function(_0x1fd5f3){if(_0x1fd5f3[_0x66f6('0x39')]!==_0x66f6('0x3a')){var _0x50190c={};_0x50190c[_0x1fd5f3[_0x66f6('0x24')]]={'$like':'%'+_0x3cb934['query'][_0x66f6('0x37')]+'%'};return _0x50190c;}})});}_0x10c55e=_[_0x66f6('0x38')]({},_0x10c55e,_0x3cb934[_0x66f6('0x3b')]);var _0xac094d={'where':_0x10c55e['where']};return db[_0x66f6('0x28')][_0x66f6('0x18')](_0xac094d)[_0x66f6('0x1e')](function(_0x4b834c){_0x474b6f[_0x66f6('0x18')]=_0x4b834c;if(_0x3cb934['query']['includeAll']){_0x10c55e['include']=[{'all':!![]}];}return db[_0x66f6('0x28')]['findAll'](_0x10c55e);})['then'](function(_0x535fc1){_0x474b6f[_0x66f6('0x3c')]=_0x535fc1;return _0x474b6f;})[_0x66f6('0x1e')](respondWithFilteredResult(_0x482df8,_0x10c55e))[_0x66f6('0x3d')](handleError(_0x482df8,null));};exports['show']=function(_0xfe87b6,_0x216de1){var _0x12f5e1={'raw':![],'where':{'id':_0xfe87b6['params']['id']}},_0x2f67d8={};_0x2f67d8[_0x66f6('0x2b')]=_['keys'](db['Trigger'][_0x66f6('0x29')]);_0x2f67d8[_0x66f6('0x2c')]=_[_0x66f6('0x2d')](_0xfe87b6[_0x66f6('0x2c')]);_0x2f67d8['filters']=_[_0x66f6('0x3e')](_0x2f67d8[_0x66f6('0x2b')],_0x2f67d8[_0x66f6('0x2c')]);_0x12f5e1[_0x66f6('0x2f')]=_[_0x66f6('0x3e')](_0x2f67d8[_0x66f6('0x2b')],qs['fields'](_0xfe87b6[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x12f5e1[_0x66f6('0x2f')]=_0x12f5e1[_0x66f6('0x2f')][_0x66f6('0x31')]?_0x12f5e1[_0x66f6('0x2f')]:_0x2f67d8[_0x66f6('0x2b')];if(_0xfe87b6[_0x66f6('0x2c')][_0x66f6('0x3f')]){_0x12f5e1['include']=[{'all':!![]}];}_0x12f5e1=_[_0x66f6('0x38')]({},_0x12f5e1,_0xfe87b6[_0x66f6('0x3b')]);return db[_0x66f6('0x28')][_0x66f6('0x40')](_0x12f5e1)[_0x66f6('0x1e')](handleEntityNotFound(_0x216de1,null))[_0x66f6('0x1e')](respondWithResult(_0x216de1,null))[_0x66f6('0x3d')](handleError(_0x216de1,null));};exports['create']=function(_0x2eb801,_0x30fa2d){return db[_0x66f6('0x28')][_0x66f6('0x41')](_0x2eb801['body'],{})[_0x66f6('0x1e')](function(_0xb401b9){var _0x3aac4d=_0x2eb801['user'][_0x66f6('0x42')]({'plain':!![]});if(!_0x3aac4d)throw new Error(_0x66f6('0x43'));if(_0x3aac4d[_0x66f6('0x44')]==='user'){var _0x210619=_0xb401b9['get']({'plain':!![]});var _0x3abf5f='Triggers';return db['UserProfileSection'][_0x66f6('0x40')]({'where':{'name':_0x3abf5f,'userProfileId':_0x3aac4d[_0x66f6('0x45')]},'raw':!![]})[_0x66f6('0x1e')](function(_0xecfa5a){if(_0xecfa5a&&_0xecfa5a[_0x66f6('0x46')]===0x0){return db[_0x66f6('0x21')][_0x66f6('0x41')]({'name':_0x210619[_0x66f6('0x24')],'resourceId':_0x210619['id'],'type':_0xecfa5a[_0x66f6('0x24')],'sectionId':_0xecfa5a['id']},{})['then'](function(){return _0xb401b9;});}else{return _0xb401b9;}})[_0x66f6('0x3d')](function(_0x548680){logger[_0x66f6('0x47')](_0x66f6('0x48'),_0x548680);throw _0x548680;});}return _0xb401b9;})[_0x66f6('0x1e')](respondWithResult(_0x30fa2d,0xc9))['catch'](handleError(_0x30fa2d,null));};exports[_0x66f6('0x1d')]=function(_0xe46620,_0x237ad4){if(_0xe46620['body']['id']){delete _0xe46620[_0x66f6('0x49')]['id'];}return db[_0x66f6('0x28')][_0x66f6('0x40')]({'where':{'id':_0xe46620[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x237ad4,null))[_0x66f6('0x1e')](saveUpdates(_0xe46620['body'],null))['then'](respondWithResult(_0x237ad4,null))[_0x66f6('0x3d')](handleError(_0x237ad4,null));};exports[_0x66f6('0x1f')]=function(_0x255931,_0x2d8727){return db['Trigger'][_0x66f6('0x40')]({'where':{'id':_0x255931[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x2d8727,null))[_0x66f6('0x1e')](removeEntity(_0x2d8727,null))[_0x66f6('0x3d')](handleError(_0x2d8727,null));};exports[_0x66f6('0x4b')]=function(_0x4389fe,_0x274484,_0x5154a5){if(_0x4389fe[_0x66f6('0x49')]['id']){delete _0x4389fe[_0x66f6('0x49')]['id'];}return db['Trigger'][_0x66f6('0x40')]({'where':{'id':_0x4389fe[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x274484,null))['then'](function(_0x1bfe4a){if(_0x1bfe4a){_0x4389fe[_0x66f6('0x49')][_0x66f6('0x4c')]=_0x1bfe4a['id'];return db[_0x66f6('0x4d')][_0x66f6('0x41')](_0x4389fe[_0x66f6('0x49')]);}})[_0x66f6('0x1e')](respondWithResult(_0x274484,null))[_0x66f6('0x3d')](handleError(_0x274484,null));};exports[_0x66f6('0x4e')]=function(_0x8e2531,_0x47542a,_0x29dbae){if(_0x8e2531[_0x66f6('0x49')]['id']){delete _0x8e2531[_0x66f6('0x49')]['id'];}return db[_0x66f6('0x28')][_0x66f6('0x40')]({'where':{'id':_0x8e2531[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x47542a,null))[_0x66f6('0x1e')](function(_0x46818f){if(_0x46818f){_0x8e2531[_0x66f6('0x49')]['TriggerAnyId']=_0x46818f['id'];return db[_0x66f6('0x4d')][_0x66f6('0x41')](_0x8e2531[_0x66f6('0x49')]);}})[_0x66f6('0x1e')](respondWithResult(_0x47542a,null))[_0x66f6('0x3d')](handleError(_0x47542a,null));};exports['getAllConditions']=function(_0x824e24,_0x357fb5,_0x4358d5){var _0x41a0ea={};var _0x51bf65={};var _0x310626;var _0x551a8c;return db[_0x66f6('0x28')][_0x66f6('0x4f')]({'where':{'id':_0x824e24[_0x66f6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x357fb5,null))[_0x66f6('0x1e')](function(_0x3cbc1b){if(_0x3cbc1b){_0x310626=_0x3cbc1b;_0x51bf65['model']=_['keys'](db[_0x66f6('0x4d')]['rawAttributes']);_0x51bf65['query']=_[_0x66f6('0x2d')](_0x824e24[_0x66f6('0x2c')]);_0x51bf65[_0x66f6('0x2e')]=_[_0x66f6('0x3e')](_0x51bf65[_0x66f6('0x2b')],_0x51bf65[_0x66f6('0x2c')]);_0x41a0ea[_0x66f6('0x2f')]=_[_0x66f6('0x3e')](_0x51bf65[_0x66f6('0x2b')],qs[_0x66f6('0x30')](_0x824e24[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x41a0ea[_0x66f6('0x2f')]=_0x41a0ea[_0x66f6('0x2f')]['length']?_0x41a0ea[_0x66f6('0x2f')]:_0x51bf65[_0x66f6('0x2b')];_0x41a0ea[_0x66f6('0x50')]=qs['sort'](_0x824e24[_0x66f6('0x2c')][_0x66f6('0x34')]);_0x41a0ea['where']=qs[_0x66f6('0x2e')](_[_0x66f6('0x36')](_0x824e24['query'],_0x51bf65['filters']));if(_0x824e24[_0x66f6('0x2c')][_0x66f6('0x37')]){_0x41a0ea['where']=_[_0x66f6('0x38')](_0x41a0ea[_0x66f6('0x35')],{'$or':_['map'](_0x41a0ea[_0x66f6('0x2f')],function(_0x27a80f){var _0x4a32d5={};_0x4a32d5[_0x27a80f]={'$like':'%'+_0x824e24[_0x66f6('0x2c')][_0x66f6('0x37')]+'%'};return _0x4a32d5;})});}_0x41a0ea=_[_0x66f6('0x38')]({},_0x41a0ea,_0x824e24['options']);return _0x310626[_0x66f6('0x51')](_0x41a0ea);}})['then'](function(_0x4363c2){if(_0x4363c2){_0x551a8c=_0x4363c2[_0x66f6('0x31')];if(!_0x824e24[_0x66f6('0x2c')][_0x66f6('0x32')](_0x66f6('0x33'))){_0x41a0ea[_0x66f6('0x16')]=qs['limit'](_0x824e24['query'][_0x66f6('0x16')]);_0x41a0ea[_0x66f6('0x19')]=qs['offset'](_0x824e24[_0x66f6('0x2c')][_0x66f6('0x19')]);}return _0x310626[_0x66f6('0x51')](_0x41a0ea);}})[_0x66f6('0x1e')](function(_0x777976){if(_0x777976){return _0x777976?{'count':_0x551a8c,'rows':_0x777976}:null;}})[_0x66f6('0x1e')](respondWithResult(_0x357fb5,null))[_0x66f6('0x3d')](handleError(_0x357fb5,null));};exports[_0x66f6('0x52')]=function(_0x33434f,_0x29f2a4,_0x5430a0){var _0x682b={};var _0x2816fb={};var _0x19903e;var _0x330acf;return db[_0x66f6('0x28')][_0x66f6('0x4f')]({'where':{'id':_0x33434f['params']['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x29f2a4,null))[_0x66f6('0x1e')](function(_0x6d5c51){if(_0x6d5c51){_0x19903e=_0x6d5c51;_0x2816fb[_0x66f6('0x2b')]=_[_0x66f6('0x2d')](db[_0x66f6('0x4d')][_0x66f6('0x29')]);_0x2816fb[_0x66f6('0x2c')]=_[_0x66f6('0x2d')](_0x33434f['query']);_0x2816fb[_0x66f6('0x2e')]=_['intersection'](_0x2816fb[_0x66f6('0x2b')],_0x2816fb[_0x66f6('0x2c')]);_0x682b[_0x66f6('0x2f')]=_['intersection'](_0x2816fb[_0x66f6('0x2b')],qs['fields'](_0x33434f[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x682b[_0x66f6('0x2f')]=_0x682b['attributes'][_0x66f6('0x31')]?_0x682b['attributes']:_0x2816fb['model'];_0x682b[_0x66f6('0x50')]=qs['sort'](_0x33434f['query'][_0x66f6('0x34')]);_0x682b['where']=qs[_0x66f6('0x2e')](_[_0x66f6('0x36')](_0x33434f[_0x66f6('0x2c')],_0x2816fb[_0x66f6('0x2e')]));if(_0x33434f['query'][_0x66f6('0x37')]){_0x682b[_0x66f6('0x35')]=_[_0x66f6('0x38')](_0x682b[_0x66f6('0x35')],{'$or':_[_0x66f6('0x27')](_0x682b[_0x66f6('0x2f')],function(_0x16b672){var _0x40d8ad={};_0x40d8ad[_0x16b672]={'$like':'%'+_0x33434f[_0x66f6('0x2c')][_0x66f6('0x37')]+'%'};return _0x40d8ad;})});}_0x682b=_[_0x66f6('0x38')]({},_0x682b,_0x33434f[_0x66f6('0x3b')]);return _0x19903e[_0x66f6('0x52')](_0x682b);}})['then'](function(_0x17a865){if(_0x17a865){_0x330acf=_0x17a865[_0x66f6('0x31')];if(!_0x33434f['query'][_0x66f6('0x32')](_0x66f6('0x33'))){_0x682b[_0x66f6('0x16')]=qs[_0x66f6('0x16')](_0x33434f[_0x66f6('0x2c')][_0x66f6('0x16')]);_0x682b[_0x66f6('0x19')]=qs[_0x66f6('0x19')](_0x33434f[_0x66f6('0x2c')]['offset']);}return _0x19903e[_0x66f6('0x52')](_0x682b);}})['then'](function(_0x288ea9){if(_0x288ea9){return _0x288ea9?{'count':_0x330acf,'rows':_0x288ea9}:null;}})[_0x66f6('0x1e')](respondWithResult(_0x29f2a4,null))[_0x66f6('0x3d')](handleError(_0x29f2a4,null));};exports[_0x66f6('0x53')]=function(_0x1acf8c,_0x12d287,_0x21293a){if(_0x1acf8c[_0x66f6('0x49')]['id']){delete _0x1acf8c[_0x66f6('0x49')]['id'];}return db[_0x66f6('0x28')]['find']({'where':{'id':_0x1acf8c[_0x66f6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12d287,null))['then'](function(_0x3aa824){if(_0x3aa824){_0x1acf8c[_0x66f6('0x49')][_0x66f6('0x54')]=_0x3aa824['id'];return db[_0x66f6('0x55')][_0x66f6('0x41')](_0x1acf8c[_0x66f6('0x49')]);}})['then'](respondWithResult(_0x12d287,null))[_0x66f6('0x3d')](handleError(_0x12d287,null));};exports['getActions']=function(_0x440ebf,_0x4ff62d,_0x50291b){var _0x3c204c={};var _0x24afa5={};var _0x54a23f;var _0x47df13;return db[_0x66f6('0x28')][_0x66f6('0x4f')]({'where':{'id':_0x440ebf[_0x66f6('0x4a')]['id']}})[_0x66f6('0x1e')](handleEntityNotFound(_0x4ff62d,null))[_0x66f6('0x1e')](function(_0x5ccddf){if(_0x5ccddf){_0x54a23f=_0x5ccddf;_0x24afa5[_0x66f6('0x2b')]=_[_0x66f6('0x2d')](db[_0x66f6('0x55')]['rawAttributes']);_0x24afa5[_0x66f6('0x2c')]=_['keys'](_0x440ebf[_0x66f6('0x2c')]);_0x24afa5[_0x66f6('0x2e')]=_[_0x66f6('0x3e')](_0x24afa5[_0x66f6('0x2b')],_0x24afa5[_0x66f6('0x2c')]);_0x3c204c[_0x66f6('0x2f')]=_[_0x66f6('0x3e')](_0x24afa5[_0x66f6('0x2b')],qs['fields'](_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x30')]));_0x3c204c[_0x66f6('0x2f')]=_0x3c204c[_0x66f6('0x2f')][_0x66f6('0x31')]?_0x3c204c[_0x66f6('0x2f')]:_0x24afa5[_0x66f6('0x2b')];_0x3c204c[_0x66f6('0x50')]=qs[_0x66f6('0x34')](_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x34')]);_0x3c204c['where']=qs['filters'](_[_0x66f6('0x36')](_0x440ebf[_0x66f6('0x2c')],_0x24afa5['filters']));if(_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x37')]){_0x3c204c[_0x66f6('0x35')]=_['merge'](_0x3c204c[_0x66f6('0x35')],{'$or':_[_0x66f6('0x27')](_0x3c204c[_0x66f6('0x2f')],function(_0x256d75){var _0x2fec28={};_0x2fec28[_0x256d75]={'$like':'%'+_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x37')]+'%'};return _0x2fec28;})});}_0x3c204c=_[_0x66f6('0x38')]({},_0x3c204c,_0x440ebf[_0x66f6('0x3b')]);return _0x54a23f[_0x66f6('0x56')](_0x3c204c);}})[_0x66f6('0x1e')](function(_0x4625c4){if(_0x4625c4){_0x47df13=_0x4625c4[_0x66f6('0x31')];if(!_0x440ebf[_0x66f6('0x2c')]['hasOwnProperty']('nolimit')){_0x3c204c['limit']=qs['limit'](_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x16')]);_0x3c204c['offset']=qs['offset'](_0x440ebf[_0x66f6('0x2c')][_0x66f6('0x19')]);}return _0x54a23f[_0x66f6('0x56')](_0x3c204c);}})[_0x66f6('0x1e')](function(_0x5adb48){if(_0x5adb48){return _0x5adb48?{'count':_0x47df13,'rows':_0x5adb48}:null;}})[_0x66f6('0x1e')](respondWithResult(_0x4ff62d,null))['catch'](handleError(_0x4ff62d,null));}; \ No newline at end of file +var _0x3764=['fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Triggers','UserProfileResource','error','stack','name','Trigger','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','TriggerAllId','Condition','TriggerAnyId','findOne','order','pick','getAllConditions','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4aee90,_0x35faaa){var _0x4fd2ea=function(_0x1617cd){while(--_0x1617cd){_0x4aee90['push'](_0x4aee90['shift']());}};_0x4fd2ea(++_0x35faaa);}(_0x3764,0x116));var _0x4376=function(_0x100497,_0x1aa6a2){_0x100497=_0x100497-0x0;var _0x10f131=_0x3764[_0x100497];return _0x10f131;};'use strict';var emlformat=require(_0x4376('0x0'));var rimraf=require(_0x4376('0x1'));var zipdir=require(_0x4376('0x2'));var jsonpatch=require(_0x4376('0x3'));var rp=require(_0x4376('0x4'));var moment=require(_0x4376('0x5'));var BPromise=require(_0x4376('0x6'));var Mustache=require(_0x4376('0x7'));var util=require(_0x4376('0x8'));var path=require(_0x4376('0x9'));var sox=require(_0x4376('0xa'));var csv=require(_0x4376('0xb'));var ejs=require(_0x4376('0xc'));var fs=require('fs');var fs_extra=require(_0x4376('0xd'));var _=require(_0x4376('0xe'));var squel=require(_0x4376('0xf'));var crypto=require(_0x4376('0x10'));var jsforce=require(_0x4376('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4376('0x12'));var Papa=require('papaparse');var Redis=require(_0x4376('0x13'));var authService=require(_0x4376('0x14'));var qs=require(_0x4376('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4376('0x16'))(_0x4376('0x17'));var utils=require(_0x4376('0x18'));var config=require(_0x4376('0x19'));var licenseUtil=require(_0x4376('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26eb57,_0x131510){_0x131510=_0x131510||0xcc;return function(_0x235425){if(_0x235425){return _0x26eb57[_0x4376('0x1b')](_0x131510);}return _0x26eb57[_0x4376('0x1c')](_0x131510)[_0x4376('0x1d')]();};}function respondWithResult(_0x3524dc,_0x51fa80){_0x51fa80=_0x51fa80||0xc8;return function(_0x36c204){if(_0x36c204){return _0x3524dc[_0x4376('0x1c')](_0x51fa80)[_0x4376('0x1e')](_0x36c204);}};}function respondWithFilteredResult(_0x53223e,_0x2959bf){return function(_0x45c20c){if(_0x45c20c){var _0x4ce40f=typeof _0x2959bf[_0x4376('0x1f')]==='undefined'&&typeof _0x2959bf[_0x4376('0x20')]===_0x4376('0x21');var _0x49f79f=_0x45c20c[_0x4376('0x22')];var _0x998786=_0x4ce40f?0x0:_0x2959bf[_0x4376('0x1f')];var _0x383d37=_0x4ce40f?_0x45c20c[_0x4376('0x22')]:_0x2959bf[_0x4376('0x1f')]+_0x2959bf[_0x4376('0x20')];var _0x18b7ae;if(_0x383d37>=_0x49f79f){_0x383d37=_0x49f79f;_0x18b7ae=0xc8;}else{_0x18b7ae=0xce;}_0x53223e[_0x4376('0x1c')](_0x18b7ae);return _0x53223e[_0x4376('0x23')](_0x4376('0x24'),_0x998786+'-'+_0x383d37+'/'+_0x49f79f)[_0x4376('0x1e')](_0x45c20c);}return null;};}function patchUpdates(_0x1738c1){return function(_0x1a822d){try{jsonpatch[_0x4376('0x25')](_0x1a822d,_0x1738c1,!![]);}catch(_0x50a469){return BPromise[_0x4376('0x26')](_0x50a469);}return _0x1a822d[_0x4376('0x27')]();};}function saveUpdates(_0x24d539,_0xb1bf4){return function(_0x504c31){if(_0x504c31){return _0x504c31['update'](_0x24d539)[_0x4376('0x28')](function(_0x2203a7){return _0x2203a7;});}return null;};}function removeEntity(_0x1baebb,_0x2ec687){return function(_0x14df68){if(_0x14df68){return _0x14df68[_0x4376('0x29')]()['then'](function(){var _0x418147=_0x14df68['get']({'plain':!![]});var _0x33a75f=_0x4376('0x2a');return db[_0x4376('0x2b')]['destroy']({'where':{'type':_0x33a75f,'resourceId':_0x418147['id']}})[_0x4376('0x28')](function(){return _0x14df68;});})[_0x4376('0x28')](function(){_0x1baebb['status'](0xcc)[_0x4376('0x1d')]();});}};}function handleEntityNotFound(_0x456df2,_0x4e8eed){return function(_0x5c4d5b){if(!_0x5c4d5b){_0x456df2[_0x4376('0x1b')](0x194);}return _0x5c4d5b;};}function handleError(_0x59ce09,_0x469c0e){_0x469c0e=_0x469c0e||0x1f4;return function(_0x1bdbff){logger[_0x4376('0x2c')](_0x1bdbff[_0x4376('0x2d')]);if(_0x1bdbff[_0x4376('0x2e')]){delete _0x1bdbff['name'];}_0x59ce09['status'](_0x469c0e)['send'](_0x1bdbff);};}exports['index']=function(_0x24cc43,_0x3af4b6){var _0x43ada5={},_0x9d33c6={},_0x10b15a={'count':0x0,'rows':[]};var _0x4e40a9=_['map'](db[_0x4376('0x2f')][_0x4376('0x30')],function(_0x13a583){return{'name':_0x13a583['fieldName'],'type':_0x13a583['type'][_0x4376('0x31')]};});_0x9d33c6['model']=_['map'](_0x4e40a9,_0x4376('0x2e'));_0x9d33c6['query']=_['keys'](_0x24cc43[_0x4376('0x32')]);_0x9d33c6[_0x4376('0x33')]=_[_0x4376('0x34')](_0x9d33c6[_0x4376('0x35')],_0x9d33c6[_0x4376('0x32')]);_0x43ada5['attributes']=_[_0x4376('0x34')](_0x9d33c6[_0x4376('0x35')],qs[_0x4376('0x36')](_0x24cc43[_0x4376('0x32')][_0x4376('0x36')]));_0x43ada5[_0x4376('0x37')]=_0x43ada5['attributes'][_0x4376('0x38')]?_0x43ada5[_0x4376('0x37')]:_0x9d33c6['model'];if(!_0x24cc43['query'][_0x4376('0x39')]('nolimit')){_0x43ada5[_0x4376('0x20')]=qs['limit'](_0x24cc43[_0x4376('0x32')][_0x4376('0x20')]);_0x43ada5[_0x4376('0x1f')]=qs[_0x4376('0x1f')](_0x24cc43[_0x4376('0x32')]['offset']);}_0x43ada5['order']=qs[_0x4376('0x3a')](_0x24cc43[_0x4376('0x32')][_0x4376('0x3a')]);_0x43ada5[_0x4376('0x3b')]=qs['filters'](_['pick'](_0x24cc43['query'],_0x9d33c6[_0x4376('0x33')]),_0x4e40a9);if(_0x24cc43[_0x4376('0x32')][_0x4376('0x3c')]){_0x43ada5[_0x4376('0x3b')]=_[_0x4376('0x3d')](_0x43ada5['where'],{'$or':_[_0x4376('0x3e')](_0x4e40a9,function(_0x1e111b){if(_0x1e111b[_0x4376('0x3f')]!==_0x4376('0x40')){var _0x56ca09={};_0x56ca09[_0x1e111b[_0x4376('0x2e')]]={'$like':'%'+_0x24cc43[_0x4376('0x32')]['filter']+'%'};return _0x56ca09;}})});}_0x43ada5=_[_0x4376('0x3d')]({},_0x43ada5,_0x24cc43['options']);var _0xc7df19={'where':_0x43ada5[_0x4376('0x3b')]};return db[_0x4376('0x2f')]['count'](_0xc7df19)[_0x4376('0x28')](function(_0x5c815c){_0x10b15a[_0x4376('0x22')]=_0x5c815c;if(_0x24cc43[_0x4376('0x32')][_0x4376('0x41')]){_0x43ada5[_0x4376('0x42')]=[{'all':!![]}];}return db[_0x4376('0x2f')][_0x4376('0x43')](_0x43ada5);})[_0x4376('0x28')](function(_0x4a8ecf){_0x10b15a[_0x4376('0x44')]=_0x4a8ecf;return _0x10b15a;})[_0x4376('0x28')](respondWithFilteredResult(_0x3af4b6,_0x43ada5))[_0x4376('0x45')](handleError(_0x3af4b6,null));};exports[_0x4376('0x46')]=function(_0x55dc9d,_0x2543d2){var _0x380beb={'raw':![],'where':{'id':_0x55dc9d['params']['id']}},_0x4ac2f8={};_0x4ac2f8[_0x4376('0x35')]=_[_0x4376('0x47')](db[_0x4376('0x2f')][_0x4376('0x30')]);_0x4ac2f8[_0x4376('0x32')]=_[_0x4376('0x47')](_0x55dc9d['query']);_0x4ac2f8['filters']=_[_0x4376('0x34')](_0x4ac2f8['model'],_0x4ac2f8[_0x4376('0x32')]);_0x380beb[_0x4376('0x37')]=_[_0x4376('0x34')](_0x4ac2f8[_0x4376('0x35')],qs[_0x4376('0x36')](_0x55dc9d['query']['fields']));_0x380beb[_0x4376('0x37')]=_0x380beb['attributes']['length']?_0x380beb[_0x4376('0x37')]:_0x4ac2f8[_0x4376('0x35')];if(_0x55dc9d[_0x4376('0x32')]['includeAll']){_0x380beb[_0x4376('0x42')]=[{'all':!![]}];}_0x380beb=_[_0x4376('0x3d')]({},_0x380beb,_0x55dc9d[_0x4376('0x48')]);return db['Trigger']['find'](_0x380beb)['then'](handleEntityNotFound(_0x2543d2,null))[_0x4376('0x28')](respondWithResult(_0x2543d2,null))[_0x4376('0x45')](handleError(_0x2543d2,null));};exports[_0x4376('0x49')]=function(_0x13322e,_0x1ec637){return db[_0x4376('0x2f')][_0x4376('0x49')](_0x13322e[_0x4376('0x4a')],{})['then'](function(_0x18d4bc){var _0x501ff2=_0x13322e[_0x4376('0x4b')][_0x4376('0x4c')]({'plain':!![]});if(!_0x501ff2)throw new Error(_0x4376('0x4d'));if(_0x501ff2[_0x4376('0x4e')]==='user'){var _0x260a99=_0x18d4bc[_0x4376('0x4c')]({'plain':!![]});var _0x3905a8=_0x4376('0x2a');return db['UserProfileSection'][_0x4376('0x4f')]({'where':{'name':_0x3905a8,'userProfileId':_0x501ff2['userProfileId']},'raw':!![]})[_0x4376('0x28')](function(_0x4d3231){if(_0x4d3231&&_0x4d3231[_0x4376('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x260a99[_0x4376('0x2e')],'resourceId':_0x260a99['id'],'type':_0x4d3231[_0x4376('0x2e')],'sectionId':_0x4d3231['id']},{})[_0x4376('0x28')](function(){return _0x18d4bc;});}else{return _0x18d4bc;}})[_0x4376('0x45')](function(_0x2c1f9e){logger['error'](_0x4376('0x51'),_0x2c1f9e);throw _0x2c1f9e;});}return _0x18d4bc;})['then'](respondWithResult(_0x1ec637,0xc9))[_0x4376('0x45')](handleError(_0x1ec637,null));};exports[_0x4376('0x52')]=function(_0x48bb72,_0x3dbf2b){if(_0x48bb72[_0x4376('0x4a')]['id']){delete _0x48bb72[_0x4376('0x4a')]['id'];}return db[_0x4376('0x2f')][_0x4376('0x4f')]({'where':{'id':_0x48bb72[_0x4376('0x53')]['id']}})[_0x4376('0x28')](handleEntityNotFound(_0x3dbf2b,null))['then'](saveUpdates(_0x48bb72[_0x4376('0x4a')],null))['then'](respondWithResult(_0x3dbf2b,null))['catch'](handleError(_0x3dbf2b,null));};exports[_0x4376('0x29')]=function(_0x4e7e5c,_0x630a20){return db[_0x4376('0x2f')][_0x4376('0x4f')]({'where':{'id':_0x4e7e5c[_0x4376('0x53')]['id']}})['then'](handleEntityNotFound(_0x630a20,null))[_0x4376('0x28')](removeEntity(_0x630a20,null))[_0x4376('0x45')](handleError(_0x630a20,null));};exports['addAllCondition']=function(_0x1b7e56,_0x296447,_0x533434){if(_0x1b7e56[_0x4376('0x4a')]['id']){delete _0x1b7e56[_0x4376('0x4a')]['id'];}return db[_0x4376('0x2f')]['find']({'where':{'id':_0x1b7e56[_0x4376('0x53')]['id']}})[_0x4376('0x28')](handleEntityNotFound(_0x296447,null))[_0x4376('0x28')](function(_0x164997){if(_0x164997){_0x1b7e56[_0x4376('0x4a')][_0x4376('0x54')]=_0x164997['id'];return db[_0x4376('0x55')][_0x4376('0x49')](_0x1b7e56['body']);}})[_0x4376('0x28')](respondWithResult(_0x296447,null))['catch'](handleError(_0x296447,null));};exports['addAnyCondition']=function(_0x3eeafa,_0x5eb855,_0x599799){if(_0x3eeafa[_0x4376('0x4a')]['id']){delete _0x3eeafa[_0x4376('0x4a')]['id'];}return db[_0x4376('0x2f')][_0x4376('0x4f')]({'where':{'id':_0x3eeafa[_0x4376('0x53')]['id']}})['then'](handleEntityNotFound(_0x5eb855,null))[_0x4376('0x28')](function(_0x482d8c){if(_0x482d8c){_0x3eeafa['body'][_0x4376('0x56')]=_0x482d8c['id'];return db[_0x4376('0x55')][_0x4376('0x49')](_0x3eeafa[_0x4376('0x4a')]);}})['then'](respondWithResult(_0x5eb855,null))[_0x4376('0x45')](handleError(_0x5eb855,null));};exports['getAllConditions']=function(_0x4c4f84,_0x23b9cf,_0x4ec6e8){var _0x138a89={};var _0x1343c9={};var _0x14842d;var _0x35d8a7;return db[_0x4376('0x2f')][_0x4376('0x57')]({'where':{'id':_0x4c4f84[_0x4376('0x53')]['id']}})[_0x4376('0x28')](handleEntityNotFound(_0x23b9cf,null))[_0x4376('0x28')](function(_0x21afbf){if(_0x21afbf){_0x14842d=_0x21afbf;_0x1343c9[_0x4376('0x35')]=_['keys'](db['Condition'][_0x4376('0x30')]);_0x1343c9[_0x4376('0x32')]=_[_0x4376('0x47')](_0x4c4f84['query']);_0x1343c9['filters']=_[_0x4376('0x34')](_0x1343c9[_0x4376('0x35')],_0x1343c9[_0x4376('0x32')]);_0x138a89[_0x4376('0x37')]=_['intersection'](_0x1343c9['model'],qs[_0x4376('0x36')](_0x4c4f84[_0x4376('0x32')]['fields']));_0x138a89[_0x4376('0x37')]=_0x138a89['attributes'][_0x4376('0x38')]?_0x138a89[_0x4376('0x37')]:_0x1343c9[_0x4376('0x35')];_0x138a89[_0x4376('0x58')]=qs[_0x4376('0x3a')](_0x4c4f84[_0x4376('0x32')][_0x4376('0x3a')]);_0x138a89[_0x4376('0x3b')]=qs[_0x4376('0x33')](_[_0x4376('0x59')](_0x4c4f84[_0x4376('0x32')],_0x1343c9[_0x4376('0x33')]));if(_0x4c4f84[_0x4376('0x32')]['filter']){_0x138a89[_0x4376('0x3b')]=_[_0x4376('0x3d')](_0x138a89[_0x4376('0x3b')],{'$or':_[_0x4376('0x3e')](_0x138a89[_0x4376('0x37')],function(_0x1c85ea){var _0x393853={};_0x393853[_0x1c85ea]={'$like':'%'+_0x4c4f84[_0x4376('0x32')]['filter']+'%'};return _0x393853;})});}_0x138a89=_[_0x4376('0x3d')]({},_0x138a89,_0x4c4f84[_0x4376('0x48')]);return _0x14842d[_0x4376('0x5a')](_0x138a89);}})[_0x4376('0x28')](function(_0x2c6d7e){if(_0x2c6d7e){_0x35d8a7=_0x2c6d7e[_0x4376('0x38')];if(!_0x4c4f84[_0x4376('0x32')][_0x4376('0x39')](_0x4376('0x5b'))){_0x138a89[_0x4376('0x20')]=qs['limit'](_0x4c4f84['query']['limit']);_0x138a89[_0x4376('0x1f')]=qs['offset'](_0x4c4f84[_0x4376('0x32')]['offset']);}return _0x14842d[_0x4376('0x5a')](_0x138a89);}})[_0x4376('0x28')](function(_0x30cd67){if(_0x30cd67){return _0x30cd67?{'count':_0x35d8a7,'rows':_0x30cd67}:null;}})[_0x4376('0x28')](respondWithResult(_0x23b9cf,null))[_0x4376('0x45')](handleError(_0x23b9cf,null));};exports[_0x4376('0x5c')]=function(_0x52038a,_0x52847b,_0x2703ce){var _0xfc36e={};var _0x258fa9={};var _0x2a5ffc;var _0x575435;return db['Trigger'][_0x4376('0x57')]({'where':{'id':_0x52038a[_0x4376('0x53')]['id']}})['then'](handleEntityNotFound(_0x52847b,null))[_0x4376('0x28')](function(_0x113cc8){if(_0x113cc8){_0x2a5ffc=_0x113cc8;_0x258fa9[_0x4376('0x35')]=_['keys'](db['Condition']['rawAttributes']);_0x258fa9[_0x4376('0x32')]=_[_0x4376('0x47')](_0x52038a[_0x4376('0x32')]);_0x258fa9[_0x4376('0x33')]=_[_0x4376('0x34')](_0x258fa9['model'],_0x258fa9[_0x4376('0x32')]);_0xfc36e[_0x4376('0x37')]=_[_0x4376('0x34')](_0x258fa9['model'],qs['fields'](_0x52038a[_0x4376('0x32')][_0x4376('0x36')]));_0xfc36e[_0x4376('0x37')]=_0xfc36e['attributes'][_0x4376('0x38')]?_0xfc36e['attributes']:_0x258fa9['model'];_0xfc36e[_0x4376('0x58')]=qs[_0x4376('0x3a')](_0x52038a[_0x4376('0x32')][_0x4376('0x3a')]);_0xfc36e[_0x4376('0x3b')]=qs[_0x4376('0x33')](_['pick'](_0x52038a['query'],_0x258fa9[_0x4376('0x33')]));if(_0x52038a[_0x4376('0x32')][_0x4376('0x3c')]){_0xfc36e['where']=_[_0x4376('0x3d')](_0xfc36e[_0x4376('0x3b')],{'$or':_[_0x4376('0x3e')](_0xfc36e[_0x4376('0x37')],function(_0x144d6f){var _0x22afdd={};_0x22afdd[_0x144d6f]={'$like':'%'+_0x52038a[_0x4376('0x32')][_0x4376('0x3c')]+'%'};return _0x22afdd;})});}_0xfc36e=_[_0x4376('0x3d')]({},_0xfc36e,_0x52038a[_0x4376('0x48')]);return _0x2a5ffc[_0x4376('0x5c')](_0xfc36e);}})['then'](function(_0xb71ed0){if(_0xb71ed0){_0x575435=_0xb71ed0['length'];if(!_0x52038a[_0x4376('0x32')][_0x4376('0x39')](_0x4376('0x5b'))){_0xfc36e[_0x4376('0x20')]=qs[_0x4376('0x20')](_0x52038a[_0x4376('0x32')][_0x4376('0x20')]);_0xfc36e[_0x4376('0x1f')]=qs[_0x4376('0x1f')](_0x52038a[_0x4376('0x32')]['offset']);}return _0x2a5ffc['getAnyConditions'](_0xfc36e);}})[_0x4376('0x28')](function(_0x4e0564){if(_0x4e0564){return _0x4e0564?{'count':_0x575435,'rows':_0x4e0564}:null;}})[_0x4376('0x28')](respondWithResult(_0x52847b,null))[_0x4376('0x45')](handleError(_0x52847b,null));};exports[_0x4376('0x5d')]=function(_0x4f7793,_0x19bf32,_0x885af0){if(_0x4f7793[_0x4376('0x4a')]['id']){delete _0x4f7793['body']['id'];}return db[_0x4376('0x2f')][_0x4376('0x4f')]({'where':{'id':_0x4f7793[_0x4376('0x53')]['id']}})['then'](handleEntityNotFound(_0x19bf32,null))[_0x4376('0x28')](function(_0x2aa272){if(_0x2aa272){_0x4f7793[_0x4376('0x4a')][_0x4376('0x5e')]=_0x2aa272['id'];return db[_0x4376('0x5f')]['create'](_0x4f7793[_0x4376('0x4a')]);}})['then'](respondWithResult(_0x19bf32,null))['catch'](handleError(_0x19bf32,null));};exports[_0x4376('0x60')]=function(_0x1e2d6e,_0x2798d1,_0x2382af){var _0x390d41={};var _0x4c33d5={};var _0x373e43;var _0x376fac;return db[_0x4376('0x2f')][_0x4376('0x57')]({'where':{'id':_0x1e2d6e[_0x4376('0x53')]['id']}})[_0x4376('0x28')](handleEntityNotFound(_0x2798d1,null))['then'](function(_0x4ca91e){if(_0x4ca91e){_0x373e43=_0x4ca91e;_0x4c33d5[_0x4376('0x35')]=_[_0x4376('0x47')](db[_0x4376('0x5f')][_0x4376('0x30')]);_0x4c33d5[_0x4376('0x32')]=_[_0x4376('0x47')](_0x1e2d6e[_0x4376('0x32')]);_0x4c33d5[_0x4376('0x33')]=_[_0x4376('0x34')](_0x4c33d5['model'],_0x4c33d5[_0x4376('0x32')]);_0x390d41[_0x4376('0x37')]=_[_0x4376('0x34')](_0x4c33d5['model'],qs[_0x4376('0x36')](_0x1e2d6e[_0x4376('0x32')]['fields']));_0x390d41[_0x4376('0x37')]=_0x390d41[_0x4376('0x37')][_0x4376('0x38')]?_0x390d41['attributes']:_0x4c33d5['model'];_0x390d41[_0x4376('0x58')]=qs[_0x4376('0x3a')](_0x1e2d6e[_0x4376('0x32')][_0x4376('0x3a')]);_0x390d41[_0x4376('0x3b')]=qs[_0x4376('0x33')](_[_0x4376('0x59')](_0x1e2d6e[_0x4376('0x32')],_0x4c33d5['filters']));if(_0x1e2d6e[_0x4376('0x32')][_0x4376('0x3c')]){_0x390d41[_0x4376('0x3b')]=_[_0x4376('0x3d')](_0x390d41[_0x4376('0x3b')],{'$or':_[_0x4376('0x3e')](_0x390d41[_0x4376('0x37')],function(_0x6991b2){var _0x1b9c75={};_0x1b9c75[_0x6991b2]={'$like':'%'+_0x1e2d6e[_0x4376('0x32')][_0x4376('0x3c')]+'%'};return _0x1b9c75;})});}_0x390d41=_['merge']({},_0x390d41,_0x1e2d6e[_0x4376('0x48')]);return _0x373e43['getActions'](_0x390d41);}})[_0x4376('0x28')](function(_0x458567){if(_0x458567){_0x376fac=_0x458567[_0x4376('0x38')];if(!_0x1e2d6e[_0x4376('0x32')][_0x4376('0x39')](_0x4376('0x5b'))){_0x390d41[_0x4376('0x20')]=qs[_0x4376('0x20')](_0x1e2d6e['query'][_0x4376('0x20')]);_0x390d41[_0x4376('0x1f')]=qs[_0x4376('0x1f')](_0x1e2d6e[_0x4376('0x32')][_0x4376('0x1f')]);}return _0x373e43[_0x4376('0x60')](_0x390d41);}})[_0x4376('0x28')](function(_0x59d8cf){if(_0x59d8cf){return _0x59d8cf?{'count':_0x376fac,'rows':_0x59d8cf}:null;}})['then'](respondWithResult(_0x2798d1,null))[_0x4376('0x45')](handleError(_0x2798d1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 9bf5957..64e1929 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 _0x72a2=['define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x72a2,0x161));var _0x272a=function(_0x1c12e5,_0x1c9271){_0x1c12e5=_0x1c12e5-0x0;var _0x46eb65=_0x72a2[_0x1c12e5];return _0x46eb65;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var logger=require(_0x272a('0x1'))(_0x272a('0x2'));var moment=require(_0x272a('0x3'));var BPromise=require(_0x272a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x272a('0x5'));var rimraf=require('rimraf');var config=require(_0x272a('0x6'));var attributes=require('./trigger.attributes');module['exports']=function(_0x4f628a,_0x2ba5db){return _0x4f628a[_0x272a('0x7')](_0x272a('0x8'),attributes,{'tableName':_0x272a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85d8=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','Trigger','tools_triggers'];(function(_0x42e92c,_0x3886ea){var _0x53a67e=function(_0x2c555d){while(--_0x2c555d){_0x42e92c['push'](_0x42e92c['shift']());}};_0x53a67e(++_0x3886ea);}(_0x85d8,0x1b0));var _0x885d=function(_0x1bee14,_0x3a8307){_0x1bee14=_0x1bee14-0x0;var _0x44ad41=_0x85d8[_0x1bee14];return _0x44ad41;};'use strict';var _=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var logger=require(_0x885d('0x2'))(_0x885d('0x3'));var moment=require(_0x885d('0x4'));var BPromise=require('bluebird');var rp=require(_0x885d('0x5'));var fs=require('fs');var path=require(_0x885d('0x6'));var rimraf=require(_0x885d('0x7'));var config=require(_0x885d('0x8'));var attributes=require('./trigger.attributes');module['exports']=function(_0x186504,_0x30dcc2){return _0x186504[_0x885d('0x9')](_0x885d('0xa'),attributes,{'tableName':_0x885d('0xb'),'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 f5e14ad..6899aa8 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 _0x09a1=['model','then','stringify','ShowTrigger','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x21387e,_0x3c19d1){var _0x1f63d9=function(_0x524d49){while(--_0x524d49){_0x21387e['push'](_0x21387e['shift']());}};_0x1f63d9(++_0x3c19d1);}(_0x09a1,0x101));var _0x109a=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x09a1[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x109a('0x0'));var util=require('util');var moment=require(_0x109a('0x1'));var BPromise=require(_0x109a('0x2'));var rs=require(_0x109a('0x3'));var fs=require('fs');var Redis=require(_0x109a('0x4'));var db=require(_0x109a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x109a('0x6'))(_0x109a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x109a('0x8')][_0x109a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdeaade,_0x247605,_0x579205){return new BPromise(function(_0x40ba03,_0x585379){return client[_0x109a('0xa')](_0xdeaade,_0x579205)['then'](function(_0x26bae3){logger[_0x109a('0xb')]('Trigger,\x20%s,\x20%s',_0x247605,_0x109a('0xc'));logger[_0x109a('0xd')](_0x109a('0xe'),_0x247605,_0x109a('0xc'),JSON['stringify'](_0x26bae3));if(_0x26bae3['error']){if(_0x26bae3[_0x109a('0xf')][_0x109a('0x10')]===0x1f4){logger[_0x109a('0xf')](_0x109a('0x11'),_0x247605,_0x26bae3['error'][_0x109a('0x12')]);return _0x585379(_0x26bae3[_0x109a('0xf')][_0x109a('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x247605,_0x26bae3['error'][_0x109a('0x12')]);return _0x40ba03(_0x26bae3[_0x109a('0xf')][_0x109a('0x12')]);}else{logger['info'](_0x109a('0x11'),_0x247605,_0x109a('0xc'));_0x40ba03(_0x26bae3[_0x109a('0x13')][_0x109a('0x12')]);}})[_0x109a('0x14')](function(_0x58fcbf){logger[_0x109a('0xf')](_0x109a('0x11'),_0x247605,_0x58fcbf);_0x585379(_0x58fcbf);});});}exports[_0x109a('0x15')]=function(_0x4f868d){var _0x1071a0=this;return new Promise(function(_0x1a9849,_0x599225){return db[_0x109a('0x16')][_0x109a('0x17')]({'raw':_0x4f868d['options']?_0x4f868d[_0x109a('0x18')][_0x109a('0x19')]===undefined?!![]:![]:!![],'where':_0x4f868d['options']?_0x4f868d[_0x109a('0x18')][_0x109a('0x1a')]||null:null,'attributes':_0x4f868d[_0x109a('0x18')]?_0x4f868d[_0x109a('0x18')][_0x109a('0x1b')]||null:null,'limit':_0x4f868d[_0x109a('0x18')]?_0x4f868d[_0x109a('0x18')][_0x109a('0x1c')]||null:null,'include':_0x4f868d[_0x109a('0x18')]?_0x4f868d['options'][_0x109a('0x1d')]?_[_0x109a('0x1e')](_0x4f868d[_0x109a('0x18')][_0x109a('0x1d')],function(_0x414415){return{'model':db[_0x414415[_0x109a('0x1f')]],'as':_0x414415['as'],'attributes':_0x414415['attributes'],'include':_0x414415[_0x109a('0x1d')]?_[_0x109a('0x1e')](_0x414415[_0x109a('0x1d')],function(_0x5680c6){return{'model':db[_0x5680c6[_0x109a('0x1f')]],'as':_0x5680c6['as'],'attributes':_0x5680c6[_0x109a('0x1b')],'include':_0x5680c6[_0x109a('0x1d')]?_['map'](_0x5680c6[_0x109a('0x1d')],function(_0x5924a8){return{'model':db[_0x5924a8[_0x109a('0x1f')]],'as':_0x5924a8['as'],'attributes':_0x5924a8[_0x109a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x109a('0x20')](function(_0x1c173f){logger[_0x109a('0xb')](_0x109a('0x15'),_0x4f868d);logger[_0x109a('0xd')](_0x109a('0x15'),_0x4f868d,JSON[_0x109a('0x21')](_0x1c173f));_0x1a9849(_0x1c173f);})[_0x109a('0x14')](function(_0x4869eb){logger['error'](_0x109a('0x15'),_0x4869eb[_0x109a('0x12')],_0x4f868d);_0x599225(_0x1071a0[_0x109a('0xf')](0x1f4,_0x4869eb[_0x109a('0x12')]));});});};exports[_0x109a('0x22')]=function(_0x5893ff){var _0x3f9b96=this;return new Promise(function(_0x5a85ca,_0x31fae2){return db[_0x109a('0x16')][_0x109a('0x23')]({'raw':_0x5893ff['options']?_0x5893ff['options']['raw']===undefined?!![]:![]:!![],'where':_0x5893ff[_0x109a('0x18')]?_0x5893ff['options'][_0x109a('0x1a')]||null:null,'attributes':_0x5893ff[_0x109a('0x18')]?_0x5893ff[_0x109a('0x18')][_0x109a('0x1b')]||null:null,'include':_0x5893ff[_0x109a('0x18')]?_0x5893ff[_0x109a('0x18')][_0x109a('0x1d')]?_[_0x109a('0x1e')](_0x5893ff[_0x109a('0x18')][_0x109a('0x1d')],function(_0xe544f2){return{'model':db[_0xe544f2[_0x109a('0x1f')]],'as':_0xe544f2['as'],'attributes':_0xe544f2[_0x109a('0x1b')],'include':_0xe544f2['include']?_[_0x109a('0x1e')](_0xe544f2[_0x109a('0x1d')],function(_0x4132c6){return{'model':db[_0x4132c6[_0x109a('0x1f')]],'as':_0x4132c6['as'],'attributes':_0x4132c6['attributes'],'include':_0x4132c6['include']?_[_0x109a('0x1e')](_0x4132c6[_0x109a('0x1d')],function(_0x406f6b){return{'model':db[_0x406f6b['model']],'as':_0x406f6b['as'],'attributes':_0x406f6b[_0x109a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b2303){logger[_0x109a('0xb')]('ShowTrigger',_0x5893ff);logger[_0x109a('0xd')]('ShowTrigger',_0x5893ff,JSON['stringify'](_0x2b2303));_0x5a85ca(_0x2b2303);})[_0x109a('0x14')](function(_0x15734c){logger[_0x109a('0xf')](_0x109a('0x22'),_0x15734c[_0x109a('0x12')],_0x5893ff);_0x31fae2(_0x3f9b96[_0x109a('0xf')](0x1f4,_0x15734c['message']));});});}; \ No newline at end of file +var _0x7c45=['then','catch','ShowTrigger','where','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x7c45,0x71));var _0x57c4=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x7c45[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x57c4('0x0'));var util=require(_0x57c4('0x1'));var moment=require(_0x57c4('0x2'));var BPromise=require(_0x57c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57c4('0x4'));var db=require(_0x57c4('0x5'))['db'];var utils=require(_0x57c4('0x6'));var logger=require(_0x57c4('0x7'))(_0x57c4('0x8'));var config=require(_0x57c4('0x9'));var jayson=require(_0x57c4('0xa'));var client=jayson['client'][_0x57c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x81e6b0,_0x3bb3b9,_0x57f50b){return new BPromise(function(_0x1f8091,_0x5378ff){return client[_0x57c4('0xc')](_0x81e6b0,_0x57f50b)['then'](function(_0x641937){logger[_0x57c4('0xd')]('Trigger,\x20%s,\x20%s',_0x3bb3b9,_0x57c4('0xe'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x3bb3b9,'request\x20sent',JSON[_0x57c4('0xf')](_0x641937));if(_0x641937[_0x57c4('0x10')]){if(_0x641937[_0x57c4('0x10')][_0x57c4('0x11')]===0x1f4){logger[_0x57c4('0x10')](_0x57c4('0x12'),_0x3bb3b9,_0x641937[_0x57c4('0x10')][_0x57c4('0x13')]);return _0x5378ff(_0x641937['error'][_0x57c4('0x13')]);}logger[_0x57c4('0x10')](_0x57c4('0x12'),_0x3bb3b9,_0x641937[_0x57c4('0x10')][_0x57c4('0x13')]);return _0x1f8091(_0x641937['error'][_0x57c4('0x13')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x3bb3b9,_0x57c4('0xe'));_0x1f8091(_0x641937[_0x57c4('0x14')][_0x57c4('0x13')]);}})['catch'](function(_0x535939){logger[_0x57c4('0x10')](_0x57c4('0x12'),_0x3bb3b9,_0x535939);_0x5378ff(_0x535939);});});}exports[_0x57c4('0x15')]=function(_0x33e6c1){var _0x53eb82=this;return new Promise(function(_0x5438fc,_0x52cb30){return db[_0x57c4('0x16')][_0x57c4('0x17')]({'raw':_0x33e6c1[_0x57c4('0x18')]?_0x33e6c1[_0x57c4('0x18')][_0x57c4('0x19')]===undefined?!![]:![]:!![],'where':_0x33e6c1[_0x57c4('0x18')]?_0x33e6c1[_0x57c4('0x18')]['where']||null:null,'attributes':_0x33e6c1[_0x57c4('0x18')]?_0x33e6c1[_0x57c4('0x18')][_0x57c4('0x1a')]||null:null,'limit':_0x33e6c1[_0x57c4('0x18')]?_0x33e6c1[_0x57c4('0x18')][_0x57c4('0x1b')]||null:null,'include':_0x33e6c1['options']?_0x33e6c1['options'][_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x33e6c1[_0x57c4('0x18')][_0x57c4('0x1c')],function(_0x4c7ca4){return{'model':db[_0x4c7ca4[_0x57c4('0x1e')]],'as':_0x4c7ca4['as'],'attributes':_0x4c7ca4[_0x57c4('0x1a')],'include':_0x4c7ca4[_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x4c7ca4[_0x57c4('0x1c')],function(_0x43a219){return{'model':db[_0x43a219[_0x57c4('0x1e')]],'as':_0x43a219['as'],'attributes':_0x43a219[_0x57c4('0x1a')],'include':_0x43a219[_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x43a219[_0x57c4('0x1c')],function(_0x1f6a69){return{'model':db[_0x1f6a69['model']],'as':_0x1f6a69['as'],'attributes':_0x1f6a69[_0x57c4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x57c4('0x1f')](function(_0x22b993){logger[_0x57c4('0xd')](_0x57c4('0x15'),_0x33e6c1);logger['debug'](_0x57c4('0x15'),_0x33e6c1,JSON[_0x57c4('0xf')](_0x22b993));_0x5438fc(_0x22b993);})[_0x57c4('0x20')](function(_0x5d335e){logger['error'](_0x57c4('0x15'),_0x5d335e[_0x57c4('0x13')],_0x33e6c1);_0x52cb30(_0x53eb82[_0x57c4('0x10')](0x1f4,_0x5d335e[_0x57c4('0x13')]));});});};exports[_0x57c4('0x21')]=function(_0x353b8d){var _0x27873f=this;return new Promise(function(_0x43bca3,_0x2d0c99){return db['Trigger']['find']({'raw':_0x353b8d[_0x57c4('0x18')]?_0x353b8d['options'][_0x57c4('0x19')]===undefined?!![]:![]:!![],'where':_0x353b8d['options']?_0x353b8d[_0x57c4('0x18')][_0x57c4('0x22')]||null:null,'attributes':_0x353b8d[_0x57c4('0x18')]?_0x353b8d['options'][_0x57c4('0x1a')]||null:null,'include':_0x353b8d[_0x57c4('0x18')]?_0x353b8d[_0x57c4('0x18')][_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x353b8d[_0x57c4('0x18')]['include'],function(_0x46d9c8){return{'model':db[_0x46d9c8[_0x57c4('0x1e')]],'as':_0x46d9c8['as'],'attributes':_0x46d9c8[_0x57c4('0x1a')],'include':_0x46d9c8[_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x46d9c8[_0x57c4('0x1c')],function(_0x12f9a9){return{'model':db[_0x12f9a9[_0x57c4('0x1e')]],'as':_0x12f9a9['as'],'attributes':_0x12f9a9[_0x57c4('0x1a')],'include':_0x12f9a9['include']?_[_0x57c4('0x1d')](_0x12f9a9['include'],function(_0x37c037){return{'model':db[_0x37c037[_0x57c4('0x1e')]],'as':_0x37c037['as'],'attributes':_0x37c037[_0x57c4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfbbf2e){logger['info'](_0x57c4('0x21'),_0x353b8d);logger[_0x57c4('0x23')]('ShowTrigger',_0x353b8d,JSON[_0x57c4('0xf')](_0xfbbf2e));_0x43bca3(_0xfbbf2e);})['catch'](function(_0xbb84cd){logger[_0x57c4('0x10')](_0x57c4('0x21'),_0xbb84cd[_0x57c4('0x13')],_0x353b8d);_0x2d0c99(_0x27873f[_0x57c4('0x10')](0x1f4,_0xbb84cd[_0x57c4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 4883737..4671227 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 _0x41b3=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','create','put','update','destroy','exports'];(function(_0x96845e,_0x4d95c3){var _0x5a1c3e=function(_0x29fc7c){while(--_0x29fc7c){_0x96845e['push'](_0x96845e['shift']());}};_0x5a1c3e(++_0x4d95c3);}(_0x41b3,0x1db));var _0x341b=function(_0x3d82fb,_0x1a84f5){_0x3d82fb=_0x3d82fb-0x0;var _0x29bbb3=_0x41b3[_0x3d82fb];return _0x29bbb3;};'use strict';var multer=require(_0x341b('0x0'));var util=require(_0x341b('0x1'));var path=require(_0x341b('0x2'));var timeout=require(_0x341b('0x3'));var express=require('express');var router=express[_0x341b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x341b('0x5'));var interaction=require(_0x341b('0x6'));var config=require('../../config/environment');var controller=require(_0x341b('0x7'));router[_0x341b('0x8')]('/',auth[_0x341b('0x9')](),controller[_0x341b('0xa')]);router['get'](_0x341b('0xb'),auth[_0x341b('0x9')](),controller[_0x341b('0xc')]);router['post'](_0x341b('0xd'),auth[_0x341b('0x9')](),controller['clone']);router['post']('/',auth[_0x341b('0x9')](),controller[_0x341b('0xe')]);router[_0x341b('0xf')](_0x341b('0xb'),auth[_0x341b('0x9')](),controller[_0x341b('0x10')]);router['delete'](_0x341b('0xb'),auth[_0x341b('0x9')](),controller[_0x341b('0x11')]);module[_0x341b('0x12')]=router; \ No newline at end of file +var _0xa84a=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id/clone','post','create','put','/:id','update','destroy','exports'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xa84a,0x18f));var _0xaa84=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa84a[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0xaa84('0x0'));var util=require(_0xaa84('0x1'));var path=require('path');var timeout=require(_0xaa84('0x2'));var express=require(_0xaa84('0x3'));var router=express[_0xaa84('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaa84('0x5'));var interaction=require(_0xaa84('0x6'));var config=require('../../config/environment');var controller=require(_0xaa84('0x7'));router[_0xaa84('0x8')]('/',auth[_0xaa84('0x9')](),controller[_0xaa84('0xa')]);router[_0xaa84('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post'](_0xaa84('0xb'),auth[_0xaa84('0x9')](),controller['clone']);router[_0xaa84('0xc')]('/',auth['isAuthenticated'](),controller[_0xaa84('0xd')]);router[_0xaa84('0xe')](_0xaa84('0xf'),auth[_0xaa84('0x9')](),controller[_0xaa84('0x10')]);router['delete'](_0xaa84('0xf'),auth[_0xaa84('0x9')](),controller[_0xaa84('0x11')]);module[_0xaa84('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 fb2e8bd..e277fb5 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 _0x944c=['sequelize','name','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','setDataValue','getDataValue','transport','split','rfc2833','info','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','refuse','uas','pai','fingerprint','certificate','active','passive','dynamic'];(function(_0x5248a7,_0x1604da){var _0x1ac3ee=function(_0x7c02b){while(--_0x7c02b){_0x5248a7['push'](_0x5248a7['shift']());}};_0x1ac3ee(++_0x1604da);}(_0x944c,0xe1));var _0xc944=function(_0x38c121,_0x29c927){_0x38c121=_0x38c121-0x0;var _0x21c1f5=_0x944c[_0x38c121];return _0x21c1f5;};'use strict';var Sequelize=require(_0xc944('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc944('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x3'),_0xc944('0x4'),'peer'),'allowNull':![],'defaultValue':_0xc944('0x3')},'context':{'type':Sequelize[_0xc944('0x5')],'allowNull':![],'defaultValue':_0xc944('0x6')},'callingpres':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x7'),_0xc944('0x8'),_0xc944('0x9'),_0xc944('0xa'),_0xc944('0xb'),_0xc944('0xc'),_0xc944('0xd'),_0xc944('0xe'))},'deny':{'type':Sequelize[_0xc944('0x5')]},'permit':{'type':Sequelize[_0xc944('0x5')]},'secret':{'type':Sequelize[_0xc944('0x5')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xc944('0x5')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x57dacb){this[_0xc944('0xf')]('transport',_0x57dacb?_0x57dacb['join'](','):null);},'get':function(){return this[_0xc944('0x10')](_0xc944('0x11'))?this[_0xc944('0x10')](_0xc944('0x11'))[_0xc944('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x13'),_0xc944('0x14'),_0xc944('0x15'),'inband','auto'),'defaultValue':_0xc944('0x13')},'directmedia':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no',_0xc944('0x17'),_0xc944('0x18'),_0xc944('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc944('0x5')]},'directmediadeny':{'type':Sequelize[_0xc944('0x5')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xc944('0x1a'),'set':function(_0x2c89f0){this[_0xc944('0xf')](_0xc944('0x1b'),_0x2c89f0?_0x2c89f0[_0xc944('0x1c')](','):null);},'get':function(){return this[_0xc944('0x10')](_0xc944('0x1b'))?this[_0xc944('0x10')](_0xc944('0x1b'))[_0xc944('0x12')](','):null;},'comment':_0xc944('0x1d')},'callgroup':{'type':Sequelize[_0xc944('0x5')]},'namedcallgroup':{'type':Sequelize[_0xc944('0x5')]},'pickupgroup':{'type':Sequelize[_0xc944('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xc944('0x5')]},'language':{'type':Sequelize[_0xc944('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc944('0x5')],'defaultValue':_0xc944('0x1e')},'allow':{'type':Sequelize[_0xc944('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x18afeb){this['setDataValue']('allow',_0x18afeb?_0x18afeb[_0xc944('0x1c')](';'):_0xc944('0x1f'));},'get':function(){return this[_0xc944('0x10')]('allow')?this[_0xc944('0x10')]('allow')[_0xc944('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'insecure':{'type':Sequelize[_0xc944('0x5')],'defaultValue':_0xc944('0x20'),'set':function(_0x1f3f9d){this[_0xc944('0xf')](_0xc944('0x21'),_0x1f3f9d?_0x1f3f9d[_0xc944('0x1c')](','):null);},'get':function(){return this[_0xc944('0x10')]('insecure')?this[_0xc944('0x10')](_0xc944('0x21'))[_0xc944('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'accountcode':{'type':Sequelize[_0xc944('0x22')](0xb)},'setvar':{'type':Sequelize[_0xc944('0x5')]},'callerid':{'type':Sequelize[_0xc944('0x5')],'defaultValue':_0xc944('0x23')},'amaflags':{'type':Sequelize[_0xc944('0x5')]},'callcounter':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc944('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xc944('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xc944('0x5')]},'videosupport':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no',_0xc944('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no')},'mailbox':{'type':Sequelize[_0xc944('0x5')]},'session_timers':{'type':Sequelize[_0xc944('0x2')]('accept',_0xc944('0x25'),'originate')},'session_expires':{'type':Sequelize[_0xc944('0x22')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc944('0x2')]('uac',_0xc944('0x26')),'defaultValue':_0xc944('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xc944('0x5')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xc944('0x5')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc944('0x22')](0x5)},'qualify':{'type':Sequelize[_0xc944('0x2')]('yes','no'),'defaultValue':_0xc944('0x16')},'keepalive':{'type':Sequelize[_0xc944('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc944('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc944('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc944('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no',_0xc944('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc944('0x5')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xc944('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc944('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xc944('0x5')]},'contactdeny':{'type':Sequelize[_0xc944('0x5')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xc944('0x22')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no')},'force_avp':{'type':Sequelize[_0xc944('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xc944('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no',_0xc944('0x28'),_0xc944('0x29'))},'dtlsrekey':{'type':Sequelize[_0xc944('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc944('0x5')]},'dtlscapath':{'type':Sequelize[_0xc944('0x5')]},'dtlssetup':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x2a'),_0xc944('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc944('0x5')]},'call_limit':{'type':Sequelize[_0xc944('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xc944('0x2')](_0xc944('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xc944('0x5')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc944('0x5')]},'host':{'type':Sequelize[_0xc944('0x5')],'defaultValue':_0xc944('0x2c')},'canreinvite':{'type':Sequelize['ENUM'](_0xc944('0x16'),'no',_0xc944('0x17'),_0xc944('0x18'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc944('0x5')]},'otherFields':{'type':Sequelize[_0xc944('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc944('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x077c=['port,invite','insecure','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','BOOLEAN','sequelize','STRING','name','friend','user','peer','ENUM','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','info','shortinfo','inband','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'];(function(_0x21b11f,_0x3732e6){var _0x351177=function(_0x456f73){while(--_0x456f73){_0x21b11f['push'](_0x21b11f['shift']());}};_0x351177(++_0x3732e6);}(_0x077c,0xd6));var _0xc077=function(_0x571edb,_0x5a648d){_0x571edb=_0x571edb-0x0;var _0x2a682e=_0x077c[_0x571edb];return _0x2a682e;};'use strict';var Sequelize=require(_0xc077('0x0'));module['exports']={'name':{'type':Sequelize[_0xc077('0x1')],'allowNull':![],'unique':_0xc077('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xc077('0x3'),_0xc077('0x4'),_0xc077('0x5')),'allowNull':![],'defaultValue':_0xc077('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc077('0x6')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xc077('0x7'),_0xc077('0x8'),_0xc077('0x9'),_0xc077('0xa'),'PROHIB_FAILED_SCREEN',_0xc077('0xb'))},'deny':{'type':Sequelize[_0xc077('0x1')]},'permit':{'type':Sequelize[_0xc077('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc077('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0xc'),'set':function(_0x28beea){this[_0xc077('0xd')](_0xc077('0xe'),_0x28beea?_0x28beea[_0xc077('0xf')](','):null);},'get':function(){return this[_0xc077('0x10')]('transport')?this[_0xc077('0x10')](_0xc077('0xe'))[_0xc077('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc077('0x6')]('rfc2833',_0xc077('0x12'),_0xc077('0x13'),_0xc077('0x14'),'auto'),'defaultValue':_0xc077('0x15')},'directmedia':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no',_0xc077('0x17'),'update',_0xc077('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc077('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x19'),'set':function(_0x3a6c38){this['setDataValue'](_0xc077('0x1a'),_0x3a6c38?_0x3a6c38[_0xc077('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xc077('0x1a'))?this[_0xc077('0x10')](_0xc077('0x1a'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc077('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc077('0x1')]},'language':{'type':Sequelize[_0xc077('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x1b')},'allow':{'type':Sequelize[_0xc077('0x1')],'allowNull':![],'defaultValue':_0xc077('0x1c'),'set':function(_0x53a770){this['setDataValue']('allow',_0x53a770?_0x53a770[_0xc077('0xf')](';'):_0xc077('0x1c'));},'get':function(){return this[_0xc077('0x10')](_0xc077('0x1d'))?this[_0xc077('0x10')](_0xc077('0x1d'))['split'](';'):null;},'comment':_0xc077('0x1e')},'autoframing':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'insecure':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x1f'),'set':function(_0x26f243){this[_0xc077('0xd')](_0xc077('0x20'),_0x26f243?_0x26f243['join'](','):null);},'get':function(){return this[_0xc077('0x10')](_0xc077('0x20'))?this['getDataValue']('insecure')[_0xc077('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'accountcode':{'type':Sequelize[_0xc077('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x22')},'amaflags':{'type':Sequelize[_0xc077('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xc077('0x1')]},'template':{'type':Sequelize[_0xc077('0x1')]},'videosupport':{'type':Sequelize[_0xc077('0x6')]('yes','no',_0xc077('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc077('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x24'),_0xc077('0x25'),_0xc077('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xc077('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0xc077('0x6')]('uac',_0xc077('0x27')),'defaultValue':_0xc077('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xc077('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xc077('0x1')]},'port':{'type':Sequelize[_0xc077('0x21')](0x5)},'qualify':{'type':Sequelize[_0xc077('0x6')]('yes','no'),'defaultValue':_0xc077('0x16')},'keepalive':{'type':Sequelize[_0xc077('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc077('0x1')]},'rtptimeout':{'type':Sequelize[_0xc077('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc077('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc077('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no',_0xc077('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xc077('0x1')]},'timert1':{'type':Sequelize[_0xc077('0x21')](0xb)},'timerb':{'type':Sequelize[_0xc077('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc077('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0xc077('0x1')]},'contactdeny':{'type':Sequelize[_0xc077('0x1')]},'contactacl':{'type':Sequelize[_0xc077('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xc077('0x1')]},'use_q850_reason':{'type':Sequelize[_0xc077('0x1')]},'maxforwards':{'type':Sequelize[_0xc077('0x21')](0xb)},'encryption':{'type':Sequelize[_0xc077('0x6')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'force_avp':{'type':Sequelize[_0xc077('0x6')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no',_0xc077('0x29'),_0xc077('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xc077('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc077('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xc077('0x1')]},'dtlscafile':{'type':Sequelize[_0xc077('0x1')]},'dtlscapath':{'type':Sequelize[_0xc077('0x1')]},'dtlssetup':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x2b'),_0xc077('0x2c'),_0xc077('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc077('0x1')]},'usereqphone':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc077('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'vmexten':{'type':Sequelize[_0xc077('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xc077('0x1')]},'parkinglot':{'type':Sequelize[_0xc077('0x1')]},'description':{'type':Sequelize[_0xc077('0x1')]},'host':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x2e')},'canreinvite':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no',_0xc077('0x17'),_0xc077('0x2f'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc077('0x1')]},'otherFields':{'type':Sequelize[_0xc077('0x1')]},'active':{'type':Sequelize[_0xc077('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc077('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index b0342a3..9bad492 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 _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x5cb7ac,_0x368be8){var _0x8cfc1b=function(_0x4c9489){while(--_0x4c9489){_0x5cb7ac['push'](_0x5cb7ac['shift']());}};_0x8cfc1b(++_0x368be8);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d4dd8,_0x4bb657){_0x3d4dd8=_0x3d4dd8-0x0;var _0x57f21e=_0xedd9[_0x3d4dd8];return _0x57f21e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x51cadf,_0x43e776){var _0x1e1ed9=function(_0x42675a){while(--_0x42675a){_0x51cadf['push'](_0x51cadf['shift']());}};_0x1e1ed9(++_0x43e776);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x24ca[_0x2e9187];return _0x1fc3a8;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 5ce7c71..409badf 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 _0xe6e1=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','Trunk','tools_trunks'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xe6e1,0x197));var _0x1e6e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe6e1[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x1e6e('0x0'));var util=require('util');var logger=require(_0x1e6e('0x1'))(_0x1e6e('0x2'));var moment=require('moment');var BPromise=require(_0x1e6e('0x3'));var rp=require(_0x1e6e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e6e('0x5'));var config=require(_0x1e6e('0x6'));var attributes=require('./trunk.attributes');module[_0x1e6e('0x7')]=function(_0x4243e4,_0x29a2ed){return _0x4243e4[_0x1e6e('0x8')](_0x1e6e('0x9'),attributes,{'tableName':_0x1e6e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3477=['tools_trunks','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x2b9517,_0x5b9a93){var _0x43f966=function(_0x257f28){while(--_0x257f28){_0x2b9517['push'](_0x2b9517['shift']());}};_0x43f966(++_0x5b9a93);}(_0x3477,0xf8));var _0x7347=function(_0x29a912,_0x232d36){_0x29a912=_0x29a912-0x0;var _0x996902=_0x3477[_0x29a912];return _0x996902;};'use strict';var _=require(_0x7347('0x0'));var util=require(_0x7347('0x1'));var logger=require(_0x7347('0x2'))('api');var moment=require(_0x7347('0x3'));var BPromise=require('bluebird');var rp=require(_0x7347('0x4'));var fs=require('fs');var path=require(_0x7347('0x5'));var rimraf=require(_0x7347('0x6'));var config=require(_0x7347('0x7'));var attributes=require(_0x7347('0x8'));module[_0x7347('0x9')]=function(_0x62173c,_0x4e4d11){return _0x62173c[_0x7347('0xa')](_0x7347('0xb'),attributes,{'tableName':_0x7347('0xc'),'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 89a106d..39c2a3e 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 _0x1f1b=['model','stringify','catch','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','error','code','message','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x223ac5,_0x1ddeb3){var _0x141621=function(_0x27a98a){while(--_0x27a98a){_0x223ac5['push'](_0x223ac5['shift']());}};_0x141621(++_0x1ddeb3);}(_0x1f1b,0x67));var _0xb1f1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1f1b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb1f1('0x0'));var util=require(_0xb1f1('0x1'));var moment=require(_0xb1f1('0x2'));var BPromise=require(_0xb1f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1f1('0x4'));var db=require(_0xb1f1('0x5'))['db'];var utils=require(_0xb1f1('0x6'));var logger=require(_0xb1f1('0x7'))(_0xb1f1('0x8'));var config=require(_0xb1f1('0x9'));var jayson=require(_0xb1f1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10e760,_0x41501c,_0x1881d7){return new BPromise(function(_0x28c351,_0x49b228){return client[_0xb1f1('0xb')](_0x10e760,_0x1881d7)[_0xb1f1('0xc')](function(_0x47d2f1){logger[_0xb1f1('0xd')](_0xb1f1('0xe'),_0x41501c,_0xb1f1('0xf'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x41501c,_0xb1f1('0xf'),JSON['stringify'](_0x47d2f1));if(_0x47d2f1[_0xb1f1('0x10')]){if(_0x47d2f1[_0xb1f1('0x10')][_0xb1f1('0x11')]===0x1f4){logger['error'](_0xb1f1('0xe'),_0x41501c,_0x47d2f1[_0xb1f1('0x10')][_0xb1f1('0x12')]);return _0x49b228(_0x47d2f1[_0xb1f1('0x10')][_0xb1f1('0x12')]);}logger['error'](_0xb1f1('0xe'),_0x41501c,_0x47d2f1['error'][_0xb1f1('0x12')]);return _0x28c351(_0x47d2f1[_0xb1f1('0x10')][_0xb1f1('0x12')]);}else{logger[_0xb1f1('0xd')]('Trunk,\x20%s,\x20%s',_0x41501c,'request\x20sent');_0x28c351(_0x47d2f1['result'][_0xb1f1('0x12')]);}})['catch'](function(_0x2c980c){logger[_0xb1f1('0x10')](_0xb1f1('0xe'),_0x41501c,_0x2c980c);_0x49b228(_0x2c980c);});});}exports[_0xb1f1('0x13')]=function(_0xc6ea94){var _0x5a9a04=this;return new Promise(function(_0x1e4c01,_0x5de714){return db[_0xb1f1('0x14')][_0xb1f1('0x15')]({'raw':_0xc6ea94[_0xb1f1('0x16')]?_0xc6ea94['options'][_0xb1f1('0x17')]===undefined?!![]:![]:!![],'where':_0xc6ea94[_0xb1f1('0x16')]?_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x18')]||null:null,'attributes':_0xc6ea94['options']?_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x19')]||null:null,'limit':_0xc6ea94['options']?_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x1a')]||null:null,'include':_0xc6ea94[_0xb1f1('0x16')]?_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0xc6ea94[_0xb1f1('0x16')][_0xb1f1('0x1b')],function(_0x131ea2){return{'model':db[_0x131ea2[_0xb1f1('0x1d')]],'as':_0x131ea2['as'],'attributes':_0x131ea2[_0xb1f1('0x19')],'include':_0x131ea2[_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x131ea2[_0xb1f1('0x1b')],function(_0x46d050){return{'model':db[_0x46d050['model']],'as':_0x46d050['as'],'attributes':_0x46d050[_0xb1f1('0x19')],'include':_0x46d050[_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x46d050[_0xb1f1('0x1b')],function(_0x2d436e){return{'model':db[_0x2d436e[_0xb1f1('0x1d')]],'as':_0x2d436e['as'],'attributes':_0x2d436e[_0xb1f1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb1f1('0xc')](function(_0x21d31f){logger[_0xb1f1('0xd')](_0xb1f1('0x13'),_0xc6ea94);logger['debug'](_0xb1f1('0x13'),_0xc6ea94,JSON[_0xb1f1('0x1e')](_0x21d31f));_0x1e4c01(_0x21d31f);})[_0xb1f1('0x1f')](function(_0x53429d){logger[_0xb1f1('0x10')](_0xb1f1('0x13'),_0x53429d[_0xb1f1('0x12')],_0xc6ea94);_0x5de714(_0x5a9a04['error'](0x1f4,_0x53429d[_0xb1f1('0x12')]));});});};exports['ShowTrunk']=function(_0x1a0971){var _0x2431c1=this;return new Promise(function(_0x1f2ff4,_0x5729dd){return db[_0xb1f1('0x14')]['find']({'raw':_0x1a0971[_0xb1f1('0x16')]?_0x1a0971[_0xb1f1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1a0971[_0xb1f1('0x16')]?_0x1a0971['options'][_0xb1f1('0x18')]||null:null,'attributes':_0x1a0971[_0xb1f1('0x16')]?_0x1a0971[_0xb1f1('0x16')]['attributes']||null:null,'include':_0x1a0971[_0xb1f1('0x16')]?_0x1a0971['options'][_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x1a0971[_0xb1f1('0x16')][_0xb1f1('0x1b')],function(_0x3f36ff){return{'model':db[_0x3f36ff[_0xb1f1('0x1d')]],'as':_0x3f36ff['as'],'attributes':_0x3f36ff[_0xb1f1('0x19')],'include':_0x3f36ff[_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x3f36ff[_0xb1f1('0x1b')],function(_0x31aa63){return{'model':db[_0x31aa63['model']],'as':_0x31aa63['as'],'attributes':_0x31aa63[_0xb1f1('0x19')],'include':_0x31aa63[_0xb1f1('0x1b')]?_[_0xb1f1('0x1c')](_0x31aa63[_0xb1f1('0x1b')],function(_0x53463f){return{'model':db[_0x53463f[_0xb1f1('0x1d')]],'as':_0x53463f['as'],'attributes':_0x53463f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1f1('0xc')](function(_0x2cb194){logger[_0xb1f1('0xd')]('ShowTrunk',_0x1a0971);logger['debug'](_0xb1f1('0x20'),_0x1a0971,JSON['stringify'](_0x2cb194));_0x1f2ff4(_0x2cb194);})[_0xb1f1('0x1f')](function(_0x46d007){logger[_0xb1f1('0x10')](_0xb1f1('0x20'),_0x46d007[_0xb1f1('0x12')],_0x1a0971);_0x5729dd(_0x2431c1[_0xb1f1('0x10')](0x1f4,_0x46d007[_0xb1f1('0x12')]));});});}; \ No newline at end of file +var _0x0d2a=['GetTrunk','debug','message','ShowTrunk','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x352de7,_0x42d665){var _0x76cff2=function(_0x4e9f7c){while(--_0x4e9f7c){_0x352de7['push'](_0x352de7['shift']());}};_0x76cff2(++_0x42d665);}(_0x0d2a,0x13f));var _0xa0d2=function(_0x57954f,_0xe509ea){_0x57954f=_0x57954f-0x0;var _0x50bd0a=_0x0d2a[_0x57954f];return _0x50bd0a;};'use strict';var _=require(_0xa0d2('0x0'));var util=require(_0xa0d2('0x1'));var moment=require('moment');var BPromise=require(_0xa0d2('0x2'));var rs=require(_0xa0d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0d2('0x4'))['db'];var utils=require(_0xa0d2('0x5'));var logger=require(_0xa0d2('0x6'))(_0xa0d2('0x7'));var config=require(_0xa0d2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa0d2('0x9')][_0xa0d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e45a0,_0x527112,_0xce118e){return new BPromise(function(_0x48594d,_0x31214b){return client['request'](_0x2e45a0,_0xce118e)['then'](function(_0x2b3395){logger[_0xa0d2('0xb')](_0xa0d2('0xc'),_0x527112,'request\x20sent');logger['debug'](_0xa0d2('0xd'),_0x527112,_0xa0d2('0xe'),JSON[_0xa0d2('0xf')](_0x2b3395));if(_0x2b3395['error']){if(_0x2b3395[_0xa0d2('0x10')][_0xa0d2('0x11')]===0x1f4){logger[_0xa0d2('0x10')](_0xa0d2('0xc'),_0x527112,_0x2b3395[_0xa0d2('0x10')]['message']);return _0x31214b(_0x2b3395['error']['message']);}logger[_0xa0d2('0x10')](_0xa0d2('0xc'),_0x527112,_0x2b3395[_0xa0d2('0x10')]['message']);return _0x48594d(_0x2b3395[_0xa0d2('0x10')]['message']);}else{logger[_0xa0d2('0xb')](_0xa0d2('0xc'),_0x527112,_0xa0d2('0xe'));_0x48594d(_0x2b3395[_0xa0d2('0x12')]['message']);}})[_0xa0d2('0x13')](function(_0x13b64e){logger['error'](_0xa0d2('0xc'),_0x527112,_0x13b64e);_0x31214b(_0x13b64e);});});}exports['GetTrunk']=function(_0x599953){var _0x5113bb=this;return new Promise(function(_0x1bab11,_0x1ee48b){return db[_0xa0d2('0x14')][_0xa0d2('0x15')]({'raw':_0x599953[_0xa0d2('0x16')]?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x17')]===undefined?!![]:![]:!![],'where':_0x599953['options']?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x18')]||null:null,'attributes':_0x599953[_0xa0d2('0x16')]?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x19')]||null:null,'limit':_0x599953[_0xa0d2('0x16')]?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x1a')]||null:null,'include':_0x599953[_0xa0d2('0x16')]?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x1b')]?_['map'](_0x599953['options']['include'],function(_0x30f213){return{'model':db[_0x30f213['model']],'as':_0x30f213['as'],'attributes':_0x30f213[_0xa0d2('0x19')],'include':_0x30f213[_0xa0d2('0x1b')]?_['map'](_0x30f213[_0xa0d2('0x1b')],function(_0x4843cc){return{'model':db[_0x4843cc['model']],'as':_0x4843cc['as'],'attributes':_0x4843cc[_0xa0d2('0x19')],'include':_0x4843cc[_0xa0d2('0x1b')]?_[_0xa0d2('0x1c')](_0x4843cc[_0xa0d2('0x1b')],function(_0x136148){return{'model':db[_0x136148[_0xa0d2('0x1d')]],'as':_0x136148['as'],'attributes':_0x136148['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0d2('0x1e')](function(_0x5697ed){logger[_0xa0d2('0xb')](_0xa0d2('0x1f'),_0x599953);logger[_0xa0d2('0x20')]('GetTrunk',_0x599953,JSON[_0xa0d2('0xf')](_0x5697ed));_0x1bab11(_0x5697ed);})['catch'](function(_0xf5681c){logger[_0xa0d2('0x10')](_0xa0d2('0x1f'),_0xf5681c[_0xa0d2('0x21')],_0x599953);_0x1ee48b(_0x5113bb[_0xa0d2('0x10')](0x1f4,_0xf5681c['message']));});});};exports[_0xa0d2('0x22')]=function(_0x6daaeb){var _0x23875f=this;return new Promise(function(_0x227c86,_0x3159fd){return db[_0xa0d2('0x14')]['find']({'raw':_0x6daaeb['options']?_0x6daaeb[_0xa0d2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x6daaeb['options']?_0x6daaeb[_0xa0d2('0x16')][_0xa0d2('0x18')]||null:null,'attributes':_0x6daaeb[_0xa0d2('0x16')]?_0x6daaeb[_0xa0d2('0x16')][_0xa0d2('0x19')]||null:null,'include':_0x6daaeb[_0xa0d2('0x16')]?_0x6daaeb[_0xa0d2('0x16')]['include']?_[_0xa0d2('0x1c')](_0x6daaeb[_0xa0d2('0x16')][_0xa0d2('0x1b')],function(_0x341462){return{'model':db[_0x341462[_0xa0d2('0x1d')]],'as':_0x341462['as'],'attributes':_0x341462[_0xa0d2('0x19')],'include':_0x341462['include']?_['map'](_0x341462[_0xa0d2('0x1b')],function(_0x40886b){return{'model':db[_0x40886b[_0xa0d2('0x1d')]],'as':_0x40886b['as'],'attributes':_0x40886b[_0xa0d2('0x19')],'include':_0x40886b[_0xa0d2('0x1b')]?_[_0xa0d2('0x1c')](_0x40886b['include'],function(_0x38d637){return{'model':db[_0x38d637[_0xa0d2('0x1d')]],'as':_0x38d637['as'],'attributes':_0x38d637[_0xa0d2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa0d2('0x1e')](function(_0xa5d143){logger[_0xa0d2('0xb')](_0xa0d2('0x22'),_0x6daaeb);logger[_0xa0d2('0x20')](_0xa0d2('0x22'),_0x6daaeb,JSON[_0xa0d2('0xf')](_0xa5d143));_0x227c86(_0xa5d143);})['catch'](function(_0x342486){logger['error']('ShowTrunk',_0x342486[_0xa0d2('0x21')],_0x6daaeb);_0x3159fd(_0x23875f['error'](0x1f4,_0x342486['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 1e464c0..b0b06a8 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 _0x4de9=['express','Router','../../components/auth/service','./user-setting.controller','isAuthenticated','update','exports'];(function(_0x209972,_0x29181c){var _0x4e82c6=function(_0x2122c0){while(--_0x2122c0){_0x209972['push'](_0x209972['shift']());}};_0x4e82c6(++_0x29181c);}(_0x4de9,0xe0));var _0x94de=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x4de9[_0xb6e43];return _0x47c40f;};'use strict';var express=require(_0x94de('0x0'));var router=express[_0x94de('0x1')]();var auth=require(_0x94de('0x2'));var controller=require(_0x94de('0x3'));router['put']('/:id',auth[_0x94de('0x4')](),controller[_0x94de('0x5')]);module[_0x94de('0x6')]=router; \ No newline at end of file +var _0x18f3=['update','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0xd8f220,_0x453a11){var _0x4e865f=function(_0x3e37ff){while(--_0x3e37ff){_0xd8f220['push'](_0xd8f220['shift']());}};_0x4e865f(++_0x453a11);}(_0x18f3,0x1cf));var _0x318f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x18f3[_0x122096];return _0x3d1966;};'use strict';var express=require('express');var router=express[_0x318f('0x0')]();var auth=require(_0x318f('0x1'));var controller=require(_0x318f('0x2'));router[_0x318f('0x3')](_0x318f('0x4'),auth[_0x318f('0x5')](),controller[_0x318f('0x6')]);module['exports']=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 e256d98..996b911 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 _0xb0d0=['exports','ENUM','DATE','UserId','error','debug'];(function(_0x51a76b,_0x1358fc){var _0x42ab85=function(_0x1210ce){while(--_0x1210ce){_0x51a76b['push'](_0x51a76b['shift']());}};_0x42ab85(++_0x1358fc);}(_0xb0d0,0x148));var _0x0b0d=function(_0x1ab730,_0x26a5dd){_0x1ab730=_0x1ab730-0x0;var _0x565359=_0xb0d0[_0x1ab730];return _0x565359;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x0b0d('0x0'),'warning','info',_0x0b0d('0x1')];module[_0x0b0d('0x2')]={'clientSideLoggingLevel':{'type':Sequelize[_0x0b0d('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0b0d('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0b0d('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x0b0d('0x5')}}; \ No newline at end of file +var _0x218c=['info','debug','exports','error','BOOLEAN','DATE','INTEGER','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x218c,0xa8));var _0xc218=function(_0x6823e,_0xc66f0e){_0x6823e=_0x6823e-0x0;var _0x5a2be8=_0x218c[_0x6823e];return _0x5a2be8;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0xc218('0x0'),_0xc218('0x1')];module[_0xc218('0x2')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xc218('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xc218('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc218('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xc218('0x6')],'unique':_0xc218('0x7')}}; \ 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 376f972..09906f3 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 _0x8fed=['Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','status','update','then','stack','name','send','user','role','Unauthorized','params'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8fed,0xf5));var _0xd8fe=function(_0xeb8a12,_0x222a56){_0xeb8a12=_0xeb8a12-0x0;var _0x172eae=_0x8fed[_0xeb8a12];return _0x172eae;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0xd8fe('0x0'))(_0xd8fe('0x1'));var config=require(_0xd8fe('0x2'));var db=require(_0xd8fe('0x3'))['db'];var socket=require(_0xd8fe('0x4'))(new Redis(config['redis']));require(_0xd8fe('0x5'))[_0xd8fe('0x6')](socket);config[_0xd8fe('0x7')]=_[_0xd8fe('0x8')](config[_0xd8fe('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x7e3b94,_0x1747b3){_0x1747b3=_0x1747b3||0xc8;return function(_0xa33e22){if(_0xa33e22){return _0x7e3b94[_0xd8fe('0x9')](_0x1747b3)['json'](_0xa33e22);}};}function saveUpdates(_0x1c360b){return function(_0x4b9dc5){if(_0x4b9dc5){return _0x4b9dc5[_0xd8fe('0xa')](_0x1c360b)[_0xd8fe('0xb')](function(_0x369943){return _0x369943;});}return null;};}function handleEntityNotFound(_0x25c7ac){return function(_0x2a4142){if(!_0x2a4142){_0x25c7ac['sendStatus'](0x194);}return _0x2a4142;};}function handleError(_0x2228a4,_0x3be0c7){_0x3be0c7=_0x3be0c7||0x1f4;return function(_0x3f8cab){logger['error'](_0x3f8cab[_0xd8fe('0xc')]);if(_0x3f8cab['name']){delete _0x3f8cab[_0xd8fe('0xd')];}_0x2228a4[_0xd8fe('0x9')](_0x3be0c7)[_0xd8fe('0xe')](_0x3f8cab);};}exports[_0xd8fe('0xa')]=function(_0x1a8960,_0x515cb1){if(_0x1a8960[_0xd8fe('0xf')][_0xd8fe('0x10')]!=='admin')throw new Error(_0xd8fe('0x11'));if(isNaN(Number(_0x1a8960[_0xd8fe('0x12')]['id'])))throw new Error(_0xd8fe('0x13'));return db[_0xd8fe('0x14')][_0xd8fe('0x15')]({'where':{'id':_0x1a8960[_0xd8fe('0x12')]['id']}})[_0xd8fe('0xb')](handleEntityNotFound(_0x515cb1,null))['then'](saveUpdates(_0x1a8960[_0xd8fe('0x16')],null))['then'](respondWithResult(_0x515cb1,null))[_0xd8fe('0x17')](handleError(_0x515cb1,null));}; \ No newline at end of file +var _0x1ddc=['status','send','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','then','catch','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','./user-setting.socket','register','defaults','redis','json','update','sendStatus','error','stack','name'];(function(_0x3a6ee1,_0x4de9fe){var _0xbe4556=function(_0x3ab5d0){while(--_0x3ab5d0){_0x3a6ee1['push'](_0x3a6ee1['shift']());}};_0xbe4556(++_0x4de9fe);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x54a7aa,_0x55d59c){_0x54a7aa=_0x54a7aa-0x0;var _0x43a783=_0x1ddc[_0x54a7aa];return _0x43a783;};'use strict';var _=require('lodash');var Redis=require(_0xc1dd('0x0'));var logger=require(_0xc1dd('0x1'))(_0xc1dd('0x2'));var config=require('../../config/environment');var db=require(_0xc1dd('0x3'))['db'];var socket=require(_0xc1dd('0x4'))(new Redis(config['redis']));require(_0xc1dd('0x5'))[_0xc1dd('0x6')](socket);config['redis']=_[_0xc1dd('0x7')](config[_0xc1dd('0x8')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x3938ff,_0x25c543){_0x25c543=_0x25c543||0xc8;return function(_0x593de5){if(_0x593de5){return _0x3938ff['status'](_0x25c543)[_0xc1dd('0x9')](_0x593de5);}};}function saveUpdates(_0x2bf2bd){return function(_0x17157a){if(_0x17157a){return _0x17157a[_0xc1dd('0xa')](_0x2bf2bd)['then'](function(_0x38b62e){return _0x38b62e;});}return null;};}function handleEntityNotFound(_0x1b4b3f){return function(_0xa720ed){if(!_0xa720ed){_0x1b4b3f[_0xc1dd('0xb')](0x194);}return _0xa720ed;};}function handleError(_0x4f404d,_0xaf56b8){_0xaf56b8=_0xaf56b8||0x1f4;return function(_0x1d28a7){logger[_0xc1dd('0xc')](_0x1d28a7[_0xc1dd('0xd')]);if(_0x1d28a7[_0xc1dd('0xe')]){delete _0x1d28a7[_0xc1dd('0xe')];}_0x4f404d[_0xc1dd('0xf')](_0xaf56b8)[_0xc1dd('0x10')](_0x1d28a7);};}exports[_0xc1dd('0xa')]=function(_0x3882fc,_0x433b64){if(_0x3882fc['user'][_0xc1dd('0x11')]!==_0xc1dd('0x12'))throw new Error(_0xc1dd('0x13'));if(isNaN(Number(_0x3882fc[_0xc1dd('0x14')]['id'])))throw new Error(_0xc1dd('0x15'));return db['UserSetting'][_0xc1dd('0x16')]({'where':{'id':_0x3882fc[_0xc1dd('0x14')]['id']}})[_0xc1dd('0x17')](handleEntityNotFound(_0x433b64,null))[_0xc1dd('0x17')](saveUpdates(_0x3882fc['body'],null))['then'](respondWithResult(_0x433b64,null))[_0xc1dd('0x18')](handleError(_0x433b64,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 cc769fb..dd043d9 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 _0xee98=['update','emit','hook','events','../../mysqldb','UserSetting','save'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xee98,0xc7));var _0x8ee9=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xee98[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require(_0x8ee9('0x0'));var UserSetting=require(_0x8ee9('0x1'))['db'][_0x8ee9('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8ee9('0x3'),'afterUpdate':_0x8ee9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x10af53){return function(_0x40e08b,_0x11e705,_0x190588){UserSettingEvents[_0x8ee9('0x5')](_0x10af53+':'+_0x40e08b['id'],_0x40e08b);UserSettingEvents['emit'](_0x10af53,_0x40e08b);_0x190588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x8ee9('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xdd45=['UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1d9e0a,_0x186cb6){var _0x511957=function(_0x25ab3c){while(--_0x25ab3c){_0x1d9e0a['push'](_0x1d9e0a['shift']());}};_0x511957(++_0x186cb6);}(_0xdd45,0x1f2));var _0x5dd4=function(_0x5a556b,_0x36cbc5){_0x5a556b=_0x5a556b-0x0;var _0x3f88a2=_0xdd45[_0x5a556b];return _0x3f88a2;};'use strict';var EventEmitter=require(_0x5dd4('0x0'));var UserSetting=require(_0x5dd4('0x1'))['db'][_0x5dd4('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x5dd4('0x3')](0x0);var events={'afterCreate':_0x5dd4('0x4'),'afterUpdate':_0x5dd4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5e569f){return function(_0x4e1a0e,_0x3debb8,_0x6ab5dd){UserSettingEvents[_0x5dd4('0x6')](_0x5e569f+':'+_0x4e1a0e['id'],_0x4e1a0e);UserSettingEvents[_0x5dd4('0x6')](_0x5e569f,_0x4e1a0e);_0x6ab5dd(null);};}for(var e in events){if(events[_0x5dd4('0x7')](e)){var event=events[e];UserSetting[_0x5dd4('0x8')](e,emitEvent(event));}}module[_0x5dd4('0x9')]=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 6b0826b..c02c403 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 _0xee5b=['./user-setting.attributes','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4327f1,_0x36ff89){_0x4327f1=_0x4327f1-0x0;var _0x59a98a=_0xee5b[_0x4327f1];return _0x59a98a;};'use strict';var attributes=require(_0xbee5('0x0'));module['exports']=function(_0x7b2344){return _0x7b2344[_0xbee5('0x1')]('UserSetting',attributes,{'tableName':_0xbee5('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b93c2){if(!_0x2b93c2[_0xbee5('0x3')])_0x2b93c2[_0xbee5('0x4')]=null;else if(_0x2b93c2['clientSideLoggingEnabledSince']===null)_0x2b93c2['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x5ff3=['clientSideLoggingEnabledSince','exports','define','user_settings','clientSideLoggingEnabled'];(function(_0x1be098,_0x396596){var _0x37be1a=function(_0x183c39){while(--_0x183c39){_0x1be098['push'](_0x1be098['shift']());}};_0x37be1a(++_0x396596);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1a81b4,_0x4d011a){_0x1a81b4=_0x1a81b4-0x0;var _0x42964e=_0x5ff3[_0x1a81b4];return _0x42964e;};'use strict';var attributes=require('./user-setting.attributes');module[_0x35ff('0x0')]=function(_0x48cbf7){return _0x48cbf7[_0x35ff('0x1')]('UserSetting',attributes,{'tableName':_0x35ff('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bb200){if(!_0x1bb200[_0x35ff('0x3')])_0x1bb200[_0x35ff('0x4')]=null;else if(_0x1bb200['clientSideLoggingEnabledSince']===null)_0x1bb200[_0x35ff('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index f2e9432..65a9d06 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 _0x5f1a=['save','remove','update','emit','user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x24c5c7,_0x5099cc){var _0x1e52b7=function(_0x1a1181){while(--_0x1a1181){_0x24c5c7['push'](_0x24c5c7['shift']());}};_0x1e52b7(++_0x5099cc);}(_0x5f1a,0x95));var _0xa5f1=function(_0x587d32,_0x45a0c5){_0x587d32=_0x587d32-0x0;var _0x5552f8=_0x5f1a[_0x587d32];return _0x5552f8;};'use strict';var UserSettingEvents=require(_0xa5f1('0x0'));var events=[_0xa5f1('0x1'),_0xa5f1('0x2'),_0xa5f1('0x3')];function createListener(_0x3c46ee,_0x2ec6d9){return function(_0x30ea53){_0x2ec6d9[_0xa5f1('0x4')](_0x3c46ee,_0x30ea53);if(_0x3c46ee===_0xa5f1('0x5')){_0x2ec6d9[_0xa5f1('0x4')](_0xa5f1('0x6')+_0x30ea53['UserId'],_0x30ea53);}};}exports[_0xa5f1('0x7')]=function(_0x5b6ad0){for(var _0x214383=0x0,_0x119342=events[_0xa5f1('0x8')];_0x214383<_0x119342;_0x214383++){var _0x45e52d=events[_0x214383];var _0x4ac16a=createListener(_0xa5f1('0x9')+_0x45e52d,_0x5b6ad0);UserSettingEvents['on'](_0x45e52d,_0x4ac16a);}}; \ No newline at end of file +var _0xe57f=['length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x18b2a3,_0x2a639b){var _0x50659f=function(_0x6cb26e){while(--_0x6cb26e){_0x18b2a3['push'](_0x18b2a3['shift']());}};_0x50659f(++_0x2a639b);}(_0xe57f,0x1a6));var _0xfe57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe57f[_0x17d9e3];return _0x14192d;};'use strict';var UserSettingEvents=require(_0xfe57('0x0'));var events=['save',_0xfe57('0x1'),_0xfe57('0x2')];function createListener(_0x482b40,_0x343f85){return function(_0x18c3c4){_0x343f85[_0xfe57('0x3')](_0x482b40,_0x18c3c4);if(_0x482b40===_0xfe57('0x4')){_0x343f85[_0xfe57('0x3')](_0xfe57('0x5')+_0x18c3c4[_0xfe57('0x6')],_0x18c3c4);}};}exports[_0xfe57('0x7')]=function(_0x493552){for(var _0x1b8b07=0x0,_0x1d34ec=events[_0xfe57('0x8')];_0x1b8b07<_0x1d34ec;_0x1b8b07++){var _0x32cda5=events[_0x1b8b07];var _0x3298d8=createListener(_0xfe57('0x9')+_0x32cda5,_0x493552);UserSettingEvents['on'](_0x32cda5,_0x3298d8);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 58403cc..5a3f8d3 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 _0x0eee=['getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','update','/:id/password','changePassword','delete','removeTeams','/:id','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/groups','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts'];(function(_0xfee294,_0x1a19dc){var _0x54f196=function(_0x53907e){while(--_0x53907e){_0xfee294['push'](_0xfee294['shift']());}};_0x54f196(++_0x1a19dc);}(_0x0eee,0xb3));var _0xe0ee=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x0eee[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xe0ee('0x0'));var util=require(_0xe0ee('0x1'));var path=require(_0xe0ee('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0ee('0x3'));var router=express[_0xe0ee('0x4')]();var fs_extra=require(_0xe0ee('0x5'));var auth=require(_0xe0ee('0x6'));var interaction=require(_0xe0ee('0x7'));var config=require(_0xe0ee('0x8'));var controller=require(_0xe0ee('0x9'));router[_0xe0ee('0xa')]('/',auth['isAuthenticated'](),controller[_0xe0ee('0xb')]);router[_0xe0ee('0xa')](_0xe0ee('0xc'),auth[_0xe0ee('0xd')](),controller['describe']);router[_0xe0ee('0xa')]('/whoami',auth['isAuthenticated'](),controller[_0xe0ee('0xe')]);router[_0xe0ee('0xa')](_0xe0ee('0xf'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x10')]);router[_0xe0ee('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe0ee('0x11')]);router['get'](_0xe0ee('0x12'),controller[_0xe0ee('0x13')]);router['get'](_0xe0ee('0x14'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x15')]);router[_0xe0ee('0xa')](_0xe0ee('0x16'),auth['isAuthenticated'](),controller[_0xe0ee('0x17')]);router['get'](_0xe0ee('0x18'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x19')]);router['get']('/:id/queues_rt',auth[_0xe0ee('0xd')](),controller['getVoiceQueuesRt']);router['get'](_0xe0ee('0x1a'),auth[_0xe0ee('0xd')](),controller['getGroups']);router[_0xe0ee('0xa')]('/:id/recordings',auth[_0xe0ee('0xd')](),controller['getRecordings']);router[_0xe0ee('0xa')](_0xe0ee('0x1b'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x1c')]);router[_0xe0ee('0xa')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xe0ee('0x1d')]);router[_0xe0ee('0xa')](_0xe0ee('0x1e'),auth[_0xe0ee('0xd')](),controller['getOpenchannelInteractions']);router[_0xe0ee('0xa')]('/:id/mail/interactions',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x1f')]);router['get'](_0xe0ee('0x20'),auth[_0xe0ee('0xd')](),controller['getSmsInteractions']);router['get']('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xe0ee('0x21')]);router[_0xe0ee('0xa')](_0xe0ee('0x22'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x23')]);router[_0xe0ee('0xa')]('/:id/teams',auth[_0xe0ee('0xd')](),controller['getTeams']);router[_0xe0ee('0xa')]('/:id/lists',auth['isAuthenticated'](),controller[_0xe0ee('0x24')]);router[_0xe0ee('0xa')](_0xe0ee('0x25'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x26')]);router['get']('/:id/prefixes',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x27')]);router['get'](_0xe0ee('0x28'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x29')]);router[_0xe0ee('0xa')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xe0ee('0x2a')]);router[_0xe0ee('0xa')](_0xe0ee('0x2b'),auth['isAuthenticated'](),controller[_0xe0ee('0x2c')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xe0ee('0x2d')]);router[_0xe0ee('0xa')](_0xe0ee('0x2e'),auth['isAuthenticated'](),controller[_0xe0ee('0x2f')]);router[_0xe0ee('0xa')](_0xe0ee('0x30'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x31')]);router['get']('/:id/scheduled_calls',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x32')]);router[_0xe0ee('0xa')](_0xe0ee('0x33'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x34')]);router[_0xe0ee('0x35')](_0xe0ee('0x16'),auth['isAuthenticated'](),controller[_0xe0ee('0x36')]);router['post']('/',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x37')]);router[_0xe0ee('0x35')]('/create_many',auth[_0xe0ee('0xd')](),controller['bulkCreate']);router[_0xe0ee('0x35')](_0xe0ee('0x18'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16eb38,_0x65b4c1,_0x427b13){_0x427b13(null,path[_0xe0ee('0x39')](config[_0xe0ee('0x3a')],_0xe0ee('0x3b')));},'filename':function(_0x4a92f0,_0x23a8c2,_0x45d477){_0x45d477(null,util[_0xe0ee('0x3c')](_0xe0ee('0x3d'),Date[_0xe0ee('0x3e')](),_0x23a8c2[_0xe0ee('0x3f')]));}})});router[_0xe0ee('0x35')](_0xe0ee('0x12'),upload[_0xe0ee('0x40')](_0xe0ee('0x41')),controller[_0xe0ee('0x42')]);router[_0xe0ee('0x35')](_0xe0ee('0x43'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x44')]);router['post'](_0xe0ee('0x45'),auth[_0xe0ee('0xd')](),controller['logout']);router['post'](_0xe0ee('0x46'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x47')]);router[_0xe0ee('0x35')](_0xe0ee('0x48'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x49')]);router['post'](_0xe0ee('0x4a'),auth['isAuthenticated'](),controller[_0xe0ee('0x4b')]);router[_0xe0ee('0x35')]('/:id/chat_interactions',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x4c')]);router[_0xe0ee('0x35')](_0xe0ee('0x4d'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x4e')]);router[_0xe0ee('0x35')](_0xe0ee('0x4f'),auth['isAuthenticated'](),controller[_0xe0ee('0x50')]);router[_0xe0ee('0x35')](_0xe0ee('0x51'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x52')]);router['post'](_0xe0ee('0x53'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x54')]);router[_0xe0ee('0x35')](_0xe0ee('0x55'),auth[_0xe0ee('0xd')](),controller['addWhatsappInteractions']);router[_0xe0ee('0x35')](_0xe0ee('0x28'),auth['isAuthenticated'](),controller[_0xe0ee('0x56')]);router[_0xe0ee('0x35')](_0xe0ee('0x57'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x58')]);router[_0xe0ee('0x35')](_0xe0ee('0x2b'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x59')]);router[_0xe0ee('0x35')](_0xe0ee('0x5a'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x5b')]);router[_0xe0ee('0x35')](_0xe0ee('0x2e'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x5c')]);router['post'](_0xe0ee('0x30'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x5d')]);router[_0xe0ee('0x35')]('/:id/api_key',auth[_0xe0ee('0xd')](),controller['createApiKey']);router['put']('/:id',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x5e')]);router['put'](_0xe0ee('0x5f'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x60')]);router[_0xe0ee('0x61')](_0xe0ee('0x18'),auth[_0xe0ee('0xd')](),controller['removeQueues']);router[_0xe0ee('0x61')](_0xe0ee('0x4a'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x62')]);router[_0xe0ee('0x61')](_0xe0ee('0x63'),auth[_0xe0ee('0xd')](),controller['destroy']);router['delete']('/:id/chat_interactions',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x64')]);router[_0xe0ee('0x61')](_0xe0ee('0x4d'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x65')]);router[_0xe0ee('0x61')](_0xe0ee('0x4f'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xe0ee('0x61')](_0xe0ee('0x51'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x66')]);router[_0xe0ee('0x61')]('/:id/openchannel_interactions',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x67')]);router[_0xe0ee('0x61')](_0xe0ee('0x55'),auth['isAuthenticated'](),controller[_0xe0ee('0x68')]);router[_0xe0ee('0x61')](_0xe0ee('0x28'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x69')]);router[_0xe0ee('0x61')]('/:id/mail_accounts',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6a')]);router[_0xe0ee('0x61')](_0xe0ee('0x2b'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6b')]);router[_0xe0ee('0x61')](_0xe0ee('0x5a'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6c')]);router[_0xe0ee('0x61')](_0xe0ee('0x2e'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6d')]);router['delete'](_0xe0ee('0x30'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x6e')]);router['delete']('/:id/api_key',auth[_0xe0ee('0xd')](),controller['removeApiKey']);router[_0xe0ee('0x35')](_0xe0ee('0x6f'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x70')]);module[_0xe0ee('0x71')]=router; \ No newline at end of file +var _0xe586=['removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','describe','/whoami','isAuthenticated','/presence','getPresence','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','create','/create_many','addQueues','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','/:id/logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','/:id','update','put','changePassword','delete','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x815c81,_0x54224f){var _0x432fb6=function(_0x26254b){while(--_0x26254b){_0x815c81['push'](_0x815c81['shift']());}};_0x432fb6(++_0x54224f);}(_0xe586,0x151));var _0x6e58=function(_0x594542,_0x49a7b6){_0x594542=_0x594542-0x0;var _0x1b47fc=_0xe586[_0x594542];return _0x1b47fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6e58('0x0'));var timeout=require(_0x6e58('0x1'));var express=require('express');var router=express[_0x6e58('0x2')]();var fs_extra=require(_0x6e58('0x3'));var auth=require(_0x6e58('0x4'));var interaction=require(_0x6e58('0x5'));var config=require(_0x6e58('0x6'));var controller=require(_0x6e58('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e58('0x8')]);router[_0x6e58('0x9')](_0x6e58('0xa'),auth['isAuthenticated'](),controller[_0x6e58('0xb')]);router['get'](_0x6e58('0xc'),auth[_0x6e58('0xd')](),controller['whoami']);router['get'](_0x6e58('0xe'),auth['isAuthenticated'](),controller[_0x6e58('0xf')]);router[_0x6e58('0x9')]('/:id',auth[_0x6e58('0xd')](),controller['show']);router[_0x6e58('0x9')](_0x6e58('0x10'),controller[_0x6e58('0x11')]);router[_0x6e58('0x9')](_0x6e58('0x12'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x13')]);router[_0x6e58('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x6e58('0x9')](_0x6e58('0x14'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x15')]);router[_0x6e58('0x9')]('/:id/queues_rt',auth[_0x6e58('0xd')](),controller[_0x6e58('0x16')]);router[_0x6e58('0x9')](_0x6e58('0x17'),auth['isAuthenticated'](),controller[_0x6e58('0x18')]);router['get'](_0x6e58('0x19'),auth[_0x6e58('0xd')](),controller['getRecordings']);router[_0x6e58('0x9')](_0x6e58('0x1a'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x1b')]);router[_0x6e58('0x9')]('/:id/chat/interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x1c')]);router[_0x6e58('0x9')](_0x6e58('0x1d'),auth[_0x6e58('0xd')](),controller['getOpenchannelInteractions']);router[_0x6e58('0x9')](_0x6e58('0x1e'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x1f')]);router['get'](_0x6e58('0x20'),auth[_0x6e58('0xd')](),controller['getSmsInteractions']);router[_0x6e58('0x9')](_0x6e58('0x21'),auth['isAuthenticated'](),controller[_0x6e58('0x22')]);router['get'](_0x6e58('0x23'),auth[_0x6e58('0xd')](),controller['getWhatsappInteractions']);router[_0x6e58('0x9')](_0x6e58('0x24'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x25')]);router[_0x6e58('0x9')](_0x6e58('0x26'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x27')]);router[_0x6e58('0x9')](_0x6e58('0x28'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x29')]);router[_0x6e58('0x9')]('/:id/prefixes',auth[_0x6e58('0xd')](),controller[_0x6e58('0x2a')]);router[_0x6e58('0x9')](_0x6e58('0x2b'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x2c')]);router[_0x6e58('0x9')]('/:id/mail_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x2d')]);router['get'](_0x6e58('0x2e'),auth['isAuthenticated'](),controller[_0x6e58('0x2f')]);router['get'](_0x6e58('0x30'),auth[_0x6e58('0xd')](),controller['getSmsAccounts']);router[_0x6e58('0x9')](_0x6e58('0x31'),auth['isAuthenticated'](),controller[_0x6e58('0x32')]);router[_0x6e58('0x9')](_0x6e58('0x33'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x34')]);router[_0x6e58('0x9')](_0x6e58('0x35'),auth['isAuthenticated'](),controller[_0x6e58('0x36')]);router['get'](_0x6e58('0x37'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x38')]);router[_0x6e58('0x39')](_0x6e58('0x3a'),auth[_0x6e58('0xd')](),controller['addContacts']);router[_0x6e58('0x39')]('/',auth[_0x6e58('0xd')](),controller[_0x6e58('0x3b')]);router[_0x6e58('0x39')](_0x6e58('0x3c'),auth[_0x6e58('0xd')](),controller['bulkCreate']);router[_0x6e58('0x39')]('/:id/queues',auth[_0x6e58('0xd')](),controller[_0x6e58('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x9a66b7,_0x1af1d7,_0x536823){_0x536823(null,path[_0x6e58('0x3e')](config[_0x6e58('0x3f')],_0x6e58('0x40')));},'filename':function(_0x497ce5,_0x32d2b5,_0x35f7cb){_0x35f7cb(null,util[_0x6e58('0x41')](_0x6e58('0x42'),Date['now'](),_0x32d2b5[_0x6e58('0x43')]));}})});router[_0x6e58('0x39')]('/:id/avatar',upload[_0x6e58('0x44')](_0x6e58('0x45')),controller[_0x6e58('0x46')]);router[_0x6e58('0x39')](_0x6e58('0x47'),auth[_0x6e58('0xd')](),controller['login']);router[_0x6e58('0x39')](_0x6e58('0x48'),auth[_0x6e58('0xd')](),controller['logout']);router[_0x6e58('0x39')](_0x6e58('0x49'),auth['isAuthenticated'](),controller['pause']);router['post'](_0x6e58('0x4a'),auth['isAuthenticated'](),controller[_0x6e58('0x4b')]);router[_0x6e58('0x39')](_0x6e58('0x24'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x4c')]);router[_0x6e58('0x39')](_0x6e58('0x4d'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x4e')]);router[_0x6e58('0x39')](_0x6e58('0x4f'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x50')]);router['post'](_0x6e58('0x51'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x52')]);router[_0x6e58('0x39')](_0x6e58('0x53'),auth['isAuthenticated'](),controller[_0x6e58('0x54')]);router[_0x6e58('0x39')]('/:id/openchannel_interactions',auth[_0x6e58('0xd')](),controller['addOpenchannelInteractions']);router[_0x6e58('0x39')]('/:id/whatsapp_interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x55')]);router[_0x6e58('0x39')](_0x6e58('0x2b'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x56')]);router[_0x6e58('0x39')]('/:id/mail_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x57')]);router['post']('/:id/openchannel_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x58')]);router[_0x6e58('0x39')]('/:id/sms_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x59')]);router[_0x6e58('0x39')](_0x6e58('0x31'),auth[_0x6e58('0xd')](),controller['addChatWebsites']);router[_0x6e58('0x39')](_0x6e58('0x33'),auth['isAuthenticated'](),controller[_0x6e58('0x5a')]);router[_0x6e58('0x39')](_0x6e58('0x37'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x5b')]);router['put'](_0x6e58('0x5c'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x5d')]);router[_0x6e58('0x5e')]('/:id/password',auth[_0x6e58('0xd')](),controller[_0x6e58('0x5f')]);router[_0x6e58('0x60')](_0x6e58('0x14'),auth[_0x6e58('0xd')](),controller['removeQueues']);router[_0x6e58('0x60')](_0x6e58('0x24'),auth[_0x6e58('0xd')](),controller['removeTeams']);router[_0x6e58('0x60')](_0x6e58('0x5c'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x61')]);router[_0x6e58('0x60')]('/:id/chat_interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x62')]);router[_0x6e58('0x60')](_0x6e58('0x4f'),auth[_0x6e58('0xd')](),controller['removeMailInteractions']);router[_0x6e58('0x60')]('/:id/fax_interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x63')]);router[_0x6e58('0x60')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x6e58('0x64')]);router[_0x6e58('0x60')]('/:id/openchannel_interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x65')]);router[_0x6e58('0x60')](_0x6e58('0x66'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete']('/:id/fax_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x67')]);router[_0x6e58('0x60')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x68')]);router['delete'](_0x6e58('0x30'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x69')]);router[_0x6e58('0x60')]('/:id/chat_websites',auth[_0x6e58('0xd')](),controller[_0x6e58('0x6a')]);router[_0x6e58('0x60')](_0x6e58('0x33'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x6b')]);router[_0x6e58('0x60')]('/:id/api_key',auth[_0x6e58('0xd')](),controller[_0x6e58('0x6c')]);router[_0x6e58('0x39')](_0x6e58('0x6d'),auth[_0x6e58('0xd')](),controller['messengerSoundNotification']);module[_0x6e58('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1e9ec02..41dad45 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 _0xa8ed=['fingerprint','certificate','active','passive','actpass','TEXT','showWebBar','get','wss','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','format','getDataValue','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','internal','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas'];(function(_0x31b167,_0xf3f3d2){var _0x58a791=function(_0x3603c2){while(--_0x3603c2){_0x31b167['push'](_0x31b167['shift']());}};_0x58a791(++_0xf3f3d2);}(_0xa8ed,0x17f));var _0xda8e=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa8ed[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xda8e('0x0'));var moment=require(_0xda8e('0x1'));var util=require('util');var _=require(_0xda8e('0x2'));module[_0xda8e('0x3')]={'name':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'unique':_0xda8e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2e839e){this[_0xda8e('0x6')](_0xda8e('0x5'),_0x2e839e);this[_0xda8e('0x6')](_0xda8e('0x7'),_0x2e839e);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'set':function(_0x58bdd2){this['setDataValue'](_0xda8e('0x8'),_0x58bdd2);this[_0xda8e('0x6')]('callerid',util[_0xda8e('0x9')]('\x22%s\x22\x20<%s>',_0x58bdd2,this[_0xda8e('0xa')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'unique':_0xda8e('0xb'),'validate':{'isEmail':!![]},'set':function(_0x57a00c){if(_0x57a00c){this['setDataValue'](_0xda8e('0xb'),_0x57a00c[_0xda8e('0xc')]());}}},'role':{'type':Sequelize[_0xda8e('0xd')]('admin',_0xda8e('0xe'),_0xda8e('0xf'),_0xda8e('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':_0xda8e('0x11')},'internal':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':![],'unique':_0xda8e('0x13'),'set':function(_0x94d506){this[_0xda8e('0x6')](_0xda8e('0x13'),_0x94d506);this['setDataValue'](_0xda8e('0x14'),_0x94d506);this[_0xda8e('0x6')]('callerid',util[_0xda8e('0x9')](_0xda8e('0x15'),this[_0xda8e('0xa')](_0xda8e('0x8')),_0x94d506));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xda8e('0x4')]},'address':{'type':Sequelize[_0xda8e('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xda8e('0x4')]},'city':{'type':Sequelize[_0xda8e('0x4')]},'country':{'type':Sequelize[_0xda8e('0x4')]},'online':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xda8e('0x17')]},'voicePause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':_0xda8e('0x18')},'lastPauseAt':{'type':Sequelize[_0xda8e('0x17')]},'chatCapacity':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xda8e('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':_0xda8e('0x19')},'ipaddr':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xda8e('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x1a'),_0xda8e('0xe'),'peer'),'allowNull':!![],'defaultValue':_0xda8e('0x1a')},'context':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x1b'),_0xda8e('0x1c'),'ALLOWED_FAILED_SCREEN',_0xda8e('0x1d'),_0xda8e('0x1e'),'PROHIB_PASSED_SCREEN',_0xda8e('0x1f'),_0xda8e('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1d16f3){this[_0xda8e('0x6')](_0xda8e('0x21'),_0x1d16f3?_0x1d16f3[_0xda8e('0x22')](','):null);},'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x21'))?this[_0xda8e('0xa')](_0xda8e('0x21'))[_0xda8e('0x23')](','):null;},'comment':_0xda8e('0x24')},'dtmfmode':{'type':Sequelize['ENUM'](_0xda8e('0x25'),'info',_0xda8e('0x26'),_0xda8e('0x27'),_0xda8e('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no',_0xda8e('0x2a'),_0xda8e('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x315516){this[_0xda8e('0x6')](_0xda8e('0x2c'),_0x315516?_0x315516['join'](','):null);},'get':function(){return this[_0xda8e('0xa')]('nat')?this[_0xda8e('0xa')](_0xda8e('0x2c'))[_0xda8e('0x23')](','):null;},'comment':_0xda8e('0x2d')},'callgroup':{'type':Sequelize[_0xda8e('0x4')]},'namedcallgroup':{'type':Sequelize[_0xda8e('0x4')]},'pickupgroup':{'type':Sequelize[_0xda8e('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xda8e('0x4')]},'language':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'defaultValue':_0xda8e('0x2e')},'allow':{'type':Sequelize[_0xda8e('0x4')],'allowNull':![],'defaultValue':_0xda8e('0x2f'),'set':function(_0x1a3c4e){this[_0xda8e('0x6')]('allow',_0x1a3c4e?_0x1a3c4e[_0xda8e('0x22')](';'):_0xda8e('0x2f'));},'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x30'))?this[_0xda8e('0xa')](_0xda8e('0x30'))[_0xda8e('0x23')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xda8e('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x1a9365){this[_0xda8e('0x6')](_0xda8e('0x31'),_0x1a9365?_0x1a9365[_0xda8e('0x22')](','):null);},'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x31'))?this['getDataValue'](_0xda8e('0x31'))[_0xda8e('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xda8e('0xd')]('yes','no',_0xda8e('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![],'defaultValue':_0xda8e('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':_0xda8e('0x29')},'busylevel':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xda8e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xda8e('0xd')]('yes','no',_0xda8e('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x35'),_0xda8e('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x37'),_0xda8e('0x38')),'allowNull':!![],'defaultValue':_0xda8e('0x38')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':_0xda8e('0x29')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no',_0xda8e('0x39'),_0xda8e('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x3b'),_0xda8e('0x3c'),_0xda8e('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xda8e('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xda8e('0xd')](_0xda8e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xda8e('0xd')]('yes','no',_0xda8e('0x2a'),_0xda8e('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xda8e('0x17')]},'passwordResetAt':{'type':Sequelize[_0xda8e('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xda8e('0x3e')]},'showWebBar':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0,'set':function(_0x3a9d64){this['setDataValue'](_0xda8e('0x3f'),_0x3a9d64);var _0x203b55=this[_0xda8e('0x40')]({'plain':!![]});switch(_0x3a9d64){case 0x0:case 0x1:var _0x22a1b2=_0x203b55[_0xda8e('0x21')]?_['isArray'](_0x203b55[_0xda8e('0x21')])?_0x203b55[_0xda8e('0x21')][_0xda8e('0x22')]():_0x203b55[_0xda8e('0x21')]:'udp';if(_0x22a1b2===_0xda8e('0x41')){_0x22a1b2='udp';}this['setDataValue'](_0xda8e('0x21'),_0x22a1b2);this[_0xda8e('0x6')]('encryption','no');this[_0xda8e('0x6')](_0xda8e('0x42'),null);this[_0xda8e('0x6')]('force_avp',null);this[_0xda8e('0x6')](_0xda8e('0x43'),null);this[_0xda8e('0x6')](_0xda8e('0x44'),null);this[_0xda8e('0x6')](_0xda8e('0x45'),null);this[_0xda8e('0x6')](_0xda8e('0x46'),null);this['setDataValue'](_0xda8e('0x47'),null);this[_0xda8e('0x6')](_0xda8e('0x48'),null);this[_0xda8e('0x6')](_0xda8e('0x49'),'no');break;case 0x2:this[_0xda8e('0x6')]('transport','wss');this[_0xda8e('0x6')]('encryption',_0xda8e('0x29'));this[_0xda8e('0x6')](_0xda8e('0x42'),_0xda8e('0x29'));this['setDataValue'](_0xda8e('0x4a'),_0xda8e('0x29'));this[_0xda8e('0x6')](_0xda8e('0x43'),'yes');this[_0xda8e('0x6')]('dtlsenable',_0xda8e('0x29'));this['setDataValue'](_0xda8e('0x45'),'no');this[_0xda8e('0x6')](_0xda8e('0x46'),'actpass');this[_0xda8e('0x6')]('dtlscertfile',_0x203b55[_0xda8e('0x47')]||_0xda8e('0x4b'));this['setDataValue'](_0xda8e('0x48'),_0x203b55[_0xda8e('0x48')]||_0xda8e('0x4c'));this[_0xda8e('0x6')](_0xda8e('0x49'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xda8e('0x3e')],'set':function(_0x169a3b){this[_0xda8e('0x6')](_0xda8e('0x4d'),_0x169a3b?_0x169a3b[_0xda8e('0x22')](','):[]);},'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x4d'))?_[_0xda8e('0x4e')](this[_0xda8e('0xa')]('permissions')['split'](','),function(_0x406e39){return parseInt(_0x406e39,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xda8e('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xda8e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xda8e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xda8e('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xda8e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xda8e('0xa')](_0xda8e('0x4f'))?this[_0xda8e('0xa')](_0xda8e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xda8e('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xda8e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1505bc){if(typeof _0x1505bc===_0xda8e('0x50')){var _0x4795a1=_0x1505bc==='1'?!![]:_0x1505bc==='0'?![]:_0x1505bc===_0xda8e('0x51')?!![]:_0x1505bc===_0xda8e('0x52')?![]:![];this[_0xda8e('0x6')](_0xda8e('0x53'),_0x4795a1);}else{this[_0xda8e('0x6')](_0xda8e('0x53'),_0x1505bc);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2d8bf6){this['setDataValue'](_0xda8e('0x54'),_0x2d8bf6);if(_0x2d8bf6===!![]){this['setDataValue'](_0xda8e('0x55'),moment());this[_0xda8e('0x6')](_0xda8e('0x56'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xda8e('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xda8e('0x12')](0x5)[_0xda8e('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xda8e('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xda8e('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc91e=['refuse','originate','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','get','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','local','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','insecure','always','accept'];(function(_0x536f11,_0x1e921c){var _0xe15654=function(_0x386dd6){while(--_0x386dd6){_0x536f11['push'](_0x536f11['shift']());}};_0xe15654(++_0x1e921c);}(_0xc91e,0x74));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xec91('0x0'));var moment=require('moment');var util=require(_0xec91('0x1'));var _=require(_0xec91('0x2'));module[_0xec91('0x3')]={'name':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'unique':_0xec91('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x135dc2){this['setDataValue'](_0xec91('0x5'),_0x135dc2);this[_0xec91('0x6')](_0xec91('0x7'),_0x135dc2);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'set':function(_0x46abd6){this[_0xec91('0x6')](_0xec91('0x8'),_0x46abd6);this[_0xec91('0x6')](_0xec91('0x9'),util['format'](_0xec91('0xa'),_0x46abd6,this[_0xec91('0xb')](_0xec91('0xc'))));}},'alias':{'type':Sequelize[_0xec91('0x4')]},'email':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'unique':_0xec91('0xd'),'validate':{'isEmail':!![]},'set':function(_0x48e78e){if(_0x48e78e){this[_0xec91('0x6')](_0xec91('0xd'),_0x48e78e[_0xec91('0xe')]());}}},'role':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x10'),_0xec91('0x11'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xec91('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xec91('0xc'),'set':function(_0x48cd94){this[_0xec91('0x6')](_0xec91('0xc'),_0x48cd94);this[_0xec91('0x6')](_0xec91('0x13'),_0x48cd94);this[_0xec91('0x6')](_0xec91('0x9'),util['format'](_0xec91('0xa'),this[_0xec91('0xb')](_0xec91('0x8')),_0x48cd94));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xec91('0x4')]},'mobile':{'type':Sequelize[_0xec91('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xec91('0x4')]},'userpic':{'type':Sequelize[_0xec91('0x4')]},'city':{'type':Sequelize[_0xec91('0x4')]},'country':{'type':Sequelize[_0xec91('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xec91('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xec91('0x4')],'defaultValue':_0xec91('0x16')},'lastPauseAt':{'type':Sequelize[_0xec91('0x14')]},'chatCapacity':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xec91('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xec91('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'defaultValue':_0xec91('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xec91('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x19'),'user',_0xec91('0x1a')),'allowNull':!![],'defaultValue':_0xec91('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xec91('0x1b')},'callingpres':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x1c'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED',_0xec91('0x1d'),_0xec91('0x1e'),_0xec91('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'defaultValue':_0xec91('0x20'),'set':function(_0x434bf7){this[_0xec91('0x6')](_0xec91('0x21'),_0x434bf7?_0x434bf7[_0xec91('0x22')](','):null);},'get':function(){return this['getDataValue'](_0xec91('0x21'))?this[_0xec91('0xb')](_0xec91('0x21'))[_0xec91('0x23')](','):null;},'comment':_0xec91('0x24')},'dtmfmode':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x25'),'info','shortinfo',_0xec91('0x26'),_0xec91('0x27')),'allowNull':!![],'defaultValue':_0xec91('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no',_0xec91('0x29'),_0xec91('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x4b78c2){this[_0xec91('0x6')](_0xec91('0x2b'),_0x4b78c2?_0x4b78c2['join'](','):null);},'get':function(){return this[_0xec91('0xb')](_0xec91('0x2b'))?this[_0xec91('0xb')](_0xec91('0x2b'))['split'](','):null;},'comment':_0xec91('0x2c')},'callgroup':{'type':Sequelize[_0xec91('0x4')]},'namedcallgroup':{'type':Sequelize[_0xec91('0x4')]},'pickupgroup':{'type':Sequelize[_0xec91('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xec91('0x4')]},'language':{'type':Sequelize[_0xec91('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xec91('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xec91('0x2d')},'allow':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x45687a){this['setDataValue'](_0xec91('0x2e'),_0x45687a?_0x45687a[_0xec91('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xec91('0xb')](_0xec91('0x2e'))?this[_0xec91('0xb')](_0xec91('0x2e'))[_0xec91('0x23')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'set':function(_0x2359fb){this['setDataValue']('insecure',_0x2359fb?_0x2359fb[_0xec91('0x22')](','):null);},'get':function(){return this[_0xec91('0xb')](_0xec91('0x2f'))?this[_0xec91('0xb')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xec91('0x30')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x31'),_0xec91('0x32'),_0xec91('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xec91('0x34')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':_0xec91('0x28')},'keepalive':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xec91('0xf')]('yes','no',_0xec91('0x35'),_0xec91('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x37'),_0xec91('0x38'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xec91('0xf')]('yes','no',_0xec91('0x29'),_0xec91('0x2a'),_0xec91('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xec91('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xec91('0x14')]},'passwordResetAt':{'type':Sequelize[_0xec91('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xec91('0x3a')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x1a8dc7){this[_0xec91('0x6')](_0xec91('0x3b'),_0x1a8dc7);var _0x19adb0=this[_0xec91('0x3c')]({'plain':!![]});switch(_0x1a8dc7){case 0x0:case 0x1:var _0x4c3542=_0x19adb0[_0xec91('0x21')]?_['isArray'](_0x19adb0[_0xec91('0x21')])?_0x19adb0[_0xec91('0x21')][_0xec91('0x22')]():_0x19adb0['transport']:_0xec91('0x20');if(_0x4c3542===_0xec91('0x3d')){_0x4c3542='udp';}this[_0xec91('0x6')]('transport',_0x4c3542);this[_0xec91('0x6')](_0xec91('0x3e'),'no');this[_0xec91('0x6')](_0xec91('0x3f'),null);this[_0xec91('0x6')]('force_avp',null);this['setDataValue'](_0xec91('0x40'),null);this[_0xec91('0x6')](_0xec91('0x41'),null);this['setDataValue'](_0xec91('0x42'),null);this[_0xec91('0x6')](_0xec91('0x43'),null);this[_0xec91('0x6')](_0xec91('0x44'),null);this[_0xec91('0x6')](_0xec91('0x45'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xec91('0x6')](_0xec91('0x21'),_0xec91('0x3d'));this[_0xec91('0x6')](_0xec91('0x3e'),_0xec91('0x28'));this[_0xec91('0x6')](_0xec91('0x3f'),_0xec91('0x28'));this['setDataValue']('force_avp',_0xec91('0x28'));this[_0xec91('0x6')](_0xec91('0x40'),_0xec91('0x28'));this[_0xec91('0x6')](_0xec91('0x41'),'yes');this['setDataValue']('dtlsverify','no');this[_0xec91('0x6')]('dtlssetup',_0xec91('0x46'));this[_0xec91('0x6')](_0xec91('0x44'),_0x19adb0[_0xec91('0x44')]||_0xec91('0x47'));this[_0xec91('0x6')](_0xec91('0x45'),_0x19adb0[_0xec91('0x45')]||_0xec91('0x48'));this[_0xec91('0x6')](_0xec91('0x49'),_0xec91('0x28'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x4f31ca){this['setDataValue'](_0xec91('0x4a'),_0x4f31ca?_0x4f31ca[_0xec91('0x22')](','):[]);},'get':function(){return this[_0xec91('0xb')](_0xec91('0x4a'))?_[_0xec91('0x4b')](this[_0xec91('0xb')]('permissions')['split'](','),function(_0x107738){return parseInt(_0x107738,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xec91('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xec91('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xec91('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xec91('0x4c'))?this['getDataValue'](_0xec91('0x4c')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xec91('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![],'set':function(_0x158d94){if(typeof _0x158d94==='string'){var _0x2527fd=_0x158d94==='1'?!![]:_0x158d94==='0'?![]:_0x158d94===_0xec91('0x4d')?!![]:_0x158d94===_0xec91('0x4e')?![]:![];this['setDataValue'](_0xec91('0x4f'),_0x2527fd);}else{this['setDataValue'](_0xec91('0x4f'),_0x158d94);}}},'blocked':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![],'set':function(_0x155e93){this['setDataValue'](_0xec91('0x50'),_0x155e93);if(_0x155e93===!![]){this[_0xec91('0x6')](_0xec91('0x51'),moment());this[_0xec91('0x6')](_0xec91('0x52'),0x0);}else{this[_0xec91('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xec91('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xec91('0x17')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 25c09eb..23c0d6f 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 _0x3fc2=['count','query','includeAll','include','userSetting','UserSetting','attributes','push','findAll','rows','openTabs','true','length','dataValues','sms','fax','mail','all','catch','show','params','merge','options','find','chat','openchannel','whatsapp','body','describe','addContacts','ids','omit','internal','Setting','findById','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','fullname','email','agent','permissions','101','110','104','105','108','109','100','111','114','115','create','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','updatePasswordsHistory','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','QueueId','voice','format','SIP/%s','UserVoiceQueueRt','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','download','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','nolimit','getVoiceQueuesRt','pick','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','concat','resolve','logout','forEach','pause','online','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','Team','getTeams','addTeams','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','UserVoicePrefix','getLists','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$gte','$lt','$lte','$ne','$not','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','firstName','lastName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','ringing','teams','inbound','getAgents','toString','lower','asc','substring','orderBy','getRealtimeAgents','offline','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','field','ui.','InteractionId','ui.createdAt','OpenTabs','enabled','moment','util','path','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','redis','./user.socket','register','defaults','localhost','status','json','offset','undefined','limit','set','Content-Range','update','then','role','emit','destroy','get','Users','user','Agents','Telephones','filter','ignore','map','value','includes','name','UserProfileResource','end','sendStatus','error','stack','User','rawAttributes','fieldName','type','password','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where'];(function(_0x2d5abe,_0x5af517){var _0x4fe904=function(_0x44b6d8){while(--_0x44b6d8){_0x2d5abe['push'](_0x2d5abe['shift']());}};_0x4fe904(++_0x5af517);}(_0x3fc2,0x146));var _0x23fc=function(_0x32ebd9,_0x3d8d94){_0x32ebd9=_0x32ebd9-0x0;var _0x54424c=_0x3fc2[_0x32ebd9];return _0x54424c;};'use strict';var moment=require(_0x23fc('0x0'));var util=require(_0x23fc('0x1'));var path=require(_0x23fc('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x23fc('0x3'));var Redis=require(_0x23fc('0x4'));var authService=require(_0x23fc('0x5'));var contacts=require('../../components/contacts');var qs=require(_0x23fc('0x6'));var rta=require(_0x23fc('0x7'));var logger=require(_0x23fc('0x8'))('api');var utils=require(_0x23fc('0x9'));var config=require(_0x23fc('0xa'));var licenseUtil=require(_0x23fc('0xb'));var APIBadRequestError=require(_0x23fc('0xc'))[_0x23fc('0xd')];var APINotFoundError=require(_0x23fc('0xc'))[_0x23fc('0xe')];var APIHandleError=require(_0x23fc('0xc'))[_0x23fc('0xf')];var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x23fc('0x10')]));require(_0x23fc('0x11'))[_0x23fc('0x12')](socket);config['redis']=_[_0x23fc('0x13')](config[_0x23fc('0x10')],{'host':_0x23fc('0x14'),'port':0x18eb});var values;function respondWithStatusCode(_0x5c012d,_0x5677f0){_0x5677f0=_0x5677f0||0xcc;return function(_0x572a1b){if(_0x572a1b){return _0x5c012d['sendStatus'](_0x5677f0);}return _0x5c012d[_0x23fc('0x15')](_0x5677f0)['end']();};}function respondWithResult(_0x5a219f,_0x3e3b0f){_0x3e3b0f=_0x3e3b0f||0xc8;return function(_0x297966){if(_0x297966){return _0x5a219f[_0x23fc('0x15')](_0x3e3b0f)[_0x23fc('0x16')](_0x297966);}};}function respondWithFilteredResult(_0x1afe79,_0x10540e){return function(_0x354f95){if(_0x354f95){var _0x51fd3f=typeof _0x10540e[_0x23fc('0x17')]===_0x23fc('0x18')&&typeof _0x10540e[_0x23fc('0x19')]==='undefined';var _0x1c5489=_0x354f95['count'];var _0x31a91d=_0x51fd3f?0x0:_0x10540e[_0x23fc('0x17')];var _0x94de97=_0x51fd3f?_0x354f95['count']:_0x10540e[_0x23fc('0x17')]+_0x10540e[_0x23fc('0x19')];var _0x95418e;if(_0x94de97>=_0x1c5489){_0x94de97=_0x1c5489;_0x95418e=0xc8;}else{_0x95418e=0xce;}_0x1afe79['status'](_0x95418e);return _0x1afe79[_0x23fc('0x1a')](_0x23fc('0x1b'),_0x31a91d+'-'+_0x94de97+'/'+_0x1c5489)[_0x23fc('0x16')](_0x354f95);}return null;};}function saveUpdates(_0x4d34a9){return function(_0x1c7bce){if(_0x1c7bce){return _0x1c7bce[_0x23fc('0x1c')](_0x4d34a9)[_0x23fc('0x1d')](function(_0x113b08){if(_0x113b08[_0x23fc('0x1e')]==='agent'){socket[_0x23fc('0x1f')]('userNotification:recalc:'+_0x113b08['id'],_0x113b08);}return _0x113b08;});}return null;};}function removeEntity(_0x58a6b8){return function(_0x4fcd61){if(_0x4fcd61){return _0x4fcd61[_0x23fc('0x20')]()[_0x23fc('0x1d')](function(){var _0xab81b1=_0x4fcd61[_0x23fc('0x21')]({'plain':!![]});if(_0xab81b1[_0x23fc('0x1e')]==='admin')return;var _0x43b337=[{'name':_0x23fc('0x22'),'value':_0x23fc('0x23'),'ignore':!![]},{'name':_0x23fc('0x24'),'value':'agent','ignore':![]},{'name':_0x23fc('0x25'),'value':'telephone','ignore':![]}];var _0x343431=_(_0x43b337)[_0x23fc('0x26')](_0x23fc('0x27'))[_0x23fc('0x28')](_0x23fc('0x29'))[_0x23fc('0x29')]();if(_[_0x23fc('0x2a')](_0x343431,_0xab81b1[_0x23fc('0x1e')])){return;}var _0x20cc66=_['find'](_0x43b337,[_0x23fc('0x29'),_0xab81b1[_0x23fc('0x1e')]])[_0x23fc('0x2b')];return db[_0x23fc('0x2c')][_0x23fc('0x20')]({'where':{'type':_0x20cc66,'resourceId':_0xab81b1['id']}})[_0x23fc('0x1d')](function(){return _0x4fcd61;});})[_0x23fc('0x1d')](function(){_0x58a6b8[_0x23fc('0x15')](0xcc)[_0x23fc('0x2d')]();});}};}function handleEntityNotFound(_0x4170a7){return function(_0x11ff69){if(!_0x11ff69){_0x4170a7[_0x23fc('0x2e')](0x194);}return _0x11ff69;};}function handleError(_0x5cb62d,_0x5634b4){_0x5634b4=_0x5634b4||0x1f4;return function(_0x294f9d){logger[_0x23fc('0x2f')](_0x294f9d[_0x23fc('0x30')]);if(_0x294f9d[_0x23fc('0x2b')]){delete _0x294f9d['name'];}_0x5cb62d[_0x23fc('0x15')](_0x5634b4)['send'](_0x294f9d);};}function getUserAttributes(){return _(db[_0x23fc('0x31')][_0x23fc('0x32')])['map'](function(_0x557c9a){return{'name':_0x557c9a[_0x23fc('0x33')],'type':_0x557c9a[_0x23fc('0x34')]['key']};})[_0x23fc('0x26')](function(_0x3e7999){return![_0x23fc('0x35'),'salt',_0x23fc('0x36'),_0x23fc('0x37'),_0x23fc('0x38'),_0x23fc('0x39')][_0x23fc('0x2a')](_0x3e7999[_0x23fc('0x2b')]);})['value']();}exports[_0x23fc('0x3a')]=function(_0xaeebeb,_0x53c9ae){var _0x24cf20={},_0x33191a={'count':0x0,'rows':[]};var _0x402c2f=getUserAttributes();_0x24cf20=qs[_0x23fc('0x3b')](_0x402c2f,_0xaeebeb);var _0xcdd4fa={'where':_0x24cf20[_0x23fc('0x3c')]};return db[_0x23fc('0x31')][_0x23fc('0x3d')](_0xcdd4fa)[_0x23fc('0x1d')](function(_0xdfbb59){_0x33191a['count']=_0xdfbb59;if(_0xaeebeb[_0x23fc('0x3e')][_0x23fc('0x3f')]){_0x24cf20[_0x23fc('0x40')]=[{'all':!![]}];}if(_0xaeebeb[_0x23fc('0x3e')][_0x23fc('0x41')]==='true'){_0x24cf20[_0x23fc('0x40')]=[{'model':db[_0x23fc('0x42')],'as':_0x23fc('0x41')}];}if(!_['includes'](_0x24cf20['attributes'],'id')){_0x24cf20[_0x23fc('0x43')][_0x23fc('0x44')]('id');}return db[_0x23fc('0x31')][_0x23fc('0x45')](_0x24cf20);})[_0x23fc('0x1d')](function(_0x42ee99){_0x33191a[_0x23fc('0x46')]=_0x42ee99;if(_0xaeebeb['query'][_0x23fc('0x47')]===_0x23fc('0x48')){var _0x577ea3=[];for(var _0x458892=0x0;_0x458892<_0x33191a['rows'][_0x23fc('0x49')];_0x458892++){_0x577ea3['push'](get_open_tabs('chat',_0x33191a['rows'][_0x458892][_0x23fc('0x4a')]));_0x577ea3['push'](get_open_tabs(_0x23fc('0x4b'),_0x33191a[_0x23fc('0x46')][_0x458892][_0x23fc('0x4a')]));_0x577ea3['push'](get_open_tabs(_0x23fc('0x4c'),_0x33191a[_0x23fc('0x46')][_0x458892][_0x23fc('0x4a')]));_0x577ea3[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x4d'),_0x33191a['rows'][_0x458892]['dataValues']));_0x577ea3[_0x23fc('0x44')](get_open_tabs('openchannel',_0x33191a[_0x23fc('0x46')][_0x458892]['dataValues']));_0x577ea3[_0x23fc('0x44')](get_open_tabs('whatsapp',_0x33191a[_0x23fc('0x46')][_0x458892]['dataValues']));}return Promise[_0x23fc('0x4e')](_0x577ea3)[_0x23fc('0x1d')](function(){return _0x33191a;});}else{return _0x33191a;}})[_0x23fc('0x1d')](respondWithFilteredResult(_0x53c9ae,_0x24cf20))[_0x23fc('0x4f')](handleError(_0x53c9ae,null));};exports[_0x23fc('0x50')]=function(_0x4c6427,_0x2e0cd1){var _0x36250b=getUserAttributes();_0x4c6427[_0x23fc('0x3e')]['id']=_0x4c6427[_0x23fc('0x51')]['id'];var _0x47ecd0=qs['getOptions'](_0x36250b,_0x4c6427);if(_0x4c6427[_0x23fc('0x3e')][_0x23fc('0x3f')]){_0x47ecd0[_0x23fc('0x40')]=[{'all':!![]}];}if(_0x4c6427['query'][_0x23fc('0x41')]===_0x23fc('0x48')){_0x47ecd0[_0x23fc('0x40')]=[{'model':db[_0x23fc('0x42')],'as':_0x23fc('0x41')}];}_0x47ecd0=_[_0x23fc('0x52')]({},_0x47ecd0,_0x4c6427[_0x23fc('0x53')]);if(!_[_0x23fc('0x2a')](_0x47ecd0[_0x23fc('0x43')],'id')){_0x47ecd0[_0x23fc('0x43')][_0x23fc('0x44')]('id');}return db['User'][_0x23fc('0x54')](_0x47ecd0)[_0x23fc('0x1d')](handleEntityNotFound(_0x2e0cd1,null))['then'](function(_0x384579){var _0x56711f=[];values=_0x384579;if(_0x4c6427[_0x23fc('0x3e')][_0x23fc('0x47')]===_0x23fc('0x48')){_0x56711f[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x55'),_0x384579[_0x23fc('0x4a')]));_0x56711f[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x4b'),_0x384579[_0x23fc('0x4a')]));_0x56711f[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x56'),_0x384579['dataValues']));_0x56711f[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x57'),_0x384579[_0x23fc('0x4a')]));_0x56711f['push'](get_open_tabs('fax',_0x384579[_0x23fc('0x4a')]));_0x56711f['push'](get_open_tabs('mail',_0x384579[_0x23fc('0x4a')]));return Promise[_0x23fc('0x4e')](_0x56711f);}else{return values;}})['then'](function(){return values;})[_0x23fc('0x1d')](respondWithResult(_0x2e0cd1,null))['catch'](handleError(_0x2e0cd1,null));};exports[_0x23fc('0x1c')]=function(_0x2c75a5,_0x29e64e){if(_0x2c75a5['body']['id']){delete _0x2c75a5[_0x23fc('0x58')]['id'];}delete _0x2c75a5['body']['role'];return db['User'][_0x23fc('0x54')]({'where':{'id':_0x2c75a5[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x29e64e,null))['then'](saveUpdates(_0x2c75a5[_0x23fc('0x58')],null))[_0x23fc('0x1d')](respondWithResult(_0x29e64e,null))[_0x23fc('0x4f')](handleError(_0x29e64e,null));};exports[_0x23fc('0x59')]=function(_0x8203ee,_0xf0674a){return db[_0x23fc('0x31')][_0x23fc('0x59')]()['then'](respondWithResult(_0xf0674a,null))['catch'](handleError(_0xf0674a,null));};exports[_0x23fc('0x5a')]=function(_0x3d367e,_0x2129b1){return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x3d367e[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x2129b1,null))['then'](function(_0x2f314b){if(_0x2f314b){return _0x2f314b[_0x23fc('0x5a')](_0x3d367e[_0x23fc('0x58')][_0x23fc('0x5b')],_[_0x23fc('0x5c')](_0x3d367e[_0x23fc('0x58')],[_0x23fc('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x2129b1,null))['catch'](handleError(_0x2129b1,null));};function validateUser(_0x551627){return new Promise(function(_0xb5b74a,_0x55ed0d){if(_0x551627[_0x23fc('0x5d')])return _0xb5b74a(_0x551627);return db[_0x23fc('0x5e')][_0x23fc('0x5f')](0x1)['then'](function(_0x3ec94){if(_0x3ec94['securePassword'])authService['validatePasswordPattern'](_0x551627[_0x23fc('0x35')]);db[_0x23fc('0x31')]['max'](_0x23fc('0x5d'))[_0x23fc('0x1d')](function(_0x186242){if(_[_0x23fc('0x60')](_0x186242)){_0x551627[_0x23fc('0x5d')]=_0x3ec94[_0x23fc('0x61')]||0x1;return;}if(_[_0x23fc('0x60')](_0x3ec94[_0x23fc('0x61')])||_0x3ec94['min_internal']===_0x186242){_0x551627[_0x23fc('0x5d')]=_0x186242+0x1;return;}if(_0x3ec94['min_internal']>_0x186242){_0x551627[_0x23fc('0x5d')]=_0x3ec94['min_internal'];return;}return db[_0x23fc('0x62')][_0x23fc('0x3e')](_0x23fc('0x63'),{'type':db['sequelize'][_0x23fc('0x64')][_0x23fc('0x65')]})['then'](function(_0x67df98){if(_0x67df98&&_0x67df98['length']){for(var _0x64e4ef=0x0,_0x261ce3=_0x67df98['length'];_0x64e4ef<_0x261ce3&&_[_0x23fc('0x60')](_0x551627[_0x23fc('0x5d')]);_0x64e4ef++){if(_0x3ec94[_0x23fc('0x61')]<=_0x67df98[_0x64e4ef][_0x23fc('0x66')]){_0x551627[_0x23fc('0x5d')]=_0x67df98[_0x64e4ef][_0x23fc('0x66')];}else if(_0x3ec94['min_internal']>_0x67df98[_0x64e4ef][_0x23fc('0x66')]&&_0x3ec94[_0x23fc('0x61')]<=_0x67df98[_0x64e4ef]['to']){_0x551627['internal']=_0x3ec94['min_internal'];}}}if(_[_0x23fc('0x60')](_0x551627[_0x23fc('0x5d')])){_0x551627['internal']=_0x186242+0x1;}return _0xb5b74a(_0x551627);});});})[_0x23fc('0x4f')](function(_0x5732b0){_0x55ed0d(_0x5732b0);});});}function updateUser(_0x20a0eb){return new Promise(function(_0x1ac8ab,_0x3a9814){try{if(_0x20a0eb['voicemail']){_0x20a0eb[_0x23fc('0x67')]=_0x20a0eb[_0x23fc('0x5d')];_0x20a0eb['VoiceMail']={'mailbox':_0x20a0eb[_0x23fc('0x5d')],'password':_0x20a0eb[_0x23fc('0x35')],'fullname':_0x20a0eb[_0x23fc('0x68')],'email':_0x20a0eb[_0x23fc('0x69')]};}if(_0x20a0eb[_0x23fc('0x1e')]===_0x23fc('0x6a')){if(!_0x20a0eb[_0x23fc('0x6b')])_0x20a0eb[_0x23fc('0x6b')]=[_0x23fc('0x6c'),'102','103','113',_0x23fc('0x6d'),_0x23fc('0x6e'),_0x23fc('0x6f'),'106','107',_0x23fc('0x70'),_0x23fc('0x71'),_0x23fc('0x72'),_0x23fc('0x73'),_0x23fc('0x74'),_0x23fc('0x75')];}_0x1ac8ab(_0x20a0eb);}catch(_0x554f8b){_0x3a9814(_0x554f8b);}});}exports[_0x23fc('0x76')]=function(_0x1e1175,_0x3e2351){if(_0x1e1175[_0x23fc('0x23')][_0x23fc('0x1e')]===_0x23fc('0x6a'))throw new Error('Unauthorized');if(_0x1e1175[_0x23fc('0x58')][_0x23fc('0x1e')]===_0x23fc('0x23')&&_0x1e1175[_0x23fc('0x23')]['role']!==_0x23fc('0x77')){throw new Error(_0x23fc('0x78'));}if(_0x1e1175[_0x23fc('0x58')][_0x23fc('0x1e')]===_0x23fc('0x77')&&_0x1e1175['user'][_0x23fc('0x1e')]!==_0x23fc('0x77')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x23fc('0x79')]([_0x1e1175[_0x23fc('0x58')]])[_0x23fc('0x1d')](function(){return validateUser(_0x1e1175['body']);})['then'](function(_0x32781d){return updateUser(_0x32781d)['then'](function(_0x3a3244){if(_0x3a3244[_0x23fc('0x1e')]==='admin'){_0x3a3244[_0x23fc('0x7a')]=_0x1e1175[_0x23fc('0x23')][_0x23fc('0x7a')];delete _0x3a3244[_0x23fc('0x7b')];}return _0x3a3244;});})[_0x23fc('0x1d')](function(_0x2bc440){return db[_0x23fc('0x31')]['create'](_0x2bc440,{'include':[{'model':db['VoiceMail'],'as':_0x23fc('0x7c')}]});})[_0x23fc('0x1d')](function(_0x373813){if(_0x1e1175['body'][_0x23fc('0x1e')]===_0x23fc('0x23'))return _0x373813;if(_0x1e1175[_0x23fc('0x23')][_0x23fc('0x1e')]!==_0x23fc('0x23'))return _0x373813;return db[_0x23fc('0x7d')]['find']({'where':{'name':_0x373813[_0x23fc('0x1e')]===_0x23fc('0x6a')?_0x23fc('0x24'):'Telephones','userProfileId':_0x1e1175[_0x23fc('0x23')]['userProfileId']},'raw':!![]})[_0x23fc('0x1d')](function(_0x1d6309){if(!_0x1d6309||_0x1d6309['autoAssociation']!=0x0)return _0x373813;return db[_0x23fc('0x2c')]['create']({'name':_0x373813[_0x23fc('0x2b')],'resourceId':_0x373813['id'],'type':_0x1d6309['name'],'sectionId':_0x1d6309['id']},{})[_0x23fc('0x1d')](function(){return _0x373813;});})[_0x23fc('0x4f')](function(_0xe475f1){logger[_0x23fc('0x2f')](_0x23fc('0x7e'),_0xe475f1);throw _0xe475f1;});})[_0x23fc('0x1d')](respondWithResult(_0x3e2351,0xc9))[_0x23fc('0x4f')](handleError(_0x3e2351,null));};exports[_0x23fc('0x7f')]=function(_0x253866,_0x135b40){var _0x1f89ad=_0x253866[_0x23fc('0x58')];var _0x37edfd=[];if(_0x253866[_0x23fc('0x23')][_0x23fc('0x1e')]===_0x23fc('0x6a'))throw new Error('Unauthorized');if(_[_0x23fc('0x80')](_0x1f89ad,[_0x23fc('0x1e'),_0x23fc('0x23')])&&_0x253866[_0x23fc('0x23')][_0x23fc('0x1e')]!==_0x23fc('0x77')){throw new Error(_0x23fc('0x78'));}if(_['some'](_0x1f89ad,['role',_0x23fc('0x77')])&&_0x253866[_0x23fc('0x23')][_0x23fc('0x1e')]!==_0x23fc('0x77')){throw new Error(_0x23fc('0x81'));}return licenseUtil[_0x23fc('0x79')](_0x1f89ad)[_0x23fc('0x1d')](function(){return validateUser(_0x1f89ad[0x0]);})[_0x23fc('0x1d')](function(){for(var _0x1c5d87=0x1;_0x1c5d87<_0x1f89ad[_0x23fc('0x49')];_0x1c5d87++){var _0x414690=_0x1f89ad[_0x1c5d87-0x1][_0x23fc('0x5d')];if(!_0x1f89ad[_0x1c5d87]['internal'])_0x1f89ad[_0x1c5d87][_0x23fc('0x5d')]=_0x414690+0x1;_0x37edfd[_0x23fc('0x44')](validateUser(_0x1f89ad[_0x1c5d87]));}return Promise['all'](_0x37edfd);})['then'](function(){_0x37edfd=[];for(var _0x1a1ee9=0x0;_0x1a1ee9<_0x1f89ad[_0x23fc('0x49')];_0x1a1ee9++){_0x37edfd[_0x23fc('0x44')](updateUser(_0x1f89ad[_0x1a1ee9]));}return Promise['all'](_0x37edfd);})['then'](function(){_0x37edfd=_0x1f89ad['map'](function(_0x14afc3){return db[_0x23fc('0x31')]['create'](_0x14afc3,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x23fc('0x1d')](function(_0x48bc40){_0x14afc3['id']=_0x48bc40['id'];return _0x14afc3;});});return Promise[_0x23fc('0x4e')](_0x37edfd);})['then'](function(_0x176e7e){if(_0x253866['body']['role']===_0x23fc('0x23'))return _0x176e7e;if(_0x253866[_0x23fc('0x23')][_0x23fc('0x1e')]!=='user')return _0x176e7e;var _0x2018fa=_[_0x23fc('0x80')](_0x176e7e,function(_0xca2d4a){return _0xca2d4a[_0x23fc('0x1e')]===_0x23fc('0x6a')||_0xca2d4a[_0x23fc('0x1e')]==='telephone';});if(!_0x2018fa)return _0x176e7e;return db[_0x23fc('0x7d')]['findAll']({'where':{'name':{'$or':[_0x23fc('0x24'),_0x23fc('0x25')]},'userProfileId':_0x253866[_0x23fc('0x23')]['userProfileId']},'raw':!![]})[_0x23fc('0x1d')](function(_0x2c9a92){if(_[_0x23fc('0x82')](_0x2c9a92)||!_[_0x23fc('0x80')](_0x2c9a92,[_0x23fc('0x83'),0x0]))return _0x176e7e;_0x37edfd=[];var _0x28b014=_(_0x2c9a92)['map'](function(_0x10b484){if(_0x10b484['autoAssociation']===0x1)return;return _0x10b484['name']===_0x23fc('0x24')?'agent':'telephone';})[_0x23fc('0x84')]()[_0x23fc('0x29')]();for(var _0x227bb7=0x0;_0x227bb7<_0x176e7e[_0x23fc('0x49')];_0x227bb7++){if(!_['includes'](_0x28b014,_0x176e7e[_0x227bb7][_0x23fc('0x1e')]))return;var _0x5ec47b=_0x176e7e[_0x227bb7][_0x23fc('0x1e')]==='agent'?_0x23fc('0x24'):_0x23fc('0x25');_0x37edfd['push'](db[_0x23fc('0x2c')][_0x23fc('0x76')]({'name':_0x176e7e[_0x227bb7][_0x23fc('0x2b')],'resourceId':_0x176e7e[_0x227bb7]['id'],'type':_0x5ec47b,'sectionId':_[_0x23fc('0x54')](_0x2c9a92,[_0x23fc('0x2b'),_0x5ec47b])['id']},{}));}return Promise['all'](_0x37edfd);});})[_0x23fc('0x1d')](respondWithResult(_0x135b40,0xc9))[_0x23fc('0x4f')](handleError(_0x135b40,null));};exports[_0x23fc('0x85')]=function(_0x190af0,_0x4654a9){if(_0x190af0[_0x23fc('0x58')]['id']){delete _0x190af0[_0x23fc('0x58')]['id'];}return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x190af0[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](function(_0xc7a862){if(!_0xc7a862)return null;if(_0xc7a862['id']===_0x190af0[_0x23fc('0x23')]['id']){if(!_0x190af0[_0x23fc('0x58')][_0x23fc('0x86')]||!_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]){throw new db[(_0x23fc('0x88'))]['ValidationError'](_0x23fc('0x89'));}if(!_0xc7a862['authenticate'](_0x190af0[_0x23fc('0x58')][_0x23fc('0x86')])){throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x8b'));}if(_0x190af0[_0x23fc('0x58')]['oldPassword']===_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]){throw new db[(_0x23fc('0x88'))]['ValidationError'](_0x23fc('0x8c'));}}else if(_0x190af0['user']['role']===_0x23fc('0x77')){if(!_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]){throw new db[(_0x23fc('0x88'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x190af0['user'][_0x23fc('0x1e')]==='user'){if(!_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]){throw new db[(_0x23fc('0x88'))]['ValidationError'](_0x23fc('0x8d'));}if(_0xc7a862['role']!==_0x23fc('0x6a')){throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x8e'));}}else{throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x8e'));}return _0xc7a862;})[_0x23fc('0x1d')](handleEntityNotFound(_0x4654a9,null))[_0x23fc('0x1d')](function(_0x4c0a5d){return db['Setting'][_0x23fc('0x8f')]({'attributes':['id',_0x23fc('0x90'),_0x23fc('0x91'),_0x23fc('0x92')]})[_0x23fc('0x1d')](function(_0x22a523){if(_0x22a523[_0x23fc('0x90')])authService[_0x23fc('0x93')](_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')]);if(!_0x22a523[_0x23fc('0x91')]||!_0x4c0a5d['previousPasswords'])return _0x4c0a5d;authService[_0x23fc('0x94')](_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')],_0x4c0a5d[_0x23fc('0x36')],_0x22a523['passwordHistoryLimit']);return _0x4c0a5d;})[_0x23fc('0x1d')](saveUpdates({'password':_0x190af0[_0x23fc('0x58')]['newPassword'],'passwordResetAt':_0x190af0[_0x23fc('0x23')]['id']==_0x190af0['params']['id']?moment():null,'previousPasswords':authService[_0x23fc('0x95')](_0x190af0[_0x23fc('0x58')][_0x23fc('0x87')],_0x4c0a5d[_0x23fc('0x36')])},null));})['then'](respondWithResult(_0x4654a9,null))['catch'](handleError(_0x4654a9,null));};exports['addQueues']=function(_0x5eac86,_0x5229d9){var _0x307971=_0x5eac86[_0x23fc('0x58')][_0x23fc('0x96')];return db[_0x23fc('0x31')]['find']({'where':{'id':_0x5eac86['params']['id']},'attributes':['id','name','role','online',_0x23fc('0x97'),_0x23fc('0x98'),_0x23fc('0x99')]})[_0x23fc('0x1d')](handleEntityNotFound(_0x5229d9,null))['then'](function(_0x2f05b4){if(_0x2f05b4){if(!utils[_0x23fc('0x9a')](_0x307971)){throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x9b'));}return _0x2f05b4[_0x23fc('0x9c')+_['capitalize'](_0x307971[_0x23fc('0x9d')]())+_0x23fc('0x9e')](_0x5eac86[_0x23fc('0x58')][_0x23fc('0x5b')],{'penalty':_0x5eac86[_0x23fc('0x58')][_0x23fc('0x9f')]||0x0})[_0x23fc('0xa0')](function(_0x2d392b){for(var _0x2459e9=0x0;_0x2459e9<_0x5eac86['body'][_0x23fc('0x5b')][_0x23fc('0x49')];_0x2459e9+=0x1){var _0x3a831a={'UserId':Number(_0x5eac86[_0x23fc('0x51')]['id'])};_0x3a831a[_[_0x23fc('0xa1')](_0x307971[_0x23fc('0x9d')]())+_0x23fc('0xa2')]=Number(_0x5eac86['body'][_0x23fc('0x5b')][_0x2459e9]);socket[_0x23fc('0x1f')](_0x23fc('0x23')+_[_0x23fc('0xa1')](_0x307971['toLowerCase']())+'Queue:save',_0x3a831a);}return _0x2d392b;})[_0x23fc('0x1d')](function(){if(_0x307971===_0x23fc('0xa3')){return db['VoiceQueue'][_0x23fc('0x45')]({'where':{'id':_0x5eac86[_0x23fc('0x58')][_0x23fc('0x5b')]||[]},'raw':!![],'attributes':['id',_0x23fc('0x2b')]});}})[_0x23fc('0x1d')](function(_0x22ad50){var _0x11b541=_0x2f05b4['get']({'plain':!![]});var _0x22e497=[];if(_0x307971===_0x23fc('0xa3')&&_0x11b541[_0x23fc('0x1e')]===_0x23fc('0x6a')&&_0x11b541['online']){for(let _0x2288b5=0x0;_0x2288b5<_0x22ad50['length'];_0x2288b5+=0x1){_0x22e497[_0x23fc('0x44')]({'membername':_0x11b541[_0x23fc('0x2b')],'UserId':_0x11b541['id'],'queue_name':_0x22ad50[_0x2288b5][_0x23fc('0x2b')],'VoiceQueueId':_0x22ad50[_0x2288b5]['id'],'interface':_[_0x23fc('0x60')](_0x11b541[_0x23fc('0x99')])?util[_0x23fc('0xa4')](_0x23fc('0xa5'),_0x11b541[_0x23fc('0x2b')]):_0x11b541['interface'],'paused':_0x11b541[_0x23fc('0x98')]||![],'penalty':_0x5eac86[_0x23fc('0x58')][_0x23fc('0x9f')]||0x0});}return Promise['all'](_0x22e497[_0x23fc('0x28')](function(_0x1e8ffa){return db[_0x23fc('0xa6')]['upsert'](_0x1e8ffa);}));}return _0x2f05b4;});}})[_0x23fc('0x1d')](respondWithStatusCode(_0x5229d9,null))['catch'](handleError(_0x5229d9,null));};exports['removeQueues']=function(_0x191062,_0x43a842){var _0x76e829,_0xe04e6e;return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x191062[_0x23fc('0x51')]['id']},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e')]})[_0x23fc('0x1d')](handleEntityNotFound(_0x43a842,null))['then'](function(_0x11b705){if(_0x11b705){_0x76e829=_0x11b705;if(!_0x191062[_0x23fc('0x3e')][_0x23fc('0x96')]||!utils['isValidChannel'](_0x191062[_0x23fc('0x3e')][_0x23fc('0x96')])){throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0x9b'));}return _0x11b705[_0x23fc('0xa7')+_[_0x23fc('0xa1')](_0x191062['query'][_0x23fc('0x96')][_0x23fc('0x9d')]())+_0x23fc('0x9e')](_0x191062['query'][_0x23fc('0x5b')]);}})[_0x23fc('0x1d')](function(_0x307cf0){if(_[_0x23fc('0xa8')](_0x191062['query']['ids'])){for(var _0x3ea0dc=0x0;_0x3ea0dc<_0x191062[_0x23fc('0x3e')][_0x23fc('0x5b')][_0x23fc('0x49')];_0x3ea0dc+=0x1){_0xe04e6e={'UserId':Number(_0x191062[_0x23fc('0x51')]['id'])};_0xe04e6e[_['capitalize'](_0x191062[_0x23fc('0x3e')][_0x23fc('0x96')][_0x23fc('0x9d')]())+_0x23fc('0xa2')]=Number(_0x191062[_0x23fc('0x3e')][_0x23fc('0x5b')][_0x3ea0dc]);socket[_0x23fc('0x1f')](_0x23fc('0x23')+_[_0x23fc('0xa1')](_0x191062['query'][_0x23fc('0x96')][_0x23fc('0x9d')]())+_0x23fc('0xa9'),_0xe04e6e);}}else{_0xe04e6e={'UserId':Number(_0x191062[_0x23fc('0x51')]['id'])};_0xe04e6e[_[_0x23fc('0xa1')](_0x191062[_0x23fc('0x3e')]['channel'][_0x23fc('0x9d')]())+_0x23fc('0xa2')]=Number(_0x191062[_0x23fc('0x3e')]['ids']);socket[_0x23fc('0x1f')](_0x23fc('0x23')+_[_0x23fc('0xa1')](_0x191062[_0x23fc('0x3e')][_0x23fc('0x96')][_0x23fc('0x9d')]())+_0x23fc('0xa9'),_0xe04e6e);}return _0x307cf0;})['then'](function(){if(_0x191062['query']['channel']==='voice'){return db[_0x23fc('0xa6')]['destroy']({'where':{'UserId':_0x191062['params']['id'],'VoiceQueueId':_0x191062[_0x23fc('0x3e')][_0x23fc('0x5b')]},'individualHooks':!![]})[_0x23fc('0x1d')](function(){return _0x76e829;});}return _0x76e829;})[_0x23fc('0x1d')](respondWithStatusCode(_0x43a842,null))[_0x23fc('0x4f')](handleError(_0x43a842,null));};exports[_0x23fc('0xaa')]=function(_0x5233f9,_0x2ae71a){_0x5233f9['body'][_0x23fc('0xab')]=_0x5233f9[_0x23fc('0xac')][_0x23fc('0xad')];return db[_0x23fc('0x31')]['find']({'where':{'id':_0x5233f9[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x2ae71a,null))[_0x23fc('0x1d')](saveUpdates(_0x5233f9[_0x23fc('0x58')],null))['then'](respondWithResult(_0x2ae71a,null))[_0x23fc('0x4f')](handleError(_0x2ae71a,null));};exports[_0x23fc('0xae')]=function(_0xa705d6,_0x174d57){var _0x1a89c7=path['join'](config[_0x23fc('0xaf')],'server/files/images/logos/default_profile.png');return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0xa705d6[_0x23fc('0x51')]['id']},'attributes':['id',_0x23fc('0xab')],'raw':!![]})[_0x23fc('0x1d')](handleEntityNotFound(_0x174d57,null))[_0x23fc('0x1d')](function(_0x505b93){if(_0x505b93){if(_[_0x23fc('0x60')](_0x505b93[_0x23fc('0xab')])){return _0x174d57[_0x23fc('0xb0')](_0x1a89c7);}else{if(!fs['existsSync'](path[_0x23fc('0xb1')](config[_0x23fc('0xaf')],_0x23fc('0xb2'),_0x505b93['userpic']))){return _0x174d57[_0x23fc('0xb0')](_0x1a89c7);}return _0x174d57[_0x23fc('0xb0')](path['join'](config['root'],_0x23fc('0xb2'),_0x505b93[_0x23fc('0xab')]));}}})[_0x23fc('0x4f')](handleError(_0x174d57,null));};exports[_0x23fc('0xb3')]=function(_0x1392f1,_0x3c2a36){return db['User'][_0x23fc('0x54')]({'where':{'id':_0x1392f1['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3c2a36,null))[_0x23fc('0x1d')](function(_0x2d7fec){var _0xa5927a=[];values=_0x2d7fec[_0x23fc('0x4a')];_0xa5927a[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x55'),_0x2d7fec['dataValues']));_0xa5927a['push'](get_open_tabs('sms',_0x2d7fec[_0x23fc('0x4a')]));_0xa5927a[_0x23fc('0x44')](get_open_tabs(_0x23fc('0x56'),_0x2d7fec[_0x23fc('0x4a')]));_0xa5927a[_0x23fc('0x44')](get_open_tabs('whatsapp',_0x2d7fec['dataValues']));_0xa5927a['push'](get_open_tabs(_0x23fc('0x4c'),_0x2d7fec[_0x23fc('0x4a')]));_0xa5927a[_0x23fc('0x44')](get_open_tabs('mail',_0x2d7fec['dataValues']));return Promise[_0x23fc('0x4e')](_0xa5927a);})[_0x23fc('0x1d')](function(_0x1e3a91){if(_0x1e3a91){var _0xbf76e2=_[_0x23fc('0x28')](values[_0x23fc('0xb4')],function(_0x5996e2){return{'channel':_0x23fc('0xb5'),'id':_0x5996e2['id'],'createdAt':_0x5996e2[_0x23fc('0xb6')]};});var _0x49593b=_[_0x23fc('0x28')](values['FaxOpenTabs'],function(_0x3b8d19){return{'channel':_0x23fc('0xb7'),'id':_0x3b8d19['id'],'createdAt':_0x3b8d19['createdAt']};});var _0xbfcd4=_['map'](values[_0x23fc('0xb8')],function(_0x40a3fb){return{'channel':_0x23fc('0xb9'),'id':_0x40a3fb['id'],'createdAt':_0x40a3fb['createdAt']};});var _0x14dbff=_[_0x23fc('0x28')](values[_0x23fc('0xba')],function(_0x39f5d1){return{'channel':_0x23fc('0xbb'),'id':_0x39f5d1['id'],'createdAt':_0x39f5d1[_0x23fc('0xb6')]};});var _0x268785=_[_0x23fc('0x28')](values[_0x23fc('0xbc')],function(_0xba5e5f){return{'channel':'SMS','id':_0xba5e5f['id'],'createdAt':_0xba5e5f['createdAt']};});var _0x4d9523=_[_0x23fc('0x28')](values[_0x23fc('0xbd')],function(_0x2d46c0){return{'channel':_0x23fc('0xbe'),'id':_0x2d46c0['id'],'createdAt':_0x2d46c0[_0x23fc('0xb6')]};});var _0x311308=_['concat'](_0xbf76e2,_0x49593b,_0xbfcd4,_0x14dbff,_0x268785,_0x4d9523);var _0x4364f6={'count':_0x311308['length'],'rows':_0x311308};return _0x4364f6;}else return null;})[_0x23fc('0x1d')](respondWithResult(_0x3c2a36,null))['catch'](handleError(_0x3c2a36,null));};exports[_0x23fc('0xbf')]=function(_0x23d8df,_0x5dc816){var _0x554724={};return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x23d8df[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](function(_0x3ed3e9){if(!_0x3ed3e9){throw new APINotFoundError(util[_0x23fc('0xa4')](_0x23fc('0xc0'),_0x23d8df[_0x23fc('0x51')]['id']));}return contacts['describe']();})[_0x23fc('0x1d')](function(_0x19bad3){_0x23d8df[_0x23fc('0x3e')]['User']=_0x23d8df[_0x23fc('0x51')]['id'];_0x554724=qs['getOptions'](_0x19bad3,_0x23d8df);if(_0x23d8df[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0x3f'))){_0x554724[_0x23fc('0x40')]=[{'model':db[_0x23fc('0xc2')],'as':_0x23fc('0xc3'),'required':![]},{'model':db[_0x23fc('0xc4')],'as':_0x23fc('0xc5'),'attributes':['id',_0x23fc('0x2b'),'color'],'where':_0x23d8df[_0x23fc('0x3e')][_0x23fc('0xc6')]?{'id':_0x23d8df[_0x23fc('0x3e')][_0x23fc('0xc6')]}:undefined,'required':_0x23d8df['query'][_0x23fc('0xc6')]?!![]:![]}];}return contacts[_0x23fc('0x45')](_0x23d8df[_0x23fc('0x3e')],_0x23d8df[_0x23fc('0x23')],_0x554724,_0x19bad3);})[_0x23fc('0x1d')](respondWithFilteredResult(_0x5dc816,_0x554724))['catch'](APIHandleError(_0x5dc816));};exports[_0x23fc('0xc7')]=function(_0x59b4e1,_0x361a09){var _0x438d4b;var _0x2a7244={};var _0x1bd764;return db['User']['findOne']({'where':{'id':_0x59b4e1['params']['id']},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e')]})[_0x23fc('0x1d')](handleEntityNotFound(_0x361a09,null))['then'](function(_0x423c3d){if(!utils[_0x23fc('0x9a')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x96')])){throw new db[(_0x23fc('0x88'))]['ValidationError'](_0x23fc('0x9b'));}_0x438d4b=_0x423c3d;var _0x298279={};_0x298279[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_[_0x23fc('0xa1')](_0x59b4e1['query'][_0x23fc('0x96')])+_0x23fc('0xca')]['rawAttributes']);_0x298279[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x59b4e1[_0x23fc('0x3e')]);_0x298279[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x298279[_0x23fc('0xc8')],_0x298279['query']);_0x2a7244[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x298279[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x2a7244['attributes']=_0x2a7244[_0x23fc('0x43')][_0x23fc('0x49')]?_0x2a7244[_0x23fc('0x43')]:_0x298279[_0x23fc('0xc8')];_0x2a7244[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x2a7244[_0x23fc('0x3c')]=qs['filters'](_['pick'](_0x59b4e1[_0x23fc('0x3e')],_0x298279[_0x23fc('0xcb')]));if(_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x2a7244[_0x23fc('0x3c')]=_['merge'](_0x2a7244['where'],{'$or':_['map'](_0x2a7244[_0x23fc('0x43')],function(_0x5d5a72){var _0x5bae8d={};_0x5bae8d[_0x5d5a72]={'$like':'%'+_0x59b4e1[_0x23fc('0x3e')]['filter']+'%'};return _0x5bae8d;})});}_0x2a7244=_[_0x23fc('0x52')]({},_0x2a7244,_0x59b4e1[_0x23fc('0x53')]);switch(_0x438d4b[_0x23fc('0x1e')]){case _0x23fc('0x77'):return db[_[_0x23fc('0xa1')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x96')])+'Queue'][_0x23fc('0x45')](_0x2a7244);case _0x23fc('0x23'):case _0x23fc('0x6a'):return _0x438d4b[_0x23fc('0x21')+_[_0x23fc('0xa1')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x96')])+_0x23fc('0x9e')](_0x2a7244);default:throw new db[(_0x23fc('0x88'))]['ValidationError']('Unknown\x20role');}})[_0x23fc('0x1d')](function(_0x3c966d){_0x1bd764=_0x3c966d[_0x23fc('0x49')];if(!_0x59b4e1[_0x23fc('0x3e')]['hasOwnProperty'](_0x23fc('0xd0'))){_0x2a7244[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x2a7244[_0x23fc('0x17')]=qs['offset'](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x17')]);}switch(_0x438d4b[_0x23fc('0x1e')]){case _0x23fc('0x77'):return db[_[_0x23fc('0xa1')](_0x59b4e1['query']['channel'])+_0x23fc('0xca')][_0x23fc('0x45')](_0x2a7244);case _0x23fc('0x23'):case _0x23fc('0x6a'):return _0x438d4b[_0x23fc('0x21')+_[_0x23fc('0xa1')](_0x59b4e1[_0x23fc('0x3e')][_0x23fc('0x96')])+'Queues'](_0x2a7244);}})[_0x23fc('0x1d')](function(_0x5b46a7){return{'count':_0x1bd764,'rows':_0x5b46a7};})[_0x23fc('0x1d')](respondWithResult(_0x361a09,null))[_0x23fc('0x4f')](handleError(_0x361a09,null));};exports[_0x23fc('0xd1')]=function(_0x31c2b5,_0x2c9027){var _0xb4b7ea={};var _0x34ddf8={};var _0x14fece;var _0x258fee;return db[_0x23fc('0x31')]['findOne']({'where':{'id':_0x31c2b5['params']['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x2c9027,null))[_0x23fc('0x1d')](function(_0xb4eebf){if(_0xb4eebf){_0x14fece=_0xb4eebf;_0x34ddf8[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xa6')][_0x23fc('0x32')]);_0x34ddf8[_0x23fc('0x3e')]=_['keys'](_0x31c2b5[_0x23fc('0x3e')]);_0x34ddf8[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x34ddf8[_0x23fc('0xc8')],_0x34ddf8[_0x23fc('0x3e')]);_0xb4b7ea[_0x23fc('0x43')]=_['intersection'](_0x34ddf8['model'],qs[_0x23fc('0xcd')](_0x31c2b5[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0xb4b7ea[_0x23fc('0x43')]=_0xb4b7ea[_0x23fc('0x43')]['length']?_0xb4b7ea[_0x23fc('0x43')]:_0x34ddf8[_0x23fc('0xc8')];_0xb4b7ea[_0x23fc('0xce')]=qs['sort'](_0x31c2b5['query'][_0x23fc('0xcf')]);_0xb4b7ea[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x31c2b5[_0x23fc('0x3e')],_0x34ddf8[_0x23fc('0xcb')]));if(_0x31c2b5['query'][_0x23fc('0x26')]){_0xb4b7ea[_0x23fc('0x3c')]=_['merge'](_0xb4b7ea['where'],{'$or':_['map'](_0xb4b7ea['attributes'],function(_0x53d679){var _0x5cceef={};_0x5cceef[_0x53d679]={'$like':'%'+_0x31c2b5[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x5cceef;})});}_0xb4b7ea=_[_0x23fc('0x52')]({},_0xb4b7ea,_0x31c2b5[_0x23fc('0x53')]);return _0x14fece[_0x23fc('0xd1')](_0xb4b7ea);}})[_0x23fc('0x1d')](function(_0x33f99e){if(_0x33f99e){_0x258fee=_0x33f99e[_0x23fc('0x49')];if(!_0x31c2b5['query'][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0xb4b7ea[_0x23fc('0x19')]=qs['limit'](_0x31c2b5['query']['limit']);_0xb4b7ea[_0x23fc('0x17')]=qs['offset'](_0x31c2b5[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x14fece['getVoiceQueuesRt'](_0xb4b7ea);}})[_0x23fc('0x1d')](function(_0x9e5687){if(_0x9e5687){return _0x9e5687?{'count':_0x258fee,'rows':_0x9e5687}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x2c9027,null))[_0x23fc('0x4f')](handleError(_0x2c9027,null));};exports[_0x23fc('0xd3')]=function(_0x147de5,_0x5ad8ab){var _0x1f20e7={};var _0x3b115b={};var _0x283f71;var _0x34ba2d;return db['User'][_0x23fc('0x8f')]({'where':{'id':_0x147de5[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ad8ab,null))['then'](function(_0x544134){if(_0x544134){_0x283f71=_0x544134;_0x3b115b[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xd4')][_0x23fc('0x32')]);_0x3b115b[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x147de5[_0x23fc('0x3e')]);_0x3b115b['filters']=_[_0x23fc('0xcc')](_0x3b115b[_0x23fc('0xc8')],_0x3b115b['query']);_0x1f20e7['attributes']=_[_0x23fc('0xcc')](_0x3b115b[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x147de5['query']['fields']));_0x1f20e7[_0x23fc('0x43')]=_0x1f20e7['attributes']['length']?_0x1f20e7['attributes']:_0x3b115b[_0x23fc('0xc8')];_0x1f20e7[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x147de5['query'][_0x23fc('0xcf')]);_0x1f20e7[_0x23fc('0x3c')]=qs['filters'](_[_0x23fc('0xd2')](_0x147de5[_0x23fc('0x3e')],_0x3b115b['filters']));if(_0x147de5[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x1f20e7['where']=_['merge'](_0x1f20e7[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x1f20e7['attributes'],function(_0x2745bb){var _0x4e0816={};_0x4e0816[_0x2745bb]={'$like':'%'+_0x147de5[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x4e0816;})});}_0x1f20e7=_[_0x23fc('0x52')]({},_0x1f20e7,_0x147de5['options']);return _0x283f71[_0x23fc('0xd3')](_0x1f20e7);}})[_0x23fc('0x1d')](function(_0x10fc53){if(_0x10fc53){_0x34ba2d=_0x10fc53['length'];if(!_0x147de5[_0x23fc('0x3e')]['hasOwnProperty'](_0x23fc('0xd0'))){_0x1f20e7['limit']=qs['limit'](_0x147de5[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x1f20e7[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x147de5[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x283f71[_0x23fc('0xd3')](_0x1f20e7);}})['then'](function(_0x1e189a){if(_0x1e189a){return _0x1e189a?{'count':_0x34ba2d,'rows':_0x1e189a}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x5ad8ab,null))[_0x23fc('0x4f')](handleError(_0x5ad8ab,null));};exports[_0x23fc('0xd5')]=function(_0x565e6c,_0x9b0652){var _0x75d8ba={'raw':!![],'where':{}};var _0x5e046d={};var _0x527e53={'count':0x0,'rows':[]};return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x565e6c[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x9b0652,null))['then'](function(_0x5e7b45){if(_0x5e7b45){_0x5e046d[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xd6')][_0x23fc('0x32')]);_0x5e046d[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x565e6c[_0x23fc('0x3e')]);_0x5e046d[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x5e046d['model'],_0x5e046d['query']);_0x75d8ba[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x5e046d[_0x23fc('0xc8')],qs['fields'](_0x565e6c[_0x23fc('0x3e')]['fields']));_0x75d8ba[_0x23fc('0x43')]=_0x75d8ba[_0x23fc('0x43')][_0x23fc('0x49')]?_0x75d8ba[_0x23fc('0x43')]:_0x5e046d[_0x23fc('0xc8')];if(!_0x565e6c[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x75d8ba[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x565e6c[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x75d8ba[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x565e6c[_0x23fc('0x3e')][_0x23fc('0x17')]);}_0x75d8ba[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x565e6c[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x75d8ba['where']=qs[_0x23fc('0xcb')](_['pick'](_0x565e6c[_0x23fc('0x3e')],_0x5e046d[_0x23fc('0xcb')]));_0x75d8ba['where']['UserId']=_0x5e7b45['id'];if(_0x565e6c['query'][_0x23fc('0x26')]){_0x75d8ba[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x75d8ba[_0x23fc('0x3c')],{'$or':_['map'](_0x75d8ba['attributes'],function(_0x30a2f7){var _0x4d9896={};_0x4d9896[_0x30a2f7]={'$like':'%'+_0x565e6c[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x4d9896;})});}_0x75d8ba=_['merge']({},_0x75d8ba,_0x565e6c['options']);return db[_0x23fc('0xd6')]['count']({'where':_0x75d8ba[_0x23fc('0x3c')]})['then'](function(_0x313e54){_0x527e53[_0x23fc('0x3d')]=_0x313e54;if(_0x565e6c[_0x23fc('0x3e')][_0x23fc('0x3f')]){_0x75d8ba[_0x23fc('0x40')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x75d8ba);})['then'](function(_0x4533fa){_0x527e53['rows']=_0x4533fa;return _0x527e53;});}})[_0x23fc('0x1d')](respondWithFilteredResult(_0x9b0652,_0x75d8ba))[_0x23fc('0x4f')](handleError(_0x9b0652,null));};exports['getScreenRecordings']=function(_0x47a47e,_0x67354b){var _0x1cc02c={'raw':!![],'where':{}};var _0x3919d0={};var _0x3fe8cc={'count':0x0,'rows':[]};return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x47a47e[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x67354b,null))[_0x23fc('0x1d')](function(_0x4ffa29){if(_0x4ffa29){_0x3919d0[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db['ScreenRecording'][_0x23fc('0x32')]);_0x3919d0[_0x23fc('0x3e')]=_['keys'](_0x47a47e[_0x23fc('0x3e')]);_0x3919d0[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x3919d0[_0x23fc('0xc8')],_0x3919d0[_0x23fc('0x3e')]);_0x1cc02c[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x3919d0[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x47a47e[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x1cc02c[_0x23fc('0x43')]=_0x1cc02c[_0x23fc('0x43')][_0x23fc('0x49')]?_0x1cc02c['attributes']:_0x3919d0[_0x23fc('0xc8')];if(!_0x47a47e['query'][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x1cc02c[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x47a47e[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x1cc02c[_0x23fc('0x17')]=qs['offset'](_0x47a47e['query']['offset']);}_0x1cc02c[_0x23fc('0xce')]=qs['sort'](_0x47a47e[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x1cc02c[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x47a47e[_0x23fc('0x3e')],_0x3919d0[_0x23fc('0xcb')]));_0x1cc02c['where'][_0x23fc('0xd7')]=_0x4ffa29['id'];if(_0x47a47e[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x1cc02c['where']=_[_0x23fc('0x52')](_0x1cc02c[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x1cc02c[_0x23fc('0x43')],function(_0x149ee7){var _0x5807dc={};_0x5807dc[_0x149ee7]={'$like':'%'+_0x47a47e[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x5807dc;})});}_0x1cc02c=_[_0x23fc('0x52')]({},_0x1cc02c,_0x47a47e[_0x23fc('0x53')]);return db['ScreenRecording']['count']({'where':_0x1cc02c[_0x23fc('0x3c')]})[_0x23fc('0x1d')](function(_0x542ff1){_0x3fe8cc['count']=_0x542ff1;if(_0x47a47e[_0x23fc('0x3e')]['includeAll']){_0x1cc02c[_0x23fc('0x40')]=[{'all':!![]}];}return db[_0x23fc('0xd8')][_0x23fc('0x45')](_0x1cc02c);})[_0x23fc('0x1d')](function(_0x1c11a6){_0x3fe8cc[_0x23fc('0x46')]=_0x1c11a6;return _0x3fe8cc;});}})[_0x23fc('0x1d')](respondWithFilteredResult(_0x67354b,_0x1cc02c))[_0x23fc('0x4f')](handleError(_0x67354b,null));};exports[_0x23fc('0xd9')]=function(_0x4ed80a,_0x23be03){var _0x2dd7f3={};var _0x48a108={};var _0x2c71fc;var _0x124583;return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x4ed80a['params']['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x23be03,null))[_0x23fc('0x1d')](function(_0x2eadf0){if(_0x2eadf0){_0x2c71fc=_0x2eadf0;_0x48a108['model']=_[_0x23fc('0xc9')](db[_0x23fc('0xda')][_0x23fc('0x32')]);_0x48a108[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x4ed80a[_0x23fc('0x3e')]);_0x48a108['filters']=_['intersection'](_0x48a108[_0x23fc('0xc8')],_0x48a108[_0x23fc('0x3e')]);_0x2dd7f3[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x48a108[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x4ed80a[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x2dd7f3[_0x23fc('0x43')]=_0x2dd7f3[_0x23fc('0x43')][_0x23fc('0x49')]?_0x2dd7f3['attributes']:_0x48a108[_0x23fc('0xc8')];_0x2dd7f3[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x4ed80a[_0x23fc('0x3e')]['sort']);_0x2dd7f3[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_['pick'](_0x4ed80a[_0x23fc('0x3e')],_0x48a108[_0x23fc('0xcb')]));if(_0x4ed80a[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x2dd7f3['where']=_[_0x23fc('0x52')](_0x2dd7f3[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x2dd7f3[_0x23fc('0x43')],function(_0x2d57de){var _0x2b4fe5={};_0x2b4fe5[_0x2d57de]={'$like':'%'+_0x4ed80a[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x2b4fe5;})});}_0x2dd7f3=_[_0x23fc('0x52')]({},_0x2dd7f3,_0x4ed80a[_0x23fc('0x53')]);return _0x2c71fc[_0x23fc('0xd9')](_0x2dd7f3);}})[_0x23fc('0x1d')](function(_0x1ce147){if(_0x1ce147){_0x124583=_0x1ce147['length'];if(!_0x4ed80a['query']['hasOwnProperty']('nolimit')){_0x2dd7f3[_0x23fc('0x19')]=qs['limit'](_0x4ed80a['query'][_0x23fc('0x19')]);_0x2dd7f3[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x4ed80a['query'][_0x23fc('0x17')]);}return _0x2c71fc[_0x23fc('0xd9')](_0x2dd7f3);}})[_0x23fc('0x1d')](function(_0x38509c){if(_0x38509c){return _0x38509c?{'count':_0x124583,'rows':_0x38509c}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x23be03,null))[_0x23fc('0x4f')](handleError(_0x23be03,null));};exports['getOpenchannelInteractions']=function(_0x347a06,_0xbe5b9f){var _0x9fe527={};var _0x5125e5={};var _0x4e3338;var _0x5d7dee;return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x347a06[_0x23fc('0x51')]['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0xbe5b9f,null))[_0x23fc('0x1d')](function(_0x4f26b9){if(_0x4f26b9){_0x4e3338=_0x4f26b9;_0x5125e5[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xdb')][_0x23fc('0x32')]);_0x5125e5['query']=_[_0x23fc('0xc9')](_0x347a06['query']);_0x5125e5[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x5125e5[_0x23fc('0xc8')],_0x5125e5[_0x23fc('0x3e')]);_0x9fe527['attributes']=_[_0x23fc('0xcc')](_0x5125e5[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x347a06[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x9fe527[_0x23fc('0x43')]=_0x9fe527[_0x23fc('0x43')]['length']?_0x9fe527[_0x23fc('0x43')]:_0x5125e5[_0x23fc('0xc8')];_0x9fe527['order']=qs[_0x23fc('0xcf')](_0x347a06[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x9fe527[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_['pick'](_0x347a06[_0x23fc('0x3e')],_0x5125e5[_0x23fc('0xcb')]));if(_0x347a06[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x9fe527[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x9fe527[_0x23fc('0x3c')],{'$or':_['map'](_0x9fe527[_0x23fc('0x43')],function(_0x1fa36d){var _0x506a3c={};_0x506a3c[_0x1fa36d]={'$like':'%'+_0x347a06[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x506a3c;})});}_0x9fe527=_[_0x23fc('0x52')]({},_0x9fe527,_0x347a06['options']);return _0x4e3338[_0x23fc('0xdc')](_0x9fe527);}})[_0x23fc('0x1d')](function(_0x3d696c){if(_0x3d696c){_0x5d7dee=_0x3d696c[_0x23fc('0x49')];if(!_0x347a06[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x9fe527['limit']=qs['limit'](_0x347a06[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x9fe527['offset']=qs[_0x23fc('0x17')](_0x347a06[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x4e3338[_0x23fc('0xdc')](_0x9fe527);}})['then'](function(_0xf6cd9c){if(_0xf6cd9c){return _0xf6cd9c?{'count':_0x5d7dee,'rows':_0xf6cd9c}:null;}})[_0x23fc('0x1d')](respondWithResult(_0xbe5b9f,null))[_0x23fc('0x4f')](handleError(_0xbe5b9f,null));};exports[_0x23fc('0xdd')]=function(_0x168cda,_0x38bf35){var _0x361559={'raw':!![],'where':{}};var _0x56b7c8={};var _0x560f61={'count':0x0,'rows':[]};return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x168cda['params']['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x38bf35,null))[_0x23fc('0x1d')](function(_0x19d642){if(_0x19d642){_0x56b7c8[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xde')][_0x23fc('0x32')]);_0x56b7c8[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x168cda['query']);_0x56b7c8[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x56b7c8[_0x23fc('0xc8')],_0x56b7c8['query']);_0x361559['attributes']=_[_0x23fc('0xcc')](_0x56b7c8[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x168cda[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x361559[_0x23fc('0x43')]=_0x361559['attributes'][_0x23fc('0x49')]?_0x361559[_0x23fc('0x43')]:_0x56b7c8[_0x23fc('0xc8')];if(!_0x168cda[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x361559['limit']=qs[_0x23fc('0x19')](_0x168cda[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x361559[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x168cda[_0x23fc('0x3e')][_0x23fc('0x17')]);}_0x361559[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x168cda['query']['sort']);_0x361559[_0x23fc('0x3c')]=qs['filters'](_[_0x23fc('0xd2')](_0x168cda['query'],_0x56b7c8[_0x23fc('0xcb')]));_0x361559[_0x23fc('0x3c')][_0x23fc('0xd7')]=_0x19d642['id'];if(_0x168cda[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x361559[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x361559[_0x23fc('0x3c')],{'$or':_['map'](_0x361559[_0x23fc('0x43')],function(_0x4298fc){var _0x319754={};_0x319754[_0x4298fc]={'$like':'%'+_0x168cda[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x319754;})});}_0x361559=_[_0x23fc('0x52')]({},_0x361559,_0x168cda[_0x23fc('0x53')]);return db['MailInteraction']['count']({'where':_0x361559['where']})[_0x23fc('0x1d')](function(_0x3873d0){_0x560f61['count']=_0x3873d0;if(_0x168cda[_0x23fc('0x3e')]['includeAll']){_0x361559['include']=[{'all':!![]}];}return db[_0x23fc('0xde')][_0x23fc('0x45')](_0x361559);})[_0x23fc('0x1d')](function(_0x517587){_0x560f61[_0x23fc('0x46')]=_0x517587;return _0x560f61;});}})[_0x23fc('0x1d')](respondWithFilteredResult(_0x38bf35,_0x361559))[_0x23fc('0x4f')](handleError(_0x38bf35,null));};exports[_0x23fc('0xdf')]=function(_0x3861d7,_0x444886){var _0xc0eae4={};var _0x308dfa={};var _0xc9eb8b;var _0x5dea62;return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x3861d7[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x444886,null))['then'](function(_0x5138a9){if(_0x5138a9){_0xc9eb8b=_0x5138a9;_0x308dfa[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xe0')][_0x23fc('0x32')]);_0x308dfa[_0x23fc('0x3e')]=_['keys'](_0x3861d7[_0x23fc('0x3e')]);_0x308dfa['filters']=_[_0x23fc('0xcc')](_0x308dfa[_0x23fc('0xc8')],_0x308dfa[_0x23fc('0x3e')]);_0xc0eae4[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x308dfa['model'],qs[_0x23fc('0xcd')](_0x3861d7[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0xc0eae4[_0x23fc('0x43')]=_0xc0eae4[_0x23fc('0x43')][_0x23fc('0x49')]?_0xc0eae4[_0x23fc('0x43')]:_0x308dfa[_0x23fc('0xc8')];_0xc0eae4[_0x23fc('0xce')]=qs['sort'](_0x3861d7['query'][_0x23fc('0xcf')]);_0xc0eae4[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x3861d7[_0x23fc('0x3e')],_0x308dfa[_0x23fc('0xcb')]));if(_0x3861d7['query']['filter']){_0xc0eae4['where']=_[_0x23fc('0x52')](_0xc0eae4[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0xc0eae4[_0x23fc('0x43')],function(_0xb20715){var _0x15af86={};_0x15af86[_0xb20715]={'$like':'%'+_0x3861d7[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x15af86;})});}_0xc0eae4=_[_0x23fc('0x52')]({},_0xc0eae4,_0x3861d7[_0x23fc('0x53')]);return _0xc9eb8b['getSmsInteractions'](_0xc0eae4);}})[_0x23fc('0x1d')](function(_0x17106e){if(_0x17106e){_0x5dea62=_0x17106e[_0x23fc('0x49')];if(!_0x3861d7['query'][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0xc0eae4[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x3861d7['query'][_0x23fc('0x19')]);_0xc0eae4['offset']=qs[_0x23fc('0x17')](_0x3861d7['query']['offset']);}return _0xc9eb8b[_0x23fc('0xdf')](_0xc0eae4);}})[_0x23fc('0x1d')](function(_0x1df71c){if(_0x1df71c){return _0x1df71c?{'count':_0x5dea62,'rows':_0x1df71c}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x444886,null))[_0x23fc('0x4f')](handleError(_0x444886,null));};exports[_0x23fc('0xe1')]=function(_0x3b3f6a,_0x1496f7){var _0x118969={};var _0x57657f={};var _0x3e2f3d;var _0x598061;return db[_0x23fc('0x31')]['findOne']({'where':{'id':_0x3b3f6a[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x1496f7,null))['then'](function(_0xf27a4c){if(_0xf27a4c){_0x3e2f3d=_0xf27a4c;_0x57657f['model']=_[_0x23fc('0xc9')](db[_0x23fc('0xe2')][_0x23fc('0x32')]);_0x57657f[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x3b3f6a[_0x23fc('0x3e')]);_0x57657f[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x57657f[_0x23fc('0xc8')],_0x57657f[_0x23fc('0x3e')]);_0x118969['attributes']=_[_0x23fc('0xcc')](_0x57657f['model'],qs['fields'](_0x3b3f6a[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x118969[_0x23fc('0x43')]=_0x118969[_0x23fc('0x43')]['length']?_0x118969[_0x23fc('0x43')]:_0x57657f[_0x23fc('0xc8')];_0x118969['order']=qs[_0x23fc('0xcf')](_0x3b3f6a[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x118969[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x3b3f6a[_0x23fc('0x3e')],_0x57657f['filters']));if(_0x3b3f6a[_0x23fc('0x3e')]['filter']){_0x118969[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x118969[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x118969[_0x23fc('0x43')],function(_0x139d54){var _0x29cd61={};_0x29cd61[_0x139d54]={'$like':'%'+_0x3b3f6a[_0x23fc('0x3e')]['filter']+'%'};return _0x29cd61;})});}_0x118969=_[_0x23fc('0x52')]({},_0x118969,_0x3b3f6a[_0x23fc('0x53')]);return _0x3e2f3d[_0x23fc('0xe1')](_0x118969);}})['then'](function(_0x31f3ba){if(_0x31f3ba){_0x598061=_0x31f3ba['length'];if(!_0x3b3f6a[_0x23fc('0x3e')]['hasOwnProperty'](_0x23fc('0xd0'))){_0x118969[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x3b3f6a[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x118969['offset']=qs[_0x23fc('0x17')](_0x3b3f6a[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x3e2f3d['getFaxInteractions'](_0x118969);}})[_0x23fc('0x1d')](function(_0x507dae){if(_0x507dae){return _0x507dae?{'count':_0x598061,'rows':_0x507dae}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x1496f7,null))[_0x23fc('0x4f')](handleError(_0x1496f7,null));};exports[_0x23fc('0xe3')]=function(_0x51eee1,_0x57ef1e){var _0x3f8a02={};var _0xde6b94={};var _0x1c9bd9;var _0xc1ca7c;return db['User']['findOne']({'where':{'id':_0x51eee1[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x57ef1e,null))[_0x23fc('0x1d')](function(_0x16a8a5){if(_0x16a8a5){_0x1c9bd9=_0x16a8a5;_0xde6b94[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db['WhatsappInteraction'][_0x23fc('0x32')]);_0xde6b94[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x51eee1['query']);_0xde6b94[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0xde6b94[_0x23fc('0xc8')],_0xde6b94[_0x23fc('0x3e')]);_0x3f8a02[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0xde6b94[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x51eee1[_0x23fc('0x3e')][_0x23fc('0xcd')]));_0x3f8a02['attributes']=_0x3f8a02[_0x23fc('0x43')][_0x23fc('0x49')]?_0x3f8a02[_0x23fc('0x43')]:_0xde6b94[_0x23fc('0xc8')];_0x3f8a02[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x51eee1[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x3f8a02['where']=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x51eee1[_0x23fc('0x3e')],_0xde6b94[_0x23fc('0xcb')]));if(_0x51eee1[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x3f8a02[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x3f8a02[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x3f8a02['attributes'],function(_0x31c5b8){var _0x22c1fb={};_0x22c1fb[_0x31c5b8]={'$like':'%'+_0x51eee1['query'][_0x23fc('0x26')]+'%'};return _0x22c1fb;})});}_0x3f8a02=_[_0x23fc('0x52')]({},_0x3f8a02,_0x51eee1[_0x23fc('0x53')]);return _0x1c9bd9['getWhatsappInteractions'](_0x3f8a02);}})[_0x23fc('0x1d')](function(_0x556913){if(_0x556913){_0xc1ca7c=_0x556913['length'];if(!_0x51eee1[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x3f8a02[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x51eee1[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x3f8a02[_0x23fc('0x17')]=qs[_0x23fc('0x17')](_0x51eee1['query'][_0x23fc('0x17')]);}return _0x1c9bd9[_0x23fc('0xe3')](_0x3f8a02);}})[_0x23fc('0x1d')](function(_0x2c096a){if(_0x2c096a){return _0x2c096a?{'count':_0xc1ca7c,'rows':_0x2c096a}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x57ef1e,null))[_0x23fc('0x4f')](handleError(_0x57ef1e,null));};exports[_0x23fc('0xe4')]=function(_0x4dbf79,_0x48b14c,_0x2587a4){var _0x56144a;var _0x459062;var _0x321c8b;var _0x57d6e9=!_[_0x23fc('0x60')](_0x4dbf79[_0x23fc('0x51')]['id'])?_0x4dbf79[_0x23fc('0x51')]['id']:!_[_0x23fc('0x60')](_0x4dbf79['user']['id'])?_0x4dbf79[_0x23fc('0x23')]['id']:null;return db[_0x23fc('0x31')]['find']({'where':{'id':_0x57d6e9,'role':{'$or':[_0x23fc('0x77'),'user','agent']}},'attributes':['id','name',_0x23fc('0xe5'),_0x23fc('0xe6'),_0x23fc('0x1e'),_0x23fc('0x5d'),'loginInPause']})[_0x23fc('0x1d')](function(_0x451993){if(_0x451993){if(_0x451993['role']===_0x23fc('0x6a')){_0x56144a=_0x451993;if(_0x4dbf79[_0x23fc('0x58')]['interface']){_0x321c8b=util[_0x23fc('0xa4')]('LOCAL/%s@from-sip/n',_0x56144a[_0x4dbf79[_0x23fc('0x58')][_0x23fc('0x99')]]);}else if(_0x4dbf79[_0x23fc('0x58')][_0x23fc('0xe7')]){_0x321c8b=util[_0x23fc('0xa4')]('SIP/%s',_0x4dbf79[_0x23fc('0x58')][_0x23fc('0xe7')]);}else{_0x321c8b=util[_0x23fc('0xa4')](_0x23fc('0xa5'),_0x56144a[_0x23fc('0x2b')]);}socket['to'](util['format'](_0x23fc('0xe8'),_0x56144a[_0x23fc('0x2b')]))['emit'](_0x23fc('0xe9'),{'user':{'id':_0x56144a['id'],'name':_0x56144a[_0x23fc('0x2b')]},'ip':_0x4dbf79['headers'][_0x23fc('0xea')]||_0x4dbf79[_0x23fc('0xeb')]['remoteAddress']||_0x4dbf79[_0x23fc('0xec')][_0x23fc('0xed')]||_0x4dbf79[_0x23fc('0xeb')][_0x23fc('0xec')][_0x23fc('0xed')]});return db[_0x23fc('0xa6')][_0x23fc('0x20')]({'where':{'membername':_0x56144a['name']},'individualHooks':!![]});}}else{throw new db[(_0x23fc('0x88'))][(_0x23fc('0x8a'))](_0x23fc('0xee'));}})[_0x23fc('0x1d')](function(){if(_0x56144a){return _0x56144a[_0x23fc('0xef')]({'raw':!![]});}})[_0x23fc('0x1d')](function(_0x4c6286){if(_0x56144a){if(_0x4c6286){_0x459062=_0x4c6286;if(_0x459062[_0x23fc('0x49')]){var _0x4a1278=_0x459062[_0x23fc('0x28')](function(_0x3509b9){var _0x4eec03={'membername':_0x56144a[_0x23fc('0x2b')],'UserId':_0x56144a['id'],'queue_name':_0x3509b9[_0x23fc('0x2b')],'VoiceQueueId':_0x3509b9['id'],'interface':_0x321c8b,'paused':_0x56144a[_0x23fc('0x97')]||![],'penalty':_0x3509b9[_0x23fc('0xf0')]||0x0};return db[_0x23fc('0xa6')][_0x23fc('0xf1')](_0x4eec03);});return Promise[_0x23fc('0x4e')](_0x4a1278);}}}})[_0x23fc('0x1d')](function(){if(_0x56144a){return db[_0x23fc('0xf2')][_0x23fc('0x45')]({'where':{'membername':_0x56144a[_0x23fc('0x2b')],'exitAt':null}});}})[_0x23fc('0x1d')](function(_0x5c00f9){if(_0x56144a){var _0x41fc8b=[];_0x5c00f9['forEach'](function(_0x29f139){_0x41fc8b[_0x23fc('0x44')](_0x29f139[_0x23fc('0x1c')]({'exitAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3'))}));});return Promise[_0x23fc('0x4e')](_0x41fc8b);}})[_0x23fc('0x1d')](function(){if(_0x56144a){var _0xaaf0e8=[];var _0x8f811d=[];var _0x465e79=utils[_0x23fc('0xf4')]();var _0x3622af={'membername':_0x56144a[_0x23fc('0x2b')],'interface':_0x321c8b,'enterAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3')),'role':_0x56144a[_0x23fc('0x1e')],'internal':_0x56144a[_0x23fc('0x5d')]};_0x465e79['forEach'](function(_0x2b3abf){_0xaaf0e8[_0x23fc('0x44')](_[_0x23fc('0x52')]({'channel':_0x2b3abf,'type':_0x23fc('0xf5'),'data1':_0x4dbf79[_0x23fc('0x58')][_0x23fc('0xf6')],'data2':_0x321c8b},_0x3622af));if(_0x56144a['loginInPause']){_0x8f811d[_0x23fc('0x44')](_[_0x23fc('0x52')]({'channel':_0x2b3abf,'type':'PAUSE','data1':_0x23fc('0xf7')},_0x3622af));}});return db[_0x23fc('0xf2')][_0x23fc('0x7f')](_0xaaf0e8[_0x23fc('0xf8')](_0x8f811d),{'individualHooks':!![]});}})[_0x23fc('0x1d')](function(){if(_0x56144a){return _0x56144a['update']({'online':!![],'lastLoginAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3')),'voicePause':_0x56144a['loginInPause']||![],'mailPause':_0x56144a[_0x23fc('0x97')]||![],'chatPause':_0x56144a[_0x23fc('0x97')]||![],'faxPause':_0x56144a[_0x23fc('0x97')]||![],'smsPause':_0x56144a['loginInPause']||![],'openchannelPause':_0x56144a[_0x23fc('0x97')]||![],'whatsappPause':_0x56144a['loginInPause']||![],'pauseType':_0x56144a['loginInPause']?_0x23fc('0xf7'):null,'interface':_0x321c8b,'lastPauseAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3'))});}})[_0x23fc('0x1d')](function(_0x869d69){if(_0x4dbf79['isMiddleware']){return _0x2587a4();}else{return Promise[_0x23fc('0xf9')](_0x869d69)[_0x23fc('0x1d')](respondWithResult(_0x48b14c,null));}})[_0x23fc('0x4f')](handleError(_0x48b14c,null));};exports[_0x23fc('0xfa')]=function(_0x3c145c,_0x3c5f5a){var _0x11d806;return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x3c145c['params']['id'],'role':'agent'},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e')]})[_0x23fc('0x1d')](handleEntityNotFound(_0x3c5f5a,null))[_0x23fc('0x1d')](function(_0x3d7842){if(_0x3d7842){_0x11d806=_0x3d7842;return db[_0x23fc('0xa6')][_0x23fc('0x20')]({'where':{'membername':_0x11d806[_0x23fc('0x2b')]},'individualHooks':!![]});}})[_0x23fc('0x1d')](function(){return db['MemberReport'][_0x23fc('0x45')]({'where':{'membername':_0x11d806[_0x23fc('0x2b')],'exitAt':null}});})[_0x23fc('0x1d')](function(_0x4bf222){var _0x31a72d=[];_0x4bf222[_0x23fc('0xfb')](function(_0x2ace4f){_0x31a72d[_0x23fc('0x44')](_0x2ace4f['update']({'exitAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3'))}));});return Promise[_0x23fc('0x4e')](_0x31a72d);})[_0x23fc('0x1d')](function(){return _0x11d806[_0x23fc('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x23fc('0x1d')](respondWithResult(_0x3c5f5a,null))['catch'](handleError(_0x3c5f5a,null));};exports[_0x23fc('0xfc')]=function(_0x5ad2a9,_0x1f041b){var _0x30bd44;return db['UserVoiceQueueRt'][_0x23fc('0x1c')]({'paused':0x1},{'where':{'UserId':_0x5ad2a9[_0x23fc('0x51')]['id']},'individualHooks':!![]})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x31')]['find']({'where':{'id':_0x5ad2a9[_0x23fc('0x51')]['id'],'role':_0x23fc('0x6a')},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e'),'internal','interface',_0x23fc('0xfd')]});})[_0x23fc('0x1d')](handleEntityNotFound(_0x1f041b,null))[_0x23fc('0x1d')](function(_0x3c702c){if(_0x3c702c){_0x30bd44=_0x3c702c;return db[_0x23fc('0xf2')][_0x23fc('0x45')]({'where':{'membername':_0x30bd44[_0x23fc('0x2b')],'type':_0x23fc('0xfe'),'exitAt':null}});}})[_0x23fc('0x1d')](function(_0x5c77c9){if(_0x5c77c9[_0x23fc('0x49')]){var _0xbe78f0=moment()[_0x23fc('0xa4')](_0x23fc('0xf3'));for(var _0x28d393=0x0,_0x51cb1d=_0x5c77c9['length'];_0x28d393<_0x51cb1d;_0x28d393++){_0x5c77c9[_0x28d393][_0x23fc('0xff')]({'exitAt':_0xbe78f0});}}})[_0x23fc('0x1d')](function(){var _0x43b6ba=[];var _0x2d0fd8=utils[_0x23fc('0xf4')]();_0x2d0fd8['forEach'](function(_0x284259){_0x43b6ba['push']({'channel':_0x284259,'membername':_0x30bd44[_0x23fc('0x2b')],'interface':_[_0x23fc('0x60')](_0x30bd44[_0x23fc('0x99')])?util[_0x23fc('0xa4')](_0x23fc('0xa5'),_0x30bd44[_0x23fc('0x2b')]):_0x30bd44[_0x23fc('0x99')],'type':_0x23fc('0xfe'),'enterAt':moment()[_0x23fc('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5ad2a9[_0x23fc('0x58')][_0x23fc('0x34')]||_0x23fc('0x100'),'role':_0x30bd44[_0x23fc('0x1e')],'internal':_0x30bd44[_0x23fc('0x5d')]});});return db[_0x23fc('0xf2')]['bulkCreate'](_0x43b6ba,{'individualHooks':!![]});})[_0x23fc('0x1d')](function(){return _0x30bd44[_0x23fc('0x1c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5ad2a9[_0x23fc('0x58')][_0x23fc('0x34')]||_0x23fc('0x100'),'lastPauseAt':moment()[_0x23fc('0xa4')](_0x23fc('0xf3'))});})[_0x23fc('0x1d')](respondWithResult(_0x1f041b,null))[_0x23fc('0x4f')](handleError(_0x1f041b,null));};exports[_0x23fc('0x101')]=function(_0x4b6166,_0x1d14e6){if(_0x4b6166['body'][_0x23fc('0x96')]&&!utils[_0x23fc('0x9a')](_0x4b6166[_0x23fc('0x58')][_0x23fc('0x96')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4b6166['body']['channel']));}return db[_0x23fc('0x31')][_0x23fc('0x54')]({'where':{'id':_0x4b6166[_0x23fc('0x51')]['id']},'attributes':['id',_0x23fc('0x2b'),_0x23fc('0x1e'),_0x23fc('0x5d'),_0x23fc('0x99'),_0x23fc('0xfd'),_0x23fc('0x98'),'mailPause',_0x23fc('0x102'),_0x23fc('0x103'),_0x23fc('0x104'),_0x23fc('0x105'),_0x23fc('0x106'),_0x23fc('0x107'),_0x23fc('0x108')]})[_0x23fc('0x1d')](function(_0x87b127){if(!_0x87b127){throw new APINotFoundError(util[_0x23fc('0xa4')](_0x23fc('0xc0'),_0x4b6166[_0x23fc('0x51')]['id']));}return _0x87b127[_0x23fc('0x101')](_0x4b6166[_0x23fc('0x58')][_0x23fc('0x96')]);})[_0x23fc('0x1d')](respondWithResult(_0x1d14e6,null))[_0x23fc('0x4f')](APIHandleError(_0x1d14e6));};exports['getTeams']=function(_0x5c1aa0,_0x1e0cf7){var _0x389b16={};var _0x344020={};var _0x15d4aa;var _0x2f851b;return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x5c1aa0[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x1e0cf7,null))[_0x23fc('0x1d')](function(_0x5bd249){if(_0x5bd249){_0x15d4aa=_0x5bd249;_0x344020[_0x23fc('0xc8')]=_['keys'](db[_0x23fc('0x109')][_0x23fc('0x32')]);_0x344020['query']=_['keys'](_0x5c1aa0[_0x23fc('0x3e')]);_0x344020['filters']=_[_0x23fc('0xcc')](_0x344020[_0x23fc('0xc8')],_0x344020[_0x23fc('0x3e')]);_0x389b16[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x344020[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x5c1aa0['query']['fields']));_0x389b16[_0x23fc('0x43')]=_0x389b16[_0x23fc('0x43')][_0x23fc('0x49')]?_0x389b16[_0x23fc('0x43')]:_0x344020[_0x23fc('0xc8')];_0x389b16[_0x23fc('0xce')]=qs[_0x23fc('0xcf')](_0x5c1aa0[_0x23fc('0x3e')]['sort']);_0x389b16[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x5c1aa0[_0x23fc('0x3e')],_0x344020[_0x23fc('0xcb')]));if(_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x389b16[_0x23fc('0x3c')]=_[_0x23fc('0x52')](_0x389b16[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x389b16[_0x23fc('0x43')],function(_0x37b8ca){var _0x2ee5e4={};_0x2ee5e4[_0x37b8ca]={'$like':'%'+_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x2ee5e4;})});}_0x389b16=_[_0x23fc('0x52')]({},_0x389b16,_0x5c1aa0[_0x23fc('0x53')]);return _0x15d4aa[_0x23fc('0x10a')](_0x389b16);}})[_0x23fc('0x1d')](function(_0x24ca05){if(_0x24ca05){_0x2f851b=_0x24ca05[_0x23fc('0x49')];if(!_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0xc1')](_0x23fc('0xd0'))){_0x389b16[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x389b16[_0x23fc('0x17')]=qs['offset'](_0x5c1aa0[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x15d4aa[_0x23fc('0x10a')](_0x389b16);}})[_0x23fc('0x1d')](function(_0x234d3d){if(_0x234d3d){return _0x234d3d?{'count':_0x2f851b,'rows':_0x234d3d}:null;}})['then'](respondWithResult(_0x1e0cf7,null))[_0x23fc('0x4f')](handleError(_0x1e0cf7,null));};exports[_0x23fc('0x10b')]=function(_0x21c45e,_0x49979f){var _0x101026=_0x21c45e[_0x23fc('0x51')]['id'];var _0x5d7ddd=_0x21c45e[_0x23fc('0x58')]?_0x21c45e[_0x23fc('0x58')][_0x23fc('0x5b')]:null;var _0xe668d6=[];return Promise[_0x23fc('0xf9')]()[_0x23fc('0x1d')](function(){if(!_0x5d7ddd)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x101026}});})[_0x23fc('0x1d')](function(_0x2132f4){if(!_0x2132f4)throw new APINotFoundError(util[_0x23fc('0xa4')](_0x23fc('0xc0'),_0x21c45e[_0x23fc('0x51')]['id']));return db[_0x23fc('0x62')][_0x23fc('0x10c')](function(_0x4c266f){return _0x2132f4[_0x23fc('0x10b')](_0x5d7ddd,{'transaction':_0x4c266f})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x109')][_0x23fc('0x45')]({'where':{'id':{'$in':_0x5d7ddd}}});})['then'](function(_0x4c0258){var _0x469e4f=_[_0x23fc('0x28')](_0x4c0258,function(_0x105484){return _0x105484[_0x23fc('0x10d')]();});return Promise[_0x23fc('0x4e')](_0x469e4f);})['then'](function(_0x443a7f){_0xe668d6=_[_0x23fc('0x10e')](_0x443a7f);var _0xc0aa9b=_[_0x23fc('0x28')](_0xe668d6,function(_0x45ac58){return _0x45ac58[_0x23fc('0x10f')](_0x2132f4['id'],{'transaction':_0x4c266f});});return Promise[_0x23fc('0x4e')](_0xc0aa9b);})[_0x23fc('0x1d')](function(){if(!_0x2132f4['online'])return;var _0x93e034=_['filter'](_0xe668d6,function(_0x282e83){return _0x282e83[_0x23fc('0x110')](_0x23fc('0x96'))===_0x23fc('0x111');});var _0x46725a=_[_0x23fc('0x28')](_0x93e034,function(_0x4ad568){return db[_0x23fc('0xa6')][_0x23fc('0xf1')]({'membername':_0x2132f4['name'],'UserId':_0x2132f4['id'],'queue_name':_0x4ad568[_0x23fc('0x2b')],'VoiceQueueId':_0x4ad568['id'],'interface':_[_0x23fc('0x60')](_0x2132f4[_0x23fc('0x99')])?util[_0x23fc('0xa4')](_0x23fc('0xa5'),_0x2132f4['name']):_0x2132f4[_0x23fc('0x99')],'paused':_0x2132f4[_0x23fc('0x98')]||![],'penalty':_0x2132f4[_0x23fc('0x9f')]},{'transaction':_0x4c266f});});return Promise[_0x23fc('0x4e')](_0x46725a);})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x112')][_0x23fc('0x45')]({'where':{'teamId':{'$in':_0x5d7ddd}}});})['then'](function(_0x13ffc1){var _0x204f71=_[_0x23fc('0x28')](_0x13ffc1,function(_0x5a6721){return db['UserVoicePrefix'][_0x23fc('0x76')]({'UserId':_0x2132f4['id'],'VoicePrefixId':_0x5a6721[_0x23fc('0x113')]},{'transaction':_0x4c266f});});return Promise['all'](_0x204f71);});});})[_0x23fc('0x1d')](function(){for(var _0x40ba37=0x0;_0x40ba37<_0xe668d6[_0x23fc('0x49')];_0x40ba37++){var _0x52bf4c=_0xe668d6[_0x40ba37][_0x23fc('0x110')](_0x23fc('0x96'));var _0x5d96db=_0x52bf4c+'QueueId';socket['emit'](_0x23fc('0x23')+_0x52bf4c+_0x23fc('0x114'),{'UserId':_0x101026,['queueField']:_0xe668d6[_0x40ba37]['id']});}})[_0x23fc('0x1d')](respondWithStatusCode(_0x49979f,null))[_0x23fc('0x4f')](APIHandleError(_0x49979f));};exports[_0x23fc('0x115')]=function(_0x288ca8,_0x3102e4){var _0x126f32=_0x288ca8[_0x23fc('0x51')]['id'];var _0x286a94=null;if(_0x288ca8[_0x23fc('0x3e')][_0x23fc('0x5b')]){_0x286a94=_['isArray'](_0x288ca8[_0x23fc('0x3e')][_0x23fc('0x5b')])?_0x288ca8[_0x23fc('0x3e')][_0x23fc('0x5b')]:[_0x288ca8[_0x23fc('0x3e')][_0x23fc('0x5b')]];}var _0x32ac32=[];return Promise[_0x23fc('0xf9')]()[_0x23fc('0x1d')](function(){if(!_0x286a94)throw new APIBadRequestError(_0x23fc('0x116'));})[_0x23fc('0x1d')](function(){return db[_0x23fc('0x31')][_0x23fc('0x8f')]({'where':{'id':_0x126f32}});})[_0x23fc('0x1d')](function(_0xe9091d){if(!_0xe9091d)throw new APINotFoundError(util[_0x23fc('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x288ca8[_0x23fc('0x51')]['id']));return db[_0x23fc('0x62')][_0x23fc('0x10c')](function(_0x299d93){return _0xe9091d[_0x23fc('0x115')](_0x286a94,{'transaction':_0x299d93})['then'](function(){return db[_0x23fc('0x109')][_0x23fc('0x45')]({'where':{'id':{'$in':_0x286a94}}});})[_0x23fc('0x1d')](function(_0xf0df07){var _0x533603=_[_0x23fc('0x28')](_0xf0df07,function(_0x40b468){return _0x40b468['getAssociatedQueues']();});return Promise[_0x23fc('0x4e')](_0x533603);})['then'](function(_0x25b853){_0x32ac32=_[_0x23fc('0x10e')](_0x25b853);var _0x23e98f=_[_0x23fc('0x28')](_0x32ac32,function(_0x361078){return _0x361078[_0x23fc('0x117')](_0xe9091d['id'],{'transaction':_0x299d93});});return Promise[_0x23fc('0x4e')](_0x23e98f);})[_0x23fc('0x1d')](function(){if(!_0xe9091d['online'])return;var _0x5d8064=_[_0x23fc('0x26')](_0x32ac32,function(_0x10eb0c){return _0x10eb0c[_0x23fc('0x110')](_0x23fc('0x96'))===_0x23fc('0x111');});var _0x3cbb07=_[_0x23fc('0x28')](_0x5d8064,function(_0x3aeaa8){return db[_0x23fc('0xa6')]['destroy']({'where':{'VoiceQueueId':_0x3aeaa8['id'],'UserId':_0xe9091d['id']},'transaction':_0x299d93});});return Promise[_0x23fc('0x4e')](_0x3cbb07);})[_0x23fc('0x1d')](function(){return db['TeamVoicePrefix'][_0x23fc('0x45')]({'where':{'teamId':{'$in':_0x286a94}}});})[_0x23fc('0x1d')](function(_0x29819d){var _0x6eeeb9=_[_0x23fc('0x28')](_0x29819d,function(_0x4eb745){return db[_0x23fc('0x118')][_0x23fc('0x20')]({'where':{'UserId':_0xe9091d['id'],'VoicePrefixId':_0x4eb745[_0x23fc('0x113')]}},{'transaction':_0x299d93});});return Promise[_0x23fc('0x4e')](_0x6eeeb9);});});})[_0x23fc('0x1d')](function(){for(var _0x473a48=0x0;_0x473a48<_0x32ac32[_0x23fc('0x49')];_0x473a48++){var _0x180df7=_0x32ac32[_0x473a48][_0x23fc('0x110')](_0x23fc('0x96'));var _0x240734=_0x180df7+'QueueId';socket[_0x23fc('0x1f')](_0x23fc('0x23')+_0x180df7+_0x23fc('0xa9'),{'UserId':_0x126f32,['queueField']:_0x32ac32[_0x473a48]['id']});}})['then'](respondWithStatusCode(_0x3102e4,null))['catch'](APIHandleError(_0x3102e4));};exports['getLists']=function(_0x36ef91,_0x3535bd){var _0x238a92={};var _0x4f794f={};var _0x1cbb89;var _0x145a4b;return db[_0x23fc('0x31')]['findOne']({'where':{'id':_0x36ef91[_0x23fc('0x51')]['id']}})['then'](handleEntityNotFound(_0x3535bd,null))[_0x23fc('0x1d')](function(_0x58a68b){if(_0x58a68b){_0x1cbb89=_0x58a68b;_0x4f794f[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0xc2')][_0x23fc('0x32')]);_0x4f794f[_0x23fc('0x3e')]=_[_0x23fc('0xc9')](_0x36ef91[_0x23fc('0x3e')]);_0x4f794f[_0x23fc('0xcb')]=_[_0x23fc('0xcc')](_0x4f794f[_0x23fc('0xc8')],_0x4f794f[_0x23fc('0x3e')]);_0x238a92['attributes']=_[_0x23fc('0xcc')](_0x4f794f[_0x23fc('0xc8')],qs[_0x23fc('0xcd')](_0x36ef91[_0x23fc('0x3e')]['fields']));_0x238a92['attributes']=_0x238a92[_0x23fc('0x43')][_0x23fc('0x49')]?_0x238a92[_0x23fc('0x43')]:_0x4f794f[_0x23fc('0xc8')];_0x238a92[_0x23fc('0xce')]=qs['sort'](_0x36ef91[_0x23fc('0x3e')]['sort']);_0x238a92[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x36ef91[_0x23fc('0x3e')],_0x4f794f['filters']));if(_0x36ef91['query'][_0x23fc('0x26')]){_0x238a92['where']=_[_0x23fc('0x52')](_0x238a92[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x238a92[_0x23fc('0x43')],function(_0x4f5230){var _0x452919={};_0x452919[_0x4f5230]={'$like':'%'+_0x36ef91['query']['filter']+'%'};return _0x452919;})});}_0x238a92=_['merge']({},_0x238a92,_0x36ef91['options']);return _0x1cbb89[_0x23fc('0x119')](_0x238a92);}})[_0x23fc('0x1d')](function(_0x467d75){if(_0x467d75){_0x145a4b=_0x467d75[_0x23fc('0x49')];if(!_0x36ef91[_0x23fc('0x3e')]['hasOwnProperty'](_0x23fc('0xd0'))){_0x238a92[_0x23fc('0x19')]=qs[_0x23fc('0x19')](_0x36ef91[_0x23fc('0x3e')][_0x23fc('0x19')]);_0x238a92['offset']=qs['offset'](_0x36ef91[_0x23fc('0x3e')][_0x23fc('0x17')]);}return _0x1cbb89[_0x23fc('0x119')](_0x238a92);}})['then'](function(_0x4612e0){if(_0x4612e0){return _0x4612e0?{'count':_0x145a4b,'rows':_0x4612e0}:null;}})[_0x23fc('0x1d')](respondWithResult(_0x3535bd,null))[_0x23fc('0x4f')](handleError(_0x3535bd,null));};exports['getAgents']=function(_0x23982e,_0x4a154a){var _0x1d639e={};var _0x261a03={};var _0x12ee16;return db['User']['findOne']({'where':{'id':_0x23982e['params']['id']}})[_0x23fc('0x1d')](handleEntityNotFound(_0x4a154a,null))[_0x23fc('0x1d')](function(_0x500801){if(_0x500801){_0x12ee16=_0x500801;_0x261a03[_0x23fc('0xc8')]=_[_0x23fc('0xc9')](db[_0x23fc('0x31')][_0x23fc('0x32')]);_0x261a03[_0x23fc('0x3e')]=_['keys'](_0x23982e[_0x23fc('0x3e')]);_0x261a03['filters']=_[_0x23fc('0xcc')](_0x261a03[_0x23fc('0xc8')],_0x261a03[_0x23fc('0x3e')]);_0x1d639e[_0x23fc('0x43')]=_[_0x23fc('0xcc')](_0x261a03[_0x23fc('0xc8')],qs['fields'](_0x23982e['query'][_0x23fc('0xcd')]));_0x1d639e[_0x23fc('0x43')]=_0x1d639e[_0x23fc('0x43')][_0x23fc('0x49')]?_0x1d639e[_0x23fc('0x43')]:_0x261a03[_0x23fc('0xc8')];_0x1d639e['order']=qs[_0x23fc('0xcf')](_0x23982e[_0x23fc('0x3e')][_0x23fc('0xcf')]);_0x1d639e[_0x23fc('0x3c')]=qs[_0x23fc('0xcb')](_[_0x23fc('0xd2')](_0x23982e[_0x23fc('0x3e')],_0x261a03['filters']));if(_0x23982e[_0x23fc('0x3e')][_0x23fc('0x26')]){_0x1d639e[_0x23fc('0x3c')]=_['merge'](_0x1d639e[_0x23fc('0x3c')],{'$or':_[_0x23fc('0x28')](_0x1d639e[_0x23fc('0x43')],function(_0x1c40c6){var _0x16b7be={};_0x16b7be[_0x1c40c6]={'$like':'%'+_0x23982e[_0x23fc('0x3e')][_0x23fc('0x26')]+'%'};return _0x16b7be;})});}_0x1d639e[_0x23fc('0xc8')]=db[_0x23fc('0x31')];_0x1d639e['as']=_0x23fc('0x24');_0x1d639e=_['merge']({},_0x1d639e,_0x23982e['options']);return _0x12ee16['getVoiceQueues']({'include':[_0x1d639e]});}})[_0x23fc('0x1d')](function(_0x51db40){if(_0x51db40){var _0x1d8229={},_0x3df7d8=[];for(var _0x3d7ebe=0x0;_0x3d7ebe<_0x51db40['length'];_0x3d7ebe+=0x1){for(var _0x327a0d=0x0,_0x1cc34c;_0x327a0d<_0x51db40[_0x3d7ebe][_0x23fc('0x24')][_0x23fc('0x49')];_0x327a0d+=0x1){_0x1cc34c=_0x51db40[_0x3d7ebe][_0x23fc('0x24')][_0x327a0d][_0x23fc('0x21')]({'plain':!![]});_0x1d8229[_0x1cc34c['id']]=_0x1cc34c;}}_0x1d8229=_[_0x23fc('0x11a')](_0x1d8229);for(var _0x106921=qs['offset'](_0x23982e[_0x23fc('0x3e')][_0x23fc('0x17')]);_0x106921<_0x1d8229['length']&&_0x3df7d8[_0x23fc('0x49')]=_0x1ca0f2){_0x117af9=_0x1ca0f2;_0x132a28=0xc8;}else{_0x132a28=0xce;}_0x88d61f[_0x1f07('0x19')](_0x132a28);return _0x88d61f[_0x1f07('0x20')]('Content-Range',_0x102a1a+'-'+_0x117af9+'/'+_0x1ca0f2)[_0x1f07('0x1b')](_0x2b447c);}return null;};}function saveUpdates(_0x50a994){return function(_0x2d6a9d){if(_0x2d6a9d){return _0x2d6a9d[_0x1f07('0x21')](_0x50a994)[_0x1f07('0x22')](function(_0x1940d0){if(_0x1940d0['role']==='agent'){socket[_0x1f07('0x23')](_0x1f07('0x24')+_0x1940d0['id'],_0x1940d0);}return _0x1940d0;});}return null;};}function removeEntity(_0x1aefaa){return function(_0xa7a533){if(_0xa7a533){return _0xa7a533[_0x1f07('0x25')]()['then'](function(){var _0x3c6719=_0xa7a533[_0x1f07('0x26')]({'plain':!![]});if(_0x3c6719[_0x1f07('0x27')]===_0x1f07('0x28'))return;var _0x51d2ef=[{'name':'Users','value':_0x1f07('0x29'),'ignore':!![]},{'name':_0x1f07('0x2a'),'value':'agent','ignore':![]},{'name':_0x1f07('0x2b'),'value':_0x1f07('0x2c'),'ignore':![]}];var _0x197e9f=_(_0x51d2ef)['filter']('ignore')[_0x1f07('0x2d')](_0x1f07('0x2e'))['value']();if(_[_0x1f07('0x2f')](_0x197e9f,_0x3c6719[_0x1f07('0x27')])){return;}var _0x38896e=_[_0x1f07('0x30')](_0x51d2ef,[_0x1f07('0x2e'),_0x3c6719['role']])[_0x1f07('0x31')];return db[_0x1f07('0x32')][_0x1f07('0x25')]({'where':{'type':_0x38896e,'resourceId':_0x3c6719['id']}})[_0x1f07('0x22')](function(){return _0xa7a533;});})[_0x1f07('0x22')](function(){_0x1aefaa['status'](0xcc)[_0x1f07('0x1a')]();});}};}function handleEntityNotFound(_0xeff084){return function(_0x386368){if(!_0x386368){_0xeff084[_0x1f07('0x18')](0x194);}return _0x386368;};}function handleError(_0x4f1eb6,_0x3eabec){_0x3eabec=_0x3eabec||0x1f4;return function(_0xd31224){logger[_0x1f07('0x33')](_0xd31224[_0x1f07('0x34')]);if(_0xd31224['name']){delete _0xd31224['name'];}_0x4f1eb6[_0x1f07('0x19')](_0x3eabec)[_0x1f07('0x35')](_0xd31224);};}function getUserAttributes(){return _(db['User'][_0x1f07('0x36')])[_0x1f07('0x2d')](function(_0x25e0bf){return{'name':_0x25e0bf[_0x1f07('0x37')],'type':_0x25e0bf[_0x1f07('0x38')][_0x1f07('0x39')]};})[_0x1f07('0x3a')](function(_0x1d6b40){return![_0x1f07('0x3b'),_0x1f07('0x3c'),_0x1f07('0x3d'),'resetPasswordToken',_0x1f07('0x3e'),_0x1f07('0x3f')][_0x1f07('0x2f')](_0x1d6b40[_0x1f07('0x31')]);})[_0x1f07('0x2e')]();}exports[_0x1f07('0x40')]=function(_0x295962,_0x10c615){var _0x10789c={},_0x4b2389={'count':0x0,'rows':[]};var _0x5c88cc=getUserAttributes();_0x10789c=qs[_0x1f07('0x41')](_0x5c88cc,_0x295962);var _0x2492e9={'where':_0x10789c['where']};return db['User'][_0x1f07('0x1f')](_0x2492e9)['then'](function(_0x3f5bfb){_0x4b2389[_0x1f07('0x1f')]=_0x3f5bfb;if(_0x295962['query'][_0x1f07('0x42')]){_0x10789c[_0x1f07('0x43')]=[{'all':!![]}];}if(_0x295962[_0x1f07('0x44')][_0x1f07('0x45')]===_0x1f07('0x46')){_0x10789c[_0x1f07('0x43')]=[{'model':db[_0x1f07('0x47')],'as':'userSetting'}];}if(!_[_0x1f07('0x2f')](_0x10789c[_0x1f07('0x48')],'id')){_0x10789c[_0x1f07('0x48')][_0x1f07('0x49')]('id');}return db[_0x1f07('0x4a')][_0x1f07('0x4b')](_0x10789c);})['then'](function(_0x4487b1){_0x4b2389['rows']=_0x4487b1;if(_0x295962[_0x1f07('0x44')][_0x1f07('0x4c')]===_0x1f07('0x46')){var _0x318b53=[];for(var _0x1ad687=0x0;_0x1ad687<_0x4b2389['rows']['length'];_0x1ad687++){_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x4d'),_0x4b2389[_0x1f07('0x4e')][_0x1ad687][_0x1f07('0x4f')]));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x50'),_0x4b2389['rows'][_0x1ad687][_0x1f07('0x4f')]));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x51'),_0x4b2389[_0x1f07('0x4e')][_0x1ad687][_0x1f07('0x4f')]));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x52'),_0x4b2389[_0x1f07('0x4e')][_0x1ad687][_0x1f07('0x4f')]));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x53'),_0x4b2389[_0x1f07('0x4e')][_0x1ad687]['dataValues']));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x54'),_0x4b2389['rows'][_0x1ad687][_0x1f07('0x4f')]));}return Promise[_0x1f07('0x55')](_0x318b53)['then'](function(){return _0x4b2389;});}else{return _0x4b2389;}})['then'](respondWithFilteredResult(_0x10c615,_0x10789c))[_0x1f07('0x56')](handleError(_0x10c615,null));};exports['show']=function(_0x84b0af,_0x1abbc3){var _0x23ea3a=getUserAttributes();_0x84b0af[_0x1f07('0x44')]['id']=_0x84b0af[_0x1f07('0x57')]['id'];var _0x132ca=qs[_0x1f07('0x41')](_0x23ea3a,_0x84b0af);if(_0x84b0af[_0x1f07('0x44')][_0x1f07('0x42')]){_0x132ca['include']=[{'all':!![]}];}if(_0x84b0af['query'][_0x1f07('0x45')]==='true'){_0x132ca[_0x1f07('0x43')]=[{'model':db[_0x1f07('0x47')],'as':_0x1f07('0x45')}];}_0x132ca=_[_0x1f07('0x58')]({},_0x132ca,_0x84b0af['options']);if(!_[_0x1f07('0x2f')](_0x132ca[_0x1f07('0x48')],'id')){_0x132ca[_0x1f07('0x48')][_0x1f07('0x49')]('id');}return db['User'][_0x1f07('0x30')](_0x132ca)['then'](handleEntityNotFound(_0x1abbc3,null))[_0x1f07('0x22')](function(_0x2faad8){var _0x4fd237=[];values=_0x2faad8;if(_0x84b0af[_0x1f07('0x44')][_0x1f07('0x4c')]===_0x1f07('0x46')){_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x4d'),_0x2faad8[_0x1f07('0x4f')]));_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x50'),_0x2faad8[_0x1f07('0x4f')]));_0x4fd237['push'](get_open_tabs(_0x1f07('0x53'),_0x2faad8['dataValues']));_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x54'),_0x2faad8[_0x1f07('0x4f')]));_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x51'),_0x2faad8[_0x1f07('0x4f')]));_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x52'),_0x2faad8[_0x1f07('0x4f')]));return Promise[_0x1f07('0x55')](_0x4fd237);}else{return values;}})[_0x1f07('0x22')](function(){return values;})[_0x1f07('0x22')](respondWithResult(_0x1abbc3,null))['catch'](handleError(_0x1abbc3,null));};exports['update']=function(_0x46025a,_0x5e90fa){if(_0x46025a[_0x1f07('0x59')]['id']){delete _0x46025a[_0x1f07('0x59')]['id'];}delete _0x46025a['body'][_0x1f07('0x27')];return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x46025a[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x5e90fa,null))[_0x1f07('0x22')](saveUpdates(_0x46025a['body'],null))[_0x1f07('0x22')](respondWithResult(_0x5e90fa,null))[_0x1f07('0x56')](handleError(_0x5e90fa,null));};exports[_0x1f07('0x5a')]=function(_0x39f7f5,_0x4048de){return db[_0x1f07('0x4a')][_0x1f07('0x5a')]()[_0x1f07('0x22')](respondWithResult(_0x4048de,null))['catch'](handleError(_0x4048de,null));};exports[_0x1f07('0x5b')]=function(_0x47f56d,_0x641944){return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x47f56d['params']['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x641944,null))[_0x1f07('0x22')](function(_0x7e4af){if(_0x7e4af){return _0x7e4af[_0x1f07('0x5b')](_0x47f56d[_0x1f07('0x59')][_0x1f07('0x5c')],_[_0x1f07('0x5d')](_0x47f56d['body'],['ids','id'])||{});}})[_0x1f07('0x22')](respondWithResult(_0x641944,null))['catch'](handleError(_0x641944,null));};function validateUser(_0xa3b693){return new Promise(function(_0x412a23,_0x11b2d6){if(_0xa3b693[_0x1f07('0x5e')])return _0x412a23(_0xa3b693);return db[_0x1f07('0x5f')][_0x1f07('0x60')](0x1)['then'](function(_0x5e6b6d){if(_0x5e6b6d[_0x1f07('0x61')])authService[_0x1f07('0x62')](_0xa3b693[_0x1f07('0x3b')]);db[_0x1f07('0x4a')][_0x1f07('0x63')](_0x1f07('0x5e'))[_0x1f07('0x22')](function(_0x35b823){if(_[_0x1f07('0x64')](_0x35b823)){_0xa3b693['internal']=_0x5e6b6d[_0x1f07('0x65')]||0x1;return;}if(_[_0x1f07('0x64')](_0x5e6b6d[_0x1f07('0x65')])||_0x5e6b6d[_0x1f07('0x65')]===_0x35b823){_0xa3b693['internal']=_0x35b823+0x1;return;}if(_0x5e6b6d[_0x1f07('0x65')]>_0x35b823){_0xa3b693[_0x1f07('0x5e')]=_0x5e6b6d[_0x1f07('0x65')];return;}return db[_0x1f07('0x66')][_0x1f07('0x44')](_0x1f07('0x67'),{'type':db[_0x1f07('0x66')]['QueryTypes'][_0x1f07('0x68')]})[_0x1f07('0x22')](function(_0x2023ac){if(_0x2023ac&&_0x2023ac['length']){for(var _0x44e7f3=0x0,_0x488c00=_0x2023ac[_0x1f07('0x69')];_0x44e7f3<_0x488c00&&_[_0x1f07('0x64')](_0xa3b693[_0x1f07('0x5e')]);_0x44e7f3++){if(_0x5e6b6d[_0x1f07('0x65')]<=_0x2023ac[_0x44e7f3][_0x1f07('0x6a')]){_0xa3b693[_0x1f07('0x5e')]=_0x2023ac[_0x44e7f3][_0x1f07('0x6a')];}else if(_0x5e6b6d[_0x1f07('0x65')]>_0x2023ac[_0x44e7f3][_0x1f07('0x6a')]&&_0x5e6b6d[_0x1f07('0x65')]<=_0x2023ac[_0x44e7f3]['to']){_0xa3b693['internal']=_0x5e6b6d['min_internal'];}}}if(_['isNil'](_0xa3b693[_0x1f07('0x5e')])){_0xa3b693[_0x1f07('0x5e')]=_0x35b823+0x1;}return _0x412a23(_0xa3b693);});});})[_0x1f07('0x56')](function(_0x378482){_0x11b2d6(_0x378482);});});}function updateUser(_0x520edd){return new Promise(function(_0x39f881,_0x558ab2){try{if(_0x520edd[_0x1f07('0x6b')]){_0x520edd[_0x1f07('0x6c')]=_0x520edd[_0x1f07('0x5e')];_0x520edd['VoiceMail']={'mailbox':_0x520edd[_0x1f07('0x5e')],'password':_0x520edd[_0x1f07('0x3b')],'fullname':_0x520edd['fullname'],'email':_0x520edd[_0x1f07('0x6d')]};}if(_0x520edd[_0x1f07('0x27')]==='agent'){if(!_0x520edd[_0x1f07('0x6e')])_0x520edd[_0x1f07('0x6e')]=['101','102',_0x1f07('0x6f'),_0x1f07('0x70'),_0x1f07('0x71'),_0x1f07('0x72'),_0x1f07('0x73'),_0x1f07('0x74'),_0x1f07('0x75'),_0x1f07('0x76'),_0x1f07('0x77'),_0x1f07('0x78'),_0x1f07('0x79'),_0x1f07('0x7a'),_0x1f07('0x7b')];}_0x39f881(_0x520edd);}catch(_0x228c92){_0x558ab2(_0x228c92);}});}exports[_0x1f07('0x7c')]=function(_0x22879e,_0x11ffee){if(_0x22879e[_0x1f07('0x29')][_0x1f07('0x27')]===_0x1f07('0x7d'))throw new Error('Unauthorized');if(_0x22879e[_0x1f07('0x59')][_0x1f07('0x27')]===_0x1f07('0x29')&&_0x22879e[_0x1f07('0x29')][_0x1f07('0x27')]!==_0x1f07('0x28')){throw new Error(_0x1f07('0x7e'));}if(_0x22879e['body'][_0x1f07('0x27')]===_0x1f07('0x28')&&_0x22879e[_0x1f07('0x29')]['role']!==_0x1f07('0x28')){throw new Error(_0x1f07('0x7f'));}return licenseUtil[_0x1f07('0x80')]([_0x22879e[_0x1f07('0x59')]])[_0x1f07('0x22')](function(){return validateUser(_0x22879e[_0x1f07('0x59')]);})[_0x1f07('0x22')](function(_0x25aae8){return updateUser(_0x25aae8)[_0x1f07('0x22')](function(_0x4fc15f){if(_0x4fc15f['role']===_0x1f07('0x28')){_0x4fc15f[_0x1f07('0x81')]=_0x22879e['user']['settingsEnabled'];delete _0x4fc15f[_0x1f07('0x82')];}return _0x4fc15f;});})[_0x1f07('0x22')](function(_0x4eccf0){return db['User']['create'](_0x4eccf0,{'include':[{'model':db[_0x1f07('0x83')],'as':'VoiceMail'}]});})[_0x1f07('0x22')](function(_0x4d6e1e){if(_0x22879e['body'][_0x1f07('0x27')]===_0x1f07('0x29'))return _0x4d6e1e;if(_0x22879e[_0x1f07('0x29')][_0x1f07('0x27')]!==_0x1f07('0x29'))return _0x4d6e1e;return db[_0x1f07('0x84')]['find']({'where':{'name':_0x4d6e1e[_0x1f07('0x27')]===_0x1f07('0x7d')?_0x1f07('0x2a'):_0x1f07('0x2b'),'userProfileId':_0x22879e['user'][_0x1f07('0x82')]},'raw':!![]})[_0x1f07('0x22')](function(_0x19242e){if(!_0x19242e||_0x19242e[_0x1f07('0x85')]!=0x0)return _0x4d6e1e;return db[_0x1f07('0x32')][_0x1f07('0x7c')]({'name':_0x4d6e1e[_0x1f07('0x31')],'resourceId':_0x4d6e1e['id'],'type':_0x19242e[_0x1f07('0x31')],'sectionId':_0x19242e['id']},{})[_0x1f07('0x22')](function(){return _0x4d6e1e;});})['catch'](function(_0x20a751){logger[_0x1f07('0x33')](_0x1f07('0x86'),_0x20a751);throw _0x20a751;});})[_0x1f07('0x22')](respondWithResult(_0x11ffee,0xc9))[_0x1f07('0x56')](handleError(_0x11ffee,null));};exports[_0x1f07('0x87')]=function(_0x598fda,_0x5f3b14){var _0x1b94a8=_0x598fda[_0x1f07('0x59')];var _0x53d0e7=[];if(_0x598fda[_0x1f07('0x29')][_0x1f07('0x27')]==='agent')throw new Error(_0x1f07('0x88'));if(_['some'](_0x1b94a8,[_0x1f07('0x27'),'user'])&&_0x598fda[_0x1f07('0x29')][_0x1f07('0x27')]!=='admin'){throw new Error(_0x1f07('0x7e'));}if(_['some'](_0x1b94a8,[_0x1f07('0x27'),_0x1f07('0x28')])&&_0x598fda[_0x1f07('0x29')][_0x1f07('0x27')]!==_0x1f07('0x28')){throw new Error(_0x1f07('0x89'));}return licenseUtil['checkUserLimits'](_0x1b94a8)[_0x1f07('0x22')](function(){return validateUser(_0x1b94a8[0x0]);})[_0x1f07('0x22')](function(){for(var _0x3c31fc=0x1;_0x3c31fc<_0x1b94a8[_0x1f07('0x69')];_0x3c31fc++){var _0x128608=_0x1b94a8[_0x3c31fc-0x1]['internal'];if(!_0x1b94a8[_0x3c31fc][_0x1f07('0x5e')])_0x1b94a8[_0x3c31fc][_0x1f07('0x5e')]=_0x128608+0x1;_0x53d0e7['push'](validateUser(_0x1b94a8[_0x3c31fc]));}return Promise['all'](_0x53d0e7);})['then'](function(){_0x53d0e7=[];for(var _0x18559c=0x0;_0x18559c<_0x1b94a8['length'];_0x18559c++){_0x53d0e7[_0x1f07('0x49')](updateUser(_0x1b94a8[_0x18559c]));}return Promise[_0x1f07('0x55')](_0x53d0e7);})[_0x1f07('0x22')](function(){_0x53d0e7=_0x1b94a8[_0x1f07('0x2d')](function(_0x38f865){return db[_0x1f07('0x4a')][_0x1f07('0x7c')](_0x38f865,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x1f07('0x22')](function(_0x366bec){_0x38f865['id']=_0x366bec['id'];return _0x38f865;});});return Promise[_0x1f07('0x55')](_0x53d0e7);})['then'](function(_0x3e3be9){if(_0x598fda[_0x1f07('0x59')][_0x1f07('0x27')]===_0x1f07('0x29'))return _0x3e3be9;if(_0x598fda[_0x1f07('0x29')][_0x1f07('0x27')]!==_0x1f07('0x29'))return _0x3e3be9;var _0x5122f5=_['some'](_0x3e3be9,function(_0x210ffe){return _0x210ffe[_0x1f07('0x27')]==='agent'||_0x210ffe[_0x1f07('0x27')]==='telephone';});if(!_0x5122f5)return _0x3e3be9;return db[_0x1f07('0x84')]['findAll']({'where':{'name':{'$or':[_0x1f07('0x2a'),'Telephones']},'userProfileId':_0x598fda[_0x1f07('0x29')][_0x1f07('0x82')]},'raw':!![]})[_0x1f07('0x22')](function(_0x2a5aea){if(_[_0x1f07('0x8a')](_0x2a5aea)||!_['some'](_0x2a5aea,[_0x1f07('0x85'),0x0]))return _0x3e3be9;_0x53d0e7=[];var _0x4b06eb=_(_0x2a5aea)['map'](function(_0x24196b){if(_0x24196b['autoAssociation']===0x1)return;return _0x24196b[_0x1f07('0x31')]==='Agents'?_0x1f07('0x7d'):_0x1f07('0x2c');})['compact']()[_0x1f07('0x2e')]();for(var _0x4050c1=0x0;_0x4050c1<_0x3e3be9['length'];_0x4050c1++){if(!_[_0x1f07('0x2f')](_0x4b06eb,_0x3e3be9[_0x4050c1][_0x1f07('0x27')]))return;var _0x54dd6b=_0x3e3be9[_0x4050c1][_0x1f07('0x27')]==='agent'?_0x1f07('0x2a'):'Telephones';_0x53d0e7[_0x1f07('0x49')](db['UserProfileResource']['create']({'name':_0x3e3be9[_0x4050c1][_0x1f07('0x31')],'resourceId':_0x3e3be9[_0x4050c1]['id'],'type':_0x54dd6b,'sectionId':_[_0x1f07('0x30')](_0x2a5aea,[_0x1f07('0x31'),_0x54dd6b])['id']},{}));}return Promise['all'](_0x53d0e7);});})[_0x1f07('0x22')](respondWithResult(_0x5f3b14,0xc9))['catch'](handleError(_0x5f3b14,null));};exports[_0x1f07('0x8b')]=function(_0xefc2fd,_0x3b0132){if(_0xefc2fd['body']['id']){delete _0xefc2fd[_0x1f07('0x59')]['id'];}return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0xefc2fd[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](function(_0xbb3feb){if(!_0xbb3feb)return null;if(_0xbb3feb['id']===_0xefc2fd['user']['id']){if(!_0xefc2fd[_0x1f07('0x59')]['oldPassword']||!_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')]){throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))](_0x1f07('0x8f'));}if(!_0xbb3feb[_0x1f07('0x90')](_0xefc2fd['body'][_0x1f07('0x91')])){throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))]('Wrong\x20credentials');}if(_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x91')]===_0xefc2fd[_0x1f07('0x59')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x1f07('0x92'));}}else if(_0xefc2fd[_0x1f07('0x29')][_0x1f07('0x27')]===_0x1f07('0x28')){if(!_0xefc2fd[_0x1f07('0x59')]['newPassword']){throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xefc2fd[_0x1f07('0x29')][_0x1f07('0x27')]==='user'){if(!_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')]){throw new db['Sequelize'][(_0x1f07('0x8e'))](_0x1f07('0x93'));}if(_0xbb3feb['role']!==_0x1f07('0x7d')){throw new db['Sequelize'][(_0x1f07('0x8e'))](_0x1f07('0x88'));}}else{throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))](_0x1f07('0x88'));}return _0xbb3feb;})[_0x1f07('0x22')](handleEntityNotFound(_0x3b0132,null))[_0x1f07('0x22')](function(_0x43ad0a){return db[_0x1f07('0x5f')]['findOne']({'attributes':['id',_0x1f07('0x61'),_0x1f07('0x94'),'passwordHistoryLimit']})[_0x1f07('0x22')](function(_0x49a6fb){if(_0x49a6fb[_0x1f07('0x61')])authService['validatePasswordPattern'](_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')]);if(!_0x49a6fb['enforcePasswordHistory']||!_0x43ad0a['previousPasswords'])return _0x43ad0a;authService[_0x1f07('0x95')](_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')],_0x43ad0a[_0x1f07('0x3d')],_0x49a6fb[_0x1f07('0x96')]);return _0x43ad0a;})[_0x1f07('0x22')](saveUpdates({'password':_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')],'passwordResetAt':_0xefc2fd['user']['id']==_0xefc2fd[_0x1f07('0x57')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')],_0x43ad0a['previousPasswords'])},null));})[_0x1f07('0x22')](respondWithResult(_0x3b0132,null))['catch'](handleError(_0x3b0132,null));};exports[_0x1f07('0x97')]=function(_0x47293d,_0x4125ec){var _0xab05c3=_0x47293d['body'][_0x1f07('0x98')];return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x47293d['params']['id']},'attributes':['id',_0x1f07('0x31'),_0x1f07('0x27'),_0x1f07('0x99'),_0x1f07('0x9a'),_0x1f07('0x9b'),_0x1f07('0x9c')]})[_0x1f07('0x22')](handleEntityNotFound(_0x4125ec,null))['then'](function(_0x220673){if(_0x220673){if(!utils[_0x1f07('0x9d')](_0xab05c3)){throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))]('Unknown\x20channel');}return _0x220673['add'+_[_0x1f07('0x9e')](_0xab05c3[_0x1f07('0x9f')]())+_0x1f07('0xa0')](_0x47293d[_0x1f07('0x59')]['ids'],{'penalty':_0x47293d[_0x1f07('0x59')]['penalty']||0x0})['spread'](function(_0x371fa4){for(var _0x4fc826=0x0;_0x4fc826<_0x47293d[_0x1f07('0x59')][_0x1f07('0x5c')]['length'];_0x4fc826+=0x1){var _0x479f8c={'UserId':Number(_0x47293d[_0x1f07('0x57')]['id'])};_0x479f8c[_['capitalize'](_0xab05c3['toLowerCase']())+_0x1f07('0xa1')]=Number(_0x47293d[_0x1f07('0x59')][_0x1f07('0x5c')][_0x4fc826]);socket[_0x1f07('0x23')]('user'+_[_0x1f07('0x9e')](_0xab05c3['toLowerCase']())+_0x1f07('0xa2'),_0x479f8c);}return _0x371fa4;})[_0x1f07('0x22')](function(){if(_0xab05c3===_0x1f07('0xa3')){return db[_0x1f07('0xa4')]['findAll']({'where':{'id':_0x47293d[_0x1f07('0x59')][_0x1f07('0x5c')]||[]},'raw':!![],'attributes':['id',_0x1f07('0x31')]});}})[_0x1f07('0x22')](function(_0x20b695){var _0x519c89=_0x220673[_0x1f07('0x26')]({'plain':!![]});var _0x116d6d=[];if(_0xab05c3==='voice'&&_0x519c89[_0x1f07('0x27')]===_0x1f07('0x7d')&&_0x519c89[_0x1f07('0x99')]){for(let _0x369412=0x0;_0x369412<_0x20b695[_0x1f07('0x69')];_0x369412+=0x1){_0x116d6d[_0x1f07('0x49')]({'membername':_0x519c89['name'],'UserId':_0x519c89['id'],'queue_name':_0x20b695[_0x369412][_0x1f07('0x31')],'VoiceQueueId':_0x20b695[_0x369412]['id'],'interface':_[_0x1f07('0x64')](_0x519c89[_0x1f07('0x9c')])?util['format'](_0x1f07('0xa5'),_0x519c89[_0x1f07('0x31')]):_0x519c89[_0x1f07('0x9c')],'paused':_0x519c89['voicePause']||![],'penalty':_0x47293d['body'][_0x1f07('0xa6')]||0x0});}return Promise[_0x1f07('0x55')](_0x116d6d[_0x1f07('0x2d')](function(_0x310e0d){return db[_0x1f07('0xa7')]['upsert'](_0x310e0d);}));}return _0x220673;});}})[_0x1f07('0x22')](respondWithStatusCode(_0x4125ec,null))[_0x1f07('0x56')](handleError(_0x4125ec,null));};exports[_0x1f07('0xa8')]=function(_0x1b8618,_0x5bde12){var _0x392205,_0x58dcb5;return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x1b8618['params']['id']},'attributes':['id',_0x1f07('0x31'),'role']})[_0x1f07('0x22')](handleEntityNotFound(_0x5bde12,null))[_0x1f07('0x22')](function(_0x198555){if(_0x198555){_0x392205=_0x198555;if(!_0x1b8618[_0x1f07('0x44')][_0x1f07('0x98')]||!utils['isValidChannel'](_0x1b8618[_0x1f07('0x44')]['channel'])){throw new db['Sequelize'][(_0x1f07('0x8e'))]('Unknown\x20channel');}return _0x198555[_0x1f07('0xa9')+_[_0x1f07('0x9e')](_0x1b8618['query']['channel'][_0x1f07('0x9f')]())+_0x1f07('0xa0')](_0x1b8618['query'][_0x1f07('0x5c')]);}})[_0x1f07('0x22')](function(_0x42a873){if(_[_0x1f07('0xaa')](_0x1b8618[_0x1f07('0x44')]['ids'])){for(var _0x10bd84=0x0;_0x10bd84<_0x1b8618[_0x1f07('0x44')][_0x1f07('0x5c')][_0x1f07('0x69')];_0x10bd84+=0x1){_0x58dcb5={'UserId':Number(_0x1b8618[_0x1f07('0x57')]['id'])};_0x58dcb5[_[_0x1f07('0x9e')](_0x1b8618['query'][_0x1f07('0x98')][_0x1f07('0x9f')]())+_0x1f07('0xa1')]=Number(_0x1b8618['query'][_0x1f07('0x5c')][_0x10bd84]);socket[_0x1f07('0x23')](_0x1f07('0x29')+_[_0x1f07('0x9e')](_0x1b8618[_0x1f07('0x44')][_0x1f07('0x98')][_0x1f07('0x9f')]())+_0x1f07('0xab'),_0x58dcb5);}}else{_0x58dcb5={'UserId':Number(_0x1b8618['params']['id'])};_0x58dcb5[_[_0x1f07('0x9e')](_0x1b8618[_0x1f07('0x44')][_0x1f07('0x98')][_0x1f07('0x9f')]())+_0x1f07('0xa1')]=Number(_0x1b8618[_0x1f07('0x44')]['ids']);socket[_0x1f07('0x23')](_0x1f07('0x29')+_['capitalize'](_0x1b8618[_0x1f07('0x44')]['channel']['toLowerCase']())+'Queue:remove',_0x58dcb5);}return _0x42a873;})['then'](function(){if(_0x1b8618[_0x1f07('0x44')]['channel']===_0x1f07('0xa3')){return db['UserVoiceQueueRt'][_0x1f07('0x25')]({'where':{'UserId':_0x1b8618[_0x1f07('0x57')]['id'],'VoiceQueueId':_0x1b8618[_0x1f07('0x44')][_0x1f07('0x5c')]},'individualHooks':!![]})[_0x1f07('0x22')](function(){return _0x392205;});}return _0x392205;})[_0x1f07('0x22')](respondWithStatusCode(_0x5bde12,null))[_0x1f07('0x56')](handleError(_0x5bde12,null));};exports[_0x1f07('0xac')]=function(_0x54881a,_0x43df93){_0x54881a['body'][_0x1f07('0xad')]=_0x54881a['file'][_0x1f07('0xae')];return db['User'][_0x1f07('0x30')]({'where':{'id':_0x54881a[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x43df93,null))[_0x1f07('0x22')](saveUpdates(_0x54881a['body'],null))[_0x1f07('0x22')](respondWithResult(_0x43df93,null))[_0x1f07('0x56')](handleError(_0x43df93,null));};exports[_0x1f07('0xaf')]=function(_0x430326,_0x44942a){var _0x11b8a8=path[_0x1f07('0xb0')](config['root'],_0x1f07('0xb1'));return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x430326[_0x1f07('0x57')]['id']},'attributes':['id',_0x1f07('0xad')],'raw':!![]})['then'](handleEntityNotFound(_0x44942a,null))[_0x1f07('0x22')](function(_0x5a68cb){if(_0x5a68cb){if(_[_0x1f07('0x64')](_0x5a68cb[_0x1f07('0xad')])){return _0x44942a['download'](_0x11b8a8);}else{if(!fs[_0x1f07('0xb2')](path[_0x1f07('0xb0')](config['root'],_0x1f07('0xb3'),_0x5a68cb[_0x1f07('0xad')]))){return _0x44942a[_0x1f07('0xb4')](_0x11b8a8);}return _0x44942a[_0x1f07('0xb4')](path['join'](config[_0x1f07('0xb5')],_0x1f07('0xb3'),_0x5a68cb[_0x1f07('0xad')]));}}})['catch'](handleError(_0x44942a,null));};exports['getOpenTabs']=function(_0x137eeb,_0x46b220){return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x137eeb[_0x1f07('0x57')]['id']},'attributes':['id']})[_0x1f07('0x22')](handleEntityNotFound(_0x46b220,null))[_0x1f07('0x22')](function(_0x5a93d1){var _0x4da413=[];values=_0x5a93d1[_0x1f07('0x4f')];_0x4da413[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x4d'),_0x5a93d1[_0x1f07('0x4f')]));_0x4da413['push'](get_open_tabs(_0x1f07('0x50'),_0x5a93d1[_0x1f07('0x4f')]));_0x4da413[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x53'),_0x5a93d1[_0x1f07('0x4f')]));_0x4da413[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x54'),_0x5a93d1[_0x1f07('0x4f')]));_0x4da413[_0x1f07('0x49')](get_open_tabs('fax',_0x5a93d1[_0x1f07('0x4f')]));_0x4da413[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x52'),_0x5a93d1[_0x1f07('0x4f')]));return Promise['all'](_0x4da413);})[_0x1f07('0x22')](function(_0x5c6fd7){if(_0x5c6fd7){var _0x5a7b45=_[_0x1f07('0x2d')](values[_0x1f07('0xb6')],function(_0x3255c2){return{'channel':'CHAT','id':_0x3255c2['id'],'createdAt':_0x3255c2[_0x1f07('0xb7')]};});var _0x2f6fe5=_[_0x1f07('0x2d')](values['FaxOpenTabs'],function(_0x3281e6){return{'channel':_0x1f07('0xb8'),'id':_0x3281e6['id'],'createdAt':_0x3281e6[_0x1f07('0xb7')]};});var _0x3d38ab=_[_0x1f07('0x2d')](values['OpenchannelOpenTabs'],function(_0x13dfb0){return{'channel':_0x1f07('0xb9'),'id':_0x13dfb0['id'],'createdAt':_0x13dfb0[_0x1f07('0xb7')]};});var _0x4b62c6=_[_0x1f07('0x2d')](values[_0x1f07('0xba')],function(_0x4f1095){return{'channel':_0x1f07('0xbb'),'id':_0x4f1095['id'],'createdAt':_0x4f1095[_0x1f07('0xb7')]};});var _0x38f335=_[_0x1f07('0x2d')](values[_0x1f07('0xbc')],function(_0x4bd657){return{'channel':_0x1f07('0xbd'),'id':_0x4bd657['id'],'createdAt':_0x4bd657[_0x1f07('0xb7')]};});var _0x3c7e7c=_[_0x1f07('0x2d')](values['WhatsappOpenTabs'],function(_0x76030e){return{'channel':'WHATSAPP','id':_0x76030e['id'],'createdAt':_0x76030e[_0x1f07('0xb7')]};});var _0x4845e8=_[_0x1f07('0xbe')](_0x5a7b45,_0x2f6fe5,_0x3d38ab,_0x4b62c6,_0x38f335,_0x3c7e7c);var _0x31b42a={'count':_0x4845e8[_0x1f07('0x69')],'rows':_0x4845e8};return _0x31b42a;}else return null;})[_0x1f07('0x22')](respondWithResult(_0x46b220,null))[_0x1f07('0x56')](handleError(_0x46b220,null));};exports[_0x1f07('0xbf')]=function(_0x4cd2f5,_0x169fcc){var _0x1bc53b={};return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x4cd2f5[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](function(_0x5077bb){if(!_0x5077bb){throw new APINotFoundError(util[_0x1f07('0xc1')](_0x1f07('0xc2'),_0x4cd2f5[_0x1f07('0x57')]['id']));}return contacts['describe']();})['then'](function(_0xd05a1c){_0x4cd2f5['query'][_0x1f07('0x4a')]=_0x4cd2f5[_0x1f07('0x57')]['id'];_0x1bc53b=qs[_0x1f07('0x41')](_0xd05a1c,_0x4cd2f5);if(_0x4cd2f5[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0x42'))){_0x1bc53b[_0x1f07('0x43')]=[{'model':db[_0x1f07('0xc4')],'as':_0x1f07('0xc5'),'required':![]},{'model':db[_0x1f07('0xc6')],'as':_0x1f07('0xc7'),'attributes':['id',_0x1f07('0x31'),_0x1f07('0xc8')],'where':_0x4cd2f5[_0x1f07('0x44')][_0x1f07('0xc9')]?{'id':_0x4cd2f5[_0x1f07('0x44')][_0x1f07('0xc9')]}:undefined,'required':_0x4cd2f5[_0x1f07('0x44')][_0x1f07('0xc9')]?!![]:![]}];}return contacts['findAll'](_0x4cd2f5[_0x1f07('0x44')],_0x4cd2f5[_0x1f07('0x29')],_0x1bc53b,_0xd05a1c);})['then'](respondWithFilteredResult(_0x169fcc,_0x1bc53b))[_0x1f07('0x56')](APIHandleError(_0x169fcc));};exports[_0x1f07('0xca')]=function(_0x220dcc,_0x3b52cd){var _0x4159a0;var _0xd6add4={};var _0x3336ba;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x220dcc[_0x1f07('0x57')]['id']},'attributes':['id','name',_0x1f07('0x27')]})[_0x1f07('0x22')](handleEntityNotFound(_0x3b52cd,null))[_0x1f07('0x22')](function(_0x4c7818){if(!utils[_0x1f07('0x9d')](_0x220dcc[_0x1f07('0x44')]['channel'])){throw new db['Sequelize'][(_0x1f07('0x8e'))](_0x1f07('0xcb'));}_0x4159a0=_0x4c7818;var _0x2dbf60={};_0x2dbf60[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_[_0x1f07('0x9e')](_0x220dcc[_0x1f07('0x44')]['channel'])+_0x1f07('0xce')][_0x1f07('0x36')]);_0x2dbf60[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x220dcc[_0x1f07('0x44')]);_0x2dbf60[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x2dbf60['model'],_0x2dbf60['query']);_0xd6add4[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x2dbf60[_0x1f07('0xcc')],qs['fields'](_0x220dcc[_0x1f07('0x44')][_0x1f07('0xd1')]));_0xd6add4[_0x1f07('0x48')]=_0xd6add4[_0x1f07('0x48')][_0x1f07('0x69')]?_0xd6add4['attributes']:_0x2dbf60[_0x1f07('0xcc')];_0xd6add4[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x220dcc[_0x1f07('0x44')][_0x1f07('0xd3')]);_0xd6add4[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_['pick'](_0x220dcc[_0x1f07('0x44')],_0x2dbf60[_0x1f07('0xcf')]));if(_0x220dcc[_0x1f07('0x44')][_0x1f07('0x3a')]){_0xd6add4[_0x1f07('0xd4')]=_['merge'](_0xd6add4[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0xd6add4[_0x1f07('0x48')],function(_0x385bd2){var _0x1349db={};_0x1349db[_0x385bd2]={'$like':'%'+_0x220dcc[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x1349db;})});}_0xd6add4=_['merge']({},_0xd6add4,_0x220dcc[_0x1f07('0xd5')]);switch(_0x4159a0[_0x1f07('0x27')]){case _0x1f07('0x28'):return db[_[_0x1f07('0x9e')](_0x220dcc['query'][_0x1f07('0x98')])+_0x1f07('0xce')][_0x1f07('0x4b')](_0xd6add4);case'user':case _0x1f07('0x7d'):return _0x4159a0[_0x1f07('0x26')+_['capitalize'](_0x220dcc['query'][_0x1f07('0x98')])+_0x1f07('0xa0')](_0xd6add4);default:throw new db['Sequelize']['ValidationError']('Unknown\x20role');}})['then'](function(_0x2b8fc7){_0x3336ba=_0x2b8fc7['length'];if(!_0x220dcc[_0x1f07('0x44')][_0x1f07('0xc3')]('nolimit')){_0xd6add4[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x220dcc[_0x1f07('0x44')][_0x1f07('0x1e')]);_0xd6add4[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x220dcc[_0x1f07('0x44')]['offset']);}switch(_0x4159a0[_0x1f07('0x27')]){case _0x1f07('0x28'):return db[_[_0x1f07('0x9e')](_0x220dcc[_0x1f07('0x44')][_0x1f07('0x98')])+_0x1f07('0xce')][_0x1f07('0x4b')](_0xd6add4);case _0x1f07('0x29'):case _0x1f07('0x7d'):return _0x4159a0[_0x1f07('0x26')+_[_0x1f07('0x9e')](_0x220dcc[_0x1f07('0x44')][_0x1f07('0x98')])+_0x1f07('0xa0')](_0xd6add4);}})[_0x1f07('0x22')](function(_0x1c6a21){return{'count':_0x3336ba,'rows':_0x1c6a21};})['then'](respondWithResult(_0x3b52cd,null))[_0x1f07('0x56')](handleError(_0x3b52cd,null));};exports[_0x1f07('0xd6')]=function(_0x7a6c02,_0x372615){var _0x1b28f3={};var _0x24b93f={};var _0x36cf84;var _0x129dfc;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x7a6c02['params']['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x372615,null))[_0x1f07('0x22')](function(_0x3cadc5){if(_0x3cadc5){_0x36cf84=_0x3cadc5;_0x24b93f['model']=_['keys'](db['UserVoiceQueueRt'][_0x1f07('0x36')]);_0x24b93f[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x7a6c02[_0x1f07('0x44')]);_0x24b93f[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x24b93f[_0x1f07('0xcc')],_0x24b93f['query']);_0x1b28f3[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x24b93f[_0x1f07('0xcc')],qs['fields'](_0x7a6c02['query'][_0x1f07('0xd1')]));_0x1b28f3[_0x1f07('0x48')]=_0x1b28f3[_0x1f07('0x48')]['length']?_0x1b28f3[_0x1f07('0x48')]:_0x24b93f[_0x1f07('0xcc')];_0x1b28f3[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x7a6c02[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x1b28f3['where']=qs['filters'](_[_0x1f07('0xd7')](_0x7a6c02[_0x1f07('0x44')],_0x24b93f[_0x1f07('0xcf')]));if(_0x7a6c02[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x1b28f3[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x1b28f3[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x1b28f3[_0x1f07('0x48')],function(_0x4d5c9f){var _0x2a76e7={};_0x2a76e7[_0x4d5c9f]={'$like':'%'+_0x7a6c02[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x2a76e7;})});}_0x1b28f3=_[_0x1f07('0x58')]({},_0x1b28f3,_0x7a6c02[_0x1f07('0xd5')]);return _0x36cf84[_0x1f07('0xd6')](_0x1b28f3);}})[_0x1f07('0x22')](function(_0x33e440){if(_0x33e440){_0x129dfc=_0x33e440[_0x1f07('0x69')];if(!_0x7a6c02['query']['hasOwnProperty'](_0x1f07('0xd8'))){_0x1b28f3['limit']=qs[_0x1f07('0x1e')](_0x7a6c02[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x1b28f3[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x7a6c02[_0x1f07('0x44')]['offset']);}return _0x36cf84[_0x1f07('0xd6')](_0x1b28f3);}})[_0x1f07('0x22')](function(_0x2509fe){if(_0x2509fe){return _0x2509fe?{'count':_0x129dfc,'rows':_0x2509fe}:null;}})[_0x1f07('0x22')](respondWithResult(_0x372615,null))[_0x1f07('0x56')](handleError(_0x372615,null));};exports['getGroups']=function(_0x1eef85,_0x5e3c7d){var _0x3daf6e={};var _0x59cc44={};var _0x2e293f;var _0x1c5ccf;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x1eef85['params']['id']}})['then'](handleEntityNotFound(_0x5e3c7d,null))['then'](function(_0x13442a){if(_0x13442a){_0x2e293f=_0x13442a;_0x59cc44[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xd9')]['rawAttributes']);_0x59cc44[_0x1f07('0x44')]=_['keys'](_0x1eef85[_0x1f07('0x44')]);_0x59cc44[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x59cc44[_0x1f07('0xcc')],_0x59cc44['query']);_0x3daf6e[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x59cc44[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x1eef85[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x3daf6e[_0x1f07('0x48')]=_0x3daf6e[_0x1f07('0x48')][_0x1f07('0x69')]?_0x3daf6e[_0x1f07('0x48')]:_0x59cc44[_0x1f07('0xcc')];_0x3daf6e[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x1eef85['query'][_0x1f07('0xd3')]);_0x3daf6e[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x1eef85[_0x1f07('0x44')],_0x59cc44[_0x1f07('0xcf')]));if(_0x1eef85[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x3daf6e[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x3daf6e[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x3daf6e[_0x1f07('0x48')],function(_0x49c067){var _0x49fbab={};_0x49fbab[_0x49c067]={'$like':'%'+_0x1eef85[_0x1f07('0x44')]['filter']+'%'};return _0x49fbab;})});}_0x3daf6e=_[_0x1f07('0x58')]({},_0x3daf6e,_0x1eef85[_0x1f07('0xd5')]);return _0x2e293f[_0x1f07('0xda')](_0x3daf6e);}})[_0x1f07('0x22')](function(_0x299fb0){if(_0x299fb0){_0x1c5ccf=_0x299fb0[_0x1f07('0x69')];if(!_0x1eef85[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0x3daf6e[_0x1f07('0x1e')]=qs['limit'](_0x1eef85[_0x1f07('0x44')]['limit']);_0x3daf6e[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x1eef85[_0x1f07('0x44')][_0x1f07('0x1c')]);}return _0x2e293f[_0x1f07('0xda')](_0x3daf6e);}})[_0x1f07('0x22')](function(_0x4b4742){if(_0x4b4742){return _0x4b4742?{'count':_0x1c5ccf,'rows':_0x4b4742}:null;}})[_0x1f07('0x22')](respondWithResult(_0x5e3c7d,null))[_0x1f07('0x56')](handleError(_0x5e3c7d,null));};exports[_0x1f07('0xdb')]=function(_0x81d054,_0x3a69a9){var _0x43f9e9={'raw':!![],'where':{}};var _0x30d21f={};var _0x466ed5={'count':0x0,'rows':[]};return db['User'][_0x1f07('0xc0')]({'where':{'id':_0x81d054[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x3a69a9,null))[_0x1f07('0x22')](function(_0x11ae85){if(_0x11ae85){_0x30d21f[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xdc')][_0x1f07('0x36')]);_0x30d21f['query']=_[_0x1f07('0xcd')](_0x81d054[_0x1f07('0x44')]);_0x30d21f['filters']=_[_0x1f07('0xd0')](_0x30d21f['model'],_0x30d21f[_0x1f07('0x44')]);_0x43f9e9[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x30d21f[_0x1f07('0xcc')],qs['fields'](_0x81d054[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x43f9e9[_0x1f07('0x48')]=_0x43f9e9['attributes'][_0x1f07('0x69')]?_0x43f9e9[_0x1f07('0x48')]:_0x30d21f[_0x1f07('0xcc')];if(!_0x81d054[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0x43f9e9[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x81d054[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x43f9e9[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x81d054[_0x1f07('0x44')][_0x1f07('0x1c')]);}_0x43f9e9['order']=qs[_0x1f07('0xd3')](_0x81d054[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x43f9e9[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x81d054[_0x1f07('0x44')],_0x30d21f[_0x1f07('0xcf')]));_0x43f9e9['where'][_0x1f07('0xdd')]=_0x11ae85['id'];if(_0x81d054['query']['filter']){_0x43f9e9[_0x1f07('0xd4')]=_['merge'](_0x43f9e9[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x43f9e9[_0x1f07('0x48')],function(_0x3363dd){var _0x1b7eb8={};_0x1b7eb8[_0x3363dd]={'$like':'%'+_0x81d054[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x1b7eb8;})});}_0x43f9e9=_[_0x1f07('0x58')]({},_0x43f9e9,_0x81d054[_0x1f07('0xd5')]);return db[_0x1f07('0xdc')][_0x1f07('0x1f')]({'where':_0x43f9e9['where']})['then'](function(_0xceac15){_0x466ed5['count']=_0xceac15;if(_0x81d054[_0x1f07('0x44')][_0x1f07('0x42')]){_0x43f9e9[_0x1f07('0x43')]=[{'all':!![]}];}return db[_0x1f07('0xdc')][_0x1f07('0x4b')](_0x43f9e9);})[_0x1f07('0x22')](function(_0xebe723){_0x466ed5[_0x1f07('0x4e')]=_0xebe723;return _0x466ed5;});}})[_0x1f07('0x22')](respondWithFilteredResult(_0x3a69a9,_0x43f9e9))[_0x1f07('0x56')](handleError(_0x3a69a9,null));};exports[_0x1f07('0xde')]=function(_0x1035de,_0x4dee0e){var _0x2928ab={'raw':!![],'where':{}};var _0x41f834={};var _0x2447f6={'count':0x0,'rows':[]};return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x1035de[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x4dee0e,null))['then'](function(_0x430241){if(_0x430241){_0x41f834[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xdf')][_0x1f07('0x36')]);_0x41f834[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x1035de[_0x1f07('0x44')]);_0x41f834['filters']=_[_0x1f07('0xd0')](_0x41f834[_0x1f07('0xcc')],_0x41f834[_0x1f07('0x44')]);_0x2928ab[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x41f834[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x1035de[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x2928ab['attributes']=_0x2928ab['attributes']['length']?_0x2928ab['attributes']:_0x41f834[_0x1f07('0xcc')];if(!_0x1035de[_0x1f07('0x44')][_0x1f07('0xc3')]('nolimit')){_0x2928ab[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x1035de[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x2928ab['offset']=qs[_0x1f07('0x1c')](_0x1035de[_0x1f07('0x44')][_0x1f07('0x1c')]);}_0x2928ab[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x1035de['query']['sort']);_0x2928ab[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x1035de[_0x1f07('0x44')],_0x41f834[_0x1f07('0xcf')]));_0x2928ab['where']['UserId']=_0x430241['id'];if(_0x1035de[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x2928ab[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x2928ab[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x2928ab[_0x1f07('0x48')],function(_0x338c49){var _0x4d3aa6={};_0x4d3aa6[_0x338c49]={'$like':'%'+_0x1035de[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x4d3aa6;})});}_0x2928ab=_['merge']({},_0x2928ab,_0x1035de[_0x1f07('0xd5')]);return db['ScreenRecording'][_0x1f07('0x1f')]({'where':_0x2928ab[_0x1f07('0xd4')]})[_0x1f07('0x22')](function(_0x14d231){_0x2447f6[_0x1f07('0x1f')]=_0x14d231;if(_0x1035de['query']['includeAll']){_0x2928ab[_0x1f07('0x43')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x2928ab);})[_0x1f07('0x22')](function(_0x1b2bd3){_0x2447f6[_0x1f07('0x4e')]=_0x1b2bd3;return _0x2447f6;});}})['then'](respondWithFilteredResult(_0x4dee0e,_0x2928ab))[_0x1f07('0x56')](handleError(_0x4dee0e,null));};exports['getChatInteractions']=function(_0x11f03c,_0x374c56){var _0x16f902={};var _0x4a52cf={};var _0x5e70bd;var _0x21c540;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x11f03c[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x374c56,null))[_0x1f07('0x22')](function(_0x5ba1cf){if(_0x5ba1cf){_0x5e70bd=_0x5ba1cf;_0x4a52cf[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db['ChatInteraction'][_0x1f07('0x36')]);_0x4a52cf['query']=_[_0x1f07('0xcd')](_0x11f03c[_0x1f07('0x44')]);_0x4a52cf['filters']=_[_0x1f07('0xd0')](_0x4a52cf['model'],_0x4a52cf[_0x1f07('0x44')]);_0x16f902[_0x1f07('0x48')]=_['intersection'](_0x4a52cf[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x11f03c[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x16f902['attributes']=_0x16f902[_0x1f07('0x48')][_0x1f07('0x69')]?_0x16f902['attributes']:_0x4a52cf[_0x1f07('0xcc')];_0x16f902[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x11f03c[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x16f902[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_['pick'](_0x11f03c[_0x1f07('0x44')],_0x4a52cf['filters']));if(_0x11f03c[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x16f902[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x16f902[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x16f902[_0x1f07('0x48')],function(_0x28de71){var _0xe9e24f={};_0xe9e24f[_0x28de71]={'$like':'%'+_0x11f03c[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0xe9e24f;})});}_0x16f902=_[_0x1f07('0x58')]({},_0x16f902,_0x11f03c['options']);return _0x5e70bd[_0x1f07('0xe0')](_0x16f902);}})[_0x1f07('0x22')](function(_0x1cf219){if(_0x1cf219){_0x21c540=_0x1cf219['length'];if(!_0x11f03c[_0x1f07('0x44')]['hasOwnProperty'](_0x1f07('0xd8'))){_0x16f902[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x11f03c[_0x1f07('0x44')]['limit']);_0x16f902[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x11f03c[_0x1f07('0x44')]['offset']);}return _0x5e70bd[_0x1f07('0xe0')](_0x16f902);}})['then'](function(_0x3ac7c8){if(_0x3ac7c8){return _0x3ac7c8?{'count':_0x21c540,'rows':_0x3ac7c8}:null;}})[_0x1f07('0x22')](respondWithResult(_0x374c56,null))[_0x1f07('0x56')](handleError(_0x374c56,null));};exports[_0x1f07('0xe1')]=function(_0x5673ef,_0x1ca247){var _0xcef7e1={};var _0x10954f={};var _0x4d6564;var _0x151aca;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x5673ef[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x1ca247,null))[_0x1f07('0x22')](function(_0x1bb327){if(_0x1bb327){_0x4d6564=_0x1bb327;_0x10954f[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xe2')][_0x1f07('0x36')]);_0x10954f[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x5673ef[_0x1f07('0x44')]);_0x10954f[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x10954f['model'],_0x10954f[_0x1f07('0x44')]);_0xcef7e1['attributes']=_[_0x1f07('0xd0')](_0x10954f[_0x1f07('0xcc')],qs['fields'](_0x5673ef['query']['fields']));_0xcef7e1[_0x1f07('0x48')]=_0xcef7e1[_0x1f07('0x48')][_0x1f07('0x69')]?_0xcef7e1[_0x1f07('0x48')]:_0x10954f['model'];_0xcef7e1[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x5673ef[_0x1f07('0x44')][_0x1f07('0xd3')]);_0xcef7e1[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x5673ef[_0x1f07('0x44')],_0x10954f[_0x1f07('0xcf')]));if(_0x5673ef['query'][_0x1f07('0x3a')]){_0xcef7e1['where']=_[_0x1f07('0x58')](_0xcef7e1[_0x1f07('0xd4')],{'$or':_['map'](_0xcef7e1[_0x1f07('0x48')],function(_0x1a0893){var _0x16c04a={};_0x16c04a[_0x1a0893]={'$like':'%'+_0x5673ef[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x16c04a;})});}_0xcef7e1=_[_0x1f07('0x58')]({},_0xcef7e1,_0x5673ef[_0x1f07('0xd5')]);return _0x4d6564[_0x1f07('0xe1')](_0xcef7e1);}})[_0x1f07('0x22')](function(_0x467fce){if(_0x467fce){_0x151aca=_0x467fce[_0x1f07('0x69')];if(!_0x5673ef[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0xcef7e1[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x5673ef[_0x1f07('0x44')][_0x1f07('0x1e')]);_0xcef7e1['offset']=qs[_0x1f07('0x1c')](_0x5673ef[_0x1f07('0x44')][_0x1f07('0x1c')]);}return _0x4d6564['getOpenchannelInteractions'](_0xcef7e1);}})['then'](function(_0x42717a){if(_0x42717a){return _0x42717a?{'count':_0x151aca,'rows':_0x42717a}:null;}})[_0x1f07('0x22')](respondWithResult(_0x1ca247,null))[_0x1f07('0x56')](handleError(_0x1ca247,null));};exports[_0x1f07('0xe3')]=function(_0x5c503b,_0x3ffa0b){var _0x134280={'raw':!![],'where':{}};var _0x23b8fa={};var _0x3ea168={'count':0x0,'rows':[]};return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x5c503b[_0x1f07('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ffa0b,null))[_0x1f07('0x22')](function(_0x17a540){if(_0x17a540){_0x23b8fa[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db['MailInteraction'][_0x1f07('0x36')]);_0x23b8fa[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x5c503b[_0x1f07('0x44')]);_0x23b8fa[_0x1f07('0xcf')]=_['intersection'](_0x23b8fa[_0x1f07('0xcc')],_0x23b8fa[_0x1f07('0x44')]);_0x134280[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x23b8fa[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x5c503b[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x134280[_0x1f07('0x48')]=_0x134280['attributes'][_0x1f07('0x69')]?_0x134280[_0x1f07('0x48')]:_0x23b8fa[_0x1f07('0xcc')];if(!_0x5c503b['query'][_0x1f07('0xc3')]('nolimit')){_0x134280[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x5c503b['query'][_0x1f07('0x1e')]);_0x134280['offset']=qs[_0x1f07('0x1c')](_0x5c503b['query']['offset']);}_0x134280[_0x1f07('0xd2')]=qs['sort'](_0x5c503b[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x134280[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x5c503b[_0x1f07('0x44')],_0x23b8fa[_0x1f07('0xcf')]));_0x134280[_0x1f07('0xd4')][_0x1f07('0xdd')]=_0x17a540['id'];if(_0x5c503b[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x134280[_0x1f07('0xd4')]=_['merge'](_0x134280['where'],{'$or':_[_0x1f07('0x2d')](_0x134280[_0x1f07('0x48')],function(_0x218a9a){var _0x28602a={};_0x28602a[_0x218a9a]={'$like':'%'+_0x5c503b[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x28602a;})});}_0x134280=_[_0x1f07('0x58')]({},_0x134280,_0x5c503b[_0x1f07('0xd5')]);return db['MailInteraction'][_0x1f07('0x1f')]({'where':_0x134280[_0x1f07('0xd4')]})['then'](function(_0x3495db){_0x3ea168['count']=_0x3495db;if(_0x5c503b[_0x1f07('0x44')][_0x1f07('0x42')]){_0x134280[_0x1f07('0x43')]=[{'all':!![]}];}return db[_0x1f07('0xe4')]['findAll'](_0x134280);})[_0x1f07('0x22')](function(_0x5b6a89){_0x3ea168['rows']=_0x5b6a89;return _0x3ea168;});}})[_0x1f07('0x22')](respondWithFilteredResult(_0x3ffa0b,_0x134280))[_0x1f07('0x56')](handleError(_0x3ffa0b,null));};exports[_0x1f07('0xe5')]=function(_0x4b523e,_0x5115b7){var _0x443aa8={};var _0x5afc02={};var _0x1897b3;var _0x26014f;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x4b523e[_0x1f07('0x57')]['id']}})['then'](handleEntityNotFound(_0x5115b7,null))['then'](function(_0x947ca1){if(_0x947ca1){_0x1897b3=_0x947ca1;_0x5afc02[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xe6')][_0x1f07('0x36')]);_0x5afc02[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x4b523e[_0x1f07('0x44')]);_0x5afc02[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x5afc02[_0x1f07('0xcc')],_0x5afc02['query']);_0x443aa8[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x5afc02[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x4b523e[_0x1f07('0x44')]['fields']));_0x443aa8[_0x1f07('0x48')]=_0x443aa8[_0x1f07('0x48')][_0x1f07('0x69')]?_0x443aa8[_0x1f07('0x48')]:_0x5afc02['model'];_0x443aa8[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x4b523e[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x443aa8[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x4b523e['query'],_0x5afc02['filters']));if(_0x4b523e['query'][_0x1f07('0x3a')]){_0x443aa8[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x443aa8['where'],{'$or':_['map'](_0x443aa8[_0x1f07('0x48')],function(_0x5ed62b){var _0xa7729f={};_0xa7729f[_0x5ed62b]={'$like':'%'+_0x4b523e[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0xa7729f;})});}_0x443aa8=_[_0x1f07('0x58')]({},_0x443aa8,_0x4b523e[_0x1f07('0xd5')]);return _0x1897b3[_0x1f07('0xe5')](_0x443aa8);}})[_0x1f07('0x22')](function(_0x1aeb1e){if(_0x1aeb1e){_0x26014f=_0x1aeb1e['length'];if(!_0x4b523e['query']['hasOwnProperty']('nolimit')){_0x443aa8['limit']=qs[_0x1f07('0x1e')](_0x4b523e['query'][_0x1f07('0x1e')]);_0x443aa8['offset']=qs[_0x1f07('0x1c')](_0x4b523e[_0x1f07('0x44')]['offset']);}return _0x1897b3[_0x1f07('0xe5')](_0x443aa8);}})[_0x1f07('0x22')](function(_0x39de31){if(_0x39de31){return _0x39de31?{'count':_0x26014f,'rows':_0x39de31}:null;}})[_0x1f07('0x22')](respondWithResult(_0x5115b7,null))[_0x1f07('0x56')](handleError(_0x5115b7,null));};exports[_0x1f07('0xe7')]=function(_0x4fb2f0,_0x4fa2ca){var _0x5bf177={};var _0x4ac9d7={};var _0x197ad2;var _0x3b6a0b;return db[_0x1f07('0x4a')]['findOne']({'where':{'id':_0x4fb2f0['params']['id']}})['then'](handleEntityNotFound(_0x4fa2ca,null))[_0x1f07('0x22')](function(_0xc88e29){if(_0xc88e29){_0x197ad2=_0xc88e29;_0x4ac9d7[_0x1f07('0xcc')]=_['keys'](db[_0x1f07('0xe8')][_0x1f07('0x36')]);_0x4ac9d7['query']=_[_0x1f07('0xcd')](_0x4fb2f0[_0x1f07('0x44')]);_0x4ac9d7[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x4ac9d7[_0x1f07('0xcc')],_0x4ac9d7['query']);_0x5bf177[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x4ac9d7[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x4fb2f0[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x5bf177[_0x1f07('0x48')]=_0x5bf177['attributes'][_0x1f07('0x69')]?_0x5bf177[_0x1f07('0x48')]:_0x4ac9d7['model'];_0x5bf177[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x4fb2f0['query'][_0x1f07('0xd3')]);_0x5bf177[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x4fb2f0[_0x1f07('0x44')],_0x4ac9d7[_0x1f07('0xcf')]));if(_0x4fb2f0['query']['filter']){_0x5bf177[_0x1f07('0xd4')]=_['merge'](_0x5bf177[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x5bf177[_0x1f07('0x48')],function(_0x300085){var _0x399a4f={};_0x399a4f[_0x300085]={'$like':'%'+_0x4fb2f0[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x399a4f;})});}_0x5bf177=_[_0x1f07('0x58')]({},_0x5bf177,_0x4fb2f0[_0x1f07('0xd5')]);return _0x197ad2[_0x1f07('0xe7')](_0x5bf177);}})[_0x1f07('0x22')](function(_0x32360f){if(_0x32360f){_0x3b6a0b=_0x32360f[_0x1f07('0x69')];if(!_0x4fb2f0[_0x1f07('0x44')]['hasOwnProperty'](_0x1f07('0xd8'))){_0x5bf177['limit']=qs[_0x1f07('0x1e')](_0x4fb2f0[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x5bf177[_0x1f07('0x1c')]=qs['offset'](_0x4fb2f0[_0x1f07('0x44')][_0x1f07('0x1c')]);}return _0x197ad2[_0x1f07('0xe7')](_0x5bf177);}})['then'](function(_0x421d3e){if(_0x421d3e){return _0x421d3e?{'count':_0x3b6a0b,'rows':_0x421d3e}:null;}})[_0x1f07('0x22')](respondWithResult(_0x4fa2ca,null))[_0x1f07('0x56')](handleError(_0x4fa2ca,null));};exports[_0x1f07('0xe9')]=function(_0x52ac46,_0x285444){var _0x594e43={};var _0x56b4ec={};var _0x55f7f9;var _0x26f3a8;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x52ac46['params']['id']}})['then'](handleEntityNotFound(_0x285444,null))[_0x1f07('0x22')](function(_0x3f15de){if(_0x3f15de){_0x55f7f9=_0x3f15de;_0x56b4ec[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xea')][_0x1f07('0x36')]);_0x56b4ec[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x52ac46[_0x1f07('0x44')]);_0x56b4ec[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x56b4ec['model'],_0x56b4ec[_0x1f07('0x44')]);_0x594e43['attributes']=_[_0x1f07('0xd0')](_0x56b4ec[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x52ac46[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x594e43[_0x1f07('0x48')]=_0x594e43[_0x1f07('0x48')][_0x1f07('0x69')]?_0x594e43['attributes']:_0x56b4ec[_0x1f07('0xcc')];_0x594e43['order']=qs[_0x1f07('0xd3')](_0x52ac46[_0x1f07('0x44')]['sort']);_0x594e43['where']=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x52ac46[_0x1f07('0x44')],_0x56b4ec[_0x1f07('0xcf')]));if(_0x52ac46[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x594e43[_0x1f07('0xd4')]=_['merge'](_0x594e43[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x594e43[_0x1f07('0x48')],function(_0x262c9f){var _0x533079={};_0x533079[_0x262c9f]={'$like':'%'+_0x52ac46['query'][_0x1f07('0x3a')]+'%'};return _0x533079;})});}_0x594e43=_[_0x1f07('0x58')]({},_0x594e43,_0x52ac46[_0x1f07('0xd5')]);return _0x55f7f9['getWhatsappInteractions'](_0x594e43);}})[_0x1f07('0x22')](function(_0x57cc0c){if(_0x57cc0c){_0x26f3a8=_0x57cc0c[_0x1f07('0x69')];if(!_0x52ac46[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0x594e43[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x52ac46['query'][_0x1f07('0x1e')]);_0x594e43[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x52ac46[_0x1f07('0x44')][_0x1f07('0x1c')]);}return _0x55f7f9[_0x1f07('0xe9')](_0x594e43);}})['then'](function(_0x683262){if(_0x683262){return _0x683262?{'count':_0x26f3a8,'rows':_0x683262}:null;}})[_0x1f07('0x22')](respondWithResult(_0x285444,null))['catch'](handleError(_0x285444,null));};exports[_0x1f07('0xeb')]=function(_0x5497fe,_0x40b777,_0x2bf02f){var _0x2f265c;var _0x240984;var _0x202e13;var _0x3ca8aa=!_[_0x1f07('0x64')](_0x5497fe[_0x1f07('0x57')]['id'])?_0x5497fe[_0x1f07('0x57')]['id']:!_['isNil'](_0x5497fe['user']['id'])?_0x5497fe[_0x1f07('0x29')]['id']:null;return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x3ca8aa,'role':{'$or':['admin','user',_0x1f07('0x7d')]}},'attributes':['id','name','phone',_0x1f07('0xec'),_0x1f07('0x27'),_0x1f07('0x5e'),_0x1f07('0x9a')]})[_0x1f07('0x22')](function(_0x4a823e){if(_0x4a823e){if(_0x4a823e[_0x1f07('0x27')]===_0x1f07('0x7d')){_0x2f265c=_0x4a823e;if(_0x5497fe[_0x1f07('0x59')]['interface']){_0x202e13=util[_0x1f07('0xc1')](_0x1f07('0xed'),_0x2f265c[_0x5497fe[_0x1f07('0x59')][_0x1f07('0x9c')]]);}else if(_0x5497fe['body'][_0x1f07('0xee')]){_0x202e13=util[_0x1f07('0xc1')](_0x1f07('0xa5'),_0x5497fe[_0x1f07('0x59')][_0x1f07('0xee')]);}else{_0x202e13=util[_0x1f07('0xc1')](_0x1f07('0xa5'),_0x2f265c['name']);}socket['to'](util['format'](_0x1f07('0xef'),_0x2f265c['name']))[_0x1f07('0x23')](_0x1f07('0xf0'),{'user':{'id':_0x2f265c['id'],'name':_0x2f265c[_0x1f07('0x31')]},'ip':_0x5497fe[_0x1f07('0xf1')]['x-forwarded-for']||_0x5497fe['connection'][_0x1f07('0xf2')]||_0x5497fe[_0x1f07('0xf3')][_0x1f07('0xf2')]||_0x5497fe[_0x1f07('0xf4')][_0x1f07('0xf3')][_0x1f07('0xf2')]});return db[_0x1f07('0xa7')][_0x1f07('0x25')]({'where':{'membername':_0x2f265c[_0x1f07('0x31')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x1f07('0x22')](function(){if(_0x2f265c){return _0x2f265c[_0x1f07('0xf5')]({'raw':!![]});}})[_0x1f07('0x22')](function(_0x5daabb){if(_0x2f265c){if(_0x5daabb){_0x240984=_0x5daabb;if(_0x240984[_0x1f07('0x69')]){var _0x50ec59=_0x240984[_0x1f07('0x2d')](function(_0x3745e2){var _0xf2f789={'membername':_0x2f265c[_0x1f07('0x31')],'UserId':_0x2f265c['id'],'queue_name':_0x3745e2[_0x1f07('0x31')],'VoiceQueueId':_0x3745e2['id'],'interface':_0x202e13,'paused':_0x2f265c[_0x1f07('0x9a')]||![],'penalty':_0x3745e2[_0x1f07('0xf6')]||0x0};return db[_0x1f07('0xa7')][_0x1f07('0xf7')](_0xf2f789);});return Promise[_0x1f07('0x55')](_0x50ec59);}}}})[_0x1f07('0x22')](function(){if(_0x2f265c){return db[_0x1f07('0xf8')][_0x1f07('0x4b')]({'where':{'membername':_0x2f265c[_0x1f07('0x31')],'exitAt':null}});}})[_0x1f07('0x22')](function(_0xed74d9){if(_0x2f265c){var _0x5c6c39=[];_0xed74d9['forEach'](function(_0x15ec48){_0x5c6c39['push'](_0x15ec48['update']({'exitAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9'))}));});return Promise[_0x1f07('0x55')](_0x5c6c39);}})[_0x1f07('0x22')](function(){if(_0x2f265c){var _0x40fada=[];var _0x3b8e6a=[];var _0x49b63a=utils[_0x1f07('0xfa')]();var _0xc1f635={'membername':_0x2f265c[_0x1f07('0x31')],'interface':_0x202e13,'enterAt':moment()[_0x1f07('0xc1')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2f265c[_0x1f07('0x27')],'internal':_0x2f265c['internal']};_0x49b63a['forEach'](function(_0x177373){_0x40fada[_0x1f07('0x49')](_[_0x1f07('0x58')]({'channel':_0x177373,'type':_0x1f07('0xfb'),'data1':_0x5497fe[_0x1f07('0x59')][_0x1f07('0xfc')],'data2':_0x202e13},_0xc1f635));if(_0x2f265c['loginInPause']){_0x3b8e6a[_0x1f07('0x49')](_[_0x1f07('0x58')]({'channel':_0x177373,'type':'PAUSE','data1':'LOGININPAUSE'},_0xc1f635));}});return db['MemberReport'][_0x1f07('0x87')](_0x40fada[_0x1f07('0xbe')](_0x3b8e6a),{'individualHooks':!![]});}})[_0x1f07('0x22')](function(){if(_0x2f265c){return _0x2f265c[_0x1f07('0x21')]({'online':!![],'lastLoginAt':moment()['format'](_0x1f07('0xf9')),'voicePause':_0x2f265c[_0x1f07('0x9a')]||![],'mailPause':_0x2f265c[_0x1f07('0x9a')]||![],'chatPause':_0x2f265c['loginInPause']||![],'faxPause':_0x2f265c['loginInPause']||![],'smsPause':_0x2f265c[_0x1f07('0x9a')]||![],'openchannelPause':_0x2f265c[_0x1f07('0x9a')]||![],'whatsappPause':_0x2f265c['loginInPause']||![],'pauseType':_0x2f265c[_0x1f07('0x9a')]?_0x1f07('0xfd'):null,'interface':_0x202e13,'lastPauseAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9'))});}})[_0x1f07('0x22')](function(_0x36a468){if(_0x5497fe[_0x1f07('0xfe')]){return _0x2bf02f();}else{return Promise[_0x1f07('0xff')](_0x36a468)[_0x1f07('0x22')](respondWithResult(_0x40b777,null));}})['catch'](handleError(_0x40b777,null));};exports[_0x1f07('0x100')]=function(_0x3d4bd9,_0x2d5411){var _0x5245c9;return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x3d4bd9[_0x1f07('0x57')]['id'],'role':'agent'},'attributes':['id',_0x1f07('0x31'),_0x1f07('0x27')]})[_0x1f07('0x22')](handleEntityNotFound(_0x2d5411,null))[_0x1f07('0x22')](function(_0x416be3){if(_0x416be3){_0x5245c9=_0x416be3;return db[_0x1f07('0xa7')]['destroy']({'where':{'membername':_0x5245c9[_0x1f07('0x31')]},'individualHooks':!![]});}})[_0x1f07('0x22')](function(){return db[_0x1f07('0xf8')][_0x1f07('0x4b')]({'where':{'membername':_0x5245c9[_0x1f07('0x31')],'exitAt':null}});})['then'](function(_0x1d10fe){var _0x4ff1a9=[];_0x1d10fe[_0x1f07('0x101')](function(_0x5111f6){_0x4ff1a9[_0x1f07('0x49')](_0x5111f6[_0x1f07('0x21')]({'exitAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9'))}));});return Promise['all'](_0x4ff1a9);})[_0x1f07('0x22')](function(){return _0x5245c9[_0x1f07('0x21')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x1f07('0x22')](respondWithResult(_0x2d5411,null))[_0x1f07('0x56')](handleError(_0x2d5411,null));};exports['pause']=function(_0x1ec8cb,_0x54ca30){var _0x3e610e;return db[_0x1f07('0xa7')][_0x1f07('0x21')]({'paused':0x1},{'where':{'UserId':_0x1ec8cb['params']['id']},'individualHooks':!![]})[_0x1f07('0x22')](function(){return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x1ec8cb['params']['id'],'role':_0x1f07('0x7d')},'attributes':['id',_0x1f07('0x31'),_0x1f07('0x27'),_0x1f07('0x5e'),_0x1f07('0x9c'),_0x1f07('0x99')]});})['then'](handleEntityNotFound(_0x54ca30,null))[_0x1f07('0x22')](function(_0xb6ac94){if(_0xb6ac94){_0x3e610e=_0xb6ac94;return db['MemberReport'][_0x1f07('0x4b')]({'where':{'membername':_0x3e610e[_0x1f07('0x31')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x39aac7){if(_0x39aac7[_0x1f07('0x69')]){var _0x296bcb=moment()[_0x1f07('0xc1')](_0x1f07('0xf9'));for(var _0x543122=0x0,_0x3ce9c3=_0x39aac7['length'];_0x543122<_0x3ce9c3;_0x543122++){_0x39aac7[_0x543122]['updateAttributes']({'exitAt':_0x296bcb});}}})['then'](function(){var _0x4d32aa=[];var _0x3444e6=utils[_0x1f07('0xfa')]();_0x3444e6[_0x1f07('0x101')](function(_0x42f052){_0x4d32aa[_0x1f07('0x49')]({'channel':_0x42f052,'membername':_0x3e610e[_0x1f07('0x31')],'interface':_[_0x1f07('0x64')](_0x3e610e[_0x1f07('0x9c')])?util['format'](_0x1f07('0xa5'),_0x3e610e['name']):_0x3e610e[_0x1f07('0x9c')],'type':_0x1f07('0x102'),'enterAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9')),'data1':_0x1ec8cb['body'][_0x1f07('0x38')]||'DEFAULT\x20PAUSE','role':_0x3e610e[_0x1f07('0x27')],'internal':_0x3e610e[_0x1f07('0x5e')]});});return db[_0x1f07('0xf8')][_0x1f07('0x87')](_0x4d32aa,{'individualHooks':!![]});})[_0x1f07('0x22')](function(){return _0x3e610e[_0x1f07('0x21')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1ec8cb['body'][_0x1f07('0x38')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9'))});})[_0x1f07('0x22')](respondWithResult(_0x54ca30,null))['catch'](handleError(_0x54ca30,null));};exports[_0x1f07('0x103')]=function(_0x2d1288,_0x132af7){if(_0x2d1288[_0x1f07('0x59')][_0x1f07('0x98')]&&!utils[_0x1f07('0x9d')](_0x2d1288[_0x1f07('0x59')][_0x1f07('0x98')])){throw new APIBadRequestError(util[_0x1f07('0xc1')](_0x1f07('0x104'),_0x2d1288['body']['channel']));}return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x2d1288[_0x1f07('0x57')]['id']},'attributes':['id',_0x1f07('0x31'),_0x1f07('0x27'),_0x1f07('0x5e'),_0x1f07('0x9c'),'online','voicePause','mailPause',_0x1f07('0x105'),_0x1f07('0x106'),_0x1f07('0x107'),_0x1f07('0x108'),_0x1f07('0x109'),'pauseType',_0x1f07('0x10a')]})[_0x1f07('0x22')](function(_0x33ce6c){if(!_0x33ce6c){throw new APINotFoundError(util[_0x1f07('0xc1')](_0x1f07('0xc2'),_0x2d1288['params']['id']));}return _0x33ce6c[_0x1f07('0x103')](_0x2d1288[_0x1f07('0x59')][_0x1f07('0x98')]);})['then'](respondWithResult(_0x132af7,null))[_0x1f07('0x56')](APIHandleError(_0x132af7));};exports[_0x1f07('0x10b')]=function(_0x458daa,_0x1d6c6a){var _0x36a6ae={};var _0x29c875={};var _0x394f48;var _0x13a0ce;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x458daa[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x1d6c6a,null))[_0x1f07('0x22')](function(_0x5278ca){if(_0x5278ca){_0x394f48=_0x5278ca;_0x29c875[_0x1f07('0xcc')]=_['keys'](db['Team']['rawAttributes']);_0x29c875['query']=_[_0x1f07('0xcd')](_0x458daa[_0x1f07('0x44')]);_0x29c875[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x29c875[_0x1f07('0xcc')],_0x29c875[_0x1f07('0x44')]);_0x36a6ae[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x29c875[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x458daa['query']['fields']));_0x36a6ae[_0x1f07('0x48')]=_0x36a6ae[_0x1f07('0x48')]['length']?_0x36a6ae[_0x1f07('0x48')]:_0x29c875[_0x1f07('0xcc')];_0x36a6ae[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x458daa['query']['sort']);_0x36a6ae['where']=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x458daa[_0x1f07('0x44')],_0x29c875[_0x1f07('0xcf')]));if(_0x458daa[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x36a6ae[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x36a6ae[_0x1f07('0xd4')],{'$or':_['map'](_0x36a6ae[_0x1f07('0x48')],function(_0x36b937){var _0x3b21dc={};_0x3b21dc[_0x36b937]={'$like':'%'+_0x458daa[_0x1f07('0x44')]['filter']+'%'};return _0x3b21dc;})});}_0x36a6ae=_['merge']({},_0x36a6ae,_0x458daa['options']);return _0x394f48[_0x1f07('0x10b')](_0x36a6ae);}})['then'](function(_0x4ea400){if(_0x4ea400){_0x13a0ce=_0x4ea400[_0x1f07('0x69')];if(!_0x458daa[_0x1f07('0x44')]['hasOwnProperty'](_0x1f07('0xd8'))){_0x36a6ae['limit']=qs[_0x1f07('0x1e')](_0x458daa[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x36a6ae['offset']=qs['offset'](_0x458daa['query'][_0x1f07('0x1c')]);}return _0x394f48[_0x1f07('0x10b')](_0x36a6ae);}})[_0x1f07('0x22')](function(_0xd3034d){if(_0xd3034d){return _0xd3034d?{'count':_0x13a0ce,'rows':_0xd3034d}:null;}})[_0x1f07('0x22')](respondWithResult(_0x1d6c6a,null))[_0x1f07('0x56')](handleError(_0x1d6c6a,null));};exports[_0x1f07('0x10c')]=function(_0x5d24c5,_0x58d27e){var _0x4776c3=_0x5d24c5[_0x1f07('0x57')]['id'];var _0x16ce39=_0x5d24c5[_0x1f07('0x59')]?_0x5d24c5[_0x1f07('0x59')][_0x1f07('0x5c')]:null;var _0x4f9baa=[];return Promise['resolve']()[_0x1f07('0x22')](function(){if(!_0x16ce39)throw new APIBadRequestError(_0x1f07('0x10d'));})[_0x1f07('0x22')](function(){return db['User'][_0x1f07('0xc0')]({'where':{'id':_0x4776c3}});})[_0x1f07('0x22')](function(_0x2f0d45){if(!_0x2f0d45)throw new APINotFoundError(util[_0x1f07('0xc1')](_0x1f07('0xc2'),_0x5d24c5[_0x1f07('0x57')]['id']));return db[_0x1f07('0x66')][_0x1f07('0x10e')](function(_0x1aee77){return _0x2f0d45[_0x1f07('0x10c')](_0x16ce39,{'transaction':_0x1aee77})[_0x1f07('0x22')](function(){return db[_0x1f07('0x10f')][_0x1f07('0x4b')]({'where':{'id':{'$in':_0x16ce39}}});})[_0x1f07('0x22')](function(_0x18dac2){var _0x152a55=_[_0x1f07('0x2d')](_0x18dac2,function(_0x5f9fdd){return _0x5f9fdd[_0x1f07('0x110')]();});return Promise[_0x1f07('0x55')](_0x152a55);})['then'](function(_0x185bfc){_0x4f9baa=_[_0x1f07('0x111')](_0x185bfc);var _0x417d9c=_[_0x1f07('0x2d')](_0x4f9baa,function(_0x16a570){return _0x16a570[_0x1f07('0x112')](_0x2f0d45['id'],{'transaction':_0x1aee77});});return Promise[_0x1f07('0x55')](_0x417d9c);})[_0x1f07('0x22')](function(){if(!_0x2f0d45[_0x1f07('0x99')])return;var _0x2485ba=_['filter'](_0x4f9baa,function(_0x323794){return _0x323794['getDataValue'](_0x1f07('0x98'))===_0x1f07('0x113');});var _0x4daaf8=_[_0x1f07('0x2d')](_0x2485ba,function(_0x358164){return db[_0x1f07('0xa7')]['upsert']({'membername':_0x2f0d45[_0x1f07('0x31')],'UserId':_0x2f0d45['id'],'queue_name':_0x358164['name'],'VoiceQueueId':_0x358164['id'],'interface':_[_0x1f07('0x64')](_0x2f0d45[_0x1f07('0x9c')])?util[_0x1f07('0xc1')]('SIP/%s',_0x2f0d45['name']):_0x2f0d45[_0x1f07('0x9c')],'paused':_0x2f0d45[_0x1f07('0x9b')]||![],'penalty':_0x2f0d45[_0x1f07('0xa6')]},{'transaction':_0x1aee77});});return Promise['all'](_0x4daaf8);})[_0x1f07('0x22')](function(){return db[_0x1f07('0x114')][_0x1f07('0x4b')]({'where':{'teamId':{'$in':_0x16ce39}}});})[_0x1f07('0x22')](function(_0x48882b){var _0x40ce2a=_[_0x1f07('0x2d')](_0x48882b,function(_0x47e38c){return db[_0x1f07('0x115')][_0x1f07('0x7c')]({'UserId':_0x2f0d45['id'],'VoicePrefixId':_0x47e38c[_0x1f07('0x116')]},{'transaction':_0x1aee77});});return Promise[_0x1f07('0x55')](_0x40ce2a);});});})['then'](function(){for(var _0x1c76ac=0x0;_0x1c76ac<_0x4f9baa[_0x1f07('0x69')];_0x1c76ac++){var _0x5c6508=_0x4f9baa[_0x1c76ac]['getDataValue'](_0x1f07('0x98'));var _0x56ca73=_0x5c6508+_0x1f07('0xa1');socket[_0x1f07('0x23')](_0x1f07('0x29')+_0x5c6508+_0x1f07('0xa2'),{'UserId':_0x4776c3,['queueField']:_0x4f9baa[_0x1c76ac]['id']});}})[_0x1f07('0x22')](respondWithStatusCode(_0x58d27e,null))[_0x1f07('0x56')](APIHandleError(_0x58d27e));};exports[_0x1f07('0x117')]=function(_0x4792a7,_0x5ab837){var _0x448e03=_0x4792a7[_0x1f07('0x57')]['id'];var _0x1b9645=null;if(_0x4792a7[_0x1f07('0x44')][_0x1f07('0x5c')]){_0x1b9645=_[_0x1f07('0xaa')](_0x4792a7[_0x1f07('0x44')]['ids'])?_0x4792a7[_0x1f07('0x44')][_0x1f07('0x5c')]:[_0x4792a7[_0x1f07('0x44')]['ids']];}var _0x515f00=[];return Promise[_0x1f07('0xff')]()[_0x1f07('0x22')](function(){if(!_0x1b9645)throw new APIBadRequestError(_0x1f07('0x118'));})[_0x1f07('0x22')](function(){return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x448e03}});})[_0x1f07('0x22')](function(_0x115e99){if(!_0x115e99)throw new APINotFoundError(util['format'](_0x1f07('0xc2'),_0x4792a7[_0x1f07('0x57')]['id']));return db[_0x1f07('0x66')][_0x1f07('0x10e')](function(_0x58ded0){return _0x115e99[_0x1f07('0x117')](_0x1b9645,{'transaction':_0x58ded0})[_0x1f07('0x22')](function(){return db['Team'][_0x1f07('0x4b')]({'where':{'id':{'$in':_0x1b9645}}});})[_0x1f07('0x22')](function(_0x211dbc){var _0x270e96=_[_0x1f07('0x2d')](_0x211dbc,function(_0x2d8f72){return _0x2d8f72[_0x1f07('0x110')]();});return Promise[_0x1f07('0x55')](_0x270e96);})[_0x1f07('0x22')](function(_0x491085){_0x515f00=_[_0x1f07('0x111')](_0x491085);var _0x2fa058=_[_0x1f07('0x2d')](_0x515f00,function(_0xc73ba7){return _0xc73ba7[_0x1f07('0x119')](_0x115e99['id'],{'transaction':_0x58ded0});});return Promise['all'](_0x2fa058);})['then'](function(){if(!_0x115e99[_0x1f07('0x99')])return;var _0x1e39a1=_[_0x1f07('0x3a')](_0x515f00,function(_0x366c21){return _0x366c21[_0x1f07('0x11a')]('channel')===_0x1f07('0x113');});var _0x5e8d0f=_[_0x1f07('0x2d')](_0x1e39a1,function(_0x56d116){return db[_0x1f07('0xa7')][_0x1f07('0x25')]({'where':{'VoiceQueueId':_0x56d116['id'],'UserId':_0x115e99['id']},'transaction':_0x58ded0});});return Promise['all'](_0x5e8d0f);})['then'](function(){return db[_0x1f07('0x114')][_0x1f07('0x4b')]({'where':{'teamId':{'$in':_0x1b9645}}});})['then'](function(_0x1b76e6){var _0x2feb6c=_[_0x1f07('0x2d')](_0x1b76e6,function(_0x4b317c){return db[_0x1f07('0x115')]['destroy']({'where':{'UserId':_0x115e99['id'],'VoicePrefixId':_0x4b317c['VoicePrefixId']}},{'transaction':_0x58ded0});});return Promise['all'](_0x2feb6c);});});})['then'](function(){for(var _0x3b996e=0x0;_0x3b996e<_0x515f00[_0x1f07('0x69')];_0x3b996e++){var _0x9029a5=_0x515f00[_0x3b996e][_0x1f07('0x11a')]('channel');var _0x78918e=_0x9029a5+_0x1f07('0xa1');socket[_0x1f07('0x23')](_0x1f07('0x29')+_0x9029a5+_0x1f07('0xab'),{'UserId':_0x448e03,['queueField']:_0x515f00[_0x3b996e]['id']});}})['then'](respondWithStatusCode(_0x5ab837,null))[_0x1f07('0x56')](APIHandleError(_0x5ab837));};exports[_0x1f07('0x11b')]=function(_0x289e31,_0x3ef9b5){var _0x1309e0={};var _0x292446={};var _0xa123a8;var _0x5515b4;return db[_0x1f07('0x4a')]['findOne']({'where':{'id':_0x289e31[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x3ef9b5,null))[_0x1f07('0x22')](function(_0x2e1caa){if(_0x2e1caa){_0xa123a8=_0x2e1caa;_0x292446[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xc4')][_0x1f07('0x36')]);_0x292446[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x289e31[_0x1f07('0x44')]);_0x292446[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x292446['model'],_0x292446['query']);_0x1309e0[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x292446[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x289e31[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x1309e0[_0x1f07('0x48')]=_0x1309e0['attributes'][_0x1f07('0x69')]?_0x1309e0[_0x1f07('0x48')]:_0x292446[_0x1f07('0xcc')];_0x1309e0[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x289e31['query'][_0x1f07('0xd3')]);_0x1309e0[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x289e31[_0x1f07('0x44')],_0x292446[_0x1f07('0xcf')]));if(_0x289e31[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x1309e0['where']=_[_0x1f07('0x58')](_0x1309e0['where'],{'$or':_[_0x1f07('0x2d')](_0x1309e0[_0x1f07('0x48')],function(_0x20b381){var _0x158b25={};_0x158b25[_0x20b381]={'$like':'%'+_0x289e31['query'][_0x1f07('0x3a')]+'%'};return _0x158b25;})});}_0x1309e0=_['merge']({},_0x1309e0,_0x289e31[_0x1f07('0xd5')]);return _0xa123a8[_0x1f07('0x11b')](_0x1309e0);}})[_0x1f07('0x22')](function(_0x58c756){if(_0x58c756){_0x5515b4=_0x58c756[_0x1f07('0x69')];if(!_0x289e31['query'][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0x1309e0[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x289e31[_0x1f07('0x44')]['limit']);_0x1309e0[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x289e31['query']['offset']);}return _0xa123a8[_0x1f07('0x11b')](_0x1309e0);}})[_0x1f07('0x22')](function(_0x54e45d){if(_0x54e45d){return _0x54e45d?{'count':_0x5515b4,'rows':_0x54e45d}:null;}})['then'](respondWithResult(_0x3ef9b5,null))[_0x1f07('0x56')](handleError(_0x3ef9b5,null));};exports[_0x1f07('0x11c')]=function(_0x2e7f04,_0x4228ab){var _0xb95aa={};var _0x392b62={};var _0x35412c;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x2e7f04[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x4228ab,null))[_0x1f07('0x22')](function(_0xda6c3){if(_0xda6c3){_0x35412c=_0xda6c3;_0x392b62[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db['User'][_0x1f07('0x36')]);_0x392b62[_0x1f07('0x44')]=_['keys'](_0x2e7f04[_0x1f07('0x44')]);_0x392b62[_0x1f07('0xcf')]=_['intersection'](_0x392b62[_0x1f07('0xcc')],_0x392b62[_0x1f07('0x44')]);_0xb95aa[_0x1f07('0x48')]=_['intersection'](_0x392b62[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x2e7f04[_0x1f07('0x44')][_0x1f07('0xd1')]));_0xb95aa[_0x1f07('0x48')]=_0xb95aa[_0x1f07('0x48')][_0x1f07('0x69')]?_0xb95aa[_0x1f07('0x48')]:_0x392b62[_0x1f07('0xcc')];_0xb95aa[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x2e7f04[_0x1f07('0x44')]['sort']);_0xb95aa[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x2e7f04[_0x1f07('0x44')],_0x392b62[_0x1f07('0xcf')]));if(_0x2e7f04[_0x1f07('0x44')][_0x1f07('0x3a')]){_0xb95aa[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0xb95aa[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0xb95aa[_0x1f07('0x48')],function(_0x503dd9){var _0x1f13ef={};_0x1f13ef[_0x503dd9]={'$like':'%'+_0x2e7f04['query']['filter']+'%'};return _0x1f13ef;})});}_0xb95aa[_0x1f07('0xcc')]=db[_0x1f07('0x4a')];_0xb95aa['as']=_0x1f07('0x2a');_0xb95aa=_[_0x1f07('0x58')]({},_0xb95aa,_0x2e7f04['options']);return _0x35412c[_0x1f07('0xf5')]({'include':[_0xb95aa]});}})[_0x1f07('0x22')](function(_0x4ed93d){if(_0x4ed93d){var _0x5e45fc={},_0x11e2ab=[];for(var _0x9e7f6c=0x0;_0x9e7f6c<_0x4ed93d[_0x1f07('0x69')];_0x9e7f6c+=0x1){for(var _0x25f667=0x0,_0x64e3d1;_0x25f667<_0x4ed93d[_0x9e7f6c][_0x1f07('0x2a')]['length'];_0x25f667+=0x1){_0x64e3d1=_0x4ed93d[_0x9e7f6c]['Agents'][_0x25f667][_0x1f07('0x26')]({'plain':!![]});_0x5e45fc[_0x64e3d1['id']]=_0x64e3d1;}}_0x5e45fc=_['values'](_0x5e45fc);for(var _0x5102ed=qs['offset'](_0x2e7f04[_0x1f07('0x44')][_0x1f07('0x1c')]);_0x5102ed<_0x5e45fc[_0x1f07('0x69')]&&_0x11e2ab[_0x1f07('0x69')]=_0x272649[_0xfb58('0x53')]){throw new Error(_0xfb58('0x54'));}})[_0xfb58('0x16')](function(){if(_0x130f5d){return db[_0xfb58('0x27')]['destroy']({'where':{'membername':_0x130f5d[_0xfb58('0x21')]},'individualHooks':!![]});}})[_0xfb58('0x16')](function(){if(_0x130f5d){return _0x130f5d[_0xfb58('0x55')]({'raw':!![]});}})[_0xfb58('0x16')](function(_0x3be7d3){if(_0x130f5d){if(_0x3be7d3){var _0x4404f9=[];_0x2d5697=_0x3be7d3;if(_0x2d5697['length']){for(var _0x1cc356=0x0;_0x1cc356<_0x2d5697[_0xfb58('0x2a')];_0x1cc356++){_0x4404f9[_0xfb58('0x48')](db[_0xfb58('0x27')][_0xfb58('0x56')]({'membername':_0x130f5d[_0xfb58('0x21')],'UserId':_0x130f5d['id'],'queue_name':_0x2d5697[_0x1cc356][_0xfb58('0x21')],'VoiceQueueId':_0x2d5697[_0x1cc356]['id'],'interface':_0x1db360,'paused':_0x130f5d[_0xfb58('0x4d')]||![],'penalty':_0x2d5697[_0x1cc356][_0xfb58('0x57')]||0x0}));}return BPromise[_0xfb58('0x49')](_0x4404f9);}}}})['then'](function(){if(_0x130f5d){return db['MemberReport']['findAll']({'where':{'membername':_0x130f5d[_0xfb58('0x21')],'exitAt':null}});}})[_0xfb58('0x16')](function(_0x309956){if(_0x130f5d){if(_0x309956&&_0x309956[_0xfb58('0x2a')]){var _0x41bf52=[];_0x309956[_0xfb58('0x2e')](function(_0x189874){_0x41bf52['push'](_0x189874['update']({'exitAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b'))}));});return BPromise[_0xfb58('0x49')](_0x41bf52);}}})[_0xfb58('0x16')](function(){if(_0x130f5d){var _0x3ab62c=[];var _0x2b8094=[];var _0x5232b5=utils[_0xfb58('0x2d')]();var _0x10f37a={'membername':_0x130f5d[_0xfb58('0x21')],'interface':_0x1db360,'enterAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b')),'role':_0x130f5d[_0xfb58('0x22')],'internal':_0x130f5d['internal']};_0x5232b5[_0xfb58('0x2e')](function(_0x528513){_0x3ab62c[_0xfb58('0x48')](_[_0xfb58('0x58')]({'channel':_0x528513,'type':'LOGIN','data1':_0xfb58('0x59'),'data2':_0x1db360},_0x10f37a));if(_0x130f5d[_0xfb58('0x4d')]){_0x2b8094[_0xfb58('0x48')](_[_0xfb58('0x58')]({'channel':_0x528513,'type':_0xfb58('0x30'),'data1':'LOGININPAUSE'},_0x10f37a));}});return db['MemberReport'][_0xfb58('0x5a')](_0x3ab62c[_0xfb58('0x5b')](_0x2b8094),{'individualHooks':!![]});}})[_0xfb58('0x16')](function(){if(_0x130f5d){return _0x130f5d[_0xfb58('0x28')]({'online':!![],'lastLoginAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b')),'voicePause':_0x130f5d[_0xfb58('0x4d')]||![],'mailPause':_0x130f5d[_0xfb58('0x4d')]||![],'chatPause':_0x130f5d[_0xfb58('0x4d')]||![],'faxPause':_0x130f5d[_0xfb58('0x4d')]||![],'smsPause':_0x130f5d[_0xfb58('0x4d')]||![],'openchannelPause':_0x130f5d[_0xfb58('0x4d')]||![],'pauseType':_0x130f5d[_0xfb58('0x4d')]?_0xfb58('0x5c'):null,'lastPauseAt':moment()[_0xfb58('0x25')](_0xfb58('0x2b')),'interface':_0x1db360});}})[_0xfb58('0x16')](function(_0xa8d72f){_0x1a6bad(_0xa8d72f);})['catch'](function(_0x4ebf73){_0x4c17e4(_0x37b3b2[_0xfb58('0x1a')](0x1f4,_0x4ebf73[_0xfb58('0x1b')]));});});}; \ No newline at end of file +var _0x48d3=['findAll','options','raw','where','attributes','include','map','model','info','debug','stringify','error','message','ShowUser','find','catch','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','update','PAUSE','then','updateAttributes','getChannels','forEach','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','faxPause','openchannelPause','lastPauseAt','system','UserVoiceQueueRt','destroy','MemberReport','push','all','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','length','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User'];(function(_0x2e9f72,_0x36480c){var _0x4b1a98=function(_0x2c7f62){while(--_0x2c7f62){_0x2e9f72['push'](_0x2e9f72['shift']());}};_0x4b1a98(++_0x36480c);}(_0x48d3,0x142));var _0x348d=function(_0x194918,_0x56935f){_0x194918=_0x194918-0x0;var _0x31bcb0=_0x48d3[_0x194918];return _0x31bcb0;};'use strict';var _=require(_0x348d('0x0'));var util=require(_0x348d('0x1'));var moment=require(_0x348d('0x2'));var BPromise=require(_0x348d('0x3'));var Redis=require(_0x348d('0x4'));var db=require(_0x348d('0x5'))['db'];var utils=require(_0x348d('0x6'));var logger=require(_0x348d('0x7'))(_0x348d('0x8'));var config=require(_0x348d('0x9'));config['redis']=_[_0x348d('0xa')](config[_0x348d('0xb')],{'host':_0x348d('0xc'),'port':0x18eb});var socket=require(_0x348d('0xd'))(new Redis(config[_0x348d('0xb')]));require(_0x348d('0xe'))[_0x348d('0xf')](socket);exports[_0x348d('0x10')]=function(_0x95fee7){var _0x4d9032=this;return new Promise(function(_0x4a5d0d,_0xbd1410){return db[_0x348d('0x11')][_0x348d('0x12')]({'raw':_0x95fee7['options']?_0x95fee7[_0x348d('0x13')][_0x348d('0x14')]===undefined?!![]:![]:!![],'where':_0x95fee7[_0x348d('0x13')]?_0x95fee7['options'][_0x348d('0x15')]||null:null,'attributes':_0x95fee7[_0x348d('0x13')]?_0x95fee7[_0x348d('0x13')][_0x348d('0x16')]||null:null,'limit':_0x95fee7[_0x348d('0x13')]?_0x95fee7[_0x348d('0x13')]['limit']||null:null,'include':_0x95fee7['options']?_0x95fee7['options'][_0x348d('0x17')]?_[_0x348d('0x18')](_0x95fee7[_0x348d('0x13')]['include'],function(_0x1d5ec0){return{'model':db[_0x1d5ec0[_0x348d('0x19')]],'as':_0x1d5ec0['as'],'attributes':_0x1d5ec0[_0x348d('0x16')],'include':_0x1d5ec0[_0x348d('0x17')]?_[_0x348d('0x18')](_0x1d5ec0['include'],function(_0x1777a5){return{'model':db[_0x1777a5[_0x348d('0x19')]],'as':_0x1777a5['as'],'attributes':_0x1777a5[_0x348d('0x16')],'include':_0x1777a5['include']?_[_0x348d('0x18')](_0x1777a5[_0x348d('0x17')],function(_0x5bceab){return{'model':db[_0x5bceab[_0x348d('0x19')]],'as':_0x5bceab['as'],'attributes':_0x5bceab[_0x348d('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38f130){logger[_0x348d('0x1a')](_0x348d('0x10'),_0x95fee7);logger[_0x348d('0x1b')](_0x348d('0x10'),_0x95fee7,JSON[_0x348d('0x1c')](_0x38f130));_0x4a5d0d(_0x38f130);})['catch'](function(_0x796a04){logger[_0x348d('0x1d')]('GetUser',_0x796a04[_0x348d('0x1e')],_0x95fee7);_0xbd1410(_0x4d9032[_0x348d('0x1d')](0x1f4,_0x796a04[_0x348d('0x1e')]));});});};exports[_0x348d('0x1f')]=function(_0x43c2ce){var _0x1f1e53=this;return new Promise(function(_0x2960cf,_0x3f84e8){return db[_0x348d('0x11')][_0x348d('0x20')]({'raw':_0x43c2ce[_0x348d('0x13')]?_0x43c2ce['options'][_0x348d('0x14')]===undefined?!![]:![]:!![],'where':_0x43c2ce['options']?_0x43c2ce['options'][_0x348d('0x15')]||null:null,'attributes':_0x43c2ce['options']?_0x43c2ce['options'][_0x348d('0x16')]||null:null,'include':_0x43c2ce[_0x348d('0x13')]?_0x43c2ce[_0x348d('0x13')][_0x348d('0x17')]?_[_0x348d('0x18')](_0x43c2ce[_0x348d('0x13')][_0x348d('0x17')],function(_0x1ff8da){return{'model':db[_0x1ff8da['model']],'as':_0x1ff8da['as'],'attributes':_0x1ff8da[_0x348d('0x16')],'include':_0x1ff8da['include']?_[_0x348d('0x18')](_0x1ff8da[_0x348d('0x17')],function(_0x5a7fa7){return{'model':db[_0x5a7fa7['model']],'as':_0x5a7fa7['as'],'attributes':_0x5a7fa7[_0x348d('0x16')],'include':_0x5a7fa7[_0x348d('0x17')]?_[_0x348d('0x18')](_0x5a7fa7[_0x348d('0x17')],function(_0x28a3b3){return{'model':db[_0x28a3b3[_0x348d('0x19')]],'as':_0x28a3b3['as'],'attributes':_0x28a3b3[_0x348d('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf251e5){logger[_0x348d('0x1a')](_0x348d('0x1f'),_0x43c2ce);logger[_0x348d('0x1b')]('ShowUser',_0x43c2ce,JSON[_0x348d('0x1c')](_0xf251e5));_0x2960cf(_0xf251e5);})[_0x348d('0x21')](function(_0x51da3a){logger['error'](_0x348d('0x1f'),_0x51da3a[_0x348d('0x1e')],_0x43c2ce);_0x3f84e8(_0x1f1e53[_0x348d('0x1d')](0x1f4,_0x51da3a[_0x348d('0x1e')]));});});};exports[_0x348d('0x22')]=function(_0x41415e){var _0x15ec2e;return db[_0x348d('0x11')][_0x348d('0x20')]({'where':_0x41415e[_0x348d('0x13')]['where']||{},'attributes':['id',_0x348d('0x23'),_0x348d('0x24'),_0x348d('0x25'),_0x348d('0x26')]})['then'](function(_0x3beb6e){if(!_0x3beb6e){throw new Error(util[_0x348d('0x27')](_0x348d('0x28'),_0x41415e[_0x348d('0x29')]['id']));}_0x15ec2e=_0x3beb6e;return db['UserVoiceQueueRt'][_0x348d('0x2a')]({'paused':0x1},{'where':{'UserId':_0x15ec2e['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x15ec2e[_0x348d('0x23')],'type':_0x348d('0x2b'),'exitAt':null}});})[_0x348d('0x2c')](function(_0x1c1147){if(_0x1c1147&&_0x1c1147['length']){var _0x595101=moment()[_0x348d('0x27')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4ee896=0x0,_0x18481b=_0x1c1147['length'];_0x4ee896<_0x18481b;_0x4ee896++){_0x1c1147[_0x4ee896][_0x348d('0x2d')]({'exitAt':_0x595101});}}})[_0x348d('0x2c')](function(){var _0x9ab464=[];var _0x4240f1=utils[_0x348d('0x2e')]();_0x4240f1[_0x348d('0x2f')](function(_0x362105){_0x9ab464['push']({'channel':_0x362105,'membername':_0x15ec2e[_0x348d('0x23')],'interface':_[_0x348d('0x30')](_0x15ec2e[_0x348d('0x26')])?util[_0x348d('0x27')](_0x348d('0x31'),_0x15ec2e[_0x348d('0x23')]):_0x15ec2e[_0x348d('0x26')],'type':_0x348d('0x2b'),'enterAt':moment()[_0x348d('0x27')](_0x348d('0x32')),'data1':_0x41415e[_0x348d('0x33')]['type']||_0x348d('0x34'),'role':_0x15ec2e[_0x348d('0x24')],'internal':_0x15ec2e[_0x348d('0x25')],'uniqueid':_0x41415e[_0x348d('0x33')][_0x348d('0x35')]||null});});return db['MemberReport'][_0x348d('0x36')](_0x9ab464,{'individualHooks':!![]});})['then'](function(){return _0x15ec2e[_0x348d('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x41415e[_0x348d('0x33')][_0x348d('0x37')]||_0x348d('0x34'),'lastPauseAt':moment()[_0x348d('0x27')](_0x348d('0x32'))});})[_0x348d('0x21')](function(_0x399a83){throw _0x399a83;});};exports['UnpauseUser']=function(_0x57f71c){return Promise['resolve']()[_0x348d('0x2c')](function(){if(_0x57f71c['body'][_0x348d('0x38')]&&!utils[_0x348d('0x39')](_0x57f71c[_0x348d('0x33')][_0x348d('0x38')])){throw new Error(util[_0x348d('0x27')](_0x348d('0x3a'),_0x57f71c[_0x348d('0x33')][_0x348d('0x38')]));}return db[_0x348d('0x11')][_0x348d('0x3b')]({'where':_0x57f71c[_0x348d('0x13')][_0x348d('0x15')]||{},'attributes':['id',_0x348d('0x23'),_0x348d('0x24'),_0x348d('0x25'),_0x348d('0x26'),_0x348d('0x3c'),'voicePause','mailPause','chatPause',_0x348d('0x3d'),_0x348d('0x3e'),'smsPause','whatsappPause','pauseType',_0x348d('0x3f')]});})[_0x348d('0x2c')](function(_0x5e0b37){if(!_0x5e0b37){throw new Error(util[_0x348d('0x27')](_0x348d('0x28'),_0x57f71c[_0x348d('0x29')]['id']));}return _0x5e0b37['unpause'](_0x57f71c[_0x348d('0x33')]['channel'],_0x348d('0x40'));})[_0x348d('0x21')](function(_0x8a5b9d){throw _0x8a5b9d;});};exports['LogoutUser']=function(_0x441c20){var _0x4dac1e=this;return new Promise(function(_0x136a4c,_0x402463){var _0x50ddd4;return db['User'][_0x348d('0x3b')]({'where':_0x441c20[_0x348d('0x13')][_0x348d('0x15')]||{},'attributes':['id',_0x348d('0x23')]})['then'](function(_0x36937d){if(_0x36937d){_0x50ddd4=_0x36937d;return db[_0x348d('0x41')][_0x348d('0x42')]({'where':{'membername':_0x50ddd4['name']},'individualHooks':!![]});}})['then'](function(){if(_0x50ddd4){return db[_0x348d('0x43')]['findAll']({'where':{'membername':_0x50ddd4['name'],'exitAt':null}});}})['then'](function(_0xf89de){if(_0x50ddd4){if(_0xf89de&&_0xf89de['length']){var _0x4d5343=[];_0xf89de[_0x348d('0x2f')](function(_0x5961ac){_0x4d5343[_0x348d('0x44')](_0x5961ac[_0x348d('0x2a')]({'exitAt':moment()[_0x348d('0x27')](_0x348d('0x32'))}));});return BPromise[_0x348d('0x45')](_0x4d5343);}}})[_0x348d('0x2c')](function(){if(_0x50ddd4){return _0x50ddd4[_0x348d('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x348d('0x2c')](function(_0x57ee51){_0x136a4c(_0x57ee51);})[_0x348d('0x21')](function(_0x26c892){_0x402463(_0x4dac1e[_0x348d('0x1d')](0x1f4,_0x26c892['message']));});});};exports['LoginUser']=function(_0x13c25e){var _0x276d21=this;return new Promise(function(_0x270698,_0x3320f6){var _0x2be508;var _0x1e0ba4;var _0x361d08;var _0x4f83ee;return db[_0x348d('0x11')]['findOne']({'where':_0x13c25e[_0x348d('0x13')][_0x348d('0x15')]||{},'attributes':['id','name','role',_0x348d('0x46'),_0x348d('0x47'),_0x348d('0x25'),_0x348d('0x48'),_0x348d('0x26')]})[_0x348d('0x2c')](function(_0x35e0cd){if(_0x35e0cd){_0x2be508=_0x35e0cd;_0x4f83ee=_0x13c25e[_0x348d('0x33')][_0x348d('0x26')]?_0x13c25e[_0x348d('0x33')][_0x348d('0x26')]:util[_0x348d('0x27')](_0x348d('0x31'),_0x2be508[_0x348d('0x23')]);return db['User'][_0x348d('0x49')]({'where':{'role':_0x348d('0x4a'),'online':!![],'id':{'$ne':_0x2be508['id']}}});}})[_0x348d('0x2c')](function(_0x58a90d){if(_0x58a90d){_0x361d08=_0x58a90d;return require(_0x348d('0x4b'))[_0x348d('0x4c')]();}})[_0x348d('0x2c')](function(_0x4bdf70){if(_0x4bdf70&&_0x4bdf70['agents']&&_0x361d08>=_0x4bdf70['agents']){throw new Error(_0x348d('0x4d'));}})[_0x348d('0x2c')](function(){if(_0x2be508){return db[_0x348d('0x41')]['destroy']({'where':{'membername':_0x2be508[_0x348d('0x23')]},'individualHooks':!![]});}})[_0x348d('0x2c')](function(){if(_0x2be508){return _0x2be508[_0x348d('0x4e')]({'raw':!![]});}})[_0x348d('0x2c')](function(_0x706a7f){if(_0x2be508){if(_0x706a7f){var _0x3dd291=[];_0x1e0ba4=_0x706a7f;if(_0x1e0ba4[_0x348d('0x4f')]){for(var _0x3b5c38=0x0;_0x3b5c38<_0x1e0ba4['length'];_0x3b5c38++){_0x3dd291[_0x348d('0x44')](db['UserVoiceQueueRt']['upsert']({'membername':_0x2be508[_0x348d('0x23')],'UserId':_0x2be508['id'],'queue_name':_0x1e0ba4[_0x3b5c38][_0x348d('0x23')],'VoiceQueueId':_0x1e0ba4[_0x3b5c38]['id'],'interface':_0x4f83ee,'paused':_0x2be508[_0x348d('0x48')]||![],'penalty':_0x1e0ba4[_0x3b5c38][_0x348d('0x50')]||0x0}));}return BPromise[_0x348d('0x45')](_0x3dd291);}}}})[_0x348d('0x2c')](function(){if(_0x2be508){return db[_0x348d('0x43')]['findAll']({'where':{'membername':_0x2be508[_0x348d('0x23')],'exitAt':null}});}})[_0x348d('0x2c')](function(_0x8861c5){if(_0x2be508){if(_0x8861c5&&_0x8861c5[_0x348d('0x4f')]){var _0x210933=[];_0x8861c5['forEach'](function(_0x4b98a0){_0x210933[_0x348d('0x44')](_0x4b98a0[_0x348d('0x2a')]({'exitAt':moment()[_0x348d('0x27')](_0x348d('0x32'))}));});return BPromise[_0x348d('0x45')](_0x210933);}}})[_0x348d('0x2c')](function(){if(_0x2be508){var _0x343708=[];var _0x4b1220=[];var _0xe6c4df=utils[_0x348d('0x2e')]();var _0x3ed4ab={'membername':_0x2be508['name'],'interface':_0x4f83ee,'enterAt':moment()[_0x348d('0x27')](_0x348d('0x32')),'role':_0x2be508[_0x348d('0x24')],'internal':_0x2be508[_0x348d('0x25')]};_0xe6c4df[_0x348d('0x2f')](function(_0x659f3e){_0x343708['push'](_[_0x348d('0x51')]({'channel':_0x659f3e,'type':_0x348d('0x52'),'data1':'callysquare','data2':_0x4f83ee},_0x3ed4ab));if(_0x2be508[_0x348d('0x48')]){_0x4b1220[_0x348d('0x44')](_[_0x348d('0x51')]({'channel':_0x659f3e,'type':_0x348d('0x2b'),'data1':_0x348d('0x53')},_0x3ed4ab));}});return db[_0x348d('0x43')][_0x348d('0x36')](_0x343708[_0x348d('0x54')](_0x4b1220),{'individualHooks':!![]});}})[_0x348d('0x2c')](function(){if(_0x2be508){return _0x2be508[_0x348d('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x348d('0x27')](_0x348d('0x32')),'voicePause':_0x2be508[_0x348d('0x48')]||![],'mailPause':_0x2be508[_0x348d('0x48')]||![],'chatPause':_0x2be508[_0x348d('0x48')]||![],'faxPause':_0x2be508[_0x348d('0x48')]||![],'smsPause':_0x2be508[_0x348d('0x48')]||![],'openchannelPause':_0x2be508[_0x348d('0x48')]||![],'pauseType':_0x2be508[_0x348d('0x48')]?_0x348d('0x53'):null,'lastPauseAt':moment()[_0x348d('0x27')](_0x348d('0x32')),'interface':_0x4f83ee});}})['then'](function(_0x4214df){_0x270698(_0x4214df);})[_0x348d('0x21')](function(_0x2c5325){_0x3320f6(_0x276d21[_0x348d('0x1d')](0x1f4,_0x2c5325[_0x348d('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index aed56da..69dbb6c 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 _0x1c21=['remove','update','user:','./user.events'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x1c21,0x19f));var _0x11c2=function(_0x501429,_0x20b28e){_0x501429=_0x501429-0x0;var _0x4864e1=_0x1c21[_0x501429];return _0x4864e1;};'use strict';var UserEvents=require(_0x11c2('0x0'));var events=['save',_0x11c2('0x1'),_0x11c2('0x2')];function createListener(_0x52c0e1,_0x3b42ab){return function(_0x7b2024){_0x3b42ab['emit'](_0x52c0e1,_0x7b2024);};}function removeListener(_0x2c95f4,_0x2253b4){return function(){UserEvents['removeListener'](_0x2c95f4,_0x2253b4);};}exports['register']=function(_0x596005){for(var _0xc0894=0x0,_0x1b291f=events['length'];_0xc0894<_0x1b291f;_0xc0894++){var _0x2b8edc=events[_0xc0894];var _0x47f11b=createListener(_0x11c2('0x3')+_0x2b8edc,_0x596005);UserEvents['on'](_0x2b8edc,_0x47f11b);}}; \ No newline at end of file +var _0x0160=['removeListener','register','user:','remove','update','emit'];(function(_0x283106,_0x15bd22){var _0x23f1d7=function(_0x266bba){while(--_0x266bba){_0x283106['push'](_0x283106['shift']());}};_0x23f1d7(++_0x15bd22);}(_0x0160,0x1bf));var _0x0016=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x0160[_0x2f4c1c];return _0x25e0f2;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x0016('0x0'),_0x0016('0x1')];function createListener(_0x224c23,_0x4a1e28){return function(_0x209509){_0x4a1e28[_0x0016('0x2')](_0x224c23,_0x209509);};}function removeListener(_0x340e91,_0x54fddf){return function(){UserEvents[_0x0016('0x3')](_0x340e91,_0x54fddf);};}exports[_0x0016('0x4')]=function(_0x154668){for(var _0x5c9208=0x0,_0x350773=events['length'];_0x5c9208<_0x350773;_0x5c9208++){var _0x3e834=events[_0x5c9208];var _0x12e55c=createListener(_0x0016('0x5')+_0x3e834,_0x154668);UserEvents['on'](_0x3e834,_0x12e55c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index cee67df..da56123 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x35870d,_0x24a527){var _0x3b823a=function(_0xf1c0a5){while(--_0xf1c0a5){_0x35870d['push'](_0x35870d['shift']());}};_0x3b823a(++_0x24a527);}(_0xe706,0xa3));var _0x6e70=function(_0x20c893,_0xbef2b4){_0x20c893=_0x20c893-0x0;var _0xc705e8=_0xe706[_0x20c893];return _0xc705e8;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x258796,_0x50d62b){var _0x399594=function(_0x396d6e){while(--_0x396d6e){_0x258796['push'](_0x258796['shift']());}};_0x399594(++_0x50d62b);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9006424..c3b109e 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x11fc=['INTEGER','exports'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x11fc,0x187));var _0xc11f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x11fc[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0xc11f('0x0')]={'penalty':{'type':Sequelize[_0xc11f('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 f01855f..23bc3a5 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 _0x6f69=['request-promise','path','rimraf','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','bluebird'];(function(_0x32b2bf,_0x64a61e){var _0x42756a=function(_0x18250d){while(--_0x18250d){_0x32b2bf['push'](_0x32b2bf['shift']());}};_0x42756a(++_0x64a61e);}(_0x6f69,0x1d2));var _0x96f6=function(_0x1d83fc,_0x41da74){_0x1d83fc=_0x1d83fc-0x0;var _0x35997b=_0x6f69[_0x1d83fc];return _0x35997b;};'use strict';var _=require(_0x96f6('0x0'));var util=require('util');var logger=require(_0x96f6('0x1'))(_0x96f6('0x2'));var moment=require('moment');var BPromise=require(_0x96f6('0x3'));var rp=require(_0x96f6('0x4'));var fs=require('fs');var path=require(_0x96f6('0x5'));var rimraf=require(_0x96f6('0x6'));var config=require('../../config/environment');var attributes=require(_0x96f6('0x7'));module['exports']=function(_0x51ce2c,_0x56f0e6){return _0x51ce2c['define'](_0x96f6('0x8'),attributes,{'tableName':_0x96f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0188=['user_has_chat_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x0188,0x9d));var _0x8018=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0x0188[_0x282a1f];return _0x296ea7;};'use strict';var _=require(_0x8018('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8018('0x1'));var moment=require(_0x8018('0x2'));var BPromise=require(_0x8018('0x3'));var rp=require(_0x8018('0x4'));var fs=require('fs');var path=require(_0x8018('0x5'));var rimraf=require(_0x8018('0x6'));var config=require(_0x8018('0x7'));var attributes=require(_0x8018('0x8'));module[_0x8018('0x9')]=function(_0x3c474e,_0x2ed114){return _0x3c474e['define'](_0x8018('0xa'),attributes,{'tableName':_0x8018('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index f5b707f..be7321d 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 _0xd4ea=['http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x35deb9,_0x545380){var _0xe1d491=function(_0x86b245){while(--_0x86b245){_0x35deb9['push'](_0x35deb9['shift']());}};_0xe1d491(++_0x545380);}(_0xd4ea,0x141));var _0xad4e=function(_0xa0b362,_0x29a84a){_0xa0b362=_0xa0b362-0x0;var _0xca8dfb=_0xd4ea[_0xa0b362];return _0xca8dfb;};'use strict';var _=require(_0xad4e('0x0'));var util=require(_0xad4e('0x1'));var moment=require(_0xad4e('0x2'));var BPromise=require(_0xad4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad4e('0x4'));var db=require(_0xad4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xad4e('0x6'))(_0xad4e('0x7'));var config=require(_0xad4e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xad4e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27bb9d,_0x2a67b3,_0x47b533){return new BPromise(function(_0x136f4e,_0x360ca3){return client[_0xad4e('0xa')](_0x27bb9d,_0x47b533)[_0xad4e('0xb')](function(_0x434bdd){logger[_0xad4e('0xc')](_0xad4e('0xd'),_0x2a67b3,_0xad4e('0xe'));logger[_0xad4e('0xf')](_0xad4e('0x10'),_0x2a67b3,_0xad4e('0xe'),JSON['stringify'](_0x434bdd));if(_0x434bdd[_0xad4e('0x11')]){if(_0x434bdd[_0xad4e('0x11')][_0xad4e('0x12')]===0x1f4){logger[_0xad4e('0x11')](_0xad4e('0xd'),_0x2a67b3,_0x434bdd[_0xad4e('0x11')][_0xad4e('0x13')]);return _0x360ca3(_0x434bdd[_0xad4e('0x11')][_0xad4e('0x13')]);}logger[_0xad4e('0x11')](_0xad4e('0xd'),_0x2a67b3,_0x434bdd[_0xad4e('0x11')]['message']);return _0x136f4e(_0x434bdd['error'][_0xad4e('0x13')]);}else{logger['info'](_0xad4e('0xd'),_0x2a67b3,'request\x20sent');_0x136f4e(_0x434bdd[_0xad4e('0x14')][_0xad4e('0x13')]);}})[_0xad4e('0x15')](function(_0x4a7bb4){logger[_0xad4e('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x2a67b3,_0x4a7bb4);_0x360ca3(_0x4a7bb4);});});} \ No newline at end of file +var _0x881e=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5e9ea7,_0x199845){var _0xd87526=function(_0x2f4a7e){while(--_0x2f4a7e){_0x5e9ea7['push'](_0x5e9ea7['shift']());}};_0xd87526(++_0x199845);}(_0x881e,0x102));var _0xe881=function(_0x1304de,_0x39663f){_0x1304de=_0x1304de-0x0;var _0x4a68fc=_0x881e[_0x1304de];return _0x4a68fc;};'use strict';var _=require(_0xe881('0x0'));var util=require(_0xe881('0x1'));var moment=require(_0xe881('0x2'));var BPromise=require(_0xe881('0x3'));var rs=require(_0xe881('0x4'));var fs=require('fs');var Redis=require(_0xe881('0x5'));var db=require(_0xe881('0x6'))['db'];var utils=require(_0xe881('0x7'));var logger=require(_0xe881('0x8'))(_0xe881('0x9'));var config=require('../../config/environment');var jayson=require(_0xe881('0xa'));var client=jayson[_0xe881('0xb')][_0xe881('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20fdcb,_0x299632,_0x4a3ef8){return new BPromise(function(_0x86c7d6,_0xece977){return client[_0xe881('0xd')](_0x20fdcb,_0x4a3ef8)[_0xe881('0xe')](function(_0x114d86){logger[_0xe881('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x299632,_0xe881('0x10'));logger[_0xe881('0x11')](_0xe881('0x12'),_0x299632,_0xe881('0x10'),JSON[_0xe881('0x13')](_0x114d86));if(_0x114d86['error']){if(_0x114d86[_0xe881('0x14')][_0xe881('0x15')]===0x1f4){logger['error'](_0xe881('0x16'),_0x299632,_0x114d86['error'][_0xe881('0x17')]);return _0xece977(_0x114d86[_0xe881('0x14')]['message']);}logger[_0xe881('0x14')](_0xe881('0x16'),_0x299632,_0x114d86[_0xe881('0x14')][_0xe881('0x17')]);return _0x86c7d6(_0x114d86['error'][_0xe881('0x17')]);}else{logger[_0xe881('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x299632,_0xe881('0x10'));_0x86c7d6(_0x114d86['result'][_0xe881('0x17')]);}})['catch'](function(_0x58747c){logger[_0xe881('0x14')](_0xe881('0x16'),_0x299632,_0x58747c);_0xece977(_0x58747c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2daa2b3..755b575 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c3026,_0x1dddbe){var _0x208b7c=function(_0x24133b){while(--_0x24133b){_0x1c3026['push'](_0x1c3026['shift']());}};_0x208b7c(++_0x1dddbe);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x7f34b7,_0x40b68d){var _0x4d3d9d=function(_0x4831d1){while(--_0x4831d1){_0x7f34b7['push'](_0x7f34b7['shift']());}};_0x4d3d9d(++_0x40b68d);}(_0xe706,0xa3));var _0x6e70=function(_0x1cb931,_0x41493d){_0x1cb931=_0x1cb931-0x0;var _0x1ef86b=_0xe706[_0x1cb931];return _0x1ef86b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 93e24cc..b9420ca 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 _0x772b=['INTEGER','STRING'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x772b,0x18c));var _0xb772=function(_0x18dace,_0x2ff63c){_0x18dace=_0x18dace-0x0;var _0x44e125=_0x772b[_0x18dace];return _0x44e125;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xb772('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb772('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb772('0x1')]}}; \ No newline at end of file +var _0x1715=['STRING','sequelize','exports','INTEGER'];(function(_0x185860,_0x5b276e){var _0x15bf16=function(_0x21751b){while(--_0x21751b){_0x185860['push'](_0x185860['shift']());}};_0x15bf16(++_0x5b276e);}(_0x1715,0x1c9));var _0x5171=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1715[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5171('0x0'));module[_0x5171('0x1')]={'penalty':{'type':Sequelize[_0x5171('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5171('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5171('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ad6dcc0..0fcf4c7 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 _0xca85=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','user_has_fax_queues'];(function(_0x39853d,_0x2501bf){var _0x5864ca=function(_0xbc99d5){while(--_0xbc99d5){_0x39853d['push'](_0x39853d['shift']());}};_0x5864ca(++_0x2501bf);}(_0xca85,0x1e0));var _0x5ca8=function(_0xf9cb79,_0x57cb52){_0xf9cb79=_0xf9cb79-0x0;var _0x4358e5=_0xca85[_0xf9cb79];return _0x4358e5;};'use strict';var _=require(_0x5ca8('0x0'));var util=require(_0x5ca8('0x1'));var logger=require(_0x5ca8('0x2'))(_0x5ca8('0x3'));var moment=require(_0x5ca8('0x4'));var BPromise=require(_0x5ca8('0x5'));var rp=require(_0x5ca8('0x6'));var fs=require('fs');var path=require(_0x5ca8('0x7'));var rimraf=require(_0x5ca8('0x8'));var config=require('../../config/environment');var attributes=require(_0x5ca8('0x9'));module['exports']=function(_0x533afa,_0x26a690){return _0x533afa[_0x5ca8('0xa')]('UserFaxQueue',attributes,{'tableName':_0x5ca8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5693=['exports','UserFaxQueue','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x5693,0x1db));var _0x3569=function(_0x342db7,_0x2f2fac){_0x342db7=_0x342db7-0x0;var _0x2742e1=_0x5693[_0x342db7];return _0x2742e1;};'use strict';var _=require(_0x3569('0x0'));var util=require(_0x3569('0x1'));var logger=require(_0x3569('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3569('0x3'));var rp=require(_0x3569('0x4'));var fs=require('fs');var path=require(_0x3569('0x5'));var rimraf=require(_0x3569('0x6'));var config=require(_0x3569('0x7'));var attributes=require(_0x3569('0x8'));module[_0x3569('0x9')]=function(_0x368b73,_0x1c0c31){return _0x368b73['define'](_0x3569('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 32fffbf..55d291b 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 _0xdb3e=['rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb3e,0x144));var _0xedb3=function(_0x55e45e,_0x51c886){_0x55e45e=_0x55e45e-0x0;var _0x3e7583=_0xdb3e[_0x55e45e];return _0x3e7583;};'use strict';var _=require(_0xedb3('0x0'));var util=require(_0xedb3('0x1'));var moment=require('moment');var BPromise=require(_0xedb3('0x2'));var rs=require(_0xedb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedb3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xedb3('0x5'))(_0xedb3('0x6'));var config=require('../../config/environment');var jayson=require(_0xedb3('0x7'));var client=jayson[_0xedb3('0x8')][_0xedb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x533021,_0x338aa3,_0x1b89e9){return new BPromise(function(_0x4cfc0d,_0x1fccc7){return client[_0xedb3('0xa')](_0x533021,_0x1b89e9)[_0xedb3('0xb')](function(_0x1aa581){logger[_0xedb3('0xc')](_0xedb3('0xd'),_0x338aa3,_0xedb3('0xe'));logger[_0xedb3('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x338aa3,'request\x20sent',JSON[_0xedb3('0x10')](_0x1aa581));if(_0x1aa581[_0xedb3('0x11')]){if(_0x1aa581[_0xedb3('0x11')][_0xedb3('0x12')]===0x1f4){logger[_0xedb3('0x11')](_0xedb3('0xd'),_0x338aa3,_0x1aa581[_0xedb3('0x11')]['message']);return _0x1fccc7(_0x1aa581[_0xedb3('0x11')][_0xedb3('0x13')]);}logger[_0xedb3('0x11')](_0xedb3('0xd'),_0x338aa3,_0x1aa581['error'][_0xedb3('0x13')]);return _0x4cfc0d(_0x1aa581['error'][_0xedb3('0x13')]);}else{logger[_0xedb3('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x338aa3,_0xedb3('0xe'));_0x4cfc0d(_0x1aa581[_0xedb3('0x14')][_0xedb3('0x13')]);}})[_0xedb3('0x15')](function(_0x12a5b3){logger[_0xedb3('0x11')](_0xedb3('0xd'),_0x338aa3,_0x12a5b3);_0x1fccc7(_0x12a5b3);});});} \ No newline at end of file +var _0x4520=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\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','then','info'];(function(_0x159a1d,_0x4fd041){var _0x56c1ed=function(_0x322395){while(--_0x322395){_0x159a1d['push'](_0x159a1d['shift']());}};_0x56c1ed(++_0x4fd041);}(_0x4520,0xa3));var _0x0452=function(_0x48271f,_0xc4f6d3){_0x48271f=_0x48271f-0x0;var _0x13eb5c=_0x4520[_0x48271f];return _0x13eb5c;};'use strict';var _=require(_0x0452('0x0'));var util=require(_0x0452('0x1'));var moment=require(_0x0452('0x2'));var BPromise=require(_0x0452('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0452('0x4'))['db'];var utils=require(_0x0452('0x5'));var logger=require(_0x0452('0x6'))(_0x0452('0x7'));var config=require(_0x0452('0x8'));var jayson=require(_0x0452('0x9'));var client=jayson[_0x0452('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195756,_0x17ccf4,_0x36f147){return new BPromise(function(_0x2fac58,_0x386c88){return client['request'](_0x195756,_0x36f147)[_0x0452('0xb')](function(_0x57c49a){logger[_0x0452('0xc')](_0x0452('0xd'),_0x17ccf4,_0x0452('0xe'));logger[_0x0452('0xf')](_0x0452('0x10'),_0x17ccf4,'request\x20sent',JSON['stringify'](_0x57c49a));if(_0x57c49a[_0x0452('0x11')]){if(_0x57c49a[_0x0452('0x11')][_0x0452('0x12')]===0x1f4){logger[_0x0452('0x11')](_0x0452('0xd'),_0x17ccf4,_0x57c49a[_0x0452('0x11')][_0x0452('0x13')]);return _0x386c88(_0x57c49a[_0x0452('0x11')][_0x0452('0x13')]);}logger[_0x0452('0x11')](_0x0452('0xd'),_0x17ccf4,_0x57c49a[_0x0452('0x11')][_0x0452('0x13')]);return _0x2fac58(_0x57c49a[_0x0452('0x11')][_0x0452('0x13')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x17ccf4,'request\x20sent');_0x2fac58(_0x57c49a[_0x0452('0x14')]['message']);}})[_0x0452('0x15')](function(_0x92f25d){logger[_0x0452('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x17ccf4,_0x92f25d);_0x386c88(_0x92f25d);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 194cd31..ad96d99 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x49088a,_0xa2b35c){var _0x3a522d=function(_0x19cf27){while(--_0x19cf27){_0x49088a['push'](_0x49088a['shift']());}};_0x3a522d(++_0xa2b35c);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x118efa,_0x3575a0){var _0x5a28e3=function(_0x299923){while(--_0x299923){_0x118efa['push'](_0x118efa['shift']());}};_0x5a28e3(++_0x3575a0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xcb91[_0x1778e1];return _0x2bc4c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ef6eaa9..a45518c 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 _0x1e7c=['exports','sequelize'];(function(_0x3c23bc,_0x579ae1){var _0x52516c=function(_0x236c8f){while(--_0x236c8f){_0x3c23bc['push'](_0x3c23bc['shift']());}};_0x52516c(++_0x579ae1);}(_0x1e7c,0x1e3));var _0xc1e7=function(_0x45cc0d,_0x3b1080){_0x45cc0d=_0x45cc0d-0x0;var _0x53dc42=_0x1e7c[_0x45cc0d];return _0x53dc42;};'use strict';var Sequelize=require(_0xc1e7('0x0'));module[_0xc1e7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfadd=['exports','sequelize'];(function(_0x19c7e8,_0x1b1f1d){var _0x36c64f=function(_0x1deccf){while(--_0x1deccf){_0x19c7e8['push'](_0x19c7e8['shift']());}};_0x36c64f(++_0x1b1f1d);}(_0xfadd,0x1df));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdfad('0x0'));module[_0xdfad('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 9df8a24..aeb50b8 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 _0x1b54=['rimraf','../../config/environment','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x22efd1,_0x1f404d){var _0xf11137=function(_0x18c537){while(--_0x18c537){_0x22efd1['push'](_0x22efd1['shift']());}};_0xf11137(++_0x1f404d);}(_0x1b54,0x9a));var _0x41b5=function(_0x9303e,_0xeec64c){_0x9303e=_0x9303e-0x0;var _0x192126=_0x1b54[_0x9303e];return _0x192126;};'use strict';var _=require(_0x41b5('0x0'));var util=require(_0x41b5('0x1'));var logger=require(_0x41b5('0x2'))(_0x41b5('0x3'));var moment=require(_0x41b5('0x4'));var BPromise=require('bluebird');var rp=require(_0x41b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41b5('0x6'));var config=require(_0x41b5('0x7'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x8393b5,_0x1a5002){return _0x8393b5[_0x41b5('0x8')]('UserMailQueue',attributes,{'tableName':_0x41b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0105=['../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0x0105,0xc9));var _0x5010=function(_0x26d4d9,_0x58129b){_0x26d4d9=_0x26d4d9-0x0;var _0x4601c4=_0x0105[_0x26d4d9];return _0x4601c4;};'use strict';var _=require(_0x5010('0x0'));var util=require(_0x5010('0x1'));var logger=require(_0x5010('0x2'))(_0x5010('0x3'));var moment=require(_0x5010('0x4'));var BPromise=require(_0x5010('0x5'));var rp=require(_0x5010('0x6'));var fs=require('fs');var path=require(_0x5010('0x7'));var rimraf=require('rimraf');var config=require(_0x5010('0x8'));var attributes=require('./userMailQueue.attributes');module[_0x5010('0x9')]=function(_0x26ae17,_0x37a997){return _0x26ae17[_0x5010('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 64042f9..730e229 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1cb9,0x14e));var _0x91cb=function(_0x20d2d7,_0x37c39e){_0x20d2d7=_0x20d2d7-0x0;var _0x6848d2=_0x1cb9[_0x20d2d7];return _0x6848d2;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 57b1db1..146895b 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 _0xc71b=['fs-extra','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0xc71b,0x1a9));var _0xbc71=function(_0x5dd070,_0x598b5e){_0x5dd070=_0x5dd070-0x0;var _0x117034=_0xc71b[_0x5dd070];return _0x117034;};'use strict';var multer=require(_0xbc71('0x0'));var util=require(_0xbc71('0x1'));var path=require(_0xbc71('0x2'));var timeout=require(_0xbc71('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbc71('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc71('0x5'));var config=require(_0xbc71('0x6'));var controller=require('./userNotification.controller');router[_0xbc71('0x7')]('/',auth[_0xbc71('0x8')](),controller[_0xbc71('0x9')]);module[_0xbc71('0xa')]=router; \ No newline at end of file +var _0x8743=['Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','sendUserNotification','exports','multer','util','path','express'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8743,0x1b4));var _0x3874=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8743[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x3874('0x0'));var util=require(_0x3874('0x1'));var path=require(_0x3874('0x2'));var timeout=require('connect-timeout');var express=require(_0x3874('0x3'));var router=express[_0x3874('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3874('0x5'));var interaction=require(_0x3874('0x6'));var config=require('../../config/environment');var controller=require(_0x3874('0x7'));router[_0x3874('0x8')]('/',auth['isAuthenticated'](),controller[_0x3874('0x9')]);module[_0x3874('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 34a37b8..d6a5289 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 _0x573c=['exports','STRING','TEXT','BOOLEAN','sequelize'];(function(_0x515680,_0x5c3b90){var _0x2eb2b2=function(_0x565074){while(--_0x565074){_0x515680['push'](_0x515680['shift']());}};_0x2eb2b2(++_0x5c3b90);}(_0x573c,0x167));var _0xc573=function(_0x1c24ec,_0xbc9720){_0x1c24ec=_0x1c24ec-0x0;var _0x46d3f0=_0x573c[_0x1c24ec];return _0x46d3f0;};'use strict';var Sequelize=require(_0xc573('0x0'));module[_0xc573('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xc573('0x2')]},'recipientsId':{'type':Sequelize[_0xc573('0x3')]},'recipientsDescription':{'type':Sequelize[_0xc573('0x2')]},'beep':{'type':Sequelize[_0xc573('0x4')]}}; \ No newline at end of file +var _0xb4c6=['exports','STRING','TEXT','sequelize'];(function(_0x24d7b8,_0x13ad17){var _0x5d89ab=function(_0x31d763){while(--_0x31d763){_0x24d7b8['push'](_0x24d7b8['shift']());}};_0x5d89ab(++_0x13ad17);}(_0xb4c6,0x12f));var _0x6b4c=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xb4c6[_0x5a26db];return _0x4619dd;};'use strict';var Sequelize=require(_0x6b4c('0x0'));module[_0x6b4c('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x6b4c('0x2')]},'recipientsId':{'type':Sequelize[_0x6b4c('0x3')]},'recipientsDescription':{'type':Sequelize[_0x6b4c('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 3d89fff..cc04697 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 _0x1b49=['undefined','limit','count','save','update','then','destroy','error','stack','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','SenderId','recipientsId','sequelize','transaction','UserNotification','create','beep','forEach','recipient','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','union','ids','queue','replace','Queue','push','all','flatten','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./userNotification.socket','register','sendStatus','end','status','json','offset'];(function(_0x414d3d,_0x51656b){var _0x11740b=function(_0x191a2f){while(--_0x191a2f){_0x414d3d['push'](_0x414d3d['shift']());}};_0x11740b(++_0x51656b);}(_0x1b49,0x14f));var _0x91b4=function(_0x3407be,_0x3ad78b){_0x3407be=_0x3407be-0x0;var _0x1743e2=_0x1b49[_0x3407be];return _0x1743e2;};'use strict';var emlformat=require(_0x91b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91b4('0x1'));var jsonpatch=require(_0x91b4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x91b4('0x3'));var util=require(_0x91b4('0x4'));var path=require(_0x91b4('0x5'));var sox=require(_0x91b4('0x6'));var csv=require('to-csv');var ejs=require(_0x91b4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91b4('0x8'));var squel=require(_0x91b4('0x9'));var crypto=require(_0x91b4('0xa'));var jsforce=require(_0x91b4('0xb'));var deskjs=require(_0x91b4('0xc'));var toCsv=require(_0x91b4('0xd'));var querystring=require(_0x91b4('0xe'));var Papa=require(_0x91b4('0xf'));var Redis=require('ioredis');var authService=require(_0x91b4('0x10'));var qs=require(_0x91b4('0x11'));var as=require(_0x91b4('0x12'));var hardwareService=require(_0x91b4('0x13'));var logger=require('../../config/logger')(_0x91b4('0x14'));var utils=require(_0x91b4('0x15'));var config=require(_0x91b4('0x16'));var licenseUtil=require(_0x91b4('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x91b4('0x18')],{'host':_0x91b4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91b4('0x18')]));require(_0x91b4('0x1a'))[_0x91b4('0x1b')](socket);function respondWithStatusCode(_0x34b725,_0x5d5c04){_0x5d5c04=_0x5d5c04||0xcc;return function(_0x404705){if(_0x404705){return _0x34b725[_0x91b4('0x1c')](_0x5d5c04);}return _0x34b725['status'](_0x5d5c04)[_0x91b4('0x1d')]();};}function respondWithResult(_0x406a75,_0x297571){_0x297571=_0x297571||0xc8;return function(_0x235d23){if(_0x235d23){return _0x406a75[_0x91b4('0x1e')](_0x297571)[_0x91b4('0x1f')](_0x235d23);}};}function respondWithFilteredResult(_0x166ec5,_0x508a7a){return function(_0x41449b){if(_0x41449b){var _0xfa4c2e=typeof _0x508a7a[_0x91b4('0x20')]===_0x91b4('0x21')&&typeof _0x508a7a[_0x91b4('0x22')]===_0x91b4('0x21');var _0x5584ed=_0x41449b[_0x91b4('0x23')];var _0x599d4c=_0xfa4c2e?0x0:_0x508a7a[_0x91b4('0x20')];var _0x1bdd31=_0xfa4c2e?_0x41449b[_0x91b4('0x23')]:_0x508a7a['offset']+_0x508a7a['limit'];var _0x31e0bd;if(_0x1bdd31>=_0x5584ed){_0x1bdd31=_0x5584ed;_0x31e0bd=0xc8;}else{_0x31e0bd=0xce;}_0x166ec5[_0x91b4('0x1e')](_0x31e0bd);return _0x166ec5['set']('Content-Range',_0x599d4c+'-'+_0x1bdd31+'/'+_0x5584ed)[_0x91b4('0x1f')](_0x41449b);}return null;};}function patchUpdates(_0x36dfc4){return function(_0xd8f39e){try{jsonpatch['apply'](_0xd8f39e,_0x36dfc4,!![]);}catch(_0x53a7c4){return BPromise['reject'](_0x53a7c4);}return _0xd8f39e[_0x91b4('0x24')]();};}function saveUpdates(_0x2c3831,_0x240b8a){return function(_0x2b2392){if(_0x2b2392){return _0x2b2392[_0x91b4('0x25')](_0x2c3831)[_0x91b4('0x26')](function(_0xf7354e){return _0xf7354e;});}return null;};}function removeEntity(_0x3859a2,_0x2d49b0){return function(_0xc63af0){if(_0xc63af0){return _0xc63af0[_0x91b4('0x27')]()[_0x91b4('0x26')](function(){_0x3859a2['status'](0xcc)[_0x91b4('0x1d')]();});}};}function handleEntityNotFound(_0xf74f01,_0x2b5fb8){return function(_0x5ee919){if(!_0x5ee919){_0xf74f01[_0x91b4('0x1c')](0x194);}return _0x5ee919;};}function handleError(_0x5cf9f5,_0x4bb72d){_0x4bb72d=_0x4bb72d||0x1f4;return function(_0x2309dc){logger[_0x91b4('0x28')](_0x2309dc[_0x91b4('0x29')]);if(_0x2309dc['name']){delete _0x2309dc['name'];}_0x5cf9f5[_0x91b4('0x1e')](_0x4bb72d)[_0x91b4('0x2a')](_0x2309dc);};}exports[_0x91b4('0x2b')]=function(_0x132a68,_0x1d10b2,_0x37f2b){if(!_0x132a68[_0x91b4('0x2c')][_0x91b4('0x2d')](_0x91b4('0x2e'))&&!_0x132a68[_0x91b4('0x2c')][_0x91b4('0x2d')](_0x91b4('0x2f'))){throw new db['Sequelize'][(_0x91b4('0x30'))](_0x91b4('0x31'));}else{if(_0x132a68[_0x91b4('0x2c')]['hasOwnProperty']('TemplateId')&&!_0x132a68[_0x91b4('0x2c')][_0x91b4('0x2d')](_0x91b4('0x32'))){throw new db[(_0x91b4('0x33'))][(_0x91b4('0x30'))](_0x91b4('0x34'));}if(!_0x132a68[_0x91b4('0x2c')]['hasOwnProperty'](_0x91b4('0x35'))){throw new db[(_0x91b4('0x33'))][(_0x91b4('0x30'))](_0x91b4('0x36'));}else{try{var _0x1dd081=JSON[_0x91b4('0x37')](_0x132a68[_0x91b4('0x2c')][_0x91b4('0x35')]);}catch(_0x363ca2){logger[_0x91b4('0x28')](_0x363ca2);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x233fea=[_0x91b4('0x38'),'faxqueue','mailqueue','openchannelqueue','smsqueue',_0x91b4('0x39'),'whatsappqueue',_0x91b4('0x3a'),_0x91b4('0x3b')];if(_[_0x91b4('0x3c')](_0x1dd081,function(_0x13c2b8){return!_[_0x91b4('0x3d')](_0x233fea,_0x13c2b8[_0x91b4('0x3e')][_0x91b4('0x3f')]());})){throw new db[(_0x91b4('0x33'))][(_0x91b4('0x30'))](_0x91b4('0x40'));}}}var _0x279746={};_0x279746[_0x91b4('0x41')]=_0x132a68[_0x91b4('0x2c')][_0x91b4('0x2d')](_0x91b4('0x41'))?_0x132a68[_0x91b4('0x2c')][_0x91b4('0x41')]:_0x132a68[_0x91b4('0x3b')]['fullname'];_0x279746[_0x91b4('0x42')]=_['isEmpty'](_0x132a68[_0x91b4('0x2c')][_0x91b4('0x42')])?null:_0x132a68[_0x91b4('0x2c')][_0x91b4('0x42')];_0x279746['beep']=_0x132a68[_0x91b4('0x2c')]['beep']||![];_0x279746[_0x91b4('0x43')]=_0x132a68[_0x91b4('0x3b')]['id'];return getContent(_0x132a68[_0x91b4('0x2c')])['then'](function(_0x13d979){_0x279746[_0x91b4('0x2c')]=_0x13d979;return getRecipients(_0x1dd081);})[_0x91b4('0x26')](function(_0x16e222){_0x279746[_0x91b4('0x44')]=_['sortBy'](_0x16e222)['join'](',');return db[_0x91b4('0x45')][_0x91b4('0x46')](function(_0x5423b6){return db[_0x91b4('0x47')][_0x91b4('0x48')](_0x279746,{'raw':!![],'transaction':_0x5423b6})[_0x91b4('0x26')](function(_0x467fd1){var _0x1e7b84={'sender':_0x279746[_0x91b4('0x41')],'description':_0x279746[_0x91b4('0x42')],'content':_0x279746[_0x91b4('0x2c')],'beep':_0x279746[_0x91b4('0x49')]};_0x16e222[_0x91b4('0x4a')](function(_0xff0a80){_0x1e7b84[_0x91b4('0x4b')]=_0xff0a80;socket['emit'](_0x91b4('0x4c'),_0x1e7b84);});return _0x467fd1;});});})[_0x91b4('0x26')](respondWithResult(_0x1d10b2,0xc9))[_0x91b4('0x4d')](handleError(_0x1d10b2,null));};function getContent(_0x361a6f){return new BPromise(function(_0x522cdd,_0x143d92){if(_0x361a6f[_0x91b4('0x2e')]){_0x522cdd(_0x361a6f[_0x91b4('0x2e')]);return;}return db[_0x91b4('0x4e')][_0x91b4('0x4f')]({'attributes':['html'],'where':{'id':_0x361a6f[_0x91b4('0x2f')]},'raw':!![]})[_0x91b4('0x26')](function(_0x2dcfd1){if(!_0x2dcfd1)throw new db['Sequelize'][(_0x91b4('0x30'))](_0x91b4('0x50'));var _0x2fda47=Mustache[_0x91b4('0x51')](_0x2dcfd1[_0x91b4('0x52')],_0x361a6f['view']);_0x522cdd(_0x2fda47);})[_0x91b4('0x4d')](function(_0x1b080f){_0x143d92(_0x1b080f);});});}function getRecipients(_0x5a1fe0){return new BPromise(function(_0x172bff,_0x51f98e){var _0x588bab=[];var _0x23e5ed=[];_0x5a1fe0['forEach'](function(_0x5b51e9){var _0x342886=_[_0x91b4('0x53')](_0x5b51e9[_0x91b4('0x3e')][_0x91b4('0x3f')]());if(_0x342886==='User'){_0x588bab=_[_0x91b4('0x54')](_0x588bab,_0x5b51e9[_0x91b4('0x55')]);}else{if(_[_0x91b4('0x3d')](_0x342886,_0x91b4('0x56')))_0x342886=_0x342886[_0x91b4('0x57')]('queue',_0x91b4('0x58'));_0x5b51e9[_0x91b4('0x55')][_0x91b4('0x4a')](function(_0x2cd397){_0x23e5ed[_0x91b4('0x59')](getAgents(_0x342886,_0x2cd397));});}});return BPromise[_0x91b4('0x5a')](_0x23e5ed)[_0x91b4('0x26')](function(_0xe64c3){_0x588bab=_[_0x91b4('0x54')](_0x588bab,_[_0x91b4('0x5b')](_0xe64c3));_0x172bff(_0x588bab);})[_0x91b4('0x4d')](function(_0x1c3d72){_0x51f98e(_0x1c3d72);});});}function getAgents(_0x12eaf8,_0x3e0b33){return new BPromise(function(_0x1944cb,_0x29bf8e){return db[_0x12eaf8][_0x91b4('0x4f')]({'where':{'id':_0x3e0b33}})[_0x91b4('0x26')](function(_0x32043e){return _0x32043e['getAgents']({'attributes':['id'],'raw':!![]})[_0x91b4('0x26')](function(_0x14b820){var _0x4ca062=_['map'](_0x14b820,'id');_0x1944cb(_0x4ca062);});})[_0x91b4('0x4d')](function(_0x1890b7){_0x29bf8e(_0x1890b7);});});} \ No newline at end of file +var _0x3a5e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','stack','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','mailqueue','openchannelqueue','smsqueue','voicequeue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','catch','forEach','startCase','User','union','ids','queue','Queue','push','all','flatten','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3a5e,0x177));var _0xe3a5=function(_0x5c7b36,_0x531722){_0x5c7b36=_0x5c7b36-0x0;var _0x4d9138=_0x3a5e[_0x5c7b36];return _0x4d9138;};'use strict';var emlformat=require(_0xe3a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe3a5('0x1'));var rp=require(_0xe3a5('0x2'));var moment=require(_0xe3a5('0x3'));var BPromise=require(_0xe3a5('0x4'));var Mustache=require('mustache');var util=require(_0xe3a5('0x5'));var path=require('path');var sox=require(_0xe3a5('0x6'));var csv=require(_0xe3a5('0x7'));var ejs=require(_0xe3a5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe3a5('0x9'));var crypto=require(_0xe3a5('0xa'));var jsforce=require(_0xe3a5('0xb'));var deskjs=require(_0xe3a5('0xc'));var toCsv=require(_0xe3a5('0x7'));var querystring=require(_0xe3a5('0xd'));var Papa=require(_0xe3a5('0xe'));var Redis=require(_0xe3a5('0xf'));var authService=require(_0xe3a5('0x10'));var qs=require(_0xe3a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3a5('0x12'));var logger=require('../../config/logger')(_0xe3a5('0x13'));var utils=require('../../config/utils');var config=require(_0xe3a5('0x14'));var licenseUtil=require(_0xe3a5('0x15'));var db=require(_0xe3a5('0x16'))['db'];config[_0xe3a5('0x17')]=_[_0xe3a5('0x18')](config[_0xe3a5('0x17')],{'host':_0xe3a5('0x19'),'port':0x18eb});var socket=require(_0xe3a5('0x1a'))(new Redis(config[_0xe3a5('0x17')]));require(_0xe3a5('0x1b'))[_0xe3a5('0x1c')](socket);function respondWithStatusCode(_0x2f1c0b,_0xb28aab){_0xb28aab=_0xb28aab||0xcc;return function(_0x1ee6a4){if(_0x1ee6a4){return _0x2f1c0b['sendStatus'](_0xb28aab);}return _0x2f1c0b[_0xe3a5('0x1d')](_0xb28aab)['end']();};}function respondWithResult(_0x30fbf5,_0x166555){_0x166555=_0x166555||0xc8;return function(_0x67abc8){if(_0x67abc8){return _0x30fbf5[_0xe3a5('0x1d')](_0x166555)['json'](_0x67abc8);}};}function respondWithFilteredResult(_0x58f829,_0x2372a7){return function(_0x55fcd4){if(_0x55fcd4){var _0x1c482b=typeof _0x2372a7[_0xe3a5('0x1e')]===_0xe3a5('0x1f')&&typeof _0x2372a7[_0xe3a5('0x20')]===_0xe3a5('0x1f');var _0x1ce27a=_0x55fcd4['count'];var _0x59d75f=_0x1c482b?0x0:_0x2372a7['offset'];var _0x483774=_0x1c482b?_0x55fcd4[_0xe3a5('0x21')]:_0x2372a7[_0xe3a5('0x1e')]+_0x2372a7[_0xe3a5('0x20')];var _0x43a743;if(_0x483774>=_0x1ce27a){_0x483774=_0x1ce27a;_0x43a743=0xc8;}else{_0x43a743=0xce;}_0x58f829[_0xe3a5('0x1d')](_0x43a743);return _0x58f829[_0xe3a5('0x22')](_0xe3a5('0x23'),_0x59d75f+'-'+_0x483774+'/'+_0x1ce27a)[_0xe3a5('0x24')](_0x55fcd4);}return null;};}function patchUpdates(_0x5c9a85){return function(_0xdec302){try{jsonpatch[_0xe3a5('0x25')](_0xdec302,_0x5c9a85,!![]);}catch(_0x7d34d0){return BPromise['reject'](_0x7d34d0);}return _0xdec302[_0xe3a5('0x26')]();};}function saveUpdates(_0x57f8c2,_0x28e686){return function(_0x2a49f8){if(_0x2a49f8){return _0x2a49f8[_0xe3a5('0x27')](_0x57f8c2)['then'](function(_0x2523c2){return _0x2523c2;});}return null;};}function removeEntity(_0x1466d4,_0x4d1e69){return function(_0x4d3c5b){if(_0x4d3c5b){return _0x4d3c5b[_0xe3a5('0x28')]()[_0xe3a5('0x29')](function(){_0x1466d4['status'](0xcc)[_0xe3a5('0x2a')]();});}};}function handleEntityNotFound(_0x2d6658,_0x3ca838){return function(_0x1fc45b){if(!_0x1fc45b){_0x2d6658[_0xe3a5('0x2b')](0x194);}return _0x1fc45b;};}function handleError(_0x538fe3,_0x753a9){_0x753a9=_0x753a9||0x1f4;return function(_0x4f2470){logger['error'](_0x4f2470[_0xe3a5('0x2c')]);if(_0x4f2470[_0xe3a5('0x2d')]){delete _0x4f2470[_0xe3a5('0x2d')];}_0x538fe3[_0xe3a5('0x1d')](_0x753a9)[_0xe3a5('0x2e')](_0x4f2470);};}exports[_0xe3a5('0x2f')]=function(_0x35b402,_0xb67402,_0x420665){if(!_0x35b402['body'][_0xe3a5('0x30')](_0xe3a5('0x31'))&&!_0x35b402[_0xe3a5('0x32')]['hasOwnProperty'](_0xe3a5('0x33'))){throw new db[(_0xe3a5('0x34'))][(_0xe3a5('0x35'))](_0xe3a5('0x36'));}else{if(_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x30')]('TemplateId')&&!_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x30')]('view')){throw new db[(_0xe3a5('0x34'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x35b402['body'][_0xe3a5('0x30')](_0xe3a5('0x37'))){throw new db[(_0xe3a5('0x34'))]['ValidationError'](_0xe3a5('0x38'));}else{try{var _0x5c29f2=JSON['parse'](_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x37')]);}catch(_0x4884f4){logger['error'](_0x4884f4);throw new db['Sequelize'][(_0xe3a5('0x35'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5bf5e5=['chatqueue','faxqueue',_0xe3a5('0x39'),_0xe3a5('0x3a'),_0xe3a5('0x3b'),_0xe3a5('0x3c'),'whatsappqueue','team',_0xe3a5('0x3d')];if(_['some'](_0x5c29f2,function(_0x1f70db){return!_[_0xe3a5('0x3e')](_0x5bf5e5,_0x1f70db[_0xe3a5('0x3f')][_0xe3a5('0x40')]());})){throw new db['Sequelize'][(_0xe3a5('0x35'))](_0xe3a5('0x41'));}}}var _0x375012={};_0x375012[_0xe3a5('0x42')]=_0x35b402['body'][_0xe3a5('0x30')]('senderName')?_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x42')]:_0x35b402[_0xe3a5('0x3d')]['fullname'];_0x375012['recipientsDescription']=_[_0xe3a5('0x43')](_0x35b402[_0xe3a5('0x32')]['recipientsDescription'])?null:_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x44')];_0x375012[_0xe3a5('0x45')]=_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x45')]||![];_0x375012[_0xe3a5('0x46')]=_0x35b402['user']['id'];return getContent(_0x35b402[_0xe3a5('0x32')])[_0xe3a5('0x29')](function(_0x3c5884){_0x375012[_0xe3a5('0x32')]=_0x3c5884;return getRecipients(_0x5c29f2);})[_0xe3a5('0x29')](function(_0x3c0802){_0x375012[_0xe3a5('0x47')]=_[_0xe3a5('0x48')](_0x3c0802)[_0xe3a5('0x49')](',');return db[_0xe3a5('0x4a')][_0xe3a5('0x4b')](function(_0x80af84){return db[_0xe3a5('0x4c')]['create'](_0x375012,{'raw':!![],'transaction':_0x80af84})[_0xe3a5('0x29')](function(_0x3a26c4){var _0x1c93f6={'sender':_0x375012[_0xe3a5('0x42')],'description':_0x375012[_0xe3a5('0x44')],'content':_0x375012[_0xe3a5('0x32')],'beep':_0x375012[_0xe3a5('0x45')]};_0x3c0802['forEach'](function(_0x47fd59){_0x1c93f6[_0xe3a5('0x4d')]=_0x47fd59;socket[_0xe3a5('0x4e')](_0xe3a5('0x4f'),_0x1c93f6);});return _0x3a26c4;});});})['then'](respondWithResult(_0xb67402,0xc9))['catch'](handleError(_0xb67402,null));};function getContent(_0x44ae29){return new BPromise(function(_0x4a75ce,_0x2018c5){if(_0x44ae29[_0xe3a5('0x31')]){_0x4a75ce(_0x44ae29[_0xe3a5('0x31')]);return;}return db['Template'][_0xe3a5('0x50')]({'attributes':[_0xe3a5('0x51')],'where':{'id':_0x44ae29[_0xe3a5('0x33')]},'raw':!![]})[_0xe3a5('0x29')](function(_0x307c97){if(!_0x307c97)throw new db[(_0xe3a5('0x34'))][(_0xe3a5('0x35'))](_0xe3a5('0x52'));var _0x45e420=Mustache[_0xe3a5('0x53')](_0x307c97['html'],_0x44ae29[_0xe3a5('0x54')]);_0x4a75ce(_0x45e420);})[_0xe3a5('0x55')](function(_0x5596f5){_0x2018c5(_0x5596f5);});});}function getRecipients(_0x535dd3){return new BPromise(function(_0x2b840b,_0x647e0b){var _0x1286c5=[];var _0x4f872b=[];_0x535dd3[_0xe3a5('0x56')](function(_0x293df3){var _0x163fab=_[_0xe3a5('0x57')](_0x293df3['model'][_0xe3a5('0x40')]());if(_0x163fab===_0xe3a5('0x58')){_0x1286c5=_[_0xe3a5('0x59')](_0x1286c5,_0x293df3[_0xe3a5('0x5a')]);}else{if(_[_0xe3a5('0x3e')](_0x163fab,_0xe3a5('0x5b')))_0x163fab=_0x163fab['replace'](_0xe3a5('0x5b'),_0xe3a5('0x5c'));_0x293df3[_0xe3a5('0x5a')][_0xe3a5('0x56')](function(_0x3db316){_0x4f872b[_0xe3a5('0x5d')](getAgents(_0x163fab,_0x3db316));});}});return BPromise[_0xe3a5('0x5e')](_0x4f872b)[_0xe3a5('0x29')](function(_0xbb65d7){_0x1286c5=_[_0xe3a5('0x59')](_0x1286c5,_[_0xe3a5('0x5f')](_0xbb65d7));_0x2b840b(_0x1286c5);})[_0xe3a5('0x55')](function(_0x2505ae){_0x647e0b(_0x2505ae);});});}function getAgents(_0x337ca9,_0x1ef5ce){return new BPromise(function(_0x2e5f94,_0x5c23dd){return db[_0x337ca9][_0xe3a5('0x50')]({'where':{'id':_0x1ef5ce}})[_0xe3a5('0x29')](function(_0x4af318){return _0x4af318['getAgents']({'attributes':['id'],'raw':!![]})[_0xe3a5('0x29')](function(_0x14bb68){var _0x44fe22=_['map'](_0x14bb68,'id');_0x2e5f94(_0x44fe22);});})[_0xe3a5('0x55')](function(_0x1048a4){_0x5c23dd(_0x1048a4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 1adf973..9b4af78 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 _0x8f83=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x8f83,0x9e));var _0x38f8=function(_0x411b61,_0x23122b){_0x411b61=_0x411b61-0x0;var _0x82e8a1=_0x8f83[_0x411b61];return _0x82e8a1;};'use strict';var EventEmitter=require(_0x38f8('0x0'));var UserNotification=require(_0x38f8('0x1'))['db'][_0x38f8('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x38f8('0x3')](0x0);var events={'afterCreate':_0x38f8('0x4'),'afterUpdate':_0x38f8('0x5'),'afterDestroy':_0x38f8('0x6')};function emitEvent(_0x4e2527){return function(_0x2dd641,_0x29acbd,_0x2d0d4e){UserNotificationEvents[_0x38f8('0x7')](_0x4e2527+':'+_0x2dd641['id'],_0x2dd641);UserNotificationEvents['emit'](_0x4e2527,_0x2dd641);_0x2d0d4e(null);};}for(var e in events){if(events[_0x38f8('0x8')](e)){var event=events[e];UserNotification[_0x38f8('0x9')](e,emitEvent(event));}}module[_0x38f8('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x39cf=['UserNotification','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3d7954,_0x74af94){var _0x242873=function(_0x4851d3){while(--_0x4851d3){_0x3d7954['push'](_0x3d7954['shift']());}};_0x242873(++_0x74af94);}(_0x39cf,0x1ae));var _0xf39c=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x39cf[_0x57486e];return _0x5f110b;};'use strict';var EventEmitter=require(_0xf39c('0x0'));var UserNotification=require(_0xf39c('0x1'))['db'][_0xf39c('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf39c('0x3')](0x0);var events={'afterCreate':_0xf39c('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e8459){return function(_0x36b657,_0xf2d482,_0xe28b3a){UserNotificationEvents[_0xf39c('0x5')](_0x2e8459+':'+_0x36b657['id'],_0x36b657);UserNotificationEvents[_0xf39c('0x5')](_0x2e8459,_0x36b657);_0xe28b3a(null);};}for(var e in events){if(events[_0xf39c('0x6')](e)){var event=events[e];UserNotification[_0xf39c('0x7')](e,emitEvent(event));}}module[_0xf39c('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 819852c..6e0bff2 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 _0x7b9b=['rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0x7b9b,0x97));var _0xb7b9=function(_0x516118,_0x26acb7){_0x516118=_0x516118-0x0;var _0x4922a8=_0x7b9b[_0x516118];return _0x4922a8;};'use strict';var _=require('lodash');var util=require(_0xb7b9('0x0'));var logger=require('../../config/logger')(_0xb7b9('0x1'));var moment=require(_0xb7b9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb7b9('0x3'));var fs=require('fs');var path=require(_0xb7b9('0x4'));var rimraf=require(_0xb7b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7b9('0x6'));module[_0xb7b9('0x7')]=function(_0x155268,_0x15fa43){return _0x155268[_0xb7b9('0x8')](_0xb7b9('0x9'),attributes,{'tableName':_0xb7b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7b9('0xb'),'collate':_0xb7b9('0xc')});}; \ No newline at end of file +var _0x38e7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x592eeb,_0x10ef82){var _0x3ea777=function(_0x4ca4f7){while(--_0x4ca4f7){_0x592eeb['push'](_0x592eeb['shift']());}};_0x3ea777(++_0x10ef82);}(_0x38e7,0x1b3));var _0x738e=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x38e7[_0x4de9e8];return _0x4db0de;};'use strict';var _=require('lodash');var util=require(_0x738e('0x0'));var logger=require(_0x738e('0x1'))(_0x738e('0x2'));var moment=require(_0x738e('0x3'));var BPromise=require(_0x738e('0x4'));var rp=require(_0x738e('0x5'));var fs=require('fs');var path=require(_0x738e('0x6'));var rimraf=require(_0x738e('0x7'));var config=require('../../config/environment');var attributes=require(_0x738e('0x8'));module[_0x738e('0x9')]=function(_0x33a23f,_0x17fa11){return _0x33a23f[_0x738e('0xa')](_0x738e('0xb'),attributes,{'tableName':_0x738e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x738e('0xd'),'collate':_0x738e('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8007aaa..3a2227f 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 _0x761e=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x3802d7,_0x15e553){var _0x25bda5=function(_0x5ed02c){while(--_0x5ed02c){_0x3802d7['push'](_0x3802d7['shift']());}};_0x25bda5(++_0x15e553);}(_0x761e,0xb7));var _0xe761=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x761e[_0x57b236];return _0x4feb29;};'use strict';var _=require(_0xe761('0x0'));var util=require(_0xe761('0x1'));var moment=require('moment');var BPromise=require(_0xe761('0x2'));var rs=require(_0xe761('0x3'));var fs=require('fs');var Redis=require(_0xe761('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe761('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe761('0x6'));var jayson=require(_0xe761('0x7'));var client=jayson[_0xe761('0x8')][_0xe761('0x9')]({'port':0x232a});config[_0xe761('0xa')]=_[_0xe761('0xb')](config['redis'],{'host':_0xe761('0xc'),'port':0x18eb});var socket=require(_0xe761('0xd'))(new Redis(config[_0xe761('0xa')]));require(_0xe761('0xe'))[_0xe761('0xf')](socket);function respondWithRpcPromise(_0x33eda1,_0xc3323b,_0x4dfb99){return new BPromise(function(_0x30e479,_0x749cfa){return client[_0xe761('0x10')](_0x33eda1,_0x4dfb99)[_0xe761('0x11')](function(_0xf286cb){logger[_0xe761('0x12')](_0xe761('0x13'),_0xc3323b,_0xe761('0x14'));logger[_0xe761('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0xc3323b,'request\x20sent',JSON['stringify'](_0xf286cb));if(_0xf286cb[_0xe761('0x16')]){if(_0xf286cb[_0xe761('0x16')][_0xe761('0x17')]===0x1f4){logger[_0xe761('0x16')](_0xe761('0x13'),_0xc3323b,_0xf286cb[_0xe761('0x16')][_0xe761('0x18')]);return _0x749cfa(_0xf286cb[_0xe761('0x16')][_0xe761('0x18')]);}logger['error'](_0xe761('0x13'),_0xc3323b,_0xf286cb[_0xe761('0x16')][_0xe761('0x18')]);return _0x30e479(_0xf286cb['error']['message']);}else{logger['info'](_0xe761('0x13'),_0xc3323b,'request\x20sent');_0x30e479(_0xf286cb['result'][_0xe761('0x18')]);}})[_0xe761('0x19')](function(_0x17b0ed){logger[_0xe761('0x16')](_0xe761('0x13'),_0xc3323b,_0x17b0ed);_0x749cfa(_0x17b0ed);});});} \ No newline at end of file +var _0x0225=['client','redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserNotification,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x55cea0,_0x4debe7){var _0x1fa966=function(_0x4b561a){while(--_0x4b561a){_0x55cea0['push'](_0x55cea0['shift']());}};_0x1fa966(++_0x4debe7);}(_0x0225,0x74));var _0x5022=function(_0x338391,_0x4d5e84){_0x338391=_0x338391-0x0;var _0x363e1c=_0x0225[_0x338391];return _0x363e1c;};'use strict';var _=require(_0x5022('0x0'));var util=require(_0x5022('0x1'));var moment=require('moment');var BPromise=require(_0x5022('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5022('0x3'));var db=require(_0x5022('0x4'))['db'];var utils=require(_0x5022('0x5'));var logger=require(_0x5022('0x6'))('rpc');var config=require(_0x5022('0x7'));var jayson=require(_0x5022('0x8'));var client=jayson[_0x5022('0x9')]['http']({'port':0x232a});config[_0x5022('0xa')]=_['defaults'](config[_0x5022('0xa')],{'host':_0x5022('0xb'),'port':0x18eb});var socket=require(_0x5022('0xc'))(new Redis(config[_0x5022('0xa')]));require(_0x5022('0xd'))[_0x5022('0xe')](socket);function respondWithRpcPromise(_0x16659a,_0x50239a,_0x3d454b){return new BPromise(function(_0x93cdb4,_0xb67e0e){return client['request'](_0x16659a,_0x3d454b)[_0x5022('0xf')](function(_0x1261a7){logger[_0x5022('0x10')]('UserNotification,\x20%s,\x20%s',_0x50239a,'request\x20sent');logger[_0x5022('0x11')](_0x5022('0x12'),_0x50239a,_0x5022('0x13'),JSON[_0x5022('0x14')](_0x1261a7));if(_0x1261a7[_0x5022('0x15')]){if(_0x1261a7[_0x5022('0x15')]['code']===0x1f4){logger[_0x5022('0x15')](_0x5022('0x16'),_0x50239a,_0x1261a7[_0x5022('0x15')]['message']);return _0xb67e0e(_0x1261a7[_0x5022('0x15')][_0x5022('0x17')]);}logger[_0x5022('0x15')](_0x5022('0x16'),_0x50239a,_0x1261a7[_0x5022('0x15')][_0x5022('0x17')]);return _0x93cdb4(_0x1261a7['error'][_0x5022('0x17')]);}else{logger[_0x5022('0x10')](_0x5022('0x16'),_0x50239a,_0x5022('0x13'));_0x93cdb4(_0x1261a7['result'][_0x5022('0x17')]);}})[_0x5022('0x18')](function(_0x3bfe1e){logger['error'](_0x5022('0x16'),_0x50239a,_0x3bfe1e);_0xb67e0e(_0x3bfe1e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 96cf2cb..13277d5 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 _0xd8f8=['./userNotification.events','update','emit','removeListener','register','length'];(function(_0x503ea8,_0x22e391){var _0x427e5d=function(_0x1484e8){while(--_0x1484e8){_0x503ea8['push'](_0x503ea8['shift']());}};_0x427e5d(++_0x22e391);}(_0xd8f8,0x1f2));var _0x8d8f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xd8f8[_0x1589dd];return _0x1bddd1;};'use strict';var UserNotificationEvents=require(_0x8d8f('0x0'));var events=['save','remove',_0x8d8f('0x1')];function createListener(_0xcebb65,_0x5d39f3){return function(_0xa58b27){_0x5d39f3[_0x8d8f('0x2')](_0xcebb65,_0xa58b27);};}function removeListener(_0x244a12,_0x4994ac){return function(){UserNotificationEvents[_0x8d8f('0x3')](_0x244a12,_0x4994ac);};}exports[_0x8d8f('0x4')]=function(_0x1e1a18){for(var _0x3857fe=0x0,_0x200c07=events[_0x8d8f('0x5')];_0x3857fe<_0x200c07;_0x3857fe++){var _0x15d8eb=events[_0x3857fe];var _0x21d1fb=createListener('userNotification:'+_0x15d8eb,_0x1e1a18);UserNotificationEvents['on'](_0x15d8eb,_0x21d1fb);}}; \ No newline at end of file +var _0x6c51=['save','remove','update','removeListener','length','userNotification:','./userNotification.events'];(function(_0x5c44ca,_0x176260){var _0x112eeb=function(_0x278a66){while(--_0x278a66){_0x5c44ca['push'](_0x5c44ca['shift']());}};_0x112eeb(++_0x176260);}(_0x6c51,0x1c6));var _0x16c5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6c51[_0xa464c9];return _0x3d73c4;};'use strict';var UserNotificationEvents=require(_0x16c5('0x0'));var events=[_0x16c5('0x1'),_0x16c5('0x2'),_0x16c5('0x3')];function createListener(_0x159341,_0xa45eb4){return function(_0xda6901){_0xa45eb4['emit'](_0x159341,_0xda6901);};}function removeListener(_0x53abac,_0x23bbae){return function(){UserNotificationEvents[_0x16c5('0x4')](_0x53abac,_0x23bbae);};}exports['register']=function(_0x4429bc){for(var _0x1e1f8b=0x0,_0x39b033=events[_0x16c5('0x5')];_0x1e1f8b<_0x39b033;_0x1e1f8b++){var _0x5276a4=events[_0x1e1f8b];var _0x4b2fb1=createListener(_0x16c5('0x6')+_0x5276a4,_0x4429bc);UserNotificationEvents['on'](_0x5276a4,_0x4b2fb1);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index b60ba81..85a50b7 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x494abf,_0xc69b50){var _0x165352=function(_0x994bc3){while(--_0x994bc3){_0x494abf['push'](_0x494abf['shift']());}};_0x165352(++_0xc69b50);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0xcb91[_0x10c51f];return _0x56a0cd;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x495acf,_0x5c0120){var _0x417f5e=function(_0x1405b9){while(--_0x1405b9){_0x495acf['push'](_0x495acf['shift']());}};_0x417f5e(++_0x5c0120);}(_0xe706,0xa3));var _0x6e70=function(_0x44b346,_0xeb097d){_0x44b346=_0x44b346-0x0;var _0x1c2f2b=_0xe706[_0x44b346];return _0x1c2f2b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 04bacc4..821ccfd 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 _0xa115=['sequelize','exports','INTEGER'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xa115,0x81));var _0x5a11=function(_0x1507fd,_0x895743){_0x1507fd=_0x1507fd-0x0;var _0x155d34=_0xa115[_0x1507fd];return _0x155d34;};'use strict';var Sequelize=require(_0x5a11('0x0'));module[_0x5a11('0x1')]={'penalty':{'type':Sequelize[_0x5a11('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1a6b=['INTEGER','sequelize','exports'];(function(_0x1b67aa,_0x57f59d){var _0x19ed6d=function(_0x192e56){while(--_0x192e56){_0x1b67aa['push'](_0x1b67aa['shift']());}};_0x19ed6d(++_0x57f59d);}(_0x1a6b,0x94));var _0xb1a6=function(_0x305f4b,_0x39199b){_0x305f4b=_0x305f4b-0x0;var _0x140130=_0x1a6b[_0x305f4b];return _0x140130;};'use strict';var Sequelize=require(_0xb1a6('0x0'));module[_0xb1a6('0x1')]={'penalty':{'type':Sequelize[_0xb1a6('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 79e60ac..2b57bb8 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 _0xc5c7=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','api','moment','bluebird','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc5c7,0x124));var _0x7c5c=function(_0x1158af,_0x1d7917){_0x1158af=_0x1158af-0x0;var _0x322890=_0xc5c7[_0x1158af];return _0x322890;};'use strict';var _=require('lodash');var util=require(_0x7c5c('0x0'));var logger=require('../../config/logger')(_0x7c5c('0x1'));var moment=require(_0x7c5c('0x2'));var BPromise=require(_0x7c5c('0x3'));var rp=require(_0x7c5c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c5c('0x5'));var config=require(_0x7c5c('0x6'));var attributes=require(_0x7c5c('0x7'));module[_0x7c5c('0x8')]=function(_0x4a441f,_0x154fbb){return _0x4a441f['define'](_0x7c5c('0x9'),attributes,{'tableName':_0x7c5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a7c=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x7677eb,_0x59ba67){var _0x523039=function(_0x27edf7){while(--_0x27edf7){_0x7677eb['push'](_0x7677eb['shift']());}};_0x523039(++_0x59ba67);}(_0x4a7c,0x1ed));var _0xc4a7=function(_0x167769,_0x3f5533){_0x167769=_0x167769-0x0;var _0x2bc551=_0x4a7c[_0x167769];return _0x2bc551;};'use strict';var _=require(_0xc4a7('0x0'));var util=require('util');var logger=require(_0xc4a7('0x1'))('api');var moment=require(_0xc4a7('0x2'));var BPromise=require(_0xc4a7('0x3'));var rp=require(_0xc4a7('0x4'));var fs=require('fs');var path=require(_0xc4a7('0x5'));var rimraf=require(_0xc4a7('0x6'));var config=require(_0xc4a7('0x7'));var attributes=require(_0xc4a7('0x8'));module[_0xc4a7('0x9')]=function(_0x47960d,_0x546a96){return _0x47960d[_0xc4a7('0xa')](_0xc4a7('0xb'),attributes,{'tableName':_0xc4a7('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 92cb73e..f332e13 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 _0x9768=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','code','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x8bb11a,_0x516e83){var _0x4d8c2b=function(_0x44c895){while(--_0x44c895){_0x8bb11a['push'](_0x8bb11a['shift']());}};_0x4d8c2b(++_0x516e83);}(_0x9768,0x96));var _0x8976=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0x9768[_0x5ca353];return _0x4f2fe5;};'use strict';var _=require(_0x8976('0x0'));var util=require('util');var moment=require(_0x8976('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8976('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8976('0x3'))('rpc');var config=require(_0x8976('0x4'));var jayson=require(_0x8976('0x5'));var client=jayson[_0x8976('0x6')][_0x8976('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ec2cd,_0x7bb1b2,_0x43d443){return new BPromise(function(_0x114ada,_0x27a7b3){return client[_0x8976('0x8')](_0x1ec2cd,_0x43d443)['then'](function(_0x123caa){logger[_0x8976('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x7bb1b2,_0x8976('0xa'));logger[_0x8976('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x7bb1b2,_0x8976('0xa'),JSON[_0x8976('0xc')](_0x123caa));if(_0x123caa['error']){if(_0x123caa['error'][_0x8976('0xd')]===0x1f4){logger[_0x8976('0xe')](_0x8976('0xf'),_0x7bb1b2,_0x123caa[_0x8976('0xe')][_0x8976('0x10')]);return _0x27a7b3(_0x123caa['error']['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x7bb1b2,_0x123caa[_0x8976('0xe')][_0x8976('0x10')]);return _0x114ada(_0x123caa[_0x8976('0xe')][_0x8976('0x10')]);}else{logger[_0x8976('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x7bb1b2,_0x8976('0xa'));_0x114ada(_0x123caa[_0x8976('0x11')][_0x8976('0x10')]);}})[_0x8976('0x12')](function(_0x43f491){logger[_0x8976('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x7bb1b2,_0x43f491);_0x27a7b3(_0x43f491);});});} \ No newline at end of file +var _0xbe7f=['../../config/utils','../../config/logger','rpc','client','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x18ba26,_0x4c142c){var _0x58ad0c=function(_0x872d4b){while(--_0x872d4b){_0x18ba26['push'](_0x18ba26['shift']());}};_0x58ad0c(++_0x4c142c);}(_0xbe7f,0xa7));var _0xfbe7=function(_0x6cdf62,_0x25d4f5){_0x6cdf62=_0x6cdf62-0x0;var _0x24a12a=_0xbe7f[_0x6cdf62];return _0x24a12a;};'use strict';var _=require(_0xfbe7('0x0'));var util=require(_0xfbe7('0x1'));var moment=require(_0xfbe7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbe7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbe7('0x4'));var logger=require(_0xfbe7('0x5'))(_0xfbe7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfbe7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5c04,_0x21c973,_0x480a4b){return new BPromise(function(_0x40caae,_0x546109){return client[_0xfbe7('0x8')](_0x3c5c04,_0x480a4b)['then'](function(_0x48627a){logger[_0xfbe7('0x9')](_0xfbe7('0xa'),_0x21c973,_0xfbe7('0xb'));logger['debug'](_0xfbe7('0xc'),_0x21c973,_0xfbe7('0xb'),JSON[_0xfbe7('0xd')](_0x48627a));if(_0x48627a['error']){if(_0x48627a[_0xfbe7('0xe')][_0xfbe7('0xf')]===0x1f4){logger[_0xfbe7('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x21c973,_0x48627a['error']['message']);return _0x546109(_0x48627a[_0xfbe7('0xe')][_0xfbe7('0x10')]);}logger[_0xfbe7('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x21c973,_0x48627a[_0xfbe7('0xe')][_0xfbe7('0x10')]);return _0x40caae(_0x48627a['error'][_0xfbe7('0x10')]);}else{logger[_0xfbe7('0x9')](_0xfbe7('0xa'),_0x21c973,'request\x20sent');_0x40caae(_0x48627a[_0xfbe7('0x11')][_0xfbe7('0x10')]);}})[_0xfbe7('0x12')](function(_0x108579){logger[_0xfbe7('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x21c973,_0x108579);_0x546109(_0x108579);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 850e9d9..7a13a26 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 _0x93f5=['addSections','addResources','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','post','clone'];(function(_0x3efde9,_0x3fc803){var _0x12697d=function(_0x1416b4){while(--_0x1416b4){_0x3efde9['push'](_0x3efde9['shift']());}};_0x12697d(++_0x3fc803);}(_0x93f5,0x10c));var _0x593f=function(_0x4561f2,_0x553c86){_0x4561f2=_0x4561f2-0x0;var _0x76e69d=_0x93f5[_0x4561f2];return _0x76e69d;};'use strict';var multer=require(_0x593f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x593f('0x1'));var express=require(_0x593f('0x2'));var router=express[_0x593f('0x3')]();var fs_extra=require(_0x593f('0x4'));var auth=require(_0x593f('0x5'));var interaction=require(_0x593f('0x6'));var config=require(_0x593f('0x7'));var controller=require(_0x593f('0x8'));router[_0x593f('0x9')]('/',auth[_0x593f('0xa')](),controller[_0x593f('0xb')]);router[_0x593f('0x9')](_0x593f('0xc'),auth[_0x593f('0xa')](),controller['describe']);router[_0x593f('0x9')](_0x593f('0xd'),auth[_0x593f('0xa')](),controller[_0x593f('0xe')]);router['get'](_0x593f('0xf'),auth['isAuthenticated'](),controller[_0x593f('0x10')]);router['get'](_0x593f('0x11'),auth[_0x593f('0xa')](),controller[_0x593f('0x12')]);router['post']('/',auth[_0x593f('0xa')](),controller[_0x593f('0x13')]);router[_0x593f('0x14')]('/:id/clone',auth[_0x593f('0xa')](),controller[_0x593f('0x15')]);router['post'](_0x593f('0xf'),auth[_0x593f('0xa')](),controller[_0x593f('0x16')]);router[_0x593f('0x14')](_0x593f('0x11'),auth[_0x593f('0xa')](),controller[_0x593f('0x17')]);router[_0x593f('0x18')](_0x593f('0xd'),auth[_0x593f('0xa')](),controller[_0x593f('0x19')]);router[_0x593f('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x593f('0x1b')]);router[_0x593f('0x1a')](_0x593f('0xf'),auth[_0x593f('0xa')](),controller['removeSections']);router[_0x593f('0x1a')](_0x593f('0x11'),auth['isAuthenticated'](),controller['removeResources']);module[_0x593f('0x1c')]=router; \ No newline at end of file +var _0x5594=['post','/:id/clone','clone','addResources','put','update','delete','/:id','destroy','removeResources','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5594,0x173));var _0x4559=function(_0x23707a,_0x4c5296){_0x23707a=_0x23707a-0x0;var _0x3eeea8=_0x5594[_0x23707a];return _0x3eeea8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4559('0x0'));var timeout=require(_0x4559('0x1'));var express=require(_0x4559('0x2'));var router=express['Router']();var fs_extra=require(_0x4559('0x3'));var auth=require(_0x4559('0x4'));var interaction=require(_0x4559('0x5'));var config=require(_0x4559('0x6'));var controller=require(_0x4559('0x7'));router[_0x4559('0x8')]('/',auth[_0x4559('0x9')](),controller[_0x4559('0xa')]);router['get'](_0x4559('0xb'),auth[_0x4559('0x9')](),controller[_0x4559('0xc')]);router[_0x4559('0x8')]('/:id',auth[_0x4559('0x9')](),controller[_0x4559('0xd')]);router[_0x4559('0x8')](_0x4559('0xe'),auth[_0x4559('0x9')](),controller[_0x4559('0xf')]);router[_0x4559('0x8')](_0x4559('0x10'),auth[_0x4559('0x9')](),controller[_0x4559('0x11')]);router['post']('/',auth[_0x4559('0x9')](),controller[_0x4559('0x12')]);router[_0x4559('0x13')](_0x4559('0x14'),auth[_0x4559('0x9')](),controller[_0x4559('0x15')]);router[_0x4559('0x13')](_0x4559('0xe'),auth['isAuthenticated'](),controller['addSections']);router[_0x4559('0x13')](_0x4559('0x10'),auth[_0x4559('0x9')](),controller[_0x4559('0x16')]);router[_0x4559('0x17')]('/:id',auth[_0x4559('0x9')](),controller[_0x4559('0x18')]);router[_0x4559('0x19')](_0x4559('0x1a'),auth[_0x4559('0x9')](),controller[_0x4559('0x1b')]);router[_0x4559('0x19')](_0x4559('0xe'),auth['isAuthenticated'](),controller['removeSections']);router[_0x4559('0x19')](_0x4559('0x10'),auth[_0x4559('0x9')](),controller[_0x4559('0x1c')]);module[_0x4559('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index fe1767c..a4cfb66 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 _0xcea8=['getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','crudPermissions'];(function(_0x594d94,_0x5f2cf3){var _0x929428=function(_0x4b8a0b){while(--_0x4b8a0b){_0x594d94['push'](_0x594d94['shift']());}};_0x929428(++_0x5f2cf3);}(_0xcea8,0xff));var _0x8cea=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0xcea8[_0x15f3c0];return _0x1adfe0;};'use strict';var Sequelize=require(_0x8cea('0x0'));module[_0x8cea('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8cea('0x2')},'crudPermissions':{'type':Sequelize[_0x8cea('0x3')],'set':function(_0x11a810){this[_0x8cea('0x4')](_0x8cea('0x5'),_0x11a810?_0x11a810['join'](''):[]);},'get':function(){return this[_0x8cea('0x6')]('crudPermissions')?this[_0x8cea('0x6')](_0x8cea('0x5'))[_0x8cea('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8cea('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8cea('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3a7e=['STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x534733,_0x115d0b){var _0x1166e8=function(_0x4a79d6){while(--_0x4a79d6){_0x534733['push'](_0x534733['shift']());}};_0x1166e8(++_0x115d0b);}(_0x3a7e,0x1de));var _0xe3a7=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x3a7e[_0x285824];return _0x311d7e;};'use strict';var Sequelize=require(_0xe3a7('0x0'));module[_0xe3a7('0x1')]={'name':{'type':Sequelize[_0xe3a7('0x2')],'allowNull':![],'unique':_0xe3a7('0x3')},'crudPermissions':{'type':Sequelize[_0xe3a7('0x2')],'set':function(_0x417747){this[_0xe3a7('0x4')](_0xe3a7('0x5'),_0x417747?_0x417747[_0xe3a7('0x6')](''):[]);},'get':function(){return this[_0xe3a7('0x7')]('crudPermissions')?this['getDataValue'](_0xe3a7('0x5'))[_0xe3a7('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c513971..a5a5d4e 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 _0x5629=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./userProfile.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','map','UserProfile','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','omit','createdAt','updatedAt','sequelize','transaction','get','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','find','describe','addSections','destroy','sectionId','push','removeSections','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x24154b,_0x227ae2){var _0x119c38=function(_0x5eec1a){while(--_0x5eec1a){_0x24154b['push'](_0x24154b['shift']());}};_0x119c38(++_0x227ae2);}(_0x5629,0x1c6));var _0x9562=function(_0x158961,_0xb8764c){_0x158961=_0x158961-0x0;var _0x4b495e=_0x5629[_0x158961];return _0x4b495e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9562('0x0'));var zipdir=require(_0x9562('0x1'));var jsonpatch=require(_0x9562('0x2'));var rp=require(_0x9562('0x3'));var moment=require('moment');var BPromise=require(_0x9562('0x4'));var Mustache=require(_0x9562('0x5'));var util=require('util');var path=require(_0x9562('0x6'));var sox=require(_0x9562('0x7'));var csv=require(_0x9562('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9562('0x9'));var _=require(_0x9562('0xa'));var squel=require(_0x9562('0xb'));var crypto=require(_0x9562('0xc'));var jsforce=require(_0x9562('0xd'));var deskjs=require(_0x9562('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9562('0xf'));var Papa=require(_0x9562('0x10'));var Redis=require(_0x9562('0x11'));var authService=require(_0x9562('0x12'));var qs=require(_0x9562('0x13'));var as=require(_0x9562('0x14'));var hardwareService=require(_0x9562('0x15'));var logger=require(_0x9562('0x16'))(_0x9562('0x17'));var utils=require(_0x9562('0x18'));var config=require(_0x9562('0x19'));var licenseUtil=require(_0x9562('0x1a'));var db=require(_0x9562('0x1b'))['db'];config[_0x9562('0x1c')]=_['defaults'](config[_0x9562('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9562('0x1c')]));require(_0x9562('0x1d'))[_0x9562('0x1e')](socket);function respondWithStatusCode(_0x323c1b,_0x4cdacb){_0x4cdacb=_0x4cdacb||0xcc;return function(_0x816a4d){if(_0x816a4d){return _0x323c1b['sendStatus'](_0x4cdacb);}return _0x323c1b[_0x9562('0x1f')](_0x4cdacb)['end']();};}function respondWithResult(_0xc65c51,_0x52e4c2){_0x52e4c2=_0x52e4c2||0xc8;return function(_0xc67e01){if(_0xc67e01){return _0xc65c51[_0x9562('0x1f')](_0x52e4c2)[_0x9562('0x20')](_0xc67e01);}};}function respondWithFilteredResult(_0x171d90,_0x37f8ad){return function(_0x5f1003){if(_0x5f1003){var _0x5a4c38=typeof _0x37f8ad[_0x9562('0x21')]===_0x9562('0x22')&&typeof _0x37f8ad[_0x9562('0x23')]==='undefined';var _0x49a683=_0x5f1003[_0x9562('0x24')];var _0x347f97=_0x5a4c38?0x0:_0x37f8ad[_0x9562('0x21')];var _0x25c667=_0x5a4c38?_0x5f1003['count']:_0x37f8ad[_0x9562('0x21')]+_0x37f8ad['limit'];var _0x320d27;if(_0x25c667>=_0x49a683){_0x25c667=_0x49a683;_0x320d27=0xc8;}else{_0x320d27=0xce;}_0x171d90[_0x9562('0x1f')](_0x320d27);return _0x171d90[_0x9562('0x25')](_0x9562('0x26'),_0x347f97+'-'+_0x25c667+'/'+_0x49a683)['json'](_0x5f1003);}return null;};}function patchUpdates(_0x2690df){return function(_0x30abd6){try{jsonpatch[_0x9562('0x27')](_0x30abd6,_0x2690df,!![]);}catch(_0x4298c4){return BPromise[_0x9562('0x28')](_0x4298c4);}return _0x30abd6[_0x9562('0x29')]();};}function saveUpdates(_0x200d35,_0x43fe21){return function(_0x126684){if(_0x126684){return _0x126684[_0x9562('0x2a')](_0x200d35)[_0x9562('0x2b')](function(_0x52f717){return _0x52f717;});}return null;};}function removeEntity(_0x4bdfcb,_0x402ca5){return function(_0xe883e9){if(_0xe883e9){return _0xe883e9['destroy']()[_0x9562('0x2b')](function(){_0x4bdfcb[_0x9562('0x1f')](0xcc)[_0x9562('0x2c')]();});}};}function handleEntityNotFound(_0x5c588b,_0x5c612c){return function(_0x13099e){if(!_0x13099e){_0x5c588b[_0x9562('0x2d')](0x194);}return _0x13099e;};}function handleError(_0x5d7fc8,_0x3d5aa7){_0x3d5aa7=_0x3d5aa7||0x1f4;return function(_0x22477c){logger[_0x9562('0x2e')](_0x22477c[_0x9562('0x2f')]);if(_0x22477c[_0x9562('0x30')]){delete _0x22477c[_0x9562('0x30')];}_0x5d7fc8[_0x9562('0x1f')](_0x3d5aa7)[_0x9562('0x31')](_0x22477c);};}exports['index']=function(_0xc95c45,_0x35a9f9){var _0xf6c149={},_0x19e25a={},_0x2c9759={'count':0x0,'rows':[]};var _0x59a36f=_[_0x9562('0x32')](db[_0x9562('0x33')][_0x9562('0x34')],function(_0x1f8bdd){return{'name':_0x1f8bdd['fieldName'],'type':_0x1f8bdd['type'][_0x9562('0x35')]};});_0x19e25a[_0x9562('0x36')]=_[_0x9562('0x32')](_0x59a36f,_0x9562('0x30'));_0x19e25a[_0x9562('0x37')]=_[_0x9562('0x38')](_0xc95c45['query']);_0x19e25a[_0x9562('0x39')]=_[_0x9562('0x3a')](_0x19e25a[_0x9562('0x36')],_0x19e25a[_0x9562('0x37')]);_0xf6c149[_0x9562('0x3b')]=_[_0x9562('0x3a')](_0x19e25a[_0x9562('0x36')],qs['fields'](_0xc95c45[_0x9562('0x37')][_0x9562('0x3c')]));_0xf6c149[_0x9562('0x3b')]=_0xf6c149[_0x9562('0x3b')][_0x9562('0x3d')]?_0xf6c149['attributes']:_0x19e25a[_0x9562('0x36')];if(!_0xc95c45[_0x9562('0x37')][_0x9562('0x3e')]('nolimit')){_0xf6c149[_0x9562('0x23')]=qs['limit'](_0xc95c45[_0x9562('0x37')][_0x9562('0x23')]);_0xf6c149[_0x9562('0x21')]=qs[_0x9562('0x21')](_0xc95c45[_0x9562('0x37')][_0x9562('0x21')]);}_0xf6c149[_0x9562('0x3f')]=qs[_0x9562('0x40')](_0xc95c45['query'][_0x9562('0x40')]);_0xf6c149['where']=qs['filters'](_[_0x9562('0x41')](_0xc95c45[_0x9562('0x37')],_0x19e25a[_0x9562('0x39')]),_0x59a36f);if(_0xc95c45[_0x9562('0x37')][_0x9562('0x42')]){_0xf6c149['where']=_[_0x9562('0x43')](_0xf6c149[_0x9562('0x44')],{'$or':_['map'](_0x59a36f,function(_0x526ffd){if(_0x526ffd[_0x9562('0x45')]!==_0x9562('0x46')){var _0x17f05f={};_0x17f05f[_0x526ffd[_0x9562('0x30')]]={'$like':'%'+_0xc95c45[_0x9562('0x37')][_0x9562('0x42')]+'%'};return _0x17f05f;}})});}_0xf6c149=_[_0x9562('0x43')]({},_0xf6c149,_0xc95c45[_0x9562('0x47')]);var _0x3c89cb={'where':_0xf6c149[_0x9562('0x44')]};return db[_0x9562('0x33')][_0x9562('0x24')](_0x3c89cb)[_0x9562('0x2b')](function(_0xe52a9c){_0x2c9759[_0x9562('0x24')]=_0xe52a9c;if(_0xc95c45[_0x9562('0x37')][_0x9562('0x48')]){_0xf6c149[_0x9562('0x49')]=[{'all':!![]}];}return db[_0x9562('0x33')]['findAll'](_0xf6c149);})[_0x9562('0x2b')](function(_0x3ea965){_0x2c9759[_0x9562('0x4a')]=_0x3ea965;return _0x2c9759;})[_0x9562('0x2b')](respondWithFilteredResult(_0x35a9f9,_0xf6c149))[_0x9562('0x4b')](handleError(_0x35a9f9,null));};exports[_0x9562('0x4c')]=function(_0x54bfd5,_0x1a9a73){var _0x59763d={'raw':![],'where':{'id':_0x54bfd5[_0x9562('0x4d')]['id']}},_0x57c5b5={};_0x57c5b5[_0x9562('0x36')]=_[_0x9562('0x38')](db[_0x9562('0x33')][_0x9562('0x34')]);_0x57c5b5[_0x9562('0x37')]=_[_0x9562('0x38')](_0x54bfd5['query']);_0x57c5b5['filters']=_['intersection'](_0x57c5b5['model'],_0x57c5b5[_0x9562('0x37')]);_0x59763d[_0x9562('0x3b')]=_[_0x9562('0x3a')](_0x57c5b5[_0x9562('0x36')],qs[_0x9562('0x3c')](_0x54bfd5[_0x9562('0x37')][_0x9562('0x3c')]));_0x59763d['attributes']=_0x59763d['attributes'][_0x9562('0x3d')]?_0x59763d[_0x9562('0x3b')]:_0x57c5b5[_0x9562('0x36')];if(_0x54bfd5[_0x9562('0x37')][_0x9562('0x48')]){_0x59763d[_0x9562('0x49')]=[{'all':!![]}];}_0x59763d=_[_0x9562('0x43')]({},_0x59763d,_0x54bfd5[_0x9562('0x47')]);return db[_0x9562('0x33')]['find'](_0x59763d)[_0x9562('0x2b')](handleEntityNotFound(_0x1a9a73,null))[_0x9562('0x2b')](respondWithResult(_0x1a9a73,null))[_0x9562('0x4b')](handleError(_0x1a9a73,null));};exports[_0x9562('0x4e')]=function(_0x10efb1,_0x51d8ea){return db[_0x9562('0x33')][_0x9562('0x4e')](_0x10efb1[_0x9562('0x4f')],{})[_0x9562('0x2b')](respondWithResult(_0x51d8ea,0xc9))[_0x9562('0x4b')](handleError(_0x51d8ea,null));};exports['clone']=function(_0x1820f6,_0x559d6c){var _0x3e43fc={'where':{'id':_0x1820f6['params']['id']}},_0x5cb869={};_0x5cb869[_0x9562('0x36')]=_[_0x9562('0x38')](db[_0x9562('0x33')][_0x9562('0x34')]);_0x3e43fc[_0x9562('0x3b')]=_['intersection'](_0x5cb869['model'],qs['fields'](_0x1820f6[_0x9562('0x37')][_0x9562('0x3c')]));_0x3e43fc[_0x9562('0x3b')]=_0x3e43fc[_0x9562('0x3b')][_0x9562('0x3d')]?_0x3e43fc[_0x9562('0x3b')]:_0x5cb869[_0x9562('0x36')];if(_0x1820f6[_0x9562('0x37')][_0x9562('0x48')]){_0x3e43fc[_0x9562('0x49')]=[{'all':!![]}];}_0x3e43fc=_[_0x9562('0x43')]({},_0x3e43fc,_0x1820f6['options']);return db[_0x9562('0x33')]['find'](_0x3e43fc)[_0x9562('0x2b')](handleEntityNotFound(_0x559d6c,null))[_0x9562('0x2b')](function(_0x49e8b6){if(_0x49e8b6){var _0x2bacd7=_0x49e8b6['get']({'plain':!![]});_0x2bacd7=qs[_0x9562('0x50')](_0x2bacd7,['id',_0x9562('0x51'),_0x9562('0x52'),'crudPermissions']);_0x1820f6['body']=_[_0x9562('0x50')](_0x1820f6[_0x9562('0x4f')],['id',_0x9562('0x51'),_0x9562('0x52')]);return db[_0x9562('0x53')][_0x9562('0x54')](function(_0x9cbfff){return db['UserProfile'][_0x9562('0x4e')](_[_0x9562('0x43')](_0x2bacd7,_0x1820f6[_0x9562('0x4f')]),{'include':_0x1820f6[_0x9562('0x37')][_0x9562('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x9cbfff})['then'](function(_0x314228){var _0x5170d3=_0x314228[_0x9562('0x55')]({'plain':!![]});return db[_0x9562('0x56')][_0x9562('0x57')]({'where':{'userProfileId':_0x1820f6[_0x9562('0x4d')]['id']},'raw':!![]})[_0x9562('0x2b')](function(_0x3119b8){if(_0x3119b8){return BPromise[_0x9562('0x58')](_0x3119b8,function(_0x4ea6a3){return new BPromise(function(_0x3a89b7,_0x1b5370){if(_0x4ea6a3[_0x9562('0x59')]===null||_0x4ea6a3[_0x9562('0x59')]===0x1)_0x3a89b7(null);return db[_0x9562('0x5a')][_0x9562('0x57')]({'where':{'sectionId':_0x4ea6a3['id']},'raw':!![]})['then'](function(_0x8504fc){var _0x624d6f=_[_0x9562('0x32')](_0x8504fc,function(_0x5210f0){return qs[_0x9562('0x50')](_0x5210f0,['id',_0x9562('0x51'),'updatedAt','sectionId']);});_0x3a89b7(_0x624d6f);})[_0x9562('0x4b')](function(_0x20727a){_0x1b5370(_0x20727a);});})[_0x9562('0x2b')](function(_0x27161f){var _0x3106f2=qs[_0x9562('0x50')](_0x4ea6a3,['id','createdAt',_0x9562('0x52')]);_0x3106f2[_0x9562('0x5b')]=_0x5170d3['id'];if(_0x27161f)_0x3106f2['Resources']=_0x27161f;return _0x3106f2;})[_0x9562('0x2b')](function(_0x34b09a){return db[_0x9562('0x56')][_0x9562('0x4e')](_0x34b09a,{'include':[{'model':db[_0x9562('0x5a')],'as':_0x9562('0x5c')}],'raw':!![],'transaction':_0x9cbfff});});})[_0x9562('0x2b')](function(){return _0x5170d3;});}});});});}})[_0x9562('0x2b')](respondWithResult(_0x559d6c,0xc9))[_0x9562('0x4b')](handleError(_0x559d6c,null));};exports[_0x9562('0x2a')]=function(_0x3f7886,_0xbc89f4){if(_0x3f7886[_0x9562('0x4f')]['id']){delete _0x3f7886['body']['id'];}return db[_0x9562('0x33')][_0x9562('0x5d')]({'where':{'id':_0x3f7886['params']['id']}})[_0x9562('0x2b')](handleEntityNotFound(_0xbc89f4,null))['then'](saveUpdates(_0x3f7886[_0x9562('0x4f')],null))['then'](respondWithResult(_0xbc89f4,null))['catch'](handleError(_0xbc89f4,null));};exports['destroy']=function(_0x1c1818,_0x42a94e){return db[_0x9562('0x33')][_0x9562('0x5d')]({'where':{'id':_0x1c1818[_0x9562('0x4d')]['id']}})[_0x9562('0x2b')](handleEntityNotFound(_0x42a94e,null))['then'](removeEntity(_0x42a94e,null))[_0x9562('0x4b')](handleError(_0x42a94e,null));};exports['describe']=function(_0x5a4a5e,_0x48680d){return db[_0x9562('0x33')][_0x9562('0x5e')]()['then'](respondWithResult(_0x48680d,null))[_0x9562('0x4b')](handleError(_0x48680d,null));};exports[_0x9562('0x5f')]=function(_0x28c83a,_0x1e8a13){var _0x213166=_0x28c83a[_0x9562('0x4f')];return db[_0x9562('0x33')][_0x9562('0x5d')]({'where':{'id':_0x28c83a[_0x9562('0x4d')]['id']}})[_0x9562('0x2b')](handleEntityNotFound(_0x1e8a13,null))['then'](function(_0x421de8){if(_0x421de8){return db[_0x9562('0x53')]['transaction'](function(_0x2e1d67){return db['UserProfileSection'][_0x9562('0x60')]({'where':{'userProfileId':_0x28c83a['params']['id'],'sectionId':_[_0x9562('0x32')](_0x213166,function(_0x19e596){return _0x19e596[_0x9562('0x61')];})},'transaction':_0x2e1d67})[_0x9562('0x2b')](function(){var _0x19d411=_[_0x9562('0x32')](_0x213166,function(_0x3e3354){_0x3e3354[_0x9562('0x5b')]=_0x28c83a[_0x9562('0x4d')]['id'];return _0x3e3354;});var _0xdf3a37=[];return BPromise['each'](_0x19d411,function(_0x4dca3d){return db[_0x9562('0x56')][_0x9562('0x4e')](_0x4dca3d,{'include':[{'model':db['UserProfileResource'],'as':_0x9562('0x5c')}],'raw':!![],'transaction':_0x2e1d67})[_0x9562('0x2b')](function(_0x16afdf){_0xdf3a37[_0x9562('0x62')](_0x16afdf[_0x9562('0x55')]({'plain':!![]}));});})[_0x9562('0x2b')](function(){return _0xdf3a37;});});});}})[_0x9562('0x2b')](function(_0x4b2212){return _0x4b2212;})['then'](respondWithResult(_0x1e8a13,null))[_0x9562('0x4b')](handleError(_0x1e8a13,null));};exports[_0x9562('0x63')]=function(_0x36934c,_0x2d6d3){var _0x3e12a4;return db[_0x9562('0x33')]['find']({'where':{'id':_0x36934c[_0x9562('0x4d')]['id']},'attributes':['id',_0x9562('0x30')]})[_0x9562('0x2b')](handleEntityNotFound(_0x2d6d3,null))[_0x9562('0x2b')](function(_0x39ca41){if(_0x39ca41){_0x3e12a4=_0x39ca41;return db[_0x9562('0x56')]['destroy']({'where':{'userProfileId':_0x36934c[_0x9562('0x4d')]['id'],'sectionId':_0x36934c[_0x9562('0x37')][_0x9562('0x64')]}});}})['then'](function(){return _0x3e12a4;})[_0x9562('0x2b')](respondWithStatusCode(_0x2d6d3,null))[_0x9562('0x4b')](handleError(_0x2d6d3,null));};exports[_0x9562('0x65')]=function(_0x57b3ac,_0x9b426f){var _0x414764=[];var _0x2c452e=[];return db['UserProfileSection'][_0x9562('0x57')]({'where':{'userProfileId':_0x57b3ac[_0x9562('0x4d')]['id']},'raw':!![]})[_0x9562('0x2b')](function(_0x4cedfb){_0x414764=_[_0x9562('0x42')](_0x4cedfb,function(_0x3539b7){return _0x3539b7[_0x9562('0x66')]===0x1||_[_0x9562('0x67')]([0x3eb,0x709],_0x3539b7['sectionId']);});if(!_['isEmpty'](_0x414764)){return _[_0x9562('0x32')](_0x414764,function(_0x5b39ae){return _0x5b39ae[_0x9562('0x61')];});}else{return;}})[_0x9562('0x2b')](function(_0x513106){if(_0x513106)_0x2c452e=_0x513106;if(_[_0x9562('0x67')](_0x2c452e,0x64)){var _0x35e030=_[_0x9562('0x5d')](_0x414764,{'sectionId':0x64});return hasDefaultDashboard(_0x35e030)['then'](function(_0x696c84){return _[_0x9562('0x32')](_0x414764,function(_0x363f90){if(_0x363f90['sectionId']===0x64){_0x363f90[_0x9562('0x68')]=_0x696c84;}return _0x363f90;});});}else{return;}})[_0x9562('0x2b')](function(_0x15b66c){if(_0x15b66c)_0x414764=_0x15b66c;if(_[_0x9562('0x67')](_0x2c452e,0x3eb)){var _0x17ba77=_[_0x9562('0x5d')](_0x414764,{'sectionId':0x3eb});return getCustomDashboards(_0x17ba77)['then'](function(_0x233239){return _['map'](_0x414764,function(_0x53d7a9){if(_0x17ba77[_0x9562('0x66')]){if(_0x53d7a9[_0x9562('0x61')]===0x3eb){_0x53d7a9[_0x9562('0x68')]=_0x233239;}}else{if(_0x53d7a9[_0x9562('0x61')]===0x64){if(!_0x53d7a9[_0x9562('0x68')]){_0x53d7a9[_0x9562('0x68')]=[];}_0x53d7a9['subsections']=_0x53d7a9[_0x9562('0x68')][_0x9562('0x69')](_0x233239);}}return _0x53d7a9;});});}else{return;}})[_0x9562('0x2b')](function(_0xf4084d){if(_0xf4084d)_0x414764=_0xf4084d;if(_[_0x9562('0x67')](_0x2c452e,0x709)){var _0x49e23f=_['find'](_0x414764,{'sectionId':0x709});return getPlugins(_0x49e23f)[_0x9562('0x2b')](function(_0x9467fc){if(_0x49e23f[_0x9562('0x66')]){return _[_0x9562('0x32')](_0x414764,function(_0x207c50){if(_0x207c50[_0x9562('0x61')]===0x709){_0x207c50[_0x9562('0x68')]=_0x9467fc;}return _0x207c50;});}else{var _0x214451={'sectionId':0x76c,'enabled':0x1,'subsections':_0x9467fc};var _0x255d17=_[_0x9562('0x32')](_0x414764);_0x255d17[_0x9562('0x62')](_0x214451);return _0x255d17;}});}else{return;}})[_0x9562('0x2b')](function(_0x5476b6){if(_0x5476b6)_0x414764=_0x5476b6;return _['filter'](_0x414764,[_0x9562('0x66'),0x1]);})[_0x9562('0x2b')](respondWithResult(_0x9b426f,null))[_0x9562('0x4b')](handleError(_0x9b426f,null));};function hasDefaultDashboard(_0x58af12){var _0x316291=[0x65];return new BPromise(function(_0x31bacd,_0x1868b6){try{if(_0x58af12[_0x9562('0x59')]){_0x31bacd(_0x316291);}else{return db[_0x9562('0x5a')][_0x9562('0x6a')]({'where':{'sectionId':_0x58af12['id']},'raw':!![]})[_0x9562('0x2b')](function(_0x5752f0){_0x5752f0?_0x31bacd(_0x316291):_0x31bacd();});}}catch(_0x41a977){_0x1868b6(_0x41a977);}});}function getCustomDashboards(_0x3ed45f){var _0x42527f=[];return new BPromise(function(_0x13a130,_0x3009d9){try{if(_0x3ed45f[_0x9562('0x59')]){return db[_0x9562('0x6b')][_0x9562('0x57')]({'raw':!![]})[_0x9562('0x2b')](function(_0x521835){_0x521835[_0x9562('0x6c')](function(_0x391fb2){_0x42527f['push'](_0x391fb2['id']+0x1869f);});_0x13a130(_0x42527f);});}else{return db[_0x9562('0x5a')][_0x9562('0x57')]({'where':{'sectionId':_0x3ed45f['id']},'raw':!![]})['then'](function(_0x4bc2d2){_0x4bc2d2[_0x9562('0x6c')](function(_0x313ee3){_0x42527f['push'](_0x313ee3['resourceId']+0x1869f);});_0x13a130(_0x42527f);});}}catch(_0x576636){_0x3009d9(_0x576636);}});}function getPlugins(_0x4a3bda){var _0x47695a=[];return new BPromise(function(_0x2717f6,_0x2c0f61){try{if(_0x4a3bda[_0x9562('0x59')]){return db[_0x9562('0x6d')][_0x9562('0x57')]({'raw':!![]})[_0x9562('0x2b')](function(_0x1685b4){_0x1685b4[_0x9562('0x6c')](function(_0x499221){_0x47695a[_0x9562('0x62')](_0x499221['id']+0x15b38);});_0x2717f6(_0x47695a);});}else{return db[_0x9562('0x5a')][_0x9562('0x57')]({'where':{'sectionId':_0x4a3bda['id']},'raw':!![]})[_0x9562('0x2b')](function(_0x7bde09){_0x7bde09[_0x9562('0x6c')](function(_0x524c3a){_0x47695a[_0x9562('0x62')](_0x524c3a[_0x9562('0x6e')]+0x15b38);});_0x2717f6(_0x47695a);});}}catch(_0x52dad4){_0x2c0f61(_0x52dad4);}});}exports[_0x9562('0x6f')]=function(_0x17ac45,_0x5ce2fa){return db['UserProfile']['find']({'where':{'id':_0x17ac45[_0x9562('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ce2fa,null))[_0x9562('0x2b')](function(_0x101f88){if(_0x101f88){return db[_0x9562('0x53')]['transaction'](function(_0x595759){return db[_0x9562('0x56')][_0x9562('0x57')]({'where':{'userProfileId':_0x17ac45[_0x9562('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x9562('0x2b')](function(_0x570066){if(_0x570066){return db['UserProfileSection'][_0x9562('0x60')]({'where':{'userProfileId':_0x17ac45['params']['id'],'id':_[_0x9562('0x32')](_0x570066,function(_0x41f068){return _0x41f068['id'];})},'transaction':_0x595759});}})['then'](function(_0x17977b){var _0x595528=_[_0x9562('0x32')](_0x17ac45['body'],function(_0x3910da){_0x3910da['userProfileId']=_0x17ac45[_0x9562('0x4d')]['id'];return _0x3910da;});return db['UserProfileSection'][_0x9562('0x70')](_0x595528,{'raw':!![],'transaction':_0x595759});})['then'](function(_0x4dabd0){var _0x2c0726=_[_0x9562('0x42')](_['map'](_0x4dabd0,function(_0x4f59b4){return _0x4f59b4[_0x9562('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x2c0726){return db[_0x9562('0x56')][_0x9562('0x57')]({'where':{'userProfileId':_0x17ac45[_0x9562('0x4d')]['id'],'sectionId':_['map'](_0x2c0726,function(_0xde5521){return _0xde5521[_0x9562('0x61')];})},'attributes':['id',_0x9562('0x61')],'raw':!![]})[_0x9562('0x2b')](function(_0x283d96){var _0x2a05df=_[_0x9562('0x32')](_0x17ac45[_0x9562('0x4f')],function(_0xebe4b8){_0xebe4b8[_0x9562('0x5b')]=_0x17ac45[_0x9562('0x4d')]['id'];return _0xebe4b8;});return db[_0x9562('0x5a')][_0x9562('0x70')](_0x2a05df,{'raw':!![],'transaction':_0x595759});});}})['catch'](handleError(_0x5ce2fa,null));});}})[_0x9562('0x2b')](function(_0x1e21c2){var _0xacb59a=_[_0x9562('0x32')](_0x1e21c2,function(_0x124007){return _0x124007[_0x9562('0x55')]({'plain':!![]});});})[_0x9562('0x2b')](respondWithResult(_0x5ce2fa,null))[_0x9562('0x4b')](handleError(_0x5ce2fa,null));};exports['removeResources']=function(_0x3104a1,_0x51b3b1,_0x2929ec){return db[_0x9562('0x33')][_0x9562('0x5d')]({'where':{'id':_0x3104a1[_0x9562('0x4d')]['id']}})[_0x9562('0x2b')](handleEntityNotFound(_0x51b3b1,null))[_0x9562('0x2b')](function(_0x448028){if(_0x448028){return _0x448028[_0x9562('0x71')](_0x3104a1[_0x9562('0x37')][_0x9562('0x64')]);}})[_0x9562('0x2b')](respondWithStatusCode(_0x51b3b1,null))['catch'](handleError(_0x51b3b1,null));};exports['getResources']=function(_0x2e006a,_0x38021e){var _0x1163bb={};if(!_0x2e006a[_0x9562('0x37')][_0x9562('0x72')])throw new Error('Missing\x20section\x20parameter');if(!_0x2e006a[_0x9562('0x37')][_0x9562('0x3e')](_0x9562('0x73'))){_0x1163bb[_0x9562('0x23')]=qs[_0x9562('0x23')](_0x2e006a[_0x9562('0x37')][_0x9562('0x23')]);_0x1163bb['offset']=qs['offset'](_0x2e006a[_0x9562('0x37')][_0x9562('0x21')]);}return db['UserProfile'][_0x9562('0x5d')]({'where':{'id':_0x2e006a[_0x9562('0x4d')]['id']}})[_0x9562('0x2b')](function(_0x1c60d4){if(!_0x1c60d4)throw new Error(_0x9562('0x74')+_0x2e006a['params']['id']);return db['UserProfile'][_0x9562('0x75')](_0x2e006a);})['then'](respondWithFilteredResult(_0x38021e,_0x1163bb))['catch'](handleError(_0x38021e,null));}; \ No newline at end of file +var _0x4bde=['zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','destroy','error','stack','name','send','map','UserProfile','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','VIRTUAL','merge','options','then','includeAll','findAll','rows','show','params','include','create','body','clone','keys','find','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','each','autoAssociation','sectionId','catch','userProfileId','Resources','UserProfileSection','UserProfileResource','update','describe','addSections','removeSections','getSections','enabled','subsections','includes','concat','push','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format'];(function(_0x213462,_0x135726){var _0x20d2b9=function(_0x585c06){while(--_0x585c06){_0x213462['push'](_0x213462['shift']());}};_0x20d2b9(++_0x135726);}(_0x4bde,0xe3));var _0xe4bd=function(_0x401744,_0x30a0be){_0x401744=_0x401744-0x0;var _0x20eb56=_0x4bde[_0x401744];return _0x20eb56;};'use strict';var emlformat=require(_0xe4bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe4bd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe4bd('0x3'));var util=require(_0xe4bd('0x4'));var path=require(_0xe4bd('0x5'));var sox=require(_0xe4bd('0x6'));var csv=require(_0xe4bd('0x7'));var ejs=require(_0xe4bd('0x8'));var fs=require('fs');var fs_extra=require(_0xe4bd('0x9'));var _=require(_0xe4bd('0xa'));var squel=require(_0xe4bd('0xb'));var crypto=require('crypto');var jsforce=require(_0xe4bd('0xc'));var deskjs=require(_0xe4bd('0xd'));var toCsv=require(_0xe4bd('0x7'));var querystring=require(_0xe4bd('0xe'));var Papa=require('papaparse');var Redis=require(_0xe4bd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe4bd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4bd('0x11'));var logger=require(_0xe4bd('0x12'))(_0xe4bd('0x13'));var utils=require('../../config/utils');var config=require(_0xe4bd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4bd('0x15'))['db'];config[_0xe4bd('0x16')]=_[_0xe4bd('0x17')](config[_0xe4bd('0x16')],{'host':_0xe4bd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4bd('0x16')]));require(_0xe4bd('0x19'))[_0xe4bd('0x1a')](socket);function respondWithStatusCode(_0x28f7f4,_0x2c5b16){_0x2c5b16=_0x2c5b16||0xcc;return function(_0x5cef7c){if(_0x5cef7c){return _0x28f7f4[_0xe4bd('0x1b')](_0x2c5b16);}return _0x28f7f4[_0xe4bd('0x1c')](_0x2c5b16)[_0xe4bd('0x1d')]();};}function respondWithResult(_0xdd2fdd,_0x14fd91){_0x14fd91=_0x14fd91||0xc8;return function(_0x3b8f0b){if(_0x3b8f0b){return _0xdd2fdd[_0xe4bd('0x1c')](_0x14fd91)[_0xe4bd('0x1e')](_0x3b8f0b);}};}function respondWithFilteredResult(_0x26954a,_0x47f682){return function(_0x360a4c){if(_0x360a4c){var _0x4c75b6=typeof _0x47f682['offset']==='undefined'&&typeof _0x47f682[_0xe4bd('0x1f')]===_0xe4bd('0x20');var _0x453502=_0x360a4c[_0xe4bd('0x21')];var _0xd8ac84=_0x4c75b6?0x0:_0x47f682['offset'];var _0x8b047=_0x4c75b6?_0x360a4c['count']:_0x47f682['offset']+_0x47f682[_0xe4bd('0x1f')];var _0xdb3b15;if(_0x8b047>=_0x453502){_0x8b047=_0x453502;_0xdb3b15=0xc8;}else{_0xdb3b15=0xce;}_0x26954a[_0xe4bd('0x1c')](_0xdb3b15);return _0x26954a[_0xe4bd('0x22')]('Content-Range',_0xd8ac84+'-'+_0x8b047+'/'+_0x453502)[_0xe4bd('0x1e')](_0x360a4c);}return null;};}function patchUpdates(_0x85413d){return function(_0x572706){try{jsonpatch[_0xe4bd('0x23')](_0x572706,_0x85413d,!![]);}catch(_0x2c5267){return BPromise[_0xe4bd('0x24')](_0x2c5267);}return _0x572706[_0xe4bd('0x25')]();};}function saveUpdates(_0x5b92b2,_0x11d1f8){return function(_0x2b9d39){if(_0x2b9d39){return _0x2b9d39['update'](_0x5b92b2)['then'](function(_0x3402dc){return _0x3402dc;});}return null;};}function removeEntity(_0xec5af7,_0x955264){return function(_0x182ed0){if(_0x182ed0){return _0x182ed0[_0xe4bd('0x26')]()['then'](function(){_0xec5af7[_0xe4bd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a707,_0xecd4e9){return function(_0x5e317a){if(!_0x5e317a){_0x42a707['sendStatus'](0x194);}return _0x5e317a;};}function handleError(_0x3a9804,_0x152f83){_0x152f83=_0x152f83||0x1f4;return function(_0x149cee){logger[_0xe4bd('0x27')](_0x149cee[_0xe4bd('0x28')]);if(_0x149cee[_0xe4bd('0x29')]){delete _0x149cee[_0xe4bd('0x29')];}_0x3a9804['status'](_0x152f83)[_0xe4bd('0x2a')](_0x149cee);};}exports['index']=function(_0x5455be,_0x55025c){var _0x1fff1a={},_0x17289a={},_0x5969d7={'count':0x0,'rows':[]};var _0x51dca2=_[_0xe4bd('0x2b')](db[_0xe4bd('0x2c')][_0xe4bd('0x2d')],function(_0x3a4a81){return{'name':_0x3a4a81['fieldName'],'type':_0x3a4a81['type'][_0xe4bd('0x2e')]};});_0x17289a[_0xe4bd('0x2f')]=_['map'](_0x51dca2,_0xe4bd('0x29'));_0x17289a[_0xe4bd('0x30')]=_['keys'](_0x5455be[_0xe4bd('0x30')]);_0x17289a[_0xe4bd('0x31')]=_[_0xe4bd('0x32')](_0x17289a[_0xe4bd('0x2f')],_0x17289a[_0xe4bd('0x30')]);_0x1fff1a[_0xe4bd('0x33')]=_[_0xe4bd('0x32')](_0x17289a[_0xe4bd('0x2f')],qs['fields'](_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x34')]));_0x1fff1a[_0xe4bd('0x33')]=_0x1fff1a['attributes'][_0xe4bd('0x35')]?_0x1fff1a[_0xe4bd('0x33')]:_0x17289a['model'];if(!_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x36')](_0xe4bd('0x37'))){_0x1fff1a[_0xe4bd('0x1f')]=qs[_0xe4bd('0x1f')](_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x1f')]);_0x1fff1a[_0xe4bd('0x38')]=qs[_0xe4bd('0x38')](_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x38')]);}_0x1fff1a[_0xe4bd('0x39')]=qs[_0xe4bd('0x3a')](_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x3a')]);_0x1fff1a[_0xe4bd('0x3b')]=qs[_0xe4bd('0x31')](_[_0xe4bd('0x3c')](_0x5455be[_0xe4bd('0x30')],_0x17289a[_0xe4bd('0x31')]),_0x51dca2);if(_0x5455be['query'][_0xe4bd('0x3d')]){_0x1fff1a[_0xe4bd('0x3b')]=_['merge'](_0x1fff1a[_0xe4bd('0x3b')],{'$or':_[_0xe4bd('0x2b')](_0x51dca2,function(_0x571de5){if(_0x571de5[_0xe4bd('0x3e')]!==_0xe4bd('0x3f')){var _0x2fb35d={};_0x2fb35d[_0x571de5[_0xe4bd('0x29')]]={'$like':'%'+_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x3d')]+'%'};return _0x2fb35d;}})});}_0x1fff1a=_[_0xe4bd('0x40')]({},_0x1fff1a,_0x5455be[_0xe4bd('0x41')]);var _0x8053e0={'where':_0x1fff1a['where']};return db['UserProfile'][_0xe4bd('0x21')](_0x8053e0)[_0xe4bd('0x42')](function(_0x53865d){_0x5969d7['count']=_0x53865d;if(_0x5455be['query'][_0xe4bd('0x43')]){_0x1fff1a['include']=[{'all':!![]}];}return db[_0xe4bd('0x2c')][_0xe4bd('0x44')](_0x1fff1a);})[_0xe4bd('0x42')](function(_0x2ac785){_0x5969d7[_0xe4bd('0x45')]=_0x2ac785;return _0x5969d7;})['then'](respondWithFilteredResult(_0x55025c,_0x1fff1a))['catch'](handleError(_0x55025c,null));};exports[_0xe4bd('0x46')]=function(_0x19195f,_0x414329){var _0x525fce={'raw':![],'where':{'id':_0x19195f[_0xe4bd('0x47')]['id']}},_0x166be2={};_0x166be2[_0xe4bd('0x2f')]=_['keys'](db[_0xe4bd('0x2c')][_0xe4bd('0x2d')]);_0x166be2['query']=_['keys'](_0x19195f[_0xe4bd('0x30')]);_0x166be2[_0xe4bd('0x31')]=_[_0xe4bd('0x32')](_0x166be2[_0xe4bd('0x2f')],_0x166be2['query']);_0x525fce[_0xe4bd('0x33')]=_[_0xe4bd('0x32')](_0x166be2['model'],qs[_0xe4bd('0x34')](_0x19195f[_0xe4bd('0x30')][_0xe4bd('0x34')]));_0x525fce[_0xe4bd('0x33')]=_0x525fce[_0xe4bd('0x33')][_0xe4bd('0x35')]?_0x525fce['attributes']:_0x166be2[_0xe4bd('0x2f')];if(_0x19195f[_0xe4bd('0x30')][_0xe4bd('0x43')]){_0x525fce[_0xe4bd('0x48')]=[{'all':!![]}];}_0x525fce=_['merge']({},_0x525fce,_0x19195f[_0xe4bd('0x41')]);return db[_0xe4bd('0x2c')]['find'](_0x525fce)[_0xe4bd('0x42')](handleEntityNotFound(_0x414329,null))[_0xe4bd('0x42')](respondWithResult(_0x414329,null))['catch'](handleError(_0x414329,null));};exports[_0xe4bd('0x49')]=function(_0x5ac475,_0x4a6ca2){return db['UserProfile'][_0xe4bd('0x49')](_0x5ac475[_0xe4bd('0x4a')],{})[_0xe4bd('0x42')](respondWithResult(_0x4a6ca2,0xc9))['catch'](handleError(_0x4a6ca2,null));};exports[_0xe4bd('0x4b')]=function(_0x1e4472,_0x455a1f){var _0x14ff73={'where':{'id':_0x1e4472[_0xe4bd('0x47')]['id']}},_0x188f44={};_0x188f44[_0xe4bd('0x2f')]=_[_0xe4bd('0x4c')](db[_0xe4bd('0x2c')]['rawAttributes']);_0x14ff73[_0xe4bd('0x33')]=_['intersection'](_0x188f44[_0xe4bd('0x2f')],qs[_0xe4bd('0x34')](_0x1e4472[_0xe4bd('0x30')][_0xe4bd('0x34')]));_0x14ff73[_0xe4bd('0x33')]=_0x14ff73[_0xe4bd('0x33')]['length']?_0x14ff73[_0xe4bd('0x33')]:_0x188f44[_0xe4bd('0x2f')];if(_0x1e4472[_0xe4bd('0x30')]['includeAll']){_0x14ff73[_0xe4bd('0x48')]=[{'all':!![]}];}_0x14ff73=_[_0xe4bd('0x40')]({},_0x14ff73,_0x1e4472[_0xe4bd('0x41')]);return db[_0xe4bd('0x2c')][_0xe4bd('0x4d')](_0x14ff73)[_0xe4bd('0x42')](handleEntityNotFound(_0x455a1f,null))['then'](function(_0x3f1618){if(_0x3f1618){var _0x412712=_0x3f1618[_0xe4bd('0x4e')]({'plain':!![]});_0x412712=qs[_0xe4bd('0x4f')](_0x412712,['id','createdAt',_0xe4bd('0x50'),_0xe4bd('0x51')]);_0x1e4472[_0xe4bd('0x4a')]=_[_0xe4bd('0x4f')](_0x1e4472[_0xe4bd('0x4a')],['id',_0xe4bd('0x52'),_0xe4bd('0x50')]);return db[_0xe4bd('0x53')][_0xe4bd('0x54')](function(_0x43a6c1){return db[_0xe4bd('0x2c')][_0xe4bd('0x49')](_[_0xe4bd('0x40')](_0x412712,_0x1e4472[_0xe4bd('0x4a')]),{'include':_0x1e4472[_0xe4bd('0x30')][_0xe4bd('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x43a6c1})[_0xe4bd('0x42')](function(_0xc832ee){var _0x471200=_0xc832ee[_0xe4bd('0x4e')]({'plain':!![]});return db['UserProfileSection'][_0xe4bd('0x44')]({'where':{'userProfileId':_0x1e4472[_0xe4bd('0x47')]['id']},'raw':!![]})['then'](function(_0x543652){if(_0x543652){return BPromise[_0xe4bd('0x55')](_0x543652,function(_0x973073){return new BPromise(function(_0x3c3ec5,_0x3296f9){if(_0x973073[_0xe4bd('0x56')]===null||_0x973073['autoAssociation']===0x1)_0x3c3ec5(null);return db['UserProfileResource'][_0xe4bd('0x44')]({'where':{'sectionId':_0x973073['id']},'raw':!![]})[_0xe4bd('0x42')](function(_0xa43a45){var _0x4bd7a2=_[_0xe4bd('0x2b')](_0xa43a45,function(_0x1caac8){return qs['omit'](_0x1caac8,['id',_0xe4bd('0x52'),'updatedAt',_0xe4bd('0x57')]);});_0x3c3ec5(_0x4bd7a2);})[_0xe4bd('0x58')](function(_0x58ac24){_0x3296f9(_0x58ac24);});})[_0xe4bd('0x42')](function(_0x1f31da){var _0x21aa6a=qs[_0xe4bd('0x4f')](_0x973073,['id',_0xe4bd('0x52'),_0xe4bd('0x50')]);_0x21aa6a[_0xe4bd('0x59')]=_0x471200['id'];if(_0x1f31da)_0x21aa6a[_0xe4bd('0x5a')]=_0x1f31da;return _0x21aa6a;})[_0xe4bd('0x42')](function(_0x4aad76){return db[_0xe4bd('0x5b')][_0xe4bd('0x49')](_0x4aad76,{'include':[{'model':db[_0xe4bd('0x5c')],'as':_0xe4bd('0x5a')}],'raw':!![],'transaction':_0x43a6c1});});})['then'](function(){return _0x471200;});}});});});}})[_0xe4bd('0x42')](respondWithResult(_0x455a1f,0xc9))[_0xe4bd('0x58')](handleError(_0x455a1f,null));};exports[_0xe4bd('0x5d')]=function(_0x3c08e6,_0x4f8b95){if(_0x3c08e6['body']['id']){delete _0x3c08e6[_0xe4bd('0x4a')]['id'];}return db['UserProfile'][_0xe4bd('0x4d')]({'where':{'id':_0x3c08e6[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](handleEntityNotFound(_0x4f8b95,null))[_0xe4bd('0x42')](saveUpdates(_0x3c08e6['body'],null))[_0xe4bd('0x42')](respondWithResult(_0x4f8b95,null))['catch'](handleError(_0x4f8b95,null));};exports['destroy']=function(_0x1baab0,_0x3718c5){return db[_0xe4bd('0x2c')][_0xe4bd('0x4d')]({'where':{'id':_0x1baab0[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](handleEntityNotFound(_0x3718c5,null))[_0xe4bd('0x42')](removeEntity(_0x3718c5,null))[_0xe4bd('0x58')](handleError(_0x3718c5,null));};exports[_0xe4bd('0x5e')]=function(_0x403200,_0x129c9e){return db[_0xe4bd('0x2c')]['describe']()[_0xe4bd('0x42')](respondWithResult(_0x129c9e,null))['catch'](handleError(_0x129c9e,null));};exports[_0xe4bd('0x5f')]=function(_0x56c8f8,_0x557526){var _0x94558f=_0x56c8f8[_0xe4bd('0x4a')];return db['UserProfile'][_0xe4bd('0x4d')]({'where':{'id':_0x56c8f8[_0xe4bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x557526,null))['then'](function(_0x17296f){if(_0x17296f){return db[_0xe4bd('0x53')][_0xe4bd('0x54')](function(_0x5576a9){return db[_0xe4bd('0x5b')][_0xe4bd('0x26')]({'where':{'userProfileId':_0x56c8f8['params']['id'],'sectionId':_['map'](_0x94558f,function(_0x3c30f3){return _0x3c30f3[_0xe4bd('0x57')];})},'transaction':_0x5576a9})['then'](function(){var _0x30b818=_[_0xe4bd('0x2b')](_0x94558f,function(_0x2880eb){_0x2880eb[_0xe4bd('0x59')]=_0x56c8f8[_0xe4bd('0x47')]['id'];return _0x2880eb;});var _0x433e90=[];return BPromise[_0xe4bd('0x55')](_0x30b818,function(_0x5dfcd0){return db['UserProfileSection'][_0xe4bd('0x49')](_0x5dfcd0,{'include':[{'model':db[_0xe4bd('0x5c')],'as':_0xe4bd('0x5a')}],'raw':!![],'transaction':_0x5576a9})[_0xe4bd('0x42')](function(_0x60e6dd){_0x433e90['push'](_0x60e6dd[_0xe4bd('0x4e')]({'plain':!![]}));});})['then'](function(){return _0x433e90;});});});}})[_0xe4bd('0x42')](function(_0x144e61){return _0x144e61;})[_0xe4bd('0x42')](respondWithResult(_0x557526,null))[_0xe4bd('0x58')](handleError(_0x557526,null));};exports[_0xe4bd('0x60')]=function(_0x591bf9,_0x3d6f70){var _0x31299e;return db[_0xe4bd('0x2c')][_0xe4bd('0x4d')]({'where':{'id':_0x591bf9[_0xe4bd('0x47')]['id']},'attributes':['id',_0xe4bd('0x29')]})[_0xe4bd('0x42')](handleEntityNotFound(_0x3d6f70,null))['then'](function(_0x2c6b79){if(_0x2c6b79){_0x31299e=_0x2c6b79;return db[_0xe4bd('0x5b')][_0xe4bd('0x26')]({'where':{'userProfileId':_0x591bf9[_0xe4bd('0x47')]['id'],'sectionId':_0x591bf9['query']['ids']}});}})[_0xe4bd('0x42')](function(){return _0x31299e;})['then'](respondWithStatusCode(_0x3d6f70,null))[_0xe4bd('0x58')](handleError(_0x3d6f70,null));};exports[_0xe4bd('0x61')]=function(_0x1897d1,_0x1bbed3){var _0x1637ad=[];var _0x47e8e8=[];return db[_0xe4bd('0x5b')][_0xe4bd('0x44')]({'where':{'userProfileId':_0x1897d1[_0xe4bd('0x47')]['id']},'raw':!![]})[_0xe4bd('0x42')](function(_0x608c87){_0x1637ad=_[_0xe4bd('0x3d')](_0x608c87,function(_0x4d2633){return _0x4d2633[_0xe4bd('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x4d2633[_0xe4bd('0x57')]);});if(!_['isEmpty'](_0x1637ad)){return _[_0xe4bd('0x2b')](_0x1637ad,function(_0x5a1750){return _0x5a1750[_0xe4bd('0x57')];});}else{return;}})[_0xe4bd('0x42')](function(_0x193650){if(_0x193650)_0x47e8e8=_0x193650;if(_['includes'](_0x47e8e8,0x64)){var _0x5635b5=_[_0xe4bd('0x4d')](_0x1637ad,{'sectionId':0x64});return hasDefaultDashboard(_0x5635b5)[_0xe4bd('0x42')](function(_0x573432){return _[_0xe4bd('0x2b')](_0x1637ad,function(_0x53e4ed){if(_0x53e4ed[_0xe4bd('0x57')]===0x64){_0x53e4ed[_0xe4bd('0x63')]=_0x573432;}return _0x53e4ed;});});}else{return;}})['then'](function(_0x46b471){if(_0x46b471)_0x1637ad=_0x46b471;if(_[_0xe4bd('0x64')](_0x47e8e8,0x3eb)){var _0x47408e=_['find'](_0x1637ad,{'sectionId':0x3eb});return getCustomDashboards(_0x47408e)[_0xe4bd('0x42')](function(_0x5393cd){return _[_0xe4bd('0x2b')](_0x1637ad,function(_0x4fb067){if(_0x47408e[_0xe4bd('0x62')]){if(_0x4fb067[_0xe4bd('0x57')]===0x3eb){_0x4fb067['subsections']=_0x5393cd;}}else{if(_0x4fb067['sectionId']===0x64){if(!_0x4fb067['subsections']){_0x4fb067[_0xe4bd('0x63')]=[];}_0x4fb067[_0xe4bd('0x63')]=_0x4fb067['subsections'][_0xe4bd('0x65')](_0x5393cd);}}return _0x4fb067;});});}else{return;}})[_0xe4bd('0x42')](function(_0x3608bb){if(_0x3608bb)_0x1637ad=_0x3608bb;if(_['includes'](_0x47e8e8,0x709)){var _0x1f0485=_[_0xe4bd('0x4d')](_0x1637ad,{'sectionId':0x709});return getPlugins(_0x1f0485)[_0xe4bd('0x42')](function(_0x49450d){if(_0x1f0485['enabled']){return _[_0xe4bd('0x2b')](_0x1637ad,function(_0x51275a){if(_0x51275a[_0xe4bd('0x57')]===0x709){_0x51275a[_0xe4bd('0x63')]=_0x49450d;}return _0x51275a;});}else{var _0xeaedfa={'sectionId':0x76c,'enabled':0x1,'subsections':_0x49450d};var _0x539241=_['map'](_0x1637ad);_0x539241[_0xe4bd('0x66')](_0xeaedfa);return _0x539241;}});}else{return;}})[_0xe4bd('0x42')](function(_0x236224){if(_0x236224)_0x1637ad=_0x236224;return _['filter'](_0x1637ad,[_0xe4bd('0x62'),0x1]);})[_0xe4bd('0x42')](respondWithResult(_0x1bbed3,null))['catch'](handleError(_0x1bbed3,null));};function hasDefaultDashboard(_0x241c38){var _0x5ce6fa=[0x65];return new BPromise(function(_0x2d4780,_0x431772){try{if(_0x241c38[_0xe4bd('0x56')]){_0x2d4780(_0x5ce6fa);}else{return db[_0xe4bd('0x5c')][_0xe4bd('0x67')]({'where':{'sectionId':_0x241c38['id']},'raw':!![]})['then'](function(_0x1983e9){_0x1983e9?_0x2d4780(_0x5ce6fa):_0x2d4780();});}}catch(_0x58283a){_0x431772(_0x58283a);}});}function getCustomDashboards(_0xcff8c){var _0x4c28df=[];return new BPromise(function(_0x57fa4f,_0x7ac04c){try{if(_0xcff8c[_0xe4bd('0x56')]){return db[_0xe4bd('0x68')]['findAll']({'raw':!![]})[_0xe4bd('0x42')](function(_0x59de48){_0x59de48[_0xe4bd('0x69')](function(_0xd92651){_0x4c28df['push'](_0xd92651['id']+0x1869f);});_0x57fa4f(_0x4c28df);});}else{return db[_0xe4bd('0x5c')][_0xe4bd('0x44')]({'where':{'sectionId':_0xcff8c['id']},'raw':!![]})['then'](function(_0x5b6b36){_0x5b6b36['forEach'](function(_0x450cf2){_0x4c28df['push'](_0x450cf2[_0xe4bd('0x6a')]+0x1869f);});_0x57fa4f(_0x4c28df);});}}catch(_0x2663ed){_0x7ac04c(_0x2663ed);}});}function getPlugins(_0x4b9ebb){var _0x113947=[];return new BPromise(function(_0x2c7700,_0x40a052){try{if(_0x4b9ebb[_0xe4bd('0x56')]){return db['Plugin'][_0xe4bd('0x44')]({'raw':!![]})[_0xe4bd('0x42')](function(_0x3b10b0){_0x3b10b0[_0xe4bd('0x69')](function(_0x3b03cb){_0x113947['push'](_0x3b03cb['id']+0x15b38);});_0x2c7700(_0x113947);});}else{return db[_0xe4bd('0x5c')][_0xe4bd('0x44')]({'where':{'sectionId':_0x4b9ebb['id']},'raw':!![]})[_0xe4bd('0x42')](function(_0xaa0db){_0xaa0db[_0xe4bd('0x69')](function(_0x5202ff){_0x113947['push'](_0x5202ff[_0xe4bd('0x6a')]+0x15b38);});_0x2c7700(_0x113947);});}}catch(_0x4b7f99){_0x40a052(_0x4b7f99);}});}exports[_0xe4bd('0x6b')]=function(_0x49a1aa,_0x1bcdb7){return db[_0xe4bd('0x2c')][_0xe4bd('0x4d')]({'where':{'id':_0x49a1aa[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](handleEntityNotFound(_0x1bcdb7,null))['then'](function(_0x49c3cf){if(_0x49c3cf){return db[_0xe4bd('0x53')]['transaction'](function(_0x140050){return db[_0xe4bd('0x5b')][_0xe4bd('0x44')]({'where':{'userProfileId':_0x49a1aa[_0xe4bd('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2d69c3){if(_0x2d69c3){return db[_0xe4bd('0x5b')][_0xe4bd('0x26')]({'where':{'userProfileId':_0x49a1aa[_0xe4bd('0x47')]['id'],'id':_[_0xe4bd('0x2b')](_0x2d69c3,function(_0x3e1749){return _0x3e1749['id'];})},'transaction':_0x140050});}})[_0xe4bd('0x42')](function(_0x15810c){var _0x35ac12=_[_0xe4bd('0x2b')](_0x49a1aa['body'],function(_0x4e35f5){_0x4e35f5[_0xe4bd('0x59')]=_0x49a1aa[_0xe4bd('0x47')]['id'];return _0x4e35f5;});return db[_0xe4bd('0x5b')]['bulkCreate'](_0x35ac12,{'raw':!![],'transaction':_0x140050});})[_0xe4bd('0x42')](function(_0x51b312){var _0x296cce=_[_0xe4bd('0x3d')](_['map'](_0x51b312,function(_0x5d41e6){return _0x5d41e6['get']({'plain':!![]});}),{'includeAll':![]});if(_0x296cce){return db['UserProfileSection'][_0xe4bd('0x44')]({'where':{'userProfileId':_0x49a1aa[_0xe4bd('0x47')]['id'],'sectionId':_[_0xe4bd('0x2b')](_0x296cce,function(_0x2080e5){return _0x2080e5[_0xe4bd('0x57')];})},'attributes':['id',_0xe4bd('0x57')],'raw':!![]})['then'](function(_0x263767){var _0x635c61=_[_0xe4bd('0x2b')](_0x49a1aa[_0xe4bd('0x4a')],function(_0x1d8cf3){_0x1d8cf3[_0xe4bd('0x59')]=_0x49a1aa[_0xe4bd('0x47')]['id'];return _0x1d8cf3;});return db[_0xe4bd('0x5c')][_0xe4bd('0x6c')](_0x635c61,{'raw':!![],'transaction':_0x140050});});}})[_0xe4bd('0x58')](handleError(_0x1bcdb7,null));});}})[_0xe4bd('0x42')](function(_0x2514be){var _0x174d22=_[_0xe4bd('0x2b')](_0x2514be,function(_0x2a816d){return _0x2a816d['get']({'plain':!![]});});})[_0xe4bd('0x42')](respondWithResult(_0x1bcdb7,null))[_0xe4bd('0x58')](handleError(_0x1bcdb7,null));};exports['removeResources']=function(_0x38ed05,_0xdd9ca1,_0x2588d0){return db['UserProfile'][_0xe4bd('0x4d')]({'where':{'id':_0x38ed05[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](handleEntityNotFound(_0xdd9ca1,null))[_0xe4bd('0x42')](function(_0x3e1ca6){if(_0x3e1ca6){return _0x3e1ca6[_0xe4bd('0x6d')](_0x38ed05[_0xe4bd('0x30')]['ids']);}})[_0xe4bd('0x42')](respondWithStatusCode(_0xdd9ca1,null))[_0xe4bd('0x58')](handleError(_0xdd9ca1,null));};exports['getResources']=function(_0x3e095c,_0xd87080){var _0x26155c={};if(!_0x3e095c['query'][_0xe4bd('0x6e')])throw new Error(_0xe4bd('0x6f'));if(!_0x3e095c[_0xe4bd('0x30')][_0xe4bd('0x36')](_0xe4bd('0x37'))){_0x26155c['limit']=qs[_0xe4bd('0x1f')](_0x3e095c[_0xe4bd('0x30')]['limit']);_0x26155c[_0xe4bd('0x38')]=qs['offset'](_0x3e095c[_0xe4bd('0x30')][_0xe4bd('0x38')]);}return db['UserProfile'][_0xe4bd('0x4d')]({'where':{'id':_0x3e095c[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](function(_0x16de5d){if(!_0x16de5d)throw new Error(_0xe4bd('0x70')+_0x3e095c['params']['id']);return db['UserProfile'][_0xe4bd('0x71')](_0x3e095c);})[_0xe4bd('0x42')](respondWithFilteredResult(_0xd87080,_0x26155c))['catch'](handleError(_0xd87080,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d4d0ff4..45b7d47 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 _0xa423=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x2ac9d5,_0x44ce87){var _0x51cb13=function(_0x26d2b4){while(--_0x26d2b4){_0x2ac9d5['push'](_0x2ac9d5['shift']());}};_0x51cb13(++_0x44ce87);}(_0xa423,0x16c));var _0x3a42=function(_0x5b33ad,_0x2a7d55){_0x5b33ad=_0x5b33ad-0x0;var _0x16ec00=_0xa423[_0x5b33ad];return _0x16ec00;};'use strict';var EventEmitter=require(_0x3a42('0x0'));var UserProfile=require(_0x3a42('0x1'))['db'][_0x3a42('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3a42('0x3')](0x0);var events={'afterCreate':_0x3a42('0x4'),'afterUpdate':'update','afterDestroy':_0x3a42('0x5')};function emitEvent(_0x857de4){return function(_0x5c4f6a,_0xc6780b,_0x33f87e){UserProfileEvents[_0x3a42('0x6')](_0x857de4+':'+_0x5c4f6a['id'],_0x5c4f6a);UserProfileEvents[_0x3a42('0x6')](_0x857de4,_0x5c4f6a);_0x33f87e(null);};}for(var e in events){if(events[_0x3a42('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3a42('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x323f=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x5752a0,_0x2b0f7b){var _0x214a1e=function(_0x2fb1b9){while(--_0x2fb1b9){_0x5752a0['push'](_0x5752a0['shift']());}};_0x214a1e(++_0x2b0f7b);}(_0x323f,0x1ee));var _0xf323=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x323f[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf323('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf323('0x1')](0x0);var events={'afterCreate':_0xf323('0x2'),'afterUpdate':_0xf323('0x3'),'afterDestroy':_0xf323('0x4')};function emitEvent(_0x111042){return function(_0x2c9d35,_0xb4caa8,_0x2d4750){UserProfileEvents[_0xf323('0x5')](_0x111042+':'+_0x2c9d35['id'],_0x2c9d35);UserProfileEvents[_0xf323('0x5')](_0x111042,_0x2c9d35);_0x2d4750(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xf323('0x6')](e,emitEvent(event));}}module[_0xf323('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e587eb8..1175788 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 _0x9a45=['CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicerecordings','VoiceRecording','Agents','name','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','QueueCampaigns','outbound','musiconholds','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','VoiceQueue','parentSections','agents','telephones','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','sounds','Sound','Tag','templates','triggers','trunks','variables','Variable','plugins','Plugin','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','define','UserProfile','../../components/parsers/qs','query','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','default','DefaultReports','count','ids','customSorting','extraQueryConditions','include','Tags','color','tag','ThroughTags','rows','openTabs','true','dataValues','sms','fax','mail','whatsapp','./userProfile.attributes','squel','models','filter','findAll','then','associatedResources','catch','field','value','UserProfileResource','map','AnalyticExtractedReport','type','resourceId','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields'];(function(_0x59e875,_0x4219d2){var _0x1dcddd=function(_0x476594){while(--_0x476594){_0x59e875['push'](_0x59e875['shift']());}};_0x1dcddd(++_0x4219d2);}(_0x9a45,0x9f));var _0x59a4=function(_0x1146a8,_0x29edaf){_0x1146a8=_0x1146a8-0x0;var _0x359657=_0x9a45[_0x1146a8];return _0x359657;};'use strict';var _=require('lodash');var attributes=require(_0x59a4('0x0'));var squel=require(_0x59a4('0x1'));module['exports']=function(_0x3d30c8){var _0x139318=_0x3d30c8[_0x59a4('0x2')];function _0x12d644(_0x342f67,_0x1ac8f1){return new Promise(function(_0x1eb79c,_0x3a62f8){if(!_0x1ac8f1)return _0x1eb79c(null);var _0x3f09da=_0x1ac8f1[_0x59a4('0x3')]?{[_0x1ac8f1[_0x59a4('0x3')]['field']]:_0x1ac8f1['filter']['value']}:undefined;return _0x139318[_0x342f67][_0x59a4('0x4')]({'where':_0x3f09da,'raw':!![]})[_0x59a4('0x5')](function(_0x4e4f99){_0x1ac8f1[_0x59a4('0x6')]=_['map'](_0x4e4f99,'id');_0x1eb79c(_0x1ac8f1);})[_0x59a4('0x7')](function(_0x49519f){_0x3a62f8(_0x49519f);});});}function _0x20fa32(_0x1144da,_0x1f93f0){return new Promise(function(_0x411f61,_0x400d12){var _0x51d5bc=_0x1144da[_0x59a4('0x3')]?{[_0x1144da[_0x59a4('0x3')][_0x59a4('0x8')]]:_0x1144da[_0x59a4('0x3')][_0x59a4('0x9')]}:undefined;return _0x139318[_0x1144da['model']][_0x59a4('0x4')]({'where':_0x51d5bc,'raw':!![]})[_0x59a4('0x5')](function(_0x46c80d){_0x1f93f0[_0x59a4('0x6')]=_['map'](_0x46c80d,function(_0x251d4a){return _0x251d4a['name'];});_0x411f61(_0x1f93f0);})[_0x59a4('0x7')](function(_0x15ea88){_0x400d12(_0x15ea88);});});}function _0x439468(_0x1222b6,_0x4f298f,_0x5bc45a){if(!_0x4f298f)return Promise['resolve'](null);return new Promise(function(_0x3cb093,_0x2bb315){return _0x139318[_0x59a4('0xa')][_0x59a4('0x4')]({'where':{'sectionId':_0x4f298f['id']},'raw':!![]})[_0x59a4('0x5')](function(_0x3c447c){if(_0x1222b6[_0x59a4('0x8')]&&_0x1222b6[_0x59a4('0x8')]!=='id'){_0x4f298f[_0x59a4('0x6')]=_[_0x59a4('0xb')](_0x3c447c,function(_0x533057){return _0x533057[_0x1222b6[_0x59a4('0x8')]];});}else{if(_0x5bc45a===_0x59a4('0xc')){_0x4f298f[_0x59a4('0x6')]=_[_0x59a4('0xb')](_0x3c447c,function(_0xc86cb2){return{'id':_0xc86cb2['resourceId'],'type':_0xc86cb2[_0x59a4('0xd')]};});}else{_0x4f298f['associatedResources']=_['map'](_0x3c447c,function(_0x4e137f){return _0x4e137f[_0x59a4('0xe')];});}}_0x3cb093(_0x4f298f);})['catch'](function(_0x2e9100){_0x2bb315(_0x2e9100);});});}function _0x356885(_0x53a36d,_0x3e4d58){var _0x2fd322={'parentSections':[]};switch(_0x53a36d['toLowerCase']()){case'squareprojects':_0x2fd322['childModel']=_0x59a4('0xf');break;case _0x59a4('0x10'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x12');break;case _0x59a4('0x13'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x14');_0x2fd322['parentSections']=[{'name':_0x59a4('0x15'),'field':'name','foreignKey':_0x59a4('0x16')}];break;case _0x59a4('0x17'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x18');break;case _0x59a4('0x19'):_0x2fd322['childModel']=_0x59a4('0x1a');_0x2fd322['parentSections']=[{'name':_0x59a4('0x1b'),'field':'id','foreignKey':_0x59a4('0x1c')}];break;case _0x59a4('0x1d'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x1e');break;case'companies':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x1f');break;case _0x59a4('0x20'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x21');break;case _0x59a4('0x22'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x23');break;case _0x59a4('0x24'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x25');break;case _0x59a4('0x26'):_0x2fd322['childModel']=_0x59a4('0x27');break;case _0x59a4('0x28'):_0x2fd322['childModel']=_0x59a4('0x29');break;case'inboundroutes':case _0x59a4('0x2a'):case _0x59a4('0x2b'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x2c');break;case'contexts':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x2d');break;case'voicemails':_0x2fd322['childModel']='VoiceMail';break;case _0x59a4('0x2e'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x2f');_0x2fd322['parentSections']=[{'name':_0x59a4('0x30'),'field':_0x59a4('0x31'),'foreignKey':'membername','model':_0x59a4('0x32'),'filter':{'field':_0x59a4('0x33'),'value':[_0x59a4('0x34')]}},{'name':_0x59a4('0x35'),'field':'name','foreignKey':_0x59a4('0x36'),'model':_0x59a4('0x32'),'filter':{'field':_0x59a4('0x33'),'value':[_0x59a4('0x37')]}},{'name':_0x59a4('0x38'),'field':_0x59a4('0x31'),'foreignKey':_0x59a4('0x39'),'model':'VoiceQueue','filter':{'field':_0x59a4('0xd'),'value':['inbound']}},{'name':_0x59a4('0x3a'),'field':_0x59a4('0x31'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0x59a4('0x3b')]}}];break;case _0x59a4('0x3c'):_0x2fd322[_0x59a4('0x11')]='VoiceMusicOnHold';break;case'chanspies':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x3d');break;case _0x59a4('0x3e'):_0x2fd322[_0x59a4('0x11')]='VoicePrefix';break;case _0x59a4('0x3f'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x40');break;case _0x59a4('0x41'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x42');break;case _0x59a4('0x43'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x44');break;case _0x59a4('0x45'):_0x2fd322[_0x59a4('0x11')]='MailSubstatus';break;case _0x59a4('0x46'):_0x2fd322['childModel']=_0x59a4('0x47');break;case _0x59a4('0x48'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x49');break;case'smsqueues':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x4a');break;case _0x59a4('0x4b'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x4c');break;case _0x59a4('0x4d'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x4e');break;case _0x59a4('0x4f'):_0x2fd322[_0x59a4('0x11')]='WhatsappAccount';break;case _0x59a4('0x50'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x51');break;case'voicequeues':case'queuecampaigns':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x52');if(_0x3e4d58){_0x2fd322[_0x59a4('0x53')]=[{'name':_0x59a4('0x38')},{'name':_0x59a4('0x3a')}];}break;case'users':case _0x59a4('0x54'):case _0x59a4('0x55'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x32');if(_0x3e4d58){_0x2fd322[_0x59a4('0x53')]=[{'name':'Users','filter':{'field':_0x59a4('0x33'),'value':[_0x59a4('0x56'),_0x59a4('0x57')]},'ignore':!![]},{'name':_0x59a4('0x30')},{'name':_0x59a4('0x35')}];}break;case _0x59a4('0x58'):_0x2fd322[_0x59a4('0x11')]='ZendeskAccount';break;case _0x59a4('0x59'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x5a');break;case _0x59a4('0x5b'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x5c');break;case _0x59a4('0x5d'):_0x2fd322['childModel']=_0x59a4('0x5e');break;case'deskaccounts':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x5f');break;case _0x59a4('0x60'):_0x2fd322['childModel']=_0x59a4('0x61');break;case _0x59a4('0x62'):_0x2fd322['childModel']=_0x59a4('0x32');break;case'cannedanswers':_0x2fd322['childModel']=_0x59a4('0x63');break;case _0x59a4('0x64'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x65');break;case _0x59a4('0x66'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x67');break;case _0x59a4('0x68'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x69');break;case'pauses':_0x2fd322['childModel']=_0x59a4('0x6a');break;case _0x59a4('0x6b'):_0x2fd322[_0x59a4('0x11')]='Schedule';break;case _0x59a4('0x6c'):_0x2fd322['childModel']=_0x59a4('0x6d');break;case'tags':_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x6e');break;case _0x59a4('0x6f'):_0x2fd322[_0x59a4('0x11')]='Template';break;case _0x59a4('0x70'):_0x2fd322['childModel']='Trigger';break;case _0x59a4('0x71'):_0x2fd322[_0x59a4('0x11')]='Trunk';break;case _0x59a4('0x72'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x73');break;case _0x59a4('0x74'):_0x2fd322[_0x59a4('0x11')]=_0x59a4('0x75');break;case'extractedreports':_0x2fd322['childModel']=_0x59a4('0xc');_0x2fd322['parentSections']=[{'name':_0x59a4('0x76'),'field':'id','foreignKey':_0x59a4('0x77')}];break;case _0x59a4('0x78'):_0x2fd322['childModel']='AnalyticMetric';break;}return _0x2fd322;}function _0x5c5e7a(_0x36103b,_0x303645){var _0x2b5bd2=_0x36103b[_0x59a4('0x79')](0x0)[_0x59a4('0x7a')]()+_0x36103b[_0x59a4('0x7b')](0x1);var _0x434c7d={'type':_0x139318[_0x59a4('0x7c')][_0x59a4('0x7d')][_0x59a4('0x7e')],'raw':!![]};return new Promise(function(_0x42c097,_0x53a239){var _0x4d8b0b=squel['select']()[_0x59a4('0x8')](_0x59a4('0x7f')+_0x2b5bd2+_0x59a4('0x80'),'id')[_0x59a4('0x8')](_0x59a4('0x81'))[_0x59a4('0x82')]('user_has_'+_0x36103b+_0x59a4('0x83'),'ui')[_0x59a4('0x84')](_0x59a4('0x85'),_0x303645['id']);return _0x139318[_0x59a4('0x86')]['query'](_0x4d8b0b['toString'](),_0x434c7d)[_0x59a4('0x5')](function(_0x16b889){_0x303645[_0x2b5bd2+'OpenTabs']=_0x16b889;_0x42c097(_0x16b889);})[_0x59a4('0x7')](function(_0x5474b7){_0x53a239(_0x5474b7);});});}return _0x3d30c8[_0x59a4('0x87')](_0x59a4('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x36eee8){var _0x2377b3=require(_0x59a4('0x89'));var _0x1550cf={'raw':_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x8b')],'where':{}};var _0xd1fa6d={};var _0x347a31={'count':0x0,'rows':[]};var _0x2f9592=_0x36eee8[_0x59a4('0x8a')]['section'];var _0x4b2882=_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x8c')]||![];var _0x496cea=_0x356885(_0x2f9592,_0x4b2882);if(!_0x496cea[_0x59a4('0x11')])throw new Error(_0x59a4('0x8d')+_0x2f9592+'\x27');var _0x524a30=[{'name':_0x2f9592}];if(!_[_0x59a4('0x8e')](_0x496cea[_0x59a4('0x53')]))_0x524a30=_0x496cea['parentSections'];var _0x466a32=[];for(var _0x1b9d51=0x0;_0x1b9d51<_0x524a30[_0x59a4('0x8f')];_0x1b9d51++){_0x466a32[_0x59a4('0x90')](_0x139318[_0x59a4('0x91')][_0x59a4('0x92')]({'where':{'userProfileId':_0x36eee8[_0x59a4('0x93')]['id'],'name':_0x524a30[_0x1b9d51][_0x59a4('0x31')]},'raw':!![]}));}return Promise[_0x59a4('0x94')](_0x466a32)[_0x59a4('0x5')](function(_0x36447f){var _0x333346=_[_0x59a4('0x3')](_0x36447f,function(_0x18f3af){return _0x18f3af?_0x18f3af:undefined;});var _0x2b9d59=_[_0x59a4('0x3')](_0x524a30,[_0x59a4('0x95'),!![]]);var _0x581fe2=_['isEmpty'](_0x333346)&&_[_0x59a4('0x8e')](_0x2b9d59)?null:_[_0x59a4('0x96')](_0x2b9d59,_0x333346);if(!_0x581fe2)return null;var _0x379783=[];for(var _0x4037f6=0x0;_0x4037f6<_0x581fe2['length'];_0x4037f6++){var _0x4c21da=_[_0x59a4('0x92')](_0x524a30,function(_0x5819a4){return _0x581fe2[_0x4037f6]?_0x5819a4[_0x59a4('0x31')]===_0x581fe2[_0x4037f6][_0x59a4('0x31')]:null;});if(_0x4c21da){if(_0x581fe2[_0x4037f6][_0x59a4('0x95')]){_0x379783[_0x59a4('0x90')](_0x12d644(_0x496cea['childModel'],_0x581fe2[_0x4037f6]));}else{if(!_0x581fe2[_0x4037f6][_0x59a4('0x97')]){_0x379783[_0x59a4('0x90')](_0x439468(_0x4c21da,_0x581fe2[_0x4037f6],_0x496cea[_0x59a4('0x11')]));}else{if(_0x4c21da[_0x59a4('0x98')]){_0x379783[_0x59a4('0x90')](_0x20fa32(_0x4c21da,_0x581fe2[_0x4037f6]));}}}}}return Promise[_0x59a4('0x94')](_0x379783);})[_0x59a4('0x5')](function(_0x3ad0fe){var _0x337d1e=_0x3ad0fe;var _0x1152dc=null;if(_0x337d1e){_0x1152dc=_0x337d1e[_0x59a4('0x8f')]===0x1?_0x337d1e[0x0]:null;}if(!_0x1152dc&&!_0x337d1e)return _0x347a31;var _0x2ef4ff=_0x139318[_0x496cea[_0x59a4('0x11')]][_0x59a4('0x99')];_0xd1fa6d[_0x59a4('0x98')]=_['keys'](_0x2ef4ff);_0xd1fa6d[_0x59a4('0x8a')]=_[_0x59a4('0x9a')](_0x36eee8[_0x59a4('0x8a')]);_0xd1fa6d[_0x59a4('0x9b')]=_[_0x59a4('0x9c')](_0xd1fa6d[_0x59a4('0x98')],_0xd1fa6d[_0x59a4('0x8a')]);_0x1550cf[_0x59a4('0x9d')]=_[_0x59a4('0x9c')](_0xd1fa6d[_0x59a4('0x98')],_0x2377b3[_0x59a4('0x9e')](_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x9e')]));_0x1550cf[_0x59a4('0x9d')]=_0x1550cf[_0x59a4('0x9d')][_0x59a4('0x8f')]?_0x1550cf[_0x59a4('0x9d')]:_0xd1fa6d['model'];if(!_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x9f')](_0x59a4('0xa0'))){_0x1550cf[_0x59a4('0xa1')]=_0x2377b3[_0x59a4('0xa1')](_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xa1')]);_0x1550cf[_0x59a4('0xa2')]=_0x2377b3['offset'](_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xa2')]);}_0x1550cf[_0x59a4('0xa3')]=_0x2377b3['sort'](_0x36eee8['query'][_0x59a4('0xa4')]);_0x1550cf[_0x59a4('0x84')]=_0x2377b3[_0x59a4('0x9b')](_['pick'](_0x36eee8['query'],_0xd1fa6d[_0x59a4('0x9b')]));if(_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x3')]){_0x1550cf[_0x59a4('0x84')]=_['merge'](_0x1550cf['where'],{'$or':_[_0x59a4('0xb')](_0x2ef4ff,function(_0x5606f8){if(_0x5606f8[_0x59a4('0xd')][_0x59a4('0xa5')]!==_0x59a4('0xa6')){var _0x45df24={};_0x45df24[_0x5606f8['field']]={'$like':'%'+_0x36eee8[_0x59a4('0x8a')][_0x59a4('0x3')]+'%'};return _0x45df24;}})});}var _0x41b1e7=[];var _0x289248=null;var _0x52eba3={};if(_0x1152dc){_0x289248=_[_0x59a4('0x92')](_0x524a30,[_0x59a4('0x31'),_0x1152dc[_0x59a4('0x31')]]);if(_0x289248[_0x59a4('0x8')]){_0x52eba3={};if(_0x496cea[_0x59a4('0x11')]===_0x59a4('0xc')){_0x52eba3[_0x289248['foreignKey']]=_[_0x59a4('0xb')](_0x1152dc[_0x59a4('0x6')],'id');}else{_0x52eba3[_0x289248['foreignKey']]=_0x1152dc[_0x59a4('0x6')];}_0x41b1e7[_0x59a4('0x90')](_0x52eba3);}else{_0x1550cf[_0x59a4('0x84')]['id']=_0x1152dc[_0x59a4('0x6')];}}else{for(var _0x2b19d5=0x0;_0x2b19d5<_0x337d1e[_0x59a4('0x8f')];_0x2b19d5++){_0x289248=_[_0x59a4('0x92')](_0x524a30,[_0x59a4('0x31'),_0x337d1e[_0x2b19d5]['name']]);if(_0x289248[_0x59a4('0x8')]){_0x52eba3={};_0x52eba3[_0x289248[_0x59a4('0xa7')]]=_0x337d1e[_0x2b19d5][_0x59a4('0x6')];_0x41b1e7[_0x59a4('0x90')](_0x52eba3);}else{if(!_0x1550cf['where']['id'])_0x1550cf[_0x59a4('0x84')]['id']=[];_0x337d1e[_0x2b19d5]['associatedResources'][_0x59a4('0xa8')](function(_0x4a5c53){_0x1550cf[_0x59a4('0x84')]['id'][_0x59a4('0x90')](_0x4a5c53);});}}}if(!_[_0x59a4('0x8e')](_0x41b1e7)){_0x1550cf[_0x59a4('0x84')]=_[_0x59a4('0xa9')](_0x1550cf[_0x59a4('0x84')],{'$and':{'$or':_0x41b1e7}});}_0x1550cf=_[_0x59a4('0xa9')]({},_0x1550cf,_0x36eee8[_0x59a4('0xaa')]);if(_0x1152dc&&!_0x1152dc['autoAssociation']&&_0x496cea[_0x59a4('0x11')]===_0x59a4('0xc')){if(_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xab')]){_0x1550cf['include']=[{'all':!![]}];}return _0x139318[_0x496cea[_0x59a4('0x11')]][_0x59a4('0x4')](_0x1550cf)[_0x59a4('0x5')](function(_0x2952c0){var _0x35f071=[];_0x2952c0[_0x59a4('0xa8')](function(_0x455890){var _0x25060b;switch(_0x455890[_0x59a4('0xac')]){case _0x59a4('0xad'):_0x25060b=_[_0x59a4('0x92')](_0x1152dc['associatedResources'],function(_0x2fec9c){return _0x2fec9c['id']===_0x455890['reportId']&&_0x2fec9c[_0x59a4('0xd')]===_0x59a4('0xae');});break;case'custom':_0x25060b=_[_0x59a4('0x92')](_0x1152dc[_0x59a4('0x6')],function(_0x380fc5){return _0x380fc5['id']===_0x455890['reportId']&&_0x380fc5[_0x59a4('0xd')]==='CustomReports';});break;}if(_0x25060b)_0x35f071[_0x59a4('0x90')](_0x455890);});_0x347a31[_0x59a4('0xaf')]=_0x35f071[_0x59a4('0x8f')];_0x347a31['rows']=_0x35f071;return _0x347a31;});}else{if(!_['isEmpty'](_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb0')])){_0x1550cf['where']['id']=_0x1550cf[_0x59a4('0x84')]['id']?_[_0x59a4('0x9c')](_0x1550cf[_0x59a4('0x84')]['id'],_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb0')]):_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb0')];if(_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb1')]){_0x1550cf[_0x59a4('0xa3')]=_0x36eee8[_0x59a4('0x8a')]['customSorting'];}}if(_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb2')]){_0x1550cf['where']=_[_0x59a4('0xa9')](_0x1550cf[_0x59a4('0x84')],{'$and':_0x36eee8[_0x59a4('0x8a')]['extraQueryConditions']});}return _0x139318[_0x496cea[_0x59a4('0x11')]][_0x59a4('0xaf')]({'where':_0x1550cf[_0x59a4('0x84')]})[_0x59a4('0x5')](function(_0x43f477){_0x347a31[_0x59a4('0xaf')]=_0x43f477;if(_0x36eee8['query'][_0x59a4('0xab')]){if(_0x496cea[_0x59a4('0x11')]===_0x59a4('0x1a')){_0x1550cf[_0x59a4('0xb3')]=[{'model':_0x139318['Tag'],'as':_0x59a4('0xb4'),'attributes':['id','name',_0x59a4('0xb5')],'required':_0x36eee8['query'][_0x59a4('0xb6')]?!![]:![]},{'model':_0x139318[_0x59a4('0x6e')],'as':_0x59a4('0xb7'),'attributes':['id',_0x59a4('0x31'),_0x59a4('0xb5')],'through':_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb6')]?{'attributes':[],'where':{'TagId':_0x36eee8['query'][_0x59a4('0xb6')]||undefined}}:{},'required':_0x36eee8[_0x59a4('0x8a')]['tag']?!![]:![]}];}else{_0x1550cf[_0x59a4('0xb3')]=[{'all':!![]}];}}return _0x139318[_0x496cea[_0x59a4('0x11')]]['findAll'](_0x1550cf);})[_0x59a4('0x5')](function(_0x52beba){_0x347a31[_0x59a4('0xb8')]=_0x52beba;if(_0x2f9592===_0x59a4('0x30')&&_0x36eee8[_0x59a4('0x8a')][_0x59a4('0xb9')]===_0x59a4('0xba')){var _0x496ef0=[];for(var _0x1e3325=0x0;_0x1e3325<_0x347a31['rows'][_0x59a4('0x8f')];_0x1e3325++){_0x496ef0[_0x59a4('0x90')](_0x5c5e7a('chat',_0x347a31[_0x59a4('0xb8')][_0x1e3325][_0x59a4('0xbb')]));_0x496ef0[_0x59a4('0x90')](_0x5c5e7a(_0x59a4('0xbc'),_0x347a31['rows'][_0x1e3325][_0x59a4('0xbb')]));_0x496ef0[_0x59a4('0x90')](_0x5c5e7a(_0x59a4('0xbd'),_0x347a31['rows'][_0x1e3325]['dataValues']));_0x496ef0['push'](_0x5c5e7a(_0x59a4('0xbe'),_0x347a31[_0x59a4('0xb8')][_0x1e3325][_0x59a4('0xbb')]));_0x496ef0[_0x59a4('0x90')](_0x5c5e7a('openchannel',_0x347a31[_0x59a4('0xb8')][_0x1e3325][_0x59a4('0xbb')]));_0x496ef0['push'](_0x5c5e7a(_0x59a4('0xbf'),_0x347a31[_0x59a4('0xb8')][_0x1e3325][_0x59a4('0xbb')]));}return Promise['all'](_0x496ef0)[_0x59a4('0x5')](function(){return _0x347a31;});}return _0x347a31;});}});}}});}; \ No newline at end of file +var _0x5052=['options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','extraQueryConditions','CmContact','Tags','color','tag','openTabs','true','dataValues','mail','openchannel','whatsapp','./userProfile.attributes','squel','models','filter','field','value','associatedResources','catch','model','findAll','then','map','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareRecording','parentSections','projectName','projects','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','queue','VoiceQueue','inbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','VoiceQueues','QueueCampaigns','users','Users','admin','user','zendeskaccounts','salesforceaccounts','sugarcrmaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.createdAt','_interactions','where','sequelize','query','toString','OpenTabs','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','find','params','ignore','isEmpty','union','all','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x5052,0x187));var _0x2505=function(_0x3a7258,_0x4f9d4f){_0x3a7258=_0x3a7258-0x0;var _0x2f6012=_0x5052[_0x3a7258];return _0x2f6012;};'use strict';var _=require('lodash');var attributes=require(_0x2505('0x0'));var squel=require(_0x2505('0x1'));module['exports']=function(_0x13d416){var _0x1a0fc4=_0x13d416[_0x2505('0x2')];function _0x376069(_0x20ff6c,_0x229a33){return new Promise(function(_0x2bff57,_0xd740cb){if(!_0x229a33)return _0x2bff57(null);var _0x5d2b6b=_0x229a33[_0x2505('0x3')]?{[_0x229a33['filter'][_0x2505('0x4')]]:_0x229a33['filter'][_0x2505('0x5')]}:undefined;return _0x1a0fc4[_0x20ff6c]['findAll']({'where':_0x5d2b6b,'raw':!![]})['then'](function(_0x434b3a){_0x229a33[_0x2505('0x6')]=_['map'](_0x434b3a,'id');_0x2bff57(_0x229a33);})[_0x2505('0x7')](function(_0xac6d8e){_0xd740cb(_0xac6d8e);});});}function _0x4c3ca2(_0x39c1a3,_0x35cfdc){return new Promise(function(_0x3fa29c,_0x18d496){var _0x87572a=_0x39c1a3[_0x2505('0x3')]?{[_0x39c1a3['filter'][_0x2505('0x4')]]:_0x39c1a3[_0x2505('0x3')][_0x2505('0x5')]}:undefined;return _0x1a0fc4[_0x39c1a3[_0x2505('0x8')]][_0x2505('0x9')]({'where':_0x87572a,'raw':!![]})[_0x2505('0xa')](function(_0x2be9af){_0x35cfdc[_0x2505('0x6')]=_[_0x2505('0xb')](_0x2be9af,function(_0x44e79d){return _0x44e79d[_0x2505('0xc')];});_0x3fa29c(_0x35cfdc);})[_0x2505('0x7')](function(_0x155cd5){_0x18d496(_0x155cd5);});});}function _0x2d45a0(_0x43d31f,_0x2bad1a,_0x2f56fe){if(!_0x2bad1a)return Promise[_0x2505('0xd')](null);return new Promise(function(_0x3e1023,_0x5657a0){return _0x1a0fc4[_0x2505('0xe')]['findAll']({'where':{'sectionId':_0x2bad1a['id']},'raw':!![]})[_0x2505('0xa')](function(_0x3a647c){if(_0x43d31f['field']&&_0x43d31f['field']!=='id'){_0x2bad1a['associatedResources']=_[_0x2505('0xb')](_0x3a647c,function(_0x1ed323){return _0x1ed323[_0x43d31f[_0x2505('0x4')]];});}else{if(_0x2f56fe===_0x2505('0xf')){_0x2bad1a[_0x2505('0x6')]=_[_0x2505('0xb')](_0x3a647c,function(_0x1b3543){return{'id':_0x1b3543[_0x2505('0x10')],'type':_0x1b3543[_0x2505('0x11')]};});}else{_0x2bad1a['associatedResources']=_[_0x2505('0xb')](_0x3a647c,function(_0x3860f9){return _0x3860f9['resourceId'];});}}_0x3e1023(_0x2bad1a);})[_0x2505('0x7')](function(_0x124984){_0x5657a0(_0x124984);});});}function _0x3077f8(_0xa917e5,_0x269ba0){var _0x4424e7={'parentSections':[]};switch(_0xa917e5[_0x2505('0x12')]()){case _0x2505('0x13'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x15');break;case _0x2505('0x16'):_0x4424e7[_0x2505('0x14')]='SquareOdbc';break;case'squarerecordings':_0x4424e7[_0x2505('0x14')]=_0x2505('0x17');_0x4424e7[_0x2505('0x18')]=[{'name':'SquareProjects','field':_0x2505('0xc'),'foreignKey':_0x2505('0x19')}];break;case _0x2505('0x1a'):_0x4424e7[_0x2505('0x14')]='JscriptyProject';break;case _0x2505('0x1b'):_0x4424e7[_0x2505('0x14')]='CmContact';_0x4424e7['parentSections']=[{'name':_0x2505('0x1c'),'field':'id','foreignKey':_0x2505('0x1d')}];break;case'lists':_0x4424e7[_0x2505('0x14')]=_0x2505('0x1e');break;case _0x2505('0x1f'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x20');break;case _0x2505('0x21'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x22');break;case _0x2505('0x23'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x24');break;case _0x2505('0x25'):_0x4424e7['childModel']=_0x2505('0x26');break;case _0x2505('0x27'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x28');break;case _0x2505('0x29'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x2a');break;case _0x2505('0x2b'):case'internalroutes':case _0x2505('0x2c'):_0x4424e7['childModel']=_0x2505('0x2d');break;case _0x2505('0x2e'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x2f');break;case _0x2505('0x30'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x31');break;case _0x2505('0x32'):_0x4424e7['childModel']=_0x2505('0x33');_0x4424e7['parentSections']=[{'name':_0x2505('0x34'),'field':_0x2505('0xc'),'foreignKey':'membername','model':_0x2505('0x35'),'filter':{'field':_0x2505('0x36'),'value':[_0x2505('0x37')]}},{'name':_0x2505('0x38'),'field':'name','foreignKey':_0x2505('0x39'),'model':_0x2505('0x35'),'filter':{'field':_0x2505('0x36'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x2505('0xc'),'foreignKey':_0x2505('0x3a'),'model':_0x2505('0x3b'),'filter':{'field':_0x2505('0x11'),'value':[_0x2505('0x3c')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':_0x2505('0x3b'),'filter':{'field':_0x2505('0x11'),'value':['outbound']}}];break;case'musiconholds':_0x4424e7[_0x2505('0x14')]=_0x2505('0x3d');break;case _0x2505('0x3e'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x3f');break;case'voiceprefixes':_0x4424e7['childModel']=_0x2505('0x40');break;case'ivrcampaigns':_0x4424e7[_0x2505('0x14')]=_0x2505('0x41');break;case'mailqueues':_0x4424e7['childModel']=_0x2505('0x42');break;case _0x2505('0x43'):_0x4424e7['childModel']=_0x2505('0x44');break;case'mailsubstatuses':_0x4424e7[_0x2505('0x14')]='MailSubstatus';break;case _0x2505('0x45'):_0x4424e7[_0x2505('0x14')]='OpenchannelQueue';break;case _0x2505('0x46'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x47');break;case _0x2505('0x48'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x49');break;case _0x2505('0x4a'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x4b');break;case'whatsappqueues':_0x4424e7[_0x2505('0x14')]='WhatsappQueue';break;case _0x2505('0x4c'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x4d');break;case _0x2505('0x4e'):_0x4424e7[_0x2505('0x14')]='Team';break;case'voicequeues':case _0x2505('0x4f'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x3b');if(_0x269ba0){_0x4424e7['parentSections']=[{'name':_0x2505('0x50')},{'name':_0x2505('0x51')}];}break;case _0x2505('0x52'):case'agents':case'telephones':_0x4424e7['childModel']=_0x2505('0x35');if(_0x269ba0){_0x4424e7[_0x2505('0x18')]=[{'name':_0x2505('0x53'),'filter':{'field':_0x2505('0x36'),'value':[_0x2505('0x54'),_0x2505('0x55')]},'ignore':!![]},{'name':_0x2505('0x34')},{'name':'Telephones'}];}break;case _0x2505('0x56'):_0x4424e7[_0x2505('0x14')]='ZendeskAccount';break;case _0x2505('0x57'):_0x4424e7[_0x2505('0x14')]='SalesforceAccount';break;case'freshdeskaccounts':_0x4424e7[_0x2505('0x14')]='FreshdeskAccount';break;case _0x2505('0x58'):_0x4424e7[_0x2505('0x14')]='SugarcrmAccount';break;case'deskaccounts':_0x4424e7['childModel']=_0x2505('0x59');break;case'zohoaccounts':_0x4424e7[_0x2505('0x14')]=_0x2505('0x5a');break;case _0x2505('0x5b'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x35');break;case _0x2505('0x5c'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x5d');break;case _0x2505('0x5e'):_0x4424e7['childModel']=_0x2505('0x5f');break;case'customdashboards':_0x4424e7[_0x2505('0x14')]=_0x2505('0x60');break;case _0x2505('0x61'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x62');break;case _0x2505('0x63'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x64');break;case _0x2505('0x65'):_0x4424e7[_0x2505('0x14')]='Schedule';break;case _0x2505('0x66'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x67');break;case'tags':_0x4424e7[_0x2505('0x14')]=_0x2505('0x68');break;case'templates':_0x4424e7[_0x2505('0x14')]=_0x2505('0x69');break;case _0x2505('0x6a'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x6b');break;case _0x2505('0x6c'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x6d');break;case _0x2505('0x6e'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x6f');break;case _0x2505('0x70'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x71');break;case'extractedreports':_0x4424e7[_0x2505('0x14')]=_0x2505('0xf');_0x4424e7[_0x2505('0x18')]=[{'name':_0x2505('0x72'),'field':'id','foreignKey':_0x2505('0x73')}];break;case _0x2505('0x74'):_0x4424e7['childModel']=_0x2505('0x75');break;}return _0x4424e7;}function _0xf4154d(_0x108502,_0x1e496e){var _0x23e477=_0x108502[_0x2505('0x76')](0x0)[_0x2505('0x77')]()+_0x108502[_0x2505('0x78')](0x1);var _0x626fee={'type':_0x1a0fc4[_0x2505('0x79')][_0x2505('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0x26f953,_0x1bc864){var _0x1b7fe4=squel[_0x2505('0x7b')]()[_0x2505('0x4')]('ui.'+_0x23e477+'InteractionId','id')[_0x2505('0x4')](_0x2505('0x7c'))['from']('user_has_'+_0x108502+_0x2505('0x7d'),'ui')[_0x2505('0x7e')]('ui.UserId\x20=\x20?',_0x1e496e['id']);return _0x1a0fc4[_0x2505('0x7f')][_0x2505('0x80')](_0x1b7fe4[_0x2505('0x81')](),_0x626fee)[_0x2505('0xa')](function(_0x12e212){_0x1e496e[_0x23e477+_0x2505('0x82')]=_0x12e212;_0x26f953(_0x12e212);})[_0x2505('0x7')](function(_0x3e0459){_0x1bc864(_0x3e0459);});});}return _0x13d416['define']('UserProfile',attributes,{'tableName':_0x2505('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3eddc6){var _0x52df6b=require('../../components/parsers/qs');var _0x5888da={'raw':_0x3eddc6[_0x2505('0x80')][_0x2505('0x84')],'where':{}};var _0x1457ea={};var _0x5b553b={'count':0x0,'rows':[]};var _0x51efc2=_0x3eddc6[_0x2505('0x80')][_0x2505('0x85')];var _0x39628f=_0x3eddc6['query'][_0x2505('0x86')]||![];var _0x231693=_0x3077f8(_0x51efc2,_0x39628f);if(!_0x231693[_0x2505('0x14')])throw new Error(_0x2505('0x87')+_0x51efc2+'\x27');var _0x6d931e=[{'name':_0x51efc2}];if(!_['isEmpty'](_0x231693['parentSections']))_0x6d931e=_0x231693['parentSections'];var _0x351119=[];for(var _0x299f3e=0x0;_0x299f3e<_0x6d931e[_0x2505('0x88')];_0x299f3e++){_0x351119[_0x2505('0x89')](_0x1a0fc4['UserProfileSection'][_0x2505('0x8a')]({'where':{'userProfileId':_0x3eddc6[_0x2505('0x8b')]['id'],'name':_0x6d931e[_0x299f3e][_0x2505('0xc')]},'raw':!![]}));}return Promise['all'](_0x351119)['then'](function(_0x314232){var _0x2e6af2=_[_0x2505('0x3')](_0x314232,function(_0x13c858){return _0x13c858?_0x13c858:undefined;});var _0x4d395f=_[_0x2505('0x3')](_0x6d931e,[_0x2505('0x8c'),!![]]);var _0x35b7c7=_[_0x2505('0x8d')](_0x2e6af2)&&_[_0x2505('0x8d')](_0x4d395f)?null:_[_0x2505('0x8e')](_0x4d395f,_0x2e6af2);if(!_0x35b7c7)return null;var _0x48a2fd=[];for(var _0x1de88f=0x0;_0x1de88f<_0x35b7c7[_0x2505('0x88')];_0x1de88f++){var _0x16402b=_[_0x2505('0x8a')](_0x6d931e,function(_0x10e52c){return _0x35b7c7[_0x1de88f]?_0x10e52c[_0x2505('0xc')]===_0x35b7c7[_0x1de88f][_0x2505('0xc')]:null;});if(_0x16402b){if(_0x35b7c7[_0x1de88f][_0x2505('0x8c')]){_0x48a2fd[_0x2505('0x89')](_0x376069(_0x231693[_0x2505('0x14')],_0x35b7c7[_0x1de88f]));}else{if(!_0x35b7c7[_0x1de88f]['autoAssociation']){_0x48a2fd[_0x2505('0x89')](_0x2d45a0(_0x16402b,_0x35b7c7[_0x1de88f],_0x231693[_0x2505('0x14')]));}else{if(_0x16402b['model']){_0x48a2fd[_0x2505('0x89')](_0x4c3ca2(_0x16402b,_0x35b7c7[_0x1de88f]));}}}}}return Promise[_0x2505('0x8f')](_0x48a2fd);})[_0x2505('0xa')](function(_0x6f4c4e){var _0xcd8b62=_0x6f4c4e;var _0x46297d=null;if(_0xcd8b62){_0x46297d=_0xcd8b62[_0x2505('0x88')]===0x1?_0xcd8b62[0x0]:null;}if(!_0x46297d&&!_0xcd8b62)return _0x5b553b;var _0x37f8bf=_0x1a0fc4[_0x231693[_0x2505('0x14')]][_0x2505('0x90')];_0x1457ea[_0x2505('0x8')]=_['keys'](_0x37f8bf);_0x1457ea[_0x2505('0x80')]=_[_0x2505('0x91')](_0x3eddc6[_0x2505('0x80')]);_0x1457ea['filters']=_[_0x2505('0x92')](_0x1457ea[_0x2505('0x8')],_0x1457ea['query']);_0x5888da[_0x2505('0x93')]=_[_0x2505('0x92')](_0x1457ea[_0x2505('0x8')],_0x52df6b[_0x2505('0x94')](_0x3eddc6[_0x2505('0x80')][_0x2505('0x94')]));_0x5888da['attributes']=_0x5888da['attributes']['length']?_0x5888da['attributes']:_0x1457ea[_0x2505('0x8')];if(!_0x3eddc6[_0x2505('0x80')][_0x2505('0x95')]('nolimit')){_0x5888da[_0x2505('0x96')]=_0x52df6b[_0x2505('0x96')](_0x3eddc6[_0x2505('0x80')][_0x2505('0x96')]);_0x5888da[_0x2505('0x97')]=_0x52df6b[_0x2505('0x97')](_0x3eddc6[_0x2505('0x80')]['offset']);}_0x5888da[_0x2505('0x98')]=_0x52df6b[_0x2505('0x99')](_0x3eddc6['query'][_0x2505('0x99')]);_0x5888da[_0x2505('0x7e')]=_0x52df6b[_0x2505('0x9a')](_[_0x2505('0x9b')](_0x3eddc6[_0x2505('0x80')],_0x1457ea[_0x2505('0x9a')]));if(_0x3eddc6[_0x2505('0x80')][_0x2505('0x3')]){_0x5888da[_0x2505('0x7e')]=_[_0x2505('0x9c')](_0x5888da['where'],{'$or':_['map'](_0x37f8bf,function(_0xe0fb76){if(_0xe0fb76[_0x2505('0x11')][_0x2505('0x9d')]!==_0x2505('0x9e')){var _0x217065={};_0x217065[_0xe0fb76[_0x2505('0x4')]]={'$like':'%'+_0x3eddc6[_0x2505('0x80')]['filter']+'%'};return _0x217065;}})});}var _0x380525=[];var _0x36a420=null;var _0x13ea20={};if(_0x46297d){_0x36a420=_[_0x2505('0x8a')](_0x6d931e,['name',_0x46297d['name']]);if(_0x36a420['field']){_0x13ea20={};if(_0x231693[_0x2505('0x14')]===_0x2505('0xf')){_0x13ea20[_0x36a420['foreignKey']]=_[_0x2505('0xb')](_0x46297d[_0x2505('0x6')],'id');}else{_0x13ea20[_0x36a420[_0x2505('0x9f')]]=_0x46297d[_0x2505('0x6')];}_0x380525[_0x2505('0x89')](_0x13ea20);}else{_0x5888da['where']['id']=_0x46297d['associatedResources'];}}else{for(var _0x3ff5c6=0x0;_0x3ff5c6<_0xcd8b62['length'];_0x3ff5c6++){_0x36a420=_[_0x2505('0x8a')](_0x6d931e,[_0x2505('0xc'),_0xcd8b62[_0x3ff5c6][_0x2505('0xc')]]);if(_0x36a420[_0x2505('0x4')]){_0x13ea20={};_0x13ea20[_0x36a420[_0x2505('0x9f')]]=_0xcd8b62[_0x3ff5c6][_0x2505('0x6')];_0x380525['push'](_0x13ea20);}else{if(!_0x5888da['where']['id'])_0x5888da['where']['id']=[];_0xcd8b62[_0x3ff5c6]['associatedResources'][_0x2505('0xa0')](function(_0x540493){_0x5888da['where']['id'][_0x2505('0x89')](_0x540493);});}}}if(!_[_0x2505('0x8d')](_0x380525)){_0x5888da[_0x2505('0x7e')]=_[_0x2505('0x9c')](_0x5888da[_0x2505('0x7e')],{'$and':{'$or':_0x380525}});}_0x5888da=_[_0x2505('0x9c')]({},_0x5888da,_0x3eddc6[_0x2505('0xa1')]);if(_0x46297d&&!_0x46297d[_0x2505('0xa2')]&&_0x231693[_0x2505('0x14')]==='AnalyticExtractedReport'){if(_0x3eddc6['query'][_0x2505('0xa3')]){_0x5888da[_0x2505('0xa4')]=[{'all':!![]}];}return _0x1a0fc4[_0x231693[_0x2505('0x14')]][_0x2505('0x9')](_0x5888da)[_0x2505('0xa')](function(_0x3af96d){var _0xc8b1bb=[];_0x3af96d[_0x2505('0xa0')](function(_0x2a912c){var _0x51b732;switch(_0x2a912c[_0x2505('0xa5')]){case _0x2505('0xa6'):_0x51b732=_['find'](_0x46297d[_0x2505('0x6')],function(_0x3c5922){return _0x3c5922['id']===_0x2a912c[_0x2505('0x73')]&&_0x3c5922[_0x2505('0x11')]===_0x2505('0xa7');});break;case _0x2505('0xa8'):_0x51b732=_[_0x2505('0x8a')](_0x46297d[_0x2505('0x6')],function(_0x34d9a3){return _0x34d9a3['id']===_0x2a912c[_0x2505('0x73')]&&_0x34d9a3[_0x2505('0x11')]===_0x2505('0xa9');});break;}if(_0x51b732)_0xc8b1bb[_0x2505('0x89')](_0x2a912c);});_0x5b553b[_0x2505('0xaa')]=_0xc8b1bb[_0x2505('0x88')];_0x5b553b[_0x2505('0xab')]=_0xc8b1bb;return _0x5b553b;});}else{if(!_[_0x2505('0x8d')](_0x3eddc6['query']['ids'])){_0x5888da[_0x2505('0x7e')]['id']=_0x5888da[_0x2505('0x7e')]['id']?_['intersection'](_0x5888da['where']['id'],_0x3eddc6[_0x2505('0x80')][_0x2505('0xac')]):_0x3eddc6[_0x2505('0x80')][_0x2505('0xac')];if(_0x3eddc6[_0x2505('0x80')]['customSorting']){_0x5888da[_0x2505('0x98')]=_0x3eddc6[_0x2505('0x80')]['customSorting'];}}if(_0x3eddc6['query'][_0x2505('0xad')]){_0x5888da['where']=_[_0x2505('0x9c')](_0x5888da[_0x2505('0x7e')],{'$and':_0x3eddc6[_0x2505('0x80')]['extraQueryConditions']});}return _0x1a0fc4[_0x231693[_0x2505('0x14')]][_0x2505('0xaa')]({'where':_0x5888da[_0x2505('0x7e')]})[_0x2505('0xa')](function(_0x400548){_0x5b553b[_0x2505('0xaa')]=_0x400548;if(_0x3eddc6[_0x2505('0x80')]['includeAll']){if(_0x231693[_0x2505('0x14')]===_0x2505('0xae')){_0x5888da[_0x2505('0xa4')]=[{'model':_0x1a0fc4[_0x2505('0x68')],'as':_0x2505('0xaf'),'attributes':['id',_0x2505('0xc'),_0x2505('0xb0')],'required':_0x3eddc6[_0x2505('0x80')]['tag']?!![]:![]},{'model':_0x1a0fc4['Tag'],'as':'ThroughTags','attributes':['id','name',_0x2505('0xb0')],'through':_0x3eddc6[_0x2505('0x80')][_0x2505('0xb1')]?{'attributes':[],'where':{'TagId':_0x3eddc6['query']['tag']||undefined}}:{},'required':_0x3eddc6[_0x2505('0x80')][_0x2505('0xb1')]?!![]:![]}];}else{_0x5888da[_0x2505('0xa4')]=[{'all':!![]}];}}return _0x1a0fc4[_0x231693[_0x2505('0x14')]][_0x2505('0x9')](_0x5888da);})['then'](function(_0x4054e7){_0x5b553b[_0x2505('0xab')]=_0x4054e7;if(_0x51efc2==='Agents'&&_0x3eddc6['query'][_0x2505('0xb2')]===_0x2505('0xb3')){var _0x181600=[];for(var _0x537067=0x0;_0x537067<_0x5b553b['rows'][_0x2505('0x88')];_0x537067++){_0x181600[_0x2505('0x89')](_0xf4154d('chat',_0x5b553b['rows'][_0x537067]['dataValues']));_0x181600['push'](_0xf4154d('sms',_0x5b553b[_0x2505('0xab')][_0x537067][_0x2505('0xb4')]));_0x181600[_0x2505('0x89')](_0xf4154d('fax',_0x5b553b[_0x2505('0xab')][_0x537067]['dataValues']));_0x181600[_0x2505('0x89')](_0xf4154d(_0x2505('0xb5'),_0x5b553b[_0x2505('0xab')][_0x537067][_0x2505('0xb4')]));_0x181600[_0x2505('0x89')](_0xf4154d(_0x2505('0xb6'),_0x5b553b['rows'][_0x537067][_0x2505('0xb4')]));_0x181600[_0x2505('0x89')](_0xf4154d(_0x2505('0xb7'),_0x5b553b[_0x2505('0xab')][_0x537067][_0x2505('0xb4')]));}return Promise[_0x2505('0x8f')](_0x181600)['then'](function(){return _0x5b553b;});}return _0x5b553b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 05c3258..ac17762 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 _0x5fab=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./userProfile.socket','register'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0x5fab,0x177));var _0xb5fa=function(_0x1b5a5a,_0x1c3b75){_0x1b5a5a=_0x1b5a5a-0x0;var _0x42b32d=_0x5fab[_0x1b5a5a];return _0x42b32d;};'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});config['redis']=_[_0xb5fa('0xc')](config[_0xb5fa('0xd')],{'host':_0xb5fa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0xd')]));require(_0xb5fa('0xf'))[_0xb5fa('0x10')](socket);function respondWithRpcPromise(_0x54c7eb,_0x5b5ea8,_0x3a8e1b){return new BPromise(function(_0x23d124,_0xe46b26){return client[_0xb5fa('0x11')](_0x54c7eb,_0x3a8e1b)[_0xb5fa('0x12')](function(_0xadef41){logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));logger['debug'](_0xb5fa('0x16'),_0x5b5ea8,_0xb5fa('0x15'),JSON['stringify'](_0xadef41));if(_0xadef41[_0xb5fa('0x17')]){if(_0xadef41['error'][_0xb5fa('0x18')]===0x1f4){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0xe46b26(_0xadef41['error']['message']);}logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x23d124(_0xadef41['error']['message']);}else{logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));_0x23d124(_0xadef41[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x3b0f69){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0x3b0f69);_0xe46b26(_0x3b0f69);});});} \ No newline at end of file +var _0x444e=['debug','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./userProfile.socket','register','request','info','request\x20sent'];(function(_0x365df3,_0x25d6a7){var _0x2a02a0=function(_0x5797a3){while(--_0x5797a3){_0x365df3['push'](_0x365df3['shift']());}};_0x2a02a0(++_0x25d6a7);}(_0x444e,0xe8));var _0xe444=function(_0x494413,_0x40e7ec){_0x494413=_0x494413-0x0;var _0x2217ed=_0x444e[_0x494413];return _0x2217ed;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var moment=require(_0xe444('0x1'));var BPromise=require('bluebird');var rs=require(_0xe444('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe444('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe444('0x4'))(_0xe444('0x5'));var config=require(_0xe444('0x6'));var jayson=require(_0xe444('0x7'));var client=jayson[_0xe444('0x8')][_0xe444('0x9')]({'port':0x232a});config['redis']=_[_0xe444('0xa')](config['redis'],{'host':_0xe444('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe444('0xc')]));require(_0xe444('0xd'))[_0xe444('0xe')](socket);function respondWithRpcPromise(_0x48907b,_0x55697b,_0x36c8a5){return new BPromise(function(_0x1f41ff,_0x5e53cb){return client[_0xe444('0xf')](_0x48907b,_0x36c8a5)['then'](function(_0x5f0f7f){logger[_0xe444('0x10')]('UserProfile,\x20%s,\x20%s',_0x55697b,_0xe444('0x11'));logger[_0xe444('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x55697b,_0xe444('0x11'),JSON['stringify'](_0x5f0f7f));if(_0x5f0f7f['error']){if(_0x5f0f7f[_0xe444('0x13')][_0xe444('0x14')]===0x1f4){logger['error'](_0xe444('0x15'),_0x55697b,_0x5f0f7f['error'][_0xe444('0x16')]);return _0x5e53cb(_0x5f0f7f[_0xe444('0x13')][_0xe444('0x16')]);}logger[_0xe444('0x13')](_0xe444('0x15'),_0x55697b,_0x5f0f7f[_0xe444('0x13')][_0xe444('0x16')]);return _0x1f41ff(_0x5f0f7f[_0xe444('0x13')][_0xe444('0x16')]);}else{logger[_0xe444('0x10')](_0xe444('0x15'),_0x55697b,_0xe444('0x11'));_0x1f41ff(_0x5f0f7f[_0xe444('0x17')]['message']);}})[_0xe444('0x18')](function(_0x1f904f){logger[_0xe444('0x13')](_0xe444('0x15'),_0x55697b,_0x1f904f);_0x5e53cb(_0x1f904f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index cc2092e..46b240d 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 _0xd6e5=['save','remove','emit','removeListener','register','length','userProfile:'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xd6e5,0xa8));var _0x5d6e=function(_0x9c4fe7,_0x1bdc80){_0x9c4fe7=_0x9c4fe7-0x0;var _0x1b3c03=_0xd6e5[_0x9c4fe7];return _0x1b3c03;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x5d6e('0x0'),_0x5d6e('0x1'),'update'];function createListener(_0x3b5ad3,_0x43a8df){return function(_0x1289a8){_0x43a8df[_0x5d6e('0x2')](_0x3b5ad3,_0x1289a8);};}function removeListener(_0x343257,_0x35f4e4){return function(){UserProfileEvents[_0x5d6e('0x3')](_0x343257,_0x35f4e4);};}exports[_0x5d6e('0x4')]=function(_0x7b2078){for(var _0x4adae2=0x0,_0x391d57=events[_0x5d6e('0x5')];_0x4adae2<_0x391d57;_0x4adae2++){var _0x488fd4=events[_0x4adae2];var _0x1cfa52=createListener(_0x5d6e('0x6')+_0x488fd4,_0x7b2078);UserProfileEvents['on'](_0x488fd4,_0x1cfa52);}}; \ No newline at end of file +var _0xdf05=['remove','emit','removeListener','register','length','userProfile:','./userProfile.events','save'];(function(_0x4bfd41,_0x4330e0){var _0x8bd130=function(_0xe2ff10){while(--_0xe2ff10){_0x4bfd41['push'](_0x4bfd41['shift']());}};_0x8bd130(++_0x4330e0);}(_0xdf05,0x1be));var _0x5df0=function(_0x35e6ca,_0x54939f){_0x35e6ca=_0x35e6ca-0x0;var _0x239e43=_0xdf05[_0x35e6ca];return _0x239e43;};'use strict';var UserProfileEvents=require(_0x5df0('0x0'));var events=[_0x5df0('0x1'),_0x5df0('0x2'),'update'];function createListener(_0x3125fd,_0x36ffff){return function(_0x233b9a){_0x36ffff[_0x5df0('0x3')](_0x3125fd,_0x233b9a);};}function removeListener(_0x230700,_0x1c7533){return function(){UserProfileEvents[_0x5df0('0x4')](_0x230700,_0x1c7533);};}exports[_0x5df0('0x5')]=function(_0x38f567){for(var _0x1a87bd=0x0,_0x1c64c0=events[_0x5df0('0x6')];_0x1a87bd<_0x1c64c0;_0x1a87bd++){var _0x3e78d6=events[_0x1a87bd];var _0x11f17a=createListener(_0x5df0('0x7')+_0x3e78d6,_0x38f567);UserProfileEvents['on'](_0x3e78d6,_0x11f17a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f23963b..558d395 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 _0xb296=['/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','index','get','/describe','isAuthenticated','describe','show','post','create','put'];(function(_0x1f2bc1,_0x46bf9a){var _0x271a67=function(_0x51262e){while(--_0x51262e){_0x1f2bc1['push'](_0x1f2bc1['shift']());}};_0x271a67(++_0x46bf9a);}(_0xb296,0xeb));var _0x6b29=function(_0x24865d,_0xabe09a){_0x24865d=_0x24865d-0x0;var _0x42d927=_0xb296[_0x24865d];return _0x42d927;};'use strict';var multer=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var path=require('path');var timeout=require(_0x6b29('0x2'));var express=require(_0x6b29('0x3'));var router=express[_0x6b29('0x4')]();var fs_extra=require(_0x6b29('0x5'));var auth=require(_0x6b29('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b29('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6b29('0x8')]);router[_0x6b29('0x9')](_0x6b29('0xa'),auth[_0x6b29('0xb')](),controller[_0x6b29('0xc')]);router[_0x6b29('0x9')]('/:id',auth[_0x6b29('0xb')](),controller[_0x6b29('0xd')]);router[_0x6b29('0xe')]('/',auth[_0x6b29('0xb')](),controller[_0x6b29('0xf')]);router[_0x6b29('0x10')](_0x6b29('0x11'),auth[_0x6b29('0xb')](),controller[_0x6b29('0x12')]);router[_0x6b29('0x13')]('/:id',auth[_0x6b29('0xb')](),controller[_0x6b29('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1817=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./userProfileResource.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x1817,0x1e5));var _0x7181=function(_0x31e87f,_0x2223c9){_0x31e87f=_0x31e87f-0x0;var _0xab5ab0=_0x1817[_0x31e87f];return _0xab5ab0;};'use strict';var multer=require(_0x7181('0x0'));var util=require(_0x7181('0x1'));var path=require('path');var timeout=require(_0x7181('0x2'));var express=require('express');var router=express[_0x7181('0x3')]();var fs_extra=require(_0x7181('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7181('0x5'));var controller=require(_0x7181('0x6'));router[_0x7181('0x7')]('/',auth['isAuthenticated'](),controller[_0x7181('0x8')]);router[_0x7181('0x7')](_0x7181('0x9'),auth['isAuthenticated'](),controller[_0x7181('0xa')]);router[_0x7181('0x7')](_0x7181('0xb'),auth[_0x7181('0xc')](),controller[_0x7181('0xd')]);router[_0x7181('0xe')]('/',auth[_0x7181('0xc')](),controller['create']);router[_0x7181('0xf')]('/:id',auth[_0x7181('0xc')](),controller[_0x7181('0x10')]);router[_0x7181('0x11')](_0x7181('0xb'),auth[_0x7181('0xc')](),controller[_0x7181('0x12')]);module[_0x7181('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index d3d716e..9915345 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 _0xf92a=['sequelize','STRING'];(function(_0x23857c,_0x518d73){var _0x3fb991=function(_0x6f12bf){while(--_0x6f12bf){_0x23857c['push'](_0x23857c['shift']());}};_0x3fb991(++_0x518d73);}(_0xf92a,0xe8));var _0xaf92=function(_0x132886,_0x1b56cb){_0x132886=_0x132886-0x0;var _0x333c46=_0xf92a[_0x132886];return _0x333c46;};'use strict';var Sequelize=require(_0xaf92('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xaf92('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2eeb=['INTEGER','sequelize','exports','STRING'];(function(_0x1e0063,_0x836add){var _0xd870fa=function(_0x4ef016){while(--_0x4ef016){_0x1e0063['push'](_0x1e0063['shift']());}};_0xd870fa(++_0x836add);}(_0x2eeb,0x181));var _0xb2ee=function(_0x3f86e9,_0x1d57d5){_0x3f86e9=_0x3f86e9-0x0;var _0x4151a5=_0x2eeb[_0x3f86e9];return _0x4151a5;};'use strict';var Sequelize=require(_0xb2ee('0x0'));module[_0xb2ee('0x1')]={'name':{'type':Sequelize[_0xb2ee('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb2ee('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb2ee('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index fd713b4..d383d5c 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 _0xadb5=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','keys'];(function(_0x57d843,_0x2a95e0){var _0x42ba2d=function(_0x46cb71){while(--_0x46cb71){_0x57d843['push'](_0x57d843['shift']());}};_0x42ba2d(++_0x2a95e0);}(_0xadb5,0xad));var _0x5adb=function(_0x3e8dc4,_0x2564db){_0x3e8dc4=_0x3e8dc4-0x0;var _0x27d8db=_0xadb5[_0x3e8dc4];return _0x27d8db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['UserProfileResource']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['UserProfileResource'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['UserProfileResource'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));};exports['describe']=function(_0x36b847,_0x3a5703){return db[_0x5adb('0x2a')][_0x5adb('0x49')]()['then'](respondWithResult(_0x3a5703,null))[_0x5adb('0x42')](handleError(_0x3a5703,null));}; \ No newline at end of file +var _0x1883=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileResource','includeAll','include','findAll','params','catch','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','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x26b116,_0x50d113){var _0x36fa36=function(_0x326bfc){while(--_0x326bfc){_0x26b116['push'](_0x26b116['shift']());}};_0x36fa36(++_0x50d113);}(_0x1883,0xab));var _0x3188=function(_0x56ee08,_0x3d7e2e){_0x56ee08=_0x56ee08-0x0;var _0x11e6bc=_0x1883[_0x56ee08];return _0x11e6bc;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['UserProfileResource'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['UserProfileResource'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));};exports[_0x3188('0x4a')]=function(_0x4f8852,_0x559264){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x559264,null))['catch'](handleError(_0x559264,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e9df23b..fd44722 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 _0xf992=['UserProfileResource','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','define'];(function(_0x34b084,_0x363eb9){var _0x460d98=function(_0xb4a921){while(--_0xb4a921){_0x34b084['push'](_0x34b084['shift']());}};_0x460d98(++_0x363eb9);}(_0xf992,0x82));var _0x2f99=function(_0x3ac5bb,_0x1dcb4c){_0x3ac5bb=_0x3ac5bb-0x0;var _0x27078d=_0xf992[_0x3ac5bb];return _0x27078d;};'use strict';var _=require(_0x2f99('0x0'));var util=require('util');var logger=require(_0x2f99('0x1'))(_0x2f99('0x2'));var moment=require(_0x2f99('0x3'));var BPromise=require(_0x2f99('0x4'));var rp=require(_0x2f99('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f99('0x6'));var config=require(_0x2f99('0x7'));var attributes=require(_0x2f99('0x8'));module['exports']=function(_0x39fcf8,_0x157c6a){return _0x39fcf8[_0x2f99('0x9')](_0x2f99('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2f99('0xb'),'fields':[_0x2f99('0xc'),_0x2f99('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb517=['compositeIndex','resourceId','sectionId','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','user_profile_has_resources'];(function(_0x42dd68,_0x3b2dcf){var _0x1578a5=function(_0x599343){while(--_0x599343){_0x42dd68['push'](_0x42dd68['shift']());}};_0x1578a5(++_0x3b2dcf);}(_0xb517,0x177));var _0x7b51=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xb517[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7b51('0x0'));var util=require('util');var logger=require(_0x7b51('0x1'))('api');var moment=require(_0x7b51('0x2'));var BPromise=require(_0x7b51('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b51('0x4'));var rimraf=require(_0x7b51('0x5'));var config=require(_0x7b51('0x6'));var attributes=require(_0x7b51('0x7'));module['exports']=function(_0x1c196b,_0x5741a5){return _0x1c196b['define']('UserProfileResource',attributes,{'tableName':_0x7b51('0x8'),'paranoid':![],'indexes':[{'name':_0x7b51('0x9'),'fields':[_0x7b51('0xa'),_0x7b51('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b07b8d1..3efa0bc 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 _0xad14=['client','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xad14,0x9e));var _0x4ad1=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0xad14[_0x599d7f];return _0x3346d3;};'use strict';var _=require(_0x4ad1('0x0'));var util=require(_0x4ad1('0x1'));var moment=require(_0x4ad1('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ad1('0x3'));var fs=require('fs');var Redis=require(_0x4ad1('0x4'));var db=require(_0x4ad1('0x5'))['db'];var utils=require(_0x4ad1('0x6'));var logger=require(_0x4ad1('0x7'))('rpc');var config=require(_0x4ad1('0x8'));var jayson=require(_0x4ad1('0x9'));var client=jayson[_0x4ad1('0xa')][_0x4ad1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2180,_0x6ffc9f,_0x47ac66){return new BPromise(function(_0x1ec137,_0x5af628){return client[_0x4ad1('0xc')](_0x5b2180,_0x47ac66)['then'](function(_0x259610){logger[_0x4ad1('0xd')](_0x4ad1('0xe'),_0x6ffc9f,'request\x20sent');logger[_0x4ad1('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x6ffc9f,'request\x20sent',JSON['stringify'](_0x259610));if(_0x259610[_0x4ad1('0x10')]){if(_0x259610[_0x4ad1('0x10')]['code']===0x1f4){logger[_0x4ad1('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x6ffc9f,_0x259610[_0x4ad1('0x10')][_0x4ad1('0x11')]);return _0x5af628(_0x259610['error'][_0x4ad1('0x11')]);}logger['error'](_0x4ad1('0xe'),_0x6ffc9f,_0x259610['error'][_0x4ad1('0x11')]);return _0x1ec137(_0x259610[_0x4ad1('0x10')][_0x4ad1('0x11')]);}else{logger[_0x4ad1('0xd')](_0x4ad1('0xe'),_0x6ffc9f,_0x4ad1('0x12'));_0x1ec137(_0x259610[_0x4ad1('0x13')][_0x4ad1('0x11')]);}})[_0x4ad1('0x14')](function(_0x6ceff1){logger[_0x4ad1('0x10')](_0x4ad1('0xe'),_0x6ffc9f,_0x6ceff1);_0x5af628(_0x6ceff1);});});} \ No newline at end of file +var _0x8ffc=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8ffc,0x197));var _0xc8ff=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x8ffc[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0xc8ff('0x0'));var util=require(_0xc8ff('0x1'));var moment=require(_0xc8ff('0x2'));var BPromise=require(_0xc8ff('0x3'));var rs=require(_0xc8ff('0x4'));var fs=require('fs');var Redis=require(_0xc8ff('0x5'));var db=require(_0xc8ff('0x6'))['db'];var utils=require(_0xc8ff('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc8ff('0x8'));var jayson=require(_0xc8ff('0x9'));var client=jayson[_0xc8ff('0xa')][_0xc8ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27a106,_0x325425,_0x13d302){return new BPromise(function(_0x259769,_0x2e9051){return client['request'](_0x27a106,_0x13d302)[_0xc8ff('0xc')](function(_0x40e0d3){logger[_0xc8ff('0xd')](_0xc8ff('0xe'),_0x325425,_0xc8ff('0xf'));logger[_0xc8ff('0x10')](_0xc8ff('0x11'),_0x325425,_0xc8ff('0xf'),JSON[_0xc8ff('0x12')](_0x40e0d3));if(_0x40e0d3[_0xc8ff('0x13')]){if(_0x40e0d3[_0xc8ff('0x13')]['code']===0x1f4){logger['error'](_0xc8ff('0xe'),_0x325425,_0x40e0d3[_0xc8ff('0x13')][_0xc8ff('0x14')]);return _0x2e9051(_0x40e0d3[_0xc8ff('0x13')][_0xc8ff('0x14')]);}logger['error'](_0xc8ff('0xe'),_0x325425,_0x40e0d3[_0xc8ff('0x13')][_0xc8ff('0x14')]);return _0x259769(_0x40e0d3[_0xc8ff('0x13')][_0xc8ff('0x14')]);}else{logger[_0xc8ff('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x325425,_0xc8ff('0xf'));_0x259769(_0x40e0d3['result'][_0xc8ff('0x14')]);}})['catch'](function(_0x1997ff){logger[_0xc8ff('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x325425,_0x1997ff);_0x2e9051(_0x1997ff);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 16986aa..7326745 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 _0xcfa1=['get','isAuthenticated','/describe','describe','/:id','show','create','put','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0x165c16,_0x400108){var _0x48ea7b=function(_0x55149a){while(--_0x55149a){_0x165c16['push'](_0x165c16['shift']());}};_0x48ea7b(++_0x400108);}(_0xcfa1,0xf8));var _0x1cfa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcfa1[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x1cfa('0x0'));var util=require('util');var path=require(_0x1cfa('0x1'));var timeout=require(_0x1cfa('0x2'));var express=require('express');var router=express[_0x1cfa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cfa('0x4'));var interaction=require(_0x1cfa('0x5'));var config=require(_0x1cfa('0x6'));var controller=require(_0x1cfa('0x7'));router[_0x1cfa('0x8')]('/',auth[_0x1cfa('0x9')](),controller['index']);router[_0x1cfa('0x8')](_0x1cfa('0xa'),auth[_0x1cfa('0x9')](),controller[_0x1cfa('0xb')]);router[_0x1cfa('0x8')](_0x1cfa('0xc'),auth['isAuthenticated'](),controller[_0x1cfa('0xd')]);router['post']('/',auth[_0x1cfa('0x9')](),controller[_0x1cfa('0xe')]);router[_0x1cfa('0xf')](_0x1cfa('0xc'),auth[_0x1cfa('0x9')](),controller['update']);router['delete'](_0x1cfa('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x11d3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x38ad08,_0x471444){var _0x4eac9a=function(_0x55e19c){while(--_0x55e19c){_0x38ad08['push'](_0x38ad08['shift']());}};_0x4eac9a(++_0x471444);}(_0x11d3,0x18a));var _0x311d=function(_0x59e4e3,_0x430f6c){_0x59e4e3=_0x59e4e3-0x0;var _0x54be45=_0x11d3[_0x59e4e3];return _0x54be45;};'use strict';var multer=require(_0x311d('0x0'));var util=require(_0x311d('0x1'));var path=require(_0x311d('0x2'));var timeout=require(_0x311d('0x3'));var express=require(_0x311d('0x4'));var router=express[_0x311d('0x5')]();var fs_extra=require(_0x311d('0x6'));var auth=require(_0x311d('0x7'));var interaction=require(_0x311d('0x8'));var config=require(_0x311d('0x9'));var controller=require('./userProfileSection.controller');router[_0x311d('0xa')]('/',auth['isAuthenticated'](),controller[_0x311d('0xb')]);router[_0x311d('0xa')](_0x311d('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x311d('0xa')]('/:id',auth[_0x311d('0xd')](),controller[_0x311d('0xe')]);router['post']('/',auth[_0x311d('0xd')](),controller[_0x311d('0xf')]);router['put'](_0x311d('0x10'),auth[_0x311d('0xd')](),controller[_0x311d('0x11')]);router[_0x311d('0x12')](_0x311d('0x10'),auth[_0x311d('0xd')](),controller[_0x311d('0x13')]);module[_0x311d('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 1bce228..724bb4b 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 _0x57f8=['join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0x57f8,0x198));var _0x857f=function(_0x1be7fd,_0x51ff5a){_0x1be7fd=_0x1be7fd-0x0;var _0x2f7949=_0x57f8[_0x1be7fd];return _0x2f7949;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'name':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x857f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x857f('0x1')],'set':function(_0x6f054b){this[_0x857f('0x4')](_0x857f('0x5'),_0x6f054b?_0x6f054b[_0x857f('0x6')](''):[]);},'get':function(){return this[_0x857f('0x7')]('crudPermissions')?this[_0x857f('0x7')](_0x857f('0x5'))[_0x857f('0x8')](''):[];}}}; \ No newline at end of file +var _0xd4a2=['join','getDataValue','split','sequelize','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0x351d50,_0x11da89){var _0x4c8d58=function(_0x274153){while(--_0x274153){_0x351d50['push'](_0x351d50['shift']());}};_0x4c8d58(++_0x11da89);}(_0xd4a2,0x173));var _0x2d4a=function(_0x323582,_0x30f533){_0x323582=_0x323582-0x0;var _0x5bf833=_0xd4a2[_0x323582];return _0x5bf833;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x2d4a('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x2d4a('0x1')],'set':function(_0x5d435a){this[_0x2d4a('0x3')](_0x2d4a('0x4'),_0x5d435a?_0x5d435a[_0x2d4a('0x5')](''):[]);},'get':function(){return this[_0x2d4a('0x6')](_0x2d4a('0x4'))?this['getDataValue'](_0x2d4a('0x4'))[_0x2d4a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 2e7b4a3..0bb1141 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 _0xaafb=['model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','keys','query','intersection'];(function(_0x5752cc,_0x4b0504){var _0x3c82e4=function(_0x54caee){while(--_0x54caee){_0x5752cc['push'](_0x5752cc['shift']());}};_0x3c82e4(++_0x4b0504);}(_0xaafb,0x18e));var _0xbaaf=function(_0x18f085,_0x34d9fd){_0x18f085=_0x18f085-0x0;var _0x1ba93d=_0xaafb[_0x18f085];return _0x1ba93d;};'use strict';var emlformat=require(_0xbaaf('0x0'));var rimraf=require(_0xbaaf('0x1'));var zipdir=require(_0xbaaf('0x2'));var jsonpatch=require(_0xbaaf('0x3'));var rp=require(_0xbaaf('0x4'));var moment=require(_0xbaaf('0x5'));var BPromise=require(_0xbaaf('0x6'));var Mustache=require(_0xbaaf('0x7'));var util=require(_0xbaaf('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbaaf('0x9'));var ejs=require(_0xbaaf('0xa'));var fs=require('fs');var fs_extra=require(_0xbaaf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbaaf('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbaaf('0x9'));var querystring=require(_0xbaaf('0xd'));var Papa=require('papaparse');var Redis=require(_0xbaaf('0xe'));var authService=require(_0xbaaf('0xf'));var qs=require(_0xbaaf('0x10'));var as=require(_0xbaaf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbaaf('0x12'))(_0xbaaf('0x13'));var utils=require('../../config/utils');var config=require(_0xbaaf('0x14'));var licenseUtil=require(_0xbaaf('0x15'));var db=require(_0xbaaf('0x16'))['db'];function respondWithStatusCode(_0x5d0ad6,_0x6b5f0e){_0x6b5f0e=_0x6b5f0e||0xcc;return function(_0x365bbb){if(_0x365bbb){return _0x5d0ad6['sendStatus'](_0x6b5f0e);}return _0x5d0ad6[_0xbaaf('0x17')](_0x6b5f0e)['end']();};}function respondWithResult(_0xeb47bb,_0x5ee01b){_0x5ee01b=_0x5ee01b||0xc8;return function(_0x4e75fe){if(_0x4e75fe){return _0xeb47bb[_0xbaaf('0x17')](_0x5ee01b)[_0xbaaf('0x18')](_0x4e75fe);}};}function respondWithFilteredResult(_0x4dfc80,_0x4f0e98){return function(_0x2550ba){if(_0x2550ba){var _0x1355e9=typeof _0x4f0e98[_0xbaaf('0x19')]===_0xbaaf('0x1a')&&typeof _0x4f0e98[_0xbaaf('0x1b')]===_0xbaaf('0x1a');var _0x114ae2=_0x2550ba[_0xbaaf('0x1c')];var _0x5051dc=_0x1355e9?0x0:_0x4f0e98['offset'];var _0x347914=_0x1355e9?_0x2550ba['count']:_0x4f0e98[_0xbaaf('0x19')]+_0x4f0e98[_0xbaaf('0x1b')];var _0x5e2a06;if(_0x347914>=_0x114ae2){_0x347914=_0x114ae2;_0x5e2a06=0xc8;}else{_0x5e2a06=0xce;}_0x4dfc80[_0xbaaf('0x17')](_0x5e2a06);return _0x4dfc80[_0xbaaf('0x1d')](_0xbaaf('0x1e'),_0x5051dc+'-'+_0x347914+'/'+_0x114ae2)[_0xbaaf('0x18')](_0x2550ba);}return null;};}function patchUpdates(_0x23eed8){return function(_0x14e16a){try{jsonpatch['apply'](_0x14e16a,_0x23eed8,!![]);}catch(_0x24e921){return BPromise[_0xbaaf('0x1f')](_0x24e921);}return _0x14e16a[_0xbaaf('0x20')]();};}function saveUpdates(_0x205d6a,_0x1939b2){return function(_0x1e2588){if(_0x1e2588){return _0x1e2588[_0xbaaf('0x21')](_0x205d6a)[_0xbaaf('0x22')](function(_0x4ca7e3){return _0x4ca7e3;});}return null;};}function removeEntity(_0x36e367,_0x2b79d9){return function(_0x2aadf4){if(_0x2aadf4){return _0x2aadf4[_0xbaaf('0x23')]()[_0xbaaf('0x22')](function(){_0x36e367[_0xbaaf('0x17')](0xcc)[_0xbaaf('0x24')]();});}};}function handleEntityNotFound(_0x46940b,_0x142a0f){return function(_0x492f1b){if(!_0x492f1b){_0x46940b[_0xbaaf('0x25')](0x194);}return _0x492f1b;};}function handleError(_0x136fa6,_0x4fee3d){_0x4fee3d=_0x4fee3d||0x1f4;return function(_0x3e32da){logger[_0xbaaf('0x26')](_0x3e32da[_0xbaaf('0x27')]);if(_0x3e32da[_0xbaaf('0x28')]){delete _0x3e32da['name'];}_0x136fa6[_0xbaaf('0x17')](_0x4fee3d)[_0xbaaf('0x29')](_0x3e32da);};}exports[_0xbaaf('0x2a')]=function(_0x252c78,_0x2534bd){var _0xe11ac7={},_0x39a837={},_0x13b54b={'count':0x0,'rows':[]};var _0x296f39=_[_0xbaaf('0x2b')](db[_0xbaaf('0x2c')][_0xbaaf('0x2d')],function(_0xc6d05f){return{'name':_0xc6d05f[_0xbaaf('0x2e')],'type':_0xc6d05f[_0xbaaf('0x2f')][_0xbaaf('0x30')]};});_0x39a837['model']=_[_0xbaaf('0x2b')](_0x296f39,_0xbaaf('0x28'));_0x39a837['query']=_[_0xbaaf('0x31')](_0x252c78[_0xbaaf('0x32')]);_0x39a837['filters']=_[_0xbaaf('0x33')](_0x39a837[_0xbaaf('0x34')],_0x39a837[_0xbaaf('0x32')]);_0xe11ac7[_0xbaaf('0x35')]=_['intersection'](_0x39a837[_0xbaaf('0x34')],qs[_0xbaaf('0x36')](_0x252c78[_0xbaaf('0x32')]['fields']));_0xe11ac7[_0xbaaf('0x35')]=_0xe11ac7[_0xbaaf('0x35')][_0xbaaf('0x37')]?_0xe11ac7['attributes']:_0x39a837[_0xbaaf('0x34')];if(!_0x252c78[_0xbaaf('0x32')]['hasOwnProperty'](_0xbaaf('0x38'))){_0xe11ac7[_0xbaaf('0x1b')]=qs['limit'](_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x1b')]);_0xe11ac7[_0xbaaf('0x19')]=qs['offset'](_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x19')]);}_0xe11ac7['order']=qs[_0xbaaf('0x39')](_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x39')]);_0xe11ac7[_0xbaaf('0x3a')]=qs[_0xbaaf('0x3b')](_[_0xbaaf('0x3c')](_0x252c78[_0xbaaf('0x32')],_0x39a837[_0xbaaf('0x3b')]),_0x296f39);if(_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x3d')]){_0xe11ac7['where']=_['merge'](_0xe11ac7[_0xbaaf('0x3a')],{'$or':_[_0xbaaf('0x2b')](_0x296f39,function(_0x58eca3){if(_0x58eca3['type']!==_0xbaaf('0x3e')){var _0x4b6e9f={};_0x4b6e9f[_0x58eca3[_0xbaaf('0x28')]]={'$like':'%'+_0x252c78[_0xbaaf('0x32')][_0xbaaf('0x3d')]+'%'};return _0x4b6e9f;}})});}_0xe11ac7=_[_0xbaaf('0x3f')]({},_0xe11ac7,_0x252c78[_0xbaaf('0x40')]);var _0x4e7864={'where':_0xe11ac7[_0xbaaf('0x3a')]};return db[_0xbaaf('0x2c')][_0xbaaf('0x1c')](_0x4e7864)[_0xbaaf('0x22')](function(_0xc32e29){_0x13b54b[_0xbaaf('0x1c')]=_0xc32e29;if(_0x252c78['query'][_0xbaaf('0x41')]){_0xe11ac7[_0xbaaf('0x42')]=[{'all':!![]}];}return db[_0xbaaf('0x2c')][_0xbaaf('0x43')](_0xe11ac7);})[_0xbaaf('0x22')](function(_0x4001cd){_0x13b54b[_0xbaaf('0x44')]=_0x4001cd;return _0x13b54b;})[_0xbaaf('0x22')](respondWithFilteredResult(_0x2534bd,_0xe11ac7))['catch'](handleError(_0x2534bd,null));};exports[_0xbaaf('0x45')]=function(_0x532f43,_0x2ae315){var _0x13c17f={'raw':![],'where':{'id':_0x532f43[_0xbaaf('0x46')]['id']}},_0x484ade={};_0x484ade[_0xbaaf('0x34')]=_[_0xbaaf('0x31')](db[_0xbaaf('0x2c')][_0xbaaf('0x2d')]);_0x484ade[_0xbaaf('0x32')]=_['keys'](_0x532f43[_0xbaaf('0x32')]);_0x484ade[_0xbaaf('0x3b')]=_[_0xbaaf('0x33')](_0x484ade[_0xbaaf('0x34')],_0x484ade[_0xbaaf('0x32')]);_0x13c17f[_0xbaaf('0x35')]=_[_0xbaaf('0x33')](_0x484ade['model'],qs['fields'](_0x532f43[_0xbaaf('0x32')][_0xbaaf('0x36')]));_0x13c17f['attributes']=_0x13c17f[_0xbaaf('0x35')][_0xbaaf('0x37')]?_0x13c17f[_0xbaaf('0x35')]:_0x484ade[_0xbaaf('0x34')];if(_0x532f43[_0xbaaf('0x32')][_0xbaaf('0x41')]){_0x13c17f[_0xbaaf('0x42')]=[{'all':!![]}];}_0x13c17f=_['merge']({},_0x13c17f,_0x532f43[_0xbaaf('0x40')]);return db[_0xbaaf('0x2c')][_0xbaaf('0x47')](_0x13c17f)[_0xbaaf('0x22')](handleEntityNotFound(_0x2ae315,null))[_0xbaaf('0x22')](respondWithResult(_0x2ae315,null))[_0xbaaf('0x48')](handleError(_0x2ae315,null));};exports[_0xbaaf('0x49')]=function(_0x1f7452,_0x235a19){return db[_0xbaaf('0x2c')]['create'](_0x1f7452[_0xbaaf('0x4a')],{})['then'](respondWithResult(_0x235a19,0xc9))[_0xbaaf('0x48')](handleError(_0x235a19,null));};exports['update']=function(_0x5a161b,_0x472b51){if(_0x5a161b[_0xbaaf('0x4a')]['id']){delete _0x5a161b[_0xbaaf('0x4a')]['id'];}return db[_0xbaaf('0x2c')][_0xbaaf('0x47')]({'where':{'id':_0x5a161b[_0xbaaf('0x46')]['id']}})[_0xbaaf('0x22')](handleEntityNotFound(_0x472b51,null))[_0xbaaf('0x22')](saveUpdates(_0x5a161b[_0xbaaf('0x4a')],null))[_0xbaaf('0x22')](respondWithResult(_0x472b51,null))[_0xbaaf('0x48')](handleError(_0x472b51,null));};exports['destroy']=function(_0x213c7f,_0x5157ab){return db[_0xbaaf('0x2c')][_0xbaaf('0x47')]({'where':{'id':_0x213c7f[_0xbaaf('0x46')]['id']}})[_0xbaaf('0x22')](handleEntityNotFound(_0x5157ab,null))[_0xbaaf('0x22')](removeEntity(_0x5157ab,null))[_0xbaaf('0x48')](handleError(_0x5157ab,null));};exports['describe']=function(_0xd05bf9,_0x3bce34){return db[_0xbaaf('0x2c')]['describe']()[_0xbaaf('0x22')](respondWithResult(_0x3bce34,null))['catch'](handleError(_0x3bce34,null));}; \ No newline at end of file +var _0xc4ff=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','UserProfileSection','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','length','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring'];(function(_0x355aed,_0x33647e){var _0x122f31=function(_0x349636){while(--_0x349636){_0x355aed['push'](_0x355aed['shift']());}};_0x122f31(++_0x33647e);}(_0xc4ff,0x15f));var _0xfc4f=function(_0x9a470b,_0x2e81dc){_0x9a470b=_0x9a470b-0x0;var _0x884638=_0xc4ff[_0x9a470b];return _0x884638;};'use strict';var emlformat=require(_0xfc4f('0x0'));var rimraf=require(_0xfc4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc4f('0x2'));var rp=require('request-promise');var moment=require(_0xfc4f('0x3'));var BPromise=require(_0xfc4f('0x4'));var Mustache=require(_0xfc4f('0x5'));var util=require('util');var path=require(_0xfc4f('0x6'));var sox=require(_0xfc4f('0x7'));var csv=require(_0xfc4f('0x8'));var ejs=require(_0xfc4f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc4f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc4f('0xb'));var deskjs=require(_0xfc4f('0xc'));var toCsv=require(_0xfc4f('0x8'));var querystring=require(_0xfc4f('0xd'));var Papa=require('papaparse');var Redis=require(_0xfc4f('0xe'));var authService=require(_0xfc4f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfc4f('0x10'));var hardwareService=require(_0xfc4f('0x11'));var logger=require(_0xfc4f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfc4f('0x13'));var licenseUtil=require(_0xfc4f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x163953,_0xaf6ec3){_0xaf6ec3=_0xaf6ec3||0xcc;return function(_0x58f6b7){if(_0x58f6b7){return _0x163953[_0xfc4f('0x15')](_0xaf6ec3);}return _0x163953[_0xfc4f('0x16')](_0xaf6ec3)[_0xfc4f('0x17')]();};}function respondWithResult(_0x4c36a1,_0x387e52){_0x387e52=_0x387e52||0xc8;return function(_0x21fc2a){if(_0x21fc2a){return _0x4c36a1[_0xfc4f('0x16')](_0x387e52)[_0xfc4f('0x18')](_0x21fc2a);}};}function respondWithFilteredResult(_0x1366ae,_0x1e6227){return function(_0x40386f){if(_0x40386f){var _0x6d827c=typeof _0x1e6227[_0xfc4f('0x19')]===_0xfc4f('0x1a')&&typeof _0x1e6227[_0xfc4f('0x1b')]===_0xfc4f('0x1a');var _0x9a5cdc=_0x40386f[_0xfc4f('0x1c')];var _0x241f36=_0x6d827c?0x0:_0x1e6227[_0xfc4f('0x19')];var _0xe9baa0=_0x6d827c?_0x40386f[_0xfc4f('0x1c')]:_0x1e6227[_0xfc4f('0x19')]+_0x1e6227[_0xfc4f('0x1b')];var _0x52df78;if(_0xe9baa0>=_0x9a5cdc){_0xe9baa0=_0x9a5cdc;_0x52df78=0xc8;}else{_0x52df78=0xce;}_0x1366ae[_0xfc4f('0x16')](_0x52df78);return _0x1366ae[_0xfc4f('0x1d')](_0xfc4f('0x1e'),_0x241f36+'-'+_0xe9baa0+'/'+_0x9a5cdc)[_0xfc4f('0x18')](_0x40386f);}return null;};}function patchUpdates(_0xab72c0){return function(_0x3cea55){try{jsonpatch[_0xfc4f('0x1f')](_0x3cea55,_0xab72c0,!![]);}catch(_0x2b5dbc){return BPromise[_0xfc4f('0x20')](_0x2b5dbc);}return _0x3cea55['save']();};}function saveUpdates(_0x5aa1e0,_0x41dac8){return function(_0x59825a){if(_0x59825a){return _0x59825a[_0xfc4f('0x21')](_0x5aa1e0)[_0xfc4f('0x22')](function(_0x1deed7){return _0x1deed7;});}return null;};}function removeEntity(_0x4d1b36,_0xf7dd2f){return function(_0x430ce8){if(_0x430ce8){return _0x430ce8[_0xfc4f('0x23')]()[_0xfc4f('0x22')](function(){_0x4d1b36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e27e,_0x2cee2b){return function(_0x127885){if(!_0x127885){_0x58e27e[_0xfc4f('0x15')](0x194);}return _0x127885;};}function handleError(_0x23e3db,_0x430f14){_0x430f14=_0x430f14||0x1f4;return function(_0x57907f){logger[_0xfc4f('0x24')](_0x57907f[_0xfc4f('0x25')]);if(_0x57907f[_0xfc4f('0x26')]){delete _0x57907f[_0xfc4f('0x26')];}_0x23e3db[_0xfc4f('0x16')](_0x430f14)['send'](_0x57907f);};}exports[_0xfc4f('0x27')]=function(_0x159535,_0x98dfd2){var _0x3dfccd={},_0x218398={},_0xcd34d3={'count':0x0,'rows':[]};var _0x5b701e=_['map'](db[_0xfc4f('0x28')][_0xfc4f('0x29')],function(_0x54a167){return{'name':_0x54a167[_0xfc4f('0x2a')],'type':_0x54a167[_0xfc4f('0x2b')][_0xfc4f('0x2c')]};});_0x218398['model']=_[_0xfc4f('0x2d')](_0x5b701e,_0xfc4f('0x26'));_0x218398[_0xfc4f('0x2e')]=_[_0xfc4f('0x2f')](_0x159535[_0xfc4f('0x2e')]);_0x218398[_0xfc4f('0x30')]=_[_0xfc4f('0x31')](_0x218398['model'],_0x218398[_0xfc4f('0x2e')]);_0x3dfccd[_0xfc4f('0x32')]=_[_0xfc4f('0x31')](_0x218398[_0xfc4f('0x33')],qs[_0xfc4f('0x34')](_0x159535[_0xfc4f('0x2e')][_0xfc4f('0x34')]));_0x3dfccd[_0xfc4f('0x32')]=_0x3dfccd['attributes']['length']?_0x3dfccd[_0xfc4f('0x32')]:_0x218398[_0xfc4f('0x33')];if(!_0x159535[_0xfc4f('0x2e')][_0xfc4f('0x35')]('nolimit')){_0x3dfccd[_0xfc4f('0x1b')]=qs[_0xfc4f('0x1b')](_0x159535[_0xfc4f('0x2e')][_0xfc4f('0x1b')]);_0x3dfccd[_0xfc4f('0x19')]=qs[_0xfc4f('0x19')](_0x159535['query'][_0xfc4f('0x19')]);}_0x3dfccd[_0xfc4f('0x36')]=qs[_0xfc4f('0x37')](_0x159535['query'][_0xfc4f('0x37')]);_0x3dfccd['where']=qs['filters'](_[_0xfc4f('0x38')](_0x159535[_0xfc4f('0x2e')],_0x218398[_0xfc4f('0x30')]),_0x5b701e);if(_0x159535[_0xfc4f('0x2e')]['filter']){_0x3dfccd[_0xfc4f('0x39')]=_[_0xfc4f('0x3a')](_0x3dfccd[_0xfc4f('0x39')],{'$or':_[_0xfc4f('0x2d')](_0x5b701e,function(_0x19fb79){if(_0x19fb79['type']!==_0xfc4f('0x3b')){var _0x6fcd8d={};_0x6fcd8d[_0x19fb79[_0xfc4f('0x26')]]={'$like':'%'+_0x159535[_0xfc4f('0x2e')][_0xfc4f('0x3c')]+'%'};return _0x6fcd8d;}})});}_0x3dfccd=_[_0xfc4f('0x3a')]({},_0x3dfccd,_0x159535['options']);var _0x302a75={'where':_0x3dfccd[_0xfc4f('0x39')]};return db[_0xfc4f('0x28')][_0xfc4f('0x1c')](_0x302a75)[_0xfc4f('0x22')](function(_0x3d9450){_0xcd34d3[_0xfc4f('0x1c')]=_0x3d9450;if(_0x159535[_0xfc4f('0x2e')]['includeAll']){_0x3dfccd[_0xfc4f('0x3d')]=[{'all':!![]}];}return db[_0xfc4f('0x28')][_0xfc4f('0x3e')](_0x3dfccd);})[_0xfc4f('0x22')](function(_0x597b83){_0xcd34d3[_0xfc4f('0x3f')]=_0x597b83;return _0xcd34d3;})[_0xfc4f('0x22')](respondWithFilteredResult(_0x98dfd2,_0x3dfccd))[_0xfc4f('0x40')](handleError(_0x98dfd2,null));};exports[_0xfc4f('0x41')]=function(_0x28557a,_0x27b96d){var _0x1d144f={'raw':![],'where':{'id':_0x28557a[_0xfc4f('0x42')]['id']}},_0x4f1d1c={};_0x4f1d1c['model']=_[_0xfc4f('0x2f')](db[_0xfc4f('0x28')][_0xfc4f('0x29')]);_0x4f1d1c['query']=_[_0xfc4f('0x2f')](_0x28557a[_0xfc4f('0x2e')]);_0x4f1d1c[_0xfc4f('0x30')]=_[_0xfc4f('0x31')](_0x4f1d1c['model'],_0x4f1d1c[_0xfc4f('0x2e')]);_0x1d144f[_0xfc4f('0x32')]=_[_0xfc4f('0x31')](_0x4f1d1c[_0xfc4f('0x33')],qs['fields'](_0x28557a[_0xfc4f('0x2e')][_0xfc4f('0x34')]));_0x1d144f[_0xfc4f('0x32')]=_0x1d144f['attributes'][_0xfc4f('0x43')]?_0x1d144f[_0xfc4f('0x32')]:_0x4f1d1c[_0xfc4f('0x33')];if(_0x28557a[_0xfc4f('0x2e')]['includeAll']){_0x1d144f[_0xfc4f('0x3d')]=[{'all':!![]}];}_0x1d144f=_['merge']({},_0x1d144f,_0x28557a[_0xfc4f('0x44')]);return db[_0xfc4f('0x28')]['find'](_0x1d144f)[_0xfc4f('0x22')](handleEntityNotFound(_0x27b96d,null))[_0xfc4f('0x22')](respondWithResult(_0x27b96d,null))[_0xfc4f('0x40')](handleError(_0x27b96d,null));};exports['create']=function(_0x1fbdd5,_0x13f6fc){return db[_0xfc4f('0x28')][_0xfc4f('0x45')](_0x1fbdd5[_0xfc4f('0x46')],{})[_0xfc4f('0x22')](respondWithResult(_0x13f6fc,0xc9))['catch'](handleError(_0x13f6fc,null));};exports[_0xfc4f('0x21')]=function(_0x3bacca,_0x481115){if(_0x3bacca[_0xfc4f('0x46')]['id']){delete _0x3bacca[_0xfc4f('0x46')]['id'];}return db['UserProfileSection'][_0xfc4f('0x47')]({'where':{'id':_0x3bacca[_0xfc4f('0x42')]['id']}})[_0xfc4f('0x22')](handleEntityNotFound(_0x481115,null))['then'](saveUpdates(_0x3bacca['body'],null))[_0xfc4f('0x22')](respondWithResult(_0x481115,null))[_0xfc4f('0x40')](handleError(_0x481115,null));};exports['destroy']=function(_0x184dcd,_0x46d478){return db[_0xfc4f('0x28')][_0xfc4f('0x47')]({'where':{'id':_0x184dcd[_0xfc4f('0x42')]['id']}})['then'](handleEntityNotFound(_0x46d478,null))[_0xfc4f('0x22')](removeEntity(_0x46d478,null))['catch'](handleError(_0x46d478,null));};exports['describe']=function(_0x1f6120,_0xc811f8){return db[_0xfc4f('0x28')][_0xfc4f('0x48')]()[_0xfc4f('0x22')](respondWithResult(_0xc811f8,null))['catch'](handleError(_0xc811f8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 3ae6fbb..c580053 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 _0xf466=['moment','bluebird','path','../../config/environment','exports','user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','api'];(function(_0x94cfd7,_0xaab212){var _0x3d88aa=function(_0x41ce85){while(--_0x41ce85){_0x94cfd7['push'](_0x94cfd7['shift']());}};_0x3d88aa(++_0xaab212);}(_0xf466,0x110));var _0x6f46=function(_0x7a0496,_0x3b4dbc){_0x7a0496=_0x7a0496-0x0;var _0x4d5a25=_0xf466[_0x7a0496];return _0x4d5a25;};'use strict';var _=require(_0x6f46('0x0'));var util=require('util');var logger=require(_0x6f46('0x1'))(_0x6f46('0x2'));var moment=require(_0x6f46('0x3'));var BPromise=require(_0x6f46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f46('0x5'));var rimraf=require('rimraf');var config=require(_0x6f46('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x6f46('0x7')]=function(_0x3976d7,_0xef0c2d){return _0x3976d7['define']('UserProfileSection',attributes,{'tableName':_0x6f46('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6f46('0x9'),_0x6f46('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2732=['moment','request-promise','path','rimraf','../../config/environment','exports','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','util','api'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x2732,0x112));var _0x2273=function(_0x5f03e8,_0x33075e){_0x5f03e8=_0x5f03e8-0x0;var _0x5d9c9c=_0x2732[_0x5f03e8];return _0x5d9c9c;};'use strict';var _=require('lodash');var util=require(_0x2273('0x0'));var logger=require('../../config/logger')(_0x2273('0x1'));var moment=require(_0x2273('0x2'));var BPromise=require('bluebird');var rp=require(_0x2273('0x3'));var fs=require('fs');var path=require(_0x2273('0x4'));var rimraf=require(_0x2273('0x5'));var config=require(_0x2273('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x2273('0x7')]=function(_0x3c1940,_0xbe1a19){return _0x3c1940['define'](_0x2273('0x8'),attributes,{'tableName':_0x2273('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x2273('0xa'),_0x2273('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1167692..85ec766 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 _0xe52b=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe52b,0x11a));var _0xbe52=function(_0x492c4e,_0xae9e96){_0x492c4e=_0x492c4e-0x0;var _0x1d1ade=_0xe52b[_0x492c4e];return _0x1d1ade;};'use strict';var _=require(_0xbe52('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe52('0x1'));var fs=require('fs');var Redis=require(_0xbe52('0x2'));var db=require(_0xbe52('0x3'))['db'];var utils=require(_0xbe52('0x4'));var logger=require('../../config/logger')(_0xbe52('0x5'));var config=require('../../config/environment');var jayson=require(_0xbe52('0x6'));var client=jayson[_0xbe52('0x7')][_0xbe52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x379e1d,_0x5594af,_0x41bf76){return new BPromise(function(_0x310c3f,_0x329d9f){return client[_0xbe52('0x9')](_0x379e1d,_0x41bf76)['then'](function(_0x255657){logger[_0xbe52('0xa')](_0xbe52('0xb'),_0x5594af,'request\x20sent');logger[_0xbe52('0xc')](_0xbe52('0xd'),_0x5594af,_0xbe52('0xe'),JSON[_0xbe52('0xf')](_0x255657));if(_0x255657[_0xbe52('0x10')]){if(_0x255657[_0xbe52('0x10')][_0xbe52('0x11')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5594af,_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);return _0x329d9f(_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);}logger[_0xbe52('0x10')](_0xbe52('0xb'),_0x5594af,_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);return _0x310c3f(_0x255657['error'][_0xbe52('0x12')]);}else{logger[_0xbe52('0xa')](_0xbe52('0xb'),_0x5594af,_0xbe52('0xe'));_0x310c3f(_0x255657[_0xbe52('0x13')][_0xbe52('0x12')]);}})[_0xbe52('0x14')](function(_0x3aea2f){logger[_0xbe52('0x10')](_0xbe52('0xb'),_0x5594af,_0x3aea2f);_0x329d9f(_0x3aea2f);});});} \ No newline at end of file +var _0xef6d=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51d691,_0x559a81){var _0x564552=function(_0x192dc8){while(--_0x192dc8){_0x51d691['push'](_0x51d691['shift']());}};_0x564552(++_0x559a81);}(_0xef6d,0x12c));var _0xdef6=function(_0x77149d,_0x2e8d8a){_0x77149d=_0x77149d-0x0;var _0x86e543=_0xef6d[_0x77149d];return _0x86e543;};'use strict';var _=require('lodash');var util=require(_0xdef6('0x0'));var moment=require(_0xdef6('0x1'));var BPromise=require('bluebird');var rs=require(_0xdef6('0x2'));var fs=require('fs');var Redis=require(_0xdef6('0x3'));var db=require(_0xdef6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdef6('0x5'))(_0xdef6('0x6'));var config=require(_0xdef6('0x7'));var jayson=require(_0xdef6('0x8'));var client=jayson['client'][_0xdef6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35b512,_0x2401f8,_0x1a5979){return new BPromise(function(_0x4f7f24,_0x39e6cf){return client['request'](_0x35b512,_0x1a5979)[_0xdef6('0xa')](function(_0x2194b2){logger[_0xdef6('0xb')](_0xdef6('0xc'),_0x2401f8,_0xdef6('0xd'));logger[_0xdef6('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2401f8,_0xdef6('0xd'),JSON[_0xdef6('0xf')](_0x2194b2));if(_0x2194b2[_0xdef6('0x10')]){if(_0x2194b2[_0xdef6('0x10')][_0xdef6('0x11')]===0x1f4){logger[_0xdef6('0x10')](_0xdef6('0xc'),_0x2401f8,_0x2194b2['error'][_0xdef6('0x12')]);return _0x39e6cf(_0x2194b2[_0xdef6('0x10')][_0xdef6('0x12')]);}logger[_0xdef6('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2401f8,_0x2194b2[_0xdef6('0x10')]['message']);return _0x4f7f24(_0x2194b2[_0xdef6('0x10')]['message']);}else{logger[_0xdef6('0xb')](_0xdef6('0xc'),_0x2401f8,_0xdef6('0xd'));_0x4f7f24(_0x2194b2[_0xdef6('0x13')][_0xdef6('0x12')]);}})[_0xdef6('0x14')](function(_0x477eb7){logger[_0xdef6('0x10')](_0xdef6('0xc'),_0x2401f8,_0x477eb7);_0x39e6cf(_0x477eb7);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 94acd4b..5261ab2 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xa22583,_0x564cdd){var _0x3e2d07=function(_0x56520a){while(--_0x56520a){_0xa22583['push'](_0xa22583['shift']());}};_0x3e2d07(++_0x564cdd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x34882f,_0x601a99){var _0x455929=function(_0x463c7c){while(--_0x463c7c){_0x34882f['push'](_0x34882f['shift']());}};_0x455929(++_0x601a99);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 967b739..9e3b606 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 _0xbc1c=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xbc1c[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require('sequelize');module[_0xcbc1('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbd06=['exports','INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbd06,0x98));var _0x6bd0=function(_0x38313f,_0x31f6ab){_0x38313f=_0x38313f-0x0;var _0x3255c8=_0xbd06[_0x38313f];return _0x3255c8;};'use strict';var Sequelize=require('sequelize');module[_0x6bd0('0x0')]={'penalty':{'type':Sequelize[_0x6bd0('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 e412cc6..bf7c5a6 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 _0x8085=['define','UserSmsQueue','user_has_sms_queues','lodash','api','moment','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes'];(function(_0x22e11c,_0x32ef49){var _0x4fd8ed=function(_0x1098b7){while(--_0x1098b7){_0x22e11c['push'](_0x22e11c['shift']());}};_0x4fd8ed(++_0x32ef49);}(_0x8085,0x71));var _0x5808=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x8085[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5808('0x1'));var moment=require(_0x5808('0x2'));var BPromise=require(_0x5808('0x3'));var rp=require(_0x5808('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5808('0x5'));var attributes=require(_0x5808('0x6'));module['exports']=function(_0x17f899,_0x749306){return _0x17f899[_0x5808('0x7')](_0x5808('0x8'),attributes,{'tableName':_0x5808('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x964b=['util','api','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x38e870,_0x3d2e6a){var _0x2dabbe=function(_0x3ddea3){while(--_0x3ddea3){_0x38e870['push'](_0x38e870['shift']());}};_0x2dabbe(++_0x3d2e6a);}(_0x964b,0x112));var _0xb964=function(_0x2577ab,_0x29d56d){_0x2577ab=_0x2577ab-0x0;var _0x3185a6=_0x964b[_0x2577ab];return _0x3185a6;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index cd10fd1..c1d432c 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 _0xb351=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','request\x20sent','result','lodash'];(function(_0x1fda27,_0x18fa92){var _0x477640=function(_0x347bf){while(--_0x347bf){_0x1fda27['push'](_0x1fda27['shift']());}};_0x477640(++_0x18fa92);}(_0xb351,0x1cd));var _0x1b35=function(_0x1fc454,_0x47e609){_0x1fc454=_0x1fc454-0x0;var _0x1a7994=_0xb351[_0x1fc454];return _0x1a7994;};'use strict';var _=require(_0x1b35('0x0'));var util=require('util');var moment=require(_0x1b35('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b35('0x2'));var fs=require('fs');var Redis=require(_0x1b35('0x3'));var db=require(_0x1b35('0x4'))['db'];var utils=require(_0x1b35('0x5'));var logger=require(_0x1b35('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1b35('0x7'));var client=jayson[_0x1b35('0x8')][_0x1b35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bcceb,_0x5e2904,_0x1f0a1f){return new BPromise(function(_0x2e944b,_0x319c7a){return client[_0x1b35('0xa')](_0x2bcceb,_0x1f0a1f)[_0x1b35('0xb')](function(_0xb4db03){logger[_0x1b35('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x5e2904,'request\x20sent');logger[_0x1b35('0xd')](_0x1b35('0xe'),_0x5e2904,'request\x20sent',JSON[_0x1b35('0xf')](_0xb4db03));if(_0xb4db03[_0x1b35('0x10')]){if(_0xb4db03[_0x1b35('0x10')][_0x1b35('0x11')]===0x1f4){logger[_0x1b35('0x10')](_0x1b35('0x12'),_0x5e2904,_0xb4db03[_0x1b35('0x10')]['message']);return _0x319c7a(_0xb4db03[_0x1b35('0x10')][_0x1b35('0x13')]);}logger[_0x1b35('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x5e2904,_0xb4db03['error'][_0x1b35('0x13')]);return _0x2e944b(_0xb4db03[_0x1b35('0x10')]['message']);}else{logger[_0x1b35('0xc')](_0x1b35('0x12'),_0x5e2904,_0x1b35('0x14'));_0x2e944b(_0xb4db03[_0x1b35('0x15')]['message']);}})['catch'](function(_0x378421){logger[_0x1b35('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x5e2904,_0x378421);_0x319c7a(_0x378421);});});} \ No newline at end of file +var _0x7f9c=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x36a6e6,_0x189ec4){var _0x4559d6=function(_0x93da28){while(--_0x93da28){_0x36a6e6['push'](_0x36a6e6['shift']());}};_0x4559d6(++_0x189ec4);}(_0x7f9c,0x1cf));var _0xc7f9=function(_0x18f702,_0x354b61){_0x18f702=_0x18f702-0x0;var _0xe37bad=_0x7f9c[_0x18f702];return _0xe37bad;};'use strict';var _=require(_0xc7f9('0x0'));var util=require(_0xc7f9('0x1'));var moment=require(_0xc7f9('0x2'));var BPromise=require('bluebird');var rs=require(_0xc7f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7f9('0x4'))['db'];var utils=require(_0xc7f9('0x5'));var logger=require(_0xc7f9('0x6'))(_0xc7f9('0x7'));var config=require(_0xc7f9('0x8'));var jayson=require(_0xc7f9('0x9'));var client=jayson[_0xc7f9('0xa')][_0xc7f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bf291,_0x181929,_0x5736dd){return new BPromise(function(_0x320cc7,_0x2d8cae){return client[_0xc7f9('0xc')](_0x4bf291,_0x5736dd)[_0xc7f9('0xd')](function(_0x31ab01){logger[_0xc7f9('0xe')](_0xc7f9('0xf'),_0x181929,_0xc7f9('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x181929,_0xc7f9('0x10'),JSON[_0xc7f9('0x11')](_0x31ab01));if(_0x31ab01[_0xc7f9('0x12')]){if(_0x31ab01[_0xc7f9('0x12')][_0xc7f9('0x13')]===0x1f4){logger[_0xc7f9('0x12')](_0xc7f9('0xf'),_0x181929,_0x31ab01[_0xc7f9('0x12')][_0xc7f9('0x14')]);return _0x2d8cae(_0x31ab01[_0xc7f9('0x12')][_0xc7f9('0x14')]);}logger[_0xc7f9('0x12')](_0xc7f9('0xf'),_0x181929,_0x31ab01[_0xc7f9('0x12')][_0xc7f9('0x14')]);return _0x320cc7(_0x31ab01['error'][_0xc7f9('0x14')]);}else{logger[_0xc7f9('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x181929,_0xc7f9('0x10'));_0x320cc7(_0x31ab01[_0xc7f9('0x15')][_0xc7f9('0x14')]);}})[_0xc7f9('0x16')](function(_0x4d9e9a){logger['error'](_0xc7f9('0xf'),_0x181929,_0x4d9e9a);_0x2d8cae(_0x4d9e9a);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index d6e2a33..ee8c271 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 _0xda99=['sequelize','exports','INTEGER'];(function(_0x1af909,_0x422cba){var _0x24ec10=function(_0x48a334){while(--_0x48a334){_0x1af909['push'](_0x1af909['shift']());}};_0x24ec10(++_0x422cba);}(_0xda99,0x17a));var _0x9da9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda99[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9da9('0x0'));module[_0x9da9('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x9da9('0x2')]}}; \ No newline at end of file +var _0x9f2c=['exports','INTEGER','sequelize'];(function(_0x52af3f,_0x254cd8){var _0x4d496a=function(_0x2f8d40){while(--_0x2f8d40){_0x52af3f['push'](_0x52af3f['shift']());}};_0x4d496a(++_0x254cd8);}(_0x9f2c,0x155));var _0xc9f2=function(_0x58b900,_0x4067f4){_0x58b900=_0x58b900-0x0;var _0x142565=_0x9f2c[_0x58b900];return _0x142565;};'use strict';var Sequelize=require(_0xc9f2('0x0'));module[_0xc9f2('0x1')]={'UserId':{'type':Sequelize[_0xc9f2('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 3419599..2bd6282 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(_0x590796,_0x2e4436){var _0x16e0a6=function(_0x5cea16){while(--_0x5cea16){_0x590796['push'](_0x590796['shift']());}};_0x16e0a6(++_0x2e4436);}(_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 +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x170b55,_0xf3245a){var _0x23e3c0=function(_0x2d6dea){while(--_0x2d6dea){_0x170b55['push'](_0x170b55['shift']());}};_0x23e3c0(++_0xf3245a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 1dd81e2..5bbf251 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(_0x2e4574,_0x2e7660){var _0x15d5a5=function(_0x3e0df7){while(--_0x3e0df7){_0x2e4574['push'](_0x2e4574['shift']());}};_0x15d5a5(++_0x2e7660);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x56e6c6,_0x4486ce){var _0x21547e=function(_0x5f0730){while(--_0x5f0730){_0x56e6c6['push'](_0x56e6c6['shift']());}};_0x21547e(++_0x4486ce);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index a29eed1..749559c 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 _0x048f=['exports'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x048f,0x1e4));var _0xf048=function(_0x174ed5,_0x2c06ff){_0x174ed5=_0x174ed5-0x0;var _0x6af1f6=_0x048f[_0x174ed5];return _0x6af1f6;};'use strict';var Sequelize=require('sequelize');module[_0xf048('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2080=['sequelize','exports'];(function(_0x504221,_0x59d9a9){var _0x114c4e=function(_0x3ce03f){while(--_0x3ce03f){_0x504221['push'](_0x504221['shift']());}};_0x114c4e(++_0x59d9a9);}(_0x2080,0x1c6));var _0x0208=function(_0x3abf39,_0x2a8ca5){_0x3abf39=_0x3abf39-0x0;var _0x447491=_0x2080[_0x3abf39];return _0x447491;};'use strict';var Sequelize=require(_0x0208('0x0'));module[_0x0208('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index eeaebd5..491648b 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 _0x9fe2=['exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes'];(function(_0x5723e4,_0x2231b1){var _0x2819e4=function(_0x433e95){while(--_0x433e95){_0x5723e4['push'](_0x5723e4['shift']());}};_0x2819e4(++_0x2231b1);}(_0x9fe2,0x196));var _0x29fe=function(_0x5de258,_0x568c2b){_0x5de258=_0x5de258-0x0;var _0x5e1705=_0x9fe2[_0x5de258];return _0x5e1705;};'use strict';var _=require(_0x29fe('0x0'));var util=require(_0x29fe('0x1'));var logger=require(_0x29fe('0x2'))(_0x29fe('0x3'));var moment=require(_0x29fe('0x4'));var BPromise=require(_0x29fe('0x5'));var rp=require(_0x29fe('0x6'));var fs=require('fs');var path=require(_0x29fe('0x7'));var rimraf=require(_0x29fe('0x8'));var config=require('../../config/environment');var attributes=require(_0x29fe('0x9'));module[_0x29fe('0xa')]=function(_0x19190e,_0x4e0d8b){return _0x19190e[_0x29fe('0xb')](_0x29fe('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7f5=['request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4933b3,_0x34d834){var _0x1f81c1=function(_0x582fd9){while(--_0x582fd9){_0x4933b3['push'](_0x4933b3['shift']());}};_0x1f81c1(++_0x34d834);}(_0xe7f5,0x97));var _0x5e7f=function(_0x4c462e,_0x4bd48c){_0x4c462e=_0x4c462e-0x0;var _0x5133cd=_0xe7f5[_0x4c462e];return _0x5133cd;};'use strict';var _=require(_0x5e7f('0x0'));var util=require('util');var logger=require(_0x5e7f('0x1'))(_0x5e7f('0x2'));var moment=require(_0x5e7f('0x3'));var BPromise=require(_0x5e7f('0x4'));var rp=require(_0x5e7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e7f('0x6'));var config=require(_0x5e7f('0x7'));var attributes=require(_0x5e7f('0x8'));module['exports']=function(_0x59ba22,_0x44192e){return _0x59ba22[_0x5e7f('0x9')](_0x5e7f('0xa'),attributes,{'tableName':_0x5e7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5085e18..f9c31df 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 _0x5e65=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x41d184,_0xd9177c){var _0x1c2ba2=function(_0x54ecaf){while(--_0x54ecaf){_0x41d184['push'](_0x41d184['shift']());}};_0x1c2ba2(++_0xd9177c);}(_0x5e65,0x1c8));var _0x55e6=function(_0x183068,_0x5e9c83){_0x183068=_0x183068-0x0;var _0x2d2f83=_0x5e65[_0x183068];return _0x2d2f83;};'use strict';var _=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var moment=require('moment');var BPromise=require(_0x55e6('0x2'));var rs=require(_0x55e6('0x3'));var fs=require('fs');var Redis=require(_0x55e6('0x4'));var db=require(_0x55e6('0x5'))['db'];var utils=require(_0x55e6('0x6'));var logger=require(_0x55e6('0x7'))('rpc');var config=require(_0x55e6('0x8'));var jayson=require(_0x55e6('0x9'));var client=jayson[_0x55e6('0xa')][_0x55e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16ef52,_0x3e6e27,_0x5a5a5d){return new BPromise(function(_0x3263c4,_0x12418a){return client[_0x55e6('0xc')](_0x16ef52,_0x5a5a5d)[_0x55e6('0xd')](function(_0xb8b914){logger[_0x55e6('0xe')](_0x55e6('0xf'),_0x3e6e27,_0x55e6('0x10'));logger[_0x55e6('0x11')](_0x55e6('0x12'),_0x3e6e27,_0x55e6('0x10'),JSON[_0x55e6('0x13')](_0xb8b914));if(_0xb8b914[_0x55e6('0x14')]){if(_0xb8b914[_0x55e6('0x14')]['code']===0x1f4){logger['error'](_0x55e6('0xf'),_0x3e6e27,_0xb8b914[_0x55e6('0x14')]['message']);return _0x12418a(_0xb8b914['error'][_0x55e6('0x15')]);}logger['error'](_0x55e6('0xf'),_0x3e6e27,_0xb8b914[_0x55e6('0x14')][_0x55e6('0x15')]);return _0x3263c4(_0xb8b914[_0x55e6('0x14')][_0x55e6('0x15')]);}else{logger['info'](_0x55e6('0xf'),_0x3e6e27,_0x55e6('0x10'));_0x3263c4(_0xb8b914[_0x55e6('0x16')]['message']);}})[_0x55e6('0x17')](function(_0x50631d){logger[_0x55e6('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x3e6e27,_0x50631d);_0x12418a(_0x50631d);});});} \ No newline at end of file +var _0xfe43=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfe43,0x166));var _0x3fe4=function(_0x3c918a,_0x5ef50e){_0x3c918a=_0x3c918a-0x0;var _0x480bf3=_0xfe43[_0x3c918a];return _0x480bf3;};'use strict';var _=require(_0x3fe4('0x0'));var util=require(_0x3fe4('0x1'));var moment=require(_0x3fe4('0x2'));var BPromise=require(_0x3fe4('0x3'));var rs=require(_0x3fe4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fe4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fe4('0x6'))(_0x3fe4('0x7'));var config=require(_0x3fe4('0x8'));var jayson=require(_0x3fe4('0x9'));var client=jayson[_0x3fe4('0xa')][_0x3fe4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ca5bb,_0x20db9b,_0x20ee5c){return new BPromise(function(_0x49c5d0,_0x4dccbe){return client[_0x3fe4('0xc')](_0x5ca5bb,_0x20ee5c)[_0x3fe4('0xd')](function(_0x4b7cfa){logger[_0x3fe4('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x20db9b,_0x3fe4('0xf'));logger['debug'](_0x3fe4('0x10'),_0x20db9b,_0x3fe4('0xf'),JSON['stringify'](_0x4b7cfa));if(_0x4b7cfa[_0x3fe4('0x11')]){if(_0x4b7cfa[_0x3fe4('0x11')]['code']===0x1f4){logger[_0x3fe4('0x11')](_0x3fe4('0x12'),_0x20db9b,_0x4b7cfa[_0x3fe4('0x11')][_0x3fe4('0x13')]);return _0x4dccbe(_0x4b7cfa['error'][_0x3fe4('0x13')]);}logger[_0x3fe4('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x20db9b,_0x4b7cfa[_0x3fe4('0x11')][_0x3fe4('0x13')]);return _0x49c5d0(_0x4b7cfa[_0x3fe4('0x11')]['message']);}else{logger[_0x3fe4('0xe')](_0x3fe4('0x12'),_0x20db9b,_0x3fe4('0xf'));_0x49c5d0(_0x4b7cfa[_0x3fe4('0x14')][_0x3fe4('0x13')]);}})[_0x3fe4('0x15')](function(_0x56d8e3){logger[_0x3fe4('0x11')](_0x3fe4('0x12'),_0x20db9b,_0x56d8e3);_0x4dccbe(_0x56d8e3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2d40f86..ad992a9 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1cab3a,_0x283214){var _0x1b1c76=function(_0x3cfb45){while(--_0x3cfb45){_0x1cab3a['push'](_0x1cab3a['shift']());}};_0x1b1c76(++_0x283214);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x292427,_0x5dc5d1){var _0x1e5629=function(_0xeb9913){while(--_0xeb9913){_0x292427['push'](_0x292427['shift']());}};_0x1e5629(++_0x5dc5d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index de6e3a6..9777934 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 _0x9269=['INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk','exports'];(function(_0x20823b,_0x88604f){var _0x4a7a50=function(_0x5a8890){while(--_0x5a8890){_0x20823b['push'](_0x20823b['shift']());}};_0x4a7a50(++_0x88604f);}(_0x9269,0x1e9));var _0x9926=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x9269[_0x540dcb];return _0x49353c;};'use strict';var Sequelize=require('sequelize');module[_0x9926('0x0')]={'uniqueid':{'type':Sequelize[_0x9926('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x9926('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x9926('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9926('0x2')],'allowNull':![],'unique':_0x9926('0x3'),'comment':_0x9926('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9926('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x9926('0x2')],'allowNull':![],'unique':_0x9926('0x3'),'comment':_0x9926('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x9926('0x4')},'paused':{'type':Sequelize[_0x9926('0x1')](0xb),'defaultValue':0x0,'comment':_0x9926('0x4')}}; \ No newline at end of file +var _0xeff1=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xeff1,0x198));var _0x1eff=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xeff1[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0x1eff('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1eff('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1eff('0x2')},'membername':{'type':Sequelize[_0x1eff('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x1eff('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x1eff('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x1eff('0x3')],'allowNull':![],'unique':_0x1eff('0x4'),'comment':_0x1eff('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1eff('0x2')},'paused':{'type':Sequelize[_0x1eff('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index bf4b780..0ec8efe 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 _0xe386=['update','emit','hasOwnProperty','hook','UserVoiceQueueRt','save'];(function(_0x58258f,_0x51e2d3){var _0x397e0b=function(_0x3bf712){while(--_0x3bf712){_0x58258f['push'](_0x58258f['shift']());}};_0x397e0b(++_0x51e2d3);}(_0xe386,0x70));var _0x6e38=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe386[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x6e38('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e38('0x1'),'afterUpdate':_0x6e38('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1acf9c){return function(_0x47c640,_0x4d50b6,_0x1d5e45){UserVoiceQueueRtEvents[_0x6e38('0x3')](_0x1acf9c+':'+_0x47c640['id'],_0x47c640);UserVoiceQueueRtEvents[_0x6e38('0x3')](_0x1acf9c,_0x47c640);_0x1d5e45(null);};}for(var e in events){if(events[_0x6e38('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x6e38('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd45f=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','update'];(function(_0x243d5e,_0x23718){var _0x3092c1=function(_0x16cdc3){while(--_0x16cdc3){_0x243d5e['push'](_0x243d5e['shift']());}};_0x3092c1(++_0x23718);}(_0xd45f,0xa4));var _0xfd45=function(_0x39c8ea,_0x53e7c1){_0x39c8ea=_0x39c8ea-0x0;var _0xfa2892=_0xd45f[_0x39c8ea];return _0xfa2892;};'use strict';var EventEmitter=require(_0xfd45('0x0'));var UserVoiceQueueRt=require(_0xfd45('0x1'))['db'][_0xfd45('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd45('0x3'),'afterDestroy':_0xfd45('0x4')};function emitEvent(_0x51330c){return function(_0x25c3bc,_0xdb2e59,_0x30b508){UserVoiceQueueRtEvents[_0xfd45('0x5')](_0x51330c+':'+_0x25c3bc['id'],_0x25c3bc);UserVoiceQueueRtEvents[_0xfd45('0x5')](_0x51330c,_0x25c3bc);_0x30b508(null);};}for(var e in events){if(events[_0xfd45('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xfd45('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4f722cb..174f5ea 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 _0x65fd=['request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','util','api','bluebird'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x65fd,0x10b));var _0xd65f=function(_0x1837bb,_0x8b1bf8){_0x1837bb=_0x1837bb-0x0;var _0x20d9da=_0x65fd[_0x1837bb];return _0x20d9da;};'use strict';var _=require('lodash');var util=require(_0xd65f('0x0'));var logger=require('../../config/logger')(_0xd65f('0x1'));var moment=require('moment');var BPromise=require(_0xd65f('0x2'));var rp=require(_0xd65f('0x3'));var fs=require('fs');var path=require(_0xd65f('0x4'));var rimraf=require(_0xd65f('0x5'));var config=require('../../config/environment');var attributes=require(_0xd65f('0x6'));module[_0xd65f('0x7')]=function(_0x48d2d4,_0x2dde7b){return _0x48d2d4[_0xd65f('0x8')](_0xd65f('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x811d=['api','moment','bluebird','request-promise','../../config/environment','exports','define','user_has_voice_queues_rt','util','../../config/logger'];(function(_0x153f57,_0x390473){var _0xe1070b=function(_0x38c04a){while(--_0x38c04a){_0x153f57['push'](_0x153f57['shift']());}};_0xe1070b(++_0x390473);}(_0x811d,0x148));var _0xd811=function(_0x2bac1f,_0x1dba62){_0x2bac1f=_0x2bac1f-0x0;var _0x514736=_0x811d[_0x2bac1f];return _0x514736;};'use strict';var _=require('lodash');var util=require(_0xd811('0x0'));var logger=require(_0xd811('0x1'))(_0xd811('0x2'));var moment=require(_0xd811('0x3'));var BPromise=require(_0xd811('0x4'));var rp=require(_0xd811('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd811('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xd811('0x7')]=function(_0x465607,_0x26a00c){return _0x465607[_0xd811('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xd811('0x9'),'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 dc60a46..af6c9ab 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 _0x160a=['GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','literal','outboundQueuePauses','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x160a,0x1d1));var _0xa160=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x160a[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xa160('0x0'));var util=require('util');var moment=require(_0xa160('0x1'));var BPromise=require(_0xa160('0x2'));var rs=require(_0xa160('0x3'));var fs=require('fs');var Redis=require(_0xa160('0x4'));var db=require(_0xa160('0x5'))['db'];var utils=require(_0xa160('0x6'));var logger=require('../../config/logger')(_0xa160('0x7'));var config=require(_0xa160('0x8'));var jayson=require(_0xa160('0x9'));var client=jayson[_0xa160('0xa')][_0xa160('0xb')]({'port':0x232a});config[_0xa160('0xc')]=_[_0xa160('0xd')](config[_0xa160('0xc')],{'host':_0xa160('0xe'),'port':0x18eb});var socket=require(_0xa160('0xf'))(new Redis(config['redis']));require(_0xa160('0x10'))[_0xa160('0x11')](socket);function respondWithRpcPromise(_0xb944ea,_0x3d8c27,_0x48badf){return new BPromise(function(_0x2b73f4,_0x59b2c2){return client[_0xa160('0x12')](_0xb944ea,_0x48badf)[_0xa160('0x13')](function(_0x367baa){logger[_0xa160('0x14')](_0xa160('0x15'),_0x3d8c27,_0xa160('0x16'));logger[_0xa160('0x17')](_0xa160('0x18'),_0x3d8c27,'request\x20sent',JSON['stringify'](_0x367baa));if(_0x367baa['error']){if(_0x367baa[_0xa160('0x19')][_0xa160('0x1a')]===0x1f4){logger[_0xa160('0x19')](_0xa160('0x15'),_0x3d8c27,_0x367baa[_0xa160('0x19')][_0xa160('0x1b')]);return _0x59b2c2(_0x367baa[_0xa160('0x19')]['message']);}logger[_0xa160('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3d8c27,_0x367baa[_0xa160('0x19')][_0xa160('0x1b')]);return _0x2b73f4(_0x367baa[_0xa160('0x19')][_0xa160('0x1b')]);}else{logger[_0xa160('0x14')](_0xa160('0x15'),_0x3d8c27,_0xa160('0x16'));_0x2b73f4(_0x367baa['result'][_0xa160('0x1b')]);}})[_0xa160('0x1c')](function(_0x14b597){logger[_0xa160('0x19')](_0xa160('0x15'),_0x3d8c27,_0x14b597);_0x59b2c2(_0x14b597);});});}exports[_0xa160('0x1d')]=function(_0x551ce8){var _0x42f715=this;return new Promise(function(_0x5d163d,_0x4b7e58){return db[_0xa160('0x1e')]['findAll']({'raw':_0x551ce8[_0xa160('0x1f')]?_0x551ce8['options'][_0xa160('0x20')]===undefined?!![]:![]:!![],'where':_0x551ce8[_0xa160('0x1f')]?_0x551ce8[_0xa160('0x1f')][_0xa160('0x21')]||null:null,'attributes':[[db[_0xa160('0x22')]['fn']('COUNT',db[_0xa160('0x22')]['fn']('IF',db[_0xa160('0x22')][_0xa160('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xa160('0x24')]]})['then'](function(_0x509aa1){logger[_0xa160('0x14')](_0xa160('0x1d'),_0x551ce8);logger[_0xa160('0x17')](_0xa160('0x1d'),_0x551ce8,JSON[_0xa160('0x25')](_0x509aa1));_0x5d163d(_0x509aa1);})[_0xa160('0x1c')](function(_0x5b975c){logger[_0xa160('0x19')](_0xa160('0x1d'),_0x5b975c['message'],_0x551ce8);_0x4b7e58(_0x42f715[_0xa160('0x19')](0x1f4,_0x5b975c[_0xa160('0x1b')]));});});}; \ No newline at end of file +var _0x3bd7=['./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','GetVoiceQueueRtPauses','debug','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x276c9f,_0x182acf){var _0x2c9305=function(_0x45bfe6){while(--_0x45bfe6){_0x276c9f['push'](_0x276c9f['shift']());}};_0x2c9305(++_0x182acf);}(_0x3bd7,0x87));var _0x73bd=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x3bd7[_0x3c4062];return _0x3f5bf3;};'use strict';var _=require(_0x73bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x73bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73bd('0x2'));var db=require(_0x73bd('0x3'))['db'];var utils=require(_0x73bd('0x4'));var logger=require(_0x73bd('0x5'))(_0x73bd('0x6'));var config=require(_0x73bd('0x7'));var jayson=require(_0x73bd('0x8'));var client=jayson['client'][_0x73bd('0x9')]({'port':0x232a});config[_0x73bd('0xa')]=_['defaults'](config[_0x73bd('0xa')],{'host':_0x73bd('0xb'),'port':0x18eb});var socket=require(_0x73bd('0xc'))(new Redis(config[_0x73bd('0xa')]));require(_0x73bd('0xd'))[_0x73bd('0xe')](socket);function respondWithRpcPromise(_0x27ea58,_0x3d4568,_0x3692e3){return new BPromise(function(_0x4e8efb,_0x271adf){return client[_0x73bd('0xf')](_0x27ea58,_0x3692e3)[_0x73bd('0x10')](function(_0x4d565b){logger[_0x73bd('0x11')](_0x73bd('0x12'),_0x3d4568,_0x73bd('0x13'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3d4568,_0x73bd('0x13'),JSON[_0x73bd('0x14')](_0x4d565b));if(_0x4d565b['error']){if(_0x4d565b[_0x73bd('0x15')][_0x73bd('0x16')]===0x1f4){logger[_0x73bd('0x15')](_0x73bd('0x12'),_0x3d4568,_0x4d565b[_0x73bd('0x15')][_0x73bd('0x17')]);return _0x271adf(_0x4d565b[_0x73bd('0x15')][_0x73bd('0x17')]);}logger[_0x73bd('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3d4568,_0x4d565b[_0x73bd('0x15')][_0x73bd('0x17')]);return _0x4e8efb(_0x4d565b[_0x73bd('0x15')][_0x73bd('0x17')]);}else{logger[_0x73bd('0x11')](_0x73bd('0x12'),_0x3d4568,_0x73bd('0x13'));_0x4e8efb(_0x4d565b[_0x73bd('0x18')][_0x73bd('0x17')]);}})['catch'](function(_0x3eeea8){logger[_0x73bd('0x15')](_0x73bd('0x12'),_0x3d4568,_0x3eeea8);_0x271adf(_0x3eeea8);});});}exports['GetVoiceQueueRtPauses']=function(_0x40846d){var _0x2b37a5=this;return new Promise(function(_0x25494b,_0x5e2f35){return db[_0x73bd('0x19')][_0x73bd('0x1a')]({'raw':_0x40846d['options']?_0x40846d[_0x73bd('0x1b')][_0x73bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x40846d['options']?_0x40846d[_0x73bd('0x1b')][_0x73bd('0x1d')]||null:null,'attributes':[[db[_0x73bd('0x1e')]['fn'](_0x73bd('0x1f'),db['sequelize']['fn']('IF',db[_0x73bd('0x1e')][_0x73bd('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0x73bd('0x21')]]})['then'](function(_0x1184b8){logger['info'](_0x73bd('0x22'),_0x40846d);logger[_0x73bd('0x23')]('GetVoiceQueueRtPauses',_0x40846d,JSON[_0x73bd('0x14')](_0x1184b8));_0x25494b(_0x1184b8);})[_0x73bd('0x24')](function(_0x3a2d8e){logger[_0x73bd('0x15')](_0x73bd('0x22'),_0x3a2d8e[_0x73bd('0x17')],_0x40846d);_0x5e2f35(_0x2b37a5[_0x73bd('0x15')](0x1f4,_0x3a2d8e[_0x73bd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6540068..228f31e 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 _0x51f2=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x499869,_0x159407){var _0x4a63b6=function(_0x2e0d16){while(--_0x2e0d16){_0x499869['push'](_0x499869['shift']());}};_0x4a63b6(++_0x159407);}(_0x51f2,0xeb));var _0x251f=function(_0x28b551,_0x219d02){_0x28b551=_0x28b551-0x0;var _0x11c17f=_0x51f2[_0x28b551];return _0x11c17f;};'use strict';var UserVoiceQueueRtEvents=require(_0x251f('0x0'));var events=[_0x251f('0x1'),_0x251f('0x2'),_0x251f('0x3')];function createListener(_0x2afc7f,_0x243816){return function(_0x1d0c48){_0x243816[_0x251f('0x4')](_0x2afc7f,_0x1d0c48);};}function removeListener(_0x1dd1c9,_0x4bc4be){return function(){UserVoiceQueueRtEvents[_0x251f('0x5')](_0x1dd1c9,_0x4bc4be);};}exports[_0x251f('0x6')]=function(_0x145630){for(var _0xd9d8e1=0x0,_0x18c6ab=events['length'];_0xd9d8e1<_0x18c6ab;_0xd9d8e1++){var _0x1f01da=events[_0xd9d8e1];var _0x37469e=createListener(_0x251f('0x7')+_0x1f01da,_0x145630);UserVoiceQueueRtEvents['on'](_0x1f01da,_0x37469e);}}; \ No newline at end of file +var _0x3eea=['removeListener','register','length','./userVoiceQueueRt.events','remove','update','emit'];(function(_0x8ef83d,_0x520c3d){var _0x4a4a19=function(_0x189336){while(--_0x189336){_0x8ef83d['push'](_0x8ef83d['shift']());}};_0x4a4a19(++_0x520c3d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2846df,_0x278188){_0x2846df=_0x2846df-0x0;var _0x388335=_0x3eea[_0x2846df];return _0x388335;};'use strict';var UserVoiceQueueRtEvents=require(_0xa3ee('0x0'));var events=['save',_0xa3ee('0x1'),_0xa3ee('0x2')];function createListener(_0x16512c,_0x1c6a49){return function(_0x46acfa){_0x1c6a49[_0xa3ee('0x3')](_0x16512c,_0x46acfa);};}function removeListener(_0x104913,_0x35ed7d){return function(){UserVoiceQueueRtEvents[_0xa3ee('0x4')](_0x104913,_0x35ed7d);};}exports[_0xa3ee('0x5')]=function(_0xb93cdb){for(var _0x5776bb=0x0,_0x538bf9=events[_0xa3ee('0x6')];_0x5776bb<_0x538bf9;_0x5776bb++){var _0x4e4588=events[_0x5776bb];var _0x37a3f0=createListener('userVoiceQueueRt:'+_0x4e4588,_0xb93cdb);UserVoiceQueueRtEvents['on'](_0x4e4588,_0x37a3f0);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1ab3fee..dfbeaf8 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4cce3e,_0x4a1349){var _0x391e08=function(_0x4b6708){while(--_0x4b6708){_0x4cce3e['push'](_0x4cce3e['shift']());}};_0x391e08(++_0x4a1349);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x34edc6,_0x4a0b01){var _0x5788b1=function(_0x36e634){while(--_0x36e634){_0x34edc6['push'](_0x34edc6['shift']());}};_0x5788b1(++_0x4a0b01);}(_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 7b7bf50..576c2f2 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 _0xdb2f=['exports','INTEGER'];(function(_0x4454b2,_0x3f408b){var _0x50b8f1=function(_0x5bdbe8){while(--_0x5bdbe8){_0x4454b2['push'](_0x4454b2['shift']());}};_0x50b8f1(++_0x3f408b);}(_0xdb2f,0x1d8));var _0xfdb2=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xdb2f[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');module[_0xfdb2('0x0')]={'penalty':{'type':Sequelize[_0xfdb2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb19f=['exports','sequelize'];(function(_0x151f00,_0x4ca3a1){var _0x418d9b=function(_0x5c37c7){while(--_0x5c37c7){_0x151f00['push'](_0x151f00['shift']());}};_0x418d9b(++_0x4ca3a1);}(_0xb19f,0x7d));var _0xfb19=function(_0x46a89e,_0x3c223c){_0x46a89e=_0x46a89e-0x0;var _0x50a1e7=_0xb19f[_0x46a89e];return _0x50a1e7;};'use strict';var Sequelize=require(_0xfb19('0x0'));module[_0xfb19('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index fc68fac..d85d841 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 _0xabe4=['exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5dfbc3,_0x57f31d){var _0x57218f=function(_0x9e07e1){while(--_0x9e07e1){_0x5dfbc3['push'](_0x5dfbc3['shift']());}};_0x57218f(++_0x57f31d);}(_0xabe4,0xdb));var _0x4abe=function(_0x4cb231,_0x3d3c5b){_0x4cb231=_0x4cb231-0x0;var _0x4d5063=_0xabe4[_0x4cb231];return _0x4d5063;};'use strict';var _=require(_0x4abe('0x0'));var util=require(_0x4abe('0x1'));var logger=require(_0x4abe('0x2'))(_0x4abe('0x3'));var moment=require(_0x4abe('0x4'));var BPromise=require(_0x4abe('0x5'));var rp=require(_0x4abe('0x6'));var fs=require('fs');var path=require(_0x4abe('0x7'));var rimraf=require(_0x4abe('0x8'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x4abe('0x9')]=function(_0x3daa22,_0x516554){return _0x3daa22[_0x4abe('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x4abe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4905=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x4d311e,_0x4715f3){var _0x54fc0a=function(_0x297a15){while(--_0x297a15){_0x4d311e['push'](_0x4d311e['shift']());}};_0x54fc0a(++_0x4715f3);}(_0x4905,0x144));var _0x5490=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x4905[_0x4c7935];return _0x30651d;};'use strict';var _=require(_0x5490('0x0'));var util=require(_0x5490('0x1'));var logger=require(_0x5490('0x2'))('api');var moment=require(_0x5490('0x3'));var BPromise=require('bluebird');var rp=require(_0x5490('0x4'));var fs=require('fs');var path=require(_0x5490('0x5'));var rimraf=require(_0x5490('0x6'));var config=require(_0x5490('0x7'));var attributes=require(_0x5490('0x8'));module['exports']=function(_0xe5d0a0,_0x190571){return _0xe5d0a0[_0x5490('0x9')](_0x5490('0xa'),attributes,{'tableName':_0x5490('0xb'),'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 6ee68a3..05a9593 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 _0x4a6f=['../../mysqldb','../../config/utils','rpc','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x212627,_0xba7fc9){var _0x3c9961=function(_0x1a551a){while(--_0x1a551a){_0x212627['push'](_0x212627['shift']());}};_0x3c9961(++_0xba7fc9);}(_0x4a6f,0x162));var _0xf4a6=function(_0x4bfff5,_0xbd2a67){_0x4bfff5=_0x4bfff5-0x0;var _0x2383bc=_0x4a6f[_0x4bfff5];return _0x2383bc;};'use strict';var _=require(_0xf4a6('0x0'));var util=require(_0xf4a6('0x1'));var moment=require(_0xf4a6('0x2'));var BPromise=require(_0xf4a6('0x3'));var rs=require(_0xf4a6('0x4'));var fs=require('fs');var Redis=require(_0xf4a6('0x5'));var db=require(_0xf4a6('0x6'))['db'];var utils=require(_0xf4a6('0x7'));var logger=require('../../config/logger')(_0xf4a6('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf4a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35d4d6,_0x3292f9,_0x580618){return new BPromise(function(_0x38e3d8,_0x20d3c2){return client[_0xf4a6('0xa')](_0x35d4d6,_0x580618)['then'](function(_0xb22c5e){logger[_0xf4a6('0xb')](_0xf4a6('0xc'),_0x3292f9,_0xf4a6('0xd'));logger[_0xf4a6('0xe')](_0xf4a6('0xf'),_0x3292f9,_0xf4a6('0xd'),JSON['stringify'](_0xb22c5e));if(_0xb22c5e[_0xf4a6('0x10')]){if(_0xb22c5e['error'][_0xf4a6('0x11')]===0x1f4){logger[_0xf4a6('0x10')](_0xf4a6('0xc'),_0x3292f9,_0xb22c5e[_0xf4a6('0x10')][_0xf4a6('0x12')]);return _0x20d3c2(_0xb22c5e[_0xf4a6('0x10')][_0xf4a6('0x12')]);}logger['error'](_0xf4a6('0xc'),_0x3292f9,_0xb22c5e['error'][_0xf4a6('0x12')]);return _0x38e3d8(_0xb22c5e[_0xf4a6('0x10')]['message']);}else{logger[_0xf4a6('0xb')](_0xf4a6('0xc'),_0x3292f9,_0xf4a6('0xd'));_0x38e3d8(_0xb22c5e['result']['message']);}})[_0xf4a6('0x13')](function(_0x5abc73){logger[_0xf4a6('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3292f9,_0x5abc73);_0x20d3c2(_0x5abc73);});});} \ No newline at end of file +var _0xa0ae=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xa0ae,0x155));var _0xea0a=function(_0x533daf,_0x19a7bf){_0x533daf=_0x533daf-0x0;var _0x3c161f=_0xa0ae[_0x533daf];return _0x3c161f;};'use strict';var _=require(_0xea0a('0x0'));var util=require(_0xea0a('0x1'));var moment=require(_0xea0a('0x2'));var BPromise=require(_0xea0a('0x3'));var rs=require(_0xea0a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea0a('0x6'))(_0xea0a('0x7'));var config=require(_0xea0a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xea0a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38da46,_0x178729,_0x209d32){return new BPromise(function(_0x5715af,_0xd4ab5e){return client['request'](_0x38da46,_0x209d32)[_0xea0a('0xa')](function(_0x356065){logger[_0xea0a('0xb')](_0xea0a('0xc'),_0x178729,_0xea0a('0xd'));logger[_0xea0a('0xe')](_0xea0a('0xf'),_0x178729,_0xea0a('0xd'),JSON[_0xea0a('0x10')](_0x356065));if(_0x356065['error']){if(_0x356065[_0xea0a('0x11')]['code']===0x1f4){logger[_0xea0a('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x178729,_0x356065[_0xea0a('0x11')][_0xea0a('0x12')]);return _0xd4ab5e(_0x356065[_0xea0a('0x11')][_0xea0a('0x12')]);}logger[_0xea0a('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x178729,_0x356065['error'][_0xea0a('0x12')]);return _0x5715af(_0x356065[_0xea0a('0x11')][_0xea0a('0x12')]);}else{logger[_0xea0a('0xb')](_0xea0a('0xc'),_0x178729,_0xea0a('0xd'));_0x5715af(_0x356065[_0xea0a('0x13')][_0xea0a('0x12')]);}})[_0xea0a('0x14')](function(_0x24fec8){logger[_0xea0a('0x11')](_0xea0a('0xc'),_0x178729,_0x24fec8);_0xd4ab5e(_0x24fec8);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 7730b4a..a7ee21a 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 _0x09dd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x09dd,0x81));var _0xd09d=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0x09dd[_0x35181c];return _0xe14bf9;};'use strict';var multer=require(_0xd09d('0x0'));var util=require(_0xd09d('0x1'));var path=require(_0xd09d('0x2'));var timeout=require(_0xd09d('0x3'));var express=require(_0xd09d('0x4'));var router=express[_0xd09d('0x5')]();var fs_extra=require(_0xd09d('0x6'));var auth=require(_0xd09d('0x7'));var interaction=require(_0xd09d('0x8'));var config=require(_0xd09d('0x9'));var controller=require(_0xd09d('0xa'));router[_0xd09d('0xb')]('/',auth[_0xd09d('0xc')](),controller[_0xd09d('0xd')]);router['get'](_0xd09d('0xe'),auth[_0xd09d('0xc')](),controller[_0xd09d('0xf')]);router[_0xd09d('0x10')]('/',auth[_0xd09d('0xc')](),controller[_0xd09d('0x11')]);router[_0xd09d('0x12')]('/:id',auth[_0xd09d('0xc')](),controller[_0xd09d('0x13')]);router[_0xd09d('0x14')](_0xd09d('0xe'),auth[_0xd09d('0xc')](),controller['destroy']);module[_0xd09d('0x15')]=router; \ No newline at end of file +var _0xad53=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show'];(function(_0x114720,_0x100b90){var _0x482582=function(_0x2998e3){while(--_0x2998e3){_0x114720['push'](_0x114720['shift']());}};_0x482582(++_0x100b90);}(_0xad53,0x1ea));var _0x3ad5=function(_0x58d320,_0x2eaad2){_0x58d320=_0x58d320-0x0;var _0x4357cc=_0xad53[_0x58d320];return _0x4357cc;};'use strict';var multer=require(_0x3ad5('0x0'));var util=require(_0x3ad5('0x1'));var path=require(_0x3ad5('0x2'));var timeout=require(_0x3ad5('0x3'));var express=require(_0x3ad5('0x4'));var router=express[_0x3ad5('0x5')]();var fs_extra=require(_0x3ad5('0x6'));var auth=require(_0x3ad5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3ad5('0x8'));var controller=require(_0x3ad5('0x9'));router[_0x3ad5('0xa')]('/',auth[_0x3ad5('0xb')](),controller[_0x3ad5('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3ad5('0xd')]);router[_0x3ad5('0xe')]('/',auth[_0x3ad5('0xb')](),controller[_0x3ad5('0xf')]);router[_0x3ad5('0x10')](_0x3ad5('0x11'),auth[_0x3ad5('0xb')](),controller[_0x3ad5('0x12')]);router['delete'](_0x3ad5('0x11'),auth[_0x3ad5('0xb')](),controller[_0x3ad5('0x13')]);module[_0x3ad5('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 2bac1bc..c7be544 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 _0x0238=['exports','STRING','name','sequelize'];(function(_0x5376c6,_0xba32d2){var _0x3f923b=function(_0x1ab61c){while(--_0x1ab61c){_0x5376c6['push'](_0x5376c6['shift']());}};_0x3f923b(++_0xba32d2);}(_0x0238,0x1cf));var _0x8023=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x0238[_0x15b380];return _0x232c5c;};'use strict';var Sequelize=require(_0x8023('0x0'));module[_0x8023('0x1')]={'name':{'type':Sequelize[_0x8023('0x2')],'unique':_0x8023('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c8b=['name','sequelize'];(function(_0x5c6ceb,_0x4ed099){var _0x28821b=function(_0x391add){while(--_0x391add){_0x5c6ceb['push'](_0x5c6ceb['shift']());}};_0x28821b(++_0x4ed099);}(_0x2c8b,0x8b));var _0xb2c8=function(_0x4a4d18,_0x1ba46f){_0x4a4d18=_0x4a4d18-0x0;var _0x48f353=_0x2c8b[_0x4a4d18];return _0x48f353;};'use strict';var Sequelize=require(_0xb2c8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb2c8('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 480c5e4..a692e03 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 _0xf825=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','Variables','UserProfileResource','destroy','error','stack','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x688546,_0x349b41){var _0x75b742=function(_0x297c7d){while(--_0x297c7d){_0x688546['push'](_0x688546['shift']());}};_0x75b742(++_0x349b41);}(_0xf825,0x15e));var _0x5f82=function(_0x42935c,_0x42da45){_0x42935c=_0x42935c-0x0;var _0x4758c7=_0xf825[_0x42935c];return _0x4758c7;};'use strict';var emlformat=require(_0x5f82('0x0'));var rimraf=require(_0x5f82('0x1'));var zipdir=require(_0x5f82('0x2'));var jsonpatch=require(_0x5f82('0x3'));var rp=require(_0x5f82('0x4'));var moment=require(_0x5f82('0x5'));var BPromise=require(_0x5f82('0x6'));var Mustache=require(_0x5f82('0x7'));var util=require(_0x5f82('0x8'));var path=require(_0x5f82('0x9'));var sox=require(_0x5f82('0xa'));var csv=require('to-csv');var ejs=require(_0x5f82('0xb'));var fs=require('fs');var fs_extra=require(_0x5f82('0xc'));var _=require(_0x5f82('0xd'));var squel=require(_0x5f82('0xe'));var crypto=require(_0x5f82('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5f82('0x10'));var toCsv=require(_0x5f82('0x11'));var querystring=require(_0x5f82('0x12'));var Papa=require(_0x5f82('0x13'));var Redis=require(_0x5f82('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5f82('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5f82('0x16'));var config=require(_0x5f82('0x17'));var licenseUtil=require(_0x5f82('0x18'));var db=require(_0x5f82('0x19'))['db'];function respondWithStatusCode(_0x15621b,_0x25bd66){_0x25bd66=_0x25bd66||0xcc;return function(_0xc14337){if(_0xc14337){return _0x15621b[_0x5f82('0x1a')](_0x25bd66);}return _0x15621b[_0x5f82('0x1b')](_0x25bd66)[_0x5f82('0x1c')]();};}function respondWithResult(_0x473ba0,_0xa9ad5f){_0xa9ad5f=_0xa9ad5f||0xc8;return function(_0x3c19d8){if(_0x3c19d8){return _0x473ba0[_0x5f82('0x1b')](_0xa9ad5f)['json'](_0x3c19d8);}};}function respondWithFilteredResult(_0x5d7d55,_0x2efa31){return function(_0x3e7746){if(_0x3e7746){var _0x24958c=typeof _0x2efa31['offset']===_0x5f82('0x1d')&&typeof _0x2efa31[_0x5f82('0x1e')]===_0x5f82('0x1d');var _0x2170cd=_0x3e7746[_0x5f82('0x1f')];var _0x7c8e1e=_0x24958c?0x0:_0x2efa31[_0x5f82('0x20')];var _0x32f892=_0x24958c?_0x3e7746['count']:_0x2efa31['offset']+_0x2efa31['limit'];var _0x2d84e8;if(_0x32f892>=_0x2170cd){_0x32f892=_0x2170cd;_0x2d84e8=0xc8;}else{_0x2d84e8=0xce;}_0x5d7d55[_0x5f82('0x1b')](_0x2d84e8);return _0x5d7d55[_0x5f82('0x21')](_0x5f82('0x22'),_0x7c8e1e+'-'+_0x32f892+'/'+_0x2170cd)[_0x5f82('0x23')](_0x3e7746);}return null;};}function patchUpdates(_0x47de7b){return function(_0x1ca9d9){try{jsonpatch[_0x5f82('0x24')](_0x1ca9d9,_0x47de7b,!![]);}catch(_0x912b51){return BPromise['reject'](_0x912b51);}return _0x1ca9d9[_0x5f82('0x25')]();};}function saveUpdates(_0x3bc025,_0x4f6f90){return function(_0x3d3c5e){if(_0x3d3c5e){return _0x3d3c5e[_0x5f82('0x26')](_0x3bc025)[_0x5f82('0x27')](function(_0x6feaa){return _0x6feaa;});}return null;};}function removeEntity(_0x41ee68,_0x2fe3fe){return function(_0x26ff1c){if(_0x26ff1c){return _0x26ff1c['destroy']()['then'](function(){var _0x51dc07=_0x26ff1c['get']({'plain':!![]});var _0x5b4251=_0x5f82('0x28');return db[_0x5f82('0x29')][_0x5f82('0x2a')]({'where':{'type':_0x5b4251,'resourceId':_0x51dc07['id']}})['then'](function(){return _0x26ff1c;});})['then'](function(){_0x41ee68[_0x5f82('0x1b')](0xcc)[_0x5f82('0x1c')]();});}};}function handleEntityNotFound(_0x115056,_0x1afd19){return function(_0x1f3727){if(!_0x1f3727){_0x115056[_0x5f82('0x1a')](0x194);}return _0x1f3727;};}function handleError(_0x2540c4,_0x2c6851){_0x2c6851=_0x2c6851||0x1f4;return function(_0x29a78d){logger[_0x5f82('0x2b')](_0x29a78d[_0x5f82('0x2c')]);if(_0x29a78d['name']){delete _0x29a78d['name'];}_0x2540c4[_0x5f82('0x1b')](_0x2c6851)['send'](_0x29a78d);};}exports[_0x5f82('0x2d')]=function(_0x275df3,_0x15053){var _0x60e973={},_0x4a4028={},_0x415432={'count':0x0,'rows':[]};var _0x3d7e4c=_[_0x5f82('0x2e')](db[_0x5f82('0x2f')][_0x5f82('0x30')],function(_0x55c2da){return{'name':_0x55c2da[_0x5f82('0x31')],'type':_0x55c2da[_0x5f82('0x32')][_0x5f82('0x33')]};});_0x4a4028[_0x5f82('0x34')]=_[_0x5f82('0x2e')](_0x3d7e4c,'name');_0x4a4028[_0x5f82('0x35')]=_[_0x5f82('0x36')](_0x275df3[_0x5f82('0x35')]);_0x4a4028[_0x5f82('0x37')]=_[_0x5f82('0x38')](_0x4a4028[_0x5f82('0x34')],_0x4a4028[_0x5f82('0x35')]);_0x60e973[_0x5f82('0x39')]=_[_0x5f82('0x38')](_0x4a4028[_0x5f82('0x34')],qs[_0x5f82('0x3a')](_0x275df3[_0x5f82('0x35')][_0x5f82('0x3a')]));_0x60e973[_0x5f82('0x39')]=_0x60e973[_0x5f82('0x39')][_0x5f82('0x3b')]?_0x60e973[_0x5f82('0x39')]:_0x4a4028[_0x5f82('0x34')];if(!_0x275df3[_0x5f82('0x35')][_0x5f82('0x3c')]('nolimit')){_0x60e973[_0x5f82('0x1e')]=qs[_0x5f82('0x1e')](_0x275df3[_0x5f82('0x35')][_0x5f82('0x1e')]);_0x60e973[_0x5f82('0x20')]=qs[_0x5f82('0x20')](_0x275df3['query'][_0x5f82('0x20')]);}_0x60e973[_0x5f82('0x3d')]=qs[_0x5f82('0x3e')](_0x275df3[_0x5f82('0x35')][_0x5f82('0x3e')]);_0x60e973[_0x5f82('0x3f')]=qs['filters'](_[_0x5f82('0x40')](_0x275df3[_0x5f82('0x35')],_0x4a4028['filters']),_0x3d7e4c);if(_0x275df3['query']['filter']){_0x60e973[_0x5f82('0x3f')]=_['merge'](_0x60e973['where'],{'$or':_[_0x5f82('0x2e')](_0x3d7e4c,function(_0x1d861b){if(_0x1d861b['type']!==_0x5f82('0x41')){var _0x342098={};_0x342098[_0x1d861b[_0x5f82('0x42')]]={'$like':'%'+_0x275df3['query'][_0x5f82('0x43')]+'%'};return _0x342098;}})});}_0x60e973=_[_0x5f82('0x44')]({},_0x60e973,_0x275df3[_0x5f82('0x45')]);var _0x4f23bd={'where':_0x60e973[_0x5f82('0x3f')]};return db['Variable'][_0x5f82('0x1f')](_0x4f23bd)[_0x5f82('0x27')](function(_0x494228){_0x415432[_0x5f82('0x1f')]=_0x494228;if(_0x275df3[_0x5f82('0x35')][_0x5f82('0x46')]){_0x60e973[_0x5f82('0x47')]=[{'all':!![]}];}return db[_0x5f82('0x2f')][_0x5f82('0x48')](_0x60e973);})[_0x5f82('0x27')](function(_0x4f8078){_0x415432[_0x5f82('0x49')]=_0x4f8078;return _0x415432;})[_0x5f82('0x27')](respondWithFilteredResult(_0x15053,_0x60e973))[_0x5f82('0x4a')](handleError(_0x15053,null));};exports[_0x5f82('0x4b')]=function(_0x13635d,_0x1ce7ad){var _0x20bea6={'raw':!![],'where':{'id':_0x13635d[_0x5f82('0x4c')]['id']}},_0x27cc4c={};_0x27cc4c[_0x5f82('0x34')]=_[_0x5f82('0x36')](db[_0x5f82('0x2f')]['rawAttributes']);_0x27cc4c[_0x5f82('0x35')]=_[_0x5f82('0x36')](_0x13635d[_0x5f82('0x35')]);_0x27cc4c[_0x5f82('0x37')]=_[_0x5f82('0x38')](_0x27cc4c[_0x5f82('0x34')],_0x27cc4c[_0x5f82('0x35')]);_0x20bea6[_0x5f82('0x39')]=_[_0x5f82('0x38')](_0x27cc4c['model'],qs['fields'](_0x13635d[_0x5f82('0x35')][_0x5f82('0x3a')]));_0x20bea6[_0x5f82('0x39')]=_0x20bea6[_0x5f82('0x39')]['length']?_0x20bea6[_0x5f82('0x39')]:_0x27cc4c[_0x5f82('0x34')];if(_0x13635d['query'][_0x5f82('0x46')]){_0x20bea6[_0x5f82('0x47')]=[{'all':!![]}];}_0x20bea6=_[_0x5f82('0x44')]({},_0x20bea6,_0x13635d[_0x5f82('0x45')]);return db['Variable'][_0x5f82('0x4d')](_0x20bea6)[_0x5f82('0x27')](handleEntityNotFound(_0x1ce7ad,null))['then'](respondWithResult(_0x1ce7ad,null))[_0x5f82('0x4a')](handleError(_0x1ce7ad,null));};exports[_0x5f82('0x4e')]=function(_0x87e49a,_0x56f39c){return db[_0x5f82('0x2f')][_0x5f82('0x4e')](_0x87e49a[_0x5f82('0x4f')],{})['then'](function(_0x3978f9){var _0x2df397=_0x87e49a['user'][_0x5f82('0x50')]({'plain':!![]});if(!_0x2df397)throw new Error(_0x5f82('0x51'));if(_0x2df397['role']===_0x5f82('0x52')){var _0x6edf93=_0x3978f9[_0x5f82('0x50')]({'plain':!![]});var _0x119b2b=_0x5f82('0x28');return db[_0x5f82('0x53')]['find']({'where':{'name':_0x119b2b,'userProfileId':_0x2df397['userProfileId']},'raw':!![]})[_0x5f82('0x27')](function(_0x2caf32){if(_0x2caf32&&_0x2caf32[_0x5f82('0x54')]===0x0){return db[_0x5f82('0x29')][_0x5f82('0x4e')]({'name':_0x6edf93[_0x5f82('0x42')],'resourceId':_0x6edf93['id'],'type':_0x2caf32[_0x5f82('0x42')],'sectionId':_0x2caf32['id']},{})[_0x5f82('0x27')](function(){return _0x3978f9;});}else{return _0x3978f9;}})[_0x5f82('0x4a')](function(_0x1db4cb){logger[_0x5f82('0x2b')](_0x5f82('0x55'),_0x1db4cb);throw _0x1db4cb;});}return _0x3978f9;})[_0x5f82('0x27')](respondWithResult(_0x56f39c,0xc9))['catch'](handleError(_0x56f39c,null));};exports[_0x5f82('0x26')]=function(_0x1c1c2b,_0x500e26){if(_0x1c1c2b[_0x5f82('0x4f')]['id']){delete _0x1c1c2b['body']['id'];}return db[_0x5f82('0x2f')]['find']({'where':{'id':_0x1c1c2b[_0x5f82('0x4c')]['id']}})[_0x5f82('0x27')](handleEntityNotFound(_0x500e26,null))[_0x5f82('0x27')](saveUpdates(_0x1c1c2b[_0x5f82('0x4f')],null))[_0x5f82('0x27')](respondWithResult(_0x500e26,null))[_0x5f82('0x4a')](handleError(_0x500e26,null));};exports[_0x5f82('0x2a')]=function(_0x2734f3,_0x19f8a4){return db['Variable'][_0x5f82('0x4d')]({'where':{'id':_0x2734f3[_0x5f82('0x4c')]['id']}})[_0x5f82('0x27')](handleEntityNotFound(_0x19f8a4,null))[_0x5f82('0x27')](removeEntity(_0x19f8a4,null))[_0x5f82('0x4a')](handleError(_0x19f8a4,null));}; \ No newline at end of file +var _0x2d50=['attributes','fields','length','nolimit','limit','order','sort','pick','merge','VIRTUAL','where','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','count','set','apply','reject','save','then','get','UserProfileResource','sendStatus','error','stack','name','map','Variable','type','key','model','query','keys','filters','intersection'];(function(_0x4b4fd9,_0xd601f4){var _0x1c7ade=function(_0x33bcd0){while(--_0x33bcd0){_0x4b4fd9['push'](_0x4b4fd9['shift']());}};_0x1c7ade(++_0xd601f4);}(_0x2d50,0x10c));var _0x02d5=function(_0xb31e2,_0x3d0cba){_0xb31e2=_0xb31e2-0x0;var _0x1e8c24=_0x2d50[_0xb31e2];return _0x1e8c24;};'use strict';var emlformat=require(_0x02d5('0x0'));var rimraf=require(_0x02d5('0x1'));var zipdir=require(_0x02d5('0x2'));var jsonpatch=require(_0x02d5('0x3'));var rp=require('request-promise');var moment=require(_0x02d5('0x4'));var BPromise=require(_0x02d5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x02d5('0x6'));var sox=require('sox');var csv=require(_0x02d5('0x7'));var ejs=require(_0x02d5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02d5('0x9'));var squel=require('squel');var crypto=require(_0x02d5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x02d5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x02d5('0xc'));var Papa=require(_0x02d5('0xd'));var Redis=require(_0x02d5('0xe'));var authService=require(_0x02d5('0xf'));var qs=require(_0x02d5('0x10'));var as=require(_0x02d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02d5('0x12'))(_0x02d5('0x13'));var utils=require(_0x02d5('0x14'));var config=require(_0x02d5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x02d5('0x16'))['db'];function respondWithStatusCode(_0x47c010,_0x39a384){_0x39a384=_0x39a384||0xcc;return function(_0x415339){if(_0x415339){return _0x47c010['sendStatus'](_0x39a384);}return _0x47c010[_0x02d5('0x17')](_0x39a384)[_0x02d5('0x18')]();};}function respondWithResult(_0x2a1a31,_0x4fa8c6){_0x4fa8c6=_0x4fa8c6||0xc8;return function(_0x24c900){if(_0x24c900){return _0x2a1a31[_0x02d5('0x17')](_0x4fa8c6)[_0x02d5('0x19')](_0x24c900);}};}function respondWithFilteredResult(_0x5a6412,_0xafdcdd){return function(_0x5e6b40){if(_0x5e6b40){var _0x82d204=typeof _0xafdcdd[_0x02d5('0x1a')]==='undefined'&&typeof _0xafdcdd['limit']==='undefined';var _0xeb19bf=_0x5e6b40[_0x02d5('0x1b')];var _0x37349c=_0x82d204?0x0:_0xafdcdd[_0x02d5('0x1a')];var _0x5cfa23=_0x82d204?_0x5e6b40[_0x02d5('0x1b')]:_0xafdcdd[_0x02d5('0x1a')]+_0xafdcdd['limit'];var _0x1858d5;if(_0x5cfa23>=_0xeb19bf){_0x5cfa23=_0xeb19bf;_0x1858d5=0xc8;}else{_0x1858d5=0xce;}_0x5a6412[_0x02d5('0x17')](_0x1858d5);return _0x5a6412[_0x02d5('0x1c')]('Content-Range',_0x37349c+'-'+_0x5cfa23+'/'+_0xeb19bf)[_0x02d5('0x19')](_0x5e6b40);}return null;};}function patchUpdates(_0x2edec6){return function(_0xf7880c){try{jsonpatch[_0x02d5('0x1d')](_0xf7880c,_0x2edec6,!![]);}catch(_0x4738ba){return BPromise[_0x02d5('0x1e')](_0x4738ba);}return _0xf7880c[_0x02d5('0x1f')]();};}function saveUpdates(_0x40cd84,_0x378ef5){return function(_0x271f63){if(_0x271f63){return _0x271f63['update'](_0x40cd84)[_0x02d5('0x20')](function(_0x4629cf){return _0x4629cf;});}return null;};}function removeEntity(_0x40bae4,_0x3620d1){return function(_0x4567d3){if(_0x4567d3){return _0x4567d3['destroy']()[_0x02d5('0x20')](function(){var _0x470dfe=_0x4567d3[_0x02d5('0x21')]({'plain':!![]});var _0x216b56='Variables';return db[_0x02d5('0x22')]['destroy']({'where':{'type':_0x216b56,'resourceId':_0x470dfe['id']}})[_0x02d5('0x20')](function(){return _0x4567d3;});})['then'](function(){_0x40bae4['status'](0xcc)[_0x02d5('0x18')]();});}};}function handleEntityNotFound(_0x9e9d7d,_0x2aa2b1){return function(_0x59fd8f){if(!_0x59fd8f){_0x9e9d7d[_0x02d5('0x23')](0x194);}return _0x59fd8f;};}function handleError(_0x25e5a4,_0x17ee65){_0x17ee65=_0x17ee65||0x1f4;return function(_0xe3691e){logger[_0x02d5('0x24')](_0xe3691e[_0x02d5('0x25')]);if(_0xe3691e[_0x02d5('0x26')]){delete _0xe3691e[_0x02d5('0x26')];}_0x25e5a4[_0x02d5('0x17')](_0x17ee65)['send'](_0xe3691e);};}exports['index']=function(_0x4e08c0,_0x2db58e){var _0x39ac32={},_0x1f473f={},_0x2227b4={'count':0x0,'rows':[]};var _0x1ae0fa=_[_0x02d5('0x27')](db[_0x02d5('0x28')]['rawAttributes'],function(_0x6504d0){return{'name':_0x6504d0['fieldName'],'type':_0x6504d0[_0x02d5('0x29')][_0x02d5('0x2a')]};});_0x1f473f[_0x02d5('0x2b')]=_[_0x02d5('0x27')](_0x1ae0fa,'name');_0x1f473f[_0x02d5('0x2c')]=_[_0x02d5('0x2d')](_0x4e08c0['query']);_0x1f473f[_0x02d5('0x2e')]=_[_0x02d5('0x2f')](_0x1f473f[_0x02d5('0x2b')],_0x1f473f['query']);_0x39ac32[_0x02d5('0x30')]=_[_0x02d5('0x2f')](_0x1f473f[_0x02d5('0x2b')],qs[_0x02d5('0x31')](_0x4e08c0[_0x02d5('0x2c')][_0x02d5('0x31')]));_0x39ac32[_0x02d5('0x30')]=_0x39ac32[_0x02d5('0x30')][_0x02d5('0x32')]?_0x39ac32[_0x02d5('0x30')]:_0x1f473f['model'];if(!_0x4e08c0[_0x02d5('0x2c')]['hasOwnProperty'](_0x02d5('0x33'))){_0x39ac32[_0x02d5('0x34')]=qs[_0x02d5('0x34')](_0x4e08c0[_0x02d5('0x2c')]['limit']);_0x39ac32['offset']=qs[_0x02d5('0x1a')](_0x4e08c0['query']['offset']);}_0x39ac32[_0x02d5('0x35')]=qs[_0x02d5('0x36')](_0x4e08c0[_0x02d5('0x2c')][_0x02d5('0x36')]);_0x39ac32['where']=qs[_0x02d5('0x2e')](_[_0x02d5('0x37')](_0x4e08c0['query'],_0x1f473f[_0x02d5('0x2e')]),_0x1ae0fa);if(_0x4e08c0[_0x02d5('0x2c')]['filter']){_0x39ac32['where']=_[_0x02d5('0x38')](_0x39ac32['where'],{'$or':_[_0x02d5('0x27')](_0x1ae0fa,function(_0x3cb1cd){if(_0x3cb1cd[_0x02d5('0x29')]!==_0x02d5('0x39')){var _0x24f2bb={};_0x24f2bb[_0x3cb1cd[_0x02d5('0x26')]]={'$like':'%'+_0x4e08c0[_0x02d5('0x2c')]['filter']+'%'};return _0x24f2bb;}})});}_0x39ac32=_[_0x02d5('0x38')]({},_0x39ac32,_0x4e08c0['options']);var _0x1822b3={'where':_0x39ac32[_0x02d5('0x3a')]};return db['Variable']['count'](_0x1822b3)[_0x02d5('0x20')](function(_0x19b2d8){_0x2227b4[_0x02d5('0x1b')]=_0x19b2d8;if(_0x4e08c0[_0x02d5('0x2c')][_0x02d5('0x3b')]){_0x39ac32[_0x02d5('0x3c')]=[{'all':!![]}];}return db[_0x02d5('0x28')]['findAll'](_0x39ac32);})[_0x02d5('0x20')](function(_0x42eca9){_0x2227b4[_0x02d5('0x3d')]=_0x42eca9;return _0x2227b4;})[_0x02d5('0x20')](respondWithFilteredResult(_0x2db58e,_0x39ac32))[_0x02d5('0x3e')](handleError(_0x2db58e,null));};exports[_0x02d5('0x3f')]=function(_0xd1b83e,_0x2cf8b7){var _0x2fd062={'raw':!![],'where':{'id':_0xd1b83e[_0x02d5('0x40')]['id']}},_0x4fb987={};_0x4fb987[_0x02d5('0x2b')]=_[_0x02d5('0x2d')](db['Variable']['rawAttributes']);_0x4fb987[_0x02d5('0x2c')]=_[_0x02d5('0x2d')](_0xd1b83e['query']);_0x4fb987['filters']=_['intersection'](_0x4fb987[_0x02d5('0x2b')],_0x4fb987['query']);_0x2fd062[_0x02d5('0x30')]=_[_0x02d5('0x2f')](_0x4fb987[_0x02d5('0x2b')],qs[_0x02d5('0x31')](_0xd1b83e[_0x02d5('0x2c')][_0x02d5('0x31')]));_0x2fd062['attributes']=_0x2fd062['attributes'][_0x02d5('0x32')]?_0x2fd062[_0x02d5('0x30')]:_0x4fb987[_0x02d5('0x2b')];if(_0xd1b83e[_0x02d5('0x2c')][_0x02d5('0x3b')]){_0x2fd062[_0x02d5('0x3c')]=[{'all':!![]}];}_0x2fd062=_[_0x02d5('0x38')]({},_0x2fd062,_0xd1b83e[_0x02d5('0x41')]);return db[_0x02d5('0x28')][_0x02d5('0x42')](_0x2fd062)[_0x02d5('0x20')](handleEntityNotFound(_0x2cf8b7,null))[_0x02d5('0x20')](respondWithResult(_0x2cf8b7,null))[_0x02d5('0x3e')](handleError(_0x2cf8b7,null));};exports[_0x02d5('0x43')]=function(_0x3dbeff,_0x4fa79b){return db[_0x02d5('0x28')]['create'](_0x3dbeff[_0x02d5('0x44')],{})[_0x02d5('0x20')](function(_0x1925ca){var _0x466996=_0x3dbeff[_0x02d5('0x45')]['get']({'plain':!![]});if(!_0x466996)throw new Error(_0x02d5('0x46'));if(_0x466996[_0x02d5('0x47')]==='user'){var _0x5688bc=_0x1925ca[_0x02d5('0x21')]({'plain':!![]});var _0x2381ae=_0x02d5('0x48');return db[_0x02d5('0x49')]['find']({'where':{'name':_0x2381ae,'userProfileId':_0x466996[_0x02d5('0x4a')]},'raw':!![]})[_0x02d5('0x20')](function(_0x26300f){if(_0x26300f&&_0x26300f[_0x02d5('0x4b')]===0x0){return db[_0x02d5('0x22')][_0x02d5('0x43')]({'name':_0x5688bc[_0x02d5('0x26')],'resourceId':_0x5688bc['id'],'type':_0x26300f[_0x02d5('0x26')],'sectionId':_0x26300f['id']},{})[_0x02d5('0x20')](function(){return _0x1925ca;});}else{return _0x1925ca;}})['catch'](function(_0x240eb7){logger[_0x02d5('0x24')](_0x02d5('0x4c'),_0x240eb7);throw _0x240eb7;});}return _0x1925ca;})['then'](respondWithResult(_0x4fa79b,0xc9))['catch'](handleError(_0x4fa79b,null));};exports[_0x02d5('0x4d')]=function(_0x13ddfe,_0x531f4b){if(_0x13ddfe[_0x02d5('0x44')]['id']){delete _0x13ddfe[_0x02d5('0x44')]['id'];}return db[_0x02d5('0x28')][_0x02d5('0x42')]({'where':{'id':_0x13ddfe[_0x02d5('0x40')]['id']}})[_0x02d5('0x20')](handleEntityNotFound(_0x531f4b,null))[_0x02d5('0x20')](saveUpdates(_0x13ddfe[_0x02d5('0x44')],null))['then'](respondWithResult(_0x531f4b,null))[_0x02d5('0x3e')](handleError(_0x531f4b,null));};exports[_0x02d5('0x4e')]=function(_0x946ebf,_0xe5777a){return db['Variable']['find']({'where':{'id':_0x946ebf['params']['id']}})[_0x02d5('0x20')](handleEntityNotFound(_0xe5777a,null))[_0x02d5('0x20')](removeEntity(_0xe5777a,null))[_0x02d5('0x3e')](handleError(_0xe5777a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 333e764..01f0b00 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 _0x56a0=['exports','define','Variable','tools_variables','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2a1097,_0x241da2){var _0x165f60=function(_0x172167){while(--_0x172167){_0x2a1097['push'](_0x2a1097['shift']());}};_0x165f60(++_0x241da2);}(_0x56a0,0x190));var _0x056a=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0x56a0[_0x38841c];return _0x500610;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x056a('0x0'))(_0x056a('0x1'));var moment=require(_0x056a('0x2'));var BPromise=require(_0x056a('0x3'));var rp=require(_0x056a('0x4'));var fs=require('fs');var path=require(_0x056a('0x5'));var rimraf=require('rimraf');var config=require(_0x056a('0x6'));var attributes=require('./variable.attributes');module[_0x056a('0x7')]=function(_0x5cc82b,_0x3902c5){return _0x5cc82b[_0x056a('0x8')](_0x056a('0x9'),attributes,{'tableName':_0x056a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ed1=['./variable.attributes','Variable','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3afda9,_0x157233){var _0x54df67=function(_0x75b42a){while(--_0x75b42a){_0x3afda9['push'](_0x3afda9['shift']());}};_0x54df67(++_0x157233);}(_0x4ed1,0x119));var _0x14ed=function(_0x28a2d4,_0x5ecf15){_0x28a2d4=_0x28a2d4-0x0;var _0x374ddb=_0x4ed1[_0x28a2d4];return _0x374ddb;};'use strict';var _=require(_0x14ed('0x0'));var util=require('util');var logger=require(_0x14ed('0x1'))(_0x14ed('0x2'));var moment=require(_0x14ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x14ed('0x4'));var fs=require('fs');var path=require(_0x14ed('0x5'));var rimraf=require('rimraf');var config=require(_0x14ed('0x6'));var attributes=require(_0x14ed('0x7'));module['exports']=function(_0x1b4e10,_0x3c9b3a){return _0x1b4e10['define'](_0x14ed('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 42ae7a0..5b01447 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x1beda9,_0x5a3849){var _0x3fe3b1=function(_0x1169b2){while(--_0x1169b2){_0x1beda9['push'](_0x1beda9['shift']());}};_0x3fe3b1(++_0x5a3849);}(_0xe14b,0x93));var _0xbe14=function(_0x5e4b1d,_0x4f37d7){_0x5e4b1d=_0x5e4b1d-0x0;var _0x22d4fc=_0xe14b[_0x5e4b1d];return _0x22d4fc;};'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);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x42314b,_0x3d6128){var _0x3f9e0c=function(_0x341c84){while(--_0x341c84){_0x42314b['push'](_0x42314b['shift']());}};_0x3f9e0c(++_0x3d6128);}(_0x814b,0x1a2));var _0xb814=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0x814b[_0x301dab];return _0x2500a2;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ee9ac6e..aee47ca 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 _0x1c8d=['get','index','canUpdate','fetch','isAuthenticated','reset','/pull','/restart','restart','/migrations','migrations','exports','express','../../components/auth/service','./version.controller'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x1c8d,0x129));var _0xd1c8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1c8d[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0xd1c8('0x0'));var router=express['Router']();var auth=require(_0xd1c8('0x1'));var controller=require(_0xd1c8('0x2'));router[_0xd1c8('0x3')]('/',controller[_0xd1c8('0x4')]);router[_0xd1c8('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0xd1c8('0x5')](),controller[_0xd1c8('0x6')]);router[_0xd1c8('0x3')]('/reset',auth[_0xd1c8('0x7')](),auth[_0xd1c8('0x5')](),controller[_0xd1c8('0x8')]);router[_0xd1c8('0x3')](_0xd1c8('0x9'),auth[_0xd1c8('0x7')](),auth[_0xd1c8('0x5')](),controller['pull']);router['get'](_0xd1c8('0xa'),auth['isAuthenticated'](),controller[_0xd1c8('0xb')]);router['get'](_0xd1c8('0xc'),controller[_0xd1c8('0xd')]);module[_0xd1c8('0xe')]=router; \ No newline at end of file +var _0x1301=['reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','isAuthenticated','fetch','/reset','canUpdate'];(function(_0x35aa81,_0xf12756){var _0x4069d5=function(_0x35e4f8){while(--_0x35e4f8){_0x35aa81['push'](_0x35aa81['shift']());}};_0x4069d5(++_0xf12756);}(_0x1301,0x1e4));var _0x1130=function(_0x2df6f2,_0x1c47ff){_0x2df6f2=_0x2df6f2-0x0;var _0x52c534=_0x1301[_0x2df6f2];return _0x52c534;};'use strict';var express=require(_0x1130('0x0'));var router=express[_0x1130('0x1')]();var auth=require(_0x1130('0x2'));var controller=require(_0x1130('0x3'));router[_0x1130('0x4')]('/',controller['index']);router['get']('/fetch',auth[_0x1130('0x5')](),auth['canUpdate'](),controller[_0x1130('0x6')]);router[_0x1130('0x4')](_0x1130('0x7'),auth[_0x1130('0x5')](),auth[_0x1130('0x8')](),controller[_0x1130('0x9')]);router[_0x1130('0x4')](_0x1130('0xa'),auth[_0x1130('0x5')](),auth[_0x1130('0x8')](),controller[_0x1130('0xb')]);router[_0x1130('0x4')](_0x1130('0xc'),auth['isAuthenticated'](),controller[_0x1130('0xd')]);router[_0x1130('0x4')](_0x1130('0xe'),controller[_0x1130('0xf')]);module[_0x1130('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c34a330..4855806 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 _0x94ef=['exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','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','migrations','readdirSync','join','root','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','child_process','../../mysqldb','../../config/environment','update','simple-git','index'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x94ef,0x17e));var _0xf94e=function(_0x275558,_0x312051){_0x275558=_0x275558-0x0;var _0x56e4f6=_0x94ef[_0x275558];return _0x56e4f6;};'use strict';var Umzug=require(_0xf94e('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xf94e('0x1'));var pkginfo=require('pkginfo')(module,_0xf94e('0x2'));var compareVersions=require(_0xf94e('0x3'));var exec=require(_0xf94e('0x4'))['exec'];var db=require(_0xf94e('0x5'))['db'];var config=require(_0xf94e('0x6'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xf94e('0x7'));var git=require(_0xf94e('0x8'))(config['root']);exports[_0xf94e('0x9')]=function(_0x518c06,_0x4870a7){var _0x4e9ea8={'current':module[_0xf94e('0xa')][_0xf94e('0x2')],'phonebar':0x2};if(_0x518c06[_0xf94e('0xb')]&&_0x518c06[_0xf94e('0xb')][_0xf94e('0xc')]){return git[_0xf94e('0xd')]()[_0xf94e('0xe')](function(_0x472c1c,_0x3fda0f){_0x4e9ea8[_0xf94e('0xc')]=(_0x472c1c?module['exports']['version']:_0x3fda0f[_0xf94e('0xc')])||_0xf94e('0xf');return _0x4870a7[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')](_0x4e9ea8);});}else{return _0x4870a7[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')](_0x4e9ea8);}};exports[_0xf94e('0xd')]=function(_0x4f590c,_0x41ffba){return git['fetch']([_0xf94e('0x12'),_0xf94e('0x13')],function(_0xe3e261){if(_0xe3e261){logger[_0xf94e('0x14')](_0xe3e261);return _0x41ffba['status'](0x1f4)['json'](_0xe3e261);}logger[_0xf94e('0x15')](_0xf94e('0x16'));return _0x41ffba[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x17')});});};exports[_0xf94e('0x18')]=function(_0x43582c,_0x4560fd){return git[_0xf94e('0x18')](['--hard',_0xf94e('0x19')],function(_0x302851){if(_0x302851){logger[_0xf94e('0x14')](_0x302851);return _0x4560fd[_0xf94e('0x10')](0x1f4)[_0xf94e('0x11')](_0x302851);}logger[_0xf94e('0x15')](_0xf94e('0x1a'));return _0x4560fd[_0xf94e('0x10')](0xc8)['json']({'output':_0xf94e('0x1b')});});};exports[_0xf94e('0x1c')]=function(_0x1a0a53,_0x24fa96){exec(_0xf94e('0x1d'),function(_0xcca96b,_0x485b99,_0x5ac1d1){logger[_0xf94e('0x15')](_0x485b99);logger[_0xf94e('0x15')](_0x5ac1d1);if(_0xcca96b){logger['error'](_0xcca96b);return _0x24fa96[_0xf94e('0x10')](0x1f4)[_0xf94e('0x11')](_0xcca96b);}return _0x24fa96[_0xf94e('0x10')](0xc8)['json']({'output':_0x485b99});});};exports['restart']=function(_0x471bcd,_0x1baad1){return pm2[_0xf94e('0x1e')](_0xf94e('0x1f'))[_0xf94e('0x20')](function(_0x22b7f1){logger['info'](_0xf94e('0x21'),_0x22b7f1);return _0x1baad1['status'](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x22')});})[_0xf94e('0x23')](function(_0x45c41f){logger['error'](_0x45c41f);return _0x1baad1['status'](0x1f4)[_0xf94e('0x11')](_0x45c41f);});};exports[_0xf94e('0x24')]=function(_0x10995e,_0xa10d90){var _0x59d5cb=fs[_0xf94e('0x25')](path[_0xf94e('0x26')](config[_0xf94e('0x27')],_0xf94e('0x28'),_0xf94e('0x24')));var _0x1edf51=[];for(var _0x25f8a0=0x0;_0x25f8a0<_0x59d5cb[_0xf94e('0x29')];_0x25f8a0++){var _0x2b697a=_0x59d5cb[_0x25f8a0][_0xf94e('0x2a')](_0xf94e('0x2b'),'');if(compareVersions(module[_0xf94e('0xa')]['version'],_0x2b697a)===-0x1){_0x1edf51['push'](_0x2b697a);}}if(_0x1edf51[_0xf94e('0x29')]){var _0x496774=_0x1edf51[_0xf94e('0x2c')](compareVersions);var _0x41837f=new Umzug({'storage':_0xf94e('0x2d'),'storageOptions':{'model':db[_0xf94e('0x2e')],'modelName':_0xf94e('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0xf94e('0x2d')][_0xf94e('0x2f')](),db[_0xf94e('0x2d')][_0xf94e('0x30')],function(){throw new Error(_0xf94e('0x31'));}],'path':path['join'](config[_0xf94e('0x27')],'server','migrations'),'pattern':/\.js$/}});_0x41837f['up']({'migrations':_[_0xf94e('0x32')](_0x496774,function(_0x121d38){return _0x121d38+_0xf94e('0x2b');})})[_0xf94e('0x20')](function(){return _0xa10d90[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x33')+module[_0xf94e('0xa')]['version']+_0xf94e('0x34')+_[_0xf94e('0x35')](_0x496774),'migrations':_[_0xf94e('0x26')](_0x496774)});})['catch'](function(_0x4f0a6f){if(_0x4f0a6f instanceof db[_0xf94e('0x2d')][_0xf94e('0x36')]){return _0xa10d90[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x37')});}else{return _0xa10d90[_0xf94e('0x10')](0x1f4)[_0xf94e('0x11')](_0x4f0a6f);}});}else{return _0xa10d90[_0xf94e('0x10')](0xc8)[_0xf94e('0x11')]({'output':_0xf94e('0x37')});}}; \ No newline at end of file +var _0x5973=['path','lodash','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','query','latest','tags','exports','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','catch','migrations','join','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5973,0x103));var _0x3597=function(_0xec9c4e,_0x1f3b34){_0xec9c4e=_0xec9c4e-0x0;var _0x49cf7b=_0x5973[_0xec9c4e];return _0x49cf7b;};'use strict';var Umzug=require(_0x3597('0x0'));var path=require(_0x3597('0x1'));var fs=require('fs');var _=require(_0x3597('0x2'));var pkginfo=require('pkginfo')(module,_0x3597('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x3597('0x4'))[_0x3597('0x5')];var db=require(_0x3597('0x6'))['db'];var config=require(_0x3597('0x7'));var pm2=require(_0x3597('0x8'));var logger=require(_0x3597('0x9'))(_0x3597('0xa'));var git=require('simple-git')(config[_0x3597('0xb')]);exports[_0x3597('0xc')]=function(_0x5654a9,_0x198db5){var _0x59c143={'current':module['exports'][_0x3597('0x3')],'phonebar':0x2};if(_0x5654a9[_0x3597('0xd')]&&_0x5654a9[_0x3597('0xd')][_0x3597('0xe')]){return git['fetch']()[_0x3597('0xf')](function(_0x347b1d,_0x5400ad){_0x59c143[_0x3597('0xe')]=(_0x347b1d?module[_0x3597('0x10')][_0x3597('0x3')]:_0x5400ad[_0x3597('0xe')])||_0x3597('0x11');return _0x198db5[_0x3597('0x12')](0xc8)[_0x3597('0x13')](_0x59c143);});}else{return _0x198db5['status'](0xc8)[_0x3597('0x13')](_0x59c143);}};exports['fetch']=function(_0x47429b,_0x13e76c){return git[_0x3597('0x14')]([_0x3597('0x15'),_0x3597('0x16')],function(_0x3ba63b){if(_0x3ba63b){logger[_0x3597('0x17')](_0x3ba63b);return _0x13e76c[_0x3597('0x12')](0x1f4)[_0x3597('0x13')](_0x3ba63b);}logger[_0x3597('0x18')](_0x3597('0x19'));return _0x13e76c['status'](0xc8)[_0x3597('0x13')]({'output':_0x3597('0x1a')});});};exports[_0x3597('0x1b')]=function(_0x1230e9,_0x3cf331){return git['reset']([_0x3597('0x1c'),_0x3597('0x1d')],function(_0x30465f){if(_0x30465f){logger[_0x3597('0x17')](_0x30465f);return _0x3cf331[_0x3597('0x12')](0x1f4)[_0x3597('0x13')](_0x30465f);}logger[_0x3597('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3cf331[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0x3597('0x1e')]=function(_0x4eb866,_0x473013){exec(_0x3597('0x1f'),function(_0x571c77,_0x5b8298,_0x1082ab){logger[_0x3597('0x18')](_0x5b8298);logger[_0x3597('0x18')](_0x1082ab);if(_0x571c77){logger[_0x3597('0x17')](_0x571c77);return _0x473013[_0x3597('0x12')](0x1f4)['json'](_0x571c77);}return _0x473013[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':_0x5b8298});});};exports[_0x3597('0x20')]=function(_0x89a52b,_0x1e2c2b){return pm2[_0x3597('0x20')]('motion2')['then'](function(_0x16e817){logger['info'](_0x3597('0x21'),_0x16e817);return _0x1e2c2b[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x3597('0x22')](function(_0xe2b03f){logger['error'](_0xe2b03f);return _0x1e2c2b[_0x3597('0x12')](0x1f4)['json'](_0xe2b03f);});};exports[_0x3597('0x23')]=function(_0x4aba5c,_0x15d829){var _0x1720ac=fs['readdirSync'](path[_0x3597('0x24')](config['root'],_0x3597('0x25'),_0x3597('0x23')));var _0x4df91d=[];for(var _0x38e460=0x0;_0x38e460<_0x1720ac[_0x3597('0x26')];_0x38e460++){var _0x4d605e=_0x1720ac[_0x38e460][_0x3597('0x27')](_0x3597('0x28'),'');if(compareVersions(module['exports']['version'],_0x4d605e)===-0x1){_0x4df91d[_0x3597('0x29')](_0x4d605e);}}if(_0x4df91d[_0x3597('0x26')]){var _0x5adf47=_0x4df91d['sort'](compareVersions);var _0x3e60e6=new Umzug({'storage':_0x3597('0x2a'),'storageOptions':{'model':db[_0x3597('0x2b')],'modelName':_0x3597('0x2b'),'columnName':_0x3597('0x3')},'migrations':{'params':[db[_0x3597('0x2a')][_0x3597('0x2c')](),db['sequelize'][_0x3597('0x2d')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config['root'],_0x3597('0x25'),_0x3597('0x23')),'pattern':/\.js$/}});_0x3e60e6['up']({'migrations':_[_0x3597('0x2e')](_0x5adf47,function(_0x490384){return _0x490384+'.js';})})[_0x3597('0x2f')](function(){return _0x15d829[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':_0x3597('0x30')+module[_0x3597('0x10')][_0x3597('0x3')]+_0x3597('0x31')+_[_0x3597('0x32')](_0x5adf47),'migrations':_[_0x3597('0x24')](_0x5adf47)});})[_0x3597('0x22')](function(_0x186ec7){if(_0x186ec7 instanceof db['sequelize']['UniqueConstraintError']){return _0x15d829[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x15d829['status'](0x1f4)[_0x3597('0x13')](_0x186ec7);}});}else{return _0x15d829[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':_0x3597('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a7c523d..5548543 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 _0x30c7=['index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get'];(function(_0x100519,_0x50dd2c){var _0x1dd752=function(_0x451bb7){while(--_0x451bb7){_0x100519['push'](_0x100519['shift']());}};_0x1dd752(++_0x50dd2c);}(_0x30c7,0x1d1));var _0x730c=function(_0x16a25e,_0x23cb8e){_0x16a25e=_0x16a25e-0x0;var _0x54f0fc=_0x30c7[_0x16a25e];return _0x54f0fc;};'use strict';var multer=require('multer');var util=require(_0x730c('0x0'));var path=require(_0x730c('0x1'));var timeout=require(_0x730c('0x2'));var express=require(_0x730c('0x3'));var router=express['Router']();var fs_extra=require(_0x730c('0x4'));var auth=require(_0x730c('0x5'));var interaction=require(_0x730c('0x6'));var config=require(_0x730c('0x7'));var controller=require(_0x730c('0x8'));router[_0x730c('0x9')]('/',auth['isAuthenticated'](),controller[_0x730c('0xa')]);router[_0x730c('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x730c('0x9')](_0x730c('0xb'),auth[_0x730c('0xc')](),controller['show']);router[_0x730c('0xd')]('/',auth[_0x730c('0xc')](),controller[_0x730c('0xe')]);router[_0x730c('0xf')](_0x730c('0xb'),auth[_0x730c('0xc')](),controller['update']);router[_0x730c('0x10')]('/:id',auth[_0x730c('0xc')](),controller[_0x730c('0x11')]);module[_0x730c('0x12')]=router; \ No newline at end of file +var _0x0593=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0593,0x1d1));var _0x3059=function(_0x25e4af,_0x9603c5){_0x25e4af=_0x25e4af-0x0;var _0x456dc2=_0x0593[_0x25e4af];return _0x456dc2;};'use strict';var multer=require(_0x3059('0x0'));var util=require(_0x3059('0x1'));var path=require(_0x3059('0x2'));var timeout=require(_0x3059('0x3'));var express=require(_0x3059('0x4'));var router=express[_0x3059('0x5')]();var fs_extra=require(_0x3059('0x6'));var auth=require(_0x3059('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3059('0x8'));var controller=require(_0x3059('0x9'));router[_0x3059('0xa')]('/',auth[_0x3059('0xb')](),controller[_0x3059('0xc')]);router[_0x3059('0xa')](_0x3059('0xd'),auth['isAuthenticated'](),controller[_0x3059('0xe')]);router[_0x3059('0xa')](_0x3059('0xf'),auth[_0x3059('0xb')](),controller[_0x3059('0x10')]);router[_0x3059('0x11')]('/',auth[_0x3059('0xb')](),controller[_0x3059('0x12')]);router[_0x3059('0x13')]('/:id',auth[_0x3059('0xb')](),controller[_0x3059('0x14')]);router[_0x3059('0x15')]('/:id',auth[_0x3059('0xb')](),controller[_0x3059('0x16')]);module[_0x3059('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 6a1b8e9..f845e70 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 _0x5713=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x5713,0x1c7));var _0x3571=function(_0x3b3d2b,_0x1f1c69){_0x3b3d2b=_0x3b3d2b-0x0;var _0x557baa=_0x5713[_0x3b3d2b];return _0x557baa;};'use strict';var Sequelize=require(_0x3571('0x0'));module[_0x3571('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3571('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3571('0x2')]},'queue':{'type':Sequelize[_0x3571('0x2')]},'interface':{'type':Sequelize[_0x3571('0x2')]},'membername':{'type':Sequelize[_0x3571('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x3571('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x3571('0x3')]},'agentdumpAt':{'type':Sequelize[_0x3571('0x3')]},'holdtime':{'type':Sequelize[_0x3571('0x4')]},'agentcomplete':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3571('0x4')]},'agentacw':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3571('0x4')]},'reason':{'type':Sequelize[_0x3571('0x2')]},'lastevent':{'type':Sequelize[_0x3571('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3571('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3571('0x2')]},'connectedlinename':{'type':Sequelize[_0x3571('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3571('0x2')]},'destchannel':{'type':Sequelize[_0x3571('0x2')]},'destchannelstate':{'type':Sequelize[_0x3571('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x3571('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3571('0x2')]},'destcalleridname':{'type':Sequelize[_0x3571('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3571('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3571('0x2')]},'destlanguage':{'type':Sequelize[_0x3571('0x2')]},'destaccountcode':{'type':Sequelize[_0x3571('0x2')]},'destcontext':{'type':Sequelize[_0x3571('0x2')]},'destexten':{'type':Sequelize[_0x3571('0x2')]},'destpriority':{'type':Sequelize[_0x3571('0x2')]},'destuniqueid':{'type':Sequelize[_0x3571('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3571('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x3571('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x3571('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x3571('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f2f=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x2dd1a7,_0x4b598d){var _0x3523cc=function(_0xb2bd38){while(--_0xb2bd38){_0x2dd1a7['push'](_0x2dd1a7['shift']());}};_0x3523cc(++_0x4b598d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x313675,_0x23c8b2){_0x313675=_0x313675-0x0;var _0x4051fd=_0x5f2f[_0x313675];return _0x4051fd;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'type':{'type':Sequelize[_0xf5f2('0x2')]},'uniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'calleridnum':{'type':Sequelize[_0xf5f2('0x2')]},'calleridname':{'type':Sequelize[_0xf5f2('0x2')]},'queue':{'type':Sequelize[_0xf5f2('0x2')]},'interface':{'type':Sequelize[_0xf5f2('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentdumpAt':{'type':Sequelize[_0xf5f2('0x3')]},'holdtime':{'type':Sequelize[_0xf5f2('0x4')]},'agentcomplete':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf5f2('0x4')]},'agentacw':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf5f2('0x2')]},'lastevent':{'type':Sequelize[_0xf5f2('0x2')]},'channel':{'type':Sequelize[_0xf5f2('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf5f2('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf5f2('0x2')]},'accountcode':{'type':Sequelize[_0xf5f2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf5f2('0x2')]},'priority':{'type':Sequelize[_0xf5f2('0x2')]},'destchannel':{'type':Sequelize[_0xf5f2('0x2')]},'destchannelstate':{'type':Sequelize[_0xf5f2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xf5f2('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf5f2('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf5f2('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf5f2('0x2')]},'destlanguage':{'type':Sequelize[_0xf5f2('0x2')]},'destaccountcode':{'type':Sequelize[_0xf5f2('0x2')]},'destcontext':{'type':Sequelize[_0xf5f2('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf5f2('0x2')]},'destuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xf5f2('0x2')]},'transfer':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf5f2('0x2')],'comment':_0xf5f2('0x6')},'transferexten':{'type':Sequelize[_0xf5f2('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'agententerreason':{'type':Sequelize[_0xf5f2('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 4ffc346..29bdff8 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(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 42aa82c..3d1415a 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 _0x6c7b=['report_agent','uniqueid','destuniqueid','lodash','moment','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define'];(function(_0x39e15b,_0x555185){var _0x4e5766=function(_0x45ef45){while(--_0x45ef45){_0x39e15b['push'](_0x39e15b['shift']());}};_0x4e5766(++_0x555185);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x5b24da,_0x41443c){_0x5b24da=_0x5b24da-0x0;var _0x4eae1c=_0x6c7b[_0x5b24da];return _0x4eae1c;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('VoiceAgentReport',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[{'fields':[_0xb6c7('0x9'),_0xb6c7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x950a=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','uniqueid','destuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x950a,0x111));var _0xa950=function(_0xa2c2e2,_0x535d90){_0xa2c2e2=_0xa2c2e2-0x0;var _0x3d7867=_0x950a[_0xa2c2e2];return _0x3d7867;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var logger=require(_0xa950('0x2'))(_0xa950('0x3'));var moment=require('moment');var BPromise=require(_0xa950('0x4'));var rp=require(_0xa950('0x5'));var fs=require('fs');var path=require(_0xa950('0x6'));var rimraf=require(_0xa950('0x7'));var config=require('../../config/environment');var attributes=require(_0xa950('0x8'));module[_0xa950('0x9')]=function(_0x512c0e,_0x14b4ac){return _0x512c0e[_0xa950('0xa')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xa950('0xb'),_0xa950('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index a8e21ee..845fc8d 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 _0x31ed=['error','message','request\x20sent','result','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2bbd69,_0x2b1b65){var _0x30dd4c=function(_0x293aad){while(--_0x293aad){_0x2bbd69['push'](_0x2bbd69['shift']());}};_0x30dd4c(++_0x2b1b65);}(_0x31ed,0x1c8));var _0xd31e=function(_0xd6dc4d,_0x417d75){_0xd6dc4d=_0xd6dc4d-0x0;var _0x4848f7=_0x31ed[_0xd6dc4d];return _0x4848f7;};'use strict';var _=require(_0xd31e('0x0'));var util=require(_0xd31e('0x1'));var moment=require(_0xd31e('0x2'));var BPromise=require(_0xd31e('0x3'));var rs=require(_0xd31e('0x4'));var fs=require('fs');var Redis=require(_0xd31e('0x5'));var db=require(_0xd31e('0x6'))['db'];var utils=require(_0xd31e('0x7'));var logger=require(_0xd31e('0x8'))(_0xd31e('0x9'));var config=require(_0xd31e('0xa'));var jayson=require(_0xd31e('0xb'));var client=jayson[_0xd31e('0xc')][_0xd31e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x36ee10,_0x4ee812,_0x48de1c){return new BPromise(function(_0x4d9cc9,_0x4e75b9){return client['request'](_0x36ee10,_0x48de1c)[_0xd31e('0xe')](function(_0x3ca55c){logger[_0xd31e('0xf')](_0xd31e('0x10'),_0x4ee812,'request\x20sent');logger[_0xd31e('0x11')](_0xd31e('0x12'),_0x4ee812,'request\x20sent',JSON[_0xd31e('0x13')](_0x3ca55c));if(_0x3ca55c[_0xd31e('0x14')]){if(_0x3ca55c[_0xd31e('0x14')]['code']===0x1f4){logger[_0xd31e('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ee812,_0x3ca55c['error']['message']);return _0x4e75b9(_0x3ca55c[_0xd31e('0x14')][_0xd31e('0x15')]);}logger[_0xd31e('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ee812,_0x3ca55c[_0xd31e('0x14')][_0xd31e('0x15')]);return _0x4d9cc9(_0x3ca55c['error'][_0xd31e('0x15')]);}else{logger[_0xd31e('0xf')](_0xd31e('0x10'),_0x4ee812,_0xd31e('0x16'));_0x4d9cc9(_0x3ca55c[_0xd31e('0x17')][_0xd31e('0x15')]);}})['catch'](function(_0x3018ba){logger[_0xd31e('0x14')](_0xd31e('0x10'),_0x4ee812,_0x3018ba);_0x4e75b9(_0x3018ba);});});}exports['CreateVoiceAgentReport']=function(_0x16c85b){var _0x2719f9=this;return new Promise(function(_0x1af502,_0x485f45){return db[_0xd31e('0x18')][_0xd31e('0x19')](_0x16c85b[_0xd31e('0x1a')],{'raw':_0x16c85b[_0xd31e('0x1b')]?_0x16c85b[_0xd31e('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7f6355){logger[_0xd31e('0xf')](_0xd31e('0x1c'),_0x16c85b);logger['debug'](_0xd31e('0x1c'),_0x16c85b,JSON[_0xd31e('0x13')](_0x7f6355));_0x1af502(_0x7f6355);})[_0xd31e('0x1d')](function(_0x59327e){logger[_0xd31e('0x14')]('CreateVoiceAgentReport',_0x59327e[_0xd31e('0x15')],_0x16c85b);_0x485f45(_0x2719f9[_0xd31e('0x14')](0x1f4,_0x59327e[_0xd31e('0x15')]));});});};exports[_0xd31e('0x1e')]=function(_0x191fa8){var _0x17ad3d=this;return new Promise(function(_0x580927,_0x282dc1){return db[_0xd31e('0x18')][_0xd31e('0x1f')](_0x191fa8[_0xd31e('0x1a')],{'raw':_0x191fa8[_0xd31e('0x1b')]?_0x191fa8[_0xd31e('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x191fa8[_0xd31e('0x1b')]?_0x191fa8[_0xd31e('0x1b')][_0xd31e('0x20')]||null:null,'attributes':_0x191fa8['options']?_0x191fa8[_0xd31e('0x1b')][_0xd31e('0x21')]||null:null,'limit':_0x191fa8[_0xd31e('0x1b')]?_0x191fa8['options']['limit']||null:null})[_0xd31e('0xe')](function(_0x393e95){logger[_0xd31e('0xf')]('UpdateVoiceAgentReport',_0x191fa8);logger[_0xd31e('0x11')](_0xd31e('0x1e'),_0x191fa8,JSON[_0xd31e('0x13')](_0x393e95));_0x580927(_0x393e95);})[_0xd31e('0x1d')](function(_0x5afb6e){logger[_0xd31e('0x14')](_0xd31e('0x1e'),_0x5afb6e[_0xd31e('0x15')],_0x191fa8);_0x282dc1(_0x17ad3d[_0xd31e('0x14')](0x1f4,_0x5afb6e['message']));});});}; \ No newline at end of file +var _0x579c=['request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','VoiceAgentReport','create','options','raw','then','CreateVoiceAgentReport','stringify','catch','body','attributes','limit','UpdateVoiceAgentReport','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x296e35,_0xd0ceaf){var _0x2dbdeb=function(_0x5b27cd){while(--_0x5b27cd){_0x296e35['push'](_0x296e35['shift']());}};_0x2dbdeb(++_0xd0ceaf);}(_0x579c,0x175));var _0xc579=function(_0x1222ac,_0x10efcc){_0x1222ac=_0x1222ac-0x0;var _0x147e72=_0x579c[_0x1222ac];return _0x147e72;};'use strict';var _=require(_0xc579('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc579('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc579('0x2'));var db=require(_0xc579('0x3'))['db'];var utils=require(_0xc579('0x4'));var logger=require(_0xc579('0x5'))(_0xc579('0x6'));var config=require(_0xc579('0x7'));var jayson=require(_0xc579('0x8'));var client=jayson[_0xc579('0x9')][_0xc579('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe60a41,_0x1fe2cd,_0xdd68b4){return new BPromise(function(_0x5e3ad8,_0x2ac526){return client[_0xc579('0xb')](_0xe60a41,_0xdd68b4)['then'](function(_0x47441c){logger[_0xc579('0xc')](_0xc579('0xd'),_0x1fe2cd,_0xc579('0xe'));logger[_0xc579('0xf')](_0xc579('0x10'),_0x1fe2cd,'request\x20sent',JSON['stringify'](_0x47441c));if(_0x47441c[_0xc579('0x11')]){if(_0x47441c[_0xc579('0x11')]['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x1fe2cd,_0x47441c['error'][_0xc579('0x12')]);return _0x2ac526(_0x47441c[_0xc579('0x11')]['message']);}logger[_0xc579('0x11')](_0xc579('0xd'),_0x1fe2cd,_0x47441c[_0xc579('0x11')][_0xc579('0x12')]);return _0x5e3ad8(_0x47441c[_0xc579('0x11')][_0xc579('0x12')]);}else{logger[_0xc579('0xc')](_0xc579('0xd'),_0x1fe2cd,'request\x20sent');_0x5e3ad8(_0x47441c[_0xc579('0x13')][_0xc579('0x12')]);}})['catch'](function(_0x413dfb){logger['error'](_0xc579('0xd'),_0x1fe2cd,_0x413dfb);_0x2ac526(_0x413dfb);});});}exports['CreateVoiceAgentReport']=function(_0x2fac18){var _0x137f8d=this;return new Promise(function(_0x193c01,_0x1381d9){return db[_0xc579('0x14')][_0xc579('0x15')](_0x2fac18['body'],{'raw':_0x2fac18[_0xc579('0x16')]?_0x2fac18[_0xc579('0x16')][_0xc579('0x17')]===undefined?!![]:![]:!![]})[_0xc579('0x18')](function(_0x4b6ff5){logger[_0xc579('0xc')](_0xc579('0x19'),_0x2fac18);logger[_0xc579('0xf')]('CreateVoiceAgentReport',_0x2fac18,JSON[_0xc579('0x1a')](_0x4b6ff5));_0x193c01(_0x4b6ff5);})[_0xc579('0x1b')](function(_0x40f019){logger[_0xc579('0x11')](_0xc579('0x19'),_0x40f019[_0xc579('0x12')],_0x2fac18);_0x1381d9(_0x137f8d['error'](0x1f4,_0x40f019['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x872bb4){var _0x2c75d9=this;return new Promise(function(_0xcc45d8,_0x5aeee8){return db[_0xc579('0x14')]['update'](_0x872bb4[_0xc579('0x1c')],{'raw':_0x872bb4[_0xc579('0x16')]?_0x872bb4['options'][_0xc579('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x872bb4[_0xc579('0x16')]?_0x872bb4[_0xc579('0x16')]['where']||null:null,'attributes':_0x872bb4['options']?_0x872bb4[_0xc579('0x16')][_0xc579('0x1d')]||null:null,'limit':_0x872bb4[_0xc579('0x16')]?_0x872bb4[_0xc579('0x16')][_0xc579('0x1e')]||null:null})['then'](function(_0x6fc281){logger['info']('UpdateVoiceAgentReport',_0x872bb4);logger[_0xc579('0xf')]('UpdateVoiceAgentReport',_0x872bb4,JSON['stringify'](_0x6fc281));_0xcc45d8(_0x6fc281);})[_0xc579('0x1b')](function(_0x5cdc00){logger[_0xc579('0x11')](_0xc579('0x1f'),_0x5cdc00[_0xc579('0x12')],_0x872bb4);_0x5aeee8(_0x2c75d9['error'](0x1f4,_0x5cdc00[_0xc579('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5e6d23b..d750022 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 _0x46ed=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','multer'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x8')](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x8')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller['show']);router[_0xd46e('0xe')]('/',auth[_0xd46e('0x9')](),controller['create']);router[_0xd46e('0xf')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x10')]);router[_0xd46e('0x11')](_0xd46e('0xd'),auth['isAuthenticated'](),controller[_0xd46e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','show','post','/:id'];(function(_0x2f0c62,_0x56a49){var _0x430a79=function(_0x5c5458){while(--_0x5c5458){_0x2f0c62['push'](_0x2f0c62['shift']());}};_0x430a79(++_0x56a49);}(_0xe14b,0x93));var _0xbe14=function(_0x30ec29,_0x1456f3){_0x30ec29=_0x30ec29-0x0;var _0xaedd9a=_0xe14b[_0x30ec29];return _0xaedd9a;};'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('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xd')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 4eef07f..b33224c 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 _0x5a87=['inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','exports','STRING','ENUM'];(function(_0xa9ad43,_0x3d9901){var _0x3decda=function(_0x2d565a){while(--_0x2d565a){_0xa9ad43['push'](_0xa9ad43['shift']());}};_0x3decda(++_0x3d9901);}(_0x5a87,0x194));var _0x75a8=function(_0x37e9a1,_0x2c30d2){_0x37e9a1=_0x37e9a1-0x0;var _0xccb5c4=_0x5a87[_0x37e9a1];return _0xccb5c4;};'use strict';var Sequelize=require('sequelize');module[_0x75a8('0x0')]={'uniqueid':{'type':Sequelize[_0x75a8('0x1')]},'type':{'type':Sequelize[_0x75a8('0x2')](_0x75a8('0x3'),_0x75a8('0x4'),_0x75a8('0x5'),_0x75a8('0x6'),_0x75a8('0x7'),_0x75a8('0x8'))},'tag':{'type':Sequelize[_0x75a8('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x75a8('0x1')]},'destination':{'type':Sequelize[_0x75a8('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x75a8('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x75a8('0x1')]},'lastapplication':{'type':Sequelize[_0x75a8('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x75a8('0x9')]},'answertime':{'type':Sequelize[_0x75a8('0x9')]},'endtime':{'type':Sequelize[_0x75a8('0x9')]},'duration':{'type':Sequelize[_0x75a8('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x75a8('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x75a8('0x1')]},'amaflags':{'type':Sequelize[_0x75a8('0x1')]},'userfield':{'type':Sequelize[_0x75a8('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x75a8('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x75a8('0x1')]},'note':{'type':Sequelize[_0x75a8('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x75a8('0x1')]}}; \ No newline at end of file +var _0x94c9=['dialer','DATE','INTEGER','sequelize','exports','STRING','inbound','outbound','inbound-fax','outbound-fax'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x94c9,0x1a7));var _0x994c=function(_0x353e63,_0x5f3e65){_0x353e63=_0x353e63-0x0;var _0x283819=_0x94c9[_0x353e63];return _0x283819;};'use strict';var Sequelize=require(_0x994c('0x0'));module[_0x994c('0x1')]={'uniqueid':{'type':Sequelize[_0x994c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x994c('0x3'),'internal',_0x994c('0x4'),_0x994c('0x5'),_0x994c('0x6'),_0x994c('0x7'))},'tag':{'type':Sequelize[_0x994c('0x2')]},'accountcode':{'type':Sequelize[_0x994c('0x2')]},'source':{'type':Sequelize[_0x994c('0x2')]},'destination':{'type':Sequelize[_0x994c('0x2')]},'destinationcontext':{'type':Sequelize[_0x994c('0x2')]},'callerid':{'type':Sequelize[_0x994c('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x994c('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x994c('0x8')]},'answertime':{'type':Sequelize[_0x994c('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x994c('0x9')]},'billableseconds':{'type':Sequelize[_0x994c('0x9')]},'mohtime':{'type':Sequelize[_0x994c('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x994c('0x2')]},'amaflags':{'type':Sequelize[_0x994c('0x2')]},'userfield':{'type':Sequelize[_0x994c('0x2')]},'userDisposition':{'type':Sequelize[_0x994c('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x994c('0x2')]},'note':{'type':Sequelize[_0x994c('0x2')]},'prefix':{'type':Sequelize[_0x994c('0x2')]},'routeid':{'type':Sequelize[_0x994c('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 56a65b4..b889766 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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2ef3,0xba));var _0x32ef=function(_0x4227e2,_0x215f36){_0x4227e2=_0x4227e2-0x0;var _0x175c97=_0x2ef3[_0x4227e2];return _0x175c97;};'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 _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(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x2ef3,0xba));var _0x32ef=function(_0x5b7be4,_0x2ee709){_0x5b7be4=_0x5b7be4-0x0;var _0x49f161=_0x2ef3[_0x5b7be4];return _0x49f161;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4b8d876..c12197b 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 _0x919d=['api','bluebird','path','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger'];(function(_0x37e61a,_0x435290){var _0x3ab814=function(_0x27525b){while(--_0x27525b){_0x37e61a['push'](_0x37e61a['shift']());}};_0x3ab814(++_0x435290);}(_0x919d,0x1c0));var _0xd919=function(_0x3f12be,_0x2a9c41){_0x3f12be=_0x3f12be-0x0;var _0x57cf5d=_0x919d[_0x3f12be];return _0x57cf5d;};'use strict';var _=require(_0xd919('0x0'));var util=require(_0xd919('0x1'));var logger=require(_0xd919('0x2'))(_0xd919('0x3'));var moment=require('moment');var BPromise=require(_0xd919('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd919('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd919('0x6'));module[_0xd919('0x7')]=function(_0x5493fc,_0x495d7b){return _0x5493fc[_0xd919('0x8')](_0xd919('0x9'),attributes,{'tableName':_0xd919('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9db=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9db,0x189));var _0xbf9d=function(_0x4d9fb0,_0x447fd0){_0x4d9fb0=_0x4d9fb0-0x0;var _0x5240f3=_0xf9db[_0x4d9fb0];return _0x5240f3;};'use strict';var _=require(_0xbf9d('0x0'));var util=require(_0xbf9d('0x1'));var logger=require(_0xbf9d('0x2'))(_0xbf9d('0x3'));var moment=require(_0xbf9d('0x4'));var BPromise=require(_0xbf9d('0x5'));var rp=require(_0xbf9d('0x6'));var fs=require('fs');var path=require(_0xbf9d('0x7'));var rimraf=require(_0xbf9d('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf9d('0x9'));module[_0xbf9d('0xa')]=function(_0x3aba8d,_0x39c670){return _0x3aba8d[_0xbf9d('0xb')](_0xbf9d('0xc'),attributes,{'tableName':_0xbf9d('0xd'),'paranoid':![],'indexes':[{'fields':[_0xbf9d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 75414dc..f67051f 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 _0xc64a=['debug','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model'];(function(_0x213cf0,_0x3e3d3c){var _0x3c7515=function(_0x32ea70){while(--_0x32ea70){_0x213cf0['push'](_0x213cf0['shift']());}};_0x3c7515(++_0x3e3d3c);}(_0xc64a,0x117));var _0xac64=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc64a[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac64('0x0'));var util=require('util');var moment=require(_0xac64('0x1'));var BPromise=require(_0xac64('0x2'));var rs=require(_0xac64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac64('0x4'))['db'];var utils=require(_0xac64('0x5'));var logger=require(_0xac64('0x6'))('rpc');var config=require(_0xac64('0x7'));var jayson=require(_0xac64('0x8'));var client=jayson[_0xac64('0x9')][_0xac64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x517824,_0x471bea,_0x680184){return new BPromise(function(_0x28b373,_0x417317){return client[_0xac64('0xb')](_0x517824,_0x680184)[_0xac64('0xc')](function(_0xd97ade){logger[_0xac64('0xd')](_0xac64('0xe'),_0x471bea,_0xac64('0xf'));logger['debug'](_0xac64('0x10'),_0x471bea,'request\x20sent',JSON[_0xac64('0x11')](_0xd97ade));if(_0xd97ade['error']){if(_0xd97ade[_0xac64('0x12')][_0xac64('0x13')]===0x1f4){logger[_0xac64('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x471bea,_0xd97ade['error'][_0xac64('0x14')]);return _0x417317(_0xd97ade['error'][_0xac64('0x14')]);}logger[_0xac64('0x12')](_0xac64('0xe'),_0x471bea,_0xd97ade['error'][_0xac64('0x14')]);return _0x28b373(_0xd97ade[_0xac64('0x12')]['message']);}else{logger[_0xac64('0xd')](_0xac64('0xe'),_0x471bea,_0xac64('0xf'));_0x28b373(_0xd97ade[_0xac64('0x15')][_0xac64('0x14')]);}})[_0xac64('0x16')](function(_0x371ec6){logger[_0xac64('0x12')](_0xac64('0xe'),_0x471bea,_0x371ec6);_0x417317(_0x371ec6);});});}exports[_0xac64('0x17')]=function(_0x146c7b){var _0x118927=this;return new Promise(function(_0x18c448,_0x18548a){return db[_0xac64('0x18')][_0xac64('0x19')]({'raw':_0x146c7b[_0xac64('0x1a')]?_0x146c7b[_0xac64('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x146c7b['options']?_0x146c7b[_0xac64('0x1a')][_0xac64('0x1b')]||null:null,'attributes':_0x146c7b['options']?_0x146c7b[_0xac64('0x1a')][_0xac64('0x1c')]||null:null,'limit':_0x146c7b[_0xac64('0x1a')]?_0x146c7b[_0xac64('0x1a')][_0xac64('0x1d')]||null:null,'include':_0x146c7b[_0xac64('0x1a')]?_0x146c7b[_0xac64('0x1a')][_0xac64('0x1e')]?_[_0xac64('0x1f')](_0x146c7b[_0xac64('0x1a')][_0xac64('0x1e')],function(_0x15bea3){return{'model':db[_0x15bea3['model']],'as':_0x15bea3['as'],'attributes':_0x15bea3['attributes'],'include':_0x15bea3[_0xac64('0x1e')]?_[_0xac64('0x1f')](_0x15bea3['include'],function(_0x88f8be){return{'model':db[_0x88f8be[_0xac64('0x20')]],'as':_0x88f8be['as'],'attributes':_0x88f8be['attributes'],'include':_0x88f8be['include']?_['map'](_0x88f8be[_0xac64('0x1e')],function(_0x385191){return{'model':db[_0x385191[_0xac64('0x20')]],'as':_0x385191['as'],'attributes':_0x385191['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c1ba7){logger[_0xac64('0xd')]('GetVoiceCallReport',_0x146c7b);logger[_0xac64('0x21')]('GetVoiceCallReport',_0x146c7b,JSON[_0xac64('0x11')](_0x2c1ba7));_0x18c448(_0x2c1ba7);})['catch'](function(_0x2b607c){logger[_0xac64('0x12')]('GetVoiceCallReport',_0x2b607c[_0xac64('0x14')],_0x146c7b);_0x18548a(_0x118927['error'](0x1f4,_0x2b607c['message']));});});};exports[_0xac64('0x22')]=function(_0xa1f28f){var _0x19a2b5=this;return new Promise(function(_0x36be5d,_0x1dcaf4){return db[_0xac64('0x18')][_0xac64('0x23')](_0xa1f28f[_0xac64('0x24')],{'raw':_0xa1f28f[_0xac64('0x1a')]?_0xa1f28f[_0xac64('0x1a')][_0xac64('0x25')]===undefined?!![]:![]:!![]})[_0xac64('0xc')](function(_0x50332a){logger[_0xac64('0xd')](_0xac64('0x22'),_0xa1f28f);logger[_0xac64('0x21')]('CreateVoiceCallReport',_0xa1f28f,JSON['stringify'](_0x50332a));_0x36be5d(_0x50332a);})['catch'](function(_0x1db04a){logger['error'](_0xac64('0x22'),_0x1db04a['message'],_0xa1f28f);_0x1dcaf4(_0x19a2b5['error'](0x1f4,_0x1db04a['message']));});});};exports[_0xac64('0x26')]=function(_0x5a5013){var _0x509708=this;return new Promise(function(_0x168708,_0x39a8ee){return db[_0xac64('0x18')]['update'](_0x5a5013['body'],{'raw':_0x5a5013[_0xac64('0x1a')]?_0x5a5013[_0xac64('0x1a')][_0xac64('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a5013['options']?_0x5a5013[_0xac64('0x1a')][_0xac64('0x1b')]||null:null,'attributes':_0x5a5013[_0xac64('0x1a')]?_0x5a5013[_0xac64('0x1a')][_0xac64('0x1c')]||null:null,'limit':_0x5a5013['options']?_0x5a5013[_0xac64('0x1a')][_0xac64('0x1d')]||null:null})['then'](function(_0x5ede47){logger[_0xac64('0xd')](_0xac64('0x26'),_0x5a5013);logger['debug'](_0xac64('0x26'),_0x5a5013,JSON['stringify'](_0x5ede47));_0x168708(_0x5ede47);})[_0xac64('0x16')](function(_0x502220){logger[_0xac64('0x12')](_0xac64('0x26'),_0x502220[_0xac64('0x14')],_0x5a5013);_0x39a8ee(_0x509708['error'](0x1f4,_0x502220['message']));});});}; \ No newline at end of file +var _0xef62=['http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','GetVoiceCallReport','options','raw','attributes','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','stringify','UpdateVoiceCallReport','update','body','where','limit','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x414124,_0x379e77){var _0x21b891=function(_0x3101cf){while(--_0x3101cf){_0x414124['push'](_0x414124['shift']());}};_0x21b891(++_0x379e77);}(_0xef62,0x1b3));var _0x2ef6=function(_0x5c7798,_0x5327af){_0x5c7798=_0x5c7798-0x0;var _0x154a57=_0xef62[_0x5c7798];return _0x154a57;};'use strict';var _=require(_0x2ef6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ef6('0x1'));var db=require(_0x2ef6('0x2'))['db'];var utils=require(_0x2ef6('0x3'));var logger=require(_0x2ef6('0x4'))('rpc');var config=require(_0x2ef6('0x5'));var jayson=require(_0x2ef6('0x6'));var client=jayson['client'][_0x2ef6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46b0a6,_0x434314,_0x358044){return new BPromise(function(_0x25570a,_0x2202a3){return client[_0x2ef6('0x8')](_0x46b0a6,_0x358044)[_0x2ef6('0x9')](function(_0x585eab){logger[_0x2ef6('0xa')](_0x2ef6('0xb'),_0x434314,'request\x20sent');logger[_0x2ef6('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x434314,_0x2ef6('0xd'),JSON['stringify'](_0x585eab));if(_0x585eab[_0x2ef6('0xe')]){if(_0x585eab['error']['code']===0x1f4){logger['error'](_0x2ef6('0xb'),_0x434314,_0x585eab[_0x2ef6('0xe')]['message']);return _0x2202a3(_0x585eab[_0x2ef6('0xe')][_0x2ef6('0xf')]);}logger[_0x2ef6('0xe')](_0x2ef6('0xb'),_0x434314,_0x585eab['error'][_0x2ef6('0xf')]);return _0x25570a(_0x585eab[_0x2ef6('0xe')][_0x2ef6('0xf')]);}else{logger['info'](_0x2ef6('0xb'),_0x434314,_0x2ef6('0xd'));_0x25570a(_0x585eab[_0x2ef6('0x10')]['message']);}})[_0x2ef6('0x11')](function(_0x387ee4){logger[_0x2ef6('0xe')](_0x2ef6('0xb'),_0x434314,_0x387ee4);_0x2202a3(_0x387ee4);});});}exports[_0x2ef6('0x12')]=function(_0x25c3b0){var _0x1d6dfc=this;return new Promise(function(_0x469afe,_0x498e0b){return db['VoiceCallReport']['findAll']({'raw':_0x25c3b0['options']?_0x25c3b0[_0x2ef6('0x13')][_0x2ef6('0x14')]===undefined?!![]:![]:!![],'where':_0x25c3b0[_0x2ef6('0x13')]?_0x25c3b0[_0x2ef6('0x13')]['where']||null:null,'attributes':_0x25c3b0[_0x2ef6('0x13')]?_0x25c3b0['options'][_0x2ef6('0x15')]||null:null,'limit':_0x25c3b0[_0x2ef6('0x13')]?_0x25c3b0[_0x2ef6('0x13')]['limit']||null:null,'include':_0x25c3b0[_0x2ef6('0x13')]?_0x25c3b0[_0x2ef6('0x13')][_0x2ef6('0x16')]?_[_0x2ef6('0x17')](_0x25c3b0[_0x2ef6('0x13')][_0x2ef6('0x16')],function(_0x42594b){return{'model':db[_0x42594b[_0x2ef6('0x18')]],'as':_0x42594b['as'],'attributes':_0x42594b[_0x2ef6('0x15')],'include':_0x42594b['include']?_[_0x2ef6('0x17')](_0x42594b[_0x2ef6('0x16')],function(_0x1309e1){return{'model':db[_0x1309e1[_0x2ef6('0x18')]],'as':_0x1309e1['as'],'attributes':_0x1309e1[_0x2ef6('0x15')],'include':_0x1309e1[_0x2ef6('0x16')]?_[_0x2ef6('0x17')](_0x1309e1[_0x2ef6('0x16')],function(_0x213b46){return{'model':db[_0x213b46['model']],'as':_0x213b46['as'],'attributes':_0x213b46['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ef6('0x9')](function(_0x36d149){logger[_0x2ef6('0xa')](_0x2ef6('0x12'),_0x25c3b0);logger['debug'](_0x2ef6('0x12'),_0x25c3b0,JSON['stringify'](_0x36d149));_0x469afe(_0x36d149);})['catch'](function(_0x36f104){logger[_0x2ef6('0xe')]('GetVoiceCallReport',_0x36f104[_0x2ef6('0xf')],_0x25c3b0);_0x498e0b(_0x1d6dfc[_0x2ef6('0xe')](0x1f4,_0x36f104[_0x2ef6('0xf')]));});});};exports[_0x2ef6('0x19')]=function(_0xe831fa){var _0x52a8a6=this;return new Promise(function(_0x3bdc88,_0x3f462a){return db[_0x2ef6('0x1a')][_0x2ef6('0x1b')](_0xe831fa['body'],{'raw':_0xe831fa['options']?_0xe831fa[_0x2ef6('0x13')][_0x2ef6('0x14')]===undefined?!![]:![]:!![]})[_0x2ef6('0x9')](function(_0x486cb5){logger[_0x2ef6('0xa')](_0x2ef6('0x19'),_0xe831fa);logger[_0x2ef6('0xc')]('CreateVoiceCallReport',_0xe831fa,JSON[_0x2ef6('0x1c')](_0x486cb5));_0x3bdc88(_0x486cb5);})[_0x2ef6('0x11')](function(_0x4faa3e){logger['error']('CreateVoiceCallReport',_0x4faa3e['message'],_0xe831fa);_0x3f462a(_0x52a8a6['error'](0x1f4,_0x4faa3e['message']));});});};exports[_0x2ef6('0x1d')]=function(_0x51cfc8){var _0x1a586b=this;return new Promise(function(_0x48ed1c,_0x1e39f9){return db[_0x2ef6('0x1a')][_0x2ef6('0x1e')](_0x51cfc8[_0x2ef6('0x1f')],{'raw':_0x51cfc8[_0x2ef6('0x13')]?_0x51cfc8[_0x2ef6('0x13')][_0x2ef6('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51cfc8[_0x2ef6('0x13')]?_0x51cfc8[_0x2ef6('0x13')][_0x2ef6('0x20')]||null:null,'attributes':_0x51cfc8[_0x2ef6('0x13')]?_0x51cfc8['options'][_0x2ef6('0x15')]||null:null,'limit':_0x51cfc8[_0x2ef6('0x13')]?_0x51cfc8['options'][_0x2ef6('0x21')]||null:null})[_0x2ef6('0x9')](function(_0x3d68a0){logger['info']('UpdateVoiceCallReport',_0x51cfc8);logger[_0x2ef6('0xc')](_0x2ef6('0x1d'),_0x51cfc8,JSON[_0x2ef6('0x1c')](_0x3d68a0));_0x48ed1c(_0x3d68a0);})[_0x2ef6('0x11')](function(_0xd7818d){logger[_0x2ef6('0xe')](_0x2ef6('0x1d'),_0xd7818d[_0x2ef6('0xf')],_0x51cfc8);_0x1e39f9(_0x1a586b[_0x2ef6('0xe')](0x1f4,_0xd7818d[_0x2ef6('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 20a7ef7..901fc75 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 _0x40d3=['post','create','put','/:id','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','show'];(function(_0x3a9ec8,_0x3b648c){var _0x443b47=function(_0x455f97){while(--_0x455f97){_0x3a9ec8['push'](_0x3a9ec8['shift']());}};_0x443b47(++_0x3b648c);}(_0x40d3,0xb2));var _0x340d=function(_0x31a36d,_0x2781d9){_0x31a36d=_0x31a36d-0x0;var _0x517c66=_0x40d3[_0x31a36d];return _0x517c66;};'use strict';var multer=require(_0x340d('0x0'));var util=require('util');var path=require(_0x340d('0x1'));var timeout=require('connect-timeout');var express=require(_0x340d('0x2'));var router=express['Router']();var fs_extra=require(_0x340d('0x3'));var auth=require(_0x340d('0x4'));var interaction=require(_0x340d('0x5'));var config=require(_0x340d('0x6'));var controller=require(_0x340d('0x7'));router['get']('/',auth[_0x340d('0x8')](),controller[_0x340d('0x9')]);router[_0x340d('0xa')]('/:id',auth[_0x340d('0x8')](),controller[_0x340d('0xb')]);router[_0x340d('0xc')]('/',auth[_0x340d('0x8')](),controller[_0x340d('0xd')]);router[_0x340d('0xe')](_0x340d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x340d('0x10')](_0x340d('0xf'),auth[_0x340d('0x8')](),controller[_0x340d('0x11')]);module[_0x340d('0x12')]=router; \ No newline at end of file +var _0x2004=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x2004,0x13f));var _0x4200=function(_0xda9464,_0x5a65fd){_0xda9464=_0xda9464-0x0;var _0x83dc5e=_0x2004[_0xda9464];return _0x83dc5e;};'use strict';var multer=require(_0x4200('0x0'));var util=require(_0x4200('0x1'));var path=require(_0x4200('0x2'));var timeout=require(_0x4200('0x3'));var express=require(_0x4200('0x4'));var router=express[_0x4200('0x5')]();var fs_extra=require(_0x4200('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4200('0x7'));var config=require(_0x4200('0x8'));var controller=require(_0x4200('0x9'));router['get']('/',auth[_0x4200('0xa')](),controller[_0x4200('0xb')]);router[_0x4200('0xc')](_0x4200('0xd'),auth[_0x4200('0xa')](),controller[_0x4200('0xe')]);router[_0x4200('0xf')]('/',auth[_0x4200('0xa')](),controller[_0x4200('0x10')]);router[_0x4200('0x11')](_0x4200('0xd'),auth[_0x4200('0xa')](),controller[_0x4200('0x12')]);router[_0x4200('0x13')](_0x4200('0xd'),auth[_0x4200('0xa')](),controller['destroy']);module[_0x4200('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 68f1322..129b449 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 _0x928b=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x928b,0x151));var _0xb928=function(_0x1b0df5,_0x2498bf){_0x1b0df5=_0x1b0df5-0x0;var _0x60696a=_0x928b[_0x1b0df5];return _0x60696a;};'use strict';var Sequelize=require(_0xb928('0x0'));module[_0xb928('0x1')]={'name':{'type':Sequelize[_0xb928('0x2')]},'prefix':{'type':Sequelize[_0xb928('0x2')],'unique':_0xb928('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb928('0x2')],'set':function(_0x34ed52){this[_0xb928('0x4')](_0xb928('0x5'),_0x34ed52?_0x34ed52['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xb928('0x6')](_0xb928('0x5'))[_0xb928('0x7')](''):[];}},'auth':{'type':Sequelize[_0xb928('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb928('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc66a=['BOOLEAN','exports','STRING','options','getDataValue','split'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xc66a,0xeb));var _0xac66=function(_0x28b1c9,_0x39a7ee){_0x28b1c9=_0x28b1c9-0x0;var _0x19fb13=_0xc66a[_0x28b1c9];return _0x19fb13;};'use strict';var Sequelize=require('sequelize');module[_0xac66('0x0')]={'name':{'type':Sequelize[_0xac66('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xac66('0x1')],'set':function(_0x2e2f4c){this['setDataValue'](_0xac66('0x2'),_0x2e2f4c?_0x2e2f4c['join'](''):[]);},'get':function(){return this[_0xac66('0x3')](_0xac66('0x2'))?this[_0xac66('0x3')](_0xac66('0x2'))[_0xac66('0x4')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xac66('0x1')]},'record':{'type':Sequelize[_0xac66('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a4859d2..75b25ae 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 _0x3ce4=['UserProfileResource','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','reject','save','then','destroy','ChanSpies'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ce4,0xcb));var _0x43ce=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x3ce4[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require(_0x43ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43ce('0x2'));var moment=require(_0x43ce('0x3'));var BPromise=require(_0x43ce('0x4'));var Mustache=require(_0x43ce('0x5'));var util=require(_0x43ce('0x6'));var path=require('path');var sox=require(_0x43ce('0x7'));var csv=require(_0x43ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43ce('0x9'));var _=require('lodash');var squel=require(_0x43ce('0xa'));var crypto=require(_0x43ce('0xb'));var jsforce=require(_0x43ce('0xc'));var deskjs=require(_0x43ce('0xd'));var toCsv=require('to-csv');var querystring=require(_0x43ce('0xe'));var Papa=require(_0x43ce('0xf'));var Redis=require(_0x43ce('0x10'));var authService=require(_0x43ce('0x11'));var qs=require(_0x43ce('0x12'));var as=require(_0x43ce('0x13'));var hardwareService=require(_0x43ce('0x14'));var logger=require(_0x43ce('0x15'))('api');var utils=require(_0x43ce('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x43ce('0x17'));var db=require(_0x43ce('0x18'))['db'];function respondWithStatusCode(_0x84300e,_0x472b54){_0x472b54=_0x472b54||0xcc;return function(_0x2be282){if(_0x2be282){return _0x84300e[_0x43ce('0x19')](_0x472b54);}return _0x84300e[_0x43ce('0x1a')](_0x472b54)['end']();};}function respondWithResult(_0x3fb780,_0x57eb00){_0x57eb00=_0x57eb00||0xc8;return function(_0x1a02f8){if(_0x1a02f8){return _0x3fb780[_0x43ce('0x1a')](_0x57eb00)[_0x43ce('0x1b')](_0x1a02f8);}};}function respondWithFilteredResult(_0x5ebcef,_0x14e2b2){return function(_0x14e906){if(_0x14e906){var _0x298771=typeof _0x14e2b2[_0x43ce('0x1c')]===_0x43ce('0x1d')&&typeof _0x14e2b2[_0x43ce('0x1e')]===_0x43ce('0x1d');var _0xfb7e97=_0x14e906[_0x43ce('0x1f')];var _0x2f679=_0x298771?0x0:_0x14e2b2[_0x43ce('0x1c')];var _0x1b7f2=_0x298771?_0x14e906[_0x43ce('0x1f')]:_0x14e2b2[_0x43ce('0x1c')]+_0x14e2b2[_0x43ce('0x1e')];var _0x202459;if(_0x1b7f2>=_0xfb7e97){_0x1b7f2=_0xfb7e97;_0x202459=0xc8;}else{_0x202459=0xce;}_0x5ebcef[_0x43ce('0x1a')](_0x202459);return _0x5ebcef['set']('Content-Range',_0x2f679+'-'+_0x1b7f2+'/'+_0xfb7e97)[_0x43ce('0x1b')](_0x14e906);}return null;};}function patchUpdates(_0x2f8d63){return function(_0x34db72){try{jsonpatch['apply'](_0x34db72,_0x2f8d63,!![]);}catch(_0x4c31e3){return BPromise[_0x43ce('0x20')](_0x4c31e3);}return _0x34db72[_0x43ce('0x21')]();};}function saveUpdates(_0x42b4a3,_0x439063){return function(_0x550013){if(_0x550013){return _0x550013['update'](_0x42b4a3)[_0x43ce('0x22')](function(_0x5cb18c){return _0x5cb18c;});}return null;};}function removeEntity(_0x115ba2,_0x2bce6d){return function(_0x2a74ec){if(_0x2a74ec){return _0x2a74ec[_0x43ce('0x23')]()[_0x43ce('0x22')](function(){var _0x52f858=_0x2a74ec['get']({'plain':!![]});var _0x151777=_0x43ce('0x24');return db[_0x43ce('0x25')][_0x43ce('0x23')]({'where':{'type':_0x151777,'resourceId':_0x52f858['id']}})['then'](function(){return _0x2a74ec;});})[_0x43ce('0x22')](function(){_0x115ba2[_0x43ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2330ba,_0x4d3782){return function(_0x517232){if(!_0x517232){_0x2330ba[_0x43ce('0x19')](0x194);}return _0x517232;};}function handleError(_0x28b08b,_0x79f757){_0x79f757=_0x79f757||0x1f4;return function(_0xefecdf){logger[_0x43ce('0x26')](_0xefecdf['stack']);if(_0xefecdf[_0x43ce('0x27')]){delete _0xefecdf[_0x43ce('0x27')];}_0x28b08b[_0x43ce('0x1a')](_0x79f757)[_0x43ce('0x28')](_0xefecdf);};}exports['index']=function(_0x382c71,_0x102fbe){var _0x31ab16={},_0x34bb16={},_0x241a4f={'count':0x0,'rows':[]};var _0x284710=_[_0x43ce('0x29')](db[_0x43ce('0x2a')][_0x43ce('0x2b')],function(_0x50aa48){return{'name':_0x50aa48[_0x43ce('0x2c')],'type':_0x50aa48[_0x43ce('0x2d')][_0x43ce('0x2e')]};});_0x34bb16[_0x43ce('0x2f')]=_[_0x43ce('0x29')](_0x284710,_0x43ce('0x27'));_0x34bb16[_0x43ce('0x30')]=_['keys'](_0x382c71[_0x43ce('0x30')]);_0x34bb16[_0x43ce('0x31')]=_[_0x43ce('0x32')](_0x34bb16[_0x43ce('0x2f')],_0x34bb16[_0x43ce('0x30')]);_0x31ab16[_0x43ce('0x33')]=_['intersection'](_0x34bb16[_0x43ce('0x2f')],qs['fields'](_0x382c71[_0x43ce('0x30')][_0x43ce('0x34')]));_0x31ab16['attributes']=_0x31ab16[_0x43ce('0x33')]['length']?_0x31ab16['attributes']:_0x34bb16[_0x43ce('0x2f')];if(!_0x382c71[_0x43ce('0x30')][_0x43ce('0x35')](_0x43ce('0x36'))){_0x31ab16[_0x43ce('0x1e')]=qs[_0x43ce('0x1e')](_0x382c71[_0x43ce('0x30')][_0x43ce('0x1e')]);_0x31ab16['offset']=qs['offset'](_0x382c71[_0x43ce('0x30')][_0x43ce('0x1c')]);}_0x31ab16[_0x43ce('0x37')]=qs[_0x43ce('0x38')](_0x382c71['query'][_0x43ce('0x38')]);_0x31ab16[_0x43ce('0x39')]=qs['filters'](_[_0x43ce('0x3a')](_0x382c71['query'],_0x34bb16[_0x43ce('0x31')]),_0x284710);if(_0x382c71[_0x43ce('0x30')][_0x43ce('0x3b')]){_0x31ab16[_0x43ce('0x39')]=_[_0x43ce('0x3c')](_0x31ab16[_0x43ce('0x39')],{'$or':_[_0x43ce('0x29')](_0x284710,function(_0x57e98d){if(_0x57e98d['type']!==_0x43ce('0x3d')){var _0x18ab10={};_0x18ab10[_0x57e98d[_0x43ce('0x27')]]={'$like':'%'+_0x382c71[_0x43ce('0x30')]['filter']+'%'};return _0x18ab10;}})});}_0x31ab16=_[_0x43ce('0x3c')]({},_0x31ab16,_0x382c71[_0x43ce('0x3e')]);var _0x1f991d={'where':_0x31ab16[_0x43ce('0x39')]};return db[_0x43ce('0x2a')][_0x43ce('0x1f')](_0x1f991d)[_0x43ce('0x22')](function(_0x6d3327){_0x241a4f['count']=_0x6d3327;if(_0x382c71['query']['includeAll']){_0x31ab16[_0x43ce('0x3f')]=[{'all':!![]}];}return db[_0x43ce('0x2a')]['findAll'](_0x31ab16);})[_0x43ce('0x22')](function(_0x37d6f0){_0x241a4f[_0x43ce('0x40')]=_0x37d6f0;return _0x241a4f;})[_0x43ce('0x22')](respondWithFilteredResult(_0x102fbe,_0x31ab16))[_0x43ce('0x41')](handleError(_0x102fbe,null));};exports[_0x43ce('0x42')]=function(_0x1da3fc,_0x369443){var _0x2a926d={'raw':![],'where':{'id':_0x1da3fc['params']['id']}},_0x4a922d={};_0x4a922d[_0x43ce('0x2f')]=_['keys'](db[_0x43ce('0x2a')][_0x43ce('0x2b')]);_0x4a922d[_0x43ce('0x30')]=_['keys'](_0x1da3fc[_0x43ce('0x30')]);_0x4a922d[_0x43ce('0x31')]=_['intersection'](_0x4a922d[_0x43ce('0x2f')],_0x4a922d[_0x43ce('0x30')]);_0x2a926d[_0x43ce('0x33')]=_['intersection'](_0x4a922d['model'],qs[_0x43ce('0x34')](_0x1da3fc['query'][_0x43ce('0x34')]));_0x2a926d[_0x43ce('0x33')]=_0x2a926d[_0x43ce('0x33')]['length']?_0x2a926d['attributes']:_0x4a922d[_0x43ce('0x2f')];if(_0x1da3fc[_0x43ce('0x30')][_0x43ce('0x43')]){_0x2a926d[_0x43ce('0x3f')]=[{'all':!![]}];}_0x2a926d=_[_0x43ce('0x3c')]({},_0x2a926d,_0x1da3fc['options']);return db[_0x43ce('0x2a')]['find'](_0x2a926d)[_0x43ce('0x22')](handleEntityNotFound(_0x369443,null))[_0x43ce('0x22')](respondWithResult(_0x369443,null))[_0x43ce('0x41')](handleError(_0x369443,null));};exports[_0x43ce('0x44')]=function(_0x3bc85d,_0x282040){return db[_0x43ce('0x2a')][_0x43ce('0x44')](_0x3bc85d[_0x43ce('0x45')],{})[_0x43ce('0x22')](function(_0x5bd403){var _0x3be04e=_0x3bc85d[_0x43ce('0x46')][_0x43ce('0x47')]({'plain':!![]});if(!_0x3be04e)throw new Error(_0x43ce('0x48'));if(_0x3be04e[_0x43ce('0x49')]===_0x43ce('0x46')){var _0x42c849=_0x5bd403[_0x43ce('0x47')]({'plain':!![]});var _0x24265a=_0x43ce('0x24');return db[_0x43ce('0x4a')][_0x43ce('0x4b')]({'where':{'name':_0x24265a,'userProfileId':_0x3be04e[_0x43ce('0x4c')]},'raw':!![]})[_0x43ce('0x22')](function(_0x1c47d7){if(_0x1c47d7&&_0x1c47d7[_0x43ce('0x4d')]===0x0){return db[_0x43ce('0x25')]['create']({'name':_0x42c849['name'],'resourceId':_0x42c849['id'],'type':_0x1c47d7['name'],'sectionId':_0x1c47d7['id']},{})[_0x43ce('0x22')](function(){return _0x5bd403;});}else{return _0x5bd403;}})[_0x43ce('0x41')](function(_0x1ad203){logger[_0x43ce('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ad203);throw _0x1ad203;});}return _0x5bd403;})[_0x43ce('0x22')](respondWithResult(_0x282040,0xc9))['catch'](handleError(_0x282040,null));};exports[_0x43ce('0x4e')]=function(_0x1c6627,_0x4dbe46){if(_0x1c6627[_0x43ce('0x45')]['id']){delete _0x1c6627[_0x43ce('0x45')]['id'];}return db[_0x43ce('0x2a')][_0x43ce('0x4b')]({'where':{'id':_0x1c6627[_0x43ce('0x4f')]['id']}})[_0x43ce('0x22')](handleEntityNotFound(_0x4dbe46,null))[_0x43ce('0x22')](saveUpdates(_0x1c6627[_0x43ce('0x45')],null))['then'](respondWithResult(_0x4dbe46,null))[_0x43ce('0x41')](handleError(_0x4dbe46,null));};exports[_0x43ce('0x23')]=function(_0x133d17,_0x5b801c){return db['VoiceChanSpy'][_0x43ce('0x4b')]({'where':{'id':_0x133d17[_0x43ce('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5b801c,null))[_0x43ce('0x22')](removeEntity(_0x5b801c,null))[_0x43ce('0x41')](handleError(_0x5b801c,null));}; \ No newline at end of file +var _0x12c9=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise'];(function(_0x2d9e15,_0xb31a54){var _0x365289=function(_0x3d3b10){while(--_0x3d3b10){_0x2d9e15['push'](_0x2d9e15['shift']());}};_0x365289(++_0xb31a54);}(_0x12c9,0x9f));var _0x912c=function(_0x4c2ec5,_0x5db075){_0x4c2ec5=_0x4c2ec5-0x0;var _0x1494a0=_0x12c9[_0x4c2ec5];return _0x1494a0;};'use strict';var emlformat=require(_0x912c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x912c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x912c('0x2'));var moment=require('moment');var BPromise=require(_0x912c('0x3'));var Mustache=require(_0x912c('0x4'));var util=require(_0x912c('0x5'));var path=require(_0x912c('0x6'));var sox=require(_0x912c('0x7'));var csv=require(_0x912c('0x8'));var ejs=require(_0x912c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x912c('0xa'));var squel=require(_0x912c('0xb'));var crypto=require(_0x912c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x912c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x912c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x912c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x912c('0x10'))(_0x912c('0x11'));var utils=require(_0x912c('0x12'));var config=require(_0x912c('0x13'));var licenseUtil=require(_0x912c('0x14'));var db=require(_0x912c('0x15'))['db'];function respondWithStatusCode(_0x23b282,_0x5644a5){_0x5644a5=_0x5644a5||0xcc;return function(_0x268b42){if(_0x268b42){return _0x23b282[_0x912c('0x16')](_0x5644a5);}return _0x23b282[_0x912c('0x17')](_0x5644a5)['end']();};}function respondWithResult(_0x48b041,_0x1cd77b){_0x1cd77b=_0x1cd77b||0xc8;return function(_0x28142d){if(_0x28142d){return _0x48b041['status'](_0x1cd77b)[_0x912c('0x18')](_0x28142d);}};}function respondWithFilteredResult(_0x2c2232,_0x55ae08){return function(_0x4f0c33){if(_0x4f0c33){var _0x114cf=typeof _0x55ae08[_0x912c('0x19')]===_0x912c('0x1a')&&typeof _0x55ae08['limit']===_0x912c('0x1a');var _0x468ad2=_0x4f0c33[_0x912c('0x1b')];var _0x25b3d6=_0x114cf?0x0:_0x55ae08['offset'];var _0x46d34c=_0x114cf?_0x4f0c33[_0x912c('0x1b')]:_0x55ae08[_0x912c('0x19')]+_0x55ae08[_0x912c('0x1c')];var _0x562156;if(_0x46d34c>=_0x468ad2){_0x46d34c=_0x468ad2;_0x562156=0xc8;}else{_0x562156=0xce;}_0x2c2232[_0x912c('0x17')](_0x562156);return _0x2c2232[_0x912c('0x1d')](_0x912c('0x1e'),_0x25b3d6+'-'+_0x46d34c+'/'+_0x468ad2)[_0x912c('0x18')](_0x4f0c33);}return null;};}function patchUpdates(_0x551576){return function(_0x2a41a2){try{jsonpatch[_0x912c('0x1f')](_0x2a41a2,_0x551576,!![]);}catch(_0xbca0af){return BPromise[_0x912c('0x20')](_0xbca0af);}return _0x2a41a2['save']();};}function saveUpdates(_0x4f6272,_0x27f644){return function(_0x2eb96b){if(_0x2eb96b){return _0x2eb96b[_0x912c('0x21')](_0x4f6272)[_0x912c('0x22')](function(_0x534cd2){return _0x534cd2;});}return null;};}function removeEntity(_0x35d2f3,_0x16bf68){return function(_0x4e79ba){if(_0x4e79ba){return _0x4e79ba[_0x912c('0x23')]()[_0x912c('0x22')](function(){var _0x5e2bea=_0x4e79ba[_0x912c('0x24')]({'plain':!![]});var _0x59a7a2='ChanSpies';return db[_0x912c('0x25')][_0x912c('0x23')]({'where':{'type':_0x59a7a2,'resourceId':_0x5e2bea['id']}})['then'](function(){return _0x4e79ba;});})['then'](function(){_0x35d2f3[_0x912c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b614,_0x269283){return function(_0xd46b89){if(!_0xd46b89){_0x46b614[_0x912c('0x16')](0x194);}return _0xd46b89;};}function handleError(_0x8746a7,_0xb626a){_0xb626a=_0xb626a||0x1f4;return function(_0x344e6d){logger[_0x912c('0x26')](_0x344e6d[_0x912c('0x27')]);if(_0x344e6d['name']){delete _0x344e6d[_0x912c('0x28')];}_0x8746a7[_0x912c('0x17')](_0xb626a)[_0x912c('0x29')](_0x344e6d);};}exports[_0x912c('0x2a')]=function(_0xccb6c0,_0x4f1eed){var _0x49164e={},_0x5b4740={},_0xe08372={'count':0x0,'rows':[]};var _0x3f21fd=_['map'](db[_0x912c('0x2b')][_0x912c('0x2c')],function(_0x43b16d){return{'name':_0x43b16d['fieldName'],'type':_0x43b16d[_0x912c('0x2d')][_0x912c('0x2e')]};});_0x5b4740[_0x912c('0x2f')]=_[_0x912c('0x30')](_0x3f21fd,_0x912c('0x28'));_0x5b4740[_0x912c('0x31')]=_[_0x912c('0x32')](_0xccb6c0['query']);_0x5b4740[_0x912c('0x33')]=_[_0x912c('0x34')](_0x5b4740['model'],_0x5b4740['query']);_0x49164e[_0x912c('0x35')]=_['intersection'](_0x5b4740[_0x912c('0x2f')],qs['fields'](_0xccb6c0[_0x912c('0x31')][_0x912c('0x36')]));_0x49164e[_0x912c('0x35')]=_0x49164e[_0x912c('0x35')][_0x912c('0x37')]?_0x49164e[_0x912c('0x35')]:_0x5b4740[_0x912c('0x2f')];if(!_0xccb6c0[_0x912c('0x31')][_0x912c('0x38')]('nolimit')){_0x49164e[_0x912c('0x1c')]=qs[_0x912c('0x1c')](_0xccb6c0['query'][_0x912c('0x1c')]);_0x49164e[_0x912c('0x19')]=qs[_0x912c('0x19')](_0xccb6c0[_0x912c('0x31')]['offset']);}_0x49164e[_0x912c('0x39')]=qs['sort'](_0xccb6c0[_0x912c('0x31')][_0x912c('0x3a')]);_0x49164e[_0x912c('0x3b')]=qs['filters'](_[_0x912c('0x3c')](_0xccb6c0[_0x912c('0x31')],_0x5b4740[_0x912c('0x33')]),_0x3f21fd);if(_0xccb6c0[_0x912c('0x31')][_0x912c('0x3d')]){_0x49164e[_0x912c('0x3b')]=_[_0x912c('0x3e')](_0x49164e[_0x912c('0x3b')],{'$or':_[_0x912c('0x30')](_0x3f21fd,function(_0x49a168){if(_0x49a168[_0x912c('0x2d')]!==_0x912c('0x3f')){var _0x105905={};_0x105905[_0x49a168['name']]={'$like':'%'+_0xccb6c0[_0x912c('0x31')][_0x912c('0x3d')]+'%'};return _0x105905;}})});}_0x49164e=_[_0x912c('0x3e')]({},_0x49164e,_0xccb6c0[_0x912c('0x40')]);var _0x5e209b={'where':_0x49164e[_0x912c('0x3b')]};return db['VoiceChanSpy'][_0x912c('0x1b')](_0x5e209b)[_0x912c('0x22')](function(_0x544da1){_0xe08372[_0x912c('0x1b')]=_0x544da1;if(_0xccb6c0['query'][_0x912c('0x41')]){_0x49164e[_0x912c('0x42')]=[{'all':!![]}];}return db[_0x912c('0x2b')][_0x912c('0x43')](_0x49164e);})['then'](function(_0x320585){_0xe08372[_0x912c('0x44')]=_0x320585;return _0xe08372;})[_0x912c('0x22')](respondWithFilteredResult(_0x4f1eed,_0x49164e))[_0x912c('0x45')](handleError(_0x4f1eed,null));};exports[_0x912c('0x46')]=function(_0x201b30,_0x18b4e5){var _0x1b9c5c={'raw':![],'where':{'id':_0x201b30[_0x912c('0x47')]['id']}},_0x309d3f={};_0x309d3f[_0x912c('0x2f')]=_[_0x912c('0x32')](db[_0x912c('0x2b')][_0x912c('0x2c')]);_0x309d3f['query']=_[_0x912c('0x32')](_0x201b30[_0x912c('0x31')]);_0x309d3f[_0x912c('0x33')]=_['intersection'](_0x309d3f['model'],_0x309d3f[_0x912c('0x31')]);_0x1b9c5c['attributes']=_['intersection'](_0x309d3f[_0x912c('0x2f')],qs[_0x912c('0x36')](_0x201b30[_0x912c('0x31')][_0x912c('0x36')]));_0x1b9c5c['attributes']=_0x1b9c5c[_0x912c('0x35')][_0x912c('0x37')]?_0x1b9c5c[_0x912c('0x35')]:_0x309d3f[_0x912c('0x2f')];if(_0x201b30['query'][_0x912c('0x41')]){_0x1b9c5c[_0x912c('0x42')]=[{'all':!![]}];}_0x1b9c5c=_[_0x912c('0x3e')]({},_0x1b9c5c,_0x201b30['options']);return db[_0x912c('0x2b')][_0x912c('0x48')](_0x1b9c5c)[_0x912c('0x22')](handleEntityNotFound(_0x18b4e5,null))['then'](respondWithResult(_0x18b4e5,null))[_0x912c('0x45')](handleError(_0x18b4e5,null));};exports[_0x912c('0x49')]=function(_0x56bd1d,_0x31b145){return db[_0x912c('0x2b')]['create'](_0x56bd1d[_0x912c('0x4a')],{})[_0x912c('0x22')](function(_0x3b1b0e){var _0x3a7acd=_0x56bd1d['user'][_0x912c('0x24')]({'plain':!![]});if(!_0x3a7acd)throw new Error(_0x912c('0x4b'));if(_0x3a7acd['role']===_0x912c('0x4c')){var _0x5388c0=_0x3b1b0e[_0x912c('0x24')]({'plain':!![]});var _0x57ff91=_0x912c('0x4d');return db['UserProfileSection'][_0x912c('0x48')]({'where':{'name':_0x57ff91,'userProfileId':_0x3a7acd[_0x912c('0x4e')]},'raw':!![]})['then'](function(_0x5a4b0c){if(_0x5a4b0c&&_0x5a4b0c[_0x912c('0x4f')]===0x0){return db['UserProfileResource'][_0x912c('0x49')]({'name':_0x5388c0[_0x912c('0x28')],'resourceId':_0x5388c0['id'],'type':_0x5a4b0c[_0x912c('0x28')],'sectionId':_0x5a4b0c['id']},{})[_0x912c('0x22')](function(){return _0x3b1b0e;});}else{return _0x3b1b0e;}})[_0x912c('0x45')](function(_0x565f31){logger[_0x912c('0x26')](_0x912c('0x50'),_0x565f31);throw _0x565f31;});}return _0x3b1b0e;})[_0x912c('0x22')](respondWithResult(_0x31b145,0xc9))[_0x912c('0x45')](handleError(_0x31b145,null));};exports[_0x912c('0x21')]=function(_0x48379a,_0x1e92c8){if(_0x48379a[_0x912c('0x4a')]['id']){delete _0x48379a[_0x912c('0x4a')]['id'];}return db['VoiceChanSpy'][_0x912c('0x48')]({'where':{'id':_0x48379a['params']['id']}})[_0x912c('0x22')](handleEntityNotFound(_0x1e92c8,null))[_0x912c('0x22')](saveUpdates(_0x48379a['body'],null))[_0x912c('0x22')](respondWithResult(_0x1e92c8,null))[_0x912c('0x45')](handleError(_0x1e92c8,null));};exports['destroy']=function(_0x1a5918,_0x102c7e){return db['VoiceChanSpy']['find']({'where':{'id':_0x1a5918[_0x912c('0x47')]['id']}})[_0x912c('0x22')](handleEntityNotFound(_0x102c7e,null))[_0x912c('0x22')](removeEntity(_0x102c7e,null))[_0x912c('0x45')](handleError(_0x102c7e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 74ac01f..418d910 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 _0x58de=['name','User','agent','then','exports','models','define','VoiceChanSpy','length','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','context','from-sip','%s%s','prefix','push','Set','format','CDR(type)=%s','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','options','join','StopMixMonitor','concat','internal'];(function(_0x185334,_0x4630ac){var _0xf2e59a=function(_0x3cc497){while(--_0x3cc497){_0x185334['push'](_0x185334['shift']());}};_0xf2e59a(++_0x4630ac);}(_0x58de,0x12d));var _0xe58d=function(_0x33f3fc,_0x2eaf31){_0x33f3fc=_0x33f3fc-0x0;var _0x156e09=_0x58de[_0x33f3fc];return _0x156e09;};'use strict';var _=require(_0xe58d('0x0'));var util=require(_0xe58d('0x1'));var BPromise=require(_0xe58d('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xddd1fc,_0x215c9c,_0x574566){var _0x3bcb9b=0x1;var _0x2e7e9c=[];var _0x3b8516={'context':_0x215c9c[_0xe58d('0x3')]||_0xe58d('0x4'),'exten':util['format'](_0xe58d('0x5'),_0xddd1fc[_0xe58d('0x6')],_0x574566),'type':'system','isApp':![],'ChanSpyId':_0xddd1fc['id'],'UserId':_0x215c9c['id']};_0x2e7e9c[_0xe58d('0x7')](_['merge']({'app':_0xe58d('0x8'),'appdata':util[_0xe58d('0x9')](_0xe58d('0xa'),'chanspy'),'priority':_0x3bcb9b++},_0x3b8516));if(_0xddd1fc[_0xe58d('0xb')]){_0x2e7e9c[_0xe58d('0x7')](_[_0xe58d('0xc')]({'app':_0xe58d('0xd'),'appdata':util[_0xe58d('0x9')](_0xe58d('0xe'),_0xddd1fc[_0xe58d('0xf')]),'priority':_0x3bcb9b++},_0x3b8516));}if(_0xddd1fc['auth']){_0x2e7e9c[_0xe58d('0x7')](_[_0xe58d('0xc')]({'app':'Authenticate','appdata':_0xddd1fc[_0xe58d('0x10')],'priority':_0x3bcb9b++},_0x3b8516));}_0x2e7e9c[_0xe58d('0x7')](_['merge']({'app':_0xe58d('0x11'),'appdata':util[_0xe58d('0x9')]('SIP/%s,%s',_0x215c9c['name'],_0xddd1fc[_0xe58d('0x12')]?_0xddd1fc[_0xe58d('0x12')][_0xe58d('0x13')](''):''),'priority':_0x3bcb9b++},_0x3b8516));if(_0xddd1fc[_0xe58d('0xb')]){_0x2e7e9c['push'](_[_0xe58d('0xc')]({'app':_0xe58d('0x14'),'priority':_0x3bcb9b++},_0x3b8516));}return _0x2e7e9c;};var getChanSpyApplications=function(_0x4d962a,_0x584b81){var _0x8dfaed=[];for(var _0x2d0d78=0x0,_0xec09e3=0x1;_0x2d0d78<_0x584b81['length'];_0x2d0d78++,_0xec09e3=0x1){_0x8dfaed=_0x8dfaed[_0xe58d('0x15')](getUserApplications(_0x4d962a,_0x584b81[_0x2d0d78],_0x584b81[_0x2d0d78][_0xe58d('0x16')]));if(_0x584b81[_0x2d0d78][_0xe58d('0x16')]!=_0x584b81[_0x2d0d78][_0xe58d('0x17')]){_0x8dfaed=_0x8dfaed[_0xe58d('0x15')](getUserApplications(_0x4d962a,_0x584b81[_0x2d0d78],_0x584b81[_0x2d0d78][_0xe58d('0x17')]));}}return _0x8dfaed;};var getChanSpyPromise=function(_0x49b509,_0x253910){return new BPromise(function(_0x1cb0c6,_0x50b940){return _0x49b509[_0xe58d('0x18')]['findAll']({'attributes':['id','name',_0xe58d('0x16')],'where':{'role':_0xe58d('0x19'),'chanspy':!![]},'raw':!![]})[_0xe58d('0x1a')](function(_0x109154){if(_0x109154){return _0x1cb0c6(getChanSpyApplications(_0x253910,_0x109154));}return _0x1cb0c6([]);})['catch'](function(_0x155ea6){_0x50b940(_0x155ea6);});});};module[_0xe58d('0x1b')]=function(_0x4b4124,_0x593c1b){var _0x374f77=_0x4b4124[_0xe58d('0x1c')];return _0x4b4124[_0xe58d('0x1d')](_0xe58d('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x25be66,_0x511a43,_0x17bd06){return getChanSpyPromise(_0x374f77,_0x25be66)[_0xe58d('0x1a')](function(_0x50a9c5){if(_0x50a9c5&&_0x50a9c5[_0xe58d('0x1f')]){return _0x374f77[_0xe58d('0x20')][_0xe58d('0x21')](_0x50a9c5);}})[_0xe58d('0x1a')](function(){_0x17bd06();})[_0xe58d('0x22')](function(_0x27b914){_0x17bd06(_0x27b914);});},'afterUpdate':function(_0x3a6384,_0x3ce1c6,_0x3a713c){return _0x374f77['VoiceExtension'][_0xe58d('0x23')]({'where':{'ChanSpyId':_0x3a6384['id']}})['then'](function(){return getChanSpyPromise(_0x374f77,_0x3a6384);})['then'](function(_0x380aed){if(_0x380aed&&_0x380aed[_0xe58d('0x1f')]){return _0x374f77['VoiceExtension'][_0xe58d('0x21')](_0x380aed);}})['then'](function(){_0x3a713c();})[_0xe58d('0x22')](function(_0x2ebb9d){_0x3a713c(_0x2ebb9d);});},'afterDestroy':function(_0x597077,_0x5ea282,_0x2865bd){return _0x374f77['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x597077['id']}})[_0xe58d('0x1a')](function(){_0x2865bd();})[_0xe58d('0x22')](function(_0x116f29){_0x2865bd(_0x116f29);});}}});}; \ No newline at end of file +var _0x393b=['push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','findAll','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system'];(function(_0x2d86f2,_0x5e1b5c){var _0x4d2124=function(_0x4b6c2f){while(--_0x4b6c2f){_0x2d86f2['push'](_0x2d86f2['shift']());}};_0x4d2124(++_0x5e1b5c);}(_0x393b,0xed));var _0xb393=function(_0x1416fc,_0x72e155){_0x1416fc=_0x1416fc-0x0;var _0x3a4b34=_0x393b[_0x1416fc];return _0x3a4b34;};'use strict';var _=require(_0xb393('0x0'));var util=require(_0xb393('0x1'));var BPromise=require(_0xb393('0x2'));var attributes=require(_0xb393('0x3'));var getUserApplications=function(_0x561d0f,_0x10d45e,_0xe9144b){var _0x1cb6ed=0x1;var _0x568266=[];var _0x3ea1c0={'context':_0x10d45e['context']||_0xb393('0x4'),'exten':util[_0xb393('0x5')](_0xb393('0x6'),_0x561d0f[_0xb393('0x7')],_0xe9144b),'type':_0xb393('0x8'),'isApp':![],'ChanSpyId':_0x561d0f['id'],'UserId':_0x10d45e['id']};_0x568266[_0xb393('0x9')](_[_0xb393('0xa')]({'app':_0xb393('0xb'),'appdata':util[_0xb393('0x5')](_0xb393('0xc'),_0xb393('0xd')),'priority':_0x1cb6ed++},_0x3ea1c0));if(_0x561d0f[_0xb393('0xe')]){_0x568266['push'](_[_0xb393('0xa')]({'app':_0xb393('0xf'),'appdata':util[_0xb393('0x5')](_0xb393('0x10'),_0x561d0f[_0xb393('0x11')]),'priority':_0x1cb6ed++},_0x3ea1c0));}if(_0x561d0f[_0xb393('0x12')]){_0x568266[_0xb393('0x9')](_['merge']({'app':_0xb393('0x13'),'appdata':_0x561d0f[_0xb393('0x14')],'priority':_0x1cb6ed++},_0x3ea1c0));}_0x568266[_0xb393('0x9')](_[_0xb393('0xa')]({'app':_0xb393('0x15'),'appdata':util['format'](_0xb393('0x16'),_0x10d45e[_0xb393('0x17')],_0x561d0f['options']?_0x561d0f[_0xb393('0x18')][_0xb393('0x19')](''):''),'priority':_0x1cb6ed++},_0x3ea1c0));if(_0x561d0f['record']){_0x568266[_0xb393('0x9')](_[_0xb393('0xa')]({'app':'StopMixMonitor','priority':_0x1cb6ed++},_0x3ea1c0));}return _0x568266;};var getChanSpyApplications=function(_0x5d230b,_0x167551){var _0x52ca03=[];for(var _0x206b88=0x0,_0x12e1df=0x1;_0x206b88<_0x167551['length'];_0x206b88++,_0x12e1df=0x1){_0x52ca03=_0x52ca03[_0xb393('0x1a')](getUserApplications(_0x5d230b,_0x167551[_0x206b88],_0x167551[_0x206b88][_0xb393('0x1b')]));if(_0x167551[_0x206b88][_0xb393('0x1b')]!=_0x167551[_0x206b88][_0xb393('0x17')]){_0x52ca03=_0x52ca03[_0xb393('0x1a')](getUserApplications(_0x5d230b,_0x167551[_0x206b88],_0x167551[_0x206b88]['name']));}}return _0x52ca03;};var getChanSpyPromise=function(_0x49f713,_0x1919fc){return new BPromise(function(_0x153f55,_0x4fb89c){return _0x49f713[_0xb393('0x1c')][_0xb393('0x1d')]({'attributes':['id',_0xb393('0x17'),_0xb393('0x1b')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xb393('0x1e')](function(_0x2aadbe){if(_0x2aadbe){return _0x153f55(getChanSpyApplications(_0x1919fc,_0x2aadbe));}return _0x153f55([]);})[_0xb393('0x1f')](function(_0x3dbb4f){_0x4fb89c(_0x3dbb4f);});});};module[_0xb393('0x20')]=function(_0x1c5a6b,_0x5e51a3){var _0x3fdb71=_0x1c5a6b[_0xb393('0x21')];return _0x1c5a6b[_0xb393('0x22')](_0xb393('0x23'),attributes,{'tableName':_0xb393('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3add5c,_0x7532f,_0x405721){return getChanSpyPromise(_0x3fdb71,_0x3add5c)[_0xb393('0x1e')](function(_0x28e3c8){if(_0x28e3c8&&_0x28e3c8['length']){return _0x3fdb71[_0xb393('0x25')][_0xb393('0x26')](_0x28e3c8);}})['then'](function(){_0x405721();})['catch'](function(_0x4557d8){_0x405721(_0x4557d8);});},'afterUpdate':function(_0x510908,_0x3c5f6b,_0x366215){return _0x3fdb71['VoiceExtension'][_0xb393('0x27')]({'where':{'ChanSpyId':_0x510908['id']}})[_0xb393('0x1e')](function(){return getChanSpyPromise(_0x3fdb71,_0x510908);})[_0xb393('0x1e')](function(_0x4527df){if(_0x4527df&&_0x4527df[_0xb393('0x28')]){return _0x3fdb71[_0xb393('0x25')][_0xb393('0x26')](_0x4527df);}})[_0xb393('0x1e')](function(){_0x366215();})[_0xb393('0x1f')](function(_0x232a5f){_0x366215(_0x232a5f);});},'afterDestroy':function(_0x452d84,_0x377cad,_0xd2f568){return _0x3fdb71[_0xb393('0x25')]['destroy']({'where':{'ChanSpyId':_0x452d84['id']}})['then'](function(){_0xd2f568();})[_0xb393('0x1f')](function(_0x68978){_0xd2f568(_0x68978);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 833e06a..419945b 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 _0x2750=['jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x501942,_0x2e712f){var _0x3d37e1=function(_0x43e7bf){while(--_0x43e7bf){_0x501942['push'](_0x501942['shift']());}};_0x3d37e1(++_0x2e712f);}(_0x2750,0x13b));var _0x0275=function(_0x30aba9,_0x27185d){_0x30aba9=_0x30aba9-0x0;var _0x1a9315=_0x2750[_0x30aba9];return _0x1a9315;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file +var _0x7072=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x300a0a,_0x1653d4){var _0x28b718=function(_0x1100ce){while(--_0x1100ce){_0x300a0a['push'](_0x300a0a['shift']());}};_0x28b718(++_0x1653d4);}(_0x7072,0x138));var _0x2707=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x7072[_0x2261ce];return _0x524640;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4ad0eef..0150d79 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 _0x47c4=['put','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x47c4,0x1a6));var _0x447c=function(_0x33f34e,_0x4fde5b){_0x33f34e=_0x33f34e-0x0;var _0x58dc01=_0x47c4[_0x33f34e];return _0x58dc01;};'use strict';var multer=require(_0x447c('0x0'));var util=require(_0x447c('0x1'));var path=require(_0x447c('0x2'));var timeout=require(_0x447c('0x3'));var express=require('express');var router=express[_0x447c('0x4')]();var fs_extra=require(_0x447c('0x5'));var auth=require(_0x447c('0x6'));var interaction=require(_0x447c('0x7'));var config=require(_0x447c('0x8'));var controller=require(_0x447c('0x9'));router[_0x447c('0xa')]('/',auth[_0x447c('0xb')](),controller[_0x447c('0xc')]);router[_0x447c('0xa')]('/:id',auth[_0x447c('0xb')](),controller['show']);router[_0x447c('0xd')]('/',auth[_0x447c('0xb')](),controller[_0x447c('0xe')]);router[_0x447c('0xf')](_0x447c('0x10'),auth[_0x447c('0xb')](),controller[_0x447c('0x11')]);router['delete']('/:id',auth[_0x447c('0xb')](),controller[_0x447c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1880=['create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','post'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x1880,0xc2));var _0x0188=function(_0x282320,_0x379ad6){_0x282320=_0x282320-0x0;var _0x271d54=_0x1880[_0x282320];return _0x271d54;};'use strict';var multer=require('multer');var util=require(_0x0188('0x0'));var path=require(_0x0188('0x1'));var timeout=require(_0x0188('0x2'));var express=require(_0x0188('0x3'));var router=express['Router']();var fs_extra=require(_0x0188('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0188('0x5'));var controller=require(_0x0188('0x6'));router[_0x0188('0x7')]('/',auth[_0x0188('0x8')](),controller['index']);router[_0x0188('0x7')]('/:id',auth[_0x0188('0x8')](),controller['show']);router[_0x0188('0x9')]('/',auth['isAuthenticated'](),controller[_0x0188('0xa')]);router[_0x0188('0xb')]('/:id',auth[_0x0188('0x8')](),controller[_0x0188('0xc')]);router[_0x0188('0xd')](_0x0188('0xe'),auth[_0x0188('0x8')](),controller[_0x0188('0xf')]);module[_0x0188('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index dca5820..f7bb233 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 _0x4374=['name','BOOLEAN','exports','STRING'];(function(_0x4e969a,_0x11efc3){var _0x4c37ce=function(_0x499e9f){while(--_0x499e9f){_0x4e969a['push'](_0x4e969a['shift']());}};_0x4c37ce(++_0x11efc3);}(_0x4374,0xae));var _0x4437=function(_0x8d7d99,_0x58fd90){_0x8d7d99=_0x8d7d99-0x0;var _0x5ddd6a=_0x4374[_0x8d7d99];return _0x5ddd6a;};'use strict';var Sequelize=require('sequelize');module[_0x4437('0x0')]={'name':{'type':Sequelize[_0x4437('0x1')],'unique':_0x4437('0x2')},'description':{'type':Sequelize[_0x4437('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4437('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbf2b=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x4a9650,_0x743543){var _0x28b475=function(_0x557404){while(--_0x557404){_0x4a9650['push'](_0x4a9650['shift']());}};_0x28b475(++_0x743543);}(_0xbf2b,0x12f));var _0xbbf2=function(_0xbc07fb,_0x6c7b3f){_0xbc07fb=_0xbc07fb-0x0;var _0x26a009=_0xbf2b[_0xbc07fb];return _0x26a009;};'use strict';var Sequelize=require(_0xbbf2('0x0'));module[_0xbbf2('0x1')]={'name':{'type':Sequelize[_0xbbf2('0x2')],'unique':_0xbbf2('0x3')},'description':{'type':Sequelize[_0xbbf2('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbbf2('0x4')],'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 d85af11..36902d3 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 _0x44c3=['pick','VIRTUAL','options','includeAll','findAll','show','params','include','merge','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','render','writeFileSync','join','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','Contexts','destroy','stack','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where'];(function(_0x5bd332,_0x2a930a){var _0x54079b=function(_0x4d510b){while(--_0x4d510b){_0x5bd332['push'](_0x5bd332['shift']());}};_0x54079b(++_0x2a930a);}(_0x44c3,0xea));var _0x344c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x344c('0x0'));var rimraf=require(_0x344c('0x1'));var zipdir=require(_0x344c('0x2'));var jsonpatch=require(_0x344c('0x3'));var rp=require('request-promise');var moment=require(_0x344c('0x4'));var BPromise=require(_0x344c('0x5'));var Mustache=require(_0x344c('0x6'));var util=require(_0x344c('0x7'));var path=require(_0x344c('0x8'));var sox=require('sox');var csv=require(_0x344c('0x9'));var ejs=require(_0x344c('0xa'));var fs=require('fs');var fs_extra=require(_0x344c('0xb'));var _=require(_0x344c('0xc'));var squel=require(_0x344c('0xd'));var crypto=require('crypto');var jsforce=require(_0x344c('0xe'));var deskjs=require(_0x344c('0xf'));var toCsv=require(_0x344c('0x9'));var querystring=require('querystring');var Papa=require(_0x344c('0x10'));var Redis=require(_0x344c('0x11'));var authService=require(_0x344c('0x12'));var qs=require(_0x344c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x344c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x344c('0x15'));var config=require(_0x344c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x344c('0x17'))['db'];var jayson=require(_0x344c('0x18'));var client=jayson[_0x344c('0x19')][_0x344c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x31dbae,_0x127f96,_0xeb2696,_0x51c5a9){return new BPromise(function(_0x4dd746,_0x497437){var _0x4e563c=_0x51c5a9||client;return _0x4e563c[_0x344c('0x1b')](_0x31dbae,_0xeb2696)[_0x344c('0x1c')](function(_0x54374a){logger[_0x344c('0x1d')](_0x344c('0x1e'),_0x127f96,_0x344c('0x1f'));logger[_0x344c('0x20')](_0x344c('0x21'),_0x127f96,_0x344c('0x1f'),JSON[_0x344c('0x22')](_0x54374a));if(_0x54374a[_0x344c('0x23')]){if(_0x54374a['error'][_0x344c('0x24')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x127f96,_0x54374a['error']['message']);return _0x497437(_0x54374a[_0x344c('0x23')][_0x344c('0x25')]);}logger[_0x344c('0x23')](_0x344c('0x1e'),_0x127f96,_0x54374a[_0x344c('0x23')]['message']);return _0x4dd746(_0x54374a['error'][_0x344c('0x25')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x127f96,_0x344c('0x1f'));_0x4dd746(_0x54374a[_0x344c('0x26')][_0x344c('0x25')]);}})[_0x344c('0x27')](function(_0x5c646c){logger[_0x344c('0x23')](_0x344c('0x1e'),_0x127f96,_0x5c646c);_0x497437(_0x5c646c);});});}function respondWithStatusCode(_0x17aa44,_0x43950f){_0x43950f=_0x43950f||0xcc;return function(_0xb35a6b){if(_0xb35a6b){return _0x17aa44[_0x344c('0x28')](_0x43950f);}return _0x17aa44[_0x344c('0x29')](_0x43950f)['end']();};}function respondWithResult(_0xd68136,_0x127e85){_0x127e85=_0x127e85||0xc8;return function(_0x4db917){if(_0x4db917){return _0xd68136['status'](_0x127e85)[_0x344c('0x2a')](_0x4db917);}};}function respondWithFilteredResult(_0x2d566a,_0x532b37){return function(_0x137dce){if(_0x137dce){var _0x15ccdb=typeof _0x532b37[_0x344c('0x2b')]===_0x344c('0x2c')&&typeof _0x532b37[_0x344c('0x2d')]===_0x344c('0x2c');var _0xdec8f0=_0x137dce['count'];var _0x4b8a7c=_0x15ccdb?0x0:_0x532b37[_0x344c('0x2b')];var _0x38c8b1=_0x15ccdb?_0x137dce[_0x344c('0x2e')]:_0x532b37[_0x344c('0x2b')]+_0x532b37[_0x344c('0x2d')];var _0x348ce6;if(_0x38c8b1>=_0xdec8f0){_0x38c8b1=_0xdec8f0;_0x348ce6=0xc8;}else{_0x348ce6=0xce;}_0x2d566a[_0x344c('0x29')](_0x348ce6);return _0x2d566a['set'](_0x344c('0x2f'),_0x4b8a7c+'-'+_0x38c8b1+'/'+_0xdec8f0)[_0x344c('0x2a')](_0x137dce);}return null;};}function patchUpdates(_0x7cd92c){return function(_0x360be1){try{jsonpatch[_0x344c('0x30')](_0x360be1,_0x7cd92c,!![]);}catch(_0x23e9b9){return BPromise['reject'](_0x23e9b9);}return _0x360be1[_0x344c('0x31')]();};}function saveUpdates(_0x3adcf3,_0x50c430){return function(_0x19b681){if(_0x19b681){return _0x19b681[_0x344c('0x32')](_0x3adcf3)['then'](function(_0x25027a){return _0x25027a;});}return null;};}function removeEntity(_0x479b73,_0x2bc822){return function(_0x4af28b){if(_0x4af28b){return _0x4af28b['destroy']()[_0x344c('0x1c')](function(){var _0x25583b=_0x4af28b[_0x344c('0x33')]({'plain':!![]});var _0x441e93=_0x344c('0x34');return db['UserProfileResource'][_0x344c('0x35')]({'where':{'type':_0x441e93,'resourceId':_0x25583b['id']}})[_0x344c('0x1c')](function(){return _0x4af28b;});})[_0x344c('0x1c')](function(){_0x479b73['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c43d6,_0x5de4a5){return function(_0x488604){if(!_0x488604){_0x1c43d6['sendStatus'](0x194);}return _0x488604;};}function handleError(_0x3c3ed7,_0x218882){_0x218882=_0x218882||0x1f4;return function(_0x265f19){logger['error'](_0x265f19[_0x344c('0x36')]);if(_0x265f19[_0x344c('0x37')]){delete _0x265f19[_0x344c('0x37')];}_0x3c3ed7[_0x344c('0x29')](_0x218882)[_0x344c('0x38')](_0x265f19);};}exports[_0x344c('0x39')]=function(_0x11c2a3,_0x5706fc){var _0x4b9c9a={},_0x54ec8d={},_0x28720a={'count':0x0,'rows':[]};var _0x5c055b=_['map'](db[_0x344c('0x3a')][_0x344c('0x3b')],function(_0x57ba9a){return{'name':_0x57ba9a[_0x344c('0x3c')],'type':_0x57ba9a[_0x344c('0x3d')][_0x344c('0x3e')]};});_0x54ec8d[_0x344c('0x3f')]=_[_0x344c('0x40')](_0x5c055b,_0x344c('0x37'));_0x54ec8d[_0x344c('0x41')]=_[_0x344c('0x42')](_0x11c2a3['query']);_0x54ec8d[_0x344c('0x43')]=_[_0x344c('0x44')](_0x54ec8d['model'],_0x54ec8d[_0x344c('0x41')]);_0x4b9c9a[_0x344c('0x45')]=_['intersection'](_0x54ec8d[_0x344c('0x3f')],qs[_0x344c('0x46')](_0x11c2a3[_0x344c('0x41')]['fields']));_0x4b9c9a[_0x344c('0x45')]=_0x4b9c9a['attributes']['length']?_0x4b9c9a['attributes']:_0x54ec8d[_0x344c('0x3f')];if(!_0x11c2a3[_0x344c('0x41')]['hasOwnProperty'](_0x344c('0x47'))){_0x4b9c9a[_0x344c('0x2d')]=qs[_0x344c('0x2d')](_0x11c2a3['query'][_0x344c('0x2d')]);_0x4b9c9a[_0x344c('0x2b')]=qs[_0x344c('0x2b')](_0x11c2a3['query'][_0x344c('0x2b')]);}_0x4b9c9a[_0x344c('0x48')]=qs[_0x344c('0x49')](_0x11c2a3[_0x344c('0x41')][_0x344c('0x49')]);_0x4b9c9a[_0x344c('0x4a')]=qs[_0x344c('0x43')](_[_0x344c('0x4b')](_0x11c2a3[_0x344c('0x41')],_0x54ec8d[_0x344c('0x43')]),_0x5c055b);if(_0x11c2a3['query']['filter']){_0x4b9c9a[_0x344c('0x4a')]=_['merge'](_0x4b9c9a['where'],{'$or':_['map'](_0x5c055b,function(_0x2e75b7){if(_0x2e75b7[_0x344c('0x3d')]!==_0x344c('0x4c')){var _0x149f58={};_0x149f58[_0x2e75b7[_0x344c('0x37')]]={'$like':'%'+_0x11c2a3[_0x344c('0x41')]['filter']+'%'};return _0x149f58;}})});}_0x4b9c9a=_['merge']({},_0x4b9c9a,_0x11c2a3[_0x344c('0x4d')]);var _0xbda49c={'where':_0x4b9c9a['where']};return db[_0x344c('0x3a')][_0x344c('0x2e')](_0xbda49c)[_0x344c('0x1c')](function(_0x26ce11){_0x28720a[_0x344c('0x2e')]=_0x26ce11;if(_0x11c2a3[_0x344c('0x41')][_0x344c('0x4e')]){_0x4b9c9a['include']=[{'all':!![]}];}return db[_0x344c('0x3a')][_0x344c('0x4f')](_0x4b9c9a);})['then'](function(_0x51c05d){_0x28720a['rows']=_0x51c05d;return _0x28720a;})[_0x344c('0x1c')](respondWithFilteredResult(_0x5706fc,_0x4b9c9a))['catch'](handleError(_0x5706fc,null));};exports[_0x344c('0x50')]=function(_0x1ddf2f,_0x5df9de){var _0x52c105={'raw':![],'where':{'id':_0x1ddf2f[_0x344c('0x51')]['id']}},_0x47dff5={};_0x47dff5['model']=_['keys'](db[_0x344c('0x3a')][_0x344c('0x3b')]);_0x47dff5[_0x344c('0x41')]=_[_0x344c('0x42')](_0x1ddf2f['query']);_0x47dff5['filters']=_[_0x344c('0x44')](_0x47dff5[_0x344c('0x3f')],_0x47dff5[_0x344c('0x41')]);_0x52c105['attributes']=_[_0x344c('0x44')](_0x47dff5[_0x344c('0x3f')],qs[_0x344c('0x46')](_0x1ddf2f[_0x344c('0x41')][_0x344c('0x46')]));_0x52c105[_0x344c('0x45')]=_0x52c105[_0x344c('0x45')]['length']?_0x52c105['attributes']:_0x47dff5[_0x344c('0x3f')];if(_0x1ddf2f['query']['includeAll']){_0x52c105[_0x344c('0x52')]=[{'all':!![]}];}_0x52c105=_[_0x344c('0x53')]({},_0x52c105,_0x1ddf2f[_0x344c('0x4d')]);return db[_0x344c('0x3a')][_0x344c('0x54')](_0x52c105)[_0x344c('0x1c')](handleEntityNotFound(_0x5df9de,null))[_0x344c('0x1c')](respondWithResult(_0x5df9de,null))['catch'](handleError(_0x5df9de,null));};exports[_0x344c('0x55')]=function(_0xe4cc67,_0x5a2bbb,_0xcb1a94){var _0x2c2fce;return db[_0x344c('0x3a')][_0x344c('0x55')](_0xe4cc67[_0x344c('0x56')],{'raw':!![]})['then'](function(_0x497f8b){_0x2c2fce=_0x497f8b;return db['VoiceContext'][_0x344c('0x4f')]({'raw':!![]});})[_0x344c('0x1c')](function(_0x4246f8){var _0x3bac10=fs[_0x344c('0x57')](path['join'](config[_0x344c('0x58')],_0x344c('0x59')),_0x344c('0x5a'));var _0x397b64=ejs['render'](_0x3bac10,{'contexts':_0x4246f8||[]});fs['writeFileSync'](_0x344c('0x5b'),_0x397b64);})[_0x344c('0x1c')](function(){return respondWithRpcPromise(_0x344c('0x5c'),_0x344c('0x55'),{'module':_0x344c('0x5d')});})[_0x344c('0x1c')](function(){var _0x36a13d=_0xe4cc67[_0x344c('0x5e')][_0x344c('0x33')]({'plain':!![]});if(!_0x36a13d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36a13d[_0x344c('0x5f')]==='user'){var _0x958cb9=_0x2c2fce[_0x344c('0x33')]({'plain':!![]});return db[_0x344c('0x60')][_0x344c('0x54')]({'where':{'name':_0x344c('0x34'),'userProfileId':_0x36a13d[_0x344c('0x61')]},'raw':!![]})[_0x344c('0x1c')](function(_0x26f07b){if(_0x26f07b&&_0x26f07b[_0x344c('0x62')]===0x0){return db[_0x344c('0x63')][_0x344c('0x55')]({'name':_0x958cb9['name'],'resourceId':_0x958cb9['id'],'type':_0x26f07b[_0x344c('0x37')],'sectionId':_0x26f07b['id']},{})[_0x344c('0x1c')](function(){return _0x2c2fce;});}else{return _0x2c2fce;}})[_0x344c('0x27')](function(_0xe88143){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe88143);throw _0xe88143;});}return _0x2c2fce;})[_0x344c('0x1c')](respondWithResult(_0x5a2bbb,0xc9))[_0x344c('0x27')](handleError(_0x5a2bbb,null));};exports['update']=function(_0x1a0986,_0x3e125d,_0x59a069){var _0x4b68c6;return db[_0x344c('0x3a')][_0x344c('0x54')]({'where':{'id':_0x1a0986['params']['id']}})[_0x344c('0x1c')](handleEntityNotFound(_0x3e125d,null))[_0x344c('0x1c')](saveUpdates(_0x1a0986[_0x344c('0x56')],null))[_0x344c('0x1c')](function(_0x26e548){if(_0x26e548){_0x4b68c6=_0x26e548;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x344c('0x1c')](function(_0x567179){var _0x3a158a=fs['readFileSync'](path['join'](config[_0x344c('0x58')],_0x344c('0x59')),'utf8');var _0x12191c=ejs[_0x344c('0x64')](_0x3a158a,{'contexts':_0x567179||[]});fs[_0x344c('0x65')](_0x344c('0x5b'),_0x12191c);})[_0x344c('0x1c')](function(){return respondWithRpcPromise(_0x344c('0x5c'),_0x344c('0x32'),{'module':'chan_sip.so'});})['then'](function(){return _0x4b68c6;})[_0x344c('0x1c')](respondWithResult(_0x3e125d,null))[_0x344c('0x27')](handleError(_0x3e125d,null));};exports[_0x344c('0x35')]=function(_0xb46ba8,_0x41ac8d,_0x34802f){var _0x5214c3;return db['VoiceContext'][_0x344c('0x54')]({'where':{'id':_0xb46ba8['params']['id']}})[_0x344c('0x1c')](handleEntityNotFound(_0x41ac8d,null))[_0x344c('0x1c')](removeEntity(_0x41ac8d,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x305e07){var _0x478afc=fs[_0x344c('0x57')](path[_0x344c('0x66')](config[_0x344c('0x58')],'server/files/templates/context.ejs'),_0x344c('0x5a'));var _0x4f0088=ejs[_0x344c('0x64')](_0x478afc,{'contexts':_0x305e07});fs[_0x344c('0x65')](_0x344c('0x5b'),_0x4f0088);return respondWithRpcPromise(_0x344c('0x5c'),_0x344c('0x35'),{'module':_0x344c('0x5d')});})[_0x344c('0x27')](handleError(_0x41ac8d,null));}; \ No newline at end of file +var _0xfb12=['merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','create','body','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','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','http','request','then','VoiceContext,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','Contexts','destroy','sendStatus','stack','name','send','map','VoiceContext','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters'];(function(_0x4529a6,_0xcf5c91){var _0x1f63df=function(_0x710e0c){while(--_0x710e0c){_0x4529a6['push'](_0x4529a6['shift']());}};_0x1f63df(++_0xcf5c91);}(_0xfb12,0xf1));var _0x2fb1=function(_0x55ee39,_0x4ee949){_0x55ee39=_0x55ee39-0x0;var _0x51ec97=_0xfb12[_0x55ee39];return _0x51ec97;};'use strict';var emlformat=require(_0x2fb1('0x0'));var rimraf=require(_0x2fb1('0x1'));var zipdir=require(_0x2fb1('0x2'));var jsonpatch=require(_0x2fb1('0x3'));var rp=require(_0x2fb1('0x4'));var moment=require(_0x2fb1('0x5'));var BPromise=require(_0x2fb1('0x6'));var Mustache=require('mustache');var util=require(_0x2fb1('0x7'));var path=require('path');var sox=require(_0x2fb1('0x8'));var csv=require('to-csv');var ejs=require(_0x2fb1('0x9'));var fs=require('fs');var fs_extra=require(_0x2fb1('0xa'));var _=require('lodash');var squel=require(_0x2fb1('0xb'));var crypto=require('crypto');var jsforce=require(_0x2fb1('0xc'));var deskjs=require(_0x2fb1('0xd'));var toCsv=require(_0x2fb1('0xe'));var querystring=require(_0x2fb1('0xf'));var Papa=require(_0x2fb1('0x10'));var Redis=require('ioredis');var authService=require(_0x2fb1('0x11'));var qs=require(_0x2fb1('0x12'));var as=require(_0x2fb1('0x13'));var hardwareService=require(_0x2fb1('0x14'));var logger=require(_0x2fb1('0x15'))(_0x2fb1('0x16'));var utils=require(_0x2fb1('0x17'));var config=require(_0x2fb1('0x18'));var licenseUtil=require(_0x2fb1('0x19'));var db=require(_0x2fb1('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2fb1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x37f1b1,_0x231e0b,_0x2471db,_0x1df6c0){return new BPromise(function(_0x5947c7,_0xad6630){var _0x1142e7=_0x1df6c0||client;return _0x1142e7[_0x2fb1('0x1c')](_0x37f1b1,_0x2471db)[_0x2fb1('0x1d')](function(_0x3c5edd){logger['info'](_0x2fb1('0x1e'),_0x231e0b,'request\x20sent');logger[_0x2fb1('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x231e0b,'request\x20sent',JSON[_0x2fb1('0x20')](_0x3c5edd));if(_0x3c5edd[_0x2fb1('0x21')]){if(_0x3c5edd['error'][_0x2fb1('0x22')]===0x1f4){logger['error'](_0x2fb1('0x1e'),_0x231e0b,_0x3c5edd[_0x2fb1('0x21')]['message']);return _0xad6630(_0x3c5edd[_0x2fb1('0x21')][_0x2fb1('0x23')]);}logger[_0x2fb1('0x21')](_0x2fb1('0x1e'),_0x231e0b,_0x3c5edd[_0x2fb1('0x21')]['message']);return _0x5947c7(_0x3c5edd['error'][_0x2fb1('0x23')]);}else{logger[_0x2fb1('0x24')](_0x2fb1('0x1e'),_0x231e0b,_0x2fb1('0x25'));_0x5947c7(_0x3c5edd[_0x2fb1('0x26')][_0x2fb1('0x23')]);}})[_0x2fb1('0x27')](function(_0x1fca27){logger[_0x2fb1('0x21')]('VoiceContext,\x20%s,\x20%s',_0x231e0b,_0x1fca27);_0xad6630(_0x1fca27);});});}function respondWithStatusCode(_0x1aebea,_0x480799){_0x480799=_0x480799||0xcc;return function(_0x2d953e){if(_0x2d953e){return _0x1aebea['sendStatus'](_0x480799);}return _0x1aebea['status'](_0x480799)[_0x2fb1('0x28')]();};}function respondWithResult(_0x3038c7,_0x196420){_0x196420=_0x196420||0xc8;return function(_0x4a386b){if(_0x4a386b){return _0x3038c7[_0x2fb1('0x29')](_0x196420)[_0x2fb1('0x2a')](_0x4a386b);}};}function respondWithFilteredResult(_0x59cc5a,_0x2faf1e){return function(_0x5cf4b4){if(_0x5cf4b4){var _0x49d694=typeof _0x2faf1e[_0x2fb1('0x2b')]===_0x2fb1('0x2c')&&typeof _0x2faf1e[_0x2fb1('0x2d')]===_0x2fb1('0x2c');var _0x6cbdb5=_0x5cf4b4[_0x2fb1('0x2e')];var _0x29ea32=_0x49d694?0x0:_0x2faf1e['offset'];var _0x3e87dd=_0x49d694?_0x5cf4b4[_0x2fb1('0x2e')]:_0x2faf1e[_0x2fb1('0x2b')]+_0x2faf1e[_0x2fb1('0x2d')];var _0x254c3a;if(_0x3e87dd>=_0x6cbdb5){_0x3e87dd=_0x6cbdb5;_0x254c3a=0xc8;}else{_0x254c3a=0xce;}_0x59cc5a[_0x2fb1('0x29')](_0x254c3a);return _0x59cc5a['set'](_0x2fb1('0x2f'),_0x29ea32+'-'+_0x3e87dd+'/'+_0x6cbdb5)[_0x2fb1('0x2a')](_0x5cf4b4);}return null;};}function patchUpdates(_0x1ae889){return function(_0x4e4c08){try{jsonpatch[_0x2fb1('0x30')](_0x4e4c08,_0x1ae889,!![]);}catch(_0x118454){return BPromise[_0x2fb1('0x31')](_0x118454);}return _0x4e4c08[_0x2fb1('0x32')]();};}function saveUpdates(_0x13fe55,_0x4d36f7){return function(_0x262925){if(_0x262925){return _0x262925[_0x2fb1('0x33')](_0x13fe55)['then'](function(_0x5903d0){return _0x5903d0;});}return null;};}function removeEntity(_0x1f0dc8,_0x58bfee){return function(_0xf419de){if(_0xf419de){return _0xf419de['destroy']()[_0x2fb1('0x1d')](function(){var _0x471b9d=_0xf419de[_0x2fb1('0x34')]({'plain':!![]});var _0x570d07=_0x2fb1('0x35');return db['UserProfileResource'][_0x2fb1('0x36')]({'where':{'type':_0x570d07,'resourceId':_0x471b9d['id']}})[_0x2fb1('0x1d')](function(){return _0xf419de;});})[_0x2fb1('0x1d')](function(){_0x1f0dc8[_0x2fb1('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a1b33,_0x35f8f0){return function(_0x46de5f){if(!_0x46de5f){_0x3a1b33[_0x2fb1('0x37')](0x194);}return _0x46de5f;};}function handleError(_0x6544ed,_0x263791){_0x263791=_0x263791||0x1f4;return function(_0x4550ab){logger[_0x2fb1('0x21')](_0x4550ab[_0x2fb1('0x38')]);if(_0x4550ab[_0x2fb1('0x39')]){delete _0x4550ab[_0x2fb1('0x39')];}_0x6544ed[_0x2fb1('0x29')](_0x263791)[_0x2fb1('0x3a')](_0x4550ab);};}exports['index']=function(_0x3a9637,_0x203b05){var _0x31f7b9={},_0x48a924={},_0x7928b0={'count':0x0,'rows':[]};var _0x4855d2=_[_0x2fb1('0x3b')](db[_0x2fb1('0x3c')][_0x2fb1('0x3d')],function(_0x5a5a97){return{'name':_0x5a5a97['fieldName'],'type':_0x5a5a97[_0x2fb1('0x3e')][_0x2fb1('0x3f')]};});_0x48a924[_0x2fb1('0x40')]=_[_0x2fb1('0x3b')](_0x4855d2,_0x2fb1('0x39'));_0x48a924[_0x2fb1('0x41')]=_[_0x2fb1('0x42')](_0x3a9637[_0x2fb1('0x41')]);_0x48a924['filters']=_[_0x2fb1('0x43')](_0x48a924[_0x2fb1('0x40')],_0x48a924[_0x2fb1('0x41')]);_0x31f7b9['attributes']=_[_0x2fb1('0x43')](_0x48a924[_0x2fb1('0x40')],qs[_0x2fb1('0x44')](_0x3a9637[_0x2fb1('0x41')]['fields']));_0x31f7b9['attributes']=_0x31f7b9[_0x2fb1('0x45')]['length']?_0x31f7b9[_0x2fb1('0x45')]:_0x48a924['model'];if(!_0x3a9637[_0x2fb1('0x41')][_0x2fb1('0x46')](_0x2fb1('0x47'))){_0x31f7b9['limit']=qs[_0x2fb1('0x2d')](_0x3a9637['query']['limit']);_0x31f7b9[_0x2fb1('0x2b')]=qs[_0x2fb1('0x2b')](_0x3a9637[_0x2fb1('0x41')]['offset']);}_0x31f7b9['order']=qs[_0x2fb1('0x48')](_0x3a9637[_0x2fb1('0x41')]['sort']);_0x31f7b9['where']=qs[_0x2fb1('0x49')](_['pick'](_0x3a9637[_0x2fb1('0x41')],_0x48a924[_0x2fb1('0x49')]),_0x4855d2);if(_0x3a9637[_0x2fb1('0x41')]['filter']){_0x31f7b9['where']=_[_0x2fb1('0x4a')](_0x31f7b9[_0x2fb1('0x4b')],{'$or':_[_0x2fb1('0x3b')](_0x4855d2,function(_0xd21cd1){if(_0xd21cd1[_0x2fb1('0x3e')]!==_0x2fb1('0x4c')){var _0x1cf59d={};_0x1cf59d[_0xd21cd1[_0x2fb1('0x39')]]={'$like':'%'+_0x3a9637['query'][_0x2fb1('0x4d')]+'%'};return _0x1cf59d;}})});}_0x31f7b9=_['merge']({},_0x31f7b9,_0x3a9637[_0x2fb1('0x4e')]);var _0x4e61ec={'where':_0x31f7b9[_0x2fb1('0x4b')]};return db['VoiceContext'][_0x2fb1('0x2e')](_0x4e61ec)['then'](function(_0x1c2c2f){_0x7928b0[_0x2fb1('0x2e')]=_0x1c2c2f;if(_0x3a9637[_0x2fb1('0x41')][_0x2fb1('0x4f')]){_0x31f7b9[_0x2fb1('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x2fb1('0x51')](_0x31f7b9);})[_0x2fb1('0x1d')](function(_0x3c4430){_0x7928b0[_0x2fb1('0x52')]=_0x3c4430;return _0x7928b0;})[_0x2fb1('0x1d')](respondWithFilteredResult(_0x203b05,_0x31f7b9))[_0x2fb1('0x27')](handleError(_0x203b05,null));};exports[_0x2fb1('0x53')]=function(_0x112e9b,_0x49c6f6){var _0x172494={'raw':![],'where':{'id':_0x112e9b[_0x2fb1('0x54')]['id']}},_0x4027bd={};_0x4027bd[_0x2fb1('0x40')]=_['keys'](db['VoiceContext'][_0x2fb1('0x3d')]);_0x4027bd[_0x2fb1('0x41')]=_[_0x2fb1('0x42')](_0x112e9b[_0x2fb1('0x41')]);_0x4027bd[_0x2fb1('0x49')]=_[_0x2fb1('0x43')](_0x4027bd[_0x2fb1('0x40')],_0x4027bd[_0x2fb1('0x41')]);_0x172494[_0x2fb1('0x45')]=_[_0x2fb1('0x43')](_0x4027bd['model'],qs[_0x2fb1('0x44')](_0x112e9b['query'][_0x2fb1('0x44')]));_0x172494[_0x2fb1('0x45')]=_0x172494[_0x2fb1('0x45')][_0x2fb1('0x55')]?_0x172494[_0x2fb1('0x45')]:_0x4027bd['model'];if(_0x112e9b[_0x2fb1('0x41')]['includeAll']){_0x172494[_0x2fb1('0x50')]=[{'all':!![]}];}_0x172494=_[_0x2fb1('0x4a')]({},_0x172494,_0x112e9b[_0x2fb1('0x4e')]);return db[_0x2fb1('0x3c')]['find'](_0x172494)[_0x2fb1('0x1d')](handleEntityNotFound(_0x49c6f6,null))[_0x2fb1('0x1d')](respondWithResult(_0x49c6f6,null))['catch'](handleError(_0x49c6f6,null));};exports[_0x2fb1('0x56')]=function(_0x1ba7f8,_0x4a73d5,_0x3a757a){var _0x44b29b;return db[_0x2fb1('0x3c')]['create'](_0x1ba7f8[_0x2fb1('0x57')],{'raw':!![]})[_0x2fb1('0x1d')](function(_0x47a22b){_0x44b29b=_0x47a22b;return db['VoiceContext'][_0x2fb1('0x51')]({'raw':!![]});})[_0x2fb1('0x1d')](function(_0x142263){var _0x28dde9=fs['readFileSync'](path[_0x2fb1('0x58')](config[_0x2fb1('0x59')],_0x2fb1('0x5a')),_0x2fb1('0x5b'));var _0x1024fb=ejs[_0x2fb1('0x5c')](_0x28dde9,{'contexts':_0x142263||[]});fs['writeFileSync'](_0x2fb1('0x5d'),_0x1024fb);})[_0x2fb1('0x1d')](function(){return respondWithRpcPromise(_0x2fb1('0x5e'),'create',{'module':_0x2fb1('0x5f')});})[_0x2fb1('0x1d')](function(){var _0x271c64=_0x1ba7f8[_0x2fb1('0x60')][_0x2fb1('0x34')]({'plain':!![]});if(!_0x271c64)throw new Error(_0x2fb1('0x61'));if(_0x271c64[_0x2fb1('0x62')]==='user'){var _0x508e16=_0x44b29b[_0x2fb1('0x34')]({'plain':!![]});return db[_0x2fb1('0x63')][_0x2fb1('0x64')]({'where':{'name':'Contexts','userProfileId':_0x271c64['userProfileId']},'raw':!![]})[_0x2fb1('0x1d')](function(_0x3fa8de){if(_0x3fa8de&&_0x3fa8de[_0x2fb1('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x508e16[_0x2fb1('0x39')],'resourceId':_0x508e16['id'],'type':_0x3fa8de[_0x2fb1('0x39')],'sectionId':_0x3fa8de['id']},{})[_0x2fb1('0x1d')](function(){return _0x44b29b;});}else{return _0x44b29b;}})['catch'](function(_0x4dda8c){logger[_0x2fb1('0x21')](_0x2fb1('0x66'),_0x4dda8c);throw _0x4dda8c;});}return _0x44b29b;})['then'](respondWithResult(_0x4a73d5,0xc9))['catch'](handleError(_0x4a73d5,null));};exports['update']=function(_0xd2806c,_0x4c40a9,_0x6e3ac8){var _0x1dce89;return db[_0x2fb1('0x3c')][_0x2fb1('0x64')]({'where':{'id':_0xd2806c[_0x2fb1('0x54')]['id']}})[_0x2fb1('0x1d')](handleEntityNotFound(_0x4c40a9,null))['then'](saveUpdates(_0xd2806c[_0x2fb1('0x57')],null))[_0x2fb1('0x1d')](function(_0x45a72b){if(_0x45a72b){_0x1dce89=_0x45a72b;return db[_0x2fb1('0x3c')]['findAll']({'raw':!![]});}})[_0x2fb1('0x1d')](function(_0x56f7c7){var _0x41fb9e=fs[_0x2fb1('0x67')](path[_0x2fb1('0x58')](config['root'],_0x2fb1('0x5a')),_0x2fb1('0x5b'));var _0x4d6855=ejs[_0x2fb1('0x5c')](_0x41fb9e,{'contexts':_0x56f7c7||[]});fs['writeFileSync'](_0x2fb1('0x5d'),_0x4d6855);})['then'](function(){return respondWithRpcPromise(_0x2fb1('0x5e'),_0x2fb1('0x33'),{'module':_0x2fb1('0x5f')});})['then'](function(){return _0x1dce89;})[_0x2fb1('0x1d')](respondWithResult(_0x4c40a9,null))['catch'](handleError(_0x4c40a9,null));};exports['destroy']=function(_0x3a24b0,_0x925220,_0x2e0238){var _0xf4a1e3;return db['VoiceContext'][_0x2fb1('0x64')]({'where':{'id':_0x3a24b0['params']['id']}})[_0x2fb1('0x1d')](handleEntityNotFound(_0x925220,null))[_0x2fb1('0x1d')](removeEntity(_0x925220,null))['then'](function(){return db[_0x2fb1('0x3c')][_0x2fb1('0x51')]({'raw':!![]});})[_0x2fb1('0x1d')](function(_0x5fc6c){var _0x349568=fs[_0x2fb1('0x67')](path[_0x2fb1('0x58')](config[_0x2fb1('0x59')],_0x2fb1('0x5a')),_0x2fb1('0x5b'));var _0x20086b=ejs['render'](_0x349568,{'contexts':_0x5fc6c});fs[_0x2fb1('0x68')](_0x2fb1('0x5d'),_0x20086b);return respondWithRpcPromise(_0x2fb1('0x5e'),_0x2fb1('0x36'),{'module':_0x2fb1('0x5f')});})[_0x2fb1('0x27')](handleError(_0x925220,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 56bcd2f..54da842 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 _0x3b99=['path','../../config/environment','./voiceContext.attributes','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x33cf79,_0x2e4446){var _0x266724=function(_0x371efb){while(--_0x371efb){_0x33cf79['push'](_0x33cf79['shift']());}};_0x266724(++_0x2e4446);}(_0x3b99,0x161));var _0x93b9=function(_0x22653b,_0x5969a7){_0x22653b=_0x22653b-0x0;var _0x48da0d=_0x3b99[_0x22653b];return _0x48da0d;};'use strict';var _=require(_0x93b9('0x0'));var util=require(_0x93b9('0x1'));var logger=require(_0x93b9('0x2'))(_0x93b9('0x3'));var moment=require(_0x93b9('0x4'));var BPromise=require(_0x93b9('0x5'));var rp=require(_0x93b9('0x6'));var fs=require('fs');var path=require(_0x93b9('0x7'));var rimraf=require('rimraf');var config=require(_0x93b9('0x8'));var attributes=require(_0x93b9('0x9'));module['exports']=function(_0x53894f,_0x3d735f){return _0x53894f[_0x93b9('0xa')]('VoiceContext',attributes,{'tableName':_0x93b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa03=['./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa03,0xdf));var _0x3aa0=function(_0x59acf5,_0x576bb3){_0x59acf5=_0x59acf5-0x0;var _0x21f1df=_0xaa03[_0x59acf5];return _0x21f1df;};'use strict';var _=require(_0x3aa0('0x0'));var util=require(_0x3aa0('0x1'));var logger=require(_0x3aa0('0x2'))(_0x3aa0('0x3'));var moment=require(_0x3aa0('0x4'));var BPromise=require(_0x3aa0('0x5'));var rp=require(_0x3aa0('0x6'));var fs=require('fs');var path=require(_0x3aa0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3aa0('0x8'));module['exports']=function(_0x435d4a,_0x5b5b32){return _0x435d4a['define'](_0x3aa0('0x9'),attributes,{'tableName':_0x3aa0('0xa'),'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 18f246a..427494d 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 _0x3715=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4288a3,_0x4edf77){var _0x402e72=function(_0x575893){while(--_0x575893){_0x4288a3['push'](_0x4288a3['shift']());}};_0x402e72(++_0x4edf77);}(_0x3715,0xc3));var _0x5371=function(_0x8ba59,_0x41fe65){_0x8ba59=_0x8ba59-0x0;var _0x5acd28=_0x3715[_0x8ba59];return _0x5acd28;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var moment=require(_0x5371('0x2'));var BPromise=require(_0x5371('0x3'));var rs=require(_0x5371('0x4'));var fs=require('fs');var Redis=require(_0x5371('0x5'));var db=require(_0x5371('0x6'))['db'];var utils=require(_0x5371('0x7'));var logger=require(_0x5371('0x8'))(_0x5371('0x9'));var config=require(_0x5371('0xa'));var jayson=require(_0x5371('0xb'));var client=jayson['client'][_0x5371('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x340e44,_0x5edddc,_0x426a2a){return new BPromise(function(_0x16c64a,_0x41d142){return client['request'](_0x340e44,_0x426a2a)[_0x5371('0xd')](function(_0x48b76c){logger['info'](_0x5371('0xe'),_0x5edddc,_0x5371('0xf'));logger[_0x5371('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5edddc,_0x5371('0xf'),JSON[_0x5371('0x11')](_0x48b76c));if(_0x48b76c[_0x5371('0x12')]){if(_0x48b76c['error'][_0x5371('0x13')]===0x1f4){logger[_0x5371('0x12')](_0x5371('0xe'),_0x5edddc,_0x48b76c[_0x5371('0x12')]['message']);return _0x41d142(_0x48b76c[_0x5371('0x12')]['message']);}logger[_0x5371('0x12')](_0x5371('0xe'),_0x5edddc,_0x48b76c['error'][_0x5371('0x14')]);return _0x16c64a(_0x48b76c[_0x5371('0x12')][_0x5371('0x14')]);}else{logger[_0x5371('0x15')](_0x5371('0xe'),_0x5edddc,_0x5371('0xf'));_0x16c64a(_0x48b76c[_0x5371('0x16')]['message']);}})[_0x5371('0x17')](function(_0x3e7169){logger[_0x5371('0x12')](_0x5371('0xe'),_0x5edddc,_0x3e7169);_0x41d142(_0x3e7169);});});} \ No newline at end of file +var _0x6c9f=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3019ec,_0x378b8b){var _0x3db9c1=function(_0x3637ca){while(--_0x3637ca){_0x3019ec['push'](_0x3019ec['shift']());}};_0x3db9c1(++_0x378b8b);}(_0x6c9f,0x16a));var _0xf6c9=function(_0x5a866a,_0x3e83a5){_0x5a866a=_0x5a866a-0x0;var _0x5d281c=_0x6c9f[_0x5a866a];return _0x5d281c;};'use strict';var _=require(_0xf6c9('0x0'));var util=require('util');var moment=require(_0xf6c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xf6c9('0x2'));var fs=require('fs');var Redis=require(_0xf6c9('0x3'));var db=require(_0xf6c9('0x4'))['db'];var utils=require(_0xf6c9('0x5'));var logger=require(_0xf6c9('0x6'))(_0xf6c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xf6c9('0x8'));var client=jayson[_0xf6c9('0x9')][_0xf6c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2abc04,_0x151322,_0x3d8579){return new BPromise(function(_0x24901b,_0x105f16){return client[_0xf6c9('0xb')](_0x2abc04,_0x3d8579)['then'](function(_0x3d93f7){logger[_0xf6c9('0xc')](_0xf6c9('0xd'),_0x151322,_0xf6c9('0xe'));logger[_0xf6c9('0xf')](_0xf6c9('0x10'),_0x151322,_0xf6c9('0xe'),JSON[_0xf6c9('0x11')](_0x3d93f7));if(_0x3d93f7[_0xf6c9('0x12')]){if(_0x3d93f7['error'][_0xf6c9('0x13')]===0x1f4){logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x3d93f7[_0xf6c9('0x12')]['message']);return _0x105f16(_0x3d93f7['error'][_0xf6c9('0x14')]);}logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x3d93f7[_0xf6c9('0x12')][_0xf6c9('0x14')]);return _0x24901b(_0x3d93f7[_0xf6c9('0x12')]['message']);}else{logger['info'](_0xf6c9('0xd'),_0x151322,_0xf6c9('0xe'));_0x24901b(_0x3d93f7['result'][_0xf6c9('0x14')]);}})[_0xf6c9('0x15')](function(_0x276b26){logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x276b26);_0x105f16(_0x276b26);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 71577d3..908a777 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 _0x8d76=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','multer'];(function(_0x217121,_0x18a421){var _0x2cebae=function(_0x21a0e1){while(--_0x21a0e1){_0x217121['push'](_0x217121['shift']());}};_0x2cebae(++_0x18a421);}(_0x8d76,0x14f));var _0x68d7=function(_0x113368,_0x12661b){_0x113368=_0x113368-0x0;var _0x175002=_0x8d76[_0x113368];return _0x175002;};'use strict';var multer=require(_0x68d7('0x0'));var util=require(_0x68d7('0x1'));var path=require(_0x68d7('0x2'));var timeout=require(_0x68d7('0x3'));var express=require(_0x68d7('0x4'));var router=express[_0x68d7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x68d7('0x6'));var interaction=require(_0x68d7('0x7'));var config=require(_0x68d7('0x8'));var controller=require(_0x68d7('0x9'));router[_0x68d7('0xa')]('/',auth[_0x68d7('0xb')](),controller[_0x68d7('0xc')]);router[_0x68d7('0xa')](_0x68d7('0xd'),auth[_0x68d7('0xb')](),controller[_0x68d7('0xe')]);router['get'](_0x68d7('0xf'),auth[_0x68d7('0xb')](),controller[_0x68d7('0x10')]);router[_0x68d7('0x11')]('/',auth[_0x68d7('0xb')](),controller['create']);router[_0x68d7('0x12')](_0x68d7('0xf'),auth[_0x68d7('0xb')](),controller['update']);router[_0x68d7('0x13')](_0x68d7('0xf'),auth['isAuthenticated'](),controller[_0x68d7('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1f7f=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','destroy','exports','multer'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x1f7f,0xbd));var _0xf1f7=function(_0x66808a,_0x60f3bd){_0x66808a=_0x66808a-0x0;var _0x760006=_0x1f7f[_0x66808a];return _0x760006;};'use strict';var multer=require(_0xf1f7('0x0'));var util=require(_0xf1f7('0x1'));var path=require(_0xf1f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1f7('0x3'));var router=express[_0xf1f7('0x4')]();var fs_extra=require(_0xf1f7('0x5'));var auth=require(_0xf1f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf1f7('0x7'));var controller=require(_0xf1f7('0x8'));router[_0xf1f7('0x9')]('/',auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xb')]);router[_0xf1f7('0x9')]('/describe',auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xc')]);router[_0xf1f7('0x9')](_0xf1f7('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xe')]);router[_0xf1f7('0xf')](_0xf1f7('0xd'),auth[_0xf1f7('0xa')](),controller[_0xf1f7('0x10')]);router['delete'](_0xf1f7('0xd'),auth[_0xf1f7('0xa')](),controller[_0xf1f7('0x11')]);module[_0xf1f7('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index abbd0dc..de9e358 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 _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x54ef,0x112));var _0xf54e=function(_0x2288fd,_0x170a65){_0x2288fd=_0x2288fd-0x0;var _0x45465d=_0x54ef[_0x2288fd];return _0x45465d;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x7a5535,_0x42e99f){var _0x580250=function(_0x2a9d76){while(--_0x2a9d76){_0x7a5535['push'](_0x7a5535['shift']());}};_0x580250(++_0x42e99f);}(_0x425d,0x1e0));var _0xd425=function(_0x5d4390,_0x21b7d8){_0x5d4390=_0x5d4390-0x0;var _0x4f3e01=_0x425d[_0x5d4390];return _0x4f3e01;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a193026..52ae0a0 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 _0x93e6=['end','undefined','limit','count','offset','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','status'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x93e6,0xfe));var _0x693e=function(_0x430277,_0x1efad3){_0x430277=_0x430277-0x0;var _0x3ed44b=_0x93e6[_0x430277];return _0x3ed44b;};'use strict';var emlformat=require(_0x693e('0x0'));var rimraf=require(_0x693e('0x1'));var zipdir=require(_0x693e('0x2'));var jsonpatch=require(_0x693e('0x3'));var rp=require(_0x693e('0x4'));var moment=require(_0x693e('0x5'));var BPromise=require(_0x693e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x693e('0x7'));var csv=require('to-csv');var ejs=require(_0x693e('0x8'));var fs=require('fs');var fs_extra=require(_0x693e('0x9'));var _=require(_0x693e('0xa'));var squel=require(_0x693e('0xb'));var crypto=require(_0x693e('0xc'));var jsforce=require(_0x693e('0xd'));var deskjs=require(_0x693e('0xe'));var toCsv=require(_0x693e('0xf'));var querystring=require('querystring');var Papa=require(_0x693e('0x10'));var Redis=require('ioredis');var authService=require(_0x693e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x693e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x693e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x693e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x448cf1,_0x24ad9c){_0x24ad9c=_0x24ad9c||0xcc;return function(_0x710183){if(_0x710183){return _0x448cf1['sendStatus'](_0x24ad9c);}return _0x448cf1[_0x693e('0x15')](_0x24ad9c)[_0x693e('0x16')]();};}function respondWithResult(_0x2fecd0,_0x3c572e){_0x3c572e=_0x3c572e||0xc8;return function(_0x4644b4){if(_0x4644b4){return _0x2fecd0[_0x693e('0x15')](_0x3c572e)['json'](_0x4644b4);}};}function respondWithFilteredResult(_0x3d9020,_0xd2c5c4){return function(_0x464705){if(_0x464705){var _0x5fc3f6=typeof _0xd2c5c4['offset']===_0x693e('0x17')&&typeof _0xd2c5c4[_0x693e('0x18')]===_0x693e('0x17');var _0x2684de=_0x464705[_0x693e('0x19')];var _0x4b6cb1=_0x5fc3f6?0x0:_0xd2c5c4[_0x693e('0x1a')];var _0x5800e3=_0x5fc3f6?_0x464705[_0x693e('0x19')]:_0xd2c5c4[_0x693e('0x1a')]+_0xd2c5c4[_0x693e('0x18')];var _0x346b7d;if(_0x5800e3>=_0x2684de){_0x5800e3=_0x2684de;_0x346b7d=0xc8;}else{_0x346b7d=0xce;}_0x3d9020[_0x693e('0x15')](_0x346b7d);return _0x3d9020['set'](_0x693e('0x1b'),_0x4b6cb1+'-'+_0x5800e3+'/'+_0x2684de)[_0x693e('0x1c')](_0x464705);}return null;};}function patchUpdates(_0x9eed0b){return function(_0x35a694){try{jsonpatch[_0x693e('0x1d')](_0x35a694,_0x9eed0b,!![]);}catch(_0x27f1ea){return BPromise['reject'](_0x27f1ea);}return _0x35a694[_0x693e('0x1e')]();};}function saveUpdates(_0x276138,_0x10aa21){return function(_0x461c1c){if(_0x461c1c){return _0x461c1c[_0x693e('0x1f')](_0x276138)['then'](function(_0x1fc357){return _0x1fc357;});}return null;};}function removeEntity(_0x67300e,_0x3fff79){return function(_0x3cdc5e){if(_0x3cdc5e){return _0x3cdc5e[_0x693e('0x20')]()[_0x693e('0x21')](function(){_0x67300e['status'](0xcc)[_0x693e('0x16')]();});}};}function handleEntityNotFound(_0x504516,_0x4865fb){return function(_0x18f6ea){if(!_0x18f6ea){_0x504516['sendStatus'](0x194);}return _0x18f6ea;};}function handleError(_0x8c353a,_0x393844){_0x393844=_0x393844||0x1f4;return function(_0x12aa47){logger[_0x693e('0x22')](_0x12aa47[_0x693e('0x23')]);if(_0x12aa47[_0x693e('0x24')]){delete _0x12aa47[_0x693e('0x24')];}_0x8c353a[_0x693e('0x15')](_0x393844)[_0x693e('0x25')](_0x12aa47);};}exports[_0x693e('0x26')]=function(_0x298a61,_0x27c90b){var _0x54bd51={},_0x24435a={},_0x1574b3={'count':0x0,'rows':[]};var _0x5a7443=_[_0x693e('0x27')](db[_0x693e('0x28')]['rawAttributes'],function(_0x51c752){return{'name':_0x51c752[_0x693e('0x29')],'type':_0x51c752[_0x693e('0x2a')]['key']};});_0x24435a[_0x693e('0x2b')]=_['map'](_0x5a7443,_0x693e('0x24'));_0x24435a[_0x693e('0x2c')]=_[_0x693e('0x2d')](_0x298a61[_0x693e('0x2c')]);_0x24435a[_0x693e('0x2e')]=_[_0x693e('0x2f')](_0x24435a[_0x693e('0x2b')],_0x24435a[_0x693e('0x2c')]);_0x54bd51[_0x693e('0x30')]=_[_0x693e('0x2f')](_0x24435a[_0x693e('0x2b')],qs[_0x693e('0x31')](_0x298a61['query'][_0x693e('0x31')]));_0x54bd51[_0x693e('0x30')]=_0x54bd51[_0x693e('0x30')]['length']?_0x54bd51[_0x693e('0x30')]:_0x24435a[_0x693e('0x2b')];if(!_0x298a61[_0x693e('0x2c')]['hasOwnProperty'](_0x693e('0x32'))){_0x54bd51[_0x693e('0x18')]=qs[_0x693e('0x18')](_0x298a61[_0x693e('0x2c')][_0x693e('0x18')]);_0x54bd51['offset']=qs['offset'](_0x298a61[_0x693e('0x2c')][_0x693e('0x1a')]);}_0x54bd51[_0x693e('0x33')]=qs[_0x693e('0x34')](_0x298a61[_0x693e('0x2c')][_0x693e('0x34')]);_0x54bd51['where']=qs[_0x693e('0x2e')](_[_0x693e('0x35')](_0x298a61[_0x693e('0x2c')],_0x24435a[_0x693e('0x2e')]),_0x5a7443);if(_0x298a61[_0x693e('0x2c')][_0x693e('0x36')]){_0x54bd51[_0x693e('0x37')]=_[_0x693e('0x38')](_0x54bd51[_0x693e('0x37')],{'$or':_[_0x693e('0x27')](_0x5a7443,function(_0x4eb606){if(_0x4eb606[_0x693e('0x2a')]!==_0x693e('0x39')){var _0x34fcf1={};_0x34fcf1[_0x4eb606[_0x693e('0x24')]]={'$like':'%'+_0x298a61[_0x693e('0x2c')][_0x693e('0x36')]+'%'};return _0x34fcf1;}})});}_0x54bd51=_[_0x693e('0x38')]({},_0x54bd51,_0x298a61['options']);var _0x52ae4e={'where':_0x54bd51['where']};return db['VoiceDialReport']['count'](_0x52ae4e)[_0x693e('0x21')](function(_0x5f35ae){_0x1574b3[_0x693e('0x19')]=_0x5f35ae;if(_0x298a61[_0x693e('0x2c')][_0x693e('0x3a')]){_0x54bd51[_0x693e('0x3b')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x693e('0x3c')](_0x54bd51);})[_0x693e('0x21')](function(_0x5434e6){_0x1574b3['rows']=_0x5434e6;return _0x1574b3;})[_0x693e('0x21')](respondWithFilteredResult(_0x27c90b,_0x54bd51))[_0x693e('0x3d')](handleError(_0x27c90b,null));};exports[_0x693e('0x3e')]=function(_0x54f56d,_0x30a379){var _0x549531={'raw':!![],'where':{'id':_0x54f56d[_0x693e('0x3f')]['id']}},_0x3ed3d5={};_0x3ed3d5[_0x693e('0x2b')]=_['keys'](db[_0x693e('0x28')]['rawAttributes']);_0x3ed3d5[_0x693e('0x2c')]=_['keys'](_0x54f56d[_0x693e('0x2c')]);_0x3ed3d5[_0x693e('0x2e')]=_[_0x693e('0x2f')](_0x3ed3d5[_0x693e('0x2b')],_0x3ed3d5[_0x693e('0x2c')]);_0x549531['attributes']=_[_0x693e('0x2f')](_0x3ed3d5[_0x693e('0x2b')],qs[_0x693e('0x31')](_0x54f56d[_0x693e('0x2c')][_0x693e('0x31')]));_0x549531['attributes']=_0x549531[_0x693e('0x30')][_0x693e('0x40')]?_0x549531[_0x693e('0x30')]:_0x3ed3d5[_0x693e('0x2b')];if(_0x54f56d[_0x693e('0x2c')][_0x693e('0x3a')]){_0x549531['include']=[{'all':!![]}];}_0x549531=_[_0x693e('0x38')]({},_0x549531,_0x54f56d['options']);return db[_0x693e('0x28')][_0x693e('0x41')](_0x549531)[_0x693e('0x21')](handleEntityNotFound(_0x30a379,null))['then'](respondWithResult(_0x30a379,null))[_0x693e('0x3d')](handleError(_0x30a379,null));};exports[_0x693e('0x42')]=function(_0x52f2e3,_0x1b6ac5){return db['VoiceDialReport'][_0x693e('0x42')](_0x52f2e3[_0x693e('0x43')],{})[_0x693e('0x21')](respondWithResult(_0x1b6ac5,0xc9))[_0x693e('0x3d')](handleError(_0x1b6ac5,null));};exports[_0x693e('0x1f')]=function(_0x3585a1,_0x5d0931){if(_0x3585a1['body']['id']){delete _0x3585a1[_0x693e('0x43')]['id'];}return db[_0x693e('0x28')][_0x693e('0x41')]({'where':{'id':_0x3585a1['params']['id']}})[_0x693e('0x21')](handleEntityNotFound(_0x5d0931,null))[_0x693e('0x21')](saveUpdates(_0x3585a1[_0x693e('0x43')],null))['then'](respondWithResult(_0x5d0931,null))[_0x693e('0x3d')](handleError(_0x5d0931,null));};exports[_0x693e('0x20')]=function(_0x51798b,_0x1fcfc2){return db[_0x693e('0x28')][_0x693e('0x41')]({'where':{'id':_0x51798b[_0x693e('0x3f')]['id']}})[_0x693e('0x21')](handleEntityNotFound(_0x1fcfc2,null))['then'](removeEntity(_0x1fcfc2,null))[_0x693e('0x3d')](handleError(_0x1fcfc2,null));};exports[_0x693e('0x44')]=function(_0x264691,_0x1fc6b0){return db[_0x693e('0x28')][_0x693e('0x44')]()[_0x693e('0x21')](respondWithResult(_0x1fc6b0,null))['catch'](handleError(_0x1fc6b0,null));}; \ No newline at end of file +var _0xbb27=['nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','VoiceDialReport','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x3e336c,_0x44bcc6){var _0x5bebef=function(_0x3c04bd){while(--_0x3c04bd){_0x3e336c['push'](_0x3e336c['shift']());}};_0x5bebef(++_0x44bcc6);}(_0xbb27,0x1da));var _0x7bb2=function(_0x3421ab,_0x227d8c){_0x3421ab=_0x3421ab-0x0;var _0x3b3066=_0xbb27[_0x3421ab];return _0x3b3066;};'use strict';var emlformat=require(_0x7bb2('0x0'));var rimraf=require(_0x7bb2('0x1'));var zipdir=require(_0x7bb2('0x2'));var jsonpatch=require(_0x7bb2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bb2('0x4'));var Mustache=require(_0x7bb2('0x5'));var util=require(_0x7bb2('0x6'));var path=require('path');var sox=require(_0x7bb2('0x7'));var csv=require('to-csv');var ejs=require(_0x7bb2('0x8'));var fs=require('fs');var fs_extra=require(_0x7bb2('0x9'));var _=require(_0x7bb2('0xa'));var squel=require(_0x7bb2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7bb2('0xc'));var toCsv=require(_0x7bb2('0xd'));var querystring=require(_0x7bb2('0xe'));var Papa=require(_0x7bb2('0xf'));var Redis=require(_0x7bb2('0x10'));var authService=require(_0x7bb2('0x11'));var qs=require(_0x7bb2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bb2('0x13'));var logger=require(_0x7bb2('0x14'))(_0x7bb2('0x15'));var utils=require(_0x7bb2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bb2('0x17'))['db'];function respondWithStatusCode(_0x585f88,_0x424594){_0x424594=_0x424594||0xcc;return function(_0x261939){if(_0x261939){return _0x585f88[_0x7bb2('0x18')](_0x424594);}return _0x585f88[_0x7bb2('0x19')](_0x424594)[_0x7bb2('0x1a')]();};}function respondWithResult(_0x374ce5,_0x3033f2){_0x3033f2=_0x3033f2||0xc8;return function(_0x4b4aa4){if(_0x4b4aa4){return _0x374ce5['status'](_0x3033f2)[_0x7bb2('0x1b')](_0x4b4aa4);}};}function respondWithFilteredResult(_0x53ffd0,_0x1a9ab6){return function(_0x3999f2){if(_0x3999f2){var _0x52e9c8=typeof _0x1a9ab6[_0x7bb2('0x1c')]===_0x7bb2('0x1d')&&typeof _0x1a9ab6[_0x7bb2('0x1e')]==='undefined';var _0xed1b0e=_0x3999f2['count'];var _0x46b3c1=_0x52e9c8?0x0:_0x1a9ab6[_0x7bb2('0x1c')];var _0x2b749d=_0x52e9c8?_0x3999f2[_0x7bb2('0x1f')]:_0x1a9ab6[_0x7bb2('0x1c')]+_0x1a9ab6['limit'];var _0x4b7c7a;if(_0x2b749d>=_0xed1b0e){_0x2b749d=_0xed1b0e;_0x4b7c7a=0xc8;}else{_0x4b7c7a=0xce;}_0x53ffd0[_0x7bb2('0x19')](_0x4b7c7a);return _0x53ffd0['set'](_0x7bb2('0x20'),_0x46b3c1+'-'+_0x2b749d+'/'+_0xed1b0e)[_0x7bb2('0x1b')](_0x3999f2);}return null;};}function patchUpdates(_0x178c3f){return function(_0x424569){try{jsonpatch[_0x7bb2('0x21')](_0x424569,_0x178c3f,!![]);}catch(_0xdcdb32){return BPromise[_0x7bb2('0x22')](_0xdcdb32);}return _0x424569[_0x7bb2('0x23')]();};}function saveUpdates(_0x3d7f72,_0x3f9ae7){return function(_0x1c3a5e){if(_0x1c3a5e){return _0x1c3a5e[_0x7bb2('0x24')](_0x3d7f72)[_0x7bb2('0x25')](function(_0x5c57e1){return _0x5c57e1;});}return null;};}function removeEntity(_0x56adb9,_0x18fd3f){return function(_0x2a456d){if(_0x2a456d){return _0x2a456d[_0x7bb2('0x26')]()[_0x7bb2('0x25')](function(){_0x56adb9[_0x7bb2('0x19')](0xcc)[_0x7bb2('0x1a')]();});}};}function handleEntityNotFound(_0x164113,_0x57c99c){return function(_0x169d1e){if(!_0x169d1e){_0x164113[_0x7bb2('0x18')](0x194);}return _0x169d1e;};}function handleError(_0x4ecb7e,_0x1e0247){_0x1e0247=_0x1e0247||0x1f4;return function(_0x1c6d7e){logger[_0x7bb2('0x27')](_0x1c6d7e[_0x7bb2('0x28')]);if(_0x1c6d7e['name']){delete _0x1c6d7e[_0x7bb2('0x29')];}_0x4ecb7e[_0x7bb2('0x19')](_0x1e0247)[_0x7bb2('0x2a')](_0x1c6d7e);};}exports[_0x7bb2('0x2b')]=function(_0x55f33d,_0x92e5b0){var _0x3e725b={},_0x449ad0={},_0x372187={'count':0x0,'rows':[]};var _0xacf12=_[_0x7bb2('0x2c')](db['VoiceDialReport'][_0x7bb2('0x2d')],function(_0x364516){return{'name':_0x364516[_0x7bb2('0x2e')],'type':_0x364516[_0x7bb2('0x2f')][_0x7bb2('0x30')]};});_0x449ad0[_0x7bb2('0x31')]=_[_0x7bb2('0x2c')](_0xacf12,_0x7bb2('0x29'));_0x449ad0[_0x7bb2('0x32')]=_[_0x7bb2('0x33')](_0x55f33d[_0x7bb2('0x32')]);_0x449ad0[_0x7bb2('0x34')]=_[_0x7bb2('0x35')](_0x449ad0[_0x7bb2('0x31')],_0x449ad0['query']);_0x3e725b[_0x7bb2('0x36')]=_[_0x7bb2('0x35')](_0x449ad0[_0x7bb2('0x31')],qs[_0x7bb2('0x37')](_0x55f33d['query'][_0x7bb2('0x37')]));_0x3e725b['attributes']=_0x3e725b['attributes'][_0x7bb2('0x38')]?_0x3e725b[_0x7bb2('0x36')]:_0x449ad0[_0x7bb2('0x31')];if(!_0x55f33d[_0x7bb2('0x32')][_0x7bb2('0x39')](_0x7bb2('0x3a'))){_0x3e725b[_0x7bb2('0x1e')]=qs[_0x7bb2('0x1e')](_0x55f33d[_0x7bb2('0x32')][_0x7bb2('0x1e')]);_0x3e725b[_0x7bb2('0x1c')]=qs[_0x7bb2('0x1c')](_0x55f33d['query']['offset']);}_0x3e725b[_0x7bb2('0x3b')]=qs['sort'](_0x55f33d[_0x7bb2('0x32')][_0x7bb2('0x3c')]);_0x3e725b['where']=qs[_0x7bb2('0x34')](_['pick'](_0x55f33d[_0x7bb2('0x32')],_0x449ad0[_0x7bb2('0x34')]),_0xacf12);if(_0x55f33d['query'][_0x7bb2('0x3d')]){_0x3e725b['where']=_[_0x7bb2('0x3e')](_0x3e725b[_0x7bb2('0x3f')],{'$or':_[_0x7bb2('0x2c')](_0xacf12,function(_0x159679){if(_0x159679[_0x7bb2('0x2f')]!==_0x7bb2('0x40')){var _0xd3b4fd={};_0xd3b4fd[_0x159679['name']]={'$like':'%'+_0x55f33d['query']['filter']+'%'};return _0xd3b4fd;}})});}_0x3e725b=_['merge']({},_0x3e725b,_0x55f33d[_0x7bb2('0x41')]);var _0x43a6b4={'where':_0x3e725b[_0x7bb2('0x3f')]};return db['VoiceDialReport'][_0x7bb2('0x1f')](_0x43a6b4)[_0x7bb2('0x25')](function(_0x3f1f66){_0x372187[_0x7bb2('0x1f')]=_0x3f1f66;if(_0x55f33d[_0x7bb2('0x32')][_0x7bb2('0x42')]){_0x3e725b[_0x7bb2('0x43')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x3e725b);})[_0x7bb2('0x25')](function(_0x1ee8ff){_0x372187[_0x7bb2('0x44')]=_0x1ee8ff;return _0x372187;})['then'](respondWithFilteredResult(_0x92e5b0,_0x3e725b))['catch'](handleError(_0x92e5b0,null));};exports[_0x7bb2('0x45')]=function(_0x3d7cb8,_0x2b44ca){var _0xec670b={'raw':!![],'where':{'id':_0x3d7cb8['params']['id']}},_0x1d0e79={};_0x1d0e79[_0x7bb2('0x31')]=_['keys'](db[_0x7bb2('0x46')]['rawAttributes']);_0x1d0e79['query']=_[_0x7bb2('0x33')](_0x3d7cb8[_0x7bb2('0x32')]);_0x1d0e79['filters']=_[_0x7bb2('0x35')](_0x1d0e79[_0x7bb2('0x31')],_0x1d0e79[_0x7bb2('0x32')]);_0xec670b[_0x7bb2('0x36')]=_[_0x7bb2('0x35')](_0x1d0e79[_0x7bb2('0x31')],qs[_0x7bb2('0x37')](_0x3d7cb8[_0x7bb2('0x32')][_0x7bb2('0x37')]));_0xec670b[_0x7bb2('0x36')]=_0xec670b[_0x7bb2('0x36')][_0x7bb2('0x38')]?_0xec670b['attributes']:_0x1d0e79[_0x7bb2('0x31')];if(_0x3d7cb8['query']['includeAll']){_0xec670b['include']=[{'all':!![]}];}_0xec670b=_['merge']({},_0xec670b,_0x3d7cb8[_0x7bb2('0x41')]);return db[_0x7bb2('0x46')]['find'](_0xec670b)[_0x7bb2('0x25')](handleEntityNotFound(_0x2b44ca,null))[_0x7bb2('0x25')](respondWithResult(_0x2b44ca,null))[_0x7bb2('0x47')](handleError(_0x2b44ca,null));};exports[_0x7bb2('0x48')]=function(_0x2d0372,_0x57bfc2){return db['VoiceDialReport']['create'](_0x2d0372[_0x7bb2('0x49')],{})[_0x7bb2('0x25')](respondWithResult(_0x57bfc2,0xc9))[_0x7bb2('0x47')](handleError(_0x57bfc2,null));};exports[_0x7bb2('0x24')]=function(_0x5524f5,_0x236a20){if(_0x5524f5[_0x7bb2('0x49')]['id']){delete _0x5524f5[_0x7bb2('0x49')]['id'];}return db[_0x7bb2('0x46')]['find']({'where':{'id':_0x5524f5[_0x7bb2('0x4a')]['id']}})[_0x7bb2('0x25')](handleEntityNotFound(_0x236a20,null))[_0x7bb2('0x25')](saveUpdates(_0x5524f5[_0x7bb2('0x49')],null))[_0x7bb2('0x25')](respondWithResult(_0x236a20,null))['catch'](handleError(_0x236a20,null));};exports[_0x7bb2('0x26')]=function(_0xf6a148,_0x1153d1){return db[_0x7bb2('0x46')]['find']({'where':{'id':_0xf6a148[_0x7bb2('0x4a')]['id']}})[_0x7bb2('0x25')](handleEntityNotFound(_0x1153d1,null))['then'](removeEntity(_0x1153d1,null))[_0x7bb2('0x47')](handleError(_0x1153d1,null));};exports[_0x7bb2('0x4b')]=function(_0x5a9c10,_0x2b83a6){return db[_0x7bb2('0x46')][_0x7bb2('0x4b')]()[_0x7bb2('0x25')](respondWithResult(_0x2b83a6,null))[_0x7bb2('0x47')](handleError(_0x2b83a6,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e667ae4..1d8b312 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 _0x4104=['../../config/environment','define','VoiceDialReport','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x20b18f,_0xf29421){var _0x510ea8=function(_0x1b02f8){while(--_0x1b02f8){_0x20b18f['push'](_0x20b18f['shift']());}};_0x510ea8(++_0xf29421);}(_0x4104,0x180));var _0x4410=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x4104[_0x3074f3];return _0x53f112;};'use strict';var _=require('lodash');var util=require(_0x4410('0x0'));var logger=require(_0x4410('0x1'))('api');var moment=require(_0x4410('0x2'));var BPromise=require(_0x4410('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4410('0x4'));var rimraf=require(_0x4410('0x5'));var config=require(_0x4410('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0xc20ff7,_0x17d0bc){return _0xc20ff7[_0x4410('0x7')](_0x4410('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x4410('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc96c=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','uniqueid'];(function(_0x2f1101,_0xfbafa6){var _0x3decca=function(_0x181ce0){while(--_0x181ce0){_0x2f1101['push'](_0x2f1101['shift']());}};_0x3decca(++_0xfbafa6);}(_0xc96c,0x14a));var _0xcc96=function(_0x43e3f1,_0xbb0bfa){_0x43e3f1=_0x43e3f1-0x0;var _0x220cc5=_0xc96c[_0x43e3f1];return _0x220cc5;};'use strict';var _=require('lodash');var util=require(_0xcc96('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcc96('0x1'));var BPromise=require(_0xcc96('0x2'));var rp=require(_0xcc96('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc96('0x4'));var config=require(_0xcc96('0x5'));var attributes=require(_0xcc96('0x6'));module[_0xcc96('0x7')]=function(_0x32cba9,_0x5e3ce3){return _0x32cba9['define'](_0xcc96('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xcc96('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index e02bb55..e0cee88 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 _0x801a=['create','body','options','raw','debug','UpdateVoiceDialReport','VoiceDialReport','update','attributes','limit','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','info','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x801a,0xbf));var _0xa801=function(_0xb4e64e,_0x19da01){_0xb4e64e=_0xb4e64e-0x0;var _0x1b1274=_0x801a[_0xb4e64e];return _0x1b1274;};'use strict';var _=require(_0xa801('0x0'));var util=require(_0xa801('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa801('0x2'));var fs=require('fs');var Redis=require(_0xa801('0x3'));var db=require(_0xa801('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa801('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa801('0x6')][_0xa801('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23d83b,_0x608763,_0x12bf6c){return new BPromise(function(_0x36f49d,_0x2c9887){return client['request'](_0x23d83b,_0x12bf6c)['then'](function(_0x52f2a0){logger[_0xa801('0x8')]('VoiceDialReport,\x20%s,\x20%s',_0x608763,'request\x20sent');logger['debug'](_0xa801('0x9'),_0x608763,_0xa801('0xa'),JSON[_0xa801('0xb')](_0x52f2a0));if(_0x52f2a0[_0xa801('0xc')]){if(_0x52f2a0[_0xa801('0xc')][_0xa801('0xd')]===0x1f4){logger[_0xa801('0xc')](_0xa801('0xe'),_0x608763,_0x52f2a0[_0xa801('0xc')]['message']);return _0x2c9887(_0x52f2a0[_0xa801('0xc')][_0xa801('0xf')]);}logger[_0xa801('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x608763,_0x52f2a0[_0xa801('0xc')][_0xa801('0xf')]);return _0x36f49d(_0x52f2a0[_0xa801('0xc')]['message']);}else{logger[_0xa801('0x8')](_0xa801('0xe'),_0x608763,_0xa801('0xa'));_0x36f49d(_0x52f2a0[_0xa801('0x10')][_0xa801('0xf')]);}})[_0xa801('0x11')](function(_0x4c754a){logger[_0xa801('0xc')](_0xa801('0xe'),_0x608763,_0x4c754a);_0x2c9887(_0x4c754a);});});}exports[_0xa801('0x12')]=function(_0x50449a){var _0x58849c=this;return new Promise(function(_0x35edf8,_0x555c4f){return db['VoiceDialReport'][_0xa801('0x13')](_0x50449a[_0xa801('0x14')],{'raw':_0x50449a[_0xa801('0x15')]?_0x50449a['options'][_0xa801('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2b0796){logger[_0xa801('0x8')]('CreateVoiceDialReport',_0x50449a);logger[_0xa801('0x17')](_0xa801('0x12'),_0x50449a,JSON[_0xa801('0xb')](_0x2b0796));_0x35edf8(_0x2b0796);})[_0xa801('0x11')](function(_0x14b50b){logger['error']('CreateVoiceDialReport',_0x14b50b[_0xa801('0xf')],_0x50449a);_0x555c4f(_0x58849c[_0xa801('0xc')](0x1f4,_0x14b50b[_0xa801('0xf')]));});});};exports[_0xa801('0x18')]=function(_0x22697e){var _0x41bba5=this;return new Promise(function(_0x938283,_0x205154){return db[_0xa801('0x19')][_0xa801('0x1a')](_0x22697e[_0xa801('0x14')],{'raw':_0x22697e[_0xa801('0x15')]?_0x22697e[_0xa801('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22697e[_0xa801('0x15')]?_0x22697e[_0xa801('0x15')]['where']||null:null,'attributes':_0x22697e['options']?_0x22697e['options'][_0xa801('0x1b')]||null:null,'limit':_0x22697e[_0xa801('0x15')]?_0x22697e[_0xa801('0x15')][_0xa801('0x1c')]||null:null})[_0xa801('0x1d')](function(_0x41dd26){logger['info'](_0xa801('0x18'),_0x22697e);logger[_0xa801('0x17')](_0xa801('0x18'),_0x22697e,JSON['stringify'](_0x41dd26));_0x938283(_0x41dd26);})[_0xa801('0x11')](function(_0x296995){logger[_0xa801('0xc')](_0xa801('0x18'),_0x296995[_0xa801('0xf')],_0x22697e);_0x205154(_0x41bba5[_0xa801('0xc')](0x1f4,_0x296995[_0xa801('0xf')]));});});}; \ No newline at end of file +var _0xbaaf=['then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','VoiceDialReport','body','options','raw','info','CreateVoiceDialReport','UpdateVoiceDialReport','update','attributes','lodash','util','moment','../../mysqldb','rpc','../../config/environment','client','request'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbaaf,0x1cc));var _0xfbaa=function(_0x13269,_0x258e86){_0x13269=_0x13269-0x0;var _0x2145ca=_0xbaaf[_0x13269];return _0x2145ca;};'use strict';var _=require(_0xfbaa('0x0'));var util=require(_0xfbaa('0x1'));var moment=require(_0xfbaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbaa('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfbaa('0x4'));var config=require(_0xfbaa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xfbaa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e3187,_0x30e425,_0x2a7154){return new BPromise(function(_0x9184ea,_0x45512b){return client[_0xfbaa('0x7')](_0x4e3187,_0x2a7154)[_0xfbaa('0x8')](function(_0x493303){logger['info'](_0xfbaa('0x9'),_0x30e425,'request\x20sent');logger[_0xfbaa('0xa')](_0xfbaa('0xb'),_0x30e425,'request\x20sent',JSON[_0xfbaa('0xc')](_0x493303));if(_0x493303[_0xfbaa('0xd')]){if(_0x493303[_0xfbaa('0xd')]['code']===0x1f4){logger[_0xfbaa('0xd')](_0xfbaa('0x9'),_0x30e425,_0x493303[_0xfbaa('0xd')][_0xfbaa('0xe')]);return _0x45512b(_0x493303['error'][_0xfbaa('0xe')]);}logger[_0xfbaa('0xd')](_0xfbaa('0x9'),_0x30e425,_0x493303[_0xfbaa('0xd')][_0xfbaa('0xe')]);return _0x9184ea(_0x493303[_0xfbaa('0xd')][_0xfbaa('0xe')]);}else{logger['info'](_0xfbaa('0x9'),_0x30e425,_0xfbaa('0xf'));_0x9184ea(_0x493303['result']['message']);}})[_0xfbaa('0x10')](function(_0x44e9f1){logger[_0xfbaa('0xd')](_0xfbaa('0x9'),_0x30e425,_0x44e9f1);_0x45512b(_0x44e9f1);});});}exports['CreateVoiceDialReport']=function(_0x2606aa){var _0x5b9452=this;return new Promise(function(_0x40bb61,_0x4a1cc3){return db[_0xfbaa('0x11')]['create'](_0x2606aa[_0xfbaa('0x12')],{'raw':_0x2606aa[_0xfbaa('0x13')]?_0x2606aa[_0xfbaa('0x13')][_0xfbaa('0x14')]===undefined?!![]:![]:!![]})[_0xfbaa('0x8')](function(_0x15479f){logger[_0xfbaa('0x15')](_0xfbaa('0x16'),_0x2606aa);logger[_0xfbaa('0xa')](_0xfbaa('0x16'),_0x2606aa,JSON[_0xfbaa('0xc')](_0x15479f));_0x40bb61(_0x15479f);})['catch'](function(_0x2d60b2){logger[_0xfbaa('0xd')](_0xfbaa('0x16'),_0x2d60b2['message'],_0x2606aa);_0x4a1cc3(_0x5b9452[_0xfbaa('0xd')](0x1f4,_0x2d60b2[_0xfbaa('0xe')]));});});};exports[_0xfbaa('0x17')]=function(_0x1038c8){var _0x46d6d7=this;return new Promise(function(_0xb00db2,_0x43b2e9){return db[_0xfbaa('0x11')][_0xfbaa('0x18')](_0x1038c8[_0xfbaa('0x12')],{'raw':_0x1038c8[_0xfbaa('0x13')]?_0x1038c8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1038c8[_0xfbaa('0x13')]?_0x1038c8['options']['where']||null:null,'attributes':_0x1038c8[_0xfbaa('0x13')]?_0x1038c8[_0xfbaa('0x13')][_0xfbaa('0x19')]||null:null,'limit':_0x1038c8[_0xfbaa('0x13')]?_0x1038c8['options']['limit']||null:null})['then'](function(_0x1137f7){logger[_0xfbaa('0x15')](_0xfbaa('0x17'),_0x1038c8);logger['debug'](_0xfbaa('0x17'),_0x1038c8,JSON['stringify'](_0x1137f7));_0xb00db2(_0x1137f7);})['catch'](function(_0x425069){logger['error'](_0xfbaa('0x17'),_0x425069['message'],_0x1038c8);_0x43b2e9(_0x46d6d7[_0xfbaa('0xd')](0x1f4,_0x425069['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2914f6b..f4f16f6 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 _0x25df=['/:id/applications','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','show','post'];(function(_0xe248ff,_0x2f658b){var _0xc45e09=function(_0x211029){while(--_0x211029){_0xe248ff['push'](_0xe248ff['shift']());}};_0xc45e09(++_0x2f658b);}(_0x25df,0xa7));var _0xf25d=function(_0x303c54,_0x46edea){_0x303c54=_0x303c54-0x0;var _0x4b5cb0=_0x25df[_0x303c54];return _0x4b5cb0;};'use strict';var multer=require('multer');var util=require(_0xf25d('0x0'));var path=require(_0xf25d('0x1'));var timeout=require(_0xf25d('0x2'));var express=require(_0xf25d('0x3'));var router=express[_0xf25d('0x4')]();var fs_extra=require(_0xf25d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf25d('0x6'));var config=require('../../config/environment');var controller=require(_0xf25d('0x7'));router[_0xf25d('0x8')]('/',auth[_0xf25d('0x9')](),controller[_0xf25d('0xa')]);router[_0xf25d('0x8')]('/:id',auth[_0xf25d('0x9')](),controller[_0xf25d('0xb')]);router[_0xf25d('0xc')]('/',auth[_0xf25d('0x9')](),controller['create']);router[_0xf25d('0xc')](_0xf25d('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0xf25d('0xe')](_0xf25d('0xf'),auth[_0xf25d('0x9')](),controller[_0xf25d('0x10')]);router[_0xf25d('0x11')]('/:id',auth[_0xf25d('0x9')](),controller[_0xf25d('0x12')]);module[_0xf25d('0x13')]=router; \ No newline at end of file +var _0x4f9f=['create','post','/:id/applications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x4f9f,0xb0));var _0xf4f9=function(_0x958e79,_0x2f3ffa){_0x958e79=_0x958e79-0x0;var _0x3ae692=_0x4f9f[_0x958e79];return _0x3ae692;};'use strict';var multer=require(_0xf4f9('0x0'));var util=require(_0xf4f9('0x1'));var path=require(_0xf4f9('0x2'));var timeout=require(_0xf4f9('0x3'));var express=require(_0xf4f9('0x4'));var router=express[_0xf4f9('0x5')]();var fs_extra=require(_0xf4f9('0x6'));var auth=require(_0xf4f9('0x7'));var interaction=require(_0xf4f9('0x8'));var config=require(_0xf4f9('0x9'));var controller=require('./voiceExtension.controller');router[_0xf4f9('0xa')]('/',auth[_0xf4f9('0xb')](),controller['index']);router['get'](_0xf4f9('0xc'),auth[_0xf4f9('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf4f9('0xd')]);router[_0xf4f9('0xe')](_0xf4f9('0xf'),auth[_0xf4f9('0xb')](),controller['addApplications']);router[_0xf4f9('0x10')]('/:id',auth[_0xf4f9('0xb')](),controller[_0xf4f9('0x11')]);router[_0xf4f9('0x12')](_0xf4f9('0xc'),auth['isAuthenticated'](),controller[_0xf4f9('0x13')]);module[_0xf4f9('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 6e5c2c7..ee158be 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 _0xd8df=['BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','system','*,*,*,*','INTEGER'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd8df,0x174));var _0xfd8d=function(_0x2b3fcc,_0x103c0c){_0x2b3fcc=_0x2b3fcc-0x0;var _0x1a592d=_0xd8df[_0x2b3fcc];return _0x1a592d;};'use strict';var Sequelize=require(_0xfd8d('0x0'));module[_0xfd8d('0x1')]={'context':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':![],'unique':_0xfd8d('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfd8d('0x3')},'priority':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xfd8d('0x3')},'tag':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd8d('0x4')},'appdata':{'type':Sequelize[_0xfd8d('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xfd8d('0x5'),_0xfd8d('0x6'),_0xfd8d('0x7'),_0xfd8d('0x8'),'outbound-fax',_0xfd8d('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':![],'defaultValue':_0xfd8d('0xa')},'IntervalId':{'type':Sequelize[_0xfd8d('0xb')]},'isApp':{'type':Sequelize[_0xfd8d('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xfd8d('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xfd8d('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xfd8d('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xfd8d('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xfd8d('0xd')},'answer':{'type':Sequelize[_0xfd8d('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xfd8d('0xe')],'get':function(_0x4c04b8){return this['getDataValue'](_0xfd8d('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xea13=['internal','system','INTEGER','BOOLEAN','getDataValue','STRING','ENUM','inbound','outbound'];(function(_0x286262,_0x4dbe62){var _0x133aa3=function(_0x3f91e3){while(--_0x3f91e3){_0x286262['push'](_0x286262['shift']());}};_0x133aa3(++_0x4dbe62);}(_0xea13,0x1f4));var _0x3ea1=function(_0x1a8e49,_0x5d0657){_0x1a8e49=_0x1a8e49-0x0;var _0x4b72e9=_0xea13[_0x1a8e49];return _0x4b72e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3ea1('0x0')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3ea1('0x0')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x3ea1('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3ea1('0x0')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3ea1('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3ea1('0x1')](_0x3ea1('0x2'),_0x3ea1('0x3'),_0x3ea1('0x4'),'inbound-fax','outbound-fax',_0x3ea1('0x5'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x3ea1('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x3ea1('0x6')]},'isApp':{'type':Sequelize[_0x3ea1('0x7')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3ea1('0x6')]},'recordingFormat':{'type':Sequelize[_0x3ea1('0x0')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x3ea1('0x7')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x27d698){return this[_0x3ea1('0x8')]('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 9205165..c1dc16d 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 _0xa771=['limit','count','set','Content-Range','json','destroy','then','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','VoiceExtension','fieldName','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','keys','rawAttributes','includeAll','params','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','InboundRoutes','internal','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa771,0xb1));var _0x1a77=function(_0x3a7ce4,_0x5f32bf){_0x3a7ce4=_0x3a7ce4-0x0;var _0x215a88=_0xa771[_0x3a7ce4];return _0x215a88;};'use strict';var _=require('lodash');var Redis=require(_0x1a77('0x0'));var qs=require(_0x1a77('0x1'));var logger=require('../../config/logger')(_0x1a77('0x2'));var config=require('../../config/environment');var db=require(_0x1a77('0x3'))['db'];config[_0x1a77('0x4')]=_['defaults'](config['redis'],{'host':_0x1a77('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a77('0x4')]));require(_0x1a77('0x6'))[_0x1a77('0x7')](socket);function respondWithStatusCode(_0x4befaa,_0x2183fc){_0x2183fc=_0x2183fc||0xcc;return function(_0xecc815){if(_0xecc815){return _0x4befaa[_0x1a77('0x8')](_0x2183fc);}return _0x4befaa[_0x1a77('0x9')](_0x2183fc)[_0x1a77('0xa')]();};}function respondWithResult(_0x1d13d9,_0x4c0c1e){_0x4c0c1e=_0x4c0c1e||0xc8;return function(_0x21a87e){if(_0x21a87e){return _0x1d13d9['status'](_0x4c0c1e)['json'](_0x21a87e);}};}function respondWithFilteredResult(_0x49dac1,_0x2fecb8){return function(_0xe445bc){if(_0xe445bc){var _0x276a82=typeof _0x2fecb8[_0x1a77('0xb')]===_0x1a77('0xc')&&typeof _0x2fecb8[_0x1a77('0xd')]===_0x1a77('0xc');var _0x41e235=_0xe445bc[_0x1a77('0xe')];var _0x1b46e4=_0x276a82?0x0:_0x2fecb8[_0x1a77('0xb')];var _0x8c916d=_0x276a82?_0xe445bc[_0x1a77('0xe')]:_0x2fecb8[_0x1a77('0xb')]+_0x2fecb8[_0x1a77('0xd')];var _0x4cd021;if(_0x8c916d>=_0x41e235){_0x8c916d=_0x41e235;_0x4cd021=0xc8;}else{_0x4cd021=0xce;}_0x49dac1[_0x1a77('0x9')](_0x4cd021);return _0x49dac1[_0x1a77('0xf')](_0x1a77('0x10'),_0x1b46e4+'-'+_0x8c916d+'/'+_0x41e235)[_0x1a77('0x11')](_0xe445bc);}return null;};}function removeEntity(_0x32a86d){return function(_0x4dab84){if(_0x4dab84){return _0x4dab84[_0x1a77('0x12')]()[_0x1a77('0x13')](function(){var _0x3caf2b=_0x4dab84['get']({'plain':!![]});var _0x5e82df=[{'name':'InboundRoutes','value':_0x1a77('0x14'),'ignore':![]},{'name':_0x1a77('0x15'),'value':_0x1a77('0x16'),'ignore':![]},{'name':_0x1a77('0x17'),'value':'internal','ignore':![]}];var _0x5009c1=_(_0x5e82df)[_0x1a77('0x18')](_0x1a77('0x19'))[_0x1a77('0x1a')](_0x1a77('0x1b'))[_0x1a77('0x1b')]();if(_[_0x1a77('0x1c')](_0x5009c1,_0x3caf2b[_0x1a77('0x1d')])){return;}var _0x3483b6=_[_0x1a77('0x1e')](_0x5e82df,[_0x1a77('0x1b'),_0x3caf2b[_0x1a77('0x1d')]])[_0x1a77('0x1f')];return db[_0x1a77('0x20')]['destroy']({'where':{'type':_0x3483b6,'resourceId':_0x3caf2b['id']}})[_0x1a77('0x13')](function(){return _0x4dab84;});})[_0x1a77('0x13')](function(){_0x32a86d[_0x1a77('0x9')](0xcc)[_0x1a77('0xa')]();});}};}function handleEntityNotFound(_0x2eaf15){return function(_0xb93c20){if(!_0xb93c20){_0x2eaf15['sendStatus'](0x194);}return _0xb93c20;};}function handleError(_0x264d4f,_0x40b154){_0x40b154=_0x40b154||0x1f4;return function(_0x260051){logger[_0x1a77('0x21')](_0x260051[_0x1a77('0x22')]);if(_0x260051[_0x1a77('0x1f')]){delete _0x260051[_0x1a77('0x1f')];}_0x264d4f[_0x1a77('0x9')](_0x40b154)[_0x1a77('0x23')](_0x260051);};}exports['index']=function(_0x477ca9,_0x24947e){var _0x2cf7c1={},_0x4a316b={},_0x525611={'count':0x0,'rows':[]};var _0x3d4659=_[_0x1a77('0x1a')](db[_0x1a77('0x24')]['rawAttributes'],function(_0x234ed9){return{'name':_0x234ed9[_0x1a77('0x25')],'type':_0x234ed9[_0x1a77('0x1d')][_0x1a77('0x26')]};});_0x4a316b[_0x1a77('0x27')]=_[_0x1a77('0x1a')](_0x3d4659,_0x1a77('0x1f'));_0x4a316b['query']=_['keys'](_0x477ca9['query']);_0x4a316b[_0x1a77('0x28')]=_['intersection'](_0x4a316b[_0x1a77('0x27')],_0x4a316b[_0x1a77('0x29')]);_0x2cf7c1['attributes']=_[_0x1a77('0x2a')](_0x4a316b[_0x1a77('0x27')],qs[_0x1a77('0x2b')](_0x477ca9[_0x1a77('0x29')][_0x1a77('0x2b')]));_0x2cf7c1[_0x1a77('0x2c')]=_0x2cf7c1[_0x1a77('0x2c')][_0x1a77('0x2d')]?_0x2cf7c1[_0x1a77('0x2c')]:_0x4a316b['model'];if(!_0x477ca9[_0x1a77('0x29')][_0x1a77('0x2e')](_0x1a77('0x2f'))){_0x2cf7c1[_0x1a77('0xd')]=qs[_0x1a77('0xd')](_0x477ca9['query'][_0x1a77('0xd')]);_0x2cf7c1[_0x1a77('0xb')]=qs[_0x1a77('0xb')](_0x477ca9[_0x1a77('0x29')][_0x1a77('0xb')]);}_0x2cf7c1[_0x1a77('0x30')]=qs[_0x1a77('0x31')](_0x477ca9[_0x1a77('0x29')]['sort']);_0x2cf7c1[_0x1a77('0x32')]=qs[_0x1a77('0x28')](_[_0x1a77('0x33')](_0x477ca9['query'],_0x4a316b[_0x1a77('0x28')]),_0x3d4659);if(_0x477ca9[_0x1a77('0x29')][_0x1a77('0x18')]){_0x2cf7c1[_0x1a77('0x32')]=_[_0x1a77('0x34')](_0x2cf7c1[_0x1a77('0x32')],{'$or':_['map'](_0x3d4659,function(_0x4f0984){if(_0x4f0984[_0x1a77('0x1d')]!==_0x1a77('0x35')){var _0x1640fa={};_0x1640fa[_0x4f0984[_0x1a77('0x1f')]]={'$like':'%'+_0x477ca9[_0x1a77('0x29')][_0x1a77('0x18')]+'%'};return _0x1640fa;}})});}_0x2cf7c1=_['merge']({},_0x2cf7c1,_0x477ca9[_0x1a77('0x36')]);var _0x37d000={'where':_0x2cf7c1[_0x1a77('0x32')]};return db['VoiceExtension'][_0x1a77('0xe')](_0x37d000)['then'](function(_0x9357fb){_0x525611['count']=_0x9357fb;if(_0x477ca9[_0x1a77('0x29')]['includeAll']){_0x2cf7c1[_0x1a77('0x37')]=[{'all':!![]}];}return db[_0x1a77('0x24')][_0x1a77('0x38')](_0x2cf7c1);})[_0x1a77('0x13')](function(_0x3d469a){_0x525611[_0x1a77('0x39')]=_0x3d469a;return _0x525611;})[_0x1a77('0x13')](respondWithFilteredResult(_0x24947e,_0x2cf7c1))[_0x1a77('0x3a')](handleError(_0x24947e,null));};exports['show']=function(_0x132bef,_0x53d625){var _0x5282a7={'raw':![],'where':{'id':_0x132bef['params']['id']}},_0x3f52c7={};_0x3f52c7[_0x1a77('0x27')]=_[_0x1a77('0x3b')](db['VoiceExtension'][_0x1a77('0x3c')]);_0x3f52c7[_0x1a77('0x29')]=_['keys'](_0x132bef[_0x1a77('0x29')]);_0x3f52c7[_0x1a77('0x28')]=_[_0x1a77('0x2a')](_0x3f52c7[_0x1a77('0x27')],_0x3f52c7[_0x1a77('0x29')]);_0x5282a7[_0x1a77('0x2c')]=_[_0x1a77('0x2a')](_0x3f52c7[_0x1a77('0x27')],qs['fields'](_0x132bef[_0x1a77('0x29')][_0x1a77('0x2b')]));_0x5282a7['attributes']=_0x5282a7['attributes'][_0x1a77('0x2d')]?_0x5282a7['attributes']:_0x3f52c7[_0x1a77('0x27')];if(_0x132bef['query'][_0x1a77('0x3d')]){_0x5282a7[_0x1a77('0x37')]=[{'all':!![]}];}_0x5282a7=_[_0x1a77('0x34')]({},_0x5282a7,_0x132bef[_0x1a77('0x36')]);return db['VoiceExtension']['find'](_0x5282a7)['then'](handleEntityNotFound(_0x53d625,null))['then'](respondWithResult(_0x53d625,null))['catch'](handleError(_0x53d625,null));};exports[_0x1a77('0x12')]=function(_0x2f7d9e,_0x172273){return db[_0x1a77('0x24')][_0x1a77('0x1e')]({'where':{'id':_0x2f7d9e[_0x1a77('0x3e')]['id']}})['then'](handleEntityNotFound(_0x172273,null))[_0x1a77('0x13')](removeEntity(_0x172273,null))['catch'](handleError(_0x172273,null));};exports['create']=function(_0x59f796,_0x19cea0){if(_0x59f796[_0x1a77('0x3f')]['type']==='outbound'&&!_[_0x1a77('0x40')](_0x59f796['body']['exten'],'_')){_0x59f796[_0x1a77('0x3f')][_0x1a77('0x41')]='_'[_0x1a77('0x42')](_0x59f796[_0x1a77('0x3f')][_0x1a77('0x41')]);}return db[_0x1a77('0x24')][_0x1a77('0x43')](_0x59f796['body'],{'raw':![]})['then'](function(_0x313567){var _0x5aef5d=_0x59f796[_0x1a77('0x44')]['get']({'plain':!![]});if(!_0x5aef5d)throw new Error(_0x1a77('0x45'));if(_0x5aef5d[_0x1a77('0x46')]===_0x1a77('0x44')){var _0x4f965=_0x313567[_0x1a77('0x47')]({'plain':!![]});var _0x14cf20=[{'name':_0x1a77('0x48'),'value':_0x1a77('0x14')},{'name':'OutboundRoutes','value':_0x1a77('0x16')},{'name':_0x1a77('0x17'),'value':_0x1a77('0x49')}];var _0x56766e=_[_0x1a77('0x1e')](_0x14cf20,[_0x1a77('0x1b'),_0x4f965[_0x1a77('0x1d')]])[_0x1a77('0x1f')];return db['UserProfileSection'][_0x1a77('0x1e')]({'where':{'name':_0x56766e,'userProfileId':_0x5aef5d['userProfileId']},'raw':!![]})[_0x1a77('0x13')](function(_0x1c9c42){if(_0x1c9c42&&_0x1c9c42[_0x1a77('0x4a')]===0x0){return db[_0x1a77('0x20')][_0x1a77('0x43')]({'name':_0x4f965[_0x1a77('0x1f')],'resourceId':_0x4f965['id'],'type':_0x1c9c42[_0x1a77('0x1f')],'sectionId':_0x1c9c42['id']},{})['then'](function(){return _0x313567;});}else{return _0x313567;}})[_0x1a77('0x3a')](function(_0x567a73){logger[_0x1a77('0x21')](_0x1a77('0x4b'),_0x567a73);throw _0x567a73;});}return _0x313567;})['then'](respondWithResult(_0x19cea0,0xc9))[_0x1a77('0x3a')](handleError(_0x19cea0,null));};exports[_0x1a77('0x4c')]=function(_0x102b3f,_0x527d43){if(_0x102b3f[_0x1a77('0x3f')]['id']){delete _0x102b3f[_0x1a77('0x3f')]['id'];}return db[_0x1a77('0x24')][_0x1a77('0x1e')]({'where':{'id':_0x102b3f[_0x1a77('0x3e')]['id']}})[_0x1a77('0x13')](handleEntityNotFound(_0x527d43,null))[_0x1a77('0x13')](function(_0x5dee6a){if(_0x5dee6a){return db[_0x1a77('0x24')][_0x1a77('0x4c')](_[_0x1a77('0x33')](_0x102b3f['body'],['exten',_0x1a77('0x4d'),_0x1a77('0x4e'),_0x1a77('0x4f'),_0x1a77('0x50'),_0x1a77('0x51'),_0x1a77('0x52')]),{'where':{'context':_0x5dee6a[_0x1a77('0x4d')],'exten':_0x5dee6a['exten']},'individualHooks':!![]})[_0x1a77('0x13')](function(_0x30848a){return _0x30848a;});}return null;})[_0x1a77('0x13')](respondWithStatusCode(_0x527d43,null))[_0x1a77('0x3a')](handleError(_0x527d43,null));};exports[_0x1a77('0x53')]=function(_0xc4d8dd,_0x2f0159){var _0x71bb8e=_0xc4d8dd[_0x1a77('0x3e')]['id'];var _0x459cc5=_0xc4d8dd[_0x1a77('0x3f')];var _0x30472a=0xc8;var _0x591a96=null;return db[_0x1a77('0x54')][_0x1a77('0x55')]({'isolationLevel':db['sequelize'][_0x1a77('0x56')][_0x1a77('0x57')]['READ_COMMITTED']},function(_0x164927){return db['VoiceExtension'][_0x1a77('0x58')]({'where':{'id':_0x71bb8e},'transaction':_0x164927})[_0x1a77('0x13')](function(_0x34ac4c){if(_0x34ac4c){return db[_0x1a77('0x24')][_0x1a77('0x12')]({'where':{'VoiceExtensionId':_0x71bb8e},'transaction':_0x164927})['then'](function(){var _0x290553=_['map'](_0x459cc5,function(_0x5bde02){_0x5bde02[_0x1a77('0x59')]=_0x71bb8e;_0x5bde02[_0x1a77('0x5a')]=!![];return _0x5bde02;});return _0x34ac4c[_0x1a77('0x5b')](_0x290553);})[_0x1a77('0x13')](function(_0x31ce94){return db[_0x1a77('0x24')][_0x1a77('0x5c')](_0x31ce94,{'transaction':_0x164927});});}else{_0x30472a=0x194;_0x591a96=[];}});})[_0x1a77('0x13')](function(){if(_0x30472a!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x71bb8e},'order':_0x1a77('0x5d')})[_0x1a77('0x13')](function(_0x5b32b7){_0x591a96=_0x5b32b7;});}})[_0x1a77('0x3a')](function(_0x5eb547){_0x30472a=0x1f4;logger[_0x1a77('0x21')](_0x5eb547[_0x1a77('0x22')]);if(_0x5eb547['name']){delete _0x5eb547[_0x1a77('0x1f')];}_0x591a96=_0x5eb547;})[_0x1a77('0x5e')](function(){if(_0x591a96===null){_0x2f0159[_0x1a77('0x8')](_0x30472a);}else{if(_0x30472a===0x1f4){_0x2f0159[_0x1a77('0x9')](_0x30472a)[_0x1a77('0x23')](_0x591a96);}else{_0x2f0159[_0x1a77('0x9')](_0x30472a)['json'](_0x591a96);}}});}; \ No newline at end of file +var _0x6040=['stack','finally','ioredis','api','../../config/environment','../../mysqldb','redis','register','sendStatus','status','json','offset','limit','undefined','set','destroy','then','get','InboundRoutes','OutboundRoutes','internal','filter','map','value','type','find','UserProfileResource','end','name','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','count','includeAll','include','rows','catch','show','params','VoiceExtension','create','body','outbound','startsWith','exten','role','inbound','InternalRoutes','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)'];(function(_0x14e3d1,_0x5e37a5){var _0x5baa3b=function(_0x161ae6){while(--_0x161ae6){_0x14e3d1['push'](_0x14e3d1['shift']());}};_0x5baa3b(++_0x5e37a5);}(_0x6040,0x1f4));var _0x0604=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x6040[_0x1e1965];return _0x1a2e96;};'use strict';var _=require('lodash');var Redis=require(_0x0604('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0604('0x1'));var config=require(_0x0604('0x2'));var db=require(_0x0604('0x3'))['db'];config[_0x0604('0x4')]=_['defaults'](config[_0x0604('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0604('0x4')]));require('./voiceExtension.socket')[_0x0604('0x5')](socket);function respondWithStatusCode(_0x5d7b3a,_0x1d15b9){_0x1d15b9=_0x1d15b9||0xcc;return function(_0x16f18e){if(_0x16f18e){return _0x5d7b3a[_0x0604('0x6')](_0x1d15b9);}return _0x5d7b3a[_0x0604('0x7')](_0x1d15b9)['end']();};}function respondWithResult(_0x116e20,_0x5b9ec9){_0x5b9ec9=_0x5b9ec9||0xc8;return function(_0xa4a336){if(_0xa4a336){return _0x116e20['status'](_0x5b9ec9)[_0x0604('0x8')](_0xa4a336);}};}function respondWithFilteredResult(_0x150123,_0x1d1d30){return function(_0x1ea448){if(_0x1ea448){var _0x10e196=typeof _0x1d1d30[_0x0604('0x9')]==='undefined'&&typeof _0x1d1d30[_0x0604('0xa')]===_0x0604('0xb');var _0x18c29b=_0x1ea448['count'];var _0xd71b93=_0x10e196?0x0:_0x1d1d30['offset'];var _0x5b0b5e=_0x10e196?_0x1ea448['count']:_0x1d1d30[_0x0604('0x9')]+_0x1d1d30['limit'];var _0x15649d;if(_0x5b0b5e>=_0x18c29b){_0x5b0b5e=_0x18c29b;_0x15649d=0xc8;}else{_0x15649d=0xce;}_0x150123[_0x0604('0x7')](_0x15649d);return _0x150123[_0x0604('0xc')]('Content-Range',_0xd71b93+'-'+_0x5b0b5e+'/'+_0x18c29b)[_0x0604('0x8')](_0x1ea448);}return null;};}function removeEntity(_0x171ae9){return function(_0x410ed9){if(_0x410ed9){return _0x410ed9[_0x0604('0xd')]()[_0x0604('0xe')](function(){var _0x1cea67=_0x410ed9[_0x0604('0xf')]({'plain':!![]});var _0x53a8e=[{'name':_0x0604('0x10'),'value':'inbound','ignore':![]},{'name':_0x0604('0x11'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x0604('0x12'),'ignore':![]}];var _0x48d211=_(_0x53a8e)[_0x0604('0x13')]('ignore')[_0x0604('0x14')]('value')[_0x0604('0x15')]();if(_['includes'](_0x48d211,_0x1cea67[_0x0604('0x16')])){return;}var _0x545e90=_[_0x0604('0x17')](_0x53a8e,[_0x0604('0x15'),_0x1cea67[_0x0604('0x16')]])['name'];return db[_0x0604('0x18')]['destroy']({'where':{'type':_0x545e90,'resourceId':_0x1cea67['id']}})[_0x0604('0xe')](function(){return _0x410ed9;});})[_0x0604('0xe')](function(){_0x171ae9[_0x0604('0x7')](0xcc)[_0x0604('0x19')]();});}};}function handleEntityNotFound(_0x412f9d){return function(_0x1f50ff){if(!_0x1f50ff){_0x412f9d[_0x0604('0x6')](0x194);}return _0x1f50ff;};}function handleError(_0x48acec,_0x34e450){_0x34e450=_0x34e450||0x1f4;return function(_0x3adec6){logger['error'](_0x3adec6['stack']);if(_0x3adec6['name']){delete _0x3adec6[_0x0604('0x1a')];}_0x48acec[_0x0604('0x7')](_0x34e450)[_0x0604('0x1b')](_0x3adec6);};}exports[_0x0604('0x1c')]=function(_0x3f018d,_0x25828a){var _0x5d3651={},_0x3dc8e3={},_0x1de09e={'count':0x0,'rows':[]};var _0x350d09=_['map'](db['VoiceExtension']['rawAttributes'],function(_0x1a93bb){return{'name':_0x1a93bb[_0x0604('0x1d')],'type':_0x1a93bb['type'][_0x0604('0x1e')]};});_0x3dc8e3[_0x0604('0x1f')]=_[_0x0604('0x14')](_0x350d09,_0x0604('0x1a'));_0x3dc8e3[_0x0604('0x20')]=_[_0x0604('0x21')](_0x3f018d['query']);_0x3dc8e3[_0x0604('0x22')]=_[_0x0604('0x23')](_0x3dc8e3['model'],_0x3dc8e3[_0x0604('0x20')]);_0x5d3651[_0x0604('0x24')]=_[_0x0604('0x23')](_0x3dc8e3[_0x0604('0x1f')],qs[_0x0604('0x25')](_0x3f018d[_0x0604('0x20')][_0x0604('0x25')]));_0x5d3651['attributes']=_0x5d3651[_0x0604('0x24')][_0x0604('0x26')]?_0x5d3651[_0x0604('0x24')]:_0x3dc8e3[_0x0604('0x1f')];if(!_0x3f018d[_0x0604('0x20')][_0x0604('0x27')](_0x0604('0x28'))){_0x5d3651['limit']=qs[_0x0604('0xa')](_0x3f018d[_0x0604('0x20')]['limit']);_0x5d3651[_0x0604('0x9')]=qs[_0x0604('0x9')](_0x3f018d[_0x0604('0x20')][_0x0604('0x9')]);}_0x5d3651['order']=qs['sort'](_0x3f018d[_0x0604('0x20')][_0x0604('0x29')]);_0x5d3651['where']=qs[_0x0604('0x22')](_[_0x0604('0x2a')](_0x3f018d[_0x0604('0x20')],_0x3dc8e3['filters']),_0x350d09);if(_0x3f018d[_0x0604('0x20')][_0x0604('0x13')]){_0x5d3651[_0x0604('0x2b')]=_[_0x0604('0x2c')](_0x5d3651[_0x0604('0x2b')],{'$or':_[_0x0604('0x14')](_0x350d09,function(_0x42053f){if(_0x42053f[_0x0604('0x16')]!=='VIRTUAL'){var _0x551260={};_0x551260[_0x42053f[_0x0604('0x1a')]]={'$like':'%'+_0x3f018d[_0x0604('0x20')]['filter']+'%'};return _0x551260;}})});}_0x5d3651=_[_0x0604('0x2c')]({},_0x5d3651,_0x3f018d[_0x0604('0x2d')]);var _0x5aecb4={'where':_0x5d3651[_0x0604('0x2b')]};return db['VoiceExtension'][_0x0604('0x2e')](_0x5aecb4)[_0x0604('0xe')](function(_0x184db9){_0x1de09e[_0x0604('0x2e')]=_0x184db9;if(_0x3f018d[_0x0604('0x20')][_0x0604('0x2f')]){_0x5d3651[_0x0604('0x30')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x5d3651);})[_0x0604('0xe')](function(_0x3137be){_0x1de09e[_0x0604('0x31')]=_0x3137be;return _0x1de09e;})[_0x0604('0xe')](respondWithFilteredResult(_0x25828a,_0x5d3651))[_0x0604('0x32')](handleError(_0x25828a,null));};exports[_0x0604('0x33')]=function(_0x22d24c,_0xc88b32){var _0x23eef4={'raw':![],'where':{'id':_0x22d24c[_0x0604('0x34')]['id']}},_0x2b9788={};_0x2b9788[_0x0604('0x1f')]=_[_0x0604('0x21')](db[_0x0604('0x35')]['rawAttributes']);_0x2b9788['query']=_[_0x0604('0x21')](_0x22d24c['query']);_0x2b9788['filters']=_['intersection'](_0x2b9788[_0x0604('0x1f')],_0x2b9788[_0x0604('0x20')]);_0x23eef4['attributes']=_['intersection'](_0x2b9788[_0x0604('0x1f')],qs[_0x0604('0x25')](_0x22d24c['query'][_0x0604('0x25')]));_0x23eef4[_0x0604('0x24')]=_0x23eef4[_0x0604('0x24')][_0x0604('0x26')]?_0x23eef4[_0x0604('0x24')]:_0x2b9788[_0x0604('0x1f')];if(_0x22d24c[_0x0604('0x20')]['includeAll']){_0x23eef4[_0x0604('0x30')]=[{'all':!![]}];}_0x23eef4=_[_0x0604('0x2c')]({},_0x23eef4,_0x22d24c['options']);return db[_0x0604('0x35')]['find'](_0x23eef4)[_0x0604('0xe')](handleEntityNotFound(_0xc88b32,null))[_0x0604('0xe')](respondWithResult(_0xc88b32,null))[_0x0604('0x32')](handleError(_0xc88b32,null));};exports[_0x0604('0xd')]=function(_0x54f183,_0x119c45){return db[_0x0604('0x35')][_0x0604('0x17')]({'where':{'id':_0x54f183[_0x0604('0x34')]['id']}})[_0x0604('0xe')](handleEntityNotFound(_0x119c45,null))[_0x0604('0xe')](removeEntity(_0x119c45,null))[_0x0604('0x32')](handleError(_0x119c45,null));};exports[_0x0604('0x36')]=function(_0x5c5339,_0x100408){if(_0x5c5339[_0x0604('0x37')]['type']===_0x0604('0x38')&&!_[_0x0604('0x39')](_0x5c5339[_0x0604('0x37')][_0x0604('0x3a')],'_')){_0x5c5339['body'][_0x0604('0x3a')]='_'['concat'](_0x5c5339[_0x0604('0x37')][_0x0604('0x3a')]);}return db[_0x0604('0x35')][_0x0604('0x36')](_0x5c5339[_0x0604('0x37')],{'raw':![]})[_0x0604('0xe')](function(_0x554635){var _0x10a0e7=_0x5c5339['user'][_0x0604('0xf')]({'plain':!![]});if(!_0x10a0e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10a0e7[_0x0604('0x3b')]==='user'){var _0x904ce5=_0x554635[_0x0604('0xf')]({'plain':!![]});var _0x567bad=[{'name':_0x0604('0x10'),'value':_0x0604('0x3c')},{'name':_0x0604('0x11'),'value':_0x0604('0x38')},{'name':_0x0604('0x3d'),'value':_0x0604('0x12')}];var _0xb48bf5=_[_0x0604('0x17')](_0x567bad,['value',_0x904ce5['type']])['name'];return db['UserProfileSection']['find']({'where':{'name':_0xb48bf5,'userProfileId':_0x10a0e7[_0x0604('0x3e')]},'raw':!![]})[_0x0604('0xe')](function(_0x551d0f){if(_0x551d0f&&_0x551d0f[_0x0604('0x3f')]===0x0){return db[_0x0604('0x18')]['create']({'name':_0x904ce5['name'],'resourceId':_0x904ce5['id'],'type':_0x551d0f[_0x0604('0x1a')],'sectionId':_0x551d0f['id']},{})[_0x0604('0xe')](function(){return _0x554635;});}else{return _0x554635;}})[_0x0604('0x32')](function(_0x1ba3d1){logger[_0x0604('0x40')](_0x0604('0x41'),_0x1ba3d1);throw _0x1ba3d1;});}return _0x554635;})[_0x0604('0xe')](respondWithResult(_0x100408,0xc9))['catch'](handleError(_0x100408,null));};exports[_0x0604('0x42')]=function(_0x40d83a,_0x1b04de){if(_0x40d83a[_0x0604('0x37')]['id']){delete _0x40d83a[_0x0604('0x37')]['id'];}return db['VoiceExtension'][_0x0604('0x17')]({'where':{'id':_0x40d83a[_0x0604('0x34')]['id']}})[_0x0604('0xe')](handleEntityNotFound(_0x1b04de,null))[_0x0604('0xe')](function(_0x404e7c){if(_0x404e7c){return db[_0x0604('0x35')][_0x0604('0x42')](_[_0x0604('0x2a')](_0x40d83a[_0x0604('0x37')],[_0x0604('0x3a'),'context',_0x0604('0x43'),_0x0604('0x44'),_0x0604('0x45'),_0x0604('0x46'),_0x0604('0x47')]),{'where':{'context':_0x404e7c[_0x0604('0x48')],'exten':_0x404e7c['exten']},'individualHooks':!![]})[_0x0604('0xe')](function(_0x2b1f84){return _0x2b1f84;});}return null;})[_0x0604('0xe')](respondWithStatusCode(_0x1b04de,null))[_0x0604('0x32')](handleError(_0x1b04de,null));};exports['addApplications']=function(_0x39e634,_0x348323){var _0x227754=_0x39e634[_0x0604('0x34')]['id'];var _0x325802=_0x39e634['body'];var _0x40e669=0xc8;var _0x498040=null;return db[_0x0604('0x49')][_0x0604('0x4a')]({'isolationLevel':db[_0x0604('0x49')]['Transaction'][_0x0604('0x4b')][_0x0604('0x4c')]},function(_0x1fd31f){return db[_0x0604('0x35')]['findOne']({'where':{'id':_0x227754},'transaction':_0x1fd31f})['then'](function(_0x276246){if(_0x276246){return db[_0x0604('0x35')][_0x0604('0xd')]({'where':{'VoiceExtensionId':_0x227754},'transaction':_0x1fd31f})[_0x0604('0xe')](function(){var _0x3e7192=_[_0x0604('0x14')](_0x325802,function(_0x1b607c){_0x1b607c[_0x0604('0x4d')]=_0x227754;_0x1b607c[_0x0604('0x4e')]=!![];return _0x1b607c;});return _0x276246['createRouting'](_0x3e7192);})[_0x0604('0xe')](function(_0x41e021){return db[_0x0604('0x35')][_0x0604('0x4f')](_0x41e021,{'transaction':_0x1fd31f});});}else{_0x40e669=0x194;_0x498040=[];}});})[_0x0604('0xe')](function(){if(_0x40e669!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x227754},'order':_0x0604('0x50')})[_0x0604('0xe')](function(_0x1cdbb7){_0x498040=_0x1cdbb7;});}})[_0x0604('0x32')](function(_0x36024e){_0x40e669=0x1f4;logger[_0x0604('0x40')](_0x36024e[_0x0604('0x51')]);if(_0x36024e['name']){delete _0x36024e[_0x0604('0x1a')];}_0x498040=_0x36024e;})[_0x0604('0x52')](function(){if(_0x498040===null){_0x348323['sendStatus'](_0x40e669);}else{if(_0x40e669===0x1f4){_0x348323['status'](_0x40e669)[_0x0604('0x1b')](_0x498040);}else{_0x348323[_0x0604('0x7')](_0x40e669)[_0x0604('0x8')](_0x498040);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 936116b..f817104 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 _0x0d0c=['hook','exports','VoiceExtension','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x3bd0d8,_0xc8228c){var _0x3d7415=function(_0x13e7e9){while(--_0x13e7e9){_0x3bd0d8['push'](_0x3bd0d8['shift']());}};_0x3d7415(++_0xc8228c);}(_0x0d0c,0x1ad));var _0xc0d0=function(_0x5f34eb,_0x41e23f){_0x5f34eb=_0x5f34eb-0x0;var _0x342a19=_0x0d0c[_0x5f34eb];return _0x342a19;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xc0d0('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc0d0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0d0('0x2'),'afterDestroy':'remove'};function emitEvent(_0x13814b){return function(_0x22e3c5,_0x4defb0,_0x486d17){VoiceExtensionEvents[_0xc0d0('0x3')](_0x13814b+':'+_0x22e3c5['id'],_0x22e3c5);VoiceExtensionEvents['emit'](_0x13814b,_0x22e3c5);_0x486d17(null);};}for(var e in events){if(events[_0xc0d0('0x4')](e)){var event=events[e];VoiceExtension[_0xc0d0('0x5')](e,emitEvent(event));}}module[_0xc0d0('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x43ca=['events','../../mysqldb','VoiceExtension','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x43ca,0x195));var _0xa43c=function(_0x3f0f2e,_0xf2b92d){_0x3f0f2e=_0x3f0f2e-0x0;var _0x49fc6f=_0x43ca[_0x3f0f2e];return _0x49fc6f;};'use strict';var EventEmitter=require(_0xa43c('0x0'));var VoiceExtension=require(_0xa43c('0x1'))['db'][_0xa43c('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa43c('0x3'),'afterUpdate':_0xa43c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37f01c){return function(_0x550d2b,_0x213e8e,_0x380459){VoiceExtensionEvents[_0xa43c('0x5')](_0x37f01c+':'+_0x550d2b['id'],_0x550d2b);VoiceExtensionEvents[_0xa43c('0x5')](_0x37f01c,_0x550d2b);_0x380459(null);};}for(var e in events){if(events[_0xa43c('0x6')](e)){var event=events[e];VoiceExtension[_0xa43c('0x7')](e,emitEvent(event));}}module[_0xa43c('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 7e38e92..77b2e82 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 _0x1bb9=['hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','split','length','param','phone','prefix','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','intervals','answer','queue','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','define','VoiceExtension','voice_extensions','get','Hangup','Set','CDR(type)=','type','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','MONITOR_OPTIONS=ab','outboundrouteid='];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x1bb9,0x124));var _0x91bb=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x1bb9[_0x507c81];return _0x368a25;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0xa16977){var _0x1dbc1e=_0xa16977['models'];function _0x35292b(_0x20dc53){var _0x265a74=0x2;var _0x323af3=[{'type':_0x20dc53['type'],'app':_0x91bb('0x0'),'appdata':_0x91bb('0x1')+_0x20dc53[_0x91bb('0x2')],'context':_0x20dc53['context'],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']},{'type':_0x20dc53[_0x91bb('0x2')],'app':_0x20dc53[_0x91bb('0x4')]?_0x91bb('0x0'):_0x91bb('0x5'),'appdata':_0x20dc53[_0x91bb('0x4')]?_0x91bb('0x6')+_0x20dc53[_0x91bb('0x4')]:_0x91bb('0x7'),'context':_0x20dc53[_0x91bb('0x8')],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']}];if(_0x20dc53['type']===_0x91bb('0x9')){_0x323af3[_0x91bb('0xa')]({'type':'inbound','app':_0x91bb('0x0'),'appdata':_0x91bb('0xb')+_0x20dc53['id'],'context':_0x20dc53[_0x91bb('0x8')],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']});}_0x323af3[_0x91bb('0xa')]({'type':_0x20dc53[_0x91bb('0x2')],'app':_0x91bb('0x0'),'appdata':_0x91bb('0xc'),'context':_0x20dc53[_0x91bb('0x8')],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']},{'type':_0x20dc53[_0x91bb('0x2')],'app':_0x91bb('0x0'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x20dc53[_0x91bb('0x8')],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']},{'type':_0x20dc53[_0x91bb('0x2')],'app':_0x91bb('0x0'),'appdata':'MONITOR_OPTIONS=ab','context':_0x20dc53['context'],'exten':_0x20dc53[_0x91bb('0x3')],'priority':_0x265a74++,'VoiceExtensionId':_0x20dc53['id']});return _0x323af3;}function _0x31a1db(_0x427a29){var _0xa22e9b=0x2;var _0x50a845=[{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':'CDR(type)=outbound','context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x427a29[_0x91bb('0x4')]?_0x91bb('0x0'):_0x91bb('0x5'),'appdata':_0x427a29['alias']?'CDR(routeAlias)='+_0x427a29[_0x91bb('0x4')]:_0x91bb('0x7'),'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':_0x91bb('0xe')+(_0x427a29['cutdigits']?_0x91bb('0xf')+_0x427a29[_0x91bb('0x10')]+'}':_0x91bb('0x11')),'context':_0x427a29['context'],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':'CDR(routeid)='+_0x427a29['id'],'context':_0x427a29['context'],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x12'),'appdata':_0x91bb('0x13')+(_0xa22e9b+0x2)+_0x91bb('0x14')+(_0xa22e9b+0x1)+')','context':_0x427a29['context'],'exten':_0x427a29['exten'],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':'outbound','app':'Set','appdata':_0x427a29[_0x91bb('0x10')]?_0x91bb('0x15')+_0x427a29[_0x91bb('0x10')]+'}':'CDR(prefix)=noprefix','context':_0x427a29['context'],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':_0x91bb('0xc'),'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29['exten'],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x427a29['context'],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':'outbound','app':_0x91bb('0x0'),'appdata':_0x91bb('0x16'),'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':'outbound','app':'Set','appdata':_0x91bb('0x17')+_0x427a29['id'],'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']}];if(_0x427a29[_0x91bb('0x18')](_0x91bb('0x19'))&&_0x427a29[_0x91bb('0x19')]!=='none'){_0x50a845['push']({'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x1a'),'context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29['exten'],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']},{'type':_0x91bb('0xd'),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x1b')+_0x427a29[_0x91bb('0x19')]||'wav','context':_0x427a29[_0x91bb('0x8')],'exten':_0x427a29[_0x91bb('0x3')],'priority':_0xa22e9b++,'VoiceExtensionId':_0x427a29['id']});}return _0x50a845;}function _0x40e588(_0x54bd82,_0x1565ff){var _0x2ab94f=[{'name':_0x91bb('0x1c'),'param':0x0},{'name':_0x91bb('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x101735={};var _0x1d6a20=_0x1565ff[_0x91bb('0x1e')](',');var _0x17ae56=[];for(var _0x49a63b=0x0;_0x49a63b<_0x2ab94f[_0x91bb('0x1f')];_0x49a63b++){switch(_0x2ab94f[_0x49a63b]['name']){case'trunk':_0x101735[_0x91bb('0x1c')]=_0x1d6a20[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]][_0x91bb('0x1e')]('/')[0x1];_0x101735[_0x91bb('0x21')]=_0x1d6a20[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]][_0x91bb('0x1e')]('/')[0x2];_0x101735[_0x91bb('0x22')]=_0x101735[_0x91bb('0x21')]?_0x101735[_0x91bb('0x21')][_0x91bb('0x1e')]('$')[0x0]:undefined;_0x101735[_0x91bb('0x21')]=_0x54bd82[_0x91bb('0x10')]?(_0x101735[_0x91bb('0x22')]||'')+_0x91bb('0xf')+_0x54bd82[_0x91bb('0x10')]+'}':(_0x101735[_0x91bb('0x22')]||'')+_0x91bb('0x11');_0x17ae56[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]]=[_0x91bb('0x23'),_0x101735[_0x91bb('0x1c')],_0x101735[_0x91bb('0x21')]][_0x91bb('0x24')]('/');break;case _0x91bb('0x25'):_0x101735[_0x91bb('0x25')]=_0x1d6a20[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]];if(_0x54bd82[_0x91bb('0x19')]!==_0x91bb('0x26')){if(_0x101735['options'][_0x91bb('0x27')](_0x91bb('0x28'))<0x0){_0x101735['options']+=_0x91bb('0x28');}}else{_0x101735[_0x91bb('0x25')]=_0x101735['options'][_0x91bb('0x29')](_0x91bb('0x28'),'');}_0x17ae56[_0x2ab94f[_0x49a63b]['param']]=_0x101735[_0x91bb('0x25')];break;default:_0x17ae56[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]]=_0x1d6a20[_0x2ab94f[_0x49a63b][_0x91bb('0x20')]];}}return _0x17ae56[_0x91bb('0x24')](',');}function _0x2a986e(_0x528522,_0xf4b4ac,_0x1f6be1){return new Promise(function(_0x4c89c9,_0x4f57a7){var _0x2f3c0a=[];if(_[_0x91bb('0x2a')](_0xf4b4ac))return _0x4c89c9(_0x2f3c0a);_0x1dbc1e[_0x91bb('0x2b')][_0x91bb('0x2c')]({'attributes':['id',_0x91bb('0x2d'),'IntervalId'],'raw':!![]})[_0x91bb('0x2e')](function(_0x18439f){for(var _0x58b3ad=0x0,_0x1c23ed=0x0;_0x58b3ad<_0xf4b4ac[_0x91bb('0x1f')];_0x58b3ad++,_0x1c23ed=0x0){var _0xcf3335=_0xf4b4ac[_0x58b3ad];var _0x423302=[];var _0x4466c5=[];delete _0xcf3335['id'];if(_0xcf3335[_0x91bb('0x2d')]!==_0x91bb('0x2f')){_0xcf3335['intervals']=[_0xcf3335['interval']];}else{_0xcf3335['intervals']=_0xcf3335[_0x91bb('0x30')]?_[_0x91bb('0x31')](_[_0x91bb('0x32')](_0x18439f,{'IntervalId':_0xcf3335['IntervalId']}),'interval'):[];}_0xcf3335[_0x91bb('0x8')]=_0x528522[_0x91bb('0x8')];_0xcf3335[_0x91bb('0x3')]=_0x528522['exten'];if(_0xcf3335[_0x91bb('0x2')])_0xcf3335[_0x91bb('0x2')]=_0xcf3335[_0x91bb('0x2')][_0x91bb('0x33')]();if(_0x528522[_0x91bb('0x2')]===_0x91bb('0xd')){if(_0xcf3335['hasOwnProperty'](_0x91bb('0x34'))&&_0xcf3335['tag']&&_0xcf3335[_0x91bb('0x34')]!=='--'){_0x423302[_0x91bb('0xa')]({'type':_0xcf3335['type'][_0x91bb('0x33')](),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x35')+_0xcf3335[_0x91bb('0x34')],'context':_0x528522['context'],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335['intervals']['length']+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}_0x423302['push']({'type':_0xcf3335[_0x91bb('0x2')][_0x91bb('0x33')](),'app':'ExecIf','appdata':_0x91bb('0x36')+(_0xcf3335[_0x91bb('0x37')]?_0x91bb('0x38')+_0xcf3335[_0x91bb('0x37')]+')':_0x91bb('0x39')),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335[_0x91bb('0x3a')]['length']+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}else{if(_0xcf3335[_0x91bb('0x18')](_0x91bb('0x3b'))){if([_0x91bb('0x3c'),'playback']['includes'](_0xcf3335['app'][_0x91bb('0x33')]())&&_0xcf3335['appType']!=='custom'){if(_0xcf3335[_0x91bb('0x3b')]){_0x423302[_0x91bb('0xa')]({'type':_0xcf3335[_0x91bb('0x2')][_0x91bb('0x33')](),'app':_0x91bb('0x12'),'appdata':_0x91bb('0x3d'),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335['intervals'][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});_0x423302[_0x91bb('0xa')]({'type':_0xcf3335['type']['toLowerCase'](),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x3e'),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}else{_0x423302[_0x91bb('0xa')]({'type':_0xcf3335['type'][_0x91bb('0x33')](),'app':'ExecIf','appdata':_0x91bb('0x3f'),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335['intervals'][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});_0x423302[_0x91bb('0xa')]({'type':_0xcf3335[_0x91bb('0x2')]['toLowerCase'](),'app':_0x91bb('0x0'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}}}}for(var _0xa7852b=0x0;_0xa7852b<_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')];_0xa7852b++){var _0x1f6d3c=_0x1f6be1+_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')];var _0x1a06a8=_0xa7852b===_0xcf3335['intervals'][_0x91bb('0x1f')]-0x1?_0x1f6be1+_0x423302[_0x91bb('0x1f')]+_0x4466c5[_0x91bb('0x1f')]+0x2:_0x1f6be1+_0xa7852b+0x1;_0x423302[_0x91bb('0x40')](_0xa7852b,0x0,{'type':_0x528522[_0x91bb('0x2')],'app':_0x91bb('0x41'),'appdata':_0xcf3335[_0x91bb('0x3a')][_0xa7852b]+'?'+_0x528522[_0x91bb('0x8')]+_0x91bb('0x42')+_0x1f6d3c+':'+_0x528522['context']+',${EXTEN},'+_0x1a06a8,'exten':_0x528522[_0x91bb('0x3')],'context':_0x528522[_0x91bb('0x8')],'priority':_0x1f6be1+_0xa7852b,'VoiceExtensionId':_0x528522['id']});}if(_0xcf3335[_0x91bb('0x43')]===_0x91bb('0x44')){_0xcf3335['appdata']=_0x40e588(_0x528522,_0xcf3335[_0x91bb('0x45')]);}if(_0xcf3335[_0x91bb('0x43')]==='agi'){_0x423302[_0x91bb('0xa')]({'type':_0xcf3335[_0x91bb('0x2')][_0x91bb('0x33')](),'app':_0x91bb('0x0'),'appdata':_0x91bb('0x46'),'context':_0x528522[_0x91bb('0x8')],'exten':_0x528522[_0x91bb('0x3')],'priority':_0xcf3335[_0x91bb('0x3a')][_0x91bb('0x1f')]+_0x1f6be1+_0x1c23ed++,'VoiceExtensionId':_0x528522['id']});}_0xcf3335['priority']=_0x423302[_0x91bb('0x1f')]?_[_0x91bb('0x47')](_0x423302)[_0x91bb('0x48')]+0x1:_0x1f6be1;_0x2f3c0a=_[_0x91bb('0x49')](_0x2f3c0a,_0x423302,[_0xcf3335],_0x4466c5);_0x1f6be1=_[_0x91bb('0x47')](_0x2f3c0a)['priority']+0x1;}return _0x4c89c9(_0x2f3c0a);})['catch'](function(_0x5893c4){_0x4f57a7(_0x5893c4);});});}return _0xa16977[_0x91bb('0x4a')](_0x91bb('0x4b'),attributes,{'tableName':_0x91bb('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4557ac){var _0x330605=this[_0x91bb('0x4d')]({'plain':!![]});var _0x467bc8=_0x330605[_0x91bb('0x2')]===_0x91bb('0xd')?_0x31a1db(_0x330605):_0x35292b(_0x330605);return _0x2a986e(_0x330605,_0x4557ac,_['last'](_0x467bc8)[_0x91bb('0x48')]+0x1)[_0x91bb('0x2e')](function(_0x30a333){var _0x8645af=_[_0x91bb('0x49')](_0x467bc8,_0x30a333);_0x8645af[_0x91bb('0xa')]({'type':_0x330605['type'],'app':_0x91bb('0x4e'),'exten':_0x330605[_0x91bb('0x3')],'context':_0x330605['context'],'priority':_[_0x91bb('0x47')](_0x8645af)[_0x91bb('0x48')]+0x1,'VoiceExtensionId':_0x330605['id']});return _0x8645af;});}}});}; \ No newline at end of file +var _0x081e=['priority','concat','define','VoiceExtension','voice_extensions','get','last','Hangup','lodash','exports','type','Set','CDR(type)=','context','exten','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi'];(function(_0x304608,_0x303dd1){var _0x17091a=function(_0x3f6eca){while(--_0x3f6eca){_0x304608['push'](_0x304608['shift']());}};_0x17091a(++_0x303dd1);}(_0x081e,0x160));var _0xe081=function(_0x39887a,_0x5835ca){_0x39887a=_0x39887a-0x0;var _0x1f8468=_0x081e[_0x39887a];return _0x1f8468;};'use strict';var _=require(_0xe081('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xe081('0x1')]=function(_0x3c3812){var _0x3192ba=_0x3c3812['models'];function _0x1e6138(_0x918a10){var _0x4de4f0=0x2;var _0x3e306a=[{'type':_0x918a10[_0xe081('0x2')],'app':_0xe081('0x3'),'appdata':_0xe081('0x4')+_0x918a10[_0xe081('0x2')],'context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']},{'type':_0x918a10[_0xe081('0x2')],'app':_0x918a10['alias']?_0xe081('0x3'):_0xe081('0x7'),'appdata':_0x918a10['alias']?_0xe081('0x8')+_0x918a10[_0xe081('0x9')]:_0xe081('0xa'),'context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']}];if(_0x918a10[_0xe081('0x2')]===_0xe081('0xb')){_0x3e306a[_0xe081('0xc')]({'type':_0xe081('0xb'),'app':_0xe081('0x3'),'appdata':_0xe081('0xd')+_0x918a10['id'],'context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']});}_0x3e306a[_0xe081('0xc')]({'type':_0x918a10[_0xe081('0x2')],'app':_0xe081('0x3'),'appdata':_0xe081('0xe'),'context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']},{'type':_0x918a10[_0xe081('0x2')],'app':_0xe081('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']},{'type':_0x918a10[_0xe081('0x2')],'app':_0xe081('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']});return _0x3e306a;}function _0x143a82(_0x5465c7){var _0x3dd655=0x2;var _0x5e05d0=[{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x10'),'context':_0x5465c7['context'],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0x5465c7['alias']?_0xe081('0x3'):_0xe081('0x7'),'appdata':_0x5465c7['alias']?_0xe081('0x8')+_0x5465c7['alias']:_0xe081('0xa'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7['exten'],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x11')+(_0x5465c7[_0xe081('0x12')]?_0xe081('0x13')+_0x5465c7[_0xe081('0x12')]+'}':_0xe081('0x14')),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':'CDR(routeid)='+_0x5465c7['id'],'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7['exten'],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x15'),'appdata':_0xe081('0x16')+(_0x3dd655+0x2)+_0xe081('0x17')+(_0x3dd655+0x1)+')','context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':'Set','appdata':_0x5465c7[_0xe081('0x12')]?_0xe081('0x18')+_0x5465c7[_0xe081('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7['exten'],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':'outbound','app':_0xe081('0x3'),'appdata':_0xe081('0xe'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x19'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':'outbound','app':_0xe081('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x1a')+_0x5465c7['id'],'context':_0x5465c7['context'],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']}];if(_0x5465c7[_0xe081('0x1b')](_0xe081('0x1c'))&&_0x5465c7[_0xe081('0x1c')]!==_0xe081('0x1d')){_0x5e05d0[_0xe081('0xc')]({'type':'outbound','app':_0xe081('0x3'),'appdata':_0xe081('0x1e'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x1f')+_0x5465c7[_0xe081('0x1c')]||_0xe081('0x20'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7['exten'],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']});}return _0x5e05d0;}function _0x677e5f(_0x4d9643,_0x519a1e){var _0x17457b=[{'name':_0xe081('0x21'),'param':0x0},{'name':_0xe081('0x22'),'param':0x1},{'name':_0xe081('0x23'),'param':0x2},{'name':_0xe081('0x24'),'param':0x3}];var _0x450e20={};var _0x24a994=_0x519a1e[_0xe081('0x25')](',');var _0x2095d4=[];for(var _0x372bf7=0x0;_0x372bf7<_0x17457b['length'];_0x372bf7++){switch(_0x17457b[_0x372bf7][_0xe081('0x26')]){case _0xe081('0x21'):_0x450e20[_0xe081('0x21')]=_0x24a994[_0x17457b[_0x372bf7][_0xe081('0x27')]]['split']('/')[0x1];_0x450e20['phone']=_0x24a994[_0x17457b[_0x372bf7][_0xe081('0x27')]][_0xe081('0x25')]('/')[0x2];_0x450e20[_0xe081('0x28')]=_0x450e20[_0xe081('0x29')]?_0x450e20['phone'][_0xe081('0x25')]('$')[0x0]:undefined;_0x450e20[_0xe081('0x29')]=_0x4d9643[_0xe081('0x12')]?(_0x450e20[_0xe081('0x28')]||'')+'${EXTEN:'+_0x4d9643[_0xe081('0x12')]+'}':(_0x450e20[_0xe081('0x28')]||'')+_0xe081('0x14');_0x2095d4[_0x17457b[_0x372bf7][_0xe081('0x27')]]=[_0xe081('0x2a'),_0x450e20[_0xe081('0x21')],_0x450e20[_0xe081('0x29')]][_0xe081('0x2b')]('/');break;case'options':_0x450e20[_0xe081('0x23')]=_0x24a994[_0x17457b[_0x372bf7]['param']];if(_0x4d9643['recordingFormat']!==_0xe081('0x1d')){if(_0x450e20[_0xe081('0x23')][_0xe081('0x2c')](_0xe081('0x2d'))<0x0){_0x450e20[_0xe081('0x23')]+='U(xcally-mixmonitor-context)';}}else{_0x450e20[_0xe081('0x23')]=_0x450e20[_0xe081('0x23')]['replace']('U(xcally-mixmonitor-context)','');}_0x2095d4[_0x17457b[_0x372bf7][_0xe081('0x27')]]=_0x450e20['options'];break;default:_0x2095d4[_0x17457b[_0x372bf7][_0xe081('0x27')]]=_0x24a994[_0x17457b[_0x372bf7][_0xe081('0x27')]];}}return _0x2095d4[_0xe081('0x2b')](',');}function _0x47d806(_0x2486a1,_0x4f9004,_0xa1e130){return new Promise(function(_0xe38ff5,_0x23567a){var _0x3968d7=[];if(_[_0xe081('0x2e')](_0x4f9004))return _0xe38ff5(_0x3968d7);_0x3192ba[_0xe081('0x2f')][_0xe081('0x30')]({'attributes':['id',_0xe081('0x31'),_0xe081('0x32')],'raw':!![]})[_0xe081('0x33')](function(_0x4b750a){for(var _0x3a16cd=0x0,_0x3561df=0x0;_0x3a16cd<_0x4f9004[_0xe081('0x34')];_0x3a16cd++,_0x3561df=0x0){var _0x2d2a64=_0x4f9004[_0x3a16cd];var _0x320677=[];var _0x376b87=[];delete _0x2d2a64['id'];if(_0x2d2a64[_0xe081('0x31')]!==_0xe081('0x35')){_0x2d2a64['intervals']=[_0x2d2a64[_0xe081('0x31')]];}else{_0x2d2a64[_0xe081('0x36')]=_0x2d2a64['IntervalId']?_[_0xe081('0x37')](_[_0xe081('0x38')](_0x4b750a,{'IntervalId':_0x2d2a64[_0xe081('0x32')]}),_0xe081('0x31')):[];}_0x2d2a64['context']=_0x2486a1[_0xe081('0x5')];_0x2d2a64[_0xe081('0x6')]=_0x2486a1['exten'];if(_0x2d2a64[_0xe081('0x2')])_0x2d2a64[_0xe081('0x2')]=_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')]();if(_0x2486a1[_0xe081('0x2')]===_0xe081('0xf')){if(_0x2d2a64[_0xe081('0x1b')](_0xe081('0x3a'))&&_0x2d2a64['tag']&&_0x2d2a64[_0xe081('0x3a')]!=='--'){_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x3'),'appdata':_0xe081('0x3b')+_0x2d2a64[_0xe081('0x3a')],'context':_0x2486a1['context'],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64['intervals'][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x15'),'appdata':_0xe081('0x3c')+(_0x2d2a64[_0xe081('0x3d')]?_0xe081('0x3e')+_0x2d2a64[_0xe081('0x3d')]+')':_0xe081('0x3f')),'context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64[_0xe081('0x36')][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}else{if(_0x2d2a64[_0xe081('0x1b')](_0xe081('0x40'))){if([_0xe081('0x41'),_0xe081('0x42')]['includes'](_0x2d2a64[_0xe081('0x43')][_0xe081('0x39')]())&&_0x2d2a64['appType']!==_0xe081('0x44')){if(_0x2d2a64[_0xe081('0x40')]){_0x320677[_0xe081('0xc')]({'type':_0x2d2a64['type'][_0xe081('0x39')](),'app':_0xe081('0x15'),'appdata':_0xe081('0x45'),'context':_0x2486a1['context'],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64['intervals']['length']+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});_0x320677[_0xe081('0xc')]({'type':_0x2d2a64['type']['toLowerCase'](),'app':_0xe081('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64[_0xe081('0x36')][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}else{_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64[_0xe081('0x36')][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x3'),'appdata':_0xe081('0x46'),'context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64['intervals'][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}}}}for(var _0x3d8923=0x0;_0x3d8923<_0x2d2a64[_0xe081('0x36')][_0xe081('0x34')];_0x3d8923++){var _0xcdab9=_0xa1e130+_0x2d2a64['intervals'][_0xe081('0x34')];var _0x4aa6db=_0x3d8923===_0x2d2a64['intervals'][_0xe081('0x34')]-0x1?_0xa1e130+_0x320677['length']+_0x376b87[_0xe081('0x34')]+0x2:_0xa1e130+_0x3d8923+0x1;_0x320677[_0xe081('0x47')](_0x3d8923,0x0,{'type':_0x2486a1[_0xe081('0x2')],'app':_0xe081('0x48'),'appdata':_0x2d2a64['intervals'][_0x3d8923]+'?'+_0x2486a1[_0xe081('0x5')]+_0xe081('0x49')+_0xcdab9+':'+_0x2486a1[_0xe081('0x5')]+',${EXTEN},'+_0x4aa6db,'exten':_0x2486a1[_0xe081('0x6')],'context':_0x2486a1[_0xe081('0x5')],'priority':_0xa1e130+_0x3d8923,'VoiceExtensionId':_0x2486a1['id']});}if(_0x2d2a64[_0xe081('0x4a')]===_0xe081('0x4b')){_0x2d2a64[_0xe081('0x4c')]=_0x677e5f(_0x2486a1,_0x2d2a64[_0xe081('0x4c')]);}if(_0x2d2a64[_0xe081('0x4a')]===_0xe081('0x4d')){_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x3'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64['intervals'][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}_0x2d2a64['priority']=_0x320677[_0xe081('0x34')]?_['last'](_0x320677)[_0xe081('0x4e')]+0x1:_0xa1e130;_0x3968d7=_[_0xe081('0x4f')](_0x3968d7,_0x320677,[_0x2d2a64],_0x376b87);_0xa1e130=_['last'](_0x3968d7)[_0xe081('0x4e')]+0x1;}return _0xe38ff5(_0x3968d7);})['catch'](function(_0x923cce){_0x23567a(_0x923cce);});});}return _0x3c3812[_0xe081('0x50')](_0xe081('0x51'),attributes,{'tableName':_0xe081('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1996f3){var _0x54cfd7=this[_0xe081('0x53')]({'plain':!![]});var _0x5af78b=_0x54cfd7['type']===_0xe081('0xf')?_0x143a82(_0x54cfd7):_0x1e6138(_0x54cfd7);return _0x47d806(_0x54cfd7,_0x1996f3,_[_0xe081('0x54')](_0x5af78b)[_0xe081('0x4e')]+0x1)['then'](function(_0xee4b86){var _0x37486b=_[_0xe081('0x4f')](_0x5af78b,_0xee4b86);_0x37486b[_0xe081('0xc')]({'type':_0x54cfd7['type'],'app':_0xe081('0x55'),'exten':_0x54cfd7[_0xe081('0x6')],'context':_0x54cfd7[_0xe081('0x5')],'priority':_['last'](_0x37486b)[_0xe081('0x4e')]+0x1,'VoiceExtensionId':_0x54cfd7['id']});return _0x37486b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 21be220..44909eb 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 _0xfd87=['options','raw','where','limit','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var moment=require(_0x7fd8('0x2'));var BPromise=require(_0x7fd8('0x3'));var rs=require(_0x7fd8('0x4'));var fs=require('fs');var Redis=require(_0x7fd8('0x5'));var db=require(_0x7fd8('0x6'))['db'];var utils=require(_0x7fd8('0x7'));var logger=require(_0x7fd8('0x8'))(_0x7fd8('0x9'));var config=require(_0x7fd8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7fd8('0xb')][_0x7fd8('0xc')]({'port':0x232a});config['redis']=_[_0x7fd8('0xd')](config[_0x7fd8('0xe')],{'host':_0x7fd8('0xf'),'port':0x18eb});var socket=require(_0x7fd8('0x10'))(new Redis(config[_0x7fd8('0xe')]));require('./voiceExtension.socket')[_0x7fd8('0x11')](socket);function respondWithRpcPromise(_0x18e3ea,_0x1b8863,_0x596d03){return new BPromise(function(_0x5486fc,_0x4948d0){return client[_0x7fd8('0x12')](_0x18e3ea,_0x596d03)['then'](function(_0x4749df){logger[_0x7fd8('0x13')](_0x7fd8('0x14'),_0x1b8863,'request\x20sent');logger[_0x7fd8('0x15')](_0x7fd8('0x16'),_0x1b8863,_0x7fd8('0x17'),JSON[_0x7fd8('0x18')](_0x4749df));if(_0x4749df[_0x7fd8('0x19')]){if(_0x4749df['error'][_0x7fd8('0x1a')]===0x1f4){logger[_0x7fd8('0x19')](_0x7fd8('0x14'),_0x1b8863,_0x4749df[_0x7fd8('0x19')][_0x7fd8('0x1b')]);return _0x4948d0(_0x4749df[_0x7fd8('0x19')][_0x7fd8('0x1b')]);}logger[_0x7fd8('0x19')](_0x7fd8('0x14'),_0x1b8863,_0x4749df[_0x7fd8('0x19')][_0x7fd8('0x1b')]);return _0x5486fc(_0x4749df['error']['message']);}else{logger['info'](_0x7fd8('0x14'),_0x1b8863,_0x7fd8('0x17'));_0x5486fc(_0x4749df['result'][_0x7fd8('0x1b')]);}})[_0x7fd8('0x1c')](function(_0x40b134){logger[_0x7fd8('0x19')](_0x7fd8('0x14'),_0x1b8863,_0x40b134);_0x4948d0(_0x40b134);});});}exports[_0x7fd8('0x1d')]=function(_0x2edf31){var _0x4539b6=this;return new Promise(function(_0x4b5d0a,_0x34bc09){return db[_0x7fd8('0x1e')][_0x7fd8('0x1f')]({'raw':_0x2edf31[_0x7fd8('0x20')]?_0x2edf31[_0x7fd8('0x20')][_0x7fd8('0x21')]===undefined?!![]:![]:!![],'where':_0x2edf31['options']?_0x2edf31[_0x7fd8('0x20')][_0x7fd8('0x22')]||null:null,'attributes':_0x2edf31[_0x7fd8('0x20')]?_0x2edf31[_0x7fd8('0x20')]['attributes']||null:null,'limit':_0x2edf31[_0x7fd8('0x20')]?_0x2edf31[_0x7fd8('0x20')][_0x7fd8('0x23')]||null:null,'include':_0x2edf31[_0x7fd8('0x20')]?_0x2edf31[_0x7fd8('0x20')]['include']?_['map'](_0x2edf31[_0x7fd8('0x20')][_0x7fd8('0x24')],function(_0xa273a7){return{'model':db[_0xa273a7[_0x7fd8('0x25')]],'as':_0xa273a7['as'],'attributes':_0xa273a7[_0x7fd8('0x26')],'include':_0xa273a7['include']?_[_0x7fd8('0x27')](_0xa273a7[_0x7fd8('0x24')],function(_0xda5f2a){return{'model':db[_0xda5f2a[_0x7fd8('0x25')]],'as':_0xda5f2a['as'],'attributes':_0xda5f2a[_0x7fd8('0x26')],'include':_0xda5f2a['include']?_['map'](_0xda5f2a[_0x7fd8('0x24')],function(_0x2bd721){return{'model':db[_0x2bd721[_0x7fd8('0x25')]],'as':_0x2bd721['as'],'attributes':_0x2bd721[_0x7fd8('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fc63a){logger[_0x7fd8('0x13')]('GetVoiceExtension',_0x2edf31);logger[_0x7fd8('0x15')](_0x7fd8('0x1d'),_0x2edf31,JSON[_0x7fd8('0x18')](_0x4fc63a));_0x4b5d0a(_0x4fc63a);})['catch'](function(_0x28e28e){logger['error'](_0x7fd8('0x1d'),_0x28e28e[_0x7fd8('0x1b')],_0x2edf31);_0x34bc09(_0x4539b6[_0x7fd8('0x19')](0x1f4,_0x28e28e[_0x7fd8('0x1b')]));});});}; \ No newline at end of file +var _0xe2bc=['../../config/environment','jayson/promise','client','http','redis','localhost','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xe2bc[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var moment=require(_0xce2b('0x1'));var BPromise=require('bluebird');var rs=require(_0xce2b('0x2'));var fs=require('fs');var Redis=require(_0xce2b('0x3'));var db=require(_0xce2b('0x4'))['db'];var utils=require(_0xce2b('0x5'));var logger=require(_0xce2b('0x6'))('rpc');var config=require(_0xce2b('0x7'));var jayson=require(_0xce2b('0x8'));var client=jayson[_0xce2b('0x9')][_0xce2b('0xa')]({'port':0x232a});config[_0xce2b('0xb')]=_['defaults'](config[_0xce2b('0xb')],{'host':_0xce2b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce2b('0xb')]));require(_0xce2b('0xd'))[_0xce2b('0xe')](socket);function respondWithRpcPromise(_0x3786aa,_0x1e5036,_0xc6cdb){return new BPromise(function(_0x3eae6d,_0xa7941){return client[_0xce2b('0xf')](_0x3786aa,_0xc6cdb)[_0xce2b('0x10')](function(_0x47a597){logger[_0xce2b('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x1e5036,_0xce2b('0x12'));logger[_0xce2b('0x13')](_0xce2b('0x14'),_0x1e5036,_0xce2b('0x12'),JSON[_0xce2b('0x15')](_0x47a597));if(_0x47a597[_0xce2b('0x16')]){if(_0x47a597[_0xce2b('0x16')][_0xce2b('0x17')]===0x1f4){logger['error'](_0xce2b('0x18'),_0x1e5036,_0x47a597[_0xce2b('0x16')]['message']);return _0xa7941(_0x47a597['error']['message']);}logger[_0xce2b('0x16')](_0xce2b('0x18'),_0x1e5036,_0x47a597[_0xce2b('0x16')]['message']);return _0x3eae6d(_0x47a597['error'][_0xce2b('0x19')]);}else{logger[_0xce2b('0x11')](_0xce2b('0x18'),_0x1e5036,_0xce2b('0x12'));_0x3eae6d(_0x47a597[_0xce2b('0x1a')][_0xce2b('0x19')]);}})[_0xce2b('0x1b')](function(_0x31316d){logger[_0xce2b('0x16')](_0xce2b('0x18'),_0x1e5036,_0x31316d);_0xa7941(_0x31316d);});});}exports['GetVoiceExtension']=function(_0x192002){var _0x1d888c=this;return new Promise(function(_0x167e55,_0x44c2af){return db[_0xce2b('0x1c')][_0xce2b('0x1d')]({'raw':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x1f')]===undefined?!![]:![]:!![],'where':_0x192002[_0xce2b('0x1e')]?_0x192002['options'][_0xce2b('0x20')]||null:null,'attributes':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x21')]||null:null,'limit':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x22')]||null:null,'include':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x192002['options']['include'],function(_0x527b03){return{'model':db[_0x527b03[_0xce2b('0x25')]],'as':_0x527b03['as'],'attributes':_0x527b03['attributes'],'include':_0x527b03[_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x527b03['include'],function(_0x60eca0){return{'model':db[_0x60eca0[_0xce2b('0x25')]],'as':_0x60eca0['as'],'attributes':_0x60eca0['attributes'],'include':_0x60eca0[_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x60eca0[_0xce2b('0x23')],function(_0x50a62f){return{'model':db[_0x50a62f['model']],'as':_0x50a62f['as'],'attributes':_0x50a62f[_0xce2b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xce2b('0x10')](function(_0x211b88){logger['info']('GetVoiceExtension',_0x192002);logger[_0xce2b('0x13')](_0xce2b('0x26'),_0x192002,JSON[_0xce2b('0x15')](_0x211b88));_0x167e55(_0x211b88);})['catch'](function(_0x3a8c00){logger[_0xce2b('0x16')](_0xce2b('0x26'),_0x3a8c00[_0xce2b('0x19')],_0x192002);_0x44c2af(_0x1d888c[_0xce2b('0x16')](0x1f4,_0x3a8c00[_0xce2b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index da7a102..4a0d285 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x5029b6,_0x4849b3){var _0x662627=function(_0x3f89f1){while(--_0x3f89f1){_0x5029b6['push'](_0x5029b6['shift']());}};_0x662627(++_0x4849b3);}(_0x1261,0x144));var _0x1126=function(_0x17cb63,_0x4c0e90){_0x17cb63=_0x17cb63-0x0;var _0x4340bc=_0x1261[_0x17cb63];return _0x4340bc;};'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 +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x32928c,_0x6a0bf7){var _0xace309=function(_0x4be298){while(--_0x4be298){_0x32928c['push'](_0x32928c['shift']());}};_0xace309(++_0x6a0bf7);}(_0x4975,0x86));var _0x5497=function(_0x38fe35,_0x204d8c){_0x38fe35=_0x38fe35-0x0;var _0xafd33e=_0x4975[_0x38fe35];return _0xafd33e;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 47b4e7a..0261bf5 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 _0x2d72=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2d72,0xa8));var _0x22d7=function(_0x4c699b,_0x418c0d){_0x4c699b=_0x4c699b-0x0;var _0x16bcd7=_0x2d72[_0x4c699b];return _0x16bcd7;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['show']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22d7('0x11')]);router[_0x22d7('0x12')](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x13')]);router['delete']('/:id',auth[_0x22d7('0xc')](),controller['destroy']);module[_0x22d7('0x14')]=router; \ No newline at end of file +var _0x1893=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0x4b651b,_0x400809){var _0x9879e1=function(_0xb51c02){while(--_0xb51c02){_0x4b651b['push'](_0x4b651b['shift']());}};_0x9879e1(++_0x400809);}(_0x1893,0xa2));var _0x3189=function(_0x555569,_0x15669b){_0x555569=_0x555569-0x0;var _0x2541ff=_0x1893[_0x555569];return _0x2541ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var fs_extra=require(_0x3189('0x4'));var auth=require(_0x3189('0x5'));var interaction=require(_0x3189('0x6'));var config=require('../../config/environment');var controller=require(_0x3189('0x7'));router[_0x3189('0x8')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0x8')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0xc')]);router['get'](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router['post']('/',auth[_0x3189('0x9')](),controller[_0x3189('0xf')]);router[_0x3189('0x10')](_0x3189('0xb'),auth['isAuthenticated'](),controller[_0x3189('0x11')]);router[_0x3189('0x12')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index d6f3325..e10bc98 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 _0x9071=['yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central'];(function(_0x399d76,_0xdc4493){var _0x3b19a1=function(_0x262225){while(--_0x262225){_0x399d76['push'](_0x399d76['shift']());}};_0x3b19a1(++_0xdc4493);}(_0x9071,0xac));var _0x1907=function(_0x56a37e,_0x2e5185){_0x56a37e=_0x56a37e-0x0;var _0x30cd29=_0x9071[_0x56a37e];return _0x30cd29;};'use strict';var Sequelize=require('sequelize');module[_0x1907('0x0')]={'customer_id':{'type':Sequelize[_0x1907('0x1')]},'context':{'type':Sequelize[_0x1907('0x1')],'defaultValue':_0x1907('0x2'),'unique':_0x1907('0x3')},'mailbox':{'type':Sequelize[_0x1907('0x1')],'defaultValue':'','allowNull':![],'unique':_0x1907('0x3')},'password':{'type':Sequelize[_0x1907('0x1')]},'fullname':{'type':Sequelize[_0x1907('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x501ac5){this[_0x1907('0x4')](_0x1907('0x5'),typeof _0x501ac5==='string'&&_0x501ac5[_0x1907('0x6')]()?_0x501ac5['trim']():null);}},'pager':{'type':Sequelize[_0x1907('0x1')]},'tz':{'type':Sequelize[_0x1907('0x1')],'defaultValue':_0x1907('0x7')},'attach':{'type':Sequelize['ENUM'](_0x1907('0x8'),'no'),'defaultValue':_0x1907('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':_0x1907('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1907('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1907('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1907('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1907('0x9')](_0x1907('0x8'),'no'),'defaultValue':_0x1907('0x8'),'allowNull':![]},'stamp':{'type':_0x1907('0xa')},'emailsubject':{'type':Sequelize[_0x1907('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x1907('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1907('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1907('0xc')],'get':function(){return this['getDataValue']('fullname')+'\x20-\x20'+this[_0x1907('0xd')](_0x1907('0xe'));}}}; \ No newline at end of file +var _0x1947=['from-voicemail','contest_mailbox','setDataValue','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','STRING'];(function(_0x2f9a69,_0x14874a){var _0x343a80=function(_0x541e3e){while(--_0x541e3e){_0x2f9a69['push'](_0x2f9a69['shift']());}};_0x343a80(++_0x14874a);}(_0x1947,0x124));var _0x7194=function(_0x281187,_0x32ddf2){_0x281187=_0x281187-0x0;var _0x32b7a1=_0x1947[_0x281187];return _0x32b7a1;};'use strict';var Sequelize=require(_0x7194('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x7194('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x7194('0x2'),'unique':_0x7194('0x3')},'mailbox':{'type':Sequelize[_0x7194('0x1')],'defaultValue':'','allowNull':![],'unique':_0x7194('0x3')},'password':{'type':Sequelize[_0x7194('0x1')]},'fullname':{'type':Sequelize[_0x7194('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2125dc){this[_0x7194('0x4')]('email',typeof _0x2125dc==='string'&&_0x2125dc[_0x7194('0x5')]()?_0x2125dc[_0x7194('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x7194('0x1')],'defaultValue':_0x7194('0x6')},'attach':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':_0x7194('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7194('0x1')]},'callback':{'type':Sequelize[_0x7194('0x1')]},'review':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7194('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x7194('0x8'),'no'),'defaultValue':_0x7194('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x7194('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':_0x7194('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x7194('0x1')]},'emailbody':{'type':Sequelize[_0x7194('0x1')]},'maxsecs':{'type':Sequelize[_0x7194('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7194('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7194('0xb')],'get':function(){return this[_0x7194('0xc')]('fullname')+'\x20-\x20'+this[_0x7194('0xc')](_0x7194('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index edb3c8e..661c1cc 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 _0xc900=['body','params','findOne','VoiceMailMessage','findAndCountAll','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','Voicemails','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceMail','includeAll','include','findAll','catch','show','rawAttributes','keys','find','user','get','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xc900,0xb3));var _0x0c90=function(_0x311cf5,_0x240145){_0x311cf5=_0x311cf5-0x0;var _0x4e4cbc=_0xc900[_0x311cf5];return _0x4e4cbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];function respondWithStatusCode(_0x50e7db,_0x459cdb){_0x459cdb=_0x459cdb||0xcc;return function(_0x26fc46){if(_0x26fc46){return _0x50e7db[_0x0c90('0x19')](_0x459cdb);}return _0x50e7db[_0x0c90('0x1a')](_0x459cdb)[_0x0c90('0x1b')]();};}function respondWithResult(_0x59ea8e,_0x467b32){_0x467b32=_0x467b32||0xc8;return function(_0x4451e0){if(_0x4451e0){return _0x59ea8e['status'](_0x467b32)[_0x0c90('0x1c')](_0x4451e0);}};}function respondWithFilteredResult(_0x3a492d,_0x3bd5e8){return function(_0x5bef7d){if(_0x5bef7d){var _0x5daeb7=typeof _0x3bd5e8[_0x0c90('0x1d')]===_0x0c90('0x1e')&&typeof _0x3bd5e8[_0x0c90('0x1f')]===_0x0c90('0x1e');var _0x276b92=_0x5bef7d[_0x0c90('0x20')];var _0x42321a=_0x5daeb7?0x0:_0x3bd5e8['offset'];var _0xc3bb47=_0x5daeb7?_0x5bef7d[_0x0c90('0x20')]:_0x3bd5e8[_0x0c90('0x1d')]+_0x3bd5e8[_0x0c90('0x1f')];var _0x594267;if(_0xc3bb47>=_0x276b92){_0xc3bb47=_0x276b92;_0x594267=0xc8;}else{_0x594267=0xce;}_0x3a492d[_0x0c90('0x1a')](_0x594267);return _0x3a492d[_0x0c90('0x21')](_0x0c90('0x22'),_0x42321a+'-'+_0xc3bb47+'/'+_0x276b92)[_0x0c90('0x1c')](_0x5bef7d);}return null;};}function patchUpdates(_0x315932){return function(_0xc08f54){try{jsonpatch['apply'](_0xc08f54,_0x315932,!![]);}catch(_0x365a42){return BPromise['reject'](_0x365a42);}return _0xc08f54[_0x0c90('0x23')]();};}function saveUpdates(_0x1a021e,_0x47b13c){return function(_0x2a053a){if(_0x2a053a){return _0x2a053a[_0x0c90('0x24')](_0x1a021e)[_0x0c90('0x25')](function(_0x86dee){return _0x86dee;});}return null;};}function removeEntity(_0x212164,_0x3b287c){return function(_0x4dfbc3){if(_0x4dfbc3){return _0x4dfbc3[_0x0c90('0x26')]()[_0x0c90('0x25')](function(){var _0x5695a2=_0x4dfbc3['get']({'plain':!![]});var _0x28d005=_0x0c90('0x27');return db[_0x0c90('0x28')][_0x0c90('0x26')]({'where':{'type':_0x28d005,'resourceId':_0x5695a2['id']}})['then'](function(){return _0x4dfbc3;});})[_0x0c90('0x25')](function(){_0x212164[_0x0c90('0x1a')](0xcc)[_0x0c90('0x1b')]();});}};}function handleEntityNotFound(_0x277d4a,_0x427c2b){return function(_0x114589){if(!_0x114589){_0x277d4a['sendStatus'](0x194);}return _0x114589;};}function handleError(_0x15de68,_0x22a47d){_0x22a47d=_0x22a47d||0x1f4;return function(_0x39f1b2){logger[_0x0c90('0x29')](_0x39f1b2['stack']);if(_0x39f1b2['name']){delete _0x39f1b2[_0x0c90('0x2a')];}_0x15de68[_0x0c90('0x1a')](_0x22a47d)[_0x0c90('0x2b')](_0x39f1b2);};}exports[_0x0c90('0x2c')]=function(_0x119e09,_0x562664){var _0x120136={},_0x50b156={},_0x478002={'count':0x0,'rows':[]};var _0x47a935=_[_0x0c90('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x886634){return{'name':_0x886634[_0x0c90('0x2e')],'type':_0x886634[_0x0c90('0x2f')][_0x0c90('0x30')]};});_0x50b156['model']=_[_0x0c90('0x2d')](_0x47a935,'name');_0x50b156[_0x0c90('0x31')]=_['keys'](_0x119e09[_0x0c90('0x31')]);_0x50b156[_0x0c90('0x32')]=_['intersection'](_0x50b156[_0x0c90('0x33')],_0x50b156[_0x0c90('0x31')]);_0x120136[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x50b156[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x36')]));_0x120136['attributes']=_0x120136[_0x0c90('0x34')][_0x0c90('0x37')]?_0x120136[_0x0c90('0x34')]:_0x50b156[_0x0c90('0x33')];if(!_0x119e09['query'][_0x0c90('0x38')](_0x0c90('0x39'))){_0x120136[_0x0c90('0x1f')]=qs[_0x0c90('0x1f')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x120136[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x119e09['query'][_0x0c90('0x1d')]);}_0x120136[_0x0c90('0x3a')]=qs['sort'](_0x119e09[_0x0c90('0x31')][_0x0c90('0x3b')]);_0x120136[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x119e09['query'],_0x50b156[_0x0c90('0x32')]),_0x47a935);if(_0x119e09[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x120136[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x120136[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x47a935,function(_0x1695dd){if(_0x1695dd[_0x0c90('0x2f')]!=='VIRTUAL'){var _0x2cd2c2={};_0x2cd2c2[_0x1695dd['name']]={'$like':'%'+_0x119e09[_0x0c90('0x31')]['filter']+'%'};return _0x2cd2c2;}})});}_0x120136=_[_0x0c90('0x3f')]({},_0x120136,_0x119e09[_0x0c90('0x40')]);var _0x49f8b4={'where':_0x120136['where']};return db[_0x0c90('0x41')]['count'](_0x49f8b4)[_0x0c90('0x25')](function(_0x4545bb){_0x478002[_0x0c90('0x20')]=_0x4545bb;if(_0x119e09['query'][_0x0c90('0x42')]){_0x120136[_0x0c90('0x43')]=[{'all':!![]}];}return db[_0x0c90('0x41')][_0x0c90('0x44')](_0x120136);})[_0x0c90('0x25')](function(_0x1184c4){_0x478002['rows']=_0x1184c4;return _0x478002;})[_0x0c90('0x25')](respondWithFilteredResult(_0x562664,_0x120136))[_0x0c90('0x45')](handleError(_0x562664,null));};exports[_0x0c90('0x46')]=function(_0x399115,_0x3c47c9){var _0x15d040={'raw':!![],'where':{'id':_0x399115['params']['id']}},_0x30b9df={};_0x30b9df[_0x0c90('0x33')]=_['keys'](db[_0x0c90('0x41')][_0x0c90('0x47')]);_0x30b9df[_0x0c90('0x31')]=_[_0x0c90('0x48')](_0x399115[_0x0c90('0x31')]);_0x30b9df[_0x0c90('0x32')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],_0x30b9df[_0x0c90('0x31')]);_0x15d040[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x399115[_0x0c90('0x31')][_0x0c90('0x36')]));_0x15d040['attributes']=_0x15d040[_0x0c90('0x34')][_0x0c90('0x37')]?_0x15d040[_0x0c90('0x34')]:_0x30b9df[_0x0c90('0x33')];if(_0x399115[_0x0c90('0x31')][_0x0c90('0x42')]){_0x15d040[_0x0c90('0x43')]=[{'all':!![]}];}_0x15d040=_[_0x0c90('0x3f')]({},_0x15d040,_0x399115[_0x0c90('0x40')]);return db[_0x0c90('0x41')][_0x0c90('0x49')](_0x15d040)[_0x0c90('0x25')](handleEntityNotFound(_0x3c47c9,null))[_0x0c90('0x25')](respondWithResult(_0x3c47c9,null))[_0x0c90('0x45')](handleError(_0x3c47c9,null));};exports['create']=function(_0x1b4aac,_0x38f492){return db['VoiceMail']['create'](_0x1b4aac['body'],{})[_0x0c90('0x25')](function(_0x1205d0){var _0x460cf9=_0x1b4aac[_0x0c90('0x4a')][_0x0c90('0x4b')]({'plain':!![]});if(!_0x460cf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460cf9[_0x0c90('0x4c')]===_0x0c90('0x4a')){var _0x2b756d=_0x1205d0['get']({'plain':!![]});var _0x119776=_0x0c90('0x27');return db[_0x0c90('0x4d')][_0x0c90('0x49')]({'where':{'name':_0x119776,'userProfileId':_0x460cf9[_0x0c90('0x4e')]},'raw':!![]})[_0x0c90('0x25')](function(_0x42c121){if(_0x42c121&&_0x42c121[_0x0c90('0x4f')]===0x0){return db[_0x0c90('0x28')][_0x0c90('0x50')]({'name':_0x2b756d['name'],'resourceId':_0x2b756d['id'],'type':_0x42c121[_0x0c90('0x2a')],'sectionId':_0x42c121['id']},{})['then'](function(){return _0x1205d0;});}else{return _0x1205d0;}})[_0x0c90('0x45')](function(_0x67539d){logger[_0x0c90('0x29')](_0x0c90('0x51'),_0x67539d);throw _0x67539d;});}return _0x1205d0;})[_0x0c90('0x25')](respondWithResult(_0x38f492,0xc9))[_0x0c90('0x45')](handleError(_0x38f492,null));};exports['update']=function(_0x4930fc,_0x5382d9){if(_0x4930fc['body']['id']){delete _0x4930fc[_0x0c90('0x52')]['id'];}return db[_0x0c90('0x41')][_0x0c90('0x49')]({'where':{'id':_0x4930fc['params']['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x5382d9,null))[_0x0c90('0x25')](saveUpdates(_0x4930fc['body'],null))[_0x0c90('0x25')](respondWithResult(_0x5382d9,null))['catch'](handleError(_0x5382d9,null));};exports[_0x0c90('0x26')]=function(_0x8951f2,_0x42398b){return db[_0x0c90('0x41')]['find']({'where':{'id':_0x8951f2[_0x0c90('0x53')]['id']}})['then'](handleEntityNotFound(_0x42398b,null))[_0x0c90('0x25')](removeEntity(_0x42398b,null))[_0x0c90('0x45')](handleError(_0x42398b,null));};exports['getMessages']=function(_0x52b437,_0x51c356,_0x221fba){return db[_0x0c90('0x41')][_0x0c90('0x54')]({'where':{'id':_0x52b437[_0x0c90('0x53')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x51c356,null))['then'](function(_0x3bfd01){var _0x25ab13;var _0x5ee971={},_0x3eb725={};_0x3eb725['model']=_[_0x0c90('0x48')](db[_0x0c90('0x55')]['rawAttributes']);_0x3eb725[_0x0c90('0x31')]=_['keys'](_0x52b437['query']);_0x3eb725['filters']=_[_0x0c90('0x35')](_0x3eb725[_0x0c90('0x33')],_0x3eb725[_0x0c90('0x31')]);_0x5ee971[_0x0c90('0x34')]=_['intersection'](_0x3eb725['model'],qs[_0x0c90('0x36')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x36')]));_0x5ee971['attributes']=_0x5ee971[_0x0c90('0x34')][_0x0c90('0x37')]?_0x5ee971[_0x0c90('0x34')]:_0x3eb725['model'];if(!_0x52b437[_0x0c90('0x31')][_0x0c90('0x38')](_0x0c90('0x39'))){_0x5ee971['limit']=qs[_0x0c90('0x1f')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x5ee971[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1d')]);}_0x5ee971[_0x0c90('0x3a')]=qs[_0x0c90('0x3b')](_0x52b437['query']['sort']);_0x5ee971[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x52b437[_0x0c90('0x31')],_0x3eb725[_0x0c90('0x32')]));if(_0x52b437[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x5ee971[_0x0c90('0x34')],function(_0x309152){var _0x164d4d={};_0x164d4d[_0x309152]={'$like':'%'+_0x52b437[_0x0c90('0x31')]['filter']+'%'};return _0x164d4d;})});}_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'mailboxuser':_0x3bfd01['mailbox']});_0x5ee971=_['merge']({},_0x5ee971,_0x52b437[_0x0c90('0x40')]);return db['VoiceMailMessage'][_0x0c90('0x56')](_0x5ee971)[_0x0c90('0x25')](respondWithFilteredResult(_0x51c356,_0x5ee971));})['catch'](handleError(_0x51c356,null));}; \ No newline at end of file +var _0x0bb5=['error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails'];(function(_0x49c8a2,_0x58dcff){var _0xe46e67=function(_0x547e69){while(--_0x547e69){_0x49c8a2['push'](_0x49c8a2['shift']());}};_0xe46e67(++_0x58dcff);}(_0x0bb5,0x148));var _0x50bb=function(_0x2cb0f3,_0xf73a5c){_0x2cb0f3=_0x2cb0f3-0x0;var _0xa44f94=_0x0bb5[_0x2cb0f3];return _0xa44f94;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){var _0xad17ac=_0x846311[_0x50bb('0x26')]({'plain':!![]});var _0x284a76=_0x50bb('0x27');return db['UserProfileResource'][_0x50bb('0x25')]({'where':{'type':_0x284a76,'resourceId':_0xad17ac['id']}})['then'](function(){return _0x846311;});})['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cfe4b,_0x41fd89){return function(_0x12ee2c){if(!_0x12ee2c){_0x5cfe4b[_0x50bb('0x19')](0x194);}return _0x12ee2c;};}function handleError(_0x1b74f9,_0x17c158){_0x17c158=_0x17c158||0x1f4;return function(_0x269479){logger[_0x50bb('0x28')](_0x269479[_0x50bb('0x29')]);if(_0x269479['name']){delete _0x269479[_0x50bb('0x2a')];}_0x1b74f9[_0x50bb('0x1a')](_0x17c158)[_0x50bb('0x2b')](_0x269479);};}exports[_0x50bb('0x2c')]=function(_0x560b07,_0x13dc3c){var _0x1a62fb={},_0xc38da5={},_0xb3c3ba={'count':0x0,'rows':[]};var _0x3fd5f6=_[_0x50bb('0x2d')](db[_0x50bb('0x2e')][_0x50bb('0x2f')],function(_0x5cfdd5){return{'name':_0x5cfdd5[_0x50bb('0x30')],'type':_0x5cfdd5[_0x50bb('0x31')][_0x50bb('0x32')]};});_0xc38da5['model']=_[_0x50bb('0x2d')](_0x3fd5f6,_0x50bb('0x2a'));_0xc38da5[_0x50bb('0x33')]=_[_0x50bb('0x34')](_0x560b07[_0x50bb('0x33')]);_0xc38da5[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0xc38da5[_0x50bb('0x37')],_0xc38da5[_0x50bb('0x33')]);_0x1a62fb[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0xc38da5['model'],qs[_0x50bb('0x39')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x39')]));_0x1a62fb[_0x50bb('0x38')]=_0x1a62fb[_0x50bb('0x38')][_0x50bb('0x3a')]?_0x1a62fb['attributes']:_0xc38da5['model'];if(!_0x560b07[_0x50bb('0x33')]['hasOwnProperty'](_0x50bb('0x3b'))){_0x1a62fb[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1a62fb['offset']=qs[_0x50bb('0x1c')](_0x560b07['query'][_0x50bb('0x1c')]);}_0x1a62fb[_0x50bb('0x3d')]=qs[_0x50bb('0x3e')](_0x560b07['query']['sort']);_0x1a62fb[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x560b07[_0x50bb('0x33')],_0xc38da5['filters']),_0x3fd5f6);if(_0x560b07[_0x50bb('0x33')]['filter']){_0x1a62fb['where']=_[_0x50bb('0x41')](_0x1a62fb['where'],{'$or':_[_0x50bb('0x2d')](_0x3fd5f6,function(_0x3d94b8){if(_0x3d94b8[_0x50bb('0x31')]!==_0x50bb('0x42')){var _0x3a9fe4={};_0x3a9fe4[_0x3d94b8[_0x50bb('0x2a')]]={'$like':'%'+_0x560b07[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0x3a9fe4;}})});}_0x1a62fb=_[_0x50bb('0x41')]({},_0x1a62fb,_0x560b07[_0x50bb('0x44')]);var _0x594f16={'where':_0x1a62fb['where']};return db[_0x50bb('0x2e')][_0x50bb('0x1e')](_0x594f16)[_0x50bb('0x24')](function(_0x1d929d){_0xb3c3ba['count']=_0x1d929d;if(_0x560b07[_0x50bb('0x33')]['includeAll']){_0x1a62fb[_0x50bb('0x45')]=[{'all':!![]}];}return db[_0x50bb('0x2e')][_0x50bb('0x46')](_0x1a62fb);})[_0x50bb('0x24')](function(_0x1c438b){_0xb3c3ba[_0x50bb('0x47')]=_0x1c438b;return _0xb3c3ba;})[_0x50bb('0x24')](respondWithFilteredResult(_0x13dc3c,_0x1a62fb))[_0x50bb('0x48')](handleError(_0x13dc3c,null));};exports[_0x50bb('0x49')]=function(_0x46c1c3,_0x349474){var _0x24e375={'raw':!![],'where':{'id':_0x46c1c3[_0x50bb('0x4a')]['id']}},_0x85b0ff={};_0x85b0ff[_0x50bb('0x37')]=_[_0x50bb('0x34')](db['VoiceMail'][_0x50bb('0x2f')]);_0x85b0ff['query']=_[_0x50bb('0x34')](_0x46c1c3[_0x50bb('0x33')]);_0x85b0ff[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],_0x85b0ff[_0x50bb('0x33')]);_0x24e375[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x39')]));_0x24e375[_0x50bb('0x38')]=_0x24e375[_0x50bb('0x38')]['length']?_0x24e375[_0x50bb('0x38')]:_0x85b0ff['model'];if(_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x4b')]){_0x24e375[_0x50bb('0x45')]=[{'all':!![]}];}_0x24e375=_[_0x50bb('0x41')]({},_0x24e375,_0x46c1c3[_0x50bb('0x44')]);return db[_0x50bb('0x2e')][_0x50bb('0x4c')](_0x24e375)[_0x50bb('0x24')](handleEntityNotFound(_0x349474,null))['then'](respondWithResult(_0x349474,null))[_0x50bb('0x48')](handleError(_0x349474,null));};exports[_0x50bb('0x4d')]=function(_0xf52a22,_0x13afe2){return db[_0x50bb('0x2e')]['create'](_0xf52a22[_0x50bb('0x4e')],{})[_0x50bb('0x24')](function(_0x2a411d){var _0x154ff8=_0xf52a22[_0x50bb('0x4f')]['get']({'plain':!![]});if(!_0x154ff8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154ff8[_0x50bb('0x50')]==='user'){var _0x357d08=_0x2a411d['get']({'plain':!![]});var _0x4316e4=_0x50bb('0x27');return db[_0x50bb('0x51')]['find']({'where':{'name':_0x4316e4,'userProfileId':_0x154ff8[_0x50bb('0x52')]},'raw':!![]})[_0x50bb('0x24')](function(_0x588dfe){if(_0x588dfe&&_0x588dfe[_0x50bb('0x53')]===0x0){return db[_0x50bb('0x54')][_0x50bb('0x4d')]({'name':_0x357d08[_0x50bb('0x2a')],'resourceId':_0x357d08['id'],'type':_0x588dfe['name'],'sectionId':_0x588dfe['id']},{})[_0x50bb('0x24')](function(){return _0x2a411d;});}else{return _0x2a411d;}})[_0x50bb('0x48')](function(_0x2e0032){logger[_0x50bb('0x28')](_0x50bb('0x55'),_0x2e0032);throw _0x2e0032;});}return _0x2a411d;})['then'](respondWithResult(_0x13afe2,0xc9))[_0x50bb('0x48')](handleError(_0x13afe2,null));};exports['update']=function(_0x38a775,_0x50216f){if(_0x38a775['body']['id']){delete _0x38a775[_0x50bb('0x4e')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x38a775[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x50216f,null))[_0x50bb('0x24')](saveUpdates(_0x38a775[_0x50bb('0x4e')],null))[_0x50bb('0x24')](respondWithResult(_0x50216f,null))[_0x50bb('0x48')](handleError(_0x50216f,null));};exports[_0x50bb('0x25')]=function(_0x1408fa,_0x57d749){return db['VoiceMail'][_0x50bb('0x4c')]({'where':{'id':_0x1408fa[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x57d749,null))[_0x50bb('0x24')](removeEntity(_0x57d749,null))[_0x50bb('0x48')](handleError(_0x57d749,null));};exports[_0x50bb('0x56')]=function(_0x287bc7,_0x4bf426,_0x3be83b){return db[_0x50bb('0x2e')][_0x50bb('0x57')]({'where':{'id':_0x287bc7[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x4bf426,null))['then'](function(_0x33ebe6){var _0x1d8b85;var _0x1da5cd={},_0x507f26={};_0x507f26[_0x50bb('0x37')]=_['keys'](db[_0x50bb('0x58')]['rawAttributes']);_0x507f26['query']=_[_0x50bb('0x34')](_0x287bc7[_0x50bb('0x33')]);_0x507f26[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x507f26[_0x50bb('0x37')],_0x507f26[_0x50bb('0x33')]);_0x1da5cd[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x507f26[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x287bc7[_0x50bb('0x33')]['fields']));_0x1da5cd[_0x50bb('0x38')]=_0x1da5cd['attributes'][_0x50bb('0x3a')]?_0x1da5cd[_0x50bb('0x38')]:_0x507f26['model'];if(!_0x287bc7[_0x50bb('0x33')][_0x50bb('0x59')](_0x50bb('0x3b'))){_0x1da5cd[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1da5cd[_0x50bb('0x1c')]=qs['offset'](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x1c')]);}_0x1da5cd[_0x50bb('0x3d')]=qs['sort'](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x3e')]);_0x1da5cd[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x287bc7[_0x50bb('0x33')],_0x507f26['filters']));if(_0x287bc7[_0x50bb('0x33')][_0x50bb('0x43')]){_0x1da5cd[_0x50bb('0x3f')]=_[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')],{'$or':_[_0x50bb('0x2d')](_0x1da5cd['attributes'],function(_0x40257b){var _0xa85833={};_0xa85833[_0x40257b]={'$like':'%'+_0x287bc7[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0xa85833;})});}_0x1da5cd[_0x50bb('0x3f')]=_[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')],{'mailboxuser':_0x33ebe6[_0x50bb('0x5a')]});_0x1da5cd=_[_0x50bb('0x41')]({},_0x1da5cd,_0x287bc7['options']);return db[_0x50bb('0x58')][_0x50bb('0x5b')](_0x1da5cd)[_0x50bb('0x24')](respondWithFilteredResult(_0x4bf426,_0x1da5cd));})[_0x50bb('0x48')](handleError(_0x4bf426,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a1de4de..7f7b438 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 _0xb1ca=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','define'];(function(_0x34b311,_0x50db15){var _0x5c5113=function(_0x2045d4){while(--_0x2045d4){_0x34b311['push'](_0x34b311['shift']());}};_0x5c5113(++_0x50db15);}(_0xb1ca,0x195));var _0xab1c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb1ca[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xab1c('0x0'));var util=require(_0xab1c('0x1'));var logger=require(_0xab1c('0x2'))(_0xab1c('0x3'));var moment=require(_0xab1c('0x4'));var BPromise=require(_0xab1c('0x5'));var rp=require(_0xab1c('0x6'));var fs=require('fs');var path=require(_0xab1c('0x7'));var rimraf=require(_0xab1c('0x8'));var config=require('../../config/environment');var attributes=require(_0xab1c('0x9'));module['exports']=function(_0x47af2c,_0x1555b5){return _0x47af2c[_0xab1c('0xa')](_0xab1c('0xb'),attributes,{'tableName':_0xab1c('0xc'),'paranoid':![],'indexes':[{'name':_0xab1c('0xd'),'fields':[_0xab1c('0xe'),_0xab1c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x20dc=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','lodash','util','moment','bluebird','request-promise'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x20dc,0x1bb));var _0xc20d=function(_0x596e95,_0x489b4c){_0x596e95=_0x596e95-0x0;var _0xbf179d=_0x20dc[_0x596e95];return _0xbf179d;};'use strict';var _=require(_0xc20d('0x0'));var util=require(_0xc20d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc20d('0x2'));var BPromise=require(_0xc20d('0x3'));var rp=require(_0xc20d('0x4'));var fs=require('fs');var path=require(_0xc20d('0x5'));var rimraf=require(_0xc20d('0x6'));var config=require(_0xc20d('0x7'));var attributes=require(_0xc20d('0x8'));module[_0xc20d('0x9')]=function(_0x192874,_0x5753fa){return _0x192874[_0xc20d('0xa')](_0xc20d('0xb'),attributes,{'tableName':_0xc20d('0xc'),'paranoid':![],'indexes':[{'name':_0xc20d('0xd'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 4cfbbc7..b301eea 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 _0x115c=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x306cf9,_0x4570f0){var _0xc9c029=function(_0x34275e){while(--_0x34275e){_0x306cf9['push'](_0x306cf9['shift']());}};_0xc9c029(++_0x4570f0);}(_0x115c,0x164));var _0xc115=function(_0x332b3f,_0x4d6873){_0x332b3f=_0x332b3f-0x0;var _0x2eebd4=_0x115c[_0x332b3f];return _0x2eebd4;};'use strict';var _=require(_0xc115('0x0'));var util=require(_0xc115('0x1'));var moment=require(_0xc115('0x2'));var BPromise=require(_0xc115('0x3'));var rs=require(_0xc115('0x4'));var fs=require('fs');var Redis=require(_0xc115('0x5'));var db=require(_0xc115('0x6'))['db'];var utils=require(_0xc115('0x7'));var logger=require(_0xc115('0x8'))('rpc');var config=require(_0xc115('0x9'));var jayson=require(_0xc115('0xa'));var client=jayson[_0xc115('0xb')][_0xc115('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e5a10,_0x16c19f,_0x2b2ae){return new BPromise(function(_0x393327,_0x4d1f97){return client[_0xc115('0xd')](_0x1e5a10,_0x2b2ae)[_0xc115('0xe')](function(_0xd2d99d){logger[_0xc115('0xf')](_0xc115('0x10'),_0x16c19f,'request\x20sent');logger[_0xc115('0x11')](_0xc115('0x12'),_0x16c19f,_0xc115('0x13'),JSON[_0xc115('0x14')](_0xd2d99d));if(_0xd2d99d[_0xc115('0x15')]){if(_0xd2d99d['error'][_0xc115('0x16')]===0x1f4){logger[_0xc115('0x15')](_0xc115('0x10'),_0x16c19f,_0xd2d99d[_0xc115('0x15')][_0xc115('0x17')]);return _0x4d1f97(_0xd2d99d[_0xc115('0x15')][_0xc115('0x17')]);}logger[_0xc115('0x15')]('VoiceMail,\x20%s,\x20%s',_0x16c19f,_0xd2d99d[_0xc115('0x15')][_0xc115('0x17')]);return _0x393327(_0xd2d99d[_0xc115('0x15')]['message']);}else{logger[_0xc115('0xf')](_0xc115('0x10'),_0x16c19f,'request\x20sent');_0x393327(_0xd2d99d['result'][_0xc115('0x17')]);}})[_0xc115('0x18')](function(_0x2346d7){logger[_0xc115('0x15')](_0xc115('0x10'),_0x16c19f,_0x2346d7);_0x4d1f97(_0x2346d7);});});} \ No newline at end of file +var _0x21bf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','VoiceMail,\x20%s,\x20%s','catch','lodash','util'];(function(_0x386a70,_0x53478b){var _0xe9b1dc=function(_0x363f09){while(--_0x363f09){_0x386a70['push'](_0x386a70['shift']());}};_0xe9b1dc(++_0x53478b);}(_0x21bf,0xbb));var _0xf21b=function(_0xe2b013,_0x5790ce){_0xe2b013=_0xe2b013-0x0;var _0x37e2cc=_0x21bf[_0xe2b013];return _0x37e2cc;};'use strict';var _=require(_0xf21b('0x0'));var util=require(_0xf21b('0x1'));var moment=require(_0xf21b('0x2'));var BPromise=require(_0xf21b('0x3'));var rs=require(_0xf21b('0x4'));var fs=require('fs');var Redis=require(_0xf21b('0x5'));var db=require(_0xf21b('0x6'))['db'];var utils=require(_0xf21b('0x7'));var logger=require(_0xf21b('0x8'))('rpc');var config=require(_0xf21b('0x9'));var jayson=require(_0xf21b('0xa'));var client=jayson[_0xf21b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31c613,_0x334315,_0x1d95c3){return new BPromise(function(_0x5c3f50,_0x123ce5){return client[_0xf21b('0xc')](_0x31c613,_0x1d95c3)['then'](function(_0x34c2d3){logger[_0xf21b('0xd')]('VoiceMail,\x20%s,\x20%s',_0x334315,_0xf21b('0xe'));logger['debug'](_0xf21b('0xf'),_0x334315,_0xf21b('0xe'),JSON['stringify'](_0x34c2d3));if(_0x34c2d3[_0xf21b('0x10')]){if(_0x34c2d3['error'][_0xf21b('0x11')]===0x1f4){logger[_0xf21b('0x10')]('VoiceMail,\x20%s,\x20%s',_0x334315,_0x34c2d3[_0xf21b('0x10')][_0xf21b('0x12')]);return _0x123ce5(_0x34c2d3[_0xf21b('0x10')][_0xf21b('0x12')]);}logger['error'](_0xf21b('0x13'),_0x334315,_0x34c2d3[_0xf21b('0x10')][_0xf21b('0x12')]);return _0x5c3f50(_0x34c2d3[_0xf21b('0x10')][_0xf21b('0x12')]);}else{logger[_0xf21b('0xd')](_0xf21b('0x13'),_0x334315,_0xf21b('0xe'));_0x5c3f50(_0x34c2d3['result'][_0xf21b('0x12')]);}})[_0xf21b('0x14')](function(_0x161fd8){logger[_0xf21b('0x10')](_0xf21b('0x13'),_0x334315,_0x161fd8);_0x123ce5(_0x161fd8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6cb95ab..2bd80f1 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 _0x9326=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','update','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x3cf477,_0x29cff1){var _0x1ab931=function(_0x3b61f4){while(--_0x3b61f4){_0x3cf477['push'](_0x3cf477['shift']());}};_0x1ab931(++_0x29cff1);}(_0x9326,0x1b0));var _0x6932=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x9326[_0x6eb833];return _0xdfc38c;};'use strict';var multer=require(_0x6932('0x0'));var util=require(_0x6932('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6932('0x2'));var router=express[_0x6932('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6932('0x4'));var interaction=require(_0x6932('0x5'));var config=require(_0x6932('0x6'));var controller=require(_0x6932('0x7'));router[_0x6932('0x8')]('/',auth[_0x6932('0x9')](),controller[_0x6932('0xa')]);router[_0x6932('0x8')](_0x6932('0xb'),auth[_0x6932('0x9')](),controller['show']);router[_0x6932('0x8')](_0x6932('0xc'),auth[_0x6932('0x9')](),controller[_0x6932('0xd')]);router[_0x6932('0xe')]('/',auth[_0x6932('0x9')](),controller[_0x6932('0xf')]);router['put'](_0x6932('0xb'),auth[_0x6932('0x9')](),controller[_0x6932('0x10')]);router['delete'](_0x6932('0xb'),auth[_0x6932('0x9')](),controller[_0x6932('0x11')]);module[_0x6932('0x12')]=router; \ No newline at end of file +var _0x02e5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','show','download','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x98e242,_0x1d25a0){var _0x592809=function(_0xebab3a){while(--_0xebab3a){_0x98e242['push'](_0x98e242['shift']());}};_0x592809(++_0x1d25a0);}(_0x02e5,0xe3));var _0x502e=function(_0x5999f3,_0x2cd0bc){_0x5999f3=_0x5999f3-0x0;var _0x341f51=_0x02e5[_0x5999f3];return _0x341f51;};'use strict';var multer=require(_0x502e('0x0'));var util=require(_0x502e('0x1'));var path=require('path');var timeout=require(_0x502e('0x2'));var express=require(_0x502e('0x3'));var router=express[_0x502e('0x4')]();var fs_extra=require(_0x502e('0x5'));var auth=require(_0x502e('0x6'));var interaction=require(_0x502e('0x7'));var config=require(_0x502e('0x8'));var controller=require(_0x502e('0x9'));router[_0x502e('0xa')]('/',auth[_0x502e('0xb')](),controller['index']);router[_0x502e('0xa')]('/:id',auth[_0x502e('0xb')](),controller[_0x502e('0xc')]);router[_0x502e('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x502e('0xd')]);router[_0x502e('0xe')]('/',auth['isAuthenticated'](),controller[_0x502e('0xf')]);router[_0x502e('0x10')](_0x502e('0x11'),auth[_0x502e('0xb')](),controller[_0x502e('0x12')]);router[_0x502e('0x13')](_0x502e('0x11'),auth[_0x502e('0xb')](),controller[_0x502e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index e3a892d..956b06d 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 _0xd93e=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER','STRING','BLOB'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xd93e,0x73));var _0xed93=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd93e[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xed93('0x0'));module[_0xed93('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x53ec4b){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xed93('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xed93('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xed93('0x4')](_0xed93('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xed93('0x6')](_0xed93('0x7'))}}; \ No newline at end of file +var _0x9269=['VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports'];(function(_0x1e1800,_0x481d01){var _0x11dcea=function(_0x2d0436){while(--_0x2d0436){_0x1e1800['push'](_0x1e1800['shift']());}};_0x11dcea(++_0x481d01);}(_0x9269,0x1c9));var _0x9926=function(_0x40750d,_0x593094){_0x40750d=_0x40750d-0x0;var _0x42d026=_0x9269[_0x40750d];return _0x42d026;};'use strict';var Sequelize=require(_0x9926('0x0'));module[_0x9926('0x1')]={'name':{'type':Sequelize[_0x9926('0x2')],'get':function(_0x32cfc0){return this[_0x9926('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x9926('0x5')](_0x9926('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'stamp':{'type':_0x9926('0x7'),'defaultValue':Sequelize[_0x9926('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f8abea7..e8b9cc9 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 _0x9039=['msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','download','recording'];(function(_0x5155fd,_0xaa956f){var _0x1bf312=function(_0x1e8a0e){while(--_0x1e8a0e){_0x5155fd['push'](_0x5155fd['shift']());}};_0x1bf312(++_0xaa956f);}(_0x9039,0x1b0));var _0x9903=function(_0x36a101,_0xbc546a){_0x36a101=_0x36a101-0x0;var _0x413fca=_0x9039[_0x36a101];return _0x413fca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9903('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9903('0x1'));var rp=require('request-promise');var moment=require(_0x9903('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9903('0x3'));var util=require(_0x9903('0x4'));var path=require(_0x9903('0x5'));var sox=require(_0x9903('0x6'));var csv=require(_0x9903('0x7'));var ejs=require(_0x9903('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9903('0x9'));var squel=require(_0x9903('0xa'));var crypto=require(_0x9903('0xb'));var jsforce=require(_0x9903('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9903('0x7'));var querystring=require('querystring');var Papa=require(_0x9903('0xd'));var Redis=require(_0x9903('0xe'));var authService=require(_0x9903('0xf'));var qs=require(_0x9903('0x10'));var as=require(_0x9903('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9903('0x12'))(_0x9903('0x13'));var utils=require('../../config/utils');var config=require(_0x9903('0x14'));var licenseUtil=require(_0x9903('0x15'));var db=require(_0x9903('0x16'))['db'];function respondWithStatusCode(_0x282a8a,_0x4a8fb8){_0x4a8fb8=_0x4a8fb8||0xcc;return function(_0x317721){if(_0x317721){return _0x282a8a[_0x9903('0x17')](_0x4a8fb8);}return _0x282a8a[_0x9903('0x18')](_0x4a8fb8)['end']();};}function respondWithResult(_0x56cf14,_0x229a9d){_0x229a9d=_0x229a9d||0xc8;return function(_0x557be8){if(_0x557be8){return _0x56cf14['status'](_0x229a9d)[_0x9903('0x19')](_0x557be8);}};}function respondWithFilteredResult(_0x2ee115,_0x4906ac){return function(_0x332f13){if(_0x332f13){var _0x387191=typeof _0x4906ac[_0x9903('0x1a')]==='undefined'&&typeof _0x4906ac[_0x9903('0x1b')]===_0x9903('0x1c');var _0x4c7cd0=_0x332f13['count'];var _0x58f652=_0x387191?0x0:_0x4906ac[_0x9903('0x1a')];var _0x5a7ee5=_0x387191?_0x332f13['count']:_0x4906ac['offset']+_0x4906ac[_0x9903('0x1b')];var _0x35548c;if(_0x5a7ee5>=_0x4c7cd0){_0x5a7ee5=_0x4c7cd0;_0x35548c=0xc8;}else{_0x35548c=0xce;}_0x2ee115[_0x9903('0x18')](_0x35548c);return _0x2ee115[_0x9903('0x1d')](_0x9903('0x1e'),_0x58f652+'-'+_0x5a7ee5+'/'+_0x4c7cd0)[_0x9903('0x19')](_0x332f13);}return null;};}function patchUpdates(_0x1ea855){return function(_0x315b4a){try{jsonpatch[_0x9903('0x1f')](_0x315b4a,_0x1ea855,!![]);}catch(_0x202679){return BPromise[_0x9903('0x20')](_0x202679);}return _0x315b4a[_0x9903('0x21')]();};}function saveUpdates(_0x46d02a,_0x42ab82){return function(_0xa6467c){if(_0xa6467c){return _0xa6467c[_0x9903('0x22')](_0x46d02a)['then'](function(_0x5e9b88){return _0x5e9b88;});}return null;};}function removeEntity(_0x20e705,_0x5196ab){return function(_0x511612){if(_0x511612){return _0x511612[_0x9903('0x23')]()['then'](function(){_0x20e705[_0x9903('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b547,_0x1edb0c){return function(_0x2051cf){if(!_0x2051cf){_0x40b547[_0x9903('0x17')](0x194);}return _0x2051cf;};}function handleError(_0x2061d9,_0x29b72d){_0x29b72d=_0x29b72d||0x1f4;return function(_0x548e2c){logger[_0x9903('0x24')](_0x548e2c[_0x9903('0x25')]);if(_0x548e2c['name']){delete _0x548e2c[_0x9903('0x26')];}_0x2061d9[_0x9903('0x18')](_0x29b72d)[_0x9903('0x27')](_0x548e2c);};}exports[_0x9903('0x28')]=function(_0x343b54,_0x533e20){var _0x43163d={},_0x2948e8={},_0x45799c={'count':0x0,'rows':[]};var _0x122709=_[_0x9903('0x29')](db[_0x9903('0x2a')][_0x9903('0x2b')],function(_0x43a76c){return{'name':_0x43a76c[_0x9903('0x2c')],'type':_0x43a76c[_0x9903('0x2d')][_0x9903('0x2e')]};});_0x2948e8['model']=_['differenceBy'](_[_0x9903('0x29')](_0x122709,_0x9903('0x26')),[_0x9903('0x26')]);_0x2948e8[_0x9903('0x2f')]=_[_0x9903('0x30')](_0x343b54[_0x9903('0x2f')]);_0x2948e8[_0x9903('0x31')]=_[_0x9903('0x32')](_0x2948e8[_0x9903('0x33')],_0x2948e8['query']);_0x43163d['attributes']=_[_0x9903('0x32')](_0x2948e8[_0x9903('0x33')],qs[_0x9903('0x34')](_0x343b54[_0x9903('0x2f')]['fields']));_0x43163d[_0x9903('0x35')]=_0x43163d['attributes'][_0x9903('0x36')]?_0x43163d['attributes']:_0x2948e8[_0x9903('0x33')];if(!_0x343b54[_0x9903('0x2f')][_0x9903('0x37')](_0x9903('0x38'))){_0x43163d[_0x9903('0x1b')]=qs[_0x9903('0x1b')](_0x343b54[_0x9903('0x2f')][_0x9903('0x1b')]);_0x43163d[_0x9903('0x1a')]=qs[_0x9903('0x1a')](_0x343b54[_0x9903('0x2f')]['offset']);}_0x43163d[_0x9903('0x39')]=qs['sort'](_0x343b54[_0x9903('0x2f')][_0x9903('0x3a')]);_0x43163d[_0x9903('0x3b')]=qs[_0x9903('0x31')](_[_0x9903('0x3c')](_0x343b54[_0x9903('0x2f')],_0x2948e8[_0x9903('0x31')]),_0x122709);if(_0x343b54[_0x9903('0x2f')][_0x9903('0x3d')]){_0x43163d[_0x9903('0x3b')]=_[_0x9903('0x3e')](_0x43163d['where'],{'$or':_[_0x9903('0x29')](_0x122709,function(_0xf31e00){if(_0xf31e00[_0x9903('0x2d')]!=='VIRTUAL'){var _0x270f28={};_0x270f28[_0xf31e00['name']]={'$like':'%'+_0x343b54[_0x9903('0x2f')]['filter']+'%'};return _0x270f28;}})});}_0x43163d=_[_0x9903('0x3e')]({},_0x43163d,_0x343b54[_0x9903('0x3f')]);var _0x347eff={'where':_0x43163d['where']};return db['VoiceMailMessage'][_0x9903('0x40')](_0x347eff)[_0x9903('0x41')](function(_0x27b337){_0x45799c[_0x9903('0x40')]=_0x27b337;if(_0x343b54[_0x9903('0x2f')][_0x9903('0x42')]){_0x43163d[_0x9903('0x43')]=[{'all':!![]}];}return db[_0x9903('0x2a')][_0x9903('0x44')](_0x43163d);})['then'](function(_0x395ab7){_0x45799c[_0x9903('0x45')]=_0x395ab7;return _0x45799c;})['then'](respondWithFilteredResult(_0x533e20,_0x43163d))[_0x9903('0x46')](handleError(_0x533e20,null));};exports[_0x9903('0x47')]=function(_0x51c589,_0x17ff1f){var _0x521c0b={'raw':!![],'where':{'id':_0x51c589[_0x9903('0x48')]['id']}},_0x4ce491={};_0x4ce491[_0x9903('0x33')]=_[_0x9903('0x30')](db[_0x9903('0x2a')][_0x9903('0x2b')]);_0x4ce491[_0x9903('0x2f')]=_['keys'](_0x51c589[_0x9903('0x2f')]);_0x4ce491[_0x9903('0x31')]=_['intersection'](_0x4ce491[_0x9903('0x33')],_0x4ce491['query']);_0x521c0b[_0x9903('0x35')]=_[_0x9903('0x32')](_0x4ce491[_0x9903('0x33')],qs[_0x9903('0x34')](_0x51c589[_0x9903('0x2f')]['fields']));_0x521c0b['attributes']=_0x521c0b[_0x9903('0x35')][_0x9903('0x36')]?_0x521c0b[_0x9903('0x35')]:_0x4ce491['model'];if(_0x51c589[_0x9903('0x2f')][_0x9903('0x42')]){_0x521c0b['include']=[{'all':!![]}];}_0x521c0b=_[_0x9903('0x3e')]({},_0x521c0b,_0x51c589[_0x9903('0x3f')]);return db[_0x9903('0x2a')]['find'](_0x521c0b)[_0x9903('0x41')](handleEntityNotFound(_0x17ff1f,null))[_0x9903('0x41')](respondWithResult(_0x17ff1f,null))['catch'](handleError(_0x17ff1f,null));};exports[_0x9903('0x49')]=function(_0x3f5b4e,_0x7ed8fd){return db[_0x9903('0x2a')][_0x9903('0x49')](_0x3f5b4e[_0x9903('0x4a')],{})[_0x9903('0x41')](respondWithResult(_0x7ed8fd,0xc9))['catch'](handleError(_0x7ed8fd,null));};exports['update']=function(_0xe86fd,_0x57f76e){if(_0xe86fd['body']['id']){delete _0xe86fd[_0x9903('0x4a')]['id'];}return db[_0x9903('0x2a')]['find']({'where':{'id':_0xe86fd[_0x9903('0x48')]['id']}})[_0x9903('0x41')](handleEntityNotFound(_0x57f76e,null))['then'](saveUpdates(_0xe86fd['body'],null))[_0x9903('0x41')](respondWithResult(_0x57f76e,null))['catch'](handleError(_0x57f76e,null));};exports['destroy']=function(_0x3d5f49,_0x482add){return db[_0x9903('0x2a')][_0x9903('0x4b')]({'where':{'id':_0x3d5f49[_0x9903('0x48')]['id']}})[_0x9903('0x41')](handleEntityNotFound(_0x482add,null))['then'](removeEntity(_0x482add,null))['catch'](handleError(_0x482add,null));};exports[_0x9903('0x4c')]=function(_0x37fd69,_0x18a2c4,_0xaae53a){return db[_0x9903('0x2a')][_0x9903('0x4b')]({'where':{'id':_0x37fd69[_0x9903('0x48')]['id']},'attributes':['id',_0x9903('0x4d'),_0x9903('0x4e')]})[_0x9903('0x41')](handleEntityNotFound(_0x18a2c4,null))['then'](function(_0x380964){if(_0x380964){if(!_0x380964[_0x9903('0x4d')]){throw new db[(_0x9903('0x4f'))][(_0x9903('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x41cefd={'Content-Type':_0x9903('0x51'),'Content-Disposition':_0x9903('0x52')};if(_0x380964[_0x9903('0x4e')]){_0x41cefd[_0x9903('0x53')]=_0x9903('0x54')+_0x380964[_0x9903('0x4e')]+'.wav\x22';}_0x18a2c4['set'](_0x41cefd);return _0x18a2c4['send'](new Buffer(_0x380964[_0x9903('0x4d')]));}})[_0x9903('0x46')](handleError(_0x18a2c4,null));}; \ No newline at end of file +var _0x5222=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','show','params','keys','options','find','create','body','catch','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x355c8b,_0x51ecf6){var _0x1bd1ac=function(_0x24e7f2){while(--_0x24e7f2){_0x355c8b['push'](_0x355c8b['shift']());}};_0x1bd1ac(++_0x51ecf6);}(_0x5222,0x14c));var _0x2522=function(_0x641f18,_0x2919e8){_0x641f18=_0x641f18-0x0;var _0x16eefe=_0x5222[_0x641f18];return _0x16eefe;};'use strict';var emlformat=require(_0x2522('0x0'));var rimraf=require(_0x2522('0x1'));var zipdir=require(_0x2522('0x2'));var jsonpatch=require(_0x2522('0x3'));var rp=require(_0x2522('0x4'));var moment=require(_0x2522('0x5'));var BPromise=require(_0x2522('0x6'));var Mustache=require(_0x2522('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2522('0x8'));var csv=require(_0x2522('0x9'));var ejs=require(_0x2522('0xa'));var fs=require('fs');var fs_extra=require(_0x2522('0xb'));var _=require(_0x2522('0xc'));var squel=require(_0x2522('0xd'));var crypto=require(_0x2522('0xe'));var jsforce=require(_0x2522('0xf'));var deskjs=require(_0x2522('0x10'));var toCsv=require(_0x2522('0x9'));var querystring=require(_0x2522('0x11'));var Papa=require(_0x2522('0x12'));var Redis=require(_0x2522('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2522('0x14'));var hardwareService=require(_0x2522('0x15'));var logger=require(_0x2522('0x16'))('api');var utils=require(_0x2522('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2522('0x18'));var db=require(_0x2522('0x19'))['db'];function respondWithStatusCode(_0xf3dbf8,_0x528b7c){_0x528b7c=_0x528b7c||0xcc;return function(_0x5cf5bf){if(_0x5cf5bf){return _0xf3dbf8[_0x2522('0x1a')](_0x528b7c);}return _0xf3dbf8[_0x2522('0x1b')](_0x528b7c)[_0x2522('0x1c')]();};}function respondWithResult(_0x75dd36,_0x32c0d5){_0x32c0d5=_0x32c0d5||0xc8;return function(_0x1466b1){if(_0x1466b1){return _0x75dd36[_0x2522('0x1b')](_0x32c0d5)['json'](_0x1466b1);}};}function respondWithFilteredResult(_0x548d4a,_0x4f6a87){return function(_0x1885e3){if(_0x1885e3){var _0x88fe30=typeof _0x4f6a87[_0x2522('0x1d')]===_0x2522('0x1e')&&typeof _0x4f6a87[_0x2522('0x1f')]===_0x2522('0x1e');var _0x346650=_0x1885e3[_0x2522('0x20')];var _0x3524f1=_0x88fe30?0x0:_0x4f6a87[_0x2522('0x1d')];var _0x4e35ef=_0x88fe30?_0x1885e3[_0x2522('0x20')]:_0x4f6a87['offset']+_0x4f6a87[_0x2522('0x1f')];var _0x3be932;if(_0x4e35ef>=_0x346650){_0x4e35ef=_0x346650;_0x3be932=0xc8;}else{_0x3be932=0xce;}_0x548d4a[_0x2522('0x1b')](_0x3be932);return _0x548d4a[_0x2522('0x21')](_0x2522('0x22'),_0x3524f1+'-'+_0x4e35ef+'/'+_0x346650)[_0x2522('0x23')](_0x1885e3);}return null;};}function patchUpdates(_0x36697f){return function(_0x53c0d6){try{jsonpatch['apply'](_0x53c0d6,_0x36697f,!![]);}catch(_0x190f11){return BPromise[_0x2522('0x24')](_0x190f11);}return _0x53c0d6[_0x2522('0x25')]();};}function saveUpdates(_0x10a399,_0x3a4aad){return function(_0x13d626){if(_0x13d626){return _0x13d626[_0x2522('0x26')](_0x10a399)[_0x2522('0x27')](function(_0x55f8ad){return _0x55f8ad;});}return null;};}function removeEntity(_0x323dc3,_0x386c9f){return function(_0x327281){if(_0x327281){return _0x327281[_0x2522('0x28')]()['then'](function(){_0x323dc3[_0x2522('0x1b')](0xcc)[_0x2522('0x1c')]();});}};}function handleEntityNotFound(_0x4f2cd1,_0x1e4deb){return function(_0x1c48ac){if(!_0x1c48ac){_0x4f2cd1['sendStatus'](0x194);}return _0x1c48ac;};}function handleError(_0x28e829,_0xf4c0d3){_0xf4c0d3=_0xf4c0d3||0x1f4;return function(_0x2669af){logger[_0x2522('0x29')](_0x2669af['stack']);if(_0x2669af[_0x2522('0x2a')]){delete _0x2669af[_0x2522('0x2a')];}_0x28e829[_0x2522('0x1b')](_0xf4c0d3)[_0x2522('0x2b')](_0x2669af);};}exports['index']=function(_0xaf0b5b,_0x25a555){var _0x50756b={},_0x1b67ef={},_0x16f944={'count':0x0,'rows':[]};var _0x5f0319=_[_0x2522('0x2c')](db[_0x2522('0x2d')][_0x2522('0x2e')],function(_0xb8c2e5){return{'name':_0xb8c2e5[_0x2522('0x2f')],'type':_0xb8c2e5[_0x2522('0x30')][_0x2522('0x31')]};});_0x1b67ef[_0x2522('0x32')]=_[_0x2522('0x33')](_[_0x2522('0x2c')](_0x5f0319,'name'),[_0x2522('0x2a')]);_0x1b67ef['query']=_['keys'](_0xaf0b5b[_0x2522('0x34')]);_0x1b67ef['filters']=_[_0x2522('0x35')](_0x1b67ef[_0x2522('0x32')],_0x1b67ef['query']);_0x50756b[_0x2522('0x36')]=_[_0x2522('0x35')](_0x1b67ef[_0x2522('0x32')],qs[_0x2522('0x37')](_0xaf0b5b[_0x2522('0x34')][_0x2522('0x37')]));_0x50756b[_0x2522('0x36')]=_0x50756b[_0x2522('0x36')][_0x2522('0x38')]?_0x50756b[_0x2522('0x36')]:_0x1b67ef[_0x2522('0x32')];if(!_0xaf0b5b[_0x2522('0x34')][_0x2522('0x39')]('nolimit')){_0x50756b[_0x2522('0x1f')]=qs[_0x2522('0x1f')](_0xaf0b5b[_0x2522('0x34')][_0x2522('0x1f')]);_0x50756b[_0x2522('0x1d')]=qs[_0x2522('0x1d')](_0xaf0b5b[_0x2522('0x34')][_0x2522('0x1d')]);}_0x50756b[_0x2522('0x3a')]=qs[_0x2522('0x3b')](_0xaf0b5b[_0x2522('0x34')][_0x2522('0x3b')]);_0x50756b[_0x2522('0x3c')]=qs[_0x2522('0x3d')](_['pick'](_0xaf0b5b[_0x2522('0x34')],_0x1b67ef[_0x2522('0x3d')]),_0x5f0319);if(_0xaf0b5b[_0x2522('0x34')][_0x2522('0x3e')]){_0x50756b[_0x2522('0x3c')]=_['merge'](_0x50756b[_0x2522('0x3c')],{'$or':_[_0x2522('0x2c')](_0x5f0319,function(_0x36c138){if(_0x36c138['type']!==_0x2522('0x3f')){var _0x58714b={};_0x58714b[_0x36c138[_0x2522('0x2a')]]={'$like':'%'+_0xaf0b5b['query'][_0x2522('0x3e')]+'%'};return _0x58714b;}})});}_0x50756b=_[_0x2522('0x40')]({},_0x50756b,_0xaf0b5b['options']);var _0x3351bd={'where':_0x50756b[_0x2522('0x3c')]};return db[_0x2522('0x2d')]['count'](_0x3351bd)['then'](function(_0x327b68){_0x16f944[_0x2522('0x20')]=_0x327b68;if(_0xaf0b5b['query'][_0x2522('0x41')]){_0x50756b[_0x2522('0x42')]=[{'all':!![]}];}return db[_0x2522('0x2d')][_0x2522('0x43')](_0x50756b);})[_0x2522('0x27')](function(_0x2fa3a4){_0x16f944['rows']=_0x2fa3a4;return _0x16f944;})[_0x2522('0x27')](respondWithFilteredResult(_0x25a555,_0x50756b))['catch'](handleError(_0x25a555,null));};exports[_0x2522('0x44')]=function(_0x5ebdc9,_0x14ad22){var _0x3b24e1={'raw':!![],'where':{'id':_0x5ebdc9[_0x2522('0x45')]['id']}},_0x5b70aa={};_0x5b70aa[_0x2522('0x32')]=_[_0x2522('0x46')](db[_0x2522('0x2d')]['rawAttributes']);_0x5b70aa[_0x2522('0x34')]=_[_0x2522('0x46')](_0x5ebdc9[_0x2522('0x34')]);_0x5b70aa['filters']=_[_0x2522('0x35')](_0x5b70aa['model'],_0x5b70aa[_0x2522('0x34')]);_0x3b24e1['attributes']=_[_0x2522('0x35')](_0x5b70aa['model'],qs[_0x2522('0x37')](_0x5ebdc9['query']['fields']));_0x3b24e1[_0x2522('0x36')]=_0x3b24e1[_0x2522('0x36')]['length']?_0x3b24e1[_0x2522('0x36')]:_0x5b70aa[_0x2522('0x32')];if(_0x5ebdc9[_0x2522('0x34')][_0x2522('0x41')]){_0x3b24e1['include']=[{'all':!![]}];}_0x3b24e1=_[_0x2522('0x40')]({},_0x3b24e1,_0x5ebdc9[_0x2522('0x47')]);return db[_0x2522('0x2d')][_0x2522('0x48')](_0x3b24e1)['then'](handleEntityNotFound(_0x14ad22,null))[_0x2522('0x27')](respondWithResult(_0x14ad22,null))['catch'](handleError(_0x14ad22,null));};exports[_0x2522('0x49')]=function(_0x59c37c,_0x3fcc71){return db[_0x2522('0x2d')][_0x2522('0x49')](_0x59c37c[_0x2522('0x4a')],{})[_0x2522('0x27')](respondWithResult(_0x3fcc71,0xc9))[_0x2522('0x4b')](handleError(_0x3fcc71,null));};exports['update']=function(_0x27c990,_0x383953){if(_0x27c990[_0x2522('0x4a')]['id']){delete _0x27c990['body']['id'];}return db[_0x2522('0x2d')][_0x2522('0x48')]({'where':{'id':_0x27c990['params']['id']}})[_0x2522('0x27')](handleEntityNotFound(_0x383953,null))[_0x2522('0x27')](saveUpdates(_0x27c990[_0x2522('0x4a')],null))[_0x2522('0x27')](respondWithResult(_0x383953,null))['catch'](handleError(_0x383953,null));};exports[_0x2522('0x28')]=function(_0x90948b,_0x232359){return db[_0x2522('0x2d')]['find']({'where':{'id':_0x90948b[_0x2522('0x45')]['id']}})[_0x2522('0x27')](handleEntityNotFound(_0x232359,null))[_0x2522('0x27')](removeEntity(_0x232359,null))['catch'](handleError(_0x232359,null));};exports[_0x2522('0x4c')]=function(_0x40420c,_0x5c1e06,_0x8b2e5b){return db['VoiceMailMessage'][_0x2522('0x48')]({'where':{'id':_0x40420c[_0x2522('0x45')]['id']},'attributes':['id',_0x2522('0x4d'),_0x2522('0x4e')]})['then'](handleEntityNotFound(_0x5c1e06,null))[_0x2522('0x27')](function(_0x7b126d){if(_0x7b126d){if(!_0x7b126d['recording']){throw new db[(_0x2522('0x4f'))]['ValidationError'](_0x2522('0x50'));}var _0xdfc977={'Content-Type':_0x2522('0x51'),'Content-Disposition':_0x2522('0x52')};if(_0x7b126d[_0x2522('0x4e')]){_0xdfc977[_0x2522('0x53')]=_0x2522('0x54')+_0x7b126d[_0x2522('0x4e')]+'.wav\x22';}_0x5c1e06['set'](_0xdfc977);return _0x5c1e06[_0x2522('0x2b')](new Buffer(_0x7b126d[_0x2522('0x4d')]));}})[_0x2522('0x4b')](handleError(_0x5c1e06,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 772a4c9..483f1b8 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 _0xab60=['request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird'];(function(_0x43f559,_0xf5090c){var _0x1f71b0=function(_0x350491){while(--_0x350491){_0x43f559['push'](_0x43f559['shift']());}};_0x1f71b0(++_0xf5090c);}(_0xab60,0x97));var _0x0ab6=function(_0x27829e,_0x3aed0d){_0x27829e=_0x27829e-0x0;var _0x4b05ee=_0xab60[_0x27829e];return _0x4b05ee;};'use strict';var _=require('lodash');var util=require(_0x0ab6('0x0'));var logger=require(_0x0ab6('0x1'))(_0x0ab6('0x2'));var moment=require(_0x0ab6('0x3'));var BPromise=require(_0x0ab6('0x4'));var rp=require(_0x0ab6('0x5'));var fs=require('fs');var path=require(_0x0ab6('0x6'));var rimraf=require('rimraf');var config=require(_0x0ab6('0x7'));var attributes=require(_0x0ab6('0x8'));module[_0x0ab6('0x9')]=function(_0x482c7b,_0x141f1b){return _0x482c7b['define'](_0x0ab6('0xa'),attributes,{'tableName':_0x0ab6('0xb'),'paranoid':![],'indexes':[{'name':_0x0ab6('0xc'),'fields':[_0x0ab6('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xda2d=['dir','lodash','util','../../config/logger','api','bluebird','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages'];(function(_0x231aa1,_0x261fb8){var _0x1de20b=function(_0x528fde){while(--_0x528fde){_0x231aa1['push'](_0x231aa1['shift']());}};_0x1de20b(++_0x261fb8);}(_0xda2d,0x196));var _0xdda2=function(_0x192d85,_0x3fe395){_0x192d85=_0x192d85-0x0;var _0x56f550=_0xda2d[_0x192d85];return _0x56f550;};'use strict';var _=require(_0xdda2('0x0'));var util=require(_0xdda2('0x1'));var logger=require(_0xdda2('0x2'))(_0xdda2('0x3'));var moment=require('moment');var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdda2('0x5'));module['exports']=function(_0x502271,_0x2d6124){return _0x502271['define'](_0xdda2('0x6'),attributes,{'tableName':_0xdda2('0x7'),'paranoid':![],'indexes':[{'name':_0xdda2('0x8'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 678bf03..1679e6e 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 _0x2613=['../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5bc192,_0x210573){var _0x3f0553=function(_0x420ace){while(--_0x420ace){_0x5bc192['push'](_0x5bc192['shift']());}};_0x3f0553(++_0x210573);}(_0x2613,0x151));var _0x3261=function(_0x93937f,_0x310774){_0x93937f=_0x93937f-0x0;var _0x24cc87=_0x2613[_0x93937f];return _0x24cc87;};'use strict';var _=require(_0x3261('0x0'));var util=require(_0x3261('0x1'));var moment=require('moment');var BPromise=require(_0x3261('0x2'));var rs=require(_0x3261('0x3'));var fs=require('fs');var Redis=require(_0x3261('0x4'));var db=require(_0x3261('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3261('0x6'));var config=require(_0x3261('0x7'));var jayson=require(_0x3261('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb1a0,_0x5d2b10,_0x14bc70){return new BPromise(function(_0x27d020,_0xe1b31){return client[_0x3261('0x9')](_0x5bb1a0,_0x14bc70)['then'](function(_0x2988a5){logger[_0x3261('0xa')](_0x3261('0xb'),_0x5d2b10,_0x3261('0xc'));logger[_0x3261('0xd')](_0x3261('0xe'),_0x5d2b10,'request\x20sent',JSON['stringify'](_0x2988a5));if(_0x2988a5[_0x3261('0xf')]){if(_0x2988a5[_0x3261('0xf')]['code']===0x1f4){logger[_0x3261('0xf')](_0x3261('0xb'),_0x5d2b10,_0x2988a5[_0x3261('0xf')][_0x3261('0x10')]);return _0xe1b31(_0x2988a5[_0x3261('0xf')][_0x3261('0x10')]);}logger['error'](_0x3261('0xb'),_0x5d2b10,_0x2988a5[_0x3261('0xf')][_0x3261('0x10')]);return _0x27d020(_0x2988a5[_0x3261('0xf')][_0x3261('0x10')]);}else{logger[_0x3261('0xa')](_0x3261('0xb'),_0x5d2b10,'request\x20sent');_0x27d020(_0x2988a5[_0x3261('0x11')][_0x3261('0x10')]);}})['catch'](function(_0xa7bf62){logger[_0x3261('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x5d2b10,_0xa7bf62);_0xe1b31(_0xa7bf62);});});} \ No newline at end of file +var _0x8172=['client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x26e376,_0x580262){var _0x69a251=function(_0x598451){while(--_0x598451){_0x26e376['push'](_0x26e376['shift']());}};_0x69a251(++_0x580262);}(_0x8172,0xb4));var _0x2817=function(_0x2d9db2,_0x2a2f35){_0x2d9db2=_0x2d9db2-0x0;var _0x20ac01=_0x8172[_0x2d9db2];return _0x20ac01;};'use strict';var _=require(_0x2817('0x0'));var util=require('util');var moment=require(_0x2817('0x1'));var BPromise=require(_0x2817('0x2'));var rs=require(_0x2817('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2817('0x4'))['db'];var utils=require(_0x2817('0x5'));var logger=require(_0x2817('0x6'))('rpc');var config=require(_0x2817('0x7'));var jayson=require(_0x2817('0x8'));var client=jayson[_0x2817('0x9')][_0x2817('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1233ef,_0x2a2593,_0x5e114a){return new BPromise(function(_0xb0a87a,_0x2db4ed){return client[_0x2817('0xb')](_0x1233ef,_0x5e114a)[_0x2817('0xc')](function(_0x38b896){logger[_0x2817('0xd')](_0x2817('0xe'),_0x2a2593,_0x2817('0xf'));logger[_0x2817('0x10')](_0x2817('0x11'),_0x2a2593,'request\x20sent',JSON[_0x2817('0x12')](_0x38b896));if(_0x38b896['error']){if(_0x38b896[_0x2817('0x13')]['code']===0x1f4){logger[_0x2817('0x13')](_0x2817('0xe'),_0x2a2593,_0x38b896['error']['message']);return _0x2db4ed(_0x38b896['error'][_0x2817('0x14')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2a2593,_0x38b896['error']['message']);return _0xb0a87a(_0x38b896[_0x2817('0x13')][_0x2817('0x14')]);}else{logger[_0x2817('0xd')](_0x2817('0xe'),_0x2a2593,_0x2817('0xf'));_0xb0a87a(_0x38b896['result']['message']);}})['catch'](function(_0x5b221b){logger[_0x2817('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x2a2593,_0x5b221b);_0x2db4ed(_0x5b221b);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index d2a87c0..b6f5970 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 _0xd903=['destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getSounds','create','post','addSound','put','update','delete'];(function(_0x2c535b,_0x30fd8d){var _0x59561b=function(_0xca0d35){while(--_0xca0d35){_0x2c535b['push'](_0x2c535b['shift']());}};_0x59561b(++_0x30fd8d);}(_0xd903,0x88));var _0x3d90=function(_0x29bfce,_0x5acc66){_0x29bfce=_0x29bfce-0x0;var _0x393d98=_0xd903[_0x29bfce];return _0x393d98;};'use strict';var multer=require('multer');var util=require(_0x3d90('0x0'));var path=require(_0x3d90('0x1'));var timeout=require(_0x3d90('0x2'));var express=require(_0x3d90('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d90('0x4'));var interaction=require(_0x3d90('0x5'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x3d90('0x6')]('/',auth[_0x3d90('0x7')](),controller[_0x3d90('0x8')]);router[_0x3d90('0x6')](_0x3d90('0x9'),auth[_0x3d90('0x7')](),controller[_0x3d90('0xa')]);router[_0x3d90('0x6')]('/:id/sounds',auth[_0x3d90('0x7')](),controller[_0x3d90('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3d90('0xc')]);router[_0x3d90('0xd')]('/:id/sounds',auth[_0x3d90('0x7')](),controller[_0x3d90('0xe')]);router[_0x3d90('0xf')](_0x3d90('0x9'),auth['isAuthenticated'](),controller[_0x3d90('0x10')]);router[_0x3d90('0x11')](_0x3d90('0x9'),auth['isAuthenticated'](),controller[_0x3d90('0x12')]);router[_0x3d90('0x11')](_0x3d90('0x13'),auth[_0x3d90('0x7')](),controller[_0x3d90('0x14')]);module[_0x3d90('0x15')]=router; \ No newline at end of file +var _0x7168=['get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','update','delete','/:id/sounds/:id2','multer','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x16afe5,_0x129d87){var _0x123fff=function(_0x5db4d6){while(--_0x5db4d6){_0x16afe5['push'](_0x16afe5['shift']());}};_0x123fff(++_0x129d87);}(_0x7168,0x199));var _0x8716=function(_0x4c1cde,_0x553b85){_0x4c1cde=_0x4c1cde-0x0;var _0x392202=_0x7168[_0x4c1cde];return _0x392202;};'use strict';var multer=require(_0x8716('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8716('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x8716('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8716('0x3'));var controller=require(_0x8716('0x4'));router[_0x8716('0x5')]('/',auth[_0x8716('0x6')](),controller[_0x8716('0x7')]);router[_0x8716('0x5')](_0x8716('0x8'),auth[_0x8716('0x6')](),controller[_0x8716('0x9')]);router[_0x8716('0x5')](_0x8716('0xa'),auth['isAuthenticated'](),controller[_0x8716('0xb')]);router[_0x8716('0xc')]('/',auth[_0x8716('0x6')](),controller[_0x8716('0xd')]);router['post'](_0x8716('0xa'),auth[_0x8716('0x6')](),controller[_0x8716('0xe')]);router['put'](_0x8716('0x8'),auth['isAuthenticated'](),controller[_0x8716('0xf')]);router[_0x8716('0x10')]('/:id',auth[_0x8716('0x6')](),controller['destroy']);router['delete'](_0x8716('0x11'),auth[_0x8716('0x6')](),controller['removeSound']);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 37f9801..0107d3c 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 _0xa334=['mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','mp3nb','quietmp3'];(function(_0x1b4ec2,_0x55ba64){var _0x543068=function(_0x363cb4){while(--_0x363cb4){_0x1b4ec2['push'](_0x1b4ec2['shift']());}};_0x543068(++_0x55ba64);}(_0xa334,0x109));var _0x4a33=function(_0x384b4c,_0x2ca893){_0x384b4c=_0x384b4c-0x0;var _0x384a39=_0xa334[_0x384b4c];return _0x384a39;};'use strict';var Sequelize=require(_0x4a33('0x0'));module[_0x4a33('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4a33('0x2')},'mode':{'type':Sequelize[_0x4a33('0x3')](_0x4a33('0x4'),_0x4a33('0x5'),_0x4a33('0x6'),'quietmp3nb',_0x4a33('0x7'),_0x4a33('0x8')),'allowNull':!![],'defaultValue':_0x4a33('0x5')},'directory':{'type':Sequelize[_0x4a33('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x4a33('0x9')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4a33('0xa')},'format':{'type':Sequelize[_0x4a33('0x9')],'allowNull':!![]},'stamp':{'type':_0x4a33('0xb')},'defaultEntry':{'type':Sequelize[_0x4a33('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcc7c=['custom','files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','name','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc7c,0x81));var _0xccc7=function(_0x448c22,_0x4bd296){_0x448c22=_0x448c22-0x0;var _0x57d486=_0xcc7c[_0x448c22];return _0x57d486;};'use strict';var Sequelize=require(_0xccc7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xccc7('0x1')},'mode':{'type':Sequelize[_0xccc7('0x2')](_0xccc7('0x3'),_0xccc7('0x4'),'mp3nb',_0xccc7('0x5'),_0xccc7('0x6'),_0xccc7('0x7')),'allowNull':!![],'defaultValue':_0xccc7('0x4')},'directory':{'type':Sequelize[_0xccc7('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xccc7('0x8')],'allowNull':!![],'defaultValue':_0xccc7('0x9')},'format':{'type':Sequelize[_0xccc7('0x8')],'allowNull':!![]},'stamp':{'type':_0xccc7('0xa')},'defaultEntry':{'type':Sequelize[_0xccc7('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 c0e952c..c119bf7 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 _0xf31f=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','filter','hasOwnProperty','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','update','destroy','then','get','MusicOnHolds','UserProfileResource','sendStatus','stack','name','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','body','find','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0xa95f7f,_0x1e8bba){var _0x40bda0=function(_0x56ed58){while(--_0x56ed58){_0xa95f7f['push'](_0xa95f7f['shift']());}};_0x40bda0(++_0x1e8bba);}(_0xf31f,0x1d9));var _0xff31=function(_0x360e4c,_0x365a8c){_0x360e4c=_0x360e4c-0x0;var _0x5a5fc4=_0xf31f[_0x360e4c];return _0x5a5fc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff31('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff31('0x1'));var rp=require(_0xff31('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff31('0x3'));var util=require(_0xff31('0x4'));var path=require(_0xff31('0x5'));var sox=require(_0xff31('0x6'));var csv=require(_0xff31('0x7'));var ejs=require(_0xff31('0x8'));var fs=require('fs');var fs_extra=require(_0xff31('0x9'));var _=require(_0xff31('0xa'));var squel=require(_0xff31('0xb'));var crypto=require(_0xff31('0xc'));var jsforce=require(_0xff31('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xff31('0x7'));var querystring=require('querystring');var Papa=require(_0xff31('0xe'));var Redis=require(_0xff31('0xf'));var authService=require(_0xff31('0x10'));var qs=require(_0xff31('0x11'));var as=require(_0xff31('0x12'));var hardwareService=require(_0xff31('0x13'));var logger=require('../../config/logger')(_0xff31('0x14'));var utils=require(_0xff31('0x15'));var config=require(_0xff31('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xff31('0x17'))['db'];function respondWithStatusCode(_0x27ef96,_0x10777e){_0x10777e=_0x10777e||0xcc;return function(_0x25cdc4){if(_0x25cdc4){return _0x27ef96['sendStatus'](_0x10777e);}return _0x27ef96[_0xff31('0x18')](_0x10777e)[_0xff31('0x19')]();};}function respondWithResult(_0x3db5ea,_0x5cd7b8){_0x5cd7b8=_0x5cd7b8||0xc8;return function(_0x1c4374){if(_0x1c4374){return _0x3db5ea[_0xff31('0x18')](_0x5cd7b8)['json'](_0x1c4374);}};}function respondWithFilteredResult(_0x3d7c6f,_0x397964){return function(_0x4b6198){if(_0x4b6198){var _0x4bef45=typeof _0x397964['offset']==='undefined'&&typeof _0x397964[_0xff31('0x1a')]===_0xff31('0x1b');var _0x1a6ad5=_0x4b6198[_0xff31('0x1c')];var _0x1d0584=_0x4bef45?0x0:_0x397964['offset'];var _0xc5defa=_0x4bef45?_0x4b6198[_0xff31('0x1c')]:_0x397964[_0xff31('0x1d')]+_0x397964[_0xff31('0x1a')];var _0x22da53;if(_0xc5defa>=_0x1a6ad5){_0xc5defa=_0x1a6ad5;_0x22da53=0xc8;}else{_0x22da53=0xce;}_0x3d7c6f[_0xff31('0x18')](_0x22da53);return _0x3d7c6f[_0xff31('0x1e')](_0xff31('0x1f'),_0x1d0584+'-'+_0xc5defa+'/'+_0x1a6ad5)[_0xff31('0x20')](_0x4b6198);}return null;};}function patchUpdates(_0x548385){return function(_0x1b299e){try{jsonpatch[_0xff31('0x21')](_0x1b299e,_0x548385,!![]);}catch(_0x42f4b9){return BPromise['reject'](_0x42f4b9);}return _0x1b299e['save']();};}function saveUpdates(_0x254b5a,_0x2335cd){return function(_0x191279){if(_0x191279){return _0x191279[_0xff31('0x22')](_0x254b5a)['then'](function(_0x1e4d73){return _0x1e4d73;});}return null;};}function removeEntity(_0x94772d,_0x534d84){return function(_0x375267){if(_0x375267){return _0x375267[_0xff31('0x23')]()[_0xff31('0x24')](function(){var _0x486f9a=_0x375267[_0xff31('0x25')]({'plain':!![]});var _0x18bca2=_0xff31('0x26');return db[_0xff31('0x27')][_0xff31('0x23')]({'where':{'type':_0x18bca2,'resourceId':_0x486f9a['id']}})['then'](function(){return _0x375267;});})['then'](function(){_0x94772d['status'](0xcc)[_0xff31('0x19')]();});}};}function handleEntityNotFound(_0x5e8ca2,_0x3d0dab){return function(_0x8b038a){if(!_0x8b038a){_0x5e8ca2[_0xff31('0x28')](0x194);}return _0x8b038a;};}function handleError(_0x42a495,_0x488574){_0x488574=_0x488574||0x1f4;return function(_0x469ece){logger['error'](_0x469ece[_0xff31('0x29')]);if(_0x469ece[_0xff31('0x2a')]){delete _0x469ece[_0xff31('0x2a')];}_0x42a495[_0xff31('0x18')](_0x488574)['send'](_0x469ece);};}exports['index']=function(_0x4a98f2,_0x42fc19){var _0x41cb04={},_0x41b3e8={},_0x148122={'count':0x0,'rows':[]};var _0x2ed64f=_[_0xff31('0x2b')](db[_0xff31('0x2c')][_0xff31('0x2d')],function(_0x3cd75c){return{'name':_0x3cd75c[_0xff31('0x2e')],'type':_0x3cd75c['type'][_0xff31('0x2f')]};});_0x41b3e8[_0xff31('0x30')]=_[_0xff31('0x2b')](_0x2ed64f,'name');_0x41b3e8['query']=_[_0xff31('0x31')](_0x4a98f2[_0xff31('0x32')]);_0x41b3e8['filters']=_[_0xff31('0x33')](_0x41b3e8[_0xff31('0x30')],_0x41b3e8[_0xff31('0x32')]);_0x41cb04[_0xff31('0x34')]=_['intersection'](_0x41b3e8[_0xff31('0x30')],qs['fields'](_0x4a98f2['query']['fields']));_0x41cb04[_0xff31('0x34')]=_0x41cb04[_0xff31('0x34')][_0xff31('0x35')]?_0x41cb04[_0xff31('0x34')]:_0x41b3e8[_0xff31('0x30')];if(!_0x4a98f2[_0xff31('0x32')]['hasOwnProperty']('nolimit')){_0x41cb04[_0xff31('0x1a')]=qs[_0xff31('0x1a')](_0x4a98f2[_0xff31('0x32')]['limit']);_0x41cb04[_0xff31('0x1d')]=qs[_0xff31('0x1d')](_0x4a98f2[_0xff31('0x32')][_0xff31('0x1d')]);}_0x41cb04[_0xff31('0x36')]=qs[_0xff31('0x37')](_0x4a98f2[_0xff31('0x32')]['sort']);delete _0x4a98f2[_0xff31('0x32')][_0xff31('0x37')];_0x41cb04[_0xff31('0x38')]=qs[_0xff31('0x39')](_[_0xff31('0x3a')](_0x4a98f2[_0xff31('0x32')],_0x41b3e8[_0xff31('0x39')]),_0x2ed64f);if(_0x4a98f2['query']['filter']){_0x41cb04[_0xff31('0x38')]=_[_0xff31('0x3b')](_0x41cb04[_0xff31('0x38')],{'$or':_[_0xff31('0x2b')](_0x2ed64f,function(_0x4be7e1){if(_0x4be7e1['type']!==_0xff31('0x3c')){var _0x335caf={};_0x335caf[_0x4be7e1[_0xff31('0x2a')]]={'$like':'%'+_0x4a98f2['query']['filter']+'%'};return _0x335caf;}})});}_0x41cb04=_[_0xff31('0x3b')]({},_0x41cb04,_0x4a98f2[_0xff31('0x3d')]);var _0x389aea={'where':_0x41cb04[_0xff31('0x38')]};return db[_0xff31('0x2c')][_0xff31('0x1c')](_0x389aea)[_0xff31('0x24')](function(_0x383f73){_0x148122[_0xff31('0x1c')]=_0x383f73;if(_0x4a98f2[_0xff31('0x32')][_0xff31('0x3e')]){_0x41cb04[_0xff31('0x3f')]=[{'all':!![]}];}return db[_0xff31('0x2c')][_0xff31('0x40')](_0x41cb04);})[_0xff31('0x24')](function(_0x214ebf){_0x148122['rows']=_0x214ebf;return _0x148122;})[_0xff31('0x24')](respondWithFilteredResult(_0x42fc19,_0x41cb04))[_0xff31('0x41')](handleError(_0x42fc19,null));};exports[_0xff31('0x42')]=function(_0x1ea8f7,_0x58dbc9){var _0x259386={'raw':![],'where':{'id':_0x1ea8f7[_0xff31('0x43')]['id']}},_0x1686e6={};_0x1686e6[_0xff31('0x30')]=_[_0xff31('0x31')](db[_0xff31('0x2c')]['rawAttributes']);_0x1686e6['query']=_['keys'](_0x1ea8f7[_0xff31('0x32')]);_0x1686e6[_0xff31('0x39')]=_[_0xff31('0x33')](_0x1686e6[_0xff31('0x30')],_0x1686e6['query']);_0x259386['attributes']=_[_0xff31('0x33')](_0x1686e6[_0xff31('0x30')],qs[_0xff31('0x44')](_0x1ea8f7[_0xff31('0x32')]['fields']));_0x259386[_0xff31('0x34')]=_0x259386['attributes'][_0xff31('0x35')]?_0x259386[_0xff31('0x34')]:_0x1686e6['model'];if(_0x1ea8f7[_0xff31('0x32')]['includeAll']){_0x259386['include']=[{'all':!![]}];}_0x259386=_['merge']({},_0x259386,_0x1ea8f7[_0xff31('0x3d')]);return db['VoiceMusicOnHold']['find'](_0x259386)[_0xff31('0x24')](handleEntityNotFound(_0x58dbc9,null))[_0xff31('0x24')](respondWithResult(_0x58dbc9,null))[_0xff31('0x41')](handleError(_0x58dbc9,null));};exports['update']=function(_0x1b8702,_0x1fff6a){if(_0x1b8702[_0xff31('0x45')]['id']){delete _0x1b8702['body']['id'];}return db[_0xff31('0x2c')][_0xff31('0x46')]({'where':{'id':_0x1b8702[_0xff31('0x43')]['id']}})[_0xff31('0x24')](handleEntityNotFound(_0x1fff6a,null))[_0xff31('0x24')](saveUpdates(_0x1b8702[_0xff31('0x45')],null))[_0xff31('0x24')](respondWithResult(_0x1fff6a,null))['catch'](handleError(_0x1fff6a,null));};exports[_0xff31('0x47')]=function(_0x23c27c,_0xfa023f,_0x51153c){return db[_0xff31('0x48')][_0xff31('0x49')](function(_0x3a7ccd){if(_0x23c27c[_0xff31('0x45')]['mode']===_0xff31('0x4a')){_0x23c27c[_0xff31('0x45')]['directory']=path[_0xff31('0x4b')](config[_0xff31('0x4c')],_0xff31('0x4d'),_0x23c27c[_0xff31('0x45')]['name']);}return db['VoiceMusicOnHold']['create'](_0x23c27c[_0xff31('0x45')],{'transaction':_0x3a7ccd})[_0xff31('0x24')](function(_0x318458){if(_0x23c27c['body'][_0xff31('0x4e')]===_0xff31('0x4a')){fs[_0xff31('0x4f')](_0x318458[_0xff31('0x50')],parseInt(_0xff31('0x51'),0x8));}var _0x1cff96=_0x23c27c['user']['get']({'plain':!![]});if(!_0x1cff96)throw new Error(_0xff31('0x52'));if(_0x1cff96[_0xff31('0x53')]==='user'){var _0x2038b1=_0x318458[_0xff31('0x25')]({'plain':!![]});return db[_0xff31('0x54')][_0xff31('0x46')]({'where':{'name':_0xff31('0x26'),'userProfileId':_0x1cff96[_0xff31('0x55')]},'raw':!![]})[_0xff31('0x24')](function(_0x1b3f3b){if(_0x1b3f3b&&_0x1b3f3b[_0xff31('0x56')]===0x0){return db['UserProfileResource'][_0xff31('0x47')]({'name':_0x2038b1[_0xff31('0x2a')],'resourceId':_0x2038b1['id'],'type':_0x1b3f3b[_0xff31('0x2a')],'sectionId':_0x1b3f3b['id']},{})[_0xff31('0x24')](function(){return _0x318458;});}else{return _0x318458;}})['catch'](function(_0x1521c2){logger[_0xff31('0x57')](_0xff31('0x58'),_0x1521c2);});}return _0x318458;});})[_0xff31('0x24')](respondWithResult(_0xfa023f,0xc9))[_0xff31('0x41')](handleError(_0xfa023f,null));};exports['destroy']=function(_0x422972,_0x3827f4,_0x493c57){var _0x2a9d14;return db[_0xff31('0x2c')]['find']({'where':{'id':_0x422972[_0xff31('0x43')]['id']}})[_0xff31('0x24')](function(_0x5cd32e){if(_0x5cd32e){return db[_0xff31('0x48')][_0xff31('0x49')](function(_0x22e43a){return _0x5cd32e[_0xff31('0x23')]({'transaction':_0x22e43a,'raw':!![]})[_0xff31('0x24')](function(_0x138bc4){if(_0x138bc4[_0xff31('0x50')]){fs[_0xff31('0x59')](_0x138bc4[_0xff31('0x50')])['forEach'](function(_0x1cec8b){fs['unlinkSync'](path[_0xff31('0x4b')](_0x138bc4['directory'],_0x1cec8b));});fs[_0xff31('0x5a')](_0x138bc4[_0xff31('0x50')]);}return _0x138bc4;});})[_0xff31('0x41')](function(_0x4a4051){throw new db[(_0xff31('0x5b'))][(_0xff31('0x5c'))](_0x4a4051[_0xff31('0x5d')]);});}})[_0xff31('0x24')](handleEntityNotFound(_0x3827f4,null))[_0xff31('0x24')](removeEntity(_0x3827f4,null))[_0xff31('0x41')](handleError(_0x3827f4,null));};exports[_0xff31('0x5e')]=function(_0x18a13f,_0x52eb29,_0x4504ad){return db[_0xff31('0x48')][_0xff31('0x49')](function(_0xc9565d){var _0x2af779;return db['VoiceMusicOnHold'][_0xff31('0x46')]({'where':{'id':_0x18a13f[_0xff31('0x43')]['id']}})['then'](function(_0x11b2ed){if(_0x11b2ed){_0x2af779=_0x11b2ed;return _0x11b2ed['addSound'](_0x18a13f['body']['id'],{'transaction':_0xc9565d});}})['then'](function(_0x245f93){if(_0x245f93){return db[_0xff31('0x5f')][_0xff31('0x60')]({'where':{'id':_0x18a13f['body']['id']},'attributes':['id','name',_0xff31('0x61'),_0xff31('0x62'),_0xff31('0x63')],'raw':!![]});}})[_0xff31('0x24')](function(_0x4a4199){if(_0x4a4199){var _0x20c2c6=path[_0xff31('0x4b')](config[_0xff31('0x4c')],_0xff31('0x64'),util[_0xff31('0x65')](_0xff31('0x66'),path[_0xff31('0x67')](_0x4a4199[_0xff31('0x61')],path[_0xff31('0x68')](_0x4a4199[_0xff31('0x61')])),_0x4a4199[_0xff31('0x62')]));var _0x2ff376=path['join'](config[_0xff31('0x4c')],_0xff31('0x4d'),_0x2af779[_0xff31('0x2a')],util['format'](_0xff31('0x66'),_0x4a4199['name'],_0x4a4199['converted_format']));fs[_0xff31('0x69')](_0x20c2c6,_0x2ff376);return _0x4a4199;}})[_0xff31('0x41')](function(_0x388d55){throw new db[(_0xff31('0x5b'))][(_0xff31('0x5c'))](_0x388d55[_0xff31('0x5d')]);});})[_0xff31('0x24')](handleEntityNotFound(_0x52eb29,null))[_0xff31('0x24')](respondWithResult(_0x52eb29,0xc9))[_0xff31('0x41')](handleError(_0x52eb29,null));};exports['removeSound']=function(_0x46d77a,_0x331957,_0x257208){return db[_0xff31('0x48')][_0xff31('0x49')](function(_0x387f1a){var _0x19778f;return db[_0xff31('0x2c')][_0xff31('0x60')]({'where':{'id':_0x46d77a['params']['id']}})[_0xff31('0x24')](handleEntityNotFound(_0x331957,null))[_0xff31('0x24')](function(_0x7e5072){if(_0x7e5072){_0x19778f=_0x7e5072;return _0x7e5072[_0xff31('0x6a')](_0x46d77a[_0xff31('0x43')][_0xff31('0x6b')]);}})[_0xff31('0x24')](function(_0x3f22f0){if(_0x3f22f0){return db[_0xff31('0x5f')]['findOne']({'where':{'id':_0x46d77a[_0xff31('0x43')]['id2']},'attributes':['id','name','save_name',_0xff31('0x62'),_0xff31('0x63')],'raw':!![]});}})[_0xff31('0x24')](function(_0x422e39){if(_0x422e39){fs[_0xff31('0x6c')](path['join'](_0x19778f[_0xff31('0x50')],util[_0xff31('0x65')](_0xff31('0x66'),_0x422e39[_0xff31('0x2a')],_0x422e39[_0xff31('0x62')])));return _0x422e39;}})[_0xff31('0x41')](function(_0x46b90d){throw new db[(_0xff31('0x5b'))][(_0xff31('0x5c'))](_0x46b90d[_0xff31('0x5d')]);});})[_0xff31('0x24')](handleEntityNotFound(_0x331957,null))['then'](respondWithStatusCode(_0x331957,0xcc))[_0xff31('0x41')](handleError(_0x331957,null));};exports[_0xff31('0x6d')]=function(_0x488ae8,_0x4f4591,_0x2659ef){var _0x12e604={};var _0x360274={};var _0x4258f8;var _0x279ebf;return db['VoiceMusicOnHold'][_0xff31('0x60')]({'where':{'id':_0x488ae8[_0xff31('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f4591,null))[_0xff31('0x24')](function(_0x175bf3){if(_0x175bf3){_0x4258f8=_0x175bf3;_0x360274['model']=_[_0xff31('0x31')](db['Sound']['rawAttributes']);_0x360274[_0xff31('0x32')]=_[_0xff31('0x31')](_0x488ae8[_0xff31('0x32')]);_0x360274['filters']=_[_0xff31('0x33')](_0x360274[_0xff31('0x30')],_0x360274['query']);_0x12e604['attributes']=_[_0xff31('0x33')](_0x360274['model'],qs[_0xff31('0x44')](_0x488ae8[_0xff31('0x32')][_0xff31('0x44')]));_0x12e604['attributes']=_0x12e604[_0xff31('0x34')][_0xff31('0x35')]?_0x12e604[_0xff31('0x34')]:_0x360274['model'];_0x12e604['order']=qs[_0xff31('0x37')](_0x488ae8[_0xff31('0x32')][_0xff31('0x37')]);_0x12e604[_0xff31('0x38')]=qs[_0xff31('0x39')](_[_0xff31('0x3a')](_0x488ae8[_0xff31('0x32')],_0x360274['filters']));if(_0x488ae8[_0xff31('0x32')][_0xff31('0x6e')]){_0x12e604[_0xff31('0x38')]=_[_0xff31('0x3b')](_0x12e604[_0xff31('0x38')],{'$or':_[_0xff31('0x2b')](_0x12e604['attributes'],function(_0x415db1){var _0x5b8c3b={};_0x5b8c3b[_0x415db1]={'$like':'%'+_0x488ae8[_0xff31('0x32')][_0xff31('0x6e')]+'%'};return _0x5b8c3b;})});}_0x12e604=_['merge']({},_0x12e604,_0x488ae8[_0xff31('0x3d')]);return _0x4258f8['getSounds'](_0x12e604);}})['then'](function(_0xbcf630){if(_0xbcf630){_0x279ebf=_0xbcf630[_0xff31('0x35')];if(!_0x488ae8[_0xff31('0x32')][_0xff31('0x6f')]('nolimit')){_0x12e604['limit']=qs[_0xff31('0x1a')](_0x488ae8[_0xff31('0x32')][_0xff31('0x1a')]);_0x12e604[_0xff31('0x1d')]=qs['offset'](_0x488ae8[_0xff31('0x32')][_0xff31('0x1d')]);}return _0x4258f8['getSounds'](_0x12e604);}})['then'](function(_0x3b6af8){if(_0x3b6af8){return _0x3b6af8?{'count':_0x279ebf,'rows':_0x3b6af8}:null;}})[_0xff31('0x24')](respondWithResult(_0x4f4591,null))['catch'](handleError(_0x4f4591,null));}; \ No newline at end of file +var _0x93de=['params','rawAttributes','intersection','find','body','create','sequelize','transaction','mode','files','directory','join','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync','ValidationError','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','%s.%s','basename','extname','server/files/moh','format','symlinkSync','Sequelize','message','id2','getSounds','nolimit','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','name','send','index','map','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x93de,0x167));var _0xe93d=function(_0x45cae4,_0x10d727){_0x45cae4=_0x45cae4-0x0;var _0x37ed37=_0x93de[_0x45cae4];return _0x37ed37;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe93d('0x0'));var jsonpatch=require(_0xe93d('0x1'));var rp=require(_0xe93d('0x2'));var moment=require('moment');var BPromise=require(_0xe93d('0x3'));var Mustache=require(_0xe93d('0x4'));var util=require(_0xe93d('0x5'));var path=require('path');var sox=require(_0xe93d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe93d('0x7'));var _=require(_0xe93d('0x8'));var squel=require('squel');var crypto=require(_0xe93d('0x9'));var jsforce=require(_0xe93d('0xa'));var deskjs=require(_0xe93d('0xb'));var toCsv=require(_0xe93d('0xc'));var querystring=require(_0xe93d('0xd'));var Papa=require(_0xe93d('0xe'));var Redis=require('ioredis');var authService=require(_0xe93d('0xf'));var qs=require(_0xe93d('0x10'));var as=require(_0xe93d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe93d('0x12'))(_0xe93d('0x13'));var utils=require(_0xe93d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe93d('0x15'))['db'];function respondWithStatusCode(_0x184729,_0x235ab4){_0x235ab4=_0x235ab4||0xcc;return function(_0x217980){if(_0x217980){return _0x184729[_0xe93d('0x16')](_0x235ab4);}return _0x184729[_0xe93d('0x17')](_0x235ab4)[_0xe93d('0x18')]();};}function respondWithResult(_0x20e1df,_0xc2e477){_0xc2e477=_0xc2e477||0xc8;return function(_0x431bda){if(_0x431bda){return _0x20e1df[_0xe93d('0x17')](_0xc2e477)[_0xe93d('0x19')](_0x431bda);}};}function respondWithFilteredResult(_0x22251f,_0xe01645){return function(_0x188f57){if(_0x188f57){var _0x276c00=typeof _0xe01645[_0xe93d('0x1a')]===_0xe93d('0x1b')&&typeof _0xe01645[_0xe93d('0x1c')]===_0xe93d('0x1b');var _0x3d1701=_0x188f57['count'];var _0x493541=_0x276c00?0x0:_0xe01645[_0xe93d('0x1a')];var _0x202385=_0x276c00?_0x188f57[_0xe93d('0x1d')]:_0xe01645[_0xe93d('0x1a')]+_0xe01645['limit'];var _0x18c8b9;if(_0x202385>=_0x3d1701){_0x202385=_0x3d1701;_0x18c8b9=0xc8;}else{_0x18c8b9=0xce;}_0x22251f[_0xe93d('0x17')](_0x18c8b9);return _0x22251f[_0xe93d('0x1e')]('Content-Range',_0x493541+'-'+_0x202385+'/'+_0x3d1701)[_0xe93d('0x19')](_0x188f57);}return null;};}function patchUpdates(_0x19ad21){return function(_0x356da6){try{jsonpatch[_0xe93d('0x1f')](_0x356da6,_0x19ad21,!![]);}catch(_0x2725b9){return BPromise['reject'](_0x2725b9);}return _0x356da6[_0xe93d('0x20')]();};}function saveUpdates(_0x22eac1,_0x25a309){return function(_0x4164f3){if(_0x4164f3){return _0x4164f3[_0xe93d('0x21')](_0x22eac1)[_0xe93d('0x22')](function(_0x12d69c){return _0x12d69c;});}return null;};}function removeEntity(_0x1f9f3a,_0x1ac451){return function(_0x57782c){if(_0x57782c){return _0x57782c[_0xe93d('0x23')]()[_0xe93d('0x22')](function(){var _0x5d5948=_0x57782c[_0xe93d('0x24')]({'plain':!![]});var _0x5f1260=_0xe93d('0x25');return db[_0xe93d('0x26')][_0xe93d('0x23')]({'where':{'type':_0x5f1260,'resourceId':_0x5d5948['id']}})[_0xe93d('0x22')](function(){return _0x57782c;});})[_0xe93d('0x22')](function(){_0x1f9f3a[_0xe93d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd9c5,_0x44669d){return function(_0x41be07){if(!_0x41be07){_0x5cd9c5[_0xe93d('0x16')](0x194);}return _0x41be07;};}function handleError(_0x5760e3,_0x2c1cc1){_0x2c1cc1=_0x2c1cc1||0x1f4;return function(_0x12a047){logger['error'](_0x12a047['stack']);if(_0x12a047['name']){delete _0x12a047[_0xe93d('0x27')];}_0x5760e3[_0xe93d('0x17')](_0x2c1cc1)[_0xe93d('0x28')](_0x12a047);};}exports[_0xe93d('0x29')]=function(_0x879d12,_0x417e2c){var _0x1b7001={},_0x3976d7={},_0x1ab972={'count':0x0,'rows':[]};var _0x4b49ad=_[_0xe93d('0x2a')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x4a999c){return{'name':_0x4a999c['fieldName'],'type':_0x4a999c['type'][_0xe93d('0x2b')]};});_0x3976d7[_0xe93d('0x2c')]=_[_0xe93d('0x2a')](_0x4b49ad,_0xe93d('0x27'));_0x3976d7[_0xe93d('0x2d')]=_[_0xe93d('0x2e')](_0x879d12['query']);_0x3976d7[_0xe93d('0x2f')]=_['intersection'](_0x3976d7[_0xe93d('0x2c')],_0x3976d7[_0xe93d('0x2d')]);_0x1b7001['attributes']=_['intersection'](_0x3976d7[_0xe93d('0x2c')],qs['fields'](_0x879d12['query'][_0xe93d('0x30')]));_0x1b7001[_0xe93d('0x31')]=_0x1b7001[_0xe93d('0x31')][_0xe93d('0x32')]?_0x1b7001[_0xe93d('0x31')]:_0x3976d7[_0xe93d('0x2c')];if(!_0x879d12[_0xe93d('0x2d')][_0xe93d('0x33')]('nolimit')){_0x1b7001[_0xe93d('0x1c')]=qs['limit'](_0x879d12['query'][_0xe93d('0x1c')]);_0x1b7001['offset']=qs[_0xe93d('0x1a')](_0x879d12['query'][_0xe93d('0x1a')]);}_0x1b7001[_0xe93d('0x34')]=qs[_0xe93d('0x35')](_0x879d12[_0xe93d('0x2d')][_0xe93d('0x35')]);delete _0x879d12[_0xe93d('0x2d')]['sort'];_0x1b7001[_0xe93d('0x36')]=qs['filters'](_[_0xe93d('0x37')](_0x879d12[_0xe93d('0x2d')],_0x3976d7['filters']),_0x4b49ad);if(_0x879d12['query'][_0xe93d('0x38')]){_0x1b7001['where']=_[_0xe93d('0x39')](_0x1b7001['where'],{'$or':_[_0xe93d('0x2a')](_0x4b49ad,function(_0x17a973){if(_0x17a973['type']!==_0xe93d('0x3a')){var _0x3ae986={};_0x3ae986[_0x17a973[_0xe93d('0x27')]]={'$like':'%'+_0x879d12['query'][_0xe93d('0x38')]+'%'};return _0x3ae986;}})});}_0x1b7001=_[_0xe93d('0x39')]({},_0x1b7001,_0x879d12[_0xe93d('0x3b')]);var _0x1b7626={'where':_0x1b7001[_0xe93d('0x36')]};return db[_0xe93d('0x3c')][_0xe93d('0x1d')](_0x1b7626)['then'](function(_0x56dfb0){_0x1ab972[_0xe93d('0x1d')]=_0x56dfb0;if(_0x879d12['query'][_0xe93d('0x3d')]){_0x1b7001[_0xe93d('0x3e')]=[{'all':!![]}];}return db[_0xe93d('0x3c')][_0xe93d('0x3f')](_0x1b7001);})[_0xe93d('0x22')](function(_0x413c87){_0x1ab972['rows']=_0x413c87;return _0x1ab972;})[_0xe93d('0x22')](respondWithFilteredResult(_0x417e2c,_0x1b7001))[_0xe93d('0x40')](handleError(_0x417e2c,null));};exports['show']=function(_0x1936a4,_0x3b62f5){var _0x1eee04={'raw':![],'where':{'id':_0x1936a4[_0xe93d('0x41')]['id']}},_0x30ec54={};_0x30ec54['model']=_[_0xe93d('0x2e')](db[_0xe93d('0x3c')][_0xe93d('0x42')]);_0x30ec54[_0xe93d('0x2d')]=_[_0xe93d('0x2e')](_0x1936a4[_0xe93d('0x2d')]);_0x30ec54[_0xe93d('0x2f')]=_[_0xe93d('0x43')](_0x30ec54['model'],_0x30ec54[_0xe93d('0x2d')]);_0x1eee04['attributes']=_[_0xe93d('0x43')](_0x30ec54[_0xe93d('0x2c')],qs[_0xe93d('0x30')](_0x1936a4['query'][_0xe93d('0x30')]));_0x1eee04[_0xe93d('0x31')]=_0x1eee04[_0xe93d('0x31')][_0xe93d('0x32')]?_0x1eee04[_0xe93d('0x31')]:_0x30ec54[_0xe93d('0x2c')];if(_0x1936a4[_0xe93d('0x2d')][_0xe93d('0x3d')]){_0x1eee04[_0xe93d('0x3e')]=[{'all':!![]}];}_0x1eee04=_[_0xe93d('0x39')]({},_0x1eee04,_0x1936a4[_0xe93d('0x3b')]);return db[_0xe93d('0x3c')][_0xe93d('0x44')](_0x1eee04)[_0xe93d('0x22')](handleEntityNotFound(_0x3b62f5,null))[_0xe93d('0x22')](respondWithResult(_0x3b62f5,null))[_0xe93d('0x40')](handleError(_0x3b62f5,null));};exports[_0xe93d('0x21')]=function(_0xb448d9,_0x1b78e0){if(_0xb448d9['body']['id']){delete _0xb448d9[_0xe93d('0x45')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0xb448d9['params']['id']}})['then'](handleEntityNotFound(_0x1b78e0,null))['then'](saveUpdates(_0xb448d9[_0xe93d('0x45')],null))[_0xe93d('0x22')](respondWithResult(_0x1b78e0,null))[_0xe93d('0x40')](handleError(_0x1b78e0,null));};exports[_0xe93d('0x46')]=function(_0x333cb8,_0x15f6dc,_0x49854f){return db[_0xe93d('0x47')][_0xe93d('0x48')](function(_0xcff536){if(_0x333cb8[_0xe93d('0x45')][_0xe93d('0x49')]===_0xe93d('0x4a')){_0x333cb8[_0xe93d('0x45')][_0xe93d('0x4b')]=path[_0xe93d('0x4c')](config['root'],'server/files/moh',_0x333cb8[_0xe93d('0x45')][_0xe93d('0x27')]);}return db[_0xe93d('0x3c')][_0xe93d('0x46')](_0x333cb8[_0xe93d('0x45')],{'transaction':_0xcff536})[_0xe93d('0x22')](function(_0x429c9c){if(_0x333cb8[_0xe93d('0x45')][_0xe93d('0x49')]==='files'){fs[_0xe93d('0x4d')](_0x429c9c['directory'],parseInt(_0xe93d('0x4e'),0x8));}var _0x4edb73=_0x333cb8[_0xe93d('0x4f')]['get']({'plain':!![]});if(!_0x4edb73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4edb73[_0xe93d('0x50')]===_0xe93d('0x4f')){var _0x4d24d6=_0x429c9c[_0xe93d('0x24')]({'plain':!![]});return db[_0xe93d('0x51')][_0xe93d('0x44')]({'where':{'name':_0xe93d('0x25'),'userProfileId':_0x4edb73[_0xe93d('0x52')]},'raw':!![]})['then'](function(_0x2b7c){if(_0x2b7c&&_0x2b7c[_0xe93d('0x53')]===0x0){return db[_0xe93d('0x26')][_0xe93d('0x46')]({'name':_0x4d24d6[_0xe93d('0x27')],'resourceId':_0x4d24d6['id'],'type':_0x2b7c[_0xe93d('0x27')],'sectionId':_0x2b7c['id']},{})[_0xe93d('0x22')](function(){return _0x429c9c;});}else{return _0x429c9c;}})[_0xe93d('0x40')](function(_0x2de195){logger['error'](_0xe93d('0x54'),_0x2de195);});}return _0x429c9c;});})[_0xe93d('0x22')](respondWithResult(_0x15f6dc,0xc9))[_0xe93d('0x40')](handleError(_0x15f6dc,null));};exports[_0xe93d('0x23')]=function(_0x295733,_0x5082a0,_0x1d9f13){var _0x3a486d;return db[_0xe93d('0x3c')][_0xe93d('0x44')]({'where':{'id':_0x295733[_0xe93d('0x41')]['id']}})[_0xe93d('0x22')](function(_0x296a8b){if(_0x296a8b){return db[_0xe93d('0x47')][_0xe93d('0x48')](function(_0x116871){return _0x296a8b['destroy']({'transaction':_0x116871,'raw':!![]})[_0xe93d('0x22')](function(_0x59c0ad){if(_0x59c0ad[_0xe93d('0x4b')]){fs['readdirSync'](_0x59c0ad[_0xe93d('0x4b')])[_0xe93d('0x55')](function(_0x2c387b){fs['unlinkSync'](path['join'](_0x59c0ad[_0xe93d('0x4b')],_0x2c387b));});fs[_0xe93d('0x56')](_0x59c0ad[_0xe93d('0x4b')]);}return _0x59c0ad;});})[_0xe93d('0x40')](function(_0x4cc0c3){throw new db['Sequelize'][(_0xe93d('0x57'))](_0x4cc0c3['message']);});}})['then'](handleEntityNotFound(_0x5082a0,null))['then'](removeEntity(_0x5082a0,null))[_0xe93d('0x40')](handleError(_0x5082a0,null));};exports[_0xe93d('0x58')]=function(_0x34b746,_0x399fc2,_0x191e99){return db[_0xe93d('0x47')][_0xe93d('0x48')](function(_0x4d8536){var _0x5a708e;return db[_0xe93d('0x3c')]['find']({'where':{'id':_0x34b746[_0xe93d('0x41')]['id']}})[_0xe93d('0x22')](function(_0x934a8e){if(_0x934a8e){_0x5a708e=_0x934a8e;return _0x934a8e[_0xe93d('0x58')](_0x34b746['body']['id'],{'transaction':_0x4d8536});}})[_0xe93d('0x22')](function(_0x5debcf){if(_0x5debcf){return db[_0xe93d('0x59')][_0xe93d('0x5a')]({'where':{'id':_0x34b746[_0xe93d('0x45')]['id']},'attributes':['id',_0xe93d('0x27'),_0xe93d('0x5b'),_0xe93d('0x5c'),'createdAt'],'raw':!![]});}})[_0xe93d('0x22')](function(_0xd7e76a){if(_0xd7e76a){var _0x13e8cd=path[_0xe93d('0x4c')](config[_0xe93d('0x5d')],_0xe93d('0x5e'),util['format'](_0xe93d('0x5f'),path[_0xe93d('0x60')](_0xd7e76a[_0xe93d('0x5b')],path[_0xe93d('0x61')](_0xd7e76a[_0xe93d('0x5b')])),_0xd7e76a[_0xe93d('0x5c')]));var _0x41eb77=path['join'](config[_0xe93d('0x5d')],_0xe93d('0x62'),_0x5a708e['name'],util[_0xe93d('0x63')]('%s.%s',_0xd7e76a[_0xe93d('0x27')],_0xd7e76a[_0xe93d('0x5c')]));fs[_0xe93d('0x64')](_0x13e8cd,_0x41eb77);return _0xd7e76a;}})[_0xe93d('0x40')](function(_0xf61ebe){throw new db[(_0xe93d('0x65'))]['ValidationError'](_0xf61ebe[_0xe93d('0x66')]);});})[_0xe93d('0x22')](handleEntityNotFound(_0x399fc2,null))['then'](respondWithResult(_0x399fc2,0xc9))[_0xe93d('0x40')](handleError(_0x399fc2,null));};exports['removeSound']=function(_0x3c9c30,_0x3ff5b,_0x4c712b){return db[_0xe93d('0x47')][_0xe93d('0x48')](function(_0xf3b3b0){var _0x1e9f5b;return db['VoiceMusicOnHold'][_0xe93d('0x5a')]({'where':{'id':_0x3c9c30[_0xe93d('0x41')]['id']}})[_0xe93d('0x22')](handleEntityNotFound(_0x3ff5b,null))[_0xe93d('0x22')](function(_0x2df8bd){if(_0x2df8bd){_0x1e9f5b=_0x2df8bd;return _0x2df8bd['removeSound'](_0x3c9c30[_0xe93d('0x41')][_0xe93d('0x67')]);}})[_0xe93d('0x22')](function(_0x4d1d81){if(_0x4d1d81){return db[_0xe93d('0x59')]['findOne']({'where':{'id':_0x3c9c30[_0xe93d('0x41')]['id2']},'attributes':['id','name',_0xe93d('0x5b'),'converted_format','createdAt'],'raw':!![]});}})[_0xe93d('0x22')](function(_0x5562c6){if(_0x5562c6){fs['unlinkSync'](path[_0xe93d('0x4c')](_0x1e9f5b['directory'],util[_0xe93d('0x63')](_0xe93d('0x5f'),_0x5562c6[_0xe93d('0x27')],_0x5562c6[_0xe93d('0x5c')])));return _0x5562c6;}})['catch'](function(_0x2007c0){throw new db['Sequelize']['ValidationError'](_0x2007c0['message']);});})[_0xe93d('0x22')](handleEntityNotFound(_0x3ff5b,null))[_0xe93d('0x22')](respondWithStatusCode(_0x3ff5b,0xcc))[_0xe93d('0x40')](handleError(_0x3ff5b,null));};exports[_0xe93d('0x68')]=function(_0x4eaf35,_0x51f4c3,_0x377d44){var _0x508a5b={};var _0x11d43f={};var _0x1603db;var _0x5709d5;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x4eaf35[_0xe93d('0x41')]['id']}})[_0xe93d('0x22')](handleEntityNotFound(_0x51f4c3,null))['then'](function(_0x38daaa){if(_0x38daaa){_0x1603db=_0x38daaa;_0x11d43f['model']=_[_0xe93d('0x2e')](db['Sound'][_0xe93d('0x42')]);_0x11d43f[_0xe93d('0x2d')]=_[_0xe93d('0x2e')](_0x4eaf35[_0xe93d('0x2d')]);_0x11d43f[_0xe93d('0x2f')]=_[_0xe93d('0x43')](_0x11d43f['model'],_0x11d43f[_0xe93d('0x2d')]);_0x508a5b[_0xe93d('0x31')]=_['intersection'](_0x11d43f[_0xe93d('0x2c')],qs[_0xe93d('0x30')](_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x30')]));_0x508a5b['attributes']=_0x508a5b[_0xe93d('0x31')][_0xe93d('0x32')]?_0x508a5b['attributes']:_0x11d43f[_0xe93d('0x2c')];_0x508a5b['order']=qs[_0xe93d('0x35')](_0x4eaf35[_0xe93d('0x2d')]['sort']);_0x508a5b[_0xe93d('0x36')]=qs[_0xe93d('0x2f')](_[_0xe93d('0x37')](_0x4eaf35['query'],_0x11d43f[_0xe93d('0x2f')]));if(_0x4eaf35['query']['filter']){_0x508a5b['where']=_[_0xe93d('0x39')](_0x508a5b[_0xe93d('0x36')],{'$or':_[_0xe93d('0x2a')](_0x508a5b['attributes'],function(_0x2c4893){var _0x5d20aa={};_0x5d20aa[_0x2c4893]={'$like':'%'+_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x38')]+'%'};return _0x5d20aa;})});}_0x508a5b=_[_0xe93d('0x39')]({},_0x508a5b,_0x4eaf35[_0xe93d('0x3b')]);return _0x1603db[_0xe93d('0x68')](_0x508a5b);}})['then'](function(_0x27da4d){if(_0x27da4d){_0x5709d5=_0x27da4d[_0xe93d('0x32')];if(!_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x33')](_0xe93d('0x69'))){_0x508a5b[_0xe93d('0x1c')]=qs[_0xe93d('0x1c')](_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x1c')]);_0x508a5b[_0xe93d('0x1a')]=qs[_0xe93d('0x1a')](_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x1a')]);}return _0x1603db['getSounds'](_0x508a5b);}})['then'](function(_0x5d35c8){if(_0x5d35c8){return _0x5d35c8?{'count':_0x5709d5,'rows':_0x5d35c8}:null;}})[_0xe93d('0x22')](respondWithResult(_0x51f4c3,null))[_0xe93d('0x40')](handleError(_0x51f4c3,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 8ffe0e0..5331501 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 _0x5199=['request-promise','path','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0x5199,0x8a));var _0x9519=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5199[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x9519('0x0'));var util=require(_0x9519('0x1'));var logger=require(_0x9519('0x2'))(_0x9519('0x3'));var moment=require('moment');var BPromise=require(_0x9519('0x4'));var rp=require(_0x9519('0x5'));var fs=require('fs');var path=require(_0x9519('0x6'));var rimraf=require('rimraf');var config=require(_0x9519('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x111c65,_0x582d06){return _0x111c65[_0x9519('0x8')](_0x9519('0x9'),attributes,{'tableName':_0x9519('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa763=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c236b,_0x58a997){var _0x2b5789=function(_0x503dbb){while(--_0x503dbb){_0x4c236b['push'](_0x4c236b['shift']());}};_0x2b5789(++_0x58a997);}(_0xa763,0xe2));var _0x3a76=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xa763[_0x67f95e];return _0x538f5a;};'use strict';var _=require(_0x3a76('0x0'));var util=require(_0x3a76('0x1'));var logger=require(_0x3a76('0x2'))(_0x3a76('0x3'));var moment=require(_0x3a76('0x4'));var BPromise=require(_0x3a76('0x5'));var rp=require(_0x3a76('0x6'));var fs=require('fs');var path=require(_0x3a76('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a76('0x8'));module[_0x3a76('0x9')]=function(_0x1015c,_0x521c9f){return _0x1015c[_0x3a76('0xa')](_0x3a76('0xb'),attributes,{'tableName':_0x3a76('0xc'),'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 ab31a43..937085b 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x50b3f7,_0x31e9b5){var _0x175b15=function(_0x4987e2){while(--_0x4987e2){_0x50b3f7['push'](_0x50b3f7['shift']());}};_0x175b15(++_0x31e9b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 _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(_0x4d7219,_0x144cff){var _0x258c71=function(_0x5e11fb){while(--_0x5e11fb){_0x4d7219['push'](_0x4d7219['shift']());}};_0x258c71(++_0x144cff);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 0ab88d8..e539e0b 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 _0xaa9d=['post','/:id/users','addAgents','addTeams','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','getAgents','/:id/teams','getTeams'];(function(_0x4669c6,_0xcc724b){var _0x209c7c=function(_0x3642cf){while(--_0x3642cf){_0x4669c6['push'](_0x4669c6['shift']());}};_0x209c7c(++_0xcc724b);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0xdf205f,_0x4d433b){_0xdf205f=_0xdf205f-0x0;var _0x277962=_0xaa9d[_0xdf205f];return _0x277962;};'use strict';var multer=require(_0xdaa9('0x0'));var util=require(_0xdaa9('0x1'));var path=require(_0xdaa9('0x2'));var timeout=require(_0xdaa9('0x3'));var express=require(_0xdaa9('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(_0xdaa9('0x5'));var controller=require(_0xdaa9('0x6'));router[_0xdaa9('0x7')]('/',auth[_0xdaa9('0x8')](),controller['index']);router['get'](_0xdaa9('0x9'),auth[_0xdaa9('0x8')](),controller[_0xdaa9('0xa')]);router[_0xdaa9('0x7')]('/:id',auth[_0xdaa9('0x8')](),controller['show']);router[_0xdaa9('0x7')]('/:id/users',auth[_0xdaa9('0x8')](),controller[_0xdaa9('0xb')]);router['get'](_0xdaa9('0xc'),auth[_0xdaa9('0x8')](),controller[_0xdaa9('0xd')]);router[_0xdaa9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdaa9('0xe')](_0xdaa9('0xf'),auth[_0xdaa9('0x8')](),controller[_0xdaa9('0x10')]);router[_0xdaa9('0xe')](_0xdaa9('0xc'),auth[_0xdaa9('0x8')](),controller[_0xdaa9('0x11')]);router['put']('/:id',auth[_0xdaa9('0x8')](),controller[_0xdaa9('0x12')]);router[_0xdaa9('0x13')](_0xdaa9('0x14'),auth['isAuthenticated'](),controller['destroy']);router[_0xdaa9('0x13')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router[_0xdaa9('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdaa9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0560=['/:id','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','update','delete'];(function(_0x2c8978,_0x91982a){var _0x58a356=function(_0x1c9e57){while(--_0x1c9e57){_0x2c8978['push'](_0x2c8978['shift']());}};_0x58a356(++_0x91982a);}(_0x0560,0x95));var _0x0056=function(_0x5c9c08,_0x2a4d90){_0x5c9c08=_0x5c9c08-0x0;var _0x55d5ed=_0x0560[_0x5c9c08];return _0x55d5ed;};'use strict';var multer=require(_0x0056('0x0'));var util=require('util');var path=require(_0x0056('0x1'));var timeout=require(_0x0056('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0056('0x3'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x0056('0x4')]('/',auth[_0x0056('0x5')](),controller[_0x0056('0x6')]);router['get'](_0x0056('0x7'),auth[_0x0056('0x5')](),controller[_0x0056('0x8')]);router[_0x0056('0x4')]('/:id',auth[_0x0056('0x5')](),controller[_0x0056('0x9')]);router[_0x0056('0x4')](_0x0056('0xa'),auth[_0x0056('0x5')](),controller[_0x0056('0xb')]);router['get'](_0x0056('0xc'),auth[_0x0056('0x5')](),controller[_0x0056('0xd')]);router[_0x0056('0xe')]('/',auth['isAuthenticated'](),controller[_0x0056('0xf')]);router[_0x0056('0xe')](_0x0056('0xa'),auth[_0x0056('0x5')](),controller[_0x0056('0x10')]);router[_0x0056('0xe')](_0x0056('0xc'),auth[_0x0056('0x5')](),controller['addTeams']);router['put']('/:id',auth[_0x0056('0x5')](),controller[_0x0056('0x11')]);router[_0x0056('0x12')](_0x0056('0x13'),auth[_0x0056('0x5')](),controller[_0x0056('0x14')]);router[_0x0056('0x12')](_0x0056('0xa'),auth['isAuthenticated'](),controller[_0x0056('0x15')]);router[_0x0056('0x12')](_0x0056('0xc'),auth[_0x0056('0x5')](),controller[_0x0056('0x16')]);module[_0x0056('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b61df0c..1c2471c 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 _0x57fa=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','STRING'];(function(_0x15b006,_0x42c524){var _0x4c21e5=function(_0x20876b){while(--_0x20876b){_0x15b006['push'](_0x15b006['shift']());}};_0x4c21e5(++_0x42c524);}(_0x57fa,0x11d));var _0xa57f=function(_0x32aaca,_0x58b090){_0x32aaca=_0x32aaca-0x0;var _0x17329=_0x57fa[_0x32aaca];return _0x17329;};'use strict';var Sequelize=require(_0xa57f('0x0'));module['exports']={'name':{'type':Sequelize[_0xa57f('0x1')],'allowNull':![],'unique':_0xa57f('0x2')},'prefix':{'type':Sequelize[_0xa57f('0x3')],'get':function(_0x4c6ecc){return _0xa57f('0x4')+this[_0xa57f('0x5')](_0xa57f('0x2'))+'-';}},'description':{'type':Sequelize[_0xa57f('0x1')]},'callerIdAll':{'type':Sequelize[_0xa57f('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xa57f('0x6')]}}; \ No newline at end of file +var _0x197a=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x52a167,_0xd2e437){var _0x2ab33a=function(_0xa5dab1){while(--_0xa5dab1){_0x52a167['push'](_0x52a167['shift']());}};_0x2ab33a(++_0xd2e437);}(_0x197a,0x1c8));var _0xa197=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0x197a[_0x134d5e];return _0x1e166a;};'use strict';var Sequelize=require(_0xa197('0x0'));module[_0xa197('0x1')]={'name':{'type':Sequelize[_0xa197('0x2')],'allowNull':![],'unique':_0xa197('0x3')},'prefix':{'type':Sequelize[_0xa197('0x4')],'get':function(_0x27ad38){return _0xa197('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xa197('0x2')]},'callerIdAll':{'type':Sequelize[_0xa197('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xa197('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9ca9cd5..f8c827c 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 _0xc900=['voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VoicePrefix','includeAll','include','findAll','show','params','options','catch','destroy','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','goto','${EXTEN:','update','system-','sequelize','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','Team','getTeams','addTeams','Agents'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xc900,0xb3));var _0x0c90=function(_0x31d720,_0x116867){_0x31d720=_0x31d720-0x0;var _0x22a7b7=_0xc900[_0x31d720];return _0x22a7b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];config['redis']=_[_0x0c90('0x19')](config[_0x0c90('0x1a')],{'host':_0x0c90('0x1b'),'port':0x18eb});var socket=require(_0x0c90('0x1c'))(new Redis(config[_0x0c90('0x1a')]));require('./voicePrefix.socket')[_0x0c90('0x1d')](socket);function respondWithStatusCode(_0x4451e0,_0x4f35f4){_0x4f35f4=_0x4f35f4||0xcc;return function(_0x2c82a4){if(_0x2c82a4){return _0x4451e0[_0x0c90('0x1e')](_0x4f35f4);}return _0x4451e0[_0x0c90('0x1f')](_0x4f35f4)['end']();};}function respondWithResult(_0x5daeb7,_0x412635){_0x412635=_0x412635||0xc8;return function(_0x15ca42){if(_0x15ca42){return _0x5daeb7[_0x0c90('0x1f')](_0x412635)[_0x0c90('0x20')](_0x15ca42);}};}function respondWithFilteredResult(_0x276b92,_0x2cab22){return function(_0x42321a){if(_0x42321a){var _0x57b9a6=typeof _0x2cab22[_0x0c90('0x21')]===_0x0c90('0x22')&&typeof _0x2cab22[_0x0c90('0x23')]===_0x0c90('0x22');var _0x594267=_0x42321a[_0x0c90('0x24')];var _0xd129ca=_0x57b9a6?0x0:_0x2cab22[_0x0c90('0x21')];var _0x1241a9=_0x57b9a6?_0x42321a[_0x0c90('0x24')]:_0x2cab22[_0x0c90('0x21')]+_0x2cab22['limit'];var _0x365a42;if(_0x1241a9>=_0x594267){_0x1241a9=_0x594267;_0x365a42=0xc8;}else{_0x365a42=0xce;}_0x276b92['status'](_0x365a42);return _0x276b92[_0x0c90('0x25')](_0x0c90('0x26'),_0xd129ca+'-'+_0x1241a9+'/'+_0x594267)['json'](_0x42321a);}return null;};}function patchUpdates(_0x2a053a){return function(_0x43ddc3){try{jsonpatch[_0x0c90('0x27')](_0x43ddc3,_0x2a053a,!![]);}catch(_0x86dee){return BPromise[_0x0c90('0x28')](_0x86dee);}return _0x43ddc3[_0x0c90('0x29')]();};}function saveUpdates(_0x4dfbc3,_0x26f0a3){return function(_0x12f22c){if(_0x12f22c){return _0x12f22c['update'](_0x4dfbc3)['then'](function(_0x28d005){return _0x28d005;});}return null;};}function removeEntity(_0x3ea861,_0x35c243){return function(_0x109a5f){if(_0x109a5f){return _0x109a5f['destroy']()[_0x0c90('0x2a')](function(){var _0x438652=_0x109a5f[_0x0c90('0x2b')]({'plain':!![]});var _0x277d4a=_0x0c90('0x2c');return db[_0x0c90('0x2d')]['destroy']({'where':{'type':_0x277d4a,'resourceId':_0x438652['id']}})[_0x0c90('0x2a')](function(){return _0x109a5f;});})[_0x0c90('0x2a')](function(){_0x3ea861[_0x0c90('0x1f')](0xcc)[_0x0c90('0x2e')]();});}};}function handleEntityNotFound(_0x52d28d,_0x4c8603){return function(_0x1f27f1){if(!_0x1f27f1){_0x52d28d[_0x0c90('0x1e')](0x194);}return _0x1f27f1;};}function handleError(_0x3bff04,_0x122a4f){_0x122a4f=_0x122a4f||0x1f4;return function(_0x119e09){logger['error'](_0x119e09[_0x0c90('0x2f')]);if(_0x119e09[_0x0c90('0x30')]){delete _0x119e09[_0x0c90('0x30')];}_0x3bff04['status'](_0x122a4f)[_0x0c90('0x31')](_0x119e09);};}exports['index']=function(_0x54a3f5,_0x886634){var _0x5071b={},_0x2f0835={},_0x41189f={'count':0x0,'rows':[]};var _0x58c01a=_[_0x0c90('0x32')](db['VoicePrefix'][_0x0c90('0x33')],function(_0x5a0e75){return{'name':_0x5a0e75[_0x0c90('0x34')],'type':_0x5a0e75[_0x0c90('0x35')]['key']};});_0x2f0835[_0x0c90('0x36')]=_[_0x0c90('0x32')](_0x58c01a,_0x0c90('0x30'));_0x2f0835[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x54a3f5[_0x0c90('0x37')]);_0x2f0835[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x2f0835['model'],_0x2f0835[_0x0c90('0x37')]);_0x5071b[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x2f0835[_0x0c90('0x36')],qs['fields'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x5071b[_0x0c90('0x3b')]=_0x5071b[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x5071b[_0x0c90('0x3b')]:_0x2f0835[_0x0c90('0x36')];if(!_0x54a3f5[_0x0c90('0x37')]['hasOwnProperty'](_0x0c90('0x3e'))){_0x5071b[_0x0c90('0x23')]=qs['limit'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x23')]);_0x5071b[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x54a3f5[_0x0c90('0x37')]['offset']);}_0x5071b[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x40')]);_0x5071b[_0x0c90('0x41')]=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x54a3f5[_0x0c90('0x37')],_0x2f0835[_0x0c90('0x39')]),_0x58c01a);if(_0x54a3f5['query'][_0x0c90('0x43')]){_0x5071b['where']=_[_0x0c90('0x44')](_0x5071b['where'],{'$or':_[_0x0c90('0x32')](_0x58c01a,function(_0x62e316){if(_0x62e316['type']!=='VIRTUAL'){var _0x27ef6f={};_0x27ef6f[_0x62e316['name']]={'$like':'%'+_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x27ef6f;}})});}_0x5071b=_[_0x0c90('0x44')]({},_0x5071b,_0x54a3f5['options']);var _0x2ad8eb={'where':_0x5071b[_0x0c90('0x41')]};return db[_0x0c90('0x45')][_0x0c90('0x24')](_0x2ad8eb)[_0x0c90('0x2a')](function(_0x1184c4){_0x41189f['count']=_0x1184c4;if(_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x46')]){_0x5071b[_0x0c90('0x47')]=[{'all':!![]}];}return db[_0x0c90('0x45')][_0x0c90('0x48')](_0x5071b);})[_0x0c90('0x2a')](function(_0x30b9df){_0x41189f['rows']=_0x30b9df;return _0x41189f;})[_0x0c90('0x2a')](respondWithFilteredResult(_0x886634,_0x5071b))['catch'](handleError(_0x886634,null));};exports[_0x0c90('0x49')]=function(_0x2470ce,_0x1a7a36){var _0x1179b0={'raw':![],'where':{'id':_0x2470ce[_0x0c90('0x4a')]['id']}},_0x38842c={};_0x38842c[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x45')][_0x0c90('0x33')]);_0x38842c[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2470ce[_0x0c90('0x37')]);_0x38842c[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x38842c['model'],_0x38842c[_0x0c90('0x37')]);_0x1179b0[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x38842c[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x2470ce[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x1179b0[_0x0c90('0x3b')]=_0x1179b0[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x1179b0[_0x0c90('0x3b')]:_0x38842c[_0x0c90('0x36')];if(_0x2470ce[_0x0c90('0x37')][_0x0c90('0x46')]){_0x1179b0['include']=[{'all':!![]}];}_0x1179b0=_[_0x0c90('0x44')]({},_0x1179b0,_0x2470ce[_0x0c90('0x4b')]);return db['VoicePrefix']['find'](_0x1179b0)['then'](handleEntityNotFound(_0x1a7a36,null))[_0x0c90('0x2a')](respondWithResult(_0x1a7a36,null))[_0x0c90('0x4c')](handleError(_0x1a7a36,null));};exports[_0x0c90('0x4d')]=function(_0x3fbdfc,_0x11d2de){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x3fbdfc[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x11d2de,null))['then'](removeEntity(_0x11d2de,null))[_0x0c90('0x4c')](handleError(_0x11d2de,null));};exports[_0x0c90('0x4f')]=function(_0xd639a1,_0xb483e7){return db[_0x0c90('0x45')][_0x0c90('0x4f')]()[_0x0c90('0x2a')](respondWithResult(_0xb483e7,null))[_0x0c90('0x4c')](handleError(_0xb483e7,null));};exports[_0x0c90('0x50')]=function(_0xeeee3b,_0x5e288e){var _0xac80b2;return db['sequelize'][_0x0c90('0x51')](function(_0x67539d){return db[_0x0c90('0x45')][_0x0c90('0x50')](_0xeeee3b[_0x0c90('0x52')],{'transaction':_0x67539d})[_0x0c90('0x2a')](function(_0x58dcfc){_0xac80b2=_0x58dcfc['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0xac80b2[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x3bf5de){return createVoicePrefixExtensions(_0xac80b2,_0x3bf5de,_0x67539d);});});})['then'](function(){var _0x202666=_0xeeee3b[_0x0c90('0x54')]['get']({'plain':!![]});if(!_0x202666)throw new Error(_0x0c90('0x55'));if(_0x202666['role']===_0x0c90('0x54')){var _0x8951f2=_0xac80b2;return db[_0x0c90('0x56')][_0x0c90('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x202666[_0x0c90('0x57')]},'raw':!![]})['then'](function(_0x344613){if(_0x344613&&_0x344613[_0x0c90('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x8951f2['name'],'resourceId':_0x8951f2['id'],'type':_0x344613[_0x0c90('0x30')],'sectionId':_0x344613['id']},{})[_0x0c90('0x2a')](function(){return _0xac80b2;});}else{return _0xac80b2;}})[_0x0c90('0x4c')](function(_0x2f61cb){logger[_0x0c90('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f61cb);throw _0x2f61cb;});}return _0xac80b2;})[_0x0c90('0x2a')](respondWithResult(_0x5e288e,null))[_0x0c90('0x4c')](handleError(_0x5e288e,null));};function Extension(_0x5ee971,_0x3eb725,_0x5a11e5,_0x24326b){this[_0x0c90('0x5a')]='from-sip';this[_0x0c90('0x5b')]=_0x5ee971;this['app']=_0x5a11e5;this['type']='system';this[_0x0c90('0x5c')]=_0x0c90('0x5d');this[_0x0c90('0x5e')]=_0x3eb725;this[_0x0c90('0x5f')]=_0x24326b;}function createVoicePrefixExtensions(_0x536a26,_0x5b385b,_0x426f65){return new BPromise(function(_0xd982c5,_0x120b88){var _0x4c4e5a=new Extension(formatPrefixName(_0x536a26[_0x0c90('0x60')]),0x1,_0x0c90('0x61'),_0x0c90('0x62'));_0x4c4e5a['VoicePrefixId']=_0x536a26['id'];return db[_0x0c90('0x63')][_0x0c90('0x50')](_0x4c4e5a,{'transaction':_0x426f65})[_0x0c90('0x2a')](function(_0x521436){var _0x31343b=_0x521436[_0x0c90('0x2b')]({'plain':!![]});var _0x1a198b=_[_0x0c90('0x32')](addVoicePrefixExtensions(_0x536a26,_0x5b385b),function(_0xf58a25){_0xf58a25[_0x0c90('0x53')]=_0x31343b['id'];_0xf58a25[_0x0c90('0x64')]=_0x536a26['id'];return _0xf58a25;});return db[_0x0c90('0x63')][_0x0c90('0x65')](_0x1a198b,{'transaction':_0x426f65})['then'](function(_0x530bbe){if(!_0x530bbe){return _0x120b88(_0x0c90('0x66'));}else{return _0xd982c5(_0x530bbe);}})[_0x0c90('0x4c')](function(_0x3a44df){return _0x120b88(_0x3a44df);});});;});};function addVoicePrefixExtensions(_0x2faf14,_0x19dae5){var _0x2dad30=[];var _0x2f1459=formatPrefixName(_0x2faf14[_0x0c90('0x60')]);_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x2,_0x0c90('0x68'),_0x0c90('0x69')+_0x2faf14[_0x0c90('0x30')]));if(_0x2faf14[_0x0c90('0x6a')]){_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x68'),'PREFIX-CALLERIDALL='+_0x2faf14[_0x0c90('0x6a')]));}else{_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x61'),'No\x20callerid\x20available'));}_0x2dad30['push'](new Extension(_0x2f1459,0x4,_0x0c90('0x6b'),_0x19dae5['context']+','+_0x0c90('0x6c')+(0x8+_0x2faf14[_0x0c90('0x30')]['length'])+'}'+','+0x1));return _0x2dad30;}function formatPrefixName(_0x2c64e0){var _0x3f4819='_';for(var _0x25ef97=0x0;_0x25ef97<_0x2c64e0[_0x0c90('0x3d')];_0x25ef97++){if(_0x2c64e0['charAt'](_0x25ef97)=='-'){_0x3f4819+=_0x2c64e0['charAt'](_0x25ef97);}else{_0x3f4819+='['+_0x2c64e0['charAt'](_0x25ef97)+']';}}_0x3f4819+='.';return _0x3f4819;}exports[_0x0c90('0x6d')]=function(_0x2d3287,_0x3bc90d,_0x2d5fe3){var _0x4a801f=_0x2d3287[_0x0c90('0x52')];_0x4a801f['prefix']=_0x0c90('0x6e')+_0x4a801f[_0x0c90('0x30')]+'-';return db[_0x0c90('0x6f')]['transaction'](function(_0x10f686){return db[_0x0c90('0x45')][_0x0c90('0x6d')](_0x4a801f,{'where':{'id':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension'][_0x0c90('0x4e')]({'where':{'id':_0x4a801f[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x4a59b5){return createVoicePrefixExtensions(_0x4a801f,_0x4a59b5,_0x10f686);});});});})[_0x0c90('0x2a')](function(){return db[_0x0c90('0x45')][_0x0c90('0x70')](_0x4a801f['id']);})[_0x0c90('0x2a')](respondWithResult(_0x3bc90d,null))[_0x0c90('0x4c')](handleError(_0x3bc90d,null));};exports[_0x0c90('0x71')]=function(_0x53779b,_0x28a2f0,_0x431828){return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x53779b[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x28a2f0,null))[_0x0c90('0x2a')](function(_0x1777ac){if(_0x1777ac){return _0x1777ac[_0x0c90('0x71')](_0x53779b[_0x0c90('0x52')]['ids'],_[_0x0c90('0x72')](_0x53779b[_0x0c90('0x52')],[_0x0c90('0x73'),'id'])||{})[_0x0c90('0x74')](function(_0x4e8330){for(var _0x2e68ea=0x0;_0x2e68ea<_0x53779b[_0x0c90('0x52')][_0x0c90('0x73')]['length'];_0x2e68ea+=0x1){socket[_0x0c90('0x75')](_0x0c90('0x76'),{'UserId':Number(_0x53779b['body'][_0x0c90('0x73')][_0x2e68ea]),'VoicePrefixId':Number(_0x53779b['params']['id'])});}return _0x4e8330;});}})[_0x0c90('0x2a')](respondWithResult(_0x28a2f0,null))['catch'](handleError(_0x28a2f0,null));};exports['removeAgents']=function(_0x42e76a,_0x137c30,_0x56a38b){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x42e76a[_0x0c90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x137c30,null))['then'](function(_0x250d41){if(_0x250d41){return _0x250d41['removeAgents'](_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')])[_0x0c90('0x2a')](function(){if(_[_0x0c90('0x77')](_0x42e76a[_0x0c90('0x37')]['ids'])){for(var _0x471caa=0x0;_0x471caa<_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')]['length'];_0x471caa+=0x1){socket['emit'](_0x0c90('0x78'),{'UserId':Number(_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')][_0x471caa]),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x42e76a[_0x0c90('0x37')]['ids']),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x137c30,null))['catch'](handleError(_0x137c30,null));};exports[_0x0c90('0x79')]=function(_0x2ca017,_0x1bf6e0,_0x29ede1){var _0x16c383={};var _0x56a3bc={};var _0x5562cc;var _0x57eab8;return db[_0x0c90('0x45')][_0x0c90('0x7a')]({'where':{'id':_0x2ca017[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x1bf6e0,null))[_0x0c90('0x2a')](function(_0x3d5521){if(_0x3d5521){_0x5562cc=_0x3d5521;_0x56a3bc['model']=_[_0x0c90('0x38')](db[_0x0c90('0x7b')][_0x0c90('0x33')]);_0x56a3bc[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2ca017[_0x0c90('0x37')]);_0x56a3bc[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x56a3bc[_0x0c90('0x36')],_0x56a3bc[_0x0c90('0x37')]);_0x16c383[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x56a3bc['model'],qs[_0x0c90('0x3c')](_0x2ca017['query'][_0x0c90('0x3c')]));_0x16c383['attributes']=_0x16c383[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x16c383[_0x0c90('0x3b')]:_0x56a3bc[_0x0c90('0x36')];_0x16c383['order']=qs['sort'](_0x2ca017[_0x0c90('0x37')][_0x0c90('0x40')]);_0x16c383['where']=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x2ca017['query'],_0x56a3bc[_0x0c90('0x39')]));if(_0x2ca017[_0x0c90('0x37')]['filter']){_0x16c383[_0x0c90('0x41')]=_['merge'](_0x16c383[_0x0c90('0x41')],{'$or':_[_0x0c90('0x32')](_0x16c383[_0x0c90('0x3b')],function(_0x1b95db){var _0x519f74={};_0x519f74[_0x1b95db]={'$like':'%'+_0x2ca017[_0x0c90('0x37')]['filter']+'%'};return _0x519f74;})});}_0x16c383=_[_0x0c90('0x44')]({},_0x16c383,_0x2ca017[_0x0c90('0x4b')]);return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})[_0x0c90('0x2a')](function(_0x1306bb){if(_0x1306bb){_0x57eab8=_0x1306bb['length'];if(!_0x2ca017[_0x0c90('0x37')][_0x0c90('0x7c')](_0x0c90('0x3e'))){_0x16c383[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x2ca017[_0x0c90('0x37')]['limit']);_0x16c383[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x2ca017['query'][_0x0c90('0x21')]);}return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})['then'](function(_0x199d05){if(_0x199d05){return _0x199d05?{'count':_0x57eab8,'rows':_0x199d05}:null;}})[_0x0c90('0x2a')](respondWithResult(_0x1bf6e0,null))['catch'](handleError(_0x1bf6e0,null));};exports['getTeams']=function(_0x13c69c,_0x407c6e,_0x4859e9){var _0x391e3f={};var _0x4fee0e={};var _0x37d1d5;var _0x4c142b;return db['VoicePrefix'][_0x0c90('0x7a')]({'where':{'id':_0x13c69c[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x407c6e,null))['then'](function(_0x54846c){if(_0x54846c){_0x37d1d5=_0x54846c;_0x4fee0e[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x7d')][_0x0c90('0x33')]);_0x4fee0e[_0x0c90('0x37')]=_['keys'](_0x13c69c[_0x0c90('0x37')]);_0x4fee0e['filters']=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],_0x4fee0e[_0x0c90('0x37')]);_0x391e3f[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x13c69c['query']['fields']));_0x391e3f[_0x0c90('0x3b')]=_0x391e3f[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x391e3f[_0x0c90('0x3b')]:_0x4fee0e[_0x0c90('0x36')];_0x391e3f[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x13c69c[_0x0c90('0x37')]['sort']);_0x391e3f[_0x0c90('0x41')]=qs['filters'](_[_0x0c90('0x42')](_0x13c69c[_0x0c90('0x37')],_0x4fee0e[_0x0c90('0x39')]));if(_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]){_0x391e3f[_0x0c90('0x41')]=_[_0x0c90('0x44')](_0x391e3f['where'],{'$or':_['map'](_0x391e3f[_0x0c90('0x3b')],function(_0x4a001d){var _0x2204fe={};_0x2204fe[_0x4a001d]={'$like':'%'+_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x2204fe;})});}_0x391e3f=_['merge']({},_0x391e3f,_0x13c69c[_0x0c90('0x4b')]);return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x30be13){if(_0x30be13){_0x4c142b=_0x30be13[_0x0c90('0x3d')];if(!_0x13c69c['query']['hasOwnProperty'](_0x0c90('0x3e'))){_0x391e3f[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x23')]);_0x391e3f[_0x0c90('0x21')]=qs['offset'](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x21')]);}return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x5103ae){if(_0x5103ae){return _0x5103ae?{'count':_0x4c142b,'rows':_0x5103ae}:null;}})['then'](respondWithResult(_0x407c6e,null))[_0x0c90('0x4c')](handleError(_0x407c6e,null));};exports[_0x0c90('0x7f')]=function(_0x59e8d9,_0x9bed36,_0x379a0e){var _0x19a144=_0x59e8d9[_0x0c90('0x52')][_0x0c90('0x73')];var _0x5379bc;return db[_0x0c90('0x7d')]['findAll']({'where':{'id':_0x19a144},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id',_0x0c90('0x30'),'online',_0x0c90('0x81'),_0x0c90('0x82')],'raw':!![]}]})[_0x0c90('0x2a')](function(_0x5f295e){if(_0x5f295e){_0x5379bc=_0x5f295e;var _0x5a2961=_['flatMap'](_0x5f295e,function(_0x4930cd){var _0x2858a9=_0x4930cd[_0x0c90('0x2b')]({'plain':!![]});return _0x2858a9['Agents'];});return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x59e8d9['params']['id']}})[_0x0c90('0x2a')](function(_0x13c0f2){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x1091fb){return _0x13c0f2['addTeams'](_0x19a144,{'transaction':_0x1091fb})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5379bc,function(_0x35ee25){return db[_0x0c90('0x84')][_0x0c90('0x85')]({'TeamId':_0x35ee25['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},{'transaction':_0x1091fb});});})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5a2961,function(_0x3614d1){return db[_0x0c90('0x86')]['findOrCreate']({'where':{'UserId':_0x3614d1['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},'transaction':_0x1091fb});});})['then'](function(){_0x5a2961[_0x0c90('0x87')](function(_0x40dd25){socket[_0x0c90('0x75')]('userVoicePrefix:save',{'UserId':_0x40dd25['id'],'VoicePrefixId':_0x13c0f2['id']});});});});});}})[_0x0c90('0x2a')](respondWithStatusCode(_0x9bed36,null))['catch'](handleError(_0x9bed36,null));};exports[_0x0c90('0x88')]=function(_0x1c2814,_0x2f542b,_0x3f3787){return db[_0x0c90('0x7d')][_0x0c90('0x48')]({'where':{'id':_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')]},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f542b,null))[_0x0c90('0x2a')](function(_0x31dde9){var _0x37acdc=_['map'](_0x31dde9,'id');var _0x5f431d=[];var _0x2dabe6=[];var _0x28736e=squel['select']();_0x28736e['field'](_0x0c90('0x89'))[_0x0c90('0x8a')]('team_has_voice_prefixes','tq')[_0x0c90('0x8b')](_0x0c90('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c90('0x41')](_0x0c90('0x8d'),_0x1c2814['params']['id']);for(var _0x1fb55a=0x0;_0x1fb55a<_0x31dde9['length'];_0x1fb55a+=0x1){let _0x5aa532=_0x31dde9[_0x1fb55a];for(var _0x8e8e30=0x0;_0x8e8e30<_0x5aa532[_0x0c90('0x80')]['length'];_0x8e8e30+=0x1){let _0x5c942d=_0x5aa532[_0x0c90('0x80')][_0x8e8e30];var _0x155915=_0x28736e[_0x0c90('0x8e')]();_0x155915[_0x0c90('0x41')](_0x0c90('0x8f'),_0x5c942d['id']);_0x2dabe6['push'](db[_0x0c90('0x6f')][_0x0c90('0x37')](_0x155915[_0x0c90('0x90')](),{'type':db[_0x0c90('0x6f')][_0x0c90('0x91')][_0x0c90('0x92')]})['then'](function(_0x18cc89){if(_0x18cc89['length']===0x1){return _0x5c942d['id'];}else{var _0x5e6e8f=_['every'](_[_0x0c90('0x32')](_0x18cc89,_0x0c90('0x93')),function(_0x53c760){return _[_0x0c90('0x94')](_0x37acdc,_0x53c760);});if(_0x5e6e8f){return _0x5c942d['id'];}}}));}}return BPromise['all'](_0x2dabe6)['then'](function(_0x22b3df){_0x5f431d=_(_0x5f431d)[_0x0c90('0x95')](_0x22b3df)[_0x0c90('0x96')]()[_0x0c90('0x97')]();return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x1c2814[_0x0c90('0x4a')]['id']}})['then'](function(_0x2eece9){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x3817a4){return _0x2eece9[_0x0c90('0x88')](_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')],{'transaction':_0x3817a4})[_0x0c90('0x2a')](function(){if(!_[_0x0c90('0x98')](_0x5f431d)){return _0x2eece9[_0x0c90('0x99')](_0x5f431d,{'transaction':_0x3817a4});}})[_0x0c90('0x2a')](function(){_0x5f431d[_0x0c90('0x87')](function(_0x9187af){socket[_0x0c90('0x75')]('userVoicePrefix:remove',{'UserId':_0x9187af,'VoicePrefixId':_0x2eece9['id']});});});});});});})[_0x0c90('0x2a')](respondWithStatusCode(_0x2f542b,null))[_0x0c90('0x4c')](handleError(_0x2f542b,null));}; \ No newline at end of file +var _0xb03e=['from','team_has_voice_prefixes','join','user_has_teams','clone','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId'];(function(_0x42eb0c,_0x28f7fc){var _0xbf441c=function(_0x474d0c){while(--_0x474d0c){_0x42eb0c['push'](_0x42eb0c['shift']());}};_0xbf441c(++_0x28f7fc);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1e6c14,_0x2b3fbc){_0x1e6c14=_0x1e6c14-0x0;var _0x4af44e=_0xb03e[_0x1e6c14];return _0x4af44e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];config[_0xeb03('0x1b')]=_[_0xeb03('0x1c')](config[_0xeb03('0x1b')],{'host':_0xeb03('0x1d'),'port':0x18eb});var socket=require(_0xeb03('0x1e'))(new Redis(config[_0xeb03('0x1b')]));require('./voicePrefix.socket')[_0xeb03('0x1f')](socket);function respondWithStatusCode(_0x100bef,_0x372c71){_0x372c71=_0x372c71||0xcc;return function(_0x33f9ba){if(_0x33f9ba){return _0x100bef['sendStatus'](_0x372c71);}return _0x100bef[_0xeb03('0x20')](_0x372c71)[_0xeb03('0x21')]();};}function respondWithResult(_0x3f26ef,_0x478989){_0x478989=_0x478989||0xc8;return function(_0x7ce874){if(_0x7ce874){return _0x3f26ef[_0xeb03('0x20')](_0x478989)[_0xeb03('0x22')](_0x7ce874);}};}function respondWithFilteredResult(_0x44716c,_0x42fa4e){return function(_0x1b4cbd){if(_0x1b4cbd){var _0x167a33=typeof _0x42fa4e[_0xeb03('0x23')]===_0xeb03('0x24')&&typeof _0x42fa4e[_0xeb03('0x25')]===_0xeb03('0x24');var _0x2c238d=_0x1b4cbd[_0xeb03('0x26')];var _0x19bddf=_0x167a33?0x0:_0x42fa4e['offset'];var _0x1bea3f=_0x167a33?_0x1b4cbd[_0xeb03('0x26')]:_0x42fa4e[_0xeb03('0x23')]+_0x42fa4e[_0xeb03('0x25')];var _0xe5a1c2;if(_0x1bea3f>=_0x2c238d){_0x1bea3f=_0x2c238d;_0xe5a1c2=0xc8;}else{_0xe5a1c2=0xce;}_0x44716c[_0xeb03('0x20')](_0xe5a1c2);return _0x44716c[_0xeb03('0x27')](_0xeb03('0x28'),_0x19bddf+'-'+_0x1bea3f+'/'+_0x2c238d)[_0xeb03('0x22')](_0x1b4cbd);}return null;};}function patchUpdates(_0x5a704b){return function(_0x712ac2){try{jsonpatch[_0xeb03('0x29')](_0x712ac2,_0x5a704b,!![]);}catch(_0x11ea85){return BPromise[_0xeb03('0x2a')](_0x11ea85);}return _0x712ac2[_0xeb03('0x2b')]();};}function saveUpdates(_0x5dcda3,_0x638353){return function(_0x406864){if(_0x406864){return _0x406864[_0xeb03('0x2c')](_0x5dcda3)[_0xeb03('0x2d')](function(_0x3f276a){return _0x3f276a;});}return null;};}function removeEntity(_0x119697,_0xb04f34){return function(_0x3f68f3){if(_0x3f68f3){return _0x3f68f3[_0xeb03('0x2e')]()['then'](function(){var _0x832372=_0x3f68f3[_0xeb03('0x2f')]({'plain':!![]});var _0x2683f9=_0xeb03('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x2683f9,'resourceId':_0x832372['id']}})[_0xeb03('0x2d')](function(){return _0x3f68f3;});})['then'](function(){_0x119697[_0xeb03('0x20')](0xcc)[_0xeb03('0x21')]();});}};}function handleEntityNotFound(_0x160a37,_0x5db8bb){return function(_0xd4c8ec){if(!_0xd4c8ec){_0x160a37['sendStatus'](0x194);}return _0xd4c8ec;};}function handleError(_0x5cb729,_0x49e316){_0x49e316=_0x49e316||0x1f4;return function(_0x538d19){logger[_0xeb03('0x31')](_0x538d19[_0xeb03('0x32')]);if(_0x538d19['name']){delete _0x538d19['name'];}_0x5cb729['status'](_0x49e316)['send'](_0x538d19);};}exports[_0xeb03('0x33')]=function(_0x3655c3,_0x32aff7){var _0x2d2ddd={},_0x19fa35={},_0x5234dc={'count':0x0,'rows':[]};var _0x13efc6=_['map'](db[_0xeb03('0x34')][_0xeb03('0x35')],function(_0x19ceae){return{'name':_0x19ceae[_0xeb03('0x36')],'type':_0x19ceae[_0xeb03('0x37')][_0xeb03('0x38')]};});_0x19fa35[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x13efc6,'name');_0x19fa35[_0xeb03('0x3b')]=_['keys'](_0x3655c3[_0xeb03('0x3b')]);_0x19fa35[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x19fa35[_0xeb03('0x39')],_0x19fa35[_0xeb03('0x3b')]);_0x2d2ddd[_0xeb03('0x3e')]=_['intersection'](_0x19fa35[_0xeb03('0x39')],qs['fields'](_0x3655c3['query']['fields']));_0x2d2ddd[_0xeb03('0x3e')]=_0x2d2ddd[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x2d2ddd[_0xeb03('0x3e')]:_0x19fa35[_0xeb03('0x39')];if(!_0x3655c3['query'][_0xeb03('0x40')](_0xeb03('0x41'))){_0x2d2ddd[_0xeb03('0x25')]=qs['limit'](_0x3655c3['query'][_0xeb03('0x25')]);_0x2d2ddd[_0xeb03('0x23')]=qs[_0xeb03('0x23')](_0x3655c3['query'][_0xeb03('0x23')]);}_0x2d2ddd[_0xeb03('0x42')]=qs['sort'](_0x3655c3['query'][_0xeb03('0x43')]);_0x2d2ddd[_0xeb03('0x44')]=qs['filters'](_[_0xeb03('0x45')](_0x3655c3[_0xeb03('0x3b')],_0x19fa35[_0xeb03('0x3c')]),_0x13efc6);if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x2d2ddd[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x2d2ddd[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x13efc6,function(_0x286f48){if(_0x286f48[_0xeb03('0x37')]!==_0xeb03('0x48')){var _0x2a9348={};_0x2a9348[_0x286f48[_0xeb03('0x49')]]={'$like':'%'+_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]+'%'};return _0x2a9348;}})});}_0x2d2ddd=_[_0xeb03('0x47')]({},_0x2d2ddd,_0x3655c3[_0xeb03('0x4a')]);var _0x35e53d={'where':_0x2d2ddd[_0xeb03('0x44')]};return db[_0xeb03('0x34')][_0xeb03('0x26')](_0x35e53d)[_0xeb03('0x2d')](function(_0x5bb7d9){_0x5234dc['count']=_0x5bb7d9;if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x4b')]){_0x2d2ddd[_0xeb03('0x4c')]=[{'all':!![]}];}return db[_0xeb03('0x34')][_0xeb03('0x4d')](_0x2d2ddd);})[_0xeb03('0x2d')](function(_0x103c78){_0x5234dc[_0xeb03('0x4e')]=_0x103c78;return _0x5234dc;})['then'](respondWithFilteredResult(_0x32aff7,_0x2d2ddd))[_0xeb03('0x4f')](handleError(_0x32aff7,null));};exports[_0xeb03('0x50')]=function(_0x275d4d,_0xe9dcb0){var _0x528c0f={'raw':![],'where':{'id':_0x275d4d['params']['id']}},_0x57f59e={};_0x57f59e[_0xeb03('0x39')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x57f59e[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x275d4d[_0xeb03('0x3b')]);_0x57f59e[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x57f59e[_0xeb03('0x39')],_0x57f59e['query']);_0x528c0f[_0xeb03('0x3e')]=_['intersection'](_0x57f59e['model'],qs[_0xeb03('0x52')](_0x275d4d[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x528c0f['attributes']=_0x528c0f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x528c0f[_0xeb03('0x3e')]:_0x57f59e[_0xeb03('0x39')];if(_0x275d4d[_0xeb03('0x3b')]['includeAll']){_0x528c0f[_0xeb03('0x4c')]=[{'all':!![]}];}_0x528c0f=_['merge']({},_0x528c0f,_0x275d4d[_0xeb03('0x4a')]);return db[_0xeb03('0x34')][_0xeb03('0x53')](_0x528c0f)[_0xeb03('0x2d')](handleEntityNotFound(_0xe9dcb0,null))[_0xeb03('0x2d')](respondWithResult(_0xe9dcb0,null))[_0xeb03('0x4f')](handleError(_0xe9dcb0,null));};exports[_0xeb03('0x2e')]=function(_0x292319,_0x38c993){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x292319[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x38c993,null))[_0xeb03('0x2d')](removeEntity(_0x38c993,null))[_0xeb03('0x4f')](handleError(_0x38c993,null));};exports[_0xeb03('0x55')]=function(_0xf5c1ab,_0x79b7c6){return db[_0xeb03('0x34')][_0xeb03('0x55')]()[_0xeb03('0x2d')](respondWithResult(_0x79b7c6,null))[_0xeb03('0x4f')](handleError(_0x79b7c6,null));};exports[_0xeb03('0x56')]=function(_0x365520,_0x509d79){var _0x17112e;return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0x5405b4){return db[_0xeb03('0x34')][_0xeb03('0x56')](_0x365520[_0xeb03('0x59')],{'transaction':_0x5405b4})[_0xeb03('0x2d')](function(_0x103da5){_0x17112e=_0x103da5[_0xeb03('0x2f')]({'plain':!![]});return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x17112e[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x46f52e){return createVoicePrefixExtensions(_0x17112e,_0x46f52e,_0x5405b4);});});})[_0xeb03('0x2d')](function(){var _0xf9beaf=_0x365520[_0xeb03('0x5c')]['get']({'plain':!![]});if(!_0xf9beaf)throw new Error(_0xeb03('0x5d'));if(_0xf9beaf[_0xeb03('0x5e')]===_0xeb03('0x5c')){var _0x259db7=_0x17112e;return db[_0xeb03('0x5f')][_0xeb03('0x53')]({'where':{'name':_0xeb03('0x30'),'userProfileId':_0xf9beaf[_0xeb03('0x60')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x23406a){if(_0x23406a&&_0x23406a['autoAssociation']===0x0){return db[_0xeb03('0x61')][_0xeb03('0x56')]({'name':_0x259db7[_0xeb03('0x49')],'resourceId':_0x259db7['id'],'type':_0x23406a[_0xeb03('0x49')],'sectionId':_0x23406a['id']},{})['then'](function(){return _0x17112e;});}else{return _0x17112e;}})[_0xeb03('0x4f')](function(_0x68e1b7){logger[_0xeb03('0x31')](_0xeb03('0x62'),_0x68e1b7);throw _0x68e1b7;});}return _0x17112e;})[_0xeb03('0x2d')](respondWithResult(_0x509d79,null))['catch'](handleError(_0x509d79,null));};function Extension(_0x43efc3,_0x10beeb,_0x28e488,_0x5e1361){this[_0xeb03('0x63')]=_0xeb03('0x64');this['exten']=_0x43efc3;this[_0xeb03('0x65')]=_0x28e488;this[_0xeb03('0x37')]=_0xeb03('0x66');this['description']=_0xeb03('0x67');this[_0xeb03('0x68')]=_0x10beeb;this['appdata']=_0x5e1361;}function createVoicePrefixExtensions(_0x3eb482,_0xfeb8e2,_0x1972fb){return new BPromise(function(_0x3ac2de,_0x3963a7){var _0x38618e=new Extension(formatPrefixName(_0x3eb482[_0xeb03('0x69')]),0x1,_0xeb03('0x6a'),'Voice\x20Prefix');_0x38618e[_0xeb03('0x6b')]=_0x3eb482['id'];return db['VoiceExtension'][_0xeb03('0x56')](_0x38618e,{'transaction':_0x1972fb})[_0xeb03('0x2d')](function(_0x3a9518){var _0x59d0c7=_0x3a9518[_0xeb03('0x2f')]({'plain':!![]});var _0x1508f6=_[_0xeb03('0x3a')](addVoicePrefixExtensions(_0x3eb482,_0xfeb8e2),function(_0x467a9d){_0x467a9d['VoiceExtensionId']=_0x59d0c7['id'];_0x467a9d[_0xeb03('0x6b')]=_0x3eb482['id'];return _0x467a9d;});return db[_0xeb03('0x5a')]['bulkCreate'](_0x1508f6,{'transaction':_0x1972fb})['then'](function(_0x583518){if(!_0x583518){return _0x3963a7(_0xeb03('0x6c'));}else{return _0x3ac2de(_0x583518);}})[_0xeb03('0x4f')](function(_0x9148a6){return _0x3963a7(_0x9148a6);});});;});};function addVoicePrefixExtensions(_0x16ad3a,_0x3da5f4){var _0x461777=[];var _0x443fc9=formatPrefixName(_0x16ad3a[_0xeb03('0x69')]);_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x2,'Set','CDR(prefix)='+_0x16ad3a[_0xeb03('0x49')]));if(_0x16ad3a[_0xeb03('0x6e')]){_0x461777['push'](new Extension(_0x443fc9,0x3,_0xeb03('0x6f'),_0xeb03('0x70')+_0x16ad3a[_0xeb03('0x6e')]));}else{_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x3,'NoOp','No\x20callerid\x20available'));}_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x4,_0xeb03('0x71'),_0x3da5f4[_0xeb03('0x63')]+','+_0xeb03('0x72')+(0x8+_0x16ad3a[_0xeb03('0x49')][_0xeb03('0x3f')])+'}'+','+0x1));return _0x461777;}function formatPrefixName(_0x1a8057){var _0x2ee5c1='_';for(var _0x2e67a4=0x0;_0x2e67a4<_0x1a8057[_0xeb03('0x3f')];_0x2e67a4++){if(_0x1a8057[_0xeb03('0x73')](_0x2e67a4)=='-'){_0x2ee5c1+=_0x1a8057['charAt'](_0x2e67a4);}else{_0x2ee5c1+='['+_0x1a8057['charAt'](_0x2e67a4)+']';}}_0x2ee5c1+='.';return _0x2ee5c1;}exports[_0xeb03('0x2c')]=function(_0x4e52a4,_0x1099ff,_0x4cf4f1){var _0x30623a=_0x4e52a4['body'];_0x30623a[_0xeb03('0x69')]=_0xeb03('0x74')+_0x30623a['name']+'-';return db[_0xeb03('0x57')]['transaction'](function(_0x45f0aa){return db['VoicePrefix'][_0xeb03('0x2c')](_0x30623a,{'where':{'id':_0x30623a['id']},'transaction':_0x45f0aa})['then'](function(){return db['VoiceExtension'][_0xeb03('0x2e')]({'where':{'VoicePrefixId':_0x30623a['id']},'transaction':_0x45f0aa})[_0xeb03('0x2d')](function(){return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x30623a[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x39c15d){return createVoicePrefixExtensions(_0x30623a,_0x39c15d,_0x45f0aa);});});});})['then'](function(){return db[_0xeb03('0x34')][_0xeb03('0x75')](_0x30623a['id']);})[_0xeb03('0x2d')](respondWithResult(_0x1099ff,null))[_0xeb03('0x4f')](handleError(_0x1099ff,null));};exports[_0xeb03('0x76')]=function(_0x126a7f,_0x137a98,_0x4fff6e){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x126a7f[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x137a98,null))[_0xeb03('0x2d')](function(_0xcd7ab1){if(_0xcd7ab1){return _0xcd7ab1[_0xeb03('0x76')](_0x126a7f[_0xeb03('0x59')]['ids'],_[_0xeb03('0x77')](_0x126a7f[_0xeb03('0x59')],[_0xeb03('0x78'),'id'])||{})[_0xeb03('0x79')](function(_0x17c010){for(var _0x5ace77=0x0;_0x5ace77<_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0xeb03('0x3f')];_0x5ace77+=0x1){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':Number(_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0x5ace77]),'VoicePrefixId':Number(_0x126a7f['params']['id'])});}return _0x17c010;});}})[_0xeb03('0x2d')](respondWithResult(_0x137a98,null))[_0xeb03('0x4f')](handleError(_0x137a98,null));};exports[_0xeb03('0x7c')]=function(_0x21dfab,_0x396329,_0x48dc21){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x21dfab[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x396329,null))[_0xeb03('0x2d')](function(_0x215759){if(_0x215759){return _0x215759[_0xeb03('0x7c')](_0x21dfab['query'][_0xeb03('0x78')])[_0xeb03('0x2d')](function(){if(_[_0xeb03('0x7d')](_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')])){for(var _0x388fbd=0x0;_0x388fbd<_0x21dfab['query'][_0xeb03('0x78')][_0xeb03('0x3f')];_0x388fbd+=0x1){socket[_0xeb03('0x7a')]('userVoicePrefix:remove',{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')][_0x388fbd]),'VoicePrefixId':Number(_0x21dfab[_0xeb03('0x54')]['id'])});}}else{socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')]),'VoicePrefixId':Number(_0x21dfab['params']['id'])});}});}})['then'](respondWithStatusCode(_0x396329,null))[_0xeb03('0x4f')](handleError(_0x396329,null));};exports[_0xeb03('0x7f')]=function(_0x3630a7,_0xe55200,_0x511e5a){var _0x8ba377={};var _0x42c477={};var _0x5b60a4;var _0x45fd83;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x3630a7[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0xe55200,null))[_0xeb03('0x2d')](function(_0x5ea593){if(_0x5ea593){_0x5b60a4=_0x5ea593;_0x42c477[_0xeb03('0x39')]=_[_0xeb03('0x51')](db[_0xeb03('0x81')][_0xeb03('0x35')]);_0x42c477[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x3630a7[_0xeb03('0x3b')]);_0x42c477[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x42c477[_0xeb03('0x39')],_0x42c477['query']);_0x8ba377[_0xeb03('0x3e')]=_[_0xeb03('0x3d')](_0x42c477['model'],qs[_0xeb03('0x52')](_0x3630a7[_0xeb03('0x3b')]['fields']));_0x8ba377[_0xeb03('0x3e')]=_0x8ba377[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x8ba377[_0xeb03('0x3e')]:_0x42c477[_0xeb03('0x39')];_0x8ba377['order']=qs['sort'](_0x3630a7['query'][_0xeb03('0x43')]);_0x8ba377['where']=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x3630a7[_0xeb03('0x3b')],_0x42c477[_0xeb03('0x3c')]));if(_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x8ba377[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x8ba377[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x8ba377[_0xeb03('0x3e')],function(_0x27a388){var _0x4ec45c={};_0x4ec45c[_0x27a388]={'$like':'%'+_0x3630a7['query'][_0xeb03('0x46')]+'%'};return _0x4ec45c;})});}_0x8ba377=_['merge']({},_0x8ba377,_0x3630a7['options']);return _0x5b60a4[_0xeb03('0x7f')](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x502b25){if(_0x502b25){_0x45fd83=_0x502b25['length'];if(!_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x40')]('nolimit')){_0x8ba377[_0xeb03('0x25')]=qs[_0xeb03('0x25')](_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x8ba377[_0xeb03('0x23')]=qs['offset'](_0x3630a7[_0xeb03('0x3b')]['offset']);}return _0x5b60a4['getAgents'](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x2d12eb){if(_0x2d12eb){return _0x2d12eb?{'count':_0x45fd83,'rows':_0x2d12eb}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xe55200,null))[_0xeb03('0x4f')](handleError(_0xe55200,null));};exports['getTeams']=function(_0x4b59f4,_0xf9f2d3,_0x847253){var _0x70343f={};var _0x2d6225={};var _0x388642;var _0x3dc483;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x4b59f4['params']['id']}})['then'](handleEntityNotFound(_0xf9f2d3,null))[_0xeb03('0x2d')](function(_0x5741d4){if(_0x5741d4){_0x388642=_0x5741d4;_0x2d6225[_0xeb03('0x39')]=_['keys'](db[_0xeb03('0x82')][_0xeb03('0x35')]);_0x2d6225[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x4b59f4[_0xeb03('0x3b')]);_0x2d6225[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],_0x2d6225['query']);_0x70343f['attributes']=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],qs[_0xeb03('0x52')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x70343f['attributes']=_0x70343f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x70343f['attributes']:_0x2d6225[_0xeb03('0x39')];_0x70343f[_0xeb03('0x42')]=qs[_0xeb03('0x43')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x43')]);_0x70343f[_0xeb03('0x44')]=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x4b59f4[_0xeb03('0x3b')],_0x2d6225[_0xeb03('0x3c')]));if(_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x70343f[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x70343f['where'],{'$or':_[_0xeb03('0x3a')](_0x70343f[_0xeb03('0x3e')],function(_0x4c6b85){var _0x1f3ee1={};_0x1f3ee1[_0x4c6b85]={'$like':'%'+_0x4b59f4['query'][_0xeb03('0x46')]+'%'};return _0x1f3ee1;})});}_0x70343f=_['merge']({},_0x70343f,_0x4b59f4[_0xeb03('0x4a')]);return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x1df994){if(_0x1df994){_0x3dc483=_0x1df994[_0xeb03('0x3f')];if(!_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x40')](_0xeb03('0x41'))){_0x70343f['limit']=qs[_0xeb03('0x25')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x70343f[_0xeb03('0x23')]=qs['offset'](_0x4b59f4[_0xeb03('0x3b')]['offset']);}return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x423ddd){if(_0x423ddd){return _0x423ddd?{'count':_0x3dc483,'rows':_0x423ddd}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xf9f2d3,null))['catch'](handleError(_0xf9f2d3,null));};exports[_0xeb03('0x84')]=function(_0x473d63,_0x1fc15a,_0x45f4d3){var _0x5095a6=_0x473d63[_0xeb03('0x59')]['ids'];var _0x4e0fd8;return db['Team'][_0xeb03('0x4d')]({'where':{'id':_0x5095a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb03('0x85'),'attributes':['id',_0xeb03('0x49'),_0xeb03('0x86'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x50b2c5){if(_0x50b2c5){_0x4e0fd8=_0x50b2c5;var _0x5c7f6e=_[_0xeb03('0x87')](_0x50b2c5,function(_0x392aaa){var _0x117c5e=_0x392aaa[_0xeb03('0x2f')]({'plain':!![]});return _0x117c5e[_0xeb03('0x85')];});return db[_0xeb03('0x34')]['find']({'where':{'id':_0x473d63[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x2d8bca){return db[_0xeb03('0x57')]['transaction'](function(_0x5c49c9){return _0x2d8bca[_0xeb03('0x84')](_0x5095a6,{'transaction':_0x5c49c9})[_0xeb03('0x2d')](function(){return BPromise['each'](_0x4e0fd8,function(_0xc7a504){return db[_0xeb03('0x88')][_0xeb03('0x89')]({'TeamId':_0xc7a504['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},{'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){return BPromise[_0xeb03('0x8a')](_0x5c7f6e,function(_0x11cc99){return db['UserVoicePrefix'][_0xeb03('0x8b')]({'where':{'UserId':_0x11cc99['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){_0x5c7f6e[_0xeb03('0x8c')](function(_0x1f2ebe){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':_0x1f2ebe['id'],'VoicePrefixId':_0x2d8bca['id']});});});});});}})[_0xeb03('0x2d')](respondWithStatusCode(_0x1fc15a,null))['catch'](handleError(_0x1fc15a,null));};exports[_0xeb03('0x8d')]=function(_0x5e0e2b,_0x497a5b,_0x188d39){return db[_0xeb03('0x82')]['findAll']({'where':{'id':_0x5e0e2b[_0xeb03('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeb03('0x81')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeb03('0x2d')](handleEntityNotFound(_0x497a5b,null))[_0xeb03('0x2d')](function(_0xd6f37b){var _0x1522d4=_[_0xeb03('0x3a')](_0xd6f37b,'id');var _0x47b648=[];var _0x15a726=[];var _0x226569=squel[_0xeb03('0x8e')]();_0x226569[_0xeb03('0x8f')](_0xeb03('0x90'))[_0xeb03('0x91')](_0xeb03('0x92'),'tq')[_0xeb03('0x93')](_0xeb03('0x94'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x5e0e2b[_0xeb03('0x54')]['id']);for(var _0x40a6ce=0x0;_0x40a6ce<_0xd6f37b[_0xeb03('0x3f')];_0x40a6ce+=0x1){let _0x2f640d=_0xd6f37b[_0x40a6ce];for(var _0x546ebe=0x0;_0x546ebe<_0x2f640d['Agents']['length'];_0x546ebe+=0x1){let _0x3d861f=_0x2f640d[_0xeb03('0x85')][_0x546ebe];var _0x2c89c4=_0x226569[_0xeb03('0x95')]();_0x2c89c4[_0xeb03('0x44')]('ut.UserId\x20=\x20?',_0x3d861f['id']);_0x15a726[_0xeb03('0x6d')](db[_0xeb03('0x57')]['query'](_0x2c89c4[_0xeb03('0x96')](),{'type':db['sequelize']['QueryTypes'][_0xeb03('0x97')]})[_0xeb03('0x2d')](function(_0x123742){if(_0x123742['length']===0x1){return _0x3d861f['id'];}else{var _0x243689=_[_0xeb03('0x98')](_['map'](_0x123742,_0xeb03('0x99')),function(_0x5eb15a){return _['includes'](_0x1522d4,_0x5eb15a);});if(_0x243689){return _0x3d861f['id'];}}}));}}return BPromise[_0xeb03('0x9a')](_0x15a726)[_0xeb03('0x2d')](function(_0x366054){_0x47b648=_(_0x47b648)[_0xeb03('0x9b')](_0x366054)[_0xeb03('0x9c')]()[_0xeb03('0x9d')]();return db['VoicePrefix'][_0xeb03('0x53')]({'where':{'id':_0x5e0e2b[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x1f0387){return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0xf0d912){return _0x1f0387[_0xeb03('0x8d')](_0x5e0e2b[_0xeb03('0x3b')][_0xeb03('0x78')],{'transaction':_0xf0d912})[_0xeb03('0x2d')](function(){if(!_[_0xeb03('0x9e')](_0x47b648)){return _0x1f0387[_0xeb03('0x7c')](_0x47b648,{'transaction':_0xf0d912});}})[_0xeb03('0x2d')](function(){_0x47b648[_0xeb03('0x8c')](function(_0x1a0bb5){socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':_0x1a0bb5,'VoicePrefixId':_0x1f0387['id']});});});});});});})[_0xeb03('0x2d')](respondWithStatusCode(_0x497a5b,null))[_0xeb03('0x4f')](handleError(_0x497a5b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e4051bb..89bb9c5 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 _0xa681=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x503d23,_0x5e12d7){var _0x2787da=function(_0x7b14d2){while(--_0x7b14d2){_0x503d23['push'](_0x503d23['shift']());}};_0x2787da(++_0x5e12d7);}(_0xa681,0xb2));var _0x1a68=function(_0x16c4e0,_0x1b9ea4){_0x16c4e0=_0x16c4e0-0x0;var _0x1988d9=_0xa681[_0x16c4e0];return _0x1988d9;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x1a68('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1a68('0x1')](0x0);var events={'afterCreate':_0x1a68('0x2'),'afterUpdate':_0x1a68('0x3'),'afterDestroy':_0x1a68('0x4')};function emitEvent(_0x3304f5){return function(_0x2a8d47,_0x23df1f,_0x2cf0d5){VoicePrefixEvents[_0x1a68('0x5')](_0x3304f5+':'+_0x2a8d47['id'],_0x2a8d47);VoicePrefixEvents['emit'](_0x3304f5,_0x2a8d47);_0x2cf0d5(null);};}for(var e in events){if(events[_0x1a68('0x6')](e)){var event=events[e];VoicePrefix[_0x1a68('0x7')](e,emitEvent(event));}}module[_0x1a68('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xe5d9=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit'];(function(_0x47aca7,_0x146518){var _0x524aef=function(_0x3ddac1){while(--_0x3ddac1){_0x47aca7['push'](_0x47aca7['shift']());}};_0x524aef(++_0x146518);}(_0xe5d9,0x192));var _0x9e5d=function(_0x46c865,_0x154b2f){_0x46c865=_0x46c865-0x0;var _0x200973=_0xe5d9[_0x46c865];return _0x200973;};'use strict';var EventEmitter=require(_0x9e5d('0x0'));var VoicePrefix=require(_0x9e5d('0x1'))['db'][_0x9e5d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9e5d('0x3')](0x0);var events={'afterCreate':_0x9e5d('0x4'),'afterUpdate':_0x9e5d('0x5'),'afterDestroy':_0x9e5d('0x6')};function emitEvent(_0x1d53e2){return function(_0x187318,_0x334bf0,_0x408954){VoicePrefixEvents[_0x9e5d('0x7')](_0x1d53e2+':'+_0x187318['id'],_0x187318);VoicePrefixEvents[_0x9e5d('0x7')](_0x1d53e2,_0x187318);_0x408954(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x9e5d('0x8')](e,emitEvent(event));}}module[_0x9e5d('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a8505ac..6bbc884 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 _0xa9c9=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','lodash','../../config/logger'];(function(_0x3e5bd8,_0xccabb3){var _0x451883=function(_0x1877dc){while(--_0x1877dc){_0x3e5bd8['push'](_0x3e5bd8['shift']());}};_0x451883(++_0xccabb3);}(_0xa9c9,0xf6));var _0x9a9c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xa9c9[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x9a9c('0x0'));var util=require('util');var logger=require(_0x9a9c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a9c('0x2'));var rimraf=require(_0x9a9c('0x3'));var config=require(_0x9a9c('0x4'));var attributes=require(_0x9a9c('0x5'));module[_0x9a9c('0x6')]=function(_0x413bc0,_0x1a7a47){return _0x413bc0['define'](_0x9a9c('0x7'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb67c=['api','moment','bluebird','path','rimraf','exports','VoicePrefix','voice_prefixes','util'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xb67c,0x155));var _0xcb67=function(_0x35a0e2,_0x302ad1){_0x35a0e2=_0x35a0e2-0x0;var _0x31ea9a=_0xb67c[_0x35a0e2];return _0x31ea9a;};'use strict';var _=require('lodash');var util=require(_0xcb67('0x0'));var logger=require('../../config/logger')(_0xcb67('0x1'));var moment=require(_0xcb67('0x2'));var BPromise=require(_0xcb67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb67('0x4'));var rimraf=require(_0xcb67('0x5'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0xcb67('0x6')]=function(_0x5d87f3,_0x130f24){return _0x5d87f3['define'](_0xcb67('0x7'),attributes,{'tableName':_0xcb67('0x8'),'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 1d269d9..7bfdf7a 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 _0x1228=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x5a17dd,_0x371fcc){var _0x354e54=function(_0x4bad56){while(--_0x4bad56){_0x5a17dd['push'](_0x5a17dd['shift']());}};_0x354e54(++_0x371fcc);}(_0x1228,0x12f));var _0x8122=function(_0x4a2171,_0x2ded2d){_0x4a2171=_0x4a2171-0x0;var _0x5d9cf3=_0x1228[_0x4a2171];return _0x5d9cf3;};'use strict';var _=require(_0x8122('0x0'));var util=require('util');var moment=require(_0x8122('0x1'));var BPromise=require('bluebird');var rs=require(_0x8122('0x2'));var fs=require('fs');var Redis=require(_0x8122('0x3'));var db=require(_0x8122('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8122('0x5'))(_0x8122('0x6'));var config=require('../../config/environment');var jayson=require(_0x8122('0x7'));var client=jayson[_0x8122('0x8')]['http']({'port':0x232a});config[_0x8122('0x9')]=_[_0x8122('0xa')](config['redis'],{'host':_0x8122('0xb'),'port':0x18eb});var socket=require(_0x8122('0xc'))(new Redis(config['redis']));require(_0x8122('0xd'))[_0x8122('0xe')](socket);function respondWithRpcPromise(_0x4a1378,_0x5a7875,_0x4fa7b3){return new BPromise(function(_0x52f48b,_0x208043){return client['request'](_0x4a1378,_0x4fa7b3)[_0x8122('0xf')](function(_0x23a9e4){logger[_0x8122('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x5a7875,_0x8122('0x11'));logger['debug'](_0x8122('0x12'),_0x5a7875,_0x8122('0x11'),JSON[_0x8122('0x13')](_0x23a9e4));if(_0x23a9e4[_0x8122('0x14')]){if(_0x23a9e4[_0x8122('0x14')][_0x8122('0x15')]===0x1f4){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);return _0x208043(_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);}logger['error'](_0x8122('0x16'),_0x5a7875,_0x23a9e4['error'][_0x8122('0x17')]);return _0x52f48b(_0x23a9e4['error'][_0x8122('0x17')]);}else{logger[_0x8122('0x10')](_0x8122('0x16'),_0x5a7875,_0x8122('0x11'));_0x52f48b(_0x23a9e4['result']['message']);}})['catch'](function(_0x56a926){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x56a926);_0x208043(_0x56a926);});});} \ No newline at end of file +var _0x6144=['register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x141fba,_0x5d3b47){var _0x54568e=function(_0x2b79cf){while(--_0x2b79cf){_0x141fba['push'](_0x141fba['shift']());}};_0x54568e(++_0x5d3b47);}(_0x6144,0x99));var _0x4614=function(_0x4b69f9,_0x352ea9){_0x4b69f9=_0x4b69f9-0x0;var _0x1c1a47=_0x6144[_0x4b69f9];return _0x1c1a47;};'use strict';var _=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var moment=require(_0x4614('0x2'));var BPromise=require(_0x4614('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4614('0x4'));var db=require(_0x4614('0x5'))['db'];var utils=require(_0x4614('0x6'));var logger=require(_0x4614('0x7'))('rpc');var config=require(_0x4614('0x8'));var jayson=require(_0x4614('0x9'));var client=jayson[_0x4614('0xa')][_0x4614('0xb')]({'port':0x232a});config[_0x4614('0xc')]=_['defaults'](config[_0x4614('0xc')],{'host':_0x4614('0xd'),'port':0x18eb});var socket=require(_0x4614('0xe'))(new Redis(config[_0x4614('0xc')]));require('./voicePrefix.socket')[_0x4614('0xf')](socket);function respondWithRpcPromise(_0x3953bd,_0x7df8c,_0x3c339c){return new BPromise(function(_0x270e8d,_0x2b0439){return client[_0x4614('0x10')](_0x3953bd,_0x3c339c)['then'](function(_0x3f4202){logger[_0x4614('0x11')](_0x4614('0x12'),_0x7df8c,_0x4614('0x13'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x7df8c,_0x4614('0x13'),JSON[_0x4614('0x14')](_0x3f4202));if(_0x3f4202[_0x4614('0x15')]){if(_0x3f4202['error']['code']===0x1f4){logger['error'](_0x4614('0x12'),_0x7df8c,_0x3f4202[_0x4614('0x15')]['message']);return _0x2b0439(_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);}logger[_0x4614('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x7df8c,_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);return _0x270e8d(_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);}else{logger[_0x4614('0x11')](_0x4614('0x12'),_0x7df8c,'request\x20sent');_0x270e8d(_0x3f4202[_0x4614('0x17')][_0x4614('0x16')]);}})['catch'](function(_0xb8c6fd){logger[_0x4614('0x15')](_0x4614('0x12'),_0x7df8c,_0xb8c6fd);_0x2b0439(_0xb8c6fd);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b0693c3..28a0526 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 _0x255f=['emit','removeListener','register','voicePrefix:','./voicePrefix.events','remove','update'];(function(_0x33075b,_0x12035f){var _0x203186=function(_0x5d6aea){while(--_0x5d6aea){_0x33075b['push'](_0x33075b['shift']());}};_0x203186(++_0x12035f);}(_0x255f,0x185));var _0xf255=function(_0x15ae3d,_0x70df40){_0x15ae3d=_0x15ae3d-0x0;var _0x8ce8a6=_0x255f[_0x15ae3d];return _0x8ce8a6;};'use strict';var VoicePrefixEvents=require(_0xf255('0x0'));var events=['save',_0xf255('0x1'),_0xf255('0x2')];function createListener(_0xba19b,_0x4fae55){return function(_0x3984f5){_0x4fae55[_0xf255('0x3')](_0xba19b,_0x3984f5);};}function removeListener(_0x474ac5,_0x151b29){return function(){VoicePrefixEvents[_0xf255('0x4')](_0x474ac5,_0x151b29);};}exports[_0xf255('0x5')]=function(_0xc1d19f){for(var _0x5bbed0=0x0,_0x1236fb=events['length'];_0x5bbed0<_0x1236fb;_0x5bbed0++){var _0x481d8c=events[_0x5bbed0];var _0x4a533f=createListener(_0xf255('0x6')+_0x481d8c,_0xc1d19f);VoicePrefixEvents['on'](_0x481d8c,_0x4a533f);}}; \ No newline at end of file +var _0x65f4=['length','voicePrefix:','remove','update','emit','register'];(function(_0x12b507,_0x4aa32c){var _0x4660e3=function(_0x2d1196){while(--_0x2d1196){_0x12b507['push'](_0x12b507['shift']());}};_0x4660e3(++_0x4aa32c);}(_0x65f4,0x19a));var _0x465f=function(_0x2fe705,_0x576f74){_0x2fe705=_0x2fe705-0x0;var _0x4e85f3=_0x65f4[_0x2fe705];return _0x4e85f3;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x465f('0x0'),_0x465f('0x1')];function createListener(_0x34f1ce,_0x59c7cb){return function(_0x584451){_0x59c7cb[_0x465f('0x2')](_0x34f1ce,_0x584451);};}function removeListener(_0x3bf967,_0x307a2b){return function(){VoicePrefixEvents['removeListener'](_0x3bf967,_0x307a2b);};}exports[_0x465f('0x3')]=function(_0xe5a9bd){for(var _0x44d697=0x0,_0x553ce9=events[_0x465f('0x4')];_0x44d697<_0x553ce9;_0x44d697++){var _0x5e26ea=events[_0x44d697];var _0x523ca1=createListener(_0x465f('0x5')+_0x5e26ea,_0xe5a9bd);VoicePrefixEvents['on'](_0x5e26ea,_0x523ca1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a9950c4..ad1f2b2 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xfb9aaa,_0x37935d){var _0x103bf7=function(_0x1e9f2a){while(--_0x1e9f2a){_0xfb9aaa['push'](_0xfb9aaa['shift']());}};_0x103bf7(++_0x37935d);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ce9d,_0x4ff962){_0x2ce9d=_0x2ce9d-0x0;var _0x578428=_0xb10b[_0x2ce9d];return _0x578428;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x572be5,_0x2b75d5){var _0xe63e21=function(_0x3aeff4){while(--_0x3aeff4){_0x572be5['push'](_0x572be5['shift']());}};_0xe63e21(++_0x2b75d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 1211fb4..d5e2437 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 _0xd56b=['mandatoryDisposition','exports','outbound','inbound','STRING','default','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','roundrobin','includes','INTEGER','ENUM','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','onlyIfOpen','always','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x225815,_0x5db310){var _0x47a32e=function(_0xafe283){while(--_0xafe283){_0x225815['push'](_0x225815['shift']());}};_0x47a32e(++_0x5db310);}(_0xd56b,0x187));var _0xbd56=function(_0x2ae5b1,_0x5b500c){_0x2ae5b1=_0x2ae5b1-0x0;var _0x4d5cc7=_0xd56b[_0x2ae5b1];return _0x4d5cc7;};'use strict';var Sequelize=require('sequelize');module[_0xbd56('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0xbd56('0x1')),'allowNull':![],'defaultValue':_0xbd56('0x2')},'musiconhold':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':_0xbd56('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xbd56('0x5'),_0xbd56('0x6'),'fewestcalls',_0xbd56('0x7'),_0xbd56('0x8'),_0xbd56('0x9'),_0xbd56('0xa'),_0xbd56('0xb')),'allowNull':![],'defaultValue':_0xbd56('0x5'),'set':function(_0x3c68a5){this[_0xbd56('0xc')](_0xbd56('0xd'),_0x3c68a5?_0x3c68a5:_0xbd56('0x8'));},'get':function(){var _0x38870b=this[_0xbd56('0xe')](_0xbd56('0xf'));var _0x5c0d06=this[_0xbd56('0xe')](_0xbd56('0x10'));var _0x12a05a=this[_0xbd56('0xe')](_0xbd56('0xd'));if(_0x38870b===_0xbd56('0x1')){if(_0x5c0d06===_0xbd56('0x11')){return null;}if(_0x5c0d06==='booked'&&!['rrmemory',_0xbd56('0x12')][_0xbd56('0x13')](_0x12a05a)){this[_0xbd56('0xc')](_0xbd56('0xd'),'rrmemory');}}return _0x12a05a;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbd56('0x14')](0xb)},'timeout':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xbd56('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':_0xbd56('0x16')},'autopause':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no',_0xbd56('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbd56('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xbd56('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbd56('0x3')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xbd56('0x3')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbd56('0x15')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0xbd56('0x16'),'no',_0xbd56('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xbd56('0x15')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xbd56('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbd56('0x15')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbd56('0x3')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xbd56('0x3')]},'queue_quantity1':{'type':Sequelize[_0xbd56('0x3')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xbd56('0x3')]},'queue_less_than':{'type':Sequelize[_0xbd56('0x3')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2e9f2){this[_0xbd56('0xc')](_0xbd56('0x19'),_0x2e9f2?_0x2e9f2[_0xbd56('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xbd56('0x19'))?this['getDataValue'](_0xbd56('0x19'))[_0xbd56('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':_0xbd56('0x16'),'set':function(_0x3a7861){this['setDataValue'](_0xbd56('0x1c'),_0x3a7861?_0x3a7861[_0xbd56('0x1a')](','):undefined);},'get':function(){return this[_0xbd56('0xe')](_0xbd56('0x1c'))?this[_0xbd56('0xe')](_0xbd56('0x1c'))[_0xbd56('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':'no','set':function(_0x184826){this[_0xbd56('0xc')](_0xbd56('0x1d'),_0x184826?_0x184826[_0xbd56('0x1a')](','):undefined);},'get':function(){return this[_0xbd56('0xe')]('leavewhenempty')?this[_0xbd56('0xe')](_0xbd56('0x1d'))[_0xbd56('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbd56('0x3')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':0x0,'set':function(_0x273aa8){this[_0xbd56('0xc')]('acw',_0x273aa8);if(_0x273aa8){if(this[_0xbd56('0xe')](_0xbd56('0x1f'))<0x2){this[_0xbd56('0xc')](_0xbd56('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbd56('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':0x0,'comment':_0xbd56('0x20')},'dialMethod':{'type':Sequelize[_0xbd56('0x15')]('preview',_0xbd56('0x21'),_0xbd56('0x22'),_0xbd56('0x23'),_0xbd56('0x24')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xbd56('0x14')](0x4)[_0xbd56('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbd56('0x26')},'dialLimitQueue':{'type':Sequelize[_0xbd56('0x14')](0x4)[_0xbd56('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbd56('0x27')},'dialPowerLevel':{'type':Sequelize[_0xbd56('0x28')](0x2)[_0xbd56('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbd56('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xbd56('0x15')](_0xbd56('0x2a'),_0xbd56('0x2b')),'defaultValue':_0xbd56('0x2b'),'comment':_0xbd56('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbd56('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbd56('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xbd56('0x2e'),'comment':_0xbd56('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x30')},'dialQueueProject':{'type':Sequelize[_0xbd56('0x3')],'comment':_0xbd56('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':_0xbd56('0x36')},'dialPrefix':{'type':Sequelize[_0xbd56('0x3')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbd56('0x15')]('always','never',_0xbd56('0x37')),'defaultValue':_0xbd56('0x38')},'dialAMDActive':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xbd56('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xbd56('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbd56('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbd56('0x14')](0x9)[_0xbd56('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbd56('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbd56('0x14')](0x9)[_0xbd56('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xbd56('0x14')](0x9)[_0xbd56('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbd56('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbd56('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbd56('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbd56('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xbd56('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':0x0,'comment':_0xbd56('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbd56('0x3e'),_0xbd56('0x3f')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xbd56('0x3')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbd56('0x40')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)[_0xbd56('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)[_0xbd56('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbd56('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd56('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbd56('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd56('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd56('0x14')],'allowNull':!![],'comment':_0xbd56('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':![],'comment':_0xbd56('0x4b'),'set':function(_0x57b350){if(!_0x57b350)this[_0xbd56('0xc')](_0xbd56('0x4c'),null);this[_0xbd56('0xc')](_0xbd56('0x4d'),_0x57b350);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbd56('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xbd56('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xbd56('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x3781=['progressive','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','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','type','getDataValue','preview','booked','roundrobin','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime'];(function(_0x428c7d,_0x218ceb){var _0x1b565a=function(_0x2d4a7d){while(--_0x2d4a7d){_0x428c7d['push'](_0x428c7d['shift']());}};_0x1b565a(++_0x218ceb);}(_0x3781,0x1f4));var _0x1378=function(_0x2be33d,_0x3fc0af){_0x2be33d=_0x2be33d-0x0;var _0x2daa6a=_0x3781[_0x2be33d];return _0x2daa6a;};'use strict';var Sequelize=require(_0x1378('0x0'));module['exports']={'name':{'type':Sequelize[_0x1378('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1378('0x2')]('inbound',_0x1378('0x3')),'allowNull':![],'defaultValue':_0x1378('0x4')},'musiconhold':{'type':Sequelize[_0x1378('0x1')],'defaultValue':_0x1378('0x5')},'announce':{'type':Sequelize[_0x1378('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1378('0x2')]('rr',_0x1378('0x6'),_0x1378('0x7'),_0x1378('0x8'),_0x1378('0x9'),_0x1378('0xa'),_0x1378('0xb'),_0x1378('0xc'),_0x1378('0xd')),'allowNull':![],'defaultValue':_0x1378('0x6'),'set':function(_0x33a5d6){this[_0x1378('0xe')]('strategy',_0x33a5d6?_0x33a5d6:'rrmemory');},'get':function(){var _0x21c0b7=this['getDataValue'](_0x1378('0xf'));var _0x1a34e2=this['getDataValue']('dialMethod');var _0x5b196c=this[_0x1378('0x10')]('strategy');if(_0x21c0b7===_0x1378('0x3')){if(_0x1a34e2===_0x1378('0x11')){return null;}if(_0x1a34e2===_0x1378('0x12')&&![_0x1378('0xa'),_0x1378('0x13')]['includes'](_0x5b196c)){this[_0x1378('0xe')]('strategy',_0x1378('0xa'));}}return _0x5b196c;}},'servicelevel':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1378('0x14')](0xb)},'timeout':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1378('0x1')]},'weight':{'type':Sequelize[_0x1378('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':_0x1378('0x15')},'autopause':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no',_0x1378('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1378('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1378('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1378('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1378('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1378('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':_0x1378('0x15')},'announce_holdtime':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no',_0x1378('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1378('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1378('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x1378('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1378('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1378('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x1378('0x1')]},'queue_quantity2':{'type':Sequelize[_0x1378('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x1378('0x1')]},'periodic_announce':{'type':Sequelize[_0x1378('0x18')],'set':function(_0x54983d){this[_0x1378('0xe')]('periodic_announce',_0x54983d?_0x54983d[_0x1378('0x19')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x1378('0x10')](_0x1378('0x1a'))[_0x1378('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x1378('0x1')],'defaultValue':_0x1378('0x15'),'set':function(_0x421107){this[_0x1378('0xe')]('joinempty',_0x421107?_0x421107['join'](','):undefined);},'get':function(){return this[_0x1378('0x10')](_0x1378('0x1c'))?this['getDataValue'](_0x1378('0x1c'))[_0x1378('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1378('0x1')],'defaultValue':'no','set':function(_0x615c09){this['setDataValue']('leavewhenempty',_0x615c09?_0x615c09['join'](','):undefined);},'get':function(){return this[_0x1378('0x10')](_0x1378('0x1d'))?this[_0x1378('0x10')](_0x1378('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1378('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1378('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1378('0x1')]},'description':{'type':Sequelize[_0x1378('0x1')]},'acw':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':0x0,'set':function(_0x1cac4e){this[_0x1378('0xe')]('acw',_0x1cac4e);if(_0x1cac4e){if(this[_0x1378('0x10')](_0x1378('0x1f'))<0x2){this[_0x1378('0xe')](_0x1378('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x1378('0x11'),_0x1378('0x20'),'power','predictive',_0x1378('0x12')),'defaultValue':'progressive','comment':_0x1378('0x21')},'dialLimitChannel':{'type':Sequelize[_0x1378('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1378('0x22')},'dialLimitQueue':{'type':Sequelize[_0x1378('0x14')](0x4)[_0x1378('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1378('0x24')},'dialPowerLevel':{'type':Sequelize[_0x1378('0x25')](0x2)[_0x1378('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1378('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x1378('0x27'),_0x1378('0x28')),'defaultValue':'dropRate','comment':_0x1378('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1378('0x25')](0x2)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1378('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x1378('0x1')],'defaultValue':_0x1378('0x2c'),'comment':_0x1378('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x2e')},'dialQueueProject':{'type':Sequelize[_0x1378('0x1')],'comment':_0x1378('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1378('0x35')},'dialTimezone':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1378('0x1')],'defaultValue':_0x1378('0x36')},'dialPrefix':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x37'),'never',_0x1378('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':0x0,'comment':_0x1378('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x1378('0x14')](0x9)[_0x1378('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1378('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1378('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1378('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1378('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1378('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1378('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1378('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1378('0x14')](0x9)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1378('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1378('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1378('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1378('0x14')](0x9)[_0x1378('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1378('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x1378('0x14')](0x5)[_0x1378('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x40'),'ASC'),'defaultValue':_0x1378('0x40')},'dialQueueProject2':{'type':Sequelize[_0x1378('0x1')],'comment':_0x1378('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1378('0x41')},'dialCutDigit':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1378('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x373743){if(!_0x373743)this['setDataValue'](_0x1378('0x4a'),null);this[_0x1378('0xe')](_0x1378('0x4b'),_0x373743);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c885cf7..d24feba 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 _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x2654d5,_0x460860){var _0x390e2d=function(_0x15838b){while(--_0x15838b){_0x2654d5['push'](_0x2654d5['shift']());}};_0x390e2d(++_0x460860);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file +var _0x7217=['toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','emit','userVoiceQueue:remove','addAgents','isEmpty','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','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=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','options','create','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','body','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','flatMap','penalty','sequelize','transaction','addTeams','upsert','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','Agents','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0x7217,0x19e));var _0x7721=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7217[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var util=require(_0x7721('0x1'));var _=require(_0x7721('0x2'));var squel=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var qs=require(_0x7721('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x7721('0x6'));var db=require(_0x7721('0x7'))['db'];config[_0x7721('0x8')]=_[_0x7721('0x9')](config[_0x7721('0x8')],{'host':_0x7721('0xa'),'port':0x18eb});var socket=require(_0x7721('0xb'))(new Redis(config[_0x7721('0x8')]));require(_0x7721('0xc'))[_0x7721('0xd')](socket);function respondWithStatusCode(_0x3e6368,_0x2a66cb){_0x2a66cb=_0x2a66cb||0xcc;return function(_0xfa8835){if(_0xfa8835){return _0x3e6368[_0x7721('0xe')](_0x2a66cb);}return _0x3e6368[_0x7721('0xf')](_0x2a66cb)['end']();};}function respondWithResult(_0x461d1a,_0x29bc8f){_0x29bc8f=_0x29bc8f||0xc8;return function(_0x8729a6){if(_0x8729a6){return _0x461d1a[_0x7721('0xf')](_0x29bc8f)[_0x7721('0x10')](_0x8729a6);}};}function respondWithFilteredResult(_0x409b37,_0x1e7fd7){return function(_0x27b36b){if(_0x27b36b){var _0x55b4ca=typeof _0x1e7fd7[_0x7721('0x11')]===_0x7721('0x12')&&typeof _0x1e7fd7['limit']===_0x7721('0x12');var _0x30da54=_0x27b36b[_0x7721('0x13')];var _0x2e9752=_0x55b4ca?0x0:_0x1e7fd7['offset'];var _0x3cbce8=_0x55b4ca?_0x27b36b[_0x7721('0x13')]:_0x1e7fd7['offset']+_0x1e7fd7['limit'];var _0x4b183e;if(_0x3cbce8>=_0x30da54){_0x3cbce8=_0x30da54;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x409b37[_0x7721('0xf')](_0x4b183e);return _0x409b37[_0x7721('0x14')](_0x7721('0x15'),_0x2e9752+'-'+_0x3cbce8+'/'+_0x30da54)[_0x7721('0x10')](_0x27b36b);}return null;};}function saveUpdates(_0x5ed94b){return function(_0x20f669){if(_0x20f669){return _0x20f669['update'](_0x5ed94b)[_0x7721('0x16')](function(_0x5cb0e6){return _0x5cb0e6;});}return null;};}function removeEntity(_0xfec626){return function(_0x4e96fb){if(_0x4e96fb){return _0x4e96fb[_0x7721('0x17')]()[_0x7721('0x16')](function(){var _0x2286e5=_0x4e96fb[_0x7721('0x18')]({'plain':!![]});var _0x402820=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a'),'ignore':![]},{'name':_0x7721('0x1b'),'value':'outbound','ignore':![]}];var _0x288f7e=_(_0x402820)[_0x7721('0x1c')](_0x7721('0x1d'))[_0x7721('0x1e')]('value')[_0x7721('0x1f')]();if(_['includes'](_0x288f7e,_0x2286e5[_0x7721('0x20')])){return;}var _0x288e3a=_[_0x7721('0x21')](_0x402820,[_0x7721('0x1f'),_0x2286e5[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x23')]['destroy']({'where':{'type':_0x288e3a,'resourceId':_0x2286e5['id']}})[_0x7721('0x16')](function(){return _0x4e96fb;});})[_0x7721('0x16')](function(){_0xfec626[_0x7721('0xf')](0xcc)[_0x7721('0x24')]();});}};}function handleEntityNotFound(_0x40d550){return function(_0x16355a){if(!_0x16355a){_0x40d550[_0x7721('0xe')](0x194);}return _0x16355a;};}function handleError(_0xf753f1,_0x40f367){_0x40f367=_0x40f367||0x1f4;return function(_0x52316e){logger[_0x7721('0x25')](_0x52316e['stack']);if(_0x52316e['name']){delete _0x52316e[_0x7721('0x22')];}_0xf753f1[_0x7721('0xf')](_0x40f367)[_0x7721('0x26')](_0x52316e);};}exports[_0x7721('0x27')]=function(_0x1ea4d,_0x37b9f0){var _0xd7d703={};var _0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x1e')](db[_0x7721('0x28')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x29')],'type':_0x4a25c9[_0x7721('0x20')]['key']};});_0xd7d703=qs[_0x7721('0x2a')](_0x5c54f0,_0x1ea4d);var _0x4651b5={'where':_0xd7d703[_0x7721('0x2b')]};return db['VoiceQueue'][_0x7721('0x13')](_0x4651b5)[_0x7721('0x16')](function(_0x1492d4){_0x1da2d8[_0x7721('0x13')]=_0x1492d4;_0xd7d703[_0x7721('0x2c')]=qs['include'](_0x1ea4d[_0x7721('0x2d')]);return db[_0x7721('0x28')][_0x7721('0x2e')](_0xd7d703);})['then'](function(_0x35de7a){_0x1da2d8[_0x7721('0x2f')]=_0x35de7a;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x37b9f0,_0xd7d703))[_0x7721('0x30')](handleError(_0x37b9f0,null));};exports['show']=function(_0x2d6ba0,_0x326c50){var _0x19d082={'raw':![],'where':{'id':_0x2d6ba0[_0x7721('0x31')]['id']}},_0x1d894b={};_0x1d894b[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x28')][_0x7721('0x34')]);_0x1d894b[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x2d6ba0['query']);_0x1d894b[_0x7721('0x35')]=_['intersection'](_0x1d894b[_0x7721('0x32')],_0x1d894b[_0x7721('0x2d')]);_0x19d082[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1d894b[_0x7721('0x32')],qs[_0x7721('0x38')](_0x2d6ba0['query']['fields']));_0x19d082['attributes']=_0x19d082['attributes'][_0x7721('0x39')]?_0x19d082[_0x7721('0x36')]:_0x1d894b[_0x7721('0x32')];if(_0x2d6ba0[_0x7721('0x2d')]['includeAll']){_0x19d082[_0x7721('0x2c')]=[{'all':!![]}];}_0x19d082=_['merge']({},_0x19d082,_0x2d6ba0[_0x7721('0x3a')]);return db[_0x7721('0x28')]['find'](_0x19d082)[_0x7721('0x16')](handleEntityNotFound(_0x326c50,null))[_0x7721('0x16')](respondWithResult(_0x326c50,null))['catch'](handleError(_0x326c50,null));};exports['create']=function(_0x3d84d3,_0xfc4dc4){return db[_0x7721('0x28')][_0x7721('0x3b')](_0x3d84d3['body'],{})[_0x7721('0x16')](function(_0x120de9){var _0x40ce8c=_0x3d84d3[_0x7721('0x3c')][_0x7721('0x18')]({'plain':!![]});if(!_0x40ce8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ce8c[_0x7721('0x3d')]==='user'){var _0xaa3216=_0x120de9['get']({'plain':!![]});var _0x2333b8=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':'QueueCampaigns','value':_0x7721('0x3e')}];var _0x11d853=_[_0x7721('0x21')](_0x2333b8,['value',_0xaa3216[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x11d853,'userProfileId':_0x40ce8c[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x463ccc){if(_0x463ccc&&_0x463ccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7721('0x3b')]({'name':_0xaa3216[_0x7721('0x22')],'resourceId':_0xaa3216['id'],'type':_0x463ccc[_0x7721('0x22')],'sectionId':_0x463ccc['id']},{})[_0x7721('0x16')](function(){return _0x120de9;});}else{return _0x120de9;}})[_0x7721('0x30')](function(_0x15181b){logger[_0x7721('0x25')](_0x7721('0x41'),_0x15181b);throw _0x15181b;});}return _0x120de9;})[_0x7721('0x16')](respondWithResult(_0xfc4dc4,0xc9))[_0x7721('0x30')](handleError(_0xfc4dc4,null));};exports['clone']=function(_0x578867,_0x5ed70d){var _0x6a4664={'where':{'id':_0x578867[_0x7721('0x31')]['id']}},_0x151f69={};_0x151f69['model']=_[_0x7721('0x33')](db[_0x7721('0x28')]['rawAttributes']);_0x6a4664[_0x7721('0x36')]=_['intersection'](_0x151f69[_0x7721('0x32')],qs['fields'](_0x578867[_0x7721('0x2d')][_0x7721('0x38')]));_0x6a4664[_0x7721('0x36')]=_0x6a4664['attributes'][_0x7721('0x39')]?_0x6a4664[_0x7721('0x36')]:_0x151f69['model'];if(_0x578867[_0x7721('0x2d')][_0x7721('0x42')]){_0x6a4664[_0x7721('0x2c')]=[{'all':!![]}];}_0x6a4664=_['merge']({},_0x6a4664,_0x578867[_0x7721('0x3a')]);return db['VoiceQueue'][_0x7721('0x21')](_0x6a4664)[_0x7721('0x16')](handleEntityNotFound(_0x5ed70d,null))[_0x7721('0x16')](function(_0x443503){if(_0x443503){var _0x1c95d8=_0x443503[_0x7721('0x18')]({'plain':!![]});_0x1c95d8=qs[_0x7721('0x43')](_0x1c95d8,['id',_0x7721('0x44'),_0x7721('0x45')]);_0x578867[_0x7721('0x46')]=_[_0x7721('0x43')](_0x578867[_0x7721('0x46')],['id',_0x7721('0x44'),_0x7721('0x45')]);return db[_0x7721('0x28')]['create'](_[_0x7721('0x47')](_0x1c95d8,_0x578867[_0x7721('0x46')]),{'include':_0x578867[_0x7721('0x2d')][_0x7721('0x42')]?[{'all':!![]}]:undefined})[_0x7721('0x16')](function(_0x315127){var _0x267f5e=_0x578867['user'][_0x7721('0x18')]({'plain':!![]});if(!_0x267f5e)throw new Error(_0x7721('0x48'));if(_0x267f5e[_0x7721('0x3d')]===_0x7721('0x3c')){var _0x1f1e84=_0x315127[_0x7721('0x18')]({'plain':!![]});var _0x7fbd6c=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':_0x7721('0x1b'),'value':_0x7721('0x3e')}];var _0x52e870=_[_0x7721('0x21')](_0x7fbd6c,[_0x7721('0x1f'),_0x1f1e84[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x52e870,'userProfileId':_0x267f5e[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x360882){if(_0x360882&&_0x360882[_0x7721('0x49')]===0x0){return db[_0x7721('0x23')][_0x7721('0x3b')]({'name':_0x1f1e84[_0x7721('0x22')],'resourceId':_0x1f1e84['id'],'type':_0x360882[_0x7721('0x22')],'sectionId':_0x360882['id']},{})[_0x7721('0x16')](function(){return _0x315127;});}else{return _0x315127;}})['catch'](function(_0x50e9e9){logger['error'](_0x7721('0x41'),_0x50e9e9);throw _0x50e9e9;});}return _0x315127;});}})['then'](respondWithResult(_0x5ed70d,0xc9))['catch'](handleError(_0x5ed70d,null));};exports['update']=function(_0x5d7036,_0x47925a){if(_0x5d7036[_0x7721('0x46')]['id']){delete _0x5d7036[_0x7721('0x46')]['id'];}return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x5d7036['params']['id']}})['then'](handleEntityNotFound(_0x47925a,null))['then'](saveUpdates(_0x5d7036[_0x7721('0x46')],null))['then'](respondWithResult(_0x47925a,null))['catch'](handleError(_0x47925a,null));};exports['destroy']=function(_0x160292,_0x2e9155){return db[_0x7721('0x28')]['find']({'where':{'id':_0x160292[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x16')](removeEntity(_0x2e9155,null))[_0x7721('0x30')](handleError(_0x2e9155,null));};exports[_0x7721('0x4a')]=function(_0x16e80b,_0xad43ce){var _0x3e3301={'raw':![],'where':{}};var _0x127f46={};var _0x197b73={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16e80b[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0xad43ce,null))[_0x7721('0x16')](function(_0x4cbd28){if(_0x4cbd28){_0x127f46[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x4c')][_0x7721('0x34')]);_0x127f46['query']=_[_0x7721('0x33')](_0x16e80b[_0x7721('0x2d')]);_0x127f46['filters']=_[_0x7721('0x37')](_0x127f46['model'],_0x127f46[_0x7721('0x2d')]);_0x3e3301[_0x7721('0x36')]=_[_0x7721('0x37')](_0x127f46[_0x7721('0x32')],qs[_0x7721('0x38')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x38')]));_0x3e3301[_0x7721('0x36')]=_0x3e3301[_0x7721('0x36')]['length']?_0x3e3301[_0x7721('0x36')]:_0x127f46[_0x7721('0x32')];if(!_0x16e80b[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x3e3301[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16e80b['query'][_0x7721('0x4f')]);_0x3e3301[_0x7721('0x11')]=qs['offset'](_0x16e80b[_0x7721('0x2d')]['offset']);}_0x3e3301[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x51')]);_0x3e3301[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x16e80b['query'],_0x127f46[_0x7721('0x35')]));_0x3e3301[_0x7721('0x2b')][_0x7721('0x53')]=_0x4cbd28['id'];if(_0x16e80b['query']['filter']){_0x3e3301['where']=_['merge'](_0x3e3301['where'],{'$or':_[_0x7721('0x1e')](_0x3e3301[_0x7721('0x36')],function(_0x580473){var _0x2d4b3a={};_0x2d4b3a[_0x580473]={'$like':'%'+_0x16e80b[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x2d4b3a;})});}_0x3e3301=_[_0x7721('0x47')]({},_0x3e3301,_0x16e80b['options']);return db[_0x7721('0x4c')][_0x7721('0x13')]({'where':_0x3e3301[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0x3cf3fd){_0x197b73['count']=_0x3cf3fd;if(_0x16e80b[_0x7721('0x2d')][_0x7721('0x42')]){_0x3e3301[_0x7721('0x2c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e3301);})[_0x7721('0x16')](function(_0x752564){_0x197b73[_0x7721('0x2f')]=_0x752564;return _0x197b73;});}})[_0x7721('0x16')](respondWithFilteredResult(_0xad43ce,_0x3e3301))[_0x7721('0x30')](handleError(_0xad43ce,null));};exports['getHopperHistories']=function(_0x4ba35e,_0x263070){var _0x1bd97e={'raw':!![],'where':{}};var _0x68de4={};var _0x3c66b3={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x4ba35e[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x263070,null))[_0x7721('0x16')](function(_0x413185){if(_0x413185){_0x68de4[_0x7721('0x32')]=_['keys'](db[_0x7721('0x54')][_0x7721('0x34')]);_0x68de4[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x4ba35e['query']);_0x68de4['filters']=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],_0x68de4[_0x7721('0x2d')]);_0x1bd97e[_0x7721('0x36')]=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],qs['fields'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x38')]));_0x1bd97e[_0x7721('0x36')]=_0x1bd97e['attributes'][_0x7721('0x39')]?_0x1bd97e[_0x7721('0x36')]:_0x68de4[_0x7721('0x32')];if(!_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x1bd97e[_0x7721('0x4f')]=qs['limit'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1bd97e[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x11')]);}_0x1bd97e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x51')]);_0x1bd97e[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0x4ba35e[_0x7721('0x2d')],_0x68de4[_0x7721('0x35')]));_0x1bd97e['where'][_0x7721('0x53')]=_0x413185['id'];if(_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1bd97e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x1bd97e['where'],{'$or':_[_0x7721('0x1e')](_0x1bd97e[_0x7721('0x36')],function(_0x44326d){var _0x21b365={};_0x21b365[_0x44326d]={'$like':'%'+_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x21b365;})});}_0x1bd97e=_['merge']({},_0x1bd97e,_0x4ba35e[_0x7721('0x3a')]);return db[_0x7721('0x54')]['count']({'where':_0x1bd97e[_0x7721('0x2b')]})['then'](function(_0x453792){_0x3c66b3[_0x7721('0x13')]=_0x453792;if(_0x4ba35e['query'][_0x7721('0x42')]){_0x1bd97e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bd97e);})[_0x7721('0x16')](function(_0x20f12e){_0x3c66b3[_0x7721('0x2f')]=_0x20f12e;return _0x3c66b3;});}})['then'](respondWithFilteredResult(_0x263070,_0x1bd97e))['catch'](handleError(_0x263070,null));};exports['getHopperFinals']=function(_0x355aa8,_0x3f7923){var _0x3c9334={'raw':!![],'where':{}};var _0x4220cf={};var _0x3b02d7={'count':0x0,'rows':[]};return db[_0x7721('0x28')]['findOne']({'where':{'id':_0x355aa8[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3f7923,null))[_0x7721('0x16')](function(_0xcf5304){if(_0xcf5304){_0x4220cf[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x55')][_0x7721('0x34')]);_0x4220cf[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x355aa8[_0x7721('0x2d')]);_0x4220cf[_0x7721('0x35')]=_['intersection'](_0x4220cf['model'],_0x4220cf[_0x7721('0x2d')]);_0x3c9334[_0x7721('0x36')]=_['intersection'](_0x4220cf[_0x7721('0x32')],qs['fields'](_0x355aa8['query'][_0x7721('0x38')]));_0x3c9334['attributes']=_0x3c9334['attributes'][_0x7721('0x39')]?_0x3c9334[_0x7721('0x36')]:_0x4220cf[_0x7721('0x32')];if(!_0x355aa8[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x3c9334[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x355aa8[_0x7721('0x2d')][_0x7721('0x4f')]);_0x3c9334['offset']=qs['offset'](_0x355aa8[_0x7721('0x2d')][_0x7721('0x11')]);}_0x3c9334['order']=qs[_0x7721('0x51')](_0x355aa8[_0x7721('0x2d')]['sort']);_0x3c9334['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x355aa8[_0x7721('0x2d')],_0x4220cf[_0x7721('0x35')]));_0x3c9334[_0x7721('0x2b')][_0x7721('0x53')]=_0xcf5304['id'];if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x1c')]){_0x3c9334['where']=_[_0x7721('0x47')](_0x3c9334[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x3c9334[_0x7721('0x36')],function(_0xe1c795){var _0x9b5f60={};_0x9b5f60[_0xe1c795]={'$like':'%'+_0x355aa8[_0x7721('0x2d')]['filter']+'%'};return _0x9b5f60;})});}_0x3c9334=_[_0x7721('0x47')]({},_0x3c9334,_0x355aa8[_0x7721('0x3a')]);return db['CmHopperFinal'][_0x7721('0x13')]({'where':_0x3c9334[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0xb8547a){_0x3b02d7[_0x7721('0x13')]=_0xb8547a;if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x42')]){_0x3c9334[_0x7721('0x2c')]=[{'all':!![]}];}return db[_0x7721('0x55')][_0x7721('0x2e')](_0x3c9334);})['then'](function(_0x418954){_0x3b02d7[_0x7721('0x2f')]=_0x418954;return _0x3b02d7;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x3f7923,_0x3c9334))[_0x7721('0x30')](handleError(_0x3f7923,null));};exports[_0x7721('0x56')]=function(_0x47653d,_0x12869b){var _0x1cfee2={'raw':!![],'where':{}};var _0x425327={};var _0x42ee11={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x47653d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12869b,null))[_0x7721('0x16')](function(_0x461938){if(_0x461938){_0x425327[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x57')][_0x7721('0x34')]);_0x425327['query']=_[_0x7721('0x33')](_0x47653d['query']);_0x425327[_0x7721('0x35')]=_[_0x7721('0x37')](_0x425327[_0x7721('0x32')],_0x425327[_0x7721('0x2d')]);_0x1cfee2[_0x7721('0x36')]=_['intersection'](_0x425327['model'],qs['fields'](_0x47653d['query'][_0x7721('0x38')]));_0x1cfee2[_0x7721('0x36')]=_0x1cfee2[_0x7721('0x36')][_0x7721('0x39')]?_0x1cfee2[_0x7721('0x36')]:_0x425327['model'];if(!_0x47653d[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x1cfee2[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x47653d[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1cfee2[_0x7721('0x11')]=qs['offset'](_0x47653d[_0x7721('0x2d')]['offset']);}_0x1cfee2['order']=qs[_0x7721('0x51')](_0x47653d[_0x7721('0x2d')][_0x7721('0x51')]);_0x1cfee2[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x47653d[_0x7721('0x2d')],_0x425327[_0x7721('0x35')]));_0x1cfee2[_0x7721('0x2b')][_0x7721('0x53')]=_0x461938['id'];if(_0x47653d[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1cfee2[_0x7721('0x2b')]=_['merge'](_0x1cfee2[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x1cfee2[_0x7721('0x36')],function(_0x193326){var _0x1dbf47={};_0x1dbf47[_0x193326]={'$like':'%'+_0x47653d['query'][_0x7721('0x1c')]+'%'};return _0x1dbf47;})});}_0x1cfee2=_[_0x7721('0x47')]({},_0x1cfee2,_0x47653d[_0x7721('0x3a')]);return db['CmHopperBlack'][_0x7721('0x13')]({'where':_0x1cfee2[_0x7721('0x2b')]})['then'](function(_0x29403d){_0x42ee11[_0x7721('0x13')]=_0x29403d;if(_0x47653d[_0x7721('0x2d')][_0x7721('0x42')]){_0x1cfee2['include']=[{'all':!![]}];}return db[_0x7721('0x57')]['findAll'](_0x1cfee2);})[_0x7721('0x16')](function(_0x1c50c2){_0x42ee11['rows']=_0x1c50c2;return _0x42ee11;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x12869b,_0x1cfee2))[_0x7721('0x30')](handleError(_0x12869b,null));};exports['getTeams']=function(_0x29968c,_0x11733f){var _0x5e3816={};var _0x7fd3e8={};var _0x52e8b1;var _0x240b0a;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x29968c['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x11733f,null))['then'](function(_0x5a00be){if(_0x5a00be){_0x52e8b1=_0x5a00be;_0x7fd3e8[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x58')][_0x7721('0x34')]);_0x7fd3e8[_0x7721('0x2d')]=_['keys'](_0x29968c[_0x7721('0x2d')]);_0x7fd3e8[_0x7721('0x35')]=_[_0x7721('0x37')](_0x7fd3e8[_0x7721('0x32')],_0x7fd3e8[_0x7721('0x2d')]);_0x5e3816['attributes']=_[_0x7721('0x37')](_0x7fd3e8['model'],qs[_0x7721('0x38')](_0x29968c['query']['fields']));_0x5e3816[_0x7721('0x36')]=_0x5e3816['attributes']['length']?_0x5e3816[_0x7721('0x36')]:_0x7fd3e8[_0x7721('0x32')];_0x5e3816[_0x7721('0x50')]=qs['sort'](_0x29968c[_0x7721('0x2d')]['sort']);_0x5e3816['where']=qs['filters'](_[_0x7721('0x52')](_0x29968c[_0x7721('0x2d')],_0x7fd3e8[_0x7721('0x35')]));if(_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]){_0x5e3816[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x5e3816[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x5e3816[_0x7721('0x36')],function(_0x25bf32){var _0x4ec3c6={};_0x4ec3c6[_0x25bf32]={'$like':'%'+_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x4ec3c6;})});}_0x5e3816=_[_0x7721('0x47')]({},_0x5e3816,_0x29968c[_0x7721('0x3a')]);return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0xc7e4e9){if(_0xc7e4e9){_0x240b0a=_0xc7e4e9['length'];if(!_0x29968c['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x5e3816[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x29968c['query'][_0x7721('0x4f')]);_0x5e3816['offset']=qs[_0x7721('0x11')](_0x29968c['query'][_0x7721('0x11')]);}return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0x249a5b){if(_0x249a5b){return _0x249a5b?{'count':_0x240b0a,'rows':_0x249a5b}:null;}})[_0x7721('0x16')](respondWithResult(_0x11733f,null))[_0x7721('0x30')](handleError(_0x11733f,null));};exports['addTeams']=function(_0x509f2d,_0x4d2644){var _0x2b0968=_0x509f2d['body'][_0x7721('0x5a')];var _0x186ada=_['map'](_0x2b0968,'id');return db[_0x7721('0x58')][_0x7721('0x2e')]({'where':{'id':_0x186ada},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':'Agents','attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),'voicePause','interface'],'raw':!![]}]})[_0x7721('0x16')](function(_0xc85b9){if(_0xc85b9){var _0x58be49=_[_0x7721('0x5d')](_0xc85b9,function(_0x283716){var _0x4cd26e=_0x283716['get']({'plain':!![]});_0x4cd26e['Agents']['forEach'](function(_0x19be6b){_0x19be6b[_0x7721('0x5e')]=_[_0x7721('0x21')](_0x2b0968,{'id':_0x4cd26e['id']})['penalty'];});return _0x4cd26e['Agents'];});return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x509f2d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x14711c){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0x435455){return _0x14711c[_0x7721('0x61')](_0x186ada,{'transaction':_0x435455})['then'](function(){return BPromise['each'](_0x2b0968,function(_0x415445){return db['TeamVoiceQueue'][_0x7721('0x62')]({'TeamId':_0x415445['id'],'VoiceQueueId':_0x509f2d['params']['id'],'penalty':_0x415445[_0x7721('0x5e')]},{'transaction':_0x435455});});})['then'](function(){return BPromise[_0x7721('0x63')](_0x58be49,function(_0x14341e){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x14341e['id'],'VoiceQueueId':_0x509f2d[_0x7721('0x31')]['id']},'defaults':{'penalty':_0x14341e[_0x7721('0x5e')]},'transaction':_0x435455});});})[_0x7721('0x16')](function(){return BPromise[_0x7721('0x63')](_[_0x7721('0x1c')](_0x58be49,{'online':!![]}),function(_0x5e69d7){return db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x5e69d7[_0x7721('0x22')],'UserId':_0x5e69d7['id'],'queue_name':_0x14711c['name'],'VoiceQueueId':_0x14711c['id'],'interface':_[_0x7721('0x65')](_0x5e69d7[_0x7721('0x66')])?util[_0x7721('0x67')](_0x7721('0x68'),_0x5e69d7[_0x7721('0x22')]):_0x5e69d7[_0x7721('0x66')],'paused':_0x5e69d7[_0x7721('0x69')]||![],'penalty':_0x5e69d7[_0x7721('0x5e')]},{'transaction':_0x435455});});})[_0x7721('0x16')](function(){_0x58be49[_0x7721('0x6a')](function(_0x2a2d8a){socket['emit'](_0x7721('0x6b'),{'UserId':_0x2a2d8a['id'],'VoiceQueueId':_0x14711c['id']});});});});});}})[_0x7721('0x16')](respondWithStatusCode(_0x4d2644,null))[_0x7721('0x30')](handleError(_0x4d2644,null));};exports[_0x7721('0x6c')]=function(_0xcb843e,_0x35d3f1){return db[_0x7721('0x58')]['findAll']({'where':{'id':_0xcb843e[_0x7721('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':_0x7721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7721('0x16')](handleEntityNotFound(_0x35d3f1,null))[_0x7721('0x16')](function(_0x37b607){var _0x3d6d41=_['map'](_0x37b607,'id');var _0xbce1b=[];var _0x4d3ad1=[];var _0x4028fa=squel[_0x7721('0x6e')]();_0x4028fa[_0x7721('0x6f')]('tq.TeamId')[_0x7721('0x70')](_0x7721('0x71'),'tq')[_0x7721('0x72')](_0x7721('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7721('0x2b')](_0x7721('0x74'),_0xcb843e[_0x7721('0x31')]['id']);for(var _0x980f26=0x0;_0x980f26<_0x37b607['length'];_0x980f26+=0x1){let _0x40dd5e=_0x37b607[_0x980f26];for(var _0x3d143a=0x0;_0x3d143a<_0x40dd5e[_0x7721('0x6d')][_0x7721('0x39')];_0x3d143a+=0x1){let _0x53fa66=_0x40dd5e[_0x7721('0x6d')][_0x3d143a];var _0x1a95e6=_0x4028fa[_0x7721('0x75')]();_0x1a95e6[_0x7721('0x2b')](_0x7721('0x76'),_0x53fa66['id']);_0x4d3ad1[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x1a95e6[_0x7721('0x78')](),{'type':db['sequelize'][_0x7721('0x79')][_0x7721('0x7a')]})[_0x7721('0x16')](function(_0x1c246b){if(_0x1c246b[_0x7721('0x39')]===0x1){return _0x53fa66['id'];}else{var _0x31447d=_[_0x7721('0x7b')](_[_0x7721('0x1e')](_0x1c246b,_0x7721('0x7c')),function(_0x14fd97){return _[_0x7721('0x7d')](_0x3d6d41,_0x14fd97);});if(_0x31447d){return _0x53fa66['id'];}}}));}}return BPromise[_0x7721('0x7e')](_0x4d3ad1)[_0x7721('0x16')](function(_0x18ccdf){_0xbce1b=_(_0xbce1b)[_0x7721('0x7f')](_0x18ccdf)[_0x7721('0x80')]()['value']();return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xcb843e[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x157310){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0xdd0e7a){return _0x157310[_0x7721('0x6c')](_0xcb843e[_0x7721('0x2d')][_0x7721('0x81')],{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){if(!_['isEmpty'](_0xbce1b)){return _0x157310['removeAgents'](_0xbce1b,{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0xcb843e[_0x7721('0x31')]['id'],'UserId':_0xbce1b},'transaction':_0xdd0e7a});});}})[_0x7721('0x16')](function(){_0xbce1b['forEach'](function(_0x1ebc86){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':_0x1ebc86,'VoiceQueueId':_0x157310['id']});});});});});});})[_0x7721('0x16')](respondWithStatusCode(_0x35d3f1,null))[_0x7721('0x30')](handleError(_0x35d3f1,null));};exports[_0x7721('0x84')]=function(_0xc0f448,_0x3dc688){var _0x298aca,_0x45b430;return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xc0f448['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3dc688,null))[_0x7721('0x16')](function(_0x16e0cd){if(_0x16e0cd){_0x45b430=_0x16e0cd;return _0x16e0cd['addAgents'](_0xc0f448[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xc0f448['body'],[_0x7721('0x81'),'id'])||{})['spread'](function(_0x5f3dd2){for(var _0xa73193=0x0;_0xa73193<_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0x7721('0x39')];_0xa73193+=0x1){socket['emit'](_0x7721('0x6b'),{'UserId':Number(_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0xa73193]),'VoiceQueueId':Number(_0xc0f448[_0x7721('0x31')]['id'])});}return _0x5f3dd2;});}})[_0x7721('0x16')](function(_0x5b12c7){_0x298aca=_0x5b12c7||[];if(_0x45b430){return db[_0x7721('0x5b')][_0x7721('0x2e')]({'where':{'id':_0xc0f448[_0x7721('0x46')][_0x7721('0x81')]},'attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),_0x7721('0x69'),_0x7721('0x66')],'raw':!![]});}})[_0x7721('0x16')](function(_0x385c86){if(!_[_0x7721('0x85')](_0x385c86)){var _0xc18d1a=[];for(var _0x9575b3=0x0;_0x9575b3<_0x385c86[_0x7721('0x39')];_0x9575b3++){if(_0x385c86[_0x9575b3][_0x7721('0x5c')]){_0xc18d1a[_0x7721('0x77')](db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x385c86[_0x9575b3][_0x7721('0x22')],'UserId':_0x385c86[_0x9575b3]['id'],'queue_name':_0x45b430[_0x7721('0x22')],'VoiceQueueId':_0x45b430['id'],'interface':_[_0x7721('0x65')](_0x385c86[_0x9575b3][_0x7721('0x66')])?util['format'](_0x7721('0x68'),_0x385c86[_0x9575b3]['name']):_0x385c86[_0x9575b3][_0x7721('0x66')],'paused':_0x385c86[_0x9575b3][_0x7721('0x69')]||![],'penalty':_0xc0f448[_0x7721('0x46')][_0x7721('0x5e')]||0x0}));}}return BPromise['all'](_0xc18d1a);}})[_0x7721('0x16')](function(){return _0x298aca;})[_0x7721('0x16')](respondWithResult(_0x3dc688,null))['catch'](handleError(_0x3dc688,null));};exports[_0x7721('0x86')]=function(_0x3a8f89,_0x52aae1){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x3a8f89[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x52aae1,null))[_0x7721('0x16')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c['removeAgents'](_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')])['then'](function(){if(_['isArray'](_0x3a8f89[_0x7721('0x2d')]['ids'])){for(var _0x1c23e3=0x0;_0x1c23e3<_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]['length'];_0x1c23e3+=0x1){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')][_0x1c23e3]),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}}else{socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')]['ids']),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}});}})[_0x7721('0x16')](function(_0x3c3c7e){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0x3a8f89['params']['id'],'UserId':_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]}})[_0x7721('0x16')](function(){return _0x3c3c7e;});})[_0x7721('0x16')](respondWithStatusCode(_0x52aae1,null))[_0x7721('0x30')](handleError(_0x52aae1,null));};exports[_0x7721('0x87')]=function(_0x16b110,_0x366323){var _0x14b49e={};var _0x12f568={};var _0x259640;var _0x4a0e50;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16b110[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x366323,null))[_0x7721('0x16')](function(_0x25e4db){if(_0x25e4db){_0x259640=_0x25e4db;_0x12f568[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x5b')][_0x7721('0x34')]);_0x12f568[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x16b110[_0x7721('0x2d')]);_0x12f568[_0x7721('0x35')]=_[_0x7721('0x37')](_0x12f568['model'],_0x12f568[_0x7721('0x2d')]);_0x14b49e['attributes']=_['intersection'](_0x12f568[_0x7721('0x32')],qs['fields'](_0x16b110[_0x7721('0x2d')][_0x7721('0x38')]));_0x14b49e[_0x7721('0x36')]=_0x14b49e[_0x7721('0x36')]['length']?_0x14b49e['attributes']:_0x12f568[_0x7721('0x32')];_0x14b49e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16b110[_0x7721('0x2d')][_0x7721('0x51')]);_0x14b49e[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x16b110[_0x7721('0x2d')],_0x12f568['filters']));if(_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]){_0x14b49e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x14b49e[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x14b49e[_0x7721('0x36')],function(_0x184f1b){var _0xa257a0={};_0xa257a0[_0x184f1b]={'$like':'%'+_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0xa257a0;})});}_0x14b49e=_[_0x7721('0x47')]({},_0x14b49e,_0x16b110[_0x7721('0x3a')]);return _0x259640[_0x7721('0x87')](_0x14b49e);}})[_0x7721('0x16')](function(_0x1ee0c1){if(_0x1ee0c1){_0x4a0e50=_0x1ee0c1[_0x7721('0x39')];if(!_0x16b110[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x14b49e[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16b110[_0x7721('0x2d')][_0x7721('0x4f')]);_0x14b49e[_0x7721('0x11')]=qs['offset'](_0x16b110[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x259640[_0x7721('0x87')](_0x14b49e);}})['then'](function(_0x1bdadb){if(_0x1bdadb){return _0x1bdadb?{'count':_0x4a0e50,'rows':_0x1bdadb}:null;}})['then'](respondWithResult(_0x366323,null))[_0x7721('0x30')](handleError(_0x366323,null));};exports['getMembers']=function(_0xe5e55f,_0x17ce3b){var _0xbc0a80={};var _0xf2dc08={};var _0x5b493a;var _0x45024c;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0xe5e55f[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x17ce3b,null))['then'](function(_0x12b255){if(_0x12b255){_0x5b493a=_0x12b255;_0xf2dc08['model']=_[_0x7721('0x33')](db[_0x7721('0x64')][_0x7721('0x34')]);_0xf2dc08[_0x7721('0x2d')]=_[_0x7721('0x33')](_0xe5e55f[_0x7721('0x2d')]);_0xf2dc08[_0x7721('0x35')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],_0xf2dc08['query']);_0xbc0a80[_0x7721('0x36')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],qs['fields'](_0xe5e55f['query'][_0x7721('0x38')]));_0xbc0a80[_0x7721('0x36')]=_0xbc0a80[_0x7721('0x36')][_0x7721('0x39')]?_0xbc0a80[_0x7721('0x36')]:_0xf2dc08[_0x7721('0x32')];_0xbc0a80['order']=qs[_0x7721('0x51')](_0xe5e55f[_0x7721('0x2d')]['sort']);_0xbc0a80[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0xe5e55f['query'],_0xf2dc08[_0x7721('0x35')]));if(_0xe5e55f['query']['filter']){_0xbc0a80['where']=_[_0x7721('0x47')](_0xbc0a80['where'],{'$or':_['map'](_0xbc0a80['attributes'],function(_0x52a1ee){var _0x41c991={};_0x41c991[_0x52a1ee]={'$like':'%'+_0xe5e55f[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x41c991;})});}_0xbc0a80=_[_0x7721('0x47')]({},_0xbc0a80,_0xe5e55f[_0x7721('0x3a')]);return _0x5b493a['getMembers'](_0xbc0a80);}})[_0x7721('0x16')](function(_0x22d4e0){if(_0x22d4e0){_0x45024c=_0x22d4e0['length'];if(!_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0xbc0a80[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4f')]);_0xbc0a80[_0x7721('0x11')]=qs['offset'](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x5b493a[_0x7721('0x88')](_0xbc0a80);}})[_0x7721('0x16')](function(_0x2fbb00){return _0x2fbb00?{'count':_0x45024c,'rows':_0x2fbb00}:null;})[_0x7721('0x16')](respondWithResult(_0x17ce3b,null))[_0x7721('0x30')](handleError(_0x17ce3b,null));};exports[_0x7721('0x89')]=function(_0x561235,_0x12ad4d){var _0x226081={};var _0x17c3e7={};var _0x250cbf;var _0x255b22;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x561235[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12ad4d,null))[_0x7721('0x16')](function(_0x396880){if(_0x396880){_0x250cbf=_0x396880;_0x17c3e7['model']=_[_0x7721('0x33')](db[_0x7721('0x8a')]['rawAttributes']);_0x17c3e7[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x561235[_0x7721('0x2d')]);_0x17c3e7[_0x7721('0x35')]=_[_0x7721('0x37')](_0x17c3e7['model'],_0x17c3e7[_0x7721('0x2d')]);_0x226081[_0x7721('0x36')]=_['intersection'](_0x17c3e7['model'],qs[_0x7721('0x38')](_0x561235[_0x7721('0x2d')][_0x7721('0x38')]));_0x226081['attributes']=_0x226081[_0x7721('0x36')]['length']?_0x226081['attributes']:_0x17c3e7[_0x7721('0x32')];_0x226081[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x561235[_0x7721('0x2d')][_0x7721('0x51')]);_0x226081['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x561235[_0x7721('0x2d')],_0x17c3e7[_0x7721('0x35')]));if(_0x561235[_0x7721('0x2d')]['filter']){_0x226081[_0x7721('0x2b')]=_['merge'](_0x226081[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x226081[_0x7721('0x36')],function(_0x5209ff){var _0x2583c1={};_0x2583c1[_0x5209ff]={'$like':'%'+_0x561235['query'][_0x7721('0x1c')]+'%'};return _0x2583c1;})});}_0x226081=_[_0x7721('0x47')]({},_0x226081,_0x561235[_0x7721('0x3a')]);return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x3235d8){if(_0x3235d8){_0x255b22=_0x3235d8[_0x7721('0x39')];if(!_0x561235[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x226081['limit']=qs[_0x7721('0x4f')](_0x561235[_0x7721('0x2d')][_0x7721('0x4f')]);_0x226081[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x561235['query'][_0x7721('0x11')]);}return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x501e31){if(_0x501e31){return _0x501e31?{'count':_0x255b22,'rows':_0x501e31}:null;}})[_0x7721('0x16')](respondWithResult(_0x12ad4d,null))[_0x7721('0x30')](handleError(_0x12ad4d,null));};exports[_0x7721('0x8b')]=function(_0xe325e1,_0x1aa1fc){var _0x560be6=moment()[_0x7721('0x67')](_0x7721('0x8c'));var _0x1bd066,_0xaa15c5;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xe325e1[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x1aa1fc,null))[_0x7721('0x16')](function(_0x42ffff){if(_0x42ffff){_0xaa15c5=_0x42ffff;return _0x42ffff[_0x7721('0x8b')](_0xe325e1[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xe325e1[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x3f19f5){var _0x28f11a;_0x1bd066=_0x3f19f5||[];var _0x3bc8f3=[];if(_0x3f19f5){for(var _0x26cea3=0x0;_0x26cea3<_0x3f19f5[_0x7721('0x39')];_0x26cea3+=0x1){var _0x57e928=_0x3f19f5[_0x26cea3]['get']({'plain':!![]});_0xaa15c5[_0x7721('0x8e')]=_0xe325e1[_0x7721('0x46')][_0x7721('0x8e')]?_0xe325e1[_0x7721('0x46')]['dialCheckDuplicateType']:_0xaa15c5[_0x7721('0x8e')];switch(_0xaa15c5['dialCheckDuplicateType']){case _0x7721('0x8f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')['fromQuery'](['phone',_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),'updatedAt'],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),'ListId')[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','updatedAt')['from'](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928['CmListId'][_0x7721('0x78')]())[_0x7721('0x2b')](_0x7721('0x9a'))[_0x7721('0x2b')](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9c'))[_0x7721('0x70')](_0x7721('0x9d'))['where'](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id']['toString']()))[_0x7721('0x2b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7721('0x6e')]()['field'](_0x7721('0x9e'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xe325e1[_0x7721('0x31')]['id']['toString']())))[_0x7721('0x78')]();break;case _0x7721('0x9f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')](_0x7721('0xa0'))[_0x7721('0xa1')](['phone',_0x7721('0x92'),_0x7721('0x93'),'ListId','VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field']('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))['from'](_0x7721('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7721('0x2b')]('ListId\x20=\x20?',_0x57e928[_0x7721('0x96')]['toString']())[_0x7721('0x2b')](_0x7721('0x9a'))['where'](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9e'))[_0x7721('0x70')]('cm_hopper')[_0x7721('0x2b')](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')]())))[_0x7721('0x78')]();break;default:_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')[_0x7721('0xa1')]([_0x7721('0x95'),_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),'VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id',_0x7721('0x93'))['field'](_0x57e928['CmListId'][_0x7721('0x78')](),'ListId')['field'](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x44'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928[_0x7721('0x96')][_0x7721('0x78')]())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();}_0x3bc8f3[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x28f11a));}return BPromise[_0x7721('0x7e')](_0x3bc8f3);}})[_0x7721('0x16')](function(){var _0x5f53b3=[];var _0x8fc283=squel[_0x7721('0x90')]()['into'](_0x7721('0xa2'))['fromQuery']([_0x7721('0xa3'),_0x7721('0x95'),_0x7721('0xa4'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0xa5'))[_0x7721('0x6f')](_0x7721('0xa6'))[_0x7721('0x6f')](_0x7721('0xa7'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0xa8'),'ci')[_0x7721('0x72')](_0x7721('0xa0'),'h',_0x7721('0xa9'))['where'](_0x7721('0xaa'),_0x560be6)[_0x7721('0x2b')](_0x7721('0xab'),'PHONE'))[_0x7721('0x78')]();_0x5f53b3['push'](db['sequelize'][_0x7721('0x2d')](_0x8fc283));return BPromise[_0x7721('0x7e')](_0x5f53b3);})['then'](function(){return _0x1bd066;})[_0x7721('0x16')](respondWithResult(_0x1aa1fc,null))[_0x7721('0x30')](handleError(_0x1aa1fc,null));};exports[_0x7721('0xac')]=function(_0xbc4f13,_0x50f4bd){return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xbc4f13['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x50f4bd,null))[_0x7721('0x16')](function(_0x537831){if(_0x537831){return _0x537831[_0x7721('0xac')](_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')]);}})[_0x7721('0x16')](function(_0x49548e){if(_0x49548e){return db['CmHopper'][_0x7721('0x17')]({'where':{'ListId':_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0xbc4f13[_0x7721('0x31')]['id']}})['then'](function(){return _0x49548e;});}})['then'](respondWithStatusCode(_0x50f4bd,null))[_0x7721('0x30')](handleError(_0x50f4bd,null));};exports[_0x7721('0xad')]=function(_0x4ea8ac,_0x226556){var _0x4bd023={};var _0x50de45={};var _0x51ac8f;var _0x27ed5e;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x4ea8ac[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x226556,null))['then'](function(_0x4893c0){if(_0x4893c0){_0x51ac8f=_0x4893c0;_0x50de45[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x8a')][_0x7721('0x34')]);_0x50de45[_0x7721('0x2d')]=_['keys'](_0x4ea8ac[_0x7721('0x2d')]);_0x50de45[_0x7721('0x35')]=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],_0x50de45[_0x7721('0x2d')]);_0x4bd023['attributes']=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],qs[_0x7721('0x38')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x38')]));_0x4bd023[_0x7721('0x36')]=_0x4bd023['attributes']['length']?_0x4bd023[_0x7721('0x36')]:_0x50de45[_0x7721('0x32')];_0x4bd023[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x51')]);_0x4bd023[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x4ea8ac[_0x7721('0x2d')],_0x50de45[_0x7721('0x35')]));if(_0x4ea8ac['query'][_0x7721('0x1c')]){_0x4bd023[_0x7721('0x2b')]=_['merge'](_0x4bd023[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x4bd023[_0x7721('0x36')],function(_0x400273){var _0x42c438={};_0x42c438[_0x400273]={'$like':'%'+_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x42c438;})});}_0x4bd023=_[_0x7721('0x47')]({},_0x4bd023,_0x4ea8ac[_0x7721('0x3a')]);return _0x51ac8f[_0x7721('0xad')](_0x4bd023);}})[_0x7721('0x16')](function(_0x1192a8){if(_0x1192a8){_0x27ed5e=_0x1192a8[_0x7721('0x39')];if(!_0x4ea8ac['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x4bd023['limit']=qs[_0x7721('0x4f')](_0x4ea8ac['query'][_0x7721('0x4f')]);_0x4bd023[_0x7721('0x11')]=qs['offset'](_0x4ea8ac['query'][_0x7721('0x11')]);}return _0x51ac8f['getBlackLists'](_0x4bd023);}})[_0x7721('0x16')](function(_0x2f7067){if(_0x2f7067){return _0x2f7067?{'count':_0x27ed5e,'rows':_0x2f7067}:null;}})[_0x7721('0x16')](respondWithResult(_0x226556,null))[_0x7721('0x30')](handleError(_0x226556,null));};exports[_0x7721('0xae')]=function(_0x376f37,_0x5b157e){var _0x4b84b9;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x376f37[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x5b157e,null))[_0x7721('0x16')](function(_0x39d43b){if(_0x39d43b){return _0x39d43b['addBlackLists'](_0x376f37['body'][_0x7721('0x81')],_[_0x7721('0x43')](_0x376f37[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x430304){var _0x469b6b;_0x4b84b9=_0x430304||[];var _0x6766c6=[];if(_0x430304){for(var _0x37877c=0x0;_0x37877c<_0x430304['length'];_0x37877c+=0x1){var _0x259eaa=_0x430304[_0x37877c][_0x7721('0x18')]({'plain':!![]});_0x469b6b=squel['insert']()['into'](_0x7721('0xaf'))[_0x7721('0xa1')]([_0x7721('0x95'),'ContactId',_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x259eaa['CmListId'][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0x376f37[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field'](_0x7721('0xb0'),_0x7721('0x44'))[_0x7721('0x6f')](_0x7721('0xb0'),'updatedAt')[_0x7721('0x70')](_0x7721('0x97'))['where'](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x259eaa['CmListId']['toString']())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();_0x6766c6[_0x7721('0x77')](db['sequelize'][_0x7721('0x2d')](_0x469b6b));}return BPromise[_0x7721('0x7e')](_0x6766c6);}})['then'](function(){return _0x4b84b9;})[_0x7721('0x16')](respondWithResult(_0x5b157e,null))[_0x7721('0x30')](handleError(_0x5b157e,null));};exports[_0x7721('0xb1')]=function(_0x37da70,_0x54616a){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x37da70[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x54616a,null))[_0x7721('0x16')](function(_0x174e79){if(_0x174e79){return _0x174e79['removeBlackLists'](_0x37da70[_0x7721('0x2d')]['ids']);}})[_0x7721('0x16')](function(_0x4c1b63){if(_0x4c1b63){return db[_0x7721('0x57')][_0x7721('0x17')]({'where':{'ListId':_0x37da70[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0x37da70[_0x7721('0x31')]['id']}})['then'](function(){return _0x4c1b63;});}})[_0x7721('0x16')](respondWithStatusCode(_0x54616a,null))[_0x7721('0x30')](handleError(_0x54616a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 92452cf..c13daf3 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 _0xdfc9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','VoiceQueue'];(function(_0x528e34,_0x49857e){var _0x6a2744=function(_0x437f40){while(--_0x437f40){_0x528e34['push'](_0x528e34['shift']());}};_0x6a2744(++_0x49857e);}(_0xdfc9,0x11e));var _0x9dfc=function(_0x3c0c96,_0x449674){_0x3c0c96=_0x3c0c96-0x0;var _0x1780ec=_0xdfc9[_0x3c0c96];return _0x1780ec;};'use strict';var EventEmitter=require(_0x9dfc('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x9dfc('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9dfc('0x2')](0x0);var events={'afterCreate':_0x9dfc('0x3'),'afterUpdate':_0x9dfc('0x4'),'afterDestroy':_0x9dfc('0x5')};function emitEvent(_0x41621e){return function(_0x24e621,_0x1f8d1e,_0xd47d59){VoiceQueueEvents[_0x9dfc('0x6')](_0x41621e+':'+_0x24e621['id'],_0x24e621);VoiceQueueEvents[_0x9dfc('0x6')](_0x41621e,_0x24e621);_0xd47d59(null);};}for(var e in events){if(events[_0x9dfc('0x7')](e)){var event=events[e];VoiceQueue[_0x9dfc('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x15f4=['../../mysqldb','VoiceQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x46d616,_0x315082){var _0x4fd0ce=function(_0x2ff11e){while(--_0x2ff11e){_0x46d616['push'](_0x46d616['shift']());}};_0x4fd0ce(++_0x315082);}(_0x15f4,0x1b8));var _0x415f=function(_0x43f0ca,_0xfc9e5a){_0x43f0ca=_0x43f0ca-0x0;var _0x4d2b1d=_0x15f4[_0x43f0ca];return _0x4d2b1d;};'use strict';var EventEmitter=require(_0x415f('0x0'));var VoiceQueue=require(_0x415f('0x1'))['db'][_0x415f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x415f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x415f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a3c44){return function(_0x258368,_0x474fe7,_0x3a61e4){VoiceQueueEvents[_0x415f('0x5')](_0x2a3c44+':'+_0x258368['id'],_0x258368);VoiceQueueEvents[_0x415f('0x5')](_0x2a3c44,_0x258368);_0x3a61e4(null);};}for(var e in events){if(events[_0x415f('0x6')](e)){var event=events[e];VoiceQueue[_0x415f('0x7')](e,emitEvent(event));}}module[_0x415f('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 11af60a..f3b4399 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0xc0b1b,_0x397cd5){var _0x3d50bc=function(_0x414790){while(--_0x414790){_0xc0b1b['push'](_0xc0b1b['shift']());}};_0x3d50bc(++_0x397cd5);}(_0x34e8,0x12c));var _0x834e=function(_0x4fcaea,_0x4d89d9){_0x4fcaea=_0x4fcaea-0x0;var _0xebdf59=_0x34e8[_0x4fcaea];return _0xebdf59;};'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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x39d9ec,_0x4ed6e5){var _0x499ff0=function(_0x565eaf){while(--_0x565eaf){_0x39d9ec['push'](_0x39d9ec['shift']());}};_0x499ff0(++_0x4ed6e5);}(_0x3e74,0x175));var _0x43e7=function(_0x37d005,_0x40414a){_0x37d005=_0x37d005-0x0;var _0x202b00=_0x3e74[_0x37d005];return _0x202b00;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index cf8c27c..de75efc 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 _0x1ae6=['model','attributes','map','VoiceQueue','raw','ShowVoiceQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','where','limit','include'];(function(_0x45d972,_0x26d63f){var _0x29da5c=function(_0x531fab){while(--_0x531fab){_0x45d972['push'](_0x45d972['shift']());}};_0x29da5c(++_0x26d63f);}(_0x1ae6,0x1e7));var _0x61ae=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1ae6[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x61ae('0x0'));var util=require(_0x61ae('0x1'));var moment=require(_0x61ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x61ae('0x3'));var fs=require('fs');var Redis=require(_0x61ae('0x4'));var db=require(_0x61ae('0x5'))['db'];var utils=require(_0x61ae('0x6'));var logger=require(_0x61ae('0x7'))(_0x61ae('0x8'));var config=require(_0x61ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x61ae('0xa')][_0x61ae('0xb')]({'port':0x232a});config[_0x61ae('0xc')]=_[_0x61ae('0xd')](config[_0x61ae('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61ae('0xc')]));require(_0x61ae('0xe'))['register'](socket);function respondWithRpcPromise(_0x422197,_0x5b81e6,_0x52988a){return new BPromise(function(_0x4f64d1,_0x42b5d5){return client['request'](_0x422197,_0x52988a)[_0x61ae('0xf')](function(_0x3cd65c){logger[_0x61ae('0x10')](_0x61ae('0x11'),_0x5b81e6,_0x61ae('0x12'));logger[_0x61ae('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5b81e6,_0x61ae('0x12'),JSON[_0x61ae('0x14')](_0x3cd65c));if(_0x3cd65c['error']){if(_0x3cd65c['error']['code']===0x1f4){logger[_0x61ae('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x5b81e6,_0x3cd65c[_0x61ae('0x15')]['message']);return _0x42b5d5(_0x3cd65c['error'][_0x61ae('0x16')]);}logger[_0x61ae('0x15')](_0x61ae('0x11'),_0x5b81e6,_0x3cd65c['error'][_0x61ae('0x16')]);return _0x4f64d1(_0x3cd65c[_0x61ae('0x15')][_0x61ae('0x16')]);}else{logger[_0x61ae('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x5b81e6,'request\x20sent');_0x4f64d1(_0x3cd65c[_0x61ae('0x17')]['message']);}})[_0x61ae('0x18')](function(_0x3fbf98){logger['error'](_0x61ae('0x11'),_0x5b81e6,_0x3fbf98);_0x42b5d5(_0x3fbf98);});});}exports[_0x61ae('0x19')]=function(_0x4c97ec){var _0x397d57=this;return new Promise(function(_0x1c94da,_0x38a0db){return db['VoiceQueue'][_0x61ae('0x1a')]({'raw':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec[_0x61ae('0x1b')][_0x61ae('0x1c')]||null:null,'attributes':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec[_0x61ae('0x1b')]['attributes']||null:null,'limit':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec[_0x61ae('0x1b')][_0x61ae('0x1d')]||null:null,'include':_0x4c97ec[_0x61ae('0x1b')]?_0x4c97ec['options']['include']?_['map'](_0x4c97ec[_0x61ae('0x1b')][_0x61ae('0x1e')],function(_0x7558e8){return{'model':db[_0x7558e8[_0x61ae('0x1f')]],'as':_0x7558e8['as'],'attributes':_0x7558e8[_0x61ae('0x20')],'include':_0x7558e8[_0x61ae('0x1e')]?_[_0x61ae('0x21')](_0x7558e8['include'],function(_0x4d2be7){return{'model':db[_0x4d2be7[_0x61ae('0x1f')]],'as':_0x4d2be7['as'],'attributes':_0x4d2be7[_0x61ae('0x20')],'include':_0x4d2be7['include']?_['map'](_0x4d2be7[_0x61ae('0x1e')],function(_0x2aa83a){return{'model':db[_0x2aa83a[_0x61ae('0x1f')]],'as':_0x2aa83a['as'],'attributes':_0x2aa83a[_0x61ae('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xed769e){logger[_0x61ae('0x10')](_0x61ae('0x19'),_0x4c97ec);logger[_0x61ae('0x13')]('GetVoiceQueue',_0x4c97ec,JSON[_0x61ae('0x14')](_0xed769e));_0x1c94da(_0xed769e);})[_0x61ae('0x18')](function(_0x33a589){logger[_0x61ae('0x15')](_0x61ae('0x19'),_0x33a589['message'],_0x4c97ec);_0x38a0db(_0x397d57[_0x61ae('0x15')](0x1f4,_0x33a589[_0x61ae('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x16a298){var _0x47ae8a=this;return new Promise(function(_0x31ce60,_0x525201){return db[_0x61ae('0x22')]['find']({'raw':_0x16a298[_0x61ae('0x1b')]?_0x16a298[_0x61ae('0x1b')][_0x61ae('0x23')]===undefined?!![]:![]:!![],'where':_0x16a298[_0x61ae('0x1b')]?_0x16a298[_0x61ae('0x1b')][_0x61ae('0x1c')]||null:null,'attributes':_0x16a298[_0x61ae('0x1b')]?_0x16a298[_0x61ae('0x1b')]['attributes']||null:null,'include':_0x16a298['options']?_0x16a298[_0x61ae('0x1b')][_0x61ae('0x1e')]?_['map'](_0x16a298[_0x61ae('0x1b')]['include'],function(_0x115b3a){return{'model':db[_0x115b3a[_0x61ae('0x1f')]],'as':_0x115b3a['as'],'attributes':_0x115b3a[_0x61ae('0x20')],'include':_0x115b3a[_0x61ae('0x1e')]?_[_0x61ae('0x21')](_0x115b3a['include'],function(_0x509edd){return{'model':db[_0x509edd[_0x61ae('0x1f')]],'as':_0x509edd['as'],'attributes':_0x509edd[_0x61ae('0x20')],'include':_0x509edd[_0x61ae('0x1e')]?_[_0x61ae('0x21')](_0x509edd[_0x61ae('0x1e')],function(_0x375f97){return{'model':db[_0x375f97[_0x61ae('0x1f')]],'as':_0x375f97['as'],'attributes':_0x375f97[_0x61ae('0x20')]};}):[]};}):[]};}):[]:[]})[_0x61ae('0xf')](function(_0x5262b0){logger['info'](_0x61ae('0x24'),_0x16a298);logger[_0x61ae('0x13')](_0x61ae('0x24'),_0x16a298,JSON[_0x61ae('0x14')](_0x5262b0));_0x31ce60(_0x5262b0);})['catch'](function(_0x51ea6c){logger[_0x61ae('0x15')](_0x61ae('0x24'),_0x51ea6c['message'],_0x16a298);_0x525201(_0x47ae8a[_0x61ae('0x15')](0x1f4,_0x51ea6c[_0x61ae('0x16')]));});});}; \ No newline at end of file +var _0x6f17=['then','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','localhost','redis','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x6f17,0x7c));var _0x76f1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x6f17[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x76f1('0x0'));var util=require(_0x76f1('0x1'));var moment=require(_0x76f1('0x2'));var BPromise=require('bluebird');var rs=require(_0x76f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x76f1('0x4'));var logger=require(_0x76f1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x76f1('0x6'));var client=jayson[_0x76f1('0x7')][_0x76f1('0x8')]({'port':0x232a});config['redis']=_[_0x76f1('0x9')](config['redis'],{'host':_0x76f1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76f1('0xb')]));require(_0x76f1('0xc'))[_0x76f1('0xd')](socket);function respondWithRpcPromise(_0x260f58,_0x429d44,_0x36bf09){return new BPromise(function(_0x40a023,_0x3d0171){return client[_0x76f1('0xe')](_0x260f58,_0x36bf09)['then'](function(_0x47a88b){logger['info'](_0x76f1('0xf'),_0x429d44,'request\x20sent');logger[_0x76f1('0x10')](_0x76f1('0x11'),_0x429d44,_0x76f1('0x12'),JSON[_0x76f1('0x13')](_0x47a88b));if(_0x47a88b[_0x76f1('0x14')]){if(_0x47a88b[_0x76f1('0x14')][_0x76f1('0x15')]===0x1f4){logger[_0x76f1('0x14')](_0x76f1('0xf'),_0x429d44,_0x47a88b[_0x76f1('0x14')][_0x76f1('0x16')]);return _0x3d0171(_0x47a88b[_0x76f1('0x14')][_0x76f1('0x16')]);}logger['error'](_0x76f1('0xf'),_0x429d44,_0x47a88b[_0x76f1('0x14')][_0x76f1('0x16')]);return _0x40a023(_0x47a88b['error']['message']);}else{logger[_0x76f1('0x17')](_0x76f1('0xf'),_0x429d44,'request\x20sent');_0x40a023(_0x47a88b[_0x76f1('0x18')]['message']);}})[_0x76f1('0x19')](function(_0x2abbdb){logger[_0x76f1('0x14')](_0x76f1('0xf'),_0x429d44,_0x2abbdb);_0x3d0171(_0x2abbdb);});});}exports[_0x76f1('0x1a')]=function(_0x306757){var _0x1f20b0=this;return new Promise(function(_0x343fc8,_0x4d68e1){return db['VoiceQueue'][_0x76f1('0x1b')]({'raw':_0x306757[_0x76f1('0x1c')]?_0x306757[_0x76f1('0x1c')][_0x76f1('0x1d')]===undefined?!![]:![]:!![],'where':_0x306757[_0x76f1('0x1c')]?_0x306757['options'][_0x76f1('0x1e')]||null:null,'attributes':_0x306757[_0x76f1('0x1c')]?_0x306757[_0x76f1('0x1c')][_0x76f1('0x1f')]||null:null,'limit':_0x306757[_0x76f1('0x1c')]?_0x306757[_0x76f1('0x1c')][_0x76f1('0x20')]||null:null,'include':_0x306757[_0x76f1('0x1c')]?_0x306757[_0x76f1('0x1c')][_0x76f1('0x21')]?_[_0x76f1('0x22')](_0x306757['options'][_0x76f1('0x21')],function(_0x53feb9){return{'model':db[_0x53feb9[_0x76f1('0x23')]],'as':_0x53feb9['as'],'attributes':_0x53feb9[_0x76f1('0x1f')],'include':_0x53feb9[_0x76f1('0x21')]?_[_0x76f1('0x22')](_0x53feb9[_0x76f1('0x21')],function(_0x34da7f){return{'model':db[_0x34da7f[_0x76f1('0x23')]],'as':_0x34da7f['as'],'attributes':_0x34da7f['attributes'],'include':_0x34da7f[_0x76f1('0x21')]?_['map'](_0x34da7f[_0x76f1('0x21')],function(_0x2c9198){return{'model':db[_0x2c9198['model']],'as':_0x2c9198['as'],'attributes':_0x2c9198['attributes']};}):[]};}):[]};}):[]:[]})[_0x76f1('0x24')](function(_0x50eb4e){logger[_0x76f1('0x17')]('GetVoiceQueue',_0x306757);logger['debug']('GetVoiceQueue',_0x306757,JSON[_0x76f1('0x13')](_0x50eb4e));_0x343fc8(_0x50eb4e);})[_0x76f1('0x19')](function(_0x5eda8a){logger[_0x76f1('0x14')](_0x76f1('0x1a'),_0x5eda8a['message'],_0x306757);_0x4d68e1(_0x1f20b0[_0x76f1('0x14')](0x1f4,_0x5eda8a['message']));});});};exports[_0x76f1('0x25')]=function(_0x33d4ae){var _0x134ac9=this;return new Promise(function(_0x5887e9,_0x1f387a){return db[_0x76f1('0x26')][_0x76f1('0x27')]({'raw':_0x33d4ae[_0x76f1('0x1c')]?_0x33d4ae['options'][_0x76f1('0x1d')]===undefined?!![]:![]:!![],'where':_0x33d4ae[_0x76f1('0x1c')]?_0x33d4ae[_0x76f1('0x1c')]['where']||null:null,'attributes':_0x33d4ae[_0x76f1('0x1c')]?_0x33d4ae[_0x76f1('0x1c')]['attributes']||null:null,'include':_0x33d4ae[_0x76f1('0x1c')]?_0x33d4ae[_0x76f1('0x1c')][_0x76f1('0x21')]?_[_0x76f1('0x22')](_0x33d4ae['options'][_0x76f1('0x21')],function(_0x4cbb46){return{'model':db[_0x4cbb46[_0x76f1('0x23')]],'as':_0x4cbb46['as'],'attributes':_0x4cbb46['attributes'],'include':_0x4cbb46[_0x76f1('0x21')]?_['map'](_0x4cbb46['include'],function(_0x1a610f){return{'model':db[_0x1a610f['model']],'as':_0x1a610f['as'],'attributes':_0x1a610f['attributes'],'include':_0x1a610f[_0x76f1('0x21')]?_['map'](_0x1a610f[_0x76f1('0x21')],function(_0x45969e){return{'model':db[_0x45969e['model']],'as':_0x45969e['as'],'attributes':_0x45969e[_0x76f1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x76f1('0x24')](function(_0x3ed309){logger[_0x76f1('0x17')]('ShowVoiceQueue',_0x33d4ae);logger['debug'](_0x76f1('0x25'),_0x33d4ae,JSON[_0x76f1('0x13')](_0x3ed309));_0x5887e9(_0x3ed309);})[_0x76f1('0x19')](function(_0x1fd532){logger[_0x76f1('0x14')]('ShowVoiceQueue',_0x1fd532[_0x76f1('0x16')],_0x33d4ae);_0x1f387a(_0x134ac9[_0x76f1('0x14')](0x1f4,_0x1fd532['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2824abe..6bed592 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 _0xe4a0=['emit','removeListener','register','length','remove','update'];(function(_0x10ebe7,_0x116650){var _0xc03446=function(_0x46527c){while(--_0x46527c){_0x10ebe7['push'](_0x10ebe7['shift']());}};_0xc03446(++_0x116650);}(_0xe4a0,0x94));var _0x0e4a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe4a0[_0x3bf83f];return _0x22c4a9;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x0e4a('0x0'),_0x0e4a('0x1')];function createListener(_0x39bc32,_0x554d21){return function(_0x1d9e23){_0x554d21[_0x0e4a('0x2')](_0x39bc32,_0x1d9e23);};}function removeListener(_0x1e16ea,_0x4b15e2){return function(){VoiceQueueEvents[_0x0e4a('0x3')](_0x1e16ea,_0x4b15e2);};}exports[_0x0e4a('0x4')]=function(_0xdcb40d){for(var _0x364661=0x0,_0x21280b=events[_0x0e4a('0x5')];_0x364661<_0x21280b;_0x364661++){var _0x2b96c7=events[_0x364661];var _0x1e4eb7=createListener('voiceQueue:'+_0x2b96c7,_0xdcb40d);VoiceQueueEvents['on'](_0x2b96c7,_0x1e4eb7);}}; \ No newline at end of file +var _0xceac=['emit','removeListener','length','./voiceQueue.events','save','update'];(function(_0x33de83,_0x4a2401){var _0x2c18dd=function(_0x15dff5){while(--_0x15dff5){_0x33de83['push'](_0x33de83['shift']());}};_0x2c18dd(++_0x4a2401);}(_0xceac,0x153));var _0xccea=function(_0x4d9798,_0x4f0807){_0x4d9798=_0x4d9798-0x0;var _0x48975f=_0xceac[_0x4d9798];return _0x48975f;};'use strict';var VoiceQueueEvents=require(_0xccea('0x0'));var events=[_0xccea('0x1'),'remove',_0xccea('0x2')];function createListener(_0x5f2892,_0x11d92d){return function(_0x10a035){_0x11d92d[_0xccea('0x3')](_0x5f2892,_0x10a035);};}function removeListener(_0x1a6108,_0x3220f1){return function(){VoiceQueueEvents[_0xccea('0x4')](_0x1a6108,_0x3220f1);};}exports['register']=function(_0x464fee){for(var _0x49ffd7=0x0,_0x22c9a6=events[_0xccea('0x5')];_0x49ffd7<_0x22c9a6;_0x49ffd7++){var _0x1c2abd=events[_0x49ffd7];var _0x5d6497=createListener('voiceQueue:'+_0x1c2abd,_0x464fee);VoiceQueueEvents['on'](_0x1c2abd,_0x5d6497);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7d019a0..5027eea 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 _0xd762=['getVoiceQueuesReport','get','/:id','create','update','delete','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','describe'];(function(_0x337cca,_0x3508d0){var _0x5b5ece=function(_0x19d28c){while(--_0x19d28c){_0x337cca['push'](_0x337cca['shift']());}};_0x5b5ece(++_0x3508d0);}(_0xd762,0xb0));var _0x2d76=function(_0x2e1095,_0x3a7d94){_0x2e1095=_0x2e1095-0x0;var _0x3b2455=_0xd762[_0x2e1095];return _0x3b2455;};'use strict';var multer=require(_0x2d76('0x0'));var util=require('util');var path=require(_0x2d76('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2d76('0x2')]();var fs_extra=require(_0x2d76('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2d76('0x4'));var config=require(_0x2d76('0x5'));var controller=require(_0x2d76('0x6'));router['get']('/',auth[_0x2d76('0x7')](),controller[_0x2d76('0x8')]);router['get'](_0x2d76('0x9'),auth[_0x2d76('0x7')](),controller[_0x2d76('0xa')]);router['get']('/index',auth[_0x2d76('0x7')](),controller[_0x2d76('0xb')]);router[_0x2d76('0xc')](_0x2d76('0xd'),auth[_0x2d76('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2d76('0xe')]);router['put']('/:id',auth[_0x2d76('0x7')](),controller[_0x2d76('0xf')]);router[_0x2d76('0x10')](_0x2d76('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x98d9=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','get','/index','/:id','show','post','create','put','update','exports','multer'];(function(_0x30dbe1,_0xccce9f){var _0x571790=function(_0x2b8f6c){while(--_0x2b8f6c){_0x30dbe1['push'](_0x30dbe1['shift']());}};_0x571790(++_0xccce9f);}(_0x98d9,0x7d));var _0x998d=function(_0x507fe4,_0x5c02e0){_0x507fe4=_0x507fe4-0x0;var _0x395703=_0x98d9[_0x507fe4];return _0x395703;};'use strict';var multer=require(_0x998d('0x0'));var util=require(_0x998d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x998d('0x2'));var router=express[_0x998d('0x3')]();var fs_extra=require(_0x998d('0x4'));var auth=require(_0x998d('0x5'));var interaction=require(_0x998d('0x6'));var config=require(_0x998d('0x7'));var controller=require(_0x998d('0x8'));router['get']('/',auth[_0x998d('0x9')](),controller[_0x998d('0xa')]);router['get'](_0x998d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x998d('0xc')](_0x998d('0xd'),auth[_0x998d('0x9')](),controller['getVoiceQueuesReport']);router[_0x998d('0xc')](_0x998d('0xe'),auth[_0x998d('0x9')](),controller[_0x998d('0xf')]);router[_0x998d('0x10')]('/',auth[_0x998d('0x9')](),controller[_0x998d('0x11')]);router[_0x998d('0x12')](_0x998d('0xe'),auth[_0x998d('0x9')](),controller[_0x998d('0x13')]);router['delete'](_0x998d('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x998d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b5d6fe7..f7c8982 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 _0x6131=['YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x50b2a9,_0xdb2afa){var _0x222205=function(_0xa62904){while(--_0xa62904){_0x50b2a9['push'](_0x50b2a9['shift']());}};_0x222205(++_0xdb2afa);}(_0x6131,0x148));var _0x1613=function(_0x1348c0,_0x7a9608){_0x1348c0=_0x1348c0-0x0;var _0x8a6441=_0x6131[_0x1348c0];return _0x8a6441;};'use strict';var Sequelize=require(_0x1613('0x0'));var moment=require(_0x1613('0x1'));module[_0x1613('0x2')]={'type':{'type':Sequelize[_0x1613('0x3')]},'uniqueid':{'type':Sequelize[_0x1613('0x3')]},'calleridnum':{'type':Sequelize[_0x1613('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1613('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x1613('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1613('0x4')],'set':function(_0x164711){var _0x58446a=moment(_0x164711);var _0x3327c6=moment(this[_0x1613('0x5')](_0x1613('0x6')))[_0x1613('0x7')](_0x1613('0x8'));var _0x37d6ec=_0x58446a['diff'](_0x3327c6,_0x1613('0x9'));this[_0x1613('0xa')]('queuecallerleaveAt',_0x164711);this[_0x1613('0xa')](_0x1613('0xb'),_0x37d6ec||null);}},'position':{'type':Sequelize[_0x1613('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1613('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1613('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x1613('0x3')],'comment':_0x1613('0xe')},'originalposition':{'type':Sequelize[_0x1613('0xc')]},'channel':{'type':Sequelize[_0x1613('0x3')]},'connectedlinenum':{'type':Sequelize[_0x1613('0x3')]},'connectedlinename':{'type':Sequelize[_0x1613('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1613('0x3')]},'priority':{'type':Sequelize[_0x1613('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x1613('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1613('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1613('0x3')]},'transfer':{'type':Sequelize[_0x1613('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1613('0x3')],'comment':_0x1613('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x1613('0x3')]},'disposition':{'type':Sequelize[_0x1613('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1613('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x1613('0xc')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0d75=['moment','exports','STRING','DATE','format','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x21b47b,_0x1c6661){var _0x14f183=function(_0x2a03fe){while(--_0x2a03fe){_0x21b47b['push'](_0x21b47b['shift']());}};_0x14f183(++_0x1c6661);}(_0x0d75,0xd1));var _0x50d7=function(_0xbf4f64,_0x19442c){_0xbf4f64=_0xbf4f64-0x0;var _0x2db797=_0x0d75[_0xbf4f64];return _0x2db797;};'use strict';var Sequelize=require(_0x50d7('0x0'));var moment=require(_0x50d7('0x1'));module[_0x50d7('0x2')]={'type':{'type':Sequelize[_0x50d7('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x50d7('0x3')]},'calleridname':{'type':Sequelize[_0x50d7('0x3')]},'queue':{'type':Sequelize[_0x50d7('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x50d7('0x4')],'set':function(_0x33564d){var _0x5a92dc=moment(_0x33564d);var _0x2d7379=moment(this['getDataValue']('queuecallerjoinAt'))[_0x50d7('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x9d1065=_0x5a92dc['diff'](_0x2d7379,_0x50d7('0x6'));this['setDataValue'](_0x50d7('0x7'),_0x33564d);this[_0x50d7('0x8')](_0x50d7('0x9'),_0x9d1065||null);}},'position':{'type':Sequelize[_0x50d7('0xa')]},'count':{'type':Sequelize[_0x50d7('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x50d7('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x50d7('0x4')]},'queuecallerexit':{'type':Sequelize[_0x50d7('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x50d7('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x50d7('0x3')],'comment':_0x50d7('0xc')},'originalposition':{'type':Sequelize[_0x50d7('0xa')]},'channel':{'type':Sequelize[_0x50d7('0x3')]},'connectedlinenum':{'type':Sequelize[_0x50d7('0x3')]},'connectedlinename':{'type':Sequelize[_0x50d7('0x3')]},'accountcode':{'type':Sequelize[_0x50d7('0x3')]},'context':{'type':Sequelize[_0x50d7('0x3')]},'exten':{'type':Sequelize[_0x50d7('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x50d7('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x50d7('0x3')]},'transfer':{'type':Sequelize[_0x50d7('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x50d7('0x3')],'comment':_0x50d7('0xd')},'transferexten':{'type':Sequelize[_0x50d7('0x3')]},'transferuniqueid':{'type':Sequelize[_0x50d7('0x3')]},'disposition':{'type':Sequelize[_0x50d7('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x50d7('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x50d7('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2eba4d6..819d6d6 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 _0x0bc0=['defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','end','sendStatus','error','stack','name','send','VoiceQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x22b2be,_0x4b164c){var _0x213c31=function(_0x475528){while(--_0x475528){_0x22b2be['push'](_0x22b2be['shift']());}};_0x213c31(++_0x4b164c);}(_0x0bc0,0x12c));var _0x00bc=function(_0x5cd51d,_0x20d4fa){_0x5cd51d=_0x5cd51d-0x0;var _0x444608=_0x0bc0[_0x5cd51d];return _0x444608;};'use strict';var emlformat=require(_0x00bc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x00bc('0x1'));var rp=require(_0x00bc('0x2'));var moment=require(_0x00bc('0x3'));var BPromise=require(_0x00bc('0x4'));var Mustache=require(_0x00bc('0x5'));var util=require('util');var path=require(_0x00bc('0x6'));var sox=require(_0x00bc('0x7'));var csv=require(_0x00bc('0x8'));var ejs=require(_0x00bc('0x9'));var fs=require('fs');var fs_extra=require(_0x00bc('0xa'));var _=require('lodash');var squel=require(_0x00bc('0xb'));var crypto=require('crypto');var jsforce=require(_0x00bc('0xc'));var deskjs=require(_0x00bc('0xd'));var toCsv=require(_0x00bc('0x8'));var querystring=require(_0x00bc('0xe'));var Papa=require(_0x00bc('0xf'));var Redis=require(_0x00bc('0x10'));var authService=require(_0x00bc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x00bc('0x12'));var hardwareService=require(_0x00bc('0x13'));var logger=require('../../config/logger')(_0x00bc('0x14'));var utils=require('../../config/utils');var config=require(_0x00bc('0x15'));var licenseUtil=require(_0x00bc('0x16'));var db=require(_0x00bc('0x17'))['db'];config['redis']=_[_0x00bc('0x18')](config[_0x00bc('0x19')],{'host':_0x00bc('0x1a'),'port':0x18eb});var socket=require(_0x00bc('0x1b'))(new Redis(config[_0x00bc('0x19')]));require(_0x00bc('0x1c'))[_0x00bc('0x1d')](socket);function respondWithStatusCode(_0x188222,_0x510dae){_0x510dae=_0x510dae||0xcc;return function(_0x7af412){if(_0x7af412){return _0x188222['sendStatus'](_0x510dae);}return _0x188222[_0x00bc('0x1e')](_0x510dae)['end']();};}function respondWithResult(_0x2dbfc7,_0x28e6f7){_0x28e6f7=_0x28e6f7||0xc8;return function(_0x4df949){if(_0x4df949){return _0x2dbfc7[_0x00bc('0x1e')](_0x28e6f7)['json'](_0x4df949);}};}function respondWithFilteredResult(_0x2af001,_0x340694){return function(_0x45d264){if(_0x45d264){var _0xdc82d9=typeof _0x340694[_0x00bc('0x1f')]===_0x00bc('0x20')&&typeof _0x340694['limit']===_0x00bc('0x20');var _0x26a47e=_0x45d264[_0x00bc('0x21')];var _0x14658a=_0xdc82d9?0x0:_0x340694[_0x00bc('0x1f')];var _0x30bbfe=_0xdc82d9?_0x45d264[_0x00bc('0x21')]:_0x340694[_0x00bc('0x1f')]+_0x340694[_0x00bc('0x22')];var _0x39e655;if(_0x30bbfe>=_0x26a47e){_0x30bbfe=_0x26a47e;_0x39e655=0xc8;}else{_0x39e655=0xce;}_0x2af001['status'](_0x39e655);return _0x2af001[_0x00bc('0x23')](_0x00bc('0x24'),_0x14658a+'-'+_0x30bbfe+'/'+_0x26a47e)['json'](_0x45d264);}return null;};}function patchUpdates(_0x48dc18){return function(_0x19ffeb){try{jsonpatch['apply'](_0x19ffeb,_0x48dc18,!![]);}catch(_0x1445e7){return BPromise['reject'](_0x1445e7);}return _0x19ffeb[_0x00bc('0x25')]();};}function saveUpdates(_0x19ed6e,_0x267d8c){return function(_0x1f2230){if(_0x1f2230){return _0x1f2230[_0x00bc('0x26')](_0x19ed6e)[_0x00bc('0x27')](function(_0xe50fed){return _0xe50fed;});}return null;};}function removeEntity(_0x40b008,_0x33677e){return function(_0x34206b){if(_0x34206b){return _0x34206b[_0x00bc('0x28')]()['then'](function(){_0x40b008[_0x00bc('0x1e')](0xcc)[_0x00bc('0x29')]();});}};}function handleEntityNotFound(_0x3977b4,_0x369577){return function(_0xf85119){if(!_0xf85119){_0x3977b4[_0x00bc('0x2a')](0x194);}return _0xf85119;};}function handleError(_0x4ec07f,_0x145692){_0x145692=_0x145692||0x1f4;return function(_0x282593){logger[_0x00bc('0x2b')](_0x282593[_0x00bc('0x2c')]);if(_0x282593[_0x00bc('0x2d')]){delete _0x282593[_0x00bc('0x2d')];}_0x4ec07f[_0x00bc('0x1e')](_0x145692)[_0x00bc('0x2e')](_0x282593);};}exports['index']=function(_0x389cc2,_0x23eb94){var _0x23c313={},_0x5558ce={},_0x353855={'count':0x0,'rows':[]};var _0x3aadc2=_['map'](db[_0x00bc('0x2f')][_0x00bc('0x30')],function(_0x3bd185){return{'name':_0x3bd185[_0x00bc('0x31')],'type':_0x3bd185['type'][_0x00bc('0x32')]};});_0x5558ce[_0x00bc('0x33')]=_[_0x00bc('0x34')](_0x3aadc2,_0x00bc('0x2d'));_0x5558ce[_0x00bc('0x35')]=_[_0x00bc('0x36')](_0x389cc2[_0x00bc('0x35')]);_0x5558ce[_0x00bc('0x37')]=_[_0x00bc('0x38')](_0x5558ce['model'],_0x5558ce[_0x00bc('0x35')]);_0x23c313['attributes']=_[_0x00bc('0x38')](_0x5558ce[_0x00bc('0x33')],qs['fields'](_0x389cc2[_0x00bc('0x35')][_0x00bc('0x39')]));_0x23c313[_0x00bc('0x3a')]=_0x23c313[_0x00bc('0x3a')][_0x00bc('0x3b')]?_0x23c313[_0x00bc('0x3a')]:_0x5558ce[_0x00bc('0x33')];if(!_0x389cc2[_0x00bc('0x35')][_0x00bc('0x3c')](_0x00bc('0x3d'))){_0x23c313['limit']=qs[_0x00bc('0x22')](_0x389cc2[_0x00bc('0x35')][_0x00bc('0x22')]);_0x23c313[_0x00bc('0x1f')]=qs[_0x00bc('0x1f')](_0x389cc2[_0x00bc('0x35')][_0x00bc('0x1f')]);}_0x23c313[_0x00bc('0x3e')]=qs[_0x00bc('0x3f')](_0x389cc2[_0x00bc('0x35')][_0x00bc('0x3f')]);_0x23c313[_0x00bc('0x40')]=qs['filters'](_[_0x00bc('0x41')](_0x389cc2[_0x00bc('0x35')],_0x5558ce[_0x00bc('0x37')]),_0x3aadc2);if(_0x389cc2[_0x00bc('0x35')][_0x00bc('0x42')]){_0x23c313['where']=_[_0x00bc('0x43')](_0x23c313['where'],{'$or':_[_0x00bc('0x34')](_0x3aadc2,function(_0x520a05){if(_0x520a05[_0x00bc('0x44')]!=='VIRTUAL'){var _0x199103={};_0x199103[_0x520a05[_0x00bc('0x2d')]]={'$like':'%'+_0x389cc2['query'][_0x00bc('0x42')]+'%'};return _0x199103;}})});}_0x23c313=_[_0x00bc('0x43')]({},_0x23c313,_0x389cc2[_0x00bc('0x45')]);var _0xac2020={'where':_0x23c313['where']};return db[_0x00bc('0x2f')][_0x00bc('0x21')](_0xac2020)['then'](function(_0x55c4fd){_0x353855['count']=_0x55c4fd;if(_0x389cc2[_0x00bc('0x35')][_0x00bc('0x46')]){_0x23c313[_0x00bc('0x47')]=[{'all':!![]}];}return db[_0x00bc('0x2f')][_0x00bc('0x48')](_0x23c313);})[_0x00bc('0x27')](function(_0x177c3d){_0x353855[_0x00bc('0x49')]=_0x177c3d;return _0x353855;})[_0x00bc('0x27')](respondWithFilteredResult(_0x23eb94,_0x23c313))[_0x00bc('0x4a')](handleError(_0x23eb94,null));};exports['show']=function(_0x2efb49,_0x440733){var _0x44d62f={'raw':![],'where':{'id':_0x2efb49[_0x00bc('0x4b')]['id']}},_0x3ef363={};_0x3ef363[_0x00bc('0x33')]=_[_0x00bc('0x36')](db[_0x00bc('0x2f')][_0x00bc('0x30')]);_0x3ef363[_0x00bc('0x35')]=_['keys'](_0x2efb49['query']);_0x3ef363[_0x00bc('0x37')]=_[_0x00bc('0x38')](_0x3ef363[_0x00bc('0x33')],_0x3ef363[_0x00bc('0x35')]);_0x44d62f['attributes']=_[_0x00bc('0x38')](_0x3ef363[_0x00bc('0x33')],qs[_0x00bc('0x39')](_0x2efb49[_0x00bc('0x35')][_0x00bc('0x39')]));_0x44d62f[_0x00bc('0x3a')]=_0x44d62f[_0x00bc('0x3a')][_0x00bc('0x3b')]?_0x44d62f[_0x00bc('0x3a')]:_0x3ef363[_0x00bc('0x33')];if(_0x2efb49[_0x00bc('0x35')]['includeAll']){_0x44d62f[_0x00bc('0x47')]=[{'all':!![]}];}_0x44d62f=_[_0x00bc('0x43')]({},_0x44d62f,_0x2efb49[_0x00bc('0x45')]);return db[_0x00bc('0x2f')][_0x00bc('0x4c')](_0x44d62f)[_0x00bc('0x27')](handleEntityNotFound(_0x440733,null))[_0x00bc('0x27')](respondWithResult(_0x440733,null))[_0x00bc('0x4a')](handleError(_0x440733,null));};exports[_0x00bc('0x4d')]=function(_0x3299ef,_0x2133f2){return db['VoiceQueueReport'][_0x00bc('0x4d')](_0x3299ef[_0x00bc('0x4e')],{})[_0x00bc('0x27')](respondWithResult(_0x2133f2,0xc9))['catch'](handleError(_0x2133f2,null));};exports[_0x00bc('0x26')]=function(_0xd4c079,_0x5bd7d3){if(_0xd4c079[_0x00bc('0x4e')]['id']){delete _0xd4c079['body']['id'];}return db['VoiceQueueReport'][_0x00bc('0x4c')]({'where':{'id':_0xd4c079['params']['id']}})[_0x00bc('0x27')](handleEntityNotFound(_0x5bd7d3,null))[_0x00bc('0x27')](saveUpdates(_0xd4c079[_0x00bc('0x4e')],null))[_0x00bc('0x27')](respondWithResult(_0x5bd7d3,null))['catch'](handleError(_0x5bd7d3,null));};exports[_0x00bc('0x28')]=function(_0x9d2b84,_0x59dd9b){return db[_0x00bc('0x2f')][_0x00bc('0x4c')]({'where':{'id':_0x9d2b84[_0x00bc('0x4b')]['id']}})[_0x00bc('0x27')](handleEntityNotFound(_0x59dd9b,null))['then'](removeEntity(_0x59dd9b,null))[_0x00bc('0x4a')](handleError(_0x59dd9b,null));};exports['describe']=function(_0x464728,_0x16e9f1){return db[_0x00bc('0x2f')][_0x00bc('0x4f')]()['then'](respondWithResult(_0x16e9f1,null))[_0x00bc('0x4a')](handleError(_0x16e9f1,null));};exports['getVoiceQueuesReport']=function(_0x99d9b3,_0x4f042c){var _0x47c9ff={},_0x6b8a16={},_0x146791={'count':0x0,'rows':[]};_0x6b8a16[_0x00bc('0x33')]=_[_0x00bc('0x36')](db['VoiceQueueReport'][_0x00bc('0x30')]);_0x6b8a16[_0x00bc('0x35')]=_[_0x00bc('0x36')](_0x99d9b3[_0x00bc('0x35')]);_0x6b8a16[_0x00bc('0x37')]=_[_0x00bc('0x38')](_0x6b8a16[_0x00bc('0x33')],_0x6b8a16[_0x00bc('0x35')]);_0x47c9ff[_0x00bc('0x3a')]=_[_0x00bc('0x38')](_0x6b8a16[_0x00bc('0x33')],qs[_0x00bc('0x39')](_0x99d9b3[_0x00bc('0x35')][_0x00bc('0x39')]));_0x47c9ff[_0x00bc('0x3a')]=_0x47c9ff['attributes'][_0x00bc('0x3b')]?_0x47c9ff['attributes']:_0x6b8a16['model'];if(!_0x99d9b3[_0x00bc('0x35')]['hasOwnProperty'](_0x00bc('0x3d'))){_0x47c9ff[_0x00bc('0x22')]=qs[_0x00bc('0x22')](_0x99d9b3[_0x00bc('0x35')]['limit']);_0x47c9ff[_0x00bc('0x1f')]=qs[_0x00bc('0x1f')](_0x99d9b3[_0x00bc('0x35')][_0x00bc('0x1f')]);}_0x47c9ff[_0x00bc('0x3e')]=qs[_0x00bc('0x3f')](_0x99d9b3[_0x00bc('0x35')][_0x00bc('0x3f')]);_0x47c9ff[_0x00bc('0x40')]=qs[_0x00bc('0x37')](_[_0x00bc('0x41')](_0x99d9b3[_0x00bc('0x35')],_0x6b8a16[_0x00bc('0x37')]));if(_0x99d9b3[_0x00bc('0x35')]['filter']){_0x47c9ff[_0x00bc('0x40')]=_[_0x00bc('0x43')](_0x47c9ff['where'],{'$or':_[_0x00bc('0x34')](_0x47c9ff['attributes'],function(_0x3c7297){var _0x317db7={};_0x317db7[_0x3c7297]={'$like':'%'+_0x99d9b3['query'][_0x00bc('0x42')]+'%'};return _0x317db7;})});}_0x47c9ff=_[_0x00bc('0x43')]({},_0x47c9ff,_0x99d9b3[_0x00bc('0x45')]);var _0x247fe6={'where':_0x47c9ff[_0x00bc('0x40')]};return db[_0x00bc('0x2f')][_0x00bc('0x21')](_0x247fe6)[_0x00bc('0x27')](function(_0x4e5877){_0x146791[_0x00bc('0x21')]=_0x4e5877;if(_0x99d9b3['query'][_0x00bc('0x46')]){_0x47c9ff['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x00bc('0x48')](_0x47c9ff);})[_0x00bc('0x27')](function(_0x2b743c){_0x146791[_0x00bc('0x49')]=_0x2b743c;return _0x146791;})[_0x00bc('0x27')](respondWithFilteredResult(_0x4f042c,_0x47c9ff,_0x00bc('0x50')))[_0x00bc('0x4a')](handleError(_0x4f042c,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xbcc2=['end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','VoiceQueueReport','rows','catch','show','params','fields','options','find','create','body','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./voiceQueueReport.socket'];(function(_0xe0246a,_0x1831c6){var _0x438e91=function(_0x5f2486){while(--_0x5f2486){_0xe0246a['push'](_0xe0246a['shift']());}};_0x438e91(++_0x1831c6);}(_0xbcc2,0x17d));var _0x2bcc=function(_0x6c48d2,_0x26164e){_0x6c48d2=_0x6c48d2-0x0;var _0x577eef=_0xbcc2[_0x6c48d2];return _0x577eef;};'use strict';var emlformat=require(_0x2bcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2bcc('0x1'));var jsonpatch=require(_0x2bcc('0x2'));var rp=require(_0x2bcc('0x3'));var moment=require(_0x2bcc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bcc('0x5'));var util=require('util');var path=require(_0x2bcc('0x6'));var sox=require(_0x2bcc('0x7'));var csv=require(_0x2bcc('0x8'));var ejs=require(_0x2bcc('0x9'));var fs=require('fs');var fs_extra=require(_0x2bcc('0xa'));var _=require(_0x2bcc('0xb'));var squel=require(_0x2bcc('0xc'));var crypto=require(_0x2bcc('0xd'));var jsforce=require(_0x2bcc('0xe'));var deskjs=require(_0x2bcc('0xf'));var toCsv=require(_0x2bcc('0x8'));var querystring=require(_0x2bcc('0x10'));var Papa=require(_0x2bcc('0x11'));var Redis=require('ioredis');var authService=require(_0x2bcc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2bcc('0x13'));var hardwareService=require(_0x2bcc('0x14'));var logger=require(_0x2bcc('0x15'))('api');var utils=require(_0x2bcc('0x16'));var config=require(_0x2bcc('0x17'));var licenseUtil=require(_0x2bcc('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2bcc('0x19')](config[_0x2bcc('0x1a')],{'host':_0x2bcc('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bcc('0x1a')]));require(_0x2bcc('0x1c'))['register'](socket);function respondWithStatusCode(_0x5150eb,_0x1532ce){_0x1532ce=_0x1532ce||0xcc;return function(_0x12dc9f){if(_0x12dc9f){return _0x5150eb['sendStatus'](_0x1532ce);}return _0x5150eb['status'](_0x1532ce)[_0x2bcc('0x1d')]();};}function respondWithResult(_0x1913ae,_0x312d78){_0x312d78=_0x312d78||0xc8;return function(_0x1af9b9){if(_0x1af9b9){return _0x1913ae[_0x2bcc('0x1e')](_0x312d78)['json'](_0x1af9b9);}};}function respondWithFilteredResult(_0x38b43d,_0x4a1a41){return function(_0x41705b){if(_0x41705b){var _0x2406eb=typeof _0x4a1a41[_0x2bcc('0x1f')]===_0x2bcc('0x20')&&typeof _0x4a1a41['limit']===_0x2bcc('0x20');var _0x899083=_0x41705b[_0x2bcc('0x21')];var _0x5c6596=_0x2406eb?0x0:_0x4a1a41['offset'];var _0x137cbb=_0x2406eb?_0x41705b[_0x2bcc('0x21')]:_0x4a1a41[_0x2bcc('0x1f')]+_0x4a1a41['limit'];var _0x43f86e;if(_0x137cbb>=_0x899083){_0x137cbb=_0x899083;_0x43f86e=0xc8;}else{_0x43f86e=0xce;}_0x38b43d[_0x2bcc('0x1e')](_0x43f86e);return _0x38b43d[_0x2bcc('0x22')](_0x2bcc('0x23'),_0x5c6596+'-'+_0x137cbb+'/'+_0x899083)[_0x2bcc('0x24')](_0x41705b);}return null;};}function patchUpdates(_0x4458b8){return function(_0x32890f){try{jsonpatch[_0x2bcc('0x25')](_0x32890f,_0x4458b8,!![]);}catch(_0x4f1508){return BPromise[_0x2bcc('0x26')](_0x4f1508);}return _0x32890f[_0x2bcc('0x27')]();};}function saveUpdates(_0x5c70fe,_0x2a4d48){return function(_0x45260e){if(_0x45260e){return _0x45260e[_0x2bcc('0x28')](_0x5c70fe)[_0x2bcc('0x29')](function(_0x29ca82){return _0x29ca82;});}return null;};}function removeEntity(_0x39557c,_0x138186){return function(_0x1e5215){if(_0x1e5215){return _0x1e5215[_0x2bcc('0x2a')]()[_0x2bcc('0x29')](function(){_0x39557c[_0x2bcc('0x1e')](0xcc)[_0x2bcc('0x1d')]();});}};}function handleEntityNotFound(_0x56ead7,_0xea83b8){return function(_0x5e60e4){if(!_0x5e60e4){_0x56ead7['sendStatus'](0x194);}return _0x5e60e4;};}function handleError(_0x3a4bef,_0x25058a){_0x25058a=_0x25058a||0x1f4;return function(_0x4262ec){logger[_0x2bcc('0x2b')](_0x4262ec[_0x2bcc('0x2c')]);if(_0x4262ec[_0x2bcc('0x2d')]){delete _0x4262ec[_0x2bcc('0x2d')];}_0x3a4bef['status'](_0x25058a)[_0x2bcc('0x2e')](_0x4262ec);};}exports['index']=function(_0x439b75,_0x558b3b){var _0x260020={},_0x308c0c={},_0x472c5e={'count':0x0,'rows':[]};var _0x37e2d9=_['map'](db['VoiceQueueReport'][_0x2bcc('0x2f')],function(_0x3a4904){return{'name':_0x3a4904[_0x2bcc('0x30')],'type':_0x3a4904[_0x2bcc('0x31')][_0x2bcc('0x32')]};});_0x308c0c[_0x2bcc('0x33')]=_[_0x2bcc('0x34')](_0x37e2d9,_0x2bcc('0x2d'));_0x308c0c[_0x2bcc('0x35')]=_[_0x2bcc('0x36')](_0x439b75[_0x2bcc('0x35')]);_0x308c0c[_0x2bcc('0x37')]=_[_0x2bcc('0x38')](_0x308c0c[_0x2bcc('0x33')],_0x308c0c[_0x2bcc('0x35')]);_0x260020[_0x2bcc('0x39')]=_['intersection'](_0x308c0c[_0x2bcc('0x33')],qs['fields'](_0x439b75[_0x2bcc('0x35')]['fields']));_0x260020[_0x2bcc('0x39')]=_0x260020[_0x2bcc('0x39')][_0x2bcc('0x3a')]?_0x260020[_0x2bcc('0x39')]:_0x308c0c[_0x2bcc('0x33')];if(!_0x439b75[_0x2bcc('0x35')][_0x2bcc('0x3b')](_0x2bcc('0x3c'))){_0x260020['limit']=qs['limit'](_0x439b75['query'][_0x2bcc('0x3d')]);_0x260020[_0x2bcc('0x1f')]=qs[_0x2bcc('0x1f')](_0x439b75[_0x2bcc('0x35')][_0x2bcc('0x1f')]);}_0x260020[_0x2bcc('0x3e')]=qs['sort'](_0x439b75['query'][_0x2bcc('0x3f')]);_0x260020[_0x2bcc('0x40')]=qs[_0x2bcc('0x37')](_[_0x2bcc('0x41')](_0x439b75[_0x2bcc('0x35')],_0x308c0c[_0x2bcc('0x37')]),_0x37e2d9);if(_0x439b75[_0x2bcc('0x35')][_0x2bcc('0x42')]){_0x260020[_0x2bcc('0x40')]=_['merge'](_0x260020['where'],{'$or':_['map'](_0x37e2d9,function(_0x482977){if(_0x482977['type']!==_0x2bcc('0x43')){var _0x2f0bbb={};_0x2f0bbb[_0x482977[_0x2bcc('0x2d')]]={'$like':'%'+_0x439b75[_0x2bcc('0x35')]['filter']+'%'};return _0x2f0bbb;}})});}_0x260020=_[_0x2bcc('0x44')]({},_0x260020,_0x439b75['options']);var _0x326fb7={'where':_0x260020[_0x2bcc('0x40')]};return db['VoiceQueueReport']['count'](_0x326fb7)[_0x2bcc('0x29')](function(_0x5770de){_0x472c5e[_0x2bcc('0x21')]=_0x5770de;if(_0x439b75[_0x2bcc('0x35')][_0x2bcc('0x45')]){_0x260020[_0x2bcc('0x46')]=[{'all':!![]}];}return db[_0x2bcc('0x47')]['findAll'](_0x260020);})['then'](function(_0x778933){_0x472c5e[_0x2bcc('0x48')]=_0x778933;return _0x472c5e;})[_0x2bcc('0x29')](respondWithFilteredResult(_0x558b3b,_0x260020))[_0x2bcc('0x49')](handleError(_0x558b3b,null));};exports[_0x2bcc('0x4a')]=function(_0x3db7bc,_0x4d77ef){var _0x275153={'raw':![],'where':{'id':_0x3db7bc[_0x2bcc('0x4b')]['id']}},_0x291401={};_0x291401['model']=_[_0x2bcc('0x36')](db['VoiceQueueReport'][_0x2bcc('0x2f')]);_0x291401[_0x2bcc('0x35')]=_[_0x2bcc('0x36')](_0x3db7bc[_0x2bcc('0x35')]);_0x291401['filters']=_[_0x2bcc('0x38')](_0x291401[_0x2bcc('0x33')],_0x291401[_0x2bcc('0x35')]);_0x275153[_0x2bcc('0x39')]=_[_0x2bcc('0x38')](_0x291401[_0x2bcc('0x33')],qs[_0x2bcc('0x4c')](_0x3db7bc[_0x2bcc('0x35')]['fields']));_0x275153[_0x2bcc('0x39')]=_0x275153[_0x2bcc('0x39')][_0x2bcc('0x3a')]?_0x275153[_0x2bcc('0x39')]:_0x291401[_0x2bcc('0x33')];if(_0x3db7bc[_0x2bcc('0x35')][_0x2bcc('0x45')]){_0x275153[_0x2bcc('0x46')]=[{'all':!![]}];}_0x275153=_[_0x2bcc('0x44')]({},_0x275153,_0x3db7bc[_0x2bcc('0x4d')]);return db[_0x2bcc('0x47')][_0x2bcc('0x4e')](_0x275153)[_0x2bcc('0x29')](handleEntityNotFound(_0x4d77ef,null))[_0x2bcc('0x29')](respondWithResult(_0x4d77ef,null))[_0x2bcc('0x49')](handleError(_0x4d77ef,null));};exports[_0x2bcc('0x4f')]=function(_0x1eace0,_0x4a0acb){return db[_0x2bcc('0x47')][_0x2bcc('0x4f')](_0x1eace0[_0x2bcc('0x50')],{})[_0x2bcc('0x29')](respondWithResult(_0x4a0acb,0xc9))[_0x2bcc('0x49')](handleError(_0x4a0acb,null));};exports[_0x2bcc('0x28')]=function(_0x23306b,_0x179a2a){if(_0x23306b[_0x2bcc('0x50')]['id']){delete _0x23306b[_0x2bcc('0x50')]['id'];}return db[_0x2bcc('0x47')][_0x2bcc('0x4e')]({'where':{'id':_0x23306b[_0x2bcc('0x4b')]['id']}})[_0x2bcc('0x29')](handleEntityNotFound(_0x179a2a,null))[_0x2bcc('0x29')](saveUpdates(_0x23306b[_0x2bcc('0x50')],null))[_0x2bcc('0x29')](respondWithResult(_0x179a2a,null))[_0x2bcc('0x49')](handleError(_0x179a2a,null));};exports[_0x2bcc('0x2a')]=function(_0x2bfa4d,_0x575ea0){return db['VoiceQueueReport'][_0x2bcc('0x4e')]({'where':{'id':_0x2bfa4d[_0x2bcc('0x4b')]['id']}})[_0x2bcc('0x29')](handleEntityNotFound(_0x575ea0,null))[_0x2bcc('0x29')](removeEntity(_0x575ea0,null))[_0x2bcc('0x49')](handleError(_0x575ea0,null));};exports['describe']=function(_0x3e1b7e,_0x5b77d4){return db[_0x2bcc('0x47')]['describe']()[_0x2bcc('0x29')](respondWithResult(_0x5b77d4,null))[_0x2bcc('0x49')](handleError(_0x5b77d4,null));};exports['getVoiceQueuesReport']=function(_0x251639,_0x31317b){var _0x47dcca={},_0xd097bc={},_0x12409c={'count':0x0,'rows':[]};_0xd097bc[_0x2bcc('0x33')]=_[_0x2bcc('0x36')](db[_0x2bcc('0x47')][_0x2bcc('0x2f')]);_0xd097bc['query']=_['keys'](_0x251639['query']);_0xd097bc[_0x2bcc('0x37')]=_[_0x2bcc('0x38')](_0xd097bc['model'],_0xd097bc[_0x2bcc('0x35')]);_0x47dcca['attributes']=_['intersection'](_0xd097bc[_0x2bcc('0x33')],qs[_0x2bcc('0x4c')](_0x251639[_0x2bcc('0x35')][_0x2bcc('0x4c')]));_0x47dcca[_0x2bcc('0x39')]=_0x47dcca[_0x2bcc('0x39')]['length']?_0x47dcca[_0x2bcc('0x39')]:_0xd097bc[_0x2bcc('0x33')];if(!_0x251639[_0x2bcc('0x35')][_0x2bcc('0x3b')](_0x2bcc('0x3c'))){_0x47dcca[_0x2bcc('0x3d')]=qs[_0x2bcc('0x3d')](_0x251639['query'][_0x2bcc('0x3d')]);_0x47dcca[_0x2bcc('0x1f')]=qs['offset'](_0x251639[_0x2bcc('0x35')][_0x2bcc('0x1f')]);}_0x47dcca[_0x2bcc('0x3e')]=qs[_0x2bcc('0x3f')](_0x251639[_0x2bcc('0x35')][_0x2bcc('0x3f')]);_0x47dcca['where']=qs['filters'](_[_0x2bcc('0x41')](_0x251639[_0x2bcc('0x35')],_0xd097bc[_0x2bcc('0x37')]));if(_0x251639[_0x2bcc('0x35')]['filter']){_0x47dcca[_0x2bcc('0x40')]=_[_0x2bcc('0x44')](_0x47dcca[_0x2bcc('0x40')],{'$or':_[_0x2bcc('0x34')](_0x47dcca[_0x2bcc('0x39')],function(_0x517de0){var _0x5c3b23={};_0x5c3b23[_0x517de0]={'$like':'%'+_0x251639[_0x2bcc('0x35')][_0x2bcc('0x42')]+'%'};return _0x5c3b23;})});}_0x47dcca=_[_0x2bcc('0x44')]({},_0x47dcca,_0x251639[_0x2bcc('0x4d')]);var _0x26a7c3={'where':_0x47dcca[_0x2bcc('0x40')]};return db[_0x2bcc('0x47')][_0x2bcc('0x21')](_0x26a7c3)[_0x2bcc('0x29')](function(_0x2fb1fb){_0x12409c[_0x2bcc('0x21')]=_0x2fb1fb;if(_0x251639[_0x2bcc('0x35')]['includeAll']){_0x47dcca['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x47dcca);})[_0x2bcc('0x29')](function(_0x31d7c9){_0x12409c[_0x2bcc('0x48')]=_0x31d7c9;return _0x12409c;})['then'](respondWithFilteredResult(_0x31317b,_0x47dcca,_0x2bcc('0x51')))[_0x2bcc('0x49')](handleError(_0x31317b,null,_0x2bcc('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b2c76e0..39146d9 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 _0x3a04=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','remove','emit','hook','exports'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0x3a04,0xb0));var _0x43a0=function(_0x3d5e72,_0x3ab167){_0x3d5e72=_0x3d5e72-0x0;var _0x2230e4=_0x3a04[_0x3d5e72];return _0x2230e4;};'use strict';var EventEmitter=require(_0x43a0('0x0'));var VoiceQueueReport=require(_0x43a0('0x1'))['db'][_0x43a0('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x43a0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x43a0('0x4')};function emitEvent(_0x384438){return function(_0x1491fb,_0x1eb1ad,_0x2d914d){VoiceQueueReportEvents[_0x43a0('0x5')](_0x384438+':'+_0x1491fb['id'],_0x1491fb);VoiceQueueReportEvents[_0x43a0('0x5')](_0x384438,_0x1491fb);_0x2d914d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x43a0('0x6')](e,emitEvent(event));}}module[_0x43a0('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x78bf=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1ae382,_0x3b64e4){var _0x464502=function(_0x2ddd13){while(--_0x2ddd13){_0x1ae382['push'](_0x1ae382['shift']());}};_0x464502(++_0x3b64e4);}(_0x78bf,0x1f4));var _0xf78b=function(_0x31520d,_0x50046a){_0x31520d=_0x31520d-0x0;var _0x4d0d26=_0x78bf[_0x31520d];return _0x4d0d26;};'use strict';var EventEmitter=require(_0xf78b('0x0'));var VoiceQueueReport=require(_0xf78b('0x1'))['db'][_0xf78b('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf78b('0x3')](0x0);var events={'afterCreate':_0xf78b('0x4'),'afterUpdate':'update','afterDestroy':_0xf78b('0x5')};function emitEvent(_0x2eaa74){return function(_0x150b3b,_0x14e78e,_0x29eed2){VoiceQueueReportEvents[_0xf78b('0x6')](_0x2eaa74+':'+_0x150b3b['id'],_0x150b3b);VoiceQueueReportEvents[_0xf78b('0x6')](_0x2eaa74,_0x150b3b);_0x29eed2(null);};}for(var e in events){if(events[_0xf78b('0x7')](e)){var event=events[e];VoiceQueueReport[_0xf78b('0x8')](e,emitEvent(event));}}module[_0xf78b('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c8032fa..431ea8d 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 _0x2375=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2375,0x141));var _0x5237=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x2375[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x5237('0x0'));var util=require('util');var logger=require(_0x5237('0x1'))(_0x5237('0x2'));var moment=require(_0x5237('0x3'));var BPromise=require(_0x5237('0x4'));var rp=require(_0x5237('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5237('0x6'));var config=require(_0x5237('0x7'));var attributes=require(_0x5237('0x8'));module[_0x5237('0x9')]=function(_0x1b3e94,_0x1691e6){return _0x1b3e94[_0x5237('0xa')](_0x5237('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5237('0xc')]},{'fields':[_0x5237('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8524=['VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define'];(function(_0x45633f,_0x4326ba){var _0x3531bc=function(_0x51c7e0){while(--_0x51c7e0){_0x45633f['push'](_0x45633f['shift']());}};_0x3531bc(++_0x4326ba);}(_0x8524,0x1d4));var _0x4852=function(_0x448aa0,_0x3648f2){_0x448aa0=_0x448aa0-0x0;var _0x399a6e=_0x8524[_0x448aa0];return _0x399a6e;};'use strict';var _=require(_0x4852('0x0'));var util=require(_0x4852('0x1'));var logger=require(_0x4852('0x2'))(_0x4852('0x3'));var moment=require(_0x4852('0x4'));var BPromise=require(_0x4852('0x5'));var rp=require(_0x4852('0x6'));var fs=require('fs');var path=require(_0x4852('0x7'));var rimraf=require(_0x4852('0x8'));var config=require(_0x4852('0x9'));var attributes=require(_0x4852('0xa'));module['exports']=function(_0x45089f,_0x3f70eb){return _0x45089f[_0x4852('0xb')](_0x4852('0xc'),attributes,{'tableName':_0x4852('0xd'),'paranoid':![],'indexes':[{'fields':[_0x4852('0xe')]},{'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 97ea1ca..4bbf07f 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 _0x2278=['ioredis','../../config/logger','jayson/promise','client','http','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceQueueReport','options','raw','where','attributes','limit','map','include','model','then','GetVoiceQueueReport','create','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','util','moment','bluebird','randomstring'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x2278,0xc4));var _0x8227=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8227('0x0'));var moment=require(_0x8227('0x1'));var BPromise=require(_0x8227('0x2'));var rs=require(_0x8227('0x3'));var fs=require('fs');var Redis=require(_0x8227('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8227('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8227('0x6'));var client=jayson[_0x8227('0x7')][_0x8227('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8227('0x9'))(new Redis(config[_0x8227('0xa')]));require(_0x8227('0xb'))[_0x8227('0xc')](socket);function respondWithRpcPromise(_0xb70af2,_0x293acd,_0x5a06a7){return new BPromise(function(_0x2e53c7,_0x43d5fa){return client[_0x8227('0xd')](_0xb70af2,_0x5a06a7)['then'](function(_0x29ea07){logger[_0x8227('0xe')](_0x8227('0xf'),_0x293acd,'request\x20sent');logger[_0x8227('0x10')](_0x8227('0x11'),_0x293acd,_0x8227('0x12'),JSON[_0x8227('0x13')](_0x29ea07));if(_0x29ea07[_0x8227('0x14')]){if(_0x29ea07[_0x8227('0x14')]['code']===0x1f4){logger[_0x8227('0x14')](_0x8227('0xf'),_0x293acd,_0x29ea07[_0x8227('0x14')][_0x8227('0x15')]);return _0x43d5fa(_0x29ea07['error'][_0x8227('0x15')]);}logger[_0x8227('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x293acd,_0x29ea07[_0x8227('0x14')][_0x8227('0x15')]);return _0x2e53c7(_0x29ea07[_0x8227('0x14')][_0x8227('0x15')]);}else{logger[_0x8227('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x293acd,_0x8227('0x12'));_0x2e53c7(_0x29ea07[_0x8227('0x16')][_0x8227('0x15')]);}})[_0x8227('0x17')](function(_0x19e457){logger['error'](_0x8227('0xf'),_0x293acd,_0x19e457);_0x43d5fa(_0x19e457);});});}exports['GetVoiceQueueReport']=function(_0x6650a7){var _0x3216b3=this;return new Promise(function(_0x47d76d,_0x4283ec){return db[_0x8227('0x18')]['findAll']({'raw':_0x6650a7[_0x8227('0x19')]?_0x6650a7[_0x8227('0x19')][_0x8227('0x1a')]===undefined?!![]:![]:!![],'where':_0x6650a7['options']?_0x6650a7[_0x8227('0x19')][_0x8227('0x1b')]||null:null,'attributes':_0x6650a7[_0x8227('0x19')]?_0x6650a7[_0x8227('0x19')][_0x8227('0x1c')]||null:null,'limit':_0x6650a7[_0x8227('0x19')]?_0x6650a7[_0x8227('0x19')][_0x8227('0x1d')]||null:null,'include':_0x6650a7[_0x8227('0x19')]?_0x6650a7[_0x8227('0x19')]['include']?_[_0x8227('0x1e')](_0x6650a7[_0x8227('0x19')][_0x8227('0x1f')],function(_0x132331){return{'model':db[_0x132331[_0x8227('0x20')]],'as':_0x132331['as'],'attributes':_0x132331[_0x8227('0x1c')],'include':_0x132331[_0x8227('0x1f')]?_[_0x8227('0x1e')](_0x132331[_0x8227('0x1f')],function(_0x5ad2c4){return{'model':db[_0x5ad2c4['model']],'as':_0x5ad2c4['as'],'attributes':_0x5ad2c4[_0x8227('0x1c')],'include':_0x5ad2c4[_0x8227('0x1f')]?_[_0x8227('0x1e')](_0x5ad2c4[_0x8227('0x1f')],function(_0x22f29b){return{'model':db[_0x22f29b[_0x8227('0x20')]],'as':_0x22f29b['as'],'attributes':_0x22f29b[_0x8227('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8227('0x21')](function(_0x564032){logger['info'](_0x8227('0x22'),_0x6650a7);logger['debug'](_0x8227('0x22'),_0x6650a7,JSON['stringify'](_0x564032));_0x47d76d(_0x564032);})['catch'](function(_0x50b152){logger[_0x8227('0x14')](_0x8227('0x22'),_0x50b152['message'],_0x6650a7);_0x4283ec(_0x3216b3[_0x8227('0x14')](0x1f4,_0x50b152[_0x8227('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x1a9320){var _0x43f086=this;return new Promise(function(_0x4e28db,_0x37e380){return db[_0x8227('0x18')][_0x8227('0x23')](_0x1a9320[_0x8227('0x24')],{'raw':_0x1a9320[_0x8227('0x19')]?_0x1a9320['options'][_0x8227('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x53e714){logger[_0x8227('0xe')](_0x8227('0x25'),_0x1a9320);logger[_0x8227('0x10')](_0x8227('0x25'),_0x1a9320,JSON[_0x8227('0x13')](_0x53e714));_0x4e28db(_0x53e714);})[_0x8227('0x17')](function(_0xacfcc8){logger[_0x8227('0x14')](_0x8227('0x25'),_0xacfcc8[_0x8227('0x15')],_0x1a9320);_0x37e380(_0x43f086[_0x8227('0x14')](0x1f4,_0xacfcc8[_0x8227('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x24fe2f){var _0x74e332=this;return new Promise(function(_0x22d43a,_0x3e153d){return db['VoiceQueueReport'][_0x8227('0x26')](_0x24fe2f[_0x8227('0x24')],{'raw':_0x24fe2f[_0x8227('0x19')]?_0x24fe2f[_0x8227('0x19')][_0x8227('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24fe2f['options']?_0x24fe2f[_0x8227('0x19')][_0x8227('0x1b')]||null:null,'attributes':_0x24fe2f[_0x8227('0x19')]?_0x24fe2f[_0x8227('0x19')]['attributes']||null:null,'limit':_0x24fe2f[_0x8227('0x19')]?_0x24fe2f[_0x8227('0x19')][_0x8227('0x1d')]||null:null})[_0x8227('0x21')](function(_0x42de20){logger['info'](_0x8227('0x27'),_0x24fe2f);logger[_0x8227('0x10')](_0x8227('0x27'),_0x24fe2f,JSON[_0x8227('0x13')](_0x42de20));_0x22d43a(_0x42de20);})['catch'](function(_0x46dc50){logger[_0x8227('0x14')](_0x8227('0x27'),_0x46dc50['message'],_0x24fe2f);_0x3e153d(_0x74e332[_0x8227('0x14')](0x1f4,_0x46dc50[_0x8227('0x15')]));});});}; \ No newline at end of file +var _0xbc80=['debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','limit','map','model','attributes','include','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x295c5a,_0x154dad){var _0x334e9a=function(_0x482e62){while(--_0x482e62){_0x295c5a['push'](_0x295c5a['shift']());}};_0x334e9a(++_0x154dad);}(_0xbc80,0x15e));var _0x0bc8=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0xbc80[_0xcfeda9];return _0x4826c7;};'use strict';var _=require(_0x0bc8('0x0'));var util=require(_0x0bc8('0x1'));var moment=require(_0x0bc8('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bc8('0x3'));var fs=require('fs');var Redis=require(_0x0bc8('0x4'));var db=require(_0x0bc8('0x5'))['db'];var utils=require(_0x0bc8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0bc8('0x7'));var jayson=require(_0x0bc8('0x8'));var client=jayson[_0x0bc8('0x9')][_0x0bc8('0xa')]({'port':0x232a});config[_0x0bc8('0xb')]=_[_0x0bc8('0xc')](config[_0x0bc8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0bc8('0xd'))(new Redis(config[_0x0bc8('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x14add6,_0x53c2f8,_0x34298f){return new BPromise(function(_0x19584e,_0x1fdd0b){return client[_0x0bc8('0xe')](_0x14add6,_0x34298f)[_0x0bc8('0xf')](function(_0x272051){logger[_0x0bc8('0x10')](_0x0bc8('0x11'),_0x53c2f8,_0x0bc8('0x12'));logger[_0x0bc8('0x13')](_0x0bc8('0x14'),_0x53c2f8,'request\x20sent',JSON[_0x0bc8('0x15')](_0x272051));if(_0x272051[_0x0bc8('0x16')]){if(_0x272051[_0x0bc8('0x16')]['code']===0x1f4){logger[_0x0bc8('0x16')](_0x0bc8('0x11'),_0x53c2f8,_0x272051[_0x0bc8('0x16')]['message']);return _0x1fdd0b(_0x272051[_0x0bc8('0x16')]['message']);}logger[_0x0bc8('0x16')](_0x0bc8('0x11'),_0x53c2f8,_0x272051[_0x0bc8('0x16')][_0x0bc8('0x17')]);return _0x19584e(_0x272051[_0x0bc8('0x16')][_0x0bc8('0x17')]);}else{logger[_0x0bc8('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x53c2f8,'request\x20sent');_0x19584e(_0x272051[_0x0bc8('0x18')][_0x0bc8('0x17')]);}})[_0x0bc8('0x19')](function(_0x180ff1){logger['error'](_0x0bc8('0x11'),_0x53c2f8,_0x180ff1);_0x1fdd0b(_0x180ff1);});});}exports[_0x0bc8('0x1a')]=function(_0x34aa24){var _0x3ea509=this;return new Promise(function(_0x42b678,_0x253f45){return db[_0x0bc8('0x1b')]['findAll']({'raw':_0x34aa24[_0x0bc8('0x1c')]?_0x34aa24[_0x0bc8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x34aa24[_0x0bc8('0x1c')]?_0x34aa24['options']['where']||null:null,'attributes':_0x34aa24[_0x0bc8('0x1c')]?_0x34aa24[_0x0bc8('0x1c')]['attributes']||null:null,'limit':_0x34aa24[_0x0bc8('0x1c')]?_0x34aa24[_0x0bc8('0x1c')][_0x0bc8('0x1d')]||null:null,'include':_0x34aa24['options']?_0x34aa24[_0x0bc8('0x1c')]['include']?_[_0x0bc8('0x1e')](_0x34aa24['options']['include'],function(_0x55262e){return{'model':db[_0x55262e[_0x0bc8('0x1f')]],'as':_0x55262e['as'],'attributes':_0x55262e[_0x0bc8('0x20')],'include':_0x55262e[_0x0bc8('0x21')]?_['map'](_0x55262e[_0x0bc8('0x21')],function(_0x559b98){return{'model':db[_0x559b98['model']],'as':_0x559b98['as'],'attributes':_0x559b98['attributes'],'include':_0x559b98[_0x0bc8('0x21')]?_[_0x0bc8('0x1e')](_0x559b98[_0x0bc8('0x21')],function(_0x39d778){return{'model':db[_0x39d778['model']],'as':_0x39d778['as'],'attributes':_0x39d778[_0x0bc8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f4ae0){logger[_0x0bc8('0x10')]('GetVoiceQueueReport',_0x34aa24);logger[_0x0bc8('0x13')](_0x0bc8('0x1a'),_0x34aa24,JSON['stringify'](_0x1f4ae0));_0x42b678(_0x1f4ae0);})[_0x0bc8('0x19')](function(_0x1e1046){logger[_0x0bc8('0x16')](_0x0bc8('0x1a'),_0x1e1046[_0x0bc8('0x17')],_0x34aa24);_0x253f45(_0x3ea509[_0x0bc8('0x16')](0x1f4,_0x1e1046[_0x0bc8('0x17')]));});});};exports[_0x0bc8('0x22')]=function(_0x2b061b){var _0x543c5d=this;return new Promise(function(_0x4d5f95,_0x58a2e3){return db[_0x0bc8('0x1b')][_0x0bc8('0x23')](_0x2b061b[_0x0bc8('0x24')],{'raw':_0x2b061b[_0x0bc8('0x1c')]?_0x2b061b['options']['raw']===undefined?!![]:![]:!![]})[_0x0bc8('0xf')](function(_0xf6225f){logger[_0x0bc8('0x10')](_0x0bc8('0x22'),_0x2b061b);logger[_0x0bc8('0x13')](_0x0bc8('0x22'),_0x2b061b,JSON['stringify'](_0xf6225f));_0x4d5f95(_0xf6225f);})[_0x0bc8('0x19')](function(_0x4ed34f){logger[_0x0bc8('0x16')]('CreateVoiceQueueReport',_0x4ed34f[_0x0bc8('0x17')],_0x2b061b);_0x58a2e3(_0x543c5d[_0x0bc8('0x16')](0x1f4,_0x4ed34f[_0x0bc8('0x17')]));});});};exports[_0x0bc8('0x25')]=function(_0x6ca4ce){var _0x3ecb6a=this;return new Promise(function(_0xa1e311,_0x28019b){return db['VoiceQueueReport'][_0x0bc8('0x26')](_0x6ca4ce[_0x0bc8('0x24')],{'raw':_0x6ca4ce['options']?_0x6ca4ce[_0x0bc8('0x1c')][_0x0bc8('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6ca4ce[_0x0bc8('0x1c')]?_0x6ca4ce[_0x0bc8('0x1c')][_0x0bc8('0x28')]||null:null,'attributes':_0x6ca4ce['options']?_0x6ca4ce[_0x0bc8('0x1c')]['attributes']||null:null,'limit':_0x6ca4ce[_0x0bc8('0x1c')]?_0x6ca4ce['options'][_0x0bc8('0x1d')]||null:null})['then'](function(_0x4768bb){logger[_0x0bc8('0x10')](_0x0bc8('0x25'),_0x6ca4ce);logger[_0x0bc8('0x13')](_0x0bc8('0x25'),_0x6ca4ce,JSON[_0x0bc8('0x15')](_0x4768bb));_0xa1e311(_0x4768bb);})[_0x0bc8('0x19')](function(_0x43ca1f){logger[_0x0bc8('0x16')]('UpdateVoiceQueueReport',_0x43ca1f[_0x0bc8('0x17')],_0x6ca4ce);_0x28019b(_0x3ecb6a[_0x0bc8('0x16')](0x1f4,_0x43ca1f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index beaf7c8..2b167dd 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 _0xb39f=['remove','update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x21f07f,_0x49fee5){var _0x26d200=function(_0x16c563){while(--_0x16c563){_0x21f07f['push'](_0x21f07f['shift']());}};_0x26d200(++_0x49fee5);}(_0xb39f,0x1e6));var _0xfb39=function(_0x1967ff,_0x38073f){_0x1967ff=_0x1967ff-0x0;var _0x56d0c4=_0xb39f[_0x1967ff];return _0x56d0c4;};'use strict';var VoiceQueueReportEvents=require(_0xfb39('0x0'));var events=[_0xfb39('0x1'),_0xfb39('0x2'),_0xfb39('0x3')];function createListener(_0x5ba2ac,_0x4bc0e0){return function(_0x588127){_0x4bc0e0[_0xfb39('0x4')](_0x5ba2ac,_0x588127);};}function removeListener(_0x50f9a1,_0x3d2ee9){return function(){VoiceQueueReportEvents[_0xfb39('0x5')](_0x50f9a1,_0x3d2ee9);};}exports['register']=function(_0x1619f6){for(var _0x455dbe=0x0,_0x45bb1c=events[_0xfb39('0x6')];_0x455dbe<_0x45bb1c;_0x455dbe++){var _0x4ce401=events[_0x455dbe];var _0x4daba2=createListener(_0xfb39('0x7')+_0x4ce401,_0x1619f6);VoiceQueueReportEvents['on'](_0x4ce401,_0x4daba2);}}; \ No newline at end of file +var _0x85d3=['remove','update','emit','removeListener','voiceQueueReport:','save'];(function(_0x137941,_0xdafeb7){var _0x2426b3=function(_0x19edc2){while(--_0x19edc2){_0x137941['push'](_0x137941['shift']());}};_0x2426b3(++_0xdafeb7);}(_0x85d3,0x1a9));var _0x385d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x85d3[_0x501510];return _0x1e6ee5;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x385d('0x0'),_0x385d('0x1'),_0x385d('0x2')];function createListener(_0x4a60cb,_0x5df85c){return function(_0x292155){_0x5df85c[_0x385d('0x3')](_0x4a60cb,_0x292155);};}function removeListener(_0x1c70e9,_0x586d7c){return function(){VoiceQueueReportEvents[_0x385d('0x4')](_0x1c70e9,_0x586d7c);};}exports['register']=function(_0x554c8d){for(var _0x59938d=0x0,_0x1b84d9=events['length'];_0x59938d<_0x1b84d9;_0x59938d++){var _0x2ea3b1=events[_0x59938d];var _0x5494d1=createListener(_0x385d('0x5')+_0x2ea3b1,_0x554c8d);VoiceQueueReportEvents['on'](_0x2ea3b1,_0x5494d1);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a280a49..a4c6a3d 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 _0x1803=['get','show','post','create','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1803,0x1be));var _0x3180=function(_0x2fcd0b,_0x590579){_0x2fcd0b=_0x2fcd0b-0x0;var _0x308934=_0x1803[_0x2fcd0b];return _0x308934;};'use strict';var multer=require('multer');var util=require(_0x3180('0x0'));var path=require('path');var timeout=require(_0x3180('0x1'));var express=require(_0x3180('0x2'));var router=express[_0x3180('0x3')]();var fs_extra=require(_0x3180('0x4'));var auth=require(_0x3180('0x5'));var interaction=require(_0x3180('0x6'));var config=require(_0x3180('0x7'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x3180('0x8')](),controller[_0x3180('0x9')]);router[_0x3180('0xa')]('/:id',auth[_0x3180('0x8')](),controller[_0x3180('0xb')]);router[_0x3180('0xc')]('/',auth['isAuthenticated'](),controller[_0x3180('0xd')]);router[_0x3180('0xe')](_0x3180('0xf'),auth[_0x3180('0x8')](),controller['update']);router[_0x3180('0x10')](_0x3180('0xf'),auth[_0x3180('0x8')](),controller[_0x3180('0x11')]);module[_0x3180('0x12')]=router; \ No newline at end of file +var _0x46fc=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x37aeb6,_0x24bd14){var _0xdbe448=function(_0x640944){while(--_0x640944){_0x37aeb6['push'](_0x37aeb6['shift']());}};_0xdbe448(++_0x24bd14);}(_0x46fc,0x103));var _0xc46f=function(_0x211f4e,_0x5126c4){_0x211f4e=_0x211f4e-0x0;var _0x440a89=_0x46fc[_0x211f4e];return _0x440a89;};'use strict';var multer=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var path=require(_0xc46f('0x2'));var timeout=require(_0xc46f('0x3'));var express=require(_0xc46f('0x4'));var router=express[_0xc46f('0x5')]();var fs_extra=require(_0xc46f('0x6'));var auth=require(_0xc46f('0x7'));var interaction=require(_0xc46f('0x8'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0xc46f('0x9')]('/',auth[_0xc46f('0xa')](),controller[_0xc46f('0xb')]);router[_0xc46f('0x9')](_0xc46f('0xc'),auth[_0xc46f('0xa')](),controller[_0xc46f('0xd')]);router[_0xc46f('0xe')]('/',auth[_0xc46f('0xa')](),controller[_0xc46f('0xf')]);router[_0xc46f('0x10')](_0xc46f('0xc'),auth[_0xc46f('0xa')](),controller[_0xc46f('0x11')]);router['delete'](_0xc46f('0xc'),auth[_0xc46f('0xa')](),controller[_0xc46f('0x12')]);module[_0xc46f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 2b364fd..bd03d46 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 _0x8a69=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE','literal'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a69,0x135));var _0x98a6=function(_0x4ca95d,_0x4b70ea){_0x4ca95d=_0x4ca95d-0x0;var _0x1969c5=_0x8a69[_0x4ca95d];return _0x1969c5;};'use strict';var Sequelize=require(_0x98a6('0x0'));var moment=require(_0x98a6('0x1'));module[_0x98a6('0x2')]={'time':{'type':Sequelize[_0x98a6('0x3')]},'callid':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x98a6('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x98a6('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x98a6('0x5')](_0x98a6('0x6'))}}; \ No newline at end of file +var _0x5eb9=['sequelize','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x59a8c5,_0x498465){var _0x13b90d=function(_0x58d79c){while(--_0x58d79c){_0x59a8c5['push'](_0x59a8c5['shift']());}};_0x13b90d(++_0x498465);}(_0x5eb9,0x1d1));var _0x95eb=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x5eb9[_0x3e44fa];return _0x2a0aba;};'use strict';var Sequelize=require(_0x95eb('0x0'));var moment=require('moment');module[_0x95eb('0x1')]={'time':{'type':Sequelize[_0x95eb('0x2')]},'callid':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x95eb('0x3')](_0x95eb('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8ae73ac..a88a58c 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 _0x063a=['desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','VoiceQueuesLog','findAll','rows','catch','show','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x20f4d7,_0x29a502){var _0x630d61=function(_0x24cc2c){while(--_0x24cc2c){_0x20f4d7['push'](_0x20f4d7['shift']());}};_0x630d61(++_0x29a502);}(_0x063a,0x166));var _0xa063=function(_0x302a58,_0x38f769){_0x302a58=_0x302a58-0x0;var _0x47a76b=_0x063a[_0x302a58];return _0x47a76b;};'use strict';var emlformat=require(_0xa063('0x0'));var rimraf=require(_0xa063('0x1'));var zipdir=require(_0xa063('0x2'));var jsonpatch=require(_0xa063('0x3'));var rp=require(_0xa063('0x4'));var moment=require(_0xa063('0x5'));var BPromise=require(_0xa063('0x6'));var Mustache=require(_0xa063('0x7'));var util=require(_0xa063('0x8'));var path=require(_0xa063('0x9'));var sox=require(_0xa063('0xa'));var csv=require(_0xa063('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa063('0xc'));var _=require(_0xa063('0xd'));var squel=require(_0xa063('0xe'));var crypto=require(_0xa063('0xf'));var jsforce=require(_0xa063('0x10'));var deskjs=require(_0xa063('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa063('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa063('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa063('0x14'));var hardwareService=require(_0xa063('0x15'));var logger=require('../../config/logger')(_0xa063('0x16'));var utils=require(_0xa063('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa063('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a98fc,_0x2574ab){_0x2574ab=_0x2574ab||0xcc;return function(_0x1495a1){if(_0x1495a1){return _0x4a98fc[_0xa063('0x19')](_0x2574ab);}return _0x4a98fc[_0xa063('0x1a')](_0x2574ab)['end']();};}function respondWithResult(_0x1c7bb2,_0x2d67f0){_0x2d67f0=_0x2d67f0||0xc8;return function(_0x8458d7){if(_0x8458d7){return _0x1c7bb2['status'](_0x2d67f0)[_0xa063('0x1b')](_0x8458d7);}};}function respondWithFilteredResult(_0xc21136,_0x2d3fd5){return function(_0x1fab42){if(_0x1fab42){var _0x31d0cf=typeof _0x2d3fd5[_0xa063('0x1c')]==='undefined'&&typeof _0x2d3fd5['limit']==='undefined';var _0x5ab2dd=_0x1fab42[_0xa063('0x1d')];var _0x33b05f=_0x31d0cf?0x0:_0x2d3fd5[_0xa063('0x1c')];var _0x5bf9ea=_0x31d0cf?_0x1fab42['count']:_0x2d3fd5[_0xa063('0x1c')]+_0x2d3fd5[_0xa063('0x1e')];var _0x548a19;if(_0x5bf9ea>=_0x5ab2dd){_0x5bf9ea=_0x5ab2dd;_0x548a19=0xc8;}else{_0x548a19=0xce;}_0xc21136[_0xa063('0x1a')](_0x548a19);return _0xc21136['set'](_0xa063('0x1f'),_0x33b05f+'-'+_0x5bf9ea+'/'+_0x5ab2dd)[_0xa063('0x1b')](_0x1fab42);}return null;};}function patchUpdates(_0x4681cf){return function(_0x3dae9c){try{jsonpatch[_0xa063('0x20')](_0x3dae9c,_0x4681cf,!![]);}catch(_0x2c702f){return BPromise[_0xa063('0x21')](_0x2c702f);}return _0x3dae9c['save']();};}function saveUpdates(_0x12de6d,_0x45dc2f){return function(_0x294ecd){if(_0x294ecd){return _0x294ecd[_0xa063('0x22')](_0x12de6d)[_0xa063('0x23')](function(_0x5a238f){return _0x5a238f;});}return null;};}function removeEntity(_0x1500e6,_0x35bb87){return function(_0x2c1c80){if(_0x2c1c80){return _0x2c1c80[_0xa063('0x24')]()[_0xa063('0x23')](function(){_0x1500e6[_0xa063('0x1a')](0xcc)[_0xa063('0x25')]();});}};}function handleEntityNotFound(_0x3b6fee,_0x18f3b0){return function(_0x5dd627){if(!_0x5dd627){_0x3b6fee[_0xa063('0x19')](0x194);}return _0x5dd627;};}function handleError(_0x17be87,_0x2cace5){_0x2cace5=_0x2cace5||0x1f4;return function(_0x145196){logger[_0xa063('0x26')](_0x145196[_0xa063('0x27')]);if(_0x145196[_0xa063('0x28')]){delete _0x145196['name'];}_0x17be87[_0xa063('0x1a')](_0x2cace5)[_0xa063('0x29')](_0x145196);};}exports[_0xa063('0x2a')]=function(_0x2af706,_0x4e6816){var _0x31f625={},_0x2868f7={},_0x444911={'count':0x0,'rows':[]};var _0x5780bf=_[_0xa063('0x2b')](db['VoiceQueuesLog'][_0xa063('0x2c')],function(_0x540c21){return{'name':_0x540c21[_0xa063('0x2d')],'type':_0x540c21[_0xa063('0x2e')][_0xa063('0x2f')]};});_0x2868f7[_0xa063('0x30')]=_['map'](_0x5780bf,_0xa063('0x28'));_0x2868f7[_0xa063('0x31')]=_[_0xa063('0x32')](_0x2af706[_0xa063('0x31')]);_0x2868f7[_0xa063('0x33')]=_[_0xa063('0x34')](_0x2868f7[_0xa063('0x30')],_0x2868f7['query']);_0x31f625[_0xa063('0x35')]=_[_0xa063('0x34')](_0x2868f7[_0xa063('0x30')],qs[_0xa063('0x36')](_0x2af706[_0xa063('0x31')]['fields']));_0x31f625['attributes']=_0x31f625['attributes'][_0xa063('0x37')]?_0x31f625[_0xa063('0x35')]:_0x2868f7[_0xa063('0x30')];if(!_0x2af706['query'][_0xa063('0x38')](_0xa063('0x39'))){_0x31f625[_0xa063('0x1e')]=qs[_0xa063('0x1e')](_0x2af706['query'][_0xa063('0x1e')]);_0x31f625[_0xa063('0x1c')]=qs[_0xa063('0x1c')](_0x2af706[_0xa063('0x31')]['offset']);}_0x31f625['order']=qs[_0xa063('0x3a')](_0x2af706[_0xa063('0x31')][_0xa063('0x3a')]);_0x31f625[_0xa063('0x3b')]=qs['filters'](_[_0xa063('0x3c')](_0x2af706[_0xa063('0x31')],_0x2868f7[_0xa063('0x33')]),_0x5780bf);if(_0x2af706['query']['filter']){_0x31f625[_0xa063('0x3b')]=_['merge'](_0x31f625[_0xa063('0x3b')],{'$or':_[_0xa063('0x2b')](_0x5780bf,function(_0x956850){if(_0x956850['type']!==_0xa063('0x3d')){var _0x28a6a8={};_0x28a6a8[_0x956850[_0xa063('0x28')]]={'$like':'%'+_0x2af706[_0xa063('0x31')][_0xa063('0x3e')]+'%'};return _0x28a6a8;}})});}_0x31f625=_[_0xa063('0x3f')]({},_0x31f625,_0x2af706['options']);var _0x34977d={'where':_0x31f625[_0xa063('0x3b')]};return db[_0xa063('0x40')]['count'](_0x34977d)[_0xa063('0x23')](function(_0x3ddb3a){_0x444911[_0xa063('0x1d')]=_0x3ddb3a;if(_0x2af706[_0xa063('0x31')]['includeAll']){_0x31f625['include']=[{'all':!![]}];}return db[_0xa063('0x40')][_0xa063('0x41')](_0x31f625);})['then'](function(_0x429cef){_0x444911[_0xa063('0x42')]=_0x429cef;return _0x444911;})['then'](respondWithFilteredResult(_0x4e6816,_0x31f625))[_0xa063('0x43')](handleError(_0x4e6816,null));};exports[_0xa063('0x44')]=function(_0x2c246d,_0x10fb0e){var _0x5e0626={'raw':!![],'where':{'id':_0x2c246d['params']['id']}},_0x1c723c={};_0x1c723c[_0xa063('0x30')]=_[_0xa063('0x32')](db[_0xa063('0x40')][_0xa063('0x2c')]);_0x1c723c['query']=_[_0xa063('0x32')](_0x2c246d[_0xa063('0x31')]);_0x1c723c['filters']=_[_0xa063('0x34')](_0x1c723c[_0xa063('0x30')],_0x1c723c[_0xa063('0x31')]);_0x5e0626['attributes']=_[_0xa063('0x34')](_0x1c723c[_0xa063('0x30')],qs['fields'](_0x2c246d[_0xa063('0x31')][_0xa063('0x36')]));_0x5e0626[_0xa063('0x35')]=_0x5e0626[_0xa063('0x35')][_0xa063('0x37')]?_0x5e0626[_0xa063('0x35')]:_0x1c723c[_0xa063('0x30')];if(_0x2c246d[_0xa063('0x31')][_0xa063('0x45')]){_0x5e0626['include']=[{'all':!![]}];}_0x5e0626=_['merge']({},_0x5e0626,_0x2c246d[_0xa063('0x46')]);return db[_0xa063('0x40')][_0xa063('0x47')](_0x5e0626)['then'](handleEntityNotFound(_0x10fb0e,null))[_0xa063('0x23')](respondWithResult(_0x10fb0e,null))[_0xa063('0x43')](handleError(_0x10fb0e,null));};exports[_0xa063('0x48')]=function(_0x3306d2,_0x2a11e7){return db['VoiceQueuesLog'][_0xa063('0x48')](_0x3306d2[_0xa063('0x49')],{})[_0xa063('0x23')](respondWithResult(_0x2a11e7,0xc9))[_0xa063('0x43')](handleError(_0x2a11e7,null));};exports[_0xa063('0x22')]=function(_0x1d1b8b,_0x128ec4){if(_0x1d1b8b['body']['id']){delete _0x1d1b8b['body']['id'];}return db[_0xa063('0x40')][_0xa063('0x47')]({'where':{'id':_0x1d1b8b[_0xa063('0x4a')]['id']}})[_0xa063('0x23')](handleEntityNotFound(_0x128ec4,null))[_0xa063('0x23')](saveUpdates(_0x1d1b8b['body'],null))[_0xa063('0x23')](respondWithResult(_0x128ec4,null))[_0xa063('0x43')](handleError(_0x128ec4,null));};exports[_0xa063('0x24')]=function(_0x1041b6,_0x206244){return db[_0xa063('0x40')]['find']({'where':{'id':_0x1041b6['params']['id']}})['then'](handleEntityNotFound(_0x206244,null))[_0xa063('0x23')](removeEntity(_0x206244,null))[_0xa063('0x43')](handleError(_0x206244,null));}; \ No newline at end of file +var _0x73d6=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x509081,_0x144a1c){var _0x516423=function(_0x31b98e){while(--_0x31b98e){_0x509081['push'](_0x509081['shift']());}};_0x516423(++_0x144a1c);}(_0x73d6,0x1aa));var _0x673d=function(_0x1d8fa1,_0x18d00f){_0x1d8fa1=_0x1d8fa1-0x0;var _0x528467=_0x73d6[_0x1d8fa1];return _0x528467;};'use strict';var emlformat=require(_0x673d('0x0'));var rimraf=require(_0x673d('0x1'));var zipdir=require(_0x673d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x673d('0x3'));var moment=require(_0x673d('0x4'));var BPromise=require(_0x673d('0x5'));var Mustache=require(_0x673d('0x6'));var util=require(_0x673d('0x7'));var path=require(_0x673d('0x8'));var sox=require(_0x673d('0x9'));var csv=require(_0x673d('0xa'));var ejs=require(_0x673d('0xb'));var fs=require('fs');var fs_extra=require(_0x673d('0xc'));var _=require(_0x673d('0xd'));var squel=require(_0x673d('0xe'));var crypto=require(_0x673d('0xf'));var jsforce=require(_0x673d('0x10'));var deskjs=require(_0x673d('0x11'));var toCsv=require(_0x673d('0xa'));var querystring=require('querystring');var Papa=require(_0x673d('0x12'));var Redis=require(_0x673d('0x13'));var authService=require(_0x673d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x673d('0x15'));var hardwareService=require(_0x673d('0x16'));var logger=require('../../config/logger')(_0x673d('0x17'));var utils=require(_0x673d('0x18'));var config=require(_0x673d('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17ee48,_0x48d891){_0x48d891=_0x48d891||0xcc;return function(_0x45dd7b){if(_0x45dd7b){return _0x17ee48[_0x673d('0x1a')](_0x48d891);}return _0x17ee48[_0x673d('0x1b')](_0x48d891)[_0x673d('0x1c')]();};}function respondWithResult(_0x2ce333,_0x3d2cbf){_0x3d2cbf=_0x3d2cbf||0xc8;return function(_0x1cd596){if(_0x1cd596){return _0x2ce333[_0x673d('0x1b')](_0x3d2cbf)['json'](_0x1cd596);}};}function respondWithFilteredResult(_0x50e860,_0x93f5cc){return function(_0x2d7811){if(_0x2d7811){var _0x5d50c6=typeof _0x93f5cc['offset']===_0x673d('0x1d')&&typeof _0x93f5cc[_0x673d('0x1e')]==='undefined';var _0x4bc7e1=_0x2d7811[_0x673d('0x1f')];var _0x8e48a0=_0x5d50c6?0x0:_0x93f5cc[_0x673d('0x20')];var _0x1834fc=_0x5d50c6?_0x2d7811[_0x673d('0x1f')]:_0x93f5cc[_0x673d('0x20')]+_0x93f5cc[_0x673d('0x1e')];var _0x565bcc;if(_0x1834fc>=_0x4bc7e1){_0x1834fc=_0x4bc7e1;_0x565bcc=0xc8;}else{_0x565bcc=0xce;}_0x50e860[_0x673d('0x1b')](_0x565bcc);return _0x50e860[_0x673d('0x21')](_0x673d('0x22'),_0x8e48a0+'-'+_0x1834fc+'/'+_0x4bc7e1)[_0x673d('0x23')](_0x2d7811);}return null;};}function patchUpdates(_0x13d098){return function(_0x149cbd){try{jsonpatch[_0x673d('0x24')](_0x149cbd,_0x13d098,!![]);}catch(_0x8e9ab2){return BPromise[_0x673d('0x25')](_0x8e9ab2);}return _0x149cbd['save']();};}function saveUpdates(_0x824cb9,_0x58c39a){return function(_0x329263){if(_0x329263){return _0x329263[_0x673d('0x26')](_0x824cb9)[_0x673d('0x27')](function(_0x51582f){return _0x51582f;});}return null;};}function removeEntity(_0x89fbf8,_0x5e1cff){return function(_0x2d48c0){if(_0x2d48c0){return _0x2d48c0['destroy']()['then'](function(){_0x89fbf8['status'](0xcc)[_0x673d('0x1c')]();});}};}function handleEntityNotFound(_0x4934da,_0x3d617d){return function(_0x49be15){if(!_0x49be15){_0x4934da['sendStatus'](0x194);}return _0x49be15;};}function handleError(_0x2463d8,_0x5e4e2c){_0x5e4e2c=_0x5e4e2c||0x1f4;return function(_0x1db0ea){logger['error'](_0x1db0ea[_0x673d('0x28')]);if(_0x1db0ea['name']){delete _0x1db0ea[_0x673d('0x29')];}_0x2463d8['status'](_0x5e4e2c)[_0x673d('0x2a')](_0x1db0ea);};}exports[_0x673d('0x2b')]=function(_0x2a215c,_0x1e30e8){var _0x1ee9b3={},_0x41dbcc={},_0x39f5e2={'count':0x0,'rows':[]};var _0xcfcd4d=_[_0x673d('0x2c')](db[_0x673d('0x2d')][_0x673d('0x2e')],function(_0x31aea7){return{'name':_0x31aea7[_0x673d('0x2f')],'type':_0x31aea7[_0x673d('0x30')][_0x673d('0x31')]};});_0x41dbcc['model']=_[_0x673d('0x2c')](_0xcfcd4d,_0x673d('0x29'));_0x41dbcc['query']=_[_0x673d('0x32')](_0x2a215c[_0x673d('0x33')]);_0x41dbcc[_0x673d('0x34')]=_[_0x673d('0x35')](_0x41dbcc[_0x673d('0x36')],_0x41dbcc[_0x673d('0x33')]);_0x1ee9b3[_0x673d('0x37')]=_[_0x673d('0x35')](_0x41dbcc['model'],qs['fields'](_0x2a215c[_0x673d('0x33')][_0x673d('0x38')]));_0x1ee9b3['attributes']=_0x1ee9b3[_0x673d('0x37')]['length']?_0x1ee9b3[_0x673d('0x37')]:_0x41dbcc[_0x673d('0x36')];if(!_0x2a215c[_0x673d('0x33')]['hasOwnProperty'](_0x673d('0x39'))){_0x1ee9b3['limit']=qs[_0x673d('0x1e')](_0x2a215c[_0x673d('0x33')][_0x673d('0x1e')]);_0x1ee9b3['offset']=qs[_0x673d('0x20')](_0x2a215c[_0x673d('0x33')]['offset']);}_0x1ee9b3[_0x673d('0x3a')]=qs[_0x673d('0x3b')](_0x2a215c[_0x673d('0x33')][_0x673d('0x3b')]);_0x1ee9b3[_0x673d('0x3c')]=qs[_0x673d('0x34')](_['pick'](_0x2a215c[_0x673d('0x33')],_0x41dbcc['filters']),_0xcfcd4d);if(_0x2a215c['query'][_0x673d('0x3d')]){_0x1ee9b3['where']=_[_0x673d('0x3e')](_0x1ee9b3['where'],{'$or':_[_0x673d('0x2c')](_0xcfcd4d,function(_0x336777){if(_0x336777['type']!=='VIRTUAL'){var _0x4543c3={};_0x4543c3[_0x336777['name']]={'$like':'%'+_0x2a215c[_0x673d('0x33')][_0x673d('0x3d')]+'%'};return _0x4543c3;}})});}_0x1ee9b3=_[_0x673d('0x3e')]({},_0x1ee9b3,_0x2a215c[_0x673d('0x3f')]);var _0x40461f={'where':_0x1ee9b3[_0x673d('0x3c')]};return db['VoiceQueuesLog'][_0x673d('0x1f')](_0x40461f)[_0x673d('0x27')](function(_0x5cc970){_0x39f5e2[_0x673d('0x1f')]=_0x5cc970;if(_0x2a215c['query'][_0x673d('0x40')]){_0x1ee9b3[_0x673d('0x41')]=[{'all':!![]}];}return db[_0x673d('0x2d')]['findAll'](_0x1ee9b3);})[_0x673d('0x27')](function(_0x3ea3ce){_0x39f5e2[_0x673d('0x42')]=_0x3ea3ce;return _0x39f5e2;})['then'](respondWithFilteredResult(_0x1e30e8,_0x1ee9b3))[_0x673d('0x43')](handleError(_0x1e30e8,null));};exports['show']=function(_0xc1781c,_0xc88e72){var _0x305d72={'raw':!![],'where':{'id':_0xc1781c[_0x673d('0x44')]['id']}},_0x105f3b={};_0x105f3b['model']=_[_0x673d('0x32')](db['VoiceQueuesLog']['rawAttributes']);_0x105f3b[_0x673d('0x33')]=_[_0x673d('0x32')](_0xc1781c[_0x673d('0x33')]);_0x105f3b[_0x673d('0x34')]=_[_0x673d('0x35')](_0x105f3b[_0x673d('0x36')],_0x105f3b['query']);_0x305d72['attributes']=_['intersection'](_0x105f3b['model'],qs[_0x673d('0x38')](_0xc1781c[_0x673d('0x33')]['fields']));_0x305d72[_0x673d('0x37')]=_0x305d72[_0x673d('0x37')][_0x673d('0x45')]?_0x305d72[_0x673d('0x37')]:_0x105f3b[_0x673d('0x36')];if(_0xc1781c[_0x673d('0x33')]['includeAll']){_0x305d72['include']=[{'all':!![]}];}_0x305d72=_[_0x673d('0x3e')]({},_0x305d72,_0xc1781c[_0x673d('0x3f')]);return db['VoiceQueuesLog'][_0x673d('0x46')](_0x305d72)[_0x673d('0x27')](handleEntityNotFound(_0xc88e72,null))['then'](respondWithResult(_0xc88e72,null))[_0x673d('0x43')](handleError(_0xc88e72,null));};exports[_0x673d('0x47')]=function(_0x4e7fd9,_0x1c64b2){return db['VoiceQueuesLog'][_0x673d('0x47')](_0x4e7fd9[_0x673d('0x48')],{})[_0x673d('0x27')](respondWithResult(_0x1c64b2,0xc9))['catch'](handleError(_0x1c64b2,null));};exports['update']=function(_0x832504,_0x4aed49){if(_0x832504[_0x673d('0x48')]['id']){delete _0x832504[_0x673d('0x48')]['id'];}return db['VoiceQueuesLog'][_0x673d('0x46')]({'where':{'id':_0x832504[_0x673d('0x44')]['id']}})[_0x673d('0x27')](handleEntityNotFound(_0x4aed49,null))[_0x673d('0x27')](saveUpdates(_0x832504[_0x673d('0x48')],null))[_0x673d('0x27')](respondWithResult(_0x4aed49,null))[_0x673d('0x43')](handleError(_0x4aed49,null));};exports[_0x673d('0x49')]=function(_0x19dec1,_0x131fe4){return db[_0x673d('0x2d')]['find']({'where':{'id':_0x19dec1['params']['id']}})[_0x673d('0x27')](handleEntityNotFound(_0x131fe4,null))[_0x673d('0x27')](removeEntity(_0x131fe4,null))[_0x673d('0x43')](handleError(_0x131fe4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b36f0a0..d3d323e 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 _0xad7f=['dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueuesLog','event_dtm','event'];(function(_0x3803e7,_0x2b477c){var _0x1f6ca9=function(_0x564420){while(--_0x564420){_0x3803e7['push'](_0x3803e7['shift']());}};_0x1f6ca9(++_0x2b477c);}(_0xad7f,0x1a5));var _0xfad7=function(_0x380356,_0x44304f){_0x380356=_0x380356-0x0;var _0x542fb4=_0xad7f[_0x380356];return _0x542fb4;};'use strict';var _=require(_0xfad7('0x0'));var util=require(_0xfad7('0x1'));var logger=require(_0xfad7('0x2'))(_0xfad7('0x3'));var moment=require(_0xfad7('0x4'));var BPromise=require(_0xfad7('0x5'));var rp=require(_0xfad7('0x6'));var fs=require('fs');var path=require(_0xfad7('0x7'));var rimraf=require(_0xfad7('0x8'));var config=require(_0xfad7('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0xfad7('0xa')]=function(_0x5b067d,_0x57774f){return _0x5b067d['define'](_0xfad7('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xfad7('0xc'),'fields':[_0xfad7('0xd'),_0xfad7('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x44b4=['path','rimraf','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x7c9a91,_0x206c39){var _0x1c0e61=function(_0xd9dfac){while(--_0xd9dfac){_0x7c9a91['push'](_0x7c9a91['shift']());}};_0x1c0e61(++_0x206c39);}(_0x44b4,0x143));var _0x444b=function(_0x532db6,_0x1ec16b){_0x532db6=_0x532db6-0x0;var _0x5a0b8b=_0x44b4[_0x532db6];return _0x5a0b8b;};'use strict';var _=require(_0x444b('0x0'));var util=require(_0x444b('0x1'));var logger=require(_0x444b('0x2'))(_0x444b('0x3'));var moment=require(_0x444b('0x4'));var BPromise=require(_0x444b('0x5'));var rp=require(_0x444b('0x6'));var fs=require('fs');var path=require(_0x444b('0x7'));var rimraf=require(_0x444b('0x8'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x444b('0x9')]=function(_0x1bd97f,_0x1b064e){return _0x1bd97f[_0x444b('0xa')](_0x444b('0xb'),attributes,{'tableName':_0x444b('0xc'),'paranoid':![],'indexes':[{'name':_0x444b('0xd'),'fields':[_0x444b('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index c744b6d..04329f5 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 _0x0e12=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x5dbef,_0x46fd96){var _0x234c9f=function(_0x4dde67){while(--_0x4dde67){_0x5dbef['push'](_0x5dbef['shift']());}};_0x234c9f(++_0x46fd96);}(_0x0e12,0x180));var _0x20e1=function(_0x3d8ca8,_0x1a9764){_0x3d8ca8=_0x3d8ca8-0x0;var _0x517e45=_0x0e12[_0x3d8ca8];return _0x517e45;};'use strict';var _=require(_0x20e1('0x0'));var util=require(_0x20e1('0x1'));var moment=require(_0x20e1('0x2'));var BPromise=require(_0x20e1('0x3'));var rs=require(_0x20e1('0x4'));var fs=require('fs');var Redis=require(_0x20e1('0x5'));var db=require(_0x20e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x20e1('0x7'))(_0x20e1('0x8'));var config=require(_0x20e1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x20e1('0xa')][_0x20e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51499b,_0x33efe6,_0x47eb0a){return new BPromise(function(_0x2b7184,_0x47a077){return client[_0x20e1('0xc')](_0x51499b,_0x47eb0a)[_0x20e1('0xd')](function(_0x4e9e99){logger[_0x20e1('0xe')](_0x20e1('0xf'),_0x33efe6,_0x20e1('0x10'));logger[_0x20e1('0x11')](_0x20e1('0x12'),_0x33efe6,_0x20e1('0x10'),JSON[_0x20e1('0x13')](_0x4e9e99));if(_0x4e9e99[_0x20e1('0x14')]){if(_0x4e9e99[_0x20e1('0x14')]['code']===0x1f4){logger[_0x20e1('0x14')](_0x20e1('0xf'),_0x33efe6,_0x4e9e99['error']['message']);return _0x47a077(_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);}logger[_0x20e1('0x14')](_0x20e1('0xf'),_0x33efe6,_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);return _0x2b7184(_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);}else{logger['info'](_0x20e1('0xf'),_0x33efe6,_0x20e1('0x10'));_0x2b7184(_0x4e9e99[_0x20e1('0x16')][_0x20e1('0x15')]);}})[_0x20e1('0x17')](function(_0x5ae8dd){logger[_0x20e1('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x33efe6,_0x5ae8dd);_0x47a077(_0x5ae8dd);});});} \ No newline at end of file +var _0x0b40=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info'];(function(_0x524b44,_0x50fcac){var _0x2edf85=function(_0x574892){while(--_0x574892){_0x524b44['push'](_0x524b44['shift']());}};_0x2edf85(++_0x50fcac);}(_0x0b40,0xba));var _0x00b4=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x0b40[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x00b4('0x0'));var moment=require(_0x00b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x00b4('0x2'));var fs=require('fs');var Redis=require(_0x00b4('0x3'));var db=require(_0x00b4('0x4'))['db'];var utils=require(_0x00b4('0x5'));var logger=require(_0x00b4('0x6'))(_0x00b4('0x7'));var config=require('../../config/environment');var jayson=require(_0x00b4('0x8'));var client=jayson[_0x00b4('0x9')][_0x00b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x120157,_0x5684ec,_0x445536){return new BPromise(function(_0x20c810,_0x3f6285){return client['request'](_0x120157,_0x445536)[_0x00b4('0xb')](function(_0x144611){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5684ec,_0x00b4('0xc'));logger[_0x00b4('0xd')](_0x00b4('0xe'),_0x5684ec,_0x00b4('0xc'),JSON[_0x00b4('0xf')](_0x144611));if(_0x144611[_0x00b4('0x10')]){if(_0x144611[_0x00b4('0x10')][_0x00b4('0x11')]===0x1f4){logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x144611[_0x00b4('0x10')][_0x00b4('0x13')]);return _0x3f6285(_0x144611['error']['message']);}logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x144611[_0x00b4('0x10')][_0x00b4('0x13')]);return _0x20c810(_0x144611['error'][_0x00b4('0x13')]);}else{logger[_0x00b4('0x14')](_0x00b4('0x12'),_0x5684ec,_0x00b4('0xc'));_0x20c810(_0x144611[_0x00b4('0x15')][_0x00b4('0x13')]);}})[_0x00b4('0x16')](function(_0x56e54c){logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x56e54c);_0x3f6285(_0x56e54c);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index b6fc35d..a985775 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 _0x764b=['describe','/:id','show','download','downloads','post','create','/:id/transcribe','runTranscribe','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe'];(function(_0x579374,_0x4135bc){var _0x2c4d41=function(_0x42a26d){while(--_0x42a26d){_0x579374['push'](_0x579374['shift']());}};_0x2c4d41(++_0x4135bc);}(_0x764b,0x84));var _0xb764=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x764b[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xb764('0x0'));var util=require(_0xb764('0x1'));var path=require(_0xb764('0x2'));var timeout=require(_0xb764('0x3'));var express=require(_0xb764('0x4'));var router=express['Router']();var fs_extra=require(_0xb764('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb764('0x6'));var config=require(_0xb764('0x7'));var controller=require(_0xb764('0x8'));router[_0xb764('0x9')]('/',auth[_0xb764('0xa')](),controller['index']);router[_0xb764('0x9')](_0xb764('0xb'),auth[_0xb764('0xa')](),controller[_0xb764('0xc')]);router[_0xb764('0x9')](_0xb764('0xd'),auth[_0xb764('0xa')](),controller[_0xb764('0xe')]);router[_0xb764('0x9')]('/:id/download',auth[_0xb764('0xa')](),controller[_0xb764('0xf')]);router[_0xb764('0x9')]('/:id/downloads',controller[_0xb764('0x10')]);router[_0xb764('0x9')]('/:id/transcribe',auth[_0xb764('0xa')](),controller['downloadTranscribe']);router[_0xb764('0x11')]('/',auth[_0xb764('0xa')](),controller[_0xb764('0x12')]);router['post'](_0xb764('0x13'),auth[_0xb764('0xa')](),controller[_0xb764('0x14')]);router['put'](_0xb764('0xd'),auth[_0xb764('0xa')](),controller[_0xb764('0x15')]);router[_0xb764('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb764('0x17')]);module['exports']=router; \ No newline at end of file +var _0x149e=['exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','destroy'];(function(_0x2b22a2,_0x55e449){var _0x2e8440=function(_0x14a068){while(--_0x14a068){_0x2b22a2['push'](_0x2b22a2['shift']());}};_0x2e8440(++_0x55e449);}(_0x149e,0x1cd));var _0xe149=function(_0x30056e,_0x5362da){_0x30056e=_0x30056e-0x0;var _0x2d0556=_0x149e[_0x30056e];return _0x2d0556;};'use strict';var multer=require('multer');var util=require(_0xe149('0x0'));var path=require(_0xe149('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe149('0x2')]();var fs_extra=require(_0xe149('0x3'));var auth=require(_0xe149('0x4'));var interaction=require(_0xe149('0x5'));var config=require(_0xe149('0x6'));var controller=require('./voiceRecording.controller');router[_0xe149('0x7')]('/',auth[_0xe149('0x8')](),controller[_0xe149('0x9')]);router[_0xe149('0x7')](_0xe149('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe149('0x7')](_0xe149('0xb'),auth['isAuthenticated'](),controller[_0xe149('0xc')]);router[_0xe149('0x7')]('/:id/download',auth[_0xe149('0x8')](),controller[_0xe149('0xd')]);router['get']('/:id/downloads',controller[_0xe149('0xe')]);router['get'](_0xe149('0xf'),auth[_0xe149('0x8')](),controller[_0xe149('0x10')]);router[_0xe149('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe149('0x11')](_0xe149('0xf'),auth['isAuthenticated'](),controller[_0xe149('0x12')]);router['put'](_0xe149('0xb'),auth[_0xe149('0x8')](),controller[_0xe149('0x13')]);router[_0xe149('0x14')](_0xe149('0xb'),auth[_0xe149('0x8')](),controller[_0xe149('0x15')]);module[_0xe149('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 166c175..7cc7d70 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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 564bb30..184a279 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 _0xed0d=['uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','VoiceRecording','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','decryptFile','secrets','recording','existsSync','ValidationError','filename','extname','unlink','message','send','downloads','sequelize','col','token','$and','push','Sequelize','VoiceRecording\x20not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','aws-sdk'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xed0d,0x87));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xded0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xded0('0x1'));var jsonpatch=require(_0xded0('0x2'));var rp=require(_0xded0('0x3'));var moment=require(_0xded0('0x4'));var BPromise=require(_0xded0('0x5'));var Mustache=require(_0xded0('0x6'));var util=require('util');var path=require(_0xded0('0x7'));var sox=require('sox');var csv=require(_0xded0('0x8'));var ejs=require(_0xded0('0x9'));var fs=require('fs');var fs_extra=require(_0xded0('0xa'));var _=require(_0xded0('0xb'));var squel=require('squel');var crypto=require(_0xded0('0xc'));var jsforce=require(_0xded0('0xd'));var deskjs=require(_0xded0('0xe'));var toCsv=require(_0xded0('0x8'));var querystring=require('querystring');var Papa=require(_0xded0('0xf'));var AWS=require(_0xded0('0x10'));var uuidv4=require(_0xded0('0x11'));var Redis=require('ioredis');var authService=require(_0xded0('0x12'));var qs=require(_0xded0('0x13'));var as=require(_0xded0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xded0('0x15'))(_0xded0('0x16'));var utils=require('../../config/utils');var config=require(_0xded0('0x17'));var licenseUtil=require(_0xded0('0x18'));var db=require(_0xded0('0x19'))['db'];function respondWithStatusCode(_0x10b1ed,_0x2ab7d5){_0x2ab7d5=_0x2ab7d5||0xcc;return function(_0x53f1ff){if(_0x53f1ff){return _0x10b1ed['sendStatus'](_0x2ab7d5);}return _0x10b1ed[_0xded0('0x1a')](_0x2ab7d5)[_0xded0('0x1b')]();};}function respondWithResult(_0x1d0399,_0x525f80){_0x525f80=_0x525f80||0xc8;return function(_0x416e4a){if(_0x416e4a){return _0x1d0399[_0xded0('0x1a')](_0x525f80)[_0xded0('0x1c')](_0x416e4a);}};}function respondWithFilteredResult(_0x20ac74,_0x53be51){return function(_0x1d6e01){if(_0x1d6e01){var _0x3c6dd1=typeof _0x53be51['offset']===_0xded0('0x1d')&&typeof _0x53be51[_0xded0('0x1e')]==='undefined';var _0xf6ee5a=_0x1d6e01[_0xded0('0x1f')];var _0x4aa5cb=_0x3c6dd1?0x0:_0x53be51[_0xded0('0x20')];var _0x370ab4=_0x3c6dd1?_0x1d6e01[_0xded0('0x1f')]:_0x53be51['offset']+_0x53be51[_0xded0('0x1e')];var _0x12dc9f;if(_0x370ab4>=_0xf6ee5a){_0x370ab4=_0xf6ee5a;_0x12dc9f=0xc8;}else{_0x12dc9f=0xce;}_0x20ac74[_0xded0('0x1a')](_0x12dc9f);return _0x20ac74[_0xded0('0x21')](_0xded0('0x22'),_0x4aa5cb+'-'+_0x370ab4+'/'+_0xf6ee5a)[_0xded0('0x1c')](_0x1d6e01);}return null;};}function patchUpdates(_0x1bf578){return function(_0x5efcd9){try{jsonpatch[_0xded0('0x23')](_0x5efcd9,_0x1bf578,!![]);}catch(_0x27c7a0){return BPromise[_0xded0('0x24')](_0x27c7a0);}return _0x5efcd9[_0xded0('0x25')]();};}function saveUpdates(_0x258086,_0x363c2f){return function(_0x3561a8){if(_0x3561a8){return _0x3561a8[_0xded0('0x26')](_0x258086)['then'](function(_0x294d3a){return _0x294d3a;});}return null;};}function removeEntity(_0x252ee1,_0x1f8cbc){return function(_0x5f4bad){if(_0x5f4bad){return _0x5f4bad[_0xded0('0x27')]()[_0xded0('0x28')](function(){_0x252ee1['status'](0xcc)[_0xded0('0x1b')]();});}};}function handleEntityNotFound(_0x25fd42,_0x59b2c6){return function(_0x412e37){if(!_0x412e37){_0x25fd42['sendStatus'](0x194);}return _0x412e37;};}function handleError(_0x570696,_0x3a5053){_0x3a5053=_0x3a5053||0x1f4;return function(_0x12272d){logger[_0xded0('0x29')](_0x12272d['stack']);if(_0x12272d['name']){delete _0x12272d[_0xded0('0x2a')];}_0x570696[_0xded0('0x1a')](_0x3a5053)['send'](_0x12272d);};}exports[_0xded0('0x2b')]=function(_0x5d658b,_0x43ea4b){var _0x13e428={},_0x2d5227={},_0x591f73={'count':0x0,'rows':[]};var _0x46c9d5=_[_0xded0('0x2c')](db[_0xded0('0x2d')][_0xded0('0x2e')],function(_0x75162e){return{'name':_0x75162e[_0xded0('0x2f')],'type':_0x75162e[_0xded0('0x30')]['key']};});_0x2d5227[_0xded0('0x31')]=_['differenceBy'](_[_0xded0('0x2c')](_0x46c9d5,_0xded0('0x2a')),['format']);_0x2d5227[_0xded0('0x32')]=_[_0xded0('0x33')](_0x5d658b[_0xded0('0x32')]);_0x2d5227[_0xded0('0x34')]=_[_0xded0('0x35')](_0x2d5227[_0xded0('0x31')],_0x2d5227['query']);_0x13e428['attributes']=_[_0xded0('0x35')](_0x2d5227[_0xded0('0x31')],qs[_0xded0('0x36')](_0x5d658b[_0xded0('0x32')][_0xded0('0x36')]));_0x13e428[_0xded0('0x37')]=_0x13e428[_0xded0('0x37')][_0xded0('0x38')]?_0x13e428[_0xded0('0x37')]:_0x2d5227[_0xded0('0x31')];if(!_0x5d658b[_0xded0('0x32')][_0xded0('0x39')](_0xded0('0x3a'))){_0x13e428[_0xded0('0x1e')]=qs[_0xded0('0x1e')](_0x5d658b['query'][_0xded0('0x1e')]);_0x13e428[_0xded0('0x20')]=qs[_0xded0('0x20')](_0x5d658b[_0xded0('0x32')][_0xded0('0x20')]);}_0x13e428[_0xded0('0x3b')]=qs[_0xded0('0x3c')](_0x5d658b[_0xded0('0x32')][_0xded0('0x3c')]);_0x13e428[_0xded0('0x3d')]=qs[_0xded0('0x34')](_[_0xded0('0x3e')](_0x5d658b[_0xded0('0x32')],_0x2d5227[_0xded0('0x34')]),_0x46c9d5);if(_0x5d658b[_0xded0('0x32')][_0xded0('0x3f')]){_0x13e428[_0xded0('0x3d')]=_['merge'](_0x13e428['where'],{'$or':_['map'](_0x46c9d5,function(_0x28fea1){if(_0x28fea1[_0xded0('0x30')]!==_0xded0('0x40')){var _0x3da105={};_0x3da105[_0x28fea1['name']]={'$like':'%'+_0x5d658b['query']['filter']+'%'};return _0x3da105;}})});}_0x13e428=_[_0xded0('0x41')]({},_0x13e428,_0x5d658b[_0xded0('0x42')]);var _0x58efe1={'where':_0x13e428[_0xded0('0x3d')]};return db['VoiceRecording'][_0xded0('0x1f')](_0x58efe1)['then'](function(_0x5ebe7c){_0x591f73[_0xded0('0x1f')]=_0x5ebe7c;if(_0x5d658b[_0xded0('0x32')][_0xded0('0x43')]){_0x13e428[_0xded0('0x44')]=[{'all':!![]}];}return db[_0xded0('0x2d')]['findAll'](_0x13e428);})[_0xded0('0x28')](function(_0x45ea58){_0x591f73['rows']=_0x45ea58;return _0x591f73;})['then'](respondWithFilteredResult(_0x43ea4b,_0x13e428))[_0xded0('0x45')](handleError(_0x43ea4b,null));};exports[_0xded0('0x46')]=function(_0x12c00e,_0x3e1817){var _0x52f0b3={'raw':![],'where':{'id':_0x12c00e[_0xded0('0x47')]['id']}},_0x24a36a={};_0x24a36a[_0xded0('0x31')]=_[_0xded0('0x33')](db['VoiceRecording'][_0xded0('0x2e')]);_0x24a36a[_0xded0('0x32')]=_['keys'](_0x12c00e[_0xded0('0x32')]);_0x24a36a[_0xded0('0x34')]=_[_0xded0('0x35')](_0x24a36a['model'],_0x24a36a['query']);_0x52f0b3[_0xded0('0x37')]=_['intersection'](_0x24a36a[_0xded0('0x31')],qs[_0xded0('0x36')](_0x12c00e['query']['fields']));_0x52f0b3[_0xded0('0x37')]=_0x52f0b3['attributes']['length']?_0x52f0b3[_0xded0('0x37')]:_0x24a36a[_0xded0('0x31')];if(_0x12c00e[_0xded0('0x32')][_0xded0('0x43')]){_0x52f0b3['include']=[{'all':!![]}];}_0x52f0b3=_[_0xded0('0x41')]({},_0x52f0b3,_0x12c00e[_0xded0('0x42')]);return db[_0xded0('0x2d')]['find'](_0x52f0b3)[_0xded0('0x28')](handleEntityNotFound(_0x3e1817,null))[_0xded0('0x28')](respondWithResult(_0x3e1817,null))[_0xded0('0x45')](handleError(_0x3e1817,null));};exports[_0xded0('0x48')]=function(_0x4b4743,_0x1efda6){return db['VoiceRecording'][_0xded0('0x48')](_0x4b4743[_0xded0('0x49')],{})[_0xded0('0x28')](respondWithResult(_0x1efda6,0xc9))[_0xded0('0x45')](handleError(_0x1efda6,null));};exports[_0xded0('0x26')]=function(_0x51e7f0,_0x42a88a){if(_0x51e7f0[_0xded0('0x49')]['id']){delete _0x51e7f0['body']['id'];}return db['VoiceRecording'][_0xded0('0x4a')]({'where':{'id':_0x51e7f0['params']['id']}})[_0xded0('0x28')](handleEntityNotFound(_0x42a88a,null))[_0xded0('0x28')](saveUpdates(_0x51e7f0[_0xded0('0x49')],null))[_0xded0('0x28')](respondWithResult(_0x42a88a,null))[_0xded0('0x45')](handleError(_0x42a88a,null));};exports[_0xded0('0x4b')]=function(_0x48030d,_0xe36e05){return db[_0xded0('0x2d')][_0xded0('0x4b')]()['then'](respondWithResult(_0xe36e05,null))[_0xded0('0x45')](handleError(_0xe36e05,null));};exports[_0xded0('0x4c')]=function(_0x53e4e2,_0x3cdc7d,_0x247de3){var _0x58e68a=require(_0xded0('0x4d'));var _0x32efec=![];var _0x2cc521={};if(_0x53e4e2[_0xded0('0x32')][_0xded0('0x30')]&&_0x53e4e2[_0xded0('0x32')][_0xded0('0x30')]==='uniqueid'){_0x2cc521[_0xded0('0x4e')]=_0x53e4e2[_0xded0('0x47')]['id'];}else{_0x2cc521['id']=_0x53e4e2[_0xded0('0x47')]['id'];}return db[_0xded0('0x2d')]['find']({'where':_0x2cc521,'attributes':['id',_0xded0('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x3cdc7d,null))[_0xded0('0x28')](function(_0x11d5de){if(_0x11d5de){var _0x2fb1bb=_0x11d5de[_0xded0('0x4f')];var _0x1d1bfe=util[_0xded0('0x50')](_0xded0('0x51'),_0x2fb1bb);if(fs['existsSync'](_0x1d1bfe)){_0x32efec=!![];return _0x58e68a[_0xded0('0x52')](_0x1d1bfe,_0x2fb1bb,config[_0xded0('0x53')][_0xded0('0x54')])[_0xded0('0x28')](function(){return _0x11d5de;});}return _0x11d5de;}})[_0xded0('0x28')](function(_0x4eac35){if(_0x4eac35){var _0x4cd35c=_0x4eac35[_0xded0('0x4f')];if(!fs[_0xded0('0x55')](_0x4cd35c)){throw new db['Sequelize'][(_0xded0('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x4eac35[_0xded0('0x57')]){return _0x3cdc7d[_0xded0('0x4c')](_0x4cd35c,_0x4eac35[_0xded0('0x57')]+path[_0xded0('0x58')](_0x4cd35c),function(){if(_0x32efec){fs['unlink'](_0x4cd35c);}});}else{return _0x3cdc7d[_0xded0('0x4c')](_0x4cd35c,function(_0x2ac2c6){if(_0x32efec){fs[_0xded0('0x59')](_0x4cd35c);}});}}})[_0xded0('0x45')](function(_0x201aa4){if(_0x201aa4[_0xded0('0x5a')]==='VoiceRecording\x20not\x20found'){_0x3cdc7d[_0xded0('0x1a')](0x194)[_0xded0('0x5b')]('Not\x20found');}else{return handleError(_0x3cdc7d,null);}});};exports[_0xded0('0x5c')]=function(_0x542a6e,_0xebf091,_0x407048){var _0x2c2656=require('../../components/encryptor');var _0x445c80=![];var _0x289283={'$and':[db['sequelize']['where'](db[_0xded0('0x5d')]['fn']('MD5',db[_0xded0('0x5d')][_0xded0('0x5e')](_0xded0('0x4e'))),_0x542a6e[_0xded0('0x32')][_0xded0('0x5f')])]};if(_0x542a6e[_0xded0('0x32')][_0xded0('0x30')]&&_0x542a6e[_0xded0('0x32')][_0xded0('0x30')]===_0xded0('0x4e')){_0x289283[_0xded0('0x60')][_0xded0('0x61')]({'uniqueid':_0x542a6e[_0xded0('0x47')]['id']});}else{_0x289283[_0xded0('0x60')][_0xded0('0x61')]({'id':_0x542a6e[_0xded0('0x47')]['id']});}return db[_0xded0('0x2d')][_0xded0('0x4a')]({'where':_0x289283,'attributes':['id',_0xded0('0x4f')],'raw':!![]})[_0xded0('0x28')](handleEntityNotFound(_0xebf091,null))[_0xded0('0x28')](function(_0x5a99a6){if(_0x5a99a6){var _0x2e6594=util[_0xded0('0x50')](_0xded0('0x51'),_0x5a99a6[_0xded0('0x4f')]);if(fs[_0xded0('0x55')](_0x2e6594)){_0x445c80=!![];return _0x2c2656['decryptFile'](_0x2e6594,_0x5a99a6[_0xded0('0x4f')],config[_0xded0('0x53')]['recording'])[_0xded0('0x28')](function(){return _0x5a99a6;});}return _0x5a99a6;}})['then'](function(_0x55c676){if(_0x55c676){if(!fs['existsSync'](_0x55c676[_0xded0('0x4f')])){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x63'));}if(_0x55c676[_0xded0('0x57')]){return _0xebf091[_0xded0('0x4c')](_0x55c676[_0xded0('0x4f')],_0x55c676[_0xded0('0x57')]+path['extname'](_0x55c676['value']),function(){if(_0x445c80){fs['unlink'](_0x55c676[_0xded0('0x4f')]);}});}else{return _0xebf091[_0xded0('0x4c')](_0x55c676['value'],function(_0x232b30){if(_0x445c80){fs[_0xded0('0x59')](_0x55c676[_0xded0('0x4f')]);}});}}})[_0xded0('0x45')](handleError(_0xebf091,null));};exports[_0xded0('0x27')]=function(_0x14deb2,_0x100d9d){return db[_0xded0('0x2d')][_0xded0('0x4a')]({'where':{'id':_0x14deb2[_0xded0('0x47')]['id']}})['then'](function(_0x3fe78d){if(_[_0xded0('0x64')](_0x3fe78d)){throw new ReferenceError(_0xded0('0x65'));}return _0x3fe78d;})['then'](function(_0x53cc59){var _0xa4335a=_0x53cc59['value'];logger[_0xded0('0x66')](_0xded0('0x67'),_0xa4335a);if(!_['isNil'](_0x53cc59[_0xded0('0x4f')])&&fs[_0xded0('0x55')](_0xa4335a)){logger['info'](_0xded0('0x68')+_0xa4335a+_0xded0('0x69'));fs[_0xded0('0x6a')](_0xa4335a);}_0xa4335a=_0xa4335a+'.cypher';if(!_[_0xded0('0x64')](_0x53cc59[_0xded0('0x4f')])&&fs[_0xded0('0x55')](_0xa4335a)){logger[_0xded0('0x66')](_0xded0('0x68')+_0xa4335a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xded0('0x6a')](_0xa4335a);}return _0x53cc59;})[_0xded0('0x28')](function(_0x2f3dc9){if(!_0x2f3dc9)throw new InternalError();return _0x2f3dc9[_0xded0('0x27')]();})[_0xded0('0x28')](function(){_0x100d9d[_0xded0('0x1a')](0xcc)[_0xded0('0x1b')]();})[_0xded0('0x45')](handleError(_0x100d9d,null));};function getBucketslist(_0x1679c4,_0x33d429,_0x1be534){return new Promise(function(_0x169154,_0x29f1b8){var _0x536358=new AWS['S3']({'accessKeyId':_0x33d429,'secretAccessKey':_0x1679c4,'region':_0x1be534});_0x536358['listBuckets']({},function(_0x5c85aa,_0x58f712){if(_0x5c85aa){return _0x29f1b8(_0x5c85aa);}else{return _0x169154(_0x58f712);}});});}function createBucket(_0x1bf426,_0x3ad903,_0xdde92e,_0x310dd6){return new Promise(function(_0x3ef04e,_0x43fa18){var _0x6ce74f=new AWS['S3']({'accessKeyId':_0x3ad903,'secretAccessKey':_0x1bf426,'region':_0xdde92e});_0x6ce74f['createBucket']({'Bucket':_0x310dd6},function(_0xd618c,_0x25a4c1){if(_0xd618c){return _0x43fa18(_0xd618c);}else{return _0x3ef04e(_0x25a4c1);}});});}function uploadFile(_0x55fff5,_0x2c0831,_0x122adf,_0x29f409,_0x1b19af,_0xcd3bfd){return new Promise(function(_0x3cbb4e,_0x3480cd){var _0x299423=new AWS['S3']({'accessKeyId':_0x2c0831,'secretAccessKey':_0x55fff5,'region':_0x122adf});_0x299423['upload']({'Bucket':_0x29f409,'Key':_0x1b19af,'Body':_0xcd3bfd},function(_0x37f636,_0x14bf14){if(_0x37f636){return _0x3480cd(_0x37f636);}else{return _0x3cbb4e(_0x14bf14);}});});}function startTranscribe(_0x239fc7,_0xdaddff,_0x11b5af,_0x244ebc,_0xee11e0,_0x433929){return new Promise(function(_0x38859f,_0x576610){var _0x390bc2=new AWS[(_0xded0('0x6b'))]({'accessKeyId':_0xdaddff,'secretAccessKey':_0x239fc7,'region':_0x11b5af});_0x390bc2[_0xded0('0x6c')]({'TranscriptionJobName':_0x244ebc,'LanguageCode':_0xee11e0,'Media':{'MediaFileUri':_0x433929}},function(_0x2cb73a,_0x4f74ac){if(_0x2cb73a){return _0x576610(_0x2cb73a);}else{return _0x38859f(_0x4f74ac);}});});}function transcribe(_0x6effff,_0x3710e5,_0x5b6839,_0x174f5e,_0x1a424e,_0x55cfce,_0x9545df){return new Promise(function(_0xea6d0b,_0x47c0e8){var _0x3354b5={};logger['info'](util[_0xded0('0x50')](_0xded0('0x6d'),_0x6effff,_0x1a424e));return uploadFile(_0x3710e5,_0x5b6839,_0x174f5e,_0x1a424e,path[_0xded0('0x6e')](_0x55cfce),fs[_0xded0('0x6f')](_0x55cfce))[_0xded0('0x28')](function(_0xaa9a0f){logger['info'](util['format'](_0xded0('0x70'),_0x6effff,_0x1a424e,_0xaa9a0f['Location']));_0x3354b5[_0xded0('0x71')]=_0xaa9a0f[_0xded0('0x72')];_0x3354b5[_0xded0('0x73')]=_0xaa9a0f['Location'];logger[_0xded0('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x6effff));return startTranscribe(_0x3710e5,_0x5b6839,_0x174f5e,uuidv4(),_0x9545df,_0xaa9a0f[_0xded0('0x74')]);})[_0xded0('0x28')](function(_0x5aebac){logger[_0xded0('0x66')](util[_0xded0('0x50')](_0xded0('0x75'),_0x6effff,_0x5aebac[_0xded0('0x76')]['TranscriptionJobName']));_0x3354b5[_0xded0('0x77')]=_0x5aebac[_0xded0('0x76')][_0xded0('0x78')];_0x3354b5[_0xded0('0x79')]=_0x5aebac['TranscriptionJob'][_0xded0('0x7a')];return _0xea6d0b(_0x3354b5);})['catch'](function(_0x36ef9b){return _0x47c0e8(_0x36ef9b);});});}exports['runTranscribe']=function(_0x1ff441,_0x5e1e43,_0x416eda){var _0x1c8c23;var _0x29cbeb;var _0x44a7a0;var _0x1d27df=require(_0xded0('0x4d'));return db[_0xded0('0x2d')][_0xded0('0x7b')]({'where':{'id':_0x1ff441['params']['id']}})[_0xded0('0x28')](function(_0x4fe29d){if(_0x4fe29d){var _0xdbee21=util[_0xded0('0x50')](_0xded0('0x51'),_0x4fe29d['value']);if(fs[_0xded0('0x55')](_0xdbee21)){cypher=!![];return _0x1d27df[_0xded0('0x52')](_0xdbee21,_0x4fe29d[_0xded0('0x4f')],config[_0xded0('0x53')]['recording'])[_0xded0('0x28')](function(){return _0x4fe29d;});}return _0x4fe29d;}})[_0xded0('0x28')](function(_0xc076a4){if(!_0xc076a4){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))]('Voice\x20Recording\x20not\x20found');}_0x29cbeb=_0xc076a4;return db[_0xded0('0x7c')][_0xded0('0x7b')]({'where':{'id':0x1}});})[_0xded0('0x28')](handleEntityNotFound(_0x5e1e43,null))[_0xded0('0x28')](function(_0x591a01){if(_0x591a01){_0x1c8c23=_0x591a01;if(!_0x1c8c23[_0xded0('0x7d')]||!_0x1c8c23[_0xded0('0x7e')]||!_0x1c8c23['transcribeRegion']||!_0x1c8c23['language']||!_0x1c8c23[_0xded0('0x71')]){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x7f'));}if(_0x1ff441['body'][_0xded0('0x80')]&&(!_0x1c8c23[_0xded0('0x81')]||!_0x1c8c23['sentimentAccountId']||!_0x1c8c23[_0xded0('0x82')]||!_0x1c8c23[_0xded0('0x83')]||!_0x1c8c23['bucket'])){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x84'));}return db[_0xded0('0x85')][_0xded0('0x7b')]({'where':{'id':_0x1c8c23['transcribeAccountId']}});}})['then'](function(_0x5d67fd){if(!_0x5d67fd){throw new db[(_0xded0('0x62'))]['ValidationError'](_0xded0('0x86'));}if(!_0x5d67fd[_0xded0('0x87')]||!_0x5d67fd['data2']){throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x88'));}_0x44a7a0=_0x5d67fd;return getBucketslist(_0x44a7a0[_0xded0('0x87')],_0x44a7a0[_0xded0('0x89')],_0x1c8c23[_0xded0('0x8a')]);})[_0xded0('0x28')](function(_0x5dbb73){if(_0x5dbb73&&_0x5dbb73[_0xded0('0x8b')]){var _0x231815=_[_0xded0('0x4a')](_0x5dbb73[_0xded0('0x8b')],function(_0x436c7d){return _0x436c7d[_0xded0('0x8c')]===_0x1c8c23[_0xded0('0x71')];});if(!_0x231815){logger[_0xded0('0x66')](util['format'](_0xded0('0x8d'),_0x1ff441[_0xded0('0x47')]['id'],_0x1c8c23[_0xded0('0x71')]));return createBucket(_0x44a7a0[_0xded0('0x87')],_0x44a7a0[_0xded0('0x89')],_0x1c8c23[_0xded0('0x8a')],_0x1c8c23[_0xded0('0x71')]);}logger['info'](util[_0xded0('0x50')](_0xded0('0x8e'),_0x1ff441['params']['id'],_0x1c8c23['bucket']));return;}})[_0xded0('0x28')](function(_0x3362cb){if(_0x29cbeb[_0xded0('0x79')]===_0xded0('0x8f')){return transcribe(_0x1ff441[_0xded0('0x47')]['id'],_0x44a7a0['data1'],_0x44a7a0[_0xded0('0x89')],_0x1c8c23['transcribeRegion'],_0x1c8c23['bucket'],_0x29cbeb[_0xded0('0x4f')],_0x1c8c23[_0xded0('0x83')]);}else{logger[_0xded0('0x66')](util[_0xded0('0x50')](_0xded0('0x90'),_0x1ff441['params']['id']));return{'transcribeStatus':_0xded0('0x91')};}})['then'](function(_0x48c783){if(_0x48c783){_0x48c783[_0xded0('0x92')]=_0x1ff441[_0xded0('0x49')][_0xded0('0x80')];return _0x29cbeb[_0xded0('0x93')](_0x48c783);}})[_0xded0('0x28')](respondWithResult(_0x5e1e43,null))[_0xded0('0x45')](handleError(_0x5e1e43,null));};function writeFile(_0x43e353,_0x1e3959){return new Promise(function(_0x2ffdb6,_0x107e63){fs[_0xded0('0x94')](_0x1e3959,_0x43e353,function(_0x5773cf,_0x21b27b){if(_0x5773cf){return _0x107e63(_0x5773cf);}else{return _0x2ffdb6(_0x21b27b);}});});}exports['downloadTranscribe']=function(_0x3fedd2,_0x10d1fd,_0x2bf1cb){return db['VoiceRecording'][_0xded0('0x7b')]({'where':{'id':_0x3fedd2[_0xded0('0x47')]['id']}})[_0xded0('0x28')](handleEntityNotFound(_0x10d1fd))[_0xded0('0x28')](function(_0x1d6fef){if(_0x1d6fef&&_0x1d6fef[_0xded0('0x95')]){var _0x1440ef=_0x1d6fef[_0xded0('0x95')];var _0x155a56=config['root']+_0xded0('0x96')+_0x1d6fef['id']+'.txt';if(fs[_0xded0('0x55')](_0x155a56)){return _0x155a56;}return writeFile(_0x1440ef,_0x155a56)[_0xded0('0x28')](function(){return _0x155a56;});}else{throw new db[(_0xded0('0x62'))][(_0xded0('0x56'))](_0xded0('0x97'));}})[_0xded0('0x28')](function(_0x587c76){return _0x10d1fd['download'](_0x587c76);})[_0xded0('0x45')](handleError(_0x10d1fd));}; \ No newline at end of file +var _0x0703=['File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','keys','include','create','body','find','describe','uniqueid','params','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','$and','push','destroy','isNil','Entity\x20not\x20found','info'];(function(_0x383005,_0x308d94){var _0x53b88e=function(_0x411128){while(--_0x411128){_0x383005['push'](_0x383005['shift']());}};_0x53b88e(++_0x308d94);}(_0x0703,0xcb));var _0x3070=function(_0x3ca829,_0xc55f17){_0x3ca829=_0x3ca829-0x0;var _0x3b416b=_0x0703[_0x3ca829];return _0x3b416b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3070('0x0'));var zipdir=require(_0x3070('0x1'));var jsonpatch=require(_0x3070('0x2'));var rp=require(_0x3070('0x3'));var moment=require(_0x3070('0x4'));var BPromise=require(_0x3070('0x5'));var Mustache=require(_0x3070('0x6'));var util=require('util');var path=require(_0x3070('0x7'));var sox=require('sox');var csv=require(_0x3070('0x8'));var ejs=require(_0x3070('0x9'));var fs=require('fs');var fs_extra=require(_0x3070('0xa'));var _=require(_0x3070('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3070('0xc'));var toCsv=require(_0x3070('0x8'));var querystring=require(_0x3070('0xd'));var Papa=require(_0x3070('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x3070('0xf'));var Redis=require(_0x3070('0x10'));var authService=require(_0x3070('0x11'));var qs=require(_0x3070('0x12'));var as=require(_0x3070('0x13'));var hardwareService=require(_0x3070('0x14'));var logger=require(_0x3070('0x15'))('api');var utils=require(_0x3070('0x16'));var config=require(_0x3070('0x17'));var licenseUtil=require(_0x3070('0x18'));var db=require(_0x3070('0x19'))['db'];function respondWithStatusCode(_0x55f949,_0x467b0b){_0x467b0b=_0x467b0b||0xcc;return function(_0x112b6c){if(_0x112b6c){return _0x55f949[_0x3070('0x1a')](_0x467b0b);}return _0x55f949['status'](_0x467b0b)['end']();};}function respondWithResult(_0x2c5d6c,_0x4ba763){_0x4ba763=_0x4ba763||0xc8;return function(_0x862cd5){if(_0x862cd5){return _0x2c5d6c[_0x3070('0x1b')](_0x4ba763)[_0x3070('0x1c')](_0x862cd5);}};}function respondWithFilteredResult(_0x22dd3a,_0x2c7c49){return function(_0x1132a1){if(_0x1132a1){var _0xbc0293=typeof _0x2c7c49['offset']==='undefined'&&typeof _0x2c7c49['limit']==='undefined';var _0x53fc17=_0x1132a1[_0x3070('0x1d')];var _0x21b19c=_0xbc0293?0x0:_0x2c7c49[_0x3070('0x1e')];var _0x3ef1b8=_0xbc0293?_0x1132a1[_0x3070('0x1d')]:_0x2c7c49[_0x3070('0x1e')]+_0x2c7c49[_0x3070('0x1f')];var _0x456bc6;if(_0x3ef1b8>=_0x53fc17){_0x3ef1b8=_0x53fc17;_0x456bc6=0xc8;}else{_0x456bc6=0xce;}_0x22dd3a['status'](_0x456bc6);return _0x22dd3a[_0x3070('0x20')](_0x3070('0x21'),_0x21b19c+'-'+_0x3ef1b8+'/'+_0x53fc17)[_0x3070('0x1c')](_0x1132a1);}return null;};}function patchUpdates(_0x448a3d){return function(_0x5d9cf3){try{jsonpatch['apply'](_0x5d9cf3,_0x448a3d,!![]);}catch(_0x475ecd){return BPromise[_0x3070('0x22')](_0x475ecd);}return _0x5d9cf3[_0x3070('0x23')]();};}function saveUpdates(_0x3f5270,_0x36d574){return function(_0x1ded31){if(_0x1ded31){return _0x1ded31[_0x3070('0x24')](_0x3f5270)[_0x3070('0x25')](function(_0x5842d0){return _0x5842d0;});}return null;};}function removeEntity(_0x433577,_0x535ab3){return function(_0x33d6b2){if(_0x33d6b2){return _0x33d6b2['destroy']()[_0x3070('0x25')](function(){_0x433577['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x163d0a,_0x3731be){return function(_0x2a1fd2){if(!_0x2a1fd2){_0x163d0a[_0x3070('0x1a')](0x194);}return _0x2a1fd2;};}function handleError(_0x5a863c,_0x3d6eb2){_0x3d6eb2=_0x3d6eb2||0x1f4;return function(_0x44d695){logger['error'](_0x44d695[_0x3070('0x26')]);if(_0x44d695[_0x3070('0x27')]){delete _0x44d695['name'];}_0x5a863c['status'](_0x3d6eb2)[_0x3070('0x28')](_0x44d695);};}exports[_0x3070('0x29')]=function(_0x14aec0,_0x179bfe){var _0x1877f3={},_0x1455e3={},_0x4d1caf={'count':0x0,'rows':[]};var _0x5636cc=_[_0x3070('0x2a')](db[_0x3070('0x2b')][_0x3070('0x2c')],function(_0x53bc8e){return{'name':_0x53bc8e[_0x3070('0x2d')],'type':_0x53bc8e[_0x3070('0x2e')][_0x3070('0x2f')]};});_0x1455e3['model']=_['differenceBy'](_[_0x3070('0x2a')](_0x5636cc,'name'),[_0x3070('0x30')]);_0x1455e3[_0x3070('0x31')]=_['keys'](_0x14aec0[_0x3070('0x31')]);_0x1455e3[_0x3070('0x32')]=_[_0x3070('0x33')](_0x1455e3[_0x3070('0x34')],_0x1455e3['query']);_0x1877f3[_0x3070('0x35')]=_[_0x3070('0x33')](_0x1455e3[_0x3070('0x34')],qs[_0x3070('0x36')](_0x14aec0[_0x3070('0x31')][_0x3070('0x36')]));_0x1877f3[_0x3070('0x35')]=_0x1877f3[_0x3070('0x35')][_0x3070('0x37')]?_0x1877f3[_0x3070('0x35')]:_0x1455e3['model'];if(!_0x14aec0[_0x3070('0x31')][_0x3070('0x38')](_0x3070('0x39'))){_0x1877f3[_0x3070('0x1f')]=qs[_0x3070('0x1f')](_0x14aec0[_0x3070('0x31')][_0x3070('0x1f')]);_0x1877f3[_0x3070('0x1e')]=qs['offset'](_0x14aec0[_0x3070('0x31')][_0x3070('0x1e')]);}_0x1877f3['order']=qs[_0x3070('0x3a')](_0x14aec0['query'][_0x3070('0x3a')]);_0x1877f3[_0x3070('0x3b')]=qs[_0x3070('0x32')](_['pick'](_0x14aec0[_0x3070('0x31')],_0x1455e3[_0x3070('0x32')]),_0x5636cc);if(_0x14aec0[_0x3070('0x31')][_0x3070('0x3c')]){_0x1877f3[_0x3070('0x3b')]=_[_0x3070('0x3d')](_0x1877f3[_0x3070('0x3b')],{'$or':_[_0x3070('0x2a')](_0x5636cc,function(_0x39a07f){if(_0x39a07f[_0x3070('0x2e')]!==_0x3070('0x3e')){var _0x4a675f={};_0x4a675f[_0x39a07f[_0x3070('0x27')]]={'$like':'%'+_0x14aec0['query'][_0x3070('0x3c')]+'%'};return _0x4a675f;}})});}_0x1877f3=_[_0x3070('0x3d')]({},_0x1877f3,_0x14aec0[_0x3070('0x3f')]);var _0x2a947f={'where':_0x1877f3[_0x3070('0x3b')]};return db[_0x3070('0x2b')][_0x3070('0x1d')](_0x2a947f)[_0x3070('0x25')](function(_0x1be995){_0x4d1caf[_0x3070('0x1d')]=_0x1be995;if(_0x14aec0[_0x3070('0x31')]['includeAll']){_0x1877f3['include']=[{'all':!![]}];}return db[_0x3070('0x2b')][_0x3070('0x40')](_0x1877f3);})[_0x3070('0x25')](function(_0x126ed5){_0x4d1caf[_0x3070('0x41')]=_0x126ed5;return _0x4d1caf;})[_0x3070('0x25')](respondWithFilteredResult(_0x179bfe,_0x1877f3))[_0x3070('0x42')](handleError(_0x179bfe,null));};exports[_0x3070('0x43')]=function(_0x103389,_0x35f2a6){var _0x19b0a8={'raw':![],'where':{'id':_0x103389['params']['id']}},_0x158b64={};_0x158b64[_0x3070('0x34')]=_[_0x3070('0x44')](db[_0x3070('0x2b')][_0x3070('0x2c')]);_0x158b64[_0x3070('0x31')]=_[_0x3070('0x44')](_0x103389[_0x3070('0x31')]);_0x158b64['filters']=_[_0x3070('0x33')](_0x158b64[_0x3070('0x34')],_0x158b64[_0x3070('0x31')]);_0x19b0a8['attributes']=_[_0x3070('0x33')](_0x158b64[_0x3070('0x34')],qs[_0x3070('0x36')](_0x103389[_0x3070('0x31')][_0x3070('0x36')]));_0x19b0a8['attributes']=_0x19b0a8['attributes'][_0x3070('0x37')]?_0x19b0a8[_0x3070('0x35')]:_0x158b64[_0x3070('0x34')];if(_0x103389[_0x3070('0x31')]['includeAll']){_0x19b0a8[_0x3070('0x45')]=[{'all':!![]}];}_0x19b0a8=_[_0x3070('0x3d')]({},_0x19b0a8,_0x103389[_0x3070('0x3f')]);return db[_0x3070('0x2b')]['find'](_0x19b0a8)[_0x3070('0x25')](handleEntityNotFound(_0x35f2a6,null))[_0x3070('0x25')](respondWithResult(_0x35f2a6,null))[_0x3070('0x42')](handleError(_0x35f2a6,null));};exports[_0x3070('0x46')]=function(_0x427518,_0x5b08d2){return db[_0x3070('0x2b')][_0x3070('0x46')](_0x427518[_0x3070('0x47')],{})[_0x3070('0x25')](respondWithResult(_0x5b08d2,0xc9))[_0x3070('0x42')](handleError(_0x5b08d2,null));};exports[_0x3070('0x24')]=function(_0x11b663,_0x438056){if(_0x11b663[_0x3070('0x47')]['id']){delete _0x11b663[_0x3070('0x47')]['id'];}return db[_0x3070('0x2b')][_0x3070('0x48')]({'where':{'id':_0x11b663['params']['id']}})[_0x3070('0x25')](handleEntityNotFound(_0x438056,null))[_0x3070('0x25')](saveUpdates(_0x11b663[_0x3070('0x47')],null))[_0x3070('0x25')](respondWithResult(_0x438056,null))[_0x3070('0x42')](handleError(_0x438056,null));};exports[_0x3070('0x49')]=function(_0x12c65d,_0x4a516b){return db[_0x3070('0x2b')][_0x3070('0x49')]()[_0x3070('0x25')](respondWithResult(_0x4a516b,null))[_0x3070('0x42')](handleError(_0x4a516b,null));};exports['download']=function(_0x2b9e3b,_0x49c5b6,_0xbf541d){var _0x37308e=require('../../components/encryptor');var _0x41743c=![];var _0x41736f={};if(_0x2b9e3b[_0x3070('0x31')][_0x3070('0x2e')]&&_0x2b9e3b[_0x3070('0x31')]['type']===_0x3070('0x4a')){_0x41736f[_0x3070('0x4a')]=_0x2b9e3b[_0x3070('0x4b')]['id'];}else{_0x41736f['id']=_0x2b9e3b['params']['id'];}return db[_0x3070('0x2b')][_0x3070('0x48')]({'where':_0x41736f,'attributes':['id',_0x3070('0x4c')],'raw':!![]})[_0x3070('0x25')](handleEntityNotFound(_0x49c5b6,null))[_0x3070('0x25')](function(_0x3bb7b6){if(_0x3bb7b6){var _0x418b6f=_0x3bb7b6[_0x3070('0x4c')];var _0x52f857=util['format'](_0x3070('0x4d'),_0x418b6f);if(fs['existsSync'](_0x52f857)){_0x41743c=!![];return _0x37308e[_0x3070('0x4e')](_0x52f857,_0x418b6f,config[_0x3070('0x4f')][_0x3070('0x50')])[_0x3070('0x25')](function(){return _0x3bb7b6;});}return _0x3bb7b6;}})['then'](function(_0x5ac69f){if(_0x5ac69f){var _0x5c08d5=_0x5ac69f[_0x3070('0x4c')];if(!fs[_0x3070('0x51')](_0x5c08d5)){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x54'));}if(_0x5ac69f[_0x3070('0x55')]){return _0x49c5b6[_0x3070('0x56')](_0x5c08d5,_0x5ac69f['filename']+path['extname'](_0x5c08d5),function(){if(_0x41743c){fs[_0x3070('0x57')](_0x5c08d5);}});}else{return _0x49c5b6[_0x3070('0x56')](_0x5c08d5,function(_0x10d698){if(_0x41743c){fs[_0x3070('0x57')](_0x5c08d5);}});}}})[_0x3070('0x42')](function(_0x206d05){if(_0x206d05[_0x3070('0x58')]===_0x3070('0x54')){_0x49c5b6[_0x3070('0x1b')](0x194)[_0x3070('0x28')](_0x3070('0x59'));}else{return handleError(_0x49c5b6,null);}});};exports[_0x3070('0x5a')]=function(_0x32e89b,_0x55f95a,_0x5e7916){var _0xead13f=require(_0x3070('0x5b'));var _0x40755c=![];var _0x5eadbb={'$and':[db[_0x3070('0x5c')]['where'](db[_0x3070('0x5c')]['fn'](_0x3070('0x5d'),db['sequelize']['col']('uniqueid')),_0x32e89b[_0x3070('0x31')][_0x3070('0x5e')])]};if(_0x32e89b['query'][_0x3070('0x2e')]&&_0x32e89b[_0x3070('0x31')]['type']==='uniqueid'){_0x5eadbb[_0x3070('0x5f')][_0x3070('0x60')]({'uniqueid':_0x32e89b[_0x3070('0x4b')]['id']});}else{_0x5eadbb[_0x3070('0x5f')][_0x3070('0x60')]({'id':_0x32e89b['params']['id']});}return db[_0x3070('0x2b')]['find']({'where':_0x5eadbb,'attributes':['id',_0x3070('0x4c')],'raw':!![]})[_0x3070('0x25')](handleEntityNotFound(_0x55f95a,null))[_0x3070('0x25')](function(_0xec2c34){if(_0xec2c34){var _0xe26e20=util['format'](_0x3070('0x4d'),_0xec2c34[_0x3070('0x4c')]);if(fs[_0x3070('0x51')](_0xe26e20)){_0x40755c=!![];return _0xead13f[_0x3070('0x4e')](_0xe26e20,_0xec2c34[_0x3070('0x4c')],config[_0x3070('0x4f')][_0x3070('0x50')])['then'](function(){return _0xec2c34;});}return _0xec2c34;}})[_0x3070('0x25')](function(_0xedb622){if(_0xedb622){if(!fs['existsSync'](_0xedb622['value'])){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x54'));}if(_0xedb622[_0x3070('0x55')]){return _0x55f95a[_0x3070('0x56')](_0xedb622[_0x3070('0x4c')],_0xedb622[_0x3070('0x55')]+path['extname'](_0xedb622['value']),function(){if(_0x40755c){fs['unlink'](_0xedb622['value']);}});}else{return _0x55f95a[_0x3070('0x56')](_0xedb622[_0x3070('0x4c')],function(_0x5f1606){if(_0x40755c){fs[_0x3070('0x57')](_0xedb622[_0x3070('0x4c')]);}});}}})['catch'](handleError(_0x55f95a,null));};exports[_0x3070('0x61')]=function(_0x131fd0,_0x29955c){return db[_0x3070('0x2b')][_0x3070('0x48')]({'where':{'id':_0x131fd0[_0x3070('0x4b')]['id']}})[_0x3070('0x25')](function(_0x59c030){if(_[_0x3070('0x62')](_0x59c030)){throw new ReferenceError(_0x3070('0x63'));}return _0x59c030;})[_0x3070('0x25')](function(_0x1b502f){var _0x1fb388=_0x1b502f[_0x3070('0x4c')];logger[_0x3070('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x1fb388);if(!_[_0x3070('0x62')](_0x1b502f[_0x3070('0x4c')])&&fs[_0x3070('0x51')](_0x1fb388)){logger[_0x3070('0x64')](_0x3070('0x65')+_0x1fb388+_0x3070('0x66'));fs[_0x3070('0x67')](_0x1fb388);}_0x1fb388=_0x1fb388+_0x3070('0x68');if(!_[_0x3070('0x62')](_0x1b502f['value'])&&fs[_0x3070('0x51')](_0x1fb388)){logger[_0x3070('0x64')](_0x3070('0x65')+_0x1fb388+_0x3070('0x66'));fs['unlinkSync'](_0x1fb388);}return _0x1b502f;})[_0x3070('0x25')](function(_0x5d99c0){if(!_0x5d99c0)throw new InternalError();return _0x5d99c0[_0x3070('0x61')]();})['then'](function(){_0x29955c[_0x3070('0x1b')](0xcc)[_0x3070('0x69')]();})[_0x3070('0x42')](handleError(_0x29955c,null));};function getBucketslist(_0x2bf81e,_0x5d9469,_0x503b8b){return new Promise(function(_0x5ada7b,_0x2aba83){var _0x52de8a=new AWS['S3']({'accessKeyId':_0x5d9469,'secretAccessKey':_0x2bf81e,'region':_0x503b8b});_0x52de8a[_0x3070('0x6a')]({},function(_0x30fcf2,_0x21c2be){if(_0x30fcf2){return _0x2aba83(_0x30fcf2);}else{return _0x5ada7b(_0x21c2be);}});});}function createBucket(_0x59eb73,_0x23477e,_0x2e6bda,_0x4ba5a1){return new Promise(function(_0x41b590,_0x1b48fb){var _0x2a942e=new AWS['S3']({'accessKeyId':_0x23477e,'secretAccessKey':_0x59eb73,'region':_0x2e6bda});_0x2a942e[_0x3070('0x6b')]({'Bucket':_0x4ba5a1},function(_0x41029a,_0x438b88){if(_0x41029a){return _0x1b48fb(_0x41029a);}else{return _0x41b590(_0x438b88);}});});}function uploadFile(_0x4e15b7,_0xb4f8ad,_0x9c220,_0x47b31b,_0x5715d0,_0x579af5){return new Promise(function(_0x65e265,_0x43b2b7){var _0x50901d=new AWS['S3']({'accessKeyId':_0xb4f8ad,'secretAccessKey':_0x4e15b7,'region':_0x9c220});_0x50901d[_0x3070('0x6c')]({'Bucket':_0x47b31b,'Key':_0x5715d0,'Body':_0x579af5},function(_0x5ba3d0,_0x466109){if(_0x5ba3d0){return _0x43b2b7(_0x5ba3d0);}else{return _0x65e265(_0x466109);}});});}function startTranscribe(_0x5efd02,_0x2f6fc3,_0x145115,_0x2ade76,_0x5e3227,_0x3ee022){return new Promise(function(_0x1b3f2c,_0x484636){var _0x493e13=new AWS[(_0x3070('0x6d'))]({'accessKeyId':_0x2f6fc3,'secretAccessKey':_0x5efd02,'region':_0x145115});_0x493e13[_0x3070('0x6e')]({'TranscriptionJobName':_0x2ade76,'LanguageCode':_0x5e3227,'Media':{'MediaFileUri':_0x3ee022}},function(_0x1f80cd,_0x1c6bc4){if(_0x1f80cd){return _0x484636(_0x1f80cd);}else{return _0x1b3f2c(_0x1c6bc4);}});});}function transcribe(_0x198e30,_0x5cd90e,_0x2302e7,_0x24353e,_0x45c8a4,_0x34d6a7,_0x7f45b1){return new Promise(function(_0x58aca8,_0x1195b6){var _0x56a4ed={};logger['info'](util[_0x3070('0x30')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x198e30,_0x45c8a4));return uploadFile(_0x5cd90e,_0x2302e7,_0x24353e,_0x45c8a4,path['basename'](_0x34d6a7),fs['readFileSync'](_0x34d6a7))[_0x3070('0x25')](function(_0x56f532){logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x6f'),_0x198e30,_0x45c8a4,_0x56f532[_0x3070('0x70')]));_0x56a4ed[_0x3070('0x71')]=_0x56f532['Bucket'];_0x56a4ed[_0x3070('0x72')]=_0x56f532[_0x3070('0x70')];logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x73'),_0x198e30));return startTranscribe(_0x5cd90e,_0x2302e7,_0x24353e,uuidv4(),_0x7f45b1,_0x56f532['Location']);})['then'](function(_0x5b5ab8){logger[_0x3070('0x64')](util[_0x3070('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x198e30,_0x5b5ab8[_0x3070('0x74')][_0x3070('0x75')]));_0x56a4ed[_0x3070('0x76')]=_0x5b5ab8['TranscriptionJob'][_0x3070('0x75')];_0x56a4ed[_0x3070('0x77')]=_0x5b5ab8['TranscriptionJob'][_0x3070('0x78')];return _0x58aca8(_0x56a4ed);})[_0x3070('0x42')](function(_0x191e4b){return _0x1195b6(_0x191e4b);});});}exports[_0x3070('0x79')]=function(_0xf14330,_0x4fe530,_0x3e028d){var _0x4ed915;var _0x22597d;var _0x1c302e;var _0x1a05b5=require(_0x3070('0x5b'));return db[_0x3070('0x2b')]['findOne']({'where':{'id':_0xf14330['params']['id']}})[_0x3070('0x25')](function(_0x3242d5){if(_0x3242d5){var _0x2de60a=util['format']('%s.cypher',_0x3242d5[_0x3070('0x4c')]);if(fs[_0x3070('0x51')](_0x2de60a)){cypher=!![];return _0x1a05b5[_0x3070('0x4e')](_0x2de60a,_0x3242d5[_0x3070('0x4c')],config[_0x3070('0x4f')]['recording'])[_0x3070('0x25')](function(){return _0x3242d5;});}return _0x3242d5;}})[_0x3070('0x25')](function(_0x5159c5){if(!_0x5159c5){throw new db[(_0x3070('0x52'))]['ValidationError'](_0x3070('0x7a'));}_0x22597d=_0x5159c5;return db['Setting'][_0x3070('0x7b')]({'where':{'id':0x1}});})[_0x3070('0x25')](handleEntityNotFound(_0x4fe530,null))['then'](function(_0x4ebac7){if(_0x4ebac7){_0x4ed915=_0x4ebac7;if(!_0x4ed915[_0x3070('0x7c')]||!_0x4ed915['transcribeAccountId']||!_0x4ed915[_0x3070('0x7d')]||!_0x4ed915[_0x3070('0x7e')]||!_0x4ed915[_0x3070('0x71')]){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x7f'));}if(_0xf14330[_0x3070('0x47')][_0x3070('0x80')]&&(!_0x4ed915[_0x3070('0x81')]||!_0x4ed915[_0x3070('0x82')]||!_0x4ed915[_0x3070('0x83')]||!_0x4ed915[_0x3070('0x7e')]||!_0x4ed915['bucket'])){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x84'));}return db[_0x3070('0x85')][_0x3070('0x7b')]({'where':{'id':_0x4ed915[_0x3070('0x86')]}});}})[_0x3070('0x25')](function(_0x140a88){if(!_0x140a88){throw new db['Sequelize'][(_0x3070('0x53'))](_0x3070('0x87'));}if(!_0x140a88[_0x3070('0x88')]||!_0x140a88[_0x3070('0x89')]){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x8a'));}_0x1c302e=_0x140a88;return getBucketslist(_0x1c302e['data1'],_0x1c302e[_0x3070('0x89')],_0x4ed915[_0x3070('0x7d')]);})['then'](function(_0x2738e6){if(_0x2738e6&&_0x2738e6[_0x3070('0x8b')]){var _0x1badb3=_[_0x3070('0x48')](_0x2738e6[_0x3070('0x8b')],function(_0x5b8124){return _0x5b8124['Name']===_0x4ed915['bucket'];});if(!_0x1badb3){logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x8c'),_0xf14330[_0x3070('0x4b')]['id'],_0x4ed915[_0x3070('0x71')]));return createBucket(_0x1c302e['data1'],_0x1c302e['data2'],_0x4ed915['transcribeRegion'],_0x4ed915[_0x3070('0x71')]);}logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x8d'),_0xf14330[_0x3070('0x4b')]['id'],_0x4ed915[_0x3070('0x71')]));return;}})[_0x3070('0x25')](function(_0x257cc0){if(_0x22597d[_0x3070('0x77')]===_0x3070('0x8e')){return transcribe(_0xf14330[_0x3070('0x4b')]['id'],_0x1c302e[_0x3070('0x88')],_0x1c302e[_0x3070('0x89')],_0x4ed915[_0x3070('0x7d')],_0x4ed915[_0x3070('0x71')],_0x22597d[_0x3070('0x4c')],_0x4ed915[_0x3070('0x7e')]);}else{logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x8f'),_0xf14330['params']['id']));return{'transcribeStatus':_0x3070('0x90')};}})[_0x3070('0x25')](function(_0x66d97e){if(_0x66d97e){_0x66d97e[_0x3070('0x91')]=_0xf14330[_0x3070('0x47')][_0x3070('0x80')];return _0x22597d[_0x3070('0x92')](_0x66d97e);}})[_0x3070('0x25')](respondWithResult(_0x4fe530,null))[_0x3070('0x42')](handleError(_0x4fe530,null));};function writeFile(_0xf491ea,_0x5a6362){return new Promise(function(_0x3d1100,_0x46f1a8){fs[_0x3070('0x93')](_0x5a6362,_0xf491ea,function(_0x50148a,_0x17cc31){if(_0x50148a){return _0x46f1a8(_0x50148a);}else{return _0x3d1100(_0x17cc31);}});});}exports['downloadTranscribe']=function(_0x109ce4,_0x3b2ffa,_0x3ff5b9){return db[_0x3070('0x2b')][_0x3070('0x7b')]({'where':{'id':_0x109ce4['params']['id']}})['then'](handleEntityNotFound(_0x3b2ffa))[_0x3070('0x25')](function(_0x2b71c6){if(_0x2b71c6&&_0x2b71c6[_0x3070('0x94')]){var _0x426ad8=_0x2b71c6[_0x3070('0x94')];var _0x44d191=config[_0x3070('0x95')]+_0x3070('0x96')+_0x2b71c6['id']+_0x3070('0x97');if(fs['existsSync'](_0x44d191)){return _0x44d191;}return writeFile(_0x426ad8,_0x44d191)[_0x3070('0x25')](function(){return _0x44d191;});}else{throw new db['Sequelize'][(_0x3070('0x53'))]('Transcript\x20not\x20available');}})[_0x3070('0x25')](function(_0xf859d3){return _0x3b2ffa[_0x3070('0x56')](_0xf859d3);})[_0x3070('0x42')](handleError(_0x3b2ffa));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 60877e5..714f87c 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 _0x280f=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','define'];(function(_0xd4ec0c,_0x2afcd2){var _0x580218=function(_0x3b1cd4){while(--_0x3b1cd4){_0xd4ec0c['push'](_0xd4ec0c['shift']());}};_0x580218(++_0x2afcd2);}(_0x280f,0xe2));var _0xf280=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x280f[_0x644ecd];return _0x1c66ce;};'use strict';var attributes=require(_0xf280('0x0'));module['exports']=function(_0x412811,_0x125275){return _0x412811[_0xf280('0x1')](_0xf280('0x2'),attributes,{'tableName':_0xf280('0x3'),'paranoid':![],'indexes':[{'name':_0xf280('0x4'),'fields':[_0xf280('0x4')]},{'name':'transcribeStatus','fields':[_0xf280('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe58a=['exports','define','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x3ccda4,_0x3b097b){var _0x4c68d6=function(_0x13753f){while(--_0x13753f){_0x3ccda4['push'](_0x3ccda4['shift']());}};_0x4c68d6(++_0x3b097b);}(_0xe58a,0x9f));var _0xae58=function(_0x316c48,_0x4d669f){_0x316c48=_0x316c48-0x0;var _0x3d7c68=_0xe58a[_0x316c48];return _0x3d7c68;};'use strict';var attributes=require(_0xae58('0x0'));module[_0xae58('0x1')]=function(_0x3adf03,_0x56bff5){return _0x3adf03[_0xae58('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xae58('0x3'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0xae58('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 38c4b8c..4966bde 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 _0x5b12=['Setting','callRecordingEncryption','create','body','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','UpdateVoiceRecording','VoiceRecording','options','raw','attributes','CreateVoiceRecording','../../components/encryptor'];(function(_0x381f03,_0x4c3f61){var _0x21a630=function(_0x34a2fa){while(--_0x34a2fa){_0x381f03['push'](_0x381f03['shift']());}};_0x21a630(++_0x4c3f61);}(_0x5b12,0xa3));var _0x25b1=function(_0xf73297,_0x1e8493){_0xf73297=_0xf73297-0x0;var _0x24ebdf=_0x5b12[_0xf73297];return _0x24ebdf;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});}exports[_0x25b1('0x14')]=function(_0x27ccc9){var _0x1f78c2=this;return new Promise(function(_0x2a7d14,_0x17024a){return db[_0x25b1('0x15')]['update'](_0x27ccc9['body'],{'raw':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ccc9['options']?_0x27ccc9[_0x25b1('0x16')]['where']||null:null,'attributes':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x18')]||null:null,'limit':_0x27ccc9['options']?_0x27ccc9['options']['limit']||null:null})[_0x25b1('0x9')](function(_0x150436){logger['info'](_0x25b1('0x14'),_0x27ccc9);logger[_0x25b1('0xc')](_0x25b1('0x14'),_0x27ccc9,JSON[_0x25b1('0xe')](_0x150436));_0x2a7d14(_0x150436);})[_0x25b1('0x13')](function(_0x5e6b6b){logger[_0x25b1('0xf')](_0x25b1('0x14'),_0x5e6b6b[_0x25b1('0x12')],_0x27ccc9);_0x17024a(_0x1f78c2[_0x25b1('0xf')](0x1f4,_0x5e6b6b[_0x25b1('0x12')]));});});};exports[_0x25b1('0x19')]=function(_0x5d9ed7){var _0x3c05c6=this;return new Promise(function(_0x27dd68,_0x3d279f){var _0x5bc8fc=require(_0x25b1('0x1a'));var _0x9e175f;return db[_0x25b1('0x1b')]['findOne']({'attributes':['id',_0x25b1('0x1c')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x19ecd1){_0x9e175f=_0x19ecd1;return db[_0x25b1('0x15')][_0x25b1('0x1d')](_0x5d9ed7[_0x25b1('0x1e')]);})[_0x25b1('0x9')](function(_0x300a14){if(_0x9e175f[_0x25b1('0x1c')]&&fs['existsSync'](_0x300a14[_0x25b1('0x1f')])){var _0xca56f0=util[_0x25b1('0x20')](_0x25b1('0x21'),_0x300a14[_0x25b1('0x1f')]);return _0x5bc8fc['encryptFile'](_0x300a14[_0x25b1('0x1f')],_0xca56f0,config[_0x25b1('0x22')][_0x25b1('0x23')])[_0x25b1('0x9')](function(){fs[_0x25b1('0x24')](_0x300a14['value']);logger['info'](_0x25b1('0x25'));return _0x300a14;});}return _0x300a14;})['then'](function(_0x446984){logger[_0x25b1('0xa')](_0x25b1('0x19'),_0x5d9ed7);logger['debug']('CreateVoiceRecording',_0x5d9ed7,JSON[_0x25b1('0xe')](_0x446984));_0x27dd68(_0x446984);})[_0x25b1('0x13')](function(_0x26d3bc){logger['error'](_0x25b1('0x19'),_0x26d3bc[_0x25b1('0x12')],_0x5d9ed7);_0x3d279f(_0x3c05c6[_0x25b1('0xf')](0x1f4,_0x26d3bc[_0x25b1('0x12')]));});});}; \ No newline at end of file +var _0xc1c6=['format','%s.cypher','value','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','update','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','existsSync'];(function(_0x43d4f8,_0x1afb74){var _0x1f6c87=function(_0x289353){while(--_0x289353){_0x43d4f8['push'](_0x43d4f8['shift']());}};_0x1f6c87(++_0x1afb74);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2915cb,_0x44baf7){_0x2915cb=_0x2915cb-0x0;var _0x367276=_0xc1c6[_0x2915cb];return _0x367276;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['UpdateVoiceRecording']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['VoiceRecording'][_0x6c1c('0x13')](_0x137770['body'],{'raw':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x16')]||null:null,'attributes':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x17')]||null:null,'limit':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x18')]||null:null})[_0x6c1c('0x9')](function(_0x9c6c55){logger[_0x6c1c('0x11')](_0x6c1c('0x19'),_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x19'),_0x137770,JSON[_0x6c1c('0xe')](_0x9c6c55));_0x338dc2(_0x9c6c55);})[_0x6c1c('0x12')](function(_0x96046a){logger[_0x6c1c('0xf')](_0x6c1c('0x19'),_0x96046a[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x96046a[_0x6c1c('0x10')]));});});};exports[_0x6c1c('0x1a')]=function(_0x1b9d7d){var _0x2feaf4=this;return new Promise(function(_0x5f4568,_0x2595c3){var _0x4d73aa=require(_0x6c1c('0x1b'));var _0x4c23f8;return db[_0x6c1c('0x1c')]['findOne']({'attributes':['id',_0x6c1c('0x1d')],'where':{'id':0x1},'raw':!![]})[_0x6c1c('0x9')](function(_0x504348){_0x4c23f8=_0x504348;return db[_0x6c1c('0x1e')][_0x6c1c('0x1f')](_0x1b9d7d['body']);})[_0x6c1c('0x9')](function(_0x19a8f1){if(_0x4c23f8[_0x6c1c('0x1d')]&&fs[_0x6c1c('0x20')](_0x19a8f1['value'])){var _0x52c036=util[_0x6c1c('0x21')](_0x6c1c('0x22'),_0x19a8f1[_0x6c1c('0x23')]);return _0x4d73aa[_0x6c1c('0x24')](_0x19a8f1[_0x6c1c('0x23')],_0x52c036,config[_0x6c1c('0x25')]['recording'])[_0x6c1c('0x9')](function(){fs[_0x6c1c('0x26')](_0x19a8f1['value']);logger[_0x6c1c('0x11')](_0x6c1c('0x27'));return _0x19a8f1;});}return _0x19a8f1;})[_0x6c1c('0x9')](function(_0x15b6d2){logger['info'](_0x6c1c('0x1a'),_0x1b9d7d);logger[_0x6c1c('0xc')](_0x6c1c('0x1a'),_0x1b9d7d,JSON['stringify'](_0x15b6d2));_0x5f4568(_0x15b6d2);})[_0x6c1c('0x12')](function(_0x4e5767){logger[_0x6c1c('0xf')]('CreateVoiceRecording',_0x4e5767[_0x6c1c('0x10')],_0x1b9d7d);_0x2595c3(_0x2feaf4[_0x6c1c('0xf')](0x1f4,_0x4e5767[_0x6c1c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 829fee8..d78eb40 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 _0x4c7b=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x4ccd1b,_0x3cac28){var _0x3da838=function(_0x2fa459){while(--_0x2fa459){_0x4ccd1b['push'](_0x4ccd1b['shift']());}};_0x3da838(++_0x3cac28);}(_0x4c7b,0x1c4));var _0xb4c7=function(_0xcc734a,_0x3b4dbc){_0xcc734a=_0xcc734a-0x0;var _0x59fb95=_0x4c7b[_0xcc734a];return _0x59fb95;};'use strict';var multer=require(_0xb4c7('0x0'));var util=require(_0xb4c7('0x1'));var path=require(_0xb4c7('0x2'));var timeout=require(_0xb4c7('0x3'));var express=require('express');var router=express[_0xb4c7('0x4')]();var fs_extra=require(_0xb4c7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb4c7('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0xb4c7('0x7')]('/',auth[_0xb4c7('0x8')](),controller[_0xb4c7('0x9')]);router['get'](_0xb4c7('0xa'),auth[_0xb4c7('0x8')](),controller[_0xb4c7('0xb')]);router['get'](_0xb4c7('0xc'),auth['isAuthenticated'](),controller[_0xb4c7('0xd')]);router[_0xb4c7('0xe')]('/',auth[_0xb4c7('0x8')](),controller[_0xb4c7('0xf')]);router[_0xb4c7('0x10')](_0xb4c7('0xc'),auth['isAuthenticated'](),controller[_0xb4c7('0x11')]);router[_0xb4c7('0x12')](_0xb4c7('0xc'),auth[_0xb4c7('0x8')](),controller[_0xb4c7('0x13')]);module[_0xb4c7('0x14')]=router; \ No newline at end of file +var _0x3f8c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2ebff5,_0x4c744b){var _0x21241b=function(_0x4d8e6b){while(--_0x4d8e6b){_0x2ebff5['push'](_0x2ebff5['shift']());}};_0x21241b(++_0x4c744b);}(_0x3f8c,0x90));var _0xc3f8=function(_0x1c4675,_0x5b4437){_0x1c4675=_0x1c4675-0x0;var _0x3ea5ea=_0x3f8c[_0x1c4675];return _0x3ea5ea;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3f8('0x0'));var router=express[_0xc3f8('0x1')]();var fs_extra=require(_0xc3f8('0x2'));var auth=require(_0xc3f8('0x3'));var interaction=require(_0xc3f8('0x4'));var config=require(_0xc3f8('0x5'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xc3f8('0x6')](),controller[_0xc3f8('0x7')]);router[_0xc3f8('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc3f8('0x9')]);router['get'](_0xc3f8('0xa'),auth['isAuthenticated'](),controller[_0xc3f8('0xb')]);router[_0xc3f8('0xc')]('/',auth[_0xc3f8('0x6')](),controller[_0xc3f8('0xd')]);router[_0xc3f8('0xe')](_0xc3f8('0xa'),auth[_0xc3f8('0x6')](),controller[_0xc3f8('0xf')]);router[_0xc3f8('0x10')](_0xc3f8('0xa'),auth[_0xc3f8('0x6')](),controller[_0xc3f8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f649c0b..e51ae33 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 _0x8a1a=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x2424e2,_0x5ac144){var _0x38ecf8=function(_0x43d5bf){while(--_0x43d5bf){_0x2424e2['push'](_0x2424e2['shift']());}};_0x38ecf8(++_0x5ac144);}(_0x8a1a,0x115));var _0xa8a1=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0x8a1a[_0x5d61b4];return _0x183fc5;};'use strict';var Sequelize=require(_0xa8a1('0x0'));var moment=require(_0xa8a1('0x1'));module[_0xa8a1('0x2')]={'type':{'type':Sequelize[_0xa8a1('0x3')](_0xa8a1('0x4'),_0xa8a1('0x5'))},'result':{'type':Sequelize[_0xa8a1('0x6')]},'transfererchannel':{'type':Sequelize[_0xa8a1('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xa8a1('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xa8a1('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xa8a1('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xa8a1('0x6')]},'transfereechannel':{'type':Sequelize[_0xa8a1('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xa8a1('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xa8a1('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa8a1('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xa8a1('0x6')]},'transfereecontext':{'type':Sequelize[_0xa8a1('0x6')]},'transfereeexten':{'type':Sequelize[_0xa8a1('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xa8a1('0x6')]},'isexternal':{'type':Sequelize[_0xa8a1('0x3')](_0xa8a1('0x7'),'No')},'context':{'type':Sequelize[_0xa8a1('0x6')]},'extension':{'type':Sequelize[_0xa8a1('0x6')]}}; \ No newline at end of file +var _0x743f=['ENUM','blind','attended','STRING','moment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x743f,0xfa));var _0xf743=function(_0x5674a4,_0x21848d){_0x5674a4=_0x5674a4-0x0;var _0x55f742=_0x743f[_0x5674a4];return _0x55f742;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf743('0x0'));module[_0xf743('0x1')]={'type':{'type':Sequelize[_0xf743('0x2')](_0xf743('0x3'),_0xf743('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf743('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf743('0x5')]},'transfererexten':{'type':Sequelize[_0xf743('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xf743('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xf743('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf743('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xf743('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xf743('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xf743('0x5')]},'isexternal':{'type':Sequelize[_0xf743('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xf743('0x5')]},'extension':{'type':Sequelize[_0xf743('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index dfadff7..aaffa7e 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 _0x6982=['set','apply','reject','save','update','then','error','stack','name','send','index','VoiceTransferReport','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','findAll','rows','catch','show','params','keys','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x441d3a,_0x49bed8){var _0x32a7c3=function(_0x34dcaf){while(--_0x34dcaf){_0x441d3a['push'](_0x441d3a['shift']());}};_0x32a7c3(++_0x49bed8);}(_0x6982,0x1e4));var _0x2698=function(_0x22dea6,_0x4fa222){_0x22dea6=_0x22dea6-0x0;var _0x52bb67=_0x6982[_0x22dea6];return _0x52bb67;};'use strict';var emlformat=require(_0x2698('0x0'));var rimraf=require(_0x2698('0x1'));var zipdir=require(_0x2698('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2698('0x3'));var moment=require(_0x2698('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2698('0x5'));var path=require(_0x2698('0x6'));var sox=require(_0x2698('0x7'));var csv=require(_0x2698('0x8'));var ejs=require(_0x2698('0x9'));var fs=require('fs');var fs_extra=require(_0x2698('0xa'));var _=require(_0x2698('0xb'));var squel=require(_0x2698('0xc'));var crypto=require(_0x2698('0xd'));var jsforce=require(_0x2698('0xe'));var deskjs=require(_0x2698('0xf'));var toCsv=require(_0x2698('0x8'));var querystring=require(_0x2698('0x10'));var Papa=require('papaparse');var Redis=require(_0x2698('0x11'));var authService=require(_0x2698('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2698('0x13'));var hardwareService=require(_0x2698('0x14'));var logger=require('../../config/logger')(_0x2698('0x15'));var utils=require(_0x2698('0x16'));var config=require(_0x2698('0x17'));var licenseUtil=require(_0x2698('0x18'));var db=require(_0x2698('0x19'))['db'];function respondWithStatusCode(_0x329dd8,_0x1dd286){_0x1dd286=_0x1dd286||0xcc;return function(_0x49581a){if(_0x49581a){return _0x329dd8[_0x2698('0x1a')](_0x1dd286);}return _0x329dd8['status'](_0x1dd286)[_0x2698('0x1b')]();};}function respondWithResult(_0x31ddbf,_0x31da3b){_0x31da3b=_0x31da3b||0xc8;return function(_0x501fa7){if(_0x501fa7){return _0x31ddbf[_0x2698('0x1c')](_0x31da3b)[_0x2698('0x1d')](_0x501fa7);}};}function respondWithFilteredResult(_0x45065e,_0x2a921b){return function(_0x451a27){if(_0x451a27){var _0x80c91=typeof _0x2a921b[_0x2698('0x1e')]===_0x2698('0x1f')&&typeof _0x2a921b[_0x2698('0x20')]===_0x2698('0x1f');var _0x345252=_0x451a27['count'];var _0x3c8747=_0x80c91?0x0:_0x2a921b[_0x2698('0x1e')];var _0x2ddc51=_0x80c91?_0x451a27[_0x2698('0x21')]:_0x2a921b[_0x2698('0x1e')]+_0x2a921b['limit'];var _0x3a23f1;if(_0x2ddc51>=_0x345252){_0x2ddc51=_0x345252;_0x3a23f1=0xc8;}else{_0x3a23f1=0xce;}_0x45065e[_0x2698('0x1c')](_0x3a23f1);return _0x45065e[_0x2698('0x22')]('Content-Range',_0x3c8747+'-'+_0x2ddc51+'/'+_0x345252)[_0x2698('0x1d')](_0x451a27);}return null;};}function patchUpdates(_0x55b53b){return function(_0xf877fd){try{jsonpatch[_0x2698('0x23')](_0xf877fd,_0x55b53b,!![]);}catch(_0x5c23da){return BPromise[_0x2698('0x24')](_0x5c23da);}return _0xf877fd[_0x2698('0x25')]();};}function saveUpdates(_0x4ea962,_0x2a4045){return function(_0x32368d){if(_0x32368d){return _0x32368d[_0x2698('0x26')](_0x4ea962)[_0x2698('0x27')](function(_0xf3265c){return _0xf3265c;});}return null;};}function removeEntity(_0x2a804b,_0x5bf245){return function(_0x38062f){if(_0x38062f){return _0x38062f['destroy']()['then'](function(){_0x2a804b[_0x2698('0x1c')](0xcc)[_0x2698('0x1b')]();});}};}function handleEntityNotFound(_0x398baa,_0x18eded){return function(_0x4e2112){if(!_0x4e2112){_0x398baa[_0x2698('0x1a')](0x194);}return _0x4e2112;};}function handleError(_0x20f1c6,_0x15adf5){_0x15adf5=_0x15adf5||0x1f4;return function(_0xd0800f){logger[_0x2698('0x28')](_0xd0800f[_0x2698('0x29')]);if(_0xd0800f['name']){delete _0xd0800f[_0x2698('0x2a')];}_0x20f1c6[_0x2698('0x1c')](_0x15adf5)[_0x2698('0x2b')](_0xd0800f);};}exports[_0x2698('0x2c')]=function(_0x58c8b6,_0x12ccec){var _0xd03b0={},_0x4ee6e5={},_0x29dcbd={'count':0x0,'rows':[]};var _0x3e8157=_['map'](db[_0x2698('0x2d')]['rawAttributes'],function(_0x2dcd90){return{'name':_0x2dcd90['fieldName'],'type':_0x2dcd90[_0x2698('0x2e')][_0x2698('0x2f')]};});_0x4ee6e5[_0x2698('0x30')]=_[_0x2698('0x31')](_0x3e8157,'name');_0x4ee6e5[_0x2698('0x32')]=_['keys'](_0x58c8b6[_0x2698('0x32')]);_0x4ee6e5['filters']=_[_0x2698('0x33')](_0x4ee6e5[_0x2698('0x30')],_0x4ee6e5[_0x2698('0x32')]);_0xd03b0[_0x2698('0x34')]=_[_0x2698('0x33')](_0x4ee6e5['model'],qs['fields'](_0x58c8b6[_0x2698('0x32')][_0x2698('0x35')]));_0xd03b0[_0x2698('0x34')]=_0xd03b0[_0x2698('0x34')][_0x2698('0x36')]?_0xd03b0[_0x2698('0x34')]:_0x4ee6e5[_0x2698('0x30')];if(!_0x58c8b6[_0x2698('0x32')][_0x2698('0x37')]('nolimit')){_0xd03b0[_0x2698('0x20')]=qs['limit'](_0x58c8b6['query'][_0x2698('0x20')]);_0xd03b0['offset']=qs[_0x2698('0x1e')](_0x58c8b6[_0x2698('0x32')]['offset']);}_0xd03b0[_0x2698('0x38')]=qs[_0x2698('0x39')](_0x58c8b6[_0x2698('0x32')][_0x2698('0x39')]);_0xd03b0['where']=qs[_0x2698('0x3a')](_[_0x2698('0x3b')](_0x58c8b6[_0x2698('0x32')],_0x4ee6e5[_0x2698('0x3a')]),_0x3e8157);if(_0x58c8b6[_0x2698('0x32')][_0x2698('0x3c')]){_0xd03b0[_0x2698('0x3d')]=_[_0x2698('0x3e')](_0xd03b0[_0x2698('0x3d')],{'$or':_['map'](_0x3e8157,function(_0xec2ac9){if(_0xec2ac9[_0x2698('0x2e')]!=='VIRTUAL'){var _0xbd0173={};_0xbd0173[_0xec2ac9['name']]={'$like':'%'+_0x58c8b6[_0x2698('0x32')]['filter']+'%'};return _0xbd0173;}})});}_0xd03b0=_[_0x2698('0x3e')]({},_0xd03b0,_0x58c8b6[_0x2698('0x3f')]);var _0x160812={'where':_0xd03b0[_0x2698('0x3d')]};return db[_0x2698('0x2d')][_0x2698('0x21')](_0x160812)[_0x2698('0x27')](function(_0x2e40c6){_0x29dcbd[_0x2698('0x21')]=_0x2e40c6;if(_0x58c8b6[_0x2698('0x32')]['includeAll']){_0xd03b0['include']=[{'all':!![]}];}return db[_0x2698('0x2d')][_0x2698('0x40')](_0xd03b0);})['then'](function(_0xd5dd51){_0x29dcbd[_0x2698('0x41')]=_0xd5dd51;return _0x29dcbd;})['then'](respondWithFilteredResult(_0x12ccec,_0xd03b0))[_0x2698('0x42')](handleError(_0x12ccec,null));};exports[_0x2698('0x43')]=function(_0x3b58f7,_0x25ba15){var _0x5d4c29={'raw':!![],'where':{'id':_0x3b58f7[_0x2698('0x44')]['id']}},_0x59872f={};_0x59872f[_0x2698('0x30')]=_['keys'](db[_0x2698('0x2d')]['rawAttributes']);_0x59872f['query']=_[_0x2698('0x45')](_0x3b58f7[_0x2698('0x32')]);_0x59872f['filters']=_[_0x2698('0x33')](_0x59872f['model'],_0x59872f[_0x2698('0x32')]);_0x5d4c29[_0x2698('0x34')]=_[_0x2698('0x33')](_0x59872f[_0x2698('0x30')],qs[_0x2698('0x35')](_0x3b58f7[_0x2698('0x32')]['fields']));_0x5d4c29[_0x2698('0x34')]=_0x5d4c29['attributes']['length']?_0x5d4c29[_0x2698('0x34')]:_0x59872f[_0x2698('0x30')];if(_0x3b58f7[_0x2698('0x32')]['includeAll']){_0x5d4c29['include']=[{'all':!![]}];}_0x5d4c29=_[_0x2698('0x3e')]({},_0x5d4c29,_0x3b58f7[_0x2698('0x3f')]);return db[_0x2698('0x2d')]['find'](_0x5d4c29)[_0x2698('0x27')](handleEntityNotFound(_0x25ba15,null))[_0x2698('0x27')](respondWithResult(_0x25ba15,null))[_0x2698('0x42')](handleError(_0x25ba15,null));};exports[_0x2698('0x46')]=function(_0x437fce,_0x2d65b0){return db['VoiceTransferReport'][_0x2698('0x46')](_0x437fce[_0x2698('0x47')],{})[_0x2698('0x27')](respondWithResult(_0x2d65b0,0xc9))[_0x2698('0x42')](handleError(_0x2d65b0,null));};exports[_0x2698('0x26')]=function(_0x27d504,_0x11db7e){if(_0x27d504['body']['id']){delete _0x27d504[_0x2698('0x47')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x27d504[_0x2698('0x44')]['id']}})[_0x2698('0x27')](handleEntityNotFound(_0x11db7e,null))[_0x2698('0x27')](saveUpdates(_0x27d504[_0x2698('0x47')],null))[_0x2698('0x27')](respondWithResult(_0x11db7e,null))['catch'](handleError(_0x11db7e,null));};exports[_0x2698('0x48')]=function(_0x1374d0,_0x1e0d3d){return db[_0x2698('0x2d')]['find']({'where':{'id':_0x1374d0['params']['id']}})['then'](handleEntityNotFound(_0x1e0d3d,null))[_0x2698('0x27')](removeEntity(_0x1e0d3d,null))[_0x2698('0x42')](handleError(_0x1e0d3d,null));};exports[_0x2698('0x49')]=function(_0x39fb48,_0x2f4700){return db[_0x2698('0x2d')][_0x2698('0x49')]()[_0x2698('0x27')](respondWithResult(_0x2f4700,null))[_0x2698('0x42')](handleError(_0x2f4700,null));}; \ No newline at end of file +var _0x68ca=['util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','show','length','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x29e8f0,_0x912eb8){var _0x37d0d9=function(_0x12e240){while(--_0x12e240){_0x29e8f0['push'](_0x29e8f0['shift']());}};_0x37d0d9(++_0x912eb8);}(_0x68ca,0x1cc));var _0xa68c=function(_0x1d28c6,_0x3c9cb6){_0x1d28c6=_0x1d28c6-0x0;var _0x465e3a=_0x68ca[_0x1d28c6];return _0x465e3a;};'use strict';var emlformat=require(_0xa68c('0x0'));var rimraf=require(_0xa68c('0x1'));var zipdir=require(_0xa68c('0x2'));var jsonpatch=require(_0xa68c('0x3'));var rp=require(_0xa68c('0x4'));var moment=require(_0xa68c('0x5'));var BPromise=require(_0xa68c('0x6'));var Mustache=require(_0xa68c('0x7'));var util=require(_0xa68c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa68c('0x9'));var ejs=require(_0xa68c('0xa'));var fs=require('fs');var fs_extra=require(_0xa68c('0xb'));var _=require(_0xa68c('0xc'));var squel=require(_0xa68c('0xd'));var crypto=require(_0xa68c('0xe'));var jsforce=require(_0xa68c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa68c('0x10'));var Papa=require(_0xa68c('0x11'));var Redis=require(_0xa68c('0x12'));var authService=require(_0xa68c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa68c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa68c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa68c('0x16'));var licenseUtil=require(_0xa68c('0x17'));var db=require(_0xa68c('0x18'))['db'];function respondWithStatusCode(_0x40fc09,_0x48b644){_0x48b644=_0x48b644||0xcc;return function(_0x29843e){if(_0x29843e){return _0x40fc09['sendStatus'](_0x48b644);}return _0x40fc09['status'](_0x48b644)['end']();};}function respondWithResult(_0x5ba983,_0x614dcc){_0x614dcc=_0x614dcc||0xc8;return function(_0x18f631){if(_0x18f631){return _0x5ba983[_0xa68c('0x19')](_0x614dcc)['json'](_0x18f631);}};}function respondWithFilteredResult(_0x5d8a1c,_0x2656e2){return function(_0x9b5b0d){if(_0x9b5b0d){var _0x23a0af=typeof _0x2656e2[_0xa68c('0x1a')]===_0xa68c('0x1b')&&typeof _0x2656e2[_0xa68c('0x1c')]===_0xa68c('0x1b');var _0x546671=_0x9b5b0d[_0xa68c('0x1d')];var _0x609c0c=_0x23a0af?0x0:_0x2656e2['offset'];var _0x3faf27=_0x23a0af?_0x9b5b0d['count']:_0x2656e2['offset']+_0x2656e2[_0xa68c('0x1c')];var _0x4f2518;if(_0x3faf27>=_0x546671){_0x3faf27=_0x546671;_0x4f2518=0xc8;}else{_0x4f2518=0xce;}_0x5d8a1c[_0xa68c('0x19')](_0x4f2518);return _0x5d8a1c[_0xa68c('0x1e')](_0xa68c('0x1f'),_0x609c0c+'-'+_0x3faf27+'/'+_0x546671)['json'](_0x9b5b0d);}return null;};}function patchUpdates(_0x593071){return function(_0x3dd8fe){try{jsonpatch[_0xa68c('0x20')](_0x3dd8fe,_0x593071,!![]);}catch(_0x8b3582){return BPromise['reject'](_0x8b3582);}return _0x3dd8fe[_0xa68c('0x21')]();};}function saveUpdates(_0x3a61ca,_0x1a9b24){return function(_0x4770d1){if(_0x4770d1){return _0x4770d1[_0xa68c('0x22')](_0x3a61ca)['then'](function(_0x536882){return _0x536882;});}return null;};}function removeEntity(_0x11037a,_0x1e6073){return function(_0x385ed5){if(_0x385ed5){return _0x385ed5[_0xa68c('0x23')]()[_0xa68c('0x24')](function(){_0x11037a[_0xa68c('0x19')](0xcc)[_0xa68c('0x25')]();});}};}function handleEntityNotFound(_0x1b8e78,_0x329f04){return function(_0x33ef98){if(!_0x33ef98){_0x1b8e78[_0xa68c('0x26')](0x194);}return _0x33ef98;};}function handleError(_0x594376,_0x160e7d){_0x160e7d=_0x160e7d||0x1f4;return function(_0x614443){logger[_0xa68c('0x27')](_0x614443[_0xa68c('0x28')]);if(_0x614443[_0xa68c('0x29')]){delete _0x614443[_0xa68c('0x29')];}_0x594376[_0xa68c('0x19')](_0x160e7d)[_0xa68c('0x2a')](_0x614443);};}exports[_0xa68c('0x2b')]=function(_0x4eea9e,_0x4696e5){var _0x3ac127={},_0xbf9c52={},_0x500fc0={'count':0x0,'rows':[]};var _0x402767=_[_0xa68c('0x2c')](db['VoiceTransferReport'][_0xa68c('0x2d')],function(_0x356b45){return{'name':_0x356b45['fieldName'],'type':_0x356b45['type'][_0xa68c('0x2e')]};});_0xbf9c52[_0xa68c('0x2f')]=_[_0xa68c('0x2c')](_0x402767,_0xa68c('0x29'));_0xbf9c52[_0xa68c('0x30')]=_[_0xa68c('0x31')](_0x4eea9e['query']);_0xbf9c52[_0xa68c('0x32')]=_['intersection'](_0xbf9c52[_0xa68c('0x2f')],_0xbf9c52[_0xa68c('0x30')]);_0x3ac127[_0xa68c('0x33')]=_[_0xa68c('0x34')](_0xbf9c52[_0xa68c('0x2f')],qs[_0xa68c('0x35')](_0x4eea9e[_0xa68c('0x30')]['fields']));_0x3ac127['attributes']=_0x3ac127['attributes']['length']?_0x3ac127['attributes']:_0xbf9c52['model'];if(!_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x36')](_0xa68c('0x37'))){_0x3ac127[_0xa68c('0x1c')]=qs[_0xa68c('0x1c')](_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x1c')]);_0x3ac127[_0xa68c('0x1a')]=qs['offset'](_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x1a')]);}_0x3ac127[_0xa68c('0x38')]=qs['sort'](_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x39')]);_0x3ac127[_0xa68c('0x3a')]=qs[_0xa68c('0x32')](_[_0xa68c('0x3b')](_0x4eea9e['query'],_0xbf9c52['filters']),_0x402767);if(_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x3c')]){_0x3ac127['where']=_[_0xa68c('0x3d')](_0x3ac127[_0xa68c('0x3a')],{'$or':_[_0xa68c('0x2c')](_0x402767,function(_0x2ad43d){if(_0x2ad43d[_0xa68c('0x3e')]!==_0xa68c('0x3f')){var _0x1ab0c7={};_0x1ab0c7[_0x2ad43d['name']]={'$like':'%'+_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x3c')]+'%'};return _0x1ab0c7;}})});}_0x3ac127=_[_0xa68c('0x3d')]({},_0x3ac127,_0x4eea9e[_0xa68c('0x40')]);var _0x201c95={'where':_0x3ac127[_0xa68c('0x3a')]};return db[_0xa68c('0x41')][_0xa68c('0x1d')](_0x201c95)[_0xa68c('0x24')](function(_0x44ecf0){_0x500fc0['count']=_0x44ecf0;if(_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x42')]){_0x3ac127[_0xa68c('0x43')]=[{'all':!![]}];}return db[_0xa68c('0x41')][_0xa68c('0x44')](_0x3ac127);})[_0xa68c('0x24')](function(_0x401ca4){_0x500fc0[_0xa68c('0x45')]=_0x401ca4;return _0x500fc0;})[_0xa68c('0x24')](respondWithFilteredResult(_0x4696e5,_0x3ac127))['catch'](handleError(_0x4696e5,null));};exports[_0xa68c('0x46')]=function(_0x2ca1ab,_0xb77521){var _0x4e39cb={'raw':!![],'where':{'id':_0x2ca1ab['params']['id']}},_0x1012f7={};_0x1012f7[_0xa68c('0x2f')]=_[_0xa68c('0x31')](db['VoiceTransferReport']['rawAttributes']);_0x1012f7[_0xa68c('0x30')]=_['keys'](_0x2ca1ab[_0xa68c('0x30')]);_0x1012f7[_0xa68c('0x32')]=_[_0xa68c('0x34')](_0x1012f7[_0xa68c('0x2f')],_0x1012f7[_0xa68c('0x30')]);_0x4e39cb[_0xa68c('0x33')]=_[_0xa68c('0x34')](_0x1012f7[_0xa68c('0x2f')],qs['fields'](_0x2ca1ab[_0xa68c('0x30')][_0xa68c('0x35')]));_0x4e39cb[_0xa68c('0x33')]=_0x4e39cb[_0xa68c('0x33')][_0xa68c('0x47')]?_0x4e39cb[_0xa68c('0x33')]:_0x1012f7['model'];if(_0x2ca1ab[_0xa68c('0x30')][_0xa68c('0x42')]){_0x4e39cb[_0xa68c('0x43')]=[{'all':!![]}];}_0x4e39cb=_['merge']({},_0x4e39cb,_0x2ca1ab['options']);return db[_0xa68c('0x41')]['find'](_0x4e39cb)['then'](handleEntityNotFound(_0xb77521,null))[_0xa68c('0x24')](respondWithResult(_0xb77521,null))[_0xa68c('0x48')](handleError(_0xb77521,null));};exports['create']=function(_0x25215b,_0x1de2dc){return db[_0xa68c('0x41')][_0xa68c('0x49')](_0x25215b[_0xa68c('0x4a')],{})[_0xa68c('0x24')](respondWithResult(_0x1de2dc,0xc9))[_0xa68c('0x48')](handleError(_0x1de2dc,null));};exports[_0xa68c('0x22')]=function(_0x1e7a44,_0x3a5292){if(_0x1e7a44[_0xa68c('0x4a')]['id']){delete _0x1e7a44[_0xa68c('0x4a')]['id'];}return db[_0xa68c('0x41')][_0xa68c('0x4b')]({'where':{'id':_0x1e7a44[_0xa68c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3a5292,null))[_0xa68c('0x24')](saveUpdates(_0x1e7a44[_0xa68c('0x4a')],null))[_0xa68c('0x24')](respondWithResult(_0x3a5292,null))[_0xa68c('0x48')](handleError(_0x3a5292,null));};exports[_0xa68c('0x23')]=function(_0xf1c6f9,_0x4700fa){return db[_0xa68c('0x41')][_0xa68c('0x4b')]({'where':{'id':_0xf1c6f9['params']['id']}})[_0xa68c('0x24')](handleEntityNotFound(_0x4700fa,null))[_0xa68c('0x24')](removeEntity(_0x4700fa,null))[_0xa68c('0x48')](handleError(_0x4700fa,null));};exports[_0xa68c('0x4d')]=function(_0x28fc81,_0x3ea59e){return db['VoiceTransferReport'][_0xa68c('0x4d')]()[_0xa68c('0x24')](respondWithResult(_0x3ea59e,null))[_0xa68c('0x48')](handleError(_0x3ea59e,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d3e6415..28d2f80 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 _0xb41d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb41d,0x94));var _0xdb41=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xb41d[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0xdb41('0x0'));var util=require('util');var logger=require(_0xdb41('0x1'))('api');var moment=require(_0xdb41('0x2'));var BPromise=require(_0xdb41('0x3'));var rp=require(_0xdb41('0x4'));var fs=require('fs');var path=require(_0xdb41('0x5'));var rimraf=require(_0xdb41('0x6'));var config=require(_0xdb41('0x7'));var attributes=require(_0xdb41('0x8'));module[_0xdb41('0x9')]=function(_0x96af9,_0x13d739){return _0x96af9['define']('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6347=['bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x1c05c7,_0x3eeb38){var _0x16e1e7=function(_0x5e790f){while(--_0x5e790f){_0x1c05c7['push'](_0x1c05c7['shift']());}};_0x16e1e7(++_0x3eeb38);}(_0x6347,0xec));var _0x7634=function(_0xd9a7cd,_0x77c637){_0xd9a7cd=_0xd9a7cd-0x0;var _0xf17af7=_0x6347[_0xd9a7cd];return _0xf17af7;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require(_0x7634('0x2'))(_0x7634('0x3'));var moment=require('moment');var BPromise=require(_0x7634('0x4'));var rp=require(_0x7634('0x5'));var fs=require('fs');var path=require(_0x7634('0x6'));var rimraf=require('rimraf');var config=require(_0x7634('0x7'));var attributes=require(_0x7634('0x8'));module[_0x7634('0x9')]=function(_0x213b0d,_0x1dce3c){return _0x213b0d[_0x7634('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x7634('0xb'),'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 2135d55..0955af0 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 _0xe260=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateVoiceTransferReport','create','body','options','raw','then','debug','lodash'];(function(_0x1b2b4c,_0x184037){var _0x80e1f5=function(_0x1a82c5){while(--_0x1a82c5){_0x1b2b4c['push'](_0x1b2b4c['shift']());}};_0x80e1f5(++_0x184037);}(_0xe260,0xe0));var _0x0e26=function(_0x2008b9,_0x221290){_0x2008b9=_0x2008b9-0x0;var _0x604cd3=_0xe260[_0x2008b9];return _0x604cd3;};'use strict';var _=require(_0x0e26('0x0'));var util=require('util');var moment=require(_0x0e26('0x1'));var BPromise=require(_0x0e26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e26('0x3'))['db'];var utils=require(_0x0e26('0x4'));var logger=require(_0x0e26('0x5'))(_0x0e26('0x6'));var config=require(_0x0e26('0x7'));var jayson=require(_0x0e26('0x8'));var client=jayson['client'][_0x0e26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x473423,_0x133f52,_0x5a5f52){return new BPromise(function(_0x18bb2b,_0x411179){return client[_0x0e26('0xa')](_0x473423,_0x5a5f52)['then'](function(_0x133d0b){logger[_0x0e26('0xb')](_0x0e26('0xc'),_0x133f52,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x133f52,_0x0e26('0xd'),JSON[_0x0e26('0xe')](_0x133d0b));if(_0x133d0b[_0x0e26('0xf')]){if(_0x133d0b['error'][_0x0e26('0x10')]===0x1f4){logger['error'](_0x0e26('0xc'),_0x133f52,_0x133d0b[_0x0e26('0xf')][_0x0e26('0x11')]);return _0x411179(_0x133d0b[_0x0e26('0xf')][_0x0e26('0x11')]);}logger[_0x0e26('0xf')](_0x0e26('0xc'),_0x133f52,_0x133d0b[_0x0e26('0xf')]['message']);return _0x18bb2b(_0x133d0b[_0x0e26('0xf')]['message']);}else{logger[_0x0e26('0xb')](_0x0e26('0xc'),_0x133f52,_0x0e26('0xd'));_0x18bb2b(_0x133d0b['result'][_0x0e26('0x11')]);}})['catch'](function(_0x394aca){logger[_0x0e26('0xf')](_0x0e26('0xc'),_0x133f52,_0x394aca);_0x411179(_0x394aca);});});}exports[_0x0e26('0x12')]=function(_0x100e67){var _0x13a5a5=this;return new Promise(function(_0x34aa9e,_0x431fa0){return db['VoiceTransferReport'][_0x0e26('0x13')](_0x100e67[_0x0e26('0x14')],{'raw':_0x100e67[_0x0e26('0x15')]?_0x100e67[_0x0e26('0x15')][_0x0e26('0x16')]===undefined?!![]:![]:!![]})[_0x0e26('0x17')](function(_0x4d04fa){logger[_0x0e26('0xb')]('CreateVoiceTransferReport',_0x100e67);logger[_0x0e26('0x18')]('CreateVoiceTransferReport',_0x100e67,JSON[_0x0e26('0xe')](_0x4d04fa));_0x34aa9e(_0x4d04fa);})['catch'](function(_0x162e57){logger['error'](_0x0e26('0x12'),_0x162e57[_0x0e26('0x11')],_0x100e67);_0x431fa0(_0x13a5a5[_0x0e26('0xf')](0x1f4,_0x162e57['message']));});});}; \ No newline at end of file +var _0xb59e=['then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x414c00,_0x37a5b7){var _0x3a5018=function(_0x16563c){while(--_0x16563c){_0x414c00['push'](_0x414c00['shift']());}};_0x3a5018(++_0x37a5b7);}(_0xb59e,0x1e3));var _0xeb59=function(_0x18341f,_0x4dc568){_0x18341f=_0x18341f-0x0;var _0x49f61b=_0xb59e[_0x18341f];return _0x49f61b;};'use strict';var _=require(_0xeb59('0x0'));var util=require(_0xeb59('0x1'));var moment=require(_0xeb59('0x2'));var BPromise=require(_0xeb59('0x3'));var rs=require(_0xeb59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb59('0x5'))['db'];var utils=require(_0xeb59('0x6'));var logger=require('../../config/logger')(_0xeb59('0x7'));var config=require(_0xeb59('0x8'));var jayson=require(_0xeb59('0x9'));var client=jayson[_0xeb59('0xa')][_0xeb59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x504879,_0x2c1b8c,_0x10949a){return new BPromise(function(_0x338ab8,_0x312078){return client[_0xeb59('0xc')](_0x504879,_0x10949a)[_0xeb59('0xd')](function(_0x5d3a7f){logger['info'](_0xeb59('0xe'),_0x2c1b8c,_0xeb59('0xf'));logger[_0xeb59('0x10')](_0xeb59('0x11'),_0x2c1b8c,_0xeb59('0xf'),JSON[_0xeb59('0x12')](_0x5d3a7f));if(_0x5d3a7f[_0xeb59('0x13')]){if(_0x5d3a7f[_0xeb59('0x13')][_0xeb59('0x14')]===0x1f4){logger['error'](_0xeb59('0xe'),_0x2c1b8c,_0x5d3a7f[_0xeb59('0x13')][_0xeb59('0x15')]);return _0x312078(_0x5d3a7f['error']['message']);}logger[_0xeb59('0x13')](_0xeb59('0xe'),_0x2c1b8c,_0x5d3a7f[_0xeb59('0x13')][_0xeb59('0x15')]);return _0x338ab8(_0x5d3a7f[_0xeb59('0x13')][_0xeb59('0x15')]);}else{logger[_0xeb59('0x16')]('VoiceTransferReport,\x20%s,\x20%s',_0x2c1b8c,_0xeb59('0xf'));_0x338ab8(_0x5d3a7f[_0xeb59('0x17')]['message']);}})[_0xeb59('0x18')](function(_0x49ee2f){logger[_0xeb59('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x2c1b8c,_0x49ee2f);_0x312078(_0x49ee2f);});});}exports['CreateVoiceTransferReport']=function(_0x4bafd7){var _0x105a73=this;return new Promise(function(_0x14b162,_0x5d6526){return db[_0xeb59('0x19')][_0xeb59('0x1a')](_0x4bafd7[_0xeb59('0x1b')],{'raw':_0x4bafd7[_0xeb59('0x1c')]?_0x4bafd7[_0xeb59('0x1c')][_0xeb59('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xf12b72){logger[_0xeb59('0x16')](_0xeb59('0x1e'),_0x4bafd7);logger['debug'](_0xeb59('0x1e'),_0x4bafd7,JSON['stringify'](_0xf12b72));_0x14b162(_0xf12b72);})[_0xeb59('0x18')](function(_0x34575d){logger[_0xeb59('0x13')]('CreateVoiceTransferReport',_0x34575d['message'],_0x4bafd7);_0x5d6526(_0x105a73[_0xeb59('0x13')](0x1f4,_0x34575d[_0xeb59('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d36a00d..7248b06 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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x48b685,_0x4e9e19){_0x48b685=_0x48b685-0x0;var _0x5a6733=_0xb43b[_0x48b685];return _0x5a6733;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x70e0,0x17b));var _0x070e=function(_0x4a8718,_0x50de2c){_0x4a8718=_0x4a8718-0x0;var _0x4a0c6d=_0x70e0[_0x4a8718];return _0x4a0c6d;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);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 9febd8b..b15e094 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 _0x984b=['transfer\x20executed!','../../config/environment','util','bluebird','http','../../config/logger','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x984b,0xee));var _0xb984=function(_0x210d2b,_0x5c1b78){_0x210d2b=_0x210d2b-0x0;var _0x1a9af2=_0x984b[_0x210d2b];return _0x1a9af2;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xb984('0x0'));var util=require(_0xb984('0x1'));var BPromise=require(_0xb984('0x2'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xb984('0x3')]({'port':0x232a});var logger=require(_0xb984('0x4'))('webbarapi');var Redis=require('ioredis');config[_0xb984('0x5')]=_[_0xb984('0x6')](config['redis'],{'host':_0xb984('0x7'),'port':0x18eb});var io=require(_0xb984('0x8'))(new Redis(config['redis']));var Schema=require(_0xb984('0x9'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'callNumber':{'type':_0xb984('0xb'),'required':[!![],_0xb984('0xc')]},'callerId':{'type':_0xb984('0xb')},'callbackUrl':{'type':_0xb984('0xb')}});var hangupValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb984('0xb'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xb984('0xb'),'required':[!![],_0xb984('0xe')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x6fae41,_0x5cd1aa,_0x3b8241){logger[_0xb984('0xf')](_0x6fae41,_0x5cd1aa,JSON[_0xb984('0x10')](_0x3b8241));io['to'](_0x6fae41)[_0xb984('0x11')](_0x5cd1aa,_0x3b8241);}function handleError(_0x59dcb7){return function(_0x396c36){console[_0xb984('0x12')](_0xb984('0x13'),_0x396c36,_0x396c36 instanceof RangeError);logger[_0xb984('0x14')](_0x396c36[_0xb984('0x15')]);if(_0x396c36 instanceof RangeError){if(_0x396c36[_0xb984('0x16')]){delete _0x396c36['name'];}_0x59dcb7[_0xb984('0x17')](0x194)[_0xb984('0x18')](_0x396c36);}else{if(_0x396c36[_0xb984('0x16')]){delete _0x396c36[_0xb984('0x16')];}_0x59dcb7[_0xb984('0x17')](0x1f4)[_0xb984('0x18')](_0x396c36);}};}function checkError(){return function(_0x54dd81){if(!_0x54dd81){throw new RangeError(_0xb984('0x19'));}return _0x54dd81;};}function respondWithRpcPromise(_0xc16561,_0x551ad4){return new BPromise(function(_0x44b570,_0x97af5c){var _0x14734a=amiClient;return _0x14734a[_0xb984('0x1a')](_0xc16561,_0x551ad4)[_0xb984('0x1b')](function(_0x286033){if(_0x286033[_0xb984('0x14')]){if(_0x286033['error'][_0xb984('0x1c')]===0x1f4){return _0x97af5c(_0x286033[_0xb984('0x14')][_0xb984('0x1d')]);}return _0x44b570(_0x286033['error'][_0xb984('0x1d')]);}else{_0x44b570(_0x286033[_0xb984('0x1e')]);}})[_0xb984('0x1f')](function(_0x2d0450){_0x97af5c(_0x2d0450);});});}function getAgent(_0x1f7b62){return db[_0xb984('0x20')][_0xb984('0x21')]({'where':{'id':_0x1f7b62,'role':_0xb984('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x249d47,_0x469af6){return new BPromise(function(_0x3e254b,_0x2bd0f2){var _0x4fb896=respondWithRpcPromise(_0xb984('0x23'));var _0x67e4d3=getAgent(_0x249d47);Promise[_0xb984('0x24')]([_0x4fb896,_0x67e4d3])['then'](function(_0x363e33){var _0x311e22=_0x363e33[0x0];var _0x2012ca=_0x363e33[0x1];var _0x3d2757=_['filter'](_0x311e22['rows'],function(_0x4dcf73){return _0x4dcf73[_0xb984('0x25')]==_0x2012ca['id']&&_0x4dcf73[_0xb984('0x26')]==_0x469af6;});if(_0x3d2757['length']==0x1){_0x3e254b(_0x2012ca);}else{_0x2bd0f2(new RangeError(_0xb984('0x27')+_0x469af6+_0xb984('0x28')));}});});}exports[_0xb984('0x29')]=function(_0x2c5a99,_0x518bef){logger['info'](_0xb984('0x2a'),_0x2c5a99[_0xb984('0x2b')]);var _0x2c0562=originateValidation[_0xb984('0x9')](_0x2c5a99['body']);if(_0x2c0562[_0xb984('0x2c')]>0x0){return _0x518bef[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x2c0562);}var _0x3c4687=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x2e')];var _0x5f4426=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x2f')];var _0x523784=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x30')];var _0x30891c=_0x2c5a99['body'][_0xb984('0x31')];return getAgent(_0x3c4687)[_0xb984('0x1b')](function(_0x4edaf1){logger['info'](_0xb984('0x32'),_0x4edaf1['name']);emit(util[_0xb984('0x33')](_0xb984('0x34'),_0x4edaf1['name']),_0xb984('0x35'),{'callNumber':_0x5f4426,'callerId':_0x523784,'callbackUrl':_0x30891c});return _0x518bef['status'](0xc8)[_0xb984('0x2d')]({'error':![],'message':'originate\x20executed!'});})[_0xb984('0x1f')](handleError(_0x518bef));};exports['hangup']=function(_0x52f872,_0xf6d925){logger[_0xb984('0xf')]('hangup\x20fired:',_0x52f872[_0xb984('0x2b')]);var _0x1fd248=hangupValidation['validate'](_0x52f872[_0xb984('0x2b')]);if(_0x1fd248[_0xb984('0x2c')]>0x0){return _0xf6d925[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x1fd248);}var _0x4837d5=_0x52f872[_0xb984('0x2b')][_0xb984('0x2e')];var _0x383c87=_0x52f872[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x4837d5)[_0xb984('0x1b')](function(_0xc257ee){logger[_0xb984('0xf')](_0xb984('0x32'),_0xc257ee[_0xb984('0x16')]);emit(util['format'](_0xb984('0x34'),_0xc257ee[_0xb984('0x16')]),_0xb984('0x36'),{'sessionId':_0x383c87});return _0xf6d925[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x37')});})[_0xb984('0x1f')](handleError(_0xf6d925));};exports[_0xb984('0x38')]=function(_0x52181e,_0x5d4be9){logger[_0xb984('0xf')]('answer\x20fired:',_0x52181e[_0xb984('0x2b')]);var _0x2326c6=answerValidation[_0xb984('0x9')](_0x52181e[_0xb984('0x2b')]);if(_0x2326c6['length']>0x0){return _0x5d4be9[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x2326c6);}var _0x5d5e85=_0x52181e[_0xb984('0x2b')][_0xb984('0x2e')];var _0x38a025=_0x52181e[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x5d5e85)[_0xb984('0x1b')](function(_0x2f2f02){logger['info'](_0xb984('0x32'),_0x2f2f02[_0xb984('0x16')]);emit(util['format']('user:%s',_0x2f2f02[_0xb984('0x16')]),_0xb984('0x39'),{'sessionId':_0x38a025});return _0x5d4be9[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x3a')});})['catch'](handleError(_0x5d4be9));};exports[_0xb984('0x3b')]=function(_0x40666f,_0x424f65){logger[_0xb984('0xf')](_0xb984('0x3c'),_0x40666f[_0xb984('0x2b')]);var _0x2097e6=holdValidation[_0xb984('0x9')](_0x40666f[_0xb984('0x2b')]);if(_0x2097e6[_0xb984('0x2c')]>0x0){return _0x424f65['status'](0x190)[_0xb984('0x2d')](_0x2097e6);}var _0x71880c=_0x40666f['body'][_0xb984('0x2e')];var _0x436597=_0x40666f[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x71880c)[_0xb984('0x1b')](function(_0x49dde7){logger[_0xb984('0xf')](_0xb984('0x32'),_0x49dde7[_0xb984('0x16')]);emit(util[_0xb984('0x33')]('user:%s',_0x49dde7[_0xb984('0x16')]),_0xb984('0x3d'),{'sessionId':_0x436597});return _0x424f65[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x3e')});})[_0xb984('0x1f')](handleError(_0x424f65));};exports[_0xb984('0x3f')]=function(_0x445f90,_0xc6389d){logger['info'](_0xb984('0x40'),_0x445f90[_0xb984('0x2b')]);var _0x3a7cbb=unholdValidation['validate'](_0x445f90[_0xb984('0x2b')]);if(_0x3a7cbb[_0xb984('0x2c')]>0x0){return _0xc6389d['status'](0x190)[_0xb984('0x2d')](_0x3a7cbb);}var _0x481eac=_0x445f90[_0xb984('0x2b')][_0xb984('0x2e')];var _0x5a1a34=_0x445f90[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x481eac)[_0xb984('0x1b')](function(_0x3ddeb5){logger[_0xb984('0xf')](_0xb984('0x32'),_0x3ddeb5['name']);emit(util[_0xb984('0x33')]('user:%s',_0x3ddeb5[_0xb984('0x16')]),_0xb984('0x41'),{'sessionId':_0x5a1a34});return _0xc6389d[_0xb984('0x17')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0xb984('0x1f')](handleError(_0xc6389d));};exports[_0xb984('0x42')]=function(_0x56ad15,_0x493a8b){logger[_0xb984('0xf')](_0xb984('0x43'),_0x493a8b[_0xb984('0x2b')]);var _0x3daaa0=callsValidation[_0xb984('0x9')](_0x56ad15[_0xb984('0x2b')]);if(_0x3daaa0['length']>0x0){return _0x493a8b['status'](0x190)[_0xb984('0x2d')](_0x3daaa0);}var _0x22ddf=_0x56ad15['body'][_0xb984('0x2e')];var _0x159835=respondWithRpcPromise(_0xb984('0x23'));var _0x317cd8=getAgent(_0x22ddf);return Promise['all']([_0x159835,_0x317cd8])['then'](function(_0x226db2){var _0x36a9eb=_0x226db2[0x0];var _0x2fc1f7=_0x226db2[0x1];var _0x29c79d=_[_0xb984('0x44')](_0x36a9eb[_0xb984('0x45')],function(_0x49ecfd){return _0x49ecfd[_0xb984('0x25')]==_0x2fc1f7['id'];});return _0x493a8b[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'count':_0x29c79d[_0xb984('0x2c')],'rows':_0x29c79d});})[_0xb984('0x1f')](handleError(_0x493a8b));};exports[_0xb984('0x46')]=function(_0x575503,_0x55852d){logger['info'](_0xb984('0x47'),_0x575503[_0xb984('0x2b')]);var _0x36ca94=conferenceValidation[_0xb984('0x9')](_0x575503[_0xb984('0x2b')]);if(_0x36ca94['length']>0x0){return _0x55852d[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x36ca94);}var _0x356442=_0x575503['body'][_0xb984('0x2e')];return getAgent(_0x356442)[_0xb984('0x1b')](function(_0x529e28){logger['info'](_0xb984('0x32'),_0x529e28['name']);emit(util['format'](_0xb984('0x34'),_0x529e28['name']),_0xb984('0x48'));return _0x55852d[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x49')});})[_0xb984('0x1f')](handleError(_0x55852d));};exports[_0xb984('0x4a')]=function(_0x145052,_0x1a81c3){logger[_0xb984('0xf')](_0xb984('0x4b'),_0x145052[_0xb984('0x2b')]);var _0x1d9213=transferValidation['validate'](_0x145052[_0xb984('0x2b')]);if(_0x1d9213[_0xb984('0x2c')]>0x0){return _0x1a81c3[_0xb984('0x17')](0x190)['json'](_0x1d9213);}var _0x54abb4=_0x145052[_0xb984('0x2b')][_0xb984('0x2e')];var _0x74fc95=_0x145052['body'][_0xb984('0x26')];var _0x35132b=_0x145052[_0xb984('0x2b')][_0xb984('0x4c')];return getAgent(_0x54abb4)[_0xb984('0x1b')](function(_0x1793e2){logger[_0xb984('0xf')](_0xb984('0x32'),_0x1793e2[_0xb984('0x16')]);emit(util[_0xb984('0x33')](_0xb984('0x34'),_0x1793e2[_0xb984('0x16')]),_0xb984('0x4d'),{'sessionId':_0x74fc95,'transferNumber':_0x35132b});return _0x1a81c3[_0xb984('0x17')](0xc8)['json']({'error':![],'message':_0xb984('0x4e')});})['catch'](handleError(_0x1a81c3));}; \ No newline at end of file +var _0xe5b3=['string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','socket.io-emitter','validate','number','callNumber\x20is\x20required'];(function(_0x4160c2,_0x517b9b){var _0x473c62=function(_0x46f5fd){while(--_0x46f5fd){_0x4160c2['push'](_0x4160c2['shift']());}};_0x473c62(++_0x517b9b);}(_0xe5b3,0x133));var _0x3e5b=function(_0xfbcec7,_0x24d860){_0xfbcec7=_0xfbcec7-0x0;var _0x1d8626=_0xe5b3[_0xfbcec7];return _0x1d8626;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3e5b('0x0'));var db=require(_0x3e5b('0x1'))['db'];var config=require(_0x3e5b('0x2'));var util=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var jayson=require(_0x3e5b('0x5'));var amiClient=jayson[_0x3e5b('0x6')][_0x3e5b('0x7')]({'port':0x232a});var logger=require(_0x3e5b('0x8'))(_0x3e5b('0x9'));var Redis=require(_0x3e5b('0xa'));config['redis']=_[_0x3e5b('0xb')](config[_0x3e5b('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x3e5b('0xd'))(new Redis(config[_0x3e5b('0xc')]));var Schema=require(_0x3e5b('0xe'));var originateValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x3e5b('0x10')]},'callerId':{'type':_0x3e5b('0x11')},'callbackUrl':{'type':_0x3e5b('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x13')]},'transferNumber':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]}});function emit(_0x59ddc0,_0x56a453,_0x258d6a){logger[_0x3e5b('0x15')](_0x59ddc0,_0x56a453,JSON['stringify'](_0x258d6a));io['to'](_0x59ddc0)[_0x3e5b('0x16')](_0x56a453,_0x258d6a);}function handleError(_0x143040){return function(_0x555002){console[_0x3e5b('0x17')](_0x3e5b('0x18'),_0x555002,_0x555002 instanceof RangeError);logger['error'](_0x555002['stack']);if(_0x555002 instanceof RangeError){if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x194)[_0x3e5b('0x1b')](_0x555002);}else{if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x1f4)[_0x3e5b('0x1b')](_0x555002);}};}function checkError(){return function(_0x36c988){if(!_0x36c988){throw new RangeError(_0x3e5b('0x1c'));}return _0x36c988;};}function respondWithRpcPromise(_0x2b977c,_0x11e5cf){return new BPromise(function(_0x2d77cc,_0x402873){var _0x5b46d4=amiClient;return _0x5b46d4[_0x3e5b('0x1d')](_0x2b977c,_0x11e5cf)[_0x3e5b('0x1e')](function(_0x2146d4){if(_0x2146d4[_0x3e5b('0x1f')]){if(_0x2146d4['error'][_0x3e5b('0x20')]===0x1f4){return _0x402873(_0x2146d4['error'][_0x3e5b('0x21')]);}return _0x2d77cc(_0x2146d4[_0x3e5b('0x1f')]['message']);}else{_0x2d77cc(_0x2146d4[_0x3e5b('0x22')]);}})[_0x3e5b('0x23')](function(_0x42d7e9){_0x402873(_0x42d7e9);});});}function getAgent(_0x3c8965){return db[_0x3e5b('0x24')][_0x3e5b('0x25')]({'where':{'id':_0x3c8965,'role':_0x3e5b('0x26')}})[_0x3e5b('0x1e')](checkError());}function getAgentCheckSession(_0x4c4b89,_0x1c7278){return new BPromise(function(_0x505f40,_0xb70ab4){var _0x4fd64b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x1f6473=getAgent(_0x4c4b89);Promise[_0x3e5b('0x28')]([_0x4fd64b,_0x1f6473])[_0x3e5b('0x1e')](function(_0x10d2ed){var _0x3cfaf6=_0x10d2ed[0x0];var _0x307091=_0x10d2ed[0x1];var _0x9c2123=_[_0x3e5b('0x29')](_0x3cfaf6[_0x3e5b('0x2a')],function(_0x1e1565){return _0x1e1565['UserId']==_0x307091['id']&&_0x1e1565[_0x3e5b('0x2b')]==_0x1c7278;});if(_0x9c2123[_0x3e5b('0x2c')]==0x1){_0x505f40(_0x307091);}else{_0xb70ab4(new RangeError(_0x3e5b('0x2d')+_0x1c7278+_0x3e5b('0x2e')));}});});}exports[_0x3e5b('0x2f')]=function(_0x31e9f9,_0x345927){logger['info'](_0x3e5b('0x30'),_0x31e9f9['body']);var _0x5b9ba3=originateValidation[_0x3e5b('0xe')](_0x31e9f9[_0x3e5b('0x31')]);if(_0x5b9ba3['length']>0x0){return _0x345927[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x5b9ba3);}var _0x9d01c4=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x26f842=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x34')];var _0x2450c0=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x35')];var _0x1506f5=_0x31e9f9['body'][_0x3e5b('0x36')];return getAgent(_0x9d01c4)[_0x3e5b('0x1e')](function(_0x53caa2){logger['info'](_0x3e5b('0x37'),_0x53caa2['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x53caa2[_0x3e5b('0x19')]),_0x3e5b('0x3a'),{'callNumber':_0x26f842,'callerId':_0x2450c0,'callbackUrl':_0x1506f5});return _0x345927['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':'originate\x20executed!'});})[_0x3e5b('0x23')](handleError(_0x345927));};exports['hangup']=function(_0x47f7c8,_0x48f414){logger[_0x3e5b('0x15')](_0x3e5b('0x3b'),_0x47f7c8[_0x3e5b('0x31')]);var _0x35cfcd=hangupValidation[_0x3e5b('0xe')](_0x47f7c8[_0x3e5b('0x31')]);if(_0x35cfcd['length']>0x0){return _0x48f414['status'](0x190)['json'](_0x35cfcd);}var _0x565319=_0x47f7c8['body']['userId'];var _0x5aad1d=_0x47f7c8[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x565319)[_0x3e5b('0x1e')](function(_0x1aafd5){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x1aafd5[_0x3e5b('0x19')]);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x1aafd5[_0x3e5b('0x19')]),_0x3e5b('0x3c'),{'sessionId':_0x5aad1d});return _0x48f414['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x3d')});})[_0x3e5b('0x23')](handleError(_0x48f414));};exports[_0x3e5b('0x3e')]=function(_0xa262e0,_0xc69499){logger[_0x3e5b('0x15')](_0x3e5b('0x3f'),_0xa262e0[_0x3e5b('0x31')]);var _0x39da3f=answerValidation[_0x3e5b('0xe')](_0xa262e0['body']);if(_0x39da3f['length']>0x0){return _0xc69499['status'](0x190)['json'](_0x39da3f);}var _0xa99d75=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x24c416=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0xa99d75)[_0x3e5b('0x1e')](function(_0x158518){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x158518['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x158518[_0x3e5b('0x19')]),_0x3e5b('0x40'),{'sessionId':_0x24c416});return _0xc69499[_0x3e5b('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0xc69499));};exports[_0x3e5b('0x41')]=function(_0x20af6a,_0x3b2319){logger['info']('hold\x20fired:',_0x20af6a[_0x3e5b('0x31')]);var _0x313c51=holdValidation[_0x3e5b('0xe')](_0x20af6a['body']);if(_0x313c51['length']>0x0){return _0x3b2319[_0x3e5b('0x1a')](0x190)['json'](_0x313c51);}var _0x14b62a=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x36abab=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x14b62a)[_0x3e5b('0x1e')](function(_0x3ea5aa){logger[_0x3e5b('0x15')]('entityFound:',_0x3ea5aa[_0x3e5b('0x19')]);emit(util['format'](_0x3e5b('0x39'),_0x3ea5aa[_0x3e5b('0x19')]),_0x3e5b('0x42'),{'sessionId':_0x36abab});return _0x3b2319[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x43')});})[_0x3e5b('0x23')](handleError(_0x3b2319));};exports[_0x3e5b('0x44')]=function(_0x2b5d3d,_0x371655){logger[_0x3e5b('0x15')](_0x3e5b('0x45'),_0x2b5d3d[_0x3e5b('0x31')]);var _0x59d311=unholdValidation[_0x3e5b('0xe')](_0x2b5d3d[_0x3e5b('0x31')]);if(_0x59d311[_0x3e5b('0x2c')]>0x0){return _0x371655[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x59d311);}var _0x2cecd3=_0x2b5d3d['body'][_0x3e5b('0x33')];var _0x1cbdf7=_0x2b5d3d[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x2cecd3)[_0x3e5b('0x1e')](function(_0x449d0f){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x449d0f['name']);emit(util[_0x3e5b('0x38')]('user:%s',_0x449d0f['name']),_0x3e5b('0x46'),{'sessionId':_0x1cbdf7});return _0x371655['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x47')});})[_0x3e5b('0x23')](handleError(_0x371655));};exports[_0x3e5b('0x48')]=function(_0x4a492b,_0x5ddeee){logger['info']('calls\x20fired:',_0x5ddeee[_0x3e5b('0x31')]);var _0x999518=callsValidation[_0x3e5b('0xe')](_0x4a492b[_0x3e5b('0x31')]);if(_0x999518[_0x3e5b('0x2c')]>0x0){return _0x5ddeee['status'](0x190)['json'](_0x999518);}var _0xa0a18d=_0x4a492b[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x325f7b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x51efbd=getAgent(_0xa0a18d);return Promise['all']([_0x325f7b,_0x51efbd])['then'](function(_0x4eaa6e){var _0x3563b0=_0x4eaa6e[0x0];var _0x3e3115=_0x4eaa6e[0x1];var _0x3088d4=_[_0x3e5b('0x29')](_0x3563b0[_0x3e5b('0x2a')],function(_0x24087b){return _0x24087b[_0x3e5b('0x49')]==_0x3e3115['id'];});return _0x5ddeee[_0x3e5b('0x1a')](0xc8)['json']({'count':_0x3088d4[_0x3e5b('0x2c')],'rows':_0x3088d4});})[_0x3e5b('0x23')](handleError(_0x5ddeee));};exports[_0x3e5b('0x4a')]=function(_0x3e784a,_0x2d2c1e){logger['info'](_0x3e5b('0x4b'),_0x3e784a['body']);var _0x45ca16=conferenceValidation[_0x3e5b('0xe')](_0x3e784a['body']);if(_0x45ca16['length']>0x0){return _0x2d2c1e['status'](0x190)[_0x3e5b('0x32')](_0x45ca16);}var _0x50f5b4=_0x3e784a[_0x3e5b('0x31')][_0x3e5b('0x33')];return getAgent(_0x50f5b4)[_0x3e5b('0x1e')](function(_0x40197c){logger[_0x3e5b('0x15')]('entityFound:',_0x40197c['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x40197c[_0x3e5b('0x19')]),'webbar:conference');return _0x2d2c1e[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x4c')});})[_0x3e5b('0x23')](handleError(_0x2d2c1e));};exports[_0x3e5b('0x4d')]=function(_0x198316,_0x455594){logger[_0x3e5b('0x15')](_0x3e5b('0x4e'),_0x198316[_0x3e5b('0x31')]);var _0x4eb336=transferValidation[_0x3e5b('0xe')](_0x198316[_0x3e5b('0x31')]);if(_0x4eb336[_0x3e5b('0x2c')]>0x0){return _0x455594[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x4eb336);}var _0x39f1f2=_0x198316[_0x3e5b('0x31')]['userId'];var _0xe5d4c5=_0x198316[_0x3e5b('0x31')]['sessionId'];var _0x177144=_0x198316[_0x3e5b('0x31')]['transferNumber'];return getAgent(_0x39f1f2)['then'](function(_0x4f67d1){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x4f67d1['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x4f67d1['name']),_0x3e5b('0x4f'),{'sessionId':_0xe5d4c5,'transferNumber':_0x177144});return _0x455594[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x50')});})[_0x3e5b('0x23')](handleError(_0x455594));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index bb9e797..ca6857e 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 _0xc867=['removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create','addAnswer','addAgents','/:id/notify','notify','/:id/send','send','put','/:id','delete','destroy','removeDispositions'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc867,0xbb));var _0x7c86=function(_0x1dae2a,_0x11ed5e){_0x1dae2a=_0x1dae2a-0x0;var _0x38f211=_0xc867[_0x1dae2a];return _0x38f211;};'use strict';var multer=require(_0x7c86('0x0'));var util=require('util');var path=require(_0x7c86('0x1'));var timeout=require(_0x7c86('0x2'));var express=require(_0x7c86('0x3'));var router=express[_0x7c86('0x4')]();var fs_extra=require(_0x7c86('0x5'));var auth=require(_0x7c86('0x6'));var interaction=require(_0x7c86('0x7'));var config=require(_0x7c86('0x8'));var controller=require(_0x7c86('0x9'));router[_0x7c86('0xa')]('/',auth[_0x7c86('0xb')](),controller[_0x7c86('0xc')]);router[_0x7c86('0xa')]('/describe',auth[_0x7c86('0xb')](),controller[_0x7c86('0xd')]);router[_0x7c86('0xa')]('/:id',auth[_0x7c86('0xb')](),controller[_0x7c86('0xe')]);router[_0x7c86('0xa')](_0x7c86('0xf'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x10')]);router[_0x7c86('0xa')](_0x7c86('0x11'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x12')]);router[_0x7c86('0xa')](_0x7c86('0x13'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x14')]);router[_0x7c86('0xa')]('/:id/applications',auth[_0x7c86('0xb')](),controller[_0x7c86('0x15')]);router[_0x7c86('0x16')]('/',auth[_0x7c86('0xb')](),controller[_0x7c86('0x17')]);router[_0x7c86('0x16')](_0x7c86('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7c86('0x18')]);router[_0x7c86('0x16')](_0x7c86('0x13'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x19')]);router[_0x7c86('0x16')]('/:id/applications',auth[_0x7c86('0xb')](),controller['addApplications']);router[_0x7c86('0x16')](_0x7c86('0x1a'),controller[_0x7c86('0x1b')]);router[_0x7c86('0x16')](_0x7c86('0x1c'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x1d')]);router[_0x7c86('0x1e')](_0x7c86('0x1f'),auth[_0x7c86('0xb')](),controller['update']);router[_0x7c86('0x20')](_0x7c86('0x1f'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x21')]);router[_0x7c86('0x20')](_0x7c86('0xf'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x22')]);router[_0x7c86('0x20')](_0x7c86('0x11'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x23')]);router['delete'](_0x7c86('0x13'),auth[_0x7c86('0xb')](),controller[_0x7c86('0x24')]);module['exports']=router; \ No newline at end of file +var _0x720e=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','/:id/users','addAgents','addApplications','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','util','path'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x720e,0x18a));var _0xe720=function(_0x21cf80,_0x1fb0a1){_0x21cf80=_0x21cf80-0x0;var _0x5c6bed=_0x720e[_0x21cf80];return _0x5c6bed;};'use strict';var multer=require('multer');var util=require(_0xe720('0x0'));var path=require(_0xe720('0x1'));var timeout=require(_0xe720('0x2'));var express=require(_0xe720('0x3'));var router=express[_0xe720('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe720('0x5'));var config=require(_0xe720('0x6'));var controller=require(_0xe720('0x7'));router[_0xe720('0x8')]('/',auth[_0xe720('0x9')](),controller[_0xe720('0xa')]);router['get']('/describe',auth[_0xe720('0x9')](),controller[_0xe720('0xb')]);router[_0xe720('0x8')](_0xe720('0xc'),auth[_0xe720('0x9')](),controller['show']);router[_0xe720('0x8')](_0xe720('0xd'),auth['isAuthenticated'](),controller[_0xe720('0xe')]);router[_0xe720('0x8')]('/:id/canned_answers',auth[_0xe720('0x9')](),controller['getAnswers']);router[_0xe720('0x8')]('/:id/users',auth[_0xe720('0x9')](),controller[_0xe720('0xf')]);router[_0xe720('0x8')](_0xe720('0x10'),auth[_0xe720('0x9')](),controller['getApplications']);router[_0xe720('0x11')]('/',auth['isAuthenticated'](),controller[_0xe720('0x12')]);router[_0xe720('0x11')]('/:id/dispositions',auth[_0xe720('0x9')](),controller[_0xe720('0x13')]);router[_0xe720('0x11')](_0xe720('0x14'),auth[_0xe720('0x9')](),controller['addAnswer']);router[_0xe720('0x11')](_0xe720('0x15'),auth[_0xe720('0x9')](),controller[_0xe720('0x16')]);router[_0xe720('0x11')](_0xe720('0x10'),auth[_0xe720('0x9')](),controller[_0xe720('0x17')]);router[_0xe720('0x11')]('/:id/notify',controller['notify']);router['post'](_0xe720('0x18'),auth['isAuthenticated'](),controller[_0xe720('0x19')]);router[_0xe720('0x1a')](_0xe720('0xc'),auth['isAuthenticated'](),controller[_0xe720('0x1b')]);router['delete'](_0xe720('0xc'),auth[_0xe720('0x9')](),controller[_0xe720('0x1c')]);router[_0xe720('0x1d')](_0xe720('0xd'),auth[_0xe720('0x9')](),controller[_0xe720('0x1e')]);router['delete'](_0xe720('0x14'),auth['isAuthenticated'](),controller[_0xe720('0x1f')]);router[_0xe720('0x1d')]('/:id/users',auth[_0xe720('0x9')](),controller[_0xe720('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 9f8fa79..0335c2f 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 _0xe6ea=['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','name','STRING','generate','ENUM','sinch','TEXT'];(function(_0x5ae591,_0x105872){var _0x3b37ae=function(_0x64a531){while(--_0x64a531){_0x5ae591['push'](_0x5ae591['shift']());}};_0x3b37ae(++_0x105872);}(_0xe6ea,0xb2));var _0xae6e=function(_0x54ac77,_0x4dbac8){_0x54ac77=_0x54ac77-0x0;var _0x4ec57e=_0xe6ea[_0x54ac77];return _0x4ec57e;};'use strict';var Sequelize=require(_0xae6e('0x0'));var rs=require(_0xae6e('0x1'));module[_0xae6e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xae6e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xae6e('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xae6e('0x5')]();}},'phone':{'type':Sequelize[_0xae6e('0x4')]},'type':{'type':Sequelize[_0xae6e('0x6')]('twilio',_0xae6e('0x7'))},'accountSid':{'type':Sequelize[_0xae6e('0x4')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xae6e('0x8')],'defaultValue':function(){return _0xae6e('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xae6e('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xae6e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xae6e('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae6e('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae6e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae6e('0xb')],'comment':_0xae6e('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xae6e('0xa')],'defaultValue':![],'comment':_0xae6e('0xd'),'set':function(_0x211ae8){if(!_0x211ae8){this[_0xae6e('0xe')](_0xae6e('0xf'),null);}this[_0xae6e('0xe')](_0xae6e('0x10'),_0x211ae8);}},'description':{'type':Sequelize[_0xae6e('0x4')]}}; \ No newline at end of file +var _0x0f36=['generate','ENUM','twilio','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x22f9c0,_0x35410c){var _0x1883fe=function(_0x5a5601){while(--_0x5a5601){_0x22f9c0['push'](_0x22f9c0['shift']());}};_0x1883fe(++_0x35410c);}(_0x0f36,0x8b));var _0x60f3=function(_0x449b81,_0x4b2a6f){_0x449b81=_0x449b81-0x0;var _0xb9b60c=_0x0f36[_0x449b81];return _0xb9b60c;};'use strict';var Sequelize=require(_0x60f3('0x0'));var rs=require(_0x60f3('0x1'));module[_0x60f3('0x2')]={'name':{'type':Sequelize[_0x60f3('0x3')],'unique':_0x60f3('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x60f3('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x60f3('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x60f3('0x3')],'defaultValue':function(){return rs[_0x60f3('0x5')]();}},'phone':{'type':Sequelize[_0x60f3('0x3')]},'type':{'type':Sequelize[_0x60f3('0x6')](_0x60f3('0x7'),_0x60f3('0x8'))},'accountSid':{'type':Sequelize[_0x60f3('0x3')]},'baseUrl':{'type':Sequelize[_0x60f3('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x60f3('0x9')],'defaultValue':function(){return _0x60f3('0xa');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x60f3('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x60f3('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x60f3('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x60f3('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x60f3('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x60f3('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x60f3('0xc')],'comment':_0x60f3('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x60f3('0xb')],'defaultValue':![],'comment':_0x60f3('0xe'),'set':function(_0x327446){if(!_0x327446){this['setDataValue'](_0x60f3('0xf'),null);}this[_0x60f3('0x10')](_0x60f3('0x11'),_0x327446);}},'description':{'type':Sequelize[_0x60f3('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index f632165..8d0e2aa 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 _0x3558=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','twilio','from','From','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','AttachmentId','UserId','applications','unshift','agent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','dataValues','Messages','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','sendStatus','status','undefined','limit','offset','count','Content-Range','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappAccount','includeAll','findAll','rows','catch','show','params','keys','include','create','user','role','get','find','userProfileId'];(function(_0x2dbe7e,_0x1866e5){var _0x15f7e4=function(_0x1b9161){while(--_0x1b9161){_0x2dbe7e['push'](_0x2dbe7e['shift']());}};_0x15f7e4(++_0x1866e5);}(_0x3558,0x67));var _0x8355=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x3558[_0x4fbfd9];return _0x31dc94;};'use strict';var emlformat=require(_0x8355('0x0'));var rimraf=require(_0x8355('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8355('0x2'));var rp=require('request-promise');var moment=require(_0x8355('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8355('0x4'));var util=require(_0x8355('0x5'));var path=require('path');var sox=require(_0x8355('0x6'));var csv=require(_0x8355('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8355('0x8'));var _=require(_0x8355('0x9'));var squel=require(_0x8355('0xa'));var crypto=require(_0x8355('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8355('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8355('0xc'));var authService=require(_0x8355('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x8355('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8355('0xf'))('api');var utils=require(_0x8355('0x10'));var config=require(_0x8355('0x11'));var licenseUtil=require(_0x8355('0x12'));var db=require('../../mysqldb')['db'];config[_0x8355('0x13')]=_[_0x8355('0x14')](config[_0x8355('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x8355('0x15'))(new Redis(config[_0x8355('0x13')]));require('./whatsappAccount.socket')[_0x8355('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8355('0x17')][_0x8355('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x47958f,_0xeee4b7,_0x5ae87b,_0x456e48){return new BPromise(function(_0x53f377,_0x35bce8){var _0x5486b8=_0x456e48||client;return _0x5486b8[_0x8355('0x19')](_0x47958f,_0x5ae87b)[_0x8355('0x1a')](function(_0x1aaaea){logger['info'](_0x8355('0x1b'),_0xeee4b7,_0x8355('0x1c'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xeee4b7,'request\x20sent',JSON[_0x8355('0x1d')](_0x1aaaea));if(_0x1aaaea['error']){if(_0x1aaaea[_0x8355('0x1e')][_0x8355('0x1f')]===0x1f4){logger[_0x8355('0x1e')](_0x8355('0x1b'),_0xeee4b7,_0x1aaaea[_0x8355('0x1e')][_0x8355('0x20')]);return _0x35bce8(_0x1aaaea['error'][_0x8355('0x20')]);}logger[_0x8355('0x1e')](_0x8355('0x1b'),_0xeee4b7,_0x1aaaea[_0x8355('0x1e')][_0x8355('0x20')]);return _0x53f377(_0x1aaaea[_0x8355('0x1e')][_0x8355('0x20')]);}else{logger[_0x8355('0x21')](_0x8355('0x1b'),_0xeee4b7,_0x8355('0x1c'));_0x53f377(_0x1aaaea['result'][_0x8355('0x20')]);}})['catch'](function(_0x3768da){logger['error'](_0x8355('0x1b'),_0xeee4b7,_0x3768da);_0x35bce8(_0x3768da);});});}function respondWithStatusCode(_0x50488a,_0x182392){_0x182392=_0x182392||0xcc;return function(_0x44b696){if(_0x44b696){return _0x50488a[_0x8355('0x22')](_0x182392);}return _0x50488a[_0x8355('0x23')](_0x182392)['end']();};}function respondWithResult(_0x1032fe,_0x107c66){_0x107c66=_0x107c66||0xc8;return function(_0x564551){if(_0x564551){return _0x1032fe[_0x8355('0x23')](_0x107c66)['json'](_0x564551);}};}function respondWithFilteredResult(_0x34fbf2,_0x422abe){return function(_0x2ee409){if(_0x2ee409){var _0x38a5bb=typeof _0x422abe['offset']===_0x8355('0x24')&&typeof _0x422abe[_0x8355('0x25')]===_0x8355('0x24');var _0x256261=_0x2ee409['count'];var _0x20135b=_0x38a5bb?0x0:_0x422abe[_0x8355('0x26')];var _0x1d5b32=_0x38a5bb?_0x2ee409[_0x8355('0x27')]:_0x422abe[_0x8355('0x26')]+_0x422abe['limit'];var _0x3847c7;if(_0x1d5b32>=_0x256261){_0x1d5b32=_0x256261;_0x3847c7=0xc8;}else{_0x3847c7=0xce;}_0x34fbf2[_0x8355('0x23')](_0x3847c7);return _0x34fbf2['set'](_0x8355('0x28'),_0x20135b+'-'+_0x1d5b32+'/'+_0x256261)['json'](_0x2ee409);}return null;};}function patchUpdates(_0x425356){return function(_0x51d2cc){try{jsonpatch['apply'](_0x51d2cc,_0x425356,!![]);}catch(_0x1ba3e2){return BPromise[_0x8355('0x29')](_0x1ba3e2);}return _0x51d2cc[_0x8355('0x2a')]();};}function saveUpdates(_0x37baec,_0x29224b){return function(_0x1a287f){if(_0x1a287f){return _0x1a287f[_0x8355('0x2b')](_0x37baec)[_0x8355('0x1a')](function(_0x526399){return _0x526399;});}return null;};}function removeEntity(_0x50bf62,_0x102fab){return function(_0x5221f3){if(_0x5221f3){return _0x5221f3[_0x8355('0x2c')]()[_0x8355('0x1a')](function(){var _0x41203d=_0x5221f3['get']({'plain':!![]});var _0x6963cc=_0x8355('0x2d');return db[_0x8355('0x2e')][_0x8355('0x2c')]({'where':{'type':_0x6963cc,'resourceId':_0x41203d['id']}})[_0x8355('0x1a')](function(){return _0x5221f3;});})['then'](function(){_0x50bf62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272ba7,_0x2386b4){return function(_0x10e31e){if(!_0x10e31e){_0x272ba7[_0x8355('0x22')](0x194);}return _0x10e31e;};}function handleError(_0x287f3e,_0x9d834a){_0x9d834a=_0x9d834a||0x1f4;return function(_0x444ce4){logger[_0x8355('0x1e')](_0x444ce4['stack']);if(_0x444ce4[_0x8355('0x2f')]){delete _0x444ce4[_0x8355('0x2f')];}_0x287f3e[_0x8355('0x23')](_0x9d834a)[_0x8355('0x30')](_0x444ce4);};}exports[_0x8355('0x31')]=function(_0x512ed1,_0x399d26){var _0x2c2980={'include':[{'model':db[_0x8355('0x32')],'as':_0x8355('0x33')}]},_0x440dd9={},_0xb95cec={'count':0x0,'rows':[]};var _0x490132=_[_0x8355('0x34')](db['WhatsappAccount'][_0x8355('0x35')],function(_0x30ecc8){return{'name':_0x30ecc8[_0x8355('0x36')],'type':_0x30ecc8[_0x8355('0x37')][_0x8355('0x38')]};});_0x440dd9[_0x8355('0x39')]=_['map'](_0x490132,_0x8355('0x2f'));_0x440dd9[_0x8355('0x3a')]=_['keys'](_0x512ed1[_0x8355('0x3a')]);_0x440dd9[_0x8355('0x3b')]=_[_0x8355('0x3c')](_0x440dd9[_0x8355('0x39')],_0x440dd9['query']);_0x2c2980[_0x8355('0x3d')]=_[_0x8355('0x3c')](_0x440dd9[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x512ed1[_0x8355('0x3a')][_0x8355('0x3e')]));_0x2c2980[_0x8355('0x3d')]=_0x2c2980['attributes'][_0x8355('0x3f')]?_0x2c2980[_0x8355('0x3d')]:_0x440dd9['model'];if(!_0x512ed1[_0x8355('0x3a')][_0x8355('0x40')](_0x8355('0x41'))){_0x2c2980[_0x8355('0x25')]=qs[_0x8355('0x25')](_0x512ed1['query'][_0x8355('0x25')]);_0x2c2980[_0x8355('0x26')]=qs['offset'](_0x512ed1['query'][_0x8355('0x26')]);}_0x2c2980[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x512ed1[_0x8355('0x3a')][_0x8355('0x43')]);_0x2c2980[_0x8355('0x44')]=qs[_0x8355('0x3b')](_[_0x8355('0x45')](_0x512ed1[_0x8355('0x3a')],_0x440dd9[_0x8355('0x3b')]),_0x490132);if(_0x512ed1[_0x8355('0x3a')]['filter']){_0x2c2980[_0x8355('0x44')]=_[_0x8355('0x46')](_0x2c2980['where'],{'$or':_['map'](_0x490132,function(_0x27b2cf){if(_0x27b2cf[_0x8355('0x37')]!==_0x8355('0x47')){var _0x456fb2={};_0x456fb2[_0x27b2cf[_0x8355('0x2f')]]={'$like':'%'+_0x512ed1['query'][_0x8355('0x48')]+'%'};return _0x456fb2;}})});}_0x2c2980=_['merge']({},_0x2c2980,_0x512ed1[_0x8355('0x49')]);var _0x49b84b={'where':_0x2c2980[_0x8355('0x44')]};return db[_0x8355('0x4a')][_0x8355('0x27')](_0x49b84b)[_0x8355('0x1a')](function(_0x25c1f3){_0xb95cec['count']=_0x25c1f3;if(_0x512ed1[_0x8355('0x3a')][_0x8355('0x4b')]){_0x2c2980['include']=[{'all':!![]}];}return db[_0x8355('0x4a')][_0x8355('0x4c')](_0x2c2980);})[_0x8355('0x1a')](function(_0x903869){_0xb95cec[_0x8355('0x4d')]=_0x903869;return _0xb95cec;})[_0x8355('0x1a')](respondWithFilteredResult(_0x399d26,_0x2c2980))[_0x8355('0x4e')](handleError(_0x399d26,null));};exports[_0x8355('0x4f')]=function(_0x4ec9ce,_0x27fbfa){var _0x3f4a80={'raw':![],'where':{'id':_0x4ec9ce[_0x8355('0x50')]['id']},'include':[{'model':db[_0x8355('0x32')],'as':'mandatoryDispositionPause'}]},_0x3d9bef={};_0x3d9bef[_0x8355('0x39')]=_[_0x8355('0x51')](db['WhatsappAccount'][_0x8355('0x35')]);_0x3d9bef[_0x8355('0x3a')]=_[_0x8355('0x51')](_0x4ec9ce[_0x8355('0x3a')]);_0x3d9bef[_0x8355('0x3b')]=_[_0x8355('0x3c')](_0x3d9bef[_0x8355('0x39')],_0x3d9bef[_0x8355('0x3a')]);_0x3f4a80[_0x8355('0x3d')]=_['intersection'](_0x3d9bef[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x4ec9ce['query'][_0x8355('0x3e')]));_0x3f4a80[_0x8355('0x3d')]=_0x3f4a80['attributes'][_0x8355('0x3f')]?_0x3f4a80['attributes']:_0x3d9bef[_0x8355('0x39')];if(_0x4ec9ce[_0x8355('0x3a')][_0x8355('0x4b')]){_0x3f4a80[_0x8355('0x52')]=[{'all':!![]}];}_0x3f4a80=_['merge']({},_0x3f4a80,_0x4ec9ce['options']);return db[_0x8355('0x4a')]['find'](_0x3f4a80)[_0x8355('0x1a')](handleEntityNotFound(_0x27fbfa,null))['then'](respondWithResult(_0x27fbfa,null))['catch'](handleError(_0x27fbfa,null));};exports[_0x8355('0x53')]=function(_0x158b22,_0x576616){return db[_0x8355('0x4a')][_0x8355('0x53')](_0x158b22['body'],{})[_0x8355('0x1a')](function(_0x39314b){var _0x5d0587=_0x158b22[_0x8355('0x54')]['get']({'plain':!![]});if(!_0x5d0587)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d0587[_0x8355('0x55')]==='user'){var _0x4eb7c5=_0x39314b[_0x8355('0x56')]({'plain':!![]});var _0x503495=_0x8355('0x2d');return db['UserProfileSection'][_0x8355('0x57')]({'where':{'name':_0x503495,'userProfileId':_0x5d0587[_0x8355('0x58')]},'raw':!![]})[_0x8355('0x1a')](function(_0x299fb0){if(_0x299fb0&&_0x299fb0[_0x8355('0x59')]===0x0){return db[_0x8355('0x2e')][_0x8355('0x53')]({'name':_0x4eb7c5[_0x8355('0x2f')],'resourceId':_0x4eb7c5['id'],'type':_0x299fb0[_0x8355('0x2f')],'sectionId':_0x299fb0['id']},{})[_0x8355('0x1a')](function(){return _0x39314b;});}else{return _0x39314b;}})[_0x8355('0x4e')](function(_0x453d5e){logger[_0x8355('0x1e')](_0x8355('0x5a'),_0x453d5e);throw _0x453d5e;});}return _0x39314b;})[_0x8355('0x1a')](respondWithResult(_0x576616,0xc9))[_0x8355('0x4e')](handleError(_0x576616,null));};exports[_0x8355('0x2b')]=function(_0x28d4b4,_0x440c11){if(_0x28d4b4[_0x8355('0x5b')]['id']){delete _0x28d4b4[_0x8355('0x5b')]['id'];}return db[_0x8355('0x4a')]['find']({'where':{'id':_0x28d4b4[_0x8355('0x50')]['id']},'include':[{'model':db[_0x8355('0x32')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x440c11,null))[_0x8355('0x1a')](saveUpdates(_0x28d4b4[_0x8355('0x5b')],null))['then'](respondWithResult(_0x440c11,null))[_0x8355('0x4e')](handleError(_0x440c11,null));};exports[_0x8355('0x2c')]=function(_0x26ac73,_0x39ace5){return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x26ac73[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x39ace5,null))['then'](removeEntity(_0x39ace5,null))[_0x8355('0x4e')](handleError(_0x39ace5,null));};exports['describe']=function(_0xcf41ea,_0x5d5151){return db['WhatsappAccount'][_0x8355('0x5c')]()[_0x8355('0x1a')](respondWithResult(_0x5d5151,null))[_0x8355('0x4e')](handleError(_0x5d5151,null));};exports[_0x8355('0x5d')]=function(_0x290eab,_0xd346a7,_0x219d08){if(_0x290eab[_0x8355('0x5b')]['id']){delete _0x290eab[_0x8355('0x5b')]['id'];}return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x290eab['params']['id']}})['then'](handleEntityNotFound(_0xd346a7,null))[_0x8355('0x1a')](function(_0x4085c7){if(_0x4085c7){_0x290eab['body'][_0x8355('0x5e')]=_0x4085c7['id'];return db['Disposition'][_0x8355('0x53')](_0x290eab[_0x8355('0x5b')]);}})[_0x8355('0x1a')](respondWithResult(_0xd346a7,null))[_0x8355('0x4e')](handleError(_0xd346a7,null));};exports[_0x8355('0x5f')]=function(_0x12c12b,_0x19cc7c,_0x4199bb){var _0x2ddcba={'raw':![],'where':{}};var _0x3d6cd8={};var _0x449b67={'count':0x0,'rows':[]};return db[_0x8355('0x4a')][_0x8355('0x60')]({'where':{'id':_0x12c12b[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x19cc7c,null))[_0x8355('0x1a')](function(_0xfe5747){if(_0xfe5747){_0x3d6cd8[_0x8355('0x39')]=_[_0x8355('0x51')](db[_0x8355('0x61')]['rawAttributes']);_0x3d6cd8[_0x8355('0x3a')]=_[_0x8355('0x51')](_0x12c12b[_0x8355('0x3a')]);_0x3d6cd8[_0x8355('0x3b')]=_['intersection'](_0x3d6cd8[_0x8355('0x39')],_0x3d6cd8['query']);_0x2ddcba[_0x8355('0x3d')]=_[_0x8355('0x3c')](_0x3d6cd8[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x12c12b[_0x8355('0x3a')]['fields']));_0x2ddcba[_0x8355('0x3d')]=_0x2ddcba[_0x8355('0x3d')]['length']?_0x2ddcba[_0x8355('0x3d')]:_0x3d6cd8[_0x8355('0x39')];if(!_0x12c12b[_0x8355('0x3a')]['hasOwnProperty'](_0x8355('0x41'))){_0x2ddcba[_0x8355('0x25')]=qs['limit'](_0x12c12b[_0x8355('0x3a')][_0x8355('0x25')]);_0x2ddcba[_0x8355('0x26')]=qs[_0x8355('0x26')](_0x12c12b['query'][_0x8355('0x26')]);}_0x2ddcba[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x12c12b['query'][_0x8355('0x43')]);_0x2ddcba['where']=qs[_0x8355('0x3b')](_['pick'](_0x12c12b[_0x8355('0x3a')],_0x3d6cd8[_0x8355('0x3b')]));_0x2ddcba[_0x8355('0x44')][_0x8355('0x5e')]=_0xfe5747['id'];if(_0x12c12b[_0x8355('0x3a')][_0x8355('0x48')]){_0x2ddcba['where']=_[_0x8355('0x46')](_0x2ddcba[_0x8355('0x44')],{'$or':_[_0x8355('0x34')](_0x2ddcba[_0x8355('0x3d')],function(_0x37c2c6){var _0x139f33={};_0x139f33[_0x37c2c6]={'$like':'%'+_0x12c12b[_0x8355('0x3a')][_0x8355('0x48')]+'%'};return _0x139f33;})});}_0x2ddcba=_['merge']({},_0x2ddcba,_0x12c12b['options']);return db[_0x8355('0x61')][_0x8355('0x27')]({'where':_0x2ddcba['where']})[_0x8355('0x1a')](function(_0x3527d4){_0x449b67['count']=_0x3527d4;if(_0x12c12b[_0x8355('0x3a')][_0x8355('0x4b')]){_0x2ddcba[_0x8355('0x52')]=[{'all':!![]}];}return db[_0x8355('0x61')][_0x8355('0x4c')](_0x2ddcba);})['then'](function(_0x41dc57){_0x449b67['rows']=_0x41dc57;return _0x449b67;});}})[_0x8355('0x1a')](respondWithFilteredResult(_0x19cc7c,_0x2ddcba))['catch'](handleError(_0x19cc7c,null));};exports[_0x8355('0x62')]=function(_0x1f7fe4,_0x1d6c89,_0x2ef9a9){return db['WhatsappAccount'][_0x8355('0x57')]({'where':{'id':_0x1f7fe4[_0x8355('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d6c89,null))[_0x8355('0x1a')](function(_0x4b941f){if(_0x4b941f){return _0x4b941f[_0x8355('0x62')](_0x1f7fe4[_0x8355('0x3a')][_0x8355('0x63')]);}})[_0x8355('0x1a')](respondWithStatusCode(_0x1d6c89,null))[_0x8355('0x4e')](handleError(_0x1d6c89,null));};exports[_0x8355('0x64')]=function(_0x42881b,_0x5665ee,_0x15373a){if(_0x42881b[_0x8355('0x5b')]['id']){delete _0x42881b['body']['id'];}return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x42881b['params']['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x5665ee,null))[_0x8355('0x1a')](function(_0x31dda0){if(_0x31dda0){_0x42881b[_0x8355('0x5b')][_0x8355('0x5e')]=_0x31dda0['id'];return db['CannedAnswer'][_0x8355('0x53')](_0x42881b[_0x8355('0x5b')]);}})[_0x8355('0x1a')](respondWithResult(_0x5665ee,null))[_0x8355('0x4e')](handleError(_0x5665ee,null));};exports[_0x8355('0x65')]=function(_0x3158de,_0x215343,_0x5b79ed){var _0x1bb563={'raw':![],'where':{}};var _0x491f9b={};var _0x1cbcd1={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8355('0x60')]({'where':{'id':_0x3158de[_0x8355('0x50')]['id']}})['then'](handleEntityNotFound(_0x215343,null))[_0x8355('0x1a')](function(_0x35af79){if(_0x35af79){_0x491f9b['model']=_[_0x8355('0x51')](db[_0x8355('0x66')]['rawAttributes']);_0x491f9b[_0x8355('0x3a')]=_[_0x8355('0x51')](_0x3158de['query']);_0x491f9b[_0x8355('0x3b')]=_['intersection'](_0x491f9b['model'],_0x491f9b['query']);_0x1bb563[_0x8355('0x3d')]=_[_0x8355('0x3c')](_0x491f9b[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x3158de[_0x8355('0x3a')]['fields']));_0x1bb563['attributes']=_0x1bb563[_0x8355('0x3d')][_0x8355('0x3f')]?_0x1bb563[_0x8355('0x3d')]:_0x491f9b[_0x8355('0x39')];if(!_0x3158de[_0x8355('0x3a')][_0x8355('0x40')](_0x8355('0x41'))){_0x1bb563[_0x8355('0x25')]=qs[_0x8355('0x25')](_0x3158de[_0x8355('0x3a')]['limit']);_0x1bb563['offset']=qs['offset'](_0x3158de['query'][_0x8355('0x26')]);}_0x1bb563[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x3158de[_0x8355('0x3a')]['sort']);_0x1bb563[_0x8355('0x44')]=qs[_0x8355('0x3b')](_[_0x8355('0x45')](_0x3158de[_0x8355('0x3a')],_0x491f9b['filters']));_0x1bb563[_0x8355('0x44')][_0x8355('0x5e')]=_0x35af79['id'];if(_0x3158de[_0x8355('0x3a')][_0x8355('0x48')]){_0x1bb563[_0x8355('0x44')]=_[_0x8355('0x46')](_0x1bb563[_0x8355('0x44')],{'$or':_[_0x8355('0x34')](_0x1bb563['attributes'],function(_0x2addd6){var _0x1ae7c1={};_0x1ae7c1[_0x2addd6]={'$like':'%'+_0x3158de[_0x8355('0x3a')]['filter']+'%'};return _0x1ae7c1;})});}_0x1bb563=_[_0x8355('0x46')]({},_0x1bb563,_0x3158de[_0x8355('0x49')]);return db[_0x8355('0x66')][_0x8355('0x27')]({'where':_0x1bb563['where']})[_0x8355('0x1a')](function(_0x18e1aa){_0x1cbcd1['count']=_0x18e1aa;if(_0x3158de[_0x8355('0x3a')][_0x8355('0x4b')]){_0x1bb563[_0x8355('0x52')]=[{'all':!![]}];}return db[_0x8355('0x66')][_0x8355('0x4c')](_0x1bb563);})[_0x8355('0x1a')](function(_0x22ece7){_0x1cbcd1[_0x8355('0x4d')]=_0x22ece7;return _0x1cbcd1;});}})[_0x8355('0x1a')](respondWithFilteredResult(_0x215343,_0x1bb563))[_0x8355('0x4e')](handleError(_0x215343,null));};exports['removeAnswers']=function(_0x9b44f3,_0x3f1c1a,_0x43b2cf){return db['WhatsappAccount'][_0x8355('0x57')]({'where':{'id':_0x9b44f3[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x3f1c1a,null))[_0x8355('0x1a')](function(_0x18877a){if(_0x18877a){return _0x18877a[_0x8355('0x67')](_0x9b44f3[_0x8355('0x3a')]['ids']);}})[_0x8355('0x1a')](respondWithStatusCode(_0x3f1c1a,null))[_0x8355('0x4e')](handleError(_0x3f1c1a,null));};exports[_0x8355('0x68')]=function(_0x3d07a6,_0x172ba4,_0x3a3d0f){return db['WhatsappAccount'][_0x8355('0x57')]({'where':{'id':_0x3d07a6[_0x8355('0x50')]['id']}})['then'](handleEntityNotFound(_0x172ba4,null))[_0x8355('0x1a')](function(_0x375dda){if(_0x375dda){return _0x375dda['addAgents'](_0x3d07a6[_0x8355('0x5b')][_0x8355('0x63')],_[_0x8355('0x69')](_0x3d07a6[_0x8355('0x5b')],['ids','id'])||{})[_0x8355('0x6a')](function(_0x36fe2c){for(var _0x2b3257=0x0;_0x2b3257<_0x3d07a6[_0x8355('0x5b')][_0x8355('0x63')][_0x8355('0x3f')];_0x2b3257+=0x1){socket[_0x8355('0x6b')](_0x8355('0x6c'),{'UserId':Number(_0x3d07a6['body']['ids'][_0x2b3257]),'WhatsappAccountId':Number(_0x3d07a6[_0x8355('0x50')]['id'])});}return _0x36fe2c;});}})[_0x8355('0x1a')](respondWithResult(_0x172ba4,null))[_0x8355('0x4e')](handleError(_0x172ba4,null));};exports[_0x8355('0x6d')]=function(_0x5b8c65,_0x165fe4,_0x74fa63){return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x5b8c65['params']['id']}})['then'](handleEntityNotFound(_0x165fe4,null))[_0x8355('0x1a')](function(_0x5ab59c){if(_0x5ab59c){return _0x5ab59c[_0x8355('0x6d')](_0x5b8c65['query']['ids'])[_0x8355('0x1a')](function(){if(_[_0x8355('0x6e')](_0x5b8c65[_0x8355('0x3a')]['ids'])){for(var _0x40e899=0x0;_0x40e899<_0x5b8c65['query']['ids'][_0x8355('0x3f')];_0x40e899+=0x1){socket[_0x8355('0x6b')]('userWhatsappAccount:remove',{'UserId':Number(_0x5b8c65['query'][_0x8355('0x63')][_0x40e899]),'WhatsappAccountId':Number(_0x5b8c65[_0x8355('0x50')]['id'])});}}else{socket[_0x8355('0x6b')](_0x8355('0x6f'),{'UserId':Number(_0x5b8c65['query']['ids']),'WhatsappAccountId':Number(_0x5b8c65['params']['id'])});}});}})[_0x8355('0x1a')](respondWithStatusCode(_0x165fe4,null))['catch'](handleError(_0x165fe4,null));};exports[_0x8355('0x70')]=function(_0x108beb,_0xf5b354,_0x30efb6){var _0x40072c={};var _0x92c2b7={};var _0xce1b1d;var _0x13f813;return db[_0x8355('0x4a')][_0x8355('0x60')]({'where':{'id':_0x108beb[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0xf5b354,null))['then'](function(_0xeb53a2){if(_0xeb53a2){_0xce1b1d=_0xeb53a2;_0x92c2b7[_0x8355('0x39')]=_[_0x8355('0x51')](db[_0x8355('0x71')][_0x8355('0x35')]);_0x92c2b7[_0x8355('0x3a')]=_['keys'](_0x108beb[_0x8355('0x3a')]);_0x92c2b7[_0x8355('0x3b')]=_[_0x8355('0x3c')](_0x92c2b7[_0x8355('0x39')],_0x92c2b7[_0x8355('0x3a')]);_0x40072c['attributes']=_[_0x8355('0x3c')](_0x92c2b7['model'],qs[_0x8355('0x3e')](_0x108beb[_0x8355('0x3a')][_0x8355('0x3e')]));_0x40072c[_0x8355('0x3d')]=_0x40072c[_0x8355('0x3d')]['length']?_0x40072c[_0x8355('0x3d')]:_0x92c2b7[_0x8355('0x39')];_0x40072c[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x108beb['query'][_0x8355('0x43')]);_0x40072c[_0x8355('0x44')]=qs[_0x8355('0x3b')](_[_0x8355('0x45')](_0x108beb[_0x8355('0x3a')],_0x92c2b7[_0x8355('0x3b')]));if(_0x108beb[_0x8355('0x3a')][_0x8355('0x48')]){_0x40072c[_0x8355('0x44')]=_['merge'](_0x40072c['where'],{'$or':_[_0x8355('0x34')](_0x40072c[_0x8355('0x3d')],function(_0x68d197){var _0x103b9a={};_0x103b9a[_0x68d197]={'$like':'%'+_0x108beb[_0x8355('0x3a')][_0x8355('0x48')]+'%'};return _0x103b9a;})});}_0x40072c=_['merge']({},_0x40072c,_0x108beb[_0x8355('0x49')]);return _0xce1b1d[_0x8355('0x70')](_0x40072c);}})['then'](function(_0x15b4b2){if(_0x15b4b2){_0x13f813=_0x15b4b2[_0x8355('0x3f')];if(!_0x108beb[_0x8355('0x3a')][_0x8355('0x40')](_0x8355('0x41'))){_0x40072c[_0x8355('0x25')]=qs['limit'](_0x108beb[_0x8355('0x3a')][_0x8355('0x25')]);_0x40072c['offset']=qs['offset'](_0x108beb[_0x8355('0x3a')][_0x8355('0x26')]);}return _0xce1b1d[_0x8355('0x70')](_0x40072c);}})[_0x8355('0x1a')](function(_0x58bac5){if(_0x58bac5){return _0x58bac5?{'count':_0x13f813,'rows':_0x58bac5}:null;}})[_0x8355('0x1a')](respondWithResult(_0xf5b354,null))['catch'](handleError(_0xf5b354,null));};exports[_0x8355('0x72')]=function(_0x346ac6,_0x2ac3bf){var _0x4501ee=_0x346ac6[_0x8355('0x50')]['id'];var _0x151d82=_0x346ac6['body'];var _0x1e9ddc=0xc8;var _0x58f01b=null;return db['sequelize'][_0x8355('0x73')]({'isolationLevel':db['sequelize'][_0x8355('0x74')][_0x8355('0x75')][_0x8355('0x76')]},function(_0x504575){return db[_0x8355('0x4a')]['findOne']({'where':{'id':_0x4501ee},'transaction':_0x504575})[_0x8355('0x1a')](function(_0x80c628){if(_0x80c628){return db[_0x8355('0x77')][_0x8355('0x2c')]({'where':{'WhatsappAccountId':_0x4501ee},'transaction':_0x504575})['then'](function(){var _0x5d3e20=_[_0x8355('0x34')](_0x151d82,function(_0x49ef2b){_0x49ef2b[_0x8355('0x5e')]=_0x4501ee;return _0x49ef2b;});return db[_0x8355('0x77')][_0x8355('0x78')](_0x5d3e20,{'transaction':_0x504575});});}else{_0x1e9ddc=0x194;_0x58f01b=[];}});})[_0x8355('0x1a')](function(){if(_0x1e9ddc!==0x194){return db[_0x8355('0x77')][_0x8355('0x79')]({'where':{'WhatsappAccountId':_0x4501ee},'order':_0x8355('0x7a')})['then'](function(_0x4def1a){_0x58f01b=_0x4def1a;});}})[_0x8355('0x4e')](function(_0x509f7c){_0x1e9ddc=0x1f4;logger[_0x8355('0x1e')](_0x509f7c['stack']);if(_0x509f7c[_0x8355('0x2f')]){delete _0x509f7c[_0x8355('0x2f')];}_0x58f01b=_0x509f7c;})[_0x8355('0x7b')](function(){if(_0x58f01b===null){_0x2ac3bf[_0x8355('0x22')](_0x1e9ddc);}else{if(_0x1e9ddc===0x1f4){_0x2ac3bf[_0x8355('0x23')](_0x1e9ddc)[_0x8355('0x30')](_0x58f01b);}else{_0x2ac3bf['status'](_0x1e9ddc)[_0x8355('0x7c')](_0x58f01b);}}});};exports[_0x8355('0x7d')]=function(_0x20382d,_0x207f3a,_0x4aed46){var _0x4769b8={};var _0x3fa0d2={};var _0x339619;var _0x512c3;return db['WhatsappAccount'][_0x8355('0x60')]({'where':{'id':_0x20382d[_0x8355('0x50')]['id']}})[_0x8355('0x1a')](handleEntityNotFound(_0x207f3a,null))['then'](function(_0x482386){if(_0x482386){_0x339619=_0x482386;_0x3fa0d2[_0x8355('0x39')]=_[_0x8355('0x51')](db['WhatsappApplication'][_0x8355('0x35')]);_0x3fa0d2[_0x8355('0x3a')]=_[_0x8355('0x51')](_0x20382d[_0x8355('0x3a')]);_0x3fa0d2[_0x8355('0x3b')]=_[_0x8355('0x3c')](_0x3fa0d2['model'],_0x3fa0d2[_0x8355('0x3a')]);_0x4769b8[_0x8355('0x3d')]=_[_0x8355('0x3c')](_0x3fa0d2[_0x8355('0x39')],qs[_0x8355('0x3e')](_0x20382d[_0x8355('0x3a')][_0x8355('0x3e')]));_0x4769b8[_0x8355('0x3d')]=_0x4769b8[_0x8355('0x3d')]['length']?_0x4769b8[_0x8355('0x3d')]:_0x3fa0d2[_0x8355('0x39')];_0x4769b8[_0x8355('0x42')]=qs[_0x8355('0x43')](_0x20382d[_0x8355('0x3a')][_0x8355('0x43')]);_0x4769b8[_0x8355('0x44')]=qs[_0x8355('0x3b')](_[_0x8355('0x45')](_0x20382d[_0x8355('0x3a')],_0x3fa0d2[_0x8355('0x3b')]));if(_0x20382d['query'][_0x8355('0x48')]){_0x4769b8[_0x8355('0x44')]=_[_0x8355('0x46')](_0x4769b8[_0x8355('0x44')],{'$or':_[_0x8355('0x34')](_0x4769b8[_0x8355('0x3d')],function(_0x45afb2){var _0x5ab011={};_0x5ab011[_0x45afb2]={'$like':'%'+_0x20382d[_0x8355('0x3a')][_0x8355('0x48')]+'%'};return _0x5ab011;})});}_0x4769b8=_[_0x8355('0x46')]({},_0x4769b8,_0x20382d[_0x8355('0x49')]);return _0x339619[_0x8355('0x7d')](_0x4769b8);}})[_0x8355('0x1a')](function(_0x3b8712){if(_0x3b8712){_0x512c3=_0x3b8712[_0x8355('0x3f')];if(!_0x20382d['query'][_0x8355('0x40')](_0x8355('0x41'))){_0x4769b8[_0x8355('0x25')]=qs[_0x8355('0x25')](_0x20382d[_0x8355('0x3a')][_0x8355('0x25')]);_0x4769b8['offset']=qs[_0x8355('0x26')](_0x20382d[_0x8355('0x3a')][_0x8355('0x26')]);}return _0x339619[_0x8355('0x7d')](_0x4769b8);}})['then'](function(_0x5475e7){if(_0x5475e7){return _0x5475e7?{'count':_0x512c3,'rows':_0x5475e7}:null;}})[_0x8355('0x1a')](respondWithResult(_0x207f3a,null))[_0x8355('0x4e')](handleError(_0x207f3a,null));};exports['notify']=function(_0x5dd002,_0x47094e,_0x444008){var _0x51070d={'channel':'whatsapp'};var _0x81f8d9=[];var _0x28cd76=[];var _0x1a6bf2={};return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0x5dd002[_0x8355('0x50')]['id']},'include':[{'model':db[_0x8355('0x77')],'as':_0x8355('0x7e')}]})[_0x8355('0x1a')](handleEntityNotFound(_0x47094e,null))[_0x8355('0x1a')](function(_0x3709bc){_0x51070d[_0x8355('0x7f')]=_0x3709bc;if(_0x51070d['account']&&_0x51070d[_0x8355('0x7f')]['type']===_0x8355('0x80')&&_0x5dd002[_0x8355('0x5b')][_0x8355('0x81')]){if(_0x5dd002[_0x8355('0x5b')][_0x8355('0x81')][_0x8355('0x3f')]===0x0)return;if(_0x5dd002[_0x8355('0x5b')]['statuses'][0x0][_0x8355('0x82')]!==_0x8355('0x83'))return;return db[_0x8355('0x84')]['update']({'read':!![],'readAt':_0x5dd002['body'][_0x8355('0x81')][0x0][_0x8355('0x85')]},{'where':{'messageId':_0x5dd002['body'][_0x8355('0x81')][0x0][_0x8355('0x86')]},'individualHooks':!![]})[_0x8355('0x1a')](function(_0x23dd25){return _0x47094e[_0x8355('0x23')](0xc8)[_0x8355('0x7c')](_0x23dd25);});}_0x51070d['applications']=_[_0x8355('0x87')](_0x3709bc[_0x8355('0x7e')],[_0x8355('0x7a')],[_0x8355('0x88')]);if(_0x51070d[_0x8355('0x7f')][_0x8355('0x7e')]){delete _0x51070d[_0x8355('0x7f')][_0x8355('0x7e')];}return db[_0x8355('0x89')][_0x8355('0x5c')]()[_0x8355('0x1a')](function(_0x44f8b5){if(!_0x44f8b5){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0x8c'));}_0x81f8d9=_[_0x8355('0x8d')](_[_0x8355('0x51')](_0x44f8b5),['createdAt','updatedAt']);_0x28cd76=_[_0x8355('0x8d')](_[_0x8355('0x51')](_0x44f8b5),[_0x8355('0x8e'),'updatedAt',_0x8355('0x8f'),_0x8355('0x90')]);_0x51070d['body']={'mapKey':'mobile'};if(_0x51070d[_0x8355('0x7f')]&&_0x51070d[_0x8355('0x7f')][_0x8355('0x37')]===_0x8355('0x91')){_0x51070d[_0x8355('0x5b')][_0x8355('0x92')]=_0x5dd002[_0x8355('0x5b')][_0x8355('0x93')]['replace'](_0x8355('0x94'),'');_0x51070d[_0x8355('0x5b')][_0x8355('0x5b')]=_0x5dd002[_0x8355('0x5b')]['Body'];_0x51070d['body'][_0x8355('0x95')]=_0x5dd002[_0x8355('0x5b')][_0x8355('0x96')];}if(_0x51070d['account']&&_0x51070d['account'][_0x8355('0x37')]==='sinch'){_0x51070d[_0x8355('0x5b')][_0x8355('0x92')]=_0x5dd002[_0x8355('0x5b')][_0x8355('0x97')][0x0][_0x8355('0x92')];_0x51070d['body']['body']=_0x5dd002[_0x8355('0x5b')][_0x8355('0x97')][0x0]['message'][_0x8355('0x5b')];_0x51070d['body'][_0x8355('0x95')]=_0x5dd002[_0x8355('0x5b')]['notifications'][0x0][_0x8355('0x86')];}if(_0x51070d[_0x8355('0x5b')]['id']){delete _0x51070d[_0x8355('0x5b')]['id'];}if(_[_0x8355('0x98')](_0x51070d[_0x8355('0x5b')][_0x8355('0x92')])){throw new db['Sequelize'][(_0x8355('0x8b'))](_0x8355('0x99'));}if(_[_0x8355('0x98')](_0x51070d[_0x8355('0x5b')][_0x8355('0x5b')])||_0x51070d['body'][_0x8355('0x5b')]===''){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0x9a'));}if(_['isNil'](_0x51070d[_0x8355('0x5b')][_0x8355('0x9b')])){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0x9c')+_0x28cd76);}if(!_['includes'](_0x28cd76,_0x51070d[_0x8355('0x5b')][_0x8355('0x9b')])){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28cd76);}_0x1a6bf2[_0x51070d[_0x8355('0x5b')][_0x8355('0x9b')]]=_0x51070d[_0x8355('0x5b')][_0x8355('0x92')];return db[_0x8355('0x9d')][_0x8355('0x57')]({'where':{'id':_0x51070d['account']['ListId']},'include':[{'model':db[_0x8355('0x89')],'as':_0x8355('0x9e'),'where':_0x1a6bf2,'limit':0x1,'order':[[_0x8355('0x9f'),_0x8355('0xa0')]]}]});})[_0x8355('0x1a')](handleEntityNotFound(_0x47094e,null))[_0x8355('0x1a')](function(_0x19282f){if(_0x19282f){_0x51070d[_0x8355('0xa1')]=_[_0x8355('0x69')](_0x19282f,[_0x8355('0x9e')]);if(_0x19282f[_0x8355('0x9e')]['length']){return _0x19282f[_0x8355('0x9e')][0x0];}var _0x217b6f=_[_0x8355('0x14')](_0x51070d[_0x8355('0x5b')],{'firstName':_0x51070d[_0x8355('0x5b')][_0x8355('0x92')],'ListId':_0x19282f['id']});_0x217b6f[_0x51070d[_0x8355('0x5b')][_0x8355('0x9b')]]=_0x51070d[_0x8355('0x5b')][_0x8355('0x92')];return db[_0x8355('0x89')][_0x8355('0x53')](_0x217b6f,{'fields':_0x81f8d9,'raw':!![]});}})[_0x8355('0x1a')](handleEntityNotFound(_0x47094e,null))['then'](function(_0x330018){if(_0x330018){_0x51070d[_0x8355('0xa2')]=_0x330018;var _0xa92d5f={'ContactId':_0x330018['id'],'phone':_0x51070d[_0x8355('0x5b')]['from'],'WhatsappAccountId':_0x5dd002[_0x8355('0x50')]['id']};var _0x4e6b2b={'ContactId':_0x330018['id'],'WhatsappAccountId':_0x5dd002[_0x8355('0x50')]['id'],'closed':![]};return db[_0x8355('0xa3')][_0x8355('0x57')]({'where':_0x4e6b2b})['then'](function(_0x35c328){if(_0x35c328){return[_0x35c328,![]];}return db['WhatsappInteraction'][_0x8355('0x53')](_0xa92d5f)['then'](function(_0x38515d){return[_0x38515d,!![]];});});}})[_0x8355('0x6a')](function(_0x326444,_0x22f830){_0x51070d['interaction']=_0x326444['get']({'plain':!![]});_0x51070d[_0x8355('0xa4')][_0x8355('0xa5')]=![];if(_0x22f830){if(_0x51070d['account'][_0x8355('0xa6')]){_0x51070d['applications'][_0x8355('0xa7')]({'id':0x0,'priority':_0x51070d['applications'][_0x8355('0x3f')]+0x1,'app':_0x8355('0xa8'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x51070d[_0x8355('0xa4')][_0x8355('0xa5')]=!![];}return db['WhatsappMessage'][_0x8355('0x53')]({'phone':_0x51070d[_0x8355('0x5b')][_0x8355('0x92')],'messageId':_0x51070d[_0x8355('0x5b')][_0x8355('0x95')],'body':_0x51070d['body'][_0x8355('0x5b')],'WhatsappAccountId':_0x5dd002[_0x8355('0x50')]['id'],'WhatsappInteractionId':_0x326444['id'],'direction':'in','ContactId':_0x326444['ContactId'],'AttachmentId':_0x51070d['body'][_0x8355('0xa9')]});})[_0x8355('0x1a')](function(_0x57b269){_0x51070d[_0x8355('0x20')]=_0x57b269;if(!_0x51070d['interaction']['UserId'])return;return db[_0x8355('0x71')][_0x8355('0x57')]({'attributes':['id',_0x8355('0x2f')],'where':{'id':_0x51070d[_0x8355('0xa4')][_0x8355('0xaa')]}});})[_0x8355('0x1a')](function(_0x559682){if(_0x559682){_0x51070d[_0x8355('0xab')][_0x8355('0xac')]({'id':0x0,'priority':0x0,'app':_0x8355('0xad'),'appdata':_0x559682[_0x8355('0x2f')]+','+(_0x51070d[_0x8355('0x7f')]['waitForTheAssignedAgent']||0xa),'interval':_0x8355('0xae')});}if(!_0x51070d[_0x8355('0xa4')][_0x8355('0xaf')])return;return db[_0x8355('0xb0')][_0x8355('0x57')]({'attributes':['id',_0x8355('0x2f')],'where':{'id':_0x51070d[_0x8355('0xa4')][_0x8355('0xaf')]}});})[_0x8355('0x1a')](function(_0x363785){if(_0x363785){_0x51070d[_0x8355('0xab')][_0x8355('0xac')]({'id':0x0,'priority':0x1,'app':_0x8355('0xb1'),'appdata':_0x363785[_0x8355('0x2f')]+','+(_0x51070d[_0x8355('0x7f')][_0x8355('0xb2')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8355('0xb3'),_0x8355('0xb4'),_0x51070d);})['then'](function(_0x147e90){if(_0x147e90){var _0x2b89e2=0xc8;var _0x175a6e=_0x8355('0xb5');logger[_0x8355('0x21')](_0x8355('0xb6'),_0x175a6e,_0x2b89e2,_0x8355('0xb7'));logger['debug'](_0x8355('0xb8'),_0x175a6e,_0x2b89e2,_0x8355('0xb7'),JSON['stringify'](_0x147e90));if(_0x51070d['account'][_0x8355('0x37')]===_0x8355('0x91')){return _0x47094e[_0x8355('0x23')](_0x2b89e2)['set'](_0x8355('0xb9'),_0x8355('0xba'))[_0x8355('0x30')](_0x8355('0xbb'));}else{return _0x47094e[_0x8355('0x23')](_0x2b89e2)['json'](_0x147e90);}}});})[_0x8355('0x4e')](handleError(_0x47094e,null));};exports[_0x8355('0x30')]=function(_0xfca4a1,_0x219dc6,_0x16ceeb){var _0x4f86b5,_0x6dd46b,_0x294e9c;if(_[_0x8355('0x98')](_0xfca4a1[_0x8355('0x5b')][_0x8355('0x5b')])||_0xfca4a1[_0x8355('0x5b')][_0x8355('0x5b')]===''){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0x9a'));}if(_[_0x8355('0x98')](_0xfca4a1[_0x8355('0x5b')]['to'])){throw new db[(_0x8355('0x8a'))][(_0x8355('0x8b'))](_0x8355('0xbc'));}_0x4f86b5=_0xfca4a1[_0x8355('0x5b')]['to'];return db[_0x8355('0x4a')][_0x8355('0x57')]({'where':{'id':_0xfca4a1['params']['id']},'include':[{'model':db[_0x8355('0x9d')],'as':'List','include':[{'model':db[_0x8355('0x89')],'as':_0x8355('0x9e'),'where':{'mobile':_0x4f86b5},'limit':0x1,'order':[[_0x8355('0x9f'),_0x8355('0xa0')]]}]}]})['then'](handleEntityNotFound(_0x219dc6,null))[_0x8355('0x1a')](function(_0x19a1f1){if(_0x19a1f1&&_0x19a1f1['List']){_0x6dd46b=_0x19a1f1[_0x8355('0x56')]({'plain':!![]});if(_0x6dd46b['List']&&_0x6dd46b[_0x8355('0xbd')]['Contacts']['length']){return _0x6dd46b[_0x8355('0xbd')][_0x8355('0x9e')][0x0];}return db[_0x8355('0x89')][_0x8355('0x53')](_['defaults'](_0xfca4a1[_0x8355('0x5b')],{'firstName':_0x4f86b5,'mobile':_0x4f86b5,'phone':_0x4f86b5,'ListId':_0x6dd46b[_0x8355('0x90')]}));}})[_0x8355('0x1a')](handleEntityNotFound(_0x219dc6,null))[_0x8355('0x1a')](function(_0x450542){if(_0x450542){_0x294e9c=_0x450542;return db[_0x8355('0xa3')][_0x8355('0x57')]({'where':{'ContactId':_0x294e9c['id'],'closed':![],'WhatsappAccountId':_0x6dd46b['id']}})['then'](function(_0x317877){if(_0x317877){return[_0x317877,![]];}return db['WhatsappInteraction'][_0x8355('0x53')]({'UserId':_0xfca4a1[_0x8355('0x54')]['id'],'ContactId':_0x294e9c['id'],'WhatsappAccountId':_0x6dd46b['id'],'phone':_0x4f86b5,'firstMsgDirection':'out','Messages':[_['merge'](_0xfca4a1[_0x8355('0x5b')],{'read':![],'body':_0xfca4a1[_0x8355('0x5b')]['body'],'phone':_0x4f86b5,'WhatsappAccountId':_0x6dd46b['id'],'UserId':_0xfca4a1['user']['id'],'ContactId':_0x294e9c['id']})]},{'include':[{'model':db[_0x8355('0x84')],'as':'Messages'}]})[_0x8355('0x1a')](function(_0x499a19){return[_0x499a19,!![]];});});}})['spread'](function(_0xed27b5,_0x3dadd5){if(_0x3dadd5){return _0xed27b5;}return db['WhatsappMessage'][_0x8355('0x53')](_[_0x8355('0x46')](_0xfca4a1['body'],{'read':![],'body':_0xfca4a1[_0x8355('0x5b')]['body'],'phone':_0x4f86b5,'WhatsappAccountId':_0x6dd46b['id'],'WhatsappInteractionId':_0xed27b5['id'],'UserId':_0xfca4a1[_0x8355('0x54')]['id'],'ContactId':_0x294e9c['id']}))[_0x8355('0x1a')](function(_0x1b8d78){_0xed27b5[_0x8355('0xbe')][_0x8355('0xbf')]=[];_0xed27b5[_0x8355('0xbe')][_0x8355('0xbf')][_0x8355('0xa7')](_0x1b8d78[_0x8355('0xbe')]);return _0xed27b5;});})[_0x8355('0x1a')](respondWithResult(_0x219dc6,null))['catch'](handleError(_0x219dc6,null));}; \ No newline at end of file +var _0x8d23=['include','find','create','user','role','userProfileId','autoAssociation','UserProfileResource','body','params','describe','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','register','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','get','WhatsappAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappAccount','includeAll','findAll','rows'];(function(_0x9a7d5b,_0x50327f){var _0xe2a5b3=function(_0x98ad8d){while(--_0x98ad8d){_0x9a7d5b['push'](_0x9a7d5b['shift']());}};_0xe2a5b3(++_0x50327f);}(_0x8d23,0x133));var _0x38d2=function(_0x7a679d,_0x54ad5b){_0x7a679d=_0x7a679d-0x0;var _0x23ed76=_0x8d23[_0x7a679d];return _0x23ed76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38d2('0x0'));var zipdir=require(_0x38d2('0x1'));var jsonpatch=require(_0x38d2('0x2'));var rp=require(_0x38d2('0x3'));var moment=require(_0x38d2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x38d2('0x5'));var util=require(_0x38d2('0x6'));var path=require(_0x38d2('0x7'));var sox=require(_0x38d2('0x8'));var csv=require(_0x38d2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38d2('0xa'));var _=require(_0x38d2('0xb'));var squel=require(_0x38d2('0xc'));var crypto=require(_0x38d2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x38d2('0xe'));var toCsv=require(_0x38d2('0x9'));var querystring=require(_0x38d2('0xf'));var Papa=require('papaparse');var Redis=require(_0x38d2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x38d2('0x11'));var as=require(_0x38d2('0x12'));var hardwareService=require(_0x38d2('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38d2('0x14'));var db=require(_0x38d2('0x15'))['db'];config[_0x38d2('0x16')]=_[_0x38d2('0x17')](config[_0x38d2('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38d2('0x16')]));require('./whatsappAccount.socket')[_0x38d2('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x38d2('0x19')][_0x38d2('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x3a4a94,_0x534662,_0x4b71ee,_0x5e1799){return new BPromise(function(_0x58fccd,_0x15cee9){var _0x2bc86c=_0x5e1799||client;return _0x2bc86c['request'](_0x3a4a94,_0x4b71ee)[_0x38d2('0x1b')](function(_0x3fe0c9){logger[_0x38d2('0x1c')](_0x38d2('0x1d'),_0x534662,_0x38d2('0x1e'));logger[_0x38d2('0x1f')](_0x38d2('0x20'),_0x534662,_0x38d2('0x1e'),JSON[_0x38d2('0x21')](_0x3fe0c9));if(_0x3fe0c9[_0x38d2('0x22')]){if(_0x3fe0c9[_0x38d2('0x22')][_0x38d2('0x23')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x534662,_0x3fe0c9[_0x38d2('0x22')][_0x38d2('0x24')]);return _0x15cee9(_0x3fe0c9[_0x38d2('0x22')]['message']);}logger[_0x38d2('0x22')](_0x38d2('0x1d'),_0x534662,_0x3fe0c9[_0x38d2('0x22')][_0x38d2('0x24')]);return _0x58fccd(_0x3fe0c9['error'][_0x38d2('0x24')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x534662,_0x38d2('0x1e'));_0x58fccd(_0x3fe0c9[_0x38d2('0x25')][_0x38d2('0x24')]);}})[_0x38d2('0x26')](function(_0x1106ae){logger[_0x38d2('0x22')](_0x38d2('0x1d'),_0x534662,_0x1106ae);_0x15cee9(_0x1106ae);});});}function respondWithStatusCode(_0x15a943,_0x1c9a7d){_0x1c9a7d=_0x1c9a7d||0xcc;return function(_0x54e15a){if(_0x54e15a){return _0x15a943[_0x38d2('0x27')](_0x1c9a7d);}return _0x15a943['status'](_0x1c9a7d)[_0x38d2('0x28')]();};}function respondWithResult(_0x596e16,_0x417899){_0x417899=_0x417899||0xc8;return function(_0xe38a56){if(_0xe38a56){return _0x596e16['status'](_0x417899)['json'](_0xe38a56);}};}function respondWithFilteredResult(_0x272439,_0x336999){return function(_0x4bd05e){if(_0x4bd05e){var _0x183aa5=typeof _0x336999[_0x38d2('0x29')]===_0x38d2('0x2a')&&typeof _0x336999[_0x38d2('0x2b')]==='undefined';var _0x3adb64=_0x4bd05e['count'];var _0x289b99=_0x183aa5?0x0:_0x336999[_0x38d2('0x29')];var _0x454c2e=_0x183aa5?_0x4bd05e[_0x38d2('0x2c')]:_0x336999['offset']+_0x336999['limit'];var _0x1f39f6;if(_0x454c2e>=_0x3adb64){_0x454c2e=_0x3adb64;_0x1f39f6=0xc8;}else{_0x1f39f6=0xce;}_0x272439[_0x38d2('0x2d')](_0x1f39f6);return _0x272439[_0x38d2('0x2e')](_0x38d2('0x2f'),_0x289b99+'-'+_0x454c2e+'/'+_0x3adb64)[_0x38d2('0x30')](_0x4bd05e);}return null;};}function patchUpdates(_0x4de2c2){return function(_0x489024){try{jsonpatch[_0x38d2('0x31')](_0x489024,_0x4de2c2,!![]);}catch(_0xb2a9f6){return BPromise['reject'](_0xb2a9f6);}return _0x489024[_0x38d2('0x32')]();};}function saveUpdates(_0xa170ad,_0x337add){return function(_0x107544){if(_0x107544){return _0x107544[_0x38d2('0x33')](_0xa170ad)[_0x38d2('0x1b')](function(_0x266fdb){return _0x266fdb;});}return null;};}function removeEntity(_0x291c75,_0x45d5d9){return function(_0x1ade51){if(_0x1ade51){return _0x1ade51['destroy']()[_0x38d2('0x1b')](function(){var _0x5a989e=_0x1ade51[_0x38d2('0x34')]({'plain':!![]});var _0x188934=_0x38d2('0x35');return db['UserProfileResource'][_0x38d2('0x36')]({'where':{'type':_0x188934,'resourceId':_0x5a989e['id']}})[_0x38d2('0x1b')](function(){return _0x1ade51;});})['then'](function(){_0x291c75['status'](0xcc)[_0x38d2('0x28')]();});}};}function handleEntityNotFound(_0x2b23dc,_0x441c6b){return function(_0x122151){if(!_0x122151){_0x2b23dc[_0x38d2('0x27')](0x194);}return _0x122151;};}function handleError(_0x327c3d,_0x409dd3){_0x409dd3=_0x409dd3||0x1f4;return function(_0x3f3856){logger[_0x38d2('0x22')](_0x3f3856[_0x38d2('0x37')]);if(_0x3f3856[_0x38d2('0x38')]){delete _0x3f3856['name'];}_0x327c3d[_0x38d2('0x2d')](_0x409dd3)[_0x38d2('0x39')](_0x3f3856);};}exports[_0x38d2('0x3a')]=function(_0x174c0b,_0x23366c){var _0x20a141={'include':[{'model':db[_0x38d2('0x3b')],'as':_0x38d2('0x3c')}]},_0x4b7271={},_0x429982={'count':0x0,'rows':[]};var _0xe4ea00=_[_0x38d2('0x3d')](db['WhatsappAccount'][_0x38d2('0x3e')],function(_0x2488ca){return{'name':_0x2488ca['fieldName'],'type':_0x2488ca[_0x38d2('0x3f')][_0x38d2('0x40')]};});_0x4b7271['model']=_['map'](_0xe4ea00,_0x38d2('0x38'));_0x4b7271['query']=_[_0x38d2('0x41')](_0x174c0b[_0x38d2('0x42')]);_0x4b7271[_0x38d2('0x43')]=_[_0x38d2('0x44')](_0x4b7271[_0x38d2('0x45')],_0x4b7271[_0x38d2('0x42')]);_0x20a141[_0x38d2('0x46')]=_['intersection'](_0x4b7271[_0x38d2('0x45')],qs['fields'](_0x174c0b[_0x38d2('0x42')][_0x38d2('0x47')]));_0x20a141[_0x38d2('0x46')]=_0x20a141[_0x38d2('0x46')][_0x38d2('0x48')]?_0x20a141[_0x38d2('0x46')]:_0x4b7271[_0x38d2('0x45')];if(!_0x174c0b[_0x38d2('0x42')][_0x38d2('0x49')](_0x38d2('0x4a'))){_0x20a141[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x174c0b['query'][_0x38d2('0x2b')]);_0x20a141['offset']=qs['offset'](_0x174c0b[_0x38d2('0x42')][_0x38d2('0x29')]);}_0x20a141[_0x38d2('0x4b')]=qs['sort'](_0x174c0b[_0x38d2('0x42')][_0x38d2('0x4c')]);_0x20a141[_0x38d2('0x4d')]=qs[_0x38d2('0x43')](_[_0x38d2('0x4e')](_0x174c0b[_0x38d2('0x42')],_0x4b7271['filters']),_0xe4ea00);if(_0x174c0b[_0x38d2('0x42')][_0x38d2('0x4f')]){_0x20a141['where']=_['merge'](_0x20a141[_0x38d2('0x4d')],{'$or':_['map'](_0xe4ea00,function(_0x21f0e3){if(_0x21f0e3[_0x38d2('0x3f')]!==_0x38d2('0x50')){var _0x3a3827={};_0x3a3827[_0x21f0e3[_0x38d2('0x38')]]={'$like':'%'+_0x174c0b[_0x38d2('0x42')][_0x38d2('0x4f')]+'%'};return _0x3a3827;}})});}_0x20a141=_[_0x38d2('0x51')]({},_0x20a141,_0x174c0b[_0x38d2('0x52')]);var _0x47f0ac={'where':_0x20a141[_0x38d2('0x4d')]};return db[_0x38d2('0x53')][_0x38d2('0x2c')](_0x47f0ac)[_0x38d2('0x1b')](function(_0x96c6e){_0x429982['count']=_0x96c6e;if(_0x174c0b['query'][_0x38d2('0x54')]){_0x20a141['include']=[{'all':!![]}];}return db[_0x38d2('0x53')][_0x38d2('0x55')](_0x20a141);})[_0x38d2('0x1b')](function(_0x4d8067){_0x429982[_0x38d2('0x56')]=_0x4d8067;return _0x429982;})[_0x38d2('0x1b')](respondWithFilteredResult(_0x23366c,_0x20a141))['catch'](handleError(_0x23366c,null));};exports['show']=function(_0x3cabb0,_0x462184){var _0xe01910={'raw':![],'where':{'id':_0x3cabb0['params']['id']},'include':[{'model':db[_0x38d2('0x3b')],'as':_0x38d2('0x3c')}]},_0x4f9dfe={};_0x4f9dfe[_0x38d2('0x45')]=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x4f9dfe['query']=_[_0x38d2('0x41')](_0x3cabb0['query']);_0x4f9dfe[_0x38d2('0x43')]=_['intersection'](_0x4f9dfe['model'],_0x4f9dfe['query']);_0xe01910[_0x38d2('0x46')]=_[_0x38d2('0x44')](_0x4f9dfe[_0x38d2('0x45')],qs[_0x38d2('0x47')](_0x3cabb0[_0x38d2('0x42')]['fields']));_0xe01910[_0x38d2('0x46')]=_0xe01910[_0x38d2('0x46')][_0x38d2('0x48')]?_0xe01910[_0x38d2('0x46')]:_0x4f9dfe[_0x38d2('0x45')];if(_0x3cabb0[_0x38d2('0x42')][_0x38d2('0x54')]){_0xe01910[_0x38d2('0x57')]=[{'all':!![]}];}_0xe01910=_[_0x38d2('0x51')]({},_0xe01910,_0x3cabb0[_0x38d2('0x52')]);return db[_0x38d2('0x53')][_0x38d2('0x58')](_0xe01910)[_0x38d2('0x1b')](handleEntityNotFound(_0x462184,null))[_0x38d2('0x1b')](respondWithResult(_0x462184,null))['catch'](handleError(_0x462184,null));};exports['create']=function(_0x4c4d1d,_0x5b78ea){return db[_0x38d2('0x53')][_0x38d2('0x59')](_0x4c4d1d['body'],{})[_0x38d2('0x1b')](function(_0x2daaab){var _0x1c63cc=_0x4c4d1d[_0x38d2('0x5a')][_0x38d2('0x34')]({'plain':!![]});if(!_0x1c63cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c63cc[_0x38d2('0x5b')]===_0x38d2('0x5a')){var _0x219152=_0x2daaab[_0x38d2('0x34')]({'plain':!![]});var _0x35dc0c=_0x38d2('0x35');return db['UserProfileSection'][_0x38d2('0x58')]({'where':{'name':_0x35dc0c,'userProfileId':_0x1c63cc[_0x38d2('0x5c')]},'raw':!![]})['then'](function(_0xec6a9){if(_0xec6a9&&_0xec6a9[_0x38d2('0x5d')]===0x0){return db[_0x38d2('0x5e')][_0x38d2('0x59')]({'name':_0x219152['name'],'resourceId':_0x219152['id'],'type':_0xec6a9[_0x38d2('0x38')],'sectionId':_0xec6a9['id']},{})[_0x38d2('0x1b')](function(){return _0x2daaab;});}else{return _0x2daaab;}})[_0x38d2('0x26')](function(_0x4dc0e8){logger[_0x38d2('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dc0e8);throw _0x4dc0e8;});}return _0x2daaab;})[_0x38d2('0x1b')](respondWithResult(_0x5b78ea,0xc9))['catch'](handleError(_0x5b78ea,null));};exports[_0x38d2('0x33')]=function(_0xf5f165,_0x5d0a13){if(_0xf5f165[_0x38d2('0x5f')]['id']){delete _0xf5f165[_0x38d2('0x5f')]['id'];}return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0xf5f165[_0x38d2('0x60')]['id']},'include':[{'model':db[_0x38d2('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x38d2('0x1b')](handleEntityNotFound(_0x5d0a13,null))['then'](saveUpdates(_0xf5f165[_0x38d2('0x5f')],null))[_0x38d2('0x1b')](respondWithResult(_0x5d0a13,null))[_0x38d2('0x26')](handleError(_0x5d0a13,null));};exports['destroy']=function(_0x2f0064,_0x464eee){return db['WhatsappAccount'][_0x38d2('0x58')]({'where':{'id':_0x2f0064[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x464eee,null))['then'](removeEntity(_0x464eee,null))['catch'](handleError(_0x464eee,null));};exports['describe']=function(_0x454a6a,_0x2dcf27){return db['WhatsappAccount'][_0x38d2('0x61')]()[_0x38d2('0x1b')](respondWithResult(_0x2dcf27,null))[_0x38d2('0x26')](handleError(_0x2dcf27,null));};exports['addDisposition']=function(_0x590b58,_0x1b93d,_0x15ceed){if(_0x590b58[_0x38d2('0x5f')]['id']){delete _0x590b58[_0x38d2('0x5f')]['id'];}return db[_0x38d2('0x53')]['find']({'where':{'id':_0x590b58[_0x38d2('0x60')]['id']}})['then'](handleEntityNotFound(_0x1b93d,null))['then'](function(_0x4ad1b4){if(_0x4ad1b4){_0x590b58[_0x38d2('0x5f')][_0x38d2('0x62')]=_0x4ad1b4['id'];return db['Disposition'][_0x38d2('0x59')](_0x590b58[_0x38d2('0x5f')]);}})['then'](respondWithResult(_0x1b93d,null))['catch'](handleError(_0x1b93d,null));};exports[_0x38d2('0x63')]=function(_0x518b93,_0x5768f9,_0x1f1b79){var _0x2f8000={'raw':![],'where':{}};var _0x20305a={};var _0x3799a3={'count':0x0,'rows':[]};return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x518b93[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x5768f9,null))[_0x38d2('0x1b')](function(_0x574485){if(_0x574485){_0x20305a[_0x38d2('0x45')]=_[_0x38d2('0x41')](db['Disposition'][_0x38d2('0x3e')]);_0x20305a['query']=_[_0x38d2('0x41')](_0x518b93[_0x38d2('0x42')]);_0x20305a['filters']=_[_0x38d2('0x44')](_0x20305a[_0x38d2('0x45')],_0x20305a[_0x38d2('0x42')]);_0x2f8000[_0x38d2('0x46')]=_[_0x38d2('0x44')](_0x20305a[_0x38d2('0x45')],qs[_0x38d2('0x47')](_0x518b93[_0x38d2('0x42')][_0x38d2('0x47')]));_0x2f8000[_0x38d2('0x46')]=_0x2f8000[_0x38d2('0x46')][_0x38d2('0x48')]?_0x2f8000[_0x38d2('0x46')]:_0x20305a[_0x38d2('0x45')];if(!_0x518b93[_0x38d2('0x42')][_0x38d2('0x49')]('nolimit')){_0x2f8000[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x518b93[_0x38d2('0x42')]['limit']);_0x2f8000[_0x38d2('0x29')]=qs[_0x38d2('0x29')](_0x518b93['query'][_0x38d2('0x29')]);}_0x2f8000[_0x38d2('0x4b')]=qs[_0x38d2('0x4c')](_0x518b93[_0x38d2('0x42')]['sort']);_0x2f8000['where']=qs['filters'](_[_0x38d2('0x4e')](_0x518b93[_0x38d2('0x42')],_0x20305a['filters']));_0x2f8000[_0x38d2('0x4d')][_0x38d2('0x62')]=_0x574485['id'];if(_0x518b93[_0x38d2('0x42')][_0x38d2('0x4f')]){_0x2f8000[_0x38d2('0x4d')]=_['merge'](_0x2f8000['where'],{'$or':_[_0x38d2('0x3d')](_0x2f8000[_0x38d2('0x46')],function(_0x2fba8e){var _0x524e79={};_0x524e79[_0x2fba8e]={'$like':'%'+_0x518b93[_0x38d2('0x42')][_0x38d2('0x4f')]+'%'};return _0x524e79;})});}_0x2f8000=_[_0x38d2('0x51')]({},_0x2f8000,_0x518b93[_0x38d2('0x52')]);return db[_0x38d2('0x65')][_0x38d2('0x2c')]({'where':_0x2f8000[_0x38d2('0x4d')]})[_0x38d2('0x1b')](function(_0x3d44e1){_0x3799a3[_0x38d2('0x2c')]=_0x3d44e1;if(_0x518b93[_0x38d2('0x42')][_0x38d2('0x54')]){_0x2f8000['include']=[{'all':!![]}];}return db[_0x38d2('0x65')][_0x38d2('0x55')](_0x2f8000);})[_0x38d2('0x1b')](function(_0x50f5d6){_0x3799a3[_0x38d2('0x56')]=_0x50f5d6;return _0x3799a3;});}})[_0x38d2('0x1b')](respondWithFilteredResult(_0x5768f9,_0x2f8000))['catch'](handleError(_0x5768f9,null));};exports[_0x38d2('0x66')]=function(_0xec3c51,_0x183a3f,_0x5aafa7){return db[_0x38d2('0x53')]['find']({'where':{'id':_0xec3c51[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x183a3f,null))['then'](function(_0x515d1b){if(_0x515d1b){return _0x515d1b[_0x38d2('0x66')](_0xec3c51[_0x38d2('0x42')][_0x38d2('0x67')]);}})[_0x38d2('0x1b')](respondWithStatusCode(_0x183a3f,null))[_0x38d2('0x26')](handleError(_0x183a3f,null));};exports[_0x38d2('0x68')]=function(_0x9d6c18,_0x8b52c4,_0x3c4c21){if(_0x9d6c18[_0x38d2('0x5f')]['id']){delete _0x9d6c18[_0x38d2('0x5f')]['id'];}return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0x9d6c18[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x8b52c4,null))[_0x38d2('0x1b')](function(_0x292499){if(_0x292499){_0x9d6c18['body']['WhatsappAccountId']=_0x292499['id'];return db[_0x38d2('0x69')][_0x38d2('0x59')](_0x9d6c18['body']);}})['then'](respondWithResult(_0x8b52c4,null))[_0x38d2('0x26')](handleError(_0x8b52c4,null));};exports[_0x38d2('0x6a')]=function(_0x40c3ac,_0x393621,_0x351ed3){var _0x2517c7={'raw':![],'where':{}};var _0x15e946={};var _0x3e781a={'count':0x0,'rows':[]};return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x40c3ac[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x393621,null))['then'](function(_0x27ee34){if(_0x27ee34){_0x15e946[_0x38d2('0x45')]=_[_0x38d2('0x41')](db['CannedAnswer']['rawAttributes']);_0x15e946['query']=_['keys'](_0x40c3ac[_0x38d2('0x42')]);_0x15e946[_0x38d2('0x43')]=_[_0x38d2('0x44')](_0x15e946[_0x38d2('0x45')],_0x15e946[_0x38d2('0x42')]);_0x2517c7[_0x38d2('0x46')]=_[_0x38d2('0x44')](_0x15e946[_0x38d2('0x45')],qs[_0x38d2('0x47')](_0x40c3ac['query']['fields']));_0x2517c7['attributes']=_0x2517c7[_0x38d2('0x46')][_0x38d2('0x48')]?_0x2517c7['attributes']:_0x15e946['model'];if(!_0x40c3ac[_0x38d2('0x42')]['hasOwnProperty']('nolimit')){_0x2517c7[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x2b')]);_0x2517c7['offset']=qs[_0x38d2('0x29')](_0x40c3ac['query'][_0x38d2('0x29')]);}_0x2517c7[_0x38d2('0x4b')]=qs[_0x38d2('0x4c')](_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x4c')]);_0x2517c7[_0x38d2('0x4d')]=qs[_0x38d2('0x43')](_['pick'](_0x40c3ac[_0x38d2('0x42')],_0x15e946['filters']));_0x2517c7['where'][_0x38d2('0x62')]=_0x27ee34['id'];if(_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x4f')]){_0x2517c7[_0x38d2('0x4d')]=_[_0x38d2('0x51')](_0x2517c7[_0x38d2('0x4d')],{'$or':_[_0x38d2('0x3d')](_0x2517c7[_0x38d2('0x46')],function(_0x3f3e95){var _0x2b6a0e={};_0x2b6a0e[_0x3f3e95]={'$like':'%'+_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x4f')]+'%'};return _0x2b6a0e;})});}_0x2517c7=_[_0x38d2('0x51')]({},_0x2517c7,_0x40c3ac[_0x38d2('0x52')]);return db[_0x38d2('0x69')][_0x38d2('0x2c')]({'where':_0x2517c7['where']})[_0x38d2('0x1b')](function(_0x4cd50f){_0x3e781a[_0x38d2('0x2c')]=_0x4cd50f;if(_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x54')]){_0x2517c7[_0x38d2('0x57')]=[{'all':!![]}];}return db[_0x38d2('0x69')][_0x38d2('0x55')](_0x2517c7);})['then'](function(_0x270531){_0x3e781a[_0x38d2('0x56')]=_0x270531;return _0x3e781a;});}})[_0x38d2('0x1b')](respondWithFilteredResult(_0x393621,_0x2517c7))['catch'](handleError(_0x393621,null));};exports[_0x38d2('0x6b')]=function(_0x390005,_0x3d25ef,_0x3d8383){return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0x390005[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x3d25ef,null))[_0x38d2('0x1b')](function(_0x2ba11e){if(_0x2ba11e){return _0x2ba11e[_0x38d2('0x6b')](_0x390005[_0x38d2('0x42')]['ids']);}})[_0x38d2('0x1b')](respondWithStatusCode(_0x3d25ef,null))[_0x38d2('0x26')](handleError(_0x3d25ef,null));};exports[_0x38d2('0x6c')]=function(_0xefade6,_0x34d426,_0xa70a4){return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0xefade6[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x34d426,null))[_0x38d2('0x1b')](function(_0x2464bc){if(_0x2464bc){return _0x2464bc[_0x38d2('0x6c')](_0xefade6[_0x38d2('0x5f')][_0x38d2('0x67')],_[_0x38d2('0x6d')](_0xefade6[_0x38d2('0x5f')],['ids','id'])||{})['spread'](function(_0x541fcb){for(var _0x4fe682=0x0;_0x4fe682<_0xefade6[_0x38d2('0x5f')][_0x38d2('0x67')][_0x38d2('0x48')];_0x4fe682+=0x1){socket[_0x38d2('0x6e')](_0x38d2('0x6f'),{'UserId':Number(_0xefade6[_0x38d2('0x5f')][_0x38d2('0x67')][_0x4fe682]),'WhatsappAccountId':Number(_0xefade6[_0x38d2('0x60')]['id'])});}return _0x541fcb;});}})[_0x38d2('0x1b')](respondWithResult(_0x34d426,null))[_0x38d2('0x26')](handleError(_0x34d426,null));};exports[_0x38d2('0x70')]=function(_0x276e42,_0xfa5ed1,_0x6c1b64){return db['WhatsappAccount'][_0x38d2('0x58')]({'where':{'id':_0x276e42[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0xfa5ed1,null))[_0x38d2('0x1b')](function(_0x204359){if(_0x204359){return _0x204359[_0x38d2('0x70')](_0x276e42[_0x38d2('0x42')][_0x38d2('0x67')])['then'](function(){if(_[_0x38d2('0x71')](_0x276e42['query']['ids'])){for(var _0x153655=0x0;_0x153655<_0x276e42[_0x38d2('0x42')]['ids'][_0x38d2('0x48')];_0x153655+=0x1){socket[_0x38d2('0x6e')](_0x38d2('0x72'),{'UserId':Number(_0x276e42['query'][_0x38d2('0x67')][_0x153655]),'WhatsappAccountId':Number(_0x276e42[_0x38d2('0x60')]['id'])});}}else{socket[_0x38d2('0x6e')](_0x38d2('0x72'),{'UserId':Number(_0x276e42[_0x38d2('0x42')][_0x38d2('0x67')]),'WhatsappAccountId':Number(_0x276e42['params']['id'])});}});}})[_0x38d2('0x1b')](respondWithStatusCode(_0xfa5ed1,null))[_0x38d2('0x26')](handleError(_0xfa5ed1,null));};exports['getAgents']=function(_0x2b1871,_0xd4a4a2,_0x231fe6){var _0x46a184={};var _0x3526cb={};var _0x346cf9;var _0x490106;return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x2b1871[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0xd4a4a2,null))[_0x38d2('0x1b')](function(_0x5140bb){if(_0x5140bb){_0x346cf9=_0x5140bb;_0x3526cb[_0x38d2('0x45')]=_['keys'](db[_0x38d2('0x73')][_0x38d2('0x3e')]);_0x3526cb[_0x38d2('0x42')]=_[_0x38d2('0x41')](_0x2b1871[_0x38d2('0x42')]);_0x3526cb[_0x38d2('0x43')]=_[_0x38d2('0x44')](_0x3526cb[_0x38d2('0x45')],_0x3526cb[_0x38d2('0x42')]);_0x46a184[_0x38d2('0x46')]=_['intersection'](_0x3526cb[_0x38d2('0x45')],qs[_0x38d2('0x47')](_0x2b1871[_0x38d2('0x42')][_0x38d2('0x47')]));_0x46a184[_0x38d2('0x46')]=_0x46a184['attributes']['length']?_0x46a184[_0x38d2('0x46')]:_0x3526cb[_0x38d2('0x45')];_0x46a184[_0x38d2('0x4b')]=qs[_0x38d2('0x4c')](_0x2b1871[_0x38d2('0x42')][_0x38d2('0x4c')]);_0x46a184['where']=qs['filters'](_['pick'](_0x2b1871[_0x38d2('0x42')],_0x3526cb['filters']));if(_0x2b1871[_0x38d2('0x42')]['filter']){_0x46a184['where']=_[_0x38d2('0x51')](_0x46a184[_0x38d2('0x4d')],{'$or':_[_0x38d2('0x3d')](_0x46a184['attributes'],function(_0x31a995){var _0x119ab5={};_0x119ab5[_0x31a995]={'$like':'%'+_0x2b1871[_0x38d2('0x42')][_0x38d2('0x4f')]+'%'};return _0x119ab5;})});}_0x46a184=_[_0x38d2('0x51')]({},_0x46a184,_0x2b1871[_0x38d2('0x52')]);return _0x346cf9[_0x38d2('0x74')](_0x46a184);}})['then'](function(_0x3f0815){if(_0x3f0815){_0x490106=_0x3f0815[_0x38d2('0x48')];if(!_0x2b1871['query'][_0x38d2('0x49')](_0x38d2('0x4a'))){_0x46a184[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x2b1871['query'][_0x38d2('0x2b')]);_0x46a184['offset']=qs[_0x38d2('0x29')](_0x2b1871['query'][_0x38d2('0x29')]);}return _0x346cf9[_0x38d2('0x74')](_0x46a184);}})[_0x38d2('0x1b')](function(_0x5f601d){if(_0x5f601d){return _0x5f601d?{'count':_0x490106,'rows':_0x5f601d}:null;}})[_0x38d2('0x1b')](respondWithResult(_0xd4a4a2,null))[_0x38d2('0x26')](handleError(_0xd4a4a2,null));};exports[_0x38d2('0x75')]=function(_0x47680b,_0xc9704f){var _0x7e72c=_0x47680b[_0x38d2('0x60')]['id'];var _0x345b7e=_0x47680b[_0x38d2('0x5f')];var _0x5ccda5=0xc8;var _0x1c31d8=null;return db['sequelize'][_0x38d2('0x76')]({'isolationLevel':db[_0x38d2('0x77')]['Transaction'][_0x38d2('0x78')][_0x38d2('0x79')]},function(_0x4fe28b){return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x7e72c},'transaction':_0x4fe28b})[_0x38d2('0x1b')](function(_0x11dec6){if(_0x11dec6){return db[_0x38d2('0x7a')][_0x38d2('0x36')]({'where':{'WhatsappAccountId':_0x7e72c},'transaction':_0x4fe28b})[_0x38d2('0x1b')](function(){var _0x8f4232=_[_0x38d2('0x3d')](_0x345b7e,function(_0x106e61){_0x106e61[_0x38d2('0x62')]=_0x7e72c;return _0x106e61;});return db['WhatsappApplication'][_0x38d2('0x7b')](_0x8f4232,{'transaction':_0x4fe28b});});}else{_0x5ccda5=0x194;_0x1c31d8=[];}});})[_0x38d2('0x1b')](function(){if(_0x5ccda5!==0x194){return db[_0x38d2('0x7a')][_0x38d2('0x7c')]({'where':{'WhatsappAccountId':_0x7e72c},'order':_0x38d2('0x7d')})[_0x38d2('0x1b')](function(_0x34dd21){_0x1c31d8=_0x34dd21;});}})[_0x38d2('0x26')](function(_0x3268d8){_0x5ccda5=0x1f4;logger[_0x38d2('0x22')](_0x3268d8[_0x38d2('0x37')]);if(_0x3268d8[_0x38d2('0x38')]){delete _0x3268d8['name'];}_0x1c31d8=_0x3268d8;})['finally'](function(){if(_0x1c31d8===null){_0xc9704f[_0x38d2('0x27')](_0x5ccda5);}else{if(_0x5ccda5===0x1f4){_0xc9704f[_0x38d2('0x2d')](_0x5ccda5)[_0x38d2('0x39')](_0x1c31d8);}else{_0xc9704f[_0x38d2('0x2d')](_0x5ccda5)[_0x38d2('0x30')](_0x1c31d8);}}});};exports[_0x38d2('0x7e')]=function(_0x288f12,_0x1a24bf,_0x486b31){var _0x51a779={};var _0x36c0e7={};var _0x20fbdc;var _0x2cc182;return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x288f12[_0x38d2('0x60')]['id']}})['then'](handleEntityNotFound(_0x1a24bf,null))['then'](function(_0x4a5119){if(_0x4a5119){_0x20fbdc=_0x4a5119;_0x36c0e7[_0x38d2('0x45')]=_[_0x38d2('0x41')](db[_0x38d2('0x7a')][_0x38d2('0x3e')]);_0x36c0e7[_0x38d2('0x42')]=_[_0x38d2('0x41')](_0x288f12[_0x38d2('0x42')]);_0x36c0e7['filters']=_[_0x38d2('0x44')](_0x36c0e7[_0x38d2('0x45')],_0x36c0e7[_0x38d2('0x42')]);_0x51a779[_0x38d2('0x46')]=_[_0x38d2('0x44')](_0x36c0e7['model'],qs[_0x38d2('0x47')](_0x288f12[_0x38d2('0x42')]['fields']));_0x51a779[_0x38d2('0x46')]=_0x51a779[_0x38d2('0x46')][_0x38d2('0x48')]?_0x51a779[_0x38d2('0x46')]:_0x36c0e7[_0x38d2('0x45')];_0x51a779['order']=qs[_0x38d2('0x4c')](_0x288f12[_0x38d2('0x42')][_0x38d2('0x4c')]);_0x51a779['where']=qs[_0x38d2('0x43')](_['pick'](_0x288f12['query'],_0x36c0e7['filters']));if(_0x288f12[_0x38d2('0x42')][_0x38d2('0x4f')]){_0x51a779[_0x38d2('0x4d')]=_[_0x38d2('0x51')](_0x51a779[_0x38d2('0x4d')],{'$or':_[_0x38d2('0x3d')](_0x51a779[_0x38d2('0x46')],function(_0x164355){var _0x1b7bd1={};_0x1b7bd1[_0x164355]={'$like':'%'+_0x288f12[_0x38d2('0x42')]['filter']+'%'};return _0x1b7bd1;})});}_0x51a779=_['merge']({},_0x51a779,_0x288f12[_0x38d2('0x52')]);return _0x20fbdc['getApplications'](_0x51a779);}})['then'](function(_0x2deade){if(_0x2deade){_0x2cc182=_0x2deade[_0x38d2('0x48')];if(!_0x288f12[_0x38d2('0x42')][_0x38d2('0x49')](_0x38d2('0x4a'))){_0x51a779[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x288f12[_0x38d2('0x42')][_0x38d2('0x2b')]);_0x51a779[_0x38d2('0x29')]=qs['offset'](_0x288f12[_0x38d2('0x42')][_0x38d2('0x29')]);}return _0x20fbdc[_0x38d2('0x7e')](_0x51a779);}})['then'](function(_0x48b825){if(_0x48b825){return _0x48b825?{'count':_0x2cc182,'rows':_0x48b825}:null;}})[_0x38d2('0x1b')](respondWithResult(_0x1a24bf,null))['catch'](handleError(_0x1a24bf,null));};exports['notify']=function(_0x439dd0,_0x547244,_0x1f974d){var _0x268eac={'channel':_0x38d2('0x7f')};var _0x37e449=[];var _0x4de41d=[];var _0x18a14b={};return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0x439dd0[_0x38d2('0x60')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x38d2('0x80')}]})[_0x38d2('0x1b')](handleEntityNotFound(_0x547244,null))[_0x38d2('0x1b')](function(_0x40d8b5){_0x268eac[_0x38d2('0x81')]=_0x40d8b5;if(_0x268eac[_0x38d2('0x81')]&&_0x268eac['account'][_0x38d2('0x3f')]===_0x38d2('0x82')&&_0x439dd0['body'][_0x38d2('0x83')]){if(_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x83')]['length']===0x0)return;if(_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x83')][0x0][_0x38d2('0x84')]!==_0x38d2('0x85'))return;return db[_0x38d2('0x86')][_0x38d2('0x33')]({'read':!![],'readAt':_0x439dd0['body']['statuses'][0x0][_0x38d2('0x87')]},{'where':{'messageId':_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x83')][0x0][_0x38d2('0x88')]},'individualHooks':!![]})['then'](function(_0x356827){return _0x547244[_0x38d2('0x2d')](0xc8)[_0x38d2('0x30')](_0x356827);});}_0x268eac[_0x38d2('0x89')]=_['orderBy'](_0x40d8b5[_0x38d2('0x80')],[_0x38d2('0x7d')],[_0x38d2('0x8a')]);if(_0x268eac[_0x38d2('0x81')][_0x38d2('0x80')]){delete _0x268eac[_0x38d2('0x81')][_0x38d2('0x80')];}return db[_0x38d2('0x8b')]['describe']()[_0x38d2('0x1b')](function(_0x1a74d7){if(!_0x1a74d7){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))]('no\x20available\x20attributes');}_0x37e449=_[_0x38d2('0x8e')](_['keys'](_0x1a74d7),[_0x38d2('0x8f'),_0x38d2('0x90')]);_0x4de41d=_[_0x38d2('0x8e')](_['keys'](_0x1a74d7),[_0x38d2('0x8f'),'updatedAt',_0x38d2('0x91'),_0x38d2('0x92')]);_0x268eac[_0x38d2('0x5f')]={'mapKey':_0x38d2('0x93')};if(_0x268eac['account']&&_0x268eac[_0x38d2('0x81')][_0x38d2('0x3f')]==='twilio'){_0x268eac['body'][_0x38d2('0x94')]=_0x439dd0['body'][_0x38d2('0x95')][_0x38d2('0x96')](_0x38d2('0x97'),'');_0x268eac[_0x38d2('0x5f')][_0x38d2('0x5f')]=_0x439dd0['body'][_0x38d2('0x98')];_0x268eac[_0x38d2('0x5f')][_0x38d2('0x99')]=_0x439dd0[_0x38d2('0x5f')]['MessageSid'];}if(_0x268eac[_0x38d2('0x81')]&&_0x268eac[_0x38d2('0x81')][_0x38d2('0x3f')]===_0x38d2('0x82')){_0x268eac[_0x38d2('0x5f')][_0x38d2('0x94')]=_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x9a')][0x0][_0x38d2('0x94')];_0x268eac[_0x38d2('0x5f')][_0x38d2('0x5f')]=_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x9a')][0x0]['message'][_0x38d2('0x5f')];_0x268eac['body'][_0x38d2('0x99')]=_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x9a')][0x0][_0x38d2('0x88')];}if(_0x268eac[_0x38d2('0x5f')]['id']){delete _0x268eac['body']['id'];}if(_[_0x38d2('0x9b')](_0x268eac[_0x38d2('0x5f')][_0x38d2('0x94')])){throw new db[(_0x38d2('0x8c'))]['ValidationError'](_0x38d2('0x9c'));}if(_[_0x38d2('0x9b')](_0x268eac['body']['body'])||_0x268eac[_0x38d2('0x5f')][_0x38d2('0x5f')]===''){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))](_0x38d2('0x9d'));}if(_['isNil'](_0x268eac['body'][_0x38d2('0x9e')])){throw new db[(_0x38d2('0x8c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4de41d);}if(!_[_0x38d2('0x9f')](_0x4de41d,_0x268eac[_0x38d2('0x5f')][_0x38d2('0x9e')])){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))](_0x38d2('0xa0')+_0x4de41d);}_0x18a14b[_0x268eac[_0x38d2('0x5f')][_0x38d2('0x9e')]]=_0x268eac[_0x38d2('0x5f')]['from'];return db[_0x38d2('0xa1')]['find']({'where':{'id':_0x268eac['account']['ListId']},'include':[{'model':db[_0x38d2('0x8b')],'as':_0x38d2('0xa2'),'where':_0x18a14b,'limit':0x1,'order':[[_0x38d2('0x90'),_0x38d2('0xa3')]]}]});})[_0x38d2('0x1b')](handleEntityNotFound(_0x547244,null))[_0x38d2('0x1b')](function(_0x3110a6){if(_0x3110a6){_0x268eac[_0x38d2('0xa4')]=_['omit'](_0x3110a6,['Contacts']);if(_0x3110a6[_0x38d2('0xa2')][_0x38d2('0x48')]){return _0x3110a6[_0x38d2('0xa2')][0x0];}var _0x27f2f6=_['defaults'](_0x268eac[_0x38d2('0x5f')],{'firstName':_0x268eac[_0x38d2('0x5f')][_0x38d2('0x94')],'ListId':_0x3110a6['id']});_0x27f2f6[_0x268eac[_0x38d2('0x5f')][_0x38d2('0x9e')]]=_0x268eac[_0x38d2('0x5f')]['from'];return db[_0x38d2('0x8b')][_0x38d2('0x59')](_0x27f2f6,{'fields':_0x37e449,'raw':!![]});}})[_0x38d2('0x1b')](handleEntityNotFound(_0x547244,null))[_0x38d2('0x1b')](function(_0x267014){if(_0x267014){_0x268eac[_0x38d2('0xa5')]=_0x267014;var _0x1a2daf={'ContactId':_0x267014['id'],'phone':_0x268eac[_0x38d2('0x5f')][_0x38d2('0x94')],'WhatsappAccountId':_0x439dd0[_0x38d2('0x60')]['id']};var _0x3b2187={'ContactId':_0x267014['id'],'WhatsappAccountId':_0x439dd0[_0x38d2('0x60')]['id'],'closed':![]};return db[_0x38d2('0xa6')][_0x38d2('0x58')]({'where':_0x3b2187})[_0x38d2('0x1b')](function(_0x5f2e61){if(_0x5f2e61){return[_0x5f2e61,![]];}return db[_0x38d2('0xa6')][_0x38d2('0x59')](_0x1a2daf)[_0x38d2('0x1b')](function(_0x9415ef){return[_0x9415ef,!![]];});});}})[_0x38d2('0xa7')](function(_0x3b27d4,_0x135d5a){_0x268eac[_0x38d2('0xa8')]=_0x3b27d4[_0x38d2('0x34')]({'plain':!![]});_0x268eac[_0x38d2('0xa8')][_0x38d2('0xa9')]=![];if(_0x135d5a){if(_0x268eac['account']['autoclose']){_0x268eac[_0x38d2('0x89')][_0x38d2('0xaa')]({'id':0x0,'priority':_0x268eac[_0x38d2('0x89')]['length']+0x1,'app':_0x38d2('0xab'),'appdata':_0x38d2('0xac'),'interval':_0x38d2('0xad')});}_0x268eac[_0x38d2('0xa8')][_0x38d2('0xa9')]=!![];}return db[_0x38d2('0x86')][_0x38d2('0x59')]({'phone':_0x268eac['body'][_0x38d2('0x94')],'messageId':_0x268eac[_0x38d2('0x5f')][_0x38d2('0x99')],'body':_0x268eac[_0x38d2('0x5f')][_0x38d2('0x5f')],'WhatsappAccountId':_0x439dd0[_0x38d2('0x60')]['id'],'WhatsappInteractionId':_0x3b27d4['id'],'direction':'in','ContactId':_0x3b27d4[_0x38d2('0xae')],'AttachmentId':_0x268eac[_0x38d2('0x5f')][_0x38d2('0xaf')]});})[_0x38d2('0x1b')](function(_0x4522ba){_0x268eac[_0x38d2('0x24')]=_0x4522ba;if(!_0x268eac[_0x38d2('0xa8')]['UserId'])return;return db['User'][_0x38d2('0x58')]({'attributes':['id',_0x38d2('0x38')],'where':{'id':_0x268eac[_0x38d2('0xa8')][_0x38d2('0xb0')]}});})['then'](function(_0x50e031){if(_0x50e031){_0x268eac[_0x38d2('0x89')][_0x38d2('0xb1')]({'id':0x0,'priority':0x0,'app':_0x38d2('0xb2'),'appdata':_0x50e031[_0x38d2('0x38')]+','+(_0x268eac[_0x38d2('0x81')][_0x38d2('0xb3')]||0xa),'interval':_0x38d2('0xad')});}if(!_0x268eac[_0x38d2('0xa8')][_0x38d2('0xb4')])return;return db[_0x38d2('0xb5')][_0x38d2('0x58')]({'attributes':['id',_0x38d2('0x38')],'where':{'id':_0x268eac[_0x38d2('0xa8')][_0x38d2('0xb4')]}});})[_0x38d2('0x1b')](function(_0x1bc44d){if(_0x1bc44d){_0x268eac[_0x38d2('0x89')][_0x38d2('0xb1')]({'id':0x0,'priority':0x1,'app':_0x38d2('0xb6'),'appdata':_0x1bc44d[_0x38d2('0x38')]+','+(_0x268eac[_0x38d2('0x81')][_0x38d2('0xb7')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x38d2('0xb8'),'startRouting',_0x268eac);})['then'](function(_0x1f5a7f){if(_0x1f5a7f){var _0x27439d=0xc8;var _0x3876dd=_0x38d2('0xb9');logger[_0x38d2('0x1c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3876dd,_0x27439d,_0x38d2('0xba'));logger[_0x38d2('0x1f')](_0x38d2('0xbb'),_0x3876dd,_0x27439d,_0x38d2('0xba'),JSON[_0x38d2('0x21')](_0x1f5a7f));if(_0x268eac[_0x38d2('0x81')]['type']===_0x38d2('0xbc')){return _0x547244[_0x38d2('0x2d')](_0x27439d)[_0x38d2('0x2e')](_0x38d2('0xbd'),_0x38d2('0xbe'))[_0x38d2('0x39')](_0x38d2('0xbf'));}else{return _0x547244[_0x38d2('0x2d')](_0x27439d)['json'](_0x1f5a7f);}}});})[_0x38d2('0x26')](handleError(_0x547244,null));};exports[_0x38d2('0x39')]=function(_0x1bcdba,_0x30b47d,_0x56f2a2){var _0x12d76b,_0x17294f,_0x373907;if(_['isNil'](_0x1bcdba[_0x38d2('0x5f')][_0x38d2('0x5f')])||_0x1bcdba[_0x38d2('0x5f')][_0x38d2('0x5f')]===''){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x38d2('0x9b')](_0x1bcdba[_0x38d2('0x5f')]['to'])){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))](_0x38d2('0xc0'));}_0x12d76b=_0x1bcdba[_0x38d2('0x5f')]['to'];return db[_0x38d2('0x53')]['find']({'where':{'id':_0x1bcdba[_0x38d2('0x60')]['id']},'include':[{'model':db[_0x38d2('0xa1')],'as':'List','include':[{'model':db[_0x38d2('0x8b')],'as':_0x38d2('0xa2'),'where':{'mobile':_0x12d76b},'limit':0x1,'order':[['updatedAt',_0x38d2('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x30b47d,null))[_0x38d2('0x1b')](function(_0x536d8b){if(_0x536d8b&&_0x536d8b[_0x38d2('0xc1')]){_0x17294f=_0x536d8b[_0x38d2('0x34')]({'plain':!![]});if(_0x17294f[_0x38d2('0xc1')]&&_0x17294f[_0x38d2('0xc1')][_0x38d2('0xa2')][_0x38d2('0x48')]){return _0x17294f[_0x38d2('0xc1')][_0x38d2('0xa2')][0x0];}return db[_0x38d2('0x8b')][_0x38d2('0x59')](_[_0x38d2('0x17')](_0x1bcdba[_0x38d2('0x5f')],{'firstName':_0x12d76b,'mobile':_0x12d76b,'phone':_0x12d76b,'ListId':_0x17294f['ListId']}));}})[_0x38d2('0x1b')](handleEntityNotFound(_0x30b47d,null))[_0x38d2('0x1b')](function(_0x2994b0){if(_0x2994b0){_0x373907=_0x2994b0;return db[_0x38d2('0xa6')][_0x38d2('0x58')]({'where':{'ContactId':_0x373907['id'],'closed':![],'WhatsappAccountId':_0x17294f['id']}})[_0x38d2('0x1b')](function(_0x3be2a5){if(_0x3be2a5){return[_0x3be2a5,![]];}return db[_0x38d2('0xa6')][_0x38d2('0x59')]({'UserId':_0x1bcdba['user']['id'],'ContactId':_0x373907['id'],'WhatsappAccountId':_0x17294f['id'],'phone':_0x12d76b,'firstMsgDirection':_0x38d2('0xc2'),'Messages':[_['merge'](_0x1bcdba['body'],{'read':![],'body':_0x1bcdba[_0x38d2('0x5f')]['body'],'phone':_0x12d76b,'WhatsappAccountId':_0x17294f['id'],'UserId':_0x1bcdba[_0x38d2('0x5a')]['id'],'ContactId':_0x373907['id']})]},{'include':[{'model':db[_0x38d2('0x86')],'as':_0x38d2('0xc3')}]})[_0x38d2('0x1b')](function(_0x3869d5){return[_0x3869d5,!![]];});});}})[_0x38d2('0xa7')](function(_0x1fde42,_0xdbab87){if(_0xdbab87){return _0x1fde42;}return db[_0x38d2('0x86')][_0x38d2('0x59')](_[_0x38d2('0x51')](_0x1bcdba[_0x38d2('0x5f')],{'read':![],'body':_0x1bcdba[_0x38d2('0x5f')]['body'],'phone':_0x12d76b,'WhatsappAccountId':_0x17294f['id'],'WhatsappInteractionId':_0x1fde42['id'],'UserId':_0x1bcdba[_0x38d2('0x5a')]['id'],'ContactId':_0x373907['id']}))[_0x38d2('0x1b')](function(_0x561df6){_0x1fde42[_0x38d2('0xc4')]['Messages']=[];_0x1fde42[_0x38d2('0xc4')][_0x38d2('0xc3')][_0x38d2('0xaa')](_0x561df6[_0x38d2('0xc4')]);return _0x1fde42;});})['then'](respondWithResult(_0x30b47d,null))['catch'](handleError(_0x30b47d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2c03342..4cedfbe 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 _0x5285=['hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x45423d,_0x5b9263){var _0x2085d6=function(_0x4d4f86){while(--_0x4d4f86){_0x45423d['push'](_0x45423d['shift']());}};_0x2085d6(++_0x5b9263);}(_0x5285,0xca));var _0x5528=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x5285[_0xffa198];return _0x1e4b50;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x5528('0x0'))['db'][_0x5528('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5528('0x2')](0x0);var events={'afterCreate':_0x5528('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a905e){return function(_0x36569a,_0x29ee9d,_0x74ef5){WhatsappAccountEvents[_0x5528('0x4')](_0x5a905e+':'+_0x36569a['id'],_0x36569a);WhatsappAccountEvents['emit'](_0x5a905e,_0x36569a);_0x74ef5(null);};}for(var e in events){if(events[_0x5528('0x5')](e)){var event=events[e];WhatsappAccount[_0x5528('0x6')](e,emitEvent(event));}}module[_0x5528('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x2d74=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x498f45,_0x33a0d7){var _0x5dedf1=function(_0x224849){while(--_0x224849){_0x498f45['push'](_0x498f45['shift']());}};_0x5dedf1(++_0x33a0d7);}(_0x2d74,0xd9));var _0x42d7=function(_0x507303,_0x5bba97){_0x507303=_0x507303-0x0;var _0x57c49b=_0x2d74[_0x507303];return _0x57c49b;};'use strict';var EventEmitter=require(_0x42d7('0x0'));var WhatsappAccount=require(_0x42d7('0x1'))['db'][_0x42d7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x42d7('0x3')](0x0);var events={'afterCreate':_0x42d7('0x4'),'afterUpdate':_0x42d7('0x5'),'afterDestroy':_0x42d7('0x6')};function emitEvent(_0xf39c04){return function(_0x5a1dfd,_0x45942a,_0xe562de){WhatsappAccountEvents[_0x42d7('0x7')](_0xf39c04+':'+_0x5a1dfd['id'],_0x5a1dfd);WhatsappAccountEvents[_0x42d7('0x7')](_0xf39c04,_0x5a1dfd);_0xe562de(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x42d7('0x8')](e,emitEvent(event));}}module[_0x42d7('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 5e7a065..9d55d34 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 _0x2f44=['exports','WhatsappAccount','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5cab7e,_0x464e20){var _0x35c71f=function(_0x5455e6){while(--_0x5455e6){_0x5cab7e['push'](_0x5cab7e['shift']());}};_0x35c71f(++_0x464e20);}(_0x2f44,0x19a));var _0x42f4=function(_0x3d6135,_0x256136){_0x3d6135=_0x3d6135-0x0;var _0x16f3c1=_0x2f44[_0x3d6135];return _0x16f3c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42f4('0x0'))(_0x42f4('0x1'));var moment=require('moment');var BPromise=require(_0x42f4('0x2'));var rp=require(_0x42f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42f4('0x4'));var config=require(_0x42f4('0x5'));var attributes=require('./whatsappAccount.attributes');module[_0x42f4('0x6')]=function(_0x318886,_0x3bab68){return _0x318886['define'](_0x42f4('0x7'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b0d=['../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xd4adad,_0x1f3b36){var _0x2d8f88=function(_0x20d0de){while(--_0x20d0de){_0xd4adad['push'](_0xd4adad['shift']());}};_0x2d8f88(++_0x1f3b36);}(_0x3b0d,0x1d9));var _0xd3b0=function(_0x3ef031,_0x3d8cbf){_0x3ef031=_0x3ef031-0x0;var _0x49e70d=_0x3b0d[_0x3ef031];return _0x49e70d;};'use strict';var _=require(_0xd3b0('0x0'));var util=require(_0xd3b0('0x1'));var logger=require(_0xd3b0('0x2'))('api');var moment=require(_0xd3b0('0x3'));var BPromise=require(_0xd3b0('0x4'));var rp=require(_0xd3b0('0x5'));var fs=require('fs');var path=require(_0xd3b0('0x6'));var rimraf=require('rimraf');var config=require(_0xd3b0('0x7'));var attributes=require(_0xd3b0('0x8'));module['exports']=function(_0x5a6d64,_0x3531d1){return _0x5a6d64[_0xd3b0('0x9')](_0xd3b0('0xa'),attributes,{'tableName':_0xd3b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 4cbee9c..03236d6 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 _0x1e82=['localhost','socket.io-emitter','register','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1e82,0x8b));var _0x21e8=function(_0x10f46e,_0x3e9e6d){_0x10f46e=_0x10f46e-0x0;var _0x433756=_0x1e82[_0x10f46e];return _0x433756;};'use strict';var _=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var moment=require(_0x21e8('0x2'));var BPromise=require(_0x21e8('0x3'));var rs=require(_0x21e8('0x4'));var fs=require('fs');var Redis=require(_0x21e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21e8('0x6'));var logger=require(_0x21e8('0x7'))('rpc');var config=require(_0x21e8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21e8('0x9')][_0x21e8('0xa')]({'port':0x232a});config[_0x21e8('0xb')]=_[_0x21e8('0xc')](config['redis'],{'host':_0x21e8('0xd'),'port':0x18eb});var socket=require(_0x21e8('0xe'))(new Redis(config[_0x21e8('0xb')]));require('./whatsappAccount.socket')[_0x21e8('0xf')](socket);function respondWithRpcPromise(_0x20aae0,_0x2f4a82,_0x3fa1da){return new BPromise(function(_0x5c6d17,_0x4d561a){return client[_0x21e8('0x10')](_0x20aae0,_0x3fa1da)['then'](function(_0x131349){logger[_0x21e8('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x2f4a82,_0x21e8('0x12'));logger['debug'](_0x21e8('0x13'),_0x2f4a82,_0x21e8('0x12'),JSON[_0x21e8('0x14')](_0x131349));if(_0x131349['error']){if(_0x131349[_0x21e8('0x15')]['code']===0x1f4){logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x131349[_0x21e8('0x15')]['message']);return _0x4d561a(_0x131349['error'][_0x21e8('0x17')]);}logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x131349[_0x21e8('0x15')][_0x21e8('0x17')]);return _0x5c6d17(_0x131349[_0x21e8('0x15')][_0x21e8('0x17')]);}else{logger[_0x21e8('0x11')](_0x21e8('0x16'),_0x2f4a82,'request\x20sent');_0x5c6d17(_0x131349[_0x21e8('0x18')]['message']);}})['catch'](function(_0x32ec05){logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x32ec05);_0x4d561a(_0x32ec05);});});}exports[_0x21e8('0x19')]=function(_0x5ca78c){var _0x45243f=this;return new Promise(function(_0x1be10b,_0x25b678){return db[_0x21e8('0x1a')][_0x21e8('0x1b')]({'raw':_0x5ca78c[_0x21e8('0x1c')]?_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x1d')]===undefined?!![]:![]:!![],'where':_0x5ca78c['options']?_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x1e')]||null:null,'attributes':_0x5ca78c['options']?_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x1f')]||null:null,'include':_0x5ca78c[_0x21e8('0x1c')]?_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x20')]?_[_0x21e8('0x21')](_0x5ca78c[_0x21e8('0x1c')][_0x21e8('0x20')],function(_0x565c96){return{'model':db[_0x565c96[_0x21e8('0x22')]],'as':_0x565c96['as'],'attributes':_0x565c96['attributes'],'include':_0x565c96[_0x21e8('0x20')]?_[_0x21e8('0x21')](_0x565c96[_0x21e8('0x20')],function(_0x559509){return{'model':db[_0x559509[_0x21e8('0x22')]],'as':_0x559509['as'],'attributes':_0x559509['attributes'],'include':_0x559509[_0x21e8('0x20')]?_[_0x21e8('0x21')](_0x559509[_0x21e8('0x20')],function(_0x4e7b45){return{'model':db[_0x4e7b45[_0x21e8('0x22')]],'as':_0x4e7b45['as'],'attributes':_0x4e7b45[_0x21e8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x21e8('0x23')](function(_0x5e79c5){logger[_0x21e8('0x11')](_0x21e8('0x19'),_0x5ca78c);logger[_0x21e8('0x24')](_0x21e8('0x19'),_0x5ca78c,JSON[_0x21e8('0x14')](_0x5e79c5));_0x1be10b(_0x5e79c5);})[_0x21e8('0x25')](function(_0x2116f2){logger[_0x21e8('0x15')](_0x21e8('0x19'),_0x2116f2[_0x21e8('0x17')],_0x5ca78c);_0x25b678(_0x45243f[_0x21e8('0x15')](0x1f4,_0x2116f2[_0x21e8('0x17')]));});});}; \ No newline at end of file +var _0x96ff=['error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','map','include','attributes','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c706c,_0x57ebb7){var _0x1d8dc7=function(_0x50a0f3){while(--_0x50a0f3){_0x4c706c['push'](_0x4c706c['shift']());}};_0x1d8dc7(++_0x57ebb7);}(_0x96ff,0xd8));var _0xf96f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x96ff[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf96f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf96f('0x1'));var db=require(_0xf96f('0x2'))['db'];var utils=require(_0xf96f('0x3'));var logger=require(_0xf96f('0x4'))(_0xf96f('0x5'));var config=require(_0xf96f('0x6'));var jayson=require(_0xf96f('0x7'));var client=jayson[_0xf96f('0x8')][_0xf96f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf96f('0xa')],{'host':_0xf96f('0xb'),'port':0x18eb});var socket=require(_0xf96f('0xc'))(new Redis(config['redis']));require(_0xf96f('0xd'))[_0xf96f('0xe')](socket);function respondWithRpcPromise(_0x22dc88,_0x40de4c,_0xed4cda){return new BPromise(function(_0x2d40a7,_0x1314ba){return client['request'](_0x22dc88,_0xed4cda)[_0xf96f('0xf')](function(_0x5c34da){logger[_0xf96f('0x10')](_0xf96f('0x11'),_0x40de4c,_0xf96f('0x12'));logger[_0xf96f('0x13')](_0xf96f('0x14'),_0x40de4c,'request\x20sent',JSON[_0xf96f('0x15')](_0x5c34da));if(_0x5c34da[_0xf96f('0x16')]){if(_0x5c34da[_0xf96f('0x16')]['code']===0x1f4){logger['error'](_0xf96f('0x11'),_0x40de4c,_0x5c34da['error'][_0xf96f('0x17')]);return _0x1314ba(_0x5c34da[_0xf96f('0x16')][_0xf96f('0x17')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x40de4c,_0x5c34da[_0xf96f('0x16')][_0xf96f('0x17')]);return _0x2d40a7(_0x5c34da['error']['message']);}else{logger[_0xf96f('0x10')](_0xf96f('0x11'),_0x40de4c,_0xf96f('0x12'));_0x2d40a7(_0x5c34da[_0xf96f('0x18')][_0xf96f('0x17')]);}})[_0xf96f('0x19')](function(_0x33a4b8){logger['error'](_0xf96f('0x11'),_0x40de4c,_0x33a4b8);_0x1314ba(_0x33a4b8);});});}exports[_0xf96f('0x1a')]=function(_0x3ec023){var _0x57b902=this;return new Promise(function(_0x1f54d8,_0x419402){return db[_0xf96f('0x1b')][_0xf96f('0x1c')]({'raw':_0x3ec023['options']?_0x3ec023[_0xf96f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3ec023[_0xf96f('0x1d')]?_0x3ec023[_0xf96f('0x1d')][_0xf96f('0x1e')]||null:null,'attributes':_0x3ec023[_0xf96f('0x1d')]?_0x3ec023[_0xf96f('0x1d')]['attributes']||null:null,'include':_0x3ec023[_0xf96f('0x1d')]?_0x3ec023[_0xf96f('0x1d')]['include']?_[_0xf96f('0x1f')](_0x3ec023[_0xf96f('0x1d')][_0xf96f('0x20')],function(_0x1d1238){return{'model':db[_0x1d1238['model']],'as':_0x1d1238['as'],'attributes':_0x1d1238[_0xf96f('0x21')],'include':_0x1d1238[_0xf96f('0x20')]?_[_0xf96f('0x1f')](_0x1d1238['include'],function(_0x3c1be4){return{'model':db[_0x3c1be4['model']],'as':_0x3c1be4['as'],'attributes':_0x3c1be4[_0xf96f('0x21')],'include':_0x3c1be4['include']?_['map'](_0x3c1be4[_0xf96f('0x20')],function(_0x66edc0){return{'model':db[_0x66edc0['model']],'as':_0x66edc0['as'],'attributes':_0x66edc0[_0xf96f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf96f('0xf')](function(_0x515405){logger[_0xf96f('0x10')](_0xf96f('0x1a'),_0x3ec023);logger['debug'](_0xf96f('0x1a'),_0x3ec023,JSON[_0xf96f('0x15')](_0x515405));_0x1f54d8(_0x515405);})[_0xf96f('0x19')](function(_0x42c516){logger['error']('ShowWhatsappAccount',_0x42c516[_0xf96f('0x17')],_0x3ec023);_0x419402(_0x57b902[_0xf96f('0x16')](0x1f4,_0x42c516[_0xf96f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2afe242..3318210 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 _0x4c3b=['./whatsappAccount.events','save','remove','update','emit','length','whatsappAccount:'];(function(_0x2d48c8,_0x235edf){var _0x2d14b7=function(_0x4235cb){while(--_0x4235cb){_0x2d48c8['push'](_0x2d48c8['shift']());}};_0x2d14b7(++_0x235edf);}(_0x4c3b,0xe0));var _0xb4c3=function(_0x1eaa26,_0x51b276){_0x1eaa26=_0x1eaa26-0x0;var _0x2aa6f9=_0x4c3b[_0x1eaa26];return _0x2aa6f9;};'use strict';var WhatsappAccountEvents=require(_0xb4c3('0x0'));var events=[_0xb4c3('0x1'),_0xb4c3('0x2'),_0xb4c3('0x3')];function createListener(_0x1c109e,_0x1409c6){return function(_0x53797a){_0x1409c6[_0xb4c3('0x4')](_0x1c109e,_0x53797a);};}function removeListener(_0x435418,_0x494912){return function(){WhatsappAccountEvents['removeListener'](_0x435418,_0x494912);};}exports['register']=function(_0x190c03){for(var _0x2ef280=0x0,_0x15f74e=events[_0xb4c3('0x5')];_0x2ef280<_0x15f74e;_0x2ef280++){var _0x3ddcbb=events[_0x2ef280];var _0x59753e=createListener(_0xb4c3('0x6')+_0x3ddcbb,_0x190c03);WhatsappAccountEvents['on'](_0x3ddcbb,_0x59753e);}}; \ No newline at end of file +var _0x28bf=['length','whatsappAccount:','./whatsappAccount.events','remove','update','removeListener'];(function(_0x4003c5,_0x54bfbf){var _0x2f5972=function(_0x2dfcf4){while(--_0x2dfcf4){_0x4003c5['push'](_0x4003c5['shift']());}};_0x2f5972(++_0x54bfbf);}(_0x28bf,0x1ac));var _0xf28b=function(_0x76d02c,_0x202df1){_0x76d02c=_0x76d02c-0x0;var _0x25cc97=_0x28bf[_0x76d02c];return _0x25cc97;};'use strict';var WhatsappAccountEvents=require(_0xf28b('0x0'));var events=['save',_0xf28b('0x1'),_0xf28b('0x2')];function createListener(_0xd65f8e,_0x1ebbd3){return function(_0x243c79){_0x1ebbd3['emit'](_0xd65f8e,_0x243c79);};}function removeListener(_0x2b278a,_0x5c68cc){return function(){WhatsappAccountEvents[_0xf28b('0x3')](_0x2b278a,_0x5c68cc);};}exports['register']=function(_0x4f3dbb){for(var _0x5ab75f=0x0,_0x5177ce=events[_0xf28b('0x4')];_0x5ab75f<_0x5177ce;_0x5ab75f++){var _0x1276a7=events[_0x5ab75f];var _0x178edc=createListener(_0xf28b('0x5')+_0x1276a7,_0x4f3dbb);WhatsappAccountEvents['on'](_0x1276a7,_0x178edc);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index bd51ac0..e2d0f6b 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 _0xb978=['post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x734698,_0x4c1bbd){var _0x3a5a6b=function(_0x2107ef){while(--_0x2107ef){_0x734698['push'](_0x734698['shift']());}};_0x3a5a6b(++_0x4c1bbd);}(_0xb978,0x124));var _0x8b97=function(_0x5f55d9,_0x37b594){_0x5f55d9=_0x5f55d9-0x0;var _0x35f3b0=_0xb978[_0x5f55d9];return _0x35f3b0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8b97('0x0'));var timeout=require(_0x8b97('0x1'));var express=require(_0x8b97('0x2'));var router=express[_0x8b97('0x3')]();var fs_extra=require(_0x8b97('0x4'));var auth=require(_0x8b97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b97('0x6'));var controller=require(_0x8b97('0x7'));router[_0x8b97('0x8')]('/',auth[_0x8b97('0x9')](),controller[_0x8b97('0xa')]);router['get'](_0x8b97('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8b97('0xc')]('/',auth[_0x8b97('0x9')](),controller[_0x8b97('0xd')]);router[_0x8b97('0xe')](_0x8b97('0xb'),auth[_0x8b97('0x9')](),controller[_0x8b97('0xf')]);router[_0x8b97('0x10')](_0x8b97('0xb'),auth[_0x8b97('0x9')](),controller[_0x8b97('0x11')]);module[_0x8b97('0x12')]=router; \ No newline at end of file +var _0x4fd5=['show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','/:id','isAuthenticated'];(function(_0x1cd585,_0x54276b){var _0x3ca87f=function(_0x224de8){while(--_0x224de8){_0x1cd585['push'](_0x1cd585['shift']());}};_0x3ca87f(++_0x54276b);}(_0x4fd5,0x102));var _0x54fd=function(_0x305d8d,_0x2c2d2d){_0x305d8d=_0x305d8d-0x0;var _0x439619=_0x4fd5[_0x305d8d];return _0x439619;};'use strict';var multer=require(_0x54fd('0x0'));var util=require(_0x54fd('0x1'));var path=require(_0x54fd('0x2'));var timeout=require(_0x54fd('0x3'));var express=require(_0x54fd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x54fd('0x5'));var interaction=require(_0x54fd('0x6'));var config=require(_0x54fd('0x7'));var controller=require(_0x54fd('0x8'));router[_0x54fd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x54fd('0x9')](_0x54fd('0xa'),auth[_0x54fd('0xb')](),controller[_0x54fd('0xc')]);router[_0x54fd('0xd')]('/',auth[_0x54fd('0xb')](),controller[_0x54fd('0xe')]);router['put'](_0x54fd('0xa'),auth[_0x54fd('0xb')](),controller[_0x54fd('0xf')]);router['delete'](_0x54fd('0xa'),auth[_0x54fd('0xb')](),controller[_0x54fd('0x10')]);module[_0x54fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 0b0c5be..d86f131 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 _0xa5cd=['STRING','noop','*,*,*,*','INTEGER'];(function(_0x6a8b44,_0x23b383){var _0x16fe06=function(_0x1cbb88){while(--_0x1cbb88){_0x6a8b44['push'](_0x6a8b44['shift']());}};_0x16fe06(++_0x23b383);}(_0xa5cd,0xd3));var _0xda5c=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xa5cd[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xda5c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xda5c('0x1')],'allowNull':![],'defaultValue':_0xda5c('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xda5c('0x1')]},'interval':{'type':Sequelize[_0xda5c('0x1')],'defaultValue':_0xda5c('0x3')}}; \ No newline at end of file +var _0x268e=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x268e,0xf2));var _0xe268=function(_0x4ca026,_0x3ea042){_0x4ca026=_0x4ca026-0x0;var _0x5f4bff=_0x268e[_0x4ca026];return _0x5f4bff;};'use strict';var Sequelize=require(_0xe268('0x0'));module[_0xe268('0x1')]={'priority':{'type':Sequelize[_0xe268('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe268('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe268('0x3')]},'interval':{'type':Sequelize[_0xe268('0x3')],'defaultValue':_0xe268('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 8247897..4593ed4 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 _0xdbc6=['create','body','find','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','show','params','rawAttributes','catch'];(function(_0x43218a,_0x467f94){var _0x38c054=function(_0x487e48){while(--_0x487e48){_0x43218a['push'](_0x43218a['shift']());}};_0x38c054(++_0x467f94);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x3b191c,_0x5cba50){_0x3b191c=_0x3b191c-0x0;var _0x56fdb7=_0xdbc6[_0x3b191c];return _0x56fdb7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6dbc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dbc('0x1'));var moment=require(_0x6dbc('0x2'));var BPromise=require(_0x6dbc('0x3'));var Mustache=require(_0x6dbc('0x4'));var util=require(_0x6dbc('0x5'));var path=require(_0x6dbc('0x6'));var sox=require('sox');var csv=require(_0x6dbc('0x7'));var ejs=require(_0x6dbc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dbc('0x9'));var squel=require(_0x6dbc('0xa'));var crypto=require(_0x6dbc('0xb'));var jsforce=require(_0x6dbc('0xc'));var deskjs=require(_0x6dbc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6dbc('0xe'));var Papa=require(_0x6dbc('0xf'));var Redis=require('ioredis');var authService=require(_0x6dbc('0x10'));var qs=require(_0x6dbc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dbc('0x12'));var logger=require(_0x6dbc('0x13'))(_0x6dbc('0x14'));var utils=require(_0x6dbc('0x15'));var config=require(_0x6dbc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x296a9b,_0x1da999){_0x1da999=_0x1da999||0xcc;return function(_0x44591c){if(_0x44591c){return _0x296a9b[_0x6dbc('0x17')](_0x1da999);}return _0x296a9b[_0x6dbc('0x18')](_0x1da999)[_0x6dbc('0x19')]();};}function respondWithResult(_0x314a55,_0x424e52){_0x424e52=_0x424e52||0xc8;return function(_0x297b6a){if(_0x297b6a){return _0x314a55['status'](_0x424e52)[_0x6dbc('0x1a')](_0x297b6a);}};}function respondWithFilteredResult(_0x3fc449,_0x12a257){return function(_0x418e71){if(_0x418e71){var _0x25b8a8=typeof _0x12a257[_0x6dbc('0x1b')]===_0x6dbc('0x1c')&&typeof _0x12a257[_0x6dbc('0x1d')]==='undefined';var _0x5a896d=_0x418e71['count'];var _0x285ccd=_0x25b8a8?0x0:_0x12a257[_0x6dbc('0x1b')];var _0x1f185b=_0x25b8a8?_0x418e71[_0x6dbc('0x1e')]:_0x12a257[_0x6dbc('0x1b')]+_0x12a257['limit'];var _0x44435c;if(_0x1f185b>=_0x5a896d){_0x1f185b=_0x5a896d;_0x44435c=0xc8;}else{_0x44435c=0xce;}_0x3fc449[_0x6dbc('0x18')](_0x44435c);return _0x3fc449[_0x6dbc('0x1f')](_0x6dbc('0x20'),_0x285ccd+'-'+_0x1f185b+'/'+_0x5a896d)[_0x6dbc('0x1a')](_0x418e71);}return null;};}function patchUpdates(_0x2cd2f1){return function(_0x94335e){try{jsonpatch[_0x6dbc('0x21')](_0x94335e,_0x2cd2f1,!![]);}catch(_0x9edc7a){return BPromise[_0x6dbc('0x22')](_0x9edc7a);}return _0x94335e[_0x6dbc('0x23')]();};}function saveUpdates(_0x581438,_0x2f106f){return function(_0x2a1d0d){if(_0x2a1d0d){return _0x2a1d0d[_0x6dbc('0x24')](_0x581438)['then'](function(_0x1b8e84){return _0x1b8e84;});}return null;};}function removeEntity(_0x47d55b,_0x3e98b2){return function(_0x3f290e){if(_0x3f290e){return _0x3f290e[_0x6dbc('0x25')]()['then'](function(){_0x47d55b[_0x6dbc('0x18')](0xcc)[_0x6dbc('0x19')]();});}};}function handleEntityNotFound(_0x2be03c,_0x8cc556){return function(_0xd6dd78){if(!_0xd6dd78){_0x2be03c[_0x6dbc('0x17')](0x194);}return _0xd6dd78;};}function handleError(_0x43fab4,_0x1eb3fd){_0x1eb3fd=_0x1eb3fd||0x1f4;return function(_0x4bcbfb){logger[_0x6dbc('0x26')](_0x4bcbfb[_0x6dbc('0x27')]);if(_0x4bcbfb[_0x6dbc('0x28')]){delete _0x4bcbfb[_0x6dbc('0x28')];}_0x43fab4[_0x6dbc('0x18')](_0x1eb3fd)[_0x6dbc('0x29')](_0x4bcbfb);};}exports[_0x6dbc('0x2a')]=function(_0x235e00,_0xe77d87){var _0x485593={},_0x23ea7d={},_0x17203d={'count':0x0,'rows':[]};var _0x7d6155=_[_0x6dbc('0x2b')](db[_0x6dbc('0x2c')]['rawAttributes'],function(_0x3e2788){return{'name':_0x3e2788[_0x6dbc('0x2d')],'type':_0x3e2788[_0x6dbc('0x2e')][_0x6dbc('0x2f')]};});_0x23ea7d[_0x6dbc('0x30')]=_[_0x6dbc('0x2b')](_0x7d6155,'name');_0x23ea7d[_0x6dbc('0x31')]=_[_0x6dbc('0x32')](_0x235e00[_0x6dbc('0x31')]);_0x23ea7d[_0x6dbc('0x33')]=_[_0x6dbc('0x34')](_0x23ea7d[_0x6dbc('0x30')],_0x23ea7d[_0x6dbc('0x31')]);_0x485593[_0x6dbc('0x35')]=_[_0x6dbc('0x34')](_0x23ea7d[_0x6dbc('0x30')],qs[_0x6dbc('0x36')](_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x36')]));_0x485593[_0x6dbc('0x35')]=_0x485593[_0x6dbc('0x35')][_0x6dbc('0x37')]?_0x485593[_0x6dbc('0x35')]:_0x23ea7d[_0x6dbc('0x30')];if(!_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x38')](_0x6dbc('0x39'))){_0x485593[_0x6dbc('0x1d')]=qs[_0x6dbc('0x1d')](_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x1d')]);_0x485593[_0x6dbc('0x1b')]=qs['offset'](_0x235e00['query'][_0x6dbc('0x1b')]);}_0x485593[_0x6dbc('0x3a')]=qs[_0x6dbc('0x3b')](_0x235e00['query'][_0x6dbc('0x3b')]);_0x485593['where']=qs['filters'](_[_0x6dbc('0x3c')](_0x235e00[_0x6dbc('0x31')],_0x23ea7d['filters']),_0x7d6155);if(_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x3d')]){_0x485593[_0x6dbc('0x3e')]=_[_0x6dbc('0x3f')](_0x485593[_0x6dbc('0x3e')],{'$or':_['map'](_0x7d6155,function(_0x2c7545){if(_0x2c7545['type']!==_0x6dbc('0x40')){var _0x11554b={};_0x11554b[_0x2c7545['name']]={'$like':'%'+_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x3d')]+'%'};return _0x11554b;}})});}_0x485593=_[_0x6dbc('0x3f')]({},_0x485593,_0x235e00[_0x6dbc('0x41')]);var _0x40d79e={'where':_0x485593['where']};return db[_0x6dbc('0x2c')]['count'](_0x40d79e)['then'](function(_0x501d15){_0x17203d[_0x6dbc('0x1e')]=_0x501d15;if(_0x235e00[_0x6dbc('0x31')][_0x6dbc('0x42')]){_0x485593[_0x6dbc('0x43')]=[{'all':!![]}];}return db[_0x6dbc('0x2c')][_0x6dbc('0x44')](_0x485593);})[_0x6dbc('0x45')](function(_0x39df60){_0x17203d[_0x6dbc('0x46')]=_0x39df60;return _0x17203d;})[_0x6dbc('0x45')](respondWithFilteredResult(_0xe77d87,_0x485593))['catch'](handleError(_0xe77d87,null));};exports[_0x6dbc('0x47')]=function(_0x3b74b0,_0x5cd3b9){var _0x1b946b={'raw':!![],'where':{'id':_0x3b74b0[_0x6dbc('0x48')]['id']}},_0x39adea={};_0x39adea[_0x6dbc('0x30')]=_[_0x6dbc('0x32')](db['WhatsappApplication'][_0x6dbc('0x49')]);_0x39adea[_0x6dbc('0x31')]=_[_0x6dbc('0x32')](_0x3b74b0[_0x6dbc('0x31')]);_0x39adea[_0x6dbc('0x33')]=_[_0x6dbc('0x34')](_0x39adea[_0x6dbc('0x30')],_0x39adea['query']);_0x1b946b[_0x6dbc('0x35')]=_['intersection'](_0x39adea[_0x6dbc('0x30')],qs[_0x6dbc('0x36')](_0x3b74b0[_0x6dbc('0x31')][_0x6dbc('0x36')]));_0x1b946b[_0x6dbc('0x35')]=_0x1b946b[_0x6dbc('0x35')][_0x6dbc('0x37')]?_0x1b946b[_0x6dbc('0x35')]:_0x39adea[_0x6dbc('0x30')];if(_0x3b74b0['query'][_0x6dbc('0x42')]){_0x1b946b[_0x6dbc('0x43')]=[{'all':!![]}];}_0x1b946b=_[_0x6dbc('0x3f')]({},_0x1b946b,_0x3b74b0[_0x6dbc('0x41')]);return db['WhatsappApplication']['find'](_0x1b946b)[_0x6dbc('0x45')](handleEntityNotFound(_0x5cd3b9,null))['then'](respondWithResult(_0x5cd3b9,null))[_0x6dbc('0x4a')](handleError(_0x5cd3b9,null));};exports[_0x6dbc('0x4b')]=function(_0x45b4d6,_0xfda49d){return db[_0x6dbc('0x2c')]['create'](_0x45b4d6[_0x6dbc('0x4c')],{})[_0x6dbc('0x45')](respondWithResult(_0xfda49d,0xc9))[_0x6dbc('0x4a')](handleError(_0xfda49d,null));};exports['update']=function(_0x427210,_0x82ea74){if(_0x427210['body']['id']){delete _0x427210[_0x6dbc('0x4c')]['id'];}return db[_0x6dbc('0x2c')][_0x6dbc('0x4d')]({'where':{'id':_0x427210['params']['id']}})['then'](handleEntityNotFound(_0x82ea74,null))['then'](saveUpdates(_0x427210['body'],null))[_0x6dbc('0x45')](respondWithResult(_0x82ea74,null))[_0x6dbc('0x4a')](handleError(_0x82ea74,null));};exports[_0x6dbc('0x25')]=function(_0x5501cc,_0x23f39b){return db[_0x6dbc('0x2c')][_0x6dbc('0x4d')]({'where':{'id':_0x5501cc['params']['id']}})['then'](handleEntityNotFound(_0x23f39b,null))[_0x6dbc('0x45')](removeEntity(_0x23f39b,null))[_0x6dbc('0x4a')](handleError(_0x23f39b,null));}; \ No newline at end of file +var _0xc1d3=['rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll'];(function(_0x3320f4,_0x5c1e63){var _0x2fd1eb=function(_0x5e7b99){while(--_0x5e7b99){_0x3320f4['push'](_0x3320f4['shift']());}};_0x2fd1eb(++_0x5c1e63);}(_0xc1d3,0x147));var _0x3c1d=function(_0x223df0,_0x3d48dd){_0x223df0=_0x223df0-0x0;var _0x1d733a=_0xc1d3[_0x223df0];return _0x1d733a;};'use strict';var emlformat=require(_0x3c1d('0x0'));var rimraf=require(_0x3c1d('0x1'));var zipdir=require(_0x3c1d('0x2'));var jsonpatch=require(_0x3c1d('0x3'));var rp=require(_0x3c1d('0x4'));var moment=require(_0x3c1d('0x5'));var BPromise=require(_0x3c1d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3c1d('0x7'));var sox=require(_0x3c1d('0x8'));var csv=require(_0x3c1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c1d('0xa'));var _=require(_0x3c1d('0xb'));var squel=require(_0x3c1d('0xc'));var crypto=require(_0x3c1d('0xd'));var jsforce=require(_0x3c1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3c1d('0x9'));var querystring=require(_0x3c1d('0xf'));var Papa=require(_0x3c1d('0x10'));var Redis=require(_0x3c1d('0x11'));var authService=require(_0x3c1d('0x12'));var qs=require(_0x3c1d('0x13'));var as=require(_0x3c1d('0x14'));var hardwareService=require(_0x3c1d('0x15'));var logger=require('../../config/logger')(_0x3c1d('0x16'));var utils=require(_0x3c1d('0x17'));var config=require(_0x3c1d('0x18'));var licenseUtil=require(_0x3c1d('0x19'));var db=require(_0x3c1d('0x1a'))['db'];function respondWithStatusCode(_0x5a2402,_0xf3cd6d){_0xf3cd6d=_0xf3cd6d||0xcc;return function(_0x209b55){if(_0x209b55){return _0x5a2402['sendStatus'](_0xf3cd6d);}return _0x5a2402[_0x3c1d('0x1b')](_0xf3cd6d)['end']();};}function respondWithResult(_0x4ed530,_0x4b941d){_0x4b941d=_0x4b941d||0xc8;return function(_0x2875a9){if(_0x2875a9){return _0x4ed530[_0x3c1d('0x1b')](_0x4b941d)[_0x3c1d('0x1c')](_0x2875a9);}};}function respondWithFilteredResult(_0x434dbc,_0x2ed7af){return function(_0x2c0b83){if(_0x2c0b83){var _0x4e6157=typeof _0x2ed7af['offset']===_0x3c1d('0x1d')&&typeof _0x2ed7af['limit']===_0x3c1d('0x1d');var _0x295467=_0x2c0b83['count'];var _0x4a7e42=_0x4e6157?0x0:_0x2ed7af['offset'];var _0x33637d=_0x4e6157?_0x2c0b83[_0x3c1d('0x1e')]:_0x2ed7af[_0x3c1d('0x1f')]+_0x2ed7af[_0x3c1d('0x20')];var _0x9dce85;if(_0x33637d>=_0x295467){_0x33637d=_0x295467;_0x9dce85=0xc8;}else{_0x9dce85=0xce;}_0x434dbc['status'](_0x9dce85);return _0x434dbc['set'](_0x3c1d('0x21'),_0x4a7e42+'-'+_0x33637d+'/'+_0x295467)[_0x3c1d('0x1c')](_0x2c0b83);}return null;};}function patchUpdates(_0x3c7455){return function(_0x233dff){try{jsonpatch[_0x3c1d('0x22')](_0x233dff,_0x3c7455,!![]);}catch(_0x5b2720){return BPromise[_0x3c1d('0x23')](_0x5b2720);}return _0x233dff[_0x3c1d('0x24')]();};}function saveUpdates(_0xa5fd81,_0x5211d7){return function(_0x129497){if(_0x129497){return _0x129497[_0x3c1d('0x25')](_0xa5fd81)[_0x3c1d('0x26')](function(_0x210e9c){return _0x210e9c;});}return null;};}function removeEntity(_0x2e1af4,_0x1a853d){return function(_0x41a683){if(_0x41a683){return _0x41a683[_0x3c1d('0x27')]()[_0x3c1d('0x26')](function(){_0x2e1af4['status'](0xcc)[_0x3c1d('0x28')]();});}};}function handleEntityNotFound(_0x2a8854,_0x2078d5){return function(_0x4f7cd8){if(!_0x4f7cd8){_0x2a8854[_0x3c1d('0x29')](0x194);}return _0x4f7cd8;};}function handleError(_0x3bde45,_0x4e1f79){_0x4e1f79=_0x4e1f79||0x1f4;return function(_0x392bb1){logger[_0x3c1d('0x2a')](_0x392bb1[_0x3c1d('0x2b')]);if(_0x392bb1['name']){delete _0x392bb1[_0x3c1d('0x2c')];}_0x3bde45['status'](_0x4e1f79)[_0x3c1d('0x2d')](_0x392bb1);};}exports[_0x3c1d('0x2e')]=function(_0x59db0a,_0x4ff12a){var _0x356f61={},_0x2f7af9={},_0x93a3b1={'count':0x0,'rows':[]};var _0x52ab2b=_[_0x3c1d('0x2f')](db['WhatsappApplication'][_0x3c1d('0x30')],function(_0x438b09){return{'name':_0x438b09[_0x3c1d('0x31')],'type':_0x438b09['type'][_0x3c1d('0x32')]};});_0x2f7af9[_0x3c1d('0x33')]=_[_0x3c1d('0x2f')](_0x52ab2b,_0x3c1d('0x2c'));_0x2f7af9[_0x3c1d('0x34')]=_[_0x3c1d('0x35')](_0x59db0a[_0x3c1d('0x34')]);_0x2f7af9[_0x3c1d('0x36')]=_[_0x3c1d('0x37')](_0x2f7af9['model'],_0x2f7af9['query']);_0x356f61[_0x3c1d('0x38')]=_['intersection'](_0x2f7af9[_0x3c1d('0x33')],qs[_0x3c1d('0x39')](_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x39')]));_0x356f61[_0x3c1d('0x38')]=_0x356f61['attributes'][_0x3c1d('0x3a')]?_0x356f61[_0x3c1d('0x38')]:_0x2f7af9['model'];if(!_0x59db0a['query'][_0x3c1d('0x3b')](_0x3c1d('0x3c'))){_0x356f61[_0x3c1d('0x20')]=qs[_0x3c1d('0x20')](_0x59db0a[_0x3c1d('0x34')]['limit']);_0x356f61[_0x3c1d('0x1f')]=qs[_0x3c1d('0x1f')](_0x59db0a['query']['offset']);}_0x356f61['order']=qs[_0x3c1d('0x3d')](_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x3d')]);_0x356f61[_0x3c1d('0x3e')]=qs['filters'](_[_0x3c1d('0x3f')](_0x59db0a['query'],_0x2f7af9[_0x3c1d('0x36')]),_0x52ab2b);if(_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x40')]){_0x356f61[_0x3c1d('0x3e')]=_[_0x3c1d('0x41')](_0x356f61['where'],{'$or':_[_0x3c1d('0x2f')](_0x52ab2b,function(_0x28c575){if(_0x28c575[_0x3c1d('0x42')]!==_0x3c1d('0x43')){var _0x59c8fb={};_0x59c8fb[_0x28c575[_0x3c1d('0x2c')]]={'$like':'%'+_0x59db0a['query']['filter']+'%'};return _0x59c8fb;}})});}_0x356f61=_[_0x3c1d('0x41')]({},_0x356f61,_0x59db0a[_0x3c1d('0x44')]);var _0x58c490={'where':_0x356f61['where']};return db[_0x3c1d('0x45')][_0x3c1d('0x1e')](_0x58c490)['then'](function(_0x4f07d6){_0x93a3b1[_0x3c1d('0x1e')]=_0x4f07d6;if(_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x46')]){_0x356f61[_0x3c1d('0x47')]=[{'all':!![]}];}return db[_0x3c1d('0x45')][_0x3c1d('0x48')](_0x356f61);})[_0x3c1d('0x26')](function(_0x11bca2){_0x93a3b1[_0x3c1d('0x49')]=_0x11bca2;return _0x93a3b1;})[_0x3c1d('0x26')](respondWithFilteredResult(_0x4ff12a,_0x356f61))[_0x3c1d('0x4a')](handleError(_0x4ff12a,null));};exports[_0x3c1d('0x4b')]=function(_0x4b0f40,_0x21dbef){var _0x5ca02c={'raw':!![],'where':{'id':_0x4b0f40['params']['id']}},_0x415a61={};_0x415a61[_0x3c1d('0x33')]=_['keys'](db[_0x3c1d('0x45')][_0x3c1d('0x30')]);_0x415a61[_0x3c1d('0x34')]=_[_0x3c1d('0x35')](_0x4b0f40['query']);_0x415a61[_0x3c1d('0x36')]=_['intersection'](_0x415a61[_0x3c1d('0x33')],_0x415a61[_0x3c1d('0x34')]);_0x5ca02c[_0x3c1d('0x38')]=_[_0x3c1d('0x37')](_0x415a61['model'],qs[_0x3c1d('0x39')](_0x4b0f40[_0x3c1d('0x34')][_0x3c1d('0x39')]));_0x5ca02c[_0x3c1d('0x38')]=_0x5ca02c[_0x3c1d('0x38')]['length']?_0x5ca02c[_0x3c1d('0x38')]:_0x415a61[_0x3c1d('0x33')];if(_0x4b0f40[_0x3c1d('0x34')]['includeAll']){_0x5ca02c['include']=[{'all':!![]}];}_0x5ca02c=_[_0x3c1d('0x41')]({},_0x5ca02c,_0x4b0f40[_0x3c1d('0x44')]);return db[_0x3c1d('0x45')][_0x3c1d('0x4c')](_0x5ca02c)[_0x3c1d('0x26')](handleEntityNotFound(_0x21dbef,null))[_0x3c1d('0x26')](respondWithResult(_0x21dbef,null))['catch'](handleError(_0x21dbef,null));};exports[_0x3c1d('0x4d')]=function(_0x4c533e,_0x34ad3a){return db[_0x3c1d('0x45')][_0x3c1d('0x4d')](_0x4c533e[_0x3c1d('0x4e')],{})[_0x3c1d('0x26')](respondWithResult(_0x34ad3a,0xc9))[_0x3c1d('0x4a')](handleError(_0x34ad3a,null));};exports[_0x3c1d('0x25')]=function(_0x4f0b44,_0x576552){if(_0x4f0b44['body']['id']){delete _0x4f0b44[_0x3c1d('0x4e')]['id'];}return db[_0x3c1d('0x45')][_0x3c1d('0x4c')]({'where':{'id':_0x4f0b44[_0x3c1d('0x4f')]['id']}})[_0x3c1d('0x26')](handleEntityNotFound(_0x576552,null))[_0x3c1d('0x26')](saveUpdates(_0x4f0b44['body'],null))[_0x3c1d('0x26')](respondWithResult(_0x576552,null))[_0x3c1d('0x4a')](handleError(_0x576552,null));};exports['destroy']=function(_0x4bc4ac,_0x4302f3){return db[_0x3c1d('0x45')][_0x3c1d('0x4c')]({'where':{'id':_0x4bc4ac[_0x3c1d('0x4f')]['id']}})[_0x3c1d('0x26')](handleEntityNotFound(_0x4302f3,null))[_0x3c1d('0x26')](removeEntity(_0x4302f3,null))[_0x3c1d('0x4a')](handleError(_0x4302f3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1890080..9768abc 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 _0xacfe=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4'];(function(_0x496b7e,_0x30c11a){var _0x26b0c1=function(_0x33e357){while(--_0x33e357){_0x496b7e['push'](_0x496b7e['shift']());}};_0x26b0c1(++_0x30c11a);}(_0xacfe,0xfd));var _0xeacf=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xacfe[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeacf('0x0'))(_0xeacf('0x1'));var moment=require(_0xeacf('0x2'));var BPromise=require(_0xeacf('0x3'));var rp=require(_0xeacf('0x4'));var fs=require('fs');var path=require(_0xeacf('0x5'));var rimraf=require(_0xeacf('0x6'));var config=require(_0xeacf('0x7'));var attributes=require(_0xeacf('0x8'));module[_0xeacf('0x9')]=function(_0x369ad7,_0x229f28){return _0x369ad7[_0xeacf('0xa')]('WhatsappApplication',attributes,{'tableName':_0xeacf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeacf('0xc'),'collate':_0xeacf('0xd')});}; \ No newline at end of file +var _0x34f8=['moment','path','rimraf','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3fc017,_0x288faf){var _0x542e8c=function(_0x42438c){while(--_0x42438c){_0x3fc017['push'](_0x3fc017['shift']());}};_0x542e8c(++_0x288faf);}(_0x34f8,0x80));var _0x834f=function(_0x18fb80,_0x29869f){_0x18fb80=_0x18fb80-0x0;var _0x92aba1=_0x34f8[_0x18fb80];return _0x92aba1;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var logger=require(_0x834f('0x2'))(_0x834f('0x3'));var moment=require(_0x834f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x834f('0x5'));var rimraf=require(_0x834f('0x6'));var config=require('../../config/environment');var attributes=require(_0x834f('0x7'));module[_0x834f('0x8')]=function(_0x9e052f,_0x3498dd){return _0x9e052f['define']('WhatsappApplication',attributes,{'tableName':_0x834f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x834f('0xa'),'collate':_0x834f('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index fa2b1a2..ac51230 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 _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x7a8d74,_0x61f903){var _0x163048=function(_0x5d1ba7){while(--_0x5d1ba7){_0x7a8d74['push'](_0x7a8d74['shift']());}};_0x163048(++_0x61f903);}(_0x0e85,0x7c));var _0x50e8=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x0e85[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file +var _0xed1f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5f0d29,_0x4f7b80){var _0x1b7aec=function(_0x1da8c5){while(--_0x1da8c5){_0x5f0d29['push'](_0x5f0d29['shift']());}};_0x1b7aec(++_0x4f7b80);}(_0xed1f,0x6a));var _0xfed1=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xed1f[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 57bca6e..2960f65 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 _0x25fa=['update','delete','whatsappinteraction:destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x5d5ee0,_0x55b047){var _0x36a63c=function(_0x40103b){while(--_0x40103b){_0x5d5ee0['push'](_0x5d5ee0['shift']());}};_0x36a63c(++_0x55b047);}(_0x25fa,0x109));var _0xa25f=function(_0xe135e,_0x30083a){_0xe135e=_0xe135e-0x0;var _0x316059=_0x25fa[_0xe135e];return _0x316059;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0x9')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0xe')]);router[_0xa25f('0x9')](_0xa25f('0xf'),auth[_0xa25f('0x7')](),controller['download']);router[_0xa25f('0x10')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0x10')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0x11')]);router[_0xa25f('0x10')](_0xa25f('0x12'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')](_0xa25f('0x14'),_0xa25f('0x15')),controller[_0xa25f('0x16')]);router[_0xa25f('0x17')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x18')),controller[_0xa25f('0x19')]);router[_0xa25f('0x1a')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x1b')),controller['destroy']);router[_0xa25f('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa25f('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xdb8b=['delete','whatsappinteraction:destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x4b37b6,_0x1a2fe6){var _0x5a9782=function(_0x126d59){while(--_0x126d59){_0x4b37b6['push'](_0x4b37b6['shift']());}};_0x5a9782(++_0x1a2fe6);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x4a92bf,_0x391651){_0x4a92bf=_0x4a92bf-0x0;var _0x537b38=_0xdb8b[_0x4a92bf];return _0x537b38;};'use strict';var multer=require('multer');var util=require(_0xbdb8('0x0'));var path=require(_0xbdb8('0x1'));var timeout=require(_0xbdb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdb8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var controller=require(_0xbdb8('0x6'));router[_0xbdb8('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdb8('0x8')]);router['get'](_0xbdb8('0x9'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xb')]);router[_0xbdb8('0x7')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller['show']);router[_0xbdb8('0x7')](_0xbdb8('0xd'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xe')]);router[_0xbdb8('0x7')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller['download']);router['post']('/',auth[_0xbdb8('0xa')](),controller['create']);router[_0xbdb8('0x10')]('/:id/messages',auth[_0xbdb8('0xa')](),controller['addMessage']);router[_0xbdb8('0x10')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x14')),controller[_0xbdb8('0x15')]);router[_0xbdb8('0x16')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x17')),controller['update']);router[_0xbdb8('0x18')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction['tracked']('whatsapp',_0xbdb8('0x19')),controller['destroy']);router[_0xbdb8('0x18')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x1a')]);module[_0xbdb8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 7c59d6a..4dd2ab4 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 _0xe61c=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x29203e,_0x428c2c){var _0x116d6=function(_0x5a9212){while(--_0x5a9212){_0x29203e['push'](_0x29203e['shift']());}};_0x116d6(++_0x428c2c);}(_0xe61c,0xee));var _0xce61=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0xe61c[_0x188703];return _0x1a0c81;};'use strict';var Sequelize=require(_0xce61('0x0'));var moment=require('moment');module[_0xce61('0x1')]={'closed':{'type':Sequelize[_0xce61('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce61('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xce61('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xce61('0x4')]},'read1stAt':{'type':Sequelize[_0xce61('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xce61('0x5')]('in',_0xce61('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xce61('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xce61('0x5')]('in',_0xce61('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xce61('0x7')]}}; \ No newline at end of file +var _0x58c9=['ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x6ea62b,_0x2802a7){var _0x581b2e=function(_0x3ee0da){while(--_0x3ee0da){_0x6ea62b['push'](_0x6ea62b['shift']());}};_0x581b2e(++_0x2802a7);}(_0x58c9,0x1bc));var _0x958c=function(_0x248177,_0x5df653){_0x248177=_0x248177-0x0;var _0x44c530=_0x58c9[_0x248177];return _0x44c530;};'use strict';var Sequelize=require(_0x958c('0x0'));var moment=require(_0x958c('0x1'));module[_0x958c('0x2')]={'closed':{'type':Sequelize[_0x958c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x958c('0x4')]},'disposition':{'type':Sequelize[_0x958c('0x5')]},'secondDisposition':{'type':Sequelize[_0x958c('0x5')]},'thirdDisposition':{'type':Sequelize[_0x958c('0x5')]},'note':{'type':Sequelize[_0x958c('0x5')]},'phone':{'type':Sequelize[_0x958c('0x5')]},'read1stAt':{'type':Sequelize[_0x958c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x958c('0x6')]('in',_0x958c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x958c('0x6')]('in',_0x958c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x958c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x958c('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 27e8bbf..fb4ab05 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 _0x9137=['moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','end','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','user','catch','params','model','query','keys','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','destroy','describe','WhatsappMessage','omit','ids','getMessages','findOne','hasOwnProperty','order','where','pick','filters','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Whatsapp','closed','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','value','renderFile','views','.pdf','log','err','unlinkSync','sendStatus','rimraf','zip-dir'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x9137,0x7b));var _0x7913=function(_0x127728,_0x11c9c5){_0x127728=_0x127728-0x0;var _0x3b6cfe=_0x9137[_0x127728];return _0x3b6cfe;};'use strict';var rimraf=require(_0x7913('0x0'));var zipdir=require(_0x7913('0x1'));var moment=require(_0x7913('0x2'));var BPromise=require(_0x7913('0x3'));var util=require('util');var path=require(_0x7913('0x4'));var ejs=require(_0x7913('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x7913('0x6'));var interaction=require(_0x7913('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7913('0x8'));var logger=require(_0x7913('0x9'))(_0x7913('0xa'));var config=require(_0x7913('0xb'));var db=require(_0x7913('0xc'))['db'];config[_0x7913('0xd')]=_['defaults'](config[_0x7913('0xd')],{'host':_0x7913('0xe'),'port':0x18eb});var socket=require(_0x7913('0xf'))(new Redis(config['redis']));require(_0x7913('0x10'))[_0x7913('0x11')](socket);function respondWithStatusCode(_0x111f0a,_0x4b5840){_0x4b5840=_0x4b5840||0xcc;return function(_0x1d6c1e){if(_0x1d6c1e){return _0x111f0a['sendStatus'](_0x4b5840);}return _0x111f0a[_0x7913('0x12')](_0x4b5840)['end']();};}function respondWithResult(_0x139861,_0x2e8b1f){_0x2e8b1f=_0x2e8b1f||0xc8;return function(_0x57caa6){if(_0x57caa6){return _0x139861[_0x7913('0x12')](_0x2e8b1f)[_0x7913('0x13')](_0x57caa6);}};}function respondWithFilteredResult(_0x91367d,_0x2ec155){return function(_0x1d4612){if(_0x1d4612){var _0x39d2ae=typeof _0x2ec155[_0x7913('0x14')]===_0x7913('0x15')&&typeof _0x2ec155[_0x7913('0x16')]===_0x7913('0x15');var _0x2bff56=_0x1d4612[_0x7913('0x17')];var _0x58edee=_0x39d2ae?0x0:_0x2ec155[_0x7913('0x14')];var _0x335e5a=_0x39d2ae?_0x1d4612[_0x7913('0x17')]:_0x2ec155[_0x7913('0x14')]+_0x2ec155[_0x7913('0x16')];var _0xc66976;if(_0x335e5a>=_0x2bff56){_0x335e5a=_0x2bff56;_0xc66976=0xc8;}else{_0xc66976=0xce;}_0x91367d[_0x7913('0x12')](_0xc66976);return _0x91367d[_0x7913('0x18')](_0x7913('0x19'),_0x58edee+'-'+_0x335e5a+'/'+_0x2bff56)[_0x7913('0x13')](_0x1d4612);}return null;};}function saveUpdates(_0x3389a4){return function(_0x11e877){if(_0x11e877){return _0x11e877['update'](_0x3389a4)[_0x7913('0x1a')](function(_0x3b3f51){return _0x3b3f51;});}return null;};}function removeEntity(_0xf6e6fc){return function(_0x28a1f1){if(_0x28a1f1){return _0x28a1f1['destroy']()['then'](function(){_0xf6e6fc[_0x7913('0x12')](0xcc)[_0x7913('0x1b')]();});}};}function handleEntityNotFound(_0x400a60){return function(_0x277b21){if(!_0x277b21){_0x400a60['sendStatus'](0x194);}return _0x277b21;};}function handleError(_0x423054,_0x2731fc){_0x2731fc=_0x2731fc||0x1f4;return function(_0x41b710){logger[_0x7913('0x1c')](_0x41b710[_0x7913('0x1d')]);if(_0x41b710[_0x7913('0x1e')]){delete _0x41b710['name'];}_0x423054[_0x7913('0x12')](_0x2731fc)['send'](_0x41b710);};}exports[_0x7913('0x1f')]=function(_0x380afe,_0x54737c){var _0x35b7ad={};var _0x5738e6=_[_0x7913('0x20')](db[_0x7913('0x21')][_0x7913('0x22')],function(_0x44dd6d){return{'name':_0x44dd6d[_0x7913('0x23')],'type':_0x44dd6d['type'][_0x7913('0x24')]};});_0x35b7ad=qs[_0x7913('0x25')](_0x5738e6,_0x380afe);return interaction[_0x7913('0x26')](_0x7913('0x27'),_0x380afe['query'],_0x380afe[_0x7913('0x28')],_0x35b7ad,_0x5738e6)[_0x7913('0x1a')](respondWithFilteredResult(_0x54737c,_0x35b7ad))[_0x7913('0x29')](handleError(_0x54737c,null));};exports['show']=function(_0x56c67c,_0x366003){var _0x43f607={'raw':![],'where':{'id':_0x56c67c[_0x7913('0x2a')]['id']}},_0x3dc3eb={};_0x3dc3eb[_0x7913('0x2b')]=_['keys'](db['WhatsappInteraction'][_0x7913('0x22')]);_0x3dc3eb[_0x7913('0x2c')]=_[_0x7913('0x2d')](_0x56c67c[_0x7913('0x2c')]);_0x3dc3eb['filters']=_[_0x7913('0x2e')](_0x3dc3eb[_0x7913('0x2b')],_0x3dc3eb[_0x7913('0x2c')]);_0x43f607['attributes']=_['intersection'](_0x3dc3eb[_0x7913('0x2b')],qs[_0x7913('0x2f')](_0x56c67c['query'][_0x7913('0x2f')]));_0x43f607[_0x7913('0x30')]=_0x43f607['attributes'][_0x7913('0x31')]?_0x43f607[_0x7913('0x30')]:_0x3dc3eb['model'];if(_0x56c67c['query'][_0x7913('0x32')]){_0x43f607[_0x7913('0x33')]=[{'all':!![]}];}_0x43f607=_[_0x7913('0x34')]({},_0x43f607,_0x56c67c[_0x7913('0x35')]);return db[_0x7913('0x21')][_0x7913('0x36')](_0x43f607)['then'](handleEntityNotFound(_0x366003,null))[_0x7913('0x1a')](respondWithResult(_0x366003,null))[_0x7913('0x29')](handleError(_0x366003,null));};exports[_0x7913('0x37')]=function(_0x17124f,_0x2a7e8f){return db[_0x7913('0x21')][_0x7913('0x37')](_0x17124f[_0x7913('0x38')],{})[_0x7913('0x1a')](respondWithResult(_0x2a7e8f,0xc9))[_0x7913('0x29')](handleError(_0x2a7e8f,null));};exports[_0x7913('0x39')]=function(_0x5543c4,_0xfc574d){if(_0x5543c4['body']['id']){delete _0x5543c4[_0x7913('0x38')]['id'];}return db[_0x7913('0x21')][_0x7913('0x36')]({'where':{'id':_0x5543c4[_0x7913('0x2a')]['id']}})[_0x7913('0x1a')](handleEntityNotFound(_0xfc574d,null))[_0x7913('0x1a')](saveUpdates(_0x5543c4[_0x7913('0x38')],null))['then'](respondWithResult(_0xfc574d,null))[_0x7913('0x29')](handleError(_0xfc574d,null));};exports[_0x7913('0x3a')]=function(_0x5b7ca2,_0x25309a){return db[_0x7913('0x21')]['find']({'where':{'id':_0x5b7ca2[_0x7913('0x2a')]['id']}})[_0x7913('0x1a')](handleEntityNotFound(_0x25309a,null))['then'](removeEntity(_0x25309a,null))['catch'](handleError(_0x25309a,null));};exports['describe']=function(_0x4cd3b5,_0x2b591e){return db[_0x7913('0x21')][_0x7913('0x3b')]()[_0x7913('0x1a')](respondWithResult(_0x2b591e,null))['catch'](handleError(_0x2b591e,null));};exports['addMessage']=function(_0x1e8a16,_0x86ed9a){return db[_0x7913('0x3c')][_0x7913('0x36')]({'where':{'id':_0x1e8a16[_0x7913('0x2a')]['id']}})[_0x7913('0x1a')](handleEntityNotFound(_0x86ed9a,null))[_0x7913('0x1a')](function(_0x5ee687){if(_0x5ee687){return _0x5ee687['addMessage'](_0x1e8a16[_0x7913('0x38')]['ids'],_[_0x7913('0x3d')](_0x1e8a16[_0x7913('0x38')],[_0x7913('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x86ed9a,null))[_0x7913('0x29')](handleError(_0x86ed9a,null));};exports[_0x7913('0x3f')]=function(_0x1b76bf,_0x3b2adc){var _0x204397={'raw':![],'where':{}};var _0x23d846={};var _0x44182a={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x7913('0x40')]({'where':{'id':_0x1b76bf[_0x7913('0x2a')]['id']}})[_0x7913('0x1a')](handleEntityNotFound(_0x3b2adc,null))['then'](function(_0x45d3aa){if(_0x45d3aa){_0x23d846[_0x7913('0x2b')]=_[_0x7913('0x2d')](db[_0x7913('0x3c')][_0x7913('0x22')]);_0x23d846['query']=_[_0x7913('0x2d')](_0x1b76bf[_0x7913('0x2c')]);_0x23d846['filters']=_['intersection'](_0x23d846['model'],_0x23d846[_0x7913('0x2c')]);_0x204397[_0x7913('0x30')]=_[_0x7913('0x2e')](_0x23d846['model'],qs[_0x7913('0x2f')](_0x1b76bf[_0x7913('0x2c')]['fields']));_0x204397[_0x7913('0x30')]=_0x204397[_0x7913('0x30')][_0x7913('0x31')]?_0x204397[_0x7913('0x30')]:_0x23d846['model'];if(!_0x1b76bf[_0x7913('0x2c')][_0x7913('0x41')]('nolimit')){_0x204397[_0x7913('0x16')]=qs[_0x7913('0x16')](_0x1b76bf[_0x7913('0x2c')][_0x7913('0x16')]);_0x204397['offset']=qs[_0x7913('0x14')](_0x1b76bf[_0x7913('0x2c')][_0x7913('0x14')]);}_0x204397[_0x7913('0x42')]=qs['sort'](_0x1b76bf[_0x7913('0x2c')]['sort']);_0x204397[_0x7913('0x43')]=qs['filters'](_[_0x7913('0x44')](_0x1b76bf['query'],_0x23d846[_0x7913('0x45')]));_0x204397[_0x7913('0x43')][_0x7913('0x46')]=_0x45d3aa['id'];if(_0x1b76bf[_0x7913('0x2c')][_0x7913('0x47')]){_0x204397[_0x7913('0x43')]=_[_0x7913('0x34')](_0x204397['where'],{'$or':_[_0x7913('0x20')](_0x204397['attributes'],function(_0x229430){var _0x2edaf0={};_0x2edaf0[_0x229430]={'$like':'%'+_0x1b76bf['query'][_0x7913('0x47')]+'%'};return _0x2edaf0;})});}if(_0x1b76bf[_0x7913('0x2c')][_0x7913('0x48')]){var _0xc2ef92=_0x1b76bf[_0x7913('0x2c')]['$gte']['split'](',');var _0x388bb6={};_0x388bb6[_0xc2ef92[0x0]]={'$gte':moment(_0xc2ef92[0x1])[_0x7913('0x49')](_0x7913('0x4a'))};_0x204397[_0x7913('0x43')]=_[_0x7913('0x34')](_0x204397[_0x7913('0x43')],_0x388bb6);}_0x204397=_[_0x7913('0x34')]({},_0x204397,_0x1b76bf[_0x7913('0x35')]);return db[_0x7913('0x3c')][_0x7913('0x17')]({'where':_0x204397[_0x7913('0x43')]})[_0x7913('0x1a')](function(_0x5261d9){_0x44182a[_0x7913('0x17')]=_0x5261d9;if(_0x1b76bf['query'][_0x7913('0x32')]){_0x204397[_0x7913('0x33')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x204397);})['then'](function(_0x306ebd){_0x44182a[_0x7913('0x4b')]=_0x306ebd;return _0x44182a;});}})[_0x7913('0x1a')](respondWithFilteredResult(_0x3b2adc,_0x204397))[_0x7913('0x29')](handleError(_0x3b2adc,null));};exports[_0x7913('0x4c')]=function(_0x17846d,_0x3cff81){return db[_0x7913('0x21')][_0x7913('0x36')]({'where':{'id':_0x17846d[_0x7913('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3cff81,null))[_0x7913('0x1a')](function(_0x180584){if(_0x180584){return _0x180584[_0x7913('0x4d')](_0x17846d[_0x7913('0x38')][_0x7913('0x3e')],_[_0x7913('0x3d')](_0x17846d['body'],['ids','id'])||{})['spread'](function(){return db[_0x7913('0x4e')][_0x7913('0x26')]({'attributes':['id','name','color'],'where':{'id':_0x17846d[_0x7913('0x38')][_0x7913('0x3e')]}});})['then'](function(_0x529a00){socket['emit'](_0x7913('0x4f'),{'id':Number(_0x17846d[_0x7913('0x2a')]['id']),'tags':_0x529a00||[]});return{'id':Number(_0x17846d[_0x7913('0x2a')]['id']),'tags':_0x529a00||[]};});}})[_0x7913('0x1a')](respondWithResult(_0x3cff81,null))[_0x7913('0x29')](handleError(_0x3cff81,null));};exports[_0x7913('0x50')]=function(_0x464c46,_0x69ffc5){return db[_0x7913('0x21')][_0x7913('0x36')]({'where':{'id':_0x464c46[_0x7913('0x2a')]['id']}})['then'](handleEntityNotFound(_0x69ffc5,null))['then'](function(_0x5b0ffa){if(_0x5b0ffa){return _0x5b0ffa[_0x7913('0x50')](_0x464c46[_0x7913('0x2c')][_0x7913('0x3e')]);}})[_0x7913('0x1a')](respondWithStatusCode(_0x69ffc5,null))[_0x7913('0x29')](handleError(_0x69ffc5,null));};exports[_0x7913('0x51')]=function(_0x2dde76,_0x1c9994){var _0x4b6c96=moment()[_0x7913('0x52')]()[_0x7913('0x53')]();var _0x549c17=path[_0x7913('0x54')](config[_0x7913('0x55')],_0x7913('0x56'),_0x7913('0x57'),_0x7913('0x58'));var _0x58d2e1=path['join'](config[_0x7913('0x55')],_0x7913('0x56'),_0x7913('0x57'),_0x7913('0x59'));var _0x7e618f=path[_0x7913('0x54')](_0x549c17,_0x4b6c96);var _0x1d34da=util['format'](_0x7913('0x5a'),_0x2dde76[_0x7913('0x2a')]['id'],_0x4b6c96);var _0x5b6413=path[_0x7913('0x54')](_0x549c17,_0x1d34da);var _0x28f5c5=[];_0x28f5c5[_0x7913('0x5b')]({'model':db[_0x7913('0x5c')],'as':_0x7913('0x5c'),'attributes':['id',_0x7913('0x5d')],'raw':!![]});_0x28f5c5['push']({'model':db[_0x7913('0x5e')],'as':_0x7913('0x5f'),'attributes':['id',_0x7913('0x60'),_0x7913('0x61')],'raw':!![]});if(_0x2dde76[_0x7913('0x2c')][_0x7913('0x59')]){_0x28f5c5[_0x7913('0x5b')]({'model':db['Attachment'],'as':_0x7913('0x62'),'raw':!![]});}var _0x3e1f8d=[{'model':db[_0x7913('0x3c')],'as':_0x7913('0x63'),'attributes':['id',_0x7913('0x38'),_0x7913('0x64'),_0x7913('0x65'),_0x7913('0x66'),_0x7913('0x67')],'include':_0x28f5c5}];_0x3e1f8d[_0x7913('0x5b')]({'model':db['WhatsappAccount'],'as':_0x7913('0x68'),'attributes':['id',_0x7913('0x1e')]});_0x3e1f8d[_0x7913('0x5b')]({'model':db['User'],'as':_0x7913('0x69'),'attributes':['id','fullname']});return db[_0x7913('0x21')][_0x7913('0x36')]({'where':{'id':_0x2dde76[_0x7913('0x2a')]['id']},'include':_0x3e1f8d})[_0x7913('0x1a')](handleEntityNotFound(_0x1c9994,null))['then'](function(_0x4d4786){if(_0x4d4786){var _0x3cda86=_0x4d4786[_0x7913('0x6a')]({'plain':!![]});fs[_0x7913('0x6b')](_0x7e618f);var _0x2294a9={'channel':_0x7913('0x6c'),'account':_0x3cda86[_0x7913('0x68')][_0x7913('0x1e')],'agent':_0x3cda86[_0x7913('0x69')]?_0x3cda86[_0x7913('0x69')][_0x7913('0x5d')]:'N.A.','createdAt':moment(_0x3cda86['createdAt'])['format'](_0x7913('0x4a'))[_0x7913('0x53')](),'closedAt':_0x3cda86[_0x7913('0x6d')]?moment(_0x3cda86['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7913('0x53')]():'','disposition':_0x3cda86[_0x7913('0x6e')],'messages':_(_0x3cda86[_0x7913('0x63')])[_0x7913('0x47')]({'secret':![]})['map'](function(_0x38a002){if(_0x38a002[_0x7913('0x62')]){var _0x380fab=path['join'](_0x58d2e1,_0x38a002[_0x7913('0x62')]['basename']);if(fs[_0x7913('0x6f')](_0x380fab)){fs[_0x7913('0x70')](_0x380fab)[_0x7913('0x71')](fs[_0x7913('0x72')](path[_0x7913('0x54')](_0x7e618f,_0x38a002['Attachment'][_0x7913('0x73')])));}}return{'date':moment(_0x38a002['createdAt'])['format'](_0x7913('0x4a'))[_0x7913('0x53')](),'sender':_0x38a002[_0x7913('0x65')]===_0x7913('0x74')?_0x38a002[_0x7913('0x5c')]?_0x38a002['User'][_0x7913('0x5d')]:'System':_0x38a002[_0x7913('0x5f')][_0x7913('0x60')]+(_0x38a002[_0x7913('0x5f')][_0x7913('0x61')]?'\x20'+_0x38a002[_0x7913('0x5f')][_0x7913('0x61')]:''),'body':_0x38a002[_0x7913('0x62')]?_0x38a002[_0x7913('0x62')]['basename']:_0x38a002['body'],'direction':_0x38a002[_0x7913('0x65')]===_0x7913('0x74')?'A':'C','secret':_0x38a002['secret'],'read':_0x38a002['read'],'attachment':_0x38a002['Attachment']};})[_0x7913('0x75')]()};return ejs[_0x7913('0x76')](path['join'](config[_0x7913('0x55')],_0x7913('0x56'),_0x7913('0x77'),'downloadInteraction.ejs'),{'interaction':_0x2294a9})['then'](function(_0x3a65ff){var _0x2f34d8=path['join'](_0x7e618f,'transcript-'+_0x3cda86['id']+'-'+_0x4b6c96+_0x7913('0x78'));var _0x12e8a4={'path':_0x2f34d8,'channel':_0x7913('0x6c'),'interactionId':_0x3cda86['id']};return pdf['createPdfFromHTML'](_0x3a65ff,_0x12e8a4);})[_0x7913('0x1a')](function(){return new BPromise(function(_0x182a88,_0x176e02){zipdir(_0x7e618f,{'saveTo':_0x5b6413},function(_0x365591,_0x37ac8c){if(_0x365591)return _0x176e02(_0x365591);return _0x182a88(_0x37ac8c);});})[_0x7913('0x1a')](function(){return new BPromise(function(_0x20eb35,_0x4f70a1){rimraf(_0x7e618f,function(_0x32b4ec){if(_0x32b4ec)_0x4f70a1(_0x32b4ec);return _0x20eb35();});});})[_0x7913('0x1a')](function(){return _0x1c9994['download'](_0x5b6413,_0x1d34da,function(_0x3c3666){if(_0x3c3666){console[_0x7913('0x79')](_0x7913('0x7a'),_0x3c3666);}else{fs[_0x7913('0x7b')](_0x5b6413);}});});});}else{return _0x1c9994[_0x7913('0x7c')](0xc8);}})[_0x7913('0x29')](handleError(_0x1c9994,null));}; \ No newline at end of file +var _0xb52a=['lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','send','fieldName','key','getOptions','whatsapp','query','user','catch','params','model','WhatsappInteraction','rawAttributes','intersection','attributes','fields','length','includeAll','include','merge','find','create','update','body','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','keys','hasOwnProperty','nolimit','order','where','WhatsappInteractionId','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','get','mkdirSync','Whatsapp','Owner','N.A.','toString','closed','basename','createReadStream','pipe','createWriteStream','out','System','firstName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','zip-dir','moment','path','ejs'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xb52a,0x76));var _0xab52=function(_0x2002b3,_0x11e91c){_0x2002b3=_0x2002b3-0x0;var _0x2756f0=_0xb52a[_0x2002b3];return _0x2756f0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xab52('0x0'));var moment=require(_0xab52('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xab52('0x2'));var ejs=require(_0xab52('0x3'));var fs=require('fs');var _=require(_0xab52('0x4'));var Redis=require(_0xab52('0x5'));var interaction=require(_0xab52('0x6'));var qs=require(_0xab52('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xab52('0x8'))(_0xab52('0x9'));var config=require(_0xab52('0xa'));var db=require('../../mysqldb')['db'];config[_0xab52('0xb')]=_[_0xab52('0xc')](config[_0xab52('0xb')],{'host':_0xab52('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab52('0xb')]));require(_0xab52('0xe'))['register'](socket);function respondWithStatusCode(_0x239cb1,_0x13dae1){_0x13dae1=_0x13dae1||0xcc;return function(_0x86e136){if(_0x86e136){return _0x239cb1[_0xab52('0xf')](_0x13dae1);}return _0x239cb1[_0xab52('0x10')](_0x13dae1)[_0xab52('0x11')]();};}function respondWithResult(_0x497298,_0x35c107){_0x35c107=_0x35c107||0xc8;return function(_0x2d3b87){if(_0x2d3b87){return _0x497298[_0xab52('0x10')](_0x35c107)[_0xab52('0x12')](_0x2d3b87);}};}function respondWithFilteredResult(_0x2c0845,_0xd59315){return function(_0x51fe2c){if(_0x51fe2c){var _0x3d4209=typeof _0xd59315[_0xab52('0x13')]===_0xab52('0x14')&&typeof _0xd59315[_0xab52('0x15')]===_0xab52('0x14');var _0x1d503b=_0x51fe2c[_0xab52('0x16')];var _0x19f40c=_0x3d4209?0x0:_0xd59315[_0xab52('0x13')];var _0xd82521=_0x3d4209?_0x51fe2c[_0xab52('0x16')]:_0xd59315[_0xab52('0x13')]+_0xd59315[_0xab52('0x15')];var _0x4ffdf9;if(_0xd82521>=_0x1d503b){_0xd82521=_0x1d503b;_0x4ffdf9=0xc8;}else{_0x4ffdf9=0xce;}_0x2c0845[_0xab52('0x10')](_0x4ffdf9);return _0x2c0845[_0xab52('0x17')](_0xab52('0x18'),_0x19f40c+'-'+_0xd82521+'/'+_0x1d503b)[_0xab52('0x12')](_0x51fe2c);}return null;};}function saveUpdates(_0x31d8fe){return function(_0x547a9d){if(_0x547a9d){return _0x547a9d['update'](_0x31d8fe)[_0xab52('0x19')](function(_0x237312){return _0x237312;});}return null;};}function removeEntity(_0x2e06c9){return function(_0x473bd8){if(_0x473bd8){return _0x473bd8[_0xab52('0x1a')]()[_0xab52('0x19')](function(){_0x2e06c9[_0xab52('0x10')](0xcc)[_0xab52('0x11')]();});}};}function handleEntityNotFound(_0x5824a1){return function(_0x1e5b95){if(!_0x1e5b95){_0x5824a1['sendStatus'](0x194);}return _0x1e5b95;};}function handleError(_0x10a704,_0x14986f){_0x14986f=_0x14986f||0x1f4;return function(_0x2c5f79){logger[_0xab52('0x1b')](_0x2c5f79['stack']);if(_0x2c5f79[_0xab52('0x1c')]){delete _0x2c5f79[_0xab52('0x1c')];}_0x10a704[_0xab52('0x10')](_0x14986f)[_0xab52('0x1d')](_0x2c5f79);};}exports['index']=function(_0x1e6af7,_0x377b08){var _0x439d6e={};var _0xf2ca8a=_['map'](db['WhatsappInteraction']['rawAttributes'],function(_0x1c0c59){return{'name':_0x1c0c59[_0xab52('0x1e')],'type':_0x1c0c59['type'][_0xab52('0x1f')]};});_0x439d6e=qs[_0xab52('0x20')](_0xf2ca8a,_0x1e6af7);return interaction['findAll'](_0xab52('0x21'),_0x1e6af7[_0xab52('0x22')],_0x1e6af7[_0xab52('0x23')],_0x439d6e,_0xf2ca8a)[_0xab52('0x19')](respondWithFilteredResult(_0x377b08,_0x439d6e))[_0xab52('0x24')](handleError(_0x377b08,null));};exports['show']=function(_0x4e4b3c,_0x427039){var _0x224b1={'raw':![],'where':{'id':_0x4e4b3c[_0xab52('0x25')]['id']}},_0x329c8d={};_0x329c8d[_0xab52('0x26')]=_['keys'](db[_0xab52('0x27')][_0xab52('0x28')]);_0x329c8d[_0xab52('0x22')]=_['keys'](_0x4e4b3c[_0xab52('0x22')]);_0x329c8d['filters']=_[_0xab52('0x29')](_0x329c8d['model'],_0x329c8d[_0xab52('0x22')]);_0x224b1[_0xab52('0x2a')]=_[_0xab52('0x29')](_0x329c8d[_0xab52('0x26')],qs[_0xab52('0x2b')](_0x4e4b3c['query'][_0xab52('0x2b')]));_0x224b1['attributes']=_0x224b1[_0xab52('0x2a')][_0xab52('0x2c')]?_0x224b1['attributes']:_0x329c8d[_0xab52('0x26')];if(_0x4e4b3c[_0xab52('0x22')][_0xab52('0x2d')]){_0x224b1[_0xab52('0x2e')]=[{'all':!![]}];}_0x224b1=_[_0xab52('0x2f')]({},_0x224b1,_0x4e4b3c['options']);return db['WhatsappInteraction'][_0xab52('0x30')](_0x224b1)[_0xab52('0x19')](handleEntityNotFound(_0x427039,null))[_0xab52('0x19')](respondWithResult(_0x427039,null))[_0xab52('0x24')](handleError(_0x427039,null));};exports['create']=function(_0x3ad479,_0x1522b3){return db[_0xab52('0x27')][_0xab52('0x31')](_0x3ad479['body'],{})[_0xab52('0x19')](respondWithResult(_0x1522b3,0xc9))['catch'](handleError(_0x1522b3,null));};exports[_0xab52('0x32')]=function(_0x54067f,_0x3b0d1a){if(_0x54067f['body']['id']){delete _0x54067f[_0xab52('0x33')]['id'];}return db[_0xab52('0x27')][_0xab52('0x30')]({'where':{'id':_0x54067f[_0xab52('0x25')]['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x3b0d1a,null))[_0xab52('0x19')](saveUpdates(_0x54067f[_0xab52('0x33')],null))[_0xab52('0x19')](respondWithResult(_0x3b0d1a,null))[_0xab52('0x24')](handleError(_0x3b0d1a,null));};exports['destroy']=function(_0x16a4ae,_0x59e97c){return db['WhatsappInteraction']['find']({'where':{'id':_0x16a4ae['params']['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x59e97c,null))[_0xab52('0x19')](removeEntity(_0x59e97c,null))['catch'](handleError(_0x59e97c,null));};exports[_0xab52('0x34')]=function(_0x449550,_0x1d7b6d){return db[_0xab52('0x27')][_0xab52('0x34')]()['then'](respondWithResult(_0x1d7b6d,null))[_0xab52('0x24')](handleError(_0x1d7b6d,null));};exports['addMessage']=function(_0x3e4272,_0x31b651){return db[_0xab52('0x35')][_0xab52('0x30')]({'where':{'id':_0x3e4272[_0xab52('0x25')]['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x31b651,null))['then'](function(_0x12ac4e){if(_0x12ac4e){return _0x12ac4e[_0xab52('0x36')](_0x3e4272[_0xab52('0x33')][_0xab52('0x37')],_[_0xab52('0x38')](_0x3e4272['body'],[_0xab52('0x37'),'id'])||{});}})[_0xab52('0x19')](respondWithResult(_0x31b651,null))[_0xab52('0x24')](handleError(_0x31b651,null));};exports[_0xab52('0x39')]=function(_0x4bb85b,_0x439951){var _0x2e9ec1={'raw':![],'where':{}};var _0x3cc0bc={};var _0xeefdec={'count':0x0,'rows':[]};return db[_0xab52('0x27')][_0xab52('0x3a')]({'where':{'id':_0x4bb85b['params']['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x439951,null))[_0xab52('0x19')](function(_0x2f9042){if(_0x2f9042){_0x3cc0bc[_0xab52('0x26')]=_[_0xab52('0x3b')](db['WhatsappMessage'][_0xab52('0x28')]);_0x3cc0bc[_0xab52('0x22')]=_[_0xab52('0x3b')](_0x4bb85b[_0xab52('0x22')]);_0x3cc0bc['filters']=_[_0xab52('0x29')](_0x3cc0bc[_0xab52('0x26')],_0x3cc0bc[_0xab52('0x22')]);_0x2e9ec1['attributes']=_['intersection'](_0x3cc0bc[_0xab52('0x26')],qs[_0xab52('0x2b')](_0x4bb85b[_0xab52('0x22')]['fields']));_0x2e9ec1[_0xab52('0x2a')]=_0x2e9ec1[_0xab52('0x2a')]['length']?_0x2e9ec1[_0xab52('0x2a')]:_0x3cc0bc[_0xab52('0x26')];if(!_0x4bb85b[_0xab52('0x22')][_0xab52('0x3c')](_0xab52('0x3d'))){_0x2e9ec1[_0xab52('0x15')]=qs[_0xab52('0x15')](_0x4bb85b[_0xab52('0x22')]['limit']);_0x2e9ec1[_0xab52('0x13')]=qs[_0xab52('0x13')](_0x4bb85b['query'][_0xab52('0x13')]);}_0x2e9ec1[_0xab52('0x3e')]=qs['sort'](_0x4bb85b['query']['sort']);_0x2e9ec1[_0xab52('0x3f')]=qs['filters'](_['pick'](_0x4bb85b[_0xab52('0x22')],_0x3cc0bc['filters']));_0x2e9ec1[_0xab52('0x3f')][_0xab52('0x40')]=_0x2f9042['id'];if(_0x4bb85b[_0xab52('0x22')]['filter']){_0x2e9ec1[_0xab52('0x3f')]=_[_0xab52('0x2f')](_0x2e9ec1[_0xab52('0x3f')],{'$or':_[_0xab52('0x41')](_0x2e9ec1['attributes'],function(_0x42ab70){var _0x3fe201={};_0x3fe201[_0x42ab70]={'$like':'%'+_0x4bb85b['query'][_0xab52('0x42')]+'%'};return _0x3fe201;})});}if(_0x4bb85b[_0xab52('0x22')]['$gte']){var _0x412add=_0x4bb85b[_0xab52('0x22')][_0xab52('0x43')][_0xab52('0x44')](',');var _0x547489={};_0x547489[_0x412add[0x0]]={'$gte':moment(_0x412add[0x1])['format'](_0xab52('0x45'))};_0x2e9ec1[_0xab52('0x3f')]=_[_0xab52('0x2f')](_0x2e9ec1[_0xab52('0x3f')],_0x547489);}_0x2e9ec1=_[_0xab52('0x2f')]({},_0x2e9ec1,_0x4bb85b[_0xab52('0x46')]);return db['WhatsappMessage'][_0xab52('0x16')]({'where':_0x2e9ec1['where']})['then'](function(_0x53162e){_0xeefdec[_0xab52('0x16')]=_0x53162e;if(_0x4bb85b[_0xab52('0x22')][_0xab52('0x2d')]){_0x2e9ec1['include']=[{'all':!![]}];}return db[_0xab52('0x35')][_0xab52('0x47')](_0x2e9ec1);})[_0xab52('0x19')](function(_0x1ae9d2){_0xeefdec[_0xab52('0x48')]=_0x1ae9d2;return _0xeefdec;});}})['then'](respondWithFilteredResult(_0x439951,_0x2e9ec1))['catch'](handleError(_0x439951,null));};exports['addTags']=function(_0x340bbd,_0x422500){return db[_0xab52('0x27')][_0xab52('0x30')]({'where':{'id':_0x340bbd[_0xab52('0x25')]['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x422500,null))[_0xab52('0x19')](function(_0x196388){if(_0x196388){return _0x196388[_0xab52('0x49')](_0x340bbd[_0xab52('0x33')]['ids'],_['omit'](_0x340bbd[_0xab52('0x33')],[_0xab52('0x37'),'id'])||{})[_0xab52('0x4a')](function(){return db['Tag'][_0xab52('0x47')]({'attributes':['id',_0xab52('0x1c'),_0xab52('0x4b')],'where':{'id':_0x340bbd[_0xab52('0x33')][_0xab52('0x37')]}});})[_0xab52('0x19')](function(_0x26af4d){socket[_0xab52('0x4c')](_0xab52('0x4d'),{'id':Number(_0x340bbd['params']['id']),'tags':_0x26af4d||[]});return{'id':Number(_0x340bbd[_0xab52('0x25')]['id']),'tags':_0x26af4d||[]};});}})[_0xab52('0x19')](respondWithResult(_0x422500,null))[_0xab52('0x24')](handleError(_0x422500,null));};exports[_0xab52('0x4e')]=function(_0x4377b7,_0x32b550){return db['WhatsappInteraction']['find']({'where':{'id':_0x4377b7[_0xab52('0x25')]['id']}})['then'](handleEntityNotFound(_0x32b550,null))[_0xab52('0x19')](function(_0x2a627a){if(_0x2a627a){return _0x2a627a[_0xab52('0x4e')](_0x4377b7['query']['ids']);}})['then'](respondWithStatusCode(_0x32b550,null))['catch'](handleError(_0x32b550,null));};exports[_0xab52('0x4f')]=function(_0x41a53d,_0x4385aa){var _0x27f9f1=moment()[_0xab52('0x50')]()['toString']();var _0x1782d4=path[_0xab52('0x51')](config[_0xab52('0x52')],_0xab52('0x53'),_0xab52('0x54'),_0xab52('0x55'));var _0x5686cc=path[_0xab52('0x51')](config[_0xab52('0x52')],'server',_0xab52('0x54'),_0xab52('0x56'));var _0x4291ca=path[_0xab52('0x51')](_0x1782d4,_0x27f9f1);var _0x542922=util[_0xab52('0x57')](_0xab52('0x58'),_0x41a53d['params']['id'],_0x27f9f1);var _0x214cdf=path['join'](_0x1782d4,_0x542922);var _0x4533ac=[];_0x4533ac[_0xab52('0x59')]({'model':db['User'],'as':_0xab52('0x5a'),'attributes':['id',_0xab52('0x5b')],'raw':!![]});_0x4533ac['push']({'model':db[_0xab52('0x5c')],'as':_0xab52('0x5d'),'attributes':['id','firstName',_0xab52('0x5e')],'raw':!![]});if(_0x41a53d[_0xab52('0x22')][_0xab52('0x56')]){_0x4533ac[_0xab52('0x59')]({'model':db[_0xab52('0x5f')],'as':_0xab52('0x5f'),'raw':!![]});}var _0x25e750=[{'model':db['WhatsappMessage'],'as':_0xab52('0x60'),'attributes':['id',_0xab52('0x33'),_0xab52('0x61'),_0xab52('0x62'),_0xab52('0x63'),_0xab52('0x64')],'include':_0x4533ac}];_0x25e750[_0xab52('0x59')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id','name']});_0x25e750[_0xab52('0x59')]({'model':db['User'],'as':'Owner','attributes':['id',_0xab52('0x5b')]});return db[_0xab52('0x27')][_0xab52('0x30')]({'where':{'id':_0x41a53d[_0xab52('0x25')]['id']},'include':_0x25e750})[_0xab52('0x19')](handleEntityNotFound(_0x4385aa,null))['then'](function(_0x4609af){if(_0x4609af){var _0xe00ffb=_0x4609af[_0xab52('0x65')]({'plain':!![]});fs[_0xab52('0x66')](_0x4291ca);var _0x2e78f5={'channel':_0xab52('0x67'),'account':_0xe00ffb['Account'][_0xab52('0x1c')],'agent':_0xe00ffb['Owner']?_0xe00ffb[_0xab52('0x68')]['fullname']:_0xab52('0x69'),'createdAt':moment(_0xe00ffb[_0xab52('0x61')])[_0xab52('0x57')](_0xab52('0x45'))[_0xab52('0x6a')](),'closedAt':_0xe00ffb[_0xab52('0x6b')]?moment(_0xe00ffb['closedAt'])[_0xab52('0x57')](_0xab52('0x45'))[_0xab52('0x6a')]():'','disposition':_0xe00ffb['disposition'],'messages':_(_0xe00ffb[_0xab52('0x60')])['filter']({'secret':![]})[_0xab52('0x41')](function(_0x3f90d1){if(_0x3f90d1[_0xab52('0x5f')]){var _0xec0653=path[_0xab52('0x51')](_0x5686cc,_0x3f90d1['Attachment'][_0xab52('0x6c')]);if(fs['existsSync'](_0xec0653)){fs[_0xab52('0x6d')](_0xec0653)[_0xab52('0x6e')](fs[_0xab52('0x6f')](path['join'](_0x4291ca,_0x3f90d1[_0xab52('0x5f')][_0xab52('0x6c')])));}}return{'date':moment(_0x3f90d1['createdAt'])[_0xab52('0x57')](_0xab52('0x45'))[_0xab52('0x6a')](),'sender':_0x3f90d1[_0xab52('0x62')]===_0xab52('0x70')?_0x3f90d1[_0xab52('0x5a')]?_0x3f90d1['User'][_0xab52('0x5b')]:_0xab52('0x71'):_0x3f90d1[_0xab52('0x5d')][_0xab52('0x72')]+(_0x3f90d1[_0xab52('0x5d')][_0xab52('0x5e')]?'\x20'+_0x3f90d1['Contact'][_0xab52('0x5e')]:''),'body':_0x3f90d1[_0xab52('0x5f')]?_0x3f90d1['Attachment'][_0xab52('0x6c')]:_0x3f90d1[_0xab52('0x33')],'direction':_0x3f90d1[_0xab52('0x62')]===_0xab52('0x70')?'A':'C','secret':_0x3f90d1[_0xab52('0x63')],'read':_0x3f90d1[_0xab52('0x64')],'attachment':_0x3f90d1[_0xab52('0x5f')]};})[_0xab52('0x73')]()};return ejs[_0xab52('0x74')](path[_0xab52('0x51')](config[_0xab52('0x52')],_0xab52('0x53'),'views',_0xab52('0x75')),{'interaction':_0x2e78f5})[_0xab52('0x19')](function(_0x3bb6c8){var _0xa81435=path[_0xab52('0x51')](_0x4291ca,_0xab52('0x76')+_0xe00ffb['id']+'-'+_0x27f9f1+_0xab52('0x77'));var _0x2e0600={'path':_0xa81435,'channel':_0xab52('0x67'),'interactionId':_0xe00ffb['id']};return pdf[_0xab52('0x78')](_0x3bb6c8,_0x2e0600);})['then'](function(){return new BPromise(function(_0x10f05b,_0x3b4a28){zipdir(_0x4291ca,{'saveTo':_0x214cdf},function(_0x3f3e6c,_0x47fe6f){if(_0x3f3e6c)return _0x3b4a28(_0x3f3e6c);return _0x10f05b(_0x47fe6f);});})[_0xab52('0x19')](function(){return new BPromise(function(_0x476e28,_0x4caeb1){rimraf(_0x4291ca,function(_0x1c6837){if(_0x1c6837)_0x4caeb1(_0x1c6837);return _0x476e28();});});})['then'](function(){return _0x4385aa[_0xab52('0x4f')](_0x214cdf,_0x542922,function(_0x3ec973){if(_0x3ec973){console[_0xab52('0x79')]('err',_0x3ec973);}else{fs['unlinkSync'](_0x214cdf);}});});});}else{return _0x4385aa[_0xab52('0xf')](0xc8);}})[_0xab52('0x24')](handleError(_0x4385aa,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 71c9fe0..93af9be 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 _0xaa2d=['then','setDataValue','Users','map','findAll','unreadMessages','length','catch','../../mysqldb','setMaxListeners','save','update'];(function(_0x2896c2,_0x30e986){var _0x244375=function(_0x573941){while(--_0x573941){_0x2896c2['push'](_0x2896c2['shift']());}};_0x244375(++_0x30e986);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xdaa2('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xdaa2('0x1')](0x0);var events={'afterCreate':_0xdaa2('0x2'),'afterUpdate':_0xdaa2('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc2de5c){return function(_0x113f8b,_0x27a165,_0x552169){_0x113f8b['getUsers']({'attributes':['id'],'raw':!![]})[_0xdaa2('0x4')](function(_0x4ca453){_0x113f8b[_0xdaa2('0x5')](_0xdaa2('0x6'),_0x4ca453[_0xdaa2('0x7')](function(_0x4b10b2){return{'id':_0x4b10b2['id']};}));return WhatsappMessage[_0xdaa2('0x8')]({'where':{'WhatsappInteractionId':_0x113f8b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdaa2('0x4')](function(_0x464c8c){_0x113f8b[_0xdaa2('0x5')](_0xdaa2('0x9'),_0x464c8c[_0xdaa2('0xa')]);WhatsappInteractionEvents['emit'](_0xc2de5c+':'+_0x113f8b['id'],_0x113f8b);WhatsappInteractionEvents['emit'](_0xc2de5c,_0x113f8b);_0x552169(null);})[_0xdaa2('0xb')](_0x552169(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x2242=['remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update'];(function(_0xec9322,_0x2d5b87){var _0x39d576=function(_0x542056){while(--_0x542056){_0xec9322['push'](_0xec9322['shift']());}};_0x39d576(++_0x2d5b87);}(_0x2242,0x1a3));var _0x2224=function(_0x5a2b39,_0x7684a1){_0x5a2b39=_0x5a2b39-0x0;var _0x4bfc96=_0x2242[_0x5a2b39];return _0x4bfc96;};'use strict';var EventEmitter=require(_0x2224('0x0'));var WhatsappInteraction=require(_0x2224('0x1'))['db'][_0x2224('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x2224('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2224('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2224('0x5'),'afterDestroy':_0x2224('0x6')};function emitEvent(_0x4b2099){return function(_0x272e58,_0x1ba850,_0x23a873){_0x272e58['getUsers']({'attributes':['id'],'raw':!![]})[_0x2224('0x7')](function(_0x16893c){_0x272e58[_0x2224('0x8')](_0x2224('0x9'),_0x16893c[_0x2224('0xa')](function(_0x1d3c0e){return{'id':_0x1d3c0e['id']};}));return WhatsappMessage[_0x2224('0xb')]({'where':{'WhatsappInteractionId':_0x272e58['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2224('0x7')](function(_0x359fe8){_0x272e58[_0x2224('0x8')](_0x2224('0xc'),_0x359fe8[_0x2224('0xd')]);WhatsappInteractionEvents[_0x2224('0xe')](_0x4b2099+':'+_0x272e58['id'],_0x272e58);WhatsappInteractionEvents[_0x2224('0xe')](_0x4b2099,_0x272e58);_0x23a873(null);})[_0x2224('0xf')](_0x23a873(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x2224('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 061ed6a..85171e7 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 _0x1834=['../../config/logger','api','moment','bluebird','request-promise','path','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x45e5f1,_0x5ac3ee){var _0x448018=function(_0x115b44){while(--_0x115b44){_0x45e5f1['push'](_0x45e5f1['shift']());}};_0x448018(++_0x5ac3ee);}(_0x1834,0x1c9));var _0x4183=function(_0x39f375,_0x3aa8ec){_0x39f375=_0x39f375-0x0;var _0x463f93=_0x1834[_0x39f375];return _0x463f93;};'use strict';var _=require(_0x4183('0x0'));var util=require(_0x4183('0x1'));var logger=require(_0x4183('0x2'))(_0x4183('0x3'));var moment=require(_0x4183('0x4'));var BPromise=require(_0x4183('0x5'));var rp=require(_0x4183('0x6'));var fs=require('fs');var path=require(_0x4183('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4183('0x8'));module[_0x4183('0x9')]=function(_0x4fe1b3,_0x4327ec){return _0x4fe1b3[_0x4183('0xa')](_0x4183('0xb'),attributes,{'tableName':_0x4183('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25079a,_0x3514b4,_0x3f9473){if(_0x25079a['changed'](_0x4183('0xd'))){_0x25079a[_0x4183('0xe')]=moment()[_0x4183('0xf')](_0x4183('0x10'));}_0x3f9473(null,_0x25079a);}}});}; \ No newline at end of file +var _0x2e91=['bluebird','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','closedAt','lodash','util','api','moment'];(function(_0x2577b4,_0x299f5d){var _0x2c089b=function(_0x488448){while(--_0x488448){_0x2577b4['push'](_0x2577b4['shift']());}};_0x2c089b(++_0x299f5d);}(_0x2e91,0x158));var _0x12e9=function(_0x51fcb8,_0x488303){_0x51fcb8=_0x51fcb8-0x0;var _0x4ddc02=_0x2e91[_0x51fcb8];return _0x4ddc02;};'use strict';var _=require(_0x12e9('0x0'));var util=require(_0x12e9('0x1'));var logger=require('../../config/logger')(_0x12e9('0x2'));var moment=require(_0x12e9('0x3'));var BPromise=require(_0x12e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12e9('0x5'));module[_0x12e9('0x6')]=function(_0x5aa715,_0x28addd){return _0x5aa715[_0x12e9('0x7')]('WhatsappInteraction',attributes,{'tableName':_0x12e9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5353a8,_0x4877c9,_0xb32523){if(_0x5353a8[_0x12e9('0x9')](_0x12e9('0xa'))){_0x5353a8[_0x12e9('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xb32523(null,_0x5353a8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 383d1b0..9b0d3d3 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 _0x5d4d=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappInteraction,\x20%s,\x20%s','catch','WhatsappInteraction','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','AddTags','lodash','moment','randomstring','ioredis'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x5d4d,0x18c));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5d4('0x0'));var util=require('util');var moment=require(_0xd5d4('0x1'));var BPromise=require('bluebird');var rs=require(_0xd5d4('0x2'));var fs=require('fs');var Redis=require(_0xd5d4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5d4('0x4'));var logger=require('../../config/logger')(_0xd5d4('0x5'));var config=require(_0xd5d4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd5d4('0x7')][_0xd5d4('0x8')]({'port':0x232a});config[_0xd5d4('0x9')]=_[_0xd5d4('0xa')](config['redis'],{'host':_0xd5d4('0xb'),'port':0x18eb});var socket=require(_0xd5d4('0xc'))(new Redis(config['redis']));require(_0xd5d4('0xd'))[_0xd5d4('0xe')](socket);function respondWithRpcPromise(_0x3a2b0d,_0xb880dc,_0x511622){return new BPromise(function(_0x5de7b5,_0x4888a6){return client[_0xd5d4('0xf')](_0x3a2b0d,_0x511622)[_0xd5d4('0x10')](function(_0x22d3d7){logger[_0xd5d4('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0xb880dc,_0xd5d4('0x12'));logger[_0xd5d4('0x13')](_0xd5d4('0x14'),_0xb880dc,_0xd5d4('0x12'),JSON['stringify'](_0x22d3d7));if(_0x22d3d7[_0xd5d4('0x15')]){if(_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x16')]===0x1f4){logger[_0xd5d4('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0xb880dc,_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x17')]);return _0x4888a6(_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x17')]);}logger[_0xd5d4('0x15')](_0xd5d4('0x18'),_0xb880dc,_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x17')]);return _0x5de7b5(_0x22d3d7[_0xd5d4('0x15')][_0xd5d4('0x17')]);}else{logger[_0xd5d4('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0xb880dc,_0xd5d4('0x12'));_0x5de7b5(_0x22d3d7['result']['message']);}})[_0xd5d4('0x19')](function(_0x18a7bc){logger[_0xd5d4('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0xb880dc,_0x18a7bc);_0x4888a6(_0x18a7bc);});});}exports['UpdateWhatsappInteraction']=function(_0x528578){var _0x48f4f0=this;return new Promise(function(_0x207519,_0x26ef7a){return db[_0xd5d4('0x1a')]['update'](_0x528578[_0xd5d4('0x1b')],{'raw':_0x528578[_0xd5d4('0x1c')]?_0x528578[_0xd5d4('0x1c')][_0xd5d4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x528578['options']?_0x528578['options'][_0xd5d4('0x1e')]||null:null,'attributes':_0x528578[_0xd5d4('0x1c')]?_0x528578[_0xd5d4('0x1c')][_0xd5d4('0x1f')]||null:null,'limit':_0x528578[_0xd5d4('0x1c')]?_0x528578[_0xd5d4('0x1c')][_0xd5d4('0x20')]||null:null})['then'](function(_0x56d987){logger[_0xd5d4('0x11')](_0xd5d4('0x21'),_0x528578);logger[_0xd5d4('0x13')](_0xd5d4('0x21'),_0x528578,JSON[_0xd5d4('0x22')](_0x56d987));_0x207519(_0x56d987);})[_0xd5d4('0x19')](function(_0x45f4a6){logger[_0xd5d4('0x15')](_0xd5d4('0x21'),_0x45f4a6[_0xd5d4('0x17')],_0x528578);_0x26ef7a(_0x48f4f0['error'](0x1f4,_0x45f4a6[_0xd5d4('0x17')]));});});};exports[_0xd5d4('0x23')]=function(_0x58301e){return new Promise(function(_0x132263,_0x253acd){return db[_0xd5d4('0x1a')][_0xd5d4('0x24')]({'where':_0x58301e[_0xd5d4('0x1c')]?_0x58301e[_0xd5d4('0x1c')]['where']||null:null})['then'](function(_0x38e331){if(_0x38e331){return _0x38e331[_0xd5d4('0x25')](_0x58301e['body'][_0xd5d4('0x26')],_['omit'](_0x58301e[_0xd5d4('0x1b')],[_0xd5d4('0x26'),'id'])||{});}})['spread'](function(_0x1cf8d2){logger[_0xd5d4('0x11')](_0xd5d4('0x27'),_0x58301e);logger[_0xd5d4('0x13')](_0xd5d4('0x27'),_0x58301e,JSON[_0xd5d4('0x22')](_0x1cf8d2));_0x132263(_0x1cf8d2);})[_0xd5d4('0x19')](function(_0x49c4fd){logger['error'](_0xd5d4('0x27'),_0x49c4fd['message'],_0x58301e);_0x253acd(_this[_0xd5d4('0x15')](0x1f4,_0x49c4fd[_0xd5d4('0x17')]));});});}; \ No newline at end of file +var _0x25a9=['defaults','redis','localhost','./whatsappInteraction.socket','register','request','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','limit','find','where','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x140fe6,_0x56dbfb){var _0x244f22=function(_0x575aee){while(--_0x575aee){_0x140fe6['push'](_0x140fe6['shift']());}};_0x244f22(++_0x56dbfb);}(_0x25a9,0x173));var _0x925a=function(_0x125106,_0x1a5f5d){_0x125106=_0x125106-0x0;var _0xc1ffd5=_0x25a9[_0x125106];return _0xc1ffd5;};'use strict';var _=require(_0x925a('0x0'));var util=require('util');var moment=require(_0x925a('0x1'));var BPromise=require(_0x925a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x925a('0x3'));var db=require(_0x925a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x925a('0x5'));var config=require('../../config/environment');var jayson=require(_0x925a('0x6'));var client=jayson[_0x925a('0x7')][_0x925a('0x8')]({'port':0x232a});config['redis']=_[_0x925a('0x9')](config[_0x925a('0xa')],{'host':_0x925a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x925a('0xc'))[_0x925a('0xd')](socket);function respondWithRpcPromise(_0x32dae8,_0x5acfc8,_0x461a0e){return new BPromise(function(_0x559c65,_0x30db53){return client[_0x925a('0xe')](_0x32dae8,_0x461a0e)[_0x925a('0xf')](function(_0x22d85c){logger[_0x925a('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x5acfc8,'request\x20sent');logger[_0x925a('0x11')](_0x925a('0x12'),_0x5acfc8,_0x925a('0x13'),JSON[_0x925a('0x14')](_0x22d85c));if(_0x22d85c['error']){if(_0x22d85c[_0x925a('0x15')]['code']===0x1f4){logger[_0x925a('0x15')](_0x925a('0x16'),_0x5acfc8,_0x22d85c[_0x925a('0x15')]['message']);return _0x30db53(_0x22d85c[_0x925a('0x15')]['message']);}logger[_0x925a('0x15')](_0x925a('0x16'),_0x5acfc8,_0x22d85c[_0x925a('0x15')][_0x925a('0x17')]);return _0x559c65(_0x22d85c[_0x925a('0x15')][_0x925a('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x5acfc8,_0x925a('0x13'));_0x559c65(_0x22d85c['result']['message']);}})[_0x925a('0x18')](function(_0x3e9810){logger[_0x925a('0x15')](_0x925a('0x16'),_0x5acfc8,_0x3e9810);_0x30db53(_0x3e9810);});});}exports[_0x925a('0x19')]=function(_0x534327){var _0x4d7c0c=this;return new Promise(function(_0x316d69,_0x4e93ac){return db[_0x925a('0x1a')][_0x925a('0x1b')](_0x534327[_0x925a('0x1c')],{'raw':_0x534327[_0x925a('0x1d')]?_0x534327['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x534327[_0x925a('0x1d')]?_0x534327[_0x925a('0x1d')]['where']||null:null,'attributes':_0x534327[_0x925a('0x1d')]?_0x534327[_0x925a('0x1d')]['attributes']||null:null,'limit':_0x534327[_0x925a('0x1d')]?_0x534327[_0x925a('0x1d')][_0x925a('0x1e')]||null:null})['then'](function(_0x176d57){logger[_0x925a('0x10')](_0x925a('0x19'),_0x534327);logger[_0x925a('0x11')](_0x925a('0x19'),_0x534327,JSON['stringify'](_0x176d57));_0x316d69(_0x176d57);})[_0x925a('0x18')](function(_0x5445a4){logger['error'](_0x925a('0x19'),_0x5445a4[_0x925a('0x17')],_0x534327);_0x4e93ac(_0x4d7c0c[_0x925a('0x15')](0x1f4,_0x5445a4['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x516261){return new Promise(function(_0x541145,_0x374a82){return db['WhatsappInteraction'][_0x925a('0x1f')]({'where':_0x516261['options']?_0x516261[_0x925a('0x1d')][_0x925a('0x20')]||null:null})[_0x925a('0xf')](function(_0x157a16){if(_0x157a16){return _0x157a16[_0x925a('0x21')](_0x516261[_0x925a('0x1c')][_0x925a('0x22')],_[_0x925a('0x23')](_0x516261['body'],[_0x925a('0x22'),'id'])||{});}})[_0x925a('0x24')](function(_0x44a869){logger[_0x925a('0x10')](_0x925a('0x25'),_0x516261);logger[_0x925a('0x11')](_0x925a('0x25'),_0x516261,JSON[_0x925a('0x14')](_0x44a869));_0x541145(_0x44a869);})[_0x925a('0x18')](function(_0x597891){logger[_0x925a('0x15')](_0x925a('0x25'),_0x597891[_0x925a('0x17')],_0x516261);_0x374a82(_this['error'](0x1f4,_0x597891[_0x925a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f47aba6..d8bc9e0 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 _0x326d=['update','removeListener','register','length','whatsappInteraction:','save'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x326d,0x1af));var _0xd326=function(_0x48796d,_0x30b860){_0x48796d=_0x48796d-0x0;var _0x3b1572=_0x326d[_0x48796d];return _0x3b1572;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xd326('0x0'),'remove',_0xd326('0x1')];function createListener(_0x311f75,_0x4a8af2){return function(_0x5a4cb9){_0x4a8af2['emit'](_0x311f75,_0x5a4cb9);};}function removeListener(_0x50ddb2,_0x36ee92){return function(){WhatsappInteractionEvents[_0xd326('0x2')](_0x50ddb2,_0x36ee92);};}exports[_0xd326('0x3')]=function(_0x21543b){for(var _0x2015fa=0x0,_0x217fe8=events[_0xd326('0x4')];_0x2015fa<_0x217fe8;_0x2015fa++){var _0x5a9576=events[_0x2015fa];var _0x108dc7=createListener(_0xd326('0x5')+_0x5a9576,_0x21543b);WhatsappInteractionEvents['on'](_0x5a9576,_0x108dc7);}}; \ No newline at end of file +var _0x6c77=['length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','register'];(function(_0x28e96c,_0x2d75ed){var _0x1db3d5=function(_0x101ebd){while(--_0x101ebd){_0x28e96c['push'](_0x28e96c['shift']());}};_0x1db3d5(++_0x2d75ed);}(_0x6c77,0x152));var _0x76c7=function(_0x120900,_0x1b16c7){_0x120900=_0x120900-0x0;var _0x356528=_0x6c77[_0x120900];return _0x356528;};'use strict';var WhatsappInteractionEvents=require(_0x76c7('0x0'));var events=['save',_0x76c7('0x1'),_0x76c7('0x2')];function createListener(_0x348df4,_0x4fca3f){return function(_0x5136a0){_0x4fca3f[_0x76c7('0x3')](_0x348df4,_0x5136a0);};}function removeListener(_0x245ffa,_0x5ee312){return function(){WhatsappInteractionEvents[_0x76c7('0x4')](_0x245ffa,_0x5ee312);};}exports[_0x76c7('0x5')]=function(_0x50fd8b){for(var _0x18fde8=0x0,_0x2cba45=events[_0x76c7('0x6')];_0x18fde8<_0x2cba45;_0x18fde8++){var _0x5eccf9=events[_0x18fde8];var _0x46d30c=createListener(_0x76c7('0x7')+_0x5eccf9,_0x50fd8b);WhatsappInteractionEvents['on'](_0x5eccf9,_0x46d30c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 99556a1..82f29db 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 _0xffbb=['../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffbb,0xc5));var _0xbffb=function(_0x51e1e7,_0x5c7bca){_0x51e1e7=_0x51e1e7-0x0;var _0x568f5c=_0xffbb[_0x51e1e7];return _0x568f5c;};'use strict';var multer=require(_0xbffb('0x0'));var util=require('util');var path=require(_0xbffb('0x1'));var timeout=require(_0xbffb('0x2'));var express=require(_0xbffb('0x3'));var router=express[_0xbffb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbffb('0x5'));var interaction=require(_0xbffb('0x6'));var config=require(_0xbffb('0x7'));var controller=require(_0xbffb('0x8'));router[_0xbffb('0x9')]('/',auth['isAuthenticated'](),controller[_0xbffb('0xa')]);router[_0xbffb('0x9')](_0xbffb('0xb'),auth[_0xbffb('0xc')](),controller[_0xbffb('0xd')]);router['get'](_0xbffb('0xe'),auth[_0xbffb('0xc')](),controller[_0xbffb('0xf')]);router[_0xbffb('0x10')]('/',auth['isAuthenticated'](),interaction[_0xbffb('0x11')](_0xbffb('0x12'),_0xbffb('0x13')),controller['create']);router[_0xbffb('0x10')](_0xbffb('0x14'),controller[_0xbffb('0x15')]);router[_0xbffb('0x16')](_0xbffb('0xe'),auth[_0xbffb('0xc')](),controller['update']);router[_0xbffb('0x16')](_0xbffb('0x17'),auth['isAuthenticated'](),controller[_0xbffb('0x18')]);router[_0xbffb('0x16')](_0xbffb('0x19'),auth[_0xbffb('0xc')](),controller['reject']);router[_0xbffb('0x1a')](_0xbffb('0xe'),auth[_0xbffb('0xc')](),controller[_0xbffb('0x1b')]);module[_0xbffb('0x1c')]=router; \ No newline at end of file +var _0x7fd0=['/:id','show','whatsapp','create','post','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x43685c,_0x4616ff){var _0x4264c1=function(_0x186d8d){while(--_0x186d8d){_0x43685c['push'](_0x43685c['shift']());}};_0x4264c1(++_0x4616ff);}(_0x7fd0,0xa9));var _0x07fd=function(_0x10f98d,_0x7658d3){_0x10f98d=_0x10f98d-0x0;var _0x11befb=_0x7fd0[_0x10f98d];return _0x11befb;};'use strict';var multer=require(_0x07fd('0x0'));var util=require(_0x07fd('0x1'));var path=require(_0x07fd('0x2'));var timeout=require('connect-timeout');var express=require(_0x07fd('0x3'));var router=express['Router']();var fs_extra=require(_0x07fd('0x4'));var auth=require(_0x07fd('0x5'));var interaction=require(_0x07fd('0x6'));var config=require('../../config/environment');var controller=require(_0x07fd('0x7'));router[_0x07fd('0x8')]('/',auth[_0x07fd('0x9')](),controller[_0x07fd('0xa')]);router[_0x07fd('0x8')](_0x07fd('0xb'),auth[_0x07fd('0x9')](),controller[_0x07fd('0xc')]);router[_0x07fd('0x8')](_0x07fd('0xd'),auth['isAuthenticated'](),controller[_0x07fd('0xe')]);router['post']('/',auth[_0x07fd('0x9')](),interaction['tracked'](_0x07fd('0xf'),'whatsappmessage:create'),controller[_0x07fd('0x10')]);router[_0x07fd('0x11')]('/:id/status',controller[_0x07fd('0x12')]);router[_0x07fd('0x13')](_0x07fd('0xd'),auth[_0x07fd('0x9')](),controller[_0x07fd('0x14')]);router[_0x07fd('0x13')](_0x07fd('0x15'),auth[_0x07fd('0x9')](),controller[_0x07fd('0x16')]);router[_0x07fd('0x13')](_0x07fd('0x17'),auth['isAuthenticated'](),controller[_0x07fd('0x18')]);router['delete'](_0x07fd('0xd'),auth[_0x07fd('0x9')](),controller[_0x07fd('0x19')]);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 d8af12f..5721fba 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 _0xb515=['medium','BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x5472cb,_0x1108b7){var _0x564309=function(_0x593a9d){while(--_0x593a9d){_0x5472cb['push'](_0x5472cb['shift']());}};_0x564309(++_0x1108b7);}(_0xb515,0x195));var _0x5b51=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xb515[_0x17c483];return _0x112bdb;};'use strict';var Sequelize=require(_0x5b51('0x0'));module[_0x5b51('0x1')]={'body':{'type':Sequelize[_0x5b51('0x2')](_0x5b51('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5b51('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5b51('0x5')),'defaultValue':_0x5b51('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x5b51('0x6')]},'readAt':{'type':Sequelize[_0x5b51('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5b51('0x6')]},'providerResponse':{'type':Sequelize[_0x5b51('0x2')]}}; \ No newline at end of file +var _0x06fe=['ENUM','out','STRING','sequelize','TEXT','BOOLEAN'];(function(_0x4268c4,_0x1722af){var _0x2cd6c9=function(_0x43fd2b){while(--_0x43fd2b){_0x4268c4['push'](_0x4268c4['shift']());}};_0x2cd6c9(++_0x1722af);}(_0x06fe,0xff));var _0xe06f=function(_0x3879f5,_0x5b4fe8){_0x3879f5=_0x3879f5-0x0;var _0x27ee90=_0x06fe[_0x3879f5];return _0x27ee90;};'use strict';var Sequelize=require(_0xe06f('0x0'));module['exports']={'body':{'type':Sequelize[_0xe06f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe06f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe06f('0x3')]('in','out'),'defaultValue':_0xe06f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe06f('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe06f('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe06f('0x5')]},'providerResponse':{'type':Sequelize[_0xe06f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5e3386e..9635490 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 _0xe26e=['interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT','User','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','twilio','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x273fcb,_0x576f40){var _0xebff6b=function(_0x571b7f){while(--_0x571b7f){_0x273fcb['push'](_0x273fcb['shift']());}};_0xebff6b(++_0x576f40);}(_0xe26e,0x1cf));var _0xee26=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe26e[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee26('0x0'));var zipdir=require(_0xee26('0x1'));var jsonpatch=require(_0xee26('0x2'));var rp=require(_0xee26('0x3'));var moment=require(_0xee26('0x4'));var BPromise=require(_0xee26('0x5'));var Mustache=require(_0xee26('0x6'));var util=require(_0xee26('0x7'));var path=require('path');var sox=require(_0xee26('0x8'));var csv=require(_0xee26('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee26('0xa'));var _=require(_0xee26('0xb'));var squel=require(_0xee26('0xc'));var crypto=require(_0xee26('0xd'));var jsforce=require(_0xee26('0xe'));var deskjs=require(_0xee26('0xf'));var toCsv=require(_0xee26('0x9'));var querystring=require(_0xee26('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee26('0x11'));var qs=require(_0xee26('0x12'));var as=require(_0xee26('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee26('0x14'))(_0xee26('0x15'));var utils=require(_0xee26('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee26('0x17'))['db'];config[_0xee26('0x18')]=_[_0xee26('0x19')](config[_0xee26('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xee26('0x1a'))(new Redis(config['redis']));require(_0xee26('0x1b'))[_0xee26('0x1c')](socket);var jayson=require(_0xee26('0x1d'));var client=jayson[_0xee26('0x1e')][_0xee26('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xee26('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1a4a83,_0x17b5b6,_0x456099,_0x2acef3){return new BPromise(function(_0x397dfc,_0x2bd865){var _0x52f470=_0x2acef3||client;return _0x52f470['request'](_0x1a4a83,_0x456099)[_0xee26('0x20')](function(_0x581d3b){logger['info'](_0xee26('0x21'),_0x17b5b6,'request\x20sent');logger[_0xee26('0x22')](_0xee26('0x23'),_0x17b5b6,_0xee26('0x24'),JSON[_0xee26('0x25')](_0x581d3b));if(_0x581d3b[_0xee26('0x26')]){if(_0x581d3b[_0xee26('0x26')][_0xee26('0x27')]===0x1f4){logger[_0xee26('0x26')](_0xee26('0x21'),_0x17b5b6,_0x581d3b[_0xee26('0x26')]['message']);return _0x2bd865(_0x581d3b[_0xee26('0x26')]['message']);}logger[_0xee26('0x26')](_0xee26('0x21'),_0x17b5b6,_0x581d3b[_0xee26('0x26')][_0xee26('0x28')]);return _0x397dfc(_0x581d3b['error'][_0xee26('0x28')]);}else{logger[_0xee26('0x29')](_0xee26('0x21'),_0x17b5b6,_0xee26('0x24'));_0x397dfc(_0x581d3b[_0xee26('0x2a')]['message']);}})[_0xee26('0x2b')](function(_0x4fbd40){logger[_0xee26('0x26')](_0xee26('0x21'),_0x17b5b6,_0x4fbd40);_0x2bd865(_0x4fbd40);});});}function respondWithStatusCode(_0x479a8e,_0x30d1aa){_0x30d1aa=_0x30d1aa||0xcc;return function(_0x5b4978){if(_0x5b4978){return _0x479a8e[_0xee26('0x2c')](_0x30d1aa);}return _0x479a8e['status'](_0x30d1aa)[_0xee26('0x2d')]();};}function respondWithResult(_0x48c49f,_0x3778f1){_0x3778f1=_0x3778f1||0xc8;return function(_0x59d019){if(_0x59d019){return _0x48c49f['status'](_0x3778f1)[_0xee26('0x2e')](_0x59d019);}};}function respondWithFilteredResult(_0x4dbba1,_0x8b8927){return function(_0x1822d2){if(_0x1822d2){var _0x412dde=typeof _0x8b8927[_0xee26('0x2f')]===_0xee26('0x30')&&typeof _0x8b8927[_0xee26('0x31')]===_0xee26('0x30');var _0x1a3ebc=_0x1822d2[_0xee26('0x32')];var _0x2b28f=_0x412dde?0x0:_0x8b8927[_0xee26('0x2f')];var _0x49c08a=_0x412dde?_0x1822d2[_0xee26('0x32')]:_0x8b8927[_0xee26('0x2f')]+_0x8b8927['limit'];var _0x942796;if(_0x49c08a>=_0x1a3ebc){_0x49c08a=_0x1a3ebc;_0x942796=0xc8;}else{_0x942796=0xce;}_0x4dbba1[_0xee26('0x33')](_0x942796);return _0x4dbba1[_0xee26('0x34')](_0xee26('0x35'),_0x2b28f+'-'+_0x49c08a+'/'+_0x1a3ebc)[_0xee26('0x2e')](_0x1822d2);}return null;};}function patchUpdates(_0x3aa48b){return function(_0x5b3086){try{jsonpatch[_0xee26('0x36')](_0x5b3086,_0x3aa48b,!![]);}catch(_0x3e52de){return BPromise['reject'](_0x3e52de);}return _0x5b3086['save']();};}function saveUpdates(_0x1e9e77,_0x431579){return function(_0x5ef6ba){if(_0x5ef6ba){return _0x5ef6ba[_0xee26('0x37')](_0x1e9e77)[_0xee26('0x20')](function(_0x1ff2e8){return _0x1ff2e8;});}return null;};}function removeEntity(_0x4618fd,_0x256207){return function(_0x596cb4){if(_0x596cb4){return _0x596cb4['destroy']()[_0xee26('0x20')](function(){_0x4618fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd7ba21,_0x46fc17){return function(_0x431864){if(!_0x431864){_0xd7ba21[_0xee26('0x2c')](0x194);}return _0x431864;};}function handleError(_0x54eb5a,_0x122ed7){_0x122ed7=_0x122ed7||0x1f4;return function(_0x2b19b8){logger[_0xee26('0x26')](_0x2b19b8[_0xee26('0x38')]);if(_0x2b19b8['name']){delete _0x2b19b8[_0xee26('0x39')];}_0x54eb5a[_0xee26('0x33')](_0x122ed7)[_0xee26('0x3a')](_0x2b19b8);};}exports[_0xee26('0x3b')]=function(_0x1d3157,_0x406c31){var _0x1f49b8={},_0x51a156={},_0x5496f1={'count':0x0,'rows':[]};var _0x3095e9=_[_0xee26('0x3c')](db[_0xee26('0x3d')]['rawAttributes'],function(_0x45b627){return{'name':_0x45b627[_0xee26('0x3e')],'type':_0x45b627[_0xee26('0x3f')][_0xee26('0x40')]};});_0x51a156[_0xee26('0x41')]=_[_0xee26('0x3c')](_0x3095e9,'name');_0x51a156[_0xee26('0x42')]=_['keys'](_0x1d3157[_0xee26('0x42')]);_0x51a156[_0xee26('0x43')]=_['intersection'](_0x51a156[_0xee26('0x41')],_0x51a156['query']);_0x1f49b8['attributes']=_[_0xee26('0x44')](_0x51a156[_0xee26('0x41')],qs['fields'](_0x1d3157[_0xee26('0x42')][_0xee26('0x45')]));_0x1f49b8[_0xee26('0x46')]=_0x1f49b8['attributes'][_0xee26('0x47')]?_0x1f49b8['attributes']:_0x51a156[_0xee26('0x41')];if(!_0x1d3157[_0xee26('0x42')][_0xee26('0x48')](_0xee26('0x49'))){_0x1f49b8[_0xee26('0x31')]=qs[_0xee26('0x31')](_0x1d3157[_0xee26('0x42')]['limit']);_0x1f49b8[_0xee26('0x2f')]=qs[_0xee26('0x2f')](_0x1d3157[_0xee26('0x42')][_0xee26('0x2f')]);}_0x1f49b8[_0xee26('0x4a')]=qs[_0xee26('0x4b')](_0x1d3157[_0xee26('0x42')][_0xee26('0x4b')]);_0x1f49b8['where']=qs[_0xee26('0x43')](_['pick'](_0x1d3157['query'],_0x51a156[_0xee26('0x43')]),_0x3095e9);if(_0x1d3157['query'][_0xee26('0x4c')]){_0x1f49b8['where']=_['merge'](_0x1f49b8[_0xee26('0x4d')],{'$or':_[_0xee26('0x3c')](_0x3095e9,function(_0x62f7ca){if(_0x62f7ca[_0xee26('0x3f')]!==_0xee26('0x4e')){var _0x30e76e={};_0x30e76e[_0x62f7ca['name']]={'$like':'%'+_0x1d3157[_0xee26('0x42')][_0xee26('0x4c')]+'%'};return _0x30e76e;}})});}_0x1f49b8=_[_0xee26('0x4f')]({},_0x1f49b8,_0x1d3157[_0xee26('0x50')]);var _0x2fefdc={'where':_0x1f49b8[_0xee26('0x4d')]};return db[_0xee26('0x3d')][_0xee26('0x32')](_0x2fefdc)[_0xee26('0x20')](function(_0x31f6db){_0x5496f1[_0xee26('0x32')]=_0x31f6db;if(_0x1d3157['query'][_0xee26('0x51')]){_0x1f49b8[_0xee26('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xee26('0x53')](_0x1f49b8);})['then'](function(_0xfa7209){_0x5496f1[_0xee26('0x54')]=_0xfa7209;return _0x5496f1;})[_0xee26('0x20')](respondWithFilteredResult(_0x406c31,_0x1f49b8))[_0xee26('0x2b')](handleError(_0x406c31,null));};exports[_0xee26('0x55')]=function(_0x16f90a,_0x5b2497){var _0x4cca1d={'raw':!![],'where':{'id':_0x16f90a[_0xee26('0x56')]['id']}},_0xaf7f2c={};_0xaf7f2c[_0xee26('0x41')]=_[_0xee26('0x57')](db[_0xee26('0x3d')][_0xee26('0x58')]);_0xaf7f2c['query']=_[_0xee26('0x57')](_0x16f90a['query']);_0xaf7f2c['filters']=_[_0xee26('0x44')](_0xaf7f2c[_0xee26('0x41')],_0xaf7f2c['query']);_0x4cca1d['attributes']=_[_0xee26('0x44')](_0xaf7f2c[_0xee26('0x41')],qs[_0xee26('0x45')](_0x16f90a[_0xee26('0x42')][_0xee26('0x45')]));_0x4cca1d[_0xee26('0x46')]=_0x4cca1d[_0xee26('0x46')][_0xee26('0x47')]?_0x4cca1d[_0xee26('0x46')]:_0xaf7f2c[_0xee26('0x41')];if(_0x16f90a['query'][_0xee26('0x51')]){_0x4cca1d[_0xee26('0x52')]=[{'all':!![]}];}_0x4cca1d=_[_0xee26('0x4f')]({},_0x4cca1d,_0x16f90a[_0xee26('0x50')]);return db['WhatsappMessage'][_0xee26('0x59')](_0x4cca1d)[_0xee26('0x20')](handleEntityNotFound(_0x5b2497,null))['then'](respondWithResult(_0x5b2497,null))[_0xee26('0x2b')](handleError(_0x5b2497,null));};exports[_0xee26('0x5a')]=function(_0x571bc5,_0x98c4b7){return db[_0xee26('0x3d')]['create'](_0x571bc5[_0xee26('0x5b')],{})[_0xee26('0x20')](respondWithResult(_0x98c4b7,0xc9))[_0xee26('0x2b')](handleError(_0x98c4b7,null));};exports[_0xee26('0x37')]=function(_0x1ac874,_0x512aa8){if(_0x1ac874[_0xee26('0x5b')]['id']){delete _0x1ac874['body']['id'];}return db[_0xee26('0x3d')][_0xee26('0x59')]({'where':{'id':_0x1ac874['params']['id']}})[_0xee26('0x20')](handleEntityNotFound(_0x512aa8,null))[_0xee26('0x20')](saveUpdates(_0x1ac874['body'],null))[_0xee26('0x20')](respondWithResult(_0x512aa8,null))[_0xee26('0x2b')](handleError(_0x512aa8,null));};exports['destroy']=function(_0x5c3fa9,_0x898188){return db[_0xee26('0x3d')][_0xee26('0x59')]({'where':{'id':_0x5c3fa9['params']['id']}})[_0xee26('0x20')](handleEntityNotFound(_0x898188,null))[_0xee26('0x20')](removeEntity(_0x898188,null))[_0xee26('0x2b')](handleError(_0x898188,null));};exports['describe']=function(_0x5d09fd,_0x5dd1d3){return db[_0xee26('0x3d')][_0xee26('0x5c')]()[_0xee26('0x20')](respondWithResult(_0x5dd1d3,null))[_0xee26('0x2b')](handleError(_0x5dd1d3,null));};var interaction_log=require(_0xee26('0x14'))(_0xee26('0x5d'));exports[_0xee26('0x5e')]=function(_0x410ff9,_0x35efe8,_0x1019a5){var _0x3ef4af={'agent':{},'channel':_0xee26('0x5f')};if(_0x410ff9[_0xee26('0x5b')]['id']){delete _0x410ff9[_0xee26('0x5b')]['id'];}_0x410ff9['body']['read']=!![];_0x410ff9[_0xee26('0x5b')][_0xee26('0x60')]=moment()[_0xee26('0x61')](_0xee26('0x62'));_0x410ff9['body'][_0xee26('0x63')]=_0x410ff9[_0xee26('0x5b')][_0xee26('0x63')]||_0x410ff9[_0xee26('0x64')]['id'];_0x3ef4af[_0xee26('0x65')]['id']=_0x410ff9[_0xee26('0x5b')]['UserId'];return db[_0xee26('0x3d')]['find']({'where':{'id':_0x410ff9[_0xee26('0x56')]['id'],'UserId':null}})[_0xee26('0x20')](handleEntityNotFound(_0x35efe8,null))['then'](saveUpdates(_0x410ff9[_0xee26('0x5b')],null))[_0xee26('0x20')](function(_0x357ab0){if(_0x357ab0){_0x3ef4af[_0xee26('0x28')]=_0x357ab0['get']({'plain':!![]});return db[_0xee26('0x66')][_0xee26('0x59')]({'where':{'id':_0x357ab0[_0xee26('0x67')]}});}return null;})[_0xee26('0x20')](handleEntityNotFound(_0x35efe8,null))[_0xee26('0x20')](function(_0x3fe34f){if(_0x3fe34f){return _0x3fe34f[_0xee26('0x37')]({'UserId':_0x410ff9[_0xee26('0x5b')][_0xee26('0x63')],'read1stAt':_[_0xee26('0x68')](_0x3fe34f[_0xee26('0x69')])?moment()[_0xee26('0x61')](_0xee26('0x62')):undefined});}return null;})[_0xee26('0x20')](function(_0xecb556){if(_0xecb556){_0x3ef4af['interaction']=_0xecb556[_0xee26('0x6a')]({'plain':!![]});interaction_log[_0xee26('0x29')](_0xee26('0x6b'),_0x410ff9['user']['id'],_0x410ff9[_0xee26('0x64')][_0xee26('0x39')],_0x410ff9[_0xee26('0x64')][_0xee26('0x6c')],_0x3ef4af[_0xee26('0x6d')]['id'],_0x410ff9['body']?JSON[_0xee26('0x25')](_0x410ff9['body']):'null');return respondWithRpcPromise(_0xee26('0x6e'),_0xee26('0x6f'),_0x3ef4af);}return null;})[_0xee26('0x20')](function(_0x4eafbc){var _0x755de6=_0xee26('0x70')+_0x4eafbc[_0xee26('0x28')][_0xee26('0x71')];return db[_0xee26('0x72')][_0xee26('0x42')](_0x755de6,{'type':db[_0xee26('0x73')][_0xee26('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x40792c){return _0x40792c;});})[_0xee26('0x20')](function(_0x4dce5c){if(_0x4dce5c){_0x3ef4af[_0xee26('0x28')][_0xee26('0x75')]=_0x4dce5c[0x0];if(!_0x410ff9[_0xee26('0x5b')][_0xee26('0x63')])return;return db['User'][_0xee26('0x59')]({'where':{'id':_0x410ff9[_0xee26('0x5b')][_0xee26('0x63')],'role':_0xee26('0x65')},'attributes':['id','name',_0xee26('0x76'),_0xee26('0x77'),_0xee26('0x78')],'raw':!![]});}return null;})[_0xee26('0x20')](function(_0x575130){if(!_0x575130)return null;_0x3ef4af[_0xee26('0x28')][_0xee26('0x65')]=_0x575130;return _0x3ef4af;})[_0xee26('0x20')](function(_0x1b9a08){if(_0x1b9a08){if(_0x410ff9[_0xee26('0x5b')][_0xee26('0x79')]){_0x3ef4af['message'][_0xee26('0x7a')]=util[_0xee26('0x61')](_0xee26('0x7b'),_0x410ff9['user'][_0xee26('0x39')]);_0x3ef4af['message'][_0xee26('0x7c')]=_0x3ef4af[_0xee26('0x7c')];_0x3ef4af['message'][_0xee26('0x7d')]=_0x3ef4af['channel'];_0x3ef4af[_0xee26('0x28')][_0xee26('0x7e')]='accept';return respondWithRpcPromise(_0xee26('0x7f'),_0xee26('0x7f'),{'event':_0xee26('0x80'),'message':_0x3ef4af[_0xee26('0x28')]},client9002)[_0xee26('0x20')](function(){return _0x3ef4af;});}return _0x3ef4af;}return null;})[_0xee26('0x20')](respondWithResult(_0x35efe8,null))[_0xee26('0x2b')](handleError(_0x35efe8,null));};var interaction_log=require(_0xee26('0x14'))(_0xee26('0x5d'));exports[_0xee26('0x81')]=function(_0x25a0d1,_0x5d7fe2,_0x300435){var _0x1d9e22={'agent':{},'channel':_0xee26('0x5f')};if(_0x25a0d1[_0xee26('0x5b')]['id']){delete _0x25a0d1[_0xee26('0x5b')]['id'];}_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')]=_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')]||_0x25a0d1[_0xee26('0x64')]['id'];_0x1d9e22['agent']['id']=_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')];return db[_0xee26('0x3d')]['find']({'where':{'id':_0x25a0d1['params']['id'],'UserId':null}})[_0xee26('0x20')](handleEntityNotFound(_0x5d7fe2,null))['then'](function(_0x1d0fd0){if(_0x1d0fd0){_0x1d9e22[_0xee26('0x28')]=_0x1d0fd0['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x1d0fd0[_0xee26('0x67')]}});}return null;})[_0xee26('0x20')](handleEntityNotFound(_0x5d7fe2,null))['then'](function(_0x227c42){if(_0x227c42){_0x1d9e22[_0xee26('0x6d')]=_0x227c42[_0xee26('0x6a')]({'plain':!![]});interaction_log[_0xee26('0x29')](_0xee26('0x82'),_0x25a0d1[_0xee26('0x64')]['id'],_0x25a0d1[_0xee26('0x64')][_0xee26('0x39')],_0x25a0d1[_0xee26('0x64')][_0xee26('0x6c')],_0x1d9e22[_0xee26('0x6d')]['id'],_0x25a0d1['body']?JSON[_0xee26('0x25')](_0x25a0d1[_0xee26('0x5b')]):_0xee26('0x83'));return respondWithRpcPromise(_0xee26('0x84'),'rejectMessage',_0x1d9e22);}return null;})['then'](function(_0x3c0cf8){var _0x496ed2=_0xee26('0x70')+_0x3c0cf8['message']['ContactId'];return db[_0xee26('0x72')][_0xee26('0x42')](_0x496ed2,{'type':db[_0xee26('0x73')][_0xee26('0x74')][_0xee26('0x85')],'raw':!![]})[_0xee26('0x20')](function(_0x25ba5b){return _0x25ba5b;});})['then'](function(_0x818562){if(_0x818562){_0x1d9e22[_0xee26('0x28')][_0xee26('0x75')]=_0x818562[0x0];if(!_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')])return;return db[_0xee26('0x86')]['find']({'where':{'id':_0x25a0d1[_0xee26('0x5b')][_0xee26('0x63')],'role':_0xee26('0x65')},'attributes':['id','name',_0xee26('0x76'),_0xee26('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3c7842){if(!_0x3c7842)return null;_0x1d9e22[_0xee26('0x28')][_0xee26('0x65')]=_0x3c7842;return _0x1d9e22;})[_0xee26('0x20')](function(_0x5af104){if(_0x5af104){_0x5af104[_0xee26('0x28')][_0xee26('0x7a')]=util[_0xee26('0x61')]('SIP/%s',_0x25a0d1['user']['name']);_0x5af104['message'][_0xee26('0x7c')]=_0x1d9e22[_0xee26('0x7c')];_0x5af104[_0xee26('0x28')][_0xee26('0x7d')]=_0x1d9e22[_0xee26('0x7c')];_0x5af104[_0xee26('0x28')][_0xee26('0x7e')]=_0xee26('0x81');respondWithRpcPromise(_0xee26('0x7f'),_0xee26('0x7f'),{'event':'rejectmessage','message':_0x5af104[_0xee26('0x28')]},client9002);return _0x1d9e22;}return null;})[_0xee26('0x20')](respondWithResult(_0x5d7fe2,null))[_0xee26('0x2b')](handleError(_0x5d7fe2,null));};exports[_0xee26('0x33')]=function(_0x3dde91,_0x1188d1,_0x3e3662){if(_0x3dde91[_0xee26('0x5b')]['id']){delete _0x3dde91[_0xee26('0x5b')]['id'];}var _0x1d6050;return db[_0xee26('0x3d')][_0xee26('0x59')]({'where':{'id':_0x3dde91['params']['id']}})[_0xee26('0x20')](handleEntityNotFound(_0x1188d1,null))[_0xee26('0x20')](function(_0x223003){if(_0x223003){_0x1d6050=_0x223003;return db[_0xee26('0x87')][_0xee26('0x59')]({'where':{'id':_0x223003['WhatsappAccountId']}});}})[_0xee26('0x20')](handleEntityNotFound(_0x1188d1,null))[_0xee26('0x20')](function(_0x502edf){if(_0x502edf){logger[_0xee26('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xee26('0x33'),_0xee26('0x88'),_0x502edf[_0xee26('0x3f')],util[_0xee26('0x89')](_0x3dde91[_0xee26('0x5b')],{'showHidden':![],'depth':null}));switch(_0x502edf[_0xee26('0x3f')]){case'twilio':if(_0x3dde91[_0xee26('0x5b')][_0xee26('0x8a')]&&_0x3dde91[_0xee26('0x5b')][_0xee26('0x8a')]===_0x1d6050[_0xee26('0x8b')]&&_0x3dde91[_0xee26('0x5b')][_0xee26('0x8c')]&&_0x3dde91[_0xee26('0x5b')][_0xee26('0x8c')]===_0xee26('0x8d')){return _0x1d6050[_0xee26('0x37')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xee26('0x33'),_0xee26('0x8e'),util['inspect'](_0x3dde91[_0xee26('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x1d6050;}})['then'](respondWithResult(_0x1188d1,null))[_0xee26('0x2b')](handleError(_0x1188d1,null));}; \ No newline at end of file +var _0xf737=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','offset','undefined','limit','count','set','apply','reject','update','sendStatus','stack','name','send','index','WhatsappMessage','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','keys','include','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','fullname','internal','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/parsers/qs'];(function(_0x481cde,_0x11c1d1){var _0x41b368=function(_0x2e34ea){while(--_0x2e34ea){_0x481cde['push'](_0x481cde['shift']());}};_0x41b368(++_0x11c1d1);}(_0xf737,0x102));var _0x7f73=function(_0x1819be,_0x19ba61){_0x1819be=_0x1819be-0x0;var _0x1d1dea=_0xf737[_0x1819be];return _0x1d1dea;};'use strict';var emlformat=require(_0x7f73('0x0'));var rimraf=require(_0x7f73('0x1'));var zipdir=require(_0x7f73('0x2'));var jsonpatch=require(_0x7f73('0x3'));var rp=require(_0x7f73('0x4'));var moment=require('moment');var BPromise=require(_0x7f73('0x5'));var Mustache=require(_0x7f73('0x6'));var util=require(_0x7f73('0x7'));var path=require(_0x7f73('0x8'));var sox=require('sox');var csv=require(_0x7f73('0x9'));var ejs=require(_0x7f73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f73('0xb'));var squel=require('squel');var crypto=require(_0x7f73('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7f73('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f73('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f73('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f73('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x7f73('0x11'));var config=require(_0x7f73('0x12'));var licenseUtil=require(_0x7f73('0x13'));var db=require(_0x7f73('0x14'))['db'];config[_0x7f73('0x15')]=_[_0x7f73('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7f73('0x17'))(new Redis(config['redis']));require(_0x7f73('0x18'))[_0x7f73('0x19')](socket);var jayson=require(_0x7f73('0x1a'));var client=jayson[_0x7f73('0x1b')][_0x7f73('0x1c')]({'port':0x232c});var client9002=jayson[_0x7f73('0x1b')][_0x7f73('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c2055,_0x2d5e12,_0x45a309,_0x4d9166){return new BPromise(function(_0x501368,_0x369205){var _0x34ccb4=_0x4d9166||client;return _0x34ccb4[_0x7f73('0x1d')](_0x2c2055,_0x45a309)[_0x7f73('0x1e')](function(_0x1303a9){logger[_0x7f73('0x1f')](_0x7f73('0x20'),_0x2d5e12,_0x7f73('0x21'));logger['debug'](_0x7f73('0x22'),_0x2d5e12,_0x7f73('0x21'),JSON[_0x7f73('0x23')](_0x1303a9));if(_0x1303a9[_0x7f73('0x24')]){if(_0x1303a9[_0x7f73('0x24')]['code']===0x1f4){logger[_0x7f73('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x2d5e12,_0x1303a9['error']['message']);return _0x369205(_0x1303a9[_0x7f73('0x24')][_0x7f73('0x25')]);}logger[_0x7f73('0x24')](_0x7f73('0x20'),_0x2d5e12,_0x1303a9[_0x7f73('0x24')][_0x7f73('0x25')]);return _0x501368(_0x1303a9['error'][_0x7f73('0x25')]);}else{logger[_0x7f73('0x1f')](_0x7f73('0x20'),_0x2d5e12,'request\x20sent');_0x501368(_0x1303a9['result'][_0x7f73('0x25')]);}})[_0x7f73('0x26')](function(_0x2099b0){logger[_0x7f73('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x2d5e12,_0x2099b0);_0x369205(_0x2099b0);});});}function respondWithStatusCode(_0x1c84c5,_0xf3cbb){_0xf3cbb=_0xf3cbb||0xcc;return function(_0x2d2bb0){if(_0x2d2bb0){return _0x1c84c5['sendStatus'](_0xf3cbb);}return _0x1c84c5['status'](_0xf3cbb)[_0x7f73('0x27')]();};}function respondWithResult(_0x7a6f1d,_0x3e0f02){_0x3e0f02=_0x3e0f02||0xc8;return function(_0x54eec6){if(_0x54eec6){return _0x7a6f1d[_0x7f73('0x28')](_0x3e0f02)[_0x7f73('0x29')](_0x54eec6);}};}function respondWithFilteredResult(_0x191c3b,_0x24d8f6){return function(_0x1974da){if(_0x1974da){var _0x3cef37=typeof _0x24d8f6[_0x7f73('0x2a')]===_0x7f73('0x2b')&&typeof _0x24d8f6[_0x7f73('0x2c')]===_0x7f73('0x2b');var _0x170406=_0x1974da['count'];var _0x2e913f=_0x3cef37?0x0:_0x24d8f6['offset'];var _0x57be5f=_0x3cef37?_0x1974da[_0x7f73('0x2d')]:_0x24d8f6[_0x7f73('0x2a')]+_0x24d8f6[_0x7f73('0x2c')];var _0x32fbb8;if(_0x57be5f>=_0x170406){_0x57be5f=_0x170406;_0x32fbb8=0xc8;}else{_0x32fbb8=0xce;}_0x191c3b[_0x7f73('0x28')](_0x32fbb8);return _0x191c3b[_0x7f73('0x2e')]('Content-Range',_0x2e913f+'-'+_0x57be5f+'/'+_0x170406)['json'](_0x1974da);}return null;};}function patchUpdates(_0x31c850){return function(_0x32d068){try{jsonpatch[_0x7f73('0x2f')](_0x32d068,_0x31c850,!![]);}catch(_0x399367){return BPromise[_0x7f73('0x30')](_0x399367);}return _0x32d068['save']();};}function saveUpdates(_0x3c4f89,_0x333030){return function(_0x426abc){if(_0x426abc){return _0x426abc[_0x7f73('0x31')](_0x3c4f89)[_0x7f73('0x1e')](function(_0x15e900){return _0x15e900;});}return null;};}function removeEntity(_0x4fac3a,_0x26bdd9){return function(_0x1393e9){if(_0x1393e9){return _0x1393e9['destroy']()[_0x7f73('0x1e')](function(){_0x4fac3a[_0x7f73('0x28')](0xcc)[_0x7f73('0x27')]();});}};}function handleEntityNotFound(_0x42f534,_0x175a95){return function(_0x1927fc){if(!_0x1927fc){_0x42f534[_0x7f73('0x32')](0x194);}return _0x1927fc;};}function handleError(_0x12281a,_0x54461a){_0x54461a=_0x54461a||0x1f4;return function(_0x2710d1){logger[_0x7f73('0x24')](_0x2710d1[_0x7f73('0x33')]);if(_0x2710d1[_0x7f73('0x34')]){delete _0x2710d1['name'];}_0x12281a[_0x7f73('0x28')](_0x54461a)[_0x7f73('0x35')](_0x2710d1);};}exports[_0x7f73('0x36')]=function(_0x50a5ee,_0x1b09e5){var _0x586d78={},_0x565af0={},_0x2400a1={'count':0x0,'rows':[]};var _0x2f33cb=_['map'](db[_0x7f73('0x37')][_0x7f73('0x38')],function(_0x5c047d){return{'name':_0x5c047d['fieldName'],'type':_0x5c047d[_0x7f73('0x39')][_0x7f73('0x3a')]};});_0x565af0['model']=_[_0x7f73('0x3b')](_0x2f33cb,_0x7f73('0x34'));_0x565af0[_0x7f73('0x3c')]=_['keys'](_0x50a5ee['query']);_0x565af0[_0x7f73('0x3d')]=_['intersection'](_0x565af0[_0x7f73('0x3e')],_0x565af0[_0x7f73('0x3c')]);_0x586d78[_0x7f73('0x3f')]=_[_0x7f73('0x40')](_0x565af0[_0x7f73('0x3e')],qs['fields'](_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x41')]));_0x586d78[_0x7f73('0x3f')]=_0x586d78[_0x7f73('0x3f')][_0x7f73('0x42')]?_0x586d78['attributes']:_0x565af0[_0x7f73('0x3e')];if(!_0x50a5ee[_0x7f73('0x3c')]['hasOwnProperty'](_0x7f73('0x43'))){_0x586d78[_0x7f73('0x2c')]=qs[_0x7f73('0x2c')](_0x50a5ee['query'][_0x7f73('0x2c')]);_0x586d78[_0x7f73('0x2a')]=qs[_0x7f73('0x2a')](_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x2a')]);}_0x586d78['order']=qs['sort'](_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x44')]);_0x586d78[_0x7f73('0x45')]=qs[_0x7f73('0x3d')](_[_0x7f73('0x46')](_0x50a5ee[_0x7f73('0x3c')],_0x565af0[_0x7f73('0x3d')]),_0x2f33cb);if(_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x47')]){_0x586d78['where']=_[_0x7f73('0x48')](_0x586d78[_0x7f73('0x45')],{'$or':_['map'](_0x2f33cb,function(_0x2a45a2){if(_0x2a45a2[_0x7f73('0x39')]!==_0x7f73('0x49')){var _0x3faa2e={};_0x3faa2e[_0x2a45a2[_0x7f73('0x34')]]={'$like':'%'+_0x50a5ee['query'][_0x7f73('0x47')]+'%'};return _0x3faa2e;}})});}_0x586d78=_[_0x7f73('0x48')]({},_0x586d78,_0x50a5ee['options']);var _0x4495b3={'where':_0x586d78[_0x7f73('0x45')]};return db[_0x7f73('0x37')][_0x7f73('0x2d')](_0x4495b3)[_0x7f73('0x1e')](function(_0x447015){_0x2400a1[_0x7f73('0x2d')]=_0x447015;if(_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x4a')]){_0x586d78['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x7f73('0x4b')](_0x586d78);})[_0x7f73('0x1e')](function(_0x37553c){_0x2400a1['rows']=_0x37553c;return _0x2400a1;})[_0x7f73('0x1e')](respondWithFilteredResult(_0x1b09e5,_0x586d78))[_0x7f73('0x26')](handleError(_0x1b09e5,null));};exports[_0x7f73('0x4c')]=function(_0x3e3bff,_0xd47823){var _0x4c8d18={'raw':!![],'where':{'id':_0x3e3bff[_0x7f73('0x4d')]['id']}},_0xf5cd91={};_0xf5cd91[_0x7f73('0x3e')]=_[_0x7f73('0x4e')](db[_0x7f73('0x37')][_0x7f73('0x38')]);_0xf5cd91[_0x7f73('0x3c')]=_['keys'](_0x3e3bff[_0x7f73('0x3c')]);_0xf5cd91[_0x7f73('0x3d')]=_[_0x7f73('0x40')](_0xf5cd91[_0x7f73('0x3e')],_0xf5cd91[_0x7f73('0x3c')]);_0x4c8d18[_0x7f73('0x3f')]=_[_0x7f73('0x40')](_0xf5cd91[_0x7f73('0x3e')],qs[_0x7f73('0x41')](_0x3e3bff[_0x7f73('0x3c')]['fields']));_0x4c8d18['attributes']=_0x4c8d18[_0x7f73('0x3f')]['length']?_0x4c8d18[_0x7f73('0x3f')]:_0xf5cd91[_0x7f73('0x3e')];if(_0x3e3bff['query'][_0x7f73('0x4a')]){_0x4c8d18[_0x7f73('0x4f')]=[{'all':!![]}];}_0x4c8d18=_['merge']({},_0x4c8d18,_0x3e3bff['options']);return db[_0x7f73('0x37')][_0x7f73('0x50')](_0x4c8d18)[_0x7f73('0x1e')](handleEntityNotFound(_0xd47823,null))['then'](respondWithResult(_0xd47823,null))[_0x7f73('0x26')](handleError(_0xd47823,null));};exports[_0x7f73('0x51')]=function(_0xef0b05,_0xad674e){return db[_0x7f73('0x37')]['create'](_0xef0b05[_0x7f73('0x52')],{})['then'](respondWithResult(_0xad674e,0xc9))['catch'](handleError(_0xad674e,null));};exports['update']=function(_0x27b8db,_0x6f3b72){if(_0x27b8db[_0x7f73('0x52')]['id']){delete _0x27b8db[_0x7f73('0x52')]['id'];}return db[_0x7f73('0x37')][_0x7f73('0x50')]({'where':{'id':_0x27b8db[_0x7f73('0x4d')]['id']}})[_0x7f73('0x1e')](handleEntityNotFound(_0x6f3b72,null))[_0x7f73('0x1e')](saveUpdates(_0x27b8db[_0x7f73('0x52')],null))[_0x7f73('0x1e')](respondWithResult(_0x6f3b72,null))[_0x7f73('0x26')](handleError(_0x6f3b72,null));};exports[_0x7f73('0x53')]=function(_0x2352d1,_0x33d367){return db[_0x7f73('0x37')][_0x7f73('0x50')]({'where':{'id':_0x2352d1[_0x7f73('0x4d')]['id']}})[_0x7f73('0x1e')](handleEntityNotFound(_0x33d367,null))[_0x7f73('0x1e')](removeEntity(_0x33d367,null))[_0x7f73('0x26')](handleError(_0x33d367,null));};exports[_0x7f73('0x54')]=function(_0x3e5283,_0x4b95cf){return db['WhatsappMessage'][_0x7f73('0x54')]()[_0x7f73('0x1e')](respondWithResult(_0x4b95cf,null))['catch'](handleError(_0x4b95cf,null));};var interaction_log=require('../../config/logger')(_0x7f73('0x55'));exports[_0x7f73('0x56')]=function(_0x1f7e0e,_0x2ffe56,_0x5c7088){var _0xdafb5d={'agent':{},'channel':_0x7f73('0x57')};if(_0x1f7e0e[_0x7f73('0x52')]['id']){delete _0x1f7e0e[_0x7f73('0x52')]['id'];}_0x1f7e0e[_0x7f73('0x52')]['read']=!![];_0x1f7e0e[_0x7f73('0x52')]['readAt']=moment()[_0x7f73('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f7e0e['body']['UserId']=_0x1f7e0e['body'][_0x7f73('0x59')]||_0x1f7e0e[_0x7f73('0x5a')]['id'];_0xdafb5d[_0x7f73('0x5b')]['id']=_0x1f7e0e[_0x7f73('0x52')][_0x7f73('0x59')];return db[_0x7f73('0x37')][_0x7f73('0x50')]({'where':{'id':_0x1f7e0e[_0x7f73('0x4d')]['id'],'UserId':null}})[_0x7f73('0x1e')](handleEntityNotFound(_0x2ffe56,null))[_0x7f73('0x1e')](saveUpdates(_0x1f7e0e['body'],null))['then'](function(_0x3d4163){if(_0x3d4163){_0xdafb5d['message']=_0x3d4163[_0x7f73('0x5c')]({'plain':!![]});return db[_0x7f73('0x5d')]['find']({'where':{'id':_0x3d4163[_0x7f73('0x5e')]}});}return null;})[_0x7f73('0x1e')](handleEntityNotFound(_0x2ffe56,null))[_0x7f73('0x1e')](function(_0x161e3a){if(_0x161e3a){return _0x161e3a[_0x7f73('0x31')]({'UserId':_0x1f7e0e[_0x7f73('0x52')]['UserId'],'read1stAt':_['isNil'](_0x161e3a[_0x7f73('0x5f')])?moment()['format'](_0x7f73('0x60')):undefined});}return null;})[_0x7f73('0x1e')](function(_0x32faf7){if(_0x32faf7){_0xdafb5d[_0x7f73('0x61')]=_0x32faf7[_0x7f73('0x5c')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f7e0e[_0x7f73('0x5a')]['id'],_0x1f7e0e['user']['name'],_0x1f7e0e[_0x7f73('0x5a')]['role'],_0xdafb5d[_0x7f73('0x61')]['id'],_0x1f7e0e[_0x7f73('0x52')]?JSON[_0x7f73('0x23')](_0x1f7e0e[_0x7f73('0x52')]):_0x7f73('0x62'));return respondWithRpcPromise(_0x7f73('0x63'),_0x7f73('0x64'),_0xdafb5d);}return null;})['then'](function(_0x1ac05b){var _0x2c2dd7=_0x7f73('0x65')+_0x1ac05b[_0x7f73('0x25')]['ContactId'];return db[_0x7f73('0x66')]['query'](_0x2c2dd7,{'type':db[_0x7f73('0x67')][_0x7f73('0x68')][_0x7f73('0x69')],'raw':!![]})[_0x7f73('0x1e')](function(_0x507ede){return _0x507ede;});})[_0x7f73('0x1e')](function(_0x4a4b62){if(_0x4a4b62){_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x6a')]=_0x4a4b62[0x0];if(!_0x1f7e0e[_0x7f73('0x52')]['UserId'])return;return db[_0x7f73('0x6b')][_0x7f73('0x50')]({'where':{'id':_0x1f7e0e[_0x7f73('0x52')]['UserId'],'role':'agent'},'attributes':['id',_0x7f73('0x34'),'fullname',_0x7f73('0x6c'),'internal'],'raw':!![]});}return null;})[_0x7f73('0x1e')](function(_0x324665){if(!_0x324665)return null;_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x5b')]=_0x324665;return _0xdafb5d;})[_0x7f73('0x1e')](function(_0x2e60a8){if(_0x2e60a8){if(_0x1f7e0e[_0x7f73('0x52')][_0x7f73('0x6d')]){_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x6e')]=util['format'](_0x7f73('0x6f'),_0x1f7e0e[_0x7f73('0x5a')][_0x7f73('0x34')]);_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x70')]=_0xdafb5d[_0x7f73('0x70')];_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x71')]=_0xdafb5d[_0x7f73('0x70')];_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x72')]='accept';return respondWithRpcPromise(_0x7f73('0x73'),_0x7f73('0x73'),{'event':_0x7f73('0x74'),'message':_0xdafb5d[_0x7f73('0x25')]},client9002)['then'](function(){return _0xdafb5d;});}return _0xdafb5d;}return null;})[_0x7f73('0x1e')](respondWithResult(_0x2ffe56,null))[_0x7f73('0x26')](handleError(_0x2ffe56,null));};var interaction_log=require(_0x7f73('0x75'))(_0x7f73('0x55'));exports['reject']=function(_0x3a643f,_0xf21438,_0x71b2f){var _0x13e39f={'agent':{},'channel':_0x7f73('0x57')};if(_0x3a643f[_0x7f73('0x52')]['id']){delete _0x3a643f[_0x7f73('0x52')]['id'];}_0x3a643f[_0x7f73('0x52')]['UserId']=_0x3a643f[_0x7f73('0x52')]['UserId']||_0x3a643f['user']['id'];_0x13e39f['agent']['id']=_0x3a643f[_0x7f73('0x52')][_0x7f73('0x59')];return db[_0x7f73('0x37')][_0x7f73('0x50')]({'where':{'id':_0x3a643f[_0x7f73('0x4d')]['id'],'UserId':null}})[_0x7f73('0x1e')](handleEntityNotFound(_0xf21438,null))[_0x7f73('0x1e')](function(_0x46785f){if(_0x46785f){_0x13e39f[_0x7f73('0x25')]=_0x46785f[_0x7f73('0x5c')]({'plain':!![]});return db['WhatsappInteraction'][_0x7f73('0x50')]({'where':{'id':_0x46785f[_0x7f73('0x5e')]}});}return null;})[_0x7f73('0x1e')](handleEntityNotFound(_0xf21438,null))[_0x7f73('0x1e')](function(_0x9ea71){if(_0x9ea71){_0x13e39f['interaction']=_0x9ea71[_0x7f73('0x5c')]({'plain':!![]});interaction_log['info'](_0x7f73('0x76'),_0x3a643f['user']['id'],_0x3a643f[_0x7f73('0x5a')]['name'],_0x3a643f['user'][_0x7f73('0x77')],_0x13e39f['interaction']['id'],_0x3a643f[_0x7f73('0x52')]?JSON[_0x7f73('0x23')](_0x3a643f['body']):_0x7f73('0x62'));return respondWithRpcPromise(_0x7f73('0x78'),_0x7f73('0x79'),_0x13e39f);}return null;})[_0x7f73('0x1e')](function(_0x42d584){var _0x13c563=_0x7f73('0x65')+_0x42d584[_0x7f73('0x25')][_0x7f73('0x7a')];return db[_0x7f73('0x66')]['query'](_0x13c563,{'type':db['Sequelize'][_0x7f73('0x68')][_0x7f73('0x69')],'raw':!![]})[_0x7f73('0x1e')](function(_0x56ebbc){return _0x56ebbc;});})[_0x7f73('0x1e')](function(_0x3fc758){if(_0x3fc758){_0x13e39f[_0x7f73('0x25')]['contact']=_0x3fc758[0x0];if(!_0x3a643f['body'][_0x7f73('0x59')])return;return db['User'][_0x7f73('0x50')]({'where':{'id':_0x3a643f[_0x7f73('0x52')][_0x7f73('0x59')],'role':_0x7f73('0x5b')},'attributes':['id',_0x7f73('0x34'),_0x7f73('0x7b'),_0x7f73('0x6c'),_0x7f73('0x7c')],'raw':!![]});}return null;})[_0x7f73('0x1e')](function(_0x4541e9){if(!_0x4541e9)return null;_0x13e39f[_0x7f73('0x25')][_0x7f73('0x5b')]=_0x4541e9;return _0x13e39f;})[_0x7f73('0x1e')](function(_0x5442e7){if(_0x5442e7){_0x5442e7['message']['interface']=util['format']('SIP/%s',_0x3a643f[_0x7f73('0x5a')][_0x7f73('0x34')]);_0x5442e7['message']['channel']=_0x13e39f[_0x7f73('0x70')];_0x5442e7[_0x7f73('0x25')][_0x7f73('0x71')]=_0x13e39f[_0x7f73('0x70')];_0x5442e7[_0x7f73('0x25')]['event']=_0x7f73('0x30');respondWithRpcPromise(_0x7f73('0x73'),_0x7f73('0x73'),{'event':'rejectmessage','message':_0x5442e7[_0x7f73('0x25')]},client9002);return _0x13e39f;}return null;})[_0x7f73('0x1e')](respondWithResult(_0xf21438,null))[_0x7f73('0x26')](handleError(_0xf21438,null));};exports[_0x7f73('0x28')]=function(_0xbf2d70,_0x3fc6e6,_0x1a1d19){if(_0xbf2d70[_0x7f73('0x52')]['id']){delete _0xbf2d70[_0x7f73('0x52')]['id'];}var _0x3d0723;return db['WhatsappMessage'][_0x7f73('0x50')]({'where':{'id':_0xbf2d70[_0x7f73('0x4d')]['id']}})[_0x7f73('0x1e')](handleEntityNotFound(_0x3fc6e6,null))['then'](function(_0x2468d4){if(_0x2468d4){_0x3d0723=_0x2468d4;return db[_0x7f73('0x7d')][_0x7f73('0x50')]({'where':{'id':_0x2468d4[_0x7f73('0x7e')]}});}})['then'](handleEntityNotFound(_0x3fc6e6,null))[_0x7f73('0x1e')](function(_0x2f904f){if(_0x2f904f){logger[_0x7f73('0x7f')](_0x7f73('0x80'),_0x7f73('0x28'),_0x7f73('0x81'),_0x2f904f[_0x7f73('0x39')],util[_0x7f73('0x82')](_0xbf2d70[_0x7f73('0x52')],{'showHidden':![],'depth':null}));switch(_0x2f904f[_0x7f73('0x39')]){case _0x7f73('0x83'):if(_0xbf2d70[_0x7f73('0x52')]['MessageSid']&&_0xbf2d70[_0x7f73('0x52')][_0x7f73('0x84')]===_0x3d0723[_0x7f73('0x85')]&&_0xbf2d70[_0x7f73('0x52')]['MessageStatus']&&_0xbf2d70[_0x7f73('0x52')][_0x7f73('0x86')]===_0x7f73('0x87')){return _0x3d0723[_0x7f73('0x31')]({'read':!![]});}else{logger[_0x7f73('0x24')](_0x7f73('0x88'),_0x7f73('0x28'),_0x7f73('0x83'),util[_0x7f73('0x82')](_0xbf2d70[_0x7f73('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x3d0723;}})[_0x7f73('0x1e')](respondWithResult(_0x3fc6e6,null))[_0x7f73('0x26')](handleError(_0x3fc6e6,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ef86309..43435a9 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 _0xe130=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x46a01f,_0x425306){var _0x3fb6dd=function(_0x4a590e){while(--_0x4a590e){_0x46a01f['push'](_0x46a01f['shift']());}};_0x3fb6dd(++_0x425306);}(_0xe130,0x127));var _0x0e13=function(_0x3e7eea,_0x42397b){_0x3e7eea=_0x3e7eea-0x0;var _0x5d2b6f=_0xe130[_0x3e7eea];return _0x5d2b6f;};'use strict';var EventEmitter=require(_0x0e13('0x0'));var WhatsappMessage=require(_0x0e13('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0e13('0x2')](0x0);var events={'afterCreate':_0x0e13('0x3'),'afterUpdate':_0x0e13('0x4'),'afterDestroy':_0x0e13('0x5')};function emitEvent(_0x449ddd){return function(_0x504f15,_0x1489a9,_0x223c28){WhatsappMessageEvents[_0x0e13('0x6')](_0x449ddd+':'+_0x504f15['id'],_0x504f15);WhatsappMessageEvents[_0x0e13('0x6')](_0x449ddd,_0x504f15);_0x223c28(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x0e13('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x143e76,_0x48e958){var _0x52c0ac=function(_0x21b0a3){while(--_0x21b0a3){_0x143e76['push'](_0x143e76['shift']());}};_0x52c0ac(++_0x48e958);}(_0xf4eb,0xec));var _0xbf4e=function(_0xecdad6,_0x5e232f){_0xecdad6=_0xecdad6-0x0;var _0xd2a390=_0xf4eb[_0xecdad6];return _0xd2a390;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){WhatsappMessageEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);WhatsappMessageEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];WhatsappMessage[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 5c21858..e41e8a8 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 _0x44ca=['statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','toLowerCase','direction','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','out','find','then','type','twilio','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','accountSid','authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x44ca,0xe6));var _0xa44c=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0x44ca[_0x4169d8];return _0x32084a;};'use strict';var _=require(_0xa44c('0x0'));var util=require(_0xa44c('0x1'));var logger=require(_0xa44c('0x2'))('api');var moment=require(_0xa44c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xa44c('0x4'));var fs=require('fs');var path=require(_0xa44c('0x5'));var rimraf=require(_0xa44c('0x6'));var config=require(_0xa44c('0x7'));var attributes=require(_0xa44c('0x8'));module['exports']=function(_0x214fca,_0x1d1c4b){return _0x214fca[_0xa44c('0x9')]('WhatsappMessage',attributes,{'tableName':_0xa44c('0xa'),'paranoid':![],'indexes':[{'name':_0xa44c('0xb'),'fields':[_0xa44c('0xb')]},{'name':_0xa44c('0xc'),'fields':[_0xa44c('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a46a9,_0x12e2b4,_0x4457da){var _0x295d61=_0x214fca[_0xa44c('0xe')];var _0x142d12=_0x5a46a9['get']({'plain':!![]});if(_0x142d12['direction'][_0xa44c('0xf')]()==='in'||_0x142d12[_0xa44c('0x10')][_0xa44c('0xf')]()==='out'&&!_0x142d12[_0xa44c('0x11')]&&!_['isNil'](_0x142d12[_0xa44c('0x12')])){_0x295d61[_0xa44c('0x13')][_0xa44c('0x14')]({'where':{'id':_0x142d12[_0xa44c('0x15')]}})['then'](function(_0x567a95){if(_0x567a95){_0x567a95[_0xa44c('0x16')]({'lastMsgAt':_0x142d12[_0xa44c('0x17')],'lastMsgDirection':_0x142d12[_0xa44c('0x10')][_0xa44c('0xf')]()});}})['catch'](function(_0x574df7){console['error'](_0x574df7);});}if(_0x142d12[_0xa44c('0x10')]===_0xa44c('0x18')&&!_0x142d12['secret']){var _0x4be612;_0x295d61['WhatsappAccount'][_0xa44c('0x19')]({'where':{'id':_0x142d12['WhatsappAccountId']},'raw':!![]})[_0xa44c('0x1a')](function(_0x56a346){_0x4be612=_0x56a346;if(_0x4be612&&_0x4be612['type']){switch(_0x4be612[_0xa44c('0x1b')]){case _0xa44c('0x1c'):var _0x43b76d=require(_0xa44c('0x1c'));if(_0x4be612['accountSid']&&_0x4be612['authToken']&&_0x4be612[_0xa44c('0x1d')]){var _0x105211=new _0x43b76d(_0x4be612['accountSid'],_0x4be612['authToken']);_0x105211[_0xa44c('0x1e')][_0xa44c('0x1f')]({'body':_0x142d12[_0xa44c('0xd')],'to':_0xa44c('0x20')+_0x142d12[_0xa44c('0x1d')],'from':'whatsapp:'+_0x4be612[_0xa44c('0x1d')],'statusCallback':_0x4be612[_0xa44c('0x21')]+_0xa44c('0x22')+_0x142d12['id']+'/status?token='+_0x4be612[_0xa44c('0x23')]})[_0xa44c('0x1a')](function(_0x11d3e9){if(_0x11d3e9[_0xa44c('0x24')]){return _0x5a46a9['update']({'messageId':_0x11d3e9[_0xa44c('0x24')]});}})[_0xa44c('0x25')](function(_0x156cbf){logger[_0xa44c('0x26')](_0xa44c('0x27'),'afterCreate',_0xa44c('0x1c'),util['inspect'](_0x156cbf,{'showHidden':![],'depth':null}));});}else{logger[_0xa44c('0x26')](_0xa44c('0x27'),_0xa44c('0x28'),_0xa44c('0x1c'),_0xa44c('0x29'));}break;case _0xa44c('0x2a'):var _0x42e649=_0x4be612[_0xa44c('0x2b')];var _0x1ee75a=_0x4be612[_0xa44c('0x2c')];var _0x1cf489=_0x4be612[_0xa44c('0x2d')]+_0xa44c('0x2e')+_0x42e649+_0xa44c('0x2f');var _0xf6c90a={'to':[_0x142d12[_0xa44c('0x1d')]],'message':{'type':_0xa44c('0x30'),'text':_0x142d12[_0xa44c('0xd')]}};var _0x4885ba={'method':_0xa44c('0x31'),'uri':_0x1cf489,'headers':{'Authorization':'Bearer\x20'+_0x1ee75a,'Content-Type':'application/json'},'body':_0xf6c90a,'json':!![]};rp(_0x4885ba)[_0xa44c('0x1a')](function(_0x555db0){if(_0x555db0[_0xa44c('0x32')][0x0][_0xa44c('0x33')]){return _0x5a46a9[_0xa44c('0x16')]({'messageId':_0x555db0['statuses'][0x0][_0xa44c('0x33')]});}})['catch'](function(_0x262f4b){logger[_0xa44c('0x34')]('WhatsappMessage,\x20%s',_0x262f4b);});break;}}})[_0xa44c('0x35')](function(){_0x4457da();});}else{_0x4457da();}}},'charset':_0xa44c('0x36'),'collate':_0xa44c('0x37')});}; \ No newline at end of file +var _0xebe7=['POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text'];(function(_0x49dff6,_0xbc89cf){var _0x333c98=function(_0x3c1865){while(--_0x3c1865){_0x49dff6['push'](_0x49dff6['shift']());}};_0x333c98(++_0xbc89cf);}(_0xebe7,0x165));var _0x7ebe=function(_0x534829,_0x58695a){_0x534829=_0x534829-0x0;var _0x531339=_0xebe7[_0x534829];return _0x531339;};'use strict';var _=require(_0x7ebe('0x0'));var util=require(_0x7ebe('0x1'));var logger=require(_0x7ebe('0x2'))('api');var moment=require(_0x7ebe('0x3'));var BPromise=require(_0x7ebe('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x7ebe('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7ebe('0x6'));module['exports']=function(_0xbd6236,_0x242475){return _0xbd6236['define'](_0x7ebe('0x7'),attributes,{'tableName':_0x7ebe('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7ebe('0x9')]},{'name':_0x7ebe('0xa'),'fields':[_0x7ebe('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46e234,_0x497142,_0x502dcc){var _0x12b07f=_0xbd6236[_0x7ebe('0xc')];var _0x5f2f0e=_0x46e234[_0x7ebe('0xd')]({'plain':!![]});if(_0x5f2f0e[_0x7ebe('0xe')][_0x7ebe('0xf')]()==='in'||_0x5f2f0e[_0x7ebe('0xe')][_0x7ebe('0xf')]()===_0x7ebe('0x10')&&!_0x5f2f0e[_0x7ebe('0x11')]&&!_[_0x7ebe('0x12')](_0x5f2f0e[_0x7ebe('0x13')])){_0x12b07f[_0x7ebe('0x14')][_0x7ebe('0x15')]({'where':{'id':_0x5f2f0e['WhatsappInteractionId']}})[_0x7ebe('0x16')](function(_0x3f24bd){if(_0x3f24bd){_0x3f24bd[_0x7ebe('0x17')]({'lastMsgAt':_0x5f2f0e[_0x7ebe('0x18')],'lastMsgDirection':_0x5f2f0e[_0x7ebe('0xe')][_0x7ebe('0xf')]()});}})[_0x7ebe('0x19')](function(_0x21660a){console[_0x7ebe('0x1a')](_0x21660a);});}if(_0x5f2f0e[_0x7ebe('0xe')]===_0x7ebe('0x10')&&!_0x5f2f0e[_0x7ebe('0x11')]){var _0x6b9977;_0x12b07f[_0x7ebe('0x1b')][_0x7ebe('0x1c')]({'where':{'id':_0x5f2f0e[_0x7ebe('0x1d')]},'raw':!![]})[_0x7ebe('0x16')](function(_0x4de664){_0x6b9977=_0x4de664;if(_0x6b9977&&_0x6b9977['type']){switch(_0x6b9977[_0x7ebe('0x1e')]){case _0x7ebe('0x1f'):var _0x4d5ef1=require('twilio');if(_0x6b9977[_0x7ebe('0x20')]&&_0x6b9977[_0x7ebe('0x21')]&&_0x6b9977['phone']){var _0x35e012=new _0x4d5ef1(_0x6b9977[_0x7ebe('0x20')],_0x6b9977['authToken']);_0x35e012[_0x7ebe('0x22')][_0x7ebe('0x23')]({'body':_0x5f2f0e[_0x7ebe('0xb')],'to':_0x7ebe('0x24')+_0x5f2f0e[_0x7ebe('0x25')],'from':'whatsapp:'+_0x6b9977[_0x7ebe('0x25')],'statusCallback':_0x6b9977[_0x7ebe('0x26')]+_0x7ebe('0x27')+_0x5f2f0e['id']+_0x7ebe('0x28')+_0x6b9977['token']})['then'](function(_0x18e566){if(_0x18e566[_0x7ebe('0x29')]){return _0x46e234[_0x7ebe('0x17')]({'messageId':_0x18e566['sid']});}})['catch'](function(_0x48e911){logger[_0x7ebe('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7ebe('0x2a'),_0x7ebe('0x1f'),util['inspect'](_0x48e911,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7ebe('0x2a'),'twilio',_0x7ebe('0x2b'));}break;case _0x7ebe('0x2c'):var _0x4aa17f=_0x6b9977[_0x7ebe('0x20')];var _0x3db968=_0x6b9977[_0x7ebe('0x21')];var _0x5aecf6=_0x6b9977[_0x7ebe('0x2d')]+_0x7ebe('0x2e')+_0x4aa17f+_0x7ebe('0x2f');var _0x560597={'to':[_0x5f2f0e[_0x7ebe('0x25')]],'message':{'type':_0x7ebe('0x30'),'text':_0x5f2f0e['body']}};var _0x5dae6b={'method':_0x7ebe('0x31'),'uri':_0x5aecf6,'headers':{'Authorization':_0x7ebe('0x32')+_0x3db968,'Content-Type':_0x7ebe('0x33')},'body':_0x560597,'json':!![]};rp(_0x5dae6b)[_0x7ebe('0x16')](function(_0x1270b7){if(_0x1270b7[_0x7ebe('0x34')][0x0][_0x7ebe('0x35')]){return _0x46e234[_0x7ebe('0x17')]({'messageId':_0x1270b7[_0x7ebe('0x34')][0x0]['message_id']});}})['catch'](function(_0x43c2a9){logger[_0x7ebe('0x36')](_0x7ebe('0x37'),_0x43c2a9);});break;}}})['finally'](function(){_0x502dcc();});}else{_0x502dcc();}}},'charset':_0x7ebe('0x38'),'collate':_0x7ebe('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 28cfe13..2b1e336 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 _0x7067=['WhatsappMessage,\x20%s,\x20%s','result','create','body','options','CreateWhatsappMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x32194d,_0x174cd5){var _0x10217d=function(_0x1d5e66){while(--_0x1d5e66){_0x32194d['push'](_0x32194d['shift']());}};_0x10217d(++_0x174cd5);}(_0x7067,0x87));var _0x7706=function(_0x46d838,_0x16ef6d){_0x46d838=_0x46d838-0x0;var _0x3f820a=_0x7067[_0x46d838];return _0x3f820a;};'use strict';var _=require(_0x7706('0x0'));var util=require(_0x7706('0x1'));var moment=require(_0x7706('0x2'));var BPromise=require(_0x7706('0x3'));var rs=require(_0x7706('0x4'));var fs=require('fs');var Redis=require(_0x7706('0x5'));var db=require(_0x7706('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7706('0x7'));var config=require(_0x7706('0x8'));var jayson=require(_0x7706('0x9'));var client=jayson[_0x7706('0xa')][_0x7706('0xb')]({'port':0x232a});config[_0x7706('0xc')]=_[_0x7706('0xd')](config[_0x7706('0xc')],{'host':_0x7706('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7706('0xc')]));require(_0x7706('0xf'))[_0x7706('0x10')](socket);function respondWithRpcPromise(_0x119d17,_0x14b054,_0x504c9a){return new BPromise(function(_0x28bd66,_0x9ef330){return client['request'](_0x119d17,_0x504c9a)[_0x7706('0x11')](function(_0x39c005){logger[_0x7706('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x14b054,_0x7706('0x13'));logger[_0x7706('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x14b054,_0x7706('0x13'),JSON[_0x7706('0x15')](_0x39c005));if(_0x39c005[_0x7706('0x16')]){if(_0x39c005['error'][_0x7706('0x17')]===0x1f4){logger[_0x7706('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x14b054,_0x39c005[_0x7706('0x16')][_0x7706('0x18')]);return _0x9ef330(_0x39c005['error'][_0x7706('0x18')]);}logger[_0x7706('0x16')](_0x7706('0x19'),_0x14b054,_0x39c005[_0x7706('0x16')][_0x7706('0x18')]);return _0x28bd66(_0x39c005[_0x7706('0x16')]['message']);}else{logger[_0x7706('0x12')](_0x7706('0x19'),_0x14b054,_0x7706('0x13'));_0x28bd66(_0x39c005[_0x7706('0x1a')][_0x7706('0x18')]);}})['catch'](function(_0x30270c){logger['error'](_0x7706('0x19'),_0x14b054,_0x30270c);_0x9ef330(_0x30270c);});});}exports['CreateWhatsappMessage']=function(_0x64b4c5){var _0x115749=this;return new Promise(function(_0x29d9ef,_0x33da73){return db['WhatsappMessage'][_0x7706('0x1b')](_0x64b4c5[_0x7706('0x1c')],{'raw':_0x64b4c5[_0x7706('0x1d')]?_0x64b4c5[_0x7706('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4dce93){logger[_0x7706('0x12')](_0x7706('0x1e'),_0x64b4c5);logger['debug'](_0x7706('0x1e'),_0x64b4c5,JSON[_0x7706('0x15')](_0x4dce93));_0x29d9ef(_0x4dce93);})[_0x7706('0x1f')](function(_0xd7c277){logger[_0x7706('0x16')](_0x7706('0x1e'),_0xd7c277['message'],_0x64b4c5);_0x33da73(_0x115749['error'](0x1f4,_0xd7c277['message']));});});}; \ No newline at end of file +var _0x6702=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6702,0x1eb));var _0x2670=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x6702[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x2670('0x0'));var util=require(_0x2670('0x1'));var moment=require('moment');var BPromise=require(_0x2670('0x2'));var rs=require(_0x2670('0x3'));var fs=require('fs');var Redis=require(_0x2670('0x4'));var db=require(_0x2670('0x5'))['db'];var utils=require(_0x2670('0x6'));var logger=require(_0x2670('0x7'))(_0x2670('0x8'));var config=require('../../config/environment');var jayson=require(_0x2670('0x9'));var client=jayson[_0x2670('0xa')][_0x2670('0xb')]({'port':0x232a});config[_0x2670('0xc')]=_[_0x2670('0xd')](config[_0x2670('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2670('0xc')]));require('./whatsappMessage.socket')[_0x2670('0xe')](socket);function respondWithRpcPromise(_0x3e0795,_0x5d2982,_0x1952e6){return new BPromise(function(_0x508e85,_0x575fad){return client[_0x2670('0xf')](_0x3e0795,_0x1952e6)[_0x2670('0x10')](function(_0x8c315c){logger[_0x2670('0x11')](_0x2670('0x12'),_0x5d2982,_0x2670('0x13'));logger[_0x2670('0x14')](_0x2670('0x15'),_0x5d2982,'request\x20sent',JSON[_0x2670('0x16')](_0x8c315c));if(_0x8c315c['error']){if(_0x8c315c['error']['code']===0x1f4){logger[_0x2670('0x17')](_0x2670('0x12'),_0x5d2982,_0x8c315c[_0x2670('0x17')][_0x2670('0x18')]);return _0x575fad(_0x8c315c[_0x2670('0x17')]['message']);}logger[_0x2670('0x17')](_0x2670('0x12'),_0x5d2982,_0x8c315c[_0x2670('0x17')][_0x2670('0x18')]);return _0x508e85(_0x8c315c['error'][_0x2670('0x18')]);}else{logger[_0x2670('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x5d2982,_0x2670('0x13'));_0x508e85(_0x8c315c['result'][_0x2670('0x18')]);}})[_0x2670('0x19')](function(_0x1f515d){logger[_0x2670('0x17')](_0x2670('0x12'),_0x5d2982,_0x1f515d);_0x575fad(_0x1f515d);});});}exports[_0x2670('0x1a')]=function(_0x44a193){var _0x3e55f1=this;return new Promise(function(_0xa63f13,_0x4a3f41){return db[_0x2670('0x1b')][_0x2670('0x1c')](_0x44a193[_0x2670('0x1d')],{'raw':_0x44a193[_0x2670('0x1e')]?_0x44a193[_0x2670('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x2670('0x10')](function(_0x3d6941){logger[_0x2670('0x11')](_0x2670('0x1a'),_0x44a193);logger[_0x2670('0x14')](_0x2670('0x1a'),_0x44a193,JSON[_0x2670('0x16')](_0x3d6941));_0xa63f13(_0x3d6941);})[_0x2670('0x19')](function(_0x5a7d52){logger[_0x2670('0x17')](_0x2670('0x1a'),_0x5a7d52[_0x2670('0x18')],_0x44a193);_0x4a3f41(_0x3e55f1[_0x2670('0x17')](0x1f4,_0x5a7d52[_0x2670('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 53e69e0..61bd172 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 _0x6cb9=['remove','emit','removeListener','register','length','./whatsappMessage.events','save'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x6cb9,0xbb));var _0x96cb=function(_0xacd69c,_0x305440){_0xacd69c=_0xacd69c-0x0;var _0x519594=_0x6cb9[_0xacd69c];return _0x519594;};'use strict';var WhatsappMessageEvents=require(_0x96cb('0x0'));var events=[_0x96cb('0x1'),_0x96cb('0x2'),'update'];function createListener(_0x4e3241,_0x5514a9){return function(_0x1cfdcd){_0x5514a9[_0x96cb('0x3')](_0x4e3241,_0x1cfdcd);};}function removeListener(_0x28ab8b,_0xa3f691){return function(){WhatsappMessageEvents[_0x96cb('0x4')](_0x28ab8b,_0xa3f691);};}exports[_0x96cb('0x5')]=function(_0x5d96c7){for(var _0xa7d80a=0x0,_0x21d1c7=events[_0x96cb('0x6')];_0xa7d80a<_0x21d1c7;_0xa7d80a++){var _0x567699=events[_0xa7d80a];var _0x22c0e3=createListener('whatsappMessage:'+_0x567699,_0x5d96c7);WhatsappMessageEvents['on'](_0x567699,_0x22c0e3);}}; \ No newline at end of file +var _0x0608=['emit','register','length','whatsappMessage:','remove','update'];(function(_0x1fcd0a,_0x129511){var _0x33fa68=function(_0x3164a5){while(--_0x3164a5){_0x1fcd0a['push'](_0x1fcd0a['shift']());}};_0x33fa68(++_0x129511);}(_0x0608,0x8e));var _0x8060=function(_0xd9b681,_0x1a85ce){_0xd9b681=_0xd9b681-0x0;var _0x574d99=_0x0608[_0xd9b681];return _0x574d99;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x8060('0x0'),_0x8060('0x1')];function createListener(_0x434377,_0x204671){return function(_0x3ddd73){_0x204671[_0x8060('0x2')](_0x434377,_0x3ddd73);};}function removeListener(_0x314fac,_0x9e49d4){return function(){WhatsappMessageEvents['removeListener'](_0x314fac,_0x9e49d4);};}exports[_0x8060('0x3')]=function(_0xb4d78c){for(var _0x3b8714=0x0,_0xcb58e=events[_0x8060('0x4')];_0x3b8714<_0xcb58e;_0x3b8714++){var _0x43f6a1=events[_0x3b8714];var _0x54448d=createListener(_0x8060('0x5')+_0x43f6a1,_0xb4d78c);WhatsappMessageEvents['on'](_0x43f6a1,_0x54448d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 3426778..a2242f2 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 _0x7883=['post','/:id/teams','/:id/users','put','delete','removeTeams','removeAgents','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams'];(function(_0x2de59e,_0x24b766){var _0x534d4b=function(_0x30617b){while(--_0x30617b){_0x2de59e['push'](_0x2de59e['shift']());}};_0x534d4b(++_0x24b766);}(_0x7883,0x8b));var _0x3788=function(_0x1ae81f,_0x3c0dd6){_0x1ae81f=_0x1ae81f-0x0;var _0x102107=_0x7883[_0x1ae81f];return _0x102107;};'use strict';var multer=require(_0x3788('0x0'));var util=require('util');var path=require(_0x3788('0x1'));var timeout=require('connect-timeout');var express=require(_0x3788('0x2'));var router=express['Router']();var fs_extra=require(_0x3788('0x3'));var auth=require(_0x3788('0x4'));var interaction=require(_0x3788('0x5'));var config=require(_0x3788('0x6'));var controller=require('./whatsappQueue.controller');router[_0x3788('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3788('0x7')](_0x3788('0x8'),auth[_0x3788('0x9')](),controller['describe']);router['get'](_0x3788('0xa'),auth[_0x3788('0x9')](),controller[_0x3788('0xb')]);router[_0x3788('0x7')](_0x3788('0xc'),auth[_0x3788('0x9')](),controller[_0x3788('0xd')]);router['get']('/:id/teams',auth[_0x3788('0x9')](),controller[_0x3788('0xe')]);router[_0x3788('0x7')]('/:id/users',auth[_0x3788('0x9')](),controller['getAgents']);router[_0x3788('0xf')]('/',auth[_0x3788('0x9')](),controller['create']);router[_0x3788('0xf')](_0x3788('0x10'),auth[_0x3788('0x9')](),controller['addTeams']);router[_0x3788('0xf')](_0x3788('0x11'),auth[_0x3788('0x9')](),controller['addAgents']);router[_0x3788('0x12')]('/:id',auth[_0x3788('0x9')](),controller['update']);router[_0x3788('0x13')]('/:id',auth[_0x3788('0x9')](),controller['destroy']);router[_0x3788('0x13')](_0x3788('0x10'),auth[_0x3788('0x9')](),controller[_0x3788('0x14')]);router[_0x3788('0x13')](_0x3788('0x11'),auth[_0x3788('0x9')](),controller[_0x3788('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6aba=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6aba,0x188));var _0xa6ab=function(_0xdf99c5,_0x3ec8dd){_0xdf99c5=_0xdf99c5-0x0;var _0x4cf43a=_0x6aba[_0xdf99c5];return _0x4cf43a;};'use strict';var multer=require(_0xa6ab('0x0'));var util=require('util');var path=require(_0xa6ab('0x1'));var timeout=require(_0xa6ab('0x2'));var express=require(_0xa6ab('0x3'));var router=express[_0xa6ab('0x4')]();var fs_extra=require(_0xa6ab('0x5'));var auth=require(_0xa6ab('0x6'));var interaction=require(_0xa6ab('0x7'));var config=require(_0xa6ab('0x8'));var controller=require('./whatsappQueue.controller');router[_0xa6ab('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa6ab('0x9')](_0xa6ab('0xa'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0xc')]);router[_0xa6ab('0x9')](_0xa6ab('0xd'),auth[_0xa6ab('0xb')](),controller['show']);router[_0xa6ab('0x9')](_0xa6ab('0xe'),auth['isAuthenticated'](),controller[_0xa6ab('0xf')]);router[_0xa6ab('0x9')]('/:id/teams',auth[_0xa6ab('0xb')](),controller['getTeams']);router[_0xa6ab('0x9')](_0xa6ab('0x10'),auth[_0xa6ab('0xb')](),controller['getAgents']);router[_0xa6ab('0x11')]('/',auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x12')]);router[_0xa6ab('0x11')](_0xa6ab('0x13'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x14')]);router[_0xa6ab('0x11')](_0xa6ab('0x10'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x15')]);router[_0xa6ab('0x16')](_0xa6ab('0xd'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x17')]);router[_0xa6ab('0x18')](_0xa6ab('0xd'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x19')]);router['delete'](_0xa6ab('0x13'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x1a')]);router[_0xa6ab('0x18')](_0xa6ab('0x10'),auth[_0xa6ab('0xb')](),controller['removeAgents']);module[_0xa6ab('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0a29b58..723bf5f 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 _0x885e=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name'];(function(_0x221244,_0x206702){var _0x209ee2=function(_0x50674e){while(--_0x50674e){_0x221244['push'](_0x221244['shift']());}};_0x209ee2(++_0x206702);}(_0x885e,0xe4));var _0xe885=function(_0x2ea651,_0x5ac315){_0x2ea651=_0x2ea651-0x0;var _0x2fa5cc=_0x885e[_0x2ea651];return _0x2fa5cc;};'use strict';var Sequelize=require(_0xe885('0x0'));module[_0xe885('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe885('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe885('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe885('0x4')](_0xe885('0x5'),_0xe885('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3140=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x3140,0xaf));var _0x0314=function(_0x1f14a8,_0x11de2f){_0x1f14a8=_0x1f14a8-0x0;var _0x4f5581=_0x3140[_0x1f14a8];return _0x4f5581;};'use strict';var Sequelize=require(_0x0314('0x0'));module[_0x0314('0x1')]={'name':{'type':Sequelize[_0x0314('0x2')],'unique':_0x0314('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0314('0x4'),_0x0314('0x5'),_0x0314('0x6'))},'description':{'type':Sequelize[_0x0314('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 0cb70c7..8703b70 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 _0x119e=['then','WhatsappQueues','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','catch','show','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','where','WhatsappQueueId','filter','findAll','User','UserId','whatsappPause','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update'];(function(_0x1aba6a,_0x3018a3){var _0x148845=function(_0x435a2a){while(--_0x435a2a){_0x1aba6a['push'](_0x1aba6a['shift']());}};_0x148845(++_0x3018a3);}(_0x119e,0x16e));var _0xe119=function(_0x58ab6b,_0x1e6049){_0x58ab6b=_0x58ab6b-0x0;var _0x28901b=_0x119e[_0x58ab6b];return _0x28901b;};'use strict';var BPromise=require(_0xe119('0x0'));var util=require(_0xe119('0x1'));var _=require(_0xe119('0x2'));var squel=require(_0xe119('0x3'));var Redis=require('ioredis');var qs=require(_0xe119('0x4'));var logger=require(_0xe119('0x5'))('api');var config=require(_0xe119('0x6'));var db=require(_0xe119('0x7'))['db'];config[_0xe119('0x8')]=_[_0xe119('0x9')](config[_0xe119('0x8')],{'host':_0xe119('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe119('0xb'))[_0xe119('0xc')](socket);function respondWithStatusCode(_0x47c3cd,_0x4912ed){_0x4912ed=_0x4912ed||0xcc;return function(_0x558fed){if(_0x558fed){return _0x47c3cd[_0xe119('0xd')](_0x4912ed);}return _0x47c3cd[_0xe119('0xe')](_0x4912ed)[_0xe119('0xf')]();};}function respondWithResult(_0x114ffd,_0x4b970e){_0x4b970e=_0x4b970e||0xc8;return function(_0x283054){if(_0x283054){return _0x114ffd['status'](_0x4b970e)[_0xe119('0x10')](_0x283054);}};}function respondWithFilteredResult(_0x39784c,_0x9ff127){return function(_0x35b2f6){if(_0x35b2f6){var _0x16e30a=typeof _0x9ff127[_0xe119('0x11')]==='undefined'&&typeof _0x9ff127[_0xe119('0x12')]===_0xe119('0x13');var _0x30667f=_0x35b2f6[_0xe119('0x14')];var _0x36bcc7=_0x16e30a?0x0:_0x9ff127['offset'];var _0x3577b3=_0x16e30a?_0x35b2f6['count']:_0x9ff127['offset']+_0x9ff127[_0xe119('0x12')];var _0x24b092;if(_0x3577b3>=_0x30667f){_0x3577b3=_0x30667f;_0x24b092=0xc8;}else{_0x24b092=0xce;}_0x39784c[_0xe119('0xe')](_0x24b092);return _0x39784c[_0xe119('0x15')](_0xe119('0x16'),_0x36bcc7+'-'+_0x3577b3+'/'+_0x30667f)[_0xe119('0x10')](_0x35b2f6);}return null;};}function saveUpdates(_0x1f74af){return function(_0x55dfa8){if(_0x55dfa8){return _0x55dfa8[_0xe119('0x17')](_0x1f74af)[_0xe119('0x18')](function(_0x540a2c){return _0x540a2c;});}return null;};}function removeEntity(_0x391933){return function(_0x1898c6){if(_0x1898c6){return _0x1898c6['destroy']()[_0xe119('0x18')](function(){var _0x149c33=_0x1898c6['get']({'plain':!![]});var _0x528e0a=_0xe119('0x19');return db['UserProfileResource'][_0xe119('0x1a')]({'where':{'type':_0x528e0a,'resourceId':_0x149c33['id']}})[_0xe119('0x18')](function(){return _0x1898c6;});})[_0xe119('0x18')](function(){_0x391933[_0xe119('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e44b3){return function(_0x2f10fb){if(!_0x2f10fb){_0x1e44b3[_0xe119('0xd')](0x194);}return _0x2f10fb;};}function handleError(_0x2f91f5,_0x4f1bbe){_0x4f1bbe=_0x4f1bbe||0x1f4;return function(_0x1807b0){logger[_0xe119('0x1b')](_0x1807b0[_0xe119('0x1c')]);if(_0x1807b0[_0xe119('0x1d')]){delete _0x1807b0[_0xe119('0x1d')];}_0x2f91f5[_0xe119('0xe')](_0x4f1bbe)[_0xe119('0x1e')](_0x1807b0);};}exports[_0xe119('0x1f')]=function(_0x2005aa,_0x2e015d){var _0x50e0be={};var _0x20a2b1={'count':0x0,'rows':[]};var _0x1f4183=_[_0xe119('0x20')](db[_0xe119('0x21')][_0xe119('0x22')],function(_0x1fc917){return{'name':_0x1fc917[_0xe119('0x23')],'type':_0x1fc917[_0xe119('0x24')][_0xe119('0x25')]};});_0x50e0be=qs[_0xe119('0x26')](_0x1f4183,_0x2005aa);var _0x4bd56e={'where':_0x50e0be['where']};return db[_0xe119('0x21')][_0xe119('0x14')](_0x4bd56e)[_0xe119('0x18')](function(_0x1730ec){_0x20a2b1['count']=_0x1730ec;_0x50e0be[_0xe119('0x27')]=qs[_0xe119('0x27')](_0x2005aa[_0xe119('0x28')]);return db[_0xe119('0x21')]['findAll'](_0x50e0be);})[_0xe119('0x18')](function(_0x5e76d2){_0x20a2b1[_0xe119('0x29')]=_0x5e76d2;return _0x20a2b1;})[_0xe119('0x18')](respondWithFilteredResult(_0x2e015d,_0x50e0be))[_0xe119('0x2a')](handleError(_0x2e015d,null));};exports[_0xe119('0x2b')]=function(_0x1841ea,_0x3b85da){var _0x150744={'raw':!![],'where':{'id':_0x1841ea['params']['id']}},_0x384bcc={};_0x384bcc['model']=_[_0xe119('0x2c')](db[_0xe119('0x21')][_0xe119('0x22')]);_0x384bcc[_0xe119('0x28')]=_['keys'](_0x1841ea[_0xe119('0x28')]);_0x384bcc[_0xe119('0x2d')]=_[_0xe119('0x2e')](_0x384bcc[_0xe119('0x2f')],_0x384bcc[_0xe119('0x28')]);_0x150744[_0xe119('0x30')]=_[_0xe119('0x2e')](_0x384bcc['model'],qs[_0xe119('0x31')](_0x1841ea[_0xe119('0x28')][_0xe119('0x31')]));_0x150744['attributes']=_0x150744['attributes'][_0xe119('0x32')]?_0x150744['attributes']:_0x384bcc[_0xe119('0x2f')];if(_0x1841ea['query'][_0xe119('0x33')]){_0x150744[_0xe119('0x27')]=[{'all':!![]}];}_0x150744=_[_0xe119('0x34')]({},_0x150744,_0x1841ea[_0xe119('0x35')]);return db[_0xe119('0x21')][_0xe119('0x36')](_0x150744)[_0xe119('0x18')](handleEntityNotFound(_0x3b85da,null))[_0xe119('0x18')](respondWithResult(_0x3b85da,null))[_0xe119('0x2a')](handleError(_0x3b85da,null));};exports['create']=function(_0x37e6e4,_0x9dcc48){return db['WhatsappQueue']['create'](_0x37e6e4[_0xe119('0x37')],{})[_0xe119('0x18')](function(_0x1d897a){var _0x279e6a=_0x37e6e4[_0xe119('0x38')][_0xe119('0x39')]({'plain':!![]});if(!_0x279e6a)throw new Error(_0xe119('0x3a'));if(_0x279e6a[_0xe119('0x3b')]==='user'){var _0x1eb9ef=_0x1d897a[_0xe119('0x39')]({'plain':!![]});var _0x138a87=_0xe119('0x19');return db[_0xe119('0x3c')][_0xe119('0x36')]({'where':{'name':_0x138a87,'userProfileId':_0x279e6a[_0xe119('0x3d')]},'raw':!![]})[_0xe119('0x18')](function(_0x3461db){if(_0x3461db&&_0x3461db[_0xe119('0x3e')]===0x0){return db[_0xe119('0x3f')][_0xe119('0x40')]({'name':_0x1eb9ef[_0xe119('0x1d')],'resourceId':_0x1eb9ef['id'],'type':_0x3461db['name'],'sectionId':_0x3461db['id']},{})[_0xe119('0x18')](function(){return _0x1d897a;});}else{return _0x1d897a;}})[_0xe119('0x2a')](function(_0x2f0db2){logger[_0xe119('0x1b')](_0xe119('0x41'),_0x2f0db2);throw _0x2f0db2;});}return _0x1d897a;})['then'](respondWithResult(_0x9dcc48,0xc9))[_0xe119('0x2a')](handleError(_0x9dcc48,null));};exports[_0xe119('0x17')]=function(_0x4900ba,_0x219caa){if(_0x4900ba[_0xe119('0x37')]['id']){delete _0x4900ba[_0xe119('0x37')]['id'];}return db[_0xe119('0x21')][_0xe119('0x36')]({'where':{'id':_0x4900ba['params']['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x219caa,null))[_0xe119('0x18')](saveUpdates(_0x4900ba[_0xe119('0x37')],null))[_0xe119('0x18')](respondWithResult(_0x219caa,null))[_0xe119('0x2a')](handleError(_0x219caa,null));};exports[_0xe119('0x1a')]=function(_0x8baf1d,_0x3530a3){return db['WhatsappQueue'][_0xe119('0x36')]({'where':{'id':_0x8baf1d[_0xe119('0x42')]['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x3530a3,null))[_0xe119('0x18')](removeEntity(_0x3530a3,null))[_0xe119('0x2a')](handleError(_0x3530a3,null));};exports[_0xe119('0x43')]=function(_0x37f655,_0x2aee4d){return db[_0xe119('0x21')][_0xe119('0x43')]()[_0xe119('0x18')](respondWithResult(_0x2aee4d,null))['catch'](handleError(_0x2aee4d,null));};exports[_0xe119('0x44')]=function(_0x174eba,_0x5f0a07){var _0x25aa82={'raw':!![],'where':{}},_0x5bcecf={},_0x285fa6;return db[_0xe119('0x21')][_0xe119('0x45')]({'where':{'id':_0x174eba['params']['id']}})['then'](handleEntityNotFound(_0x5f0a07,null))['then'](function(_0x57c481){if(_0x57c481){_0x285fa6=_0x57c481[_0xe119('0x39')]({'plain':!![]});_0x5bcecf['model']=_[_0xe119('0x2c')](db[_0xe119('0x46')]['rawAttributes']);_0x5bcecf[_0xe119('0x28')]=_[_0xe119('0x2c')](_0x174eba[_0xe119('0x28')]);_0x5bcecf[_0xe119('0x2d')]=_[_0xe119('0x2e')](_0x5bcecf['model'],_0x5bcecf['query']);_0x25aa82[_0xe119('0x30')]=_[_0xe119('0x2e')](_0x5bcecf[_0xe119('0x2f')],qs['fields'](_0x174eba['query'][_0xe119('0x31')]));_0x25aa82[_0xe119('0x30')]=_0x25aa82[_0xe119('0x30')][_0xe119('0x32')]?_0x25aa82['attributes']:_0x5bcecf[_0xe119('0x2f')];if(!_0x174eba[_0xe119('0x28')][_0xe119('0x47')](_0xe119('0x48'))){_0x25aa82[_0xe119('0x12')]=qs[_0xe119('0x12')](_0x174eba[_0xe119('0x28')]['limit']);_0x25aa82[_0xe119('0x11')]=qs[_0xe119('0x11')](_0x174eba[_0xe119('0x28')][_0xe119('0x11')]);}_0x25aa82[_0xe119('0x49')]=qs['sort'](_0x174eba[_0xe119('0x28')][_0xe119('0x4a')]);_0x25aa82['where']=qs[_0xe119('0x2d')](_['pick'](_0x174eba['query'],_0x5bcecf[_0xe119('0x2d')]));_0x25aa82[_0xe119('0x4b')][_0xe119('0x4c')]=_0x57c481['id'];if(_0x174eba['query']['filter']){_0x25aa82['where']=_[_0xe119('0x34')](_0x25aa82[_0xe119('0x4b')],{'$or':_[_0xe119('0x20')](_0x25aa82[_0xe119('0x30')],function(_0xda4fe9){var _0x29aa99={};_0x29aa99[_0xda4fe9]={'$like':'%'+_0x174eba[_0xe119('0x28')][_0xe119('0x4d')]+'%'};return _0x29aa99;})});}_0x25aa82=_[_0xe119('0x34')]({},_0x25aa82,_0x174eba[_0xe119('0x35')]);return db[_0xe119('0x46')][_0xe119('0x4e')](_0x25aa82);}})['then'](function(_0x413bd5){if(_0x413bd5){return db[_0xe119('0x4f')]['findAndCountAll']({'where':{'id':_[_0xe119('0x20')](_0x413bd5,_0xe119('0x50')),'role':'agent'},'attributes':['id',_0xe119('0x1d'),_0xe119('0x51'),'updatedAt',_0xe119('0x52')]});}})['then'](function(_0x1ad271){if(_0x1ad271){return{'count':_0x1ad271['count'],'rows':_[_0xe119('0x20')](_0x1ad271[_0xe119('0x29')],function(_0x3e8813){return{'membername':_0x3e8813[_0xe119('0x1d')],'UserId':_0x3e8813['id'],'queue_name':_0x285fa6[_0xe119('0x1d')],'WhatsappQueueId':_0x285fa6['id'],'interface':util[_0xe119('0x53')](_0xe119('0x54'),_0xe119('0x55'),_0x3e8813['name']),'penalty':0x0,'paused':_0x3e8813[_0xe119('0x51')],'createdAt':_0x3e8813['createdAt'],'updatedAt':_0x3e8813['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe119('0x18')](respondWithFilteredResult(_0x5f0a07,_0x25aa82))['catch'](handleError(_0x5f0a07,null));};exports[_0xe119('0x56')]=function(_0x5d6c75,_0x488eb5){var _0x27a300={};var _0x45b8ef={};var _0x2f6c61;var _0x32f641;return db[_0xe119('0x21')][_0xe119('0x45')]({'where':{'id':_0x5d6c75[_0xe119('0x42')]['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x488eb5,null))[_0xe119('0x18')](function(_0x4bb03c){if(_0x4bb03c){_0x2f6c61=_0x4bb03c;_0x45b8ef['model']=_['keys'](db[_0xe119('0x57')]['rawAttributes']);_0x45b8ef[_0xe119('0x28')]=_[_0xe119('0x2c')](_0x5d6c75[_0xe119('0x28')]);_0x45b8ef['filters']=_[_0xe119('0x2e')](_0x45b8ef['model'],_0x45b8ef[_0xe119('0x28')]);_0x27a300[_0xe119('0x30')]=_[_0xe119('0x2e')](_0x45b8ef[_0xe119('0x2f')],qs[_0xe119('0x31')](_0x5d6c75[_0xe119('0x28')][_0xe119('0x31')]));_0x27a300[_0xe119('0x30')]=_0x27a300['attributes'][_0xe119('0x32')]?_0x27a300[_0xe119('0x30')]:_0x45b8ef['model'];_0x27a300[_0xe119('0x49')]=qs['sort'](_0x5d6c75['query'][_0xe119('0x4a')]);_0x27a300[_0xe119('0x4b')]=qs[_0xe119('0x2d')](_[_0xe119('0x58')](_0x5d6c75['query'],_0x45b8ef[_0xe119('0x2d')]));if(_0x5d6c75[_0xe119('0x28')]['filter']){_0x27a300[_0xe119('0x4b')]=_[_0xe119('0x34')](_0x27a300[_0xe119('0x4b')],{'$or':_[_0xe119('0x20')](_0x27a300['attributes'],function(_0x2b4b30){var _0x4e8f0c={};_0x4e8f0c[_0x2b4b30]={'$like':'%'+_0x5d6c75[_0xe119('0x28')][_0xe119('0x4d')]+'%'};return _0x4e8f0c;})});}_0x27a300=_[_0xe119('0x34')]({},_0x27a300,_0x5d6c75[_0xe119('0x35')]);return _0x2f6c61[_0xe119('0x56')](_0x27a300);}})['then'](function(_0x21d3e7){if(_0x21d3e7){_0x32f641=_0x21d3e7[_0xe119('0x32')];if(!_0x5d6c75[_0xe119('0x28')]['hasOwnProperty'](_0xe119('0x48'))){_0x27a300[_0xe119('0x12')]=qs[_0xe119('0x12')](_0x5d6c75[_0xe119('0x28')]['limit']);_0x27a300[_0xe119('0x11')]=qs[_0xe119('0x11')](_0x5d6c75['query']['offset']);}return _0x2f6c61[_0xe119('0x56')](_0x27a300);}})[_0xe119('0x18')](function(_0x453366){if(_0x453366){return _0x453366?{'count':_0x32f641,'rows':_0x453366}:null;}})[_0xe119('0x18')](respondWithResult(_0x488eb5,null))[_0xe119('0x2a')](handleError(_0x488eb5,null));};exports[_0xe119('0x59')]=function(_0x8d5b1f,_0x4e459e){var _0x1441d7=_0x8d5b1f[_0xe119('0x37')][_0xe119('0x5a')];return db[_0xe119('0x57')][_0xe119('0x4e')]({'where':{'id':_0x1441d7},'attributes':['id'],'include':[{'model':db[_0xe119('0x4f')],'as':_0xe119('0x5b'),'attributes':['id','name','online',_0xe119('0x5c'),_0xe119('0x5d')],'raw':!![]}]})[_0xe119('0x18')](function(_0x401146){if(_0x401146){var _0x512eff=_[_0xe119('0x5e')](_0x401146,function(_0x43684b){var _0x382f57=_0x43684b[_0xe119('0x39')]({'plain':!![]});return _0x382f57[_0xe119('0x5b')];});return db['WhatsappQueue']['find']({'where':{'id':_0x8d5b1f[_0xe119('0x42')]['id']}})[_0xe119('0x18')](function(_0x445ad6){return db[_0xe119('0x5f')]['transaction'](function(_0x515580){return _0x445ad6[_0xe119('0x59')](_0x1441d7,{'transaction':_0x515580})[_0xe119('0x18')](function(){return BPromise[_0xe119('0x60')](_0x512eff,function(_0x392b78){return db[_0xe119('0x46')][_0xe119('0x61')]({'where':{'UserId':_0x392b78['id'],'WhatsappQueueId':_0x8d5b1f[_0xe119('0x42')]['id']},'transaction':_0x515580});});})[_0xe119('0x18')](function(){_0x512eff[_0xe119('0x62')](function(_0x327c84){socket[_0xe119('0x63')](_0xe119('0x64'),{'UserId':_0x327c84['id'],'WhatsappQueueId':_0x445ad6['id']});});});});});}})[_0xe119('0x18')](respondWithStatusCode(_0x4e459e,null))[_0xe119('0x2a')](handleError(_0x4e459e,null));};exports[_0xe119('0x65')]=function(_0x38434e,_0x82d5c7){return db[_0xe119('0x57')][_0xe119('0x4e')]({'where':{'id':_0x38434e[_0xe119('0x28')][_0xe119('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xe119('0x4f')],'as':_0xe119('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xe119('0x18')](handleEntityNotFound(_0x82d5c7,null))[_0xe119('0x18')](function(_0x5b7940){var _0x560d88=_[_0xe119('0x20')](_0x5b7940,'id');var _0x93a875=[];var _0x57fd8b=[];var _0x57e04c=squel['select']();_0x57e04c[_0xe119('0x66')](_0xe119('0x67'))[_0xe119('0x68')](_0xe119('0x69'),'tq')['join'](_0xe119('0x6a'),'ut',_0xe119('0x6b'))[_0xe119('0x4b')](_0xe119('0x6c'),_0x38434e[_0xe119('0x42')]['id']);for(var _0x19f025=0x0;_0x19f025<_0x5b7940[_0xe119('0x32')];_0x19f025+=0x1){let _0x52013e=_0x5b7940[_0x19f025];for(var _0x2dd316=0x0;_0x2dd316<_0x52013e[_0xe119('0x5b')][_0xe119('0x32')];_0x2dd316+=0x1){let _0x4799df=_0x52013e['Agents'][_0x2dd316];var _0x169cd8=_0x57e04c[_0xe119('0x6d')]();_0x169cd8['where'](_0xe119('0x6e'),_0x4799df['id']);_0x57fd8b[_0xe119('0x6f')](db[_0xe119('0x5f')]['query'](_0x169cd8[_0xe119('0x70')](),{'type':db[_0xe119('0x5f')][_0xe119('0x71')][_0xe119('0x72')]})[_0xe119('0x18')](function(_0x357715){if(_0x357715[_0xe119('0x32')]===0x1){return _0x4799df['id'];}else{var _0xb590c=_[_0xe119('0x73')](_[_0xe119('0x20')](_0x357715,_0xe119('0x74')),function(_0x5b720e){return _[_0xe119('0x75')](_0x560d88,_0x5b720e);});if(_0xb590c){return _0x4799df['id'];}}}));}}return BPromise[_0xe119('0x76')](_0x57fd8b)[_0xe119('0x18')](function(_0x335308){_0x93a875=_(_0x93a875)[_0xe119('0x77')](_0x335308)['compact']()[_0xe119('0x78')]();return db['WhatsappQueue'][_0xe119('0x36')]({'where':{'id':_0x38434e[_0xe119('0x42')]['id']}})[_0xe119('0x18')](function(_0x4d4553){return db['sequelize'][_0xe119('0x79')](function(_0x1993d2){return _0x4d4553[_0xe119('0x65')](_0x38434e[_0xe119('0x28')][_0xe119('0x5a')],{'transaction':_0x1993d2})[_0xe119('0x18')](function(){if(!_[_0xe119('0x7a')](_0x93a875)){return _0x4d4553['removeAgents'](_0x93a875,{'transaction':_0x1993d2});}})[_0xe119('0x18')](function(){_0x93a875['forEach'](function(_0x5cb69e){socket['emit'](_0xe119('0x7b'),{'UserId':_0x5cb69e,'WhatsappQueueId':_0x4d4553['id']});});});});});});})['then'](respondWithStatusCode(_0x82d5c7,null))[_0xe119('0x2a')](handleError(_0x82d5c7,null));};exports[_0xe119('0x7c')]=function(_0x19032f,_0xa19cb4){return db[_0xe119('0x21')][_0xe119('0x36')]({'where':{'id':_0x19032f[_0xe119('0x42')]['id']}})[_0xe119('0x18')](handleEntityNotFound(_0xa19cb4,null))[_0xe119('0x18')](function(_0x278c77){if(_0x278c77){return _0x278c77[_0xe119('0x7c')](_0x19032f[_0xe119('0x37')][_0xe119('0x5a')],_[_0xe119('0x7d')](_0x19032f[_0xe119('0x37')],[_0xe119('0x5a'),'id'])||{})[_0xe119('0x7e')](function(_0x53a94c){for(var _0x5bb6ac=0x0;_0x5bb6ac<_0x19032f[_0xe119('0x37')][_0xe119('0x5a')][_0xe119('0x32')];_0x5bb6ac+=0x1){socket[_0xe119('0x63')]('userWhatsappQueue:save',{'UserId':Number(_0x19032f[_0xe119('0x37')][_0xe119('0x5a')][_0x5bb6ac]),'WhatsappQueueId':Number(_0x19032f[_0xe119('0x42')]['id'])});}return _0x53a94c;});}})[_0xe119('0x18')](respondWithResult(_0xa19cb4,null))[_0xe119('0x2a')](handleError(_0xa19cb4,null));};exports[_0xe119('0x7f')]=function(_0x537073,_0x1a63ff){return db['WhatsappQueue'][_0xe119('0x36')]({'where':{'id':_0x537073['params']['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x1a63ff,null))[_0xe119('0x18')](function(_0x84e0f0){if(_0x84e0f0){return _0x84e0f0[_0xe119('0x7f')](_0x537073[_0xe119('0x28')][_0xe119('0x5a')])[_0xe119('0x18')](function(){if(_[_0xe119('0x80')](_0x537073[_0xe119('0x28')]['ids'])){for(var _0x1b27a4=0x0;_0x1b27a4<_0x537073[_0xe119('0x28')][_0xe119('0x5a')][_0xe119('0x32')];_0x1b27a4+=0x1){socket[_0xe119('0x63')](_0xe119('0x7b'),{'UserId':Number(_0x537073[_0xe119('0x28')]['ids'][_0x1b27a4]),'WhatsappQueueId':Number(_0x537073[_0xe119('0x42')]['id'])});}}else{socket['emit'](_0xe119('0x7b'),{'UserId':Number(_0x537073[_0xe119('0x28')][_0xe119('0x5a')]),'WhatsappQueueId':Number(_0x537073[_0xe119('0x42')]['id'])});}});}})[_0xe119('0x18')](respondWithStatusCode(_0x1a63ff,null))[_0xe119('0x2a')](handleError(_0x1a63ff,null));};exports[_0xe119('0x81')]=function(_0x2afcb5,_0x19cd52){var _0x4c34f3={};var _0x3c71fc={};var _0x5e2aed;var _0x5385cf;return db['WhatsappQueue']['findOne']({'where':{'id':_0x2afcb5[_0xe119('0x42')]['id']}})[_0xe119('0x18')](handleEntityNotFound(_0x19cd52,null))[_0xe119('0x18')](function(_0x31a0ae){if(_0x31a0ae){_0x5e2aed=_0x31a0ae;_0x3c71fc[_0xe119('0x2f')]=_[_0xe119('0x2c')](db[_0xe119('0x4f')][_0xe119('0x22')]);_0x3c71fc[_0xe119('0x28')]=_[_0xe119('0x2c')](_0x2afcb5[_0xe119('0x28')]);_0x3c71fc[_0xe119('0x2d')]=_[_0xe119('0x2e')](_0x3c71fc[_0xe119('0x2f')],_0x3c71fc[_0xe119('0x28')]);_0x4c34f3[_0xe119('0x30')]=_[_0xe119('0x2e')](_0x3c71fc['model'],qs[_0xe119('0x31')](_0x2afcb5[_0xe119('0x28')][_0xe119('0x31')]));_0x4c34f3[_0xe119('0x30')]=_0x4c34f3[_0xe119('0x30')]['length']?_0x4c34f3[_0xe119('0x30')]:_0x3c71fc[_0xe119('0x2f')];_0x4c34f3[_0xe119('0x49')]=qs[_0xe119('0x4a')](_0x2afcb5[_0xe119('0x28')][_0xe119('0x4a')]);_0x4c34f3[_0xe119('0x4b')]=qs['filters'](_[_0xe119('0x58')](_0x2afcb5[_0xe119('0x28')],_0x3c71fc[_0xe119('0x2d')]));if(_0x2afcb5[_0xe119('0x28')][_0xe119('0x4d')]){_0x4c34f3[_0xe119('0x4b')]=_[_0xe119('0x34')](_0x4c34f3[_0xe119('0x4b')],{'$or':_[_0xe119('0x20')](_0x4c34f3[_0xe119('0x30')],function(_0x1b23b8){var _0x5eb60c={};_0x5eb60c[_0x1b23b8]={'$like':'%'+_0x2afcb5[_0xe119('0x28')][_0xe119('0x4d')]+'%'};return _0x5eb60c;})});}_0x4c34f3=_[_0xe119('0x34')]({},_0x4c34f3,_0x2afcb5[_0xe119('0x35')]);return _0x5e2aed['getAgents'](_0x4c34f3);}})['then'](function(_0x53cf5f){if(_0x53cf5f){_0x5385cf=_0x53cf5f[_0xe119('0x32')];if(!_0x2afcb5['query'][_0xe119('0x47')](_0xe119('0x48'))){_0x4c34f3['limit']=qs[_0xe119('0x12')](_0x2afcb5[_0xe119('0x28')][_0xe119('0x12')]);_0x4c34f3[_0xe119('0x11')]=qs[_0xe119('0x11')](_0x2afcb5['query'][_0xe119('0x11')]);}return _0x5e2aed[_0xe119('0x81')](_0x4c34f3);}})[_0xe119('0x18')](function(_0xec0b75){if(_0xec0b75){return _0xec0b75?{'count':_0x5385cf,'rows':_0xec0b75}:null;}})[_0xe119('0x18')](respondWithResult(_0x19cd52,null))[_0xe119('0x2a')](handleError(_0x19cd52,null));}; \ No newline at end of file +var _0x8c31=['flatMap','sequelize','transaction','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','findOne','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','type','key','getOptions','where','include','query','findAll','rows','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','options','body','user','role','find','autoAssociation','create','catch','describe','getMembers','UserWhatsappQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface'];(function(_0x11cdd5,_0x3b8fbc){var _0x26cdf1=function(_0x2069bc){while(--_0x2069bc){_0x11cdd5['push'](_0x11cdd5['shift']());}};_0x26cdf1(++_0x3b8fbc);}(_0x8c31,0x98));var _0x18c3=function(_0x1dd378,_0x54081d){_0x1dd378=_0x1dd378-0x0;var _0x5a304e=_0x8c31[_0x1dd378];return _0x5a304e;};'use strict';var BPromise=require('bluebird');var util=require(_0x18c3('0x0'));var _=require('lodash');var squel=require(_0x18c3('0x1'));var Redis=require(_0x18c3('0x2'));var qs=require(_0x18c3('0x3'));var logger=require(_0x18c3('0x4'))(_0x18c3('0x5'));var config=require('../../config/environment');var db=require(_0x18c3('0x6'))['db'];config['redis']=_[_0x18c3('0x7')](config[_0x18c3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x18c3('0x9'))(new Redis(config[_0x18c3('0x8')]));require(_0x18c3('0xa'))[_0x18c3('0xb')](socket);function respondWithStatusCode(_0x175161,_0x3af714){_0x3af714=_0x3af714||0xcc;return function(_0x1f2a66){if(_0x1f2a66){return _0x175161[_0x18c3('0xc')](_0x3af714);}return _0x175161['status'](_0x3af714)[_0x18c3('0xd')]();};}function respondWithResult(_0x4a210c,_0x9205be){_0x9205be=_0x9205be||0xc8;return function(_0x243cb7){if(_0x243cb7){return _0x4a210c['status'](_0x9205be)['json'](_0x243cb7);}};}function respondWithFilteredResult(_0x1491ac,_0x122916){return function(_0x39a8ce){if(_0x39a8ce){var _0x4cad1a=typeof _0x122916[_0x18c3('0xe')]===_0x18c3('0xf')&&typeof _0x122916[_0x18c3('0x10')]===_0x18c3('0xf');var _0x25e196=_0x39a8ce[_0x18c3('0x11')];var _0x5332f0=_0x4cad1a?0x0:_0x122916[_0x18c3('0xe')];var _0x37bb27=_0x4cad1a?_0x39a8ce[_0x18c3('0x11')]:_0x122916[_0x18c3('0xe')]+_0x122916[_0x18c3('0x10')];var _0x2a6ba9;if(_0x37bb27>=_0x25e196){_0x37bb27=_0x25e196;_0x2a6ba9=0xc8;}else{_0x2a6ba9=0xce;}_0x1491ac[_0x18c3('0x12')](_0x2a6ba9);return _0x1491ac[_0x18c3('0x13')](_0x18c3('0x14'),_0x5332f0+'-'+_0x37bb27+'/'+_0x25e196)[_0x18c3('0x15')](_0x39a8ce);}return null;};}function saveUpdates(_0xdc9953){return function(_0x27a2d3){if(_0x27a2d3){return _0x27a2d3[_0x18c3('0x16')](_0xdc9953)[_0x18c3('0x17')](function(_0x358894){return _0x358894;});}return null;};}function removeEntity(_0x2ca0b4){return function(_0x11edf9){if(_0x11edf9){return _0x11edf9[_0x18c3('0x18')]()['then'](function(){var _0x432553=_0x11edf9[_0x18c3('0x19')]({'plain':!![]});var _0xc6d2ed=_0x18c3('0x1a');return db[_0x18c3('0x1b')][_0x18c3('0x18')]({'where':{'type':_0xc6d2ed,'resourceId':_0x432553['id']}})['then'](function(){return _0x11edf9;});})['then'](function(){_0x2ca0b4[_0x18c3('0x12')](0xcc)[_0x18c3('0xd')]();});}};}function handleEntityNotFound(_0x31f6b1){return function(_0x1c5d20){if(!_0x1c5d20){_0x31f6b1[_0x18c3('0xc')](0x194);}return _0x1c5d20;};}function handleError(_0x5518b3,_0x5a3526){_0x5a3526=_0x5a3526||0x1f4;return function(_0x290a0f){logger[_0x18c3('0x1c')](_0x290a0f[_0x18c3('0x1d')]);if(_0x290a0f[_0x18c3('0x1e')]){delete _0x290a0f[_0x18c3('0x1e')];}_0x5518b3[_0x18c3('0x12')](_0x5a3526)[_0x18c3('0x1f')](_0x290a0f);};}exports[_0x18c3('0x20')]=function(_0xb0c303,_0x56d9dc){var _0x2d760d={};var _0x1ab1e9={'count':0x0,'rows':[]};var _0x1148f9=_[_0x18c3('0x21')](db[_0x18c3('0x22')]['rawAttributes'],function(_0x2d7dbf){return{'name':_0x2d7dbf['fieldName'],'type':_0x2d7dbf[_0x18c3('0x23')][_0x18c3('0x24')]};});_0x2d760d=qs[_0x18c3('0x25')](_0x1148f9,_0xb0c303);var _0x387f03={'where':_0x2d760d[_0x18c3('0x26')]};return db['WhatsappQueue'][_0x18c3('0x11')](_0x387f03)[_0x18c3('0x17')](function(_0x21fe48){_0x1ab1e9[_0x18c3('0x11')]=_0x21fe48;_0x2d760d[_0x18c3('0x27')]=qs[_0x18c3('0x27')](_0xb0c303[_0x18c3('0x28')]);return db['WhatsappQueue'][_0x18c3('0x29')](_0x2d760d);})[_0x18c3('0x17')](function(_0x11c56f){_0x1ab1e9[_0x18c3('0x2a')]=_0x11c56f;return _0x1ab1e9;})[_0x18c3('0x17')](respondWithFilteredResult(_0x56d9dc,_0x2d760d))['catch'](handleError(_0x56d9dc,null));};exports[_0x18c3('0x2b')]=function(_0x454335,_0x3693be){var _0x15fcb4={'raw':!![],'where':{'id':_0x454335[_0x18c3('0x2c')]['id']}},_0x317c9b={};_0x317c9b['model']=_[_0x18c3('0x2d')](db[_0x18c3('0x22')]['rawAttributes']);_0x317c9b[_0x18c3('0x28')]=_['keys'](_0x454335[_0x18c3('0x28')]);_0x317c9b[_0x18c3('0x2e')]=_[_0x18c3('0x2f')](_0x317c9b['model'],_0x317c9b[_0x18c3('0x28')]);_0x15fcb4[_0x18c3('0x30')]=_['intersection'](_0x317c9b[_0x18c3('0x31')],qs[_0x18c3('0x32')](_0x454335[_0x18c3('0x28')]['fields']));_0x15fcb4[_0x18c3('0x30')]=_0x15fcb4['attributes'][_0x18c3('0x33')]?_0x15fcb4['attributes']:_0x317c9b['model'];if(_0x454335[_0x18c3('0x28')][_0x18c3('0x34')]){_0x15fcb4[_0x18c3('0x27')]=[{'all':!![]}];}_0x15fcb4=_[_0x18c3('0x35')]({},_0x15fcb4,_0x454335[_0x18c3('0x36')]);return db['WhatsappQueue']['find'](_0x15fcb4)[_0x18c3('0x17')](handleEntityNotFound(_0x3693be,null))[_0x18c3('0x17')](respondWithResult(_0x3693be,null))['catch'](handleError(_0x3693be,null));};exports['create']=function(_0x4afc36,_0x3491e9){return db[_0x18c3('0x22')]['create'](_0x4afc36[_0x18c3('0x37')],{})[_0x18c3('0x17')](function(_0x21b4ff){var _0x455a70=_0x4afc36[_0x18c3('0x38')][_0x18c3('0x19')]({'plain':!![]});if(!_0x455a70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x455a70[_0x18c3('0x39')]===_0x18c3('0x38')){var _0x143c54=_0x21b4ff[_0x18c3('0x19')]({'plain':!![]});var _0x4e4475=_0x18c3('0x1a');return db['UserProfileSection'][_0x18c3('0x3a')]({'where':{'name':_0x4e4475,'userProfileId':_0x455a70['userProfileId']},'raw':!![]})[_0x18c3('0x17')](function(_0x3bb880){if(_0x3bb880&&_0x3bb880[_0x18c3('0x3b')]===0x0){return db['UserProfileResource'][_0x18c3('0x3c')]({'name':_0x143c54[_0x18c3('0x1e')],'resourceId':_0x143c54['id'],'type':_0x3bb880[_0x18c3('0x1e')],'sectionId':_0x3bb880['id']},{})[_0x18c3('0x17')](function(){return _0x21b4ff;});}else{return _0x21b4ff;}})[_0x18c3('0x3d')](function(_0x4d38d2){logger[_0x18c3('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d38d2);throw _0x4d38d2;});}return _0x21b4ff;})['then'](respondWithResult(_0x3491e9,0xc9))[_0x18c3('0x3d')](handleError(_0x3491e9,null));};exports[_0x18c3('0x16')]=function(_0x52e4a8,_0x3e8681){if(_0x52e4a8[_0x18c3('0x37')]['id']){delete _0x52e4a8[_0x18c3('0x37')]['id'];}return db[_0x18c3('0x22')][_0x18c3('0x3a')]({'where':{'id':_0x52e4a8[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x3e8681,null))[_0x18c3('0x17')](saveUpdates(_0x52e4a8[_0x18c3('0x37')],null))[_0x18c3('0x17')](respondWithResult(_0x3e8681,null))[_0x18c3('0x3d')](handleError(_0x3e8681,null));};exports[_0x18c3('0x18')]=function(_0x305f4e,_0x3a4dc2){return db['WhatsappQueue'][_0x18c3('0x3a')]({'where':{'id':_0x305f4e[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x3a4dc2,null))[_0x18c3('0x17')](removeEntity(_0x3a4dc2,null))['catch'](handleError(_0x3a4dc2,null));};exports[_0x18c3('0x3e')]=function(_0x4cd84a,_0x5c71dc){return db[_0x18c3('0x22')]['describe']()[_0x18c3('0x17')](respondWithResult(_0x5c71dc,null))['catch'](handleError(_0x5c71dc,null));};exports[_0x18c3('0x3f')]=function(_0x5dde0b,_0x56a698){var _0xa4587a={'raw':!![],'where':{}},_0xb636d={},_0x5df696;return db[_0x18c3('0x22')]['findOne']({'where':{'id':_0x5dde0b[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x56a698,null))[_0x18c3('0x17')](function(_0x476d75){if(_0x476d75){_0x5df696=_0x476d75['get']({'plain':!![]});_0xb636d['model']=_[_0x18c3('0x2d')](db[_0x18c3('0x40')][_0x18c3('0x41')]);_0xb636d[_0x18c3('0x28')]=_[_0x18c3('0x2d')](_0x5dde0b[_0x18c3('0x28')]);_0xb636d[_0x18c3('0x2e')]=_[_0x18c3('0x2f')](_0xb636d['model'],_0xb636d[_0x18c3('0x28')]);_0xa4587a[_0x18c3('0x30')]=_[_0x18c3('0x2f')](_0xb636d[_0x18c3('0x31')],qs[_0x18c3('0x32')](_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x32')]));_0xa4587a[_0x18c3('0x30')]=_0xa4587a[_0x18c3('0x30')][_0x18c3('0x33')]?_0xa4587a[_0x18c3('0x30')]:_0xb636d['model'];if(!_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x42')](_0x18c3('0x43'))){_0xa4587a[_0x18c3('0x10')]=qs[_0x18c3('0x10')](_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x10')]);_0xa4587a[_0x18c3('0xe')]=qs[_0x18c3('0xe')](_0x5dde0b[_0x18c3('0x28')][_0x18c3('0xe')]);}_0xa4587a[_0x18c3('0x44')]=qs[_0x18c3('0x45')](_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x45')]);_0xa4587a[_0x18c3('0x26')]=qs[_0x18c3('0x2e')](_[_0x18c3('0x46')](_0x5dde0b['query'],_0xb636d[_0x18c3('0x2e')]));_0xa4587a[_0x18c3('0x26')]['WhatsappQueueId']=_0x476d75['id'];if(_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x47')]){_0xa4587a[_0x18c3('0x26')]=_['merge'](_0xa4587a[_0x18c3('0x26')],{'$or':_[_0x18c3('0x21')](_0xa4587a[_0x18c3('0x30')],function(_0x4b8ce1){var _0x3aaf75={};_0x3aaf75[_0x4b8ce1]={'$like':'%'+_0x5dde0b['query'][_0x18c3('0x47')]+'%'};return _0x3aaf75;})});}_0xa4587a=_[_0x18c3('0x35')]({},_0xa4587a,_0x5dde0b['options']);return db[_0x18c3('0x40')][_0x18c3('0x29')](_0xa4587a);}})[_0x18c3('0x17')](function(_0xda4817){if(_0xda4817){return db[_0x18c3('0x48')][_0x18c3('0x49')]({'where':{'id':_[_0x18c3('0x21')](_0xda4817,'UserId'),'role':_0x18c3('0x4a')},'attributes':['id',_0x18c3('0x1e'),_0x18c3('0x4b'),_0x18c3('0x4c'),_0x18c3('0x4d')]});}})[_0x18c3('0x17')](function(_0x52da59){if(_0x52da59){return{'count':_0x52da59[_0x18c3('0x11')],'rows':_['map'](_0x52da59[_0x18c3('0x2a')],function(_0x2856c7){return{'membername':_0x2856c7[_0x18c3('0x1e')],'UserId':_0x2856c7['id'],'queue_name':_0x5df696[_0x18c3('0x1e')],'WhatsappQueueId':_0x5df696['id'],'interface':util[_0x18c3('0x4e')]('%s/%s',_0x18c3('0x4f'),_0x2856c7['name']),'penalty':0x0,'paused':_0x2856c7[_0x18c3('0x4b')],'createdAt':_0x2856c7[_0x18c3('0x4d')],'updatedAt':_0x2856c7[_0x18c3('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x18c3('0x17')](respondWithFilteredResult(_0x56a698,_0xa4587a))[_0x18c3('0x3d')](handleError(_0x56a698,null));};exports[_0x18c3('0x50')]=function(_0x22621f,_0x37f47d){var _0x4a81e4={};var _0x4fa926={};var _0x2943f0;var _0x1da343;return db[_0x18c3('0x22')]['findOne']({'where':{'id':_0x22621f['params']['id']}})['then'](handleEntityNotFound(_0x37f47d,null))[_0x18c3('0x17')](function(_0x54fca4){if(_0x54fca4){_0x2943f0=_0x54fca4;_0x4fa926[_0x18c3('0x31')]=_['keys'](db[_0x18c3('0x51')][_0x18c3('0x41')]);_0x4fa926[_0x18c3('0x28')]=_[_0x18c3('0x2d')](_0x22621f['query']);_0x4fa926['filters']=_[_0x18c3('0x2f')](_0x4fa926[_0x18c3('0x31')],_0x4fa926['query']);_0x4a81e4[_0x18c3('0x30')]=_[_0x18c3('0x2f')](_0x4fa926[_0x18c3('0x31')],qs[_0x18c3('0x32')](_0x22621f['query'][_0x18c3('0x32')]));_0x4a81e4[_0x18c3('0x30')]=_0x4a81e4[_0x18c3('0x30')][_0x18c3('0x33')]?_0x4a81e4[_0x18c3('0x30')]:_0x4fa926[_0x18c3('0x31')];_0x4a81e4[_0x18c3('0x44')]=qs['sort'](_0x22621f[_0x18c3('0x28')][_0x18c3('0x45')]);_0x4a81e4['where']=qs[_0x18c3('0x2e')](_['pick'](_0x22621f['query'],_0x4fa926[_0x18c3('0x2e')]));if(_0x22621f['query'][_0x18c3('0x47')]){_0x4a81e4['where']=_[_0x18c3('0x35')](_0x4a81e4[_0x18c3('0x26')],{'$or':_[_0x18c3('0x21')](_0x4a81e4[_0x18c3('0x30')],function(_0x150764){var _0x18e050={};_0x18e050[_0x150764]={'$like':'%'+_0x22621f[_0x18c3('0x28')][_0x18c3('0x47')]+'%'};return _0x18e050;})});}_0x4a81e4=_[_0x18c3('0x35')]({},_0x4a81e4,_0x22621f[_0x18c3('0x36')]);return _0x2943f0[_0x18c3('0x50')](_0x4a81e4);}})[_0x18c3('0x17')](function(_0xf710d5){if(_0xf710d5){_0x1da343=_0xf710d5[_0x18c3('0x33')];if(!_0x22621f['query']['hasOwnProperty'](_0x18c3('0x43'))){_0x4a81e4[_0x18c3('0x10')]=qs[_0x18c3('0x10')](_0x22621f[_0x18c3('0x28')][_0x18c3('0x10')]);_0x4a81e4[_0x18c3('0xe')]=qs[_0x18c3('0xe')](_0x22621f[_0x18c3('0x28')][_0x18c3('0xe')]);}return _0x2943f0['getTeams'](_0x4a81e4);}})[_0x18c3('0x17')](function(_0x489568){if(_0x489568){return _0x489568?{'count':_0x1da343,'rows':_0x489568}:null;}})[_0x18c3('0x17')](respondWithResult(_0x37f47d,null))[_0x18c3('0x3d')](handleError(_0x37f47d,null));};exports[_0x18c3('0x52')]=function(_0x3beec6,_0x5b03a5){var _0x31bd99=_0x3beec6[_0x18c3('0x37')][_0x18c3('0x53')];return db[_0x18c3('0x51')][_0x18c3('0x29')]({'where':{'id':_0x31bd99},'attributes':['id'],'include':[{'model':db[_0x18c3('0x48')],'as':_0x18c3('0x54'),'attributes':['id',_0x18c3('0x1e'),_0x18c3('0x55'),_0x18c3('0x56'),_0x18c3('0x57')],'raw':!![]}]})[_0x18c3('0x17')](function(_0x59aff2){if(_0x59aff2){var _0x38fd2c=_[_0x18c3('0x58')](_0x59aff2,function(_0x1262d9){var _0x166d74=_0x1262d9[_0x18c3('0x19')]({'plain':!![]});return _0x166d74[_0x18c3('0x54')];});return db['WhatsappQueue'][_0x18c3('0x3a')]({'where':{'id':_0x3beec6[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](function(_0x456469){return db[_0x18c3('0x59')][_0x18c3('0x5a')](function(_0x415637){return _0x456469[_0x18c3('0x52')](_0x31bd99,{'transaction':_0x415637})[_0x18c3('0x17')](function(){return BPromise['each'](_0x38fd2c,function(_0x53ea19){return db[_0x18c3('0x40')][_0x18c3('0x5b')]({'where':{'UserId':_0x53ea19['id'],'WhatsappQueueId':_0x3beec6[_0x18c3('0x2c')]['id']},'transaction':_0x415637});});})[_0x18c3('0x17')](function(){_0x38fd2c[_0x18c3('0x5c')](function(_0x5dc01e){socket['emit'](_0x18c3('0x5d'),{'UserId':_0x5dc01e['id'],'WhatsappQueueId':_0x456469['id']});});});});});}})[_0x18c3('0x17')](respondWithStatusCode(_0x5b03a5,null))[_0x18c3('0x3d')](handleError(_0x5b03a5,null));};exports[_0x18c3('0x5e')]=function(_0x441e24,_0x5dd1da){return db[_0x18c3('0x51')][_0x18c3('0x29')]({'where':{'id':_0x441e24[_0x18c3('0x28')][_0x18c3('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x18c3('0x54'),'attributes':['id'],'raw':!![]}]})[_0x18c3('0x17')](handleEntityNotFound(_0x5dd1da,null))[_0x18c3('0x17')](function(_0x916e44){var _0x18a819=_[_0x18c3('0x21')](_0x916e44,'id');var _0x4a047c=[];var _0x590144=[];var _0x58a68b=squel[_0x18c3('0x5f')]();_0x58a68b[_0x18c3('0x60')](_0x18c3('0x61'))[_0x18c3('0x62')](_0x18c3('0x63'),'tq')['join'](_0x18c3('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x18c3('0x26')]('WhatsappQueueId\x20=\x20?',_0x441e24['params']['id']);for(var _0x4afc76=0x0;_0x4afc76<_0x916e44[_0x18c3('0x33')];_0x4afc76+=0x1){let _0x8c23c6=_0x916e44[_0x4afc76];for(var _0x359787=0x0;_0x359787<_0x8c23c6[_0x18c3('0x54')]['length'];_0x359787+=0x1){let _0x400d38=_0x8c23c6[_0x18c3('0x54')][_0x359787];var _0x3d93f2=_0x58a68b['clone']();_0x3d93f2[_0x18c3('0x26')](_0x18c3('0x65'),_0x400d38['id']);_0x590144[_0x18c3('0x66')](db[_0x18c3('0x59')]['query'](_0x3d93f2[_0x18c3('0x67')](),{'type':db[_0x18c3('0x59')][_0x18c3('0x68')]['SELECT']})[_0x18c3('0x17')](function(_0x16e5e0){if(_0x16e5e0[_0x18c3('0x33')]===0x1){return _0x400d38['id'];}else{var _0x25fa18=_['every'](_[_0x18c3('0x21')](_0x16e5e0,_0x18c3('0x69')),function(_0x43d48e){return _[_0x18c3('0x6a')](_0x18a819,_0x43d48e);});if(_0x25fa18){return _0x400d38['id'];}}}));}}return BPromise['all'](_0x590144)[_0x18c3('0x17')](function(_0x288898){_0x4a047c=_(_0x4a047c)[_0x18c3('0x6b')](_0x288898)[_0x18c3('0x6c')]()[_0x18c3('0x6d')]();return db['WhatsappQueue'][_0x18c3('0x3a')]({'where':{'id':_0x441e24[_0x18c3('0x2c')]['id']}})['then'](function(_0x21bc2d){return db[_0x18c3('0x59')][_0x18c3('0x5a')](function(_0x16f3c9){return _0x21bc2d[_0x18c3('0x5e')](_0x441e24[_0x18c3('0x28')][_0x18c3('0x53')],{'transaction':_0x16f3c9})[_0x18c3('0x17')](function(){if(!_[_0x18c3('0x6e')](_0x4a047c)){return _0x21bc2d[_0x18c3('0x6f')](_0x4a047c,{'transaction':_0x16f3c9});}})[_0x18c3('0x17')](function(){_0x4a047c['forEach'](function(_0x4b2934){socket['emit'](_0x18c3('0x70'),{'UserId':_0x4b2934,'WhatsappQueueId':_0x21bc2d['id']});});});});});});})[_0x18c3('0x17')](respondWithStatusCode(_0x5dd1da,null))[_0x18c3('0x3d')](handleError(_0x5dd1da,null));};exports[_0x18c3('0x71')]=function(_0x492932,_0xcc7f71){return db[_0x18c3('0x22')][_0x18c3('0x3a')]({'where':{'id':_0x492932[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0xcc7f71,null))[_0x18c3('0x17')](function(_0x549f76){if(_0x549f76){return _0x549f76[_0x18c3('0x71')](_0x492932[_0x18c3('0x37')][_0x18c3('0x53')],_[_0x18c3('0x72')](_0x492932[_0x18c3('0x37')],['ids','id'])||{})[_0x18c3('0x73')](function(_0x2368ed){for(var _0x1b9917=0x0;_0x1b9917<_0x492932[_0x18c3('0x37')][_0x18c3('0x53')][_0x18c3('0x33')];_0x1b9917+=0x1){socket[_0x18c3('0x74')]('userWhatsappQueue:save',{'UserId':Number(_0x492932[_0x18c3('0x37')][_0x18c3('0x53')][_0x1b9917]),'WhatsappQueueId':Number(_0x492932[_0x18c3('0x2c')]['id'])});}return _0x2368ed;});}})['then'](respondWithResult(_0xcc7f71,null))['catch'](handleError(_0xcc7f71,null));};exports[_0x18c3('0x6f')]=function(_0x4d32ad,_0x1af259){return db[_0x18c3('0x22')][_0x18c3('0x3a')]({'where':{'id':_0x4d32ad[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x1af259,null))[_0x18c3('0x17')](function(_0x57ae38){if(_0x57ae38){return _0x57ae38[_0x18c3('0x6f')](_0x4d32ad[_0x18c3('0x28')][_0x18c3('0x53')])['then'](function(){if(_[_0x18c3('0x75')](_0x4d32ad[_0x18c3('0x28')][_0x18c3('0x53')])){for(var _0x299280=0x0;_0x299280<_0x4d32ad[_0x18c3('0x28')]['ids']['length'];_0x299280+=0x1){socket[_0x18c3('0x74')](_0x18c3('0x70'),{'UserId':Number(_0x4d32ad[_0x18c3('0x28')][_0x18c3('0x53')][_0x299280]),'WhatsappQueueId':Number(_0x4d32ad[_0x18c3('0x2c')]['id'])});}}else{socket[_0x18c3('0x74')](_0x18c3('0x70'),{'UserId':Number(_0x4d32ad['query'][_0x18c3('0x53')]),'WhatsappQueueId':Number(_0x4d32ad[_0x18c3('0x2c')]['id'])});}});}})[_0x18c3('0x17')](respondWithStatusCode(_0x1af259,null))[_0x18c3('0x3d')](handleError(_0x1af259,null));};exports[_0x18c3('0x76')]=function(_0x47ad91,_0x44bfc5){var _0xd99314={};var _0x431af8={};var _0x50c6b9;var _0x4e02de;return db[_0x18c3('0x22')][_0x18c3('0x77')]({'where':{'id':_0x47ad91[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x44bfc5,null))[_0x18c3('0x17')](function(_0x528219){if(_0x528219){_0x50c6b9=_0x528219;_0x431af8[_0x18c3('0x31')]=_['keys'](db[_0x18c3('0x48')][_0x18c3('0x41')]);_0x431af8[_0x18c3('0x28')]=_[_0x18c3('0x2d')](_0x47ad91[_0x18c3('0x28')]);_0x431af8[_0x18c3('0x2e')]=_[_0x18c3('0x2f')](_0x431af8[_0x18c3('0x31')],_0x431af8[_0x18c3('0x28')]);_0xd99314[_0x18c3('0x30')]=_[_0x18c3('0x2f')](_0x431af8[_0x18c3('0x31')],qs[_0x18c3('0x32')](_0x47ad91[_0x18c3('0x28')]['fields']));_0xd99314[_0x18c3('0x30')]=_0xd99314['attributes']['length']?_0xd99314['attributes']:_0x431af8[_0x18c3('0x31')];_0xd99314[_0x18c3('0x44')]=qs[_0x18c3('0x45')](_0x47ad91[_0x18c3('0x28')][_0x18c3('0x45')]);_0xd99314[_0x18c3('0x26')]=qs[_0x18c3('0x2e')](_[_0x18c3('0x46')](_0x47ad91['query'],_0x431af8[_0x18c3('0x2e')]));if(_0x47ad91[_0x18c3('0x28')]['filter']){_0xd99314[_0x18c3('0x26')]=_[_0x18c3('0x35')](_0xd99314[_0x18c3('0x26')],{'$or':_[_0x18c3('0x21')](_0xd99314[_0x18c3('0x30')],function(_0x15fb45){var _0x56bb94={};_0x56bb94[_0x15fb45]={'$like':'%'+_0x47ad91[_0x18c3('0x28')][_0x18c3('0x47')]+'%'};return _0x56bb94;})});}_0xd99314=_[_0x18c3('0x35')]({},_0xd99314,_0x47ad91[_0x18c3('0x36')]);return _0x50c6b9[_0x18c3('0x76')](_0xd99314);}})[_0x18c3('0x17')](function(_0x79e515){if(_0x79e515){_0x4e02de=_0x79e515[_0x18c3('0x33')];if(!_0x47ad91['query'][_0x18c3('0x42')]('nolimit')){_0xd99314[_0x18c3('0x10')]=qs['limit'](_0x47ad91[_0x18c3('0x28')][_0x18c3('0x10')]);_0xd99314['offset']=qs[_0x18c3('0xe')](_0x47ad91['query'][_0x18c3('0xe')]);}return _0x50c6b9['getAgents'](_0xd99314);}})['then'](function(_0x264ec5){if(_0x264ec5){return _0x264ec5?{'count':_0x4e02de,'rows':_0x264ec5}:null;}})[_0x18c3('0x17')](respondWithResult(_0x44bfc5,null))[_0x18c3('0x3d')](handleError(_0x44bfc5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 2432cfd..7e04b3c 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 _0x365e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x45fa84,_0x215351){var _0x42c133=function(_0x6ddd37){while(--_0x6ddd37){_0x45fa84['push'](_0x45fa84['shift']());}};_0x42c133(++_0x215351);}(_0x365e,0x1bc));var _0xe365=function(_0x3996f5,_0x5c8d76){_0x3996f5=_0x3996f5-0x0;var _0x4a7aeb=_0x365e[_0x3996f5];return _0x4a7aeb;};'use strict';var EventEmitter=require(_0xe365('0x0'));var WhatsappQueue=require(_0xe365('0x1'))['db'][_0xe365('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe365('0x3')](0x0);var events={'afterCreate':_0xe365('0x4'),'afterUpdate':_0xe365('0x5'),'afterDestroy':'remove'};function emitEvent(_0x246dd5){return function(_0x129c95,_0x388a7d,_0x1ac435){WhatsappQueueEvents[_0xe365('0x6')](_0x246dd5+':'+_0x129c95['id'],_0x129c95);WhatsappQueueEvents[_0xe365('0x6')](_0x246dd5,_0x129c95);_0x1ac435(null);};}for(var e in events){if(events[_0xe365('0x7')](e)){var event=events[e];WhatsappQueue[_0xe365('0x8')](e,emitEvent(event));}}module[_0xe365('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x205c=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','save'];(function(_0x18c08a,_0x46e340){var _0x388429=function(_0x27d239){while(--_0x27d239){_0x18c08a['push'](_0x18c08a['shift']());}};_0x388429(++_0x46e340);}(_0x205c,0x7e));var _0xc205=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x205c[_0x6cf19c];return _0xce14f3;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xc205('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc205('0x1'),'afterUpdate':_0xc205('0x2'),'afterDestroy':_0xc205('0x3')};function emitEvent(_0x7355a5){return function(_0x2c80de,_0x58ba54,_0x41d662){WhatsappQueueEvents[_0xc205('0x4')](_0x7355a5+':'+_0x2c80de['id'],_0x2c80de);WhatsappQueueEvents[_0xc205('0x4')](_0x7355a5,_0x2c80de);_0x41d662(null);};}for(var e in events){if(events[_0xc205('0x5')](e)){var event=events[e];WhatsappQueue[_0xc205('0x6')](e,emitEvent(event));}}module[_0xc205('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 1996728..9c4d081 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 _0x7f34=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x276067,_0xe95243){var _0x2cbf90=function(_0x4bb231){while(--_0x4bb231){_0x276067['push'](_0x276067['shift']());}};_0x2cbf90(++_0xe95243);}(_0x7f34,0x1a4));var _0x47f3=function(_0x314552,_0x3b82ef){_0x314552=_0x314552-0x0;var _0xb13f7f=_0x7f34[_0x314552];return _0xb13f7f;};'use strict';var _=require(_0x47f3('0x0'));var util=require(_0x47f3('0x1'));var logger=require(_0x47f3('0x2'))(_0x47f3('0x3'));var moment=require(_0x47f3('0x4'));var BPromise=require(_0x47f3('0x5'));var rp=require(_0x47f3('0x6'));var fs=require('fs');var path=require(_0x47f3('0x7'));var rimraf=require(_0x47f3('0x8'));var config=require('../../config/environment');var attributes=require(_0x47f3('0x9'));module[_0x47f3('0xa')]=function(_0x5e5cee,_0x3bafea){return _0x5e5cee[_0x47f3('0xb')](_0x47f3('0xc'),attributes,{'tableName':_0x47f3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e1=['exports','define','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x27d9e4,_0x3ddf3a){var _0x4a60f9=function(_0x6cd9a2){while(--_0x6cd9a2){_0x27d9e4['push'](_0x27d9e4['shift']());}};_0x4a60f9(++_0x3ddf3a);}(_0xe1e1,0xdf));var _0x1e1e=function(_0x145904,_0x279ca6){_0x145904=_0x145904-0x0;var _0x3a68b6=_0xe1e1[_0x145904];return _0x3a68b6;};'use strict';var _=require(_0x1e1e('0x0'));var util=require(_0x1e1e('0x1'));var logger=require(_0x1e1e('0x2'))(_0x1e1e('0x3'));var moment=require(_0x1e1e('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e1e('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x1e1e('0x7')]=function(_0x38bb57,_0x704627){return _0x38bb57[_0x1e1e('0x8')]('WhatsappQueue',attributes,{'tableName':_0x1e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index ccaf827..534a446 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 _0x88d6=['register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','options','raw','where','limit','include','map','attributes','model','GetWhatsappQueue','ShowWhatsappQueue','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket'];(function(_0xa42446,_0x3fd138){var _0x48dbf8=function(_0x214d42){while(--_0x214d42){_0xa42446['push'](_0xa42446['shift']());}};_0x48dbf8(++_0x3fd138);}(_0x88d6,0x103));var _0x688d=function(_0x3a14ba,_0x1b19fe){_0x3a14ba=_0x3a14ba-0x0;var _0x564584=_0x88d6[_0x3a14ba];return _0x564584;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x688d('0x0'));var BPromise=require('bluebird');var rs=require(_0x688d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x688d('0x2'))['db'];var utils=require(_0x688d('0x3'));var logger=require(_0x688d('0x4'))(_0x688d('0x5'));var config=require(_0x688d('0x6'));var jayson=require(_0x688d('0x7'));var client=jayson['client'][_0x688d('0x8')]({'port':0x232a});config['redis']=_[_0x688d('0x9')](config['redis'],{'host':_0x688d('0xa'),'port':0x18eb});var socket=require(_0x688d('0xb'))(new Redis(config[_0x688d('0xc')]));require(_0x688d('0xd'))[_0x688d('0xe')](socket);function respondWithRpcPromise(_0x2689a2,_0x45a72a,_0xf75233){return new BPromise(function(_0x511bae,_0x51c6d3){return client[_0x688d('0xf')](_0x2689a2,_0xf75233)[_0x688d('0x10')](function(_0x2872ff){logger[_0x688d('0x11')](_0x688d('0x12'),_0x45a72a,_0x688d('0x13'));logger[_0x688d('0x14')](_0x688d('0x15'),_0x45a72a,_0x688d('0x13'),JSON[_0x688d('0x16')](_0x2872ff));if(_0x2872ff['error']){if(_0x2872ff[_0x688d('0x17')][_0x688d('0x18')]===0x1f4){logger[_0x688d('0x17')](_0x688d('0x12'),_0x45a72a,_0x2872ff['error']['message']);return _0x51c6d3(_0x2872ff[_0x688d('0x17')]['message']);}logger['error'](_0x688d('0x12'),_0x45a72a,_0x2872ff[_0x688d('0x17')][_0x688d('0x19')]);return _0x511bae(_0x2872ff['error'][_0x688d('0x19')]);}else{logger[_0x688d('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x45a72a,_0x688d('0x13'));_0x511bae(_0x2872ff[_0x688d('0x1a')][_0x688d('0x19')]);}})[_0x688d('0x1b')](function(_0x125178){logger[_0x688d('0x17')](_0x688d('0x12'),_0x45a72a,_0x125178);_0x51c6d3(_0x125178);});});}exports['GetWhatsappQueue']=function(_0x1653d2){var _0x410943=this;return new Promise(function(_0x295f44,_0x242a3c){return db[_0x688d('0x1c')]['findAll']({'raw':_0x1653d2[_0x688d('0x1d')]?_0x1653d2[_0x688d('0x1d')][_0x688d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1653d2['options']?_0x1653d2['options'][_0x688d('0x1f')]||null:null,'attributes':_0x1653d2[_0x688d('0x1d')]?_0x1653d2['options']['attributes']||null:null,'limit':_0x1653d2['options']?_0x1653d2['options'][_0x688d('0x20')]||null:null,'include':_0x1653d2[_0x688d('0x1d')]?_0x1653d2[_0x688d('0x1d')][_0x688d('0x21')]?_[_0x688d('0x22')](_0x1653d2[_0x688d('0x1d')][_0x688d('0x21')],function(_0x467759){return{'model':db[_0x467759['model']],'as':_0x467759['as'],'attributes':_0x467759[_0x688d('0x23')],'include':_0x467759[_0x688d('0x21')]?_[_0x688d('0x22')](_0x467759[_0x688d('0x21')],function(_0x29c8d7){return{'model':db[_0x29c8d7['model']],'as':_0x29c8d7['as'],'attributes':_0x29c8d7['attributes'],'include':_0x29c8d7[_0x688d('0x21')]?_[_0x688d('0x22')](_0x29c8d7['include'],function(_0x23a918){return{'model':db[_0x23a918[_0x688d('0x24')]],'as':_0x23a918['as'],'attributes':_0x23a918[_0x688d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x688d('0x10')](function(_0x466f21){logger[_0x688d('0x11')](_0x688d('0x25'),_0x1653d2);logger[_0x688d('0x14')](_0x688d('0x25'),_0x1653d2,JSON[_0x688d('0x16')](_0x466f21));_0x295f44(_0x466f21);})[_0x688d('0x1b')](function(_0x3337e5){logger[_0x688d('0x17')]('GetWhatsappQueue',_0x3337e5[_0x688d('0x19')],_0x1653d2);_0x242a3c(_0x410943[_0x688d('0x17')](0x1f4,_0x3337e5['message']));});});};exports['ShowWhatsappQueue']=function(_0x43a07a){var _0x3b86a6=this;return new Promise(function(_0x605cd5,_0x41a7f6){return db['WhatsappQueue']['find']({'raw':_0x43a07a['options']?_0x43a07a[_0x688d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x43a07a[_0x688d('0x1d')]?_0x43a07a[_0x688d('0x1d')][_0x688d('0x1f')]||null:null,'attributes':_0x43a07a['options']?_0x43a07a['options']['attributes']||null:null,'include':_0x43a07a['options']?_0x43a07a['options'][_0x688d('0x21')]?_[_0x688d('0x22')](_0x43a07a[_0x688d('0x1d')][_0x688d('0x21')],function(_0x657076){return{'model':db[_0x657076[_0x688d('0x24')]],'as':_0x657076['as'],'attributes':_0x657076[_0x688d('0x23')],'include':_0x657076['include']?_[_0x688d('0x22')](_0x657076[_0x688d('0x21')],function(_0x17a11b){return{'model':db[_0x17a11b[_0x688d('0x24')]],'as':_0x17a11b['as'],'attributes':_0x17a11b[_0x688d('0x23')],'include':_0x17a11b[_0x688d('0x21')]?_[_0x688d('0x22')](_0x17a11b[_0x688d('0x21')],function(_0xf8d151){return{'model':db[_0xf8d151[_0x688d('0x24')]],'as':_0xf8d151['as'],'attributes':_0xf8d151[_0x688d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x688d('0x10')](function(_0x94af47){logger['info'](_0x688d('0x26'),_0x43a07a);logger['debug'](_0x688d('0x26'),_0x43a07a,JSON[_0x688d('0x16')](_0x94af47));_0x605cd5(_0x94af47);})['catch'](function(_0x5c0721){logger[_0x688d('0x17')](_0x688d('0x26'),_0x5c0721['message'],_0x43a07a);_0x41a7f6(_0x3b86a6[_0x688d('0x17')](0x1f4,_0x5c0721[_0x688d('0x19')]));});});}; \ No newline at end of file +var _0xafb0=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','raw','options','limit','include','map','model','attributes','then','debug','find','ShowWhatsappQueue','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x194618,_0x2b8535){var _0x3a6638=function(_0x3853f6){while(--_0x3853f6){_0x194618['push'](_0x194618['shift']());}};_0x3a6638(++_0x2b8535);}(_0xafb0,0x1db));var _0x0afb=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xafb0[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x0afb('0x0'));var util=require('util');var moment=require(_0x0afb('0x1'));var BPromise=require(_0x0afb('0x2'));var rs=require(_0x0afb('0x3'));var fs=require('fs');var Redis=require(_0x0afb('0x4'));var db=require(_0x0afb('0x5'))['db'];var utils=require(_0x0afb('0x6'));var logger=require(_0x0afb('0x7'))(_0x0afb('0x8'));var config=require('../../config/environment');var jayson=require(_0x0afb('0x9'));var client=jayson['client'][_0x0afb('0xa')]({'port':0x232a});config[_0x0afb('0xb')]=_[_0x0afb('0xc')](config[_0x0afb('0xb')],{'host':_0x0afb('0xd'),'port':0x18eb});var socket=require(_0x0afb('0xe'))(new Redis(config[_0x0afb('0xb')]));require(_0x0afb('0xf'))[_0x0afb('0x10')](socket);function respondWithRpcPromise(_0x1c27d4,_0xe162b6,_0x3566cd){return new BPromise(function(_0x4d78f8,_0x24acaa){return client['request'](_0x1c27d4,_0x3566cd)['then'](function(_0x58fb1e){logger[_0x0afb('0x11')](_0x0afb('0x12'),_0xe162b6,_0x0afb('0x13'));logger['debug'](_0x0afb('0x14'),_0xe162b6,_0x0afb('0x13'),JSON[_0x0afb('0x15')](_0x58fb1e));if(_0x58fb1e[_0x0afb('0x16')]){if(_0x58fb1e['error'][_0x0afb('0x17')]===0x1f4){logger[_0x0afb('0x16')](_0x0afb('0x12'),_0xe162b6,_0x58fb1e[_0x0afb('0x16')]['message']);return _0x24acaa(_0x58fb1e[_0x0afb('0x16')][_0x0afb('0x18')]);}logger[_0x0afb('0x16')](_0x0afb('0x12'),_0xe162b6,_0x58fb1e[_0x0afb('0x16')][_0x0afb('0x18')]);return _0x4d78f8(_0x58fb1e[_0x0afb('0x16')][_0x0afb('0x18')]);}else{logger['info'](_0x0afb('0x12'),_0xe162b6,_0x0afb('0x13'));_0x4d78f8(_0x58fb1e['result'][_0x0afb('0x18')]);}})[_0x0afb('0x19')](function(_0x2e538f){logger[_0x0afb('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0xe162b6,_0x2e538f);_0x24acaa(_0x2e538f);});});}exports[_0x0afb('0x1a')]=function(_0x19ada3){var _0x2331db=this;return new Promise(function(_0x44e0c5,_0x3a9593){return db[_0x0afb('0x1b')][_0x0afb('0x1c')]({'raw':_0x19ada3['options']?_0x19ada3['options'][_0x0afb('0x1d')]===undefined?!![]:![]:!![],'where':_0x19ada3[_0x0afb('0x1e')]?_0x19ada3[_0x0afb('0x1e')]['where']||null:null,'attributes':_0x19ada3['options']?_0x19ada3[_0x0afb('0x1e')]['attributes']||null:null,'limit':_0x19ada3['options']?_0x19ada3[_0x0afb('0x1e')][_0x0afb('0x1f')]||null:null,'include':_0x19ada3[_0x0afb('0x1e')]?_0x19ada3[_0x0afb('0x1e')][_0x0afb('0x20')]?_[_0x0afb('0x21')](_0x19ada3[_0x0afb('0x1e')][_0x0afb('0x20')],function(_0x53f633){return{'model':db[_0x53f633[_0x0afb('0x22')]],'as':_0x53f633['as'],'attributes':_0x53f633[_0x0afb('0x23')],'include':_0x53f633['include']?_['map'](_0x53f633[_0x0afb('0x20')],function(_0x20c111){return{'model':db[_0x20c111[_0x0afb('0x22')]],'as':_0x20c111['as'],'attributes':_0x20c111['attributes'],'include':_0x20c111[_0x0afb('0x20')]?_['map'](_0x20c111['include'],function(_0x19b8a5){return{'model':db[_0x19b8a5['model']],'as':_0x19b8a5['as'],'attributes':_0x19b8a5[_0x0afb('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0afb('0x24')](function(_0x40f18f){logger[_0x0afb('0x11')]('GetWhatsappQueue',_0x19ada3);logger[_0x0afb('0x25')]('GetWhatsappQueue',_0x19ada3,JSON[_0x0afb('0x15')](_0x40f18f));_0x44e0c5(_0x40f18f);})[_0x0afb('0x19')](function(_0x445c52){logger[_0x0afb('0x16')](_0x0afb('0x1a'),_0x445c52[_0x0afb('0x18')],_0x19ada3);_0x3a9593(_0x2331db[_0x0afb('0x16')](0x1f4,_0x445c52[_0x0afb('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x3d32e6){var _0x1eca57=this;return new Promise(function(_0x1db3a2,_0x1d8677){return db[_0x0afb('0x1b')][_0x0afb('0x26')]({'raw':_0x3d32e6[_0x0afb('0x1e')]?_0x3d32e6['options'][_0x0afb('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d32e6['options']?_0x3d32e6[_0x0afb('0x1e')]['where']||null:null,'attributes':_0x3d32e6[_0x0afb('0x1e')]?_0x3d32e6[_0x0afb('0x1e')][_0x0afb('0x23')]||null:null,'include':_0x3d32e6[_0x0afb('0x1e')]?_0x3d32e6['options'][_0x0afb('0x20')]?_[_0x0afb('0x21')](_0x3d32e6[_0x0afb('0x1e')][_0x0afb('0x20')],function(_0x136c3e){return{'model':db[_0x136c3e[_0x0afb('0x22')]],'as':_0x136c3e['as'],'attributes':_0x136c3e[_0x0afb('0x23')],'include':_0x136c3e[_0x0afb('0x20')]?_['map'](_0x136c3e['include'],function(_0x5c0fd4){return{'model':db[_0x5c0fd4[_0x0afb('0x22')]],'as':_0x5c0fd4['as'],'attributes':_0x5c0fd4[_0x0afb('0x23')],'include':_0x5c0fd4[_0x0afb('0x20')]?_[_0x0afb('0x21')](_0x5c0fd4['include'],function(_0x3315c8){return{'model':db[_0x3315c8[_0x0afb('0x22')]],'as':_0x3315c8['as'],'attributes':_0x3315c8[_0x0afb('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0afb('0x24')](function(_0x46f169){logger[_0x0afb('0x11')](_0x0afb('0x27'),_0x3d32e6);logger['debug'](_0x0afb('0x27'),_0x3d32e6,JSON[_0x0afb('0x15')](_0x46f169));_0x1db3a2(_0x46f169);})[_0x0afb('0x19')](function(_0x33a549){logger[_0x0afb('0x16')](_0x0afb('0x27'),_0x33a549[_0x0afb('0x18')],_0x3d32e6);_0x1d8677(_0x1eca57[_0x0afb('0x16')](0x1f4,_0x33a549[_0x0afb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 052a584..3c3c58b 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 _0x10ec=['emit','register','length','whatsappQueue:','./whatsappQueue.events','remove','update'];(function(_0xe78493,_0x2428e8){var _0x3fb97b=function(_0x4954d0){while(--_0x4954d0){_0xe78493['push'](_0xe78493['shift']());}};_0x3fb97b(++_0x2428e8);}(_0x10ec,0xe4));var _0xc10e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x10ec[_0xfae23b];return _0x200640;};'use strict';var WhatsappQueueEvents=require(_0xc10e('0x0'));var events=['save',_0xc10e('0x1'),_0xc10e('0x2')];function createListener(_0x337091,_0x940a4a){return function(_0xb889ca){_0x940a4a[_0xc10e('0x3')](_0x337091,_0xb889ca);};}function removeListener(_0x4e118c,_0x234d34){return function(){WhatsappQueueEvents['removeListener'](_0x4e118c,_0x234d34);};}exports[_0xc10e('0x4')]=function(_0xe710b2){for(var _0x63e67d=0x0,_0x1034c1=events[_0xc10e('0x5')];_0x63e67d<_0x1034c1;_0x63e67d++){var _0x55f476=events[_0x63e67d];var _0x395992=createListener(_0xc10e('0x6')+_0x55f476,_0xe710b2);WhatsappQueueEvents['on'](_0x55f476,_0x395992);}}; \ No newline at end of file +var _0xd50e=['register','length','whatsappQueue:','./whatsappQueue.events','save','update','removeListener'];(function(_0x2c68ed,_0x37cfdc){var _0x161061=function(_0x16ed09){while(--_0x16ed09){_0x2c68ed['push'](_0x2c68ed['shift']());}};_0x161061(++_0x37cfdc);}(_0xd50e,0x6c));var _0xed50=function(_0xf741a,_0xf50784){_0xf741a=_0xf741a-0x0;var _0x9240ab=_0xd50e[_0xf741a];return _0x9240ab;};'use strict';var WhatsappQueueEvents=require(_0xed50('0x0'));var events=[_0xed50('0x1'),'remove',_0xed50('0x2')];function createListener(_0x482315,_0x1daaf5){return function(_0x3ee7bb){_0x1daaf5['emit'](_0x482315,_0x3ee7bb);};}function removeListener(_0x4a375f,_0xb0e654){return function(){WhatsappQueueEvents[_0xed50('0x3')](_0x4a375f,_0xb0e654);};}exports[_0xed50('0x4')]=function(_0xed01bf){for(var _0x25c109=0x0,_0x1255f0=events[_0xed50('0x5')];_0x25c109<_0x1255f0;_0x25c109++){var _0x17ed47=events[_0x25c109];var _0x4fe75f=createListener(_0xed50('0x6')+_0x17ed47,_0xed01bf);WhatsappQueueEvents['on'](_0x17ed47,_0x4fe75f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 6a50b53..52f00b2 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 _0x148b=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put'];(function(_0x71bb53,_0x5970da){var _0x46c0bd=function(_0x1716b0){while(--_0x1716b0){_0x71bb53['push'](_0x71bb53['shift']());}};_0x46c0bd(++_0x5970da);}(_0x148b,0x8f));var _0xb148=function(_0x53c8ef,_0x1a95c6){_0x53c8ef=_0x53c8ef-0x0;var _0x16e980=_0x148b[_0x53c8ef];return _0x16e980;};'use strict';var multer=require(_0xb148('0x0'));var util=require(_0xb148('0x1'));var path=require(_0xb148('0x2'));var timeout=require(_0xb148('0x3'));var express=require(_0xb148('0x4'));var router=express['Router']();var fs_extra=require(_0xb148('0x5'));var auth=require(_0xb148('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb148('0x7'));router['get']('/',auth[_0xb148('0x8')](),controller[_0xb148('0x9')]);router[_0xb148('0xa')](_0xb148('0xb'),auth[_0xb148('0x8')](),controller[_0xb148('0xc')]);router[_0xb148('0xa')](_0xb148('0xd'),auth['isAuthenticated'](),controller[_0xb148('0xe')]);router[_0xb148('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb148('0x10')](_0xb148('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xb148('0x11')]('/:id',auth[_0xb148('0x8')](),controller[_0xb148('0x12')]);module[_0xb148('0x13')]=router; \ No newline at end of file +var _0x8a28=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','index','/describe','isAuthenticated','get','/:id','show','post','create','put','delete','destroy'];(function(_0x3a9e62,_0x4934fb){var _0x280fd3=function(_0x337cf9){while(--_0x337cf9){_0x3a9e62['push'](_0x3a9e62['shift']());}};_0x280fd3(++_0x4934fb);}(_0x8a28,0x1cf));var _0x88a2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8a28[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x88a2('0x0'));var path=require(_0x88a2('0x1'));var timeout=require(_0x88a2('0x2'));var express=require('express');var router=express[_0x88a2('0x3')]();var fs_extra=require(_0x88a2('0x4'));var auth=require(_0x88a2('0x5'));var interaction=require(_0x88a2('0x6'));var config=require(_0x88a2('0x7'));var controller=require(_0x88a2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x88a2('0x9')]);router['get'](_0x88a2('0xa'),auth[_0x88a2('0xb')](),controller['describe']);router[_0x88a2('0xc')](_0x88a2('0xd'),auth[_0x88a2('0xb')](),controller[_0x88a2('0xe')]);router[_0x88a2('0xf')]('/',auth['isAuthenticated'](),controller[_0x88a2('0x10')]);router[_0x88a2('0x11')]('/:id',auth[_0x88a2('0xb')](),controller['update']);router[_0x88a2('0x12')](_0x88a2('0xd'),auth['isAuthenticated'](),controller[_0x88a2('0x13')]);module[_0x88a2('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e58c7b4..72d5272 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(_0x262339,_0x910304){var _0x5a984c=function(_0x14b33c){while(--_0x14b33c){_0x262339['push'](_0x262339['shift']());}};_0x5a984c(++_0x910304);}(_0x7a54,0x106));var _0x47a5=function(_0x26ea5a,_0x20e5d1){_0x26ea5a=_0x26ea5a-0x0;var _0x2c2196=_0x7a54[_0x26ea5a];return _0x2c2196;};'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(_0xaa4fb7,_0x44f417){var _0x15215b=function(_0x2fca13){while(--_0x2fca13){_0xaa4fb7['push'](_0xaa4fb7['shift']());}};_0x15215b(++_0x44f417);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 fbe9c20..0618425 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 _0x4cf8=['limit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','merge','find','create','body','params','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0x4cf8[_0x38080e];return _0x4e4c87;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){_0x29e9e1[_0x84cf('0x19')](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x1d220a,_0x44d4bf){return function(_0x3c7eda){if(!_0x3c7eda){_0x1d220a[_0x84cf('0x18')](0x194);}return _0x3c7eda;};}function handleError(_0x401aa4,_0x6797c0){_0x6797c0=_0x6797c0||0x1f4;return function(_0x5179c1){logger[_0x84cf('0x27')](_0x5179c1[_0x84cf('0x28')]);if(_0x5179c1[_0x84cf('0x29')]){delete _0x5179c1[_0x84cf('0x29')];}_0x401aa4['status'](_0x6797c0)[_0x84cf('0x2a')](_0x5179c1);};}exports['index']=function(_0x29455e,_0x4092fd){var _0x43b41b={},_0xc15298={},_0x51adcf={'count':0x0,'rows':[]};var _0x20de4b=_[_0x84cf('0x2b')](db[_0x84cf('0x2c')][_0x84cf('0x2d')],function(_0xb4fc5a){return{'name':_0xb4fc5a[_0x84cf('0x2e')],'type':_0xb4fc5a[_0x84cf('0x2f')][_0x84cf('0x30')]};});_0xc15298[_0x84cf('0x31')]=_['map'](_0x20de4b,'name');_0xc15298[_0x84cf('0x32')]=_[_0x84cf('0x33')](_0x29455e[_0x84cf('0x32')]);_0xc15298[_0x84cf('0x34')]=_[_0x84cf('0x35')](_0xc15298[_0x84cf('0x31')],_0xc15298[_0x84cf('0x32')]);_0x43b41b[_0x84cf('0x36')]=_['intersection'](_0xc15298[_0x84cf('0x31')],qs[_0x84cf('0x37')](_0x29455e['query'][_0x84cf('0x37')]));_0x43b41b['attributes']=_0x43b41b[_0x84cf('0x36')][_0x84cf('0x38')]?_0x43b41b[_0x84cf('0x36')]:_0xc15298[_0x84cf('0x31')];if(!_0x29455e[_0x84cf('0x32')]['hasOwnProperty'](_0x84cf('0x39'))){_0x43b41b['limit']=qs['limit'](_0x29455e[_0x84cf('0x32')][_0x84cf('0x3a')]);_0x43b41b['offset']=qs[_0x84cf('0x1c')](_0x29455e[_0x84cf('0x32')][_0x84cf('0x1c')]);}_0x43b41b[_0x84cf('0x3b')]=qs[_0x84cf('0x3c')](_0x29455e[_0x84cf('0x32')]['sort']);_0x43b41b[_0x84cf('0x3d')]=qs[_0x84cf('0x34')](_[_0x84cf('0x3e')](_0x29455e[_0x84cf('0x32')],_0xc15298[_0x84cf('0x34')]),_0x20de4b);if(_0x29455e[_0x84cf('0x32')]['filter']){_0x43b41b[_0x84cf('0x3d')]=_['merge'](_0x43b41b[_0x84cf('0x3d')],{'$or':_[_0x84cf('0x2b')](_0x20de4b,function(_0x3fa39a){if(_0x3fa39a[_0x84cf('0x2f')]!==_0x84cf('0x3f')){var _0x3897b0={};_0x3897b0[_0x3fa39a[_0x84cf('0x29')]]={'$like':'%'+_0x29455e[_0x84cf('0x32')][_0x84cf('0x40')]+'%'};return _0x3897b0;}})});}_0x43b41b=_['merge']({},_0x43b41b,_0x29455e[_0x84cf('0x41')]);var _0x516928={'where':_0x43b41b[_0x84cf('0x3d')]};return db[_0x84cf('0x2c')]['count'](_0x516928)[_0x84cf('0x25')](function(_0x531410){_0x51adcf[_0x84cf('0x1e')]=_0x531410;if(_0x29455e['query'][_0x84cf('0x42')]){_0x43b41b['include']=[{'all':!![]}];}return db[_0x84cf('0x2c')][_0x84cf('0x43')](_0x43b41b);})['then'](function(_0x847ce9){_0x51adcf[_0x84cf('0x44')]=_0x847ce9;return _0x51adcf;})[_0x84cf('0x25')](respondWithFilteredResult(_0x4092fd,_0x43b41b))['catch'](handleError(_0x4092fd,null));};exports[_0x84cf('0x45')]=function(_0x5f1b8e,_0x1c84e0){var _0x58b539={'raw':!![],'where':{'id':_0x5f1b8e['params']['id']}},_0x56b0e5={};_0x56b0e5[_0x84cf('0x31')]=_[_0x84cf('0x33')](db['WhatsappQueueReport'][_0x84cf('0x2d')]);_0x56b0e5['query']=_[_0x84cf('0x33')](_0x5f1b8e[_0x84cf('0x32')]);_0x56b0e5['filters']=_[_0x84cf('0x35')](_0x56b0e5['model'],_0x56b0e5[_0x84cf('0x32')]);_0x58b539['attributes']=_['intersection'](_0x56b0e5['model'],qs['fields'](_0x5f1b8e['query']['fields']));_0x58b539['attributes']=_0x58b539[_0x84cf('0x36')][_0x84cf('0x38')]?_0x58b539[_0x84cf('0x36')]:_0x56b0e5[_0x84cf('0x31')];if(_0x5f1b8e['query'][_0x84cf('0x42')]){_0x58b539['include']=[{'all':!![]}];}_0x58b539=_[_0x84cf('0x46')]({},_0x58b539,_0x5f1b8e[_0x84cf('0x41')]);return db[_0x84cf('0x2c')][_0x84cf('0x47')](_0x58b539)[_0x84cf('0x25')](handleEntityNotFound(_0x1c84e0,null))[_0x84cf('0x25')](respondWithResult(_0x1c84e0,null))['catch'](handleError(_0x1c84e0,null));};exports[_0x84cf('0x48')]=function(_0x2732bf,_0x4a4cf7){return db[_0x84cf('0x2c')][_0x84cf('0x48')](_0x2732bf[_0x84cf('0x49')],{})['then'](respondWithResult(_0x4a4cf7,0xc9))['catch'](handleError(_0x4a4cf7,null));};exports['update']=function(_0x1cf3f6,_0x104421){if(_0x1cf3f6[_0x84cf('0x49')]['id']){delete _0x1cf3f6[_0x84cf('0x49')]['id'];}return db[_0x84cf('0x2c')][_0x84cf('0x47')]({'where':{'id':_0x1cf3f6['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x104421,null))['then'](saveUpdates(_0x1cf3f6[_0x84cf('0x49')],null))['then'](respondWithResult(_0x104421,null))['catch'](handleError(_0x104421,null));};exports[_0x84cf('0x26')]=function(_0xb1c3a8,_0x426df1){return db['WhatsappQueueReport']['find']({'where':{'id':_0xb1c3a8[_0x84cf('0x4a')]['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x426df1,null))[_0x84cf('0x25')](removeEntity(_0x426df1,null))[_0x84cf('0x4b')](handleError(_0x426df1,null));};exports[_0x84cf('0x4c')]=function(_0x4c2025,_0xcfe28f){return db[_0x84cf('0x2c')]['describe']()[_0x84cf('0x25')](respondWithResult(_0xcfe28f,null))['catch'](handleError(_0xcfe28f,null));}; \ No newline at end of file +var _0xbfcc=['destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','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','status','limit','undefined','offset','count','set','Content-Range','json','reject','then'];(function(_0x258270,_0x2d718c){var _0x4e8d3e=function(_0x59a1a5){while(--_0x59a1a5){_0x258270['push'](_0x258270['shift']());}};_0x4e8d3e(++_0x2d718c);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xbfcc[_0x4b2cc6];return _0x3e0b08;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x51284a,_0x280b78){return function(_0x75bca0){if(!_0x75bca0){_0x51284a['sendStatus'](0x194);}return _0x75bca0;};}function handleError(_0x28bdcf,_0x3b73a3){_0x3b73a3=_0x3b73a3||0x1f4;return function(_0x4ab48e){logger[_0xcbfc('0x23')](_0x4ab48e[_0xcbfc('0x24')]);if(_0x4ab48e[_0xcbfc('0x25')]){delete _0x4ab48e[_0xcbfc('0x25')];}_0x28bdcf['status'](_0x3b73a3)[_0xcbfc('0x26')](_0x4ab48e);};}exports[_0xcbfc('0x27')]=function(_0x4f632a,_0x1f6a14){var _0x26463f={},_0x7cbdfa={},_0x388d41={'count':0x0,'rows':[]};var _0x2b4286=_[_0xcbfc('0x28')](db[_0xcbfc('0x29')]['rawAttributes'],function(_0x41b68b){return{'name':_0x41b68b[_0xcbfc('0x2a')],'type':_0x41b68b[_0xcbfc('0x2b')][_0xcbfc('0x2c')]};});_0x7cbdfa['model']=_[_0xcbfc('0x28')](_0x2b4286,_0xcbfc('0x25'));_0x7cbdfa[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x4f632a[_0xcbfc('0x2d')]);_0x7cbdfa[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x7cbdfa['model'],_0x7cbdfa[_0xcbfc('0x2d')]);_0x26463f[_0xcbfc('0x31')]=_['intersection'](_0x7cbdfa[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x4f632a[_0xcbfc('0x2d')]['fields']));_0x26463f['attributes']=_0x26463f['attributes'][_0xcbfc('0x34')]?_0x26463f[_0xcbfc('0x31')]:_0x7cbdfa[_0xcbfc('0x32')];if(!_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x35')](_0xcbfc('0x36'))){_0x26463f[_0xcbfc('0x19')]=qs[_0xcbfc('0x19')](_0x4f632a['query'][_0xcbfc('0x19')]);_0x26463f[_0xcbfc('0x1b')]=qs['offset'](_0x4f632a[_0xcbfc('0x2d')]['offset']);}_0x26463f[_0xcbfc('0x37')]=qs[_0xcbfc('0x38')](_0x4f632a[_0xcbfc('0x2d')]['sort']);_0x26463f[_0xcbfc('0x39')]=qs['filters'](_['pick'](_0x4f632a[_0xcbfc('0x2d')],_0x7cbdfa[_0xcbfc('0x2f')]),_0x2b4286);if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]){_0x26463f[_0xcbfc('0x39')]=_[_0xcbfc('0x3b')](_0x26463f[_0xcbfc('0x39')],{'$or':_[_0xcbfc('0x28')](_0x2b4286,function(_0x5cf4fa){if(_0x5cf4fa[_0xcbfc('0x2b')]!=='VIRTUAL'){var _0x15a5c4={};_0x15a5c4[_0x5cf4fa[_0xcbfc('0x25')]]={'$like':'%'+_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]+'%'};return _0x15a5c4;}})});}_0x26463f=_['merge']({},_0x26463f,_0x4f632a['options']);var _0x236b66={'where':_0x26463f[_0xcbfc('0x39')]};return db[_0xcbfc('0x29')][_0xcbfc('0x1c')](_0x236b66)[_0xcbfc('0x21')](function(_0x4aa189){_0x388d41[_0xcbfc('0x1c')]=_0x4aa189;if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x26463f['include']=[{'all':!![]}];}return db[_0xcbfc('0x29')][_0xcbfc('0x3d')](_0x26463f);})[_0xcbfc('0x21')](function(_0x4ca55c){_0x388d41[_0xcbfc('0x3e')]=_0x4ca55c;return _0x388d41;})[_0xcbfc('0x21')](respondWithFilteredResult(_0x1f6a14,_0x26463f))[_0xcbfc('0x3f')](handleError(_0x1f6a14,null));};exports[_0xcbfc('0x40')]=function(_0x102f4f,_0x28447a){var _0x1e14bb={'raw':!![],'where':{'id':_0x102f4f[_0xcbfc('0x41')]['id']}},_0x561544={};_0x561544[_0xcbfc('0x32')]=_['keys'](db[_0xcbfc('0x29')][_0xcbfc('0x42')]);_0x561544[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x102f4f[_0xcbfc('0x2d')]);_0x561544[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],_0x561544['query']);_0x1e14bb[_0xcbfc('0x31')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x33')]));_0x1e14bb[_0xcbfc('0x31')]=_0x1e14bb['attributes'][_0xcbfc('0x34')]?_0x1e14bb[_0xcbfc('0x31')]:_0x561544['model'];if(_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x1e14bb[_0xcbfc('0x43')]=[{'all':!![]}];}_0x1e14bb=_['merge']({},_0x1e14bb,_0x102f4f[_0xcbfc('0x44')]);return db[_0xcbfc('0x29')][_0xcbfc('0x45')](_0x1e14bb)[_0xcbfc('0x21')](handleEntityNotFound(_0x28447a,null))[_0xcbfc('0x21')](respondWithResult(_0x28447a,null))[_0xcbfc('0x3f')](handleError(_0x28447a,null));};exports[_0xcbfc('0x46')]=function(_0x55fc0b,_0x5a87b6){return db[_0xcbfc('0x29')][_0xcbfc('0x46')](_0x55fc0b[_0xcbfc('0x47')],{})[_0xcbfc('0x21')](respondWithResult(_0x5a87b6,0xc9))['catch'](handleError(_0x5a87b6,null));};exports['update']=function(_0x2e89bf,_0xe5c5ef){if(_0x2e89bf[_0xcbfc('0x47')]['id']){delete _0x2e89bf['body']['id'];}return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0x2e89bf[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0xe5c5ef,null))[_0xcbfc('0x21')](saveUpdates(_0x2e89bf[_0xcbfc('0x47')],null))[_0xcbfc('0x21')](respondWithResult(_0xe5c5ef,null))[_0xcbfc('0x3f')](handleError(_0xe5c5ef,null));};exports[_0xcbfc('0x22')]=function(_0xd9976d,_0x222b58){return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0xd9976d[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0x222b58,null))[_0xcbfc('0x21')](removeEntity(_0x222b58,null))[_0xcbfc('0x3f')](handleError(_0x222b58,null));};exports[_0xcbfc('0x48')]=function(_0x5c2ad9,_0x28ae7f){return db[_0xcbfc('0x29')]['describe']()[_0xcbfc('0x21')](respondWithResult(_0x28ae7f,null))[_0xcbfc('0x3f')](handleError(_0x28ae7f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 2886caa..3392009 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 _0x8e75=['api','moment','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger'];(function(_0x1bcb32,_0x284fac){var _0x387d2e=function(_0x9ab44f){while(--_0x9ab44f){_0x1bcb32['push'](_0x1bcb32['shift']());}};_0x387d2e(++_0x284fac);}(_0x8e75,0x8d));var _0x58e7=function(_0x58226c,_0x3333d9){_0x58226c=_0x58226c-0x0;var _0x545de4=_0x8e75[_0x58226c];return _0x545de4;};'use strict';var _=require(_0x58e7('0x0'));var util=require(_0x58e7('0x1'));var logger=require(_0x58e7('0x2'))(_0x58e7('0x3'));var moment=require(_0x58e7('0x4'));var BPromise=require('bluebird');var rp=require(_0x58e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58e7('0x6'));var config=require(_0x58e7('0x7'));var attributes=require(_0x58e7('0x8'));module[_0x58e7('0x9')]=function(_0x13bc81,_0x1b383f){return _0x13bc81[_0x58e7('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x58e7('0xb'),'fields':[_0x58e7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3eb0=['define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0x3eb0,0x11b));var _0x03eb=function(_0x32f2d0,_0x2a3bc5){_0x32f2d0=_0x32f2d0-0x0;var _0x6354fe=_0x3eb0[_0x32f2d0];return _0x6354fe;};'use strict';var _=require(_0x03eb('0x0'));var util=require(_0x03eb('0x1'));var logger=require(_0x03eb('0x2'))(_0x03eb('0x3'));var moment=require(_0x03eb('0x4'));var BPromise=require(_0x03eb('0x5'));var rp=require(_0x03eb('0x6'));var fs=require('fs');var path=require(_0x03eb('0x7'));var rimraf=require(_0x03eb('0x8'));var config=require(_0x03eb('0x9'));var attributes=require(_0x03eb('0xa'));module['exports']=function(_0x8140ab,_0x57ea6e){return _0x8140ab[_0x03eb('0xb')](_0x03eb('0xc'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x03eb('0xd'),'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 1b75bb2..119e0ac 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 _0x4513=['stringify','UpdateWhatsappQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw'];(function(_0x3a2c88,_0x26226c){var _0x2bffe2=function(_0x221144){while(--_0x221144){_0x3a2c88['push'](_0x3a2c88['shift']());}};_0x2bffe2(++_0x26226c);}(_0x4513,0x19e));var _0x3451=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4513[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3451('0x0'));var util=require(_0x3451('0x1'));var moment=require(_0x3451('0x2'));var BPromise=require(_0x3451('0x3'));var rs=require(_0x3451('0x4'));var fs=require('fs');var Redis=require(_0x3451('0x5'));var db=require(_0x3451('0x6'))['db'];var utils=require(_0x3451('0x7'));var logger=require(_0x3451('0x8'))(_0x3451('0x9'));var config=require(_0x3451('0xa'));var jayson=require(_0x3451('0xb'));var client=jayson[_0x3451('0xc')][_0x3451('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5ab0bf,_0x4b97a8,_0x44ea7b){return new BPromise(function(_0x1cbe14,_0x110728){return client['request'](_0x5ab0bf,_0x44ea7b)[_0x3451('0xe')](function(_0x29adad){logger[_0x3451('0xf')](_0x3451('0x10'),_0x4b97a8,'request\x20sent');logger[_0x3451('0x11')](_0x3451('0x12'),_0x4b97a8,_0x3451('0x13'),JSON['stringify'](_0x29adad));if(_0x29adad[_0x3451('0x14')]){if(_0x29adad[_0x3451('0x14')]['code']===0x1f4){logger[_0x3451('0x14')](_0x3451('0x10'),_0x4b97a8,_0x29adad['error']['message']);return _0x110728(_0x29adad[_0x3451('0x14')][_0x3451('0x15')]);}logger[_0x3451('0x14')](_0x3451('0x10'),_0x4b97a8,_0x29adad[_0x3451('0x14')][_0x3451('0x15')]);return _0x1cbe14(_0x29adad[_0x3451('0x14')][_0x3451('0x15')]);}else{logger['info'](_0x3451('0x10'),_0x4b97a8,_0x3451('0x13'));_0x1cbe14(_0x29adad[_0x3451('0x16')]['message']);}})[_0x3451('0x17')](function(_0x461c65){logger[_0x3451('0x14')](_0x3451('0x10'),_0x4b97a8,_0x461c65);_0x110728(_0x461c65);});});}exports[_0x3451('0x18')]=function(_0x41ab26){var _0x5d93fa=this;return new Promise(function(_0x1f26c0,_0x268bfc){return db[_0x3451('0x19')]['create'](_0x41ab26['body'],{'raw':_0x41ab26[_0x3451('0x1a')]?_0x41ab26[_0x3451('0x1a')][_0x3451('0x1b')]===undefined?!![]:![]:!![]})[_0x3451('0xe')](function(_0x1a9e13){logger[_0x3451('0xf')]('CreateWhatsappQueueReport',_0x41ab26);logger[_0x3451('0x11')](_0x3451('0x18'),_0x41ab26,JSON[_0x3451('0x1c')](_0x1a9e13));_0x1f26c0(_0x1a9e13);})[_0x3451('0x17')](function(_0x332a16){logger['error'](_0x3451('0x18'),_0x332a16['message'],_0x41ab26);_0x268bfc(_0x5d93fa[_0x3451('0x14')](0x1f4,_0x332a16[_0x3451('0x15')]));});});};exports[_0x3451('0x1d')]=function(_0x4c7431){var _0x570fb0=this;return new Promise(function(_0x15cae9,_0x3928d6){return db[_0x3451('0x19')][_0x3451('0x1e')](_0x4c7431[_0x3451('0x1f')],{'raw':_0x4c7431[_0x3451('0x1a')]?_0x4c7431[_0x3451('0x1a')][_0x3451('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c7431[_0x3451('0x1a')]?_0x4c7431[_0x3451('0x1a')]['where']||null:null,'attributes':_0x4c7431['options']?_0x4c7431['options'][_0x3451('0x20')]||null:null,'limit':_0x4c7431[_0x3451('0x1a')]?_0x4c7431[_0x3451('0x1a')][_0x3451('0x21')]||null:null})[_0x3451('0xe')](function(_0x16d4fa){logger[_0x3451('0xf')](_0x3451('0x1d'),_0x4c7431);logger['debug'](_0x3451('0x1d'),_0x4c7431,JSON[_0x3451('0x1c')](_0x16d4fa));_0x15cae9(_0x16d4fa);})['catch'](function(_0x41a050){logger[_0x3451('0x14')](_0x3451('0x1d'),_0x41a050['message'],_0x4c7431);_0x3928d6(_0x570fb0['error'](0x1f4,_0x41a050[_0x3451('0x15')]));});});}; \ No newline at end of file +var _0x16b5=['then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','debug','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2ed1bf,_0x3d8d02){var _0xe0d8df=function(_0x333048){while(--_0x333048){_0x2ed1bf['push'](_0x2ed1bf['shift']());}};_0xe0d8df(++_0x3d8d02);}(_0x16b5,0x1c4));var _0x516b=function(_0x175cf5,_0x34d222){_0x175cf5=_0x175cf5-0x0;var _0x5d9155=_0x16b5[_0x175cf5];return _0x5d9155;};'use strict';var _=require('lodash');var util=require(_0x516b('0x0'));var moment=require(_0x516b('0x1'));var BPromise=require(_0x516b('0x2'));var rs=require(_0x516b('0x3'));var fs=require('fs');var Redis=require(_0x516b('0x4'));var db=require(_0x516b('0x5'))['db'];var utils=require(_0x516b('0x6'));var logger=require('../../config/logger')(_0x516b('0x7'));var config=require(_0x516b('0x8'));var jayson=require(_0x516b('0x9'));var client=jayson[_0x516b('0xa')][_0x516b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38607e,_0x31de98,_0x485f16){return new BPromise(function(_0x1b10cf,_0x64486c){return client[_0x516b('0xc')](_0x38607e,_0x485f16)[_0x516b('0xd')](function(_0x6e48b0){logger[_0x516b('0xe')](_0x516b('0xf'),_0x31de98,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x31de98,_0x516b('0x10'),JSON[_0x516b('0x11')](_0x6e48b0));if(_0x6e48b0[_0x516b('0x12')]){if(_0x6e48b0['error'][_0x516b('0x13')]===0x1f4){logger[_0x516b('0x12')](_0x516b('0xf'),_0x31de98,_0x6e48b0[_0x516b('0x12')][_0x516b('0x14')]);return _0x64486c(_0x6e48b0['error'][_0x516b('0x14')]);}logger[_0x516b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x31de98,_0x6e48b0[_0x516b('0x12')][_0x516b('0x14')]);return _0x1b10cf(_0x6e48b0[_0x516b('0x12')]['message']);}else{logger[_0x516b('0xe')](_0x516b('0xf'),_0x31de98,_0x516b('0x10'));_0x1b10cf(_0x6e48b0[_0x516b('0x15')][_0x516b('0x14')]);}})[_0x516b('0x16')](function(_0x5c48ab){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x31de98,_0x5c48ab);_0x64486c(_0x5c48ab);});});}exports['CreateWhatsappQueueReport']=function(_0x36fae9){var _0x379746=this;return new Promise(function(_0x443804,_0x16e28c){return db['WhatsappQueueReport'][_0x516b('0x17')](_0x36fae9[_0x516b('0x18')],{'raw':_0x36fae9[_0x516b('0x19')]?_0x36fae9[_0x516b('0x19')][_0x516b('0x1a')]===undefined?!![]:![]:!![]})[_0x516b('0xd')](function(_0x318933){logger[_0x516b('0xe')]('CreateWhatsappQueueReport',_0x36fae9);logger[_0x516b('0x1b')](_0x516b('0x1c'),_0x36fae9,JSON[_0x516b('0x11')](_0x318933));_0x443804(_0x318933);})['catch'](function(_0x18df22){logger[_0x516b('0x12')](_0x516b('0x1c'),_0x18df22[_0x516b('0x14')],_0x36fae9);_0x16e28c(_0x379746[_0x516b('0x12')](0x1f4,_0x18df22[_0x516b('0x14')]));});});};exports[_0x516b('0x1d')]=function(_0x2a38d2){var _0xa26a71=this;return new Promise(function(_0x4b4fd6,_0x97d9bf){return db['WhatsappQueueReport'][_0x516b('0x1e')](_0x2a38d2[_0x516b('0x18')],{'raw':_0x2a38d2[_0x516b('0x19')]?_0x2a38d2[_0x516b('0x19')][_0x516b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a38d2[_0x516b('0x19')]?_0x2a38d2[_0x516b('0x19')]['where']||null:null,'attributes':_0x2a38d2['options']?_0x2a38d2['options']['attributes']||null:null,'limit':_0x2a38d2[_0x516b('0x19')]?_0x2a38d2['options']['limit']||null:null})[_0x516b('0xd')](function(_0x5c256e){logger[_0x516b('0xe')](_0x516b('0x1d'),_0x2a38d2);logger[_0x516b('0x1b')]('UpdateWhatsappQueueReport',_0x2a38d2,JSON['stringify'](_0x5c256e));_0x4b4fd6(_0x5c256e);})[_0x516b('0x16')](function(_0x37f74c){logger[_0x516b('0x12')]('UpdateWhatsappQueueReport',_0x37f74c[_0x516b('0x14')],_0x2a38d2);_0x97d9bf(_0xa26a71[_0x516b('0x12')](0x1f4,_0x37f74c[_0x516b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8c31a1d..b1ebf39 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 _0x809c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','exports','multer','util','path'];(function(_0x4001c7,_0xfe9f11){var _0x555a8b=function(_0xec1f67){while(--_0xec1f67){_0x4001c7['push'](_0x4001c7['shift']());}};_0x555a8b(++_0xfe9f11);}(_0x809c,0x1ad));var _0xc809=function(_0x4f68a9,_0x1b2cb1){_0x4f68a9=_0x4f68a9-0x0;var _0x266722=_0x809c[_0x4f68a9];return _0x266722;};'use strict';var multer=require(_0xc809('0x0'));var util=require(_0xc809('0x1'));var path=require(_0xc809('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc809('0x3')]();var fs_extra=require(_0xc809('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc809('0x5'));var config=require(_0xc809('0x6'));var controller=require(_0xc809('0x7'));router[_0xc809('0x8')]('/',auth['isAuthenticated'](),controller[_0xc809('0x9')]);router['get'](_0xc809('0xa'),auth[_0xc809('0xb')](),controller[_0xc809('0xc')]);router[_0xc809('0x8')](_0xc809('0xd'),auth[_0xc809('0xb')](),controller[_0xc809('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc809('0xd'),auth[_0xc809('0xb')](),controller[_0xc809('0xf')]);router[_0xc809('0x10')](_0xc809('0xd'),auth[_0xc809('0xb')](),controller['destroy']);module[_0xc809('0x11')]=router; \ No newline at end of file +var _0x82c7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','express'];(function(_0x3ef999,_0x377005){var _0x156517=function(_0x5eb8dc){while(--_0x5eb8dc){_0x3ef999['push'](_0x3ef999['shift']());}};_0x156517(++_0x377005);}(_0x82c7,0x6f));var _0x782c=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x82c7[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x782c('0x0'));var util=require(_0x782c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x782c('0x2'));var router=express['Router']();var fs_extra=require(_0x782c('0x3'));var auth=require(_0x782c('0x4'));var interaction=require(_0x782c('0x5'));var config=require(_0x782c('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x782c('0x7')]('/',auth[_0x782c('0x8')](),controller[_0x782c('0x9')]);router['get'](_0x782c('0xa'),auth[_0x782c('0x8')](),controller['describe']);router[_0x782c('0x7')]('/:id',auth[_0x782c('0x8')](),controller[_0x782c('0xb')]);router['post']('/',auth[_0x782c('0x8')](),controller[_0x782c('0xc')]);router[_0x782c('0xd')](_0x782c('0xe'),auth[_0x782c('0x8')](),controller[_0x782c('0xf')]);router[_0x782c('0x10')](_0x782c('0xe'),auth['isAuthenticated'](),controller[_0x782c('0x11')]);module[_0x782c('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index fa815d6..731dc98 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 _0x723c=['STRING','account','queue','DATE','exports'];(function(_0x134a39,_0x43e765){var _0x1464e9=function(_0x5ce7a3){while(--_0x5ce7a3){_0x134a39['push'](_0x134a39['shift']());}};_0x1464e9(++_0x43e765);}(_0x723c,0x1ad));var _0xc723=function(_0x2d034b,_0xa50b7c){_0x2d034b=_0x2d034b-0x0;var _0x19caee=_0x723c[_0x2d034b];return _0x19caee;};'use strict';var Sequelize=require('sequelize');module[_0xc723('0x0')]={'uniqueid':{'type':Sequelize[_0xc723('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc723('0x2'),'agent',_0xc723('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc723('0x4')]}}; \ No newline at end of file +var _0x153c=['sequelize','exports','STRING','ENUM','agent','queue','DATE'];(function(_0x7e7876,_0x2e3181){var _0x1273f5=function(_0xcf4505){while(--_0xcf4505){_0x7e7876['push'](_0x7e7876['shift']());}};_0x1273f5(++_0x2e3181);}(_0x153c,0x8c));var _0xc153=function(_0x1692ee,_0x416db8){_0x1692ee=_0x1692ee-0x0;var _0x134915=_0x153c[_0x1692ee];return _0x134915;};'use strict';var Sequelize=require(_0xc153('0x0'));module[_0xc153('0x1')]={'uniqueid':{'type':Sequelize[_0xc153('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc153('0x3')]('account',_0xc153('0x4'),_0xc153('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc153('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 30c667c..f3cc680 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 _0x9dde=['../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','end','sendStatus','error','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x10b34d,_0xf07181){var _0x14bf67=function(_0x45178d){while(--_0x45178d){_0x10b34d['push'](_0x10b34d['shift']());}};_0x14bf67(++_0xf07181);}(_0x9dde,0x1e2));var _0xe9dd=function(_0x421ff1,_0x453e00){_0x421ff1=_0x421ff1-0x0;var _0x35ef3b=_0x9dde[_0x421ff1];return _0x35ef3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9dd('0x0'));var zipdir=require(_0xe9dd('0x1'));var jsonpatch=require(_0xe9dd('0x2'));var rp=require(_0xe9dd('0x3'));var moment=require(_0xe9dd('0x4'));var BPromise=require(_0xe9dd('0x5'));var Mustache=require('mustache');var util=require(_0xe9dd('0x6'));var path=require('path');var sox=require(_0xe9dd('0x7'));var csv=require(_0xe9dd('0x8'));var ejs=require(_0xe9dd('0x9'));var fs=require('fs');var fs_extra=require(_0xe9dd('0xa'));var _=require(_0xe9dd('0xb'));var squel=require(_0xe9dd('0xc'));var crypto=require(_0xe9dd('0xd'));var jsforce=require(_0xe9dd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe9dd('0x8'));var querystring=require('querystring');var Papa=require(_0xe9dd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe9dd('0x10'));var as=require(_0xe9dd('0x11'));var hardwareService=require(_0xe9dd('0x12'));var logger=require(_0xe9dd('0x13'))(_0xe9dd('0x14'));var utils=require(_0xe9dd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe9dd('0x16'))['db'];function respondWithStatusCode(_0x7461b2,_0x37497b){_0x37497b=_0x37497b||0xcc;return function(_0x5932c1){if(_0x5932c1){return _0x7461b2['sendStatus'](_0x37497b);}return _0x7461b2[_0xe9dd('0x17')](_0x37497b)['end']();};}function respondWithResult(_0x37e478,_0xe5bac2){_0xe5bac2=_0xe5bac2||0xc8;return function(_0x14ebec){if(_0x14ebec){return _0x37e478[_0xe9dd('0x17')](_0xe5bac2)[_0xe9dd('0x18')](_0x14ebec);}};}function respondWithFilteredResult(_0x1e5eaa,_0x6586ba){return function(_0x9b5bf){if(_0x9b5bf){var _0x13038c=typeof _0x6586ba[_0xe9dd('0x19')]===_0xe9dd('0x1a')&&typeof _0x6586ba[_0xe9dd('0x1b')]===_0xe9dd('0x1a');var _0x45b943=_0x9b5bf[_0xe9dd('0x1c')];var _0x57cc59=_0x13038c?0x0:_0x6586ba[_0xe9dd('0x19')];var _0x20ed8d=_0x13038c?_0x9b5bf[_0xe9dd('0x1c')]:_0x6586ba[_0xe9dd('0x19')]+_0x6586ba[_0xe9dd('0x1b')];var _0x2423e4;if(_0x20ed8d>=_0x45b943){_0x20ed8d=_0x45b943;_0x2423e4=0xc8;}else{_0x2423e4=0xce;}_0x1e5eaa[_0xe9dd('0x17')](_0x2423e4);return _0x1e5eaa['set'](_0xe9dd('0x1d'),_0x57cc59+'-'+_0x20ed8d+'/'+_0x45b943)['json'](_0x9b5bf);}return null;};}function patchUpdates(_0x26a787){return function(_0x5a7bda){try{jsonpatch['apply'](_0x5a7bda,_0x26a787,!![]);}catch(_0x38b087){return BPromise['reject'](_0x38b087);}return _0x5a7bda[_0xe9dd('0x1e')]();};}function saveUpdates(_0x1c14fb,_0xf813b){return function(_0x3a41fe){if(_0x3a41fe){return _0x3a41fe[_0xe9dd('0x1f')](_0x1c14fb)['then'](function(_0x5e399c){return _0x5e399c;});}return null;};}function removeEntity(_0x4f9da8,_0x434818){return function(_0xec67ad){if(_0xec67ad){return _0xec67ad[_0xe9dd('0x20')]()[_0xe9dd('0x21')](function(){_0x4f9da8['status'](0xcc)[_0xe9dd('0x22')]();});}};}function handleEntityNotFound(_0x497eb9,_0x3ff8fb){return function(_0x16e654){if(!_0x16e654){_0x497eb9[_0xe9dd('0x23')](0x194);}return _0x16e654;};}function handleError(_0x431527,_0x10c99d){_0x10c99d=_0x10c99d||0x1f4;return function(_0x2f5f59){logger[_0xe9dd('0x24')](_0x2f5f59['stack']);if(_0x2f5f59[_0xe9dd('0x25')]){delete _0x2f5f59[_0xe9dd('0x25')];}_0x431527['status'](_0x10c99d)[_0xe9dd('0x26')](_0x2f5f59);};}exports['index']=function(_0x1b04bb,_0x1ec997){var _0x44425b={},_0x2e0a34={},_0x409567={'count':0x0,'rows':[]};var _0x3d307a=_[_0xe9dd('0x27')](db[_0xe9dd('0x28')][_0xe9dd('0x29')],function(_0x32fc80){return{'name':_0x32fc80[_0xe9dd('0x2a')],'type':_0x32fc80[_0xe9dd('0x2b')][_0xe9dd('0x2c')]};});_0x2e0a34[_0xe9dd('0x2d')]=_[_0xe9dd('0x27')](_0x3d307a,_0xe9dd('0x25'));_0x2e0a34[_0xe9dd('0x2e')]=_[_0xe9dd('0x2f')](_0x1b04bb[_0xe9dd('0x2e')]);_0x2e0a34[_0xe9dd('0x30')]=_[_0xe9dd('0x31')](_0x2e0a34[_0xe9dd('0x2d')],_0x2e0a34['query']);_0x44425b[_0xe9dd('0x32')]=_[_0xe9dd('0x31')](_0x2e0a34['model'],qs[_0xe9dd('0x33')](_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x33')]));_0x44425b[_0xe9dd('0x32')]=_0x44425b['attributes'][_0xe9dd('0x34')]?_0x44425b[_0xe9dd('0x32')]:_0x2e0a34[_0xe9dd('0x2d')];if(!_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x35')](_0xe9dd('0x36'))){_0x44425b['limit']=qs[_0xe9dd('0x1b')](_0x1b04bb[_0xe9dd('0x2e')]['limit']);_0x44425b['offset']=qs['offset'](_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x19')]);}_0x44425b[_0xe9dd('0x37')]=qs['sort'](_0x1b04bb[_0xe9dd('0x2e')]['sort']);_0x44425b[_0xe9dd('0x38')]=qs[_0xe9dd('0x30')](_[_0xe9dd('0x39')](_0x1b04bb['query'],_0x2e0a34[_0xe9dd('0x30')]),_0x3d307a);if(_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x3a')]){_0x44425b[_0xe9dd('0x38')]=_[_0xe9dd('0x3b')](_0x44425b['where'],{'$or':_[_0xe9dd('0x27')](_0x3d307a,function(_0x2c9987){if(_0x2c9987[_0xe9dd('0x2b')]!==_0xe9dd('0x3c')){var _0x1b3305={};_0x1b3305[_0x2c9987[_0xe9dd('0x25')]]={'$like':'%'+_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x3a')]+'%'};return _0x1b3305;}})});}_0x44425b=_[_0xe9dd('0x3b')]({},_0x44425b,_0x1b04bb[_0xe9dd('0x3d')]);var _0x25adde={'where':_0x44425b[_0xe9dd('0x38')]};return db[_0xe9dd('0x28')][_0xe9dd('0x1c')](_0x25adde)[_0xe9dd('0x21')](function(_0x4435d1){_0x409567[_0xe9dd('0x1c')]=_0x4435d1;if(_0x1b04bb[_0xe9dd('0x2e')][_0xe9dd('0x3e')]){_0x44425b[_0xe9dd('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xe9dd('0x40')](_0x44425b);})[_0xe9dd('0x21')](function(_0x5dc27b){_0x409567[_0xe9dd('0x41')]=_0x5dc27b;return _0x409567;})[_0xe9dd('0x21')](respondWithFilteredResult(_0x1ec997,_0x44425b))[_0xe9dd('0x42')](handleError(_0x1ec997,null));};exports[_0xe9dd('0x43')]=function(_0x51bc9c,_0x37240d){var _0x36be8b={'raw':!![],'where':{'id':_0x51bc9c[_0xe9dd('0x44')]['id']}},_0x5c09ce={};_0x5c09ce[_0xe9dd('0x2d')]=_[_0xe9dd('0x2f')](db[_0xe9dd('0x28')]['rawAttributes']);_0x5c09ce[_0xe9dd('0x2e')]=_['keys'](_0x51bc9c[_0xe9dd('0x2e')]);_0x5c09ce[_0xe9dd('0x30')]=_[_0xe9dd('0x31')](_0x5c09ce['model'],_0x5c09ce[_0xe9dd('0x2e')]);_0x36be8b[_0xe9dd('0x32')]=_['intersection'](_0x5c09ce[_0xe9dd('0x2d')],qs[_0xe9dd('0x33')](_0x51bc9c[_0xe9dd('0x2e')]['fields']));_0x36be8b[_0xe9dd('0x32')]=_0x36be8b[_0xe9dd('0x32')][_0xe9dd('0x34')]?_0x36be8b['attributes']:_0x5c09ce['model'];if(_0x51bc9c[_0xe9dd('0x2e')][_0xe9dd('0x3e')]){_0x36be8b[_0xe9dd('0x3f')]=[{'all':!![]}];}_0x36be8b=_[_0xe9dd('0x3b')]({},_0x36be8b,_0x51bc9c[_0xe9dd('0x3d')]);return db[_0xe9dd('0x28')][_0xe9dd('0x45')](_0x36be8b)['then'](handleEntityNotFound(_0x37240d,null))[_0xe9dd('0x21')](respondWithResult(_0x37240d,null))['catch'](handleError(_0x37240d,null));};exports['create']=function(_0x14f50f,_0x105c4f){return db[_0xe9dd('0x28')]['create'](_0x14f50f[_0xe9dd('0x46')],{})['then'](respondWithResult(_0x105c4f,0xc9))[_0xe9dd('0x42')](handleError(_0x105c4f,null));};exports[_0xe9dd('0x1f')]=function(_0x10bf42,_0x30ee87){if(_0x10bf42[_0xe9dd('0x46')]['id']){delete _0x10bf42['body']['id'];}return db[_0xe9dd('0x28')][_0xe9dd('0x45')]({'where':{'id':_0x10bf42['params']['id']}})[_0xe9dd('0x21')](handleEntityNotFound(_0x30ee87,null))[_0xe9dd('0x21')](saveUpdates(_0x10bf42[_0xe9dd('0x46')],null))[_0xe9dd('0x21')](respondWithResult(_0x30ee87,null))['catch'](handleError(_0x30ee87,null));};exports[_0xe9dd('0x20')]=function(_0x5f4619,_0x42c551){return db[_0xe9dd('0x28')][_0xe9dd('0x45')]({'where':{'id':_0x5f4619['params']['id']}})[_0xe9dd('0x21')](handleEntityNotFound(_0x42c551,null))['then'](removeEntity(_0x42c551,null))[_0xe9dd('0x42')](handleError(_0x42c551,null));};exports['describe']=function(_0x1d9075,_0x517d66){return db[_0xe9dd('0x28')][_0xe9dd('0x47')]()['then'](respondWithResult(_0x517d66,null))[_0xe9dd('0x42')](handleError(_0x517d66,null));}; \ No newline at end of file +var _0x66d8=['undefined','limit','count','offset','set','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','filters','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','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'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x66d8,0x1c1));var _0x866d=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x66d8[_0x3cc9d9];return _0x1a425d;};'use strict';var emlformat=require(_0x866d('0x0'));var rimraf=require(_0x866d('0x1'));var zipdir=require(_0x866d('0x2'));var jsonpatch=require(_0x866d('0x3'));var rp=require(_0x866d('0x4'));var moment=require(_0x866d('0x5'));var BPromise=require(_0x866d('0x6'));var Mustache=require('mustache');var util=require(_0x866d('0x7'));var path=require(_0x866d('0x8'));var sox=require(_0x866d('0x9'));var csv=require('to-csv');var ejs=require(_0x866d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x866d('0xb'));var squel=require(_0x866d('0xc'));var crypto=require(_0x866d('0xd'));var jsforce=require(_0x866d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x866d('0xf'));var querystring=require(_0x866d('0x10'));var Papa=require(_0x866d('0x11'));var Redis=require(_0x866d('0x12'));var authService=require(_0x866d('0x13'));var qs=require(_0x866d('0x14'));var as=require(_0x866d('0x15'));var hardwareService=require(_0x866d('0x16'));var logger=require(_0x866d('0x17'))(_0x866d('0x18'));var utils=require(_0x866d('0x19'));var config=require(_0x866d('0x1a'));var licenseUtil=require(_0x866d('0x1b'));var db=require(_0x866d('0x1c'))['db'];function respondWithStatusCode(_0x501e56,_0x109fc4){_0x109fc4=_0x109fc4||0xcc;return function(_0x4abe88){if(_0x4abe88){return _0x501e56[_0x866d('0x1d')](_0x109fc4);}return _0x501e56[_0x866d('0x1e')](_0x109fc4)['end']();};}function respondWithResult(_0x3de8a3,_0x4381f0){_0x4381f0=_0x4381f0||0xc8;return function(_0x3b9a2d){if(_0x3b9a2d){return _0x3de8a3['status'](_0x4381f0)['json'](_0x3b9a2d);}};}function respondWithFilteredResult(_0x45727f,_0x2f52f8){return function(_0x229412){if(_0x229412){var _0x44865e=typeof _0x2f52f8['offset']===_0x866d('0x1f')&&typeof _0x2f52f8[_0x866d('0x20')]===_0x866d('0x1f');var _0x1e04db=_0x229412[_0x866d('0x21')];var _0x5d7781=_0x44865e?0x0:_0x2f52f8[_0x866d('0x22')];var _0x56b0c4=_0x44865e?_0x229412[_0x866d('0x21')]:_0x2f52f8[_0x866d('0x22')]+_0x2f52f8[_0x866d('0x20')];var _0x470b7e;if(_0x56b0c4>=_0x1e04db){_0x56b0c4=_0x1e04db;_0x470b7e=0xc8;}else{_0x470b7e=0xce;}_0x45727f[_0x866d('0x1e')](_0x470b7e);return _0x45727f[_0x866d('0x23')]('Content-Range',_0x5d7781+'-'+_0x56b0c4+'/'+_0x1e04db)[_0x866d('0x24')](_0x229412);}return null;};}function patchUpdates(_0x8ed7f6){return function(_0x1e8af7){try{jsonpatch[_0x866d('0x25')](_0x1e8af7,_0x8ed7f6,!![]);}catch(_0x599614){return BPromise[_0x866d('0x26')](_0x599614);}return _0x1e8af7['save']();};}function saveUpdates(_0x1dce8d,_0x2dee31){return function(_0x29da4b){if(_0x29da4b){return _0x29da4b[_0x866d('0x27')](_0x1dce8d)[_0x866d('0x28')](function(_0x44acbf){return _0x44acbf;});}return null;};}function removeEntity(_0xfef6db,_0x371f90){return function(_0x2cb952){if(_0x2cb952){return _0x2cb952[_0x866d('0x29')]()[_0x866d('0x28')](function(){_0xfef6db[_0x866d('0x1e')](0xcc)[_0x866d('0x2a')]();});}};}function handleEntityNotFound(_0x418119,_0x54171a){return function(_0x29244c){if(!_0x29244c){_0x418119[_0x866d('0x1d')](0x194);}return _0x29244c;};}function handleError(_0x41e7a0,_0x4907cf){_0x4907cf=_0x4907cf||0x1f4;return function(_0x2e2454){logger['error'](_0x2e2454[_0x866d('0x2b')]);if(_0x2e2454[_0x866d('0x2c')]){delete _0x2e2454['name'];}_0x41e7a0[_0x866d('0x1e')](_0x4907cf)[_0x866d('0x2d')](_0x2e2454);};}exports[_0x866d('0x2e')]=function(_0x57f133,_0x2ccc54){var _0x1ac4f0={},_0x2fffa1={},_0x54b296={'count':0x0,'rows':[]};var _0x5ce05f=_[_0x866d('0x2f')](db[_0x866d('0x30')][_0x866d('0x31')],function(_0x48181e){return{'name':_0x48181e[_0x866d('0x32')],'type':_0x48181e[_0x866d('0x33')][_0x866d('0x34')]};});_0x2fffa1['model']=_['map'](_0x5ce05f,_0x866d('0x2c'));_0x2fffa1['query']=_['keys'](_0x57f133['query']);_0x2fffa1[_0x866d('0x35')]=_['intersection'](_0x2fffa1[_0x866d('0x36')],_0x2fffa1[_0x866d('0x37')]);_0x1ac4f0[_0x866d('0x38')]=_[_0x866d('0x39')](_0x2fffa1['model'],qs[_0x866d('0x3a')](_0x57f133['query'][_0x866d('0x3a')]));_0x1ac4f0[_0x866d('0x38')]=_0x1ac4f0[_0x866d('0x38')][_0x866d('0x3b')]?_0x1ac4f0['attributes']:_0x2fffa1[_0x866d('0x36')];if(!_0x57f133[_0x866d('0x37')]['hasOwnProperty'](_0x866d('0x3c'))){_0x1ac4f0[_0x866d('0x20')]=qs[_0x866d('0x20')](_0x57f133[_0x866d('0x37')][_0x866d('0x20')]);_0x1ac4f0['offset']=qs[_0x866d('0x22')](_0x57f133[_0x866d('0x37')][_0x866d('0x22')]);}_0x1ac4f0[_0x866d('0x3d')]=qs[_0x866d('0x3e')](_0x57f133[_0x866d('0x37')][_0x866d('0x3e')]);_0x1ac4f0[_0x866d('0x3f')]=qs[_0x866d('0x35')](_[_0x866d('0x40')](_0x57f133[_0x866d('0x37')],_0x2fffa1[_0x866d('0x35')]),_0x5ce05f);if(_0x57f133[_0x866d('0x37')]['filter']){_0x1ac4f0[_0x866d('0x3f')]=_[_0x866d('0x41')](_0x1ac4f0[_0x866d('0x3f')],{'$or':_[_0x866d('0x2f')](_0x5ce05f,function(_0x3257d1){if(_0x3257d1[_0x866d('0x33')]!==_0x866d('0x42')){var _0x45a4cc={};_0x45a4cc[_0x3257d1[_0x866d('0x2c')]]={'$like':'%'+_0x57f133['query']['filter']+'%'};return _0x45a4cc;}})});}_0x1ac4f0=_['merge']({},_0x1ac4f0,_0x57f133[_0x866d('0x43')]);var _0x144f5c={'where':_0x1ac4f0['where']};return db[_0x866d('0x30')]['count'](_0x144f5c)[_0x866d('0x28')](function(_0x57bd1a){_0x54b296[_0x866d('0x21')]=_0x57bd1a;if(_0x57f133[_0x866d('0x37')]['includeAll']){_0x1ac4f0[_0x866d('0x44')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x866d('0x45')](_0x1ac4f0);})['then'](function(_0xf7d351){_0x54b296[_0x866d('0x46')]=_0xf7d351;return _0x54b296;})[_0x866d('0x28')](respondWithFilteredResult(_0x2ccc54,_0x1ac4f0))['catch'](handleError(_0x2ccc54,null));};exports[_0x866d('0x47')]=function(_0x39306a,_0x1ebbab){var _0x5a23fc={'raw':!![],'where':{'id':_0x39306a[_0x866d('0x48')]['id']}},_0x2e9988={};_0x2e9988[_0x866d('0x36')]=_[_0x866d('0x49')](db[_0x866d('0x30')]['rawAttributes']);_0x2e9988[_0x866d('0x37')]=_[_0x866d('0x49')](_0x39306a['query']);_0x2e9988[_0x866d('0x35')]=_[_0x866d('0x39')](_0x2e9988[_0x866d('0x36')],_0x2e9988[_0x866d('0x37')]);_0x5a23fc[_0x866d('0x38')]=_[_0x866d('0x39')](_0x2e9988[_0x866d('0x36')],qs[_0x866d('0x3a')](_0x39306a[_0x866d('0x37')][_0x866d('0x3a')]));_0x5a23fc[_0x866d('0x38')]=_0x5a23fc[_0x866d('0x38')][_0x866d('0x3b')]?_0x5a23fc['attributes']:_0x2e9988[_0x866d('0x36')];if(_0x39306a[_0x866d('0x37')][_0x866d('0x4a')]){_0x5a23fc[_0x866d('0x44')]=[{'all':!![]}];}_0x5a23fc=_[_0x866d('0x41')]({},_0x5a23fc,_0x39306a[_0x866d('0x43')]);return db[_0x866d('0x30')][_0x866d('0x4b')](_0x5a23fc)['then'](handleEntityNotFound(_0x1ebbab,null))[_0x866d('0x28')](respondWithResult(_0x1ebbab,null))[_0x866d('0x4c')](handleError(_0x1ebbab,null));};exports['create']=function(_0x4a52ca,_0xd63f4){return db['WhatsappTransferReport'][_0x866d('0x4d')](_0x4a52ca[_0x866d('0x4e')],{})[_0x866d('0x28')](respondWithResult(_0xd63f4,0xc9))[_0x866d('0x4c')](handleError(_0xd63f4,null));};exports[_0x866d('0x27')]=function(_0x4f7ef0,_0x392458){if(_0x4f7ef0[_0x866d('0x4e')]['id']){delete _0x4f7ef0['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x4f7ef0[_0x866d('0x48')]['id']}})[_0x866d('0x28')](handleEntityNotFound(_0x392458,null))['then'](saveUpdates(_0x4f7ef0[_0x866d('0x4e')],null))['then'](respondWithResult(_0x392458,null))[_0x866d('0x4c')](handleError(_0x392458,null));};exports[_0x866d('0x29')]=function(_0x2bd0ec,_0x10a93b){return db[_0x866d('0x30')][_0x866d('0x4b')]({'where':{'id':_0x2bd0ec[_0x866d('0x48')]['id']}})[_0x866d('0x28')](handleEntityNotFound(_0x10a93b,null))[_0x866d('0x28')](removeEntity(_0x10a93b,null))['catch'](handleError(_0x10a93b,null));};exports[_0x866d('0x4f')]=function(_0x5e0a03,_0x17b442){return db['WhatsappTransferReport']['describe']()[_0x866d('0x28')](respondWithResult(_0x17b442,null))['catch'](handleError(_0x17b442,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2c3f432..170f2d8 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 _0x5004=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x58b113,_0x4e638e){var _0xf242c1=function(_0x1befca){while(--_0x1befca){_0x58b113['push'](_0x58b113['shift']());}};_0xf242c1(++_0x4e638e);}(_0x5004,0x117));var _0x4500=function(_0x152919,_0x345c46){_0x152919=_0x152919-0x0;var _0x46f867=_0x5004[_0x152919];return _0x46f867;};'use strict';var _=require(_0x4500('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4500('0x1'));var moment=require('moment');var BPromise=require(_0x4500('0x2'));var rp=require(_0x4500('0x3'));var fs=require('fs');var path=require(_0x4500('0x4'));var rimraf=require(_0x4500('0x5'));var config=require(_0x4500('0x6'));var attributes=require(_0x4500('0x7'));module[_0x4500('0x8')]=function(_0x8bfbc,_0xc13979){return _0x8bfbc['define'](_0x4500('0x9'),attributes,{'tableName':_0x4500('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4500('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x529d=['uniqueid','util','api','moment','bluebird','request-promise','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x14b883,_0x39cd7d){var _0x31325f=function(_0x6d9c8e){while(--_0x6d9c8e){_0x14b883['push'](_0x14b883['shift']());}};_0x31325f(++_0x39cd7d);}(_0x529d,0x1c4));var _0xd529=function(_0x1e93ce,_0x56a18f){_0x1e93ce=_0x1e93ce-0x0;var _0x35f4a4=_0x529d[_0x1e93ce];return _0x35f4a4;};'use strict';var _=require('lodash');var util=require(_0xd529('0x0'));var logger=require('../../config/logger')(_0xd529('0x1'));var moment=require(_0xd529('0x2'));var BPromise=require(_0xd529('0x3'));var rp=require(_0xd529('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd529('0x5'));module[_0xd529('0x6')]=function(_0x172f5f,_0x184b0f){return _0x172f5f[_0xd529('0x7')](_0xd529('0x8'),attributes,{'tableName':_0xd529('0x9'),'paranoid':![],'indexes':[{'name':_0xd529('0xa'),'fields':[_0xd529('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 9228732..c9d7511 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 _0x7a1c=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x4e7d5d,_0x1a3ceb){var _0x5f1719=function(_0xcfacec){while(--_0xcfacec){_0x4e7d5d['push'](_0x4e7d5d['shift']());}};_0x5f1719(++_0x1a3ceb);}(_0x7a1c,0x78));var _0xc7a1=function(_0x49297c,_0x29bdb5){_0x49297c=_0x49297c-0x0;var _0xa22a84=_0x7a1c[_0x49297c];return _0xa22a84;};'use strict';var _=require('lodash');var util=require(_0xc7a1('0x0'));var moment=require(_0xc7a1('0x1'));var BPromise=require(_0xc7a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7a1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7a1('0x4'))(_0xc7a1('0x5'));var config=require(_0xc7a1('0x6'));var jayson=require(_0xc7a1('0x7'));var client=jayson[_0xc7a1('0x8')][_0xc7a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b162,_0x21d8f1,_0x4c11d0){return new BPromise(function(_0x7f53c0,_0x40439a){return client[_0xc7a1('0xa')](_0x52b162,_0x4c11d0)[_0xc7a1('0xb')](function(_0x25a9b4){logger['info'](_0xc7a1('0xc'),_0x21d8f1,_0xc7a1('0xd'));logger[_0xc7a1('0xe')](_0xc7a1('0xf'),_0x21d8f1,_0xc7a1('0xd'),JSON['stringify'](_0x25a9b4));if(_0x25a9b4['error']){if(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x11')]===0x1f4){logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);return _0x40439a(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);}logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);return _0x7f53c0(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);}else{logger['info'](_0xc7a1('0xc'),_0x21d8f1,'request\x20sent');_0x7f53c0(_0x25a9b4['result']['message']);}})[_0xc7a1('0x13')](function(_0x38886d){logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x38886d);_0x40439a(_0x38886d);});});} \ No newline at end of file +var _0xc05b=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b763e,_0x4b9869){var _0x5540cc=function(_0x183408){while(--_0x183408){_0x2b763e['push'](_0x2b763e['shift']());}};_0x5540cc(++_0x4b9869);}(_0xc05b,0x156));var _0xbc05=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xc05b[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0xbc05('0x0'));var util=require(_0xbc05('0x1'));var moment=require(_0xbc05('0x2'));var BPromise=require(_0xbc05('0x3'));var rs=require(_0xbc05('0x4'));var fs=require('fs');var Redis=require(_0xbc05('0x5'));var db=require(_0xbc05('0x6'))['db'];var utils=require(_0xbc05('0x7'));var logger=require(_0xbc05('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc05('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a15b9,_0x46731d,_0x36724d){return new BPromise(function(_0x731196,_0x3515bd){return client[_0xbc05('0xa')](_0x3a15b9,_0x36724d)['then'](function(_0x5e14b1){logger[_0xbc05('0xb')](_0xbc05('0xc'),_0x46731d,_0xbc05('0xd'));logger[_0xbc05('0xe')](_0xbc05('0xf'),_0x46731d,_0xbc05('0xd'),JSON['stringify'](_0x5e14b1));if(_0x5e14b1[_0xbc05('0x10')]){if(_0x5e14b1['error'][_0xbc05('0x11')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x46731d,_0x5e14b1['error'][_0xbc05('0x12')]);return _0x3515bd(_0x5e14b1[_0xbc05('0x10')][_0xbc05('0x12')]);}logger[_0xbc05('0x10')](_0xbc05('0xc'),_0x46731d,_0x5e14b1['error'][_0xbc05('0x12')]);return _0x731196(_0x5e14b1[_0xbc05('0x10')]['message']);}else{logger[_0xbc05('0xb')](_0xbc05('0xc'),_0x46731d,_0xbc05('0xd'));_0x731196(_0x5e14b1[_0xbc05('0x13')][_0xbc05('0x12')]);}})[_0xbc05('0x14')](function(_0xbdc256){logger[_0xbc05('0x10')](_0xbc05('0xc'),_0x46731d,_0xbdc256);_0x3515bd(_0xbdc256);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index aa7a522..7adf113 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4672=['pm2_env','name','Online\x20apps:','filter','online','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/seedDB','./config/license','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map'];(function(_0x1439e6,_0x2634b8){var _0x1101a9=function(_0x591d44){while(--_0x591d44){_0x1439e6['push'](_0x1439e6['shift']());}};_0x1101a9(++_0x2634b8);}(_0x4672,0x18a));var _0x2467=function(_0x4ede09,_0x18801d){_0x4ede09=_0x4ede09-0x0;var _0x253193=_0x4672[_0x4ede09];return _0x253193;};'use strict';var _=require(_0x2467('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x2467('0x1'));var checkLicense=require(_0x2467('0x2'));var rpc=require('./rpc');var config=require(_0x2467('0x3'));var logger=require('./config/logger')(_0x2467('0x4'));var pm2=require(_0x2467('0x5'));var pm2Config=require(_0x2467('0x6'));var schedule=require(_0x2467('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x2467('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x2467('0x9'));function main(){return db[_0x2467('0xa')][_0x2467('0xb')]()[_0x2467('0xc')](function(){if(config[_0x2467('0xd')]){return seedDb[_0x2467('0xe')]();}})[_0x2467('0xc')](function(){return checkLicense[_0x2467('0xe')]();})[_0x2467('0xc')](function(){return rpc['listen']();})[_0x2467('0xc')](function(_0x1b1c63){logger[_0x2467('0xf')](_0x1b1c63);return chat[_0x2467('0x10')]();})['then'](function(){return whatsapp[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return schedule[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return transcribe[_0x2467('0x10')]();})[_0x2467('0xc')](function(){return provider['start']();})[_0x2467('0xc')](function(_0x373ef2){logger[_0x2467('0xf')](_0x373ef2);return pm2[_0x2467('0x10')](pm2Config);})[_0x2467('0xc')](function(_0x265d7e){var _0x15aa74=_0x265d7e['filter'](function(_0x520ad9){return typeof _0x520ad9['exitCode']===_0x2467('0x11')&&_0x520ad9[_0x2467('0x12')]>=0x0;});if(_0x15aa74[_0x2467('0x13')]>0x0){throw new Error(_0x15aa74['length']+_0x2467('0x14')+_[_0x2467('0x15')](_0x15aa74,function(_0x4abd91){return'\x22'+_0x4abd91[_0x2467('0x16')][_0x2467('0x17')]+'\x22';}));}logger[_0x2467('0xf')](_0x2467('0x18'),_[_0x2467('0x15')](_[_0x2467('0x19')](_0x265d7e,{'status':_0x2467('0x1a')}),'name')['join']());logger[_0x2467('0xf')]('Offline\x20apps:',_[_0x2467('0x15')](_[_0x2467('0x19')](_0x265d7e,function(_0x50e555){return _0x50e555['status']!==_0x2467('0x1a');}),_0x2467('0x17'))['join']()||_0x2467('0x1b'));console[_0x2467('0x1c')](_0x2467('0x1d'));})[_0x2467('0x1e')](function(_0x59f7d2){console[_0x2467('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x59f7d2);logger['error'](_0x2467('0x1f'),_0x59f7d2);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x9432=['None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/license','./rpc','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','name','Online\x20apps:','map','join','Offline\x20apps:','online'];(function(_0x74c31d,_0x2ff936){var _0x25ac61=function(_0x4a0839){while(--_0x4a0839){_0x74c31d['push'](_0x74c31d['shift']());}};_0x25ac61(++_0x2ff936);}(_0x9432,0x1e3));var _0x2943=function(_0x38f3ae,_0x1d52b9){_0x38f3ae=_0x38f3ae-0x0;var _0x140afa=_0x9432[_0x38f3ae];return _0x140afa;};'use strict';var _=require(_0x2943('0x0'));var db=require(_0x2943('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x2943('0x2'));var rpc=require(_0x2943('0x3'));var config=require('./config/environment');var logger=require(_0x2943('0x4'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x2943('0x5'));var schedule=require(_0x2943('0x6'));var chat=require(_0x2943('0x7'));var whatsapp=require(_0x2943('0x8'));var transcribe=require(_0x2943('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x2943('0xa')][_0x2943('0xb')]()[_0x2943('0xc')](function(){if(config[_0x2943('0xd')]){return seedDb['default']();}})[_0x2943('0xc')](function(){return checkLicense[_0x2943('0xe')]();})[_0x2943('0xc')](function(){return rpc['listen']();})[_0x2943('0xc')](function(_0x4f0262){logger[_0x2943('0xf')](_0x4f0262);return chat[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return whatsapp[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return schedule[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return transcribe[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return provider[_0x2943('0x10')]();})[_0x2943('0xc')](function(_0x1a246c){logger[_0x2943('0xf')](_0x1a246c);return pm2['start'](pm2Config);})[_0x2943('0xc')](function(_0x32b897){var _0x19bbfd=_0x32b897[_0x2943('0x11')](function(_0x11a622){return typeof _0x11a622[_0x2943('0x12')]===_0x2943('0x13')&&_0x11a622['exitCode']>=0x0;});if(_0x19bbfd['length']>0x0){throw new Error(_0x19bbfd[_0x2943('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x19bbfd,function(_0x10f6bc){return'\x22'+_0x10f6bc['pm2_env'][_0x2943('0x15')]+'\x22';}));}logger['info'](_0x2943('0x16'),_[_0x2943('0x17')](_[_0x2943('0x11')](_0x32b897,{'status':'online'}),_0x2943('0x15'))[_0x2943('0x18')]());logger['info'](_0x2943('0x19'),_[_0x2943('0x17')](_[_0x2943('0x11')](_0x32b897,function(_0x1a107a){return _0x1a107a['status']!==_0x2943('0x1a');}),_0x2943('0x15'))['join']()||_0x2943('0x1b'));console[_0x2943('0x1c')](_0x2943('0x1d'));})[_0x2943('0x1e')](function(_0x4fcdc3){console[_0x2943('0x1c')](_0x2943('0x1f'),_0x4fcdc3);logger[_0x2943('0x20')](_0x2943('0x21'),_0x4fcdc3);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 75167e9..7a5bcca 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 _0x4cf8=['Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','options','promisify','verify','randomBytes','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','role','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','authenticate','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x4cf8[_0x4a3898];return _0x25ceb0;};'use strict';var db=require(_0x84cf('0x0'))['db'];var config=require(_0x84cf('0x1'));var hardwareConf=require(_0x84cf('0x2'));var licenseUtil=require(_0x84cf('0x3'));var encryptor=require(_0x84cf('0x4'));var _=require(_0x84cf('0x5'));var jwt=require(_0x84cf('0x6'));var expressJwt=require(_0x84cf('0x7'));var compose=require(_0x84cf('0x8'));var basicAuth=require(_0x84cf('0x9'));var crypto=require(_0x84cf('0xa'));var BPromise=require(_0x84cf('0xb'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x84cf('0xc')]['session']});var userAttributes=['id',_0x84cf('0xd'),_0x84cf('0xe'),'name',_0x84cf('0xf'),_0x84cf('0x10'),'userpic',_0x84cf('0x11'),_0x84cf('0x12'),_0x84cf('0x13'),_0x84cf('0x14'),'mailPause',_0x84cf('0x15'),_0x84cf('0x16'),'openchannelPause','pauseType',_0x84cf('0x17'),_0x84cf('0x18'),_0x84cf('0x19'),_0x84cf('0x1a'),_0x84cf('0x1b'),_0x84cf('0x1c'),_0x84cf('0x1d'),_0x84cf('0x1e'),_0x84cf('0x1f'),_0x84cf('0x20'),_0x84cf('0x21'),_0x84cf('0x22'),_0x84cf('0x23'),_0x84cf('0x24'),_0x84cf('0x25'),_0x84cf('0x26'),_0x84cf('0x27'),_0x84cf('0x28'),_0x84cf('0x29'),'userProfileId',_0x84cf('0x2a'),_0x84cf('0x2b'),_0x84cf('0x2c'),_0x84cf('0x2d'),_0x84cf('0x2e'),_0x84cf('0x2f'),_0x84cf('0x30'),'selectRecallMeCampaign','chatAutoanswer',_0x84cf('0x31'),_0x84cf('0x32'),_0x84cf('0x33'),_0x84cf('0x34'),_0x84cf('0x35'),'openchannelAutoanswer',_0x84cf('0x36'),_0x84cf('0x37'),_0x84cf('0x38'),_0x84cf('0x39'),_0x84cf('0x3a'),'messengerSoundNotification'];exports[_0x84cf('0x3b')]=function(){return this[_0x84cf('0x3c')](!![])[_0x84cf('0x3d')](function(_0x23e1e7,_0x3e5e94,_0x29e9e1){if(_0x23e1e7[_0x84cf('0x3e')]){_0x29e9e1();}else{return db['ChatInteraction'][_0x84cf('0x3f')]({'where':{'id':_0x23e1e7[_0x84cf('0x40')]['id']},'attributes':['id',_0x84cf('0x41'),_0x84cf('0x42')],'raw':!![]})[_0x84cf('0x43')](function(_0x44d4bf){if(_0x44d4bf&&_0x44d4bf[_0x84cf('0x41')]){return _0x3e5e94[_0x84cf('0x44')](_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?0x195:0x193)['json']({'message':_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?_0x84cf('0x46'):_0x84cf('0x47')});}else{_0x29e9e1();}})['catch'](function(_0x1595dd){_0x29e9e1(_0x1595dd);});}});};exports['isAuthenticated']=function isAuthenticated(_0x29455e){return compose()[_0x84cf('0x3d')](function(_0x43b41b,_0xc15298,_0x51adcf){var _0x20de4b;if(_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')]){if(_[_0x84cf('0x4a')](_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')],_0x84cf('0x4b'))){var _0x18243d=basicAuth(_0x43b41b);db[_0x84cf('0x4c')]['find']({'where':{'name':_0x18243d['name']}})[_0x84cf('0x43')](function(_0x25de3a){if(!_0x25de3a||!_0x25de3a[_0x84cf('0x4d')](_0x18243d[_0x84cf('0x4e')])){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x50')});}_0x43b41b[_0x84cf('0x3e')]={'id':_0x25de3a['id']};_0x51adcf();})['catch'](function(_0x113b3e){_0x51adcf(_0x113b3e);});}else if(_[_0x84cf('0x4a')](_0x43b41b['headers'][_0x84cf('0x49')],'Bearer')){validateJwt(_0x43b41b,_0xc15298,_0x51adcf);}else{if(_0x29455e){_0x51adcf();}else{return _0xc15298[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}}}else if(_0x43b41b[_0x84cf('0x52')][_0x84cf('0x53')]){try{var _0x49d415={'audience':hardwareConf[_0x84cf('0x54')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x43b41b['query'][_0x84cf('0x53')],_0x49d415)[_0x84cf('0x43')](function(_0x4c4676){return db[_0x84cf('0x4c')][_0x84cf('0x55')]({'where':{'id':_0x4c4676[_0x84cf('0x56')]}})[_0x84cf('0x43')](function(_0xd13908){_0x20de4b=_0xd13908;return db[_0x84cf('0x57')]['findOne']({'where':{'id':0x1},'attributes':[_0x84cf('0x58'),_0x84cf('0x59')],'raw':!![]});})[_0x84cf('0x43')](function(_0x32cff6){if(!_0x20de4b||!_[_0x84cf('0x5a')](_0x20de4b[_0x84cf('0x5b')],_0x4c4676['nonce'])){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5c')});}if(_0x20de4b[_0x84cf('0x5d')]){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}if(_0x20de4b[_0x84cf('0x5f')]){if(_0x32cff6[_0x84cf('0x59')]>0x0){if(moment(_0x20de4b[_0x84cf('0x60')])[_0x84cf('0x61')](_0x32cff6['blockDuration'],_0x84cf('0x62'))>moment()){return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}}else{return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x43b41b[_0x84cf('0x3e')]={'id':_0x20de4b['id']};_0x51adcf();});})['catch'](function(){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5e')});});}catch(_0x40ae50){_0x51adcf(_0x40ae50);}}else if(_0x29455e){_0x51adcf();}else{return _0xc15298['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}})[_0x84cf('0x3d')](function(_0x5ef5fb,_0x3c1314,_0x5f1b8e){if(_0x5ef5fb[_0x84cf('0x3e')]){db['User']['find']({'where':{'id':_0x5ef5fb['user']['id']},'attributes':userAttributes})[_0x84cf('0x43')](function(_0xcf14ba){if(!_0xcf14ba){return _0x3c1314['status'](0x194)[_0x84cf('0x4f')]({'message':'User\x20not\x20found.'});}_0x5ef5fb[_0x84cf('0x3e')]=_0xcf14ba;_0x5f1b8e();})[_0x84cf('0x63')](function(_0x5ce309){_0x5f1b8e(_0x5ce309);});}else if(_0x29455e){_0x5f1b8e();}else{return _0x3c1314[_0x84cf('0x44')](0x194)['json']({'message':_0x84cf('0x64')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5d8b69,_0x5498ec,_0x585644){return licenseUtil['getLicense']()['then'](function(_0x210d9b){if(_0x210d9b[_0x84cf('0x65')]){_0x585644();}else{return _0x5498ec[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':'Forbidden'});}})[_0x84cf('0x63')](function(_0x4af229){_0x585644(_0x4af229);});});};exports[_0x84cf('0x66')]=function isWebrtcLicence(){return compose()[_0x84cf('0x3d')](function(_0x1533a7,_0x253464,_0x121bb9){return licenseUtil[_0x84cf('0x67')]()['then'](function(_0x2f7da6){if(_0x2f7da6[_0x84cf('0x68')]){_0x121bb9();}else{return _0x253464['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x69')});}})[_0x84cf('0x63')](function(_0x5212ec){_0x121bb9(_0x5212ec);});});};exports['isMiddleware']=function(_0x5499f9,_0x1cf3f6,_0x104421){_0x5499f9[_0x84cf('0x6a')]=!![];return _0x104421();};exports[_0x84cf('0x6b')]=function signToken(_0x271cc3){return signJwt(_0x271cc3);};exports[_0x84cf('0x6c')]=function(_0x51d725,_0x350985){if(!_0x51d725['user']){return _0x350985[_0x84cf('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x46c595={'payload':{'id':_0x51d725[_0x84cf('0x3e')]['id'],'role':_0x51d725[_0x84cf('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x46c595)['then'](function(_0x290a4d){_0x350985[_0x84cf('0x6d')](_0x84cf('0x6e'),_0x290a4d);_0x350985[_0x84cf('0x6f')](_0x84cf('0x70'));})['catch'](function(_0xcfe28f){return _0x350985[_0x84cf('0x44')](0x1f4)['send'](_0xcfe28f);});};exports[_0x84cf('0x71')]=function(_0x5baea8){if(_['isNil'](_0x5baea8[_0x84cf('0x5b')])||_[_0x84cf('0x72')](_0x5baea8['apiKeyIat'])){return null;}else{return createJwt(_0x5baea8);}};exports['generateApiKey']=function(_0x31176c){_0x31176c[_0x84cf('0x5b')]=generateNonce();_0x31176c[_0x84cf('0x73')]=generateIssuedAt();return createJwt(_0x31176c);};exports[_0x84cf('0x74')]=function(_0x406c33,_0x3edaec){var _0x3a0eb4=_0x406c33[_0x84cf('0x52')]['apikey'];if(_0x3a0eb4){var _0x1bc15c={'nonce':_0x3edaec[_0x84cf('0x5b')],'iat':_0x3edaec['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x84cf('0x54')]()};return verifyJwt(_0x3a0eb4,_0x1bc15c)[_0x84cf('0x43')](function(){return generateApiKey(_0x3edaec);});}else{throw{'message':_0x84cf('0x75')};}};exports[_0x84cf('0x76')]=function(_0x340915){var _0xfec87d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xfec87d[_0x84cf('0x77')](_0x340915))throw new db['Sequelize'][(_0x84cf('0x78'))]('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[_0x84cf('0x79')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){var _0x55d8c4=encryptor[_0x84cf('0x7a')](_0x2a60bc)[_0x84cf('0x7b')](',');for(var _0x52a3f1=0x0;_0x52a3f1<_0x1c2f1b;_0x52a3f1++){if(!_0x55d8c4[_0x52a3f1])break;if(_0x5c0122[_0x84cf('0x7c')]()===_0x55d8c4[_0x52a3f1]['toLowerCase']()){var _0x577d55=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1c2f1b);if(_0x1c2f1b===0x1){_0x577d55=_0x84cf('0x7d');}throw new db[(_0x84cf('0x7e'))][(_0x84cf('0x78'))](_0x577d55);}}return;};exports[_0x84cf('0x7f')]=function(_0x480c3e,_0x32aa8b){var _0x3c1c55=_0x32aa8b?encryptor['decryptString'](_0x32aa8b)[_0x84cf('0x7b')](','):[];if(_0x3c1c55[_0x84cf('0x80')]===0x5){_0x3c1c55[_0x84cf('0x81')](-0x1,0x1);}_0x3c1c55[_0x84cf('0x82')](_0x480c3e);return encryptor[_0x84cf('0x83')](_0x3c1c55[_0x84cf('0x84')](','));};function signJwt(_0x1f1f76){var _0x39a336=BPromise['promisify'](jwt[_0x84cf('0x85')],{'context':jwt});var _0x58a96a=_0x1f1f76[_0x84cf('0x86')]||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x276ab1,_0x2602b7){_0x39a336(_0x1f1f76['payload'],_0x58a96a,_0x1f1f76[_0x84cf('0x88')])[_0x84cf('0x43')](function(_0xe1a1d9){_0x276ab1(_0xe1a1d9);})['catch'](function(_0xdb9b0c){_0x2602b7(_0xdb9b0c);});});}function verifyJwt(_0x240cca,_0x4e6077,_0x84d9cb){var _0x482958=BPromise[_0x84cf('0x89')](jwt[_0x84cf('0x8a')],{'context':jwt});var _0x57f1f2=_0x84d9cb||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x4a7905,_0x40b33e){_0x482958(_0x240cca,_0x57f1f2,_0x4e6077)[_0x84cf('0x43')](function(_0x262ae1){_0x4a7905(_0x262ae1);})[_0x84cf('0x63')](function(_0x577ade){_0x40b33e(_0x577ade);});});}function generateNonce(){return crypto[_0x84cf('0x8b')](0x10)[_0x84cf('0x8c')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x84cf('0x8c')]();}function createJwt(_0x8399f4){var _0xfcd0d={'payload':{'iat':_0x8399f4['apiKeyIat'],'nonce':_0x8399f4['apiKeyNonce']},'options':{'algorithm':_0x84cf('0x8d'),'subject':_0x8399f4['id'][_0x84cf('0x8c')](),'issuer':hardwareConf[_0x84cf('0x54')](),'audience':hardwareConf[_0x84cf('0x54')]()}};return signJwt(_0xfcd0d)[_0x84cf('0x43')](function(_0x39bd44){return{'iat':_0x8399f4[_0x84cf('0x73')],'nonce':_0x8399f4[_0x84cf('0x5b')],'token':_0x39bd44};});} \ No newline at end of file +var _0x0972=['allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isAuthenticated','use','user','findOne','closed','disposition','then','status','json','unmanaged','Forbidden.','catch','authorization','startsWith','Basic','User','find','authenticate','Wrong\x20credentials.','headers','Unknown\x20authorization\x20format','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','isEqual','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','canUpdate','update','Forbidden','webrtc','signToken','cookie','motion.token','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','randomBytes','floor','now','toString','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x0972,0x64));var _0x2097=function(_0x3e6b76,_0x1f94d7){_0x3e6b76=_0x3e6b76-0x0;var _0x47465f=_0x0972[_0x3e6b76];return _0x47465f;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2097('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x2097('0x1'));var encryptor=require('../encryptor');var _=require(_0x2097('0x2'));var jwt=require(_0x2097('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x2097('0x4'));var basicAuth=require(_0x2097('0x5'));var crypto=require(_0x2097('0x6'));var BPromise=require(_0x2097('0x7'));var util=require(_0x2097('0x8'));var moment=require(_0x2097('0x9'));var validateJwt=expressJwt({'secret':config[_0x2097('0xa')]['session']});var userAttributes=['id',_0x2097('0xb'),_0x2097('0xc'),_0x2097('0xd'),_0x2097('0xe'),_0x2097('0xf'),'userpic',_0x2097('0x10'),_0x2097('0x11'),_0x2097('0x12'),_0x2097('0x13'),_0x2097('0x14'),_0x2097('0x15'),_0x2097('0x16'),_0x2097('0x17'),_0x2097('0x18'),_0x2097('0x19'),_0x2097('0x1a'),_0x2097('0x1b'),_0x2097('0x1c'),_0x2097('0x1d'),_0x2097('0x1e'),_0x2097('0x1f'),_0x2097('0x20'),_0x2097('0x21'),_0x2097('0x22'),_0x2097('0x23'),'phoneBarEnableDtmfTone',_0x2097('0x24'),_0x2097('0x25'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x2097('0x26'),'interface',_0x2097('0x27'),_0x2097('0x28'),_0x2097('0x29'),_0x2097('0x2a'),_0x2097('0x2b'),'downloadOmnichannelInteractions',_0x2097('0x2c'),_0x2097('0x2d'),_0x2097('0x2e'),_0x2097('0x2f'),_0x2097('0x30'),_0x2097('0x31'),_0x2097('0x32'),_0x2097('0x33'),'smsAutoanswerDelay','openchannelAutoanswer',_0x2097('0x34'),'faxAutoanswer',_0x2097('0x35'),_0x2097('0x36'),'whatsappAutoanswerDelay',_0x2097('0x37')];exports['isChatInteractionAuthorized']=function(){return this[_0x2097('0x38')](!![])[_0x2097('0x39')](function(_0x36189e,_0x20b93a,_0x36b15e){if(_0x36189e[_0x2097('0x3a')]){_0x36b15e();}else{return db['ChatInteraction'][_0x2097('0x3b')]({'where':{'id':_0x36189e['params']['id']},'attributes':['id',_0x2097('0x3c'),_0x2097('0x3d')],'raw':!![]})[_0x2097('0x3e')](function(_0x9f59bc){if(_0x9f59bc&&_0x9f59bc['closed']){return _0x20b93a[_0x2097('0x3f')](_0x9f59bc[_0x2097('0x3d')]==='unmanaged'?0x195:0x193)[_0x2097('0x40')]({'message':_0x9f59bc['disposition']===_0x2097('0x41')?'Unmanaged.':_0x2097('0x42')});}else{_0x36b15e();}})[_0x2097('0x43')](function(_0x407a2a){_0x36b15e(_0x407a2a);});}});};exports[_0x2097('0x38')]=function isAuthenticated(_0x410afa){return compose()[_0x2097('0x39')](function(_0x450e0b,_0x4b443d,_0x11242f){var _0x14d964;if(_0x450e0b['headers'][_0x2097('0x44')]){if(_[_0x2097('0x45')](_0x450e0b['headers']['authorization'],_0x2097('0x46'))){var _0x11b051=basicAuth(_0x450e0b);db[_0x2097('0x47')][_0x2097('0x48')]({'where':{'name':_0x11b051[_0x2097('0xd')]}})[_0x2097('0x3e')](function(_0x56c538){if(!_0x56c538||!_0x56c538[_0x2097('0x49')](_0x11b051['pass'])){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':_0x2097('0x4a')});}_0x450e0b[_0x2097('0x3a')]={'id':_0x56c538['id']};_0x11242f();})[_0x2097('0x43')](function(_0x395d9f){_0x11242f(_0x395d9f);});}else if(_[_0x2097('0x45')](_0x450e0b[_0x2097('0x4b')][_0x2097('0x44')],'Bearer')){validateJwt(_0x450e0b,_0x4b443d,_0x11242f);}else{if(_0x410afa){_0x11242f();}else{return _0x4b443d[_0x2097('0x3f')](0x193)[_0x2097('0x40')]({'message':_0x2097('0x4c')});}}}else if(_0x450e0b['query'][_0x2097('0x4d')]){try{var _0x3bda50={'audience':hardwareConf[_0x2097('0x4e')](),'issuer':hardwareConf[_0x2097('0x4e')]()};verifyJwt(_0x450e0b['query']['apikey'],_0x3bda50)['then'](function(_0x3484ff){return db[_0x2097('0x47')][_0x2097('0x48')]({'where':{'id':_0x3484ff[_0x2097('0x4f')]}})[_0x2097('0x3e')](function(_0x296281){_0x14d964=_0x296281;return db['Setting'][_0x2097('0x3b')]({'where':{'id':0x1},'attributes':[_0x2097('0x50'),_0x2097('0x51')],'raw':!![]});})[_0x2097('0x3e')](function(_0x25375f){if(!_0x14d964||!_[_0x2097('0x52')](_0x14d964['apiKeyNonce'],_0x3484ff[_0x2097('0x53')])){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x14d964['disabled']){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':_0x2097('0x54')});}if(_0x14d964[_0x2097('0x55')]){if(_0x25375f[_0x2097('0x51')]>0x0){if(moment(_0x14d964[_0x2097('0x56')])[_0x2097('0x57')](_0x25375f[_0x2097('0x51')],_0x2097('0x58'))>moment()){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':_0x2097('0x54')});}}else{return _0x4b443d['status'](0x191)[_0x2097('0x40')]({'message':_0x2097('0x54')});}}_0x450e0b[_0x2097('0x3a')]={'id':_0x14d964['id']};_0x11242f();});})['catch'](function(){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':_0x2097('0x54')});});}catch(_0xf9fba7){_0x11242f(_0xf9fba7);}}else if(_0x410afa){_0x11242f();}else{return _0x4b443d[_0x2097('0x3f')](0x193)[_0x2097('0x40')]({'message':_0x2097('0x4c')});}})[_0x2097('0x39')](function(_0x5ab893,_0x11c825,_0x283adc){if(_0x5ab893[_0x2097('0x3a')]){db[_0x2097('0x47')][_0x2097('0x48')]({'where':{'id':_0x5ab893[_0x2097('0x3a')]['id']},'attributes':userAttributes})[_0x2097('0x3e')](function(_0x280ecd){if(!_0x280ecd){return _0x11c825['status'](0x194)[_0x2097('0x40')]({'message':'User\x20not\x20found.'});}_0x5ab893[_0x2097('0x3a')]=_0x280ecd;_0x283adc();})[_0x2097('0x43')](function(_0x370cc6){_0x283adc(_0x370cc6);});}else if(_0x410afa){_0x283adc();}else{return _0x11c825[_0x2097('0x3f')](0x194)[_0x2097('0x40')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2097('0x59')]=function canUpdate(){return compose()[_0x2097('0x39')](function(_0x113c3b,_0x39e0a4,_0x1e04f8){return licenseUtil['getLicense']()[_0x2097('0x3e')](function(_0x37cdb9){if(_0x37cdb9[_0x2097('0x5a')]){_0x1e04f8();}else{return _0x39e0a4[_0x2097('0x3f')](0x193)[_0x2097('0x40')]({'message':_0x2097('0x5b')});}})[_0x2097('0x43')](function(_0x40ec03){_0x1e04f8(_0x40ec03);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x2097('0x39')](function(_0x594804,_0x305657,_0xfe13c8){return licenseUtil['getLicense']()['then'](function(_0x4b6331){if(_0x4b6331[_0x2097('0x5c')]){_0xfe13c8();}else{return _0x305657[_0x2097('0x3f')](0x193)['json']({'message':_0x2097('0x5b')});}})[_0x2097('0x43')](function(_0x5daafd){_0xfe13c8(_0x5daafd);});});};exports['isMiddleware']=function(_0x23acf3,_0x21829d,_0x1b4de6){_0x23acf3['isMiddleware']=!![];return _0x1b4de6();};exports[_0x2097('0x5d')]=function signToken(_0x2881f8){return signJwt(_0x2881f8);};exports['setTokenCookie']=function(_0x86a05a,_0x2682a9){if(!_0x86a05a[_0x2097('0x3a')]){return _0x2682a9[_0x2097('0x3f')](0x194)[_0x2097('0x40')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5127d9={'payload':{'id':_0x86a05a[_0x2097('0x3a')]['id'],'role':_0x86a05a[_0x2097('0x3a')][_0x2097('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5127d9)['then'](function(_0x5c1739){_0x2682a9[_0x2097('0x5e')](_0x2097('0x5f'),_0x5c1739);_0x2682a9['redirect'](_0x2097('0x60'));})[_0x2097('0x43')](function(_0x12bdbd){return _0x2682a9[_0x2097('0x3f')](0x1f4)[_0x2097('0x61')](_0x12bdbd);});};exports['retrieveApiKey']=function(_0x42b222){if(_[_0x2097('0x62')](_0x42b222[_0x2097('0x63')])||_['isNil'](_0x42b222[_0x2097('0x64')])){return null;}else{return createJwt(_0x42b222);}};exports[_0x2097('0x65')]=function(_0x4edf1d){_0x4edf1d[_0x2097('0x63')]=generateNonce();_0x4edf1d['apiKeyIat']=generateIssuedAt();return createJwt(_0x4edf1d);};exports[_0x2097('0x66')]=function(_0x56a0d1,_0x48742a){var _0x5d4f35=_0x56a0d1[_0x2097('0x67')]['apikey'];if(_0x5d4f35){var _0x54bea1={'nonce':_0x48742a[_0x2097('0x63')],'iat':_0x48742a['apiKeyIat'],'audience':hardwareConf[_0x2097('0x4e')](),'issuer':hardwareConf[_0x2097('0x4e')]()};return verifyJwt(_0x5d4f35,_0x54bea1)['then'](function(){return generateApiKey(_0x48742a);});}else{throw{'message':_0x2097('0x68')};}};exports[_0x2097('0x69')]=function(_0x3445fc){var _0x924537=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x924537[_0x2097('0x6a')](_0x3445fc))throw new db['Sequelize'][(_0x2097('0x6b'))]('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[_0x2097('0x6c')]=function(_0x140e43,_0x24f166,_0x55e3cd){var _0x365499=encryptor[_0x2097('0x6d')](_0x24f166)[_0x2097('0x6e')](',');for(var _0x168a7d=0x0;_0x168a7d<_0x55e3cd;_0x168a7d++){if(!_0x365499[_0x168a7d])break;if(_0x140e43[_0x2097('0x6f')]()===_0x365499[_0x168a7d]['toLowerCase']()){var _0x5b9fa2=util[_0x2097('0x70')](_0x2097('0x71'),_0x55e3cd);if(_0x55e3cd===0x1){_0x5b9fa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x5b9fa2);}}return;};exports['updatePasswordsHistory']=function(_0x14b2d4,_0x4cdc65){var _0x4445ff=_0x4cdc65?encryptor[_0x2097('0x6d')](_0x4cdc65)['split'](','):[];if(_0x4445ff[_0x2097('0x72')]===0x5){_0x4445ff[_0x2097('0x73')](-0x1,0x1);}_0x4445ff[_0x2097('0x74')](_0x14b2d4);return encryptor[_0x2097('0x75')](_0x4445ff[_0x2097('0x76')](','));};function signJwt(_0x60332a){var _0x15aa91=BPromise[_0x2097('0x77')](jwt[_0x2097('0x78')],{'context':jwt});var _0x586922=_0x60332a[_0x2097('0x79')]||config[_0x2097('0xa')][_0x2097('0x7a')];return new BPromise(function(_0x4705e1,_0x412321){_0x15aa91(_0x60332a[_0x2097('0x7b')],_0x586922,_0x60332a['options'])[_0x2097('0x3e')](function(_0x27ed29){_0x4705e1(_0x27ed29);})[_0x2097('0x43')](function(_0x3c3b38){_0x412321(_0x3c3b38);});});}function verifyJwt(_0x1c4156,_0x5d6b8a,_0x437b79){var _0x28dd95=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x580c1e=_0x437b79||config[_0x2097('0xa')][_0x2097('0x7a')];return new BPromise(function(_0x319d3b,_0x3edb3e){_0x28dd95(_0x1c4156,_0x580c1e,_0x5d6b8a)[_0x2097('0x3e')](function(_0x18d90a){_0x319d3b(_0x18d90a);})[_0x2097('0x43')](function(_0x2ce256){_0x3edb3e(_0x2ce256);});});}function generateNonce(){return crypto[_0x2097('0x7c')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x2097('0x7d')](Date[_0x2097('0x7e')]()/0x3e8)[_0x2097('0x7f')]();}function createJwt(_0x2bdf29){var _0x4649dc={'payload':{'iat':_0x2bdf29[_0x2097('0x64')],'nonce':_0x2bdf29['apiKeyNonce']},'options':{'algorithm':_0x2097('0x80'),'subject':_0x2bdf29['id'][_0x2097('0x7f')](),'issuer':hardwareConf[_0x2097('0x4e')](),'audience':hardwareConf[_0x2097('0x4e')]()}};return signJwt(_0x4649dc)['then'](function(_0x5f4cf9){return{'iat':_0x2bdf29[_0x2097('0x64')],'nonce':_0x2bdf29[_0x2097('0x63')],'token':_0x5f4cf9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 34499bb..6f5cd82 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafd7=['tags','skip','checkListsRestrictions','ids','tag','count','buildContactsQuery','fields','getFilteredContacts','describe','keys','startsWith','cf_','map','findOne','slice','all','fieldType','catch','./sql-utils','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','where','default','filter','user','clause'];(function(_0x45ee80,_0x556689){var _0x350e98=function(_0x96e156){while(--_0x96e156){_0x45ee80['push'](_0x45ee80['shift']());}};_0x350e98(++_0x556689);}(_0xafd7,0x1b3));var _0x7afd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xafd7[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var sqlUtils=require(_0x7afd('0x0'));var db=require(_0x7afd('0x1'))['db'];exports['findAll']=function(_0x1c9274,_0x11d294,_0x2dc806,_0x1c887b){var _0xd5cde5={'count':0x0,'rows':[]};var _0x3f55f8=sqlUtils[_0x7afd('0x2')](_0x11d294,_0x1c9274);if(_0x3f55f8){return Promise['resolve'](_0xd5cde5);}var _0x58bf2a=sqlUtils[_0x7afd('0x3')]();var _0x449cdb={};var _0x50b0e9=![];var _0x26f0c0=![];return Promise[_0x7afd('0x4')]()[_0x7afd('0x5')](function(){if(_0x1c9274[_0x7afd('0x6')]){return sqlUtils[_0x7afd('0x7')](_0x1c9274[_0x7afd('0x6')],_0x1c887b);}else{return sqlUtils['parseQueryParameters'](_0x1c9274,_0x1c887b);}})['then'](function(_0x3e414b){_0x58bf2a[_0x7afd('0x8')](_0x3e414b[_0x7afd('0x9')]);_0x58bf2a['where'](_0x3e414b['fields']);_0x58bf2a[_0x7afd('0x8')](_0x3e414b[_0x7afd('0xa')]);_0x58bf2a[_0x7afd('0x8')](_0x3e414b[_0x7afd('0xb')][_0x7afd('0xc')]);_0x449cdb=_0x3e414b[_0x7afd('0xd')];_0x26f0c0=_0x3e414b[_0x7afd('0xb')][_0x7afd('0xe')];return sqlUtils[_0x7afd('0xf')](_0x11d294,_0x1c9274,_0x26f0c0);})['then'](function(_0x1af06c){_0x58bf2a[_0x7afd('0x8')](_0x1af06c);var _0x18830f=_0x1c9274[_0x7afd('0x6')]?_0x449cdb[_0x7afd('0x10')]:_0x1c9274[_0x7afd('0x11')];_0x50b0e9=_0x18830f?!![]:![];return sqlUtils['countFilteredContacts'](_0x58bf2a,_0x18830f);})[_0x7afd('0x5')](function(_0x4282e4){_0xd5cde5[_0x7afd('0x12')]=_0x4282e4;if(_0xd5cde5[_0x7afd('0x12')]===0x0){return;}if(_0x1c9274['User']){_0x26f0c0=!![];}return sqlUtils[_0x7afd('0x13')](_0x58bf2a,_0x1c9274[_0x7afd('0x14')],_0x2dc806,_0x50b0e9,_0x449cdb[_0x7afd('0xc')],_0x26f0c0);})[_0x7afd('0x5')](function(_0x30bd32){if(!_0x30bd32){return[];}return sqlUtils[_0x7afd('0x15')](_0x30bd32,_0x1c9274,_0x2dc806);})[_0x7afd('0x5')](function(_0x5527f8){_0xd5cde5['rows']=_0x5527f8;return _0xd5cde5;})['catch'](function(_0x190a1f){throw _0x190a1f;});};exports['describe']=function(){var _0x3b3749={};var _0x5a1eff=[];return db['CmContact'][_0x7afd('0x16')]()[_0x7afd('0x5')](function(_0x26c347){_0x3b3749=_0x26c347;var _0x48b475=Object[_0x7afd('0x17')](_0x3b3749)[_0x7afd('0xa')](function(_0x47ce8f){return _[_0x7afd('0x18')](_0x47ce8f,_0x7afd('0x19'))?_0x47ce8f:undefined;});var _0x14d603=_0x48b475[_0x7afd('0x1a')](function(_0x35aec1){return db['CmCustomField'][_0x7afd('0x1b')]({'where':{'id':_0x35aec1[_0x7afd('0x1c')](0x3)},'raw':!![]});});return Promise[_0x7afd('0x1d')](_0x14d603);})[_0x7afd('0x5')](function(_0xde0d44){for(var _0x3b6dba=0x0;_0x3b6dba<_0xde0d44['length'];_0x3b6dba++){if(_0xde0d44[_0x3b6dba]){var _0xdeda00=_0x7afd('0x19')+_0xde0d44[_0x3b6dba]['id'];_0x3b3749[_0xdeda00][_0x7afd('0x1e')]=_0xde0d44[_0x3b6dba]['type'];}}_0x5a1eff=_[_0x7afd('0x1a')](Object[_0x7afd('0x17')](_0x3b3749),function(_0x12241c){return{'name':_0x12241c,'type':_0x3b3749[_0x12241c]['type']};});return _0x5a1eff;})[_0x7afd('0x1f')](function(_0x25f858){throw _0x25f858;});}; \ No newline at end of file +var _0xba7f=['then','search','parseAdvancedSearchFilter','where','default','fields','user','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','slice','length','cf_','fieldType','type','map','lodash','../../mysqldb','findAll','skipContactsQuery','resolve'];(function(_0x5726e9,_0x5cf183){var _0x655893=function(_0x361488){while(--_0x361488){_0x5726e9['push'](_0x5726e9['shift']());}};_0x655893(++_0x5cf183);}(_0xba7f,0x145));var _0xfba7=function(_0x100ff9,_0x5a4021){_0x100ff9=_0x100ff9-0x0;var _0x4ff399=_0xba7f[_0x100ff9];return _0x4ff399;};'use strict';var _=require(_0xfba7('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xfba7('0x1'))['db'];exports[_0xfba7('0x2')]=function(_0x2fa8fe,_0x5ec0bb,_0x3c14b5,_0x527b78){var _0x20a4f1={'count':0x0,'rows':[]};var _0x3a52e8=sqlUtils[_0xfba7('0x3')](_0x5ec0bb,_0x2fa8fe);if(_0x3a52e8){return Promise[_0xfba7('0x4')](_0x20a4f1);}var _0x4389a7=sqlUtils['getContactsSubquery']();var _0x55009e={};var _0x2863bd=![];var _0x2efa0a=![];return Promise[_0xfba7('0x4')]()[_0xfba7('0x5')](function(){if(_0x2fa8fe[_0xfba7('0x6')]){return sqlUtils[_0xfba7('0x7')](_0x2fa8fe[_0xfba7('0x6')],_0x527b78);}else{return sqlUtils['parseQueryParameters'](_0x2fa8fe,_0x527b78);}})[_0xfba7('0x5')](function(_0x21db31){_0x4389a7[_0xfba7('0x8')](_0x21db31[_0xfba7('0x9')]);_0x4389a7[_0xfba7('0x8')](_0x21db31[_0xfba7('0xa')]);_0x4389a7[_0xfba7('0x8')](_0x21db31['filter']);_0x4389a7[_0xfba7('0x8')](_0x21db31[_0xfba7('0xb')][_0xfba7('0xc')]);_0x55009e=_0x21db31[_0xfba7('0xd')];_0x2efa0a=_0x21db31[_0xfba7('0xb')][_0xfba7('0xe')];return sqlUtils[_0xfba7('0xf')](_0x5ec0bb,_0x2fa8fe,_0x2efa0a);})[_0xfba7('0x5')](function(_0x40e471){_0x4389a7[_0xfba7('0x8')](_0x40e471);var _0x3216dd=_0x2fa8fe[_0xfba7('0x6')]?_0x55009e[_0xfba7('0x10')]:_0x2fa8fe['tag'];_0x2863bd=_0x3216dd?!![]:![];return sqlUtils[_0xfba7('0x11')](_0x4389a7,_0x3216dd);})['then'](function(_0x13ed5a){_0x20a4f1[_0xfba7('0x12')]=_0x13ed5a;if(_0x20a4f1['count']===0x0){return;}if(_0x2fa8fe[_0xfba7('0x13')]){_0x2efa0a=!![];}return sqlUtils['buildContactsQuery'](_0x4389a7,_0x2fa8fe[_0xfba7('0xa')],_0x3c14b5,_0x2863bd,_0x55009e[_0xfba7('0xc')],_0x2efa0a);})[_0xfba7('0x5')](function(_0x3ce18c){if(!_0x3ce18c){return[];}return sqlUtils[_0xfba7('0x14')](_0x3ce18c,_0x2fa8fe,_0x3c14b5);})[_0xfba7('0x5')](function(_0x1c7a05){_0x20a4f1[_0xfba7('0x15')]=_0x1c7a05;return _0x20a4f1;})[_0xfba7('0x16')](function(_0x5c6f35){throw _0x5c6f35;});};exports['describe']=function(){var _0x226336={};var _0x4d9cb0=[];return db[_0xfba7('0x17')][_0xfba7('0x18')]()[_0xfba7('0x5')](function(_0x161890){_0x226336=_0x161890;var _0x3b775a=Object[_0xfba7('0x19')](_0x226336)['filter'](function(_0x280ce6){return _[_0xfba7('0x1a')](_0x280ce6,'cf_')?_0x280ce6:undefined;});var _0x51128a=_0x3b775a['map'](function(_0x450ad8){return db['CmCustomField']['findOne']({'where':{'id':_0x450ad8[_0xfba7('0x1b')](0x3)},'raw':!![]});});return Promise['all'](_0x51128a);})[_0xfba7('0x5')](function(_0x48dd15){for(var _0x4d21eb=0x0;_0x4d21eb<_0x48dd15[_0xfba7('0x1c')];_0x4d21eb++){if(_0x48dd15[_0x4d21eb]){var _0x3681eb=_0xfba7('0x1d')+_0x48dd15[_0x4d21eb]['id'];_0x226336[_0x3681eb][_0xfba7('0x1e')]=_0x48dd15[_0x4d21eb][_0xfba7('0x1f')];}}_0x4d9cb0=_[_0xfba7('0x20')](Object['keys'](_0x226336),function(_0x5f2a27){return{'name':_0x5f2a27,'type':_0x226336[_0x5f2a27]['type']};});return _0x4d9cb0;})[_0xfba7('0x16')](function(_0x4a3d1f){throw _0x4a3d1f;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 5742132..6194c89 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4c9=['User','and','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','fields','tag','filter','then','search','role','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','subqry.id','order','subqry.','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','Tags','clone','COUNT(*)','SELECT','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','length','conditions','dateOfBirth','fieldType','DATE','buildExpression','type','default','text','end','Tag','value','map','tags','clause','ids','user','uc.UserId\x20=\x20?','keys','some','name','compact','Contact'];(function(_0x3c1b91,_0x4b4914){var _0x43881b=function(_0x284bc2){while(--_0x284bc2){_0x3c1b91['push'](_0x3c1b91['shift']());}};_0x43881b(++_0x4b4914);}(_0xf4c9,0x1b3));var _0x9f4c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf4c9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9f4c('0x0'));var squel=require('squel');var as=require(_0x9f4c('0x1'));var qs=require(_0x9f4c('0x2'));var utils=require(_0x9f4c('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x2bb415,_0x2768ab){var _0x1e8d86=![];if(_0x2bb415['role']===_0x9f4c('0x4')&&!_0x2768ab['search']&&!_0x2768ab[_0x9f4c('0x5')]&&_0x2768ab[_0x9f4c('0x6')]!==_0x9f4c('0x7')){_0x1e8d86=!![];}return _0x1e8d86;}function getContactsSubquery(){return squel[_0x9f4c('0x8')]()[_0x9f4c('0x9')]('cm_contacts','c')[_0x9f4c('0xa')](_0x9f4c('0xb'));}function applyJoinClauses(_0x6f32d4,_0x57d9ba){var _0x550d0c=_0x57d9ba?'c':_0x9f4c('0xc');_0x6f32d4[_0x9f4c('0xd')](_0x9f4c('0xe'),'uc',_0x9f4c('0xf')+_0x550d0c+_0x9f4c('0x10'))[_0x9f4c('0xd')](_0x9f4c('0x11'),'ct',_0x9f4c('0x12')+_0x550d0c+_0x9f4c('0x10'))[_0x9f4c('0xd')](_0x9f4c('0x13'),'t',_0x9f4c('0x14'));return _0x6f32d4;}function addFieldsToQuery(_0x4a7292,_0x2a4e66,_0x3ea048,_0x48b28f,_0x528f62){var _0x27ca23=_0x528f62?'c':_0x9f4c('0xc');if(!_0x2a4e66){_0x2a4e66=['id',_0x9f4c('0x15'),'lastName',_0x9f4c('0x16'),_0x9f4c('0x17'),_0x9f4c('0x18'),_0x9f4c('0x19'),_0x9f4c('0x5'),'CompanyId',_0x9f4c('0x1a'),_0x9f4c('0x1b'),_0x9f4c('0x1c'),_0x9f4c('0x1d')];}else if(!_0x2a4e66[_0x9f4c('0x1e')]('id')){_0x2a4e66[_0x9f4c('0x1f')]('id');}var _0x5d6a4d=_0x3ea048&&_0x528f62||!_0x3ea048&&!_0x528f62;if(_0x48b28f){_0x5d6a4d=_0x48b28f&&_0x528f62||!_0x48b28f&&!_0x528f62;}_0x2a4e66[_0x9f4c('0x20')](function(_0x4cb843){if(_0x4cb843===_0x9f4c('0x1d')){if(_0x5d6a4d){_0x4a7292[_0x9f4c('0x21')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4cb843);}else if(_0x3ea048||_0x48b28f){_0x4a7292['field'](_0x27ca23+'.'+_0x4cb843);}}else{_0x4a7292[_0x9f4c('0x21')](_0x27ca23+'.'+_0x4cb843);}});return _0x4a7292;}function getSqlClauses(){var _0x56002e={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x9f4c('0x22')](),'tags':{'clause':squel[_0x9f4c('0x22')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x56002e;}function parseTagParameter(_0x360dca){var _0x444da1=squel[_0x9f4c('0x22')]();if(_0x360dca){var _0x150fe5=utils[_0x9f4c('0x23')](_0x360dca);_0x150fe5[_0x9f4c('0x20')](function(_0x207b74){_0x444da1['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x207b74+',%');});}return _0x444da1;}function parseSearchFilter(_0x2a8d5f){var _0x2e232a=squel[_0x9f4c('0x22')]();if(_0x2a8d5f){var _0x447693=_0x2a8d5f[_0x9f4c('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x447693[_0x9f4c('0x25')]('\x20')['length']>0x1){_0x2e232a['or'](_0x9f4c('0x26'),qs['getFullTextValue'](_0x447693,!![]),null);}else{if(qs['isNumeric'](_0x447693)){_0x2e232a['or'](_0x9f4c('0x27'),_0x447693+'%');_0x2e232a['or'](_0x9f4c('0x28'),_0x447693+'%');_0x2e232a['or'](_0x9f4c('0x29'),_0x447693+'%');_0x2e232a['or']('c.fax\x20LIKE\x20?',_0x447693+'%');}else if(qs[_0x9f4c('0x2a')](_0x447693)){_0x2e232a['or'](_0x9f4c('0x2b'),_0x447693+'%');}else{_0x2e232a['or']('c.firstName\x20LIKE\x20?','%'+_0x447693+'%');_0x2e232a['or'](_0x9f4c('0x2c'),'%'+_0x447693+'%');_0x2e232a['or'](_0x9f4c('0x2b'),'%'+_0x447693+'%');}}}return _0x2e232a;}function parseAdvancedSearchFilter(_0x26aa09,_0x12b8df){var _0x57512e=getSqlClauses();var _0x80a6bc=as[_0x9f4c('0x2d')](_0x26aa09);var _0x31b18c=_0x80a6bc[_0x9f4c('0x2e')];for(var _0x3727a8=0x0;_0x3727a8<_0x80a6bc['conditions'][_0x9f4c('0x2f')];_0x3727a8++){var _0x58f380=_0x80a6bc[_0x9f4c('0x30')][_0x3727a8];var _0x45ebf2='c';var _0x3e9f26=_['find'](_0x12b8df,['name',_0x58f380[_0x9f4c('0x21')]]);if(_0x3e9f26){if(_0x58f380[_0x9f4c('0x21')]===_0x9f4c('0x31')||_0x3e9f26[_0x9f4c('0x32')]==='datetime'){_0x58f380['castTo']=_0x9f4c('0x33');}var _0x18e96c=as[_0x9f4c('0x34')](_0x45ebf2,_0x3e9f26[_0x9f4c('0x35')],_0x58f380);_0x57512e[_0x9f4c('0x36')][_0x31b18c](_0x18e96c[_0x9f4c('0x37')],_0x18e96c['value']['start'],_0x18e96c['value'][_0x9f4c('0x38')]);}else{if(_0x58f380[_0x9f4c('0x21')]===_0x9f4c('0x39')){var _0x13d185=_0x58f380[_0x9f4c('0x3a')][_0x9f4c('0x25')](',')[_0x9f4c('0x3b')](function(_0x21f0df){return Number(_0x21f0df);});var _0x1aaab4=parseTagParameter(_0x13d185);_0x57512e[_0x9f4c('0x3c')][_0x9f4c('0x3d')]['and'](_0x1aaab4);_0x57512e[_0x9f4c('0x3c')][_0x9f4c('0x3e')]=_0x13d185;}else if(_0x58f380[_0x9f4c('0x21')]==='User'){_0x57512e[_0x9f4c('0x3f')][_0x9f4c('0x3d')]['and'](_0x9f4c('0x40'),_0x58f380[_0x9f4c('0x3a')]);_0x57512e['user']['skip']=!![];}}}return _0x57512e;}function parseModelFields(_0x5dc438,_0x23cd79){var _0x37bb37=squel[_0x9f4c('0x22')]();var _0x319415=_(_0x5dc438)[_0x9f4c('0x41')]()[_0x9f4c('0x3b')](function(_0x1ac627){return _[_0x9f4c('0x42')](_0x23cd79,[_0x9f4c('0x43'),_0x1ac627])?_0x1ac627:undefined;})[_0x9f4c('0x44')]()['value']();if(_0x5dc438[_0x9f4c('0x45')]){_0x319415[_0x9f4c('0x1f')](_0x9f4c('0x45'));}if(_0x5dc438[_0x9f4c('0x46')]){_0x319415[_0x9f4c('0x1f')](_0x9f4c('0x46'));}if(_0x319415[_0x9f4c('0x2f')]>0x0){_0x319415[_0x9f4c('0x20')](function(_0x3c1939){if(_0x3c1939===_0x9f4c('0x5')){_0x37bb37[_0x9f4c('0x47')](_0x9f4c('0x48'),[][_0x9f4c('0x49')](_0x5dc438[_0x3c1939]));}else if(_0x3c1939===_0x9f4c('0x45')){var _0x79174f='%'+_0x5dc438[_0x3c1939]+'%';_0x37bb37[_0x9f4c('0x47')](_0x9f4c('0x4a'),_0x79174f);}else if(_0x3c1939===_0x9f4c('0x46')){_0x37bb37['and']('uc.UserId\x20=\x20?',_0x5dc438[_0x3c1939]);}else{_0x37bb37['and']('c.'+_0x3c1939+_0x9f4c('0x4b'),_0x5dc438[_0x3c1939]);}});}return _0x37bb37;}function parseQueryParameters(_0x5d354a,_0x39235f){var _0x4dbd50=getSqlClauses();return Promise[_0x9f4c('0x4c')]()['then'](function(){return parseModelFields(_0x5d354a,_0x39235f);})['then'](function(_0x524de7){_0x4dbd50[_0x9f4c('0x4d')][_0x9f4c('0x47')](_0x524de7);return parseTagParameter(_0x5d354a[_0x9f4c('0x4e')]);})['then'](function(_0x1d67e){_0x4dbd50[_0x9f4c('0x3c')]['clause']['and'](_0x1d67e);return parseSearchFilter(_0x5d354a[_0x9f4c('0x4f')]);})[_0x9f4c('0x50')](function(_0x58ecf5){_0x4dbd50['filter']=_0x58ecf5;return _0x4dbd50;});}function checkListsRestrictions(_0x34f54e,_0x2c03f3,_0xf4371b){var _0x4264bb=squel[_0x9f4c('0x22')]();return Promise[_0x9f4c('0x4c')]()['then'](function(){if(_0x2c03f3[_0x9f4c('0x51')]&&_0x34f54e[_0x9f4c('0x52')]===_0x9f4c('0x4')&&!_0xf4371b){return _0x34f54e['getLists']({'attributes':['id'],'raw':!![]});}})[_0x9f4c('0x50')](function(_0x3cf6ea){if(_0x3cf6ea){if(_0x3cf6ea[_0x9f4c('0x2f')]===0x0){_0x4264bb[_0x9f4c('0x47')](_0x9f4c('0x53'));}else{_0x4264bb['and'](_0x9f4c('0x48'),_['map'](_0x3cf6ea,'id'));}}})[_0x9f4c('0x50')](function(){return _0x4264bb;});}function buildContactsQuery(_0x4a659e,_0x464825,_0x7abe4,_0x41b267,_0x3759ee,_0x2e62c7){if(_0x464825){_0x464825=_0x7abe4['attributes'];}_0x4a659e=addFieldsToQuery(_0x4a659e,_0x464825,_0x41b267,_0x2e62c7,!![]);var _0x302a24=squel[_0x9f4c('0x8')]();_0x302a24=addFieldsToQuery(_0x302a24,_0x464825,_0x41b267,_0x2e62c7,![]);if(_0x41b267||_0x2e62c7){_0x4a659e=applyJoinClauses(_0x4a659e,!![]);_0x4a659e[_0x9f4c('0x54')](_0x9f4c('0x55'));if(_0x7abe4[_0x9f4c('0x56')]){_0x302a24[_0x9f4c('0x56')](_0x7abe4['limit']);}if(_0x7abe4[_0x9f4c('0x57')]){_0x302a24[_0x9f4c('0x57')](_0x7abe4[_0x9f4c('0x57')]);}}else{_0x302a24=applyJoinClauses(_0x302a24,![]);_0x302a24[_0x9f4c('0x54')](_0x9f4c('0x58'));if(_0x7abe4[_0x9f4c('0x56')]){_0x4a659e[_0x9f4c('0x56')](_0x7abe4['limit']);}if(_0x7abe4[_0x9f4c('0x57')]){_0x4a659e['offset'](_0x7abe4[_0x9f4c('0x57')]);}}_0x302a24['having'](_0x3759ee);if(_0x7abe4[_0x9f4c('0x59')]){_0x7abe4[_0x9f4c('0x59')][_0x9f4c('0x20')](function(_0x219556){_0x4a659e[_0x9f4c('0x59')]('c.'+_0x219556[0x0],_0x219556[0x1]==='DESC'?![]:!![]);_0x302a24[_0x9f4c('0x59')](_0x9f4c('0x5a')+_0x219556[0x0],_0x219556[0x1]==='DESC'?![]:!![]);});}_0x302a24[_0x9f4c('0x9')](_0x4a659e,_0x9f4c('0xc'));return _0x302a24;}function getFilteredContacts(_0x5d5484){var _0x55ab02=[];return db[_0x9f4c('0x39')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0x9f4c('0x50')](function(_0x3bc468){_0x55ab02=_[_0x9f4c('0x5b')](_0x3bc468,'id');var _0x16fdab={'type':db[_0x9f4c('0x5c')][_0x9f4c('0x5d')]['SELECT'],'model':db[_0x9f4c('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9f4c('0x5f')][_0x9f4c('0x60')](_0x5d5484['toString'](),_0x16fdab);})[_0x9f4c('0x50')](function(_0xb7757c){_0xb7757c[_0x9f4c('0x20')](function(_0x2533c2){if(_0x2533c2[_0x9f4c('0x1d')]){_0x2533c2[_0x9f4c('0x61')]=[];_0x2533c2[_0x9f4c('0x1d')][_0x9f4c('0x25')](',')[_0x9f4c('0x20')](function(_0x37dc51){_0x2533c2[_0x9f4c('0x61')][_0x9f4c('0x1f')](_0x55ab02[_0x37dc51]);});}delete _0x2533c2['TagIds'];});return _0xb7757c;});}function countFilteredContacts(_0x34bfb1,_0x482f0b){var _0x176f22=_0x34bfb1[_0x9f4c('0x62')]();_0x176f22[_0x9f4c('0x21')](_0x9f4c('0x63'));_0x176f22=applyJoinClauses(_0x176f22,!![]);_0x34bfb1[_0x9f4c('0x54')](_0x9f4c('0x55'));var _0x17a4fa=utils['getSelectedTags'](_0x482f0b);if(!_['isEmpty'](_0x17a4fa)){_0x176f22['where']('t.id\x20IN\x20?',_0x17a4fa);}var _0x4f6310={'type':db[_0x9f4c('0x5c')][_0x9f4c('0x5d')][_0x9f4c('0x64')],'raw':!![]};return db[_0x9f4c('0x5f')]['query'](_0x176f22['toString'](),_0x4f6310)[_0x9f4c('0x50')](function(_0x1ca6ae){return _0x1ca6ae[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x655a=['c.id','limit','offset','group','subqry.id','order','subqry.','DESC','findAll','color','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','split','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','where','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','mobile','fax','ListId','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','replace','length','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','datetime','castTo','buildExpression','type','default','text','start','value','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes'];(function(_0x336da1,_0x58f3e9){var _0x4fb34d=function(_0x4d5d58){while(--_0x4d5d58){_0x336da1['push'](_0x336da1['shift']());}};_0x4fb34d(++_0x58f3e9);}(_0x655a,0x1cd));var _0xa655=function(_0x446af8,_0x29a80c){_0x446af8=_0x446af8-0x0;var _0x489288=_0x655a[_0x446af8];return _0x489288;};'use strict';var _=require('lodash');var squel=require(_0xa655('0x0'));var as=require(_0xa655('0x1'));var qs=require(_0xa655('0x2'));var utils=require(_0xa655('0x3'));var db=require(_0xa655('0x4'))['db'];function skipContactsQuery(_0x203516,_0x2198f9){var _0xa567c8=![];if(_0x203516[_0xa655('0x5')]===_0xa655('0x6')&&!_0x2198f9[_0xa655('0x7')]&&!_0x2198f9['ListId']&&_0x2198f9['autocomplete']!==_0xa655('0x8')){_0xa567c8=!![];}return _0xa567c8;}function getContactsSubquery(){return squel[_0xa655('0x9')]()[_0xa655('0xa')](_0xa655('0xb'),'c')['where'](_0xa655('0xc'));}function applyJoinClauses(_0x1aae8d,_0x3b7e15){var _0x43f835=_0x3b7e15?'c':_0xa655('0xd');_0x1aae8d['left_join'](_0xa655('0xe'),'uc',_0xa655('0xf')+_0x43f835+_0xa655('0x10'))[_0xa655('0x11')](_0xa655('0x12'),'ct',_0xa655('0x13')+_0x43f835+'.id')[_0xa655('0x11')](_0xa655('0x14'),'t',_0xa655('0x15'));return _0x1aae8d;}function addFieldsToQuery(_0x227231,_0x4d514f,_0xe91bd9,_0x5c4d31,_0x6c1338){var _0xdbcb66=_0x6c1338?'c':_0xa655('0xd');if(!_0x4d514f){_0x4d514f=['id','firstName',_0xa655('0x16'),'phone',_0xa655('0x17'),_0xa655('0x18'),'email',_0xa655('0x19'),_0xa655('0x1a'),'createdAt',_0xa655('0x1b'),_0xa655('0x1c'),_0xa655('0x1d')];}else if(!_0x4d514f[_0xa655('0x1e')]('id')){_0x4d514f[_0xa655('0x1f')]('id');}var _0x32d52e=_0xe91bd9&&_0x6c1338||!_0xe91bd9&&!_0x6c1338;if(_0x5c4d31){_0x32d52e=_0x5c4d31&&_0x6c1338||!_0x5c4d31&&!_0x6c1338;}_0x4d514f[_0xa655('0x20')](function(_0x48059f){if(_0x48059f==='TagIds'){if(_0x32d52e){_0x227231[_0xa655('0x21')](_0xa655('0x22'),_0x48059f);}else if(_0xe91bd9||_0x5c4d31){_0x227231[_0xa655('0x21')](_0xdbcb66+'.'+_0x48059f);}}else{_0x227231[_0xa655('0x21')](_0xdbcb66+'.'+_0x48059f);}});return _0x227231;}function getSqlClauses(){var _0x18cf2c={'default':squel[_0xa655('0x23')](),'fields':squel['expr'](),'filter':squel[_0xa655('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xa655('0x23')](),'skip':![]}};return _0x18cf2c;}function parseTagParameter(_0x2287ee){var _0x3ef443=squel[_0xa655('0x23')]();if(_0x2287ee){var _0x26190e=utils['getSelectedTags'](_0x2287ee);_0x26190e[_0xa655('0x20')](function(_0x157410){_0x3ef443['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x157410+',%');});}return _0x3ef443;}function parseSearchFilter(_0x3b8ffe){var _0x2671ea=squel[_0xa655('0x23')]();if(_0x3b8ffe){var _0x1bd42e=_0x3b8ffe[_0xa655('0x24')]('\x5c','\x5c\x5c')[_0xa655('0x24')](/'/g,'\x27\x27');if(_0x1bd42e['split']('\x20')[_0xa655('0x25')]>0x1){_0x2671ea['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1bd42e,!![]),null);}else{if(qs[_0xa655('0x26')](_0x1bd42e)){_0x2671ea['or']('c.id\x20LIKE\x20?',_0x1bd42e+'%');_0x2671ea['or'](_0xa655('0x27'),_0x1bd42e+'%');_0x2671ea['or'](_0xa655('0x28'),_0x1bd42e+'%');_0x2671ea['or'](_0xa655('0x29'),_0x1bd42e+'%');}else if(qs[_0xa655('0x2a')](_0x1bd42e)){_0x2671ea['or'](_0xa655('0x2b'),_0x1bd42e+'%');}else{_0x2671ea['or'](_0xa655('0x2c'),'%'+_0x1bd42e+'%');_0x2671ea['or'](_0xa655('0x2d'),'%'+_0x1bd42e+'%');_0x2671ea['or']('c.email\x20LIKE\x20?','%'+_0x1bd42e+'%');}}}return _0x2671ea;}function parseAdvancedSearchFilter(_0xec355d,_0x3548ac){var _0x3494aa=getSqlClauses();var _0x18121a=as[_0xa655('0x2e')](_0xec355d);var _0x3cd91e=_0x18121a[_0xa655('0x2f')];for(var _0x55fcac=0x0;_0x55fcac<_0x18121a[_0xa655('0x30')]['length'];_0x55fcac++){var _0x2405d4=_0x18121a['conditions'][_0x55fcac];var _0x2b4bbe='c';var _0x6fab15=_['find'](_0x3548ac,[_0xa655('0x31'),_0x2405d4[_0xa655('0x21')]]);if(_0x6fab15){if(_0x2405d4['field']===_0xa655('0x32')||_0x6fab15['fieldType']===_0xa655('0x33')){_0x2405d4[_0xa655('0x34')]='DATE';}var _0xbc5337=as[_0xa655('0x35')](_0x2b4bbe,_0x6fab15[_0xa655('0x36')],_0x2405d4);_0x3494aa[_0xa655('0x37')][_0x3cd91e](_0xbc5337[_0xa655('0x38')],_0xbc5337['value'][_0xa655('0x39')],_0xbc5337[_0xa655('0x3a')][_0xa655('0x3b')]);}else{if(_0x2405d4[_0xa655('0x21')]===_0xa655('0x3c')){var _0x275f6a=_0x2405d4['value']['split'](',')[_0xa655('0x3d')](function(_0x4728b4){return Number(_0x4728b4);});var _0x339287=parseTagParameter(_0x275f6a);_0x3494aa[_0xa655('0x3e')][_0xa655('0x3f')][_0xa655('0x40')](_0x339287);_0x3494aa[_0xa655('0x3e')][_0xa655('0x41')]=_0x275f6a;}else if(_0x2405d4['field']===_0xa655('0x42')){_0x3494aa[_0xa655('0x43')][_0xa655('0x3f')]['and'](_0xa655('0x44'),_0x2405d4[_0xa655('0x3a')]);_0x3494aa[_0xa655('0x43')][_0xa655('0x45')]=!![];}}}return _0x3494aa;}function parseModelFields(_0x1ce7d5,_0x18e0e4){var _0x3f4ace=squel[_0xa655('0x23')]();var _0x4d46f3=_(_0x1ce7d5)[_0xa655('0x46')]()[_0xa655('0x3d')](function(_0x30e96d){return _[_0xa655('0x47')](_0x18e0e4,[_0xa655('0x31'),_0x30e96d])?_0x30e96d:undefined;})['compact']()['value']();if(_0x1ce7d5[_0xa655('0x48')]){_0x4d46f3[_0xa655('0x1f')]('Contact');}if(_0x1ce7d5[_0xa655('0x42')]){_0x4d46f3['push'](_0xa655('0x42'));}if(_0x4d46f3[_0xa655('0x25')]>0x0){_0x4d46f3['forEach'](function(_0x1e8898){if(_0x1e8898===_0xa655('0x19')){_0x3f4ace['and'](_0xa655('0x49'),[]['concat'](_0x1ce7d5[_0x1e8898]));}else if(_0x1e8898===_0xa655('0x48')){var _0x8e96e0='%'+_0x1ce7d5[_0x1e8898]+'%';_0x3f4ace[_0xa655('0x40')](_0xa655('0x4a'),_0x8e96e0);}else if(_0x1e8898==='User'){_0x3f4ace[_0xa655('0x40')](_0xa655('0x44'),_0x1ce7d5[_0x1e8898]);}else{_0x3f4ace[_0xa655('0x40')]('c.'+_0x1e8898+_0xa655('0x4b'),_0x1ce7d5[_0x1e8898]);}});}return _0x3f4ace;}function parseQueryParameters(_0x4492cb,_0x2247e0){var _0x19a727=getSqlClauses();return Promise[_0xa655('0x4c')]()[_0xa655('0x4d')](function(){return parseModelFields(_0x4492cb,_0x2247e0);})[_0xa655('0x4d')](function(_0x36a411){_0x19a727[_0xa655('0x4e')][_0xa655('0x40')](_0x36a411);return parseTagParameter(_0x4492cb[_0xa655('0x4f')]);})[_0xa655('0x4d')](function(_0x4731cf){_0x19a727[_0xa655('0x3e')][_0xa655('0x3f')][_0xa655('0x40')](_0x4731cf);return parseSearchFilter(_0x4492cb[_0xa655('0x50')]);})['then'](function(_0xbfb693){_0x19a727[_0xa655('0x50')]=_0xbfb693;return _0x19a727;});}function checkListsRestrictions(_0x3bcd28,_0x2027f7,_0x49a013){var _0x35c1b7=squel[_0xa655('0x23')]();return Promise[_0xa655('0x4c')]()[_0xa655('0x4d')](function(){if(_0x2027f7['search']&&_0x3bcd28[_0xa655('0x5')]===_0xa655('0x6')&&!_0x49a013){return _0x3bcd28[_0xa655('0x51')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x31f441){if(_0x31f441){if(_0x31f441[_0xa655('0x25')]===0x0){_0x35c1b7['and'](_0xa655('0x52'));}else{_0x35c1b7[_0xa655('0x40')](_0xa655('0x49'),_[_0xa655('0x3d')](_0x31f441,'id'));}}})[_0xa655('0x4d')](function(){return _0x35c1b7;});}function buildContactsQuery(_0x10fc8b,_0x3773c0,_0x5d36cb,_0x3f3076,_0x4c6182,_0x381a7d){if(_0x3773c0){_0x3773c0=_0x5d36cb[_0xa655('0x53')];}_0x10fc8b=addFieldsToQuery(_0x10fc8b,_0x3773c0,_0x3f3076,_0x381a7d,!![]);var _0xc74ccd=squel[_0xa655('0x9')]();_0xc74ccd=addFieldsToQuery(_0xc74ccd,_0x3773c0,_0x3f3076,_0x381a7d,![]);if(_0x3f3076||_0x381a7d){_0x10fc8b=applyJoinClauses(_0x10fc8b,!![]);_0x10fc8b['group'](_0xa655('0x54'));if(_0x5d36cb[_0xa655('0x55')]){_0xc74ccd['limit'](_0x5d36cb['limit']);}if(_0x5d36cb[_0xa655('0x56')]){_0xc74ccd[_0xa655('0x56')](_0x5d36cb[_0xa655('0x56')]);}}else{_0xc74ccd=applyJoinClauses(_0xc74ccd,![]);_0xc74ccd[_0xa655('0x57')](_0xa655('0x58'));if(_0x5d36cb['limit']){_0x10fc8b['limit'](_0x5d36cb[_0xa655('0x55')]);}if(_0x5d36cb[_0xa655('0x56')]){_0x10fc8b['offset'](_0x5d36cb[_0xa655('0x56')]);}}_0xc74ccd['having'](_0x4c6182);if(_0x5d36cb[_0xa655('0x59')]){_0x5d36cb[_0xa655('0x59')][_0xa655('0x20')](function(_0xea9284){_0x10fc8b[_0xa655('0x59')]('c.'+_0xea9284[0x0],_0xea9284[0x1]==='DESC'?![]:!![]);_0xc74ccd[_0xa655('0x59')](_0xa655('0x5a')+_0xea9284[0x0],_0xea9284[0x1]===_0xa655('0x5b')?![]:!![]);});}_0xc74ccd[_0xa655('0xa')](_0x10fc8b,_0xa655('0xd'));return _0xc74ccd;}function getFilteredContacts(_0x406f34){var _0x12ac4a=[];return db[_0xa655('0x3c')][_0xa655('0x5c')]({'attributes':['id',_0xa655('0x31'),_0xa655('0x5d')],'raw':!![]})[_0xa655('0x4d')](function(_0x5116b4){_0x12ac4a=_['keyBy'](_0x5116b4,'id');var _0x533cd0={'type':db[_0xa655('0x5e')][_0xa655('0x5f')][_0xa655('0x60')],'model':db[_0xa655('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xa655('0x62')][_0xa655('0x63')](_0x406f34[_0xa655('0x64')](),_0x533cd0);})[_0xa655('0x4d')](function(_0x214ba0){_0x214ba0[_0xa655('0x20')](function(_0x1149eb){if(_0x1149eb[_0xa655('0x1d')]){_0x1149eb['Tags']=[];_0x1149eb[_0xa655('0x1d')][_0xa655('0x65')](',')[_0xa655('0x20')](function(_0xdf795b){_0x1149eb[_0xa655('0x66')]['push'](_0x12ac4a[_0xdf795b]);});}delete _0x1149eb[_0xa655('0x1d')];});return _0x214ba0;});}function countFilteredContacts(_0x44a007,_0x3dd2e2){var _0x3c0a9e=_0x44a007[_0xa655('0x67')]();_0x3c0a9e[_0xa655('0x21')](_0xa655('0x68'));_0x3c0a9e=applyJoinClauses(_0x3c0a9e,!![]);_0x44a007['group'](_0xa655('0x54'));var _0x5d6efb=utils[_0xa655('0x69')](_0x3dd2e2);if(!_[_0xa655('0x6a')](_0x5d6efb)){_0x3c0a9e[_0xa655('0x6b')]('t.id\x20IN\x20?',_0x5d6efb);}var _0x42634b={'type':db[_0xa655('0x5e')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0xa655('0x63')](_0x3c0a9e[_0xa655('0x64')](),_0x42634b)[_0xa655('0x4d')](function(_0x1b89a2){return _0x1b89a2[0x0][_0xa655('0x68')];});}module[_0xa655('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 8e47d93..8189fbc 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 _0xea1c=['filter','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','write','end','binary','close','unlink','decryptFile','createDecipher','final','utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0xea1c,0xe5));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xcea1('0x0'));var fs=require('fs');var BPromise=require(_0xcea1('0x1'));var _=require(_0xcea1('0x2'));var config=require(_0xcea1('0x3'));var logger=require(_0xcea1('0x4'))(_0xcea1('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xcea1('0x6')][_0xcea1('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xcea1('0x8')};if(config[_0xcea1('0x9')]&&config['encrypt'][_0xcea1('0xa')]){var isSupported=isAlgorithmSupported(config[_0xcea1('0x9')][_0xcea1('0xa')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0xcea1('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xcea1('0xb')](',\x20');logger[_0xcea1('0xc')](config[_0xcea1('0x9')][_0xcea1('0xa')],_0xcea1('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x1a085e){return AES_SUPPORTED_RX[_0xcea1('0xe')](_0x1a085e);}function getSupportedCiphers(){return crypto[_0xcea1('0xf')]()[_0xcea1('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x42a9cb){return getSupportedCiphers()['indexOf'](_0x42a9cb)>-0x1;}function combineOptions(_0x503cee){var _0x1b68e9={};for(var _0x30a81b in fileOptions){if(fileOptions['hasOwnProperty'](_0x30a81b)){_0x1b68e9[_0x30a81b]=fileOptions[_0x30a81b];}}if(_0x503cee){for(var _0x535499 in _0x503cee){if(_0x503cee[_0xcea1('0x11')](_0x535499)){_0x1b68e9[_0x535499]=_0x503cee[_0x535499];}}}return _0x1b68e9;}exports['encryptFile']=function(_0x216d48,_0x5a6f53,_0xd40e8a,_0xc4da80){return new BPromise(function(_0x5afb74,_0xf62fe1){_0xc4da80=combineOptions(_0xc4da80);var _0x2cad61=new Buffer(_0xd40e8a);var _0x2e8cb8=fs[_0xcea1('0x12')](_0x216d48);var _0x22122b=fs[_0xcea1('0x13')](_0x5a6f53);var _0x1cc858=crypto[_0xcea1('0x14')](_0xc4da80[_0xcea1('0xa')],_0x2cad61);_0x2e8cb8['on'](_0xcea1('0x15'),function(_0x164577){var _0x50e6d2=new Buffer(_0x1cc858[_0xcea1('0x16')](_0x164577),'binary');_0x22122b[_0xcea1('0x17')](_0x50e6d2);});_0x2e8cb8['on'](_0xcea1('0x18'),function(){try{var _0x55548d=new Buffer(_0x1cc858['final']('binary'),_0xcea1('0x19'));_0x22122b[_0xcea1('0x17')](_0x55548d);_0x22122b[_0xcea1('0x18')]();_0x22122b['on'](_0xcea1('0x1a'),function(){return _0x5afb74(_0x5a6f53);});}catch(_0x5af03a){fs[_0xcea1('0x1b')](_0x5a6f53);return _0xf62fe1(_0x5af03a);}});});};exports[_0xcea1('0x1c')]=function(_0x84a72c,_0x772637,_0x2b61f3,_0x19e03b){return new BPromise(function(_0x442a47,_0x5eabae){_0x19e03b=combineOptions(_0x19e03b);var _0xf11923=new Buffer(_0x2b61f3);var _0x3701f4=fs[_0xcea1('0x12')](_0x84a72c);var _0x577e8c=fs['createWriteStream'](_0x772637);var _0x2edd3e=crypto[_0xcea1('0x1d')](_0x19e03b[_0xcea1('0xa')],_0xf11923);_0x3701f4['on'](_0xcea1('0x15'),function(_0x4e2da1){var _0xbb17c=new Buffer(_0x2edd3e[_0xcea1('0x16')](_0x4e2da1),_0xcea1('0x19'));_0x577e8c['write'](_0xbb17c);});_0x3701f4['on'](_0xcea1('0x18'),function(){try{var _0x3c7c8f=new Buffer(_0x2edd3e[_0xcea1('0x1e')]('binary'),'binary');_0x577e8c[_0xcea1('0x17')](_0x3c7c8f);_0x577e8c[_0xcea1('0x18')]();_0x577e8c['on'](_0xcea1('0x1a'),function(){return _0x442a47(_0x772637);});}catch(_0x3ce2d3){fs[_0xcea1('0x1b')](_0x772637);return _0x5eabae(_0x3ce2d3);}});});};exports['encryptString']=function(_0x399403,_0x5b3af7,_0x4d603c){var _0x52c3a1=_0x4d603c||stringOptions['algorithm'];var _0x2a6605=_0x5b3af7||stringOptions['secret'];var _0x15a62e=crypto['createCipher'](_0x52c3a1,_0x2a6605);var _0x237d67=_0x15a62e[_0xcea1('0x16')](_0x399403,_0xcea1('0x1f'),_0xcea1('0x20'));_0x237d67+=_0x15a62e[_0xcea1('0x1e')](_0xcea1('0x20'));return _0x237d67;};exports[_0xcea1('0x21')]=function(_0x5b0cb4,_0xd43c2a,_0x4cb5e4){var _0x128b06=_0x4cb5e4||stringOptions['algorithm'];var _0x5b4df0=_0xd43c2a||stringOptions[_0xcea1('0x22')];var _0x3aa5f=crypto[_0xcea1('0x1d')](_0x128b06,_0x5b4df0);var _0x1c463d=_0x3aa5f[_0xcea1('0x16')](_0x5b0cb4,_0xcea1('0x20'),_0xcea1('0x1f'));_0x1c463d+=_0x3aa5f[_0xcea1('0x1e')](_0xcea1('0x1f'));return _0x1c463d;}; \ No newline at end of file +var _0x7c0c=['createWriteStream','createCipher','data','update','binary','write','final','end','close','decryptFile','createDecipher','unlink','encryptString','secret','utf8','base64','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','indexOf','hasOwnProperty','encryptFile','createReadStream'];(function(_0x283b93,_0x1e48c5){var _0x56c8dd=function(_0x1b707f){while(--_0x1b707f){_0x283b93['push'](_0x283b93['shift']());}};_0x56c8dd(++_0x1e48c5);}(_0x7c0c,0xe2));var _0xc7c0=function(_0x486b88,_0x10faca){_0x486b88=_0x486b88-0x0;var _0x20dee9=_0x7c0c[_0x486b88];return _0x20dee9;};'use strict';var crypto=require(_0xc7c0('0x0'));var fs=require('fs');var BPromise=require(_0xc7c0('0x1'));var _=require(_0xc7c0('0x2'));var config=require(_0xc7c0('0x3'));var logger=require('../../config/logger')(_0xc7c0('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc7c0('0x5')][_0xc7c0('0x6')],'algorithm':_0xc7c0('0x7')};const fileOptions={'algorithm':_0xc7c0('0x8')};if(config[_0xc7c0('0x9')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0xc7c0('0x9')][_0xc7c0('0xa')]);if(isSupported){fileOptions[_0xc7c0('0xa')]=config[_0xc7c0('0x9')][_0xc7c0('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc7c0('0xb')](',\x20');logger[_0xc7c0('0xc')](config['encrypt']['algorithm'],_0xc7c0('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x3dab59){return AES_SUPPORTED_RX[_0xc7c0('0xe')](_0x3dab59);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x5342d6){return getSupportedCiphers()[_0xc7c0('0xf')](_0x5342d6)>-0x1;}function combineOptions(_0x393fc3){var _0x467e3c={};for(var _0x3ecde5 in fileOptions){if(fileOptions[_0xc7c0('0x10')](_0x3ecde5)){_0x467e3c[_0x3ecde5]=fileOptions[_0x3ecde5];}}if(_0x393fc3){for(var _0x13f535 in _0x393fc3){if(_0x393fc3[_0xc7c0('0x10')](_0x13f535)){_0x467e3c[_0x13f535]=_0x393fc3[_0x13f535];}}}return _0x467e3c;}exports[_0xc7c0('0x11')]=function(_0x1aef37,_0x5e047d,_0x1af0bd,_0x754cb3){return new BPromise(function(_0xda7618,_0x6a5d2d){_0x754cb3=combineOptions(_0x754cb3);var _0x319bdb=new Buffer(_0x1af0bd);var _0x23b8f5=fs[_0xc7c0('0x12')](_0x1aef37);var _0x28ff4f=fs[_0xc7c0('0x13')](_0x5e047d);var _0x8d62b9=crypto[_0xc7c0('0x14')](_0x754cb3['algorithm'],_0x319bdb);_0x23b8f5['on'](_0xc7c0('0x15'),function(_0x192aa9){var _0x10fcf1=new Buffer(_0x8d62b9[_0xc7c0('0x16')](_0x192aa9),_0xc7c0('0x17'));_0x28ff4f[_0xc7c0('0x18')](_0x10fcf1);});_0x23b8f5['on']('end',function(){try{var _0x2fb143=new Buffer(_0x8d62b9[_0xc7c0('0x19')](_0xc7c0('0x17')),'binary');_0x28ff4f[_0xc7c0('0x18')](_0x2fb143);_0x28ff4f[_0xc7c0('0x1a')]();_0x28ff4f['on'](_0xc7c0('0x1b'),function(){return _0xda7618(_0x5e047d);});}catch(_0x449250){fs['unlink'](_0x5e047d);return _0x6a5d2d(_0x449250);}});});};exports[_0xc7c0('0x1c')]=function(_0x1edfa6,_0x3b881b,_0x21ae06,_0x2bd401){return new BPromise(function(_0x3fcfd3,_0x47f63b){_0x2bd401=combineOptions(_0x2bd401);var _0x5a5fdb=new Buffer(_0x21ae06);var _0x5de5d0=fs[_0xc7c0('0x12')](_0x1edfa6);var _0x5a677d=fs[_0xc7c0('0x13')](_0x3b881b);var _0x1ed652=crypto[_0xc7c0('0x1d')](_0x2bd401[_0xc7c0('0xa')],_0x5a5fdb);_0x5de5d0['on']('data',function(_0x3fe9a3){var _0x62f65b=new Buffer(_0x1ed652[_0xc7c0('0x16')](_0x3fe9a3),'binary');_0x5a677d[_0xc7c0('0x18')](_0x62f65b);});_0x5de5d0['on'](_0xc7c0('0x1a'),function(){try{var _0x5605ed=new Buffer(_0x1ed652[_0xc7c0('0x19')](_0xc7c0('0x17')),_0xc7c0('0x17'));_0x5a677d['write'](_0x5605ed);_0x5a677d['end']();_0x5a677d['on'](_0xc7c0('0x1b'),function(){return _0x3fcfd3(_0x3b881b);});}catch(_0x215278){fs[_0xc7c0('0x1e')](_0x3b881b);return _0x47f63b(_0x215278);}});});};exports[_0xc7c0('0x1f')]=function(_0x338093,_0x363a93,_0x3785db){var _0x456d16=_0x3785db||stringOptions[_0xc7c0('0xa')];var _0x3458d6=_0x363a93||stringOptions[_0xc7c0('0x20')];var _0x2733c9=crypto[_0xc7c0('0x14')](_0x456d16,_0x3458d6);var _0x24543c=_0x2733c9[_0xc7c0('0x16')](_0x338093,_0xc7c0('0x21'),_0xc7c0('0x22'));_0x24543c+=_0x2733c9[_0xc7c0('0x19')](_0xc7c0('0x22'));return _0x24543c;};exports['decryptString']=function(_0x46e17d,_0x4af487,_0x28c136){var _0x11e368=_0x28c136||stringOptions['algorithm'];var _0x2f891c=_0x4af487||stringOptions[_0xc7c0('0x20')];var _0x3891fe=crypto['createDecipher'](_0x11e368,_0x2f891c);var _0x36dfb0=_0x3891fe[_0xc7c0('0x16')](_0x46e17d,_0xc7c0('0x22'),_0xc7c0('0x21'));_0x36dfb0+=_0x3891fe[_0xc7c0('0x19')](_0xc7c0('0x21'));return _0x36dfb0;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 35e47ed..f313268 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 _0x78d9=['to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','lodash'];(function(_0x5d05c6,_0x482c6e){var _0x52403a=function(_0x256a97){while(--_0x256a97){_0x5d05c6['push'](_0x5d05c6['shift']());}};_0x52403a(++_0x482c6e);}(_0x78d9,0x156));var _0x978d=function(_0x3dcd7d,_0x184b2e){_0x3dcd7d=_0x3dcd7d-0x0;var _0x34d496=_0x78d9[_0x3dcd7d];return _0x34d496;};'use strict';var util=require('util');var path=require('path');var _=require(_0x978d('0x0'));var csv=require(_0x978d('0x1'));var fs=require('fs');var BPromise=require(_0x978d('0x2'));var zipdir=require(_0x978d('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x978d('0x4'))[_0x978d('0x5')];var logger=require(_0x978d('0x6'))(_0x978d('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x978d('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x978d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x16f2ea,_0x49d0dc){var _0x554c1f={'status':_0x16f2ea};var _0x1a90d5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49d0dc){_0x554c1f[_0x978d('0x9')]=_0x49d0dc;}return db[_0x978d('0xa')][_0x978d('0xb')](_0x554c1f,_0x1a90d5);}function main(){var _0x1665c6=0x1388;var _0x192085;logger[_0x978d('0xc')](util['format'](_0x978d('0xd'),EXTRACTED_REPORT_ID,_0x978d('0xe')));return db[_0x978d('0xf')][_0x978d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x978d('0x11'),_0x978d('0x12')]})[_0x978d('0x13')](function(_0x425dd7){if(_0x425dd7){_0x192085=_0x425dd7;_0x1665c6=_0x192085[_0x978d('0x12')]||0x1388;}})[_0x978d('0x13')](function(){return dbH[_0x978d('0x14')]['query'](util[_0x978d('0x15')](_0x978d('0x16'),QUERY),{'type':dbH['sequelize'][_0x978d('0x17')][_0x978d('0x18')]});})[_0x978d('0x13')](function(_0x32c48c){if(!_0x32c48c[0x0][_0x978d('0x19')]){return analyticExtractedReport(_0x978d('0x1a'));}var _0x1e5f79=[];var _0x50a8e7=0x0;if(_0x192085[_0x978d('0x11')]){if(_0x32c48c&&_0x32c48c[_0x978d('0x1b')]){var _0x53f061=_['range'](_0x32c48c[0x0][_0x978d('0x19')]/_0x1665c6);var _0x3c64ea=Number[_0x978d('0x1c')](_0x32c48c[0x0][_0x978d('0x19')]/_0x1665c6)?_0x32c48c[0x0][_0x978d('0x19')]%_0x1665c6:0x0;_0x53f061[_0x978d('0x1d')](function(_0x45c486){if(_0x45c486>0x0){_0x50a8e7+=_0x1665c6;}_0x1e5f79['push'](dbH[_0x978d('0x14')][_0x978d('0x1e')](util[_0x978d('0x15')](_0x978d('0x1f'),QUERY,_0x1665c6,_0x50a8e7),{'type':dbH[_0x978d('0x14')][_0x978d('0x17')][_0x978d('0x18')]}));});if(_0x3c64ea>0x0){_0x50a8e7+=_0x1665c6;_0x1e5f79[_0x978d('0x20')](dbH[_0x978d('0x14')][_0x978d('0x1e')](util[_0x978d('0x15')](_0x978d('0x1f'),QUERY,_0x3c64ea,_0x50a8e7),{'type':dbH[_0x978d('0x14')][_0x978d('0x17')][_0x978d('0x18')]}));}}}else{_0x1e5f79[_0x978d('0x20')](dbH[_0x978d('0x14')][_0x978d('0x1e')](QUERY,{'type':dbH[_0x978d('0x14')]['QueryTypes']['SELECT']}));}var _0x1cda59=path[_0x978d('0x21')](PATH);var _0x3a9948=path['basename'](PATH,_0x978d('0x22'));var _0x4c7bf3=_0x192085[_0x978d('0x11')]&&_0x1e5f79[_0x978d('0x1b')]>0x1;var _0x57f5c6=[];if(!fs[_0x978d('0x23')](path['join'](_0x1cda59,_0x3a9948))&&_0x4c7bf3){fs[_0x978d('0x24')](path[_0x978d('0x25')](_0x1cda59,_0x3a9948));}return BPromise['each'](_0x1e5f79,function(_0x21d0d8){_0x57f5c6['push'](_0x21d0d8);})[_0x978d('0x13')](function(){for(var _0x5c44df=0x0;_0x5c44df<_0x57f5c6[_0x978d('0x1b')];_0x5c44df+=0x1){var _0x21390c;var _0x577f09=_0x57f5c6[_0x5c44df];if(_0x4c7bf3){_0x21390c=path[_0x978d('0x25')](_0x1cda59,_0x3a9948,util[_0x978d('0x15')](_0x978d('0x26'),_0x3a9948,_0x5c44df,'csv'));}else{_0x21390c=path['join'](_0x1cda59,util[_0x978d('0x15')](_0x978d('0x27'),_0x3a9948,'csv'));}fs[_0x978d('0x28')](_0x21390c,csv(_0x577f09));}})[_0x978d('0x13')](function(){if(_0x4c7bf3){return new Promise(function(_0x18f899){zipdir(path['join'](_0x1cda59,_0x3a9948),{'saveTo':path['join'](_0x1cda59,util[_0x978d('0x15')]('%s.%s',_0x3a9948,_0x978d('0x29')))},function(_0x333ef8,_0x4411e6){rimraf(path[_0x978d('0x25')](_0x1cda59,_0x3a9948),function(){});_0x18f899('zip\x20finished');});});}})[_0x978d('0x13')](function(){logger[_0x978d('0xc')](util[_0x978d('0x15')](_0x978d('0x2a'),EXTRACTED_REPORT_ID,_0x978d('0xe')));return analyticExtractedReport(_0x978d('0x2b'),_0x4c7bf3?util['format'](_0x978d('0x27'),_0x3a9948,_0x4c7bf3?_0x978d('0x29'):_0x978d('0x2c')):null);});})[_0x978d('0x2d')](function(_0x3ea81b){logger[_0x978d('0xc')](util['format'](_0x978d('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x3ea81b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x978d('0x2f')](function(){process[_0x978d('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x868b=['SELECT','num','Empty','length','range','forEach','push','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x3164cf,_0x2a2fa6){var _0x8fbf99=function(_0x144b35){while(--_0x144b35){_0x3164cf['push'](_0x3164cf['shift']());}};_0x8fbf99(++_0x2a2fa6);}(_0x868b,0x1e9));var _0xb868=function(_0x4d0180,_0x3c182e){_0x4d0180=_0x4d0180-0x0;var _0x3b91a9=_0x868b[_0x4d0180];return _0x3b91a9;};'use strict';var util=require(_0xb868('0x0'));var path=require(_0xb868('0x1'));var _=require(_0xb868('0x2'));var csv=require(_0xb868('0x3'));var fs=require('fs');var BPromise=require(_0xb868('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xb868('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb868('0x6'))['dbH'];var logger=require('../../config/logger')(_0xb868('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb868('0x8')][0x2]);var QUERY=process[_0xb868('0x8')][0x3];var PATH=process[_0xb868('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e6748,_0x43dd1b){var _0x353dd9={'status':_0x2e6748};var _0x532559={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43dd1b){_0x353dd9[_0xb868('0x9')]=_0x43dd1b;}return db[_0xb868('0xa')][_0xb868('0xb')](_0x353dd9,_0x532559);}function main(){var _0x152793=0x1388;var _0x28a23e;logger[_0xb868('0xc')](util[_0xb868('0xd')](_0xb868('0xe'),EXTRACTED_REPORT_ID,_0xb868('0xf')));return db[_0xb868('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb868('0x11'),_0xb868('0x12')]})[_0xb868('0x13')](function(_0x4e60b7){if(_0x4e60b7){_0x28a23e=_0x4e60b7;_0x152793=_0x28a23e[_0xb868('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0xb868('0xd')](_0xb868('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xb868('0x15')]});})[_0xb868('0x13')](function(_0xe8f395){if(!_0xe8f395[0x0][_0xb868('0x16')]){return analyticExtractedReport(_0xb868('0x17'));}var _0x2d5792=[];var _0x2da7a2=0x0;if(_0x28a23e[_0xb868('0x11')]){if(_0xe8f395&&_0xe8f395[_0xb868('0x18')]){var _0x292a09=_[_0xb868('0x19')](_0xe8f395[0x0][_0xb868('0x16')]/_0x152793);var _0x477fb8=Number['isInteger'](_0xe8f395[0x0][_0xb868('0x16')]/_0x152793)?_0xe8f395[0x0]['num']%_0x152793:0x0;_0x292a09[_0xb868('0x1a')](function(_0x449154){if(_0x449154>0x0){_0x2da7a2+=_0x152793;}_0x2d5792[_0xb868('0x1b')](dbH[_0xb868('0x1c')][_0xb868('0x1d')](util['format'](_0xb868('0x1e'),QUERY,_0x152793,_0x2da7a2),{'type':dbH['sequelize'][_0xb868('0x1f')][_0xb868('0x15')]}));});if(_0x477fb8>0x0){_0x2da7a2+=_0x152793;_0x2d5792[_0xb868('0x1b')](dbH[_0xb868('0x1c')][_0xb868('0x1d')](util[_0xb868('0xd')](_0xb868('0x1e'),QUERY,_0x477fb8,_0x2da7a2),{'type':dbH[_0xb868('0x1c')]['QueryTypes'][_0xb868('0x15')]}));}}}else{_0x2d5792['push'](dbH[_0xb868('0x1c')][_0xb868('0x1d')](QUERY,{'type':dbH[_0xb868('0x1c')][_0xb868('0x1f')][_0xb868('0x15')]}));}var _0x495ae7=path[_0xb868('0x20')](PATH);var _0x3c1b7e=path[_0xb868('0x21')](PATH,_0xb868('0x22'));var _0x3a8eb9=_0x28a23e[_0xb868('0x11')]&&_0x2d5792['length']>0x1;var _0x384d62=[];if(!fs[_0xb868('0x23')](path[_0xb868('0x24')](_0x495ae7,_0x3c1b7e))&&_0x3a8eb9){fs['mkdirSync'](path[_0xb868('0x24')](_0x495ae7,_0x3c1b7e));}return BPromise[_0xb868('0x25')](_0x2d5792,function(_0x3a9a3e){_0x384d62[_0xb868('0x1b')](_0x3a9a3e);})[_0xb868('0x13')](function(){for(var _0x21f735=0x0;_0x21f735<_0x384d62[_0xb868('0x18')];_0x21f735+=0x1){var _0x1edee3;var _0x397f61=_0x384d62[_0x21f735];if(_0x3a8eb9){_0x1edee3=path['join'](_0x495ae7,_0x3c1b7e,util[_0xb868('0xd')](_0xb868('0x26'),_0x3c1b7e,_0x21f735,_0xb868('0x27')));}else{_0x1edee3=path[_0xb868('0x24')](_0x495ae7,util[_0xb868('0xd')](_0xb868('0x28'),_0x3c1b7e,'csv'));}fs['writeFileSync'](_0x1edee3,csv(_0x397f61));}})[_0xb868('0x13')](function(){if(_0x3a8eb9){return new Promise(function(_0x2675e6){zipdir(path[_0xb868('0x24')](_0x495ae7,_0x3c1b7e),{'saveTo':path[_0xb868('0x24')](_0x495ae7,util['format']('%s.%s',_0x3c1b7e,_0xb868('0x29')))},function(_0x16a50c,_0x5862dc){rimraf(path['join'](_0x495ae7,_0x3c1b7e),function(){});_0x2675e6(_0xb868('0x2a'));});});}})[_0xb868('0x13')](function(){logger[_0xb868('0xc')](util[_0xb868('0xd')](_0xb868('0x2b'),EXTRACTED_REPORT_ID,_0xb868('0xf')));return analyticExtractedReport(_0xb868('0x2c'),_0x3a8eb9?util['format']('%s.%s',_0x3c1b7e,_0x3a8eb9?_0xb868('0x29'):_0xb868('0x27')):null);});})[_0xb868('0x2d')](function(_0x5a1143){logger[_0xb868('0xc')](util['format'](_0xb868('0x2e'),EXTRACTED_REPORT_ID,_0xb868('0xf')),util[_0xb868('0x2f')](_0x5a1143,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb868('0x30'));})[_0xb868('0x31')](function(){process[_0xb868('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1fa0658..6647965 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 _0xdb14=['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','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','body','concat','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','push','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xdb14,0xcc));var _0x4db1=function(_0x5dee44,_0x115b60){_0x5dee44=_0x5dee44-0x0;var _0x46f720=_0xdb14[_0x5dee44];return _0x46f720;};'use strict';var _=require(_0x4db1('0x0'));var fs=require('fs');var util=require(_0x4db1('0x1'));var path=require(_0x4db1('0x2'));var moment=require(_0x4db1('0x3'));var htmlToPdfmake=require(_0x4db1('0x4'));var PdfPrinter=require(_0x4db1('0x5'));var zipdir=require(_0x4db1('0x6'));var rimraf=require(_0x4db1('0x7'));var JSDOM=require(_0x4db1('0x8'))[_0x4db1('0x9')];var window=new JSDOM('')[_0x4db1('0xa')];var BPromise=require(_0x4db1('0xb'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4db1('0xc'))(_0x4db1('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4db1('0xe')][0x3];var PATH=process[_0x4db1('0xe')][0x4];var NAME=process[_0x4db1('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x46bc4f,_0x5e8d97){var _0x17438e={'status':_0x46bc4f};var _0x7a4302={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5e8d97){_0x17438e[_0x4db1('0xf')]=_0x5e8d97;}return db[_0x4db1('0x10')][_0x4db1('0x11')](_0x17438e,_0x7a4302);}function getHeaders(_0x5eb2c3){return _[_0x4db1('0x12')](_0x5eb2c3,function(_0x4ac76){return{'text':_0x4ac76,'style':_0x4db1('0x13')};});}function getRows(_0x2480a8,_0x20a52e){return _[_0x4db1('0x12')](_0x20a52e,function(_0x2a82c5){return _(_0x2a82c5)[_0x4db1('0x14')](_0x2480a8)['map'](function(_0x52b99e){return _0x52b99e?_[_0x4db1('0x15')](_0x52b99e):'';})[_0x4db1('0x16')]();});}function createTable(_0x46fcbc,_0x36c505){var _0x3ed191={'widths':_[_0x4db1('0x17')](Array(_0x46fcbc[_0x4db1('0x18')]),0x91),'heights':function(_0x2740a1){return _0x2740a1===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4b2364=getHeaders(_0x46fcbc);_0x3ed191['body']['push'](_0x4b2364);var _0xbfaacd=getRows(_0x46fcbc,_0x36c505);_0x3ed191[_0x4db1('0x19')]=_0x3ed191[_0x4db1('0x19')][_0x4db1('0x1a')](_0xbfaacd);return _0x3ed191;}function createTables(_0x415b35){var _0x4dd6d2=[];var _0x156fb9=_['chunk'](Object['keys'](_0x415b35[0x0]),0x5);_0x156fb9[_0x4db1('0x1b')](function(_0x1de970){_0x4dd6d2['push'](createTable(_0x1de970,_0x415b35));});return _0x4dd6d2;}function getPDFDocDefinition(_0x35595d){var _0x38747f=util[_0x4db1('0x1c')](_0x4db1('0x1d'),NAME,EXTRACTED_REPORT[_0x4db1('0x1e')],moment(EXTRACTED_REPORT['startDate'])[_0x4db1('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x4db1('0x1f')])[_0x4db1('0x1c')](FORMAT));var _0x4c606c=[];for(var _0x511b59=0x0;_0x511b59<_0x35595d[_0x4db1('0x18')];_0x511b59++){var _0x2a1866=[];if(_0x511b59===0x0){_0x2a1866[_0x4db1('0x20')]({'text':_0x38747f,'style':_0x4db1('0x21')});}var _0xd1d05={'table':_0x35595d[_0x511b59]};if(_0x511b59>0x0){_0xd1d05[_0x4db1('0x22')]=_0x4db1('0x23');_0xd1d05['margin']=[0x0,0x46,0x0,0x0];}_0x2a1866[_0x4db1('0x20')](_0xd1d05);_0x4c606c[_0x4db1('0x20')](_0x2a1866);}return{'pageSize':'A4','pageOrientation':_0x4db1('0x24'),'content':_0x4c606c,'footer':function(_0x33630d,_0x19dad5){return{'text':_0x33630d['toString']()+_0x4db1('0x25')+_0x19dad5,'style':_0x4db1('0x26')};},'defaultStyle':{'font':_0x4db1('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4db1('0x28')},'footer':{'alignment':_0x4db1('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x63e2b9){var _0x38575a=0x1388;var _0x35d50f;if(!_0x63e2b9[0x0][_0x4db1('0x2a')]){return analyticExtractedReport(_0x4db1('0x2b'));}return db[_0x4db1('0x2c')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4db1('0x2d'),_0x4db1('0x2e')]})[_0x4db1('0x2f')](function(_0x6666c5){if(_0x6666c5){_0x35d50f=_0x6666c5;_0x38575a=_0x35d50f[_0x4db1('0x2e')]||0x3e8;}})[_0x4db1('0x2f')](function(){var _0x5a4220=[];var _0xc2d12d=0x0;if(_0x35d50f[_0x4db1('0x2d')]){if(_0x63e2b9&&_0x63e2b9['length']){var _0x3362dc=_[_0x4db1('0x30')](_0x63e2b9[0x0]['num']/_0x38575a);var _0x12b411=Number[_0x4db1('0x31')](_0x63e2b9[0x0]['num']/_0x38575a)?_0x63e2b9[0x0][_0x4db1('0x2a')]%_0x38575a:0x0;_0x3362dc[_0x4db1('0x1b')](function(_0x4d7d04){if(_0x4d7d04>0x0){_0xc2d12d+=_0x38575a;}_0x5a4220[_0x4db1('0x20')](dbH['sequelize'][_0x4db1('0x32')](util[_0x4db1('0x1c')](_0x4db1('0x33'),QUERY,_0x38575a,_0xc2d12d),{'type':dbH[_0x4db1('0x34')]['QueryTypes']['SELECT']}));});if(_0x12b411>0x0){_0xc2d12d+=_0x38575a;_0x5a4220['push'](dbH[_0x4db1('0x34')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x12b411,_0xc2d12d),{'type':dbH[_0x4db1('0x34')][_0x4db1('0x35')][_0x4db1('0x36')]}));}}}else{_0x5a4220[_0x4db1('0x20')](dbH[_0x4db1('0x34')][_0x4db1('0x32')](QUERY,{'type':dbH[_0x4db1('0x34')]['QueryTypes']['SELECT']}));}var _0x3e0d41=path[_0x4db1('0x37')](PATH);var _0xebafb5=path['basename'](PATH,_0x4db1('0x38'));var _0xeb725b=_0x35d50f['split']&&_0x5a4220[_0x4db1('0x18')]>0x1;var _0x1de744=[];if(!fs[_0x4db1('0x39')](path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5))&&_0xeb725b){fs['mkdirSync'](path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5));}return BPromise[_0x4db1('0x3b')](_0x5a4220,function(_0x55aa1e){_0x1de744[_0x4db1('0x20')](_0x55aa1e);})['then'](function(){var _0x1da4f4=[];for(var _0x39dc5e=0x0;_0x39dc5e<_0x1de744['length'];_0x39dc5e+=0x1){var _0x54b58b=_0x1de744[_0x39dc5e];var _0x5a3ddb=createTables(_[_0x4db1('0x3c')](_0x54b58b));var _0x11191f;var _0x415d87=getPDFDocDefinition(_0x5a3ddb);var _0x5ec77c=getPDFPrinter();var _0x37bedb=_0x5ec77c[_0x4db1('0x3d')](_0x415d87);if(_0xeb725b){_0x11191f=path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5,util[_0x4db1('0x1c')](_0x4db1('0x3e'),_0xebafb5,_0x39dc5e,_0x4db1('0x3f')));}else{_0x11191f=path[_0x4db1('0x3a')](_0x3e0d41,util[_0x4db1('0x1c')](_0x4db1('0x40'),_0xebafb5,_0x4db1('0x3f')));}_0x1da4f4[_0x4db1('0x20')](writePDFDocument(_0x37bedb,_0x11191f));}return Promise['all'](_0x1da4f4);})['then'](function(){if(_0xeb725b){return new Promise(function(_0x27605b){zipdir(path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5),{'saveTo':path['join'](_0x3e0d41,util[_0x4db1('0x1c')]('%s.%s',_0xebafb5,_0x4db1('0x41')))},function(){rimraf(path['join'](_0x3e0d41,_0xebafb5),function(){});_0x27605b(_0x4db1('0x42'));});});}})[_0x4db1('0x2f')](function(){if(!_0xeb725b)return;rimraf(path[_0x4db1('0x3a')](_0x3e0d41,_0xebafb5),function(){});})[_0x4db1('0x2f')](function(){logger[_0x4db1('0x43')](util[_0x4db1('0x1c')](_0x4db1('0x44'),EXTRACTED_REPORT_ID,_0x4db1('0x45')));return analyticExtractedReport(_0x4db1('0x46'),_0xeb725b?util['format']('%s.%s',_0xebafb5,_0xeb725b?_0x4db1('0x41'):_0x4db1('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4db1('0x43')](util[_0x4db1('0x1c')](_0x4db1('0x47'),EXTRACTED_REPORT_ID,_0x4db1('0x45')));return db[_0x4db1('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4db1('0x2f')](function(_0x48d040){EXTRACTED_REPORT=_0x48d040;return dbH[_0x4db1('0x34')][_0x4db1('0x32')](util['format'](_0x4db1('0x48'),QUERY),{'type':dbH['sequelize'][_0x4db1('0x35')]['SELECT']});})[_0x4db1('0x2f')](extractReport)['catch'](function(_0x2b8aa1){logger[_0x4db1('0x43')](util[_0x4db1('0x1c')](_0x4db1('0x49'),EXTRACTED_REPORT_ID,_0x4db1('0x45')),util[_0x4db1('0x4a')](_0x2b8aa1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4db1('0x4b'));})['finally'](function(){process[_0x4db1('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2ee59f=new PdfPrinter({'Arial':{'normal':__dirname+_0x4db1('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x4db1('0x4e'),'bolditalics':__dirname+_0x4db1('0x4f')}});return _0x2ee59f;}function getPDFDocDefinitionFromHTML(_0x3369f5,_0x4e1c36){var _0x2cc8b6=util['format'](_0x4db1('0x50'),_0x4e1c36[_0x4db1('0x51')],_0x4e1c36['interactionId']);var _0x129687=moment()[_0x4db1('0x1c')](_0x4db1('0x52'))[_0x4db1('0x15')]();var _0x1bc160=htmlToPdfmake(_0x3369f5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1bc160],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4db1('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4db1('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x4db1('0x21')}];},'footer':function(_0x2a7cc6,_0x24d651){return[{'text':util[_0x4db1('0x1c')](_0x4db1('0x54'),_0x2cc8b6,_0x2a7cc6,_0x24d651,_0x129687),'style':'footer'}];}};}function writePDFDocument(_0x19dcb7,_0x265643){return new Promise(function(_0x521678,_0x2afad5){var _0x35f195=_0x19dcb7[_0x4db1('0x55')](fs[_0x4db1('0x56')](_0x265643));_0x35f195['on']('finish',function(){_0x521678(_0x4db1('0x57'));});_0x35f195['on']('error',function(_0x2e900d){_0x2afad5(_0x2e900d);});_0x19dcb7['end']();});}exports[_0x4db1('0x58')]=function(_0x3e1710,_0x4f5967){var _0x4eb6c4=getPDFPrinter();var _0x25b783=getPDFDocDefinitionFromHTML(_0x3e1710,_0x4f5967);var _0x32c228=_0x4eb6c4[_0x4db1('0x3d')](_0x25b783);return writePDFDocument(_0x32c228,_0x4f5967[_0x4db1('0x2')])[_0x4db1('0x59')](function(_0x5685a5){throw _0x5685a5;});}; \ No newline at end of file +var _0x709d=['sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.pdf','existsSync','join','mkdirSync','each','%s.%s','pdf','all','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','error','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','forEach'];(function(_0x4c4242,_0xde3ab0){var _0xee38c3=function(_0x201780){while(--_0x201780){_0x4c4242['push'](_0x4c4242['shift']());}};_0xee38c3(++_0xde3ab0);}(_0x709d,0xdc));var _0xd709=function(_0x1821b2,_0x5e82a8){_0x1821b2=_0x1821b2-0x0;var _0x17022d=_0x709d[_0x1821b2];return _0x17022d;};'use strict';var _=require(_0xd709('0x0'));var fs=require('fs');var util=require(_0xd709('0x1'));var path=require(_0xd709('0x2'));var moment=require(_0xd709('0x3'));var htmlToPdfmake=require(_0xd709('0x4'));var PdfPrinter=require(_0xd709('0x5'));var zipdir=require(_0xd709('0x6'));var rimraf=require(_0xd709('0x7'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xd709('0x8')];var BPromise=require(_0xd709('0x9'));var db=require(_0xd709('0xa'))['db'];var dbH=require(_0xd709('0xa'))[_0xd709('0xb')];var logger=require(_0xd709('0xc'))(_0xd709('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xd709('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd709('0xe')][0x4];var NAME=process[_0xd709('0xe')][0x5];var FORMAT=_0xd709('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2f59cd,_0x2cc520){var _0x5cde0b={'status':_0x2f59cd};var _0x161c94={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2cc520){_0x5cde0b[_0xd709('0x10')]=_0x2cc520;}return db[_0xd709('0x11')]['update'](_0x5cde0b,_0x161c94);}function getHeaders(_0x23774){return _[_0xd709('0x12')](_0x23774,function(_0x57f1e8){return{'text':_0x57f1e8,'style':_0xd709('0x13')};});}function getRows(_0x491e20,_0x3df379){return _[_0xd709('0x12')](_0x3df379,function(_0x37a24a){return _(_0x37a24a)[_0xd709('0x14')](_0x491e20)[_0xd709('0x12')](function(_0x5c0454){return _0x5c0454?_[_0xd709('0x15')](_0x5c0454):'';})[_0xd709('0x16')]();});}function createTable(_0x5d1a37,_0x45e59b){var _0x3ffedc={'widths':_[_0xd709('0x17')](Array(_0x5d1a37[_0xd709('0x18')]),0x91),'heights':function(_0x1cde28){return _0x1cde28===0x0?_0xd709('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x338796=getHeaders(_0x5d1a37);_0x3ffedc[_0xd709('0x1a')][_0xd709('0x1b')](_0x338796);var _0x3f157a=getRows(_0x5d1a37,_0x45e59b);_0x3ffedc[_0xd709('0x1a')]=_0x3ffedc[_0xd709('0x1a')]['concat'](_0x3f157a);return _0x3ffedc;}function createTables(_0x30a882){var _0x1044fb=[];var _0x243683=_[_0xd709('0x1c')](Object[_0xd709('0x1d')](_0x30a882[0x0]),0x5);_0x243683['forEach'](function(_0x23b5ff){_0x1044fb[_0xd709('0x1b')](createTable(_0x23b5ff,_0x30a882));});return _0x1044fb;}function getPDFDocDefinition(_0x48e45c){var _0x1a8c57=util[_0xd709('0x1e')](_0xd709('0x1f'),NAME,EXTRACTED_REPORT[_0xd709('0x20')],moment(EXTRACTED_REPORT[_0xd709('0x21')])[_0xd709('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xd709('0x22')])['format'](FORMAT));var _0x3a18b2=[];for(var _0x20d280=0x0;_0x20d280<_0x48e45c[_0xd709('0x18')];_0x20d280++){var _0x57cd9a=[];if(_0x20d280===0x0){_0x57cd9a[_0xd709('0x1b')]({'text':_0x1a8c57,'style':'header'});}var _0x5b43b7={'table':_0x48e45c[_0x20d280]};if(_0x20d280>0x0){_0x5b43b7[_0xd709('0x23')]=_0xd709('0x24');_0x5b43b7[_0xd709('0x25')]=[0x0,0x46,0x0,0x0];}_0x57cd9a[_0xd709('0x1b')](_0x5b43b7);_0x3a18b2['push'](_0x57cd9a);}return{'pageSize':'A4','pageOrientation':_0xd709('0x26'),'content':_0x3a18b2,'footer':function(_0xcb1fbd,_0x5ab9d9){return{'text':_0xcb1fbd[_0xd709('0x15')]()+_0xd709('0x27')+_0x5ab9d9,'style':_0xd709('0x28')};},'defaultStyle':{'font':_0xd709('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd709('0x2a')},'footer':{'alignment':_0xd709('0x2b'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3f0212){var _0x3bf8bc=0x1388;var _0x206efb;if(!_0x3f0212[0x0][_0xd709('0x2c')]){return analyticExtractedReport(_0xd709('0x2d'));}return db[_0xd709('0x2e')][_0xd709('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd709('0x30')]})[_0xd709('0x31')](function(_0x34015f){if(_0x34015f){_0x206efb=_0x34015f;_0x3bf8bc=_0x206efb[_0xd709('0x30')]||0x3e8;}})['then'](function(){var _0x29b27b=[];var _0x3b85f2=0x0;if(_0x206efb[_0xd709('0x32')]){if(_0x3f0212&&_0x3f0212[_0xd709('0x18')]){var _0x1c7109=_[_0xd709('0x33')](_0x3f0212[0x0][_0xd709('0x2c')]/_0x3bf8bc);var _0x2bc972=Number['isInteger'](_0x3f0212[0x0][_0xd709('0x2c')]/_0x3bf8bc)?_0x3f0212[0x0][_0xd709('0x2c')]%_0x3bf8bc:0x0;_0x1c7109[_0xd709('0x34')](function(_0x1a6c17){if(_0x1a6c17>0x0){_0x3b85f2+=_0x3bf8bc;}_0x29b27b[_0xd709('0x1b')](dbH[_0xd709('0x35')][_0xd709('0x36')](util[_0xd709('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3bf8bc,_0x3b85f2),{'type':dbH[_0xd709('0x35')][_0xd709('0x37')][_0xd709('0x38')]}));});if(_0x2bc972>0x0){_0x3b85f2+=_0x3bf8bc;_0x29b27b['push'](dbH[_0xd709('0x35')][_0xd709('0x36')](util['format'](_0xd709('0x39'),QUERY,_0x2bc972,_0x3b85f2),{'type':dbH[_0xd709('0x35')][_0xd709('0x37')][_0xd709('0x38')]}));}}}else{_0x29b27b[_0xd709('0x1b')](dbH[_0xd709('0x35')]['query'](QUERY,{'type':dbH['sequelize'][_0xd709('0x37')][_0xd709('0x38')]}));}var _0x204176=path[_0xd709('0x3a')](PATH);var _0x196f70=path['basename'](PATH,_0xd709('0x3b'));var _0x2c5a55=_0x206efb[_0xd709('0x32')]&&_0x29b27b[_0xd709('0x18')]>0x1;var _0x1f9ad2=[];if(!fs[_0xd709('0x3c')](path[_0xd709('0x3d')](_0x204176,_0x196f70))&&_0x2c5a55){fs[_0xd709('0x3e')](path[_0xd709('0x3d')](_0x204176,_0x196f70));}return BPromise[_0xd709('0x3f')](_0x29b27b,function(_0x3a332b){_0x1f9ad2[_0xd709('0x1b')](_0x3a332b);})[_0xd709('0x31')](function(){var _0xa4a2d1=[];for(var _0x309745=0x0;_0x309745<_0x1f9ad2['length'];_0x309745+=0x1){var _0x12b54a=_0x1f9ad2[_0x309745];var _0x26f8d7=createTables(_['flatten'](_0x12b54a));var _0x5aa83c;var _0x8395c9=getPDFDocDefinition(_0x26f8d7);var _0x54c032=getPDFPrinter();var _0x1bf521=_0x54c032['createPdfKitDocument'](_0x8395c9);if(_0x2c5a55){_0x5aa83c=path[_0xd709('0x3d')](_0x204176,_0x196f70,util[_0xd709('0x1e')]('%s%d.%s',_0x196f70,_0x309745,'pdf'));}else{_0x5aa83c=path[_0xd709('0x3d')](_0x204176,util['format'](_0xd709('0x40'),_0x196f70,_0xd709('0x41')));}_0xa4a2d1['push'](writePDFDocument(_0x1bf521,_0x5aa83c));}return Promise[_0xd709('0x42')](_0xa4a2d1);})[_0xd709('0x31')](function(){if(_0x2c5a55){return new Promise(function(_0x1e173d){zipdir(path[_0xd709('0x3d')](_0x204176,_0x196f70),{'saveTo':path[_0xd709('0x3d')](_0x204176,util['format'](_0xd709('0x40'),_0x196f70,_0xd709('0x43')))},function(){rimraf(path['join'](_0x204176,_0x196f70),function(){});_0x1e173d('zip\x20finished');});});}})[_0xd709('0x31')](function(){if(!_0x2c5a55)return;rimraf(path[_0xd709('0x3d')](_0x204176,_0x196f70),function(){});})['then'](function(){logger['info'](util[_0xd709('0x1e')](_0xd709('0x44'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xd709('0x45'),_0x2c5a55?util[_0xd709('0x1e')](_0xd709('0x40'),_0x196f70,_0x2c5a55?_0xd709('0x43'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd709('0x46')](util[_0xd709('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd709('0x47')));return db[_0xd709('0x11')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd709('0x31')](function(_0x13c907){EXTRACTED_REPORT=_0x13c907;return dbH[_0xd709('0x35')]['query'](util[_0xd709('0x1e')](_0xd709('0x48'),QUERY),{'type':dbH[_0xd709('0x35')][_0xd709('0x37')][_0xd709('0x38')]});})['then'](extractReport)[_0xd709('0x49')](function(_0x4bfa19){logger[_0xd709('0x46')](util['format'](_0xd709('0x4a'),EXTRACTED_REPORT_ID,_0xd709('0x47')),util['inspect'](_0x4bfa19,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd709('0x4b'));})['finally'](function(){process[_0xd709('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3cb6e0=new PdfPrinter({'Arial':{'normal':__dirname+_0xd709('0x4d'),'bold':__dirname+_0xd709('0x4e'),'italics':__dirname+_0xd709('0x4f'),'bolditalics':__dirname+_0xd709('0x50')}});return _0x3cb6e0;}function getPDFDocDefinitionFromHTML(_0x28ad7a,_0x3ef4b3){var _0x5cb56f=util['format'](_0xd709('0x51'),_0x3ef4b3[_0xd709('0x52')],_0x3ef4b3[_0xd709('0x53')]);var _0x3bfac8=moment()[_0xd709('0x1e')](_0xd709('0x54'))[_0xd709('0x15')]();var _0x2c164c=htmlToPdfmake(_0x28ad7a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2c164c],'defaultStyle':{'font':_0xd709('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd709('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd709('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd709('0x55')}},'header':function(){return[{'text':_0xd709('0x56'),'style':'header'}];},'footer':function(_0x3f4021,_0x7eef76){return[{'text':util[_0xd709('0x1e')](_0xd709('0x57'),_0x5cb56f,_0x3f4021,_0x7eef76,_0x3bfac8),'style':'footer'}];}};}function writePDFDocument(_0x497154,_0x47d921){return new Promise(function(_0x5804bb,_0x29a70a){var _0x2a28fb=_0x497154[_0xd709('0x58')](fs['createWriteStream'](_0x47d921));_0x2a28fb['on']('finish',function(){_0x5804bb('finish');});_0x2a28fb['on'](_0xd709('0x59'),function(_0x218f7a){_0x29a70a(_0x218f7a);});_0x497154['end']();});}exports['createPdfFromHTML']=function(_0x2b503f,_0x3eff71){var _0x5d6ac3=getPDFPrinter();var _0x4fab59=getPDFDocDefinitionFromHTML(_0x2b503f,_0x3eff71);var _0x3ef07f=_0x5d6ac3[_0xd709('0x5a')](_0x4fab59);return writePDFDocument(_0x3ef07f,_0x3eff71[_0xd709('0x2')])[_0xd709('0x49')](function(_0x440604){throw _0x440604;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3b71946..8a34dd1 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 _0xa7b5=['Empty','length','range','num','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x161904,_0x21d7bf){_0x161904=_0x161904-0x0;var _0x24ffa3=_0xa7b5[_0x161904];return _0x24ffa3;};'use strict';var util=require(_0x5a7b('0x0'));var path=require('path');var _=require(_0x5a7b('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x5a7b('0x2'));var zipdir=require(_0x5a7b('0x3'));var rimraf=require(_0x5a7b('0x4'));var db=require(_0x5a7b('0x5'))['db'];var dbH=require(_0x5a7b('0x5'))[_0x5a7b('0x6')];var logger=require(_0x5a7b('0x7'))(_0x5a7b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5a7b('0x9')][0x2]);var QUERY=process[_0x5a7b('0x9')][0x3];var PATH=process[_0x5a7b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x493ae6,_0x2cd623){var _0x24b80c={'status':_0x493ae6};var _0x7a3ae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2cd623){_0x24b80c[_0x5a7b('0xa')]=_0x2cd623;}return db[_0x5a7b('0xb')][_0x5a7b('0xc')](_0x24b80c,_0x7a3ae);}function main(){var _0x5a414a=0x1388;var _0x5476b8;logger[_0x5a7b('0xd')](util['format'](_0x5a7b('0xe'),EXTRACTED_REPORT_ID,_0x5a7b('0xf')));return db[_0x5a7b('0x10')][_0x5a7b('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5a7b('0x12'),_0x5a7b('0x13')]})[_0x5a7b('0x14')](function(_0x156031){if(_0x156031){_0x5476b8=_0x156031;_0x5a414a=_0x5476b8[_0x5a7b('0x13')]||0x1388;}})[_0x5a7b('0x14')](function(){return dbH[_0x5a7b('0x15')]['query'](util[_0x5a7b('0x16')](_0x5a7b('0x17'),QUERY),{'type':dbH[_0x5a7b('0x15')][_0x5a7b('0x18')]['SELECT']});})[_0x5a7b('0x14')](function(_0x2ca1d6){if(!_0x2ca1d6[0x0]['num']){return analyticExtractedReport(_0x5a7b('0x19'));}var _0x4d2e57=[];var _0x3d3239=0x0;if(_0x5476b8['split']){if(_0x2ca1d6&&_0x2ca1d6[_0x5a7b('0x1a')]){var _0x3c3359=_[_0x5a7b('0x1b')](_0x2ca1d6[0x0]['num']/_0x5a414a);var _0x33b996=Number['isInteger'](_0x2ca1d6[0x0][_0x5a7b('0x1c')]/_0x5a414a)?_0x2ca1d6[0x0][_0x5a7b('0x1c')]%_0x5a414a:0x0;_0x3c3359[_0x5a7b('0x1d')](function(_0x311b3f){if(_0x311b3f>0x0){_0x3d3239+=_0x5a414a;}_0x4d2e57[_0x5a7b('0x1e')](dbH[_0x5a7b('0x15')][_0x5a7b('0x1f')](util[_0x5a7b('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a414a,_0x3d3239),{'type':dbH[_0x5a7b('0x15')][_0x5a7b('0x18')]['SELECT']}));});if(_0x33b996>0x0){_0x3d3239+=_0x5a414a;_0x4d2e57['push'](dbH[_0x5a7b('0x15')][_0x5a7b('0x1f')](util[_0x5a7b('0x16')](_0x5a7b('0x20'),QUERY,_0x33b996,_0x3d3239),{'type':dbH[_0x5a7b('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x4d2e57[_0x5a7b('0x1e')](dbH[_0x5a7b('0x15')][_0x5a7b('0x1f')](QUERY,{'type':dbH[_0x5a7b('0x15')]['QueryTypes']['SELECT']}));}var _0x51928c=path[_0x5a7b('0x21')](PATH);var _0x3fbff6=path[_0x5a7b('0x22')](PATH,_0x5a7b('0x23'));var _0x26b4f3=_0x5476b8['split']&&_0x4d2e57[_0x5a7b('0x1a')]>0x1;var _0x55724d=[];if(!fs[_0x5a7b('0x24')](path['join'](_0x51928c,_0x3fbff6))&&_0x26b4f3){fs[_0x5a7b('0x25')](path[_0x5a7b('0x26')](_0x51928c,_0x3fbff6));}return BPromise[_0x5a7b('0x27')](_0x4d2e57,function(_0x4adbf0){_0x55724d[_0x5a7b('0x1e')](_0x4adbf0);})[_0x5a7b('0x14')](function(){for(var _0x169762=0x0;_0x169762<_0x55724d['length'];_0x169762+=0x1){var _0x36b90e;var _0x3172a8=_0x55724d[_0x169762];if(_0x26b4f3){_0x36b90e=path[_0x5a7b('0x26')](_0x51928c,_0x3fbff6,util[_0x5a7b('0x16')](_0x5a7b('0x28'),_0x3fbff6,_0x169762,'xlsx'));}else{_0x36b90e=path[_0x5a7b('0x26')](_0x51928c,util[_0x5a7b('0x16')](_0x5a7b('0x29'),_0x3fbff6,_0x5a7b('0x2a')));}fs[_0x5a7b('0x2b')](_0x36b90e,json2xls(_0x3172a8),_0x5a7b('0x2c'));}})['then'](function(){if(_0x26b4f3){return new Promise(function(_0x34f7a8){zipdir(path['join'](_0x51928c,_0x3fbff6),{'saveTo':path[_0x5a7b('0x26')](_0x51928c,util['format'](_0x5a7b('0x29'),_0x3fbff6,_0x5a7b('0x2d')))},function(_0x16d07e,_0x220f5d){rimraf(path[_0x5a7b('0x26')](_0x51928c,_0x3fbff6),function(){});_0x34f7a8(_0x5a7b('0x2e'));});});}})[_0x5a7b('0x14')](function(){logger['info'](util[_0x5a7b('0x16')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5a7b('0xf')));return analyticExtractedReport(_0x5a7b('0x2f'),_0x26b4f3?util[_0x5a7b('0x16')](_0x5a7b('0x29'),_0x3fbff6,_0x26b4f3?'zip':_0x5a7b('0x2a')):null);});})[_0x5a7b('0x30')](function(_0x441afc){logger[_0x5a7b('0xd')](util['format'](_0x5a7b('0x31'),EXTRACTED_REPORT_ID,_0x5a7b('0xf')),util[_0x5a7b('0x32')](_0x441afc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5a7b('0x33')](function(){process[_0x5a7b('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe798=['lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','query','dirname','.xlsx','split','join','mkdirSync','each','xlsx','%s.%s','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path'];(function(_0x32b8a9,_0x59d62b){var _0x40105c=function(_0x54c048){while(--_0x54c048){_0x32b8a9['push'](_0x32b8a9['shift']());}};_0x40105c(++_0x59d62b);}(_0xe798,0xe4));var _0x8e79=function(_0x23d666,_0x5deeae){_0x23d666=_0x23d666-0x0;var _0x3150b9=_0xe798[_0x23d666];return _0x3150b9;};'use strict';var util=require(_0x8e79('0x0'));var path=require(_0x8e79('0x1'));var _=require(_0x8e79('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x8e79('0x3'));var zipdir=require(_0x8e79('0x4'));var rimraf=require('rimraf');var db=require(_0x8e79('0x5'))['db'];var dbH=require(_0x8e79('0x5'))[_0x8e79('0x6')];var logger=require(_0x8e79('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8e79('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8e79('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x22d41b,_0x19b51d){var _0x8fee14={'status':_0x22d41b};var _0x53bce4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x19b51d){_0x8fee14['savename']=_0x19b51d;}return db[_0x8e79('0x9')][_0x8e79('0xa')](_0x8fee14,_0x53bce4);}function main(){var _0x58f8ae=0x1388;var _0x14147f;logger[_0x8e79('0xb')](util[_0x8e79('0xc')](_0x8e79('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x8e79('0xe')][_0x8e79('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8e79('0x10')]})[_0x8e79('0x11')](function(_0x2e5a33){if(_0x2e5a33){_0x14147f=_0x2e5a33;_0x58f8ae=_0x14147f[_0x8e79('0x10')]||0x1388;}})[_0x8e79('0x11')](function(){return dbH['sequelize']['query'](util['format'](_0x8e79('0x12'),QUERY),{'type':dbH[_0x8e79('0x13')][_0x8e79('0x14')][_0x8e79('0x15')]});})['then'](function(_0x1613b7){if(!_0x1613b7[0x0][_0x8e79('0x16')]){return analyticExtractedReport(_0x8e79('0x17'));}var _0x389d50=[];var _0x76cda6=0x0;if(_0x14147f['split']){if(_0x1613b7&&_0x1613b7[_0x8e79('0x18')]){var _0x49b74e=_[_0x8e79('0x19')](_0x1613b7[0x0][_0x8e79('0x16')]/_0x58f8ae);var _0x41b6c8=Number[_0x8e79('0x1a')](_0x1613b7[0x0][_0x8e79('0x16')]/_0x58f8ae)?_0x1613b7[0x0]['num']%_0x58f8ae:0x0;_0x49b74e[_0x8e79('0x1b')](function(_0x9ebcdb){if(_0x9ebcdb>0x0){_0x76cda6+=_0x58f8ae;}_0x389d50[_0x8e79('0x1c')](dbH[_0x8e79('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x58f8ae,_0x76cda6),{'type':dbH[_0x8e79('0x13')][_0x8e79('0x14')][_0x8e79('0x15')]}));});if(_0x41b6c8>0x0){_0x76cda6+=_0x58f8ae;_0x389d50[_0x8e79('0x1c')](dbH['sequelize'][_0x8e79('0x1d')](util[_0x8e79('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41b6c8,_0x76cda6),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x389d50[_0x8e79('0x1c')](dbH[_0x8e79('0x13')][_0x8e79('0x1d')](QUERY,{'type':dbH[_0x8e79('0x13')][_0x8e79('0x14')]['SELECT']}));}var _0x526d02=path[_0x8e79('0x1e')](PATH);var _0x456f8b=path['basename'](PATH,_0x8e79('0x1f'));var _0x58c014=_0x14147f[_0x8e79('0x20')]&&_0x389d50[_0x8e79('0x18')]>0x1;var _0x52c2e1=[];if(!fs['existsSync'](path[_0x8e79('0x21')](_0x526d02,_0x456f8b))&&_0x58c014){fs[_0x8e79('0x22')](path[_0x8e79('0x21')](_0x526d02,_0x456f8b));}return BPromise[_0x8e79('0x23')](_0x389d50,function(_0xb918cf){_0x52c2e1[_0x8e79('0x1c')](_0xb918cf);})['then'](function(){for(var _0x5ba35e=0x0;_0x5ba35e<_0x52c2e1[_0x8e79('0x18')];_0x5ba35e+=0x1){var _0x52faa;var _0x189462=_0x52c2e1[_0x5ba35e];if(_0x58c014){_0x52faa=path['join'](_0x526d02,_0x456f8b,util[_0x8e79('0xc')]('%s%d.%s',_0x456f8b,_0x5ba35e,_0x8e79('0x24')));}else{_0x52faa=path[_0x8e79('0x21')](_0x526d02,util[_0x8e79('0xc')](_0x8e79('0x25'),_0x456f8b,_0x8e79('0x24')));}fs['writeFileSync'](_0x52faa,json2xls(_0x189462),_0x8e79('0x26'));}})['then'](function(){if(_0x58c014){return new Promise(function(_0x49e0d1){zipdir(path[_0x8e79('0x21')](_0x526d02,_0x456f8b),{'saveTo':path[_0x8e79('0x21')](_0x526d02,util['format'](_0x8e79('0x25'),_0x456f8b,_0x8e79('0x27')))},function(_0x6290e1,_0x136a8b){rimraf(path[_0x8e79('0x21')](_0x526d02,_0x456f8b),function(){});_0x49e0d1(_0x8e79('0x28'));});});}})['then'](function(){logger[_0x8e79('0xb')](util[_0x8e79('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x8e79('0x29'),_0x58c014?util[_0x8e79('0xc')]('%s.%s',_0x456f8b,_0x58c014?_0x8e79('0x27'):_0x8e79('0x24')):null);});})[_0x8e79('0x2a')](function(_0x505e78){logger['info'](util[_0x8e79('0xc')](_0x8e79('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x8e79('0x2c')](_0x505e78,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8e79('0x2d'));})['finally'](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 d85a313..49ed14b 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 _0x2077=['Hangup','transaction','bulkCreate','sortBy','catch','lodash','Interval','findAll','then','intervals','models','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','inbound','VoiceExtensionId','context','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','hasOwnProperty','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat'];(function(_0x26f360,_0x2e261a){var _0x36d220=function(_0x550fd7){while(--_0x550fd7){_0x26f360['push'](_0x26f360['shift']());}};_0x36d220(++_0x2e261a);}(_0x2077,0x1e1));var _0x7207=function(_0x322a4f,_0x5ed401){_0x322a4f=_0x322a4f-0x0;var _0x4cca48=_0x2077[_0x322a4f];return _0x4cca48;};'use strict';var _=require(_0x7207('0x0'));var util=require('util');function rewrite(_0x462a0e,_0x2f47b3){var _0x4e16f8=this;return _0x462a0e['models'][_0x7207('0x1')][_0x7207('0x2')]({'raw':!![]})[_0x7207('0x3')](function(_0x197351){_0x4e16f8[_0x7207('0x4')]=_0x197351;return _0x462a0e[_0x7207('0x5')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x2f47b3['IntervalId']},'raw':!![]});})[_0x7207('0x3')](function(_0x25a558){return _0x462a0e[_0x7207('0x5')][_0x7207('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x7207('0x7')](_0x25a558,_0x7207('0x8')))}},'order':[{'raw':_0x7207('0x9')}],'raw':!![]});})[_0x7207('0x3')](function(_0x3a44b9){var _0x441c39=_[_0x7207('0xa')](_0x3a44b9,{'priority':'1'});var _0x4ef0f5=_[_0x7207('0xa')](_0x3a44b9,{'isApp':0x1});var _0x4fac00=_[_0x7207('0xb')](_0x4ef0f5,_0x7207('0x8'));var _0x44689f=['queue',_0x7207('0xc')];var _0x3f5cb1=[];var _0x3adaea=[];for(var _0x501395 in _0x4fac00){if(_0x4fac00['hasOwnProperty'](_0x501395)){_0x4e16f8[_0x7207('0xd')]=0x2;_0x4e16f8[_0x7207('0xe')]=[];_0x4e16f8[_0x7207('0xf')]=_[_0x7207('0x10')](_0x441c39,{'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')]});_0x4e16f8['extensions'][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':util[_0x7207('0x14')](_0x7207('0x15'),_0x4fac00[_0x501395][0x0][_0x7207('0x12')]),'context':_0x4fac00[_0x501395][0x0]['context'],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0]['VoiceExtensionId']});if(_0x4fac00[_0x501395][0x0][_0x7207('0x12')]===_0x7207('0x16')){_0x4e16f8['extensions'][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':'CDR(routeid)='+_0x4fac00[_0x501395][0x0][_0x7207('0x17')],'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});}else if(_0x4fac00[_0x501395][0x0][_0x7207('0x12')]===_0x7207('0x19')){if(_0x4e16f8[_0x7207('0xf')]){_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0]['type'],'app':'Set','appdata':_0x7207('0x1a')+(_0x4e16f8['extension'][_0x7207('0x1b')]?'${EXTEN:'+_0x4e16f8[_0x7207('0xf')][_0x7207('0x1b')]+'}':_0x7207('0x1c')),'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});}_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x1d')+_0x4fac00[_0x501395][0x0][_0x7207('0x17')],'context':_0x4fac00[_0x501395][0x0]['context'],'exten':_0x4fac00[_0x501395][0x0]['exten'],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});var _0x389957=_0x4e16f8[_0x7207('0xd')]++;_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x389957+0x2)+'):Goto('+(_0x389957+0x1)+')','context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x389957,'VoiceExtensionId':_0x4fac00[_0x501395][0x0]['VoiceExtensionId']});if(_0x4e16f8['extension']){_0x4e16f8['extensions'][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':'Set','appdata':_0x4e16f8[_0x7207('0xf')]['cutdigits']?_0x7207('0x1f')+_0x4e16f8[_0x7207('0xf')][_0x7207('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0]['VoiceExtensionId']});}_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':'Set','appdata':_0x7207('0x20')+_0x4fac00[_0x501395][0x0][_0x7207('0x17')],'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});if(_0x4e16f8[_0x7207('0xf')]&&_0x4e16f8['extension']['hasOwnProperty'](_0x7207('0x21'))&&_0x4e16f8[_0x7207('0xf')][_0x7207('0x21')]!==_0x7207('0x22')){_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':'Set','appdata':_0x7207('0x23'),'context':_0x4fac00[_0x501395][0x0]['context'],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});_0x4e16f8[_0x7207('0xe')]['push']({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4e16f8['extension'][_0x7207('0x21')]||_0x7207('0x24'),'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});}}_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x25'),'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0]['VoiceExtensionId']});_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'exten':_0x4fac00[_0x501395][0x0]['exten'],'priority':_0x4e16f8[_0x7207('0xd')]++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});_0x4e16f8[_0x7207('0xe')][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0][_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x26'),'context':_0x4fac00[_0x501395][0x0]['context'],'exten':_0x4fac00[_0x501395][0x0][_0x7207('0x8')],'priority':_0x4e16f8['priority']++,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});for(var _0x25284f=0x0,_0x49916c=0x0;_0x25284f<_0x4fac00[_0x501395][_0x7207('0x27')];_0x25284f+=0x1,_0x49916c=0x0){var _0x54d89b=_0x4fac00[_0x501395][_0x25284f];if(_0x54d89b[_0x7207('0x12')]){_0x54d89b[_0x7207('0x12')]=_0x54d89b[_0x7207('0x12')][_0x7207('0x28')]();}var _0x20250f=[];var _0x2c2c92=[];delete _0x54d89b['id'];delete _0x54d89b[_0x7207('0x29')];delete _0x54d89b[_0x7207('0x2a')];var _0x508483=_0x54d89b[_0x7207('0x2b')]!=='*,*,*,*'?[_0x54d89b['interval']]:_0x54d89b['IntervalId']?_[_0x7207('0x7')](_[_0x7207('0xa')](_0x4e16f8[_0x7207('0x4')],{'IntervalId':_0x54d89b['IntervalId']}),_0x7207('0x2b')):[];if(_0x54d89b[_0x7207('0x2c')]('tag')){if(_0x54d89b[_0x7207('0x2d')]&&_0x54d89b[_0x7207('0x2d')]!=='--'){_0x20250f['push']({'type':_0x54d89b[_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x2e')+_0x54d89b[_0x7207('0x2d')],'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b['exten'],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}}if(_0x54d89b[_0x7207('0x12')]===_0x7207('0x19')&&_0x54d89b[_0x7207('0x2c')]('callerID')){if(_0x54d89b[_0x7207('0x2f')]){_0x20250f[_0x7207('0x11')]({'type':_0x54d89b['type'],'app':'ExecIf','appdata':_0x7207('0x30')+_0x54d89b[_0x7207('0x2f')]+')','context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b[_0x7207('0x8')],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}else{_0x20250f[_0x7207('0x11')]({'type':_0x54d89b[_0x7207('0x12')],'app':_0x7207('0x1e'),'appdata':_0x7207('0x31'),'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b['exten'],'priority':_0x508483['length']+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}}if(_0x54d89b[_0x7207('0x2c')](_0x7207('0x32'))){if(_0x44689f[_0x7207('0x33')](_0x54d89b[_0x7207('0x34')][_0x7207('0x28')]())>=0x0&&_0x54d89b[_0x7207('0x35')]!==_0x7207('0x36')){if(_0x54d89b['answer']){_0x20250f[_0x7207('0x11')]({'type':_0x54d89b['type'],'app':_0x7207('0x1e'),'appdata':_0x7207('0x37'),'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b[_0x7207('0x8')],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});_0x20250f['push']({'type':_0x54d89b[_0x7207('0x12')],'app':_0x7207('0x13'),'appdata':_0x7207('0x38'),'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b['exten'],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}else{_0x20250f[_0x7207('0x11')]({'type':_0x54d89b[_0x7207('0x12')],'app':_0x7207('0x1e'),'appdata':_0x7207('0x39'),'context':_0x54d89b[_0x7207('0x18')],'exten':_0x54d89b[_0x7207('0x8')],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8['priority']+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});_0x20250f[_0x7207('0x11')]({'type':_0x54d89b[_0x7207('0x12')],'app':'Set','appdata':_0x7207('0x3a'),'context':_0x54d89b['context'],'exten':_0x54d89b[_0x7207('0x8')],'priority':_0x508483[_0x7207('0x27')]+_0x4e16f8[_0x7207('0xd')]+_0x49916c++,'VoiceExtensionId':_0x54d89b[_0x7207('0x17')]});}}}for(var _0x2fa964=0x0;_0x2fa964<_0x508483[_0x7207('0x27')];_0x2fa964+=0x1){var _0x32e6ac=_0x4e16f8[_0x7207('0xd')]+_0x508483['length'];var _0x3abefa=_0x2fa964===_0x508483['length']-0x1?_0x4e16f8[_0x7207('0xd')]+_0x20250f['length']+_0x2c2c92[_0x7207('0x27')]+0x2:_0x4e16f8['priority']+_0x2fa964+0x1;_0x20250f[_0x7207('0x3b')](_0x2fa964,0x0,{'type':_0x54d89b['type'],'app':_0x7207('0x3c'),'appdata':_0x508483[_0x2fa964]+'?'+_0x54d89b['context']+',${EXTEN},'+_0x32e6ac+':'+_0x54d89b['context']+',${EXTEN},'+_0x3abefa,'exten':_0x54d89b[_0x7207('0x8')],'context':_0x54d89b[_0x7207('0x18')],'priority':_0x4e16f8[_0x7207('0xd')]+_0x2fa964,'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});}_0x54d89b['priority']=_0x20250f['length']?_[_0x7207('0x3d')](_0x20250f)[_0x7207('0xd')]+0x1:_0x4e16f8[_0x7207('0xd')];_0x4e16f8[_0x7207('0xd')]=(_0x2c2c92['length']?_['last'](_0x2c2c92)[_0x7207('0xd')]:_0x54d89b[_0x7207('0xd')])+0x1;_0x4e16f8[_0x7207('0xe')]=_[_0x7207('0x3e')](_0x4e16f8[_0x7207('0xe')],_0x20250f,[_0x54d89b],_0x2c2c92);}_0x4e16f8['extensions'][_0x7207('0x11')]({'type':_0x4fac00[_0x501395][0x0]['type'],'app':_0x7207('0x3f'),'exten':_0x4fac00[_0x501395][0x0]['exten'],'context':_0x4fac00[_0x501395][0x0][_0x7207('0x18')],'priority':_0x4e16f8['priority'],'VoiceExtensionId':_0x4fac00[_0x501395][0x0][_0x7207('0x17')]});_0x3f5cb1[_0x7207('0x11')](_0x4fac00[_0x501395][0x0][_0x7207('0x17')]);_0x3adaea=_[_0x7207('0x3e')](_0x3adaea,_0x4e16f8[_0x7207('0xe')]);}}return _0x462a0e[_0x7207('0x40')](function(_0x1db561){return _0x462a0e[_0x7207('0x5')][_0x7207('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3f5cb1}},'transaction':_0x1db561})['then'](function(_0x2c073c){return _0x462a0e[_0x7207('0x5')]['VoiceExtension'][_0x7207('0x41')](_[_0x7207('0x42')](_0x3adaea,_0x7207('0xd')),{'transaction':_0x1db561});});});})[_0x7207('0x43')](function(_0x4ae031){console['error'](_0x4ae031);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x95af=['filter','queue','playback','hasOwnProperty','extensions','extension','find','push','type','CDR(type)=%s','VoiceExtensionId','Set','CDR(routeid)=','context','priority','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','sortBy','error','rewrite','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x95af,0x1d1));var _0xf95a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x95af[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xf95a('0x0'));function rewrite(_0x24ee36,_0x1c6269){var _0x32770d=this;return _0x24ee36[_0xf95a('0x1')]['Interval'][_0xf95a('0x2')]({'raw':!![]})[_0xf95a('0x3')](function(_0x307fa0){_0x32770d[_0xf95a('0x4')]=_0x307fa0;return _0x24ee36[_0xf95a('0x1')][_0xf95a('0x5')][_0xf95a('0x2')]({'where':{'IntervalId':_0x1c6269[_0xf95a('0x6')]},'raw':!![]});})[_0xf95a('0x3')](function(_0x597bf0){return _0x24ee36[_0xf95a('0x1')][_0xf95a('0x5')]['findAll']({'where':{'exten':{'$in':_[_0xf95a('0x7')](_[_0xf95a('0x8')](_0x597bf0,_0xf95a('0x9')))}},'order':[{'raw':_0xf95a('0xa')}],'raw':!![]});})['then'](function(_0x32ed34){var _0x96a7fe=_[_0xf95a('0xb')](_0x32ed34,{'priority':'1'});var _0x232b70=_['filter'](_0x32ed34,{'isApp':0x1});var _0x4c5a2f=_['groupBy'](_0x232b70,_0xf95a('0x9'));var _0x586635=[_0xf95a('0xc'),_0xf95a('0xd')];var _0xe1659f=[];var _0x12040b=[];for(var _0x36dfb0 in _0x4c5a2f){if(_0x4c5a2f[_0xf95a('0xe')](_0x36dfb0)){_0x32770d['priority']=0x2;_0x32770d[_0xf95a('0xf')]=[];_0x32770d[_0xf95a('0x10')]=_[_0xf95a('0x11')](_0x96a7fe,{'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')]});_0x32770d['extensions'][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':util['format'](_0xf95a('0x14'),_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')]),'context':_0x4c5a2f[_0x36dfb0][0x0]['context'],'exten':_0x4c5a2f[_0x36dfb0][0x0]['exten'],'priority':_0x32770d['priority']++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});if(_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')]==='inbound'){_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x17')+_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')],'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0]['VoiceExtensionId']});}else if(_0x4c5a2f[_0x36dfb0][0x0]['type']===_0xf95a('0x1a')){if(_0x32770d[_0xf95a('0x10')]){_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':_0xf95a('0x1b')+(_0x32770d['extension'][_0xf95a('0x1c')]?'${EXTEN:'+_0x32770d[_0xf95a('0x10')][_0xf95a('0x1c')]+'}':_0xf95a('0x1d')),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d['priority']++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});}_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':_0xf95a('0x17')+_0x4c5a2f[_0x36dfb0][0x0]['VoiceExtensionId'],'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});var _0x4766bf=_0x32770d[_0xf95a('0x19')]++;_0x32770d['extensions']['push']({'type':_0x4c5a2f[_0x36dfb0][0x0]['type'],'app':_0xf95a('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4766bf+0x2)+_0xf95a('0x1f')+(_0x4766bf+0x1)+')','context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x4766bf,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0]['VoiceExtensionId']});if(_0x32770d[_0xf95a('0x10')]){_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':_0x32770d['extension'][_0xf95a('0x1c')]?_0xf95a('0x20')+_0x32770d['extension'][_0xf95a('0x1c')]+'}':_0xf95a('0x21'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});}_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':_0xf95a('0x22')+_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')],'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d['priority']++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});if(_0x32770d[_0xf95a('0x10')]&&_0x32770d[_0xf95a('0x10')]['hasOwnProperty'](_0xf95a('0x23'))&&_0x32770d[_0xf95a('0x10')][_0xf95a('0x23')]!==_0xf95a('0x24')){_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x25'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});_0x32770d['extensions'][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0]['type'],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x26')+_0x32770d[_0xf95a('0x10')][_0xf95a('0x23')]||'wav','context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0]['exten'],'priority':_0x32770d['priority']++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});}}_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x27'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});_0x32770d['extensions'][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x28'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});_0x32770d[_0xf95a('0xf')]['push']({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x29'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});for(var _0x325bb6=0x0,_0xc7b276=0x0;_0x325bb6<_0x4c5a2f[_0x36dfb0][_0xf95a('0x2a')];_0x325bb6+=0x1,_0xc7b276=0x0){var _0x2a6304=_0x4c5a2f[_0x36dfb0][_0x325bb6];if(_0x2a6304['type']){_0x2a6304[_0xf95a('0x13')]=_0x2a6304[_0xf95a('0x13')]['toLowerCase']();}var _0x2bdeb7=[];var _0x11dd4b=[];delete _0x2a6304['id'];delete _0x2a6304['createdAt'];delete _0x2a6304['updatedAt'];var _0x418b7f=_0x2a6304[_0xf95a('0x2b')]!==_0xf95a('0x2c')?[_0x2a6304['interval']]:_0x2a6304['IntervalId']?_['map'](_[_0xf95a('0xb')](_0x32770d['intervals'],{'IntervalId':_0x2a6304[_0xf95a('0x6')]}),_0xf95a('0x2b')):[];if(_0x2a6304[_0xf95a('0xe')](_0xf95a('0x2d'))){if(_0x2a6304['tag']&&_0x2a6304[_0xf95a('0x2d')]!=='--'){_0x2bdeb7[_0xf95a('0x12')]({'type':_0x2a6304['type'],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x2e')+_0x2a6304[_0xf95a('0x2d')],'context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});}}if(_0x2a6304['type']==='outbound'&&_0x2a6304[_0xf95a('0xe')](_0xf95a('0x2f'))){if(_0x2a6304['callerID']){_0x2bdeb7[_0xf95a('0x12')]({'type':_0x2a6304[_0xf95a('0x13')],'app':_0xf95a('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2a6304[_0xf95a('0x2f')]+')','context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d['priority']+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});}else{_0x2bdeb7[_0xf95a('0x12')]({'type':_0x2a6304[_0xf95a('0x13')],'app':'ExecIf','appdata':_0xf95a('0x30'),'context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d['priority']+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});}}if(_0x2a6304['hasOwnProperty']('answer')){if(_0x586635[_0xf95a('0x31')](_0x2a6304[_0xf95a('0x32')]['toLowerCase']())>=0x0&&_0x2a6304[_0xf95a('0x33')]!==_0xf95a('0x34')){if(_0x2a6304[_0xf95a('0x35')]){_0x2bdeb7[_0xf95a('0x12')]({'type':_0x2a6304[_0xf95a('0x13')],'app':_0xf95a('0x1e'),'appdata':_0xf95a('0x36'),'context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});_0x2bdeb7['push']({'type':_0x2a6304[_0xf95a('0x13')],'app':'Set','appdata':_0xf95a('0x37'),'context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});}else{_0x2bdeb7['push']({'type':_0x2a6304['type'],'app':_0xf95a('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});_0x2bdeb7['push']({'type':_0x2a6304[_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x38'),'context':_0x2a6304['context'],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304['VoiceExtensionId']});}}}for(var _0x596e3e=0x0;_0x596e3e<_0x418b7f[_0xf95a('0x2a')];_0x596e3e+=0x1){var _0x31ac1f=_0x32770d['priority']+_0x418b7f[_0xf95a('0x2a')];var _0x2a92b1=_0x596e3e===_0x418b7f[_0xf95a('0x2a')]-0x1?_0x32770d[_0xf95a('0x19')]+_0x2bdeb7[_0xf95a('0x2a')]+_0x11dd4b[_0xf95a('0x2a')]+0x2:_0x32770d['priority']+_0x596e3e+0x1;_0x2bdeb7[_0xf95a('0x39')](_0x596e3e,0x0,{'type':_0x2a6304[_0xf95a('0x13')],'app':_0xf95a('0x3a'),'appdata':_0x418b7f[_0x596e3e]+'?'+_0x2a6304[_0xf95a('0x18')]+_0xf95a('0x3b')+_0x31ac1f+':'+_0x2a6304[_0xf95a('0x18')]+',${EXTEN},'+_0x2a92b1,'exten':_0x2a6304['exten'],'context':_0x2a6304['context'],'priority':_0x32770d[_0xf95a('0x19')]+_0x596e3e,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0]['VoiceExtensionId']});}_0x2a6304[_0xf95a('0x19')]=_0x2bdeb7['length']?_['last'](_0x2bdeb7)[_0xf95a('0x19')]+0x1:_0x32770d[_0xf95a('0x19')];_0x32770d['priority']=(_0x11dd4b[_0xf95a('0x2a')]?_[_0xf95a('0x3c')](_0x11dd4b)[_0xf95a('0x19')]:_0x2a6304[_0xf95a('0x19')])+0x1;_0x32770d[_0xf95a('0xf')]=_['concat'](_0x32770d[_0xf95a('0xf')],_0x2bdeb7,[_0x2a6304],_0x11dd4b);}_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x3d'),'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'priority':_0x32770d[_0xf95a('0x19')],'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});_0xe1659f[_0xf95a('0x12')](_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]);_0x12040b=_[_0xf95a('0x3e')](_0x12040b,_0x32770d['extensions']);}}return _0x24ee36[_0xf95a('0x3f')](function(_0x51f737){return _0x24ee36[_0xf95a('0x1')][_0xf95a('0x5')][_0xf95a('0x40')]({'where':{'VoiceExtensionId':{'$in':_0xe1659f}},'transaction':_0x51f737})[_0xf95a('0x3')](function(_0xc964c9){return _0x24ee36[_0xf95a('0x1')]['VoiceExtension']['bulkCreate'](_[_0xf95a('0x41')](_0x12040b,_0xf95a('0x19')),{'transaction':_0x51f737});});});})['catch'](function(_0x88884b){console[_0xf95a('0x42')](_0x88884b);});}exports[_0xf95a('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 10ccb9d..8ca7e29 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 _0x5905=['CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','resolve','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','into','fromQuery','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','VoiceQueue','outbound','Lists'];(function(_0x5c96d8,_0x2bb659){var _0x4a0263=function(_0x36e0be){while(--_0x36e0be){_0x5c96d8['push'](_0x5c96d8['shift']());}};_0x4a0263(++_0x2bb659);}(_0x5905,0xea));var _0x5590=function(_0x380c2d,_0x555eb9){_0x380c2d=_0x380c2d-0x0;var _0x5a1ba2=_0x5905[_0x380c2d];return _0x5a1ba2;};'use strict';var BPromise=require(_0x5590('0x0'));var util=require(_0x5590('0x1'));var _=require(_0x5590('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x5590('0x3'));var Redis=require(_0x5590('0x4'));var db=require(_0x5590('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0x5590('0x6')]=_['defaults'](config[_0x5590('0x6')],{'host':_0x5590('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5590('0x8'))['register'](socket);try{if(!process[_0x5590('0x9')][0x2]||process[_0x5590('0x9')][0x2]===_0x5590('0xa')||process['argv'][0x2]==='null'){throw new Error(_0x5590('0xb'));}var FILEPATH=process[_0x5590('0x9')][0x2];if(!process[_0x5590('0x9')][0x3]||process[_0x5590('0x9')][0x3]===_0x5590('0xa')||process[_0x5590('0x9')][0x3]===_0x5590('0xc')||!process[_0x5590('0x9')][0x4]||process['argv'][0x4]===_0x5590('0xa')||process[_0x5590('0x9')][0x4]===_0x5590('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x5590('0xd')](process['argv'][0x3][_0x5590('0xe')](','),process[_0x5590('0x9')][0x4][_0x5590('0xe')](','));if(!process[_0x5590('0x9')][0x5]||process['argv'][0x5]===_0x5590('0xa')||process[_0x5590('0x9')][0x5]===_0x5590('0xc')){throw new Error(_0x5590('0xf'));}var LISTID=process[_0x5590('0x9')][0x5];var COMPANYID=process[_0x5590('0x9')][0x6]&&process[_0x5590('0x9')][0x6]!==_0x5590('0xa')&&process['argv'][0x6]!==_0x5590('0xc')?process[_0x5590('0x9')][0x6]:null;var DUPLICATES=process[_0x5590('0x9')][0x7]&&process[_0x5590('0x9')][0x7]!==_0x5590('0xa')&&process[_0x5590('0x9')][0x7]!==_0x5590('0xc')?process[_0x5590('0x9')][0x7]:null;if(!process[_0x5590('0x9')][0x8]||process['argv'][0x8]===_0x5590('0xa')||process['argv'][0x8]===_0x5590('0xc')){throw new Error(_0x5590('0x10'));}var SOCKET_TIMESTAMP=process[_0x5590('0x9')][0x8];}catch(_0x5813a8){logger[_0x5590('0x11')](_0x5813a8);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(_0x53fe82,_0x12a706,_0xa796e1,_0x101809){var _0x5c7658={'message':_0x12a706};_0x5c7658[_0x53fe82]=!![];if(_0xa796e1){_0x5c7658['contact']=_0xa796e1;}if(_0x101809){_0x5c7658['index']=_0x101809;}return _0x5c7658;}function isEmail(_0x48f284){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'](_0x48f284);}function checkRow(_0x5f4867,_0x4ab450,_0x208fea){return new BPromise(function(_0x45d39d,_0x3be8c1){if(_[_0x5590('0x12')](_0x5f4867)){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),_0x5590('0x13'),null,_0x208fea));}if(_0x5f4867[_0x5590('0x14')]&&_0x5f4867['errors'][_0x5590('0x15')]){var _0x27a266=_[_0x5590('0x16')](_0x5f4867['errors'],'message')['join'](';');return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),_0x27a266,null,_0x208fea));}var _0x22f6dd={};for(var _0x2ee23c in FIELDS){if(FIELDS[_0x5590('0x17')](_0x2ee23c)&&FIELDS[_0x2ee23c]){_0x22f6dd[_0x2ee23c]=_0x5f4867['data'][0x0][FIELDS[_0x2ee23c]]||_0x5f4867[_0x5590('0x18')][0x0]['\ufeff'+FIELDS[_0x2ee23c]];}}if(!_0x22f6dd[_0x5590('0x19')]){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),'firstName\x20not\x20specified!',null,_0x208fea));}if(!_0x22f6dd[_0x5590('0x1a')]){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),'phone\x20not\x20specified!',null,_0x208fea));}if(_0x22f6dd['birthDate']){var _0x409fcf=moment(_0x22f6dd[_0x5590('0x1b')],_0x5590('0x1c'));if(!_0x409fcf[_0x5590('0x1d')]()){return _0x3be8c1(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x208fea));}}if(_0x22f6dd[_0x5590('0x1e')]){if(!isEmail(_0x22f6dd[_0x5590('0x1e')])){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),_0x5590('0x1f'),null,_0x208fea));}}_0x22f6dd[_0x5590('0x20')]=LISTID;_0x22f6dd[_0x5590('0x21')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5590('0x15')]&&_0x4ab450){var _0x276c89={};for(var _0x46a665=0x0,_0x292fee=DUPLICATES[_0x5590('0x15')];_0x46a665<_0x292fee;_0x46a665+=0x1){_0x276c89[DUPLICATES[_0x46a665]]=_0x22f6dd[DUPLICATES[_0x46a665]];}var _0x20da7e=_[_0x5590('0x22')](_0x4ab450,_0x276c89);if(_0x20da7e){return _0x3be8c1(handleCheckRowError(_0x5590('0x23'),_0x5590('0x24'),_0x20da7e,_0x208fea));}}return db['CmContact']['create'](_0x22f6dd,{'raw':!![],'hooks':![],'fields':_[_0x5590('0x25')](_0x22f6dd)})[_0x5590('0x26')](function(_0x2f94e1){if(DUPLICATES&&DUPLICATES[_0x5590('0x15')]&&_0x4ab450){_0x4ab450['push'](_[_0x5590('0x27')](_0x22f6dd,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2f94e1['id'];return _0x45d39d();})[_0x5590('0x28')](function(_0x287c81){return _0x3be8c1(handleCheckRowError(_0x5590('0x11'),_0x5590('0x29')+(_0x287c81['message']||JSON[_0x5590('0x2a')](_0x287c81)),null,_0x208fea));});});}function checkHopper(){function _0x9b9bc0(){return function(_0x56ad8e){logger[_0x5590('0x11')](_0x5590('0x2b'),'checkHopper',util[_0x5590('0x2c')](_0x56ad8e,{'showHidden':![],'depth':null}));};}var _0x255c95=function(_0x1fbe77,_0x4a29cf){var _0x1f203a=squel[_0x5590('0x2d')]()['into']('cm_hopper')['fromQuery']([_0x5590('0x1a'),_0x5590('0x2e'),_0x5590('0x2f'),_0x5590('0x20'),_0x4a29cf,_0x5590('0x30'),_0x5590('0x31')],squel[_0x5590('0x32')]()[_0x5590('0x33')](_0x5590('0x1a'),_0x5590('0x1a'))[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x2e'))['field']('id','ContactId')[_0x5590('0x33')](LISTID[_0x5590('0x35')](),'ListId')[_0x5590('0x33')](_0x1fbe77['id']['toString'](),_0x4a29cf)[_0x5590('0x33')](_0x5590('0x34'),'createdAt')[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x31'))[_0x5590('0x36')](_0x5590('0x37'))[_0x5590('0x38')]('deletedAt\x20IS\x20NULL')[_0x5590('0x38')]('ListId\x20=\x20?',LISTID[_0x5590('0x35')]())[_0x5590('0x38')](_0x5590('0x39'))[_0x5590('0x38')](_0x5590('0x3a'),squel['select']()[_0x5590('0x33')](_0x5590('0x1a'))[_0x5590('0x36')](_0x5590('0x3b'))['where'](_0x4a29cf+'\x20=\x20?',_0x1fbe77['id']['toString']())))[_0x5590('0x35')]();return _0x1f203a;};var _0x1c2052=function(_0x343868,_0x37345b){var _0x1de134=squel[_0x5590('0x2d')]()[_0x5590('0x3c')]('cm_hopper')[_0x5590('0x3d')]([_0x5590('0x1a'),_0x5590('0x2e'),_0x5590('0x2f'),_0x5590('0x20'),_0x37345b,'createdAt',_0x5590('0x31')],squel[_0x5590('0x32')]()['field'](_0x5590('0x1a'),_0x5590('0x1a'))[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x2e'))['field']('id',_0x5590('0x2f'))['field'](LISTID[_0x5590('0x35')](),_0x5590('0x20'))['field'](_0x343868['id'][_0x5590('0x35')](),_0x37345b)[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x30'))['field']('NOW()',_0x5590('0x31'))[_0x5590('0x36')](_0x5590('0x37'))[_0x5590('0x38')](_0x5590('0x3e'))[_0x5590('0x38')](_0x5590('0x3f'),LISTID['toString']())[_0x5590('0x38')](_0x5590('0x40'),squel['str'](hopperContacts))['where'](_0x5590('0x39'))[_0x5590('0x38')](_0x5590('0x3a'),squel[_0x5590('0x32')]()['field']('calleridnum')[_0x5590('0x36')]('cm_hopper_final')[_0x5590('0x38')](_0x37345b+'\x20=\x20?',_0x343868['id'][_0x5590('0x35')]()))[_0x5590('0x38')](_0x5590('0x3a'),squel[_0x5590('0x32')]()[_0x5590('0x33')](_0x5590('0x1a'))[_0x5590('0x36')](_0x5590('0x3b'))[_0x5590('0x38')](_0x37345b+'\x20=\x20?',_0x343868['id'][_0x5590('0x35')]())))['toString']();return _0x1de134;};function _0x4f3200(_0x3cb9e0,_0x393c55){var _0x564fd5=squel[_0x5590('0x2d')]()['into']('cm_hopper')['fromQuery']([_0x5590('0x1a'),_0x5590('0x2e'),'ContactId',_0x5590('0x20'),_0x393c55,'createdAt',_0x5590('0x31')],squel[_0x5590('0x32')]()['field'](_0x5590('0x1a'),_0x5590('0x1a'))[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x2e'))[_0x5590('0x33')]('id',_0x5590('0x2f'))['field'](LISTID[_0x5590('0x35')](),_0x5590('0x20'))[_0x5590('0x33')](_0x3cb9e0['id'][_0x5590('0x35')](),_0x393c55)[_0x5590('0x33')](_0x5590('0x34'),'createdAt')[_0x5590('0x33')]('NOW()',_0x5590('0x31'))['from'](_0x5590('0x37'))[_0x5590('0x38')]('deletedAt\x20IS\x20NULL')['where'](_0x5590('0x3f'),LISTID[_0x5590('0x35')]())['where'](_0x5590('0x40'),squel[_0x5590('0x41')](hopperContacts))[_0x5590('0x38')](_0x5590('0x39')))[_0x5590('0x35')]();return _0x564fd5;}function _0x24dfab(_0x192f9b,_0x3b706f){var _0x1fbd46=squel[_0x5590('0x2d')]()[_0x5590('0x3c')](_0x5590('0x42'))[_0x5590('0x3d')](['phone',_0x5590('0x2f'),'ListId',_0x3b706f,_0x5590('0x30'),'updatedAt'],squel[_0x5590('0x32')]()['field'](_0x5590('0x1a'),_0x5590('0x1a'))[_0x5590('0x33')]('id',_0x5590('0x2f'))[_0x5590('0x33')](LISTID[_0x5590('0x35')](),_0x5590('0x20'))['field'](_0x192f9b['id'][_0x5590('0x35')](),_0x3b706f)[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x30'))[_0x5590('0x33')](_0x5590('0x34'),_0x5590('0x31'))[_0x5590('0x36')]('cm_contacts')[_0x5590('0x38')](_0x5590('0x3e'))['where'](_0x5590('0x3f'),LISTID[_0x5590('0x35')]())[_0x5590('0x38')]('id\x20IN\x20?',squel[_0x5590('0x41')](hopperContacts))['where'](_0x5590('0x39')))[_0x5590('0x35')]();return _0x1fbd46;}return db['VoiceQueue'][_0x5590('0x43')]({'where':{'type':'outbound'},'attributes':['id',_0x5590('0x44')],'include':[{'model':db[_0x5590('0x45')],'as':'Lists','where':{'id':LISTID}}]})[_0x5590('0x26')](function(_0x5a91fa){var _0x3b8bf5=[];if(_0x5a91fa){var _0x18107a;for(var _0xe3236a=0x0,_0x514de0;_0xe3236a<_0x5a91fa[_0x5590('0x15')];_0xe3236a+=0x1){_0x514de0=_0x5a91fa[_0xe3236a][_0x5590('0x46')]({'plain':!![]});switch(_0x514de0[_0x5590('0x44')]){case _0x5590('0x47'):_0x3b8bf5[_0x5590('0x48')](db[_0x5590('0x49')][_0x5590('0x4a')](_0x1c2052(_0x514de0,_0x5590('0x4b')))[_0x5590('0x26')](function(){})[_0x5590('0x28')](_0x9b9bc0()));break;case _0x5590('0x4c'):_0x3b8bf5[_0x5590('0x48')](db[_0x5590('0x49')]['query'](_0x255c95(_0x514de0,_0x5590('0x4b')))[_0x5590('0x26')](function(){})[_0x5590('0x28')](_0x9b9bc0()));break;default:_0x3b8bf5[_0x5590('0x48')](db['sequelize'][_0x5590('0x4a')](_0x4f3200(_0x514de0,'VoiceQueueId'))[_0x5590('0x26')](function(){})[_0x5590('0x28')](_0x9b9bc0()));}}}return _0x3b8bf5;})[_0x5590('0x4d')]()[_0x5590('0x26')](function(){return db[_0x5590('0x4e')][_0x5590('0x43')]({'where':{'type':_0x5590('0x4f')},'attributes':['id'],'include':[{'model':db[_0x5590('0x45')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x552d7c){var _0x3f2ea3=[];if(_0x552d7c){var _0x4d61bd;for(var _0x5afa18=0x0,_0x4c8035;_0x5afa18<_0x552d7c[_0x5590('0x15')];_0x5afa18+=0x1){_0x4c8035=_0x552d7c[_0x5afa18]['get']({'plain':!![]});_0x3f2ea3[_0x5590('0x48')](db[_0x5590('0x49')][_0x5590('0x4a')](_0x24dfab(_0x4c8035,'VoiceQueueId'))[_0x5590('0x26')](function(){})['catch'](_0x9b9bc0()));}}return _0x3f2ea3;})[_0x5590('0x4d')]();})[_0x5590('0x26')](function(){return db['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x5590('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x258a97){var _0x23d303=[];if(_0x258a97){for(var _0x39a434=0x0,_0x2dd991;_0x39a434<_0x258a97[_0x5590('0x15')];_0x39a434+=0x1){_0x2dd991=_0x258a97[_0x39a434][_0x5590('0x46')]({'plain':!![]});switch(_0x2dd991['dialCheckDuplicateType']){case'always':_0x23d303[_0x5590('0x48')](db[_0x5590('0x49')][_0x5590('0x4a')](_0x1c2052(_0x2dd991,_0x5590('0x51')))[_0x5590('0x26')](function(){})[_0x5590('0x28')](_0x9b9bc0()));break;case _0x5590('0x4c'):_0x23d303[_0x5590('0x48')](db['sequelize'][_0x5590('0x4a')](_0x255c95(_0x2dd991,_0x5590('0x51')))['then'](function(){})['catch'](_0x9b9bc0()));break;default:_0x23d303[_0x5590('0x48')](db[_0x5590('0x49')][_0x5590('0x4a')](_0x4f3200(_0x2dd991,_0x5590('0x51')))['then'](function(){})[_0x5590('0x28')](_0x9b9bc0()));}}}return _0x23d303;})['all']();})[_0x5590('0x26')](function(){return db[_0x5590('0x52')][_0x5590('0x43')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x5590('0x53'),'where':{'id':LISTID}}]})[_0x5590('0x26')](function(_0x3b279c){var _0x5caa26=[];if(_0x3b279c){for(var _0x43bec1=0x0,_0x596ed7;_0x43bec1<_0x3b279c[_0x5590('0x15')];_0x43bec1+=0x1){_0x596ed7=_0x3b279c[_0x43bec1][_0x5590('0x46')]({'plain':!![]});_0x5caa26['push'](db[_0x5590('0x49')][_0x5590('0x4a')](_0x24dfab(_0x596ed7,_0x5590('0x51')))['then'](function(){})[_0x5590('0x28')](_0x9b9bc0()));}}return _0x5caa26;})[_0x5590('0x4d')]();})['catch'](function(_0x34bb0c){logger[_0x5590('0x11')](_0x5590('0x54'),_0x5590('0x55'),_0x34bb0c[_0x5590('0x56')]);});}var processPromises=function(_0x56e1d8){return BPromise['all'](promises)[_0x5590('0x26')](function(_0x27a29b){})[_0x5590('0x28')](function(_0x3bb643){logger[_0x5590('0x11')](_0x5590('0x57'),JSON['stringify'](_0x3bb643));})[_0x5590('0x58')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x56e1d8){return _0x56e1d8['resume']();}});};var endCsv=function(){return BPromise[_0x5590('0x59')]()[_0x5590('0x26')](function(){if(hopperContacts){return checkHopper();}})[_0x5590('0x26')](function(){socket[_0x5590('0x5a')](_0x5590('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5590('0x5c')](FILEPATH);}catch(_0x52076b){logger[_0x5590('0x11')](_0x5590('0x5d'),JSON[_0x5590('0x2a')](_0x52076b));}finally{process[_0x5590('0x5e')](0x0);}});};process['on'](_0x5590('0x5f'),function(){logger[_0x5590('0x60')](_0x5590('0x61'));endCsv();});function main(){return BPromise[_0x5590('0x59')]()[_0x5590('0x26')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x5590('0x62')][_0x5590('0x43')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5590('0x26')](function(_0x1b4b65){var _0x316de4=fs[_0x5590('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5590('0x64')](_0x316de4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5f3b34,_0x179594){total+=0x1;var _0x3fe9d6=total;promises[_0x5590('0x48')](checkRow(_0x5f3b34,_0x1b4b65,_0x3fe9d6)[_0x5590('0x26')](function(){success+=0x1;})[_0x5590('0x28')](function(_0x11cfc9){if(_0x11cfc9[_0x5590('0x11')]){errors+=0x1;delete _0x11cfc9[_0x5590('0x11')];}else if(_0x11cfc9['duplicate']){duplicates+=0x1;delete _0x11cfc9[_0x5590('0x23')];}rows[_0x5590('0x48')](_0x11cfc9);}));if(total%0xc8===0x0){_0x179594[_0x5590('0x65')]();return processPromises(_0x179594);}},'complete':function(){return processPromises()['then'](function(){logger[_0x5590('0x60')](_0x5590('0x66'));endCsv();});},'error':function(_0x101f4e,_0x56e643){logger[_0x5590('0x60')](_0x5590('0x67'),JSON[_0x5590('0x2a')](_0x101f4e));endCsv();}});})[_0x5590('0x28')](function(_0x1b37ea){logger[_0x5590('0x11')](_0x5590('0x68'),JSON[_0x5590('0x2a')](_0x1b37ea));});}main(); \ No newline at end of file +var _0x5463=['inspect','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','insert','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','push','all','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','test','isNil','errors','length','message','join','error','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','pick','catch','stringify','cmContact','checkHopper'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x5463,0x17f));var _0x3546=function(_0x3ffbec,_0x27df31){_0x3ffbec=_0x3ffbec-0x0;var _0x503dd3=_0x5463[_0x3ffbec];return _0x503dd3;};'use strict';var BPromise=require(_0x3546('0x0'));var util=require(_0x3546('0x1'));var _=require(_0x3546('0x2'));var fs=require('fs');var squel=require(_0x3546('0x3'));var Papa=require(_0x3546('0x4'));var Redis=require(_0x3546('0x5'));var db=require(_0x3546('0x6'))['db'];var config=require(_0x3546('0x7'));var logger=require(_0x3546('0x8'))('api');config['redis']=_[_0x3546('0x9')](config[_0x3546('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3546('0xb'))(new Redis(config[_0x3546('0xa')]));require(_0x3546('0xc'))['register'](socket);try{if(!process[_0x3546('0xd')][0x2]||process[_0x3546('0xd')][0x2]==='undefined'||process['argv'][0x2]===_0x3546('0xe')){throw new Error(_0x3546('0xf'));}var FILEPATH=process[_0x3546('0xd')][0x2];if(!process[_0x3546('0xd')][0x3]||process['argv'][0x3]===_0x3546('0x10')||process[_0x3546('0xd')][0x3]===_0x3546('0xe')||!process['argv'][0x4]||process['argv'][0x4]===_0x3546('0x10')||process['argv'][0x4]===_0x3546('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x3546('0x11')](process['argv'][0x3][_0x3546('0x12')](','),process['argv'][0x4]['split'](','));if(!process[_0x3546('0xd')][0x5]||process[_0x3546('0xd')][0x5]===_0x3546('0x10')||process[_0x3546('0xd')][0x5]===_0x3546('0xe')){throw new Error(_0x3546('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x3546('0xd')][0x6]&&process[_0x3546('0xd')][0x6]!==_0x3546('0x10')&&process['argv'][0x6]!=='null'?process[_0x3546('0xd')][0x6]:null;var DUPLICATES=process[_0x3546('0xd')][0x7]&&process[_0x3546('0xd')][0x7]!=='undefined'&&process[_0x3546('0xd')][0x7]!==_0x3546('0xe')?process[_0x3546('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x3546('0xd')][0x8]==='undefined'||process[_0x3546('0xd')][0x8]==='null'){throw new Error(_0x3546('0x14'));}var SOCKET_TIMESTAMP=process[_0x3546('0xd')][0x8];}catch(_0x4524c0){logger['error'](_0x4524c0);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(_0x5ee2a9,_0x27112d,_0x24ed8d,_0xc2750c){var _0x47700d={'message':_0x27112d};_0x47700d[_0x5ee2a9]=!![];if(_0x24ed8d){_0x47700d[_0x3546('0x15')]=_0x24ed8d;}if(_0xc2750c){_0x47700d['index']=_0xc2750c;}return _0x47700d;}function isEmail(_0x42a1fa){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))*$/[_0x3546('0x16')](_0x42a1fa);}function checkRow(_0x370fae,_0x14daa2,_0x25cb25){return new BPromise(function(_0x27e096,_0x5d31ae){if(_[_0x3546('0x17')](_0x370fae)){return _0x5d31ae(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x25cb25));}if(_0x370fae[_0x3546('0x18')]&&_0x370fae['errors'][_0x3546('0x19')]){var _0x47c681=_['map'](_0x370fae[_0x3546('0x18')],_0x3546('0x1a'))[_0x3546('0x1b')](';');return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),_0x47c681,null,_0x25cb25));}var _0x2c0660={};for(var _0x40b7f3 in FIELDS){if(FIELDS['hasOwnProperty'](_0x40b7f3)&&FIELDS[_0x40b7f3]){_0x2c0660[_0x40b7f3]=_0x370fae[_0x3546('0x1d')][0x0][FIELDS[_0x40b7f3]]||_0x370fae[_0x3546('0x1d')][0x0]['\ufeff'+FIELDS[_0x40b7f3]];}}if(!_0x2c0660['firstName']){return _0x5d31ae(handleCheckRowError('error',_0x3546('0x1e'),null,_0x25cb25));}if(!_0x2c0660[_0x3546('0x1f')]){return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),_0x3546('0x20'),null,_0x25cb25));}if(_0x2c0660['birthDate']){var _0x1aa038=moment(_0x2c0660[_0x3546('0x21')],_0x3546('0x22'));if(!_0x1aa038[_0x3546('0x23')]()){return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x25cb25));}}if(_0x2c0660[_0x3546('0x24')]){if(!isEmail(_0x2c0660['email'])){return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),'email\x20format\x20is\x20not\x20valid!',null,_0x25cb25));}}_0x2c0660[_0x3546('0x25')]=LISTID;_0x2c0660[_0x3546('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3546('0x19')]&&_0x14daa2){var _0x4fd386={};for(var _0x220eb7=0x0,_0x23b980=DUPLICATES[_0x3546('0x19')];_0x220eb7<_0x23b980;_0x220eb7+=0x1){_0x4fd386[DUPLICATES[_0x220eb7]]=_0x2c0660[DUPLICATES[_0x220eb7]];}var _0x594b3a=_[_0x3546('0x27')](_0x14daa2,_0x4fd386);if(_0x594b3a){return _0x5d31ae(handleCheckRowError(_0x3546('0x28'),_0x3546('0x29'),_0x594b3a,_0x25cb25));}}return db[_0x3546('0x2a')]['create'](_0x2c0660,{'raw':!![],'hooks':![],'fields':_[_0x3546('0x2b')](_0x2c0660)})['then'](function(_0x5a0b9f){if(DUPLICATES&&DUPLICATES[_0x3546('0x19')]&&_0x14daa2){_0x14daa2['push'](_[_0x3546('0x2c')](_0x2c0660,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5a0b9f['id'];return _0x27e096();})[_0x3546('0x2d')](function(_0x1c04cc){return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),'Error\x20while\x20creating\x20contact:\x20'+(_0x1c04cc[_0x3546('0x1a')]||JSON[_0x3546('0x2e')](_0x1c04cc)),null,_0x25cb25));});});}function checkHopper(){function _0x169bf3(){return function(_0x46f632){logger[_0x3546('0x1c')](_0x3546('0x2f'),_0x3546('0x30'),util[_0x3546('0x31')](_0x46f632,{'showHidden':![],'depth':null}));};}var _0x3341dc=function(_0x38ffb0,_0x1340a9){var _0x1f8545=squel['insert']()[_0x3546('0x32')](_0x3546('0x33'))['fromQuery'](['phone',_0x3546('0x34'),_0x3546('0x35'),_0x3546('0x25'),_0x1340a9,_0x3546('0x36'),_0x3546('0x37')],squel['select']()[_0x3546('0x38')](_0x3546('0x1f'),_0x3546('0x1f'))[_0x3546('0x38')](_0x3546('0x39'),_0x3546('0x34'))['field']('id','ContactId')[_0x3546('0x38')](LISTID[_0x3546('0x3a')](),_0x3546('0x25'))[_0x3546('0x38')](_0x38ffb0['id'][_0x3546('0x3a')](),_0x1340a9)['field'](_0x3546('0x39'),'createdAt')['field'](_0x3546('0x39'),'updatedAt')[_0x3546('0x3b')](_0x3546('0x3c'))[_0x3546('0x3d')](_0x3546('0x3e'))['where'](_0x3546('0x3f'),LISTID[_0x3546('0x3a')]())[_0x3546('0x3d')](_0x3546('0x40'))['where'](_0x3546('0x41'),squel[_0x3546('0x42')]()[_0x3546('0x38')](_0x3546('0x1f'))[_0x3546('0x3b')](_0x3546('0x33'))[_0x3546('0x3d')](_0x1340a9+_0x3546('0x43'),_0x38ffb0['id'][_0x3546('0x3a')]())))[_0x3546('0x3a')]();return _0x1f8545;};var _0x1a8a0c=function(_0x3814e1,_0x26e21a){var _0x1a4e87=squel[_0x3546('0x44')]()[_0x3546('0x32')](_0x3546('0x33'))[_0x3546('0x45')]([_0x3546('0x1f'),_0x3546('0x34'),_0x3546('0x35'),_0x3546('0x25'),_0x26e21a,_0x3546('0x36'),_0x3546('0x37')],squel[_0x3546('0x42')]()[_0x3546('0x38')](_0x3546('0x1f'),_0x3546('0x1f'))[_0x3546('0x38')](_0x3546('0x39'),'scheduledAt')[_0x3546('0x38')]('id','ContactId')[_0x3546('0x38')](LISTID['toString'](),_0x3546('0x25'))[_0x3546('0x38')](_0x3814e1['id'][_0x3546('0x3a')](),_0x26e21a)[_0x3546('0x38')](_0x3546('0x39'),'createdAt')['field']('NOW()',_0x3546('0x37'))[_0x3546('0x3b')](_0x3546('0x3c'))[_0x3546('0x3d')]('deletedAt\x20IS\x20NULL')[_0x3546('0x3d')](_0x3546('0x3f'),LISTID[_0x3546('0x3a')]())[_0x3546('0x3d')](_0x3546('0x46'),squel[_0x3546('0x47')](hopperContacts))['where'](_0x3546('0x40'))[_0x3546('0x3d')](_0x3546('0x41'),squel['select']()[_0x3546('0x38')](_0x3546('0x48'))[_0x3546('0x3b')](_0x3546('0x49'))[_0x3546('0x3d')](_0x26e21a+_0x3546('0x43'),_0x3814e1['id'][_0x3546('0x3a')]()))[_0x3546('0x3d')](_0x3546('0x41'),squel['select']()[_0x3546('0x38')](_0x3546('0x1f'))['from'](_0x3546('0x33'))[_0x3546('0x3d')](_0x26e21a+_0x3546('0x43'),_0x3814e1['id'][_0x3546('0x3a')]())))[_0x3546('0x3a')]();return _0x1a4e87;};function _0x11147a(_0x4dda3f,_0x927442){var _0x555504=squel[_0x3546('0x44')]()[_0x3546('0x32')](_0x3546('0x33'))['fromQuery']([_0x3546('0x1f'),'scheduledAt',_0x3546('0x35'),'ListId',_0x927442,'createdAt','updatedAt'],squel['select']()[_0x3546('0x38')](_0x3546('0x1f'),_0x3546('0x1f'))[_0x3546('0x38')]('NOW()',_0x3546('0x34'))[_0x3546('0x38')]('id','ContactId')[_0x3546('0x38')](LISTID[_0x3546('0x3a')](),_0x3546('0x25'))[_0x3546('0x38')](_0x4dda3f['id'][_0x3546('0x3a')](),_0x927442)[_0x3546('0x38')](_0x3546('0x39'),_0x3546('0x36'))[_0x3546('0x38')](_0x3546('0x39'),_0x3546('0x37'))[_0x3546('0x3b')]('cm_contacts')[_0x3546('0x3d')](_0x3546('0x3e'))[_0x3546('0x3d')](_0x3546('0x3f'),LISTID[_0x3546('0x3a')]())[_0x3546('0x3d')](_0x3546('0x46'),squel[_0x3546('0x47')](hopperContacts))[_0x3546('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x3546('0x3a')]();return _0x555504;}function _0x5ad2e2(_0x200c3c,_0x2907a8){var _0x107a5b=squel[_0x3546('0x44')]()[_0x3546('0x32')]('cm_hopper_black')['fromQuery']([_0x3546('0x1f'),'ContactId',_0x3546('0x25'),_0x2907a8,_0x3546('0x36'),_0x3546('0x37')],squel['select']()[_0x3546('0x38')](_0x3546('0x1f'),_0x3546('0x1f'))['field']('id',_0x3546('0x35'))['field'](LISTID[_0x3546('0x3a')](),_0x3546('0x25'))[_0x3546('0x38')](_0x200c3c['id'][_0x3546('0x3a')](),_0x2907a8)[_0x3546('0x38')]('NOW()','createdAt')[_0x3546('0x38')](_0x3546('0x39'),'updatedAt')[_0x3546('0x3b')](_0x3546('0x3c'))[_0x3546('0x3d')](_0x3546('0x3e'))['where'](_0x3546('0x3f'),LISTID['toString']())[_0x3546('0x3d')](_0x3546('0x46'),squel[_0x3546('0x47')](hopperContacts))['where'](_0x3546('0x40')))[_0x3546('0x3a')]();return _0x107a5b;}return db[_0x3546('0x4a')][_0x3546('0x4b')]({'where':{'type':_0x3546('0x4c')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3546('0x4d')],'as':_0x3546('0x4e'),'where':{'id':LISTID}}]})[_0x3546('0x4f')](function(_0x2a3bed){var _0x295ba2=[];if(_0x2a3bed){var _0x5b62ba;for(var _0x679b07=0x0,_0x3a7ce9;_0x679b07<_0x2a3bed['length'];_0x679b07+=0x1){_0x3a7ce9=_0x2a3bed[_0x679b07][_0x3546('0x50')]({'plain':!![]});switch(_0x3a7ce9[_0x3546('0x51')]){case _0x3546('0x52'):_0x295ba2['push'](db[_0x3546('0x53')][_0x3546('0x54')](_0x1a8a0c(_0x3a7ce9,_0x3546('0x55')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));break;case'onlyIfOpen':_0x295ba2['push'](db[_0x3546('0x53')][_0x3546('0x54')](_0x3341dc(_0x3a7ce9,_0x3546('0x55')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));break;default:_0x295ba2[_0x3546('0x56')](db[_0x3546('0x53')][_0x3546('0x54')](_0x11147a(_0x3a7ce9,_0x3546('0x55')))['then'](function(){})[_0x3546('0x2d')](_0x169bf3()));}}}return _0x295ba2;})[_0x3546('0x57')]()[_0x3546('0x4f')](function(){return db[_0x3546('0x4a')]['findAll']({'where':{'type':_0x3546('0x4c')},'attributes':['id'],'include':[{'model':db[_0x3546('0x4d')],'as':_0x3546('0x58'),'where':{'id':LISTID}}]})[_0x3546('0x4f')](function(_0x23e470){var _0x4395fe=[];if(_0x23e470){var _0x553aab;for(var _0x10a08c=0x0,_0x552104;_0x10a08c<_0x23e470[_0x3546('0x19')];_0x10a08c+=0x1){_0x552104=_0x23e470[_0x10a08c]['get']({'plain':!![]});_0x4395fe['push'](db[_0x3546('0x53')][_0x3546('0x54')](_0x5ad2e2(_0x552104,_0x3546('0x55')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));}}return _0x4395fe;})[_0x3546('0x57')]();})['then'](function(){return db[_0x3546('0x59')][_0x3546('0x4b')]({'attributes':['id',_0x3546('0x51')],'include':[{'model':db[_0x3546('0x4d')],'as':_0x3546('0x4e'),'where':{'id':LISTID}}]})[_0x3546('0x4f')](function(_0x37375e){var _0x3765a3=[];if(_0x37375e){for(var _0x3cb71d=0x0,_0x3c1da4;_0x3cb71d<_0x37375e[_0x3546('0x19')];_0x3cb71d+=0x1){_0x3c1da4=_0x37375e[_0x3cb71d][_0x3546('0x50')]({'plain':!![]});switch(_0x3c1da4[_0x3546('0x51')]){case _0x3546('0x52'):_0x3765a3[_0x3546('0x56')](db[_0x3546('0x53')]['query'](_0x1a8a0c(_0x3c1da4,_0x3546('0x5a')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));break;case _0x3546('0x5b'):_0x3765a3[_0x3546('0x56')](db[_0x3546('0x53')][_0x3546('0x54')](_0x3341dc(_0x3c1da4,_0x3546('0x5a')))['then'](function(){})['catch'](_0x169bf3()));break;default:_0x3765a3[_0x3546('0x56')](db[_0x3546('0x53')][_0x3546('0x54')](_0x11147a(_0x3c1da4,_0x3546('0x5a')))[_0x3546('0x4f')](function(){})['catch'](_0x169bf3()));}}}return _0x3765a3;})[_0x3546('0x57')]();})[_0x3546('0x4f')](function(){return db['Campaign'][_0x3546('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x3546('0x4d')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3546('0x4f')](function(_0x1839ac){var _0x10e385=[];if(_0x1839ac){for(var _0x339275=0x0,_0x1548b7;_0x339275<_0x1839ac[_0x3546('0x19')];_0x339275+=0x1){_0x1548b7=_0x1839ac[_0x339275][_0x3546('0x50')]({'plain':!![]});_0x10e385[_0x3546('0x56')](db['sequelize']['query'](_0x5ad2e2(_0x1548b7,_0x3546('0x5a')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));}}return _0x10e385;})[_0x3546('0x57')]();})[_0x3546('0x2d')](function(_0xcb9fb0){logger[_0x3546('0x1c')](_0x3546('0x5c'),_0x3546('0x5d'),_0xcb9fb0[_0x3546('0x1a')]);});}var processPromises=function(_0x175b73){return BPromise[_0x3546('0x57')](promises)[_0x3546('0x4f')](function(_0x5547d3){})[_0x3546('0x2d')](function(_0x38eee1){logger['error'](_0x3546('0x5e'),JSON[_0x3546('0x2e')](_0x38eee1));})[_0x3546('0x5f')](function(){socket[_0x3546('0x60')](_0x3546('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x175b73){return _0x175b73[_0x3546('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3546('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0x3546('0x4f')](function(){socket[_0x3546('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3546('0x63')](FILEPATH);}catch(_0x3e9afc){logger['error'](_0x3546('0x64'),JSON[_0x3546('0x2e')](_0x3e9afc));}finally{process[_0x3546('0x65')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x3546('0x66'));endCsv();});function main(){return BPromise['resolve']()[_0x3546('0x4f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3546('0x12')](',');return db[_0x3546('0x2a')][_0x3546('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3546('0x4f')](function(_0xc4756f){var _0x30fb03=fs[_0x3546('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3546('0x68')](_0x30fb03,{'header':!![],'skipEmptyLines':!![],'step':function(_0x41c8a5,_0x2c640f){total+=0x1;var _0x2c5481=total;promises['push'](checkRow(_0x41c8a5,_0xc4756f,_0x2c5481)['then'](function(){success+=0x1;})[_0x3546('0x2d')](function(_0x5e0e35){if(_0x5e0e35['error']){errors+=0x1;delete _0x5e0e35[_0x3546('0x1c')];}else if(_0x5e0e35['duplicate']){duplicates+=0x1;delete _0x5e0e35['duplicate'];}rows[_0x3546('0x56')](_0x5e0e35);}));if(total%0xc8===0x0){_0x2c640f[_0x3546('0x69')]();return processPromises(_0x2c640f);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x3546('0x6a'));endCsv();});},'error':function(_0x1d5be2,_0x1462ee){logger['info'](_0x3546('0x6b'),JSON[_0x3546('0x2e')](_0x1d5be2));endCsv();}});})['catch'](function(_0x5c5fbc){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x3546('0x2e')](_0x5c5fbc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2487245..783d2f8 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 _0xc98e=['.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','into','createdAt','cm_contacts','select','cm_hopper_black','ListId\x20=\x20?','\x20=\x20','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.priority','scheduledat','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','catch','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','set','offset','dialTimezone','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','includes','ContactItemType','name','_description','AdditionalPhones','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','priority','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','utcOffset','firstName','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','.id\x20=\x20','where','join','CmContact','findAll','length','push','all','split','then','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','updatedAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc98e,0x1ec));var _0xec98=function(_0x56c146,_0x1abb0e){_0x56c146=_0x56c146-0x0;var _0x17c39c=_0xc98e[_0x56c146];return _0x17c39c;};'use strict';var fs=require('fs');var path=require(_0xec98('0x0'));var _=require(_0xec98('0x1'));var Papa=require(_0xec98('0x2'));var util=require(_0xec98('0x3'));var BPromise=require('bluebird');var moment=require(_0xec98('0x4'));var squel=require(_0xec98('0x5'));var Redis=require(_0xec98('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xec98('0x7'));var shared=require(_0xec98('0x8'));var logger=require(_0xec98('0x9'))(_0xec98('0xa'));config[_0xec98('0xb')]=_[_0xec98('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec98('0xd'))(new Redis(config[_0xec98('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xec98('0xe')](_0xec98('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xec98('0xe')](_0xec98('0xf'));function isEmail(_0x33ecf2){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'](_0x33ecf2);}function selectNotIn(_0xa534ec,_0x2d44a7,_0x5825b6,_0x4fd021,_0x316217){return squel['select']()[_0xec98('0x10')](_0xec98('0x11'))[_0xec98('0x12')](_0x4fd021)['join'](_0x2d44a7,null,_0x2d44a7+_0xec98('0x13')+_0x4fd021+'.'+_0x5825b6)[_0xec98('0x14')](_0x4fd021+'.'+_0x5825b6+'\x20=\x20'+_0xa534ec+'.'+_0x5825b6)['where'](_0x2d44a7+'.dialCheckDuplicateType\x20IN\x20('+_0x316217[_0xec98('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x58ba8b,_0x2191c4){promisesAdditionalPhones=[];return db[_0xec98('0x16')][_0xec98('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x110400){if(_0x110400!==null){var _0x234598=[];for(var _0x5d8308=0x0;_0x5d8308<_0x110400[_0xec98('0x18')];_0x5d8308++){var _0x469862=_0x110400[_0x5d8308];_0x234598[_0xec98('0x19')](insertAdditionalPhones(_0x469862));}}Promise[_0xec98('0x1a')](_0x234598)['then'](function(){_0x58ba8b({'val':0x1});});});});}function insertAdditionalPhones(_0x162f29){return new Promise(function(_0x155ebb,_0x35b4f4){var _0x398ce0=_0x162f29['AdditionalPhones'];var _0x4411a9=_0x398ce0[_0xec98('0x1b')](';');var _0x1896b6=[];orderBy=0x0;for(var _0x577201=0x0;_0x577201<_0x4411a9[_0xec98('0x18')];_0x577201++){_0x1896b6[_0xec98('0x19')](splitAdditionalPhone(_0x162f29['id'],_0x4411a9[_0x577201]));}Promise[_0xec98('0x1a')](_0x1896b6)[_0xec98('0x1c')](function(){_0x155ebb({'val':_0x4411a9[_0xec98('0x18')]});});});}function splitAdditionalPhone(_0x576fa1,_0x39d305){return new Promise(function(_0x11774a,_0x12800c){var _0x53621b=_0x39d305[_0xec98('0x1b')](':');var _0x32b753=_0x53621b[0x0];var _0x8db2f8=_0x53621b[0x1];if(!_[_0xec98('0x1d')](_0x8db2f8)){var _0x5a7365=_0x8db2f8[_0xec98('0x1b')]('|');var _0x4aba4a=[];for(var _0x1d5656=0x0;_0x1d5656<_0x5a7365[_0xec98('0x18')];_0x1d5656++){if(_0x5a7365[_0x1d5656]!==''){var _0x50582a=_[_0xec98('0x1e')](promisesAdditionalPhones,{'contactId':_0x576fa1,'phone':_0x5a7365[_0x1d5656]});if(_0x50582a[_0xec98('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xec98('0x19')]({'contactId':_0x576fa1,'contactTypeId':_0x32b753,'phone':_0x5a7365[_0x1d5656],'orderBy':orderBy});}}}_0x11774a({'ok':0x1});}else _0x11774a({'res':0x0});});}function createAdditionalPhone(_0xdaec97,_0x565499,_0x38f2fe,_0x522360){var _0xc9393b='';var _0x13eacc='';var _0x2b0f23=_0x38f2fe[_0xec98('0x1b')]('§');_0xc9393b=_0x2b0f23[0x0];if(_0x2b0f23[_0xec98('0x18')]==0x2)_0x13eacc=_0x2b0f23[0x1];return new Promise(function(_0x1a0ec2,_0x36517f){return db[_0xec98('0x1f')][_0xec98('0x20')]({'where':{'CmContactId':_0xdaec97,'item':_0xc9393b}})['then'](function(_0x123209){if(_0x123209){return db['CmContactHasItem']['update']({'ItemTypeId':_0x565499,'description':_0x13eacc,'OrderBy':_0x522360},{'where':{'CmContactId':_0xdaec97,'item':_0xc9393b}})[_0xec98('0x1c')](function(_0x270568){_0x1a0ec2({'res':_0xec98('0x21')});});}else{return db[_0xec98('0x1f')][_0xec98('0x22')]({'CmContactId':_0xdaec97,'item':_0xc9393b,'description':_0x13eacc,'ItemTypeId':_0x565499,'OrderBy':_0x522360,'ItemClass':_0xec98('0x23')})[_0xec98('0x1c')](function(_0x3d3879){_0x1a0ec2({'res':_0xec98('0x24')});});}});});}function insertCmHopper(_0x4e9e17,_0x24ea90,_0x59f759,_0x493407,_0x339328){var _0x2bdbf8=[_0xec98('0x25'),_0xec98('0x26'),'cm_contacts.id',_0xec98('0x27'),_0x24ea90+'.'+_0x493407,_0xec98('0x28'),_0xec98('0x29'),'cm_contacts.priority',_0xec98('0x2a'),'\x22'+_0x339328+'\x22'];return squel[_0xec98('0x2b')]()['into'](_0xec98('0x2c'))[_0xec98('0x2d')](['phone','scheduledat',_0xec98('0x2e'),_0xec98('0x2f'),_0x493407,'createdAt',_0xec98('0x30'),'priority',_0xec98('0x31'),_0xec98('0x32')],squel['select']()[_0xec98('0x33')](_0x2bdbf8)['from'](_0x24ea90)[_0xec98('0x15')]('cm_contacts',null,_0xec98('0x34')+_0x24ea90+_0xec98('0x35'))[_0xec98('0x15')](_0x59f759,null,_0x59f759+_0xec98('0x13')+_0x24ea90+'.'+_0x493407)[_0xec98('0x14')](_0x24ea90+_0xec98('0x36'),_0x4e9e17)[_0xec98('0x14')](_0xec98('0x37'),NOW)[_0xec98('0x14')](_0xec98('0x38'),selectNotIn(_0x24ea90,_0x59f759,_0x493407,_0xec98('0x2c'),[_0xec98('0x39'),_0xec98('0x3a')]))[_0xec98('0x14')](_0xec98('0x38'),selectNotIn(_0x24ea90,_0x59f759,_0x493407,_0xec98('0x2c'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x1542d7,_0x40be47,_0x5175fa,_0x51ad26){var _0x5f188e=[_0xec98('0x25'),'cm_contacts.id','cm_contacts.ListId',_0x40be47+'.'+_0x51ad26,_0xec98('0x28'),_0xec98('0x29')];return squel['insert']()[_0xec98('0x3b')]('cm_hopper_black')[_0xec98('0x2d')](['phone',_0xec98('0x2e'),_0xec98('0x2f'),_0x51ad26,_0xec98('0x3c'),_0xec98('0x30')],squel['select']()[_0xec98('0x33')](_0x5f188e)[_0xec98('0x12')](_0x40be47)[_0xec98('0x15')](_0xec98('0x3d'),null,_0xec98('0x34')+_0x40be47+_0xec98('0x35'))[_0xec98('0x15')](_0x5175fa,null,_0x5175fa+_0xec98('0x13')+_0x40be47+'.'+_0x51ad26)[_0xec98('0x14')](_0x40be47+_0xec98('0x36'),_0x1542d7)[_0xec98('0x14')](_0xec98('0x37'),NOW)[_0xec98('0x14')](_0xec98('0x38'),squel[_0xec98('0x3e')]()[_0xec98('0x10')](_0xec98('0x11'))[_0xec98('0x12')](_0xec98('0x3f'))['where'](_0xec98('0x40'),_0x1542d7)[_0xec98('0x14')](_0x51ad26+_0xec98('0x41')+_0x40be47+'.'+_0x51ad26)))[_0xec98('0x42')]();}function insertTzCmHopper(_0x5af08a,_0x1af8b8,_0x25cc15,_0xe3f920,_0x4dde3f,_0x43a64a){var _0x4a067d=[_0xec98('0x25'),_0xec98('0x43')+_0x43a64a+_0xec98('0x44'),_0xec98('0x45'),_0xec98('0x27'),_0x1af8b8+'.'+_0xe3f920,_0xec98('0x28'),_0xec98('0x29'),_0xec98('0x46'),_0xec98('0x2a'),'\x22'+_0x4dde3f+'\x22'];var _0x30f940=squel['insert']()['into']('cm_hopper')[_0xec98('0x2d')]([_0xec98('0x11'),_0xec98('0x47'),'ContactId',_0xec98('0x2f'),_0xe3f920,'createdAt','updatedAt','priority',_0xec98('0x31'),'recallme'],squel['select']()['fields'](_0x4a067d)[_0xec98('0x12')](_0x1af8b8)['join'](_0xec98('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0x1af8b8+_0xec98('0x35'))[_0xec98('0x15')](_0x25cc15,null,_0x25cc15+'.id\x20=\x20'+_0x1af8b8+'.'+_0xe3f920)[_0xec98('0x15')](_0x43a64a,null,_0x43a64a+'.id\x20=\x20'+_0x1af8b8+'.'+_0xe3f920)[_0xec98('0x14')](_0x1af8b8+_0xec98('0x36'),_0x5af08a)[_0xec98('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xec98('0x14')](_0xec98('0x38'),selectNotIn(_0x1af8b8,_0x25cc15,_0xe3f920,_0xec98('0x2c'),['\x22always\x22',_0xec98('0x3a')]))['where'](_0xec98('0x38'),selectNotIn(_0x1af8b8,_0x25cc15,_0xe3f920,_0xec98('0x2c'),[_0xec98('0x39')])))[_0xec98('0x42')]();return _0x30f940;}function insertTzCmHopperBlack(_0x3ca11d,_0x75bab8,_0x2a95ea,_0x2b3391){var _0x3eb17f=[_0xec98('0x25'),_0xec98('0x45'),_0xec98('0x27'),_0x75bab8+'.'+_0x2b3391,_0xec98('0x28'),_0xec98('0x29')];return squel['insert']()[_0xec98('0x3b')](_0xec98('0x3f'))['fromQuery']([_0xec98('0x11'),_0xec98('0x2e'),_0xec98('0x2f'),_0x2b3391,'createdAt',_0xec98('0x30')],squel[_0xec98('0x3e')]()[_0xec98('0x33')](_0x3eb17f)[_0xec98('0x12')](_0x75bab8)[_0xec98('0x15')](_0xec98('0x3d'),null,_0xec98('0x34')+_0x75bab8+_0xec98('0x35'))[_0xec98('0x15')](_0x2a95ea,null,_0x2a95ea+_0xec98('0x13')+_0x75bab8+'.'+_0x2b3391)['where'](_0x75bab8+'.CmListId\x20=\x20?',_0x3ca11d)[_0xec98('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xec98('0x38'),squel[_0xec98('0x3e')]()[_0xec98('0x10')]('phone')['from']('cm_hopper_black')[_0xec98('0x14')](_0xec98('0x40'),_0x3ca11d)['where'](_0x2b3391+_0xec98('0x41')+_0x75bab8+'.'+_0x2b3391)))[_0xec98('0x42')]();}function insertCmHopperAdditionalPhones(_0x4d198f){var _0x528d5f=[_0xec98('0x48'),_0xec98('0x49'),'cm_contact_has_items.OrderBy',_0xec98('0x4a'),_0xec98('0x4b')];return squel['insert']()[_0xec98('0x3b')](_0xec98('0x4c'))[_0xec98('0x2d')]([_0xec98('0x4d'),_0xec98('0x11'),'OrderBy','createdAt',_0xec98('0x30')],squel[_0xec98('0x3e')]()['fields'](_0x528d5f)[_0xec98('0x12')]('cm_hopper')[_0xec98('0x15')](_0xec98('0x3d'),null,_0xec98('0x4e'))[_0xec98('0x15')](_0xec98('0x4f'),null,_0xec98('0x50'))[_0xec98('0x14')](_0xec98('0x51'),_0x4d198f)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0xec98('0x42')]();}function insertCmContact(_0x18c793,_0x3617b3,_0x4d86e7,_0x2f46d4){var _0x34b070=_[_0xec98('0x52')](_[_0xec98('0x53')](_0x2f46d4),[_0xec98('0x2f'),'CompanyId',_0xec98('0x3c'),_0xec98('0x30'),_0xec98('0x54')]);return squel[_0xec98('0x2b')]()[_0xec98('0x3b')](_0xec98('0x3d'))[_0xec98('0x2d')](_0x34b070,squel[_0xec98('0x3e')]()['fields'](_0x34b070)[_0xec98('0x12')](_0x3617b3)['where']('('+_0x4d86e7[_0xec98('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0xec98('0x3e')]()[_0xec98('0x33')](_0x4d86e7)['from'](_0xec98('0x3d'))['where'](_0xec98('0x40'),_0x18c793)[_0xec98('0x14')](_0xec98('0x55')))[_0xec98('0x14')](_0xec98('0x56'),squel[_0xec98('0x3e')]()[_0xec98('0x10')](_0xec98('0x57'),_0xec98('0x58'))[_0xec98('0x12')](_0x3617b3)[_0xec98('0x59')](_0x4d86e7[_0xec98('0x15')](','))))[_0xec98('0x42')]();}function handleStop(){logger[_0xec98('0x5a')](_0xec98('0x5b'));stopped=!![];}function handleUncaughtException(_0x4c9a30){logger[_0xec98('0x5c')](_0x4c9a30[_0xec98('0x5d')]);process[_0xec98('0x5e')](0x1);}function handleError(_0x1e9be9,_0x193770){stats['errors']['push']({'name':_0x193770[_0xec98('0x5f')],'message':_0x193770['message'],'row':_0x1e9be9});}function handleQuery(_0x54ee3a){logger[_0xec98('0x5a')](_0x54ee3a);return db[_0xec98('0x60')][_0xec98('0x61')](_0x54ee3a)[_0xec98('0x62')](function(_0x5e1b10){results['push'](_0x5e1b10);})['catch'](function(_0xf65fd5){logger[_0xec98('0x5c')](_0xf65fd5['message']);});}function updateTzCampaigns(_0x35a3f6){return new Promise(function(_0x5d193d,_0x11513f){var _0xd87835=squel[_0xec98('0x3e')]()[_0xec98('0x33')]([_0xec98('0x63'),_0xec98('0x64')])[_0xec98('0x12')]('campaigns')[_0xec98('0x15')]('campaigns_has_cm_lists',null,_0xec98('0x65'))[_0xec98('0x14')](_0xec98('0x66')+_0x35a3f6);db['sequelize']['query'](_0xd87835[_0xec98('0x42')]())[_0xec98('0x62')](function(_0x1afd69){var _0x161125=[];for(var _0x17b3ca=0x0;_0x17b3ca<_0x1afd69[_0xec98('0x18')];_0x17b3ca++){_0x161125[_0xec98('0x19')](getTimezoneData(_0x1afd69[_0x17b3ca],tmp_campaigns));}BPromise[_0xec98('0x1a')](_0x161125)[_0xec98('0x1c')](function(){_0x5d193d({'val':0x1});});})[_0xec98('0x67')](function(_0x341bfd){logger[_0xec98('0x5c')](_0x341bfd[_0xec98('0x5d')]);_0x5d193d({'val':0x0});});});}function updateTzVoiceQueues(_0x51babe){return new Promise(function(_0x4781f8,_0x376f4a){var _0xed310c=squel[_0xec98('0x3e')]()[_0xec98('0x33')](['voice_queues.id',_0xec98('0x68')])[_0xec98('0x12')](_0xec98('0x69'))[_0xec98('0x15')]('voice_queues_has_cm_lists',null,_0xec98('0x6a'))[_0xec98('0x14')](_0xec98('0x6b')+_0x51babe);db[_0xec98('0x60')][_0xec98('0x61')](_0xed310c[_0xec98('0x42')]())[_0xec98('0x62')](function(_0x31146e){var _0x2ec50b=[];for(var _0x15dbd7=0x0;_0x15dbd7<_0x31146e[_0xec98('0x18')];_0x15dbd7++){_0x2ec50b['push'](getTimezoneData(_0x31146e[_0x15dbd7],tmp_voice_queues));}BPromise['all'](_0x2ec50b)[_0xec98('0x1c')](function(){_0x4781f8({'val':0x1});});})[_0xec98('0x67')](function(_0x123a35){logger[_0xec98('0x5c')](_0x123a35[_0xec98('0x5d')]);_0x4781f8({'val':0x0});});});}function getTimezoneData(_0x4d2020,_0x45ba07){return new Promise(function(_0x19d8c6,_0x1cca13){var _0x1ed9d0=shared[_0xec98('0x6c')];var _0x4748f2=_0x1ed9d0[_0x4d2020['dialTimezone']];if(_[_0xec98('0x1d')](_0x4748f2)){_0x19d8c6({'ret':0x1});}else{var _0x8f358a=_0x4748f2['utcOffset'];var _0x26a675=squel[_0xec98('0x2b')]()[_0xec98('0x3b')](_0x45ba07)[_0xec98('0x6d')]('id',_0x4d2020['id'])[_0xec98('0x6d')](_0xec98('0x6e'),_0x8f358a)[_0xec98('0x6d')](_0xec98('0x6f'),_0x4d2020[_0xec98('0x6f')])[_0xec98('0x42')]();return db[_0xec98('0x60')][_0xec98('0x61')](_0x26a675)[_0xec98('0x62')](function(_0x570d05){_0x19d8c6({'ret':0x1});})[_0xec98('0x67')](function(_0x202d8a){logger[_0xec98('0x5c')](_0x202d8a[_0xec98('0x5d')]);_0x1cca13({'ret':0x1});});}});}function handleTZQuery(_0xb5f1d3){logger[_0xec98('0x5a')](_0xb5f1d3);return db[_0xec98('0x60')]['query'](_0xb5f1d3)[_0xec98('0x62')](function(_0x450c36){})[_0xec98('0x67')](function(_0x511809){logger[_0xec98('0x5c')](_0x511809['message']);});}function main(_0x15221e,_0x2c4488,_0x3be915,_0x506bd9){logger[_0xec98('0x5a')](_0xec98('0x70'),_0x15221e,JSON[_0xec98('0x71')](_0x2c4488));process[_0xec98('0x72')](_0xec98('0x73'));var _0x332b43=_0x2c4488['binding'];var _0x4d4d30=_[_0xec98('0x74')](_0x332b43);var _0x353b6d=_0x2c4488[_0xec98('0x75')];var _0x2c14a5=path[_0xec98('0x15')](config[_0xec98('0x76')],_0xec98('0x77'),_0x353b6d+_0xec98('0x78'));hasTZ=_['keys'](_0x332b43)[_0xec98('0x79')](_0xec98('0x6f'));var _0x5cc9d0=_[_0xec98('0x53')](_0x332b43)['join']();logger['info']('header',_0x5cc9d0);db[_0xec98('0x7a')]['findAll']({'raw':!![],'attributes':['id',_0xec98('0x7b')]})['then'](function(_0x21dac5){for(var _0x5e18f5=0x0;_0x5e18f5<_0x21dac5['length'];_0x5e18f5++){if(_0x21dac5[_0x5e18f5][_0xec98('0x7b')]in _0x332b43){contactItemTypes['push'](_0x21dac5[_0x5e18f5]);delete _0x4d4d30[_0x21dac5[_0x5e18f5]['name']];hasAdditionalPhones=!![];}for(var _0x33484d in _0x332b43){if(_0x21dac5[_0x5e18f5][_0xec98('0x7b')]+_0xec98('0x7c')===_0x33484d){phoneDescriptions[_0xec98('0x19')]({'itemTypeId':_0x21dac5[_0x5e18f5]['id'],'description':_0x33484d});delete _0x4d4d30[_0x33484d];}}}if(hasAdditionalPhones)_0x4d4d30[_0xec98('0x7d')]='';var _0x59cada=_[_0xec98('0x53')](_0x4d4d30)[_0xec98('0x15')]();logger['info']('header',_0x59cada);fs['writeFileSync'](_0x2c14a5,_0x59cada+'\x0a');Papa['parse'](fs['createReadStream'](_0x15221e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x54cd6a,_0x2e3a9d){try{for(var _0x563278=0x0,_0x335cfa=[];_0x563278<_0x54cd6a[_0xec98('0x7e')][_0xec98('0x18')];_0x563278++){stats[_0xec98('0x7f')]+=0x1;if(_0x54cd6a[_0xec98('0x80')][_0x563278]){handleError(_0x54cd6a[_0xec98('0x7e')][_0x563278],_0x54cd6a[_0xec98('0x80')][_0x563278]);}else{var _0xe104ab=[];var _0x21a51d=[];var _0x5f0b89={};for(var _0x98ab3c in _0x332b43){let _0x9fee81=contactItemTypes['find'](_0x224aeb=>_0x224aeb[_0xec98('0x7b')]===_0x98ab3c);let _0x5f61c6=contactItemTypes[_0xec98('0x81')](_0x5b51c4=>_0x5b51c4[_0xec98('0x7b')]+_0xec98('0x7c')===_0x98ab3c);if(_['isNil'](_0x9fee81)&&_['isNil'](_0x5f61c6)){if(_0x332b43[_0xec98('0x82')](_0x98ab3c)){if(_0x54cd6a['data'][_0x563278][_0x332b43[_0x98ab3c]]){var _0x317d96=_[_0xec98('0x83')](_0x54cd6a['data'][_0x563278][_0x332b43[_0x98ab3c]][_0xec98('0x84')](/"/g,'\x27'));switch(_0x98ab3c){case _0xec98('0x47'):var _0x1ef43a=moment(_0x317d96,_0xec98('0xf'),!![]);if(_0x1ef43a[_0xec98('0x85')]()){_0x335cfa[_0xec98('0x19')]('\x22'+_0x317d96+'\x22');}else{_0xe104ab['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xec98('0x86'):var _0x2a2385=parseInt(_0x317d96);_0x317d96=_['isNaN'](_0x2a2385)||_0x2a2385<0x0||_0x2a2385>0x4?_0x506bd9?0x3:0x2:_0x2a2385;_0x335cfa['push']('\x22'+_0x317d96+'\x22');break;case _0xec98('0x31'):var _0x14c4dd=parseInt(_0x317d96);if(_[_0xec98('0x87')](_0x14c4dd)&&_[_0xec98('0x79')](_0x3be915,_0x14c4dd)){_0x335cfa[_0xec98('0x19')]('\x22'+_0x14c4dd+'\x22');}else{_0xe104ab['push'](_0xec98('0x88'));}break;case _0xec98('0x89'):if(isEmail(_0x317d96)){_0x335cfa[_0xec98('0x19')]('\x22'+_0x317d96+'\x22');}else{_0xe104ab[_0xec98('0x19')](_0xec98('0x8a'));}break;case'dateOfBirth':var _0x55eb62=moment(_0x317d96,_0xec98('0x8b'),!![]);if(_0x55eb62[_0xec98('0x85')]()){_0x335cfa['push']('\x22'+_0x317d96+'\x22');}else{_0xe104ab['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xec98('0x6f'):var _0x42412b=shared[_0xec98('0x6c')];var _0x59ec2d=_0x42412b[_0x317d96];if(!_[_0xec98('0x1d')](_0x59ec2d)){var _0x36e6a4=_0x59ec2d[_0xec98('0x8c')];_0x335cfa[_0xec98('0x19')]('\x22'+_0x317d96+'\x22');_0x335cfa[_0xec98('0x19')]('\x22'+_0x36e6a4+'\x22');}break;default:_0x335cfa[_0xec98('0x19')]('\x22'+_0x317d96+'\x22');}}else{switch(_0x98ab3c){case _0xec98('0x8d'):case _0xec98('0x11'):_0xe104ab['push'](_0x98ab3c+'\x20not\x20specified');break;default:_0x335cfa[_0xec98('0x19')]('\x22\x22');}}}}else{var _0x2c32c6='';if(!_[_0xec98('0x1d')](_0x9fee81)){if(!_0x5f0b89[_0xec98('0x82')](_0x9fee81['id'])){if(!_['isNil'](_0x54cd6a['data'][_0x563278][_0x332b43[_0x98ab3c]])){var _0x317d96=_[_0xec98('0x83')](_0x54cd6a['data'][_0x563278][_0x332b43[_0x98ab3c]][_0xec98('0x84')](/"/g,'\x27'));var _0x5edd6e=phoneDescriptions[_0xec98('0x81')](_0x547080=>_0x547080[_0xec98('0x8e')]===_0x9fee81['id']);if(!_[_0xec98('0x1d')](_0x5edd6e)){var _0x16d04e=_[_0xec98('0x83')](_0x54cd6a[_0xec98('0x7e')][_0x563278][_0x332b43[_0x5edd6e[_0xec98('0x8f')]]][_0xec98('0x84')](/"/g,'\x27'));if(!_[_0xec98('0x1d')](_0x16d04e))_0x317d96=_0x317d96+'§'+_0x16d04e;}if(_0x2c32c6=='')_0x2c32c6=_0x317d96;else _0x2c32c6+='|'+_0x317d96;}_0x21a51d['push'](_0x9fee81['id']+':'+_0x2c32c6);_0x5f0b89[_0x9fee81['id']]=0x1;}}}}if(hasAdditionalPhones){_0x335cfa[_0xec98('0x19')]('\x22'+_0x21a51d[_0xec98('0x15')](';')+'\x22');}if(_0xe104ab[_0xec98('0x18')]){handleError(_0x54cd6a[_0xec98('0x7e')][_0x563278],{'code':_0xec98('0x90'),'message':_0xe104ab['join']()});}else{fs['appendFileSync'](_0x2c14a5,_0x335cfa['join']()+'\x0a');}_0x335cfa=[];}if(!(stats[_0xec98('0x7f')]%0xc8)){socket[_0xec98('0x91')](_0xec98('0x92')+_0x353b6d,stats);stats['errors']=[];}}if(stopped){logger[_0xec98('0x5a')](_0xec98('0x93'));_0x2e3a9d['abort']();}}catch(_0x10ada0){handleError(_0x54cd6a['data'][_0x563278],{'code':_0xec98('0x94'),'message':_0x10ada0['message']});logger[_0xec98('0x5c')]('step',_0x10ada0[_0xec98('0x5d')]);}},'complete':function(){try{var _0x4c28b6=[];var _0x2eead5=[];var _0x1b26ab=_0xec98('0x3d');if(_0x2c4488[_0xec98('0x95')]&&_0x2c4488[_0xec98('0x95')][_0xec98('0x18')]){_0x1b26ab=_0xec98('0x96')+_0x353b6d;_0x4c28b6['push'](_0xec98('0x97')+_0x1b26ab+_0xec98('0x98'));}tmp_campaigns=_0xec98('0x99')+_0x353b6d;tmp_voice_queues=_0xec98('0x9a')+_0x353b6d;_0x2eead5[_0xec98('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x2eead5[_0xec98('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xec98('0x9b'));BPromise['each'](_0x2eead5,handleTZQuery)['then'](function(_0x26bcf5){updateTzCampaigns(_0x2c4488['ListId'])[_0xec98('0x1c')](function(_0x5ad5fd){updateTzVoiceQueues(_0x2c4488['ListId'])[_0xec98('0x1c')](function(_0x3bef73){if(hasTZ)_0x59cada=_0x59cada[_0xec98('0x84')]('dialTimezone','dialTimezone,utcOffset');var _0x5346e7=util[_0xec98('0xe')](_0xec98('0x9c'),_0x2c14a5,_0x1b26ab,_0x59cada,_0x2c4488[_0xec98('0x2f')],_0x2c4488['CompanyId']||null,NOW,NOW);if(_[_0xec98('0x1d')](_0x332b43[_0xec98('0x47')])){_0x5346e7+=',\x20scheduledAt\x20=\x20NOW()';}_0x4c28b6[_0xec98('0x19')](_0x5346e7);if(_0x2c4488[_0xec98('0x95')]&&_0x2c4488[_0xec98('0x95')][_0xec98('0x18')]){_0x4c28b6[_0xec98('0x19')](insertCmContact(_0x2c4488[_0xec98('0x2f')],_0x1b26ab,_0x2c4488[_0xec98('0x95')],_0x332b43));_0x4c28b6['push'](_0xec98('0x9d')+_0x1b26ab+';');}BPromise[_0xec98('0x9e')](_0x4c28b6,handleQuery)[_0xec98('0x1c')](function(_0x2b8636){BPromise[_0xec98('0x1a')]([handleAdditionalPhones()])[_0xec98('0x1c')](function(){_0x4c28b6=[];for(var _0x9db5e1=0x0;_0x9db5e1_0x5c8766[_0xa418('0x7b')]===_0x439676);let _0x3d087e=contactItemTypes[_0xa418('0x81')](_0x4f45a9=>_0x4f45a9['name']+_0xa418('0x7c')===_0x439676);if(_['isNil'](_0x42068a)&&_[_0xa418('0x1c')](_0x3d087e)){if(_0x35462b[_0xa418('0x82')](_0x439676)){if(_0x63309d['data'][_0x31aae4][_0x35462b[_0x439676]]){var _0x46e7d8=_[_0xa418('0x83')](_0x63309d['data'][_0x31aae4][_0x35462b[_0x439676]]['replace'](/"/g,'\x27'));switch(_0x439676){case _0xa418('0x2a'):var _0x38efd8=moment(_0x46e7d8,_0xa418('0xa'),!![]);if(_0x38efd8[_0xa418('0x84')]()){_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');}else{_0x36925f[_0xa418('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xa418('0x2e'):var _0x2a9c42=parseInt(_0x46e7d8);_0x46e7d8=_['isNaN'](_0x2a9c42)||_0x2a9c42<0x0||_0x2a9c42>0x4?_0x38a0b1?0x3:0x2:_0x2a9c42;_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');break;case _0xa418('0x2f'):var _0x297670=parseInt(_0x46e7d8);if(_[_0xa418('0x85')](_0x297670)&&_[_0xa418('0x78')](_0x49b0c9,_0x297670)){_0x2e651f[_0xa418('0x19')]('\x22'+_0x297670+'\x22');}else{_0x36925f['push'](_0xa418('0x86'));}break;case'email':if(isEmail(_0x46e7d8)){_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');}else{_0x36925f[_0xa418('0x19')](_0xa418('0x87'));}break;case'dateOfBirth':var _0x5fadfd=moment(_0x46e7d8,'YYYY-MM-DD',!![]);if(_0x5fadfd['isValid']()){_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');}else{_0x36925f[_0xa418('0x19')](_0xa418('0x88'));}break;case _0xa418('0x6b'):var _0x409c61=shared[_0xa418('0x6a')];var _0x3448ca=_0x409c61[_0x46e7d8];if(!_[_0xa418('0x1c')](_0x3448ca)){var _0x41dde2=_0x3448ca[_0xa418('0x6c')];_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');_0x2e651f[_0xa418('0x19')]('\x22'+_0x41dde2+'\x22');}break;default:_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');}}else{switch(_0x439676){case'firstName':case _0xa418('0xe'):_0x36925f[_0xa418('0x19')](_0x439676+'\x20not\x20specified');break;default:_0x2e651f[_0xa418('0x19')]('\x22\x22');}}}}else{var _0xa3f8e6='';if(!_['isNil'](_0x42068a)){if(!_0x4d3ff0['hasOwnProperty'](_0x42068a['id'])){if(!_[_0xa418('0x1c')](_0x63309d[_0xa418('0x7f')][_0x31aae4][_0x35462b[_0x439676]])){var _0x46e7d8=_[_0xa418('0x83')](_0x63309d['data'][_0x31aae4][_0x35462b[_0x439676]][_0xa418('0x89')](/"/g,'\x27'));var _0x3de598=phoneDescriptions[_0xa418('0x81')](_0x17cbe4=>_0x17cbe4['itemTypeId']===_0x42068a['id']);if(!_[_0xa418('0x1c')](_0x3de598)){var _0x4cdff1=_[_0xa418('0x83')](_0x63309d[_0xa418('0x7f')][_0x31aae4][_0x35462b[_0x3de598[_0xa418('0x8a')]]][_0xa418('0x89')](/"/g,'\x27'));if(!_[_0xa418('0x1c')](_0x4cdff1))_0x46e7d8=_0x46e7d8+'§'+_0x4cdff1;}if(_0xa3f8e6=='')_0xa3f8e6=_0x46e7d8;else _0xa3f8e6+='|'+_0x46e7d8;}_0x21d204[_0xa418('0x19')](_0x42068a['id']+':'+_0xa3f8e6);_0x4d3ff0[_0x42068a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2e651f[_0xa418('0x19')]('\x22'+_0x21d204[_0xa418('0x10')](';')+'\x22');}if(_0x36925f[_0xa418('0x18')]){handleError(_0x63309d[_0xa418('0x7f')][_0x31aae4],{'code':_0xa418('0x8b'),'message':_0x36925f[_0xa418('0x10')]()});}else{fs[_0xa418('0x8c')](_0x46099c,_0x2e651f[_0xa418('0x10')]()+'\x0a');}_0x2e651f=[];}if(!(stats[_0xa418('0x80')]%0xc8)){socket[_0xa418('0x8d')](_0xa418('0x8e')+_0x1c0d64,stats);stats[_0xa418('0x59')]=[];}}if(stopped){logger['info'](_0xa418('0x8f'));_0x31a0de[_0xa418('0x90')]();}}catch(_0x33d7e6){handleError(_0x63309d['data'][_0x31aae4],{'code':_0xa418('0x91'),'message':_0x33d7e6[_0xa418('0x57')]});logger[_0xa418('0x56')](_0xa418('0x92'),_0x33d7e6[_0xa418('0x57')]);}},'complete':function(){try{var _0x362a80=[];var _0x133c63=[];var _0x4a7234=_0xa418('0x30');if(_0x37c8fc[_0xa418('0x93')]&&_0x37c8fc[_0xa418('0x93')][_0xa418('0x18')]){_0x4a7234=_0xa418('0x94')+_0x1c0d64;_0x362a80[_0xa418('0x19')](_0xa418('0x95')+_0x4a7234+_0xa418('0x96'));}tmp_campaigns=_0xa418('0x97')+_0x1c0d64;tmp_voice_queues='voice_queues_'+_0x1c0d64;_0x133c63['push'](_0xa418('0x95')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x133c63['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xa418('0x98'));BPromise['each'](_0x133c63,handleTZQuery)['then'](function(_0x24cc17){updateTzCampaigns(_0x37c8fc[_0xa418('0x2c')])[_0xa418('0x17')](function(_0x4d073f){updateTzVoiceQueues(_0x37c8fc[_0xa418('0x2c')])[_0xa418('0x17')](function(_0x2a3994){if(hasTZ)_0x59a0d5=_0x59a0d5[_0xa418('0x89')](_0xa418('0x6b'),_0xa418('0x99'));var _0x2edef5=util[_0xa418('0xb')](_0xa418('0x9a'),_0x46099c,_0x4a7234,_0x59a0d5,_0x37c8fc[_0xa418('0x2c')],_0x37c8fc['CompanyId']||null,NOW,NOW);if(_[_0xa418('0x1c')](_0x35462b['scheduledat'])){_0x2edef5+=',\x20scheduledAt\x20=\x20NOW()';}_0x362a80[_0xa418('0x19')](_0x2edef5);if(_0x37c8fc['duplicates']&&_0x37c8fc[_0xa418('0x93')][_0xa418('0x18')]){_0x362a80[_0xa418('0x19')](insertCmContact(_0x37c8fc['ListId'],_0x4a7234,_0x37c8fc[_0xa418('0x93')],_0x35462b));_0x362a80[_0xa418('0x19')](_0xa418('0x9b')+_0x4a7234+';');}BPromise[_0xa418('0x9c')](_0x362a80,handleQuery)[_0xa418('0x17')](function(_0x118fcb){BPromise[_0xa418('0x1a')]([handleAdditionalPhones()])[_0xa418('0x17')](function(){_0x362a80=[];for(var _0x37c317=0x0;_0x37c317\x20\x20');}var _0x38b30e=path[_0xa418('0x10')](config['root'],_0xa418('0x76'),process['argv'][0x2]);if(!fs[_0xa418('0xa8')](_0x38b30e)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3c7edc={};try{_0x3c7edc=JSON[_0xa418('0x7d')](process[_0xa418('0xa7')][0x3]);if(!_0x3c7edc['binding']){throw new Error(_0xa418('0xa9'));}if(!_0x3c7edc['binding'][_0xa418('0xe')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x3c7edc[_0xa418('0x72')]['firstName']){throw new Error(_0xa418('0xaa'));}var _0x4c95db=0x0;if(_0x3c7edc[_0xa418('0x72')][_0xa418('0x2f')]){_0x4c95db=0x1;}if(!_0x3c7edc['ListId']){throw new Error(_0xa418('0xab'));}}catch(_0x2cc5d1){throw new Error(_0xa418('0xac'));}var _0xf2e236=[];try{_0xf2e236=_[_0xa418('0xad')](JSON[_0xa418('0x7d')](process['argv'][0x4]),'id');}catch(_0x350fda){logger['info'](_0xa418('0xae'));}main(_0x38b30e,_0x3c7edc,_0xf2e236,_0x4c95db);}validate();process['on'](_0xa418('0xaf'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 5627bcc..13b3b88 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7da=['cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','code','spread','main','stringify','send','start','binding','clone','socket_timestamp','root','.csv','body','findAll','name','_description','header','writeFileSync','parse','rows','errors','find','hasOwnProperty','data','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','\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',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','finish','affectedRows','unlink','catch','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','length','isNil','push','all','then','error','message','AdditionalPhones','split','CmContactHasItem','findOne','updated','create','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','ListId','createdAt','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','toString','into','cm_hopper_black','updatedAt','cm_contacts','.CmListId','.CmListId\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId'];(function(_0x5112f1,_0x8ecb42){var _0x449174=function(_0x1f74a8){while(--_0x1f74a8){_0x5112f1['push'](_0x5112f1['shift']());}};_0x449174(++_0x8ecb42);}(_0xc7da,0xf2));var _0xac7d=function(_0x269f94,_0x5f50b3){_0x269f94=_0x269f94-0x0;var _0x537a59=_0xc7da[_0x269f94];return _0x537a59;};'use strict';var fs=require('fs');var path=require(_0xac7d('0x0'));var _=require(_0xac7d('0x1'));var Papa=require(_0xac7d('0x2'));var util=require('util');var BPromise=require(_0xac7d('0x3'));var moment=require(_0xac7d('0x4'));var squel=require('squel');var Redis=require(_0xac7d('0x5'));var db=require(_0xac7d('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xac7d('0x7'))(_0xac7d('0x8'));config[_0xac7d('0x9')]=_[_0xac7d('0xa')](config[_0xac7d('0x9')],{'host':_0xac7d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac7d('0x9')]));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()[_0xac7d('0xc')](_0xac7d('0xd'));var tempTableName=_0xac7d('0xe')+moment()[_0xac7d('0xc')](_0xac7d('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xe8dfe6){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'](_0xe8dfe6);}function selectNotIn(_0x276778,_0x2fd75b,_0x3eaee6,_0x5a53de,_0x238069){return squel[_0xac7d('0x10')]()[_0xac7d('0x11')](_0xac7d('0x12'))['from'](_0x5a53de)[_0xac7d('0x13')](_0x2fd75b,null,_0x2fd75b+_0xac7d('0x14')+_0x5a53de+'.'+_0x3eaee6)[_0xac7d('0x15')](_0x5a53de+'.'+_0x3eaee6+_0xac7d('0x16')+_0x276778+'.'+_0x3eaee6)[_0xac7d('0x15')](_0x2fd75b+'.dialCheckDuplicateType\x20IN\x20('+_0x238069[_0xac7d('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5b94e9,_0x3e580d){promisesAdditionalPhones=[];promisesContact=[];return db[_0xac7d('0x17')][_0xac7d('0x18')](_0xac7d('0x19')+tempTableName)['spread'](function(_0x19e7ba){if(_0x19e7ba!==null){var _0x4283dd=[];for(var _0x27ed38=0x0;_0x27ed38<_0x19e7ba[_0xac7d('0x1a')];_0x27ed38++){var _0x35ea95=_0x19e7ba[_0x27ed38];if(!_['isNil'](_0x35ea95[_0xac7d('0x12')])){if(!_[_0xac7d('0x1b')](_0x35ea95['AdditionalPhones']))_0x4283dd[_0xac7d('0x1c')](insertAdditionalPhones(_0x35ea95));promisesContact[_0xac7d('0x1c')]({'contact':_0x35ea95});}}}Promise[_0xac7d('0x1d')](_0x4283dd)[_0xac7d('0x1e')](function(){_0x5b94e9({'val':0x1});});})['catch'](function(_0x46e2ed){logger[_0xac7d('0x1f')](_0x46e2ed[_0xac7d('0x20')]);});});}function insertAdditionalPhones(_0x518e77){return new Promise(function(_0xd42c40,_0x4f4e4e){var _0x3189fe=_0x518e77[_0xac7d('0x21')];if(_[_0xac7d('0x1b')](_0x3189fe))_0x4f4e4e({'val':0x0});else{var _0x160b42=_0x3189fe[_0xac7d('0x22')](';');var _0x365269=[];orderBy=0x0;for(var _0x5a006e=0x0;_0x5a006e<_0x160b42['length'];_0x5a006e++){_0x365269[_0xac7d('0x1c')](splitAdditionalPhone(_0x518e77['id'],_0x160b42[_0x5a006e]));}Promise[_0xac7d('0x1d')](_0x365269)['then'](function(){_0xd42c40({'val':_0x160b42[_0xac7d('0x1a')]});});}});}function splitAdditionalPhone(_0x3966dd,_0x2a5774){return new Promise(function(_0x1c1f88,_0x43aa8e){var _0xc8a7f0=_0x2a5774[_0xac7d('0x22')](':');var _0x3bb7dd=_0xc8a7f0[0x0];var _0x42e313=_0xc8a7f0[0x1];if(_0x42e313!==''){var _0x26a8c4=_0x42e313['split']('|');var _0x229ecd=[];for(var _0x3216cb=0x0;_0x3216cb<_0x26a8c4[_0xac7d('0x1a')];_0x3216cb++){if(_0x26a8c4[_0x3216cb]!==''){var _0x1bcfd5=_['filter'](promisesAdditionalPhones,{'contactId':_0x3966dd,'phone':_0x26a8c4[_0x3216cb]});if(_0x1bcfd5['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3966dd,'contactTypeId':_0x3bb7dd,'phone':_0x26a8c4[_0x3216cb],'orderBy':orderBy});}}}_0x1c1f88({'ok':0x1});}else _0x1c1f88({'res':0x0});});}function createAdditionalPhone(_0xc30df3,_0x32b12c,_0xac3f87,_0x5bd39b){var _0x51df23='';var _0x506b88='';var _0x4e2456=_0xac3f87['split']('§');_0x51df23=_0x4e2456[0x0];if(_0x4e2456['length']==0x2)_0x506b88=_0x4e2456[0x1];return new Promise(function(_0x57ef95,_0x104186){return db[_0xac7d('0x23')][_0xac7d('0x24')]({'where':{'CmContactId':_0xc30df3,'item':_0x51df23}})[_0xac7d('0x1e')](function(_0x15a950){if(_0x15a950){return db['CmContactHasItem']['update']({'ItemTypeId':_0x32b12c,'description':_0x506b88,'OrderBy':_0x5bd39b},{'where':{'CmContactId':_0xc30df3,'item':_0x51df23}})[_0xac7d('0x1e')](function(_0xfbfbf7){_0x57ef95({'res':_0xac7d('0x25')});});}else{return db[_0xac7d('0x23')][_0xac7d('0x26')]({'CmContactId':_0xc30df3,'item':_0x51df23,'ItemTypeId':_0x32b12c,'description':_0x506b88,'OrderBy':_0x5bd39b,'ItemClass':_0xac7d('0x27')})[_0xac7d('0x1e')](function(_0x3c507e){_0x57ef95({'res':_0xac7d('0x28')});});}});});}function updateContact(_0x96e66b){return new Promise(function(_0x41c60a,_0x2e10f7){var _0x29163c=_0x96e66b['id'];delete _0x96e66b['id'];return db[_0xac7d('0x29')][_0xac7d('0x2a')](_0x96e66b,{'where':{'id':_0x29163c}})[_0xac7d('0x1e')](function(_0x4ee968){updatedRows+=0x1;return db[_0xac7d('0x2b')][_0xac7d('0x2a')]({'phone':_0x96e66b[_0xac7d('0x12')]},{'where':{'ContactId':_0x29163c}})[_0xac7d('0x1e')](function(_0x204717){_0x41c60a({'ret':'OK'});});});});}function insertCmHopper(_0x5690e4,_0x2bfc9e,_0x5c09a4,_0x5831e2,_0x23a09d){var _0x1c2ccc=[_0xac7d('0x2c'),_0xac7d('0x2d'),_0xac7d('0x2e'),_0xac7d('0x2f'),_0x2bfc9e+'.'+_0x5831e2,_0xac7d('0x30'),_0xac7d('0x31'),_0xac7d('0x32'),_0xac7d('0x33'),'\x22'+_0x23a09d+'\x22'];return squel[_0xac7d('0x34')]()['into']('cm_hopper')[_0xac7d('0x35')](['phone',_0xac7d('0x36'),_0xac7d('0x37'),_0xac7d('0x38'),_0x5831e2,_0xac7d('0x39'),'updatedAt','priority',_0xac7d('0x3a'),_0xac7d('0x3b')],squel[_0xac7d('0x10')]()[_0xac7d('0x3c')](_0x1c2ccc)[_0xac7d('0x3d')](_0x2bfc9e)['join']('cm_contacts',null,_0xac7d('0x3e')+_0x2bfc9e+'.CmListId')[_0xac7d('0x13')](_0x5c09a4,null,_0x5c09a4+_0xac7d('0x14')+_0x2bfc9e+'.'+_0x5831e2)[_0xac7d('0x15')](_0x2bfc9e+'.CmListId\x20=\x20?',_0x5690e4)[_0xac7d('0x15')](_0xac7d('0x3f'),NOW)[_0xac7d('0x15')](_0xac7d('0x40'),selectNotIn(_0x2bfc9e,_0x5c09a4,_0x5831e2,_0xac7d('0x41'),[_0xac7d('0x42'),'\x22onlyIfOpen\x22']))['where'](_0xac7d('0x40'),selectNotIn(_0x2bfc9e,_0x5c09a4,_0x5831e2,_0xac7d('0x41'),['\x22always\x22'])))[_0xac7d('0x43')]();}function insertCmHopperBlack(_0x14a658,_0x355647,_0x5978ea,_0x5f3b48){var _0x133bd6=['cm_contacts.phone',_0xac7d('0x2e'),_0xac7d('0x2f'),_0x355647+'.'+_0x5f3b48,_0xac7d('0x30'),_0xac7d('0x31')];return squel[_0xac7d('0x34')]()[_0xac7d('0x44')](_0xac7d('0x45'))[_0xac7d('0x35')]([_0xac7d('0x12'),_0xac7d('0x37'),'ListId',_0x5f3b48,_0xac7d('0x39'),_0xac7d('0x46')],squel[_0xac7d('0x10')]()[_0xac7d('0x3c')](_0x133bd6)[_0xac7d('0x3d')](_0x355647)[_0xac7d('0x13')](_0xac7d('0x47'),null,'cm_contacts.ListId\x20=\x20'+_0x355647+_0xac7d('0x48'))[_0xac7d('0x13')](_0x5978ea,null,_0x5978ea+'.id\x20=\x20'+_0x355647+'.'+_0x5f3b48)[_0xac7d('0x15')](_0x355647+_0xac7d('0x49'),_0x14a658)[_0xac7d('0x15')](_0xac7d('0x3f'),NOW)[_0xac7d('0x15')](_0xac7d('0x40'),squel[_0xac7d('0x10')]()['field'](_0xac7d('0x12'))[_0xac7d('0x3d')]('cm_hopper_black')[_0xac7d('0x15')](_0xac7d('0x4a'),_0x14a658)[_0xac7d('0x15')](_0x5f3b48+'\x20=\x20?',_0x355647+'.'+_0x5f3b48)))[_0xac7d('0x43')]();}function insertCmHopperAdditionalPhones(_0xead395){var _0xfa8ab=[_0xac7d('0x4b'),'cm_contact_has_items.item',_0xac7d('0x4c'),_0xac7d('0x4d'),_0xac7d('0x4e')];return squel[_0xac7d('0x34')]()[_0xac7d('0x44')]('cm_hopper_additional_phones')['fromQuery']([_0xac7d('0x4f'),_0xac7d('0x12'),_0xac7d('0x50'),'createdAt',_0xac7d('0x46')],squel['select']()[_0xac7d('0x3c')](_0xfa8ab)[_0xac7d('0x3d')](_0xac7d('0x41'))[_0xac7d('0x13')](_0xac7d('0x47'),null,_0xac7d('0x51'))['join'](_0xac7d('0x52'),null,_0xac7d('0x53'))[_0xac7d('0x15')](_0xac7d('0x54'),_0xead395)[_0xac7d('0x15')](_0xac7d('0x3f'),NOW))[_0xac7d('0x43')]();}function insertCmContact(_0x1bcfbd,_0x20166d,_0x5bc2e2,_0x449034){var _0x24977d=_[_0xac7d('0x55')](_[_0xac7d('0x56')](_0x449034),[_0xac7d('0x38'),_0xac7d('0x57'),_0xac7d('0x39'),_0xac7d('0x46')]);return squel[_0xac7d('0x34')]()[_0xac7d('0x44')](_0xac7d('0x47'))[_0xac7d('0x35')](_0x24977d,squel[_0xac7d('0x10')]()[_0xac7d('0x3c')](_0x24977d)['from'](_0x20166d)['where']('('+_0x5bc2e2[_0xac7d('0x13')](',')+_0xac7d('0x58'),squel[_0xac7d('0x10')]()[_0xac7d('0x3c')](_0x5bc2e2)['from'](_0xac7d('0x47'))[_0xac7d('0x15')](_0xac7d('0x4a'),_0x1bcfbd))[_0xac7d('0x15')](_0xac7d('0x59'),squel['select']()[_0xac7d('0x11')](_0xac7d('0x5a'),_0xac7d('0x5b'))[_0xac7d('0x3d')](_0x20166d)['group'](_0x5bc2e2['join'](','))))[_0xac7d('0x43')]();}function handleStop(){logger[_0xac7d('0x5c')](_0xac7d('0x5d'));stopped=!![];}function handleUncaughtException(_0x29fc2c){logger[_0xac7d('0x1f')](_0x29fc2c[_0xac7d('0x20')]);process[_0xac7d('0x5e')](0x1);}function handleError(_0x407ace,_0x2bbd4d){stats['errors'][_0xac7d('0x1c')]({'name':_0x2bbd4d[_0xac7d('0x5f')],'message':_0x2bbd4d[_0xac7d('0x20')],'row':_0x407ace});}function handleQuery(_0x2ea5ea){logger['info'](_0x2ea5ea);return db[_0xac7d('0x17')][_0xac7d('0x18')](_0x2ea5ea)[_0xac7d('0x60')](function(_0x45097a){results[_0xac7d('0x1c')](_0x45097a);})['catch'](function(_0x3daf00){logger[_0xac7d('0x1f')](_0x3daf00[_0xac7d('0x20')]);});}function main(_0x13dc6b,_0x336cb2,_0x1b2c24,_0x1caa0a){logger['info'](_0xac7d('0x61'),_0x13dc6b,JSON[_0xac7d('0x62')](_0x336cb2));process[_0xac7d('0x63')](_0xac7d('0x64'));var _0x145bfa=_0x336cb2[_0xac7d('0x65')];var _0xf2b4bb=_[_0xac7d('0x66')](_0x145bfa);var _0x22153a=_0x336cb2[_0xac7d('0x67')];var _0x22d7cd=path[_0xac7d('0x13')](config[_0xac7d('0x68')],'server/files/tmp',_0x22153a+_0xac7d('0x69'));logger[_0xac7d('0x5c')](_0xac7d('0x6a'),_0x336cb2);db['ContactItemType'][_0xac7d('0x6b')]({'raw':!![],'attributes':['id','name']})['then'](function(_0xd7c443){for(var _0x12c35f=0x0;_0x12c35f<_0xd7c443[_0xac7d('0x1a')];_0x12c35f++){if(_0xd7c443[_0x12c35f][_0xac7d('0x6c')]in _0x145bfa){contactItemTypes[_0xac7d('0x1c')](_0xd7c443[_0x12c35f]);delete _0xf2b4bb[_0xd7c443[_0x12c35f]['name']];hasAdditionalPhones=!![];}for(var _0x213649 in _0x145bfa){if(_0xd7c443[_0x12c35f]['name']+_0xac7d('0x6d')===_0x213649){phoneDescriptions['push']({'itemTypeId':_0xd7c443[_0x12c35f]['id'],'description':_0x213649});delete _0xf2b4bb[_0x213649];}}}if(hasAdditionalPhones)_0xf2b4bb[_0xac7d('0x21')]='';var _0x46b202=_[_0xac7d('0x56')](_0xf2b4bb)['join']();logger[_0xac7d('0x5c')](_0xac7d('0x6e'),_0x46b202);fs[_0xac7d('0x6f')](_0x22d7cd,_0x46b202+'\x0a');Papa[_0xac7d('0x70')](fs['createReadStream'](_0x13dc6b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x298e2b,_0x2779a4){try{for(var _0x65058a=0x0,_0x57c19e=[];_0x65058a<_0x298e2b['data'][_0xac7d('0x1a')];_0x65058a++){stats[_0xac7d('0x71')]+=0x1;if(_0x298e2b['errors'][_0x65058a]){handleError(_0x298e2b['data'][_0x65058a],_0x298e2b[_0xac7d('0x72')][_0x65058a]);}else{var _0x4d1321=[];var _0x36ff2d=[];var _0x1f5ba6={};for(var _0x482693 in _0x145bfa){let _0x38b8ba=contactItemTypes[_0xac7d('0x73')](_0x5bd9e0=>_0x5bd9e0[_0xac7d('0x6c')]===_0x482693);let _0x39129b=contactItemTypes['find'](_0x31a86c=>_0x31a86c[_0xac7d('0x6c')]+_0xac7d('0x6d')===_0x482693);if(_['isNil'](_0x38b8ba)&&_[_0xac7d('0x1b')](_0x39129b)){if(_0x145bfa[_0xac7d('0x74')](_0x482693)){if(_0x298e2b[_0xac7d('0x75')][_0x65058a][_0x145bfa[_0x482693]]){var _0x437c8e=_[_0xac7d('0x76')](_0x298e2b[_0xac7d('0x75')][_0x65058a][_0x145bfa[_0x482693]]['replace'](/"/g,'\x27'));switch(_0x482693){case'scheduledat':var _0x45d0fd=moment(_0x437c8e,_0xac7d('0xd'),!![]);if(_0x45d0fd[_0xac7d('0x77')]()){_0x57c19e['push']('\x22'+_0x437c8e+'\x22');}else{_0x4d1321[_0xac7d('0x1c')](_0xac7d('0x78'));}break;case _0xac7d('0x79'):var _0x2ad3dd=parseInt(_0x437c8e);_0x437c8e=_[_0xac7d('0x7a')](_0x2ad3dd)||_0x2ad3dd<0x0||_0x2ad3dd>0x4?_0x1caa0a?0x3:0x2:_0x2ad3dd;_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x437c8e+'\x22');break;case _0xac7d('0x3a'):var _0x1b6f79=parseInt(_0x437c8e);if(_[_0xac7d('0x7b')](_0x1b6f79)&&_['includes'](_0x1b2c24,_0x1b6f79)){_0x57c19e['push']('\x22'+_0x1b6f79+'\x22');}else{_0x4d1321['push'](_0xac7d('0x7c'));}break;case'email':if(isEmail(_0x437c8e)){_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x437c8e+'\x22');}else{_0x4d1321[_0xac7d('0x1c')](_0xac7d('0x7d'));}break;case _0xac7d('0x7e'):var _0x561429=moment(_0x437c8e,_0xac7d('0x7f'),!![]);if(_0x561429[_0xac7d('0x77')]()){_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x437c8e+'\x22');}else{_0x4d1321['push'](_0xac7d('0x80'));}break;default:_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x437c8e+'\x22');}}else{switch(_0x482693){case'firstName':case _0xac7d('0x12'):_0x4d1321['push'](_0x482693+_0xac7d('0x81'));break;default:_0x57c19e[_0xac7d('0x1c')]('\x22\x22');}}}}else{var _0x413871='';if(!_[_0xac7d('0x1b')](_0x38b8ba)){if(!_0x1f5ba6[_0xac7d('0x74')](_0x38b8ba['id'])){for(var _0x5ea154=0x0;_0x5ea154<_0x145bfa[_0x482693]['length'];_0x5ea154++){var _0x437c8e=_[_0xac7d('0x76')](_0x298e2b[_0xac7d('0x75')][_0x65058a][_0x145bfa[_0x482693][_0x5ea154]][_0xac7d('0x82')](/"/g,'\x27'));var _0x50d35a=phoneDescriptions['find'](_0x5bafd3=>_0x5bafd3[_0xac7d('0x83')]===_0x38b8ba['id']);if(!_['isNil'](_0x50d35a)){var _0x1b7160=_[_0xac7d('0x76')](_0x298e2b['data'][_0x65058a][_0x145bfa[_0x50d35a[_0xac7d('0x84')]][0x0]][_0xac7d('0x82')](/"/g,'\x27'));if(!_[_0xac7d('0x1b')](_0x1b7160))_0x437c8e=_0x437c8e+'§'+_0x1b7160;}if(_0x413871=='')_0x413871=_0x437c8e;else _0x413871+='|'+_0x437c8e;}_0x36ff2d[_0xac7d('0x1c')](_0x38b8ba['id']+':'+_0x413871);_0x1f5ba6[_0x38b8ba['id']]=0x1;}}}}if(hasAdditionalPhones){_0x57c19e[_0xac7d('0x1c')]('\x22'+_0x36ff2d[_0xac7d('0x13')](';')+'\x22');}if(_0x4d1321[_0xac7d('0x1a')]){handleError(_0x298e2b[_0xac7d('0x75')][_0x65058a],{'code':_0xac7d('0x85'),'message':_0x4d1321[_0xac7d('0x13')]()});}else{fs[_0xac7d('0x86')](_0x22d7cd,_0x57c19e[_0xac7d('0x13')]()+'\x0a');}_0x57c19e=[];}if(!(stats[_0xac7d('0x71')]%0xc8)){socket[_0xac7d('0x87')](_0xac7d('0x88')+_0x22153a,stats);stats[_0xac7d('0x72')]=[];}}if(stopped){logger[_0xac7d('0x5c')](_0xac7d('0x89'));_0x2779a4[_0xac7d('0x8a')]();}}catch(_0x542aa7){handleError(_0x298e2b['data'][_0x65058a],{'code':_0xac7d('0x8b'),'message':_0x542aa7[_0xac7d('0x20')]});logger[_0xac7d('0x1f')](_0xac7d('0x8c'),_0x542aa7['message']);}},'complete':function(){try{var _0x7d535a=[];var _0x238e07=tempTableName;_0x7d535a[_0xac7d('0x1c')]('CREATE\x20TABLE\x20'+_0x238e07+_0xac7d('0x8d'));logger[_0xac7d('0x5c')](_0xac7d('0x8e'),contactItemTypes[_0xac7d('0x1a')]);var _0x50bbe3=util[_0xac7d('0xc')](_0xac7d('0x8f'),_0x22d7cd,_0x238e07,_0x46b202,_0x336cb2[_0xac7d('0x38')],_0x336cb2['CompanyId']||null,NOW,NOW);if(_[_0xac7d('0x1b')](_0x145bfa['scheduledat'])){_0x50bbe3+=_0xac7d('0x90');}_0x7d535a[_0xac7d('0x1c')](_0x50bbe3);BPromise[_0xac7d('0x91')](_0x7d535a,handleQuery)[_0xac7d('0x1e')](function(_0x5345a9){BPromise[_0xac7d('0x1d')]([handleAdditionalPhones()])[_0xac7d('0x1e')](function(){_0x7d535a=[];for(var _0x4f53e7=0x0;_0x4f53e7\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','ioredis','../../../config/environment','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','field','phone','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','length','isNil','AdditionalPhones','all','then','catch','error','message','split','push','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','ListId','select','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','query','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20'];(function(_0x4b755e,_0x4922af){var _0xa834e5=function(_0x4cc937){while(--_0x4cc937){_0x4b755e['push'](_0x4b755e['shift']());}};_0xa834e5(++_0x4922af);}(_0x2b84,0x1ed));var _0x42b8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2b84[_0x19e35c];return _0x3e1fe8;};'use strict';var fs=require('fs');var path=require(_0x42b8('0x0'));var _=require(_0x42b8('0x1'));var Papa=require('papaparse');var util=require(_0x42b8('0x2'));var BPromise=require(_0x42b8('0x3'));var moment=require(_0x42b8('0x4'));var squel=require('squel');var Redis=require(_0x42b8('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x42b8('0x6'));var logger=require('../../../config/logger')(_0x42b8('0x7'));config[_0x42b8('0x8')]=_['defaults'](config['redis'],{'host':_0x42b8('0x9'),'port':0x18eb});var socket=require(_0x42b8('0xa'))(new Redis(config[_0x42b8('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x42b8('0xb')](_0x42b8('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x42b8('0xb')](_0x42b8('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2a13a3){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))*$/[_0x42b8('0xe')](_0x2a13a3);}function selectNotIn(_0x1cd104,_0x3044eb,_0x296db0,_0x61c061,_0x490ea9){return squel['select']()[_0x42b8('0xf')](_0x42b8('0x10'))['from'](_0x61c061)[_0x42b8('0x11')](_0x3044eb,null,_0x3044eb+'.id\x20=\x20'+_0x61c061+'.'+_0x296db0)['where'](_0x61c061+'.'+_0x296db0+_0x42b8('0x12')+_0x1cd104+'.'+_0x296db0)[_0x42b8('0x13')](_0x3044eb+_0x42b8('0x14')+_0x490ea9[_0x42b8('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xf1fcc1,_0x57c65d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x42b8('0x15')]['query'](_0x42b8('0x16')+tempTableName)['spread'](function(_0x54b74b){if(_0x54b74b!==null){var _0x45a918=[];for(var _0x1ca756=0x0;_0x1ca756<_0x54b74b[_0x42b8('0x17')];_0x1ca756++){var _0x266068=_0x54b74b[_0x1ca756];if(!_[_0x42b8('0x18')](_0x266068[_0x42b8('0x10')])){if(!_['isNil'](_0x266068[_0x42b8('0x19')]))_0x45a918['push'](insertAdditionalPhones(_0x266068));promisesContact['push']({'contact':_0x266068});}}}Promise[_0x42b8('0x1a')](_0x45a918)[_0x42b8('0x1b')](function(){_0xf1fcc1({'val':0x1});});})[_0x42b8('0x1c')](function(_0x43d71c){logger[_0x42b8('0x1d')](_0x43d71c[_0x42b8('0x1e')]);});});}function insertAdditionalPhones(_0x1b4892){return new Promise(function(_0x3dd964,_0x2a28ba){var _0x4e992b=_0x1b4892['AdditionalPhones'];if(_['isNil'](_0x4e992b))_0x2a28ba({'val':0x0});else{var _0x161446=_0x4e992b[_0x42b8('0x1f')](';');var _0x135bab=[];orderBy=0x0;for(var _0x20b35f=0x0;_0x20b35f<_0x161446['length'];_0x20b35f++){_0x135bab[_0x42b8('0x20')](splitAdditionalPhone(_0x1b4892['id'],_0x161446[_0x20b35f]));}Promise[_0x42b8('0x1a')](_0x135bab)['then'](function(){_0x3dd964({'val':_0x161446['length']});});}});}function splitAdditionalPhone(_0x328e72,_0x38d941){return new Promise(function(_0x2b36e9,_0x183bd0){var _0x33bf0a=_0x38d941['split'](':');var _0x30cde3=_0x33bf0a[0x0];var _0xa29e14=_0x33bf0a[0x1];if(_0xa29e14!==''){var _0x3685bc=_0xa29e14[_0x42b8('0x1f')]('|');var _0x37a904=[];for(var _0x48836e=0x0;_0x48836e<_0x3685bc[_0x42b8('0x17')];_0x48836e++){if(_0x3685bc[_0x48836e]!==''){var _0x2a50aa=_['filter'](promisesAdditionalPhones,{'contactId':_0x328e72,'phone':_0x3685bc[_0x48836e]});if(_0x2a50aa[_0x42b8('0x17')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x328e72,'contactTypeId':_0x30cde3,'phone':_0x3685bc[_0x48836e],'orderBy':orderBy});}}}_0x2b36e9({'ok':0x1});}else _0x2b36e9({'res':0x0});});}function createAdditionalPhone(_0x1fd893,_0x124aef,_0x59dc05,_0x42cd34){var _0x47b462='';var _0x31ef39='';var _0x134bee=_0x59dc05[_0x42b8('0x1f')]('§');_0x47b462=_0x134bee[0x0];if(_0x134bee['length']==0x2)_0x31ef39=_0x134bee[0x1];return new Promise(function(_0x1a1604,_0x2dcfc8){return db[_0x42b8('0x21')][_0x42b8('0x22')]({'where':{'CmContactId':_0x1fd893,'item':_0x47b462}})[_0x42b8('0x1b')](function(_0x453227){if(_0x453227){return db[_0x42b8('0x21')][_0x42b8('0x23')]({'ItemTypeId':_0x124aef,'description':_0x31ef39,'OrderBy':_0x42cd34},{'where':{'CmContactId':_0x1fd893,'item':_0x47b462}})[_0x42b8('0x1b')](function(_0x3f7cf4){_0x1a1604({'res':_0x42b8('0x24')});});}else{return db['CmContactHasItem'][_0x42b8('0x25')]({'CmContactId':_0x1fd893,'item':_0x47b462,'ItemTypeId':_0x124aef,'description':_0x31ef39,'OrderBy':_0x42cd34,'ItemClass':_0x42b8('0x26')})['then'](function(_0x2a39b0){_0x1a1604({'res':_0x42b8('0x27')});});}});});}function updateContact(_0xa50343){return new Promise(function(_0x32bf1f,_0x4f36f1){var _0x2662bf=_0xa50343['id'];delete _0xa50343['id'];return db['CmContact'][_0x42b8('0x23')](_0xa50343,{'where':{'id':_0x2662bf}})[_0x42b8('0x1b')](function(_0x5c9255){updatedRows+=0x1;return db[_0x42b8('0x28')][_0x42b8('0x23')]({'phone':_0xa50343[_0x42b8('0x10')]},{'where':{'ContactId':_0x2662bf}})[_0x42b8('0x1b')](function(_0x369235){_0x32bf1f({'ret':'OK'});});});});}function insertCmHopper(_0x10f8c4,_0x227f4e,_0x51e039,_0x4ea166,_0xcae985){var _0x49d73d=['cm_contacts.phone',_0x42b8('0x29'),_0x42b8('0x2a'),_0x42b8('0x2b'),_0x227f4e+'.'+_0x4ea166,_0x42b8('0x2c'),'cm_contacts.updatedAt',_0x42b8('0x2d'),'cm_contacts.UserId','\x22'+_0xcae985+'\x22'];return squel[_0x42b8('0x2e')]()[_0x42b8('0x2f')](_0x42b8('0x30'))[_0x42b8('0x31')]([_0x42b8('0x10'),_0x42b8('0x32'),_0x42b8('0x33'),'ListId',_0x4ea166,_0x42b8('0x34'),_0x42b8('0x35'),_0x42b8('0x36'),'UserId',_0x42b8('0x37')],squel['select']()[_0x42b8('0x38')](_0x49d73d)[_0x42b8('0x39')](_0x227f4e)['join'](_0x42b8('0x3a'),null,_0x42b8('0x3b')+_0x227f4e+_0x42b8('0x3c'))[_0x42b8('0x11')](_0x51e039,null,_0x51e039+_0x42b8('0x3d')+_0x227f4e+'.'+_0x4ea166)[_0x42b8('0x13')](_0x227f4e+_0x42b8('0x3e'),_0x10f8c4)[_0x42b8('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x42b8('0x13')](_0x42b8('0x3f'),selectNotIn(_0x227f4e,_0x51e039,_0x4ea166,'cm_hopper',[_0x42b8('0x40'),_0x42b8('0x41')]))[_0x42b8('0x13')](_0x42b8('0x3f'),selectNotIn(_0x227f4e,_0x51e039,_0x4ea166,'cm_hopper',[_0x42b8('0x40')])))[_0x42b8('0x42')]();}function insertCmHopperBlack(_0x1167fd,_0x3e3508,_0x424cb8,_0x5ded87){var _0x37b11e=[_0x42b8('0x43'),_0x42b8('0x2a'),_0x42b8('0x2b'),_0x3e3508+'.'+_0x5ded87,'cm_contacts.createdAt',_0x42b8('0x44')];return squel[_0x42b8('0x2e')]()[_0x42b8('0x2f')]('cm_hopper_black')['fromQuery']([_0x42b8('0x10'),_0x42b8('0x33'),_0x42b8('0x45'),_0x5ded87,_0x42b8('0x34'),_0x42b8('0x35')],squel[_0x42b8('0x46')]()[_0x42b8('0x38')](_0x37b11e)[_0x42b8('0x39')](_0x3e3508)[_0x42b8('0x11')](_0x42b8('0x3a'),null,'cm_contacts.ListId\x20=\x20'+_0x3e3508+_0x42b8('0x3c'))[_0x42b8('0x11')](_0x424cb8,null,_0x424cb8+'.id\x20=\x20'+_0x3e3508+'.'+_0x5ded87)['where'](_0x3e3508+'.CmListId\x20=\x20?',_0x1167fd)['where'](_0x42b8('0x47'),NOW)[_0x42b8('0x13')](_0x42b8('0x3f'),squel[_0x42b8('0x46')]()[_0x42b8('0xf')](_0x42b8('0x10'))['from'](_0x42b8('0x48'))['where'](_0x42b8('0x49'),_0x1167fd)[_0x42b8('0x13')](_0x5ded87+'\x20=\x20?',_0x3e3508+'.'+_0x5ded87)))[_0x42b8('0x42')]();}function insertCmHopperAdditionalPhones(_0x3aad36){var _0x543ed5=['cm_hopper.id',_0x42b8('0x4a'),_0x42b8('0x4b'),_0x42b8('0x4c'),_0x42b8('0x4d')];return squel[_0x42b8('0x2e')]()[_0x42b8('0x2f')](_0x42b8('0x4e'))[_0x42b8('0x31')](['CmHopperId',_0x42b8('0x10'),_0x42b8('0x4f'),'createdAt',_0x42b8('0x35')],squel[_0x42b8('0x46')]()['fields'](_0x543ed5)[_0x42b8('0x39')]('cm_hopper')[_0x42b8('0x11')](_0x42b8('0x3a'),null,_0x42b8('0x50'))['join'](_0x42b8('0x51'),null,_0x42b8('0x52'))[_0x42b8('0x13')](_0x42b8('0x53'),_0x3aad36)['where'](_0x42b8('0x47'),NOW))['toString']();}function insertCmContact(_0x353511,_0x34f154,_0x544b2a,_0x2667f5){var _0x258e95=_[_0x42b8('0x54')](_[_0x42b8('0x55')](_0x2667f5),[_0x42b8('0x45'),'CompanyId',_0x42b8('0x34'),'updatedAt']);return squel[_0x42b8('0x2e')]()['into'](_0x42b8('0x3a'))[_0x42b8('0x31')](_0x258e95,squel[_0x42b8('0x46')]()[_0x42b8('0x38')](_0x258e95)[_0x42b8('0x39')](_0x34f154)[_0x42b8('0x13')]('('+_0x544b2a['join'](',')+_0x42b8('0x56'),squel[_0x42b8('0x46')]()['fields'](_0x544b2a)[_0x42b8('0x39')](_0x42b8('0x3a'))[_0x42b8('0x13')]('ListId\x20=\x20?',_0x353511))['where']('id\x20IN\x20?',squel[_0x42b8('0x46')]()[_0x42b8('0xf')](_0x42b8('0x57'),_0x42b8('0x58'))['from'](_0x34f154)[_0x42b8('0x59')](_0x544b2a['join'](','))))[_0x42b8('0x42')]();}function handleStop(){logger[_0x42b8('0x5a')](_0x42b8('0x5b'));stopped=!![];}function handleUncaughtException(_0x2bf727){logger['error'](_0x2bf727[_0x42b8('0x1e')]);process[_0x42b8('0x5c')](0x1);}function handleError(_0xc2bdc,_0x41e4c2){stats[_0x42b8('0x5d')][_0x42b8('0x20')]({'name':_0x41e4c2['code'],'message':_0x41e4c2[_0x42b8('0x1e')],'row':_0xc2bdc});}function handleQuery(_0x12a8ee){logger[_0x42b8('0x5a')](_0x12a8ee);return db[_0x42b8('0x15')][_0x42b8('0x5e')](_0x12a8ee)['spread'](function(_0x67cdc5){results[_0x42b8('0x20')](_0x67cdc5);})['catch'](function(_0xcc8b01){logger[_0x42b8('0x1d')](_0xcc8b01['message']);});}function main(_0x1c6c5e,_0x919806,_0x3f2ff0,_0x3d5c19){logger[_0x42b8('0x5a')](_0x42b8('0x5f'),_0x1c6c5e,JSON[_0x42b8('0x60')](_0x919806));process[_0x42b8('0x61')](_0x42b8('0x62'));var _0x6383ce=_0x919806[_0x42b8('0x63')];var _0x52547c=_[_0x42b8('0x64')](_0x6383ce);var _0x2c887e=_0x919806['socket_timestamp'];var _0x286844=path['join'](config[_0x42b8('0x65')],_0x42b8('0x66'),_0x2c887e+_0x42b8('0x67'));logger[_0x42b8('0x5a')](_0x42b8('0x68'),_0x919806);db[_0x42b8('0x69')][_0x42b8('0x6a')]({'raw':!![],'attributes':['id',_0x42b8('0x6b')]})[_0x42b8('0x1b')](function(_0x136777){for(var _0x5ce5f8=0x0;_0x5ce5f8<_0x136777[_0x42b8('0x17')];_0x5ce5f8++){if(_0x136777[_0x5ce5f8][_0x42b8('0x6b')]in _0x6383ce){contactItemTypes['push'](_0x136777[_0x5ce5f8]);delete _0x52547c[_0x136777[_0x5ce5f8]['name']];hasAdditionalPhones=!![];}for(var _0x4e3dbc in _0x6383ce){if(_0x136777[_0x5ce5f8][_0x42b8('0x6b')]+_0x42b8('0x6c')===_0x4e3dbc){phoneDescriptions['push']({'itemTypeId':_0x136777[_0x5ce5f8]['id'],'description':_0x4e3dbc});delete _0x52547c[_0x4e3dbc];}}}if(hasAdditionalPhones)_0x52547c[_0x42b8('0x19')]='';var _0x102a26=_[_0x42b8('0x55')](_0x52547c)[_0x42b8('0x11')]();logger[_0x42b8('0x5a')]('header',_0x102a26);fs['writeFileSync'](_0x286844,_0x102a26+'\x0a');Papa['parse'](fs[_0x42b8('0x6d')](_0x1c6c5e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x490950,_0x22cf66){try{for(var _0xad151=0x0,_0x2787ac=[];_0xad151<_0x490950[_0x42b8('0x6e')][_0x42b8('0x17')];_0xad151++){stats[_0x42b8('0x6f')]+=0x1;if(_0x490950['errors'][_0xad151]){handleError(_0x490950['data'][_0xad151],_0x490950['errors'][_0xad151]);}else{var _0xd12625=[];var _0x556867=[];var _0x3183d1={};for(var _0x5634c8 in _0x6383ce){let _0x48118c=contactItemTypes[_0x42b8('0x70')](_0x4e6581=>_0x4e6581[_0x42b8('0x6b')]===_0x5634c8);let _0x31853d=contactItemTypes[_0x42b8('0x70')](_0x55ceb4=>_0x55ceb4[_0x42b8('0x6b')]+_0x42b8('0x6c')===_0x5634c8);if(_[_0x42b8('0x18')](_0x48118c)&&_[_0x42b8('0x18')](_0x31853d)){if(_0x6383ce[_0x42b8('0x71')](_0x5634c8)){if(_0x490950['data'][_0xad151][_0x6383ce[_0x5634c8]]){var _0x292ed9=_[_0x42b8('0x72')](_0x490950[_0x42b8('0x6e')][_0xad151][_0x6383ce[_0x5634c8]][_0x42b8('0x73')](/"/g,'\x27'));switch(_0x5634c8){case _0x42b8('0x32'):var _0x7c377c=moment(_0x292ed9,_0x42b8('0xc'),!![]);if(_0x7c377c[_0x42b8('0x74')]()){_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');}else{_0xd12625[_0x42b8('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x42b8('0x36'):var _0x12bdb1=parseInt(_0x292ed9);_0x292ed9=_[_0x42b8('0x75')](_0x12bdb1)||_0x12bdb1<0x0||_0x12bdb1>0x4?_0x3d5c19?0x3:0x2:_0x12bdb1;_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');break;case _0x42b8('0x76'):var _0x40507d=parseInt(_0x292ed9);if(_[_0x42b8('0x77')](_0x40507d)&&_[_0x42b8('0x78')](_0x3f2ff0,_0x40507d)){_0x2787ac[_0x42b8('0x20')]('\x22'+_0x40507d+'\x22');}else{_0xd12625[_0x42b8('0x20')](_0x42b8('0x79'));}break;case _0x42b8('0x7a'):if(isEmail(_0x292ed9)){_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');}else{_0xd12625['push'](_0x42b8('0x7b'));}break;case _0x42b8('0x7c'):var _0x189056=moment(_0x292ed9,'YYYY-MM-DD',!![]);if(_0x189056['isValid']()){_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');}else{_0xd12625[_0x42b8('0x20')](_0x42b8('0x7d'));}break;default:_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');}}else{switch(_0x5634c8){case _0x42b8('0x7e'):case _0x42b8('0x10'):_0xd12625[_0x42b8('0x20')](_0x5634c8+_0x42b8('0x7f'));break;default:_0x2787ac[_0x42b8('0x20')]('\x22\x22');}}}}else{var _0x17c8fb='';if(!_['isNil'](_0x48118c)){if(!_0x3183d1[_0x42b8('0x71')](_0x48118c['id'])){for(var _0x299687=0x0;_0x299687<_0x6383ce[_0x5634c8][_0x42b8('0x17')];_0x299687++){var _0x292ed9=_[_0x42b8('0x72')](_0x490950[_0x42b8('0x6e')][_0xad151][_0x6383ce[_0x5634c8][_0x299687]]['replace'](/"/g,'\x27'));var _0x3e49e9=phoneDescriptions[_0x42b8('0x70')](_0x5dcd57=>_0x5dcd57['itemTypeId']===_0x48118c['id']);if(!_[_0x42b8('0x18')](_0x3e49e9)){var _0x7ad47f=_[_0x42b8('0x72')](_0x490950[_0x42b8('0x6e')][_0xad151][_0x6383ce[_0x3e49e9['description']][0x0]][_0x42b8('0x73')](/"/g,'\x27'));if(!_[_0x42b8('0x18')](_0x7ad47f))_0x292ed9=_0x292ed9+'§'+_0x7ad47f;}if(_0x17c8fb=='')_0x17c8fb=_0x292ed9;else _0x17c8fb+='|'+_0x292ed9;}_0x556867['push'](_0x48118c['id']+':'+_0x17c8fb);_0x3183d1[_0x48118c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2787ac['push']('\x22'+_0x556867[_0x42b8('0x11')](';')+'\x22');}if(_0xd12625[_0x42b8('0x17')]){handleError(_0x490950[_0x42b8('0x6e')][_0xad151],{'code':'SystemRow','message':_0xd12625[_0x42b8('0x11')]()});}else{fs[_0x42b8('0x80')](_0x286844,_0x2787ac[_0x42b8('0x11')]()+'\x0a');}_0x2787ac=[];}if(!(stats[_0x42b8('0x6f')]%0xc8)){socket['emit'](_0x42b8('0x81')+_0x2c887e,stats);stats[_0x42b8('0x5d')]=[];}}if(stopped){logger['info'](_0x42b8('0x82'));_0x22cf66[_0x42b8('0x83')]();}}catch(_0xef7f35){handleError(_0x490950[_0x42b8('0x6e')][_0xad151],{'code':_0x42b8('0x84'),'message':_0xef7f35[_0x42b8('0x1e')]});logger[_0x42b8('0x1d')](_0x42b8('0x85'),_0xef7f35[_0x42b8('0x1e')]);}},'complete':function(){try{var _0x3a9a93=[];var _0x49d871=tempTableName;_0x3a9a93[_0x42b8('0x20')](_0x42b8('0x86')+_0x49d871+_0x42b8('0x87'));logger['info']('CIS\x20len',contactItemTypes[_0x42b8('0x17')]);var _0x30986b=util[_0x42b8('0xb')](_0x42b8('0x88'),_0x286844,_0x49d871,_0x102a26,_0x919806[_0x42b8('0x45')],_0x919806['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x6383ce['scheduledat'])){_0x30986b+=_0x42b8('0x89');}_0x3a9a93['push'](_0x30986b);BPromise[_0x42b8('0x8a')](_0x3a9a93,handleQuery)[_0x42b8('0x1b')](function(_0x406e93){BPromise[_0x42b8('0x1a')]([handleAdditionalPhones()])[_0x42b8('0x1b')](function(){_0x3a9a93=[];for(var _0x198839=0x0;_0x198839\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.internal','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','search','field','name','color','from','tools_tags','getInteractionFK','user_has_','select','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','default','text','value','start','end','read','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','clause','and','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type','body','some','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','fields','then','tag','tags','filter','get','capitalize','Websites','Accounts','resolve','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages'];(function(_0x8ccfdc,_0x59d713){var _0x1e106e=function(_0x2c4745){while(--_0x2c4745){_0x8ccfdc['push'](_0x8ccfdc['shift']());}};_0x1e106e(++_0x59d713);}(_0x69de,0x16b));var _0xe69d=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x69de[_0x16629d];return _0x56ccee;};'use strict';var _=require('lodash');var squel=require(_0xe69d('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xe69d('0x1'));var updateInteraction=require(_0xe69d('0x2'))[_0xe69d('0x3')];var utils=require(_0xe69d('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x3ae7a5,_0x4917e2,_0x3de00d){var _0x5ec521=![];var _0x3e7ca0=utils[_0xe69d('0x5')](_0x3ae7a5);if(_0x4917e2[_0xe69d('0x6')]===_0xe69d('0x7')&&!_0x3de00d[_0xe69d('0x8')]&&!_0x3de00d[_0x3e7ca0]){_0x5ec521=!![];}return _0x5ec521;}function getTagsQuery(){return squel['select']()[_0xe69d('0x9')]('id')[_0xe69d('0x9')](_0xe69d('0xa'))[_0xe69d('0x9')](_0xe69d('0xb'))[_0xe69d('0xc')](_0xe69d('0xd'));}function getUsersQuery(_0x358aa3,_0x139175){var _0x50fd4e=utils[_0xe69d('0xe')](_0x358aa3);var _0x4142ec=_0xe69d('0xf')+_0x358aa3+'_interactions';var _0x22c14b=squel[_0xe69d('0x10')]()['field'](_0xe69d('0x11'))[_0xe69d('0x9')]('u.fullname')['field'](_0xe69d('0x12')+_0x50fd4e)['from'](_0x4142ec,'ui')[_0xe69d('0x13')](_0xe69d('0x14'),'u',_0xe69d('0x15'));if(_0x139175[_0xe69d('0x16')]>0x0){_0x22c14b[_0xe69d('0x17')](_0xe69d('0x12')+_0x50fd4e+_0xe69d('0x18'),_[_0xe69d('0x19')](_0x139175,'id'));}return _0x22c14b;}function getInteractionsQuery(_0x5bf7f1){var _0x298d75=utils[_0xe69d('0x1a')](_0x5bf7f1);var _0x35302d=utils['getAccountFK'](_0x5bf7f1);var _0x250b73=utils['getInteractionFK'](_0x5bf7f1);return squel[_0xe69d('0x10')]()[_0xe69d('0xc')](_0x298d75[_0xe69d('0x1b')],'i')['left_join'](_0xe69d('0x1c'),'c',_0xe69d('0x1d'))[_0xe69d('0x13')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x298d75[_0xe69d('0x1e')],'a',_0xe69d('0x1f')+_0x35302d)[_0xe69d('0x13')](_0x298d75[_0xe69d('0x20')],'me','me.'+_0x250b73+_0xe69d('0x21'))[_0xe69d('0x13')](_0x298d75['interactionsTags'],'it',_0xe69d('0x22')+_0x250b73+_0xe69d('0x21'))[_0xe69d('0x13')](_0xe69d('0xd'),'t',_0xe69d('0x23'));}function getSqlClauses(){var _0x563e9e={'body':squel[_0xe69d('0x24')](),'contact':squel[_0xe69d('0x24')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xe69d('0x24')](),'read':squel[_0xe69d('0x24')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xe69d('0x24')]()};return _0x563e9e;}function parseTagParameter(_0x9afad1){var _0x296c10=squel[_0xe69d('0x24')]();if(_0x9afad1){var _0x5519fa=utils[_0xe69d('0x25')](_0x9afad1);_0x5519fa[_0xe69d('0x26')](function(_0x5172fa){_0x296c10['or'](_0xe69d('0x27'),'%,'+_0x5172fa+',%');});}return _0x296c10;}function parseReadParameter(_0x42d045){var _0x12e9a9='';if(_0x42d045){_0x12e9a9='unreadMessages\x20{OPERATOR}\x200';if(_0x42d045==='1'){_0x12e9a9=_0x12e9a9['replace']('{OPERATOR}','=');}else{_0x12e9a9=_0x12e9a9[_0xe69d('0x28')](_0xe69d('0x29'),'>');}}return _0x12e9a9;}function parseSearchFilter(_0x5cce95,_0x5bb33a){var _0x201744=squel['expr']();if(_0x5bb33a){var _0x351240=_0x5bb33a[_0xe69d('0x28')]('\x5c','\x5c\x5c')[_0xe69d('0x28')](/'/g,'\x27\x27');if(qs[_0xe69d('0x2a')](_0x351240)){_0x201744['or'](_0xe69d('0x2b'),_0x351240+'%');if([_0xe69d('0x2c'),_0xe69d('0x2d')][_0xe69d('0x2e')](_0x5cce95)){_0x201744['or'](_0xe69d('0x2f'),_0x351240+'%');}else if(_0x5cce95===_0xe69d('0x30')){_0x201744['or']('i.fax\x20LIKE\x20?',_0x351240+'%');}else if(_0x5cce95===_0xe69d('0x31')){_0x201744['or'](_0xe69d('0x32'),_0x351240+'%');}}else if(_0x5cce95===_0xe69d('0x33')&&qs[_0xe69d('0x34')](_0x351240)){_0x201744['or'](_0xe69d('0x35'),_0x351240+'%');}else{if(_0x5cce95===_0xe69d('0x33')){_0x201744['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x351240,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe69d('0x36')](_0x351240));}else if(_0x5cce95!==_0xe69d('0x30')){_0x201744['or'](_0xe69d('0x37'),qs[_0xe69d('0x36')](_0x351240));}_0x201744['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe69d('0x36')](_0x351240,!![]),null);}}return _0x201744;}function parseAdvancedSearchFilter(_0xf94752,_0x2caec4){var _0x2b9748=getSqlClauses();var _0x4b826d=as['parseSearch'](_0xf94752);var _0x3e7604=_0x4b826d[_0xe69d('0x38')];for(var _0x3c0a48=0x0;_0x3c0a48<_0x4b826d[_0xe69d('0x39')]['length'];_0x3c0a48++){var _0x1b098d=_0x4b826d[_0xe69d('0x39')][_0x3c0a48];var _0x59cdcd='i';var _0x55334d=_[_0xe69d('0x3a')](_0x2caec4,[_0xe69d('0xa'),_0x1b098d[_0xe69d('0x9')]]);if(_0x55334d){var _0x22835d=as['buildExpression'](_0x59cdcd,_0x55334d['type'],_0x1b098d);_0x2b9748[_0xe69d('0x3b')][_0x3e7604](_0x22835d[_0xe69d('0x3c')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3e')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3f')]);}else{switch(_0x1b098d['field']){case'unreadMessages':var _0x5f2d15=parseReadParameter(_0x1b098d[_0xe69d('0x3d')]);_0x2b9748[_0xe69d('0x40')]['and'](_0x5f2d15);break;case _0xe69d('0x41'):if(_0x1b098d[_0xe69d('0x42')]===_0xe69d('0x43')){if(_0x1b098d['value'][_0xe69d('0x44')]('\x20')[_0xe69d('0x16')]>0x1){_0x2b9748['contact'][_0x3e7604](_0xe69d('0x45'),qs[_0xe69d('0x36')](_0x1b098d['value'],!![]),null);}else{var _0x33cf38='%'+_0x1b098d[_0xe69d('0x3d')]+'%';_0x2b9748[_0xe69d('0x46')][_0x3e7604](_0xe69d('0x47'),_0x33cf38,_0x33cf38,_0x33cf38);}}else{_0x55334d=_[_0xe69d('0x3a')](_0x2caec4,[_0xe69d('0xa'),'ContactId']);_0x1b098d[_0xe69d('0x9')]=_0xe69d('0x48');_0x22835d=as['buildExpression'](_0x59cdcd,_0x55334d['type'],_0x1b098d);_0x2b9748['contact'][_0x3e7604](_0x22835d[_0xe69d('0x3c')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3e')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3f')]);}break;case _0xe69d('0x49'):var _0x29f7ed=_0x1b098d[_0xe69d('0x3d')][_0xe69d('0x44')](',')['map'](function(_0x46b7b9){return Number(_0x46b7b9);});var _0x171b1f=parseTagParameter(_0x29f7ed);_0x2b9748['tags'][_0xe69d('0x4a')][_0xe69d('0x4b')](_0x171b1f);_0x2b9748['tags'][_0xe69d('0x4c')]=_0x29f7ed;break;case'User':if(_0x1b098d[_0xe69d('0x42')]==='$substring'){_0x2b9748[_0xe69d('0x4d')][_0x3e7604](_0xe69d('0x4e'),'%'+_0x1b098d['value']+'%',null);}else{_0x55334d=_['find'](_0x2caec4,[_0xe69d('0xa'),_0xe69d('0x4f')]);_0x1b098d[_0xe69d('0x9')]=_0xe69d('0x4f');_0x22835d=as[_0xe69d('0x50')](_0x59cdcd,_0x55334d[_0xe69d('0x51')],_0x1b098d);_0x2b9748[_0xe69d('0x4d')][_0x3e7604](_0x22835d[_0xe69d('0x3c')],_0x22835d[_0xe69d('0x3d')][_0xe69d('0x3e')],_0x22835d['value'][_0xe69d('0x3f')]);}break;case'body':case'plainBody':_0x22835d=as[_0xe69d('0x50')]('me',null,_0x1b098d);_0x2b9748[_0xe69d('0x52')][_0x3e7604](_0x22835d[_0xe69d('0x3c')],_0x22835d['value']['start'],_0x22835d['value']['end']);break;}}}return _0x2b9748;}function parseModelFields(_0x38509d,_0x283ed1,_0x39a536){var _0x5885a9=utils[_0xe69d('0x5')](_0x38509d);var _0x38179d=squel['expr']();var _0x5adae9=_(_0x283ed1)['keys']()[_0xe69d('0x19')](function(_0xe71daa){return _[_0xe69d('0x53')](_0x39a536,['name',_0xe71daa])?_0xe71daa:undefined;})['compact']()['value']();if(_0x5adae9[_0xe69d('0x16')]>0x0){_0x5adae9['forEach'](function(_0x3464ea){if(_0x3464ea===_0x5885a9){_0x38179d[_0xe69d('0x4b')]('i.'+_0x5885a9+_0xe69d('0x18'),[]['concat'](_0x283ed1[_0x3464ea]));}else if(_0x3464ea===_0xe69d('0x54')){var _0x3adf5a=JSON[_0xe69d('0x55')](_0x283ed1[_0x3464ea])[_0xe69d('0x56')];var _0x30d07c=JSON[_0xe69d('0x55')](_0x283ed1[_0x3464ea])[_0xe69d('0x57')];_0x38179d['and'](_0xe69d('0x58'),_0x3adf5a,_0x30d07c);}else{if(_0x283ed1[_0x3464ea]===_0xe69d('0x59')){_0x38179d[_0xe69d('0x4b')]('i.'+_0x3464ea+'\x20IS\x20NULL');}else{_0x38179d[_0xe69d('0x4b')]('i.'+_0x3464ea+'\x20=\x20?',_0x283ed1[_0x3464ea]);}}});}return _0x38179d;}function parseQueryParameters(_0x36b5d4,_0x2c0830,_0x13b654){var _0x27de14=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x36b5d4,_0x2c0830,_0x13b654);})['then'](function(_0x54ad74){_0x27de14[_0xe69d('0x5a')][_0xe69d('0x4b')](_0x54ad74);return parseReadParameter(_0x2c0830[_0xe69d('0x40')]);})[_0xe69d('0x5b')](function(_0x3010be){_0x27de14[_0xe69d('0x40')]['and'](_0x3010be);return parseTagParameter(_0x2c0830[_0xe69d('0x5c')]);})[_0xe69d('0x5b')](function(_0x2e36e6){_0x27de14[_0xe69d('0x5d')][_0xe69d('0x4a')]['and'](_0x2e36e6);return parseSearchFilter(_0x36b5d4,_0x2c0830[_0xe69d('0x5e')]);})[_0xe69d('0x5b')](function(_0x3eb86e){_0x27de14[_0xe69d('0x5e')]=_0x3eb86e;return _0x27de14;});}function checkAccountsRestrictions(_0x4f11e0,_0x415d2a,_0x1a02c5){var _0x50e721=utils[_0xe69d('0x5')](_0x4f11e0);var _0x3485bc=_0xe69d('0x5f')+_[_0xe69d('0x60')](_0x4f11e0)+(_0x4f11e0==='chat'?_0xe69d('0x61'):_0xe69d('0x62'));var _0x43cf6f=squel['expr']();return Promise[_0xe69d('0x63')]()[_0xe69d('0x5b')](function(){if(_0x1a02c5['search']&&_0x415d2a[_0xe69d('0x6')]==='agent'){return _0x415d2a[_0x3485bc]({'attributes':['id'],'raw':!![]});}})[_0xe69d('0x5b')](function(_0x29e5de){if(_0x29e5de){if(_0x29e5de[_0xe69d('0x16')]===0x0){_0x43cf6f['and']('i.'+_0x50e721+_0xe69d('0x64'));}else{_0x43cf6f['and']('i.'+_0x50e721+'\x20IN\x20?',_['map'](_0x29e5de,'id'));}}else if(!_0x1a02c5[_0x50e721]){_0x43cf6f[_0xe69d('0x4b')]('i.'+_0x50e721+_0xe69d('0x65'));}})['then'](function(){return _0x43cf6f;});}function getClosedOrderClause(_0x173080,_0x101903){var _0x434cce='';var _0x5ae726=['i.thirdDisposition',_0xe69d('0x66'),_0xe69d('0x67')];if(_0x173080===_0xe69d('0x33')){_0x5ae726[_0xe69d('0x68')](_0xe69d('0x69'));}if(_0x101903[_0xe69d('0x6a')]==='0'&&_0x173080===_0xe69d('0x33')){_0x434cce=_0xe69d('0x69');}else{if(_0x101903[_0xe69d('0x6a')]==='1'){_0x5ae726[_0xe69d('0x6b')]();}_0x434cce=_0xe69d('0x6c')+_0x5ae726['join'](',\x20')+')';}return _0x434cce;}function getFilteredInteractions(_0x12a746,_0x5c470d,_0x1a126f,_0x37b5c4){var _0x2e55cd=utils[_0xe69d('0xe')](_0x12a746);var _0x4567b8=_[_0xe69d('0x60')](_0x12a746)+_0xe69d('0x6d');var _0x177b1f=[];var _0x35a4f4=getTagsQuery();var _0x5153aa={'type':db[_0xe69d('0x6e')][_0xe69d('0x6f')][_0xe69d('0x70')],'raw':!![]};var _0x1d9f8a=[];var _0x5d4301=[];return db[_0xe69d('0x71')][_0xe69d('0x72')](_0x35a4f4[_0xe69d('0x73')](),_0x5153aa)[_0xe69d('0x5b')](function(_0x4afa01){_0x177b1f=_[_0xe69d('0x74')](_0x4afa01,'id');_0x5153aa=_['merge'](_0x5153aa,{'model':db[_0x4567b8],'mapToModel':!![],'nest':!![]});if(_0x1a126f[_0xe69d('0x5a')]){_0x37b5c4[_0xe69d('0x75')]['forEach'](function(_0x2e3454){_0x5c470d['field']('i.'+_0x2e3454);});}else{_0x5c470d['field'](_0xe69d('0x76'),_0xe69d('0x77'));_0x5c470d[_0xe69d('0x9')]('a.key','Account.key');_0x5c470d[_0xe69d('0x9')](_0xe69d('0x78'),_0xe69d('0x79'));if(_0x12a746===_0xe69d('0x33')){_0x5c470d[_0xe69d('0x9')]('a.email','Account.email');_0x5c470d[_0xe69d('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe69d('0x7a'));_0x5c470d[_0xe69d('0x9')]('i.id');_0x5c470d[_0xe69d('0x9')](_0xe69d('0x7b'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x7c'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x7d'));_0x5c470d['field'](_0xe69d('0x7e'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x7f'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x80'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x81'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x82'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x67'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x66'));_0x5c470d['field'](_0xe69d('0x83'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x69'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x84'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x85'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x86'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x87'));}else if(_0x12a746===_0xe69d('0x31')){_0x5c470d['field'](_0xe69d('0x88'),_0xe69d('0x7a'));}else{_0x5c470d['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x12a746!==_0xe69d('0x33')){_0x5c470d[_0xe69d('0x9')](_0xe69d('0x89'));}_0x5c470d[_0xe69d('0x9')](_0xe69d('0x8a'),'Contact.firstName');_0x5c470d['field'](_0xe69d('0x8b'),_0xe69d('0x8c'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x8d'),_0xe69d('0x8e'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x8f'),_0xe69d('0x90'));_0x5c470d[_0xe69d('0x9')](_0xe69d('0x91'),'Contact.mobile');_0x5c470d[_0xe69d('0x9')](_0xe69d('0x92'),_0xe69d('0x93'));_0x5c470d[_0xe69d('0x9')]('o.fullname','Owner.fullname');_0x5c470d[_0xe69d('0x9')]('o.internal',_0xe69d('0x94'));_0x5c470d[_0xe69d('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe69d('0x95'));}if(_0x37b5c4['limit']){_0x5c470d[_0xe69d('0x96')](_0x37b5c4['limit']);}if(_0x37b5c4[_0xe69d('0x97')]){_0x5c470d['offset'](_0x37b5c4[_0xe69d('0x97')]);}return db[_0xe69d('0x71')][_0xe69d('0x72')](_0x5c470d[_0xe69d('0x73')](),_0x5153aa);})[_0xe69d('0x5b')](function(_0x370237){_0x1d9f8a=_0x370237;var _0x142fa4=getUsersQuery(_0x12a746,_0x1d9f8a);return db[_0xe69d('0x71')][_0xe69d('0x72')](_0x142fa4[_0xe69d('0x73')](),_0x5153aa);})[_0xe69d('0x5b')](function(_0x581b74){_0x5d4301=_[_0xe69d('0x98')](_0x581b74,_0x2e55cd);if(_0x12a746===_0xe69d('0x33')){return db[_0xe69d('0x99')][_0xe69d('0x9a')]({'attributes':[_0xe69d('0x9b')],'raw':!![]});}})[_0xe69d('0x5b')](function(_0x707637){var _0x53816=_0x707637?_0x707637[_0xe69d('0x9b')]:undefined;var _0x394f8a=_0x1d9f8a[_0xe69d('0x19')](function(_0x658892){return updateInteraction(_0x658892,_0x177b1f,_0x5d4301,_0x53816);});return Promise[_0xe69d('0x9c')](_0x394f8a);});}function countFilteredInteractions(_0x477d58,_0x4deefb){var _0x185a71=_0x477d58[_0xe69d('0x9d')]();_0x185a71['field'](_0xe69d('0x9e'));_0x185a71['field'](_0xe69d('0x76'),_0xe69d('0x77'));var _0x8249be=utils['getSelectedTags'](_0x4deefb);if(!_[_0xe69d('0x9f')](_0x8249be)){_0x185a71[_0xe69d('0x17')](_0xe69d('0xa0'),_0x8249be);}var _0x4323c2={'type':db[_0xe69d('0x6e')][_0xe69d('0x6f')]['SELECT'],'raw':!![]};return db['sequelize'][_0xe69d('0x72')](_0x185a71[_0xe69d('0x73')](),_0x4323c2);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x627a=['expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','parseSearch','sqlOperator','conditions','find','buildExpression','type','text','start','value','end','unreadMessages','and','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','map','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','body','keys','some','compact','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','resolve','then','fields','read','tag','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','contactName','i.id','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.ContactId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','SELECT','exports','lodash','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','user_has_','u.id','u.fullname','left_join','users','length','where','ui.','\x20IN\x20?','getInteractionFK','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId'];(function(_0x2ea5d6,_0x2ef3e7){var _0x20dcb3=function(_0x22ed56){while(--_0x22ed56){_0x2ea5d6['push'](_0x2ea5d6['shift']());}};_0x20dcb3(++_0x2ef3e7);}(_0x627a,0x1b9));var _0xa627=function(_0x1c7cde,_0x3b54f4){_0x1c7cde=_0x1c7cde-0x0;var _0x523e24=_0x627a[_0x1c7cde];return _0x523e24;};'use strict';var _=require(_0xa627('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require(_0xa627('0x1'))[_0xa627('0x2')];var utils=require('./utils');var db=require(_0xa627('0x3'))['db'];function skipInteractionsQuery(_0x4589fa,_0x2ef1cb,_0x58adfc){var _0x3f7de5=![];var _0x4cb1c3=utils[_0xa627('0x4')](_0x4589fa);if(_0x2ef1cb[_0xa627('0x5')]===_0xa627('0x6')&&!_0x58adfc[_0xa627('0x7')]&&!_0x58adfc[_0x4cb1c3]){_0x3f7de5=!![];}return _0x3f7de5;}function getTagsQuery(){return squel[_0xa627('0x8')]()[_0xa627('0x9')]('id')[_0xa627('0x9')](_0xa627('0xa'))['field'](_0xa627('0xb'))[_0xa627('0xc')](_0xa627('0xd'));}function getUsersQuery(_0x1efdd2,_0x5d340c){var _0x38a8df=utils['getInteractionFK'](_0x1efdd2);var _0x5c693d=_0xa627('0xe')+_0x1efdd2+'_interactions';var _0x57f3a7=squel[_0xa627('0x8')]()['field'](_0xa627('0xf'))[_0xa627('0x9')](_0xa627('0x10'))[_0xa627('0x9')]('ui.'+_0x38a8df)[_0xa627('0xc')](_0x5c693d,'ui')[_0xa627('0x11')](_0xa627('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x5d340c[_0xa627('0x13')]>0x0){_0x57f3a7[_0xa627('0x14')](_0xa627('0x15')+_0x38a8df+_0xa627('0x16'),_['map'](_0x5d340c,'id'));}return _0x57f3a7;}function getInteractionsQuery(_0x27785d){var _0x1f4a4c=utils['getInteractionsTables'](_0x27785d);var _0x2427e4=utils[_0xa627('0x4')](_0x27785d);var _0x220438=utils[_0xa627('0x17')](_0x27785d);return squel[_0xa627('0x8')]()[_0xa627('0xc')](_0x1f4a4c['interactions'],'i')[_0xa627('0x11')](_0xa627('0x18'),'c',_0xa627('0x19'))[_0xa627('0x11')](_0xa627('0x12'),'o',_0xa627('0x1a'))['left_join'](_0x1f4a4c[_0xa627('0x1b')],'a',_0xa627('0x1c')+_0x2427e4)['left_join'](_0x1f4a4c[_0xa627('0x1d')],'me',_0xa627('0x1e')+_0x220438+_0xa627('0x1f'))[_0xa627('0x11')](_0x1f4a4c['interactionsTags'],'it','it.'+_0x220438+_0xa627('0x1f'))[_0xa627('0x11')]('tools_tags','t',_0xa627('0x20'));}function getSqlClauses(){var _0x346d26={'body':squel[_0xa627('0x21')](),'contact':squel[_0xa627('0x21')](),'default':squel[_0xa627('0x21')](),'fields':squel[_0xa627('0x21')](),'filter':squel[_0xa627('0x21')](),'read':squel[_0xa627('0x21')](),'tags':{'clause':squel[_0xa627('0x21')](),'ids':null},'user':squel['expr']()};return _0x346d26;}function parseTagParameter(_0x7fc212){var _0x2fe6c0=squel['expr']();if(_0x7fc212){var _0x1287a6=utils[_0xa627('0x22')](_0x7fc212);_0x1287a6[_0xa627('0x23')](function(_0x42c846){_0x2fe6c0['or'](_0xa627('0x24'),'%,'+_0x42c846+',%');});}return _0x2fe6c0;}function parseReadParameter(_0x1a8c66){var _0x53c51d='';if(_0x1a8c66){_0x53c51d=_0xa627('0x25');if(_0x1a8c66==='1'){_0x53c51d=_0x53c51d['replace'](_0xa627('0x26'),'=');}else{_0x53c51d=_0x53c51d[_0xa627('0x27')]('{OPERATOR}','>');}}return _0x53c51d;}function parseSearchFilter(_0x2f32f0,_0x1ead20){var _0x18d0f7=squel[_0xa627('0x21')]();if(_0x1ead20){var _0x5c7915=_0x1ead20['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5c7915)){_0x18d0f7['or'](_0xa627('0x28'),_0x5c7915+'%');if([_0xa627('0x29'),_0xa627('0x2a')]['includes'](_0x2f32f0)){_0x18d0f7['or'](_0xa627('0x2b'),_0x5c7915+'%');}else if(_0x2f32f0==='fax'){_0x18d0f7['or'](_0xa627('0x2c'),_0x5c7915+'%');}else if(_0x2f32f0==='openchannel'){_0x18d0f7['or']('i.from\x20LIKE\x20?',_0x5c7915+'%');}}else if(_0x2f32f0===_0xa627('0x2d')&&qs[_0xa627('0x2e')](_0x5c7915)){_0x18d0f7['or'](_0xa627('0x2f'),_0x5c7915+'%');}else{if(_0x2f32f0===_0xa627('0x2d')){_0x18d0f7['or'](_0xa627('0x30'),qs[_0xa627('0x31')](_0x5c7915,!![]))['or'](_0xa627('0x32'),qs[_0xa627('0x31')](_0x5c7915));}else if(_0x2f32f0!==_0xa627('0x33')){_0x18d0f7['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5c7915));}_0x18d0f7['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa627('0x31')](_0x5c7915,!![]),null);}}return _0x18d0f7;}function parseAdvancedSearchFilter(_0x5a4790,_0xc33377){var _0x4b1bc8=getSqlClauses();var _0x4fdf19=as[_0xa627('0x34')](_0x5a4790);var _0x115460=_0x4fdf19[_0xa627('0x35')];for(var _0x465b08=0x0;_0x465b08<_0x4fdf19[_0xa627('0x36')][_0xa627('0x13')];_0x465b08++){var _0x5c83da=_0x4fdf19[_0xa627('0x36')][_0x465b08];var _0x2e04c2='i';var _0x2b8c6b=_[_0xa627('0x37')](_0xc33377,[_0xa627('0xa'),_0x5c83da[_0xa627('0x9')]]);if(_0x2b8c6b){var _0x3ebe47=as[_0xa627('0x38')](_0x2e04c2,_0x2b8c6b[_0xa627('0x39')],_0x5c83da);_0x4b1bc8['default'][_0x115460](_0x3ebe47[_0xa627('0x3a')],_0x3ebe47['value'][_0xa627('0x3b')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3d')]);}else{switch(_0x5c83da['field']){case _0xa627('0x3e'):var _0x52d90a=parseReadParameter(_0x5c83da['value']);_0x4b1bc8['read'][_0xa627('0x3f')](_0x52d90a);break;case _0xa627('0x40'):if(_0x5c83da[_0xa627('0x41')]===_0xa627('0x42')){if(_0x5c83da[_0xa627('0x3c')][_0xa627('0x43')]('\x20')[_0xa627('0x13')]>0x1){_0x4b1bc8[_0xa627('0x44')][_0x115460](_0xa627('0x45'),qs[_0xa627('0x31')](_0x5c83da['value'],!![]),null);}else{var _0x2b0de7='%'+_0x5c83da[_0xa627('0x3c')]+'%';_0x4b1bc8[_0xa627('0x44')][_0x115460](_0xa627('0x46'),_0x2b0de7,_0x2b0de7,_0x2b0de7);}}else{_0x2b8c6b=_[_0xa627('0x37')](_0xc33377,['name','ContactId']);_0x5c83da['field']='ContactId';_0x3ebe47=as[_0xa627('0x38')](_0x2e04c2,_0x2b8c6b['type'],_0x5c83da);_0x4b1bc8[_0xa627('0x44')][_0x115460](_0x3ebe47[_0xa627('0x3a')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3b')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3d')]);}break;case'Tag':var _0xf52c38=_0x5c83da[_0xa627('0x3c')][_0xa627('0x43')](',')[_0xa627('0x47')](function(_0x5aa8aa){return Number(_0x5aa8aa);});var _0x4b67bc=parseTagParameter(_0xf52c38);_0x4b1bc8[_0xa627('0x48')][_0xa627('0x49')][_0xa627('0x3f')](_0x4b67bc);_0x4b1bc8[_0xa627('0x48')][_0xa627('0x4a')]=_0xf52c38;break;case _0xa627('0x4b'):if(_0x5c83da[_0xa627('0x41')]===_0xa627('0x42')){_0x4b1bc8[_0xa627('0x4c')][_0x115460](_0xa627('0x4d'),'%'+_0x5c83da['value']+'%',null);}else{_0x2b8c6b=_[_0xa627('0x37')](_0xc33377,['name',_0xa627('0x4e')]);_0x5c83da['field']=_0xa627('0x4e');_0x3ebe47=as[_0xa627('0x38')](_0x2e04c2,_0x2b8c6b[_0xa627('0x39')],_0x5c83da);_0x4b1bc8[_0xa627('0x4c')][_0x115460](_0x3ebe47[_0xa627('0x3a')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3b')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3d')]);}break;case'body':case _0xa627('0x4f'):_0x3ebe47=as[_0xa627('0x38')]('me',null,_0x5c83da);_0x4b1bc8[_0xa627('0x50')][_0x115460](_0x3ebe47[_0xa627('0x3a')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3b')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3d')]);break;}}}return _0x4b1bc8;}function parseModelFields(_0x30d551,_0x38e555,_0x42daf3){var _0x251478=utils[_0xa627('0x4')](_0x30d551);var _0x3893ea=squel[_0xa627('0x21')]();var _0x360878=_(_0x38e555)[_0xa627('0x51')]()[_0xa627('0x47')](function(_0x4224ab){return _[_0xa627('0x52')](_0x42daf3,[_0xa627('0xa'),_0x4224ab])?_0x4224ab:undefined;})[_0xa627('0x53')]()[_0xa627('0x3c')]();if(_0x360878[_0xa627('0x13')]>0x0){_0x360878[_0xa627('0x23')](function(_0x104913){if(_0x104913===_0x251478){_0x3893ea[_0xa627('0x3f')]('i.'+_0x251478+_0xa627('0x16'),[]['concat'](_0x38e555[_0x104913]));}else if(_0x104913===_0xa627('0x54')){var _0x470256=JSON[_0xa627('0x55')](_0x38e555[_0x104913])['$gte'];var _0x21b029=JSON[_0xa627('0x55')](_0x38e555[_0x104913])[_0xa627('0x56')];_0x3893ea[_0xa627('0x3f')](_0xa627('0x57'),_0x470256,_0x21b029);}else{if(_0x38e555[_0x104913]===_0xa627('0x58')){_0x3893ea[_0xa627('0x3f')]('i.'+_0x104913+'\x20IS\x20NULL');}else{_0x3893ea[_0xa627('0x3f')]('i.'+_0x104913+'\x20=\x20?',_0x38e555[_0x104913]);}}});}return _0x3893ea;}function parseQueryParameters(_0x322027,_0x154c3d,_0x494c91){var _0x145580=getSqlClauses();return Promise[_0xa627('0x59')]()[_0xa627('0x5a')](function(){return parseModelFields(_0x322027,_0x154c3d,_0x494c91);})[_0xa627('0x5a')](function(_0x30f56b){_0x145580[_0xa627('0x5b')]['and'](_0x30f56b);return parseReadParameter(_0x154c3d[_0xa627('0x5c')]);})[_0xa627('0x5a')](function(_0x557b30){_0x145580[_0xa627('0x5c')]['and'](_0x557b30);return parseTagParameter(_0x154c3d[_0xa627('0x5d')]);})[_0xa627('0x5a')](function(_0x1bbe8c){_0x145580[_0xa627('0x48')]['clause'][_0xa627('0x3f')](_0x1bbe8c);return parseSearchFilter(_0x322027,_0x154c3d[_0xa627('0x5e')]);})[_0xa627('0x5a')](function(_0x39d970){_0x145580[_0xa627('0x5e')]=_0x39d970;return _0x145580;});}function checkAccountsRestrictions(_0x2535fc,_0x4d89a6,_0x67d7f9){var _0x3efa95=utils[_0xa627('0x4')](_0x2535fc);var _0x2776b7=_0xa627('0x5f')+_[_0xa627('0x60')](_0x2535fc)+(_0x2535fc===_0xa627('0x61')?_0xa627('0x62'):_0xa627('0x63'));var _0x1ef3c1=squel[_0xa627('0x21')]();return Promise[_0xa627('0x59')]()[_0xa627('0x5a')](function(){if(_0x67d7f9[_0xa627('0x7')]&&_0x4d89a6[_0xa627('0x5')]===_0xa627('0x6')){return _0x4d89a6[_0x2776b7]({'attributes':['id'],'raw':!![]});}})[_0xa627('0x5a')](function(_0x12974c){if(_0x12974c){if(_0x12974c['length']===0x0){_0x1ef3c1[_0xa627('0x3f')]('i.'+_0x3efa95+_0xa627('0x64'));}else{_0x1ef3c1['and']('i.'+_0x3efa95+_0xa627('0x16'),_[_0xa627('0x47')](_0x12974c,'id'));}}else if(!_0x67d7f9[_0x3efa95]){_0x1ef3c1[_0xa627('0x3f')]('i.'+_0x3efa95+_0xa627('0x65'));}})[_0xa627('0x5a')](function(){return _0x1ef3c1;});}function getClosedOrderClause(_0x3ff420,_0x2a2bcb){var _0x505a25='';var _0x94be6=[_0xa627('0x66'),_0xa627('0x67'),_0xa627('0x68')];if(_0x3ff420===_0xa627('0x2d')){_0x94be6[_0xa627('0x69')](_0xa627('0x6a'));}if(_0x2a2bcb[_0xa627('0x6b')]==='0'&&_0x3ff420==='mail'){_0x505a25=_0xa627('0x6a');}else{if(_0x2a2bcb[_0xa627('0x6b')]==='1'){_0x94be6['shift']();}_0x505a25=_0xa627('0x6c')+_0x94be6[_0xa627('0x6d')](',\x20')+')';}return _0x505a25;}function getFilteredInteractions(_0x295c7,_0x46aaa5,_0x2674cd,_0x197a13){var _0x11b8e9=utils[_0xa627('0x17')](_0x295c7);var _0x17ea9a=_[_0xa627('0x60')](_0x295c7)+_0xa627('0x6e');var _0x1a7972=[];var _0x127e07=getTagsQuery();var _0x2aa193={'type':db[_0xa627('0x6f')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3f3f02=[];var _0x42084b=[];return db[_0xa627('0x70')][_0xa627('0x71')](_0x127e07[_0xa627('0x72')](),_0x2aa193)[_0xa627('0x5a')](function(_0x41af39){_0x1a7972=_[_0xa627('0x73')](_0x41af39,'id');_0x2aa193=_[_0xa627('0x74')](_0x2aa193,{'model':db[_0x17ea9a],'mapToModel':!![],'nest':!![]});if(_0x2674cd['fields']){_0x197a13['attributes'][_0xa627('0x23')](function(_0x177a6e){_0x46aaa5[_0xa627('0x9')]('i.'+_0x177a6e);});}else{_0x46aaa5[_0xa627('0x9')](_0xa627('0x75'),'unreadMessages');_0x46aaa5[_0xa627('0x9')](_0xa627('0x76'),'Account.key');_0x46aaa5['field'](_0xa627('0x77'),'Account.mandatoryDisposition');if(_0x295c7===_0xa627('0x2d')){_0x46aaa5[_0xa627('0x9')]('a.email','Account.email');_0x46aaa5[_0xa627('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xa627('0x78'));_0x46aaa5['field'](_0xa627('0x79'));_0x46aaa5[_0xa627('0x9')]('i.createdAt');_0x46aaa5['field']('i.updatedAt');_0x46aaa5['field']('i.closed');_0x46aaa5[_0xa627('0x9')](_0xa627('0x7a'));_0x46aaa5['field'](_0xa627('0x7b'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x7c'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x7d'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x7e'));_0x46aaa5['field'](_0xa627('0x68'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x67'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x66'));_0x46aaa5[_0xa627('0x9')]('i.substatus');_0x46aaa5[_0xa627('0x9')]('i.to');_0x46aaa5['field'](_0xa627('0x7f'));_0x46aaa5[_0xa627('0x9')]('i.MailAccountId');_0x46aaa5[_0xa627('0x9')](_0xa627('0x80'));}else if(_0x295c7==='openchannel'){_0x46aaa5['field']('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',_0xa627('0x78'));}else{_0x46aaa5[_0xa627('0x9')](_0xa627('0x81'),_0xa627('0x78'));}if(_0x295c7!==_0xa627('0x2d')){_0x46aaa5[_0xa627('0x9')](_0xa627('0x82'));}_0x46aaa5[_0xa627('0x9')](_0xa627('0x83'),_0xa627('0x84'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x85'),_0xa627('0x86'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x87'),_0xa627('0x88'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x89'),_0xa627('0x8a'));_0x46aaa5['field'](_0xa627('0x8b'),'Contact.mobile');_0x46aaa5[_0xa627('0x9')]('c.fax',_0xa627('0x8c'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x8d'),_0xa627('0x8e'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x8f'),_0xa627('0x90'));_0x46aaa5['field'](_0xa627('0x91'),_0xa627('0x92'));}if(_0x197a13[_0xa627('0x93')]){_0x46aaa5[_0xa627('0x93')](_0x197a13[_0xa627('0x93')]);}if(_0x197a13[_0xa627('0x94')]){_0x46aaa5[_0xa627('0x94')](_0x197a13[_0xa627('0x94')]);}return db[_0xa627('0x70')][_0xa627('0x71')](_0x46aaa5['toString'](),_0x2aa193);})[_0xa627('0x5a')](function(_0x44bf39){_0x3f3f02=_0x44bf39;var _0xf3b2ab=getUsersQuery(_0x295c7,_0x3f3f02);return db['sequelize'][_0xa627('0x71')](_0xf3b2ab[_0xa627('0x72')](),_0x2aa193);})[_0xa627('0x5a')](function(_0x16be91){_0x42084b=_[_0xa627('0x95')](_0x16be91,_0x11b8e9);if(_0x295c7===_0xa627('0x2d')){return db[_0xa627('0x96')][_0xa627('0x97')]({'attributes':[_0xa627('0x98')],'raw':!![]});}})[_0xa627('0x5a')](function(_0x30a5e6){var _0x2c8ea8=_0x30a5e6?_0x30a5e6['enableEmailPreview']:undefined;var _0x32452a=_0x3f3f02['map'](function(_0x398bd3){return updateInteraction(_0x398bd3,_0x1a7972,_0x42084b,_0x2c8ea8);});return Promise['all'](_0x32452a);});}function countFilteredInteractions(_0x5a5adc,_0x214f93){var _0x38048d=_0x5a5adc[_0xa627('0x99')]();_0x38048d[_0xa627('0x9')](_0xa627('0x9a'));_0x38048d[_0xa627('0x9')](_0xa627('0x75'),_0xa627('0x3e'));var _0x2fe525=utils[_0xa627('0x22')](_0x214f93);if(!_[_0xa627('0x9b')](_0x2fe525)){_0x38048d[_0xa627('0x14')]('t.id\x20IN\x20?',_0x2fe525);}var _0x2a30fe={'type':db['Sequelize']['QueryTypes'][_0xa627('0x9c')],'raw':!![]};return db[_0xa627('0x70')]['query'](_0x38048d[_0xa627('0x72')](),_0x2a30fe);}module[_0xa627('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 15f9120..5eda7b0 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72f6=['waiting','talking','answered','abandoned','total','closed','disposition','unmanaged','UserId','findOne','out','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Users','TagIds','lodash','map','fullname','split','push'];(function(_0x1fec1e,_0xce18d2){var _0x31f9ec=function(_0x347a9a){while(--_0x347a9a){_0x1fec1e['push'](_0x1fec1e['shift']());}};_0x31f9ec(++_0xce18d2);}(_0x72f6,0x133));var _0x672f=function(_0x10779c,_0x22d624){_0x10779c=_0x10779c-0x0;var _0x147632=_0x72f6[_0x10779c];return _0x147632;};'use strict';var _=require(_0x672f('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x36440a,_0x22b076){return new Promise(function(_0x36d9d5,_0x13673c){try{var _0x4b06ef=[];if(_0x22b076[_0x36440a]){_0x4b06ef=_0x22b076[_0x36440a][_0x672f('0x1')](function(_0x585d29){return{'id':_0x585d29['id'],'fullname':_0x585d29[_0x672f('0x2')]};});}return _0x36d9d5(_0x4b06ef);}catch(_0x5e356e){_0x13673c(_0x5e356e);}});}function getInteractionTags(_0x16c24b,_0x46d8d6){var _0x71cb3b=[];if(_0x16c24b){_0x16c24b[_0x672f('0x3')](',')['forEach'](function(_0x23acf4){_0x71cb3b[_0x672f('0x4')](_0x46d8d6[_0x23acf4]);});}return _0x71cb3b;}function updateWaitingCounter(_0x485fba){if(_0x485fba[_0x672f('0x5')]){_0x485fba[_0x672f('0x5')]-=0x1;}}function updateInteractionCounters(_0x1b2656){_0x1b2656['waiting']=0x0;_0x1b2656[_0x672f('0x6')]=0x0;_0x1b2656[_0x672f('0x7')]=0x0;_0x1b2656['unmanaged']=0x0;_0x1b2656[_0x672f('0x8')]=0x0;_0x1b2656[_0x672f('0x9')]=0x0;if(_0x1b2656[_0x672f('0xa')]){if(_0x1b2656[_0x672f('0xb')]===_0x672f('0x8')){_0x1b2656['abandoned']+=0x1;updateWaitingCounter(_0x1b2656);}if(_0x1b2656['UserId']){_0x1b2656[_0x672f('0x7')]+=0x1;if(_0x1b2656[_0x672f('0x6')]){_0x1b2656[_0x672f('0x6')]-=0x1;}}else{if(_0x1b2656['disposition']){_0x1b2656[_0x672f('0xc')]+=0x1;updateWaitingCounter(_0x1b2656);}}}else{if(!_0x1b2656[_0x672f('0xd')]){_0x1b2656['waiting']+=0x1;}if(_0x1b2656[_0x672f('0xd')]){_0x1b2656[_0x672f('0x6')]+=0x1;updateWaitingCounter(_0x1b2656);}}_0x1b2656[_0x672f('0x9')]+=0x1;return _0x1b2656;}function getLastMessageText(_0x5a8a0a){return db['MailMessage'][_0x672f('0xe')]({'where':{'$and':[{'MailInteractionId':_0x5a8a0a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x672f('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x672f('0x10')],'order':_0x672f('0x11'),'raw':!![]})[_0x672f('0x12')](function(_0x54d444){if(_0x54d444&&_0x54d444['plainBody']){_0x5a8a0a[_0x672f('0x13')]=_[_0x672f('0x14')](_0x54d444[_0x672f('0x10')]);}return _0x5a8a0a;})['catch'](function(_0x353d75){throw _0x353d75;});}exports[_0x672f('0x15')]=function(_0xf69435,_0x13b040,_0x3db311,_0x5ad34c){return new Promise(function(_0x5dc9c5,_0x2a689a){return getInteractionUsers(_0xf69435['id'],_0x3db311)[_0x672f('0x12')](function(_0x4f0705){_0xf69435[_0x672f('0x16')]=_0x4f0705;return getInteractionTags(_0xf69435[_0x672f('0x17')],_0x13b040);})[_0x672f('0x12')](function(_0x3ff62e){_0xf69435['Tags']=_0x3ff62e;delete _0xf69435[_0x672f('0x17')];return updateInteractionCounters(_0xf69435);})[_0x672f('0x12')](function(_0x5cedda){if(_0x5ad34c){return getLastMessageText(_0x5cedda);}else{return _0x5cedda;}})[_0x672f('0x12')](function(_0x1116e6){_0x5dc9c5(_0x1116e6);})['catch'](function(_0x480b5a){_0x2a689a(_0x480b5a);});});}; \ No newline at end of file +var _0x0f07=['lodash','../../mysqldb','map','fullname','split','forEach','waiting','talking','answered','unmanaged','total','closed','abandoned','UserId','disposition','MailMessage','findOne','out','plainBody','then','trimStart','Users','TagIds','Tags','catch'];(function(_0x517ba8,_0x18537d){var _0x6ad1=function(_0x308ef0){while(--_0x308ef0){_0x517ba8['push'](_0x517ba8['shift']());}};_0x6ad1(++_0x18537d);}(_0x0f07,0x113));var _0x70f0=function(_0x19b122,_0x1e76ee){_0x19b122=_0x19b122-0x0;var _0x2134ac=_0x0f07[_0x19b122];return _0x2134ac;};'use strict';var _=require(_0x70f0('0x0'));var db=require(_0x70f0('0x1'))['db'];function getInteractionUsers(_0x13b71e,_0x432b6c){return new Promise(function(_0x5238b3,_0x21f70f){try{var _0x319dcc=[];if(_0x432b6c[_0x13b71e]){_0x319dcc=_0x432b6c[_0x13b71e][_0x70f0('0x2')](function(_0x1e64a0){return{'id':_0x1e64a0['id'],'fullname':_0x1e64a0[_0x70f0('0x3')]};});}return _0x5238b3(_0x319dcc);}catch(_0xb85607){_0x21f70f(_0xb85607);}});}function getInteractionTags(_0x224c17,_0x94f109){var _0x2d1d3b=[];if(_0x224c17){_0x224c17[_0x70f0('0x4')](',')[_0x70f0('0x5')](function(_0x52afb4){_0x2d1d3b['push'](_0x94f109[_0x52afb4]);});}return _0x2d1d3b;}function updateWaitingCounter(_0x180551){if(_0x180551['waiting']){_0x180551[_0x70f0('0x6')]-=0x1;}}function updateInteractionCounters(_0x47e80b){_0x47e80b[_0x70f0('0x6')]=0x0;_0x47e80b[_0x70f0('0x7')]=0x0;_0x47e80b[_0x70f0('0x8')]=0x0;_0x47e80b[_0x70f0('0x9')]=0x0;_0x47e80b['abandoned']=0x0;_0x47e80b[_0x70f0('0xa')]=0x0;if(_0x47e80b[_0x70f0('0xb')]){if(_0x47e80b['disposition']===_0x70f0('0xc')){_0x47e80b[_0x70f0('0xc')]+=0x1;updateWaitingCounter(_0x47e80b);}if(_0x47e80b[_0x70f0('0xd')]){_0x47e80b[_0x70f0('0x8')]+=0x1;if(_0x47e80b[_0x70f0('0x7')]){_0x47e80b[_0x70f0('0x7')]-=0x1;}}else{if(_0x47e80b[_0x70f0('0xe')]){_0x47e80b[_0x70f0('0x9')]+=0x1;updateWaitingCounter(_0x47e80b);}}}else{if(!_0x47e80b[_0x70f0('0xd')]){_0x47e80b[_0x70f0('0x6')]+=0x1;}if(_0x47e80b['UserId']){_0x47e80b['talking']+=0x1;updateWaitingCounter(_0x47e80b);}}_0x47e80b[_0x70f0('0xa')]+=0x1;return _0x47e80b;}function getLastMessageText(_0x4831bb){return db[_0x70f0('0xf')][_0x70f0('0x10')]({'where':{'$and':[{'MailInteractionId':_0x4831bb['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x70f0('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x70f0('0x12')],'order':'-id','raw':!![]})[_0x70f0('0x13')](function(_0xb3ebfd){if(_0xb3ebfd&&_0xb3ebfd[_0x70f0('0x12')]){_0x4831bb['lastMsgText']=_[_0x70f0('0x14')](_0xb3ebfd[_0x70f0('0x12')]);}return _0x4831bb;})['catch'](function(_0x4cb888){throw _0x4cb888;});}exports['updateInteraction']=function(_0x1efd66,_0x5a207e,_0x389e35,_0x435bb1){return new Promise(function(_0x49eb82,_0x3834f3){return getInteractionUsers(_0x1efd66['id'],_0x389e35)[_0x70f0('0x13')](function(_0x524e42){_0x1efd66[_0x70f0('0x15')]=_0x524e42;return getInteractionTags(_0x1efd66[_0x70f0('0x16')],_0x5a207e);})[_0x70f0('0x13')](function(_0x3218b5){_0x1efd66[_0x70f0('0x17')]=_0x3218b5;delete _0x1efd66[_0x70f0('0x16')];return updateInteractionCounters(_0x1efd66);})[_0x70f0('0x13')](function(_0x5d0c69){if(_0x435bb1){return getLastMessageText(_0x5d0c69);}else{return _0x5d0c69;}})[_0x70f0('0x13')](function(_0xa5a287){_0x49eb82(_0xa5a287);})[_0x70f0('0x18')](function(_0x5b6d43){_0x3834f3(_0x5b6d43);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 911d729..cd76e31 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6463=['isArray','toUpperCase','role','stringify','null','Interaction','findOne','then','update','info','error','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_messages','user_has_'];(function(_0x16be20,_0x3f7898){var _0x38f195=function(_0x2bdad1){while(--_0x2bdad1){_0x16be20['push'](_0x16be20['shift']());}};_0x38f195(++_0x3f7898);}(_0x6463,0x1bb));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x3646('0x0')),'mail':require(_0x3646('0x1'))(_0x3646('0x2')),'fax':require(_0x3646('0x1'))('fax-interactions'),'sms':require(_0x3646('0x1'))(_0x3646('0x3')),'chat':require(_0x3646('0x1'))('chat-interactions'),'whatsapp':require(_0x3646('0x1'))(_0x3646('0x4'))};function getAccountFK(_0x5ec104){return _[_0x3646('0x5')](_0x5ec104)+(_0x5ec104===_0x3646('0x6')?_0x3646('0x7'):_0x3646('0x8'))+'Id';}function getInteractionFK(_0x4cd106){return _['capitalize'](_0x4cd106)+_0x3646('0x9');}function getInteractionId(_0x1a6756,_0x2b794b,_0x6a638a){if(_0x1a6756&&_0x1a6756[_[_0x3646('0xa')](_0x6a638a)+_0x3646('0x9')]){return _0x1a6756[_[_0x3646('0xa')](_0x6a638a)+'InteractionId'];}else if(_0x1a6756&&_0x1a6756['id']){return _0x1a6756['id'];}else if(_0x2b794b&&_0x2b794b['id']){return _0x2b794b['id'];}else{return _0x3646('0xb');}}function getInteractionsTables(_0x374e99){return{'accounts':_0x374e99+'_'+(_0x374e99==='chat'?'websites':_0x3646('0xc')),'interactions':_0x374e99+_0x3646('0xd'),'interactionsTags':_0x374e99+'_interaction_has_tags','messages':_0x374e99+_0x3646('0xe'),'userInteractions':_0x3646('0xf')+_0x374e99+_0x3646('0xd')};}function getSelectedTags(_0x542f2d){var _0x133355=[];if(_0x542f2d){_0x133355=Array[_0x3646('0x10')](_0x542f2d)?_0x542f2d:[_0x542f2d];}return _0x133355;}function log(_0x1c6687,_0x47beb4,_0x471363,_0x5cfe2d,_0x190d84,_0xde3818){loggers[_0x190d84['toLowerCase']()][_0x1c6687]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xde3818[_0x3646('0x11')](),_0x47beb4?_0x47beb4['id']:null,_0x47beb4?_0x47beb4['name']:null,_0x47beb4?_0x47beb4[_0x3646('0x12')]:null,getInteractionId(_0x471363,_0x5cfe2d,_0x190d84),_0x471363?JSON[_0x3646('0x13')](_0x471363):_0x3646('0x14'));}function updateUser(_0x2943a1,_0x3aeda2,_0x32dd1a,_0x5b4644,_0x3db86b){db[_['upperFirst'](_0x5b4644)+_0x3646('0x15')][_0x3646('0x16')]({'where':{'id':getInteractionId(_0x3aeda2,_0x32dd1a,_0x5b4644)}})[_0x3646('0x17')](function(_0x49a0cb){if(_0x49a0cb){return _0x49a0cb[_0x3646('0x18')]({'UserId':_0x2943a1?_0x2943a1['id']:null});}})[_0x3646('0x17')](function(_0x28d2e6){if(_0x28d2e6){log(_0x3646('0x19'),_0x2943a1,_0x3aeda2,_0x32dd1a,_0x5b4644,_0x3db86b);}})['catch'](function(){log(_0x3646('0x1a'),_0x2943a1,_0x3aeda2,_0x32dd1a,_0x5b4644,_0x3db86b);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xb7b3=['findOne','then','update','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','InteractionId','upperFirst','unknown','chat','_interactions','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','null'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xb7b3,0xdc));var _0x3b7b=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xb7b3[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x3b7b('0x0'));var db=require(_0x3b7b('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x3b7b('0x2')),'mail':require(_0x3b7b('0x3'))(_0x3b7b('0x4')),'fax':require(_0x3b7b('0x3'))(_0x3b7b('0x5')),'sms':require(_0x3b7b('0x3'))('sms-interactions'),'chat':require(_0x3b7b('0x3'))(_0x3b7b('0x6')),'whatsapp':require(_0x3b7b('0x3'))(_0x3b7b('0x7'))};function getAccountFK(_0x504584){return _[_0x3b7b('0x8')](_0x504584)+(_0x504584==='chat'?_0x3b7b('0x9'):'Account')+'Id';}function getInteractionFK(_0x39a065){return _[_0x3b7b('0x8')](_0x39a065)+_0x3b7b('0xa');}function getInteractionId(_0x297865,_0x1c4869,_0xe71c31){if(_0x297865&&_0x297865[_[_0x3b7b('0xb')](_0xe71c31)+'InteractionId']){return _0x297865[_[_0x3b7b('0xb')](_0xe71c31)+_0x3b7b('0xa')];}else if(_0x297865&&_0x297865['id']){return _0x297865['id'];}else if(_0x1c4869&&_0x1c4869['id']){return _0x1c4869['id'];}else{return _0x3b7b('0xc');}}function getInteractionsTables(_0x62c7bc){return{'accounts':_0x62c7bc+'_'+(_0x62c7bc===_0x3b7b('0xd')?'websites':'accounts'),'interactions':_0x62c7bc+_0x3b7b('0xe'),'interactionsTags':_0x62c7bc+'_interaction_has_tags','messages':_0x62c7bc+'_messages','userInteractions':_0x3b7b('0xf')+_0x62c7bc+_0x3b7b('0xe')};}function getSelectedTags(_0x46f55c){var _0x194365=[];if(_0x46f55c){_0x194365=Array[_0x3b7b('0x10')](_0x46f55c)?_0x46f55c:[_0x46f55c];}return _0x194365;}function log(_0x179085,_0x123e16,_0xf250c2,_0x505447,_0x2a5e20,_0x43f9db){loggers[_0x2a5e20[_0x3b7b('0x11')]()][_0x179085]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x43f9db[_0x3b7b('0x12')](),_0x123e16?_0x123e16['id']:null,_0x123e16?_0x123e16[_0x3b7b('0x13')]:null,_0x123e16?_0x123e16[_0x3b7b('0x14')]:null,getInteractionId(_0xf250c2,_0x505447,_0x2a5e20),_0xf250c2?JSON[_0x3b7b('0x15')](_0xf250c2):_0x3b7b('0x16'));}function updateUser(_0x5b7976,_0x491cbf,_0x5a39c9,_0x5a319c,_0x538310){db[_[_0x3b7b('0xb')](_0x5a319c)+'Interaction'][_0x3b7b('0x17')]({'where':{'id':getInteractionId(_0x491cbf,_0x5a39c9,_0x5a319c)}})[_0x3b7b('0x18')](function(_0xecade8){if(_0xecade8){return _0xecade8[_0x3b7b('0x19')]({'UserId':_0x5b7976?_0x5b7976['id']:null});}})[_0x3b7b('0x18')](function(_0x436968){if(_0x436968){log('info',_0x5b7976,_0x491cbf,_0x5a39c9,_0x5a319c,_0x538310);}})['catch'](function(){log('error',_0x5b7976,_0x491cbf,_0x5a39c9,_0x5a319c,_0x538310);});}module[_0x3b7b('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index fed97e2..7c26d76 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3a5=['user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','format','%s:%s:%s','base64','utf8','final','parse','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User'];(function(_0x40412a,_0xd7d49){var _0x369d36=function(_0x325cb4){while(--_0x325cb4){_0x40412a['push'](_0x40412a['shift']());}};_0x369d36(++_0xd7d49);}(_0xd3a5,0x1cd));var _0x5d3a=function(_0x12dc45,_0x388e68){_0x12dc45=_0x12dc45-0x0;var _0x3691e4=_0xd3a5[_0x12dc45];return _0x3691e4;};'use strict';var crypto=require(_0x5d3a('0x0'));var util=require(_0x5d3a('0x1'));var compose=require(_0x5d3a('0x2'));var db=require(_0x5d3a('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2e5d9c,_0x33da22){if(_0x2e5d9c&&_0x33da22){if(_0x33da22[_0x5d3a('0x4')]&&_0x33da22[_0x5d3a('0x5')]){var _0x568955=_0x33da22['data1'];var _0x5a365c=_0x33da22[_0x5d3a('0x5')];var _0x500562=_0x568955['split']('-')[0x4];var _0x253353=_0x568955[_0x5d3a('0x6')]('-')[0x0];var _0x3bb5a3=crypto[_0x5d3a('0x7')]('aes-256-ctr',util[_0x5d3a('0x8')](_0x5d3a('0x9'),_0x500562,_0x568955,_0x253353));var _0x503055=_0x3bb5a3['update'](_0x5a365c,_0x5d3a('0xa'),_0x5d3a('0xb'));_0x503055+=_0x3bb5a3[_0x5d3a('0xc')](_0x5d3a('0xb'));var _0x44830f=JSON[_0x5d3a('0xd')](_0x503055);return _0x44830f['hasOwnProperty'](_0x2e5d9c)?_0x44830f[_0x2e5d9c]:null;}}return null;}function isLimit(_0x45f1c9,_0x2ad0fb,_0x42a27d,_0x4985ae){var _0x20e3d5=_0x2ad0fb;return compose()[_0x5d3a('0xe')](function(_0x38cacb,_0x1d6f7d,_0x44e993){return db[_0x5d3a('0xf')][_0x5d3a('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x5d3a('0x11')](function(_0x5755c0){var _0x1738bd=getValueFromLicense(_0x45f1c9,_0x5755c0);return _0x1738bd?_0x1738bd:_0x20e3d5;})[_0x5d3a('0x11')](function(_0x459f78){_0x20e3d5=_0x459f78;return _0x42a27d[_0x5d3a('0x12')](_0x4985ae);})[_0x5d3a('0x11')](function(_0x27d7e2){if(_0x27d7e2>=_0x20e3d5){return _0x1d6f7d[_0x5d3a('0x13')](0x193)[_0x5d3a('0x14')]({'message':util[_0x5d3a('0x8')](_0x5d3a('0x15'),_0x45f1c9)});}_0x44e993();})[_0x5d3a('0x16')](function(_0x4e1aa5){_0x44e993(_0x4e1aa5);});});}function isUserLimit(){return isLimit(_0x5d3a('0x17'),0x1,db[_0x5d3a('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0x5d3a('0x19')}]}});}exports[_0x5d3a('0x1a')]=isUserLimit; \ No newline at end of file +var _0x2ab6=['catch','User','admin','user','isUserLimit','crypto','../../mysqldb','../../config/environment','data1','license','split','createDecipher','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','format'];(function(_0x307b12,_0xa3111a){var _0x289091=function(_0x100d93){while(--_0x100d93){_0x307b12['push'](_0x307b12['shift']());}};_0x289091(++_0xa3111a);}(_0x2ab6,0x10d));var _0x62ab=function(_0x1448d0,_0x26e95a){_0x1448d0=_0x1448d0-0x0;var _0xc68ee1=_0x2ab6[_0x1448d0];return _0xc68ee1;};'use strict';var crypto=require(_0x62ab('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x62ab('0x1'))['db'];var config=require(_0x62ab('0x2'));function getValueFromLicense(_0x94cb78,_0x18969e){if(_0x94cb78&&_0x18969e){if(_0x18969e[_0x62ab('0x3')]&&_0x18969e[_0x62ab('0x4')]){var _0x3df340=_0x18969e[_0x62ab('0x3')];var _0x37050d=_0x18969e[_0x62ab('0x4')];var _0x310ea6=_0x3df340['split']('-')[0x4];var _0x1807fc=_0x3df340[_0x62ab('0x5')]('-')[0x0];var _0x4a2b6a=crypto[_0x62ab('0x6')]('aes-256-ctr',util['format']('%s:%s:%s',_0x310ea6,_0x3df340,_0x1807fc));var _0x3ad465=_0x4a2b6a[_0x62ab('0x7')](_0x37050d,_0x62ab('0x8'),_0x62ab('0x9'));_0x3ad465+=_0x4a2b6a[_0x62ab('0xa')](_0x62ab('0x9'));var _0x11efd5=JSON[_0x62ab('0xb')](_0x3ad465);return _0x11efd5[_0x62ab('0xc')](_0x94cb78)?_0x11efd5[_0x94cb78]:null;}}return null;}function isLimit(_0xfb5331,_0x85e4d,_0x40750a,_0x20e88e){var _0x30c657=_0x85e4d;return compose()[_0x62ab('0xd')](function(_0x435afc,_0x542354,_0xc1cb71){return db[_0x62ab('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x62ab('0xf')](function(_0x1ae2ff){var _0x2ed1b6=getValueFromLicense(_0xfb5331,_0x1ae2ff);return _0x2ed1b6?_0x2ed1b6:_0x30c657;})['then'](function(_0x34019c){_0x30c657=_0x34019c;return _0x40750a[_0x62ab('0x10')](_0x20e88e);})[_0x62ab('0xf')](function(_0x3d316e){if(_0x3d316e>=_0x30c657){return _0x542354[_0x62ab('0x11')](0x193)['json']({'message':util[_0x62ab('0x12')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0xfb5331)});}_0xc1cb71();})[_0x62ab('0x13')](function(_0x233a44){_0xc1cb71(_0x233a44);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x62ab('0x14')],{'where':{'$or':[{'role':_0x62ab('0x15')},{'role':_0x62ab('0x16')}]}});}exports[_0x62ab('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index bd2b518..adeb941 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 _0xcf0b=['lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','operator','value','includes','$gt','$lte','format','YYYY-MM-DD','castTo','CAST(','field','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$lt','<\x20?','<=\x20?','$gte','>=\x20?','$between','start','$startsWith','$endsWith','pop','utcOffset','add','hours','minutes','seconds'];(function(_0x2e50e4,_0xc9271e){var _0x1ccb48=function(_0x496ab7){while(--_0x496ab7){_0x2e50e4['push'](_0x2e50e4['shift']());}};_0x1ccb48(++_0xc9271e);}(_0xcf0b,0x156));var _0xbcf0=function(_0x123824,_0x52a5c7){_0x123824=_0x123824-0x0;var _0x1421eb=_0xcf0b[_0x123824];return _0x1421eb;};'use strict';var _=require(_0xbcf0('0x0'));var moment=require(_0xbcf0('0x1'));exports[_0xbcf0('0x2')]=function(_0xff0dd7){var _0x38683a={'conditions':[]};_0x38683a[_0xbcf0('0x3')]=_[_0xbcf0('0x4')](_0xff0dd7,_0xbcf0('0x5'))?'or':_0xbcf0('0x6');var _0x491ded=_0xff0dd7[_0xbcf0('0x7')](_0xbcf0('0x8'),'')[_0xbcf0('0x7')](_0xbcf0('0x5'),'')[_0xbcf0('0x9')]('||');for(var _0x14aed=0x0;_0x14aed<_0x491ded[_0xbcf0('0xa')];_0x14aed++){var _0x500c58=_0x491ded[_0x14aed][_0xbcf0('0x9')](':=');var _0x6f9a96=_0x500c58[0x0];var _0x14b44e=_0x500c58[_0xbcf0('0xb')](0x1);_0x14b44e[_0xbcf0('0xc')](function(_0x275387){var _0x3d3653=_0x275387[_0xbcf0('0x9')]('[')[_0xbcf0('0xd')]();var _0x403bb6=_0x275387[_0xbcf0('0xe')](/\[(.*?)\]/g);_0x403bb6[_0xbcf0('0xc')](function(_0x130159){var _0xa8ccf7=_0x130159[_0xbcf0('0x9')]('[')[_0xbcf0('0xf')](function(_0x30d265){return _0x30d265[_0xbcf0('0x10')](']')>-0x1;})[_0xbcf0('0x11')](function(_0x509280){return _0x509280[_0xbcf0('0x9')](']')[0x0];})[0x0];_0x38683a[_0xbcf0('0x12')][_0xbcf0('0x13')]({'field':_0x6f9a96,'operator':_0x3d3653,'value':_0xa8ccf7});});});}return _0x38683a;};exports['buildExpression']=function(_0xf8ba4c,_0x1d2cc0,_0x4fdb58){var _0x2b1991={};if(_0x1d2cc0===_0xbcf0('0x14')){if(_0x4fdb58[_0xbcf0('0x15')]==='$eq'){_0x4fdb58[_0xbcf0('0x15')]='$between';_0x4fdb58[_0xbcf0('0x16')]+=','+_0x4fdb58['value'];}else if(_[_0xbcf0('0x17')]([_0xbcf0('0x18'),_0xbcf0('0x19')],_0x4fdb58[_0xbcf0('0x15')])){_0x4fdb58[_0xbcf0('0x16')]=moment(_0x4fdb58['value'])['add'](0x1,'days')[_0xbcf0('0x1a')](_0xbcf0('0x1b'));}}if(_0x4fdb58[_0xbcf0('0x1c')]){_0x1d2cc0=_0x4fdb58[_0xbcf0('0x1c')];_0x2b1991['text']=_0xbcf0('0x1d')+_0xf8ba4c+'.'+_0x4fdb58[_0xbcf0('0x1e')]+'\x20AS\x20'+_0x4fdb58['castTo']+')\x20'+parseOperator(_0x4fdb58['operator']);}else{_0x2b1991['text']=_0xf8ba4c+'.'+_0x4fdb58['field']+'\x20'+parseOperator(_0x4fdb58[_0xbcf0('0x15')]);}if(_['includes']([_0xbcf0('0x1f'),_0xbcf0('0x20')],_0x4fdb58[_0xbcf0('0x15')]))_0x2b1991['text']='('+_0x2b1991[_0xbcf0('0x21')]+_0xbcf0('0x22')+_0xf8ba4c+'.'+_0x4fdb58[_0xbcf0('0x1e')]+_0xbcf0('0x23');_0x2b1991[_0xbcf0('0x16')]=parseValue(_0x1d2cc0,_0x4fdb58[_0xbcf0('0x15')],_0x4fdb58[_0xbcf0('0x16')]);return _0x2b1991;};function parseOperator(_0x4f9bb6){var _0x1bc729;switch(_0x4f9bb6){case _0xbcf0('0x24'):_0x1bc729=_0xbcf0('0x25');break;case _0xbcf0('0x20'):_0x1bc729=_0xbcf0('0x26');break;case'$eq':_0x1bc729=_0xbcf0('0x27');break;case _0xbcf0('0x1f'):_0x1bc729=_0xbcf0('0x28');break;case _0xbcf0('0x29'):case'$startsWith':case'$endsWith':_0x1bc729='LIKE\x20?';break;case _0xbcf0('0x2a'):_0x1bc729=_0xbcf0('0x2b');break;case'$gt':_0x1bc729='>\x20?';break;case _0xbcf0('0x19'):_0x1bc729=_0xbcf0('0x2c');break;case _0xbcf0('0x2d'):_0x1bc729=_0xbcf0('0x2e');break;case _0xbcf0('0x2f'):_0x1bc729='BETWEEN\x20?\x20AND\x20?';break;}return _0x1bc729;}function parseValue(_0x28b7c6,_0x17269c,_0x5f5a0f){var _0x34bc0b={'start':undefined,'end':undefined};switch(_0x17269c){case _0xbcf0('0x24'):case _0xbcf0('0x20'):_0x34bc0b[_0xbcf0('0x30')]=_0x5f5a0f[_0xbcf0('0x9')](',');break;case _0xbcf0('0x29'):_0x34bc0b[_0xbcf0('0x30')]='%'+_0x5f5a0f+'%';break;case _0xbcf0('0x31'):_0x34bc0b[_0xbcf0('0x30')]=_0x5f5a0f+'%';break;case _0xbcf0('0x32'):_0x34bc0b[_0xbcf0('0x30')]='%'+_0x5f5a0f;break;case'$between':var _0x46cbb1=_0x5f5a0f[_0xbcf0('0x9')](',');var _0x5f5a0f=_0x46cbb1[_0xbcf0('0xd')]();var _0x53f2f8=_0x46cbb1[_0xbcf0('0x33')]();if(_0x28b7c6===_0xbcf0('0x14')){_0x5f5a0f=moment(_0x5f5a0f)[_0xbcf0('0x34')](0x0,!![])[_0xbcf0('0x1a')]();_0x53f2f8=moment(_0x53f2f8)[_0xbcf0('0x34')](0x0,!![])[_0xbcf0('0x35')](0x17,_0xbcf0('0x36'))[_0xbcf0('0x35')](0x3b,_0xbcf0('0x37'))['add'](0x3b,_0xbcf0('0x38'))[_0xbcf0('0x1a')]();}_0x34bc0b={'start':_0x5f5a0f,'end':_0x53f2f8};break;default:_0x34bc0b['start']=_0x5f5a0f;break;}return _0x34bc0b;} \ No newline at end of file +var _0xd986=['castTo','text','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','minutes','lodash','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','add','days','format'];(function(_0x4d3ce1,_0x328866){var _0xfba003=function(_0x28ff8f){while(--_0x28ff8f){_0x4d3ce1['push'](_0x4d3ce1['shift']());}};_0xfba003(++_0x328866);}(_0xd986,0x123));var _0x6d98=function(_0x97de28,_0x243e31){_0x97de28=_0x97de28-0x0;var _0x17cd18=_0xd986[_0x97de28];return _0x17cd18;};'use strict';var _=require(_0x6d98('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x38b054){var _0x5359d8={'conditions':[]};_0x5359d8[_0x6d98('0x1')]=_[_0x6d98('0x2')](_0x38b054,_0x6d98('0x3'))?'or':_0x6d98('0x4');var _0x3abeaf=_0x38b054[_0x6d98('0x5')](_0x6d98('0x6'),'')[_0x6d98('0x5')](_0x6d98('0x3'),'')[_0x6d98('0x7')]('||');for(var _0x38785e=0x0;_0x38785e<_0x3abeaf[_0x6d98('0x8')];_0x38785e++){var _0x342fce=_0x3abeaf[_0x38785e][_0x6d98('0x7')](':=');var _0x1908aa=_0x342fce[0x0];var _0x11a3ba=_0x342fce[_0x6d98('0x9')](0x1);_0x11a3ba[_0x6d98('0xa')](function(_0x22ac4e){var _0x69c973=_0x22ac4e['split']('[')['shift']();var _0x219fe7=_0x22ac4e[_0x6d98('0xb')](/\[(.*?)\]/g);_0x219fe7[_0x6d98('0xa')](function(_0x5d5591){var _0x40f29f=_0x5d5591[_0x6d98('0x7')]('[')[_0x6d98('0xc')](function(_0x1490f3){return _0x1490f3[_0x6d98('0xd')](']')>-0x1;})[_0x6d98('0xe')](function(_0x2723b8){return _0x2723b8[_0x6d98('0x7')](']')[0x0];})[0x0];_0x5359d8[_0x6d98('0xf')][_0x6d98('0x10')]({'field':_0x1908aa,'operator':_0x69c973,'value':_0x40f29f});});});}return _0x5359d8;};exports[_0x6d98('0x11')]=function(_0x3ee859,_0x478bf9,_0x4ead59){var _0x11055d={};if(_0x478bf9===_0x6d98('0x12')){if(_0x4ead59[_0x6d98('0x13')]===_0x6d98('0x14')){_0x4ead59[_0x6d98('0x13')]='$between';_0x4ead59['value']+=','+_0x4ead59[_0x6d98('0x15')];}else if(_[_0x6d98('0x16')]([_0x6d98('0x17'),'$lte'],_0x4ead59[_0x6d98('0x13')])){_0x4ead59[_0x6d98('0x15')]=moment(_0x4ead59[_0x6d98('0x15')])[_0x6d98('0x18')](0x1,_0x6d98('0x19'))[_0x6d98('0x1a')]('YYYY-MM-DD');}}if(_0x4ead59[_0x6d98('0x1b')]){_0x478bf9=_0x4ead59[_0x6d98('0x1b')];_0x11055d[_0x6d98('0x1c')]='CAST('+_0x3ee859+'.'+_0x4ead59['field']+_0x6d98('0x1d')+_0x4ead59['castTo']+')\x20'+parseOperator(_0x4ead59[_0x6d98('0x13')]);}else{_0x11055d[_0x6d98('0x1c')]=_0x3ee859+'.'+_0x4ead59[_0x6d98('0x1e')]+'\x20'+parseOperator(_0x4ead59['operator']);}if(_['includes']([_0x6d98('0x1f'),_0x6d98('0x20')],_0x4ead59[_0x6d98('0x13')]))_0x11055d[_0x6d98('0x1c')]='('+_0x11055d[_0x6d98('0x1c')]+_0x6d98('0x21')+_0x3ee859+'.'+_0x4ead59[_0x6d98('0x1e')]+_0x6d98('0x22');_0x11055d[_0x6d98('0x15')]=parseValue(_0x478bf9,_0x4ead59[_0x6d98('0x13')],_0x4ead59[_0x6d98('0x15')]);return _0x11055d;};function parseOperator(_0x2bc6f7){var _0x16e224;switch(_0x2bc6f7){case _0x6d98('0x23'):_0x16e224=_0x6d98('0x24');break;case'$notIn':_0x16e224='NOT\x20IN\x20?';break;case _0x6d98('0x14'):_0x16e224=_0x6d98('0x25');break;case _0x6d98('0x1f'):_0x16e224='<>\x20?';break;case _0x6d98('0x26'):case _0x6d98('0x27'):case _0x6d98('0x28'):_0x16e224='LIKE\x20?';break;case _0x6d98('0x29'):_0x16e224=_0x6d98('0x2a');break;case _0x6d98('0x17'):_0x16e224=_0x6d98('0x2b');break;case'$lte':_0x16e224=_0x6d98('0x2c');break;case _0x6d98('0x2d'):_0x16e224=_0x6d98('0x2e');break;case'$between':_0x16e224=_0x6d98('0x2f');break;}return _0x16e224;}function parseValue(_0x23eeb0,_0x400c2d,_0x4b69bd){var _0x5c88ba={'start':undefined,'end':undefined};switch(_0x400c2d){case _0x6d98('0x23'):case'$notIn':_0x5c88ba['start']=_0x4b69bd[_0x6d98('0x7')](',');break;case _0x6d98('0x26'):_0x5c88ba['start']='%'+_0x4b69bd+'%';break;case _0x6d98('0x27'):_0x5c88ba[_0x6d98('0x30')]=_0x4b69bd+'%';break;case _0x6d98('0x28'):_0x5c88ba['start']='%'+_0x4b69bd;break;case'$between':var _0x240cba=_0x4b69bd[_0x6d98('0x7')](',');var _0x4b69bd=_0x240cba[_0x6d98('0x31')]();var _0x118b02=_0x240cba['pop']();if(_0x23eeb0===_0x6d98('0x12')){_0x4b69bd=moment(_0x4b69bd)[_0x6d98('0x32')](0x0,!![])[_0x6d98('0x1a')]();_0x118b02=moment(_0x118b02)[_0x6d98('0x32')](0x0,!![])[_0x6d98('0x18')](0x17,_0x6d98('0x33'))[_0x6d98('0x18')](0x3b,_0x6d98('0x34'))[_0x6d98('0x18')](0x3b,'seconds')[_0x6d98('0x1a')]();}_0x5c88ba={'start':_0x4b69bd,'end':_0x118b02};break;default:_0x5c88ba[_0x6d98('0x30')]=_0x4b69bd;break;}return _0x5c88ba;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2a744d2..222da3f 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 _0xd881=['hasOwnProperty','nolimit','offset','order','where','filter','object','columns','value','merge','VIRTUAL','lower','options','include','lodash','moment','../../mysqldb','parse','includes','keys','model','alias','fields','raw','split','filters','isEmpty','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','isArray','limit','sort','map','indexOf','priority','cast','unsigned','substr','ASC','omit','length','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','join','getOptions','query','$id','intersection','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd881,0x182));var _0x1d88=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd881[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1d88('0x0'));var sequelize=require('sequelize');var moment=require(_0x1d88('0x1'));var db=require(_0x1d88('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x15f3c9){var _0x1577ce=['ne'];try{var _0x3ab373=JSON[_0x1d88('0x3')](_0x15f3c9);var _0x5afc73=Object['keys'](_0x3ab373)[0x0];return _0x1577ce[_0x1d88('0x4')](_0x5afc73);}catch(_0x11b44f){return![];}}function getOperatorValue(_0x2e8c29){var _0x32d763=JSON['parse'](_0x2e8c29);var _0x3aa622=Object[_0x1d88('0x5')](_0x32d763)[0x0];var _0x4f09c7=_0x32d763[_0x3aa622];return{['$'+_0x3aa622]:_0x4f09c7};}function parseIncludeModel(_0x35e35f){var _0x1ebd2d=JSON[_0x1d88('0x3')](_0x35e35f);return{'model':db[_0x1ebd2d[_0x1d88('0x6')]],'as':_0x1ebd2d[_0x1d88('0x7')],'attributes':_0x1ebd2d[_0x1d88('0x8')],'raw':_0x1ebd2d[_0x1d88('0x9')]};}exports[_0x1d88('0x8')]=function(_0x5be669){var _0x1bf57b=null;if(_0x5be669){_0x1bf57b=_0x5be669[_0x1d88('0xa')](',');}return _0x1bf57b;};exports[_0x1d88('0xb')]=function(_0x4bcc1e,_0x3de233){var _0x485406={};if(!_[_0x1d88('0xc')](_0x4bcc1e)){_['forOwn'](_0x4bcc1e,function(_0x50962e,_0x499ff3){try{if(_0x3de233){var _0xc2d0fb=_['find'](_0x3de233,{'name':_0x499ff3})||{};if(hasSequelizeOperator(_0x50962e)){_0x485406[_0x499ff3]=getOperatorValue(_0x50962e);}else if(_0xc2d0fb[_0x1d88('0xd')]===_0x1d88('0xe')&&_[_0x1d88('0xf')](_0x50962e)){var _0x32d9e1=JSON[_0x1d88('0x3')](_0x50962e);var _0x59dccd={'$gte':moment(moment(_0x32d9e1[_0x1d88('0x10')])[_0x1d88('0x11')](_0x1d88('0x12')))['utc']()[_0x1d88('0x11')](),'$lte':moment(moment(_0x32d9e1['$lte'])[_0x1d88('0x11')]('YYYY-MM-DD'))[_0x1d88('0x13')]()[_0x1d88('0x14')](0x1,'s')[_0x1d88('0x11')]()};_0x485406[_0x499ff3]=_0x59dccd;}else if(_0xc2d0fb[_0x1d88('0x15')]==='uniqueid'){_0x485406[_0x499ff3]=_0x50962e;}else{_0x485406[_0x499ff3]=_[_0x1d88('0x16')](_0x50962e)?_0x50962e:JSON[_0x1d88('0x3')](_0x50962e);}}else{_0x485406[_0x499ff3]=_[_0x1d88('0x16')](_0x50962e)?_0x50962e:JSON['parse'](_0x50962e);}}catch(_0x15b5ac){_0x485406[_0x499ff3]=_0x50962e[_0x1d88('0xa')](',');}});}return _0x485406;};exports[_0x1d88('0x17')]=function(_0x175aae){_0x175aae=parseInt(_0x175aae,0xa);if(!_0x175aae||_0x175aae<0x0){_0x175aae=LIMIT_VALUE;}return _0x175aae;};exports['offset']=function(_0x20bf4c){_0x20bf4c=parseInt(_0x20bf4c,0xa);if(!_0x20bf4c||_0x20bf4c<0x0){_0x20bf4c=0x0;}return _0x20bf4c;};exports[_0x1d88('0x18')]=function(_0x492457){var _0x5c4520,_0x1efb3e=null;if(_0x492457){_0x5c4520=_0x492457['split'](',');_0x1efb3e=_[_0x1d88('0x19')](_0x5c4520,function(_0x85bab3){if(_0x85bab3[_0x1d88('0x1a')]('-')===0x0){return[_0x85bab3===_0x1d88('0x1b')?sequelize[_0x1d88('0x1c')](sequelize['col'](_0x1d88('0x1b')),_0x1d88('0x1d')):_0x85bab3[_0x1d88('0x1e')](0x1),'DESC'];}else{return[_0x85bab3==='priority'?sequelize[_0x1d88('0x1c')](sequelize['col'](_0x1d88('0x1b')),_0x1d88('0x1d')):_0x85bab3,_0x1d88('0x1f')];}});}return _0x1efb3e;};exports[_0x1d88('0x20')]=function(_0x4f1850,_0x9b2853){if(_[_0x1d88('0xc')](_0x4f1850)){return _0x4f1850;}if(_[_0x1d88('0x16')](_0x4f1850)){for(var _0x302c08=0x0;_0x302c08<_0x4f1850[_0x1d88('0x21')];_0x302c08+=0x1){_0x4f1850[_0x302c08]=this[_0x1d88('0x20')](_0x4f1850[_0x302c08],_0x9b2853);}return _0x4f1850;}if(!_['isObject'](_0x4f1850)){return _0x4f1850;}if(_[_0x1d88('0x22')](_0x9b2853)){_0x9b2853=[_0x9b2853];}if(!_[_0x1d88('0x16')](_0x9b2853)){return _0x4f1850;}for(var _0x15d07e=0x0;_0x15d07e<_0x9b2853[_0x1d88('0x21')];_0x15d07e+=0x1){_[_0x1d88('0x23')](_0x4f1850,_0x9b2853[_0x15d07e]);}for(var _0x19cc88 in _0x4f1850){if(_0x4f1850['hasOwnProperty'](_0x19cc88)){_0x4f1850[_0x19cc88]=this[_0x1d88('0x20')](_0x4f1850[_0x19cc88],_0x9b2853);}}return _0x4f1850;};exports[_0x1d88('0x24')]=function(_0x5db753){return _0x5db753[_0x1d88('0x25')](RegExp(_0x1d88('0x26')))?!![]:![];};exports[_0x1d88('0x27')]=function(_0x40d04c){return _0x40d04c[_0x1d88('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x546f19,_0xf7a566){var _0x3b3c09=[];var _0x4a810e=/[ `!@#$%^&*()_\-?~]/;var _0x44ac11=_0xf7a566?'\x22{EXPR}\x22':'{EXPR}';_0x546f19[_0x1d88('0xa')](/[ ,]+/)[_0x1d88('0x28')](function(_0x491ad6){_0x491ad6=_0x491ad6[_0x1d88('0x29')](/([^:]")"+/g,'$1');_0x491ad6='+'+_0x491ad6+'*';var _0x5ee644=_0x491ad6[_0x1d88('0x25')](_0x4a810e);if(_0x5ee644){_0x491ad6='\x22'+_0x491ad6+'\x22';}_0x3b3c09['push'](_0x491ad6);});_0x44ac11=_0x44ac11[_0x1d88('0x29')]('{EXPR}',_0x3b3c09[_0x1d88('0x2a')]('\x20'));return _0x44ac11;};exports[_0x1d88('0x2b')]=function(_0x152f51,_0x26379f,_0x1f86d6){var _0xa4cae0={},_0x5ca2bf={};if(_0x26379f[_0x1d88('0x2c')][_0x1d88('0x2d')]){_0x26379f['query']['id']=_0x26379f[_0x1d88('0x2c')][_0x1d88('0x2d')];delete _0x26379f[_0x1d88('0x2c')]['$id'];}_0xa4cae0[_0x1d88('0x6')]=_[_0x1d88('0x19')](_0x152f51,_0x1d88('0x15'));_0xa4cae0[_0x1d88('0x2c')]=_[_0x1d88('0x5')](_0x26379f[_0x1d88('0x2c')]);_0xa4cae0[_0x1d88('0xb')]=_[_0x1d88('0x2e')](_0xa4cae0[_0x1d88('0x6')],_0xa4cae0[_0x1d88('0x2c')]);_0x5ca2bf[_0x1d88('0x2f')]=_[_0x1d88('0x2e')](_0xa4cae0['model'],this[_0x1d88('0x8')](_0x26379f[_0x1d88('0x2c')][_0x1d88('0x8')]));_0x5ca2bf[_0x1d88('0x2f')]=_0x5ca2bf[_0x1d88('0x2f')][_0x1d88('0x21')]?_0x5ca2bf[_0x1d88('0x2f')]:_0xa4cae0[_0x1d88('0x6')];if(!_0x26379f[_0x1d88('0x2c')][_0x1d88('0x30')](_0x1d88('0x31'))){_0x5ca2bf[_0x1d88('0x17')]=this[_0x1d88('0x17')](_0x26379f['query'][_0x1d88('0x17')]);_0x5ca2bf[_0x1d88('0x32')]=this[_0x1d88('0x32')](_0x26379f[_0x1d88('0x2c')]['offset']);}_0x5ca2bf[_0x1d88('0x33')]=this[_0x1d88('0x18')](_0x26379f[_0x1d88('0x2c')]['sort']);_0x5ca2bf[_0x1d88('0x34')]=this[_0x1d88('0xb')](_['pick'](_0x26379f['query'],_0xa4cae0[_0x1d88('0xb')]),_0x152f51);if(_0x26379f[_0x1d88('0x2c')]['filter']){var _0x44fce6=_0x152f51;var _0x48a754=_0x26379f['query'][_0x1d88('0x35')];if(typeof _0x48a754===_0x1d88('0x36')){_0x44fce6=_[_0x1d88('0x35')](_0x152f51,function(_0x45cd0d){return _['includes'](_0x48a754[_0x1d88('0x37')],_0x45cd0d['name']);});_0x48a754=_0x48a754[_0x1d88('0x38')];}_0x5ca2bf['where']=_[_0x1d88('0x39')](_0x5ca2bf[_0x1d88('0x34')],{'$or':_[_0x1d88('0x19')](_0x44fce6,function(_0x28a0e4){if(_0x28a0e4[_0x1d88('0xd')]!==_0x1d88('0x3a')){if(_0x1f86d6){return sequelize[_0x1d88('0x34')](sequelize['fn'](_0x1d88('0x3b'),sequelize['col'](_0x28a0e4[_0x1d88('0x15')])),{'$like':sequelize['fn'](_0x1d88('0x3b'),'%'+_0x26379f['query']['filter']+'%')});}else{var _0xacffa4={};_0xacffa4[_0x28a0e4[_0x1d88('0x15')]]={'$like':'%'+_0x26379f[_0x1d88('0x2c')][_0x1d88('0x35')]+'%'};return _0xacffa4;}}})});}_0x5ca2bf=_[_0x1d88('0x39')]({},_0x5ca2bf,_0x26379f[_0x1d88('0x3c')]);return _0x5ca2bf;};exports[_0x1d88('0x3d')]=function(_0x5ceb30){var _0x168f07=[];if(_0x5ceb30['includeAll']){_0x168f07['push']({'all':!![]});}else if(_0x5ceb30[_0x1d88('0x3d')]){if(Array[_0x1d88('0x16')](_0x5ceb30[_0x1d88('0x3d')])){_0x168f07=Object[_0x1d88('0x5')](_0x5ceb30[_0x1d88('0x3d')])[_0x1d88('0x19')](function(_0x4b62ac){return parseIncludeModel(_0x5ceb30[_0x1d88('0x3d')][_0x4b62ac]);});}else{var _0x52b22a=parseIncludeModel(_0x5ceb30['include']);_0x168f07['push'](_0x52b22a);}}return _0x168f07;}; \ No newline at end of file +var _0x4534=['limit','offset','map','priority','cast','col','substr','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','filters','intersection','attributes','nolimit','sort','where','pick','filter','object','columns','value','lower','merge','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','model','alias','fields','raw','split','isEmpty','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray'];(function(_0x210319,_0x2bbbca){var _0x1c1284=function(_0x4a98d2){while(--_0x4a98d2){_0x210319['push'](_0x210319['shift']());}};_0x1c1284(++_0x2bbbca);}(_0x4534,0x141));var _0x4453=function(_0x349871,_0x12a5cc){_0x349871=_0x349871-0x0;var _0x101f0f=_0x4534[_0x349871];return _0x101f0f;};'use strict';var _=require(_0x4453('0x0'));var sequelize=require(_0x4453('0x1'));var moment=require(_0x4453('0x2'));var db=require(_0x4453('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x516e12){var _0x46eaf1=['ne'];try{var _0x2339f6=JSON[_0x4453('0x4')](_0x516e12);var _0x26bdae=Object['keys'](_0x2339f6)[0x0];return _0x46eaf1['includes'](_0x26bdae);}catch(_0xfa8819){return![];}}function getOperatorValue(_0x456815){var _0x25bf80=JSON[_0x4453('0x4')](_0x456815);var _0x14092d=Object[_0x4453('0x5')](_0x25bf80)[0x0];var _0x1e649b=_0x25bf80[_0x14092d];return{['$'+_0x14092d]:_0x1e649b};}function parseIncludeModel(_0x230dc8){var _0x5c684a=JSON[_0x4453('0x4')](_0x230dc8);return{'model':db[_0x5c684a[_0x4453('0x6')]],'as':_0x5c684a[_0x4453('0x7')],'attributes':_0x5c684a[_0x4453('0x8')],'raw':_0x5c684a[_0x4453('0x9')]};}exports[_0x4453('0x8')]=function(_0x597907){var _0x5651bb=null;if(_0x597907){_0x5651bb=_0x597907[_0x4453('0xa')](',');}return _0x5651bb;};exports['filters']=function(_0x2b9b12,_0x5d795b){var _0x550039={};if(!_[_0x4453('0xb')](_0x2b9b12)){_['forOwn'](_0x2b9b12,function(_0x5019ce,_0x4d076d){try{if(_0x5d795b){var _0x834f05=_[_0x4453('0xc')](_0x5d795b,{'name':_0x4d076d})||{};if(hasSequelizeOperator(_0x5019ce)){_0x550039[_0x4d076d]=getOperatorValue(_0x5019ce);}else if(_0x834f05[_0x4453('0xd')]===_0x4453('0xe')&&_[_0x4453('0xf')](_0x5019ce)){var _0x3f2884=JSON[_0x4453('0x4')](_0x5019ce);var _0x40c574={'$gte':moment(moment(_0x3f2884[_0x4453('0x10')])['format'](_0x4453('0x11')))[_0x4453('0x12')]()[_0x4453('0x13')](),'$lte':moment(moment(_0x3f2884['$lte'])[_0x4453('0x13')]('YYYY-MM-DD'))[_0x4453('0x12')]()[_0x4453('0x14')](0x1,'s')['format']()};_0x550039[_0x4d076d]=_0x40c574;}else if(_0x834f05[_0x4453('0x15')]===_0x4453('0x16')){_0x550039[_0x4d076d]=_0x5019ce;}else{_0x550039[_0x4d076d]=_[_0x4453('0x17')](_0x5019ce)?_0x5019ce:JSON[_0x4453('0x4')](_0x5019ce);}}else{_0x550039[_0x4d076d]=_[_0x4453('0x17')](_0x5019ce)?_0x5019ce:JSON[_0x4453('0x4')](_0x5019ce);}}catch(_0x4a2ccc){_0x550039[_0x4d076d]=_0x5019ce[_0x4453('0xa')](',');}});}return _0x550039;};exports[_0x4453('0x18')]=function(_0x3a20d8){_0x3a20d8=parseInt(_0x3a20d8,0xa);if(!_0x3a20d8||_0x3a20d8<0x0){_0x3a20d8=LIMIT_VALUE;}return _0x3a20d8;};exports[_0x4453('0x19')]=function(_0x4b0162){_0x4b0162=parseInt(_0x4b0162,0xa);if(!_0x4b0162||_0x4b0162<0x0){_0x4b0162=0x0;}return _0x4b0162;};exports['sort']=function(_0x4a8a4f){var _0x114b8e,_0x3e53f5=null;if(_0x4a8a4f){_0x114b8e=_0x4a8a4f[_0x4453('0xa')](',');_0x3e53f5=_[_0x4453('0x1a')](_0x114b8e,function(_0x8e8ce){if(_0x8e8ce['indexOf']('-')===0x0){return[_0x8e8ce===_0x4453('0x1b')?sequelize[_0x4453('0x1c')](sequelize[_0x4453('0x1d')](_0x4453('0x1b')),'unsigned'):_0x8e8ce[_0x4453('0x1e')](0x1),'DESC'];}else{return[_0x8e8ce===_0x4453('0x1b')?sequelize[_0x4453('0x1c')](sequelize[_0x4453('0x1d')](_0x4453('0x1b')),_0x4453('0x1f')):_0x8e8ce,_0x4453('0x20')];}});}return _0x3e53f5;};exports[_0x4453('0x21')]=function(_0x54ec88,_0x590143){if(_[_0x4453('0xb')](_0x54ec88)){return _0x54ec88;}if(_['isArray'](_0x54ec88)){for(var _0x430ca6=0x0;_0x430ca6<_0x54ec88[_0x4453('0x22')];_0x430ca6+=0x1){_0x54ec88[_0x430ca6]=this[_0x4453('0x21')](_0x54ec88[_0x430ca6],_0x590143);}return _0x54ec88;}if(!_[_0x4453('0x23')](_0x54ec88)){return _0x54ec88;}if(_[_0x4453('0x24')](_0x590143)){_0x590143=[_0x590143];}if(!_[_0x4453('0x17')](_0x590143)){return _0x54ec88;}for(var _0x4420ee=0x0;_0x4420ee<_0x590143[_0x4453('0x22')];_0x4420ee+=0x1){_[_0x4453('0x25')](_0x54ec88,_0x590143[_0x4420ee]);}for(var _0x423968 in _0x54ec88){if(_0x54ec88[_0x4453('0x26')](_0x423968)){_0x54ec88[_0x423968]=this[_0x4453('0x21')](_0x54ec88[_0x423968],_0x590143);}}return _0x54ec88;};exports[_0x4453('0x27')]=function(_0xd70da2){return _0xd70da2[_0x4453('0x28')](RegExp(_0x4453('0x29')))?!![]:![];};exports[_0x4453('0x2a')]=function(_0x5456d3){return _0x5456d3[_0x4453('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x4453('0x2b')]=function(_0x2206eb,_0x39f8ac){var _0x3f8dc7=[];var _0x362fce=/[ `!@#$%^&*()_\-?~]/;var _0x3d85dc=_0x39f8ac?_0x4453('0x2c'):_0x4453('0x2d');_0x2206eb[_0x4453('0xa')](/[ ,]+/)[_0x4453('0x2e')](function(_0x4e608e){_0x4e608e=_0x4e608e[_0x4453('0x2f')](/([^:]")"+/g,'$1');_0x4e608e='+'+_0x4e608e+'*';var _0xb20a9=_0x4e608e[_0x4453('0x28')](_0x362fce);if(_0xb20a9){_0x4e608e='\x22'+_0x4e608e+'\x22';}_0x3f8dc7[_0x4453('0x30')](_0x4e608e);});_0x3d85dc=_0x3d85dc[_0x4453('0x2f')](_0x4453('0x2d'),_0x3f8dc7[_0x4453('0x31')]('\x20'));return _0x3d85dc;};exports[_0x4453('0x32')]=function(_0x10b745,_0x45f961,_0x50eeca){var _0x3f0736={},_0x163dfa={};if(_0x45f961[_0x4453('0x33')][_0x4453('0x34')]){_0x45f961[_0x4453('0x33')]['id']=_0x45f961[_0x4453('0x33')][_0x4453('0x34')];delete _0x45f961[_0x4453('0x33')][_0x4453('0x34')];}_0x3f0736[_0x4453('0x6')]=_[_0x4453('0x1a')](_0x10b745,_0x4453('0x15'));_0x3f0736[_0x4453('0x33')]=_[_0x4453('0x5')](_0x45f961['query']);_0x3f0736[_0x4453('0x35')]=_[_0x4453('0x36')](_0x3f0736[_0x4453('0x6')],_0x3f0736[_0x4453('0x33')]);_0x163dfa[_0x4453('0x37')]=_['intersection'](_0x3f0736[_0x4453('0x6')],this[_0x4453('0x8')](_0x45f961['query'][_0x4453('0x8')]));_0x163dfa[_0x4453('0x37')]=_0x163dfa['attributes'][_0x4453('0x22')]?_0x163dfa[_0x4453('0x37')]:_0x3f0736[_0x4453('0x6')];if(!_0x45f961['query'][_0x4453('0x26')](_0x4453('0x38'))){_0x163dfa[_0x4453('0x18')]=this[_0x4453('0x18')](_0x45f961[_0x4453('0x33')][_0x4453('0x18')]);_0x163dfa[_0x4453('0x19')]=this[_0x4453('0x19')](_0x45f961[_0x4453('0x33')][_0x4453('0x19')]);}_0x163dfa['order']=this[_0x4453('0x39')](_0x45f961[_0x4453('0x33')][_0x4453('0x39')]);_0x163dfa[_0x4453('0x3a')]=this[_0x4453('0x35')](_[_0x4453('0x3b')](_0x45f961['query'],_0x3f0736[_0x4453('0x35')]),_0x10b745);if(_0x45f961['query'][_0x4453('0x3c')]){var _0x1f64a4=_0x10b745;var _0x4172c8=_0x45f961['query'][_0x4453('0x3c')];if(typeof _0x4172c8===_0x4453('0x3d')){_0x1f64a4=_[_0x4453('0x3c')](_0x10b745,function(_0x5106a9){return _['includes'](_0x4172c8[_0x4453('0x3e')],_0x5106a9['name']);});_0x4172c8=_0x4172c8[_0x4453('0x3f')];}_0x163dfa[_0x4453('0x3a')]=_['merge'](_0x163dfa[_0x4453('0x3a')],{'$or':_[_0x4453('0x1a')](_0x1f64a4,function(_0x121b8a){if(_0x121b8a[_0x4453('0xd')]!=='VIRTUAL'){if(_0x50eeca){return sequelize['where'](sequelize['fn'](_0x4453('0x40'),sequelize[_0x4453('0x1d')](_0x121b8a[_0x4453('0x15')])),{'$like':sequelize['fn']('lower','%'+_0x45f961[_0x4453('0x33')][_0x4453('0x3c')]+'%')});}else{var _0x11d545={};_0x11d545[_0x121b8a['name']]={'$like':'%'+_0x45f961[_0x4453('0x33')]['filter']+'%'};return _0x11d545;}}})});}_0x163dfa=_[_0x4453('0x41')]({},_0x163dfa,_0x45f961[_0x4453('0x42')]);return _0x163dfa;};exports[_0x4453('0x43')]=function(_0x2e67bd){var _0x28e3a1=[];if(_0x2e67bd[_0x4453('0x44')]){_0x28e3a1[_0x4453('0x30')]({'all':!![]});}else if(_0x2e67bd[_0x4453('0x43')]){if(Array[_0x4453('0x17')](_0x2e67bd[_0x4453('0x43')])){_0x28e3a1=Object[_0x4453('0x5')](_0x2e67bd['include'])['map'](function(_0x307a63){return parseIncludeModel(_0x2e67bd['include'][_0x307a63]);});}else{var _0x238e38=parseIncludeModel(_0x2e67bd['include']);_0x28e3a1['push'](_0x238e38);}}return _0x28e3a1;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 50bfe39..baaae36 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8678=['uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','mailPause','smsPause','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','internal','indexOf','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','faxPause','openchannelPause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','voicePause','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','error','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','getAgents','all','flatten','map'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x8678,0x1b6));var _0x8867=function(_0xd2010c,_0x203dc6){_0xd2010c=_0xd2010c-0x0;var _0x543bb8=_0x8678[_0xd2010c];return _0x543bb8;};'use strict';var _=require(_0x8867('0x0'));var jayson=require(_0x8867('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x8867('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x8867('0x2')][_0x8867('0x3')]({'port':0x232c});function isAgentPaused(_0x14c325,_0x4525db){var _0x10171b=[_0x14c325[_0x8867('0x4')],_0x14c325[_0x8867('0x5')],_0x14c325['mailPause'],_0x14c325[_0x8867('0x6')],_0x14c325['smsPause'],_0x14c325['voicePause'],_0x14c325[_0x8867('0x7')]];if(!_0x4525db)return _[_0x8867('0x8')](_0x10171b);var _0x3955be=_[_0x8867('0x9')](_0x10171b);return _0x3955be[_0x8867('0xa')]>0x0&&_0x3955be[_0x8867('0xa')]<_0x10171b[_0x8867('0xa')]?!![]:![];}function isIdle(_0x534435){return _0x534435===_0x8867('0xb')||_0x534435===_0x8867('0xc')||_0x534435===_0x8867('0xd')||_0x534435==='ringing'||_[_0x8867('0xe')](_0x534435);}function isAgentIdle(_0x10a456){if(_0x10a456[_0x8867('0xf')]!==_0x8867('0xb')&&_0x10a456[_0x8867('0x10')]){_0x10a456['voiceStatus']=_0x8867('0x11');return![];}return _[_0x8867('0x8')]([_0x10a456[_0x8867('0x12')],_0x10a456[_0x8867('0x13')],_0x10a456[_0x8867('0x14')],_0x10a456[_0x8867('0x15')],_0x10a456[_0x8867('0x16')],_0x10a456['voiceStatus'],_0x10a456[_0x8867('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x8867('0x18')]('Agents',{})[_0x8867('0x19')](function(_0x1beb47){if(_0x1beb47['error']){throw new Error(_0x8867('0x1a'));}var _0x3e6eb9=_0x1beb47[_0x8867('0x1b')];return routingClient[_0x8867('0x18')](_0x8867('0x1c'),{})['then'](function(_0x9e3096){if(_0x9e3096[_0x8867('0x1d')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x5b59ca=_0x9e3096['result'];return _['merge']({},_0x3e6eb9,_0x5b59ca);});})[_0x8867('0x1e')](function(_0x1db600){throw _0x1db600;});}exports[_0x8867('0x1f')]=getRealtimeAgents;function getAgentStatus(_0xb9b5aa){var _0x3af5e1='unknown';if(isAgentPaused(_0xb9b5aa))_0x3af5e1=_0x8867('0x11');else if(isAgentPaused(_0xb9b5aa,!![]))_0x3af5e1=_0x8867('0x20');else if(isAgentIdle(_0xb9b5aa))_0x3af5e1=_0x8867('0xb');else _0x3af5e1=_0x8867('0x21');return _0x3af5e1;}exports[_0x8867('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x129b69,_0xea16d9){var _0x5dceea=_[_0x8867('0x23')](_0x129b69)?_0x129b69:[_0x129b69];var _0x270f32=_[_0x8867('0x24')](_0xea16d9)+_0x8867('0x25');var _0x1c6ead=_['map'](_0x5dceea,function(_0x38276b){return db[_0x270f32]['findOne']({'where':{'id':_0x38276b}})['then'](function(_0x1f0a34){if(!_0x1f0a34)return[];return _0x1f0a34[_0x8867('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x8867('0x27')](_0x1c6ead)[_0x8867('0x19')](function(_0xc44264){var _0x54d021=_(_0xc44264)[_0x8867('0x28')]()[_0x8867('0x29')]('id')[_0x8867('0x2a')]()[_0x8867('0x2b')]();return _0x54d021;});}exports[_0x8867('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4a8852,_0x5f1e81,_0x2b4b26){try{if(_0x5f1e81[_0x8867('0xa')]>0x0){_0x4a8852=_0x4a8852[_0x8867('0x9')](function(_0x29b5e7){return _0x5f1e81[_0x8867('0x2d')](_0x29b5e7['id']);});}var _0x269bd9=_0x4a8852['filter'](function(_0x757a47){var _0x4db310=_0x8867('0x21');if(isAgentIdle(_0x757a47)){_0x4db310=_0x8867('0xb');}return _0x4db310===_0x2b4b26;});return _['map'](_0x269bd9,'id');}catch(_0xb46c8d){throw _0xb46c8d;}}exports[_0x8867('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f1d6f,_0x31298c,_0x4b82b5){return Promise[_0x8867('0x2f')]()[_0x8867('0x19')](function(){if(_0x31298c[_0x8867('0xa')]>0x0){_0x2f1d6f=_0x2f1d6f[_0x8867('0x9')](function(_0x46c5fe){return _0x31298c[_0x8867('0x2d')](_0x46c5fe['id']);});}return _0x2f1d6f;})[_0x8867('0x19')](function(){return db['User'][_0x8867('0x30')]({'attributes':['id',_0x8867('0x31'),_0x8867('0x32'),_0x8867('0x4'),_0x8867('0x5'),_0x8867('0x33'),_0x8867('0x6'),_0x8867('0x34'),'voicePause','whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x8867('0x29')](_0x2f1d6f,'id')}},'raw':!![]});})[_0x8867('0x19')](function(_0x9173d){return _0x9173d[_0x8867('0x29')](function(_0x500479){var _0x1338b8=_[_0x8867('0x35')](_0x2f1d6f,['id',_0x500479['id']]);var _0x1d082d=filterAgentAttributes(_0x1338b8);_[_0x8867('0x36')](_0x500479,_0x1d082d);_0x500479[_0x8867('0x37')]=getAgentStatus(_0x500479);return _0x500479;});})[_0x8867('0x19')](function(_0x3cf6ee){var _0x1e2b0d=sortAgentsByStatus(_0x3cf6ee,_0x4b82b5);return _['map'](_0x1e2b0d,'id');})[_0x8867('0x1e')](function(_0xdd24f){throw _0xdd24f;});}exports[_0x8867('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x26d8cd){var _0x54dcad={'fields':[],'order':null};var _0x4542ae=_0x26d8cd[_0x8867('0x39')](',');_0x54dcad[_0x8867('0x3a')]=_['filter'](_0x4542ae,function(_0x40a0f4){if(!_0x40a0f4[_0x8867('0x2d')](_0x8867('0x37'))){return!![];}_0x54dcad[_0x8867('0x3b')]=_[_0x8867('0x3c')](_0x40a0f4,'-')?_0x8867('0x3d'):'ASC';return![];});return _0x54dcad;}exports[_0x8867('0x3e')]=getUpdatedSortOptions;function validateSortParameter(_0x45fdb4){if(!_0x45fdb4){_0x45fdb4='fullname,internal';}if(_0x45fdb4[_0x8867('0x2d')](_0x8867('0x32'))&&!_0x45fdb4[_0x8867('0x2d')](_0x8867('0x3f'))){var _0x4ad32f=_0x45fdb4['substring'](0x0,_0x45fdb4[_0x8867('0x40')](_0x8867('0x32')));_0x45fdb4+=','+_0x4ad32f+_0x8867('0x3f');}return _0x45fdb4;}exports[_0x8867('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x286bda,_0x55c362){var _0x24f019=_0x286bda[_0x8867('0x42')](function(_0x4a3622,_0x36297c){if(_0x4a3622['globalStatus']===_0x36297c[_0x8867('0x37')]){if(_0x4a3622['globalStatus']===_0x8867('0x11')){if(_0x55c362==='DESC'){return(_0x4a3622[_0x8867('0x43')]||'')<(_0x36297c[_0x8867('0x43')]||'')||_0x4a3622[_0x8867('0x32')][_0x8867('0x44')]()>_0x36297c['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x4a3622[_0x8867('0x43')]||'')<(_0x36297c[_0x8867('0x43')]||'')||_0x4a3622[_0x8867('0x32')]['toLowerCase']()>_0x36297c['fullname'][_0x8867('0x44')]()?-0x1:0x1;}}else{if(_0x55c362===_0x8867('0x3d')){return _0x4a3622[_0x8867('0x32')][_0x8867('0x44')]()<_0x36297c[_0x8867('0x32')]['toLowerCase']()?0x1:-0x1;}else{return _0x4a3622[_0x8867('0x32')][_0x8867('0x44')]()<_0x36297c['fullname'][_0x8867('0x44')]()?-0x1:0x1;}}}else{if(_0x55c362===_0x8867('0x3d')){return _0x4a3622[_0x8867('0x37')]<_0x36297c[_0x8867('0x37')]?0x1:-0x1;}else{return _0x4a3622[_0x8867('0x37')]<_0x36297c[_0x8867('0x37')]?-0x1:0x1;}}});return _0x24f019;}exports[_0x8867('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0x2fed2b){var _0x170893=['userpic',_0x8867('0x46'),_0x8867('0x47'),_0x8867('0x48'),_0x8867('0x43'),_0x8867('0x48'),_0x8867('0x3f'),_0x8867('0x49'),_0x8867('0x4'),_0x8867('0x6'),'mailPause',_0x8867('0x34'),_0x8867('0x7'),_0x8867('0x5'),_0x8867('0x10'),'chatCapacity','openchannelCapacity','mailCapacity',_0x8867('0x4a'),_0x8867('0x4b'),_0x8867('0x4c'),_0x8867('0x4d'),_0x8867('0x4e'),_0x8867('0x4f'),_0x8867('0x50'),_0x8867('0x51'),_0x8867('0x52'),_0x8867('0x12'),_0x8867('0x15'),'mailStatus','smsStatus',_0x8867('0x17'),'faxStatus',_0x8867('0xf'),_0x8867('0x53'),_0x8867('0x54'),_0x8867('0x55'),_0x8867('0x56'),_0x8867('0x57'),'faxStatusTime',_0x8867('0x58'),_0x8867('0x59'),_0x8867('0x5a'),'screenrecording',_0x8867('0x5b'),_0x8867('0x5c'),'routealias'];var _0x309ab6=[_0x8867('0x4'),_0x8867('0x6'),'mailPause',_0x8867('0x34'),_0x8867('0x7'),'faxPause',_0x8867('0x10'),_0x8867('0x46')];var _0x556d48=_(_0x2fed2b)[_0x8867('0x5d')](_0x309ab6)[_0x8867('0x5e')](_0x170893)[_0x8867('0x2b')]();return _0x556d48;}exports[_0x8867('0x5f')]=filterAgentAttributes; \ No newline at end of file +var _0x8453=['findAll','name','fullname','faxPause','mailPause','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','smsPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','http','client','chatPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','startCase','Queue','map','findOne','getAgents','flatten','uniq','value','getAgentIdsByQueues','includes','busy','resolve','User'];(function(_0x57b80f,_0x4339e5){var _0x4dfdb8=function(_0x192599){while(--_0x192599){_0x57b80f['push'](_0x57b80f['shift']());}};_0x4dfdb8(++_0x4339e5);}(_0x8453,0x1c5));var _0x3845=function(_0x15ba4d,_0xeeb34c){_0x15ba4d=_0x15ba4d-0x0;var _0x32c1fe=_0x8453[_0x15ba4d];return _0x32c1fe;};'use strict';var _=require(_0x3845('0x0'));var jayson=require(_0x3845('0x1'));var db=require(_0x3845('0x2'))['db'];var amiClient=jayson['client'][_0x3845('0x3')]({'port':0x232a});var routingClient=jayson[_0x3845('0x4')][_0x3845('0x3')]({'port':0x232c});function isAgentPaused(_0x5ceea7,_0x1c9f43){var _0x29e03e=[_0x5ceea7[_0x3845('0x5')],_0x5ceea7['faxPause'],_0x5ceea7['mailPause'],_0x5ceea7[_0x3845('0x6')],_0x5ceea7['smsPause'],_0x5ceea7[_0x3845('0x7')],_0x5ceea7[_0x3845('0x8')]];if(!_0x1c9f43)return _[_0x3845('0x9')](_0x29e03e);var _0x1ae5c3=_[_0x3845('0xa')](_0x29e03e);return _0x1ae5c3['length']>0x0&&_0x1ae5c3[_0x3845('0xb')]<_0x29e03e[_0x3845('0xb')]?!![]:![];}function isIdle(_0x2b2099){return _0x2b2099===_0x3845('0xc')||_0x2b2099===_0x3845('0xd')||_0x2b2099===_0x3845('0xe')||_0x2b2099===_0x3845('0xf')||_[_0x3845('0x10')](_0x2b2099);}function isAgentIdle(_0xbc1f9c){if(_0xbc1f9c[_0x3845('0x11')]!==_0x3845('0xc')&&_0xbc1f9c[_0x3845('0x7')]){_0xbc1f9c[_0x3845('0x11')]='pause';return![];}return _[_0x3845('0x9')]([_0xbc1f9c[_0x3845('0x12')],_0xbc1f9c['faxStatus'],_0xbc1f9c[_0x3845('0x13')],_0xbc1f9c[_0x3845('0x14')],_0xbc1f9c[_0x3845('0x15')],_0xbc1f9c['voiceStatus'],_0xbc1f9c[_0x3845('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x3845('0x17')](_0x3845('0x18'),{})[_0x3845('0x19')](function(_0x5d0a4f){if(_0x5d0a4f[_0x3845('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x519b69=_0x5d0a4f[_0x3845('0x1b')];return routingClient['request'](_0x3845('0x18'),{})[_0x3845('0x19')](function(_0x2694da){if(_0x2694da[_0x3845('0x1a')]){throw new Error(_0x3845('0x1c'));}var _0x932c3a=_0x2694da[_0x3845('0x1b')];return _[_0x3845('0x1d')]({},_0x519b69,_0x932c3a);});})[_0x3845('0x1e')](function(_0x329b74){throw _0x329b74;});}exports[_0x3845('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x1455d8){var _0xbca58a=_0x3845('0xd');if(isAgentPaused(_0x1455d8))_0xbca58a=_0x3845('0x20');else if(isAgentPaused(_0x1455d8,!![]))_0xbca58a=_0x3845('0x21');else if(isAgentIdle(_0x1455d8))_0xbca58a=_0x3845('0xc');else _0xbca58a='busy';return _0xbca58a;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x31c744,_0x41eb10){var _0xa55837=_['isArray'](_0x31c744)?_0x31c744:[_0x31c744];var _0x507c70=_[_0x3845('0x22')](_0x41eb10)+_0x3845('0x23');var _0x4904e2=_[_0x3845('0x24')](_0xa55837,function(_0x32d63f){return db[_0x507c70][_0x3845('0x25')]({'where':{'id':_0x32d63f}})['then'](function(_0x54143c){if(!_0x54143c)return[];return _0x54143c[_0x3845('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x4904e2)[_0x3845('0x19')](function(_0x5e47ff){var _0x3cf52d=_(_0x5e47ff)[_0x3845('0x27')]()[_0x3845('0x24')]('id')[_0x3845('0x28')]()[_0x3845('0x29')]();return _0x3cf52d;});}exports[_0x3845('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x42756f,_0x298a19,_0xd4e048){try{if(_0x298a19[_0x3845('0xb')]>0x0){_0x42756f=_0x42756f[_0x3845('0xa')](function(_0xf539c0){return _0x298a19[_0x3845('0x2b')](_0xf539c0['id']);});}var _0x8f219b=_0x42756f[_0x3845('0xa')](function(_0x507161){var _0x4e2efa=_0x3845('0x2c');if(isAgentIdle(_0x507161)){_0x4e2efa=_0x3845('0xc');}return _0x4e2efa===_0xd4e048;});return _[_0x3845('0x24')](_0x8f219b,'id');}catch(_0x2cfc41){throw _0x2cfc41;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xc90aab,_0x3507eb,_0x3a0251){return Promise[_0x3845('0x2d')]()['then'](function(){if(_0x3507eb[_0x3845('0xb')]>0x0){_0xc90aab=_0xc90aab[_0x3845('0xa')](function(_0x4d6e27){return _0x3507eb[_0x3845('0x2b')](_0x4d6e27['id']);});}return _0xc90aab;})[_0x3845('0x19')](function(){return db[_0x3845('0x2e')][_0x3845('0x2f')]({'attributes':['id',_0x3845('0x30'),_0x3845('0x31'),_0x3845('0x5'),_0x3845('0x32'),_0x3845('0x33'),_0x3845('0x6'),'smsPause',_0x3845('0x7'),'whatsappPause','pauseType'],'where':{'id':{'$in':_['map'](_0xc90aab,'id')}},'raw':!![]});})['then'](function(_0x27f123){return _0x27f123[_0x3845('0x24')](function(_0x1cd5ae){var _0x3974ce=_[_0x3845('0x34')](_0xc90aab,['id',_0x1cd5ae['id']]);var _0x334048=filterAgentAttributes(_0x3974ce);_[_0x3845('0x1d')](_0x1cd5ae,_0x334048);_0x1cd5ae[_0x3845('0x35')]=getAgentStatus(_0x1cd5ae);return _0x1cd5ae;});})[_0x3845('0x19')](function(_0xb4ef3b){var _0x4c6640=sortAgentsByStatus(_0xb4ef3b,_0x3a0251);return _[_0x3845('0x24')](_0x4c6640,'id');})[_0x3845('0x1e')](function(_0x2b1681){throw _0x2b1681;});}exports[_0x3845('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x29e597){var _0x302103={'fields':[],'order':null};var _0x5315fa=_0x29e597[_0x3845('0x37')](',');_0x302103[_0x3845('0x38')]=_['filter'](_0x5315fa,function(_0x3e82ae){if(!_0x3e82ae['includes']('globalStatus')){return!![];}_0x302103[_0x3845('0x39')]=_[_0x3845('0x3a')](_0x3e82ae,'-')?'DESC':_0x3845('0x3b');return![];});return _0x302103;}exports[_0x3845('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x433881){if(!_0x433881){_0x433881=_0x3845('0x3d');}if(_0x433881['includes'](_0x3845('0x31'))&&!_0x433881['includes'](_0x3845('0x3e'))){var _0x3e171d=_0x433881['substring'](0x0,_0x433881['indexOf'](_0x3845('0x31')));_0x433881+=','+_0x3e171d+_0x3845('0x3e');}return _0x433881;}exports[_0x3845('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x3251e6,_0x49fd3c){var _0x1cf212=_0x3251e6[_0x3845('0x40')](function(_0xc1e43d,_0x3cf1dd){if(_0xc1e43d[_0x3845('0x35')]===_0x3cf1dd[_0x3845('0x35')]){if(_0xc1e43d[_0x3845('0x35')]===_0x3845('0x20')){if(_0x49fd3c===_0x3845('0x41')){return(_0xc1e43d['pauseType']||'')<(_0x3cf1dd[_0x3845('0x42')]||'')||_0xc1e43d[_0x3845('0x31')][_0x3845('0x43')]()>_0x3cf1dd[_0x3845('0x31')][_0x3845('0x43')]()?0x1:-0x1;}else{return(_0xc1e43d[_0x3845('0x42')]||'')<(_0x3cf1dd[_0x3845('0x42')]||'')||_0xc1e43d[_0x3845('0x31')]['toLowerCase']()>_0x3cf1dd['fullname'][_0x3845('0x43')]()?-0x1:0x1;}}else{if(_0x49fd3c===_0x3845('0x41')){return _0xc1e43d[_0x3845('0x31')][_0x3845('0x43')]()<_0x3cf1dd[_0x3845('0x31')][_0x3845('0x43')]()?0x1:-0x1;}else{return _0xc1e43d[_0x3845('0x31')][_0x3845('0x43')]()<_0x3cf1dd[_0x3845('0x31')][_0x3845('0x43')]()?-0x1:0x1;}}}else{if(_0x49fd3c==='DESC'){return _0xc1e43d[_0x3845('0x35')]<_0x3cf1dd['globalStatus']?0x1:-0x1;}else{return _0xc1e43d[_0x3845('0x35')]<_0x3cf1dd[_0x3845('0x35')]?-0x1:0x1;}}});return _0x1cf212;}exports[_0x3845('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x250480){var _0x5e72e3=[_0x3845('0x45'),'online',_0x3845('0x46'),'lastPauseAt',_0x3845('0x42'),_0x3845('0x47'),_0x3845('0x3e'),_0x3845('0x48'),_0x3845('0x5'),'openchannelPause',_0x3845('0x33'),_0x3845('0x49'),_0x3845('0x8'),_0x3845('0x32'),_0x3845('0x7'),_0x3845('0x4a'),_0x3845('0x4b'),_0x3845('0x4c'),'smsCapacity',_0x3845('0x4d'),_0x3845('0x4e'),_0x3845('0x4f'),_0x3845('0x50'),_0x3845('0x51'),_0x3845('0x52'),_0x3845('0x53'),_0x3845('0x54'),_0x3845('0x12'),'openchannelStatus',_0x3845('0x13'),_0x3845('0x15'),'whatsappStatus',_0x3845('0x55'),_0x3845('0x11'),_0x3845('0x56'),'openchannelStatusTime',_0x3845('0x57'),'smsStatusTime',_0x3845('0x58'),'faxStatusTime',_0x3845('0x59'),_0x3845('0x5a'),_0x3845('0x5b'),_0x3845('0x5c'),_0x3845('0x5d'),_0x3845('0x5e'),_0x3845('0x5f')];var _0x397123=['chatPause','openchannelPause',_0x3845('0x33'),_0x3845('0x49'),'whatsappPause',_0x3845('0x32'),_0x3845('0x7'),_0x3845('0x60')];var _0x26ff47=_(_0x250480)[_0x3845('0x61')](_0x397123)[_0x3845('0x62')](_0x5e72e3)['value']();return _0x26ff47;}exports[_0x3845('0x63')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 4611c48..254911e 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ada=['predictiveIntervalAvgTalktime','request','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound','concat','map','get','loggedInDb','waiting','outbound','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','busy','inUse','notInUse','onHold','talking','unavailable','unknown','originated','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1ada,0x1ce));var _0xa1ad=function(_0x55a915,_0x5a0c85){_0x55a915=_0x55a915-0x0;var _0x30e971=_0x1ada[_0x55a915];return _0x30e971;};'use strict';var _=require(_0xa1ad('0x0'));var jayson=require(_0xa1ad('0x1'));var util=require(_0xa1ad('0x2'));var amiClient=jayson[_0xa1ad('0x3')][_0xa1ad('0x4')]({'port':0x232a});var routingClient=jayson[_0xa1ad('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xa1ad('0x5'),_0xa1ad('0x6'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xa1ad('0x7'),_0xa1ad('0x8'),'invalid','loggedInDb',_0xa1ad('0x9'),_0xa1ad('0xa'),'ringing','ringInUse',_0xa1ad('0xb'),_0xa1ad('0xc'),_0xa1ad('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xa1ad('0xe'),'message',_0xa1ad('0xf'),_0xa1ad('0x10'),_0xa1ad('0x11'),_0xa1ad('0x12'),'startPredictive',_0xa1ad('0x13'),_0xa1ad('0x14'),_0xa1ad('0x15'),_0xa1ad('0x16'),_0xa1ad('0x17'),_0xa1ad('0x18'),'dialPredictiveIntervalMaxThreshold',_0xa1ad('0x19'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xa1ad('0x1a'),_0xa1ad('0x1b'),_0xa1ad('0x1c')];function getRealtimeQueues(_0x48e8b6,_0x20b90b){var _0x281a03=_0x20b90b==='voice'?amiClient:routingClient;return _0x281a03[_0xa1ad('0x1d')](_['startCase'](_0x20b90b)+'Queues',_0x48e8b6)[_0xa1ad('0x1e')](function(_0x4d7e4c){if(_0x4d7e4c[_0xa1ad('0x1f')])throw new Error(util[_0xa1ad('0x20')](_0xa1ad('0x21'),_0x20b90b));return _0x4d7e4c[_0xa1ad('0x22')];})[_0xa1ad('0x23')](function(_0x1ff447){throw _0x1ff447;});}exports[_0xa1ad('0x24')]=getRealtimeQueues;function initializeQueues(_0x15819c,_0x5673d6,_0x1838a7,_0x50a84e){var _0x1a9cff=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1838a7===_0xa1ad('0x25')){if(_0x50a84e===_0xa1ad('0x26')){_0x1a9cff=_0x1a9cff[_0xa1ad('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x50a84e==='outbound'){_0x1a9cff=_0x1a9cff['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x15819c[_0xa1ad('0x28')](function(_0x94d306){var _0x473c60=_0x94d306[_0xa1ad('0x29')]({'plain':!![]});_0x473c60['paused']=0x0;_0x473c60[_0xa1ad('0x2a')]=0x0;_0x473c60[_0xa1ad('0x6')]=0x0;_0x473c60[_0xa1ad('0x5')]=0x0;_0x473c60[_0xa1ad('0x2b')]=0x0;if(_0x1838a7===_0xa1ad('0x25')){_0x473c60[_0xa1ad('0xb')]=0x0;_0x473c60[_0xa1ad('0x7')]=0x0;if(_0x50a84e===_0xa1ad('0x2c')){_0x473c60['pTalking']=0x0;_0x473c60[_0xa1ad('0xe')]=0x0;}}var _0x249faa=_[_0xa1ad('0x2d')](_0x5673d6,['id',_0x473c60['id']]);if(_0x249faa){_[_0xa1ad('0x2e')](_0x473c60,_[_0xa1ad('0x2f')](_0x249faa,_0x1a9cff));}return _0x473c60;});}exports[_0xa1ad('0x30')]=initializeQueues; \ No newline at end of file +var _0xc5de=['erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','then','error','format','result','catch','concat','outbound','get','loggedIn','available','busy','merge','pick','initializeQueues','jayson/promise','util','client','http','paused','waiting','inUse','invalid','loggedInDb','notInUse','onHold','talking','unavailable','unknown','pTalking','originated','statusMessage','dialMethod','startPredictive','startProgressive'];(function(_0x58734a,_0x300972){var _0x1f692e=function(_0x1ea701){while(--_0x1ea701){_0x58734a['push'](_0x58734a['shift']());}};_0x1f692e(++_0x300972);}(_0xc5de,0xd7));var _0xec5d=function(_0x22656e,_0x1163dc){_0x22656e=_0x22656e-0x0;var _0x3e4255=_0xc5de[_0x22656e];return _0x3e4255;};'use strict';var _=require('lodash');var jayson=require(_0xec5d('0x0'));var util=require(_0xec5d('0x1'));var amiClient=jayson[_0xec5d('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xec5d('0x2')][_0xec5d('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0xec5d('0x4'),_0xec5d('0x5')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xec5d('0x6'),_0xec5d('0x7'),_0xec5d('0x8'),_0xec5d('0x9'),_0xec5d('0xa'),'ringing','ringInUse',_0xec5d('0xb'),_0xec5d('0xc'),_0xec5d('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xec5d('0xe'),_0xec5d('0xf'),'message',_0xec5d('0x10'),'dialActive',_0xec5d('0x11'),'Trunk',_0xec5d('0x12'),_0xec5d('0x13'),_0xec5d('0x14'),_0xec5d('0x15'),'erlangAbandonmentRate',_0xec5d('0x16'),'dialPredictiveInterval',_0xec5d('0x17'),_0xec5d('0x18'),'predictiveIntervalAvailable',_0xec5d('0x19'),_0xec5d('0x1a'),_0xec5d('0x1b'),_0xec5d('0x1c'),_0xec5d('0x1d'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x23063c,_0x35cf56){var _0x386b2c=_0x35cf56===_0xec5d('0x1e')?amiClient:routingClient;return _0x386b2c[_0xec5d('0x1f')](_[_0xec5d('0x20')](_0x35cf56)+'Queues',_0x23063c)[_0xec5d('0x21')](function(_0x48dd78){if(_0x48dd78[_0xec5d('0x22')])throw new Error(util[_0xec5d('0x23')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x35cf56));return _0x48dd78[_0xec5d('0x24')];})[_0xec5d('0x25')](function(_0x2422f9){throw _0x2422f9;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0xf7a28f,_0x3e0516,_0x13b7ff,_0x7fe89e){var _0x1dc336=DEFAULT_QUEUE_ATTRIBUTES;if(_0x13b7ff==='voice'){if(_0x7fe89e==='inbound'){_0x1dc336=_0x1dc336[_0xec5d('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x7fe89e===_0xec5d('0x27')){_0x1dc336=_0x1dc336[_0xec5d('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xf7a28f['map'](function(_0x26fd05){var _0x4c6425=_0x26fd05[_0xec5d('0x28')]({'plain':!![]});_0x4c6425[_0xec5d('0x4')]=0x0;_0x4c6425[_0xec5d('0x8')]=0x0;_0x4c6425[_0xec5d('0x29')]=0x0;_0x4c6425[_0xec5d('0x2a')]=0x0;_0x4c6425[_0xec5d('0x5')]=0x0;if(_0x13b7ff===_0xec5d('0x1e')){_0x4c6425[_0xec5d('0xb')]=0x0;_0x4c6425[_0xec5d('0x2b')]=0x0;if(_0x7fe89e===_0xec5d('0x27')){_0x4c6425[_0xec5d('0xe')]=0x0;_0x4c6425[_0xec5d('0xf')]=0x0;}}var _0x5058fa=_['find'](_0x3e0516,['id',_0x4c6425['id']]);if(_0x5058fa){_[_0xec5d('0x2c')](_0x4c6425,_[_0xec5d('0x2d')](_0x5058fa,_0x1dc336));}return _0x4c6425;});}exports[_0xec5d('0x2e')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index eda738e..a8387a8 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x5e0bfe,_0x747312){var _0x6468b8=function(_0x20e5e0){while(--_0x20e5e0){_0x5e0bfe['push'](_0x5e0bfe['shift']());}};_0x6468b8(++_0x747312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x2606d9,_0x49939b){var _0x293d4b=function(_0x35e3c1){while(--_0x35e3c1){_0x2606d9['push'](_0x2606d9['shift']());}};_0x293d4b(++_0x49939b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b8fdb76..64efc94 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 _0xc328=['filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc328,0x13b));var _0x8c32=function(_0x25a084,_0x29e736){_0x25a084=_0x25a084-0x0;var _0x18bba5=_0xc328[_0x25a084];return _0x18bba5;};'use strict';var _=require(_0x8c32('0x0'));var os=require('os');var crypto=require(_0x8c32('0x1'));var machine=require(_0x8c32('0x2'));var exec=require(_0x8c32('0x3'))[_0x8c32('0x4')];var config=require(_0x8c32('0x5'));function getInterfaces(){var _0x1903a3=[];var _0x3e67b0=os[_0x8c32('0x6')]();var _0x5f4678=_[_0x8c32('0x7')](_['keys'](_0x3e67b0));for(var _0x388363=0x0;_0x388363<_0x5f4678[_0x8c32('0x8')];_0x388363++){var _0x42c3b2=_0x3e67b0[_0x5f4678[_0x388363]][_0x8c32('0x9')](function(_0x30e6ea){return _0x30e6ea[_0x8c32('0xa')]===_0x8c32('0xb')&&_0x30e6ea[_0x8c32('0xc')]===![];});_0x1903a3=_0x1903a3[_0x8c32('0xd')](_0x42c3b2);}return _0x1903a3;}function getFirstInterface(){var _0x16296f=_[_0x8c32('0xe')](getInterfaces());return{'macAddress':_0x16296f&&_0x16296f['mac']?_0x16296f['mac']:_0x8c32('0xf'),'ipAddress':_0x16296f&&_0x16296f[_0x8c32('0x10')]?_0x16296f[_0x8c32('0x10')]:_0x8c32('0x11')};}exports[_0x8c32('0x12')]=getFirstInterface;function getCPUhash(){var _0x39e383=_['orderBy'](os[_0x8c32('0x13')]()[_0x8c32('0x14')](function(_0x136c0f){return _0x136c0f[_0x8c32('0x15')];}))['join'](':');return crypto['createHash'](_0x8c32('0x16'))[_0x8c32('0x17')](_0x39e383)[_0x8c32('0x18')]('hex');}exports[_0x8c32('0x19')]=function(){var _0x233b52=os[_0x8c32('0x1a')]();var _0x1c8b10=/[0-9a-f-]{36}/;if(config[_0x8c32('0x1b')]&&_0x1c8b10[_0x8c32('0x1c')](config[_0x8c32('0x1b')])){return config[_0x8c32('0x1b')];}else if(_0x233b52===_0x8c32('0x1d')){return exec(_0x8c32('0x1e'),{'encoding':_0x8c32('0x1f')})[_0x8c32('0x20')]('\x0d\x0a','');}else{var _0x1a75b9=getFirstInterface();var _0x63f7df=getCPUhash();var _0x11d138=_0x63f7df+'|'+os['hostname']()+'|'+_0x1a75b9['macAddress']+'|'+_0x1a75b9[_0x8c32('0x21')];var _0x15b289=crypto['createHash']('md5')[_0x8c32('0x17')](_0x11d138)['digest'](_0x8c32('0x22'));return _0x15b289['substring'](0x0,0x8)+'-'+_0x15b289[_0x8c32('0x23')](0x8,0xc)+'-'+_0x15b289[_0x8c32('0x23')](0xc,0x10)+'-'+_0x15b289['substring'](0x10,0x14)+'-'+_0x15b289[_0x8c32('0x23')](0x14);}}; \ No newline at end of file +var _0x467b=['bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','hex','substring','lodash','crypto'];(function(_0xaa3e6f,_0x24a630){var _0x2b0249=function(_0x576666){while(--_0x576666){_0xaa3e6f['push'](_0xaa3e6f['shift']());}};_0x2b0249(++_0x24a630);}(_0x467b,0xbc));var _0xb467=function(_0x3ed4e3,_0x401c7b){_0x3ed4e3=_0x3ed4e3-0x0;var _0xa722c1=_0x467b[_0x3ed4e3];return _0xa722c1;};'use strict';var _=require(_0xb467('0x0'));var os=require('os');var crypto=require(_0xb467('0x1'));var machine=require(_0xb467('0x2'));var exec=require(_0xb467('0x3'))[_0xb467('0x4')];var config=require(_0xb467('0x5'));function getInterfaces(){var _0x139fb8=[];var _0x55cda9=os[_0xb467('0x6')]();var _0x2cb621=_['orderBy'](_[_0xb467('0x7')](_0x55cda9));for(var _0x36433a=0x0;_0x36433a<_0x2cb621[_0xb467('0x8')];_0x36433a++){var _0x59953b=_0x55cda9[_0x2cb621[_0x36433a]]['filter'](function(_0x25f28a){return _0x25f28a[_0xb467('0x9')]==='IPv4'&&_0x25f28a[_0xb467('0xa')]===![];});_0x139fb8=_0x139fb8[_0xb467('0xb')](_0x59953b);}return _0x139fb8;}function getFirstInterface(){var _0x4a02d1=_[_0xb467('0xc')](getInterfaces());return{'macAddress':_0x4a02d1&&_0x4a02d1['mac']?_0x4a02d1[_0xb467('0xd')]:_0xb467('0xe'),'ipAddress':_0x4a02d1&&_0x4a02d1['address']?_0x4a02d1[_0xb467('0xf')]:_0xb467('0x10')};}exports[_0xb467('0x11')]=getFirstInterface;function getCPUhash(){var _0x3ff7a3=_[_0xb467('0x12')](os[_0xb467('0x13')]()[_0xb467('0x14')](function(_0x3e54c9){return _0x3e54c9[_0xb467('0x15')];}))[_0xb467('0x16')](':');return crypto['createHash'](_0xb467('0x17'))[_0xb467('0x18')](_0x3ff7a3)[_0xb467('0x19')]('hex');}exports[_0xb467('0x1a')]=function(){var _0x4c1c4e=os[_0xb467('0x1b')]();var _0x10bf03=/[0-9a-f-]{36}/;if(config[_0xb467('0x1c')]&&_0x10bf03[_0xb467('0x1d')](config[_0xb467('0x1c')])){return config['licenseToken'];}else if(_0x4c1c4e===_0xb467('0x1e')){return exec(_0xb467('0x1f'),{'encoding':_0xb467('0x20')})[_0xb467('0x21')]('\x0d\x0a','');}else{var _0x47364c=getFirstInterface();var _0x3ab1b9=getCPUhash();var _0x3275ba=_0x3ab1b9+'|'+os[_0xb467('0x22')]()+'|'+_0x47364c['macAddress']+'|'+_0x47364c[_0xb467('0x23')];var _0x31180c=crypto['createHash'](_0xb467('0x17'))['update'](_0x3275ba)[_0xb467('0x19')](_0xb467('0x24'));return _0x31180c[_0xb467('0x25')](0x0,0x8)+'-'+_0x31180c[_0xb467('0x25')](0x8,0xc)+'-'+_0x31180c[_0xb467('0x25')](0xc,0x10)+'-'+_0x31180c[_0xb467('0x25')](0x10,0x14)+'-'+_0x31180c[_0xb467('0x25')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index dfa71da..584e392 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 _0xfdd2=['https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data2','data1','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','error','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license'];(function(_0x5f0676,_0xdaf0e4){var _0x1e11ba=function(_0x5a77ff){while(--_0x5a77ff){_0x5f0676['push'](_0x5f0676['shift']());}};_0x1e11ba(++_0xdaf0e4);}(_0xfdd2,0x128));var _0x2fdd=function(_0x530245,_0x1541ab){_0x530245=_0x530245-0x0;var _0x22506d=_0xfdd2[_0x530245];return _0x22506d;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x2fdd('0x0'));var BPromise=require('bluebird');var pkginfo=require(_0x2fdd('0x1'))(module,_0x2fdd('0x2'));var db=require(_0x2fdd('0x3'))['db'];var encryptor=require(_0x2fdd('0x4'));var hardware=require(_0x2fdd('0x5'));var logger=require(_0x2fdd('0x6'))(_0x2fdd('0x7'));var HOST=_0x2fdd('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x33e927){return new BPromise(function(_0x16ad45,_0xb4edc5){var _0x378431=util[_0x2fdd('0x9')](_0x2fdd('0xa'),HOST,_0x33e927,module[_0x2fdd('0xb')]['version']);if(oldToken){_0x378431=util[_0x2fdd('0x9')](_0x2fdd('0xc'),HOST,_0x33e927,module[_0x2fdd('0xb')]['version'],oldToken);}var _0xc11c47={'uri':_0x378431,'method':_0x2fdd('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xc11c47)['then'](function(_0x3c843e){_0x16ad45(_0x3c843e);})[_0x2fdd('0xe')](function(_0x868e85){_0xb4edc5(_0x868e85);});});}function manageLicense(_0x328f7a,_0x5235ec){var _0x46800e=_0x5235ec['get']({'plain':!![]});if(!isOldTokenSent&&_0x46800e['data1']!==_0x328f7a&&!_0x46800e[_0x2fdd('0xf')]){oldToken=_0x46800e[_0x2fdd('0x10')];}httpRequest(_0x328f7a)[_0x2fdd('0x11')](function(_0x73cbcb){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x73cbcb[_0x2fdd('0x12')]){isOldTokenSent=![];if(!_0x46800e[_0x2fdd('0x7')]&&_0x46800e[_0x2fdd('0x7')]!=_0x73cbcb[_0x2fdd('0x7')]||_0x46800e[_0x2fdd('0x7')]&&_0x46800e[_0x2fdd('0xf')]){logger[_0x2fdd('0x13')](_0x2fdd('0x14'));}if(_0x46800e[_0x2fdd('0x7')]&&!_0x46800e['data2']&&_0x46800e['license']!=_0x73cbcb[_0x2fdd('0x7')]){logger[_0x2fdd('0x13')](_0x2fdd('0x15'));}if(_0x46800e['license']&&!_0x46800e[_0x2fdd('0xf')]&&_0x46800e[_0x2fdd('0x7')]==_0x73cbcb[_0x2fdd('0x7')]){return _0x5235ec;}return _0x5235ec[_0x2fdd('0x16')]({'data1':_0x328f7a,'data2':null,'license':_0x73cbcb[_0x2fdd('0x7')]});}else{if(_0x73cbcb[_0x2fdd('0x7')]||_0x46800e[_0x2fdd('0x7')]){if(!_0x46800e[_0x2fdd('0xf')]){if(_0x46800e[_0x2fdd('0x10')]==_0x328f7a){GRAY_PERIOD_REASON=_0x2fdd('0x17');logger[_0x2fdd('0x13')](_0x2fdd('0x18'));}else{GRAY_PERIOD_REASON=_0x2fdd('0x19');logger[_0x2fdd('0x13')](_0x2fdd('0x1a'),_0x46800e['data1'],_0x328f7a);}logger[_0x2fdd('0x13')](_0x2fdd('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2fdd('0x9')](_0x2fdd('0x1c')));return _0x5235ec[_0x2fdd('0x16')]({'data2':encryptor[_0x2fdd('0x1d')](moment()[_0x2fdd('0x9')](_0x2fdd('0x1c')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x46800e[_0x2fdd('0xf')]),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x2fdd('0x1c')));isOldTokenSent=![];return _0x5235ec['update']({'data1':_0x328f7a,'data2':null,'license':null});}}}else{if(_0x46800e[_0x2fdd('0x10')]!=_0x328f7a){logger[_0x2fdd('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x46800e[_0x2fdd('0x10')],_0x328f7a);return _0x5235ec[_0x2fdd('0x16')]({'data1':_0x328f7a,'data2':null,'license':null});}}}return _0x5235ec;})[_0x2fdd('0x11')](function(_0x22f733){_0x5235ec=_0x22f733;})['catch'](function(_0x3c5788){logger[_0x2fdd('0x1e')](_0x3c5788['message']);})[_0x2fdd('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x2fdd('0x20')](),_0x5235ec);},TIME);});}function defaultLicense(){var _0x44c85c=hardware[_0x2fdd('0x20')]();if(_0x44c85c){return db[_0x2fdd('0x21')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x44c85c}})[_0x2fdd('0x22')](function(_0x13028f,_0x6e8b49){logger[_0x2fdd('0x13')](_0x2fdd('0x23'),_0x44c85c);manageLicense(_0x44c85c,_0x13028f);})[_0x2fdd('0xe')](function(_0x5d15e8){logger[_0x2fdd('0x1e')](_0x5d15e8[_0x2fdd('0x24')]);});}}exports[_0x2fdd('0x25')]=defaultLicense; \ No newline at end of file +var _0xb3b4=['../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','catch','message','finally','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','version'];(function(_0x79fb36,_0x2f6c6f){var _0x536c1d=function(_0x452815){while(--_0x452815){_0x79fb36['push'](_0x79fb36['shift']());}};_0x536c1d(++_0x2f6c6f);}(_0xb3b4,0x12b));var _0x4b3b=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xb3b4[_0x3e112d];return _0x531c31;};'use strict';var util=require(_0x4b3b('0x0'));var moment=require(_0x4b3b('0x1'));var rp=require(_0x4b3b('0x2'));var BPromise=require(_0x4b3b('0x3'));var pkginfo=require('pkginfo')(module,_0x4b3b('0x4'));var db=require(_0x4b3b('0x5'))['db'];var encryptor=require(_0x4b3b('0x6'));var hardware=require(_0x4b3b('0x7'));var logger=require(_0x4b3b('0x8'))('license');var HOST=_0x4b3b('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x131b45){return new BPromise(function(_0x5579ce,_0x45aa1f){var _0x3e88c7=util[_0x4b3b('0xa')](_0x4b3b('0xb'),HOST,_0x131b45,module[_0x4b3b('0xc')][_0x4b3b('0x4')]);if(oldToken){_0x3e88c7=util['format'](_0x4b3b('0xd'),HOST,_0x131b45,module[_0x4b3b('0xc')]['version'],oldToken);}var _0x1dfd65={'uri':_0x3e88c7,'method':_0x4b3b('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1dfd65)['then'](function(_0x120577){_0x5579ce(_0x120577);})['catch'](function(_0x31dd8d){_0x45aa1f(_0x31dd8d);});});}function manageLicense(_0x4f4363,_0x4f7c12){var _0x4b3e47=_0x4f7c12['get']({'plain':!![]});if(!isOldTokenSent&&_0x4b3e47[_0x4b3b('0xf')]!==_0x4f4363&&!_0x4b3e47[_0x4b3b('0x10')]){oldToken=_0x4b3e47[_0x4b3b('0xf')];}httpRequest(_0x4f4363)[_0x4b3b('0x11')](function(_0x3980d6){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3980d6[_0x4b3b('0x12')]){isOldTokenSent=![];if(!_0x4b3e47[_0x4b3b('0x13')]&&_0x4b3e47[_0x4b3b('0x13')]!=_0x3980d6[_0x4b3b('0x13')]||_0x4b3e47[_0x4b3b('0x13')]&&_0x4b3e47[_0x4b3b('0x10')]){logger[_0x4b3b('0x14')](_0x4b3b('0x15'));}if(_0x4b3e47['license']&&!_0x4b3e47[_0x4b3b('0x10')]&&_0x4b3e47[_0x4b3b('0x13')]!=_0x3980d6[_0x4b3b('0x13')]){logger['info'](_0x4b3b('0x16'));}if(_0x4b3e47[_0x4b3b('0x13')]&&!_0x4b3e47[_0x4b3b('0x10')]&&_0x4b3e47['license']==_0x3980d6[_0x4b3b('0x13')]){return _0x4f7c12;}return _0x4f7c12[_0x4b3b('0x17')]({'data1':_0x4f4363,'data2':null,'license':_0x3980d6[_0x4b3b('0x13')]});}else{if(_0x3980d6['license']||_0x4b3e47[_0x4b3b('0x13')]){if(!_0x4b3e47[_0x4b3b('0x10')]){if(_0x4b3e47[_0x4b3b('0xf')]==_0x4f4363){GRAY_PERIOD_REASON=_0x4b3b('0x18');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4b3b('0x19');logger[_0x4b3b('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4b3e47[_0x4b3b('0xf')],_0x4f4363);}logger[_0x4b3b('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x4b3b('0xa')](_0x4b3b('0x1a')));return _0x4f7c12[_0x4b3b('0x17')]({'data2':encryptor['encryptString'](moment()[_0x4b3b('0xa')](_0x4b3b('0x1a')))});}else{if(moment()[_0x4b3b('0x1b')](encryptor[_0x4b3b('0x1c')](_0x4b3e47[_0x4b3b('0x10')]),_0x4b3b('0x1d'))>DAYS){logger[_0x4b3b('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0x4b3b('0xa')](_0x4b3b('0x1a')));isOldTokenSent=![];return _0x4f7c12[_0x4b3b('0x17')]({'data1':_0x4f4363,'data2':null,'license':null});}}}else{if(_0x4b3e47[_0x4b3b('0xf')]!=_0x4f4363){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4b3e47[_0x4b3b('0xf')],_0x4f4363);return _0x4f7c12[_0x4b3b('0x17')]({'data1':_0x4f4363,'data2':null,'license':null});}}}return _0x4f7c12;})[_0x4b3b('0x11')](function(_0x53dd2a){_0x4f7c12=_0x53dd2a;})[_0x4b3b('0x1e')](function(_0x28a2e7){logger['error'](_0x28a2e7[_0x4b3b('0x1f')]);})[_0x4b3b('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x4b3b('0x21')](),_0x4f7c12);},TIME);});}function defaultLicense(){var _0x4cc70f=hardware[_0x4b3b('0x21')]();if(_0x4cc70f){return db[_0x4b3b('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4cc70f}})['spread'](function(_0x3ceba6,_0x4f78c4){logger[_0x4b3b('0x14')](_0x4b3b('0x23'),_0x4cc70f);manageLicense(_0x4cc70f,_0x3ceba6);})[_0x4b3b('0x1e')](function(_0x380fe4){logger[_0x4b3b('0x24')](_0x380fe4[_0x4b3b('0x1f')]);});}}exports[_0x4b3b('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index bee7ea1..d62a7b2 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 _0x682b=['sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','moment','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','gray','deadline','add','days','grayReason','machineUuid','changed','message','findAll','role'];(function(_0xbbebbf,_0x5c4820){var _0x2fba5a=function(_0x3026b4){while(--_0x3026b4){_0xbbebbf['push'](_0xbbebbf['shift']());}};_0x2fba5a(++_0x5c4820);}(_0x682b,0x1da));var _0xb682=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x682b[_0x7e2eb0];return _0xd92de4;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xb682('0x0'));var BPromise=require('bluebird');var hardware=require(_0xb682('0x1'));var encryptor=require(_0xb682('0x2'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb682('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xb682('0x4')](),'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':_0xb682('0x5'),'machineUuid':hardware[_0xb682('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x18b87f){return new BPromise(function(_0x2e622c,_0x24de2f){return db[_0xb682('0x6')][_0xb682('0x7')](_[_0xb682('0x8')](_0x18b87f,{'raw':!![],'where':{'id':0x1}}))[_0xb682('0x9')](function(_0xbf3710){return checkLicense(_0xbf3710,null);})['then'](function(_0x68aac7){_0x2e622c(_0x68aac7);return;})[_0xb682('0xa')](function(_0x1f7cd3){_0x24de2f(_0x1f7cd3);});});}function checkLicense(_0x24f0d4,_0x240a5a){if(!_0x24f0d4){demoLicense[_0xb682('0xb')]=_0x24f0d4[_0xb682('0xc')];return demoLicense;}try{var _0x39858b=_0x240a5a||_0x24f0d4[_0xb682('0xd')];if(_[_0xb682('0xe')](_0x39858b)){throw new Error(_0xb682('0xf'));}var _0x740af=_0x24f0d4[_0xb682('0xc')];var _0x50f655=_0x24f0d4[_0xb682('0x10')];var _0x49e8ec=_0x740af[_0xb682('0x11')]('-')[0x4];var _0x3bb819=_0x740af[_0xb682('0x11')]('-')[0x0];var _0x200ff5=encryptor[_0xb682('0x12')](_0x39858b,util[_0xb682('0x13')](_0xb682('0x14'),_0x49e8ec,_0x740af,_0x3bb819));var _0xf030cf=JSON['parse'](_0x200ff5);_0xf030cf[_0xb682('0x15')]=![];_0xf030cf[_0xb682('0xb')]=_0x740af;_0xf030cf['machineUuid']=hardware['getUuid']();if(_0x50f655){var _0xbb6eca=encryptor[_0xb682('0x12')](_0x50f655);_0xf030cf[_0xb682('0x16')]=_0xbb6eca;_0xf030cf[_0xb682('0x17')]=moment(_0xbb6eca)[_0xb682('0x18')](0x7,_0xb682('0x19'))[_0xb682('0x13')]();_0xf030cf[_0xb682('0x1a')]=_0xf030cf[_0xb682('0xb')]!=_0xf030cf[_0xb682('0x1b')]?_0xb682('0x1c'):'disabled';}return _0xf030cf;}catch(_0x32a0e8){breakingLicense['uuid']=_0x24f0d4[_0xb682('0xc')];breakingLicense[_0xb682('0x1d')]=_0x32a0e8[_0xb682('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1a05ba,_0x5bf1d0){getLicense()[_0xb682('0x9')](function(_0x1a2391){return db['User'][_0xb682('0x1e')]({'attributes':[_0xb682('0x1f'),[db[_0xb682('0x20')]['fn'](_0xb682('0x21'),db[_0xb682('0x20')]['col']('role')),_0xb682('0x22')]],'group':_0xb682('0x1f'),'where':{'role':{'$or':[_0xb682('0x23'),_0xb682('0x24'),_0xb682('0x25')]}},'raw':!![]})[_0xb682('0x9')](function(_0x113b88){var _0x3575fb={'user':_0x1a2391[_0xb682('0x26')]||0x0,'telephone':_0x1a2391[_0xb682('0x27')]||0x0};_0x113b88[_0xb682('0x28')](function(_0x22f9ae){var _0x1fbba1=_0x22f9ae[_0xb682('0x1f')]===_0xb682('0x23')?_0xb682('0x24'):_0x22f9ae['role'];_0x3575fb[_0x1fbba1]-=_0x22f9ae[_0xb682('0x22')];if(_0x3575fb[_0x1fbba1]<0x0)_0x3575fb[_0x1fbba1]=0x0;});_0x1a05ba(_0x3575fb);return;});})[_0xb682('0xa')](function(_0xff3fd9){_0x5bf1d0(_0xff3fd9);});});}function checkUserLimits(_0x580217){return new BPromise(function(_0x59ea6b,_0x25befa){getLimits()[_0xb682('0x9')](function(_0x4a1748){var _0x14151b=_[_0xb682('0x29')](_[_0xb682('0x2a')](_0x580217,_0xb682('0x1f')),[_0xb682('0x23'),'user',_0xb682('0x25')]);var _0x17a693=(_0x14151b[_0xb682('0x23')]||0x0)+(_0x14151b[_0xb682('0x24')]||0x0);var _0x250867=_0x14151b[_0xb682('0x25')]||0x0;if(_0x17a693>_0x4a1748[_0xb682('0x24')])return _0x25befa(_0xb682('0x2b'));if(_0x250867>_0x4a1748[_0xb682('0x25')])return _0x25befa(_0xb682('0x2c'));return _0x59ea6b();})['catch'](function(_0xa3e308){_0x25befa(_0xa3e308);});});}module[_0xb682('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xa535=['admin','user','telephone','users','forEach','pick','countBy','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','defaults','catch','uuid','license','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','machineUuid','deadline','add','days','grayReason','changed','disabled','data1','message','then','User','role','sequelize','COUNT','col','count'];(function(_0x11e213,_0x4f2b14){var _0x504df2=function(_0x439750){while(--_0x439750){_0x11e213['push'](_0x11e213['shift']());}};_0x504df2(++_0x4f2b14);}(_0xa535,0x168));var _0x5a53=function(_0xc36898,_0x41fe81){_0xc36898=_0xc36898-0x0;var _0x583de3=_0xa535[_0xc36898];return _0x583de3;};'use strict';var util=require(_0x5a53('0x0'));var _=require('lodash');var moment=require(_0x5a53('0x1'));var BPromise=require(_0x5a53('0x2'));var hardware=require(_0x5a53('0x3'));var encryptor=require(_0x5a53('0x4'));var db=require(_0x5a53('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5a53('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5a53('0x7'),'machineUuid':hardware[_0x5a53('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3b9a1d){return new BPromise(function(_0x484fa1,_0x150457){return db[_0x5a53('0x9')]['find'](_[_0x5a53('0xa')](_0x3b9a1d,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3ffbff){return checkLicense(_0x3ffbff,null);})['then'](function(_0x11c124){_0x484fa1(_0x11c124);return;})[_0x5a53('0xb')](function(_0x4fad3d){_0x150457(_0x4fad3d);});});}function checkLicense(_0x5e94b6,_0x424744){if(!_0x5e94b6){demoLicense[_0x5a53('0xc')]=_0x5e94b6['data1'];return demoLicense;}try{var _0x2570a4=_0x424744||_0x5e94b6[_0x5a53('0xd')];if(_['isEmpty'](_0x2570a4)){throw new Error(_0x5a53('0xe'));}var _0x26b3aa=_0x5e94b6['data1'];var _0x23d33e=_0x5e94b6['data2'];var _0x1040fa=_0x26b3aa[_0x5a53('0xf')]('-')[0x4];var _0x276034=_0x26b3aa[_0x5a53('0xf')]('-')[0x0];var _0x365c85=encryptor[_0x5a53('0x10')](_0x2570a4,util[_0x5a53('0x11')](_0x5a53('0x12'),_0x1040fa,_0x26b3aa,_0x276034));var _0x3b415b=JSON[_0x5a53('0x13')](_0x365c85);_0x3b415b['demo']=![];_0x3b415b[_0x5a53('0xc')]=_0x26b3aa;_0x3b415b[_0x5a53('0x14')]=hardware['getUuid']();if(_0x23d33e){var _0x452442=encryptor[_0x5a53('0x10')](_0x23d33e);_0x3b415b['gray']=_0x452442;_0x3b415b[_0x5a53('0x15')]=moment(_0x452442)[_0x5a53('0x16')](0x7,_0x5a53('0x17'))[_0x5a53('0x11')]();_0x3b415b[_0x5a53('0x18')]=_0x3b415b['uuid']!=_0x3b415b[_0x5a53('0x14')]?_0x5a53('0x19'):_0x5a53('0x1a');}return _0x3b415b;}catch(_0x40ed86){breakingLicense['uuid']=_0x5e94b6[_0x5a53('0x1b')];breakingLicense[_0x5a53('0x1c')]=_0x40ed86[_0x5a53('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3d67c0,_0x2f8d74){getLicense()[_0x5a53('0x1d')](function(_0x4ff689){return db[_0x5a53('0x1e')]['findAll']({'attributes':[_0x5a53('0x1f'),[db[_0x5a53('0x20')]['fn'](_0x5a53('0x21'),db[_0x5a53('0x20')][_0x5a53('0x22')](_0x5a53('0x1f'))),_0x5a53('0x23')]],'group':'role','where':{'role':{'$or':[_0x5a53('0x24'),_0x5a53('0x25'),_0x5a53('0x26')]}},'raw':!![]})[_0x5a53('0x1d')](function(_0x2749e0){var _0x1c0ffb={'user':_0x4ff689[_0x5a53('0x27')]||0x0,'telephone':_0x4ff689['telephones']||0x0};_0x2749e0[_0x5a53('0x28')](function(_0x214ad7){var _0x475ced=_0x214ad7[_0x5a53('0x1f')]===_0x5a53('0x24')?_0x5a53('0x25'):_0x214ad7[_0x5a53('0x1f')];_0x1c0ffb[_0x475ced]-=_0x214ad7[_0x5a53('0x23')];if(_0x1c0ffb[_0x475ced]<0x0)_0x1c0ffb[_0x475ced]=0x0;});_0x3d67c0(_0x1c0ffb);return;});})[_0x5a53('0xb')](function(_0x481f29){_0x2f8d74(_0x481f29);});});}function checkUserLimits(_0x3070e0){return new BPromise(function(_0x5b625e,_0x297143){getLimits()[_0x5a53('0x1d')](function(_0x20f00f){var _0x2d616c=_[_0x5a53('0x29')](_[_0x5a53('0x2a')](_0x3070e0,_0x5a53('0x1f')),['admin',_0x5a53('0x25'),_0x5a53('0x26')]);var _0x423538=(_0x2d616c[_0x5a53('0x24')]||0x0)+(_0x2d616c[_0x5a53('0x25')]||0x0);var _0x3e1e1f=_0x2d616c[_0x5a53('0x26')]||0x0;if(_0x423538>_0x20f00f[_0x5a53('0x25')])return _0x297143('License\x20limit\x20reached\x20for\x20users');if(_0x3e1e1f>_0x20f00f['telephone'])return _0x297143('License\x20limit\x20reached\x20for\x20telephones');return _0x5b625e();})['catch'](function(_0x485e8e){_0x297143(_0x485e8e);});});}module[_0x5a53('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index b1167a3..c539929 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 _0xab40=['http://localhost:9000','exports'];(function(_0xb6f59,_0x240181){var _0x20f32d=function(_0x2104b6){while(--_0x2104b6){_0xb6f59['push'](_0xb6f59['shift']());}};_0x20f32d(++_0x240181);}(_0xab40,0xcd));var _0x0ab4=function(_0x433b61,_0x1eb8df){_0x433b61=_0x433b61-0x0;var _0x4c9a12=_0xab40[_0x433b61];return _0x4c9a12;};'use strict';module[_0x0ab4('0x0')]={'DOMAIN':_0x0ab4('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x5f66=['app-id','secret','http://localhost:9000'];(function(_0x548e55,_0x309996){var _0x38d80a=function(_0xd40467){while(--_0xd40467){_0x548e55['push'](_0x548e55['shift']());}};_0x38d80a(++_0x309996);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';module['exports']={'DOMAIN':_0x65f6('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x65f6('0x1'),'GOOGLE_SECRET':_0x65f6('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 303f590..b719220 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78e6=['../utils/loggers','exports'];(function(_0x49f2a1,_0x2623e0){var _0x1d0ad3=function(_0x36f38){while(--_0x36f38){_0x49f2a1['push'](_0x49f2a1['shift']());}};_0x1d0ad3(++_0x2623e0);}(_0x78e6,0x122));var _0x678e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x78e6[_0x4a9fb1];return _0x348672;};'use strict';var fileLogger=require(_0x678e('0x0'))['fileLogger'];module[_0x678e('0x1')]=fileLogger; \ No newline at end of file +var _0x550f=['fileLogger','exports'];(function(_0xf66b9,_0x3c0a11){var _0x1305f6=function(_0x468506){while(--_0x468506){_0xf66b9['push'](_0xf66b9['shift']());}};_0x1305f6(++_0x3c0a11);}(_0x550f,0xc6));var _0xf550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550f[_0x3dd15e];return _0x231fd0;};'use strict';var fileLogger=require('../utils/loggers')[_0xf550('0x0')];module[_0xf550('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c2c84d9..8c18a3e 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 _0xbef8=['../../services/agi/index.js','email','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x1aa1d3,_0x56eeee){var _0x99c18e=function(_0x52cbe5){while(--_0x52cbe5){_0x1aa1d3['push'](_0x1aa1d3['shift']());}};_0x99c18e(++_0x56eeee);}(_0xbef8,0x17c));var _0x8bef=function(_0x480708,_0x46a37c){_0x480708=_0x480708-0x0;var _0x348a0d=_0xbef8[_0x480708];return _0x348a0d;};'use strict';var path=require(_0x8bef('0x0'));var cfg=require(_0x8bef('0x1'));var env={'NODE_PATH':path[_0x8bef('0x2')](path[_0x8bef('0x3')](cfg[_0x8bef('0x4')],_0x8bef('0x5')))};var pm2config={'apps':[{'name':_0x8bef('0x6'),'script':path[_0x8bef('0x3')](__dirname,_0x8bef('0x7')),'env':env},{'name':_0x8bef('0x8'),'script':path[_0x8bef('0x3')](__dirname,_0x8bef('0x9')),'env':env},{'name':_0x8bef('0xa'),'script':path[_0x8bef('0x3')](__dirname,_0x8bef('0xb')),'env':env},{'name':_0x8bef('0xc'),'script':path[_0x8bef('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x8bef('0x3')](__dirname,_0x8bef('0xd')),'env':env},{'name':_0x8bef('0xe'),'script':path[_0x8bef('0x3')](__dirname,_0x8bef('0xf')),'env':env}]};module[_0x8bef('0x10')]=pm2config; \ No newline at end of file +var _0x32c0=['legacy-libs','express','ami','join','../../services/ami/index.js','agi','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment','resolve','root'];(function(_0x139c54,_0x53f5a0){var _0x388d4c=function(_0x4d81bd){while(--_0x4d81bd){_0x139c54['push'](_0x139c54['shift']());}};_0x388d4c(++_0x53f5a0);}(_0x32c0,0xa1));var _0x032c=function(_0x43fb3d,_0x114a73){_0x43fb3d=_0x43fb3d-0x0;var _0x47fd81=_0x32c0[_0x43fb3d];return _0x47fd81;};'use strict';var path=require(_0x032c('0x0'));var cfg=require(_0x032c('0x1'));var env={'NODE_PATH':path[_0x032c('0x2')](path['join'](cfg[_0x032c('0x3')],_0x032c('0x4')))};var pm2config={'apps':[{'name':_0x032c('0x5'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x032c('0x6'),'script':path[_0x032c('0x7')](__dirname,_0x032c('0x8')),'env':env},{'name':_0x032c('0x9'),'script':path[_0x032c('0x7')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x032c('0xa'),'script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x032c('0xb'),'script':path[_0x032c('0x7')](__dirname,_0x032c('0xc')),'env':env},{'name':_0x032c('0xd'),'script':path[_0x032c('0x7')](__dirname,_0x032c('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 8420401..3a1cb58 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 _0xa461=['./config','connect','connected','then','start','disconnect','restart','list','describe','delete','dump','pm2'];(function(_0x2493a8,_0x5a240d){var _0x2b06c9=function(_0x198d3c){while(--_0x198d3c){_0x2493a8['push'](_0x2493a8['shift']());}};_0x2b06c9(++_0x5a240d);}(_0xa461,0xb3));var _0x1a46=function(_0x43df6f,_0x4ff749){_0x43df6f=_0x43df6f-0x0;var _0x5373a2=_0xa461[_0x43df6f];return _0x5373a2;};'use strict';var pm2=require(_0x1a46('0x0'));var BPromise=require('bluebird');var config=require(_0x1a46('0x1'));function connect(){return new BPromise(function(_0x1858f4,_0xc5deaf){return pm2[_0x1a46('0x2')](function(_0x2d4944){if(_0x2d4944){return _0xc5deaf(_0x2d4944);}return _0x1858f4(_0x1a46('0x3'));});});};exports['start']=function(_0x153898){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x57600d,_0x3bccb6){return pm2[_0x1a46('0x5')](_0x153898,function(_0x3eb3c4,_0x916173){if(_0x3eb3c4){return _0x3bccb6(_0x3eb3c4);}pm2[_0x1a46('0x6')]();return _0x57600d(_0x916173);});});});};exports['stop']=function(_0x51b9a8){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x2cc947,_0x3bb613){return pm2['stop'](_0x51b9a8,function(_0x530f1b,_0x38c9b0){if(_0x530f1b){return _0x3bb613(_0x530f1b);}pm2[_0x1a46('0x6')]();return _0x2cc947(_0x38c9b0);});});});};exports[_0x1a46('0x7')]=function(_0x476e16){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x285850,_0xa79572){return pm2[_0x1a46('0x7')](_0x476e16,function(_0x4820e8,_0x5cfd79){if(_0x4820e8){return _0xa79572(_0x4820e8);}pm2[_0x1a46('0x6')]();return _0x285850(_0x5cfd79);});});});};exports[_0x1a46('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2ff019,_0x2b9419){return pm2[_0x1a46('0x8')](function(_0x43834b,_0x4af5a1){if(_0x43834b){return _0x2b9419(_0x43834b);}pm2[_0x1a46('0x6')]();return _0x2ff019(_0x4af5a1);});});});};exports[_0x1a46('0x9')]=function(_0x1c21d5){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x5a87f3,_0x28a7fe){return pm2['describe'](_0x1c21d5,function(_0x1dd6b8,_0x515843){if(_0x1dd6b8){return _0x28a7fe(_0x1dd6b8);}pm2['disconnect']();return _0x5a87f3(_0x515843);});});});};exports[_0x1a46('0xa')]=function(_0x15435b){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x4c715a,_0x24a1c3){return pm2[_0x1a46('0xa')](_0x15435b,function(_0x2a5fc8,_0x1e3027){if(_0x2a5fc8){return _0x24a1c3(_0x2a5fc8);}pm2['disconnect']();return _0x4c715a(_0x1e3027);});});});};exports[_0x1a46('0xb')]=function(){return connect()[_0x1a46('0x4')](function(){return new BPromise(function(_0x14295b,_0x5e6154){return pm2[_0x1a46('0xb')](function(_0x20b689){if(_0x20b689){return _0x5e6154(_0x20b689);}return _0x14295b('saved');});});});}; \ No newline at end of file +var _0xa004=['list','describe','dump','saved','pm2','bluebird','./config','connected','start','disconnect','stop','then','restart'];(function(_0x145b54,_0x267c42){var _0x52007e=function(_0xfc9fdf){while(--_0xfc9fdf){_0x145b54['push'](_0x145b54['shift']());}};_0x52007e(++_0x267c42);}(_0xa004,0x93));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x4a00('0x0'));var BPromise=require(_0x4a00('0x1'));var config=require(_0x4a00('0x2'));function connect(){return new BPromise(function(_0x16f4bc,_0x316e75){return pm2['connect'](function(_0x47a489){if(_0x47a489){return _0x316e75(_0x47a489);}return _0x16f4bc(_0x4a00('0x3'));});});};exports[_0x4a00('0x4')]=function(_0x2c28cf){return connect()['then'](function(){return new BPromise(function(_0x53e24f,_0x3b1744){return pm2[_0x4a00('0x4')](_0x2c28cf,function(_0x259d12,_0x42450b){if(_0x259d12){return _0x3b1744(_0x259d12);}pm2[_0x4a00('0x5')]();return _0x53e24f(_0x42450b);});});});};exports[_0x4a00('0x6')]=function(_0x1db5bd){return connect()[_0x4a00('0x7')](function(){return new BPromise(function(_0x31ea4e,_0x2a08cb){return pm2[_0x4a00('0x6')](_0x1db5bd,function(_0x4963cd,_0x2bb2af){if(_0x4963cd){return _0x2a08cb(_0x4963cd);}pm2[_0x4a00('0x5')]();return _0x31ea4e(_0x2bb2af);});});});};exports[_0x4a00('0x8')]=function(_0x2349a7){return connect()['then'](function(){return new BPromise(function(_0x5dcf1e,_0x39fc6d){return pm2[_0x4a00('0x8')](_0x2349a7,function(_0x4e7430,_0xb75f2b){if(_0x4e7430){return _0x39fc6d(_0x4e7430);}pm2[_0x4a00('0x5')]();return _0x5dcf1e(_0xb75f2b);});});});};exports[_0x4a00('0x9')]=function(){return connect()[_0x4a00('0x7')](function(){return new BPromise(function(_0x14fb2a,_0x8ecbe4){return pm2[_0x4a00('0x9')](function(_0x2b4779,_0x12a25c){if(_0x2b4779){return _0x8ecbe4(_0x2b4779);}pm2['disconnect']();return _0x14fb2a(_0x12a25c);});});});};exports[_0x4a00('0xa')]=function(_0xe2c4e9){return connect()[_0x4a00('0x7')](function(){return new BPromise(function(_0x2490d0,_0x3dbee2){return pm2[_0x4a00('0xa')](_0xe2c4e9,function(_0x3ce399,_0x1e1387){if(_0x3ce399){return _0x3dbee2(_0x3ce399);}pm2['disconnect']();return _0x2490d0(_0x1e1387);});});});};exports['delete']=function(_0x160559){return connect()['then'](function(){return new BPromise(function(_0x1da931,_0x26afd9){return pm2['delete'](_0x160559,function(_0xd4010d,_0x402852){if(_0xd4010d){return _0x26afd9(_0xd4010d);}pm2[_0x4a00('0x5')]();return _0x1da931(_0x402852);});});});};exports[_0x4a00('0xb')]=function(){return connect()[_0x4a00('0x7')](function(){return new BPromise(function(_0x260056,_0x3d7fdf){return pm2[_0x4a00('0xb')](function(_0x47596c){if(_0x47596c){return _0x3d7fdf(_0x47596c);}return _0x260056(_0x4a00('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 97292c7..afd7171 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 _0xf5a0=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch'];(function(_0x3ce17e,_0x9aa616){var _0x251a99=function(_0x1f0aaf){while(--_0x1f0aaf){_0x3ce17e['push'](_0x3ce17e['shift']());}};_0x251a99(++_0x9aa616);}(_0xf5a0,0x69));var _0x0f5a=function(_0x4cd685,_0x472697){_0x4cd685=_0x4cd685-0x0;var _0x37743e=_0xf5a0[_0x4cd685];return _0x37743e;};'use strict';var _=require(_0x0f5a('0x0'));var moment=require(_0x0f5a('0x1'));var Redis=require(_0x0f5a('0x2'));var util=require(_0x0f5a('0x3'));var config=require('../../config/environment');var db=require(_0x0f5a('0x4'))['db'];var logger=require(_0x0f5a('0x5'))(_0x0f5a('0x6'));config['redis']=_[_0x0f5a('0x7')](config[_0x0f5a('0x8')],{'host':_0x0f5a('0x9'),'port':0x18eb});var io=require(_0x0f5a('0xa'))(new Redis(config[_0x0f5a('0x8')]));function closeInteractions(){var _0x1533e5=0x0;var _0x267678=[];return db[_0x0f5a('0xb')][_0x0f5a('0xc')]({'raw':!![],'attributes':['id',_0x0f5a('0xd')],'where':{'id':0x1}})[_0x0f5a('0xe')](function(_0x294efa){_0x1533e5=_0x294efa[_0x0f5a('0xd')];if(_0x1533e5){return db[_0x0f5a('0xf')][_0x0f5a('0x10')]({'raw':!![],'attributes':['id',_0x0f5a('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0f5a('0x12')](_0x294efa[_0x0f5a('0xd')],'minutes')}}});}else{return[];}})[_0x0f5a('0xe')](function(_0x24d715){if(_0x24d715&&_0x24d715['length']){_0x267678=_[_0x0f5a('0x13')](_0x24d715||[],'id');logger[_0x0f5a('0x14')](_0x0f5a('0x15'),_0x267678[_0x0f5a('0x16')]());return db[_0x0f5a('0xf')][_0x0f5a('0x17')]({'closeReason':_0x0f5a('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x0f5a('0x19')](_0x0f5a('0x1a'))},{'where':{'id':_0x267678}});}})['then'](function(){if(_0x267678&&_0x267678[_0x0f5a('0x1b')]){logger[_0x0f5a('0x14')](_0x0f5a('0x1c'),_0x267678[_0x0f5a('0x16')]());for(var _0x9014c2=0x0;_0x9014c2<_0x267678['length'];_0x9014c2++){io['emit'](_0x0f5a('0x1d'),{'id':_0x267678[_0x9014c2],'closed':!![]});}}})[_0x0f5a('0x1e')](function(_0x31246d){logger['error'](_0x0f5a('0x1f'),_0x31246d?util[_0x0f5a('0x20')](_0x31246d,{'showHidden':![],'depth':null}):'');});}exports[_0x0f5a('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7577=['chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','defaults','redis','socket.io-emitter','find','then'];(function(_0x81f738,_0x576329){var _0xe6b18c=function(_0x30c5e4){while(--_0x30c5e4){_0x81f738['push'](_0x81f738['shift']());}};_0xe6b18c(++_0x576329);}(_0x7577,0xf2));var _0x7757=function(_0x172e4a,_0x392849){_0x172e4a=_0x172e4a-0x0;var _0x539454=_0x7577[_0x172e4a];return _0x539454;};'use strict';var _=require(_0x7757('0x0'));var moment=require(_0x7757('0x1'));var Redis=require(_0x7757('0x2'));var util=require(_0x7757('0x3'));var config=require(_0x7757('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config['redis']=_[_0x7757('0x5')](config[_0x7757('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x7757('0x7'))(new Redis(config[_0x7757('0x6')]));function closeInteractions(){var _0x3d772e=0x0;var _0xe35884=[];return db['Setting'][_0x7757('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x7757('0x9')](function(_0x46e072){_0x3d772e=_0x46e072[_0x7757('0xa')];if(_0x3d772e){return db[_0x7757('0xb')][_0x7757('0xc')]({'raw':!![],'attributes':['id',_0x7757('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x46e072[_0x7757('0xa')],_0x7757('0xe'))}}});}else{return[];}})['then'](function(_0x1e077a){if(_0x1e077a&&_0x1e077a[_0x7757('0xf')]){_0xe35884=_[_0x7757('0x10')](_0x1e077a||[],'id');logger['info'](_0x7757('0x11'),_0xe35884[_0x7757('0x12')]());return db[_0x7757('0xb')][_0x7757('0x13')]({'closeReason':_0x7757('0x14'),'disposition':_0x7757('0x15'),'closed':!![],'closedAt':moment()['format'](_0x7757('0x16'))},{'where':{'id':_0xe35884}});}})[_0x7757('0x9')](function(){if(_0xe35884&&_0xe35884['length']){logger[_0x7757('0x17')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xe35884[_0x7757('0x12')]());for(var _0x5a9079=0x0;_0x5a9079<_0xe35884['length'];_0x5a9079++){io['emit']('chatInteraction:update',{'id':_0xe35884[_0x5a9079],'closed':!![]});}}})[_0x7757('0x18')](function(_0x564c39){logger['error'](_0x7757('0x19'),_0x564c39?util[_0x7757('0x1a')](_0x564c39,{'showHidden':![],'depth':null}):'');});}exports[_0x7757('0x1b')]=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 dd4cd8e..a02869f 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 _0x96de=['startAllRefreshIntervals','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x96de,0x8c));var _0xe96d=function(_0x1254b4,_0x13b275){_0x1254b4=_0x1254b4-0x0;var _0x2de247=_0x96de[_0x1254b4];return _0x2de247;};'use strict';function start(){var _0x5a223b=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x5a223b[_0xe96d('0x0')]();}module[_0xe96d('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x06bc=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x585729,_0x30c1f7){var _0x352998=function(_0x44cbd4){while(--_0x44cbd4){_0x585729['push'](_0x585729['shift']());}};_0x352998(++_0x30c1f7);}(_0x06bc,0x11c));var _0xc06b=function(_0x212e6a,_0x3e6695){_0x212e6a=_0x212e6a-0x0;var _0x4be55b=_0x06bc[_0x212e6a];return _0x4be55b;};'use strict';function start(){var _0x428440=require(_0xc06b('0x0'));return _0x428440[_0xc06b('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index b06b1ac..b97534f 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 _0x61ec=['active','isBetween','startAt','add','add\x20cron','exists','stop\x20cron','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','user','bcc','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','stringify','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','toString','keyBy','difference','intersection','length','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron'];(function(_0x3b371d,_0x2cdf47){var _0x2227f2=function(_0x395806){while(--_0x395806){_0x3b371d['push'](_0x3b371d['shift']());}};_0x2227f2(++_0x2cdf47);}(_0x61ec,0xb0));var _0xc61e=function(_0x209238,_0x43cc6b){_0x209238=_0x209238-0x0;var _0x3de0e0=_0x61ec[_0x209238];return _0x3de0e0;};'use strict';var fs=require('fs');var util=require(_0xc61e('0x0'));var path=require(_0xc61e('0x1'));var _=require(_0xc61e('0x2'));var moment=require(_0xc61e('0x3'));var CronJobManager=require(_0xc61e('0x4'));var jayson=require(_0xc61e('0x5'));var BPromise=require('bluebird');var logger=require(_0xc61e('0x6'))('schedule');var db=require(_0xc61e('0x7'))['db'];var analyticCustomReportController=require(_0xc61e('0x8'));var analyticDefaultReportController=require(_0xc61e('0x9'));var client=jayson[_0xc61e('0xa')][_0xc61e('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2bd629,_0x108698){return function(){logger[_0xc61e('0xc')](_0xc61e('0xd'),_0x2bd629[_0xc61e('0xe')]);var _0xb35f52=!![];var _0x155e37=_0x2bd629[_0xc61e('0xf')][_0xc61e('0x10')]();var _0x5f2e1a={'account':_0x155e37,'message':{'from':util[_0xc61e('0x11')](_0xc61e('0x12'),_0x2bd629[_0xc61e('0xf')][_0xc61e('0x13')],_0x2bd629['MailAccount'][_0xc61e('0xe')]||_0x2bd629['MailAccount']['Smtp'][_0xc61e('0x14')]),'to':_0x2bd629[_0xc61e('0xe')],'cc':_0x2bd629['cc'],'bcc':_0x2bd629[_0xc61e('0x15')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x108698['name'],_0x2bd629[_0xc61e('0x16')],_0x2bd629[_0xc61e('0x17')])}};var _0x4a8f84=path[_0xc61e('0x18')](__dirname,'../../files/reports');var _0x242d72=_0x108698[_0xc61e('0x19')];var _0x33c2f4=util[_0xc61e('0x11')](_0xc61e('0x1a'),path[_0xc61e('0x1b')](_0x108698[_0xc61e('0x19')],path[_0xc61e('0x1c')](_0x108698[_0xc61e('0x19')])),_0xc61e('0x1d'));var _0x2cb8f=path[_0xc61e('0x18')](_0x4a8f84,_0x242d72);var _0x59197f=path['join'](_0x4a8f84,_0x33c2f4);if(fs[_0xc61e('0x1e')](_0x2cb8f)){_0x108698[_0xc61e('0x1f')]=_0xc61e('0x20');_0x5f2e1a[_0xc61e('0x21')][_0xc61e('0x22')]=[{'filename':_0x242d72,'path':_0x2cb8f}];_0x5f2e1a[_0xc61e('0x21')]['text']=util[_0xc61e('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xc61e('0x23')](_0x108698,null,0x2));}else if(fs[_0xc61e('0x1e')](_0x59197f)){_0x108698[_0xc61e('0x1f')]=_0xc61e('0x20');_0x5f2e1a[_0xc61e('0x21')]['attachments']=[{'filename':_0x33c2f4,'path':_0x59197f}];}else{_0x5f2e1a[_0xc61e('0x21')][_0xc61e('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2bd629[_0xc61e('0x25')]){_0xb35f52=![];logger[_0xc61e('0xc')](_0xc61e('0x26'));}}if(_0xb35f52){return client[_0xc61e('0x27')]('SendMail',_0x5f2e1a)['then'](function(_0x41312e){if(_0x41312e['error']){return logger[_0xc61e('0x28')](_0xc61e('0x29'),JSON[_0xc61e('0x23')](_0x41312e));}return logger[_0xc61e('0xc')](_0xc61e('0x2a'));})[_0xc61e('0x2b')](function(_0x335ca8){return logger['error'](_0xc61e('0x29'),JSON[_0xc61e('0x23')](_0x335ca8));});}};}function handleError(){return function(_0x455600){return logger[_0xc61e('0x28')](JSON[_0xc61e('0x23')](_0x455600));};}function handleResult(_0x4a0abc){return function(_0xf246b1){logger[_0xc61e('0xc')](_0xc61e('0x2c'),JSON[_0xc61e('0x23')](_0xf246b1));if(_0x4a0abc['MailAccount']&&_0x4a0abc['MailAccount'][_0xc61e('0x2d')]&&!_[_0xc61e('0x2e')](_0x4a0abc[_0xc61e('0xe')])){setTimeout(handleSendEmail(_0x4a0abc,_0xf246b1),0x3c*0x3e8);}};}function handleJob(_0x2f1839){return function(){try{if(_[_0xc61e('0x2e')](_0x2f1839['subtractNumber'])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x2f1839[_0xc61e('0x17')])){return logger[_0xc61e('0xc')](_0xc61e('0x2f'));}var _0x5ecc62={'startDate':moment()[_0xc61e('0x30')](_0x2f1839[_0xc61e('0x16')],_0x2f1839[_0xc61e('0x17')])[_0xc61e('0x11')](_0xc61e('0x31')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xc61e('0x32'),'output':_0x2f1839[_0xc61e('0x33')],'name':_0x2f1839[_0xc61e('0x13')]};if(!_[_0xc61e('0x2e')](_0x2f1839[_0xc61e('0x34')])){logger[_0xc61e('0xc')](_0xc61e('0x35'),_0x2f1839[_0xc61e('0x34')]);return analyticDefaultReportController[_0xc61e('0x36')]({'id':_0x2f1839[_0xc61e('0x34')]},_0x5ecc62)[_0xc61e('0x37')](handleResult(_0x2f1839))['catch'](handleError());}if(!_[_0xc61e('0x2e')](_0x2f1839['CustomReportId'])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x2f1839['CustomReportId']);return analyticCustomReportController[_0xc61e('0x36')]({'id':_0x2f1839[_0xc61e('0x38')]},_0x5ecc62)[_0xc61e('0x37')](handleResult(_0x2f1839))['catch'](handleError());}}catch(_0x11128d){logger[_0xc61e('0x28')](JSON['stringify'](_0x11128d));}return logger[_0xc61e('0xc')](_0xc61e('0x39'));};}function getJobs(_0x588b64){var _0x446076={};if(_0x588b64){_0x446076['id']=_0x588b64;}return db[_0xc61e('0x3a')][_0xc61e('0x3b')]({'where':_0x446076,'include':[{'model':db[_0xc61e('0xf')],'attributes':['id',_0xc61e('0x13'),_0xc61e('0xe')],'include':[{'model':db[_0xc61e('0x3c')],'as':'Smtp','include':[{'model':db[_0xc61e('0x3d')],'as':_0xc61e('0x3d')}]}]}]})[_0xc61e('0x37')](function(_0x560a04){var _0x511a93=_['keys'](manager[_0xc61e('0x3e')]);var _0x2d64ce=_['map'](_0x560a04,function(_0x1478f0){return _0x1478f0['id'][_0xc61e('0x3f')]();});var _0x1447ea=_[_0xc61e('0x40')](_0x560a04,function(_0xc01ffd){return _0xc01ffd['id']['toString']();});var _0x1511f6=_0x588b64?_0x2d64ce:_[_0xc61e('0x41')](_0x2d64ce,_0x511a93);var _0x24f1a4=_[_0xc61e('0x42')](_0x2d64ce,_0x511a93);var _0xbbd33c=_[_0xc61e('0x41')](_0x511a93,_0x2d64ce);var _0x1054e4;var _0x363ee1;for(_0x1054e4=0x0;_0x1054e4<_0xbbd33c[_0xc61e('0x43')]&&!_0x588b64;_0x1054e4+=0x1){_0x363ee1=_0xbbd33c[_0x1054e4][_0xc61e('0x3f')]();if(manager['exists'](_0x363ee1)){manager[_0xc61e('0x44')](_0x363ee1);manager[_0xc61e('0x45')](_0x363ee1);logger[_0xc61e('0xc')]('delete\x20cron',_0x363ee1);}}logger['info'](_0xc61e('0x46'),JSON['stringify'](_0x1511f6));for(_0x1054e4=0x0;_0x1054e4<_0x1511f6['length'];_0x1054e4+=0x1){_0x363ee1=_0x1511f6[_0x1054e4]['toString']();logger[_0xc61e('0xc')](_0xc61e('0x47'),_0x363ee1);if(_0x588b64){logger[_0xc61e('0xc')](_0xc61e('0x48'),_0x588b64);logger[_0xc61e('0xc')](JSON[_0xc61e('0x23')](_0x1447ea[_0x363ee1]));BPromise[_0xc61e('0x49')]()[_0xc61e('0x37')](handleJob(_0x1447ea[_0x363ee1]));logger[_0xc61e('0xc')](_0xc61e('0x4a'),_0x1447ea[_0x363ee1][_0xc61e('0x13')],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}else if(_0x1447ea[_0x363ee1][_0xc61e('0x4b')]&&_0x1447ea[_0x363ee1][_0xc61e('0x4c')]&&moment()[_0xc61e('0x4d')](_0x1447ea[_0x363ee1][_0xc61e('0x4e')],_0x1447ea[_0x363ee1]['endAt'])){manager[_0xc61e('0x4f')](_0x363ee1,_0x1447ea[_0x363ee1][_0xc61e('0x4b')],handleJob(_0x1447ea[_0x363ee1]));manager['start'](_0x363ee1);logger['info'](_0xc61e('0x50'),_0x1447ea[_0x363ee1]['name'],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}else if(manager[_0xc61e('0x51')](_0x363ee1)){manager[_0xc61e('0x44')](_0x363ee1);manager['deleteJob'](_0x363ee1);logger[_0xc61e('0xc')](_0xc61e('0x52'),_0x1447ea[_0x363ee1][_0xc61e('0x13')],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}}for(_0x1054e4=0x0,_0x363ee1;_0x1054e4<_0x24f1a4['length']&&!_0x588b64;_0x1054e4+=0x1){_0x363ee1=_0x24f1a4[_0x1054e4][_0xc61e('0x3f')]();if(manager['exists'](_0x363ee1)){if(_0x1447ea[_0x363ee1][_0xc61e('0x4b')]&&_0x1447ea[_0x363ee1][_0xc61e('0x4c')]&&moment()['isBetween'](_0x1447ea[_0x363ee1]['startAt'],_0x1447ea[_0x363ee1]['endAt'])){manager['update'](_0x363ee1,_0x1447ea[_0x363ee1][_0xc61e('0x4b')],handleJob(_0x1447ea[_0x363ee1]));logger['info']('update\x20cron',_0x1447ea[_0x363ee1]['name'],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}else{manager[_0xc61e('0x44')](_0x363ee1);manager['deleteJob'](_0x363ee1);logger[_0xc61e('0xc')](_0xc61e('0x52'),_0x1447ea[_0x363ee1][_0xc61e('0x13')],_0x1447ea[_0x363ee1][_0xc61e('0x4b')]);}}}})['catch'](function(_0x41582e){logger[_0xc61e('0x28')](JSON[_0xc61e('0x23')](_0x41582e));});}exports['run']=function(_0x59e196){return getJobs(_0x59e196);};exports[_0xc61e('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x55eb=['Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','format','%s.%s','basename','extname','join','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','catch','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','intersection','length','exists','stop','toRun','my\x20id','resolve','cron','active','startAt','endAt','add','add\x20cron','deleteJob','stop\x20cron','isBetween','update','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info'];(function(_0xc33007,_0x55a41a){var _0x7c0839=function(_0x3f7af7){while(--_0x3f7af7){_0xc33007['push'](_0xc33007['shift']());}};_0x7c0839(++_0x55a41a);}(_0x55eb,0xf5));var _0xb55e=function(_0x50a5ee,_0x533611){_0x50a5ee=_0x50a5ee-0x0;var _0x46a65b=_0x55eb[_0x50a5ee];return _0x46a65b;};'use strict';var fs=require('fs');var util=require(_0xb55e('0x0'));var path=require(_0xb55e('0x1'));var _=require(_0xb55e('0x2'));var moment=require('moment');var CronJobManager=require(_0xb55e('0x3'));var jayson=require(_0xb55e('0x4'));var BPromise=require(_0xb55e('0x5'));var logger=require(_0xb55e('0x6'))('schedule');var db=require(_0xb55e('0x7'))['db'];var analyticCustomReportController=require(_0xb55e('0x8'));var analyticDefaultReportController=require(_0xb55e('0x9'));var client=jayson[_0xb55e('0xa')][_0xb55e('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2d4329,_0x2c5175){return function(){logger[_0xb55e('0xc')](_0xb55e('0xd'),_0x2d4329[_0xb55e('0xe')]);var _0x3634f5=!![];var _0x577ca3=_0x2d4329[_0xb55e('0xf')]['getSmtpOptions']();var _0xc4724a={'account':_0x577ca3,'message':{'from':util['format'](_0xb55e('0x10'),_0x2d4329[_0xb55e('0xf')][_0xb55e('0x11')],_0x2d4329[_0xb55e('0xf')][_0xb55e('0xe')]||_0x2d4329['MailAccount'][_0xb55e('0x12')][_0xb55e('0x13')]),'to':_0x2d4329[_0xb55e('0xe')],'cc':_0x2d4329['cc'],'bcc':_0x2d4329[_0xb55e('0x14')],'subject':util['format'](_0xb55e('0x15'),_0x2c5175['name'],_0x2d4329[_0xb55e('0x16')],_0x2d4329[_0xb55e('0x17')])}};var _0x1ff7d4=path['join'](__dirname,_0xb55e('0x18'));var _0x56b657=_0x2c5175[_0xb55e('0x19')];var _0x146b72=util[_0xb55e('0x1a')](_0xb55e('0x1b'),path[_0xb55e('0x1c')](_0x2c5175[_0xb55e('0x19')],path[_0xb55e('0x1d')](_0x2c5175[_0xb55e('0x19')])),'zip');var _0x2d9e7c=path[_0xb55e('0x1e')](_0x1ff7d4,_0x56b657);var _0x2f1a15=path[_0xb55e('0x1e')](_0x1ff7d4,_0x146b72);if(fs['existsSync'](_0x2d9e7c)){_0x2c5175[_0xb55e('0x1f')]=_0xb55e('0x20');_0xc4724a[_0xb55e('0x21')][_0xb55e('0x22')]=[{'filename':_0x56b657,'path':_0x2d9e7c}];_0xc4724a[_0xb55e('0x21')][_0xb55e('0x23')]=util['format'](_0xb55e('0x24'),JSON[_0xb55e('0x25')](_0x2c5175,null,0x2));}else if(fs[_0xb55e('0x26')](_0x2f1a15)){_0x2c5175[_0xb55e('0x1f')]=_0xb55e('0x20');_0xc4724a[_0xb55e('0x21')]['attachments']=[{'filename':_0x146b72,'path':_0x2f1a15}];}else{_0xc4724a[_0xb55e('0x21')][_0xb55e('0x23')]=_0xb55e('0x27');if(!_0x2d4329[_0xb55e('0x28')]){_0x3634f5=![];logger[_0xb55e('0xc')](_0xb55e('0x29'));}}if(_0x3634f5){return client[_0xb55e('0x2a')]('SendMail',_0xc4724a)[_0xb55e('0x2b')](function(_0x3577cb){if(_0x3577cb[_0xb55e('0x2c')]){return logger['error'](_0xb55e('0x2d'),JSON[_0xb55e('0x25')](_0x3577cb));}return logger[_0xb55e('0xc')](_0xb55e('0x2e'));})['catch'](function(_0x40169e){return logger[_0xb55e('0x2c')](_0xb55e('0x2d'),JSON[_0xb55e('0x25')](_0x40169e));});}};}function handleError(){return function(_0x2c0f85){return logger[_0xb55e('0x2c')](JSON[_0xb55e('0x25')](_0x2c0f85));};}function handleResult(_0x42d6b9){return function(_0x53591b){logger[_0xb55e('0xc')](_0xb55e('0x2f'),JSON[_0xb55e('0x25')](_0x53591b));if(_0x42d6b9['MailAccount']&&_0x42d6b9[_0xb55e('0xf')][_0xb55e('0x12')]&&!_[_0xb55e('0x30')](_0x42d6b9['email'])){setTimeout(handleSendEmail(_0x42d6b9,_0x53591b),0x3c*0x3e8);}};}function handleJob(_0x4afc72){return function(){try{if(_['isNil'](_0x4afc72[_0xb55e('0x16')])){return logger[_0xb55e('0xc')](_0xb55e('0x31'));}if(_[_0xb55e('0x30')](_0x4afc72[_0xb55e('0x17')])){return logger[_0xb55e('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0x4efab8={'startDate':moment()['subtract'](_0x4afc72[_0xb55e('0x16')],_0x4afc72[_0xb55e('0x17')])['format'](_0xb55e('0x32')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xb55e('0x33'),'output':_0x4afc72[_0xb55e('0x34')],'name':_0x4afc72[_0xb55e('0x11')]};if(!_[_0xb55e('0x30')](_0x4afc72[_0xb55e('0x35')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x4afc72['DefaultReportId']);return analyticDefaultReportController[_0xb55e('0x36')]({'id':_0x4afc72[_0xb55e('0x35')]},_0x4efab8)[_0xb55e('0x2b')](handleResult(_0x4afc72))['catch'](handleError());}if(!_[_0xb55e('0x30')](_0x4afc72[_0xb55e('0x37')])){logger[_0xb55e('0xc')](_0xb55e('0x38'),_0x4afc72['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x4afc72[_0xb55e('0x37')]},_0x4efab8)[_0xb55e('0x2b')](handleResult(_0x4afc72))[_0xb55e('0x39')](handleError());}}catch(_0x3a7404){logger[_0xb55e('0x2c')](JSON[_0xb55e('0x25')](_0x3a7404));}return logger[_0xb55e('0xc')](_0xb55e('0x3a'));};}function getJobs(_0xefbb6c){var _0x33097e={};if(_0xefbb6c){_0x33097e['id']=_0xefbb6c;}return db[_0xb55e('0x3b')][_0xb55e('0x3c')]({'where':_0x33097e,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db[_0xb55e('0x3d')],'as':_0xb55e('0x12'),'include':[{'model':db[_0xb55e('0x3e')],'as':_0xb55e('0x3e')}]}]}]})[_0xb55e('0x2b')](function(_0x1c3258){var _0x559650=_[_0xb55e('0x3f')](manager['jobs']);var _0x3c8dbf=_[_0xb55e('0x40')](_0x1c3258,function(_0x18e81){return _0x18e81['id'][_0xb55e('0x41')]();});var _0xca3d19=_[_0xb55e('0x42')](_0x1c3258,function(_0x336607){return _0x336607['id'][_0xb55e('0x41')]();});var _0x4eebce=_0xefbb6c?_0x3c8dbf:_[_0xb55e('0x43')](_0x3c8dbf,_0x559650);var _0x113c14=_[_0xb55e('0x44')](_0x3c8dbf,_0x559650);var _0x51c051=_[_0xb55e('0x43')](_0x559650,_0x3c8dbf);var _0x5154b3;var _0x11c53e;for(_0x5154b3=0x0;_0x5154b3<_0x51c051[_0xb55e('0x45')]&&!_0xefbb6c;_0x5154b3+=0x1){_0x11c53e=_0x51c051[_0x5154b3][_0xb55e('0x41')]();if(manager[_0xb55e('0x46')](_0x11c53e)){manager[_0xb55e('0x47')](_0x11c53e);manager['deleteJob'](_0x11c53e);logger['info']('delete\x20cron',_0x11c53e);}}logger[_0xb55e('0xc')](_0xb55e('0x48'),JSON[_0xb55e('0x25')](_0x4eebce));for(_0x5154b3=0x0;_0x5154b3<_0x4eebce[_0xb55e('0x45')];_0x5154b3+=0x1){_0x11c53e=_0x4eebce[_0x5154b3][_0xb55e('0x41')]();logger[_0xb55e('0xc')]('index',_0x11c53e);if(_0xefbb6c){logger['info'](_0xb55e('0x49'),_0xefbb6c);logger[_0xb55e('0xc')](JSON[_0xb55e('0x25')](_0xca3d19[_0x11c53e]));BPromise[_0xb55e('0x4a')]()[_0xb55e('0x2b')](handleJob(_0xca3d19[_0x11c53e]));logger[_0xb55e('0xc')]('run\x20job',_0xca3d19[_0x11c53e][_0xb55e('0x11')],_0xca3d19[_0x11c53e][_0xb55e('0x4b')]);}else if(_0xca3d19[_0x11c53e][_0xb55e('0x4b')]&&_0xca3d19[_0x11c53e][_0xb55e('0x4c')]&&moment()['isBetween'](_0xca3d19[_0x11c53e][_0xb55e('0x4d')],_0xca3d19[_0x11c53e][_0xb55e('0x4e')])){manager[_0xb55e('0x4f')](_0x11c53e,_0xca3d19[_0x11c53e][_0xb55e('0x4b')],handleJob(_0xca3d19[_0x11c53e]));manager['start'](_0x11c53e);logger[_0xb55e('0xc')](_0xb55e('0x50'),_0xca3d19[_0x11c53e][_0xb55e('0x11')],_0xca3d19[_0x11c53e]['cron']);}else if(manager[_0xb55e('0x46')](_0x11c53e)){manager[_0xb55e('0x47')](_0x11c53e);manager[_0xb55e('0x51')](_0x11c53e);logger[_0xb55e('0xc')](_0xb55e('0x52'),_0xca3d19[_0x11c53e][_0xb55e('0x11')],_0xca3d19[_0x11c53e]['cron']);}}for(_0x5154b3=0x0,_0x11c53e;_0x5154b3<_0x113c14['length']&&!_0xefbb6c;_0x5154b3+=0x1){_0x11c53e=_0x113c14[_0x5154b3][_0xb55e('0x41')]();if(manager[_0xb55e('0x46')](_0x11c53e)){if(_0xca3d19[_0x11c53e][_0xb55e('0x4b')]&&_0xca3d19[_0x11c53e][_0xb55e('0x4c')]&&moment()[_0xb55e('0x53')](_0xca3d19[_0x11c53e]['startAt'],_0xca3d19[_0x11c53e][_0xb55e('0x4e')])){manager[_0xb55e('0x54')](_0x11c53e,_0xca3d19[_0x11c53e][_0xb55e('0x4b')],handleJob(_0xca3d19[_0x11c53e]));logger[_0xb55e('0xc')]('update\x20cron',_0xca3d19[_0x11c53e]['name'],_0xca3d19[_0x11c53e][_0xb55e('0x4b')]);}else{manager[_0xb55e('0x47')](_0x11c53e);manager[_0xb55e('0x51')](_0x11c53e);logger[_0xb55e('0xc')](_0xb55e('0x52'),_0xca3d19[_0x11c53e][_0xb55e('0x11')],_0xca3d19[_0x11c53e]['cron']);}}}})[_0xb55e('0x39')](function(_0x5e51df){logger[_0xb55e('0x2c')](JSON[_0xb55e('0x25')](_0x5e51df));});}exports[_0xb55e('0x55')]=function(_0x5b9bea){return getJobs(_0x5b9bea);};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 7b9826d..3be3d74 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 _0x4483=['data1','Cloud\x20Provider\x20not\x20configured','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','all','catch','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','sentimentAccountId','CloudProvider','then'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0x4483,0x1a3));var _0x3448=function(_0x19b0e9,_0x542840){_0x19b0e9=_0x19b0e9-0x0;var _0x19748d=_0x4483[_0x19b0e9];return _0x19748d;};var _=require(_0x3448('0x0'));var AWS=require(_0x3448('0x1'));var rp=require(_0x3448('0x2'));var util=require('util');var BPromise=require(_0x3448('0x3'));var db=require(_0x3448('0x4'))['db'];var logger=require(_0x3448('0x5'))(_0x3448('0x6'));function getTranscriptionJob(_0xef1a93,_0x5f5163,_0xeb5b8,_0x6a89b){return new Promise(function(_0x1b05db,_0xd3606d){var _0x1bb7e5=new AWS[(_0x3448('0x7'))]({'accessKeyId':_0x5f5163,'secretAccessKey':_0xef1a93,'region':_0xeb5b8});_0x1bb7e5[_0x3448('0x8')]({'TranscriptionJobName':_0x6a89b},function(_0x34b926,_0x5923ee){if(_0x34b926){return _0xd3606d(_0x34b926);}else{return _0x1b05db(_0x5923ee);}});});}function sentiment(_0x5c82c6,_0x46b1ee,_0x25c152,_0xc36409,_0x6f82ca){return new Promise(function(_0x3f4364,_0x1e645a){var _0x2bdf02=new AWS[(_0x3448('0x9'))]({'accessKeyId':_0x46b1ee,'secretAccessKey':_0x5c82c6,'region':_0x25c152});_0x2bdf02[_0x3448('0xa')]({'Text':_0xc36409,'LanguageCode':_0x6f82ca[_0x3448('0xb')](0x0,0x2)},function(_0x2a6048,_0x481a6f){if(_0x2a6048){return _0x1e645a(_0x2a6048);}else{return _0x3f4364(_0x481a6f);}});});}function checkTranscribeJob(_0x5bf09e,_0x298ae6,_0x38fbb1){var _0x5f52bd;return new BPromise(function(_0x2661e1,_0xdfb89d){logger[_0x3448('0xc')](util['format'](_0x3448('0xd'),_0x5bf09e['id'],_0x5bf09e[_0x3448('0xe')]));return getTranscriptionJob(_0x38fbb1['data1'],_0x38fbb1[_0x3448('0xf')],_0x298ae6[_0x3448('0x10')],_0x5bf09e[_0x3448('0xe')])['then'](function(_0x472518){logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x12'),_0x5bf09e['id'],_0x5bf09e[_0x3448('0xe')],_0x472518[_0x3448('0x13')][_0x3448('0x14')]));if(!_0x5bf09e[_0x3448('0x15')]){switch(_0x472518['TranscriptionJob'][_0x3448('0x14')]){case'COMPLETED':var _0x48f94a={'transcribeStatus':_0x472518['TranscriptionJob'][_0x3448('0x14')],'fileUri':_0x472518[_0x3448('0x13')][_0x3448('0x16')]['TranscriptFileUri']};logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x17'),_0x5bf09e['id']));return rp({'uri':_0x472518[_0x3448('0x13')][_0x3448('0x16')][_0x3448('0x18')],'json':!![]})['then'](function(_0x54c7ee){logger['info'](util[_0x3448('0x11')](_0x3448('0x19'),_0x5bf09e['id']));if(_0x54c7ee&&_0x54c7ee['results']&&_0x54c7ee['results'][_0x3448('0x1a')]&&_0x54c7ee[_0x3448('0x1b')][_0x3448('0x1a')][_0x3448('0x1c')]){_0x48f94a[_0x3448('0x15')]='';for(var _0x566ff5=0x0;_0x566ff5<_0x54c7ee[_0x3448('0x1b')][_0x3448('0x1a')][_0x3448('0x1c')];_0x566ff5++){_0x48f94a[_0x3448('0x15')]+=_0x54c7ee[_0x3448('0x1b')]['transcripts'][_0x566ff5][_0x3448('0x1d')]+'';}}return _0x5bf09e[_0x3448('0x1e')](_0x48f94a);})['then'](function(){logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x1f'),_0x5bf09e['id']));if(!_0x5bf09e[_0x3448('0x20')]){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))](_0x3448('0x23'));}if(!_0x298ae6[_0x3448('0x24')]||!_0x298ae6['sentimentAccountId']||!_0x298ae6[_0x3448('0x25')]||!_0x298ae6[_0x3448('0x26')]||!_0x298ae6[_0x3448('0x27')]){throw new db['Sequelize'][(_0x3448('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x48f94a['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x298ae6[_0x3448('0x28')]===_0x38fbb1['id']){return _0x38fbb1;}else{return db[_0x3448('0x29')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3448('0x2a')](function(_0x37ceac){if(!_0x37ceac){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x37ceac[_0x3448('0x2b')]||!_0x37ceac[_0x3448('0xf')]){throw new db[(_0x3448('0x21'))]['ValidationError'](_0x3448('0x2c'));}_0x5f52bd=_0x37ceac;logger[_0x3448('0xc')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5bf09e['id']));return sentiment(_0x5f52bd[_0x3448('0x2b')],_0x5f52bd[_0x3448('0xf')],_0x298ae6[_0x3448('0x25')],_0x48f94a[_0x3448('0x15')],_0x298ae6['language']);})[_0x3448('0x2a')](function(_0x36291e){logger[_0x3448('0xc')](util[_0x3448('0x11')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5bf09e['id']));return _0x5bf09e[_0x3448('0x1e')]({'sentiment':_0x36291e[_0x3448('0x2d')],'sPositive':_0x36291e['SentimentScore'][_0x3448('0x2e')],'sNegative':_0x36291e[_0x3448('0x2f')][_0x3448('0x30')],'sMixed':_0x36291e[_0x3448('0x2f')][_0x3448('0x31')],'sNeutral':_0x36291e[_0x3448('0x2f')][_0x3448('0x32')]});})[_0x3448('0x2a')](function(){logger[_0x3448('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5bf09e['id']));_0x2661e1();});case _0x3448('0x33'):return _0x5bf09e['update']({'transcribeStatus':_0x3448('0x33'),'failureReason':_0x472518[_0x3448('0x13')][_0x3448('0x34')]})[_0x3448('0x2a')](function(){logger['info'](util[_0x3448('0x11')](_0x3448('0x1f'),_0x5bf09e['id']));_0x2661e1();});default:logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x35'),_0x5bf09e['id']));break;}}else{return BPromise[_0x3448('0x36')]()[_0x3448('0x2a')](function(){if(!_0x5bf09e[_0x3448('0x20')]){throw new db[(_0x3448('0x21'))]['ValidationError'](_0x3448('0x23'));}if(!_0x298ae6[_0x3448('0x24')]||!_0x298ae6[_0x3448('0x28')]||!_0x298ae6[_0x3448('0x25')]||!_0x298ae6[_0x3448('0x26')]||!_0x298ae6['bucket']){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))](_0x3448('0x37'));}if(!_0x5bf09e[_0x3448('0x15')]){throw new Error(_0x3448('0x38'));}if(_0x298ae6[_0x3448('0x28')]===_0x38fbb1['id']){return _0x38fbb1;}else{return db[_0x3448('0x29')][_0x3448('0x39')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3448('0x2a')](function(_0x3d96be){if(!_0x3d96be){throw new db[(_0x3448('0x21'))]['ValidationError'](_0x3448('0x3a'));}if(!_0x3d96be[_0x3448('0x2b')]||!_0x3d96be[_0x3448('0xf')]){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))](_0x3448('0x2c'));}_0x5f52bd=_0x3d96be;logger[_0x3448('0xc')](util['format'](_0x3448('0x3b'),_0x5bf09e['id']));return sentiment(_0x5f52bd[_0x3448('0x2b')],_0x5f52bd[_0x3448('0xf')],_0x298ae6[_0x3448('0x25')],_0x5bf09e[_0x3448('0x15')],_0x298ae6[_0x3448('0x26')]);})['then'](function(_0xcd75af){logger['info'](util['format'](_0x3448('0x3c'),_0x5bf09e['id']));return _0x5bf09e[_0x3448('0x1e')]({'sentiment':_0xcd75af['Sentiment'],'sPositive':_0xcd75af[_0x3448('0x2f')][_0x3448('0x2e')],'sNegative':_0xcd75af['SentimentScore'][_0x3448('0x30')],'sMixed':_0xcd75af[_0x3448('0x2f')]['Mixed'],'sNeutral':_0xcd75af[_0x3448('0x2f')][_0x3448('0x32')],'transcribeStatus':_0x3448('0x3d')});})[_0x3448('0x2a')](function(){logger[_0x3448('0xc')](util[_0x3448('0x11')](_0x3448('0x1f'),_0x5bf09e['id']));_0x2661e1();});}})['catch'](function(_0x5791fe){if(_0x5791fe){if(!_0x5791fe[_0x3448('0x3e')]||_0x5791fe[_0x3448('0x3e')]!==_0x3448('0x3f')){logger[_0x3448('0x40')](util['format'](_0x3448('0x41'),_0x5bf09e['id']),util[_0x3448('0x42')](_0x5791fe,{'showHidden':![],'depth':null}));}}_0x2661e1();});});}function checkTranscribe(){var _0x248925;var _0x2d55b6;var _0x363374;return db['VoiceRecording'][_0x3448('0x43')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x3448('0x2a')](function(_0x31787c){if(!_0x31787c||!_0x31787c['length']){throw new db[(_0x3448('0x21'))][(_0x3448('0x22'))](_0x3448('0x44'));}_0x248925=_0x31787c;return db[_0x3448('0x45')][_0x3448('0x39')]({'where':{'id':0x1}});})[_0x3448('0x2a')](function(_0xc769e1){if(!_0xc769e1){throw new db['Sequelize'][(_0x3448('0x22'))](_0x3448('0x46'));}_0x2d55b6=_0xc769e1;if(!_0x2d55b6['transcribe']||!_0x2d55b6['transcribeAccountId']||!_0x2d55b6[_0x3448('0x10')]||!_0x2d55b6[_0x3448('0x26')]||!_0x2d55b6['bucket']){throw new db['Sequelize'][(_0x3448('0x22'))](_0x3448('0x47'));}return db[_0x3448('0x29')][_0x3448('0x39')]({'where':{'id':_0x2d55b6[_0x3448('0x48')]}});})[_0x3448('0x2a')](function(_0x2aea70){if(!_0x2aea70){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2aea70[_0x3448('0x2b')]||!_0x2aea70[_0x3448('0xf')]){throw new db['Sequelize'][(_0x3448('0x22'))](_0x3448('0x2c'));}_0x363374=_0x2aea70;var _0x5a4cde=[];_0x248925[_0x3448('0x49')](function(_0x93669){_0x5a4cde['push'](checkTranscribeJob(_0x93669,_0x2d55b6,_0x363374));});return BPromise[_0x3448('0x4a')](_0x5a4cde);})[_0x3448('0x4b')](function(_0x1bfa93){if(_0x1bfa93){if(!_0x1bfa93[_0x3448('0x3e')]||_0x1bfa93[_0x3448('0x3e')]!==_0x3448('0x3f')){logger[_0x3448('0x40')](util[_0x3448('0x42')](_0x1bfa93,{'showHidden':![],'depth':null}));}}});}exports[_0x3448('0x4c')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x28f2=['Negative','Neutral','FAILED','FailureReason','resolve','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[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','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive'];(function(_0x35821e,_0x1994b6){var _0x44361e=function(_0x512b01){while(--_0x512b01){_0x35821e['push'](_0x35821e['shift']());}};_0x44361e(++_0x1994b6);}(_0x28f2,0x193));var _0x228f=function(_0x907bad,_0x436195){_0x907bad=_0x907bad-0x0;var _0x23b479=_0x28f2[_0x907bad];return _0x23b479;};var _=require(_0x228f('0x0'));var AWS=require(_0x228f('0x1'));var rp=require(_0x228f('0x2'));var util=require(_0x228f('0x3'));var BPromise=require(_0x228f('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x228f('0x5'))(_0x228f('0x6'));function getTranscriptionJob(_0x79ed5f,_0x4303c3,_0x2bb7d7,_0x3439f5){return new Promise(function(_0x32c5c3,_0x485423){var _0x10da58=new AWS['TranscribeService']({'accessKeyId':_0x4303c3,'secretAccessKey':_0x79ed5f,'region':_0x2bb7d7});_0x10da58[_0x228f('0x7')]({'TranscriptionJobName':_0x3439f5},function(_0x455eb6,_0xf4b011){if(_0x455eb6){return _0x485423(_0x455eb6);}else{return _0x32c5c3(_0xf4b011);}});});}function sentiment(_0x5f406c,_0x162ed5,_0x4d0038,_0x212c90,_0x2dfd07){return new Promise(function(_0x4e26fe,_0x3884c6){var _0x40aca5=new AWS[(_0x228f('0x8'))]({'accessKeyId':_0x162ed5,'secretAccessKey':_0x5f406c,'region':_0x4d0038});_0x40aca5[_0x228f('0x9')]({'Text':_0x212c90,'LanguageCode':_0x2dfd07[_0x228f('0xa')](0x0,0x2)},function(_0x4f22af,_0x39616d){if(_0x4f22af){return _0x3884c6(_0x4f22af);}else{return _0x4e26fe(_0x39616d);}});});}function checkTranscribeJob(_0x3e3047,_0x24f69c,_0x14073a){var _0x2e1a43;return new BPromise(function(_0x244d42,_0x18a0cd){logger[_0x228f('0xb')](util['format'](_0x228f('0xc'),_0x3e3047['id'],_0x3e3047[_0x228f('0xd')]));return getTranscriptionJob(_0x14073a[_0x228f('0xe')],_0x14073a[_0x228f('0xf')],_0x24f69c[_0x228f('0x10')],_0x3e3047[_0x228f('0xd')])[_0x228f('0x11')](function(_0x5b5abb){logger[_0x228f('0xb')](util['format'](_0x228f('0x12'),_0x3e3047['id'],_0x3e3047[_0x228f('0xd')],_0x5b5abb[_0x228f('0x13')]['TranscriptionJobStatus']));if(!_0x3e3047[_0x228f('0x14')]){switch(_0x5b5abb['TranscriptionJob'][_0x228f('0x15')]){case'COMPLETED':var _0x30cbc2={'transcribeStatus':_0x5b5abb['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x5b5abb[_0x228f('0x13')]['Transcript'][_0x228f('0x16')]};logger[_0x228f('0xb')](util[_0x228f('0x17')](_0x228f('0x18'),_0x3e3047['id']));return rp({'uri':_0x5b5abb[_0x228f('0x13')][_0x228f('0x19')][_0x228f('0x16')],'json':!![]})[_0x228f('0x11')](function(_0x15d54f){logger['info'](util[_0x228f('0x17')](_0x228f('0x1a'),_0x3e3047['id']));if(_0x15d54f&&_0x15d54f[_0x228f('0x1b')]&&_0x15d54f[_0x228f('0x1b')][_0x228f('0x1c')]&&_0x15d54f[_0x228f('0x1b')][_0x228f('0x1c')][_0x228f('0x1d')]){_0x30cbc2[_0x228f('0x14')]='';for(var _0x56fbc2=0x0;_0x56fbc2<_0x15d54f[_0x228f('0x1b')][_0x228f('0x1c')][_0x228f('0x1d')];_0x56fbc2++){_0x30cbc2[_0x228f('0x14')]+=_0x15d54f[_0x228f('0x1b')]['transcripts'][_0x56fbc2][_0x228f('0x1e')]+'';}}return _0x3e3047['update'](_0x30cbc2);})[_0x228f('0x11')](function(){logger['info'](util['format'](_0x228f('0x1f'),_0x3e3047['id']));if(!_0x3e3047[_0x228f('0x20')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x23'));}if(!_0x24f69c[_0x228f('0x24')]||!_0x24f69c[_0x228f('0x25')]||!_0x24f69c[_0x228f('0x26')]||!_0x24f69c[_0x228f('0x27')]||!_0x24f69c[_0x228f('0x28')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x29'));}if(!_0x30cbc2[_0x228f('0x14')]){throw new Error(_0x228f('0x2a'));}if(_0x24f69c['sentimentAccountId']===_0x14073a['id']){return _0x14073a;}else{return db[_0x228f('0x2b')][_0x228f('0x2c')]({'where':{'id':_settings[_0x228f('0x25')]}});}})['then'](function(_0x32e0ce){if(!_0x32e0ce){throw new db[(_0x228f('0x21'))]['ValidationError'](_0x228f('0x2d'));}if(!_0x32e0ce[_0x228f('0xe')]||!_0x32e0ce[_0x228f('0xf')]){throw new db[(_0x228f('0x21'))]['ValidationError'](_0x228f('0x2e'));}_0x2e1a43=_0x32e0ce;logger['info'](util[_0x228f('0x17')](_0x228f('0x2f'),_0x3e3047['id']));return sentiment(_0x2e1a43[_0x228f('0xe')],_0x2e1a43[_0x228f('0xf')],_0x24f69c['sentimentRegion'],_0x30cbc2[_0x228f('0x14')],_0x24f69c[_0x228f('0x27')]);})['then'](function(_0x570d01){logger['info'](util[_0x228f('0x17')](_0x228f('0x30'),_0x3e3047['id']));return _0x3e3047[_0x228f('0x31')]({'sentiment':_0x570d01[_0x228f('0x32')],'sPositive':_0x570d01[_0x228f('0x33')][_0x228f('0x34')],'sNegative':_0x570d01[_0x228f('0x33')][_0x228f('0x35')],'sMixed':_0x570d01[_0x228f('0x33')]['Mixed'],'sNeutral':_0x570d01['SentimentScore'][_0x228f('0x36')]});})[_0x228f('0x11')](function(){logger[_0x228f('0xb')](util[_0x228f('0x17')](_0x228f('0x1f'),_0x3e3047['id']));_0x244d42();});case _0x228f('0x37'):return _0x3e3047[_0x228f('0x31')]({'transcribeStatus':_0x228f('0x37'),'failureReason':_0x5b5abb[_0x228f('0x13')][_0x228f('0x38')]})['then'](function(){logger['info'](util[_0x228f('0x17')](_0x228f('0x1f'),_0x3e3047['id']));_0x244d42();});default:logger[_0x228f('0xb')](util[_0x228f('0x17')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3e3047['id']));break;}}else{return BPromise[_0x228f('0x39')]()[_0x228f('0x11')](function(){if(!_0x3e3047['tempSentiment']){throw new db['Sequelize'][(_0x228f('0x22'))](_0x228f('0x23'));}if(!_0x24f69c['sentiment']||!_0x24f69c[_0x228f('0x25')]||!_0x24f69c[_0x228f('0x26')]||!_0x24f69c['language']||!_0x24f69c['bucket']){throw new db[(_0x228f('0x21'))]['ValidationError'](_0x228f('0x29'));}if(!_0x3e3047[_0x228f('0x14')]){throw new Error(_0x228f('0x2a'));}if(_0x24f69c[_0x228f('0x25')]===_0x14073a['id']){return _0x14073a;}else{return db[_0x228f('0x2b')][_0x228f('0x2c')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x228f('0x11')](function(_0x5cdd16){if(!_0x5cdd16){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x2d'));}if(!_0x5cdd16[_0x228f('0xe')]||!_0x5cdd16[_0x228f('0xf')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x2e'));}_0x2e1a43=_0x5cdd16;logger[_0x228f('0xb')](util[_0x228f('0x17')](_0x228f('0x2f'),_0x3e3047['id']));return sentiment(_0x2e1a43[_0x228f('0xe')],_0x2e1a43[_0x228f('0xf')],_0x24f69c['sentimentRegion'],_0x3e3047['fileText'],_0x24f69c[_0x228f('0x27')]);})[_0x228f('0x11')](function(_0x34cd3c){logger[_0x228f('0xb')](util[_0x228f('0x17')](_0x228f('0x30'),_0x3e3047['id']));return _0x3e3047[_0x228f('0x31')]({'sentiment':_0x34cd3c[_0x228f('0x32')],'sPositive':_0x34cd3c[_0x228f('0x33')][_0x228f('0x34')],'sNegative':_0x34cd3c['SentimentScore'][_0x228f('0x35')],'sMixed':_0x34cd3c[_0x228f('0x33')]['Mixed'],'sNeutral':_0x34cd3c[_0x228f('0x33')]['Neutral'],'transcribeStatus':_0x228f('0x3a')});})['then'](function(){logger[_0x228f('0xb')](util['format'](_0x228f('0x1f'),_0x3e3047['id']));_0x244d42();});}})[_0x228f('0x3b')](function(_0x43b2cc){if(_0x43b2cc){if(!_0x43b2cc[_0x228f('0x3c')]||_0x43b2cc[_0x228f('0x3c')]!==_0x228f('0x3d')){logger[_0x228f('0x3e')](util[_0x228f('0x17')](_0x228f('0x3f'),_0x3e3047['id']),util[_0x228f('0x40')](_0x43b2cc,{'showHidden':![],'depth':null}));}}_0x244d42();});});}function checkTranscribe(){var _0x2fcf5f;var _0xf940d8;var _0x4099d4;return db[_0x228f('0x41')][_0x228f('0x42')]({'where':{'transcribeStatus':_0x228f('0x43')}})[_0x228f('0x11')](function(_0x102e2a){if(!_0x102e2a||!_0x102e2a[_0x228f('0x1d')]){throw new db['Sequelize']['ValidationError'](_0x228f('0x44'));}_0x2fcf5f=_0x102e2a;return db[_0x228f('0x45')][_0x228f('0x2c')]({'where':{'id':0x1}});})['then'](function(_0x17bcd9){if(!_0x17bcd9){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))]('Settings\x20not\x20available');}_0xf940d8=_0x17bcd9;if(!_0xf940d8['transcribe']||!_0xf940d8['transcribeAccountId']||!_0xf940d8[_0x228f('0x10')]||!_0xf940d8[_0x228f('0x27')]||!_0xf940d8[_0x228f('0x28')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x46'));}return db[_0x228f('0x2b')][_0x228f('0x2c')]({'where':{'id':_0xf940d8[_0x228f('0x47')]}});})[_0x228f('0x11')](function(_0x43bbd2){if(!_0x43bbd2){throw new db[(_0x228f('0x21'))]['ValidationError'](_0x228f('0x2d'));}if(!_0x43bbd2[_0x228f('0xe')]||!_0x43bbd2[_0x228f('0xf')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x2e'));}_0x4099d4=_0x43bbd2;var _0x671142=[];_0x2fcf5f[_0x228f('0x48')](function(_0x4feefb){_0x671142[_0x228f('0x49')](checkTranscribeJob(_0x4feefb,_0xf940d8,_0x4099d4));});return BPromise[_0x228f('0x4a')](_0x671142);})[_0x228f('0x3b')](function(_0x22aa23){if(_0x22aa23){if(!_0x22aa23['name']||_0x22aa23[_0x228f('0x3c')]!==_0x228f('0x3d')){logger['error'](util[_0x228f('0x40')](_0x22aa23,{'showHidden':![],'depth':null}));}}});}exports[_0x228f('0x4b')]=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 d79d704..21a1615 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 _0x8f18=['defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','../../config/environment','../../mysqldb','schedule','redis'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8f18,0x108));var _0x88f1=function(_0x51058f,_0x28dde0){_0x51058f=_0x51058f-0x0;var _0x25e307=_0x8f18[_0x51058f];return _0x25e307;};'use strict';var _=require(_0x88f1('0x0'));var moment=require(_0x88f1('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x88f1('0x2'));var db=require(_0x88f1('0x3'))['db'];var logger=require('../logger')(_0x88f1('0x4'));config[_0x88f1('0x5')]=_[_0x88f1('0x6')](config[_0x88f1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x88f1('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x10e421=[];return db[_0x88f1('0x8')][_0x88f1('0x9')]({'raw':!![],'attributes':['id',_0x88f1('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x88f1('0xb')](0x18,_0x88f1('0xc'))}}})['then'](function(_0x24d3ef){if(_0x24d3ef&&_0x24d3ef[_0x88f1('0xd')]){_0x10e421=_[_0x88f1('0xe')](_0x24d3ef||[],'id');logger[_0x88f1('0xf')](_0x88f1('0x10'),_0x10e421[_0x88f1('0x11')]());return db[_0x88f1('0x8')][_0x88f1('0x12')]({'closeReason':_0x88f1('0x13'),'disposition':_0x88f1('0x14'),'closed':!![],'closedAt':moment()[_0x88f1('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x10e421}});}})[_0x88f1('0x16')](function(){if(_0x10e421&&_0x10e421[_0x88f1('0xd')]){logger[_0x88f1('0xf')](_0x88f1('0x17'),_0x10e421[_0x88f1('0x11')]());for(var _0xa7ca97=0x0;_0xa7ca97<_0x10e421[_0x88f1('0xd')];_0xa7ca97++){io[_0x88f1('0x18')](_0x88f1('0x19'),{'id':_0x10e421[_0xa7ca97],'closed':!![]});}}})[_0x88f1('0x1a')](function(_0x59ebb1){logger[_0x88f1('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x59ebb1?util[_0x88f1('0x1c')](_0x59ebb1,{'showHidden':![],'depth':null}):'');});}exports[_0x88f1('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x58ef=['redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','schedule'];(function(_0x542a9b,_0x351513){var _0x4d5032=function(_0x538ed2){while(--_0x538ed2){_0x542a9b['push'](_0x542a9b['shift']());}};_0x4d5032(++_0x351513);}(_0x58ef,0x100));var _0xf58e=function(_0x3cb0a9,_0x172b0a){_0x3cb0a9=_0x3cb0a9-0x0;var _0x5e45fc=_0x58ef[_0x3cb0a9];return _0x5e45fc;};'use strict';var _=require('lodash');var moment=require(_0xf58e('0x0'));var Redis=require(_0xf58e('0x1'));var util=require(_0xf58e('0x2'));var config=require(_0xf58e('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xf58e('0x4'));config[_0xf58e('0x5')]=_['defaults'](config[_0xf58e('0x5')],{'host':_0xf58e('0x6'),'port':0x18eb});var io=require(_0xf58e('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x205da4=[];return db[_0xf58e('0x8')][_0xf58e('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf58e('0xa'))}}})[_0xf58e('0xb')](function(_0xf7a15d){if(_0xf7a15d&&_0xf7a15d[_0xf58e('0xc')]){_0x205da4=_[_0xf58e('0xd')](_0xf7a15d||[],'id');logger['info'](_0xf58e('0xe'),_0x205da4['join']());return db[_0xf58e('0x8')][_0xf58e('0xf')]({'closeReason':_0xf58e('0x10'),'disposition':_0xf58e('0x11'),'closed':!![],'closedAt':moment()[_0xf58e('0x12')](_0xf58e('0x13'))},{'where':{'id':_0x205da4}});}})[_0xf58e('0xb')](function(){if(_0x205da4&&_0x205da4[_0xf58e('0xc')]){logger['info'](_0xf58e('0x14'),_0x205da4[_0xf58e('0x15')]());for(var _0x1e9f12=0x0;_0x1e9f12<_0x205da4[_0xf58e('0xc')];_0x1e9f12++){io[_0xf58e('0x16')](_0xf58e('0x17'),{'id':_0x205da4[_0x1e9f12],'closed':!![]});}}})[_0xf58e('0x18')](function(_0xdfd1){logger[_0xf58e('0x19')](_0xf58e('0x1a'),_0xdfd1?util[_0xf58e('0x1b')](_0xdfd1,{'showHidden':![],'depth':null}):'');});}exports[_0xf58e('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 ec4cf56..1ada33d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd665=['now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts2','CmHopper','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x26c903,_0x110b4d){var _0x5dfdbe=function(_0x35c183){while(--_0x35c183){_0x26c903['push'](_0x26c903['shift']());}};_0x5dfdbe(++_0x110b4d);}(_0xd665,0x1cd));var _0x5d66=function(_0x43d41a,_0x267d65){_0x43d41a=_0x43d41a-0x0;var _0x45969c=_0xd665[_0x43d41a];return _0x45969c;};'use strict';var util=require(_0x5d66('0x0'));var db=require(_0x5d66('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5d66('0x2')]({'id':i,'firstName':_0x5d66('0x3')+i,'lastName':_0x5d66('0x4')+i,'phone':0xf879fb460+i,'email':_0x5d66('0x5')+i+_0x5d66('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5d66('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5d66('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5d66('0x7')](),'updatedAt':Date[_0x5d66('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5d66('0x2')]({'id':i,'firstName':_0x5d66('0x3')+i,'lastName':_0x5d66('0x4')+i,'phone':0xf879fb460+i,'email':_0x5d66('0x5')+i+_0x5d66('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5d66('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5d66('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x5d66('0x7')]()});}db[_0x5d66('0x8')][_0x5d66('0x9')]({'where':{}})[_0x5d66('0xa')](function(){return db[_0x5d66('0x8')][_0x5d66('0xb')](contacts);})[_0x5d66('0xa')](function(){console[_0x5d66('0xc')](_0x5d66('0xd'),'contacts1');return db['CmHopper'][_0x5d66('0x9')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x5d66('0xb')](hopper);})[_0x5d66('0xa')](function(){console[_0x5d66('0xc')](_0x5d66('0xd'),'hopper1');return db[_0x5d66('0x8')][_0x5d66('0xb')](contacts2);})[_0x5d66('0xa')](function(){console[_0x5d66('0xc')](_0x5d66('0xd'),_0x5d66('0xe'));return db[_0x5d66('0xf')][_0x5d66('0xb')](hopper2);})[_0x5d66('0xa')](function(){console[_0x5d66('0xc')](_0x5d66('0xd'),_0x5d66('0x10'));})[_0x5d66('0x11')](function(_0x2d5016){console[_0x5d66('0xc')](_0x2d5016);}); \ No newline at end of file +var _0xbb0b=['hopper1','contacts2','hopper2','catch','util','../mysqldb','push','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','then','bulkCreate','log','finished\x20populating','destroy','CmHopper'];(function(_0xc79ec1,_0x1ac92f){var _0x1ea29c=function(_0x391922){while(--_0x391922){_0xc79ec1['push'](_0xc79ec1['shift']());}};_0x1ea29c(++_0x1ac92f);}(_0xbb0b,0xee));var _0xbbb0=function(_0x3fb440,_0x420610){_0x3fb440=_0x3fb440-0x0;var _0x2522cd=_0xbb0b[_0x3fb440];return _0x2522cd;};'use strict';var util=require(_0xbbb0('0x0'));var db=require(_0xbbb0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbbb0('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbbb0('0x3')+i+_0xbbb0('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbbb0('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbbb0('0x5')](),'updatedAt':Date[_0xbbb0('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbbb0('0x2')]({'id':i,'firstName':_0xbbb0('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbbb0('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbbb0('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xbbb0('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbbb0('0x5')](),'updatedAt':Date[_0xbbb0('0x5')]()});}db[_0xbbb0('0x7')]['destroy']({'where':{}})[_0xbbb0('0x8')](function(){return db[_0xbbb0('0x7')][_0xbbb0('0x9')](contacts);})[_0xbbb0('0x8')](function(){console[_0xbbb0('0xa')](_0xbbb0('0xb'),'contacts1');return db['CmHopper'][_0xbbb0('0xc')]({'where':{}});})[_0xbbb0('0x8')](function(){return db[_0xbbb0('0xd')]['bulkCreate'](hopper);})['then'](function(){console['log'](_0xbbb0('0xb'),_0xbbb0('0xe'));return db[_0xbbb0('0x7')]['bulkCreate'](contacts2);})[_0xbbb0('0x8')](function(){console[_0xbbb0('0xa')](_0xbbb0('0xb'),_0xbbb0('0xf'));return db['CmHopper'][_0xbbb0('0x9')](hopper2);})[_0xbbb0('0x8')](function(){console['log']('finished\x20populating',_0xbbb0('0x10'));})[_0xbbb0('0x11')](function(_0x28e8c1){console['log'](_0x28e8c1);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 5d3d091..a6f317a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc87=['format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','add\x20user','catch','log','util','../mysqldb','push'];(function(_0x227e24,_0x573dd6){var _0x2ccc99=function(_0x177963){while(--_0x177963){_0x227e24['push'](_0x227e24['shift']());}};_0x2ccc99(++_0x573dd6);}(_0xcc87,0x189));var _0x7cc8=function(_0x579200,_0x3a9f46){_0x579200=_0x579200-0x0;var _0x212840=_0xcc87[_0x579200];return _0x212840;};'use strict';var util=require(_0x7cc8('0x0'));var db=require(_0x7cc8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7cc8('0x2')]({'name':util[_0x7cc8('0x3')](_0x7cc8('0x4'),_0x7cc8('0x5'),i),'fullname':util[_0x7cc8('0x3')]('%s%s',_0x7cc8('0x5'),i),'email':util[_0x7cc8('0x3')](_0x7cc8('0x6'),_0x7cc8('0x5'),i),'role':_0x7cc8('0x5'),'password':_0x7cc8('0x7'),'internal':0xfa0+i,'type':_0x7cc8('0x8'),'transport':[_0x7cc8('0x9'),'ws',_0x7cc8('0xa')],'disallow':[_0x7cc8('0xb')],'allow':[_0x7cc8('0xc')],'defaultuser':util[_0x7cc8('0x3')](_0x7cc8('0x4'),'agent',i),'encryption':_0x7cc8('0xd'),'avpf':_0x7cc8('0xd'),'force_avp':_0x7cc8('0xd'),'icesupport':_0x7cc8('0xd'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x7cc8('0xe'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7cc8('0xf'),'callerid':util[_0x7cc8('0x3')](_0x7cc8('0x10'),util[_0x7cc8('0x3')]('%s%s','agent',i),0xfa0+i)});}db[_0x7cc8('0x11')][_0x7cc8('0x12')](users)['then'](function(){console['log'](_0x7cc8('0x13'));})[_0x7cc8('0x14')](function(_0x33f65c){console[_0x7cc8('0x15')](_0x33f65c);}); \ No newline at end of file +var _0x0f57=['catch','../mysqldb','format','%s%s','agent','friend','udp','wss','all','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user'];(function(_0x213c93,_0x2146ad){var _0x8ef7cf=function(_0x281e0a){while(--_0x281e0a){_0x213c93['push'](_0x213c93['shift']());}};_0x8ef7cf(++_0x2146ad);}(_0x0f57,0xef));var _0x70f5=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x0f57[_0x21549c];return _0x426cbd;};'use strict';var util=require('util');var db=require(_0x70f5('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x70f5('0x1')](_0x70f5('0x2'),_0x70f5('0x3'),i),'fullname':util[_0x70f5('0x1')](_0x70f5('0x2'),_0x70f5('0x3'),i),'email':util[_0x70f5('0x1')]('%s%s@xcally.com',_0x70f5('0x3'),i),'role':_0x70f5('0x3'),'password':'password','internal':0xfa0+i,'type':_0x70f5('0x4'),'transport':[_0x70f5('0x5'),'ws',_0x70f5('0x6')],'disallow':[_0x70f5('0x7')],'allow':['ulaw'],'defaultuser':util['format']('%s%s',_0x70f5('0x3'),i),'encryption':'yes','avpf':'yes','force_avp':_0x70f5('0x8'),'icesupport':_0x70f5('0x8'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x70f5('0x9'),'callerid':util[_0x70f5('0x1')](_0x70f5('0xa'),util['format'](_0x70f5('0x2'),_0x70f5('0x3'),i),0xfa0+i)});}db[_0x70f5('0xb')][_0x70f5('0xc')](users)[_0x70f5('0xd')](function(){console[_0x70f5('0xe')](_0x70f5('0xf'));})[_0x70f5('0x10')](function(_0x3dec8e){console[_0x70f5('0xe')](_0x3dec8e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index e6769f6..7419dce 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9303=['removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','../mysqldb','name','role','agent','type','ivr','findOne','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','then','where','telephone','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','User','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueue','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','fax','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','map'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x9303,0xd7));var _0x3930=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x9303[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x3930('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x3930('0x2')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x3930('0x2'),_0x3930('0x3')],'raw':!![],'where':{'role':_0x3930('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3930('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x3930('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3930('0x2'),_0x3930('0x5')],'where':{'type':_0x3930('0x6')}};function getAssociatedResources(_0xe6fe58,_0xf9b29e,_0x58e723){return db['UserProfileSection'][_0x3930('0x7')]({'where':{'name':_0xe6fe58,'userProfileId':_0xf9b29e},'raw':!![]})['then'](function(_0x5269b3){if(_0x5269b3){if(_0x5269b3['autoAssociation']){switch(_0xe6fe58){case _0x3930('0x8'):case _0x3930('0x9'):case _0x3930('0xa'):case _0x3930('0xb'):case _0x3930('0xc'):case'OpenchannelQueues':case _0x3930('0xd'):return db[_0x58e723]['findAll'](queryQueues);case _0x3930('0xe'):return db[_0x58e723][_0x3930('0xf')](queryTelephones);case _0x3930('0x10'):return db[_0x58e723]['findAll'](queryTrunks);case _0x3930('0x11'):return db[_0x58e723][_0x3930('0xf')](queryCampaigns);}}else{return db['UserProfileResource'][_0x3930('0xf')]({'attributes':[_0x3930('0x12')],'where':{'sectionId':_0x5269b3['id']},'raw':!![]})[_0x3930('0x13')](function(_0x135498){if(_0x135498){var _0x5db060={'where':{'id':_['map'](_0x135498,_0x3930('0x12'))},'raw':!![]};switch(_0x58e723){case'User':_0x5db060[_0x3930('0x14')]['role']=_0x3930('0x15');break;case _0x3930('0x16'):_0x5db060['where']['type']='ivr';break;}return db[_0x58e723][_0x3930('0xf')](_0x5db060);}else{return[];}});}}else{return[];}})[_0x3930('0x13')](function(_0x41f3b5){return _0x41f3b5;});}function joinOrLeaveQueues(_0x5b5f55,_0x5053ea,_0x4f4e2e,_0x5a2501){_0x5b5f55[_0x5053ea](util[_0x3930('0x17')](_0x3930('0x18'),_0x4f4e2e,_0x5a2501[_0x3930('0x2')]));if(_0x5a2501[_0x3930('0x19')]){for(var _0x3d2a2f=0x0;_0x3d2a2f<_0x5a2501['Agents'][_0x3930('0x1a')];_0x3d2a2f+=0x1){_0x5b5f55[_0x5053ea](util[_0x3930('0x17')](_0x3930('0x1b'),_0x5a2501['Agents'][_0x3d2a2f][_0x3930('0x2')]));}}}function joinOrLeave(_0x2ea386,_0x12eeb7,_0x3a0e16){var _0x2bcc3b;if(_0x2ea386[_0x3930('0x1c')][_0x3930('0x1d')]['id']){db[_0x3930('0x1e')]['find']({'attributes':['id',_0x3930('0x2'),_0x3930('0x3'),_0x3930('0x1f')],'where':{'id':_0x2ea386[_0x3930('0x1c')][_0x3930('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x3930('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x3930('0x21')],'as':_0x3930('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x3930('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x3930('0x24')],'as':_0x3930('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x3930('0x26')],'as':_0x3930('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x3930('0x28'),'attributes':['id'],'raw':!![]}]})[_0x3930('0x13')](function(_0xca904a){if(_0xca904a){_0x2bcc3b=_0xca904a;_0x2ea386[_0x12eeb7](util['format'](_0x3930('0x1b'),_0xca904a[_0x3930('0x2')]));var _0x63acd5=[];switch(_0xca904a[_0x3930('0x3')]){case _0x3930('0x29'):_0x2ea386[_0x12eeb7](_0x3930('0x2a'));_0x2ea386[_0x12eeb7](_0x3930('0x2b'));if(queryQueues[_0x3930('0x2c')](_0x3930('0x2d'))){delete queryQueues[_0x3930('0x2d')];}_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x2f')][_0x3930('0xf')](queryQueues));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x30')][_0x3930('0xf')](queryQueues));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x31')][_0x3930('0xf')](queryQueues));_0x63acd5[_0x3930('0x2e')](db['SmsQueue']['findAll'](queryQueues));_0x63acd5['push'](db[_0x3930('0x32')][_0x3930('0xf')](queryQueues));_0x63acd5['push'](db[_0x3930('0x33')][_0x3930('0xf')](queryQueues));_0x63acd5['push'](db[_0x3930('0x34')]['findAll'](queryQueues));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x1e')][_0x3930('0xf')](queryTelephones));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x35')][_0x3930('0xf')](queryTrunks));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x16')][_0x3930('0xf')](queryCampaigns));_0x63acd5[_0x3930('0x2e')](db[_0x3930('0x1e')][_0x3930('0xf')](queryAgents));break;case _0x3930('0x36'):_0x2ea386[_0x12eeb7](_0x3930('0x2a'));_0x2ea386[_0x12eeb7](_0x3930('0x2b'));_0x63acd5[_0x3930('0x2e')](getAssociatedResources('VoiceQueues',_0xca904a[_0x3930('0x1f')],'VoiceQueue'));_0x63acd5[_0x3930('0x2e')](getAssociatedResources('ChatQueues',_0xca904a[_0x3930('0x1f')],'ChatQueue'));_0x63acd5['push'](getAssociatedResources(_0x3930('0xa'),_0xca904a[_0x3930('0x1f')],'FaxQueue'));_0x63acd5['push'](getAssociatedResources(_0x3930('0xb'),_0xca904a['userProfileId'],_0x3930('0x37')));_0x63acd5[_0x3930('0x2e')](getAssociatedResources(_0x3930('0xc'),_0xca904a[_0x3930('0x1f')],_0x3930('0x32')));_0x63acd5[_0x3930('0x2e')](getAssociatedResources(_0x3930('0x38'),_0xca904a[_0x3930('0x1f')],'OpenchannelQueue'));_0x63acd5['push'](getAssociatedResources(_0x3930('0xd'),_0xca904a[_0x3930('0x1f')],'WhatsappQueue'));_0x63acd5['push'](getAssociatedResources(_0x3930('0xe'),_0xca904a[_0x3930('0x1f')],_0x3930('0x1e')));_0x63acd5['push'](getAssociatedResources('Trunks',_0xca904a[_0x3930('0x1f')],_0x3930('0x35')));_0x63acd5[_0x3930('0x2e')](getAssociatedResources(_0x3930('0x11'),_0xca904a['userProfileId'],'Campaign'));_0x63acd5[_0x3930('0x2e')](db['User'][_0x3930('0xf')](queryAgents));break;case _0x3930('0x4'):_0x2ea386[_0x12eeb7]('voice:inbound');_0x2ea386[_0x12eeb7](_0x3930('0x2b'));_0x63acd5['push'](_0xca904a[_0x3930('0x39')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3a')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3b')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3c')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3d')]({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a['getOpenchannelQueues']({'attributes':['id',_0x3930('0x2')]}));_0x63acd5[_0x3930('0x2e')](_0xca904a[_0x3930('0x3e')]({'attributes':['id',_0x3930('0x2')]}));break;}return BPromise[_0x3930('0x3f')](_0x63acd5);}})[_0x3930('0x13')](function(_0x58ebb7){if(_0x58ebb7&&_0x58ebb7[_0x3930('0x1a')]){for(var _0xcb6e0=0x0;_0xcb6e0<_0x58ebb7[_0x3930('0x1a')];_0xcb6e0+=0x1){for(var _0xc8014a=0x0;_0xc8014a<_0x58ebb7[_0xcb6e0]['length'];_0xc8014a+=0x1){switch(_0xcb6e0){case 0x0:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,_0x3930('0x40'),_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x1:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,'chat',_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x2:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,_0x3930('0x41'),_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x3:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,'sms',_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x4:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,'mail',_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x5:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,_0x3930('0x42'),_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x6:joinOrLeaveQueues(_0x2ea386,_0x12eeb7,_0x3930('0x43'),_0x58ebb7[_0xcb6e0][_0xc8014a]);break;case 0x7:if(_0x2bcc3b['role']!==_0x3930('0x4'))_0x2ea386[_0x12eeb7](util[_0x3930('0x17')](_0x3930('0x44'),_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x2')]));break;case 0x8:if(_0x2bcc3b['role']!==_0x3930('0x4'))_0x2ea386[_0x12eeb7](util[_0x3930('0x17')](_0x3930('0x45'),_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x2')]));break;case 0x9:if(_0x2bcc3b['role']!==_0x3930('0x4'))_0x2ea386[_0x12eeb7](util[_0x3930('0x17')](_0x3930('0x46'),_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x5')],_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x2')]));break;case 0xa:_0x2ea386[_0x12eeb7](util[_0x3930('0x17')]('user:%s',_0x58ebb7[_0xcb6e0][_0xc8014a][_0x3930('0x2')]));break;}}}}})[_0x3930('0x13')](function(){if(_0x12eeb7==='leave'){var _0x937682=_['map'](_0x2bcc3b[_0x3930('0x20')],'id');return _0x2bcc3b[_0x3930('0x47')](_0x937682)[_0x3930('0x13')](function(){for(var _0x2d23e3=0x0;_0x2d23e3<_0x937682['length'];_0x2d23e3+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x49'),{'ChatInteractionId':Number(_0x937682[_0x2d23e3]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7===_0x3930('0x4a')){var _0xb82796=_[_0x3930('0x4b')](_0x2bcc3b[_0x3930('0x22')],'id');return _0x2bcc3b[_0x3930('0x4c')](_0xb82796)[_0x3930('0x13')](function(){for(var _0x822979=0x0;_0x822979<_0xb82796['length'];_0x822979+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x4d'),{'MailInteractionId':Number(_0xb82796[_0x822979]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7==='leave'){var _0x430e8c=_['map'](_0x2bcc3b[_0x3930('0x23')],'id');return _0x2bcc3b['removeFaxInteractions'](_0x430e8c)[_0x3930('0x13')](function(){for(var _0x1d0717=0x0;_0x1d0717<_0x430e8c[_0x3930('0x1a')];_0x1d0717+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x4e'),{'FaxInteractionId':Number(_0x430e8c[_0x1d0717]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7===_0x3930('0x4a')){var _0x218592=_['map'](_0x2bcc3b['SmsInteractions'],'id');return _0x2bcc3b[_0x3930('0x4f')](_0x218592)[_0x3930('0x13')](function(){for(var _0x5121ed=0x0;_0x5121ed<_0x218592['length'];_0x5121ed+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x50'),{'SmsInteractionId':Number(_0x218592[_0x5121ed]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7==='leave'){var _0x315f21=_[_0x3930('0x4b')](_0x2bcc3b[_0x3930('0x27')],'id');return _0x2bcc3b[_0x3930('0x51')](_0x315f21)[_0x3930('0x13')](function(){for(var _0x4f965a=0x0;_0x4f965a<_0x315f21['length'];_0x4f965a+=0x1){_0x3a0e16[_0x3930('0x48')](_0x3930('0x52'),{'OpenchannelInteractionId':Number(_0x315f21[_0x4f965a]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x13')](function(){if(_0x12eeb7==='leave'){var _0x4a4506=_['map'](_0x2bcc3b['WhatsappInteractions'],'id');return _0x2bcc3b[_0x3930('0x53')](_0x4a4506)[_0x3930('0x13')](function(){for(var _0x8489d2=0x0;_0x8489d2<_0x4a4506[_0x3930('0x1a')];_0x8489d2+=0x1){_0x3a0e16['emit'](_0x3930('0x54'),{'WhatsappInteractionId':Number(_0x4a4506[_0x8489d2]),'UserId':Number(_0x2bcc3b['id'])});}});}})[_0x3930('0x55')](function(_0x555d3b){_0x2ea386[_0x3930('0x56')](_0x555d3b);});}}function onDisconnect(_0x38aedd,_0x3a9cc2){joinOrLeave(_0x38aedd,_0x3930('0x4a'),_0x3a9cc2);}function onConnect(_0x3c3f7c){joinOrLeave(_0x3c3f7c,_0x3930('0x57'));}exports['default']=function(_0x2b8a55){_0x2b8a55['on'](_0x3930('0x58'),function(_0x10874b){_0x10874b['setMaxListeners'](0x0);_0x10874b[_0x3930('0x59')]=_0x10874b[_0x3930('0x5a')][_0x3930('0x58')][_0x3930('0x5b')]+':'+_0x10874b[_0x3930('0x5a')][_0x3930('0x58')]['remotePort'];_0x10874b[_0x3930('0x5c')]=new Date();_0x10874b['log']=function(_0x42719f){console['log'](_0x3930('0x5d')+_0x10874b[_0x3930('0x5e')][_0x3930('0x2')]+'['+_0x10874b['address']+']',_0x42719f);};_0x10874b['on']('disconnect',function(){onDisconnect(_0x10874b,_0x2b8a55);_0x10874b[_0x3930('0x56')](_0x3930('0x5f'));});onConnect(_0x10874b);_0x10874b[_0x3930('0x56')](_0x3930('0x60'));});}; \ No newline at end of file +var _0x6cf5=['ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','userProfileId','VoiceQueue','ChatQueues','FaxQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','trunk:%s','campaign:%s:%s','removeChatInteractions','leave','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','agent','telephone','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','role','Campaign','ivr','format','%s:queue:%s','length','user:%s','handshake','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push'];(function(_0x8014d8,_0x134a36){var _0x581b7b=function(_0x45c7ce){while(--_0x45c7ce){_0x8014d8['push'](_0x8014d8['shift']());}};_0x581b7b(++_0x134a36);}(_0x6cf5,0x1cf));var _0x56cf=function(_0x1a63bd,_0x26ee95){_0x1a63bd=_0x1a63bd-0x0;var _0xa8d83f=_0x6cf5[_0x1a63bd];return _0xa8d83f;};'use strict';var _=require(_0x56cf('0x0'));var util=require(_0x56cf('0x1'));var BPromise=require(_0x56cf('0x2'));var db=require(_0x56cf('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x56cf('0x4')],'include':[{'as':_0x56cf('0x5'),'model':db[_0x56cf('0x6')],'attributes':['id',_0x56cf('0x4'),'role'],'raw':!![],'where':{'role':_0x56cf('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x56cf('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x56cf('0x4')],'where':{'role':_0x56cf('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x56cf('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x51b676,_0x4b65ac,_0x4b78ce){return db[_0x56cf('0xa')][_0x56cf('0xb')]({'where':{'name':_0x51b676,'userProfileId':_0x4b65ac},'raw':!![]})[_0x56cf('0xc')](function(_0x61d258){if(_0x61d258){if(_0x61d258[_0x56cf('0xd')]){switch(_0x51b676){case _0x56cf('0xe'):case'ChatQueues':case _0x56cf('0xf'):case _0x56cf('0x10'):case _0x56cf('0x11'):case _0x56cf('0x12'):case _0x56cf('0x13'):return db[_0x4b78ce][_0x56cf('0x14')](queryQueues);case _0x56cf('0x15'):return db[_0x4b78ce]['findAll'](queryTelephones);case _0x56cf('0x16'):return db[_0x4b78ce][_0x56cf('0x14')](queryTrunks);case _0x56cf('0x17'):return db[_0x4b78ce][_0x56cf('0x14')](queryCampaigns);}}else{return db[_0x56cf('0x18')][_0x56cf('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x61d258['id']},'raw':!![]})[_0x56cf('0xc')](function(_0x164e8d){if(_0x164e8d){var _0x1b4cb4={'where':{'id':_[_0x56cf('0x19')](_0x164e8d,_0x56cf('0x1a'))},'raw':!![]};switch(_0x4b78ce){case'User':_0x1b4cb4[_0x56cf('0x1b')][_0x56cf('0x1c')]=_0x56cf('0x8');break;case _0x56cf('0x1d'):_0x1b4cb4[_0x56cf('0x1b')][_0x56cf('0x9')]=_0x56cf('0x1e');break;}return db[_0x4b78ce][_0x56cf('0x14')](_0x1b4cb4);}else{return[];}});}}else{return[];}})[_0x56cf('0xc')](function(_0x55047d){return _0x55047d;});}function joinOrLeaveQueues(_0x45487f,_0x2736d1,_0x44b16a,_0x17b782){_0x45487f[_0x2736d1](util[_0x56cf('0x1f')](_0x56cf('0x20'),_0x44b16a,_0x17b782[_0x56cf('0x4')]));if(_0x17b782[_0x56cf('0x5')]){for(var _0x41a9e1=0x0;_0x41a9e1<_0x17b782[_0x56cf('0x5')][_0x56cf('0x21')];_0x41a9e1+=0x1){_0x45487f[_0x2736d1](util[_0x56cf('0x1f')](_0x56cf('0x22'),_0x17b782[_0x56cf('0x5')][_0x41a9e1][_0x56cf('0x4')]));}}}function joinOrLeave(_0x303926,_0x250e9f,_0x6bface){var _0xb54ba9;if(_0x303926[_0x56cf('0x23')][_0x56cf('0x24')]['id']){db[_0x56cf('0x6')]['find']({'attributes':['id',_0x56cf('0x4'),_0x56cf('0x1c'),'userProfileId'],'where':{'id':_0x303926['handshake'][_0x56cf('0x24')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x56cf('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x56cf('0x26')],'as':_0x56cf('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x56cf('0x28')],'as':_0x56cf('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x56cf('0x2a')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x56cf('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x56cf('0x2c')],'as':_0x56cf('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x56cf('0xc')](function(_0x321f1e){if(_0x321f1e){_0xb54ba9=_0x321f1e;_0x303926[_0x250e9f](util[_0x56cf('0x1f')](_0x56cf('0x22'),_0x321f1e[_0x56cf('0x4')]));var _0x1fd3c8=[];switch(_0x321f1e[_0x56cf('0x1c')]){case _0x56cf('0x2e'):_0x303926[_0x250e9f](_0x56cf('0x2f'));_0x303926[_0x250e9f](_0x56cf('0x30'));if(queryQueues[_0x56cf('0x31')](_0x56cf('0x32'))){delete queryQueues[_0x56cf('0x32')];}_0x1fd3c8[_0x56cf('0x33')](db['VoiceQueue'][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x34')][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db['FaxQueue'][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x35')][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x36')][_0x56cf('0x14')](queryQueues));_0x1fd3c8['push'](db[_0x56cf('0x37')][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x38')]['findAll'](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x6')][_0x56cf('0x14')](queryTelephones));_0x1fd3c8[_0x56cf('0x33')](db['Trunk'][_0x56cf('0x14')](queryTrunks));_0x1fd3c8[_0x56cf('0x33')](db['Campaign'][_0x56cf('0x14')](queryCampaigns));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x6')][_0x56cf('0x14')](queryAgents));break;case _0x56cf('0x39'):_0x303926[_0x250e9f](_0x56cf('0x2f'));_0x303926[_0x250e9f](_0x56cf('0x30'));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0xe'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x3b')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x3c'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x34')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0xf'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x3d')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x10'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x35')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources('MailQueues',_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x36')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x12'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x37')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x13'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x38')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x15'),_0x321f1e['userProfileId'],_0x56cf('0x6')));_0x1fd3c8['push'](getAssociatedResources(_0x56cf('0x16'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x3e')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x17'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x1d')));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x6')]['findAll'](queryAgents));break;case'agent':_0x303926[_0x250e9f](_0x56cf('0x2f'));_0x303926[_0x250e9f]('voice:outbound');_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x3f')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x40')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8['push'](_0x321f1e[_0x56cf('0x41')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x42')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x43')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x44')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x45')]({'attributes':['id',_0x56cf('0x4')]}));break;}return BPromise[_0x56cf('0x46')](_0x1fd3c8);}})[_0x56cf('0xc')](function(_0x480e4a){if(_0x480e4a&&_0x480e4a[_0x56cf('0x21')]){for(var _0x1b4b1e=0x0;_0x1b4b1e<_0x480e4a[_0x56cf('0x21')];_0x1b4b1e+=0x1){for(var _0x2e4da2=0x0;_0x2e4da2<_0x480e4a[_0x1b4b1e]['length'];_0x2e4da2+=0x1){switch(_0x1b4b1e){case 0x0:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x47'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x1:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x48'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x2:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x49'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x3:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x4a'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x4:joinOrLeaveQueues(_0x303926,_0x250e9f,'mail',_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x5:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x4b'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x6:joinOrLeaveQueues(_0x303926,_0x250e9f,'whatsapp',_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x7:if(_0xb54ba9[_0x56cf('0x1c')]!==_0x56cf('0x7'))_0x303926[_0x250e9f](util[_0x56cf('0x1f')]('telephone:%s',_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x4')]));break;case 0x8:if(_0xb54ba9[_0x56cf('0x1c')]!==_0x56cf('0x7'))_0x303926[_0x250e9f](util[_0x56cf('0x1f')](_0x56cf('0x4c'),_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x4')]));break;case 0x9:if(_0xb54ba9[_0x56cf('0x1c')]!=='agent')_0x303926[_0x250e9f](util['format'](_0x56cf('0x4d'),_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x9')],_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x4')]));break;case 0xa:_0x303926[_0x250e9f](util[_0x56cf('0x1f')](_0x56cf('0x22'),_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x4')]));break;}}}}})['then'](function(){if(_0x250e9f==='leave'){var _0x577b8d=_['map'](_0xb54ba9[_0x56cf('0x25')],'id');return _0xb54ba9[_0x56cf('0x4e')](_0x577b8d)['then'](function(){for(var _0xa95589=0x0;_0xa95589<_0x577b8d[_0x56cf('0x21')];_0xa95589+=0x1){_0x6bface['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x577b8d[_0xa95589]),'UserId':Number(_0xb54ba9['id'])});}});}})[_0x56cf('0xc')](function(){if(_0x250e9f===_0x56cf('0x4f')){var _0x55d3e0=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x27')],'id');return _0xb54ba9[_0x56cf('0x50')](_0x55d3e0)['then'](function(){for(var _0x56fad3=0x0;_0x56fad3<_0x55d3e0[_0x56cf('0x21')];_0x56fad3+=0x1){_0x6bface[_0x56cf('0x51')](_0x56cf('0x52'),{'MailInteractionId':Number(_0x55d3e0[_0x56fad3]),'UserId':Number(_0xb54ba9['id'])});}});}})['then'](function(){if(_0x250e9f==='leave'){var _0x2072ef=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x29')],'id');return _0xb54ba9[_0x56cf('0x53')](_0x2072ef)[_0x56cf('0xc')](function(){for(var _0x389cb1=0x0;_0x389cb1<_0x2072ef[_0x56cf('0x21')];_0x389cb1+=0x1){_0x6bface['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2072ef[_0x389cb1]),'UserId':Number(_0xb54ba9['id'])});}});}})['then'](function(){if(_0x250e9f===_0x56cf('0x4f')){var _0x5d0048=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x54')],'id');return _0xb54ba9['removeSmsInteractions'](_0x5d0048)[_0x56cf('0xc')](function(){for(var _0x3e9a41=0x0;_0x3e9a41<_0x5d0048[_0x56cf('0x21')];_0x3e9a41+=0x1){_0x6bface[_0x56cf('0x51')](_0x56cf('0x55'),{'SmsInteractionId':Number(_0x5d0048[_0x3e9a41]),'UserId':Number(_0xb54ba9['id'])});}});}})[_0x56cf('0xc')](function(){if(_0x250e9f===_0x56cf('0x4f')){var _0x2d4553=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x2b')],'id');return _0xb54ba9[_0x56cf('0x56')](_0x2d4553)[_0x56cf('0xc')](function(){for(var _0x1da0d2=0x0;_0x1da0d2<_0x2d4553[_0x56cf('0x21')];_0x1da0d2+=0x1){_0x6bface['emit'](_0x56cf('0x57'),{'OpenchannelInteractionId':Number(_0x2d4553[_0x1da0d2]),'UserId':Number(_0xb54ba9['id'])});}});}})[_0x56cf('0xc')](function(){if(_0x250e9f==='leave'){var _0x34c5d3=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x2d')],'id');return _0xb54ba9[_0x56cf('0x58')](_0x34c5d3)[_0x56cf('0xc')](function(){for(var _0x2d6157=0x0;_0x2d6157<_0x34c5d3[_0x56cf('0x21')];_0x2d6157+=0x1){_0x6bface[_0x56cf('0x51')](_0x56cf('0x59'),{'WhatsappInteractionId':Number(_0x34c5d3[_0x2d6157]),'UserId':Number(_0xb54ba9['id'])});}});}})[_0x56cf('0x5a')](function(_0x3d9836){_0x303926[_0x56cf('0x5b')](_0x3d9836);});}}function onDisconnect(_0x5c328d,_0xce3144){joinOrLeave(_0x5c328d,_0x56cf('0x4f'),_0xce3144);}function onConnect(_0x2d5b12){joinOrLeave(_0x2d5b12,_0x56cf('0x5c'));}exports[_0x56cf('0x5d')]=function(_0x53e048){_0x53e048['on'](_0x56cf('0x5e'),function(_0x43ecaa){_0x43ecaa[_0x56cf('0x5f')](0x0);_0x43ecaa[_0x56cf('0x60')]=_0x43ecaa['request'][_0x56cf('0x5e')]['remoteAddress']+':'+_0x43ecaa[_0x56cf('0x61')][_0x56cf('0x5e')]['remotePort'];_0x43ecaa['connectedAt']=new Date();_0x43ecaa[_0x56cf('0x5b')]=function(_0x3993b5){console[_0x56cf('0x5b')](_0x56cf('0x62')+_0x43ecaa[_0x56cf('0x63')][_0x56cf('0x4')]+'['+_0x43ecaa[_0x56cf('0x60')]+']',_0x3993b5);};_0x43ecaa['on'](_0x56cf('0x64'),function(){onDisconnect(_0x43ecaa,_0x53e048);_0x43ecaa['log'](_0x56cf('0x65'));});onConnect(_0x43ecaa);_0x43ecaa[_0x56cf('0x5b')](_0x56cf('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1256b92..f214107 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 _0x57b8=['contact','AfterCreate','changed','closed','substatus','AfterUpdate','email','internal','default','length','model','hook','callback','toLowerCase','condition','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','info','error','code','Trigger,\x20%s','catch','get','channel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','then','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','motionChannel','offlineMessage','resolve','query'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x57b8,0xea));var _0x857b=function(_0x3ddb2b,_0x2e5ffd){_0x3ddb2b=_0x3ddb2b-0x0;var _0x51d748=_0x57b8[_0x3ddb2b];return _0x51d748;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x857b('0x0'));var logger=require(_0x857b('0x1'))(_0x857b('0x2'));var client=jayson[_0x857b('0x3')][_0x857b('0x4')]({'port':0x232a});var triggers=[{'channel':_0x857b('0x5'),'model':_0x857b('0x6'),'event':_0x857b('0x7'),'condition':_0x857b('0x8'),'callback':afterCreate},{'channel':_0x857b('0x5'),'model':_0x857b('0x6'),'event':_0x857b('0x9'),'condition':_0x857b('0xa'),'callback':afterUpdate},{'channel':_0x857b('0x5'),'model':'ChatMessage','event':_0x857b('0x7'),'condition':_0x857b('0xb'),'callback':afterCreateMessage},{'channel':_0x857b('0x5'),'model':_0x857b('0xc'),'event':_0x857b('0x7'),'condition':_0x857b('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x857b('0xd'),'model':_0x857b('0xe'),'event':_0x857b('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x857b('0xd'),'model':_0x857b('0xe'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x857b('0xf'),'event':'afterCreate','condition':_0x857b('0xb'),'callback':afterCreateMessage},{'channel':_0x857b('0x10'),'model':_0x857b('0x11'),'event':'afterCreate','condition':_0x857b('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x857b('0x11'),'event':_0x857b('0x9'),'condition':_0x857b('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x857b('0x12'),'event':_0x857b('0x7'),'condition':_0x857b('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0x857b('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x857b('0x13'),'model':_0x857b('0x14'),'event':_0x857b('0x9'),'condition':_0x857b('0xa'),'callback':afterUpdate},{'channel':_0x857b('0x13'),'model':'FaxMessage','event':_0x857b('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x857b('0x15'),'model':_0x857b('0x16'),'event':_0x857b('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0x857b('0x16'),'event':_0x857b('0x9'),'condition':_0x857b('0xa'),'callback':afterUpdate},{'channel':_0x857b('0x15'),'model':_0x857b('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x857b('0x18'),'model':_0x857b('0x19'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x857b('0x9'),'condition':_0x857b('0xa'),'callback':afterUpdate},{'channel':_0x857b('0x18'),'model':_0x857b('0x1a'),'event':_0x857b('0x7'),'condition':_0x857b('0xb'),'callback':afterCreateMessage}];function request(_0x5ae463){return client['request'](_0x857b('0x1b'),_0x5ae463)['then'](function(_0x29345a){logger[_0x857b('0x1c')]('Trigger,\x20%s',_0x857b('0x1b'),_0x29345a);if(_0x29345a['error']){if(_0x29345a[_0x857b('0x1d')][_0x857b('0x1e')]===0x1f4){logger[_0x857b('0x1d')](_0x857b('0x1f'),_0x857b('0x1b'),_0x29345a['error']);}}})[_0x857b('0x20')](function(_0x2f2b95){logger[_0x857b('0x1d')](_0x857b('0x1f'),_0x857b('0x1b'),_0x2f2b95);});}function afterCreateMessage(_0x500144){return function(_0x374002){_0x374002=_0x374002[_0x857b('0x21')]({'plain':!![]});_0x374002[_0x857b('0x22')]=_0x500144;_0x374002['motionChannel']=_0x500144;_0x374002[_0x857b('0x23')]=_0x374002[_0x857b('0x24')];Promise['resolve']()['then'](function(){if(typeof _0x374002[_0x857b('0x25')]===_0x857b('0x26'))return null;var _0x510896=_0x857b('0x27')+_0x374002[_0x857b('0x25')];return db[_0x857b('0x28')]['query'](_0x510896,{'type':db[_0x857b('0x29')][_0x857b('0x2a')][_0x857b('0x2b')],'raw':!![]});})[_0x857b('0x2c')](function(_0x136cac){if(_0x136cac){_0x374002['contact']=_0x136cac[0x0];}if(typeof _0x374002[_0x857b('0x2d')]==='undefined')return;return getAgent(_0x374002[_0x857b('0x2d')]);})[_0x857b('0x2c')](function(_0x5c95af){if(_0x5c95af){_0x374002[_0x857b('0x2e')]=util[_0x857b('0x2f')](_0x857b('0x30'),_0x5c95af[_0x857b('0x31')]);_0x374002[_0x857b('0x32')]=_0x5c95af;_0x374002[_0x857b('0x22')]=_0x500144;return request({'event':_0x857b('0x33'),'message':_0x374002});}else{return request({'event':_0x857b('0x34'),'message':_0x374002});}})[_0x857b('0x20')](function(_0x463210){logger['error']('Trigger,\x20%s',_0x857b('0x35'),_0x463210);});};}function afterCreateOfflineMessage(_0x149445){return function(_0x54e59c){_0x54e59c=_0x54e59c[_0x857b('0x21')]({'plain':!![]});_0x54e59c['channel']=_0x149445;_0x54e59c[_0x857b('0x36')]=_0x149445;_0x54e59c[_0x857b('0x23')]=_0x857b('0x37');return request({'event':_0x54e59c[_0x857b('0x23')],'message':_0x54e59c});};}function afterCreate(_0x4310c5,_0x1c8f9c){return function(_0x43ea86){_0x43ea86=_0x43ea86[_0x857b('0x21')]({'plain':!![]});_0x43ea86['channel']=_0x4310c5;_0x43ea86[_0x857b('0x36')]=_0x4310c5;_0x43ea86[_0x857b('0x23')]='opened';Promise[_0x857b('0x38')]()[_0x857b('0x2c')](function(){var _0x544be3=_0x857b('0x27')+_0x43ea86[_0x857b('0x25')];return db[_0x857b('0x28')][_0x857b('0x39')](_0x544be3,{'type':db[_0x857b('0x29')]['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0x5d887d){if(_0x5d887d){_0x43ea86[_0x857b('0x3a')]=_0x5d887d[0x0];}if(typeof _0x43ea86[_0x857b('0x2d')]===_0x857b('0x26'))return;return getAgent(_0x43ea86[_0x857b('0x2d')]);})[_0x857b('0x2c')](function(_0x32b8e1){if(_0x32b8e1){_0x43ea86[_0x857b('0x2e')]=util['format'](_0x857b('0x30'),_0x32b8e1[_0x857b('0x31')]);_0x43ea86[_0x857b('0x32')]=_0x32b8e1;}return request({'event':_0x1c8f9c,'message':_0x43ea86});})[_0x857b('0x20')](function(_0x39ae9a){logger[_0x857b('0x1d')](_0x857b('0x1f'),_0x857b('0x3b'),_0x39ae9a);});};}function afterUpdate(_0x36e032){return function(_0x2ae8e6){var _0x3e95cc=_0x2ae8e6[_0x857b('0x3c')](_0x857b('0x3d'))&&_0x2ae8e6[_0x857b('0x3d')];var _0x127289=_0x2ae8e6['changed'](_0x857b('0x3e'));if(_0x3e95cc||_0x127289){var _0x16056e=_0x3e95cc?_0x857b('0xa'):_0x857b('0x3e');var _0x1f16f9=_0x2ae8e6[_0x857b('0x21')]({'plain':!![]});_0x1f16f9[_0x857b('0x22')]=_0x36e032;_0x1f16f9['motionChannel']=_0x36e032;_0x1f16f9[_0x857b('0x23')]=_0x3e95cc?_0x857b('0x3d'):_0x857b('0x3e');var _0x128dcc=_0x857b('0x27')+_0x1f16f9[_0x857b('0x25')];return db[_0x857b('0x28')][_0x857b('0x39')](_0x128dcc,{'type':db[_0x857b('0x29')][_0x857b('0x2a')][_0x857b('0x2b')],'raw':!![]})['then'](function(_0x5674d1){if(_0x5674d1){_0x1f16f9[_0x857b('0x3a')]=_0x5674d1[0x0];}if(typeof _0x1f16f9[_0x857b('0x2d')]==='undefined')return;return getAgent(_0x1f16f9[_0x857b('0x2d')]);})[_0x857b('0x2c')](function(_0x145fb8){if(_0x145fb8){_0x1f16f9[_0x857b('0x2e')]=util['format'](_0x857b('0x30'),_0x145fb8['name']);_0x1f16f9[_0x857b('0x32')]=_0x145fb8;}return request({'event':_0x16056e,'message':_0x1f16f9});})[_0x857b('0x20')](function(_0x5db112){logger[_0x857b('0x1d')](_0x857b('0x1f'),_0x857b('0x3f'),_0x5db112);});}};}function getAgent(_0x37434a){return db['User']['find']({'where':{'id':_0x37434a},'attributes':['id',_0x857b('0x31'),'fullname',_0x857b('0x40'),_0x857b('0x41')],'raw':!![]})[_0x857b('0x2c')](function(_0x2c6478){return _0x2c6478;});}exports[_0x857b('0x42')]=function(){for(var _0x53f54c=0x0;_0x53f54c=_0x517409['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4c5a80(_0x577755);})[_0xb368('0x14')](function(_0x3ef7c2){_0x4595fb(_0x3ef7c2);});});}; \ No newline at end of file +var _0xa07a=['voice','mail','fax','whatsapp','openchannel','getChannels','isValidChannel','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb'];(function(_0x311fcc,_0x164aa9){var _0x2e180c=function(_0x3af53c){while(--_0x3af53c){_0x311fcc['push'](_0x311fcc['shift']());}};_0x2e180c(++_0x164aa9);}(_0xa07a,0x19f));var _0xaa07=function(_0x3bbe86,_0x399c21){_0x3bbe86=_0x3bbe86-0x0;var _0x4278e3=_0xa07a[_0x3bbe86];return _0x4278e3;};'use strict';var _=require(_0xaa07('0x0'));var BPromise=require(_0xaa07('0x1'));var db=require(_0xaa07('0x2'))['db'];var util=require('./license/util');var channels=[_0xaa07('0x3'),_0xaa07('0x4'),'chat',_0xaa07('0x5'),'sms',_0xaa07('0x6'),_0xaa07('0x7')];exports[_0xaa07('0x8')]=function(){return channels;};exports[_0xaa07('0x9')]=function(_0x30271d){_0x30271d=_0x30271d['toLowerCase']();return _[_0xaa07('0xa')](channels,_0x30271d);};exports['clearBlockUser']=function(_0x2d0df0,_0x2d37c3,_0x2ccbec,_0x79ba2d){var _0x30fab6={'loginAttempts':_0x2d37c3,'blocked':_0x2ccbec};if(!_[_0xaa07('0xb')](_0x79ba2d)){_0x30fab6[_0xaa07('0xc')]=_0x79ba2d;}return _0x2d0df0[_0xaa07('0xd')](_0x30fab6);};exports[_0xaa07('0xe')]=function(_0x2718ed){return new BPromise(function(_0x402dc5,_0x1cd1e1){var _0x4939b3=0x0;if(_0x2718ed[_0xaa07('0xf')]!==_0xaa07('0x10')){_0x402dc5(_0x2718ed);}db[_0xaa07('0x11')]['count']({'where':{'role':_0xaa07('0x10'),'online':!![],'id':{'$ne':_0x2718ed['id']}}})[_0xaa07('0x12')](function(_0xd6e80e){_0x4939b3=_0xd6e80e;return util['getLicense']();})[_0xaa07('0x12')](function(_0x46354b){if(_0x46354b&&_0x46354b[_0xaa07('0x13')]&&_0x4939b3>=_0x46354b['agents']){throw Error(_0xaa07('0x14'));}_0x402dc5(_0x2718ed);})[_0xaa07('0x15')](function(_0xde01e1){_0x1cd1e1(_0xde01e1);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index c8bcde3..f635407 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x3f2439,_0x3b062f){var _0xa2576c=function(_0x1ba547){while(--_0x1ba547){_0x3f2439['push'](_0x3f2439['shift']());}};_0xa2576c(++_0x3b062f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xe14b=['Out\x20Of\x20Interval','Forbidden','error','stack','statusMessage','status','send','util','../config/logger','message','name','Bad\x20Request','inherits','Not\x20Found'];(function(_0x54417d,_0x39f452){var _0x5ed754=function(_0x1ef38b){while(--_0x1ef38b){_0x54417d['push'](_0x54417d['shift']());}};_0x5ed754(++_0x39f452);}(_0xe14b,0x93));var _0xbe14=function(_0x1b4326,_0x2fee04){_0x1b4326=_0x1b4326-0x0;var _0x51c1f9=_0xe14b[_0x1b4326];return _0x51c1f9;};'use strict';var util=require(_0xbe14('0x0'));var logger=require(_0xbe14('0x1'))('api');var APIError=function(_0x5cc4d8,_0x11c3a0){this[_0xbe14('0x2')]=_0x5cc4d8||'Internal\x20Server\x20Error';this[_0xbe14('0x3')]=_0x11c3a0||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1833e3){this[_0xbe14('0x2')]=_0x1833e3||_0xbe14('0x4');this[_0xbe14('0x3')]=_0xbe14('0x4');util[_0xbe14('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x196fca){this['message']=_0x196fca||'Entity\x20not\x20found';this['name']=_0xbe14('0x6');util[_0xbe14('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xd68cd7){this[_0xbe14('0x2')]=_0xd68cd7||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this['name']=_0xbe14('0x7');util[_0xbe14('0x5')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4935cc){switch(_0x4935cc){case _0xbe14('0x4'):return 0x190;case _0xbe14('0x8'),_0xbe14('0x7'):return 0x193;case _0xbe14('0x6'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x27792f){if(_0x27792f===_0xbe14('0x7'))return _0x27792f;return null;}function handleError(_0x23a730){return function(_0x2850cb){logger[_0xbe14('0x9')](_0x2850cb[_0xbe14('0xa')]);var _0x1e4826=getStatusCode(_0x2850cb[_0xbe14('0x3')]);var _0x813399=getCustomStatusMessage(_0x2850cb['name']);if(_0x2850cb['name'])delete _0x2850cb[_0xbe14('0x3')];if(_0x813399)_0x23a730[_0xbe14('0xb')]=_0x813399;return _0x23a730[_0xbe14('0xc')](_0x1e4826)[_0xbe14('0xd')](_0x2850cb);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c929ef0..448f6c5 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87ee=['exports','404','status','render','json','send'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x87ee,0x120));var _0xe87e=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x87ee[_0x403c20];return _0x2b271a;};'use strict';module[_0xe87e('0x0')][0x194]=function pageNotFound(_0x55b946,_0x56d295){var _0x4f7eba=_0xe87e('0x1');var _0x201a25=0x194;var _0x478522={'status':_0x201a25};_0x56d295['status'](_0x478522[_0xe87e('0x2')]);_0x56d295[_0xe87e('0x3')](_0x4f7eba,{},function(_0x1635ec,_0x340dc5){if(_0x1635ec){return _0x56d295[_0xe87e('0x2')](_0x478522[_0xe87e('0x2')])[_0xe87e('0x4')](_0x478522);}_0x56d295[_0xe87e('0x5')](_0x340dc5);});}; \ No newline at end of file +var _0x0332=['404','status','render','exports'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x0332,0x73));var _0x2033=function(_0x133f81,_0x550e62){_0x133f81=_0x133f81-0x0;var _0x2eef30=_0x0332[_0x133f81];return _0x2eef30;};'use strict';module[_0x2033('0x0')][0x194]=function pageNotFound(_0x44cd16,_0x24da10){var _0x4b62d1=_0x2033('0x1');var _0x53a214=0x194;var _0x462b80={'status':_0x53a214};_0x24da10[_0x2033('0x2')](_0x462b80[_0x2033('0x2')]);_0x24da10[_0x2033('0x3')](_0x4b62d1,{},function(_0x1394ee,_0x1cd7c8){if(_0x1394ee){return _0x24da10['status'](_0x462b80[_0x2033('0x2')])['json'](_0x462b80);}_0x24da10['send'](_0x1cd7c8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index da72454..ae3d362 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index d57fe45..b56936b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./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/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','static','join','root','/www','/demo','snippet','3.5.0','/server/files/plugins','route','get','sendFile','resolve','appPath','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue'];(function(_0xc2928,_0x4de4be){var _0x521fa1=function(_0x28847e){while(--_0x28847e){_0xc2928['push'](_0xc2928['shift']());}};_0x521fa1(++_0x4de4be);}(_0xb43b,0xbf));var _0xbb43=function(_0x52bf06,_0x21822f){_0x52bf06=_0x52bf06-0x0;var _0x58d79e=_0xb43b[_0x52bf06];return _0x58d79e;};'use strict';var path=require(_0xbb43('0x0'));var express=require('express');var errors=require(_0xbb43('0x1'));var config=require(_0xbb43('0x2'));var setupLoggers=require(_0xbb43('0x3'))[_0xbb43('0x4')];var clientSideLogs=require(_0xbb43('0x5'));exports[_0xbb43('0x6')]=function(_0x2e9c09){return setupLoggers(_0x2e9c09)[_0xbb43('0x7')](function(){_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x9'),require(_0xbb43('0xa')));_0x2e9c09['use'](_0xbb43('0xb'),require('./api/voiceChanSpy'));_0x2e9c09['use'](_0xbb43('0xc'),require(_0xbb43('0xd')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe'),require(_0xbb43('0xf')));_0x2e9c09['use'](_0xbb43('0x10'),require(_0xbb43('0x11')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x12'),require('./api/voiceQueue'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x13'),require('./api/voiceRecording'));_0x2e9c09['use']('/api/screen/recordings',require(_0xbb43('0x14')));_0x2e9c09['use'](_0xbb43('0x15'),require('./api/voiceMail'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x16'),require(_0xbb43('0x17')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x18'),require('./api/voiceCallReport'));_0x2e9c09[_0xbb43('0x8')]('/api/voice/dials/reports',require(_0xbb43('0x19')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x1a'),require(_0xbb43('0x1b')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x1c'),require(_0xbb43('0x1d')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x1e'),require(_0xbb43('0x1f')));_0x2e9c09[_0xbb43('0x8')]('/api/trunks',require(_0xbb43('0x20')));_0x2e9c09['use'](_0xbb43('0x21'),require(_0xbb43('0x22')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x23'),require('./api/mailServerOut'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x24'),require(_0xbb43('0x25')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x26'),require(_0xbb43('0x27')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x28'),require(_0xbb43('0x29')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x2a'),require(_0xbb43('0x2b')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x2c'),require('./api/mailMessage'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x2d'),require('./api/mailApplication'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x2e'),require(_0xbb43('0x2f')));_0x2e9c09['use']('/api/dashboards',require(_0xbb43('0x30')));_0x2e9c09[_0xbb43('0x8')]('/api/dashboards/items',require('./api/dashboardItem'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x31'),require(_0xbb43('0x32')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x33'),require(_0xbb43('0x34')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x35'),require('./api/faxInteraction'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x36'),require(_0xbb43('0x37')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x38'),require(_0xbb43('0x39')));_0x2e9c09[_0xbb43('0x8')]('/api/fax/reports/queue',require(_0xbb43('0x3a')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x3b'),require('./api/smsAccount'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x3c'),require(_0xbb43('0x3d')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x3e'),require(_0xbb43('0x3f')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x40'),require(_0xbb43('0x41')));_0x2e9c09['use']('/api/sms/queues',require('./api/smsQueue'));_0x2e9c09['use'](_0xbb43('0x42'),require(_0xbb43('0x43')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x44'),require(_0xbb43('0x45')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x46'),require(_0xbb43('0x47')));_0x2e9c09['use'](_0xbb43('0x48'),require(_0xbb43('0x49')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x4a'),require('./api/openchannelQueue'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x4b'),require(_0xbb43('0x4c')));_0x2e9c09[_0xbb43('0x8')]('/api/openchannel/reports/queue',require(_0xbb43('0x4d')));_0x2e9c09['use'](_0xbb43('0x4e'),require(_0xbb43('0x4f')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x50'),require(_0xbb43('0x51')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x52'),require(_0xbb43('0x53')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x54'),require(_0xbb43('0x55')));_0x2e9c09[_0xbb43('0x8')]('/api/chat/queues',require(_0xbb43('0x56')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x57'),require(_0xbb43('0x58')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x59'),require(_0xbb43('0x5a')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x5b'),require(_0xbb43('0x5c')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x5d'),require(_0xbb43('0x5e')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x5f'),require('./api/cmHopper'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x60'),require(_0xbb43('0x61')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x62'),require(_0xbb43('0x63')));_0x2e9c09['use'](_0xbb43('0x64'),require(_0xbb43('0x65')));_0x2e9c09['use']('/api/cm/custom_fields',require(_0xbb43('0x66')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x67'),require(_0xbb43('0x68')));_0x2e9c09[_0xbb43('0x8')]('/api/automations',require('./api/automation'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x69'),require(_0xbb43('0x6a')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x6b'),require(_0xbb43('0x6c')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x6d'),require(_0xbb43('0x6e')));_0x2e9c09[_0xbb43('0x8')]('/api/intervals',require('./api/interval'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x6f'),require('./api/pause'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x70'),require(_0xbb43('0x71')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x72'),require(_0xbb43('0x73')));_0x2e9c09[_0xbb43('0x8')]('/api/schedules',require(_0xbb43('0x74')));_0x2e9c09[_0xbb43('0x8')]('/api/sounds',require(_0xbb43('0x75')));_0x2e9c09[_0xbb43('0x8')]('/api/tags',require(_0xbb43('0x76')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x77'),require(_0xbb43('0x78')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x79'),require(_0xbb43('0x7a')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x7b'),require(_0xbb43('0x7c')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x7d'),require('./api/template'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x7e'),require(_0xbb43('0x7f')));_0x2e9c09[_0xbb43('0x8')]('/api/variables',require(_0xbb43('0x80')));_0x2e9c09['use'](_0xbb43('0x81'),require('./api/integration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x82'),require(_0xbb43('0x83')));_0x2e9c09['use'](_0xbb43('0x84'),require(_0xbb43('0x85')));_0x2e9c09[_0xbb43('0x8')]('/api/analytics/default_reports',require(_0xbb43('0x86')));_0x2e9c09[_0xbb43('0x8')]('/api/analytics/extracted_reports',require(_0xbb43('0x87')));_0x2e9c09['use'](_0xbb43('0x88'),require(_0xbb43('0x89')));_0x2e9c09['use'](_0xbb43('0x8a'),require(_0xbb43('0x8b')));_0x2e9c09[_0xbb43('0x8')]('/api/analytics/tree_reports',require(_0xbb43('0x8c')));_0x2e9c09['use'](_0xbb43('0x8d'),require(_0xbb43('0x8e')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/salesforce/configurations',require(_0xbb43('0x8f')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x90'),require('./api/intSugarcrmAccount'));_0x2e9c09['use'](_0xbb43('0x91'),require('./api/intSugarcrmConfiguration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x92'),require(_0xbb43('0x93')));_0x2e9c09['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x2e9c09['use']('/api/integrations/desk/configurations',require(_0xbb43('0x94')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x95'),require(_0xbb43('0x96')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/zoho/accounts',require(_0xbb43('0x97')));_0x2e9c09['use'](_0xbb43('0x98'),require('./api/intZohoConfiguration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x99'),require(_0xbb43('0x9a')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/zendesk/accounts',require(_0xbb43('0x9b')));_0x2e9c09['use'](_0xbb43('0x9c'),require(_0xbb43('0x9d')));_0x2e9c09['use'](_0xbb43('0x9e'),require(_0xbb43('0x9f')));_0x2e9c09['use'](_0xbb43('0xa0'),require(_0xbb43('0xa1')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xa2'),require(_0xbb43('0xa3')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xa4'),require(_0xbb43('0xa5')));_0x2e9c09['use'](_0xbb43('0xa6'),require('./api/intVtigerAccount'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xa7'),require('./api/intVtigerConfiguration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xa8'),require(_0xbb43('0xa9')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xaa'),require(_0xbb43('0xab')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xac'),require('./api/intServicenowConfiguration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xad'),require(_0xbb43('0xae')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/dynamics365/accounts',require(_0xbb43('0xaf')));_0x2e9c09['use'](_0xbb43('0xb0'),require('./api/intDynamics365Configuration'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xb1'),require(_0xbb43('0xb2')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xb3'),require(_0xbb43('0xb4')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xb5'),require(_0xbb43('0xb6')));_0x2e9c09[_0xbb43('0x8')]('/api/integrations/freshsales/fields',require(_0xbb43('0xb7')));_0x2e9c09['use'](_0xbb43('0xb8'),require(_0xbb43('0xb9')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xba'),require(_0xbb43('0xbb')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xbc'),require(_0xbb43('0xbd')));_0x2e9c09['use'](_0xbb43('0xbe'),require('./api/jscriptyAnswerReport'));_0x2e9c09['use'](_0xbb43('0xbf'),require('./api/jscriptyQuestionReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc0'),require('./api/jscriptySessionReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc1'),require('./api/smsQueueReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc2'),require(_0xbb43('0xc3')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc4'),require(_0xbb43('0xc5')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc6'),require(_0xbb43('0xc7')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xc8'),require(_0xbb43('0xc9')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xca'),require(_0xbb43('0xcb')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xcc'),require(_0xbb43('0xcd')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xce'),require(_0xbb43('0xcf')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xd0'),require(_0xbb43('0xd1')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xd2'),require(_0xbb43('0xd3')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xd4'),require(_0xbb43('0xd5')));_0x2e9c09['use'](_0xbb43('0xd6'),require(_0xbb43('0xd7')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xd8'),require(_0xbb43('0xd9')));_0x2e9c09[_0xbb43('0x8')]('/api/attachments',require(_0xbb43('0xda')));_0x2e9c09[_0xbb43('0x8')]('/api/plugins',require('./api/plugin'));_0x2e9c09['use'](_0xbb43('0xdb'),require(_0xbb43('0xdc')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xdd'),require('./api/chatTransferReport'));_0x2e9c09['use'](_0xbb43('0xde'),require('./api/faxTransferReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xdf'),require('./api/openchannelTransferReport'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe0'),require(_0xbb43('0xe1')));_0x2e9c09['use'](_0xbb43('0xe2'),require('./api/cmList'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe3'),require('./api/voicePrefix'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe4'),require(_0xbb43('0xe5')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe6'),require('./api/userProfileSection'));_0x2e9c09['use'](_0xbb43('0xe7'),require(_0xbb43('0xe8')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xe9'),require(_0xbb43('0xea')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xeb'),require(_0xbb43('0xec')));_0x2e9c09['use'](_0xbb43('0xed'),require('./api/whatsappApplication'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xee'),require('./api/whatsappInteraction'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xef'),require(_0xbb43('0xf0')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xf1'),require(_0xbb43('0xf2')));_0x2e9c09['use'](_0xbb43('0xf3'),require(_0xbb43('0xf4')));_0x2e9c09['use'](_0xbb43('0xf5'),require('./api/whatsappQueue'));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xf6'),require(_0xbb43('0xf7')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xf8'),require(_0xbb43('0xf9')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xfa'),require(_0xbb43('0xfb')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xfc'),require('./api/authLocal'));_0x2e9c09[_0xbb43('0x8')]('/api/auth/google',require(_0xbb43('0xfd')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0xfe'),require(_0xbb43('0xff')));_0x2e9c09[_0xbb43('0x8')]('/api/jira',require(_0xbb43('0x100')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x101'),require(_0xbb43('0x102')));_0x2e9c09[_0xbb43('0x8')]('/api/version',require(_0xbb43('0x103')));_0x2e9c09['use'](_0xbb43('0x104'),require(_0xbb43('0x105')));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x106'),require(_0xbb43('0x107')));_0x2e9c09['use'](_0xbb43('0x108'),require('./api/webbar'));_0x2e9c09[_0xbb43('0x8')]('/api/logs',clientSideLogs);_0x2e9c09[_0xbb43('0x8')]('/apidoc',express[_0xbb43('0x109')](path[_0xbb43('0x10a')](config[_0xbb43('0x10b')],'/apidoc')));_0x2e9c09[_0xbb43('0x8')]('/www',express[_0xbb43('0x109')](path[_0xbb43('0x10a')](config['root'],_0xbb43('0x10c'))));_0x2e9c09[_0xbb43('0x8')](_0xbb43('0x10d'),express[_0xbb43('0x109')](path['join'](config[_0xbb43('0x10b')],_0xbb43('0x10d'))));_0x2e9c09['use']('/snippet',express['static'](path[_0xbb43('0x10a')](config['root'],_0xbb43('0x10e'),_0xbb43('0x10f'))));_0x2e9c09[_0xbb43('0x8')]('/plugins',express['static'](path[_0xbb43('0x10a')](config[_0xbb43('0x10b')],_0xbb43('0x110'))));_0x2e9c09[_0xbb43('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xbb43('0x112')](errors[0x194]);_0x2e9c09[_0xbb43('0x111')]('/*')[_0xbb43('0x112')](function(_0x49be0f,_0x202f08){_0x202f08[_0xbb43('0x113')](path[_0xbb43('0x114')](_0x2e9c09[_0xbb43('0x112')](_0xbb43('0x115'))+'/index.html'));});return _0x2e9c09;});}; \ No newline at end of file +var _0x44d4=['/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/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./utils/client-side-logger','setupLoggers','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport'];(function(_0x3824ef,_0x4824cf){var _0x4d69d0=function(_0x2b4e4e){while(--_0x2b4e4e){_0x3824ef['push'](_0x3824ef['shift']());}};_0x4d69d0(++_0x4824cf);}(_0x44d4,0x161));var _0x444d=function(_0x19fc3e,_0x1a060e){_0x19fc3e=_0x19fc3e-0x0;var _0x56a220=_0x44d4[_0x19fc3e];return _0x56a220;};'use strict';var path=require(_0x444d('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x444d('0x1'))[_0x444d('0x2')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x51377d){return setupLoggers(_0x51377d)[_0x444d('0x3')](function(){_0x51377d[_0x444d('0x4')](_0x444d('0x5'),require(_0x444d('0x6')));_0x51377d[_0x444d('0x4')](_0x444d('0x7'),require(_0x444d('0x8')));_0x51377d['use'](_0x444d('0x9'),require('./api/voiceContext'));_0x51377d[_0x444d('0x4')](_0x444d('0xa'),require(_0x444d('0xb')));_0x51377d[_0x444d('0x4')](_0x444d('0xc'),require(_0x444d('0xd')));_0x51377d[_0x444d('0x4')](_0x444d('0xe'),require(_0x444d('0xf')));_0x51377d[_0x444d('0x4')](_0x444d('0x10'),require('./api/voiceRecording'));_0x51377d[_0x444d('0x4')](_0x444d('0x11'),require('./api/screenRecording'));_0x51377d[_0x444d('0x4')](_0x444d('0x12'),require(_0x444d('0x13')));_0x51377d['use'](_0x444d('0x14'),require(_0x444d('0x15')));_0x51377d[_0x444d('0x4')]('/api/voice/calls/reports',require(_0x444d('0x16')));_0x51377d['use'](_0x444d('0x17'),require(_0x444d('0x18')));_0x51377d[_0x444d('0x4')](_0x444d('0x19'),require('./api/voiceAgentReport'));_0x51377d['use']('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x51377d[_0x444d('0x4')](_0x444d('0x1a'),require(_0x444d('0x1b')));_0x51377d['use']('/api/trunks',require(_0x444d('0x1c')));_0x51377d[_0x444d('0x4')](_0x444d('0x1d'),require(_0x444d('0x1e')));_0x51377d[_0x444d('0x4')]('/api/mail/out_servers',require(_0x444d('0x1f')));_0x51377d[_0x444d('0x4')](_0x444d('0x20'),require(_0x444d('0x21')));_0x51377d[_0x444d('0x4')](_0x444d('0x22'),require(_0x444d('0x23')));_0x51377d['use']('/api/mail/substatuses',require(_0x444d('0x24')));_0x51377d['use']('/api/mail/interactions',require(_0x444d('0x25')));_0x51377d[_0x444d('0x4')](_0x444d('0x26'),require('./api/mailMessage'));_0x51377d[_0x444d('0x4')](_0x444d('0x27'),require(_0x444d('0x28')));_0x51377d[_0x444d('0x4')](_0x444d('0x29'),require(_0x444d('0x2a')));_0x51377d[_0x444d('0x4')](_0x444d('0x2b'),require(_0x444d('0x2c')));_0x51377d['use']('/api/dashboards/items',require(_0x444d('0x2d')));_0x51377d['use']('/api/fax/accounts',require(_0x444d('0x2e')));_0x51377d['use'](_0x444d('0x2f'),require(_0x444d('0x30')));_0x51377d['use'](_0x444d('0x31'),require(_0x444d('0x32')));_0x51377d[_0x444d('0x4')](_0x444d('0x33'),require('./api/faxMessage'));_0x51377d[_0x444d('0x4')]('/api/fax/queues',require(_0x444d('0x34')));_0x51377d['use'](_0x444d('0x35'),require(_0x444d('0x36')));_0x51377d[_0x444d('0x4')](_0x444d('0x37'),require(_0x444d('0x38')));_0x51377d['use'](_0x444d('0x39'),require(_0x444d('0x3a')));_0x51377d[_0x444d('0x4')](_0x444d('0x3b'),require(_0x444d('0x3c')));_0x51377d[_0x444d('0x4')](_0x444d('0x3d'),require(_0x444d('0x3e')));_0x51377d[_0x444d('0x4')]('/api/sms/queues',require('./api/smsQueue'));_0x51377d[_0x444d('0x4')](_0x444d('0x3f'),require('./api/openchannelAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0x40'),require(_0x444d('0x41')));_0x51377d[_0x444d('0x4')](_0x444d('0x42'),require('./api/openchannelInteraction'));_0x51377d['use']('/api/openchannel/messages',require(_0x444d('0x43')));_0x51377d[_0x444d('0x4')]('/api/openchannel/queues',require(_0x444d('0x44')));_0x51377d['use'](_0x444d('0x45'),require(_0x444d('0x46')));_0x51377d[_0x444d('0x4')](_0x444d('0x47'),require(_0x444d('0x48')));_0x51377d['use']('/api/chat/applications',require(_0x444d('0x49')));_0x51377d[_0x444d('0x4')](_0x444d('0x4a'),require(_0x444d('0x4b')));_0x51377d[_0x444d('0x4')](_0x444d('0x4c'),require(_0x444d('0x4d')));_0x51377d['use'](_0x444d('0x4e'),require(_0x444d('0x4f')));_0x51377d['use']('/api/chat/queues',require(_0x444d('0x50')));_0x51377d[_0x444d('0x4')]('/api/chat/groups',require(_0x444d('0x51')));_0x51377d[_0x444d('0x4')](_0x444d('0x52'),require(_0x444d('0x53')));_0x51377d['use']('/api/cm/companies',require('./api/cmCompany'));_0x51377d[_0x444d('0x4')]('/api/cm/contacts',require(_0x444d('0x54')));_0x51377d[_0x444d('0x4')]('/api/cm/hopper',require(_0x444d('0x55')));_0x51377d[_0x444d('0x4')]('/api/cm/hopper_black',require(_0x444d('0x56')));_0x51377d[_0x444d('0x4')](_0x444d('0x57'),require(_0x444d('0x58')));_0x51377d[_0x444d('0x4')](_0x444d('0x59'),require(_0x444d('0x5a')));_0x51377d[_0x444d('0x4')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x51377d['use'](_0x444d('0x5b'),require(_0x444d('0x5c')));_0x51377d[_0x444d('0x4')](_0x444d('0x5d'),require('./api/automation'));_0x51377d[_0x444d('0x4')](_0x444d('0x5e'),require(_0x444d('0x5f')));_0x51377d['use'](_0x444d('0x60'),require('./api/disposition'));_0x51377d[_0x444d('0x4')](_0x444d('0x61'),require(_0x444d('0x62')));_0x51377d[_0x444d('0x4')]('/api/intervals',require(_0x444d('0x63')));_0x51377d[_0x444d('0x4')](_0x444d('0x64'),require(_0x444d('0x65')));_0x51377d[_0x444d('0x4')](_0x444d('0x66'),require(_0x444d('0x67')));_0x51377d[_0x444d('0x4')](_0x444d('0x68'),require(_0x444d('0x69')));_0x51377d[_0x444d('0x4')](_0x444d('0x6a'),require(_0x444d('0x6b')));_0x51377d[_0x444d('0x4')](_0x444d('0x6c'),require(_0x444d('0x6d')));_0x51377d[_0x444d('0x4')]('/api/tags',require('./api/tag'));_0x51377d[_0x444d('0x4')](_0x444d('0x6e'),require(_0x444d('0x6f')));_0x51377d['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x51377d[_0x444d('0x4')](_0x444d('0x70'),require(_0x444d('0x71')));_0x51377d[_0x444d('0x4')](_0x444d('0x72'),require(_0x444d('0x73')));_0x51377d[_0x444d('0x4')](_0x444d('0x74'),require(_0x444d('0x75')));_0x51377d[_0x444d('0x4')](_0x444d('0x76'),require(_0x444d('0x77')));_0x51377d['use'](_0x444d('0x78'),require('./api/integration'));_0x51377d[_0x444d('0x4')](_0x444d('0x79'),require('./api/integrationReport'));_0x51377d[_0x444d('0x4')](_0x444d('0x7a'),require(_0x444d('0x7b')));_0x51377d['use']('/api/analytics/default_reports',require(_0x444d('0x7c')));_0x51377d[_0x444d('0x4')](_0x444d('0x7d'),require('./api/analyticExtractedReport'));_0x51377d[_0x444d('0x4')](_0x444d('0x7e'),require(_0x444d('0x7f')));_0x51377d[_0x444d('0x4')](_0x444d('0x80'),require(_0x444d('0x81')));_0x51377d['use'](_0x444d('0x82'),require('./api/analyticTreeReport'));_0x51377d['use'](_0x444d('0x83'),require('./api/intSalesforceAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0x84'),require(_0x444d('0x85')));_0x51377d[_0x444d('0x4')]('/api/integrations/salesforce/fields',require(_0x444d('0x86')));_0x51377d[_0x444d('0x4')](_0x444d('0x87'),require(_0x444d('0x88')));_0x51377d[_0x444d('0x4')](_0x444d('0x89'),require(_0x444d('0x8a')));_0x51377d['use'](_0x444d('0x8b'),require(_0x444d('0x8c')));_0x51377d['use'](_0x444d('0x8d'),require('./api/intDeskAccount'));_0x51377d['use'](_0x444d('0x8e'),require('./api/intDeskConfiguration'));_0x51377d[_0x444d('0x4')](_0x444d('0x8f'),require(_0x444d('0x90')));_0x51377d[_0x444d('0x4')]('/api/integrations/zoho/accounts',require(_0x444d('0x91')));_0x51377d['use']('/api/integrations/zoho/configurations',require(_0x444d('0x92')));_0x51377d[_0x444d('0x4')](_0x444d('0x93'),require(_0x444d('0x94')));_0x51377d[_0x444d('0x4')](_0x444d('0x95'),require(_0x444d('0x96')));_0x51377d['use'](_0x444d('0x97'),require(_0x444d('0x98')));_0x51377d[_0x444d('0x4')]('/api/integrations/zendesk/fields',require(_0x444d('0x99')));_0x51377d[_0x444d('0x4')](_0x444d('0x9a'),require('./api/intFreshdeskAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0x9b'),require(_0x444d('0x9c')));_0x51377d[_0x444d('0x4')](_0x444d('0x9d'),require(_0x444d('0x9e')));_0x51377d[_0x444d('0x4')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0x9f'),require(_0x444d('0xa0')));_0x51377d[_0x444d('0x4')]('/api/integrations/vtiger/fields',require(_0x444d('0xa1')));_0x51377d[_0x444d('0x4')](_0x444d('0xa2'),require(_0x444d('0xa3')));_0x51377d[_0x444d('0x4')]('/api/integrations/servicenow/configurations',require(_0x444d('0xa4')));_0x51377d[_0x444d('0x4')](_0x444d('0xa5'),require(_0x444d('0xa6')));_0x51377d[_0x444d('0x4')]('/api/integrations/dynamics365/accounts',require(_0x444d('0xa7')));_0x51377d['use'](_0x444d('0xa8'),require('./api/intDynamics365Configuration'));_0x51377d['use']('/api/integrations/dynamics365/fields',require(_0x444d('0xa9')));_0x51377d['use'](_0x444d('0xaa'),require('./api/intFreshsalesAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0xab'),require(_0x444d('0xac')));_0x51377d['use'](_0x444d('0xad'),require(_0x444d('0xae')));_0x51377d[_0x444d('0x4')](_0x444d('0xaf'),require(_0x444d('0xb0')));_0x51377d['use'](_0x444d('0xb1'),require(_0x444d('0xb2')));_0x51377d[_0x444d('0x4')](_0x444d('0xb3'),require('./api/chatInternalMessage'));_0x51377d[_0x444d('0x4')](_0x444d('0xb4'),require('./api/jscriptyAnswerReport'));_0x51377d[_0x444d('0x4')](_0x444d('0xb5'),require(_0x444d('0xb6')));_0x51377d[_0x444d('0x4')](_0x444d('0xb7'),require('./api/jscriptySessionReport'));_0x51377d[_0x444d('0x4')](_0x444d('0xb8'),require('./api/smsQueueReport'));_0x51377d[_0x444d('0x4')](_0x444d('0xb9'),require(_0x444d('0xba')));_0x51377d[_0x444d('0x4')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x51377d[_0x444d('0x4')](_0x444d('0xbb'),require('./api/jscriptyProject'));_0x51377d['use'](_0x444d('0xbc'),require(_0x444d('0xbd')));_0x51377d[_0x444d('0x4')](_0x444d('0xbe'),require(_0x444d('0xbf')));_0x51377d['use'](_0x444d('0xc0'),require(_0x444d('0xc1')));_0x51377d[_0x444d('0x4')](_0x444d('0xc2'),require(_0x444d('0xc3')));_0x51377d[_0x444d('0x4')](_0x444d('0xc4'),require('./api/squareMessage'));_0x51377d[_0x444d('0x4')]('/api/teams',require('./api/team'));_0x51377d[_0x444d('0x4')](_0x444d('0xc5'),require(_0x444d('0xc6')));_0x51377d[_0x444d('0x4')](_0x444d('0xc7'),require(_0x444d('0xc8')));_0x51377d[_0x444d('0x4')](_0x444d('0xc9'),require('./api/migration'));_0x51377d[_0x444d('0x4')](_0x444d('0xca'),require(_0x444d('0xcb')));_0x51377d[_0x444d('0x4')](_0x444d('0xcc'),require(_0x444d('0xcd')));_0x51377d[_0x444d('0x4')]('/api/mail/reports/transfer',require(_0x444d('0xce')));_0x51377d['use'](_0x444d('0xcf'),require('./api/chatTransferReport'));_0x51377d[_0x444d('0x4')]('/api/fax/reports/transfer',require(_0x444d('0xd0')));_0x51377d['use'](_0x444d('0xd1'),require(_0x444d('0xd2')));_0x51377d[_0x444d('0x4')](_0x444d('0xd3'),require(_0x444d('0xd4')));_0x51377d['use']('/api/cm/lists',require(_0x444d('0xd5')));_0x51377d[_0x444d('0x4')](_0x444d('0xd6'),require('./api/voicePrefix'));_0x51377d['use'](_0x444d('0xd7'),require(_0x444d('0xd8')));_0x51377d[_0x444d('0x4')](_0x444d('0xd9'),require(_0x444d('0xda')));_0x51377d[_0x444d('0x4')]('/api/userProfile/resources',require(_0x444d('0xdb')));_0x51377d['use'](_0x444d('0xdc'),require(_0x444d('0xdd')));_0x51377d[_0x444d('0x4')](_0x444d('0xde'),require(_0x444d('0xdf')));_0x51377d[_0x444d('0x4')](_0x444d('0xe0'),require(_0x444d('0xe1')));_0x51377d[_0x444d('0x4')]('/api/whatsapp/interactions',require(_0x444d('0xe2')));_0x51377d[_0x444d('0x4')]('/api/whatsapp/messages',require(_0x444d('0xe3')));_0x51377d['use'](_0x444d('0xe4'),require(_0x444d('0xe5')));_0x51377d['use'](_0x444d('0xe6'),require(_0x444d('0xe7')));_0x51377d['use'](_0x444d('0xe8'),require('./api/whatsappQueue'));_0x51377d[_0x444d('0x4')]('/api/cloudProviders',require('./api/cloudProvider'));_0x51377d[_0x444d('0x4')](_0x444d('0xe9'),require(_0x444d('0xea')));_0x51377d[_0x444d('0x4')](_0x444d('0xeb'),require(_0x444d('0xec')));_0x51377d['use'](_0x444d('0xed'),require(_0x444d('0xee')));_0x51377d[_0x444d('0x4')](_0x444d('0xef'),require(_0x444d('0xf0')));_0x51377d['use'](_0x444d('0xf1'),require(_0x444d('0xf2')));_0x51377d['use'](_0x444d('0xf3'),require(_0x444d('0xf4')));_0x51377d[_0x444d('0x4')](_0x444d('0xf5'),require(_0x444d('0xf6')));_0x51377d['use']('/api/version',require(_0x444d('0xf7')));_0x51377d[_0x444d('0x4')](_0x444d('0xf8'),require('./api/system'));_0x51377d['use'](_0x444d('0xf9'),require(_0x444d('0xfa')));_0x51377d[_0x444d('0x4')]('/api/webbar',require('./api/webbar'));_0x51377d[_0x444d('0x4')](_0x444d('0xfb'),clientSideLogs);_0x51377d[_0x444d('0x4')]('/apidoc',express[_0x444d('0xfc')](path[_0x444d('0xfd')](config[_0x444d('0xfe')],_0x444d('0xff'))));_0x51377d[_0x444d('0x4')](_0x444d('0x100'),express[_0x444d('0xfc')](path[_0x444d('0xfd')](config[_0x444d('0xfe')],_0x444d('0x100'))));_0x51377d[_0x444d('0x4')](_0x444d('0x101'),express[_0x444d('0xfc')](path[_0x444d('0xfd')](config[_0x444d('0xfe')],_0x444d('0x101'))));_0x51377d[_0x444d('0x4')](_0x444d('0x102'),express[_0x444d('0xfc')](path[_0x444d('0xfd')](config['root'],_0x444d('0x103'),_0x444d('0x104'))));_0x51377d['use'](_0x444d('0x105'),express[_0x444d('0xfc')](path[_0x444d('0xfd')](config[_0x444d('0xfe')],_0x444d('0x106'))));_0x51377d[_0x444d('0x107')](_0x444d('0x108'))['get'](errors[0x194]);_0x51377d[_0x444d('0x107')]('/*')[_0x444d('0x109')](function(_0x3c508c,_0xf190a9){_0xf190a9[_0x444d('0x10a')](path[_0x444d('0x10b')](_0x51377d[_0x444d('0x109')](_0x444d('0x10c'))+_0x444d('0x10d')));});return _0x51377d;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 781f3c7..4208fa9 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36b2=['../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.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','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','../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/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.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/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc'];(function(_0x130c7d,_0x155870){var _0xaaa03e=function(_0x553bd7){while(--_0x553bd7){_0x130c7d['push'](_0x130c7d['shift']());}};_0xaaa03e(++_0x155870);}(_0x36b2,0x6b));var _0x236b=function(_0x52702a,_0x132421){_0x52702a=_0x52702a-0x0;var _0x49f776=_0x36b2[_0x52702a];return _0x49f776;};'use strict';var jayson=require(_0x236b('0x0'));var _=require(_0x236b('0x1'));var config=require(_0x236b('0x2'));exports['listen']=function(){return new Promise(function(_0x17977e,_0x2aa6b5){var _0x45d0d4={};_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x3')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/voiceExtension/voiceExtension.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x5')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x6')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x7')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x8')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x9')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0xa')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/trunk/trunk.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0xb')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/mailServerIn/mailServerIn.rpc'));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0xc')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0xd')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0xe')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0xf')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x10')));_0x45d0d4=_['merge'](_0x45d0d4,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x11')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x12')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/faxInteraction/faxInteraction.rpc'));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x13')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x14')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x15')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x16')));_0x45d0d4=_['merge'](_0x45d0d4,require('../api/smsMessage/smsMessage.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x17')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x18')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x19')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1a')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1b')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1c')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x1d')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/chatMessage/chatMessage.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1e')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/cmContact/cmContact.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x1f')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x20')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x21')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x22')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x23')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x24')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x25')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x26')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x27')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x28')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x29')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x2a')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x2b')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x2c')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x2d')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x2e')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x2f')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x30')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x31')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x32')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x33')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x34')));_0x45d0d4=_['merge'](_0x45d0d4,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x35')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x36')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x37')));_0x45d0d4=_['merge'](_0x45d0d4,require(_0x236b('0x38')));_0x45d0d4=_['merge'](_0x45d0d4,require('../api/squareProject/squareProject.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x39')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3a')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require('../api/campaign/campaign.rpc'));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3b')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3c')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3d')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3e')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x3f')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x40')));_0x45d0d4=_[_0x236b('0x4')](_0x45d0d4,require(_0x236b('0x41')));var _0x2423e5=jayson[_0x236b('0x42')](_0x45d0d4)[_0x236b('0x43')]();var _0x22616a=config[_0x236b('0x44')][_0x236b('0x45')]||config[_0x236b('0x45')]+0x1;var _0x50ba8b=config['rpc']['ip']||'localhost';_0x2423e5['on'](_0x236b('0x46'),function(_0x3b05c0){return _0x2aa6b5(_0x3b05c0);});_0x2423e5[_0x236b('0x47')](_0x22616a,_0x50ba8b,function(){console[_0x236b('0x48')](_0x236b('0x49'),_0x50ba8b,_0x22616a);require(_0x236b('0x4a'))[_0x236b('0x4b')]();return _0x17977e(_0x236b('0x4c')+_0x50ba8b+':'+_0x22616a);});});}; \ No newline at end of file +var _0xff00=['http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server'];(function(_0x219c94,_0x804879){var _0x15c0a0=function(_0x407ee0){while(--_0x407ee0){_0x219c94['push'](_0x219c94['shift']());}};_0x15c0a0(++_0x804879);}(_0xff00,0x1a6));var _0x0ff0=function(_0x213dc0,_0x50248e){_0x213dc0=_0x213dc0-0x0;var _0x52ed0d=_0xff00[_0x213dc0];return _0x52ed0d;};'use strict';var jayson=require(_0x0ff0('0x0'));var _=require(_0x0ff0('0x1'));var config=require(_0x0ff0('0x2'));exports[_0x0ff0('0x3')]=function(){return new Promise(function(_0x4d8627,_0xf46a0a){var _0x35d4de={};_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x4')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x6')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x7')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x8')));_0x35d4de=_['merge'](_0x35d4de,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x9')));_0x35d4de=_['merge'](_0x35d4de,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/memberReport/memberReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0xa')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0xb')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0xc')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/mailServerIn/mailServerIn.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0xd')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0xe')));_0x35d4de=_['merge'](_0x35d4de,require('../api/mailInteraction/mailInteraction.rpc'));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0xf')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/mailApplication/mailApplication.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x10')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x11')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x12')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/faxMessage/faxMessage.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x13')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x14')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x15')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x16')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x17')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x18')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x19')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x1a')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x1b')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x1c')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x1d')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x1e')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x1f')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x20')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x21')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x22')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x23')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x24')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x25')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x26')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x27')));_0x35d4de=_['merge'](_0x35d4de,require('../api/pause/pause.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x28')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x29')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x2a')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/variable/variable.rpc'));_0x35d4de=_['merge'](_0x35d4de,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x2b')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x2c')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x2d')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x2e')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x2f')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x30')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x35d4de=_['merge'](_0x35d4de,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/squareReport/squareReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x31')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x32')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/squareOdbc/squareOdbc.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x33')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x34')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x35')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/campaign/campaign.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x36')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x37')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x38')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x39')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x3a')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x3b')));var _0x16a53d=jayson[_0x0ff0('0x3c')](_0x35d4de)[_0x0ff0('0x3d')]();var _0x5f357b=config[_0x0ff0('0x3e')][_0x0ff0('0x3f')]||config[_0x0ff0('0x3f')]+0x1;var _0x10f571=config[_0x0ff0('0x3e')]['ip']||_0x0ff0('0x40');_0x16a53d['on'](_0x0ff0('0x41'),function(_0x3c74ca){return _0xf46a0a(_0x3c74ca);});_0x16a53d['listen'](_0x5f357b,_0x10f571,function(){console[_0x0ff0('0x42')](_0x0ff0('0x43'),_0x10f571,_0x5f357b);require('../config/triggers')['default']();return _0x4d8627(_0x0ff0('0x44')+_0x10f571+':'+_0x5f357b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d78e210..28dad3d 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 _0xb296=['SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','replace','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','pipe','write','prototype','command','sync','answer','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s'];(function(_0x826da3,_0x1eedfd){var _0x442c47=function(_0x57e53a){while(--_0x57e53a){_0x826da3['push'](_0x826da3['shift']());}};_0x442c47(++_0x1eedfd);}(_0xb296,0xa3));var _0x6b29=function(_0x5600d8,_0xc2ed6b){_0x5600d8=_0x5600d8-0x0;var _0x35ea60=_0xb296[_0x5600d8];return _0x35ea60;};'use strict';var util=require(_0x6b29('0x0'));var _=require(_0x6b29('0x1'));var EventEmitter=require(_0x6b29('0x2'))[_0x6b29('0x3')];var AGIReply=require(_0x6b29('0x4'));var AGIError=require(_0x6b29('0x5'));function AGIChannel(_0x2c502e){var _0x48e967=this,_0x3ff65c=new AGIReply(),_0x5c1cf5=![],_0x50a1ba={};EventEmitter[_0x6b29('0x6')](_0x48e967);_0x2c502e['setEncoding'](_0x6b29('0x7'));_0x2c502e[_0x6b29('0x8')](0x8*0x3c*0x3c*0x3e8);_0x3ff65c[_0x6b29('0x9')](_0x6b29('0x7'));_0x3ff65c['on'](_0x6b29('0xa'),function(_0x4e4dd4){for(var _0x533b28 in _0x4e4dd4){_0x48e967[_0x533b28]=_0x4e4dd4[_0x533b28];}_0x48e967[_0x6b29('0xb')](_0x6b29('0xc'));});_0x3ff65c['on'](_0x6b29('0xd'),function(_0x1eb87c){if(_0x1eb87c[_0x6b29('0xe')]()==_0x6b29('0xf')){_0x48e967[_0x6b29('0xb')]('hangup');return;}if(_0x1eb87c[_0x6b29('0x10')](0x0,0xb)==_0x6b29('0x11')){_0x5c1cf5=!![];}if(_0x5c1cf5){_0x50a1ba['rx']+=_0x1eb87c+'\x0a';if(_0x1eb87c[_0x6b29('0x12')]('520\x20End\x20of\x20proper')!=-0x1){_0x5c1cf5=![];}}else{_0x50a1ba['rx']=_0x1eb87c;}if(_0x5c1cf5){return;}if(typeof _0x50a1ba['cb']==_0x6b29('0x13')){var _0x4ca75d=_0x50a1ba['rx']['substring'](0x0,0x3),_0x512818=null,_0x28495f=null;_0x4ca75d=parseInt(_0x4ca75d);if(isNaN(_0x4ca75d)){_0x50a1ba['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4ca75d!=0xc8){_0x50a1ba['cb'](null,{'code':_0x4ca75d,'result':-0x1,'extra':'KO'});return;}_0x512818=_0x50a1ba['rx'][_0x6b29('0x10')](0x4)[_0x6b29('0x14')]('result=','');if(_0x512818[_0x6b29('0x15')]('\x20')!=-0x1){_0x512818=_0x512818[_0x6b29('0x16')](0x0,_0x512818[_0x6b29('0x15')]('\x20'));}if(_[_0x6b29('0x17')](_0x512818,'-1')){_0x512818=parseInt(_0x512818);}_0x28495f=_0x50a1ba['rx'][_0x6b29('0x18')]('\x20');if(_0x28495f[_0x6b29('0x19')]==0x3){_0x28495f=_0x28495f[0x2][_0x6b29('0x10')](0x1,_0x28495f[0x2]['length']-0x1);}else if(_0x28495f[_0x6b29('0x19')]>0x3){var _0x14a4a8=/\((.+)\)/;var _0x1b2830=_0x50a1ba['rx']['match'](_0x14a4a8);if(_0x1b2830){_0x28495f=_0x1b2830[0x1];}else{_0x28495f=null;}}else{_0x28495f=null;}_0x50a1ba['cb'](null,{'code':_0x4ca75d,'result':_0x512818,'extra':_0x28495f});}});_0x2c502e['on']('error',function(_0xc9511c){_0x48e967[_0x6b29('0xb')](_0x6b29('0x1a'),new AGIError(_0x6b29('0x1b'),_0xc9511c[_0x6b29('0x1c')]));});_0x2c502e['on'](_0x6b29('0x1d'),function(){_0x48e967[_0x6b29('0xb')](_0x6b29('0x1d'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x2c502e['on'](_0x6b29('0x1e'),function(){_0x48e967[_0x6b29('0xb')](_0x6b29('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2c502e[_0x6b29('0x1f')]();});_0x2c502e[_0x6b29('0x20')](_0x3ff65c);this['command']=function(_0x35d3e4,_0x3686d1){var _0x35d3e4=_0x35d3e4||'',_0x3686d1=typeof _0x3686d1==_0x6b29('0x13')?_0x3686d1:new Function();_0x50a1ba={'tx':_0x35d3e4,'rx':'','cb':_0x3686d1};_0x2c502e[_0x6b29('0x21')](_0x35d3e4+'\x0a');},this[_0x6b29('0x1d')]=function(){_0x2c502e[_0x6b29('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x6b29('0x22')]['sendRequest']=function(_0x237cad){return this[_0x6b29('0x23')][_0x6b29('0x24')](this,_0x237cad);};AGIChannel[_0x6b29('0x22')][_0x6b29('0x25')]=function(){return this[_0x6b29('0x26')](_0x6b29('0x27'));};AGIChannel['prototype'][_0x6b29('0x28')]=function(_0x3b2811,_0xea8c31,_0x654528){_0x3b2811=_0x3b2811===undefined?'beep':_0x3b2811;_0xea8c31=_0xea8c31===undefined?'5':_0xea8c31;_0x654528=_0x654528===undefined?'1':_0x654528;return this['sendRequest'](util[_0x6b29('0x29')](_0x6b29('0x2a'),_0x3b2811,_0xea8c31*0x3e8,_0x654528));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x2b')]=function(_0x370d50){_0x370d50=_0x370d50||_0x6b29('0x2c');return this[_0x6b29('0x26')](util['format'](_0x6b29('0x2d'),_0x370d50));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x2e')]=function(_0x36e708,_0x36e293){if(_[_0x6b29('0x2f')](_0x36e293)){return this['sendRequest'](util[_0x6b29('0x29')](_0x6b29('0x30'),_0x36e708,_0x36e293[_0x6b29('0x31')](',')));}return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x30'),_0x36e708,_0x36e293));};AGIChannel[_0x6b29('0x22')]['setContext']=function(_0x129846){return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x32'),_0x129846));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x33')]=function(_0x2d0988){return this[_0x6b29('0x26')](util['format']('SET\x20EXTENSION\x20%s',_0x2d0988));};AGIChannel['prototype']['setPriority']=function(_0x2b3df9){return this[_0x6b29('0x26')](util[_0x6b29('0x29')]('SET\x20PRIORITY\x20%s',_0x2b3df9));};AGIChannel[_0x6b29('0x22')][_0x6b29('0xf')]=function(){return this[_0x6b29('0x26')](_0x6b29('0x34'));};AGIChannel['prototype'][_0x6b29('0x35')]=function(_0x24ee15,_0x20f7da){var _0x5aad94=_['isBoolean'](_0x20f7da)||_[_0x6b29('0x36')](_0x20f7da)?_0x20f7da['toString']():_0x20f7da;return this['sendRequest'](util[_0x6b29('0x29')](_0x6b29('0x37'),_0x24ee15,_0x5aad94?_0x5aad94[_0x6b29('0x38')]()[_0x6b29('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x6b29('0x39')]=function(_0x54ccd5,_0xbb6e00){return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x3a'),_0x54ccd5,_0xbb6e00));};AGIChannel[_0x6b29('0x22')]['sayDigits']=function(_0x332af5,_0x2be07a){return this[_0x6b29('0x26')](util[_0x6b29('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x332af5,_0x2be07a));};AGIChannel[_0x6b29('0x22')]['sayPhonetic']=function(_0x247e4f,_0x3bd58d){return this['sendRequest'](util['format'](_0x6b29('0x3b'),_0x247e4f,_0x3bd58d));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x3c')]=function(_0x278573,_0x524feb,_0x8d8571){_0x524feb=_0x524feb||this[_0x6b29('0x3d')];_0x8d8571=_0x8d8571||0x1;this['setContext'](_0x278573);this[_0x6b29('0x33')](_0x524feb);this[_0x6b29('0x3e')](_0x8d8571);return this['noop'](util[_0x6b29('0x29')](_0x6b29('0x3f'),_0x278573,_0x524feb,_0x8d8571));};AGIChannel[_0x6b29('0x22')]['getVariable']=function(_0x574b40){return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x40'),_0x574b40));};AGIChannel[_0x6b29('0x22')][_0x6b29('0x41')]=function(_0x46813b,_0x285756,_0x4788e5,_0xe1c900,_0x3491ab,_0x48ab0f){_0x285756=_0x285756||'wav';_0x4788e5=_0x4788e5||'';_0xe1c900=_0xe1c900===undefined?-0x1:_0xe1c900==='-1'?-0x1:_0xe1c900*0x3e8;_0x3491ab=_0x3491ab===undefined?'':'s='+_0x3491ab;_0x48ab0f=_0x48ab0f?'BEEP':'';return this[_0x6b29('0x26')](util[_0x6b29('0x29')](_0x6b29('0x42'),_0x46813b,_0x285756,_0x4788e5,_0xe1c900,_0x48ab0f,_0x3491ab));};AGIChannel['prototype'][_0x6b29('0x43')]=function(_0x17201b,_0x495a72){_0x495a72=_0x495a72||'';return this[_0x6b29('0x26')](util['format'](_0x6b29('0x44'),_0x17201b,_0x495a72));};AGIChannel[_0x6b29('0x22')]['agi']=function(_0x2db4cc){return this[_0x6b29('0x2e')](_0x6b29('0x45'),_0x2db4cc);};AGIChannel[_0x6b29('0x22')]['wait']=function(_0x30df11){return this[_0x6b29('0x2e')](_0x6b29('0x46'),_0x30df11);};AGIChannel[_0x6b29('0x22')]['error']=function(_0x2338d9,_0x3729b8){this[_0x6b29('0x2b')](util['format'](_0x6b29('0x47'),_0x2338d9['id'],_0x2338d9[_0x6b29('0x48')],_0x3729b8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6b29('0x49')]=AGIChannel; \ No newline at end of file +var _0x99a0=['match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','continueAt','setContext','setPriority','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','wait','label','exports','util','lodash','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','result=','indexOf','substr','startsWith','split','length'];(function(_0x78068e,_0x536a1a){var _0xb8f50f=function(_0x57db2a){while(--_0x57db2a){_0x78068e['push'](_0x78068e['shift']());}};_0xb8f50f(++_0x536a1a);}(_0x99a0,0x121));var _0x099a=function(_0x1c1447,_0x9166cc){_0x1c1447=_0x1c1447-0x0;var _0x292a43=_0x99a0[_0x1c1447];return _0x292a43;};'use strict';var util=require(_0x099a('0x0'));var _=require(_0x099a('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x3f281a){var _0x2b5e88=this,_0x5d6b40=new AGIReply(),_0x21d681=![],_0x1d3f16={};EventEmitter[_0x099a('0x2')](_0x2b5e88);_0x3f281a[_0x099a('0x3')](_0x099a('0x4'));_0x3f281a[_0x099a('0x5')](0x8*0x3c*0x3c*0x3e8);_0x5d6b40['setEncoding'](_0x099a('0x4'));_0x5d6b40['on'](_0x099a('0x6'),function(_0x268440){for(var _0x4e8958 in _0x268440){_0x2b5e88[_0x4e8958]=_0x268440[_0x4e8958];}_0x2b5e88[_0x099a('0x7')](_0x099a('0x8'));});_0x5d6b40['on'](_0x099a('0x9'),function(_0x14cccc){if(_0x14cccc[_0x099a('0xa')]()==_0x099a('0xb')){_0x2b5e88[_0x099a('0x7')](_0x099a('0xb'));return;}if(_0x14cccc[_0x099a('0xc')](0x0,0xb)==_0x099a('0xd')){_0x21d681=!![];}if(_0x21d681){_0x1d3f16['rx']+=_0x14cccc+'\x0a';if(_0x14cccc[_0x099a('0xe')](_0x099a('0xf'))!=-0x1){_0x21d681=![];}}else{_0x1d3f16['rx']=_0x14cccc;}if(_0x21d681){return;}if(typeof _0x1d3f16['cb']==_0x099a('0x10')){var _0x1e9dc1=_0x1d3f16['rx'][_0x099a('0xc')](0x0,0x3),_0x2e8afc=null,_0x4bd3ee=null;_0x1e9dc1=parseInt(_0x1e9dc1);if(isNaN(_0x1e9dc1)){_0x1d3f16['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x1e9dc1!=0xc8){_0x1d3f16['cb'](null,{'code':_0x1e9dc1,'result':-0x1,'extra':'KO'});return;}_0x2e8afc=_0x1d3f16['rx'][_0x099a('0xc')](0x4)['replace'](_0x099a('0x11'),'');if(_0x2e8afc[_0x099a('0x12')]('\x20')!=-0x1){_0x2e8afc=_0x2e8afc[_0x099a('0x13')](0x0,_0x2e8afc[_0x099a('0x12')]('\x20'));}if(_[_0x099a('0x14')](_0x2e8afc,'-1')){_0x2e8afc=parseInt(_0x2e8afc);}_0x4bd3ee=_0x1d3f16['rx'][_0x099a('0x15')]('\x20');if(_0x4bd3ee['length']==0x3){_0x4bd3ee=_0x4bd3ee[0x2][_0x099a('0xc')](0x1,_0x4bd3ee[0x2][_0x099a('0x16')]-0x1);}else if(_0x4bd3ee[_0x099a('0x16')]>0x3){var _0x371af7=/\((.+)\)/;var _0x5d7b21=_0x1d3f16['rx'][_0x099a('0x17')](_0x371af7);if(_0x5d7b21){_0x4bd3ee=_0x5d7b21[0x1];}else{_0x4bd3ee=null;}}else{_0x4bd3ee=null;}_0x1d3f16['cb'](null,{'code':_0x1e9dc1,'result':_0x2e8afc,'extra':_0x4bd3ee});}});_0x3f281a['on']('error',function(_0x1d3924){_0x2b5e88[_0x099a('0x7')](_0x099a('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x1d3924[_0x099a('0x19')]));});_0x3f281a['on'](_0x099a('0x1a'),function(){_0x2b5e88[_0x099a('0x7')](_0x099a('0x1a'),new AGIError(_0x099a('0x1b')));});_0x3f281a['on']('timeout',function(){_0x2b5e88['emit'](_0x099a('0x1c'),new AGIError(_0x099a('0x1d')));_0x3f281a[_0x099a('0x1e')]();});_0x3f281a[_0x099a('0x1f')](_0x5d6b40);this[_0x099a('0x20')]=function(_0x3c64ce,_0x2b2b9b){var _0x3c64ce=_0x3c64ce||'',_0x2b2b9b=typeof _0x2b2b9b=='function'?_0x2b2b9b:new Function();_0x1d3f16={'tx':_0x3c64ce,'rx':'','cb':_0x2b2b9b};_0x3f281a[_0x099a('0x21')](_0x3c64ce+'\x0a');},this[_0x099a('0x1a')]=function(){_0x3f281a[_0x099a('0x1e')]();};}util[_0x099a('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x099a('0x23')][_0x099a('0x24')]=function(_0x126b05){return this[_0x099a('0x20')][_0x099a('0x25')](this,_0x126b05);};AGIChannel[_0x099a('0x23')][_0x099a('0x26')]=function(){return this['sendRequest'](_0x099a('0x27'));};AGIChannel['prototype'][_0x099a('0x28')]=function(_0x39f520,_0x159a26,_0x4cbc26){_0x39f520=_0x39f520===undefined?_0x099a('0x29'):_0x39f520;_0x159a26=_0x159a26===undefined?'5':_0x159a26;_0x4cbc26=_0x4cbc26===undefined?'1':_0x4cbc26;return this[_0x099a('0x24')](util[_0x099a('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x39f520,_0x159a26*0x3e8,_0x4cbc26));};AGIChannel['prototype']['noop']=function(_0x2b1597){_0x2b1597=_0x2b1597||_0x099a('0x2b');return this['sendRequest'](util[_0x099a('0x2a')](_0x099a('0x2c'),_0x2b1597));};AGIChannel[_0x099a('0x23')][_0x099a('0x2d')]=function(_0x462c0d,_0x36c1b4){if(_['isArray'](_0x36c1b4)){return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x2e'),_0x462c0d,_0x36c1b4[_0x099a('0x2f')](',')));}return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x2e'),_0x462c0d,_0x36c1b4));};AGIChannel[_0x099a('0x23')]['setContext']=function(_0x15ba05){return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x30'),_0x15ba05));};AGIChannel[_0x099a('0x23')][_0x099a('0x31')]=function(_0x4e71d2){return this[_0x099a('0x24')](util['format'](_0x099a('0x32'),_0x4e71d2));};AGIChannel[_0x099a('0x23')]['setPriority']=function(_0x7a5837){return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x33'),_0x7a5837));};AGIChannel[_0x099a('0x23')]['hangup']=function(){return this[_0x099a('0x24')](_0x099a('0x34'));};AGIChannel['prototype'][_0x099a('0x35')]=function(_0x405b07,_0xba763c){var _0x58cb69=_[_0x099a('0x36')](_0xba763c)||_[_0x099a('0x37')](_0xba763c)?_0xba763c[_0x099a('0x38')]():_0xba763c;return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x39'),_0x405b07,_0x58cb69?_0x58cb69['toString']()[_0x099a('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x099a('0x3b')]=function(_0x51931b,_0x541173){return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x3c'),_0x51931b,_0x541173));};AGIChannel[_0x099a('0x23')][_0x099a('0x3d')]=function(_0x2911cf,_0x1386cb){return this[_0x099a('0x24')](util[_0x099a('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x2911cf,_0x1386cb));};AGIChannel[_0x099a('0x23')][_0x099a('0x3e')]=function(_0x2efb31,_0x34a601){return this[_0x099a('0x24')](util[_0x099a('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2efb31,_0x34a601));};AGIChannel['prototype'][_0x099a('0x3f')]=function(_0x8e5dcc,_0x5dea70,_0x1439fa){_0x5dea70=_0x5dea70||this['extension'];_0x1439fa=_0x1439fa||0x1;this[_0x099a('0x40')](_0x8e5dcc);this[_0x099a('0x31')](_0x5dea70);this[_0x099a('0x41')](_0x1439fa);return this[_0x099a('0x42')](util[_0x099a('0x2a')](_0x099a('0x43'),_0x8e5dcc,_0x5dea70,_0x1439fa));};AGIChannel[_0x099a('0x23')][_0x099a('0x44')]=function(_0x49fc09){return this[_0x099a('0x24')](util['format'](_0x099a('0x45'),_0x49fc09));};AGIChannel['prototype'][_0x099a('0x46')]=function(_0x29dd56,_0xaf5b0c,_0x1f1002,_0x581c05,_0x20c0b6,_0x2ec162){_0xaf5b0c=_0xaf5b0c||'wav';_0x1f1002=_0x1f1002||'';_0x581c05=_0x581c05===undefined?-0x1:_0x581c05==='-1'?-0x1:_0x581c05*0x3e8;_0x20c0b6=_0x20c0b6===undefined?'':'s='+_0x20c0b6;_0x2ec162=_0x2ec162?_0x099a('0x47'):'';return this['sendRequest'](util[_0x099a('0x2a')](_0x099a('0x48'),_0x29dd56,_0xaf5b0c,_0x1f1002,_0x581c05,_0x2ec162,_0x20c0b6));};AGIChannel[_0x099a('0x23')][_0x099a('0x49')]=function(_0x407c0e,_0x3f9308){_0x3f9308=_0x3f9308||'';return this[_0x099a('0x24')](util[_0x099a('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x407c0e,_0x3f9308));};AGIChannel[_0x099a('0x23')]['agi']=function(_0x25a545){return this[_0x099a('0x2d')](_0x099a('0x4a'),_0x25a545);};AGIChannel[_0x099a('0x23')][_0x099a('0x4b')]=function(_0x473b56){return this[_0x099a('0x2d')]('WAIT',_0x473b56);};AGIChannel[_0x099a('0x23')][_0x099a('0x18')]=function(_0x5d6fd8,_0x1c31ff){this[_0x099a('0x42')](util[_0x099a('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5d6fd8['id'],_0x5d6fd8[_0x099a('0x4c')],_0x1c31ff));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x099a('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f0181c9..9bfcd03 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 _0x2bdc=['name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2bdc,0x9b));var _0xc2bd=function(_0x176883,_0x4d9888){_0x176883=_0x176883-0x0;var _0x27bc09=_0x2bdc[_0x176883];return _0x27bc09;};'use strict';var util=require(_0xc2bd('0x0'));var error={'E_AGI_UNDEFINED':_0xc2bd('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc2bd('0x2'),'E_AGI_SERVER_CLOSE':_0xc2bd('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xc2bd('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xc2bd('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xc2bd('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xc2bd('0x7'),'E_AGI_COMMAND_EMPTY':_0xc2bd('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc2bd('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3ac758){var _0x3ac758=_0x3ac758||null,_0x33e3a8=_0x33e3a8||[],_0x4f4698=0x1,_0x3f3fad='';if(!error[_0x3ac758]){_0x3ac758=_0xc2bd('0xa');}_0x33e3a8[_0xc2bd('0xb')](error[_0x3ac758]);while(arguments[_0x4f4698]){_0x33e3a8['push'](arguments[_0x4f4698]);_0x4f4698++;}_0x3f3fad=util[_0xc2bd('0xc')][_0xc2bd('0xd')](util,_0x33e3a8);this[_0xc2bd('0xe')]=_0x3f3fad;this[_0xc2bd('0xf')]=_0x3ac758;}module[_0xc2bd('0x10')]=AGIError; \ No newline at end of file +var _0xbfb7=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','format','apply','util','Undefined\x20error.'];(function(_0x226195,_0x253ae8){var _0x5424ad=function(_0x394081){while(--_0x394081){_0x226195['push'](_0x226195['shift']());}};_0x5424ad(++_0x253ae8);}(_0xbfb7,0x1d2));var _0x7bfb=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xbfb7[_0xf26c2e];return _0x46ecb4;};'use strict';var util=require(_0x7bfb('0x0'));var error={'E_AGI_UNDEFINED':_0x7bfb('0x1'),'E_AGI_ARGUMENT_PORT':_0x7bfb('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x7bfb('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x7bfb('0x4'),'E_AGI_SOCKET_ERROR':_0x7bfb('0x5'),'E_AGI_SOCKET_CLOSE':_0x7bfb('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x7bfb('0x7'),'E_AGI_COMMAND_EMPTY':_0x7bfb('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7bfb('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x14a82e){var _0x14a82e=_0x14a82e||null,_0x5d1e54=_0x5d1e54||[],_0x526e3e=0x1,_0x4f2152='';if(!error[_0x14a82e]){_0x14a82e=_0x7bfb('0xa');}_0x5d1e54['push'](error[_0x14a82e]);while(arguments[_0x526e3e]){_0x5d1e54['push'](arguments[_0x526e3e]);_0x526e3e++;}_0x4f2152=util[_0x7bfb('0xb')][_0x7bfb('0xc')](util,_0x5d1e54);this['message']=_0x4f2152;this['name']=_0x14a82e;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 5027f19..61ba675 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750a=['lodash','events','EventEmitter','ioredis','./error','redis','defaults','subscribe','agi','emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR'];(function(_0x527a23,_0x4d4154){var _0x3fd2c1=function(_0x16b2d1){while(--_0x16b2d1){_0x527a23['push'](_0x527a23['shift']());}};_0x3fd2c1(++_0x4d4154);}(_0x750a,0x186));var _0xa750=function(_0x5a7a32,_0x2497da){_0x5a7a32=_0x5a7a32-0x0;var _0x30ba14=_0x750a[_0x5a7a32];return _0x30ba14;};'use strict';var _=require(_0xa750('0x0'));var EventEmitter=require(_0xa750('0x1'))[_0xa750('0x2')];var Redis=require(_0xa750('0x3'));var AGIError=require(_0xa750('0x4'));var config=require('../../config/environment');config[_0xa750('0x5')]=_[_0xa750('0x6')](config[_0xa750('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa750('0x5')]);sub[_0xa750('0x7')](_0xa750('0x8'),function(_0x7de428){if(_0x7de428)return eventEmitter[_0xa750('0x9')](_0xa750('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x7de428));});sub['on'](_0xa750('0xb'),function(_0x297e14,_0x338d8e){if(_0x297e14!==_0xa750('0x8'))return;try{var _0x4f6e7e=JSON[_0xa750('0xc')](_0x338d8e);eventEmitter[_0xa750('0x9')](_0xa750('0xd'),_0x4f6e7e);}catch(_0x1c23cf){eventEmitter[_0xa750('0x9')](_0xa750('0xa'),new AGIError(_0xa750('0xe'),_0x1c23cf));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x29ab=['error','E_AGI_SERVER_ERROR','agi','parse','emit','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x29ab,0x123));var _0xb29a=function(_0x32b60e,_0x540349){_0x32b60e=_0x32b60e-0x0;var _0x474832=_0x29ab[_0x32b60e];return _0x474832;};'use strict';var _=require(_0xb29a('0x0'));var EventEmitter=require(_0xb29a('0x1'))[_0xb29a('0x2')];var Redis=require(_0xb29a('0x3'));var AGIError=require(_0xb29a('0x4'));var config=require(_0xb29a('0x5'));config[_0xb29a('0x6')]=_[_0xb29a('0x7')](config['redis'],{'host':_0xb29a('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0x3d664d){if(_0x3d664d)return eventEmitter['emit'](_0xb29a('0x9'),new AGIError(_0xb29a('0xa'),_0x3d664d));});sub['on']('message',function(_0x2e1790,_0x5373dd){if(_0x2e1790!==_0xb29a('0xb'))return;try{var _0x46b58c=JSON[_0xb29a('0xc')](_0x5373dd);eventEmitter[_0xb29a('0xd')]('projectUpdate',_0x46b58c);}catch(_0x4e871a){eventEmitter[_0xb29a('0xd')](_0xb29a('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x4e871a));}});module[_0xb29a('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a05ec40..ab4c148 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 _0x7dad=['edges','prototype','addVertex','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','target','default','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices'];(function(_0x40ce06,_0x2b829e){var _0x40491a=function(_0x3053f9){while(--_0x3053f9){_0x40ce06['push'](_0x40ce06['shift']());}};_0x40491a(++_0x2b829e);}(_0x7dad,0xba));var _0xd7da=function(_0x4723c1,_0xb589e8){_0x4723c1=_0x4723c1-0x0;var _0x350f50=_0x7dad[_0x4723c1];return _0x350f50;};'use strict';var _=require(_0xd7da('0x0'));var logger=require(_0xd7da('0x1'))('agi');var verticesWithRetry=[_0xd7da('0x2'),_0xd7da('0x3'),_0xd7da('0x4')];var Graph=function(){this[_0xd7da('0x5')]={};this[_0xd7da('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0xd7da('0x7')][_0xd7da('0x8')]=function(_0xc0570){this[_0xd7da('0x5')][_0xc0570['id']]=_0xc0570;this[_0xd7da('0x6')][_0xc0570['id']]=[];};Graph['prototype'][_0xd7da('0x9')]=function(_0x41b72c,_0x424c4a,_0x38548f){this[_0xd7da('0x6')][_0x41b72c][_0xd7da('0xa')]({'target':_0x424c4a,'condition':_0x38548f});this[_0xd7da('0xb')]+=0x1;};Graph[_0xd7da('0x7')][_0xd7da('0xc')]=function(){return _[_0xd7da('0xc')](this['vertices']);};Graph['prototype'][_0xd7da('0xd')]=function(){return this['numberOfEdges'];};Graph[_0xd7da('0x7')][_0xd7da('0xe')]=function(_0x57c46c){return this['vertices'][_0x57c46c];};Graph[_0xd7da('0x7')][_0xd7da('0xf')]=function(_0x2dddd3,_0x330e10){if(!this['vertices'][_0x2dddd3]){return logger[_0xd7da('0x10')](_0xd7da('0x11'));}var _0x1a43fa=_0x330e10(this['vertices'][_0x2dddd3]);if(!_0x1a43fa){return logger['info'](_0xd7da('0x12'));}if(this['edges'][_0x2dddd3][_0xd7da('0x13')]===0x0){return logger[_0xd7da('0x10')](_0xd7da('0x14'));}for(var _0x82f1cd=0x0,_0x3ebabd=[],_0x512a25=![];_0x82f1cd\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','projectUpdate','nextTick','error','findIndex','splice','push','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport'];(function(_0x4877e3,_0x3a2ba3){var _0x14e764=function(_0x5c3607){while(--_0x5c3607){_0x4877e3['push'](_0x4877e3['shift']());}};_0x14e764(++_0x3a2ba3);}(_0xe6b9,0x1cb));var _0x9e6b=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0xe6b9[_0x406115];return _0xbbabdb;};'use strict';var _=require(_0x9e6b('0x0'));var syncho=require(_0x9e6b('0x1'));var util=require(_0x9e6b('0x2'));var config=require(_0x9e6b('0x3'));var logger=require(_0x9e6b('0x4'))(_0x9e6b('0x5'));var utilLicense=require(_0x9e6b('0x6'));var rpc=require(_0x9e6b('0x7'));var Project=require(_0x9e6b('0x8'));var AGIEmitter=require(_0x9e6b('0x9'))[_0x9e6b('0xa')];var projects=[];config[_0x9e6b('0x5')]=_['defaults'](config[_0x9e6b('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x9e6b('0xb'),projectUpdateHandler);function connectionHandler(_0x42433e){process[_0x9e6b('0xc')](function(){syncho(function(){try{setChannelVariables(_0x42433e);agiHandler(_0x42433e);}catch(_0x45bae1){logger[_0x9e6b('0xd')](_0x45bae1['stack']);}});});}function projectUpdateHandler(_0x240e7e){try{var _0x26be7f=_[_0x9e6b('0xe')](projects,['id',_0x240e7e['id']]);if(_0x26be7f>-0x1){if(_0x240e7e['deleted']===!![]){projects[_0x9e6b('0xf')](_0x26be7f,0x1);}else{projects[_0x26be7f]=_0x240e7e;}}else{projects[_0x9e6b('0x10')](_0x240e7e);}}catch(_0x164021){logger['error'](_0x164021[_0x9e6b('0x11')]);}}function listeningHandler(){console['log'](_0x9e6b('0x12'),config[_0x9e6b('0x5')][_0x9e6b('0x13')]);logger[_0x9e6b('0x14')](util[_0x9e6b('0x15')](_0x9e6b('0x16'),config[_0x9e6b('0x5')]['ip'],config['agi']['port']));}function errorHandler(_0x1e6319){if(_0x1e6319&&_0x1e6319[_0x9e6b('0x17')]&&_0x1e6319[_0x9e6b('0x18')]){logger['error'](util[_0x9e6b('0x15')]('[%s]\x20%s',_0x1e6319[_0x9e6b('0x17')],_0x1e6319['message']));}else{logger[_0x9e6b('0xd')](util['format'](_0x9e6b('0x19'),_0x1e6319[_0x9e6b('0x11')]));}}function closeHandler(){logger['info'](util[_0x9e6b('0x15')](_0x9e6b('0x1a'),this[_0x9e6b('0x1b')],this[_0x9e6b('0x1c')],this[_0x9e6b('0x1d')],this[_0x9e6b('0x1e')],this[_0x9e6b('0x1f')]));try{createSquareReport(this);}catch(_0x214969){logger[_0x9e6b('0xd')](_0x214969['stack']);}}function timeoutHandler(){logger[_0x9e6b('0x14')](util[_0x9e6b('0x15')](_0x9e6b('0x20'),this[_0x9e6b('0x1b')],this[_0x9e6b('0x1c')],this[_0x9e6b('0x1d')],this[_0x9e6b('0x1e')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x9e6b('0x15')](_0x9e6b('0x21'),this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this[_0x9e6b('0x1f')]));this[_0x9e6b('0x22')]=!![];}function createSquareReport(_0x1fc26b,_0x52decf){rpc[_0x9e6b('0x23')](_0x1fc26b)[_0x9e6b('0x24')](function(_0x41113b){if(_0x52decf){_0x52decf(null,_0x41113b);}})['catch'](function(_0x5271a1){if(_0x52decf){_0x52decf(null,_0x5271a1);}});}function setChannelVariables(_0x26e41e){for(var _0x4aae23 in _0x26e41e){if(_0x26e41e[_0x9e6b('0x25')](_0x4aae23)){if(_0x4aae23[_0x9e6b('0x26')]('agi_')===0x0){_0x26e41e[_0x4aae23[_0x9e6b('0x27')](0x4)]=_0x26e41e[_0x4aae23];delete _0x26e41e[_0x4aae23];}}}}function agiHandler(_0x5ca85d){logger[_0x9e6b('0x28')](_0x9e6b('0x29'),JSON['stringify'](_0x5ca85d,null,0x2));logger[_0x9e6b('0x14')](util[_0x9e6b('0x15')](_0x9e6b('0x2a'),_0x5ca85d[_0x9e6b('0x1b')],_0x5ca85d[_0x9e6b('0x1c')],_0x5ca85d[_0x9e6b('0x1d')],_0x5ca85d[_0x9e6b('0x1e')],_0x5ca85d[_0x9e6b('0x1f')]));_0x5ca85d['on'](_0x9e6b('0xd'),errorHandler);_0x5ca85d['on'](_0x9e6b('0x2b'),closeHandler);_0x5ca85d['on'](_0x9e6b('0x2c'),timeoutHandler);_0x5ca85d[_0x9e6b('0x22')]=![];_0x5ca85d['on']('hangup',hangupHandler);var _0x223696=_['find'](projects,[_0x9e6b('0x17'),_0x5ca85d[_0x9e6b('0x1b')]]);if(!_0x223696)return Project[_0x9e6b('0x2d')](_0x5ca85d);if(!_0x223696['production'])return Project[_0x9e6b('0x2e')](_0x5ca85d);return Project[_0x9e6b('0x2f')](_0x223696,_0x5ca85d);}function main(){var _0x517d1d;return utilLicense[_0x9e6b('0x30')]()[_0x9e6b('0x24')](function(_0x4cf25e){if(!_0x4cf25e)return;if(_0x4cf25e['voice']){if(_0x4cf25e[_0x9e6b('0x31')]&&_0x4cf25e[_0x9e6b('0x31')]>0x0){logger[_0x9e6b('0x14')](util[_0x9e6b('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4cf25e['callysquare']));_0x517d1d=_0x4cf25e[_0x9e6b('0x31')];}else{logger[_0x9e6b('0x14')](_0x9e6b('0x32'));}}else{logger[_0x9e6b('0x14')](_0x9e6b('0x33'));_0x517d1d=-0x1;}})[_0x9e6b('0x24')](function(){return Project[_0x9e6b('0x34')]();})['then'](function(_0x1b9d3a){projects=_0x1b9d3a;return;})['catch'](function(_0x32226){logger[_0x9e6b('0xd')](_0x9e6b('0x35'),_0x32226[_0x9e6b('0x11')]);})['finally'](function(){var _0x3ef4be=require('./server')(config[_0x9e6b('0x5')][_0x9e6b('0x13')],config[_0x9e6b('0x5')]['ip'],_0x517d1d);_0x3ef4be['on'](_0x9e6b('0xd'),errorHandler);_0x3ef4be['on']('listening',listeningHandler);_0x3ef4be['on'](_0x9e6b('0x36'),connectionHandler);_0x3ef4be['on'](_0x9e6b('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0xae54=['info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','stack','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','production','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','findIndex','deleted','splice','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[ERROR]\x20%s'];(function(_0x665fe4,_0x11d4e3){var _0x111a32=function(_0x5d5336){while(--_0x5d5336){_0x665fe4['push'](_0x665fe4['shift']());}};_0x111a32(++_0x11d4e3);}(_0xae54,0x95));var _0x4ae5=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0xae54[_0x4cfa2e];return _0x279b50;};'use strict';var _=require(_0x4ae5('0x0'));var syncho=require(_0x4ae5('0x1'));var util=require(_0x4ae5('0x2'));var config=require(_0x4ae5('0x3'));var logger=require(_0x4ae5('0x4'))(_0x4ae5('0x5'));var utilLicense=require(_0x4ae5('0x6'));var rpc=require(_0x4ae5('0x7'));var Project=require(_0x4ae5('0x8'));var AGIEmitter=require(_0x4ae5('0x9'))[_0x4ae5('0xa')];var projects=[];config[_0x4ae5('0x5')]=_[_0x4ae5('0xb')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x4ae5('0xc'),projectUpdateHandler);function connectionHandler(_0x44dce8){process[_0x4ae5('0xd')](function(){syncho(function(){try{setChannelVariables(_0x44dce8);agiHandler(_0x44dce8);}catch(_0x2891c2){logger['error'](_0x2891c2['stack']);}});});}function projectUpdateHandler(_0x4ae4e6){try{var _0x494cf4=_[_0x4ae5('0xe')](projects,['id',_0x4ae4e6['id']]);if(_0x494cf4>-0x1){if(_0x4ae4e6[_0x4ae5('0xf')]===!![]){projects[_0x4ae5('0x10')](_0x494cf4,0x1);}else{projects[_0x494cf4]=_0x4ae4e6;}}else{projects['push'](_0x4ae4e6);}}catch(_0x164ab5){logger[_0x4ae5('0x11')](_0x164ab5['stack']);}}function listeningHandler(){console[_0x4ae5('0x12')](_0x4ae5('0x13'),config['agi'][_0x4ae5('0x14')]);logger['info'](util['format'](_0x4ae5('0x15'),config[_0x4ae5('0x5')]['ip'],config[_0x4ae5('0x5')][_0x4ae5('0x14')]));}function errorHandler(_0x31136c){if(_0x31136c&&_0x31136c[_0x4ae5('0x16')]&&_0x31136c['message']){logger[_0x4ae5('0x11')](util[_0x4ae5('0x17')]('[%s]\x20%s',_0x31136c[_0x4ae5('0x16')],_0x31136c['message']));}else{logger[_0x4ae5('0x11')](util[_0x4ae5('0x17')](_0x4ae5('0x18'),_0x31136c['stack']));}}function closeHandler(){logger[_0x4ae5('0x19')](util[_0x4ae5('0x17')](_0x4ae5('0x1a'),this[_0x4ae5('0x1b')],this['calleridname'],this['callerid'],this[_0x4ae5('0x1c')],this[_0x4ae5('0x1d')]));try{createSquareReport(this);}catch(_0x207289){logger['error'](_0x207289[_0x4ae5('0x1e')]);}}function timeoutHandler(){logger[_0x4ae5('0x19')](util[_0x4ae5('0x17')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4ae5('0x1b')],this[_0x4ae5('0x1f')],this['callerid'],this[_0x4ae5('0x1c')],this[_0x4ae5('0x1d')]));}function hangupHandler(){logger[_0x4ae5('0x19')](util[_0x4ae5('0x17')](_0x4ae5('0x20'),this[_0x4ae5('0x1b')],this[_0x4ae5('0x1f')],this[_0x4ae5('0x21')],this[_0x4ae5('0x1c')],this[_0x4ae5('0x1d')]));this[_0x4ae5('0x22')]=!![];}function createSquareReport(_0x397445,_0x13e4d7){rpc['createSquareReport'](_0x397445)['then'](function(_0xe925cb){if(_0x13e4d7){_0x13e4d7(null,_0xe925cb);}})['catch'](function(_0x12c168){if(_0x13e4d7){_0x13e4d7(null,_0x12c168);}});}function setChannelVariables(_0x1ad704){for(var _0x52b570 in _0x1ad704){if(_0x1ad704['hasOwnProperty'](_0x52b570)){if(_0x52b570['indexOf']('agi_')===0x0){_0x1ad704[_0x52b570[_0x4ae5('0x23')](0x4)]=_0x1ad704[_0x52b570];delete _0x1ad704[_0x52b570];}}}}function agiHandler(_0x3cdbe8){logger[_0x4ae5('0x24')]('variables',JSON[_0x4ae5('0x25')](_0x3cdbe8,null,0x2));logger[_0x4ae5('0x19')](util[_0x4ae5('0x17')](_0x4ae5('0x26'),_0x3cdbe8[_0x4ae5('0x1b')],_0x3cdbe8[_0x4ae5('0x1f')],_0x3cdbe8[_0x4ae5('0x21')],_0x3cdbe8[_0x4ae5('0x1c')],_0x3cdbe8['uniqueid']));_0x3cdbe8['on'](_0x4ae5('0x11'),errorHandler);_0x3cdbe8['on'](_0x4ae5('0x27'),closeHandler);_0x3cdbe8['on'](_0x4ae5('0x28'),timeoutHandler);_0x3cdbe8[_0x4ae5('0x22')]=![];_0x3cdbe8['on']('hangup',hangupHandler);var _0x29c790=_['find'](projects,[_0x4ae5('0x16'),_0x3cdbe8[_0x4ae5('0x1b')]]);if(!_0x29c790)return Project[_0x4ae5('0x29')](_0x3cdbe8);if(!_0x29c790[_0x4ae5('0x2a')])return Project[_0x4ae5('0x2b')](_0x3cdbe8);return Project[_0x4ae5('0x2c')](_0x29c790,_0x3cdbe8);}function main(){var _0x2db37b;return utilLicense[_0x4ae5('0x2d')]()[_0x4ae5('0x2e')](function(_0x8bfbaf){if(!_0x8bfbaf)return;if(_0x8bfbaf[_0x4ae5('0x2f')]){if(_0x8bfbaf[_0x4ae5('0x30')]&&_0x8bfbaf[_0x4ae5('0x30')]>0x0){logger[_0x4ae5('0x19')](util['format'](_0x4ae5('0x31'),_0x8bfbaf[_0x4ae5('0x30')]));_0x2db37b=_0x8bfbaf['callysquare'];}else{logger[_0x4ae5('0x19')](_0x4ae5('0x32'));}}else{logger[_0x4ae5('0x19')](_0x4ae5('0x33'));_0x2db37b=-0x1;}})[_0x4ae5('0x2e')](function(){return Project[_0x4ae5('0x34')]();})[_0x4ae5('0x2e')](function(_0x3fb2df){projects=_0x3fb2df;return;})[_0x4ae5('0x35')](function(_0xea7069){logger[_0x4ae5('0x11')](_0x4ae5('0x36'),_0xea7069['stack']);})[_0x4ae5('0x37')](function(){var _0x50f3bc=require(_0x4ae5('0x38'))(config[_0x4ae5('0x5')]['port'],config['agi']['ip'],_0x2db37b);_0x50f3bc['on'](_0x4ae5('0x11'),errorHandler);_0x50f3bc['on']('listening',listeningHandler);_0x50f3bc['on'](_0x4ae5('0x39'),connectionHandler);_0x50f3bc['on'](_0x4ae5('0x27'),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 06d01bb..84adb18 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 _0x3667=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x3667,0x145));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x7366('0x0'));var jayson=require(_0x7366('0x1'));var client=jayson[_0x7366('0x2')][_0x7366('0x3')]({'port':0x232b});function request(_0x477e2d,_0x620713){return new BPromise(function(_0x992e8c,_0x464df2){return client[_0x7366('0x4')](_0x477e2d,_0x620713)[_0x7366('0x5')](function(_0x5ccf2e){if(_0x5ccf2e['error']){return _0x464df2(_0x5ccf2e[_0x7366('0x6')][_0x7366('0x7')]);}else{return _0x992e8c(_0x5ccf2e[_0x7366('0x8')]);}})[_0x7366('0x9')](function(_0x2d994){return _0x464df2(_0x2d994);});});}exports[_0x7366('0xa')]=function(_0xdd57b4,_0x5465a4){return request(_0x7366('0xb'),{'account':_0xdd57b4,'message':_0x5465a4});}; \ No newline at end of file +var _0xb999=['http','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','client'];(function(_0x2f1a67,_0x544a01){var _0x35483b=function(_0x5df509){while(--_0x5df509){_0x2f1a67['push'](_0x2f1a67['shift']());}};_0x35483b(++_0x544a01);}(_0xb999,0x120));var _0x9b99=function(_0x28a98f,_0xa005e){_0x28a98f=_0x28a98f-0x0;var _0x4dd211=_0xb999[_0x28a98f];return _0x4dd211;};'use strict';var BPromise=require(_0x9b99('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x9b99('0x1')][_0x9b99('0x2')]({'port':0x232b});function request(_0x7da3d0,_0x509445){return new BPromise(function(_0x157249,_0x54f6cc){return client['request'](_0x7da3d0,_0x509445)[_0x9b99('0x3')](function(_0x15fbe1){if(_0x15fbe1['error']){return _0x54f6cc(_0x15fbe1[_0x9b99('0x4')][_0x9b99('0x5')]);}else{return _0x157249(_0x15fbe1[_0x9b99('0x6')]);}})[_0x9b99('0x7')](function(_0x201bb0){return _0x54f6cc(_0x201bb0);});});}exports[_0x9b99('0x8')]=function(_0x505ad5,_0x4b98ba){return request(_0x9b99('0x9'),{'account':_0x505ad5,'message':_0x4b98ba});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 900c28d..2168096 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1076=['mxCell','length','source','target','value','toJson','mxGraphModel','root','inspect','production','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','finally','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x1076,0xe6));var _0x6107=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x1076[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x6107('0x0'));var moment=require(_0x6107('0x1'));var parser=require(_0x6107('0x2'));var util=require(_0x6107('0x3'));var logger=require(_0x6107('0x4'))(_0x6107('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x6107('0x6'));var Graph=require('./graph');var Vertices=require(_0x6107('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x6107('0x8')](function(_0x2fe932){logger[_0x6107('0x9')](_0x6107('0xa'),_0x2fe932[_0x6107('0xb')]);return[];});}function addVertex(_0x59526d,_0x244e22,_0x364b35){_0x244e22[_0x6107('0xc')]=_0x364b35;if(_0x244e22[_0x6107('0xd')](_0x6107('0xe'))){_0x244e22[_0x6107('0xf')]=parseInt(_0x244e22['retry'],0xa);}_0x59526d[_0x6107('0x10')](_[_0x6107('0x11')](_0x244e22,_0x6107('0x12')));}function initGraph(_0x2a8c9c,_0x220288){var _0x40cd75=new Graph();for(var _0x5050ba in _0x2a8c9c){if(_0x2a8c9c[_0x6107('0xd')](_0x5050ba)){if(_['isArray'](_0x2a8c9c[_0x5050ba])){for(var _0x37d2cd=0x0;_0x37d2cd<_0x2a8c9c[_0x5050ba][_0x6107('0x13')];_0x37d2cd+=0x1){addVertex(_0x40cd75,_0x2a8c9c[_0x5050ba][_0x37d2cd],_0x5050ba);}}else{addVertex(_0x40cd75,_0x2a8c9c[_0x5050ba],_0x5050ba);}}}for(var _0x31c4f9=0x0;_0x31c4f9<_0x220288[_0x6107('0x13')];_0x31c4f9+=0x1){if(_0x220288[_0x31c4f9][_0x6107('0x14')]&&_0x220288[_0x31c4f9][_0x6107('0x15')]){_0x40cd75['addEdge'](_0x220288[_0x31c4f9][_0x6107('0x14')],_0x220288[_0x31c4f9]['target'],_0x220288[_0x31c4f9][_0x6107('0x16')]);}}return _0x40cd75;}function getRoot(_0x15f9eb){return parser[_0x6107('0x17')](_0x15f9eb,{'object':!![]})[_0x6107('0x18')][_0x6107('0x19')];}function inspect(_0x35459b){return util[_0x6107('0x1a')](_0x35459b,{'showHidden':![],'depth':null});}function initialize(_0x56c7fc,_0x5959c5){var _0x2fb6df=getRoot(_0x56c7fc[_0x6107('0x1b')]);if(!_0x2fb6df||!_0x2fb6df[_0x6107('0x1c')])return;var _0x5bfcce,_0x5202ac,_0x3b42b2;logger[_0x6107('0x1d')](_0x6107('0x19'),JSON['stringify'](_0x2fb6df,null,0x2));_0x5959c5[_0x6107('0x1e')]=moment()[_0x6107('0x1f')](_0x6107('0x20'));_0x5bfcce=initGraph(_[_0x6107('0x11')](_0x2fb6df,_0x6107('0x12')),_0x2fb6df[_0x6107('0x12')]);_0x5202ac=new Vertices(_0x5959c5,rpc,mailRpc);logger[_0x6107('0x21')](util['format'](_0x6107('0x22'),_0x5959c5[_0x6107('0x23')],_0x5959c5[_0x6107('0x24')],_0x5959c5[_0x6107('0x25')],_0x5959c5[_0x6107('0x26')],_0x5959c5[_0x6107('0x27')]));_0x5bfcce[_0x6107('0x28')](_0x2fb6df[_0x6107('0x1c')]['id'],function(_0x17c3bd){try{_0x17c3bd=_0x5202ac[_0x6107('0x29')](_0x17c3bd);logger[_0x6107('0x1d')]('vertex',JSON[_0x6107('0x2a')](_0x17c3bd,null,0x2));if(_0x17c3bd[_0x6107('0xc')]===_0x6107('0x2b')){logger['info'](_0x6107('0x2c'));_0x5959c5[_0x6107('0x2d')]=_0x17c3bd[_0x6107('0x2d')]||_0x5959c5[_0x6107('0x2d')];_0x5959c5['extension']=_0x17c3bd[_0x6107('0x2e')];_0x5959c5[_0x6107('0x2f')]=_0x17c3bd[_0x6107('0x2f')]?_0x17c3bd[_0x6107('0x2f')]-0x1:0x1;return null;}else if(_0x17c3bd&&_0x5202ac[_0x17c3bd[_0x6107('0xc')]]){_0x3b42b2=_0x5202ac[_0x17c3bd[_0x6107('0xc')]](_0x17c3bd);logger[_0x6107('0x21')]('response',JSON[_0x6107('0x2a')](_0x3b42b2,null,0x2));if(_0x3b42b2&&_0x3b42b2[_0x6107('0x30')]===AGI_CODE_SUCCESS&&_0x3b42b2[_0x6107('0x31')]!==AGI_RESULT_ERROR&&!_0x5959c5['evtHangup']){logger['debug'](_0x6107('0x32'),inspect(_0x3b42b2));return _[_0x6107('0x33')](_0x3b42b2['result'])?null:_0x3b42b2[_0x6107('0x31')][_0x6107('0x34')]();}else{logger[_0x6107('0x9')](_0x6107('0x32'),inspect(_0x3b42b2));return null;}}else{logger[_0x6107('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x16d1c9){logger[_0x6107('0x9')](_0x16d1c9['stack']);return null;}});if(_0x2fb6df[_0x6107('0x35')]){logger[_0x6107('0x21')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5959c5['arg_1'],_0x5959c5['calleridname'],_0x5959c5['callerid'],_0x5959c5['dnid'],_0x5959c5[_0x6107('0x27')]));_0x5bfcce[_0x6107('0x28')](_0x2fb6df['finally']['id'],function(_0x9c9304){try{_0x9c9304=_0x5202ac[_0x6107('0x29')](_0x9c9304);logger[_0x6107('0x1d')](_0x6107('0x36'),JSON[_0x6107('0x2a')](_0x9c9304,null,0x2));if(_0x9c9304&&_0x5202ac[_0x9c9304['agicommand']]){_0x3b42b2=_0x5202ac[_0x9c9304[_0x6107('0xc')]](_0x9c9304);if(_0x3b42b2){logger['debug'](_0x6107('0x32'),inspect(_0x3b42b2));return _['isUndefined'](_0x3b42b2[_0x6107('0x31')])?null:_0x3b42b2[_0x6107('0x31')][_0x6107('0x34')]();}else{logger[_0x6107('0x9')]('response',inspect(_0x3b42b2));return null;}}else{logger[_0x6107('0x9')](_0x6107('0x37'));return null;}}catch(_0x4e6217){logger[_0x6107('0x9')](_0x4e6217[_0x6107('0xb')]);return null;}});}logger[_0x6107('0x21')](util['format'](_0x6107('0x38'),_0x5959c5[_0x6107('0x23')],_0x5959c5[_0x6107('0x24')],_0x5959c5[_0x6107('0x25')],_0x5959c5[_0x6107('0x26')],_0x5959c5['uniqueid']));logger['info'](util[_0x6107('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5959c5['context'],_0x5959c5[_0x6107('0x2e')],parseInt(_0x5959c5[_0x6107('0x2f')],0xa)+0x1));_0x5959c5['continueAt'](_0x5959c5[_0x6107('0x2d')],_0x5959c5[_0x6107('0x2e')],parseInt(_0x5959c5[_0x6107('0x2f')],0xa)+0x1);_0x5959c5[_0x6107('0x39')]();}function handleNotFound(_0x13e3de){logger[_0x6107('0x9')](util[_0x6107('0x1f')](_0x6107('0x3a'),_0x13e3de['arg_1']));_0x13e3de[_0x6107('0x3b')](_0x13e3de[_0x6107('0x2d')],_0x13e3de[_0x6107('0x2e')],parseInt(_0x13e3de[_0x6107('0x2f')],0xa)+0x1);_0x13e3de['close']();}function handleUnpublished(_0x21b85c){logger[_0x6107('0x9')](util[_0x6107('0x1f')](_0x6107('0x3c'),_0x21b85c[_0x6107('0x23')]));_0x21b85c['continueAt'](_0x21b85c['context'],_0x21b85c[_0x6107('0x2e')],parseInt(_0x21b85c['priority'],0xa)+0x1);_0x21b85c[_0x6107('0x39')]();}module[_0x6107('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x03ee=['omit','isArray','length','target','addEdge','mxGraphModel','root','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','result','isUndefined','agicommand\x20not\x20found','finally','calleridname','dnid','traverseBFS','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./graph','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x03ee,0x1b2));var _0xe03e=function(_0x2041a4,_0x55946d){_0x2041a4=_0x2041a4-0x0;var _0x5464b8=_0x03ee[_0x2041a4];return _0x5464b8;};'use strict';var _=require(_0xe03e('0x0'));var moment=require(_0xe03e('0x1'));var parser=require(_0xe03e('0x2'));var util=require(_0xe03e('0x3'));var logger=require(_0xe03e('0x4'))(_0xe03e('0x5'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xe03e('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe03e('0x7')]()['catch'](function(_0x25017b){logger[_0xe03e('0x8')](_0xe03e('0x9'),_0x25017b[_0xe03e('0xa')]);return[];});}function addVertex(_0x5183e2,_0xb443e8,_0x13febf){_0xb443e8[_0xe03e('0xb')]=_0x13febf;if(_0xb443e8[_0xe03e('0xc')](_0xe03e('0xd'))){_0xb443e8['maxRetry']=parseInt(_0xb443e8[_0xe03e('0xd')],0xa);}_0x5183e2['addVertex'](_[_0xe03e('0xe')](_0xb443e8,'mxCell'));}function initGraph(_0x1d6287,_0x4fe4bb){var _0x1635de=new Graph();for(var _0x2d8ea4 in _0x1d6287){if(_0x1d6287[_0xe03e('0xc')](_0x2d8ea4)){if(_[_0xe03e('0xf')](_0x1d6287[_0x2d8ea4])){for(var _0x4bc5f7=0x0;_0x4bc5f7<_0x1d6287[_0x2d8ea4][_0xe03e('0x10')];_0x4bc5f7+=0x1){addVertex(_0x1635de,_0x1d6287[_0x2d8ea4][_0x4bc5f7],_0x2d8ea4);}}else{addVertex(_0x1635de,_0x1d6287[_0x2d8ea4],_0x2d8ea4);}}}for(var _0x3800ea=0x0;_0x3800ea<_0x4fe4bb['length'];_0x3800ea+=0x1){if(_0x4fe4bb[_0x3800ea]['source']&&_0x4fe4bb[_0x3800ea][_0xe03e('0x11')]){_0x1635de[_0xe03e('0x12')](_0x4fe4bb[_0x3800ea]['source'],_0x4fe4bb[_0x3800ea]['target'],_0x4fe4bb[_0x3800ea]['value']);}}return _0x1635de;}function getRoot(_0xfdcb2){return parser['toJson'](_0xfdcb2,{'object':!![]})[_0xe03e('0x13')][_0xe03e('0x14')];}function inspect(_0x1fbada){return util['inspect'](_0x1fbada,{'showHidden':![],'depth':null});}function initialize(_0x34d023,_0x20631a){var _0x30807b=getRoot(_0x34d023[_0xe03e('0x15')]);if(!_0x30807b||!_0x30807b[_0xe03e('0x16')])return;var _0x122bb2,_0x4195bb,_0x197c23;logger[_0xe03e('0x17')](_0xe03e('0x14'),JSON[_0xe03e('0x18')](_0x30807b,null,0x2));_0x20631a[_0xe03e('0x19')]=moment()[_0xe03e('0x1a')](_0xe03e('0x1b'));_0x122bb2=initGraph(_[_0xe03e('0xe')](_0x30807b,'mxCell'),_0x30807b[_0xe03e('0x1c')]);_0x4195bb=new Vertices(_0x20631a,rpc,mailRpc);logger[_0xe03e('0x1d')](util[_0xe03e('0x1a')](_0xe03e('0x1e'),_0x20631a[_0xe03e('0x1f')],_0x20631a['calleridname'],_0x20631a[_0xe03e('0x20')],_0x20631a['dnid'],_0x20631a[_0xe03e('0x21')]));_0x122bb2['traverseBFS'](_0x30807b['start']['id'],function(_0x7641cf){try{_0x7641cf=_0x4195bb['clear'](_0x7641cf);logger[_0xe03e('0x17')](_0xe03e('0x22'),JSON[_0xe03e('0x18')](_0x7641cf,null,0x2));if(_0x7641cf[_0xe03e('0xb')]===_0xe03e('0x23')){logger[_0xe03e('0x1d')](_0xe03e('0x24'));_0x20631a[_0xe03e('0x25')]=_0x7641cf[_0xe03e('0x25')]||_0x20631a[_0xe03e('0x25')];_0x20631a['extension']=_0x7641cf['extension'];_0x20631a[_0xe03e('0x26')]=_0x7641cf[_0xe03e('0x26')]?_0x7641cf['priority']-0x1:0x1;return null;}else if(_0x7641cf&&_0x4195bb[_0x7641cf[_0xe03e('0xb')]]){_0x197c23=_0x4195bb[_0x7641cf[_0xe03e('0xb')]](_0x7641cf);logger[_0xe03e('0x1d')](_0xe03e('0x27'),JSON[_0xe03e('0x18')](_0x197c23,null,0x2));if(_0x197c23&&_0x197c23[_0xe03e('0x28')]===AGI_CODE_SUCCESS&&_0x197c23[_0xe03e('0x29')]!==AGI_RESULT_ERROR&&!_0x20631a['evtHangup']){logger['debug'](_0xe03e('0x27'),inspect(_0x197c23));return _[_0xe03e('0x2a')](_0x197c23['result'])?null:_0x197c23['result']['toString']();}else{logger[_0xe03e('0x8')](_0xe03e('0x27'),inspect(_0x197c23));return null;}}else{logger[_0xe03e('0x8')](_0xe03e('0x2b'));return null;}}catch(_0x211a42){logger['error'](_0x211a42['stack']);return null;}});if(_0x30807b[_0xe03e('0x2c')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x20631a[_0xe03e('0x1f')],_0x20631a[_0xe03e('0x2d')],_0x20631a['callerid'],_0x20631a[_0xe03e('0x2e')],_0x20631a['uniqueid']));_0x122bb2[_0xe03e('0x2f')](_0x30807b[_0xe03e('0x2c')]['id'],function(_0x180808){try{_0x180808=_0x4195bb['clear'](_0x180808);logger[_0xe03e('0x17')](_0xe03e('0x22'),JSON[_0xe03e('0x18')](_0x180808,null,0x2));if(_0x180808&&_0x4195bb[_0x180808[_0xe03e('0xb')]]){_0x197c23=_0x4195bb[_0x180808[_0xe03e('0xb')]](_0x180808);if(_0x197c23){logger[_0xe03e('0x17')](_0xe03e('0x27'),inspect(_0x197c23));return _['isUndefined'](_0x197c23[_0xe03e('0x29')])?null:_0x197c23[_0xe03e('0x29')][_0xe03e('0x30')]();}else{logger[_0xe03e('0x8')](_0xe03e('0x27'),inspect(_0x197c23));return null;}}else{logger[_0xe03e('0x8')](_0xe03e('0x2b'));return null;}}catch(_0x4781b6){logger[_0xe03e('0x8')](_0x4781b6['stack']);return null;}});}logger['info'](util[_0xe03e('0x1a')](_0xe03e('0x31'),_0x20631a[_0xe03e('0x1f')],_0x20631a['calleridname'],_0x20631a[_0xe03e('0x20')],_0x20631a[_0xe03e('0x2e')],_0x20631a[_0xe03e('0x21')]));logger['info'](util['format'](_0xe03e('0x32'),_0x20631a['context'],_0x20631a[_0xe03e('0x33')],parseInt(_0x20631a[_0xe03e('0x26')],0xa)+0x1));_0x20631a[_0xe03e('0x34')](_0x20631a[_0xe03e('0x25')],_0x20631a['extension'],parseInt(_0x20631a[_0xe03e('0x26')],0xa)+0x1);_0x20631a[_0xe03e('0x35')]();}function handleNotFound(_0x3fb64a){logger[_0xe03e('0x8')](util[_0xe03e('0x1a')](_0xe03e('0x36'),_0x3fb64a['arg_1']));_0x3fb64a[_0xe03e('0x34')](_0x3fb64a['context'],_0x3fb64a[_0xe03e('0x33')],parseInt(_0x3fb64a[_0xe03e('0x26')],0xa)+0x1);_0x3fb64a[_0xe03e('0x35')]();}function handleUnpublished(_0x4c73e1){logger[_0xe03e('0x8')](util[_0xe03e('0x1a')](_0xe03e('0x37'),_0x4c73e1[_0xe03e('0x1f')]));_0x4c73e1[_0xe03e('0x34')](_0x4c73e1[_0xe03e('0x25')],_0x4c73e1['extension'],parseInt(_0x4c73e1[_0xe03e('0x26')],0xa)+0x1);_0x4c73e1[_0xe03e('0x35')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6081e83..4721db8 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 _0xded5=['Transform','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','exports','util'];(function(_0x5104b2,_0x153661){var _0x104012=function(_0x531dbb){while(--_0x531dbb){_0x5104b2['push'](_0x5104b2['shift']());}};_0x104012(++_0x153661);}(_0xded5,0xba));var _0x5ded=function(_0x13cb14,_0x555607){_0x13cb14=_0x13cb14-0x0;var _0x47e515=_0xded5[_0x13cb14];return _0x47e515;};'use strict';var util=require(_0x5ded('0x0'));var Transform=require('stream')[_0x5ded('0x1')];function AGIReply(_0x25f78a){Transform['call'](this,_0x25f78a);this[_0x5ded('0x2')]='';this[_0x5ded('0x3')]=![];}util[_0x5ded('0x4')](AGIReply,Transform);AGIReply['prototype'][_0x5ded('0x5')]=function(_0x1b2da5,_0x5cdc68,_0x1b935c){var _0x31d77c='\x0a',_0x26b217=['\x0a\x0a',_0x5ded('0x6')],_0x19e889=-0x1,_0x3ac88b=-0x1,_0x4c003f='',_0x1617d9=0x0,_0x4fea44='',_0x40b413='';this[_0x5ded('0x2')]+=_0x1b2da5[_0x5ded('0x7')]();_0x4fea44=this[_0x5ded('0x2')];if(!this[_0x5ded('0x3')]){_0x1617d9=0x0;while(_0x26b217[_0x1617d9]){while((_0x3ac88b=_0x4fea44[_0x5ded('0x8')](_0x26b217[_0x1617d9]))!=-0x1){_0x4c003f=_0x26b217[_0x1617d9];_0x40b413=_0x4fea44[_0x5ded('0x9')](0x0,_0x3ac88b);_0x4fea44=_0x4fea44[_0x5ded('0x9')](_0x3ac88b+_0x4c003f[_0x5ded('0xa')]);var _0x4b8d07=_0x40b413[_0x5ded('0xb')](_0x31d77c),_0x25c928=0x0,_0x34fa7d={},_0x2d5eb2='',_0x22e911='',_0x5b127c=-0x1;while(_0x4b8d07[_0x25c928]){_0x5b127c=_0x4b8d07[_0x25c928][_0x5ded('0x8')](':');if(_0x5b127c!=-0x1){_0x2d5eb2=_0x4b8d07[_0x25c928][_0x5ded('0xc')](0x0,_0x5b127c)[_0x5ded('0xd')]();_0x22e911=_0x4b8d07[_0x25c928]['slice'](_0x5b127c+0x1)[_0x5ded('0xd')]();if(_0x2d5eb2[_0x5ded('0xa')]>0x0){_0x34fa7d[_0x2d5eb2]=_0x22e911;}}else{}_0x25c928++;}this[_0x5ded('0xe')](_0x5ded('0xf'),_0x34fa7d);this[_0x5ded('0x3')]=!![];}_0x1617d9++;}this[_0x5ded('0x2')]=_0x4fea44;}else{while((_0x19e889=_0x4fea44[_0x5ded('0x8')](_0x31d77c))!=-0x1){_0x40b413=_0x4fea44[_0x5ded('0x9')](0x0,_0x19e889);this[_0x5ded('0xe')]('line',_0x40b413);_0x4fea44=_0x4fea44[_0x5ded('0x9')](_0x19e889+_0x31d77c['length']);}this[_0x5ded('0x2')]=_0x4fea44;}_0x1b935c();};module[_0x5ded('0x10')]=AGIReply; \ No newline at end of file +var _0x0901=['trim','length','emit','line','util','stream','Transform','call','_localBuffer','prototype','_transform','_inBody','indexOf','substring','split','slice'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0901,0x134));var _0x1090=function(_0x5122e2,_0x18df0a){_0x5122e2=_0x5122e2-0x0;var _0x48858e=_0x0901[_0x5122e2];return _0x48858e;};'use strict';var util=require(_0x1090('0x0'));var Transform=require(_0x1090('0x1'))[_0x1090('0x2')];function AGIReply(_0x39882a){Transform[_0x1090('0x3')](this,_0x39882a);this[_0x1090('0x4')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x1090('0x5')][_0x1090('0x6')]=function(_0x3ead6b,_0xf21ed0,_0x9a1121){var _0x395921='\x0a',_0x4c4e89=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3f569b=-0x1,_0x3c1afe=-0x1,_0x5cd3f0='',_0x3d2f8a=0x0,_0x160356='',_0x2c42b1='';this['_localBuffer']+=_0x3ead6b['toString']();_0x160356=this[_0x1090('0x4')];if(!this[_0x1090('0x7')]){_0x3d2f8a=0x0;while(_0x4c4e89[_0x3d2f8a]){while((_0x3c1afe=_0x160356[_0x1090('0x8')](_0x4c4e89[_0x3d2f8a]))!=-0x1){_0x5cd3f0=_0x4c4e89[_0x3d2f8a];_0x2c42b1=_0x160356['substring'](0x0,_0x3c1afe);_0x160356=_0x160356[_0x1090('0x9')](_0x3c1afe+_0x5cd3f0['length']);var _0x5b653b=_0x2c42b1[_0x1090('0xa')](_0x395921),_0x2c7130=0x0,_0x1693a1={},_0x43f1b6='',_0x2c0afa='',_0x4250c6=-0x1;while(_0x5b653b[_0x2c7130]){_0x4250c6=_0x5b653b[_0x2c7130][_0x1090('0x8')](':');if(_0x4250c6!=-0x1){_0x43f1b6=_0x5b653b[_0x2c7130][_0x1090('0xb')](0x0,_0x4250c6)[_0x1090('0xc')]();_0x2c0afa=_0x5b653b[_0x2c7130][_0x1090('0xb')](_0x4250c6+0x1)[_0x1090('0xc')]();if(_0x43f1b6[_0x1090('0xd')]>0x0){_0x1693a1[_0x43f1b6]=_0x2c0afa;}}else{}_0x2c7130++;}this[_0x1090('0xe')]('headers',_0x1693a1);this[_0x1090('0x7')]=!![];}_0x3d2f8a++;}this[_0x1090('0x4')]=_0x160356;}else{while((_0x3f569b=_0x160356[_0x1090('0x8')](_0x395921))!=-0x1){_0x2c42b1=_0x160356['substring'](0x0,_0x3f569b);this[_0x1090('0xe')](_0x1090('0xf'),_0x2c42b1);_0x160356=_0x160356[_0x1090('0x9')](_0x3f569b+_0x395921[_0x1090('0xd')]);}this[_0x1090('0x4')]=_0x160356;}_0x9a1121();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 2398fb1..69ecab4 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 _0x55d2=['ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','jayson/promise','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','ShowSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById'];(function(_0x3a97ac,_0x442d2a){var _0x2adc20=function(_0x3ffb22){while(--_0x3ffb22){_0x3a97ac['push'](_0x3a97ac['shift']());}};_0x2adc20(++_0x442d2a);}(_0x55d2,0x9f));var _0x255d=function(_0x4ac85a,_0x644ea){_0x4ac85a=_0x4ac85a-0x0;var _0x585481=_0x55d2[_0x4ac85a];return _0x585481;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x255d('0x0'));var client=jayson[_0x255d('0x1')][_0x255d('0x2')]({'port':0x2329});function request(_0x2bac55,_0x28c41e){return new Promise(function(_0x2c9d29,_0x57cbc1){return client[_0x255d('0x3')](_0x2bac55,_0x28c41e)[_0x255d('0x4')](function(_0xda2444){if(_0xda2444[_0x255d('0x5')]){return _0x57cbc1(_0xda2444['error']['message']);}else{return _0x2c9d29(_0xda2444[_0x255d('0x6')]);}})[_0x255d('0x7')](function(_0x253ac9){return _0x57cbc1(_0x253ac9);});});}exports[_0x255d('0x8')]=function(){return request(_0x255d('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x51c2dc){return request(_0x255d('0xa'),{'options':{'raw':![],'where':{'name':_0x51c2dc},'attributes':['production']}});};exports[_0x255d('0xb')]=function(_0x2c3754){return request(_0x255d('0xc'),{'options':{'raw':![],'where':{'id':_0x2c3754},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x255d('0xd'),'as':_0x255d('0xd')}]}],'attributes':['id',_0x255d('0xe'),_0x255d('0xf')],'smtp':!![]}});};exports[_0x255d('0x10')]=function(_0x30d8f0){return request(_0x255d('0xa'),{'options':{'where':{'id':_0x30d8f0},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x11')]=function(_0x2b21fd){return request(_0x255d('0x12'),{'options':{'where':{'id':_0x2b21fd},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x13')]=function(_0x500002){return request(_0x255d('0x14'),{'options':{'where':{'id':_0x500002},'attributes':[_0x255d('0xe')]}});};exports['getSquareOdbcById']=function(_0x477c48){return request(_0x255d('0x15'),{'options':{'where':{'id':_0x477c48},'attributes':[_0x255d('0x16')]}});};exports[_0x255d('0x17')]=function(_0x201313){return request(_0x255d('0x18'),{'options':{'where':{'id':_0x201313},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x19')]=function(_0x464f6a){return request(_0x255d('0x1a'),{'options':{'where':{'phone':_0x464f6a['phone']},'attributes':['id']}});};exports[_0x255d('0x1b')]=function(_0x46b939){return request(_0x255d('0x1c'),{'options':{'where':{'id':_0x46b939},'attributes':[_0x255d('0xe')]}});};exports[_0x255d('0x1d')]=function(_0x24f105){return request(_0x255d('0x1e'),{'options':{'where':{'id':_0x24f105},'attributes':[_0x255d('0x1f')]}});};exports[_0x255d('0x20')]=function(_0x48a380){return request(_0x255d('0x21'),{'options':{'raw':![],'where':{'id':_0x48a380},'include':[{'model':_0x255d('0x22'),'as':_0x255d('0x23')}]}});};exports[_0x255d('0x24')]=function(_0xb9d98e){return request(_0x255d('0x25'),{'options':{'where':{'id':_0xb9d98e},'attributes':['id',_0x255d('0xe')]}});};exports[_0x255d('0x26')]=function(_0xd69061){return request(_0x255d('0x27'),{'body':_0xd69061});};exports[_0x255d('0x28')]=function(_0x37e01e){return request(_0x255d('0x29'),{'body':_0x37e01e});};exports[_0x255d('0x2a')]=function(_0x3d7126){return request(_0x255d('0x2b'),{'body':_[_0x255d('0x2c')](_0x3d7126,{'project_name':_0x3d7126[_0x255d('0x2d')],'prev_project_name':_0x3d7126[_0x255d('0x2e')]||'','is_subproject':_0x3d7126['arg_2']?!![]:![],'leaveAt':moment()[_0x255d('0x2f')](_0x255d('0x30'))})});};exports[_0x255d('0x31')]=function(_0x22c91b){return request(_0x255d('0x32'),{'body':_0x22c91b});};exports[_0x255d('0x33')]=function(_0x56f124){return request(_0x255d('0x34'),{'body':_0x56f124});};exports['createCmContact']=function(_0x3ed01d){return request(_0x255d('0x35'),{'options':{'raw':![],'where':{'phone':_0x3ed01d[_0x255d('0x36')],'ListId':_0x3ed01d['ListId']}}})[_0x255d('0x4')](function(_0x3f8849){if(_0x3f8849){return _0x3f8849;}return request(_0x255d('0x37'),{'body':_0x3ed01d});});};exports[_0x255d('0x38')]=function(_0x25eb35){return request(_0x255d('0x39'),{'options':{'where':{'id':_0x25eb35},'attributes':['name']}});};exports[_0x255d('0x3a')]=function(_0x529680,_0x5e7231){return request(_0x255d('0x3b'),{'body':{'interface':_0x5e7231},'options':{'where':_0x529680}});};exports[_0x255d('0x3c')]=function(_0x2a9402,_0x3bc0a0,_0x5d28bd){return request(_0x255d('0x3d'),{'body':{'type':_0x3bc0a0,'uniqueid':_0x5d28bd},'options':{'where':_0x2a9402}});};exports[_0x255d('0x3e')]=function(_0x50983){return request('UnpauseUser',{'body':{},'options':{'where':_0x50983}});};exports[_0x255d('0x3f')]=function(_0x57acc7){return request('LogoutUser',{'body':{},'options':{'where':_0x57acc7}});}; \ No newline at end of file +var _0x383d=['save_name','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','http','request','then','error','message','result','catch','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById'];(function(_0x59ba05,_0x3248b0){var _0x413f12=function(_0x226f49){while(--_0x226f49){_0x59ba05['push'](_0x59ba05['shift']());}};_0x413f12(++_0x3248b0);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0xd383('0x0'));var client=jayson[_0xd383('0x1')][_0xd383('0x2')]({'port':0x2329});function request(_0x559dd3,_0x7554ef){return new Promise(function(_0x229076,_0x319f67){return client[_0xd383('0x3')](_0x559dd3,_0x7554ef)[_0xd383('0x4')](function(_0x43ab08){if(_0x43ab08['error']){return _0x319f67(_0x43ab08[_0xd383('0x5')][_0xd383('0x6')]);}else{return _0x229076(_0x43ab08[_0xd383('0x7')]);}})[_0xd383('0x8')](function(_0xffa778){return _0x319f67(_0xffa778);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xd383('0x9'),_0xd383('0xa')]}});};exports['getSquareProject']=function(_0x2abc3a){return request(_0xd383('0xb'),{'options':{'raw':![],'where':{'name':_0x2abc3a},'attributes':[_0xd383('0xa')]}});};exports[_0xd383('0xc')]=function(_0x3f6155){return request(_0xd383('0xd'),{'options':{'raw':![],'where':{'id':_0x3f6155},'include':[{'model':'MailServerOut','as':_0xd383('0xe'),'include':[{'model':_0xd383('0xf'),'as':_0xd383('0xf')}]}],'attributes':['id',_0xd383('0x9'),'email'],'smtp':!![]}});};exports[_0xd383('0x10')]=function(_0x23fecb){return request(_0xd383('0xb'),{'options':{'where':{'id':_0x23fecb},'attributes':[_0xd383('0x9')]}});};exports['getVoiceQueueById']=function(_0x39985a){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x39985a},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x11')]=function(_0xf2dcb6){return request(_0xd383('0x12'),{'options':{'where':{'id':_0xf2dcb6},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x13')]=function(_0x5359c6){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5359c6},'attributes':[_0xd383('0x14')]}});};exports[_0xd383('0x15')]=function(_0x8639e8){return request(_0xd383('0x16'),{'options':{'where':{'id':_0x8639e8},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x17')]=function(_0x21d2ed){return request(_0xd383('0x18'),{'options':{'where':{'phone':_0x21d2ed['phone']},'attributes':['id']}});};exports[_0xd383('0x19')]=function(_0x3714c8){return request(_0xd383('0x1a'),{'options':{'where':{'id':_0x3714c8},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x1b')]=function(_0x3618d9){return request('ShowSound',{'options':{'where':{'id':_0x3618d9},'attributes':[_0xd383('0x1c')]}});};exports['getIntervalById']=function(_0x1a8e78){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1a8e78},'include':[{'model':_0xd383('0x1d'),'as':_0xd383('0x1e')}]}});};exports['getSmsAccountById']=function(_0x10c054){return request(_0xd383('0x1f'),{'options':{'where':{'id':_0x10c054},'attributes':['id',_0xd383('0x9')]}});};exports['createSmsMessage']=function(_0x48d34b){return request(_0xd383('0x20'),{'body':_0x48d34b});};exports['createSquareDetailsReport']=function(_0x58bf08){return request(_0xd383('0x21'),{'body':_0x58bf08});};exports['createSquareReport']=function(_0xdc2c45){return request('CreateSquareReport',{'body':_['merge'](_0xdc2c45,{'project_name':_0xdc2c45['arg_1'],'prev_project_name':_0xdc2c45[_0xd383('0x22')]||'','is_subproject':_0xdc2c45[_0xd383('0x22')]?!![]:![],'leaveAt':moment()[_0xd383('0x23')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xd383('0x24')]=function(_0x2b3ab6){return request(_0xd383('0x25'),{'body':_0x2b3ab6});};exports[_0xd383('0x26')]=function(_0x27750a){return request(_0xd383('0x27'),{'body':_0x27750a});};exports[_0xd383('0x28')]=function(_0x208247){return request(_0xd383('0x29'),{'options':{'raw':![],'where':{'phone':_0x208247['phone'],'ListId':_0x208247[_0xd383('0x2a')]}}})[_0xd383('0x4')](function(_0x13924e){if(_0x13924e){return _0x13924e;}return request(_0xd383('0x2b'),{'body':_0x208247});});};exports[_0xd383('0x2c')]=function(_0x16be76){return request(_0xd383('0x2d'),{'options':{'where':{'id':_0x16be76},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x2e')]=function(_0xcea4cf,_0x1f87da){return request(_0xd383('0x2f'),{'body':{'interface':_0x1f87da},'options':{'where':_0xcea4cf}});};exports[_0xd383('0x30')]=function(_0x4284dd,_0x15b20b,_0x5a2cc5){return request(_0xd383('0x31'),{'body':{'type':_0x15b20b,'uniqueid':_0x5a2cc5},'options':{'where':_0x4284dd}});};exports[_0xd383('0x32')]=function(_0x12f159){return request(_0xd383('0x33'),{'body':{},'options':{'where':_0x12f159}});};exports[_0xd383('0x34')]=function(_0x18f305){return request(_0xd383('0x35'),{'body':{},'options':{'where':_0x18f305}});}; \ 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 de3f277..28cfe96 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 _0x282a=['./lex','exports'];(function(_0x441eab,_0x583ba5){var _0xe6ff41=function(_0x98c274){while(--_0x98c274){_0x441eab['push'](_0x441eab['shift']());}};_0xe6ff41(++_0x583ba5);}(_0x282a,0xa2));var _0xa282=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x282a[_0x411017];return _0x2adeea;};var polly=require('./polly');var lex=require(_0xa282('0x0'));module[_0xa282('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var polly=require('./polly');var lex=require('./lex');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 b4e9e13..c77162a 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 _0x70e0=['exports','./lib/api'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x70e0,0x17b));var _0x070e=function(_0x27ab96,_0x4a366a){_0x27ab96=_0x27ab96-0x0;var _0x49883e=_0x70e0[_0x27ab96];return _0x49883e;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +var _0x2750=['./lib/api'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x2750,0x13b));var _0x0275=function(_0x21ab61,_0x1c9cb8){_0x21ab61=_0x21ab61-0x0;var _0xb5735b=_0x2750[_0x21ab61];return _0xb5735b;};'use strict';var lex=require(_0x0275('0x0'));module['exports']=function(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06){return lex(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06);}; \ 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 0404c9a..64568f5 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(_0x548f1d,_0x3295d8){var _0x42f347=function(_0x2ff768){while(--_0x2ff768){_0x548f1d['push'](_0x548f1d['shift']());}};_0x42f347(++_0x3295d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x3e0b82,_0x3a8dfd){var _0xe76d75=function(_0x22cb1c){while(--_0x22cb1c){_0x3e0b82['push'](_0x3e0b82['shift']());}};_0xe76d75(++_0x3a8dfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 d9ae3f3..32a96b7 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 _0xcb86=['exports'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0xcb86,0x18e));var _0x6cb8=function(_0x5a7977,_0x1cdcd3){_0x5a7977=_0x5a7977-0x0;var _0x22f392=_0xcb86[_0x5a7977];return _0x22f392;};'use strict';var polly=require('./lib/api');module[_0x6cb8('0x0')]=function(_0x3105e4,_0x4a61cb,_0x566c3a,_0x3d1d6c,_0x5d17e4,_0x206e11,_0x1ffd9a){return polly(_0x3105e4,_0x4a61cb,_0x566c3a,_0x3d1d6c,_0x5d17e4,_0x206e11,_0x1ffd9a);}; \ No newline at end of file +var _0x9b9f=['exports'];(function(_0x1cdf9e,_0x26dda3){var _0x1d8128=function(_0x4ac4d9){while(--_0x4ac4d9){_0x1cdf9e['push'](_0x1cdf9e['shift']());}};_0x1d8128(++_0x26dda3);}(_0x9b9f,0x113));var _0xf9b9=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x9b9f[_0x2cef86];return _0x46dfd6;};'use strict';var polly=require('./lib/api');module[_0xf9b9('0x0')]=function(_0x401add,_0x568ed8,_0x24eafb,_0x1a0d32,_0xfb402f,_0x3e92e9,_0x4f66ab){return polly(_0x401add,_0x568ed8,_0x24eafb,_0x1a0d32,_0xfb402f,_0x3e92e9,_0x4f66ab);}; \ 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 d609670..25c5bcf 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 _0x2010=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x1e5088,_0xae6ec3){var _0x54341d=function(_0x18f68b){while(--_0x18f68b){_0x1e5088['push'](_0x1e5088['shift']());}};_0x54341d(++_0xae6ec3);}(_0x2010,0x8b));var _0x0201=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2010[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require(_0x0201('0x0'));var BPromise=require('bluebird');var rs=require(_0x0201('0x1'));var AWS=require(_0x0201('0x2'));function pollyResult(_0x202731,_0x331b19,_0x1e3d2f){return new BPromise(function(_0x12d066,_0x50d455){_0x202731[_0x0201('0x3')](_0x331b19,function(_0xfc6e45,_0x166b69){if(_0xfc6e45){_0x50d455(_0xfc6e45);}else if(_0x166b69){if(_0x166b69[_0x0201('0x4')]instanceof Buffer){fs[_0x0201('0x5')](_0x1e3d2f,_0x166b69['AudioStream'],function(_0x221421){if(_0x221421){_0x50d455(_0x221421);}else{_0x12d066();}});}else{_0x50d455(new Error(_0x0201('0x6')));}}else{_0x50d455(new Error(_0x0201('0x7')));}});});}module[_0x0201('0x8')]=function(_0xc157fa,_0xe2f5ac,_0x1533c3,_0x376f84,_0x1ea2ca,_0x13fb3e,_0x4f11d4){var _0xaede9c=new AWS[(_0x0201('0x9'))]({'accessKeyId':_0xc157fa,'secretAccessKey':_0xe2f5ac,'region':_0x1533c3});var _0x483516={'Text':_0x1ea2ca,'TextType':_0x13fb3e||_0x0201('0xa'),'OutputFormat':_0x0201('0xb'),'VoiceId':_0x376f84};return pollyResult(_0xaede9c,_0x483516,_0x4f11d4);}; \ No newline at end of file +var _0x286c=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x10bf7b,_0x513c95){var _0x38be31=function(_0x10cfbe){while(--_0x10cfbe){_0x10bf7b['push'](_0x10bf7b['shift']());}};_0x38be31(++_0x513c95);}(_0x286c,0xd2));var _0xc286=function(_0x49e310,_0x2f59c2){_0x49e310=_0x49e310-0x0;var _0x334ccf=_0x286c[_0x49e310];return _0x334ccf;};'use strict';var fs=require('fs');var path=require(_0xc286('0x0'));var BPromise=require(_0xc286('0x1'));var rs=require(_0xc286('0x2'));var AWS=require(_0xc286('0x3'));function pollyResult(_0x5701db,_0x3a243b,_0x410c42){return new BPromise(function(_0x471d1b,_0xa7f262){_0x5701db[_0xc286('0x4')](_0x3a243b,function(_0x473872,_0x5e09c1){if(_0x473872){_0xa7f262(_0x473872);}else if(_0x5e09c1){if(_0x5e09c1[_0xc286('0x5')]instanceof Buffer){fs['writeFile'](_0x410c42,_0x5e09c1[_0xc286('0x5')],function(_0xf162a5){if(_0xf162a5){_0xa7f262(_0xf162a5);}else{_0x471d1b();}});}else{_0xa7f262(new Error(_0xc286('0x6')));}}else{_0xa7f262(new Error(_0xc286('0x7')));}});});}module[_0xc286('0x8')]=function(_0x38f86c,_0x3be20b,_0x41c250,_0x3cf68,_0x512e6b,_0x10a740,_0x2255eb){var _0x5703bf=new AWS[(_0xc286('0x9'))]({'accessKeyId':_0x38f86c,'secretAccessKey':_0x3be20b,'region':_0x41c250});var _0x200059={'Text':_0x512e6b,'TextType':_0x10a740||'text','OutputFormat':_0xc286('0xa'),'VoiceId':_0x3cf68};return pollyResult(_0x5703bf,_0x200059,_0x2255eb);}; \ 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 b42efc4..ee71e49 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 _0x703a=['./lib/api','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x703a,0xee));var _0xa703=function(_0x399b41,_0x1319eb){_0x399b41=_0x399b41-0x0;var _0x2afeeb=_0x703a[_0x399b41];return _0x2afeeb;};'use strict';var asr=require(_0xa703('0x0'));module[_0xa703('0x1')]=function(_0x115ada,_0xd143ea,_0x593eae,_0x3ac64f){return asr(_0x115ada,_0xd143ea,_0x593eae);}; \ No newline at end of file +var _0xcf88=['./lib/api','exports'];(function(_0x145eff,_0x269003){var _0x1a7a9e=function(_0x55345f){while(--_0x55345f){_0x145eff['push'](_0x145eff['shift']());}};_0x1a7a9e(++_0x269003);}(_0xcf88,0xb4));var _0x8cf8=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xcf88[_0x55f8b4];return _0x2475f9;};'use strict';var asr=require(_0x8cf8('0x0'));module[_0x8cf8('0x1')]=function(_0x250a6d,_0x277261,_0x76cc38,_0x198f9c){return asr(_0x250a6d,_0x277261,_0x76cc38);}; \ 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 45fe80c..a30527d 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 _0x3ee5=['POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64'];(function(_0x31738c,_0x548d87){var _0x113a11=function(_0x3cffe1){while(--_0x3cffe1){_0x31738c['push'](_0x31738c['shift']());}};_0x113a11(++_0x548d87);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x681d00,_0x43adf6){_0x681d00=_0x681d00-0x0;var _0x26e6a6=_0x3ee5[_0x681d00];return _0x26e6a6;};'use strict';var url=require('url');var BPromise=require(_0x53ee('0x0'));var fs=require('fs');var host=_0x53ee('0x1');module['exports']=function(_0x116163,_0x14adf3,_0x2de317){return new BPromise(function(_0x24e272,_0x25e597){var _0x119975;if(typeof _0x116163!==_0x53ee('0x2')||_0x116163[_0x53ee('0x3')]===0x0){return _0x25e597(_0x53ee('0x4'));}if(typeof _0x14adf3!==_0x53ee('0x2')||_0x14adf3[_0x53ee('0x3')]===0x0){return _0x25e597('key\x20should\x20be\x20a\x20string');}if(typeof _0x2de317!==_0x53ee('0x5')&&(typeof _0x2de317!==_0x53ee('0x2')||_0x2de317[_0x53ee('0x3')]===0x0)){return _0x25e597(_0x53ee('0x6'));}try{_0x119975=fs[_0x53ee('0x7')](_0x116163)[_0x53ee('0x8')](_0x53ee('0x9'));}catch(_0x17dace){return _0x25e597(_0x17dace);}return _0x24e272({'method':_0x53ee('0xa'),'uri':host+_0x53ee('0xb')+_0x14adf3,'body':{'config':{'encoding':_0x53ee('0xc'),'sampleRateHertz':_0x53ee('0xd'),'languageCode':_0x2de317},'audio':{'content':_0x119975}},'json':!![]});});}; \ No newline at end of file +var _0x1b73=['POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x1b73,0x1d5));var _0x31b7=function(_0x4c7d5d,_0x35d7ba){_0x4c7d5d=_0x4c7d5d-0x0;var _0x54e93b=_0x1b73[_0x4c7d5d];return _0x54e93b;};'use strict';var url=require('url');var BPromise=require(_0x31b7('0x0'));var fs=require('fs');var host=_0x31b7('0x1');module[_0x31b7('0x2')]=function(_0x5c767e,_0x4bf5ae,_0x17c0ef){return new BPromise(function(_0x59e606,_0x40fef2){var _0x3682cc;if(typeof _0x5c767e!=='string'||_0x5c767e[_0x31b7('0x3')]===0x0){return _0x40fef2(_0x31b7('0x4'));}if(typeof _0x4bf5ae!==_0x31b7('0x5')||_0x4bf5ae['length']===0x0){return _0x40fef2(_0x31b7('0x6'));}if(typeof _0x17c0ef!==_0x31b7('0x7')&&(typeof _0x17c0ef!==_0x31b7('0x5')||_0x17c0ef[_0x31b7('0x3')]===0x0)){return _0x40fef2(_0x31b7('0x8'));}try{_0x3682cc=fs[_0x31b7('0x9')](_0x5c767e)[_0x31b7('0xa')]('base64');}catch(_0x268428){return _0x40fef2(_0x268428);}return _0x59e606({'method':_0x31b7('0xb'),'uri':host+_0x31b7('0xc')+_0x4bf5ae,'body':{'config':{'encoding':_0x31b7('0xd'),'sampleRateHertz':_0x31b7('0xe'),'languageCode':_0x17c0ef},'audio':{'content':_0x3682cc}},'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 0f1f7a1..10cb4be 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 _0x2b55=['exports','./asr'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2b55,0x153));var _0x52b5=function(_0x57503d,_0x3485cd){_0x57503d=_0x57503d-0x0;var _0x300444=_0x2b55[_0x57503d];return _0x300444;};var asr=require(_0x52b5('0x0'));module[_0x52b5('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 7749a15..c9bce7b 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 _0x4de7=['protocol','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','close','unlink','download\x20error','pipe','error','end','https:','wav','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','then','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','.mp3','from','writeFile','chmodSync','777','.wav','googleCloudTTS\x20path','utf8','POST','application/x-www-form-urlencoded','stringify','jQ1olc','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','catch','message','googleDialogflow','textRequest','result','action','actionIncomplete','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','languageCode','queryText','responseId','intentDetectionConfidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest'];(function(_0x37b155,_0x6441ce){var _0x462830=function(_0x3d902b){while(--_0x3d902b){_0x37b155['push'](_0x37b155['shift']());}};_0x462830(++_0x6441ce);}(_0x4de7,0x72));var _0x74de=function(_0x2da9c6,_0x140700){_0x2da9c6=_0x2da9c6-0x0;var _0xc05f88=_0x4de7[_0x2da9c6];return _0xc05f88;};'use strict';var apiai=require(_0x74de('0x0'));var BPromise=require(_0x74de('0x1'));var dialogflow=require(_0x74de('0x2'));var fs=require('fs');var http=require(_0x74de('0x3'));var https=require(_0x74de('0x4'));var md5=require(_0x74de('0x5'));var path=require('path');var querystring=require(_0x74de('0x6'));var rp=require(_0x74de('0x7'));var rs=require(_0x74de('0x8'));var sox=require(_0x74de('0x9'));var tts=require(_0x74de('0xa'));var urlParse=require(_0x74de('0xb'))[_0x74de('0xc')];var util=require(_0x74de('0xd'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x74de('0xe'));var tilde=require(_0x74de('0xf'));var logger=require(_0x74de('0x10'))(_0x74de('0x11'));var ISPEECH_API=_0x74de('0x12');function downloadFile(_0x460dcb,_0xbeb438){return new BPromise(function(_0x358a39,_0x22457d){var _0x3d567e=urlParse(_0x460dcb);var _0x5150db=_0x3d567e[_0x74de('0x13')]==='https:'?https:http;var _0x1520e4={'host':_0x3d567e[_0x74de('0x14')],'path':_0x3d567e[_0x74de('0x15')],'headers':{'user-agent':_0x74de('0x16')}};_0x5150db[_0x74de('0x17')](_0x1520e4,function(_0x55ced2){if(_0x55ced2[_0x74de('0x18')]!==0xc8){logger['error'](_0x74de('0x19')+_0x460dcb+_0x74de('0x1a')+_0x55ced2['statusCode']+'\x20('+_0x55ced2[_0x74de('0x1b')]+')');_0x22457d(new Error('request\x20to\x20'+_0x460dcb+_0x74de('0x1a')+_0x55ced2[_0x74de('0x18')]+'\x20('+_0x55ced2[_0x74de('0x1b')]+')'));return;}var _0xb5b773=fs[_0x74de('0x1c')](_0xbeb438);_0xb5b773['on']('finish',function(){logger[_0x74de('0x1d')]('finish\x20download\x20file');_0xb5b773[_0x74de('0x1e')](_0x358a39);});_0xb5b773['on']('error',function(_0x8eeb71){fs[_0x74de('0x1f')](_0xbeb438);logger['error'](_0x74de('0x20'),_0x8eeb71);_0x22457d(_0x8eeb71);});_0x55ced2[_0x74de('0x21')](_0xb5b773);})['on'](_0x74de('0x22'),function(_0x5bd8ce){logger['error'](_0x5bd8ce);_0x22457d(_0x5bd8ce);})[_0x74de('0x23')]();});}function uploadFile(_0x33d579){return new BPromise(function(_0x2286df,_0x522609){var _0x3dc89a=urlParse(_0x33d579);var _0x2bd0ff=_0x3dc89a[_0x74de('0x13')]===_0x74de('0x24')?https:http;var _0x284b81={'host':_0x3dc89a[_0x74de('0x14')],'path':_0x3dc89a['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x2bd0ff[_0x74de('0x17')](_0x284b81,function(_0x51b379){if(_0x51b379[_0x74de('0x18')]!==0xc8){_0x522609(new Error(_0x74de('0x19')+_0x33d579+_0x74de('0x1a')+_0x51b379[_0x74de('0x18')]+'\x20('+_0x51b379['statusMessage']+')'));return;}var _0x1c74c9='';_0x51b379['on']('data',function(_0x1266df){_0x1c74c9+=_0x1266df;});_0x51b379['on'](_0x74de('0x23'),function(){_0x2286df(_0x1c74c9);});})['on'](_0x74de('0x22'),function(_0x2b56d5){_0x522609(_0x2b56d5);})[_0x74de('0x23')]();});}function convertFile(_0x1bf8a0,_0x49a602){return new BPromise(function(_0x42ad8a,_0x90ab95){var _0x119c74=sox['transcode'](_0x1bf8a0,_0x49a602,{'sampleRate':0x1f40,'format':_0x74de('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x119c74['on'](_0x74de('0x22'),function(_0x511384){logger[_0x74de('0x22')]('error\x20convert',_0x511384);_0x90ab95(_0x511384);});_0x119c74['on'](_0x74de('0x23'),function(){logger[_0x74de('0x1d')](_0x74de('0x26'));_0x42ad8a();});_0x119c74[_0x74de('0x27')]();});}function base64Decode(_0x4611a3,_0x3595d5){var _0x52eb58=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+'.wav');fs[_0x74de('0x2b')](_0x52eb58,_0x4611a3,'base64');return convertFile(_0x52eb58,_0x3595d5)[_0x74de('0x2c')](function(){try{fs[_0x74de('0x1f')](_0x52eb58);fs['chmodSync'](_0x3595d5,'777');}catch(_0x4cd823){logger[_0x74de('0x22')](_0x4cd823);}return _0x3595d5[_0x74de('0x2d')]('.')[0x0];});}function base64Encode(_0x5100c6){var _0x525c93=fs[_0x74de('0x2e')](_0x5100c6);return new Buffer(_0x525c93)[_0x74de('0x2f')](_0x74de('0x30'));}exports[_0x74de('0x31')]=function(_0x27c581,_0x144e1d,_0x2cc949,_0x5eb47f,_0x592e2c,_0x557fd0){var _0x2431aa,_0x1774b3;var _0x693f79=_0x74de('0x32');var _0x14032f=_0x74de('0x33')+_0x27c581;var _0x54df1e={};if(_0x144e1d===_0x74de('0x34')){_0x54df1e[_0x74de('0x35')]={'ssml':_0x2cc949};}else{_0x54df1e['input']={'text':_0x2cc949};};_0x54df1e[_0x74de('0x36')]={'languageCode':_0x5eb47f,'ssmlGender':_0x592e2c};_0x54df1e[_0x74de('0x37')]={'audioEncoding':_0x74de('0x38'),'sampleRateHertz':0x1f40};var _0x2f642b={'url':_0x693f79+'text:synthesize'+_0x14032f,'method':'POST','json':!![],'body':_0x54df1e};return rp(_0x2f642b)[_0x74de('0x2c')](function(_0x35f8ab){return new BPromise(function(_0x527f1a,_0x25014c){_0x2431aa=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs['generate'](0x4)+_0x74de('0x39'));var _0x5e3a7c=Buffer[_0x74de('0x3a')](_0x35f8ab['audioContent'],_0x74de('0x30'));return fs[_0x74de('0x3b')](_0x2431aa,_0x5e3a7c,function(_0x511596){_0x25014c(_0x511596);},function(_0x3d9f43){fs[_0x74de('0x3c')](_0x2431aa,_0x74de('0x3d'));_0x527f1a(_0x3d9f43);});});})[_0x74de('0x2c')](function(_0x2688b2){_0x1774b3=path[_0x74de('0x28')](__dirname,'tmp',rs[_0x74de('0x2a')](0x4)+_0x74de('0x3e'));return convertFile(_0x2431aa,_0x1774b3);})['then'](function(){try{fs[_0x74de('0x1f')](_0x2431aa);fs['chmodSync'](_0x1774b3,_0x74de('0x3d'));}catch(_0x5621a5){logger['error'](_0x5621a5);}logger[_0x74de('0x1d')](_0x74de('0x3f'),_0x1774b3[_0x74de('0x2d')]('.')[0x0]);return _0x1774b3['split']('.')[0x0];});};exports['googleTTS']=function(_0x3b2f67,_0x1e0a1a){var _0xfd1fe2='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4353c7,_0x143b2a;var _0x26e52b;var _0x2a1582={'encoding':_0x74de('0x40'),'method':_0x74de('0x41'),'timeout':0x2710,'url':_0xfd1fe2,'headers':{'Content-Type':_0x74de('0x42')},'body':'f.req='+encodeURIComponent(JSON[_0x74de('0x43')]([[[_0x74de('0x44'),JSON[_0x74de('0x43')]([_0x3b2f67,_0x1e0a1a||'en',![],'null']),null,'generic']]]))};return rp(_0x2a1582)[_0x74de('0x2c')](function(_0x20d7b5){try{_0x26e52b=eval(_0x20d7b5['slice'](0x5))[0x0][0x2];}catch(_0x145127){throw new Error(_0x74de('0x45')+_0x20d7b5['data']);}if(!_0x26e52b){if(_0x3b2f67['length']>0xc8){throw new Error(_0x74de('0x46'));}else{throw new Error('lang\x20\x22'+_0x1e0a1a+_0x74de('0x47'));}}try{_0x26e52b=eval(_0x26e52b)[0x0];}catch(_0x8ce6b5){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x22c13b=_0x26e52b;_0x4353c7=path['resolve'](__dirname,'tmp',rs[_0x74de('0x2a')](0x4)+_0x74de('0x39'));fs['writeFileSync'](_0x4353c7,_0x26e52b,{'encoding':_0x74de('0x30')});_0x143b2a=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+_0x74de('0x3e'));return convertFile(_0x4353c7,_0x143b2a);})[_0x74de('0x2c')](function(){try{fs[_0x74de('0x1f')](_0x4353c7);fs[_0x74de('0x3c')](_0x143b2a,_0x74de('0x3d'));}catch(_0x42facb){logger[_0x74de('0x22')](_0x42facb);}logger['info']('goggleTTS\x20path',_0x143b2a[_0x74de('0x2d')]('.')[0x0]);return _0x143b2a['split']('.')[0x0];});};exports[_0x74de('0x48')]=function(_0x359b3a,_0x5dce09,_0x5082f3){return google[_0x74de('0x49')](_0x359b3a,_0x5dce09,_0x5082f3)[_0x74de('0x2c')](function(_0x3f224c){logger[_0x74de('0x1d')](_0x3f224c[_0x74de('0x4a')]);return rp(_0x3f224c);})[_0x74de('0x2c')](function(_0xfe0dc9){var _0x54c6be='';var _0x1b4e70=0x0;try{fs[_0x74de('0x1f')](_0x359b3a);}catch(_0x108081){logger['error'](_0x108081);}if(_0xfe0dc9&&_0xfe0dc9['results']){_0x54c6be=_0xfe0dc9[_0x74de('0x4b')]['map'](function(_0xd63d59){return _0xd63d59&&_0xd63d59[_0x74de('0x4c')][0x0]&&_0xd63d59[_0x74de('0x4c')][0x0][_0x74de('0x4d')]?_0xd63d59[_0x74de('0x4c')][0x0][_0x74de('0x4d')]:'';})['join']('\x0a');_0x1b4e70=_0xfe0dc9[_0x74de('0x4b')][_0x74de('0x4e')](function(_0x2c1769){return _0x2c1769&&_0x2c1769[_0x74de('0x4c')][0x0]&&_0x2c1769[_0x74de('0x4c')][0x0][_0x74de('0x4f')]?_0x2c1769[_0x74de('0x4c')][0x0]['confidence']:0x0;})[_0x74de('0x50')]('\x0a');}logger[_0x74de('0x1d')](_0x74de('0x51'),_0x54c6be);logger[_0x74de('0x1d')]('googleASR\x20confidence',_0x1b4e70);return{'transcript':_0x54c6be,'confidence':_0x1b4e70};})[_0x74de('0x52')](function(_0x4c3dfc){logger[_0x74de('0x22')]('[%s]\x20%s:%s',_0x4c3dfc[_0x74de('0x18')],_0x4c3dfc['name'],_0x4c3dfc[_0x74de('0x53')]);});};exports[_0x74de('0x54')]=function(_0x277c76,_0x2f4920,_0x3e732b,_0x51e8d2){var _0x77435b=apiai(_0x2f4920,{'language':_0x51e8d2||'en'});return _0x77435b[_0x74de('0x55')](_0x3e732b,{'sessionId':md5(_0x277c76)})[_0x74de('0x2c')](function(_0x14b77c){logger[_0x74de('0x1d')](JSON[_0x74de('0x43')](_0x14b77c));return{'source':_0x14b77c['result']['source'],'resolvedQuery':_0x14b77c[_0x74de('0x56')]['resolvedQuery'],'action':_0x14b77c[_0x74de('0x56')][_0x74de('0x57')],'actionIncomplete':_0x14b77c['result'][_0x74de('0x58')],'speech':_0x14b77c['result']['fulfillment']['speech'],'score':_0x14b77c[_0x74de('0x56')][_0x74de('0x59')],'statusCode':_0x14b77c['status'][_0x74de('0x5a')],'endConversation':_0x14b77c[_0x74de('0x56')][_0x74de('0x5b')][_0x74de('0x5c')]||![],'isFallbackIntent':_0x14b77c[_0x74de('0x56')][_0x74de('0x5b')][_0x74de('0x5d')]};});};exports[_0x74de('0x5e')]=function(_0xc26d3a,_0x58ec75,_0x63eda8,_0x11b33e,_0x41591c,_0x228a0c){var _0x1d1c29=_0x11b33e[_0x74de('0x5f')](/\\n/g,'\x0a');var _0x205530={'credentials':{'private_key':_0x1d1c29,'client_email':_0x63eda8}};var _0x1cb0f3=new dialogflow[(_0x74de('0x60'))](_0x205530);var _0x2b0396=_0x1cb0f3[_0x74de('0x61')](_0x58ec75,md5(_0xc26d3a));var _0x476707={'session':_0x2b0396,'queryInput':{'text':{'text':_0x41591c,'languageCode':_0x228a0c}}};return _0x1cb0f3[_0x74de('0x62')](_0x476707)[_0x74de('0x2c')](function(_0x57499b){if(_0x57499b&&_0x57499b[_0x74de('0x63')]){logger[_0x74de('0x1d')](_0x74de('0x64'),JSON[_0x74de('0x43')](_0x57499b));var _0x49dda1=_0x57499b[0x0];if(_0x49dda1){var _0x6f906f={'action':_0x49dda1[_0x74de('0x65')][_0x74de('0x57')],'allRequiredParamsPresent':_0x49dda1[_0x74de('0x65')][_0x74de('0x66')],'endConversation':_0x49dda1[_0x74de('0x65')]['diagnosticInfo']&&_0x49dda1[_0x74de('0x65')][_0x74de('0x67')][_0x74de('0x68')]?_0x49dda1[_0x74de('0x65')][_0x74de('0x67')][_0x74de('0x68')][_0x74de('0x69')][_0x74de('0x6a')]:![],'fulfillmentText':_0x49dda1[_0x74de('0x65')][_0x74de('0x6b')],'intentName':_0x49dda1[_0x74de('0x65')][_0x74de('0x6c')][_0x74de('0x6d')],'intentDisplayName':_0x49dda1['queryResult']['intent'][_0x74de('0x6e')],'isFallbackIntent':_0x49dda1[_0x74de('0x65')][_0x74de('0x6c')]['isFallback'],'languageCode':_0x49dda1[_0x74de('0x65')][_0x74de('0x6f')],'queryText':_0x49dda1[_0x74de('0x65')][_0x74de('0x70')],'responseId':_0x49dda1[_0x74de('0x71')],'score':_0x49dda1['queryResult'][_0x74de('0x72')],'speech':_0x49dda1[_0x74de('0x65')]['fulfillmentText'],'providerResponse':JSON[_0x74de('0x43')](_0x57499b)};return _0x6f906f;}}});};exports['tildeASR']=function(_0x429c45,_0x3b20f2,_0x3363d5,_0x452d6a){return tilde[_0x74de('0x49')](_0x429c45,_0x3b20f2,_0x3363d5,_0x452d6a)[_0x74de('0x2c')](function(_0x482620){try{fs['unlink'](_0x429c45);}catch(_0xd7c032){logger[_0x74de('0x22')](_0xd7c032);}logger[_0x74de('0x1d')]('Tilde\x20ASR\x20transcription',_0x482620[_0x74de('0x4d')]);logger[_0x74de('0x1d')]('Tilde\x20ASR\x20confidence',_0x482620[_0x74de('0x4f')]);return _0x482620;});};exports[_0x74de('0x73')]=function(_0x13fb80,_0xadc569,_0x5f1fda,_0x2bd4ec,_0x48de13,_0x394f62){var _0x42ddc2=path['resolve'](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+_0x74de('0x39'));var _0x53b83c;return aws[_0x74de('0x74')](_0x13fb80,_0xadc569,_0x5f1fda,_0x2bd4ec,_0x48de13,_0x394f62,_0x42ddc2)[_0x74de('0x2c')](function(){_0x53b83c=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs['generate'](0x4)+_0x74de('0x3e'));return convertFile(_0x42ddc2,_0x53b83c);})[_0x74de('0x2c')](function(){try{fs[_0x74de('0x1f')](_0x42ddc2);fs[_0x74de('0x3c')](_0x53b83c,_0x74de('0x3d'));}catch(_0x2d02d3){logger[_0x74de('0x22')](_0x2d02d3);}return _0x53b83c['split']('.')[0x0];});};exports[_0x74de('0x75')]=function(_0x383455,_0x336516,_0x34952d,_0x474229,_0x256ccc,_0x7171cd){return aws[_0x74de('0x76')](_0x383455,_0x336516,_0x34952d,_0x474229,_0x256ccc,_0x7171cd)[_0x74de('0x2c')](function(_0xc2b5c5){logger[_0x74de('0x1d')](JSON[_0x74de('0x43')](_0xc2b5c5));return _0xc2b5c5;});};exports[_0x74de('0x77')]=function(_0x55ba05,_0x2b5c14,_0x31dbbb,_0x22f4ab){var _0x3e0449=util[_0x74de('0x78')](_0x74de('0x79'),ISPEECH_API,_0x55ba05,encodeURIComponent(_0x2b5c14),_0x31dbbb,_0x22f4ab);var _0x1e60a4=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+_0x74de('0x39'));var _0x2b1bc8;return downloadFile(_0x3e0449,_0x1e60a4)[_0x74de('0x2c')](function(){_0x2b1bc8=path[_0x74de('0x28')](__dirname,_0x74de('0x29'),rs[_0x74de('0x2a')](0x4)+_0x74de('0x3e'));return convertFile(_0x1e60a4,_0x2b1bc8);})['then'](function(){try{fs[_0x74de('0x1f')](_0x1e60a4);fs[_0x74de('0x3c')](_0x2b1bc8,_0x74de('0x3d'));}catch(_0x3790ae){logger['error'](_0x3790ae);}return _0x2b1bc8[_0x74de('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x2f4a7d,_0x4cd261,_0x45505b,_0x3bab7e){var _0x34a43e=util[_0x74de('0x78')](_0x74de('0x7a'),ISPEECH_API,_0x4cd261,_0x45505b,base64Encode(_0x2f4a7d),_0x3bab7e?util[_0x74de('0x78')](_0x74de('0x7b'),encodeURIComponent(_0x3bab7e)):_0x74de('0x7c'));return uploadFile(_0x34a43e)['then'](function(_0x1eb37f){return querystring[_0x74de('0xc')](_0x1eb37f);});};exports[_0x74de('0x7d')]=function(_0x59a3a7,_0x3d878e){return sestek[_0x74de('0x7e')](_0x59a3a7,_0x3d878e)[_0x74de('0x2c')](function(_0x294a14){logger[_0x74de('0x1d')](JSON[_0x74de('0x43')](_0x294a14));var _0x1ad140={'speech':_0x294a14['text'],'action':_0x294a14[_0x74de('0x7f')]?_0x294a14[_0x74de('0x7f')][_0x74de('0x80')]:undefined,'actiondata':_0x294a14[_0x74de('0x7f')]?_0x294a14['channelData'][_0x74de('0x81')]:undefined};if(_0x294a14[_0x74de('0x7f')]&&_0x294a14['channelData'][_0x74de('0x82')]){return base64Decode(_0x294a14[_0x74de('0x7f')][_0x74de('0x82')][_0x74de('0x83')],path[_0x74de('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x74de('0x3e')))[_0x74de('0x2c')](function(_0x366e01){_0x1ad140[_0x74de('0x84')]=_0x366e01;return _0x1ad140;});}return _0x1ad140;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x8842=['pipe','path','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','chmodSync','unlink','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','info','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','textRequest','result','resolvedQuery','action','speech','score','status','code','metadata','endConversation','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','intent','name','displayName','isFallback','languageCode','queryText','responseId','fulfillmentText','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','dirName','dialogflow','md5','querystring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish\x20download\x20file','download\x20error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8842,0x163));var _0x2884=function(_0x18f7da,_0x40d95e){_0x18f7da=_0x18f7da-0x0;var _0x38a3c4=_0x8842[_0x18f7da];return _0x38a3c4;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x2884('0x0'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x2884('0x1'));var path=require('path');var querystring=require(_0x2884('0x2'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x2884('0x3'));var tts=require(_0x2884('0x4'));var urlParse=require(_0x2884('0x5'))[_0x2884('0x6')];var util=require('util');var aws=require(_0x2884('0x7'));var google=require(_0x2884('0x8'));var sestek=require(_0x2884('0x9'));var tilde=require(_0x2884('0xa'));var logger=require(_0x2884('0xb'))(_0x2884('0xc'));var ISPEECH_API=_0x2884('0xd');function downloadFile(_0x3b63a5,_0x31e016){return new BPromise(function(_0x508965,_0x4ae6df){var _0x8149c8=urlParse(_0x3b63a5);var _0x365238=_0x8149c8['protocol']===_0x2884('0xe')?https:http;var _0x1aa673={'host':_0x8149c8[_0x2884('0xf')],'path':_0x8149c8['path'],'headers':{'user-agent':_0x2884('0x10')}};_0x365238[_0x2884('0x11')](_0x1aa673,function(_0x3cb623){if(_0x3cb623['statusCode']!==0xc8){logger[_0x2884('0x12')]('request\x20to\x20'+_0x3b63a5+_0x2884('0x13')+_0x3cb623[_0x2884('0x14')]+'\x20('+_0x3cb623[_0x2884('0x15')]+')');_0x4ae6df(new Error(_0x2884('0x16')+_0x3b63a5+'\x20failed,\x20status\x20code\x20=\x20'+_0x3cb623[_0x2884('0x14')]+'\x20('+_0x3cb623[_0x2884('0x15')]+')'));return;}var _0x3aae47=fs[_0x2884('0x17')](_0x31e016);_0x3aae47['on']('finish',function(){logger['info'](_0x2884('0x18'));_0x3aae47['close'](_0x508965);});_0x3aae47['on'](_0x2884('0x12'),function(_0xeb945b){fs['unlink'](_0x31e016);logger[_0x2884('0x12')](_0x2884('0x19'),_0xeb945b);_0x4ae6df(_0xeb945b);});_0x3cb623[_0x2884('0x1a')](_0x3aae47);})['on'](_0x2884('0x12'),function(_0x5d6857){logger[_0x2884('0x12')](_0x5d6857);_0x4ae6df(_0x5d6857);})['end']();});}function uploadFile(_0x2b74b9){return new BPromise(function(_0x27cb7e,_0x4f8a1d){var _0xf46a9f=urlParse(_0x2b74b9);var _0x11af38=_0xf46a9f['protocol']===_0x2884('0xe')?https:http;var _0xaf358f={'host':_0xf46a9f[_0x2884('0xf')],'path':_0xf46a9f[_0x2884('0x1b')],'headers':{'user-agent':_0x2884('0x10')}};_0x11af38['get'](_0xaf358f,function(_0x3c34b){if(_0x3c34b[_0x2884('0x14')]!==0xc8){_0x4f8a1d(new Error(_0x2884('0x16')+_0x2b74b9+'\x20failed,\x20status\x20code\x20=\x20'+_0x3c34b[_0x2884('0x14')]+'\x20('+_0x3c34b[_0x2884('0x15')]+')'));return;}var _0x592eff='';_0x3c34b['on'](_0x2884('0x1c'),function(_0x5144b2){_0x592eff+=_0x5144b2;});_0x3c34b['on']('end',function(){_0x27cb7e(_0x592eff);});})['on'](_0x2884('0x12'),function(_0x1b8ec9){_0x4f8a1d(_0x1b8ec9);})[_0x2884('0x1d')]();});}function convertFile(_0x594895,_0x20e861){return new BPromise(function(_0x83885,_0x56a681){var _0x5a8081=sox[_0x2884('0x1e')](_0x594895,_0x20e861,{'sampleRate':0x1f40,'format':_0x2884('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5a8081['on'](_0x2884('0x12'),function(_0x592bfc){logger[_0x2884('0x12')](_0x2884('0x20'),_0x592bfc);_0x56a681(_0x592bfc);});_0x5a8081['on'](_0x2884('0x1d'),function(){logger['info'](_0x2884('0x21'));_0x83885();});_0x5a8081['start']();});}function base64Decode(_0x27eb65,_0x22d73e){var _0x33e786=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs[_0x2884('0x24')](0x4)+_0x2884('0x25'));fs[_0x2884('0x26')](_0x33e786,_0x27eb65,_0x2884('0x27'));return convertFile(_0x33e786,_0x22d73e)[_0x2884('0x28')](function(){try{fs['unlink'](_0x33e786);fs['chmodSync'](_0x22d73e,_0x2884('0x29'));}catch(_0x4a90b1){logger['error'](_0x4a90b1);}return _0x22d73e[_0x2884('0x2a')]('.')[0x0];});}function base64Encode(_0x277257){var _0xa44427=fs[_0x2884('0x2b')](_0x277257);return new Buffer(_0xa44427)[_0x2884('0x2c')](_0x2884('0x27'));}exports['googleCloudTTS']=function(_0x4c865f,_0x1cb7bf,_0x31c6f4,_0x38ee23,_0x26e125,_0x501228){var _0x52be33,_0x33ed5b;var _0x40f785=_0x2884('0x2d');var _0x5ce944=_0x2884('0x2e')+_0x4c865f;var _0x2a5350={};if(_0x1cb7bf==='ssml'){_0x2a5350[_0x2884('0x2f')]={'ssml':_0x31c6f4};}else{_0x2a5350[_0x2884('0x2f')]={'text':_0x31c6f4};};_0x2a5350[_0x2884('0x30')]={'languageCode':_0x38ee23,'ssmlGender':_0x26e125};_0x2a5350[_0x2884('0x31')]={'audioEncoding':_0x2884('0x32'),'sampleRateHertz':0x1f40};var _0x1dc80a={'url':_0x40f785+_0x2884('0x33')+_0x5ce944,'method':_0x2884('0x34'),'json':!![],'body':_0x2a5350};return rp(_0x1dc80a)[_0x2884('0x28')](function(_0x345e1e){return new BPromise(function(_0x530e90,_0x42f7b4){_0x52be33=path[_0x2884('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0x2884('0x35'));var _0x558dd5=Buffer['from'](_0x345e1e[_0x2884('0x36')],_0x2884('0x27'));return fs[_0x2884('0x37')](_0x52be33,_0x558dd5,function(_0x588205){_0x42f7b4(_0x588205);},function(_0x51d941){fs[_0x2884('0x38')](_0x52be33,_0x2884('0x29'));_0x530e90(_0x51d941);});});})[_0x2884('0x28')](function(_0x3a8ce1){_0x33ed5b=path[_0x2884('0x22')](__dirname,'tmp',rs[_0x2884('0x24')](0x4)+_0x2884('0x25'));return convertFile(_0x52be33,_0x33ed5b);})[_0x2884('0x28')](function(){try{fs[_0x2884('0x39')](_0x52be33);fs[_0x2884('0x38')](_0x33ed5b,'777');}catch(_0x183993){logger[_0x2884('0x12')](_0x183993);}logger['info'](_0x2884('0x3a'),_0x33ed5b['split']('.')[0x0]);return _0x33ed5b['split']('.')[0x0];});};exports[_0x2884('0x3b')]=function(_0x261092,_0xe76fd0){var _0x155781='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x573fe3,_0x140549;var _0x5a67b1;var _0x498f1f={'encoding':'utf8','method':_0x2884('0x34'),'timeout':0x2710,'url':_0x155781,'headers':{'Content-Type':_0x2884('0x3c')},'body':_0x2884('0x3d')+encodeURIComponent(JSON[_0x2884('0x3e')]([[[_0x2884('0x3f'),JSON['stringify']([_0x261092,_0xe76fd0||'en',![],'null']),null,_0x2884('0x40')]]]))};return rp(_0x498f1f)[_0x2884('0x28')](function(_0x2b0324){try{_0x5a67b1=eval(_0x2b0324[_0x2884('0x41')](0x5))[0x0][0x2];}catch(_0x5ad0bd){throw new Error('parse\x20response\x20failed:\x0a'+_0x2b0324[_0x2884('0x1c')]);}if(!_0x5a67b1){if(_0x261092['length']>0xc8){throw new Error(_0x2884('0x42'));}else{throw new Error(_0x2884('0x43')+_0xe76fd0+_0x2884('0x44'));}}try{_0x5a67b1=eval(_0x5a67b1)[0x0];}catch(_0x5d9795){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2884('0x1c')]);}const _0x521864=_0x5a67b1;_0x573fe3=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs['generate'](0x4)+_0x2884('0x35'));fs[_0x2884('0x26')](_0x573fe3,_0x5a67b1,{'encoding':_0x2884('0x27')});_0x140549=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs[_0x2884('0x24')](0x4)+'.wav');return convertFile(_0x573fe3,_0x140549);})[_0x2884('0x28')](function(){try{fs['unlink'](_0x573fe3);fs[_0x2884('0x38')](_0x140549,_0x2884('0x29'));}catch(_0x115824){logger[_0x2884('0x12')](_0x115824);}logger[_0x2884('0x45')]('goggleTTS\x20path',_0x140549[_0x2884('0x2a')]('.')[0x0]);return _0x140549[_0x2884('0x2a')]('.')[0x0];});};exports[_0x2884('0x46')]=function(_0x3f5895,_0x4a4191,_0x28d92f){return google[_0x2884('0x47')](_0x3f5895,_0x4a4191,_0x28d92f)[_0x2884('0x28')](function(_0x302087){logger['info'](_0x302087[_0x2884('0x48')]);return rp(_0x302087);})[_0x2884('0x28')](function(_0x12d356){var _0x37866b='';var _0x33a215=0x0;try{fs[_0x2884('0x39')](_0x3f5895);}catch(_0x2e58b0){logger[_0x2884('0x12')](_0x2e58b0);}if(_0x12d356&&_0x12d356['results']){_0x37866b=_0x12d356[_0x2884('0x49')][_0x2884('0x4a')](function(_0x5bd662){return _0x5bd662&&_0x5bd662[_0x2884('0x4b')][0x0]&&_0x5bd662['alternatives'][0x0][_0x2884('0x4c')]?_0x5bd662[_0x2884('0x4b')][0x0][_0x2884('0x4c')]:'';})[_0x2884('0x4d')]('\x0a');_0x33a215=_0x12d356[_0x2884('0x49')][_0x2884('0x4a')](function(_0xed1061){return _0xed1061&&_0xed1061[_0x2884('0x4b')][0x0]&&_0xed1061[_0x2884('0x4b')][0x0][_0x2884('0x4e')]?_0xed1061['alternatives'][0x0][_0x2884('0x4e')]:0x0;})[_0x2884('0x4d')]('\x0a');}logger['info']('googleASR\x20transcription',_0x37866b);logger[_0x2884('0x45')](_0x2884('0x4f'),_0x33a215);return{'transcript':_0x37866b,'confidence':_0x33a215};})[_0x2884('0x50')](function(_0x286f99){logger['error'](_0x2884('0x51'),_0x286f99[_0x2884('0x14')],_0x286f99['name'],_0x286f99['message']);});};exports[_0x2884('0x52')]=function(_0x3b5c56,_0xb30e66,_0x5c99ac,_0xe3ed87){var _0x5e52dd=apiai(_0xb30e66,{'language':_0xe3ed87||'en'});return _0x5e52dd[_0x2884('0x53')](_0x5c99ac,{'sessionId':md5(_0x3b5c56)})[_0x2884('0x28')](function(_0x19ba55){logger[_0x2884('0x45')](JSON[_0x2884('0x3e')](_0x19ba55));return{'source':_0x19ba55[_0x2884('0x54')]['source'],'resolvedQuery':_0x19ba55['result'][_0x2884('0x55')],'action':_0x19ba55[_0x2884('0x54')][_0x2884('0x56')],'actionIncomplete':_0x19ba55[_0x2884('0x54')]['actionIncomplete'],'speech':_0x19ba55[_0x2884('0x54')]['fulfillment'][_0x2884('0x57')],'score':_0x19ba55[_0x2884('0x54')][_0x2884('0x58')],'statusCode':_0x19ba55[_0x2884('0x59')][_0x2884('0x5a')],'endConversation':_0x19ba55[_0x2884('0x54')][_0x2884('0x5b')][_0x2884('0x5c')]||![],'isFallbackIntent':_0x19ba55[_0x2884('0x54')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0xdf1db4,_0xc3af,_0x11b46a,_0x55cea3,_0x2c5512,_0x29dccf){var _0x981200=_0x55cea3[_0x2884('0x5d')](/\\n/g,'\x0a');var _0x45897e={'credentials':{'private_key':_0x981200,'client_email':_0x11b46a}};var _0x554680=new dialogflow[(_0x2884('0x5e'))](_0x45897e);var _0x5e47eb=_0x554680['sessionPath'](_0xc3af,md5(_0xdf1db4));var _0x41307e={'session':_0x5e47eb,'queryInput':{'text':{'text':_0x2c5512,'languageCode':_0x29dccf}}};return _0x554680[_0x2884('0x5f')](_0x41307e)[_0x2884('0x28')](function(_0x5239db){if(_0x5239db&&_0x5239db[_0x2884('0x60')]){logger['info'](_0x2884('0x61'),JSON['stringify'](_0x5239db));var _0x1d64ad=_0x5239db[0x0];if(_0x1d64ad){var _0x414ad1={'action':_0x1d64ad[_0x2884('0x62')][_0x2884('0x56')],'allRequiredParamsPresent':_0x1d64ad[_0x2884('0x62')][_0x2884('0x63')],'endConversation':_0x1d64ad[_0x2884('0x62')]['diagnosticInfo']&&_0x1d64ad[_0x2884('0x62')][_0x2884('0x64')][_0x2884('0x65')]?_0x1d64ad['queryResult']['diagnosticInfo'][_0x2884('0x65')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x1d64ad['queryResult']['fulfillmentText'],'intentName':_0x1d64ad[_0x2884('0x62')][_0x2884('0x66')][_0x2884('0x67')],'intentDisplayName':_0x1d64ad[_0x2884('0x62')][_0x2884('0x66')][_0x2884('0x68')],'isFallbackIntent':_0x1d64ad[_0x2884('0x62')][_0x2884('0x66')][_0x2884('0x69')],'languageCode':_0x1d64ad[_0x2884('0x62')][_0x2884('0x6a')],'queryText':_0x1d64ad[_0x2884('0x62')][_0x2884('0x6b')],'responseId':_0x1d64ad[_0x2884('0x6c')],'score':_0x1d64ad[_0x2884('0x62')]['intentDetectionConfidence'],'speech':_0x1d64ad['queryResult'][_0x2884('0x6d')],'providerResponse':JSON[_0x2884('0x3e')](_0x5239db)};return _0x414ad1;}}});};exports['tildeASR']=function(_0x40bb36,_0x472d5a,_0x14f1bd,_0x2257b4){return tilde[_0x2884('0x47')](_0x40bb36,_0x472d5a,_0x14f1bd,_0x2257b4)[_0x2884('0x28')](function(_0x1015d2){try{fs[_0x2884('0x39')](_0x40bb36);}catch(_0x2b0333){logger[_0x2884('0x12')](_0x2b0333);}logger['info']('Tilde\x20ASR\x20transcription',_0x1015d2['transcript']);logger[_0x2884('0x45')](_0x2884('0x6e'),_0x1015d2[_0x2884('0x4e')]);return _0x1015d2;});};exports[_0x2884('0x6f')]=function(_0x385cd0,_0x12bba1,_0xe1267a,_0x3a1696,_0x48cd50,_0x754dc1){var _0x1e0ccc=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs[_0x2884('0x24')](0x4)+_0x2884('0x35'));var _0x299f9e;return aws[_0x2884('0x70')](_0x385cd0,_0x12bba1,_0xe1267a,_0x3a1696,_0x48cd50,_0x754dc1,_0x1e0ccc)[_0x2884('0x28')](function(){_0x299f9e=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs[_0x2884('0x24')](0x4)+'.wav');return convertFile(_0x1e0ccc,_0x299f9e);})[_0x2884('0x28')](function(){try{fs[_0x2884('0x39')](_0x1e0ccc);fs[_0x2884('0x38')](_0x299f9e,'777');}catch(_0x3bd2b3){logger[_0x2884('0x12')](_0x3bd2b3);}return _0x299f9e['split']('.')[0x0];});};exports['awsLex']=function(_0x46fcb4,_0x175bcd,_0x136b4e,_0x442c22,_0x4de1ec,_0x370b63){return aws[_0x2884('0x71')](_0x46fcb4,_0x175bcd,_0x136b4e,_0x442c22,_0x4de1ec,_0x370b63)[_0x2884('0x28')](function(_0x2fa78a){logger['info'](JSON[_0x2884('0x3e')](_0x2fa78a));return _0x2fa78a;});};exports['ispeechTTS']=function(_0x2c9772,_0x3b4a9e,_0x4fcc67,_0x41b18c){var _0x3ae671=util[_0x2884('0x72')](_0x2884('0x73'),ISPEECH_API,_0x2c9772,encodeURIComponent(_0x3b4a9e),_0x4fcc67,_0x41b18c);var _0x49afaa=path[_0x2884('0x22')](__dirname,'tmp',rs[_0x2884('0x24')](0x4)+'.mp3');var _0x5be4e7;return downloadFile(_0x3ae671,_0x49afaa)[_0x2884('0x28')](function(){_0x5be4e7=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs['generate'](0x4)+_0x2884('0x25'));return convertFile(_0x49afaa,_0x5be4e7);})[_0x2884('0x28')](function(){try{fs[_0x2884('0x39')](_0x49afaa);fs[_0x2884('0x38')](_0x5be4e7,_0x2884('0x29'));}catch(_0x2799b2){logger[_0x2884('0x12')](_0x2799b2);}return _0x5be4e7[_0x2884('0x2a')]('.')[0x0];});};exports[_0x2884('0x74')]=function(_0x45f495,_0x1fefcf,_0x4a5296,_0x32e082){var _0x9ebdbe=util['format'](_0x2884('0x75'),ISPEECH_API,_0x1fefcf,_0x4a5296,base64Encode(_0x45f495),_0x32e082?util['format'](_0x2884('0x76'),encodeURIComponent(_0x32e082)):'freeform=3');return uploadFile(_0x9ebdbe)[_0x2884('0x28')](function(_0xff6770){return querystring[_0x2884('0x6')](_0xff6770);});};exports[_0x2884('0x77')]=function(_0x2228c5,_0x36209c){return sestek[_0x2884('0x78')](_0x2228c5,_0x36209c)[_0x2884('0x28')](function(_0x2ee5c8){logger[_0x2884('0x45')](JSON['stringify'](_0x2ee5c8));var _0x23a74b={'speech':_0x2ee5c8[_0x2884('0x79')],'action':_0x2ee5c8[_0x2884('0x7a')]?_0x2ee5c8['channelData']['CustomAction']:undefined,'actiondata':_0x2ee5c8[_0x2884('0x7a')]?_0x2ee5c8[_0x2884('0x7a')]['CustomActionData']:undefined};if(_0x2ee5c8['channelData']&&_0x2ee5c8[_0x2884('0x7a')]['AudioFromTts']){return base64Decode(_0x2ee5c8[_0x2884('0x7a')][_0x2884('0x7b')][_0x2884('0x7c')],path['resolve'](__dirname,_0x2884('0x23'),rs['generate'](0x4)+_0x2884('0x25')))[_0x2884('0x28')](function(_0xb00c5b){_0x23a74b[_0x2884('0x7d')]=_0xb00c5b;return _0x23a74b;});}return _0x23a74b;});};exports[_0x2884('0x7e')]=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 9889760..785771e 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 _0xc4ff=['./nda'];(function(_0x2c094f,_0xe5a1b0){var _0x2f7176=function(_0x28e5f5){while(--_0x28e5f5){_0x2c094f['push'](_0x2c094f['shift']());}};_0x2f7176(++_0xe5a1b0);}(_0xc4ff,0x123));var _0xfc4f=function(_0x163c01,_0xc11912){_0x163c01=_0x163c01-0x0;var _0x1e8c85=_0xc4ff[_0x163c01];return _0x1e8c85;};var nda=require(_0xfc4f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x97c2=['exports','./nda'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x97c2,0xf7));var _0x297c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x97c2[_0x14add3];return _0x4a174f;};var nda=require(_0x297c('0x0'));module[_0x297c('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index f05cea2..f80303b 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 _0x1d5b=['ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','extension','text','Bearer\x20','project','body','channelData'];(function(_0x56ad75,_0x348f9b){var _0x586107=function(_0x48e929){while(--_0x48e929){_0x56ad75['push'](_0x56ad75['shift']());}};_0x586107(++_0x348f9b);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x37acba,_0x19d3c3){_0x37acba=_0x37acba-0x0;var _0x1c2e72=_0x1d5b[_0x37acba];return _0x1c2e72;};'use strict';var rp=require(_0xb1d5('0x0'));var url=require(_0xb1d5('0x1'));var logger=require(_0xb1d5('0x2'))('agi');module[_0xb1d5('0x3')]=function(_0x594c25,_0x2f9c5a){var _0x1a673c={'method':_0xb1d5('0x4'),'uri':url[_0xb1d5('0x5')](_0x2f9c5a['ndauth_url'],'/token'),'form':{'grant_type':_0xb1d5('0x6'),'username':_0x2f9c5a[_0xb1d5('0x7')],'password':_0x2f9c5a[_0xb1d5('0x6')]},'json':!![]};return rp(_0x1a673c)[_0xb1d5('0x8')](function(_0x3b452f){var _0xb2d955={'method':_0xb1d5('0x4'),'uri':url[_0xb1d5('0x5')](_0x2f9c5a['ndassistant_url'],_0xb1d5('0x9')),'body':{'type':_0x2f9c5a[_0xb1d5('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x594c25[_0xb1d5('0xb')]},'from':{'id':_0x594c25[_0xb1d5('0xc')],'name':_0x594c25[_0xb1d5('0xd')]},'recipient':{'id':_0x594c25['dnid'],'name':_0x594c25[_0xb1d5('0xe')]},'text':_0x2f9c5a[_0xb1d5('0xf')],'channelData':{}},'headers':{'Authorization':_0xb1d5('0x10')+_0x3b452f['access_token']},'json':!![]};if(_0x2f9c5a[_0xb1d5('0x11')]){_0xb2d955[_0xb1d5('0x12')][_0xb1d5('0x13')][_0xb1d5('0x14')]=_0x2f9c5a['project'];}if(_0x2f9c5a[_0xb1d5('0x15')]=='1'){_0xb2d955[_0xb1d5('0x12')][_0xb1d5('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb1d5('0x16')};}if(_0x2f9c5a[_0xb1d5('0x17')]){_0xb2d955[_0xb1d5('0x12')][_0xb1d5('0x13')][_0xb1d5('0x18')]=_0x2f9c5a[_0xb1d5('0x17')];if(_0x2f9c5a['custom_action_data']){_0xb2d955[_0xb1d5('0x12')]['channelData'][_0xb1d5('0x19')]=_0x2f9c5a[_0xb1d5('0x1a')];}}logger['info'](JSON[_0xb1d5('0x1b')](_0xb2d955));return rp(_0xb2d955);});}; \ No newline at end of file +var _0xb28a=['AudioOutputSettings','CustomAction','custom_action','CustomActionData','info','stringify','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData'];(function(_0x311598,_0x5d4e7b){var _0x39de20=function(_0x444f94){while(--_0x444f94){_0x311598['push'](_0x311598['shift']());}};_0x39de20(++_0x5d4e7b);}(_0xb28a,0x166));var _0xab28=function(_0x215c7b,_0x1e8b6c){_0x215c7b=_0x215c7b-0x0;var _0x867c3d=_0xb28a[_0x215c7b];return _0x867c3d;};'use strict';var rp=require('request-promise');var url=require(_0xab28('0x0'));var logger=require(_0xab28('0x1'))('agi');module[_0xab28('0x2')]=function(_0x4cb73b,_0x5ae2aa){var _0x4b013a={'method':_0xab28('0x3'),'uri':url[_0xab28('0x4')](_0x5ae2aa[_0xab28('0x5')],_0xab28('0x6')),'form':{'grant_type':_0xab28('0x7'),'username':_0x5ae2aa[_0xab28('0x8')],'password':_0x5ae2aa[_0xab28('0x7')]},'json':!![]};return rp(_0x4b013a)[_0xab28('0x9')](function(_0x48949b){var _0x479267={'method':_0xab28('0x3'),'uri':url[_0xab28('0x4')](_0x5ae2aa[_0xab28('0xa')],_0xab28('0xb')),'body':{'type':_0x5ae2aa[_0xab28('0xc')]||_0xab28('0xd'),'channelId':'Nda','conversation':{'id':_0x4cb73b[_0xab28('0xe')]},'from':{'id':_0x4cb73b['callerid'],'name':_0x4cb73b[_0xab28('0xf')]},'recipient':{'id':_0x4cb73b[_0xab28('0x10')],'name':_0x4cb73b[_0xab28('0x11')]},'text':_0x5ae2aa[_0xab28('0x12')],'channelData':{}},'headers':{'Authorization':_0xab28('0x13')+_0x48949b[_0xab28('0x14')]},'json':!![]};if(_0x5ae2aa[_0xab28('0x15')]){_0x479267[_0xab28('0x16')]['channelData'][_0xab28('0x17')]=_0x5ae2aa[_0xab28('0x15')];}if(_0x5ae2aa[_0xab28('0x18')]=='1'){_0x479267[_0xab28('0x16')][_0xab28('0x19')][_0xab28('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5ae2aa['custom_action']){_0x479267[_0xab28('0x16')][_0xab28('0x19')][_0xab28('0x1b')]=_0x5ae2aa[_0xab28('0x1c')];if(_0x5ae2aa['custom_action_data']){_0x479267[_0xab28('0x16')]['channelData'][_0xab28('0x1d')]=_0x5ae2aa['custom_action_data'];}}logger[_0xab28('0x1e')](JSON[_0xab28('0x1f')](_0x479267));return rp(_0x479267);});}; \ 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 5b053b3..6d4c265 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 _0x71a3=['exports','./lib/api'];(function(_0x1d82ab,_0x567dcc){var _0x27cae6=function(_0x1e53b3){while(--_0x1e53b3){_0x1d82ab['push'](_0x1d82ab['shift']());}};_0x27cae6(++_0x567dcc);}(_0x71a3,0x1b5));var _0x371a=function(_0x5b758a,_0x3d5ff2){_0x5b758a=_0x5b758a-0x0;var _0x2a7e5b=_0x71a3[_0x5b758a];return _0x2a7e5b;};'use strict';var asr=require(_0x371a('0x0'));module[_0x371a('0x1')]=function(_0x3192da,_0x4449eb,_0x3b8e0f,_0xfc4d81){return asr(_0x3192da,_0x4449eb,_0x3b8e0f,_0xfc4d81);}; \ No newline at end of file +var _0x6b43=['exports','./lib/api'];(function(_0x66306a,_0x519133){var _0x3ce3b6=function(_0x22e099){while(--_0x22e099){_0x66306a['push'](_0x66306a['shift']());}};_0x3ce3b6(++_0x519133);}(_0x6b43,0x18d));var _0x36b4=function(_0x2ea770,_0x27e659){_0x2ea770=_0x2ea770-0x0;var _0x2005bb=_0x6b43[_0x2ea770];return _0x2005bb;};'use strict';var asr=require(_0x36b4('0x0'));module[_0x36b4('0x1')]=function(_0x40e0f8,_0x3f8114,_0x21454a,_0x2519c9){return asr(_0x40e0f8,_0x3f8114,_0x21454a,_0x2519c9);}; \ 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 e41a61b..9330f68 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 _0x22cd=['open','message','bluebird','lodash','moment','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0xa6fcce,_0x18fcd5){var _0x228424=function(_0x1b83ff){while(--_0x1b83ff){_0xa6fcce['push'](_0xa6fcce['shift']());}};_0x228424(++_0x18fcd5);}(_0x22cd,0x77));var _0xd22c=function(_0x100e0c,_0x5523b8){_0x100e0c=_0x100e0c-0x0;var _0x4db1aa=_0x22cd[_0x100e0c];return _0x4db1aa;};'use strict';var BPromise=require(_0xd22c('0x0'));var _=require(_0xd22c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd22c('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xd22c('0x3'));module['exports']=function(_0x42c47e,_0x11aa76,_0x48891a,_0x578336){return new BPromise(function(_0x19c9ea,_0x124c78){logger[_0xd22c('0x4')](_0xd22c('0x5'),_0x578336||_0xd22c('0x6'));var _0x5ca508=new WebSocket(_0x578336||_0xd22c('0x6'),{'perMessageDeflate':![]});var _0x97c5c8='';var _0x6775c='0';var _0xef1246='1';var _0xe45fe1='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x314303(_0x35535d){var _0x21ebfc=crypto[_0xd22c('0x7')](_0xd22c('0x8'));_0x21ebfc[_0xd22c('0x9')](_0x35535d);return _0x21ebfc[_0xd22c('0xa')]('hex');}function _0x1d32dd(){try{logger[_0xd22c('0x4')](_0xd22c('0xb'));var _0xb1ebc9=moment()[_0xd22c('0xc')]();var _0x95e09b=_0x314303(_0xb1ebc9+_0x11aa76+_0x48891a);_0x5ca508[_0xd22c('0xd')](JSON[_0xd22c('0xe')]({'appID':_0x11aa76,'timestamp':_0xb1ebc9,'appKey':_0x95e09b}));var _0x8d74f4=fs[_0xd22c('0xf')](_0x42c47e);_0x8d74f4['on'](_0xd22c('0x10'),function(_0x6a5c84){_0x5ca508[_0xd22c('0xd')](_0x6a5c84);});_0x8d74f4['on'](_0xd22c('0x11'),function(){_0x5ca508['send']('EOS');});}catch(_0x1d2f52){logger[_0xd22c('0x12')](_0xd22c('0x13'),JSON[_0xd22c('0xe')](_0x1d2f52));_0x5ca508[_0xd22c('0x14')]();}}function _0x10f1a1(_0x2e9031){try{if(_0x2e9031){var _0xedceac=JSON[_0xd22c('0x15')](_0x2e9031);switch(_0xedceac[_0xd22c('0x16')]){case 0x0:if(_0xedceac[_0xd22c('0x17')]){if(_0xedceac[_0xd22c('0x17')]['final']){logger[_0xd22c('0x4')](_0xd22c('0x18'),JSON[_0xd22c('0xe')](_0xedceac[_0xd22c('0x17')][_0xd22c('0x19')]));_0x97c5c8=_0xedceac[_0xd22c('0x17')][_0xd22c('0x19')][0x0][_0xd22c('0x1a')];_0x6775c=_0xedceac['result'][_0xd22c('0x19')][0x0]['likelihood'];_0xef1246='0';_0xe45fe1=_0xd22c('0x1b');_0x5ca508['terminate']();}}break;case 0x1:logger[_0xd22c('0x4')](_0xd22c('0x1c'));_0xef1246='1';_0xe45fe1=_0xd22c('0x1c');break;case 0x2:logger[_0xd22c('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xef1246='2';_0xe45fe1=_0xd22c('0x1d');break;case 0x9:logger[_0xd22c('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0xef1246='9';_0xe45fe1=_0xd22c('0x1e');break;case 0xa:logger[_0xd22c('0x4')](_0xd22c('0x1f'));_0xef1246='10';_0xe45fe1='Authentication\x20failed.';break;case 0xb:logger[_0xd22c('0x4')](_0xd22c('0x20'));_0xef1246='11';_0xe45fe1=_0xd22c('0x20');}}}catch(_0x4f6c23){logger[_0xd22c('0x12')](_0xd22c('0x21'),JSON[_0xd22c('0xe')](_0x4f6c23));_0x5ca508[_0xd22c('0x14')]();}}function _0x58995e(){logger[_0xd22c('0x4')](_0xd22c('0x22'));_0x19c9ea({'transcript':_0x97c5c8,'confidence':_0x6775c,'status':_0xef1246,'status_message':_0xe45fe1});}function _0xaa9f82(_0x4bdbfd){logger[_0xd22c('0x12')](_0xd22c('0x23'));if(!_[_0xd22c('0x24')](_0x4bdbfd)){logger['error'](_['isObject'](_0x4bdbfd)?JSON[_0xd22c('0xe')](_0x4bdbfd):_0x4bdbfd);}}_0x5ca508['on'](_0xd22c('0x25'),_0x1d32dd);_0x5ca508['on'](_0xd22c('0x26'),_0x10f1a1);_0x5ca508['on']('close',_0x58995e);_0x5ca508['on'](_0xd22c('0x12'),_0xaa9f82);});}; \ No newline at end of file +var _0x6ee8=['Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','info','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','crypto','agi','exports'];(function(_0x39a302,_0x3cd4a){var _0x25dce9=function(_0x573f16){while(--_0x573f16){_0x39a302['push'](_0x39a302['shift']());}};_0x25dce9(++_0x3cd4a);}(_0x6ee8,0x1b3));var _0x86ee=function(_0x302195,_0x47f65c){_0x302195=_0x302195-0x0;var _0x28a76e=_0x6ee8[_0x302195];return _0x28a76e;};'use strict';var BPromise=require('bluebird');var _=require(_0x86ee('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x86ee('0x1'));var crypto=require(_0x86ee('0x2'));var logger=require('../../../../../../config/logger')(_0x86ee('0x3'));module[_0x86ee('0x4')]=function(_0x62e766,_0x47793d,_0x4186b6,_0x2dc788){return new BPromise(function(_0x3bb1c5,_0x4f81b7){logger['info'](_0x86ee('0x5'),_0x2dc788||_0x86ee('0x6'));var _0x5aec8a=new WebSocket(_0x2dc788||_0x86ee('0x6'),{'perMessageDeflate':![]});var _0x47d72a='';var _0x5ee41c='0';var _0x22836d='1';var _0x1c2529=_0x86ee('0x7');function _0x28f759(_0x3b40ca){var _0x23da13=crypto[_0x86ee('0x8')](_0x86ee('0x9'));_0x23da13[_0x86ee('0xa')](_0x3b40ca);return _0x23da13[_0x86ee('0xb')]('hex');}function _0xcd851f(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x55297b=moment()['unix']();var _0x3682ea=_0x28f759(_0x55297b+_0x47793d+_0x4186b6);_0x5aec8a[_0x86ee('0xc')](JSON[_0x86ee('0xd')]({'appID':_0x47793d,'timestamp':_0x55297b,'appKey':_0x3682ea}));var _0x407d98=fs['createReadStream'](_0x62e766);_0x407d98['on'](_0x86ee('0xe'),function(_0x140918){_0x5aec8a[_0x86ee('0xc')](_0x140918);});_0x407d98['on'](_0x86ee('0xf'),function(){_0x5aec8a[_0x86ee('0xc')](_0x86ee('0x10'));});}catch(_0x154ec4){logger[_0x86ee('0x11')](_0x86ee('0x12'),JSON[_0x86ee('0xd')](_0x154ec4));_0x5aec8a[_0x86ee('0x13')]();}}function _0x4a3c02(_0x175913){try{if(_0x175913){var _0x29f4cc=JSON[_0x86ee('0x14')](_0x175913);switch(_0x29f4cc[_0x86ee('0x15')]){case 0x0:if(_0x29f4cc[_0x86ee('0x16')]){if(_0x29f4cc[_0x86ee('0x16')][_0x86ee('0x17')]){logger['info'](_0x86ee('0x18'),JSON[_0x86ee('0xd')](_0x29f4cc[_0x86ee('0x16')][_0x86ee('0x19')]));_0x47d72a=_0x29f4cc[_0x86ee('0x16')][_0x86ee('0x19')][0x0]['transcript'];_0x5ee41c=_0x29f4cc[_0x86ee('0x16')][_0x86ee('0x19')][0x0][_0x86ee('0x1a')];_0x22836d='0';_0x1c2529=_0x86ee('0x1b');_0x5aec8a['terminate']();}}break;case 0x1:logger[_0x86ee('0x1c')](_0x86ee('0x7'));_0x22836d='1';_0x1c2529='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x86ee('0x1c')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x22836d='2';_0x1c2529=_0x86ee('0x1d');break;case 0x9:logger[_0x86ee('0x1c')](_0x86ee('0x1e'));_0x22836d='9';_0x1c2529=_0x86ee('0x1e');break;case 0xa:logger[_0x86ee('0x1c')]('Authentication\x20failed.');_0x22836d='10';_0x1c2529=_0x86ee('0x1f');break;case 0xb:logger[_0x86ee('0x1c')](_0x86ee('0x20'));_0x22836d='11';_0x1c2529=_0x86ee('0x20');}}}catch(_0x5d08c7){logger[_0x86ee('0x11')](_0x86ee('0x21'),JSON[_0x86ee('0xd')](_0x5d08c7));_0x5aec8a[_0x86ee('0x13')]();}}function _0x19d4bb(){logger[_0x86ee('0x1c')](_0x86ee('0x22'));_0x3bb1c5({'transcript':_0x47d72a,'confidence':_0x5ee41c,'status':_0x22836d,'status_message':_0x1c2529});}function _0x3a9a62(_0x1f5937){logger[_0x86ee('0x11')](_0x86ee('0x23'));if(!_[_0x86ee('0x24')](_0x1f5937)){logger['error'](_[_0x86ee('0x25')](_0x1f5937)?JSON[_0x86ee('0xd')](_0x1f5937):_0x1f5937);}}_0x5aec8a['on'](_0x86ee('0x26'),_0xcd851f);_0x5aec8a['on'](_0x86ee('0x27'),_0x4a3c02);_0x5aec8a['on'](_0x86ee('0xf'),_0x19d4bb);_0x5aec8a['on'](_0x86ee('0x11'),_0x3a9a62);});}; \ 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 13887be..470f54f 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 _0xbea0=['exports','./asr'];(function(_0x526759,_0x3aecf9){var _0xa625f7=function(_0x567ab8){while(--_0x567ab8){_0x526759['push'](_0x526759['shift']());}};_0xa625f7(++_0x3aecf9);}(_0xbea0,0xcb));var _0x0bea=function(_0x1ac695,_0x3fbbd3){_0x1ac695=_0x1ac695-0x0;var _0x320155=_0xbea0[_0x1ac695];return _0x320155;};var asr=require(_0x0bea('0x0'));module[_0x0bea('0x1')]={'asr':asr}; \ No newline at end of file +var _0x9d66=['./asr','exports'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x9d66,0x1ce));var _0x69d6=function(_0x2a5edb,_0x31a2e7){_0x2a5edb=_0x2a5edb-0x0;var _0x55b07c=_0x9d66[_0x2a5edb];return _0x55b07c;};var asr=require(_0x69d6('0x0'));module[_0x69d6('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 31f7300..44f6e9a 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xe706,0xa3));var _0x6e70=function(_0xa76664,_0x5e32db){_0xa76664=_0xa76664-0x0;var _0x3f7743=_0xe706[_0xa76664];return _0x3f7743;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x45ce90,_0x114609){var _0x313c45=function(_0x55102a){while(--_0x55102a){_0x45ce90['push'](_0x45ce90['shift']());}};_0x313c45(++_0x114609);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 40ff98b..e0cbe22 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 _0x61a5=['query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','DIAL','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','no\x20valid\x20credentials\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','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\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','output','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','XMCS-UNIQUEID','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','agi://%s/square,\x22%s\x22,\x22%s\x22','host','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','createSquareMessage','uniqueid','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','stringify','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured'];(function(_0x37678f,_0x405bee){var _0x9f9284=function(_0x344255){while(--_0x344255){_0x37678f['push'](_0x37678f['shift']());}};_0x9f9284(++_0x405bee);}(_0x61a5,0xf0));var _0x561a=function(_0x319fc1,_0x29179b){_0x319fc1=_0x319fc1-0x0;var _0xb768af=_0x61a5[_0x319fc1];return _0xb768af;};'use strict';var fs=require('fs');var util=require(_0x561a('0x0'));var _=require('lodash');var sh=require(_0x561a('0x1'));var odbc=require(_0x561a('0x2'))();var rs=require(_0x561a('0x3'));var moment=require(_0x561a('0x4'));var Mustache=require(_0x561a('0x5'));var rp=require('request-promise');var logger=require(_0x561a('0x6'))(_0x561a('0x7'));var config=require('../../config/environment');var scripts=require(_0x561a('0x8'));var FILES_PATH=_0x561a('0x9');var recursiveMapAttributes=[_0x561a('0xa'),_0x561a('0xb')];var verticesWithRetry=[_0x561a('0xc'),_0x561a('0xd'),_0x561a('0xe')];var AGIVertices=function(_0x4db87f,_0x3db11c,_0x52563e){this[_0x561a('0xf')]=_0x4db87f;this[_0x561a('0x10')]=_0x3db11c;this['mailRpc']=_0x52563e;};AGIVertices[_0x561a('0x11')][_0x561a('0x12')]=function(_0x522f52,_0x3a1eee){this['rpc'][_0x561a('0x13')](_0x522f52)[_0x561a('0x14')](function(_0x28a652){_0x3a1eee(null,_0x28a652?_0x28a652[_0x561a('0x15')]:![]);})[_0x561a('0x16')](function(_0x3dfa9f){_0x3a1eee(_0x3dfa9f);});};AGIVertices[_0x561a('0x11')][_0x561a('0x17')]=function(_0x8c1952,_0x4f1e33){this[_0x561a('0x10')][_0x561a('0x18')](_0x8c1952)['then'](function(_0x4037a9){_0x4f1e33(null,_0x4037a9?_0x4037a9[_0x561a('0x15')]:![]);})[_0x561a('0x16')](function(_0xecbcc4){_0x4f1e33(_0xecbcc4);});};AGIVertices[_0x561a('0x11')][_0x561a('0x19')]=function(_0x3d91be,_0x14f141){this[_0x561a('0x10')][_0x561a('0x1a')](_0x3d91be)[_0x561a('0x14')](function(_0x48df6a){_0x14f141(null,_0x48df6a?_0x48df6a[_0x561a('0x15')]:![]);})[_0x561a('0x16')](function(_0x533d95){_0x14f141(_0x533d95);});};AGIVertices[_0x561a('0x11')][_0x561a('0x1b')]=function(_0x4d9f1b,_0x22c72a){this['rpc']['getSquareOdbcById'](_0x4d9f1b)[_0x561a('0x14')](function(_0xb023e6){_0x22c72a(null,_0xb023e6?_0xb023e6['dsn']:![]);})[_0x561a('0x16')](function(_0x88b2b5){_0x22c72a(_0x88b2b5);});};AGIVertices[_0x561a('0x11')][_0x561a('0x1c')]=function(_0x345941,_0x1bb8df){this['rpc'][_0x561a('0x1d')](_0x345941)[_0x561a('0x14')](function(_0x46ede7){_0x1bb8df(null,_0x46ede7?_0x46ede7['name']:![]);})['catch'](function(_0x25b53c){_0x1bb8df(_0x25b53c);});};AGIVertices[_0x561a('0x11')][_0x561a('0x1e')]=function(_0x1bbb57,_0x234771){this[_0x561a('0x10')][_0x561a('0x1f')](_0x1bbb57)[_0x561a('0x14')](function(_0x5bf2fa){_0x234771(null,_0x5bf2fa?_0x5bf2fa['name']:![]);})[_0x561a('0x16')](function(_0x2765c5){_0x234771(_0x2765c5);});};AGIVertices[_0x561a('0x11')][_0x561a('0x20')]=function(_0x5a0acd,_0x186862){var _0x3f0789=this;this[_0x561a('0x10')][_0x561a('0x21')](_0x5a0acd)[_0x561a('0x14')](function(_0x47f93a){_0x186862(null,_0x47f93a?_0x3f0789[_0x561a('0x22')](_0x47f93a[_0x561a('0x23')]):![]);})['catch'](function(_0x401636){_0x186862(_0x401636);});};AGIVertices[_0x561a('0x11')]['getMailAccount']=function(_0x2a147d,_0x591737){this['rpc'][_0x561a('0x24')](_0x2a147d)[_0x561a('0x14')](function(_0x4e0042){_0x591737(null,_0x4e0042?_0x4e0042:![]);})[_0x561a('0x16')](function(_0x1bc44c){_0x591737(_0x1bc44c);});};AGIVertices[_0x561a('0x11')][_0x561a('0x25')]=function(_0x169243,_0xbb2ae8,_0x33b2fc){this[_0x561a('0x26')]['sendMailMessage'](_0x169243,_0xbb2ae8)[_0x561a('0x14')](function(){_0x33b2fc(null);})[_0x561a('0x16')](function(_0x2ab150){_0x33b2fc(_0x2ab150);});};AGIVertices[_0x561a('0x11')][_0x561a('0x27')]=function(_0x4ab97f,_0xf96a9f){this[_0x561a('0x10')][_0x561a('0x28')](_0x4ab97f)[_0x561a('0x14')](function(_0x57809f){if(_0x57809f){if(_0x57809f[_0x561a('0x29')]){_0xf96a9f(null,[_0x57809f[_0x561a('0x2a')]]);}else{_0xf96a9f(null,_[_0x561a('0x2b')](_0x57809f['Intervals'],'interval'));}}else{_0xf96a9f(null,![]);}})[_0x561a('0x16')](function(_0x47a277){_0xf96a9f(_0x47a277);});};AGIVertices['prototype']['getSoundPath']=function(_0x46445a){return util[_0x561a('0x2c')](_0x561a('0x2d'),FILES_PATH,_0x46445a);};AGIVertices[_0x561a('0x11')][_0x561a('0x2e')]=function(_0x1e6417,_0x520f8b,_0x588a39){odbc[_0x561a('0x2f')](_0x1e6417,function(_0x1e7c4f){if(_0x1e7c4f){logger[_0x561a('0x30')](_0x561a('0x31'),_0x1e7c4f);_0x588a39(_0x1e7c4f);}else{logger[_0x561a('0x32')](_0x561a('0x33'));odbc[_0x561a('0x34')](_0x520f8b,function(_0x132237,_0x5865c7){if(_0x132237){logger[_0x561a('0x32')](_0x561a('0x35'),_0x520f8b);_0x588a39(_0x132237);}else{logger[_0x561a('0x32')](_0x561a('0x36'),_0x520f8b);odbc['close'](function(_0xbd11c4){if(_0xbd11c4){logger[_0x561a('0x30')](_0x561a('0x37'),_0xbd11c4);}_0x588a39(null,_0x5865c7);});}});}});};AGIVertices['prototype'][_0x561a('0x38')]=function(_0x3ae2db,_0x289c68){this[_0x561a('0x10')][_0x561a('0x39')](_0x3ae2db)[_0x561a('0x14')](function(_0x214846){_0x289c68(null,_0x214846?_0x214846:![]);})['catch'](function(_0x1253d9){_0x289c68(_0x1253d9);});};AGIVertices[_0x561a('0x11')][_0x561a('0x3a')]=function(_0x7c0a97,_0x75c0cf){this[_0x561a('0x10')]['createSmsMessage'](_0x7c0a97)[_0x561a('0x14')](function(_0xd991f8){_0x75c0cf(null,_0xd991f8);})[_0x561a('0x16')](function(_0x356599){_0x75c0cf(_0x356599);});};AGIVertices[_0x561a('0x11')][_0x561a('0x3b')]=function(_0x293e11,_0x32f8bd,_0x2e32b3){this['rpc'][_0x561a('0x3b')]({'uniqueid':this[_0x561a('0xf')]['uniqueid'],'node':_0x293e11[_0x561a('0x3c')],'application':_0x293e11['agicommand'],'data':_0x32f8bd||null,'project_name':this[_0x561a('0xf')][_0x561a('0x3d')],'callerid':this[_0x561a('0xf')][_0x561a('0x3e')]})[_0x561a('0x14')](function(_0x52ab73){if(_0x2e32b3){_0x2e32b3(null,_0x52ab73);}})[_0x561a('0x16')](function(_0x12e7c6){if(_0x2e32b3){_0x2e32b3(_0x12e7c6);}});};AGIVertices[_0x561a('0x11')][_0x561a('0x3f')]=function(_0x33cc,_0x13c6c6,_0x5ec6ac,_0x500629){this[_0x561a('0x10')]['createSquareRecording']({'uniqueid':this['channel']['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this[_0x561a('0xf')][_0x561a('0x40')],'context':this[_0x561a('0xf')]['context'],'extension':this[_0x561a('0xf')]['extension'],'priority':this['channel'][_0x561a('0x41')],'accountcode':this[_0x561a('0xf')][_0x561a('0x42')],'dnid':this['channel'][_0x561a('0x43')],'projectName':this['channel'][_0x561a('0x3d')],'saveName':_0x13c6c6,'filename':_0x33cc['file']||_0x13c6c6,'savePath':_0x5ec6ac})[_0x561a('0x14')](function(_0x43d557){_0x500629(null,_0x43d557);})[_0x561a('0x16')](function(_0x14d82b){_0x500629(_0x14d82b);});};AGIVertices[_0x561a('0x11')][_0x561a('0x44')]=function(_0x355d4f,_0x25aaf6,_0x8f048d,_0x5124a7,_0x1cb7e4){this[_0x561a('0x10')][_0x561a('0x44')]({'uniqueid':this['channel'][_0x561a('0x45')],'body':_0x355d4f,'direction':_0x25aaf6,'providerName':_0x8f048d,'providerResponse':_0x5124a7})[_0x561a('0x14')](function(_0x597ccf){if(_0x1cb7e4){_0x1cb7e4(null,_0x597ccf);}})[_0x561a('0x16')](function(_0x99dc7f){if(_0x1cb7e4){_0x1cb7e4(_0x99dc7f);}});};AGIVertices[_0x561a('0x11')]['createCmContact']=function(_0x1161e3,_0x2a050c){this[_0x561a('0x10')][_0x561a('0x46')]({'firstName':_[_0x561a('0x47')](_0x1161e3[_0x561a('0x15')])||_[_0x561a('0x48')](_0x1161e3['name'])?_0x561a('0x49')+Math[_0x561a('0x4a')]():_0x1161e3[_0x561a('0x15')],'lastName':_[_0x561a('0x47')](_0x1161e3[_0x561a('0x4b')])||_[_0x561a('0x48')](_0x1161e3[_0x561a('0x4b')])?null:_0x1161e3['lastName'],'phone':_0x1161e3[_0x561a('0x4c')],'ListId':_0x1161e3[_0x561a('0x4d')],'scheduledat':_0x1161e3[_0x561a('0x4e')],'callbackUniqueid':this['channel'][_0x561a('0x45')],'tags':'callback','description':_0x561a('0x4f')+_0x1161e3[_0x561a('0x4e')][_0x561a('0x50')](),'priority':_0x1161e3[_0x561a('0x51')]})[_0x561a('0x14')](function(_0x27b10c){_0x2a050c(null,_0x27b10c);})[_0x561a('0x16')](function(_0x4cad70){_0x2a050c(_0x4cad70);});};AGIVertices['prototype'][_0x561a('0x52')]=function(_0x2f274b,_0x370205){this[_0x561a('0x10')][_0x561a('0x53')](_0x2f274b)[_0x561a('0x14')](function(_0x4d13c8){_0x370205(null,_0x4d13c8?_0x4d13c8[_0x561a('0x15')]:![]);})[_0x561a('0x16')](function(_0x4ad9ee){_0x370205(_0x4ad9ee);});};AGIVertices[_0x561a('0x11')]['agentPause']=function(_0x5194d5,_0xc7447e,_0x16daeb){var _0x36dd1a={'role':_0x561a('0x54')};_0x36dd1a[_0x5194d5]=this['channel'][_0x561a('0x3e')];this['rpc'][_0x561a('0x55')](_0x36dd1a,_0xc7447e,this[_0x561a('0xf')][_0x561a('0x45')])['then'](function(_0x4ec13c){_0x16daeb(null,_['isNil'](_0x4ec13c)?![]:!![]);})['catch'](function(_0x5f28d7){logger[_0x561a('0x30')](_0x5f28d7);_0x16daeb(null,![]);});};AGIVertices['prototype'][_0x561a('0x56')]=function(_0xe76184,_0x209f07){var _0x4ae9a4={'role':_0x561a('0x54')};_0x4ae9a4[_0xe76184]=this[_0x561a('0xf')][_0x561a('0x3e')];this[_0x561a('0x10')][_0x561a('0x56')](_0x4ae9a4)[_0x561a('0x14')](function(_0x2ef4cf){_0x209f07(null,_[_0x561a('0x48')](_0x2ef4cf)?![]:!![]);})[_0x561a('0x16')](function(_0x1764a4){logger[_0x561a('0x30')](_0x1764a4);_0x209f07(null,![]);});};AGIVertices['prototype'][_0x561a('0x57')]=function(_0x4a904c,_0x540c46){var _0x54056b={'role':_0x561a('0x54')};_0x54056b[_0x4a904c]=this[_0x561a('0xf')]['callerid'];this[_0x561a('0x10')][_0x561a('0x57')](_0x54056b)[_0x561a('0x14')](function(_0x27e18a){_0x540c46(null,_[_0x561a('0x48')](_0x27e18a)?![]:!![]);})[_0x561a('0x16')](function(_0x51219f){logger['error'](_0x51219f);_0x540c46(null,![]);});};AGIVertices[_0x561a('0x11')][_0x561a('0x58')]=function(_0x3c8b20,_0xc9c23){var _0xbad527={'role':_0x561a('0x54')};_0xbad527[_0x3c8b20]=this['channel']['callerid'];var _0x53a93a=_0x3c8b20!=_0x561a('0x59')?util[_0x561a('0x2c')](_0x561a('0x5a'),'LOCAL',this['channel']['callerid']):undefined;this['rpc'][_0x561a('0x58')](_0xbad527,_0x53a93a)[_0x561a('0x14')](function(_0x5de26e){_0xc9c23(null,_[_0x561a('0x48')](_0x5de26e)?![]:!![]);})['catch'](function(_0x538bc9){logger[_0x561a('0x30')](_0x538bc9);_0xc9c23(null,![]);});};AGIVertices[_0x561a('0x11')]['shellCommand']=function(_0x40bc90,_0x5eb0d9){sh[_0x561a('0x5b')](_[_0x561a('0x5c')](_0x40bc90),function(_0x3b2031,_0x7d85ff){var _0x1cac4b=_0x7d85ff[_0x561a('0x5d')](/(\r\n|\n|\r)/gm,'');_0x5eb0d9(null,_0x1cac4b);});};AGIVertices[_0x561a('0x11')]['googleCloudTTS']=function(_0x4ef174,_0x41a1a7){scripts[_0x561a('0x5e')](_0x4ef174['apiKey'],_0x4ef174[_0x561a('0x5f')]||_0x561a('0x60'),_0x4ef174['text'],_0x4ef174[_0x561a('0x61')]||_0x561a('0x62'),_0x4ef174[_0x561a('0x63')]||'MALE',_0x4ef174[_0x561a('0x64')]||_0x561a('0x65'))['then'](function(_0xbb20c8){_0x41a1a7(null,_0xbb20c8);})['catch'](function(_0x5f0900){_0x41a1a7(_0x5f0900);});};AGIVertices[_0x561a('0x11')][_0x561a('0x66')]=function(_0x511793,_0x1fbf13){scripts['googleTTS'](_0x511793[_0x561a('0x60')],_0x511793['google_tts_language']||'en',0x1)[_0x561a('0x14')](function(_0x43daec){_0x1fbf13(null,_0x43daec);})[_0x561a('0x16')](function(_0x1c5905){_0x1fbf13(_0x1c5905);});};AGIVertices[_0x561a('0x11')][_0x561a('0x67')]=function(_0x4dcb3a,_0x528846){var _0x43dd9b={'uri':_0x4dcb3a[_0x561a('0x68')],'method':_0x4dcb3a['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4dcb3a[_0x561a('0x69')])===_0x561a('0x6a')&&parseInt(_0x4dcb3a[_0x561a('0x69')])>=0x1?parseInt(_0x4dcb3a[_0x561a('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x561a('0x6b')]([_0x561a('0x6c'),_0x561a('0x6d')],_0x43dd9b[_0x561a('0x6e')][_0x561a('0x6f')]())){try{_0x43dd9b[_0x561a('0x70')]=_0x4dcb3a[_0x561a('0xb')]?JSON[_0x561a('0x71')](_0x4dcb3a[_0x561a('0xb')]):{};}catch(_0x509680){logger[_0x561a('0x30')](_0x561a('0x72'),_0x509680);}}try{_0x43dd9b[_0x561a('0x73')]=_0x4dcb3a['rawHeaders']?JSON[_0x561a('0x71')](_0x4dcb3a[_0x561a('0xa')]):{};}catch(_0x3ca837){logger[_0x561a('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ca837);}if(_0x4dcb3a[_0x561a('0x74')]){try{var _0x204a83=require(_0x4dcb3a[_0x561a('0x74')])[_0x561a('0x75')](this,_0x43dd9b);_0x43dd9b[_0x561a('0x76')]=Mustache[_0x561a('0x77')](_0x4dcb3a[_0x561a('0x68')],_0x204a83,{},['$$','$$']);if(_0x43dd9b['headers']){_0x43dd9b['headers']=JSON[_0x561a('0x71')](Mustache[_0x561a('0x77')](JSON['stringify'](_0x43dd9b['headers']),_0x204a83,{},['$$','$$']));}if(_0x43dd9b['body']){_0x43dd9b[_0x561a('0x70')]=JSON[_0x561a('0x71')](Mustache[_0x561a('0x77')](JSON['stringify'](_0x43dd9b['body']),_0x204a83,{},['$$','$$']));}}catch(_0x4ec14a){logger[_0x561a('0x30')](_0x561a('0x78'),_0x4ec14a);}}rp(_0x43dd9b)[_0x561a('0x14')](function(_0x1b5e89){var _0x4b53dc={'statusCode':_0x1b5e89[_0x561a('0x79')]||0xc8,'statusMessage':_0x1b5e89[_0x561a('0x7a')]||'OK','headers':_0x1b5e89[_0x561a('0x73')]||{},'body':_0x1b5e89[_0x561a('0x70')]||{}};_0x528846(null,_0x4b53dc);})[_0x561a('0x16')](function(_0x562c71){var _0x59a5d0={'statusCode':_0x562c71[_0x561a('0x79')]||0x1f4,'statusMessage':_0x562c71[_0x561a('0x7b')]||_0x561a('0x7c'),'headers':_0x562c71[_0x561a('0x7d')][_0x561a('0x73')]||{},'body':_0x562c71[_0x561a('0x7d')]['body']||{}};_0x528846(null,_0x59a5d0);});};AGIVertices[_0x561a('0x11')][_0x561a('0x7e')]=function(_0x168fe8,_0x443a4a){scripts[_0x561a('0x7e')](this['channel'][_0x561a('0x45')],_0x168fe8[_0x561a('0x7f')],_0x168fe8[_0x561a('0x60')],_0x168fe8[_0x561a('0x80')]||'en')[_0x561a('0x14')](function(_0x156f6c){_0x443a4a(null,_0x156f6c);})[_0x561a('0x16')](function(_0x2dadf8){_0x443a4a(_0x2dadf8);});};AGIVertices[_0x561a('0x11')]['googleDialogflowV2']=function(_0x379e9e,_0x2d3cb3){scripts[_0x561a('0x81')](this[_0x561a('0xf')][_0x561a('0x45')],_0x379e9e[_0x561a('0x82')],_0x379e9e[_0x561a('0x83')],_0x379e9e['private_key'],_0x379e9e[_0x561a('0x60')],_0x379e9e[_0x561a('0x84')]||'en')['then'](function(_0x1eb6aa){_0x2d3cb3(null,_0x1eb6aa);})[_0x561a('0x16')](function(_0x2b22dd){_0x2d3cb3(_0x2b22dd);});};AGIVertices[_0x561a('0x11')]['sestekNDA']=function(_0x4493e9,_0x19d817){scripts[_0x561a('0x85')](this[_0x561a('0xf')],_0x4493e9)[_0x561a('0x14')](function(_0x1c6514){_0x19d817(null,_0x1c6514);})[_0x561a('0x16')](function(_0x3bbc5b){_0x19d817(_0x3bbc5b);});};AGIVertices['prototype']['ispeechTTS']=function(_0x147762,_0x4a3c8a){scripts[_0x561a('0x86')](_0x147762[_0x561a('0x7f')],_0x147762[_0x561a('0x60')],_0x147762['ispeech_tts_language']||_0x561a('0x62'),_0x147762[_0x561a('0x87')])[_0x561a('0x14')](function(_0x1d2cfd){_0x4a3c8a(null,_0x1d2cfd);})['catch'](function(_0x44328d){_0x4a3c8a(_0x44328d);});};AGIVertices[_0x561a('0x11')]['ispeechASR']=function(_0x515820,_0x54c6cc,_0x56d02e){scripts[_0x561a('0x88')](_0x54c6cc,_0x515820[_0x561a('0x7f')],_0x515820['ispeech_asr_language']||_0x561a('0x62'),this[_0x561a('0x89')](_0x515820[_0x561a('0x8a')])?_0x515820[_0x561a('0x8a')]:undefined)[_0x561a('0x14')](function(_0x40a372){_0x56d02e(null,_0x40a372);})[_0x561a('0x16')](function(_0x603e94){_0x56d02e(_0x603e94);});};AGIVertices[_0x561a('0x11')]['awsPolly']=function(_0xa02f30,_0x643bdd){scripts['awsPolly'](_0xa02f30[_0x561a('0x8b')],_0xa02f30[_0x561a('0x8c')],_0xa02f30[_0x561a('0x8d')],_0xa02f30[_0x561a('0x8e')]||_0x561a('0x8f'),_0xa02f30['text'],_0xa02f30[_0x561a('0x90')]||_0x561a('0x60'))[_0x561a('0x14')](function(_0x218f31){_0x643bdd(null,_0x218f31);})[_0x561a('0x16')](function(_0x2be528){_0x643bdd(_0x2be528);});};AGIVertices[_0x561a('0x11')]['awsLex']=function(_0x299d9c,_0x1f96cb){scripts[_0x561a('0x91')](this['channel']['uniqueid'],_0x299d9c[_0x561a('0x8b')],_0x299d9c['aws_secret_access_key'],_0x299d9c[_0x561a('0x92')],_0x299d9c[_0x561a('0x60')],_0x299d9c[_0x561a('0x93')])[_0x561a('0x14')](function(_0x566492){_0x1f96cb(null,_0x566492);})[_0x561a('0x16')](function(_0x41439e){_0x1f96cb(_0x41439e);});};AGIVertices[_0x561a('0x11')][_0x561a('0x94')]=function(_0x33653b,_0x110001,_0x579437){scripts[_0x561a('0x94')](_0x110001,_0x33653b[_0x561a('0x7f')],_0x33653b[_0x561a('0x95')]||'en-US')[_0x561a('0x14')](function(_0x412753){_0x579437(null,_0x412753);})[_0x561a('0x16')](function(_0x454ce0){_0x579437(_0x454ce0);});};AGIVertices[_0x561a('0x11')][_0x561a('0x96')]=function(_0x1d1adb,_0x1939cc,_0x5978e1){scripts['tildeASR'](_0x1939cc,_0x1d1adb[_0x561a('0x97')],_0x1d1adb[_0x561a('0x98')],_0x1d1adb[_0x561a('0x76')])[_0x561a('0x14')](function(_0x34fb60){_0x5978e1(null,_0x34fb60);})[_0x561a('0x16')](function(_0x280a26){_0x5978e1(_0x280a26);});};AGIVertices[_0x561a('0x11')][_0x561a('0x99')]=function(_0xf3351c){var _0x5517c0=_[_0x561a('0x6b')](verticesWithRetry,_0xf3351c[_0x561a('0x9a')])?_0xf3351c:_[_0x561a('0x9b')](_0xf3351c);for(var _0x437754 in _0x5517c0){if(_0x5517c0[_0x561a('0x9c')](_0x437754)){if(_0x5517c0[_0x437754]&&_['isString'](_0x5517c0[_0x437754])){if(_[_0x561a('0x6b')](recursiveMapAttributes,_0x437754)){_0x5517c0[_0x437754]=this[_0x561a('0x9d')](_0x5517c0[_0x437754]);}else{_0x5517c0[_0x437754]=this[_0x561a('0x9e')](_0x5517c0[_0x437754]);}}}}return _0x5517c0;};AGIVertices[_0x561a('0x11')]['recursiveNodeIndex']=function(_0x1f807d){for(var _0x4c1a68 in _0x1f807d){if(_0x1f807d['hasOwnProperty'](_0x4c1a68)){if(_['isPlainObject'](_0x1f807d[_0x4c1a68])){this[_0x561a('0x9f')](_0x1f807d[_0x4c1a68]);}else if(_[_0x561a('0xa0')](_0x1f807d[_0x4c1a68])){for(var _0x1a8e29=0x0;_0x1a8e29<_0x1f807d[_0x4c1a68][_0x561a('0xa1')];_0x1a8e29++){this[_0x561a('0x9f')](_0x1f807d[_0x4c1a68][_0x1a8e29]);}}else if(_[_0x561a('0xa2')](_0x1f807d[_0x4c1a68])){_0x1f807d[_0x4c1a68]=this[_0x561a('0x9e')](_0x1f807d[_0x4c1a68]);}}}};AGIVertices[_0x561a('0x11')][_0x561a('0xa3')]=function(_0x1fa4f0,_0x3b94ba){for(var _0x466d8a in _0x1fa4f0){if(_0x1fa4f0[_0x561a('0x9c')](_0x466d8a)){if(_[_0x561a('0xa4')](_0x1fa4f0[_0x466d8a])){if(!_[_0x561a('0x47')](_0x1fa4f0[_0x466d8a])){this[_0x561a('0xa3')](_0x1fa4f0[_0x466d8a],util[_0x561a('0x2c')](_0x561a('0xa5'),_0x3b94ba,_0x466d8a));}}else if(_[_0x561a('0xa0')](_0x1fa4f0[_0x466d8a])){for(var _0x33a52f=0x0;_0x33a52f<_0x1fa4f0[_0x466d8a][_0x561a('0xa1')];_0x33a52f++){this[_0x561a('0xa3')](_0x1fa4f0[_0x466d8a][_0x33a52f],util[_0x561a('0x2c')](_0x561a('0xa5'),_0x3b94ba,_0x466d8a+'['+_0x33a52f+']'));}}else{if(!_[_0x561a('0x48')](_0x1fa4f0[_0x466d8a])){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0xa5'),_0x3b94ba,_0x466d8a),_0x1fa4f0[_0x466d8a]);}}}}};AGIVertices['prototype'][_0x561a('0x9d')]=function(_0xc23457){try{var _0x5079a8=JSON[_0x561a('0x71')](_0xc23457);this[_0x561a('0x9f')](_0x5079a8);return JSON[_0x561a('0xa7')](_0x5079a8);}catch(_0x1712c4){return this[_0x561a('0x9e')](_0xc23457);}};AGIVertices[_0x561a('0x11')]['replaceAllVariables']=function(_0x41bc18){var _0x20fc12=_0x41bc18[_0x561a('0xa8')]('{');for(var _0x4dda7a=0x1;_0x4dda7a<_0x20fc12[_0x561a('0xa1')];_0x4dda7a+=0x1){var _0x3012e7=_0x20fc12[_0x4dda7a][_0x561a('0xa8')]('}');if(_0x3012e7[_0x561a('0xa1')]>0x1){_0x41bc18=_0x41bc18[_0x561a('0xa9')]('{'+_0x3012e7[0x0]+'}',this[_0x561a('0xf')][_0x561a('0x12')](_0x3012e7[0x0])[_0x561a('0xaa')]||_0x3012e7[0x0]);}}if(_0x20fc12[_0x561a('0xa1')]===0x1){return _0x41bc18[_0x561a('0x50')]();}return this[_0x561a('0x9e')](_0x41bc18);};AGIVertices[_0x561a('0x11')][_0x561a('0xab')]=function(_0x1498b1,_0xe1b486){var _0x469c6e=this[_0x561a('0xf')][_0x561a('0x12')](_0x1498b1);if(_0x469c6e[_0x561a('0xac')]===-0x1){return _0x469c6e;}logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xad'),_0xe1b486,_0x469c6e[_0x561a('0xaa')]));return this['channel'][_0x561a('0xa6')](_0xe1b486,_0x469c6e[_0x561a('0xaa')]);};AGIVertices[_0x561a('0x11')][_0x561a('0x89')]=function(_0x3300ec){return _0x3300ec&&_0x3300ec!=='0'&&_0x3300ec!=='-1'&&_0x3300ec!=='';};AGIVertices['prototype'][_0x561a('0xae')]=function(_0x3d2c16){this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x3d2c16,'-');_0x3d2c16['retry']=_0x3d2c16['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x561a('0x11')][_0x561a('0xaf')]=function(_0x899c29){logger['info'](util[_0x561a('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x899c29['label']));if(!this['isConfigured'](_0x899c29[_0x561a('0x60')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x525fe1='\x22'+_0x899c29[_0x561a('0x60')]+'\x22';if(this[_0x561a('0x89')](_0x899c29[_0x561a('0x7d')])){_0x525fe1+=','+_0x899c29[_0x561a('0x7d')];}var _0x343562=this[_0x561a('0xf')][_0x561a('0x5b')]('MRCPSynth',_0x525fe1);if(_0x343562[_0x561a('0xac')]===-0x1){return _0x343562;}return this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xb1'),_0x525fe1));};AGIVertices[_0x561a('0x11')][_0x561a('0xb2')]=function(_0x53f83b){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x53f83b[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x53f83b['grammar'])){return this['channel']['noop'](_0x561a('0xb3'));}var _0xb902c2=_0x53f83b['grammar'];if(this[_0x561a('0x89')](_0x53f83b[_0x561a('0x7d')])){_0xb902c2+=','+_0x53f83b[_0x561a('0x7d')];}var _0x3f32fa=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0xb4'),_0xb902c2);if(_0x3f32fa[_0x561a('0xac')]===-0x1){return _0x3f32fa;}var _0x6be5bd=this[_0x561a('0xab')](_0x561a('0xb5'),_0x561a('0xb6'));if(_0x6be5bd[_0x561a('0xac')]===-0x1){return _0x6be5bd;}var _0x3816c0=this[_0x561a('0xab')](_0x561a('0xb7'),_0x561a('0xb8'));if(_0x3816c0[_0x561a('0xac')]===-0x1){return _0x3816c0;}var _0x23fd43=this['getAndSetVariable'](_0x561a('0xb9'),'MRCP_RECOG_INSTANCE');if(_0x23fd43[_0x561a('0xac')]===-0x1){return _0x23fd43;}return this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0xb902c2));};AGIVertices[_0x561a('0x11')][_0x561a('0x7')]=function(_0x46b7df){logger['info'](util[_0x561a('0x2c')](_0x561a('0xba'),_0x46b7df[_0x561a('0x3c')]));return this[_0x561a('0xf')]['agi']([_0x46b7df['command'],_0x46b7df['args']]);};AGIVertices[_0x561a('0x11')][_0x561a('0xbb')]=function(_0x3e12eb){logger['info'](util['format'](_0x561a('0xbc'),_0x3e12eb[_0x561a('0x3c')]));if(this[_0x561a('0x89')](_0x3e12eb[_0x561a('0x69')])){logger['info'](util[_0x561a('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3e12eb[_0x561a('0x69')]));var _0x26a537=this[_0x561a('0xf')][_0x561a('0xbd')](_0x3e12eb[_0x561a('0x69')]);if(_0x26a537[_0x561a('0xac')]===-0x1){return _0x26a537;}}return this[_0x561a('0xf')]['answer']();};AGIVertices['prototype'][_0x561a('0xbe')]=function(_0x3ad2f3){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3ad2f3[_0x561a('0x3c')]));if(!this['isConfigured'](_0x3ad2f3[_0x561a('0x4d')])){return this[_0x561a('0xf')]['error'](_0x3ad2f3,_0x561a('0xbf'));}_0x3ad2f3[_0x561a('0x4e')]=moment();if(this['isConfigured'](_0x3ad2f3[_0x561a('0xc0')])){_0x3ad2f3['scheduledAt']=moment()[_0x561a('0xc1')](_0x3ad2f3[_0x561a('0xc0')],_0x561a('0xc2'));}if(!this['isConfigured'](_0x3ad2f3['callback_priority'])){_0x3ad2f3['callback_priority']=0x2;}this['createCmContact'][_0x561a('0x75')](this,_0x3ad2f3);return this['channel']['noop'](util[_0x561a('0x2c')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3ad2f3[_0x561a('0x4c')],_0x3ad2f3['list_id'],_0x3ad2f3[_0x561a('0x4e')]));};AGIVertices[_0x561a('0x11')][_0x561a('0xc3')]=function(_0x244621){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xc4'),_0x244621[_0x561a('0x3c')]));var _0xaf717f=this[_0x561a('0xf')][_0x561a('0x5b')](_0x244621['application'],_0x244621[_0x561a('0x7d')]);if(_0xaf717f[_0x561a('0xac')]===-0x1){return _0xaf717f;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xc5'),_0x244621[_0x561a('0xc6')],_0x244621[_0x561a('0x7d')]));};AGIVertices[_0x561a('0x11')][_0x561a('0xc7')]=function(_0x281531){logger[_0x561a('0x32')](util['format'](_0x561a('0xc8'),_0x281531['label']));if(!this[_0x561a('0x89')](_0x281531[_0x561a('0x60')])){return this[_0x561a('0xf')]['noop'](_0x561a('0xc9'));}var _0x36383a='\x22'+_0x281531['text']+'\x22';if(this['isConfigured'](_0x281531[_0x561a('0x7d')])){_0x36383a+=','+_0x281531[_0x561a('0x7d')];}var _0x1944a1=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0xca'),_0x36383a);if(_0x1944a1[_0x561a('0xac')]===-0x1){return _0x1944a1;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xb1'),_0x36383a));};AGIVertices[_0x561a('0x11')][_0x561a('0xcb')]=function(_0x96cdc3){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xcc'),_0x96cdc3[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x96cdc3[_0x561a('0x60')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20text\x20configured');}var _0x478001='\x22'+_0x96cdc3[_0x561a('0x60')]+'\x22';if(this[_0x561a('0x89')](_0x96cdc3[_0x561a('0x7d')])){_0x478001+=','+_0x96cdc3[_0x561a('0x7d')];}var _0x145c0c=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0xca'),_0x478001);if(_0x145c0c[_0x561a('0xac')]===-0x1){return _0x145c0c;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x478001));};AGIVertices[_0x561a('0x11')][_0x561a('0xcd')]=function(_0x5dde47){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xce'),_0x5dde47[_0x561a('0x3c')]));if(!this['isConfigured'](_0x5dde47[_0x561a('0xcf')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xb3'));}var _0xc6c8f4=_0x5dde47[_0x561a('0xcf')];if(this[_0x561a('0x89')](_0x5dde47[_0x561a('0x7d')])){_0xc6c8f4+=','+_0x5dde47[_0x561a('0x7d')];}var _0x547928=this[_0x561a('0xf')]['exec'](_0x561a('0xb4'),_0xc6c8f4);if(_0x547928[_0x561a('0xac')]===-0x1){return _0x547928;}var _0x37d954=this[_0x561a('0xab')](_0x561a('0xb5'),_0x561a('0xd0'));if(_0x37d954['result']===-0x1){return _0x37d954;}var _0x48744e=this[_0x561a('0xab')](_0x561a('0xb7'),_0x561a('0xd1'));if(_0x48744e[_0x561a('0xac')]===-0x1){return _0x48744e;}var _0x543827=this[_0x561a('0xab')](_0x561a('0xb9'),'LUMENVOX_ASR_INSTANCE');if(_0x543827[_0x561a('0xac')]===-0x1){return _0x543827;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0xc6c8f4));};AGIVertices['prototype'][_0x561a('0xd2')]=function(_0x14f074){logger[_0x561a('0x32')](util['format'](_0x561a('0xd3'),_0x14f074[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x14f074['grammar'])){return this['channel'][_0x561a('0xb0')]('no\x20grammar\x20configured');}var _0x4198a3=_0x14f074['grammar'];if(this['isConfigured'](_0x14f074[_0x561a('0x7d')])){_0x4198a3+=','+_0x14f074[_0x561a('0x7d')];}var _0x1a2b9a=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0xb4'),_0x4198a3);if(_0x1a2b9a[_0x561a('0xac')]===-0x1){return _0x1a2b9a;}var _0x4cebf9=this[_0x561a('0xab')]('RECOG_CONFIDENCE()',_0x561a('0xd4'));if(_0x4cebf9[_0x561a('0xac')]===-0x1){return _0x4cebf9;}var _0x3fee16=this[_0x561a('0xab')](_0x561a('0xb7'),'SESTEK_ASR_TRANSCRIPT');if(_0x3fee16[_0x561a('0xac')]===-0x1){return _0x3fee16;}var _0x41e9c5=this[_0x561a('0xab')](_0x561a('0xb9'),_0x561a('0xd5'));if(_0x41e9c5['result']===-0x1){return _0x41e9c5;}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0xd6'),_0x4198a3));};AGIVertices[_0x561a('0x11')]['database']=function(_0x157bf0){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x157bf0[_0x561a('0x3c')]));if(!this['isConfigured'](_0x157bf0['odbc_id'])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x157bf0,_0x561a('0xd7'));}var _0x20849f=this['getSquareOdbc'][_0x561a('0x75')](this,_0x157bf0[_0x561a('0xd8')]);if(!_0x20849f){return this[_0x561a('0xf')][_0x561a('0x30')](_0x157bf0,_0x561a('0xd9'));}if(!this[_0x561a('0x89')](_0x157bf0[_0x561a('0x34')])){return this[_0x561a('0xf')]['error'](_0x157bf0,_0x561a('0xda'));}var _0xbe1dbf=_0x157bf0['query'][_0x561a('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xdb'),_0xbe1dbf));var _0x38b7c8=this[_0x561a('0x2e')][_0x561a('0x75')](this,_0x20849f,_0xbe1dbf);this['createSquareDetailsReport'][_0x561a('0x75')](this,_0x157bf0,_0xbe1dbf);if(!this[_0x561a('0x89')](_0x157bf0['variable_id'])){return this[_0x561a('0xf')]['noop'](_0x561a('0xdc'));}var _0x3ca7db=this['getVariable'][_0x561a('0x75')](this,_0x157bf0[_0x561a('0xdd')]);if(!_0x3ca7db){return this[_0x561a('0xf')]['error'](_0x157bf0,_0x561a('0xde'));}var _0x5597c5=this;_0x38b7c8[_0x561a('0xdf')](function(_0x34a0ed,_0x2118ed){Object['keys'](_0x34a0ed)[_0x561a('0xdf')](function(_0x4b9dfc){_0x5597c5[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0xe0'),_0x3ca7db,_0x2118ed,_0x4b9dfc),_0x34a0ed[_0x4b9dfc]);});});this[_0x561a('0xf')]['setVariable'](util['format'](_0x561a('0xe1'),_0x3ca7db),_0x38b7c8[_0x561a('0xa1')]);return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xe2'),_0x3ca7db));};AGIVertices['prototype'][_0x561a('0xe3')]=function(_0x2cb029){logger[_0x561a('0xe4')](util[_0x561a('0x2c')](_0x561a('0xe5'),_0x2cb029[_0x561a('0x3c')]));if(!this['isConfigured'](_0x2cb029[_0x561a('0xe6')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2cb029,_0x561a('0xe7'));}var _0xbc155e=this['getUser'][_0x561a('0x75')](this,_0x2cb029[_0x561a('0xe6')]);if(!_0xbc155e){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2cb029,_0x561a('0xe8'));}var _0x2f2744=this[_0x561a('0xf')][_0x561a('0x5b')]('DIAL',[util[_0x561a('0x2c')](_0x561a('0xe9'),_0xbc155e),_0x2cb029[_0x561a('0x69')],_0x2cb029['opts'],_0x2cb029['url']]);if(_0x2f2744[_0x561a('0xac')]===-0x1){return _0x2f2744;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xea'),'DIAL'));};AGIVertices[_0x561a('0x11')][_0x561a('0xeb')]=function(_0x1aec46){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0xec'),_0x1aec46['label']));if(!this[_0x561a('0x89')](_0x1aec46[_0x561a('0x7f')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xed'));}if(!this[_0x561a('0x89')](_0x1aec46[_0x561a('0x60')])){return this['channel']['noop'](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xee')]=!![];this[_0x561a('0x3b')](_0x1aec46);this[_0x561a('0x44')](_0x1aec46[_0x561a('0x60')],'in','','');this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xef'),_0x1aec46[_0x561a('0x60')]));var _0x32b3fd=this[_0x561a('0x7e')][_0x561a('0x75')](this,_0x1aec46);if(_0x32b3fd){for(var _0x2e5079 in _0x32b3fd){if(_0x32b3fd['hasOwnProperty'](_0x2e5079)){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0xf0'),_0x2e5079[_0x561a('0x6f')]()),_0x32b3fd[_0x2e5079]);}}this[_0x561a('0x44')](_0x32b3fd[_0x561a('0xf1')],_0x561a('0xf2'),_0x561a('0xeb'),'');return this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0xf3'),_0x32b3fd['speech']));}return this[_0x561a('0xf')]['error'](_0x1aec46,_0x561a('0xf4'));};AGIVertices['prototype'][_0x561a('0xf5')]=function(_0xe4fa70){logger['info'](util[_0x561a('0x2c')](_0x561a('0xf6'),_0xe4fa70['label']));if(!this['isConfigured'](_0xe4fa70[_0x561a('0x82')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20project_id\x20configured');}if(!this[_0x561a('0x89')](_0xe4fa70[_0x561a('0x83')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xf7'));}if(!this[_0x561a('0x89')](_0xe4fa70['private_key'])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xf8'));}if(!this[_0x561a('0x89')](_0xe4fa70['dialogflowV2_language'])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20anguage\x20configured');}if(!this[_0x561a('0x89')](_0xe4fa70['text'])){return this['channel'][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xee')]=!![];this[_0x561a('0x3b')](_0xe4fa70);this[_0x561a('0x44')](_0xe4fa70[_0x561a('0x60')],'in','','');this['channel']['noop'](util[_0x561a('0x2c')](_0x561a('0xf9'),_0xe4fa70[_0x561a('0x60')]));var _0x54ef65=this[_0x561a('0x81')][_0x561a('0x75')](this,_0xe4fa70);if(_0x54ef65){for(var _0x2c569a in _0x54ef65){if(_0x54ef65[_0x561a('0x9c')](_0x2c569a)){if(_0x2c569a!==_0x561a('0xfa')){this[_0x561a('0xf')][_0x561a('0xa6')](util['format']('DIALOGFLOW_%s',_0x2c569a[_0x561a('0x6f')]()),_0x54ef65[_0x2c569a]);}}}this[_0x561a('0x44')](_0x54ef65['speech'],_0x561a('0xf2'),'dialogflowV2',_0x54ef65['providerResponse']);return this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0xfb'),_0x54ef65['speech']));}return this[_0x561a('0xf')][_0x561a('0x30')](_0xe4fa70,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x561a('0x11')][_0x561a('0xfc')]=function(_0x4b5d36){logger['info'](util[_0x561a('0x2c')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4b5d36[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x4b5d36[_0x561a('0xfd')])){return this['channel'][_0x561a('0xb0')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x561a('0x89')](_0x4b5d36['username'])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xfe'));}if(!this[_0x561a('0x89')](_0x4b5d36[_0x561a('0xff')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x100'));}if(!this['isConfigured'](_0x4b5d36[_0x561a('0x101')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xee')]=!![];this[_0x561a('0x3b')](_0x4b5d36);this[_0x561a('0x44')](_0x4b5d36['text'],'in','','');this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x102'),_0x4b5d36[_0x561a('0x60')]));var _0x228ba0=this[_0x561a('0x85')][_0x561a('0x75')](this,_0x4b5d36);if(_0x228ba0){for(var _0x401b5a in _0x228ba0){if(_0x228ba0['hasOwnProperty'](_0x401b5a)){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')]('SESTEK_NDA_%s',_0x401b5a['toUpperCase']()),_0x228ba0[_0x401b5a]);}}this[_0x561a('0x44')](_0x228ba0[_0x561a('0xf1')],_0x561a('0xf2'),_0x561a('0xfc'),'');if(_0x228ba0[_0x561a('0x103')]){this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x104'),_0x228ba0[_0x561a('0x103')]));var _0x4563b4=this[_0x561a('0xf')]['streamFile'](_0x228ba0[_0x561a('0x103')]);try{fs[_0x561a('0x105')](_0x228ba0[_0x561a('0x103')]+_0x561a('0x106'));}catch(_0x5b962a){logger[_0x561a('0x30')](_0x5b962a);}return _0x4563b4;}else{return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x107'),_0x228ba0[_0x561a('0xf1')]));}}return this[_0x561a('0xf')][_0x561a('0x30')](_0x4b5d36,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x561a('0x11')][_0x561a('0x108')]=function(_0x47bca0){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x109'),_0x47bca0['label']));return this[_0x561a('0xf')]['noop'](_0x561a('0x108'));};AGIVertices[_0x561a('0x11')][_0x561a('0x10a')]=function(_0x2c4dd6){logger['info'](util[_0x561a('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2c4dd6['label']));var _0x1e25af='';if(_0x2c4dd6['trunk_id']){if(!this[_0x561a('0x89')](_0x2c4dd6['trunk_id'])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2c4dd6,_0x561a('0x10b'));}else{var _0x5a3adc=parseInt(_0x2c4dd6[_0x561a('0x10c')],0xa);if(isNaN(_0x5a3adc)){_0x1e25af=_0x2c4dd6[_0x561a('0x10c')];}else{_0x1e25af=this[_0x561a('0x1e')][_0x561a('0x75')](this,_0x2c4dd6[_0x561a('0x10c')]);if(!_0x1e25af){return this['channel'][_0x561a('0x30')](_0x2c4dd6,_0x561a('0x10d'));}}}}else if(_0x2c4dd6[_0x561a('0x10e')]){_0x1e25af=_0x2c4dd6[_0x561a('0x10e')];}else{return this[_0x561a('0xf')][_0x561a('0x30')](_0x2c4dd6,'no\x20trunk\x20selected');}var _0x23f47b=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0x10f'),[util[_0x561a('0x2c')]('SIP/%s/%s',_0x1e25af,_0x2c4dd6['phone']),_0x2c4dd6[_0x561a('0x69')],_0x2c4dd6[_0x561a('0x110')],_0x2c4dd6[_0x561a('0x68')]]);if(_0x23f47b[_0x561a('0xac')]===-0x1){return _0x23f47b;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0xea'),_0x561a('0x10f')));};AGIVertices[_0x561a('0x11')][_0x561a('0x111')]=function(_0xa229e6){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x112'),_0xa229e6[_0x561a('0x3c')]));return this[_0x561a('0xf')]['noop'](_0x561a('0x111'));};AGIVertices[_0x561a('0x11')][_0x561a('0xd')]=function(_0x22eea7){logger[_0x561a('0x32')](util['format'](_0x561a('0x113'),_0x22eea7[_0x561a('0x3c')]));if(_0x22eea7[_0x561a('0x114')]===0x0){return this[_0x561a('0xae')](_0x22eea7);}_0x22eea7[_0x561a('0x114')]-=0x1;if(!this[_0x561a('0x89')](_0x22eea7[_0x561a('0x115')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x22eea7,'no\x20file\x20audio\x20selected');}var _0x338aa2=this[_0x561a('0x20')][_0x561a('0x75')](this,_0x22eea7[_0x561a('0x115')]);if(!_0x338aa2){return this['channel'][_0x561a('0x30')](_0x22eea7,_0x561a('0x116'));}if(!this[_0x561a('0x89')](_0x22eea7['variable_id'])){return this[_0x561a('0xf')]['error'](_0x561a('0xdc'));}var _0x4dde3e=this[_0x561a('0xf')][_0x561a('0x117')](_0x338aa2,_0x22eea7['response'],_0x22eea7['maxdigit']);var _0x173817=_0x4dde3e[_0x561a('0xac')]?_0x4dde3e[_0x561a('0xac')]['toString']():'';logger['info'](_0x561a('0x118'),JSON[_0x561a('0xa7')](_0x4dde3e));if(_0x4dde3e[_0x561a('0xac')]===-0x1){this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x22eea7,_0x173817);return _0x4dde3e;}else if(_0x4dde3e['extra']==='timeout'){_0x4dde3e['result']=_0x173817[_0x561a('0xa1')]>=parseInt(_0x22eea7[_0x561a('0x119')])?'x':'i';}else{_0x4dde3e[_0x561a('0xac')]=_0x173817[_0x561a('0xa1')]>=parseInt(_0x22eea7['mindigit'])&&_0x173817['length']<=parseInt(_0x22eea7[_0x561a('0x11a')])?'x':'i';}var _0x1c3ec6=this[_0x561a('0x12')][_0x561a('0x75')](this,_0x22eea7[_0x561a('0xdd')]);if(!_0x1c3ec6){return this[_0x561a('0xf')][_0x561a('0x30')](_0x22eea7,_0x561a('0xde'));}this[_0x561a('0xf')]['setVariable'](_0x1c3ec6,_0x173817);if(this['isConfigured'](_0x22eea7[_0x561a('0x11b')])){var _0x4bc4ff=parseInt(_0x22eea7[_0x561a('0x11b')],0xa);var _0x4753f0=rs[_0x561a('0x11c')]({'charset':'*','length':_0x4bc4ff});var _0x3b31b7=_0x173817[_0x561a('0xa1')];if(_0x3b31b7>0x0){if(_0x3b31b7>_0x4bc4ff){this[_0x561a('0x3b')]['sync'](this,_0x22eea7,_0x22eea7['hiddendigitspos']===_0x561a('0x11d')?_0x4753f0+_0x173817[_0x561a('0x11e')](_0x4bc4ff):_0x173817[_0x561a('0x11e')](0x0,_0x3b31b7-_0x4bc4ff)+_0x4753f0);}else{this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x22eea7,rs['generate']({'charset':'*','length':_0x3b31b7}));}}else{this['createSquareDetailsReport'][_0x561a('0x75')](this,_0x22eea7,'');}}else{this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x22eea7,_0x173817);}return _0x4dde3e;};AGIVertices['prototype'][_0x561a('0xe')]=function(_0x579d23){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x11f'),_0x579d23[_0x561a('0x3c')]));return this[_0x561a('0xd')](_0x579d23);};AGIVertices[_0x561a('0x11')][_0x561a('0x120')]=function(_0x37da8e){logger[_0x561a('0x32')](util['format'](_0x561a('0x121'),_0x37da8e[_0x561a('0x3c')]));this[_0x561a('0x3b')]['sync'](this,_0x37da8e,_0x37da8e['goalname']);return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x122'),_0x37da8e[_0x561a('0x123')]));};AGIVertices[_0x561a('0x11')][_0x561a('0x124')]=function(_0x5b92d9){logger[_0x561a('0x32')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5b92d9[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x5b92d9[_0x561a('0x8b')])||!this['isConfigured'](_0x5b92d9[_0x561a('0x8c')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x561a('0x89')](_0x5b92d9[_0x561a('0x60')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x125'),_0x5b92d9['text']));var _0x3308e8=this[_0x561a('0x126')][_0x561a('0x75')](this,_0x5b92d9);if(_0x3308e8){this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x127'),_0x3308e8));var _0x42437e=this[_0x561a('0xf')][_0x561a('0x128')](_0x3308e8);try{fs['unlink'](_0x3308e8+_0x561a('0x106'));}catch(_0x24320f){logger[_0x561a('0x30')](_0x24320f);}return _0x42437e;}return this[_0x561a('0xf')][_0x561a('0x30')](_0x5b92d9,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x561a('0x11')][_0x561a('0x129')]=function(_0xe19a4a){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xe19a4a['label']));if(!this[_0x561a('0x89')](_0xe19a4a['aws_access_key_id'])||!this[_0x561a('0x89')](_0xe19a4a[_0x561a('0x8c')])){return this['channel']['noop'](_0x561a('0x12a'));}if(!this[_0x561a('0x89')](_0xe19a4a[_0x561a('0x93')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20bot\x20name\x20configured');}if(!this[_0x561a('0x89')](_0xe19a4a[_0x561a('0x60')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xee')]=!![];this[_0x561a('0x3b')](_0xe19a4a);this[_0x561a('0x44')](_0xe19a4a[_0x561a('0x60')],'in','','');this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x12b'),_0xe19a4a[_0x561a('0x60')]));var _0x2ba60d=this[_0x561a('0x91')][_0x561a('0x75')](this,_0xe19a4a);if(_0x2ba60d){for(var _0x2f86b4 in _0x2ba60d){if(_0x2ba60d[_0x561a('0x9c')](_0x2f86b4)&&_['isString'](_0x2ba60d[_0x2f86b4])){this['channel'][_0x561a('0xa6')](util[_0x561a('0x2c')]('AWS_LEX_%s',_0x2f86b4['toUpperCase']()),_0x2ba60d[_0x2f86b4]);}}if(_[_0x561a('0x48')](_0x2ba60d[_0x561a('0x7b')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x561a('0x44')](_0x2ba60d[_0x561a('0x7b')],_0x561a('0xf2'),_0x561a('0x12c'),'');return this[_0x561a('0xf')][_0x561a('0xb0')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x2ba60d[_0x561a('0x7b')]));}}return this[_0x561a('0xf')][_0x561a('0x30')](_0xe19a4a,_0x561a('0x12d'));};AGIVertices[_0x561a('0x11')][_0x561a('0x12e')]=function(_0x18f10d){logger['info'](util['format'](_0x561a('0x12f'),_0x18f10d[_0x561a('0x3c')],_0x18f10d['timeout']));if(!this[_0x561a('0x89')](_0x18f10d[_0x561a('0x7f')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xed'));}var _0x2d38c0='wav';var _0x210cdb=util[_0x561a('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x561a('0x11c')](0x4));var _0x1aaf25=util[_0x561a('0x2c')](_0x561a('0xa5'),_0x210cdb,_0x2d38c0);var _0x3d7f30=!![];if(_0x18f10d['beep']===_0x561a('0x130')){_0x3d7f30=![];}var _0x32fa16=this[_0x561a('0xf')][_0x561a('0x131')](_0x210cdb,_0x2d38c0,_0x18f10d[_0x561a('0x132')],_0x18f10d[_0x561a('0x69')],undefined,_0x3d7f30);if(_0x32fa16[_0x561a('0xac')]!==-0x1){this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x133'),_0x1aaf25));var _0x26eb58=this[_0x561a('0x94')][_0x561a('0x75')](this,_0x18f10d,_0x1aaf25);if(_0x26eb58){for(var _0x252540 in _0x26eb58){if(_0x26eb58[_0x561a('0x9c')](_0x252540)){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0x134'),_0x252540['toUpperCase']()),_0x26eb58[_0x252540]);}}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x135'),JSON['stringify'](_0x26eb58)));}}return _0x32fa16;};AGIVertices[_0x561a('0x11')][_0x561a('0x136')]=function(_0xd4dfbd){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x137'),_0xd4dfbd['label']));if(!this[_0x561a('0x89')](_0xd4dfbd[_0x561a('0x97')])){return this[_0x561a('0xf')]['noop'](_0x561a('0x138'));}if(!this[_0x561a('0x89')](_0xd4dfbd[_0x561a('0x98')])){return this[_0x561a('0xf')]['noop'](_0x561a('0x139'));}var _0x5a825c=_0x561a('0x13a');var _0x17d8f8=util[_0x561a('0x2c')](_0x561a('0x13b'),FILES_PATH,rs['generate'](0x4));var _0xfd7c3c=util[_0x561a('0x2c')](_0x561a('0xa5'),_0x17d8f8,_0x5a825c);var _0x1610c1=!![];if(_0xd4dfbd[_0x561a('0x13c')]===_0x561a('0x130')){_0x1610c1=![];}var _0x12959e=this['channel'][_0x561a('0x131')](_0x17d8f8,_0x5a825c,_0xd4dfbd[_0x561a('0x132')],_0xd4dfbd['timeout'],undefined,_0x1610c1);if(_0x12959e[_0x561a('0xac')]!==-0x1){this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x13d'),_0xfd7c3c));var _0x537b01=this[_0x561a('0x96')]['sync'](this,_0xd4dfbd,_0xfd7c3c);if(_0x537b01){for(var _0x4da1b3 in _0x537b01){if(_0x537b01['hasOwnProperty'](_0x4da1b3)){this[_0x561a('0xf')]['setVariable'](util[_0x561a('0x2c')]('TILDE_ASR_%s',_0x4da1b3[_0x561a('0x6f')]()),_0x537b01[_0x4da1b3]);}}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0x561a('0xa7')](_0x537b01)));}}return _0x12959e;};AGIVertices[_0x561a('0x11')][_0x561a('0x13e')]=function(_0x56d9bd){logger['info'](util[_0x561a('0x2c')](_0x561a('0x13f'),_0x56d9bd[_0x561a('0x3c')]));return this[_0x561a('0xf')][_0x561a('0x140')](_0x56d9bd['context'],_0x56d9bd['extension'],_0x56d9bd[_0x561a('0x41')]);};AGIVertices['prototype'][_0x561a('0x141')]=function(_0x3cdf8e){logger[_0x561a('0x32')](util['format'](_0x561a('0x142'),_0x3cdf8e[_0x561a('0x3c')]));if(!this['isConfigured'](_0x3cdf8e['condition'])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x3cdf8e,'no\x20condition\x20configured');}try{var _0x2c14fb=eval(_0x3cdf8e[_0x561a('0x143')])?_0x561a('0x144'):_0x561a('0x145');this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x146'),_0x3cdf8e[_0x561a('0x143')],_0x2c14fb));return{'code':0xc8,'result':_0x2c14fb};}catch(_0x394518){return{'code':0xc8,'result':_0x561a('0x145')};}};AGIVertices[_0x561a('0x11')][_0x561a('0x147')]=function(_0x5dcf0e){logger[_0x561a('0x32')](util['format'](_0x561a('0x148'),_0x5dcf0e['label']));if(!this[_0x561a('0x89')](_0x5dcf0e[_0x561a('0x149')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x5dcf0e,'no\x20interval\x20configured');}var _0x2218fa=this['getIntervals']['sync'](this,_0x5dcf0e['interval_id']);if(!_0x2218fa){return this[_0x561a('0xf')]['error'](_0x5dcf0e,_0x561a('0x14a'));}for(var _0x1173a5=0x0;_0x1173a5<_0x2218fa[_0x561a('0xa1')];_0x1173a5+=0x1){var _0x3ebb47=this[_0x561a('0xf')]['getVariable'](util['format'](_0x561a('0x14b'),_0x2218fa[_0x1173a5]));if(_0x3ebb47[_0x561a('0xac')]===-0x1){return _0x3ebb47;}logger[_0x561a('0x32')](util[_0x561a('0x2c')]('IFTIME\x20%s\x20%s',_0x2218fa[_0x1173a5],_0x3ebb47['extra']));if(_0x3ebb47['extra']===_0x561a('0x144')){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('IFTIME\x20%s\x20%s',_0x2218fa[_0x1173a5],_0x561a('0x144')));this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x14c'),_0x2218fa[_0x1173a5],_0x561a('0x144')));return{'code':0xc8,'result':_0x561a('0x144')};}else{logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x14c'),_0x2218fa[_0x1173a5],_0x561a('0x145')));this['channel']['noop'](util['format'](_0x561a('0x14c'),_0x2218fa[_0x1173a5],_0x561a('0x145')));}}return{'code':0xc8,'result':_0x561a('0x145')};};AGIVertices['prototype'][_0x561a('0x14d')]=function(_0x2f4d4a){logger[_0x561a('0x32')](util['format'](_0x561a('0x14e'),_0x2f4d4a['label']));return this[_0x561a('0xf')][_0x561a('0x14d')]();};AGIVertices[_0x561a('0x11')][_0x561a('0x14f')]=function(_0x2f45ea){logger[_0x561a('0x32')](util['format'](_0x561a('0x150'),_0x2f45ea[_0x561a('0x3c')]));if(!this['isConfigured'](_0x2f45ea[_0x561a('0x7f')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xed'));}var _0x3daa1f='wav';var _0x5116e8=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x561a('0x11c')](0x4));var _0x3143de=util[_0x561a('0x2c')](_0x561a('0xa5'),_0x5116e8,_0x3daa1f);var _0x2ddc97=!![];if(_0x2f45ea[_0x561a('0x13c')]===_0x561a('0x130')){_0x2ddc97=![];}var _0x2bfc0c=this['channel'][_0x561a('0x131')](_0x5116e8,_0x3daa1f,_0x2f45ea[_0x561a('0x132')],_0x2f45ea[_0x561a('0x69')],undefined,_0x2ddc97);if(_0x2bfc0c[_0x561a('0xac')]!==-0x1){this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x151'),_0x3143de));var _0x4bb9fc=this['ispeechASR'][_0x561a('0x75')](this,_0x2f45ea,_0x3143de);if(_0x4bb9fc){for(var _0x17c580 in _0x4bb9fc){if(_0x4bb9fc[_0x561a('0x9c')](_0x17c580)){this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0x152'),_0x17c580[_0x561a('0x6f')]()),_0x4bb9fc[_0x17c580]);}}return this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x153'),JSON[_0x561a('0xa7')](_0x4bb9fc)));}}return _0x2bfc0c;};AGIVertices[_0x561a('0x11')][_0x561a('0x154')]=function(_0x52c846){logger['info'](util[_0x561a('0x2c')](_0x561a('0x155'),_0x52c846[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x52c846[_0x561a('0x7f')])){return this['channel'][_0x561a('0xb0')](_0x561a('0xed'));}if(!this[_0x561a('0x89')](_0x52c846['text'])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xc9'));}this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('Trying\x20ispeech\x20TTS\x20%s',_0x52c846['text']));var _0x29f0f7=this[_0x561a('0x86')][_0x561a('0x75')](this,_0x52c846);if(_0x29f0f7){this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0x151'),_0x29f0f7));var _0x1b26f9=this[_0x561a('0xf')][_0x561a('0x128')](_0x29f0f7,_0x52c846[_0x561a('0x132')]);try{fs[_0x561a('0x105')](_0x29f0f7+_0x561a('0x106'));}catch(_0x2c230e){logger[_0x561a('0x30')](_0x2c230e);}return _0x1b26f9;}return this['channel'][_0x561a('0x30')](_0x52c846,_0x561a('0x156'));};AGIVertices['prototype'][_0x561a('0x157')]=function(_0x68a83){logger[_0x561a('0x32')](util['format'](_0x561a('0x158'),_0x68a83[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x68a83[_0x561a('0x159')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x68a83,_0x561a('0x15a'));}logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x15b'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x68a83[_0x561a('0x159')]));var _0x583842=this[_0x561a('0x58')]['sync'](this,_0x68a83['findBy']);if(_0x583842){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x561a('0xf')][_0x561a('0x3e')],_0x68a83[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x15c'),this[_0x561a('0xf')]['callerid'],_0x68a83[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15d')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x561a('0x3e')],_0x68a83[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x15e'),this['channel'][_0x561a('0x3e')],_0x68a83[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15f')};}};AGIVertices['prototype'][_0x561a('0x160')]=function(_0x24fe1f){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x161'),_0x24fe1f[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x24fe1f[_0x561a('0x159')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x24fe1f,_0x561a('0x15a'));}logger[_0x561a('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x561a('0xf')]['callerid'],_0x24fe1f[_0x561a('0x159')]));var _0x469266=this['agentLogout'][_0x561a('0x75')](this,_0x24fe1f[_0x561a('0x159')]);if(_0x469266){logger['info'](util[_0x561a('0x2c')](_0x561a('0x15c'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x24fe1f[_0x561a('0x159')]));this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x15c'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x24fe1f[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15d')};}else{logger['info'](util[_0x561a('0x2c')](_0x561a('0x15e'),this[_0x561a('0xf')]['callerid'],_0x24fe1f[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x561a('0x3e')],_0x24fe1f['findBy']));return{'code':0xc8,'result':_0x561a('0x15f')};}};AGIVertices[_0x561a('0x11')][_0x561a('0x162')]=function(_0x2265de){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x163'),_0x2265de[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x2265de[_0x561a('0x164')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2265de,_0x561a('0x165'));}this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x166'),_0x2265de[_0x561a('0x164')]));var _0x471369=eval(_0x2265de[_0x561a('0x164')]);if(!this[_0x561a('0x89')](_0x2265de['variable_id'])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0xdc'));}var _0x2e158b=this['getVariable'][_0x561a('0x75')](this,_0x2265de[_0x561a('0xdd')]);if(!_0x2e158b){return this[_0x561a('0xf')][_0x561a('0x30')](_0x2265de,'no\x20variable\x20found');}if(_['isArray'](_0x471369)){var _0x160092=this;_0x471369[_0x561a('0xdf')](function(_0x3377d0,_0xefc8a4){_0x160092[_0x561a('0xf')]['setVariable'](util[_0x561a('0x2c')]('%s[%s]',_0x2e158b,_0xefc8a4),_0x3377d0);});return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('variable\x20%s[key]\x20set',_0x2e158b));}else{return this[_0x561a('0xf')][_0x561a('0xa6')](_0x2e158b,_0x471369);}};AGIVertices[_0x561a('0x11')][_0x561a('0xc')]=function(_0x255b82){logger[_0x561a('0x32')](util['format'](_0x561a('0x167'),_0x255b82[_0x561a('0x3c')]));if(_0x255b82['retry']===0x0){return this['maxRetry'](_0x255b82);}_0x255b82['retry']-=0x1;if(!this[_0x561a('0x89')](_0x255b82[_0x561a('0x115')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x255b82,_0x561a('0x168'));}var _0x4fabd0=this[_0x561a('0x20')][_0x561a('0x75')](this,_0x255b82[_0x561a('0x115')]);if(!_0x4fabd0){return this[_0x561a('0xf')]['error'](_0x255b82,_0x561a('0x116'));}var _0x4d3392=this[_0x561a('0xf')][_0x561a('0x117')](_0x4fabd0,_0x255b82['response'],_0x255b82['digit']);var _0x2cc118=_0x4d3392[_0x561a('0xac')];if(_0x4d3392[_0x561a('0xac')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x255b82,'-1');return _0x4d3392;}else if(_0x4d3392[_0x561a('0xaa')]==='timeout'){_0x4d3392[_0x561a('0xac')]=_0x4d3392[_0x561a('0xac')][_0x561a('0xa1')]>0x0?_0x4d3392[_0x561a('0xac')]:'t';}else if(_['isEmpty'](_0x4d3392[_0x561a('0xac')])){_0x4d3392[_0x561a('0xac')]='#';_0x2cc118='#';}if(!this[_0x561a('0x89')](_0x255b82[_0x561a('0xdd')])){this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3b064c=this['getVariable'][_0x561a('0x75')](this,_0x255b82['variable_id']);if(!_0x3b064c){return this['channel'][_0x561a('0x30')](_0x255b82,_0x561a('0xde'));}this['channel'][_0x561a('0xa6')](_0x3b064c,_0x2cc118);}this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x255b82,_0x2cc118);return _0x4d3392;};AGIVertices[_0x561a('0x11')][_0x561a('0xb0')]=function(_0x5ea420){logger['info'](util[_0x561a('0x2c')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5ea420[_0x561a('0x3c')]));return this['channel']['noop'](_0x5ea420[_0x561a('0x169')]||_0x5ea420[_0x561a('0x3c')]);};AGIVertices[_0x561a('0x11')]['pause']=function(_0x5e01e2){logger['info'](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5e01e2[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x5e01e2[_0x561a('0x159')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x5e01e2,'no\x20find\x20by\x20configured');}logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x15b'),this[_0x561a('0xf')]['callerid'],_0x5e01e2['findBy']));var _0xb764ee=this['getPause']['sync'](this,_0x5e01e2[_0x561a('0x16a')]);var _0x20f247=this[_0x561a('0x55')]['sync'](this,_0x5e01e2['findBy'],_0xb764ee);if(_0x20f247){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x15c'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x5e01e2[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x15c'),this['channel']['callerid'],_0x5e01e2['findBy']));return{'code':0xc8,'result':_0x561a('0x15d')};}else{logger[_0x561a('0x32')](util[_0x561a('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x561a('0xf')][_0x561a('0x3e')],_0x5e01e2['findBy']));this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x15c'),this[_0x561a('0xf')][_0x561a('0x3e')],_0x5e01e2[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15f')};}};AGIVertices['prototype'][_0x561a('0x16b')]=function(_0x7d4d2d){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x16c'),_0x7d4d2d['label']));if(!this['isConfigured'](_0x7d4d2d[_0x561a('0x115')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x7d4d2d,_0x561a('0x168'));}var _0x48a3fd=this[_0x561a('0x20')][_0x561a('0x75')](this,_0x7d4d2d[_0x561a('0x115')]);if(!_0x48a3fd){return this[_0x561a('0xf')][_0x561a('0x30')](_0x7d4d2d,'no\x20file\x20audio\x20found');}var _0x2651bf=this['channel'][_0x561a('0x5b')](_0x561a('0x16d'),[_0x48a3fd,_0x7d4d2d['opts']]);if(_0x2651bf['result']===-0x1){return _0x2651bf;}return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x48a3fd));};AGIVertices[_0x561a('0x11')][_0x561a('0x16e')]=function(_0x1ebbe5){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x16f'),_0x1ebbe5[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x1ebbe5[_0x561a('0x170')])){return this[_0x561a('0xf')][_0x561a('0x30')](_0x1ebbe5,_0x561a('0x171'));}var _0x11ac20='';var _0x3c9aed=parseInt(_0x1ebbe5[_0x561a('0x170')],0xa);if(isNaN(_0x3c9aed)){_0x11ac20=_0x1ebbe5[_0x561a('0x170')];}else{_0x11ac20=this[_0x561a('0x17')][_0x561a('0x75')](this,_0x1ebbe5[_0x561a('0x170')]);if(!_0x11ac20){return this[_0x561a('0xf')][_0x561a('0x30')](_0x1ebbe5,_0x561a('0x172'));}}var _0x50f952='';if(this[_0x561a('0x89')](_0x1ebbe5[_0x561a('0x115')])){var _0x5445ad=this[_0x561a('0x20')][_0x561a('0x75')](this,_0x1ebbe5[_0x561a('0x115')]);if(_0x5445ad){_0x50f952=_0x5445ad;}}this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x1ebbe5,_0x11ac20);if(_0x1ebbe5[_0x561a('0x110')][_0x561a('0x173')]('x')<0x0){_0x1ebbe5[_0x561a('0x110')]+='x';}if(_0x1ebbe5['opts'][_0x561a('0x173')]('X')<0x0){_0x1ebbe5[_0x561a('0x110')]+='X';}this[_0x561a('0xf')][_0x561a('0xa6')](_0x561a('0x174'),_0x11ac20?_0x11ac20[_0x561a('0x175')]():'');var _0x5d4b08=this[_0x561a('0xf')][_0x561a('0x5b')](_0x561a('0x176'),[_0x11ac20,_0x1ebbe5[_0x561a('0x110')],_0x1ebbe5[_0x561a('0x68')],_0x50f952,_0x1ebbe5[_0x561a('0x69')],_0x1ebbe5['agi'],_0x1ebbe5[_0x561a('0x177')],_0x1ebbe5[_0x561a('0x178')],'',_0x1ebbe5[_0x561a('0x179')]]);if(_0x5d4b08[_0x561a('0xac')]===-0x1){return _0x5d4b08;}return this[_0x561a('0xf')][_0x561a('0xb0')](util['format']('Executed\x20command\x20%s\x20%s',_0x561a('0x176'),_0x11ac20));};AGIVertices[_0x561a('0x11')][_0x561a('0x17a')]=function(_0x411adc){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x411adc[_0x561a('0x3c')]));var _0x52457f=_0x411adc['recordingFormat']||_0x561a('0x13a');var _0x4658ed=util[_0x561a('0x2c')]('%s_%s',this[_0x561a('0xf')][_0x561a('0x45')],rs['generate'](0x5));var _0x36fd40=util[_0x561a('0x2c')](_0x561a('0x17b'),FILES_PATH,_0x4658ed,_0x52457f);var _0x517cfe=util[_0x561a('0x2c')](_0x561a('0x13b'),FILES_PATH,_0x4658ed);this['createSquareRecording'][_0x561a('0x75')](this,_0x411adc,_0x4658ed,_0x36fd40);this['channel'][_0x561a('0xa6')](_0x561a('0x17c'),_0x4658ed);logger[_0x561a('0x32')](_0x561a('0x17d'),_0x517cfe,_0x52457f,_0x411adc[_0x561a('0x17e')],_0x411adc[_0x561a('0x69')]);return this['channel']['recordFile'](_0x517cfe,_0x52457f,_0x411adc[_0x561a('0x17e')],_0x411adc['timeout'],undefined,!![]);};AGIVertices[_0x561a('0x11')][_0x561a('0x17f')]=function(_0xb4cc50){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x180'),_0xb4cc50[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0xb4cc50['url'])){return this[_0x561a('0xf')]['noop'](_0x561a('0x181'));}var _0x2cbaa2=this[_0x561a('0x67')][_0x561a('0x75')](this,_0xb4cc50);logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x182'),util[_0x561a('0x183')](_0x2cbaa2,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xb4cc50[_0x561a('0xdd')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x184'));}var _0x429060=this[_0x561a('0x12')][_0x561a('0x75')](this,_0xb4cc50['variable_id']);if(!_0x429060){return this['channel'][_0x561a('0x30')](_0xb4cc50,_0x561a('0xde'));}this[_0x561a('0xf')][_0x561a('0xa6')](util[_0x561a('0x2c')](_0x561a('0x185'),_0x429060),_0x2cbaa2[_0x561a('0x79')]?_0x2cbaa2[_0x561a('0x79')]:'200');this[_0x561a('0xf')][_0x561a('0xa6')](util['format'](_0x561a('0x186'),_0x429060),_0x2cbaa2['statusMessage']?_0x2cbaa2[_0x561a('0x7a')]:'OK');if(_0x2cbaa2[_0x561a('0x70')]){try{this[_0x561a('0xa3')](_0x2cbaa2[_0x561a('0x70')],_0x429060);}catch(_0x5247cc){logger[_0x561a('0x30')](util[_0x561a('0x2c')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x429060));}}return this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0xe2'),_0x429060));};AGIVertices[_0x561a('0x11')][_0x561a('0x187')]=function(_0x35ce03){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x188'),_0x35ce03['label']));return this[_0x561a('0xf')][_0x561a('0x189')](_0x35ce03['digits'][_0x561a('0x5d')](/\s+/g,''),_0x35ce03['escape_digits']);};AGIVertices[_0x561a('0x11')]['saynumber']=function(_0x3dbd6e){logger['info'](util['format'](_0x561a('0x18a'),_0x3dbd6e[_0x561a('0x3c')]));return this['channel']['sayNumber'](_0x3dbd6e[_0x561a('0x6a')]['replace'](/\s+/g,''),_0x3dbd6e[_0x561a('0x17e')]);};AGIVertices[_0x561a('0x11')][_0x561a('0x18b')]=function(_0x5a7738){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5a7738[_0x561a('0x3c')]));return this[_0x561a('0xf')]['sayPhonetic'](_0x5a7738['text'],_0x5a7738[_0x561a('0x17e')]);};AGIVertices['prototype']['sendMail']=function(_0x3e5073){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3e5073['label']));if(!this[_0x561a('0x89')](_0x3e5073[_0x561a('0x18c')])){return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x18d'));}var _0x1c34dd=this[_0x561a('0x18e')][_0x561a('0x75')](this,_0x3e5073[_0x561a('0x18c')]);if(!_0x1c34dd||!_0x1c34dd[_0x561a('0x18f')]){return this[_0x561a('0xf')][_0x561a('0x30')](_0x3e5073,_0x561a('0x190'));}var _0x36b520={'from':util['format']('\x22%s\x22\x20<%s>',_0x1c34dd[_0x561a('0x15')],_0x1c34dd[_0x561a('0x191')]||_0x1c34dd['Smtp'][_0x561a('0x192')]),'to':_0x3e5073['to']||'','cc':_0x3e5073['cc']||'','bcc':_0x3e5073[_0x561a('0x193')]||'','subject':_0x3e5073[_0x561a('0x194')],'html':_0x3e5073[_0x561a('0x60')],'text':_0x3e5073['text']};if(this[_0x561a('0x89')](_0x3e5073['template_id'])){}logger[_0x561a('0xe4')](_0x561a('0x195'),JSON[_0x561a('0xa7')](_0x36b520));this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x3e5073,_0x3e5073[_0x561a('0x18c')]);this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x196'),_0x1c34dd[_0x561a('0x15')]));this[_0x561a('0x25')][_0x561a('0x75')](this,_0x1c34dd['smtpOptions'],_0x36b520);return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x197'));};AGIVertices[_0x561a('0x11')][_0x561a('0x198')]=function(_0x82a77e){logger[_0x561a('0x32')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x82a77e[_0x561a('0x3c')]));return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x199'));};AGIVertices[_0x561a('0x11')][_0x561a('0x19a')]=function(_0x3a9310){logger['info'](util[_0x561a('0x2c')](_0x561a('0x19b'),_0x3a9310[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x3a9310[_0x561a('0x19c')])){return this['channel']['noop'](_0x561a('0x19d'));}var _0x141ab5=this[_0x561a('0x38')][_0x561a('0x75')](this,_0x3a9310['sms_account_id']);if(!_0x141ab5){return this[_0x561a('0xf')]['error'](_0x3a9310,_0x561a('0x19e'));}var _0xd5d2f0={'body':_0x3a9310[_0x561a('0x19f')],'phone':_0x3a9310['to']||'','SmsAccountId':_0x141ab5['id']};logger[_0x561a('0xe4')](_0x561a('0x1a0'),JSON[_0x561a('0xa7')](_0xd5d2f0));this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x3a9310,_0x3a9310[_0x561a('0x19c')]);this['channel']['noop'](util['format'](_0x561a('0x1a1'),_0x141ab5[_0x561a('0x15')]));this['createSmsMessage']['sync'](this,_0xd5d2f0);return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x1a2'));};AGIVertices[_0x561a('0x11')]['set']=function(_0x3ad6ad){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1a3'),_0x3ad6ad[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x3ad6ad[_0x561a('0xdd')])){return this[_0x561a('0xf')]['error'](_0x3ad6ad,_0x561a('0x1a4'));}var _0xd3fa43=this['getVariable'][_0x561a('0x75')](this,_0x3ad6ad[_0x561a('0xdd')]);if(!_0xd3fa43){return this[_0x561a('0xf')][_0x561a('0x30')](_0x3ad6ad,_0x561a('0xde'));}return this['channel'][_0x561a('0xa6')](_0xd3fa43,_0x3ad6ad[_0x561a('0x1a5')]);};AGIVertices['prototype'][_0x561a('0x1a6')]=function(_0x1828eb){logger[_0x561a('0x32')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x1828eb[_0x561a('0x3c')]));this[_0x561a('0xf')][_0x561a('0xb0')]('START\x20CALLY\x20SQUARE');var _0x2b62d5=this[_0x561a('0xf')][_0x561a('0x12')](_0x561a('0x1a7'));if(!_['isEmpty'](_0x2b62d5[_0x561a('0xaa')])){this[_0x561a('0xf')][_0x561a('0x45')]=_0x2b62d5[_0x561a('0xaa')];}if(_0x1828eb[_0x561a('0xbb')]===_0x561a('0x1a8')){this['channel'][_0x561a('0xb0')](_0x561a('0x1a9'));return this['channel'][_0x561a('0xbb')]();}return this[_0x561a('0xf')][_0x561a('0xb0')](_0x561a('0x1aa'));};AGIVertices[_0x561a('0x11')][_0x561a('0x1ab')]=function(_0x49f1d8){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1ac'),_0x49f1d8[_0x561a('0x3c')]));if(!this['isConfigured'](_0x49f1d8[_0x561a('0x1ad')])){return this['channel'][_0x561a('0x30')](_0x49f1d8,_0x561a('0x1ae'));}var _0x4466bd=this[_0x561a('0x19')][_0x561a('0x75')](this,_0x49f1d8[_0x561a('0x1ad')]);if(!this[_0x561a('0x89')](_0x4466bd)){return this['channel']['error'](_0x49f1d8,util['format'](_0x561a('0x1af'),_0x49f1d8[_0x561a('0x1ad')]));}if(_0x4466bd===this['channel']['arg_1']){return this[_0x561a('0xf')][_0x561a('0x30')](_0x49f1d8,_0x561a('0x1b0'));}this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x49f1d8,_0x4466bd);var _0x747b7c=this[_0x561a('0xf')]['exec'](_0x561a('0x1b1'),util[_0x561a('0x2c')](_0x561a('0x1b2'),config[_0x561a('0x7')][_0x561a('0x1b3')]||'127.0.0.1',_0x4466bd,this[_0x561a('0xf')][_0x561a('0x3d')]));if(_0x747b7c[_0x561a('0xac')]===-0x1){return _0x747b7c;}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0xc5'),_0x561a('0x1b1'),_0x4466bd));};AGIVertices['prototype']['system']=function(_0x5ae24){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1b4'),_0x5ae24[_0x561a('0x3c')]));var _0x8ad52b=this[_0x561a('0x1b5')][_0x561a('0x75')](this,_0x5ae24[_0x561a('0x1b6')]);this[_0x561a('0x3b')][_0x561a('0x75')](this,_0x5ae24,_0x5ae24['command']);if(this[_0x561a('0x89')](_0x5ae24['variable_id'])){var _0x3d0b58=this[_0x561a('0x12')][_0x561a('0x75')](this,_0x5ae24[_0x561a('0xdd')]);if(_0x3d0b58){this[_0x561a('0xf')][_0x561a('0xa6')](_0x3d0b58,_0x8ad52b);return this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5ae24['command'],_0x3d0b58));}}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x1b7'),_0x5ae24[_0x561a('0x1b6')]));};AGIVertices[_0x561a('0x11')][_0x561a('0x1b8')]=function(_0x103bc9){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1b9'),_0x103bc9['label']));_0x103bc9[_0x561a('0x60')]=_0x103bc9[_0x561a('0x60')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x103bc9[_0x561a('0x1ba')])){return this[_0x561a('0xf')][_0x561a('0xb0')]('no\x20apiKey\x20configured');}if(!this[_0x561a('0x89')](_0x103bc9['text'])){return this[_0x561a('0xf')]['noop'](_0x561a('0xc9'));}this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0x1bb'),_0x103bc9[_0x561a('0x60')]));var _0x193c7c=this[_0x561a('0x5e')][_0x561a('0x75')](this,_0x103bc9);if(_0x193c7c){this[_0x561a('0xf')][_0x561a('0xb0')](util['format'](_0x561a('0x1bc'),_0x193c7c));var _0x497aef=this[_0x561a('0xf')][_0x561a('0x128')](_0x193c7c);try{fs['unlink'](_0x193c7c+_0x561a('0x106'));}catch(_0x5299ca){logger[_0x561a('0x30')](_0x5299ca);}return _0x497aef;}return this['channel'][_0x561a('0x30')](_0x103bc9,_0x561a('0x1bd'));};AGIVertices[_0x561a('0x11')][_0x561a('0x1be')]=function(_0x636d00){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1bf'),_0x636d00['label']));_0x636d00['text']=_0x636d00['text'][_0x561a('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x561a('0x89')](_0x636d00[_0x561a('0x60')])){return this[_0x561a('0xf')]['noop']('no\x20text\x20configured');}this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x1c0'),_0x636d00[_0x561a('0x60')]));var _0x4f149f=this[_0x561a('0x66')][_0x561a('0x75')](this,_0x636d00);if(_0x4f149f){this['channel'][_0x561a('0xb0')](util['format'](_0x561a('0x1c1'),_0x4f149f));var _0x4c7f92=this[_0x561a('0xf')][_0x561a('0x128')](_0x4f149f);try{fs[_0x561a('0x105')](_0x4f149f+_0x561a('0x106'));}catch(_0x38485f){logger[_0x561a('0x30')](_0x38485f);}return _0x4c7f92;}return this['channel'][_0x561a('0x30')](_0x636d00,_0x561a('0x1c2'));};AGIVertices[_0x561a('0x11')][_0x561a('0x1c3')]=function(_0x1caea2){logger['info'](util[_0x561a('0x2c')](_0x561a('0x1c4'),_0x1caea2[_0x561a('0x3c')]));if(!this[_0x561a('0x89')](_0x1caea2[_0x561a('0x159')])){return this[_0x561a('0xf')]['error'](_0x1caea2,_0x561a('0x15a'));}logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x15b'),this[_0x561a('0xf')]['callerid'],_0x1caea2[_0x561a('0x159')]));var _0x32e07d=this[_0x561a('0x56')]['sync'](this,_0x1caea2[_0x561a('0x159')]);if(_0x32e07d){logger['info'](util[_0x561a('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x561a('0xf')][_0x561a('0x3e')],_0x1caea2['findBy']));this['channel'][_0x561a('0xb0')](util[_0x561a('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x561a('0xf')]['callerid'],_0x1caea2[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15d')};}else{logger[_0x561a('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x561a('0xf')][_0x561a('0x3e')],_0x1caea2[_0x561a('0x159')]));this[_0x561a('0xf')][_0x561a('0xb0')](util[_0x561a('0x2c')](_0x561a('0x15e'),this['channel'][_0x561a('0x3e')],_0x1caea2[_0x561a('0x159')]));return{'code':0xc8,'result':_0x561a('0x15f')};}};AGIVertices['prototype']['voicemail']=function(_0x46ad25){logger[_0x561a('0x32')](util[_0x561a('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x46ad25['label']));var _0x3282e6=this[_0x561a('0xf')]['exec'](_0x561a('0x1c5'),[_0x46ad25[_0x561a('0x1c6')],_0x46ad25[_0x561a('0x7d')]]);if(_0x3282e6[_0x561a('0xac')]===-0x1){return _0x3282e6;}return this[_0x561a('0xf')]['noop'](util[_0x561a('0x2c')](_0x561a('0xc5'),_0x561a('0x1c5'),_0x46ad25[_0x561a('0x1c6')]));};AGIVertices[_0x561a('0x11')][_0x561a('0x1c7')]=function(_0x1bb2a5){logger[_0x561a('0x32')](util[_0x561a('0x2c')](_0x561a('0x1c8'),_0x1bb2a5[_0x561a('0x3c')]));if(!this['isConfigured'](_0x1bb2a5[_0x561a('0xdd')])){return this['channel'][_0x561a('0x30')](_0x1bb2a5,_0x561a('0x1a4'));}var _0x5d055e=this['getVariable']['sync'](this,_0x1bb2a5[_0x561a('0xdd')]);if(!_0x5d055e){return this[_0x561a('0xf')]['error'](_0x1bb2a5,'no\x20variable\x20found');}var _0x257b14=this[_0x561a('0xf')][_0x561a('0x12')](_0x5d055e);return{'code':0xc8,'result':_0x257b14[_0x561a('0xaa')]?_0x257b14[_0x561a('0xaa')]:'-'};};String[_0x561a('0x11')][_0x561a('0xa9')]=function(_0x583db1,_0x35b53e){return this[_0x561a('0xa8')](_0x583db1)[_0x561a('0x1c9')](_0x35b53e);};module[_0x561a('0x1ca')]=AGIVertices; \ No newline at end of file +var _0xafdd=['close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','.wav','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','out','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','generate','beep','NOBEEP','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','isEmpty','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','Smtp','user','subject','template_id','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','agentUnpause','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','catch','getVoiceQueue','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s'];(function(_0x3a718b,_0x3134ae){var _0x576b76=function(_0x237370){while(--_0x237370){_0x3a718b['push'](_0x3a718b['shift']());}};_0x576b76(++_0x3134ae);}(_0xafdd,0x19a));var _0xdafd=function(_0x4aaa95,_0x2b9c98){_0x4aaa95=_0x4aaa95-0x0;var _0x29e0d0=_0xafdd[_0x4aaa95];return _0x29e0d0;};'use strict';var fs=require('fs');var util=require(_0xdafd('0x0'));var _=require(_0xdafd('0x1'));var sh=require(_0xdafd('0x2'));var odbc=require(_0xdafd('0x3'))();var rs=require(_0xdafd('0x4'));var moment=require(_0xdafd('0x5'));var Mustache=require(_0xdafd('0x6'));var rp=require(_0xdafd('0x7'));var logger=require('../../config/logger')(_0xdafd('0x8'));var config=require(_0xdafd('0x9'));var scripts=require(_0xdafd('0xa'));var FILES_PATH=_0xdafd('0xb');var recursiveMapAttributes=[_0xdafd('0xc'),_0xdafd('0xd')];var verticesWithRetry=[_0xdafd('0xe'),'getdigits',_0xdafd('0xf')];var AGIVertices=function(_0x385520,_0x7a279f,_0x48000b){this[_0xdafd('0x10')]=_0x385520;this[_0xdafd('0x11')]=_0x7a279f;this[_0xdafd('0x12')]=_0x48000b;};AGIVertices[_0xdafd('0x13')]['getVariable']=function(_0x42373f,_0x2fec30){this[_0xdafd('0x11')][_0xdafd('0x14')](_0x42373f)[_0xdafd('0x15')](function(_0x3bf1f7){_0x2fec30(null,_0x3bf1f7?_0x3bf1f7['name']:![]);})[_0xdafd('0x16')](function(_0x594f47){_0x2fec30(_0x594f47);});};AGIVertices['prototype'][_0xdafd('0x17')]=function(_0x35d2e5,_0x55b05a){this[_0xdafd('0x11')]['getVoiceQueueById'](_0x35d2e5)['then'](function(_0x1c312d){_0x55b05a(null,_0x1c312d?_0x1c312d[_0xdafd('0x18')]:![]);})[_0xdafd('0x16')](function(_0x267bfc){_0x55b05a(_0x267bfc);});};AGIVertices[_0xdafd('0x13')]['getSquareProject']=function(_0x47240f,_0x1842d3){this[_0xdafd('0x11')]['getSquareProjectById'](_0x47240f)[_0xdafd('0x15')](function(_0x15beca){_0x1842d3(null,_0x15beca?_0x15beca['name']:![]);})['catch'](function(_0x2569b2){_0x1842d3(_0x2569b2);});};AGIVertices['prototype'][_0xdafd('0x19')]=function(_0x341d3d,_0x1e64d3){this[_0xdafd('0x11')][_0xdafd('0x1a')](_0x341d3d)[_0xdafd('0x15')](function(_0x44f825){_0x1e64d3(null,_0x44f825?_0x44f825[_0xdafd('0x1b')]:![]);})[_0xdafd('0x16')](function(_0x10c353){_0x1e64d3(_0x10c353);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1c')]=function(_0xa6ddd7,_0xf4a521){this['rpc'][_0xdafd('0x1d')](_0xa6ddd7)['then'](function(_0x31bcd1){_0xf4a521(null,_0x31bcd1?_0x31bcd1['name']:![]);})[_0xdafd('0x16')](function(_0x35ef78){_0xf4a521(_0x35ef78);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1e')]=function(_0xfc36d7,_0x31cf35){this[_0xdafd('0x11')][_0xdafd('0x1f')](_0xfc36d7)[_0xdafd('0x15')](function(_0x5cd11d){_0x31cf35(null,_0x5cd11d?_0x5cd11d[_0xdafd('0x18')]:![]);})[_0xdafd('0x16')](function(_0x18554c){_0x31cf35(_0x18554c);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x20')]=function(_0x25f277,_0x383845){var _0x29037e=this;this[_0xdafd('0x11')][_0xdafd('0x21')](_0x25f277)['then'](function(_0x243182){_0x383845(null,_0x243182?_0x29037e[_0xdafd('0x22')](_0x243182[_0xdafd('0x23')]):![]);})[_0xdafd('0x16')](function(_0x21edb6){_0x383845(_0x21edb6);});};AGIVertices[_0xdafd('0x13')]['getMailAccount']=function(_0x549bf2,_0x512562){this[_0xdafd('0x11')][_0xdafd('0x24')](_0x549bf2)['then'](function(_0x4f6cb1){_0x512562(null,_0x4f6cb1?_0x4f6cb1:![]);})[_0xdafd('0x16')](function(_0x3e7b4d){_0x512562(_0x3e7b4d);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x25')]=function(_0x2339c3,_0xa8b2ac,_0x3e1287){this['mailRpc'][_0xdafd('0x25')](_0x2339c3,_0xa8b2ac)[_0xdafd('0x15')](function(){_0x3e1287(null);})[_0xdafd('0x16')](function(_0x500504){_0x3e1287(_0x500504);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x26')]=function(_0x5e0995,_0x5e785a){this[_0xdafd('0x11')][_0xdafd('0x27')](_0x5e0995)['then'](function(_0x41cf77){if(_0x41cf77){if(_0x41cf77[_0xdafd('0x28')]){_0x5e785a(null,[_0x41cf77[_0xdafd('0x29')]]);}else{_0x5e785a(null,_[_0xdafd('0x2a')](_0x41cf77[_0xdafd('0x2b')],_0xdafd('0x29')));}}else{_0x5e785a(null,![]);}})[_0xdafd('0x16')](function(_0x5dc9f2){_0x5e785a(_0x5dc9f2);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x22')]=function(_0x2a711d){return util[_0xdafd('0x2c')](_0xdafd('0x2d'),FILES_PATH,_0x2a711d);};AGIVertices['prototype'][_0xdafd('0x2e')]=function(_0x21d724,_0x501470,_0x3dbdb1){odbc[_0xdafd('0x2f')](_0x21d724,function(_0x360b94){if(_0x360b94){logger[_0xdafd('0x30')](_0xdafd('0x31'),_0x360b94);_0x3dbdb1(_0x360b94);}else{logger[_0xdafd('0x32')](_0xdafd('0x33'));odbc[_0xdafd('0x34')](_0x501470,function(_0x19c501,_0x436201){if(_0x19c501){logger[_0xdafd('0x32')](_0xdafd('0x35'),_0x501470);_0x3dbdb1(_0x19c501);}else{logger[_0xdafd('0x32')](_0xdafd('0x36'),_0x501470);odbc[_0xdafd('0x37')](function(_0x401964){if(_0x401964){logger[_0xdafd('0x30')](_0xdafd('0x38'),_0x401964);}_0x3dbdb1(null,_0x436201);});}});}});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x39')]=function(_0x3f25c2,_0x2605d2){this[_0xdafd('0x11')][_0xdafd('0x3a')](_0x3f25c2)[_0xdafd('0x15')](function(_0x21d43d){_0x2605d2(null,_0x21d43d?_0x21d43d:![]);})['catch'](function(_0x5e68a7){_0x2605d2(_0x5e68a7);});};AGIVertices[_0xdafd('0x13')]['createSmsMessage']=function(_0x12d1ab,_0xde0f32){this['rpc']['createSmsMessage'](_0x12d1ab)[_0xdafd('0x15')](function(_0x3382d3){_0xde0f32(null,_0x3382d3);})[_0xdafd('0x16')](function(_0x1b0e3a){_0xde0f32(_0x1b0e3a);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x3b')]=function(_0x3a3a14,_0x2417f8,_0x11446c){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xdafd('0x10')][_0xdafd('0x3c')],'node':_0x3a3a14[_0xdafd('0x3d')],'application':_0x3a3a14[_0xdafd('0x3e')],'data':_0x2417f8||null,'project_name':this[_0xdafd('0x10')][_0xdafd('0x3f')],'callerid':this[_0xdafd('0x10')][_0xdafd('0x40')]})[_0xdafd('0x15')](function(_0x4694f1){if(_0x11446c){_0x11446c(null,_0x4694f1);}})[_0xdafd('0x16')](function(_0x3a9505){if(_0x11446c){_0x11446c(_0x3a9505);}});};AGIVertices[_0xdafd('0x13')]['createSquareRecording']=function(_0x43c44a,_0x536227,_0x57aea9,_0x4d30c3){this[_0xdafd('0x11')][_0xdafd('0x41')]({'uniqueid':this[_0xdafd('0x10')][_0xdafd('0x3c')],'callerid':this[_0xdafd('0x10')][_0xdafd('0x40')],'calleridname':this['channel'][_0xdafd('0x42')],'context':this[_0xdafd('0x10')][_0xdafd('0x43')],'extension':this[_0xdafd('0x10')][_0xdafd('0x44')],'priority':this['channel']['priority'],'accountcode':this[_0xdafd('0x10')][_0xdafd('0x45')],'dnid':this[_0xdafd('0x10')][_0xdafd('0x46')],'projectName':this[_0xdafd('0x10')][_0xdafd('0x3f')],'saveName':_0x536227,'filename':_0x43c44a[_0xdafd('0x47')]||_0x536227,'savePath':_0x57aea9})[_0xdafd('0x15')](function(_0x2ae4cd){_0x4d30c3(null,_0x2ae4cd);})['catch'](function(_0x6f2f39){_0x4d30c3(_0x6f2f39);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x48')]=function(_0x4555f1,_0x4f204a,_0xf8fcb8,_0x343ef5,_0x254824){this[_0xdafd('0x11')][_0xdafd('0x48')]({'uniqueid':this['channel']['uniqueid'],'body':_0x4555f1,'direction':_0x4f204a,'providerName':_0xf8fcb8,'providerResponse':_0x343ef5})[_0xdafd('0x15')](function(_0x261dc1){if(_0x254824){_0x254824(null,_0x261dc1);}})['catch'](function(_0x5334c3){if(_0x254824){_0x254824(_0x5334c3);}});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x49')]=function(_0x4b138b,_0x2dde06){this[_0xdafd('0x11')][_0xdafd('0x49')]({'firstName':_['isEmpty'](_0x4b138b['name'])||_[_0xdafd('0x4a')](_0x4b138b[_0xdafd('0x18')])?'callback_'+Math[_0xdafd('0x4b')]():_0x4b138b['name'],'lastName':_['isEmpty'](_0x4b138b[_0xdafd('0x4c')])||_[_0xdafd('0x4a')](_0x4b138b[_0xdafd('0x4c')])?null:_0x4b138b[_0xdafd('0x4c')],'phone':_0x4b138b[_0xdafd('0x4d')],'ListId':_0x4b138b[_0xdafd('0x4e')],'scheduledat':_0x4b138b[_0xdafd('0x4f')],'callbackUniqueid':this[_0xdafd('0x10')]['uniqueid'],'tags':_0xdafd('0x50'),'description':_0xdafd('0x51')+_0x4b138b['scheduledAt'][_0xdafd('0x52')](),'priority':_0x4b138b[_0xdafd('0x53')]})[_0xdafd('0x15')](function(_0x126529){_0x2dde06(null,_0x126529);})[_0xdafd('0x16')](function(_0x556f7e){_0x2dde06(_0x556f7e);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x54')]=function(_0x32340c,_0x3f480c){this[_0xdafd('0x11')]['getPauseById'](_0x32340c)[_0xdafd('0x15')](function(_0x810d30){_0x3f480c(null,_0x810d30?_0x810d30['name']:![]);})['catch'](function(_0x219a25){_0x3f480c(_0x219a25);});};AGIVertices['prototype'][_0xdafd('0x55')]=function(_0x4a8ca1,_0x47130c,_0x12c412){var _0x403a3b={'role':'agent'};_0x403a3b[_0x4a8ca1]=this[_0xdafd('0x10')]['callerid'];this[_0xdafd('0x11')][_0xdafd('0x55')](_0x403a3b,_0x47130c,this['channel'][_0xdafd('0x3c')])[_0xdafd('0x15')](function(_0x2846aa){_0x12c412(null,_[_0xdafd('0x4a')](_0x2846aa)?![]:!![]);})[_0xdafd('0x16')](function(_0x4a651e){logger[_0xdafd('0x30')](_0x4a651e);_0x12c412(null,![]);});};AGIVertices[_0xdafd('0x13')]['agentUnpause']=function(_0x316699,_0x46b3fb){var _0x1f5cd2={'role':_0xdafd('0x56')};_0x1f5cd2[_0x316699]=this[_0xdafd('0x10')]['callerid'];this[_0xdafd('0x11')]['agentUnpause'](_0x1f5cd2)['then'](function(_0x2bac93){_0x46b3fb(null,_['isNil'](_0x2bac93)?![]:!![]);})[_0xdafd('0x16')](function(_0x221822){logger[_0xdafd('0x30')](_0x221822);_0x46b3fb(null,![]);});};AGIVertices[_0xdafd('0x13')]['agentLogout']=function(_0x2a9785,_0x40f234){var _0x3f080b={'role':_0xdafd('0x56')};_0x3f080b[_0x2a9785]=this[_0xdafd('0x10')][_0xdafd('0x40')];this[_0xdafd('0x11')][_0xdafd('0x57')](_0x3f080b)[_0xdafd('0x15')](function(_0xbd4ab5){_0x40f234(null,_[_0xdafd('0x4a')](_0xbd4ab5)?![]:!![]);})[_0xdafd('0x16')](function(_0x24a8f2){logger[_0xdafd('0x30')](_0x24a8f2);_0x40f234(null,![]);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x58')]=function(_0x190930,_0x54267d){var _0x30cef1={'role':'agent'};_0x30cef1[_0x190930]=this[_0xdafd('0x10')]['callerid'];var _0x378243=_0x190930!=_0xdafd('0x59')?util['format']('%s/%s@from-sip/n',_0xdafd('0x5a'),this[_0xdafd('0x10')][_0xdafd('0x40')]):undefined;this['rpc']['agentLogin'](_0x30cef1,_0x378243)['then'](function(_0xfe8337){_0x54267d(null,_['isNil'](_0xfe8337)?![]:!![]);})[_0xdafd('0x16')](function(_0x5ee392){logger[_0xdafd('0x30')](_0x5ee392);_0x54267d(null,![]);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x5b')]=function(_0x27e2c9,_0x3f64fe){sh['exec'](_['trim'](_0x27e2c9),function(_0x17b2a9,_0x58b353){var _0x26d218=_0x58b353[_0xdafd('0x5c')](/(\r\n|\n|\r)/gm,'');_0x3f64fe(null,_0x26d218);});};AGIVertices['prototype'][_0xdafd('0x5d')]=function(_0x397a4e,_0x4bfc18){scripts[_0xdafd('0x5d')](_0x397a4e[_0xdafd('0x5e')],_0x397a4e[_0xdafd('0x5f')]||_0xdafd('0x60'),_0x397a4e[_0xdafd('0x60')],_0x397a4e['languageCode']||_0xdafd('0x61'),_0x397a4e[_0xdafd('0x62')]||'MALE',_0x397a4e[_0xdafd('0x63')]||_0xdafd('0x64'))['then'](function(_0x28b09a){_0x4bfc18(null,_0x28b09a);})[_0xdafd('0x16')](function(_0x56adcd){_0x4bfc18(_0x56adcd);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x65')]=function(_0x1e47bf,_0x547571){scripts[_0xdafd('0x65')](_0x1e47bf[_0xdafd('0x60')],_0x1e47bf[_0xdafd('0x66')]||'en',0x1)[_0xdafd('0x15')](function(_0x4ad46f){_0x547571(null,_0x4ad46f);})['catch'](function(_0x42138e){_0x547571(_0x42138e);});};AGIVertices[_0xdafd('0x13')]['restAPI']=function(_0x3bbf21,_0x3d3862){var _0x6f3fec={'uri':_0x3bbf21[_0xdafd('0x67')],'method':_0x3bbf21[_0xdafd('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3bbf21[_0xdafd('0x69')])==='number'&&parseInt(_0x3bbf21[_0xdafd('0x69')])>=0x1?parseInt(_0x3bbf21[_0xdafd('0x69')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xdafd('0x6a'),_0xdafd('0x6b')],_0x6f3fec[_0xdafd('0x68')][_0xdafd('0x6c')]())){try{_0x6f3fec[_0xdafd('0x6d')]=_0x3bbf21[_0xdafd('0xd')]?JSON[_0xdafd('0x6e')](_0x3bbf21[_0xdafd('0xd')]):{};}catch(_0x28f9b3){logger[_0xdafd('0x30')](_0xdafd('0x6f'),_0x28f9b3);}}try{_0x6f3fec['headers']=_0x3bbf21[_0xdafd('0xc')]?JSON[_0xdafd('0x6e')](_0x3bbf21[_0xdafd('0xc')]):{};}catch(_0x42da9f){logger[_0xdafd('0x30')](_0xdafd('0x70'),_0x42da9f);}if(_0x3bbf21[_0xdafd('0x71')]){try{var _0x207098=require(_0x3bbf21[_0xdafd('0x71')])[_0xdafd('0x72')](this,_0x6f3fec);_0x6f3fec[_0xdafd('0x73')]=Mustache['render'](_0x3bbf21[_0xdafd('0x67')],_0x207098,{},['$$','$$']);if(_0x6f3fec[_0xdafd('0x74')]){_0x6f3fec['headers']=JSON[_0xdafd('0x6e')](Mustache[_0xdafd('0x75')](JSON[_0xdafd('0x76')](_0x6f3fec['headers']),_0x207098,{},['$$','$$']));}if(_0x6f3fec[_0xdafd('0x6d')]){_0x6f3fec['body']=JSON[_0xdafd('0x6e')](Mustache[_0xdafd('0x75')](JSON['stringify'](_0x6f3fec[_0xdafd('0x6d')]),_0x207098,{},['$$','$$']));}}catch(_0x1f8091){logger[_0xdafd('0x30')](_0xdafd('0x77'),_0x1f8091);}}rp(_0x6f3fec)[_0xdafd('0x15')](function(_0x2d8032){var _0x3328b1={'statusCode':_0x2d8032[_0xdafd('0x78')]||0xc8,'statusMessage':_0x2d8032[_0xdafd('0x79')]||'OK','headers':_0x2d8032[_0xdafd('0x74')]||{},'body':_0x2d8032[_0xdafd('0x6d')]||{}};_0x3d3862(null,_0x3328b1);})[_0xdafd('0x16')](function(_0x4f6984){var _0x5d8327={'statusCode':_0x4f6984[_0xdafd('0x78')]||0x1f4,'statusMessage':_0x4f6984[_0xdafd('0x7a')]||_0xdafd('0x7b'),'headers':_0x4f6984[_0xdafd('0x7c')][_0xdafd('0x74')]||{},'body':_0x4f6984[_0xdafd('0x7c')][_0xdafd('0x6d')]||{}};_0x3d3862(null,_0x5d8327);});};AGIVertices[_0xdafd('0x13')]['googleDialogflow']=function(_0x705220,_0x368142){scripts[_0xdafd('0x7d')](this[_0xdafd('0x10')]['uniqueid'],_0x705220['key'],_0x705220['text'],_0x705220[_0xdafd('0x7e')]||'en')['then'](function(_0x2f25d5){_0x368142(null,_0x2f25d5);})[_0xdafd('0x16')](function(_0x143221){_0x368142(_0x143221);});};AGIVertices[_0xdafd('0x13')]['googleDialogflowV2']=function(_0xed0633,_0x16172d){scripts[_0xdafd('0x7f')](this[_0xdafd('0x10')][_0xdafd('0x3c')],_0xed0633['dialogflowV2_project_id'],_0xed0633[_0xdafd('0x80')],_0xed0633['private_key'],_0xed0633[_0xdafd('0x60')],_0xed0633[_0xdafd('0x81')]||'en')['then'](function(_0x352f74){_0x16172d(null,_0x352f74);})[_0xdafd('0x16')](function(_0x4d4d66){_0x16172d(_0x4d4d66);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x82')]=function(_0x1387da,_0x54d7db){scripts[_0xdafd('0x82')](this['channel'],_0x1387da)[_0xdafd('0x15')](function(_0x1d8287){_0x54d7db(null,_0x1d8287);})[_0xdafd('0x16')](function(_0x2d5dd4){_0x54d7db(_0x2d5dd4);});};AGIVertices['prototype']['ispeechTTS']=function(_0x393693,_0x1a6070){scripts[_0xdafd('0x83')](_0x393693[_0xdafd('0x84')],_0x393693[_0xdafd('0x60')],_0x393693[_0xdafd('0x85')]||_0xdafd('0x61'),_0x393693[_0xdafd('0x86')])['then'](function(_0xc3f3af){_0x1a6070(null,_0xc3f3af);})[_0xdafd('0x16')](function(_0x105d18){_0x1a6070(_0x105d18);});};AGIVertices[_0xdafd('0x13')]['ispeechASR']=function(_0x2fd239,_0x342ed1,_0x4e5072){scripts[_0xdafd('0x87')](_0x342ed1,_0x2fd239[_0xdafd('0x84')],_0x2fd239['ispeech_asr_language']||_0xdafd('0x61'),this['isConfigured'](_0x2fd239[_0xdafd('0x88')])?_0x2fd239[_0xdafd('0x88')]:undefined)[_0xdafd('0x15')](function(_0x1ae8d1){_0x4e5072(null,_0x1ae8d1);})['catch'](function(_0x5b5236){_0x4e5072(_0x5b5236);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x89')]=function(_0x5e16af,_0x258696){scripts[_0xdafd('0x89')](_0x5e16af[_0xdafd('0x8a')],_0x5e16af[_0xdafd('0x8b')],_0x5e16af['aws_polly_region'],_0x5e16af[_0xdafd('0x8c')]||'Amy',_0x5e16af[_0xdafd('0x60')],_0x5e16af[_0xdafd('0x8d')]||_0xdafd('0x60'))['then'](function(_0x3d1d8e){_0x258696(null,_0x3d1d8e);})['catch'](function(_0x186980){_0x258696(_0x186980);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x8e')]=function(_0x3fa782,_0x1dfb3e){scripts[_0xdafd('0x8e')](this[_0xdafd('0x10')]['uniqueid'],_0x3fa782[_0xdafd('0x8a')],_0x3fa782[_0xdafd('0x8b')],_0x3fa782[_0xdafd('0x8f')],_0x3fa782['text'],_0x3fa782[_0xdafd('0x90')])['then'](function(_0x82945c){_0x1dfb3e(null,_0x82945c);})[_0xdafd('0x16')](function(_0x2bceca){_0x1dfb3e(_0x2bceca);});};AGIVertices[_0xdafd('0x13')]['googleASR']=function(_0x470e0b,_0x2ab87a,_0x5ffaaf){scripts[_0xdafd('0x91')](_0x2ab87a,_0x470e0b[_0xdafd('0x84')],_0x470e0b['google_asr_language']||_0xdafd('0x61'))['then'](function(_0x1268f2){_0x5ffaaf(null,_0x1268f2);})[_0xdafd('0x16')](function(_0x5e404e){_0x5ffaaf(_0x5e404e);});};AGIVertices['prototype'][_0xdafd('0x92')]=function(_0x214ea6,_0x519d21,_0x440a3f){scripts['tildeASR'](_0x519d21,_0x214ea6[_0xdafd('0x93')],_0x214ea6[_0xdafd('0x94')],_0x214ea6[_0xdafd('0x73')])[_0xdafd('0x15')](function(_0x1175a8){_0x440a3f(null,_0x1175a8);})[_0xdafd('0x16')](function(_0x143526){_0x440a3f(_0x143526);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x95')]=function(_0x227a8e){var _0x42fd4a=_[_0xdafd('0x96')](verticesWithRetry,_0x227a8e[_0xdafd('0x3e')])?_0x227a8e:_['clone'](_0x227a8e);for(var _0x2eb72e in _0x42fd4a){if(_0x42fd4a[_0xdafd('0x97')](_0x2eb72e)){if(_0x42fd4a[_0x2eb72e]&&_[_0xdafd('0x98')](_0x42fd4a[_0x2eb72e])){if(_['includes'](recursiveMapAttributes,_0x2eb72e)){_0x42fd4a[_0x2eb72e]=this[_0xdafd('0x99')](_0x42fd4a[_0x2eb72e]);}else{_0x42fd4a[_0x2eb72e]=this['replaceAllVariables'](_0x42fd4a[_0x2eb72e]);}}}}return _0x42fd4a;};AGIVertices[_0xdafd('0x13')][_0xdafd('0x9a')]=function(_0x677036){for(var _0x418fcc in _0x677036){if(_0x677036['hasOwnProperty'](_0x418fcc)){if(_[_0xdafd('0x9b')](_0x677036[_0x418fcc])){this[_0xdafd('0x9a')](_0x677036[_0x418fcc]);}else if(_[_0xdafd('0x9c')](_0x677036[_0x418fcc])){for(var _0x1fb5c3=0x0;_0x1fb5c3<_0x677036[_0x418fcc][_0xdafd('0x9d')];_0x1fb5c3++){this[_0xdafd('0x9a')](_0x677036[_0x418fcc][_0x1fb5c3]);}}else if(_[_0xdafd('0x98')](_0x677036[_0x418fcc])){_0x677036[_0x418fcc]=this[_0xdafd('0x9e')](_0x677036[_0x418fcc]);}}}};AGIVertices[_0xdafd('0x13')]['saveRestApiResult']=function(_0xd7384e,_0x47e4a2){for(var _0x5cbc6f in _0xd7384e){if(_0xd7384e[_0xdafd('0x97')](_0x5cbc6f)){if(_[_0xdafd('0x9b')](_0xd7384e[_0x5cbc6f])){if(!_['isEmpty'](_0xd7384e[_0x5cbc6f])){this[_0xdafd('0x9f')](_0xd7384e[_0x5cbc6f],util[_0xdafd('0x2c')](_0xdafd('0xa0'),_0x47e4a2,_0x5cbc6f));}}else if(_[_0xdafd('0x9c')](_0xd7384e[_0x5cbc6f])){for(var _0x5a49ab=0x0;_0x5a49ab<_0xd7384e[_0x5cbc6f][_0xdafd('0x9d')];_0x5a49ab++){this[_0xdafd('0x9f')](_0xd7384e[_0x5cbc6f][_0x5a49ab],util[_0xdafd('0x2c')](_0xdafd('0xa0'),_0x47e4a2,_0x5cbc6f+'['+_0x5a49ab+']'));}}else{if(!_[_0xdafd('0x4a')](_0xd7384e[_0x5cbc6f])){this[_0xdafd('0x10')][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0xa0'),_0x47e4a2,_0x5cbc6f),_0xd7384e[_0x5cbc6f]);}}}}};AGIVertices[_0xdafd('0x13')][_0xdafd('0x99')]=function(_0x52d5fc){try{var _0x5bf65a=JSON[_0xdafd('0x6e')](_0x52d5fc);this[_0xdafd('0x9a')](_0x5bf65a);return JSON[_0xdafd('0x76')](_0x5bf65a);}catch(_0x4d862a){return this['replaceAllVariables'](_0x52d5fc);}};AGIVertices[_0xdafd('0x13')]['replaceAllVariables']=function(_0x3a34d4){var _0x382d68=_0x3a34d4[_0xdafd('0xa2')]('{');for(var _0x48acb9=0x1;_0x48acb9<_0x382d68[_0xdafd('0x9d')];_0x48acb9+=0x1){var _0x13d7e9=_0x382d68[_0x48acb9][_0xdafd('0xa2')]('}');if(_0x13d7e9['length']>0x1){_0x3a34d4=_0x3a34d4[_0xdafd('0xa3')]('{'+_0x13d7e9[0x0]+'}',this[_0xdafd('0x10')][_0xdafd('0xa4')](_0x13d7e9[0x0])[_0xdafd('0xa5')]||_0x13d7e9[0x0]);}}if(_0x382d68[_0xdafd('0x9d')]===0x1){return _0x3a34d4[_0xdafd('0x52')]();}return this[_0xdafd('0x9e')](_0x3a34d4);};AGIVertices['prototype'][_0xdafd('0xa6')]=function(_0x44d6f4,_0x54ae4d){var _0x2f7717=this[_0xdafd('0x10')][_0xdafd('0xa4')](_0x44d6f4);if(_0x2f7717[_0xdafd('0xa7')]===-0x1){return _0x2f7717;}logger['info'](util[_0xdafd('0x2c')](_0xdafd('0xa8'),_0x54ae4d,_0x2f7717[_0xdafd('0xa5')]));return this['channel']['setVariable'](_0x54ae4d,_0x2f7717['extra']);};AGIVertices[_0xdafd('0x13')][_0xdafd('0xa9')]=function(_0x440ba8){return _0x440ba8&&_0x440ba8!=='0'&&_0x440ba8!=='-1'&&_0x440ba8!=='';};AGIVertices[_0xdafd('0x13')][_0xdafd('0xaa')]=function(_0x3b115f){this[_0xdafd('0x3b')]['sync'](this,_0x3b115f,'-');_0x3b115f[_0xdafd('0xab')]=_0x3b115f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xdafd('0x13')][_0xdafd('0xac')]=function(_0x208eaf){logger[_0xdafd('0x32')](util['format'](_0xdafd('0xad'),_0x208eaf['label']));if(!this[_0xdafd('0xa9')](_0x208eaf['text'])){return this['channel'][_0xdafd('0xae')](_0xdafd('0xaf'));}var _0x4b988a='\x22'+_0x208eaf[_0xdafd('0x60')]+'\x22';if(this['isConfigured'](_0x208eaf[_0xdafd('0x7c')])){_0x4b988a+=','+_0x208eaf[_0xdafd('0x7c')];}var _0x1f65b5=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0xb1'),_0x4b988a);if(_0x1f65b5[_0xdafd('0xa7')]===-0x1){return _0x1f65b5;}return this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0xb2'),_0x4b988a));};AGIVertices['prototype'][_0xdafd('0xb3')]=function(_0x2fecf0){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0xb4'),_0x2fecf0[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x2fecf0[_0xdafd('0xb5')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xb6'));}var _0x54323b=_0x2fecf0[_0xdafd('0xb5')];if(this[_0xdafd('0xa9')](_0x2fecf0['options'])){_0x54323b+=','+_0x2fecf0[_0xdafd('0x7c')];}var _0x1e1c28=this[_0xdafd('0x10')]['exec'](_0xdafd('0xb7'),_0x54323b);if(_0x1e1c28[_0xdafd('0xa7')]===-0x1){return _0x1e1c28;}var _0x5bb826=this[_0xdafd('0xa6')](_0xdafd('0xb8'),_0xdafd('0xb9'));if(_0x5bb826['result']===-0x1){return _0x5bb826;}var _0x47f86f=this[_0xdafd('0xa6')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x47f86f[_0xdafd('0xa7')]===-0x1){return _0x47f86f;}var _0x22636d=this['getAndSetVariable'](_0xdafd('0xba'),_0xdafd('0xbb'));if(_0x22636d['result']===-0x1){return _0x22636d;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x54323b));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x8')]=function(_0x5795db){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0xbc'),_0x5795db[_0xdafd('0x3d')]));return this[_0xdafd('0x10')]['agi']([_0x5795db[_0xdafd('0xbd')],_0x5795db[_0xdafd('0xbe')]]);};AGIVertices[_0xdafd('0x13')][_0xdafd('0xbf')]=function(_0x5b7512){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5b7512['label']));if(this[_0xdafd('0xa9')](_0x5b7512[_0xdafd('0x69')])){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0xc0'),_0x5b7512['timeout']));var _0x40fe4a=this['channel'][_0xdafd('0xc1')](_0x5b7512[_0xdafd('0x69')]);if(_0x40fe4a[_0xdafd('0xa7')]===-0x1){return _0x40fe4a;}}return this[_0xdafd('0x10')]['answer']();};AGIVertices['prototype'][_0xdafd('0x50')]=function(_0x49397e){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x49397e['label']));if(!this['isConfigured'](_0x49397e[_0xdafd('0x4e')])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x49397e,'no\x20list\x20selected');}_0x49397e[_0xdafd('0x4f')]=moment();if(this[_0xdafd('0xa9')](_0x49397e[_0xdafd('0xc2')])){_0x49397e[_0xdafd('0x4f')]=moment()['add'](_0x49397e['delay'],'minutes');}if(!this[_0xdafd('0xa9')](_0x49397e[_0xdafd('0x53')])){_0x49397e[_0xdafd('0x53')]=0x2;}this[_0xdafd('0x49')][_0xdafd('0x72')](this,_0x49397e);return this[_0xdafd('0x10')]['noop'](util['format'](_0xdafd('0xc3'),_0x49397e[_0xdafd('0x4d')],_0x49397e[_0xdafd('0x4e')],_0x49397e['scheduledAt']));};AGIVertices['prototype'][_0xdafd('0xc4')]=function(_0x4eaa42){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4eaa42[_0xdafd('0x3d')]));var _0x262b98=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0x4eaa42[_0xdafd('0xc5')],_0x4eaa42['options']);if(_0x262b98[_0xdafd('0xa7')]===-0x1){return _0x262b98;}return this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xc6'),_0x4eaa42[_0xdafd('0xc5')],_0x4eaa42['options']));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xc7')]=function(_0x34ac6b){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x34ac6b['label']));if(!this[_0xdafd('0xa9')](_0x34ac6b['text'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}var _0x993caa='\x22'+_0x34ac6b[_0xdafd('0x60')]+'\x22';if(this[_0xdafd('0xa9')](_0x34ac6b['options'])){_0x993caa+=','+_0x34ac6b[_0xdafd('0x7c')];}var _0x38e41a=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0xb1'),_0x993caa);if(_0x38e41a[_0xdafd('0xa7')]===-0x1){return _0x38e41a;}return this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x993caa));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xc8')]=function(_0x177f08){logger[_0xdafd('0x32')](util['format'](_0xdafd('0xc9'),_0x177f08['label']));if(!this[_0xdafd('0xa9')](_0x177f08[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}var _0x341ab1='\x22'+_0x177f08[_0xdafd('0x60')]+'\x22';if(this[_0xdafd('0xa9')](_0x177f08['options'])){_0x341ab1+=','+_0x177f08[_0xdafd('0x7c')];}var _0x57517c=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0xb1'),_0x341ab1);if(_0x57517c[_0xdafd('0xa7')]===-0x1){return _0x57517c;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xb2'),_0x341ab1));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xca')]=function(_0x5b823e){logger[_0xdafd('0x32')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5b823e['label']));if(!this['isConfigured'](_0x5b823e[_0xdafd('0xb5')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0xb6'));}var _0x1449ab=_0x5b823e[_0xdafd('0xb5')];if(this[_0xdafd('0xa9')](_0x5b823e[_0xdafd('0x7c')])){_0x1449ab+=','+_0x5b823e['options'];}var _0x64e1c7=this[_0xdafd('0x10')]['exec'](_0xdafd('0xb7'),_0x1449ab);if(_0x64e1c7['result']===-0x1){return _0x64e1c7;}var _0x8d3e3d=this[_0xdafd('0xa6')](_0xdafd('0xb8'),_0xdafd('0xcb'));if(_0x8d3e3d[_0xdafd('0xa7')]===-0x1){return _0x8d3e3d;}var _0x212ba8=this[_0xdafd('0xa6')](_0xdafd('0xcc'),_0xdafd('0xcd'));if(_0x212ba8[_0xdafd('0xa7')]===-0x1){return _0x212ba8;}var _0x424940=this[_0xdafd('0xa6')](_0xdafd('0xba'),'LUMENVOX_ASR_INSTANCE');if(_0x424940[_0xdafd('0xa7')]===-0x1){return _0x424940;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0xce'),_0x1449ab));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xcf')]=function(_0x587633){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0xd0'),_0x587633[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x587633[_0xdafd('0xb5')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xb6'));}var _0x36346e=_0x587633[_0xdafd('0xb5')];if(this['isConfigured'](_0x587633[_0xdafd('0x7c')])){_0x36346e+=','+_0x587633[_0xdafd('0x7c')];}var _0x498a2b=this[_0xdafd('0x10')]['exec'](_0xdafd('0xb7'),_0x36346e);if(_0x498a2b[_0xdafd('0xa7')]===-0x1){return _0x498a2b;}var _0x49965b=this['getAndSetVariable'](_0xdafd('0xb8'),_0xdafd('0xd1'));if(_0x49965b[_0xdafd('0xa7')]===-0x1){return _0x49965b;}var _0x5d19fd=this[_0xdafd('0xa6')](_0xdafd('0xcc'),_0xdafd('0xd2'));if(_0x5d19fd[_0xdafd('0xa7')]===-0x1){return _0x5d19fd;}var _0xc25a42=this[_0xdafd('0xa6')](_0xdafd('0xba'),_0xdafd('0xd3'));if(_0xc25a42[_0xdafd('0xa7')]===-0x1){return _0xc25a42;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xce'),_0x36346e));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xd4')]=function(_0xe5f90a){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0xd5'),_0xe5f90a[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0xe5f90a[_0xdafd('0xd6')])){return this['channel'][_0xdafd('0x30')](_0xe5f90a,_0xdafd('0xd7'));}var _0x306540=this[_0xdafd('0x19')][_0xdafd('0x72')](this,_0xe5f90a['odbc_id']);if(!_0x306540){return this[_0xdafd('0x10')]['error'](_0xe5f90a,'no\x20odbc\x20database\x20found');}if(!this[_0xdafd('0xa9')](_0xe5f90a[_0xdafd('0x34')])){return this['channel']['error'](_0xe5f90a,_0xdafd('0xd8'));}var _0x1cd2f1=_0xe5f90a[_0xdafd('0x34')][_0xdafd('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xdafd('0xae')](util['format'](_0xdafd('0xd9'),_0x1cd2f1));var _0x4ec24b=this[_0xdafd('0x2e')][_0xdafd('0x72')](this,_0x306540,_0x1cd2f1);this['createSquareDetailsReport'][_0xdafd('0x72')](this,_0xe5f90a,_0x1cd2f1);if(!this[_0xdafd('0xa9')](_0xe5f90a[_0xdafd('0xda')])){return this['channel']['noop'](_0xdafd('0xdb'));}var _0xe87b91=this['getVariable'][_0xdafd('0x72')](this,_0xe5f90a[_0xdafd('0xda')]);if(!_0xe87b91){return this[_0xdafd('0x10')]['error'](_0xe5f90a,_0xdafd('0xdc'));}var _0x3cc897=this;_0x4ec24b[_0xdafd('0xdd')](function(_0x41a23e,_0x5322cb){Object['keys'](_0x41a23e)['forEach'](function(_0x37184b){_0x3cc897['channel']['setVariable'](util[_0xdafd('0x2c')](_0xdafd('0xde'),_0xe87b91,_0x5322cb,_0x37184b),_0x41a23e[_0x37184b]);});});this[_0xdafd('0x10')]['setVariable'](util[_0xdafd('0x2c')](_0xdafd('0xdf'),_0xe87b91),_0x4ec24b[_0xdafd('0x9d')]);return this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0xe0'),_0xe87b91));};AGIVertices['prototype'][_0xdafd('0xe1')]=function(_0x367256){logger[_0xdafd('0xe2')](util[_0xdafd('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x367256[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x367256[_0xdafd('0xe3')])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x367256,_0xdafd('0xe4'));}var _0x3d1deb=this[_0xdafd('0x1c')][_0xdafd('0x72')](this,_0x367256[_0xdafd('0xe3')]);if(!_0x3d1deb){return this[_0xdafd('0x10')]['error'](_0x367256,_0xdafd('0xe5'));}var _0x3632d4=this[_0xdafd('0x10')][_0xdafd('0xb0')]('DIAL',[util[_0xdafd('0x2c')](_0xdafd('0xe6'),_0x3d1deb),_0x367256[_0xdafd('0x69')],_0x367256[_0xdafd('0xe7')],_0x367256['url']]);if(_0x3632d4[_0xdafd('0xa7')]===-0x1){return _0x3632d4;}return this['channel']['noop'](util[_0xdafd('0x2c')](_0xdafd('0xe8'),_0xdafd('0xe9')));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xea')]=function(_0x5bbebc){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0xeb'),_0x5bbebc['label']));if(!this[_0xdafd('0xa9')](_0x5bbebc[_0xdafd('0x84')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xec'));}if(!this[_0xdafd('0xa9')](_0x5bbebc[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20text\x20configured');}this['channel'][_0xdafd('0xed')]=!![];this[_0xdafd('0x3b')](_0x5bbebc);this['createSquareMessage'](_0x5bbebc['text'],'in','','');this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xee'),_0x5bbebc[_0xdafd('0x60')]));var _0x1b9a74=this['googleDialogflow'][_0xdafd('0x72')](this,_0x5bbebc);if(_0x1b9a74){for(var _0xa4384 in _0x1b9a74){if(_0x1b9a74['hasOwnProperty'](_0xa4384)){this['channel'][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0xef'),_0xa4384['toUpperCase']()),_0x1b9a74[_0xa4384]);}}this[_0xdafd('0x48')](_0x1b9a74['speech'],'out',_0xdafd('0xea'),'');return this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0xf0'),_0x1b9a74[_0xdafd('0xf1')]));}return this[_0xdafd('0x10')]['error'](_0x5bbebc,_0xdafd('0xf2'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xf3')]=function(_0x43e6c5){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0xf4'),_0x43e6c5[_0xdafd('0x3d')]));if(!this['isConfigured'](_0x43e6c5[_0xdafd('0xf5')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xf6'));}if(!this[_0xdafd('0xa9')](_0x43e6c5[_0xdafd('0x80')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xf7'));}if(!this['isConfigured'](_0x43e6c5[_0xdafd('0xf8')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0xf9'));}if(!this[_0xdafd('0xa9')](_0x43e6c5[_0xdafd('0x81')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0xfa'));}if(!this[_0xdafd('0xa9')](_0x43e6c5[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')][_0xdafd('0xed')]=!![];this[_0xdafd('0x3b')](_0x43e6c5);this[_0xdafd('0x48')](_0x43e6c5[_0xdafd('0x60')],'in','','');this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xfb'),_0x43e6c5['text']));var _0x26107a=this[_0xdafd('0x7f')]['sync'](this,_0x43e6c5);if(_0x26107a){for(var _0x95c234 in _0x26107a){if(_0x26107a['hasOwnProperty'](_0x95c234)){if(_0x95c234!==_0xdafd('0xfc')){this['channel'][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0xef'),_0x95c234[_0xdafd('0x6c')]()),_0x26107a[_0x95c234]);}}}this['createSquareMessage'](_0x26107a[_0xdafd('0xf1')],'out',_0xdafd('0xf3'),_0x26107a[_0xdafd('0xfc')]);return this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xfd'),_0x26107a[_0xdafd('0xf1')]));}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x43e6c5,_0xdafd('0xfe'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xff')]=function(_0x35f0cc){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x100'),_0x35f0cc[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x35f0cc[_0xdafd('0x101')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x102'));}if(!this[_0xdafd('0xa9')](_0x35f0cc[_0xdafd('0x103')])){return this['channel'][_0xdafd('0xae')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x35f0cc['password'])){return this['channel'][_0xdafd('0xae')](_0xdafd('0x104'));}if(!this[_0xdafd('0xa9')](_0x35f0cc[_0xdafd('0x105')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')][_0xdafd('0xed')]=!![];this[_0xdafd('0x3b')](_0x35f0cc);this[_0xdafd('0x48')](_0x35f0cc[_0xdafd('0x60')],'in','','');this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0x106'),_0x35f0cc[_0xdafd('0x60')]));var _0x5ef632=this[_0xdafd('0x82')][_0xdafd('0x72')](this,_0x35f0cc);if(_0x5ef632){for(var _0x2a1a05 in _0x5ef632){if(_0x5ef632[_0xdafd('0x97')](_0x2a1a05)){this['channel']['setVariable'](util['format']('SESTEK_NDA_%s',_0x2a1a05['toUpperCase']()),_0x5ef632[_0x2a1a05]);}}this[_0xdafd('0x48')](_0x5ef632[_0xdafd('0xf1')],'out',_0xdafd('0xff'),'');if(_0x5ef632[_0xdafd('0x107')]){this[_0xdafd('0x10')][_0xdafd('0xae')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x5ef632[_0xdafd('0x107')]));var _0xbe0421=this['channel'][_0xdafd('0x108')](_0x5ef632['audiofile']);try{fs[_0xdafd('0x109')](_0x5ef632[_0xdafd('0x107')]+_0xdafd('0x10a'));}catch(_0x498600){logger[_0xdafd('0x30')](_0x498600);}return _0xbe0421;}else{return this[_0xdafd('0x10')][_0xdafd('0xae')](util['format']('SestekNDA\x20Result\x20%s',_0x5ef632[_0xdafd('0xf1')]));}}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x35f0cc,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x4185b3){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x10b'),_0x4185b3[_0xdafd('0x3d')]));return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x10c'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x10d')]=function(_0x3ecaa0){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x10e'),_0x3ecaa0['label']));var _0x5e4ad6='';if(_0x3ecaa0[_0xdafd('0x10f')]){if(!this[_0xdafd('0xa9')](_0x3ecaa0['trunk_id'])){return this['channel'][_0xdafd('0x30')](_0x3ecaa0,_0xdafd('0x110'));}else{var _0x35db11=parseInt(_0x3ecaa0[_0xdafd('0x10f')],0xa);if(isNaN(_0x35db11)){_0x5e4ad6=_0x3ecaa0[_0xdafd('0x10f')];}else{_0x5e4ad6=this['getTrunk']['sync'](this,_0x3ecaa0[_0xdafd('0x10f')]);if(!_0x5e4ad6){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x3ecaa0,_0xdafd('0x111'));}}}}else if(_0x3ecaa0[_0xdafd('0x112')]){_0x5e4ad6=_0x3ecaa0[_0xdafd('0x112')];}else{return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x3ecaa0,'no\x20trunk\x20selected');}var _0x3740a8=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0xe9'),[util[_0xdafd('0x2c')](_0xdafd('0x113'),_0x5e4ad6,_0x3ecaa0['phone']),_0x3ecaa0[_0xdafd('0x69')],_0x3ecaa0[_0xdafd('0xe7')],_0x3ecaa0['url']]);if(_0x3740a8[_0xdafd('0xa7')]===-0x1){return _0x3740a8;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('Executed\x20command\x20%s',_0xdafd('0xe9')));};AGIVertices['prototype'][_0xdafd('0x114')]=function(_0x20c472){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x20c472['label']));return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x114'));};AGIVertices['prototype'][_0xdafd('0x115')]=function(_0xe45dc5){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x116'),_0xe45dc5['label']));if(_0xe45dc5['retry']===0x0){return this[_0xdafd('0xaa')](_0xe45dc5);}_0xe45dc5[_0xdafd('0xab')]-=0x1;if(!this['isConfigured'](_0xe45dc5['file_id'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0xe45dc5,_0xdafd('0x117'));}var _0x2dc23b=this[_0xdafd('0x20')][_0xdafd('0x72')](this,_0xe45dc5[_0xdafd('0x118')]);if(!_0x2dc23b){return this['channel'][_0xdafd('0x30')](_0xe45dc5,_0xdafd('0x119'));}if(!this[_0xdafd('0xa9')](_0xe45dc5['variable_id'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0xdafd('0xdb'));}var _0x4ed1e2=this[_0xdafd('0x10')][_0xdafd('0x11a')](_0x2dc23b,_0xe45dc5[_0xdafd('0x11b')],_0xe45dc5[_0xdafd('0x11c')]);var _0x25a681=_0x4ed1e2[_0xdafd('0xa7')]?_0x4ed1e2[_0xdafd('0xa7')]['toString']():'';logger[_0xdafd('0x32')](_0xdafd('0x11d'),JSON[_0xdafd('0x76')](_0x4ed1e2));if(_0x4ed1e2[_0xdafd('0xa7')]===-0x1){this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0xe45dc5,_0x25a681);return _0x4ed1e2;}else if(_0x4ed1e2[_0xdafd('0xa5')]===_0xdafd('0x69')){_0x4ed1e2[_0xdafd('0xa7')]=_0x25a681[_0xdafd('0x9d')]>=parseInt(_0xe45dc5[_0xdafd('0x11e')])?'x':'i';}else{_0x4ed1e2['result']=_0x25a681[_0xdafd('0x9d')]>=parseInt(_0xe45dc5[_0xdafd('0x11e')])&&_0x25a681['length']<=parseInt(_0xe45dc5[_0xdafd('0x11c')])?'x':'i';}var _0xa0dd9=this['getVariable'][_0xdafd('0x72')](this,_0xe45dc5[_0xdafd('0xda')]);if(!_0xa0dd9){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0xe45dc5,_0xdafd('0xdc'));}this[_0xdafd('0x10')]['setVariable'](_0xa0dd9,_0x25a681);if(this['isConfigured'](_0xe45dc5['hiddendigitsnum'])){var _0x3b18b3=parseInt(_0xe45dc5[_0xdafd('0x11f')],0xa);var _0x1c994a=rs['generate']({'charset':'*','length':_0x3b18b3});var _0x31baa1=_0x25a681[_0xdafd('0x9d')];if(_0x31baa1>0x0){if(_0x31baa1>_0x3b18b3){this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0xe45dc5,_0xe45dc5[_0xdafd('0x120')]===_0xdafd('0x121')?_0x1c994a+_0x25a681[_0xdafd('0x122')](_0x3b18b3):_0x25a681[_0xdafd('0x122')](0x0,_0x31baa1-_0x3b18b3)+_0x1c994a);}else{this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0xe45dc5,rs['generate']({'charset':'*','length':_0x31baa1}));}}else{this[_0xdafd('0x3b')]['sync'](this,_0xe45dc5,'');}}else{this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0xe45dc5,_0x25a681);}return _0x4ed1e2;};AGIVertices[_0xdafd('0x13')]['getsecretdigits']=function(_0x4efc45){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x123'),_0x4efc45[_0xdafd('0x3d')]));return this['getdigits'](_0x4efc45);};AGIVertices['prototype'][_0xdafd('0x124')]=function(_0x20535a){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x125'),_0x20535a[_0xdafd('0x3d')]));this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x20535a,_0x20535a[_0xdafd('0x126')]);return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x127'),_0x20535a[_0xdafd('0x126')]));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x128')]=function(_0x4b4e24){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x129'),_0x4b4e24[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x4b4e24[_0xdafd('0x8a')])||!this['isConfigured'](_0x4b4e24[_0xdafd('0x8b')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0x12a'));}if(!this[_0xdafd('0xa9')](_0x4b4e24[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('Trying\x20aws\x20Polly\x20%s',_0x4b4e24[_0xdafd('0x60')]));var _0x5f8402=this[_0xdafd('0x89')][_0xdafd('0x72')](this,_0x4b4e24);if(_0x5f8402){this['channel'][_0xdafd('0xae')](util['format'](_0xdafd('0x12b'),_0x5f8402));var _0x14174d=this['channel'][_0xdafd('0x108')](_0x5f8402);try{fs[_0xdafd('0x109')](_0x5f8402+_0xdafd('0x10a'));}catch(_0x21bda4){logger[_0xdafd('0x30')](_0x21bda4);}return _0x14174d;}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x4b4e24,_0xdafd('0x12c'));};AGIVertices['prototype'][_0xdafd('0x12d')]=function(_0x318866){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x12e'),_0x318866['label']));if(!this[_0xdafd('0xa9')](_0x318866[_0xdafd('0x8a')])||!this[_0xdafd('0xa9')](_0x318866[_0xdafd('0x8b')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0x12a'));}if(!this[_0xdafd('0xa9')](_0x318866['aws_bot_name'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x12f'));}if(!this[_0xdafd('0xa9')](_0x318866['text'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}this['channel'][_0xdafd('0xed')]=!![];this[_0xdafd('0x3b')](_0x318866);this['createSquareMessage'](_0x318866[_0xdafd('0x60')],'in','','');this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x130'),_0x318866[_0xdafd('0x60')]));var _0x76a8c7=this[_0xdafd('0x8e')]['sync'](this,_0x318866);if(_0x76a8c7){for(var _0x24b4b3 in _0x76a8c7){if(_0x76a8c7[_0xdafd('0x97')](_0x24b4b3)&&_[_0xdafd('0x98')](_0x76a8c7[_0x24b4b3])){this[_0xdafd('0x10')][_0xdafd('0xa1')](util[_0xdafd('0x2c')]('AWS_LEX_%s',_0x24b4b3[_0xdafd('0x6c')]()),_0x76a8c7[_0x24b4b3]);}}if(_[_0xdafd('0x4a')](_0x76a8c7['message'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x131'));}else{this['createSquareMessage'](_0x76a8c7[_0xdafd('0x7a')],_0xdafd('0x132'),'amazonlex','');return this[_0xdafd('0x10')][_0xdafd('0xae')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x76a8c7['message']));}}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x318866,_0xdafd('0x133'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x134')]=function(_0x1a5ebf){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x135'),_0x1a5ebf[_0xdafd('0x3d')],_0x1a5ebf['timeout']));if(!this['isConfigured'](_0x1a5ebf[_0xdafd('0x84')])){return this['channel']['noop'](_0xdafd('0xec'));}var _0x463794='wav';var _0x2f64ac=util[_0xdafd('0x2c')](_0xdafd('0x136'),FILES_PATH,rs[_0xdafd('0x137')](0x4));var _0x3162f6=util['format']('%s.%s',_0x2f64ac,_0x463794);var _0x147d67=!![];if(_0x1a5ebf[_0xdafd('0x138')]===_0xdafd('0x139')){_0x147d67=![];}var _0x109c54=this[_0xdafd('0x10')]['recordFile'](_0x2f64ac,_0x463794,_0x1a5ebf['intKey'],_0x1a5ebf['timeout'],undefined,_0x147d67);if(_0x109c54['result']!==-0x1){this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x13a'),_0x3162f6));var _0x58a581=this[_0xdafd('0x91')]['sync'](this,_0x1a5ebf,_0x3162f6);if(_0x58a581){for(var _0x248a52 in _0x58a581){if(_0x58a581[_0xdafd('0x97')](_0x248a52)){this[_0xdafd('0x10')][_0xdafd('0xa1')](util[_0xdafd('0x2c')]('GOOGLE_ASR_%s',_0x248a52[_0xdafd('0x6c')]()),_0x58a581[_0x248a52]);}}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x13b'),JSON[_0xdafd('0x76')](_0x58a581)));}}return _0x109c54;};AGIVertices[_0xdafd('0x13')][_0xdafd('0x13c')]=function(_0x4bc4c7){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x13d'),_0x4bc4c7[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x4bc4c7[_0xdafd('0x93')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0x13e'));}if(!this[_0xdafd('0xa9')](_0x4bc4c7['appsecret'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x13f'));}var _0x37b6a8=_0xdafd('0x140');var _0x3324ba=util[_0xdafd('0x2c')](_0xdafd('0x136'),FILES_PATH,rs[_0xdafd('0x137')](0x4));var _0x1bc7be=util['format'](_0xdafd('0xa0'),_0x3324ba,_0x37b6a8);var _0x1fc41f=!![];if(_0x4bc4c7[_0xdafd('0x138')]===_0xdafd('0x139')){_0x1fc41f=![];}var _0x52e244=this[_0xdafd('0x10')]['recordFile'](_0x3324ba,_0x37b6a8,_0x4bc4c7[_0xdafd('0x141')],_0x4bc4c7[_0xdafd('0x69')],undefined,_0x1fc41f);if(_0x52e244[_0xdafd('0xa7')]!==-0x1){this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x142'),_0x1bc7be));var _0x41f268=this[_0xdafd('0x92')]['sync'](this,_0x4bc4c7,_0x1bc7be);if(_0x41f268){for(var _0x35259c in _0x41f268){if(_0x41f268[_0xdafd('0x97')](_0x35259c)){this[_0xdafd('0x10')][_0xdafd('0xa1')](util['format'](_0xdafd('0x143'),_0x35259c[_0xdafd('0x6c')]()),_0x41f268[_0x35259c]);}}return this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x144'),JSON['stringify'](_0x41f268)));}}return _0x52e244;};AGIVertices[_0xdafd('0x13')][_0xdafd('0x145')]=function(_0x6cdcb8){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x146'),_0x6cdcb8[_0xdafd('0x3d')]));return this['channel']['continueAt'](_0x6cdcb8[_0xdafd('0x43')],_0x6cdcb8[_0xdafd('0x44')],_0x6cdcb8[_0xdafd('0x147')]);};AGIVertices[_0xdafd('0x13')]['gotoif']=function(_0x2411ce){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x148'),_0x2411ce[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x2411ce[_0xdafd('0x149')])){return this['channel']['error'](_0x2411ce,_0xdafd('0x14a'));}try{var _0x390c7a=eval(_0x2411ce[_0xdafd('0x149')])?_0xdafd('0x14b'):_0xdafd('0x14c');this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x14d'),_0x2411ce[_0xdafd('0x149')],_0x390c7a));return{'code':0xc8,'result':_0x390c7a};}catch(_0x32a09f){return{'code':0xc8,'result':_0xdafd('0x14c')};}};AGIVertices[_0xdafd('0x13')][_0xdafd('0x14e')]=function(_0x26ddbd){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x14f'),_0x26ddbd[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x26ddbd[_0xdafd('0x150')])){return this['channel']['error'](_0x26ddbd,_0xdafd('0x151'));}var _0x249cee=this[_0xdafd('0x26')][_0xdafd('0x72')](this,_0x26ddbd['interval_id']);if(!_0x249cee){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x26ddbd,_0xdafd('0x152'));}for(var _0x109681=0x0;_0x109681<_0x249cee[_0xdafd('0x9d')];_0x109681+=0x1){var _0x59550e=this['channel'][_0xdafd('0xa4')](util[_0xdafd('0x2c')]('IFTIME(%s?true:false)',_0x249cee[_0x109681]));if(_0x59550e['result']===-0x1){return _0x59550e;}logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x153'),_0x249cee[_0x109681],_0x59550e[_0xdafd('0xa5')]));if(_0x59550e[_0xdafd('0xa5')]===_0xdafd('0x14b')){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x153'),_0x249cee[_0x109681],_0xdafd('0x14b')));this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x153'),_0x249cee[_0x109681],_0xdafd('0x14b')));return{'code':0xc8,'result':_0xdafd('0x14b')};}else{logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('IFTIME\x20%s\x20%s',_0x249cee[_0x109681],_0xdafd('0x14c')));this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('IFTIME\x20%s\x20%s',_0x249cee[_0x109681],_0xdafd('0x14c')));}}return{'code':0xc8,'result':_0xdafd('0x14c')};};AGIVertices[_0xdafd('0x13')][_0xdafd('0x154')]=function(_0x44bd1b){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x155'),_0x44bd1b[_0xdafd('0x3d')]));return this[_0xdafd('0x10')]['hangup']();};AGIVertices['prototype'][_0xdafd('0x156')]=function(_0x49650b){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x157'),_0x49650b['label']));if(!this[_0xdafd('0xa9')](_0x49650b[_0xdafd('0x84')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0xec'));}var _0x4a9ae9='wav';var _0x4a3175=util[_0xdafd('0x2c')](_0xdafd('0x136'),FILES_PATH,rs['generate'](0x4));var _0x50b4b3=util[_0xdafd('0x2c')](_0xdafd('0xa0'),_0x4a3175,_0x4a9ae9);var _0x5cdd57=!![];if(_0x49650b[_0xdafd('0x138')]==='NOBEEP'){_0x5cdd57=![];}var _0x1078ee=this[_0xdafd('0x10')][_0xdafd('0x158')](_0x4a3175,_0x4a9ae9,_0x49650b[_0xdafd('0x141')],_0x49650b[_0xdafd('0x69')],undefined,_0x5cdd57);if(_0x1078ee[_0xdafd('0xa7')]!==-0x1){this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x159'),_0x50b4b3));var _0x103adc=this[_0xdafd('0x87')][_0xdafd('0x72')](this,_0x49650b,_0x50b4b3);if(_0x103adc){for(var _0x3e8800 in _0x103adc){if(_0x103adc['hasOwnProperty'](_0x3e8800)){this['channel'][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0x15a'),_0x3e8800[_0xdafd('0x6c')]()),_0x103adc[_0x3e8800]);}}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('IspeechASR\x20Result\x20%s',JSON[_0xdafd('0x76')](_0x103adc)));}}return _0x1078ee;};AGIVertices[_0xdafd('0x13')][_0xdafd('0x15b')]=function(_0x19a56e){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x15c'),_0x19a56e[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x19a56e['key'])){return this['channel']['noop'](_0xdafd('0xec'));}if(!this[_0xdafd('0xa9')](_0x19a56e[_0xdafd('0x60')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0xaf'));}this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x15d'),_0x19a56e[_0xdafd('0x60')]));var _0x511016=this[_0xdafd('0x83')]['sync'](this,_0x19a56e);if(_0x511016){this[_0xdafd('0x10')][_0xdafd('0xae')](util['format']('ispeech\x20%s\x20file\x20created',_0x511016));var _0x1c1c70=this[_0xdafd('0x10')][_0xdafd('0x108')](_0x511016,_0x19a56e['intKey']);try{fs['unlink'](_0x511016+_0xdafd('0x10a'));}catch(_0x2e492d){logger['error'](_0x2e492d);}return _0x1c1c70;}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x19a56e,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xdafd('0x15e')]=function(_0x1ea98c){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x15f'),_0x1ea98c[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x1ea98c['findBy'])){return this['channel'][_0xdafd('0x30')](_0x1ea98c,'no\x20find\x20by\x20configured');}logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x160'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));var _0x1968b6=this[_0xdafd('0x58')][_0xdafd('0x72')](this,_0x1ea98c[_0xdafd('0x161')]);if(_0x1968b6){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));return{'code':0xc8,'result':'success'};}else{logger[_0xdafd('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdafd('0x10')][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x163')};}};AGIVertices[_0xdafd('0x13')][_0xdafd('0x164')]=function(_0x22d7d5){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x165'),_0x22d7d5['label']));if(!this['isConfigured'](_0x22d7d5[_0xdafd('0x161')])){return this[_0xdafd('0x10')]['error'](_0x22d7d5,_0xdafd('0x166'));}logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x160'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x22d7d5['findBy']));var _0x4944e9=this[_0xdafd('0x57')][_0xdafd('0x72')](this,_0x22d7d5[_0xdafd('0x161')]);if(_0x4944e9){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x22d7d5['findBy']));this['channel'][_0xdafd('0xae')](util['format'](_0xdafd('0x162'),this[_0xdafd('0x10')]['callerid'],_0x22d7d5[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x167')};}else{logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x168'),this['channel'][_0xdafd('0x40')],_0x22d7d5[_0xdafd('0x161')]));this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0x168'),this[_0xdafd('0x10')]['callerid'],_0x22d7d5[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x163')};}};AGIVertices[_0xdafd('0x13')]['math']=function(_0x2cb5ac){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x169'),_0x2cb5ac[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x2cb5ac['operation'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x2cb5ac,_0xdafd('0x16a'));}this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x16b'),_0x2cb5ac[_0xdafd('0x16c')]));var _0x578464=eval(_0x2cb5ac['operation']);if(!this[_0xdafd('0xa9')](_0x2cb5ac[_0xdafd('0xda')])){return this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3d86fe=this[_0xdafd('0xa4')]['sync'](this,_0x2cb5ac[_0xdafd('0xda')]);if(!_0x3d86fe){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x2cb5ac,_0xdafd('0xdc'));}if(_[_0xdafd('0x9c')](_0x578464)){var _0x42aebc=this;_0x578464[_0xdafd('0xdd')](function(_0x41e8c,_0x48f2d8){_0x42aebc[_0xdafd('0x10')][_0xdafd('0xa1')](util['format'](_0xdafd('0x16d'),_0x3d86fe,_0x48f2d8),_0x41e8c);});return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x16e'),_0x3d86fe));}else{return this[_0xdafd('0x10')]['setVariable'](_0x3d86fe,_0x578464);}};AGIVertices[_0xdafd('0x13')][_0xdafd('0xe')]=function(_0x4b7c66){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x16f'),_0x4b7c66[_0xdafd('0x3d')]));if(_0x4b7c66['retry']===0x0){return this[_0xdafd('0xaa')](_0x4b7c66);}_0x4b7c66[_0xdafd('0xab')]-=0x1;if(!this[_0xdafd('0xa9')](_0x4b7c66[_0xdafd('0x118')])){return this[_0xdafd('0x10')]['error'](_0x4b7c66,_0xdafd('0x117'));}var _0x39f310=this[_0xdafd('0x20')][_0xdafd('0x72')](this,_0x4b7c66[_0xdafd('0x118')]);if(!_0x39f310){return this['channel'][_0xdafd('0x30')](_0x4b7c66,_0xdafd('0x119'));}var _0x59ac9e=this[_0xdafd('0x10')][_0xdafd('0x11a')](_0x39f310,_0x4b7c66['response'],_0x4b7c66[_0xdafd('0x170')]);var _0x278bf8=_0x59ac9e[_0xdafd('0xa7')];if(_0x59ac9e[_0xdafd('0xa7')]===-0x1){this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x4b7c66,'-1');return _0x59ac9e;}else if(_0x59ac9e[_0xdafd('0xa5')]==='timeout'){_0x59ac9e[_0xdafd('0xa7')]=_0x59ac9e['result'][_0xdafd('0x9d')]>0x0?_0x59ac9e[_0xdafd('0xa7')]:'t';}else if(_[_0xdafd('0x171')](_0x59ac9e[_0xdafd('0xa7')])){_0x59ac9e[_0xdafd('0xa7')]='#';_0x278bf8='#';}if(!this[_0xdafd('0xa9')](_0x4b7c66[_0xdafd('0xda')])){this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x27a89d=this['getVariable'][_0xdafd('0x72')](this,_0x4b7c66[_0xdafd('0xda')]);if(!_0x27a89d){return this['channel']['error'](_0x4b7c66,_0xdafd('0xdc'));}this[_0xdafd('0x10')][_0xdafd('0xa1')](_0x27a89d,_0x278bf8);}this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x4b7c66,_0x278bf8);return _0x59ac9e;};AGIVertices['prototype'][_0xdafd('0xae')]=function(_0x24e894){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x24e894[_0xdafd('0x3d')]));return this[_0xdafd('0x10')][_0xdafd('0xae')](_0x24e894[_0xdafd('0x172')]||_0x24e894[_0xdafd('0x3d')]);};AGIVertices['prototype']['pause']=function(_0xf4f25b){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x173'),_0xf4f25b['label']));if(!this[_0xdafd('0xa9')](_0xf4f25b[_0xdafd('0x161')])){return this[_0xdafd('0x10')]['error'](_0xf4f25b,_0xdafd('0x166'));}logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xdafd('0x10')][_0xdafd('0x40')],_0xf4f25b[_0xdafd('0x161')]));var _0xacf4b6=this[_0xdafd('0x54')][_0xdafd('0x72')](this,_0xf4f25b[_0xdafd('0x174')]);var _0x15b4e2=this[_0xdafd('0x55')][_0xdafd('0x72')](this,_0xf4f25b['findBy'],_0xacf4b6);if(_0x15b4e2){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0xf4f25b[_0xdafd('0x161')]));this['channel']['noop'](util['format'](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0xf4f25b[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x167')};}else{logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0xf4f25b['findBy']));this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0xf4f25b[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x163')};}};AGIVertices[_0xdafd('0x13')]['playback']=function(_0x4020ac){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x175'),_0x4020ac[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x4020ac['file_id'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x4020ac,'no\x20file\x20audio\x20selected');}var _0x575161=this[_0xdafd('0x20')][_0xdafd('0x72')](this,_0x4020ac[_0xdafd('0x118')]);if(!_0x575161){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x4020ac,_0xdafd('0x119'));}var _0x1c0811=this[_0xdafd('0x10')]['exec'](_0xdafd('0x176'),[_0x575161,_0x4020ac['opts']]);if(_0x1c0811[_0xdafd('0xa7')]===-0x1){return _0x1c0811;}return this['channel']['noop'](util[_0xdafd('0x2c')](_0xdafd('0xc6'),_0xdafd('0x176'),_0x575161));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x177')]=function(_0x192697){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x178'),_0x192697['label']));if(!this[_0xdafd('0xa9')](_0x192697[_0xdafd('0x179')])){return this['channel']['error'](_0x192697,'no\x20queue\x20selected');}var _0x28a9ca='';var _0x208a44=parseInt(_0x192697['queue_id'],0xa);if(isNaN(_0x208a44)){_0x28a9ca=_0x192697[_0xdafd('0x179')];}else{_0x28a9ca=this[_0xdafd('0x17')][_0xdafd('0x72')](this,_0x192697['queue_id']);if(!_0x28a9ca){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x192697,_0xdafd('0x17a'));}}var _0xd8588c='';if(this[_0xdafd('0xa9')](_0x192697[_0xdafd('0x118')])){var _0xc7d026=this[_0xdafd('0x20')][_0xdafd('0x72')](this,_0x192697[_0xdafd('0x118')]);if(_0xc7d026){_0xd8588c=_0xc7d026;}}this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x192697,_0x28a9ca);if(_0x192697['opts'][_0xdafd('0x17b')]('x')<0x0){_0x192697['opts']+='x';}if(_0x192697[_0xdafd('0xe7')][_0xdafd('0x17b')]('X')<0x0){_0x192697['opts']+='X';}this[_0xdafd('0x10')][_0xdafd('0xa1')](_0xdafd('0x17c'),_0x28a9ca?_0x28a9ca[_0xdafd('0x17d')]():'');var _0x4c74e4=this[_0xdafd('0x10')]['exec']('QUEUE',[_0x28a9ca,_0x192697[_0xdafd('0xe7')],_0x192697[_0xdafd('0x67')],_0xd8588c,_0x192697[_0xdafd('0x69')],_0x192697['agi'],_0x192697[_0xdafd('0x17e')],_0x192697['gosub'],'',_0x192697[_0xdafd('0x17f')]]);if(_0x4c74e4[_0xdafd('0xa7')]===-0x1){return _0x4c74e4;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xc6'),_0xdafd('0x180'),_0x28a9ca));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x181')]=function(_0x19ff82){logger['info'](util['format'](_0xdafd('0x182'),_0x19ff82[_0xdafd('0x3d')]));var _0x294478=_0x19ff82['recordingFormat']||_0xdafd('0x140');var _0x24e3e6=util[_0xdafd('0x2c')]('%s_%s',this[_0xdafd('0x10')][_0xdafd('0x3c')],rs[_0xdafd('0x137')](0x5));var _0x3286c5=util[_0xdafd('0x2c')](_0xdafd('0x183'),FILES_PATH,_0x24e3e6,_0x294478);var _0x232bff=util[_0xdafd('0x2c')](_0xdafd('0x136'),FILES_PATH,_0x24e3e6);this[_0xdafd('0x41')][_0xdafd('0x72')](this,_0x19ff82,_0x24e3e6,_0x3286c5);this[_0xdafd('0x10')]['setVariable'](_0xdafd('0x184'),_0x24e3e6);logger[_0xdafd('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x232bff,_0x294478,_0x19ff82[_0xdafd('0x185')],_0x19ff82[_0xdafd('0x69')]);return this[_0xdafd('0x10')]['recordFile'](_0x232bff,_0x294478,_0x19ff82['escape_digits'],_0x19ff82[_0xdafd('0x69')],undefined,!![]);};AGIVertices[_0xdafd('0x13')]['restapi']=function(_0x1e7591){logger['info'](util['format'](_0xdafd('0x186'),_0x1e7591[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x1e7591[_0xdafd('0x67')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0x187'));}var _0x4960ee=this[_0xdafd('0x188')]['sync'](this,_0x1e7591);logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x189'),util[_0xdafd('0x18a')](_0x4960ee,{'showHidden':![],'depth':null})));if(!this[_0xdafd('0xa9')](_0x1e7591[_0xdafd('0xda')])){return this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x308328=this[_0xdafd('0xa4')][_0xdafd('0x72')](this,_0x1e7591[_0xdafd('0xda')]);if(!_0x308328){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x1e7591,_0xdafd('0xdc'));}this[_0xdafd('0x10')][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0x18b'),_0x308328),_0x4960ee[_0xdafd('0x78')]?_0x4960ee[_0xdafd('0x78')]:'200');this[_0xdafd('0x10')][_0xdafd('0xa1')](util['format'](_0xdafd('0x18c'),_0x308328),_0x4960ee[_0xdafd('0x79')]?_0x4960ee[_0xdafd('0x79')]:'OK');if(_0x4960ee[_0xdafd('0x6d')]){try{this[_0xdafd('0x9f')](_0x4960ee[_0xdafd('0x6d')],_0x308328);}catch(_0x192478){logger[_0xdafd('0x30')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x308328));}}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xe0'),_0x308328));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x18d')]=function(_0x18d1f3){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x18e'),_0x18d1f3[_0xdafd('0x3d')]));return this[_0xdafd('0x10')][_0xdafd('0x18f')](_0x18d1f3[_0xdafd('0x190')][_0xdafd('0x5c')](/\s+/g,''),_0x18d1f3['escape_digits']);};AGIVertices['prototype'][_0xdafd('0x191')]=function(_0x338884){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x338884[_0xdafd('0x3d')]));return this['channel'][_0xdafd('0x192')](_0x338884[_0xdafd('0x193')][_0xdafd('0x5c')](/\s+/g,''),_0x338884[_0xdafd('0x185')]);};AGIVertices[_0xdafd('0x13')][_0xdafd('0x194')]=function(_0x33e927){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x195'),_0x33e927['label']));return this[_0xdafd('0x10')]['sayPhonetic'](_0x33e927[_0xdafd('0x60')],_0x33e927[_0xdafd('0x185')]);};AGIVertices[_0xdafd('0x13')][_0xdafd('0x196')]=function(_0x1633af){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x197'),_0x1633af['label']));if(!this['isConfigured'](_0x1633af[_0xdafd('0x198')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x199'));}var _0x4ea75a=this[_0xdafd('0x19a')]['sync'](this,_0x1633af[_0xdafd('0x198')]);if(!_0x4ea75a||!_0x4ea75a['Smtp']){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x1633af,_0xdafd('0x19b'));}var _0x1ab19e={'from':util[_0xdafd('0x2c')]('\x22%s\x22\x20<%s>',_0x4ea75a[_0xdafd('0x18')],_0x4ea75a['email']||_0x4ea75a[_0xdafd('0x19c')][_0xdafd('0x19d')]),'to':_0x1633af['to']||'','cc':_0x1633af['cc']||'','bcc':_0x1633af['bcc']||'','subject':_0x1633af[_0xdafd('0x19e')],'html':_0x1633af[_0xdafd('0x60')],'text':_0x1633af[_0xdafd('0x60')]};if(this['isConfigured'](_0x1633af[_0xdafd('0x19f')])){}logger[_0xdafd('0xe2')]('sendMail\x20message',JSON[_0xdafd('0x76')](_0x1ab19e));this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x1633af,_0x1633af['account_id']);this['channel']['noop'](util[_0xdafd('0x2c')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4ea75a[_0xdafd('0x18')]));this['sendMailMessage'][_0xdafd('0x72')](this,_0x4ea75a[_0xdafd('0x1a0')],_0x1ab19e);return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1a1'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1a2')]=function(_0x4edcd8){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4edcd8[_0xdafd('0x3d')]));return this['channel'][_0xdafd('0xae')](_0xdafd('0x1a3'));};AGIVertices['prototype'][_0xdafd('0x1a4')]=function(_0x2d4b8e){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2d4b8e[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x2d4b8e['sms_account_id'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1a5'));}var _0x127edd=this[_0xdafd('0x39')]['sync'](this,_0x2d4b8e['sms_account_id']);if(!_0x127edd){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x2d4b8e,_0xdafd('0x1a6'));}var _0x30e98f={'body':_0x2d4b8e[_0xdafd('0x1a7')],'phone':_0x2d4b8e['to']||'','SmsAccountId':_0x127edd['id']};logger[_0xdafd('0xe2')](_0xdafd('0x1a8'),JSON['stringify'](_0x30e98f));this['createSquareDetailsReport'][_0xdafd('0x72')](this,_0x2d4b8e,_0x2d4b8e[_0xdafd('0x1a9')]);this[_0xdafd('0x10')]['noop'](util['format'](_0xdafd('0x1aa'),_0x127edd['name']));this[_0xdafd('0x1ab')][_0xdafd('0x72')](this,_0x30e98f);return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1ac'));};AGIVertices['prototype'][_0xdafd('0x1ad')]=function(_0x34cc13){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x34cc13[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x34cc13[_0xdafd('0xda')])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x34cc13,'no\x20variable\x20selected');}var _0x32b33e=this[_0xdafd('0xa4')][_0xdafd('0x72')](this,_0x34cc13[_0xdafd('0xda')]);if(!_0x32b33e){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x34cc13,_0xdafd('0xdc'));}return this['channel']['setVariable'](_0x32b33e,_0x34cc13[_0xdafd('0x1ae')]);};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1af')]=function(_0x4b69f3){logger['info'](util['format'](_0xdafd('0x1b0'),_0x4b69f3[_0xdafd('0x3d')]));this['channel']['noop'](_0xdafd('0x1b1'));var _0x1736ff=this[_0xdafd('0x10')]['getVariable']('XMCS-UNIQUEID');if(!_[_0xdafd('0x171')](_0x1736ff[_0xdafd('0xa5')])){this[_0xdafd('0x10')][_0xdafd('0x3c')]=_0x1736ff[_0xdafd('0xa5')];}if(_0x4b69f3[_0xdafd('0xbf')]===_0xdafd('0x1b2')){this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1b3'));return this[_0xdafd('0x10')]['answer']();}return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1b4'));};AGIVertices[_0xdafd('0x13')]['subproject']=function(_0x564bb8){logger['info'](util['format'](_0xdafd('0x1b5'),_0x564bb8[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x564bb8['project_id'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x564bb8,'no\x20subproject\x20selected');}var _0x3ddf4e=this[_0xdafd('0x1b6')][_0xdafd('0x72')](this,_0x564bb8[_0xdafd('0x1b7')]);if(!this[_0xdafd('0xa9')](_0x3ddf4e)){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x564bb8,util[_0xdafd('0x2c')](_0xdafd('0x1b8'),_0x564bb8[_0xdafd('0x1b7')]));}if(_0x3ddf4e===this[_0xdafd('0x10')][_0xdafd('0x3f')]){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x564bb8,_0xdafd('0x1b9'));}this['createSquareDetailsReport'][_0xdafd('0x72')](this,_0x564bb8,_0x3ddf4e);var _0x4c9c92=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0x1ba'),util[_0xdafd('0x2c')](_0xdafd('0x1bb'),config[_0xdafd('0x8')][_0xdafd('0x1bc')]||_0xdafd('0x1bd'),_0x3ddf4e,this[_0xdafd('0x10')][_0xdafd('0x3f')]));if(_0x4c9c92[_0xdafd('0xa7')]===-0x1){return _0x4c9c92;}return this['channel'][_0xdafd('0xae')](util['format'](_0xdafd('0xc6'),'AGI',_0x3ddf4e));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1be')]=function(_0x31dbab){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x1bf'),_0x31dbab['label']));var _0x489e53=this[_0xdafd('0x5b')][_0xdafd('0x72')](this,_0x31dbab[_0xdafd('0xbd')]);this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x31dbab,_0x31dbab[_0xdafd('0xbd')]);if(this[_0xdafd('0xa9')](_0x31dbab[_0xdafd('0xda')])){var _0x214c52=this[_0xdafd('0xa4')][_0xdafd('0x72')](this,_0x31dbab[_0xdafd('0xda')]);if(_0x214c52){this['channel'][_0xdafd('0xa1')](_0x214c52,_0x489e53);return this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x1c0'),_0x31dbab[_0xdafd('0xbd')],_0x214c52));}}return this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x1c1'),_0x31dbab[_0xdafd('0xbd')]));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1c2')]=function(_0x3b0aa7){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3b0aa7['label']));_0x3b0aa7[_0xdafd('0x60')]=_0x3b0aa7[_0xdafd('0x60')][_0xdafd('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdafd('0xa9')](_0x3b0aa7[_0xdafd('0x5e')])){return this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20apiKey\x20configured');}if(!this[_0xdafd('0xa9')](_0x3b0aa7[_0xdafd('0x60')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x1c3'),_0x3b0aa7[_0xdafd('0x60')]));var _0x3c489f=this[_0xdafd('0x5d')]['sync'](this,_0x3b0aa7);if(_0x3c489f){this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x1c4'),_0x3c489f));var _0x30ea13=this[_0xdafd('0x10')][_0xdafd('0x108')](_0x3c489f);try{fs[_0xdafd('0x109')](_0x3c489f+_0xdafd('0x10a'));}catch(_0x247df7){logger[_0xdafd('0x30')](_0x247df7);}return _0x30ea13;}return this['channel'][_0xdafd('0x30')](_0x3b0aa7,_0xdafd('0x1c5'));};AGIVertices['prototype'][_0xdafd('0x1c6')]=function(_0x5cd58e){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x1c7'),_0x5cd58e[_0xdafd('0x3d')]));_0x5cd58e[_0xdafd('0x60')]=_0x5cd58e[_0xdafd('0x60')][_0xdafd('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdafd('0xa9')](_0x5cd58e[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')]('Trying\x20Google\x20TTS\x20%s',_0x5cd58e[_0xdafd('0x60')]));var _0x4dbd7b=this[_0xdafd('0x65')][_0xdafd('0x72')](this,_0x5cd58e);if(_0x4dbd7b){this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')]('Google\x20TTS\x20%s\x20file\x20created',_0x4dbd7b));var _0x3da425=this[_0xdafd('0x10')]['streamFile'](_0x4dbd7b);try{fs[_0xdafd('0x109')](_0x4dbd7b+'.wav');}catch(_0x7a7252){logger[_0xdafd('0x30')](_0x7a7252);}return _0x3da425;}return this['channel'][_0xdafd('0x30')](_0x5cd58e,_0xdafd('0x1c8'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1c9')]=function(_0x2234a6){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2234a6[_0xdafd('0x3d')]));if(!this['isConfigured'](_0x2234a6['findBy'])){return this[_0xdafd('0x10')]['error'](_0x2234a6,_0xdafd('0x166'));}logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x160'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x2234a6[_0xdafd('0x161')]));var _0x408eaa=this[_0xdafd('0x1ca')][_0xdafd('0x72')](this,_0x2234a6[_0xdafd('0x161')]);if(_0x408eaa){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')]['callerid'],_0x2234a6[_0xdafd('0x161')]));this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0x162'),this[_0xdafd('0x10')]['callerid'],_0x2234a6[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x167')};}else{logger['info'](util['format'](_0xdafd('0x168'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x2234a6['findBy']));this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x168'),this[_0xdafd('0x10')]['callerid'],_0x2234a6['findBy']));return{'code':0xc8,'result':_0xdafd('0x163')};}};AGIVertices[_0xdafd('0x13')]['voicemail']=function(_0x30aadd){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x30aadd['label']));var _0xc6eaf2=this[_0xdafd('0x10')]['exec'](_0xdafd('0x1cb'),[_0x30aadd[_0xdafd('0x1cc')],_0x30aadd[_0xdafd('0x7c')]]);if(_0xc6eaf2[_0xdafd('0xa7')]===-0x1){return _0xc6eaf2;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xc6'),_0xdafd('0x1cb'),_0x30aadd['mailbox']));};AGIVertices[_0xdafd('0x13')]['vswitch']=function(_0x4fbd57){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x1cd'),_0x4fbd57[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x4fbd57[_0xdafd('0xda')])){return this['channel'][_0xdafd('0x30')](_0x4fbd57,_0xdafd('0x1ce'));}var _0x5c5d5e=this['getVariable'][_0xdafd('0x72')](this,_0x4fbd57['variable_id']);if(!_0x5c5d5e){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x4fbd57,_0xdafd('0xdc'));}var _0x4dbe2e=this[_0xdafd('0x10')][_0xdafd('0xa4')](_0x5c5d5e);return{'code':0xc8,'result':_0x4dbe2e['extra']?_0x4dbe2e[_0xdafd('0xa5')]:'-'};};String[_0xdafd('0x13')]['replaceAll']=function(_0xd39485,_0x49c146){return this[_0xdafd('0xa2')](_0xd39485)[_0xdafd('0x1cf')](_0x49c146);};module[_0xdafd('0x1d0')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1e44a28..e14d5df 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 _0x5334=['[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','catch','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','timers','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','agents','resolve','getAgent','then','[%s][INPAUSE][AGENT:%s][QUEUE:%s]'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0x5334,0x84));var _0x4533=function(_0x5c10b7,_0x5a7049){_0x5c10b7=_0x5c10b7-0x0;var _0xdb8e8d=_0x5334[_0x5c10b7];return _0xdb8e8d;};'use strict';var _=require(_0x4533('0x0'));var moment=require(_0x4533('0x1'));var ami=require(_0x4533('0x2'));var logger=require(_0x4533('0x3'))(_0x4533('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x4533('0x5'));function Acw(_0x5176b5){this[_0x4533('0x6')]=_0x5176b5[_0x4533('0x6')];this['agents']=_0x5176b5['agents'];this['timers']=_0x5176b5[_0x4533('0x7')];this['channels']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x4533('0x8')](this));ami['on'](_0x4533('0x9'),this[_0x4533('0xa')][_0x4533('0x8')](this));ami['on'](_0x4533('0xb'),this[_0x4533('0xc')][_0x4533('0x8')](this));ami['on']('agentringnoanswer',this[_0x4533('0xd')][_0x4533('0x8')](this));ami['on'](_0x4533('0xe'),this[_0x4533('0xf')]['bind'](this));ami['on'](_0x4533('0x10'),this['syncBlindTransfer'][_0x4533('0x8')](this));ami['on'](_0x4533('0x11'),this[_0x4533('0x12')][_0x4533('0x8')](this));}function getDiff(_0x57ff74){var _0xdd4757=moment()[_0x4533('0x13')](0x0);var _0x187f05=moment(_0x57ff74)[_0x4533('0x13')](0x0);return _0xdd4757['diff'](_0x187f05,_0x4533('0x14'));}Acw['prototype']['updateAcw']=function(_0x466545,_0x34dea9){var _0x5da8b8=this;var _0x30c68c=getDiff(_0x5da8b8[_0x4533('0x7')][_0x466545][_0x4533('0x15')]);clearTimeout(_0x5da8b8['timers'][_0x466545][_0x4533('0x16')]);_0x5da8b8['timers'][_0x466545][_0x4533('0x16')]=![];return RpcVoiceAgentReport[_0x4533('0x17')]({'acwtime':_0x30c68c},_0x5da8b8['timers'][_0x466545][_0x4533('0x18')],_0x466545)['then'](function(_0x5c2c9c){logger[_0x4533('0x19')](_0x4533('0x1a'),_0x34dea9,_0x30c68c,_0x5c2c9c);})['catch'](function(_0x53fe43){logger[_0x4533('0x1b')](_0x4533('0x1c'),_0x34dea9,_0x53fe43);})[_0x4533('0x1d')](function(){delete _0x5da8b8[_0x4533('0x7')][_0x466545];});};Acw[_0x4533('0x1e')][_0x4533('0x1f')]=function(_0x12adde){try{var _0x5c3abb=this;var _0x231bae=this[_0x4533('0x20')][_0x12adde][_0x4533('0x21')];var _0x4aa438=this['channels'][_0x12adde][_0x4533('0x22')];var _0x11e93a=this['voiceQueues'][_0x4aa438];var _0x5dcfd2=![];var _0x307bdd=_0x4533('0x23');if(_0x11e93a[_0x4533('0x24')]&&_0x11e93a['mandatoryDispositionPause'][_0x4533('0x25')]){_0x5dcfd2=!![];_0x307bdd=_0x11e93a[_0x4533('0x26')][_0x4533('0x25')];}if(!_0x5c3abb[_0x4533('0x27')][_0x231bae]){return Promise[_0x4533('0x28')]();}return RpcUser[_0x4533('0x29')](_0x5c3abb[_0x4533('0x27')][_0x231bae]['id'])[_0x4533('0x2a')](function(_0x45ad98){if(!_0x45ad98||_0x45ad98['voicePause']){logger['info'](_0x4533('0x2b'),_0x12adde,_0x231bae,_0x4aa438);return;}logger['info'](_0x4533('0x2c'),_0x12adde,_0x231bae,_0x4aa438);var _0x4e2b80=_0x5c3abb[_0x4533('0x20')][_0x12adde][_0x4533('0x2d')]&&_0x5c3abb[_0x4533('0x20')][_0x12adde][_0x4533('0x2e')]?_0x5c3abb[_0x4533('0x20')][_0x12adde][_0x4533('0x2e')]:_0x12adde;return RpcUser[_0x4533('0x2f')](_0x5c3abb[_0x4533('0x27')][_0x231bae],_0x307bdd,_0x4e2b80);})[_0x4533('0x2a')](function(_0x43682f){if(_0x5dcfd2||!_0x43682f){return;}_0x5c3abb[_0x4533('0x7')][_0x231bae]={};logger[_0x4533('0x19')](_0x4533('0x30'),_0x12adde,_0x5c3abb['voiceQueues'][_0x4aa438][_0x4533('0x31')],_0x231bae,_0x4aa438);_0x5c3abb['timers'][_0x231bae][_0x4533('0x16')]=setTimeout(_0x5c3abb[_0x4533('0x32')][_0x4533('0x8')](_0x5c3abb,_0x231bae),_0x5c3abb[_0x4533('0x6')][_0x4aa438][_0x4533('0x31')]*0x3e8);_0x5c3abb[_0x4533('0x7')][_0x231bae][_0x4533('0x15')]=moment()[_0x4533('0x33')](_0x4533('0x34'));_0x5c3abb[_0x4533('0x7')][_0x231bae][_0x4533('0x18')]=_0x12adde;_0x5c3abb[_0x4533('0x7')][_0x231bae]['queue']=_0x4aa438;_0x5c3abb[_0x4533('0x7')][_0x231bae][_0x4533('0x35')]=_0x5c3abb[_0x4533('0x35')][_0x4533('0x8')](_0x5c3abb,_0x231bae,_0x12adde);})[_0x4533('0x36')](function(){logger['error'](_0x4533('0x30'),_0x12adde,_0x5c3abb[_0x4533('0x6')][_0x4aa438][_0x4533('0x31')],_0x231bae,_0x4aa438);})[_0x4533('0x1d')](function(){delete _0x5c3abb[_0x4533('0x20')][_0x12adde];});}catch(_0x171fc5){logger['error'](_0x4533('0x37'),_0x171fc5[_0x4533('0x38')]);}};Acw['prototype'][_0x4533('0x32')]=function(_0x1e028a){try{var _0x42807e=this;if(_0x42807e[_0x4533('0x7')][_0x1e028a]){_0x42807e[_0x4533('0x7')][_0x1e028a][_0x4533('0x16')]=![];var _0x424924=_0x42807e[_0x4533('0x7')][_0x1e028a][_0x4533('0x18')];var _0x1041d1=_0x42807e['timers'][_0x1e028a][_0x4533('0x22')];var _0x3373a8=_0x42807e[_0x4533('0x6')][_0x1041d1][_0x4533('0x31')];logger[_0x4533('0x19')](_0x4533('0x39'),_0x424924,_0x1e028a);RpcUser[_0x4533('0x3a')](this[_0x4533('0x27')][_0x1e028a]);RpcVoiceAgentReport[_0x4533('0x17')]({'acwtime':_0x3373a8,'agentacw':!![]},_0x424924,_0x1e028a)[_0x4533('0x2a')](function(_0x1890ad){logger[_0x4533('0x19')]('[%s][UPDATE][ACWTIME:%s]',_0x424924,_0x3373a8,_0x1890ad);})['catch'](function(_0x451e1b){logger['error'](_0x4533('0x1c'),_0x424924,_0x451e1b);});}else{logger[_0x4533('0x1b')](_0x4533('0x3b'),_0x1e028a);if(_0x42807e[_0x4533('0x7')]){logger[_0x4533('0x19')](_0x4533('0x3c'),JSON[_0x4533('0x3d')](_0x42807e[_0x4533('0x7')]));}}}catch(_0x11bc6b){logger[_0x4533('0x1b')](_0x4533('0x3e'),_0x11bc6b[_0x4533('0x38')]);}};Acw[_0x4533('0x1e')]['syncAgentConnect']=function(_0x1aaedc){try{if(this['voiceQueues'][_0x1aaedc['queue']]&&(this['voiceQueues'][_0x1aaedc['queue']][_0x4533('0x4')]||this[_0x4533('0x6')][_0x1aaedc[_0x4533('0x22')]][_0x4533('0x24')])){if(this['agents'][_0x1aaedc[_0x4533('0x21')]]){this[_0x4533('0x20')][_0x1aaedc[_0x4533('0x18')]]={'queue':_0x1aaedc[_0x4533('0x22')],'interface':_0x1aaedc[_0x4533('0x21')],'destlinkedid':_0x1aaedc[_0x4533('0x2e')]};}}}catch(_0x46b45c){logger['error'](_0x4533('0x3f'),_0x46b45c['message']);}};Acw['prototype'][_0x4533('0x12')]=function(_0x8cb52f){try{if(this[_0x4533('0x6')][_0x8cb52f[_0x4533('0x22')]]&&(this['voiceQueues'][_0x8cb52f['queue']][_0x4533('0x4')]||this['voiceQueues'][_0x8cb52f[_0x4533('0x22')]][_0x4533('0x24')])){if(this['agents'][_0x8cb52f['interface']]){this['channels'][_0x8cb52f['uniqueid']]={'queue':_0x8cb52f['queue'],'interface':_0x8cb52f[_0x4533('0x21')]};}}}catch(_0x4797a3){logger[_0x4533('0x1b')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4797a3[_0x4533('0x38')]);}};Acw['prototype']['syncHangupRequest']=function(_0xb46cca){try{if(this['channels'][_0xb46cca[_0x4533('0x18')]]&&_['isUndefined'](this[_0x4533('0x20')][_0xb46cca[_0x4533('0x18')]]['attended'])){logger[_0x4533('0x19')](_0x4533('0x40'),_0xb46cca[_0x4533('0x18')]);this[_0x4533('0x1f')](_0xb46cca[_0x4533('0x18')]);}else if(this['channels'][_0xb46cca[_0x4533('0x41')]]&&_[_0x4533('0x42')](this['channels'][_0xb46cca[_0x4533('0x41')]][_0x4533('0x2d')])){logger[_0x4533('0x19')](_0x4533('0x43'),_0xb46cca[_0x4533('0x41')]);this[_0x4533('0x1f')](_0xb46cca[_0x4533('0x41')]);}}catch(_0x2ce254){logger[_0x4533('0x1b')](_0x4533('0x44'),_0x2ce254[_0x4533('0x38')]);}};Acw[_0x4533('0x1e')][_0x4533('0xc')]=function(_0x36297a){try{if(this[_0x4533('0x20')][_0x36297a[_0x4533('0x18')]]&&this['channels'][_0x36297a[_0x4533('0x18')]]['attended']){logger['info'](_0x4533('0x45'),_0x36297a[_0x4533('0x18')]);this[_0x4533('0x1f')](_0x36297a[_0x4533('0x18')]);}else if(this['channels'][_0x36297a[_0x4533('0x41')]]&&this['channels'][_0x36297a['linkedid']][_0x4533('0x2d')]){logger['info'](_0x4533('0x46'),_0x36297a['linkedid']);this[_0x4533('0x1f')](_0x36297a[_0x4533('0x41')]);}}catch(_0x3847cb){logger[_0x4533('0x1b')](_0x4533('0x47'),_0x3847cb['message']);}};Acw[_0x4533('0x1e')][_0x4533('0xf')]=function(_0x3caa6d){try{if(!_['isNil'](this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x48')]])){this['startAcw'](_0x3caa6d[_0x4533('0x48')]);if(this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x49')]]){this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x49')]]['attended']=!![];this[_0x4533('0x20')][_0x3caa6d['transfertargetuniqueid']]=this['channels'][_0x3caa6d[_0x4533('0x49')]];delete this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x49')]];}}else if(!_[_0x4533('0x4a')](this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x4b')]])){this[_0x4533('0x1f')](_0x3caa6d[_0x4533('0x4b')]);if(this[_0x4533('0x20')][_0x3caa6d[_0x4533('0x4c')]]){this[_0x4533('0x20')][_0x3caa6d['origtransfereruniqueid']][_0x4533('0x2d')]=!![];this['channels'][_0x3caa6d[_0x4533('0x48')]]=this['channels'][_0x3caa6d[_0x4533('0x4c')]];delete this['channels'][_0x3caa6d[_0x4533('0x4c')]];}}}catch(_0xb55728){logger[_0x4533('0x1b')](_0x4533('0x4d'),_0xb55728[_0x4533('0x38')]);}};Acw[_0x4533('0x1e')][_0x4533('0x4e')]=function(_0xef36a6){try{if(this['channels'][_0xef36a6['transfereruniqueid']]){logger[_0x4533('0x19')](_0x4533('0x4f'),JSON['stringify'](_0xef36a6[_0x4533('0x50')]));this[_0x4533('0x1f')](_0xef36a6['transfereruniqueid']);}else if(this['channels'][_0xef36a6['transfererlinkedid']]){logger['info'](_0x4533('0x51'),JSON[_0x4533('0x3d')](_0xef36a6[_0x4533('0x52')]));this[_0x4533('0x1f')](_0xef36a6[_0x4533('0x52')]);}}catch(_0xbf35f7){logger[_0x4533('0x1b')](_0x4533('0x53'),_0xbf35f7['message']);}};Acw[_0x4533('0x1e')][_0x4533('0xd')]=function(_0x1b0414){try{if(this[_0x4533('0x6')][_0x1b0414['queue']]&&this['voiceQueues'][_0x1b0414['queue']][_0x4533('0x54')]==='all'){if(this[_0x4533('0x27')][_0x1b0414[_0x4533('0x21')]]){logger[_0x4533('0x19')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1b0414[_0x4533('0x18')],_0x1b0414['interface'],_0x1b0414[_0x4533('0x22')]);return RpcUser['savePause'](this[_0x4533('0x27')][_0x1b0414[_0x4533('0x21')]],_0x4533('0x55'),_0x1b0414[_0x4533('0x18')]);}}}catch(_0x6f6025){logger['error'](_0x4533('0x56'),_0x6f6025['message']);}};module[_0x4533('0x57')]=Acw; \ No newline at end of file +var _0x6b1b=['voiceQueues','agents','timers','channels','agentconnect','bind','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','mandatoryDisposition','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport'];(function(_0x2d3622,_0x41ca4a){var _0x14b9ab=function(_0x39712d){while(--_0x39712d){_0x2d3622['push'](_0x2d3622['shift']());}};_0x14b9ab(++_0x41ca4a);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6b1b[_0x2a6809];return _0x11c371;};'use strict';var _=require('lodash');var moment=require(_0xb6b1('0x0'));var ami=require(_0xb6b1('0x1'));var logger=require(_0xb6b1('0x2'))('acw');var RpcUser=require(_0xb6b1('0x3'));var RpcVoiceAgentReport=require(_0xb6b1('0x4'));function Acw(_0x28daf9){this[_0xb6b1('0x5')]=_0x28daf9[_0xb6b1('0x5')];this[_0xb6b1('0x6')]=_0x28daf9[_0xb6b1('0x6')];this[_0xb6b1('0x7')]=_0x28daf9[_0xb6b1('0x7')];this[_0xb6b1('0x8')]={};ami['on'](_0xb6b1('0x9'),this['syncAgentConnect'][_0xb6b1('0xa')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xb6b1('0xa')](this));ami['on']('hangup',this[_0xb6b1('0xb')]['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb6b1('0xc'),this[_0xb6b1('0xd')]['bind'](this));ami['on'](_0xb6b1('0xe'),this['syncBlindTransfer']['bind'](this));ami['on'](_0xb6b1('0xf'),this[_0xb6b1('0x10')][_0xb6b1('0xa')](this));}function getDiff(_0x327eee){var _0x23881d=moment()[_0xb6b1('0x11')](0x0);var _0x360fc7=moment(_0x327eee)[_0xb6b1('0x11')](0x0);return _0x23881d[_0xb6b1('0x12')](_0x360fc7,_0xb6b1('0x13'));}Acw[_0xb6b1('0x14')][_0xb6b1('0x15')]=function(_0x4f770a,_0x57572a){var _0x513207=this;var _0x51f25f=getDiff(_0x513207[_0xb6b1('0x7')][_0x4f770a][_0xb6b1('0x16')]);clearTimeout(_0x513207[_0xb6b1('0x7')][_0x4f770a][_0xb6b1('0x17')]);_0x513207[_0xb6b1('0x7')][_0x4f770a][_0xb6b1('0x17')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x51f25f},_0x513207['timers'][_0x4f770a][_0xb6b1('0x18')],_0x4f770a)[_0xb6b1('0x19')](function(_0x16d969){logger[_0xb6b1('0x1a')](_0xb6b1('0x1b'),_0x57572a,_0x51f25f,_0x16d969);})[_0xb6b1('0x1c')](function(_0x5ba14d){logger['error'](_0xb6b1('0x1d'),_0x57572a,_0x5ba14d);})[_0xb6b1('0x1e')](function(){delete _0x513207['timers'][_0x4f770a];});};Acw['prototype'][_0xb6b1('0x1f')]=function(_0x5c8529){try{var _0x509c55=this;var _0x232157=this[_0xb6b1('0x8')][_0x5c8529][_0xb6b1('0x20')];var _0x305865=this[_0xb6b1('0x8')][_0x5c8529][_0xb6b1('0x21')];var _0x1eb1b2=this[_0xb6b1('0x5')][_0x305865];var _0x472585=![];var _0x20066f='ACW';if(_0x1eb1b2[_0xb6b1('0x22')]&&_0x1eb1b2['mandatoryDispositionPause'][_0xb6b1('0x23')]){_0x472585=!![];_0x20066f=_0x1eb1b2['mandatoryDispositionPause'][_0xb6b1('0x23')];}if(!_0x509c55['agents'][_0x232157]){return Promise[_0xb6b1('0x24')]();}return RpcUser[_0xb6b1('0x25')](_0x509c55[_0xb6b1('0x6')][_0x232157]['id'])[_0xb6b1('0x19')](function(_0x13e841){if(!_0x13e841||_0x13e841[_0xb6b1('0x26')]){logger[_0xb6b1('0x1a')](_0xb6b1('0x27'),_0x5c8529,_0x232157,_0x305865);return;}logger[_0xb6b1('0x1a')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x5c8529,_0x232157,_0x305865);var _0xf40426=_0x509c55['channels'][_0x5c8529][_0xb6b1('0x28')]&&_0x509c55[_0xb6b1('0x8')][_0x5c8529][_0xb6b1('0x29')]?_0x509c55[_0xb6b1('0x8')][_0x5c8529][_0xb6b1('0x29')]:_0x5c8529;return RpcUser[_0xb6b1('0x2a')](_0x509c55[_0xb6b1('0x6')][_0x232157],_0x20066f,_0xf40426);})['then'](function(_0x427797){if(_0x472585||!_0x427797){return;}_0x509c55[_0xb6b1('0x7')][_0x232157]={};logger[_0xb6b1('0x1a')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5c8529,_0x509c55[_0xb6b1('0x5')][_0x305865][_0xb6b1('0x2b')],_0x232157,_0x305865);_0x509c55['timers'][_0x232157][_0xb6b1('0x17')]=setTimeout(_0x509c55[_0xb6b1('0x2c')][_0xb6b1('0xa')](_0x509c55,_0x232157),_0x509c55[_0xb6b1('0x5')][_0x305865][_0xb6b1('0x2b')]*0x3e8);_0x509c55[_0xb6b1('0x7')][_0x232157]['lastPauseAt']=moment()[_0xb6b1('0x2d')](_0xb6b1('0x2e'));_0x509c55['timers'][_0x232157][_0xb6b1('0x18')]=_0x5c8529;_0x509c55['timers'][_0x232157][_0xb6b1('0x21')]=_0x305865;_0x509c55[_0xb6b1('0x7')][_0x232157][_0xb6b1('0x15')]=_0x509c55[_0xb6b1('0x15')][_0xb6b1('0xa')](_0x509c55,_0x232157,_0x5c8529);})[_0xb6b1('0x1c')](function(){logger['error'](_0xb6b1('0x2f'),_0x5c8529,_0x509c55[_0xb6b1('0x5')][_0x305865][_0xb6b1('0x2b')],_0x232157,_0x305865);})[_0xb6b1('0x1e')](function(){delete _0x509c55['channels'][_0x5c8529];});}catch(_0x56f1ff){logger['error'](_0xb6b1('0x30'),_0x56f1ff[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0x2c')]=function(_0x1c83c4){try{var _0x15cace=this;if(_0x15cace[_0xb6b1('0x7')][_0x1c83c4]){_0x15cace[_0xb6b1('0x7')][_0x1c83c4][_0xb6b1('0x17')]=![];var _0x25d6a2=_0x15cace[_0xb6b1('0x7')][_0x1c83c4][_0xb6b1('0x18')];var _0x5b8a57=_0x15cace[_0xb6b1('0x7')][_0x1c83c4][_0xb6b1('0x21')];var _0x2f0427=_0x15cace[_0xb6b1('0x5')][_0x5b8a57][_0xb6b1('0x2b')];logger[_0xb6b1('0x1a')](_0xb6b1('0x32'),_0x25d6a2,_0x1c83c4);RpcUser[_0xb6b1('0x33')](this[_0xb6b1('0x6')][_0x1c83c4]);RpcVoiceAgentReport[_0xb6b1('0x34')]({'acwtime':_0x2f0427,'agentacw':!![]},_0x25d6a2,_0x1c83c4)[_0xb6b1('0x19')](function(_0x56470a){logger[_0xb6b1('0x1a')](_0xb6b1('0x1b'),_0x25d6a2,_0x2f0427,_0x56470a);})[_0xb6b1('0x1c')](function(_0x2d6b2b){logger[_0xb6b1('0x35')](_0xb6b1('0x1d'),_0x25d6a2,_0x2d6b2b);});}else{logger[_0xb6b1('0x35')](_0xb6b1('0x36'),_0x1c83c4);if(_0x15cace['timers']){logger['info'](_0xb6b1('0x37'),JSON[_0xb6b1('0x38')](_0x15cace[_0xb6b1('0x7')]));}}}catch(_0x541eb5){logger[_0xb6b1('0x35')](_0xb6b1('0x39'),_0x541eb5[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0x3a')]=function(_0x3c2780){try{if(this[_0xb6b1('0x5')][_0x3c2780[_0xb6b1('0x21')]]&&(this['voiceQueues'][_0x3c2780[_0xb6b1('0x21')]]['acw']||this[_0xb6b1('0x5')][_0x3c2780[_0xb6b1('0x21')]][_0xb6b1('0x22')])){if(this[_0xb6b1('0x6')][_0x3c2780[_0xb6b1('0x20')]]){this[_0xb6b1('0x8')][_0x3c2780['uniqueid']]={'queue':_0x3c2780[_0xb6b1('0x21')],'interface':_0x3c2780[_0xb6b1('0x20')],'destlinkedid':_0x3c2780['destlinkedid']};}}}catch(_0x27bf19){logger['error'](_0xb6b1('0x3b'),_0x27bf19[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0x10')]=function(_0x2016a1){try{if(this[_0xb6b1('0x5')][_0x2016a1[_0xb6b1('0x21')]]&&(this[_0xb6b1('0x5')][_0x2016a1[_0xb6b1('0x21')]]['acw']||this['voiceQueues'][_0x2016a1[_0xb6b1('0x21')]][_0xb6b1('0x22')])){if(this['agents'][_0x2016a1[_0xb6b1('0x20')]]){this[_0xb6b1('0x8')][_0x2016a1[_0xb6b1('0x18')]]={'queue':_0x2016a1[_0xb6b1('0x21')],'interface':_0x2016a1[_0xb6b1('0x20')]};}}}catch(_0x505a80){logger[_0xb6b1('0x35')](_0xb6b1('0x3c'),_0x505a80[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')]['syncHangupRequest']=function(_0x5bfd0e){try{if(this[_0xb6b1('0x8')][_0x5bfd0e['uniqueid']]&&_[_0xb6b1('0x3d')](this[_0xb6b1('0x8')][_0x5bfd0e['uniqueid']][_0xb6b1('0x28')])){logger['info'](_0xb6b1('0x3e'),_0x5bfd0e[_0xb6b1('0x18')]);this[_0xb6b1('0x1f')](_0x5bfd0e[_0xb6b1('0x18')]);}else if(this[_0xb6b1('0x8')][_0x5bfd0e[_0xb6b1('0x3f')]]&&_[_0xb6b1('0x3d')](this[_0xb6b1('0x8')][_0x5bfd0e[_0xb6b1('0x3f')]][_0xb6b1('0x28')])){logger['info'](_0xb6b1('0x40'),_0x5bfd0e[_0xb6b1('0x3f')]);this[_0xb6b1('0x1f')](_0x5bfd0e[_0xb6b1('0x3f')]);}}catch(_0x46c4ef){logger[_0xb6b1('0x35')](_0xb6b1('0x41'),_0x46c4ef[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')]['syncHangup']=function(_0x16e0be){try{if(this['channels'][_0x16e0be['uniqueid']]&&this[_0xb6b1('0x8')][_0x16e0be[_0xb6b1('0x18')]]['attended']){logger[_0xb6b1('0x1a')](_0xb6b1('0x42'),_0x16e0be[_0xb6b1('0x18')]);this['startAcw'](_0x16e0be[_0xb6b1('0x18')]);}else if(this['channels'][_0x16e0be['linkedid']]&&this[_0xb6b1('0x8')][_0x16e0be[_0xb6b1('0x3f')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x16e0be[_0xb6b1('0x3f')]);this['startAcw'](_0x16e0be['linkedid']);}}catch(_0x47e64e){logger[_0xb6b1('0x35')](_0xb6b1('0x43'),_0x47e64e[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0xd')]=function(_0x3e441e){try{if(!_['isNil'](this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x44')]])){this['startAcw'](_0x3e441e['transfereeuniqueid']);if(this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x45')]]){this['channels'][_0x3e441e['secondtransfereruniqueid']][_0xb6b1('0x28')]=!![];this['channels'][_0x3e441e[_0xb6b1('0x46')]]=this[_0xb6b1('0x8')][_0x3e441e['secondtransfereruniqueid']];delete this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x45')]];}}else if(!_[_0xb6b1('0x47')](this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x46')]])){this[_0xb6b1('0x1f')](_0x3e441e[_0xb6b1('0x46')]);if(this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x48')]]){this[_0xb6b1('0x8')][_0x3e441e['origtransfereruniqueid']][_0xb6b1('0x28')]=!![];this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x44')]]=this[_0xb6b1('0x8')][_0x3e441e['origtransfereruniqueid']];delete this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x48')]];}}}catch(_0x2da39e){logger[_0xb6b1('0x35')](_0xb6b1('0x49'),_0x2da39e[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')]['syncBlindTransfer']=function(_0x485800){try{if(this[_0xb6b1('0x8')][_0x485800['transfereruniqueid']]){logger[_0xb6b1('0x1a')](_0xb6b1('0x4a'),JSON[_0xb6b1('0x38')](_0x485800['transfereruniqueid']));this[_0xb6b1('0x1f')](_0x485800[_0xb6b1('0x4b')]);}else if(this[_0xb6b1('0x8')][_0x485800[_0xb6b1('0x4c')]]){logger[_0xb6b1('0x1a')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x485800[_0xb6b1('0x4c')]));this[_0xb6b1('0x1f')](_0x485800[_0xb6b1('0x4c')]);}}catch(_0x28b4c9){logger[_0xb6b1('0x35')](_0xb6b1('0x4d'),_0x28b4c9[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0x4e')]=function(_0x3634a8){try{if(this[_0xb6b1('0x5')][_0x3634a8[_0xb6b1('0x21')]]&&this['voiceQueues'][_0x3634a8[_0xb6b1('0x21')]]['autopause']===_0xb6b1('0x4f')){if(this[_0xb6b1('0x6')][_0x3634a8[_0xb6b1('0x20')]]){logger['info'](_0xb6b1('0x50'),_0x3634a8['uniqueid'],_0x3634a8['interface'],_0x3634a8[_0xb6b1('0x21')]);return RpcUser['savePause'](this[_0xb6b1('0x6')][_0x3634a8[_0xb6b1('0x20')]],'Auto-Pause',_0x3634a8[_0xb6b1('0x18')]);}}}catch(_0x58fddf){logger[_0xb6b1('0x35')](_0xb6b1('0x51'),_0x58fddf[_0xb6b1('0x31')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c361f61..cc9d583 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 _0x20d5=['actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','then','[ami.js][fullybooted]','close','exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','actionSipShowRegistry'];(function(_0x7e2d84,_0x3d8d7a){var _0x3acd22=function(_0x24055c){while(--_0x24055c){_0x7e2d84['push'](_0x7e2d84['shift']());}};_0x3acd22(++_0x3d8d7a);}(_0x20d5,0x70));var _0x520d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20d5[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x520d('0x0'));var util=require(_0x520d('0x1'));var logger=require(_0x520d('0x2'))(_0x520d('0x3'));var config=require(_0x520d('0x4'));var ami=new Manager(config[_0x520d('0x5')][_0x520d('0x6')],config[_0x520d('0x5')]['ip'],config['asterisk'][_0x520d('0x7')],config[_0x520d('0x5')]['password'],!![]);ami[_0x520d('0x8')]();ami[_0x520d('0x9')]=BPromise[_0x520d('0xa')](ami[_0x520d('0xb')]);function error(_0x233316){logger['error'](util[_0x520d('0xc')](_0x520d('0xd'),config['asterisk']['username'],config[_0x520d('0x5')]['ip'],config[_0x520d('0x5')]['port'],util['inspect'](_0x233316,![],null)));}function close(){logger[_0x520d('0xe')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x520d('0x7')],config['asterisk']['ip'],config[_0x520d('0x5')][_0x520d('0x6')]));}ami[_0x520d('0xf')]=function(){return function(){return ami[_0x520d('0x9')]({'action':'sipshowregistry'});};};ami[_0x520d('0x10')]=function(){return function(){return ami[_0x520d('0x9')]({'action':_0x520d('0x11')});};};ami[_0x520d('0x12')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x520d('0x13')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x520d('0x14')]=function(){return function(){return ami[_0x520d('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0x520d('0x15')](util[_0x520d('0xc')](_0x520d('0x16'),config[_0x520d('0x5')][_0x520d('0x7')],config['asterisk']['ip'],config[_0x520d('0x5')][_0x520d('0x6')]));ami['once'](_0x520d('0xe'),error);ami[_0x520d('0x17')]('close',close);}ami['on']('connect',connect);ami['on'](_0x520d('0x18'),function(_0xc0aac8){logger[_0x520d('0x15')](util['format'](_0x520d('0x19'),config[_0x520d('0x5')]['username'],config['asterisk']['ip'],config[_0x520d('0x5')]['port'],util[_0x520d('0x1a')](_0xc0aac8,![],null)));});ami['on'](_0x520d('0x1b'),function(){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x520d('0x5')]['ip'],config['asterisk'][_0x520d('0x6')]));return Promise['resolve']()['then'](ami[_0x520d('0xf')]())[_0x520d('0x1c')](ami[_0x520d('0x10')]())['then'](ami[_0x520d('0x12')]())[_0x520d('0x1c')](ami['actionQueueSummary']())[_0x520d('0x1c')](ami['actionCoreShowChannels']())['catch'](function(_0x342afb){logger['error'](_0x520d('0x1d'),util[_0x520d('0x1a')](_0x342afb,{'showHidden':![],'depth':null}));});});ami[_0x520d('0x17')]('error',error);ami['once'](_0x520d('0x1e'),close);module[_0x520d('0x1f')]=ami; \ No newline at end of file +var _0xe9e8=['resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','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','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s'];(function(_0x2366b1,_0x578f99){var _0x287e79=function(_0x529aec){while(--_0x529aec){_0x2366b1['push'](_0x2366b1['shift']());}};_0x287e79(++_0x578f99);}(_0xe9e8,0x177));var _0x8e9e=function(_0x35599c,_0x36d3db){_0x35599c=_0x35599c-0x0;var _0x54eb4c=_0xe9e8[_0x35599c];return _0x54eb4c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var logger=require(_0x8e9e('0x2'))(_0x8e9e('0x3'));var config=require(_0x8e9e('0x4'));var ami=new Manager(config[_0x8e9e('0x5')]['port'],config[_0x8e9e('0x5')]['ip'],config[_0x8e9e('0x5')][_0x8e9e('0x6')],config[_0x8e9e('0x5')][_0x8e9e('0x7')],!![]);ami[_0x8e9e('0x8')]();ami[_0x8e9e('0x9')]=BPromise[_0x8e9e('0xa')](ami[_0x8e9e('0xb')]);function error(_0xd06721){logger[_0x8e9e('0xc')](util[_0x8e9e('0xd')](_0x8e9e('0xe'),config[_0x8e9e('0x5')][_0x8e9e('0x6')],config[_0x8e9e('0x5')]['ip'],config['asterisk'][_0x8e9e('0xf')],util[_0x8e9e('0x10')](_0xd06721,![],null)));}function close(){logger[_0x8e9e('0xc')](util[_0x8e9e('0xd')](_0x8e9e('0x11'),config[_0x8e9e('0x5')][_0x8e9e('0x6')],config[_0x8e9e('0x5')]['ip'],config[_0x8e9e('0x5')][_0x8e9e('0xf')]));}ami[_0x8e9e('0x12')]=function(){return function(){return ami['Action']({'action':_0x8e9e('0x13')});};};ami[_0x8e9e('0x14')]=function(){return function(){return ami[_0x8e9e('0x9')]({'action':_0x8e9e('0x15')});};};ami[_0x8e9e('0x16')]=function(){return function(){return ami[_0x8e9e('0x9')]({'action':_0x8e9e('0x17')});};};ami[_0x8e9e('0x18')]=function(){return function(){return ami[_0x8e9e('0x9')]({'action':_0x8e9e('0x19')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x8e9e('0x9')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x8e9e('0xd')](_0x8e9e('0x1a'),config[_0x8e9e('0x5')][_0x8e9e('0x6')],config[_0x8e9e('0x5')]['ip'],config['asterisk'][_0x8e9e('0xf')]));ami['once'](_0x8e9e('0xc'),error);ami[_0x8e9e('0x1b')](_0x8e9e('0x1c'),close);}ami['on'](_0x8e9e('0x1d'),connect);ami['on'](_0x8e9e('0x1e'),function(_0x5408b1){logger['info'](util[_0x8e9e('0xd')](_0x8e9e('0x1f'),config[_0x8e9e('0x5')]['username'],config[_0x8e9e('0x5')]['ip'],config[_0x8e9e('0x5')][_0x8e9e('0xf')],util[_0x8e9e('0x10')](_0x5408b1,![],null)));});ami['on'](_0x8e9e('0x20'),function(){logger[_0x8e9e('0x21')](util[_0x8e9e('0xd')](_0x8e9e('0x22'),config['asterisk'][_0x8e9e('0x6')],config['asterisk']['ip'],config['asterisk'][_0x8e9e('0xf')]));return Promise[_0x8e9e('0x23')]()[_0x8e9e('0x24')](ami[_0x8e9e('0x12')]())[_0x8e9e('0x24')](ami['actionDeviceStateList']())[_0x8e9e('0x24')](ami[_0x8e9e('0x16')]())[_0x8e9e('0x24')](ami[_0x8e9e('0x18')]())[_0x8e9e('0x24')](ami[_0x8e9e('0x25')]())[_0x8e9e('0x26')](function(_0x51eb62){logger[_0x8e9e('0xc')](_0x8e9e('0x27'),util['inspect'](_0x51eb62,{'showHidden':![],'depth':null}));});});ami[_0x8e9e('0x1b')]('error',error);ami[_0x8e9e('0x1b')](_0x8e9e('0x1c'),close);module[_0x8e9e('0x28')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0a05d66..b30e8e4 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x48fc2c,_0x1e4620){var _0x14dd35=function(_0x341c5f){while(--_0x341c5f){_0x48fc2c['push'](_0x48fc2c['shift']());}};_0x14dd35(++_0x1e4620);}(_0xaa88,0x137));var _0x8aa8=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xaa88[_0x18fb16];return _0x147b0d;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x55e3d5,_0x2656cc){var _0xdad6e4=function(_0x1d15f8){while(--_0x1d15f8){_0x55e3d5['push'](_0x55e3d5['shift']());}};_0xdad6e4(++_0x2656cc);}(_0xb43b,0x1b2));var _0xbb43=function(_0x195a3b,_0x565acf){_0x195a3b=_0x195a3b-0x0;var _0x47e31e=_0xb43b[_0x195a3b];return _0x47e31e;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index acf54d9..0599a41 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 _0x34a8=['queueBooked','push','merge','idHopper','paused','preview','run','[unlock][syncQueueStatusComplete]','isEmpty','_rr','unlockRR','Agent:\x20','pick','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','AMD','countmachineretry','custom:amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countnoanswerretry','createStateFinal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','syncQueueSummaryComplete','throttle','dialPreviewRecallmeReminder','filter','online','length','map','Agent','user:%s','loopClearZombieChannels','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','user:dialPreviewRecallReminder','handleIvr','actionOriginate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','originate','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','verifyAdditionalPhones','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalAvgHoldtime','predictiveIntervalAnsweredCalls','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','reachable','getContactDialer','countReScheduled','RUNNING','checkIsBlackList','loggerHandler','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','checkContactEmpty','checkContactLowerLimitOriginate','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','util','lodash','uuid','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncQueueCallerAbandon','bind','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','getSeconds','startProgressive\x20value\x20cleared','startPredictive','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','EMPTY_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','Action','iftime\x20%s,%s','interval','then','content','command','indexOf','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','catch','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','[syncAgentComplete][createHistory]','moveContactManagedDialer','updateOriginated','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','callAdditionalPhoneAfterMin','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','VoiceQueueId','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','roundrobin','isNil','locked','stateinterface','rrmemory'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x34a8,0x132));var _0x834a=function(_0x1c6126,_0x278b38){_0x1c6126=_0x1c6126-0x0;var _0x4a375f=_0x34a8[_0x1c6126];return _0x4a375f;};'use strict';var util=require(_0x834a('0x0'));var _=require(_0x834a('0x1'));var uuid=require(_0x834a('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x834a('0x3'));var utils=require('./utils');var hopperUtils=require(_0x834a('0x4'));var ut=require(_0x834a('0x5'));var config=require(_0x834a('0x6'));var logger=require('../../../config/logger')(_0x834a('0x7'));var loggerBooked=require(_0x834a('0x8'))(_0x834a('0x9'));var loggerPredictive=require(_0x834a('0x8'))('predictive');var loggerPredictiveCalls=require(_0x834a('0x8'))(_0x834a('0xa'));var loggerSyncQueueSummary=require(_0x834a('0x8'))(_0x834a('0xb'));var ami=require(_0x834a('0xc'));config[_0x834a('0xd')]=_[_0x834a('0xe')](config['redis'],{'host':_0x834a('0xf'),'port':0x18eb});var io=require(_0x834a('0x10'))(new Redis(config[_0x834a('0xd')]));var cmHopper=require(_0x834a('0x11'));var voiceQueueRt=require(_0x834a('0x12'));var RpcSetting=require(_0x834a('0x13'));var Interval=require(_0x834a('0x14'));var Action=require(_0x834a('0x15'));var History=require(_0x834a('0x16'));var Final=require(_0x834a('0x17'));var AgentComplete=require(_0x834a('0x18'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x834a('0x19'));var ipAgi=process['env'][_0x834a('0x1a')]||_0x834a('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x834a('0x1c')][_0x834a('0x1d')]=function(_0x264328){this[_0x834a('0x1e')]=this[_0x834a('0x1e')]?this[_0x834a('0x1e')][_0x834a('0x1f')](_0x264328):_0x264328();};function Dialer(_0x2f93f0,_0x131ab9){this[_0x834a('0x20')]=new Sequence();this['preview']=_0x131ab9;this[_0x834a('0x21')]=_0x2f93f0[_0x834a('0x21')];this[_0x834a('0x22')]=_0x2f93f0[_0x834a('0x22')];this[_0x834a('0x23')]=_0x2f93f0['agents'];this[_0x834a('0x24')]=_0x2f93f0[_0x834a('0x24')];this[_0x834a('0x25')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0x834a('0x26')]={};this[_0x834a('0x27')]={};this[_0x834a('0x28')]={};this['startPredictive']={};this[_0x834a('0x29')]={};this[_0x834a('0x2a')]={};this['queueBooked']={};this[_0x834a('0x2b')]={};this[_0x834a('0x2c')]={};ami['on'](_0x834a('0x2d'),this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this[_0x834a('0x2e')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x834a('0x2f')](this));ami['on'](_0x834a('0x30'),this['syncAgentComplete'][_0x834a('0x2f')](this));ami['on'](_0x834a('0x31'),this['syncQueueSummary'][_0x834a('0x2f')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x834a('0x2f')](this));ami['on'](_0x834a('0x32'),this[_0x834a('0x33')][_0x834a('0x2f')](this));ami['on'](_0x834a('0x34'),this[_0x834a('0x35')][_0x834a('0x2f')](this));ami['on'](_0x834a('0x36'),this[_0x834a('0x37')][_0x834a('0x2f')](this));ami['on'](_0x834a('0x38'),this[_0x834a('0x39')][_0x834a('0x2f')](this));ami['on'](_0x834a('0x3a'),this[_0x834a('0x3b')][_0x834a('0x2f')](this));this[_0x834a('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0x834a('0x3d')]()['then'](function(_0x985524){previewRecallmeReminderInterval=_0x985524[_0x834a('0x3e')];});}function isNotNull(_0x395150){return _0x395150!==null&&!_[_0x834a('0x3f')](_0x395150);}function msgResponse(_0x526bb2,_0x510761,_0x45b5fc){return{'action':_0x526bb2,'response':_0x510761,'message':_0x45b5fc,'stack':_0x45b5fc};}function emit(_0x19191b,_0x5a8243,_0x3df03b){io['to'](_0x19191b)[_0x834a('0x40')](_0x5a8243,_0x3df03b);}function emitOutboundVoiceQueueSummary(_0x3ee723){if(_0x3ee723[_0x834a('0x41')]===_0x834a('0x42')){logger[_0x834a('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x834a('0x44')](_0x3ee723,{'showHidden':![],'depth':null}));emit(util[_0x834a('0x45')]('voice:queue:%s',_0x3ee723[_0x834a('0x46')]),_0x834a('0x47'),_0x3ee723);}}function checkGetDataPredictive(_0x55fb82){if(isNotNull(_0x55fb82)&&!_['isEmpty'](_0x55fb82)){loggerPredictive[_0x834a('0x48')](_0x834a('0x49'));loggerPredictive[_0x834a('0x48')](_0x834a('0x4a'),_0x55fb82[_0x834a('0x4b')]);loggerPredictive[_0x834a('0x48')](_0x834a('0x4c'),_0x55fb82['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x834a('0x48')](_0x834a('0x4d'),_0x55fb82['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x834a('0x48')](_0x834a('0x4e'),_0x55fb82[_0x834a('0x4f')]);loggerPredictive['info'](_0x834a('0x50'),_0x55fb82['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x834a('0x48')](_0x834a('0x51'),_0x55fb82['predictiveIntervalAvgTalktime']);loggerPredictive[_0x834a('0x48')](_0x834a('0x52'));if(_0x55fb82['predictiveIntervalTotalCalls']>0x0){if(!_[_0x834a('0x3f')](_0x55fb82[_0x834a('0x53')])&&_0x55fb82[_0x834a('0x53')]>0x0){return!![];}loggerPredictive[_0x834a('0x48')](_0x834a('0x54'));if(!_[_0x834a('0x3f')](_0x55fb82['predictiveIntervalAvgHoldtime'])&&_0x55fb82['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x834a('0x48')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x834a('0x55'));}}else{loggerPredictive[_0x834a('0x48')](_0x834a('0x56'));}return![];}function mergeDataErlangB(_0x5898c2){return function(_0x1ef7a0){loggerPredictive[_0x834a('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1ef7a0[_0x834a('0x57')]);loggerPredictive['info'](_0x834a('0x58'),_0x1ef7a0[_0x834a('0x59')]);loggerPredictive[_0x834a('0x48')](_0x834a('0x5a'),_0x1ef7a0[_0x834a('0x5b')]);loggerPredictive['info'](_0x834a('0x5c'),_0x1ef7a0['erlangBusyFactor']);loggerPredictive[_0x834a('0x48')](_0x834a('0x5a'),_0x1ef7a0['erlangAbandonmentRate']);loggerPredictive['info'](_0x834a('0x52'));_['merge'](_0x5898c2,_0x1ef7a0);};}function ifInterval(_0x26a434,_0x5b2ce7){if(_[_0x834a('0x3f')](_0x5b2ce7)){return![];}return utils[_0x834a('0x5d')](undefined,_0x5b2ce7)<_0x26a434*0x3c;}function clearPredictiveAttributes(_0x58dd51){if(_0x58dd51[_0x834a('0x29')]){_0x58dd51[_0x834a('0x29')]=undefined;loggerPredictive['debug'](_0x58dd51[_0x834a('0x46')],_0x834a('0x5e'));}if(_0x58dd51[_0x834a('0x5f')]){_0x58dd51['startPredictive']=undefined;loggerPredictive[_0x834a('0x43')](_0x58dd51[_0x834a('0x46')],'startPredictive\x20value\x20cleared');}if(_0x58dd51[_0x834a('0x60')]){clearInterval(_0x58dd51['handlePredictive']);_0x58dd51['handlePredictive']=undefined;loggerPredictive[_0x834a('0x43')](_0x58dd51[_0x834a('0x46')],_0x834a('0x61'));}}function loggerCatchPredictive(_0x3fef4f,_0x335111){return function(_0x4e29af){loggerPredictive[_0x834a('0x62')](_0x335111[_0x834a('0x46')],_0x3fef4f);loggerPredictive[_0x834a('0x62')](_0x4e29af[_0x834a('0x63')]);clearPredictiveAttributes(_0x335111);};}function loggerCatch(_0x4f5143){return function(_0xeaa1da){logger[_0x834a('0x62')](_0x4f5143,util[_0x834a('0x44')](_0xeaa1da,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x38537b,_0x384513,_0x33a1cd){return function(_0x4cf211){utils['checkContactLowerLimitOriginate'](_0x384513,_0x33a1cd,0x0);_0x384513[_0x834a('0x64')]=0x0;logger[_0x834a('0x62')](_0x38537b,util[_0x834a('0x44')](_0x4cf211,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x58ab78){return function(_0x3c0cc5){if(isNotNull(_0x3c0cc5)&&isNotNull(_0x3c0cc5[0x0])){if(_0x3c0cc5[0x0][_0x834a('0x65')]>0x0){_0x58ab78[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x68')];logger['info'](_0x834a('0x69')+_0x58ab78[_0x834a('0x46')],_0x3c0cc5[0x0]['contactsRescheduled'],'contacts');}else{_0x58ab78[_0x834a('0x66')]=utils[_0x834a('0x67')]['NO_AVAILABLE_CONTACTS'];logger[_0x834a('0x48')](_0x834a('0x6a')+_0x58ab78[_0x834a('0x46')]);}}};}function createObjHistory(_0x534d16,_0x31d0f5,_0xd4c76,_0x4087de,_0x34de7c){_0x534d16['message']=_0xd4c76;var _0x37b868=new Action(_0x534d16,_0x31d0f5);var _0x43453c=new History(_0x37b868);_0x43453c[_0x834a('0x6b')]=_0x4087de;_0x43453c['statedesc']=_0x34de7c;_0x43453c[_0x834a('0x6c')]=_0x37b868[_0x834a('0x6d')];return _0x43453c;}function unlockQueueStatus(_0x2d5ce4,_0x291230){setTimeout(function(){if(_[_0x834a('0x3f')](_0x2d5ce4[_0x834a('0x6e')])){loggerBooked[_0x834a('0x62')](_0x834a('0x6f'),_0x291230);}_0x2d5ce4[_0x834a('0x6e')]=!![];loggerBooked[_0x834a('0x48')](_0x834a('0x70'),_0x291230,JSON[_0x834a('0x71')](_['pick'](_0x2d5ce4,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x34df59){return function(){if(!isNotNull(_0x34df59['Interval'])){_0x34df59[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x72')];throw _0x34df59[_0x834a('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x34df59[_0x834a('0x73')][_0x834a('0x74')])){_0x34df59[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x72')];throw _0x34df59['name']+_0x834a('0x75');}if(!isNotNull(_['isEmpty'](_0x34df59[_0x834a('0x73')][_0x834a('0x74')]))){_0x34df59[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x72')];throw _0x34df59[_0x834a('0x46')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x15c955){return function(){if(!utils['isIVRCampaignActive'](_0x15c955)){_0x15c955['message']=utils[_0x834a('0x67')][_0x834a('0x76')];throw _0x15c955[_0x834a('0x46')]+_0x834a('0x77');}};}function emitCampaignSummary(_0x375adf){if(utils[_0x834a('0x78')](_0x375adf)){emit(util[_0x834a('0x45')](_0x834a('0x79'),_0x375adf[_0x834a('0x46')]),_0x834a('0x7a'),_0x375adf);}}function loggerCatchQueueSummary(_0x4771b4,_0x2b77e8){return function(_0x295d48){clearPredictiveAttributes(_0x2b77e8);emitCampaignSummary(_0x2b77e8);loggerSyncQueueSummary[_0x834a('0x43')](_0x4771b4,util[_0x834a('0x44')](_0x295d48,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1408a9){if(_0x1408a9['sendMessageOneNotActive']){if(_0x1408a9['originated']===0x0){_0x1408a9[_0x834a('0x7b')]=![];_0x1408a9[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x76')];loggerSyncQueueSummary[_0x834a('0x43')](_0x834a('0x7c'),_0x1408a9[_0x834a('0x46')],'is\x20not\x20active');}else{_0x1408a9[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x7d')];loggerSyncQueueSummary[_0x834a('0x43')](_0x834a('0x7c'),_0x1408a9[_0x834a('0x46')],_0x834a('0x7e'));}emitCampaignSummary(_0x1408a9);}}function myreject(_0x3bae15){return function(_0x299a26){return _0x3bae15(msgResponse(_0x834a('0x7f'),'Error',JSON[_0x834a('0x71')](_0x299a26)));};}Dialer[_0x834a('0x1c')]['isTrunkReachable']=function(_0x31b416){return!_[_0x834a('0x3f')](_0x31b416)&&_0x31b416&&!_[_0x834a('0x3f')](_0x31b416[_0x834a('0x46')])&&!_[_0x834a('0x3f')](_0x31b416[_0x834a('0x80')])&&_0x31b416[_0x834a('0x80')]&&(this[_0x834a('0x24')][util[_0x834a('0x45')]('SIP/%s',_0x31b416[_0x834a('0x46')])]['status']==='reachable'||this[_0x834a('0x24')][util[_0x834a('0x45')](_0x834a('0x81'),_0x31b416[_0x834a('0x46')])][_0x834a('0x82')]===_0x834a('0x83'));};Dialer[_0x834a('0x1c')][_0x834a('0x84')]=function(_0x2b620f){var _0x1a7cfa=this;return function(){if(!_0x1a7cfa[_0x834a('0x85')](_0x2b620f[_0x834a('0x86')])){if(!_0x1a7cfa[_0x834a('0x85')](_0x2b620f[_0x834a('0x87')])){_0x2b620f['message']=utils[_0x834a('0x67')]['TRUNK_NOT_REACHABLE'];throw _0x2b620f[_0x834a('0x46')]+_0x834a('0x88');}}};};Dialer[_0x834a('0x1c')][_0x834a('0x89')]=function(_0x260f86,_0x35cb05,_0x1a1848,_0x590afa){var _0x29d393=this;return function(){var _0x4d64a8=!![];return _0x29d393[_0x834a('0x8a')](_0x260f86,_0x35cb05,_0x1a1848,_0x590afa,_0x4d64a8);};};Dialer[_0x834a('0x1c')][_0x834a('0x8b')]=function(_0x132ef9,_0x37a0b1,_0x4ef813,_0x3b6d4b){var _0x3c8be3=this;return function(){var _0x3bc32c=![];return _0x3c8be3[_0x834a('0x8a')](_0x132ef9[_0x834a('0x74')],_0x37a0b1,_0x4ef813,_0x3b6d4b,_0x3bc32c);};};Dialer[_0x834a('0x1c')][_0x834a('0x8a')]=function(_0x46d81c,_0x427ebe,_0xd2c9a,_0x11c40b,_0x5ec870){var _0x2e9e8d=[];return new Promise(function(_0x1481cf,_0x353fc0){if(!isNotNull(_0x46d81c)){_0x11c40b[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x72')];return _0x353fc0(msgResponse('ifTime','Failure',_0xd2c9a+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x46d81c)){_0x11c40b['message']=utils[_0x834a('0x67')][_0x834a('0x8c')];return _0x353fc0(msgResponse(_0x834a('0x8d'),_0x834a('0x8e'),_0xd2c9a+_0x834a('0x8f')));}if(_0x427ebe&&_[_0x834a('0x3f')](config[_0x834a('0x90')][_0x427ebe])){_0x11c40b[_0x834a('0x66')]=utils[_0x834a('0x67')]['UNKNOWN_TIMEZONE'];return _0x353fc0(msgResponse('ifTime','Failure',_0xd2c9a+'\x20Timezone\x20unknow\x20'+_0x427ebe));}if(_['isArray'](_0x46d81c)){for(var _0x5e806f=0x0;_0x5e806f<_0x46d81c['length'];_0x5e806f+=0x1){_0x2e9e8d['push'](ami[_0x834a('0x91')]({'action':'command','command':util['format'](_0x834a('0x92'),_0x46d81c[_0x5e806f][_0x834a('0x93')],!_['isUndefined'](config[_0x834a('0x90')][_0x427ebe])?_0x427ebe:'')})[_0x834a('0x94')](function(_0x45b8ef){return _0x45b8ef[_0x834a('0x95')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x353fc0)));}}else{_0x2e9e8d['push'](ami[_0x834a('0x91')]({'action':_0x834a('0x96'),'command':util[_0x834a('0x45')]('iftime\x20%s,%s',_0x46d81c,!_['isUndefined'](config['timezones'][_0x427ebe])?_0x427ebe:'')})[_0x834a('0x94')](function(_0x49b402){return _0x49b402['content'][_0x834a('0x97')](_0x834a('0x98'))>=0x0;})['catch'](myreject(_0x353fc0)));}Promise[_0x834a('0x99')](_0x2e9e8d)[_0x834a('0x94')](function(_0x5823bb){var _0x394e20=_[_0x834a('0x9a')](_0x5823bb);if(_0x394e20){return _0x1481cf(_0x394e20);}else{_0x11c40b['message']=_0x5ec870?utils[_0x834a('0x67')][_0x834a('0x9b')]:utils['CAMPAIGN_STATUS'][_0x834a('0x9c')];return _0x353fc0(msgResponse(_0x834a('0x9d'),_0x834a('0x8e'),_0x834a('0x9e')+_0x5ec870+'\x20'+_0xd2c9a+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x46d81c,{'showHidden':![],'depth':null})+_0x834a('0x9f')+_0x427ebe));}})[_0x834a('0xa0')](function(_0x2d9fe1){return _0x353fc0(msgResponse(_0x834a('0x8d'),'Failure',JSON['stringify'](_0x2d9fe1)));});});};Dialer[_0x834a('0x1c')][_0x834a('0x3c')]=function(){var _0x10b88d=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x10b88d['syncCampaigns']();},0x3e8);});};Dialer[_0x834a('0x1c')][_0x834a('0xa1')]=function(){var _0x23f6e8=this;var _0x4996d6;for(var _0x1fce20 in this['campaigns']){if(typeof this[_0x834a('0x22')][_0x1fce20]!==_0x834a('0xa2')){_0x4996d6=this[_0x834a('0x22')][_0x1fce20];if(utils[_0x834a('0x78')](_0x4996d6)&&utils[_0x834a('0xa3')](_0x4996d6)){_0x4996d6[_0x834a('0x7b')]=!![];Promise[_0x834a('0xa4')]()[_0x834a('0x94')](checkIsIVRCampaignActive(_0x4996d6))[_0x834a('0x94')](checkInterval(_0x4996d6))[_0x834a('0x94')](_0x23f6e8['checkIsTrunkReachable'](_0x4996d6))['then'](_0x23f6e8[_0x834a('0x89')](_0x4996d6[_0x834a('0xa5')],_0x4996d6[_0x834a('0xa6')],_0x4996d6[_0x834a('0x46')],_0x4996d6))[_0x834a('0x94')](_0x23f6e8[_0x834a('0x8b')](_0x4996d6[_0x834a('0x73')],_0x4996d6[_0x834a('0xa6')],_0x4996d6[_0x834a('0x46')],_0x4996d6))['then'](_0x23f6e8['launchHandleIvr'](_0x4996d6))[_0x834a('0xa0')](loggerCatchQueueSummary(_0x834a('0xa7'),_0x4996d6));}else{notSendMessagesCampaign(_0x4996d6);}}}};Dialer[_0x834a('0x1c')][_0x834a('0xa8')]=function(_0x362224){if(_0x362224[_0x834a('0xa9')]!==_0x834a('0xaa')){clearPredictiveAttributes(_0x362224);}switch(_0x362224[_0x834a('0xa9')]){case _0x834a('0xab'):this[_0x834a('0xac')](_0x362224,0x1);break;case'power':this[_0x834a('0xac')](_0x362224,_0x362224[_0x834a('0xad')]);break;case _0x834a('0xaa'):this[_0x834a('0xaa')](_0x362224);break;case'booked':this[_0x834a('0xac')](_0x362224,0x1);break;default:logger[_0x834a('0x62')](_0x834a('0xae'),_0x362224['name'],_0x834a('0xaf'));}};Dialer['prototype']['ifTime']=function(_0x383f95,_0x2e1035){var _0x45e038=_0x383f95[_0x834a('0xa6')];var _0x28d3bd=_0x2e1035?_0x383f95[_0x834a('0xa5')]:_0x383f95[_0x834a('0x73')][_0x834a('0x74')];logger[_0x834a('0xb0')](_0x834a('0xb1'),_0x28d3bd,_0x45e038,_0x383f95['name'],util[_0x834a('0x45')](_0x834a('0xb2'),_0x383f95[_0x834a('0x46')],_0x383f95['id']));var _0x4ebb76=null;return Interval[_0x834a('0xb3')](_0x28d3bd,_0x45e038)['then'](function(_0x52ce5e){if(_0x52ce5e===!![]){return _0x52ce5e;}else{_0x383f95[_0x834a('0x66')]=_0x2e1035?utils[_0x834a('0x67')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x834a('0x67')][_0x834a('0x9c')];_0x4ebb76=msgResponse(_0x834a('0x9d'),_0x834a('0x8e'),_0x834a('0x9e')+_0x2e1035+'\x20'+_0x383f95[_0x834a('0x46')]+_0x834a('0xb4')+util[_0x834a('0x44')](_0x28d3bd,{'showHidden':![],'depth':null})+_0x834a('0x9f')+_0x45e038);}if(_0x4ebb76!==null){logger[_0x834a('0xb0')](_0x834a('0xb5'),_0x4ebb76);_0x4ebb76[_0x834a('0xb6')]=_0x2e1035;throw _0x4ebb76;}})[_0x834a('0xa0')](function(_0x5efbb8){logger[_0x834a('0x62')](_0x834a('0xb7'),_0x5efbb8);throw msgResponse(_0x834a('0x7f'),_0x834a('0xb8'),util[_0x834a('0x44')](_0x5efbb8,{'showHidden':![],'depth':null}));});};Dialer[_0x834a('0x1c')]['syncAgentConnect']=function(_0x518936){if(this['voiceQueues'][_0x518936[_0x834a('0xb9')]]){if(this[_0x834a('0x27')][_0x518936[_0x834a('0xba')]]&&this[_0x834a('0x27')][_0x518936['uniqueid']]['type']!==_0x834a('0xbb')){this['updateOriginated'](this['voiceQueues'][_0x518936['queue']]);this['uniqueId'][_0x518936[_0x834a('0xba')]][_0x834a('0xbc')]=moment()[_0x834a('0x45')](_0x834a('0xbd'));}}};Dialer[_0x834a('0x1c')][_0x834a('0xbe')]=function(_0x5f3845){var _0x14030b=this[_0x834a('0x27')][_0x5f3845[_0x834a('0xba')]];if(this[_0x834a('0x21')][_0x5f3845[_0x834a('0xb9')]]){if(_0x14030b&&_0x14030b['type']!=='ivr'){delete this['uniqueId'][_0x5f3845['uniqueid']];this['voiceQueues'][_0x5f3845[_0x834a('0xb9')]][_0x834a('0xbf')]+=0x1;var _0x50cbb9=new AgentComplete(_0x14030b,_0x5f3845);if(_0x5f3845[_0x834a('0xc0')]===_0x834a('0xc1')){_0x50cbb9[_0x834a('0xc2')]=this[_0x834a('0x21')][_0x5f3845['queue']]['dialQueueProject2']&&this[_0x834a('0x21')][_0x5f3845[_0x834a('0xb9')]]['dialAgiAfterHangupAgent']?moment()[_0x834a('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x50cbb9)['catch'](loggerCatch(_0x834a('0xc3')));hopperUtils[_0x834a('0xc4')](_0x50cbb9)[_0x834a('0xa0')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x834a('0x1c')][_0x834a('0x2e')]=function(_0x3dcea5){var _0x3e85c2=this[_0x834a('0x27')][_0x3dcea5[_0x834a('0xba')]];var _0x170886=this;var _0x1f171a=![];var _0x3455c7;var _0x12fa99;if(this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]]){if(_0x3e85c2&&_0x3e85c2['type']!==_0x834a('0xbb')){delete this[_0x834a('0x27')][_0x3dcea5[_0x834a('0xba')]];this[_0x834a('0xc5')](this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]]);_0x3e85c2[_0x834a('0xc6')]=moment()['format'](_0x834a('0xbd'));var _0x364173=new QueueCallerAbandon(_0x3e85c2,_0x3dcea5);if(utils[_0x834a('0x5d')](_0x3e85c2[_0x834a('0xc6')],_0x3e85c2[_0x834a('0xc7')])>=_0x3e85c2[_0x834a('0xc8')]){this['voiceQueues'][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xc9')]+=0x1;this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xca')]+=0x1;this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xcb')]+=0x1;_0x364173[_0x834a('0x6b')]=0xa;_0x364173[_0x834a('0xcc')]=_0x834a('0xcd');_0x364173[_0x834a('0xce')]=_0x834a('0xcf');_0x364173['agiafterat']=this[_0x834a('0x21')][_0x3dcea5['queue']][_0x834a('0xd0')]?moment()[_0x834a('0x45')](_0x834a('0xbd')):undefined;_0x364173[_0x834a('0xd1')]+=0x1;_0x364173[_0x834a('0xd2')]+=0x1;_0x3455c7=this['voiceQueues'][_0x3dcea5[_0x834a('0xb9')]]['dialDropRetryFrequency'];_0x12fa99=this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xd3')];hopperUtils['verifyAdditionalPhones'](_0x364173,_0x364173[_0x834a('0x6b')],_0x3e85c2['voiceQueue'])[_0x834a('0x94')](function(_0x1f135b){_0x1f171a=_0x1f135b[_0x834a('0xd4')]==0x1;if(_0x364173['countdropretry']>=_0x170886[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xd5')]){_0x170886[_0x834a('0xd6')](_0x364173,_0x1f135b['additional']);}else{hopperUtils[_0x834a('0xd7')]({'active':![],'countdropretry':_0x364173[_0x834a('0xd1')],'scheduledat':moment()[_0x834a('0xd8')](_0x170886[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xd9')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x3e85c2[_0x834a('0xdb')],'ListId':_0x3e85c2[_0x834a('0xdc')],'VoiceQueueId':_0x3e85c2['VoiceQueueId']||undefined,'CampaignId':_0x3e85c2['CampaignId']||undefined})[_0x834a('0xa0')](loggerCatch('[rescheduleContact][Drop]'));var _0x49065a=new History(_0x364173);_0x49065a[_0x834a('0x6b')]=0xa;_0x49065a[_0x834a('0xcc')]=_0x834a('0xcd');_0x49065a[_0x834a('0x6d')]=moment()[_0x834a('0x45')](_0x834a('0xbd'));_0x49065a['endtime']=_0x49065a['starttime'];_0x49065a['calleridname']=_0x364173[_0x834a('0xdd')];_0x49065a[_0x834a('0xde')]=_0x364173['calleridnum'];hopperUtils[_0x834a('0xdf')](_0x49065a)['catch'](loggerCatch(_0x834a('0xe0')));}})[_0x834a('0x94')](function(){if(_0x1f171a)hopperUtils[_0x834a('0xe1')](_0x364173,_0x3455c7,_0x12fa99)['then'](function(){return 0x1;});});}else{this[_0x834a('0x21')][_0x3dcea5['queue']][_0x834a('0x4f')]+=0x1;this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xe2')]+=0x1;_0x364173['state']=0xb;_0x364173[_0x834a('0xcc')]=_0x834a('0xe3');_0x364173[_0x834a('0xce')]='CALLEREXIT';_0x364173['countabandonedretry']+=0x1;_0x364173['countglobal']+=0x1;_0x3455c7=this[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xe4')];_0x12fa99=this['voiceQueues'][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xd3')];hopperUtils['verifyAdditionalPhones'](_0x364173,_0x364173['state'],_0x3e85c2[_0x834a('0xe5')])[_0x834a('0x94')](function(_0x32724c){if(_0x364173['countabandonedretry']>=_0x170886[_0x834a('0x21')][_0x3dcea5['queue']][_0x834a('0xe6')]){_0x170886['queueCallerAbandonCreateState'](_0x364173,_0x32724c[_0x834a('0xd4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x364173['countabandonedretry'],'scheduledat':moment()['add'](_0x170886[_0x834a('0x21')][_0x3dcea5[_0x834a('0xb9')]][_0x834a('0xe4')],'minutes')[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x3e85c2[_0x834a('0xdb')],'ListId':_0x3e85c2['ListId'],'VoiceQueueId':_0x3e85c2[_0x834a('0xe7')]||undefined,'CampaignId':_0x3e85c2[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0xe9')));var _0x5ebb00=new History(_0x364173);_0x5ebb00[_0x834a('0x6b')]=0xb;_0x5ebb00[_0x834a('0xcc')]=_0x834a('0xe3');_0x5ebb00[_0x834a('0x6d')]=moment()[_0x834a('0x45')](_0x834a('0xbd'));_0x5ebb00[_0x834a('0x6c')]=_0x5ebb00[_0x834a('0x6d')];_0x5ebb00['calleridname']=_0x364173[_0x834a('0xdd')];_0x5ebb00[_0x834a('0xde')]=_0x364173[_0x834a('0xde')];hopperUtils['createHistory'](_0x5ebb00)[_0x834a('0xa0')](loggerCatch(_0x834a('0xea')));}})[_0x834a('0x94')](function(){if(_0x1f171a)hopperUtils[_0x834a('0xe1')](_0x364173,_0x3455c7,_0x12fa99)[_0x834a('0x94')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x834a('0x35')]=function(_0x3d82d0){if(this[_0x834a('0xeb')][_0x3d82d0[_0x834a('0xba')]]){this[_0x834a('0xeb')][_0x3d82d0['uniqueid']][_0x834a('0xec')]=_0x3d82d0[_0x834a('0xec')];}if(this[_0x834a('0x27')][_0x3d82d0[_0x834a('0xba')]]){this[_0x834a('0x27')][_0x3d82d0[_0x834a('0xba')]][_0x834a('0xec')]=_0x3d82d0['channel'];}};Dialer[_0x834a('0x1c')][_0x834a('0x39')]=function(_0x4c2c88){if(!this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]){return;}var _0x2e181a=this['voiceQueues'][this['actions'][_0x4c2c88[_0x834a('0xed')]][_0x834a('0xb9')]][_0x834a('0xee')]||'rrmemory';if(_0x2e181a===_0x834a('0xef')){if(this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]&&_[_0x834a('0xf0')](this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]][_0x834a('0xf1')])&&_0x4c2c88[_0x834a('0x82')]==='1'&&_0x4c2c88['paused']==='0'){if(this[_0x834a('0x23')][_0x4c2c88[_0x834a('0xf2')]]){if(!this[_0x834a('0x23')][_0x4c2c88[_0x834a('0xf2')]]['locked']){this[_0x834a('0x23')][_0x4c2c88['stateinterface']][_0x834a('0xf1')]=!![];this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]][_0x834a('0xf1')]=!![];this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]['stateinterface']=_0x4c2c88[_0x834a('0xf2')];}}}}else if(_0x2e181a===_0x834a('0xf3')){if(this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]){if(this[_0x834a('0x23')][_0x4c2c88[_0x834a('0xf2')]]){this[_0x834a('0xeb')][_0x4c2c88['actionid']][_0x834a('0xf2')]=_0x4c2c88[_0x834a('0xf2')];if(_[_0x834a('0xf0')](this['queueBooked'][this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]['queue']])){this['queueBooked'][this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]]['queue']]=[];}this[_0x834a('0xf4')][this['actions'][_0x4c2c88[_0x834a('0xed')]]['queue']][_0x834a('0xf5')](_[_0x834a('0xf6')](_['pick'](this[_0x834a('0xeb')][_0x4c2c88[_0x834a('0xed')]],[_0x834a('0xf7'),_0x834a('0xf2')]),{'status':_0x4c2c88[_0x834a('0x82')],'paused':_0x4c2c88[_0x834a('0xf8')]}));}}}};Dialer[_0x834a('0x1c')]['syncQueueStatusComplete']=function(_0x4a80a8){if(!this['actions'][_0x4a80a8['actionid']]){return;}var _0x32b5a4=this;var _0x818400=this[_0x834a('0x21')][this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]];var _0x39d35e=_0x818400[_0x834a('0xee')]||_0x834a('0xf3');if(_0x39d35e===_0x834a('0xef')){if(this['actions'][_0x4a80a8['actionid']]&&this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xf2')]){this[_0x834a('0xf9')][_0x834a('0xfa')](this['actions'][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xf7')],this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xf2')])[_0x834a('0xa0')](function(_0xe0603a){logger[_0x834a('0x62')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x834a('0x44')](_0xe0603a,{'showHidden':![],'depth':null}));})['finally'](function(){_0x32b5a4[_0x834a('0xc5')](_0x32b5a4[_0x834a('0x21')][_0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]);_0x32b5a4[_0x834a('0x23')][_0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xf2')]]['locked']=![];delete _0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]];unlockQueueStatus(_0x818400);});}else{this[_0x834a('0xc5')](this[_0x834a('0x21')][this[_0x834a('0xeb')][_0x4a80a8['actionid']][_0x834a('0xb9')]]);hopperUtils[_0x834a('0xd7')]({'active':![],'ContactId':this['actions'][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xdb')],'ListId':this['actions'][_0x4a80a8['actionid']][_0x834a('0xdc')],'VoiceQueueId':this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xe7')]||undefined,'CampaignId':this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0xfb')));delete this['actions'][_0x4a80a8[_0x834a('0xed')]];unlockQueueStatus(_0x818400);}}else if(_0x39d35e===_0x834a('0xf3')){var _0x538853;if(this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]]&&!_[_0x834a('0xfc')](this[_0x834a('0xf4')][this[_0x834a('0xeb')][_0x4a80a8['actionid']][_0x834a('0xb9')]])){if(this[_0x834a('0x2b')][_0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]){this['queueBookedRR'][_0x32b5a4[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]=this[_0x834a('0x2b')][this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]?this[_0x834a('0x2b')][this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]:this[_0x834a('0xf4')][this['actions'][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]?this['queueBooked'][this['actions'][_0x4a80a8[_0x834a('0xed')]]['queue']][_0x834a('0xfd')]||0x0:0x0;}this[_0x834a('0xf4')][this[_0x834a('0xeb')][_0x4a80a8[_0x834a('0xed')]][_0x834a('0xb9')]]['_rr']=this['queueBookedRR'][this[_0x834a('0xeb')][_0x4a80a8['actionid']][_0x834a('0xb9')]];for(var _0x2521b4=0x0;_0x2521b4=_0x33b7d1[_0x834a('0x125')]){_0x510b90[_0x834a('0x126')](_0x360a13,_0xa1ea44,_0x38ae79,'reason19\x20machine....');}else{if(_0x360a13[_0x834a('0x11e')]>=_0x33b7d1[_0x834a('0x127')]){_0x510b90['createStateFinal'](_0x360a13,_0xa1ea44,_0x38ae79,_0x834a('0x128'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x360a13[_0x834a('0x11e')],'scheduledat':moment()[_0x834a('0xd8')](_0x33b7d1['dialMachineRetryFrequency'],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x360a13[_0x834a('0xdb')],'ListId':_0x360a13['ListId'],'VoiceQueueId':_0x360a13[_0x834a('0xe7')]||undefined,'CampaignId':_0x360a13[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x129')));_0xa1ea44({'reschedule':0x1});}}});}if(_0x549685[_0x834a('0x41')]==='ivr'&&this[_0x834a('0x22')][_0x549685['queue']][_0x834a('0x11a')]&&_0x2c6e66[_0x834a('0x110')]===_0x834a('0x111')){delete this[_0x834a('0x27')][_0x2c6e66[_0x834a('0xba')]];this[_0x834a('0xc5')](this[_0x834a('0x22')][_0x549685[_0x834a('0xb9')]]);_0x35a8ad=new Hangup(_0x549685,_0x2c6e66);_0x35a8ad[_0x834a('0x6b')]=0x12;_0x35a8ad[_0x834a('0xcc')]=_0x834a('0x113');_0x35a8ad[_0x834a('0x114')]=_0x834a('0x11d');ami[_0x834a('0x40')](_0x834a('0x11f'),ut[_0x834a('0x115')](_0x35a8ad,_0x834a('0x116')));this['saveInDb'](_0x35a8ad,_0x834a('0x12a'),'[syncHangupInAMDIvr]');}if(_0x549685[_0x834a('0x41')]==='ivr'&&this[_0x834a('0x22')][_0x549685[_0x834a('0xb9')]]['dialAMDActive']&&_0x2c6e66[_0x834a('0x110')]===_0x834a('0x11b')){return new Promise(function(_0x17b1c6,_0x54f4bc){delete _0x510b90[_0x834a('0x27')][_0x2c6e66['uniqueid']];_0x510b90[_0x834a('0xc5')](_0x510b90['campaigns'][_0x549685[_0x834a('0xb9')]]);_0x510b90['campaigns'][_0x549685['queue']][_0x834a('0xbf')]+=0x1;_0x510b90['campaigns'][_0x549685['queue']][_0x834a('0x112')]+=0x1;var _0x5f2870=_0x510b90[_0x834a('0x22')][_0x549685[_0x834a('0xb9')]];var _0x4bdd56=new Hangup(_0x549685,_0x2c6e66);_0x4bdd56[_0x834a('0x6b')]=0x13;_0x4bdd56[_0x834a('0xcc')]='Machine';_0x4bdd56['membername']=_0x834a('0x11d');_0x4bdd56['countmachineretry']+=0x1;_0x4bdd56[_0x834a('0xd2')]+=0x1;_0x4bdd56[_0x834a('0x116')]=!![];ami[_0x834a('0x40')]('custom:amd',ut['buildObj'](_0x4bdd56,_0x834a('0x116')));hopperUtils[_0x834a('0xdf')](_0x4bdd56)[_0x834a('0xa0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4bdd56['countbusyretry']+_0x4bdd56[_0x834a('0x121')]+_0x4bdd56[_0x834a('0x12b')]+_0x4bdd56['countnosuchnumberretry']+_0x4bdd56[_0x834a('0xd1')]+_0x4bdd56[_0x834a('0x123')]+_0x4bdd56[_0x834a('0x11e')]+_0x4bdd56[_0x834a('0x124')]>=_0x5f2870['dialGlobalMaxRetry']){_0x510b90['stateGlobal'](_0x4bdd56,_0x17b1c6,_0x54f4bc,'reason19\x20machine....');}else{if(_0x4bdd56[_0x834a('0x11e')]>=_0x5f2870[_0x834a('0x127')]){_0x510b90[_0x834a('0x12c')](_0x4bdd56,_0x17b1c6,_0x54f4bc,_0x834a('0x128'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4bdd56[_0x834a('0x11e')],'scheduledat':moment()[_0x834a('0xd8')](_0x5f2870[_0x834a('0x12d')],_0x834a('0xda'))[_0x834a('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4bdd56['ContactId'],'ListId':_0x4bdd56['ListId'],'VoiceQueueId':_0x4bdd56[_0x834a('0xe7')]||undefined,'CampaignId':_0x4bdd56[_0x834a('0xe8')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x17b1c6({'reschedule':0x1});}}});}}};Dialer[_0x834a('0x1c')]['syncHangup']=function(_0x2b89cc){var _0x3f0a10=this[_0x834a('0x27')][_0x2b89cc[_0x834a('0xba')]];var _0x2710c8;if(_0x3f0a10&&_0x3f0a10[_0x834a('0x41')]===_0x834a('0xbb')){delete this['uniqueId'][_0x2b89cc[_0x834a('0xba')]];this[_0x834a('0xc5')](this[_0x834a('0x22')][_0x3f0a10['queue']]);this[_0x834a('0x22')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0x12e')]+=0x1;_0x2710c8=new Hangup(_0x3f0a10,_0x2b89cc);hopperUtils['createHistory'](_0x2710c8)['catch'](loggerCatch(_0x834a('0x12f')));hopperUtils[_0x834a('0xc4')](_0x2710c8)[_0x834a('0xa0')](loggerCatch(_0x834a('0x130')));}if(_0x3f0a10&&_0x3f0a10[_0x834a('0x41')]!==_0x834a('0xbb')&&isNotNull(this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0x131')])){delete this[_0x834a('0x27')][_0x2b89cc[_0x834a('0xba')]];this['updateOriginated'](this[_0x834a('0x21')][_0x3f0a10['queue']]);this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0xbf')]+=0x1;this[_0x834a('0x21')][_0x3f0a10['queue']][_0x834a('0x112')]+=0x1;_0x2710c8=new Hangup(_0x3f0a10,_0x2b89cc);_0x2710c8[_0x834a('0x6b')]=0x10;_0x2710c8['statedesc']=_0x834a('0x132');_0x2710c8[_0x834a('0x114')]=_0x834a('0x133');hopperUtils['createHistory'](_0x2710c8)[_0x834a('0xa0')](loggerCatch(_0x834a('0x12f')));hopperUtils[_0x834a('0xc4')](_0x2710c8)['catch'](loggerCatch(_0x834a('0x130')));}if(_0x3f0a10&&_0x3f0a10['type']!==_0x834a('0xbb')&&!isNotNull(this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0x131')])){delete this[_0x834a('0x27')][_0x2b89cc[_0x834a('0xba')]];this[_0x834a('0xc5')](this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]]);this[_0x834a('0x21')][_0x3f0a10[_0x834a('0xb9')]][_0x834a('0x134')]+=0x1;_0x2710c8=new Hangup(_0x3f0a10,_0x2b89cc);_0x2710c8[_0x834a('0x6b')]=0xc;_0x2710c8[_0x834a('0xcc')]=_0x2b89cc[_0x834a('0x135')];_0x2710c8[_0x834a('0x114')]=_0x834a('0x136');hopperUtils['createHistory'](_0x2710c8)['catch'](loggerCatch(_0x834a('0x12f')));hopperUtils[_0x834a('0xc4')](_0x2710c8)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x834a('0x1c')][_0x834a('0xb')]=function(_0x418133){var _0x426622=this;if(!_0x426622[_0x834a('0x2c')][_0x418133[_0x834a('0x46')]]){_0x426622[_0x834a('0x2c')][_0x418133[_0x834a('0x46')]]={'running':![]};}else if(_0x426622[_0x834a('0x2c')][_0x418133['name']][_0x834a('0x137')]===!![]){return;}else if(_0x426622[_0x834a('0x2c')][_0x418133['name']][_0x834a('0x137')]===![]){_0x426622['queuesSummary'][_0x418133[_0x834a('0x46')]][_0x834a('0x137')]=!![];}var _0xf058c5=_0x426622[_0x834a('0x21')][_0x418133[_0x834a('0x46')]];var _0x4d25e4=_0xf058c5[_0x834a('0x66')]!==utils['CAMPAIGN_STATUS'][_0x834a('0x76')];var _0x15ad3f=utils[_0x834a('0x138')](_0xf058c5);_0xf058c5[_0x834a('0x139')]=utils[_0x834a('0x13a')](_0xf058c5,_0x426622[_0x834a('0x24')]);Promise['resolve']()[_0x834a('0x94')](function(){if(_0xf058c5[_0x834a('0x139')]===utils[_0x834a('0x67')]['INACTIVE']){if(_0x4d25e4){clearPredictiveAttributes(_0xf058c5);_0x418133[_0x834a('0x5f')]=undefined;_0x418133['startProgressive']=undefined;}if(_0xf058c5['statusMessage']===utils[_0x834a('0x67')][_0x834a('0x76')]){_0x418133[_0x834a('0x13b')]=0x0;_0x418133[_0x834a('0xf8')]=0x0;_0x418133['inUse']=0x0;_0x418133[_0x834a('0x13c')]=0x0;_0x418133[_0x834a('0x13d')]=0x0;}}else if(_0xf058c5[_0x834a('0x139')]===utils[_0x834a('0x67')][_0x834a('0x13e')]&&!_0x15ad3f){return _0x426622['ifTime'](_0xf058c5,!![])[_0x834a('0x94')](function(){return _0x426622['ifTime'](_0xf058c5,![]);})['then'](function(){return _0x426622[_0x834a('0xa8')](_0xf058c5);})['catch'](function(_0x37d9f9){loggerSyncQueueSummary[_0x834a('0x43')]('[syncQueueSummary]',util['inspect'](_0x37d9f9,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xf058c5);});}else{clearPredictiveAttributes(_0xf058c5);}})[_0x834a('0x94')](function(){var _0x362bee=_0x418133[_0x834a('0x13f')](_0xf058c5);if(_0x362bee||_0xf058c5[_0x834a('0x140')]){_0xf058c5['queueSummaryCountersUpdated']=![];_0x418133[_0x834a('0x141')](_0xf058c5);Object[_0x834a('0x142')](_0xf058c5,_0x418133);emitOutboundVoiceQueueSummary(_0x418133);}_0x426622[_0x834a('0x2c')][_0xf058c5[_0x834a('0x46')]][_0x834a('0x137')]=![];})[_0x834a('0xa0')](function(_0x39ff9e){logger[_0x834a('0x62')](_0x834a('0x143'),util[_0x834a('0x44')](_0x39ff9e,{'showHidden':![],'depth':null}));_0x426622['queuesSummary'][_0xf058c5['name']][_0x834a('0x137')]=![];});};Dialer['prototype'][_0x834a('0x144')]=_[_0x834a('0x145')](function(){var _0xe32860=_['filter'](this['voiceQueues'],function(_0x654ff2){return _0x654ff2[_0x834a('0x146')];});var _0x832a3f=_[_0x834a('0x147')](this[_0x834a('0x23')],function(_0x78ce38){return _0x78ce38[_0x834a('0x148')]&&_0x78ce38['status']==='reachable';});if(_0xe32860[_0x834a('0x149')]>0x0&&_0x832a3f['length']>0x0){return Promise[_0x834a('0xa4')]()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0x834a('0x14a')](_0xe32860,'id'),previewRecallmeReminderInterval,_[_0x834a('0x14a')](_0x832a3f,'id')))[_0x834a('0x94')](function(_0x382a2b){for(var _0x59deeb=0x0;_0x59deeb<_0x382a2b['length'];_0x59deeb++){var _0xc97696=_0x382a2b[_0x59deeb][_0x834a('0x14b')]['name'];if(_0xc97696)io['to'](util[_0x834a('0x45')](_0x834a('0x14c'),_0xc97696))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x382a2b[_0x59deeb]});}})['catch'](function(_0x233580){logger[_0x834a('0x62')]('checkPreviewRecallReminder',_0x233580);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x834a('0x1c')][_0x834a('0x14d')]=function(){var _0x187763=this;setInterval(function(){_0x187763[_0x834a('0x14e')](_0x187763['uniqueId'],_0x834a('0x14f'));_0x187763[_0x834a('0x14e')](_0x187763[_0x834a('0xeb')],'[actions]');},0x32c8);};Dialer[_0x834a('0x1c')][_0x834a('0x14e')]=function(_0x1c6d09,_0x537126){var _0x387856=this;for(var _0x5ad4bf in _0x1c6d09){if(typeof _0x1c6d09[_0x5ad4bf]!==_0x834a('0xa2')){this[_0x834a('0x20')][_0x834a('0x1d')](function(){if(!_[_0x834a('0xf0')](_0x1c6d09[_0x5ad4bf])){return ami[_0x834a('0x91')]({'action':_0x834a('0x82'),'channel':_0x1c6d09[_0x5ad4bf][_0x834a('0xec')]})['catch'](function(_0x3ab8c7){if(_0x3ab8c7['message']===_0x834a('0x150')){setTimeout(function(){if(_0x1c6d09[_0x5ad4bf]&&_0x1c6d09[_0x5ad4bf][_0x834a('0x41')]!==_0x834a('0xbb')){_0x387856['updateOriginated'](_0x387856[_0x834a('0x21')][_0x1c6d09[_0x5ad4bf][_0x834a('0xb9')]]);logger['error']('[Dialer][checkChannel]',_0x537126,_0x5ad4bf,_0x1c6d09[_0x5ad4bf][_0x834a('0xb9')]);delete _0x1c6d09[_0x5ad4bf];}if(_0x1c6d09[_0x5ad4bf]&&_0x1c6d09[_0x5ad4bf]['type']===_0x834a('0xbb')){_0x387856[_0x834a('0xc5')](_0x387856[_0x834a('0x22')][_0x1c6d09[_0x5ad4bf][_0x834a('0xb9')]]);logger[_0x834a('0x62')](_0x834a('0x151'),_0x537126,_0x5ad4bf,_0x1c6d09[_0x5ad4bf]['queue']);delete _0x1c6d09[_0x5ad4bf];}},0x2328);}});}});}}};Dialer[_0x834a('0x1c')]['getVoiceQueueRtPauses']=function(_0x50135b){return Promise[_0x834a('0xa4')]()[_0x834a('0x94')](voiceQueueRt[_0x834a('0x152')](_0x50135b))[_0x834a('0xa0')](loggerCatch(_0x834a('0x153')));};Dialer[_0x834a('0x1c')][_0x834a('0xc5')]=function(_0x3cae54){if(!_[_0x834a('0x3f')](_0x3cae54)&&_0x3cae54!==null){if(typeof _0x3cae54[_0x834a('0x154')]!==_0x834a('0xa2')){if(_0x3cae54['originated']>0x0){_0x3cae54['originated']-=0x1;}else{logger[_0x834a('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x834a('0x62')](_0x834a('0x155'));}};Dialer[_0x834a('0x1c')]['loggerHandler']=function(_0x4ba4eb,_0x1ddc29){var _0x4355d8=this;return function(_0x1a75bb){_0x4355d8['updateOriginated'](_0x1ddc29);logger[_0x834a('0x62')](_0x4ba4eb,util[_0x834a('0x44')](_0x1a75bb,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x834a('0x156')]=function(_0x39c487,_0x261617,_0xdf216d){var _0x411991={'state':0x19,'statedesc':_0x834a('0x157')};this[_0x834a('0xc5')](_0x261617);this['saveInDb'](_[_0x834a('0xf6')](_0x411991,_[_0x834a('0x100')](_0xdf216d,['ContactId',_0x834a('0xdc'),_0x834a('0x158'),'VoiceQueueId','CampaignId'])),_0x834a('0x159'),'[emptyContact]');logger[_0x834a('0x62')](_0x39c487);};Dialer[_0x834a('0x1c')][_0x834a('0x117')]=function(_0x6b9d70,_0x144a16,_0x2b10b2){hopperUtils['createHistory'](_0x6b9d70)[_0x834a('0xa0')](loggerCatch(_0x144a16));hopperUtils['moveContactManagedDialer'](_0x6b9d70)[_0x834a('0xa0')](loggerCatch(_0x2b10b2));};Dialer[_0x834a('0x1c')][_0x834a('0xd6')]=function(_0x31efcd,_0x321287){hopperUtils[_0x834a('0xdf')](_0x31efcd)[_0x834a('0xa0')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x321287==0x0){hopperUtils[_0x834a('0xc4')](_0x31efcd)[_0x834a('0xa0')](loggerCatch(_0x834a('0x15a')));}};Dialer['prototype'][_0x834a('0x15b')]=function(_0xc83d79){return Promise[_0x834a('0xa4')]()[_0x834a('0x94')](cmHopper['handlePreviewRecallNotifications'](_0xc83d79['id'],previewRecallmeReminderInterval))['then'](function(_0x347a9d){for(var _0x186971=0x0;_0x186971<_0x347a9d[_0x834a('0x149')];_0x186971++){var _0xbe2024=_0x347a9d[_0x186971][_0x834a('0x14b')][_0x834a('0x46')];if(_0xbe2024)io['to'](util[_0x834a('0x45')]('user:%s',_0xbe2024))['emit'](_0x834a('0x15c'),{'hopper':_0x347a9d[_0x186971]});}})[_0x834a('0xa0')](function(){});};Dialer[_0x834a('0x1c')]['launchHandleIvr']=function(_0x261d12){var _0x2d008f=this;return function(){_0x2d008f[_0x834a('0x15d')](_0x261d12);};};Dialer[_0x834a('0x1c')][_0x834a('0x15e')]=function(_0x449be3,_0x109acd){var _0xa45e83=this;var _0x55d0fd=uuid['v4']();this[_0x834a('0xeb')][_0x55d0fd]=new Action(_0x449be3,_0x109acd,_0x55d0fd);return new Promise(function(_0x4dd31a,_0x3f4f82){if(_[_0x834a('0x3f')](_0x449be3)&&typeof _0x449be3!=='object'){return _0x3f4f82(msgResponse('originate','Failure',_0x834a('0x15f')));}if(_[_0x834a('0x3f')](_0x109acd[_0x834a('0x160')])||_0x109acd[_0x834a('0x160')]===null){return _0x3f4f82(msgResponse('originate',_0x834a('0x8e'),_0x834a('0x161')));}var _0x26928f={'XMD-CALLERID':_0xa45e83[_0x834a('0xeb')][_0x55d0fd][_0x834a('0x162')](),'XMD-AGI':_0x449be3[_0x834a('0x131')]?util[_0x834a('0x45')]('\x22agi://%s/square,%s\x22',ipAgi,_0x449be3[_0x834a('0x131')]):_0x834a('0x163'),'XMD-AGIAFTER':_0x449be3[_0x834a('0xd0')]?util[_0x834a('0x45')](_0x834a('0x164'),ipAgi,_0x449be3[_0x834a('0xd0')]):'NONE','XMD-QUEUE':utils[_0x834a('0x165')](_0x449be3)?util[_0x834a('0x45')](_0x834a('0x166'),_0x449be3[_0x834a('0x46')],_0x449be3[_0x834a('0x167')]||'',_0x449be3[_0x834a('0x168')]?'c':'',_0x449be3['dialQueueTimeout']||0x3):_0x834a('0x163'),'XMD-CONTACTID':_0x109acd[_0x834a('0xdb')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xa45e83['actions'][_0x55d0fd][_0x834a('0x162')](),'XMD-AMD':_0x449be3['dialAMDActive']?_0x834a('0x13e'):_0x834a('0x163'),'XMD-DESTINATION':_0x834a('0x10f')};if(_0x449be3[_0x834a('0x11a')]){_0x26928f[_0x834a('0x169')]=_0x449be3[_0x834a('0x16a')]||0x9c4;_0x26928f['XMD-AMDGREETING']=_0x449be3['dialAMDGreeting']||0x5dc;_0x26928f[_0x834a('0x16b')]=_0x449be3[_0x834a('0x16c')]||0x320;_0x26928f[_0x834a('0x16d')]=_0x449be3[_0x834a('0x16e')]||0x1388;_0x26928f['XMD-AMDMINWORDLENGTH']=_0x449be3['dialAMDMinWordLength']||0x64;_0x26928f['XMD-AMDBETWEENWORDSSILENCE']=_0x449be3['dialAMDBetweenWordsSilence']||0x32;_0x26928f[_0x834a('0x16f')]=_0x449be3[_0x834a('0x170')]||0x3;_0x26928f[_0x834a('0x171')]=_0x449be3[_0x834a('0x172')]||0x100;_0x26928f[_0x834a('0x173')]=_0x449be3[_0x834a('0x174')]||0x1388;}if(utils[_0x834a('0x165')](_0x449be3)){_0x26928f[_0x834a('0x175')]=_0x109acd[_0x834a('0xe7')];}else{_0x26928f[_0x834a('0x176')]=_0x109acd[_0x834a('0xe8')];}var _0x53906e=utils['setXMDContactVariables'](_0x109acd[_0x834a('0x177')]);Object[_0x834a('0x142')](_0x26928f,_0x53906e);var _0x201664=_0xa45e83[_0x834a('0x85')](_0x449be3[_0x834a('0x86')])?utils[_0x834a('0x178')](_0x449be3[_0x834a('0x86')]['callerid'],_0x449be3[_0x834a('0x179')],_0x449be3[_0x834a('0x17a')]>0x0?utils[_0x834a('0x17b')](_0x449be3[_0x834a('0x17c')],_0x449be3[_0x834a('0x17a')]):_0x449be3[_0x834a('0x17c')]):utils[_0x834a('0x178')](_[_0x834a('0xf0')](_0x449be3[_0x834a('0x87')])?_0x449be3[_0x834a('0x86')]['callerid']:_0x449be3[_0x834a('0x87')]['callerid'],_0x449be3[_0x834a('0x179')],_0x449be3[_0x834a('0x17a')]>0x0?utils[_0x834a('0x17b')](_0x449be3[_0x834a('0x17c')],_0x449be3[_0x834a('0x17a')]):_0x449be3['dialOriginateCallerIdNumber']);if(_0x201664){_0x26928f[_0x834a('0x17d')]=_0xa45e83[_0x834a('0xeb')][_0x55d0fd][_0x834a('0x17e')]=utils[_0x834a('0x17f')](_0x201664);_0x26928f[_0x834a('0x180')]=_0x109acd[_0x834a('0x160')];}_0x449be3[_0x834a('0x181')]=_0x26928f;return ami[_0x834a('0x91')]({'actionid':_0x55d0fd,'action':_0x834a('0x182'),'channel':_0xa45e83[_0x834a('0x85')](_0x449be3[_0x834a('0x86')])?util[_0x834a('0x45')](_0x834a('0x183'),_0x449be3[_0x834a('0x86')][_0x834a('0x46')],isNotNull(_0x449be3['dialPrefix'])?_0x449be3[_0x834a('0x184')][_0x834a('0x185')]()||'':'',_0x449be3[_0x834a('0x186')]>0x0?_0x109acd['phone']['substring'](_0x449be3[_0x834a('0x186')]):_0x109acd[_0x834a('0x160')]):util[_0x834a('0x45')](_0x834a('0x183'),_[_0x834a('0xf0')](_0x449be3[_0x834a('0x87')])?_0x449be3['Trunk'][_0x834a('0x46')]:_0x449be3['TrunkBackup']['name'],isNotNull(_0x449be3['dialPrefix'])?_0x449be3['dialPrefix'][_0x834a('0x185')]()||'':'',_0x449be3['dialCutDigit']>0x0?_0x109acd[_0x834a('0x160')][_0x834a('0x187')](_0x449be3[_0x834a('0x186')]):_0x109acd[_0x834a('0x160')]),'callerid':_0x201664,'Exten':_0x834a('0x10f'),'Context':_0x834a('0x188'),'Priority':'1','variable':_0x26928f,'timeout':(_0x449be3[_0x834a('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55d0fd})[_0x834a('0x94')](function(_0x55b04c){return _0x4dd31a(_0x55b04c);})[_0x834a('0xa0')](function(_0x55999d){_0x449be3['outboundOriginateFailureCallsDay']+=0x1;var _0x21916b=new History(_0xa45e83['actions'][_0x55d0fd]);logger[_0x834a('0x62')](util[_0x834a('0x45')](_0x834a('0x18a'),JSON['stringify'](_0x55999d)));_0x21916b['state']=0xe;_0x21916b[_0x834a('0xcc')]='OriginateError';_0x21916b['starttime']=moment()[_0x834a('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x21916b[_0x834a('0x6c')]=_0x21916b[_0x834a('0x6d')];hopperUtils['createHistory'](_0x21916b)['catch'](loggerCatch('[originate][error]'));_0xa45e83[_0x834a('0xc4')](_0x21916b)[_0x834a('0xa0')](loggerCatch('[originate][error]'))[_0x834a('0x1f')](function(){delete _0xa45e83[_0x834a('0xeb')][_0x55d0fd];return _0x3f4f82(msgResponse(_0x834a('0x182'),'Error',_0x834a('0x18b')));});});});};Dialer[_0x834a('0x1c')][_0x834a('0x18c')]=function(_0x38dc50,_0x4430d6,_0x494881){var _0x505684=new History(_0x4430d6);if(_0x505684['countbusyretry']+_0x505684[_0x834a('0x121')]+_0x505684[_0x834a('0x12b')]+_0x505684[_0x834a('0x122')]+_0x505684[_0x834a('0xd1')]+_0x505684[_0x834a('0x123')]+_0x505684[_0x834a('0x11e')]+_0x505684[_0x834a('0x124')]>=_0x494881['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x38dc50){case 0x3:if(_0x505684[_0x834a('0x12b')]>=_0x494881[_0x834a('0x18d')]-0x1){return!![];}hopperUtils[_0x834a('0xd7')]({'active':![],'countnoanswerretry':_0x505684[_0x834a('0x12b')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x18e')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684['ListId'],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x505684[_0x834a('0x120')]>=_0x494881[_0x834a('0x18f')]-0x1){return!![];}hopperUtils[_0x834a('0xd7')]({'active':![],'countbusyretry':_0x505684[_0x834a('0x120')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x190')],_0x834a('0xda'))['format'](_0x834a('0xbd')),'ContactId':_0x505684['ContactId'],'ListId':_0x505684[_0x834a('0xdc')],'VoiceQueueId':_0x505684['VoiceQueueId']||undefined,'CampaignId':_0x505684['CampaignId']||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x191')));break;case 0x8:if(_0x505684['countcongestionretry']>=_0x494881['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x834a('0xd7')]({'active':![],'countcongestionretry':_0x505684[_0x834a('0x121')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x192')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684[_0x834a('0xdc')],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x193')));break;case 0x0:if(_0x505684[_0x834a('0x122')]>=_0x494881[_0x834a('0x194')]-0x1){return!![];}else{hopperUtils[_0x834a('0xd7')]({'active':![],'countnosuchnumberretry':_0x505684[_0x834a('0x122')]+=0x1,'scheduledat':moment()['add'](_0x494881['dialNoSuchNumberRetryFrequency'],'minutes')[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684[_0x834a('0xdc')],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684['CampaignId']||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x195')));}break;case 0xa:if(_0x505684[_0x834a('0xd1')]>=_0x494881[_0x834a('0xd5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x505684[_0x834a('0xd1')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881['dialDropRetryFrequency'],'minutes')[_0x834a('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684['ListId'],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x196')));break;case 0xb:if(_0x505684['countabandonedretry']>=_0x494881[_0x834a('0xe6')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x505684[_0x834a('0x123')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0xe4')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684['ListId'],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})['catch'](loggerCatch(_0x834a('0xe9')));break;case 0x13:if(_0x505684['countmachineretry']>=_0x494881[_0x834a('0x127')]-0x1){return!![];}hopperUtils[_0x834a('0xd7')]({'active':![],'countmachineretry':_0x505684[_0x834a('0x11e')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x12d')],_0x834a('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684[_0x834a('0xdc')],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x505684['countagentrejectretry']>=_0x494881['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x505684[_0x834a('0x124')]+=0x1,'scheduledat':moment()[_0x834a('0xd8')](_0x494881[_0x834a('0x197')],_0x834a('0xda'))[_0x834a('0x45')](_0x834a('0xbd')),'ContactId':_0x505684[_0x834a('0xdb')],'ListId':_0x505684['ListId'],'VoiceQueueId':_0x505684[_0x834a('0xe7')]||undefined,'CampaignId':_0x505684[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x198')));break;default:return!![];}};Dialer[_0x834a('0x1c')]['callProgressDetecting']=function(_0x510884,_0xc82621,_0x4956b3){var _0x424e75=this;var _0x13df24=new History(_0x510884);var _0x430f65=![];var _0x50ab7a;var _0x1badbd;return new Promise(function(_0x4c6c71,_0x5b6a83){if(_['isUndefined'](_0xc82621)&&typeof _0xc82621!==_0x834a('0x199')){return _0x5b6a83(msgResponse(_0x834a('0x19a'),_0x834a('0x8e'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x4956b3)&&typeof _0x4956b3!=='object'){return _0x5b6a83(msgResponse('[callProgressDetecting]',_0x834a('0x8e'),_0x834a('0x19b')));}hopperUtils[_0x834a('0x19c')](_0x13df24,_0x4956b3[_0x834a('0xc0')],_0xc82621)[_0x834a('0x94')](function(_0x533143){if(_0x533143['additional']==0x1)_0x430f65=!![];switch(_0x4956b3['reason']){case'0':_0xc82621['outboundNoSuchCallsDay']+=0x1;_0x13df24[_0x834a('0x6b')]=0x0;_0x13df24[_0x834a('0xcc')]=_0x834a('0x19d');_0x13df24[_0x834a('0x122')]+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;ami[_0x834a('0x40')](_0x834a('0x19e'),ut['buildObj'](_0x510884,_0x834a('0x19f')));_0x50ab7a=_0xc82621['dialNoSuchNumberRetryFrequency'];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils[_0x834a('0xdf')](_0x13df24)['catch'](loggerCatch(_0x834a('0x1a0')));if(_0x424e75[_0x834a('0x18c')](0x0,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x122')]>=_0xc82621['dialNoSuchNumberMaxRetry']){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1a1'));}else{_0x424e75['stateGlobal'](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1a1'));}}break;case'3':_0xc82621[_0x834a('0x1a2')]+=0x1;_0x13df24['state']=0x3;_0x13df24[_0x834a('0xcc')]=_0x834a('0x1a3');_0x13df24[_0x834a('0x12b')]+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;var _0x7cd6cf=ut[_0x834a('0x1a4')](_0x510884,_0xc82621);ami[_0x834a('0x40')](_0x834a('0x1a5'),_0x7cd6cf);_0x50ab7a=_0xc82621[_0x834a('0x18e')];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils['createHistory'](_0x13df24)[_0x834a('0xa0')](loggerCatch(_0x834a('0x1a6')));if(_0x424e75[_0x834a('0x18c')](0x3,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x12b')]>=_0xc82621[_0x834a('0x18d')]){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,'reason\x203\x20ringing\x20no\x20answer');}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1a7'));}}break;case'5':_0xc82621['outboundBusyCallsDay']+=0x1;_0x13df24[_0x834a('0x6b')]=0x5;_0x13df24[_0x834a('0xcc')]=_0x834a('0x1a8');_0x13df24['countbusyretry']+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;ami[_0x834a('0x40')](_0x834a('0x1a9'),ut[_0x834a('0x115')](_0x510884,_0x834a('0x1aa')));_0x50ab7a=_0xc82621[_0x834a('0x190')];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils['createHistory'](_0x13df24)[_0x834a('0xa0')](loggerCatch(_0x834a('0x1ab')));if(_0x424e75[_0x834a('0x18c')](0x5,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x120')]>=_0xc82621[_0x834a('0x18f')]){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1ac'));}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1ac'));}}break;case'8':_0xc82621[_0x834a('0x1ad')]+=0x1;_0x13df24[_0x834a('0x6b')]=0x8;_0x13df24[_0x834a('0xcc')]=_0x834a('0x1ae');_0x13df24[_0x834a('0x121')]+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;_0x50ab7a=_0xc82621[_0x834a('0x192')];_0x1badbd=_0xc82621['callAdditionalPhoneAfterMin'];ami[_0x834a('0x40')]('custom:agentcongestion',ut['buildObj'](_0x510884,'congestion'));hopperUtils[_0x834a('0xdf')](_0x13df24)[_0x834a('0xa0')](loggerCatch(_0x834a('0x1af')));if(_0x424e75['checkRetriveMax'](0x8,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x121')]>=_0xc82621[_0x834a('0x1b0')]){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,'reason\x208\x20congestion');}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1b1'));}}break;case'11':_0xc82621[_0x834a('0x1b2')]+=0x1;_0x13df24[_0x834a('0x6b')]=0xb;_0x13df24[_0x834a('0xcc')]='Abandoned';_0x13df24[_0x834a('0x123')]+=0x1;_0x13df24[_0x834a('0xd2')]+=0x1;_0x50ab7a=_0xc82621[_0x834a('0xe4')];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils[_0x834a('0xdf')](_0x13df24)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x424e75[_0x834a('0x18c')](0xb,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x123')]>=_0xc82621['dialAbandonedMaxRetry']){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1b3'));}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,'reason\x2011\x20abandoned');}}break;case'20':_0xc82621[_0x834a('0x1b4')]+=0x1;_0x13df24[_0x834a('0x6b')]=0x14;_0x13df24[_0x834a('0xcc')]=_0x834a('0x1b5');_0x13df24[_0x834a('0x124')]+=0x1;_0x13df24['countglobal']+=0x1;_0x50ab7a=_0xc82621[_0x834a('0x197')];_0x1badbd=_0xc82621[_0x834a('0xd3')];ami['emit'](_0x834a('0x1b6'),ut['buildObj'](_0x510884,_0x834a('0x1b7')));hopperUtils[_0x834a('0xdf')](_0x13df24)['catch'](loggerCatch(_0x834a('0x1b8')));if(_0x424e75[_0x834a('0x18c')](0x14,_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x124')]>=_0xc82621[_0x834a('0x1b9')]){_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1ba'));}else{_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x834a('0x1ba'));}}break;default:_0xc82621[_0x834a('0x134')]+=0x1;_0x13df24['state']=0xc;_0x13df24[_0x834a('0xcc')]=_0x4956b3[_0x834a('0xc0')];_0x50ab7a=_0xc82621['dialAgentRejectRetryFrequency'];_0x1badbd=_0xc82621[_0x834a('0xd3')];hopperUtils['createHistory'](_0x13df24)[_0x834a('0xa0')](loggerCatch(_0x834a('0x1bb')));if(_0x424e75['checkRetriveMax'](_0x4956b3[_0x834a('0xc0')],_0x510884,_0xc82621)&&!_0x430f65){if(_0x13df24[_0x834a('0x120')]+_0x13df24[_0x834a('0x121')]+_0x13df24[_0x834a('0x12b')]+_0x13df24[_0x834a('0x122')]+_0x13df24[_0x834a('0xd1')]+_0x13df24[_0x834a('0x123')]+_0x13df24[_0x834a('0x11e')]+_0x13df24[_0x834a('0x124')]>=_0xc82621[_0x834a('0x125')]){_0x424e75[_0x834a('0x126')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x4956b3['reason']);}else{_0x424e75[_0x834a('0x12c')](_0x13df24,_0x4c6c71,_0x5b6a83,_0x4956b3[_0x834a('0xc0')]);}}}})['then'](function(){if(_0x430f65){hopperUtils[_0x834a('0xe1')](_0x13df24,_0x50ab7a,_0x1badbd)[_0x834a('0x94')](function(){return _0x4c6c71(0x1);});}});});};Dialer[_0x834a('0x1c')]['stateGlobal']=function(_0x27a63b,_0x1d940f,_0x25fe57,_0x1496b9){var _0x4c0dfe=new Final(_0x27a63b);_0x4c0dfe[_0x834a('0x6b')]=0xf;_0x4c0dfe[_0x834a('0xcc')]='Global';this[_0x834a('0x12c')](_0x4c0dfe,_0x1d940f,_0x25fe57,_0x1496b9);};Dialer[_0x834a('0x1c')][_0x834a('0x12c')]=function(_0x1ba8a0,_0x4c5ef2,_0x4fa4bd,_0xa0b8f){hopperUtils[_0x834a('0xc4')](_0x1ba8a0)['then'](function(){return _0x4c5ef2(msgResponse('[callProgressDetecting]','Success',_0xa0b8f));})[_0x834a('0xa0')](function(){return _0x4fa4bd(msgResponse(_0x834a('0x1bc'),_0x834a('0x8e'),_0x834a('0x1bd')));});};Dialer[_0x834a('0x1c')][_0x834a('0xaa')]=function(_0x43dc28){var _0x422511=_0x43dc28[_0x834a('0x1be')]/0x64;var _0x4e0cf9=_0x43dc28[_0x834a('0xca')]/(_0x43dc28['outboundDropCallsDayTimeout']+_0x43dc28[_0x834a('0xbf')]);var _0x18669f=Math[_0x834a('0x1bf')](_0x43dc28[_0x834a('0x1c0')]*(_0x43dc28[_0x834a('0x1c1')]/0x64));var _0x46938d=Math[_0x834a('0x1bf')](_0x43dc28[_0x834a('0x1c0')]*(_0x43dc28[_0x834a('0x1c2')]/0x64));var _0x3caca8=_0x43dc28[_0x834a('0x13b')]+_0x43dc28[_0x834a('0x13c')];var _0x10fc56=Math['floor'](_0x43dc28[_0x834a('0x57')]*_0x43dc28[_0x834a('0x5b')]*_0x43dc28[_0x834a('0x1c3')]*_0x43dc28['predictiveIntervalMultiplicativeFactor']);if(_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x29')])){if(!_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x5f')])){_0x43dc28[_0x834a('0x5f')]=undefined;loggerPredictive[_0x834a('0x62')](_0x834a('0x1c4'),_0x834a('0x1c5'));}if(!_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x60')])){loggerPredictive[_0x834a('0x62')]('[startMethodPredictive][StartProgressive]',_0x834a('0x1c6'));clearInterval(_0x43dc28['handlePredictive']);_0x43dc28[_0x834a('0x60')]=undefined;}_0x43dc28['startProgressive']=moment()[_0x834a('0x45')](_0x834a('0xbd'));loggerPredictive['info'](_0x43dc28['name'],'collection\x20data\x20in\x20progressive\x20at',_0x43dc28['startProgressive']);this[_0x834a('0xac')](_0x43dc28,0x1);}else if(ifInterval(_0x43dc28['dialPredictiveInterval'],_0x43dc28['startProgressive'])){this[_0x834a('0xac')](_0x43dc28,0x1);loggerPredictiveCalls['info'](_0x834a('0x1c7'),_0x43dc28[_0x834a('0x29')],_0x43dc28['name']);_0x43dc28['erlangCalls']=0x0;_0x43dc28['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x422511<_0x4e0cf9&&_0x43dc28['dialPredictiveOptimization']===_0x834a('0x1c8')){clearPredictiveAttributes(_0x43dc28);loggerPredictive['info'](_0x834a('0x1c9'),_0x834a('0x1ca'),_0x4e0cf9,_0x834a('0x29'),_0x43dc28[_0x834a('0x46')]);}else if(_0x10fc56<_0x43dc28[_0x834a('0xcb')]&&_0x43dc28[_0x834a('0x1cb')]===_0x834a('0x1c8')){clearPredictiveAttributes(_0x43dc28);loggerPredictive[_0x834a('0x48')](_0x834a('0x1cc'),_0x834a('0x1cd'),_0x10fc56,'Drop\x20in\x20this\x20interval',_0x43dc28[_0x834a('0xcb')],_0x834a('0x29'),_0x43dc28[_0x834a('0x46')]);}else if(!ifInterval(_0x43dc28[_0x834a('0x1ce')],_0x43dc28['startProgressive'])&&_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x5f')])&&!_[_0x834a('0x3f')](_0x43dc28[_0x834a('0x29')])){_0x43dc28['startPredictive']=moment()['format'](_0x834a('0xbd'));loggerPredictive[_0x834a('0x48')](_0x43dc28[_0x834a('0x46')],_0x834a('0x1cf'),_0x43dc28['startPredictive']);hopperUtils['avgHandleTime'](_0x43dc28['dialPredictiveInterval'])[_0x834a('0x94')](this[_0x834a('0x1d0')](_0x43dc28))[_0x834a('0x94')](mergeDataErlangB(_0x43dc28))[_0x834a('0x94')](this[_0x834a('0x1d1')](_0x43dc28))[_0x834a('0xa0')](loggerCatchPredictive(_0x834a('0x1d2'),_0x43dc28));}else if(!ifInterval(_0x43dc28[_0x834a('0x1ce')],_0x43dc28[_0x834a('0x5f')])){_0x43dc28[_0x834a('0xcb')]=0x0;_0x43dc28[_0x834a('0x5f')]=moment()[_0x834a('0x45')](_0x834a('0xbd'));loggerPredictive[_0x834a('0x48')](_0x43dc28[_0x834a('0x46')],'recalculate\x20predictive\x20at',_0x43dc28[_0x834a('0x5f')]);clearInterval(_0x43dc28['handlePredictive']);_0x43dc28[_0x834a('0x60')]=undefined;hopperUtils[_0x834a('0x1d3')](_0x43dc28[_0x834a('0x1ce')])[_0x834a('0x94')](this['getDataPredictive'](_0x43dc28))[_0x834a('0x94')](mergeDataErlangB(_0x43dc28))[_0x834a('0x94')](this['startMethodPredictive'](_0x43dc28))[_0x834a('0xa0')](loggerCatchPredictive(_0x834a('0x1d4'),_0x43dc28));}else if(_0x43dc28[_0x834a('0x1c0')]&&_0x3caca8<_0x43dc28[_0x834a('0x1c0')]-_0x46938d){clearPredictiveAttributes(_0x43dc28);loggerPredictive['info'](_0x43dc28['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3caca8,')\x20are\x20less\x20than\x20threshold\x20(',_0x43dc28[_0x834a('0x1c0')],'-',_0x46938d,'=',_0x43dc28[_0x834a('0x1c0')]-_0x46938d,')');}else if(_0x43dc28[_0x834a('0x1c0')]&&_0x3caca8>_0x43dc28[_0x834a('0x1c0')]+_0x18669f){clearPredictiveAttributes(_0x43dc28);loggerPredictive[_0x834a('0x48')](_0x43dc28[_0x834a('0x46')],_0x834a('0x1d5'),_0x3caca8,')\x20are\x20more\x20than\x20threshold\x20(',_0x43dc28[_0x834a('0x1c0')],'+',_0x18669f,'=',_0x43dc28[_0x834a('0x1c0')]+_0x18669f,')');}};Dialer[_0x834a('0x1c')]['getDataPredictive']=function(_0x583201){var _0x3b205a=this;return function(_0x4c612d){return new Promise(function(_0x44f65d,_0x1e7cc8){_[_0x834a('0xf6')](_0x583201,_0x4c612d[0x0]);if(checkGetDataPredictive(_0x4c612d[0x0])){var _0x489c67=_0x583201['predictiveIntervalAvailable']=_0x583201[_0x834a('0x13c')]+_0x583201['available'];var _0x26fdf4=_0x583201['dialPredictiveInterval']*0x3c;var _0x2babfe=_0x4c612d[0x0][_0x834a('0x53')]+_0x4c612d[0x0][_0x834a('0x1d6')];var _0x495de5=(_0x4c612d[0x0][_0x834a('0x1d7')]+_0x4c612d[0x0][_0x834a('0xc9')]+_0x4c612d[0x0][_0x834a('0x4f')])/_0x4c612d[0x0][_0x834a('0x4b')];_0x583201['predictiveIntervalHitRate']=_0x495de5>0x0?_0x495de5:0x1;switch(_0x583201[_0x834a('0x1cb')]){case _0x834a('0x1c8'):var _0x1c2bca=_0x583201[_0x834a('0x1be')]/0x64;return _0x3b205a[_0x834a('0x1d8')](_0x489c67,_0x26fdf4,_0x2babfe,_0x495de5,_0x1c2bca)[_0x834a('0x94')](function(_0x1a4067){return _0x44f65d(_0x1a4067);});case'agentBusyFactor':var _0x3fb982=_0x583201[_0x834a('0x1be')]/0x64;return _0x3b205a[_0x834a('0x1d9')](_0x489c67,_0x26fdf4,_0x2babfe,_0x495de5,_0x3fb982)[_0x834a('0x94')](function(_0xb918d){return _0x44f65d(_0xb918d);});default:return _0x1e7cc8(msgResponse('[getDataPredictive]',_0x834a('0x8e'),_0x834a('0x1da')));}}else{return _0x1e7cc8(msgResponse(_0x834a('0x1db'),_0x834a('0x8e'),'check\x20failure'));}});};};Dialer[_0x834a('0x1c')][_0x834a('0x1dc')]=function(_0x4be2cd){var _0x4db9a7=this;return function(_0x298492){return new Promise(function(_0x469fc1,_0x5cd107){_['merge'](_0x4be2cd,_0x298492[0x0]);if(checkGetDataPredictive(_0x298492[0x0])){loggerPredictive[_0x834a('0x48')](JSON[_0x834a('0x71')](_0x298492[0x0]));if(_0x4be2cd[_0x834a('0x1cb')]===_0x834a('0x1c8')){return _0x4db9a7[_0x834a('0x152')](_0x4be2cd['id'])[_0x834a('0x94')](function(_0x1879c7){var _0x16910e=_0x4be2cd[_0x834a('0x1dd')]-_0x1879c7[0x0][_0x834a('0x1de')];var _0x4c107d=_0x4be2cd[_0x834a('0x1ce')]*0x3c;var _0x25d145=_0x298492[0x0][_0x834a('0x53')]+_0x298492[0x0][_0x834a('0x1d6')];var _0x5dbadf=(_0x298492[0x0][_0x834a('0x1d7')]+_0x298492[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x298492[0x0][_0x834a('0x4f')])/_0x298492[0x0][_0x834a('0x4b')];var _0x5d3616=_0x4be2cd[_0x834a('0x1be')]/0x64;_0x4be2cd[_0x834a('0x1df')]=_0x1879c7[0x0]['outboundQueuePauses']||0x0;_0x4be2cd[_0x834a('0x1c3')]=_0x5dbadf>0x0?_0x5dbadf:0x1;return _0x4db9a7[_0x834a('0x1d8')](_0x16910e,_0x4c107d,_0x25d145,_0x5dbadf,_0x5d3616);})[_0x834a('0x94')](function(_0x1b12fc){return _0x469fc1(_0x1b12fc);})['catch'](function(_0x2220b0){return _0x5cd107(msgResponse(_0x834a('0x1e0'),_0x834a('0x8e'),JSON[_0x834a('0x71')](_0x2220b0)));});}if(_0x4be2cd[_0x834a('0x1cb')]===_0x834a('0x1e1')){return _0x4db9a7[_0x834a('0x152')](_0x4be2cd['id'])[_0x834a('0x94')](function(_0x459f99){var _0x5e658d=_0x4be2cd['loggedIn']-_0x459f99[0x0]['outboundQueuePauses'];var _0x47cfb9=_0x4be2cd[_0x834a('0x1ce')]*0x3c;var _0x19645c=_0x298492[0x0][_0x834a('0x53')]+_0x298492[0x0][_0x834a('0x1d6')];var _0x333806=(_0x298492[0x0]['predictiveIntervalAnsweredCalls']+_0x298492[0x0][_0x834a('0xc9')]+_0x298492[0x0][_0x834a('0x4f')])/_0x298492[0x0][_0x834a('0x4b')];var _0x205118=_0x4be2cd[_0x834a('0x1be')]/0x64;_0x4be2cd['predictiveIntervalPauses']=_0x459f99[0x0][_0x834a('0x1de')]||0x0;_0x4be2cd[_0x834a('0x1c3')]=_0x333806>0x0?_0x333806:0x1;return _0x4db9a7[_0x834a('0x1d9')](_0x5e658d,_0x47cfb9,_0x19645c,_0x333806,_0x205118);})[_0x834a('0x94')](function(_0x3eb71c){return _0x469fc1(_0x3eb71c);})[_0x834a('0xa0')](function(_0x54f44b){return _0x5cd107(msgResponse(_0x834a('0x1e0'),_0x834a('0x8e'),JSON[_0x834a('0x71')](_0x54f44b)));});}}else{return _0x5cd107(msgResponse(_0x834a('0x1db'),_0x834a('0x8e'),'check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x306e81){var _0x5c805f=this;return function(){var _0x449ce2=0x0;var _0x2d69c7=Math[_0x834a('0x1e2')](_0x306e81[_0x834a('0x59')]*0x3e8);if(_0x2d69c7>0x0){_0x2d69c7=_0x2d69c7<0x64?0x64:_0x2d69c7;loggerPredictive['info'](_0x306e81[_0x834a('0x46')],'one\x20call\x20every:',_0x2d69c7,'milliseconds');_0x306e81['handlePredictive']=setInterval(function(){_0x5c805f[_0x834a('0x60')](_0x306e81);loggerPredictiveCalls['info'](_0x834a('0x1e3'),_0x449ce2+=0x1);},_0x2d69c7);}else{loggerPredictive[_0x834a('0x48')](_0x306e81[_0x834a('0x46')],_0x834a('0x1e4'));}};};Dialer[_0x834a('0x1c')][_0x834a('0x1e5')]=function(_0x55021f,_0x492d9c){var _0x5cbca0=this;return function(_0x438599){if(_[_0x834a('0xfc')](_0x438599)){if(_[_0x834a('0xf0')](_0x492d9c['UserId'])||!_0x492d9c[_0x834a('0x1e6')]){if(_0x55021f['dialMethod']===_0x834a('0x9')){_0x55021f[_0x834a('0x6e')]=_[_0x834a('0x3f')](_0x55021f['queueStatusComplete'])?!![]:_0x55021f['queueStatusComplete'];var _0x3f2723=uuid['v4']();_0x5cbca0[_0x834a('0xeb')][_0x3f2723]=new Action(_0x55021f,_0x492d9c,_0x3f2723);loggerBooked[_0x834a('0x48')](_0x834a('0x1e7'),_0x3f2723,_0x834a('0x1e8'),JSON[_0x834a('0x71')](_0x55021f['queueStatusComplete']),'Queue:\x20',_0x55021f['name']);if(_0x55021f[_0x834a('0x6e')]){_0x55021f[_0x834a('0x6e')]=![];_0x5cbca0[_0x834a('0xf4')][_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xb9')]]=[];ami[_0x834a('0x91')]({'actionid':_0x3f2723,'action':_0x834a('0x1e9'),'queue':_0x55021f[_0x834a('0x46')]})[_0x834a('0xa0')](function(){_0x5cbca0[_0x834a('0xc5')](_0x55021f);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xdb')],'ListId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xdc')],'VoiceQueueId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723]['VoiceQueueId']||undefined,'CampaignId':_0x5cbca0['actions'][_0x3f2723][_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x1ea')));delete _0x5cbca0[_0x834a('0xeb')][_0x3f2723];});}else{loggerBooked[_0x834a('0x48')](_0x834a('0x1eb'),JSON[_0x834a('0x71')](_0x55021f['queueStatusComplete']),'Queue:\x20',_0x55021f['name']);_0x5cbca0['updateOriginated'](_0x55021f);hopperUtils[_0x834a('0xd7')]({'active':![],'ContactId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xdb')],'ListId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xdc')],'VoiceQueueId':_0x5cbca0['actions'][_0x3f2723][_0x834a('0xe7')]||undefined,'CampaignId':_0x5cbca0[_0x834a('0xeb')][_0x3f2723][_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x1ea')));delete _0x5cbca0[_0x834a('0xeb')][_0x3f2723];}}else{return _0x5cbca0['actionOriginate'](_0x55021f,_0x492d9c);}}else{if(utils[_0x834a('0x5d')](undefined,_0x492d9c[_0x834a('0x1ec')])<_0x55021f[_0x834a('0x1ed')]*0x3c){if(_0x492d9c['Agent']&&!_0x492d9c[_0x834a('0x14b')]['voicePause']){_0x5cbca0[_0x834a('0xf9')][_0x834a('0xfa')](_0x492d9c['id'])['finally'](function(){_0x5cbca0['updateOriginated'](_0x55021f);});}else{hopperUtils[_0x834a('0x1ee')]({'active':![]},_0x492d9c['id'],0x1)['finally'](function(){_0x5cbca0[_0x834a('0xc5')](_0x55021f);});}}else{_0x55021f[_0x834a('0x1ef')]+=0x1;_0x5cbca0[_0x834a('0xc5')](_0x55021f);if(_0x55021f[_0x834a('0x1f0')]){hopperUtils[_0x834a('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x492d9c[_0x834a('0xdb')],'ListId':_0x492d9c['ListId'],'VoiceQueueId':_0x492d9c[_0x834a('0xe7')]||undefined,'CampaignId':_0x492d9c[_0x834a('0xe8')]||undefined})[_0x834a('0xa0')](loggerCatch(_0x834a('0x1f1')));hopperUtils[_0x834a('0xdf')](createObjHistory(_0x55021f,_0x492d9c,utils[_0x834a('0x67')][_0x834a('0x1f2')],0x17,'RecallInQueue'))[_0x834a('0xa0')](loggerCatch(_0x834a('0x1f3')));}else{_0x5cbca0[_0x834a('0x117')](createObjHistory(_0x55021f,_0x492d9c,utils[_0x834a('0x67')][_0x834a('0x1f4')],0x16,_0x834a('0x1f5')),_0x834a('0x1f6'),_0x834a('0x1f7'));}}}}else{_0x55021f[_0x834a('0x1f8')]+=0x1;_0x5cbca0[_0x834a('0x117')](createObjHistory(_0x55021f,_0x492d9c,utils[_0x834a('0x67')][_0x834a('0x1f9')],0xd,_0x834a('0x1fa')),_0x834a('0x1fb'),_0x834a('0x1fc'));throw _0x834a('0x1fd');}};};Dialer['prototype'][_0x834a('0x15d')]=function(_0x3abd70){var _0x8eb27e=this;var _0x4ee5a9=_0x3abd70[_0x834a('0x1fe')]-_0x3abd70[_0x834a('0x154')];emitCampaignSummary(_0x3abd70);if(_0x4ee5a9>0x0&&_0x3abd70[_0x834a('0x64')]==0x0){if(_0x4ee5a9>this[_0x834a('0x25')]){_0x4ee5a9=this[_0x834a('0x25')];}_0x3abd70[_0x834a('0x64')]=0x1;hopperUtils[_0x834a('0x1ff')](_0x3abd70,_0x4ee5a9)[_0x834a('0x94')](function(_0x405c83){_0x3abd70[_0x834a('0x64')]=0x0;if(_0x405c83){if(!utils['checkContactEmpty'](_0x405c83)){_0x3abd70['message']=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x3abd70[_0x834a('0x46')]);}else{_0x3abd70[_0x834a('0x154')]+=_0x405c83['length'];_0x3abd70['message']=utils[_0x834a('0x67')]['RUNNING'];for(var _0x27fd11=0x0;_0x27fd11<_0x405c83[_0x834a('0x149')];_0x27fd11+=0x1){_0x3abd70[_0x834a('0x200')]+=0x1;if(_[_0x834a('0xf0')](_0x405c83[_0x27fd11])||_['isNil'](_0x405c83[_0x27fd11][_0x834a('0x177')])||_[_0x834a('0xf0')](_0x405c83[_0x27fd11][_0x834a('0x160')])){_0x8eb27e[_0x834a('0x156')](_0x834a('0x201'),_0x3abd70,_0x405c83[_0x27fd11]);}else{hopperUtils[_0x834a('0x202')](_[_0x834a('0x100')](_0x405c83[_0x27fd11],[_0x834a('0xe8'),_0x834a('0x160')]))[_0x834a('0x94')](_0x8eb27e[_0x834a('0x1e5')](_0x3abd70,_0x405c83[_0x27fd11]))[_0x834a('0xa0')](_0x8eb27e['loggerHandler'](_0x834a('0x203'),_0x3abd70));}}}}})[_0x834a('0xa0')](loggerGetContactDialer('[getContactCampaign2]',_0x3abd70,_0x4ee5a9));}};Dialer['prototype'][_0x834a('0xac')]=function(_0x3c9236,_0x390ed3){var _0x20bf92=this;var _0x463ed0=[];if(_0x390ed3<0x1||_0x3c9236[_0x834a('0xa9')]===_0x834a('0x9')){_0x390ed3=0x1;}var _0x54e351=Math[_0x834a('0x1e2')](_0x3c9236[_0x834a('0x13b')]*_0x390ed3)-_0x3c9236[_0x834a('0x154')];if(_0x3c9236['dialLimitQueue']>0x0){var _0x795ab4=_0x3c9236[_0x834a('0x204')]-_0x3c9236[_0x834a('0x154')]-_0x3c9236['talking']-_0x3c9236[_0x834a('0x13d')];if(_0x54e351>_0x795ab4){_0x54e351=_0x795ab4;}}if(_0x54e351>0x0&&_0x3c9236[_0x834a('0x64')]==0x0){if(_0x3c9236['dialMethod']===_0x834a('0x9')){_0x54e351=0x1;}if(_0x54e351>this['maxNumberOriginate']){_0x54e351=this[_0x834a('0x25')];}for(var _0x381c85 in this[_0x834a('0x23')]){if(typeof this['agents'][_0x381c85]!=='undefined'){if(this[_0x834a('0x23')][_0x381c85][_0x834a('0x6b')]===_0x834a('0x205')&&this[_0x834a('0x23')][_0x381c85]['status']===_0x834a('0x206')){_0x463ed0['push'](this['agents'][_0x381c85]['id']);}}}_0x3c9236[_0x834a('0x64')]=0x1;hopperUtils[_0x834a('0x207')](_0x3c9236,_0x463ed0,_0x54e351)[_0x834a('0x94')](function(_0x1ae865){_0x3c9236[_0x834a('0x64')]=0x0;if(_0x1ae865){if(!utils['checkContactEmpty'](_0x1ae865)){hopperUtils[_0x834a('0x208')](_0x3c9236)[_0x834a('0x94')](sendMessageReschedule(_0x3c9236))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3c9236['originated']+=_0x1ae865['length'];_0x3c9236[_0x834a('0x66')]=_0x3c9236['dialMethod']==='booked'?utils[_0x834a('0x67')][_0x834a('0x13e')]:utils['CAMPAIGN_STATUS'][_0x834a('0x209')];for(var _0xed6e46=0x0;_0xed6e46<_0x1ae865['length'];_0xed6e46+=0x1){if(_['isNil'](_0x1ae865[_0xed6e46])||_[_0x834a('0xf0')](_0x1ae865[_0xed6e46][_0x834a('0x177')])||_['isNil'](_0x1ae865[_0xed6e46][_0x834a('0x160')])){_0x20bf92['emptyContact'](_0x834a('0x201'),_0x3c9236,_0x1ae865[_0xed6e46]);}else{hopperUtils[_0x834a('0x20a')](_['pick'](_0x1ae865[_0xed6e46],['VoiceQueueId',_0x834a('0x160')]))[_0x834a('0x94')](_0x20bf92[_0x834a('0x1e5')](_0x3c9236,_0x1ae865[_0xed6e46]))[_0x834a('0xa0')](_0x20bf92[_0x834a('0x20b')](_0x834a('0x201'),_0x3c9236));}}}}})[_0x834a('0xa0')](loggerGetContactDialer(_0x834a('0x20c'),_0x3c9236,_0x54e351));}};Dialer[_0x834a('0x1c')][_0x834a('0x60')]=function(_0x358d83){if(_0x358d83[_0x834a('0x204')]>0x0){var _0x4cf8b2=_0x358d83[_0x834a('0x204')]-_0x358d83[_0x834a('0x154')]-_0x358d83[_0x834a('0x13c')];if(_0x4cf8b2>0x0&&_0x358d83[_0x834a('0x64')]==0x0){this['tryOriginatePredictive'](_0x358d83);}else{loggerPredictiveCalls[_0x834a('0x48')](_0x834a('0x20d'));}}else{this[_0x834a('0x20e')](_0x358d83);}};Dialer[_0x834a('0x1c')]['tryOriginatePredictive']=function(_0x30fcfb){var _0x544285=this;var _0x8596d0=[];_0x30fcfb[_0x834a('0x154')]+=0x1;for(var _0xc309ee in this[_0x834a('0x23')]){if(typeof this[_0x834a('0x23')][_0xc309ee]!==_0x834a('0xa2')){if(this[_0x834a('0x23')][_0xc309ee][_0x834a('0x6b')]===_0x834a('0x205')&&this['agents'][_0xc309ee][_0x834a('0x82')]==='reachable'){_0x8596d0[_0x834a('0xf5')](this['agents'][_0xc309ee]['id']);}}}_0x30fcfb[_0x834a('0x64')]=0x1;return this['getContactDialer'](_0x30fcfb['id'],_0x8596d0,0x1,_0x30fcfb[_0x834a('0x20f')],_0x30fcfb)[_0x834a('0x94')](function(_0x5270ce){_0x30fcfb[_0x834a('0x64')]=0x1;if(_0x5270ce){if(!utils[_0x834a('0x210')](_0x5270ce)){utils[_0x834a('0x211')](_0x30fcfb,0x1,0x0);return hopperUtils[_0x834a('0x208')](_0x30fcfb)[_0x834a('0x94')](sendMessageReschedule(_0x30fcfb))[_0x834a('0xa0')](loggerCatch(_0x834a('0x212')));}else{_0x30fcfb[_0x834a('0x66')]=utils[_0x834a('0x67')][_0x834a('0x209')];if(_[_0x834a('0xf0')](_0x5270ce[0x0])||_[_0x834a('0xf0')](_0x5270ce[0x0][_0x834a('0x177')])||_[_0x834a('0xf0')](_0x5270ce[0x0]['phone'])){_0x544285[_0x834a('0x156')](_0x834a('0x201'),_0x30fcfb,_0x5270ce[0x0]);}else{return hopperUtils[_0x834a('0x20a')](_[_0x834a('0x100')](_0x5270ce[0x0],[_0x834a('0xe7'),_0x834a('0x160')]))[_0x834a('0x94')](_0x544285['checkContactBlack'](_0x30fcfb,_0x5270ce[0x0]))[_0x834a('0xa0')](_0x544285[_0x834a('0x20b')](_0x834a('0x213'),_0x30fcfb));}}}})[_0x834a('0xa0')](loggerGetContactDialer(_0x834a('0x214'),_0x30fcfb,0x1));};Dialer[_0x834a('0x1c')]['abandonmentRate']=function(_0x5073f2,_0x591feb,_0x55fc26,_0x749234,_0x27f6cd,_0x342aa1){loggerPredictive[_0x834a('0x48')](_0x834a('0x215'));loggerPredictive[_0x834a('0x48')](_0x834a('0x216'),_0x5073f2);loggerPredictive[_0x834a('0x48')](_0x834a('0x217'),_0x591feb);loggerPredictive[_0x834a('0x48')](_0x834a('0x218'),_0x55fc26);loggerPredictive['info'](_0x834a('0x219'),_0x749234);loggerPredictive['info'](_0x834a('0x21a'),_0x27f6cd);loggerPredictive[_0x834a('0x48')]('---------------------------');return new Promise(function(_0x5c58be,_0x1afd00){if(_0x5073f2<=0x0||isNaN(_0x5073f2)){return _0x1afd00(msgResponse('[abandonmentRate]','Error',_0x834a('0x21b')+_0x5073f2));}if(_0x55fc26<=0x0||isNaN(_0x55fc26)){return _0x1afd00(msgResponse(_0x834a('0x21c'),'Error',_0x834a('0x21d')+_0x55fc26));}if(_0x749234<=0x0||isNaN(_0x749234)){return _0x1afd00(msgResponse('[abandonmentRate]',_0x834a('0xb8'),_0x834a('0x21e')+_0x749234));}if(_0x591feb<=0x0||isNaN(_0x591feb)){return _0x1afd00(msgResponse(_0x834a('0x21c'),_0x834a('0xb8'),'interval\x20=\x20'+_0x591feb));}if(_0x27f6cd<=0x0||isNaN(_0x27f6cd)){return _0x1afd00(msgResponse(_0x834a('0x21c'),_0x834a('0xb8'),_0x834a('0x21f')+_0x27f6cd));}_0x342aa1=_0x342aa1||0x0;var _0x3dc671=0x1/_0x55fc26;var _0x6c8de7=0x0;var _0x2d2972=0x0;var _0x225aae=0x0;var _0x32f369=0x0;for(var _0x98a24d=0x0;_0x225aae<_0x27f6cd;_0x98a24d+=0x1){_0x2d2972=_0x98a24d/_0x591feb;_0x6c8de7=(_0x749234*_0x2d2972+_0x342aa1)/_0x3dc671;_0x225aae=utils[_0x834a('0x220')](_0x6c8de7,_0x5073f2);_0x32f369=_0x6c8de7/_0x5073f2*(0x1-utils[_0x834a('0x220')](_0x6c8de7,_0x5073f2));}return _0x5c58be({'erlangCalls':_0x98a24d,'erlangCallToSecond':_0x591feb/_0x98a24d,'erlangAbandonmentRate':_0x225aae,'erlangBusyFactor':_0x32f369});});};Dialer['prototype'][_0x834a('0x1d9')]=function(_0x40abf6,_0x53e564,_0xa24be1,_0x17470d,_0x54cc6a,_0x308f9e){loggerPredictive[_0x834a('0x48')](_0x834a('0x221'));loggerPredictive['info'](_0x834a('0x216'),_0x40abf6);loggerPredictive[_0x834a('0x48')](_0x834a('0x217'),_0x53e564);loggerPredictive[_0x834a('0x48')](_0x834a('0x218'),_0xa24be1);loggerPredictive[_0x834a('0x48')](_0x834a('0x219'),_0x17470d);loggerPredictive[_0x834a('0x48')](_0x834a('0x222'),_0x54cc6a);loggerPredictive[_0x834a('0x48')](_0x834a('0x52'));return new Promise(function(_0x24279c,_0x1d7e2e){if(_0x40abf6<=0x0||isNaN(_0x40abf6)){return _0x1d7e2e(msgResponse(_0x834a('0x223'),_0x834a('0xb8'),'m\x20=\x20'+_0x40abf6));}if(_0xa24be1<=0x0||isNaN(_0xa24be1)){return _0x1d7e2e(msgResponse(_0x834a('0x223'),'Error',_0x834a('0x21d')+_0xa24be1));}if(_0x17470d<=0x0||isNaN(_0x17470d)){return _0x1d7e2e(msgResponse('[busyFactor]','Error',_0x834a('0x21e')+_0x17470d));}if(_0x53e564<=0x0||isNaN(_0x53e564)){return _0x1d7e2e(msgResponse(_0x834a('0x223'),_0x834a('0xb8'),_0x834a('0x224')+_0x53e564));}if(_0x54cc6a<=0x0||isNaN(_0x54cc6a)){return _0x1d7e2e(msgResponse(_0x834a('0x223'),_0x834a('0xb8'),'Umin\x20=\x20'+_0x54cc6a));}_0x308f9e=_0x308f9e||0x0;var _0x2b25e4=0x1/_0xa24be1;var _0x2693a5=0x0;var _0x3f84b9=0x0;var _0x5c3ef1=0x0;var _0x265d4e=0x0;for(var _0x1f2061=0x0;_0x265d4e<_0x54cc6a;_0x1f2061+=0x1){_0x3f84b9=_0x1f2061/_0x53e564;_0x2693a5=(_0x17470d*_0x3f84b9+_0x308f9e)/_0x2b25e4;_0x5c3ef1=utils[_0x834a('0x220')](_0x2693a5,_0x40abf6);_0x265d4e=_0x2693a5/_0x40abf6*(0x1-utils[_0x834a('0x220')](_0x2693a5,_0x40abf6));}return _0x24279c({'erlangCalls':_0x1f2061,'erlangCallToSecond':_0x53e564/_0x1f2061,'erlangAbandonmentRate':_0x5c3ef1,'erlangBusyFactor':_0x265d4e});});};module[_0x834a('0x225')]=Dialer; \ No newline at end of file +var _0x2bb8=['dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','object','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','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','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','agentBusyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','run','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[getContactCampaign2]','dialLimitQueue','booked','not_inuse','getContactDialer','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[countReScheduled]\x20','emptyContact','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','----\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]','lodash','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','previewRecallmeReminderInterval','isUndefined','emit','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','debug','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','inspect','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','queueStatusComplete','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','true','content','indexOf','catch','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','predictive','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','type','ivr','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','syncQueueCallerAbandon','updateOriginated','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','minutes','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','voiceQueue','countabandonedretry','dialAbandonedMaxRetry','ContactId','[syncAgentComplete][createHistory][11]','syncNewExten','channel','syncQueueMember','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','idHopper','rrmemory','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','stringify','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[syncAgentComplete][createHistory][0]','countnoanswerretry','reason19\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','reachable','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','Agent','handleIvr','actionOriginate','phone','originate','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2bb8,0x92));var _0x82bb=function(_0x8e96dd,_0x29bdd1){_0x8e96dd=_0x8e96dd-0x0;var _0x1bbda0=_0x2bb8[_0x8e96dd];return _0x1bbda0;};'use strict';var util=require('util');var _=require(_0x82bb('0x0'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x82bb('0x1'));var ut=require(_0x82bb('0x2'));var config=require(_0x82bb('0x3'));var logger=require(_0x82bb('0x4'))(_0x82bb('0x5'));var loggerBooked=require(_0x82bb('0x4'))('booked');var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x82bb('0x4'))(_0x82bb('0x6'));var loggerSyncQueueSummary=require(_0x82bb('0x4'))(_0x82bb('0x7'));var ami=require(_0x82bb('0x8'));config[_0x82bb('0x9')]=_[_0x82bb('0xa')](config[_0x82bb('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x82bb('0xb'))(new Redis(config[_0x82bb('0x9')]));var cmHopper=require(_0x82bb('0xc'));var voiceQueueRt=require(_0x82bb('0xd'));var RpcSetting=require(_0x82bb('0xe'));var Interval=require(_0x82bb('0xf'));var Action=require(_0x82bb('0x10'));var History=require(_0x82bb('0x11'));var Final=require(_0x82bb('0x12'));var AgentComplete=require(_0x82bb('0x13'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x82bb('0x14'));var ipAgi=process[_0x82bb('0x15')][_0x82bb('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x82bb('0x17')]=function(_0x4d479e){this['tail']=this[_0x82bb('0x18')]?this['tail'][_0x82bb('0x19')](_0x4d479e):_0x4d479e();};function Dialer(_0x105a39,_0x94fd88){this[_0x82bb('0x1a')]=new Sequence();this[_0x82bb('0x1b')]=_0x94fd88;this['voiceQueues']=_0x105a39[_0x82bb('0x1c')];this[_0x82bb('0x1d')]=_0x105a39[_0x82bb('0x1d')];this[_0x82bb('0x1e')]=_0x105a39[_0x82bb('0x1e')];this['trunks']=_0x105a39[_0x82bb('0x1f')];this[_0x82bb('0x20')]=config[_0x82bb('0x20')]||0x2;this[_0x82bb('0x21')]={};this[_0x82bb('0x22')]={};this[_0x82bb('0x23')]={};this[_0x82bb('0x24')]={};this[_0x82bb('0x25')]={};this['startPredictive']={};this[_0x82bb('0x26')]={};this['ivrOriginated']={};this[_0x82bb('0x27')]={};this['queueBookedRR']={};this[_0x82bb('0x28')]={};ami['on'](_0x82bb('0x29'),this[_0x82bb('0x2a')][_0x82bb('0x2b')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x82bb('0x2b')](this));ami['on']('originateresponse',this[_0x82bb('0x2c')][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x2d'),this['syncAgentComplete'][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x2e'),this[_0x82bb('0x7')][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x2f'),this[_0x82bb('0x30')][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x31'),this[_0x82bb('0x32')]['bind'](this));ami['on'](_0x82bb('0x33'),this['syncNewExten'][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x34'),this[_0x82bb('0x35')]['bind'](this));ami['on'](_0x82bb('0x36'),this['syncQueueMember'][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x37'),this[_0x82bb('0x38')][_0x82bb('0x2b')](this));this[_0x82bb('0x39')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x82bb('0x3a')](function(_0x725bf){previewRecallmeReminderInterval=_0x725bf[_0x82bb('0x3b')];});}function isNotNull(_0x2c5bc5){return _0x2c5bc5!==null&&!_[_0x82bb('0x3c')](_0x2c5bc5);}function msgResponse(_0x3bef85,_0x35ffa9,_0x3271fc){return{'action':_0x3bef85,'response':_0x35ffa9,'message':_0x3271fc,'stack':_0x3271fc};}function emit(_0x461079,_0x7c1190,_0x3973c8){io['to'](_0x461079)[_0x82bb('0x3d')](_0x7c1190,_0x3973c8);}function emitOutboundVoiceQueueSummary(_0x414ef6){if(_0x414ef6['type']==='outbound'){logger['debug'](_0x82bb('0x3e'),util['inspect'](_0x414ef6,{'showHidden':![],'depth':null}));emit(util[_0x82bb('0x3f')](_0x82bb('0x40'),_0x414ef6[_0x82bb('0x41')]),_0x82bb('0x42'),_0x414ef6);}}function checkGetDataPredictive(_0x19e7f1){if(isNotNull(_0x19e7f1)&&!_[_0x82bb('0x43')](_0x19e7f1)){loggerPredictive[_0x82bb('0x44')](_0x82bb('0x45'));loggerPredictive['info'](_0x82bb('0x46'),_0x19e7f1[_0x82bb('0x47')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19e7f1[_0x82bb('0x48')]);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x49'),_0x19e7f1['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x82bb('0x44')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19e7f1[_0x82bb('0x4a')]);loggerPredictive['info'](_0x82bb('0x4b'),_0x19e7f1['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19e7f1[_0x82bb('0x4c')]);loggerPredictive[_0x82bb('0x44')]('---------------------------');if(_0x19e7f1['predictiveIntervalTotalCalls']>0x0){if(!_[_0x82bb('0x3c')](_0x19e7f1['predictiveIntervalAvgTalktime'])&&_0x19e7f1[_0x82bb('0x4c')]>0x0){return!![];}loggerPredictive[_0x82bb('0x44')](_0x82bb('0x4d'));if(!_['isUndefined'](_0x19e7f1[_0x82bb('0x4e')])&&_0x19e7f1[_0x82bb('0x4e')]>0x0){return!![];}loggerPredictive[_0x82bb('0x44')](_0x82bb('0x4f'));}else{loggerPredictive[_0x82bb('0x44')](_0x82bb('0x50'));}}else{loggerPredictive[_0x82bb('0x44')](_0x82bb('0x51'));}return![];}function mergeDataErlangB(_0x50cf67){return function(_0x872ced){loggerPredictive['info'](_0x82bb('0x52'));loggerPredictive[_0x82bb('0x44')](_0x82bb('0x53'),_0x872ced[_0x82bb('0x54')]);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x55'),_0x872ced[_0x82bb('0x56')]);loggerPredictive[_0x82bb('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x872ced[_0x82bb('0x57')]);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x58'),_0x872ced['erlangBusyFactor']);loggerPredictive[_0x82bb('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x872ced[_0x82bb('0x57')]);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x59'));_[_0x82bb('0x5a')](_0x50cf67,_0x872ced);};}function ifInterval(_0xb24dea,_0x3869c2){if(_['isUndefined'](_0x3869c2)){return![];}return utils[_0x82bb('0x5b')](undefined,_0x3869c2)<_0xb24dea*0x3c;}function clearPredictiveAttributes(_0x258cad){if(_0x258cad['startProgressive']){_0x258cad['startProgressive']=undefined;loggerPredictive[_0x82bb('0x5c')](_0x258cad['name'],'startProgressive\x20value\x20cleared');}if(_0x258cad[_0x82bb('0x5d')]){_0x258cad[_0x82bb('0x5d')]=undefined;loggerPredictive['debug'](_0x258cad[_0x82bb('0x41')],_0x82bb('0x5e'));}if(_0x258cad[_0x82bb('0x5f')]){clearInterval(_0x258cad[_0x82bb('0x5f')]);_0x258cad[_0x82bb('0x5f')]=undefined;loggerPredictive[_0x82bb('0x5c')](_0x258cad[_0x82bb('0x41')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1dd115,_0x11579b){return function(_0x3f9470){loggerPredictive[_0x82bb('0x60')](_0x11579b[_0x82bb('0x41')],_0x1dd115);loggerPredictive['error'](_0x3f9470[_0x82bb('0x61')]);clearPredictiveAttributes(_0x11579b);};}function loggerCatch(_0x187743){return function(_0xb3a110){logger[_0x82bb('0x60')](_0x187743,util['inspect'](_0xb3a110,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x345f9c,_0x18fd48,_0x2fe5d9){return function(_0xe1e969){utils[_0x82bb('0x62')](_0x18fd48,_0x2fe5d9,0x0);_0x18fd48['temp']=0x0;logger[_0x82bb('0x60')](_0x345f9c,util[_0x82bb('0x63')](_0xe1e969,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5b66c6){return function(_0x2b4966){if(isNotNull(_0x2b4966)&&isNotNull(_0x2b4966[0x0])){if(_0x2b4966[0x0][_0x82bb('0x64')]>0x0){_0x5b66c6['message']=utils[_0x82bb('0x65')][_0x82bb('0x66')];logger['info'](_0x82bb('0x67')+_0x5b66c6[_0x82bb('0x41')],_0x2b4966[0x0][_0x82bb('0x64')],_0x82bb('0x68'));}else{_0x5b66c6[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x6a')];logger[_0x82bb('0x44')](_0x82bb('0x6b')+_0x5b66c6[_0x82bb('0x41')]);}}};}function createObjHistory(_0x2c75d6,_0x26ff05,_0x1efdb8,_0x31b132,_0x89e97e){_0x2c75d6[_0x82bb('0x69')]=_0x1efdb8;var _0x231021=new Action(_0x2c75d6,_0x26ff05);var _0x29feba=new History(_0x231021);_0x29feba[_0x82bb('0x6c')]=_0x31b132;_0x29feba[_0x82bb('0x6d')]=_0x89e97e;_0x29feba[_0x82bb('0x6e')]=_0x231021[_0x82bb('0x6f')];return _0x29feba;}function unlockQueueStatus(_0xf85b9,_0x3b57f1){setTimeout(function(){if(_[_0x82bb('0x3c')](_0xf85b9['queueStatusComplete'])){loggerBooked[_0x82bb('0x60')](_0x82bb('0x70'),_0x3b57f1);}_0xf85b9['queueStatusComplete']=!![];loggerBooked[_0x82bb('0x44')](_0x82bb('0x71'),_0x3b57f1,JSON['stringify'](_[_0x82bb('0x72')](_0xf85b9,[_0x82bb('0x41'),_0x82bb('0x73')])));},0x1f3);}function checkInterval(_0x24e974){return function(){if(!isNotNull(_0x24e974[_0x82bb('0x74')])){_0x24e974[_0x82bb('0x69')]=utils['CAMPAIGN_STATUS'][_0x82bb('0x75')];throw _0x24e974[_0x82bb('0x41')]+_0x82bb('0x76');}if(!isNotNull(_0x24e974[_0x82bb('0x74')][_0x82bb('0x77')])){_0x24e974['message']=utils['CAMPAIGN_STATUS'][_0x82bb('0x75')];throw _0x24e974[_0x82bb('0x41')]+_0x82bb('0x76');}if(!isNotNull(_[_0x82bb('0x43')](_0x24e974['Interval']['Intervals']))){_0x24e974[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x75')];throw _0x24e974[_0x82bb('0x41')]+_0x82bb('0x76');}};}function checkIsIVRCampaignActive(_0x5921fd){return function(){if(!utils['isIVRCampaignActive'](_0x5921fd)){_0x5921fd['message']=utils[_0x82bb('0x65')][_0x82bb('0x78')];throw _0x5921fd[_0x82bb('0x41')]+_0x82bb('0x79');}};}function emitCampaignSummary(_0x402625){if(utils[_0x82bb('0x7a')](_0x402625)){emit(util[_0x82bb('0x3f')](_0x82bb('0x7b'),_0x402625[_0x82bb('0x41')]),_0x82bb('0x7c'),_0x402625);}}function loggerCatchQueueSummary(_0x5b8bb2,_0x43e875){return function(_0x5ebbc6){clearPredictiveAttributes(_0x43e875);emitCampaignSummary(_0x43e875);loggerSyncQueueSummary[_0x82bb('0x5c')](_0x5b8bb2,util[_0x82bb('0x63')](_0x5ebbc6,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4008bd){if(_0x4008bd[_0x82bb('0x7d')]){if(_0x4008bd[_0x82bb('0x7e')]===0x0){_0x4008bd[_0x82bb('0x7d')]=![];_0x4008bd[_0x82bb('0x69')]=utils['CAMPAIGN_STATUS'][_0x82bb('0x78')];loggerSyncQueueSummary['debug'](_0x82bb('0x7f'),_0x4008bd[_0x82bb('0x41')],_0x82bb('0x80'));}else{_0x4008bd['message']=utils[_0x82bb('0x65')][_0x82bb('0x81')];loggerSyncQueueSummary[_0x82bb('0x5c')](_0x82bb('0x7f'),_0x4008bd[_0x82bb('0x41')],_0x82bb('0x82'));}emitCampaignSummary(_0x4008bd);}}function myreject(_0x5da212){return function(_0xcb0207){return _0x5da212(msgResponse(_0x82bb('0x83'),_0x82bb('0x84'),JSON['stringify'](_0xcb0207)));};}Dialer[_0x82bb('0x85')]['isTrunkReachable']=function(_0x18c57c){return!_[_0x82bb('0x3c')](_0x18c57c)&&_0x18c57c&&!_[_0x82bb('0x3c')](_0x18c57c['name'])&&!_[_0x82bb('0x3c')](_0x18c57c[_0x82bb('0x86')])&&_0x18c57c[_0x82bb('0x86')]&&(this[_0x82bb('0x1f')][util[_0x82bb('0x3f')](_0x82bb('0x87'),_0x18c57c['name'])][_0x82bb('0x88')]==='reachable'||this[_0x82bb('0x1f')][util[_0x82bb('0x3f')](_0x82bb('0x87'),_0x18c57c['name'])][_0x82bb('0x88')]===_0x82bb('0x89'));};Dialer[_0x82bb('0x85')][_0x82bb('0x8a')]=function(_0x20af53){var _0x456854=this;return function(){if(!_0x456854['isTrunkReachable'](_0x20af53[_0x82bb('0x8b')])){if(!_0x456854[_0x82bb('0x8c')](_0x20af53[_0x82bb('0x8d')])){_0x20af53[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x8e')];throw _0x20af53[_0x82bb('0x41')]+_0x82bb('0x8f');}}};};Dialer['prototype'][_0x82bb('0x90')]=function(_0x2266ad,_0x505816,_0x793a96,_0x35689f){var _0x102a4b=this;return function(){var _0x416323=!![];return _0x102a4b[_0x82bb('0x91')](_0x2266ad,_0x505816,_0x793a96,_0x35689f,_0x416323);};};Dialer[_0x82bb('0x85')][_0x82bb('0x92')]=function(_0x14833c,_0x504428,_0x45f96c,_0x17d3c0){var _0x5b1dee=this;return function(){var _0x487fc9=![];return _0x5b1dee[_0x82bb('0x91')](_0x14833c[_0x82bb('0x77')],_0x504428,_0x45f96c,_0x17d3c0,_0x487fc9);};};Dialer[_0x82bb('0x85')][_0x82bb('0x91')]=function(_0x1f48fc,_0x53229c,_0x1743a4,_0xe684e6,_0x465caf){var _0x8464ac=[];return new Promise(function(_0x4b3973,_0x1c6e4a){if(!isNotNull(_0x1f48fc)){_0xe684e6['message']=utils[_0x82bb('0x65')]['NULL_INTERVAL'];return _0x1c6e4a(msgResponse('ifTime','Failure',_0x1743a4+_0x82bb('0x93')));}if(_[_0x82bb('0x43')](_0x1f48fc)){_0xe684e6[_0x82bb('0x69')]=utils['CAMPAIGN_STATUS'][_0x82bb('0x94')];return _0x1c6e4a(msgResponse(_0x82bb('0x95'),_0x82bb('0x96'),_0x1743a4+_0x82bb('0x97')));}if(_0x53229c&&_[_0x82bb('0x3c')](config[_0x82bb('0x98')][_0x53229c])){_0xe684e6[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x99')];return _0x1c6e4a(msgResponse(_0x82bb('0x95'),_0x82bb('0x96'),_0x1743a4+_0x82bb('0x9a')+_0x53229c));}if(_[_0x82bb('0x9b')](_0x1f48fc)){for(var _0x13807b=0x0;_0x13807b<_0x1f48fc[_0x82bb('0x9c')];_0x13807b+=0x1){_0x8464ac[_0x82bb('0x9d')](ami[_0x82bb('0x9e')]({'action':_0x82bb('0x9f'),'command':util[_0x82bb('0x3f')](_0x82bb('0xa0'),_0x1f48fc[_0x13807b]['interval'],!_[_0x82bb('0x3c')](config[_0x82bb('0x98')][_0x53229c])?_0x53229c:'')})[_0x82bb('0x3a')](function(_0x1b326e){return _0x1b326e['content']['indexOf'](_0x82bb('0xa1'))>=0x0;})['catch'](myreject(_0x1c6e4a)));}}else{_0x8464ac[_0x82bb('0x9d')](ami[_0x82bb('0x9e')]({'action':_0x82bb('0x9f'),'command':util[_0x82bb('0x3f')](_0x82bb('0xa0'),_0x1f48fc,!_[_0x82bb('0x3c')](config[_0x82bb('0x98')][_0x53229c])?_0x53229c:'')})[_0x82bb('0x3a')](function(_0x26bc53){return _0x26bc53[_0x82bb('0xa2')][_0x82bb('0xa3')](_0x82bb('0xa1'))>=0x0;})[_0x82bb('0xa4')](myreject(_0x1c6e4a)));}Promise[_0x82bb('0xa5')](_0x8464ac)['then'](function(_0x597cd6){var _0x59dd47=_['some'](_0x597cd6);if(_0x59dd47){return _0x4b3973(_0x59dd47);}else{_0xe684e6['message']=_0x465caf?utils[_0x82bb('0x65')][_0x82bb('0xa6')]:utils[_0x82bb('0x65')]['OVERTIME_INTERVAL'];return _0x1c6e4a(msgResponse(_0x82bb('0xa7'),_0x82bb('0x96'),_0x82bb('0xa8')+_0x465caf+'\x20'+_0x1743a4+'\x20Interval\x20is\x20overtime:\x20'+util[_0x82bb('0x63')](_0x1f48fc,{'showHidden':![],'depth':null})+_0x82bb('0xa9')+_0x53229c));}})[_0x82bb('0xa4')](function(_0x1764cb){return _0x1c6e4a(msgResponse(_0x82bb('0x95'),_0x82bb('0x96'),JSON['stringify'](_0x1764cb)));});});};Dialer[_0x82bb('0x85')][_0x82bb('0x39')]=function(){var _0x59be41=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x82bb('0x3a')](function(){setInterval(function(){_0x59be41[_0x82bb('0xaa')]();},0x3e8);});};Dialer['prototype'][_0x82bb('0xaa')]=function(){var _0x39bee2=this;var _0x3a404d;for(var _0x5c1fec in this['campaigns']){if(typeof this['campaigns'][_0x5c1fec]!==_0x82bb('0xab')){_0x3a404d=this[_0x82bb('0x1d')][_0x5c1fec];if(utils[_0x82bb('0x7a')](_0x3a404d)&&utils['isIVRCampaignActive'](_0x3a404d)){_0x3a404d[_0x82bb('0x7d')]=!![];Promise[_0x82bb('0xac')]()[_0x82bb('0x3a')](checkIsIVRCampaignActive(_0x3a404d))[_0x82bb('0x3a')](checkInterval(_0x3a404d))[_0x82bb('0x3a')](_0x39bee2['checkIsTrunkReachable'](_0x3a404d))[_0x82bb('0x3a')](_0x39bee2['checkIfTime'](_0x3a404d[_0x82bb('0xad')],_0x3a404d[_0x82bb('0xae')],_0x3a404d[_0x82bb('0x41')],_0x3a404d))['then'](_0x39bee2[_0x82bb('0x92')](_0x3a404d[_0x82bb('0x74')],_0x3a404d['dialTimezone'],_0x3a404d[_0x82bb('0x41')],_0x3a404d))[_0x82bb('0x3a')](_0x39bee2[_0x82bb('0xaf')](_0x3a404d))[_0x82bb('0xa4')](loggerCatchQueueSummary('[syncCampaigns]',_0x3a404d));}else{notSendMessagesCampaign(_0x3a404d);}}}};Dialer[_0x82bb('0x85')][_0x82bb('0xb0')]=function(_0x50a86c){if(_0x50a86c['dialMethod']!==_0x82bb('0xb1')){clearPredictiveAttributes(_0x50a86c);}switch(_0x50a86c[_0x82bb('0xb2')]){case _0x82bb('0xb3'):this[_0x82bb('0xb4')](_0x50a86c,0x1);break;case _0x82bb('0xb5'):this[_0x82bb('0xb4')](_0x50a86c,_0x50a86c[_0x82bb('0xb6')]);break;case _0x82bb('0xb1'):this[_0x82bb('0xb1')](_0x50a86c);break;case'booked':this[_0x82bb('0xb4')](_0x50a86c,0x1);break;default:logger['error'](_0x82bb('0xb7'),_0x50a86c['name'],'method\x20not\x20recognized');}};Dialer[_0x82bb('0x85')]['ifTime']=function(_0x4b8043,_0x331654){var _0x23af6d=_0x4b8043[_0x82bb('0xae')];var _0x6ac72b=_0x331654?_0x4b8043[_0x82bb('0xad')]:_0x4b8043['Interval'][_0x82bb('0x77')];logger[_0x82bb('0xb8')](_0x82bb('0xb9'),_0x6ac72b,_0x23af6d,_0x4b8043[_0x82bb('0x41')],util[_0x82bb('0x3f')](_0x82bb('0xba'),_0x4b8043['name'],_0x4b8043['id']));var _0x3254e1=null;return Interval[_0x82bb('0xbb')](_0x6ac72b,_0x23af6d)[_0x82bb('0x3a')](function(_0x425568){if(_0x425568===!![]){return _0x425568;}else{_0x4b8043['message']=_0x331654?utils[_0x82bb('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x82bb('0x65')][_0x82bb('0xbc')];_0x3254e1=msgResponse('[ifTime][promiseAll]',_0x82bb('0x96'),_0x82bb('0xa8')+_0x331654+'\x20'+_0x4b8043['name']+_0x82bb('0xbd')+util[_0x82bb('0x63')](_0x6ac72b,{'showHidden':![],'depth':null})+_0x82bb('0xa9')+_0x23af6d);}if(_0x3254e1!==null){logger[_0x82bb('0xb8')](_0x82bb('0xbe'),_0x3254e1);_0x3254e1['isGlobal']=_0x331654;throw _0x3254e1;}})[_0x82bb('0xa4')](function(_0x33e72c){logger['error'](_0x82bb('0xbf'),_0x33e72c);throw msgResponse('[ifTime][Action]',_0x82bb('0x84'),util[_0x82bb('0x63')](_0x33e72c,{'showHidden':![],'depth':null}));});};Dialer[_0x82bb('0x85')]['syncAgentConnect']=function(_0x45ae33){if(this[_0x82bb('0x1c')][_0x45ae33[_0x82bb('0xc0')]]){if(this[_0x82bb('0x24')][_0x45ae33[_0x82bb('0xc1')]]&&this[_0x82bb('0x24')][_0x45ae33[_0x82bb('0xc1')]][_0x82bb('0xc2')]!==_0x82bb('0xc3')){this['updateOriginated'](this[_0x82bb('0x1c')][_0x45ae33[_0x82bb('0xc0')]]);this[_0x82bb('0x24')][_0x45ae33[_0x82bb('0xc1')]]['answertime']=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));}}};Dialer[_0x82bb('0x85')][_0x82bb('0xc5')]=function(_0x224b43){var _0x18c89d=this[_0x82bb('0x24')][_0x224b43[_0x82bb('0xc1')]];if(this['voiceQueues'][_0x224b43[_0x82bb('0xc0')]]){if(_0x18c89d&&_0x18c89d['type']!==_0x82bb('0xc3')){delete this[_0x82bb('0x24')][_0x224b43['uniqueid']];this['voiceQueues'][_0x224b43[_0x82bb('0xc0')]]['outboundAnswerCallsDay']+=0x1;var _0x55b2b6=new AgentComplete(_0x18c89d,_0x224b43);if(_0x224b43[_0x82bb('0xc6')]===_0x82bb('0xc7')){_0x55b2b6[_0x82bb('0xc8')]=this[_0x82bb('0x1c')][_0x224b43['queue']][_0x82bb('0xc9')]&&this[_0x82bb('0x1c')][_0x224b43[_0x82bb('0xc0')]][_0x82bb('0xca')]?moment()[_0x82bb('0x3f')](_0x82bb('0xc4')):undefined;}hopperUtils['createHistory'](_0x55b2b6)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x55b2b6)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0xcb')));}}};Dialer[_0x82bb('0x85')][_0x82bb('0xcc')]=function(_0x4c8e5d){var _0x477653=this[_0x82bb('0x24')][_0x4c8e5d[_0x82bb('0xc1')]];var _0x59ebfc=this;var _0x291462=![];var _0x2ecd3b;var _0x56fa62;if(this[_0x82bb('0x1c')][_0x4c8e5d['queue']]){if(_0x477653&&_0x477653[_0x82bb('0xc2')]!==_0x82bb('0xc3')){delete this[_0x82bb('0x24')][_0x4c8e5d['uniqueid']];this[_0x82bb('0xcd')](this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]]);_0x477653['droptime']=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));var _0xc6b588=new QueueCallerAbandon(_0x477653,_0x4c8e5d);if(utils[_0x82bb('0x5b')](_0x477653[_0x82bb('0xce')],_0x477653[_0x82bb('0xcf')])>=_0x477653[_0x82bb('0xd0')]){this[_0x82bb('0x1c')][_0x4c8e5d['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xd1')]+=0x1;this[_0x82bb('0x1c')][_0x4c8e5d['queue']][_0x82bb('0xd2')]+=0x1;_0xc6b588[_0x82bb('0x6c')]=0xa;_0xc6b588[_0x82bb('0x6d')]=_0x82bb('0xd3');_0xc6b588[_0x82bb('0xd4')]=_0x82bb('0xd5');_0xc6b588[_0x82bb('0xc8')]=this['voiceQueues'][_0x4c8e5d['queue']]['dialQueueProject2']?moment()[_0x82bb('0x3f')](_0x82bb('0xc4')):undefined;_0xc6b588[_0x82bb('0xd6')]+=0x1;_0xc6b588[_0x82bb('0xd7')]+=0x1;_0x2ecd3b=this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xd8')];_0x56fa62=this['voiceQueues'][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xd9')];hopperUtils[_0x82bb('0xda')](_0xc6b588,_0xc6b588[_0x82bb('0x6c')],_0x477653['voiceQueue'])['then'](function(_0x543377){_0x291462=_0x543377[_0x82bb('0xdb')]==0x1;if(_0xc6b588[_0x82bb('0xd6')]>=_0x59ebfc[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]]['dialDropMaxRetry']){_0x59ebfc[_0x82bb('0xdc')](_0xc6b588,_0x543377['additional']);}else{hopperUtils[_0x82bb('0xdd')]({'active':![],'countdropretry':_0xc6b588[_0x82bb('0xd6')],'scheduledat':moment()['add'](_0x59ebfc[_0x82bb('0x1c')][_0x4c8e5d['queue']][_0x82bb('0xd8')],_0x82bb('0xde'))[_0x82bb('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x477653['ContactId'],'ListId':_0x477653[_0x82bb('0xdf')],'VoiceQueueId':_0x477653[_0x82bb('0xe0')]||undefined,'CampaignId':_0x477653[_0x82bb('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3f9c9e=new History(_0xc6b588);_0x3f9c9e[_0x82bb('0x6c')]=0xa;_0x3f9c9e[_0x82bb('0x6d')]=_0x82bb('0xd3');_0x3f9c9e[_0x82bb('0x6f')]=moment()['format'](_0x82bb('0xc4'));_0x3f9c9e[_0x82bb('0x6e')]=_0x3f9c9e[_0x82bb('0x6f')];_0x3f9c9e[_0x82bb('0xe2')]=_0xc6b588[_0x82bb('0xe2')];_0x3f9c9e[_0x82bb('0xe3')]=_0xc6b588['calleridnum'];hopperUtils[_0x82bb('0xe4')](_0x3f9c9e)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0xe5')));}})[_0x82bb('0x3a')](function(){if(_0x291462)hopperUtils[_0x82bb('0xe6')](_0xc6b588,_0x2ecd3b,_0x56fa62)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0x4a')]+=0x1;this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]]['outboundDropCallsDayCallersExit']+=0x1;_0xc6b588['state']=0xb;_0xc6b588[_0x82bb('0x6d')]=_0x82bb('0xe7');_0xc6b588['dropreason']=_0x82bb('0xe8');_0xc6b588['countabandonedretry']+=0x1;_0xc6b588[_0x82bb('0xd7')]+=0x1;_0x2ecd3b=this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xe9')];_0x56fa62=this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xd9')];hopperUtils[_0x82bb('0xda')](_0xc6b588,_0xc6b588['state'],_0x477653[_0x82bb('0xea')])[_0x82bb('0x3a')](function(_0x2515d8){if(_0xc6b588[_0x82bb('0xeb')]>=_0x59ebfc[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xec')]){_0x59ebfc[_0x82bb('0xdc')](_0xc6b588,_0x2515d8['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xc6b588[_0x82bb('0xeb')],'scheduledat':moment()['add'](_0x59ebfc[_0x82bb('0x1c')][_0x4c8e5d['queue']][_0x82bb('0xe9')],'minutes')['format'](_0x82bb('0xc4')),'ContactId':_0x477653[_0x82bb('0xed')],'ListId':_0x477653['ListId'],'VoiceQueueId':_0x477653[_0x82bb('0xe0')]||undefined,'CampaignId':_0x477653['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3e2cca=new History(_0xc6b588);_0x3e2cca[_0x82bb('0x6c')]=0xb;_0x3e2cca['statedesc']=_0x82bb('0xe7');_0x3e2cca[_0x82bb('0x6f')]=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));_0x3e2cca[_0x82bb('0x6e')]=_0x3e2cca['starttime'];_0x3e2cca[_0x82bb('0xe2')]=_0xc6b588[_0x82bb('0xe2')];_0x3e2cca['calleridnum']=_0xc6b588[_0x82bb('0xe3')];hopperUtils[_0x82bb('0xe4')](_0x3e2cca)['catch'](loggerCatch(_0x82bb('0xee')));}})[_0x82bb('0x3a')](function(){if(_0x291462)hopperUtils['swapAdditionalPhones'](_0xc6b588,_0x2ecd3b,_0x56fa62)['then'](function(){return 0x1;});});}}}};Dialer[_0x82bb('0x85')][_0x82bb('0xef')]=function(_0xf17e77){if(this[_0x82bb('0x22')][_0xf17e77[_0x82bb('0xc1')]]){this[_0x82bb('0x22')][_0xf17e77[_0x82bb('0xc1')]][_0x82bb('0xf0')]=_0xf17e77[_0x82bb('0xf0')];}if(this[_0x82bb('0x24')][_0xf17e77[_0x82bb('0xc1')]]){this[_0x82bb('0x24')][_0xf17e77['uniqueid']][_0x82bb('0xf0')]=_0xf17e77['channel'];}};Dialer[_0x82bb('0x85')][_0x82bb('0xf1')]=function(_0x2c79aa){if(!this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]]){return;}var _0x5169c0=this[_0x82bb('0x1c')][this[_0x82bb('0x22')][_0x2c79aa['actionid']][_0x82bb('0xc0')]][_0x82bb('0xf3')]||'rrmemory';if(_0x5169c0===_0x82bb('0xf4')){if(this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]]&&_[_0x82bb('0xf5')](this[_0x82bb('0x22')][_0x2c79aa['actionid']][_0x82bb('0xf6')])&&_0x2c79aa[_0x82bb('0x88')]==='1'&&_0x2c79aa[_0x82bb('0xf7')]==='0'){if(this['agents'][_0x2c79aa['stateinterface']]){if(!this[_0x82bb('0x1e')][_0x2c79aa[_0x82bb('0xf8')]][_0x82bb('0xf6')]){this['agents'][_0x2c79aa['stateinterface']]['locked']=!![];this['actions'][_0x2c79aa[_0x82bb('0xf2')]]['locked']=!![];this[_0x82bb('0x22')][_0x2c79aa['actionid']][_0x82bb('0xf8')]=_0x2c79aa[_0x82bb('0xf8')];}}}}else if(_0x5169c0==='rrmemory'){if(this['actions'][_0x2c79aa['actionid']]){if(this['agents'][_0x2c79aa[_0x82bb('0xf8')]]){this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]]['stateinterface']=_0x2c79aa[_0x82bb('0xf8')];if(_['isNil'](this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x2c79aa['actionid']][_0x82bb('0xc0')]])){this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]][_0x82bb('0xc0')]]=[];}this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]][_0x82bb('0xc0')]][_0x82bb('0x9d')](_[_0x82bb('0x5a')](_[_0x82bb('0x72')](this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]],[_0x82bb('0xf9'),'stateinterface']),{'status':_0x2c79aa[_0x82bb('0x88')],'paused':_0x2c79aa[_0x82bb('0xf7')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x47fb19){if(!this[_0x82bb('0x22')][_0x47fb19['actionid']]){return;}var _0x12ffac=this;var _0x181438=this['voiceQueues'][this['actions'][_0x47fb19['actionid']][_0x82bb('0xc0')]];var _0x3a3e88=_0x181438['strategy']||_0x82bb('0xfa');if(_0x3a3e88===_0x82bb('0xf4')){if(this['actions'][_0x47fb19[_0x82bb('0xf2')]]&&this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xf8')]){this['preview']['run'](this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]]['idHopper'],this[_0x82bb('0x22')][_0x47fb19['actionid']][_0x82bb('0xf8')])[_0x82bb('0xa4')](function(_0x3af837){logger[_0x82bb('0x60')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x82bb('0x63')](_0x3af837,{'showHidden':![],'depth':null}));})[_0x82bb('0x19')](function(){_0x12ffac[_0x82bb('0xcd')](_0x12ffac['voiceQueues'][_0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]);_0x12ffac[_0x82bb('0x1e')][_0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xf8')]]['locked']=![];delete _0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]];unlockQueueStatus(_0x181438);});}else{this['updateOriginated'](this[_0x82bb('0x1c')][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xed')],'ListId':this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]]['ListId'],'VoiceQueueId':this[_0x82bb('0x22')][_0x47fb19['actionid']][_0x82bb('0xe0')]||undefined,'CampaignId':this[_0x82bb('0x22')][_0x47fb19['actionid']]['CampaignId']||undefined})['catch'](loggerCatch(_0x82bb('0xfb')));delete this[_0x82bb('0x22')][_0x47fb19['actionid']];unlockQueueStatus(_0x181438);}}else if(_0x3a3e88===_0x82bb('0xfa')){var _0x52b754;if(this['actions'][_0x47fb19[_0x82bb('0xf2')]]&&!_[_0x82bb('0x43')](this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]]['queue']])){if(this[_0x82bb('0xfc')][_0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]){this[_0x82bb('0xfc')][_0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]=this['queueBookedRR'][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]?this['queueBookedRR'][this['actions'][_0x47fb19['actionid']]['queue']]:this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]?this[_0x82bb('0x27')][this['actions'][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]][_0x82bb('0xfd')]||0x0:0x0;}this[_0x82bb('0x27')][this['actions'][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]][_0x82bb('0xfd')]=this[_0x82bb('0xfc')][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]]['queue']];for(var _0x5a12b4=0x0;_0x5a12b4=_0x297c69[_0x82bb('0x125')]){_0x135cc1[_0x82bb('0x126')](_0x4ba875,_0x7e270b,_0x27d683,'reason19\x20machine....');}else{if(_0x4ba875[_0x82bb('0x123')]>=_0x297c69[_0x82bb('0x127')]){_0x135cc1[_0x82bb('0x128')](_0x4ba875,_0x7e270b,_0x27d683,_0x82bb('0x129'));}else{hopperUtils[_0x82bb('0xdd')]({'active':![],'countmachineretry':_0x4ba875[_0x82bb('0x123')],'scheduledat':moment()[_0x82bb('0x12a')](_0x297c69['dialMachineRetryFrequency'],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x4ba875[_0x82bb('0xed')],'ListId':_0x4ba875[_0x82bb('0xdf')],'VoiceQueueId':_0x4ba875[_0x82bb('0xe0')]||undefined,'CampaignId':_0x4ba875[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12b')));_0x7e270b({'reschedule':0x1});}}});}if(_0x3ab93e[_0x82bb('0xc2')]===_0x82bb('0xc3')&&this[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]][_0x82bb('0x11d')]&&_0x58883e[_0x82bb('0x111')]===_0x82bb('0x112')){delete this['uniqueId'][_0x58883e['uniqueid']];this[_0x82bb('0xcd')](this[_0x82bb('0x1d')][_0x3ab93e['queue']]);_0x345d43=new Hangup(_0x3ab93e,_0x58883e);_0x345d43[_0x82bb('0x6c')]=0x12;_0x345d43[_0x82bb('0x6d')]=_0x82bb('0x115');_0x345d43[_0x82bb('0x116')]=_0x82bb('0x117');ami[_0x82bb('0x3d')]('custom:amd',ut['buildObj'](_0x345d43,_0x82bb('0x11f')));this[_0x82bb('0x11a')](_0x345d43,_0x82bb('0x12c'),_0x82bb('0x12d'));}if(_0x3ab93e['type']===_0x82bb('0xc3')&&this[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]][_0x82bb('0x11d')]&&_0x58883e[_0x82bb('0x111')]===_0x82bb('0x12e')){return new Promise(function(_0x4aa24a,_0x2d4150){delete _0x135cc1[_0x82bb('0x24')][_0x58883e['uniqueid']];_0x135cc1['updateOriginated'](_0x135cc1[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]]);_0x135cc1[_0x82bb('0x1d')][_0x3ab93e['queue']][_0x82bb('0x113')]+=0x1;_0x135cc1[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x343f99=_0x135cc1[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]];var _0x256d7d=new Hangup(_0x3ab93e,_0x58883e);_0x256d7d[_0x82bb('0x6c')]=0x13;_0x256d7d[_0x82bb('0x6d')]=_0x82bb('0x11e');_0x256d7d[_0x82bb('0x116')]=_0x82bb('0x117');_0x256d7d[_0x82bb('0x123')]+=0x1;_0x256d7d['countglobal']+=0x1;_0x256d7d[_0x82bb('0x11f')]=!![];ami[_0x82bb('0x3d')]('custom:amd',ut[_0x82bb('0x119')](_0x256d7d,'amd'));hopperUtils['createHistory'](_0x256d7d)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12f')));if(_0x256d7d[_0x82bb('0x120')]+_0x256d7d[_0x82bb('0x121')]+_0x256d7d[_0x82bb('0x130')]+_0x256d7d[_0x82bb('0x122')]+_0x256d7d[_0x82bb('0xd6')]+_0x256d7d[_0x82bb('0xeb')]+_0x256d7d[_0x82bb('0x123')]+_0x256d7d[_0x82bb('0x124')]>=_0x343f99[_0x82bb('0x125')]){_0x135cc1['stateGlobal'](_0x256d7d,_0x4aa24a,_0x2d4150,_0x82bb('0x131'));}else{if(_0x256d7d[_0x82bb('0x123')]>=_0x343f99[_0x82bb('0x127')]){_0x135cc1[_0x82bb('0x128')](_0x256d7d,_0x4aa24a,_0x2d4150,_0x82bb('0x129'));}else{hopperUtils[_0x82bb('0xdd')]({'active':![],'countmachineretry':_0x256d7d[_0x82bb('0x123')],'scheduledat':moment()[_0x82bb('0x12a')](_0x343f99['dialMachineRetryFrequency'],_0x82bb('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256d7d[_0x82bb('0xed')],'ListId':_0x256d7d[_0x82bb('0xdf')],'VoiceQueueId':_0x256d7d[_0x82bb('0xe0')]||undefined,'CampaignId':_0x256d7d[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12b')));_0x4aa24a({'reschedule':0x1});}}});}}};Dialer[_0x82bb('0x85')]['syncHangup']=function(_0x2df3ed){var _0x46a2b2=this[_0x82bb('0x24')][_0x2df3ed[_0x82bb('0xc1')]];var _0x299c8a;if(_0x46a2b2&&_0x46a2b2[_0x82bb('0xc2')]===_0x82bb('0xc3')){delete this[_0x82bb('0x24')][_0x2df3ed[_0x82bb('0xc1')]];this[_0x82bb('0xcd')](this['campaigns'][_0x46a2b2[_0x82bb('0xc0')]]);this[_0x82bb('0x1d')][_0x46a2b2[_0x82bb('0xc0')]][_0x82bb('0x132')]+=0x1;_0x299c8a=new Hangup(_0x46a2b2,_0x2df3ed);hopperUtils[_0x82bb('0xe4')](_0x299c8a)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x133')));hopperUtils[_0x82bb('0x134')](_0x299c8a)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x135')));}if(_0x46a2b2&&_0x46a2b2[_0x82bb('0xc2')]!==_0x82bb('0xc3')&&isNotNull(this['voiceQueues'][_0x46a2b2[_0x82bb('0xc0')]]['dialQueueProject'])){delete this['uniqueId'][_0x2df3ed[_0x82bb('0xc1')]];this['updateOriginated'](this[_0x82bb('0x1c')][_0x46a2b2[_0x82bb('0xc0')]]);this[_0x82bb('0x1c')][_0x46a2b2[_0x82bb('0xc0')]]['outboundAnswerCallsDay']+=0x1;this[_0x82bb('0x1c')][_0x46a2b2[_0x82bb('0xc0')]][_0x82bb('0x114')]+=0x1;_0x299c8a=new Hangup(_0x46a2b2,_0x2df3ed);_0x299c8a[_0x82bb('0x6c')]=0x10;_0x299c8a[_0x82bb('0x6d')]=_0x82bb('0x136');_0x299c8a[_0x82bb('0x116')]=_0x82bb('0x137');hopperUtils[_0x82bb('0xe4')](_0x299c8a)['catch'](loggerCatch(_0x82bb('0x133')));hopperUtils[_0x82bb('0x134')](_0x299c8a)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x135')));}if(_0x46a2b2&&_0x46a2b2[_0x82bb('0xc2')]!==_0x82bb('0xc3')&&!isNotNull(this['voiceQueues'][_0x46a2b2[_0x82bb('0xc0')]]['dialQueueProject'])){delete this[_0x82bb('0x24')][_0x2df3ed[_0x82bb('0xc1')]];this[_0x82bb('0xcd')](this[_0x82bb('0x1c')][_0x46a2b2['queue']]);this['voiceQueues'][_0x46a2b2['queue']][_0x82bb('0x138')]+=0x1;_0x299c8a=new Hangup(_0x46a2b2,_0x2df3ed);_0x299c8a[_0x82bb('0x6c')]=0xc;_0x299c8a['statedesc']=_0x2df3ed[_0x82bb('0x139')];_0x299c8a[_0x82bb('0x116')]=_0x82bb('0x13a');hopperUtils[_0x82bb('0xe4')](_0x299c8a)[_0x82bb('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x82bb('0x134')](_0x299c8a)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x82bb('0x85')][_0x82bb('0x7')]=function(_0x586ec1){var _0x48bed9=this;if(!_0x48bed9[_0x82bb('0x28')][_0x586ec1['name']]){_0x48bed9['queuesSummary'][_0x586ec1[_0x82bb('0x41')]]={'running':![]};}else if(_0x48bed9[_0x82bb('0x28')][_0x586ec1[_0x82bb('0x41')]]['running']===!![]){return;}else if(_0x48bed9['queuesSummary'][_0x586ec1[_0x82bb('0x41')]]['running']===![]){_0x48bed9[_0x82bb('0x28')][_0x586ec1[_0x82bb('0x41')]][_0x82bb('0x13b')]=!![];}var _0xa41dee=_0x48bed9[_0x82bb('0x1c')][_0x586ec1[_0x82bb('0x41')]];var _0x58f206=_0xa41dee['message']!==utils[_0x82bb('0x65')][_0x82bb('0x78')];var _0x13d970=utils[_0x82bb('0x13c')](_0xa41dee);_0xa41dee[_0x82bb('0x13d')]=utils[_0x82bb('0x13e')](_0xa41dee,_0x48bed9['trunks']);Promise['resolve']()['then'](function(){if(_0xa41dee['statusMessage']===utils[_0x82bb('0x65')][_0x82bb('0x78')]){if(_0x58f206){clearPredictiveAttributes(_0xa41dee);_0x586ec1[_0x82bb('0x5d')]=undefined;_0x586ec1[_0x82bb('0x26')]=undefined;}if(_0xa41dee['statusMessage']===utils['CAMPAIGN_STATUS'][_0x82bb('0x78')]){_0x586ec1[_0x82bb('0x13f')]=0x0;_0x586ec1[_0x82bb('0xf7')]=0x0;_0x586ec1[_0x82bb('0x140')]=0x0;_0x586ec1[_0x82bb('0x141')]=0x0;_0x586ec1[_0x82bb('0x142')]=0x0;}}else if(_0xa41dee['statusMessage']===utils[_0x82bb('0x65')][_0x82bb('0x143')]&&!_0x13d970){return _0x48bed9[_0x82bb('0x95')](_0xa41dee,!![])['then'](function(){return _0x48bed9[_0x82bb('0x95')](_0xa41dee,![]);})[_0x82bb('0x3a')](function(){return _0x48bed9[_0x82bb('0xb0')](_0xa41dee);})[_0x82bb('0xa4')](function(_0x74b684){loggerSyncQueueSummary[_0x82bb('0x5c')]('[syncQueueSummary]',util['inspect'](_0x74b684,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xa41dee);});}else{clearPredictiveAttributes(_0xa41dee);}})['then'](function(){var _0x505586=_0x586ec1[_0x82bb('0x144')](_0xa41dee);if(_0x505586||_0xa41dee['queueSummaryCountersUpdated']){_0xa41dee[_0x82bb('0x145')]=![];_0x586ec1[_0x82bb('0x146')](_0xa41dee);Object[_0x82bb('0x147')](_0xa41dee,_0x586ec1);emitOutboundVoiceQueueSummary(_0x586ec1);}_0x48bed9[_0x82bb('0x28')][_0xa41dee['name']][_0x82bb('0x13b')]=![];})[_0x82bb('0xa4')](function(_0x29f6a5){logger[_0x82bb('0x60')](_0x82bb('0x148'),util['inspect'](_0x29f6a5,{'showHidden':![],'depth':null}));_0x48bed9[_0x82bb('0x28')][_0xa41dee[_0x82bb('0x41')]][_0x82bb('0x13b')]=![];});};Dialer[_0x82bb('0x85')][_0x82bb('0x30')]=_[_0x82bb('0x149')](function(){var _0x2bcdff=_['filter'](this[_0x82bb('0x1c')],function(_0x11be52){return _0x11be52[_0x82bb('0x14a')];});var _0x5224d1=_[_0x82bb('0x14b')](this[_0x82bb('0x1e')],function(_0x2a6d44){return _0x2a6d44['online']&&_0x2a6d44[_0x82bb('0x88')]===_0x82bb('0x14c');});if(_0x2bcdff['length']>0x0&&_0x5224d1[_0x82bb('0x9c')]>0x0){return Promise['resolve']()[_0x82bb('0x3a')](cmHopper[_0x82bb('0x14d')](_[_0x82bb('0x14e')](_0x2bcdff,'id'),previewRecallmeReminderInterval,_[_0x82bb('0x14e')](_0x5224d1,'id')))['then'](function(_0x2a896a){for(var _0x3bed1b=0x0;_0x3bed1b<_0x2a896a[_0x82bb('0x9c')];_0x3bed1b++){var _0x371345=_0x2a896a[_0x3bed1b]['Agent'][_0x82bb('0x41')];if(_0x371345)io['to'](util[_0x82bb('0x3f')](_0x82bb('0x14f'),_0x371345))['emit'](_0x82bb('0x150'),{'hopper':_0x2a896a[_0x3bed1b]});}})['catch'](function(_0x3b6054){logger[_0x82bb('0x60')]('checkPreviewRecallReminder',_0x3b6054);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x82bb('0x85')]['loopClearZombieChannels']=function(){var _0x389c4e=this;setInterval(function(){_0x389c4e[_0x82bb('0x151')](_0x389c4e[_0x82bb('0x24')],_0x82bb('0x152'));_0x389c4e[_0x82bb('0x151')](_0x389c4e['actions'],_0x82bb('0x153'));},0x32c8);};Dialer[_0x82bb('0x85')][_0x82bb('0x151')]=function(_0x310860,_0x1a9ea6){var _0x78e470=this;for(var _0x3eb46c in _0x310860){if(typeof _0x310860[_0x3eb46c]!==_0x82bb('0xab')){this[_0x82bb('0x1a')][_0x82bb('0x17')](function(){if(!_[_0x82bb('0xf5')](_0x310860[_0x3eb46c])){return ami[_0x82bb('0x9e')]({'action':_0x82bb('0x88'),'channel':_0x310860[_0x3eb46c]['channel']})[_0x82bb('0xa4')](function(_0x5f5cc9){if(_0x5f5cc9[_0x82bb('0x69')]===_0x82bb('0x154')){setTimeout(function(){if(_0x310860[_0x3eb46c]&&_0x310860[_0x3eb46c][_0x82bb('0xc2')]!=='ivr'){_0x78e470[_0x82bb('0xcd')](_0x78e470['voiceQueues'][_0x310860[_0x3eb46c][_0x82bb('0xc0')]]);logger[_0x82bb('0x60')]('[Dialer][checkChannel]',_0x1a9ea6,_0x3eb46c,_0x310860[_0x3eb46c][_0x82bb('0xc0')]);delete _0x310860[_0x3eb46c];}if(_0x310860[_0x3eb46c]&&_0x310860[_0x3eb46c][_0x82bb('0xc2')]==='ivr'){_0x78e470[_0x82bb('0xcd')](_0x78e470[_0x82bb('0x1d')][_0x310860[_0x3eb46c][_0x82bb('0xc0')]]);logger[_0x82bb('0x60')](_0x82bb('0x155'),_0x1a9ea6,_0x3eb46c,_0x310860[_0x3eb46c][_0x82bb('0xc0')]);delete _0x310860[_0x3eb46c];}},0x2328);}});}});}}};Dialer[_0x82bb('0x85')][_0x82bb('0x156')]=function(_0x441efb){return Promise['resolve']()['then'](voiceQueueRt[_0x82bb('0x156')](_0x441efb))['catch'](loggerCatch(_0x82bb('0x157')));};Dialer[_0x82bb('0x85')][_0x82bb('0xcd')]=function(_0x492ed5){if(!_[_0x82bb('0x3c')](_0x492ed5)&&_0x492ed5!==null){if(typeof _0x492ed5[_0x82bb('0x7e')]!==_0x82bb('0xab')){if(_0x492ed5[_0x82bb('0x7e')]>0x0){_0x492ed5[_0x82bb('0x7e')]-=0x1;}else{logger[_0x82bb('0x60')](_0x82bb('0x158'));}}}else{logger[_0x82bb('0x60')](_0x82bb('0x159'));}};Dialer['prototype'][_0x82bb('0x15a')]=function(_0x1e2844,_0x7d93e4){var _0x3419fe=this;return function(_0x75d628){_0x3419fe[_0x82bb('0xcd')](_0x7d93e4);logger['error'](_0x1e2844,util[_0x82bb('0x63')](_0x75d628,{'showHidden':![],'depth':null}));};};Dialer[_0x82bb('0x85')]['emptyContact']=function(_0x2d24af,_0x1291d8,_0x4d2b68){var _0x428b6e={'state':0x19,'statedesc':_0x82bb('0x15b')};this[_0x82bb('0xcd')](_0x1291d8);this[_0x82bb('0x11a')](_['merge'](_0x428b6e,_['pick'](_0x4d2b68,['ContactId',_0x82bb('0xdf'),_0x82bb('0x15c'),_0x82bb('0xe0'),_0x82bb('0xe1')])),_0x82bb('0x15d'),_0x82bb('0x15e'));logger['error'](_0x2d24af);};Dialer[_0x82bb('0x85')]['saveInDb']=function(_0x29332f,_0x320cb5,_0x16f799){hopperUtils['createHistory'](_0x29332f)[_0x82bb('0xa4')](loggerCatch(_0x320cb5));hopperUtils[_0x82bb('0x134')](_0x29332f)[_0x82bb('0xa4')](loggerCatch(_0x16f799));};Dialer[_0x82bb('0x85')][_0x82bb('0xdc')]=function(_0x1d1823,_0x54c1e6){hopperUtils['createHistory'](_0x1d1823)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x15f')));if(_0x54c1e6==0x0){hopperUtils['moveContactManagedDialer'](_0x1d1823)[_0x82bb('0xa4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x13909c){return Promise['resolve']()[_0x82bb('0x3a')](cmHopper[_0x82bb('0x14d')](_0x13909c['id'],previewRecallmeReminderInterval))[_0x82bb('0x3a')](function(_0x3c2a96){for(var _0x972fe=0x0;_0x972fe<_0x3c2a96[_0x82bb('0x9c')];_0x972fe++){var _0x534c0a=_0x3c2a96[_0x972fe][_0x82bb('0x160')][_0x82bb('0x41')];if(_0x534c0a)io['to'](util['format'](_0x82bb('0x14f'),_0x534c0a))[_0x82bb('0x3d')]('user:dialPreviewRecallReminder',{'hopper':_0x3c2a96[_0x972fe]});}})[_0x82bb('0xa4')](function(){});};Dialer[_0x82bb('0x85')][_0x82bb('0xaf')]=function(_0x2bbfa2){var _0x169740=this;return function(){_0x169740[_0x82bb('0x161')](_0x2bbfa2);};};Dialer['prototype'][_0x82bb('0x162')]=function(_0x168ec8,_0x21eae8){var _0x3c304c=this;var _0x2656a0=uuid['v4']();this['actions'][_0x2656a0]=new Action(_0x168ec8,_0x21eae8,_0x2656a0);return new Promise(function(_0x43f50b,_0x3558fa){if(_[_0x82bb('0x3c')](_0x168ec8)&&typeof _0x168ec8!=='object'){return _0x3558fa(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x21eae8['phone'])||_0x21eae8[_0x82bb('0x163')]===null){return _0x3558fa(msgResponse(_0x82bb('0x164'),_0x82bb('0x96'),_0x82bb('0x165')));}var _0x3adcd8={'XMD-CALLERID':_0x3c304c[_0x82bb('0x22')][_0x2656a0][_0x82bb('0x166')](),'XMD-AGI':_0x168ec8[_0x82bb('0x167')]?util['format'](_0x82bb('0x168'),ipAgi,_0x168ec8[_0x82bb('0x167')]):_0x82bb('0x169'),'XMD-AGIAFTER':_0x168ec8[_0x82bb('0xc9')]?util['format'](_0x82bb('0x168'),ipAgi,_0x168ec8[_0x82bb('0xc9')]):_0x82bb('0x169'),'XMD-QUEUE':utils[_0x82bb('0x16a')](_0x168ec8)?util['format']('\x22%s,%s%s,,,%s\x22',_0x168ec8[_0x82bb('0x41')],_0x168ec8[_0x82bb('0x16b')]||'',_0x168ec8['dialAgiAfterHangupAgent']?'c':'',_0x168ec8['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x21eae8[_0x82bb('0xed')],'XMD-CDRTYPE':_0x82bb('0x5'),'CALLERID(all)':_0x3c304c['actions'][_0x2656a0][_0x82bb('0x166')](),'XMD-AMD':_0x168ec8[_0x82bb('0x11d')]?'ACTIVE':_0x82bb('0x169'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x168ec8[_0x82bb('0x11d')]){_0x3adcd8['XMD-AMDINITIALSILENCE']=_0x168ec8[_0x82bb('0x16c')]||0x9c4;_0x3adcd8[_0x82bb('0x16d')]=_0x168ec8[_0x82bb('0x16e')]||0x5dc;_0x3adcd8[_0x82bb('0x16f')]=_0x168ec8[_0x82bb('0x170')]||0x320;_0x3adcd8['XMD-AMDTOTALANALYSISTIME']=_0x168ec8[_0x82bb('0x171')]||0x1388;_0x3adcd8[_0x82bb('0x172')]=_0x168ec8['dialAMDMinWordLength']||0x64;_0x3adcd8['XMD-AMDBETWEENWORDSSILENCE']=_0x168ec8[_0x82bb('0x173')]||0x32;_0x3adcd8[_0x82bb('0x174')]=_0x168ec8[_0x82bb('0x175')]||0x3;_0x3adcd8[_0x82bb('0x176')]=_0x168ec8['dialAMDSilenceThreshold']||0x100;_0x3adcd8[_0x82bb('0x177')]=_0x168ec8[_0x82bb('0x178')]||0x1388;}if(utils[_0x82bb('0x16a')](_0x168ec8)){_0x3adcd8[_0x82bb('0x179')]=_0x21eae8[_0x82bb('0xe0')];}else{_0x3adcd8[_0x82bb('0x17a')]=_0x21eae8[_0x82bb('0xe1')];}var _0x416a97=utils['setXMDContactVariables'](_0x21eae8[_0x82bb('0x17b')]);Object[_0x82bb('0x147')](_0x3adcd8,_0x416a97);var _0x374e7b=_0x3c304c['isTrunkReachable'](_0x168ec8[_0x82bb('0x8b')])?utils['getCallerId'](_0x168ec8[_0x82bb('0x8b')][_0x82bb('0x17c')],_0x168ec8[_0x82bb('0x17d')],_0x168ec8[_0x82bb('0x17e')]>0x0?utils['getCallerIdRandom'](_0x168ec8[_0x82bb('0x17f')],_0x168ec8[_0x82bb('0x17e')]):_0x168ec8[_0x82bb('0x17f')]):utils[_0x82bb('0x180')](_[_0x82bb('0xf5')](_0x168ec8[_0x82bb('0x8d')])?_0x168ec8[_0x82bb('0x8b')]['callerid']:_0x168ec8[_0x82bb('0x8d')][_0x82bb('0x17c')],_0x168ec8[_0x82bb('0x17d')],_0x168ec8[_0x82bb('0x17e')]>0x0?utils[_0x82bb('0x181')](_0x168ec8['dialOriginateCallerIdNumber'],_0x168ec8[_0x82bb('0x17e')]):_0x168ec8[_0x82bb('0x17f')]);if(_0x374e7b){_0x3adcd8[_0x82bb('0x182')]=_0x3c304c[_0x82bb('0x22')][_0x2656a0][_0x82bb('0x183')]=utils['extractCalleridName'](_0x374e7b);_0x3adcd8[_0x82bb('0x184')]=_0x21eae8['phone'];}_0x168ec8[_0x82bb('0x185')]=_0x3adcd8;return ami['Action']({'actionid':_0x2656a0,'action':'originate','channel':_0x3c304c[_0x82bb('0x8c')](_0x168ec8['Trunk'])?util[_0x82bb('0x3f')]('SIP/%s/%s%s',_0x168ec8[_0x82bb('0x8b')]['name'],isNotNull(_0x168ec8[_0x82bb('0x186')])?_0x168ec8[_0x82bb('0x186')][_0x82bb('0x187')]()||'':'',_0x168ec8[_0x82bb('0x188')]>0x0?_0x21eae8['phone'][_0x82bb('0x189')](_0x168ec8[_0x82bb('0x188')]):_0x21eae8[_0x82bb('0x163')]):util[_0x82bb('0x3f')](_0x82bb('0x18a'),_['isNil'](_0x168ec8['TrunkBackup'])?_0x168ec8['Trunk'][_0x82bb('0x41')]:_0x168ec8[_0x82bb('0x8d')][_0x82bb('0x41')],isNotNull(_0x168ec8[_0x82bb('0x186')])?_0x168ec8[_0x82bb('0x186')][_0x82bb('0x187')]()||'':'',_0x168ec8[_0x82bb('0x188')]>0x0?_0x21eae8[_0x82bb('0x163')][_0x82bb('0x189')](_0x168ec8[_0x82bb('0x188')]):_0x21eae8[_0x82bb('0x163')]),'callerid':_0x374e7b,'Exten':_0x82bb('0x110'),'Context':'from-sip','Priority':'1','variable':_0x3adcd8,'timeout':(_0x168ec8[_0x82bb('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2656a0})[_0x82bb('0x3a')](function(_0x2230c5){return _0x43f50b(_0x2230c5);})['catch'](function(_0x531a72){_0x168ec8[_0x82bb('0x18c')]+=0x1;var _0x313819=new History(_0x3c304c['actions'][_0x2656a0]);logger[_0x82bb('0x60')](util[_0x82bb('0x3f')](_0x82bb('0x18d'),JSON[_0x82bb('0x101')](_0x531a72)));_0x313819[_0x82bb('0x6c')]=0xe;_0x313819[_0x82bb('0x6d')]=_0x82bb('0x18e');_0x313819[_0x82bb('0x6f')]=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));_0x313819[_0x82bb('0x6e')]=_0x313819[_0x82bb('0x6f')];hopperUtils[_0x82bb('0xe4')](_0x313819)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x18f')));_0x3c304c[_0x82bb('0x134')](_0x313819)['catch'](loggerCatch(_0x82bb('0x18f')))[_0x82bb('0x19')](function(){delete _0x3c304c['actions'][_0x2656a0];return _0x3558fa(msgResponse(_0x82bb('0x164'),_0x82bb('0x84'),'originate\x20action\x20Error'));});});});};Dialer[_0x82bb('0x85')]['checkRetriveMax']=function(_0x5c5393,_0x16b6d4,_0x2227c5){var _0x41d9a9=new History(_0x16b6d4);if(_0x41d9a9[_0x82bb('0x120')]+_0x41d9a9['countcongestionretry']+_0x41d9a9[_0x82bb('0x130')]+_0x41d9a9['countnosuchnumberretry']+_0x41d9a9[_0x82bb('0xd6')]+_0x41d9a9[_0x82bb('0xeb')]+_0x41d9a9[_0x82bb('0x123')]+_0x41d9a9[_0x82bb('0x124')]>=_0x2227c5['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5c5393){case 0x3:if(_0x41d9a9[_0x82bb('0x130')]>=_0x2227c5['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countnoanswerretry':_0x41d9a9[_0x82bb('0x130')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5['dialNoAnswerRetryFrequency'],_0x82bb('0xde'))['format'](_0x82bb('0xc4')),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9['CampaignId']||undefined})['catch'](loggerCatch(_0x82bb('0x190')));break;case 0x5:if(_0x41d9a9[_0x82bb('0x120')]>=_0x2227c5[_0x82bb('0x191')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countbusyretry':_0x41d9a9[_0x82bb('0x120')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x192')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x193')));break;case 0x8:if(_0x41d9a9[_0x82bb('0x121')]>=_0x2227c5[_0x82bb('0x194')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countcongestionretry':_0x41d9a9[_0x82bb('0x121')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x195')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9['ContactId'],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x41d9a9[_0x82bb('0x122')]>=_0x2227c5[_0x82bb('0x196')]-0x1){return!![];}else{hopperUtils[_0x82bb('0xdd')]({'active':![],'countnosuchnumberretry':_0x41d9a9['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x197')],_0x82bb('0xde'))[_0x82bb('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x198')));}break;case 0xa:if(_0x41d9a9['countdropretry']>=_0x2227c5[_0x82bb('0x199')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countdropretry':_0x41d9a9['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x2227c5[_0x82bb('0xd8')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9['ContactId'],'ListId':_0x41d9a9['ListId'],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x19a')));break;case 0xb:if(_0x41d9a9['countabandonedretry']>=_0x2227c5[_0x82bb('0xec')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x41d9a9[_0x82bb('0xeb')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0xe9')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9['ListId'],'VoiceQueueId':_0x41d9a9['VoiceQueueId']||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x19b')));break;case 0x13:if(_0x41d9a9['countmachineretry']>=_0x2227c5[_0x82bb('0x127')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countmachineretry':_0x41d9a9[_0x82bb('0x123')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x19c')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12b')));break;case 0x14:if(_0x41d9a9[_0x82bb('0x124')]>=_0x2227c5[_0x82bb('0x19d')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countagentrejectretry':_0x41d9a9['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x19e')],'minutes')[_0x82bb('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41d9a9['ContactId'],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x19f')));break;default:return!![];}};Dialer['prototype'][_0x82bb('0x10c')]=function(_0x455cb2,_0x666745,_0x4f89a1){var _0x2c6973=this;var _0x2cebc8=new History(_0x455cb2);var _0x2a070b=![];var _0x35234e;var _0x274bf9;return new Promise(function(_0x32c790,_0x4da3ab){if(_[_0x82bb('0x3c')](_0x666745)&&typeof _0x666745!=='object'){return _0x4da3ab(msgResponse('[callProgressDetecting]',_0x82bb('0x96'),_0x82bb('0x1a0')));}if(_[_0x82bb('0x3c')](_0x4f89a1)&&typeof _0x4f89a1!==_0x82bb('0x1a1')){return _0x4da3ab(msgResponse(_0x82bb('0x1a2'),_0x82bb('0x96'),_0x82bb('0x1a3')));}hopperUtils['verifyAdditionalPhones'](_0x2cebc8,_0x4f89a1[_0x82bb('0xc6')],_0x666745)[_0x82bb('0x3a')](function(_0x59a6b3){if(_0x59a6b3[_0x82bb('0xdb')]==0x1)_0x2a070b=!![];switch(_0x4f89a1[_0x82bb('0xc6')]){case'0':_0x666745[_0x82bb('0x1a4')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x0;_0x2cebc8[_0x82bb('0x6d')]=_0x82bb('0x1a5');_0x2cebc8['countnosuchnumberretry']+=0x1;_0x2cebc8['countglobal']+=0x1;ami[_0x82bb('0x3d')]('custom:agentnosuchnumber',ut['buildObj'](_0x455cb2,_0x82bb('0x1a6')));_0x35234e=_0x666745[_0x82bb('0x197')];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12f')));if(_0x2c6973[_0x82bb('0x1a7')](0x0,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0x122')]>=_0x666745[_0x82bb('0x196')]){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1a8'));}else{_0x2c6973[_0x82bb('0x126')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1a8'));}}break;case'3':_0x666745[_0x82bb('0x1a9')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x3;_0x2cebc8['statedesc']=_0x82bb('0x1aa');_0x2cebc8[_0x82bb('0x130')]+=0x1;_0x2cebc8['countglobal']+=0x1;var _0xdc2d37=ut['buildNoAnswerEventPayload'](_0x455cb2,_0x666745);ami[_0x82bb('0x3d')](_0x82bb('0x1ab'),_0xdc2d37);_0x35234e=_0x666745['dialNoAnswerRetryFrequency'];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils['createHistory'](_0x2cebc8)['catch'](loggerCatch(_0x82bb('0x1ac')));if(_0x2c6973[_0x82bb('0x1a7')](0x3,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0x130')]>=_0x666745[_0x82bb('0x1ad')]){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1ae'));}else{_0x2c6973[_0x82bb('0x126')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1ae'));}}break;case'5':_0x666745[_0x82bb('0x1af')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x5;_0x2cebc8['statedesc']='Busy';_0x2cebc8[_0x82bb('0x120')]+=0x1;_0x2cebc8[_0x82bb('0xd7')]+=0x1;ami[_0x82bb('0x3d')]('custom:agentbusy',ut[_0x82bb('0x119')](_0x455cb2,'busy'));_0x35234e=_0x666745[_0x82bb('0x192')];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2c6973['checkRetriveMax'](0x5,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0x120')]>=_0x666745[_0x82bb('0x191')]){_0x2c6973['createStateFinal'](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b0'));}else{_0x2c6973[_0x82bb('0x126')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b0'));}}break;case'8':_0x666745[_0x82bb('0x1b1')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x8;_0x2cebc8[_0x82bb('0x6d')]=_0x82bb('0x1b2');_0x2cebc8[_0x82bb('0x121')]+=0x1;_0x2cebc8['countglobal']+=0x1;_0x35234e=_0x666745[_0x82bb('0x195')];_0x274bf9=_0x666745[_0x82bb('0xd9')];ami[_0x82bb('0x3d')]('custom:agentcongestion',ut[_0x82bb('0x119')](_0x455cb2,_0x82bb('0x1b3')));hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2c6973[_0x82bb('0x1a7')](0x8,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8['countcongestionretry']>=_0x666745['dialCongestionMaxRetry']){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b4'));}else{_0x2c6973['stateGlobal'](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b4'));}}break;case'11':_0x666745[_0x82bb('0x1b5')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0xb;_0x2cebc8[_0x82bb('0x6d')]=_0x82bb('0xe7');_0x2cebc8[_0x82bb('0xeb')]+=0x1;_0x2cebc8['countglobal']+=0x1;_0x35234e=_0x666745['dialAbandonedRetryFrequency'];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2c6973[_0x82bb('0x1a7')](0xb,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0xeb')]>=_0x666745[_0x82bb('0xec')]){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b6'));}else{_0x2c6973[_0x82bb('0x126')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b6'));}}break;case'20':_0x666745[_0x82bb('0x1b7')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x14;_0x2cebc8[_0x82bb('0x6d')]=_0x82bb('0x1b8');_0x2cebc8[_0x82bb('0x124')]+=0x1;_0x2cebc8[_0x82bb('0xd7')]+=0x1;_0x35234e=_0x666745['dialAgentRejectRetryFrequency'];_0x274bf9=_0x666745[_0x82bb('0xd9')];ami[_0x82bb('0x3d')](_0x82bb('0x1b9'),ut[_0x82bb('0x119')](_0x455cb2,_0x82bb('0x1ba')));hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1bb')));if(_0x2c6973[_0x82bb('0x1a7')](0x14,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0x124')]>=_0x666745[_0x82bb('0x19d')]){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1bc'));}else{_0x2c6973['stateGlobal'](_0x2cebc8,_0x32c790,_0x4da3ab,'reason\x2020\x20agentreject');}}break;default:_0x666745[_0x82bb('0x138')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0xc;_0x2cebc8['statedesc']=_0x4f89a1[_0x82bb('0xc6')];_0x35234e=_0x666745[_0x82bb('0x19e')];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1bd')));if(_0x2c6973[_0x82bb('0x1a7')](_0x4f89a1[_0x82bb('0xc6')],_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8['countbusyretry']+_0x2cebc8[_0x82bb('0x121')]+_0x2cebc8[_0x82bb('0x130')]+_0x2cebc8[_0x82bb('0x122')]+_0x2cebc8['countdropretry']+_0x2cebc8[_0x82bb('0xeb')]+_0x2cebc8[_0x82bb('0x123')]+_0x2cebc8[_0x82bb('0x124')]>=_0x666745['dialGlobalMaxRetry']){_0x2c6973['stateGlobal'](_0x2cebc8,_0x32c790,_0x4da3ab,_0x4f89a1['reason']);}else{_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x4f89a1[_0x82bb('0xc6')]);}}}})[_0x82bb('0x3a')](function(){if(_0x2a070b){hopperUtils['swapAdditionalPhones'](_0x2cebc8,_0x35234e,_0x274bf9)[_0x82bb('0x3a')](function(){return _0x32c790(0x1);});}});});};Dialer[_0x82bb('0x85')][_0x82bb('0x126')]=function(_0x282d77,_0x2b740a,_0x795a0b,_0x5005f1){var _0x193f3e=new Final(_0x282d77);_0x193f3e[_0x82bb('0x6c')]=0xf;_0x193f3e[_0x82bb('0x6d')]='Global';this['createStateFinal'](_0x193f3e,_0x2b740a,_0x795a0b,_0x5005f1);};Dialer[_0x82bb('0x85')][_0x82bb('0x128')]=function(_0x353658,_0x4e723a,_0x30b9b2,_0x583427){hopperUtils[_0x82bb('0x134')](_0x353658)['then'](function(){return _0x4e723a(msgResponse(_0x82bb('0x1a2'),_0x82bb('0x10b'),_0x583427));})[_0x82bb('0xa4')](function(){return _0x30b9b2(msgResponse(_0x82bb('0x1be'),_0x82bb('0x96'),_0x82bb('0x1bf')));});};Dialer[_0x82bb('0x85')][_0x82bb('0xb1')]=function(_0x131444){var _0x521db2=_0x131444[_0x82bb('0x1c0')]/0x64;var _0x5d6468=_0x131444[_0x82bb('0xd1')]/(_0x131444[_0x82bb('0xd1')]+_0x131444[_0x82bb('0x113')]);var _0x1f77b9=Math[_0x82bb('0x1c1')](_0x131444[_0x82bb('0x1c2')]*(_0x131444[_0x82bb('0x1c3')]/0x64));var _0x5c2c31=Math['round'](_0x131444['predictiveIntervalAvailable']*(_0x131444['predictiveIntervalMinThreshold']/0x64));var _0x3daadc=_0x131444[_0x82bb('0x13f')]+_0x131444[_0x82bb('0x141')];var _0x266d8b=Math[_0x82bb('0x1c4')](_0x131444[_0x82bb('0x54')]*_0x131444['erlangAbandonmentRate']*_0x131444[_0x82bb('0x1c5')]*_0x131444[_0x82bb('0x1c6')]);if(_[_0x82bb('0x3c')](_0x131444['startProgressive'])){if(!_['isUndefined'](_0x131444[_0x82bb('0x5d')])){_0x131444[_0x82bb('0x5d')]=undefined;loggerPredictive['error'](_0x82bb('0x1c7'),_0x82bb('0x1c8'));}if(!_[_0x82bb('0x3c')](_0x131444[_0x82bb('0x5f')])){loggerPredictive[_0x82bb('0x60')](_0x82bb('0x1c7'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x131444[_0x82bb('0x5f')]);_0x131444[_0x82bb('0x5f')]=undefined;}_0x131444[_0x82bb('0x26')]=moment()['format'](_0x82bb('0xc4'));loggerPredictive[_0x82bb('0x44')](_0x131444[_0x82bb('0x41')],_0x82bb('0x1c9'),_0x131444['startProgressive']);this[_0x82bb('0xb4')](_0x131444,0x1);}else if(ifInterval(_0x131444[_0x82bb('0x1ca')],_0x131444[_0x82bb('0x26')])){this[_0x82bb('0xb4')](_0x131444,0x1);loggerPredictiveCalls[_0x82bb('0x44')](_0x82bb('0x1cb'),_0x131444[_0x82bb('0x26')],_0x131444[_0x82bb('0x41')]);_0x131444[_0x82bb('0x54')]=0x0;_0x131444[_0x82bb('0xd2')]=0x0;}else if(_0x521db2<_0x5d6468&&_0x131444['dialPredictiveOptimization']===_0x82bb('0x1cc')){clearPredictiveAttributes(_0x131444);loggerPredictive['info'](_0x82bb('0x1cd'),_0x82bb('0x1ce'),_0x5d6468,_0x82bb('0x26'),_0x131444[_0x82bb('0x41')]);}else if(_0x266d8b<_0x131444[_0x82bb('0xd2')]&&_0x131444[_0x82bb('0x1cf')]==='dropRate'){clearPredictiveAttributes(_0x131444);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x1d0'),_0x82bb('0x1d1'),_0x266d8b,_0x82bb('0x1d2'),_0x131444['predictiveIntervalErlangCallsDroppedCalls'],_0x82bb('0x26'),_0x131444[_0x82bb('0x41')]);}else if(!ifInterval(_0x131444[_0x82bb('0x1ca')],_0x131444[_0x82bb('0x26')])&&_[_0x82bb('0x3c')](_0x131444[_0x82bb('0x5d')])&&!_[_0x82bb('0x3c')](_0x131444[_0x82bb('0x26')])){_0x131444[_0x82bb('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x82bb('0x44')](_0x131444[_0x82bb('0x41')],_0x82bb('0x1d3'),_0x131444[_0x82bb('0x5d')]);hopperUtils['avgHandleTime'](_0x131444[_0x82bb('0x1ca')])[_0x82bb('0x3a')](this['getDataPredictive'](_0x131444))[_0x82bb('0x3a')](mergeDataErlangB(_0x131444))['then'](this['startMethodPredictive'](_0x131444))['catch'](loggerCatchPredictive(_0x82bb('0x1d4'),_0x131444));}else if(!ifInterval(_0x131444[_0x82bb('0x1ca')],_0x131444[_0x82bb('0x5d')])){_0x131444[_0x82bb('0xd2')]=0x0;_0x131444[_0x82bb('0x5d')]=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));loggerPredictive[_0x82bb('0x44')](_0x131444['name'],_0x82bb('0x1d5'),_0x131444[_0x82bb('0x5d')]);clearInterval(_0x131444['handlePredictive']);_0x131444[_0x82bb('0x5f')]=undefined;hopperUtils['avgHandleTime'](_0x131444[_0x82bb('0x1ca')])[_0x82bb('0x3a')](this[_0x82bb('0x1d6')](_0x131444))['then'](mergeDataErlangB(_0x131444))['then'](this[_0x82bb('0x1d7')](_0x131444))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x131444));}else if(_0x131444[_0x82bb('0x1c2')]&&_0x3daadc<_0x131444[_0x82bb('0x1c2')]-_0x5c2c31){clearPredictiveAttributes(_0x131444);loggerPredictive[_0x82bb('0x44')](_0x131444[_0x82bb('0x41')],_0x82bb('0x1d8'),_0x3daadc,')\x20are\x20less\x20than\x20threshold\x20(',_0x131444[_0x82bb('0x1c2')],'-',_0x5c2c31,'=',_0x131444['predictiveIntervalAvailable']-_0x5c2c31,')');}else if(_0x131444['predictiveIntervalAvailable']&&_0x3daadc>_0x131444[_0x82bb('0x1c2')]+_0x1f77b9){clearPredictiveAttributes(_0x131444);loggerPredictive['info'](_0x131444[_0x82bb('0x41')],_0x82bb('0x1d8'),_0x3daadc,_0x82bb('0x1d9'),_0x131444['predictiveIntervalAvailable'],'+',_0x1f77b9,'=',_0x131444[_0x82bb('0x1c2')]+_0x1f77b9,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2286f0){var _0x3667a1=this;return function(_0x53c2e4){return new Promise(function(_0x16d265,_0x441702){_[_0x82bb('0x5a')](_0x2286f0,_0x53c2e4[0x0]);if(checkGetDataPredictive(_0x53c2e4[0x0])){var _0x3447ef=_0x2286f0[_0x82bb('0x1c2')]=_0x2286f0[_0x82bb('0x141')]+_0x2286f0['available'];var _0x4a3dee=_0x2286f0[_0x82bb('0x1ca')]*0x3c;var _0x549304=_0x53c2e4[0x0][_0x82bb('0x4c')]+_0x53c2e4[0x0][_0x82bb('0x4e')];var _0x250b83=(_0x53c2e4[0x0]['predictiveIntervalAnsweredCalls']+_0x53c2e4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x53c2e4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x53c2e4[0x0][_0x82bb('0x47')];_0x2286f0[_0x82bb('0x1c5')]=_0x250b83>0x0?_0x250b83:0x1;switch(_0x2286f0['dialPredictiveOptimization']){case _0x82bb('0x1cc'):var _0x4e7ced=_0x2286f0['dialPredictiveOptimizationPercentage']/0x64;return _0x3667a1[_0x82bb('0x1da')](_0x3447ef,_0x4a3dee,_0x549304,_0x250b83,_0x4e7ced)[_0x82bb('0x3a')](function(_0x4bd4c7){return _0x16d265(_0x4bd4c7);});case'agentBusyFactor':var _0x680aa0=_0x2286f0[_0x82bb('0x1c0')]/0x64;return _0x3667a1['busyFactor'](_0x3447ef,_0x4a3dee,_0x549304,_0x250b83,_0x680aa0)[_0x82bb('0x3a')](function(_0x232d1){return _0x16d265(_0x232d1);});default:return _0x441702(msgResponse(_0x82bb('0x1db'),_0x82bb('0x96'),'Unknown\x20Predictive'));}}else{return _0x441702(msgResponse('[getDataPredictive]','Failure',_0x82bb('0x1dc')));}});};};Dialer[_0x82bb('0x85')][_0x82bb('0x1dd')]=function(_0x507a74){var _0x275389=this;return function(_0x4be240){return new Promise(function(_0x23912d,_0x3cbcfd){_['merge'](_0x507a74,_0x4be240[0x0]);if(checkGetDataPredictive(_0x4be240[0x0])){loggerPredictive[_0x82bb('0x44')](JSON[_0x82bb('0x101')](_0x4be240[0x0]));if(_0x507a74[_0x82bb('0x1cf')]===_0x82bb('0x1cc')){return _0x275389[_0x82bb('0x156')](_0x507a74['id'])[_0x82bb('0x3a')](function(_0x266cb4){var _0x2ffaef=_0x507a74[_0x82bb('0x1de')]-_0x266cb4[0x0][_0x82bb('0x1df')];var _0x1deb58=_0x507a74[_0x82bb('0x1ca')]*0x3c;var _0x129623=_0x4be240[0x0]['predictiveIntervalAvgTalktime']+_0x4be240[0x0][_0x82bb('0x4e')];var _0xba26ef=(_0x4be240[0x0][_0x82bb('0x48')]+_0x4be240[0x0][_0x82bb('0x1e0')]+_0x4be240[0x0][_0x82bb('0x4a')])/_0x4be240[0x0][_0x82bb('0x47')];var _0x1c3459=_0x507a74['dialPredictiveOptimizationPercentage']/0x64;_0x507a74[_0x82bb('0x1e1')]=_0x266cb4[0x0][_0x82bb('0x1df')]||0x0;_0x507a74[_0x82bb('0x1c5')]=_0xba26ef>0x0?_0xba26ef:0x1;return _0x275389[_0x82bb('0x1da')](_0x2ffaef,_0x1deb58,_0x129623,_0xba26ef,_0x1c3459);})['then'](function(_0x44d218){return _0x23912d(_0x44d218);})[_0x82bb('0xa4')](function(_0x2a018d){return _0x3cbcfd(msgResponse('[CatchErlangB]',_0x82bb('0x96'),JSON[_0x82bb('0x101')](_0x2a018d)));});}if(_0x507a74['dialPredictiveOptimization']===_0x82bb('0x1e2')){return _0x275389[_0x82bb('0x156')](_0x507a74['id'])['then'](function(_0x552fad){var _0x248a3a=_0x507a74[_0x82bb('0x1de')]-_0x552fad[0x0][_0x82bb('0x1df')];var _0x3d5e8f=_0x507a74[_0x82bb('0x1ca')]*0x3c;var _0xc10edf=_0x4be240[0x0][_0x82bb('0x4c')]+_0x4be240[0x0][_0x82bb('0x4e')];var _0x201142=(_0x4be240[0x0][_0x82bb('0x48')]+_0x4be240[0x0][_0x82bb('0x1e0')]+_0x4be240[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4be240[0x0][_0x82bb('0x47')];var _0x4f18c8=_0x507a74[_0x82bb('0x1c0')]/0x64;_0x507a74[_0x82bb('0x1e1')]=_0x552fad[0x0][_0x82bb('0x1df')]||0x0;_0x507a74[_0x82bb('0x1c5')]=_0x201142>0x0?_0x201142:0x1;return _0x275389['busyFactor'](_0x248a3a,_0x3d5e8f,_0xc10edf,_0x201142,_0x4f18c8);})[_0x82bb('0x3a')](function(_0x445642){return _0x23912d(_0x445642);})[_0x82bb('0xa4')](function(_0x42679a){return _0x3cbcfd(msgResponse('[CatchErlangB]',_0x82bb('0x96'),JSON[_0x82bb('0x101')](_0x42679a)));});}}else{return _0x3cbcfd(msgResponse('[getDataPredictive]',_0x82bb('0x96'),_0x82bb('0x1dc')));}});};};Dialer[_0x82bb('0x85')][_0x82bb('0x1d7')]=function(_0xbe0309){var _0x2d9ffe=this;return function(){var _0x2208d7=0x0;var _0x5d92f7=Math[_0x82bb('0x1c4')](_0xbe0309['erlangCallToSecond']*0x3e8);if(_0x5d92f7>0x0){_0x5d92f7=_0x5d92f7<0x64?0x64:_0x5d92f7;loggerPredictive[_0x82bb('0x44')](_0xbe0309[_0x82bb('0x41')],_0x82bb('0x1e3'),_0x5d92f7,_0x82bb('0x1e4'));_0xbe0309[_0x82bb('0x5f')]=setInterval(function(){_0x2d9ffe[_0x82bb('0x5f')](_0xbe0309);loggerPredictiveCalls['info'](_0x82bb('0x1e5'),_0x2208d7+=0x1);},_0x5d92f7);}else{loggerPredictive[_0x82bb('0x44')](_0xbe0309['name'],_0x82bb('0x1e6'));}};};Dialer[_0x82bb('0x85')]['checkContactBlack']=function(_0x396a16,_0x4e886f){var _0x2c8747=this;return function(_0x3f4800){if(_['isEmpty'](_0x3f4800)){if(_[_0x82bb('0xf5')](_0x4e886f['UserId'])||!_0x4e886f[_0x82bb('0x1e7')]){if(_0x396a16[_0x82bb('0xb2')]==='booked'){_0x396a16['queueStatusComplete']=_[_0x82bb('0x3c')](_0x396a16[_0x82bb('0x73')])?!![]:_0x396a16[_0x82bb('0x73')];var _0x568eb5=uuid['v4']();_0x2c8747[_0x82bb('0x22')][_0x568eb5]=new Action(_0x396a16,_0x4e886f,_0x568eb5);loggerBooked['info'](_0x82bb('0x1e8'),_0x568eb5,_0x82bb('0x1e9'),JSON[_0x82bb('0x101')](_0x396a16[_0x82bb('0x73')]),_0x82bb('0x1ea'),_0x396a16[_0x82bb('0x41')]);if(_0x396a16['queueStatusComplete']){_0x396a16[_0x82bb('0x73')]=![];_0x2c8747[_0x82bb('0x27')][_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xc0')]]=[];ami[_0x82bb('0x9e')]({'actionid':_0x568eb5,'action':_0x82bb('0x1eb'),'queue':_0x396a16['name']})[_0x82bb('0xa4')](function(){_0x2c8747[_0x82bb('0xcd')](_0x396a16);hopperUtils[_0x82bb('0xdd')]({'active':![],'ContactId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xed')],'ListId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xdf')],'VoiceQueueId':_0x2c8747['actions'][_0x568eb5][_0x82bb('0xe0')]||undefined,'CampaignId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1ec')));delete _0x2c8747[_0x82bb('0x22')][_0x568eb5];});}else{loggerBooked[_0x82bb('0x44')](_0x82bb('0x1ed'),JSON[_0x82bb('0x101')](_0x396a16[_0x82bb('0x73')]),'Queue:\x20',_0x396a16[_0x82bb('0x41')]);_0x2c8747[_0x82bb('0xcd')](_0x396a16);hopperUtils[_0x82bb('0xdd')]({'active':![],'ContactId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xed')],'ListId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xdf')],'VoiceQueueId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xe0')]||undefined,'CampaignId':_0x2c8747['actions'][_0x568eb5][_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1ec')));delete _0x2c8747[_0x82bb('0x22')][_0x568eb5];}}else{return _0x2c8747[_0x82bb('0x162')](_0x396a16,_0x4e886f);}}else{if(utils[_0x82bb('0x5b')](undefined,_0x4e886f[_0x82bb('0x1ee')])<_0x396a16['dialRecallMeTimeout']*0x3c){if(_0x4e886f[_0x82bb('0x160')]&&!_0x4e886f[_0x82bb('0x160')]['voicePause']){_0x2c8747['preview'][_0x82bb('0x1ef')](_0x4e886f['id'])[_0x82bb('0x19')](function(){_0x2c8747[_0x82bb('0xcd')](_0x396a16);});}else{hopperUtils[_0x82bb('0x1f0')]({'active':![]},_0x4e886f['id'],0x1)[_0x82bb('0x19')](function(){_0x2c8747['updateOriginated'](_0x396a16);});}}else{_0x396a16[_0x82bb('0x1f1')]+=0x1;_0x2c8747[_0x82bb('0xcd')](_0x396a16);if(_0x396a16[_0x82bb('0x1f2')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e886f['ContactId'],'ListId':_0x4e886f['ListId'],'VoiceQueueId':_0x4e886f[_0x82bb('0xe0')]||undefined,'CampaignId':_0x4e886f[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x82bb('0xe4')](createObjHistory(_0x396a16,_0x4e886f,utils[_0x82bb('0x65')][_0x82bb('0x1f3')],0x17,_0x82bb('0x1f4')))[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1f5')));}else{_0x2c8747[_0x82bb('0x11a')](createObjHistory(_0x396a16,_0x4e886f,utils[_0x82bb('0x65')][_0x82bb('0x1f6')],0x16,'RecallFailedTimeout'),_0x82bb('0x1f7'),_0x82bb('0x1f8'));}}}}else{_0x396a16[_0x82bb('0x1f9')]+=0x1;_0x2c8747[_0x82bb('0x11a')](createObjHistory(_0x396a16,_0x4e886f,utils[_0x82bb('0x65')][_0x82bb('0x1fa')],0xd,_0x82bb('0x1fb')),_0x82bb('0x1fc'),_0x82bb('0x1fd'));throw _0x82bb('0x1fe');}};};Dialer[_0x82bb('0x85')]['handleIvr']=function(_0x5ccdf4){var _0x405c2b=this;var _0x4b65a7=_0x5ccdf4[_0x82bb('0x1ff')]-_0x5ccdf4[_0x82bb('0x7e')];emitCampaignSummary(_0x5ccdf4);if(_0x4b65a7>0x0&&_0x5ccdf4[_0x82bb('0x200')]==0x0){if(_0x4b65a7>this[_0x82bb('0x20')]){_0x4b65a7=this[_0x82bb('0x20')];}_0x5ccdf4[_0x82bb('0x200')]=0x1;hopperUtils[_0x82bb('0x201')](_0x5ccdf4,_0x4b65a7)[_0x82bb('0x3a')](function(_0x480d81){_0x5ccdf4[_0x82bb('0x200')]=0x0;if(_0x480d81){if(!utils[_0x82bb('0x202')](_0x480d81)){_0x5ccdf4[_0x82bb('0x69')]=utils['CAMPAIGN_STATUS'][_0x82bb('0x6a')];logger[_0x82bb('0x44')](_0x82bb('0x203')+_0x5ccdf4[_0x82bb('0x41')]);}else{_0x5ccdf4[_0x82bb('0x7e')]+=_0x480d81[_0x82bb('0x9c')];_0x5ccdf4[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x204')];for(var _0x4ac9e0=0x0;_0x4ac9e0<_0x480d81[_0x82bb('0x9c')];_0x4ac9e0+=0x1){_0x5ccdf4[_0x82bb('0x205')]+=0x1;if(_[_0x82bb('0xf5')](_0x480d81[_0x4ac9e0])||_['isNil'](_0x480d81[_0x4ac9e0][_0x82bb('0x17b')])||_[_0x82bb('0xf5')](_0x480d81[_0x4ac9e0][_0x82bb('0x163')])){_0x405c2b['emptyContact'](_0x82bb('0x206'),_0x5ccdf4,_0x480d81[_0x4ac9e0]);}else{hopperUtils[_0x82bb('0x207')](_['pick'](_0x480d81[_0x4ac9e0],['CampaignId',_0x82bb('0x163')]))['then'](_0x405c2b[_0x82bb('0x208')](_0x5ccdf4,_0x480d81[_0x4ac9e0]))[_0x82bb('0xa4')](_0x405c2b[_0x82bb('0x15a')]('[actionOriginateIvr]\x20',_0x5ccdf4));}}}}})[_0x82bb('0xa4')](loggerGetContactDialer(_0x82bb('0x209'),_0x5ccdf4,_0x4b65a7));}};Dialer[_0x82bb('0x85')]['handlePower']=function(_0x190cf7,_0x21a415){var _0x11a888=this;var _0x554032=[];if(_0x21a415<0x1||_0x190cf7['dialMethod']==='booked'){_0x21a415=0x1;}var _0x3536b2=Math[_0x82bb('0x1c4')](_0x190cf7[_0x82bb('0x13f')]*_0x21a415)-_0x190cf7[_0x82bb('0x7e')];if(_0x190cf7[_0x82bb('0x20a')]>0x0){var _0x24ee4d=_0x190cf7['dialLimitQueue']-_0x190cf7[_0x82bb('0x7e')]-_0x190cf7['talking']-_0x190cf7[_0x82bb('0x142')];if(_0x3536b2>_0x24ee4d){_0x3536b2=_0x24ee4d;}}if(_0x3536b2>0x0&&_0x190cf7[_0x82bb('0x200')]==0x0){if(_0x190cf7['dialMethod']===_0x82bb('0x20b')){_0x3536b2=0x1;}if(_0x3536b2>this['maxNumberOriginate']){_0x3536b2=this[_0x82bb('0x20')];}for(var _0x3b3a36 in this['agents']){if(typeof this[_0x82bb('0x1e')][_0x3b3a36]!=='undefined'){if(this[_0x82bb('0x1e')][_0x3b3a36]['state']===_0x82bb('0x20c')&&this[_0x82bb('0x1e')][_0x3b3a36]['status']===_0x82bb('0x14c')){_0x554032[_0x82bb('0x9d')](this['agents'][_0x3b3a36]['id']);}}}_0x190cf7[_0x82bb('0x200')]=0x1;hopperUtils[_0x82bb('0x20d')](_0x190cf7,_0x554032,_0x3536b2)['then'](function(_0x4b8a96){_0x190cf7[_0x82bb('0x200')]=0x0;if(_0x4b8a96){if(!utils['checkContactEmpty'](_0x4b8a96)){hopperUtils['countReScheduled'](_0x190cf7)['then'](sendMessageReschedule(_0x190cf7))[_0x82bb('0xa4')](loggerCatch('[countReScheduled]\x20'));}else{_0x190cf7[_0x82bb('0x7e')]+=_0x4b8a96[_0x82bb('0x9c')];_0x190cf7['message']=_0x190cf7[_0x82bb('0xb2')]===_0x82bb('0x20b')?utils[_0x82bb('0x65')][_0x82bb('0x143')]:utils[_0x82bb('0x65')][_0x82bb('0x204')];for(var _0x5e7ed2=0x0;_0x5e7ed2<_0x4b8a96[_0x82bb('0x9c')];_0x5e7ed2+=0x1){if(_[_0x82bb('0xf5')](_0x4b8a96[_0x5e7ed2])||_[_0x82bb('0xf5')](_0x4b8a96[_0x5e7ed2]['Contact'])||_[_0x82bb('0xf5')](_0x4b8a96[_0x5e7ed2][_0x82bb('0x163')])){_0x11a888['emptyContact']('[actionOriginate]\x20',_0x190cf7,_0x4b8a96[_0x5e7ed2]);}else{hopperUtils[_0x82bb('0x20e')](_['pick'](_0x4b8a96[_0x5e7ed2],['VoiceQueueId','phone']))[_0x82bb('0x3a')](_0x11a888[_0x82bb('0x208')](_0x190cf7,_0x4b8a96[_0x5e7ed2]))['catch'](_0x11a888[_0x82bb('0x15a')](_0x82bb('0x206'),_0x190cf7));}}}}})[_0x82bb('0xa4')](loggerGetContactDialer(_0x82bb('0x20f'),_0x190cf7,_0x3536b2));}};Dialer[_0x82bb('0x85')][_0x82bb('0x5f')]=function(_0xf44acf){if(_0xf44acf[_0x82bb('0x20a')]>0x0){var _0x31652a=_0xf44acf[_0x82bb('0x20a')]-_0xf44acf[_0x82bb('0x7e')]-_0xf44acf['talking'];if(_0x31652a>0x0&&_0xf44acf[_0x82bb('0x200')]==0x0){this[_0x82bb('0x210')](_0xf44acf);}else{loggerPredictiveCalls[_0x82bb('0x44')](_0x82bb('0x211'));}}else{this[_0x82bb('0x210')](_0xf44acf);}};Dialer[_0x82bb('0x85')][_0x82bb('0x210')]=function(_0x2e973f){var _0x51ac72=this;var _0x28a993=[];_0x2e973f[_0x82bb('0x7e')]+=0x1;for(var _0x4b82a2 in this[_0x82bb('0x1e')]){if(typeof this[_0x82bb('0x1e')][_0x4b82a2]!==_0x82bb('0xab')){if(this['agents'][_0x4b82a2][_0x82bb('0x6c')]===_0x82bb('0x20c')&&this[_0x82bb('0x1e')][_0x4b82a2]['status']===_0x82bb('0x14c')){_0x28a993[_0x82bb('0x9d')](this[_0x82bb('0x1e')][_0x4b82a2]['id']);}}}_0x2e973f[_0x82bb('0x200')]=0x1;return this[_0x82bb('0x20d')](_0x2e973f['id'],_0x28a993,0x1,_0x2e973f[_0x82bb('0x212')],_0x2e973f)[_0x82bb('0x3a')](function(_0x50f7ad){_0x2e973f[_0x82bb('0x200')]=0x1;if(_0x50f7ad){if(!utils[_0x82bb('0x202')](_0x50f7ad)){utils[_0x82bb('0x62')](_0x2e973f,0x1,0x0);return hopperUtils[_0x82bb('0x213')](_0x2e973f)['then'](sendMessageReschedule(_0x2e973f))[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x214')));}else{_0x2e973f[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x204')];if(_[_0x82bb('0xf5')](_0x50f7ad[0x0])||_[_0x82bb('0xf5')](_0x50f7ad[0x0][_0x82bb('0x17b')])||_[_0x82bb('0xf5')](_0x50f7ad[0x0]['phone'])){_0x51ac72[_0x82bb('0x215')](_0x82bb('0x206'),_0x2e973f,_0x50f7ad[0x0]);}else{return hopperUtils[_0x82bb('0x20e')](_[_0x82bb('0x72')](_0x50f7ad[0x0],['VoiceQueueId','phone']))[_0x82bb('0x3a')](_0x51ac72[_0x82bb('0x208')](_0x2e973f,_0x50f7ad[0x0]))[_0x82bb('0xa4')](_0x51ac72[_0x82bb('0x15a')]('[actionOriginatePredictive]\x20',_0x2e973f));}}}})[_0x82bb('0xa4')](loggerGetContactDialer(_0x82bb('0x216'),_0x2e973f,0x1));};Dialer[_0x82bb('0x85')][_0x82bb('0x1da')]=function(_0x2babbf,_0x33b2b0,_0x51be6d,_0x5232be,_0x453c15,_0x925c91){loggerPredictive[_0x82bb('0x44')](_0x82bb('0x217'));loggerPredictive[_0x82bb('0x44')](_0x82bb('0x218'),_0x2babbf);loggerPredictive[_0x82bb('0x44')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33b2b0);loggerPredictive['info'](_0x82bb('0x219'),_0x51be6d);loggerPredictive['info'](_0x82bb('0x21a'),_0x5232be);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x21b'),_0x453c15);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x59'));return new Promise(function(_0x26af1d,_0x2f52a3){if(_0x2babbf<=0x0||isNaN(_0x2babbf)){return _0x2f52a3(msgResponse('[abandonmentRate]',_0x82bb('0x84'),_0x82bb('0x21c')+_0x2babbf));}if(_0x51be6d<=0x0||isNaN(_0x51be6d)){return _0x2f52a3(msgResponse(_0x82bb('0x21d'),_0x82bb('0x84'),_0x82bb('0x21e')+_0x51be6d));}if(_0x5232be<=0x0||isNaN(_0x5232be)){return _0x2f52a3(msgResponse(_0x82bb('0x21d'),_0x82bb('0x84'),_0x82bb('0x21f')+_0x5232be));}if(_0x33b2b0<=0x0||isNaN(_0x33b2b0)){return _0x2f52a3(msgResponse(_0x82bb('0x21d'),'Error',_0x82bb('0x220')+_0x33b2b0));}if(_0x453c15<=0x0||isNaN(_0x453c15)){return _0x2f52a3(msgResponse(_0x82bb('0x21d'),_0x82bb('0x84'),_0x82bb('0x221')+_0x453c15));}_0x925c91=_0x925c91||0x0;var _0x5ccf36=0x1/_0x51be6d;var _0x3b507c=0x0;var _0x27808e=0x0;var _0x183580=0x0;var _0x3d68b2=0x0;for(var _0xc10333=0x0;_0x183580<_0x453c15;_0xc10333+=0x1){_0x27808e=_0xc10333/_0x33b2b0;_0x3b507c=(_0x5232be*_0x27808e+_0x925c91)/_0x5ccf36;_0x183580=utils[_0x82bb('0x222')](_0x3b507c,_0x2babbf);_0x3d68b2=_0x3b507c/_0x2babbf*(0x1-utils[_0x82bb('0x222')](_0x3b507c,_0x2babbf));}return _0x26af1d({'erlangCalls':_0xc10333,'erlangCallToSecond':_0x33b2b0/_0xc10333,'erlangAbandonmentRate':_0x183580,'erlangBusyFactor':_0x3d68b2});});};Dialer['prototype'][_0x82bb('0x223')]=function(_0x49df73,_0x1c1bbc,_0x5c2cda,_0x2e28c3,_0x97a3b0,_0x1acde1){loggerPredictive['info'](_0x82bb('0x224'));loggerPredictive['info'](_0x82bb('0x218'),_0x49df73);loggerPredictive[_0x82bb('0x44')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c1bbc);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x219'),_0x5c2cda);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x21a'),_0x2e28c3);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x225'),_0x97a3b0);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x59'));return new Promise(function(_0x1cb73e,_0x4bccaa){if(_0x49df73<=0x0||isNaN(_0x49df73)){return _0x4bccaa(msgResponse(_0x82bb('0x226'),_0x82bb('0x84'),_0x82bb('0x21c')+_0x49df73));}if(_0x5c2cda<=0x0||isNaN(_0x5c2cda)){return _0x4bccaa(msgResponse('[busyFactor]',_0x82bb('0x84'),_0x82bb('0x21e')+_0x5c2cda));}if(_0x2e28c3<=0x0||isNaN(_0x2e28c3)){return _0x4bccaa(msgResponse('[busyFactor]',_0x82bb('0x84'),_0x82bb('0x21f')+_0x2e28c3));}if(_0x1c1bbc<=0x0||isNaN(_0x1c1bbc)){return _0x4bccaa(msgResponse(_0x82bb('0x226'),_0x82bb('0x84'),_0x82bb('0x220')+_0x1c1bbc));}if(_0x97a3b0<=0x0||isNaN(_0x97a3b0)){return _0x4bccaa(msgResponse(_0x82bb('0x226'),_0x82bb('0x84'),'Umin\x20=\x20'+_0x97a3b0));}_0x1acde1=_0x1acde1||0x0;var _0x352c18=0x1/_0x5c2cda;var _0x4e58c9=0x0;var _0x3cfa0c=0x0;var _0x2b6c2b=0x0;var _0x2ff4a2=0x0;for(var _0x58dcd2=0x0;_0x2ff4a2<_0x97a3b0;_0x58dcd2+=0x1){_0x3cfa0c=_0x58dcd2/_0x1c1bbc;_0x4e58c9=(_0x2e28c3*_0x3cfa0c+_0x1acde1)/_0x352c18;_0x2b6c2b=utils[_0x82bb('0x222')](_0x4e58c9,_0x49df73);_0x2ff4a2=_0x4e58c9/_0x49df73*(0x1-utils[_0x82bb('0x222')](_0x4e58c9,_0x49df73));}return _0x1cb73e({'erlangCalls':_0x58dcd2,'erlangCallToSecond':_0x1c1bbc/_0x58dcd2,'erlangAbandonmentRate':_0x2b6c2b,'erlangBusyFactor':_0x2ff4a2});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index d36427b..17fa91e 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b75=['idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x55e059,_0x2df2c5){var _0x1e6bb7=function(_0x15799b){while(--_0x15799b){_0x55e059['push'](_0x55e059['shift']());}};_0x1e6bb7(++_0x2df2c5);}(_0x2b75,0x180));var _0x52b7=function(_0xb14bf0,_0x53485e){_0xb14bf0=_0xb14bf0-0x0;var _0x4743ed=_0x2b75[_0xb14bf0];return _0x4743ed;};'use strict';var util=require(_0x52b7('0x0'));var _=require(_0x52b7('0x1'));var moment=require(_0x52b7('0x2'));function checkNameSurname(_0x980110,_0x543198,_0x1aef21){var _0x156118='';if(!_[_0x52b7('0x3')](_0x543198)&&_0x52b7('0x4')===typeof _0x543198){_0x156118+=_0x543198;}if(!_['isNil'](_0x1aef21)&&_0x52b7('0x4')===typeof _0x1aef21){_0x156118+='\x20'+_0x1aef21;}if(_0x156118!==''){return _0x156118;}return _0x980110;}function Action(_0xe61f7b,_0x287be1,_0xf2a33){this[_0x52b7('0x5')]=_0xe61f7b;this[_0x52b7('0x6')]=_0xf2a33||undefined;this[_0x52b7('0x7')]=checkNameSurname(_0x287be1[_0x52b7('0x8')][_0x52b7('0x9')],_0x287be1[_0x52b7('0x8')][_0x52b7('0xa')],_0x287be1['Contact']['lastName']);this[_0x52b7('0xb')]=_0x287be1[_0x52b7('0x9')];this[_0x52b7('0xc')]=_0xe61f7b[_0x52b7('0x7')];this[_0x52b7('0xd')]=_0x287be1['active']||![];this['type']=_0xe61f7b[_0x52b7('0xe')];this[_0x52b7('0xf')]=_0xe61f7b[_0x52b7('0xf')]||0x3;this[_0x52b7('0x10')]=_0x287be1[_0x52b7('0x10')];this[_0x52b7('0x11')]=_0x287be1[_0x52b7('0x11')];this[_0x52b7('0x12')]=_0x287be1[_0x52b7('0x12')];this[_0x52b7('0x13')]=_0x287be1['countnoanswerretry'];this['countnosuchnumberretry']=_0x287be1[_0x52b7('0x14')];this[_0x52b7('0x15')]=_0x287be1[_0x52b7('0x15')];this[_0x52b7('0x16')]=_0x287be1[_0x52b7('0x16')];this['countmachineretry']=_0x287be1[_0x52b7('0x17')];this['countagentrejectretry']=_0x287be1[_0x52b7('0x18')];this[_0x52b7('0x19')]=_0x287be1[_0x52b7('0x19')];this[_0x52b7('0x1a')]=_0x287be1[_0x52b7('0x1a')];this['UserId']=_0x287be1[_0x52b7('0x1b')];this[_0x52b7('0x1c')]=_0x287be1[_0x52b7('0x1c')];this[_0x52b7('0x1d')]=_0x287be1[_0x52b7('0x1d')];this[_0x52b7('0x1e')]=_0x287be1['id'];this[_0x52b7('0x1f')]=_0x287be1['Contact'][_0x52b7('0xa')]||'';this[_0x52b7('0x20')]=moment()[_0x52b7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x52b7('0x22')]=_0x287be1['callback'];this[_0x52b7('0x23')]=_0x287be1[_0x52b7('0x23')];this[_0x52b7('0x24')]=_0x287be1['callbackat'];this[_0x52b7('0x25')]=_0x287be1['recallme'];this['originatecalleridnum']='';this[_0x52b7('0x26')]='';}Action[_0x52b7('0x27')][_0x52b7('0x28')]=function(){return util[_0x52b7('0x21')](_0x52b7('0x29'),this['name'],this['voiceQueue'][_0x52b7('0x2a')]>0x0?this[_0x52b7('0xb')][_0x52b7('0x2b')](this['voiceQueue'][_0x52b7('0x2a')]):this['number']);};Action['prototype'][_0x52b7('0x2c')]=function(){return this['queue'];};module[_0x52b7('0x2d')]=Action; \ No newline at end of file +var _0x709f=['\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller'];(function(_0x36558c,_0x3fb001){var _0x273208=function(_0xcb8afa){while(--_0xcb8afa){_0x36558c['push'](_0x36558c['shift']());}};_0x273208(++_0x3fb001);}(_0x709f,0xb9));var _0xf709=function(_0x36c87d,_0x2ab247){_0x36c87d=_0x36c87d-0x0;var _0x54dc55=_0x709f[_0x36c87d];return _0x54dc55;};'use strict';var util=require(_0xf709('0x0'));var _=require(_0xf709('0x1'));var moment=require(_0xf709('0x2'));function checkNameSurname(_0x1aac54,_0x2bcefe,_0x3069f3){var _0xf9a029='';if(!_[_0xf709('0x3')](_0x2bcefe)&&'string'===typeof _0x2bcefe){_0xf9a029+=_0x2bcefe;}if(!_[_0xf709('0x3')](_0x3069f3)&&_0xf709('0x4')===typeof _0x3069f3){_0xf9a029+='\x20'+_0x3069f3;}if(_0xf9a029!==''){return _0xf9a029;}return _0x1aac54;}function Action(_0x6b59d0,_0x2bd64a,_0x49f036){this[_0xf709('0x5')]=_0x6b59d0;this['uniqueid']=_0x49f036||undefined;this[_0xf709('0x6')]=checkNameSurname(_0x2bd64a[_0xf709('0x7')][_0xf709('0x8')],_0x2bd64a[_0xf709('0x7')][_0xf709('0x9')],_0x2bd64a[_0xf709('0x7')][_0xf709('0xa')]);this[_0xf709('0xb')]=_0x2bd64a[_0xf709('0x8')];this['queue']=_0x6b59d0[_0xf709('0x6')];this[_0xf709('0xc')]=_0x2bd64a['active']||![];this['type']=_0x6b59d0[_0xf709('0xd')];this[_0xf709('0xe')]=_0x6b59d0['dialQueueTimeout']||0x3;this[_0xf709('0xf')]=_0x2bd64a[_0xf709('0xf')];this['countbusyretry']=_0x2bd64a[_0xf709('0x10')];this[_0xf709('0x11')]=_0x2bd64a[_0xf709('0x11')];this[_0xf709('0x12')]=_0x2bd64a[_0xf709('0x12')];this['countnosuchnumberretry']=_0x2bd64a[_0xf709('0x13')];this['countdropretry']=_0x2bd64a[_0xf709('0x14')];this['countabandonedretry']=_0x2bd64a[_0xf709('0x15')];this[_0xf709('0x16')]=_0x2bd64a[_0xf709('0x16')];this[_0xf709('0x17')]=_0x2bd64a[_0xf709('0x17')];this[_0xf709('0x18')]=_0x2bd64a[_0xf709('0x18')];this['ListId']=_0x2bd64a['ListId'];this[_0xf709('0x19')]=_0x2bd64a[_0xf709('0x19')];this[_0xf709('0x1a')]=_0x2bd64a[_0xf709('0x1a')];this[_0xf709('0x1b')]=_0x2bd64a[_0xf709('0x1b')];this[_0xf709('0x1c')]=_0x2bd64a['id'];this[_0xf709('0x1d')]=_0x2bd64a[_0xf709('0x7')][_0xf709('0x9')]||'';this[_0xf709('0x1e')]=moment()[_0xf709('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf709('0x20')]=_0x2bd64a[_0xf709('0x20')];this['callbackuniqueid']=_0x2bd64a[_0xf709('0x21')];this[_0xf709('0x22')]=_0x2bd64a['callbackat'];this[_0xf709('0x23')]=_0x2bd64a['recallme'];this[_0xf709('0x24')]='';this[_0xf709('0x25')]='';}Action[_0xf709('0x26')][_0xf709('0x27')]=function(){return util[_0xf709('0x1f')](_0xf709('0x28'),this[_0xf709('0x6')],this[_0xf709('0x5')][_0xf709('0x29')]>0x0?this[_0xf709('0xb')][_0xf709('0x2a')](this['voiceQueue'][_0xf709('0x29')]):this[_0xf709('0xb')]);};Action['prototype'][_0xf709('0x2b')]=function(){return this[_0xf709('0x2c')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 8fb0af7..b0d7de7 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb968=['starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','holdtime','talktime','queue','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb968,0xe9));var _0x8b96=function(_0x1bda86,_0xa19e1){_0x1bda86=_0x1bda86-0x0;var _0x1abc6b=_0xb968[_0x1bda86];return _0x1abc6b;};'use strict';var moment=require(_0x8b96('0x0'));var utils=require('../utils');function AgentComplete(_0x10a9d0,_0x3d40ec){this['state']=0x4;this[_0x8b96('0x1')]='Answer';this[_0x8b96('0x2')]=_0x10a9d0['scheduledat'];this[_0x8b96('0x3')]=_0x10a9d0[_0x8b96('0x3')];this[_0x8b96('0x4')]=_0x10a9d0[_0x8b96('0x3')]==='outbound'?'queue':_0x10a9d0[_0x8b96('0x3')];this[_0x8b96('0x5')]=_0x10a9d0['countbusyretry'];this['countcongestionretry']=_0x10a9d0[_0x8b96('0x6')];this['countnoanswerretry']=_0x10a9d0['countnoanswerretry'];this[_0x8b96('0x7')]=_0x10a9d0['countbusyretry']+_0x10a9d0[_0x8b96('0x6')]+_0x10a9d0[_0x8b96('0x8')]+_0x10a9d0['countnosuchnumberretry']+_0x10a9d0[_0x8b96('0x9')]+_0x10a9d0[_0x8b96('0xa')]+_0x10a9d0[_0x8b96('0xb')]+_0x10a9d0['countagentrejectretry'];this[_0x8b96('0xc')]=_0x10a9d0[_0x8b96('0xc')];this['countdropretry']=_0x10a9d0['countdropretry'];this[_0x8b96('0xa')]=_0x10a9d0[_0x8b96('0xa')];this[_0x8b96('0xb')]=_0x10a9d0['countmachineretry'];this[_0x8b96('0xd')]=_0x10a9d0[_0x8b96('0xd')];this['uniqueid']=_0x3d40ec[_0x8b96('0xe')];this[_0x8b96('0xf')]=_0x10a9d0[_0x8b96('0x10')];this[_0x8b96('0x11')]=_0x10a9d0[_0x8b96('0x12')];this[_0x8b96('0x13')]=_0x10a9d0['starttime'];this[_0x8b96('0x14')]=_0x10a9d0['responsetime'];this[_0x8b96('0x15')]=_0x10a9d0[_0x8b96('0x15')];this[_0x8b96('0x16')]=moment()[_0x8b96('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8b96('0x18')]=utils[_0x8b96('0x19')](_0x10a9d0[_0x8b96('0x14')],_0x10a9d0[_0x8b96('0x13')]);this[_0x8b96('0x1a')]=utils[_0x8b96('0x19')](_0x10a9d0['answertime'],_0x10a9d0[_0x8b96('0x14')]);this[_0x8b96('0x1b')]=utils[_0x8b96('0x19')](this[_0x8b96('0x16')],_0x10a9d0['answertime']);this[_0x8b96('0x1c')]=_0x3d40ec[_0x8b96('0x1c')];this['membername']=_0x3d40ec['membername'];this[_0x8b96('0x1d')]=_0x3d40ec['reason'];this[_0x8b96('0x1e')]=_0x10a9d0[_0x8b96('0x1e')];this[_0x8b96('0x1f')]=_0x10a9d0[_0x8b96('0x1f')];this[_0x8b96('0x20')]=_0x10a9d0[_0x8b96('0x20')];this[_0x8b96('0x21')]=_0x10a9d0[_0x8b96('0x21')];this['ContactId']=_0x10a9d0['ContactId'];this[_0x8b96('0x22')]=_0x10a9d0['ListId'];this[_0x8b96('0x23')]=_0x10a9d0[_0x8b96('0x23')];this[_0x8b96('0x24')]=_0x10a9d0[_0x8b96('0x24')];this['CampaignId']=_0x10a9d0[_0x8b96('0x25')];this[_0x8b96('0x26')]=_0x10a9d0['originatecalleridnum']||'';this[_0x8b96('0x27')]=_0x10a9d0[_0x8b96('0x27')]||'';this['agiafterat']=_0x10a9d0[_0x8b96('0x28')];}module[_0x8b96('0x29')]=AgentComplete; \ No newline at end of file +var _0xaa59=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','scheduledat','campaigntype','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','ringtime','getSeconds'];(function(_0x39a5a4,_0x200ab1){var _0xe9ffd8=function(_0x100595){while(--_0x100595){_0x39a5a4['push'](_0x39a5a4['shift']());}};_0xe9ffd8(++_0x200ab1);}(_0xaa59,0x1ea));var _0x9aa5=function(_0x329543,_0x2e03ff){_0x329543=_0x329543-0x0;var _0x1cf066=_0xaa59[_0x329543];return _0x1cf066;};'use strict';var moment=require('moment');var utils=require(_0x9aa5('0x0'));function AgentComplete(_0x1e27f0,_0x480868){this[_0x9aa5('0x1')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x1e27f0[_0x9aa5('0x2')];this['type']=_0x1e27f0['type'];this[_0x9aa5('0x3')]=_0x1e27f0[_0x9aa5('0x4')]==='outbound'?_0x9aa5('0x5'):_0x1e27f0[_0x9aa5('0x4')];this[_0x9aa5('0x6')]=_0x1e27f0[_0x9aa5('0x6')];this['countcongestionretry']=_0x1e27f0[_0x9aa5('0x7')];this[_0x9aa5('0x8')]=_0x1e27f0['countnoanswerretry'];this[_0x9aa5('0x9')]=_0x1e27f0['countbusyretry']+_0x1e27f0[_0x9aa5('0x7')]+_0x1e27f0[_0x9aa5('0x8')]+_0x1e27f0[_0x9aa5('0xa')]+_0x1e27f0['countdropretry']+_0x1e27f0['countabandonedretry']+_0x1e27f0[_0x9aa5('0xb')]+_0x1e27f0['countagentrejectretry'];this['countnosuchnumberretry']=_0x1e27f0[_0x9aa5('0xa')];this[_0x9aa5('0xc')]=_0x1e27f0[_0x9aa5('0xc')];this[_0x9aa5('0xd')]=_0x1e27f0[_0x9aa5('0xd')];this[_0x9aa5('0xb')]=_0x1e27f0[_0x9aa5('0xb')];this[_0x9aa5('0xe')]=_0x1e27f0[_0x9aa5('0xe')];this[_0x9aa5('0xf')]=_0x480868[_0x9aa5('0xf')];this[_0x9aa5('0x10')]=_0x1e27f0[_0x9aa5('0x11')];this[_0x9aa5('0x12')]=_0x1e27f0[_0x9aa5('0x13')];this[_0x9aa5('0x14')]=_0x1e27f0['starttime'];this[_0x9aa5('0x15')]=_0x1e27f0[_0x9aa5('0x15')];this[_0x9aa5('0x16')]=_0x1e27f0[_0x9aa5('0x16')];this[_0x9aa5('0x17')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x9aa5('0x18')]=utils[_0x9aa5('0x19')](_0x1e27f0[_0x9aa5('0x15')],_0x1e27f0['starttime']);this[_0x9aa5('0x1a')]=utils[_0x9aa5('0x19')](_0x1e27f0[_0x9aa5('0x16')],_0x1e27f0[_0x9aa5('0x15')]);this[_0x9aa5('0x1b')]=utils[_0x9aa5('0x19')](this[_0x9aa5('0x17')],_0x1e27f0[_0x9aa5('0x16')]);this[_0x9aa5('0x5')]=_0x480868[_0x9aa5('0x5')];this[_0x9aa5('0x1c')]=_0x480868[_0x9aa5('0x1c')];this[_0x9aa5('0x1d')]=_0x480868['reason'];this[_0x9aa5('0x1e')]=_0x1e27f0[_0x9aa5('0x1e')];this[_0x9aa5('0x1f')]=_0x1e27f0[_0x9aa5('0x1f')];this[_0x9aa5('0x20')]=_0x1e27f0[_0x9aa5('0x20')];this[_0x9aa5('0x21')]=_0x1e27f0[_0x9aa5('0x21')];this[_0x9aa5('0x22')]=_0x1e27f0[_0x9aa5('0x22')];this[_0x9aa5('0x23')]=_0x1e27f0['ListId'];this['UserId']=_0x1e27f0[_0x9aa5('0x24')];this[_0x9aa5('0x25')]=_0x1e27f0['VoiceQueueId'];this['CampaignId']=_0x1e27f0[_0x9aa5('0x26')];this[_0x9aa5('0x27')]=_0x1e27f0[_0x9aa5('0x27')]||'';this[_0x9aa5('0x28')]=_0x1e27f0[_0x9aa5('0x28')]||'';this[_0x9aa5('0x29')]=_0x1e27f0[_0x9aa5('0x29')];}module[_0x9aa5('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index a8fb9c3..8f87cad 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6b3=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countnoanswerretry','countglobal','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime'];(function(_0x4cf555,_0x37dddd){var _0x216497=function(_0x3af113){while(--_0x3af113){_0x4cf555['push'](_0x4cf555['shift']());}};_0x216497(++_0x37dddd);}(_0xc6b3,0x113));var _0x3c6b=function(_0x5c2bef,_0x16806e){_0x5c2bef=_0x5c2bef-0x0;var _0xd60cc1=_0xc6b3[_0x5c2bef];return _0xd60cc1;};'use strict';function Final(_0x366a31){this[_0x3c6b('0x0')]=_0x366a31['uniqueid'];this[_0x3c6b('0x1')]=_0x366a31['scheduledat'];this['type']=_0x366a31[_0x3c6b('0x2')];this[_0x3c6b('0x3')]=_0x366a31['type']===_0x3c6b('0x4')?'queue':_0x366a31[_0x3c6b('0x2')];this['countbusyretry']=_0x366a31['countbusyretry'];this['countcongestionretry']=_0x366a31['countcongestionretry'];this[_0x3c6b('0x5')]=_0x366a31[_0x3c6b('0x5')];this[_0x3c6b('0x6')]=_0x366a31[_0x3c6b('0x7')]+_0x366a31[_0x3c6b('0x8')]+_0x366a31[_0x3c6b('0x5')]+_0x366a31['countnosuchnumberretry']+_0x366a31[_0x3c6b('0x9')]+_0x366a31[_0x3c6b('0xa')]+_0x366a31[_0x3c6b('0xb')]+_0x366a31[_0x3c6b('0xc')];this['countnosuchnumberretry']=_0x366a31[_0x3c6b('0xd')];this['countdropretry']=_0x366a31[_0x3c6b('0x9')];this['countabandonedretry']=_0x366a31[_0x3c6b('0xa')];this['countmachineretry']=_0x366a31[_0x3c6b('0xb')];this[_0x3c6b('0xc')]=_0x366a31[_0x3c6b('0xc')];this[_0x3c6b('0xe')]=_0x366a31[_0x3c6b('0xe')];this[_0x3c6b('0xf')]=_0x366a31[_0x3c6b('0xf')];this[_0x3c6b('0x10')]=_0x366a31['calleridnum'];this[_0x3c6b('0x11')]=_0x366a31[_0x3c6b('0x11')];this[_0x3c6b('0x12')]=_0x366a31[_0x3c6b('0x12')];this[_0x3c6b('0x13')]=_0x366a31[_0x3c6b('0x12')];this[_0x3c6b('0x14')]=_0x366a31[_0x3c6b('0x14')]||0x0;this[_0x3c6b('0x15')]=_0x366a31['holdtime']||0x0;this[_0x3c6b('0x16')]=_0x366a31['talktime']||0x0;this[_0x3c6b('0x17')]=_0x366a31[_0x3c6b('0x17')];this[_0x3c6b('0x18')]=_0x366a31['callbackuniqueid'];this[_0x3c6b('0x19')]=_0x366a31[_0x3c6b('0x19')];this['recallme']=_0x366a31[_0x3c6b('0x1a')];this[_0x3c6b('0x1b')]=_0x366a31['ContactId'];this['ListId']=_0x366a31[_0x3c6b('0x1c')];this['UserId']=_0x366a31[_0x3c6b('0x1d')];this[_0x3c6b('0x1e')]=_0x366a31[_0x3c6b('0x1e')];this[_0x3c6b('0x1f')]=_0x366a31[_0x3c6b('0x1f')];this['originatecalleridnum']=_0x366a31[_0x3c6b('0x20')]||'';this[_0x3c6b('0x21')]=_0x366a31[_0x3c6b('0x21')]||'';this[_0x3c6b('0x22')]=_0x366a31[_0x3c6b('0x22')];this[_0x3c6b('0x23')]=_0x366a31[_0x3c6b('0x23')];}module[_0x3c6b('0x24')]=Final; \ No newline at end of file +var _0x5be4=['countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','countcongestionretry'];(function(_0xe5cdb3,_0x16dd7a){var _0x4ce3c7=function(_0x454bbe){while(--_0x454bbe){_0xe5cdb3['push'](_0xe5cdb3['shift']());}};_0x4ce3c7(++_0x16dd7a);}(_0x5be4,0x162));var _0x45be=function(_0xb8e996,_0x5df044){_0xb8e996=_0xb8e996-0x0;var _0xea66d=_0x5be4[_0xb8e996];return _0xea66d;};'use strict';function Final(_0x40e9f6){this['uniqueid']=_0x40e9f6[_0x45be('0x0')];this['scheduledat']=_0x40e9f6[_0x45be('0x1')];this[_0x45be('0x2')]=_0x40e9f6[_0x45be('0x2')];this[_0x45be('0x3')]=_0x40e9f6[_0x45be('0x2')]===_0x45be('0x4')?'queue':_0x40e9f6[_0x45be('0x2')];this['countbusyretry']=_0x40e9f6['countbusyretry'];this[_0x45be('0x5')]=_0x40e9f6[_0x45be('0x5')];this[_0x45be('0x6')]=_0x40e9f6[_0x45be('0x6')];this[_0x45be('0x7')]=_0x40e9f6[_0x45be('0x8')]+_0x40e9f6[_0x45be('0x5')]+_0x40e9f6['countnoanswerretry']+_0x40e9f6[_0x45be('0x9')]+_0x40e9f6['countdropretry']+_0x40e9f6[_0x45be('0xa')]+_0x40e9f6[_0x45be('0xb')]+_0x40e9f6[_0x45be('0xc')];this['countnosuchnumberretry']=_0x40e9f6['countnosuchnumberretry'];this['countdropretry']=_0x40e9f6[_0x45be('0xd')];this[_0x45be('0xa')]=_0x40e9f6[_0x45be('0xa')];this[_0x45be('0xb')]=_0x40e9f6['countmachineretry'];this[_0x45be('0xc')]=_0x40e9f6[_0x45be('0xc')];this[_0x45be('0xe')]=_0x40e9f6[_0x45be('0xe')];this['calleridname']=_0x40e9f6[_0x45be('0xf')];this[_0x45be('0x10')]=_0x40e9f6[_0x45be('0x10')];this[_0x45be('0x11')]=_0x40e9f6[_0x45be('0x11')];this['responsetime']=_0x40e9f6[_0x45be('0x12')];this[_0x45be('0x13')]=_0x40e9f6[_0x45be('0x12')];this[_0x45be('0x14')]=_0x40e9f6[_0x45be('0x14')]||0x0;this[_0x45be('0x15')]=_0x40e9f6[_0x45be('0x15')]||0x0;this[_0x45be('0x16')]=_0x40e9f6[_0x45be('0x16')]||0x0;this['callback']=_0x40e9f6[_0x45be('0x17')];this[_0x45be('0x18')]=_0x40e9f6['callbackuniqueid'];this[_0x45be('0x19')]=_0x40e9f6[_0x45be('0x19')];this[_0x45be('0x1a')]=_0x40e9f6[_0x45be('0x1a')];this[_0x45be('0x1b')]=_0x40e9f6[_0x45be('0x1b')];this[_0x45be('0x1c')]=_0x40e9f6['ListId'];this[_0x45be('0x1d')]=_0x40e9f6[_0x45be('0x1d')];this[_0x45be('0x1e')]=_0x40e9f6['VoiceQueueId'];this[_0x45be('0x1f')]=_0x40e9f6[_0x45be('0x1f')];this[_0x45be('0x20')]=_0x40e9f6['originatecalleridnum']||'';this[_0x45be('0x21')]=_0x40e9f6[_0x45be('0x21')]||'';this[_0x45be('0x22')]=_0x40e9f6[_0x45be('0x22')];this['statedesc']=_0x40e9f6[_0x45be('0x23')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index ca07a2a..35ba9b3 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62f8=['getSeconds','talktime','endtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x2fef92,_0x153cf8){var _0x47749f=function(_0x474282){while(--_0x474282){_0x2fef92['push'](_0x2fef92['shift']());}};_0x47749f(++_0x153cf8);}(_0x62f8,0xab));var _0x862f=function(_0x23a9ab,_0xaf9122){_0x23a9ab=_0x23a9ab-0x0;var _0x16d76c=_0x62f8[_0x23a9ab];return _0x16d76c;};'use strict';var moment=require(_0x862f('0x0'));var utils=require('../utils');function Hangup(_0x3171f9,_0x37231a){this['state']=0x4;this[_0x862f('0x1')]=_0x862f('0x2');this['scheduledat']=_0x3171f9[_0x862f('0x3')];this[_0x862f('0x4')]=_0x3171f9[_0x862f('0x4')];this[_0x862f('0x5')]=_0x3171f9[_0x862f('0x4')]===_0x862f('0x6')?_0x862f('0x7'):_0x3171f9[_0x862f('0x4')];this[_0x862f('0x8')]=_0x3171f9[_0x862f('0x8')]||![];this['countbusyretry']=_0x3171f9[_0x862f('0x9')];this[_0x862f('0xa')]=_0x3171f9[_0x862f('0xa')];this[_0x862f('0xb')]=_0x3171f9[_0x862f('0xb')];this[_0x862f('0xc')]=_0x3171f9[_0x862f('0x9')]+_0x3171f9['countcongestionretry']+_0x3171f9[_0x862f('0xb')]+_0x3171f9[_0x862f('0xd')]+_0x3171f9[_0x862f('0xe')]+_0x3171f9[_0x862f('0xf')]+_0x3171f9[_0x862f('0x10')]+_0x3171f9[_0x862f('0x11')];this[_0x862f('0xd')]=_0x3171f9[_0x862f('0xd')];this['countdropretry']=_0x3171f9[_0x862f('0xe')];this[_0x862f('0xf')]=_0x3171f9[_0x862f('0xf')];this[_0x862f('0x10')]=_0x3171f9[_0x862f('0x10')];this[_0x862f('0x11')]=_0x3171f9[_0x862f('0x11')];this[_0x862f('0x12')]=_0x37231a[_0x862f('0x12')];this[_0x862f('0x13')]=_0x3171f9['name'];this['calleridnum']=_0x3171f9['number'];this[_0x862f('0x14')]=_0x3171f9[_0x862f('0x14')];this[_0x862f('0x15')]=_0x3171f9[_0x862f('0x15')];this['endtime']=moment()['format'](_0x862f('0x16'));this[_0x862f('0x17')]=utils[_0x862f('0x18')](_0x3171f9[_0x862f('0x15')],_0x3171f9[_0x862f('0x14')]);this['holdtime']=0x0;this[_0x862f('0x19')]=utils[_0x862f('0x18')](this[_0x862f('0x1a')],_0x3171f9[_0x862f('0x15')]);this[_0x862f('0x7')]=_0x3171f9[_0x862f('0x7')];this['membername']=_0x862f('0x1b');this[_0x862f('0x1c')]=_0x37231a[_0x862f('0x1d')];this[_0x862f('0x1e')]=_0x3171f9[_0x862f('0x1e')];this[_0x862f('0x1f')]=_0x3171f9['callbackuniqueid'];this[_0x862f('0x20')]=_0x3171f9[_0x862f('0x20')];this[_0x862f('0x21')]=_0x3171f9[_0x862f('0x21')];this[_0x862f('0x22')]=_0x3171f9[_0x862f('0x22')];this[_0x862f('0x23')]=_0x3171f9[_0x862f('0x23')];this[_0x862f('0x24')]=_0x3171f9['UserId'];this[_0x862f('0x25')]=_0x3171f9['VoiceQueueId'];this[_0x862f('0x26')]=_0x3171f9[_0x862f('0x26')];}module['exports']=Hangup; \ No newline at end of file +var _0x0d70=['responsetime','endtime','ringtime','getSeconds','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime'];(function(_0x54c926,_0x3880cb){var _0x4805d8=function(_0x66d1aa){while(--_0x66d1aa){_0x54c926['push'](_0x54c926['shift']());}};_0x4805d8(++_0x3880cb);}(_0x0d70,0x91));var _0x00d7=function(_0x859f36,_0x30dffb){_0x859f36=_0x859f36-0x0;var _0x35107b=_0x0d70[_0x859f36];return _0x35107b;};'use strict';var moment=require(_0x00d7('0x0'));var utils=require('../utils');function Hangup(_0x56cab8,_0x4c4580){this[_0x00d7('0x1')]=0x4;this[_0x00d7('0x2')]=_0x00d7('0x3');this[_0x00d7('0x4')]=_0x56cab8['scheduledat'];this['type']=_0x56cab8[_0x00d7('0x5')];this[_0x00d7('0x6')]=_0x56cab8[_0x00d7('0x5')]===_0x00d7('0x7')?_0x00d7('0x8'):_0x56cab8['type'];this[_0x00d7('0x9')]=_0x56cab8[_0x00d7('0x9')]||![];this['countbusyretry']=_0x56cab8[_0x00d7('0xa')];this[_0x00d7('0xb')]=_0x56cab8[_0x00d7('0xb')];this['countnoanswerretry']=_0x56cab8[_0x00d7('0xc')];this[_0x00d7('0xd')]=_0x56cab8[_0x00d7('0xa')]+_0x56cab8[_0x00d7('0xb')]+_0x56cab8[_0x00d7('0xc')]+_0x56cab8[_0x00d7('0xe')]+_0x56cab8[_0x00d7('0xf')]+_0x56cab8[_0x00d7('0x10')]+_0x56cab8[_0x00d7('0x11')]+_0x56cab8[_0x00d7('0x12')];this['countnosuchnumberretry']=_0x56cab8['countnosuchnumberretry'];this[_0x00d7('0xf')]=_0x56cab8[_0x00d7('0xf')];this['countabandonedretry']=_0x56cab8[_0x00d7('0x10')];this[_0x00d7('0x11')]=_0x56cab8['countmachineretry'];this[_0x00d7('0x12')]=_0x56cab8[_0x00d7('0x12')];this[_0x00d7('0x13')]=_0x4c4580[_0x00d7('0x13')];this['calleridname']=_0x56cab8[_0x00d7('0x14')];this[_0x00d7('0x15')]=_0x56cab8['number'];this[_0x00d7('0x16')]=_0x56cab8[_0x00d7('0x16')];this['responsetime']=_0x56cab8[_0x00d7('0x17')];this[_0x00d7('0x18')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x00d7('0x19')]=utils[_0x00d7('0x1a')](_0x56cab8['responsetime'],_0x56cab8[_0x00d7('0x16')]);this[_0x00d7('0x1b')]=0x0;this['talktime']=utils[_0x00d7('0x1a')](this['endtime'],_0x56cab8['responsetime']);this['queue']=_0x56cab8[_0x00d7('0x8')];this[_0x00d7('0x1c')]=_0x00d7('0x1d');this[_0x00d7('0x1e')]=_0x4c4580[_0x00d7('0x1f')];this[_0x00d7('0x20')]=_0x56cab8[_0x00d7('0x20')];this['callbackuniqueid']=_0x56cab8[_0x00d7('0x21')];this[_0x00d7('0x22')]=_0x56cab8[_0x00d7('0x22')];this['recallme']=_0x56cab8[_0x00d7('0x23')];this[_0x00d7('0x24')]=_0x56cab8[_0x00d7('0x24')];this[_0x00d7('0x25')]=_0x56cab8[_0x00d7('0x25')];this[_0x00d7('0x26')]=_0x56cab8[_0x00d7('0x26')];this[_0x00d7('0x27')]=_0x56cab8['VoiceQueueId'];this[_0x00d7('0x28')]=_0x56cab8['CampaignId'];}module[_0x00d7('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index a999907..7004f2c 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae3d=['countmachineretry','countagentrejectretry','calleridname','number','starttime','responsetime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countnosuchnumberretry'];(function(_0x2bf8fe,_0x657518){var _0x456632=function(_0x162ff6){while(--_0x162ff6){_0x2bf8fe['push'](_0x2bf8fe['shift']());}};_0x456632(++_0x657518);}(_0xae3d,0x1d0));var _0xdae3=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xae3d[_0x35da42];return _0x370035;};'use strict';var utils=require('../utils');function History(_0x539418){this['uniqueid']=_0x539418[_0xdae3('0x0')];this[_0xdae3('0x1')]=_0x539418[_0xdae3('0x1')]||undefined;this[_0xdae3('0x2')]=_0x539418[_0xdae3('0x2')];this[_0xdae3('0x3')]=_0x539418[_0xdae3('0x2')]==='outbound'?_0xdae3('0x4'):_0x539418['type'];this[_0xdae3('0x5')]=_0x539418[_0xdae3('0x5')];this[_0xdae3('0x6')]=_0x539418[_0xdae3('0x6')];this['countnoanswerretry']=_0x539418['countnoanswerretry'];this[_0xdae3('0x7')]=_0x539418[_0xdae3('0x5')]+_0x539418[_0xdae3('0x6')]+_0x539418[_0xdae3('0x8')]+_0x539418['countnosuchnumberretry']+_0x539418[_0xdae3('0x9')]+_0x539418[_0xdae3('0xa')]+_0x539418['countmachineretry']+_0x539418['countagentrejectretry'];this[_0xdae3('0xb')]=_0x539418['countnosuchnumberretry'];this['countdropretry']=_0x539418[_0xdae3('0x9')];this[_0xdae3('0xa')]=_0x539418['countabandonedretry'];this[_0xdae3('0xc')]=_0x539418[_0xdae3('0xc')];this[_0xdae3('0xd')]=_0x539418[_0xdae3('0xd')];this[_0xdae3('0x4')]=_0x539418[_0xdae3('0x4')];this[_0xdae3('0xe')]=_0x539418['name'];this['calleridnum']=_0x539418[_0xdae3('0xf')];this[_0xdae3('0x10')]=_0x539418[_0xdae3('0x10')];this['responsetime']=_0x539418[_0xdae3('0x11')];this['endtime']=_0x539418[_0xdae3('0x11')];this['ringtime']=utils[_0xdae3('0x12')](_0x539418[_0xdae3('0x11')],_0x539418[_0xdae3('0x10')]);this[_0xdae3('0x13')]=0x0;this[_0xdae3('0x14')]=0x0;this[_0xdae3('0x15')]=_0x539418['callback'];this[_0xdae3('0x16')]=_0x539418[_0xdae3('0x16')];this[_0xdae3('0x17')]=_0x539418[_0xdae3('0x17')];this[_0xdae3('0x18')]=_0x539418[_0xdae3('0x18')];this[_0xdae3('0x19')]=_0x539418[_0xdae3('0x19')];this[_0xdae3('0x1a')]=_0x539418[_0xdae3('0x1a')];this[_0xdae3('0x1b')]=_0x539418[_0xdae3('0x1b')];this[_0xdae3('0x1c')]=_0x539418[_0xdae3('0x1c')];this['CampaignId']=_0x539418['CampaignId'];this[_0xdae3('0x1d')]=_0x539418[_0xdae3('0x1d')]||'';this[_0xdae3('0x1e')]=_0x539418[_0xdae3('0x1e')]||'';this[_0xdae3('0x1f')]=_0x539418[_0xdae3('0x1f')];this['statedesc']=_0x539418[_0xdae3('0x20')];}module[_0xdae3('0x21')]=History; \ No newline at end of file +var _0xa7af=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','../utils','uniqueid','scheduledat','type','campaigntype'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa7af,0x6a));var _0xfa7a=function(_0x2c75b7,_0x1b0bb9){_0x2c75b7=_0x2c75b7-0x0;var _0x3c8f91=_0xa7af[_0x2c75b7];return _0x3c8f91;};'use strict';var utils=require(_0xfa7a('0x0'));function History(_0x122c9f){this['uniqueid']=_0x122c9f[_0xfa7a('0x1')];this[_0xfa7a('0x2')]=_0x122c9f['scheduledat']||undefined;this[_0xfa7a('0x3')]=_0x122c9f[_0xfa7a('0x3')];this[_0xfa7a('0x4')]=_0x122c9f['type']===_0xfa7a('0x5')?_0xfa7a('0x6'):_0x122c9f[_0xfa7a('0x3')];this[_0xfa7a('0x7')]=_0x122c9f[_0xfa7a('0x7')];this['countcongestionretry']=_0x122c9f[_0xfa7a('0x8')];this[_0xfa7a('0x9')]=_0x122c9f[_0xfa7a('0x9')];this[_0xfa7a('0xa')]=_0x122c9f[_0xfa7a('0x7')]+_0x122c9f[_0xfa7a('0x8')]+_0x122c9f[_0xfa7a('0x9')]+_0x122c9f['countnosuchnumberretry']+_0x122c9f['countdropretry']+_0x122c9f[_0xfa7a('0xb')]+_0x122c9f['countmachineretry']+_0x122c9f[_0xfa7a('0xc')];this['countnosuchnumberretry']=_0x122c9f[_0xfa7a('0xd')];this[_0xfa7a('0xe')]=_0x122c9f[_0xfa7a('0xe')];this[_0xfa7a('0xb')]=_0x122c9f[_0xfa7a('0xb')];this[_0xfa7a('0xf')]=_0x122c9f[_0xfa7a('0xf')];this['countagentrejectretry']=_0x122c9f[_0xfa7a('0xc')];this['queue']=_0x122c9f[_0xfa7a('0x6')];this[_0xfa7a('0x10')]=_0x122c9f[_0xfa7a('0x11')];this[_0xfa7a('0x12')]=_0x122c9f[_0xfa7a('0x13')];this['starttime']=_0x122c9f[_0xfa7a('0x14')];this[_0xfa7a('0x15')]=_0x122c9f[_0xfa7a('0x15')];this[_0xfa7a('0x16')]=_0x122c9f[_0xfa7a('0x15')];this[_0xfa7a('0x17')]=utils['getSeconds'](_0x122c9f['responsetime'],_0x122c9f[_0xfa7a('0x14')]);this['holdtime']=0x0;this[_0xfa7a('0x18')]=0x0;this['callback']=_0x122c9f[_0xfa7a('0x19')];this['callbackuniqueid']=_0x122c9f[_0xfa7a('0x1a')];this[_0xfa7a('0x1b')]=_0x122c9f[_0xfa7a('0x1b')];this[_0xfa7a('0x1c')]=_0x122c9f[_0xfa7a('0x1c')];this[_0xfa7a('0x1d')]=_0x122c9f[_0xfa7a('0x1d')];this['ListId']=_0x122c9f['ListId'];this['UserId']=_0x122c9f[_0xfa7a('0x1e')];this[_0xfa7a('0x1f')]=_0x122c9f[_0xfa7a('0x1f')];this[_0xfa7a('0x20')]=_0x122c9f[_0xfa7a('0x20')];this[_0xfa7a('0x21')]=_0x122c9f[_0xfa7a('0x21')]||'';this[_0xfa7a('0x22')]=_0x122c9f[_0xfa7a('0x22')]||'';this[_0xfa7a('0x23')]=_0x122c9f[_0xfa7a('0x23')];this['statedesc']=_0x122c9f['statedesc'];}module[_0xfa7a('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index ad27612..7bc0dd8 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3440=['countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','droptime','dropreason','endtime','ringtime','getSeconds','responsetime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue','countcongestionretry'];(function(_0x3fc642,_0x2f77b2){var _0x3e8a47=function(_0x3b0529){while(--_0x3b0529){_0x3fc642['push'](_0x3fc642['shift']());}};_0x3e8a47(++_0x2f77b2);}(_0x3440,0x18e));var _0x0344=function(_0x45c4a7,_0x54093f){_0x45c4a7=_0x45c4a7-0x0;var _0xfa3b3f=_0x3440[_0x45c4a7];return _0xfa3b3f;};'use strict';var utils=require(_0x0344('0x0'));function QueueCallerAbandon(_0x290a77,_0x3b2f05){this[_0x0344('0x1')]=_0x290a77[_0x0344('0x1')];this[_0x0344('0x2')]=_0x290a77['type'];this[_0x0344('0x3')]=_0x290a77['type']===_0x0344('0x4')?_0x0344('0x5'):_0x290a77[_0x0344('0x2')];this['countbusyretry']=_0x290a77['countbusyretry'];this[_0x0344('0x6')]=_0x290a77[_0x0344('0x6')];this[_0x0344('0x7')]=_0x290a77[_0x0344('0x7')];this[_0x0344('0x8')]=_0x290a77[_0x0344('0x9')]+_0x290a77['countcongestionretry']+_0x290a77[_0x0344('0x7')]+_0x290a77['countnosuchnumberretry']+_0x290a77[_0x0344('0xa')]+_0x290a77[_0x0344('0xb')]+_0x290a77[_0x0344('0xc')]+_0x290a77[_0x0344('0xd')];this[_0x0344('0xe')]=_0x290a77['countnosuchnumberretry'];this[_0x0344('0xa')]=_0x290a77[_0x0344('0xa')];this[_0x0344('0xb')]=_0x290a77[_0x0344('0xb')];this[_0x0344('0xc')]=_0x290a77[_0x0344('0xc')];this[_0x0344('0xd')]=_0x290a77[_0x0344('0xd')];this[_0x0344('0xf')]=_0x3b2f05[_0x0344('0xf')];this[_0x0344('0x10')]=_0x290a77[_0x0344('0x11')];this[_0x0344('0x12')]=_0x290a77[_0x0344('0x13')];this[_0x0344('0x14')]=_0x290a77['starttime'];this['responsetime']=_0x290a77['responsetime'];this[_0x0344('0x15')]=_0x290a77[_0x0344('0x15')];this[_0x0344('0x16')]=_0x290a77['dropreason'];this[_0x0344('0x17')]=this[_0x0344('0x15')];this[_0x0344('0x18')]=utils[_0x0344('0x19')](_0x290a77[_0x0344('0x1a')],_0x290a77['starttime']);this[_0x0344('0x1b')]=utils[_0x0344('0x19')](this['droptime'],_0x290a77[_0x0344('0x1a')]);this[_0x0344('0x1c')]=0x0;this['queue']=_0x3b2f05[_0x0344('0x5')];this['membername']=_0x3b2f05[_0x0344('0x1d')];this[_0x0344('0x1e')]=_0x3b2f05['reason'];this[_0x0344('0x1f')]=_0x290a77[_0x0344('0x1f')];this[_0x0344('0x20')]=_0x290a77[_0x0344('0x20')];this[_0x0344('0x21')]=_0x290a77[_0x0344('0x21')];this[_0x0344('0x22')]=_0x290a77['recallme'];this['ContactId']=_0x290a77[_0x0344('0x23')];this[_0x0344('0x24')]=_0x290a77[_0x0344('0x24')];this['UserId']=_0x290a77[_0x0344('0x25')];this[_0x0344('0x26')]=_0x290a77[_0x0344('0x26')];this['CampaignId']=_0x290a77[_0x0344('0x27')];this[_0x0344('0x28')]=_0x290a77[_0x0344('0x28')]||'';this[_0x0344('0x29')]=_0x290a77['originatecalleridname']||'';this['agiafterat']=_0x290a77[_0x0344('0x2a')];this['state']=_0x290a77[_0x0344('0x2b')];this[_0x0344('0x2c')]=_0x290a77[_0x0344('0x2c')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xbf9f=['number','starttime','responsetime','droptime','dropreason','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum'];(function(_0x1365c0,_0x10bd93){var _0x106612=function(_0x1c67fb){while(--_0x1c67fb){_0x1365c0['push'](_0x1365c0['shift']());}};_0x106612(++_0x10bd93);}(_0xbf9f,0x97));var _0xfbf9=function(_0xf93a2f,_0xc2b785){_0xf93a2f=_0xf93a2f-0x0;var _0x5f0741=_0xbf9f[_0xf93a2f];return _0x5f0741;};'use strict';var utils=require(_0xfbf9('0x0'));function QueueCallerAbandon(_0x11cf17,_0x556fc7){this[_0xfbf9('0x1')]=_0x11cf17[_0xfbf9('0x1')];this[_0xfbf9('0x2')]=_0x11cf17['type'];this[_0xfbf9('0x3')]=_0x11cf17[_0xfbf9('0x2')]===_0xfbf9('0x4')?_0xfbf9('0x5'):_0x11cf17['type'];this['countbusyretry']=_0x11cf17[_0xfbf9('0x6')];this[_0xfbf9('0x7')]=_0x11cf17[_0xfbf9('0x7')];this[_0xfbf9('0x8')]=_0x11cf17[_0xfbf9('0x8')];this['countglobal']=_0x11cf17[_0xfbf9('0x6')]+_0x11cf17[_0xfbf9('0x7')]+_0x11cf17[_0xfbf9('0x8')]+_0x11cf17[_0xfbf9('0x9')]+_0x11cf17[_0xfbf9('0xa')]+_0x11cf17[_0xfbf9('0xb')]+_0x11cf17[_0xfbf9('0xc')]+_0x11cf17['countagentrejectretry'];this[_0xfbf9('0x9')]=_0x11cf17[_0xfbf9('0x9')];this['countdropretry']=_0x11cf17[_0xfbf9('0xa')];this[_0xfbf9('0xb')]=_0x11cf17['countabandonedretry'];this[_0xfbf9('0xc')]=_0x11cf17[_0xfbf9('0xc')];this[_0xfbf9('0xd')]=_0x11cf17['countagentrejectretry'];this['uniqueid']=_0x556fc7[_0xfbf9('0xe')];this['calleridname']=_0x11cf17[_0xfbf9('0xf')];this[_0xfbf9('0x10')]=_0x11cf17[_0xfbf9('0x11')];this[_0xfbf9('0x12')]=_0x11cf17['starttime'];this[_0xfbf9('0x13')]=_0x11cf17[_0xfbf9('0x13')];this[_0xfbf9('0x14')]=_0x11cf17[_0xfbf9('0x14')];this['dropreason']=_0x11cf17[_0xfbf9('0x15')];this['endtime']=this['droptime'];this['ringtime']=utils[_0xfbf9('0x16')](_0x11cf17[_0xfbf9('0x13')],_0x11cf17['starttime']);this[_0xfbf9('0x17')]=utils['getSeconds'](this['droptime'],_0x11cf17['responsetime']);this[_0xfbf9('0x18')]=0x0;this['queue']=_0x556fc7[_0xfbf9('0x5')];this['membername']=_0x556fc7[_0xfbf9('0x19')];this['reason']=_0x556fc7[_0xfbf9('0x1a')];this[_0xfbf9('0x1b')]=_0x11cf17['callback'];this[_0xfbf9('0x1c')]=_0x11cf17[_0xfbf9('0x1c')];this[_0xfbf9('0x1d')]=_0x11cf17['callbackat'];this[_0xfbf9('0x1e')]=_0x11cf17['recallme'];this[_0xfbf9('0x1f')]=_0x11cf17['ContactId'];this[_0xfbf9('0x20')]=_0x11cf17['ListId'];this['UserId']=_0x11cf17[_0xfbf9('0x21')];this[_0xfbf9('0x22')]=_0x11cf17[_0xfbf9('0x22')];this['CampaignId']=_0x11cf17[_0xfbf9('0x23')];this['originatecalleridnum']=_0x11cf17[_0xfbf9('0x24')]||'';this[_0xfbf9('0x25')]=_0x11cf17[_0xfbf9('0x25')]||'';this['agiafterat']=_0x11cf17[_0xfbf9('0x26')];this['state']=_0x11cf17[_0xfbf9('0x27')];this[_0xfbf9('0x28')]=_0x11cf17[_0xfbf9('0x28')];}module[_0xfbf9('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index e3b8170..a0fc2b0 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf55=['createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xdf55,0x83));var _0x5df5=function(_0x45dfd0,_0x43439b){_0x45dfd0=_0x45dfd0-0x0;var _0x1df4a2=_0xdf55[_0x45dfd0];return _0x1df4a2;};'use strict';var util=require(_0x5df5('0x0'));var logger=require(_0x5df5('0x1'))('dialer');var cmHopper=require(_0x5df5('0x2'));var cmHopperAdditionalPhone=require(_0x5df5('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x5df5('0x4'));function inspectError(_0x773e15){return util[_0x5df5('0x5')](_0x773e15,{'showHidden':![],'depth':null});}function getContactDialer(_0x521007,_0x289af4,_0x417341){return cmHopper[_0x5df5('0x6')](_0x521007['id'],_0x289af4,_0x417341,_0x521007[_0x5df5('0x7')])[_0x5df5('0x8')](function(_0x2b7ed9){_0x521007[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialer]',inspectError(_0x2b7ed9));});}exports[_0x5df5('0x6')]=getContactDialer;function getContactDialerIvr(_0x403d8b,_0x41941e){return cmHopper['getContactDialerIvr'](_0x403d8b['id'],_0x41941e,_0x403d8b['dialOrderByScheduledAt'])[_0x5df5('0x8')](function(_0x4e80bd){_0x403d8b[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialerIvr]',inspectError(_0x4e80bd));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x40322d){return cmHopper[_0x5df5('0xb')](_0x40322d)[_0x5df5('0x8')](function(_0x4c3d6f){logger[_0x5df5('0xa')](_0x5df5('0xc'),inspectError(_0x4c3d6f));});}exports[_0x5df5('0xb')]=countReScheduled;function rescheduleContact(_0x463990){return cmHopper[_0x5df5('0xd')](_0x463990)[_0x5df5('0x8')](function(_0x555d3f){logger[_0x5df5('0xa')]('[rescheduleContact]',inspectError(_0x555d3f));});}exports[_0x5df5('0xd')]=rescheduleContact;function unlockContact(_0x33f818,_0x5b0ad9,_0x3657c8){return cmHopper[_0x5df5('0xe')](_0x33f818,_0x5b0ad9,_0x3657c8)['catch'](function(_0x27b3fb){logger[_0x5df5('0xa')]('[unlockContact]',inspectError(_0x27b3fb));});}exports[_0x5df5('0xe')]=unlockContact;function moveContactManagedDialer(_0x45813f){return cmHopper[_0x5df5('0xf')](_0x45813f)[_0x5df5('0x8')](function(_0x215d59){logger['error']('[moveContactManagedDialer]',inspectError(_0x215d59));});}exports[_0x5df5('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x5d8dfd){return cmHopperBlack[_0x5df5('0x10')](_0x5d8dfd)[_0x5df5('0x8')](function(_0xa939e4){logger[_0x5df5('0xa')](_0x5df5('0x11'),inspectError(_0xa939e4));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x1d6474){return cmHopperBlack[_0x5df5('0x12')](_0x1d6474)[_0x5df5('0x8')](function(_0x34af1d){logger[_0x5df5('0xa')](_0x5df5('0x13'),inspectError(_0x34af1d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2e99a1,_0x2e862d,_0x8742a7){return cmHopperAdditionalPhone[_0x5df5('0x14')](_0x2e99a1,_0x2e862d,_0x8742a7)['catch'](function(_0x4358ba){logger[_0x5df5('0xa')](_0x5df5('0x15'),inspectError(_0x4358ba));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x52206d,_0x532923,_0x357fb0){return cmHopperAdditionalPhone[_0x5df5('0x16')](_0x52206d,_0x532923,_0x357fb0)[_0x5df5('0x8')](function(_0xa7f4b3){logger[_0x5df5('0xa')](_0x5df5('0x17'),inspectError(_0xa7f4b3));});}exports[_0x5df5('0x16')]=swapAdditionalPhones;function avgHandleTime(_0x28723e){return cmHopperHistory['avgHandleTime'](_0x28723e)[_0x5df5('0x8')](function(_0x4fc1a1){logger[_0x5df5('0xa')](_0x5df5('0x18'),inspectError(_0x4fc1a1));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x3854d0){return cmHopperHistory['createHistory'](_0x3854d0)[_0x5df5('0x8')](function(_0x4cccf1){logger[_0x5df5('0xa')]('[createHistory]',inspectError(_0x4cccf1));});}exports[_0x5df5('0x19')]=createHistory; \ No newline at end of file +var _0x2675=['[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp'];(function(_0x278f81,_0x2196ef){var _0x5d3c09=function(_0x51321e){while(--_0x51321e){_0x278f81['push'](_0x278f81['shift']());}};_0x5d3c09(++_0x2196ef);}(_0x2675,0x75));var _0x5267=function(_0x3e396,_0x2e4f24){_0x3e396=_0x3e396-0x0;var _0x4de253=_0x2675[_0x3e396];return _0x4de253;};'use strict';var util=require(_0x5267('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x5267('0x1'));var cmHopperBlack=require(_0x5267('0x2'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x4600fa){return util[_0x5267('0x3')](_0x4600fa,{'showHidden':![],'depth':null});}function getContactDialer(_0x4e2548,_0x328776,_0xf2b350){return cmHopper[_0x5267('0x4')](_0x4e2548['id'],_0x328776,_0xf2b350,_0x4e2548[_0x5267('0x5')])[_0x5267('0x6')](function(_0xc56cd5){_0x4e2548['temp']=0x0;logger[_0x5267('0x7')](_0x5267('0x8'),inspectError(_0xc56cd5));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x799fcc,_0x5d6645){return cmHopper[_0x5267('0x9')](_0x799fcc['id'],_0x5d6645,_0x799fcc[_0x5267('0x5')])[_0x5267('0x6')](function(_0x534c2b){_0x799fcc[_0x5267('0xa')]=0x0;logger['error'](_0x5267('0xb'),inspectError(_0x534c2b));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x31ea34){return cmHopper[_0x5267('0xc')](_0x31ea34)[_0x5267('0x6')](function(_0x1f9be3){logger[_0x5267('0x7')](_0x5267('0xd'),inspectError(_0x1f9be3));});}exports[_0x5267('0xc')]=countReScheduled;function rescheduleContact(_0x36dc17){return cmHopper[_0x5267('0xe')](_0x36dc17)[_0x5267('0x6')](function(_0x16e5a7){logger[_0x5267('0x7')](_0x5267('0xf'),inspectError(_0x16e5a7));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x52e24e,_0xa593fb,_0x40d897){return cmHopper[_0x5267('0x10')](_0x52e24e,_0xa593fb,_0x40d897)[_0x5267('0x6')](function(_0x46b2c2){logger[_0x5267('0x7')](_0x5267('0x11'),inspectError(_0x46b2c2));});}exports[_0x5267('0x10')]=unlockContact;function moveContactManagedDialer(_0x15d81e){return cmHopper[_0x5267('0x12')](_0x15d81e)[_0x5267('0x6')](function(_0x1ab03){logger['error'](_0x5267('0x13'),inspectError(_0x1ab03));});}exports[_0x5267('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x5069e8){return cmHopperBlack[_0x5267('0x14')](_0x5069e8)['catch'](function(_0x1cf835){logger[_0x5267('0x7')](_0x5267('0x15'),inspectError(_0x1cf835));});}exports[_0x5267('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x5ca9c6){return cmHopperBlack['checkIsBlackListIvr'](_0x5ca9c6)[_0x5267('0x6')](function(_0x5aebdd){logger[_0x5267('0x7')](_0x5267('0x16'),inspectError(_0x5aebdd));});}exports[_0x5267('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x56dd95,_0x499f19,_0x5546e2){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x56dd95,_0x499f19,_0x5546e2)['catch'](function(_0x26c7f8){logger[_0x5267('0x7')](_0x5267('0x18'),inspectError(_0x26c7f8));});}exports[_0x5267('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x11c8ea,_0x40d1be,_0x126a97){return cmHopperAdditionalPhone[_0x5267('0x1a')](_0x11c8ea,_0x40d1be,_0x126a97)[_0x5267('0x6')](function(_0x59f112){logger['error'](_0x5267('0x1b'),inspectError(_0x59f112));});}exports[_0x5267('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x5abf95){return cmHopperHistory[_0x5267('0x1c')](_0x5abf95)['catch'](function(_0x4d7c2a){logger[_0x5267('0x7')](_0x5267('0x1d'),inspectError(_0x4d7c2a));});}exports[_0x5267('0x1c')]=avgHandleTime;function createHistory(_0x2d2ace){return cmHopperHistory[_0x5267('0x1e')](_0x2d2ace)['catch'](function(_0x5e87eb){logger[_0x5267('0x7')](_0x5267('0x1f'),inspectError(_0x5e87eb));});}exports[_0x5267('0x1e')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 7f979d6..1aa12f6 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a8e=['match','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','erlangb','checkContactLowerLimitOriginate','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','dialActive','isQueueCampaignActive','active','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage'];(function(_0x2dc37d,_0x1fa435){var _0x1059d8=function(_0x43734e){while(--_0x43734e){_0x2dc37d['push'](_0x2dc37d['shift']());}};_0x1059d8(++_0x1fa435);}(_0x0a8e,0xc7));var _0xe0a8=function(_0x2fa143,_0x4c4301){_0x2fa143=_0x2fa143-0x0;var _0x5b32cb=_0x0a8e[_0x2fa143];return _0x5b32cb;};'use strict';var _=require(_0xe0a8('0x0'));var moment=require(_0xe0a8('0x1'));var util=require('util');var logger=require(_0xe0a8('0x2'))('dialer');var timezones=require(_0xe0a8('0x3'))[_0xe0a8('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xe0a8('0x5'),'CONTACTS_RESCHEDULED':_0xe0a8('0x6'),'DEACTIVATED':_0xe0a8('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xe0a8('0x8'),'INACTIVE':_0xe0a8('0x9'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xe0a8('0xa'),'NULL_INTERVAL':_0xe0a8('0xb'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xe0a8('0xc'),'QUEUE_RECALL':_0xe0a8('0xd'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xe0a8('0xe'),'UNKNOWN_TIMEZONE':_0xe0a8('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xe0a8('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x259ec3){return _0x259ec3[_0xe0a8('0x11')]===_0xe0a8('0x12');}exports[_0xe0a8('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x47fb19){return _0x47fb19['type']===_0xe0a8('0x14');}exports[_0xe0a8('0x15')]=isIVRCampaign;function isOutboundQueue(_0x8c7deb){return _0x8c7deb[_0xe0a8('0x16')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x4e64b0){return _0x4e64b0[_0xe0a8('0x17')];}exports[_0xe0a8('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2a21b5){return _0x2a21b5[_0xe0a8('0x19')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x3c81be,_0x9124bc){var _0x5ba630=moment(_0x3c81be)[_0xe0a8('0x1a')](0x0);var _0x1b030f=moment(_0x9124bc)['milliseconds'](0x0);return _0x5ba630[_0xe0a8('0x1b')](_0x1b030f,'seconds');}exports[_0xe0a8('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x2d2988,_0x9d7ae1){var _0x4bc7aa=![];var _0x5f2e00=_0x2d2988[_0xe0a8('0x11')]!==_0x9d7ae1[_0xe0a8('0x11')]||_0x2d2988['dialActive']!==_0x9d7ae1['dialActive']||_0x2d2988[_0xe0a8('0x1d')]!==_0x9d7ae1[_0xe0a8('0x1d')];var _0x230cbf=_0x2d2988[_0xe0a8('0x1e')]!==_0x9d7ae1['available']||_0x2d2988[_0xe0a8('0x1f')]!==_0x9d7ae1[_0xe0a8('0x1f')]||_0x2d2988[_0xe0a8('0x20')]!==_0x9d7ae1[_0xe0a8('0x20')]||_0x2d2988[_0xe0a8('0x21')]!==_0x9d7ae1[_0xe0a8('0x21')]||_0x2d2988['talking']!==_0x9d7ae1[_0xe0a8('0x22')]||_0x2d2988[_0xe0a8('0x23')]!==_0x9d7ae1['pTalking']||_0x2d2988['waiting']!==_0x9d7ae1[_0xe0a8('0x24')]||_0x2d2988[_0xe0a8('0x25')]!==_0x9d7ae1[_0xe0a8('0x25')]||_0x2d2988[_0xe0a8('0x26')]!==_0x9d7ae1[_0xe0a8('0x26')];if(_0x2d2988['Trunk']&&_0x9d7ae1[_0xe0a8('0x27')]){_0x4bc7aa=_0x2d2988['Trunk'][_0xe0a8('0x28')]!==_0x9d7ae1[_0xe0a8('0x27')][_0xe0a8('0x28')]||_0x2d2988[_0xe0a8('0x27')][_0xe0a8('0x19')]!==_0x9d7ae1[_0xe0a8('0x27')][_0xe0a8('0x19')];}return _0x5f2e00||_0x230cbf||_0x4bc7aa;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x23175b){var _0x3cd290=null;var _0x1cd500=_0x23175b[_0xe0a8('0x29')];if(_[_0xe0a8('0x2a')](_0x23175b[_0xe0a8('0x2b')])||_[_0xe0a8('0x2a')](_0x23175b['Interval'])||_['isNil'](_0x23175b[_0xe0a8('0x2c')]['Intervals'])){_0x3cd290=CAMPAIGN_STATUS[_0xe0a8('0x2d')];}else if(_[_0xe0a8('0x2e')](_0x23175b[_0xe0a8('0x2b')])||_[_0xe0a8('0x2e')](_0x23175b[_0xe0a8('0x2c')][_0xe0a8('0x2f')])){_0x3cd290=CAMPAIGN_STATUS[_0xe0a8('0x30')];}else if(_0x1cd500&&!timezones[_0x1cd500]){_0x3cd290=CAMPAIGN_STATUS[_0xe0a8('0x31')];}return _0x3cd290;}function checkAnyValidTrunk(_0x4af1b4,_0x4ca6b0){var _0x4056d9=null;var _0x1a7d50='SIP/';var _0x52a7d1=[_0xe0a8('0x32'),_0xe0a8('0x33')];var _0x44d3f0=!![];if(_0x4af1b4['Trunk']&&_0x4af1b4['Trunk'][_0xe0a8('0x19')]){_0x1a7d50+=_0x4af1b4[_0xe0a8('0x27')][_0xe0a8('0x28')];_0x4056d9=_0x4ca6b0[_0x1a7d50];_0x44d3f0=_0x52a7d1[_0xe0a8('0x34')](_0x4056d9[_0xe0a8('0x35')]);}else if(_0x4af1b4[_0xe0a8('0x36')]&&_0x4af1b4[_0xe0a8('0x36')][_0xe0a8('0x19')]){_0x1a7d50+=_0x4af1b4[_0xe0a8('0x36')][_0xe0a8('0x28')];_0x4056d9=_0x4ca6b0[_0x1a7d50];_0x44d3f0=_0x52a7d1[_0xe0a8('0x34')](_0x4056d9[_0xe0a8('0x35')]);}return _0x44d3f0;}function getQueueCampaignStatusMessage(_0x23e9d5,_0x153dd5){var _0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x37')];var _0x38e7b6=isPreviewCampaign(_0x23e9d5);if(!isQueueCampaignActive(_0x23e9d5)){if(_0x38e7b6){_0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x38')];}else{if(_0x23e9d5[_0xe0a8('0x26')]===0x0&&_0x23e9d5[_0xe0a8('0x22')]===0x0&&_0x23e9d5['waiting']===0x0&&(_0x23e9d5[_0xe0a8('0x23')]||0x0)===0x0){_0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x38')];}else{_0x2b8207=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x23e9d5['loggedIn']===0x0){_0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x39')];}else if(!checkAnyValidTrunk(_0x23e9d5,_0x153dd5)){_0x2b8207=CAMPAIGN_STATUS[_0xe0a8('0x3a')];}else if(!isPreviewCampaign(_0x23e9d5)){var _0x5a7193=checkAnyValidQueueCampaignInterval(_0x23e9d5);if(_0x5a7193){_0x2b8207=_0x5a7193;}}return _0x2b8207;}exports[_0xe0a8('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x13d6b1){var _0x4686bb=CAMPAIGN_STATUS[_0xe0a8('0x3c')];if(_0x13d6b1[_0xe0a8('0x26')]===0x0&&_0x13d6b1[_0xe0a8('0x22')]===0x0&&_0x13d6b1[_0xe0a8('0x24')]===0x0&&(_0x13d6b1['pTalking']||0x0)===0x0){_0x4686bb=CAMPAIGN_STATUS[_0xe0a8('0x38')];}return _0x4686bb;}exports[_0xe0a8('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xd8fd51){var _0x45cfca=_0xd8fd51[_0xe0a8('0x3e')](/"(.*?)"/);return _0x45cfca?_0x45cfca[0x1]:_0xd8fd51;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x2633ba,_0x561261,_0x9f1ed5){if(!_[_0xe0a8('0x3f')](_0x9f1ed5)&&typeof _0x9f1ed5===_0xe0a8('0x40')&&!_[_0xe0a8('0x2e')](_0x9f1ed5)){if(!_[_0xe0a8('0x3f')](_0x561261)&&typeof _0x561261===_0xe0a8('0x40')&&!_[_0xe0a8('0x2e')](_0x561261)){return util[_0xe0a8('0x41')](_0xe0a8('0x42'),_0x561261,_0x9f1ed5);}return util[_0xe0a8('0x41')]('\x22%s\x22\x20<%s>',_0x9f1ed5,_0x9f1ed5);}if(!_['isUndefined'](_0x2633ba)&&typeof _0x2633ba===_0xe0a8('0x40')&&!_[_0xe0a8('0x2e')](_0x2633ba)){return _0x2633ba;}return'\x22\x22\x20<>';}exports[_0xe0a8('0x43')]=getCallerId;function getCallerIdRandom(_0x3db294,_0x1a282e){var _0x569b92;var _0x23f632;var _0x5e0d85;if(_0x1a282e<=0x0){_0x1a282e=0x1;}_0x569b92=new RegExp(_0xe0a8('0x44')+_0x1a282e+'}$');_0x23f632=Math[_0xe0a8('0x45')](0xa,_0x1a282e-0x1);_0x5e0d85=Math[_0xe0a8('0x45')](0xa,_0x1a282e)-0x1;return util['format']('%s',_[_0xe0a8('0x46')](_0x3db294,_0x569b92,_[_0xe0a8('0x47')](_0x23f632,_0x5e0d85)['toString']()));}exports[_0xe0a8('0x48')]=getCallerIdRandom;function decrementOriginate(_0x1ce4a2){if(_0x1ce4a2[_0xe0a8('0x26')]&&_0x1ce4a2[_0xe0a8('0x26')]>0x0){_0x1ce4a2[_0xe0a8('0x26')]-=0x1;}else{logger[_0xe0a8('0x49')](_0xe0a8('0x4a'));}}exports[_0xe0a8('0x4b')]=decrementOriginate;function checkContactEmpty(_0x22af0c){return _0x22af0c&&_0x22af0c[_0xe0a8('0x4c')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x1fe0b1,_0x581eef){if(_0x581eef===0x0){return 0x0;}var _0x2ddef1=0x1;for(var _0x45bc20=0x1;_0x45bc20<=_0x581eef;_0x45bc20+=0x1){_0x2ddef1=0x1+_0x2ddef1*_0x45bc20/_0x1fe0b1;}return 0x1/_0x2ddef1;}exports[_0xe0a8('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x1d3152,_0xf452b0,_0x23ee84){if(_0xf452b0>_0x23ee84){for(var _0x4250cd=0x0;_0x4250cd<_0xf452b0-_0x23ee84;_0x4250cd+=0x1){decrementOriginate(_0x1d3152);}}}exports[_0xe0a8('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x57d2c9){var _0x343db2={};var _0x539856=['id','createdAt',_0xe0a8('0x4f'),_0xe0a8('0x50'),_0xe0a8('0x51')];if(_0x57d2c9){for(var _0x2e705e in _0x57d2c9){if(typeof _0x57d2c9[_0x2e705e]!==_0xe0a8('0x52')){if(!_[_0xe0a8('0x2a')](_0x57d2c9[_0x2e705e])&&!_0x539856[_0xe0a8('0x34')](_0x2e705e)){_0x343db2[util[_0xe0a8('0x41')](_0xe0a8('0x53'),_0xe0a8('0x54'),_0x2e705e[_0xe0a8('0x55')]())]=_0x57d2c9[_0x2e705e];}}}}return _0x343db2;}exports[_0xe0a8('0x56')]=setXMDContactVariables; \ No newline at end of file +var _0x42aa=['INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','SIP/','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','updatedAt','undefined','%s%s','XMD-','setXMDContactVariables','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE'];(function(_0x50d623,_0x5829bb){var _0x510b6b=function(_0x5d5ae9){while(--_0x5d5ae9){_0x50d623['push'](_0x50d623['shift']());}};_0x510b6b(++_0x5829bb);}(_0x42aa,0x1e6));var _0xa42a=function(_0x2d926e,_0x180843){_0x2d926e=_0x2d926e-0x0;var _0x146ae9=_0x42aa[_0x2d926e];return _0x146ae9;};'use strict';var _=require('lodash');var moment=require(_0xa42a('0x0'));var util=require(_0xa42a('0x1'));var logger=require(_0xa42a('0x2'))(_0xa42a('0x3'));var timezones=require(_0xa42a('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xa42a('0x5'),'BLACKLIST':_0xa42a('0x6'),'CONTACTS_RESCHEDULED':_0xa42a('0x7'),'DEACTIVATED':_0xa42a('0x8'),'DISACTIVED':_0xa42a('0x9'),'EMPTY_INTERVAL':_0xa42a('0xa'),'INACTIVE':_0xa42a('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xa42a('0xc'),'OVERTIME_INTERVAL':_0xa42a('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xa42a('0xe'),'QUEUE_RECALL':_0xa42a('0xf'),'RECALL_TIMEOUT':_0xa42a('0x10'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xa42a('0x11'),'UNREACHABLE_TRUNK':_0xa42a('0x12')};exports[_0xa42a('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5102d3){return _0x5102d3[_0xa42a('0x14')]==='preview';}exports[_0xa42a('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x18a3c7){return _0x18a3c7[_0xa42a('0x16')]===_0xa42a('0x17');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x46e7cf){return _0x46e7cf[_0xa42a('0x16')]===_0xa42a('0x18');}exports[_0xa42a('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x96d852){return _0x96d852[_0xa42a('0x1a')];}exports[_0xa42a('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x17a7c2){return _0x17a7c2[_0xa42a('0x1c')];}exports[_0xa42a('0x1d')]=isIVRCampaignActive;function getSeconds(_0x474b69,_0x5efdb3){var _0x41312a=moment(_0x474b69)[_0xa42a('0x1e')](0x0);var _0x27577c=moment(_0x5efdb3)['milliseconds'](0x0);return _0x41312a['diff'](_0x27577c,_0xa42a('0x1f'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x508df9,_0x34d907){var _0x4ecd92=![];var _0x47560b=_0x508df9[_0xa42a('0x14')]!==_0x34d907[_0xa42a('0x14')]||_0x508df9['dialActive']!==_0x34d907[_0xa42a('0x1a')]||_0x508df9[_0xa42a('0x20')]!==_0x34d907[_0xa42a('0x20')];var _0x45a7e2=_0x508df9[_0xa42a('0x21')]!==_0x34d907[_0xa42a('0x21')]||_0x508df9[_0xa42a('0x22')]!==_0x34d907[_0xa42a('0x22')]||_0x508df9[_0xa42a('0x23')]!==_0x34d907[_0xa42a('0x23')]||_0x508df9['paused']!==_0x34d907['paused']||_0x508df9[_0xa42a('0x24')]!==_0x34d907['talking']||_0x508df9[_0xa42a('0x25')]!==_0x34d907[_0xa42a('0x25')]||_0x508df9[_0xa42a('0x26')]!==_0x34d907[_0xa42a('0x26')]||_0x508df9[_0xa42a('0x27')]!==_0x34d907[_0xa42a('0x27')]||_0x508df9[_0xa42a('0x28')]!==_0x34d907[_0xa42a('0x28')];if(_0x508df9[_0xa42a('0x29')]&&_0x34d907[_0xa42a('0x29')]){_0x4ecd92=_0x508df9[_0xa42a('0x29')][_0xa42a('0x2a')]!==_0x34d907[_0xa42a('0x29')][_0xa42a('0x2a')]||_0x508df9['Trunk'][_0xa42a('0x1c')]!==_0x34d907[_0xa42a('0x29')][_0xa42a('0x1c')];}return _0x47560b||_0x45a7e2||_0x4ecd92;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x504ec1){var _0xcdc1a=null;var _0x1a7b54=_0x504ec1['dialTimezone'];if(_[_0xa42a('0x2b')](_0x504ec1[_0xa42a('0x2c')])||_[_0xa42a('0x2b')](_0x504ec1[_0xa42a('0x2d')])||_[_0xa42a('0x2b')](_0x504ec1[_0xa42a('0x2d')][_0xa42a('0x2e')])){_0xcdc1a=CAMPAIGN_STATUS[_0xa42a('0x2f')];}else if(_[_0xa42a('0x30')](_0x504ec1[_0xa42a('0x2c')])||_[_0xa42a('0x30')](_0x504ec1[_0xa42a('0x2d')][_0xa42a('0x2e')])){_0xcdc1a=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x1a7b54&&!timezones[_0x1a7b54]){_0xcdc1a=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0xcdc1a;}function checkAnyValidTrunk(_0x17bdfe,_0x2d8e48){var _0xbf8b39=null;var _0x2b5539=_0xa42a('0x31');var _0x2bc0ec=[_0xa42a('0x32'),_0xa42a('0x33')];var _0x3b25d1=!![];if(_0x17bdfe['Trunk']&&_0x17bdfe[_0xa42a('0x29')][_0xa42a('0x1c')]){_0x2b5539+=_0x17bdfe[_0xa42a('0x29')][_0xa42a('0x2a')];_0xbf8b39=_0x2d8e48[_0x2b5539];_0x3b25d1=_0x2bc0ec[_0xa42a('0x34')](_0xbf8b39['status']);}else if(_0x17bdfe[_0xa42a('0x35')]&&_0x17bdfe[_0xa42a('0x35')][_0xa42a('0x1c')]){_0x2b5539+=_0x17bdfe['TrunkBackup'][_0xa42a('0x2a')];_0xbf8b39=_0x2d8e48[_0x2b5539];_0x3b25d1=_0x2bc0ec[_0xa42a('0x34')](_0xbf8b39[_0xa42a('0x36')]);}return _0x3b25d1;}function getQueueCampaignStatusMessage(_0xb4652f,_0x4d8774){var _0x1d121d=CAMPAIGN_STATUS[_0xa42a('0x5')];var _0x4c345e=isPreviewCampaign(_0xb4652f);if(!isQueueCampaignActive(_0xb4652f)){if(_0x4c345e){_0x1d121d=CAMPAIGN_STATUS[_0xa42a('0x37')];}else{if(_0xb4652f[_0xa42a('0x28')]===0x0&&_0xb4652f[_0xa42a('0x24')]===0x0&&_0xb4652f['waiting']===0x0&&(_0xb4652f[_0xa42a('0x25')]||0x0)===0x0){_0x1d121d=CAMPAIGN_STATUS['INACTIVE'];}else{_0x1d121d=CAMPAIGN_STATUS[_0xa42a('0x38')];}}}else if(_0xb4652f[_0xa42a('0x22')]===0x0){_0x1d121d=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0xb4652f,_0x4d8774)){_0x1d121d=CAMPAIGN_STATUS[_0xa42a('0x39')];}else if(!isPreviewCampaign(_0xb4652f)){var _0x581260=checkAnyValidQueueCampaignInterval(_0xb4652f);if(_0x581260){_0x1d121d=_0x581260;}}return _0x1d121d;}exports[_0xa42a('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x584db0){var _0x31e685=CAMPAIGN_STATUS[_0xa42a('0x38')];if(_0x584db0[_0xa42a('0x28')]===0x0&&_0x584db0[_0xa42a('0x24')]===0x0&&_0x584db0[_0xa42a('0x26')]===0x0&&(_0x584db0['pTalking']||0x0)===0x0){_0x31e685=CAMPAIGN_STATUS['INACTIVE'];}return _0x31e685;}exports[_0xa42a('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2c367b){var _0x11f548=_0x2c367b[_0xa42a('0x3c')](/"(.*?)"/);return _0x11f548?_0x11f548[0x1]:_0x2c367b;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x2d6582,_0x5e0ae2,_0x428fab){if(!_[_0xa42a('0x3d')](_0x428fab)&&typeof _0x428fab===_0xa42a('0x3e')&&!_[_0xa42a('0x30')](_0x428fab)){if(!_[_0xa42a('0x3d')](_0x5e0ae2)&&typeof _0x5e0ae2===_0xa42a('0x3e')&&!_[_0xa42a('0x30')](_0x5e0ae2)){return util[_0xa42a('0x3f')](_0xa42a('0x40'),_0x5e0ae2,_0x428fab);}return util['format'](_0xa42a('0x40'),_0x428fab,_0x428fab);}if(!_['isUndefined'](_0x2d6582)&&typeof _0x2d6582===_0xa42a('0x3e')&&!_[_0xa42a('0x30')](_0x2d6582)){return _0x2d6582;}return _0xa42a('0x41');}exports[_0xa42a('0x42')]=getCallerId;function getCallerIdRandom(_0x4a107f,_0x38599a){var _0x4e28a7;var _0x13e7ee;var _0x30087f;if(_0x38599a<=0x0){_0x38599a=0x1;}_0x4e28a7=new RegExp('\x5cw{0,'+_0x38599a+'}$');_0x13e7ee=Math[_0xa42a('0x43')](0xa,_0x38599a-0x1);_0x30087f=Math['pow'](0xa,_0x38599a)-0x1;return util[_0xa42a('0x3f')]('%s',_[_0xa42a('0x44')](_0x4a107f,_0x4e28a7,_['random'](_0x13e7ee,_0x30087f)['toString']()));}exports[_0xa42a('0x45')]=getCallerIdRandom;function decrementOriginate(_0x4acd0d){if(_0x4acd0d[_0xa42a('0x28')]&&_0x4acd0d[_0xa42a('0x28')]>0x0){_0x4acd0d[_0xa42a('0x28')]-=0x1;}else{logger[_0xa42a('0x46')](_0xa42a('0x47'));}}exports[_0xa42a('0x48')]=decrementOriginate;function checkContactEmpty(_0x26a41d){return _0x26a41d&&_0x26a41d[_0xa42a('0x49')]>0x0;}exports[_0xa42a('0x4a')]=checkContactEmpty;function erlangb(_0x3e9d20,_0x2826f4){if(_0x2826f4===0x0){return 0x0;}var _0x3b9e95=0x1;for(var _0x455b95=0x1;_0x455b95<=_0x2826f4;_0x455b95+=0x1){_0x3b9e95=0x1+_0x3b9e95*_0x455b95/_0x3e9d20;}return 0x1/_0x3b9e95;}exports[_0xa42a('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x282a17,_0x25e0db,_0x5f0481){if(_0x25e0db>_0x5f0481){for(var _0x50e573=0x0;_0x50e573<_0x25e0db-_0x5f0481;_0x50e573+=0x1){decrementOriginate(_0x282a17);}}}exports[_0xa42a('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x5a3980){var _0x5a5695={};var _0x3c6f7e=['id','createdAt','description',_0xa42a('0x4d'),_0xa42a('0x4e')];if(_0x5a3980){for(var _0x5a702e in _0x5a3980){if(typeof _0x5a3980[_0x5a702e]!==_0xa42a('0x4f')){if(!_['isNil'](_0x5a3980[_0x5a702e])&&!_0x3c6f7e['includes'](_0x5a702e)){_0x5a5695[util[_0xa42a('0x3f')](_0xa42a('0x50'),_0xa42a('0x51'),_0x5a702e['toUpperCase']())]=_0x5a3980[_0x5a702e];}}}}return _0x5a5695;}exports[_0xa42a('0x52')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ec1bf38..f2f01bf 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(_0x3f47df,_0x1d3b79){var _0x3e2ac4=function(_0x2525c6){while(--_0x2525c6){_0x3f47df['push'](_0x3f47df['shift']());}};_0x3e2ac4(++_0x1d3b79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x2846fc,_0x51e861){var _0x779dd6=function(_0x5da470){while(--_0x5da470){_0x2846fc['push'](_0x2846fc['shift']());}};_0x779dd6(++_0x51e861);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 4f2c0ad..b5a32b5 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 _0x761f=['reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','./util/gs','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x761f,0x11e));var _0xf761=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x761f[_0x486f4a];return _0x135d99;};'use strict';var util=require(_0xf761('0x0'));var _=require(_0xf761('0x1'));var BPromise=require(_0xf761('0x2'));var uuid=require(_0xf761('0x3'));var moment=require(_0xf761('0x4'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0xf761('0x5'));var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require(_0xf761('0x6'));var Channel=require('./channel');var ut=require(_0xf761('0x7'));var Action=require(_0xf761('0x8'));var faxAccount=require(_0xf761('0x9'));var attachment=require(_0xf761('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2d166c){this[_0xf761('0xb')]={};this[_0xf761('0xc')]=_0x2d166c[_0xf761('0xc')];this[_0xf761('0xd')]=_0x2d166c[_0xf761('0xd')];this[_0xf761('0xe')]={};ami['on'](_0xf761('0xf'),this[_0xf761('0x10')][_0xf761('0x11')](this));ami['on'](_0xf761('0x12'),this[_0xf761('0x13')]['bind'](this));ami['on'](_0xf761('0x14'),this[_0xf761('0x15')][_0xf761('0x11')](this));ami['on'](_0xf761('0x16'),this['syncNewExten'][_0xf761('0x11')](this));ami['on'](_0xf761('0x17'),this[_0xf761('0x18')][_0xf761('0x11')](this));ami['on'](_0xf761('0x19'),this[_0xf761('0x1a')]['bind'](this));ami['on'](_0xf761('0x1b'),this[_0xf761('0x1c')]['bind'](this));ami['on'](_0xf761('0x1d'),this[_0xf761('0x1e')][_0xf761('0x11')](this));}Fax[_0xf761('0x1f')]['syncNewchannel']=function(_0x42b04e){if(_0x42b04e[_0xf761('0x20')]===_0xf761('0x21')){for(var _0x5f51f2 in this['faxAccounts']){if(this['faxAccounts'][_0xf761('0x22')](_0x5f51f2)){if(_0x42b04e[_0xf761('0x23')]===this[_0xf761('0xc')][_0x5f51f2][_0xf761('0x24')]){this[_0xf761('0xb')][_0x42b04e[_0xf761('0x25')]]={};this['channels'][_0x42b04e['uniqueid']][_0xf761('0x26')]=_0x42b04e[_0xf761('0x26')];this[_0xf761('0xb')][_0x42b04e['uniqueid']]['id']=this[_0xf761('0xc')][_0x5f51f2]['id'];this[_0xf761('0xb')][_0x42b04e[_0xf761('0x25')]][_0xf761('0x27')]=this['faxAccounts'][_0x5f51f2]['name'];logger[_0xf761('0x28')](_0x42b04e[_0xf761('0x25')],_0xf761('0x29'));}}}}if(this[_0xf761('0xe')][_0x42b04e[_0xf761('0x25')]]){this['channels'][_0x42b04e[_0xf761('0x25')]]={};this[_0xf761('0xb')][_0x42b04e[_0xf761('0x25')]][_0xf761('0x26')]=_0x42b04e['channel'];logger['info'](_0x42b04e[_0xf761('0x25')],_0xf761('0x29'));}};Fax[_0xf761('0x1f')]['syncVarSet']=function(_0x3eb3e2){if(this[_0xf761('0xb')][_0x3eb3e2[_0xf761('0x25')]]){for(var _0x7ba306 in _0x3eb3e2[_0xf761('0x2a')]){if(_0x3eb3e2[_0xf761('0x2a')][_0xf761('0x22')](_0x7ba306)){this[_0xf761('0xb')][_0x3eb3e2[_0xf761('0x25')]][_0x7ba306]=_0x3eb3e2[_0xf761('0x2b')];}}}};Fax[_0xf761('0x1f')][_0xf761('0x15')]=function(_0x2c4fbd){if(this['channels'][_0x2c4fbd[_0xf761('0x25')]]){this['channels'][_0x2c4fbd['uniqueid']]['channelstate']=_0x2c4fbd[_0xf761('0x2c')];this[_0xf761('0xb')][_0x2c4fbd['uniqueid']][_0xf761('0x2d')]=_0x2c4fbd[_0xf761('0x2d')];}};Fax[_0xf761('0x1f')][_0xf761('0x2e')]=function(_0x22f418){if(this['channels'][_0x22f418['uniqueid']]){for(var _0x38a30f in _0x22f418[_0xf761('0x2a')]){if(_0x22f418[_0xf761('0x2a')][_0xf761('0x22')](_0x38a30f)){this[_0xf761('0xb')][_0x22f418[_0xf761('0x25')]][_0x38a30f]=_0x22f418[_0xf761('0x2b')];}}}};Fax['prototype'][_0xf761('0x18')]=function(_0x3008b2){if(this[_0xf761('0xb')][_0x3008b2[_0xf761('0x25')]]){this[_0xf761('0xb')][_0x3008b2[_0xf761('0x25')]][_0xf761('0x2f')]=_0x3008b2[_0xf761('0x2f')];this['channels'][_0x3008b2[_0xf761('0x25')]][_0xf761('0x30')]=_0x3008b2['status'];this[_0xf761('0xb')][_0x3008b2[_0xf761('0x25')]][_0xf761('0x24')]=_0x3008b2[_0xf761('0x24')];this['channels'][_0x3008b2[_0xf761('0x25')]][_0xf761('0x31')]=_0x3008b2['filename'];logger[_0xf761('0x28')](_0x3008b2['uniqueid'],_0xf761('0x32'));}};Fax['prototype']['syncReceiveFax']=function(_0x3cfdbb){var _0x9b314e=this;if(this[_0xf761('0xb')][_0x3cfdbb['uniqueid']]){var _0xfbdb73=this['channels'][_0x3cfdbb['uniqueid']]['id'];this['channels'][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x33')]=_0x3cfdbb[_0xf761('0x33')];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x34')]=_0x3cfdbb[_0xf761('0x34')];this['channels'][_0x3cfdbb['uniqueid']][_0xf761('0x24')]=_0x3cfdbb['localstationid'];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]]['resolution']=_0x3cfdbb[_0xf761('0x35')];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x36')]=_0x3cfdbb[_0xf761('0x36')];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]]['filename']=_0x3cfdbb['filename'];this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x37')]=_0x3cfdbb[_0xf761('0x37')];if(this[_0xf761('0xb')][_0x3cfdbb[_0xf761('0x25')]][_0xf761('0x34')]>0x0){tiff2pdf(_0x3cfdbb[_0xf761('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x5ef363){logger[_0xf761('0x28')](_0x3cfdbb[_0xf761('0x25')],_0xf761('0x38'),_0x5ef363[_0xf761('0x39')]);attachment[_0xf761('0x3a')]({'name':path[_0xf761('0x3b')](_0x3cfdbb[_0xf761('0x31')])['name'],'basename':path['parse'](_0x3cfdbb[_0xf761('0x31')])['name']+_0xf761('0x3c'),'type':_0xf761('0x3d')})[_0xf761('0x3e')](function(_0x42a577){faxAccount[_0xf761('0x3f')](_0xfbdb73,{'from':_0x3cfdbb[_0xf761('0x37')],'mapKey':'fax','body':path[_0xf761('0x3b')](_0x3cfdbb[_0xf761('0x31')])[_0xf761('0x27')]+_0xf761('0x3c'),'AttachmentId':_0x42a577['id']})['catch'](function(_0x417ac3){logger[_0xf761('0x40')](_0x3cfdbb[_0xf761('0x25')],_0xf761('0x41'),JSON[_0xf761('0x42')](_0x417ac3));});})[_0xf761('0x43')](function(_0x5b6053){logger[_0xf761('0x40')](_0x3cfdbb['uniqueid'],_0xf761('0x44'),JSON[_0xf761('0x42')](_0x5b6053));});});}logger[_0xf761('0x28')](_0x3cfdbb[_0xf761('0x25')],_0xf761('0x44'));}};Fax[_0xf761('0x1f')]['syncOriginateResponse']=function(_0x457392){if(this['actions'][_0x457392['uniqueid']]){_[_0xf761('0x45')](this[_0xf761('0xb')][_0x457392[_0xf761('0x25')]],_[_0xf761('0x46')](_0x457392,['response',_0xf761('0x47')]));}};function updateStatus(_0xb990ed){if(_0xb990ed[_0xf761('0x48')]){faxMessage[_0xf761('0x49')](_0xb990ed[_0xf761('0x48')],{'failMessage':_0xf761('0x4a')})['then'](function(_0x38902f){ut[_0xf761('0x4b')](_0xf761('0x4c'),_0x38902f);})[_0xf761('0x43')](function(_0xed8364){ut[_0xf761('0x4b')]('[Fax][Message][Error][NoUpdate1]',_0xed8364);});}else{ut[_0xf761('0x4b')](_0xf761('0x4d'));}}Fax['prototype']['updateStatus']=function(_0x33e8f5,_0x312aa9,_0x5846bc){var _0x43c2e3=this;var _0x3a1267={};if(_0x312aa9){_0x3a1267={'read':_0x312aa9};}else{_0x3a1267={'failMessage':_0x5846bc};}if(this['actions'][_0x33e8f5][_0xf761('0x48')]){faxMessage[_0xf761('0x49')](this['actions'][_0x33e8f5][_0xf761('0x48')],_0x3a1267)['then'](function(_0x2b91ea){ut[_0xf761('0x4b')]('[Fax][Message][Updated]',_0x2b91ea);})[_0xf761('0x43')](function(_0x4df9d3){ut['logger'](_0xf761('0x4e'),_0x4df9d3);})[_0xf761('0x4f')](function(){delete _0x43c2e3[_0xf761('0xb')][_0x33e8f5];delete _0x43c2e3['actions'][_0x33e8f5];});}else{ut[_0xf761('0x4b')](_0xf761('0x50'));delete this['channels'][_0x33e8f5];delete this[_0xf761('0xe')][_0x33e8f5];}};Fax[_0xf761('0x1f')][_0xf761('0x1c')]=function(_0x2281da){var _0x19f541=this;if(this['channels'][_0x2281da['uniqueid']]){if(this['actions'][_0x2281da[_0xf761('0x25')]]){this[_0xf761('0xb')][_0x2281da[_0xf761('0x25')]]['id']=this[_0xf761('0xe')][_0x2281da[_0xf761('0x25')]]['id'];this[_0xf761('0xb')][_0x2281da['uniqueid']][_0xf761('0x27')]=this[_0xf761('0xe')][_0x2281da[_0xf761('0x25')]][_0xf761('0x27')];}logger['info'](_0x2281da[_0xf761('0x25')],this[_0xf761('0xe')][_0x2281da[_0xf761('0x25')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0xf761('0x42')](this[_0xf761('0xb')][_0x2281da[_0xf761('0x25')]]));if(this['actions'][_0x2281da[_0xf761('0x25')]]){if(this[_0xf761('0xb')][_0x2281da['uniqueid']][_0xf761('0x51')]>0x0&&this[_0xf761('0xb')][_0x2281da[_0xf761('0x25')]][_0xf761('0x17')]===_0xf761('0x52')){this[_0xf761('0x53')](_0x2281da['uniqueid'],!![]);}else{this[_0xf761('0x53')](_0x2281da['uniqueid'],![],this[_0xf761('0xb')][_0x2281da[_0xf761('0x25')]][_0xf761('0x54')]?_0xf761('0x55')+this['channels'][_0x2281da[_0xf761('0x25')]][_0xf761('0x54')]:_0xf761('0x56'));}}}};Fax['prototype'][_0xf761('0x57')]=function(_0x597e9e){var _0x13ccd7=this;return new BPromise(function(_0x178d85,_0x282f43){_0x13ccd7[_0xf761('0x58')](_0x597e9e,_0x13ccd7[_0xf761('0xc')][_0x597e9e['FaxAccountId']])[_0xf761('0x3e')](function(_0x169866){ut['logger'](_0xf761('0x59'),_0x169866);_0x178d85(ut['message'](_0xf761('0x5a')));})[_0xf761('0x43')](function(_0xcfedf9){ut[_0xf761('0x4b')](_0xf761('0x5b'),_0xcfedf9);updateStatus(_0x597e9e);_0x282f43(ut[_0xf761('0x39')](_0xf761('0x5c')));});});};Fax['prototype']['checkAfterSend']=function(_0x3b675d){var _0x6ac40f=this;return new BPromise(function(_0x1665df,_0x396ad7){var _0x33c39f=_0x6ac40f[_0xf761('0x5d')](_0x6ac40f[_0xf761('0xc')][_0x3b675d[_0xf761('0x5e')]][_0xf761('0x5f')],_0x3b675d);if(_0x33c39f[_0xf761('0x60')]){_0x1665df(ut['message'](_0xf761('0x61')));}else{_0x396ad7(ut['message'](_0x33c39f['message']));}});};function originate(_0x6f14c9,_0x411fdf,_0x3af3ff){return new BPromise(function(_0x12d74c,_0x4251ff){if(_0x3af3ff){var _0x4a72d9=util[_0xf761('0x62')](_0xf761('0x63'),path['parse'](_0x6f14c9['path'])[_0xf761('0x27')],_0x6f14c9[_0xf761('0x64')]);gs['execute'](_0x4a72d9)[_0xf761('0x3e')](function(){_0x6f14c9['path']=util[_0xf761('0x62')]('%s/%s.tif',path[_0xf761('0x3b')](_0x6f14c9['path'])[_0xf761('0x65')],path[_0xf761('0x3b')](_0x6f14c9[_0xf761('0x64')])[_0xf761('0x27')]);_0x411fdf[_0xf761('0x66')]=_0x6f14c9[_0xf761('0x64')];ut[_0xf761('0x4b')](_0xf761('0x67'),'');ami['Action'](ut['variablesAction'](_0x6f14c9,_0x411fdf))['then'](function(_0x2a19b2){_0x12d74c(_0x2a19b2);})['catch'](function(_0x3e5ab1){_0x4251ff(_0x3e5ab1);});})[_0xf761('0x43')](function(_0x592689){_0x4251ff(_0x592689);});}else{ami[_0xf761('0x68')](ut['variablesAction'](_0x6f14c9,_0x411fdf))[_0xf761('0x3e')](function(_0x541da8){_0x12d74c(_0x541da8);})[_0xf761('0x43')](function(_0x3b4209){_0x4251ff(_0x3b4209);});}});}Fax['prototype'][_0xf761('0x58')]=function(_0x278308,_0x41034c){var _0x44224a=this;return new BPromise(function(_0x3daf24,_0x301beb){var _0x970f5f=uuid['v4']();var _0x490f49=ut['addVariables'](_0x278308,_0x41034c);_0x44224a[_0xf761('0xe')][_0x970f5f]=new Action(_0x970f5f,_0x41034c,_0x278308);var _0xa65d2e=_0x44224a['actions'][_0x970f5f];if(path[_0xf761('0x3b')](_0x278308[_0xf761('0x64')])[_0xf761('0x69')]===_0xf761('0x3c')){originate(_0xa65d2e,_0x490f49,!![])[_0xf761('0x3e')](function(_0x12eedb){_0x3daf24(_0x12eedb);})['catch'](function(_0x35453c){_0x301beb(_0x35453c);});}else{originate(_0xa65d2e,_0x490f49,![])[_0xf761('0x3e')](function(_0x546e60){_0x3daf24(_0x546e60);})['catch'](function(_0x3842a8){_0x301beb(_0x3842a8);});}});};Fax['prototype'][_0xf761('0x6a')]=function(_0x3df5ff){return!_[_0xf761('0x6b')](_0x3df5ff)&&!_['isNil'](_0x3df5ff[_0xf761('0x27')])&&!_['isNil'](_0x3df5ff['active'])&&_0x3df5ff[_0xf761('0x6c')]&&!_['isNil'](this[_0xf761('0xd')][util[_0xf761('0x62')](_0xf761('0x6d'),_0x3df5ff['name'])])&&!_[_0xf761('0x6b')](this[_0xf761('0xd')][util[_0xf761('0x62')](_0xf761('0x6d'),_0x3df5ff[_0xf761('0x27')])][_0xf761('0x30')])&&(this[_0xf761('0xd')][util['format']('SIP/%s',_0x3df5ff[_0xf761('0x27')])]['status']===_0xf761('0x6e')||this['trunks'][util['format'](_0xf761('0x6d'),_0x3df5ff[_0xf761('0x27')])][_0xf761('0x30')]===_0xf761('0x6f'));};Fax[_0xf761('0x1f')][_0xf761('0x5d')]=function(_0x930ed0,_0x13e2c7){if(!this['isTrunkReachable'](_0x930ed0)){ut[_0xf761('0x4b')](_0xf761('0x70'),_[_0xf761('0x6b')](_0x930ed0)?'':_0x930ed0['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xf761('0x71')};}if(_[_0xf761('0x6b')](_0x13e2c7['fax'])){ut[_0xf761('0x4b')](_0xf761('0x72'),JSON['stringify'](_0x13e2c7));return{'isValid':![],'message':_0xf761('0x73')};}if(_['isNil'](_0x13e2c7[_0xf761('0x64')])){ut[_0xf761('0x4b')](_0xf761('0x74'),JSON[_0xf761('0x42')](_0x13e2c7));return{'isValid':![],'message':_0xf761('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xf761('0x76')]=Fax; \ No newline at end of file +var _0x7ce1=['../../../config/logger','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','error','stringify','\x20receiveFax\x20','actions','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','format','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs'];(function(_0x24e1bd,_0x4213ee){var _0x339468=function(_0x55b1eb){while(--_0x55b1eb){_0x24e1bd['push'](_0x24e1bd['shift']());}};_0x339468(++_0x4213ee);}(_0x7ce1,0x1e1));var _0x17ce=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x7ce1[_0x4350c2];return _0x8b6406;};'use strict';var util=require('util');var _=require(_0x17ce('0x0'));var BPromise=require(_0x17ce('0x1'));var uuid=require(_0x17ce('0x2'));var moment=require(_0x17ce('0x3'));var path=require(_0x17ce('0x4'));var tiff2pdf=require(_0x17ce('0x5'));var gs=require(_0x17ce('0x6'));var logger=require(_0x17ce('0x7'))('fax');var ami=require('../ami');var rpcDb=require(_0x17ce('0x8'));var Channel=require('./channel');var ut=require(_0x17ce('0x9'));var Action=require(_0x17ce('0xa'));var faxAccount=require(_0x17ce('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x17ce('0xc'));function Fax(_0xcdd45b){this[_0x17ce('0xd')]={};this['faxAccounts']=_0xcdd45b[_0x17ce('0xe')];this[_0x17ce('0xf')]=_0xcdd45b[_0x17ce('0xf')];this['actions']={};ami['on'](_0x17ce('0x10'),this[_0x17ce('0x11')]['bind'](this));ami['on'](_0x17ce('0x12'),this[_0x17ce('0x13')][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x15'),this['syncNewState'][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x16'),this[_0x17ce('0x17')][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x18'),this[_0x17ce('0x19')][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x1a'),this['syncReceiveFax'][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x1b'),this[_0x17ce('0x1c')][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x1d'),this[_0x17ce('0x1e')]['bind'](this));}Fax[_0x17ce('0x1f')]['syncNewchannel']=function(_0x9513d0){if(_0x9513d0[_0x17ce('0x20')]===_0x17ce('0x21')){for(var _0xfbef3f in this['faxAccounts']){if(this[_0x17ce('0xe')]['hasOwnProperty'](_0xfbef3f)){if(_0x9513d0[_0x17ce('0x22')]===this[_0x17ce('0xe')][_0xfbef3f][_0x17ce('0x23')]){this[_0x17ce('0xd')][_0x9513d0[_0x17ce('0x24')]]={};this[_0x17ce('0xd')][_0x9513d0['uniqueid']][_0x17ce('0x25')]=_0x9513d0[_0x17ce('0x25')];this[_0x17ce('0xd')][_0x9513d0[_0x17ce('0x24')]]['id']=this[_0x17ce('0xe')][_0xfbef3f]['id'];this[_0x17ce('0xd')][_0x9513d0[_0x17ce('0x24')]][_0x17ce('0x26')]=this['faxAccounts'][_0xfbef3f][_0x17ce('0x26')];logger['info'](_0x9513d0[_0x17ce('0x24')],_0x17ce('0x27'));}}}}if(this['actions'][_0x9513d0['uniqueid']]){this[_0x17ce('0xd')][_0x9513d0['uniqueid']]={};this['channels'][_0x9513d0[_0x17ce('0x24')]]['channel']=_0x9513d0[_0x17ce('0x25')];logger[_0x17ce('0x28')](_0x9513d0[_0x17ce('0x24')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x17ce('0x13')]=function(_0x1cba39){if(this[_0x17ce('0xd')][_0x1cba39[_0x17ce('0x24')]]){for(var _0x52d05c in _0x1cba39['variable']){if(_0x1cba39['variable'][_0x17ce('0x29')](_0x52d05c)){this[_0x17ce('0xd')][_0x1cba39[_0x17ce('0x24')]][_0x52d05c]=_0x1cba39[_0x17ce('0x2a')];}}}};Fax['prototype'][_0x17ce('0x2b')]=function(_0x923802){if(this[_0x17ce('0xd')][_0x923802[_0x17ce('0x24')]]){this['channels'][_0x923802[_0x17ce('0x24')]]['channelstate']=_0x923802[_0x17ce('0x2c')];this[_0x17ce('0xd')][_0x923802[_0x17ce('0x24')]]['channelstatedesc']=_0x923802[_0x17ce('0x2d')];}};Fax[_0x17ce('0x1f')][_0x17ce('0x17')]=function(_0x463f20){if(this['channels'][_0x463f20[_0x17ce('0x24')]]){for(var _0x270072 in _0x463f20[_0x17ce('0x2e')]){if(_0x463f20['variable']['hasOwnProperty'](_0x270072)){this[_0x17ce('0xd')][_0x463f20[_0x17ce('0x24')]][_0x270072]=_0x463f20[_0x17ce('0x2a')];}}}};Fax[_0x17ce('0x1f')][_0x17ce('0x19')]=function(_0x4c5d50){if(this[_0x17ce('0xd')][_0x4c5d50['uniqueid']]){this[_0x17ce('0xd')][_0x4c5d50['uniqueid']][_0x17ce('0x2f')]=_0x4c5d50[_0x17ce('0x2f')];this[_0x17ce('0xd')][_0x4c5d50[_0x17ce('0x24')]][_0x17ce('0x30')]=_0x4c5d50[_0x17ce('0x30')];this['channels'][_0x4c5d50[_0x17ce('0x24')]]['localstationid']=_0x4c5d50[_0x17ce('0x23')];this[_0x17ce('0xd')][_0x4c5d50[_0x17ce('0x24')]][_0x17ce('0x31')]=_0x4c5d50[_0x17ce('0x31')];logger[_0x17ce('0x28')](_0x4c5d50['uniqueid'],_0x17ce('0x32'));}};Fax[_0x17ce('0x1f')]['syncReceiveFax']=function(_0xdc51b){var _0x283db6=this;if(this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]]){var _0x1064bf=this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]]['id'];this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x33')]=_0xdc51b['remotestationid'];this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x34')]=_0xdc51b[_0x17ce('0x34')];this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x23')]=_0xdc51b[_0x17ce('0x23')];this['channels'][_0xdc51b[_0x17ce('0x24')]]['resolution']=_0xdc51b[_0x17ce('0x35')];this['channels'][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x36')]=_0xdc51b[_0x17ce('0x36')];this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]]['filename']=_0xdc51b[_0x17ce('0x31')];this['channels'][_0xdc51b[_0x17ce('0x24')]]['calleridnum']=_0xdc51b[_0x17ce('0x37')];if(this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x34')]>0x0){tiff2pdf(_0xdc51b[_0x17ce('0x31')],_0x17ce('0x38'),function(_0x3291ff){logger[_0x17ce('0x28')](_0xdc51b[_0x17ce('0x24')],_0x17ce('0x39'),_0x3291ff[_0x17ce('0x3a')]);attachment[_0x17ce('0x3b')]({'name':path[_0x17ce('0x3c')](_0xdc51b[_0x17ce('0x31')])['name'],'basename':path['parse'](_0xdc51b['filename'])[_0x17ce('0x26')]+_0x17ce('0x3d'),'type':_0x17ce('0x3e')})[_0x17ce('0x3f')](function(_0x5a16c0){faxAccount[_0x17ce('0x40')](_0x1064bf,{'from':_0xdc51b['calleridnum'],'mapKey':_0x17ce('0x41'),'body':path[_0x17ce('0x3c')](_0xdc51b['filename'])[_0x17ce('0x26')]+'.pdf','AttachmentId':_0x5a16c0['id']})['catch'](function(_0x5a02d5){logger[_0x17ce('0x42')](_0xdc51b[_0x17ce('0x24')],'\x20notify\x20',JSON[_0x17ce('0x43')](_0x5a02d5));});})['catch'](function(_0x4e2484){logger[_0x17ce('0x42')](_0xdc51b[_0x17ce('0x24')],_0x17ce('0x44'),JSON['stringify'](_0x4e2484));});});}logger[_0x17ce('0x28')](_0xdc51b['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0x17ce('0x1e')]=function(_0x5b7d24){if(this[_0x17ce('0x45')][_0x5b7d24[_0x17ce('0x24')]]){_['merge'](this[_0x17ce('0xd')][_0x5b7d24[_0x17ce('0x24')]],_['pick'](_0x5b7d24,[_0x17ce('0x46'),_0x17ce('0x47')]));}};function updateStatus(_0x5f5144){if(_0x5f5144[_0x17ce('0x48')]){faxMessage[_0x17ce('0x49')](_0x5f5144[_0x17ce('0x48')],{'failMessage':_0x17ce('0x4a')})[_0x17ce('0x3f')](function(_0x2fb461){ut[_0x17ce('0x4b')](_0x17ce('0x4c'),_0x2fb461);})[_0x17ce('0x4d')](function(_0xa92c49){ut[_0x17ce('0x4b')](_0x17ce('0x4e'),_0xa92c49);});}else{ut[_0x17ce('0x4b')](_0x17ce('0x4f'));}}Fax[_0x17ce('0x1f')]['updateStatus']=function(_0x40d30e,_0x305cbe,_0x213c33){var _0x545873=this;var _0x30bef4={};if(_0x305cbe){_0x30bef4={'read':_0x305cbe};}else{_0x30bef4={'failMessage':_0x213c33};}if(this[_0x17ce('0x45')][_0x40d30e][_0x17ce('0x48')]){faxMessage['update'](this[_0x17ce('0x45')][_0x40d30e][_0x17ce('0x48')],_0x30bef4)['then'](function(_0x417094){ut[_0x17ce('0x4b')](_0x17ce('0x50'),_0x417094);})['catch'](function(_0x24ab11){ut[_0x17ce('0x4b')]('[Fax][Message][NoUpdate1]',_0x24ab11);})[_0x17ce('0x51')](function(){delete _0x545873[_0x17ce('0xd')][_0x40d30e];delete _0x545873[_0x17ce('0x45')][_0x40d30e];});}else{ut[_0x17ce('0x4b')](_0x17ce('0x52'));delete this[_0x17ce('0xd')][_0x40d30e];delete this[_0x17ce('0x45')][_0x40d30e];}};Fax[_0x17ce('0x1f')][_0x17ce('0x1c')]=function(_0x2add8e){var _0x3ca810=this;if(this['channels'][_0x2add8e[_0x17ce('0x24')]]){if(this['actions'][_0x2add8e[_0x17ce('0x24')]]){this['channels'][_0x2add8e[_0x17ce('0x24')]]['id']=this['actions'][_0x2add8e[_0x17ce('0x24')]]['id'];this['channels'][_0x2add8e[_0x17ce('0x24')]]['name']=this[_0x17ce('0x45')][_0x2add8e[_0x17ce('0x24')]]['name'];}logger[_0x17ce('0x28')](_0x2add8e[_0x17ce('0x24')],this[_0x17ce('0x45')][_0x2add8e[_0x17ce('0x24')]]?_0x17ce('0x53'):_0x17ce('0x54'),JSON[_0x17ce('0x43')](this[_0x17ce('0xd')][_0x2add8e[_0x17ce('0x24')]]));if(this[_0x17ce('0x45')][_0x2add8e[_0x17ce('0x24')]]){if(this[_0x17ce('0xd')][_0x2add8e[_0x17ce('0x24')]][_0x17ce('0x55')]>0x0&&this[_0x17ce('0xd')][_0x2add8e['uniqueid']]['faxstatus']==='SUCCESS'){this[_0x17ce('0x56')](_0x2add8e[_0x17ce('0x24')],!![]);}else{this['updateStatus'](_0x2add8e[_0x17ce('0x24')],![],this[_0x17ce('0xd')][_0x2add8e[_0x17ce('0x24')]][_0x17ce('0x57')]?_0x17ce('0x58')+this['channels'][_0x2add8e[_0x17ce('0x24')]][_0x17ce('0x57')]:'SENDING\x20FAILED');}}}};Fax[_0x17ce('0x1f')][_0x17ce('0x59')]=function(_0x3323ca){var _0x5d820e=this;return new BPromise(function(_0x31e395,_0x4360b2){_0x5d820e[_0x17ce('0x5a')](_0x3323ca,_0x5d820e[_0x17ce('0xe')][_0x3323ca[_0x17ce('0x5b')]])[_0x17ce('0x3f')](function(_0x488f3b){ut['logger'](_0x17ce('0x5c'),_0x488f3b);_0x31e395(ut[_0x17ce('0x3a')](_0x17ce('0x5d')));})[_0x17ce('0x4d')](function(_0x2a638a){ut['logger'](_0x17ce('0x5e'),_0x2a638a);updateStatus(_0x3323ca);_0x4360b2(ut[_0x17ce('0x3a')](_0x17ce('0x5f')));});});};Fax[_0x17ce('0x1f')][_0x17ce('0x60')]=function(_0x484962){var _0x51614b=this;return new BPromise(function(_0x3cf0af,_0x5379b8){var _0x170e17=_0x51614b['checkTrunk'](_0x51614b[_0x17ce('0xe')][_0x484962['FaxAccountId']][_0x17ce('0x61')],_0x484962);if(_0x170e17[_0x17ce('0x62')]){_0x3cf0af(ut['message']('Trunk\x20Reachable'));}else{_0x5379b8(ut[_0x17ce('0x3a')](_0x170e17[_0x17ce('0x3a')]));}});};function originate(_0x57fe7e,_0x375816,_0x56c02f){return new BPromise(function(_0x2356d1,_0x157312){if(_0x56c02f){var _0x3c5d5c=util[_0x17ce('0x63')]('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['parse'](_0x57fe7e['path'])['name'],_0x57fe7e[_0x17ce('0x4')]);gs[_0x17ce('0x64')](_0x3c5d5c)['then'](function(){_0x57fe7e[_0x17ce('0x4')]=util[_0x17ce('0x63')](_0x17ce('0x65'),path[_0x17ce('0x3c')](_0x57fe7e[_0x17ce('0x4')])[_0x17ce('0x66')],path[_0x17ce('0x3c')](_0x57fe7e[_0x17ce('0x4')])[_0x17ce('0x26')]);_0x375816['XMF-PATH']=_0x57fe7e['path'];ut[_0x17ce('0x4b')](_0x17ce('0x67'),'');ami[_0x17ce('0x68')](ut[_0x17ce('0x69')](_0x57fe7e,_0x375816))[_0x17ce('0x3f')](function(_0x53c36f){_0x2356d1(_0x53c36f);})['catch'](function(_0x5e5189){_0x157312(_0x5e5189);});})[_0x17ce('0x4d')](function(_0x27a508){_0x157312(_0x27a508);});}else{ami[_0x17ce('0x68')](ut['variablesAction'](_0x57fe7e,_0x375816))[_0x17ce('0x3f')](function(_0x59f341){_0x2356d1(_0x59f341);})[_0x17ce('0x4d')](function(_0x279ed3){_0x157312(_0x279ed3);});}});}Fax[_0x17ce('0x1f')][_0x17ce('0x5a')]=function(_0x4355a8,_0x3dfa0c){var _0x4e4534=this;return new BPromise(function(_0x3f226c,_0x27e0f0){var _0x2affcb=uuid['v4']();var _0x34f2af=ut['addVariables'](_0x4355a8,_0x3dfa0c);_0x4e4534[_0x17ce('0x45')][_0x2affcb]=new Action(_0x2affcb,_0x3dfa0c,_0x4355a8);var _0x22dd32=_0x4e4534['actions'][_0x2affcb];if(path[_0x17ce('0x3c')](_0x4355a8[_0x17ce('0x4')])[_0x17ce('0x6a')]===_0x17ce('0x3d')){originate(_0x22dd32,_0x34f2af,!![])[_0x17ce('0x3f')](function(_0x4f3fcd){_0x3f226c(_0x4f3fcd);})['catch'](function(_0x17f8af){_0x27e0f0(_0x17f8af);});}else{originate(_0x22dd32,_0x34f2af,![])[_0x17ce('0x3f')](function(_0x1b251d){_0x3f226c(_0x1b251d);})[_0x17ce('0x4d')](function(_0x1273ec){_0x27e0f0(_0x1273ec);});}});};Fax[_0x17ce('0x1f')][_0x17ce('0x6b')]=function(_0x5bf7ee){return!_['isNil'](_0x5bf7ee)&&!_[_0x17ce('0x6c')](_0x5bf7ee[_0x17ce('0x26')])&&!_['isNil'](_0x5bf7ee[_0x17ce('0x6d')])&&_0x5bf7ee[_0x17ce('0x6d')]&&!_[_0x17ce('0x6c')](this[_0x17ce('0xf')][util[_0x17ce('0x63')](_0x17ce('0x6e'),_0x5bf7ee['name'])])&&!_[_0x17ce('0x6c')](this[_0x17ce('0xf')][util[_0x17ce('0x63')]('SIP/%s',_0x5bf7ee[_0x17ce('0x26')])][_0x17ce('0x30')])&&(this[_0x17ce('0xf')][util[_0x17ce('0x63')](_0x17ce('0x6e'),_0x5bf7ee[_0x17ce('0x26')])]['status']===_0x17ce('0x6f')||this[_0x17ce('0xf')][util[_0x17ce('0x63')](_0x17ce('0x6e'),_0x5bf7ee[_0x17ce('0x26')])][_0x17ce('0x30')]===_0x17ce('0x70'));};Fax[_0x17ce('0x1f')][_0x17ce('0x71')]=function(_0x951acb,_0x124853){if(!this[_0x17ce('0x6b')](_0x951acb)){ut[_0x17ce('0x4b')](_0x17ce('0x72'),_['isNil'](_0x951acb)?'':_0x951acb[_0x17ce('0x26')]+_0x17ce('0x73'));return{'isValid':![],'message':_0x17ce('0x74')};}if(_[_0x17ce('0x6c')](_0x124853[_0x17ce('0x41')])){ut[_0x17ce('0x4b')](_0x17ce('0x75'),JSON[_0x17ce('0x43')](_0x124853));return{'isValid':![],'message':_0x17ce('0x76')};}if(_[_0x17ce('0x6c')](_0x124853[_0x17ce('0x4')])){ut[_0x17ce('0x4b')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x17ce('0x43')](_0x124853));return{'isValid':![],'message':_0x17ce('0x77')};}return{'isValid':!![],'message':_0x17ce('0x78')};};module[_0x17ce('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 98d2831..d7ca259 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 _0x6e7f=['../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','../../../config/logger','lodash'];(function(_0x209129,_0x2664d4){var _0x120374=function(_0x5b664c){while(--_0x5b664c){_0x209129['push'](_0x209129['shift']());}};_0x120374(++_0x2664d4);}(_0x6e7f,0x198));var _0xf6e7=function(_0xbceef9,_0x2baad2){_0xbceef9=_0xbceef9-0x0;var _0x4581b1=_0x6e7f[_0xbceef9];return _0x4581b1;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xf6e7('0x0'))('preview');var _=require(_0xf6e7('0x1'));var faxAccount=require(_0xf6e7('0x2'));function loggerCatch(_0x468a9f){return function(_0x145409){logger[_0xf6e7('0x3')](_0x468a9f,util[_0xf6e7('0x4')](_0x145409,{'showHidden':![],'depth':null}));};}exports[_0xf6e7('0x5')]=function(_0x2ce375,_0x56d9aa){return BPromise[_0xf6e7('0x6')]()[_0xf6e7('0x7')](faxAccount[_0xf6e7('0x5')](_0x2ce375,_0x56d9aa))[_0xf6e7('0x8')](loggerCatch(_0xf6e7('0x9')));}; \ No newline at end of file +var _0x1567=['inspect','notify','resolve','then','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x51730d,_0xdab6e1){var _0x10ca0d=function(_0xbf64cf){while(--_0xbf64cf){_0x51730d['push'](_0x51730d['shift']());}};_0x10ca0d(++_0xdab6e1);}(_0x1567,0x171));var _0x7156=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1567[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require('util');var BPromise=require(_0x7156('0x0'));var logger=require(_0x7156('0x1'))(_0x7156('0x2'));var _=require(_0x7156('0x3'));var faxAccount=require(_0x7156('0x4'));function loggerCatch(_0x83aaf6){return function(_0x4bd815){logger['error'](_0x83aaf6,util[_0x7156('0x5')](_0x4bd815,{'showHidden':![],'depth':null}));};}exports[_0x7156('0x6')]=function(_0x16839f,_0x4741f5){return BPromise[_0x7156('0x7')]()[_0x7156('0x8')](faxAccount[_0x7156('0x6')](_0x16839f,_0x4741f5))[_0x7156('0x9')](loggerCatch(_0x7156('0xa')));}; \ 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 652b2b0..e90fcb9 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 _0xe441=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','exec','execute'];(function(_0x594374,_0x27bbe1){var _0xb2139f=function(_0x396924){while(--_0x396924){_0x594374['push'](_0x594374['shift']());}};_0xb2139f(++_0x27bbe1);}(_0xe441,0xb3));var _0x1e44=function(_0x3f1ba3,_0x41fd23){_0x3f1ba3=_0x3f1ba3-0x0;var _0x28045a=_0xe441[_0x3f1ba3];return _0x28045a;};'use strict';var util=require('util');var logger=require(_0x1e44('0x0'))('fax');var BPromise=require('bluebird');var exec=require('child_process')[_0x1e44('0x1')];exports[_0x1e44('0x2')]=function(_0x3a4c1d){return new BPromise(function(_0x269b0d,_0x19d596){exec(_0x3a4c1d,function(_0xeef32e,_0x210499,_0x261444){logger[_0x1e44('0x3')](_0x1e44('0x4'),_0x210499);if(_0xeef32e){logger[_0x1e44('0x3')](_0x1e44('0x4'),_0x1e44('0x5'),util[_0x1e44('0x6')](_0xeef32e,{'showHidden':![],'depth':null}),_0x210499,_0x261444);_0x19d596(_0xeef32e);}_0x269b0d(_0x210499);});});}; \ No newline at end of file +var _0x251f=['fax','bluebird','child_process','exec','info','Exec\x20gs','inspect'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x251f,0x181));var _0xf251=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x251f[_0x2160a9];return _0xa88cf7;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0xf251('0x0'));var BPromise=require(_0xf251('0x1'));var exec=require(_0xf251('0x2'))[_0xf251('0x3')];exports['execute']=function(_0x50eaae){return new BPromise(function(_0x1f31ee,_0xf21655){exec(_0x50eaae,function(_0x2e334d,_0x408613,_0x389fa8){logger[_0xf251('0x4')](_0xf251('0x5'),_0x408613);if(_0x2e334d){logger[_0xf251('0x4')](_0xf251('0x5'),'\x20Error\x20:',util[_0xf251('0x6')](_0x2e334d,{'showHidden':![],'depth':null}),_0x408613,_0x389fa8);_0xf21655(_0x2e334d);}_0x1f31ee(_0x408613);});});}; \ 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 ac939ab..473007d 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 _0x24ab=['../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate','maxrate','format','faxdetect','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x24ab,0x1c9));var _0xb24a=function(_0x20bdb3,_0x3a6456){_0x20bdb3=_0x20bdb3-0x0;var _0x3ff02a=_0x24ab[_0x20bdb3];return _0x3ff02a;};'use strict';var util=require(_0xb24a('0x0'));var _=require(_0xb24a('0x1'));var moment=require(_0xb24a('0x2'));var logger=require(_0xb24a('0x3'))(_0xb24a('0x4'));exports[_0xb24a('0x5')]=function(_0x36c489){return{'message':_0x36c489};};exports[_0xb24a('0x6')]=function(_0x11b3d1,_0x3d5117){logger[_0xb24a('0x7')](_0x11b3d1,util[_0xb24a('0x8')](_0x3d5117,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1cf4a0,_0x1bb40f){var _0x4db52c={'XMF-ECM':_0x1bb40f[_0xb24a('0x9')],'XMF-HEADERINFO':_0x1bb40f['headerinfo'],'XMF-MINRATE':_0x1bb40f[_0xb24a('0xa')],'XMF-MAXRATE':_0x1bb40f[_0xb24a('0xb')],'XMF-MODEM':util[_0xb24a('0xc')]('\x22%s\x22',_0x1bb40f['modem']),'XMF-GATEWAY':_0x1bb40f['gateway'],'XMF-FAXDETECT':_0x1bb40f[_0xb24a('0xd')],'XMF-T38TIMEOUT':_0x1bb40f['t38timeout'],'XMF-LOCALSTATIONID':_0x1bb40f[_0xb24a('0xe')],'XMF-PATH':_0x1cf4a0[_0xb24a('0xf')]};return _0x4db52c;};exports[_0xb24a('0x10')]=function(_0x26ef91,_0x1bb638){return{'actionid':_0x26ef91[_0xb24a('0x11')],'action':_0xb24a('0x12'),'channel':_0x26ef91['channel'],'Exten':_0xb24a('0x13'),'Context':_0xb24a('0x14'),'Priority':'1','callerid':util[_0xb24a('0xc')](_0xb24a('0x15'),_0x26ef91['headerinfo']?_0x26ef91[_0xb24a('0x16')]:'',_0x26ef91[_0xb24a('0xe')]),'variable':_0x1bb638,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x26ef91[_0xb24a('0x11')]};}; \ No newline at end of file +var _0xc9ef=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','path','variablesAction','uniqueid','originate'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xc9ef,0xa4));var _0xfc9e=function(_0x401936,_0x4acf75){_0x401936=_0x401936-0x0;var _0x350b85=_0xc9ef[_0x401936];return _0x350b85;};'use strict';var util=require(_0xfc9e('0x0'));var _=require(_0xfc9e('0x1'));var moment=require(_0xfc9e('0x2'));var logger=require(_0xfc9e('0x3'))(_0xfc9e('0x4'));exports['message']=function(_0x226470){return{'message':_0x226470};};exports[_0xfc9e('0x5')]=function(_0x277cc4,_0x1a8a4b){logger[_0xfc9e('0x6')](_0x277cc4,util[_0xfc9e('0x7')](_0x1a8a4b,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x21880f,_0x5eab65){var _0xe0967c={'XMF-ECM':_0x5eab65[_0xfc9e('0x8')],'XMF-HEADERINFO':_0x5eab65[_0xfc9e('0x9')],'XMF-MINRATE':_0x5eab65[_0xfc9e('0xa')],'XMF-MAXRATE':_0x5eab65[_0xfc9e('0xb')],'XMF-MODEM':util[_0xfc9e('0xc')](_0xfc9e('0xd'),_0x5eab65[_0xfc9e('0xe')]),'XMF-GATEWAY':_0x5eab65['gateway'],'XMF-FAXDETECT':_0x5eab65['faxdetect'],'XMF-T38TIMEOUT':_0x5eab65[_0xfc9e('0xf')],'XMF-LOCALSTATIONID':_0x5eab65['localstationid'],'XMF-PATH':_0x21880f[_0xfc9e('0x10')]};return _0xe0967c;};exports[_0xfc9e('0x11')]=function(_0x53d31c,_0xdd46){return{'actionid':_0x53d31c[_0xfc9e('0x12')],'action':_0xfc9e('0x13'),'channel':_0x53d31c['channel'],'Exten':_0xfc9e('0x14'),'Context':_0xfc9e('0x15'),'Priority':'1','callerid':util[_0xfc9e('0xc')](_0xfc9e('0x16'),_0x53d31c['headerinfo']?_0x53d31c[_0xfc9e('0x9')]:'',_0x53d31c['localstationid']),'variable':_0xdd46,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x53d31c[_0xfc9e('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f448d72..e06128a 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 _0xf3b4=['inspect','listen','[index.js][main]','moment','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents','getTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]'];(function(_0x4a7a43,_0x2ebf66){var _0x52329f=function(_0x3f6539){while(--_0x3f6539){_0x4a7a43['push'](_0x4a7a43['shift']());}};_0x52329f(++_0x2ebf66);}(_0xf3b4,0x10b));var _0x4f3b=function(_0x3d3a6e,_0x252431){_0x3d3a6e=_0x3d3a6e-0x0;var _0x3b0087=_0xf3b4[_0x3d3a6e];return _0x3b0087;};'use strict';var util=require('util');var moment=require(_0x4f3b('0x0'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x4f3b('0x1'));var Acw=require(_0x4f3b('0x2'));var Trigger=require(_0x4f3b('0x3'));var Dialer=require('./dialer');var Preview=require(_0x4f3b('0x4'));var Fax=require('./fax');var user=require(_0x4f3b('0x5'));var voiceQueue=require(_0x4f3b('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x4f3b('0x7'));var trunk=require(_0x4f3b('0x8'));var trigger=require(_0x4f3b('0x9'));var template=require(_0x4f3b('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x4f3b('0xb'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x4f3b('0xc'));var salesforce=require(_0x4f3b('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x4f3b('0xe'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x4f3b('0xf'));var freshsales=require(_0x4f3b('0x10'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x4f3b('0x11'));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(_0x4f3b('0x12'))(_0x4f3b('0x13'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x4f3b('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4f3b('0x15')](_0x4f3b('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4f3b('0x16')]()['then'](user[_0x4f3b('0x17')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x19')]())['then'](user[_0x4f3b('0x1a')]())['then'](realtime['initTelephones']())[_0x4f3b('0x18')](trunk['getTrunks']())[_0x4f3b('0x18')](realtime['initTrunks']())[_0x4f3b('0x18')](voiceQueue[_0x4f3b('0x1b')]())['then'](realtime[_0x4f3b('0x1c')]())[_0x4f3b('0x18')](trigger[_0x4f3b('0x1d')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x1e')]())['then'](template[_0x4f3b('0x1f')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x20')]())[_0x4f3b('0x18')](zendesk[_0x4f3b('0x21')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x22')]())['then'](salesforce[_0x4f3b('0x23')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x24')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x4f3b('0x18')](realtime[_0x4f3b('0x25')]())[_0x4f3b('0x18')](freshdesk[_0x4f3b('0x26')]())['then'](realtime[_0x4f3b('0x27')]())[_0x4f3b('0x18')](desk[_0x4f3b('0x28')]())[_0x4f3b('0x18')](realtime['initDeskAccounts']())[_0x4f3b('0x18')](zoho[_0x4f3b('0x29')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x2a')]())[_0x4f3b('0x18')](vtiger['getVtigerAccounts']())[_0x4f3b('0x18')](realtime[_0x4f3b('0x2b')]())[_0x4f3b('0x18')](freshsales['getFreshsalesAccounts']())[_0x4f3b('0x18')](realtime[_0x4f3b('0x2c')]())[_0x4f3b('0x18')](servicenow[_0x4f3b('0x2d')]())[_0x4f3b('0x18')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x4f3b('0x2e')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x2f')]())[_0x4f3b('0x18')](campaign['getCampaigns']())[_0x4f3b('0x18')](realtime[_0x4f3b('0x30')]())[_0x4f3b('0x18')](voiceExtension[_0x4f3b('0x31')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x32')]())['then'](faxAccount[_0x4f3b('0x33')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x34')]())[_0x4f3b('0x18')](function(){return realtime;});}function initParams(){return Promise[_0x4f3b('0x16')]()[_0x4f3b('0x18')](voiceQueueReport[_0x4f3b('0x35')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x36')]())[_0x4f3b('0x18')](cmHopperHistory[_0x4f3b('0x37')]())[_0x4f3b('0x18')](realtime[_0x4f3b('0x38')]())[_0x4f3b('0x18')](cmHopperHistory[_0x4f3b('0x39')]())['then'](realtime[_0x4f3b('0x3a')]())[_0x4f3b('0x18')](voiceCallReport[_0x4f3b('0x3b')]())[_0x4f3b('0x18')](realtime['initVoiceCallReports']())[_0x4f3b('0x3c')](function(_0x367d2a){logger[_0x4f3b('0x3d')](_0x4f3b('0x3e'),util[_0x4f3b('0x3f')](_0x367d2a,{'showHidden':![],'depth':null}));});}function main(){return server[_0x4f3b('0x40')](realtime,preview,fax)[_0x4f3b('0x18')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x4f3b('0x18')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x4f3b('0x3c')](function(_0x5193ed){logger[_0x4f3b('0x3d')](_0x4f3b('0x41'),util['inspect'](_0x5193ed,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xc0b7=['then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','inspect','listen','catch','[index.js][main]','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve'];(function(_0x2fbd91,_0x46b020){var _0xdf8756=function(_0x1e19a1){while(--_0x1e19a1){_0x2fbd91['push'](_0x2fbd91['shift']());}};_0xdf8756(++_0x46b020);}(_0xc0b7,0x14f));var _0x7c0b=function(_0xc8d438,_0x3768fd){_0xc8d438=_0xc8d438-0x0;var _0x515c8b=_0xc0b7[_0xc8d438];return _0x515c8b;};'use strict';var util=require(_0x7c0b('0x0'));var moment=require(_0x7c0b('0x1'));var server=require(_0x7c0b('0x2'));var Realtime=require('./realtime');var Report=require(_0x7c0b('0x3'));var Acw=require(_0x7c0b('0x4'));var Trigger=require(_0x7c0b('0x5'));var Dialer=require(_0x7c0b('0x6'));var Preview=require(_0x7c0b('0x7'));var Fax=require(_0x7c0b('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x7c0b('0x9'));var voiceQueueReport=require(_0x7c0b('0xa'));var voiceCallReport=require(_0x7c0b('0xb'));var trunk=require(_0x7c0b('0xc'));var trigger=require(_0x7c0b('0xd'));var template=require(_0x7c0b('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x7c0b('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7c0b('0x10'));var zendesk=require(_0x7c0b('0x11'));var salesforce=require(_0x7c0b('0x12'));var sugarcrm=require(_0x7c0b('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x7c0b('0x14'));var zoho=require(_0x7c0b('0x15'));var vtiger=require(_0x7c0b('0x16'));var freshsales=require(_0x7c0b('0x17'));var servicenow=require(_0x7c0b('0x18'));var dynamics365=require(_0x7c0b('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(_0x7c0b('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7c0b('0x1b')](_0x7c0b('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x7c0b('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7c0b('0x1d')]()[_0x7c0b('0x1e')](user[_0x7c0b('0x1f')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x20')]())['then'](user[_0x7c0b('0x21')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x22')]())[_0x7c0b('0x1e')](trunk[_0x7c0b('0x23')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x24')]())[_0x7c0b('0x1e')](voiceQueue['getVoiceQueues']())[_0x7c0b('0x1e')](realtime['initVoiceQueues']())[_0x7c0b('0x1e')](trigger[_0x7c0b('0x25')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x26')]())[_0x7c0b('0x1e')](template[_0x7c0b('0x27')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x28')]())[_0x7c0b('0x1e')](zendesk[_0x7c0b('0x29')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x2a')]())[_0x7c0b('0x1e')](salesforce['getSalesforceAccounts']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x2b')]())[_0x7c0b('0x1e')](sugarcrm[_0x7c0b('0x2c')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x2d')]())[_0x7c0b('0x1e')](freshdesk['getFreshdeskAccounts']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x2e')]())[_0x7c0b('0x1e')](desk[_0x7c0b('0x2f')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x30')]())[_0x7c0b('0x1e')](zoho[_0x7c0b('0x31')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x32')]())[_0x7c0b('0x1e')](vtiger[_0x7c0b('0x33')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x34')]())[_0x7c0b('0x1e')](freshsales[_0x7c0b('0x35')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x36')]())[_0x7c0b('0x1e')](servicenow['getServicenowAccounts']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x37')]())[_0x7c0b('0x1e')](dynamics365[_0x7c0b('0x38')]())['then'](realtime[_0x7c0b('0x39')]())['then'](campaign[_0x7c0b('0x3a')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x3b')]())[_0x7c0b('0x1e')](voiceExtension[_0x7c0b('0x3c')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x3d')]())[_0x7c0b('0x1e')](faxAccount[_0x7c0b('0x3e')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x3f')]())[_0x7c0b('0x1e')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0x7c0b('0x40')]())[_0x7c0b('0x1e')](realtime['initVoiceQueueReports']())[_0x7c0b('0x1e')](cmHopperHistory[_0x7c0b('0x41')]())[_0x7c0b('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x7c0b('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x42')]())[_0x7c0b('0x1e')](voiceCallReport['getVoiceCallReports']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x43')]())['catch'](function(_0x269bf9){logger[_0x7c0b('0x44')]('[index.js][initParams]',util[_0x7c0b('0x45')](_0x269bf9,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7c0b('0x46')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x7c0b('0x47')](function(_0x59661e){logger[_0x7c0b('0x44')](_0x7c0b('0x48'),util[_0x7c0b('0x45')](_0x59661e,{'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 8bd3b44..c4db869 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 _0xde6c=['prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','email','address','onhold','format','user:%s','emit','user:ami:update','user:presence','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','accountcode','fullname','state','unknown','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local'];(function(_0x777456,_0x57998f){var _0x5895b0=function(_0x3b9ce4){while(--_0x3b9ce4){_0x777456['push'](_0x777456['shift']());}};_0x5895b0(++_0x57998f);}(_0xde6c,0x119));var _0xcde6=function(_0x5114aa,_0x4596b9){_0x5114aa=_0x5114aa-0x0;var _0x1841bc=_0xde6c[_0x5114aa];return _0x1841bc;};'use strict';var _=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var moment=require('moment');var Redis=require(_0xcde6('0x2'));var config=require(_0xcde6('0x3'));config[_0xcde6('0x4')]=_[_0xcde6('0x5')](config['redis'],{'host':_0xcde6('0x6'),'port':0x18eb});var io=require(_0xcde6('0x7'))(new Redis(config[_0xcde6('0x4')]));function Agent(_0x59bc91){this['id']=_0x59bc91['id']||0x0;this[_0xcde6('0x8')]=_0x59bc91[_0xcde6('0x8')]||'';this['email']=_0x59bc91['email']||'';this[_0xcde6('0x9')]=_0x59bc91['accountcode']||'';this[_0xcde6('0xa')]=_0x59bc91[_0xcde6('0xa')]||'';this[_0xcde6('0xb')]=_0xcde6('0xc');this['stateTime']=0x0;this[_0xcde6('0xd')]=_0xcde6('0xc');this['address']='';this[_0xcde6('0xe')]='';this[_0xcde6('0xf')]='';this[_0xcde6('0x10')]='';this[_0xcde6('0x11')]=_0x59bc91[_0xcde6('0x11')]||![];this[_0xcde6('0x12')]=_0xcde6('0xc');this[_0xcde6('0x13')]=0x0;this[_0xcde6('0x14')]='';this[_0xcde6('0x15')]='';this['onhold']=![];this[_0xcde6('0x16')]=![];}Agent[_0xcde6('0x17')][_0xcde6('0x18')]=function(_0x33dbdb){if(!_0x33dbdb[_0xcde6('0xb')]){return;}var _0x35ce40=null;var _0xf78084=_0x33dbdb[_0xcde6('0xb')][_0xcde6('0x19')]();switch(_0xf78084){case _0xcde6('0x1a'):_0xf78084='idle';break;case _0xcde6('0x1b'):_0xf78084=_0xcde6('0x1c');break;}if(this[_0xcde6('0x12')]!==_0xf78084||_0x33dbdb['statePause']){_0x35ce40=_['toNumber'](moment()['format']('x'));}var _0x44451e={'id':this['id'],'name':this['name'],'email':this[_0xcde6('0x1d')],'accountcode':this[_0xcde6('0x9')],'fullname':this['fullname'],'state':this[_0xcde6('0xb')],'stateTime':this['stateTime'],'status':this[_0xcde6('0xd')],'address':this[_0xcde6('0x1e')],'voiceStatus':_0xf78084||this[_0xcde6('0x12')],'voiceStatusTime':_0x35ce40||this[_0xcde6('0x13')],'voiceStatusCallerIdNumber':this[_0xcde6('0x14')],'voiceStatusQueue':this[_0xcde6('0x15')],'interface':this[_0xcde6('0x10')],'onhold':this[_0xcde6('0x1f')]};if(this['voiceStatus']!==_0xf78084){this[_0xcde6('0x12')]=_0xf78084;io['to'](util[_0xcde6('0x20')](_0xcde6('0x21'),_0x44451e['name']))[_0xcde6('0x22')](_0xcde6('0x23'),_0x44451e);io['emit'](_0xcde6('0x24'),_0x44451e);}};module[_0xcde6('0x25')]=Agent; \ No newline at end of file +var _0xea89=['prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','talking','statePause','toNumber','format','onhold','emit','user:ami:update','user:presence','lodash','util','moment','ioredis','../../../config/environment','defaults','localhost','redis','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xea89,0x1e2));var _0x9ea8=function(_0x389265,_0x272da7){_0x389265=_0x389265-0x0;var _0x593345=_0xea89[_0x389265];return _0x593345;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var moment=require(_0x9ea8('0x2'));var Redis=require(_0x9ea8('0x3'));var config=require(_0x9ea8('0x4'));config['redis']=_[_0x9ea8('0x5')](config['redis'],{'host':_0x9ea8('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ea8('0x7')]));function Agent(_0x3ec628){this['id']=_0x3ec628['id']||0x0;this[_0x9ea8('0x8')]=_0x3ec628[_0x9ea8('0x8')]||'';this[_0x9ea8('0x9')]=_0x3ec628[_0x9ea8('0x9')]||'';this[_0x9ea8('0xa')]=_0x3ec628['accountcode']||'';this[_0x9ea8('0xb')]=_0x3ec628[_0x9ea8('0xb')]||'';this['state']=_0x9ea8('0xc');this[_0x9ea8('0xd')]=0x0;this[_0x9ea8('0xe')]='unknown';this[_0x9ea8('0xf')]='';this[_0x9ea8('0x10')]='';this[_0x9ea8('0x11')]='';this[_0x9ea8('0x12')]='';this[_0x9ea8('0x13')]=_0x3ec628[_0x9ea8('0x13')]||![];this[_0x9ea8('0x14')]='unknown';this[_0x9ea8('0x15')]=0x0;this[_0x9ea8('0x16')]='';this[_0x9ea8('0x17')]='';this['onhold']=![];this[_0x9ea8('0x18')]=![];}Agent[_0x9ea8('0x19')][_0x9ea8('0x1a')]=function(_0x1b8bd6){if(!_0x1b8bd6[_0x9ea8('0x1b')]){return;}var _0x19324d=null;var _0x8d81f7=_0x1b8bd6['state'][_0x9ea8('0x1c')]();switch(_0x8d81f7){case _0x9ea8('0x1d'):_0x8d81f7=_0x9ea8('0x1e');break;case'inuse':_0x8d81f7=_0x9ea8('0x1f');break;}if(this['voiceStatus']!==_0x8d81f7||_0x1b8bd6[_0x9ea8('0x20')]){_0x19324d=_[_0x9ea8('0x21')](moment()[_0x9ea8('0x22')]('x'));}var _0x475fcf={'id':this['id'],'name':this[_0x9ea8('0x8')],'email':this[_0x9ea8('0x9')],'accountcode':this[_0x9ea8('0xa')],'fullname':this['fullname'],'state':this[_0x9ea8('0x1b')],'stateTime':this[_0x9ea8('0xd')],'status':this[_0x9ea8('0xe')],'address':this[_0x9ea8('0xf')],'voiceStatus':_0x8d81f7||this[_0x9ea8('0x14')],'voiceStatusTime':_0x19324d||this[_0x9ea8('0x15')],'voiceStatusCallerIdNumber':this[_0x9ea8('0x16')],'voiceStatusQueue':this[_0x9ea8('0x17')],'interface':this[_0x9ea8('0x12')],'onhold':this[_0x9ea8('0x23')]};if(this[_0x9ea8('0x14')]!==_0x8d81f7){this['voiceStatus']=_0x8d81f7;io['to'](util[_0x9ea8('0x22')]('user:%s',_0x475fcf[_0x9ea8('0x8')]))[_0x9ea8('0x24')](_0x9ea8('0x25'),_0x475fcf);io[_0x9ea8('0x24')](_0x9ea8('0x26'),_0x475fcf);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ebe343d..578c66a 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 _0xc893=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x25ede0,_0x29dc39){var _0x16fc37=function(_0x13e4d1){while(--_0x13e4d1){_0x25ede0['push'](_0x25ede0['shift']());}};_0x16fc37(++_0x29dc39);}(_0xc893,0x126));var _0x3c89=function(_0x59d35c,_0x3968fc){_0x59d35c=_0x59d35c-0x0;var _0x34628b=_0xc893[_0x59d35c];return _0x34628b;};'use strict';function Campaign(_0x4a0101){this['id']=_0x4a0101['id']||0x0;this[_0x3c89('0x0')]=_0x4a0101['name']||'';this['type']=_0x4a0101[_0x3c89('0x1')]||_0x3c89('0x2');this['originated']=0x0;this[_0x3c89('0x3')]=0x0;this[_0x3c89('0x4')]=0x0;this[_0x3c89('0x5')]=0x0;this[_0x3c89('0x6')]='';this[_0x3c89('0x7')]=!![];this[_0x3c89('0x8')]=_0x4a0101[_0x3c89('0x8')];this[_0x3c89('0x9')]=_0x4a0101[_0x3c89('0x9')];this[_0x3c89('0xa')]=_0x4a0101[_0x3c89('0xa')]||null;this[_0x3c89('0xb')]=_0x4a0101['dialGlobalInterval']?_0x4a0101[_0x3c89('0xb')]:null;this['dialOriginateCallerIdName']=_0x4a0101['dialOriginateCallerIdName'];this[_0x3c89('0xc')]=_0x4a0101[_0x3c89('0xc')];this[_0x3c89('0xd')]=_0x4a0101[_0x3c89('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x4a0101[_0x3c89('0xe')];this[_0x3c89('0xf')]=_0x4a0101['dialCongestionRetryFrequency'];this[_0x3c89('0x10')]=_0x4a0101[_0x3c89('0x10')];this[_0x3c89('0x11')]=_0x4a0101[_0x3c89('0x11')];this[_0x3c89('0x12')]=_0x4a0101[_0x3c89('0x12')];this[_0x3c89('0x13')]=_0x4a0101[_0x3c89('0x13')];this['dialGlobalMaxRetry']=_0x4a0101[_0x3c89('0x14')];this[_0x3c89('0x15')]=_0x4a0101[_0x3c89('0x15')]||0x3;this[_0x3c89('0x16')]=_0x4a0101[_0x3c89('0x16')]||0x96;this[_0x3c89('0x17')]=_0x4a0101[_0x3c89('0x17')]||0x3;this[_0x3c89('0x18')]=_0x4a0101[_0x3c89('0x18')]||0x96;this[_0x3c89('0x19')]=_0x4a0101[_0x3c89('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x4a0101[_0x3c89('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x4a0101[_0x3c89('0x1b')]||0x3;this[_0x3c89('0x1c')]=_0x4a0101[_0x3c89('0x1c')]||0x96;this[_0x3c89('0x1d')]=_0x4a0101[_0x3c89('0x1d')]||0x3;this[_0x3c89('0x1e')]=_0x4a0101[_0x3c89('0x1e')]||0x96;this[_0x3c89('0x1f')]=_0x4a0101[_0x3c89('0x1f')]||'DESC';this[_0x3c89('0x20')]=_0x4a0101[_0x3c89('0x20')]||undefined;this[_0x3c89('0x21')]=_0x4a0101[_0x3c89('0x21')]||undefined;this[_0x3c89('0x22')]=_0x4a0101[_0x3c89('0x22')]||undefined;this[_0x3c89('0x23')]=_0x4a0101['TrunkBackup']?_0x4a0101[_0x3c89('0x23')]:undefined;this['Trunk']=_0x4a0101['Trunk']?_0x4a0101['Trunk']:undefined;this[_0x3c89('0x24')]=_0x4a0101[_0x3c89('0x24')]?_0x4a0101[_0x3c89('0x24')]:undefined;this['SquareProject']=_0x4a0101['SquareProject']?_0x4a0101[_0x3c89('0x25')]:undefined;this[_0x3c89('0x26')]=_0x4a0101[_0x3c89('0x25')]?_0x4a0101[_0x3c89('0x25')][_0x3c89('0x0')]:undefined;this[_0x3c89('0x27')]=_0x4a0101[_0x3c89('0x27')]||![];this[_0x3c89('0x28')]=_0x4a0101[_0x3c89('0x28')];this[_0x3c89('0x29')]=_0x4a0101[_0x3c89('0x29')];this[_0x3c89('0x2a')]=_0x4a0101[_0x3c89('0x2a')];this[_0x3c89('0x2b')]=_0x4a0101['dialAMDTotalAnalysisTime'];this[_0x3c89('0x2c')]=_0x4a0101['dialAMDMinWordLength'];this[_0x3c89('0x2d')]=_0x4a0101[_0x3c89('0x2d')];this[_0x3c89('0x2e')]=_0x4a0101[_0x3c89('0x2e')];this[_0x3c89('0x2f')]=_0x4a0101[_0x3c89('0x2f')];this['dialAMDMaximumWordLength']=_0x4a0101['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0xd3db=['type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name'];(function(_0x260f8f,_0x238a09){var _0x224b24=function(_0x2fdde3){while(--_0x2fdde3){_0x260f8f['push'](_0x260f8f['shift']());}};_0x224b24(++_0x238a09);}(_0xd3db,0x1b8));var _0xbd3d=function(_0x5efdbb,_0x539a9c){_0x5efdbb=_0x5efdbb-0x0;var _0xad34c=_0xd3db[_0x5efdbb];return _0xad34c;};'use strict';function Campaign(_0x1ab8e5){this['id']=_0x1ab8e5['id']||0x0;this[_0xbd3d('0x0')]=_0x1ab8e5[_0xbd3d('0x0')]||'';this[_0xbd3d('0x1')]=_0x1ab8e5[_0xbd3d('0x1')]||_0xbd3d('0x2');this[_0xbd3d('0x3')]=0x0;this[_0xbd3d('0x4')]=0x0;this[_0xbd3d('0x5')]=0x0;this[_0xbd3d('0x6')]=0x0;this['message']='';this[_0xbd3d('0x7')]=!![];this[_0xbd3d('0x8')]=_0x1ab8e5[_0xbd3d('0x8')];this['limitCalls']=_0x1ab8e5['limitCalls'];this['dialTimezone']=_0x1ab8e5[_0xbd3d('0x9')]||null;this[_0xbd3d('0xa')]=_0x1ab8e5[_0xbd3d('0xa')]?_0x1ab8e5[_0xbd3d('0xa')]:null;this['dialOriginateCallerIdName']=_0x1ab8e5[_0xbd3d('0xb')];this[_0xbd3d('0xc')]=_0x1ab8e5[_0xbd3d('0xc')];this['dialOriginateTimeout']=_0x1ab8e5[_0xbd3d('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x1ab8e5[_0xbd3d('0xe')];this[_0xbd3d('0xf')]=_0x1ab8e5['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x1ab8e5[_0xbd3d('0x10')];this[_0xbd3d('0x11')]=_0x1ab8e5[_0xbd3d('0x11')];this[_0xbd3d('0x12')]=_0x1ab8e5['dialNoAnswerMaxRetry'];this[_0xbd3d('0x13')]=_0x1ab8e5[_0xbd3d('0x13')];this[_0xbd3d('0x14')]=_0x1ab8e5[_0xbd3d('0x14')];this[_0xbd3d('0x15')]=_0x1ab8e5[_0xbd3d('0x15')]||0x3;this[_0xbd3d('0x16')]=_0x1ab8e5['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x1ab8e5[_0xbd3d('0x17')]||0x3;this[_0xbd3d('0x18')]=_0x1ab8e5[_0xbd3d('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x1ab8e5[_0xbd3d('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x1ab8e5[_0xbd3d('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x1ab8e5['dialMachineMaxRetry']||0x3;this[_0xbd3d('0x1b')]=_0x1ab8e5[_0xbd3d('0x1b')]||0x96;this[_0xbd3d('0x1c')]=_0x1ab8e5[_0xbd3d('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1ab8e5[_0xbd3d('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x1ab8e5[_0xbd3d('0x1e')]||'DESC';this[_0xbd3d('0x1f')]=_0x1ab8e5[_0xbd3d('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1ab8e5[_0xbd3d('0x20')]||undefined;this['dialCutDigit']=_0x1ab8e5[_0xbd3d('0x21')]||undefined;this[_0xbd3d('0x22')]=_0x1ab8e5[_0xbd3d('0x22')]?_0x1ab8e5['TrunkBackup']:undefined;this[_0xbd3d('0x23')]=_0x1ab8e5[_0xbd3d('0x23')]?_0x1ab8e5[_0xbd3d('0x23')]:undefined;this['Interval']=_0x1ab8e5[_0xbd3d('0x24')]?_0x1ab8e5[_0xbd3d('0x24')]:undefined;this[_0xbd3d('0x25')]=_0x1ab8e5[_0xbd3d('0x25')]?_0x1ab8e5[_0xbd3d('0x25')]:undefined;this[_0xbd3d('0x26')]=_0x1ab8e5[_0xbd3d('0x25')]?_0x1ab8e5[_0xbd3d('0x25')][_0xbd3d('0x0')]:undefined;this[_0xbd3d('0x27')]=_0x1ab8e5[_0xbd3d('0x27')]||![];this[_0xbd3d('0x28')]=_0x1ab8e5[_0xbd3d('0x28')];this['dialAMDGreeting']=_0x1ab8e5[_0xbd3d('0x29')];this[_0xbd3d('0x2a')]=_0x1ab8e5[_0xbd3d('0x2a')];this[_0xbd3d('0x2b')]=_0x1ab8e5[_0xbd3d('0x2b')];this[_0xbd3d('0x2c')]=_0x1ab8e5[_0xbd3d('0x2c')];this[_0xbd3d('0x2d')]=_0x1ab8e5[_0xbd3d('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x1ab8e5[_0xbd3d('0x2e')];this['dialAMDSilenceThreshold']=_0x1ab8e5['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x1ab8e5[_0xbd3d('0x2f')];}module[_0xbd3d('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a245180..30fd31c 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 _0x40af=['exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime'];(function(_0x176a6c,_0x1ab0c6){var _0x5de870=function(_0x3bb69c){while(--_0x3bb69c){_0x176a6c['push'](_0x176a6c['shift']());}};_0x5de870(++_0x1ab0c6);}(_0x40af,0x8d));var _0xf40a=function(_0x48d540,_0x9ce255){_0x48d540=_0x48d540-0x0;var _0x55cc39=_0x40af[_0x48d540];return _0x55cc39;};'use strict';function Channel(){this['starttime']=null;this[_0xf40a('0x0')]='';this[_0xf40a('0x1')]='';this[_0xf40a('0x2')]=0x0;this[_0xf40a('0x3')]='';this[_0xf40a('0x4')]=undefined;this[_0xf40a('0x5')]=undefined;this[_0xf40a('0x6')]=0x0;this[_0xf40a('0x7')]='';this[_0xf40a('0x8')]=0x0;this[_0xf40a('0x9')]=0x0;this[_0xf40a('0xa')]=0x0;this['answered']=![];this[_0xf40a('0xb')]=null;this[_0xf40a('0xc')]=null;this[_0xf40a('0xd')]=![];this['abandoned']=![];this[_0xf40a('0xe')]='';this[_0xf40a('0xf')]='';this[_0xf40a('0x10')]=0x0;this['billableseconds']=0x0;this[_0xf40a('0x11')]=0x0;this[_0xf40a('0x12')]=null;this[_0xf40a('0x13')]=null;this[_0xf40a('0x14')]=null;this['monitor']=![];this[_0xf40a('0x15')]=null;this[_0xf40a('0x16')]=null;this[_0xf40a('0x17')]=[];this['transfercalleridnum']=undefined;this[_0xf40a('0x18')]=undefined;this[_0xf40a('0x19')]=undefined;this[_0xf40a('0x1a')]=0x0;}module[_0xf40a('0x1b')]=Channel; \ No newline at end of file +var _0x87e5=['uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinename','accountcode','context'];(function(_0xf392ee,_0x4293c3){var _0x2b18b6=function(_0x4e154f){while(--_0x4e154f){_0xf392ee['push'](_0xf392ee['shift']());}};_0x2b18b6(++_0x4293c3);}(_0x87e5,0xc1));var _0x587e=function(_0x128443,_0x2fe025){_0x128443=_0x128443-0x0;var _0x1a4ce1=_0x87e5[_0x128443];return _0x1a4ce1;};'use strict';function Channel(){this[_0x587e('0x0')]=null;this[_0x587e('0x1')]='';this['destinationchannel']='';this[_0x587e('0x2')]=0x0;this[_0x587e('0x3')]='';this['connectedlinenum']=undefined;this[_0x587e('0x4')]=undefined;this[_0x587e('0x5')]=0x0;this[_0x587e('0x6')]='';this[_0x587e('0x7')]=0x0;this[_0x587e('0x8')]=0x0;this[_0x587e('0x9')]=0x0;this['answered']=![];this[_0x587e('0xa')]=null;this[_0x587e('0xb')]=null;this[_0x587e('0xc')]=![];this[_0x587e('0xd')]=![];this[_0x587e('0xe')]='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0x587e('0xf')]=null;this[_0x587e('0x10')]=null;this[_0x587e('0x11')]=![];this[_0x587e('0x12')]=null;this[_0x587e('0x13')]=null;this[_0x587e('0x14')]=[];this[_0x587e('0x15')]=undefined;this[_0x587e('0x16')]=undefined;this[_0x587e('0x17')]=undefined;this[_0x587e('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b3b3f38..9bb5470 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 _0xddf2=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xddf2,0x1da));var _0x2ddf=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xddf2[_0x3ab51d];return _0x29a04e;};'use strict';function DeskAccount(_0x232018){this['id']=_0x232018['id']||0x0;this[_0x2ddf('0x0')]=_0x232018[_0x2ddf('0x0')]||'';this[_0x2ddf('0x1')]=_0x232018[_0x2ddf('0x1')]||'';this['remoteUri']=_0x232018[_0x2ddf('0x2')]||'';this[_0x2ddf('0x3')]=_0x232018[_0x2ddf('0x3')]||'';this[_0x2ddf('0x4')]=_0x232018[_0x2ddf('0x4')]||'';this[_0x2ddf('0x5')]=_0x232018[_0x2ddf('0x5')]||'';this['consumerSecret']=_0x232018[_0x2ddf('0x6')]||'';this[_0x2ddf('0x7')]=_0x232018[_0x2ddf('0x7')]||'';this[_0x2ddf('0x8')]=_0x232018[_0x2ddf('0x8')]||'';this[_0x2ddf('0x9')]=_0x232018['type']||'';this[_0x2ddf('0xa')]=_0x232018[_0x2ddf('0xa')]||'';this[_0x2ddf('0xb')]=_0x232018['Configurations']||{};}module[_0x2ddf('0xc')]=DeskAccount; \ No newline at end of file +var _0x48a6=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret','type','serverUrl'];(function(_0x3f1504,_0x1a9318){var _0x17177f=function(_0x39f214){while(--_0x39f214){_0x3f1504['push'](_0x3f1504['shift']());}};_0x17177f(++_0x1a9318);}(_0x48a6,0xf2));var _0x648a=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0x48a6[_0x15106b];return _0x521203;};'use strict';function DeskAccount(_0x2548e5){this['id']=_0x2548e5['id']||0x0;this[_0x648a('0x0')]=_0x2548e5[_0x648a('0x0')]||'';this['username']=_0x2548e5[_0x648a('0x1')]||'';this[_0x648a('0x2')]=_0x2548e5['remoteUri']||'';this[_0x648a('0x3')]=_0x2548e5[_0x648a('0x3')]||'';this[_0x648a('0x4')]=_0x2548e5['password']||'';this[_0x648a('0x5')]=_0x2548e5['consumerKey']||'';this['consumerSecret']=_0x2548e5['consumerSecret']||'';this[_0x648a('0x6')]=_0x2548e5[_0x648a('0x6')]||'';this['tokenSecret']=_0x2548e5[_0x648a('0x7')]||'';this[_0x648a('0x8')]=_0x2548e5[_0x648a('0x8')]||'';this['serverUrl']=_0x2548e5[_0x648a('0x9')]||'';this['Configurations']=_0x2548e5[_0x648a('0xa')]||{};}module[_0x648a('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 f56b1f8..4bd0113 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 _0x4fc0=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x2b677d,_0x5900a7){var _0x454f4d=function(_0x4a6f42){while(--_0x4a6f42){_0x2b677d['push'](_0x2b677d['shift']());}};_0x454f4d(++_0x5900a7);}(_0x4fc0,0x13f));var _0x04fc=function(_0x5b2735,_0x148bd5){_0x5b2735=_0x5b2735-0x0;var _0x2f0d8f=_0x4fc0[_0x5b2735];return _0x2f0d8f;};'use strict';function Dynamics365Account(_0x3829a8){this['id']=_0x3829a8['id']||0x0;this['name']=_0x3829a8[_0x04fc('0x0')]||'';this['username']=_0x3829a8[_0x04fc('0x1')]||'';this['password']=_0x3829a8[_0x04fc('0x2')]||'';this[_0x04fc('0x3')]=_0x3829a8[_0x04fc('0x3')]||'';this[_0x04fc('0x4')]=_0x3829a8[_0x04fc('0x4')]||'';this[_0x04fc('0x5')]=_0x3829a8[_0x04fc('0x5')]||'';this[_0x04fc('0x6')]=_0x3829a8[_0x04fc('0x6')]||{};this[_0x04fc('0x7')]=_0x3829a8[_0x04fc('0x7')]||'';this[_0x04fc('0x8')]=_0x3829a8[_0x04fc('0x8')]||![];this[_0x04fc('0x9')]=_0x3829a8['Configurations']||{};this[_0x04fc('0xa')]=_0x3829a8[_0x04fc('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x96ad=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x173acc,_0x3b336c){var _0x292b33=function(_0x3be03c){while(--_0x3be03c){_0x173acc['push'](_0x173acc['shift']());}};_0x292b33(++_0x3b336c);}(_0x96ad,0x10d));var _0xd96a=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0x96ad[_0x3d00db];return _0x41f115;};'use strict';function Dynamics365Account(_0x3bd2c7){this['id']=_0x3bd2c7['id']||0x0;this[_0xd96a('0x0')]=_0x3bd2c7[_0xd96a('0x0')]||'';this[_0xd96a('0x1')]=_0x3bd2c7[_0xd96a('0x1')]||'';this[_0xd96a('0x2')]=_0x3bd2c7['password']||'';this['remoteUri']=_0x3bd2c7[_0xd96a('0x3')]||'';this[_0xd96a('0x4')]=_0x3bd2c7['tenantId']||'';this[_0xd96a('0x5')]=_0x3bd2c7[_0xd96a('0x5')]||'';this['clientSecret']=_0x3bd2c7[_0xd96a('0x6')]||{};this['serverUrl']=_0x3bd2c7[_0xd96a('0x7')]||'';this[_0xd96a('0x8')]=_0x3bd2c7[_0xd96a('0x8')]||![];this[_0xd96a('0x9')]=_0x3bd2c7[_0xd96a('0x9')]||{};this[_0xd96a('0xa')]=_0x3bd2c7['CloudProvider']||{};}module[_0xd96a('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 87a4fba..04bd66d 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 _0xbacb=['headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','ListId','key','name','description','ecm'];(function(_0x762415,_0x56faf7){var _0x5ac5ab=function(_0x5376be){while(--_0x5376be){_0x762415['push'](_0x762415['shift']());}};_0x5ac5ab(++_0x56faf7);}(_0xbacb,0x15b));var _0xbbac=function(_0x479056,_0x439a5b){_0x479056=_0x479056-0x0;var _0x24392b=_0xbacb[_0x479056];return _0x24392b;};'use strict';function FaxAccount(_0x261e02){this['id']=_0x261e02['id']||0x0;this[_0xbbac('0x0')]=_0x261e02[_0xbbac('0x0')]||'';this[_0xbbac('0x1')]=_0x261e02[_0xbbac('0x1')];this[_0xbbac('0x2')]=_0x261e02[_0xbbac('0x2')];this[_0xbbac('0x3')]=_0x261e02[_0xbbac('0x3')];this[_0xbbac('0x4')]=_0x261e02[_0xbbac('0x4')];this['minrate']=_0x261e02['minrate']||0x960;this[_0xbbac('0x5')]=_0x261e02[_0xbbac('0x5')]||0x3840;this[_0xbbac('0x6')]=_0x261e02['modem']||_0xbbac('0x7');this['gateway']=_0x261e02[_0xbbac('0x8')]||'no';this[_0xbbac('0x9')]=_0x261e02[_0xbbac('0x9')]||'no';this['t38timeout']=_0x261e02[_0xbbac('0xa')]||0x1388;this[_0xbbac('0xb')]=_0x261e02[_0xbbac('0xb')]||'SIP';this['Trunk']=_0x261e02['Trunk']?_0x261e02['Trunk']:undefined;this['ListId']=_0x261e02[_0xbbac('0xc')];this[_0xbbac('0xd')]=_0x261e02[_0xbbac('0xd')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x1ec9=['gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0xb20667,_0x3ca210){var _0x12f141=function(_0x10b542){while(--_0x10b542){_0xb20667['push'](_0xb20667['shift']());}};_0x12f141(++_0x3ca210);}(_0x1ec9,0xa1));var _0x91ec=function(_0x178c78,_0x27b1bb){_0x178c78=_0x178c78-0x0;var _0x323aa9=_0x1ec9[_0x178c78];return _0x323aa9;};'use strict';function FaxAccount(_0x36fb3a){this['id']=_0x36fb3a['id']||0x0;this[_0x91ec('0x0')]=_0x36fb3a[_0x91ec('0x0')]||'';this[_0x91ec('0x1')]=_0x36fb3a['description'];this[_0x91ec('0x2')]=_0x36fb3a[_0x91ec('0x2')];this[_0x91ec('0x3')]=_0x36fb3a[_0x91ec('0x3')];this[_0x91ec('0x4')]=_0x36fb3a['localstationid'];this[_0x91ec('0x5')]=_0x36fb3a[_0x91ec('0x5')]||0x960;this[_0x91ec('0x6')]=_0x36fb3a[_0x91ec('0x6')]||0x3840;this[_0x91ec('0x7')]=_0x36fb3a[_0x91ec('0x7')]||_0x91ec('0x8');this[_0x91ec('0x9')]=_0x36fb3a[_0x91ec('0x9')]||'no';this[_0x91ec('0xa')]=_0x36fb3a['faxdetect']||'no';this[_0x91ec('0xb')]=_0x36fb3a[_0x91ec('0xb')]||0x1388;this[_0x91ec('0xc')]=_0x36fb3a[_0x91ec('0xc')]||'SIP';this['Trunk']=_0x36fb3a[_0x91ec('0xd')]?_0x36fb3a[_0x91ec('0xd')]:undefined;this['ListId']=_0x36fb3a[_0x91ec('0xe')];this['key']=_0x36fb3a[_0x91ec('0xf')];}module[_0x91ec('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 68db4bd..1face3c 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 _0x5a2d=['remoteUri','Configurations','name','username','apiKey','token'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5a2d,0x14c));var _0xd5a2=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x5a2d[_0x3ee1fe];return _0x1ae57a;};'use strict';function FreshdeskAccount(_0x1bd010){this['id']=_0x1bd010['id']||0x0;this[_0xd5a2('0x0')]=_0x1bd010[_0xd5a2('0x0')]||'';this[_0xd5a2('0x1')]=_0x1bd010['username']||'';this[_0xd5a2('0x2')]=_0x1bd010[_0xd5a2('0x3')]||'';this[_0xd5a2('0x4')]=_0x1bd010[_0xd5a2('0x4')]||'';this['serverUrl']=_0x1bd010['serverUrl']||'';this[_0xd5a2('0x5')]=_0x1bd010[_0xd5a2('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xebae=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x2dd0c7,_0x55c703){var _0x30a7fe=function(_0x1858d3){while(--_0x1858d3){_0x2dd0c7['push'](_0x2dd0c7['shift']());}};_0x30a7fe(++_0x55c703);}(_0xebae,0x182));var _0xeeba=function(_0x54b749,_0x45913f){_0x54b749=_0x54b749-0x0;var _0x5a1b77=_0xebae[_0x54b749];return _0x5a1b77;};'use strict';function FreshdeskAccount(_0x360d86){this['id']=_0x360d86['id']||0x0;this['name']=_0x360d86[_0xeeba('0x0')]||'';this[_0xeeba('0x1')]=_0x360d86['username']||'';this[_0xeeba('0x2')]=_0x360d86[_0xeeba('0x3')]||'';this[_0xeeba('0x4')]=_0x360d86[_0xeeba('0x4')]||'';this['serverUrl']=_0x360d86[_0xeeba('0x5')]||'';this[_0xeeba('0x6')]=_0x360d86[_0xeeba('0x6')]||{};}module[_0xeeba('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e659f47..a91dde6 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 _0x4af9=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x36e990,_0x146bcc){var _0x53406b=function(_0x3ae92e){while(--_0x3ae92e){_0x36e990['push'](_0x36e990['shift']());}};_0x53406b(++_0x146bcc);}(_0x4af9,0x12c));var _0x94af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4af9[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x1c0e9e){this['id']=_0x1c0e9e['id']||0x0;this[_0x94af('0x0')]=_0x1c0e9e['name']||'';this['username']=_0x1c0e9e[_0x94af('0x1')]||'';this[_0x94af('0x2')]=_0x1c0e9e[_0x94af('0x3')]||'';this[_0x94af('0x4')]=_0x1c0e9e[_0x94af('0x4')]||'';this[_0x94af('0x5')]=_0x1c0e9e[_0x94af('0x5')]||'';this['Configurations']=_0x1c0e9e[_0x94af('0x6')]||{};}module[_0x94af('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x77f7=['name','username','apiKey','token','remoteUri','Configurations','exports'];(function(_0x43ae25,_0x58d524){var _0x53c4bc=function(_0x1e9dda){while(--_0x1e9dda){_0x43ae25['push'](_0x43ae25['shift']());}};_0x53c4bc(++_0x58d524);}(_0x77f7,0xbd));var _0x777f=function(_0x23dd9e,_0x1273eb){_0x23dd9e=_0x23dd9e-0x0;var _0x18d239=_0x77f7[_0x23dd9e];return _0x18d239;};'use strict';function FreshsalesAccount(_0x545be6){this['id']=_0x545be6['id']||0x0;this[_0x777f('0x0')]=_0x545be6[_0x777f('0x0')]||'';this[_0x777f('0x1')]=_0x545be6[_0x777f('0x1')]||'';this[_0x777f('0x2')]=_0x545be6[_0x777f('0x3')]||'';this[_0x777f('0x4')]=_0x545be6[_0x777f('0x4')]||'';this['serverUrl']=_0x545be6['serverUrl']||'';this[_0x777f('0x5')]=_0x545be6[_0x777f('0x5')]||{};}module[_0x777f('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 40962ab..150e043 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 _0xbd58=['queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','routealias','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt'];(function(_0x3ba267,_0x4ab961){var _0x47360b=function(_0x489c57){while(--_0x489c57){_0x3ba267['push'](_0x3ba267['shift']());}};_0x47360b(++_0x4ab961);}(_0xbd58,0xd7));var _0x8bd5=function(_0x182f4a,_0xb40b93){_0x182f4a=_0x182f4a-0x0;var _0x584933=_0xbd58[_0x182f4a];return _0x584933;};'use strict';function QueueReport(){this[_0x8bd5('0x0')]=_0x8bd5('0x1');this[_0x8bd5('0x2')]='';this[_0x8bd5('0x3')]='';this[_0x8bd5('0x4')]='';this['queue']='';this[_0x8bd5('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x8bd5('0x6')]=0x1;this[_0x8bd5('0x7')]=![];this[_0x8bd5('0x8')]=null;this['queuecallercomplete']=![];this[_0x8bd5('0x9')]=null;this[_0x8bd5('0xa')]=![];this[_0x8bd5('0xb')]=null;this['originalposition']=0x1;this[_0x8bd5('0xc')]='';this[_0x8bd5('0xd')]='';this[_0x8bd5('0xe')]='';this[_0x8bd5('0xf')]='';this[_0x8bd5('0x10')]='';this[_0x8bd5('0x11')]='';this[_0x8bd5('0x12')]='';this[_0x8bd5('0x13')]=0x0;this[_0x8bd5('0x14')]=![];this[_0x8bd5('0x15')]='';this['motionChannel']=_0x8bd5('0x16');this[_0x8bd5('0x17')]=null;this['mohtime']=0x0;this['variables']={};}module[_0x8bd5('0x18')]=QueueReport; \ No newline at end of file +var _0x2a35=['priority','holdtime','assigned','motionChannel','voice','routealias','mohtime','variables','type','inbound','uniqueid','queue','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','exten'];(function(_0xf3ae5e,_0x385757){var _0x353c92=function(_0x39670f){while(--_0x39670f){_0xf3ae5e['push'](_0xf3ae5e['shift']());}};_0x353c92(++_0x385757);}(_0x2a35,0x18f));var _0x52a3=function(_0xb3f00b,_0x78e86a){_0xb3f00b=_0xb3f00b-0x0;var _0x488351=_0x2a35[_0xb3f00b];return _0x488351;};'use strict';function QueueReport(){this[_0x52a3('0x0')]=_0x52a3('0x1');this[_0x52a3('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0x52a3('0x3')]='';this['queuecallerjoinAt']=null;this[_0x52a3('0x4')]=null;this[_0x52a3('0x5')]=0x1;this['count']=0x1;this[_0x52a3('0x6')]=![];this[_0x52a3('0x7')]=null;this['queuecallercomplete']=![];this[_0x52a3('0x8')]=null;this['queuecallerexit']=![];this[_0x52a3('0x9')]=null;this[_0x52a3('0xa')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x52a3('0xb')]='';this[_0x52a3('0xc')]='';this[_0x52a3('0xd')]='';this[_0x52a3('0xe')]='';this[_0x52a3('0xf')]='';this[_0x52a3('0x10')]=0x0;this[_0x52a3('0x11')]=![];this['lastAssignedTo']='';this[_0x52a3('0x12')]=_0x52a3('0x13');this[_0x52a3('0x14')]=null;this[_0x52a3('0x15')]=0x0;this[_0x52a3('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c348e88..916c464 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 _0x8a7b=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x217157,_0x24a15e){var _0xefe526=function(_0x1f9743){while(--_0x1f9743){_0x217157['push'](_0x217157['shift']());}};_0xefe526(++_0x24a15e);}(_0x8a7b,0x188));var _0xb8a7=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x8a7b[_0x5b740b];return _0x6f8f4e;};'use strict';function SalesforceAccount(_0x39b031){this['id']=_0x39b031['id']||0x0;this[_0xb8a7('0x0')]=_0x39b031['name']||'';this[_0xb8a7('0x1')]=_0x39b031[_0xb8a7('0x1')]||'';this[_0xb8a7('0x2')]=_0x39b031[_0xb8a7('0x2')]||'';this[_0xb8a7('0x3')]=_0x39b031[_0xb8a7('0x3')]||'';this[_0xb8a7('0x4')]=_0x39b031[_0xb8a7('0x4')]||'';this[_0xb8a7('0x5')]=_0x39b031[_0xb8a7('0x5')]||'';this['securityToken']=_0x39b031[_0xb8a7('0x6')]||'';this[_0xb8a7('0x7')]=_0x39b031[_0xb8a7('0x7')]||_0xb8a7('0x8');this['serverUrl']=_0x39b031[_0xb8a7('0x9')]||'';this[_0xb8a7('0xa')]=_0x39b031[_0xb8a7('0xa')]||{};}module[_0xb8a7('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x416b=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x416b,0x1c8));var _0xb416=function(_0x34dd23,_0x50ce42){_0x34dd23=_0x34dd23-0x0;var _0x18a648=_0x416b[_0x34dd23];return _0x18a648;};'use strict';function SalesforceAccount(_0x4d81c7){this['id']=_0x4d81c7['id']||0x0;this[_0xb416('0x0')]=_0x4d81c7['name']||'';this['username']=_0x4d81c7[_0xb416('0x1')]||'';this['remoteUri']=_0x4d81c7[_0xb416('0x2')]||'';this[_0xb416('0x3')]=_0x4d81c7[_0xb416('0x3')]||'';this[_0xb416('0x4')]=_0x4d81c7[_0xb416('0x4')]||'';this[_0xb416('0x5')]=_0x4d81c7[_0xb416('0x5')]||'';this[_0xb416('0x6')]=_0x4d81c7[_0xb416('0x6')]||'';this[_0xb416('0x7')]=_0x4d81c7[_0xb416('0x7')]||'integrationTab';this[_0xb416('0x8')]=_0x4d81c7[_0xb416('0x8')]||'';this[_0xb416('0x9')]=_0x4d81c7['Configurations']||{};}module[_0xb416('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 5f57606..bb83a6b 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 _0x813a=['name','password','remoteUri','serverUrl','exports'];(function(_0x16d8f9,_0x38fbbf){var _0x5d8cde=function(_0x9649aa){while(--_0x9649aa){_0x16d8f9['push'](_0x16d8f9['shift']());}};_0x5d8cde(++_0x38fbbf);}(_0x813a,0xe1));var _0xa813=function(_0x1caacc,_0x58a4bf){_0x1caacc=_0x1caacc-0x0;var _0x52eb08=_0x813a[_0x1caacc];return _0x52eb08;};'use strict';function ServicenowAccount(_0x5a7b07){this['id']=_0x5a7b07['id']||0x0;this[_0xa813('0x0')]=_0x5a7b07[_0xa813('0x0')]||'';this['username']=_0x5a7b07['username']||'';this[_0xa813('0x1')]=_0x5a7b07[_0xa813('0x1')]||'';this[_0xa813('0x2')]=_0x5a7b07[_0xa813('0x2')]||'';this[_0xa813('0x3')]=_0x5a7b07[_0xa813('0x3')]||'';this['Configurations']=_0x5a7b07['Configurations']||{};}module[_0xa813('0x4')]=ServicenowAccount; \ No newline at end of file +var _0x482f=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x482f,0x95));var _0xf482=function(_0x12c0f7,_0x5e0640){_0x12c0f7=_0x12c0f7-0x0;var _0x5733a0=_0x482f[_0x12c0f7];return _0x5733a0;};'use strict';function ServicenowAccount(_0x155bb6){this['id']=_0x155bb6['id']||0x0;this['name']=_0x155bb6[_0xf482('0x0')]||'';this[_0xf482('0x1')]=_0x155bb6[_0xf482('0x1')]||'';this[_0xf482('0x2')]=_0x155bb6['password']||'';this[_0xf482('0x3')]=_0x155bb6[_0xf482('0x3')]||'';this[_0xf482('0x4')]=_0x155bb6[_0xf482('0x4')]||'';this[_0xf482('0x5')]=_0x155bb6['Configurations']||{};}module[_0xf482('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 c3983f0..510a8d9 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 _0x240c=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xf6a649,_0x3b54e3){var _0x2fe97d=function(_0x4153d9){while(--_0x4153d9){_0xf6a649['push'](_0xf6a649['shift']());}};_0x2fe97d(++_0x3b54e3);}(_0x240c,0x82));var _0xc240=function(_0x5a1d21,_0x418cc4){_0x5a1d21=_0x5a1d21-0x0;var _0x55549b=_0x240c[_0x5a1d21];return _0x55549b;};'use strict';function SugarcrmAccount(_0x820cf2){this['id']=_0x820cf2['id']||0x0;this[_0xc240('0x0')]=_0x820cf2[_0xc240('0x0')]||'';this[_0xc240('0x1')]=_0x820cf2[_0xc240('0x1')]||'';this[_0xc240('0x2')]=_0x820cf2['password']||'';this['remoteUri']=_0x820cf2[_0xc240('0x3')]||'';this['serverUrl']=_0x820cf2[_0xc240('0x4')]||'';this[_0xc240('0x5')]=_0x820cf2['Configurations']||{};}module[_0xc240('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xac05=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x3d417f,_0x3709f1){var _0x40f867=function(_0x303131){while(--_0x303131){_0x3d417f['push'](_0x3d417f['shift']());}};_0x40f867(++_0x3709f1);}(_0xac05,0x1c3));var _0x5ac0=function(_0x348fe3,_0x3afd31){_0x348fe3=_0x348fe3-0x0;var _0x21b4ec=_0xac05[_0x348fe3];return _0x21b4ec;};'use strict';function SugarcrmAccount(_0x9be826){this['id']=_0x9be826['id']||0x0;this[_0x5ac0('0x0')]=_0x9be826[_0x5ac0('0x0')]||'';this[_0x5ac0('0x1')]=_0x9be826[_0x5ac0('0x1')]||'';this[_0x5ac0('0x2')]=_0x9be826[_0x5ac0('0x2')]||'';this[_0x5ac0('0x3')]=_0x9be826[_0x5ac0('0x3')]||'';this[_0x5ac0('0x4')]=_0x9be826['serverUrl']||'';this[_0x5ac0('0x5')]=_0x9be826[_0x5ac0('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 0e90b57..747a7f3 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 _0xaaff=['unknown','address','exports','name','accountcode'];(function(_0x3170b2,_0x4770ca){var _0xb9428b=function(_0xc420c1){while(--_0xc420c1){_0x3170b2['push'](_0x3170b2['shift']());}};_0xb9428b(++_0x4770ca);}(_0xaaff,0xad));var _0xfaaf=function(_0x4a9801,_0x548afb){_0x4a9801=_0x4a9801-0x0;var _0x2b089a=_0xaaff[_0x4a9801];return _0x2b089a;};'use strict';function Telephone(_0x367f93){this['id']=_0x367f93['id']||0x0;this[_0xfaaf('0x0')]=_0x367f93[_0xfaaf('0x0')]||'';this[_0xfaaf('0x1')]=_0x367f93[_0xfaaf('0x1')]||'';this['state']=_0xfaaf('0x2');this['stateTime']=0x0;this['status']=_0xfaaf('0x2');this[_0xfaaf('0x3')]='';}module[_0xfaaf('0x4')]=Telephone; \ No newline at end of file +var _0xb62e=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x3be06d,_0x23e756){var _0x41cb5d=function(_0x401c24){while(--_0x401c24){_0x3be06d['push'](_0x3be06d['shift']());}};_0x41cb5d(++_0x23e756);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';function Telephone(_0x175b5c){this['id']=_0x175b5c['id']||0x0;this[_0xeb62('0x0')]=_0x175b5c[_0xeb62('0x0')]||'';this[_0xeb62('0x1')]=_0x175b5c['accountcode']||'';this[_0xeb62('0x2')]=_0xeb62('0x3');this[_0xeb62('0x4')]=0x0;this[_0xeb62('0x5')]=_0xeb62('0x3');this[_0xeb62('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index ad401aa..8d61cb7 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(_0x46be11,_0x24e7ea){var _0xe372d=function(_0x56010b){while(--_0x56010b){_0x46be11['push'](_0x46be11['shift']());}};_0xe372d(++_0x24e7ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b9b30,_0x4ebf7d){_0x4b9b30=_0x4b9b30-0x0;var _0x8577a9=_0xb10b[_0x4b9b30];return _0x8577a9;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x239a13,_0x4987a8){var _0x4c28f8=function(_0x50203e){while(--_0x50203e){_0x239a13['push'](_0x239a13['shift']());}};_0x4c28f8(++_0x4987a8);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ec09b,_0x12d654){_0x5ec09b=_0x5ec09b-0x0;var _0x5a8482=_0xb10b[_0x5ec09b];return _0x5a8482;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index f66ee0a..861bf7c 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 _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x5680d1,_0x22eb8e){var _0x5b1d61=function(_0x1b2838){while(--_0x1b2838){_0x5680d1['push'](_0x5680d1['shift']());}};_0x5b1d61(++_0x22eb8e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb7e7[_0x42f009];return _0x22a1e0;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file +var _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x3f3b7d,_0x1c16b9){var _0x22cd3b=function(_0x5a0e24){while(--_0x5a0e24){_0x3f3b7d['push'](_0x3f3b7d['shift']());}};_0x22cd3b(++_0x1c16b9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x16cfeb,_0x3cc891){_0x16cfeb=_0x16cfeb-0x0;var _0xdd837a=_0x5f2f[_0x16cfeb];return _0xdd837a;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 552c28c..3fa752c 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 _0x1ad5=['registrationtime','address','defaultuser','name','state','stateTime','status','registry','indexOf','split','host','port','domain','domainport','unknown'];(function(_0x398fbb,_0x43220d){var _0x132e5c=function(_0x54ca84){while(--_0x54ca84){_0x398fbb['push'](_0x398fbb['shift']());}};_0x132e5c(++_0x43220d);}(_0x1ad5,0xe4));var _0x51ad=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1ad5[_0x502c7d];return _0x30b7ed;};'use strict';function Trunk(_0x3ad2e1){this['id']=_0x3ad2e1['id']||0x0;this['active']=_0x3ad2e1['active']||![];this[_0x51ad('0x0')]=_0x3ad2e1[_0x51ad('0x0')]||'';this[_0x51ad('0x1')]='unknown';this[_0x51ad('0x2')]=0x0;this[_0x51ad('0x3')]='unknown';this[_0x51ad('0x4')]=_0x3ad2e1[_0x51ad('0x4')]&&_0x3ad2e1['registry'][_0x51ad('0x5')](':')?_0x3ad2e1[_0x51ad('0x4')][_0x51ad('0x6')](':')[0x0]:'';this[_0x51ad('0x7')]='';this[_0x51ad('0x8')]='';this[_0x51ad('0x9')]='';this[_0x51ad('0xa')]='';this['refresh']='';this['stateRegistry']=_0x51ad('0xb');this[_0x51ad('0xc')]='';this[_0x51ad('0xd')]='';this[_0x51ad('0xe')]=_0x3ad2e1['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0xc6dd=['registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6dd,0x1c6));var _0xdc6d=function(_0x2bafcf,_0x56574c){_0x2bafcf=_0x2bafcf-0x0;var _0x5945a0=_0xc6dd[_0x2bafcf];return _0x5945a0;};'use strict';function Trunk(_0x896ad1){this['id']=_0x896ad1['id']||0x0;this[_0xdc6d('0x0')]=_0x896ad1[_0xdc6d('0x0')]||![];this[_0xdc6d('0x1')]=_0x896ad1['name']||'';this[_0xdc6d('0x2')]=_0xdc6d('0x3');this[_0xdc6d('0x4')]=0x0;this[_0xdc6d('0x5')]=_0xdc6d('0x3');this[_0xdc6d('0x6')]=_0x896ad1[_0xdc6d('0x6')]&&_0x896ad1[_0xdc6d('0x6')][_0xdc6d('0x7')](':')?_0x896ad1[_0xdc6d('0x6')][_0xdc6d('0x8')](':')[0x0]:'';this[_0xdc6d('0x9')]='';this[_0xdc6d('0xa')]='';this['domain']='';this[_0xdc6d('0xb')]='';this[_0xdc6d('0xc')]='';this[_0xdc6d('0xd')]=_0xdc6d('0x3');this[_0xdc6d('0xe')]='';this[_0xdc6d('0xf')]='';this['defaultuser']=_0x896ad1[_0xdc6d('0x10')]||'';}module[_0xdc6d('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2ca48b7..be84b34 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 _0xa32d=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x5e03c5,_0x265655){var _0x15c461=function(_0x33e479){while(--_0x33e479){_0x5e03c5['push'](_0x5e03c5['shift']());}};_0x15c461(++_0x265655);}(_0xa32d,0x1f0));var _0xda32=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa32d[_0x57b54c];return _0x59cc19;};'use strict';function voiceExtension(_0x5da626){this['id']=_0x5da626['id']||0x0;this[_0xda32('0x0')]=_0x5da626[_0xda32('0x0')]||'';this[_0xda32('0x1')]=_0x5da626['recordingFormat']||_0xda32('0x2');this['mandatoryDisposition']=_0x5da626[_0xda32('0x3')]||![];}module[_0xda32('0x4')]=voiceExtension; \ No newline at end of file +var _0x8e7a=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x1fe9d8,_0x1b8bca){var _0xc894d7=function(_0x1bb97c){while(--_0x1bb97c){_0x1fe9d8['push'](_0x1fe9d8['shift']());}};_0xc894d7(++_0x1b8bca);}(_0x8e7a,0x175));var _0xa8e7=function(_0x1f0265,_0x498b5d){_0x1f0265=_0x1f0265-0x0;var _0x5965af=_0x8e7a[_0x1f0265];return _0x5965af;};'use strict';function voiceExtension(_0x453815){this['id']=_0x453815['id']||0x0;this[_0xa8e7('0x0')]=_0x453815[_0xa8e7('0x0')]||'';this['recordingFormat']=_0x453815[_0xa8e7('0x1')]||_0xa8e7('0x2');this[_0xa8e7('0x3')]=_0x453815[_0xa8e7('0x3')]||![];}module[_0xa8e7('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 f5f0cd5..6c4b8ae 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 _0x52f6=['outboundReCallsDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','leastrecent','linear','random','ringall','roundrobin','rrordered','name','monitor_format','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','inUse','invalid','loggedIn','onHold','ringing','talking','unavailable','acw','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS'];(function(_0x3a8065,_0x4d6d7a){var _0x18b057=function(_0x334f3c){while(--_0x334f3c){_0x3a8065['push'](_0x3a8065['shift']());}};_0x18b057(++_0x4d6d7a);}(_0x52f6,0x11f));var _0x652f=function(_0x525435,_0x5e9205){_0x525435=_0x525435-0x0;var _0x4691f9=_0x52f6[_0x525435];return _0x4691f9;};'use strict';var monitorFormat={'wav':_0x652f('0x0'),'wav49':_0x652f('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x652f('0x2'),'linear':_0x652f('0x3'),'random':_0x652f('0x4'),'ringall':_0x652f('0x5'),'rr':_0x652f('0x6'),'rrmemory':'rrmemory','rrordered':_0x652f('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x680040){this['id']=_0x680040['id']||0x0;this[_0x652f('0x8')]=_0x680040[_0x652f('0x8')]||'';this[_0x652f('0x9')]=_0x680040['monitor_format']||'';this['type']=_0x680040['type']||_0x652f('0xa');this[_0x652f('0xb')]=0x0;this[_0x652f('0xc')]=0x0;this[_0x652f('0xd')]=0x0;this[_0x652f('0xe')]=0x0;this[_0x652f('0xf')]=0x0;this[_0x652f('0x10')]=0x0;this[_0x652f('0x11')]=0x0;this['abandoned']=0x0;this[_0x652f('0x12')]=0x0;this[_0x652f('0x13')]=0x0;this[_0x652f('0x14')]=0x0;this[_0x652f('0x15')]=0x0;this[_0x652f('0x16')]=0x0;this['notInUse']=0x0;this[_0x652f('0x17')]=0x0;this['paused']=0x0;this[_0x652f('0x18')]=0x0;this['ringInUse']=0x0;this[_0x652f('0x19')]=0x0;this[_0x652f('0x1a')]=0x0;this['unknown']=0x0;this[_0x652f('0x1b')]=_0x680040['acw']||![];this['acwTimeout']=_0x680040['acwTimeout']||0xa;this[_0x652f('0x1c')]=_0x680040['autopause']||'no';this[_0x652f('0x1d')]=!![];this[_0x652f('0x1e')]='';this[_0x652f('0x1f')]='';this[_0x652f('0x20')]=0x0;this[_0x652f('0x21')]=0x0;this[_0x652f('0x22')]=_0x680040['dialTimezone']||null;this[_0x652f('0x23')]=_0x680040[_0x652f('0x23')]?_0x680040['dialGlobalInterval']:null;this[_0x652f('0x24')]=_0x680040[_0x652f('0x24')];this[_0x652f('0x25')]=_0x680040[_0x652f('0x25')]||_0x652f('0x26');this['dialLimitChannel']=_0x680040[_0x652f('0x27')]||0x0;this[_0x652f('0x28')]=_0x680040[_0x652f('0x28')]||0x0;this[_0x652f('0x29')]=_0x680040[_0x652f('0x29')]||0x1;this[_0x652f('0x2a')]=_0x680040[_0x652f('0x2a')]||_0x652f('0x2b');this[_0x652f('0x2c')]=_0x680040['dialPredictiveOptimizationPercentage']||0.03;this[_0x652f('0x2d')]=_0x680040[_0x652f('0x2d')]||0x258;this[_0x652f('0x2e')]=_0x680040[_0x652f('0x2e')]||_0x652f('0x2f');this['dialOriginateCallerIdNumber']=_0x680040[_0x652f('0x30')]||_0x652f('0x2f');this['dialOriginateTimeout']=_0x680040['dialOriginateTimeout']||0x1e;this[_0x652f('0x31')]=_0x680040[_0x652f('0x31')]||_0x652f('0x32');this[_0x652f('0x33')]=_0x680040[_0x652f('0x33')]||0x3;this['dialQueueProject']=_0x680040[_0x652f('0x34')]||undefined;this[_0x652f('0x35')]=_0x680040[_0x652f('0x35')]||0x3;this[_0x652f('0x36')]=_0x680040[_0x652f('0x36')]||0x96;this['dialBusyMaxRetry']=_0x680040['dialBusyMaxRetry']||0x3;this[_0x652f('0x37')]=_0x680040[_0x652f('0x37')]||0x96;this['dialNoAnswerMaxRetry']=_0x680040[_0x652f('0x38')]||0x3;this['dialNoAnswerRetryFrequency']=_0x680040[_0x652f('0x39')]||0x96;this[_0x652f('0x3a')]=_0x680040[_0x652f('0x3a')]||0x3;this[_0x652f('0x3b')]=_0x680040['dialNoSuchNumberRetryFrequency']||0x96;this[_0x652f('0x3c')]=_0x680040[_0x652f('0x3c')]||0x3;this[_0x652f('0x3d')]=_0x680040[_0x652f('0x3d')]||0x96;this['dialAbandonedMaxRetry']=_0x680040[_0x652f('0x3e')]||0x3;this[_0x652f('0x3f')]=_0x680040[_0x652f('0x3f')]||0x96;this[_0x652f('0x40')]=_0x680040[_0x652f('0x40')]||0x3;this[_0x652f('0x41')]=_0x680040[_0x652f('0x41')]||0x96;this['dialAgentRejectMaxRetry']=_0x680040[_0x652f('0x42')]||0x3;this[_0x652f('0x43')]=_0x680040[_0x652f('0x43')]||0x96;this[_0x652f('0x44')]=_0x680040[_0x652f('0x44')]||0x3;this[_0x652f('0x45')]=_0x680040['dialGlobalMaxRetry']||0x4;this[_0x652f('0x46')]=_0x680040[_0x652f('0x46')]?_0x680040['Trunk']:undefined;this[_0x652f('0x47')]=_0x680040[_0x652f('0x47')]?_0x680040['TrunkBackup']:undefined;this['dialPrefix']=_0x680040[_0x652f('0x48')]||undefined;this[_0x652f('0x49')]=_0x680040[_0x652f('0x49')]?_0x680040[_0x652f('0x49')]:undefined;this[_0x652f('0x4a')]=_0x680040[_0x652f('0x4a')]||_0x652f('0x4b');this[_0x652f('0x4c')]=_0x680040[_0x652f('0x4c')]||undefined;this[_0x652f('0x4d')]=_0x680040[_0x652f('0x4d')]||undefined;this[_0x652f('0x4e')]=strategy[_0x680040[_0x652f('0x4e')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x680040[_0x652f('0x4f')]||![];this['dialAMDInitialSilence']=_0x680040[_0x652f('0x50')];this['dialAMDGreeting']=_0x680040[_0x652f('0x51')];this[_0x652f('0x52')]=_0x680040['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x680040[_0x652f('0x53')];this['dialAMDMinWordLength']=_0x680040[_0x652f('0x54')];this['dialAMDBetweenWordsSilence']=_0x680040[_0x652f('0x55')];this[_0x652f('0x56')]=_0x680040[_0x652f('0x56')];this['dialAMDSilenceThreshold']=_0x680040[_0x652f('0x57')];this[_0x652f('0x58')]=_0x680040[_0x652f('0x58')];this['outboundRejectCallsDay']=0x0;this[_0x652f('0x59')]=0x0;this[_0x652f('0x5a')]=_0x680040[_0x652f('0x5a')];this[_0x652f('0x5b')]=0x0;this[_0x652f('0x5c')]=0x0;this[_0x652f('0x5d')]=0x0;this[_0x652f('0x5e')]=0x0;this[_0x652f('0x5f')]=0x0;this[_0x652f('0x60')]=0x0;this[_0x652f('0x61')]=0x0;this[_0x652f('0x62')]=0x0;this[_0x652f('0x63')]=0x0;this[_0x652f('0x64')]=0x0;this[_0x652f('0x65')]=0x0;this[_0x652f('0x66')]=0x0;this[_0x652f('0x67')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x652f('0x68')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x652f('0x69')]=1.05;this[_0x652f('0x6a')]=0x0;this[_0x652f('0x6b')]=0x0;this[_0x652f('0x6c')]=0x0;this[_0x652f('0x6d')]=0x0;this[_0x652f('0x6e')]=0x0;this[_0x652f('0x6f')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x652f('0x70')]=0x0;this[_0x652f('0x71')]=_0x680040['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x652f('0x72')]=_0x680040[_0x652f('0x73')]||0xa;this[_0x652f('0x74')]=0x0;this[_0x652f('0x75')]=0x0;this[_0x652f('0x76')]=0x1;this[_0x652f('0x77')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x652f('0x78')]=_0x680040['dialRecallMeTimeout']||0x1e;this[_0x652f('0x79')]=_0x680040[_0x652f('0x79')]||![];this[_0x652f('0x7a')]=!!_0x680040[_0x652f('0x7a')]||![];this['dialPreviewRecallmeReminder']=!!_0x680040['dialPreviewRecallmeReminder']||![];this[_0x652f('0x7b')]=_0x680040['dialQueueProject2']||undefined;this[_0x652f('0x7c')]=_0x680040['dialAgiAfterHangupClient']||![];this[_0x652f('0x7d')]=_0x680040[_0x652f('0x7d')]||![];this['monitor_format']=monitorFormat[_0x680040[_0x652f('0x9')]]?monitorFormat[_0x680040[_0x652f('0x9')]]:undefined;this['mandatoryDisposition']=_0x680040[_0x652f('0x7e')]||![];this[_0x652f('0x7f')]=_0x680040['mandatoryDispositionPause']?_0x680040['mandatoryDispositionPause']:undefined;this[_0x652f('0x80')]=![];}module[_0x652f('0x81')]=VoiceQueue; \ No newline at end of file +var _0x58b9=['strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','answered','sumHoldTime','sumBillable','unmanaged','available','busy','inUse','invalid','loggedIn','notInUse','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0xac5d25,_0xabfab3){var _0x5a310b=function(_0x2d5898){while(--_0x2d5898){_0xac5d25['push'](_0xac5d25['shift']());}};_0x5a310b(++_0xabfab3);}(_0x58b9,0xad));var _0x958b=function(_0xe324d0,_0xcba278){_0xe324d0=_0xe324d0-0x0;var _0x8e4c88=_0x58b9[_0xe324d0];return _0x8e4c88;};'use strict';var monitorFormat={'wav':_0x958b('0x0'),'wav49':'wav49','gsm':_0x958b('0x1')};var strategy={'fewestcalls':_0x958b('0x2'),'leastrecent':_0x958b('0x3'),'linear':_0x958b('0x4'),'random':_0x958b('0x5'),'ringall':_0x958b('0x6'),'rr':_0x958b('0x7'),'rrmemory':_0x958b('0x8'),'rrordered':_0x958b('0x9'),'wrandom':_0x958b('0xa')};function VoiceQueue(_0x1d3ffd){this['id']=_0x1d3ffd['id']||0x0;this[_0x958b('0xb')]=_0x1d3ffd[_0x958b('0xb')]||'';this[_0x958b('0xc')]=_0x1d3ffd[_0x958b('0xc')]||'';this[_0x958b('0xd')]=_0x1d3ffd[_0x958b('0xd')]||_0x958b('0xe');this[_0x958b('0xf')]=0x0;this['total']=0x0;this[_0x958b('0x10')]=0x0;this['sumDuration']=0x0;this[_0x958b('0x11')]=0x0;this[_0x958b('0x12')]=0x0;this[_0x958b('0x13')]=0x0;this['abandoned']=0x0;this[_0x958b('0x14')]=0x0;this[_0x958b('0x15')]=0x0;this[_0x958b('0x16')]=0x0;this[_0x958b('0x17')]=0x0;this[_0x958b('0x18')]=0x0;this[_0x958b('0x19')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x958b('0x1a')]=0x0;this[_0x958b('0x1b')]=0x0;this['talking']=0x0;this[_0x958b('0x1c')]=0x0;this[_0x958b('0x1d')]=0x0;this['acw']=_0x1d3ffd[_0x958b('0x1e')]||![];this[_0x958b('0x1f')]=_0x1d3ffd[_0x958b('0x1f')]||0xa;this[_0x958b('0x20')]=_0x1d3ffd['autopause']||'no';this[_0x958b('0x21')]=!![];this[_0x958b('0x22')]='';this['statusMessage']='';this[_0x958b('0x23')]=0x0;this[_0x958b('0x24')]=0x0;this[_0x958b('0x25')]=_0x1d3ffd[_0x958b('0x25')]||null;this['dialGlobalInterval']=_0x1d3ffd[_0x958b('0x26')]?_0x1d3ffd[_0x958b('0x26')]:null;this[_0x958b('0x27')]=_0x1d3ffd[_0x958b('0x27')];this['dialMethod']=_0x1d3ffd[_0x958b('0x28')]||'progressive';this[_0x958b('0x29')]=_0x1d3ffd[_0x958b('0x29')]||0x0;this['dialLimitQueue']=_0x1d3ffd[_0x958b('0x2a')]||0x0;this[_0x958b('0x2b')]=_0x1d3ffd['dialPowerLevel']||0x1;this[_0x958b('0x2c')]=_0x1d3ffd[_0x958b('0x2c')]||_0x958b('0x2d');this['dialPredictiveOptimizationPercentage']=_0x1d3ffd['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x1d3ffd[_0x958b('0x2e')]||0x258;this[_0x958b('0x2f')]=_0x1d3ffd[_0x958b('0x2f')]||_0x958b('0x30');this['dialOriginateCallerIdNumber']=_0x1d3ffd[_0x958b('0x31')]||_0x958b('0x30');this[_0x958b('0x32')]=_0x1d3ffd[_0x958b('0x32')]||0x1e;this[_0x958b('0x33')]=_0x1d3ffd['dialQueueOptions']||'tTxX';this[_0x958b('0x34')]=_0x1d3ffd['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x1d3ffd[_0x958b('0x35')]||undefined;this[_0x958b('0x36')]=_0x1d3ffd[_0x958b('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x1d3ffd['dialCongestionRetryFrequency']||0x96;this[_0x958b('0x37')]=_0x1d3ffd[_0x958b('0x37')]||0x3;this[_0x958b('0x38')]=_0x1d3ffd['dialBusyRetryFrequency']||0x96;this[_0x958b('0x39')]=_0x1d3ffd[_0x958b('0x39')]||0x3;this[_0x958b('0x3a')]=_0x1d3ffd[_0x958b('0x3a')]||0x96;this[_0x958b('0x3b')]=_0x1d3ffd[_0x958b('0x3b')]||0x3;this[_0x958b('0x3c')]=_0x1d3ffd[_0x958b('0x3c')]||0x96;this[_0x958b('0x3d')]=_0x1d3ffd[_0x958b('0x3d')]||0x3;this[_0x958b('0x3e')]=_0x1d3ffd['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x1d3ffd[_0x958b('0x3f')]||0x3;this[_0x958b('0x40')]=_0x1d3ffd[_0x958b('0x40')]||0x96;this[_0x958b('0x41')]=_0x1d3ffd['dialMachineMaxRetry']||0x3;this[_0x958b('0x42')]=_0x1d3ffd['dialMachineRetryFrequency']||0x96;this[_0x958b('0x43')]=_0x1d3ffd[_0x958b('0x43')]||0x3;this[_0x958b('0x44')]=_0x1d3ffd[_0x958b('0x44')]||0x96;this[_0x958b('0x45')]=_0x1d3ffd['callAdditionalPhoneAfterMin']||0x3;this[_0x958b('0x46')]=_0x1d3ffd[_0x958b('0x46')]||0x4;this[_0x958b('0x47')]=_0x1d3ffd['Trunk']?_0x1d3ffd['Trunk']:undefined;this['TrunkBackup']=_0x1d3ffd[_0x958b('0x48')]?_0x1d3ffd[_0x958b('0x48')]:undefined;this[_0x958b('0x49')]=_0x1d3ffd[_0x958b('0x49')]||undefined;this[_0x958b('0x4a')]=_0x1d3ffd[_0x958b('0x4a')]?_0x1d3ffd[_0x958b('0x4a')]:undefined;this[_0x958b('0x4b')]=_0x1d3ffd[_0x958b('0x4b')]||_0x958b('0x4c');this[_0x958b('0x4d')]=_0x1d3ffd[_0x958b('0x4d')]||undefined;this[_0x958b('0x4e')]=_0x1d3ffd[_0x958b('0x4e')]||undefined;this['strategy']=strategy[_0x1d3ffd[_0x958b('0x4f')]];this[_0x958b('0x50')]=!![];this[_0x958b('0x51')]=_0x1d3ffd[_0x958b('0x51')]||![];this[_0x958b('0x52')]=_0x1d3ffd[_0x958b('0x52')];this[_0x958b('0x53')]=_0x1d3ffd[_0x958b('0x53')];this[_0x958b('0x54')]=_0x1d3ffd[_0x958b('0x54')];this[_0x958b('0x55')]=_0x1d3ffd[_0x958b('0x55')];this[_0x958b('0x56')]=_0x1d3ffd[_0x958b('0x56')];this[_0x958b('0x57')]=_0x1d3ffd[_0x958b('0x57')];this['dialAMDMaximumNumberOfWords']=_0x1d3ffd[_0x958b('0x58')];this[_0x958b('0x59')]=_0x1d3ffd[_0x958b('0x59')];this['dialAMDMaximumWordLength']=_0x1d3ffd['dialAMDMaximumWordLength'];this[_0x958b('0x5a')]=0x0;this[_0x958b('0x5b')]=0x0;this['timeout']=_0x1d3ffd[_0x958b('0x5c')];this[_0x958b('0x5d')]=0x0;this[_0x958b('0x5e')]=0x0;this[_0x958b('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x958b('0x60')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x958b('0x61')]=0x0;this[_0x958b('0x62')]=0x0;this[_0x958b('0x63')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x958b('0x64')]=0x0;this[_0x958b('0x65')]=0x0;this[_0x958b('0x66')]=undefined;this[_0x958b('0x67')]=undefined;this[_0x958b('0x68')]=undefined;this[_0x958b('0x69')]=1.05;this[_0x958b('0x6a')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x958b('0x6b')]=0x0;this[_0x958b('0x6c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x958b('0x6d')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1d3ffd['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x1d3ffd[_0x958b('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x958b('0x6f')]=0x1;this[_0x958b('0x70')]=0x0;this[_0x958b('0x71')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x958b('0x72')]=0x0;this[_0x958b('0x73')]=_0x1d3ffd[_0x958b('0x73')]||0x1e;this['dialRecallInQueue']=_0x1d3ffd[_0x958b('0x74')]||![];this[_0x958b('0x75')]=!!_0x1d3ffd[_0x958b('0x75')]||![];this[_0x958b('0x76')]=!!_0x1d3ffd[_0x958b('0x76')]||![];this[_0x958b('0x77')]=_0x1d3ffd['dialQueueProject2']||undefined;this[_0x958b('0x78')]=_0x1d3ffd[_0x958b('0x78')]||![];this[_0x958b('0x79')]=_0x1d3ffd[_0x958b('0x79')]||![];this[_0x958b('0xc')]=monitorFormat[_0x1d3ffd[_0x958b('0xc')]]?monitorFormat[_0x1d3ffd['monitor_format']]:undefined;this[_0x958b('0x7a')]=_0x1d3ffd['mandatoryDisposition']||![];this[_0x958b('0x7b')]=_0x1d3ffd[_0x958b('0x7b')]?_0x1d3ffd[_0x958b('0x7b')]:undefined;this[_0x958b('0x7c')]=![];}module[_0x958b('0x7d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 5371b48..21f3ddc 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0686=['createReport','ringInUse','callers','length','online','incall','includes','status','notInUse','booked','keys','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid'];(function(_0x46c007,_0x51bef3){var _0x3dc844=function(_0x7aa9dc){while(--_0x7aa9dc){_0x46c007['push'](_0x46c007['shift']());}};_0x3dc844(++_0x51bef3);}(_0x0686,0x123));var _0x6068=function(_0x812b,_0x30cde0){_0x812b=_0x812b-0x0;var _0x4c49da=_0x0686[_0x812b];return _0x4c49da;};'use strict';var INBOUND_COUNTERS=[_0x6068('0x0'),_0x6068('0x1'),_0x6068('0x2'),_0x6068('0x3'),_0x6068('0x4'),_0x6068('0x5'),_0x6068('0x6')];var OUTBOUND_COUNTERS=['available',_0x6068('0x7'),_0x6068('0x8'),_0x6068('0x1'),_0x6068('0x2'),_0x6068('0x9'),_0x6068('0xa'),_0x6068('0xb'),_0x6068('0xc'),_0x6068('0xd'),_0x6068('0xe'),'outboundNoAnswerCallsDay',_0x6068('0xf'),_0x6068('0x10'),_0x6068('0x11'),_0x6068('0x12'),_0x6068('0x3'),_0x6068('0x13'),_0x6068('0x5'),'sumBillable',_0x6068('0x14'),_0x6068('0x15'),_0x6068('0x6')];function VoiceQueueSummary(_0x26c658){this['id']=_0x26c658['id'];this[_0x6068('0x16')]=_0x26c658['name'];this[_0x6068('0x17')]=_0x26c658[_0x6068('0x17')];this['abandoned']=_0x26c658[_0x6068('0x18')]||0x0;this[_0x6068('0x7')]=_0x26c658[_0x6068('0x7')]||0x0;this[_0x6068('0x0')]=_0x26c658[_0x6068('0x0')]||0x0;this[_0x6068('0x19')]=_0x26c658[_0x6068('0x19')]||0x0;this[_0x6068('0x8')]=_0x26c658[_0x6068('0x8')]||0x0;this['invalid']=_0x26c658[_0x6068('0x1a')]||0x0;this[_0x6068('0x1')]=_0x26c658['loggedIn']||0x0;this[_0x6068('0x2')]=_0x26c658[_0x6068('0x2')]||0x0;this[_0x6068('0x1b')]=_0x26c658[_0x6068('0x1b')]||0x0;this['notInUse']=_0x26c658['notInUse']||0x0;this[_0x6068('0x3')]=_0x26c658[_0x6068('0x3')]||0x0;this[_0x6068('0x4')]=_0x26c658[_0x6068('0x4')]||0x0;this['ringInUse']=_0x26c658['ringInUse'];this[_0x6068('0x1c')]=_0x26c658[_0x6068('0x1c')];this[_0x6068('0x14')]=_0x26c658[_0x6068('0x14')];this[_0x6068('0x1d')]=_0x26c658[_0x6068('0x1d')]||0x0;this[_0x6068('0x5')]=_0x26c658['talking']||0x0;this['total']=_0x26c658['total']||0x0;this[_0x6068('0x1e')]=_0x26c658[_0x6068('0x1e')];this[_0x6068('0x1f')]=_0x26c658[_0x6068('0x1f')]||0x0;this[_0x6068('0x20')]=_0x26c658[_0x6068('0x20')]||0x0;this[_0x6068('0x21')]=_0x26c658[_0x6068('0x21')]||0x0;this['waiting']=_0x26c658[_0x6068('0x6')]||0x0;if(_0x26c658[_0x6068('0x1e')]==='outbound'){this[_0x6068('0x13')]=_0x26c658[_0x6068('0x13')]||0x0;this[_0x6068('0x22')]=_0x26c658[_0x6068('0x22')];this[_0x6068('0x23')]=_0x26c658['dialMethod'];this[_0x6068('0x24')]=_0x26c658['dialOriginateCallerIdName'];this[_0x6068('0x25')]=_0x26c658[_0x6068('0x25')];this[_0x6068('0x26')]=_0x26c658[_0x6068('0x26')];this[_0x6068('0x27')]=_0x26c658[_0x6068('0x27')];this[_0x6068('0x28')]=_0x26c658[_0x6068('0x28')];this[_0x6068('0x29')]=_0x26c658[_0x6068('0x29')];this['outboundAnswerCallsDay']=_0x26c658[_0x6068('0xb')];this[_0x6068('0xc')]=_0x26c658[_0x6068('0xc')];this[_0x6068('0xd')]=_0x26c658[_0x6068('0xd')];this[_0x6068('0xe')]=_0x26c658[_0x6068('0xe')];this[_0x6068('0x2a')]=_0x26c658['outboundDropCallsDayACS'];this[_0x6068('0x2b')]=_0x26c658[_0x6068('0x2b')];this[_0x6068('0x2c')]=_0x26c658[_0x6068('0x2c')];this[_0x6068('0x2d')]=_0x26c658[_0x6068('0x2d')];this[_0x6068('0xf')]=_0x26c658[_0x6068('0xf')];this['outboundOriginateFailureCallsDay']=_0x26c658[_0x6068('0x2e')];this[_0x6068('0x10')]=_0x26c658[_0x6068('0x10')];this[_0x6068('0x11')]=_0x26c658[_0x6068('0x11')];this[_0x6068('0x12')]=_0x26c658['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x26c658[_0x6068('0x2f')];this['predictiveIntervalAvgHoldtime']=_0x26c658['predictiveIntervalAvgHoldtime'];this[_0x6068('0x30')]=_0x26c658[_0x6068('0x30')];this['predictiveIntervalDroppedCallsCallersExit']=_0x26c658[_0x6068('0x31')];this[_0x6068('0x32')]=_0x26c658[_0x6068('0x32')];this[_0x6068('0x33')]=_0x26c658[_0x6068('0x33')];this[_0x6068('0x34')]=_0x26c658['predictiveIntervalErlangCallsDroppedCalls'];this[_0x6068('0x35')]=_0x26c658[_0x6068('0x35')];this[_0x6068('0x36')]=_0x26c658[_0x6068('0x36')];this[_0x6068('0x37')]=_0x26c658[_0x6068('0x37')];this[_0x6068('0x38')]=_0x26c658['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x26c658[_0x6068('0x39')];this['originated']=_0x26c658[_0x6068('0x9')];this[_0x6068('0x3a')]=_0x26c658[_0x6068('0x3a')];this[_0x6068('0x3b')]=_0x26c658[_0x6068('0x3b')];this['erlangAbandonmentRate']=_0x26c658[_0x6068('0x3c')];this[_0x6068('0x3d')]=_0x26c658['erlangBusyFactor'];this[_0x6068('0x3e')]=_0x26c658['startPredictive'];this['startProgressive']=_0x26c658[_0x6068('0x3f')];this[_0x6068('0x40')]=_0x26c658[_0x6068('0x40')];this[_0x6068('0x41')]=_0x26c658[_0x6068('0x41')];}if(_0x26c658[_0x6068('0x42')]){this[_0x6068('0x42')]={'id':_0x26c658['Trunk']['id'],'name':_0x26c658['Trunk'][_0x6068('0x16')],'active':_0x26c658[_0x6068('0x42')][_0x6068('0x43')],'callerid':_0x26c658[_0x6068('0x42')][_0x6068('0x44')]};}}VoiceQueueSummary['prototype'][_0x6068('0x45')]=function(_0x107f3e,_0x3494e8,_0xebd21c,_0x3d4fab){this[_0x6068('0x2')]=0x0;this[_0x6068('0x5')]=0x0;this['paused']=0x0;this[_0x6068('0x20')]=0x0;this['notInUse']=0x0;this[_0x6068('0x8')]=0x0;this[_0x6068('0x19')]=0x0;this[_0x6068('0x1a')]=0x0;this[_0x6068('0x1f')]=0x0;this[_0x6068('0x4')]=0x0;this[_0x6068('0x46')]=0x0;this[_0x6068('0x1b')]=0x0;if(_0xebd21c){if(_0xebd21c[_0x6068('0x0')]){this[_0x6068('0x0')]=Number(_0xebd21c[_0x6068('0x0')]);}if(_0xebd21c['loggedin']){this[_0x6068('0x1')]=Number(_0xebd21c['loggedin']);}if(_0xebd21c['callers']){this['waiting']=Number(_0xebd21c[_0x6068('0x47')]);}}for(var _0x3d5a18=0x0;_0x3d5a18<_0x107f3e[_0x6068('0x48')];_0x3d5a18++){var _0x116450=_0x3494e8['SIP/'+_0x107f3e[_0x3d5a18][_0x6068('0x16')]];if(_0x116450&&_0x116450[_0x6068('0x49')]){this[_0x6068('0x2')]+=0x1;}if(_0x107f3e[_0x3d5a18][_0x6068('0x4a')]==='1'){this[_0x6068('0x5')]+=0x1;}if(_0x107f3e[_0x3d5a18][_0x6068('0x3')]==='1'&&!['2','7','8'][_0x6068('0x4b')](_0x107f3e[_0x3d5a18][_0x6068('0x4c')])){this['paused']+=0x1;}switch(_0x107f3e[_0x3d5a18][_0x6068('0x4c')]){case'0':this[_0x6068('0x20')]+=0x1;break;case'1':this[_0x6068('0x4d')]+=0x1;break;case'2':this[_0x6068('0x8')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x6068('0x1a')]+=0x1;break;case'5':this[_0x6068('0x1f')]+=0x1;break;case'6':this[_0x6068('0x4')]+=0x1;break;case'7':this[_0x6068('0x46')]+=0x1;break;case'8':this[_0x6068('0x1b')]+=0x1;break;}}if(this[_0x6068('0x23')]===_0x6068('0x4e')){var _0x273756=Object[_0x6068('0x4f')](_0x3d4fab);for(var _0x5e8bf8=0x0;_0x5e8bf8<_0x273756['length'];_0x5e8bf8++){var _0x1eb37d=_0x273756[_0x5e8bf8];var _0x44d298=_0x3d4fab[_0x1eb37d];if(_0x44d298[_0x6068('0x50')]===this['name']&&_0x44d298[_0x6068('0x1e')]===_0x6068('0x51')&&_0x44d298[_0x6068('0x52')]===_0x6068('0x53')){this[_0x6068('0x5')]+=0x1;}}if(this[_0x6068('0x5')]>this[_0x6068('0x8')]){this[_0x6068('0x5')]=this[_0x6068('0x8')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x6068('0x54')][_0x6068('0x55')]=function(_0x19b997){var _0x5d3823=![];if(_0x19b997){_0x5d3823=INBOUND_COUNTERS[_0x6068('0x56')](function(_0x21b8b2){return this[_0x21b8b2]!==_0x19b997[_0x21b8b2];},this);}return _0x5d3823;};VoiceQueueSummary['prototype'][_0x6068('0x57')]=function(_0x1a6f42){var _0x5a3499=![];var _0x446677=![];var _0x79a00f=![];if(_0x1a6f42){_0x5a3499=this[_0x6068('0x23')]!==_0x1a6f42[_0x6068('0x23')]||this[_0x6068('0x22')]!==_0x1a6f42[_0x6068('0x22')]||this['message']!==_0x1a6f42['message']||this[_0x6068('0x41')]!==_0x1a6f42[_0x6068('0x41')];_0x446677=OUTBOUND_COUNTERS[_0x6068('0x56')](function(_0x2bc2a9){return this[_0x2bc2a9]!==_0x1a6f42[_0x2bc2a9];},this);if(this['Trunk']&&_0x1a6f42[_0x6068('0x42')]){_0x79a00f=this['Trunk'][_0x6068('0x16')]!==_0x1a6f42[_0x6068('0x42')]['name']||this[_0x6068('0x42')]['active']!==_0x1a6f42[_0x6068('0x42')]['active'];}}return _0x5a3499||_0x446677||_0x79a00f;};VoiceQueueSummary[_0x6068('0x54')][_0x6068('0x58')]=function(_0x341b46){this[_0x6068('0x7')]=_0x341b46['answered'];this[_0x6068('0x40')]=_0x341b46[_0x6068('0x40')];this[_0x6068('0x41')]=_0x341b46[_0x6068('0x41')];this[_0x6068('0x9')]=_0x341b46[_0x6068('0x9')];this[_0x6068('0xa')]=_0x341b46[_0x6068('0xa')];this[_0x6068('0xb')]=_0x341b46[_0x6068('0xb')];this[_0x6068('0xc')]=_0x341b46['outboundBlacklistCallsDay'];this[_0x6068('0xd')]=_0x341b46[_0x6068('0xd')];this[_0x6068('0xe')]=_0x341b46[_0x6068('0xe')];this['outboundNoAnswerCallsDay']=_0x341b46[_0x6068('0x2d')];this[_0x6068('0xf')]=_0x341b46[_0x6068('0xf')];this['outboundReCallsDay']=_0x341b46[_0x6068('0x10')];this[_0x6068('0x11')]=_0x341b46['outboundRejectCallsDay'];this[_0x6068('0x12')]=_0x341b46[_0x6068('0x12')];this[_0x6068('0x1c')]=_0x341b46[_0x6068('0x1c')];this[_0x6068('0x14')]=_0x341b46['sumDuration'];this[_0x6068('0x15')]=_0x341b46[_0x6068('0x15')];if(this[_0x6068('0x23')]===_0x6068('0x59')){this['pTalking']=_0x341b46[_0x6068('0x13')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x4fde=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','onHold','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','type','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','exports','available','loggedIn','loggedInDb','paused','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','notInUse','ringing','ringInUse','sumBillable','sumHoldTime','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x32c19f,_0x441579){var _0x4e1575=function(_0x1c50bb){while(--_0x1c50bb){_0x32c19f['push'](_0x32c19f['shift']());}};_0x4e1575(++_0x441579);}(_0x4fde,0x19f));var _0xe4fd=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x4fde[_0x4f3c9b];return _0x84e58a;};'use strict';var INBOUND_COUNTERS=[_0xe4fd('0x0'),_0xe4fd('0x1'),_0xe4fd('0x2'),_0xe4fd('0x3'),'ringing',_0xe4fd('0x4'),_0xe4fd('0x5')];var OUTBOUND_COUNTERS=['available',_0xe4fd('0x6'),_0xe4fd('0x7'),_0xe4fd('0x1'),_0xe4fd('0x2'),_0xe4fd('0x8'),_0xe4fd('0x9'),_0xe4fd('0xa'),_0xe4fd('0xb'),_0xe4fd('0xc'),'outboundCongestionCallsDay',_0xe4fd('0xd'),'outboundNoSuchCallsDay',_0xe4fd('0xe'),'outboundRejectCallsDay','outboundUnknownCallsDay',_0xe4fd('0x3'),_0xe4fd('0xf'),'talking','sumBillable',_0xe4fd('0x10'),_0xe4fd('0x11'),_0xe4fd('0x5')];function VoiceQueueSummary(_0x5c4dc7){this['id']=_0x5c4dc7['id'];this[_0xe4fd('0x12')]=_0x5c4dc7[_0xe4fd('0x12')];this[_0xe4fd('0x13')]=_0x5c4dc7[_0xe4fd('0x13')];this[_0xe4fd('0x14')]=_0x5c4dc7[_0xe4fd('0x14')]||0x0;this['answered']=_0x5c4dc7[_0xe4fd('0x6')]||0x0;this[_0xe4fd('0x0')]=_0x5c4dc7[_0xe4fd('0x0')]||0x0;this['busy']=_0x5c4dc7[_0xe4fd('0x15')]||0x0;this[_0xe4fd('0x7')]=_0x5c4dc7['inUse']||0x0;this['invalid']=_0x5c4dc7[_0xe4fd('0x16')]||0x0;this[_0xe4fd('0x1')]=_0x5c4dc7[_0xe4fd('0x1')]||0x0;this['loggedInDb']=_0x5c4dc7[_0xe4fd('0x2')]||0x0;this['onHold']=_0x5c4dc7['onHold']||0x0;this[_0xe4fd('0x17')]=_0x5c4dc7[_0xe4fd('0x17')]||0x0;this[_0xe4fd('0x3')]=_0x5c4dc7[_0xe4fd('0x3')]||0x0;this[_0xe4fd('0x18')]=_0x5c4dc7['ringing']||0x0;this[_0xe4fd('0x19')]=_0x5c4dc7[_0xe4fd('0x19')];this[_0xe4fd('0x1a')]=_0x5c4dc7[_0xe4fd('0x1a')];this[_0xe4fd('0x10')]=_0x5c4dc7[_0xe4fd('0x10')];this[_0xe4fd('0x1b')]=_0x5c4dc7[_0xe4fd('0x1b')]||0x0;this[_0xe4fd('0x4')]=_0x5c4dc7['talking']||0x0;this[_0xe4fd('0x11')]=_0x5c4dc7[_0xe4fd('0x11')]||0x0;this['type']=_0x5c4dc7['type'];this['unavailable']=_0x5c4dc7[_0xe4fd('0x1c')]||0x0;this['unknown']=_0x5c4dc7[_0xe4fd('0x1d')]||0x0;this['unmanaged']=_0x5c4dc7[_0xe4fd('0x1e')]||0x0;this[_0xe4fd('0x5')]=_0x5c4dc7[_0xe4fd('0x5')]||0x0;if(_0x5c4dc7['type']===_0xe4fd('0x1f')){this[_0xe4fd('0xf')]=_0x5c4dc7[_0xe4fd('0xf')]||0x0;this[_0xe4fd('0x20')]=_0x5c4dc7[_0xe4fd('0x20')];this['dialMethod']=_0x5c4dc7[_0xe4fd('0x21')];this[_0xe4fd('0x22')]=_0x5c4dc7[_0xe4fd('0x22')];this[_0xe4fd('0x23')]=_0x5c4dc7[_0xe4fd('0x23')];this[_0xe4fd('0x24')]=_0x5c4dc7[_0xe4fd('0x24')];this[_0xe4fd('0x25')]=_0x5c4dc7[_0xe4fd('0x25')];this[_0xe4fd('0x26')]=_0x5c4dc7[_0xe4fd('0x26')];this[_0xe4fd('0x27')]=_0x5c4dc7[_0xe4fd('0x27')];this[_0xe4fd('0xa')]=_0x5c4dc7[_0xe4fd('0xa')];this[_0xe4fd('0xb')]=_0x5c4dc7[_0xe4fd('0xb')];this['outboundBusyCallsDay']=_0x5c4dc7[_0xe4fd('0xc')];this[_0xe4fd('0x28')]=_0x5c4dc7[_0xe4fd('0x28')];this['outboundDropCallsDayACS']=_0x5c4dc7[_0xe4fd('0x29')];this[_0xe4fd('0x2a')]=_0x5c4dc7[_0xe4fd('0x2a')];this[_0xe4fd('0x2b')]=_0x5c4dc7[_0xe4fd('0x2b')];this['outboundNoAnswerCallsDay']=_0x5c4dc7[_0xe4fd('0xd')];this[_0xe4fd('0x2c')]=_0x5c4dc7[_0xe4fd('0x2c')];this[_0xe4fd('0x2d')]=_0x5c4dc7[_0xe4fd('0x2d')];this[_0xe4fd('0xe')]=_0x5c4dc7[_0xe4fd('0xe')];this[_0xe4fd('0x2e')]=_0x5c4dc7[_0xe4fd('0x2e')];this[_0xe4fd('0x2f')]=_0x5c4dc7[_0xe4fd('0x2f')];this[_0xe4fd('0x30')]=_0x5c4dc7[_0xe4fd('0x30')];this[_0xe4fd('0x31')]=_0x5c4dc7[_0xe4fd('0x31')];this[_0xe4fd('0x32')]=_0x5c4dc7[_0xe4fd('0x32')];this[_0xe4fd('0x33')]=_0x5c4dc7[_0xe4fd('0x33')];this[_0xe4fd('0x34')]=_0x5c4dc7[_0xe4fd('0x34')];this[_0xe4fd('0x35')]=_0x5c4dc7[_0xe4fd('0x35')];this[_0xe4fd('0x36')]=_0x5c4dc7[_0xe4fd('0x36')];this['predictiveIntervalHitRate']=_0x5c4dc7['predictiveIntervalHitRate'];this[_0xe4fd('0x37')]=_0x5c4dc7[_0xe4fd('0x37')];this[_0xe4fd('0x38')]=_0x5c4dc7[_0xe4fd('0x38')];this['predictiveIntervalAvailable']=_0x5c4dc7[_0xe4fd('0x39')];this[_0xe4fd('0x3a')]=_0x5c4dc7[_0xe4fd('0x3a')];this[_0xe4fd('0x8')]=_0x5c4dc7[_0xe4fd('0x8')];this[_0xe4fd('0x3b')]=_0x5c4dc7[_0xe4fd('0x3b')];this[_0xe4fd('0x3c')]=_0x5c4dc7[_0xe4fd('0x3c')];this['erlangAbandonmentRate']=_0x5c4dc7[_0xe4fd('0x3d')];this['erlangBusyFactor']=_0x5c4dc7[_0xe4fd('0x3e')];this[_0xe4fd('0x3f')]=_0x5c4dc7[_0xe4fd('0x3f')];this[_0xe4fd('0x40')]=_0x5c4dc7[_0xe4fd('0x40')];this['message']=_0x5c4dc7[_0xe4fd('0x41')];this[_0xe4fd('0x42')]=_0x5c4dc7[_0xe4fd('0x42')];}if(_0x5c4dc7[_0xe4fd('0x43')]){this[_0xe4fd('0x43')]={'id':_0x5c4dc7[_0xe4fd('0x43')]['id'],'name':_0x5c4dc7['Trunk'][_0xe4fd('0x12')],'active':_0x5c4dc7[_0xe4fd('0x43')][_0xe4fd('0x44')],'callerid':_0x5c4dc7['Trunk'][_0xe4fd('0x45')]};}}VoiceQueueSummary[_0xe4fd('0x46')][_0xe4fd('0x47')]=function(_0x12a961,_0x596915,_0x38a48f,_0x38f266){this[_0xe4fd('0x2')]=0x0;this[_0xe4fd('0x4')]=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0xe4fd('0x17')]=0x0;this[_0xe4fd('0x7')]=0x0;this['busy']=0x0;this[_0xe4fd('0x16')]=0x0;this[_0xe4fd('0x1c')]=0x0;this[_0xe4fd('0x18')]=0x0;this[_0xe4fd('0x19')]=0x0;this[_0xe4fd('0x48')]=0x0;if(_0x38a48f){if(_0x38a48f[_0xe4fd('0x0')]){this['available']=Number(_0x38a48f['available']);}if(_0x38a48f['loggedin']){this[_0xe4fd('0x1')]=Number(_0x38a48f[_0xe4fd('0x49')]);}if(_0x38a48f[_0xe4fd('0x4a')]){this[_0xe4fd('0x5')]=Number(_0x38a48f[_0xe4fd('0x4a')]);}}for(var _0x28898c=0x0;_0x28898c<_0x12a961[_0xe4fd('0x4b')];_0x28898c++){var _0x43c5af=_0x596915[_0xe4fd('0x4c')+_0x12a961[_0x28898c][_0xe4fd('0x12')]];if(_0x43c5af&&_0x43c5af[_0xe4fd('0x4d')]){this[_0xe4fd('0x2')]+=0x1;}if(_0x12a961[_0x28898c][_0xe4fd('0x4e')]==='1'){this[_0xe4fd('0x4')]+=0x1;}if(_0x12a961[_0x28898c]['paused']==='1'&&!['2','7','8'][_0xe4fd('0x4f')](_0x12a961[_0x28898c][_0xe4fd('0x50')])){this[_0xe4fd('0x3')]+=0x1;}switch(_0x12a961[_0x28898c]['status']){case'0':this[_0xe4fd('0x1d')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xe4fd('0x15')]+=0x1;break;case'4':this[_0xe4fd('0x16')]+=0x1;break;case'5':this[_0xe4fd('0x1c')]+=0x1;break;case'6':this[_0xe4fd('0x18')]+=0x1;break;case'7':this[_0xe4fd('0x19')]+=0x1;break;case'8':this[_0xe4fd('0x48')]+=0x1;break;}}if(this[_0xe4fd('0x21')]==='booked'){var _0x415582=Object[_0xe4fd('0x51')](_0x38f266);for(var _0x16bd52=0x0;_0x16bd52<_0x415582[_0xe4fd('0x4b')];_0x16bd52++){var _0x27a8d4=_0x415582[_0x16bd52];var _0x3f5398=_0x38f266[_0x27a8d4];if(_0x3f5398[_0xe4fd('0x52')]===this[_0xe4fd('0x12')]&&_0x3f5398[_0xe4fd('0x53')]===_0xe4fd('0x54')&&_0x3f5398[_0xe4fd('0x55')]===_0xe4fd('0x56')){this[_0xe4fd('0x4')]+=0x1;}}if(this[_0xe4fd('0x4')]>this[_0xe4fd('0x7')]){this['talking']=this[_0xe4fd('0x7')];}this[_0xe4fd('0xf')]=0x0;}return this;};VoiceQueueSummary[_0xe4fd('0x46')][_0xe4fd('0x57')]=function(_0x51d32e){var _0x59ba00=![];if(_0x51d32e){_0x59ba00=INBOUND_COUNTERS[_0xe4fd('0x58')](function(_0x1e3423){return this[_0x1e3423]!==_0x51d32e[_0x1e3423];},this);}return _0x59ba00;};VoiceQueueSummary[_0xe4fd('0x46')]['compareToOutboundQueue']=function(_0x4232be){var _0x20c37f=![];var _0x4cbc10=![];var _0xa1d3e0=![];if(_0x4232be){_0x20c37f=this[_0xe4fd('0x21')]!==_0x4232be[_0xe4fd('0x21')]||this[_0xe4fd('0x20')]!==_0x4232be[_0xe4fd('0x20')]||this[_0xe4fd('0x41')]!==_0x4232be[_0xe4fd('0x41')]||this[_0xe4fd('0x42')]!==_0x4232be[_0xe4fd('0x42')];_0x4cbc10=OUTBOUND_COUNTERS['some'](function(_0x4e0158){return this[_0x4e0158]!==_0x4232be[_0x4e0158];},this);if(this['Trunk']&&_0x4232be[_0xe4fd('0x43')]){_0xa1d3e0=this[_0xe4fd('0x43')]['name']!==_0x4232be[_0xe4fd('0x43')][_0xe4fd('0x12')]||this[_0xe4fd('0x43')][_0xe4fd('0x44')]!==_0x4232be['Trunk']['active'];}}return _0x20c37f||_0x4cbc10||_0xa1d3e0;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x2342bf){this[_0xe4fd('0x6')]=_0x2342bf[_0xe4fd('0x6')];this[_0xe4fd('0x41')]=_0x2342bf[_0xe4fd('0x41')];this['statusMessage']=_0x2342bf[_0xe4fd('0x42')];this['originated']=_0x2342bf['originated'];this[_0xe4fd('0x9')]=_0x2342bf[_0xe4fd('0x9')];this[_0xe4fd('0xa')]=_0x2342bf['outboundAnswerCallsDay'];this[_0xe4fd('0xb')]=_0x2342bf[_0xe4fd('0xb')];this['outboundBusyCallsDay']=_0x2342bf[_0xe4fd('0xc')];this[_0xe4fd('0x28')]=_0x2342bf[_0xe4fd('0x28')];this[_0xe4fd('0xd')]=_0x2342bf[_0xe4fd('0xd')];this['outboundNoSuchCallsDay']=_0x2342bf['outboundNoSuchCallsDay'];this[_0xe4fd('0xe')]=_0x2342bf[_0xe4fd('0xe')];this[_0xe4fd('0x2e')]=_0x2342bf[_0xe4fd('0x2e')];this[_0xe4fd('0x2f')]=_0x2342bf['outboundUnknownCallsDay'];this[_0xe4fd('0x1a')]=_0x2342bf[_0xe4fd('0x1a')];this[_0xe4fd('0x10')]=_0x2342bf[_0xe4fd('0x10')];this[_0xe4fd('0x11')]=_0x2342bf[_0xe4fd('0x11')];if(this[_0xe4fd('0x21')]==='preview'){this[_0xe4fd('0xf')]=_0x2342bf[_0xe4fd('0xf')];}};module[_0xe4fd('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8f7956c..8f3630d 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 _0x418c=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x418c,0x120));var _0xc418=function(_0x3e33f7,_0x32918e){_0x3e33f7=_0x3e33f7-0x0;var _0x422027=_0x418c[_0x3e33f7];return _0x422027;};'use strict';function VtigerAccount(_0x42a2e0){this['id']=_0x42a2e0['id']||0x0;this[_0xc418('0x0')]=_0x42a2e0[_0xc418('0x0')]||'';this[_0xc418('0x1')]=_0x42a2e0[_0xc418('0x1')]||'';this[_0xc418('0x2')]=_0x42a2e0[_0xc418('0x2')]||'';this[_0xc418('0x3')]=_0x42a2e0[_0xc418('0x3')]||'';this[_0xc418('0x4')]=_0x42a2e0[_0xc418('0x4')]||'';this[_0xc418('0x5')]=_0x42a2e0[_0xc418('0x5')]||{};}module[_0xc418('0x6')]=VtigerAccount; \ No newline at end of file +var _0x4074=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x4ad644,_0x521a51){var _0x442f2b=function(_0x346beb){while(--_0x346beb){_0x4ad644['push'](_0x4ad644['shift']());}};_0x442f2b(++_0x521a51);}(_0x4074,0xf0));var _0x4407=function(_0x1deb2a,_0x401cf1){_0x1deb2a=_0x1deb2a-0x0;var _0x8b98d0=_0x4074[_0x1deb2a];return _0x8b98d0;};'use strict';function VtigerAccount(_0x4dc38f){this['id']=_0x4dc38f['id']||0x0;this[_0x4407('0x0')]=_0x4dc38f[_0x4407('0x0')]||'';this['username']=_0x4dc38f[_0x4407('0x1')]||'';this[_0x4407('0x2')]=_0x4dc38f[_0x4407('0x2')]||'';this[_0x4407('0x3')]=_0x4dc38f[_0x4407('0x3')]||'';this[_0x4407('0x4')]=_0x4dc38f[_0x4407('0x4')]||'';this[_0x4407('0x5')]=_0x4dc38f[_0x4407('0x5')]||{};}module[_0x4407('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 343497d..6b68a31 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 _0xfeba=['type','serverUrl','Configurations','name','username','token','remoteUri','authType'];(function(_0x4f9876,_0x2cf1d1){var _0x24b845=function(_0x4079a2){while(--_0x4079a2){_0x4f9876['push'](_0x4f9876['shift']());}};_0x24b845(++_0x2cf1d1);}(_0xfeba,0xeb));var _0xafeb=function(_0x141afc,_0x1822f7){_0x141afc=_0x141afc-0x0;var _0x13750c=_0xfeba[_0x141afc];return _0x13750c;};'use strict';function ZendeskAccount(_0xe6a33){this['id']=_0xe6a33['id']||0x0;this[_0xafeb('0x0')]=_0xe6a33[_0xafeb('0x0')]||'';this[_0xafeb('0x1')]=_0xe6a33['username']||'';this['password']=_0xe6a33['password']||'';this[_0xafeb('0x2')]=_0xe6a33[_0xafeb('0x2')]||'';this[_0xafeb('0x3')]=_0xe6a33[_0xafeb('0x3')]||'';this[_0xafeb('0x4')]=_0xe6a33[_0xafeb('0x4')]||'';this[_0xafeb('0x5')]=_0xe6a33[_0xafeb('0x5')]||'integrationTab';this['serverUrl']=_0xe6a33[_0xafeb('0x6')]||'';this[_0xafeb('0x7')]=_0xe6a33['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xc2be=['remoteUri','authType','type','serverUrl','Configurations','name','username','password','token'];(function(_0x5520af,_0x41002d){var _0x2e6299=function(_0x100033){while(--_0x100033){_0x5520af['push'](_0x5520af['shift']());}};_0x2e6299(++_0x41002d);}(_0xc2be,0x1c7));var _0xec2b=function(_0xb71c35,_0x129343){_0xb71c35=_0xb71c35-0x0;var _0x39224f=_0xc2be[_0xb71c35];return _0x39224f;};'use strict';function ZendeskAccount(_0x326c66){this['id']=_0x326c66['id']||0x0;this['name']=_0x326c66[_0xec2b('0x0')]||'';this[_0xec2b('0x1')]=_0x326c66[_0xec2b('0x1')]||'';this[_0xec2b('0x2')]=_0x326c66[_0xec2b('0x2')]||'';this[_0xec2b('0x3')]=_0x326c66[_0xec2b('0x3')]||'';this[_0xec2b('0x4')]=_0x326c66[_0xec2b('0x4')]||'';this[_0xec2b('0x5')]=_0x326c66[_0xec2b('0x5')]||'';this[_0xec2b('0x6')]=_0x326c66[_0xec2b('0x6')]||'integrationTab';this[_0xec2b('0x7')]=_0x326c66[_0xec2b('0x7')]||'';this['Configurations']=_0x326c66[_0xec2b('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a2fc2b2..c570381 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 _0x1ce8=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','host','zone','clientId'];(function(_0x5e404a,_0x4ce384){var _0x1c804d=function(_0x3ffee9){while(--_0x3ffee9){_0x5e404a['push'](_0x5e404a['shift']());}};_0x1c804d(++_0x4ce384);}(_0x1ce8,0xb0));var _0x81ce=function(_0x2adcb7,_0x55e06e){_0x2adcb7=_0x2adcb7-0x0;var _0x29aa90=_0x1ce8[_0x2adcb7];return _0x29aa90;};'use strict';function ZohoAccount(_0x240640){this['id']=_0x240640['id']||0x0;this[_0x81ce('0x0')]=_0x240640[_0x81ce('0x0')]||'';this['description']=_0x240640['description']||'';this[_0x81ce('0x1')]=_0x240640[_0x81ce('0x1')]||'';this['zone']=_0x240640[_0x81ce('0x2')]||'';this[_0x81ce('0x3')]=_0x240640['clientId']||'';this[_0x81ce('0x4')]=_0x240640[_0x81ce('0x4')]||'';this['serverUrl']=_0x240640[_0x81ce('0x5')]||'';this['code']=_0x240640[_0x81ce('0x6')]||'';this[_0x81ce('0x7')]=_0x240640[_0x81ce('0x7')]||'';this[_0x81ce('0x8')]=_0x240640[_0x81ce('0x8')]||{};}module[_0x81ce('0x9')]=ZohoAccount; \ No newline at end of file +var _0x0c92=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x598206,_0x5bd0cf){var _0x2f914c=function(_0x57c450){while(--_0x57c450){_0x598206['push'](_0x598206['shift']());}};_0x2f914c(++_0x5bd0cf);}(_0x0c92,0xc0));var _0x20c9=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0x0c92[_0x183256];return _0x5394a2;};'use strict';function ZohoAccount(_0x432acf){this['id']=_0x432acf['id']||0x0;this[_0x20c9('0x0')]=_0x432acf[_0x20c9('0x0')]||'';this['description']=_0x432acf[_0x20c9('0x1')]||'';this[_0x20c9('0x2')]=_0x432acf['host']||'';this['zone']=_0x432acf[_0x20c9('0x3')]||'';this[_0x20c9('0x4')]=_0x432acf[_0x20c9('0x4')]||'';this[_0x20c9('0x5')]=_0x432acf[_0x20c9('0x5')]||'';this[_0x20c9('0x6')]=_0x432acf[_0x20c9('0x6')]||'';this[_0x20c9('0x7')]=_0x432acf[_0x20c9('0x7')]||'';this[_0x20c9('0x8')]=_0x432acf['refreshToken']||'';this[_0x20c9('0x9')]=_0x432acf[_0x20c9('0x9')]||{};}module[_0x20c9('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 487a739..25b0ef9 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 _0x4888=['SIP/%s','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','calleridname','number','exports','lodash','moment','isNil','string','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent'];(function(_0xdfe644,_0xed6928){var _0x32483e=function(_0x42da68){while(--_0x42da68){_0xdfe644['push'](_0xdfe644['shift']());}};_0x32483e(++_0xed6928);}(_0x4888,0x198));var _0x8488=function(_0x3ea022,_0x2d5328){_0x3ea022=_0x3ea022-0x0;var _0x3b97a2=_0x4888[_0x3ea022];return _0x3b97a2;};'use strict';var util=require('util');var _=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));function checkNameSurname(_0x2af900,_0x13b2f0,_0x257275){var _0xacc8f0='';if(!_[_0x8488('0x2')](_0x13b2f0)&&'string'===typeof _0x13b2f0){_0xacc8f0+=_0x13b2f0;}if(!_[_0x8488('0x2')](_0x257275)&&_0x8488('0x3')===typeof _0x257275){_0xacc8f0+='\x20'+_0x257275;}if(_0xacc8f0!==''){return _0xacc8f0;}return _0x2af900;}function Action(_0x1a97f4,_0x421292,_0x326887,_0x19e508,_0x5250a1){this['uniqueid']=_0x326887||undefined;this['idContact']=_0x1a97f4['id'];this['queue']=_0x421292[_0x8488('0x4')];this[_0x8488('0x5')]=_0x421292['type'];this[_0x8488('0x6')]=_0x8488('0x7');this[_0x8488('0x8')]=![];this[_0x8488('0x9')]=_['isNil'](_0x1a97f4[_0x8488('0xa')])?undefined:_0x1a97f4[_0x8488('0xa')][_0x8488('0x4')];this[_0x8488('0xb')]=this[_0x8488('0x9')]?util['format'](_0x8488('0xc'),this[_0x8488('0x9')]):_0x19e508||undefined;this['calleridname']=checkNameSurname(_0x1a97f4['Contact'][_0x8488('0xd')],_0x1a97f4['Contact'][_0x8488('0xe')],_0x1a97f4['Contact']['lastName']);this[_0x8488('0xf')]=_0x1a97f4[_0x8488('0xf')]||![];this[_0x8488('0x10')]=_0x1a97f4[_0x8488('0xd')];this[_0x8488('0x11')]=_0x1a97f4[_0x8488('0x11')];this[_0x8488('0x12')]=_0x1a97f4['countbusyretry']||0x0;this[_0x8488('0x13')]=_0x1a97f4[_0x8488('0x13')]||0x0;this[_0x8488('0x14')]=_0x1a97f4[_0x8488('0x14')]||0x0;this[_0x8488('0x15')]=(_0x1a97f4[_0x8488('0x12')]||0x0)+(_0x1a97f4[_0x8488('0x13')]||0x0)+(_0x1a97f4[_0x8488('0x14')]||0x0)+(_0x1a97f4[_0x8488('0x16')]||0x0)+(_0x1a97f4[_0x8488('0x17')]||0x0)+(_0x1a97f4[_0x8488('0x18')]||0x0)+(_0x1a97f4[_0x8488('0x19')]||0x0)+(_0x1a97f4[_0x8488('0x1a')]||0x0);this['countnosuchnumberretry']=_0x1a97f4['countnosuchnumberretry']||0x0;this[_0x8488('0x17')]=_0x1a97f4[_0x8488('0x17')]||0x0;this[_0x8488('0x18')]=_0x1a97f4[_0x8488('0x18')]||0x0;this[_0x8488('0x19')]=_0x1a97f4[_0x8488('0x19')]||0x0;this[_0x8488('0x1a')]=_0x1a97f4[_0x8488('0x1a')]||0x0;this[_0x8488('0x1b')]=_0x1a97f4['callback'];this[_0x8488('0x1c')]=_0x1a97f4[_0x8488('0x1c')];this[_0x8488('0x1d')]=_0x1a97f4[_0x8488('0x1d')];this[_0x8488('0x1e')]=_0x1a97f4['recallme'];this['ContactId']=_0x1a97f4['ContactId'];this['ListId']=_0x1a97f4[_0x8488('0x1f')];this['UserId']=_['isNil'](_0x1a97f4[_0x8488('0xa')])?_0x1a97f4[_0x8488('0x20')]:_0x1a97f4[_0x8488('0xa')]['id'];this[_0x8488('0x21')]=_0x1a97f4[_0x8488('0x21')];this['originatecalleridnum']='';this[_0x8488('0x22')]='';}Action[_0x8488('0x23')][_0x8488('0x24')]=function(){return util[_0x8488('0x25')](_0x8488('0x26'),this[_0x8488('0x27')],this[_0x8488('0x28')]);};module[_0x8488('0x29')]=Action; \ No newline at end of file +var _0x32f4=['isNil','uniqueid','queue','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','format','calleridname','exports','util','lodash','moment','string'];(function(_0xfee5a0,_0x3253a4){var _0x1961ad=function(_0x245375){while(--_0x245375){_0xfee5a0['push'](_0xfee5a0['shift']());}};_0x1961ad(++_0x3253a4);}(_0x32f4,0x154));var _0x432f=function(_0x2e202d,_0x43c9f8){_0x2e202d=_0x2e202d-0x0;var _0x219cf6=_0x32f4[_0x2e202d];return _0x219cf6;};'use strict';var util=require(_0x432f('0x0'));var _=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));function checkNameSurname(_0x2b22ad,_0x5ee65a,_0x2a4628){var _0x6f0e8a='';if(!_['isNil'](_0x5ee65a)&&_0x432f('0x3')===typeof _0x5ee65a){_0x6f0e8a+=_0x5ee65a;}if(!_[_0x432f('0x4')](_0x2a4628)&&_0x432f('0x3')===typeof _0x2a4628){_0x6f0e8a+='\x20'+_0x2a4628;}if(_0x6f0e8a!==''){return _0x6f0e8a;}return _0x2b22ad;}function Action(_0x355b02,_0x2f5f03,_0x5d8cc0,_0x5b5f08,_0x2f66fd){this[_0x432f('0x5')]=_0x5d8cc0||undefined;this['idContact']=_0x355b02['id'];this[_0x432f('0x6')]=_0x2f5f03['name'];this[_0x432f('0x7')]=_0x2f5f03[_0x432f('0x7')];this[_0x432f('0x8')]=_0x432f('0x6');this[_0x432f('0x9')]=![];this['membername']=_[_0x432f('0x4')](_0x355b02['Agent'])?undefined:_0x355b02[_0x432f('0xa')]['name'];this[_0x432f('0xb')]=this[_0x432f('0xc')]?util['format'](_0x432f('0xd'),this[_0x432f('0xc')]):_0x5b5f08||undefined;this['calleridname']=checkNameSurname(_0x355b02[_0x432f('0xe')][_0x432f('0xf')],_0x355b02['Contact']['firstName'],_0x355b02[_0x432f('0xe')][_0x432f('0x10')]);this[_0x432f('0x11')]=_0x355b02[_0x432f('0x11')]||![];this[_0x432f('0x12')]=_0x355b02['phone'];this[_0x432f('0x13')]=_0x355b02[_0x432f('0x13')];this[_0x432f('0x14')]=_0x355b02[_0x432f('0x14')]||0x0;this['countcongestionretry']=_0x355b02[_0x432f('0x15')]||0x0;this[_0x432f('0x16')]=_0x355b02[_0x432f('0x16')]||0x0;this[_0x432f('0x17')]=(_0x355b02[_0x432f('0x14')]||0x0)+(_0x355b02[_0x432f('0x15')]||0x0)+(_0x355b02['countnoanswerretry']||0x0)+(_0x355b02[_0x432f('0x18')]||0x0)+(_0x355b02['countdropretry']||0x0)+(_0x355b02[_0x432f('0x19')]||0x0)+(_0x355b02[_0x432f('0x1a')]||0x0)+(_0x355b02[_0x432f('0x1b')]||0x0);this[_0x432f('0x18')]=_0x355b02[_0x432f('0x18')]||0x0;this[_0x432f('0x1c')]=_0x355b02[_0x432f('0x1c')]||0x0;this[_0x432f('0x19')]=_0x355b02[_0x432f('0x19')]||0x0;this[_0x432f('0x1a')]=_0x355b02[_0x432f('0x1a')]||0x0;this[_0x432f('0x1b')]=_0x355b02['countagentrejectretry']||0x0;this['callback']=_0x355b02[_0x432f('0x1d')];this['callbackuniqueid']=_0x355b02[_0x432f('0x1e')];this['callbackat']=_0x355b02[_0x432f('0x1f')];this[_0x432f('0x20')]=_0x355b02[_0x432f('0x20')];this[_0x432f('0x21')]=_0x355b02[_0x432f('0x21')];this[_0x432f('0x22')]=_0x355b02['ListId'];this[_0x432f('0x23')]=_[_0x432f('0x4')](_0x355b02['Agent'])?_0x355b02[_0x432f('0x23')]:_0x355b02[_0x432f('0xa')]['id'];this[_0x432f('0x24')]=_0x355b02[_0x432f('0x24')];this[_0x432f('0x25')]='';this[_0x432f('0x26')]='';}Action[_0x432f('0x27')]['getCaller']=function(){return util[_0x432f('0x28')]('\x22%s\x22\x20<%s>',this[_0x432f('0x29')],this['number']);};module[_0x432f('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8d63191..01d6828 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 _0x275f=['available','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','isNil','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','then','length','scheduledat','Agent','run','catch','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','isActive','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','total','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','outboundBusyCallsDay','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated','ANSWER','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','VoiceQueueId','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','variables','[originated][increment]','originated:\x20','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','filterKey','keys','variable','value','error','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','hangup','syncHangup','dialend','syncDialEnd','bind','newexten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking'];(function(_0x11acc9,_0x28841d){var _0x5d4de8=function(_0x19e79d){while(--_0x19e79d){_0x11acc9['push'](_0x11acc9['shift']());}};_0x5d4de8(++_0x28841d);}(_0x275f,0x111));var _0xf275=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x275f[_0x411e71];return _0x226ae3;};'use strict';var util=require('util');var _=require(_0xf275('0x0'));var uuid=require(_0xf275('0x1'));var moment=require(_0xf275('0x2'));var Redis=require(_0xf275('0x3'));var config=require(_0xf275('0x4'));var logger=require(_0xf275('0x5'))(_0xf275('0x6'));var loggerAction=require(_0xf275('0x5'))(_0xf275('0x7'));var ami=require(_0xf275('0x8'));var rpcDb=require(_0xf275('0x9'));var cmHopperAdditionalPhone=require(_0xf275('0xa'));var Action=require(_0xf275('0xb'));var ut=require(_0xf275('0xc'));var utils=require(_0xf275('0xd'));config[_0xf275('0xe')]=_[_0xf275('0xf')](config[_0xf275('0xe')],{'host':_0xf275('0x10'),'port':0x18eb});var io=require(_0xf275('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xf275('0x12')][_0xf275('0x13')]=function(_0x53facc){this[_0xf275('0x14')]=this[_0xf275('0x14')]?this[_0xf275('0x14')][_0xf275('0x15')](_0x53facc):_0x53facc();};function Preview(_0xe6acd3){this[_0xf275('0x16')]=new Sequence();this[_0xf275('0x17')]=_0xe6acd3[_0xf275('0x18')];this[_0xf275('0x19')]=_0xe6acd3[_0xf275('0x19')];this[_0xf275('0x1a')]={};this[_0xf275('0x1b')]=_0xe6acd3['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xf275('0x1c')]['bind'](this));ami['on'](_0xf275('0x1d'),this[_0xf275('0x1e')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0xf275('0x1f'),this[_0xf275('0x20')][_0xf275('0x21')](this));ami['on'](_0xf275('0x22'),this['syncNewExten']['bind'](this));ami['on'](_0xf275('0x23'),this[_0xf275('0x24')][_0xf275('0x21')](this));ami['on'](_0xf275('0x25'),this['syncAttendedTransfer'][_0xf275('0x21')](this));ami['on'](_0xf275('0x26'),this[_0xf275('0x27')][_0xf275('0x21')](this));this[_0xf275('0x28')](this[_0xf275('0x17')]);}function emit(_0x493b58,_0x53dfad,_0x55a46d){io['to'](_0x493b58)[_0xf275('0x29')](_0x53dfad,_0x55a46d);}function emitVoiceQueueChannelRemove(_0x34bd67){logger[_0xf275('0x2a')](_0xf275('0x2b'),JSON[_0xf275('0x2c')](_0x34bd67));emit(util[_0xf275('0x2d')](_0xf275('0x2e'),_0x34bd67[_0xf275('0x2f')]),_0xf275('0x30'),_0x34bd67);io[_0xf275('0x29')](_0xf275('0x31'),_0x34bd67);}function notSendMessagesQueue(_0x6d9b2b){if(_0x6d9b2b[_0xf275('0x32')]){if(_0x6d9b2b['originated']===0x0&&_0x6d9b2b[_0xf275('0x33')]===0x0){_0x6d9b2b[_0xf275('0x32')]=![];_0x6d9b2b[_0xf275('0x34')]=0x0;_0x6d9b2b['paused']=0x0;_0x6d9b2b[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x37')];ut[_0xf275('0x38')](_0xf275('0x39'),_0x6d9b2b[_0xf275('0x2f')]+_0xf275('0x3a'));}else{_0x6d9b2b[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x3b')];ut[_0xf275('0x38')](_0xf275('0x39'),_0x6d9b2b['name']+'\x20is\x20deactivated');}}}Preview[_0xf275('0x12')][_0xf275('0x28')]=function(){var _0x45950e=this;setInterval(function(){_0x45950e[_0xf275('0x3c')]();},0x7cf);};Preview[_0xf275('0x12')]['syncCampaigns']=function(){var _0x1386df=this[_0xf275('0x17')];this[_0xf275('0x3d')]+=0x1;for(var _0x34a858 in _0x1386df){if(_0x1386df[_0xf275('0x3e')](_0x34a858)&&(_0x1386df[_0x34a858][_0xf275('0x3f')]===_0xf275('0x6')||_0x1386df[_0x34a858][_0xf275('0x3f')]===_0xf275('0x40'))&&_0x1386df[_0x34a858]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xf275('0x41')]();}}if(_0x1386df[_0xf275('0x3e')](_0x34a858)&&_0x1386df[_0x34a858][_0xf275('0x3f')]===_0xf275('0x6')&&_0x1386df[_0x34a858]['type']==='outbound'){if(_0x1386df[_0x34a858][_0xf275('0x42')]){this[_0xf275('0x43')](_0x1386df[_0x34a858]);if(_0x1386df[_0x34a858][_0xf275('0x44')])this['recallMe'](_0x1386df[_0x34a858]);}else{notSendMessagesQueue(_0x1386df[_0x34a858]);}}}};Preview[_0xf275('0x12')]['clearZombieChannel']=function(_0x5ef6ae){var _0x1b5dc5=this;this[_0xf275('0x16')][_0xf275('0x13')](function(){if(!_[_0xf275('0x45')](_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae])){loggerAction[_0xf275('0x2a')](_0xf275('0x46'),_0x5ef6ae,'Queue',_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae][_0xf275('0x47')],'originated:\x20',JSON[_0xf275('0x2c')](_0x1b5dc5[_0xf275('0x17')][_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae][_0xf275('0x47')]]['originated']),_0xf275('0x48'),JSON[_0xf275('0x2c')](_0x1b5dc5[_0xf275('0x17')][_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae][_0xf275('0x47')]][_0xf275('0x33')]),JSON[_0xf275('0x2c')](_0x1b5dc5['actions'][_0x5ef6ae][_0xf275('0x49')]),JSON[_0xf275('0x2c')](_[_0xf275('0x4a')](_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae],[_0xf275('0x4b'),_0xf275('0x4c'),'VoiceQueueId',_0xf275('0x4d')])));return ami[_0xf275('0x4e')]({'action':_0xf275('0x4f'),'channel':_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae]['channel']})['catch'](function(_0x20ef4d){if(_0x20ef4d['message']===_0xf275('0x50')){setTimeout(function(){if(_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae]){ut['updateOriginated'](_0x1b5dc5['campaignsPreview'][_0x1b5dc5['actions'][_0x5ef6ae][_0xf275('0x47')]],_0xf275('0x51'));if(_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae]['dialAnswer']===!![]){ut[_0xf275('0x52')](_0x1b5dc5[_0xf275('0x17')][_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae]['queue']],_0xf275('0x51'));ut['loggerError'](_0xf275('0x53')+_0x5ef6ae,_0x1b5dc5[_0xf275('0x1a')][_0x5ef6ae][_0xf275('0x47')]);}ut[_0xf275('0x54')](_0xf275('0x55')+_0x5ef6ae,_0x1b5dc5['actions'][_0x5ef6ae][_0xf275('0x47')]);delete _0x1b5dc5['actions'][_0x5ef6ae];}},0x2328);}});}});};Preview[_0xf275('0x12')][_0xf275('0x41')]=function(){var _0x2aa6f8=this;loggerAction['info'](_0xf275('0x56'),_[_0xf275('0x57')](this['actions']));for(var _0xbebe43 in this[_0xf275('0x1a')]){if(_0x2aa6f8['actions'][_0xf275('0x3e')](_0xbebe43)){_0x2aa6f8[_0xf275('0x58')](_0xbebe43);}}};Preview['prototype'][_0xf275('0x59')]=function(_0x4280a2){var _0x50ad23=this;rpcDb[_0xf275('0x5a')](_0x4280a2['id'],ut[_0xf275('0x5b')](this[_0xf275('0x1b')]))[_0xf275('0x5c')](function(_0x10d49b){if(!_[_0xf275('0x45')](_0x10d49b)){for(var _0x357b94=0x0;_0x357b94<_0x10d49b[_0xf275('0x5d')];_0x357b94+=0x1){if(ut['getDiff'](_0x10d49b[_0x357b94][_0xf275('0x5e')])<_0x4280a2['dialRecallMeTimeout']*0x3c){if(_0x10d49b[_0x357b94][_0xf275('0x5f')]&&!_0x10d49b[_0x357b94][_0xf275('0x5f')]['voicePause']){_0x50ad23[_0xf275('0x60')](_0x10d49b[_0x357b94]['id'])['then'](ut['logger2']('[RecallMe]'))[_0xf275('0x61')](ut[_0xf275('0x62')](_0xf275('0x63')));}else{rpcDb[_0xf275('0x64')](_0x10d49b[_0x357b94]['id']);}}else{var _0x1c256a=new Action(_0x10d49b[_0x357b94],_0x4280a2);_0x1c256a[_0xf275('0x65')]=moment()[_0xf275('0x2d')](_0xf275('0x66'));_0x4280a2['outboundReCallsDay']+=0x1;ut[_0xf275('0x67')](_0x1c256a,0x17,_0xf275('0x68'));if(_0x4280a2[_0xf275('0x69')]){rpcDb[_0xf275('0x6a')](ut['createBody'](_0x10d49b[_0x357b94]));rpcDb[_0xf275('0x6b')](_0x1c256a,_0xf275('0x6c'));}else{ut[_0xf275('0x67')](_0x1c256a,0x16,_0xf275('0x6d'));rpcDb[_0xf275('0x6b')](_0x1c256a,_0xf275('0x6e'));rpcDb['createCustomerFinal'](_0x1c256a,_0xf275('0x6e'));}}}}})['catch'](ut[_0xf275('0x62')](_0xf275('0x6f')));};Preview[_0xf275('0x12')]['setMessage']=function(_0x4e698a){_0x4e698a[_0xf275('0x32')]=!![];if(ut['IsNotLoggedIn'](_0x4e698a[_0xf275('0x70')])){_0x4e698a[_0xf275('0x35')]=utils[_0xf275('0x36')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xf275('0x71')](_0x4e698a['dialActive'])){_0x4e698a[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x37')];}else if(!this['isTrunkReachable'](_0x4e698a[_0xf275('0x72')])){if(!this['isTrunkReachable'](_0x4e698a[_0xf275('0x73')])){_0x4e698a['message']=utils[_0xf275('0x36')][_0xf275('0x74')];}else{_0x4e698a[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x75')];}}else{_0x4e698a[_0xf275('0x35')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}};Preview[_0xf275('0x12')][_0xf275('0x76')]=function(_0x1b6482,_0x459b83,_0x432cee){var _0x413910=this;var _0x3733ff=this[_0xf275('0x1a')][_0x459b83];var _0x98a54f=this[_0xf275('0x17')][_0x3733ff['queue']];var _0x3eae73;var _0x27a867=![];var _0x1a8b80=0x2;var _0x456463=0x3;if(_0x98a54f){switch(_0x432cee){case'1':_0x98a54f[_0xf275('0x77')]+=0x1;_0x3733ff[_0xf275('0x78')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x0,_0xf275('0x7b'));ami['emit'](_0xf275('0x7c'),ut[_0xf275('0x7d')](_0x3733ff,'nosuchnumber'));rpcDb[_0xf275('0x6b')](_0x3733ff,'[callProgressDetectingCustomer][logNoSuch]');_0x413910[_0xf275('0x7e')](_0x3733ff,'0',_0x98a54f)[_0xf275('0x5c')](function(_0x5adf8c){_0x27a867=_0x5adf8c[_0xf275('0x7f')]==0x1;_0x1a8b80=_0x98a54f[_0xf275('0x80')];_0x456463=_0x98a54f[_0xf275('0x81')];if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0x86'));}else{if(_0x3733ff[_0xf275('0x78')]>=_0x98a54f['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x3733ff,_0xf275('0x86'));}else{rpcDb['rescheduleContact'](ut[_0xf275('0x87')](_0x3733ff,_0xf275('0x78'),_0x98a54f[_0xf275('0x80')]),_0x3733ff[_0xf275('0x88')],_0x3733ff[_0xf275('0x89')]);}}delete this[_0xf275('0x1a')][_0x1b6482[_0xf275('0x8a')]];}else{_0x3733ff[_0xf275('0x78')]++;logger[_0xf275('0x2a')](_0xf275('0x8b'),_0x3733ff[_0xf275('0x78')]);logger[_0xf275('0x2a')]('id',_0x3733ff[_0xf275('0x8c')]);_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countnosuchnumberretry':_0x3733ff[_0xf275('0x78')]}})[_0xf275('0x5c')](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)['then'](function(){});});}});break;case'ANSWER':var _0x5e7722=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3733ff['responsetime']=_0x5e7722;_0x3733ff[_0xf275('0x8f')]=_0x5e7722;_0x3733ff['dialAnswer']=!![];_0x98a54f[_0xf275('0x33')]+=0x1;logger[_0xf275('0x2a')](_0xf275('0x90'),_0x3733ff[_0xf275('0x91')],_0xf275('0x92'),_0x98a54f['name'],_0xf275('0x48'),_0x98a54f['pTalking']);ami['emit'](_0xf275('0x93'),ut[_0xf275('0x7d')](_0x3733ff,_0xf275('0x94'),this['campaignsPreview'][_0x3733ff[_0xf275('0x47')]]));if(_0x98a54f[_0xf275('0x95')]){ami[_0xf275('0x29')]('custom:agentConnectPreview',ut[_0xf275('0x96')](_0x3733ff));}break;case'16':ami[_0xf275('0x29')](_0xf275('0x97'),ut[_0xf275('0x7d')](_0x3733ff,_0xf275('0x98'),this[_0xf275('0x17')][_0x3733ff[_0xf275('0x47')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3733ff,_0xf275('0x98')));_0x98a54f['outboundAnswerCallsDay']+=0x1;_0x98a54f[_0xf275('0x99')]+=0x1;_0x98a54f['answered']+=0x1;ut['decrementTalkink'](_0x98a54f,'[16]');_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x4,_0xf275('0x9a'));rpcDb['createCustomerHistory'](_0x3733ff,_0xf275('0x9b'));rpcDb['createCustomerFinal'](_0x3733ff,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xf275('0x9c')](_0x3733ff);_0x98a54f['sumDuration']+=_0x3733ff[_0xf275('0x9d')];_0x98a54f[_0xf275('0x9e')]+=_0x3733ff[_0xf275('0x9d')];logger[_0xf275('0x2a')](_0xf275('0x9f'),_0x3733ff[_0xf275('0x91')],_0xf275('0x92'),_0x98a54f[_0xf275('0x2f')],'pTalking:\x20',_0x98a54f[_0xf275('0x33')]);delete this[_0xf275('0x1a')][_0x1b6482[_0xf275('0x8a')]];break;case'BUSY':_0x98a54f[_0xf275('0xa0')]+=0x1;_0x3733ff['countbusyretry']+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x5,'Busy');_0x1a8b80=_0x98a54f[_0xf275('0xa1')];_0x456463=_0x98a54f['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentbusy',ut[_0xf275('0x7d')](_0x3733ff,'busy'));rpcDb[_0xf275('0x6b')](_0x3733ff,_0xf275('0xa2'));_0x413910[_0xf275('0x7e')](_0x3733ff,'5',_0x98a54f)[_0xf275('0x5c')](function(_0x427b5e){_0x27a867=_0x427b5e['additional']==0x1;if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut['cloneAction'](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xa3'));}else{if(_0x3733ff[_0xf275('0xa4')]>=_0x98a54f[_0xf275('0xa5')]){rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xa2'));}else{rpcDb['rescheduleContact'](ut[_0xf275('0x87')](_0x3733ff,'countbusyretry',_0x98a54f[_0xf275('0xa1')]),_0x3733ff[_0xf275('0x88')],_0x3733ff[_0xf275('0x89')]);}}}else{_0x3733ff['countbusyretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countbusyretry':_0x3733ff[_0xf275('0xa4')]}})[_0xf275('0x5c')](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)['then'](function(){});});}});break;case _0xf275('0xa6'):_0x98a54f[_0xf275('0xa7')]+=0x1;_0x3733ff[_0xf275('0xa8')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut['totalGlobal'](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x3,_0xf275('0xa9'));_0x1a8b80=_0x98a54f[_0xf275('0xaa')];_0x456463=_0x98a54f[_0xf275('0x81')];var _0x5af372=ut['buildNoAnswerEventPayload'](_0x3733ff,_0x98a54f);ami[_0xf275('0x29')](_0xf275('0xab'),_0x5af372);rpcDb[_0xf275('0x6b')](_0x3733ff,'[callProgressDetectingCustomer][logNoAnswer]');_0x413910['verifyAdditionalPhones'](_0x3733ff,'3',_0x98a54f)[_0xf275('0x5c')](function(_0x47576a){_0x27a867=_0x47576a[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut['totalGlobal'](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xac'));}else{if(_0x3733ff[_0xf275('0xa8')]>=_0x98a54f['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x3733ff,_0xf275('0xad'));}else{rpcDb[_0xf275('0xae')](ut[_0xf275('0x87')](_0x3733ff,_0xf275('0xa8'),_0x98a54f[_0xf275('0xaa')]),_0x3733ff[_0xf275('0x88')],_0x3733ff[_0xf275('0x89')]);}}}else{_0x3733ff['countnoanswerretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff['idContact'],'field':{'countnoanswerretry':_0x3733ff[_0xf275('0xa8')]}})[_0xf275('0x5c')](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});break;case _0xf275('0xaf'):_0x98a54f[_0xf275('0xb0')]+=0x1;_0x3733ff[_0xf275('0xb1')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x8,_0xf275('0xb2'));_0x1a8b80=_0x98a54f[_0xf275('0xb3')];_0x456463=_0x98a54f[_0xf275('0x81')];ami[_0xf275('0x29')]('custom:agentcongestion',ut['buildObj'](_0x3733ff,'congestion'));rpcDb[_0xf275('0x6b')](_0x3733ff,_0xf275('0xb4'));_0x413910[_0xf275('0x7e')](_0x3733ff,'8',_0x98a54f)[_0xf275('0x5c')](function(_0x1f8035){_0x27a867=_0x1f8035[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut['totalGlobal'](_0x3733ff)>=_0x98a54f['dialGlobalMaxRetry']){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xb5'));}else{if(_0x3733ff[_0xf275('0xb1')]>=_0x98a54f[_0xf275('0xb6')]){rpcDb['createCustomerFinal'](_0x3733ff,_0xf275('0xb4'));}else{rpcDb[_0xf275('0xae')](ut[_0xf275('0x87')](_0x3733ff,_0xf275('0xb1'),_0x98a54f[_0xf275('0xa1')]),_0x3733ff['unlockAgent'],_0x3733ff[_0xf275('0x89')]);}}}else{_0x3733ff['countcongestionretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countcongestionretry':_0x3733ff['countcongestionretry']}})['then'](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});break;case'CANCEL':_0x98a54f['outboundRejectCallsDay']+=0x1;_0x3733ff[_0xf275('0xb7')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut['totalGlobal'](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x14,_0xf275('0xb8'));_0x1a8b80=_0x98a54f[_0xf275('0xb9')];_0x456463=_0x98a54f[_0xf275('0x81')];ami[_0xf275('0x29')](_0xf275('0xba'),ut[_0xf275('0x7d')](_0x3733ff,'agentreject'));rpcDb[_0xf275('0x6b')](_0x3733ff,'[syncHangupRequest][logAgentReject]');_0x413910[_0xf275('0x7e')](_0x3733ff,'20',_0x98a54f)[_0xf275('0x5c')](function(_0x59683c){_0x27a867=_0x59683c['additional']==0x1;if(!_0x27a867){if(ut['totalGlobal'](_0x3733ff)>=_0x98a54f['dialGlobalMaxRetry']){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0x14,'AgentReject');rpcDb[_0xf275('0x85')](_0x3eae73,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3733ff[_0xf275('0xb7')]>=_0x98a54f['dialAgentRejectMaxRetry']){rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xbb'));}else{rpcDb[_0xf275('0xae')](ut['scheduledAt'](_0x3733ff,_0xf275('0xb7'),_0x98a54f[_0xf275('0xb9')]),_0x3733ff[_0xf275('0x88')],_0x3733ff['activeContact']);}}}else{_0x3733ff[_0xf275('0xa8')]++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countnoanswerretry':_0x3733ff[_0xf275('0xa8')]}})[_0xf275('0x5c')](function(){_0x413910['swapAdditionalPhones'](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});break;case _0xf275('0xbc'):_0x98a54f[_0xf275('0xbd')]+=0x1;_0x3733ff[_0xf275('0xbe')]+=0x1;_0x3733ff['countglobal']=ut[_0xf275('0x7a')](_0x3733ff);ut['logCustomer'](_0x3733ff,0xb,_0xf275('0xbf'));rpcDb[_0xf275('0x6b')](_0x3733ff,_0xf275('0xc0'));_0x413910[_0xf275('0x7e')](_0x3733ff,'11',_0x98a54f)[_0xf275('0x5c')](function(_0x6f3325){_0x27a867=_0x6f3325[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f['dialGlobalMaxRetry']){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,'Global');rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xc0'));}else{if(_0x3733ff[_0xf275('0xc1')]>=_0x98a54f[_0xf275('0xc2')]){rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xc0'));}else{rpcDb[_0xf275('0xae')](ut['scheduledAt'](_0x3733ff,_0xf275('0xbe'),_0x98a54f[_0xf275('0xc3')]),_0x3733ff['unlockAgent'],_0x3733ff['activeContact']);}}}else{_0x3733ff['countnoanswerretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countnoanswerretry':_0x3733ff['countnoanswerretry']}})[_0xf275('0x5c')](function(){_0x413910['swapAdditionalPhones'](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});break;case'18':_0x98a54f[_0xf275('0xc4')]+=0x1;_0x3733ff[_0xf275('0xc5')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x12,_0x1b6482['cause-txt']||_0x1b6482[_0xf275('0xc6')]);ami[_0xf275('0x29')]('custom:amd',ut[_0xf275('0x7d')](_0x3733ff,_0xf275('0xc7')));rpcDb['createCustomerHistory'](_0x3733ff,_0xf275('0xc8'));_0x413910[_0xf275('0x7e')](_0x3733ff,'18',_0x98a54f)[_0xf275('0x5c')](function(_0x5aa198){_0x27a867=_0x5aa198[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0x12,'Global');rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xc8'));}else{rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xc8'));}}else{_0x3733ff[_0xf275('0xa8')]++;_0x413910['incrementPreviewCounters']({'id':_0x3733ff[_0xf275('0x8c')],'field':{'countnoanswerretry':_0x3733ff[_0xf275('0xa8')]}})[_0xf275('0x5c')](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});});}});delete this[_0xf275('0x1a')][_0x1b6482['linkedid']];break;case'19':_0x98a54f[_0xf275('0xc4')]+=0x1;_0x3733ff[_0xf275('0x79')]=ut[_0xf275('0x7a')](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0x13,_0x1b6482[_0xf275('0xc9')]||_0x1b6482[_0xf275('0xc6')]);ami[_0xf275('0x29')](_0xf275('0xca'),ut[_0xf275('0x7d')](_0x3733ff,'amd'));rpcDb[_0xf275('0x6b')](_0x3733ff,'[callProgressDetectingCustomer][machine]');_0x413910['verifyAdditionalPhones'](_0x3733ff,'18',_0x98a54f)[_0xf275('0x5c')](function(_0x459346){_0x27a867=_0x459346[_0xf275('0x7f')]==0x1;if(!_0x27a867){if(ut[_0xf275('0x7a')](_0x3733ff)>=_0x98a54f['dialGlobalMaxRetry']){_0x3eae73=ut['cloneAction'](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,_0xf275('0xcb'));}else{rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xcb'));}}else{_0x3733ff['countnoanswerretry']++;_0x413910[_0xf275('0x8d')]({'id':_0x3733ff['idContact'],'field':{'countnoanswerretry':_0x3733ff[_0xf275('0xa8')]}})['then'](function(){_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)['then'](function(){});});}});delete this['actions'][_0x1b6482[_0xf275('0x8a')]];break;default:if(_0x3733ff['dialAnswer']){ut['decrementTalkink'](_0x98a54f,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x98a54f['name'],_0x1b6482);}_0x98a54f['outboundUnknownCallsDay']+=0x1;_0x3733ff[_0xf275('0x79')]=ut['totalGlobal'](_0x3733ff);ut[_0xf275('0x67')](_0x3733ff,0xc,_0x1b6482[_0xf275('0xc9')]||_0x1b6482[_0xf275('0xc6')]);_0x1a8b80=_0x98a54f[_0xf275('0xb9')];_0x456463=_0x98a54f[_0xf275('0x81')];rpcDb[_0xf275('0x6b')](_0x3733ff,_0xf275('0xcc'));_0x413910[_0xf275('0x7e')](_0x3733ff,'20',_0x98a54f)[_0xf275('0x5c')](function(_0x438809){_0x27a867=_0x438809['additional']==0x1;if(!_0x27a867){if(ut['totalGlobal'](_0x3733ff)>=_0x98a54f[_0xf275('0x82')]){_0x3eae73=ut[_0xf275('0x83')](_0x3733ff,0xf,_0xf275('0x84'));rpcDb[_0xf275('0x85')](_0x3eae73,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xf275('0x85')](_0x3733ff,_0xf275('0xcd'));}delete this[_0xf275('0x1a')][_0x1b6482[_0xf275('0x8a')]];}else{_0x413910[_0xf275('0x8e')](_0x3733ff,_0x1a8b80,_0x456463)[_0xf275('0x5c')](function(){});}});}if(!(_0x3733ff[_0xf275('0x49')]&&_0x432cee==='16')){ut['updateOriginated'](_0x98a54f,_0xf275('0xce'));logger[_0xf275('0x2a')]('[originated][decrement][callProgressDetectingCustomer]',_0x3733ff[_0xf275('0x91')],_0xf275('0x92'),_0x98a54f[_0xf275('0x2f')],'originated:\x20',_0x98a54f[_0xf275('0xcf')]);}if(_0x432cee!==_0xf275('0xd0')){delete this[_0xf275('0x1a')][_0x1b6482['linkedid']];delete this[_0xf275('0x1a')][_0x1b6482[_0xf275('0xd1')]];}_0x98a54f[_0xf275('0xd2')]=!![];}};Preview[_0xf275('0x12')]['callProgressDetectingAgent']=function(_0x45424f,_0x4022a5,_0x24c055){if(_[_0xf275('0xd3')](_0x4022a5)&&_0xf275('0xd4')!==typeof _0x4022a5){return;}if(_[_0xf275('0xd3')](_0x24c055)&&_0xf275('0xd4')!==typeof _0x24c055){return;}switch(_0x24c055['reason']){case'0':ut['logAgent'](_0x45424f,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x45424f,_0xf275('0xd5'));break;case'3':ut[_0xf275('0xd6')](_0x45424f,0x3,_0xf275('0xa9'));rpcDb[_0xf275('0xd7')](_0x45424f,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xf275('0xd6')](_0x45424f,0x5,_0xf275('0xd8'));rpcDb['createAgentHistory'](_0x45424f,_0xf275('0xd9'));break;case'8':ut[_0xf275('0xd6')](_0x45424f,0x8,_0xf275('0xb2'));rpcDb[_0xf275('0xd7')](_0x45424f,_0xf275('0xda'));break;case'22':ut[_0xf275('0xd6')](_0x45424f,0x16,_0xf275('0xdb'));rpcDb[_0xf275('0xd7')](_0x45424f,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xf275('0xd6')](_0x45424f,0xc,_0x24c055[_0xf275('0xdc')]);rpcDb[_0xf275('0xd7')](_0x45424f,_0xf275('0xda'));}ut[_0xf275('0xdd')](_0x4022a5,_0xf275('0xde'));logger['info'](_0xf275('0xdf'),_0x45424f[_0xf275('0x91')],_0xf275('0x92'),_0x4022a5[_0xf275('0x2f')],'originated:\x20',_0x4022a5[_0xf275('0xcf')]);delete this['actions'][_0x45424f[_0xf275('0x91')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x27be6a,_0x5593b2,_0x30c258){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x27be6a,_0x5593b2,_0x30c258)[_0xf275('0x61')](logger[_0xf275('0x2a')](_0xf275('0xe0')));};Preview[_0xf275('0x12')][_0xf275('0x8e')]=function(_0x17764e,_0x58d77c,_0x356a6e){return cmHopperAdditionalPhone[_0xf275('0x8e')](_0x17764e,_0x58d77c,_0x356a6e)[_0xf275('0x61')](logger[_0xf275('0x2a')](_0xf275('0xe1')));};Preview[_0xf275('0x12')][_0xf275('0x8d')]=function(_0x49bf68){return Promise[_0xf275('0xe2')]()[_0xf275('0x5c')](cmHopperAdditionalPhone[_0xf275('0x8d')](_0x49bf68))[_0xf275('0x61')](logger[_0xf275('0x2a')](_0xf275('0xe3')));};Preview[_0xf275('0x12')][_0xf275('0xe4')]=function(_0xe650c7,_0x117953,_0x28027e,_0x525b82,_0xd4870d){var _0x6a4326=this;return new Promise(function(_0x39ae99,_0xe1483){if(_[_0xf275('0x45')](_0x117953)||_[_0xf275('0x45')](_0x117953[_0xf275('0xe5')])||_[_0xf275('0x45')](_0x117953[_0xf275('0xe6')])||_['isNil'](_0x117953['VoiceQueueId'])){_0xe1483(ut[_0xf275('0x35')](_0xf275('0xe7'),_0x525b82,_0xd4870d));return;}var _0x4aa4e2=uuid['v4']();var _0x2b30f8=_0x6a4326['campaignsPreview'][_0x117953[_0xf275('0xe8')]['name']];var _0x3023a4=_0x28027e?_0x6a4326[_0xf275('0x1b')][_0x28027e]['id']:undefined;_0x6a4326[_0xf275('0x1a')][_0x4aa4e2]=new Action(_0x117953,_0x2b30f8,_0x4aa4e2,_0x28027e,_0x3023a4);var _0x324cdc=_0x6a4326['actions'][_0x4aa4e2];_0x324cdc[_0xf275('0x88')]=_0x525b82;_0x324cdc[_0xf275('0x89')]=_0xd4870d;_0x324cdc[_0xf275('0xe9')]=_0x28027e;if(_[_0xf275('0xea')](_0xe650c7)){_0x6a4326[_0xf275('0xeb')](_0x324cdc,_0x2b30f8,_0x117953,_0x28027e)[_0xf275('0x5c')](function(_0x2b3866){logger['info'](_0xf275('0xec'),_0xf275('0xed')+_0x324cdc[_0xf275('0x47')]+_0xf275('0xee')+_0x324cdc[_0xf275('0x8c')],JSON['stringify'](_0x2b3866));ami[_0xf275('0x29')](_0xf275('0xef'),ut['buildObj'](_0x324cdc,_0xf275('0xf0'),_0x6a4326[_0xf275('0x17')][_0x324cdc[_0xf275('0x47')]]));_0x39ae99(ut['message'](_0xf275('0xf1')));})[_0xf275('0x61')](function(_0x43aba8){ut[_0xf275('0x38')](_0xf275('0xf2'),_0x43aba8);_0xe1483(ut[_0xf275('0x35')](_0xf275('0xf3'),_0x525b82,_0xd4870d));});}else{_0x2b30f8[_0xf275('0xf4')]+=0x1;ut['logBlacklist'](_0x324cdc);rpcDb[_0xf275('0xf5')](_0x324cdc,_0xf275('0xf6'));delete _0x6a4326[_0xf275('0x1a')][_0x4aa4e2];_0xe1483(ut[_0xf275('0x35')](_0xf275('0xf7'),_0x525b82,_0xd4870d));}});};Preview[_0xf275('0x12')][_0xf275('0xf8')]=function(_0xc556a7){return!_[_0xf275('0x45')](_0xc556a7)&&!_[_0xf275('0x45')](_0xc556a7[_0xf275('0x2f')])&&!_[_0xf275('0x45')](_0xc556a7['active'])&&_0xc556a7[_0xf275('0xf9')]&&!_['isNil'](this[_0xf275('0x19')][util[_0xf275('0x2d')]('SIP/%s',_0xc556a7[_0xf275('0x2f')])])&&!_['isNil'](this[_0xf275('0x19')][util[_0xf275('0x2d')](_0xf275('0xfa'),_0xc556a7[_0xf275('0x2f')])][_0xf275('0x4f')])&&(this[_0xf275('0x19')][util[_0xf275('0x2d')](_0xf275('0xfa'),_0xc556a7['name'])]['status']===_0xf275('0xfb')||this[_0xf275('0x19')][util['format'](_0xf275('0xfa'),_0xc556a7[_0xf275('0x2f')])]['status']===_0xf275('0xfc'));};Preview[_0xf275('0x12')]['run']=function(_0x237e45,_0x7b2d8c){return this[_0xf275('0xfd')](_0x237e45,_0x7b2d8c)[_0xf275('0x5c')](function(_0x161178){return _['pick'](_0x161178,['message']);})[_0xf275('0x61')](function(_0x4923c3){if(_0x4923c3[_0xf275('0xfe')]){rpcDb[_0xf275('0xff')](_0x237e45);}if(_0x4923c3['active']){rpcDb['disableContact'](_0x237e45);}throw _[_0xf275('0x4a')](_0x4923c3,[_0xf275('0x35')]);});};Preview[_0xf275('0x12')][_0xf275('0xfd')]=function(_0x8fd422,_0x3d24cf){var _0x39687a=this;var _0x2be3d9,_0x10dfaa;return rpcDb[_0xf275('0x100')](_0x8fd422)[_0xf275('0x5c')](function(_0x5c7cdc){if(!_[_0xf275('0x45')](_0x5c7cdc[0x0])){_0x10dfaa=_0x5c7cdc[0x0][_0xf275('0x101')]?![]:!![];_0x2be3d9=_0x5c7cdc[0x0]['recallme']?!![]:![];_0x2be3d9=_0x3d24cf?!![]:_0x2be3d9;}var _0x574b34=_0x39687a['validateContact'](_0x5c7cdc);if(_0x574b34[_0xf275('0x102')]){rpcDb[_0xf275('0x103')](_['pick'](_0x5c7cdc[0x0],[_0xf275('0x104'),_0xf275('0xe6')]))[_0xf275('0x5c')](function(_0x422bee){_0x39687a[_0xf275('0xe4')](_0x422bee,_0x5c7cdc[0x0],_0x3d24cf,_0x10dfaa,_0x2be3d9)[_0xf275('0x5c')](function(_0x43e14d){return _0x43e14d;})['catch'](function(_0x4f1e88){throw _0x4f1e88;});})[_0xf275('0x61')](function(_0x1e25ae){ut['logger'](_0xf275('0x105'),_0x1e25ae);throw ut[_0xf275('0x35')](_0xf275('0x106'),_0x10dfaa,_0x2be3d9);});}else{throw ut[_0xf275('0x35')](_0x574b34[_0xf275('0x35')],_0x10dfaa,_0x2be3d9);}})[_0xf275('0x61')](function(_0xca836b){ut[_0xf275('0x38')](_0xf275('0x107'),_0xca836b);throw ut[_0xf275('0x35')](_0xf275('0x106'),![],!![]);});};Preview[_0xf275('0x12')][_0xf275('0x108')]=function(_0xd70dcf){if(_[_0xf275('0x45')](_0xd70dcf)||_['isEmpty'](_0xd70dcf)||!_[_0xf275('0x45')](_0xd70dcf[0x0][_0xf275('0x5f')])&&_['isNil'](_0xd70dcf[0x0][_0xf275('0x5f')][_0xf275('0x2f')])){ut[_0xf275('0x38')](_0xf275('0x109'),_0xd70dcf);return{'isValid':![],'message':_0xf275('0x10a')};}var _0x399b0c=this[_0xf275('0x17')][_0xd70dcf[0x0]['Queue']['name']];_0x399b0c[_0xf275('0x35')]=utils[_0xf275('0x36')][_0xf275('0x75')];if(_['isNil'](_0x399b0c)){ut[_0xf275('0x38')](_0xf275('0x10b'),_0x399b0c);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xf275('0xf8')](_0x399b0c['Trunk'])){ut[_0xf275('0x38')](_0xf275('0x10c'),_0xf275('0x10d')+_0x399b0c['name']+_0xf275('0x10e'));if(!this[_0xf275('0xf8')](_0x399b0c[_0xf275('0x73')])){ut[_0xf275('0x38')](_0xf275('0x10c'),_0x399b0c[_0xf275('0x2f')]+_0xf275('0x10f'));return{'isValid':![],'message':_0xf275('0x110')};}}if(!ut['isActive'](_0x399b0c['dialActive'])){ut[_0xf275('0x38')]('[Preview][validateContact][Campaign\x20Active]',_0x399b0c[_0xf275('0x2f')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x399b0c[_0xf275('0x2f')]+_0xf275('0x111')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0xf275('0xeb')]=function(_0x399bd8,_0x70912,_0x1f16eb,_0x3af53b){var _0xeb6174=this;return new Promise(function(_0x57c2d1,_0x180d0f){var _0x26e2c3=_0x399bd8[_0xf275('0x91')];var _0x4ed301=_0xeb6174[_0xf275('0xf8')](_0x70912['Trunk'])?util[_0xf275('0x2d')](_0xf275('0x112'),_0x70912[_0xf275('0x72')]['name'],_[_0xf275('0x45')](_0x70912[_0xf275('0x113')])?'':_0x70912['dialPrefix'][_0xf275('0x114')]()||'',_0x70912[_0xf275('0x115')]>0x0?_0x1f16eb[_0xf275('0xe6')]['substring'](_0x70912[_0xf275('0x115')]):_0x1f16eb['phone']):util[_0xf275('0x2d')]('SIP/%s/%s%s',_[_0xf275('0x45')](_0x70912[_0xf275('0x73')])?_0x70912[_0xf275('0x72')][_0xf275('0x2f')]:_0x70912[_0xf275('0x73')][_0xf275('0x2f')],_['isNil'](_0x70912[_0xf275('0x113')])?'':_0x70912[_0xf275('0x113')][_0xf275('0x114')]()||'',_0x70912[_0xf275('0x115')]>0x0?_0x1f16eb[_0xf275('0xe6')]['substring'](_0x70912[_0xf275('0x115')]):_0x1f16eb[_0xf275('0xe6')]);var _0xebe072=_0xeb6174[_0xf275('0xf8')](_0x70912[_0xf275('0x72')])?ut[_0xf275('0x116')](_0x70912['Trunk'][_0xf275('0x117')],_0x70912[_0xf275('0x118')],_0x70912[_0xf275('0x119')]>0x0?ut[_0xf275('0x11a')](_0x70912[_0xf275('0x11b')],_0x70912[_0xf275('0x119')]):_0x70912['dialOriginateCallerIdNumber']):ut[_0xf275('0x116')](_['isNil'](_0x70912['TrunkBackup'])?_0x70912[_0xf275('0x72')][_0xf275('0x117')]:_0x70912[_0xf275('0x73')][_0xf275('0x117')],_0x70912[_0xf275('0x118')],_0x70912['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xf275('0x11a')](_0x70912[_0xf275('0x11b')],_0x70912[_0xf275('0x119')]):_0x70912[_0xf275('0x11b')]);if(_0xebe072){_0x399bd8[_0xf275('0x11c')]=ut[_0xf275('0x11d')](_0xebe072);_0x399bd8[_0xf275('0x11e')]=ut[_0xf275('0x11f')](_0xebe072);}var _0x2ba5ec=ut[_0xf275('0x120')](_0x70912,_0x1f16eb,_0x4ed301,_0xebe072,_0x26e2c3,_0x399bd8);var _0x25ff6e=utils[_0xf275('0x121')](_0x1f16eb['Contact']);Object[_0xf275('0x122')](_0x2ba5ec,_0x25ff6e);_[_0xf275('0x123')](_0x399bd8,ut['toLowerVariables'](_0x2ba5ec));_0x399bd8[_0xf275('0x65')]=moment()[_0xf275('0x2d')](_0xf275('0x66'));_0x70912[_0xf275('0x124')]=_0x2ba5ec;var _0x392a2a=ut['variablesAction'](_0x399bd8,_0x70912,_0x2ba5ec,_0x399bd8['activeContact'],_0x3af53b);return ami[_0xf275('0x4e')](_0x392a2a)[_0xf275('0x5c')](function(_0x1432cf){_0x70912[_0xf275('0xcf')]+=0x1;logger[_0xf275('0x2a')](_0xf275('0x125'),_0x26e2c3,_0xf275('0x92'),_0x70912[_0xf275('0x2f')],_0xf275('0x126'),_0x70912[_0xf275('0xcf')]);_0x57c2d1(_0x1432cf);})[_0xf275('0x61')](function(_0x27be1d){ut[_0xf275('0xd6')](_0x399bd8,0xe,'OriginateError');rpcDb[_0xf275('0xd7')](_0x399bd8,_0xf275('0x127'));_0x180d0f(_0x27be1d);});});};Preview[_0xf275('0x12')][_0xf275('0x128')]=function(_0x324cb1){if(this[_0xf275('0x1a')][_0x324cb1[_0xf275('0x8a')]]){this[_0xf275('0x1a')][_0x324cb1[_0xf275('0x8a')]][_0xf275('0x129')]=_0x324cb1['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x5b1cf8){var _0x27d361=this;var _0x4e7545=this[_0xf275('0x1a')][_0x5b1cf8[_0xf275('0x12a')]];if(_0x4e7545){if(_0x4e7545[_0xf275('0xe9')]&&this[_0xf275('0x1b')][_0x4e7545[_0xf275('0xe9')]]){ut['logLookAgent'](_0x4e7545,this[_0xf275('0x1b')][_0x4e7545[_0xf275('0xe9')]][_0xf275('0x2f')],this[_0xf275('0x1b')][_0x4e7545['lookAgent']]['id']);}var _0x9a746=_[_0xf275('0x12b')](_0x4e7545);_0x9a746['responsetime']=moment()[_0xf275('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x451a93=_0x27d361[_0xf275('0x17')][_0x4e7545[_0xf275('0x47')]];if(ut[_0xf275('0x12c')](_0x5b1cf8[_0xf275('0x12d')])){if(_0x4e7545[_0xf275('0x88')]){rpcDb[_0xf275('0xff')](_0x4e7545[_0xf275('0x8c')]);}if(_0x4e7545[_0xf275('0x89')]){rpcDb['disableContact'](_0x4e7545['idContact']);}ami['emit'](_0xf275('0x12e'),ut[_0xf275('0x7d')](_0x4e7545,_0xf275('0x12f'),this['campaignsPreview'][_0x4e7545[_0xf275('0x47')]]));this['callProgressDetectingAgent'](_0x9a746,_0x451a93,_0x5b1cf8);}else{_0x4e7545[_0xf275('0x65')]=moment()[_0xf275('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x9a746,0x4,'Answer');rpcDb[_0xf275('0xd7')](_0x9a746,_0xf275('0x130'));}}};Preview[_0xf275('0x12')][_0xf275('0x1e')]=function(_0x5bfaf8){var _0x299f9c=this[_0xf275('0x1a')][_0x5bfaf8[_0xf275('0x8a')]];var _0x27f94d;if(_0x299f9c){_0x27f94d=this[_0xf275('0x17')][_0x299f9c[_0xf275('0x47')]];logger[_0xf275('0x2a')](_0xf275('0x131'),_0x5bfaf8[_0xf275('0x8a')],_0xf275('0x92'),_0x27f94d[_0xf275('0x2f')],_0xf275('0x48'),_0x27f94d[_0xf275('0x33')]);}if(this['actions'][_0x5bfaf8[_0xf275('0x8a')]]&&_0x5bfaf8[_0xf275('0x8a')]!==_0x5bfaf8[_0xf275('0x91')]){if(_0x5bfaf8[_0xf275('0x132')]==='16'&&this[_0xf275('0x1a')][_0x5bfaf8['linkedid']][_0xf275('0x49')]){this[_0xf275('0x76')](_0x5bfaf8,_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8['cause']);}else if(this[_0xf275('0x1a')][_0x5bfaf8[_0xf275('0x8a')]][_0xf275('0x49')]){logger[_0xf275('0x2a')](_0xf275('0x133'),_0x5bfaf8['linkedid'],_0x5bfaf8[_0xf275('0x132')],_0xf275('0x92'),_0x27f94d[_0xf275('0x2f')],'pTalking:\x20',_0x27f94d[_0xf275('0x33')]);this[_0xf275('0x76')](_0x5bfaf8,_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8[_0xf275('0x132')]);}}else if(_0x299f9c&&_[_0xf275('0x45')](_0x299f9c['statedesc'])&&_0x27f94d[_0xf275('0x134')]&&_0x5bfaf8[_0xf275('0x8a')]===_0x5bfaf8[_0xf275('0x91')]&&_['isNil'](_0x5bfaf8[_0xf275('0xdc')])&&_0x5bfaf8['cause']==='16'&&_0x5bfaf8[_0xf275('0x135')]==='6'&&_[_0xf275('0xd3')](_0x299f9c[_0xf275('0x136')])){if(_0x299f9c[_0xf275('0x88')]){rpcDb[_0xf275('0xff')](_0x299f9c[_0xf275('0x8c')]);}if(_0x299f9c['activeContact']){rpcDb[_0xf275('0x64')](_0x299f9c[_0xf275('0x8c')]);}_0x5bfaf8[_0xf275('0xdc')]='22';this['callProgressDetectingAgent'](_0x299f9c,_0x27f94d,_0x5bfaf8);}else if(_0x299f9c&&_0x299f9c[_0xf275('0x136')]){if(_0x5bfaf8[_0xf275('0x132')]==='16'&&this[_0xf275('0x1a')][_0x5bfaf8['linkedid']][_0xf275('0x49')]){logger['info'](_0xf275('0x137'),_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8['cause'],_0xf275('0x92'),_0x27f94d['name'],'pTalking:\x20',_0x27f94d[_0xf275('0x33')]);this[_0xf275('0x76')](_0x5bfaf8,_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8[_0xf275('0x132')]);}else if(this[_0xf275('0x1a')][_0x5bfaf8[_0xf275('0x8a')]][_0xf275('0x49')]){logger[_0xf275('0x2a')]('[syncHangup][talking][cause]',_0x5bfaf8[_0xf275('0x8a')],_0x5bfaf8[_0xf275('0x132')],_0xf275('0x92'),_0x27f94d['name'],_0xf275('0x48'),_0x27f94d[_0xf275('0x33')]);this[_0xf275('0x76')](_0x5bfaf8,_0x5bfaf8['linkedid'],_0x5bfaf8[_0xf275('0x132')]);}}};Preview[_0xf275('0x12')][_0xf275('0x20')]=function(_0x3d5e2c){if(this[_0xf275('0x1a')][_0x3d5e2c[_0xf275('0xd1')]]&&_0x3d5e2c['destlinkedid']!==_0x3d5e2c[_0xf275('0x138')]){this[_0xf275('0x76')](_0x3d5e2c,_0x3d5e2c[_0xf275('0xd1')],_0x3d5e2c[_0xf275('0xc6')]);}};Preview['prototype'][_0xf275('0x139')]=function(_0x1923e1){if(this['actions'][_0x1923e1['linkedid']]&&_0x1923e1[_0xf275('0x8a')]!==_0x1923e1['uniqueid']&&!this[_0xf275('0x1a')][_0x1923e1[_0xf275('0x8a')]][_0xf275('0x49')]){if(_0x1923e1[_0xf275('0x132')]==='1'){this[_0xf275('0x76')](_0x1923e1,_0x1923e1['linkedid'],_0x1923e1[_0xf275('0x132')]);}}};Preview[_0xf275('0x12')][_0xf275('0x13a')]=function(_0x1a4ef5,_0x56d031,_0x344a4f){if(this[_0xf275('0x1a')][_0x1a4ef5]){if(_['isNil'](this['actions'][_0x1a4ef5][_0xf275('0x124')])){this[_0xf275('0x1a')][_0x1a4ef5]['variables']={};}this[_0xf275('0x1a')][_0x1a4ef5]['variables'][_0x56d031]=_0x344a4f;}};Preview[_0xf275('0x12')]['syncVarSet']=function(_0x53f45e){try{if(!_[_0xf275('0x45')](_0x53f45e)){if(ut[_0xf275('0x13b')](_['keys'](_0x53f45e['variable'])[0x0])){this[_0xf275('0x13a')](_0x53f45e['uniqueid'],_[_0xf275('0x13c')](_0x53f45e[_0xf275('0x13d')])[0x0],_0x53f45e[_0xf275('0x13e')]);}}}catch(_0x2e5d9c){logger[_0xf275('0x13f')]('[syncVarSet][Preview]',util[_0xf275('0x140')](_0x2e5d9c,{'showHidden':![],'depth':null}));}};Preview[_0xf275('0x12')][_0xf275('0x141')]=function(_0x11036a){if(_0x11036a){if(this[_0xf275('0x1a')][_0x11036a[_0xf275('0x142')]]){this[_0xf275('0x1a')][_0x11036a[_0xf275('0x142')]]['transfer']=!![];}}};Preview[_0xf275('0x12')]['syncBlindTransfer']=function(_0x5656ae){if(_0x5656ae){if(this['actions'][_0x5656ae['transfererlinkedid']]){this[_0xf275('0x1a')][_0x5656ae[_0xf275('0x143')]][_0xf275('0x136')]=!![];}}};module[_0xf275('0x144')]=Preview; \ No newline at end of file +var _0x9bda=['AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact\x20is\x20undefined','Queue','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','unmonitored','execRun','unlock','getContactPreview','recallme','isValid','phone','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','callerid','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','syncNewExten','syncOriginateResponse','lookAgent','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','unlockContact','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','syncHangupRequest','filterKey','variable','addVariable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','campaignsPreview','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','emit','sendMessageOneNotActive','originated','available','paused','INACTIVE','logger','message','CAMPAIGN_STATUS','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','stringify','pTalking:\x20','pTalking','pick','contactId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','isNil','length','getDiff','scheduledat','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','idContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','dialAnswer','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','incrementPreviewCounters','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','verifyAdditionalPhones','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]'];(function(_0x16e881,_0x8e7243){var _0x48f1fc=function(_0x43ddf3){while(--_0x43ddf3){_0x16e881['push'](_0x16e881['shift']());}};_0x48f1fc(++_0x8e7243);}(_0x9bda,0x19e));var _0xa9bd=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0x9bda[_0x2d8f6c];return _0x3a00f6;};'use strict';var util=require(_0xa9bd('0x0'));var _=require(_0xa9bd('0x1'));var uuid=require(_0xa9bd('0x2'));var moment=require(_0xa9bd('0x3'));var Redis=require(_0xa9bd('0x4'));var config=require(_0xa9bd('0x5'));var logger=require(_0xa9bd('0x6'))('preview');var loggerAction=require(_0xa9bd('0x6'))(_0xa9bd('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xa9bd('0x8'));var Action=require('./action');var ut=require(_0xa9bd('0x9'));var utils=require(_0xa9bd('0xa'));config[_0xa9bd('0xb')]=_[_0xa9bd('0xc')](config[_0xa9bd('0xb')],{'host':_0xa9bd('0xd'),'port':0x18eb});var io=require(_0xa9bd('0xe'))(new Redis(config[_0xa9bd('0xb')]));var Sequence=function(){};Sequence[_0xa9bd('0xf')][_0xa9bd('0x10')]=function(_0x11bb82){this[_0xa9bd('0x11')]=this[_0xa9bd('0x11')]?this[_0xa9bd('0x11')][_0xa9bd('0x12')](_0x11bb82):_0x11bb82();};function Preview(_0xafddf5){this[_0xa9bd('0x13')]=new Sequence();this['campaignsPreview']=_0xafddf5[_0xa9bd('0x14')];this[_0xa9bd('0x15')]=_0xafddf5[_0xa9bd('0x15')];this[_0xa9bd('0x16')]={};this[_0xa9bd('0x17')]=_0xafddf5[_0xa9bd('0x17')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x19'),this[_0xa9bd('0x1a')][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x1b'),this['syncHangupRequest'][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x1c'),this[_0xa9bd('0x1d')]['bind'](this));ami['on'](_0xa9bd('0x1e'),this['syncNewExten'][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x1f'),this[_0xa9bd('0x20')][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x21'),this[_0xa9bd('0x22')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xa9bd('0x18')](this));this[_0xa9bd('0x23')](this[_0xa9bd('0x24')]);}function emit(_0x19cbed,_0x1bd7e8,_0x27b8bb){io['to'](_0x19cbed)['emit'](_0x1bd7e8,_0x27b8bb);}function emitVoiceQueueChannelRemove(_0x26f6bb){logger[_0xa9bd('0x25')](_0xa9bd('0x26'),JSON['stringify'](_0x26f6bb));emit(util[_0xa9bd('0x27')](_0xa9bd('0x28'),_0x26f6bb[_0xa9bd('0x29')]),_0xa9bd('0x2a'),_0x26f6bb);io[_0xa9bd('0x2b')]('voice_queue_presence:remove',_0x26f6bb);}function notSendMessagesQueue(_0x6fb9c){if(_0x6fb9c[_0xa9bd('0x2c')]){if(_0x6fb9c[_0xa9bd('0x2d')]===0x0&&_0x6fb9c['pTalking']===0x0){_0x6fb9c['sendMessageOneNotActive']=![];_0x6fb9c[_0xa9bd('0x2e')]=0x0;_0x6fb9c[_0xa9bd('0x2f')]=0x0;_0x6fb9c['message']=utils['CAMPAIGN_STATUS'][_0xa9bd('0x30')];ut[_0xa9bd('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x6fb9c[_0xa9bd('0x29')]+'\x20is\x20not\x20active');}else{_0x6fb9c[_0xa9bd('0x32')]=utils[_0xa9bd('0x33')][_0xa9bd('0x34')];ut[_0xa9bd('0x31')](_0xa9bd('0x35'),_0x6fb9c[_0xa9bd('0x29')]+_0xa9bd('0x36'));}}}Preview['prototype']['loopCampaigns']=function(){var _0x21face=this;setInterval(function(){_0x21face[_0xa9bd('0x37')]();},0x7cf);};Preview[_0xa9bd('0xf')][_0xa9bd('0x37')]=function(){var _0x30b9f8=this['campaignsPreview'];this[_0xa9bd('0x38')]+=0x1;for(var _0x68c821 in _0x30b9f8){if(_0x30b9f8['hasOwnProperty'](_0x68c821)&&(_0x30b9f8[_0x68c821][_0xa9bd('0x39')]===_0xa9bd('0x3a')||_0x30b9f8[_0x68c821][_0xa9bd('0x39')]===_0xa9bd('0x3b'))&&_0x30b9f8[_0x68c821][_0xa9bd('0x3c')]===_0xa9bd('0x3d')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xa9bd('0x3e')]();}}if(_0x30b9f8['hasOwnProperty'](_0x68c821)&&_0x30b9f8[_0x68c821]['dialMethod']===_0xa9bd('0x3a')&&_0x30b9f8[_0x68c821][_0xa9bd('0x3c')]===_0xa9bd('0x3d')){if(_0x30b9f8[_0x68c821][_0xa9bd('0x3f')]){this[_0xa9bd('0x40')](_0x30b9f8[_0x68c821]);if(_0x30b9f8[_0x68c821][_0xa9bd('0x41')])this[_0xa9bd('0x42')](_0x30b9f8[_0x68c821]);}else{notSendMessagesQueue(_0x30b9f8[_0x68c821]);}}}};Preview[_0xa9bd('0xf')][_0xa9bd('0x43')]=function(_0x5c2b1f){var _0x189b79=this;this['sequence'][_0xa9bd('0x10')](function(){if(!_['isNil'](_0x189b79[_0xa9bd('0x16')][_0x5c2b1f])){loggerAction[_0xa9bd('0x25')](_0xa9bd('0x44'),_0x5c2b1f,'Queue',_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')],_0xa9bd('0x46'),JSON[_0xa9bd('0x47')](_0x189b79[_0xa9bd('0x24')][_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]][_0xa9bd('0x2d')]),_0xa9bd('0x48'),JSON[_0xa9bd('0x47')](_0x189b79[_0xa9bd('0x24')][_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]][_0xa9bd('0x49')]),JSON[_0xa9bd('0x47')](_0x189b79[_0xa9bd('0x16')][_0x5c2b1f]['dialAnswer']),JSON['stringify'](_[_0xa9bd('0x4a')](_0x189b79[_0xa9bd('0x16')][_0x5c2b1f],[_0xa9bd('0x4b'),'UserId',_0xa9bd('0x4c'),_0xa9bd('0x4d')])));return ami[_0xa9bd('0x4e')]({'action':'status','channel':_0x189b79['actions'][_0x5c2b1f][_0xa9bd('0x4f')]})[_0xa9bd('0x50')](function(_0x3b8f0e){if(_0x3b8f0e[_0xa9bd('0x32')]===_0xa9bd('0x51')){setTimeout(function(){if(_0x189b79['actions'][_0x5c2b1f]){ut[_0xa9bd('0x52')](_0x189b79['campaignsPreview'][_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]],_0xa9bd('0x53'));if(_0x189b79[_0xa9bd('0x16')][_0x5c2b1f]['dialAnswer']===!![]){ut[_0xa9bd('0x54')](_0x189b79[_0xa9bd('0x24')][_0x189b79['actions'][_0x5c2b1f][_0xa9bd('0x45')]],_0xa9bd('0x53'));ut[_0xa9bd('0x55')]('[Dialer][checkChannel][pTalking][Preview]'+_0x5c2b1f,_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]);}ut['loggerError'](_0xa9bd('0x56')+_0x5c2b1f,_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]);delete _0x189b79[_0xa9bd('0x16')][_0x5c2b1f];}},0x2328);}});}});};Preview[_0xa9bd('0xf')][_0xa9bd('0x3e')]=function(){var _0x3a0e27=this;loggerAction[_0xa9bd('0x25')]('[action]',_[_0xa9bd('0x57')](this[_0xa9bd('0x16')]));for(var _0x47905c in this['actions']){if(_0x3a0e27[_0xa9bd('0x16')]['hasOwnProperty'](_0x47905c)){_0x3a0e27[_0xa9bd('0x43')](_0x47905c);}}};Preview['prototype'][_0xa9bd('0x42')]=function(_0x38bada){var _0x20f9cc=this;rpcDb[_0xa9bd('0x58')](_0x38bada['id'],ut[_0xa9bd('0x59')](this[_0xa9bd('0x17')]))['then'](function(_0x92c43c){if(!_[_0xa9bd('0x5a')](_0x92c43c)){for(var _0x56d736=0x0;_0x56d736<_0x92c43c[_0xa9bd('0x5b')];_0x56d736+=0x1){if(ut[_0xa9bd('0x5c')](_0x92c43c[_0x56d736][_0xa9bd('0x5d')])<_0x38bada['dialRecallMeTimeout']*0x3c){if(_0x92c43c[_0x56d736][_0xa9bd('0x5e')]&&!_0x92c43c[_0x56d736][_0xa9bd('0x5e')]['voicePause']){_0x20f9cc[_0xa9bd('0x5f')](_0x92c43c[_0x56d736]['id'])[_0xa9bd('0x60')](ut[_0xa9bd('0x61')](_0xa9bd('0x62')))[_0xa9bd('0x50')](ut[_0xa9bd('0x61')](_0xa9bd('0x62')));}else{rpcDb[_0xa9bd('0x63')](_0x92c43c[_0x56d736]['id']);}}else{var _0x141070=new Action(_0x92c43c[_0x56d736],_0x38bada);_0x141070[_0xa9bd('0x64')]=moment()[_0xa9bd('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x38bada['outboundReCallsDay']+=0x1;ut[_0xa9bd('0x65')](_0x141070,0x17,_0xa9bd('0x66'));if(_0x38bada[_0xa9bd('0x67')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x92c43c[_0x56d736]));rpcDb[_0xa9bd('0x68')](_0x141070,_0xa9bd('0x69'));}else{ut['logCustomer'](_0x141070,0x16,'RecallFailedTimeout');rpcDb[_0xa9bd('0x68')](_0x141070,_0xa9bd('0x6a'));rpcDb[_0xa9bd('0x6b')](_0x141070,'[HistoryRecallClose]');}}}}})[_0xa9bd('0x50')](ut[_0xa9bd('0x61')](_0xa9bd('0x6c')));};Preview[_0xa9bd('0xf')][_0xa9bd('0x40')]=function(_0x3a2f34){_0x3a2f34[_0xa9bd('0x2c')]=!![];if(ut[_0xa9bd('0x6d')](_0x3a2f34[_0xa9bd('0x6e')])){_0x3a2f34['message']=utils[_0xa9bd('0x33')][_0xa9bd('0x6f')];}else if(!ut[_0xa9bd('0x70')](_0x3a2f34[_0xa9bd('0x3f')])){_0x3a2f34[_0xa9bd('0x32')]=utils[_0xa9bd('0x33')][_0xa9bd('0x30')];}else if(!this[_0xa9bd('0x71')](_0x3a2f34[_0xa9bd('0x72')])){if(!this[_0xa9bd('0x71')](_0x3a2f34[_0xa9bd('0x73')])){_0x3a2f34[_0xa9bd('0x32')]=utils[_0xa9bd('0x33')][_0xa9bd('0x74')];}else{_0x3a2f34[_0xa9bd('0x32')]=utils[_0xa9bd('0x33')][_0xa9bd('0x75')];}}else{_0x3a2f34[_0xa9bd('0x32')]=utils['CAMPAIGN_STATUS'][_0xa9bd('0x75')];}};Preview['prototype'][_0xa9bd('0x76')]=function(_0x118256,_0x476967,_0xd4ec6d){var _0x56d7e9=this;var _0x4e0800=this[_0xa9bd('0x16')][_0x476967];var _0x4b0e07=this[_0xa9bd('0x24')][_0x4e0800[_0xa9bd('0x45')]];var _0x54d23b;var _0x482a17=![];var _0x3f9c9c=0x2;var _0x207a11=0x3;if(_0x4b0e07){switch(_0xd4ec6d){case'1':_0x4b0e07[_0xa9bd('0x77')]+=0x1;_0x4e0800[_0xa9bd('0x78')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut[_0xa9bd('0x65')](_0x4e0800,0x0,_0xa9bd('0x7b'));ami[_0xa9bd('0x2b')](_0xa9bd('0x7c'),ut['buildObj'](_0x4e0800,_0xa9bd('0x7d')));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0x7e'));_0x56d7e9['verifyAdditionalPhones'](_0x4e0800,'0',_0x4b0e07)['then'](function(_0x4ef512){_0x482a17=_0x4ef512[_0xa9bd('0x7f')]==0x1;_0x3f9c9c=_0x4b0e07[_0xa9bd('0x80')];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut['cloneAction'](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0x84'));}else{if(_0x4e0800[_0xa9bd('0x78')]>=_0x4b0e07[_0xa9bd('0x85')]){rpcDb['createCustomerFinal'](_0x4e0800,_0xa9bd('0x84'));}else{rpcDb['rescheduleContact'](ut[_0xa9bd('0x86')](_0x4e0800,_0xa9bd('0x78'),_0x4b0e07['dialNoSuchNumberRetryFrequency']),_0x4e0800[_0xa9bd('0x87')],_0x4e0800[_0xa9bd('0x88')]);}}delete this[_0xa9bd('0x16')][_0x118256[_0xa9bd('0x89')]];}else{_0x4e0800[_0xa9bd('0x78')]++;logger[_0xa9bd('0x25')]('actioncountonusuch',_0x4e0800[_0xa9bd('0x78')]);logger[_0xa9bd('0x25')]('id',_0x4e0800['idContact']);_0x56d7e9['incrementPreviewCounters']({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countnosuchnumberretry':_0x4e0800['countnosuchnumberretry']}})[_0xa9bd('0x60')](function(){_0x56d7e9['swapAdditionalPhones'](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case _0xa9bd('0x8b'):var _0x29028f=moment()[_0xa9bd('0x27')](_0xa9bd('0x8c'));_0x4e0800[_0xa9bd('0x8d')]=_0x29028f;_0x4e0800[_0xa9bd('0x8e')]=_0x29028f;_0x4e0800[_0xa9bd('0x8f')]=!![];_0x4b0e07['pTalking']+=0x1;logger[_0xa9bd('0x25')]('[syncHangup][talking][increment]',_0x4e0800[_0xa9bd('0x90')],_0xa9bd('0x91'),_0x4b0e07[_0xa9bd('0x29')],_0xa9bd('0x48'),_0x4b0e07['pTalking']);ami[_0xa9bd('0x2b')](_0xa9bd('0x92'),ut['buildObj'](_0x4e0800,'connect',this[_0xa9bd('0x24')][_0x4e0800[_0xa9bd('0x45')]]));if(_0x4b0e07[_0xa9bd('0x93')]){ami[_0xa9bd('0x2b')](_0xa9bd('0x94'),ut[_0xa9bd('0x95')](_0x4e0800));}break;case'16':ami['emit'](_0xa9bd('0x96'),ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0x98'),this[_0xa9bd('0x24')][_0x4e0800[_0xa9bd('0x45')]]));emitVoiceQueueChannelRemove(ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0x98')));_0x4b0e07[_0xa9bd('0x99')]+=0x1;_0x4b0e07['total']+=0x1;_0x4b0e07['answered']+=0x1;ut['decrementTalkink'](_0x4b0e07,_0xa9bd('0x9a'));_0x4e0800[_0xa9bd('0x79')]=ut['totalGlobal'](_0x4e0800);ut['logCustomer'](_0x4e0800,0x4,_0xa9bd('0x9b'));rpcDb[_0xa9bd('0x68')](_0x4e0800,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0x9c'));rpcDb[_0xa9bd('0x9d')](_0x4e0800);_0x4b0e07['sumDuration']+=_0x4e0800[_0xa9bd('0x9e')];_0x4b0e07[_0xa9bd('0x9f')]+=_0x4e0800[_0xa9bd('0x9e')];logger['info'](_0xa9bd('0xa0'),_0x4e0800[_0xa9bd('0x90')],'\x20Queue',_0x4b0e07[_0xa9bd('0x29')],_0xa9bd('0x48'),_0x4b0e07['pTalking']);delete this['actions'][_0x118256[_0xa9bd('0x89')]];break;case _0xa9bd('0xa1'):_0x4b0e07[_0xa9bd('0xa2')]+=0x1;_0x4e0800[_0xa9bd('0xa3')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut['logCustomer'](_0x4e0800,0x5,_0xa9bd('0xa4'));_0x3f9c9c=_0x4b0e07['dialBusyRetryFrequency'];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];ami['emit'](_0xa9bd('0xa5'),ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0xa6')));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xa7'));_0x56d7e9['verifyAdditionalPhones'](_0x4e0800,'5',_0x4b0e07)[_0xa9bd('0x60')](function(_0x1449f6){_0x482a17=_0x1449f6['additional']==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07['dialGlobalMaxRetry']){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb['createCustomerFinal'](_0x54d23b,_0xa9bd('0xa9'));}else{if(_0x4e0800[_0xa9bd('0xa3')]>=_0x4b0e07[_0xa9bd('0xaa')]){rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xa7'));}else{rpcDb[_0xa9bd('0xab')](ut['scheduledAt'](_0x4e0800,'countbusyretry',_0x4b0e07['dialBusyRetryFrequency']),_0x4e0800[_0xa9bd('0x87')],_0x4e0800[_0xa9bd('0x88')]);}}}else{_0x4e0800[_0xa9bd('0xa3')]++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countbusyretry':_0x4e0800[_0xa9bd('0xa3')]}})[_0xa9bd('0x60')](function(){_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case _0xa9bd('0xae'):_0x4b0e07[_0xa9bd('0xaf')]+=0x1;_0x4e0800[_0xa9bd('0xb0')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut['logCustomer'](_0x4e0800,0x3,_0xa9bd('0xb1'));_0x3f9c9c=_0x4b0e07['dialNoAnswerRetryFrequency'];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];var _0x172e0d=ut[_0xa9bd('0xb2')](_0x4e0800,_0x4b0e07);ami['emit']('custom:agentnoanswer',_0x172e0d);rpcDb['createCustomerHistory'](_0x4e0800,_0xa9bd('0xb3'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'3',_0x4b0e07)[_0xa9bd('0x60')](function(_0x2eee1a){_0x482a17=_0x2eee1a[_0xa9bd('0x7f')]==0x1;if(!_0x482a17){if(ut['totalGlobal'](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut['cloneAction'](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4e0800['countnoanswerretry']>=_0x4b0e07[_0xa9bd('0xb5')]){rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xb3'));}else{rpcDb[_0xa9bd('0xab')](ut[_0xa9bd('0x86')](_0x4e0800,'countnoanswerretry',_0x4b0e07['dialNoAnswerRetryFrequency']),_0x4e0800[_0xa9bd('0x87')],_0x4e0800['activeContact']);}}}else{_0x4e0800[_0xa9bd('0xb0')]++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800['idContact'],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})[_0xa9bd('0x60')](function(){_0x56d7e9['swapAdditionalPhones'](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case _0xa9bd('0xb6'):_0x4b0e07[_0xa9bd('0xb7')]+=0x1;_0x4e0800[_0xa9bd('0xb8')]+=0x1;_0x4e0800['countglobal']=ut['totalGlobal'](_0x4e0800);ut['logCustomer'](_0x4e0800,0x8,_0xa9bd('0xb9'));_0x3f9c9c=_0x4b0e07[_0xa9bd('0xba')];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];ami[_0xa9bd('0x2b')](_0xa9bd('0xbb'),ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0xbc')));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xbd'));_0x56d7e9['verifyAdditionalPhones'](_0x4e0800,'8',_0x4b0e07)[_0xa9bd('0x60')](function(_0x22bcc5){_0x482a17=_0x22bcc5['additional']==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut['cloneAction'](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xbe'));}else{if(_0x4e0800[_0xa9bd('0xb8')]>=_0x4b0e07[_0xa9bd('0xbf')]){rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xbd'));}else{rpcDb[_0xa9bd('0xab')](ut[_0xa9bd('0x86')](_0x4e0800,_0xa9bd('0xb8'),_0x4b0e07['dialBusyRetryFrequency']),_0x4e0800[_0xa9bd('0x87')],_0x4e0800[_0xa9bd('0x88')]);}}}else{_0x4e0800['countcongestionretry']++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countcongestionretry':_0x4e0800[_0xa9bd('0xb8')]}})['then'](function(){_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case _0xa9bd('0xc0'):_0x4b0e07[_0xa9bd('0xc1')]+=0x1;_0x4e0800[_0xa9bd('0xc2')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut['logCustomer'](_0x4e0800,0x14,'AgentReject');_0x3f9c9c=_0x4b0e07['dialAgentRejectRetryFrequency'];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];ami['emit'](_0xa9bd('0xc3'),ut[_0xa9bd('0x97')](_0x4e0800,'agentreject'));rpcDb[_0xa9bd('0x68')](_0x4e0800,'[syncHangupRequest][logAgentReject]');_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'20',_0x4b0e07)['then'](function(_0x4b3d18){_0x482a17=_0x4b3d18[_0xa9bd('0x7f')]==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0x14,'AgentReject');rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xc4'));}else{if(_0x4e0800['countagentrejectretry']>=_0x4b0e07['dialAgentRejectMaxRetry']){rpcDb[_0xa9bd('0x6b')](_0x4e0800,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xa9bd('0xab')](ut[_0xa9bd('0x86')](_0x4e0800,_0xa9bd('0xc2'),_0x4b0e07[_0xa9bd('0xc5')]),_0x4e0800[_0xa9bd('0x87')],_0x4e0800[_0xa9bd('0x88')]);}}}else{_0x4e0800[_0xa9bd('0xb0')]++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})[_0xa9bd('0x60')](function(){_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case'ABANDONED':_0x4b0e07['outboundAbandonedCallsDay']+=0x1;_0x4e0800[_0xa9bd('0xc6')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut[_0xa9bd('0x65')](_0x4e0800,0xb,_0xa9bd('0xc7'));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xc8'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'11',_0x4b0e07)[_0xa9bd('0x60')](function(_0x35447d){_0x482a17=_0x35447d['additional']==0x1;if(!_0x482a17){if(ut['totalGlobal'](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut['cloneAction'](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xc8'));}else{if(_0x4e0800[_0xa9bd('0xc9')]>=_0x4b0e07[_0xa9bd('0xca')]){rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xc8'));}else{rpcDb['rescheduleContact'](ut[_0xa9bd('0x86')](_0x4e0800,_0xa9bd('0xc6'),_0x4b0e07['dialAbandonedRetryFrequency']),_0x4e0800['unlockAgent'],_0x4e0800[_0xa9bd('0x88')]);}}}else{_0x4e0800[_0xa9bd('0xb0')]++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})['then'](function(){_0x56d7e9['swapAdditionalPhones'](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case'18':_0x4b0e07[_0xa9bd('0xcb')]+=0x1;_0x4e0800[_0xa9bd('0xcc')]+=0x1;_0x4e0800['countglobal']=ut[_0xa9bd('0x7a')](_0x4e0800);ut[_0xa9bd('0x65')](_0x4e0800,0x12,_0x118256['cause-txt']||_0x118256[_0xa9bd('0xcd')]);ami[_0xa9bd('0x2b')](_0xa9bd('0xce'),ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0xcf')));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xd0'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'18',_0x4b0e07)[_0xa9bd('0x60')](function(_0x2fe5bb){_0x482a17=_0x2fe5bb[_0xa9bd('0x7f')]==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0x12,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xd0'));}else{rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xd0'));}}else{_0x4e0800['countnoanswerretry']++;_0x56d7e9['incrementPreviewCounters']({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})[_0xa9bd('0x60')](function(){_0x56d7e9['swapAdditionalPhones'](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});delete this[_0xa9bd('0x16')][_0x118256['linkedid']];break;case'19':_0x4b0e07[_0xa9bd('0xcb')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut['logCustomer'](_0x4e0800,0x13,_0x118256[_0xa9bd('0xd1')]||_0x118256[_0xa9bd('0xcd')]);ami[_0xa9bd('0x2b')]('custom:amd',ut[_0xa9bd('0x97')](_0x4e0800,'amd'));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xd2'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'18',_0x4b0e07)[_0xa9bd('0x60')](function(_0x27f75d){_0x482a17=_0x27f75d['additional']==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb['createCustomerFinal'](_0x54d23b,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xd2'));}}else{_0x4e0800[_0xa9bd('0xb0')]++;_0x56d7e9['incrementPreviewCounters']({'id':_0x4e0800['idContact'],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})[_0xa9bd('0x60')](function(){_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});delete this['actions'][_0x118256[_0xa9bd('0x89')]];break;default:if(_0x4e0800['dialAnswer']){ut[_0xa9bd('0x54')](_0x4b0e07,'[default]');ut[_0xa9bd('0x55')](_0xa9bd('0xd3')+_0x4b0e07[_0xa9bd('0x29')],_0x118256);}_0x4b0e07[_0xa9bd('0xcb')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut['totalGlobal'](_0x4e0800);ut[_0xa9bd('0x65')](_0x4e0800,0xc,_0x118256[_0xa9bd('0xd1')]||_0x118256['dialstatus']);_0x3f9c9c=_0x4b0e07[_0xa9bd('0xc5')];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xd4'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'20',_0x4b0e07)['then'](function(_0x58f22a){_0x482a17=_0x58f22a[_0xa9bd('0x7f')]==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xd5'));}else{rpcDb[_0xa9bd('0x6b')](_0x4e0800,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x118256[_0xa9bd('0x89')]];}else{_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});}});}if(!(_0x4e0800[_0xa9bd('0x8f')]&&_0xd4ec6d==='16')){ut[_0xa9bd('0x52')](_0x4b0e07,_0xa9bd('0xd6'));logger[_0xa9bd('0x25')](_0xa9bd('0xd7'),_0x4e0800['uniqueid'],_0xa9bd('0x91'),_0x4b0e07[_0xa9bd('0x29')],_0xa9bd('0x46'),_0x4b0e07['originated']);}if(_0xd4ec6d!==_0xa9bd('0x8b')){delete this[_0xa9bd('0x16')][_0x118256[_0xa9bd('0x89')]];delete this[_0xa9bd('0x16')][_0x118256['destlinkedid']];}_0x4b0e07[_0xa9bd('0xd8')]=!![];}};Preview['prototype'][_0xa9bd('0xd9')]=function(_0xc03c85,_0x1e2652,_0x2a1613){if(_[_0xa9bd('0xda')](_0x1e2652)&&_0xa9bd('0xdb')!==typeof _0x1e2652){return;}if(_['isUndefined'](_0x2a1613)&&_0xa9bd('0xdb')!==typeof _0x2a1613){return;}switch(_0x2a1613[_0xa9bd('0xdc')]){case'0':ut[_0xa9bd('0xdd')](_0xc03c85,0x0,_0xa9bd('0x7b'));rpcDb['createAgentHistory'](_0xc03c85,_0xa9bd('0xde'));break;case'3':ut['logAgent'](_0xc03c85,0x3,'NoAnswer');rpcDb[_0xa9bd('0xdf')](_0xc03c85,_0xa9bd('0xe0'));break;case'5':ut[_0xa9bd('0xdd')](_0xc03c85,0x5,_0xa9bd('0xa4'));rpcDb[_0xa9bd('0xdf')](_0xc03c85,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0xc03c85,0x8,_0xa9bd('0xb9'));rpcDb[_0xa9bd('0xdf')](_0xc03c85,_0xa9bd('0xe1'));break;case'22':ut[_0xa9bd('0xdd')](_0xc03c85,0x16,_0xa9bd('0xe2'));rpcDb['createAgentHistory'](_0xc03c85,_0xa9bd('0xe3'));break;default:ut['logAgent'](_0xc03c85,0xc,_0x2a1613['reason']);rpcDb[_0xa9bd('0xdf')](_0xc03c85,_0xa9bd('0xe1'));}ut[_0xa9bd('0x52')](_0x1e2652,_0xa9bd('0xe4'));logger[_0xa9bd('0x25')]('[originated][decrement][callProgressDetectingAgent]',_0xc03c85['uniqueid'],_0xa9bd('0x91'),_0x1e2652[_0xa9bd('0x29')],_0xa9bd('0x46'),_0x1e2652[_0xa9bd('0x2d')]);delete this['actions'][_0xc03c85['uniqueid']];};Preview[_0xa9bd('0xf')][_0xa9bd('0xb4')]=function(_0x57724f,_0x5b1914,_0x729499){return cmHopperAdditionalPhone[_0xa9bd('0xb4')](_0x57724f,_0x5b1914,_0x729499)[_0xa9bd('0x50')](logger[_0xa9bd('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0xa9bd('0xf')]['swapAdditionalPhones']=function(_0x48b103,_0x2f8bb0,_0xcea7f7){return cmHopperAdditionalPhone[_0xa9bd('0xad')](_0x48b103,_0x2f8bb0,_0xcea7f7)['catch'](logger['info'](_0xa9bd('0xe5')));};Preview[_0xa9bd('0xf')]['incrementPreviewCounters']=function(_0x5ee139){return Promise[_0xa9bd('0xe6')]()['then'](cmHopperAdditionalPhone[_0xa9bd('0xac')](_0x5ee139))['catch'](logger[_0xa9bd('0x25')](_0xa9bd('0xe7')));};Preview[_0xa9bd('0xf')][_0xa9bd('0xe8')]=function(_0x1a789d,_0x423796,_0x22ccb0,_0x4bf128,_0x3ea8a2){var _0x189643=this;return new Promise(function(_0x4351b5,_0x1c295d){if(_['isNil'](_0x423796)||_['isNil'](_0x423796['Contact'])||_['isNil'](_0x423796['phone'])||_[_0xa9bd('0x5a')](_0x423796[_0xa9bd('0x4c')])){_0x1c295d(ut['message'](_0xa9bd('0xe9'),_0x4bf128,_0x3ea8a2));return;}var _0x40a9dc=uuid['v4']();var _0x55478a=_0x189643[_0xa9bd('0x24')][_0x423796[_0xa9bd('0xea')][_0xa9bd('0x29')]];var _0x13ec55=_0x22ccb0?_0x189643[_0xa9bd('0x17')][_0x22ccb0]['id']:undefined;_0x189643['actions'][_0x40a9dc]=new Action(_0x423796,_0x55478a,_0x40a9dc,_0x22ccb0,_0x13ec55);var _0x262337=_0x189643[_0xa9bd('0x16')][_0x40a9dc];_0x262337['unlockAgent']=_0x4bf128;_0x262337[_0xa9bd('0x88')]=_0x3ea8a2;_0x262337['lookAgent']=_0x22ccb0;if(_['isEmpty'](_0x1a789d)){_0x189643[_0xa9bd('0xeb')](_0x262337,_0x55478a,_0x423796,_0x22ccb0)[_0xa9bd('0x60')](function(_0xedc181){logger[_0xa9bd('0x25')](_0xa9bd('0xec'),_0xa9bd('0xed')+_0x262337[_0xa9bd('0x45')]+'\x20IdHopper:\x20'+_0x262337[_0xa9bd('0x8a')],JSON[_0xa9bd('0x47')](_0xedc181));ami['emit'](_0xa9bd('0xee'),ut[_0xa9bd('0x97')](_0x262337,_0xa9bd('0xef'),_0x189643[_0xa9bd('0x24')][_0x262337[_0xa9bd('0x45')]]));_0x4351b5(ut[_0xa9bd('0x32')](_0xa9bd('0xf0')));})[_0xa9bd('0x50')](function(_0x596dce){ut[_0xa9bd('0x31')](_0xa9bd('0xf1'),_0x596dce);_0x1c295d(ut[_0xa9bd('0x32')](_0xa9bd('0xf2'),_0x4bf128,_0x3ea8a2));});}else{_0x55478a[_0xa9bd('0xf3')]+=0x1;ut['logBlacklist'](_0x262337);rpcDb[_0xa9bd('0xf4')](_0x262337,'[Blacklist][error]');delete _0x189643[_0xa9bd('0x16')][_0x40a9dc];_0x1c295d(ut[_0xa9bd('0x32')](_0xa9bd('0xf5'),_0x4bf128,_0x3ea8a2));}});};Preview[_0xa9bd('0xf')][_0xa9bd('0x71')]=function(_0x3712b6){return!_[_0xa9bd('0x5a')](_0x3712b6)&&!_['isNil'](_0x3712b6[_0xa9bd('0x29')])&&!_[_0xa9bd('0x5a')](_0x3712b6[_0xa9bd('0xf6')])&&_0x3712b6['active']&&!_[_0xa9bd('0x5a')](this[_0xa9bd('0x15')][util[_0xa9bd('0x27')](_0xa9bd('0xf7'),_0x3712b6['name'])])&&!_['isNil'](this[_0xa9bd('0x15')][util['format']('SIP/%s',_0x3712b6['name'])][_0xa9bd('0xf8')])&&(this[_0xa9bd('0x15')][util['format']('SIP/%s',_0x3712b6[_0xa9bd('0x29')])]['status']==='reachable'||this[_0xa9bd('0x15')][util[_0xa9bd('0x27')](_0xa9bd('0xf7'),_0x3712b6[_0xa9bd('0x29')])][_0xa9bd('0xf8')]===_0xa9bd('0xf9'));};Preview[_0xa9bd('0xf')][_0xa9bd('0x5f')]=function(_0x22dcda,_0x3c5e91){return this[_0xa9bd('0xfa')](_0x22dcda,_0x3c5e91)['then'](function(_0x2647f8){return _[_0xa9bd('0x4a')](_0x2647f8,[_0xa9bd('0x32')]);})[_0xa9bd('0x50')](function(_0x13c8a3){if(_0x13c8a3[_0xa9bd('0xfb')]){rpcDb['unlockContact'](_0x22dcda);}if(_0x13c8a3[_0xa9bd('0xf6')]){rpcDb[_0xa9bd('0x63')](_0x22dcda);}throw _['pick'](_0x13c8a3,['message']);});};Preview['prototype'][_0xa9bd('0xfa')]=function(_0x3ca013,_0xe25d1e){var _0x296d52=this;var _0xa5c3b6,_0x34ba0f;return rpcDb[_0xa9bd('0xfc')](_0x3ca013)[_0xa9bd('0x60')](function(_0xfa93b0){if(!_[_0xa9bd('0x5a')](_0xfa93b0[0x0])){_0x34ba0f=_0xfa93b0[0x0][_0xa9bd('0xfd')]?![]:!![];_0xa5c3b6=_0xfa93b0[0x0]['recallme']?!![]:![];_0xa5c3b6=_0xe25d1e?!![]:_0xa5c3b6;}var _0x326667=_0x296d52['validateContact'](_0xfa93b0);if(_0x326667[_0xa9bd('0xfe')]){rpcDb['checkIsBlackList'](_[_0xa9bd('0x4a')](_0xfa93b0[0x0],['VoiceQueueId',_0xa9bd('0xff')]))[_0xa9bd('0x60')](function(_0x146f8b){_0x296d52[_0xa9bd('0xe8')](_0x146f8b,_0xfa93b0[0x0],_0xe25d1e,_0x34ba0f,_0xa5c3b6)[_0xa9bd('0x60')](function(_0x1635e2){return _0x1635e2;})['catch'](function(_0x29c220){throw _0x29c220;});})[_0xa9bd('0x50')](function(_0x513252){ut[_0xa9bd('0x31')]('[Preview][checkIsBlackList]',_0x513252);throw ut[_0xa9bd('0x32')]('Call\x20unsuccessful',_0x34ba0f,_0xa5c3b6);});}else{throw ut[_0xa9bd('0x32')](_0x326667['message'],_0x34ba0f,_0xa5c3b6);}})['catch'](function(_0x23c83d){ut[_0xa9bd('0x31')](_0xa9bd('0x100'),_0x23c83d);throw ut[_0xa9bd('0x32')](_0xa9bd('0x101'),![],!![]);});};Preview[_0xa9bd('0xf')][_0xa9bd('0x102')]=function(_0x1e818c){if(_[_0xa9bd('0x5a')](_0x1e818c)||_['isEmpty'](_0x1e818c)||!_[_0xa9bd('0x5a')](_0x1e818c[0x0]['Agent'])&&_['isNil'](_0x1e818c[0x0][_0xa9bd('0x5e')][_0xa9bd('0x29')])){ut['logger'](_0xa9bd('0x103'),_0x1e818c);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2dd9b5=this['campaignsPreview'][_0x1e818c[0x0][_0xa9bd('0xea')]['name']];_0x2dd9b5[_0xa9bd('0x32')]=utils['CAMPAIGN_STATUS'][_0xa9bd('0x75')];if(_[_0xa9bd('0x5a')](_0x2dd9b5)){ut[_0xa9bd('0x31')](_0xa9bd('0x104'),_0x2dd9b5);return{'isValid':![],'message':_0xa9bd('0x105')};}if(!this[_0xa9bd('0x71')](_0x2dd9b5[_0xa9bd('0x72')])){ut[_0xa9bd('0x31')](_0xa9bd('0x106'),_0xa9bd('0x107')+_0x2dd9b5[_0xa9bd('0x29')]+_0xa9bd('0x108'));if(!this[_0xa9bd('0x71')](_0x2dd9b5['TrunkBackup'])){ut[_0xa9bd('0x31')](_0xa9bd('0x106'),_0x2dd9b5[_0xa9bd('0x29')]+_0xa9bd('0x109'));return{'isValid':![],'message':_0xa9bd('0x10a')};}}if(!ut[_0xa9bd('0x70')](_0x2dd9b5[_0xa9bd('0x3f')])){ut[_0xa9bd('0x31')](_0xa9bd('0x10b'),_0x2dd9b5[_0xa9bd('0x29')]+_0xa9bd('0x10c'));return{'isValid':![],'message':_0xa9bd('0x107')+_0x2dd9b5[_0xa9bd('0x29')]+_0xa9bd('0x10c')};}return{'isValid':!![],'message':_0xa9bd('0x10d')};};Preview[_0xa9bd('0xf')]['execCall']=function(_0xf7ec7c,_0x2c578a,_0x4cd963,_0x247333){var _0x419084=this;return new Promise(function(_0x542d82,_0x592738){var _0x36346c=_0xf7ec7c[_0xa9bd('0x90')];var _0x447422=_0x419084[_0xa9bd('0x71')](_0x2c578a[_0xa9bd('0x72')])?util[_0xa9bd('0x27')](_0xa9bd('0x10e'),_0x2c578a[_0xa9bd('0x72')][_0xa9bd('0x29')],_[_0xa9bd('0x5a')](_0x2c578a[_0xa9bd('0x10f')])?'':_0x2c578a[_0xa9bd('0x10f')]['trim']()||'',_0x2c578a[_0xa9bd('0x110')]>0x0?_0x4cd963[_0xa9bd('0xff')][_0xa9bd('0x111')](_0x2c578a[_0xa9bd('0x110')]):_0x4cd963['phone']):util[_0xa9bd('0x27')]('SIP/%s/%s%s',_[_0xa9bd('0x5a')](_0x2c578a['TrunkBackup'])?_0x2c578a['Trunk']['name']:_0x2c578a[_0xa9bd('0x73')][_0xa9bd('0x29')],_[_0xa9bd('0x5a')](_0x2c578a[_0xa9bd('0x10f')])?'':_0x2c578a[_0xa9bd('0x10f')][_0xa9bd('0x112')]()||'',_0x2c578a[_0xa9bd('0x110')]>0x0?_0x4cd963[_0xa9bd('0xff')]['substring'](_0x2c578a[_0xa9bd('0x110')]):_0x4cd963[_0xa9bd('0xff')]);var _0x2ee7cc=_0x419084[_0xa9bd('0x71')](_0x2c578a[_0xa9bd('0x72')])?ut[_0xa9bd('0x113')](_0x2c578a[_0xa9bd('0x72')]['callerid'],_0x2c578a[_0xa9bd('0x114')],_0x2c578a[_0xa9bd('0x115')]>0x0?ut[_0xa9bd('0x116')](_0x2c578a['dialOriginateCallerIdNumber'],_0x2c578a['dialRandomLastDigitCallerIdNumber']):_0x2c578a['dialOriginateCallerIdNumber']):ut[_0xa9bd('0x113')](_[_0xa9bd('0x5a')](_0x2c578a[_0xa9bd('0x73')])?_0x2c578a[_0xa9bd('0x72')][_0xa9bd('0x117')]:_0x2c578a[_0xa9bd('0x73')]['callerid'],_0x2c578a[_0xa9bd('0x114')],_0x2c578a['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x2c578a[_0xa9bd('0x118')],_0x2c578a['dialRandomLastDigitCallerIdNumber']):_0x2c578a[_0xa9bd('0x118')]);if(_0x2ee7cc){_0xf7ec7c[_0xa9bd('0x119')]=ut[_0xa9bd('0x11a')](_0x2ee7cc);_0xf7ec7c[_0xa9bd('0x11b')]=ut['extractCalleridNumber'](_0x2ee7cc);}var _0x5d6db7=ut['addVariables'](_0x2c578a,_0x4cd963,_0x447422,_0x2ee7cc,_0x36346c,_0xf7ec7c);var _0x13557d=utils[_0xa9bd('0x11c')](_0x4cd963['Contact']);Object[_0xa9bd('0x11d')](_0x5d6db7,_0x13557d);_[_0xa9bd('0x11e')](_0xf7ec7c,ut[_0xa9bd('0x11f')](_0x5d6db7));_0xf7ec7c[_0xa9bd('0x64')]=moment()[_0xa9bd('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c578a[_0xa9bd('0x120')]=_0x5d6db7;var _0x2f8352=ut[_0xa9bd('0x121')](_0xf7ec7c,_0x2c578a,_0x5d6db7,_0xf7ec7c['activeContact'],_0x247333);return ami[_0xa9bd('0x4e')](_0x2f8352)[_0xa9bd('0x60')](function(_0x25fbd4){_0x2c578a['originated']+=0x1;logger[_0xa9bd('0x25')](_0xa9bd('0x122'),_0x36346c,'\x20Queue',_0x2c578a['name'],_0xa9bd('0x46'),_0x2c578a[_0xa9bd('0x2d')]);_0x542d82(_0x25fbd4);})[_0xa9bd('0x50')](function(_0x1ed030){ut['logAgent'](_0xf7ec7c,0xe,_0xa9bd('0x123'));rpcDb[_0xa9bd('0xdf')](_0xf7ec7c,'[originateFailure][logOriginateFailure]');_0x592738(_0x1ed030);});});};Preview['prototype'][_0xa9bd('0x124')]=function(_0x43ae11){if(this[_0xa9bd('0x16')][_0x43ae11[_0xa9bd('0x89')]]){this[_0xa9bd('0x16')][_0x43ae11[_0xa9bd('0x89')]][_0xa9bd('0x4f')]=_0x43ae11[_0xa9bd('0x4f')];}};Preview[_0xa9bd('0xf')][_0xa9bd('0x125')]=function(_0x2bc51e){var _0x180dac=this;var _0x5c9c26=this[_0xa9bd('0x16')][_0x2bc51e['actionid']];if(_0x5c9c26){if(_0x5c9c26[_0xa9bd('0x126')]&&this[_0xa9bd('0x17')][_0x5c9c26['lookAgent']]){ut['logLookAgent'](_0x5c9c26,this[_0xa9bd('0x17')][_0x5c9c26['lookAgent']][_0xa9bd('0x29')],this[_0xa9bd('0x17')][_0x5c9c26['lookAgent']]['id']);}var _0x21589b=_['clone'](_0x5c9c26);_0x21589b[_0xa9bd('0x8d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x5a051a=_0x180dac[_0xa9bd('0x24')][_0x5c9c26['queue']];if(ut[_0xa9bd('0x127')](_0x2bc51e[_0xa9bd('0x128')])){if(_0x5c9c26[_0xa9bd('0x87')]){rpcDb['unlockContact'](_0x5c9c26[_0xa9bd('0x8a')]);}if(_0x5c9c26[_0xa9bd('0x88')]){rpcDb[_0xa9bd('0x63')](_0x5c9c26[_0xa9bd('0x8a')]);}ami[_0xa9bd('0x2b')]('custom:agentringnoanswer',ut[_0xa9bd('0x97')](_0x5c9c26,_0xa9bd('0x129'),this[_0xa9bd('0x24')][_0x5c9c26[_0xa9bd('0x45')]]));this['callProgressDetectingAgent'](_0x21589b,_0x5a051a,_0x2bc51e);}else{_0x5c9c26[_0xa9bd('0x64')]=moment()['format'](_0xa9bd('0x8c'));ut[_0xa9bd('0xdd')](_0x21589b,0x4,_0xa9bd('0x9b'));rpcDb[_0xa9bd('0xdf')](_0x21589b,_0xa9bd('0x12a'));}}};Preview[_0xa9bd('0xf')][_0xa9bd('0x1a')]=function(_0x53ea2b){var _0x19aec8=this[_0xa9bd('0x16')][_0x53ea2b['linkedid']];var _0x218e13;if(_0x19aec8){_0x218e13=this[_0xa9bd('0x24')][_0x19aec8['queue']];logger['info']('[syncHangup][talking]',_0x53ea2b[_0xa9bd('0x89')],_0xa9bd('0x91'),_0x218e13[_0xa9bd('0x29')],_0xa9bd('0x48'),_0x218e13[_0xa9bd('0x49')]);}if(this[_0xa9bd('0x16')][_0x53ea2b['linkedid']]&&_0x53ea2b['linkedid']!==_0x53ea2b[_0xa9bd('0x90')]){if(_0x53ea2b[_0xa9bd('0x12b')]==='16'&&this[_0xa9bd('0x16')][_0x53ea2b[_0xa9bd('0x89')]][_0xa9bd('0x8f')]){this['callProgressDetectingCustomer'](_0x53ea2b,_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')]);}else if(this['actions'][_0x53ea2b['linkedid']][_0xa9bd('0x8f')]){logger[_0xa9bd('0x25')]('[syncHangup][talking][cause]',_0x53ea2b['linkedid'],_0x53ea2b[_0xa9bd('0x12b')],'\x20Queue',_0x218e13['name'],'pTalking:\x20',_0x218e13[_0xa9bd('0x49')]);this['callProgressDetectingCustomer'](_0x53ea2b,_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')]);}}else if(_0x19aec8&&_[_0xa9bd('0x5a')](_0x19aec8[_0xa9bd('0x12c')])&&_0x218e13[_0xa9bd('0x12d')]&&_0x53ea2b[_0xa9bd('0x89')]===_0x53ea2b[_0xa9bd('0x90')]&&_[_0xa9bd('0x5a')](_0x53ea2b[_0xa9bd('0xdc')])&&_0x53ea2b[_0xa9bd('0x12b')]==='16'&&_0x53ea2b['channelstate']==='6'&&_[_0xa9bd('0xda')](_0x19aec8['transfer'])){if(_0x19aec8[_0xa9bd('0x87')]){rpcDb[_0xa9bd('0x12e')](_0x19aec8[_0xa9bd('0x8a')]);}if(_0x19aec8[_0xa9bd('0x88')]){rpcDb[_0xa9bd('0x63')](_0x19aec8['idContact']);}_0x53ea2b[_0xa9bd('0xdc')]='22';this[_0xa9bd('0xd9')](_0x19aec8,_0x218e13,_0x53ea2b);}else if(_0x19aec8&&_0x19aec8['transfer']){if(_0x53ea2b[_0xa9bd('0x12b')]==='16'&&this[_0xa9bd('0x16')][_0x53ea2b['linkedid']][_0xa9bd('0x8f')]){logger[_0xa9bd('0x25')](_0xa9bd('0x12f'),_0x53ea2b['linkedid'],_0x53ea2b[_0xa9bd('0x12b')],_0xa9bd('0x91'),_0x218e13[_0xa9bd('0x29')],_0xa9bd('0x48'),_0x218e13[_0xa9bd('0x49')]);this[_0xa9bd('0x76')](_0x53ea2b,_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')]);}else if(this[_0xa9bd('0x16')][_0x53ea2b[_0xa9bd('0x89')]][_0xa9bd('0x8f')]){logger['info'](_0xa9bd('0x130'),_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')],_0xa9bd('0x91'),_0x218e13[_0xa9bd('0x29')],'pTalking:\x20',_0x218e13[_0xa9bd('0x49')]);this[_0xa9bd('0x76')](_0x53ea2b,_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')]);}}};Preview[_0xa9bd('0xf')]['syncDialEnd']=function(_0x57ffce){if(this['actions'][_0x57ffce[_0xa9bd('0x131')]]&&_0x57ffce[_0xa9bd('0x131')]!==_0x57ffce[_0xa9bd('0x132')]){this[_0xa9bd('0x76')](_0x57ffce,_0x57ffce[_0xa9bd('0x131')],_0x57ffce['dialstatus']);}};Preview[_0xa9bd('0xf')][_0xa9bd('0x133')]=function(_0x33b775){if(this[_0xa9bd('0x16')][_0x33b775[_0xa9bd('0x89')]]&&_0x33b775[_0xa9bd('0x89')]!==_0x33b775['uniqueid']&&!this[_0xa9bd('0x16')][_0x33b775[_0xa9bd('0x89')]][_0xa9bd('0x8f')]){if(_0x33b775[_0xa9bd('0x12b')]==='1'){this[_0xa9bd('0x76')](_0x33b775,_0x33b775[_0xa9bd('0x89')],_0x33b775[_0xa9bd('0x12b')]);}}};Preview[_0xa9bd('0xf')]['addVariable']=function(_0x4c3f49,_0x183e80,_0x4e1c73){if(this[_0xa9bd('0x16')][_0x4c3f49]){if(_['isNil'](this['actions'][_0x4c3f49]['variables'])){this[_0xa9bd('0x16')][_0x4c3f49][_0xa9bd('0x120')]={};}this['actions'][_0x4c3f49][_0xa9bd('0x120')][_0x183e80]=_0x4e1c73;}};Preview[_0xa9bd('0xf')][_0xa9bd('0x20')]=function(_0x556ba3){try{if(!_['isNil'](_0x556ba3)){if(ut[_0xa9bd('0x134')](_['keys'](_0x556ba3[_0xa9bd('0x135')])[0x0])){this[_0xa9bd('0x136')](_0x556ba3[_0xa9bd('0x90')],_[_0xa9bd('0x137')](_0x556ba3[_0xa9bd('0x135')])[0x0],_0x556ba3[_0xa9bd('0x138')]);}}}catch(_0x5d1913){logger[_0xa9bd('0x139')](_0xa9bd('0x13a'),util[_0xa9bd('0x13b')](_0x5d1913,{'showHidden':![],'depth':null}));}};Preview[_0xa9bd('0xf')][_0xa9bd('0x22')]=function(_0x33971e){if(_0x33971e){if(this[_0xa9bd('0x16')][_0x33971e[_0xa9bd('0x13c')]]){this[_0xa9bd('0x16')][_0x33971e[_0xa9bd('0x13c')]][_0xa9bd('0x13d')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x26e506){if(_0x26e506){if(this[_0xa9bd('0x16')][_0x26e506[_0xa9bd('0x13e')]]){this['actions'][_0x26e506[_0xa9bd('0x13e')]][_0xa9bd('0x13d')]=!![];}}};module[_0xa9bd('0x13f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 7eef595..3abcd26 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 _0x6559=['unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','rescheduleContact','util','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x434409,_0x3bebe2){var _0x36bf49=function(_0x50e769){while(--_0x50e769){_0x434409['push'](_0x434409['shift']());}};_0x36bf49(++_0x3bebe2);}(_0x6559,0x187));var _0x9655=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0x6559[_0x79a6e8];return _0xeeb993;};'use strict';var util=require(_0x9655('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x9655('0x1'));var cmHopper=require(_0x9655('0x2'));var cmHopperHistory=require(_0x9655('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x9655('0x4'));function loggerCatch(_0x55fdba){return function(_0x4b3747){logger[_0x9655('0x5')](_0x55fdba,util[_0x9655('0x6')](_0x4b3747,{'showHidden':![],'depth':null}));};}function create(_0x152f57){return cmHopperHistory['createHistory'](_0x152f57)[_0x9655('0x7')](loggerCatch(_0x9655('0x8')));}function createAgent(_0x4ed073){return BPromise[_0x9655('0x9')]()[_0x9655('0xa')](agentReportPreview['createHistory'](_0x4ed073))[_0x9655('0x7')](loggerCatch(_0x9655('0x8')));}function moveContact(_0x3b5d7a){return cmHopper[_0x9655('0xb')](_0x3b5d7a,!![])[_0x9655('0x7')](loggerCatch(_0x9655('0xc')));}exports[_0x9655('0xd')]=function(_0x5585b5){return cmHopperBlack[_0x9655('0xd')](_0x5585b5)[_0x9655('0x7')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x53c671){return BPromise[_0x9655('0x9')]()[_0x9655('0xa')](cmHopper[_0x9655('0xe')](_0x53c671))['catch'](loggerCatch(_0x9655('0xf')));};exports[_0x9655('0x10')]=function(_0x15b106,_0x46e519){create(_0x15b106)[_0x9655('0x7')](loggerCatch(_0x46e519));moveContact(_0x15b106)[_0x9655('0x7')](loggerCatch(_0x46e519));};exports[_0x9655('0x11')]=function(_0x56275b,_0x19e097){createAgent(_0x56275b)[_0x9655('0x7')](loggerCatch(_0x19e097));};exports[_0x9655('0x12')]=function(_0x41a574,_0x5237f9){create(_0x41a574)['catch'](loggerCatch(_0x5237f9));};exports[_0x9655('0x13')]=function(_0x3c4e0f,_0x525547){moveContact(_0x3c4e0f)[_0x9655('0x7')](loggerCatch(_0x525547));};exports['rescheduleContact']=function(_0x28c4d2,_0x46c95f,_0x3e91e3){if(_0x46c95f){_0x28c4d2[_0x9655('0x14')]=null;}if(_0x3e91e3){_0x28c4d2[_0x9655('0x15')]=![];}return cmHopper['rescheduleContact'](_0x28c4d2)['catch'](loggerCatch(_0x9655('0x16')));};exports[_0x9655('0x17')]=function(_0x5aec8e){return cmHopper[_0x9655('0x17')](_0x5aec8e)[_0x9655('0x7')](loggerCatch(_0x9655('0x18')));};exports[_0x9655('0x19')]=function(_0x24f197){return cmHopper[_0x9655('0x19')]({'UserId':null},_0x24f197,0x1)['catch'](loggerCatch(_0x9655('0x1a')));};exports['disableContact']=function(_0x545127){return cmHopper['unlockContact']({'active':![]},_0x545127,0x1)['catch'](loggerCatch(_0x9655('0x1b')));};exports[_0x9655('0x1c')]=function(_0x1c57f9){var _0x30d9a2={};_0x30d9a2[_0x9655('0x1d')]=_0x1c57f9['type'];_0x30d9a2['uniqueid']=_0x1c57f9[_0x9655('0x1e')];_0x30d9a2[_0x9655('0x1f')]=_0x1c57f9[_0x9655('0x1f')];_0x30d9a2[_0x9655('0x20')]=_0x1c57f9[_0x9655('0x20')];_0x30d9a2[_0x9655('0x21')]=_0x1c57f9[_0x9655('0x21')];_0x30d9a2['queuecallerjoinAt']=_0x1c57f9['answertime'];_0x30d9a2[_0x9655('0x22')]=_0x1c57f9[_0x9655('0x23')];_0x30d9a2[_0x9655('0x24')]=0x1;_0x30d9a2['queuecallercompleteAt']=_0x1c57f9[_0x9655('0x25')];_0x30d9a2[_0x9655('0x26')]=_0x1c57f9['membername'];_0x30d9a2[_0x9655('0x27')]=_0x9655('0x28');_0x30d9a2[_0x9655('0x29')]=_0x9655('0x2a');_0x30d9a2[_0x9655('0x2b')]=0x0;_0x30d9a2['assigned']=0x1;_0x30d9a2[_0x9655('0x2c')]=_0x1c57f9[_0x9655('0x2d')];_0x30d9a2['queuecallerexitreason']=_0x9655('0x2e');return BPromise['resolve']()[_0x9655('0xa')](voiceQueueReport[_0x9655('0x2f')](_0x30d9a2))[_0x9655('0x7')](loggerCatch(_0x9655('0x30')));};exports['getContactRecallMe']=function(_0x2b659d,_0x44d752){return BPromise[_0x9655('0x9')]()['then'](cmHopper[_0x9655('0x31')](_0x2b659d,_0x44d752))[_0x9655('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9655('0x32')]=function(_0x5a7e2d){return cmHopper[_0x9655('0x33')](_0x5a7e2d,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xb9ee=['checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb9ee,0xd5));var _0xeb9e=function(_0xffa1cd,_0x533c8c){_0xffa1cd=_0xffa1cd-0x0;var _0x231e13=_0xb9ee[_0xffa1cd];return _0x231e13;};'use strict';var util=require(_0xeb9e('0x0'));var BPromise=require(_0xeb9e('0x1'));var logger=require(_0xeb9e('0x2'))(_0xeb9e('0x3'));var cmHopper=require(_0xeb9e('0x4'));var cmHopperHistory=require(_0xeb9e('0x5'));var cmHopperBlack=require(_0xeb9e('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xeb9e('0x7'));function loggerCatch(_0x45d3f5){return function(_0x3f995a){logger[_0xeb9e('0x8')](_0x45d3f5,util[_0xeb9e('0x9')](_0x3f995a,{'showHidden':![],'depth':null}));};}function create(_0x4e961a){return cmHopperHistory[_0xeb9e('0xa')](_0x4e961a)[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0xc')));}function createAgent(_0x384795){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x384795))['catch'](loggerCatch(_0xeb9e('0xc')));}function moveContact(_0x1af5e1){return cmHopper[_0xeb9e('0xd')](_0x1af5e1,!![])[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0xe')));}exports[_0xeb9e('0xf')]=function(_0x1c833b){return cmHopperBlack[_0xeb9e('0xf')](_0x1c833b)[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x10')));};exports[_0xeb9e('0x11')]=function(_0x2b7ad2){return BPromise[_0xeb9e('0x12')]()[_0xeb9e('0x13')](cmHopper[_0xeb9e('0x11')](_0x2b7ad2))['catch'](loggerCatch(_0xeb9e('0x14')));};exports['createHistory']=function(_0x4ae1a3,_0x24f757){create(_0x4ae1a3)[_0xeb9e('0xb')](loggerCatch(_0x24f757));moveContact(_0x4ae1a3)[_0xeb9e('0xb')](loggerCatch(_0x24f757));};exports[_0xeb9e('0x15')]=function(_0x1ca5e3,_0xf9d641){createAgent(_0x1ca5e3)[_0xeb9e('0xb')](loggerCatch(_0xf9d641));};exports[_0xeb9e('0x16')]=function(_0x1b7f49,_0x75e27e){create(_0x1b7f49)[_0xeb9e('0xb')](loggerCatch(_0x75e27e));};exports['createCustomerFinal']=function(_0x3c8df1,_0x4e714d){moveContact(_0x3c8df1)[_0xeb9e('0xb')](loggerCatch(_0x4e714d));};exports[_0xeb9e('0x17')]=function(_0x4a38ea,_0x14fd06,_0x518407){if(_0x14fd06){_0x4a38ea['UserId']=null;}if(_0x518407){_0x4a38ea[_0xeb9e('0x18')]=![];}return cmHopper[_0xeb9e('0x17')](_0x4a38ea)[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x19')));};exports[_0xeb9e('0x1a')]=function(_0x4f0c0f){return cmHopper[_0xeb9e('0x1a')](_0x4f0c0f)[_0xeb9e('0xb')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x5439dd){return cmHopper[_0xeb9e('0x1b')]({'UserId':null},_0x5439dd,0x1)[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x1c')));};exports[_0xeb9e('0x1d')]=function(_0x1d5c79){return cmHopper['unlockContact']({'active':![]},_0x1d5c79,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xeb9e('0x1e')]=function(_0x5441be){var _0xebd7a8={};_0xebd7a8[_0xeb9e('0x1f')]=_0x5441be[_0xeb9e('0x1f')];_0xebd7a8[_0xeb9e('0x20')]=_0x5441be[_0xeb9e('0x20')];_0xebd7a8[_0xeb9e('0x21')]=_0x5441be['calleridnum'];_0xebd7a8['calleridname']=_0x5441be[_0xeb9e('0x22')];_0xebd7a8['queue']=_0x5441be[_0xeb9e('0x23')];_0xebd7a8[_0xeb9e('0x24')]=_0x5441be[_0xeb9e('0x25')];_0xebd7a8[_0xeb9e('0x26')]=_0x5441be['answertime'];_0xebd7a8[_0xeb9e('0x27')]=0x1;_0xebd7a8[_0xeb9e('0x28')]=_0x5441be[_0xeb9e('0x29')];_0xebd7a8['connectedlinename']=_0x5441be['membername'];_0xebd7a8[_0xeb9e('0x2a')]=_0xeb9e('0x2b');_0xebd7a8['exten']=_0xeb9e('0x2c');_0xebd7a8[_0xeb9e('0x2d')]=0x0;_0xebd7a8[_0xeb9e('0x2e')]=0x1;_0xebd7a8[_0xeb9e('0x2f')]=_0x5441be[_0xeb9e('0x30')];_0xebd7a8[_0xeb9e('0x31')]=_0xeb9e('0x32');return BPromise[_0xeb9e('0x12')]()[_0xeb9e('0x13')](voiceQueueReport[_0xeb9e('0x33')](_0xebd7a8))[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x34')));};exports[_0xeb9e('0x35')]=function(_0x4216c7,_0x2f7869){return BPromise[_0xeb9e('0x12')]()[_0xeb9e('0x13')](cmHopper[_0xeb9e('0x35')](_0x4216c7,_0x2f7869))[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x36')));};exports[_0xeb9e('0x37')]=function(_0x1aabb1){return cmHopper[_0xeb9e('0x17')](_0x1aabb1,!![],!![])['catch'](loggerCatch(_0xeb9e('0x38')));}; \ 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 2632d38..5e1d47b 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 _0xe038=['campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','recallme','UserId','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridNumber','match','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','../../dialer/utils','error','inspect','logger','info','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','logAgent','state','ringtime','getSeconds','starttime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','variablesAction','calleridname','uniqueid','originate','channelAgent','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','voice','mandatoryDisposition','buildObj','buildAcw','queue','interface','agentReadyId','getDiff','milliseconds','seconds','filterKey','type'];(function(_0x2301ab,_0x12a3a8){var _0x4837b8=function(_0x49daae){while(--_0x49daae){_0x2301ab['push'](_0x2301ab['shift']());}};_0x4837b8(++_0x12a3a8);}(_0xe038,0xa8));var _0x8e03=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe038[_0x1928c9];return _0x51b5fb;};'use strict';var util=require(_0x8e03('0x0'));var _=require('lodash');var moment=require(_0x8e03('0x1'));var logger=require(_0x8e03('0x2'))('preview');var ipAgi=process[_0x8e03('0x3')][_0x8e03('0x4')]||'127.0.0.1';var utils=require(_0x8e03('0x5'));exports['loggerCatch']=function(_0x4aaef0){return function(_0x3c6a54){logger[_0x8e03('0x6')](_0x4aaef0,util[_0x8e03('0x7')](_0x3c6a54,{'showHidden':![],'depth':null}));};};exports[_0x8e03('0x8')]=function(_0x55dd54,_0x21f768){logger[_0x8e03('0x9')](_0x55dd54,util[_0x8e03('0x7')](_0x21f768,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x989791,_0x481f4f){logger[_0x8e03('0x6')](_0x989791,util['inspect'](_0x481f4f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3d4756){return function(_0x4bc589){logger['info'](_0x3d4756,util[_0x8e03('0x7')](_0x4bc589,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4b6ae9,_0x519f19,_0x3475f1){return{'message':_0x4b6ae9,'unlock':_0x519f19,'active':_0x3475f1};};exports[_0x8e03('0xa')]=function(_0x13ff42,_0x2892a3,_0x428a3d){if(!_[_0x8e03('0xb')](_0x428a3d)&&_0x8e03('0xc')===typeof _0x428a3d&&!_['isEmpty'](_0x428a3d)){if(!_[_0x8e03('0xb')](_0x2892a3)&&_0x8e03('0xc')===typeof _0x2892a3&&!_[_0x8e03('0xd')](_0x2892a3)){return util[_0x8e03('0xe')](_0x8e03('0xf'),_0x2892a3,_0x428a3d);}return util[_0x8e03('0xe')](_0x8e03('0xf'),_0x428a3d,_0x428a3d);}if(!_['isUndefined'](_0x13ff42)&&'string'===typeof _0x13ff42&&!_[_0x8e03('0xd')](_0x13ff42)){return _0x13ff42;}return _0x8e03('0x10');};exports['isActive']=function(_0x3f7cba){if(_[_0x8e03('0x11')](_0x3f7cba)){return![];}return _0x3f7cba;};exports['addVariables']=function(_0x6c70ad,_0x2b6d27,_0x19926b,_0x584c58,_0x4009e3,_0x10590e){var _0x1cca2e={'XMD-QUEUE':_0x2b6d27['Queue']?_0x2b6d27[_0x8e03('0x12')]['name']:'','XMD-CALLERID':_0x584c58,'XMD-CALLERID-PREVIEW':_0x10590e?util[_0x8e03('0xe')](_0x8e03('0xf'),_0x10590e['calleridname'],_0x10590e[_0x8e03('0x13')]):_0x584c58,'XMD-DIALID':_0x4009e3,'XMD-CONTACTID':_0x2b6d27[_0x8e03('0x14')],'XMD-CDRTYPE':_0x8e03('0x15'),'CALLERID(all)':_0x584c58,'XMD-VOICEQUEUEID':_0x2b6d27[_0x8e03('0x16')],'XMD-DIALCHANNEL':_0x19926b,'XMD-DIALTIMEOUT':_0x6c70ad[_0x8e03('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0x8e03('0xe')](_0x8e03('0x18'),_0x6c70ad['dialQueueProject2']?'g':'',_[_0x8e03('0xd')](_0x6c70ad[_0x8e03('0x19')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x6c70ad[_0x8e03('0x1a')]||'','XMD-AGI':_0x6c70ad[_0x8e03('0x1b')]?util['format'](_0x8e03('0x1c'),ipAgi,_0x6c70ad[_0x8e03('0x1b')]):_0x8e03('0x1d'),'XMD-AGIAFTER':_0x6c70ad[_0x8e03('0x1e')]?util[_0x8e03('0xe')](_0x8e03('0x1c'),ipAgi,_0x6c70ad[_0x8e03('0x1e')]):_0x8e03('0x1d'),'XMD-ORIGINATECALLERIDNUM':_0x10590e?_0x10590e[_0x8e03('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x10590e?_0x10590e[_0x8e03('0x20')]:'','XMD-DESTINATION':_0x8e03('0x21'),'SIPADDHEADER':_0x8e03('0x22')};if(!_[_0x8e03('0xd')](_0x6c70ad[_0x8e03('0x19')])){_0x1cca2e[util[_0x8e03('0xe')]('%s',_0x8e03('0x23'))]=_0x6c70ad[_0x8e03('0x19')];_0x1cca2e[util[_0x8e03('0xe')]('%s',_0x8e03('0x24'))]=_0x4009e3;}return _0x1cca2e;};exports[_0x8e03('0x25')]=function(_0x50690a){var _0x2881e8={};for(var _0x93bbd3 in _0x50690a){if(_0x50690a[_0x8e03('0x26')](_0x93bbd3)){_0x2881e8[util[_0x8e03('0xe')]('%s',_[_0x8e03('0x27')](_0x93bbd3))]=_0x50690a[_0x93bbd3];}}return{'variables':_0x2881e8};};exports[_0x8e03('0x28')]=function(_0x1b551a,_0x35db4a){if(!_[_0x8e03('0x11')](_0x1b551a)){if(_0x1b551a[_0x8e03('0x26')](_0x8e03('0x29'))){if(_0x1b551a[_0x8e03('0x29')]>0x0){_0x1b551a[_0x8e03('0x29')]-=0x1;}else{logger['error'](_0x8e03('0x2a'),_0x35db4a);}}}else{logger[_0x8e03('0x6')](_0x8e03('0x2b'),_0x35db4a);}};exports[_0x8e03('0x2c')]=function(_0x47a9e1){var _0x165525=moment()['format'](_0x8e03('0x2d'));_0x47a9e1['state']=0xd;_0x47a9e1[_0x8e03('0x2e')]=_0x8e03('0x2f');_0x47a9e1['starttime']=_0x165525;_0x47a9e1[_0x8e03('0x30')]=_0x165525;_0x47a9e1[_0x8e03('0x31')]=_0x165525;};exports[_0x8e03('0x32')]=function(_0x13d81d,_0x47d8e1,_0x491478){var _0x1be37f=moment()[_0x8e03('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x13d81d[_0x8e03('0x33')]=_0x47d8e1;_0x13d81d[_0x8e03('0x2e')]=_0x491478;_0x13d81d['responsetime']=_0x1be37f;_0x13d81d[_0x8e03('0x34')]=utils[_0x8e03('0x35')](_0x13d81d[_0x8e03('0x30')],_0x13d81d[_0x8e03('0x36')]);};exports[_0x8e03('0x37')]=function(_0x4953f9,_0x557203,_0x2b64d6){_0x4953f9[_0x8e03('0x38')]=_0x557203;_0x4953f9['UserId']=_0x2b64d6;};exports[_0x8e03('0x39')]=function(_0x3c9954,_0x302a84,_0x4eeb6e){var _0x566e6c=moment()[_0x8e03('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c9954[_0x8e03('0x33')]=_0x302a84;_0x3c9954['statedesc']=_0x4eeb6e;_0x3c9954[_0x8e03('0x30')]=_0x3c9954['responsetime']?_0x3c9954[_0x8e03('0x30')]:_0x566e6c;_0x3c9954['endtime']=_0x3c9954[_0x8e03('0x31')]?_0x3c9954[_0x8e03('0x31')]:_0x566e6c;_0x3c9954[_0x8e03('0x34')]=utils[_0x8e03('0x35')](_0x3c9954['responsetime']||0x0,_0x3c9954['starttime']||0x0);_0x3c9954[_0x8e03('0x3a')]=_0x3c9954[_0x8e03('0x3b')]?utils[_0x8e03('0x35')](_0x3c9954[_0x8e03('0x31')],_0x3c9954[_0x8e03('0x3b')]):0x0;};exports[_0x8e03('0x3c')]=function(_0x510626){return _0x510626==='Failure';};exports[_0x8e03('0x3d')]=function(_0x4036de,_0x2a7b98,_0x3606d3,_0x419344,_0xbd63ab){var _0x1c76df=_0x419344?'RECALL':_0x4036de[_0x8e03('0x3e')];_0x1c76df=_0xbd63ab?'BOOKED':_0x1c76df;return{'actionid':_0x4036de[_0x8e03('0x3f')],'action':_0x8e03('0x40'),'channel':_0x4036de[_0x8e03('0x41')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x1c76df,_0x4036de['calleridnum']),'Exten':_0x8e03('0x21'),'Context':'from-sip','Priority':'1','variable':_0x3606d3,'timeout':(_0x2a7b98[_0x8e03('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4036de['uniqueid']};};exports['totalGlobal']=function(_0x2a39cf){return _0x2a39cf[_0x8e03('0x43')]+_0x2a39cf['countcongestionretry']+_0x2a39cf[_0x8e03('0x44')]+_0x2a39cf[_0x8e03('0x45')]+_0x2a39cf[_0x8e03('0x46')];};exports['cloneAction']=function(_0x4a959a){var _0x47a09d=_[_0x8e03('0x47')](_0x4a959a);_0x47a09d[_0x8e03('0x33')]=0xf;_0x47a09d['statedesc']='Global';return _0x47a09d;};exports[_0x8e03('0x48')]=function(_0x313f12,_0x4b3117,_0x4a9858){var _0x4921d8={};_0x4921d8[_0x4b3117]=_0x313f12[_0x4b3117];_0x4921d8[_0x8e03('0x49')]=![];_0x4921d8[_0x8e03('0x4a')]=moment()[_0x8e03('0x4b')](_0x4a9858,'minutes')[_0x8e03('0xe')](_0x8e03('0x2d'));_0x4921d8[_0x8e03('0x14')]=_0x313f12[_0x8e03('0x14')];_0x4921d8[_0x8e03('0x4c')]=_0x313f12[_0x8e03('0x4c')];_0x4921d8[_0x8e03('0x16')]=_0x313f12[_0x8e03('0x16')]||undefined;return _0x4921d8;};exports[_0x8e03('0x4d')]=function(_0x538708,_0xb13b3e){if(!_[_0x8e03('0x11')](_0x538708)){if(_0x538708[_0x8e03('0x4e')]>0x0){_0x538708['pTalking']-=0x1;}else{logger[_0x8e03('0x6')](_0xb13b3e,_0x8e03('0x4f'));}}else{logger[_0x8e03('0x6')](_0xb13b3e,_0x8e03('0x50'));}};exports[_0x8e03('0x51')]=function(_0x5eac3d){if(_0x5eac3d<=0x0){return!![];}return![];};function buildObj(_0x3cc5ae,_0x17fbc4,_0x1bdd8d){_0x3cc5ae[_0x8e03('0x52')]=_0x17fbc4;_0x3cc5ae[_0x8e03('0x53')]=_0x3cc5ae['queue'];_0x3cc5ae['interface']=_0x3cc5ae[_0x8e03('0x41')];_0x3cc5ae['motionChannel']=_0x8e03('0x54');if(_0x1bdd8d){_0x3cc5ae[_0x8e03('0x55')]=_0x1bdd8d[_0x8e03('0x55')];}return _0x3cc5ae;}exports[_0x8e03('0x56')]=buildObj;exports[_0x8e03('0x57')]=function(_0x5e6852){var _0x169e91={};_0x169e91[_0x8e03('0x58')]=_0x5e6852['queue'];_0x169e91[_0x8e03('0x59')]=_0x5e6852[_0x8e03('0x41')];_0x169e91['uniqueid']=_0x5e6852[_0x8e03('0x3f')];return _0x169e91;};exports[_0x8e03('0x5a')]=function(_0x393636){var _0x4c2824=[];for(var _0x34205a in _0x393636){if(_0x393636[_0x8e03('0x26')](_0x34205a)){if(!_[_0x8e03('0x11')](_0x393636[_0x34205a])&&_0x393636[_0x34205a][_0x8e03('0x33')]==='not_inuse'&&_0x393636[_0x34205a]['status']==='reachable'){_0x4c2824['push'](_0x393636[_0x34205a]['id']);}}}return _0x4c2824;};exports[_0x8e03('0x5b')]=function(_0x4db3a4){var _0x149f0d=moment()[_0x8e03('0x5c')](0x0);var _0xdbc328=moment(_0x4db3a4)['milliseconds'](0x0);return _0x149f0d['diff'](_0xdbc328,_0x8e03('0x5d'));};exports['createBody']=function(_0x58fc03){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58fc03[_0x8e03('0x14')],'ListId':_0x58fc03[_0x8e03('0x4c')],'VoiceQueueId':_0x58fc03[_0x8e03('0x16')]||undefined,'CampaignId':_0x58fc03['CampaignId']||undefined};};exports[_0x8e03('0x5e')]=function(_0x3b458f){if(_0x3b458f===_0x8e03('0x3f')||_0x3b458f==='idContact'||_0x3b458f==='queue'||_0x3b458f===_0x8e03('0x5f')||_0x3b458f===_0x8e03('0x60')||_0x3b458f===_0x8e03('0x61')||_0x3b458f===_0x8e03('0x38')||_0x3b458f===_0x8e03('0x41')||_0x3b458f===_0x8e03('0x3e')||_0x3b458f===_0x8e03('0x49')||_0x3b458f===_0x8e03('0x13')||_0x3b458f==='scheduledat'||_0x3b458f===_0x8e03('0x43')||_0x3b458f==='countcongestionretry'||_0x3b458f===_0x8e03('0x44')||_0x3b458f===_0x8e03('0x62')||_0x3b458f===_0x8e03('0x63')||_0x3b458f===_0x8e03('0x64')||_0x3b458f==='callbackat'||_0x3b458f===_0x8e03('0x65')||_0x3b458f===_0x8e03('0x14')||_0x3b458f===_0x8e03('0x4c')||_0x3b458f===_0x8e03('0x66')||_0x3b458f===_0x8e03('0x16')||_0x3b458f==='sipcallid'||_0x3b458f==='xmd-voicequeueid'||_0x3b458f===_0x8e03('0x67')||_0x3b458f===_0x8e03('0x68')||_0x3b458f===_0x8e03('0x69')||_0x3b458f===_0x8e03('0x6a')||_0x3b458f===_0x8e03('0x6b')||_0x3b458f===_0x8e03('0x6c')||_0x3b458f===_0x8e03('0x6d')||_0x3b458f==='xmd-dialchannel'||_0x3b458f==='xmd-contactid'||_0x3b458f===_0x8e03('0x6e')||_0x3b458f===_0x8e03('0x6f')||_0x3b458f==='xmd-agiafter'||_0x3b458f==='xmd-agi'||_0x3b458f===_0x8e03('0x70')||_0x3b458f==='rtpaudioqosbridged'||_0x3b458f===_0x8e03('0x71')||_0x3b458f===_0x8e03('0x72')||_0x3b458f===_0x8e03('0x73')||_0x3b458f===_0x8e03('0x74')||_0x3b458f===_0x8e03('0x75')||_0x3b458f==='rtpaudioqosrttbridged'||_0x3b458f===_0x8e03('0x70')||_0x3b458f===_0x8e03('0x76')||_0x3b458f===_0x8e03('0x71')||_0x3b458f===_0x8e03('0x72')||_0x3b458f===_0x8e03('0x73')||_0x3b458f===_0x8e03('0x74')||_0x3b458f===_0x8e03('0x75')||_0x3b458f===_0x8e03('0x77')||_0x3b458f==='bridgepeer'||_0x3b458f===_0x8e03('0x78')||_0x3b458f===_0x8e03('0x33')||_0x3b458f===_0x8e03('0x2e')){return![];}return!![];};exports[_0x8e03('0x79')]=function(_0x2b4ba8,_0xb2701a){var _0x1ea5cf,_0x5a56d7,_0x197707;if(_0xb2701a<=0x0){_0xb2701a=0x1;}_0x1ea5cf=new RegExp('\x5cw{0,'+_0xb2701a+'}$');_0x5a56d7=Math[_0x8e03('0x7a')](0xa,_0xb2701a-0x1);_0x197707=Math[_0x8e03('0x7a')](0xa,_0xb2701a)-0x1;return util[_0x8e03('0xe')]('%s',_[_0x8e03('0x7b')](_0x2b4ba8,_0x1ea5cf,_[_0x8e03('0x7c')](_0x5a56d7,_0x197707)));};exports['extractCalleridName']=function(_0x4dd738){var _0x362f63=_0x4dd738['match'](/"(.*?)"/);return _0x362f63?_0x362f63[0x1]:_0x4dd738;};exports[_0x8e03('0x7d')]=function(_0x1830af){var _0x35984b=_0x1830af[_0x8e03('0x7e')](/<(.*?)>/);return _0x35984b?_0x35984b[0x1]:_0x1830af;};function buildNoAnswerEventPayload(_0x50f19a,_0x53babd){var _0x2d2ac7=buildObj(_0x50f19a,_0x8e03('0x7f'));if(!_['isEmpty'](_0x53babd[_0x8e03('0x80')])){Object['keys'](_0x53babd['variables'])[_0x8e03('0x81')](function(_0x32711f){_0x2d2ac7[_0x32711f[_0x8e03('0x82')]()]=_0x53babd[_0x8e03('0x80')][_0x32711f];});}return _0x2d2ac7;}exports[_0x8e03('0x83')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x9b5f=['addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','updateOriginated','isNil','hasOwnProperty','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','membername','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive'];(function(_0xff838d,_0x8ba8cb){var _0x44112a=function(_0x2c288a){while(--_0x2c288a){_0xff838d['push'](_0xff838d['shift']());}};_0x44112a(++_0x8ba8cb);}(_0x9b5f,0x7f));var _0xf9b5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9b5f[_0x27af45];return _0x18df21;};'use strict';var util=require(_0xf9b5('0x0'));var _=require(_0xf9b5('0x1'));var moment=require('moment');var logger=require(_0xf9b5('0x2'))(_0xf9b5('0x3'));var ipAgi=process[_0xf9b5('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0xf9b5('0x5'));exports[_0xf9b5('0x6')]=function(_0x4ea59a){return function(_0x224f10){logger[_0xf9b5('0x7')](_0x4ea59a,util[_0xf9b5('0x8')](_0x224f10,{'showHidden':![],'depth':null}));};};exports[_0xf9b5('0x9')]=function(_0x477e94,_0x4a4206){logger[_0xf9b5('0xa')](_0x477e94,util[_0xf9b5('0x8')](_0x4a4206,{'showHidden':![],'depth':null}));};exports[_0xf9b5('0xb')]=function(_0x28e352,_0x4d7cca){logger[_0xf9b5('0x7')](_0x28e352,util[_0xf9b5('0x8')](_0x4d7cca,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3714f6){return function(_0x334ffb){logger[_0xf9b5('0xa')](_0x3714f6,util[_0xf9b5('0x8')](_0x334ffb,{'showHidden':![],'depth':null}));};};exports[_0xf9b5('0xc')]=function(_0x1ca0ba,_0x4c75b7,_0x5db53b){return{'message':_0x1ca0ba,'unlock':_0x4c75b7,'active':_0x5db53b};};exports[_0xf9b5('0xd')]=function(_0x4534d1,_0x424b3d,_0x8ad2de){if(!_[_0xf9b5('0xe')](_0x8ad2de)&&_0xf9b5('0xf')===typeof _0x8ad2de&&!_[_0xf9b5('0x10')](_0x8ad2de)){if(!_['isUndefined'](_0x424b3d)&&_0xf9b5('0xf')===typeof _0x424b3d&&!_[_0xf9b5('0x10')](_0x424b3d)){return util[_0xf9b5('0x11')](_0xf9b5('0x12'),_0x424b3d,_0x8ad2de);}return util[_0xf9b5('0x11')](_0xf9b5('0x12'),_0x8ad2de,_0x8ad2de);}if(!_[_0xf9b5('0xe')](_0x4534d1)&&_0xf9b5('0xf')===typeof _0x4534d1&&!_[_0xf9b5('0x10')](_0x4534d1)){return _0x4534d1;}return _0xf9b5('0x13');};exports[_0xf9b5('0x14')]=function(_0xe978a3){if(_['isNil'](_0xe978a3)){return![];}return _0xe978a3;};exports[_0xf9b5('0x15')]=function(_0x58b05e,_0x295539,_0x4fa230,_0x2721b4,_0x52c3ad,_0x1b335d){var _0x13b4ba={'XMD-QUEUE':_0x295539[_0xf9b5('0x16')]?_0x295539[_0xf9b5('0x16')]['name']:'','XMD-CALLERID':_0x2721b4,'XMD-CALLERID-PREVIEW':_0x1b335d?util['format'](_0xf9b5('0x12'),_0x1b335d[_0xf9b5('0x17')],_0x1b335d[_0xf9b5('0x18')]):_0x2721b4,'XMD-DIALID':_0x52c3ad,'XMD-CONTACTID':_0x295539[_0xf9b5('0x19')],'XMD-CDRTYPE':_0xf9b5('0x1a'),'CALLERID(all)':_0x2721b4,'XMD-VOICEQUEUEID':_0x295539[_0xf9b5('0x1b')],'XMD-DIALCHANNEL':_0x4fa230,'XMD-DIALTIMEOUT':_0x58b05e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xf9b5('0x11')](_0xf9b5('0x1c'),_0x58b05e[_0xf9b5('0x1d')]?'g':'',_[_0xf9b5('0x10')](_0x58b05e[_0xf9b5('0x1e')])?'':_0xf9b5('0x1f')),'XMD-DIALURL':_0x58b05e['dialPreviewUrl']||'','XMD-AGI':_0x58b05e[_0xf9b5('0x20')]?util[_0xf9b5('0x11')](_0xf9b5('0x21'),ipAgi,_0x58b05e[_0xf9b5('0x20')]):'NONE','XMD-AGIAFTER':_0x58b05e[_0xf9b5('0x1d')]?util['format'](_0xf9b5('0x21'),ipAgi,_0x58b05e['dialQueueProject2']):_0xf9b5('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x1b335d?_0x1b335d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1b335d?_0x1b335d[_0xf9b5('0x23')]:'','XMD-DESTINATION':_0xf9b5('0x24'),'SIPADDHEADER':_0xf9b5('0x25')};if(!_[_0xf9b5('0x10')](_0x58b05e[_0xf9b5('0x1e')])){_0x13b4ba[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x58b05e['monitor_format'];_0x13b4ba[util['format']('%s',_0xf9b5('0x26'))]=_0x52c3ad;}return _0x13b4ba;};exports[_0xf9b5('0x27')]=function(_0x485c87){var _0x12a2f9={};for(var _0x4feb57 in _0x485c87){if(_0x485c87['hasOwnProperty'](_0x4feb57)){_0x12a2f9[util['format']('%s',_[_0xf9b5('0x28')](_0x4feb57))]=_0x485c87[_0x4feb57];}}return{'variables':_0x12a2f9};};exports[_0xf9b5('0x29')]=function(_0x2a66dd,_0xd18602){if(!_[_0xf9b5('0x2a')](_0x2a66dd)){if(_0x2a66dd[_0xf9b5('0x2b')](_0xf9b5('0x2c'))){if(_0x2a66dd[_0xf9b5('0x2c')]>0x0){_0x2a66dd[_0xf9b5('0x2c')]-=0x1;}else{logger[_0xf9b5('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0xd18602);}}}else{logger[_0xf9b5('0x7')](_0xf9b5('0x2d'),_0xd18602);}};exports[_0xf9b5('0x2e')]=function(_0x4073d6){var _0x550824=moment()[_0xf9b5('0x11')](_0xf9b5('0x2f'));_0x4073d6[_0xf9b5('0x30')]=0xd;_0x4073d6['statedesc']=_0xf9b5('0x31');_0x4073d6[_0xf9b5('0x32')]=_0x550824;_0x4073d6[_0xf9b5('0x33')]=_0x550824;_0x4073d6[_0xf9b5('0x34')]=_0x550824;};exports[_0xf9b5('0x35')]=function(_0x457eb6,_0x4abf08,_0x23be5a){var _0x5e5030=moment()[_0xf9b5('0x11')](_0xf9b5('0x2f'));_0x457eb6[_0xf9b5('0x30')]=_0x4abf08;_0x457eb6[_0xf9b5('0x36')]=_0x23be5a;_0x457eb6[_0xf9b5('0x33')]=_0x5e5030;_0x457eb6[_0xf9b5('0x37')]=utils['getSeconds'](_0x457eb6['responsetime'],_0x457eb6['starttime']);};exports['logLookAgent']=function(_0xe106f1,_0x3d5247,_0x3d671b){_0xe106f1['membername']=_0x3d5247;_0xe106f1[_0xf9b5('0x38')]=_0x3d671b;};exports[_0xf9b5('0x39')]=function(_0x3cca39,_0x3ad066,_0x297593){var _0x3da572=moment()[_0xf9b5('0x11')](_0xf9b5('0x2f'));_0x3cca39['state']=_0x3ad066;_0x3cca39[_0xf9b5('0x36')]=_0x297593;_0x3cca39['responsetime']=_0x3cca39[_0xf9b5('0x33')]?_0x3cca39[_0xf9b5('0x33')]:_0x3da572;_0x3cca39[_0xf9b5('0x34')]=_0x3cca39[_0xf9b5('0x34')]?_0x3cca39[_0xf9b5('0x34')]:_0x3da572;_0x3cca39['ringtime']=utils['getSeconds'](_0x3cca39[_0xf9b5('0x33')]||0x0,_0x3cca39[_0xf9b5('0x32')]||0x0);_0x3cca39[_0xf9b5('0x3a')]=_0x3cca39[_0xf9b5('0x3b')]?utils['getSeconds'](_0x3cca39[_0xf9b5('0x34')],_0x3cca39[_0xf9b5('0x3b')]):0x0;};exports[_0xf9b5('0x3c')]=function(_0x3376b1){return _0x3376b1===_0xf9b5('0x3d');};exports['variablesAction']=function(_0x507d18,_0x34ec6d,_0xe47997,_0x5b48cb,_0x3ec052){var _0x167425=_0x5b48cb?_0xf9b5('0x3e'):_0x507d18[_0xf9b5('0x17')];_0x167425=_0x3ec052?_0xf9b5('0x3f'):_0x167425;return{'actionid':_0x507d18[_0xf9b5('0x40')],'action':_0xf9b5('0x41'),'channel':_0x507d18[_0xf9b5('0x42')],'callerid':util[_0xf9b5('0x11')]('\x22%s\x22\x20<%s>',_0x167425,_0x507d18[_0xf9b5('0x18')]),'Exten':_0xf9b5('0x24'),'Context':_0xf9b5('0x43'),'Priority':'1','variable':_0xe47997,'timeout':(_0x34ec6d['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x507d18[_0xf9b5('0x40')]};};exports[_0xf9b5('0x44')]=function(_0x20e993){return _0x20e993['countbusyretry']+_0x20e993[_0xf9b5('0x45')]+_0x20e993[_0xf9b5('0x46')]+_0x20e993[_0xf9b5('0x47')]+_0x20e993[_0xf9b5('0x48')];};exports[_0xf9b5('0x49')]=function(_0x45318d){var _0x332120=_['clone'](_0x45318d);_0x332120[_0xf9b5('0x30')]=0xf;_0x332120[_0xf9b5('0x36')]=_0xf9b5('0x4a');return _0x332120;};exports[_0xf9b5('0x4b')]=function(_0x38890f,_0x4dfadd,_0x26b2e6){var _0x494c8c={};_0x494c8c[_0x4dfadd]=_0x38890f[_0x4dfadd];_0x494c8c['active']=![];_0x494c8c[_0xf9b5('0x4c')]=moment()[_0xf9b5('0x4d')](_0x26b2e6,_0xf9b5('0x4e'))[_0xf9b5('0x11')](_0xf9b5('0x2f'));_0x494c8c[_0xf9b5('0x19')]=_0x38890f[_0xf9b5('0x19')];_0x494c8c[_0xf9b5('0x4f')]=_0x38890f[_0xf9b5('0x4f')];_0x494c8c['VoiceQueueId']=_0x38890f[_0xf9b5('0x1b')]||undefined;return _0x494c8c;};exports[_0xf9b5('0x50')]=function(_0x36634f,_0x207f47){if(!_[_0xf9b5('0x2a')](_0x36634f)){if(_0x36634f[_0xf9b5('0x51')]>0x0){_0x36634f['pTalking']-=0x1;}else{logger[_0xf9b5('0x7')](_0x207f47,_0xf9b5('0x52'));}}else{logger[_0xf9b5('0x7')](_0x207f47,_0xf9b5('0x53'));}};exports['IsNotLoggedIn']=function(_0xb7660a){if(_0xb7660a<=0x0){return!![];}return![];};function buildObj(_0x4c9e2b,_0x1926f6,_0x42645a){_0x4c9e2b[_0xf9b5('0x54')]=_0x1926f6;_0x4c9e2b[_0xf9b5('0x55')]=_0x4c9e2b[_0xf9b5('0x56')];_0x4c9e2b[_0xf9b5('0x57')]=_0x4c9e2b['channelAgent'];_0x4c9e2b[_0xf9b5('0x58')]='voice';if(_0x42645a){_0x4c9e2b['mandatoryDisposition']=_0x42645a[_0xf9b5('0x59')];}return _0x4c9e2b;}exports[_0xf9b5('0x5a')]=buildObj;exports[_0xf9b5('0x5b')]=function(_0x118fc0){var _0x2ded10={};_0x2ded10[_0xf9b5('0x56')]=_0x118fc0[_0xf9b5('0x56')];_0x2ded10[_0xf9b5('0x57')]=_0x118fc0[_0xf9b5('0x42')];_0x2ded10[_0xf9b5('0x40')]=_0x118fc0[_0xf9b5('0x40')];return _0x2ded10;};exports[_0xf9b5('0x5c')]=function(_0x5ecbd2){var _0x1f788c=[];for(var _0x50f986 in _0x5ecbd2){if(_0x5ecbd2[_0xf9b5('0x2b')](_0x50f986)){if(!_['isNil'](_0x5ecbd2[_0x50f986])&&_0x5ecbd2[_0x50f986][_0xf9b5('0x30')]===_0xf9b5('0x5d')&&_0x5ecbd2[_0x50f986][_0xf9b5('0x5e')]===_0xf9b5('0x5f')){_0x1f788c[_0xf9b5('0x60')](_0x5ecbd2[_0x50f986]['id']);}}}return _0x1f788c;};exports[_0xf9b5('0x61')]=function(_0x1e37ee){var _0x26a338=moment()[_0xf9b5('0x62')](0x0);var _0x1d0c18=moment(_0x1e37ee)['milliseconds'](0x0);return _0x26a338[_0xf9b5('0x63')](_0x1d0c18,_0xf9b5('0x64'));};exports[_0xf9b5('0x65')]=function(_0x4edd74){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4edd74[_0xf9b5('0x19')],'ListId':_0x4edd74[_0xf9b5('0x4f')],'VoiceQueueId':_0x4edd74[_0xf9b5('0x1b')]||undefined,'CampaignId':_0x4edd74[_0xf9b5('0x66')]||undefined};};exports[_0xf9b5('0x67')]=function(_0x150ff3){if(_0x150ff3===_0xf9b5('0x40')||_0x150ff3===_0xf9b5('0x68')||_0x150ff3===_0xf9b5('0x56')||_0x150ff3===_0xf9b5('0x69')||_0x150ff3==='campaigntype'||_0x150ff3===_0xf9b5('0x6a')||_0x150ff3===_0xf9b5('0x6b')||_0x150ff3===_0xf9b5('0x42')||_0x150ff3===_0xf9b5('0x17')||_0x150ff3===_0xf9b5('0x6c')||_0x150ff3===_0xf9b5('0x18')||_0x150ff3===_0xf9b5('0x4c')||_0x150ff3==='countbusyretry'||_0x150ff3===_0xf9b5('0x45')||_0x150ff3===_0xf9b5('0x46')||_0x150ff3===_0xf9b5('0x6d')||_0x150ff3===_0xf9b5('0x6e')||_0x150ff3===_0xf9b5('0x6f')||_0x150ff3===_0xf9b5('0x70')||_0x150ff3===_0xf9b5('0x71')||_0x150ff3===_0xf9b5('0x19')||_0x150ff3==='ListId'||_0x150ff3===_0xf9b5('0x38')||_0x150ff3===_0xf9b5('0x1b')||_0x150ff3===_0xf9b5('0x72')||_0x150ff3===_0xf9b5('0x73')||_0x150ff3===_0xf9b5('0x74')||_0x150ff3===_0xf9b5('0x75')||_0x150ff3===_0xf9b5('0x76')||_0x150ff3===_0xf9b5('0x77')||_0x150ff3===_0xf9b5('0x78')||_0x150ff3===_0xf9b5('0x79')||_0x150ff3===_0xf9b5('0x7a')||_0x150ff3==='xmd-dialchannel'||_0x150ff3==='xmd-contactid'||_0x150ff3===_0xf9b5('0x7b')||_0x150ff3===_0xf9b5('0x7c')||_0x150ff3===_0xf9b5('0x7d')||_0x150ff3===_0xf9b5('0x7e')||_0x150ff3===_0xf9b5('0x7f')||_0x150ff3===_0xf9b5('0x80')||_0x150ff3===_0xf9b5('0x81')||_0x150ff3==='rtpaudioqosjitterbridged'||_0x150ff3===_0xf9b5('0x82')||_0x150ff3===_0xf9b5('0x83')||_0x150ff3===_0xf9b5('0x84')||_0x150ff3===_0xf9b5('0x85')||_0x150ff3===_0xf9b5('0x7f')||_0x150ff3===_0xf9b5('0x80')||_0x150ff3===_0xf9b5('0x81')||_0x150ff3==='rtpaudioqosjitterbridged'||_0x150ff3===_0xf9b5('0x82')||_0x150ff3===_0xf9b5('0x83')||_0x150ff3===_0xf9b5('0x84')||_0x150ff3===_0xf9b5('0x85')||_0x150ff3===_0xf9b5('0x86')||_0x150ff3===_0xf9b5('0x87')||_0x150ff3===_0xf9b5('0x30')||_0x150ff3===_0xf9b5('0x36')){return![];}return!![];};exports[_0xf9b5('0x88')]=function(_0x4913ee,_0x117678){var _0x4b91e4,_0x3a820f,_0x296d00;if(_0x117678<=0x0){_0x117678=0x1;}_0x4b91e4=new RegExp(_0xf9b5('0x89')+_0x117678+'}$');_0x3a820f=Math['pow'](0xa,_0x117678-0x1);_0x296d00=Math[_0xf9b5('0x8a')](0xa,_0x117678)-0x1;return util['format']('%s',_[_0xf9b5('0x8b')](_0x4913ee,_0x4b91e4,_[_0xf9b5('0x8c')](_0x3a820f,_0x296d00)));};exports['extractCalleridName']=function(_0x3f2cb6){var _0xfe7d25=_0x3f2cb6[_0xf9b5('0x8d')](/"(.*?)"/);return _0xfe7d25?_0xfe7d25[0x1]:_0x3f2cb6;};exports['extractCalleridNumber']=function(_0x48bea3){var _0x151b0c=_0x48bea3[_0xf9b5('0x8d')](/<(.*?)>/);return _0x151b0c?_0x151b0c[0x1]:_0x48bea3;};function buildNoAnswerEventPayload(_0x250e6d,_0x8465f6){var _0x4f39be=buildObj(_0x250e6d,_0xf9b5('0x8e'));if(!_[_0xf9b5('0x10')](_0x8465f6[_0xf9b5('0x8f')])){Object[_0xf9b5('0x90')](_0x8465f6[_0xf9b5('0x8f')])[_0xf9b5('0x91')](function(_0x1fc495){_0x4f39be[_0x1fc495[_0xf9b5('0x92')]()]=_0x8465f6['variables'][_0x1fc495];});}return _0x4f39be;}exports[_0xf9b5('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 74b467a..bfeecfa 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 _0xd1a3=['number','boolean','queuepause','reload','voicequeuechannelhangup','voicequeuechannelredirect','string'];(function(_0x288f73,_0x5d378b){var _0x417fe3=function(_0x2ebdc3){while(--_0x2ebdc3){_0x288f73['push'](_0x288f73['shift']());}};_0x417fe3(++_0x5d378b);}(_0xd1a3,0xc3));var _0x3d1a=function(_0x534e79,_0x24dbfe){_0x534e79=_0x534e79-0x0;var _0x381f13=_0xd1a3[_0x534e79];return _0x381f13;};'use strict';exports['queueadd']={'queue':{'type':_0x3d1a('0x0'),'required':!![]},'interface':{'type':_0x3d1a('0x0'),'required':!![]},'membername':{'type':_0x3d1a('0x0'),'required':!![]},'penalty':{'type':_0x3d1a('0x1'),'required':![]},'paused':{'type':_0x3d1a('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x3d1a('0x0'),'required':!![]}};exports[_0x3d1a('0x3')]={'interface':{'type':_0x3d1a('0x0'),'required':!![]},'paused':{'type':_0x3d1a('0x2')},'reason':{'type':_0x3d1a('0x0'),'required':![]}};exports[_0x3d1a('0x4')]={'module':{'type':_0x3d1a('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x3d1a('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x3d1a('0x0'),'required':!![]},'filename':{'type':_0x3d1a('0x0')},'format':{'type':_0x3d1a('0x0')},'mixmonitorid':{'type':'string'}};exports[_0x3d1a('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x3d1a('0x6')]={'uniqueid':{'type':_0x3d1a('0x0'),'required':!![]},'exten':{'type':_0x3d1a('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x1600=['string','number','boolean','queueremove','reload','voicechannel'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x1600,0x174));var _0x0160=function(_0x5311ea,_0x5d9796){_0x5311ea=_0x5311ea-0x0;var _0x3e7726=_0x1600[_0x5311ea];return _0x3e7726;};'use strict';exports['queueadd']={'queue':{'type':_0x0160('0x0'),'required':!![]},'interface':{'type':_0x0160('0x0'),'required':!![]},'membername':{'type':_0x0160('0x0'),'required':!![]},'penalty':{'type':_0x0160('0x1'),'required':![]},'paused':{'type':_0x0160('0x2'),'required':![]}};exports[_0x0160('0x3')]={'queue':{'type':_0x0160('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x0160('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x0160('0x0'),'required':![]}};exports[_0x0160('0x4')]={'module':{'type':_0x0160('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x0160('0x0'),'required':!![]}};exports[_0x0160('0x5')]={'uniqueid':{'type':_0x0160('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x0160('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0160('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x0160('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 4b2338a..2e38d35 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x562fdb,_0x5684bb){var _0x318876=function(_0xcd34d9){while(--_0xcd34d9){_0x562fdb['push'](_0x562fdb['shift']());}};_0x318876(++_0x5684bb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x23fe6d,_0x4ec422){_0x23fe6d=_0x23fe6d-0x0;var _0x3854c0=_0x5f2f[_0x23fe6d];return _0x3854c0;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x16155b,_0x327ce6){var _0xffdd06=function(_0x16dccc){while(--_0x16dccc){_0x16155b['push'](_0x16155b['shift']());}};_0xffdd06(++_0x327ce6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ad9b4,_0x5df9ed){_0x1ad9b4=_0x1ad9b4-0x0;var _0xbbee74=_0xb10b[_0x1ad9b4];return _0xbbee74;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 5eac97c..3659197 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53dd=['hasOwnProperty'];(function(_0x258862,_0x24f1f8){var _0x14e744=function(_0x5bdc56){while(--_0x5bdc56){_0x258862['push'](_0x258862['shift']());}};_0x14e744(++_0x24f1f8);}(_0x53dd,0x1e7));var _0xd53d=function(_0x23f9a2,_0x30eef5){_0x23f9a2=_0x23f9a2-0x0;var _0x3b9c50=_0x53dd[_0x23f9a2];return _0x3b9c50;};'use strict';function mergeDBDataToRealtime(_0x43eb8c,_0x1e0e52){var _0x15ebd1=Object['assign']({},_0x43eb8c);for(var _0x2c3b31 in _0x1e0e52){if(_0x15ebd1[_0xd53d('0x0')](_0x2c3b31)){_0x15ebd1[_0x2c3b31]=_0x1e0e52[_0x2c3b31];}}return _0x15ebd1;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xa651=['hasOwnProperty'];(function(_0x450095,_0x46c13e){var _0x37cabc=function(_0x68defb){while(--_0x68defb){_0x450095['push'](_0x450095['shift']());}};_0x37cabc(++_0x46c13e);}(_0xa651,0xfb));var _0x1a65=function(_0x254bbe,_0x44612d){_0x254bbe=_0x254bbe-0x0;var _0x42aae4=_0xa651[_0x254bbe];return _0x42aae4;};'use strict';function mergeDBDataToRealtime(_0x49bf92,_0x17b170){var _0x48fcd3=Object['assign']({},_0x49bf92);for(var _0x2e66b9 in _0x17b170){if(_0x48fcd3[_0x1a65('0x0')](_0x2e66b9)){_0x48fcd3[_0x2e66b9]=_0x17b170[_0x2e66b9];}}return _0x48fcd3;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b9f9f1d..61101f7 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 _0xa3d2=['xcally-motion-dialer','forEach','Local','substring','indexOf','mobile','phone','transfererlinkedid','attendedTransfer','lodash','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','agents','telephones','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','prototype','find','accountcode','isNil','name','interface','format','length','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','uniqueid','blindTransfer','linkedid','getCallType','UserId','monitor','monitors','monitorFilename','filename','connectedlinename','membername'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0xa3d2,0x11a));var _0x2a3d=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0xa3d2[_0x4164f2];return _0x2575c7;};'use strict';var _=require(_0x2a3d('0x0'));var moment=require('moment');var util=require(_0x2a3d('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x2a3d('0x2'));var RpcVoiceCallReport=require(_0x2a3d('0x3'));var RpcVoiceDialReport=require(_0x2a3d('0x4'));var RpcMemberReport=require(_0x2a3d('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x2a3d('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2a3d('0x7'));var VoiceDialReport=require(_0x2a3d('0x8'));var UserReport=require('./userReport');function Report(_0x40268b){this['realtime']=_0x40268b;this['agents']=_0x40268b[_0x2a3d('0x9')];this[_0x2a3d('0xa')]=_0x40268b[_0x2a3d('0xa')];}Report['prototype']['sync']=function(_0x5ce405){var _0x570c38=new VoiceQueueReport(this[_0x2a3d('0xb')]);var _0x3c0524=new VoiceAgentReport(this[_0x2a3d('0xb')]);var _0xded9be=new VoiceDialReport(this[_0x2a3d('0xb')]);var _0x1a36ce=new VoiceCallReport(this[_0x2a3d('0xb')]);var _0x69730a=new UserReport(this['realtime']);if(config[_0x2a3d('0xc')]&&config[_0x2a3d('0xc')][_0x2a3d('0xd')]){ami['on'](_0x2a3d('0xe'),this[_0x2a3d('0xf')]['bind'](this));ami['on'](_0x2a3d('0x10'),this[_0x2a3d('0x11')][_0x2a3d('0x12')](this));ami['on'](_0x2a3d('0x13'),this[_0x2a3d('0x14')][_0x2a3d('0x12')](this));ami['on'](_0x2a3d('0x15'),this[_0x2a3d('0x16')]['bind'](this));ami['on'](_0x2a3d('0x17'),this['blindTransfer'][_0x2a3d('0x12')](this));ami['on'](_0x2a3d('0x18'),this['attendedTransfer'][_0x2a3d('0x12')](this));}};Report[_0x2a3d('0x19')]['findAgent']=function(_0xb1726b){var _0x43809d;_0x43809d=_[_0x2a3d('0x1a')](this[_0x2a3d('0x9')],function(_0x418230){return _0x418230[_0x2a3d('0x1b')]==_0xb1726b||_0x418230['name']==_0xb1726b;});if(_[_0x2a3d('0x1c')](_0x43809d)){var _0x43e43a=_[_0x2a3d('0x1a')](this['telephones'],function(_0x410bdf){return _0x410bdf[_0x2a3d('0x1b')]==_0xb1726b||_0x410bdf[_0x2a3d('0x1d')]==_0xb1726b;});if(_0x43e43a){_0x43809d=_[_0x2a3d('0x1a')](this[_0x2a3d('0x9')],function(_0x1293f5){return _0x1293f5[_0x2a3d('0x1e')]==util[_0x2a3d('0x1f')]('SIP/%s',_0x43e43a[_0x2a3d('0x1d')]);});}}return _0x43809d;};Report['prototype']['voiceQueueReport']=function(_0x586d4f){for(var _0x28ab86=0x0;_0x28ab86<_0x586d4f[_0x2a3d('0x20')];_0x28ab86+=0x1){var _0x51bf31=this[_0x2a3d('0x21')](_0x586d4f[_0x28ab86][_0x2a3d('0x22')]);if(_0x51bf31){_0x586d4f[_0x28ab86][_0x2a3d('0x1b')]=_0x51bf31[_0x2a3d('0x1b')];_0x586d4f[_0x28ab86][_0x2a3d('0x23')]=!![];_0x586d4f[_0x28ab86][_0x2a3d('0x24')]=_0x51bf31[_0x2a3d('0x1d')];_0x586d4f[_0x28ab86]['interface']=_['isNil'](_0x51bf31[_0x2a3d('0x1e')])?util['format'](_0x2a3d('0x25'),_0x51bf31['name']):_0x51bf31[_0x2a3d('0x1e')];if(_0x586d4f[_0x28ab86][_0x2a3d('0x26')]){_0x586d4f[_0x28ab86][_0x2a3d('0x27')]=moment()['format'](_0x2a3d('0x28'));}if(_0x586d4f[_0x28ab86][_0x2a3d('0x29')]){_0x586d4f[_0x28ab86][_0x2a3d('0x2a')]=moment()[_0x2a3d('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x586d4f[_0x28ab86]);}RpcVoiceQueueReport[_0x2a3d('0x2b')](_0x586d4f[_0x28ab86]);}};function extractCalleridNumber(_0x230394){var _0x4a87a7=_0x230394[_0x2a3d('0x2c')](/<(.*?)>/);return _0x4a87a7?_0x4a87a7[0x1]:_0x230394;}Report['prototype'][_0x2a3d('0x2d')]=function(_0x28eb2f){for(var _0x478b48=0x0;_0x478b48','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername'];(function(_0x304708,_0x243f40){var _0x5ea96e=function(_0xdbbdaf){while(--_0xdbbdaf){_0x304708['push'](_0x304708['shift']());}};_0x5ea96e(++_0x243f40);}(_0xfe7f,0x132));var _0xffe7=function(_0x2520eb,_0x54c6b3){_0x2520eb=_0x2520eb-0x0;var _0x3ca1b6=_0xfe7f[_0x2520eb];return _0x3ca1b6;};'use strict';var _=require(_0xffe7('0x0'));var moment=require(_0xffe7('0x1'));var util=require(_0xffe7('0x2'));var config=require(_0xffe7('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xffe7('0x4'));var RpcVoiceCallReport=require(_0xffe7('0x5'));var RpcVoiceDialReport=require(_0xffe7('0x6'));var RpcMemberReport=require(_0xffe7('0x7'));var RpcVoiceQueueReport=require(_0xffe7('0x8'));var RpcVoiceRecording=require(_0xffe7('0x9'));var RpcVoiceTransferReport=require(_0xffe7('0xa'));var VoiceQueueReport=require(_0xffe7('0xb'));var VoiceCallReport=require(_0xffe7('0xc'));var VoiceAgentReport=require(_0xffe7('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0xa7fdbd){this['realtime']=_0xa7fdbd;this[_0xffe7('0xe')]=_0xa7fdbd['agents'];this[_0xffe7('0xf')]=_0xa7fdbd['telephones'];}Report['prototype'][_0xffe7('0x10')]=function(_0x470e9f){var _0x13077f=new VoiceQueueReport(this['realtime']);var _0x9f64a7=new VoiceAgentReport(this['realtime']);var _0x4be8fe=new VoiceDialReport(this[_0xffe7('0x11')]);var _0x25f4e7=new VoiceCallReport(this[_0xffe7('0x11')]);var _0x10a123=new UserReport(this['realtime']);if(config[_0xffe7('0x12')]&&config['xdr'][_0xffe7('0x13')]){ami['on'](_0xffe7('0x14'),this[_0xffe7('0x15')]['bind'](this));ami['on'](_0xffe7('0x16'),this[_0xffe7('0x17')]['bind'](this));ami['on'](_0xffe7('0x18'),this[_0xffe7('0x19')][_0xffe7('0x1a')](this));ami['on'](_0xffe7('0x1b'),this['voiceDialReport'][_0xffe7('0x1a')](this));ami['on'](_0xffe7('0x1c'),this['blindTransfer'][_0xffe7('0x1a')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xffe7('0x1a')](this));}};Report[_0xffe7('0x1d')][_0xffe7('0x1e')]=function(_0x21a8a5){var _0x2442c9;_0x2442c9=_['find'](this[_0xffe7('0xe')],function(_0x40ec27){return _0x40ec27[_0xffe7('0x1f')]==_0x21a8a5||_0x40ec27[_0xffe7('0x20')]==_0x21a8a5;});if(_[_0xffe7('0x21')](_0x2442c9)){var _0x398cde=_[_0xffe7('0x22')](this[_0xffe7('0xf')],function(_0xb14f92){return _0xb14f92[_0xffe7('0x1f')]==_0x21a8a5||_0xb14f92[_0xffe7('0x20')]==_0x21a8a5;});if(_0x398cde){_0x2442c9=_['find'](this[_0xffe7('0xe')],function(_0x75df5){return _0x75df5['interface']==util[_0xffe7('0x23')]('SIP/%s',_0x398cde[_0xffe7('0x20')]);});}}return _0x2442c9;};Report[_0xffe7('0x1d')]['voiceQueueReport']=function(_0x300bbc){for(var _0x41a5ac=0x0;_0x41a5ac<_0x300bbc[_0xffe7('0x24')];_0x41a5ac+=0x1){var _0x58785f=this['findAgent'](_0x300bbc[_0x41a5ac][_0xffe7('0x25')]);if(_0x58785f){_0x300bbc[_0x41a5ac][_0xffe7('0x1f')]=_0x58785f[_0xffe7('0x1f')];_0x300bbc[_0x41a5ac][_0xffe7('0x26')]=!![];_0x300bbc[_0x41a5ac][_0xffe7('0x27')]=_0x58785f[_0xffe7('0x20')];_0x300bbc[_0x41a5ac][_0xffe7('0x28')]=_['isNil'](_0x58785f[_0xffe7('0x28')])?util[_0xffe7('0x23')](_0xffe7('0x29'),_0x58785f[_0xffe7('0x20')]):_0x58785f[_0xffe7('0x28')];if(_0x300bbc[_0x41a5ac][_0xffe7('0x2a')]){_0x300bbc[_0x41a5ac][_0xffe7('0x2b')]=moment()['format'](_0xffe7('0x2c'));}if(_0x300bbc[_0x41a5ac]['queuecallerexit']){_0x300bbc[_0x41a5ac][_0xffe7('0x2d')]=moment()[_0xffe7('0x23')](_0xffe7('0x2c'));}RpcMemberReport[_0xffe7('0x15')](_0x300bbc[_0x41a5ac]);}RpcVoiceQueueReport[_0xffe7('0x2e')](_0x300bbc[_0x41a5ac]);}};function extractCalleridNumber(_0x11d9e2){var _0x32917f=_0x11d9e2[_0xffe7('0x2f')](/<(.*?)>/);return _0x32917f?_0x32917f[0x1]:_0x11d9e2;}Report[_0xffe7('0x1d')][_0xffe7('0x30')]=function(_0x1cff98){for(var _0x12b239=0x0;_0x12b2390x0?!![]:![];if(!_0x799ebb){return this[_0x3011('0x1a')](this['summary'][_0x3011('0x6f')]);}};VoiceQueueReport[_0x3011('0xc')]['syncQueueMember']=function(_0x3bf6f8){var _0x353635=this[_0x3011('0x4d')]['id'];if(this[_0x3011('0x4d')][_0x3011('0x68')][_0x353635]&&this['summary']['queuestatus'][_0x353635][_0x3bf6f8[_0x3011('0x67')]]){this[_0x3011('0x4d')][_0x3011('0x68')][_0x353635][_0x3bf6f8[_0x3011('0x67')]][_0x3011('0x12')][_0x3011('0x70')](_0x3bf6f8);}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x71')]=function(_0x4b1662){var _0x4512ad=this;try{if(this[_0x3011('0x63')](_0x4b1662)&&this[_0x3011('0x63')](_0x4b1662[_0x3011('0x55')])){logger['debug'](_0x3011('0x72'),util[_0x3011('0x48')](_0x4b1662,{'showHidden':![],'depth':null}));var _0x120c65=this[_0x3011('0x14')][_0x4b1662[_0x3011('0x55')]];if(_0x120c65){logger[_0x3011('0x5f')](_0x3011('0x73'),_0x120c65[_0x3011('0x61')]);this[_0x3011('0x4d')][_0x3011('0x65')][_0x120c65[_0x3011('0x61')]]={'summaryEvent':_0x4b1662};this[_0x3011('0x4d')][_0x3011('0x6e')]+=0x1;return ami['Action']({'action':_0x3011('0x68'),'queue':_0x120c65[_0x3011('0x61')]})[_0x3011('0x74')](function(_0x28ec9e){if(!_0x4512ad['summary'][_0x3011('0x68')][_0x4b1662[_0x3011('0x67')]]){_0x4512ad[_0x3011('0x4d')][_0x3011('0x68')][_0x4b1662[_0x3011('0x67')]]={};}_0x4512ad[_0x3011('0x4d')][_0x3011('0x68')][_0x4b1662['actionid']][_0x28ec9e['actionid']]={'queue':_0x120c65[_0x3011('0x61')],'agents':[]};})[_0x3011('0x43')](function(_0x5af8b5){throw _0x5af8b5;});}}}catch(_0x525cb9){logger[_0x3011('0x46')](_0x3011('0x75'),util[_0x3011('0x48')](_0x525cb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')]['syncQueueSummaryComplete']=function(_0x129a89){if(this[_0x3011('0x4d')][_0x3011('0x6e')]>0x0){this[_0x3011('0x4d')]['completeEvent']=_0x129a89;return;}logger[_0x3011('0x5f')](_0x3011('0x76'),util[_0x3011('0x48')](_0x129a89,{'showHidden':![],'depth':null}));this[_0x3011('0x4d')]=initializeSummary();ami['emit'](_0x3011('0x77'),{});};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x78')]=function(_0x841c3a){try{if(this[_0x3011('0x63')](_0x841c3a)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x841c3a['uniqueid'],util[_0x3011('0x48')](_0x841c3a,{'showHidden':![],'depth':null}));if(_[_0x3011('0x64')](this['queueReports'][_0x841c3a[_0x3011('0x53')]])){this[_0x3011('0x10')][_0x841c3a['uniqueid']]=[];}if(_[_0x3011('0x64')](this[_0x3011('0x13')][_0x841c3a[_0x3011('0x53')]])){this['channels'][_0x841c3a[_0x3011('0x53')]]={};}var _0x5b85e2=new QueueReport();_0x5b85e2[_0x3011('0x55')]=_0x841c3a[_0x3011('0x55')];_0x5b85e2[_0x3011('0x5d')]=this[_0x3011('0x14')][_0x5b85e2['queue']]&&this['voiceQueues'][_0x5b85e2[_0x3011('0x55')]][_0x3011('0x5d')]?this[_0x3011('0x14')][_0x5b85e2[_0x3011('0x55')]][_0x3011('0x5d')]||'inbound':_0x3011('0x5e');_0x5b85e2[_0x3011('0x79')]=moment()[_0x3011('0x60')](_0x3011('0x7a'));_0x5b85e2[_0x3011('0x7b')]=_0x841c3a[_0x3011('0x7b')];_0x5b85e2[_0x3011('0x7c')]=_0x841c3a['count'];_0x5b85e2[_0x3011('0x53')]=_0x841c3a[_0x3011('0x53')];_0x5b85e2[_0x3011('0x7d')]=this['channels'][_0x841c3a[_0x3011('0x53')]][_0x3011('0x7d')];logger[_0x3011('0x7e')](_0x3011('0x7f'),_0x5b85e2[_0x3011('0x55')],_0x5b85e2['type']);Object['assign'](_0x5b85e2,_[_0x3011('0x80')](_0x841c3a,_['keys'](_0x5b85e2)));this[_0x3011('0x10')][_0x841c3a[_0x3011('0x53')]]['push'](_0x5b85e2);this[_0x3011('0x13')][_0x841c3a[_0x3011('0x53')]]=_0x5b85e2;this[_0x3011('0x51')](_0x5b85e2,_0x3011('0x1e'));}}catch(_0x5b5778){logger[_0x3011('0x46')](_0x3011('0x81'),_0x841c3a[_0x3011('0x53')],util[_0x3011('0x48')](_0x5b5778,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x20')]=function(_0x5b1cf7){try{if(this[_0x3011('0x63')](_0x5b1cf7)){logger[_0x3011('0x5f')](_0x3011('0x82'),_0x5b1cf7['uniqueid'],util[_0x3011('0x48')](_0x5b1cf7,{'showHidden':![],'depth':null}));if(this[_0x3011('0x10')][_0x5b1cf7['uniqueid']]){var _0x366364=_[_0x3011('0x83')](this['queueReports'][_0x5b1cf7[_0x3011('0x53')]]);_0x366364[_0x3011('0x84')]=![];_0x366364[_0x3011('0x85')]=null;_0x366364['holdtime']=_0x5b1cf7[_0x3011('0x86')];_0x366364[_0x3011('0x87')]=_0x5b1cf7[_0x3011('0x87')];_0x366364[_0x3011('0x1f')]=!![];_0x366364[_0x3011('0x88')]=moment()[_0x3011('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x366364['queuecallerexitreason']=_0x3011('0x89');_0x366364[_0x3011('0x8a')]=null;logger[_0x3011('0x7e')](_0x3011('0x8b'),_0x366364[_0x3011('0x55')],_0x366364[_0x3011('0x5d')]);this[_0x3011('0x13')][_0x5b1cf7[_0x3011('0x53')]]=_0x366364;this[_0x3011('0x4e')](_0x366364,'queuecallerabandon');}}}catch(_0x5cb3ab){logger[_0x3011('0x46')](_0x3011('0x82'),_0x5b1cf7[_0x3011('0x53')],util[_0x3011('0x48')](_0x5cb3ab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x22')]=function(_0x4abaff){try{if(this[_0x3011('0x63')](_0x4abaff)){logger[_0x3011('0x5f')](_0x3011('0x8c'),_0x4abaff[_0x3011('0x53')],util['inspect'](_0x4abaff,{'showHidden':![],'depth':null}));if(this[_0x3011('0x10')][_0x4abaff[_0x3011('0x53')]]){var _0x2bd38e=_[_0x3011('0x83')](this[_0x3011('0x10')][_0x4abaff[_0x3011('0x53')]]);_0x2bd38e[_0x3011('0x8d')]=moment()[_0x3011('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bd38e[_0x3011('0x8e')]=_0x4abaff[_0x3011('0x8e')];_0x2bd38e[_0x3011('0x8f')]=_0x4abaff[_0x3011('0x8f')];logger[_0x3011('0x7e')](_0x3011('0x90'),_0x2bd38e[_0x3011('0x55')],_0x2bd38e[_0x3011('0x5d')],_0x4abaff[_0x3011('0x8e')],_0x4abaff[_0x3011('0x8f')]);this[_0x3011('0x13')][_0x4abaff['uniqueid']]=_0x2bd38e;this[_0x3011('0x51')](_0x2bd38e,_0x3011('0x21'));}}}catch(_0x2e3f35){logger[_0x3011('0x46')]('[%s][voiceQueueReport][queuecallerleave]',_0x4abaff[_0x3011('0x53')],util[_0x3011('0x48')](_0x2e3f35,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0x25')]=function(_0x1526b6){try{if(this[_0x3011('0x63')](_0x1526b6)){logger[_0x3011('0x5f')](_0x3011('0x91'),_0x1526b6[_0x3011('0x53')],util[_0x3011('0x48')](_0x1526b6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1526b6['uniqueid']]){var _0x3d684a=_[_0x3011('0x83')](this[_0x3011('0x10')][_0x1526b6[_0x3011('0x53')]]);_0x3d684a[_0x3011('0x84')]=!![];_0x3d684a[_0x3011('0x59')]=_0x3011('0x92');logger[_0x3011('0x7e')](_0x3011('0x93'),_0x3d684a[_0x3011('0x55')],_0x3d684a['type']);}}}catch(_0x2a1dc0){logger[_0x3011('0x46')](_0x3011('0x91'),_0x1526b6[_0x3011('0x53')],util[_0x3011('0x48')](_0x2a1dc0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3011('0x94')]=function(_0x2fdbdb){try{if(this[_0x3011('0x63')](_0x2fdbdb)){logger[_0x3011('0x5f')](_0x3011('0x95'),_0x2fdbdb[_0x3011('0x53')],util[_0x3011('0x48')](_0x2fdbdb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2fdbdb[_0x3011('0x53')]]){var _0x1118f5=_[_0x3011('0x83')](this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0x53')]]);_0x1118f5[_0x3011('0x1f')]=![];_0x1118f5[_0x3011('0x88')]=null;_0x1118f5[_0x3011('0x96')]=!![];_0x1118f5[_0x3011('0x8a')]=_0x2fdbdb[_0x3011('0x97')];_0x1118f5['holdtime']=_0x2fdbdb[_0x3011('0x86')];_0x1118f5['queuecallercomplete']=!![];_0x1118f5['queuecallerexit']=![];_0x1118f5[_0x3011('0x98')]=null;if(!_0x1118f5[_0x3011('0x99')]){if(_0x2fdbdb[_0x3011('0x9a')]==_0x3011('0x99')){_0x1118f5[_0x3011('0x59')]=_0x3011('0x9b');logger['info'](_0x3011('0x9c'),_0x1118f5[_0x3011('0x55')],_0x1118f5[_0x3011('0x5d')]);}else{if(_[_0x3011('0x9d')](_0x2fdbdb[_0x3011('0x42')][_0x3011('0x9e')](),_0x3011('0x9f'))){if(this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0xa0')]]){var _0x19e5d5=_[_0x3011('0x83')](this['queueReports'][_0x2fdbdb[_0x3011('0xa0')]]);_0x19e5d5[_0x3011('0x84')]=![];_0x19e5d5[_0x3011('0x3b')]=!![];_0x19e5d5[_0x3011('0x98')]=moment(_0x1118f5[_0x3011('0x79')])[_0x3011('0xa1')](_0x2fdbdb[_0x3011('0x86')],_0x3011('0xa2'))[_0x3011('0x60')](_0x3011('0x7a'));_0x19e5d5[_0x3011('0x59')]='FORWARDTRANSFER';_0x19e5d5[_0x3011('0x99')]=!![];_0x19e5d5[_0x3011('0xa3')]=_0x3011('0xa4');_0x19e5d5[_0x3011('0xa5')]=_0x2fdbdb[_0x3011('0xa6')];_0x19e5d5['transferuniqueid']=_0x2fdbdb[_0x3011('0x53')];logger[_0x3011('0x7e')](_0x3011('0xa7'),_0x19e5d5['queue'],_0x19e5d5[_0x3011('0x5d')]);var _0xe588d0=this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0xa0')]];this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0xa0')]]=this['queueReports'][_0x2fdbdb[_0x3011('0x53')]];this[_0x3011('0x10')][_0x2fdbdb[_0x3011('0x53')]]=_0xe588d0;}}else{_0x1118f5['queuecallerexitreason']='COMPLETEDBY'+_0x2fdbdb[_0x3011('0x9a')]['toUpperCase']();logger[_0x3011('0x7e')](_0x3011('0xa8'),_0x1118f5[_0x3011('0x55')],_0x1118f5[_0x3011('0x5d')],_0x1118f5[_0x3011('0x59')]);}}}this[_0x3011('0x13')][_0x2fdbdb[_0x3011('0x53')]]=_0x1118f5;}}}catch(_0xfb6317){logger[_0x3011('0x46')](_0x3011('0x95'),_0x2fdbdb['uniqueid'],util[_0x3011('0x48')](_0xfb6317,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0xa9')]=function(_0x13013a){try{if(this[_0x3011('0x63')](_0x13013a)){logger[_0x3011('0x5f')](_0x3011('0xaa'),_0x13013a[_0x3011('0x53')],util[_0x3011('0x48')](_0x13013a,{'showHidden':![],'depth':null}));this['addVariable'](_0x13013a[_0x3011('0x53')],_['keys'](_0x13013a[_0x3011('0xab')])[0x0],_0x13013a['value']);if(this['queueReports'][_0x13013a[_0x3011('0x53')]]){var _0x204279=_[_0x3011('0x83')](this[_0x3011('0x10')][_0x13013a[_0x3011('0x53')]]);if(_0x204279){if(this[_0x3011('0x63')](_0x13013a['variable'])&&this[_0x3011('0x63')](_0x13013a['variable'][_0x3011('0x68')])){switch(_0x13013a[_0x3011('0xac')]){case'CONTINUE':_0x204279[_0x3011('0x3b')]=![];_0x204279[_0x3011('0x98')]=null;break;case _0x3011('0xad'):_0x204279[_0x3011('0xae')]=_0x3011('0xaf');_0x204279[_0x3011('0x3b')]=!![];_0x204279[_0x3011('0x98')]=moment()[_0x3011('0x60')](_0x3011('0x7a'));_0x204279[_0x3011('0x8d')]=moment()[_0x3011('0x60')](_0x3011('0x7a'));logger[_0x3011('0x5f')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x13013a[_0x3011('0x53')],util['inspect'](_0x204279,{'showHidden':![],'depth':null}));ami['emit'](_0x3011('0xb0'),_0x204279);break;default:_0x204279[_0x3011('0x3b')]=!![];_0x204279['queuecallerexitAt']=moment()[_0x3011('0x60')](_0x3011('0x7a'));_0x204279['queuecallerleaveAt']=moment()[_0x3011('0x60')]('YYYY-MM-DD\x20HH:mm:ss');}_0x204279[_0x3011('0x1f')]=![];_0x204279[_0x3011('0x88')]=null;_0x204279['queuecallerexitreason']=_0x13013a[_0x3011('0xac')];this[_0x3011('0x13')][_0x13013a[_0x3011('0x53')]]=_0x204279;this[_0x3011('0x4e')](_0x204279,_0x3011('0x26'));}else if(this[_0x3011('0x63')](_0x13013a[_0x3011('0xab')])&&this[_0x3011('0x63')](_0x13013a[_0x3011('0xab')][_0x3011('0xb1')])){if(!_0x204279[_0x3011('0x1f')]){_0x204279[_0x3011('0x3b')]=!![];_0x204279[_0x3011('0x98')]=moment()['format'](_0x3011('0x7a'));_0x204279[_0x3011('0x59')]=_0x3011('0xb2');_0x204279[_0x3011('0x8d')]=moment()['format'](_0x3011('0x7a'));this['channels'][_0x13013a[_0x3011('0x53')]]=_0x204279;}}logger[_0x3011('0x7e')](_0x3011('0xb3'),_0x13013a['uniqueid'],_0x204279[_0x3011('0x55')],_0x204279[_0x3011('0x5d')],_[_0x3011('0xb4')](_0x13013a[_0x3011('0xab')])[0x0],_0x13013a[_0x3011('0xac')]);_0x204279[_0x3011('0x16')]=this[_0x3011('0x16')][_0x13013a[_0x3011('0x53')]];}}}}catch(_0xcede8d){logger[_0x3011('0x46')](_0x3011('0xaa'),_0x13013a[_0x3011('0x53')],util['inspect'](_0xcede8d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0xb5')]=function(_0x5a3ff8,_0x317693,_0x441de5){var _0x45d160=[_0x3011('0xb6'),_0x3011('0xb7'),'rtpaudioqosjitter',_0x3011('0xb8'),_0x3011('0xb9'),_0x3011('0xba'),'rtpaudioqosrtt',_0x3011('0xbb'),_0x3011('0xbc'),'sipuri',_0x3011('0xbd'),_0x3011('0xbe'),_0x3011('0xbf'),_0x3011('0xc0'),_0x3011('0xc1'),_0x3011('0xc2'),_0x3011('0x97'),_0x3011('0xc3'),_0x3011('0xc4')];if(!_['isNil'](_0x317693)&&!_[_0x3011('0xc5')](_0x45d160,_0x317693)){if(_[_0x3011('0x64')](this[_0x3011('0x16')][_0x5a3ff8])){this[_0x3011('0x16')][_0x5a3ff8]={};}this[_0x3011('0x16')][_0x5a3ff8][_0x317693]=_0x441de5;}};VoiceQueueReport[_0x3011('0xc')][_0x3011('0xc6')]=function(_0x12aab8,_0x1fd072,_0x4f912b){try{var _0x2fc6ea={};if(this[_0x3011('0x10')][_0x12aab8]){for(var _0x4afddd=0x0;_0x4afddd0x0?!![]:![];if(!_0x5c51cb){return this[_0x9f20('0x1a')](this['summary'][_0x9f20('0x75')]);}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x1c')]=function(_0x12e57f){var _0x34777a=this[_0x9f20('0x4d')]['id'];if(this[_0x9f20('0x4d')][_0x9f20('0x71')][_0x34777a]&&this['summary'][_0x9f20('0x71')][_0x34777a][_0x12e57f[_0x9f20('0x68')]]){this[_0x9f20('0x4d')][_0x9f20('0x71')][_0x34777a][_0x12e57f[_0x9f20('0x68')]][_0x9f20('0x12')][_0x9f20('0x76')](_0x12e57f);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x57764d){var _0x8a5f64=this;try{if(this['isNotNull'](_0x57764d)&&this[_0x9f20('0x77')](_0x57764d[_0x9f20('0x56')])){logger[_0x9f20('0x51')](_0x9f20('0x78'),util[_0x9f20('0x46')](_0x57764d,{'showHidden':![],'depth':null}));var _0x305ae4=this[_0x9f20('0x14')][_0x57764d[_0x9f20('0x56')]];if(_0x305ae4){logger[_0x9f20('0x51')](_0x9f20('0x79'),_0x305ae4[_0x9f20('0x61')]);this[_0x9f20('0x4d')][_0x9f20('0x64')][_0x305ae4[_0x9f20('0x61')]]={'summaryEvent':_0x57764d};this['summary'][_0x9f20('0x74')]+=0x1;return ami[_0x9f20('0x41')]({'action':'queuestatus','queue':_0x305ae4[_0x9f20('0x61')]})[_0x9f20('0x67')](function(_0x3c3332){if(!_0x8a5f64[_0x9f20('0x4d')][_0x9f20('0x71')][_0x57764d[_0x9f20('0x68')]]){_0x8a5f64[_0x9f20('0x4d')][_0x9f20('0x71')][_0x57764d[_0x9f20('0x68')]]={};}_0x8a5f64['summary'][_0x9f20('0x71')][_0x57764d['actionid']][_0x3c3332['actionid']]={'queue':_0x305ae4[_0x9f20('0x61')],'agents':[]};})[_0x9f20('0x43')](function(_0x561fe5){throw _0x561fe5;});}}}catch(_0x42ba72){logger[_0x9f20('0x47')]('[voiceQueueReport][queuesummary]',util[_0x9f20('0x46')](_0x42ba72,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x1a')]=function(_0x2f2901){if(this[_0x9f20('0x4d')][_0x9f20('0x74')]>0x0){this[_0x9f20('0x4d')][_0x9f20('0x75')]=_0x2f2901;return;}logger[_0x9f20('0x51')](_0x9f20('0x7a'),util[_0x9f20('0x46')](_0x2f2901,{'showHidden':![],'depth':null}));this[_0x9f20('0x4d')]=initializeSummary();ami['emit'](_0x9f20('0x7b'),{});};VoiceQueueReport['prototype'][_0x9f20('0x20')]=function(_0x50f477){try{if(this[_0x9f20('0x77')](_0x50f477)){logger[_0x9f20('0x51')](_0x9f20('0x7c'),_0x50f477[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x50f477,{'showHidden':![],'depth':null}));if(_[_0x9f20('0x63')](this[_0x9f20('0x11')][_0x50f477[_0x9f20('0x54')]])){this[_0x9f20('0x11')][_0x50f477[_0x9f20('0x54')]]=[];}if(_[_0x9f20('0x63')](this['channels'][_0x50f477[_0x9f20('0x54')]])){this['channels'][_0x50f477[_0x9f20('0x54')]]={};}var _0x2b686d=new QueueReport();_0x2b686d['queue']=_0x50f477[_0x9f20('0x56')];_0x2b686d['type']=this[_0x9f20('0x14')][_0x2b686d['queue']]&&this[_0x9f20('0x14')][_0x2b686d[_0x9f20('0x56')]]['type']?this[_0x9f20('0x14')][_0x2b686d['queue']][_0x9f20('0x5e')]||_0x9f20('0x5f'):_0x9f20('0x5f');_0x2b686d[_0x9f20('0x7d')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));_0x2b686d['position']=_0x50f477[_0x9f20('0x80')];_0x2b686d[_0x9f20('0x81')]=_0x50f477[_0x9f20('0x81')];_0x2b686d['uniqueid']=_0x50f477[_0x9f20('0x54')];_0x2b686d[_0x9f20('0x82')]=this['channels'][_0x50f477[_0x9f20('0x54')]][_0x9f20('0x82')];logger[_0x9f20('0x83')](_0x9f20('0x84'),_0x2b686d[_0x9f20('0x56')],_0x2b686d[_0x9f20('0x5e')]);Object[_0x9f20('0x6f')](_0x2b686d,_['pick'](_0x50f477,_[_0x9f20('0x85')](_0x2b686d)));this[_0x9f20('0x11')][_0x50f477['uniqueid']][_0x9f20('0x76')](_0x2b686d);this[_0x9f20('0x13')][_0x50f477[_0x9f20('0x54')]]=_0x2b686d;this[_0x9f20('0x86')](_0x2b686d,_0x9f20('0x1f'));}}catch(_0x481dd1){logger[_0x9f20('0x47')]('[%s][voiceQueueReport][queuecallerjoin]',_0x50f477[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x481dd1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')]['syncQueueCallerAbandon']=function(_0x286af9){try{if(this[_0x9f20('0x77')](_0x286af9)){logger[_0x9f20('0x51')](_0x9f20('0x87'),_0x286af9[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x286af9,{'showHidden':![],'depth':null}));if(this[_0x9f20('0x11')][_0x286af9[_0x9f20('0x54')]]){var _0x36e90c=_[_0x9f20('0x88')](this[_0x9f20('0x11')][_0x286af9['uniqueid']]);_0x36e90c[_0x9f20('0x3e')]=![];_0x36e90c[_0x9f20('0x89')]=null;_0x36e90c['holdtime']=_0x286af9[_0x9f20('0x8a')];_0x36e90c[_0x9f20('0x8b')]=_0x286af9['originalposition'];_0x36e90c[_0x9f20('0x21')]=!![];_0x36e90c[_0x9f20('0x8c')]=moment()[_0x9f20('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x36e90c[_0x9f20('0x5a')]=_0x9f20('0x8d');_0x36e90c[_0x9f20('0x8e')]=null;logger[_0x9f20('0x83')](_0x9f20('0x8f'),_0x36e90c[_0x9f20('0x56')],_0x36e90c[_0x9f20('0x5e')]);this[_0x9f20('0x13')][_0x286af9['uniqueid']]=_0x36e90c;this['emitVoiceQueueChannelRemove'](_0x36e90c,_0x9f20('0x21'));}}}catch(_0x2042aa){logger[_0x9f20('0x47')](_0x9f20('0x87'),_0x286af9[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x2042aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x24')]=function(_0x1db51e){try{if(this['isNotNull'](_0x1db51e)){logger[_0x9f20('0x51')](_0x9f20('0x90'),_0x1db51e[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x1db51e,{'showHidden':![],'depth':null}));if(this[_0x9f20('0x11')][_0x1db51e[_0x9f20('0x54')]]){var _0x2a6b59=_[_0x9f20('0x88')](this[_0x9f20('0x11')][_0x1db51e['uniqueid']]);_0x2a6b59[_0x9f20('0x91')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));_0x2a6b59[_0x9f20('0x92')]=_0x1db51e['connectedlinenum'];_0x2a6b59[_0x9f20('0x93')]=_0x1db51e[_0x9f20('0x93')];logger[_0x9f20('0x83')](_0x9f20('0x94'),_0x2a6b59[_0x9f20('0x56')],_0x2a6b59[_0x9f20('0x5e')],_0x1db51e[_0x9f20('0x92')],_0x1db51e[_0x9f20('0x93')]);this[_0x9f20('0x13')][_0x1db51e[_0x9f20('0x54')]]=_0x2a6b59;this[_0x9f20('0x86')](_0x2a6b59,_0x9f20('0x23'));}}}catch(_0x3bb25b){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x1db51e[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x3bb25b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x27')]=function(_0x5cf34c){try{if(this['isNotNull'](_0x5cf34c)){logger[_0x9f20('0x51')](_0x9f20('0x95'),_0x5cf34c[_0x9f20('0x54')],util['inspect'](_0x5cf34c,{'showHidden':![],'depth':null}));if(this[_0x9f20('0x11')][_0x5cf34c[_0x9f20('0x54')]]){var _0x1b7e55=_[_0x9f20('0x88')](this['queueReports'][_0x5cf34c['uniqueid']]);_0x1b7e55[_0x9f20('0x3e')]=!![];_0x1b7e55[_0x9f20('0x5a')]=_0x9f20('0x96');logger[_0x9f20('0x83')](_0x9f20('0x97'),_0x1b7e55[_0x9f20('0x56')],_0x1b7e55[_0x9f20('0x5e')]);}}}catch(_0x414218){logger[_0x9f20('0x47')](_0x9f20('0x95'),_0x5cf34c[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x414218,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x98')]=function(_0x164d13){try{if(this[_0x9f20('0x77')](_0x164d13)){logger[_0x9f20('0x51')](_0x9f20('0x99'),_0x164d13['uniqueid'],util[_0x9f20('0x46')](_0x164d13,{'showHidden':![],'depth':null}));if(this[_0x9f20('0x11')][_0x164d13[_0x9f20('0x54')]]){var _0x4ceb0a=_['last'](this['queueReports'][_0x164d13['uniqueid']]);_0x4ceb0a[_0x9f20('0x21')]=![];_0x4ceb0a[_0x9f20('0x8c')]=null;_0x4ceb0a[_0x9f20('0x9a')]=!![];_0x4ceb0a['lastAssignedTo']=_0x164d13['membername'];_0x4ceb0a[_0x9f20('0x8a')]=_0x164d13[_0x9f20('0x8a')];_0x4ceb0a[_0x9f20('0x3e')]=!![];_0x4ceb0a[_0x9f20('0x3d')]=![];_0x4ceb0a[_0x9f20('0x9b')]=null;if(!_0x4ceb0a[_0x9f20('0x9c')]){if(_0x164d13[_0x9f20('0x9d')]==_0x9f20('0x9c')){_0x4ceb0a[_0x9f20('0x5a')]=_0x9f20('0x9e');logger[_0x9f20('0x83')](_0x9f20('0x9f'),_0x4ceb0a['queue'],_0x4ceb0a[_0x9f20('0x5e')]);}else{if(_[_0x9f20('0xa0')](_0x164d13[_0x9f20('0x42')][_0x9f20('0xa1')](),_0x9f20('0xa2'))){if(this[_0x9f20('0x11')][_0x164d13[_0x9f20('0xa3')]]){var _0x138a94=_[_0x9f20('0x88')](this[_0x9f20('0x11')][_0x164d13[_0x9f20('0xa3')]]);_0x138a94['queuecallercomplete']=![];_0x138a94[_0x9f20('0x3d')]=!![];_0x138a94[_0x9f20('0x9b')]=moment(_0x4ceb0a[_0x9f20('0x7d')])[_0x9f20('0xa4')](_0x164d13[_0x9f20('0x8a')],_0x9f20('0xa5'))[_0x9f20('0x7e')](_0x9f20('0x7f'));_0x138a94['queuecallerexitreason']=_0x9f20('0xa6');_0x138a94['transfer']=!![];_0x138a94[_0x9f20('0xa7')]='FORWARD';_0x138a94[_0x9f20('0xa8')]=_0x164d13['destexten'];_0x138a94[_0x9f20('0xa9')]=_0x164d13[_0x9f20('0x54')];logger[_0x9f20('0x83')](_0x9f20('0xaa'),_0x138a94[_0x9f20('0x56')],_0x138a94[_0x9f20('0x5e')]);var _0x3046ba=this[_0x9f20('0x11')][_0x164d13[_0x9f20('0xa3')]];this[_0x9f20('0x11')][_0x164d13[_0x9f20('0xa3')]]=this['queueReports'][_0x164d13[_0x9f20('0x54')]];this[_0x9f20('0x11')][_0x164d13[_0x9f20('0x54')]]=_0x3046ba;}}else{_0x4ceb0a['queuecallerexitreason']=_0x9f20('0xab')+_0x164d13[_0x9f20('0x9d')][_0x9f20('0xac')]();logger[_0x9f20('0x83')](_0x9f20('0xad'),_0x4ceb0a[_0x9f20('0x56')],_0x4ceb0a[_0x9f20('0x5e')],_0x4ceb0a[_0x9f20('0x5a')]);}}}this[_0x9f20('0x13')][_0x164d13[_0x9f20('0x54')]]=_0x4ceb0a;}}}catch(_0x1cf10c){logger[_0x9f20('0x47')](_0x9f20('0x99'),_0x164d13[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x1cf10c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x29')]=function(_0x326289){try{if(this[_0x9f20('0x77')](_0x326289)){logger[_0x9f20('0x51')](_0x9f20('0xae'),_0x326289[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x326289,{'showHidden':![],'depth':null}));this[_0x9f20('0xaf')](_0x326289[_0x9f20('0x54')],_[_0x9f20('0x85')](_0x326289[_0x9f20('0xb0')])[0x0],_0x326289[_0x9f20('0xb1')]);if(this[_0x9f20('0x11')][_0x326289[_0x9f20('0x54')]]){var _0x85c809=_[_0x9f20('0x88')](this['queueReports'][_0x326289[_0x9f20('0x54')]]);if(_0x85c809){if(this[_0x9f20('0x77')](_0x326289['variable'])&&this[_0x9f20('0x77')](_0x326289[_0x9f20('0xb0')][_0x9f20('0x71')])){switch(_0x326289[_0x9f20('0xb1')]){case _0x9f20('0xb2'):_0x85c809['queuecallerexit']=![];_0x85c809['queuecallerexitAt']=null;break;case _0x9f20('0xb3'):_0x85c809[_0x9f20('0xb4')]=_0x9f20('0xb5');_0x85c809['queuecallerexit']=!![];_0x85c809['queuecallerexitAt']=moment()['format'](_0x9f20('0x7f'));_0x85c809['queuecallerleaveAt']=moment()['format'](_0x9f20('0x7f'));logger[_0x9f20('0x51')](_0x9f20('0xb6'),_0x326289[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x85c809,{'showHidden':![],'depth':null}));ami['emit'](_0x9f20('0xb7'),_0x85c809);break;default:_0x85c809[_0x9f20('0x3d')]=!![];_0x85c809[_0x9f20('0x9b')]=moment()[_0x9f20('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x85c809[_0x9f20('0x91')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));}_0x85c809[_0x9f20('0x21')]=![];_0x85c809['queuecallerabandonAt']=null;_0x85c809['queuecallerexitreason']=_0x326289[_0x9f20('0xb1')];this[_0x9f20('0x13')][_0x326289[_0x9f20('0x54')]]=_0x85c809;this[_0x9f20('0x4e')](_0x85c809,_0x9f20('0x28'));}else if(this[_0x9f20('0x77')](_0x326289[_0x9f20('0xb0')])&&this[_0x9f20('0x77')](_0x326289['variable'][_0x9f20('0xb8')])){if(!_0x85c809['queuecallerabandon']){_0x85c809['queuecallerexit']=!![];_0x85c809[_0x9f20('0x9b')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));_0x85c809[_0x9f20('0x5a')]=_0x9f20('0xb9');_0x85c809[_0x9f20('0x91')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));this[_0x9f20('0x13')][_0x326289['uniqueid']]=_0x85c809;}}logger[_0x9f20('0x83')](_0x9f20('0xba'),_0x326289[_0x9f20('0x54')],_0x85c809['queue'],_0x85c809[_0x9f20('0x5e')],_[_0x9f20('0x85')](_0x326289[_0x9f20('0xb0')])[0x0],_0x326289['value']);_0x85c809[_0x9f20('0x16')]=this[_0x9f20('0x16')][_0x326289[_0x9f20('0x54')]];}}}}catch(_0x167461){logger['error'](_0x9f20('0xae'),_0x326289[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x167461,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0xaf')]=function(_0x4ab093,_0x224004,_0x500018){var _0x52f67d=[_0x9f20('0xbb'),_0x9f20('0xbc'),_0x9f20('0xbd'),_0x9f20('0xbe'),_0x9f20('0xbf'),_0x9f20('0xc0'),_0x9f20('0xc1'),'rtpaudioqosrttbridged',_0x9f20('0xc2'),_0x9f20('0xc3'),_0x9f20('0xc4'),_0x9f20('0xc5'),'membercalls',_0x9f20('0xc6'),_0x9f20('0xc7'),_0x9f20('0xc8'),_0x9f20('0xc9'),_0x9f20('0xca'),'memberrealtime'];if(!_[_0x9f20('0x40')](_0x224004)&&!_[_0x9f20('0xcb')](_0x52f67d,_0x224004)){if(_[_0x9f20('0x63')](this[_0x9f20('0x16')][_0x4ab093])){this[_0x9f20('0x16')][_0x4ab093]={};}this[_0x9f20('0x16')][_0x4ab093][_0x224004]=_0x500018;}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0xcc')]=function(_0x2bc071,_0x59a117,_0x42ec40){try{var _0x87515f={};if(this[_0x9f20('0x11')][_0x2bc071]){for(var _0x421d0d=0x0;_0x421d0d=0x0?moment(_0x56a17d[_0xd3b4('0x1c')])[_0xd3b4('0x10')](_0x56a17d[_0xd3b4('0x1b')],_0xd3b4('0x1d')):null,'data1':'outbound','data2':_0x56a17d[_0xd3b4('0x15')],'data3':_0x56a17d['exten'],'data4':_0x56a17d['dialstring']||null,'role':_0xd3b4('0x1e'),'internal':_0x56a17d[_0xd3b4('0x15')]?_[_0xd3b4('0x16')](_0x56a17d['accountcode']):undefined,'uniqueid':_0x56a17d['uniqueid']},'log':_0xd3b4('0x7')});}; \ No newline at end of file +var _0xb266=['diff','seconds','calleridnum','queue','toNumber','accountcode','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','outbound','exten','dialstring','agent','moment','lodash','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb266,0xdb));var _0x6b26=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb266[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0x6b26('0x0'));var _=require(_0x6b26('0x1'));var util=require('util');var client=require(_0x6b26('0x2'));exports[_0x6b26('0x3')]=function(_0x1ab229){var _0x944b70=_0x1ab229['queuecallercompleteAt']||_0x1ab229[_0x6b26('0x4')];return client[_0x6b26('0x5')]('CreateMemberReport',{'body':{'channel':_0x6b26('0x6'),'membername':_0x1ab229[_0x6b26('0x7')],'interface':_[_0x6b26('0x8')](_0x1ab229['interface'])?util[_0x6b26('0x9')](_0x6b26('0xa'),_0x1ab229[_0x6b26('0x7')]):_0x1ab229[_0x6b26('0xb')],'type':_0x6b26('0xc'),'enterAt':_0x1ab229['queuecallerleaveAt'],'exitAt':_0x944b70,'duration':moment(_0x944b70)[_0x6b26('0xd')](_0x1ab229['queuecallerleaveAt'],_0x6b26('0xe')),'data1':'inbound','data2':_0x1ab229[_0x6b26('0xf')],'data3':_0x1ab229['exten'],'data4':null,'data5':_0x1ab229[_0x6b26('0x10')],'role':'agent','internal':_0x1ab229['accountcode']?_[_0x6b26('0x11')](_0x1ab229[_0x6b26('0x12')]):undefined,'uniqueid':_0x1ab229[_0x6b26('0x13')]},'log':_0x6b26('0x14')});};exports[_0x6b26('0x15')]=function(_0x2dac04){return client['Request'](_0x6b26('0x14'),{'body':{'channel':'voice','membername':_0x2dac04[_0x6b26('0x16')],'interface':_0x2dac04['interface'],'type':_0x6b26('0xc'),'enterAt':_0x2dac04[_0x6b26('0x17')],'exitAt':_0x2dac04[_0x6b26('0x18')],'duration':moment(_0x2dac04[_0x6b26('0x18')])['diff'](_0x2dac04[_0x6b26('0x17')],_0x6b26('0xe'))>=0x0?moment(_0x2dac04[_0x6b26('0x18')])[_0x6b26('0xd')](_0x2dac04[_0x6b26('0x17')],_0x6b26('0xe')):null,'data1':_0x6b26('0x19'),'data2':_0x2dac04['accountcode'],'data3':_0x2dac04[_0x6b26('0x1a')],'data4':_0x2dac04[_0x6b26('0x1b')]||null,'role':_0x6b26('0x1c'),'internal':_0x2dac04[_0x6b26('0x12')]?_[_0x6b26('0x11')](_0x2dac04[_0x6b26('0x12')]):undefined,'uniqueid':_0x2dac04[_0x6b26('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index bbdae7b..b894488 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 _0xefe2=['stopRecordingOnTransfer','GetSettings','../client','getSettings','ShowSetting'];(function(_0x343a44,_0x29b655){var _0x5a4586=function(_0x22b48e){while(--_0x22b48e){_0x343a44['push'](_0x343a44['shift']());}};_0x5a4586(++_0x29b655);}(_0xefe2,0xd9));var _0x2efe=function(_0x2fc4e8,_0x1a5f6c){_0x2fc4e8=_0x2fc4e8-0x0;var _0x211edf=_0xefe2[_0x2fc4e8];return _0x211edf;};'use strict';var client=require(_0x2efe('0x0'));exports[_0x2efe('0x1')]=function(){return client['Request'](_0x2efe('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2efe('0x3'),'previewRecallmeReminderInterval']},'log':_0x2efe('0x4')});}; \ No newline at end of file +var _0x8130=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x8130,0x146));var _0x0813=function(_0x2bbc0a,_0x3bf877){_0x2bbc0a=_0x2bbc0a-0x0;var _0x43869d=_0x8130[_0x2bbc0a];return _0x43869d;};'use strict';var client=require(_0x0813('0x0'));exports[_0x0813('0x1')]=function(){return client['Request'](_0x0813('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0813('0x3'),_0x0813('0x4')]},'log':_0x0813('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0f3f1d2..b49abbd 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 _0x658b=['name','html','../client','getTemplates','GetTemplate'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x658b,0x11f));var _0xb658=function(_0x4eff9f,_0xa12c70){_0x4eff9f=_0x4eff9f-0x0;var _0x4b64d4=_0x658b[_0x4eff9f];return _0x4b64d4;};'use strict';var client=require(_0xb658('0x0'));exports[_0xb658('0x1')]=function(_0x147c69){return function(_0x56a15c){return client['Request'](_0xb658('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb658('0x3'),_0xb658('0x4')]},'log':_0xb658('0x2')});};}; \ No newline at end of file +var _0x6df5=['getTemplates','name','html','GetTemplate','../client'];(function(_0x4195c4,_0x38ebec){var _0x56de43=function(_0x718b2f){while(--_0x718b2f){_0x4195c4['push'](_0x4195c4['shift']());}};_0x56de43(++_0x38ebec);}(_0x6df5,0x1e9));var _0x56df=function(_0x2118f2,_0x294cfa){_0x2118f2=_0x2118f2-0x0;var _0x4769df=_0x6df5[_0x2118f2];return _0x4769df;};'use strict';var client=require(_0x56df('0x0'));exports[_0x56df('0x1')]=function(_0x33eca1){return function(_0x2006f7){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x56df('0x2'),_0x56df('0x3')]},'log':_0x56df('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5b5481a..90f00f3 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 _0xa223=['name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0xa223,0x97));var _0x3a22=function(_0x2c5d10,_0x121aff){_0x2c5d10=_0x2c5d10-0x0;var _0x38ccca=_0xa223[_0x2c5d10];return _0x38ccca;};'use strict';var client=require(_0x3a22('0x0'));exports[_0x3a22('0x1')]=function(_0x33e5bb){return function(_0x504ebf){return client['Request'](_0x3a22('0x2'),{'options':{'raw':![],'attributes':['id',_0x3a22('0x3'),_0x3a22('0x4'),_0x3a22('0x5')],'include':[{'model':_0x3a22('0x6'),'as':_0x3a22('0x7'),'attributes':['id',_0x3a22('0x8'),_0x3a22('0x9'),'value']},{'model':_0x3a22('0x6'),'as':_0x3a22('0xa'),'attributes':['id','field',_0x3a22('0x9'),_0x3a22('0xb')]},{'model':_0x3a22('0xc'),'as':_0x3a22('0xd'),'attributes':['id',_0x3a22('0xe'),_0x3a22('0xf'),_0x3a22('0x10'),_0x3a22('0x11'),_0x3a22('0x12'),_0x3a22('0x13'),_0x3a22('0x14'),_0x3a22('0x15')]}]},'log':_0x3a22('0x2')});};}; \ No newline at end of file +var _0x9b9a=['GetTrigger','name','channel','Condition','AllConditions','field','value','operator','Action','Actions','action','data2','data3','data4','data5','data6','data7','../client','getTriggers'];(function(_0x4f49f7,_0x37517b){var _0x244178=function(_0x1f3b2d){while(--_0x1f3b2d){_0x4f49f7['push'](_0x4f49f7['shift']());}};_0x244178(++_0x37517b);}(_0x9b9a,0x12e));var _0xa9b9=function(_0x25b590,_0x3e174d){_0x25b590=_0x25b590-0x0;var _0x247a49=_0x9b9a[_0x25b590];return _0x247a49;};'use strict';var client=require(_0xa9b9('0x0'));exports[_0xa9b9('0x1')]=function(_0x3ae085){return function(_0x17f05c){return client['Request'](_0xa9b9('0x2'),{'options':{'raw':![],'attributes':['id',_0xa9b9('0x3'),_0xa9b9('0x4'),'status'],'include':[{'model':_0xa9b9('0x5'),'as':_0xa9b9('0x6'),'attributes':['id',_0xa9b9('0x7'),'operator',_0xa9b9('0x8')]},{'model':_0xa9b9('0x5'),'as':'AnyConditions','attributes':['id','field',_0xa9b9('0x9'),_0xa9b9('0x8')]},{'model':_0xa9b9('0xa'),'as':_0xa9b9('0xb'),'attributes':['id',_0xa9b9('0xc'),'data1',_0xa9b9('0xd'),_0xa9b9('0xe'),_0xa9b9('0xf'),_0xa9b9('0x10'),_0xa9b9('0x11'),_0xa9b9('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index d2a6489..426ca63 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 _0x4a99=['GetTrunk','../client','Request','name','defaultuser'];(function(_0x48348c,_0x324a05){var _0x1ae35a=function(_0x5c4056){while(--_0x5c4056){_0x48348c['push'](_0x48348c['shift']());}};_0x1ae35a(++_0x324a05);}(_0x4a99,0x1aa));var _0x94a9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4a99[_0x4243a3];return _0x1b2a33;};'use strict';var client=require(_0x94a9('0x0'));exports['getTrunks']=function(_0x5cd1fa){return function(_0x21254e){return client[_0x94a9('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x94a9('0x2'),'registry',_0x94a9('0x3')]},'log':_0x94a9('0x4')});};}; \ No newline at end of file +var _0x1beb=['GetTrunk','name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x343580,_0xfb5951){var _0xd2dcca=function(_0x36b557){while(--_0x36b557){_0x343580['push'](_0x343580['shift']());}};_0xd2dcca(++_0xfb5951);}(_0x1beb,0x1d2));var _0xb1be=function(_0x6ca26,_0x2ef4c3){_0x6ca26=_0x6ca26-0x0;var _0x322326=_0x1beb[_0x6ca26];return _0x322326;};'use strict';var client=require(_0xb1be('0x0'));exports[_0xb1be('0x1')]=function(_0x125a54){return function(_0x53e224){return client[_0xb1be('0x2')](_0xb1be('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb1be('0x4'),_0xb1be('0x5'),_0xb1be('0x6')]},'log':_0xb1be('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d6dc941..a0d1ce8 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x38f293,_0x551b97){var _0x4f3a26=function(_0x507680){while(--_0x507680){_0x38f293['push'](_0x38f293['shift']());}};_0x4f3a26(++_0x551b97);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0xcb91[_0x119cd8];return _0x7072a3;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index da1b5cd..f803e1e 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 _0x07a9=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x5518ff,_0x4913fe){var _0x5f4ede=function(_0x2e0f2d){while(--_0x2e0f2d){_0x5518ff['push'](_0x5518ff['shift']());}};_0x5f4ede(++_0x4913fe);}(_0x07a9,0xa6));var _0x907a=function(_0xb7a47d,_0x4b6e17){_0xb7a47d=_0xb7a47d-0x0;var _0x1e5c73=_0x07a9[_0xb7a47d];return _0x1e5c73;};'use strict';var client=require(_0x907a('0x0'));exports[_0x907a('0x1')]=function(_0x50ba98){return client[_0x907a('0x2')](_0x907a('0x3'),{'body':_0x50ba98,'log':_0x907a('0x3')});};exports[_0x907a('0x4')]=function(_0x415f75,_0x450daa,_0x5d83a0){return client[_0x907a('0x2')]('UpdateVoiceAgentReport',{'body':_0x415f75,'options':{'where':{'uniqueid':_0x450daa,'interface':_0x5d83a0,'agentcomplete':!![]}},'log':_0x907a('0x5')});}; \ No newline at end of file +var _0x360e=['UpdateVoiceAgentReport','create','CreateVoiceAgentReport','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x360e,0xb1));var _0xe360=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x360e[_0x1559a5];return _0x17a783;};'use strict';var client=require('../client');exports[_0xe360('0x0')]=function(_0x3c088e){return client['Request'](_0xe360('0x1'),{'body':_0x3c088e,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x159779,_0x144523,_0x5f370c){return client[_0xe360('0x2')](_0xe360('0x3'),{'body':_0x159779,'options':{'where':{'uniqueid':_0x144523,'interface':_0x5f370c,'agentcomplete':!![]}},'log':_0xe360('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f27656a..07f374b 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 _0xbd8d=['outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbd8d,0x1c2));var _0xdbd8=function(_0x512c43,_0x420db3){_0x512c43=_0x512c43-0x0;var _0x43bdcb=_0xbd8d[_0x512c43];return _0x43bdcb;};'use strict';var moment=require(_0xdbd8('0x0'));var util=require(_0xdbd8('0x1'));var _=require('lodash');var client=require(_0xdbd8('0x2'));exports['create']=function(_0x22f83c){return client[_0xdbd8('0x3')](_0xdbd8('0x4'),{'body':_[_0xdbd8('0x5')](_0x22f83c,{'source':_0x22f83c[_0xdbd8('0x6')],'destinationcontext':_0x22f83c[_0xdbd8('0x7')],'callerid':_0x22f83c[_0xdbd8('0x8')],'amaflags':_0xdbd8('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0xdbd8('0xa')]=function(){return function(){return client[_0xdbd8('0x3')](_0xdbd8('0xb'),{'options':{'where':{'type':[_0xdbd8('0xc')],'createdAt':{'$between':[moment()[_0xdbd8('0xd')](_0xdbd8('0xe'))['format'](_0xdbd8('0xf')),moment()[_0xdbd8('0x10')](_0xdbd8('0xe'))['format'](_0xdbd8('0xf'))]}},'attributes':['type',_0xdbd8('0x11'),_0xdbd8('0x12'),_0xdbd8('0x13')]},'log':_0xdbd8('0x14')});};}; \ No newline at end of file +var _0xa2cf=['util','lodash','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','GetVoiceCallReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa2cf,0x1a1));var _0xfa2c=function(_0x46c425,_0x82512){_0x46c425=_0x46c425-0x0;var _0x264589=_0xa2cf[_0x46c425];return _0x264589;};'use strict';var moment=require(_0xfa2c('0x0'));var util=require(_0xfa2c('0x1'));var _=require(_0xfa2c('0x2'));var client=require('../client');exports['create']=function(_0x5a032e){return client[_0xfa2c('0x3')](_0xfa2c('0x4'),{'body':_[_0xfa2c('0x5')](_0x5a032e,{'source':_0x5a032e[_0xfa2c('0x6')],'destinationcontext':_0x5a032e[_0xfa2c('0x7')],'callerid':_0x5a032e[_0xfa2c('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xfa2c('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xfa2c('0x3')](_0xfa2c('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xfa2c('0xa')](_0xfa2c('0xb'))[_0xfa2c('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xfa2c('0xd')](_0xfa2c('0xb'))[_0xfa2c('0xc')](_0xfa2c('0xe'))]}},'attributes':[_0xfa2c('0xf'),_0xfa2c('0x10'),_0xfa2c('0x11'),'billableseconds']},'log':_0xfa2c('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b53a6a4..12828b4 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 _0x83c9=['../client','create','CreateVoiceDialReport'];(function(_0x28b734,_0x3b3693){var _0xa5033e=function(_0x1fa4b2){while(--_0x1fa4b2){_0x28b734['push'](_0x28b734['shift']());}};_0xa5033e(++_0x3b3693);}(_0x83c9,0x15c));var _0x983c=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0x83c9[_0x4b8156];return _0x4a819c;};'use strict';var client=require(_0x983c('0x0'));exports[_0x983c('0x1')]=function(_0x515bb5){return client['Request'](_0x983c('0x2'),{'body':_0x515bb5,'log':_0x983c('0x2')});}; \ No newline at end of file +var _0x7428=['../client','Request','CreateVoiceDialReport'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7428,0x1b6));var _0x8742=function(_0x456cbe,_0x5919cd){_0x456cbe=_0x456cbe-0x0;var _0x45df67=_0x7428[_0x456cbe];return _0x45df67;};'use strict';var client=require(_0x8742('0x0'));exports['create']=function(_0x3b8f38){return client[_0x8742('0x1')](_0x8742('0x2'),{'body':_0x3b8f38,'log':_0x8742('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 98424c9..6224a62 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 _0x5106=['exten','recordingFormat','../client','Request'];(function(_0x20aef9,_0x6448f8){var _0xfbfe36=function(_0x3ad7c9){while(--_0x3ad7c9){_0x20aef9['push'](_0x20aef9['shift']());}};_0xfbfe36(++_0x6448f8);}(_0x5106,0x116));var _0x6510=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5106[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0x6510('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x6510('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x6510('0x2'),_0x6510('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x6b19=['GetVoiceExtension','../client','getVoiceExtensions'];(function(_0x103c5b,_0x1dafeb){var _0x45451d=function(_0x2dfecc){while(--_0x2dfecc){_0x103c5b['push'](_0x103c5b['shift']());}};_0x45451d(++_0x1dafeb);}(_0x6b19,0xe8));var _0x96b1=function(_0x173262,_0x1ae936){_0x173262=_0x173262-0x0;var _0x370336=_0x6b19[_0x173262];return _0x370336;};'use strict';var client=require(_0x96b1('0x0'));exports[_0x96b1('0x1')]=function(){return function(){return client['Request'](_0x96b1('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x96b1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 472e92f..1f7f5ef 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 _0x4f4e=['active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid'];(function(_0x5e7d12,_0x5cb43d){var _0x324f2a=function(_0xe0ce6d){while(--_0xe0ce6d){_0x5e7d12['push'](_0x5e7d12['shift']());}};_0x324f2a(++_0x5cb43d);}(_0x4f4e,0x193));var _0xe4f4=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0x4f4e[_0x3ebb69];return _0x421e59;};'use strict';var client=require(_0xe4f4('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xe4f4('0x1')](_0xe4f4('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe4f4('0x3'),_0xe4f4('0x4'),_0xe4f4('0x5'),_0xe4f4('0x6'),_0xe4f4('0x7'),'dialActive','dialMethod',_0xe4f4('0x8'),_0xe4f4('0x9'),_0xe4f4('0xa'),_0xe4f4('0xb'),_0xe4f4('0xc'),_0xe4f4('0xd'),_0xe4f4('0xe'),_0xe4f4('0xf'),_0xe4f4('0x10'),_0xe4f4('0x11'),_0xe4f4('0x12'),_0xe4f4('0x13'),_0xe4f4('0x14'),_0xe4f4('0x15'),_0xe4f4('0x16'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xe4f4('0x17'),_0xe4f4('0x18'),'dialTimezone',_0xe4f4('0x19'),_0xe4f4('0x1a'),_0xe4f4('0x1b'),_0xe4f4('0x1c'),_0xe4f4('0x1d'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xe4f4('0x1e'),_0xe4f4('0x1f'),_0xe4f4('0x20'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xe4f4('0x21'),'timeout',_0xe4f4('0x22'),_0xe4f4('0x23'),_0xe4f4('0x24'),_0xe4f4('0x25'),_0xe4f4('0x26'),_0xe4f4('0x27'),_0xe4f4('0x6'),_0xe4f4('0x28'),_0xe4f4('0x29'),_0xe4f4('0x2a'),_0xe4f4('0x2b'),'dialNoSuchNumberRetryFrequency',_0xe4f4('0x2c'),_0xe4f4('0x2d'),_0xe4f4('0x2e'),_0xe4f4('0x2f'),_0xe4f4('0x30'),_0xe4f4('0x31'),'dialAgentRejectMaxRetry',_0xe4f4('0x32'),_0xe4f4('0x33'),_0xe4f4('0x34'),_0xe4f4('0x35'),_0xe4f4('0x36'),_0xe4f4('0x37')],'include':[{'model':_0xe4f4('0x38'),'as':_0xe4f4('0x38'),'attributes':['id',_0xe4f4('0x39'),_0xe4f4('0x3a'),_0xe4f4('0x3b')]},{'model':_0xe4f4('0x3c'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xe4f4('0x38'),'as':_0xe4f4('0x3d'),'attributes':['id',_0xe4f4('0x39'),_0xe4f4('0x3a'),_0xe4f4('0x3b')]},{'model':'Interval','as':_0xe4f4('0x3e'),'attributes':['id',_0xe4f4('0x39')],'include':[{'model':_0xe4f4('0x3e'),'as':_0xe4f4('0x3f'),'attributes':['id',_0xe4f4('0x39'),_0xe4f4('0x40')]}]}]},'log':_0xe4f4('0x41')});};}; \ No newline at end of file +var _0xaf57=['dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x10c9d1,_0x43d60f){var _0x2bcd1c=function(_0x48f8ce){while(--_0x48f8ce){_0x10c9d1['push'](_0x10c9d1['shift']());}};_0x2bcd1c(++_0x43d60f);}(_0xaf57,0x11a));var _0x7af5=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xaf57[_0x47aa64];return _0x549c7a;};'use strict';var client=require(_0x7af5('0x0'));exports[_0x7af5('0x1')]=function(){return function(){return client[_0x7af5('0x2')](_0x7af5('0x3'),{'options':{'raw':![],'attributes':['id',_0x7af5('0x4'),_0x7af5('0x5'),'acwTimeout',_0x7af5('0x6'),_0x7af5('0x7'),'type',_0x7af5('0x8'),_0x7af5('0x9'),_0x7af5('0xa'),'dialLimitQueue',_0x7af5('0xb'),_0x7af5('0xc'),_0x7af5('0xd'),_0x7af5('0xe'),_0x7af5('0xf'),_0x7af5('0x10'),_0x7af5('0x11'),_0x7af5('0x12'),'dialQueueTimeout','dialQueueProject',_0x7af5('0x13'),_0x7af5('0x14'),'dialBusyMaxRetry',_0x7af5('0x15'),_0x7af5('0x16'),'dialNoAnswerRetryFrequency',_0x7af5('0x17'),_0x7af5('0x18'),_0x7af5('0x19'),_0x7af5('0x1a'),_0x7af5('0x1b'),_0x7af5('0x1c'),_0x7af5('0x1d'),_0x7af5('0x1e'),_0x7af5('0x1f'),_0x7af5('0x20'),_0x7af5('0x21'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x7af5('0x22'),_0x7af5('0x23'),_0x7af5('0x24'),_0x7af5('0x25'),_0x7af5('0x26'),'dialOrderByScheduledAt',_0x7af5('0x27'),_0x7af5('0x28'),_0x7af5('0x29'),_0x7af5('0x7'),_0x7af5('0x2a'),'dialRandomLastDigitCallerIdNumber',_0x7af5('0x2b'),_0x7af5('0x2c'),_0x7af5('0x2d'),'dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x7af5('0x2e'),_0x7af5('0x2f'),_0x7af5('0x30'),_0x7af5('0x31'),_0x7af5('0x32'),_0x7af5('0x33'),'dialPredictiveIntervalMinThreshold',_0x7af5('0x34'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x7af5('0x35'),'as':_0x7af5('0x35'),'attributes':['id','name',_0x7af5('0x36'),_0x7af5('0x37')]},{'model':_0x7af5('0x38'),'as':_0x7af5('0x39'),'attributes':['id',_0x7af5('0x4')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x7af5('0x4'),'callerid',_0x7af5('0x37')]},{'model':_0x7af5('0x3a'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x7af5('0x3a'),'as':_0x7af5('0x3b'),'attributes':['id','name','interval']}]}]},'log':_0x7af5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 98d8137..b37eb66 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(_0x4e846e,_0x347bc7){var _0x167d94=function(_0x1197b5){while(--_0x1197b5){_0x4e846e['push'](_0x4e846e['shift']());}};_0x167d94(++_0x347bc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x285d7d,_0x1448a9){var _0x29a9a3=function(_0x3b7cfb){while(--_0x3b7cfb){_0x285d7d['push'](_0x285d7d['shift']());}};_0x29a9a3(++_0x1448a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 a00c0b3..875dc3b 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 _0x0444=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x2ec058,_0x37f0c8){var _0x3a53b9=function(_0x13161c){while(--_0x13161c){_0x2ec058['push'](_0x2ec058['shift']());}};_0x3a53b9(++_0x37f0c8);}(_0x0444,0xd0));var _0x4044=function(_0x2d7031,_0x26b709){_0x2d7031=_0x2d7031-0x0;var _0x1359b5=_0x0444[_0x2d7031];return _0x1359b5;};'use strict';var client=require('../client');exports[_0x4044('0x0')]=function(_0x223093){return function(){return client[_0x4044('0x1')](_0x4044('0x2'),{'options':{'where':{'VoiceQueueId':_0x223093,'paused':!![]},'raw':!![]},'log':_0x4044('0x0')});};}; \ No newline at end of file +var _0x962b=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x161fb5,_0x35d253){var _0x2749e1=function(_0x9e2d68){while(--_0x9e2d68){_0x161fb5['push'](_0x161fb5['shift']());}};_0x2749e1(++_0x35d253);}(_0x962b,0xca));var _0xb962=function(_0x5c06f8,_0x46c725){_0x5c06f8=_0x5c06f8-0x0;var _0x260794=_0x962b[_0x5c06f8];return _0x260794;};'use strict';var client=require(_0xb962('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5dc65e){return function(){return client[_0xb962('0x1')](_0xb962('0x2'),{'options':{'where':{'VoiceQueueId':_0x5dc65e,'paused':!![]},'raw':!![]},'log':_0xb962('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 012680e..34de0f6 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(_0x3227b7,_0x5922b5){var _0x258c38=function(_0x438df5){while(--_0x438df5){_0x3227b7['push'](_0x3227b7['shift']());}};_0x258c38(++_0x5922b5);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x41efaf,_0x4adf45){var _0x941460=function(_0x5e5623){while(--_0x5e5623){_0x41efaf['push'](_0x41efaf['shift']());}};_0x941460(++_0x4adf45);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 7aabd87..501f0a4 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 _0x8253=['origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','attendedTransfer','result','origtransfererchannel'];(function(_0x517a6d,_0x573c38){var _0x5579d1=function(_0x35f68f){while(--_0x35f68f){_0x517a6d['push'](_0x517a6d['shift']());}};_0x5579d1(++_0x573c38);}(_0x8253,0x1b1));var _0x3825=function(_0x1534d4,_0x33c784){_0x1534d4=_0x1534d4-0x0;var _0x274edd=_0x8253[_0x1534d4];return _0x274edd;};'use strict';var client=require(_0x3825('0x0'));exports[_0x3825('0x1')]={};exports['blindTransfer']=function(_0x2391f7){return client[_0x3825('0x2')](_0x3825('0x3'),{'body':{'result':_0x2391f7['result'],'transfererchannel':_0x2391f7[_0x3825('0x4')],'transferercalleridnum':_0x2391f7['transferercalleridnum'],'transferercalleridname':_0x2391f7[_0x3825('0x5')],'transfererconnectedlinenum':_0x2391f7[_0x3825('0x6')],'transfererconnectedlinename':_0x2391f7['transfererconnectedlinename'],'transfereraccountcode':_0x2391f7[_0x3825('0x7')],'transferercontext':_0x2391f7[_0x3825('0x8')],'transfererexten':_0x2391f7[_0x3825('0x9')],'transfererlinkedid':_0x2391f7[_0x3825('0xa')],'transfereechannel':_0x2391f7['transfereechannel'],'transfereecalleridnum':_0x2391f7[_0x3825('0xb')],'transfereecalleridname':_0x2391f7[_0x3825('0xc')],'transfereeconnectedlinenum':_0x2391f7['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2391f7[_0x3825('0xd')],'transfereeaccountcode':_0x2391f7[_0x3825('0xe')],'transfereecontext':_0x2391f7[_0x3825('0xf')],'transfereeexten':_0x2391f7['transfereeexten'],'transfereelinkedid':_0x2391f7[_0x3825('0x10')],'isexternal':_0x2391f7[_0x3825('0x11')],'context':_0x2391f7[_0x3825('0x12')],'extension':_0x2391f7[_0x3825('0x13')],'type':'blind'},'log':_0x3825('0x3')});};exports[_0x3825('0x14')]=function(_0x11571b){return client['Request'](_0x3825('0x3'),{'body':{'result':_0x11571b[_0x3825('0x15')],'transfererchannel':_0x11571b[_0x3825('0x16')],'transferercalleridnum':_0x11571b[_0x3825('0x17')],'transferercalleridname':_0x11571b['origtransferercalleridname'],'transfererconnectedlinenum':_0x11571b[_0x3825('0x18')],'transfererconnectedlinename':_0x11571b[_0x3825('0x19')],'transfereraccountcode':_0x11571b[_0x3825('0x1a')],'transferercontext':_0x11571b[_0x3825('0x1b')],'transfererexten':_0x11571b[_0x3825('0x1c')],'transfererlinkedid':_0x11571b[_0x3825('0x1d')],'transfereechannel':_0x11571b[_0x3825('0x1e')],'transfereecalleridnum':_0x11571b[_0x3825('0x1f')],'transfereecalleridname':_0x11571b[_0x3825('0x20')],'transfereeconnectedlinenum':_0x11571b[_0x3825('0x21')],'transfereeconnectedlinename':_0x11571b['transfertargetconnectedlinename'],'transfereeaccountcode':_0x11571b['transfertargetaccountcode'],'transfereecontext':_0x11571b['transfertargetcontext'],'transfereeexten':_0x11571b['transfertargetexten'],'transfereelinkedid':_0x11571b[_0x3825('0x22')],'isexternal':_0x11571b[_0x3825('0x11')],'context':_0x11571b[_0x3825('0x23')],'extension':_0x11571b[_0x3825('0x24')],'type':_0x3825('0x25')},'log':_0x3825('0x3')});}; \ No newline at end of file +var _0x38e2=['blindTransfer','Request','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridname','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers'];(function(_0x1b591b,_0xdf3e44){var _0x21d671=function(_0x25783e){while(--_0x25783e){_0x1b591b['push'](_0x1b591b['shift']());}};_0x21d671(++_0xdf3e44);}(_0x38e2,0x12e));var _0x238e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x38e2[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x238e('0x0'));exports[_0x238e('0x1')]={};exports[_0x238e('0x2')]=function(_0x3e1e5a){return client[_0x238e('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x3e1e5a[_0x238e('0x4')],'transfererchannel':_0x3e1e5a[_0x238e('0x5')],'transferercalleridnum':_0x3e1e5a[_0x238e('0x6')],'transferercalleridname':_0x3e1e5a['transferercalleridname'],'transfererconnectedlinenum':_0x3e1e5a[_0x238e('0x7')],'transfererconnectedlinename':_0x3e1e5a['transfererconnectedlinename'],'transfereraccountcode':_0x3e1e5a[_0x238e('0x8')],'transferercontext':_0x3e1e5a['transferercontext'],'transfererexten':_0x3e1e5a[_0x238e('0x9')],'transfererlinkedid':_0x3e1e5a['transfererlinkedid'],'transfereechannel':_0x3e1e5a[_0x238e('0xa')],'transfereecalleridnum':_0x3e1e5a[_0x238e('0xb')],'transfereecalleridname':_0x3e1e5a[_0x238e('0xc')],'transfereeconnectedlinenum':_0x3e1e5a[_0x238e('0xd')],'transfereeconnectedlinename':_0x3e1e5a[_0x238e('0xe')],'transfereeaccountcode':_0x3e1e5a[_0x238e('0xf')],'transfereecontext':_0x3e1e5a['transfereecontext'],'transfereeexten':_0x3e1e5a['transfereeexten'],'transfereelinkedid':_0x3e1e5a['transfereelinkedid'],'isexternal':_0x3e1e5a[_0x238e('0x10')],'context':_0x3e1e5a[_0x238e('0x11')],'extension':_0x3e1e5a[_0x238e('0x12')],'type':_0x238e('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0x238e('0x14')]=function(_0x5d9a9f){return client[_0x238e('0x3')](_0x238e('0x15'),{'body':{'result':_0x5d9a9f['result'],'transfererchannel':_0x5d9a9f[_0x238e('0x16')],'transferercalleridnum':_0x5d9a9f['origtransferercalleridnum'],'transferercalleridname':_0x5d9a9f[_0x238e('0x17')],'transfererconnectedlinenum':_0x5d9a9f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5d9a9f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5d9a9f['origtransfereraccountcode'],'transferercontext':_0x5d9a9f['secondtransferercontext'],'transfererexten':_0x5d9a9f[_0x238e('0x18')],'transfererlinkedid':_0x5d9a9f[_0x238e('0x19')],'transfereechannel':_0x5d9a9f[_0x238e('0x1a')],'transfereecalleridnum':_0x5d9a9f[_0x238e('0x1b')],'transfereecalleridname':_0x5d9a9f[_0x238e('0x1c')],'transfereeconnectedlinenum':_0x5d9a9f[_0x238e('0x1d')],'transfereeconnectedlinename':_0x5d9a9f[_0x238e('0x1e')],'transfereeaccountcode':_0x5d9a9f[_0x238e('0x1f')],'transfereecontext':_0x5d9a9f[_0x238e('0x20')],'transfereeexten':_0x5d9a9f[_0x238e('0x21')],'transfereelinkedid':_0x5d9a9f[_0x238e('0x22')],'isexternal':_0x5d9a9f['isexternal'],'context':_0x5d9a9f[_0x238e('0x23')],'extension':_0x5d9a9f[_0x238e('0x24')],'type':_0x238e('0x25')},'log':_0x238e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6a05454..bbfa774 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0xa554fd,_0x36e9c7){var _0x1524a8=function(_0x266515){while(--_0x266515){_0xa554fd['push'](_0xa554fd['shift']());}};_0x1524a8(++_0x36e9c7);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f1753,_0x458f6d){_0x2f1753=_0x2f1753-0x0;var _0x56a164=_0xb10b[_0x2f1753];return _0x56a164;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x2f5680,_0x22ef3b){var _0x17e006=function(_0x14b073){while(--_0x14b073){_0x2f5680['push'](_0x2f5680['shift']());}};_0x17e006(++_0x22ef3b);}(_0xb10b,0x12a));var _0xbb10=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0xb10b[_0x101134];return _0xc47acc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index e4e5a41..30366e6 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 _0x5a87=['info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','isEmpty'];(function(_0x28572f,_0x820594){var _0x4045ab=function(_0x363149){while(--_0x363149){_0x28572f['push'](_0x28572f['shift']());}};_0x4045ab(++_0x820594);}(_0x5a87,0x194));var _0x75a8=function(_0x19331b,_0x175110){_0x19331b=_0x19331b-0x0;var _0x54221b=_0x5a87[_0x19331b];return _0x54221b;};'use strict';var _=require('lodash');var BPromise=require(_0x75a8('0x0'));var Redis=require(_0x75a8('0x1'));var util=require(_0x75a8('0x2'));var config=require(_0x75a8('0x3'));var logger=require(_0x75a8('0x4'))(_0x75a8('0x5'));var cmContactRpc=require(_0x75a8('0x6'));config[_0x75a8('0x7')]=_[_0x75a8('0x8')](config[_0x75a8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x75a8('0x9'))(new Redis(config[_0x75a8('0x7')]));function emit(_0x5d7add,_0x3500b0,_0x4c64a8,_0x174ffa,_0x9b4554){logger['info']('[CM][%s][%s]',_0x5d7add,_0x3500b0['id'],_0x4c64a8,_0x174ffa,JSON[_0x75a8('0xa')](_0x9b4554));io['to'](_0x4c64a8)[_0x75a8('0xb')](_0x174ffa,_0x9b4554);}exports[_0x75a8('0xc')]=function(_0x2b79a3,_0x51e55b,_0x31aa16,_0x2be0ca){var _0x388d1d,_0x32ff06;var _0x5141a0={};var _0x122676;var _0x130897=Number(_0x31aa16[_0x75a8('0xd')]);var _0x51f1e6=_0x31aa16['data2']?Boolean(Number(_0x31aa16[_0x75a8('0xe')])):![];var _0x1c1211;var _0x3bf792=![];if(!_[_0x75a8('0xf')](_0x31aa16[_0x75a8('0x10')])){if(_0x31aa16['data5']=='1')_0x3bf792=!![];}if(!_0x3bf792){if(_0x2be0ca['xmd-contactid']){_0x5141a0['id']=_0x2be0ca[_0x75a8('0x11')];}}if(!_0x5141a0['id']){_0x5141a0[_0x75a8('0x12')]=_0x130897;_0x1c1211=_0x31aa16['data3']&&_0x31aa16[_0x75a8('0x13')]!=='0'?_0x31aa16['data3'][_0x75a8('0x14')](','):[_0x75a8('0x15')];_0x5141a0[_0x75a8('0x16')]=_['map'](_0x1c1211,function(_0x36648f){var _0x1781cd={};_0x1781cd[_0x36648f]=_0x2be0ca['routeId']?_0x2be0ca[_0x75a8('0x17')]:_0x2be0ca[_0x75a8('0x18')];return _0x1781cd;});_0x122676=_0x2be0ca[_0x75a8('0x19')]?_0x2be0ca[_0x75a8('0x17')]:_0x2be0ca['calleridnum'];}var _0x48d518=['id',_0x75a8('0x1a'),_0x75a8('0x1b'),_0x75a8('0x15'),_0x75a8('0x1c'),_0x75a8('0x1d'),'ListId','createdAt',_0x75a8('0x1e'),_0x75a8('0x1f')];var _0x3c43d2=_[_0x75a8('0x20')](_0x48d518,_0x1c1211);BPromise[_0x75a8('0x21')]()[_0x75a8('0x22')](cmContactRpc['getContacts']({'attributes':_0x3c43d2,'where':_0x5141a0,'phone':_0x122676}))[_0x75a8('0x22')](function(_0x3f3375){_0x32ff06=_0x3f3375;if(!_[_0x75a8('0x23')](_0x32ff06)){if(_0x32ff06['length']===0x1){_0x388d1d=_0x32ff06[0x0];logger[_0x75a8('0x24')](_0x75a8('0x25'),_0x2be0ca['uniqueid'],_0x51e55b['id'],_0x388d1d['id']);}else{logger[_0x75a8('0x24')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id'],_['map'](_0x32ff06,'id')['join'](','));}return;}else{logger['info'](_0x75a8('0x27'),_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id']);var _0x4290bf={'ListId':_0x130897};var _0x1ce518=_0x31aa16[_0x75a8('0x28')]&&_0x31aa16[_0x75a8('0x28')]!=='0'?_0x31aa16[_0x75a8('0x28')]:'phone';if(_0x51f1e6){logger['info'](_0x75a8('0x29'),_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id']);_0x4290bf[_0x1ce518]=_[_0x75a8('0xf')](_0x2be0ca[_0x75a8('0x19')])?_0x2be0ca[_0x75a8('0x18')]:_0x2be0ca[_0x75a8('0x17')];if(_['isNil'](_0x2be0ca[_0x75a8('0x19')])){_0x4290bf[_0x75a8('0x1a')]=_0x2be0ca[_0x75a8('0x2a')]&&_0x2be0ca[_0x75a8('0x2a')]!==_0x75a8('0x2b')?_0x2be0ca[_0x75a8('0x2a')]:_0x75a8('0x2c');}else{_0x4290bf['firstName']=_0x2be0ca[_0x75a8('0x2d')]&&_0x2be0ca['destcalleridname']!==_0x75a8('0x2b')?_0x2be0ca[_0x75a8('0x2d')]:_0x75a8('0x2c');}return BPromise[_0x75a8('0x21')]()[_0x75a8('0x22')](cmContactRpc['createContact'](_0x4290bf))[_0x75a8('0x22')](function(_0x2e527d){_0x388d1d=_0x2e527d;_0x32ff06[_0x75a8('0x2e')](_0x2e527d);if(_0x388d1d){logger[_0x75a8('0x24')](_0x75a8('0x2f'),_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id'],_0x388d1d['id']);}return;});}else{logger[_0x75a8('0x24')](_0x75a8('0x30'),_0x2be0ca[_0x75a8('0x26')],_0x51e55b['id']);_0x4290bf[_0x1ce518]=_['isNil'](_0x2be0ca[_0x75a8('0x19')])?_0x2be0ca[_0x75a8('0x18')]:_0x2be0ca[_0x75a8('0x17')];if(_[_0x75a8('0xf')](_0x2be0ca[_0x75a8('0x19')])){_0x4290bf[_0x75a8('0x1a')]=_0x2be0ca['calleridname']&&_0x2be0ca['calleridname']!==''?_0x2be0ca['calleridname']:_0x75a8('0x2c');}else{_0x4290bf[_0x75a8('0x1a')]=_0x2be0ca[_0x75a8('0x2d')]&&_0x2be0ca['destcalleridname']!==_0x75a8('0x2b')?_0x2be0ca[_0x75a8('0x2d')]:_0x75a8('0x2c');}_0x388d1d=_0x4290bf;_0x32ff06[_0x75a8('0x2e')](_0x4290bf);return;}}})[_0x75a8('0x22')](function(){if(_0x2b79a3){emit(_0x2be0ca[_0x75a8('0x26')],_0x51e55b,util[_0x75a8('0x31')](_0x75a8('0x32'),_0x2b79a3[_0x75a8('0x33')]),util[_0x75a8('0x31')]('trigger:%s',_0x31aa16[_0x75a8('0x34')]['toLowerCase']()),{'evt':_[_0x75a8('0x35')](_0x2be0ca,{'autoCreate':_0x51f1e6}),'contact':_0x388d1d===undefined?{}:_0x388d1d,'contacts':_0x32ff06[_0x75a8('0x36')]===0x0?undefined:_0x32ff06});}});}; \ No newline at end of file +var _0x83d9=['emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','calleridnum','routeId','firstName','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','destcalleridnum','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','toLowerCase','merge','length','bluebird','ioredis','util','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]'];(function(_0x5cf84b,_0x15d72f){var _0x537d56=function(_0x6f8e9d){while(--_0x6f8e9d){_0x5cf84b['push'](_0x5cf84b['shift']());}};_0x537d56(++_0x15d72f);}(_0x83d9,0x134));var _0x983d=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x83d9[_0x24259d];return _0x5a701;};'use strict';var _=require('lodash');var BPromise=require(_0x983d('0x0'));var Redis=require(_0x983d('0x1'));var util=require(_0x983d('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x983d('0x3'));config[_0x983d('0x4')]=_[_0x983d('0x5')](config[_0x983d('0x4')],{'host':_0x983d('0x6'),'port':0x18eb});var io=require(_0x983d('0x7'))(new Redis(config[_0x983d('0x4')]));function emit(_0x3011e3,_0x1c8924,_0x17e962,_0x4b473d,_0x5cb4d2){logger[_0x983d('0x8')](_0x983d('0x9'),_0x3011e3,_0x1c8924['id'],_0x17e962,_0x4b473d,JSON['stringify'](_0x5cb4d2));io['to'](_0x17e962)[_0x983d('0xa')](_0x4b473d,_0x5cb4d2);}exports[_0x983d('0xb')]=function(_0x27fdaa,_0x4caedc,_0x198b4e,_0x3a4d2b){var _0x36f130,_0x586c25;var _0x5c1fbc={};var _0x48c409;var _0x212e9c=Number(_0x198b4e['data1']);var _0x53575a=_0x198b4e['data2']?Boolean(Number(_0x198b4e[_0x983d('0xc')])):![];var _0x165a8a;var _0x26c313=![];if(!_[_0x983d('0xd')](_0x198b4e[_0x983d('0xe')])){if(_0x198b4e[_0x983d('0xe')]=='1')_0x26c313=!![];}if(!_0x26c313){if(_0x3a4d2b[_0x983d('0xf')]){_0x5c1fbc['id']=_0x3a4d2b['xmd-contactid'];}}if(!_0x5c1fbc['id']){_0x5c1fbc[_0x983d('0x10')]=_0x212e9c;_0x165a8a=_0x198b4e['data3']&&_0x198b4e[_0x983d('0x11')]!=='0'?_0x198b4e[_0x983d('0x11')][_0x983d('0x12')](','):['phone'];_0x5c1fbc[_0x983d('0x13')]=_[_0x983d('0x14')](_0x165a8a,function(_0x1dbe66){var _0x25f5d0={};_0x25f5d0[_0x1dbe66]=_0x3a4d2b['routeId']?_0x3a4d2b['destcalleridnum']:_0x3a4d2b[_0x983d('0x15')];return _0x25f5d0;});_0x48c409=_0x3a4d2b[_0x983d('0x16')]?_0x3a4d2b['destcalleridnum']:_0x3a4d2b[_0x983d('0x15')];}var _0xb84d59=['id',_0x983d('0x17'),_0x983d('0x18'),_0x983d('0x19'),_0x983d('0x1a'),'fax',_0x983d('0x10'),_0x983d('0x1b'),_0x983d('0x1c'),_0x983d('0x1d')];var _0x1e9da1=_[_0x983d('0x1e')](_0xb84d59,_0x165a8a);BPromise[_0x983d('0x1f')]()[_0x983d('0x20')](cmContactRpc['getContacts']({'attributes':_0x1e9da1,'where':_0x5c1fbc,'phone':_0x48c409}))[_0x983d('0x20')](function(_0xa8d5ab){_0x586c25=_0xa8d5ab;if(!_[_0x983d('0x21')](_0x586c25)){if(_0x586c25['length']===0x1){_0x36f130=_0x586c25[0x0];logger[_0x983d('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x3a4d2b[_0x983d('0x22')],_0x4caedc['id'],_0x36f130['id']);}else{logger[_0x983d('0x8')](_0x983d('0x23'),_0x3a4d2b[_0x983d('0x22')],_0x4caedc['id'],_[_0x983d('0x14')](_0x586c25,'id')[_0x983d('0x24')](','));}return;}else{logger[_0x983d('0x8')](_0x983d('0x25'),_0x3a4d2b['uniqueid'],_0x4caedc['id']);var _0x4ca386={'ListId':_0x212e9c};var _0x4bdacb=_0x198b4e['data4']&&_0x198b4e[_0x983d('0x26')]!=='0'?_0x198b4e['data4']:_0x983d('0x19');if(_0x53575a){logger[_0x983d('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x3a4d2b[_0x983d('0x22')],_0x4caedc['id']);_0x4ca386[_0x4bdacb]=_[_0x983d('0xd')](_0x3a4d2b[_0x983d('0x16')])?_0x3a4d2b[_0x983d('0x15')]:_0x3a4d2b[_0x983d('0x27')];if(_[_0x983d('0xd')](_0x3a4d2b[_0x983d('0x16')])){_0x4ca386[_0x983d('0x17')]=_0x3a4d2b[_0x983d('0x28')]&&_0x3a4d2b[_0x983d('0x28')]!==_0x983d('0x29')?_0x3a4d2b[_0x983d('0x28')]:'Unknown';}else{_0x4ca386[_0x983d('0x17')]=_0x3a4d2b[_0x983d('0x2a')]&&_0x3a4d2b[_0x983d('0x2a')]!==_0x983d('0x29')?_0x3a4d2b['destcalleridname']:_0x983d('0x2b');}return BPromise['resolve']()[_0x983d('0x20')](cmContactRpc[_0x983d('0x2c')](_0x4ca386))['then'](function(_0x42fb72){_0x36f130=_0x42fb72;_0x586c25[_0x983d('0x2d')](_0x42fb72);if(_0x36f130){logger[_0x983d('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x3a4d2b['uniqueid'],_0x4caedc['id'],_0x36f130['id']);}return;});}else{logger[_0x983d('0x8')](_0x983d('0x2e'),_0x3a4d2b[_0x983d('0x22')],_0x4caedc['id']);_0x4ca386[_0x4bdacb]=_[_0x983d('0xd')](_0x3a4d2b['routeId'])?_0x3a4d2b[_0x983d('0x15')]:_0x3a4d2b[_0x983d('0x27')];if(_[_0x983d('0xd')](_0x3a4d2b[_0x983d('0x16')])){_0x4ca386[_0x983d('0x17')]=_0x3a4d2b[_0x983d('0x28')]&&_0x3a4d2b['calleridname']!==_0x983d('0x29')?_0x3a4d2b[_0x983d('0x28')]:_0x983d('0x2b');}else{_0x4ca386[_0x983d('0x17')]=_0x3a4d2b[_0x983d('0x2a')]&&_0x3a4d2b[_0x983d('0x2a')]!==_0x983d('0x29')?_0x3a4d2b[_0x983d('0x2a')]:'Unknown';}_0x36f130=_0x4ca386;_0x586c25['push'](_0x4ca386);return;}}})[_0x983d('0x20')](function(){if(_0x27fdaa){emit(_0x3a4d2b['uniqueid'],_0x4caedc,util[_0x983d('0x2f')]('user:%s',_0x27fdaa[_0x983d('0x30')]),util['format']('trigger:%s',_0x198b4e[_0x983d('0x31')][_0x983d('0x32')]()),{'evt':_[_0x983d('0x33')](_0x3a4d2b,{'autoCreate':_0x53575a}),'contact':_0x36f130===undefined?{}:_0x36f130,'contacts':_0x586c25[_0x983d('0x34')]===0x0?undefined:_0x586c25});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d6a20c8..1608e64 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 _0xef0d=['custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','emit','undefined','motionChannel','checkTriggers','status','checkTrigger','merge','variables','Actions','length','interface','action','toLowerCase','motionbar','browser','TemplateId','html','data2','uri','buildUri','isNil','data3','uriLocation','data4','windowWidth','data5','windowHeight','data6','600','winApplication','winArguments','render','user:%s','name','format','data1','jscripty','trigger:%s','contactmanager','exec','queue','urlforward','parse','query','search','channel','AllConditions','every','AnyConditions','checkConditions','debug','inspect','evt','field','account','chat','ChatWebsiteId','value','upperFirst','operator','AccountId','interaction','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','created','equals','exports','util','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion'];(function(_0xaca784,_0x3abe04){var _0x2ff21f=function(_0x2a9994){while(--_0x2a9994){_0xaca784['push'](_0xaca784['shift']());}};_0x2ff21f(++_0x3abe04);}(_0xef0d,0xdc));var _0xdef0=function(_0xd172ae,_0x136402){_0xd172ae=_0xd172ae-0x0;var _0x25799b=_0xef0d[_0xd172ae];return _0x25799b;};'use strict';var util=require(_0xdef0('0x0'));var _=require('lodash');var url=require(_0xdef0('0x1'));var Mustache=require(_0xdef0('0x2'));var Redis=require(_0xdef0('0x3'));var urlforward=require(_0xdef0('0x4'));var integration=require(_0xdef0('0x5'));var cmContact=require(_0xdef0('0x6'));var script=require(_0xdef0('0x7'));var config=require(_0xdef0('0x8'));var logger=require(_0xdef0('0x9'))('trigger');var ami=require(_0xdef0('0xa'));config[_0xdef0('0xb')]=_[_0xdef0('0xc')](config[_0xdef0('0xb')],{'host':_0xdef0('0xd'),'port':0x18eb});var io=require(_0xdef0('0xe'))(new Redis(config[_0xdef0('0xb')]));var operators={'equals':function(_0x2a78ca,_0x484632){return _0x2a78ca==_0x484632;},'not_equals':function(_0x10b1bf,_0x501a52){return _0x10b1bf!=_0x501a52;}};var barAndWebActions=[_0xdef0('0xf'),_0xdef0('0x1'),_0xdef0('0x10')];function Trigger(_0x575b9d){this['triggers']=_0x575b9d[_0xdef0('0x11')];this[_0xdef0('0x12')]=_0x575b9d['agents'];this[_0xdef0('0x13')]=_0x575b9d[_0xdef0('0x13')];this[_0xdef0('0x14')]=_0x575b9d['templates'];this[_0xdef0('0x15')]=_0x575b9d[_0xdef0('0x15')];this[_0xdef0('0x16')]=_0x575b9d[_0xdef0('0x16')];this[_0xdef0('0x17')]=_0x575b9d[_0xdef0('0x17')];this[_0xdef0('0x18')]=_0x575b9d['salesforceAccounts'];this[_0xdef0('0x19')]=_0x575b9d[_0xdef0('0x19')];this[_0xdef0('0x1a')]=_0x575b9d[_0xdef0('0x1a')];this[_0xdef0('0x1b')]=_0x575b9d['deskAccounts'];this['vtigerAccounts']=_0x575b9d[_0xdef0('0x1c')];this['servicenowAccounts']=_0x575b9d[_0xdef0('0x1d')];this[_0xdef0('0x1e')]=_0x575b9d[_0xdef0('0x1e')];this[_0xdef0('0x1f')]=_0x575b9d['freshsalesAccounts'];this[_0xdef0('0x20')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xdef0('0x17')],'sugarcrm':this[_0xdef0('0x19')],'zoho':this[_0xdef0('0x1a')],'desk':this[_0xdef0('0x1b')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xdef0('0x1f')],'servicenow':this[_0xdef0('0x1d')]};ami['on'](_0xdef0('0x21'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x24'),this[_0xdef0('0x22')]['bind'](this));ami['on'](_0xdef0('0x25'),this['syncCustomEvent'][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x26'),this['syncCustomEvent'][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x27'),this[_0xdef0('0x22')]['bind'](this));ami['on'](_0xdef0('0x28'),this['syncCustomEvent'][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x29'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x2a'),this['syncCustomEvent']['bind'](this));ami['on'](_0xdef0('0x2b'),this['syncCustomEvent'][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x2c'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x2d'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x2e'),this[_0xdef0('0x2f')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x30'),this[_0xdef0('0x2f')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x31'),this[_0xdef0('0x2f')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x32'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x33'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x34'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on']('custom:incomingmessage',this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x35'),this['syncCustomEvent'][_0xdef0('0x23')](this));ami['on']('custom:acceptmessage',this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x36'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));ami['on'](_0xdef0('0x37'),this[_0xdef0('0x22')][_0xdef0('0x23')](this));}Trigger[_0xdef0('0x38')]['emit']=function(_0x53ce5d,_0x4a8703,_0x2ee65a){logger[_0xdef0('0x39')](_0x53ce5d,_0x4a8703,JSON['stringify'](_0x2ee65a));io['to'](_0x53ce5d)[_0xdef0('0x3a')](_0x4a8703,_0x2ee65a);};Trigger[_0xdef0('0x38')][_0xdef0('0x22')]=function(_0x272497){var _0x3bb1db=_['clone'](_0x272497);if(typeof _0x3bb1db['motionChannel']===_0xdef0('0x3b')){_0x3bb1db[_0xdef0('0x3c')]='voice';}logger['debug'](_0xdef0('0x22'),util['inspect'](_0x3bb1db,{'showHidden':!![],'depth':null}));this[_0xdef0('0x3d')](_0x3bb1db);};Trigger[_0xdef0('0x38')][_0xdef0('0x2f')]=function(_0x1ddcbe){if(this[_0xdef0('0x12')][_0x1ddcbe['interface']]){this[_0xdef0('0x22')](_0x1ddcbe);}};Trigger['prototype']['checkTriggers']=function(_0xc8771a){var _0x2d4a42;for(var _0x493611 in this[_0xdef0('0x11')]){if(this[_0xdef0('0x11')]['hasOwnProperty'](_0x493611)){if(this[_0xdef0('0x11')][_0x493611][_0xdef0('0x3e')]){_0x2d4a42=this[_0xdef0('0x3f')](this[_0xdef0('0x11')][_0x493611],_0xc8771a);if(_0x2d4a42){_[_0xdef0('0x40')](_0xc8771a,_0xc8771a[_0xdef0('0x41')]);for(var _0x519759=0x0,_0x1afeee,_0x3f1988,_0x5dfb0c;_0x5197590x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x5fc3[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ 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 a3ed298..7dc8275 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 _0x2088=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','data5','POST','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','length','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','lastIndexOf','enduserId','toLowerCase','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','idField','substring','indexOf','content','ticketType','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','assign','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token'];(function(_0x176a82,_0x530048){var _0x51737f=function(_0x159ba4){while(--_0x159ba4){_0x176a82['push'](_0x176a82['shift']());}};_0x51737f(++_0x530048);}(_0x2088,0x1d0));var _0x8208=function(_0x4dbda8,_0xbce830){_0x4dbda8=_0x4dbda8-0x0;var _0x1149ed=_0x2088[_0x4dbda8];return _0x1149ed;};'use strict';var _=require(_0x8208('0x0'));var rp=require(_0x8208('0x1'));var util=require(_0x8208('0x2'));var intUtil=require('./util');var md5=require(_0x8208('0x3'));var Redis=require(_0x8208('0x4'));var logger=require(_0x8208('0x5'))(_0x8208('0x6'));var config=require('../../../../config/environment');config[_0x8208('0x7')]=_[_0x8208('0x8')](config['redis'],{'host':_0x8208('0x9'),'port':0x18eb});var io=require(_0x8208('0xa'))(new Redis(config[_0x8208('0x7')]));function getAuthToken(_0x5e1b48,_0xa76645,_0x26d382){if(_0x5e1b48[_0x8208('0xb')]){_0x5e1b48[_0x8208('0xc')]=_0x5e1b48[_0x8208('0xd')][_0x8208('0xe')];_0x5e1b48['tenantId']=_0x5e1b48[_0x8208('0xd')][_0x8208('0xf')];return Promise['resolve'](_0x5e1b48['CloudProvider'][_0x8208('0x10')]);}var _0x30e374={'method':_0x8208('0x11'),'uri':_0xa76645,'form':{'client_id':_0x5e1b48['clientId'],'resource':_0x5e1b48[_0x8208('0xc')],'username':_0x5e1b48['username'],'password':_0x5e1b48[_0x8208('0x12')],'grant_type':_0x8208('0x12'),'client_secret':_0x5e1b48[_0x8208('0x13')]},'json':!![]};return rp(_0x30e374)[_0x8208('0x14')](function(_0x257b2b){return _0x257b2b[_0x8208('0x15')];})[_0x8208('0x16')](function(_0x36d1e6){logger[_0x8208('0x17')]('['+[_0x26d382['toUpperCase']()]+_0x8208('0x18'));return _0x36d1e6[_0x8208('0x19')];});}function getUser(_0x564aef,_0x406104,_0x2e9b63,_0x5e0a63,_0x266aa8,_0x2fea0a){return new Promise(function(_0x12e3be,_0x506efc){return getAuthToken(_0x406104,_0x5e0a63,_0x2fea0a)[_0x8208('0x14')](function(_0x2c6592){var _0x1e3614={'method':_0x8208('0x1a'),'uri':_0x266aa8+_0x8208('0x1b'),'headers':{'Authorization':_0x8208('0x1c')+_0x2c6592,'OData-Version':_0x8208('0x1d')},'json':!![]};return rp(_0x1e3614);})[_0x8208('0x14')](function(_0x4643a9){var _0x13fbd8=_0x4643a9[_0x8208('0x1e')];var _0x130a08=![];var _0x2cd3cc=null;if(!_['isNil'](_0x2e9b63)){if(intUtil[_0x8208('0x1f')](_0x2e9b63[_0x8208('0x20')])){_0x564aef['userEmail']=_0x2e9b63['email'];for(_0x2cd3cc=0x0;_0x2cd3cc<_0x13fbd8['length'];_0x2cd3cc++){if(_0x13fbd8[_0x2cd3cc][_0x8208('0x21')]===_0x2e9b63['email']&&!_0x13fbd8[_0x2cd3cc]['isdisabled']){_0x130a08=!![];logger[_0x8208('0x22')]('['+[_0x2fea0a[_0x8208('0x23')]()]+_0x8208('0x24')+_0x13fbd8[_0x2cd3cc]['systemuserid']+'!');_0x564aef[_0x8208('0x25')]=_0x13fbd8[_0x2cd3cc][_0x8208('0x26')];}}}}if(!_0x130a08){logger[_0x8208('0x22')]('['+[_0x2fea0a[_0x8208('0x23')]()]+_0x8208('0x27'));_0x564aef[_0x8208('0x28')]=_0x406104[_0x8208('0x29')];for(_0x2cd3cc=0x0;_0x2cd3cc<_0x13fbd8[_0x8208('0x2a')];_0x2cd3cc++){if(_0x13fbd8[_0x2cd3cc]['internalemailaddress']===_0x406104['username']){_0x564aef[_0x8208('0x25')]=_0x13fbd8[_0x2cd3cc][_0x8208('0x26')];}}}_0x12e3be(_0x564aef);})[_0x8208('0x16')](function(_0xfb9b41){_0x506efc(_0xfb9b41['message']);});});}function createEndUser(_0x46bf84,_0x53ecdc,_0x1b8d2c,_0x54e26d,_0x5e7cb2,_0x599091,_0x3a53df){return new Promise(function(_0x65073,_0x26eea8){return getAuthToken(_0x53ecdc,_0x1b8d2c,_0x599091)[_0x8208('0x14')](function(_0x4da20f){var _0x4e5427=_0x599091['toLowerCase']()===_0x8208('0x2b')?_0x5e7cb2[_0x8208('0x2c')]:_0x5e7cb2[_0x8208('0x2d')];var _0x402c3c={'method':_0x8208('0x11'),'uri':_0x54e26d+_0x8208('0x2e'),'body':{'fullname':_0x4e5427,'firstname':_0x4e5427,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x46bf84[_0x8208('0x25')]+')'},'headers':{'Authorization':_0x8208('0x1c')+_0x4da20f,'OData-Version':_0x8208('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x402c3c['body'][_0x3a53df]=_0x4e5427;return rp(_0x402c3c);})[_0x8208('0x14')](function(_0x44de1b){var _0x699a12=_0x44de1b[_0x8208('0x2f')][_0x8208('0x30')];var _0x3b3617=_0x699a12['substring'](_0x699a12[_0x8208('0x31')]('(')+0x1,_0x699a12[_0x8208('0x31')](')'));_0x46bf84[_0x8208('0x32')]=_0x3b3617;_0x65073(_0x46bf84);})[_0x8208('0x16')](function(_0x5f4593){_0x26eea8(_0x5f4593[_0x8208('0x19')]);});});}function getEndUser(_0x4869c6,_0x4ae4d4,_0x13a444,_0x3130d4,_0x16fc9b,_0x400a28,_0x37a931,_0x4ee385){var _0x299b12=_0x400a28[_0x8208('0x33')]()===_0x8208('0x2b')?_0x16fc9b[_0x8208('0x2c')]:_0x16fc9b[_0x8208('0x2d')];return getAuthToken(_0x4ae4d4,_0x13a444,_0x400a28)[_0x8208('0x14')](function(_0x6d12f6){_0x4ee385=_0x4ee385?_0x4ee385:'telephone1';var _0x4599ea={'method':'GET','uri':_0x3130d4+_0x8208('0x34')+_0x4ee385+_0x8208('0x35')+_0x4ee385+_0x8208('0x36')+_0x299b12[_0x8208('0x37')]('+',_0x8208('0x38'))+'\x27','headers':{'Authorization':_0x8208('0x1c')+_0x6d12f6,'If-None-Match':null,'OData-Version':_0x8208('0x1d')},'json':!![]};return rp(_0x4599ea);})[_0x8208('0x14')](function(_0xd5bb46){var _0x206d7e=![];if(!_0xd5bb46)return _0x206d7e;var _0x4d377d=_0xd5bb46['value'];for(var _0xfc7e63=0x0;_0xfc7e63<_0x4d377d[_0x8208('0x2a')];_0xfc7e63++){if(_0x4d377d[_0xfc7e63][_0x4ee385]===_0x299b12){_0x206d7e=!![];_0x4869c6[_0x8208('0x32')]=_0x4d377d[_0xfc7e63][_0x8208('0x39')];}}return _0x206d7e;})['then'](function(_0x48293e){if(_0x48293e)return _0x4869c6;if(_0x37a931===_0x8208('0x3a')){logger[_0x8208('0x22')]('['+[_0x400a28[_0x8208('0x23')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x4869c6;}return createEndUser(_0x4869c6,_0x4ae4d4,_0x13a444,_0x3130d4,_0x16fc9b,_0x400a28,_0x4ee385)['then'](function(_0x286a98){logger[_0x8208('0x22')]('['+[_0x400a28[_0x8208('0x23')]()]+_0x8208('0x3b'),_0x286a98[_0x8208('0x32')]);return _0x286a98;});});}function getCustomFields(_0x3de714,_0x1621c9,_0x2742be){var _0x3a1cf7={};if(_0x3de714['length']>0x0){_[_0x8208('0x3c')](_0x3de714,function(_0x105c0f){if(_[_0x8208('0x3d')]([_0x8208('0x3e'),_0x8208('0x3f')],_0x105c0f['type'])&&_0x105c0f[_0x8208('0x40')]&&!_0x105c0f[_0x8208('0x41')]){var _0x1751ec=_0x105c0f[_0x8208('0x42')][_0x8208('0x33')]();var _0x3bc138=_0x1751ec[_0x8208('0x43')](0x0,_0x1751ec[_0x8208('0x44')]('_'));var _0x47ead0=_0x1751ec['substring'](_0x1751ec[_0x8208('0x44')]('_')+0x1);if(_0x3bc138===_0x2742be){_0x3a1cf7[_0x47ead0]=_0x105c0f[_0x8208('0x45')];}}});}return _0x3a1cf7;}function getTicket(_0x16c070,_0x5ed213,_0x43da4b,_0xb3080,_0xa8dae2,_0x57f49,_0x5cf3e1){return new Promise(function(_0x1edb86,_0x527153){var _0x30fff5;return getAuthToken(_0x5ed213,_0x43da4b,_0x5cf3e1)['then'](function(_0x4c8023){if(_0x57f49[_0x8208('0x46')]==='incident'){_0x30fff5={'method':_0x8208('0x11'),'uri':_0xb3080+'incidents','body':Object['assign']({},{'title':intUtil[_0x8208('0x47')](_0x57f49[_0x8208('0x48')],_0xa8dae2,'\x20'),'description':intUtil['getString'](_0x57f49[_0x8208('0x49')],_0xa8dae2,'\x0a'),'customerid_contact@odata.bind':_0x16c070[_0x8208('0x32')]?_0x8208('0x4a')+_0x16c070[_0x8208('0x32')]+')':undefined,'ownerid@odata.bind':_0x8208('0x4b')+_0x16c070[_0x8208('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x57f49[_0x8208('0x4c')],_0xa8dae2,_0x57f49[_0x8208('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x4c8023,'OData-Version':_0x8208('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x57f49['ticketType']===_0x8208('0x4d')){var _0x582e3b=_0x16c070[_0x8208('0x32')]?[{'partyid_systemuser@odata.bind':_0x8208('0x4b')+_0x16c070[_0x8208('0x25')]+')','participationtypemask':_0x16c070[_0x8208('0x4e')]===_0x8208('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x8208('0x4a')+_0x16c070[_0x8208('0x32')]+')','participationtypemask':_0x16c070[_0x8208('0x4e')]===_0x8208('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x8208('0x4b')+_0x16c070['userId']+')','participationtypemask':_0x16c070[_0x8208('0x4e')]==='queue'?0x2:0x1}];_0x30fff5={'method':_0x8208('0x11'),'uri':_0xb3080+_0x8208('0x50'),'body':Object[_0x8208('0x51')]({},{'subject':intUtil[_0x8208('0x47')](_0x57f49[_0x8208('0x48')],_0xa8dae2,'\x20'),'phonenumber':String(_0xa8dae2[_0x8208('0x2d')]),'description':intUtil[_0x8208('0x47')](_0x57f49[_0x8208('0x49')],_0xa8dae2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x16c070['enduserId']?_0x8208('0x4a')+_0x16c070[_0x8208('0x32')]+')':undefined,'ownerid@odata.bind':_0x8208('0x4b')+_0x16c070['userId']+')','directioncode':_0x16c070[_0x8208('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x582e3b},getCustomFields(_0x57f49[_0x8208('0x4c')],_0xa8dae2,_0x57f49[_0x8208('0x46')])),'headers':{'Authorization':_0x8208('0x1c')+_0x4c8023,'OData-Version':_0x8208('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x30fff5);})[_0x8208('0x14')](function(_0x381ecc){var _0x39178c=_0x381ecc[_0x8208('0x2f')][_0x8208('0x30')];var _0x3e5e85=_0x39178c[_0x8208('0x43')](_0x39178c[_0x8208('0x31')]('(')+0x1,_0x39178c['lastIndexOf'](')'));_0x16c070[_0x8208('0x52')]=_0x3e5e85;_0x1edb86(_0x16c070);})[_0x8208('0x16')](function(_0x273caf){_0x527153(_0x273caf[_0x8208('0x19')]);});});}function emit(_0xa569f2,_0x5e392c,_0x4f3e0b,_0x955bab){var _0x48eff3={'uri':util['format'](_0x8208('0x53'),_0xa569f2,_0x4f3e0b,_0x955bab)};io['to'](util[_0x8208('0x54')](_0x8208('0x55'),_0x5e392c))[_0x8208('0x56')]('trigger:browser:url',_0x48eff3);}exports['cs']=function(_0x464c8e,_0x4ad726,_0x31072a,_0x402b03,_0x5b9c28,_0x1db2ab,_0xc7cf50,_0x38045a){var _0x1aef60={};_0x1db2ab['remoteUri']=_0x1db2ab[_0x8208('0xb')]?intUtil[_0x8208('0x57')](_0x1db2ab[_0x8208('0xd')][_0x8208('0xe')]):intUtil['stripTrailingSlash'](_0x1db2ab[_0x8208('0xc')]);_0x1db2ab[_0x8208('0x58')]=intUtil['stripTrailingSlash'](_0x1db2ab[_0x8208('0x58')]);_0x1aef60[_0x8208('0x4e')]=_0x38045a===_0x8208('0x4f')||_0x38045a===_0x8208('0x59')?_0x8208('0x4f'):'outbound';var _0x5edcf3=_0x1db2ab[_0x8208('0xb')]?util['format']('%s/api/data/v9.0/',_0x1db2ab['CloudProvider'][_0x8208('0xe')]):util[_0x8208('0x54')]('%s/api/data/v9.0/',_0x1db2ab[_0x8208('0xc')]);var _0x10696d=util[_0x8208('0x54')](_0x8208('0x5a'),_0x1db2ab['tenantId']);var _0x5470c4=util[_0x8208('0x54')](_0x8208('0x5b'),_0x1db2ab['serverUrl'],_0x4ad726[_0x8208('0x5c')],md5(_0x4ad726[_0x8208('0x5c')]));if(_0x5b9c28&&_0x5b9c28[_0x8208('0x5d')]){logger[_0x8208('0x22')]('[QUEUE]',_0x8208('0x5e'));_0x4ad726['recordingURL']=_0x5470c4;}else if(_0xc7cf50&&_0xc7cf50[_0x8208('0x5f')]&&_0xc7cf50['recordingFormat']!==_0x8208('0x60')){logger['info'](_0x8208('0x61'),_0x8208('0x5e'));_0x4ad726[_0x8208('0x62')]=_0x5470c4;}else{_0x4ad726[_0x8208('0x62')]='';}return getUser(_0x1aef60,_0x1db2ab,_0x402b03,_0x10696d,_0x5edcf3,_0x38045a)[_0x8208('0x14')](function(_0x68a660){logger[_0x8208('0x22')]('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x63'),_0x68a660[_0x8208('0x25')]);logger['info']('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x64'),_0x68a660[_0x8208('0x28')]);return getEndUser(_0x68a660,_0x1db2ab,_0x10696d,_0x5edcf3,_0x4ad726,_0x38045a,_0x31072a[_0x8208('0x65')],_0x31072a['additionalSearchContact']);})[_0x8208('0x14')](function(_0x1bcdaa){logger['info']('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x66'),_0x1bcdaa['enduserId']);logger[_0x8208('0x22')]('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x67'),_0x4ad726['calleridnum']);return getTicket(_0x1bcdaa,_0x1db2ab,_0x10696d,_0x5edcf3,_0x4ad726,_0x31072a,_0x38045a);})[_0x8208('0x14')](function(_0x4e043){logger[_0x8208('0x22')](util[_0x8208('0x54')]('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x68'),_0x31072a['ticketType'],_0x4e043[_0x8208('0x52')]));logger['info'](util[_0x8208('0x54')]('['+_0x38045a[_0x8208('0x23')]()+_0x8208('0x69'),_0x38045a));if(_0x38045a!==_0x8208('0x59')&&_0x31072a[_0x8208('0x6a')]){logger[_0x8208('0x22')]('['+_0x38045a[_0x8208('0x23')]()+']',_0x8208('0x6b'));emit(_0x1db2ab[_0x8208('0xc')],_0x402b03[_0x8208('0x6c')],_0x31072a[_0x8208('0x46')],_0x4e043[_0x8208('0x52')]);}})[_0x8208('0x16')](function(_0x1d84ec){logger[_0x8208('0x17')]('['+_0x38045a['toUpperCase']()+_0x8208('0x6d'),_0x1d84ec[_0x8208('0x19')]);console[_0x8208('0x17')](_0x8208('0x6e'),_0x1d84ec);});}; \ No newline at end of file +var _0x3345=['clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','userEmail','length','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','Subjects','getString','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','Descriptions','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data5','POST'];(function(_0xc1a7d3,_0x6ac180){var _0x576e8d=function(_0x46d9cb){while(--_0x46d9cb){_0xc1a7d3['push'](_0xc1a7d3['shift']());}};_0x576e8d(++_0x6ac180);}(_0x3345,0xce));var _0x5334=function(_0x1ec113,_0x5bc007){_0x1ec113=_0x1ec113-0x0;var _0x3e30d7=_0x3345[_0x1ec113];return _0x3e30d7;};'use strict';var _=require(_0x5334('0x0'));var rp=require('request-promise');var util=require(_0x5334('0x1'));var intUtil=require(_0x5334('0x2'));var md5=require(_0x5334('0x3'));var Redis=require(_0x5334('0x4'));var logger=require('../../../../config/logger')(_0x5334('0x5'));var config=require(_0x5334('0x6'));config[_0x5334('0x7')]=_['defaults'](config['redis'],{'host':_0x5334('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5334('0x7')]));function getAuthToken(_0x1d2bd2,_0x2a6e8d,_0x22565e){if(_0x1d2bd2[_0x5334('0x9')]){_0x1d2bd2[_0x5334('0xa')]=_0x1d2bd2[_0x5334('0xb')][_0x5334('0xc')];_0x1d2bd2[_0x5334('0xd')]=_0x1d2bd2[_0x5334('0xb')]['data2'];return Promise['resolve'](_0x1d2bd2[_0x5334('0xb')][_0x5334('0xe')]);}var _0x1c8526={'method':_0x5334('0xf'),'uri':_0x2a6e8d,'form':{'client_id':_0x1d2bd2[_0x5334('0x10')],'resource':_0x1d2bd2[_0x5334('0xa')],'username':_0x1d2bd2[_0x5334('0x11')],'password':_0x1d2bd2[_0x5334('0x12')],'grant_type':'password','client_secret':_0x1d2bd2[_0x5334('0x13')]},'json':!![]};return rp(_0x1c8526)[_0x5334('0x14')](function(_0x308fd2){return _0x308fd2[_0x5334('0x15')];})[_0x5334('0x16')](function(_0x195ec2){logger[_0x5334('0x17')]('['+[_0x22565e[_0x5334('0x18')]()]+_0x5334('0x19'));return _0x195ec2[_0x5334('0x1a')];});}function getUser(_0x4d40bb,_0x27ad37,_0x4f652c,_0x3c2f18,_0x2831c4,_0x33c251){return new Promise(function(_0x17dda3,_0x2d19b9){return getAuthToken(_0x27ad37,_0x3c2f18,_0x33c251)['then'](function(_0xdbdc44){var _0x396e28={'method':_0x5334('0x1b'),'uri':_0x2831c4+_0x5334('0x1c'),'headers':{'Authorization':_0x5334('0x1d')+_0xdbdc44,'OData-Version':_0x5334('0x1e')},'json':!![]};return rp(_0x396e28);})[_0x5334('0x14')](function(_0x30c6af){var _0x533530=_0x30c6af[_0x5334('0x1f')];var _0x32c5eb=![];var _0x1ae209=null;if(!_[_0x5334('0x20')](_0x4f652c)){if(intUtil['validateEmail'](_0x4f652c[_0x5334('0x21')])){_0x4d40bb['userEmail']=_0x4f652c[_0x5334('0x21')];for(_0x1ae209=0x0;_0x1ae209<_0x533530['length'];_0x1ae209++){if(_0x533530[_0x1ae209]['internalemailaddress']===_0x4f652c[_0x5334('0x21')]&&!_0x533530[_0x1ae209][_0x5334('0x22')]){_0x32c5eb=!![];logger['info']('['+[_0x33c251[_0x5334('0x18')]()]+_0x5334('0x23')+_0x533530[_0x1ae209][_0x5334('0x24')]+'!');_0x4d40bb[_0x5334('0x25')]=_0x533530[_0x1ae209][_0x5334('0x24')];}}}}if(!_0x32c5eb){logger[_0x5334('0x26')]('['+[_0x33c251[_0x5334('0x18')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4d40bb[_0x5334('0x27')]=_0x27ad37[_0x5334('0x11')];for(_0x1ae209=0x0;_0x1ae209<_0x533530[_0x5334('0x28')];_0x1ae209++){if(_0x533530[_0x1ae209][_0x5334('0x29')]===_0x27ad37[_0x5334('0x11')]){_0x4d40bb[_0x5334('0x25')]=_0x533530[_0x1ae209][_0x5334('0x24')];}}}_0x17dda3(_0x4d40bb);})[_0x5334('0x16')](function(_0x2f2171){_0x2d19b9(_0x2f2171[_0x5334('0x1a')]);});});}function createEndUser(_0x40d1d3,_0x3e4c87,_0x40279d,_0x3c361e,_0x52d53a,_0x33ae55,_0x3d1a00){return new Promise(function(_0x145ce7,_0x4b07a1){return getAuthToken(_0x3e4c87,_0x40279d,_0x33ae55)['then'](function(_0x194d2e){var _0xc50cf2=_0x33ae55[_0x5334('0x2a')]()===_0x5334('0x2b')?_0x52d53a[_0x5334('0x2c')]:_0x52d53a[_0x5334('0x2d')];var _0x3ea395={'method':_0x5334('0xf'),'uri':_0x3c361e+'contacts','body':{'fullname':_0xc50cf2,'firstname':_0xc50cf2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5334('0x2e')+_0x40d1d3[_0x5334('0x25')]+')'},'headers':{'Authorization':_0x5334('0x1d')+_0x194d2e,'OData-Version':_0x5334('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x3ea395[_0x5334('0x2f')][_0x3d1a00]=_0xc50cf2;return rp(_0x3ea395);})['then'](function(_0x5bd5d5){var _0x193b0d=_0x5bd5d5[_0x5334('0x30')][_0x5334('0x31')];var _0x435b89=_0x193b0d[_0x5334('0x32')](_0x193b0d[_0x5334('0x33')]('(')+0x1,_0x193b0d[_0x5334('0x33')](')'));_0x40d1d3[_0x5334('0x34')]=_0x435b89;_0x145ce7(_0x40d1d3);})[_0x5334('0x16')](function(_0x956948){_0x4b07a1(_0x956948[_0x5334('0x1a')]);});});}function getEndUser(_0x19d12a,_0x56e744,_0x148370,_0x40b996,_0x11b8da,_0x7c4c68,_0x990a40,_0x4911fd){var _0x4595c3=_0x7c4c68['toLowerCase']()===_0x5334('0x2b')?_0x11b8da[_0x5334('0x2c')]:_0x11b8da['calleridnum'];return getAuthToken(_0x56e744,_0x148370,_0x7c4c68)['then'](function(_0x57eb75){_0x4911fd=_0x4911fd?_0x4911fd:_0x5334('0x35');var _0x14ffae={'method':_0x5334('0x1b'),'uri':_0x40b996+_0x5334('0x36')+_0x4911fd+_0x5334('0x37')+_0x4911fd+_0x5334('0x38')+_0x4595c3['replace']('+',_0x5334('0x39'))+'\x27','headers':{'Authorization':_0x5334('0x1d')+_0x57eb75,'If-None-Match':null,'OData-Version':_0x5334('0x1e')},'json':!![]};return rp(_0x14ffae);})[_0x5334('0x14')](function(_0xdc558d){var _0x306719=![];if(!_0xdc558d)return _0x306719;var _0x3565ea=_0xdc558d['value'];for(var _0x20328a=0x0;_0x20328a<_0x3565ea[_0x5334('0x28')];_0x20328a++){if(_0x3565ea[_0x20328a][_0x4911fd]===_0x4595c3){_0x306719=!![];_0x19d12a[_0x5334('0x34')]=_0x3565ea[_0x20328a][_0x5334('0x3a')];}}return _0x306719;})[_0x5334('0x14')](function(_0x3559d6){if(_0x3559d6)return _0x19d12a;if(_0x990a40===_0x5334('0x3b')){logger[_0x5334('0x26')]('['+[_0x7c4c68[_0x5334('0x18')]()]+_0x5334('0x3c'));return _0x19d12a;}return createEndUser(_0x19d12a,_0x56e744,_0x148370,_0x40b996,_0x11b8da,_0x7c4c68,_0x4911fd)[_0x5334('0x14')](function(_0x2066f0){logger[_0x5334('0x26')]('['+[_0x7c4c68[_0x5334('0x18')]()]+_0x5334('0x3d'),_0x2066f0[_0x5334('0x34')]);return _0x2066f0;});});}function getCustomFields(_0x4cfd73,_0x4c0115,_0x3cf342){var _0x291768={};if(_0x4cfd73[_0x5334('0x28')]>0x0){_['forEach'](_0x4cfd73,function(_0x3d7c50){if(_['includes']([_0x5334('0x3e'),_0x5334('0x3f')],_0x3d7c50[_0x5334('0x40')])&&_0x3d7c50[_0x5334('0x41')]&&!_0x3d7c50[_0x5334('0x42')]){var _0x1b685b=_0x3d7c50[_0x5334('0x43')][_0x5334('0x2a')]();var _0x1a1fd9=_0x1b685b[_0x5334('0x32')](0x0,_0x1b685b[_0x5334('0x44')]('_'));var _0x5643cf=_0x1b685b[_0x5334('0x32')](_0x1b685b['indexOf']('_')+0x1);if(_0x1a1fd9===_0x3cf342){_0x291768[_0x5643cf]=_0x3d7c50[_0x5334('0x45')];}}});}return _0x291768;}function getTicket(_0x4e8421,_0x3c8423,_0x494bfd,_0xc9d781,_0x4b7e36,_0x48d6f0,_0x3b2dbd){return new Promise(function(_0x387932,_0x472cc3){var _0x1a1db3;return getAuthToken(_0x3c8423,_0x494bfd,_0x3b2dbd)[_0x5334('0x14')](function(_0x188019){if(_0x48d6f0[_0x5334('0x46')]===_0x5334('0x47')){_0x1a1db3={'method':_0x5334('0xf'),'uri':_0xc9d781+_0x5334('0x48'),'body':Object['assign']({},{'title':intUtil['getString'](_0x48d6f0[_0x5334('0x49')],_0x4b7e36,'\x20'),'description':intUtil[_0x5334('0x4a')](_0x48d6f0['Descriptions'],_0x4b7e36,'\x0a'),'customerid_contact@odata.bind':_0x4e8421['enduserId']?_0x5334('0x4b')+_0x4e8421[_0x5334('0x34')]+')':undefined,'ownerid@odata.bind':_0x5334('0x2e')+_0x4e8421[_0x5334('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x48d6f0[_0x5334('0x4c')],_0x4b7e36,_0x48d6f0[_0x5334('0x46')])),'headers':{'Authorization':_0x5334('0x1d')+_0x188019,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x48d6f0['ticketType']===_0x5334('0x4d')){var _0x4cce55=_0x4e8421['enduserId']?[{'partyid_systemuser@odata.bind':_0x5334('0x2e')+_0x4e8421['userId']+')','participationtypemask':_0x4e8421[_0x5334('0x4e')]===_0x5334('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x5334('0x4b')+_0x4e8421[_0x5334('0x34')]+')','participationtypemask':_0x4e8421[_0x5334('0x4e')]===_0x5334('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5334('0x2e')+_0x4e8421[_0x5334('0x25')]+')','participationtypemask':_0x4e8421['callDirection']===_0x5334('0x4f')?0x2:0x1}];_0x1a1db3={'method':_0x5334('0xf'),'uri':_0xc9d781+_0x5334('0x50'),'body':Object[_0x5334('0x51')]({},{'subject':intUtil[_0x5334('0x4a')](_0x48d6f0[_0x5334('0x49')],_0x4b7e36,'\x20'),'phonenumber':String(_0x4b7e36[_0x5334('0x2d')]),'description':intUtil[_0x5334('0x4a')](_0x48d6f0[_0x5334('0x52')],_0x4b7e36,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4e8421[_0x5334('0x34')]?_0x5334('0x4b')+_0x4e8421[_0x5334('0x34')]+')':undefined,'ownerid@odata.bind':_0x5334('0x2e')+_0x4e8421[_0x5334('0x25')]+')','directioncode':_0x4e8421[_0x5334('0x4e')]===_0x5334('0x4f')?![]:!![],'phonecall_activity_parties':_0x4cce55},getCustomFields(_0x48d6f0[_0x5334('0x4c')],_0x4b7e36,_0x48d6f0[_0x5334('0x46')])),'headers':{'Authorization':_0x5334('0x1d')+_0x188019,'OData-Version':_0x5334('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1a1db3);})[_0x5334('0x14')](function(_0x571541){var _0x1d6a62=_0x571541[_0x5334('0x30')][_0x5334('0x31')];var _0x55c93b=_0x1d6a62[_0x5334('0x32')](_0x1d6a62[_0x5334('0x33')]('(')+0x1,_0x1d6a62['lastIndexOf'](')'));_0x4e8421['ticketId']=_0x55c93b;_0x387932(_0x4e8421);})['catch'](function(_0x17e58a){_0x472cc3(_0x17e58a[_0x5334('0x1a')]);});});}function emit(_0x104853,_0x556a53,_0x392128,_0x57c2a5){var _0x159df0={'uri':util[_0x5334('0x53')](_0x5334('0x54'),_0x104853,_0x392128,_0x57c2a5)};io['to'](util['format']('user:%s',_0x556a53))[_0x5334('0x55')]('trigger:browser:url',_0x159df0);}exports['cs']=function(_0x1e515b,_0x4021e0,_0xe07245,_0x8fc4e1,_0x1d2151,_0x5f1bc4,_0x143742,_0x3824d2){var _0x435b24={};_0x5f1bc4[_0x5334('0xa')]=_0x5f1bc4[_0x5334('0x9')]?intUtil[_0x5334('0x56')](_0x5f1bc4[_0x5334('0xb')]['data7']):intUtil[_0x5334('0x56')](_0x5f1bc4[_0x5334('0xa')]);_0x5f1bc4[_0x5334('0x57')]=intUtil[_0x5334('0x56')](_0x5f1bc4[_0x5334('0x57')]);_0x435b24[_0x5334('0x4e')]=_0x3824d2===_0x5334('0x4f')||_0x3824d2===_0x5334('0x58')?'queue':'outbound';var _0x2cd66f=_0x5f1bc4['modernAuthentication']?util['format']('%s/api/data/v9.0/',_0x5f1bc4['CloudProvider'][_0x5334('0xc')]):util[_0x5334('0x53')](_0x5334('0x59'),_0x5f1bc4[_0x5334('0xa')]);var _0x517d11=util[_0x5334('0x53')](_0x5334('0x5a'),_0x5f1bc4[_0x5334('0xd')]);var _0x37f808=util[_0x5334('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f1bc4[_0x5334('0x57')],_0x4021e0[_0x5334('0x5b')],md5(_0x4021e0['uniqueid']));if(_0x1d2151&&_0x1d2151[_0x5334('0x5c')]){logger[_0x5334('0x26')](_0x5334('0x5d'),_0x5334('0x5e'));_0x4021e0[_0x5334('0x5f')]=_0x37f808;}else if(_0x143742&&_0x143742['recordingFormat']&&_0x143742[_0x5334('0x60')]!==_0x5334('0x61')){logger[_0x5334('0x26')](_0x5334('0x62'),_0x5334('0x5e'));_0x4021e0['recordingURL']=_0x37f808;}else{_0x4021e0[_0x5334('0x5f')]='';}return getUser(_0x435b24,_0x5f1bc4,_0x8fc4e1,_0x517d11,_0x2cd66f,_0x3824d2)[_0x5334('0x14')](function(_0x382927){logger['info']('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x63'),_0x382927[_0x5334('0x25')]);logger['info']('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x64'),_0x382927[_0x5334('0x27')]);return getEndUser(_0x382927,_0x5f1bc4,_0x517d11,_0x2cd66f,_0x4021e0,_0x3824d2,_0xe07245['moduleCreate'],_0xe07245[_0x5334('0x65')]);})[_0x5334('0x14')](function(_0x1710bf){logger[_0x5334('0x26')]('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x66'),_0x1710bf['enduserId']);logger['info']('['+_0x3824d2['toUpperCase']()+_0x5334('0x67'),_0x4021e0[_0x5334('0x2d')]);return getTicket(_0x1710bf,_0x5f1bc4,_0x517d11,_0x2cd66f,_0x4021e0,_0xe07245,_0x3824d2);})['then'](function(_0x328ee1){logger['info'](util[_0x5334('0x53')]('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x68'),_0xe07245[_0x5334('0x46')],_0x328ee1['ticketId']));logger['info'](util[_0x5334('0x53')]('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x69'),_0x3824d2));if(_0x3824d2!=='unmanaged'&&_0xe07245[_0x5334('0x6a')]){logger[_0x5334('0x26')]('['+_0x3824d2[_0x5334('0x18')]()+']',_0x5334('0x6b'));emit(_0x5f1bc4[_0x5334('0xa')],_0x8fc4e1[_0x5334('0x6c')],_0xe07245[_0x5334('0x46')],_0x328ee1[_0x5334('0x6d')]);}})[_0x5334('0x16')](function(_0x5e4705){logger['error']('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x6e'),_0x5e4705[_0x5334('0x1a')]);console[_0x5334('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x5e4705);});}; \ 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 35608c5..3b36f43 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 _0x4aee=['push','content','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','catch','unmanaged','Authorization','lastevent','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','
','name','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','forEach','includes','string','picklist','type','nameField','customField','idField'];(function(_0x37435c,_0x409780){var _0x2c26f0=function(_0x57c932){while(--_0x57c932){_0x37435c['push'](_0x37435c['shift']());}};_0x2c26f0(++_0x409780);}(_0x4aee,0x76));var _0xe4ae=function(_0x39ea3d,_0x36b866){_0x39ea3d=_0x39ea3d-0x0;var _0x940f78=_0x4aee[_0x39ea3d];return _0x940f78;};'use strict';var _=require(_0xe4ae('0x0'));var rp=require(_0xe4ae('0x1'));var md5=require(_0xe4ae('0x2'));var util=require(_0xe4ae('0x3'));var Redis=require('ioredis');var intUtil=require(_0xe4ae('0x4'));var config=require(_0xe4ae('0x5'));var logger=require(_0xe4ae('0x6'))('freshdesk');config[_0xe4ae('0x7')]=_[_0xe4ae('0x8')](config[_0xe4ae('0x7')],{'host':_0xe4ae('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4ae('0x7')]));var headers={'Content-Type':_0xe4ae('0xa'),'Accept':_0xe4ae('0xa')};function emit(_0x2f086c,_0x123f51,_0x1bac1f){io['to'](_0x2f086c)['emit'](_0x123f51,_0x1bac1f);}function getTicket(_0x5d5c7d,_0x466dce,_0x436441,_0x3fb9a9,_0x1ca5f6){logger[_0xe4ae('0xb')](_0xe4ae('0xc'));var _0x58fe0c=_[_0xe4ae('0xd')]({'responder_id':_0x466dce['id'],'requester_id':_0x436441['id'],'name':util[_0xe4ae('0xe')](_0xe4ae('0xf'),_0x1ca5f6[_0xe4ae('0x10')]),'phone':_0x1ca5f6[_0xe4ae('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3fb9a9[_0xe4ae('0x12')],_0x1ca5f6,'\x20'),'description':intUtil[_0xe4ae('0x13')](_0x3fb9a9['Descriptions'],_0x1ca5f6,_0xe4ae('0x14')),'tags':getTags(_0x3fb9a9['Tags'],_0xe4ae('0x15'))},getCustomFields(_0x3fb9a9['Fields'],_0x1ca5f6));_0x58fe0c[_0xe4ae('0x16')]=_['mapValues'](_['keyBy'](_0x58fe0c['custom_fields'],'id'),_0xe4ae('0x17'));return request({'uri':util[_0xe4ae('0xe')](_0xe4ae('0x18'),_0x5d5c7d[_0xe4ae('0x19')]),'method':_0xe4ae('0x1a'),'body':_0x58fe0c})[_0xe4ae('0x1b')](function(_0x4e2a2f){logger['info'](_0xe4ae('0x1c'));return _0x4e2a2f;});}function getUser(_0x8c4a25,_0x5c208b){if(intUtil[_0xe4ae('0x1d')](_0x5c208b)){return request({'uri':util['format'](_0xe4ae('0x1e'),_0x8c4a25['remoteUri']),'qs':{'email':_0x5c208b}})[_0xe4ae('0x1b')](function(_0x2aa2ac){if(_0x2aa2ac[_0xe4ae('0x1f')]){logger[_0xe4ae('0xb')](_0xe4ae('0x20'));return _[_0xe4ae('0x21')](_0x2aa2ac,function(_0x5dd0ec){return _0x5dd0ec[_0xe4ae('0x22')][_0xe4ae('0x23')]===_0x5c208b;});}else{logger[_0xe4ae('0xb')](_0xe4ae('0x24'));return request({'uri':util['format'](_0xe4ae('0x25'),_0x8c4a25[_0xe4ae('0x19')])})[_0xe4ae('0x1b')](function(_0x31b297){logger[_0xe4ae('0xb')](_0xe4ae('0x26'));return _0x31b297;});}});}else{logger[_0xe4ae('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xe4ae('0x25'),_0x8c4a25[_0xe4ae('0x19')])})[_0xe4ae('0x1b')](function(_0xa6aa08){logger[_0xe4ae('0xb')](_0xe4ae('0x26'));return _0xa6aa08;});}}function getEndUser(_0x3cb90e,_0x98dc7,_0x19300f){logger['info'](_0xe4ae('0x27'),_0x19300f);return request({'uri':util['format'](_0xe4ae('0x28'),_0x3cb90e['remoteUri']),'qs':{'phone':_0x19300f}})[_0xe4ae('0x1b')](function(_0x798203){if(_0x798203['length']){logger['info']('Enduser\x20found!');return _['find'](_0x798203,{'phone':_0x19300f});}else{logger[_0xe4ae('0xb')](_0xe4ae('0x29'));return request({'uri':util[_0xe4ae('0xe')](_0xe4ae('0x28'),_0x3cb90e['remoteUri']),'method':_0xe4ae('0x1a'),'body':{'name':_0x98dc7,'phone':_0x19300f}})[_0xe4ae('0x1b')](function(_0x1fc922){logger[_0xe4ae('0xb')](_0xe4ae('0x2a'));return _0x1fc922;});}});}function getAuth(_0x406be1){return util[_0xe4ae('0xe')](_0xe4ae('0x2b'),new Buffer(_0x406be1[_0xe4ae('0x2c')]+':X')[_0xe4ae('0x2d')]('base64'));}function request(_0xffbfe){logger[_0xe4ae('0x2e')](_0xe4ae('0x2f'),JSON['stringify'](_0xffbfe));return rp(_[_0xe4ae('0x8')](_0xffbfe,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5efa6b,_0x2fce4b){var _0x124c93=[];if(_0x5efa6b&&_0x5efa6b['length']>0x0){_0x124c93=_['map'](_0x5efa6b,_0x2fce4b);}return _0x124c93;}function getCustomFields(_0x5dc34b,_0x4845a4){var _0x13aa4f=[];var _0x47bf35={'custom_fields':[]};if(_0x5dc34b['length']>0x0){_[_0xe4ae('0x30')](_0x5dc34b,function(_0x85570){if(_[_0xe4ae('0x31')]([_0xe4ae('0x32'),_0xe4ae('0x33')],_0x85570[_0xe4ae('0x34')])&&_0x85570[_0xe4ae('0x35')]&&!_0x85570[_0xe4ae('0x36')]){_0x47bf35[_0x85570[_0xe4ae('0x35')]['toLowerCase']()]=_0x85570['content'][_0xe4ae('0x2d')]();}else if(_['includes'](['string',_0xe4ae('0x33')],_0x85570['type'])&&_0x85570[_0xe4ae('0x37')]&&_0x85570[_0xe4ae('0x36')]){_0x47bf35[_0xe4ae('0x16')][_0xe4ae('0x38')]({'id':_0x85570['idField'],'value':_0x85570[_0xe4ae('0x39')][_0xe4ae('0x2d')]()});}else if(_0x85570[_0xe4ae('0x34')]==='variable'&&_0x85570[_0xe4ae('0x3a')]&&_0x85570[_0xe4ae('0x37')]&&_0x85570['customField']){_0x4845a4[_0x85570[_0xe4ae('0x3a')]]&&_0x47bf35[_0xe4ae('0x16')][_0xe4ae('0x38')]({'id':_0x85570['idField'],'value':_0x4845a4[_0x85570[_0xe4ae('0x3a')]][_0xe4ae('0x2d')]()});}else if(_0x85570[_0xe4ae('0x34')]===_0xe4ae('0x3b')&&_0x85570[_0xe4ae('0x3c')]&&_0x85570[_0xe4ae('0x3c')]['name']&&_0x85570[_0xe4ae('0x37')]&&_0x85570[_0xe4ae('0x36')]){_0x4845a4[_0x85570[_0xe4ae('0x3c')]['name'][_0xe4ae('0x3d')]()]&&_0x47bf35[_0xe4ae('0x16')][_0xe4ae('0x38')]({'id':_0x85570[_0xe4ae('0x37')],'value':_0x4845a4[_0x85570[_0xe4ae('0x3c')][_0xe4ae('0x15')]['toLowerCase']()][_0xe4ae('0x2d')]()});}});}return _0x47bf35;}exports[_0xe4ae('0x3e')]=function(_0x502a78,_0x472139,_0x5dc04e,_0x17b1da,_0x5d0f42,_0x513e97){var _0x17bab2,_0x153539;_0x513e97[_0xe4ae('0x19')]=intUtil[_0xe4ae('0x3f')](_0x513e97[_0xe4ae('0x19')]);_0x513e97['serverUrl']=intUtil[_0xe4ae('0x3f')](_0x513e97['serverUrl']);if(_0x5d0f42&&_0x5d0f42[_0xe4ae('0x40')]){logger[_0xe4ae('0xb')](_0xe4ae('0x41'),_0xe4ae('0x42'));_0x472139[_0xe4ae('0x43')]=util[_0xe4ae('0xe')](_0xe4ae('0x44'),_0x513e97[_0xe4ae('0x45')],_0x472139[_0xe4ae('0x46')],md5(_0x472139[_0xe4ae('0x46')]));}else{_0x472139[_0xe4ae('0x43')]='';}headers['Authorization']=getAuth(_0x513e97);return getUser(_0x513e97,_0x17b1da['email'])[_0xe4ae('0x1b')](function(_0x602356){_0x17bab2=_0x602356;logger[_0xe4ae('0xb')](_0xe4ae('0x47'),_0x17bab2['id']);return getEndUser(_0x513e97,_0x472139[_0xe4ae('0x10')],_0x472139[_0xe4ae('0x11')]);})[_0xe4ae('0x1b')](function(_0x290c80){_0x153539=_0x290c80;logger[_0xe4ae('0xb')](_0xe4ae('0x48'),_0x153539['id']);return getTicket(_0x513e97,_0x17bab2,_0x153539,_0x5dc04e,_0x472139);})[_0xe4ae('0x1b')](function(_0x47f452){if(_0x47f452&&_0x47f452['id']){logger['info'](_0xe4ae('0x1c'));logger[_0xe4ae('0xb')](_0xe4ae('0x49'),_0x47f452['id']);logger[_0xe4ae('0xb')]('[QUEUE]',_0xe4ae('0x4a'));emit(util[_0xe4ae('0xe')](_0xe4ae('0x4b'),_0x17b1da[_0xe4ae('0x15')]),_0xe4ae('0x4c'),{'uri':util[_0xe4ae('0xe')]('%s/helpdesk/tickets/%d',_0x513e97[_0xe4ae('0x19')],_0x47f452['id'])});}})['catch'](function(_0x22bd12){logger[_0xe4ae('0x4d')]('[QUEUE]',JSON[_0xe4ae('0x4e')](_0x22bd12));});};exports['outbound']=function(_0x404461,_0x1ca21d,_0x37aeea,_0x2a3ee2,_0x24befd,_0x42c752,_0x4583fd){var _0x283fc6,_0x1a3068;_0x42c752[_0xe4ae('0x19')]=intUtil[_0xe4ae('0x3f')](_0x42c752[_0xe4ae('0x19')]);_0x42c752[_0xe4ae('0x45')]=intUtil['stripTrailingSlash'](_0x42c752[_0xe4ae('0x45')]);if(_0x4583fd&&_0x4583fd[_0xe4ae('0x4f')]&&_0x4583fd[_0xe4ae('0x4f')]!==_0xe4ae('0x50')){logger[_0xe4ae('0xb')](_0xe4ae('0x51'),_0xe4ae('0x42'));_0x1ca21d[_0xe4ae('0x43')]=util['format'](_0xe4ae('0x44'),_0x42c752['serverUrl'],_0x1ca21d[_0xe4ae('0x46')],md5(_0x1ca21d[_0xe4ae('0x46')]));}headers['Authorization']=getAuth(_0x42c752);return getUser(_0x42c752,_0x2a3ee2[_0xe4ae('0x23')])['then'](function(_0x229538){_0x283fc6=_0x229538;logger[_0xe4ae('0xb')](_0xe4ae('0x47'),_0x283fc6['id']);return getEndUser(_0x42c752,_0x1ca21d['destcalleridname'],_0x1ca21d[_0xe4ae('0x52')]);})['then'](function(_0x9ad9ee){_0x1a3068=_0x9ad9ee;logger[_0xe4ae('0xb')](_0xe4ae('0x48'),_0x1a3068['id']);return getTicket(_0x42c752,_0x283fc6,_0x1a3068,_0x37aeea,_0x1ca21d);})[_0xe4ae('0x1b')](function(_0x18abe0){if(_0x18abe0&&_0x18abe0['id']){logger[_0xe4ae('0xb')](_0xe4ae('0x1c'));logger['info'](_0xe4ae('0x49'),_0x18abe0['id']);logger[_0xe4ae('0xb')]('[OUTBOUND]',_0xe4ae('0x4a'));emit(util[_0xe4ae('0xe')](_0xe4ae('0x4b'),_0x2a3ee2[_0xe4ae('0x15')]),_0xe4ae('0x4c'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x42c752[_0xe4ae('0x19')],_0x18abe0['id'])});}})[_0xe4ae('0x53')](function(_0x5d9dd0){logger[_0xe4ae('0x4d')](_0xe4ae('0x51'),JSON[_0xe4ae('0x4e')](_0x5d9dd0));});};exports[_0xe4ae('0x54')]=function(_0x1b22ee,_0x5c0e6e,_0x15ff9a,_0x1f3d25,_0x59bc8f,_0x1146bf){var _0x1fcc66,_0x4f1d2b;_0x1146bf[_0xe4ae('0x19')]=intUtil[_0xe4ae('0x3f')](_0x1146bf[_0xe4ae('0x19')]);_0x1146bf['serverUrl']=intUtil[_0xe4ae('0x3f')](_0x1146bf[_0xe4ae('0x45')]);if(_0x59bc8f&&_0x59bc8f[_0xe4ae('0x40')]){logger['info']('['+_0x5c0e6e['lastevent']['toUpperCase']()+']',_0xe4ae('0x42'));_0x5c0e6e[_0xe4ae('0x43')]=util[_0xe4ae('0xe')](_0xe4ae('0x44'),_0x1146bf[_0xe4ae('0x45')],_0x5c0e6e['uniqueid'],md5(_0x5c0e6e[_0xe4ae('0x46')]));}else{_0x5c0e6e[_0xe4ae('0x43')]='';}headers[_0xe4ae('0x55')]=getAuth(_0x1146bf);return getUser(_0x1146bf,'')[_0xe4ae('0x1b')](function(_0x187727){_0x1fcc66=_0x187727;logger[_0xe4ae('0xb')]('The\x20User\x20ID\x20is:',_0x1fcc66['id']);return getEndUser(_0x1146bf,_0x5c0e6e[_0xe4ae('0x10')],_0x5c0e6e[_0xe4ae('0x11')]);})[_0xe4ae('0x1b')](function(_0x521c4e){_0x4f1d2b=_0x521c4e;logger['info'](_0xe4ae('0x48'),_0x4f1d2b['id']);return getTicket(_0x1146bf,_0x1fcc66,_0x4f1d2b,_0x15ff9a,_0x5c0e6e);})[_0xe4ae('0x1b')](function(_0x1a26a1){if(_0x1a26a1){logger[_0xe4ae('0xb')](_0xe4ae('0x1c'));logger['info'](_0xe4ae('0x49'),_0x1a26a1['id']);}})[_0xe4ae('0x53')](function(_0x42f678){logger[_0xe4ae('0x4d')]('['+_0x5c0e6e[_0xe4ae('0x56')]['toUpperCase']()+']',JSON[_0xe4ae('0x4e')](_0x42f678));});}; \ No newline at end of file +var _0x61f8=['Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','map','forEach','includes','string','picklist','nameField','content','type','idField','customField','push','toString','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','user:%s','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Tags','name','Fields','custom_fields','keyBy','value','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!'];(function(_0x4f0132,_0xd4ba7){var _0x1b3324=function(_0x2ac785){while(--_0x2ac785){_0x4f0132['push'](_0x4f0132['shift']());}};_0x1b3324(++_0xd4ba7);}(_0x61f8,0xe8));var _0x861f=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x61f8[_0x592e40];return _0x5d4288;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x861f('0x0'));var Redis=require(_0x861f('0x1'));var intUtil=require(_0x861f('0x2'));var config=require('../../../../config/environment');var logger=require(_0x861f('0x3'))(_0x861f('0x4'));config[_0x861f('0x5')]=_[_0x861f('0x6')](config[_0x861f('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x861f('0x5')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x24df72,_0x27218f,_0x50eded){io['to'](_0x24df72)[_0x861f('0x7')](_0x27218f,_0x50eded);}function getTicket(_0x1d4ad8,_0x2d05a8,_0x25dd4d,_0x474db7,_0x29e4a5){logger['info'](_0x861f('0x8'));var _0x3cead7=_['merge']({'responder_id':_0x2d05a8['id'],'requester_id':_0x25dd4d['id'],'name':util[_0x861f('0x9')](_0x861f('0xa'),_0x29e4a5[_0x861f('0xb')]),'phone':_0x29e4a5['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x861f('0xc')](_0x474db7['Subjects'],_0x29e4a5,'\x20'),'description':intUtil[_0x861f('0xc')](_0x474db7['Descriptions'],_0x29e4a5,'
'),'tags':getTags(_0x474db7[_0x861f('0xd')],_0x861f('0xe'))},getCustomFields(_0x474db7[_0x861f('0xf')],_0x29e4a5));_0x3cead7[_0x861f('0x10')]=_['mapValues'](_[_0x861f('0x11')](_0x3cead7[_0x861f('0x10')],'id'),_0x861f('0x12'));return request({'uri':util[_0x861f('0x9')]('%s/api/v2/tickets',_0x1d4ad8['remoteUri']),'method':_0x861f('0x13'),'body':_0x3cead7})['then'](function(_0x52fd90){logger[_0x861f('0x14')](_0x861f('0x15'));return _0x52fd90;});}function getUser(_0x160d9d,_0x2138ea){if(intUtil[_0x861f('0x16')](_0x2138ea)){return request({'uri':util[_0x861f('0x9')](_0x861f('0x17'),_0x160d9d[_0x861f('0x18')]),'qs':{'email':_0x2138ea}})[_0x861f('0x19')](function(_0x4404c5){if(_0x4404c5['length']){logger['info'](_0x861f('0x1a'));return _[_0x861f('0x1b')](_0x4404c5,function(_0x20a926){return _0x20a926[_0x861f('0x1c')][_0x861f('0x1d')]===_0x2138ea;});}else{logger[_0x861f('0x14')](_0x861f('0x1e'));return request({'uri':util[_0x861f('0x9')]('%s/api/v2/agents/me',_0x160d9d[_0x861f('0x18')])})[_0x861f('0x19')](function(_0x49bdbe){logger[_0x861f('0x14')]('Admin\x20account\x20selected.');return _0x49bdbe;});}});}else{logger[_0x861f('0x14')](_0x861f('0x1f'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x160d9d[_0x861f('0x18')])})['then'](function(_0x353142){logger[_0x861f('0x14')](_0x861f('0x20'));return _0x353142;});}}function getEndUser(_0x3c7e2e,_0xeb6788,_0x366f93){logger[_0x861f('0x14')](_0x861f('0x21'),_0x366f93);return request({'uri':util[_0x861f('0x9')]('%s/api/v2/contacts',_0x3c7e2e[_0x861f('0x18')]),'qs':{'phone':_0x366f93}})[_0x861f('0x19')](function(_0xf0c58e){if(_0xf0c58e[_0x861f('0x22')]){logger[_0x861f('0x14')](_0x861f('0x23'));return _['find'](_0xf0c58e,{'phone':_0x366f93});}else{logger['info'](_0x861f('0x24'));return request({'uri':util[_0x861f('0x9')](_0x861f('0x25'),_0x3c7e2e[_0x861f('0x18')]),'method':_0x861f('0x13'),'body':{'name':_0xeb6788,'phone':_0x366f93}})[_0x861f('0x19')](function(_0x5e06e6){logger[_0x861f('0x14')](_0x861f('0x26'));return _0x5e06e6;});}});}function getAuth(_0x37cb90){return util[_0x861f('0x9')](_0x861f('0x27'),new Buffer(_0x37cb90[_0x861f('0x28')]+':X')['toString'](_0x861f('0x29')));}function request(_0x413d7f){logger['debug'](_0x861f('0x2a'),JSON[_0x861f('0x2b')](_0x413d7f));return rp(_[_0x861f('0x6')](_0x413d7f,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5a7edb,_0x586268){var _0x295c73=[];if(_0x5a7edb&&_0x5a7edb[_0x861f('0x22')]>0x0){_0x295c73=_[_0x861f('0x2c')](_0x5a7edb,_0x586268);}return _0x295c73;}function getCustomFields(_0xd80697,_0x132dba){var _0x3c0e02=[];var _0x24584f={'custom_fields':[]};if(_0xd80697['length']>0x0){_[_0x861f('0x2d')](_0xd80697,function(_0x49b64a){if(_[_0x861f('0x2e')]([_0x861f('0x2f'),_0x861f('0x30')],_0x49b64a['type'])&&_0x49b64a['nameField']&&!_0x49b64a['customField']){_0x24584f[_0x49b64a[_0x861f('0x31')]['toLowerCase']()]=_0x49b64a[_0x861f('0x32')]['toString']();}else if(_['includes'](['string','picklist'],_0x49b64a[_0x861f('0x33')])&&_0x49b64a[_0x861f('0x34')]&&_0x49b64a[_0x861f('0x35')]){_0x24584f[_0x861f('0x10')][_0x861f('0x36')]({'id':_0x49b64a[_0x861f('0x34')],'value':_0x49b64a[_0x861f('0x32')][_0x861f('0x37')]()});}else if(_0x49b64a[_0x861f('0x33')]===_0x861f('0x38')&&_0x49b64a[_0x861f('0x39')]&&_0x49b64a[_0x861f('0x34')]&&_0x49b64a[_0x861f('0x35')]){_0x132dba[_0x49b64a[_0x861f('0x39')]]&&_0x24584f[_0x861f('0x10')]['push']({'id':_0x49b64a[_0x861f('0x34')],'value':_0x132dba[_0x49b64a[_0x861f('0x39')]][_0x861f('0x37')]()});}else if(_0x49b64a[_0x861f('0x33')]===_0x861f('0x3a')&&_0x49b64a[_0x861f('0x3b')]&&_0x49b64a[_0x861f('0x3b')][_0x861f('0xe')]&&_0x49b64a[_0x861f('0x34')]&&_0x49b64a[_0x861f('0x35')]){_0x132dba[_0x49b64a[_0x861f('0x3b')][_0x861f('0xe')]['toLowerCase']()]&&_0x24584f[_0x861f('0x10')][_0x861f('0x36')]({'id':_0x49b64a[_0x861f('0x34')],'value':_0x132dba[_0x49b64a[_0x861f('0x3b')][_0x861f('0xe')][_0x861f('0x3c')]()][_0x861f('0x37')]()});}});}return _0x24584f;}exports[_0x861f('0x3d')]=function(_0x31c57e,_0x5355e0,_0x4ccdcb,_0x8c57b7,_0xdb94a,_0x524b62){var _0x3a17f7,_0x1521fb;_0x524b62[_0x861f('0x18')]=intUtil[_0x861f('0x3e')](_0x524b62[_0x861f('0x18')]);_0x524b62[_0x861f('0x3f')]=intUtil['stripTrailingSlash'](_0x524b62['serverUrl']);if(_0xdb94a&&_0xdb94a[_0x861f('0x40')]){logger['info'](_0x861f('0x41'),_0x861f('0x42'));_0x5355e0[_0x861f('0x43')]=util[_0x861f('0x9')](_0x861f('0x44'),_0x524b62[_0x861f('0x3f')],_0x5355e0[_0x861f('0x45')],md5(_0x5355e0[_0x861f('0x45')]));}else{_0x5355e0[_0x861f('0x43')]='';}headers[_0x861f('0x46')]=getAuth(_0x524b62);return getUser(_0x524b62,_0x8c57b7[_0x861f('0x1d')])['then'](function(_0x572cca){_0x3a17f7=_0x572cca;logger[_0x861f('0x14')](_0x861f('0x47'),_0x3a17f7['id']);return getEndUser(_0x524b62,_0x5355e0[_0x861f('0xb')],_0x5355e0[_0x861f('0x48')]);})[_0x861f('0x19')](function(_0x39517f){_0x1521fb=_0x39517f;logger[_0x861f('0x14')](_0x861f('0x49'),_0x1521fb['id']);return getTicket(_0x524b62,_0x3a17f7,_0x1521fb,_0x4ccdcb,_0x5355e0);})['then'](function(_0x418b93){if(_0x418b93&&_0x418b93['id']){logger['info'](_0x861f('0x15'));logger[_0x861f('0x14')]('The\x20Ticket\x20ID\x20is:',_0x418b93['id']);logger[_0x861f('0x14')](_0x861f('0x41'),_0x861f('0x4a'));emit(util['format']('user:%s',_0x8c57b7[_0x861f('0xe')]),'trigger:browser:url',{'uri':util[_0x861f('0x9')](_0x861f('0x4b'),_0x524b62[_0x861f('0x18')],_0x418b93['id'])});}})['catch'](function(_0x31e968){logger[_0x861f('0x4c')](_0x861f('0x41'),JSON[_0x861f('0x2b')](_0x31e968));});};exports[_0x861f('0x4d')]=function(_0x519ff6,_0x5b6188,_0x2185de,_0x95265d,_0x4680af,_0x2fec57,_0x801ef1){var _0x4dc184,_0x2549d0;_0x2fec57[_0x861f('0x18')]=intUtil[_0x861f('0x3e')](_0x2fec57[_0x861f('0x18')]);_0x2fec57['serverUrl']=intUtil['stripTrailingSlash'](_0x2fec57[_0x861f('0x3f')]);if(_0x801ef1&&_0x801ef1[_0x861f('0x4e')]&&_0x801ef1[_0x861f('0x4e')]!==_0x861f('0x4f')){logger['info'](_0x861f('0x50'),_0x861f('0x42'));_0x5b6188['recordingURL']=util[_0x861f('0x9')](_0x861f('0x44'),_0x2fec57[_0x861f('0x3f')],_0x5b6188[_0x861f('0x45')],md5(_0x5b6188[_0x861f('0x45')]));}headers[_0x861f('0x46')]=getAuth(_0x2fec57);return getUser(_0x2fec57,_0x95265d[_0x861f('0x1d')])[_0x861f('0x19')](function(_0x1c824b){_0x4dc184=_0x1c824b;logger[_0x861f('0x14')]('The\x20User\x20ID\x20is:',_0x4dc184['id']);return getEndUser(_0x2fec57,_0x5b6188['destcalleridname'],_0x5b6188[_0x861f('0x51')]);})[_0x861f('0x19')](function(_0x4011a6){_0x2549d0=_0x4011a6;logger[_0x861f('0x14')](_0x861f('0x49'),_0x2549d0['id']);return getTicket(_0x2fec57,_0x4dc184,_0x2549d0,_0x2185de,_0x5b6188);})['then'](function(_0x2cd2f7){if(_0x2cd2f7&&_0x2cd2f7['id']){logger[_0x861f('0x14')](_0x861f('0x15'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2cd2f7['id']);logger[_0x861f('0x14')](_0x861f('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x861f('0x9')](_0x861f('0x52'),_0x95265d['name']),_0x861f('0x53'),{'uri':util['format'](_0x861f('0x4b'),_0x2fec57[_0x861f('0x18')],_0x2cd2f7['id'])});}})[_0x861f('0x54')](function(_0x219ab2){logger[_0x861f('0x4c')](_0x861f('0x50'),JSON['stringify'](_0x219ab2));});};exports[_0x861f('0x55')]=function(_0x6c5641,_0x277abe,_0x2c06b8,_0x523656,_0x32af36,_0x5de384){var _0x5eacb6,_0x183eb8;_0x5de384[_0x861f('0x18')]=intUtil['stripTrailingSlash'](_0x5de384['remoteUri']);_0x5de384['serverUrl']=intUtil['stripTrailingSlash'](_0x5de384[_0x861f('0x3f')]);if(_0x32af36&&_0x32af36[_0x861f('0x40')]){logger[_0x861f('0x14')]('['+_0x277abe[_0x861f('0x56')]['toUpperCase']()+']',_0x861f('0x42'));_0x277abe[_0x861f('0x43')]=util[_0x861f('0x9')](_0x861f('0x44'),_0x5de384['serverUrl'],_0x277abe['uniqueid'],md5(_0x277abe[_0x861f('0x45')]));}else{_0x277abe[_0x861f('0x43')]='';}headers['Authorization']=getAuth(_0x5de384);return getUser(_0x5de384,'')['then'](function(_0x5701cb){_0x5eacb6=_0x5701cb;logger[_0x861f('0x14')]('The\x20User\x20ID\x20is:',_0x5eacb6['id']);return getEndUser(_0x5de384,_0x277abe[_0x861f('0xb')],_0x277abe[_0x861f('0x48')]);})[_0x861f('0x19')](function(_0x2bc59e){_0x183eb8=_0x2bc59e;logger[_0x861f('0x14')](_0x861f('0x49'),_0x183eb8['id']);return getTicket(_0x5de384,_0x5eacb6,_0x183eb8,_0x2c06b8,_0x277abe);})[_0x861f('0x19')](function(_0xc317cb){if(_0xc317cb){logger[_0x861f('0x14')]('Ticket\x20created!');logger[_0x861f('0x14')]('The\x20Ticket\x20ID\x20is:',_0xc317cb['id']);}})['catch'](function(_0x3d8ca2){logger[_0x861f('0x4c')]('['+_0x277abe['lastevent'][_0x861f('0x57')]()+']',JSON['stringify'](_0x3d8ca2));});}; \ 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 c8cabee..29479e3 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 _0x6f61=['Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','add','task','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','adminEmail','username','toLowerCase','outbound','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','message','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x6f61,0x124));var _0x16f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6f61[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var rp=require(_0x16f6('0x0'));var md5=require(_0x16f6('0x1'));var util=require(_0x16f6('0x2'));var moment=require('moment');var Promise=require(_0x16f6('0x3'));var Redis=require(_0x16f6('0x4'));var intUtil=require(_0x16f6('0x5'));var config=require(_0x16f6('0x6'));var logger=require('../../../../config/logger')(_0x16f6('0x7'));config[_0x16f6('0x8')]=_[_0x16f6('0x9')](config[_0x16f6('0x8')],{'host':_0x16f6('0xa'),'port':0x18eb});var io=require(_0x16f6('0xb'))(new Redis(config[_0x16f6('0x8')]));function getAdminId(_0x5d42f5,_0xeee067,_0x4e8a95,_0x5cde52){return new Promise(function(_0x34793a,_0x20d2b0){var _0x1193cc=![];var _0x3270b0={'method':_0x16f6('0xc'),'uri':_0x5cde52+_0x16f6('0xd'),'json':!![]};_0x3270b0[_0x16f6('0xe')]=_0x4e8a95;logger[_0x16f6('0xf')](_0x16f6('0x10'));return rp(_0x3270b0)[_0x16f6('0x11')](function(_0x15b9ae){if(_0x15b9ae){var _0x5b0f63=_0x15b9ae['users'];var _0x40c0d1=null;for(_0x40c0d1=0x0;_0x40c0d1<_0x5b0f63[_0x16f6('0x12')];_0x40c0d1++){if(_0x5b0f63[_0x40c0d1]['email']===_0x5d42f5['adminEmail']){_0x5d42f5[_0x16f6('0x13')]=_0x5b0f63[_0x40c0d1]['id'];_0x1193cc=!![];}}if(_0x1193cc){logger[_0x16f6('0xf')](_0x16f6('0x14'),_0x5d42f5[_0x16f6('0x13')]);_0x34793a(_0x5d42f5);}else{_0x20d2b0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x20d2b0({'statusCode':0x194,'message':_0x16f6('0x15')});}})[_0x16f6('0x16')](function(_0x4f0c2f){logger[_0x16f6('0x17')]('['+[_0xeee067[_0x16f6('0x18')]()]+']',_0x4f0c2f['message']);_0x20d2b0(_0x4f0c2f);});});}function getUser(_0x1ab5e2,_0x5726af,_0x11ee1c){return function(_0x3693ce){return new Promise(function(_0x349c8a,_0x523f9b){var _0x44e157={'method':_0x16f6('0xc'),'uri':_0x11ee1c+'/api/selector/owners','json':!![]};_0x44e157[_0x16f6('0xe')]=_0x5726af;logger[_0x16f6('0xf')](_0x16f6('0x19'));return rp(_0x44e157)[_0x16f6('0x11')](function(_0x520c6a){if(_0x520c6a){var _0x5447c6=_0x520c6a['users'];var _0x35a5f0=![];var _0x3c7957=null;if(_0x3693ce[_0x16f6('0x1a')]!==null){logger[_0x16f6('0xf')](_0x16f6('0x1b'),_0x3693ce[_0x16f6('0x1a')]);_0x3693ce[_0x16f6('0x1c')]=_0x3693ce[_0x16f6('0x1a')];for(_0x3c7957=0x0;_0x3c7957<_0x5447c6[_0x16f6('0x12')];_0x3c7957++){if(_0x5447c6[_0x3c7957][_0x16f6('0x1d')]===_0x3693ce[_0x16f6('0x1a')]){_0x35a5f0=!![];_0x3693ce[_0x16f6('0x1e')]=_0x5447c6[_0x3c7957]['id'];logger[_0x16f6('0xf')](_0x16f6('0x1f'),_0x3693ce[_0x16f6('0x1e')]);}}}if(!_0x35a5f0){logger[_0x16f6('0xf')](_0x16f6('0x20'));_0x3693ce['userEmail']=_0x3693ce['adminEmail'];_0x3693ce[_0x16f6('0x1e')]=_0x3693ce[_0x16f6('0x13')];_0x35a5f0=!![];}if(_0x35a5f0){_0x349c8a(_0x3693ce);}else{_0x523f9b({'statusCode':0x194,'message':_0x16f6('0x15')});}}else{_0x523f9b({'statusCode':0x194,'message':_0x16f6('0x15')});}})['catch'](function(_0x5332a4){logger['error']('['+[_0x1ab5e2[_0x16f6('0x18')]()]+']',_0x5332a4[_0x16f6('0x21')]);_0x523f9b(_0x5332a4);});});};}function searchContact(_0x211965,_0x123b06,_0x266fbc,_0x293505){return new Promise(function(_0x1646e1,_0x239656){var _0x310af3={'method':_0x16f6('0xc'),'headers':_0x123b06,'uri':_0x211965+'/api/lookup?q='+_0x293505+'&f='+_0x266fbc+'&entities=contact','json':!![]};rp(_0x310af3)[_0x16f6('0x11')](function(_0x4bb78a){var _0x18aea3=_[_0x16f6('0x22')](_0x4bb78a[_0x16f6('0x23')]['contacts'],[_0x266fbc,_0x293505]);_0x1646e1(_0x18aea3);})[_0x16f6('0x16')](function(_0x2c9417){_0x239656(_0x2c9417);});});}function getEndUser(_0x13bf74,_0x3e84d8,_0x9b6860){return function(_0x55d9c5){return new Promise(function(_0x3ebbf9,_0x5f2778){logger[_0x16f6('0xf')](util[_0x16f6('0x24')](_0x16f6('0x25'),_0x55d9c5[_0x16f6('0x26')]));searchContact(_0x9b6860,_0x3e84d8,_0x16f6('0x27'),_0x55d9c5[_0x16f6('0x26')])[_0x16f6('0x11')](function(_0x37584b){if(_0x37584b){_0x55d9c5['endUserId']=_0x37584b['id'];logger['info'](_0x16f6('0x28'),_0x55d9c5['endUserId']);return _0x3ebbf9(_0x55d9c5);}searchContact(_0x9b6860,_0x3e84d8,_0x16f6('0x29'),_0x55d9c5[_0x16f6('0x26')])['then'](function(_0xc9f349){if(_0xc9f349){_0x55d9c5[_0x16f6('0x2a')]=_0xc9f349['id'];logger[_0x16f6('0xf')](_0x16f6('0x2b'),_0x55d9c5[_0x16f6('0x2a')]);return _0x3ebbf9(_0x55d9c5);}createEndUser(_0x55d9c5,_0x13bf74,_0x3e84d8,_0x9b6860)[_0x16f6('0x11')](function(_0x4d66f1){logger[_0x16f6('0xf')](_0x16f6('0x2c'),_0x4d66f1[_0x16f6('0x2a')]);return _0x3ebbf9(_0x4d66f1);});});})[_0x16f6('0x16')](function(_0x52ef1f){_0x5f2778(_0x52ef1f);});});};}function createEndUser(_0x39dec9,_0x52b38b,_0x1abfff,_0x5ba343){return new Promise(function(_0x2b7a1e,_0x16e4f4){var _0x478311=moment();var _0x3ba517={'method':_0x16f6('0x2d'),'uri':_0x5ba343+_0x16f6('0x2e'),'body':{'contact':{'last_name':_0x39dec9[_0x16f6('0x26')],'work_number':_0x39dec9[_0x16f6('0x26')],'mobile_number':_0x39dec9[_0x16f6('0x26')],'owner_id':_0x39dec9['userId'],'created_at':_0x478311[_0x16f6('0x24')](_0x16f6('0x2f'))}},'json':!![]};_0x3ba517['headers']=_0x1abfff;logger[_0x16f6('0xf')](_0x16f6('0x30'));return rp(_0x3ba517)[_0x16f6('0x11')](function(_0x58c09e){_0x39dec9['endUserId']=_0x58c09e[_0x16f6('0x31')]['id'];_0x2b7a1e(_0x39dec9);})[_0x16f6('0x16')](function(_0x126331){logger[_0x16f6('0x17')]('['+[_0x52b38b[_0x16f6('0x18')]()]+']',_0x126331['message']);_0x16e4f4(_0x126331[_0x16f6('0x21')]);});});}function getTicket(_0x503120,_0x18eb0b,_0x3525a0,_0x255ec3,_0x5a0f29){return function(_0x5130f8){logger[_0x16f6('0xf')](_0x16f6('0x32'));return new Promise(function(_0x4501e1,_0x467d36){var _0x51558d=moment();var _0x42cb3f={'method':_0x16f6('0x2d'),'uri':_0x3525a0+_0x16f6('0x33'),'body':{'title':intUtil[_0x16f6('0x34')](_0x255ec3[_0x16f6('0x35')],_0x5a0f29,'\x20'),'description':intUtil[_0x16f6('0x34')](_0x255ec3['Descriptions'],_0x5a0f29,'\x0a'),'owner_id':_0x5130f8[_0x16f6('0x1e')],'creater_id':_0x5130f8['adminId'],'targetable_id':_0x5130f8['endUserId'],'targetable_type':'Contact','created_at':_0x51558d[_0x16f6('0x24')](_0x16f6('0x2f')),'due_date':_0x51558d[_0x16f6('0x36')](0x1e,'m')[_0x16f6('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x42cb3f[_0x16f6('0xe')]=_0x18eb0b;return rp(_0x42cb3f)[_0x16f6('0x11')](function(_0x467b39){_0x5130f8['ticketId']=_0x467b39[_0x16f6('0x37')]['id'];logger[_0x16f6('0xf')](_0x16f6('0x38'),_0x5130f8[_0x16f6('0x39')]);_0x4501e1(_0x5130f8);})[_0x16f6('0x16')](function(_0x469ce9){logger[_0x16f6('0x17')]('['+[_0x503120['toUpperCase']()]+']',_0x469ce9['message']);_0x467d36(_0x469ce9['message']);});});};}function emit(_0x5407cd,_0x43d5d2,_0x3832ba){var _0x5c06bc={'uri':_0x5407cd+'/contacts/'+_0x3832ba};io['to'](util[_0x16f6('0x24')](_0x16f6('0x3a'),_0x43d5d2))[_0x16f6('0x3b')](_0x16f6('0x3c'),_0x5c06bc);}exports['cs']=function(_0x270c3b,_0xa12810,_0x382284,_0x315d10,_0x50b5e4,_0x1be13c,_0x1e3611,_0x499434){var _0x1d1aed={};var _0x4c3c91={'Authorization':_0x16f6('0x3d')+_0x1be13c['apiKey']};_0x1be13c[_0x16f6('0x3e')]=intUtil['stripTrailingSlash'](_0x1be13c[_0x16f6('0x3e')]);_0x1be13c[_0x16f6('0x3f')]=intUtil[_0x16f6('0x40')](_0x1be13c[_0x16f6('0x3f')]);var _0x196a38=_0x1be13c[_0x16f6('0x3e')];_0x1d1aed[_0x16f6('0x41')]=_0x1be13c[_0x16f6('0x42')];_0x1d1aed[_0x16f6('0x26')]=_0x499434[_0x16f6('0x43')]()===_0x16f6('0x44')?_0xa12810['destcalleridnum']:_0xa12810['calleridnum'];_0x1d1aed['callDirection']=_0x499434===_0x16f6('0x45')||_0x499434===_0x16f6('0x46')?_0x16f6('0x45'):'outbound';if(_0x315d10){_0x1d1aed[_0x16f6('0x1a')]=_0x315d10[_0x16f6('0x1d')];}var _0x2df5f9=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1be13c[_0x16f6('0x3f')],_0xa12810[_0x16f6('0x47')],md5(_0xa12810['uniqueid']));if(_0x50b5e4&&_0x50b5e4[_0x16f6('0x48')]){logger['info'](_0x16f6('0x49'),'Recording\x20is\x20enabled!');_0xa12810[_0x16f6('0x4a')]=_0x2df5f9;}else if(_0x1e3611&&_0x1e3611[_0x16f6('0x4b')]&&_0x1e3611[_0x16f6('0x4b')]!==_0x16f6('0x4c')){logger['info'](_0x16f6('0x4d'),_0x16f6('0x4e'));_0xa12810[_0x16f6('0x4a')]=_0x2df5f9;}else{_0xa12810[_0x16f6('0x4a')]='';}return getAdminId(_0x1d1aed,_0x499434,_0x4c3c91,_0x196a38)['then'](getUser(_0x499434,_0x4c3c91,_0x196a38))['then'](getEndUser(_0x499434,_0x4c3c91,_0x196a38))[_0x16f6('0x11')](getTicket(_0x499434,_0x4c3c91,_0x196a38,_0x382284,_0xa12810))[_0x16f6('0x11')](function(_0x3c6cf7){logger[_0x16f6('0xf')](util[_0x16f6('0x24')](_0x16f6('0x4f'),_0x3c6cf7['ticketId']));if(_0x499434!==_0x16f6('0x46')){logger[_0x16f6('0xf')]('['+[_0x499434[_0x16f6('0x18')]()]+']',_0x16f6('0x50'));emit(_0x196a38,_0x315d10[_0x16f6('0x51')],_0x3c6cf7['endUserId']);}})[_0x16f6('0x16')](function(_0x136249){logger[_0x16f6('0x17')]('['+[_0x499434[_0x16f6('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x16f6('0x52')](_0x136249,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2f51=['Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','outbound','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','defaults','redis','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','User\x20found:','Admin\x20selected','userEmail','adminEmail','userId','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','error','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions'];(function(_0x200b38,_0x45c552){var _0x2f0fec=function(_0x1b1fa9){while(--_0x1b1fa9){_0x200b38['push'](_0x200b38['shift']());}};_0x2f0fec(++_0x45c552);}(_0x2f51,0x16d));var _0x12f5=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0x2f51[_0x221a6f];return _0x3db53d;};'use strict';var _=require(_0x12f5('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x12f5('0x1'));var moment=require(_0x12f5('0x2'));var Promise=require(_0x12f5('0x3'));var Redis=require(_0x12f5('0x4'));var intUtil=require(_0x12f5('0x5'));var config=require(_0x12f5('0x6'));var logger=require('../../../../config/logger')(_0x12f5('0x7'));config['redis']=_[_0x12f5('0x8')](config[_0x12f5('0x9')],{'host':_0x12f5('0xa'),'port':0x18eb});var io=require(_0x12f5('0xb'))(new Redis(config['redis']));function getAdminId(_0x12a366,_0x49341e,_0x1dbb2b,_0x3b5ff4){return new Promise(function(_0x26fb83,_0x56d511){var _0x47ea7b=![];var _0x159485={'method':_0x12f5('0xc'),'uri':_0x3b5ff4+'/api/selector/owners','json':!![]};_0x159485[_0x12f5('0xd')]=_0x1dbb2b;logger[_0x12f5('0xe')](_0x12f5('0xf'));return rp(_0x159485)[_0x12f5('0x10')](function(_0x265694){if(_0x265694){var _0x21c76b=_0x265694[_0x12f5('0x11')];var _0x3ef9e1=null;for(_0x3ef9e1=0x0;_0x3ef9e1<_0x21c76b['length'];_0x3ef9e1++){if(_0x21c76b[_0x3ef9e1][_0x12f5('0x12')]===_0x12a366['adminEmail']){_0x12a366[_0x12f5('0x13')]=_0x21c76b[_0x3ef9e1]['id'];_0x47ea7b=!![];}}if(_0x47ea7b){logger[_0x12f5('0xe')](_0x12f5('0x14'),_0x12a366[_0x12f5('0x13')]);_0x26fb83(_0x12a366);}else{_0x56d511({'statusCode':0x194,'message':_0x12f5('0x15')});}}else{_0x56d511({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x12f5('0x16')](function(_0x2543b4){logger['error']('['+[_0x49341e[_0x12f5('0x17')]()]+']',_0x2543b4['message']);_0x56d511(_0x2543b4);});});}function getUser(_0x2e26bb,_0x57fc24,_0x458ca4){return function(_0x199b80){return new Promise(function(_0x2ff7f0,_0x323c06){var _0x13d437={'method':'GET','uri':_0x458ca4+_0x12f5('0x18'),'json':!![]};_0x13d437['headers']=_0x57fc24;logger['info'](_0x12f5('0x19'));return rp(_0x13d437)[_0x12f5('0x10')](function(_0x3312de){if(_0x3312de){var _0x2cd6d4=_0x3312de[_0x12f5('0x11')];var _0x253aef=![];var _0x172cc4=null;if(_0x199b80[_0x12f5('0x1a')]!==null){logger[_0x12f5('0xe')](_0x12f5('0x1b'),_0x199b80[_0x12f5('0x1a')]);_0x199b80['userEmail']=_0x199b80['agentEmail'];for(_0x172cc4=0x0;_0x172cc4<_0x2cd6d4[_0x12f5('0x1c')];_0x172cc4++){if(_0x2cd6d4[_0x172cc4][_0x12f5('0x12')]===_0x199b80[_0x12f5('0x1a')]){_0x253aef=!![];_0x199b80['userId']=_0x2cd6d4[_0x172cc4]['id'];logger[_0x12f5('0xe')](_0x12f5('0x1d'),_0x199b80['userId']);}}}if(!_0x253aef){logger[_0x12f5('0xe')](_0x12f5('0x1e'));_0x199b80[_0x12f5('0x1f')]=_0x199b80[_0x12f5('0x20')];_0x199b80[_0x12f5('0x21')]=_0x199b80['adminId'];_0x253aef=!![];}if(_0x253aef){_0x2ff7f0(_0x199b80);}else{_0x323c06({'statusCode':0x194,'message':_0x12f5('0x15')});}}else{_0x323c06({'statusCode':0x194,'message':_0x12f5('0x15')});}})[_0x12f5('0x16')](function(_0xc1cb4b){logger['error']('['+[_0x2e26bb[_0x12f5('0x17')]()]+']',_0xc1cb4b[_0x12f5('0x22')]);_0x323c06(_0xc1cb4b);});});};}function searchContact(_0x81306e,_0x49d806,_0x3d088d,_0x1b6b89){return new Promise(function(_0xf2f266,_0x58fbb5){var _0x4f8f2a={'method':'GET','headers':_0x49d806,'uri':_0x81306e+_0x12f5('0x23')+_0x1b6b89+_0x12f5('0x24')+_0x3d088d+_0x12f5('0x25'),'json':!![]};rp(_0x4f8f2a)[_0x12f5('0x10')](function(_0x3ab23b){var _0x109dc2=_['find'](_0x3ab23b[_0x12f5('0x26')][_0x12f5('0x26')],[_0x3d088d,_0x1b6b89]);_0xf2f266(_0x109dc2);})['catch'](function(_0x214dc4){_0x58fbb5(_0x214dc4);});});}function getEndUser(_0x33c987,_0x4fb025,_0x1b754e){return function(_0x15b3da){return new Promise(function(_0x5bd042,_0x38b028){logger['info'](util[_0x12f5('0x27')](_0x12f5('0x28'),_0x15b3da[_0x12f5('0x29')]));searchContact(_0x1b754e,_0x4fb025,_0x12f5('0x2a'),_0x15b3da[_0x12f5('0x29')])[_0x12f5('0x10')](function(_0x1aa050){if(_0x1aa050){_0x15b3da[_0x12f5('0x2b')]=_0x1aa050['id'];logger[_0x12f5('0xe')](_0x12f5('0x2c'),_0x15b3da[_0x12f5('0x2b')]);return _0x5bd042(_0x15b3da);}searchContact(_0x1b754e,_0x4fb025,_0x12f5('0x2d'),_0x15b3da[_0x12f5('0x29')])[_0x12f5('0x10')](function(_0x204243){if(_0x204243){_0x15b3da['endUserId']=_0x204243['id'];logger[_0x12f5('0xe')]('Contact\x20found\x20work_number:',_0x15b3da[_0x12f5('0x2b')]);return _0x5bd042(_0x15b3da);}createEndUser(_0x15b3da,_0x33c987,_0x4fb025,_0x1b754e)[_0x12f5('0x10')](function(_0x32a203){logger[_0x12f5('0xe')](_0x12f5('0x2e'),_0x32a203[_0x12f5('0x2b')]);return _0x5bd042(_0x32a203);});});})[_0x12f5('0x16')](function(_0xec39d0){_0x38b028(_0xec39d0);});});};}function createEndUser(_0x19a056,_0x4654a0,_0x2ff300,_0x3abd9b){return new Promise(function(_0x25885e,_0x30f434){var _0x55f8dc=moment();var _0x4d8635={'method':'POST','uri':_0x3abd9b+'/api/contacts','body':{'contact':{'last_name':_0x19a056[_0x12f5('0x29')],'work_number':_0x19a056['contactNumber'],'mobile_number':_0x19a056[_0x12f5('0x29')],'owner_id':_0x19a056[_0x12f5('0x21')],'created_at':_0x55f8dc[_0x12f5('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4d8635[_0x12f5('0xd')]=_0x2ff300;logger[_0x12f5('0xe')](_0x12f5('0x2f'));return rp(_0x4d8635)[_0x12f5('0x10')](function(_0x214e05){_0x19a056[_0x12f5('0x2b')]=_0x214e05[_0x12f5('0x30')]['id'];_0x25885e(_0x19a056);})[_0x12f5('0x16')](function(_0x304f51){logger[_0x12f5('0x31')]('['+[_0x4654a0[_0x12f5('0x17')]()]+']',_0x304f51[_0x12f5('0x22')]);_0x30f434(_0x304f51[_0x12f5('0x22')]);});});}function getTicket(_0x1aa1d5,_0x15fcb7,_0x440206,_0xe9d5af,_0x13a14e){return function(_0xa2dd09){logger[_0x12f5('0xe')](_0x12f5('0x32'));return new Promise(function(_0x496860,_0xc98387){var _0x2948b8=moment();var _0x229ba1={'method':_0x12f5('0x33'),'uri':_0x440206+_0x12f5('0x34'),'body':{'title':intUtil[_0x12f5('0x35')](_0xe9d5af['Subjects'],_0x13a14e,'\x20'),'description':intUtil[_0x12f5('0x35')](_0xe9d5af[_0x12f5('0x36')],_0x13a14e,'\x0a'),'owner_id':_0xa2dd09[_0x12f5('0x21')],'creater_id':_0xa2dd09[_0x12f5('0x13')],'targetable_id':_0xa2dd09[_0x12f5('0x2b')],'targetable_type':_0x12f5('0x37'),'created_at':_0x2948b8[_0x12f5('0x27')](_0x12f5('0x38')),'due_date':_0x2948b8[_0x12f5('0x39')](0x1e,'m')[_0x12f5('0x27')](_0x12f5('0x38'))},'json':!![]};_0x229ba1[_0x12f5('0xd')]=_0x15fcb7;return rp(_0x229ba1)[_0x12f5('0x10')](function(_0x2767f3){_0xa2dd09[_0x12f5('0x3a')]=_0x2767f3['task']['id'];logger[_0x12f5('0xe')]('Task\x20created:',_0xa2dd09[_0x12f5('0x3a')]);_0x496860(_0xa2dd09);})['catch'](function(_0x49489a){logger[_0x12f5('0x31')]('['+[_0x1aa1d5['toUpperCase']()]+']',_0x49489a[_0x12f5('0x22')]);_0xc98387(_0x49489a['message']);});});};}function emit(_0x108339,_0x130de3,_0x535ec1){var _0x4297cf={'uri':_0x108339+_0x12f5('0x3b')+_0x535ec1};io['to'](util['format'](_0x12f5('0x3c'),_0x130de3))['emit'](_0x12f5('0x3d'),_0x4297cf);}exports['cs']=function(_0x1704c0,_0x2f38cb,_0x43fc73,_0xddff57,_0xfb3fea,_0x1360c0,_0x1d2440,_0xd3adfb){var _0x2245d5={};var _0x51eecb={'Authorization':_0x12f5('0x3e')+_0x1360c0[_0x12f5('0x3f')]};_0x1360c0['remoteUri']=intUtil[_0x12f5('0x40')](_0x1360c0[_0x12f5('0x41')]);_0x1360c0[_0x12f5('0x42')]=intUtil[_0x12f5('0x40')](_0x1360c0['serverUrl']);var _0x5b4e3b=_0x1360c0[_0x12f5('0x41')];_0x2245d5[_0x12f5('0x20')]=_0x1360c0['username'];_0x2245d5[_0x12f5('0x29')]=_0xd3adfb[_0x12f5('0x43')]()===_0x12f5('0x44')?_0x2f38cb[_0x12f5('0x45')]:_0x2f38cb['calleridnum'];_0x2245d5['callDirection']=_0xd3adfb===_0x12f5('0x46')||_0xd3adfb===_0x12f5('0x47')?_0x12f5('0x46'):_0x12f5('0x44');if(_0xddff57){_0x2245d5[_0x12f5('0x1a')]=_0xddff57[_0x12f5('0x12')];}var _0x1b7537=util[_0x12f5('0x27')](_0x12f5('0x48'),_0x1360c0[_0x12f5('0x42')],_0x2f38cb[_0x12f5('0x49')],md5(_0x2f38cb[_0x12f5('0x49')]));if(_0xfb3fea&&_0xfb3fea['monitor_format']){logger[_0x12f5('0xe')](_0x12f5('0x4a'),_0x12f5('0x4b'));_0x2f38cb[_0x12f5('0x4c')]=_0x1b7537;}else if(_0x1d2440&&_0x1d2440[_0x12f5('0x4d')]&&_0x1d2440['recordingFormat']!==_0x12f5('0x4e')){logger[_0x12f5('0xe')](_0x12f5('0x4f'),_0x12f5('0x4b'));_0x2f38cb[_0x12f5('0x4c')]=_0x1b7537;}else{_0x2f38cb['recordingURL']='';}return getAdminId(_0x2245d5,_0xd3adfb,_0x51eecb,_0x5b4e3b)[_0x12f5('0x10')](getUser(_0xd3adfb,_0x51eecb,_0x5b4e3b))[_0x12f5('0x10')](getEndUser(_0xd3adfb,_0x51eecb,_0x5b4e3b))['then'](getTicket(_0xd3adfb,_0x51eecb,_0x5b4e3b,_0x43fc73,_0x2f38cb))[_0x12f5('0x10')](function(_0x8e780f){logger[_0x12f5('0xe')](util[_0x12f5('0x27')](_0x12f5('0x50'),_0x8e780f[_0x12f5('0x3a')]));if(_0xd3adfb!=='unmanaged'){logger['info']('['+[_0xd3adfb[_0x12f5('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5b4e3b,_0xddff57[_0x12f5('0x51')],_0x8e780f['endUserId']);}})[_0x12f5('0x16')](function(_0x4af822){logger[_0x12f5('0x31')]('['+[_0xd3adfb[_0x12f5('0x17')]()]+_0x12f5('0x52'),util[_0x12f5('0x53')](_0x4af822,{'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 5a4a4f7..5250e1c 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 _0xd37b=['./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','unmanaged','desk','dynamics365','log','unknown\x20integration','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xd37b,0x19a));var _0xbd37=function(_0x3e7278,_0x5b79fe){_0x3e7278=_0x3e7278-0x0;var _0x19450d=_0xd37b[_0x3e7278];return _0x19450d;};'use strict';var _=require(_0xbd37('0x0'));var util=require(_0xbd37('0x1'));var zendesk=require(_0xbd37('0x2'));var salesforce=require(_0xbd37('0x3'));var sugarcrm=require(_0xbd37('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xbd37('0x5'));var desk=require(_0xbd37('0x6'));var vtiger=require(_0xbd37('0x7'));var servicenow=require(_0xbd37('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xbd37('0x9'));var integrations=[_0xbd37('0xa'),_0xbd37('0xb'),_0xbd37('0xc'),_0xbd37('0xd'),_0xbd37('0xe'),'desk',_0xbd37('0xf'),'dynamics365',_0xbd37('0x10'),_0xbd37('0x11')];exports[_0xbd37('0x12')]=function(_0x176c55,_0x439da4,_0x4aa71c,_0x43c391,_0x46e1ee,_0x11891c){if(_0x4aa71c){if(_[_0xbd37('0x13')](integrations,_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')]())){try{var _0x1ed010=null;var _0x32c1ee='';var _0x50c218=_0x4aa71c[_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')]()];if(_0x50c218){var _0x3c25a9=_0x50c218[_0x176c55[_0xbd37('0x16')]];if(_0x3c25a9){var _0x261b4a=_[_0xbd37('0x17')](_0x3c25a9[_0xbd37('0x18')],{'id':parseInt(_0x176c55[_0xbd37('0x19')],0xa)});if(_0x261b4a){if(_0x43c391){if(_0x46e1ee&&_0x439da4['queue']){_0x32c1ee=_0xbd37('0x1a');}else if(_0x439da4['routeId']){_0x32c1ee=_0xbd37('0x1b');}else{console['log']('EVENT\x20UNKNOWN',_0x439da4);}}else{_0x32c1ee=_0xbd37('0x1c');}switch(_0x176c55['data1'][_0xbd37('0x15')]()){case _0xbd37('0xa'):zendesk[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xb'):salesforce[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xc'):sugarcrm[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xd'):freshdesk[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xe'):zoho[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0x1d'):desk[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0xf'):vtiger[_0x32c1ee](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c);break;case _0xbd37('0x10'):freshsales['cs'](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c,_0x32c1ee);break;case _0xbd37('0x11'):servicenow['cs'](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c,_0x32c1ee);break;case _0xbd37('0x1e'):dynamics365['cs'](_0x176c55,_0x439da4,_0x261b4a,_0x43c391,_0x46e1ee,_0x3c25a9,_0x11891c,_0x32c1ee);break;default:console[_0xbd37('0x1f')](_0xbd37('0x20'));}}else{_0x1ed010=require('../../../../config/logger')(_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')]());_0x1ed010['error']('[EXEC]',util['format'](_0xbd37('0x21'),_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')](),_0x176c55[_0xbd37('0x19')]));}}else{_0x1ed010=require(_0xbd37('0x22'))(_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')]());_0x1ed010[_0xbd37('0x23')](_0xbd37('0x24'),util['format'](_0xbd37('0x25'),_0x176c55[_0xbd37('0x14')][_0xbd37('0x15')](),_0x176c55['data2']));}}else{}}catch(_0x37d9b7){console['error'](_0x37d9b7);}}}}; \ No newline at end of file +var _0x077b=['toLowerCase','data2','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','data1','zoho','vtiger','log','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','zendesk','salesforce','sugarcrm','freshdesk','dynamics365','freshsales','servicenow','exec','includes'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x077b,0xbc));var _0xb077=function(_0x55bc0b,_0x95ab1b){_0x55bc0b=_0x55bc0b-0x0;var _0x10ffd6=_0x077b[_0x55bc0b];return _0x10ffd6;};'use strict';var _=require(_0xb077('0x0'));var util=require('util');var zendesk=require(_0xb077('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xb077('0x2'));var freshdesk=require(_0xb077('0x3'));var zoho=require(_0xb077('0x4'));var desk=require(_0xb077('0x5'));var vtiger=require(_0xb077('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0xb077('0x7'),_0xb077('0x8'),_0xb077('0x9'),_0xb077('0xa'),'zoho','desk','vtiger',_0xb077('0xb'),_0xb077('0xc'),_0xb077('0xd')];exports[_0xb077('0xe')]=function(_0x4b15b3,_0x46e1fe,_0x1b9f2c,_0x5a6067,_0x375ff8,_0x21117b){if(_0x1b9f2c){if(_[_0xb077('0xf')](integrations,_0x4b15b3['data1'][_0xb077('0x10')]())){try{var _0x26637c=null;var _0x1a2681='';var _0xa12382=_0x1b9f2c[_0x4b15b3['data1'][_0xb077('0x10')]()];if(_0xa12382){var _0x16cf21=_0xa12382[_0x4b15b3[_0xb077('0x11')]];if(_0x16cf21){var _0x491a18=_['find'](_0x16cf21[_0xb077('0x12')],{'id':parseInt(_0x4b15b3[_0xb077('0x13')],0xa)});if(_0x491a18){if(_0x5a6067){if(_0x375ff8&&_0x46e1fe[_0xb077('0x14')]){_0x1a2681='queue';}else if(_0x46e1fe[_0xb077('0x15')]){_0x1a2681=_0xb077('0x16');}else{console['log'](_0xb077('0x17'),_0x46e1fe);}}else{_0x1a2681='unmanaged';}switch(_0x4b15b3[_0xb077('0x18')]['toLowerCase']()){case _0xb077('0x7'):zendesk[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case _0xb077('0x8'):salesforce[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case _0xb077('0x9'):sugarcrm[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case'freshdesk':freshdesk[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case _0xb077('0x19'):zoho[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case'desk':desk[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case _0xb077('0x1a'):vtiger[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case'freshsales':freshsales['cs'](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b,_0x1a2681);break;case _0xb077('0xd'):servicenow['cs'](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b,_0x1a2681);break;case _0xb077('0xb'):dynamics365['cs'](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b,_0x1a2681);break;default:console[_0xb077('0x1b')]('unknown\x20integration');}}else{_0x26637c=require(_0xb077('0x1c'))(_0x4b15b3[_0xb077('0x18')][_0xb077('0x10')]());_0x26637c['error'](_0xb077('0x1d'),util[_0xb077('0x1e')](_0xb077('0x1f'),_0x4b15b3[_0xb077('0x18')]['toLowerCase'](),_0x4b15b3[_0xb077('0x13')]));}}else{_0x26637c=require(_0xb077('0x1c'))(_0x4b15b3['data1']['toLowerCase']());_0x26637c[_0xb077('0x20')](_0xb077('0x1d'),util[_0xb077('0x1e')](_0xb077('0x21'),_0x4b15b3[_0xb077('0x18')][_0xb077('0x10')](),_0x4b15b3[_0xb077('0x11')]));}}else{}}catch(_0x39e163){console[_0xb077('0x20')](_0x39e163);}}}}; \ 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 812ab81..7902b96 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 _0x76a4=['WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','sobject','User','find','execute','then','length','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','cloneDeep','lead','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Name','upperFirst','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','account'];(function(_0x395ee2,_0x1fdf36){var _0x673f0=function(_0x3f848c){while(--_0x3f848c){_0x395ee2['push'](_0x395ee2['shift']());}};_0x673f0(++_0x1fdf36);}(_0x76a4,0xf3));var _0x476a=function(_0x55a2ec,_0x1ff1d0){_0x55a2ec=_0x55a2ec-0x0;var _0x1bf5af=_0x76a4[_0x55a2ec];return _0x1bf5af;};'use strict';var _=require(_0x476a('0x0'));var rp=require('request-promise');var moment=require(_0x476a('0x1'));var BPromise=require(_0x476a('0x2'));var md5=require(_0x476a('0x3'));var jsforce=require(_0x476a('0x4'));var util=require(_0x476a('0x5'));var Redis=require(_0x476a('0x6'));var intUtil=require(_0x476a('0x7'));var config=require(_0x476a('0x8'));var logger=require(_0x476a('0x9'))(_0x476a('0xa'));config[_0x476a('0xb')]=_[_0x476a('0xc')](config[_0x476a('0xb')],{'host':_0x476a('0xd'),'port':0x18eb});var io=require(_0x476a('0xe'))(new Redis(config[_0x476a('0xb')]));function emit(_0x375e98,_0x3626a0,_0x457f28){io['to'](_0x375e98)[_0x476a('0xf')](_0x3626a0,_0x457f28);}function getTicket(_0x370456,_0x920eb6,_0x439515,_0x12c13e,_0x57aef0,_0x17350d,_0x53faee,_0x2a3593){var _0x3facc7=Object['assign']({},{'OwnerId':_0x920eb6['id'],'Subject':intUtil[_0x476a('0x10')](_0x12c13e[_0x476a('0x11')],_0x57aef0,'\x20'),'Description':intUtil['getString'](_0x12c13e[_0x476a('0x12')],_0x57aef0,'\x0a')},getCustomFields(_0x17350d,_0x57aef0));if(_0x439515){if(_0x12c13e[_0x476a('0x13')]===_0x476a('0x14')){_0x3facc7[_0x476a('0x15')]=moment['utc']();_0x3facc7[_0x476a('0x16')]=![];_0x3facc7[_0x476a('0x17')]=![];if(_0x439515[_0x476a('0x18')]===_0x476a('0x19')||_0x439515[_0x476a('0x18')]==='lead'){_0x3facc7['WhoId']=_0x439515['id'];}else if(_0x439515[_0x476a('0x18')]===_0x476a('0x1a')){_0x3facc7[_0x476a('0x1b')]=_0x439515['id'];}}else if(_0x12c13e[_0x476a('0x13')]===_0x476a('0x1c')){if(_0x439515[_0x476a('0x18')]===_0x476a('0x19')){_0x3facc7[_0x476a('0x1d')]=_0x439515['id'];}else if(_0x439515[_0x476a('0x18')]==='account'){_0x3facc7[_0x476a('0x1e')]=_0x439515['id'];}else if(_0x439515['endUserType']==='lead'&&_0x12c13e['leadId']){_0x3facc7[_0x12c13e[_0x476a('0x1f')]]=_0x439515['id'];}else{logger[_0x476a('0x20')](_0x476a('0x21'));}}}return _0x53faee['sobject'](_0x12c13e['ticketType'])[_0x476a('0x22')](_0x3facc7);}function getUser(_0x393c67,_0x4cc82f,_0x5ecec3){if(!_['isNil'](_0x4cc82f)&&intUtil[_0x476a('0x23')](_0x4cc82f)){var _0x5b24c7={'Email':_0x4cc82f};var _0x446a15={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5ecec3[_0x476a('0x24')](_0x476a('0x25'))[_0x476a('0x26')](_0x5b24c7,_0x446a15)[_0x476a('0x27')]()[_0x476a('0x28')](function(_0xc091b1){if(_0xc091b1[_0x476a('0x29')]){var _0x4e48ff=_[_0x476a('0x26')](_0xc091b1,function(_0x907b03){return _0x907b03[_0x476a('0x2a')]===_0x4cc82f;});if(_0x4e48ff){logger[_0x476a('0x20')]('Agent\x20%s\x20found.',_0x4cc82f);return BPromise[_0x476a('0x2b')]({'id':_0x4e48ff['Id'],'name':_0x4e48ff['Name']});}}else{logger[_0x476a('0x20')](_0x476a('0x2c'),_0x4cc82f);return _0x5ecec3['identity']()['then'](function(_0x13d12f){return BPromise['resolve']({'id':_0x13d12f[_0x476a('0x2d')],'name':_0x13d12f[_0x476a('0x2e')]});});}});}else{logger[_0x476a('0x20')](_0x476a('0x2c'),_0x4cc82f);return _0x5ecec3[_0x476a('0x2f')]()[_0x476a('0x28')](function(_0x4071f1){return BPromise['resolve']({'id':_0x4071f1[_0x476a('0x2d')],'name':_0x4071f1[_0x476a('0x2e')]});});}}function getEndUser(_0x2e66c7,_0x2d16bc,_0x2c4c20,_0x167cd6,_0x11bab7){var _0x48fa81={'$or':{'Phone':_0x167cd6}};var _0x411f71={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x476a('0x2b')]()[_0x476a('0x28')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x167cd6,_0x2d16bc['moduleSearch']);switch(_0x2d16bc[_0x476a('0x30')]){case _0x476a('0x31'):var _0x336c59=_['cloneDeep'](_0x48fa81);if(_0x2d16bc[_0x476a('0x32')]){var _0x470198={};_0x470198[_0x2d16bc['additionalSearchContact']]=_0x167cd6;_[_0x476a('0x33')](_0x336c59[_0x476a('0x34')],_0x470198);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x35'))['find'](_0x336c59,_0x411f71)['execute']()[_0x476a('0x28')](function(_0x352417){if(_0x352417&&_0x352417[_0x476a('0x29')]){return _0x352417;}else{var _0x43357a=_['cloneDeep'](_0x48fa81);if(_0x2d16bc[_0x476a('0x36')]){var _0x247b1f={};_0x247b1f[_0x2d16bc[_0x476a('0x36')]]=_0x167cd6;_[_0x476a('0x33')](_0x43357a[_0x476a('0x34')],_0x247b1f);}return _0x11bab7['sobject'](_0x476a('0x37'))[_0x476a('0x26')](_0x43357a,_0x411f71);}});case'account_contact_lead':var _0x4a9274=_['cloneDeep'](_0x48fa81);if(_0x2d16bc['additionalSearchAccount']){var _0x470198={};_0x470198[_0x2d16bc[_0x476a('0x38')]]=_0x167cd6;_[_0x476a('0x33')](_0x4a9274[_0x476a('0x34')],_0x470198);}return _0x11bab7['sobject'](_0x476a('0x39'))[_0x476a('0x26')](_0x4a9274,_0x411f71)[_0x476a('0x27')]()['then'](function(_0x8da777){if(_0x8da777&&_0x8da777[_0x476a('0x29')]){return _0x8da777;}else{var _0x198170=_[_0x476a('0x3a')](_0x48fa81);if(_0x2d16bc[_0x476a('0x32')]){var _0x4d84d1={};_0x4d84d1[_0x2d16bc['additionalSearchContact']]=_0x167cd6;_['merge'](_0x198170[_0x476a('0x34')],_0x4d84d1);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x35'))['find'](_0x198170,_0x411f71)['then'](function(_0x54e0d6){if(_0x54e0d6&&_0x54e0d6[_0x476a('0x29')]){return _0x54e0d6;}else{var _0x492f35=_[_0x476a('0x3a')](_0x48fa81);if(_0x2d16bc[_0x476a('0x36')]){var _0x38bc70={};_0x38bc70[_0x2d16bc[_0x476a('0x36')]]=_0x167cd6;_['merge'](_0x492f35['$or'],_0x38bc70);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x37'))['find'](_0x492f35,_0x411f71);}});}});case _0x476a('0x19'):var _0x336c59=_[_0x476a('0x3a')](_0x48fa81);if(_0x2d16bc[_0x476a('0x32')]){var _0x470198={};_0x470198[_0x2d16bc[_0x476a('0x32')]]=_0x167cd6;_[_0x476a('0x33')](_0x336c59[_0x476a('0x34')],_0x470198);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x35'))[_0x476a('0x26')](_0x336c59,_0x411f71)[_0x476a('0x27')]();case _0x476a('0x3b'):var _0x5340fd=_['cloneDeep'](_0x48fa81);if(_0x2d16bc[_0x476a('0x36')]){var _0x470198={};_0x470198[_0x2d16bc[_0x476a('0x36')]]=_0x167cd6;_[_0x476a('0x33')](_0x5340fd[_0x476a('0x34')],_0x470198);}return _0x11bab7[_0x476a('0x24')](_0x476a('0x37'))[_0x476a('0x26')](_0x5340fd,_0x411f71);case _0x476a('0x1a'):var _0x4a9274=_[_0x476a('0x3a')](_0x48fa81);if(_0x2d16bc[_0x476a('0x38')]){var _0x470198={};_0x470198[_0x2d16bc[_0x476a('0x38')]]=_0x167cd6;_[_0x476a('0x33')](_0x4a9274[_0x476a('0x34')],_0x470198);}return _0x11bab7['sobject']('Account')[_0x476a('0x26')](_0x4a9274,_0x411f71);default:return null;}})[_0x476a('0x28')](function(_0x1d2e89){if(_0x1d2e89&&_0x1d2e89[_0x476a('0x29')]){var _0x46a220=_[_0x476a('0x3c')](_0x1d2e89);if(_0x46a220){return BPromise[_0x476a('0x2b')]({'id':_0x46a220['Id'],'name':_0x46a220['Name'],'phone':_0x46a220[_0x476a('0x3d')],'endUserType':_0x46a220[_0x476a('0x3e')]['type'][_0x476a('0x3f')]()});}}})[_0x476a('0x28')](function(_0x5033be){if(_0x5033be){logger[_0x476a('0x20')](_0x476a('0x40'),_0x5033be[_0x476a('0x18')],_0x167cd6);return BPromise[_0x476a('0x2b')](_0x5033be);}else{logger[_0x476a('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x167cd6);var _0x42022b={'Phone':_0x167cd6};if(_0x2d16bc['moduleCreate']){if(_0x2d16bc[_0x476a('0x41')]==='contact'){logger[_0x476a('0x20')](_0x476a('0x42'),_0x167cd6,_0x2d16bc[_0x476a('0x41')]);_0x42022b[_0x476a('0x43')]=_0x2c4c20!==_0x476a('0x44')?_0x2c4c20:util[_0x476a('0x45')](_0x476a('0x46'),_0x167cd6);}else if(_0x2d16bc['moduleCreate']===_0x476a('0x3b')){logger['info'](_0x476a('0x42'),_0x167cd6,_0x2d16bc[_0x476a('0x41')]);_0x42022b[_0x476a('0x43')]=_0x2c4c20!==_0x476a('0x44')?_0x2c4c20:util[_0x476a('0x45')](_0x476a('0x46'),_0x167cd6);_0x42022b[_0x476a('0x47')]=_0x476a('0x48');}else if(_0x2d16bc[_0x476a('0x41')]===_0x476a('0x1a')){logger[_0x476a('0x20')](_0x476a('0x42'),_0x167cd6,_0x2d16bc[_0x476a('0x41')]);_0x42022b[_0x476a('0x49')]=_0x2c4c20!==_0x476a('0x44')?_0x2c4c20:util[_0x476a('0x45')](_0x476a('0x46'),_0x167cd6);}else{return null;}}return _0x11bab7['sobject'](_[_0x476a('0x4a')](_0x2d16bc[_0x476a('0x41')]))[_0x476a('0x22')](_0x42022b)['then'](function(_0x4baaae){return BPromise['resolve']({'id':_0x4baaae['id'],'endUserType':_0x2d16bc[_0x476a('0x41')]});});}});}function getCustomFields(_0xeb811f,_0x72891a){var _0x2ba9ee={};if(_0xeb811f[_0x476a('0x29')]>0x0){_['forEach'](_0xeb811f,function(_0x567c9f){if(_[_0x476a('0x4b')]([_0x476a('0x4c'),_0x476a('0x4d')],_0x567c9f[_0x476a('0x4e')])&&_0x567c9f[_0x476a('0x4f')]){_0x2ba9ee[_0x567c9f[_0x476a('0x4f')]]=_0x567c9f[_0x476a('0x50')][_0x476a('0x51')]();}else if(_0x567c9f[_0x476a('0x4e')]===_0x476a('0x52')&&_0x567c9f['variableName']&&_0x567c9f[_0x476a('0x4f')]){_0x72891a[_0x567c9f[_0x476a('0x53')]]&&(_0x2ba9ee[_0x567c9f['idField']]=_0x72891a[_0x567c9f[_0x476a('0x53')]]['toString']());}else if(_0x567c9f[_0x476a('0x4e')]==='customVariable'&&_0x567c9f[_0x476a('0x54')]&&_0x567c9f['Variable'][_0x476a('0x55')]&&_0x567c9f[_0x476a('0x4f')]){_0x72891a[_0x567c9f['Variable'][_0x476a('0x55')][_0x476a('0x3f')]()]&&(_0x2ba9ee[_0x567c9f[_0x476a('0x4f')]]=_0x72891a[_0x567c9f[_0x476a('0x54')][_0x476a('0x55')][_0x476a('0x3f')]()]['toString']());}});}return _0x2ba9ee;}function getConnection(_0x5580dd){var _0x10e689=_0x5580dd[_0x476a('0x56')][_0x476a('0x57')](_0x5580dd[_0x476a('0x58')]);var _0x333d28=new jsforce[(_0x476a('0x59'))]({'oauth2':{'loginUrl':_0x5580dd[_0x476a('0x5a')]||_0x476a('0x5b'),'clientId':_0x5580dd[_0x476a('0x5c')],'clientSecret':_0x5580dd[_0x476a('0x5d')]}});return _0x333d28[_0x476a('0x5e')](_0x5580dd[_0x476a('0x5f')],_0x10e689)[_0x476a('0x28')](function(){logger['info']('Connection\x20established.');return _0x333d28;});}exports[_0x476a('0x60')]=function(_0x1f600d,_0x373aaf,_0x4e2386,_0x24be92,_0x5c5d59,_0xfc8067){var _0x126cb4,_0x4c6d8e,_0x38de8b,_0x405560;_0xfc8067[_0x476a('0x61')]=intUtil['stripTrailingSlash'](_0xfc8067['serverUrl']);_0xfc8067[_0x476a('0x5a')]=intUtil[_0x476a('0x62')](_0xfc8067[_0x476a('0x5a')]);if(_0x5c5d59&&_0x5c5d59[_0x476a('0x63')]){logger[_0x476a('0x20')](_0x476a('0x64'),_0x476a('0x65'));_0x373aaf['recordingURL']=util[_0x476a('0x45')](_0x476a('0x66'),_0xfc8067['serverUrl'],_0x373aaf['uniqueid'],md5(_0x373aaf[_0x476a('0x67')]));}else{_0x373aaf[_0x476a('0x68')]='';}return getConnection(_0xfc8067)['then'](function(_0xe695ee){_0x405560=_0xe695ee;return getUser(_0xfc8067,_0x24be92['email'],_0x405560);})[_0x476a('0x28')](function(_0x7b3e51){_0x126cb4=_0x7b3e51;return getEndUser(_0xfc8067,_0x4e2386,_0x373aaf[_0x476a('0x69')],_0x373aaf[_0x476a('0x6a')],_0x405560);})['then'](function(_0x3b6423){_0x4c6d8e=_0x3b6423;return getTicket(_0xfc8067,_0x126cb4,_0x4c6d8e,_0x4e2386,_0x373aaf,_0x4e2386[_0x476a('0x6b')],_0x405560,_0x476a('0x60'));})['then'](function(_0x3b0762){_0x38de8b=_0x3b0762;logger[_0x476a('0x20')](_0x476a('0x6c'),_0x38de8b['id']);logger[_0x476a('0x20')](_0x476a('0x6d'),_0x38de8b['id'],_0x24be92[_0x476a('0x55')],_0xfc8067[_0x476a('0x4e')]);switch(_0xfc8067['type']){case _0x476a('0x6e'):emit(util[_0x476a('0x45')](_0x476a('0x6f'),_0x24be92[_0x476a('0x55')]),_0x476a('0x70'),{'recordId':_0x38de8b['id']});break;case'newTab':emit(util[_0x476a('0x45')](_0x476a('0x6f'),_0x24be92[_0x476a('0x55')]),_0x476a('0x71'),{'uri':util[_0x476a('0x45')](_0x476a('0x72'),_0x405560[_0x476a('0x73')],_0x38de8b['id'])});break;default:logger[_0x476a('0x74')](_0x476a('0x75'));}})[_0x476a('0x76')](function(_0x4c28e0){logger[_0x476a('0x74')]('[QUEUE]',_0x4c28e0);});};exports[_0x476a('0x77')]=function(_0x525abf,_0x38f9df,_0x288731,_0x5f0501,_0x24511b,_0x3888f0,_0x4bfe09){var _0x2afb13,_0xbc9a91,_0x3115e5,_0x2bf101;_0x3888f0[_0x476a('0x61')]=intUtil[_0x476a('0x62')](_0x3888f0[_0x476a('0x61')]);_0x3888f0['remoteUri']=intUtil[_0x476a('0x62')](_0x3888f0[_0x476a('0x5a')]);if(_0x4bfe09&&_0x4bfe09[_0x476a('0x78')]&&_0x4bfe09[_0x476a('0x78')]!==_0x476a('0x79')){logger[_0x476a('0x20')](_0x476a('0x7a'),'Recording\x20is\x20enabled!');_0x38f9df[_0x476a('0x68')]=util[_0x476a('0x45')](_0x476a('0x66'),_0x3888f0['serverUrl'],_0x38f9df['uniqueid'],md5(_0x38f9df[_0x476a('0x67')]));}return getConnection(_0x3888f0)[_0x476a('0x28')](function(_0x1c818c){_0x2bf101=_0x1c818c;return getUser(_0x3888f0,_0x5f0501[_0x476a('0x7b')],_0x2bf101);})[_0x476a('0x28')](function(_0x47c6af){_0x2afb13=_0x47c6af;return getEndUser(_0x3888f0,_0x288731,_0x38f9df[_0x476a('0x7c')],_0x38f9df[_0x476a('0x7d')],_0x2bf101);})[_0x476a('0x28')](function(_0x542556){_0xbc9a91=_0x542556;return getTicket(_0x3888f0,_0x2afb13,_0xbc9a91,_0x288731,_0x38f9df,_0x288731[_0x476a('0x6b')],_0x2bf101,_0x476a('0x77'));})[_0x476a('0x28')](function(_0x3671b2){_0x3115e5=_0x3671b2;logger['info'](_0x476a('0x7e'),_0x3115e5['id']);logger['info'](_0x476a('0x7f'),_0x3115e5['id'],_0x5f0501[_0x476a('0x55')],_0x3888f0[_0x476a('0x4e')]);switch(_0x3888f0[_0x476a('0x4e')]){case _0x476a('0x6e'):emit(util[_0x476a('0x45')](_0x476a('0x6f'),_0x5f0501[_0x476a('0x55')]),_0x476a('0x70'),{'recordId':_0x3115e5['id']});break;case'newTab':emit(util[_0x476a('0x45')](_0x476a('0x6f'),_0x5f0501[_0x476a('0x55')]),_0x476a('0x71'),{'uri':util[_0x476a('0x45')]('%s/%s/e',_0x2bf101[_0x476a('0x73')],_0x3115e5['id'])});break;default:logger['error'](_0x476a('0x7a'),_0x476a('0x80'));}})['catch'](function(_0x2a7272){logger[_0x476a('0x74')](_0x476a('0x7a'),_0x2a7272);});};exports[_0x476a('0x81')]=function(_0x30f6d2,_0x5ba7dc,_0x2cee36,_0x27db06,_0x1d5dab,_0x355b97){var _0x3b7e15,_0x479b94,_0x2c0c7e,_0x14c00b;_0x355b97[_0x476a('0x61')]=intUtil[_0x476a('0x62')](_0x355b97[_0x476a('0x61')]);_0x355b97[_0x476a('0x5a')]=intUtil[_0x476a('0x62')](_0x355b97[_0x476a('0x5a')]);if(_0x1d5dab&&_0x1d5dab[_0x476a('0x63')]){logger[_0x476a('0x20')]('['+_0x5ba7dc[_0x476a('0x82')][_0x476a('0x83')]()+']',_0x476a('0x65'));_0x5ba7dc[_0x476a('0x68')]=util[_0x476a('0x45')](_0x476a('0x66'),_0x355b97[_0x476a('0x61')],_0x5ba7dc[_0x476a('0x67')],md5(_0x5ba7dc[_0x476a('0x67')]));}else{_0x5ba7dc[_0x476a('0x68')]='';}return getConnection(_0x355b97)[_0x476a('0x28')](function(_0x3a682a){_0x14c00b=_0x3a682a;if(!_[_0x476a('0x84')](_0x27db06)){return getUser(_0x355b97,_0x27db06['name'],_0x14c00b);}else{return getUser(_0x355b97,null,_0x14c00b);}})[_0x476a('0x28')](function(_0x48c99a){_0x3b7e15=_0x48c99a;return getEndUser(_0x355b97,_0x2cee36,_0x5ba7dc['calleridname'],_0x5ba7dc[_0x476a('0x6a')],_0x14c00b);})[_0x476a('0x28')](function(_0x4f4d25){_0x479b94=_0x4f4d25;return getTicket(_0x355b97,_0x3b7e15,_0x479b94,_0x2cee36,_0x5ba7dc,_0x2cee36[_0x476a('0x6b')],_0x14c00b);})['then'](function(_0x31b1b7){_0x2c0c7e=_0x31b1b7;logger[_0x476a('0x20')]('['+_0x5ba7dc[_0x476a('0x82')]['toUpperCase']()+_0x476a('0x85'),_0x2c0c7e['id']);logger[_0x476a('0x20')]('['+_0x5ba7dc[_0x476a('0x82')][_0x476a('0x83')]()+_0x476a('0x86'),_0x355b97[_0x476a('0x4e')]);})[_0x476a('0x76')](function(_0xa0e74d){logger[_0x476a('0x74')]('['+_0x5ba7dc[_0x476a('0x82')][_0x476a('0x83')]()+']',_0xa0e74d);});}; \ No newline at end of file +var _0x15fc=['info','sobject','create','validateEmail','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','LastName','','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','user:%s','trigger:browser:url','instanceUrl','error','catch','recordingFormat','none','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','Case','ContactId','leadId'];(function(_0x36c0c1,_0x370be5){var _0x4b1734=function(_0xdf3d55){while(--_0xdf3d55){_0x36c0c1['push'](_0x36c0c1['shift']());}};_0x4b1734(++_0x370be5);}(_0x15fc,0x1e8));var _0xc15f=function(_0x430f53,_0x47ec74){_0x430f53=_0x430f53-0x0;var _0x179ebd=_0x15fc[_0x430f53];return _0x179ebd;};'use strict';var _=require(_0xc15f('0x0'));var rp=require(_0xc15f('0x1'));var moment=require(_0xc15f('0x2'));var BPromise=require(_0xc15f('0x3'));var md5=require(_0xc15f('0x4'));var jsforce=require(_0xc15f('0x5'));var util=require(_0xc15f('0x6'));var Redis=require('ioredis');var intUtil=require(_0xc15f('0x7'));var config=require(_0xc15f('0x8'));var logger=require('../../../../config/logger')(_0xc15f('0x9'));config[_0xc15f('0xa')]=_[_0xc15f('0xb')](config[_0xc15f('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xc15f('0xc'))(new Redis(config['redis']));function emit(_0x10e2f5,_0x15139c,_0x532fcb){io['to'](_0x10e2f5)[_0xc15f('0xd')](_0x15139c,_0x532fcb);}function getTicket(_0x258988,_0x18609c,_0xb821c1,_0x2a3a1b,_0x483298,_0x53b283,_0x50f384,_0x5235be){var _0x39bcc6=Object[_0xc15f('0xe')]({},{'OwnerId':_0x18609c['id'],'Subject':intUtil[_0xc15f('0xf')](_0x2a3a1b[_0xc15f('0x10')],_0x483298,'\x20'),'Description':intUtil[_0xc15f('0xf')](_0x2a3a1b[_0xc15f('0x11')],_0x483298,'\x0a')},getCustomFields(_0x53b283,_0x483298));if(_0xb821c1){if(_0x2a3a1b[_0xc15f('0x12')]===_0xc15f('0x13')){_0x39bcc6[_0xc15f('0x14')]=moment[_0xc15f('0x15')]();_0x39bcc6['IsReminderSet']=![];_0x39bcc6[_0xc15f('0x16')]=![];if(_0xb821c1['endUserType']===_0xc15f('0x17')||_0xb821c1[_0xc15f('0x18')]===_0xc15f('0x19')){_0x39bcc6[_0xc15f('0x1a')]=_0xb821c1['id'];}else if(_0xb821c1[_0xc15f('0x18')]===_0xc15f('0x1b')){_0x39bcc6[_0xc15f('0x1c')]=_0xb821c1['id'];}}else if(_0x2a3a1b['ticketType']===_0xc15f('0x1d')){if(_0xb821c1[_0xc15f('0x18')]===_0xc15f('0x17')){_0x39bcc6[_0xc15f('0x1e')]=_0xb821c1['id'];}else if(_0xb821c1['endUserType']===_0xc15f('0x1b')){_0x39bcc6['AccountId']=_0xb821c1['id'];}else if(_0xb821c1[_0xc15f('0x18')]==='lead'&&_0x2a3a1b[_0xc15f('0x1f')]){_0x39bcc6[_0x2a3a1b[_0xc15f('0x1f')]]=_0xb821c1['id'];}else{logger[_0xc15f('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x50f384[_0xc15f('0x21')](_0x2a3a1b[_0xc15f('0x12')])[_0xc15f('0x22')](_0x39bcc6);}function getUser(_0x3d0633,_0x382691,_0x160bed){if(!_['isNil'](_0x382691)&&intUtil[_0xc15f('0x23')](_0x382691)){var _0x421018={'Email':_0x382691};var _0x1046eb={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x160bed['sobject']('User')[_0xc15f('0x24')](_0x421018,_0x1046eb)[_0xc15f('0x25')]()['then'](function(_0xaaad90){if(_0xaaad90[_0xc15f('0x26')]){var _0x3cd8c3=_['find'](_0xaaad90,function(_0x16f118){return _0x16f118[_0xc15f('0x27')]===_0x382691;});if(_0x3cd8c3){logger['info'](_0xc15f('0x28'),_0x382691);return BPromise[_0xc15f('0x29')]({'id':_0x3cd8c3['Id'],'name':_0x3cd8c3[_0xc15f('0x2a')]});}}else{logger[_0xc15f('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x382691);return _0x160bed[_0xc15f('0x2b')]()[_0xc15f('0x2c')](function(_0x1aba0c){return BPromise[_0xc15f('0x29')]({'id':_0x1aba0c[_0xc15f('0x2d')],'name':_0x1aba0c['display_name']});});}});}else{logger[_0xc15f('0x20')](_0xc15f('0x2e'),_0x382691);return _0x160bed['identity']()[_0xc15f('0x2c')](function(_0x445b7e){return BPromise[_0xc15f('0x29')]({'id':_0x445b7e['user_id'],'name':_0x445b7e['display_name']});});}}function getEndUser(_0x4bb168,_0x3e3523,_0x29f9da,_0x405470,_0x4e681e){var _0x57b6c9={'$or':{'Phone':_0x405470}};var _0x37500b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc15f('0x29')]()[_0xc15f('0x2c')](function(){logger[_0xc15f('0x20')](_0xc15f('0x2f'),_0x405470,_0x3e3523[_0xc15f('0x30')]);switch(_0x3e3523['moduleSearch']){case _0xc15f('0x31'):var _0x4b3fb1=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523['additionalSearchContact']){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x33')]]=_0x405470;_[_0xc15f('0x34')](_0x4b3fb1['$or'],_0x433529);}return _0x4e681e['sobject'](_0xc15f('0x35'))[_0xc15f('0x24')](_0x4b3fb1,_0x37500b)[_0xc15f('0x25')]()[_0xc15f('0x2c')](function(_0x330da3){if(_0x330da3&&_0x330da3[_0xc15f('0x26')]){return _0x330da3;}else{var _0x4cff3c=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523['additionalSearchLead']){var _0x2ec377={};_0x2ec377[_0x3e3523[_0xc15f('0x36')]]=_0x405470;_['merge'](_0x4cff3c['$or'],_0x2ec377);}return _0x4e681e[_0xc15f('0x21')](_0xc15f('0x37'))['find'](_0x4cff3c,_0x37500b);}});case _0xc15f('0x38'):var _0x2430c1=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x39')]){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x39')]]=_0x405470;_[_0xc15f('0x34')](_0x2430c1[_0xc15f('0x3a')],_0x433529);}return _0x4e681e[_0xc15f('0x21')](_0xc15f('0x3b'))[_0xc15f('0x24')](_0x2430c1,_0x37500b)['execute']()[_0xc15f('0x2c')](function(_0x51df3f){if(_0x51df3f&&_0x51df3f[_0xc15f('0x26')]){return _0x51df3f;}else{var _0x2acff4=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x33')]){var _0x140a1c={};_0x140a1c[_0x3e3523['additionalSearchContact']]=_0x405470;_['merge'](_0x2acff4[_0xc15f('0x3a')],_0x140a1c);}return _0x4e681e['sobject'](_0xc15f('0x35'))['find'](_0x2acff4,_0x37500b)['then'](function(_0x5b20ed){if(_0x5b20ed&&_0x5b20ed['length']){return _0x5b20ed;}else{var _0x3fbe57=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x36')]){var _0x31e2b7={};_0x31e2b7[_0x3e3523['additionalSearchLead']]=_0x405470;_[_0xc15f('0x34')](_0x3fbe57[_0xc15f('0x3a')],_0x31e2b7);}return _0x4e681e['sobject'](_0xc15f('0x37'))[_0xc15f('0x24')](_0x3fbe57,_0x37500b);}});}});case'contact':var _0x4b3fb1=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x33')]){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x33')]]=_0x405470;_['merge'](_0x4b3fb1['$or'],_0x433529);}return _0x4e681e[_0xc15f('0x21')](_0xc15f('0x35'))[_0xc15f('0x24')](_0x4b3fb1,_0x37500b)[_0xc15f('0x25')]();case _0xc15f('0x19'):var _0x4a873e=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523['additionalSearchLead']){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x36')]]=_0x405470;_[_0xc15f('0x34')](_0x4a873e[_0xc15f('0x3a')],_0x433529);}return _0x4e681e['sobject']('Lead')[_0xc15f('0x24')](_0x4a873e,_0x37500b);case _0xc15f('0x1b'):var _0x2430c1=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x39')]){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x39')]]=_0x405470;_[_0xc15f('0x34')](_0x2430c1['$or'],_0x433529);}return _0x4e681e[_0xc15f('0x21')](_0xc15f('0x3b'))[_0xc15f('0x24')](_0x2430c1,_0x37500b);default:return null;}})[_0xc15f('0x2c')](function(_0x298d69){if(_0x298d69&&_0x298d69[_0xc15f('0x26')]){var _0xa159b7=_[_0xc15f('0x3c')](_0x298d69);if(_0xa159b7){return BPromise[_0xc15f('0x29')]({'id':_0xa159b7['Id'],'name':_0xa159b7[_0xc15f('0x2a')],'phone':_0xa159b7[_0xc15f('0x3d')],'endUserType':_0xa159b7['attributes'][_0xc15f('0x3e')][_0xc15f('0x3f')]()});}}})[_0xc15f('0x2c')](function(_0x13e598){if(_0x13e598){logger[_0xc15f('0x20')](_0xc15f('0x40'),_0x13e598[_0xc15f('0x18')],_0x405470);return BPromise[_0xc15f('0x29')](_0x13e598);}else{logger[_0xc15f('0x20')](_0xc15f('0x41'),_0x405470);var _0x388d17={'Phone':_0x405470};if(_0x3e3523['moduleCreate']){if(_0x3e3523[_0xc15f('0x42')]===_0xc15f('0x17')){logger[_0xc15f('0x20')](_0xc15f('0x43'),_0x405470,_0x3e3523[_0xc15f('0x42')]);_0x388d17['LastName']=_0x29f9da!==''?_0x29f9da:util[_0xc15f('0x44')]('Caller\x20-\x20%s',_0x405470);}else if(_0x3e3523[_0xc15f('0x42')]===_0xc15f('0x19')){logger[_0xc15f('0x20')](_0xc15f('0x43'),_0x405470,_0x3e3523[_0xc15f('0x42')]);_0x388d17[_0xc15f('0x45')]=_0x29f9da!==_0xc15f('0x46')?_0x29f9da:util[_0xc15f('0x44')](_0xc15f('0x47'),_0x405470);_0x388d17[_0xc15f('0x48')]=_0xc15f('0x49');}else if(_0x3e3523['moduleCreate']===_0xc15f('0x1b')){logger['info'](_0xc15f('0x43'),_0x405470,_0x3e3523['moduleCreate']);_0x388d17[_0xc15f('0x2a')]=_0x29f9da!==_0xc15f('0x46')?_0x29f9da:util[_0xc15f('0x44')](_0xc15f('0x47'),_0x405470);}else{return null;}}return _0x4e681e['sobject'](_[_0xc15f('0x4a')](_0x3e3523[_0xc15f('0x42')]))[_0xc15f('0x22')](_0x388d17)['then'](function(_0x7bf8ff){return BPromise['resolve']({'id':_0x7bf8ff['id'],'endUserType':_0x3e3523['moduleCreate']});});}});}function getCustomFields(_0x572f39,_0x46d46d){var _0x2baab0={};if(_0x572f39[_0xc15f('0x26')]>0x0){_[_0xc15f('0x4b')](_0x572f39,function(_0x4048c0){if(_[_0xc15f('0x4c')]([_0xc15f('0x4d'),_0xc15f('0x4e')],_0x4048c0[_0xc15f('0x3e')])&&_0x4048c0[_0xc15f('0x4f')]){_0x2baab0[_0x4048c0[_0xc15f('0x4f')]]=_0x4048c0[_0xc15f('0x50')][_0xc15f('0x51')]();}else if(_0x4048c0['type']===_0xc15f('0x52')&&_0x4048c0[_0xc15f('0x53')]&&_0x4048c0[_0xc15f('0x4f')]){_0x46d46d[_0x4048c0[_0xc15f('0x53')]]&&(_0x2baab0[_0x4048c0[_0xc15f('0x4f')]]=_0x46d46d[_0x4048c0[_0xc15f('0x53')]][_0xc15f('0x51')]());}else if(_0x4048c0[_0xc15f('0x3e')]==='customVariable'&&_0x4048c0[_0xc15f('0x54')]&&_0x4048c0[_0xc15f('0x54')][_0xc15f('0x55')]&&_0x4048c0[_0xc15f('0x4f')]){_0x46d46d[_0x4048c0['Variable'][_0xc15f('0x55')][_0xc15f('0x3f')]()]&&(_0x2baab0[_0x4048c0['idField']]=_0x46d46d[_0x4048c0['Variable'][_0xc15f('0x55')][_0xc15f('0x3f')]()][_0xc15f('0x51')]());}});}return _0x2baab0;}function getConnection(_0x3ea00f){var _0x1f4c89=_0x3ea00f[_0xc15f('0x56')]['concat'](_0x3ea00f[_0xc15f('0x57')]);var _0x5342ed=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3ea00f[_0xc15f('0x58')]||_0xc15f('0x59'),'clientId':_0x3ea00f[_0xc15f('0x5a')],'clientSecret':_0x3ea00f[_0xc15f('0x5b')]}});return _0x5342ed['login'](_0x3ea00f[_0xc15f('0x5c')],_0x1f4c89)[_0xc15f('0x2c')](function(){logger[_0xc15f('0x20')](_0xc15f('0x5d'));return _0x5342ed;});}exports[_0xc15f('0x5e')]=function(_0xc9a8e1,_0x213a5c,_0x3bbecc,_0x3a7518,_0x5840f5,_0x2835fa){var _0x39a7d1,_0x13c2ab,_0x581a48,_0x5d5cc5;_0x2835fa[_0xc15f('0x5f')]=intUtil['stripTrailingSlash'](_0x2835fa['serverUrl']);_0x2835fa['remoteUri']=intUtil[_0xc15f('0x60')](_0x2835fa[_0xc15f('0x58')]);if(_0x5840f5&&_0x5840f5[_0xc15f('0x61')]){logger[_0xc15f('0x20')](_0xc15f('0x62'),_0xc15f('0x63'));_0x213a5c['recordingURL']=util['format'](_0xc15f('0x64'),_0x2835fa[_0xc15f('0x5f')],_0x213a5c[_0xc15f('0x65')],md5(_0x213a5c[_0xc15f('0x65')]));}else{_0x213a5c[_0xc15f('0x66')]='';}return getConnection(_0x2835fa)[_0xc15f('0x2c')](function(_0x254c84){_0x5d5cc5=_0x254c84;return getUser(_0x2835fa,_0x3a7518[_0xc15f('0x67')],_0x5d5cc5);})[_0xc15f('0x2c')](function(_0x493a8d){_0x39a7d1=_0x493a8d;return getEndUser(_0x2835fa,_0x3bbecc,_0x213a5c['calleridname'],_0x213a5c[_0xc15f('0x68')],_0x5d5cc5);})[_0xc15f('0x2c')](function(_0x59b4c1){_0x13c2ab=_0x59b4c1;return getTicket(_0x2835fa,_0x39a7d1,_0x13c2ab,_0x3bbecc,_0x213a5c,_0x3bbecc[_0xc15f('0x69')],_0x5d5cc5,'queue');})[_0xc15f('0x2c')](function(_0x24e238){_0x581a48=_0x24e238;logger['info'](_0xc15f('0x6a'),_0x581a48['id']);logger[_0xc15f('0x20')](_0xc15f('0x6b'),_0x581a48['id'],_0x3a7518[_0xc15f('0x55')],_0x2835fa['type']);switch(_0x2835fa['type']){case'integrationTab':emit(util[_0xc15f('0x44')]('user:%s',_0x3a7518['name']),'trigger:salesforce:display',{'recordId':_0x581a48['id']});break;case _0xc15f('0x6c'):emit(util['format'](_0xc15f('0x6d'),_0x3a7518[_0xc15f('0x55')]),_0xc15f('0x6e'),{'uri':util[_0xc15f('0x44')]('%s/%s/e',_0x5d5cc5[_0xc15f('0x6f')],_0x581a48['id'])});break;default:logger[_0xc15f('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xc15f('0x71')](function(_0x3e197b){logger[_0xc15f('0x70')](_0xc15f('0x62'),_0x3e197b);});};exports['outbound']=function(_0x3d714c,_0x5c5296,_0x524c7e,_0x5a1246,_0x2ef485,_0x312a94,_0x264c99){var _0x47387a,_0x369d7c,_0x55596d,_0xd108c5;_0x312a94['serverUrl']=intUtil[_0xc15f('0x60')](_0x312a94[_0xc15f('0x5f')]);_0x312a94[_0xc15f('0x58')]=intUtil['stripTrailingSlash'](_0x312a94[_0xc15f('0x58')]);if(_0x264c99&&_0x264c99['recordingFormat']&&_0x264c99[_0xc15f('0x72')]!==_0xc15f('0x73')){logger[_0xc15f('0x20')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5c5296[_0xc15f('0x66')]=util[_0xc15f('0x44')](_0xc15f('0x64'),_0x312a94[_0xc15f('0x5f')],_0x5c5296[_0xc15f('0x65')],md5(_0x5c5296[_0xc15f('0x65')]));}return getConnection(_0x312a94)[_0xc15f('0x2c')](function(_0x4b5260){_0xd108c5=_0x4b5260;return getUser(_0x312a94,_0x5a1246[_0xc15f('0x67')],_0xd108c5);})['then'](function(_0x4ebf5c){_0x47387a=_0x4ebf5c;return getEndUser(_0x312a94,_0x524c7e,_0x5c5296[_0xc15f('0x74')],_0x5c5296['destcalleridnum'],_0xd108c5);})['then'](function(_0x3e48ab){_0x369d7c=_0x3e48ab;return getTicket(_0x312a94,_0x47387a,_0x369d7c,_0x524c7e,_0x5c5296,_0x524c7e[_0xc15f('0x69')],_0xd108c5,_0xc15f('0x75'));})['then'](function(_0x59468c){_0x55596d=_0x59468c;logger[_0xc15f('0x20')](_0xc15f('0x76'),_0x55596d['id']);logger[_0xc15f('0x20')](_0xc15f('0x77'),_0x55596d['id'],_0x5a1246['name'],_0x312a94['type']);switch(_0x312a94[_0xc15f('0x3e')]){case _0xc15f('0x78'):emit(util[_0xc15f('0x44')](_0xc15f('0x6d'),_0x5a1246[_0xc15f('0x55')]),'trigger:salesforce:display',{'recordId':_0x55596d['id']});break;case _0xc15f('0x6c'):emit(util[_0xc15f('0x44')](_0xc15f('0x6d'),_0x5a1246[_0xc15f('0x55')]),'trigger:browser:url',{'uri':util[_0xc15f('0x44')](_0xc15f('0x79'),_0xd108c5[_0xc15f('0x6f')],_0x55596d['id'])});break;default:logger[_0xc15f('0x70')](_0xc15f('0x7a'),_0xc15f('0x7b'));}})[_0xc15f('0x71')](function(_0x6fa554){logger[_0xc15f('0x70')](_0xc15f('0x7a'),_0x6fa554);});};exports[_0xc15f('0x7c')]=function(_0xc4bb84,_0x428d29,_0x4c5dfc,_0x3d09ef,_0x5d5549,_0x10d539){var _0x21b936,_0x3dd3e7,_0x4e45db,_0x2d2572;_0x10d539['serverUrl']=intUtil[_0xc15f('0x60')](_0x10d539[_0xc15f('0x5f')]);_0x10d539[_0xc15f('0x58')]=intUtil['stripTrailingSlash'](_0x10d539[_0xc15f('0x58')]);if(_0x5d5549&&_0x5d5549['monitor_format']){logger[_0xc15f('0x20')]('['+_0x428d29[_0xc15f('0x7d')][_0xc15f('0x7e')]()+']',_0xc15f('0x63'));_0x428d29[_0xc15f('0x66')]=util[_0xc15f('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10d539['serverUrl'],_0x428d29['uniqueid'],md5(_0x428d29[_0xc15f('0x65')]));}else{_0x428d29[_0xc15f('0x66')]='';}return getConnection(_0x10d539)[_0xc15f('0x2c')](function(_0x1cc1da){_0x2d2572=_0x1cc1da;if(!_[_0xc15f('0x7f')](_0x3d09ef)){return getUser(_0x10d539,_0x3d09ef[_0xc15f('0x55')],_0x2d2572);}else{return getUser(_0x10d539,null,_0x2d2572);}})[_0xc15f('0x2c')](function(_0x362fca){_0x21b936=_0x362fca;return getEndUser(_0x10d539,_0x4c5dfc,_0x428d29[_0xc15f('0x80')],_0x428d29[_0xc15f('0x68')],_0x2d2572);})['then'](function(_0x5d4ad7){_0x3dd3e7=_0x5d4ad7;return getTicket(_0x10d539,_0x21b936,_0x3dd3e7,_0x4c5dfc,_0x428d29,_0x4c5dfc[_0xc15f('0x69')],_0x2d2572);})['then'](function(_0x12c4d5){_0x4e45db=_0x12c4d5;logger[_0xc15f('0x20')]('['+_0x428d29[_0xc15f('0x7d')][_0xc15f('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x4e45db['id']);logger['info']('['+_0x428d29[_0xc15f('0x7d')][_0xc15f('0x7e')]()+_0xc15f('0x81'),_0x10d539[_0xc15f('0x3e')]);})[_0xc15f('0x71')](function(_0x148540){logger['error']('['+_0x428d29[_0xc15f('0x7d')][_0xc15f('0x7e')]()+']',_0x148540);});}; \ 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 acb1ad7..e8f4b0a 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 _0xec19=['Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%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','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','%s/api/now/table/','remoteUri','isNil','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','true','userId','adminEmail','],\x20getUser\x20crm','catch','error','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D'];(function(_0x7cd36,_0x26f475){var _0x3e884a=function(_0x338eee){while(--_0x338eee){_0x7cd36['push'](_0x7cd36['shift']());}};_0x3e884a(++_0x26f475);}(_0xec19,0x95));var _0x9ec1=function(_0xff9595,_0x46129d){_0xff9595=_0xff9595-0x0;var _0x3a8352=_0xec19[_0xff9595];return _0x3a8352;};'use strict';var _=require(_0x9ec1('0x0'));var Promise=require('bluebird');var rp=require(_0x9ec1('0x1'));var util=require(_0x9ec1('0x2'));var md5=require(_0x9ec1('0x3'));var Redis=require(_0x9ec1('0x4'));var intUtil=require(_0x9ec1('0x5'));var config=require(_0x9ec1('0x6'));var logger=require('../../../../config/logger')(_0x9ec1('0x7'));config[_0x9ec1('0x8')]=_[_0x9ec1('0x9')](config['redis'],{'host':_0x9ec1('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x3a9bc4,_0x4bb325,_0xc1ed0e,_0x439f58,_0x1440e5,_0x44caec){return new Promise(function(_0x449d0c,_0x14db2f){var _0x2d97e2={'method':_0x9ec1('0xb'),'uri':_0x439f58+_0x9ec1('0xc')+'&'+_0x1440e5+'&'+_0x44caec,'auth':_0x4bb325,'json':!![]};return rp(_0x2d97e2)[_0x9ec1('0xd')](function(_0x1b6f4e){if(_0x1b6f4e[_0x9ec1('0xe')]['length']>0x0){_0xc1ed0e[_0x9ec1('0xf')]=_0x1b6f4e[_0x9ec1('0xe')][0x0][_0x9ec1('0x10')];}logger[_0x9ec1('0x11')]('['+[_0x3a9bc4[_0x9ec1('0x12')]()]+_0x9ec1('0x13'),_0xc1ed0e);_0x449d0c(_0xc1ed0e);})['catch'](function(_0x55858a){logger['error']('['+[_0x3a9bc4[_0x9ec1('0x12')]()]+']',_0x55858a['message']);_0x14db2f(_0x55858a['message']);});});}function getUser(_0x3a478d,_0x502bcf,_0x15534b,_0x278cda,_0x308045){return function(_0xfb9d4b){logger[_0x9ec1('0x11')]('['+[_0x3a478d[_0x9ec1('0x12')]()]+_0x9ec1('0x14'),_0xfb9d4b);return new Promise(function(_0x246493,_0x32450b){if(intUtil[_0x9ec1('0x15')](_0xfb9d4b[_0x9ec1('0x16')])){var _0x5ccde4={'method':'GET','uri':_0x15534b+_0x9ec1('0x17')+_0xfb9d4b[_0x9ec1('0x16')]+'&'+_0x278cda+'&'+_0x308045,'auth':_0x502bcf,'json':!![]};logger[_0x9ec1('0x11')]('['+[_0x3a478d[_0x9ec1('0x12')]()]+_0x9ec1('0x18'),_0x5ccde4);return rp(_0x5ccde4)[_0x9ec1('0xd')](function(_0x15b4c1){logger['info']('['+[_0x3a478d['toUpperCase']()]+'],\x20getUser\x20entity',_0x15b4c1);if(_0x15b4c1['result'][_0x9ec1('0x19')]>0x0&&String(_0x15b4c1[_0x9ec1('0xe')][0x0]['active'])===_0x9ec1('0x1a')){_0xfb9d4b[_0x9ec1('0x1b')]=_0x15b4c1[_0x9ec1('0xe')][0x0][_0x9ec1('0x10')];}else{_0xfb9d4b[_0x9ec1('0x1b')]=_0xfb9d4b[_0x9ec1('0xf')];_0xfb9d4b['userEmail']=_0xfb9d4b[_0x9ec1('0x1c')];}logger['info']('['+[_0x3a478d[_0x9ec1('0x12')]()]+_0x9ec1('0x1d'),_0xfb9d4b);_0x246493(_0xfb9d4b);})[_0x9ec1('0x1e')](function(_0x3bb228){logger[_0x9ec1('0x1f')]('['+[_0x3a478d[_0x9ec1('0x12')]()]+']',_0x3bb228['message']);_0x32450b(_0x3bb228[_0x9ec1('0x20')]);});}else{logger[_0x9ec1('0x11')]('['+[_0x3a478d[_0x9ec1('0x12')]()]+_0x9ec1('0x21'));_0xfb9d4b[_0x9ec1('0x1b')]=_0xfb9d4b[_0x9ec1('0xf')];_0xfb9d4b[_0x9ec1('0x16')]=_0xfb9d4b['adminEmail'];_0x246493(_0xfb9d4b);}});};}function createEndUser(_0x1a5903,_0x25ecd6,_0x13ccff,_0x3b143f,_0x50270c){logger['info']('['+[_0x1a5903[_0x9ec1('0x12')]()]+_0x9ec1('0x22'),_0x13ccff);return new Promise(function(_0x2722b5,_0x1b3dba){var _0x20bdf5={'method':'POST','uri':_0x3b143f+'sys_user?'+_0x50270c,'body':{'user_name':_0x13ccff['endUserNumber'],'roles':'user','first_name':_0x13ccff['endUserNumber'],'active':_0x9ec1('0x1a'),'date_format':_0x9ec1('0x23'),'phone':_0x13ccff[_0x9ec1('0x24')]},'auth':_0x25ecd6,'json':!![]};return rp(_0x20bdf5)[_0x9ec1('0xd')](function(_0x495dcb){logger[_0x9ec1('0x11')]('['+[_0x1a5903['toUpperCase']()]+_0x9ec1('0x25'),_0x495dcb[_0x9ec1('0xe')]);_0x13ccff[_0x9ec1('0x26')]=_0x495dcb[_0x9ec1('0xe')][_0x9ec1('0x10')];_0x2722b5(_0x13ccff);})[_0x9ec1('0x1e')](function(_0x2573f6){logger[_0x9ec1('0x1f')]('['+[_0x1a5903['toUpperCase']()]+']',_0x2573f6[_0x9ec1('0x20')]);_0x1b3dba(_0x2573f6[_0x9ec1('0x20')]);});});}function getEndUser(_0x2a677f,_0x47a6c5,_0x52b70a,_0x5e3d07,_0x1d9585){return function(_0xa40ad5){logger[_0x9ec1('0x11')]('['+[_0x2a677f['toUpperCase']()]+_0x9ec1('0x27'),_0xa40ad5);return new Promise(function(_0x154c1a,_0x40eeb3){var _0x9df6ea={'method':_0x9ec1('0xb'),'uri':_0x52b70a+_0x9ec1('0x28')+_0xa40ad5[_0x9ec1('0x24')]+'&'+_0x5e3d07+'&'+_0x1d9585,'auth':_0x47a6c5,'json':!![]};return rp(_0x9df6ea)[_0x9ec1('0xd')](function(_0x3e9e5c){if(_0x3e9e5c[_0x9ec1('0xe')]['length']>0x0){_0xa40ad5[_0x9ec1('0x26')]=_0x3e9e5c['result'][0x0][_0x9ec1('0x10')];logger[_0x9ec1('0x11')]('['+[_0x2a677f[_0x9ec1('0x12')]()]+'],\x20getEndUser\x20crm',_0xa40ad5);_0x154c1a(_0xa40ad5);}else{return createEndUser(_0x2a677f,_0x47a6c5,_0xa40ad5,_0x52b70a,_0x5e3d07)['then'](function(_0x441cf8){logger[_0x9ec1('0x11')]('['+[_0x2a677f[_0x9ec1('0x12')]()]+_0x9ec1('0x29'),_0x441cf8);_0x154c1a(_0x441cf8);});}})[_0x9ec1('0x1e')](function(_0x5bb4a7){logger[_0x9ec1('0x1f')]('['+[_0x2a677f[_0x9ec1('0x12')]()]+']',_0x5bb4a7[_0x9ec1('0x20')]);_0x40eeb3(_0x5bb4a7[_0x9ec1('0x20')]);});});};}function getCustomFields(_0x1bfd58,_0x33f3d5){var _0x239a44={};if(_0x1bfd58[_0x9ec1('0x19')]>0x0){_[_0x9ec1('0x2a')](_0x1bfd58,function(_0x338447){if(_[_0x9ec1('0x2b')]([_0x9ec1('0x2c'),_0x9ec1('0x2d')],_0x338447[_0x9ec1('0x2e')])&&_0x338447['nameField']&&!_0x338447[_0x9ec1('0x2f')]){_0x239a44[_0x338447['nameField'][_0x9ec1('0x30')]()]=_0x338447[_0x9ec1('0x31')][_0x9ec1('0x32')]();}else if(_[_0x9ec1('0x2b')]([_0x9ec1('0x2c'),_0x9ec1('0x2d')],_0x338447[_0x9ec1('0x2e')])&&_0x338447['idField']&&_0x338447['customField']){_0x239a44[_0x338447[_0x9ec1('0x33')][_0x9ec1('0x30')]()]=_0x338447[_0x9ec1('0x31')][_0x9ec1('0x32')]();}else if(_0x338447[_0x9ec1('0x2e')]===_0x9ec1('0x34')&&_0x338447[_0x9ec1('0x35')]&&_0x338447[_0x9ec1('0x33')]&&_0x338447[_0x9ec1('0x2f')]){_0x239a44[_0x338447['idField'][_0x9ec1('0x30')]()]=_0x33f3d5[_0x338447[_0x9ec1('0x35')]][_0x9ec1('0x32')]();}else if(_0x338447['type']===_0x9ec1('0x36')&&_0x338447['Variable']&&_0x338447[_0x9ec1('0x37')][_0x9ec1('0x38')]&&_0x338447['idField']&&_0x338447[_0x9ec1('0x2f')]){_0x239a44[_0x338447[_0x9ec1('0x33')][_0x9ec1('0x30')]()]=_0x33f3d5[_0x338447[_0x9ec1('0x37')][_0x9ec1('0x38')][_0x9ec1('0x30')]()][_0x9ec1('0x32')]();}});}return _0x239a44;}function getTicket(_0x27f35a,_0x485692,_0x4a0d23,_0x5df530,_0x159064,_0x4223f2){return function(_0x4d7d07){logger[_0x9ec1('0x11')]('['+[_0x27f35a['toUpperCase']()]+_0x9ec1('0x39'),_0x4d7d07);return new Promise(function(_0x368a2b,_0x21da19){var _0x307a4f=_0x27f35a[_0x9ec1('0x30')]()===_0x9ec1('0x3a')?_0x4d7d07['userId']:_0x4d7d07[_0x9ec1('0x26')];var _0x59d84a={'method':_0x9ec1('0x3b'),'uri':_0x4a0d23+_0x9ec1('0x3c')+'?'+_0x4223f2,'body':Object[_0x9ec1('0x3d')]({},{'active':_0x9ec1('0x1a'),'caller_id':_0x307a4f,'assigned_to':_0x4d7d07[_0x9ec1('0x1b')],'short_description':intUtil[_0x9ec1('0x3e')](_0x5df530[_0x9ec1('0x3f')],_0x159064,'\x20'),'description':intUtil[_0x9ec1('0x3e')](_0x5df530['Descriptions'],_0x159064,'\x0a')},getCustomFields(_0x5df530[_0x9ec1('0x40')],_0x159064)),'auth':_0x485692,'json':!![]};return rp(_0x59d84a)[_0x9ec1('0xd')](function(_0x5788cb){logger[_0x9ec1('0x11')]('['+[_0x27f35a[_0x9ec1('0x12')]()]+_0x9ec1('0x41'),_0x5788cb['result']);_0x4d7d07[_0x9ec1('0x42')]=_0x5788cb['result'][_0x9ec1('0x10')];_0x4d7d07[_0x9ec1('0x43')]=_0x5788cb[_0x9ec1('0xe')]['number'];logger[_0x9ec1('0x11')]('['+[_0x27f35a[_0x9ec1('0x12')]()]+_0x9ec1('0x44'),_0x4d7d07);_0x368a2b(_0x4d7d07);})[_0x9ec1('0x1e')](function(_0x5db200){logger[_0x9ec1('0x1f')]('['+[_0x27f35a[_0x9ec1('0x12')]()]+']',_0x5db200[_0x9ec1('0x20')]);_0x21da19(_0x5db200[_0x9ec1('0x20')]);});});};}function createRemoteTag(_0x1f7b6a,_0x5e0a40,_0x3cfb12,_0xfc414f){return new Promise(function(_0x2da3a8,_0x5f52b5){var _0x3e02a7={'method':_0x9ec1('0x3b'),'uri':_0x3cfb12+_0x9ec1('0x45')+'?'+_0xfc414f,'body':{'short_description':_0x1f7b6a,'global':!![],'active':!![],'name':_0x1f7b6a},'auth':_0x5e0a40,'json':!![]};return rp(_0x3e02a7)['then'](function(_0x3b4c8d){var _0x174dcc=_0x3b4c8d[_0x9ec1('0xe')]['sys_id'];_0x2da3a8(_0x174dcc);});});}function getRemoteTag(_0x567b6a,_0x527e9a,_0x40e73f,_0xfce72a,_0x52cd00){return new Promise(function(_0x42a363,_0x4b17d2){var _0x75808e={'method':_0x9ec1('0xb'),'uri':_0x40e73f+_0x9ec1('0x45')+_0x9ec1('0x46')+_0x567b6a+'&'+_0xfce72a,'auth':_0x527e9a,'json':!![]};return rp(_0x75808e)[_0x9ec1('0xd')](function(_0x1b698e){if(_0x1b698e['result'][_0x9ec1('0x19')]>0x0){var _0x39dbad=_0x1b698e['result'][0x0][_0x9ec1('0x10')];_0x42a363(_0x39dbad);}else{return createRemoteTag(_0x567b6a,_0x527e9a,_0x40e73f,_0xfce72a)['then'](function(_0x98d3de){_0x42a363(_0x98d3de);});}});});}function assignTagToIncident(_0x50d63b,_0x2f3446,_0x5478a2,_0x5d8a8d,_0x917291){return new Promise(function(_0x36fcac,_0x3dfa91){var _0x11cea2={'method':_0x9ec1('0x3b'),'uri':_0x5478a2+'label_entry'+'?'+_0x917291,'body':{'label':_0x50d63b,'table':'incident','id_type':_0x9ec1('0x47'),'table_key':_0x5d8a8d[_0x9ec1('0x42')],'title':_0x9ec1('0x48')+_0x5d8a8d[_0x9ec1('0x43')],'id_display':_0x5d8a8d[_0x9ec1('0x43')]},'auth':_0x2f3446,'json':!![]};return rp(_0x11cea2)['then'](function(_0x2ea8ac){_0x36fcac();})[_0x9ec1('0x1e')](function(){_0x36fcac();});});}function manageTags(_0x59440b,_0x46093e,_0x552c3d,_0x7b546e,_0x17b32d,_0x5d6bc5,_0x25bed9){return new Promise(function(_0x3b3b3c,_0x3714c0){var _0x5162d3=[];_0x46093e[_0x9ec1('0x2a')](function(_0x34d439){_0x5162d3[_0x9ec1('0x49')](getRemoteTag(_0x34d439,_0x552c3d,_0x7b546e,_0x5d6bc5,_0x25bed9));});return Promise[_0x9ec1('0x4a')](_0x5162d3)[_0x9ec1('0xd')](function(_0x11d4d2){if(_0x11d4d2['length']){logger[_0x9ec1('0x11')]('['+[_0x59440b[_0x9ec1('0x12')]()]+_0x9ec1('0x4b'),_0x11d4d2);var _0x40f7de=[];_0x11d4d2[_0x9ec1('0x2a')](function(_0x49aaaf){_0x40f7de[_0x9ec1('0x49')](assignTagToIncident(_0x49aaaf,_0x552c3d,_0x7b546e,_0x17b32d,_0x5d6bc5));});return Promise[_0x9ec1('0x4a')](_0x40f7de)[_0x9ec1('0xd')](function(){_0x3b3b3c();})[_0x9ec1('0x1e')](function(){_0x3b3b3c();});}else{_0x3b3b3c();}});});}function getTags(_0x10c21d,_0x51246b,_0x1214a5,_0x3709fc,_0x27cb3d,_0x5a56af){return function(_0x30b649){return new Promise(function(_0x161db1,_0x2d403a){var _0x5d5e23=[];var _0x3717ee=_0x3709fc[_0x9ec1('0x4c')];if(_0x3717ee&&_0x3717ee[_0x9ec1('0x19')]>0x0){_0x5d5e23=_[_0x9ec1('0x4d')](_0x3717ee,'name');}if(_0x5d5e23[_0x9ec1('0x19')]>0x0){return manageTags(_0x10c21d,_0x5d5e23,_0x51246b,_0x1214a5,_0x30b649,_0x27cb3d,_0x5a56af)[_0x9ec1('0xd')](function(){_0x161db1(_0x30b649);});}else{_0x161db1(_0x30b649);}});};}function emit(_0xcc44a1,_0x4391e1,_0x38bdf4){var _0x249a20=_0x9ec1('0x4e')+_0x9ec1('0x4f')+_0x9ec1('0x50')+'%255EORDERBYDESCnumber';var _0x2bc761={'uri':_0xcc44a1+_0x9ec1('0x51')+_0x38bdf4+_0x249a20};io['to'](util[_0x9ec1('0x52')](_0x9ec1('0x53'),_0x4391e1))[_0x9ec1('0x54')]('trigger:browser:url',_0x2bc761);}exports['cs']=function(_0x48c5c1,_0x2635b7,_0x21cd4a,_0x577094,_0x5cc6e2,_0x37a8fc,_0x335991,_0x36bae4){var _0x25c741={};var _0x2e9e72={'user':_0x37a8fc[_0x9ec1('0x55')],'pass':_0x37a8fc[_0x9ec1('0x56')]};var _0x467bc0=_0x9ec1('0x57');var _0x494eaf=_0x9ec1('0x58');_0x37a8fc['remoteUri']=intUtil[_0x9ec1('0x59')](_0x37a8fc['remoteUri']);_0x37a8fc['serverUrl']=intUtil[_0x9ec1('0x59')](_0x37a8fc['serverUrl']);var _0x38fc50=util[_0x9ec1('0x52')](_0x9ec1('0x5a'),_0x37a8fc[_0x9ec1('0x5b')]);_0x25c741[_0x9ec1('0x16')]=!_[_0x9ec1('0x5c')](_0x577094)?_0x577094['email']:null;_0x25c741[_0x9ec1('0x1c')]=_0x37a8fc['email'];_0x25c741[_0x9ec1('0x24')]=_0x36bae4[_0x9ec1('0x30')]()===_0x9ec1('0x3a')?_0x2635b7[_0x9ec1('0x5d')]:_0x2635b7[_0x9ec1('0x5e')];_0x25c741[_0x9ec1('0x5f')]=_0x36bae4===_0x9ec1('0x60')||_0x36bae4==='unmanaged'?'queue':_0x9ec1('0x3a');var _0x25593a=util[_0x9ec1('0x52')](_0x9ec1('0x61'),_0x37a8fc['serverUrl'],_0x2635b7[_0x9ec1('0x62')],md5(_0x2635b7[_0x9ec1('0x62')]));if(_0x5cc6e2&&_0x5cc6e2[_0x9ec1('0x63')]){logger[_0x9ec1('0x11')](_0x9ec1('0x64'),_0x9ec1('0x65'));_0x2635b7[_0x9ec1('0x66')]=_0x25593a;}else if(_0x335991&&_0x335991['recordingFormat']&&_0x335991[_0x9ec1('0x67')]!==_0x9ec1('0x68')){logger[_0x9ec1('0x11')](_0x9ec1('0x69'),'Recording\x20is\x20enabled!');_0x2635b7[_0x9ec1('0x66')]=_0x25593a;}else{_0x2635b7['recordingURL']='';}return getAdminUser(_0x36bae4,_0x2e9e72,_0x25c741,_0x38fc50,_0x494eaf,_0x467bc0)[_0x9ec1('0xd')](getUser(_0x36bae4,_0x2e9e72,_0x38fc50,_0x494eaf,_0x467bc0))[_0x9ec1('0xd')](getEndUser(_0x36bae4,_0x2e9e72,_0x38fc50,_0x494eaf,_0x467bc0))[_0x9ec1('0xd')](getTicket(_0x36bae4,_0x2e9e72,_0x38fc50,_0x21cd4a,_0x2635b7,_0x494eaf))['then'](function(_0x4f0fa9){logger['info'](util['format'](_0x9ec1('0x6a'),_0x4f0fa9['ticketId']));logger[_0x9ec1('0x11')](util[_0x9ec1('0x52')]('call\x20direction:\x20%s',_0x36bae4));if(_0x36bae4!==_0x9ec1('0x6b')){logger['info']('['+[_0x36bae4['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x37a8fc[_0x9ec1('0x5b')],_0x577094['name'],_0x4f0fa9['ticketId']);}})[_0x9ec1('0x1e')](function(_0x20c5b3){logger[_0x9ec1('0x1f')]('['+[_0x36bae4[_0x9ec1('0x12')]()]+_0x9ec1('0x6c'),util[_0x9ec1('0x6d')](_0x20c5b3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x070f=['%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','servicenow','defaults','redis','localhost','GET','then','result','length','adminId','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','idField','content','toString','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x070f,0x154));var _0xf070=function(_0x105564,_0x1dd73b){_0x105564=_0x105564-0x0;var _0x44cbd7=_0x070f[_0x105564];return _0x44cbd7;};'use strict';var _=require(_0xf070('0x0'));var Promise=require(_0xf070('0x1'));var rp=require(_0xf070('0x2'));var util=require(_0xf070('0x3'));var md5=require(_0xf070('0x4'));var Redis=require(_0xf070('0x5'));var intUtil=require(_0xf070('0x6'));var config=require('../../../../config/environment');var logger=require(_0xf070('0x7'))(_0xf070('0x8'));config['redis']=_[_0xf070('0x9')](config[_0xf070('0xa')],{'host':_0xf070('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf070('0xa')]));function getAdminUser(_0x504a7e,_0xcf8adf,_0x187cf8,_0x54d65d,_0x1a5620,_0x3ca09c){return new Promise(function(_0x14f6eb,_0xc54f75){var _0x5d74d0={'method':_0xf070('0xc'),'uri':_0x54d65d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x1a5620+'&'+_0x3ca09c,'auth':_0xcf8adf,'json':!![]};return rp(_0x5d74d0)[_0xf070('0xd')](function(_0x18da6f){if(_0x18da6f[_0xf070('0xe')][_0xf070('0xf')]>0x0){_0x187cf8[_0xf070('0x10')]=_0x18da6f[_0xf070('0xe')][0x0]['sys_id'];}logger[_0xf070('0x11')]('['+[_0x504a7e[_0xf070('0x12')]()]+'],\x20getAdminUser\x20crm',_0x187cf8);_0x14f6eb(_0x187cf8);})[_0xf070('0x13')](function(_0x2234a5){logger[_0xf070('0x14')]('['+[_0x504a7e['toUpperCase']()]+']',_0x2234a5['message']);_0xc54f75(_0x2234a5[_0xf070('0x15')]);});});}function getUser(_0x4cad5f,_0x14a316,_0x23772b,_0x18b4e0,_0x4edc99){return function(_0x579e73){logger[_0xf070('0x11')]('['+[_0x4cad5f['toUpperCase']()]+_0xf070('0x16'),_0x579e73);return new Promise(function(_0x1d5105,_0x3de791){if(intUtil['validateEmail'](_0x579e73[_0xf070('0x17')])){var _0x1d721b={'method':_0xf070('0xc'),'uri':_0x23772b+_0xf070('0x18')+_0x579e73[_0xf070('0x17')]+'&'+_0x18b4e0+'&'+_0x4edc99,'auth':_0x14a316,'json':!![]};logger[_0xf070('0x11')]('['+[_0x4cad5f[_0xf070('0x12')]()]+_0xf070('0x19'),_0x1d721b);return rp(_0x1d721b)[_0xf070('0xd')](function(_0x3e766a){logger[_0xf070('0x11')]('['+[_0x4cad5f[_0xf070('0x12')]()]+'],\x20getUser\x20entity',_0x3e766a);if(_0x3e766a['result'][_0xf070('0xf')]>0x0&&String(_0x3e766a[_0xf070('0xe')][0x0][_0xf070('0x1a')])==='true'){_0x579e73['userId']=_0x3e766a[_0xf070('0xe')][0x0][_0xf070('0x1b')];}else{_0x579e73['userId']=_0x579e73[_0xf070('0x10')];_0x579e73[_0xf070('0x17')]=_0x579e73[_0xf070('0x1c')];}logger[_0xf070('0x11')]('['+[_0x4cad5f[_0xf070('0x12')]()]+_0xf070('0x1d'),_0x579e73);_0x1d5105(_0x579e73);})[_0xf070('0x13')](function(_0x304b09){logger['error']('['+[_0x4cad5f[_0xf070('0x12')]()]+']',_0x304b09[_0xf070('0x15')]);_0x3de791(_0x304b09[_0xf070('0x15')]);});}else{logger[_0xf070('0x11')]('['+[_0x4cad5f[_0xf070('0x12')]()]+_0xf070('0x1e'));_0x579e73[_0xf070('0x1f')]=_0x579e73['adminId'];_0x579e73[_0xf070('0x17')]=_0x579e73[_0xf070('0x1c')];_0x1d5105(_0x579e73);}});};}function createEndUser(_0x30380e,_0x49a08d,_0x415435,_0x11de18,_0x356171){logger['info']('['+[_0x30380e[_0xf070('0x12')]()]+_0xf070('0x20'),_0x415435);return new Promise(function(_0x3fc3f5,_0x2fb260){var _0xcfc154={'method':_0xf070('0x21'),'uri':_0x11de18+_0xf070('0x22')+_0x356171,'body':{'user_name':_0x415435[_0xf070('0x23')],'roles':_0xf070('0x24'),'first_name':_0x415435[_0xf070('0x23')],'active':_0xf070('0x25'),'date_format':_0xf070('0x26'),'phone':_0x415435['endUserNumber']},'auth':_0x49a08d,'json':!![]};return rp(_0xcfc154)[_0xf070('0xd')](function(_0x2f3c22){logger[_0xf070('0x11')]('['+[_0x30380e[_0xf070('0x12')]()]+_0xf070('0x27'),_0x2f3c22[_0xf070('0xe')]);_0x415435['endUserId']=_0x2f3c22['result'][_0xf070('0x1b')];_0x3fc3f5(_0x415435);})[_0xf070('0x13')](function(_0x43c0cb){logger[_0xf070('0x14')]('['+[_0x30380e[_0xf070('0x12')]()]+']',_0x43c0cb[_0xf070('0x15')]);_0x2fb260(_0x43c0cb[_0xf070('0x15')]);});});}function getEndUser(_0x2b0a19,_0x4b9f7c,_0x1650b5,_0x5d2cd9,_0x18f20b){return function(_0xaabb42){logger[_0xf070('0x11')]('['+[_0x2b0a19[_0xf070('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0xaabb42);return new Promise(function(_0x3b9039,_0xd9d5fc){var _0x30439c={'method':_0xf070('0xc'),'uri':_0x1650b5+_0xf070('0x28')+_0xaabb42[_0xf070('0x23')]+'&'+_0x5d2cd9+'&'+_0x18f20b,'auth':_0x4b9f7c,'json':!![]};return rp(_0x30439c)[_0xf070('0xd')](function(_0x485b35){if(_0x485b35['result'][_0xf070('0xf')]>0x0){_0xaabb42['endUserId']=_0x485b35['result'][0x0][_0xf070('0x1b')];logger[_0xf070('0x11')]('['+[_0x2b0a19[_0xf070('0x12')]()]+_0xf070('0x29'),_0xaabb42);_0x3b9039(_0xaabb42);}else{return createEndUser(_0x2b0a19,_0x4b9f7c,_0xaabb42,_0x1650b5,_0x5d2cd9)['then'](function(_0x561716){logger[_0xf070('0x11')]('['+[_0x2b0a19[_0xf070('0x12')]()]+_0xf070('0x2a'),_0x561716);_0x3b9039(_0x561716);});}})[_0xf070('0x13')](function(_0x31c825){logger[_0xf070('0x14')]('['+[_0x2b0a19[_0xf070('0x12')]()]+']',_0x31c825[_0xf070('0x15')]);_0xd9d5fc(_0x31c825[_0xf070('0x15')]);});});};}function getCustomFields(_0x168682,_0x319ec4){var _0x10fe9e={};if(_0x168682['length']>0x0){_['forEach'](_0x168682,function(_0x464abd){if(_['includes']([_0xf070('0x2b'),_0xf070('0x2c')],_0x464abd[_0xf070('0x2d')])&&_0x464abd[_0xf070('0x2e')]&&!_0x464abd[_0xf070('0x2f')]){_0x10fe9e[_0x464abd[_0xf070('0x2e')][_0xf070('0x30')]()]=_0x464abd['content']['toString']();}else if(_['includes'](['string',_0xf070('0x2c')],_0x464abd[_0xf070('0x2d')])&&_0x464abd[_0xf070('0x31')]&&_0x464abd[_0xf070('0x2f')]){_0x10fe9e[_0x464abd[_0xf070('0x31')][_0xf070('0x30')]()]=_0x464abd[_0xf070('0x32')][_0xf070('0x33')]();}else if(_0x464abd['type']==='variable'&&_0x464abd[_0xf070('0x34')]&&_0x464abd[_0xf070('0x31')]&&_0x464abd[_0xf070('0x2f')]){_0x10fe9e[_0x464abd[_0xf070('0x31')][_0xf070('0x30')]()]=_0x319ec4[_0x464abd[_0xf070('0x34')]]['toString']();}else if(_0x464abd[_0xf070('0x2d')]==='customVariable'&&_0x464abd[_0xf070('0x35')]&&_0x464abd[_0xf070('0x35')][_0xf070('0x36')]&&_0x464abd[_0xf070('0x31')]&&_0x464abd[_0xf070('0x2f')]){_0x10fe9e[_0x464abd[_0xf070('0x31')][_0xf070('0x30')]()]=_0x319ec4[_0x464abd[_0xf070('0x35')][_0xf070('0x36')]['toLowerCase']()][_0xf070('0x33')]();}});}return _0x10fe9e;}function getTicket(_0x3b02c1,_0x162249,_0x13cc81,_0x364a79,_0x6c0051,_0x574193){return function(_0x9ae64){logger[_0xf070('0x11')]('['+[_0x3b02c1[_0xf070('0x12')]()]+_0xf070('0x37'),_0x9ae64);return new Promise(function(_0x4eca9e,_0x38c3fc){var _0xd686d5=_0x3b02c1['toLowerCase']()===_0xf070('0x38')?_0x9ae64[_0xf070('0x1f')]:_0x9ae64['endUserId'];var _0x3789c4={'method':'POST','uri':_0x13cc81+_0xf070('0x39')+'?'+_0x574193,'body':Object[_0xf070('0x3a')]({},{'active':_0xf070('0x25'),'caller_id':_0xd686d5,'assigned_to':_0x9ae64['userId'],'short_description':intUtil[_0xf070('0x3b')](_0x364a79[_0xf070('0x3c')],_0x6c0051,'\x20'),'description':intUtil[_0xf070('0x3b')](_0x364a79[_0xf070('0x3d')],_0x6c0051,'\x0a')},getCustomFields(_0x364a79[_0xf070('0x3e')],_0x6c0051)),'auth':_0x162249,'json':!![]};return rp(_0x3789c4)[_0xf070('0xd')](function(_0x54d32b){logger[_0xf070('0x11')]('['+[_0x3b02c1[_0xf070('0x12')]()]+_0xf070('0x3f'),_0x54d32b[_0xf070('0xe')]);_0x9ae64[_0xf070('0x40')]=_0x54d32b[_0xf070('0xe')][_0xf070('0x1b')];_0x9ae64[_0xf070('0x41')]=_0x54d32b['result']['number'];logger[_0xf070('0x11')]('['+[_0x3b02c1[_0xf070('0x12')]()]+_0xf070('0x42'),_0x9ae64);_0x4eca9e(_0x9ae64);})[_0xf070('0x13')](function(_0x413f3c){logger[_0xf070('0x14')]('['+[_0x3b02c1[_0xf070('0x12')]()]+']',_0x413f3c[_0xf070('0x15')]);_0x38c3fc(_0x413f3c['message']);});});};}function createRemoteTag(_0x489ca6,_0x5c3d14,_0xa023cf,_0x211394){return new Promise(function(_0x7e933e,_0x3ea7e7){var _0x3b3e8d={'method':'POST','uri':_0xa023cf+_0xf070('0x43')+'?'+_0x211394,'body':{'short_description':_0x489ca6,'global':!![],'active':!![],'name':_0x489ca6},'auth':_0x5c3d14,'json':!![]};return rp(_0x3b3e8d)[_0xf070('0xd')](function(_0x435ad8){var _0x2afc9b=_0x435ad8[_0xf070('0xe')][_0xf070('0x1b')];_0x7e933e(_0x2afc9b);});});}function getRemoteTag(_0x4d27b6,_0x1f4650,_0x7c296d,_0x2adb8a,_0x17dabf){return new Promise(function(_0x45f5e7,_0x4b03fc){var _0x3eddc3={'method':_0xf070('0xc'),'uri':_0x7c296d+_0xf070('0x43')+_0xf070('0x44')+_0x4d27b6+'&'+_0x2adb8a,'auth':_0x1f4650,'json':!![]};return rp(_0x3eddc3)[_0xf070('0xd')](function(_0x6609e6){if(_0x6609e6[_0xf070('0xe')]['length']>0x0){var _0x39b921=_0x6609e6[_0xf070('0xe')][0x0]['sys_id'];_0x45f5e7(_0x39b921);}else{return createRemoteTag(_0x4d27b6,_0x1f4650,_0x7c296d,_0x2adb8a)[_0xf070('0xd')](function(_0x564c80){_0x45f5e7(_0x564c80);});}});});}function assignTagToIncident(_0x3149d7,_0x3387ef,_0x4fdaaf,_0x6115c6,_0x5193c6){return new Promise(function(_0x3c1ff8,_0x19b941){var _0x3ecdeb={'method':_0xf070('0x21'),'uri':_0x4fdaaf+_0xf070('0x45')+'?'+_0x5193c6,'body':{'label':_0x3149d7,'table':_0xf070('0x39'),'id_type':'Incident','table_key':_0x6115c6[_0xf070('0x40')],'title':'Incident\x20-\x20'+_0x6115c6[_0xf070('0x41')],'id_display':_0x6115c6[_0xf070('0x41')]},'auth':_0x3387ef,'json':!![]};return rp(_0x3ecdeb)[_0xf070('0xd')](function(_0x25c21f){_0x3c1ff8();})[_0xf070('0x13')](function(){_0x3c1ff8();});});}function manageTags(_0x123c0f,_0x1ba85e,_0x143618,_0x98cc96,_0x396eac,_0x3ebeae,_0x10974d){return new Promise(function(_0x3fc16e,_0x1dcd84){var _0x52a94b=[];_0x1ba85e['forEach'](function(_0xebebdd){_0x52a94b[_0xf070('0x46')](getRemoteTag(_0xebebdd,_0x143618,_0x98cc96,_0x3ebeae,_0x10974d));});return Promise[_0xf070('0x47')](_0x52a94b)['then'](function(_0x3c85e4){if(_0x3c85e4[_0xf070('0xf')]){logger[_0xf070('0x11')]('['+[_0x123c0f[_0xf070('0x12')]()]+_0xf070('0x48'),_0x3c85e4);var _0x5e2565=[];_0x3c85e4['forEach'](function(_0x212d6a){_0x5e2565[_0xf070('0x46')](assignTagToIncident(_0x212d6a,_0x143618,_0x98cc96,_0x396eac,_0x3ebeae));});return Promise[_0xf070('0x47')](_0x5e2565)[_0xf070('0xd')](function(){_0x3fc16e();})[_0xf070('0x13')](function(){_0x3fc16e();});}else{_0x3fc16e();}});});}function getTags(_0x184536,_0x563447,_0x5dc313,_0x397042,_0x485584,_0x4896dd){return function(_0x1556d2){return new Promise(function(_0x36c80c,_0x748135){var _0x42ecb7=[];var _0x48ae26=_0x397042[_0xf070('0x49')];if(_0x48ae26&&_0x48ae26['length']>0x0){_0x42ecb7=_[_0xf070('0x4a')](_0x48ae26,_0xf070('0x36'));}if(_0x42ecb7[_0xf070('0xf')]>0x0){return manageTags(_0x184536,_0x42ecb7,_0x563447,_0x5dc313,_0x1556d2,_0x485584,_0x4896dd)[_0xf070('0xd')](function(){_0x36c80c(_0x1556d2);});}else{_0x36c80c(_0x1556d2);}});};}function emit(_0x5620d1,_0x3c77d7,_0x55df23){var _0x24e05d=_0xf070('0x4b')+_0xf070('0x4c')+_0xf070('0x4d')+'%255EORDERBYDESCnumber';var _0x153a05={'uri':_0x5620d1+_0xf070('0x4e')+_0x55df23+_0x24e05d};io['to'](util[_0xf070('0x4f')]('user:%s',_0x3c77d7))[_0xf070('0x50')]('trigger:browser:url',_0x153a05);}exports['cs']=function(_0x1fbece,_0x2de784,_0x103a93,_0x2dc799,_0x1856d9,_0x58e0fa,_0x4c9215,_0x5c8868){var _0x3e0308={};var _0x5546f8={'user':_0x58e0fa[_0xf070('0x51')],'pass':_0x58e0fa['password']};var _0x581ad3=_0xf070('0x52');var _0x2fa337=_0xf070('0x53');_0x58e0fa[_0xf070('0x54')]=intUtil[_0xf070('0x55')](_0x58e0fa[_0xf070('0x54')]);_0x58e0fa[_0xf070('0x56')]=intUtil[_0xf070('0x55')](_0x58e0fa[_0xf070('0x56')]);var _0x22f00a=util['format'](_0xf070('0x57'),_0x58e0fa[_0xf070('0x54')]);_0x3e0308[_0xf070('0x17')]=!_[_0xf070('0x58')](_0x2dc799)?_0x2dc799['email']:null;_0x3e0308[_0xf070('0x1c')]=_0x58e0fa[_0xf070('0x59')];_0x3e0308[_0xf070('0x23')]=_0x5c8868['toLowerCase']()===_0xf070('0x38')?_0x2de784['destcalleridnum']:_0x2de784[_0xf070('0x5a')];_0x3e0308[_0xf070('0x5b')]=_0x5c8868===_0xf070('0x5c')||_0x5c8868===_0xf070('0x5d')?_0xf070('0x5c'):'outbound';var _0x488b33=util['format'](_0xf070('0x5e'),_0x58e0fa['serverUrl'],_0x2de784[_0xf070('0x5f')],md5(_0x2de784[_0xf070('0x5f')]));if(_0x1856d9&&_0x1856d9['monitor_format']){logger[_0xf070('0x11')]('[QUEUE]',_0xf070('0x60'));_0x2de784['recordingURL']=_0x488b33;}else if(_0x4c9215&&_0x4c9215[_0xf070('0x61')]&&_0x4c9215[_0xf070('0x61')]!=='none'){logger[_0xf070('0x11')](_0xf070('0x62'),'Recording\x20is\x20enabled!');_0x2de784[_0xf070('0x63')]=_0x488b33;}else{_0x2de784['recordingURL']='';}return getAdminUser(_0x5c8868,_0x5546f8,_0x3e0308,_0x22f00a,_0x2fa337,_0x581ad3)['then'](getUser(_0x5c8868,_0x5546f8,_0x22f00a,_0x2fa337,_0x581ad3))[_0xf070('0xd')](getEndUser(_0x5c8868,_0x5546f8,_0x22f00a,_0x2fa337,_0x581ad3))['then'](getTicket(_0x5c8868,_0x5546f8,_0x22f00a,_0x103a93,_0x2de784,_0x2fa337))[_0xf070('0xd')](function(_0x4b9cae){logger[_0xf070('0x11')](util[_0xf070('0x4f')](_0xf070('0x64'),_0x4b9cae[_0xf070('0x40')]));logger[_0xf070('0x11')](util[_0xf070('0x4f')]('call\x20direction:\x20%s',_0x5c8868));if(_0x5c8868!=='unmanaged'){logger['info']('['+[_0x5c8868[_0xf070('0x12')]()]+']',_0xf070('0x65'));emit(_0x58e0fa[_0xf070('0x54')],_0x2dc799[_0xf070('0x36')],_0x4b9cae[_0xf070('0x40')]);}})[_0xf070('0x13')](function(_0x19172e){logger[_0xf070('0x14')]('['+[_0x5c8868[_0xf070('0x12')]()]+_0xf070('0x66'),util[_0xf070('0x67')](_0x19172e,{'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 7b71dfc..3d21be5 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 _0x146a=['Inbound','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase','isNil','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','Creating\x20new\x20ticket...','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','duration_hours','parent_id','parent_type','Contacts','name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','then','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','toLowerCase','toString','content','Variable','custom_fields','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Fields'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x146a,0x8d));var _0xa146=function(_0x5ee0ee,_0x3ce413){_0x5ee0ee=_0x5ee0ee-0x0;var _0x198093=_0x146a[_0x5ee0ee];return _0x198093;};'use strict';var _=require(_0xa146('0x0'));var rp=require('request-promise');var BPromise=require(_0xa146('0x1'));var md5=require('md5');var util=require(_0xa146('0x2'));var Redis=require(_0xa146('0x3'));var intUtil=require(_0xa146('0x4'));var config=require(_0xa146('0x5'));var logger=require(_0xa146('0x6'))(_0xa146('0x7'));config[_0xa146('0x8')]=_[_0xa146('0x9')](config[_0xa146('0x8')],{'host':_0xa146('0xa'),'port':0x18eb});var io=require(_0xa146('0xb'))(new Redis(config[_0xa146('0x8')]));var def={'method':_0xa146('0xc'),'json':!![]};function emit(_0x910957,_0x584894,_0x2ea082){io['to'](_0x910957)['emit'](_0x584894,_0x2ea082);}function getTicket(_0x550b80,_0x4ff822,_0x41896d,_0x4b00db,_0x142775,_0x4d96a9,_0x3ce960,_0x319175){logger['info'](_0xa146('0xd'));var _0x2d03aa=new Date();var _0x5d624d=[{'name':'name','value':intUtil[_0xa146('0xe')](_0x4b00db[_0xa146('0xf')],_0x142775,'\x20')},{'name':'assigned_user_id','value':_0x4ff822['id']},{'name':_0xa146('0x10'),'value':_0x4ff822['id']},{'name':_0xa146('0x11'),'value':intUtil['getString'](_0x4b00db[_0xa146('0x12')],_0x142775,'\x0a')},{'name':_0xa146('0x13'),'value':_0x2d03aa[_0xa146('0x14')]()[_0xa146('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0xa146('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xa146('0x17'),'value':_0x41896d['id']},{'name':_0xa146('0x18'),'value':_0xa146('0x19')},{'name':'parent_name','value':_0x41896d[_0xa146('0x1a')]},{'name':'direction','value':_0x319175}];if(_0x4d96a9[_0xa146('0x1b')]){_[_0xa146('0x1c')](_0x4d96a9,function(_0x89b632){if(_0x142775[_0x89b632[_0xa146('0x1d')]]){_0x5d624d[_0xa146('0x1e')]({'name':_0x89b632[_0xa146('0x1f')],'value':_0x142775[_0x89b632['variableName']]});}});}return request({'form':{'method':_0xa146('0x20'),'input_type':'JSON','response_type':_0xa146('0x21'),'rest_data':JSON[_0xa146('0x22')]({'session':_0x3ce960['id'],'module_name':_0xa146('0x23'),'name_value_list':_0x5d624d})}});}function getAuth(_0x4c7a7f){return util[_0xa146('0x24')](_0xa146('0x25'),new Buffer(_0x4c7a7f[_0xa146('0x26')]+':X')['toString'](_0xa146('0x27')));}function getServerInfo(_0x45977f){return request({'form':{'method':_0xa146('0x28'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa146('0x22')]({'session':_0x45977f['id']})}});}function getUser(_0x267246,_0x9a5cb6,_0x32d256){if(!_['isNil'](_0x9a5cb6)){logger[_0xa146('0x29')](_0xa146('0x2a'),_0x9a5cb6);return request({'form':{'method':_0xa146('0x2b'),'input_type':'JSON','response_type':_0xa146('0x21'),'rest_data':JSON[_0xa146('0x22')]({'session':_0x32d256['id'],'module_name':_0xa146('0x2c'),'query':util[_0xa146('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x9a5cb6),'order_by':'','offset':'0','select_fields':['id',_0xa146('0x1a'),_0xa146('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x15ef5a){if(_0x15ef5a['entry_list'][_0xa146('0x1b')]){var _0x49bef0=_['find'](_0x15ef5a['entry_list'],function(_0x65e1ef){return _0x65e1ef[_0xa146('0x2e')][_0xa146('0x2d')][_0xa146('0x2f')]===_0x9a5cb6;});if(_0x49bef0){logger[_0xa146('0x29')](_0xa146('0x30'));return BPromise['resolve']({'id':_0x49bef0[_0xa146('0x2e')]['id']['value'],'name':_0x49bef0[_0xa146('0x2e')][_0xa146('0x1a')][_0xa146('0x2f')]});}}logger[_0xa146('0x29')](_0xa146('0x31'));return BPromise[_0xa146('0x32')]({'id':_0x32d256[_0xa146('0x2e')][_0xa146('0x33')][_0xa146('0x2f')],'name':_0x32d256[_0xa146('0x2e')][_0xa146('0x2d')][_0xa146('0x2f')]});});}else{logger[_0xa146('0x29')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x32d256[_0xa146('0x2e')][_0xa146('0x33')]['value'],'name':_0x32d256[_0xa146('0x2e')]['user_name']['value']});}}function getEndUser(_0x300efd,_0x4e6ac9,_0x6128d5,_0x31b90e){logger['info'](_0xa146('0x34'),_0x6128d5);return request({'form':{'method':_0xa146('0x2b'),'input_type':_0xa146('0x21'),'response_type':_0xa146('0x21'),'rest_data':JSON['stringify']({'session':_0x31b90e['id'],'module_name':_0xa146('0x19'),'query':util[_0xa146('0x24')](_0xa146('0x35'),_0x6128d5),'order_by':'','offset':'0','select_fields':['id','name',_0xa146('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x45ea08){if(_0x45ea08[_0xa146('0x37')][_0xa146('0x1b')]){var _0x18ee6f=_[_0xa146('0x38')](_0x45ea08[_0xa146('0x37')],function(_0x2e9740){return _0x2e9740[_0xa146('0x2e')][_0xa146('0x36')][_0xa146('0x2f')]===_0x6128d5;});if(_0x18ee6f){logger[_0xa146('0x29')]('Enduser\x20found!');return BPromise[_0xa146('0x32')]({'id':_0x18ee6f[_0xa146('0x2e')]['id'][_0xa146('0x2f')],'name':_0x18ee6f[_0xa146('0x2e')]['name']['value'],'phone':_0x18ee6f['name_value_list'][_0xa146('0x36')][_0xa146('0x2f')]});}}else{logger['info'](_0xa146('0x39'));return request({'form':{'method':_0xa146('0x20'),'input_type':_0xa146('0x21'),'response_type':_0xa146('0x21'),'rest_data':JSON[_0xa146('0x22')]({'session':_0x31b90e['id'],'module_name':_0xa146('0x19'),'name_value_list':[{'name':_0xa146('0x3a'),'value':_0x4e6ac9!==_0xa146('0x3b')?_0x4e6ac9:util[_0xa146('0x24')]('Caller\x20-\x20%s',_0x6128d5)},{'name':_0xa146('0x36'),'value':_0x6128d5}]})}})[_0xa146('0x3c')](function(_0x40de5a){logger[_0xa146('0x29')](_0xa146('0x3d'));return BPromise[_0xa146('0x32')]({'id':_0x40de5a['id'],'name':_0x40de5a[_0xa146('0x37')][_0xa146('0x3a')][_0xa146('0x2f')],'phone':_0x40de5a[_0xa146('0x37')][_0xa146('0x36')]['value']});});}});}function request(_0x1a4bee){logger[_0xa146('0x3e')](_0xa146('0x3f'),JSON['stringify'](_0x1a4bee));return rp(_[_0xa146('0x40')](def,_0x1a4bee));}function getTags(_0x203d5a,_0x27e97d){var _0x5450f5=[];if(_0x203d5a&&_0x203d5a[_0xa146('0x1b')]>0x0){_0x5450f5=_[_0xa146('0x41')](_0x203d5a,_0x27e97d);}return _0x5450f5;}function getCustomFields(_0x47748c,_0x2371cd){var _0x20e3f3=[];var _0x16cc18={'custom_fields':[]};if(_0x47748c['length']>0x0){_['forEach'](_0x47748c,function(_0x39d431){if(_0x39d431[_0xa146('0x42')]===_0xa146('0x43')&&_0x39d431['nameField']&&!_0x39d431[_0xa146('0x44')]){_0x16cc18[_0x39d431['nameField'][_0xa146('0x45')]()]=_0x39d431['content'][_0xa146('0x46')]();}else if(_0x39d431[_0xa146('0x42')]===_0xa146('0x43')&&_0x39d431[_0xa146('0x1f')]&&_0x39d431[_0xa146('0x44')]){_0x16cc18['custom_fields'][_0xa146('0x1e')]({'id':_0x39d431[_0xa146('0x1f')],'value':_0x39d431[_0xa146('0x47')][_0xa146('0x46')]()});}else if(_0x39d431[_0xa146('0x42')]==='variable'&&_0x39d431[_0xa146('0x1d')]&&_0x39d431[_0xa146('0x1f')]&&_0x39d431[_0xa146('0x44')]){_0x2371cd[_0x39d431['variableName']]&&_0x16cc18['custom_fields']['push']({'id':_0x39d431['idField'],'value':_0x2371cd[_0x39d431['variableName']][_0xa146('0x46')]()});}else if(_0x39d431[_0xa146('0x42')]==='customVariable'&&_0x39d431[_0xa146('0x48')]&&_0x39d431[_0xa146('0x48')][_0xa146('0x1a')]&&_0x39d431['idField']&&_0x39d431[_0xa146('0x44')]){_0x2371cd[_0x39d431[_0xa146('0x48')]['name'][_0xa146('0x45')]()]&&_0x16cc18[_0xa146('0x49')][_0xa146('0x1e')]({'id':_0x39d431[_0xa146('0x1f')],'value':_0x2371cd[_0x39d431[_0xa146('0x48')][_0xa146('0x1a')]['toLowerCase']()][_0xa146('0x46')]()});}});}return _0x16cc18;}function getConnection(_0x363875){return request({'method':_0xa146('0xc'),'form':{'method':_0xa146('0x4a'),'input_type':'JSON','response_type':_0xa146('0x21'),'rest_data':JSON[_0xa146('0x22')]({'user_auth':{'user_name':_0x363875[_0xa146('0x4b')],'password':_0x363875[_0xa146('0x4c')],'encryption':'PLAIN'},'application':_0xa146('0x4d')})}})[_0xa146('0x3c')](function(_0x553f7b){var _0x1da92a=_0x553f7b;if(_0x1da92a['id']){def[_0xa146('0x4e')]=_0x1da92a['id'];return BPromise[_0xa146('0x32')](_0x1da92a);}else{throw new Error(util[_0xa146('0x24')](_0xa146('0x4f'),_0x363875['id']));}});}function setRelationship(_0x1b57b1,_0x1f53fa,_0x336b8f,_0x125014){return request({'form':{'method':_0xa146('0x50'),'input_type':_0xa146('0x21'),'response_type':_0xa146('0x21'),'rest_data':JSON['stringify']({'session':_0x1b57b1['id'],'module_name':'Calls','module_id':_0x336b8f['id'],'link_field_name':_0x125014,'related_ids':[_0x1f53fa['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x166023,_0x2737d9,_0x5b27e9,_0x18319f,_0x43106c,_0xca5e83){var _0x230327,_0x1ef410,_0x1bff95,_0x38dd3b;_0xca5e83['remoteUri']=intUtil[_0xa146('0x51')](_0xca5e83['remoteUri']);_0xca5e83[_0xa146('0x52')]=intUtil['stripTrailingSlash'](_0xca5e83[_0xa146('0x52')]);def[_0xa146('0x53')]=util[_0xa146('0x24')](_0xa146('0x54'),_0xca5e83[_0xa146('0x55')]);if(_0x43106c&&_0x43106c[_0xa146('0x56')]){logger[_0xa146('0x29')](_0xa146('0x57'),_0xa146('0x58'));_0x2737d9[_0xa146('0x59')]=util[_0xa146('0x24')](_0xa146('0x5a'),_0xca5e83[_0xa146('0x52')],_0x2737d9[_0xa146('0x5b')],md5(_0x2737d9[_0xa146('0x5b')]));}else{_0x2737d9[_0xa146('0x59')]='';}return getConnection(_0xca5e83)[_0xa146('0x3c')](function(_0x3d2e26){_0x38dd3b=_0x3d2e26;return getUser(_0xca5e83,_0x18319f[_0xa146('0x1a')],_0x38dd3b);})[_0xa146('0x3c')](function(_0x268310){_0x230327=_0x268310;logger[_0xa146('0x29')](_0xa146('0x5c'),_0x230327['id']);return getEndUser(_0xca5e83,_0x2737d9['calleridname'],_0x2737d9[_0xa146('0x5d')],_0x38dd3b);})[_0xa146('0x3c')](function(_0x3d9548){_0x1ef410=_0x3d9548;logger[_0xa146('0x29')]('The\x20Enduser\x20ID\x20is:',_0x1ef410['id']);return getTicket(_0xca5e83,_0x230327,_0x1ef410,_0x5b27e9,_0x2737d9,_0x5b27e9[_0xa146('0x5e')],_0x38dd3b,_0xa146('0x5f'));})[_0xa146('0x3c')](function(_0x15c2d1){_0x1bff95=_0x15c2d1;logger[_0xa146('0x29')]('Ticket\x20created!');logger[_0xa146('0x29')]('The\x20Ticket\x20ID\x20is:',_0x1bff95['id']);return setRelationship(_0x38dd3b,_0x230327,_0x1bff95,_0xa146('0x60'));})[_0xa146('0x3c')](function(){return setRelationship(_0x38dd3b,_0x1ef410,_0x1bff95,_0xa146('0x61'));})['then'](function(){return getServerInfo(_0x38dd3b);})[_0xa146('0x3c')](function(_0x7b75ad){var _0x563764=parseInt(_0x7b75ad[_0xa146('0x62')][_0xa146('0x63')](0x0));var _0x14c12e=util[_0xa146('0x24')](_0xa146('0x64'),_0xca5e83['remoteUri'],_0x1bff95['id']);if(_0x563764>0x6){_0x14c12e=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xca5e83[_0xa146('0x55')],_0x1bff95['id']);}logger[_0xa146('0x29')](_0xa146('0x57'),_0xa146('0x65'));emit(util[_0xa146('0x24')](_0xa146('0x66'),_0x18319f[_0xa146('0x1a')]),'trigger:browser:url',{'uri':_0x14c12e});})[_0xa146('0x67')](function(_0x2a1445){logger[_0xa146('0x68')]('[QUEUE]',JSON[_0xa146('0x22')](_0x2a1445));});};exports[_0xa146('0x69')]=function(_0x168f9f,_0xfdcafa,_0x2dd08d,_0x431ba9,_0x230571,_0x892459,_0x48948e){var _0x2c0445,_0x4450ef,_0x29a99b,_0x30860c;_0x892459[_0xa146('0x55')]=intUtil[_0xa146('0x51')](_0x892459[_0xa146('0x55')]);_0x892459[_0xa146('0x52')]=intUtil[_0xa146('0x51')](_0x892459[_0xa146('0x52')]);def['uri']=util['format'](_0xa146('0x54'),_0x892459[_0xa146('0x55')]);if(_0x48948e&&_0x48948e[_0xa146('0x6a')]&&_0x48948e['recordingFormat']!=='none'){logger[_0xa146('0x29')]('[OUTBOUND]',_0xa146('0x58'));_0xfdcafa[_0xa146('0x59')]=util[_0xa146('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x892459[_0xa146('0x52')],_0xfdcafa[_0xa146('0x5b')],md5(_0xfdcafa[_0xa146('0x5b')]));}return getConnection(_0x892459)[_0xa146('0x3c')](function(_0x23e3a7){_0x30860c=_0x23e3a7;return getUser(_0x892459,_0x431ba9[_0xa146('0x1a')],_0x30860c);})['then'](function(_0x393de3){_0x2c0445=_0x393de3;logger['info'](_0xa146('0x5c'),_0x2c0445['id']);return getEndUser(_0x892459,_0xfdcafa[_0xa146('0x6b')],_0xfdcafa[_0xa146('0x6c')],_0x30860c);})[_0xa146('0x3c')](function(_0x506d28){_0x4450ef=_0x506d28;logger['info'](_0xa146('0x6d'),_0x4450ef['id']);return getTicket(_0x892459,_0x2c0445,_0x4450ef,_0x2dd08d,_0xfdcafa,_0x2dd08d['Fields'],_0x30860c,_0xa146('0x6e'));})[_0xa146('0x3c')](function(_0x438f2a){_0x29a99b=_0x438f2a;logger[_0xa146('0x29')](_0xa146('0x6f'));logger[_0xa146('0x29')](_0xa146('0x70'),_0x29a99b['id']);return setRelationship(_0x30860c,_0x2c0445,_0x29a99b,_0xa146('0x60'));})[_0xa146('0x3c')](function(){return setRelationship(_0x30860c,_0x4450ef,_0x29a99b,_0xa146('0x61'));})[_0xa146('0x3c')](function(){return getServerInfo(_0x30860c);})[_0xa146('0x3c')](function(_0x4806ef){var _0x5d9f8f=parseInt(_0x4806ef['version']['charAt'](0x0));var _0x5ef381=util['format'](_0xa146('0x64'),_0x892459[_0xa146('0x55')],_0x29a99b['id']);if(_0x5d9f8f>0x6){_0x5ef381=util[_0xa146('0x24')](_0xa146('0x71'),_0x892459['remoteUri'],_0x29a99b['id']);}logger['info']('[OUTBOUND]',_0xa146('0x65'));emit(util[_0xa146('0x24')](_0xa146('0x66'),_0x431ba9[_0xa146('0x1a')]),'trigger:browser:url',{'uri':_0x5ef381});})[_0xa146('0x67')](function(_0x599467){logger[_0xa146('0x68')]('[OUTBOUND]',JSON['stringify'](_0x599467));});};exports[_0xa146('0x72')]=function(_0x33f5f3,_0x1dd55e,_0x24019c,_0x3d205b,_0x107276,_0x19ff71){var _0x4d0c60,_0x32b1ab,_0x59be1f,_0x1dafb4;_0x19ff71[_0xa146('0x55')]=intUtil[_0xa146('0x51')](_0x19ff71[_0xa146('0x55')]);_0x19ff71[_0xa146('0x52')]=intUtil[_0xa146('0x51')](_0x19ff71[_0xa146('0x52')]);def['uri']=util[_0xa146('0x24')](_0xa146('0x54'),_0x19ff71[_0xa146('0x55')]);if(_0x107276&&_0x107276[_0xa146('0x56')]){logger[_0xa146('0x29')]('['+_0x1dd55e[_0xa146('0x73')][_0xa146('0x74')]()+']',_0xa146('0x58'));_0x1dd55e[_0xa146('0x59')]=util['format'](_0xa146('0x5a'),_0x19ff71[_0xa146('0x52')],_0x1dd55e[_0xa146('0x5b')],md5(_0x1dd55e[_0xa146('0x5b')]));}else{_0x1dd55e['recordingURL']='';}return getConnection(_0x19ff71)[_0xa146('0x3c')](function(_0x174e37){_0x1dafb4=_0x174e37;if(!_[_0xa146('0x75')](_0x3d205b)){return getUser(_0x19ff71,_0x3d205b[_0xa146('0x1a')],_0x1dafb4);}else{return getUser(_0x19ff71,null,_0x1dafb4);}})[_0xa146('0x3c')](function(_0x3b675a){_0x4d0c60=_0x3b675a;logger[_0xa146('0x29')](_0xa146('0x5c'),_0x4d0c60['id']);return getEndUser(_0x19ff71,_0x1dd55e['calleridname'],_0x1dd55e[_0xa146('0x5d')],_0x1dafb4);})['then'](function(_0x2fc8fb){_0x32b1ab=_0x2fc8fb;logger[_0xa146('0x29')](_0xa146('0x6d'),_0x32b1ab['id']);return getTicket(_0x19ff71,_0x4d0c60,_0x32b1ab,_0x24019c,_0x1dd55e,_0x24019c[_0xa146('0x5e')],_0x1dafb4,'Inbound');})[_0xa146('0x3c')](function(_0x323fd4){_0x59be1f=_0x323fd4;logger[_0xa146('0x29')](_0xa146('0x6f'));logger[_0xa146('0x29')](_0xa146('0x70'),_0x59be1f['id']);return setRelationship(_0x1dafb4,_0x4d0c60,_0x59be1f,_0xa146('0x60'));})['then'](function(){return setRelationship(_0x1dafb4,_0x32b1ab,_0x59be1f,'contacts');})[_0xa146('0x3c')](function(){return getServerInfo(_0x1dafb4);})[_0xa146('0x67')](function(_0x4c63c3){logger[_0xa146('0x68')]('['+_0x1dd55e[_0xa146('0x73')][_0xa146('0x74')]()+']',JSON[_0xa146('0x22')](_0x4c63c3));});}; \ No newline at end of file +var _0x561d=['length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','variable','customVariable','Variable','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','uri','%s/service/v4_1/rest.php','remoteUri','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','catch','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','direction'];(function(_0x250b1c,_0x5887f4){var _0x30d864=function(_0x1b8aec){while(--_0x1b8aec){_0x250b1c['push'](_0x250b1c['shift']());}};_0x30d864(++_0x5887f4);}(_0x561d,0x14f));var _0xd561=function(_0xbc6cf2,_0x31be69){_0xbc6cf2=_0xbc6cf2-0x0;var _0x55bf76=_0x561d[_0xbc6cf2];return _0x55bf76;};'use strict';var _=require('lodash');var rp=require(_0xd561('0x0'));var BPromise=require(_0xd561('0x1'));var md5=require('md5');var util=require(_0xd561('0x2'));var Redis=require(_0xd561('0x3'));var intUtil=require(_0xd561('0x4'));var config=require(_0xd561('0x5'));var logger=require(_0xd561('0x6'))(_0xd561('0x7'));config[_0xd561('0x8')]=_['defaults'](config[_0xd561('0x8')],{'host':_0xd561('0x9'),'port':0x18eb});var io=require(_0xd561('0xa'))(new Redis(config[_0xd561('0x8')]));var def={'method':_0xd561('0xb'),'json':!![]};function emit(_0x1ef746,_0x15801d,_0x55bf0e){io['to'](_0x1ef746)[_0xd561('0xc')](_0x15801d,_0x55bf0e);}function getTicket(_0x3229eb,_0x4a428c,_0x4fb345,_0x4c0c18,_0x2729b5,_0x56e7e0,_0x86b192,_0x6d616){logger[_0xd561('0xd')](_0xd561('0xe'));var _0x4fff22=new Date();var _0x6d942e=[{'name':_0xd561('0xf'),'value':intUtil[_0xd561('0x10')](_0x4c0c18[_0xd561('0x11')],_0x2729b5,'\x20')},{'name':'assigned_user_id','value':_0x4a428c['id']},{'name':_0xd561('0x12'),'value':_0x4a428c['id']},{'name':'description','value':intUtil['getString'](_0x4c0c18[_0xd561('0x13')],_0x2729b5,'\x0a')},{'name':_0xd561('0x14'),'value':_0x4fff22[_0xd561('0x15')]()['slice'](0x0,0x13)[_0xd561('0x16')]('T','\x20')},{'name':_0xd561('0x17'),'value':'0'},{'name':_0xd561('0x18'),'value':'15'},{'name':_0xd561('0x19'),'value':_0x4fb345['id']},{'name':_0xd561('0x1a'),'value':'Contacts'},{'name':'parent_name','value':_0x4fb345['name']},{'name':_0xd561('0x1b'),'value':_0x6d616}];if(_0x56e7e0[_0xd561('0x1c')]){_[_0xd561('0x1d')](_0x56e7e0,function(_0x306dea){if(_0x2729b5[_0x306dea[_0xd561('0x1e')]]){_0x6d942e[_0xd561('0x1f')]({'name':_0x306dea[_0xd561('0x20')],'value':_0x2729b5[_0x306dea[_0xd561('0x1e')]]});}});}return request({'form':{'method':_0xd561('0x21'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x86b192['id'],'module_name':_0xd561('0x24'),'name_value_list':_0x6d942e})}});}function getAuth(_0x50272d){return util[_0xd561('0x25')]('Basic\x20%s',new Buffer(_0x50272d[_0xd561('0x26')]+':X')['toString']('base64'));}function getServerInfo(_0x36d622){return request({'form':{'method':_0xd561('0x27'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x36d622['id']})}});}function getUser(_0x597229,_0x4a9fb3,_0x102b3b){if(!_[_0xd561('0x28')](_0x4a9fb3)){logger[_0xd561('0xd')](_0xd561('0x29'),_0x4a9fb3);return request({'form':{'method':_0xd561('0x2a'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x102b3b['id'],'module_name':_0xd561('0x2b'),'query':util[_0xd561('0x25')](_0xd561('0x2c'),_0x4a9fb3),'order_by':'','offset':'0','select_fields':['id',_0xd561('0xf'),_0xd561('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd561('0x2e')](function(_0x33f090){if(_0x33f090[_0xd561('0x2f')][_0xd561('0x1c')]){var _0x52711f=_['find'](_0x33f090[_0xd561('0x2f')],function(_0x2570a8){return _0x2570a8[_0xd561('0x30')]['user_name'][_0xd561('0x31')]===_0x4a9fb3;});if(_0x52711f){logger[_0xd561('0xd')]('Agent\x20found!');return BPromise[_0xd561('0x32')]({'id':_0x52711f[_0xd561('0x30')]['id']['value'],'name':_0x52711f[_0xd561('0x30')][_0xd561('0xf')][_0xd561('0x31')]});}}logger[_0xd561('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd561('0x32')]({'id':_0x102b3b['name_value_list'][_0xd561('0x33')]['value'],'name':_0x102b3b[_0xd561('0x30')][_0xd561('0x2d')]['value']});});}else{logger[_0xd561('0xd')](_0xd561('0x34'));return BPromise['resolve']({'id':_0x102b3b[_0xd561('0x30')][_0xd561('0x33')][_0xd561('0x31')],'name':_0x102b3b['name_value_list']['user_name'][_0xd561('0x31')]});}}function getEndUser(_0x1ac8d1,_0x6725f0,_0x58d333,_0x498436){logger[_0xd561('0xd')](_0xd561('0x35'),_0x58d333);return request({'form':{'method':_0xd561('0x2a'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x498436['id'],'module_name':_0xd561('0x36'),'query':util[_0xd561('0x25')](_0xd561('0x37'),_0x58d333),'order_by':'','offset':'0','select_fields':['id','name',_0xd561('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd561('0x2e')](function(_0x4cbb38){if(_0x4cbb38[_0xd561('0x2f')][_0xd561('0x1c')]){var _0x4817ae=_[_0xd561('0x39')](_0x4cbb38[_0xd561('0x2f')],function(_0x582e74){return _0x582e74['name_value_list'][_0xd561('0x38')][_0xd561('0x31')]===_0x58d333;});if(_0x4817ae){logger['info'](_0xd561('0x3a'));return BPromise[_0xd561('0x32')]({'id':_0x4817ae['name_value_list']['id'][_0xd561('0x31')],'name':_0x4817ae[_0xd561('0x30')][_0xd561('0xf')][_0xd561('0x31')],'phone':_0x4817ae['name_value_list'][_0xd561('0x38')][_0xd561('0x31')]});}}else{logger[_0xd561('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xd561('0x21'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x498436['id'],'module_name':_0xd561('0x36'),'name_value_list':[{'name':_0xd561('0x3b'),'value':_0x6725f0!==_0xd561('0x3c')?_0x6725f0:util[_0xd561('0x25')](_0xd561('0x3d'),_0x58d333)},{'name':_0xd561('0x38'),'value':_0x58d333}]})}})[_0xd561('0x2e')](function(_0x2114ac){logger[_0xd561('0xd')]('Enduser\x20created.');return BPromise[_0xd561('0x32')]({'id':_0x2114ac['id'],'name':_0x2114ac[_0xd561('0x2f')][_0xd561('0x3b')]['value'],'phone':_0x2114ac['entry_list']['phone_home'][_0xd561('0x31')]});});}});}function request(_0x3a24e2){logger[_0xd561('0x3e')](_0xd561('0x3f'),JSON[_0xd561('0x23')](_0x3a24e2));return rp(_['merge'](def,_0x3a24e2));}function getTags(_0x195b6a,_0xb4afd1){var _0x2aaf7e=[];if(_0x195b6a&&_0x195b6a[_0xd561('0x1c')]>0x0){_0x2aaf7e=_[_0xd561('0x40')](_0x195b6a,_0xb4afd1);}return _0x2aaf7e;}function getCustomFields(_0x3d5450,_0x254b9c){var _0x4d6dda=[];var _0x10ec35={'custom_fields':[]};if(_0x3d5450[_0xd561('0x1c')]>0x0){_[_0xd561('0x1d')](_0x3d5450,function(_0x2b8d40){if(_0x2b8d40[_0xd561('0x41')]===_0xd561('0x42')&&_0x2b8d40[_0xd561('0x43')]&&!_0x2b8d40[_0xd561('0x44')]){_0x10ec35[_0x2b8d40[_0xd561('0x43')][_0xd561('0x45')]()]=_0x2b8d40[_0xd561('0x46')][_0xd561('0x47')]();}else if(_0x2b8d40[_0xd561('0x41')]===_0xd561('0x42')&&_0x2b8d40[_0xd561('0x20')]&&_0x2b8d40[_0xd561('0x44')]){_0x10ec35[_0xd561('0x48')][_0xd561('0x1f')]({'id':_0x2b8d40[_0xd561('0x20')],'value':_0x2b8d40[_0xd561('0x46')][_0xd561('0x47')]()});}else if(_0x2b8d40['type']===_0xd561('0x49')&&_0x2b8d40[_0xd561('0x1e')]&&_0x2b8d40[_0xd561('0x20')]&&_0x2b8d40[_0xd561('0x44')]){_0x254b9c[_0x2b8d40['variableName']]&&_0x10ec35[_0xd561('0x48')]['push']({'id':_0x2b8d40[_0xd561('0x20')],'value':_0x254b9c[_0x2b8d40[_0xd561('0x1e')]][_0xd561('0x47')]()});}else if(_0x2b8d40[_0xd561('0x41')]===_0xd561('0x4a')&&_0x2b8d40[_0xd561('0x4b')]&&_0x2b8d40['Variable'][_0xd561('0xf')]&&_0x2b8d40['idField']&&_0x2b8d40[_0xd561('0x44')]){_0x254b9c[_0x2b8d40['Variable']['name'][_0xd561('0x45')]()]&&_0x10ec35[_0xd561('0x48')][_0xd561('0x1f')]({'id':_0x2b8d40[_0xd561('0x20')],'value':_0x254b9c[_0x2b8d40['Variable'][_0xd561('0xf')][_0xd561('0x45')]()][_0xd561('0x47')]()});}});}return _0x10ec35;}function getConnection(_0x303ed9){return request({'method':'POST','form':{'method':'login','input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'user_auth':{'user_name':_0x303ed9['username'],'password':_0x303ed9['password'],'encryption':_0xd561('0x4c')},'application':_0xd561('0x4d')})}})[_0xd561('0x2e')](function(_0x482f0e){var _0x56eeab=_0x482f0e;if(_0x56eeab['id']){def['sessionID']=_0x56eeab['id'];return BPromise[_0xd561('0x32')](_0x56eeab);}else{throw new Error(util[_0xd561('0x25')](_0xd561('0x4e'),_0x303ed9['id']));}});}function setRelationship(_0x56a73d,_0x5097b4,_0xe803b,_0x1add77){return request({'form':{'method':_0xd561('0x4f'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x56a73d['id'],'module_name':_0xd561('0x24'),'module_id':_0xe803b['id'],'link_field_name':_0x1add77,'related_ids':[_0x5097b4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd561('0x50')]=function(_0x1672d2,_0x11ba9c,_0x2f4c7a,_0x47a911,_0x54f32a,_0x56d4e2){var _0x334b55,_0x2dfc68,_0x4df6bb,_0x772766;_0x56d4e2['remoteUri']=intUtil[_0xd561('0x51')](_0x56d4e2['remoteUri']);_0x56d4e2['serverUrl']=intUtil[_0xd561('0x51')](_0x56d4e2['serverUrl']);def[_0xd561('0x52')]=util[_0xd561('0x25')](_0xd561('0x53'),_0x56d4e2[_0xd561('0x54')]);if(_0x54f32a&&_0x54f32a['monitor_format']){logger[_0xd561('0xd')]('[QUEUE]',_0xd561('0x55'));_0x11ba9c[_0xd561('0x56')]=util[_0xd561('0x25')](_0xd561('0x57'),_0x56d4e2[_0xd561('0x58')],_0x11ba9c[_0xd561('0x59')],md5(_0x11ba9c['uniqueid']));}else{_0x11ba9c[_0xd561('0x56')]='';}return getConnection(_0x56d4e2)[_0xd561('0x2e')](function(_0x4b3d2e){_0x772766=_0x4b3d2e;return getUser(_0x56d4e2,_0x47a911['name'],_0x772766);})[_0xd561('0x2e')](function(_0x5bd2b5){_0x334b55=_0x5bd2b5;logger[_0xd561('0xd')](_0xd561('0x5a'),_0x334b55['id']);return getEndUser(_0x56d4e2,_0x11ba9c[_0xd561('0x5b')],_0x11ba9c['calleridnum'],_0x772766);})[_0xd561('0x2e')](function(_0x22f16a){_0x2dfc68=_0x22f16a;logger[_0xd561('0xd')](_0xd561('0x5c'),_0x2dfc68['id']);return getTicket(_0x56d4e2,_0x334b55,_0x2dfc68,_0x2f4c7a,_0x11ba9c,_0x2f4c7a[_0xd561('0x5d')],_0x772766,_0xd561('0x5e'));})[_0xd561('0x2e')](function(_0x2c96a2){_0x4df6bb=_0x2c96a2;logger[_0xd561('0xd')]('Ticket\x20created!');logger[_0xd561('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4df6bb['id']);return setRelationship(_0x772766,_0x334b55,_0x4df6bb,_0xd561('0x5f'));})[_0xd561('0x2e')](function(){return setRelationship(_0x772766,_0x2dfc68,_0x4df6bb,_0xd561('0x60'));})[_0xd561('0x2e')](function(){return getServerInfo(_0x772766);})['then'](function(_0x84a64f){var _0x3ef25a=parseInt(_0x84a64f[_0xd561('0x61')]['charAt'](0x0));var _0xf85f21=util[_0xd561('0x25')](_0xd561('0x62'),_0x56d4e2[_0xd561('0x54')],_0x4df6bb['id']);if(_0x3ef25a>0x6){_0xf85f21=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x56d4e2[_0xd561('0x54')],_0x4df6bb['id']);}logger[_0xd561('0xd')](_0xd561('0x63'),_0xd561('0x64'));emit(util['format'](_0xd561('0x65'),_0x47a911[_0xd561('0xf')]),_0xd561('0x66'),{'uri':_0xf85f21});})['catch'](function(_0x3f9f26){logger[_0xd561('0x67')](_0xd561('0x63'),JSON[_0xd561('0x23')](_0x3f9f26));});};exports[_0xd561('0x68')]=function(_0x4b8af5,_0x2a9ccc,_0x4690ab,_0x189209,_0x5ab76a,_0x3970d3,_0x1cca06){var _0xa03815,_0x29e9db,_0x49d727,_0x4a794f;_0x3970d3[_0xd561('0x54')]=intUtil[_0xd561('0x51')](_0x3970d3[_0xd561('0x54')]);_0x3970d3['serverUrl']=intUtil['stripTrailingSlash'](_0x3970d3[_0xd561('0x58')]);def[_0xd561('0x52')]=util[_0xd561('0x25')](_0xd561('0x53'),_0x3970d3[_0xd561('0x54')]);if(_0x1cca06&&_0x1cca06[_0xd561('0x69')]&&_0x1cca06[_0xd561('0x69')]!==_0xd561('0x6a')){logger[_0xd561('0xd')]('[OUTBOUND]',_0xd561('0x55'));_0x2a9ccc[_0xd561('0x56')]=util[_0xd561('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3970d3[_0xd561('0x58')],_0x2a9ccc[_0xd561('0x59')],md5(_0x2a9ccc[_0xd561('0x59')]));}return getConnection(_0x3970d3)[_0xd561('0x2e')](function(_0x2aa00c){_0x4a794f=_0x2aa00c;return getUser(_0x3970d3,_0x189209[_0xd561('0xf')],_0x4a794f);})['then'](function(_0xe0a3b2){_0xa03815=_0xe0a3b2;logger[_0xd561('0xd')]('The\x20User\x20ID\x20is:',_0xa03815['id']);return getEndUser(_0x3970d3,_0x2a9ccc[_0xd561('0x6b')],_0x2a9ccc[_0xd561('0x6c')],_0x4a794f);})[_0xd561('0x2e')](function(_0x3f543a){_0x29e9db=_0x3f543a;logger['info'](_0xd561('0x5c'),_0x29e9db['id']);return getTicket(_0x3970d3,_0xa03815,_0x29e9db,_0x4690ab,_0x2a9ccc,_0x4690ab['Fields'],_0x4a794f,_0xd561('0x6d'));})[_0xd561('0x2e')](function(_0x1e1260){_0x49d727=_0x1e1260;logger['info'](_0xd561('0x6e'));logger[_0xd561('0xd')](_0xd561('0x6f'),_0x49d727['id']);return setRelationship(_0x4a794f,_0xa03815,_0x49d727,_0xd561('0x5f'));})['then'](function(){return setRelationship(_0x4a794f,_0x29e9db,_0x49d727,'contacts');})[_0xd561('0x2e')](function(){return getServerInfo(_0x4a794f);})['then'](function(_0x22a6d0){var _0x3e81ec=parseInt(_0x22a6d0[_0xd561('0x61')][_0xd561('0x70')](0x0));var _0x2ad72c=util['format'](_0xd561('0x62'),_0x3970d3[_0xd561('0x54')],_0x49d727['id']);if(_0x3e81ec>0x6){_0x2ad72c=util[_0xd561('0x25')](_0xd561('0x71'),_0x3970d3[_0xd561('0x54')],_0x49d727['id']);}logger[_0xd561('0xd')](_0xd561('0x72'),_0xd561('0x64'));emit(util['format'](_0xd561('0x65'),_0x189209[_0xd561('0xf')]),_0xd561('0x66'),{'uri':_0x2ad72c});})[_0xd561('0x73')](function(_0x4d8eba){logger[_0xd561('0x67')](_0xd561('0x72'),JSON['stringify'](_0x4d8eba));});};exports[_0xd561('0x74')]=function(_0x38e8dc,_0x1a2cb7,_0x493043,_0x4e3def,_0x314777,_0xb7fac4){var _0x20a0b7,_0x2da93a,_0x4b51f2,_0x15b6de;_0xb7fac4[_0xd561('0x54')]=intUtil['stripTrailingSlash'](_0xb7fac4[_0xd561('0x54')]);_0xb7fac4[_0xd561('0x58')]=intUtil[_0xd561('0x51')](_0xb7fac4[_0xd561('0x58')]);def['uri']=util[_0xd561('0x25')](_0xd561('0x53'),_0xb7fac4[_0xd561('0x54')]);if(_0x314777&&_0x314777[_0xd561('0x75')]){logger[_0xd561('0xd')]('['+_0x1a2cb7[_0xd561('0x76')][_0xd561('0x77')]()+']',_0xd561('0x55'));_0x1a2cb7['recordingURL']=util[_0xd561('0x25')](_0xd561('0x57'),_0xb7fac4[_0xd561('0x58')],_0x1a2cb7[_0xd561('0x59')],md5(_0x1a2cb7[_0xd561('0x59')]));}else{_0x1a2cb7[_0xd561('0x56')]='';}return getConnection(_0xb7fac4)[_0xd561('0x2e')](function(_0x911465){_0x15b6de=_0x911465;if(!_[_0xd561('0x28')](_0x4e3def)){return getUser(_0xb7fac4,_0x4e3def[_0xd561('0xf')],_0x15b6de);}else{return getUser(_0xb7fac4,null,_0x15b6de);}})['then'](function(_0x31426b){_0x20a0b7=_0x31426b;logger['info'](_0xd561('0x5a'),_0x20a0b7['id']);return getEndUser(_0xb7fac4,_0x1a2cb7['calleridname'],_0x1a2cb7[_0xd561('0x78')],_0x15b6de);})[_0xd561('0x2e')](function(_0x3f75be){_0x2da93a=_0x3f75be;logger[_0xd561('0xd')](_0xd561('0x5c'),_0x2da93a['id']);return getTicket(_0xb7fac4,_0x20a0b7,_0x2da93a,_0x493043,_0x1a2cb7,_0x493043[_0xd561('0x5d')],_0x15b6de,_0xd561('0x5e'));})[_0xd561('0x2e')](function(_0x3e73b9){_0x4b51f2=_0x3e73b9;logger['info'](_0xd561('0x6e'));logger[_0xd561('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4b51f2['id']);return setRelationship(_0x15b6de,_0x20a0b7,_0x4b51f2,'users');})[_0xd561('0x2e')](function(){return setRelationship(_0x15b6de,_0x2da93a,_0x4b51f2,'contacts');})[_0xd561('0x2e')](function(){return getServerInfo(_0x15b6de);})[_0xd561('0x73')](function(_0x15ee39){logger[_0xd561('0x67')]('['+_0x1a2cb7[_0xd561('0x76')]['toUpperCase']()+']',JSON[_0xd561('0x23')](_0x15ee39));});}; \ 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 ec797d9..35b76ae 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 _0xa14c=['string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString','sortBy','length'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa14c,0xb9));var _0xca14=function(_0xd8a99d,_0x5426fc){_0xd8a99d=_0xd8a99d-0x0;var _0x23da1c=_0xa14c[_0xd8a99d];return _0x23da1c;};'use strict';var _=require(_0xca14('0x0'));var util=require('util');exports[_0xca14('0x1')]=function(_0x1ac7ed,_0x3bac3a,_0x1aaa9a){var _0x4b3b72=[];if(_0x1ac7ed['length']>0x0){var _0x3d53c8=_[_0xca14('0x2')](_0x1ac7ed,['id']);for(var _0xba519c=0x0;_0xba519c<_0x3d53c8[_0xca14('0x3')];_0xba519c++){var _0x1fe822=_0x3d53c8[_0xba519c];if(_0x1fe822['type']===_0xca14('0x4')){_0x4b3b72[_0xca14('0x5')](_0x1fe822[_0xca14('0x6')]);}else if(_0x1fe822[_0xca14('0x7')]===_0xca14('0x8')&&_0x1fe822['variableName']){_0x3bac3a[_0x1fe822[_0xca14('0x9')]]&&_0x4b3b72[_0xca14('0x5')](_0x3bac3a[_0x1fe822[_0xca14('0x9')]][_0xca14('0xa')]());}else if(_0x1fe822[_0xca14('0x7')]===_0xca14('0xb')&&_0x1fe822[_0xca14('0xc')]&&_0x1fe822[_0xca14('0xc')][_0xca14('0xd')]){_0x3bac3a[_0x1fe822[_0xca14('0xc')][_0xca14('0xd')][_0xca14('0xe')]()]&&_0x4b3b72['push'](_0x3bac3a[_0x1fe822[_0xca14('0xc')][_0xca14('0xd')]['toLowerCase']()][_0xca14('0xa')]());}else if(_0x1fe822[_0xca14('0x7')]==='keyValue'){if(_0x1fe822[_0xca14('0xf')]===_0xca14('0x4')&&_0x1fe822['key']){_0x4b3b72[_0xca14('0x5')](util[_0xca14('0x10')](_0xca14('0x11'),_0x1fe822[_0xca14('0x12')],_0x1fe822[_0xca14('0x13')]));}else if(_0x1fe822[_0xca14('0xf')]===_0xca14('0x8')&&_0x1fe822[_0xca14('0x9')]&&_0x1fe822[_0xca14('0x12')]){_0x3bac3a[_0x1fe822[_0xca14('0x9')]]&&_0x4b3b72['push'](util[_0xca14('0x10')](_0xca14('0x11'),_0x1fe822[_0xca14('0x12')],_0x3bac3a[_0x1fe822['variableName']]));}else if(_0x1fe822[_0xca14('0xf')]==='customVariable'&&_0x1fe822['Variable']&&_0x1fe822['Variable'][_0xca14('0xd')]&&_0x1fe822[_0xca14('0x12')]){_0x3bac3a[_0x1fe822[_0xca14('0xc')][_0xca14('0xd')]['toLowerCase']()]&&_0x4b3b72[_0xca14('0x5')](util[_0xca14('0x10')](_0xca14('0x11'),_0x1fe822[_0xca14('0x12')],_0x3bac3a[_0x1fe822['Variable']['name'][_0xca14('0xe')]()]));}}}}return _0x4b3b72[_0xca14('0x14')](_0x1aaa9a);};exports['stripTrailingSlash']=function(_0x5a3b11){var _0x46c1c9=_0x5a3b11[_0xca14('0x15')](-0x1);if(_0x46c1c9==='/'){_0x5a3b11=_0x5a3b11[_0xca14('0x16')](0x0,_0x5a3b11[_0xca14('0x17')](_0x46c1c9));}return _0x5a3b11;};exports[_0xca14('0x18')]=function(_0x503da8){if(!_[_0xca14('0x19')](_0x503da8)&&_0x503da8!==''){var _0xa15793=/^(([^<>()\[\]\\.,;:\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 _0xa15793[_0xca14('0x1a')](String(_0x503da8)[_0xca14('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x0946=['lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','length','type','string','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','format','%s:\x20%s','join','slice','substring'];(function(_0x2d6566,_0x74d6da){var _0x3ec4c3=function(_0x3e4342){while(--_0x3e4342){_0x2d6566['push'](_0x2d6566['shift']());}};_0x3ec4c3(++_0x74d6da);}(_0x0946,0x163));var _0x6094=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x0946[_0x276468];return _0x36dc3a;};'use strict';var _=require(_0x6094('0x0'));var util=require(_0x6094('0x1'));exports['getString']=function(_0x42d205,_0x1ac5db,_0x1020eb){var _0x36844b=[];if(_0x42d205['length']>0x0){var _0x1c72ac=_[_0x6094('0x2')](_0x42d205,['id']);for(var _0x599f74=0x0;_0x599f74<_0x1c72ac[_0x6094('0x3')];_0x599f74++){var _0x55c4fb=_0x1c72ac[_0x599f74];if(_0x55c4fb[_0x6094('0x4')]===_0x6094('0x5')){_0x36844b['push'](_0x55c4fb['content']);}else if(_0x55c4fb[_0x6094('0x4')]===_0x6094('0x6')&&_0x55c4fb[_0x6094('0x7')]){_0x1ac5db[_0x55c4fb['variableName']]&&_0x36844b[_0x6094('0x8')](_0x1ac5db[_0x55c4fb[_0x6094('0x7')]][_0x6094('0x9')]());}else if(_0x55c4fb[_0x6094('0x4')]===_0x6094('0xa')&&_0x55c4fb[_0x6094('0xb')]&&_0x55c4fb[_0x6094('0xb')][_0x6094('0xc')]){_0x1ac5db[_0x55c4fb[_0x6094('0xb')]['name'][_0x6094('0xd')]()]&&_0x36844b[_0x6094('0x8')](_0x1ac5db[_0x55c4fb[_0x6094('0xb')]['name'][_0x6094('0xd')]()][_0x6094('0x9')]());}else if(_0x55c4fb[_0x6094('0x4')]===_0x6094('0xe')){if(_0x55c4fb[_0x6094('0xf')]===_0x6094('0x5')&&_0x55c4fb[_0x6094('0x10')]){_0x36844b[_0x6094('0x8')](util['format']('%s:\x20%s',_0x55c4fb[_0x6094('0x10')],_0x55c4fb[_0x6094('0x11')]));}else if(_0x55c4fb[_0x6094('0xf')]===_0x6094('0x6')&&_0x55c4fb[_0x6094('0x7')]&&_0x55c4fb[_0x6094('0x10')]){_0x1ac5db[_0x55c4fb[_0x6094('0x7')]]&&_0x36844b[_0x6094('0x8')](util[_0x6094('0x12')](_0x6094('0x13'),_0x55c4fb['key'],_0x1ac5db[_0x55c4fb['variableName']]));}else if(_0x55c4fb[_0x6094('0xf')]===_0x6094('0xa')&&_0x55c4fb['Variable']&&_0x55c4fb[_0x6094('0xb')]['name']&&_0x55c4fb['key']){_0x1ac5db[_0x55c4fb['Variable'][_0x6094('0xc')][_0x6094('0xd')]()]&&_0x36844b[_0x6094('0x8')](util[_0x6094('0x12')](_0x6094('0x13'),_0x55c4fb[_0x6094('0x10')],_0x1ac5db[_0x55c4fb[_0x6094('0xb')][_0x6094('0xc')][_0x6094('0xd')]()]));}}}}return _0x36844b[_0x6094('0x14')](_0x1020eb);};exports['stripTrailingSlash']=function(_0x32e1ca){var _0x42e26b=_0x32e1ca[_0x6094('0x15')](-0x1);if(_0x42e26b==='/'){_0x32e1ca=_0x32e1ca[_0x6094('0x16')](0x0,_0x32e1ca[_0x6094('0x17')](_0x42e26b));}return _0x32e1ca;};exports[_0x6094('0x18')]=function(_0x496bc8){if(!_[_0x6094('0x19')](_0x496bc8)&&_0x496bc8!==''){var _0x52ea3c=/^(([^<>()\[\]\\.,;:\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 _0x52ea3c[_0x6094('0x1a')](String(_0x496bc8)[_0x6094('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 187cff0..63c9df3 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 471965e..035f92d 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 _0x4645=['application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','includes','string','nameField','customField','content','type','idField','push','variable','variableName','customVariable','Variable','toLowerCase','custom_fields','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit'];(function(_0x31a478,_0x392438){var _0x35cef1=function(_0x2c7e92){while(--_0x2c7e92){_0x31a478['push'](_0x31a478['shift']());}};_0x35cef1(++_0x392438);}(_0x4645,0x65));var _0x5464=function(_0x34ed5b,_0x33f30b){_0x34ed5b=_0x34ed5b-0x0;var _0x355745=_0x4645[_0x34ed5b];return _0x355745;};'use strict';var _=require(_0x5464('0x0'));var rp=require(_0x5464('0x1'));var md5=require('md5');var util=require(_0x5464('0x2'));var Redis=require(_0x5464('0x3'));var intUtil=require(_0x5464('0x4'));var config=require(_0x5464('0x5'));var logger=require(_0x5464('0x6'))(_0x5464('0x7'));config[_0x5464('0x8')]=_['defaults'](config['redis'],{'host':_0x5464('0x9'),'port':0x18eb});var io=require(_0x5464('0xa'))(new Redis(config['redis']));function emit(_0x4cf34b,_0x2cb9ab,_0x5dfa1a){io['to'](_0x4cf34b)[_0x5464('0xb')](_0x2cb9ab,_0x5dfa1a);}var headers={'Content-Type':'application/json','Accept':_0x5464('0xc')};function getTicket(_0x208ddc,_0x1cb970,_0xb9a014,_0x249dc4,_0x4ee46a){logger[_0x5464('0xd')](_0x5464('0xe'));return request({'uri':util[_0x5464('0xf')](_0x5464('0x10'),_0x208ddc[_0x5464('0x11')]),'method':_0x5464('0x12'),'body':{'ticket':_[_0x5464('0x13')]({'requester_id':_0xb9a014['id'],'submitter_id':_0x1cb970?_0x1cb970['id']:undefined,'assignee_id':_0x1cb970?_0x1cb970['id']:undefined,'tags':getTags(_0x249dc4['Tags'],_0x5464('0x14')),'subject':intUtil[_0x5464('0x15')](_0x249dc4[_0x5464('0x16')],_0x4ee46a,'\x20'),'description':intUtil[_0x5464('0x15')](_0x249dc4[_0x5464('0x17')],_0x4ee46a,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5464('0x15')](_0x249dc4['Descriptions'],_0x4ee46a,'\x0a')}},getCustomFields(_0x249dc4['Fields'],_0x4ee46a))}})[_0x5464('0x18')](function(_0x3f4a4b){logger[_0x5464('0xd')](_0x5464('0x19'));return _0x3f4a4b[_0x5464('0x1a')];});}function getUser(_0x4ebad9,_0x2b00ed){if(intUtil[_0x5464('0x1b')](_0x2b00ed)){logger['info'](_0x5464('0x1c'),_0x2b00ed);return request({'uri':util[_0x5464('0xf')]('%s/search.json',_0x4ebad9['remoteUri']),'qs':{'query':util[_0x5464('0xf')](_0x5464('0x1d'),_0x2b00ed)}})[_0x5464('0x18')](function(_0x5c1345){if(_0x5c1345[_0x5464('0x1e')]){logger[_0x5464('0xd')](_0x5464('0x1f'));return _['find'](_0x5c1345['results'],{'email':_0x2b00ed,'role':_0x5464('0x20')});}else{logger[_0x5464('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x5464('0x21'),_0x4ebad9['remoteUri'])})[_0x5464('0x18')](function(_0x8d7cf3){logger[_0x5464('0xd')](_0x5464('0x22'));return _0x8d7cf3[_0x5464('0x23')];});}});}else{logger[_0x5464('0xd')](_0x5464('0x24'));return request({'uri':util[_0x5464('0xf')](_0x5464('0x21'),_0x4ebad9[_0x5464('0x11')])})[_0x5464('0x18')](function(_0x4fb680){logger['info'](_0x5464('0x22'));return _0x4fb680[_0x5464('0x23')];});}}function getEndUser(_0x342865,_0x3a9aab,_0x493090){logger[_0x5464('0xd')]('Searching\x20enduser\x20with\x20phone',_0x493090);return request({'uri':util[_0x5464('0xf')](_0x5464('0x25'),_0x342865['remoteUri']),'qs':{'query':util[_0x5464('0xf')](_0x5464('0x26'),_0x493090)}})['then'](function(_0x31024c){var _0x33510f;if(_0x31024c[_0x5464('0x27')]['length']){_0x31024c[_0x5464('0x27')]=_[_0x5464('0x28')](_0x31024c[_0x5464('0x27')],{'suspended':![],'role':_0x5464('0x29')});if(_0x31024c[_0x5464('0x27')][_0x5464('0x2a')]){_0x33510f=_[_0x5464('0x2b')](_0x31024c['results']);}}if(_0x33510f){logger[_0x5464('0xd')](_0x5464('0x2c'));return _0x33510f;}else{logger[_0x5464('0xd')](_0x5464('0x2d'));return request({'uri':util[_0x5464('0xf')](_0x5464('0x2e'),_0x342865[_0x5464('0x11')]),'method':_0x5464('0x12'),'body':{'user':{'role':'end-user','name':util[_0x5464('0xf')](_0x5464('0x2f'),_0x3a9aab||_0x493090),'phone':_0x493090}}})[_0x5464('0x18')](function(_0x442bf1){logger[_0x5464('0xd')](_0x5464('0x30'));return _0x442bf1[_0x5464('0x23')];});}});}function getAuth(_0xc3f482){var _0x5f50d9;if(_0xc3f482[_0x5464('0x31')]===_0x5464('0x32')){_0x5f50d9=util['format']('%s:%s',_0xc3f482['username'],_0xc3f482['password']);}else if(_0xc3f482[_0x5464('0x31')]===_0x5464('0x33')){_0x5f50d9=util['format']('%s/token:%s',_0xc3f482[_0x5464('0x34')],_0xc3f482[_0x5464('0x33')]);}return util[_0x5464('0xf')](_0x5464('0x35'),new Buffer(_0x5f50d9)[_0x5464('0x36')](_0x5464('0x37')));}function request(_0x338463){logger[_0x5464('0x38')](_0x5464('0x39'),JSON[_0x5464('0x3a')](_0x338463));return rp(_[_0x5464('0x3b')](_0x338463,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1e9251,_0x4727a2){var _0x60d039=[];if(_0x1e9251&&_0x1e9251[_0x5464('0x2a')]>0x0){_0x60d039=_[_0x5464('0x3c')](_0x1e9251,_0x4727a2);}return _0x60d039;}function getCustomFields(_0x4efbc2,_0xb3f577){var _0x483637=[];var _0x1bc404={'custom_fields':[]};if(_0x4efbc2[_0x5464('0x2a')]>0x0){_[_0x5464('0x3d')](_0x4efbc2,function(_0x25a384){if(_[_0x5464('0x3e')]([_0x5464('0x3f'),'picklist'],_0x25a384['type'])&&_0x25a384[_0x5464('0x40')]&&!_0x25a384[_0x5464('0x41')]){_0x1bc404[_0x25a384[_0x5464('0x40')]['toLowerCase']()]=_0x25a384[_0x5464('0x42')][_0x5464('0x36')]();}else if(_[_0x5464('0x3e')]([_0x5464('0x3f'),'picklist'],_0x25a384[_0x5464('0x43')])&&_0x25a384[_0x5464('0x44')]&&_0x25a384[_0x5464('0x41')]){_0x1bc404['custom_fields'][_0x5464('0x45')]({'id':_0x25a384[_0x5464('0x44')],'value':_0x25a384[_0x5464('0x42')][_0x5464('0x36')]()});}else if(_0x25a384[_0x5464('0x43')]===_0x5464('0x46')&&_0x25a384[_0x5464('0x47')]&&_0x25a384[_0x5464('0x44')]&&_0x25a384[_0x5464('0x41')]){_0xb3f577[_0x25a384[_0x5464('0x47')]]&&_0x1bc404['custom_fields']['push']({'id':_0x25a384['idField'],'value':_0xb3f577[_0x25a384[_0x5464('0x47')]]['toString']()});}else if(_0x25a384['type']===_0x5464('0x48')&&_0x25a384[_0x5464('0x49')]&&_0x25a384[_0x5464('0x49')][_0x5464('0x14')]&&_0x25a384['idField']&&_0x25a384[_0x5464('0x41')]){_0xb3f577[_0x25a384[_0x5464('0x49')][_0x5464('0x14')][_0x5464('0x4a')]()]&&_0x1bc404[_0x5464('0x4b')][_0x5464('0x45')]({'id':_0x25a384[_0x5464('0x44')],'value':_0xb3f577[_0x25a384[_0x5464('0x49')][_0x5464('0x14')][_0x5464('0x4a')]()][_0x5464('0x36')]()});}});}return _0x1bc404;}exports['queue']=function(_0x192af6,_0x211713,_0x2e6f23,_0x12d799,_0x50eced,_0x1cf20e){var _0x1e9e91,_0x17602c;_0x1cf20e[_0x5464('0x11')]=intUtil[_0x5464('0x4c')](_0x1cf20e[_0x5464('0x11')]);_0x1cf20e['serverUrl']=intUtil[_0x5464('0x4c')](_0x1cf20e[_0x5464('0x4d')]);if(_0x50eced&&_0x50eced[_0x5464('0x4e')]){logger[_0x5464('0xd')](_0x5464('0x4f'),_0x5464('0x50'));_0x211713[_0x5464('0x51')]=util[_0x5464('0xf')](_0x5464('0x52'),_0x1cf20e[_0x5464('0x4d')],_0x211713['uniqueid'],md5(_0x211713[_0x5464('0x53')]));}else{_0x211713['recordingURL']='';}headers[_0x5464('0x54')]=getAuth(_0x1cf20e);return getUser(_0x1cf20e,_0x12d799[_0x5464('0x55')])[_0x5464('0x18')](function(_0x3dc016){_0x1e9e91=_0x3dc016;logger['info'](_0x5464('0x56'),_0x1e9e91['id']);return getEndUser(_0x1cf20e,_0x211713[_0x5464('0x57')],_0x211713[_0x5464('0x58')]);})[_0x5464('0x18')](function(_0x5287ad){_0x17602c=_0x5287ad;logger['info'](_0x5464('0x59'),_0x17602c['id']);return getTicket(_0x1cf20e,_0x1e9e91,_0x17602c,_0x2e6f23,_0x211713);})[_0x5464('0x18')](function(_0x3eca50){if(_0x3eca50){logger[_0x5464('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3eca50['id']);switch(_0x1cf20e[_0x5464('0x43')]){case _0x5464('0x5a'):logger[_0x5464('0xd')](_0x5464('0x4f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1cf20e[_0x5464('0x11')],_0x1e9e91['id'],_0x3eca50['id']),'method':_0x5464('0x12')});case _0x5464('0x5b'):logger['info'](_0x5464('0x4f'),_0x5464('0x5c'));emit(util[_0x5464('0xf')](_0x5464('0x5d'),_0x12d799[_0x5464('0x14')]),_0x5464('0x5e'),{'uri':util['format'](_0x5464('0x5f'),_0x1cf20e['remoteUri'][_0x5464('0x60')]('/api/v2',''),_0x3eca50['id'])});break;default:logger[_0x5464('0x61')](_0x5464('0x4f'),_0x5464('0x62'));}}})[_0x5464('0x63')](function(_0x425cd2){logger[_0x5464('0x61')](_0x5464('0x64'),util[_0x5464('0x65')](_0x425cd2,{'showHidden':!![],'depth':null}));});};exports[_0x5464('0x66')]=function(_0x2bde3f,_0x26d448,_0x3a4966,_0x8b4163,_0x562718,_0x336568,_0x422831){var _0x1ee12b,_0x55fdd1;_0x336568[_0x5464('0x11')]=intUtil[_0x5464('0x4c')](_0x336568[_0x5464('0x11')]);_0x336568[_0x5464('0x4d')]=intUtil[_0x5464('0x4c')](_0x336568['serverUrl']);if(_0x422831&&_0x422831[_0x5464('0x67')]&&_0x422831['recordingFormat']!==_0x5464('0x68')){logger[_0x5464('0xd')]('[OUTBOUND]',_0x5464('0x50'));_0x26d448[_0x5464('0x51')]=util[_0x5464('0xf')](_0x5464('0x52'),_0x336568['serverUrl'],_0x26d448[_0x5464('0x53')],md5(_0x26d448[_0x5464('0x53')]));}headers['Authorization']=getAuth(_0x336568);return getUser(_0x336568,_0x8b4163[_0x5464('0x55')])[_0x5464('0x18')](function(_0x21a0da){_0x1ee12b=_0x21a0da;logger[_0x5464('0xd')](_0x5464('0x56'),_0x1ee12b['id']);return getEndUser(_0x336568,_0x26d448[_0x5464('0x69')],_0x26d448[_0x5464('0x6a')]);})[_0x5464('0x18')](function(_0x2330ce){_0x55fdd1=_0x2330ce;logger[_0x5464('0xd')](_0x5464('0x59'),_0x55fdd1['id']);return getTicket(_0x336568,_0x1ee12b,_0x55fdd1,_0x3a4966,_0x26d448);})[_0x5464('0x18')](function(_0x5ef45d){if(_0x5ef45d){logger['info'](_0x5464('0x6b'),_0x5ef45d['id']);switch(_0x336568[_0x5464('0x43')]){case _0x5464('0x5a'):logger[_0x5464('0xd')](_0x5464('0x6c'),_0x5464('0x6d'));return request({'uri':util['format'](_0x5464('0x6e'),_0x336568[_0x5464('0x11')],_0x1ee12b['id'],_0x5ef45d['id']),'method':_0x5464('0x12')});case _0x5464('0x5b'):logger[_0x5464('0xd')](_0x5464('0x6c'),_0x5464('0x5c'));emit(util[_0x5464('0xf')](_0x5464('0x5d'),_0x8b4163[_0x5464('0x14')]),_0x5464('0x5e'),{'uri':util['format'](_0x5464('0x5f'),_0x336568[_0x5464('0x11')][_0x5464('0x60')](_0x5464('0x6f'),''),_0x5ef45d['id'])});break;default:logger[_0x5464('0x61')](_0x5464('0x6c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5464('0x63')](function(_0x4aa5b8){logger[_0x5464('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x4aa5b8,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3ec640,_0x28aa32,_0x573308,_0x5040f8,_0xfa74a2,_0x32e9f7){var _0x15f894,_0xe264a1;_0x32e9f7[_0x5464('0x11')]=intUtil[_0x5464('0x4c')](_0x32e9f7[_0x5464('0x11')]);_0x32e9f7['serverUrl']=intUtil[_0x5464('0x4c')](_0x32e9f7[_0x5464('0x4d')]);if(_0xfa74a2&&_0xfa74a2[_0x5464('0x4e')]){logger[_0x5464('0xd')]('['+_0x28aa32['lastevent'][_0x5464('0x70')]()+']','Recording\x20is\x20enabled!');_0x28aa32[_0x5464('0x51')]=util[_0x5464('0xf')](_0x5464('0x52'),_0x32e9f7[_0x5464('0x4d')],_0x28aa32[_0x5464('0x53')],md5(_0x28aa32[_0x5464('0x53')]));}else{_0x28aa32[_0x5464('0x51')]='';}headers[_0x5464('0x54')]=getAuth(_0x32e9f7);return getUser(_0x32e9f7)[_0x5464('0x18')](function(_0x564d63){_0x15f894=_0x564d63;logger[_0x5464('0xd')](_0x5464('0x56'),_0x15f894['id']);return getEndUser(_0x32e9f7,_0x28aa32[_0x5464('0x57')],_0x28aa32['calleridnum']);})[_0x5464('0x18')](function(_0x41a098){_0xe264a1=_0x41a098;logger[_0x5464('0xd')](_0x5464('0x59'),_0xe264a1['id']);return getTicket(_0x32e9f7,_0x15f894,_0xe264a1,_0x573308,_0x28aa32);})[_0x5464('0x18')](function(_0x195e2d){if(_0x195e2d){logger[_0x5464('0xd')](_0x5464('0x6b'),_0x195e2d['id']);}})[_0x5464('0x63')](function(_0x46590a){logger['error']('['+_0x28aa32['lastevent'][_0x5464('0x70')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x5464('0x65')](_0x46590a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x93d6=['map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','custom_fields','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','Authorization','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','POST','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','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','base64','debug','[HTTP]','stringify','GET','length'];(function(_0x40e082,_0x48e38c){var _0x174e4f=function(_0x3b6acd){while(--_0x3b6acd){_0x40e082['push'](_0x40e082['shift']());}};_0x174e4f(++_0x48e38c);}(_0x93d6,0x19c));var _0x693d=function(_0xfc600d,_0x42c951){_0xfc600d=_0xfc600d-0x0;var _0xae26d6=_0x93d6[_0xfc600d];return _0xae26d6;};'use strict';var _=require(_0x693d('0x0'));var rp=require(_0x693d('0x1'));var md5=require(_0x693d('0x2'));var util=require(_0x693d('0x3'));var Redis=require(_0x693d('0x4'));var intUtil=require('./util');var config=require(_0x693d('0x5'));var logger=require(_0x693d('0x6'))(_0x693d('0x7'));config[_0x693d('0x8')]=_[_0x693d('0x9')](config[_0x693d('0x8')],{'host':_0x693d('0xa'),'port':0x18eb});var io=require(_0x693d('0xb'))(new Redis(config[_0x693d('0x8')]));function emit(_0x3b5e69,_0x44b4ec,_0x4844d2){io['to'](_0x3b5e69)['emit'](_0x44b4ec,_0x4844d2);}var headers={'Content-Type':_0x693d('0xc'),'Accept':_0x693d('0xc')};function getTicket(_0x2207c8,_0x314713,_0x35d953,_0x29b735,_0xe59afe){logger[_0x693d('0xd')](_0x693d('0xe'));return request({'uri':util[_0x693d('0xf')](_0x693d('0x10'),_0x2207c8[_0x693d('0x11')]),'method':'POST','body':{'ticket':_[_0x693d('0x12')]({'requester_id':_0x35d953['id'],'submitter_id':_0x314713?_0x314713['id']:undefined,'assignee_id':_0x314713?_0x314713['id']:undefined,'tags':getTags(_0x29b735[_0x693d('0x13')],'name'),'subject':intUtil[_0x693d('0x14')](_0x29b735[_0x693d('0x15')],_0xe59afe,'\x20'),'description':intUtil[_0x693d('0x14')](_0x29b735[_0x693d('0x16')],_0xe59afe,'\x0a'),'comment':{'public':![],'body':intUtil[_0x693d('0x14')](_0x29b735[_0x693d('0x16')],_0xe59afe,'\x0a')}},getCustomFields(_0x29b735[_0x693d('0x17')],_0xe59afe))}})[_0x693d('0x18')](function(_0x139d1b){logger[_0x693d('0xd')](_0x693d('0x19'));return _0x139d1b[_0x693d('0x1a')];});}function getUser(_0xe02afd,_0xb6892c){if(intUtil[_0x693d('0x1b')](_0xb6892c)){logger['info']('Getting\x20agent\x20with\x20email',_0xb6892c);return request({'uri':util[_0x693d('0xf')](_0x693d('0x1c'),_0xe02afd[_0x693d('0x11')]),'qs':{'query':util[_0x693d('0xf')](_0x693d('0x1d'),_0xb6892c)}})[_0x693d('0x18')](function(_0xe57e83){if(_0xe57e83[_0x693d('0x1e')]){logger['info'](_0x693d('0x1f'));return _['find'](_0xe57e83[_0x693d('0x20')],{'email':_0xb6892c,'role':'agent'});}else{logger['info'](_0x693d('0x21'));return request({'uri':util[_0x693d('0xf')](_0x693d('0x22'),_0xe02afd[_0x693d('0x11')])})[_0x693d('0x18')](function(_0x1935af){logger['info'](_0x693d('0x23'));return _0x1935af[_0x693d('0x24')];});}});}else{logger[_0x693d('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x693d('0xf')](_0x693d('0x22'),_0xe02afd[_0x693d('0x11')])})[_0x693d('0x18')](function(_0x1c861a){logger['info'](_0x693d('0x23'));return _0x1c861a['user'];});}}function getEndUser(_0xe93aa,_0x30d526,_0x32b36b){logger[_0x693d('0xd')](_0x693d('0x25'),_0x32b36b);return request({'uri':util[_0x693d('0xf')](_0x693d('0x1c'),_0xe93aa[_0x693d('0x11')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x32b36b)}})[_0x693d('0x18')](function(_0x368945){var _0x5651de;if(_0x368945['results']['length']){_0x368945[_0x693d('0x20')]=_[_0x693d('0x26')](_0x368945[_0x693d('0x20')],{'suspended':![],'role':_0x693d('0x27')});if(_0x368945[_0x693d('0x20')]['length']){_0x5651de=_[_0x693d('0x28')](_0x368945['results']);}}if(_0x5651de){logger['info'](_0x693d('0x29'));return _0x5651de;}else{logger[_0x693d('0xd')](_0x693d('0x2a'));return request({'uri':util[_0x693d('0xf')](_0x693d('0x2b'),_0xe93aa[_0x693d('0x11')]),'method':'POST','body':{'user':{'role':_0x693d('0x27'),'name':util[_0x693d('0xf')](_0x693d('0x2c'),_0x30d526||_0x32b36b),'phone':_0x32b36b}}})['then'](function(_0x5d723f){logger[_0x693d('0xd')](_0x693d('0x2d'));return _0x5d723f[_0x693d('0x24')];});}});}function getAuth(_0x353b8a){var _0x460ed3;if(_0x353b8a[_0x693d('0x2e')]===_0x693d('0x2f')){_0x460ed3=util['format'](_0x693d('0x30'),_0x353b8a['username'],_0x353b8a[_0x693d('0x2f')]);}else if(_0x353b8a['authType']===_0x693d('0x31')){_0x460ed3=util[_0x693d('0xf')](_0x693d('0x32'),_0x353b8a[_0x693d('0x33')],_0x353b8a[_0x693d('0x31')]);}return util[_0x693d('0xf')](_0x693d('0x34'),new Buffer(_0x460ed3)[_0x693d('0x35')](_0x693d('0x36')));}function request(_0x5d7791){logger[_0x693d('0x37')](_0x693d('0x38'),JSON[_0x693d('0x39')](_0x5d7791));return rp(_[_0x693d('0x9')](_0x5d7791,{'method':_0x693d('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x9561a8,_0x4f9d31){var _0x51417b=[];if(_0x9561a8&&_0x9561a8[_0x693d('0x3b')]>0x0){_0x51417b=_[_0x693d('0x3c')](_0x9561a8,_0x4f9d31);}return _0x51417b;}function getCustomFields(_0x108f3a,_0x42b280){var _0x5984bc=[];var _0x2e00be={'custom_fields':[]};if(_0x108f3a[_0x693d('0x3b')]>0x0){_[_0x693d('0x3d')](_0x108f3a,function(_0x4e98c0){if(_['includes']([_0x693d('0x3e'),_0x693d('0x3f')],_0x4e98c0[_0x693d('0x40')])&&_0x4e98c0[_0x693d('0x41')]&&!_0x4e98c0[_0x693d('0x42')]){_0x2e00be[_0x4e98c0[_0x693d('0x41')][_0x693d('0x43')]()]=_0x4e98c0[_0x693d('0x44')][_0x693d('0x35')]();}else if(_[_0x693d('0x45')](['string',_0x693d('0x3f')],_0x4e98c0['type'])&&_0x4e98c0[_0x693d('0x46')]&&_0x4e98c0[_0x693d('0x42')]){_0x2e00be[_0x693d('0x47')]['push']({'id':_0x4e98c0[_0x693d('0x46')],'value':_0x4e98c0[_0x693d('0x44')][_0x693d('0x35')]()});}else if(_0x4e98c0['type']===_0x693d('0x48')&&_0x4e98c0[_0x693d('0x49')]&&_0x4e98c0[_0x693d('0x46')]&&_0x4e98c0[_0x693d('0x42')]){_0x42b280[_0x4e98c0[_0x693d('0x49')]]&&_0x2e00be[_0x693d('0x47')][_0x693d('0x4a')]({'id':_0x4e98c0['idField'],'value':_0x42b280[_0x4e98c0['variableName']][_0x693d('0x35')]()});}else if(_0x4e98c0['type']===_0x693d('0x4b')&&_0x4e98c0[_0x693d('0x4c')]&&_0x4e98c0[_0x693d('0x4c')][_0x693d('0x4d')]&&_0x4e98c0[_0x693d('0x46')]&&_0x4e98c0[_0x693d('0x42')]){_0x42b280[_0x4e98c0['Variable'][_0x693d('0x4d')][_0x693d('0x43')]()]&&_0x2e00be[_0x693d('0x47')]['push']({'id':_0x4e98c0['idField'],'value':_0x42b280[_0x4e98c0['Variable'][_0x693d('0x4d')][_0x693d('0x43')]()][_0x693d('0x35')]()});}});}return _0x2e00be;}exports[_0x693d('0x4e')]=function(_0x1cb3e9,_0x1fb4d7,_0x49bef1,_0x5c8077,_0x246e2f,_0x2517f6){var _0x4fdf95,_0x463190;_0x2517f6[_0x693d('0x11')]=intUtil[_0x693d('0x4f')](_0x2517f6['remoteUri']);_0x2517f6['serverUrl']=intUtil[_0x693d('0x4f')](_0x2517f6[_0x693d('0x50')]);if(_0x246e2f&&_0x246e2f['monitor_format']){logger[_0x693d('0xd')](_0x693d('0x51'),'Recording\x20is\x20enabled!');_0x1fb4d7['recordingURL']=util['format'](_0x693d('0x52'),_0x2517f6[_0x693d('0x50')],_0x1fb4d7[_0x693d('0x53')],md5(_0x1fb4d7[_0x693d('0x53')]));}else{_0x1fb4d7[_0x693d('0x54')]='';}headers['Authorization']=getAuth(_0x2517f6);return getUser(_0x2517f6,_0x5c8077['email'])[_0x693d('0x18')](function(_0x54a224){_0x4fdf95=_0x54a224;logger[_0x693d('0xd')](_0x693d('0x55'),_0x4fdf95['id']);return getEndUser(_0x2517f6,_0x1fb4d7['calleridname'],_0x1fb4d7[_0x693d('0x56')]);})[_0x693d('0x18')](function(_0x13aca7){_0x463190=_0x13aca7;logger[_0x693d('0xd')]('The\x20Enduser\x20ID\x20is:',_0x463190['id']);return getTicket(_0x2517f6,_0x4fdf95,_0x463190,_0x49bef1,_0x1fb4d7);})[_0x693d('0x18')](function(_0x3cd03b){if(_0x3cd03b){logger[_0x693d('0xd')](_0x693d('0x57'),_0x3cd03b['id']);switch(_0x2517f6[_0x693d('0x40')]){case'integrationTab':logger[_0x693d('0xd')](_0x693d('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x693d('0x58'),_0x2517f6[_0x693d('0x11')],_0x4fdf95['id'],_0x3cd03b['id']),'method':'POST'});case _0x693d('0x59'):logger[_0x693d('0xd')](_0x693d('0x51'),_0x693d('0x5a'));emit(util[_0x693d('0xf')]('user:%s',_0x5c8077['name']),_0x693d('0x5b'),{'uri':util[_0x693d('0xf')]('%s/agent/tickets/%s',_0x2517f6[_0x693d('0x11')][_0x693d('0x5c')](_0x693d('0x5d'),''),_0x3cd03b['id'])});break;default:logger['error']('[QUEUE]',_0x693d('0x5e'));}}})[_0x693d('0x5f')](function(_0xd5a450){logger[_0x693d('0x60')](_0x693d('0x61'),util[_0x693d('0x62')](_0xd5a450,{'showHidden':!![],'depth':null}));});};exports[_0x693d('0x63')]=function(_0x48742b,_0x194360,_0x13a51d,_0x1bd803,_0x5a5487,_0xc3d8e8,_0x29c598){var _0x5af64f,_0x4828d5;_0xc3d8e8['remoteUri']=intUtil[_0x693d('0x4f')](_0xc3d8e8['remoteUri']);_0xc3d8e8[_0x693d('0x50')]=intUtil[_0x693d('0x4f')](_0xc3d8e8[_0x693d('0x50')]);if(_0x29c598&&_0x29c598[_0x693d('0x64')]&&_0x29c598[_0x693d('0x64')]!==_0x693d('0x65')){logger[_0x693d('0xd')]('[OUTBOUND]',_0x693d('0x66'));_0x194360[_0x693d('0x54')]=util[_0x693d('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc3d8e8[_0x693d('0x50')],_0x194360['uniqueid'],md5(_0x194360[_0x693d('0x53')]));}headers[_0x693d('0x67')]=getAuth(_0xc3d8e8);return getUser(_0xc3d8e8,_0x1bd803[_0x693d('0x68')])[_0x693d('0x18')](function(_0x291de3){_0x5af64f=_0x291de3;logger[_0x693d('0xd')](_0x693d('0x55'),_0x5af64f['id']);return getEndUser(_0xc3d8e8,_0x194360[_0x693d('0x69')],_0x194360[_0x693d('0x6a')]);})[_0x693d('0x18')](function(_0x2b60d9){_0x4828d5=_0x2b60d9;logger[_0x693d('0xd')](_0x693d('0x6b'),_0x4828d5['id']);return getTicket(_0xc3d8e8,_0x5af64f,_0x4828d5,_0x13a51d,_0x194360);})['then'](function(_0x1472cc){if(_0x1472cc){logger['info'](_0x693d('0x57'),_0x1472cc['id']);switch(_0xc3d8e8[_0x693d('0x40')]){case _0x693d('0x6c'):logger[_0x693d('0xd')]('[OUTBOUND]',_0x693d('0x6d'));return request({'uri':util[_0x693d('0xf')](_0x693d('0x58'),_0xc3d8e8[_0x693d('0x11')],_0x5af64f['id'],_0x1472cc['id']),'method':_0x693d('0x6e')});case _0x693d('0x59'):logger[_0x693d('0xd')](_0x693d('0x6f'),_0x693d('0x5a'));emit(util[_0x693d('0xf')]('user:%s',_0x1bd803[_0x693d('0x4d')]),_0x693d('0x5b'),{'uri':util[_0x693d('0xf')]('%s/agent/tickets/%s',_0xc3d8e8['remoteUri'][_0x693d('0x5c')]('/api/v2',''),_0x1472cc['id'])});break;default:logger[_0x693d('0x60')](_0x693d('0x6f'),_0x693d('0x5e'));}}})[_0x693d('0x5f')](function(_0xaf33b){logger[_0x693d('0x60')](_0x693d('0x70'),util[_0x693d('0x62')](_0xaf33b,{'showHidden':!![],'depth':null}));});};exports[_0x693d('0x71')]=function(_0x42472d,_0x1cb86c,_0x582ecd,_0x5aa307,_0x25fe86,_0x5d4034){var _0x5bd2b3,_0x5cc1df;_0x5d4034[_0x693d('0x11')]=intUtil[_0x693d('0x4f')](_0x5d4034['remoteUri']);_0x5d4034[_0x693d('0x50')]=intUtil['stripTrailingSlash'](_0x5d4034[_0x693d('0x50')]);if(_0x25fe86&&_0x25fe86[_0x693d('0x72')]){logger[_0x693d('0xd')]('['+_0x1cb86c['lastevent'][_0x693d('0x73')]()+']',_0x693d('0x66'));_0x1cb86c[_0x693d('0x54')]=util['format'](_0x693d('0x52'),_0x5d4034['serverUrl'],_0x1cb86c[_0x693d('0x53')],md5(_0x1cb86c['uniqueid']));}else{_0x1cb86c[_0x693d('0x54')]='';}headers[_0x693d('0x67')]=getAuth(_0x5d4034);return getUser(_0x5d4034)[_0x693d('0x18')](function(_0x5b2bb7){_0x5bd2b3=_0x5b2bb7;logger[_0x693d('0xd')]('The\x20User\x20ID\x20is:',_0x5bd2b3['id']);return getEndUser(_0x5d4034,_0x1cb86c[_0x693d('0x74')],_0x1cb86c[_0x693d('0x56')]);})['then'](function(_0x2b4722){_0x5cc1df=_0x2b4722;logger[_0x693d('0xd')](_0x693d('0x6b'),_0x5cc1df['id']);return getTicket(_0x5d4034,_0x5bd2b3,_0x5cc1df,_0x582ecd,_0x1cb86c);})[_0x693d('0x18')](function(_0xf713fb){if(_0xf713fb){logger[_0x693d('0xd')](_0x693d('0x57'),_0xf713fb['id']);}})[_0x693d('0x5f')](function(_0xd55bd2){logger[_0x693d('0x60')]('['+_0x1cb86c[_0x693d('0x75')][_0x693d('0x73')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xd55bd2,{'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 ddbaab6..6146d98 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 _0xbfd5=['../../../../config/environment','../../../../config/logger','zoho','redis','defaults','emit','debug','[HTTP]','includes','string','picklist','type','idField','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','clientId','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','user','profile','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','Contacts','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','utc','endtime','diff','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','Fields','POST','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridname','destcalleridnum','Outbound','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','calleridname','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis'];(function(_0x3be224,_0x458155){var _0x152543=function(_0x469db9){while(--_0x469db9){_0x3be224['push'](_0x3be224['shift']());}};_0x152543(++_0x458155);}(_0xbfd5,0x1dc));var _0x5bfd=function(_0x25c045,_0x23937a){_0x25c045=_0x25c045-0x0;var _0x3ddf91=_0xbfd5[_0x25c045];return _0x3ddf91;};'use strict';var _=require(_0x5bfd('0x0'));var rp=require(_0x5bfd('0x1'));var md5=require(_0x5bfd('0x2'));var util=require(_0x5bfd('0x3'));var intUtil=require(_0x5bfd('0x4'));var moment=require(_0x5bfd('0x5'));var Redis=require(_0x5bfd('0x6'));var BPromise=require('bluebird');var config=require(_0x5bfd('0x7'));var logger=require(_0x5bfd('0x8'))(_0x5bfd('0x9'));config[_0x5bfd('0xa')]=_[_0x5bfd('0xb')](config[_0x5bfd('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bfd('0xa')]));function emit(_0x3ff872,_0x1d0ccc,_0x183892){io['to'](_0x3ff872)[_0x5bfd('0xc')](_0x1d0ccc,_0x183892);}function request(_0x3ac577){logger[_0x5bfd('0xd')](_0x5bfd('0xe'),JSON['stringify'](_0x3ac577));return rp(_0x3ac577);}function getCustomFields(_0x234022,_0x55f210){var _0x20fab1={};if(_0x234022['length']>0x0){_['forEach'](_0x234022,function(_0x13c7dc){if(_[_0x5bfd('0xf')]([_0x5bfd('0x10'),_0x5bfd('0x11')],_0x13c7dc[_0x5bfd('0x12')])&&_0x13c7dc[_0x5bfd('0x13')]){_0x20fab1[_0x13c7dc['idField']]=_0x13c7dc['content']['toString']();}else if(_0x13c7dc[_0x5bfd('0x12')]===_0x5bfd('0x14')&&_0x13c7dc[_0x5bfd('0x15')]&&_0x13c7dc[_0x5bfd('0x13')]&&_0x55f210[_0x13c7dc[_0x5bfd('0x15')]]){_0x20fab1[_0x13c7dc[_0x5bfd('0x13')]]=_0x55f210[_0x13c7dc[_0x5bfd('0x15')]]['toString']();}else if(_0x13c7dc[_0x5bfd('0x12')]===_0x5bfd('0x16')&&_0x13c7dc['Variable']&&_0x13c7dc[_0x5bfd('0x17')][_0x5bfd('0x18')]&&_0x13c7dc[_0x5bfd('0x13')]&&_0x55f210[_0x13c7dc[_0x5bfd('0x17')]['name'][_0x5bfd('0x19')]()]){_0x20fab1[_0x13c7dc[_0x5bfd('0x13')]]=_0x55f210[_0x13c7dc[_0x5bfd('0x17')][_0x5bfd('0x18')][_0x5bfd('0x19')]()][_0x5bfd('0x1a')]();}});}return _0x20fab1;}function getName(_0x1aa3a9){if(_0x1aa3a9[_0x5bfd('0x1b')]('\x20')>0x0){var _0x445d8d=_0x1aa3a9[_0x5bfd('0x1c')](/ (.+)/);if(_0x445d8d[0x1]){return _0x445d8d;}}return[_0x1aa3a9,_0x1aa3a9];}var accountsTokens={};function getAccessToken(_0x1ff24e){return new Promise(function(_0x2704aa,_0x4b24c3){if(!_['isNil'](accountsTokens[_0x1ff24e['id']])&&!_[_0x5bfd('0x1d')](accountsTokens[_0x1ff24e['id']][_0x5bfd('0x1e')])){if(moment()[_0x5bfd('0x1f')](accountsTokens[_0x1ff24e['id']][_0x5bfd('0x20')])){_0x2704aa(accountsTokens[_0x1ff24e['id']][_0x5bfd('0x1e')]);}}var _0x1dc630;switch(_0x1ff24e[_0x5bfd('0x21')]){case'US':_0x1dc630='https://accounts.zoho.com';break;case'AU':_0x1dc630=_0x5bfd('0x22');break;case'EU':_0x1dc630=_0x5bfd('0x23');break;case'IN':_0x1dc630='https://accounts.zoho.in';break;case'CN':_0x1dc630=_0x5bfd('0x24');break;default:_0x1dc630=_0x5bfd('0x23');break;}var _0x12bb38={'method':'POST','uri':_0x1dc630+'/oauth/v2/token','qs':{'refresh_token':_0x1ff24e['refreshToken'],'client_id':_0x1ff24e[_0x5bfd('0x25')],'client_secret':_0x1ff24e[_0x5bfd('0x26')],'grant_type':_0x5bfd('0x27')},'json':!![]};return rp(_0x12bb38)[_0x5bfd('0x28')](function(_0xc899c6){accountsTokens[_0x1ff24e['id']]={'access_token':_0xc899c6['access_token'],'expires_in':moment()['add'](_0xc899c6[_0x5bfd('0x20')],_0x5bfd('0x29'))};_0x2704aa(_0xc899c6[_0x5bfd('0x1e')]);})['catch'](function(_0x152b35){logger[_0x5bfd('0x2a')](_0x5bfd('0x2b'),_0x152b35[_0x5bfd('0x2c')]);_0x4b24c3(_0x152b35);});});}function getUser(_0xf2372f,_0x3520c2,_0x3255aa,_0x362465){logger[_0x5bfd('0x2d')](_0x5bfd('0x2e'));return request({'method':_0x5bfd('0x2f'),'uri':util[_0x5bfd('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x3520c2),'qs':{'type':_0x5bfd('0x31')},'headers':{'Authorization':_0x5bfd('0x32')+_0xf2372f},'json':!![]})[_0x5bfd('0x28')](function(_0x470498){if(_0x470498[_0x5bfd('0x33')]){var _0x8ca9f0=-0x1;if(_[_0x5bfd('0x34')](_0x470498[_0x5bfd('0x33')])){if(!_[_0x5bfd('0x1d')](_0x362465)){_0x8ca9f0=_['findIndex'](_0x470498[_0x5bfd('0x33')],function(_0x2d1731){return _0x2d1731[_0x5bfd('0x35')]===_0x362465;});}if(_0x8ca9f0>=0x0){logger[_0x5bfd('0x2d')](_0x5bfd('0x36'));}else{logger[_0x5bfd('0x2d')](_0x5bfd('0x37'));_0x8ca9f0=_[_0x5bfd('0x38')](_0x470498[_0x5bfd('0x33')],function(_0x1d7f52){return _0x1d7f52['profile'][_0x5bfd('0x18')]===_0x5bfd('0x39');});}return _0x470498[_0x5bfd('0x33')][_0x8ca9f0];}else{if(_0x470498[_0x5bfd('0x3a')][_0x5bfd('0x3b')][_0x5bfd('0x18')]===_0x5bfd('0x39')){logger[_0x5bfd('0x2d')](_0x5bfd('0x37'));user=_0x470498[_0x5bfd('0x3a')];return user;}else{logger[_0x5bfd('0x2a')](_0x5bfd('0x3c'),JSON[_0x5bfd('0x3d')](_0x470498));throw new Error(_0x5bfd('0x3e')+JSON[_0x5bfd('0x3d')](_0x470498));}}}else{logger[_0x5bfd('0x2a')]('The\x20failing\x20result\x20is',JSON[_0x5bfd('0x3d')](_0x470498));throw new Error(_0x5bfd('0x3e')+JSON[_0x5bfd('0x3d')](_0x470498));}})[_0x5bfd('0x3f')](function(_0x1d6017){console['error'](_0x1d6017);});}function getZohoUser(_0x4adbc0,_0x2ceb54){return new BPromise(function(_0x324967,_0x3a69d9){request(_0x4adbc0)[_0x5bfd('0x28')](function(_0x38b6d2){var _0x32d7ba=null;if(_0x38b6d2){_0x32d7ba=_0x38b6d2[_0x5bfd('0x40')][0x0];_0x32d7ba[_0x5bfd('0x41')]=_0x2ceb54;}_0x324967(_0x32d7ba);})[_0x5bfd('0x3f')](function(_0x41e60c){_0x3a69d9(_0x41e60c);});});}function createEndUser(_0x18954e,_0x29214f,_0x1e9d8b,_0x43cc72,_0xafb370,_0x49368c){var _0x1e9d8b=getName(_0x1e9d8b);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x29214f+_0x5bfd('0x42')+_[_0x5bfd('0x43')](_0x49368c[_0x5bfd('0x44')])+'s','body':{'data':[{'Last_Name':_0x1e9d8b[0x1],'First_Name':_0x1e9d8b[0x0],'Phone':_0x43cc72,'Owner':{'name':!_[_0x5bfd('0x1d')](_0xafb370[_0x5bfd('0x45')][_0x5bfd('0x18')])?_0xafb370[_0x5bfd('0x45')][_0x5bfd('0x18')]:!_['isNil'](_0xafb370['first_name'])?_0xafb370[_0x5bfd('0x46')]+'\x20'+_0xafb370[_0x5bfd('0x47')]:_0xafb370[_0x5bfd('0x47')],'id':_0xafb370['id']}}]},'headers':{'Authorization':_0x5bfd('0x32')+_0x18954e},'json':!![]})[_0x5bfd('0x28')](function(_0xf37522){if(_0xf37522&&_0xf37522[_0x5bfd('0x40')][0x0][_0x5bfd('0x48')]===_0x5bfd('0x49')){var _0x37892a=_0xf37522['data'][0x0][_0x5bfd('0x4a')];_0x37892a[_0x5bfd('0x41')]=_[_0x5bfd('0x43')](_0x49368c[_0x5bfd('0x44')])+'s';return _0x37892a;}logger[_0x5bfd('0x2a')](_0x5bfd('0x3c'),JSON[_0x5bfd('0x3d')](data));throw new Error('Error:\x20'+JSON[_0x5bfd('0x3d')](data));})[_0x5bfd('0x3f')](function(_0x3beb13){console[_0x5bfd('0x4b')](_0x5bfd('0x4c'),_0x3beb13);});}function getEndUser(_0xdb4aa2,_0x40aaa3,_0x5f0539,_0x56ed80,_0x4dc775,_0x130adb,_0x29b337){var _0x2b8ff3={'method':_0x5bfd('0x2f'),'uri':'','headers':{'Authorization':_0x5bfd('0x32')+_0xdb4aa2},'json':!![]};switch(_0x29b337[_0x5bfd('0x4d')]){case _0x5bfd('0x4e'):_0x2b8ff3[_0x5bfd('0x4f')]=_0x5bfd('0x50')+_0x40aaa3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4dc775+'))';return getZohoUser(_0x2b8ff3,_0x5bfd('0x51'))[_0x5bfd('0x28')](function(_0x12ae29){if(_0x12ae29)return _0x12ae29;_0x2b8ff3[_0x5bfd('0x4f')]=_0x5bfd('0x50')+_0x40aaa3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4dc775+'))';return getZohoUser(_0x2b8ff3,_0x5bfd('0x52'))[_0x5bfd('0x28')](function(_0x378204){if(_0x378204)return _0x378204;if(_0x29b337['moduleCreate']!=_0x5bfd('0x53')){return createEndUser(_0xdb4aa2,_0x40aaa3,_0x56ed80,_0x4dc775,_0x130adb,_0x29b337);}else{return{};}});});break;case'contact':_0x2b8ff3['uri']=_0x5bfd('0x50')+_0x40aaa3+_0x5bfd('0x54')+_0x4dc775+'))';return getZohoUser(_0x2b8ff3,_0x5bfd('0x51'))[_0x5bfd('0x28')](function(_0xce9c8c){if(_0xce9c8c)return _0xce9c8c;if(_0x29b337[_0x5bfd('0x44')]!=_0x5bfd('0x53')){return createEndUser(_0xdb4aa2,_0x40aaa3,_0x56ed80,_0x4dc775,_0x130adb,_0x29b337);}else{return{};}});break;case _0x5bfd('0x55'):_0x2b8ff3['uri']='https://www.zohoapis.'+_0x40aaa3+_0x5bfd('0x56')+_0x4dc775+'))';return getZohoUser(_0x2b8ff3,_0x5bfd('0x52'))[_0x5bfd('0x28')](function(_0x4dd9e1){if(_0x4dd9e1)return _0x4dd9e1;if(_0x29b337[_0x5bfd('0x44')]!=_0x5bfd('0x53')){return createEndUser(_0xdb4aa2,_0x40aaa3,_0x56ed80,_0x4dc775,_0x130adb,_0x29b337);}else{return{};}});break;}}function getCall(_0x13fe71,_0x1af0ad,_0x50677b,_0x5d2cc7,_0x49ede0,_0x14dfcc,_0x8169a2,_0x22b56d){logger[_0x5bfd('0x2d')](_0x5bfd('0x57'));var _0xb8ec15={};_0xb8ec15[_0x5bfd('0x58')]={'name':!_[_0x5bfd('0x1d')](_0x5d2cc7['role'][_0x5bfd('0x18')])&&!_[_0x5bfd('0x1d')](_0x5d2cc7[_0x5bfd('0x3b')][_0x5bfd('0x18')])&&_0x5d2cc7[_0x5bfd('0x3b')][_0x5bfd('0x18')]===_0x5bfd('0x59')?_0x5d2cc7[_0x5bfd('0x45')]['name']:!_[_0x5bfd('0x1d')](_0x5d2cc7['first_name'])?_0x5d2cc7[_0x5bfd('0x46')]+'\x20'+_0x5d2cc7[_0x5bfd('0x47')]:_0x5d2cc7['last_name'],'id':_0x5d2cc7['id']};_0xb8ec15[_0x5bfd('0x5a')]=intUtil[_0x5bfd('0x5b')](_0x14dfcc[_0x5bfd('0x5c')],_0x8169a2,'\x20');_0xb8ec15['Description']=intUtil['getString'](_0x14dfcc[_0x5bfd('0x5d')],_0x8169a2,'\x0a');if(_0x49ede0[_0x5bfd('0x41')]===_0x5bfd('0x51')){_0xb8ec15[_0x5bfd('0x5e')]={'name':!_[_0x5bfd('0x1d')](_0x49ede0[_0x5bfd('0x5f')])?_0x49ede0[_0x5bfd('0x5f')]:!_[_0x5bfd('0x1d')](_0x49ede0[_0x5bfd('0x60')])?_0x49ede0[_0x5bfd('0x60')]+'\x20'+_0x49ede0['Last_Name']:_0x49ede0[_0x5bfd('0x61')],'id':_0x49ede0['id']};}if(_0x49ede0['enduserType']===_0x5bfd('0x52')){_0xb8ec15[_0x5bfd('0x62')]={'name':!_[_0x5bfd('0x1d')](_0x49ede0[_0x5bfd('0x5f')])?_0x49ede0['Full_Name']:!_[_0x5bfd('0x1d')](_0x49ede0['First_Name'])?_0x49ede0[_0x5bfd('0x60')]+'\x20'+_0x49ede0[_0x5bfd('0x61')]:_0x49ede0[_0x5bfd('0x61')],'id':_0x49ede0['id']};_0xb8ec15[_0x5bfd('0x63')]=_['startCase'](_0x49ede0['enduserType']);}if(_0x8169a2[_0x5bfd('0x64')]){_0xb8ec15[_0x5bfd('0x65')]=moment['utc'](parseInt(_0x8169a2['talktime'])*0x3e8)[_0x5bfd('0x30')](_0x5bfd('0x66'));}else if(_0x8169a2['answertime']&&_0x8169a2['endtime']){_0xb8ec15[_0x5bfd('0x65')]=moment[_0x5bfd('0x67')](moment(_0x8169a2[_0x5bfd('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0x5bfd('0x69')](moment(_0x8169a2[_0x5bfd('0x6a')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x5bfd('0x66'));}switch(_0x8169a2[_0x5bfd('0x6b')]){case _0x5bfd('0x6c'):_0xb8ec15['Call_Result']=_0x5bfd('0x6d');break;case _0x5bfd('0x6e'):case _0x5bfd('0x6f'):_0xb8ec15[_0x5bfd('0x70')]=_0x5bfd('0x71');break;case _0x5bfd('0x72'):_0xb8ec15[_0x5bfd('0x70')]=_0x5bfd('0x73');break;case _0x5bfd('0x74'):_0xb8ec15[_0x5bfd('0x70')]=_0x5bfd('0x75');break;case _0x5bfd('0x76'):_0xb8ec15[_0x5bfd('0x70')]=_0x5bfd('0x77');default:}_0xb8ec15[_0x5bfd('0x78')]=(_0x22b56d===_0x5bfd('0x79')?moment(_0x8169a2[_0x5bfd('0x6a')])[_0x5bfd('0x30')](_0x5bfd('0x7a')):moment(_0x8169a2[_0x5bfd('0x7b')])['format'](_0x5bfd('0x7a')))||moment()[_0x5bfd('0x30')]('YYYY-MM-DDTHH:mm:ss');_0xb8ec15[_0x5bfd('0x7c')]=_0x22b56d||_0x5bfd('0x7d');_0xb8ec15=_['merge'](_0xb8ec15,getCustomFields(_0x14dfcc[_0x5bfd('0x7e')],_0x8169a2));return request({'method':_0x5bfd('0x7f'),'uri':_0x5bfd('0x50')+_0x1af0ad+_0x5bfd('0x80'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x13fe71},'body':{'data':[_0xb8ec15]},'json':!![]})[_0x5bfd('0x28')](function(_0x5e6cbe){if(_0x5e6cbe&&_0x5e6cbe[_0x5bfd('0x40')][0x0][_0x5bfd('0x48')]===_0x5bfd('0x49')){logger[_0x5bfd('0x2d')](_0x5bfd('0x81'));return{'id':_0x5e6cbe[_0x5bfd('0x40')][0x0][_0x5bfd('0x4a')]['id']};}})['catch'](function(_0x1b9de9){logger[_0x5bfd('0x2d')]('err',_0x1b9de9[_0x5bfd('0x2c')]);console[_0x5bfd('0x4b')](_0x5bfd('0x82'),_0x1b9de9);});}exports[_0x5bfd('0x83')]=function(_0x3d79e2,_0x3d0ea2,_0x1448af,_0x47fc3c,_0x2322ca,_0x3ec1b4){var _0x224827,_0x461c16,_0x2a09fd;_0x3ec1b4[_0x5bfd('0x84')]=intUtil[_0x5bfd('0x85')](_0x3ec1b4[_0x5bfd('0x84')]);_0x3ec1b4['serverUrl']=intUtil[_0x5bfd('0x85')](_0x3ec1b4[_0x5bfd('0x86')]);if(_0x2322ca&&_0x2322ca['monitor_format']){logger[_0x5bfd('0x2d')](_0x5bfd('0x87'),_0x5bfd('0x88'));_0x3d0ea2[_0x5bfd('0x89')]=_0x3ec1b4[_0x5bfd('0x86')]+_0x5bfd('0x8a')+_0x3d0ea2[_0x5bfd('0x8b')]+_0x5bfd('0x8c')+md5(_0x3d0ea2[_0x5bfd('0x8b')]);}else{_0x3d0ea2[_0x5bfd('0x89')]='';}var _0x261365=_0x3ec1b4[_0x5bfd('0x84')]==='zoho.eu'?'eu':_0x5bfd('0x8d');return getAccessToken(_0x3ec1b4)[_0x5bfd('0x28')](function(_0x11d814){_0x2a09fd=_0x11d814;return getUser(_0x2a09fd,_0x261365,_0x3ec1b4,_0x47fc3c['email']);})[_0x5bfd('0x28')](function(_0x303305){_0x224827=_0x303305;logger[_0x5bfd('0x2d')](_0x5bfd('0x8e'),_0x224827['id']);return getEndUser(_0x2a09fd,_0x261365,_0x3ec1b4,_0x3d0ea2['calleridname'],_0x3d0ea2[_0x5bfd('0x8f')],_0x224827,_0x1448af);})[_0x5bfd('0x28')](function(_0x2eed02){_0x461c16=_0x2eed02;return getCall(_0x2a09fd,_0x261365,_0x3ec1b4,_0x224827,_0x461c16,_0x1448af,_0x3d0ea2,'Inbound');})['then'](function(_0x17b92d){if(_0x17b92d){logger['info'](_0x5bfd('0x90'),_0x17b92d['id']);logger[_0x5bfd('0x2d')]('[QUEUE]',_0x5bfd('0x91'));emit(util['format']('user:%s',_0x47fc3c[_0x5bfd('0x18')]),'trigger:browser:url',{'uri':_0x5bfd('0x92')+_0x3ec1b4[_0x5bfd('0x84')]+'/crm/EntityInfo.do?module=Calls&id='+_0x17b92d['id']});}})['catch'](function(_0x132184){logger[_0x5bfd('0x2a')](_0x5bfd('0x87'),JSON['stringify'](_0x132184));});};exports[_0x5bfd('0x79')]=function(_0x39d4e8,_0xe9747f,_0x5be8cc,_0x2c24a6,_0xd3afef,_0x1e2a29,_0xccbd62){var _0x51ecab,_0x20fe2a,_0x2bc413;_0x1e2a29['host']=intUtil['stripTrailingSlash'](_0x1e2a29[_0x5bfd('0x84')]);_0x1e2a29[_0x5bfd('0x86')]=intUtil[_0x5bfd('0x85')](_0x1e2a29[_0x5bfd('0x86')]);if(_0xccbd62&&_0xccbd62[_0x5bfd('0x93')]&&_0xccbd62[_0x5bfd('0x93')]!==_0x5bfd('0x94')){logger[_0x5bfd('0x2d')](_0x5bfd('0x95'),'Recording\x20is\x20enabled!');_0xe9747f[_0x5bfd('0x89')]=_0x1e2a29[_0x5bfd('0x86')]+_0x5bfd('0x8a')+_0xe9747f[_0x5bfd('0x8b')]+_0x5bfd('0x8c')+md5(_0xe9747f[_0x5bfd('0x8b')]);}var _0x478757=_0x1e2a29[_0x5bfd('0x84')]===_0x5bfd('0x96')?'eu':_0x5bfd('0x8d');return getAccessToken(_0x1e2a29)[_0x5bfd('0x28')](function(_0x5a599c){_0x2bc413=_0x5a599c;return getUser(_0x2bc413,_0x478757,_0x1e2a29,_0x2c24a6['email']);})[_0x5bfd('0x28')](function(_0x3eeb54){_0x51ecab=_0x3eeb54;logger[_0x5bfd('0x2d')]('The\x20User\x20ID\x20is:',_0x51ecab['id']);return getEndUser(_0x2bc413,_0x478757,_0x1e2a29,_0xe9747f[_0x5bfd('0x97')],_0xe9747f[_0x5bfd('0x98')],_0x51ecab,_0x5be8cc);})[_0x5bfd('0x28')](function(_0x1dec03){_0x20fe2a=_0x1dec03;return getCall(_0x2bc413,_0x478757,_0x1e2a29,_0x51ecab,_0x20fe2a,_0x5be8cc,_0xe9747f,_0x5bfd('0x99'));})[_0x5bfd('0x28')](function(_0x5dc2cd){if(_0x5dc2cd){logger[_0x5bfd('0x2d')]('The\x20Call\x20ID\x20is:',_0x5dc2cd['id']);logger[_0x5bfd('0x2d')](_0x5bfd('0x95'),_0x5bfd('0x91'));emit(util[_0x5bfd('0x30')](_0x5bfd('0x9a'),_0x2c24a6[_0x5bfd('0x18')]),_0x5bfd('0x9b'),{'uri':_0x5bfd('0x92')+_0x1e2a29[_0x5bfd('0x84')]+_0x5bfd('0x9c')+_0x5dc2cd['id']});}})[_0x5bfd('0x3f')](function(_0x10c8de){logger[_0x5bfd('0x2a')]('[OUTBOUND]',JSON[_0x5bfd('0x3d')](_0x10c8de));});};exports[_0x5bfd('0x9d')]=function(_0x21937c,_0x1838d9,_0x50d9ab,_0x2f5bc7,_0x22110f,_0x4856a3){var _0x1f0a40,_0x3e6a08,_0x3aa421;_0x4856a3[_0x5bfd('0x84')]=intUtil[_0x5bfd('0x85')](_0x4856a3['host']);_0x4856a3[_0x5bfd('0x86')]=intUtil[_0x5bfd('0x85')](_0x4856a3[_0x5bfd('0x86')]);if(_0x22110f&&_0x22110f[_0x5bfd('0x9e')]){logger[_0x5bfd('0x2d')]('['+_0x1838d9[_0x5bfd('0x6b')]['toUpperCase']()+']',_0x5bfd('0x88'));_0x1838d9['recordingURL']=_0x4856a3[_0x5bfd('0x86')]+_0x5bfd('0x8a')+_0x1838d9[_0x5bfd('0x8b')]+_0x5bfd('0x8c')+md5(_0x1838d9[_0x5bfd('0x8b')]);}else{_0x1838d9['recordingURL']='';}var _0x586f6d=_0x4856a3[_0x5bfd('0x84')]==='zoho.eu'?'eu':_0x5bfd('0x8d');return getAccessToken(_0x4856a3)['then'](function(_0x1d0656){_0x3aa421=_0x1d0656;return getUser(_0x3aa421,_0x586f6d,_0x4856a3);})[_0x5bfd('0x28')](function(_0x251712){_0x1f0a40=_0x251712;logger[_0x5bfd('0x2d')]('The\x20User\x20ID\x20is:',_0x1f0a40['id']);return getEndUser(_0x3aa421,_0x586f6d,_0x4856a3,_0x1838d9[_0x5bfd('0x9f')],_0x1838d9[_0x5bfd('0x8f')],_0x1f0a40,_0x50d9ab);})[_0x5bfd('0x28')](function(_0x502465){_0x3e6a08=_0x502465;return getCall(_0x3aa421,_0x586f6d,_0x4856a3,_0x1f0a40,_0x3e6a08,_0x50d9ab,_0x1838d9,_0x5bfd('0x7d'));})[_0x5bfd('0x28')](function(_0x113c03){if(_0x113c03){logger['info'](_0x5bfd('0x90'),_0x113c03['id']);}})[_0x5bfd('0x3f')](function(_0x5bdc9f){logger[_0x5bfd('0x2a')]('['+_0x1838d9[_0x5bfd('0x6b')][_0x5bfd('0xa0')]()+']',JSON[_0x5bfd('0x3d')](_0x5bdc9f));});}; \ No newline at end of file +var _0x9ddd=['agentcalledAt','Call_Type','Inbound','Fields','code','SUCCESS','Call\x20created!','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','[OUTBOUND]','destcalleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','format','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound'];(function(_0x48eb39,_0x2df1c5){var _0xbed037=function(_0x321119){while(--_0x321119){_0x48eb39['push'](_0x48eb39['shift']());}};_0xbed037(++_0x2df1c5);}(_0x9ddd,0xbc));var _0xd9dd=function(_0x20d535,_0x5957e7){_0x20d535=_0x20d535-0x0;var _0x4de6d4=_0x9ddd[_0x20d535];return _0x4de6d4;};'use strict';var _=require(_0xd9dd('0x0'));var rp=require(_0xd9dd('0x1'));var md5=require('md5');var util=require(_0xd9dd('0x2'));var intUtil=require(_0xd9dd('0x3'));var moment=require('moment');var Redis=require(_0xd9dd('0x4'));var BPromise=require('bluebird');var config=require(_0xd9dd('0x5'));var logger=require(_0xd9dd('0x6'))(_0xd9dd('0x7'));config[_0xd9dd('0x8')]=_[_0xd9dd('0x9')](config[_0xd9dd('0x8')],{'host':_0xd9dd('0xa'),'port':0x18eb});var io=require(_0xd9dd('0xb'))(new Redis(config['redis']));function emit(_0x3b3c98,_0x367549,_0x3942b1){io['to'](_0x3b3c98)[_0xd9dd('0xc')](_0x367549,_0x3942b1);}function request(_0x412b94){logger[_0xd9dd('0xd')](_0xd9dd('0xe'),JSON[_0xd9dd('0xf')](_0x412b94));return rp(_0x412b94);}function getCustomFields(_0x42048f,_0x247ef2){var _0x597a7e={};if(_0x42048f['length']>0x0){_['forEach'](_0x42048f,function(_0x18ee89){if(_[_0xd9dd('0x10')]([_0xd9dd('0x11'),_0xd9dd('0x12')],_0x18ee89[_0xd9dd('0x13')])&&_0x18ee89[_0xd9dd('0x14')]){_0x597a7e[_0x18ee89['idField']]=_0x18ee89[_0xd9dd('0x15')][_0xd9dd('0x16')]();}else if(_0x18ee89[_0xd9dd('0x13')]==='variable'&&_0x18ee89[_0xd9dd('0x17')]&&_0x18ee89[_0xd9dd('0x14')]&&_0x247ef2[_0x18ee89['variableName']]){_0x597a7e[_0x18ee89['idField']]=_0x247ef2[_0x18ee89[_0xd9dd('0x17')]][_0xd9dd('0x16')]();}else if(_0x18ee89['type']===_0xd9dd('0x18')&&_0x18ee89[_0xd9dd('0x19')]&&_0x18ee89['Variable'][_0xd9dd('0x1a')]&&_0x18ee89[_0xd9dd('0x14')]&&_0x247ef2[_0x18ee89[_0xd9dd('0x19')][_0xd9dd('0x1a')]['toLowerCase']()]){_0x597a7e[_0x18ee89[_0xd9dd('0x14')]]=_0x247ef2[_0x18ee89[_0xd9dd('0x19')][_0xd9dd('0x1a')][_0xd9dd('0x1b')]()]['toString']();}});}return _0x597a7e;}function getName(_0x463aaf){if(_0x463aaf['indexOf']('\x20')>0x0){var _0x96f376=_0x463aaf[_0xd9dd('0x1c')](/ (.+)/);if(_0x96f376[0x1]){return _0x96f376;}}return[_0x463aaf,_0x463aaf];}var accountsTokens={};function getAccessToken(_0x145c98){return new Promise(function(_0x3f244a,_0x1781fc){if(!_['isNil'](accountsTokens[_0x145c98['id']])&&!_[_0xd9dd('0x1d')](accountsTokens[_0x145c98['id']][_0xd9dd('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x145c98['id']][_0xd9dd('0x1f')])){_0x3f244a(accountsTokens[_0x145c98['id']]['access_token']);}}var _0x2fcdf6;switch(_0x145c98['zone']){case'US':_0x2fcdf6=_0xd9dd('0x20');break;case'AU':_0x2fcdf6=_0xd9dd('0x21');break;case'EU':_0x2fcdf6='https://accounts.zoho.eu';break;case'IN':_0x2fcdf6=_0xd9dd('0x22');break;case'CN':_0x2fcdf6=_0xd9dd('0x23');break;default:_0x2fcdf6='https://accounts.zoho.eu';break;}var _0x565c7c={'method':_0xd9dd('0x24'),'uri':_0x2fcdf6+'/oauth/v2/token','qs':{'refresh_token':_0x145c98[_0xd9dd('0x25')],'client_id':_0x145c98[_0xd9dd('0x26')],'client_secret':_0x145c98[_0xd9dd('0x27')],'grant_type':_0xd9dd('0x28')},'json':!![]};return rp(_0x565c7c)[_0xd9dd('0x29')](function(_0x219715){accountsTokens[_0x145c98['id']]={'access_token':_0x219715[_0xd9dd('0x1e')],'expires_in':moment()[_0xd9dd('0x2a')](_0x219715[_0xd9dd('0x1f')],_0xd9dd('0x2b'))};_0x3f244a(_0x219715[_0xd9dd('0x1e')]);})[_0xd9dd('0x2c')](function(_0x429f6e){logger[_0xd9dd('0x2d')](_0xd9dd('0x2e'),_0x429f6e['stack']);_0x1781fc(_0x429f6e);});});}function getUser(_0x3624c0,_0x543613,_0x9199bc,_0x3bb46f){logger[_0xd9dd('0x2f')](_0xd9dd('0x30'));return request({'method':_0xd9dd('0x31'),'uri':util['format'](_0xd9dd('0x32'),_0x543613),'qs':{'type':_0xd9dd('0x33')},'headers':{'Authorization':_0xd9dd('0x34')+_0x3624c0},'json':!![]})[_0xd9dd('0x29')](function(_0x25ebe8){if(_0x25ebe8[_0xd9dd('0x35')]){var _0x4a2356=-0x1;if(_['isArrayLikeObject'](_0x25ebe8[_0xd9dd('0x35')])){if(!_[_0xd9dd('0x1d')](_0x3bb46f)){_0x4a2356=_[_0xd9dd('0x36')](_0x25ebe8['users'],function(_0x2e83a4){return _0x2e83a4['email']===_0x3bb46f;});}if(_0x4a2356>=0x0){logger[_0xd9dd('0x2f')]('Agent\x20found!');}else{logger[_0xd9dd('0x2f')](_0xd9dd('0x37'));_0x4a2356=_[_0xd9dd('0x36')](_0x25ebe8[_0xd9dd('0x35')],function(_0x352fde){return _0x352fde[_0xd9dd('0x38')][_0xd9dd('0x1a')]==='Administrator';});}return _0x25ebe8['users'][_0x4a2356];}else{if(_0x25ebe8[_0xd9dd('0x39')]['profile']['name']===_0xd9dd('0x3a')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x25ebe8[_0xd9dd('0x39')];return user;}else{logger[_0xd9dd('0x2d')](_0xd9dd('0x3b'),JSON[_0xd9dd('0xf')](_0x25ebe8));throw new Error(_0xd9dd('0x3c')+JSON[_0xd9dd('0xf')](_0x25ebe8));}}}else{logger[_0xd9dd('0x2d')](_0xd9dd('0x3b'),JSON[_0xd9dd('0xf')](_0x25ebe8));throw new Error(_0xd9dd('0x3c')+JSON[_0xd9dd('0xf')](_0x25ebe8));}})[_0xd9dd('0x2c')](function(_0x45a5ec){console[_0xd9dd('0x2d')](_0x45a5ec);});}function getZohoUser(_0x3f5233,_0x8951b4){return new BPromise(function(_0x4c29dc,_0x31d04a){request(_0x3f5233)[_0xd9dd('0x29')](function(_0xe90cda){var _0x116842=null;if(_0xe90cda){_0x116842=_0xe90cda[_0xd9dd('0x3d')][0x0];_0x116842[_0xd9dd('0x3e')]=_0x8951b4;}_0x4c29dc(_0x116842);})[_0xd9dd('0x2c')](function(_0xe8c506){_0x31d04a(_0xe8c506);});});}function createEndUser(_0x183bd2,_0x15c0e9,_0x258ecc,_0x3d1f12,_0x2828bb,_0x3b4168){var _0x258ecc=getName(_0x258ecc);return request({'method':_0xd9dd('0x24'),'uri':_0xd9dd('0x3f')+_0x15c0e9+_0xd9dd('0x40')+_[_0xd9dd('0x41')](_0x3b4168[_0xd9dd('0x42')])+'s','body':{'data':[{'Last_Name':_0x258ecc[0x1],'First_Name':_0x258ecc[0x0],'Phone':_0x3d1f12,'Owner':{'name':!_['isNil'](_0x2828bb[_0xd9dd('0x43')][_0xd9dd('0x1a')])?_0x2828bb['role']['name']:!_[_0xd9dd('0x1d')](_0x2828bb[_0xd9dd('0x44')])?_0x2828bb['first_name']+'\x20'+_0x2828bb[_0xd9dd('0x45')]:_0x2828bb[_0xd9dd('0x45')],'id':_0x2828bb['id']}}]},'headers':{'Authorization':_0xd9dd('0x34')+_0x183bd2},'json':!![]})[_0xd9dd('0x29')](function(_0x4cbbda){if(_0x4cbbda&&_0x4cbbda[_0xd9dd('0x3d')][0x0]['code']==='SUCCESS'){var _0x4cd3bc=_0x4cbbda['data'][0x0][_0xd9dd('0x46')];_0x4cd3bc[_0xd9dd('0x3e')]=_['startCase'](_0x3b4168['moduleCreate'])+'s';return _0x4cd3bc;}logger[_0xd9dd('0x2d')]('The\x20failing\x20result\x20is',JSON[_0xd9dd('0xf')](data));throw new Error(_0xd9dd('0x47')+JSON[_0xd9dd('0xf')](data));})[_0xd9dd('0x2c')](function(_0x30e345){console[_0xd9dd('0x48')](_0xd9dd('0x49'),_0x30e345);});}function getEndUser(_0x4bb37d,_0x56e231,_0xe76b48,_0xc62f00,_0x337877,_0x466bee,_0xfd4e43){var _0xaa9a00={'method':'GET','uri':'','headers':{'Authorization':_0xd9dd('0x34')+_0x4bb37d},'json':!![]};switch(_0xfd4e43[_0xd9dd('0x4a')]){case _0xd9dd('0x4b'):_0xaa9a00[_0xd9dd('0x4c')]=_0xd9dd('0x3f')+_0x56e231+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x337877+'))';return getZohoUser(_0xaa9a00,'Contacts')[_0xd9dd('0x29')](function(_0x123ff2){if(_0x123ff2)return _0x123ff2;_0xaa9a00[_0xd9dd('0x4c')]='https://www.zohoapis.'+_0x56e231+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x337877+'))';return getZohoUser(_0xaa9a00,'Leads')[_0xd9dd('0x29')](function(_0x4d1a82){if(_0x4d1a82)return _0x4d1a82;if(_0xfd4e43[_0xd9dd('0x42')]!=_0xd9dd('0x4d')){return createEndUser(_0x4bb37d,_0x56e231,_0xc62f00,_0x337877,_0x466bee,_0xfd4e43);}else{return{};}});});break;case _0xd9dd('0x4e'):_0xaa9a00['uri']=_0xd9dd('0x3f')+_0x56e231+_0xd9dd('0x4f')+_0x337877+'))';return getZohoUser(_0xaa9a00,_0xd9dd('0x50'))[_0xd9dd('0x29')](function(_0x32d8ec){if(_0x32d8ec)return _0x32d8ec;if(_0xfd4e43[_0xd9dd('0x42')]!='nothing'){return createEndUser(_0x4bb37d,_0x56e231,_0xc62f00,_0x337877,_0x466bee,_0xfd4e43);}else{return{};}});break;case _0xd9dd('0x51'):_0xaa9a00['uri']=_0xd9dd('0x3f')+_0x56e231+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x337877+'))';return getZohoUser(_0xaa9a00,_0xd9dd('0x52'))[_0xd9dd('0x29')](function(_0x47dab5){if(_0x47dab5)return _0x47dab5;if(_0xfd4e43['moduleCreate']!=_0xd9dd('0x4d')){return createEndUser(_0x4bb37d,_0x56e231,_0xc62f00,_0x337877,_0x466bee,_0xfd4e43);}else{return{};}});break;}}function getCall(_0x50a764,_0x204d31,_0x136c6f,_0x3c9327,_0x4e420a,_0x2b6987,_0x4ed49d,_0x34ea){logger[_0xd9dd('0x2f')](_0xd9dd('0x53'));var _0x3820de={};_0x3820de[_0xd9dd('0x54')]={'name':!_[_0xd9dd('0x1d')](_0x3c9327[_0xd9dd('0x43')][_0xd9dd('0x1a')])&&!_[_0xd9dd('0x1d')](_0x3c9327['profile'][_0xd9dd('0x1a')])&&_0x3c9327[_0xd9dd('0x38')][_0xd9dd('0x1a')]===_0xd9dd('0x55')?_0x3c9327[_0xd9dd('0x43')][_0xd9dd('0x1a')]:!_[_0xd9dd('0x1d')](_0x3c9327[_0xd9dd('0x44')])?_0x3c9327['first_name']+'\x20'+_0x3c9327[_0xd9dd('0x45')]:_0x3c9327['last_name'],'id':_0x3c9327['id']};_0x3820de[_0xd9dd('0x56')]=intUtil['getString'](_0x2b6987[_0xd9dd('0x57')],_0x4ed49d,'\x20');_0x3820de[_0xd9dd('0x58')]=intUtil[_0xd9dd('0x59')](_0x2b6987[_0xd9dd('0x5a')],_0x4ed49d,'\x0a');if(_0x4e420a[_0xd9dd('0x3e')]===_0xd9dd('0x50')){_0x3820de[_0xd9dd('0x5b')]={'name':!_[_0xd9dd('0x1d')](_0x4e420a[_0xd9dd('0x5c')])?_0x4e420a[_0xd9dd('0x5c')]:!_[_0xd9dd('0x1d')](_0x4e420a[_0xd9dd('0x5d')])?_0x4e420a['First_Name']+'\x20'+_0x4e420a[_0xd9dd('0x5e')]:_0x4e420a[_0xd9dd('0x5e')],'id':_0x4e420a['id']};}if(_0x4e420a[_0xd9dd('0x3e')]===_0xd9dd('0x52')){_0x3820de['What_Id']={'name':!_[_0xd9dd('0x1d')](_0x4e420a[_0xd9dd('0x5c')])?_0x4e420a[_0xd9dd('0x5c')]:!_[_0xd9dd('0x1d')](_0x4e420a[_0xd9dd('0x5d')])?_0x4e420a[_0xd9dd('0x5d')]+'\x20'+_0x4e420a[_0xd9dd('0x5e')]:_0x4e420a[_0xd9dd('0x5e')],'id':_0x4e420a['id']};_0x3820de[_0xd9dd('0x5f')]=_[_0xd9dd('0x41')](_0x4e420a[_0xd9dd('0x3e')]);}if(_0x4ed49d[_0xd9dd('0x60')]){_0x3820de[_0xd9dd('0x61')]=moment['utc'](parseInt(_0x4ed49d[_0xd9dd('0x60')])*0x3e8)[_0xd9dd('0x62')](_0xd9dd('0x63'));}else if(_0x4ed49d[_0xd9dd('0x64')]&&_0x4ed49d[_0xd9dd('0x65')]){_0x3820de[_0xd9dd('0x61')]=moment[_0xd9dd('0x66')](moment(_0x4ed49d['endtime'],_0xd9dd('0x67'))[_0xd9dd('0x68')](moment(_0x4ed49d[_0xd9dd('0x69')],_0xd9dd('0x67'))))[_0xd9dd('0x62')](_0xd9dd('0x63'));}switch(_0x4ed49d[_0xd9dd('0x6a')]){case _0xd9dd('0x6b'):_0x3820de[_0xd9dd('0x6c')]=_0xd9dd('0x6d');break;case _0xd9dd('0x6e'):case _0xd9dd('0x6f'):_0x3820de['Call_Result']='Answered';break;case _0xd9dd('0x70'):_0x3820de[_0xd9dd('0x6c')]='Rejected';break;case'abandoned':_0x3820de['Call_Result']=_0xd9dd('0x71');break;case _0xd9dd('0x72'):_0x3820de['Call_Result']=_0xd9dd('0x73');default:}_0x3820de[_0xd9dd('0x74')]=(_0x34ea===_0xd9dd('0x75')?moment(_0x4ed49d['starttime'])[_0xd9dd('0x62')](_0xd9dd('0x67')):moment(_0x4ed49d[_0xd9dd('0x76')])[_0xd9dd('0x62')](_0xd9dd('0x67')))||moment()[_0xd9dd('0x62')]('YYYY-MM-DDTHH:mm:ss');_0x3820de[_0xd9dd('0x77')]=_0x34ea||_0xd9dd('0x78');_0x3820de=_['merge'](_0x3820de,getCustomFields(_0x2b6987[_0xd9dd('0x79')],_0x4ed49d));return request({'method':_0xd9dd('0x24'),'uri':'https://www.zohoapis.'+_0x204d31+'/crm/v2/Calls','headers':{'Authorization':_0xd9dd('0x34')+_0x50a764},'body':{'data':[_0x3820de]},'json':!![]})[_0xd9dd('0x29')](function(_0x499b3f){if(_0x499b3f&&_0x499b3f[_0xd9dd('0x3d')][0x0][_0xd9dd('0x7a')]===_0xd9dd('0x7b')){logger[_0xd9dd('0x2f')](_0xd9dd('0x7c'));return{'id':_0x499b3f[_0xd9dd('0x3d')][0x0][_0xd9dd('0x46')]['id']};}})['catch'](function(_0x144915){logger['info']('err',_0x144915[_0xd9dd('0x7d')]);console[_0xd9dd('0x48')]('err',_0x144915);});}exports[_0xd9dd('0x7e')]=function(_0x3c9b96,_0x12d634,_0x5540d4,_0x1d6c83,_0xc0bea,_0x3fc0e5){var _0x524a9c,_0x585371,_0x440420;_0x3fc0e5[_0xd9dd('0x7f')]=intUtil[_0xd9dd('0x80')](_0x3fc0e5[_0xd9dd('0x7f')]);_0x3fc0e5[_0xd9dd('0x81')]=intUtil[_0xd9dd('0x80')](_0x3fc0e5[_0xd9dd('0x81')]);if(_0xc0bea&&_0xc0bea[_0xd9dd('0x82')]){logger[_0xd9dd('0x2f')]('[QUEUE]',_0xd9dd('0x83'));_0x12d634[_0xd9dd('0x84')]=_0x3fc0e5[_0xd9dd('0x81')]+_0xd9dd('0x85')+_0x12d634['uniqueid']+_0xd9dd('0x86')+md5(_0x12d634[_0xd9dd('0x87')]);}else{_0x12d634[_0xd9dd('0x84')]='';}var _0x58a959=_0x3fc0e5[_0xd9dd('0x7f')]===_0xd9dd('0x88')?'eu':_0xd9dd('0x89');return getAccessToken(_0x3fc0e5)['then'](function(_0x41cc0b){_0x440420=_0x41cc0b;return getUser(_0x440420,_0x58a959,_0x3fc0e5,_0x1d6c83[_0xd9dd('0x8a')]);})['then'](function(_0x5a3531){_0x524a9c=_0x5a3531;logger[_0xd9dd('0x2f')](_0xd9dd('0x8b'),_0x524a9c['id']);return getEndUser(_0x440420,_0x58a959,_0x3fc0e5,_0x12d634[_0xd9dd('0x8c')],_0x12d634[_0xd9dd('0x8d')],_0x524a9c,_0x5540d4);})[_0xd9dd('0x29')](function(_0x18e685){_0x585371=_0x18e685;return getCall(_0x440420,_0x58a959,_0x3fc0e5,_0x524a9c,_0x585371,_0x5540d4,_0x12d634,_0xd9dd('0x78'));})['then'](function(_0x369c2a){if(_0x369c2a){logger['info'](_0xd9dd('0x8e'),_0x369c2a['id']);logger[_0xd9dd('0x2f')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd9dd('0x62')](_0xd9dd('0x8f'),_0x1d6c83[_0xd9dd('0x1a')]),_0xd9dd('0x90'),{'uri':'https://crm.'+_0x3fc0e5[_0xd9dd('0x7f')]+_0xd9dd('0x91')+_0x369c2a['id']});}})['catch'](function(_0x530bc4){logger[_0xd9dd('0x2d')](_0xd9dd('0x92'),JSON[_0xd9dd('0xf')](_0x530bc4));});};exports['outbound']=function(_0x3163e0,_0x57fdb4,_0x5c2dc8,_0x449587,_0x4bdae3,_0x5ac6ae,_0x55466a){var _0x59eda6,_0x2ac067,_0x3b4814;_0x5ac6ae[_0xd9dd('0x7f')]=intUtil[_0xd9dd('0x80')](_0x5ac6ae['host']);_0x5ac6ae[_0xd9dd('0x81')]=intUtil[_0xd9dd('0x80')](_0x5ac6ae['serverUrl']);if(_0x55466a&&_0x55466a[_0xd9dd('0x93')]&&_0x55466a[_0xd9dd('0x93')]!=='none'){logger[_0xd9dd('0x2f')](_0xd9dd('0x94'),_0xd9dd('0x83'));_0x57fdb4[_0xd9dd('0x84')]=_0x5ac6ae[_0xd9dd('0x81')]+_0xd9dd('0x85')+_0x57fdb4['uniqueid']+_0xd9dd('0x86')+md5(_0x57fdb4[_0xd9dd('0x87')]);}var _0x1a3125=_0x5ac6ae['host']===_0xd9dd('0x88')?'eu':_0xd9dd('0x89');return getAccessToken(_0x5ac6ae)[_0xd9dd('0x29')](function(_0x249105){_0x3b4814=_0x249105;return getUser(_0x3b4814,_0x1a3125,_0x5ac6ae,_0x449587[_0xd9dd('0x8a')]);})[_0xd9dd('0x29')](function(_0x53fea8){_0x59eda6=_0x53fea8;logger[_0xd9dd('0x2f')](_0xd9dd('0x8b'),_0x59eda6['id']);return getEndUser(_0x3b4814,_0x1a3125,_0x5ac6ae,_0x57fdb4[_0xd9dd('0x95')],_0x57fdb4['destcalleridnum'],_0x59eda6,_0x5c2dc8);})[_0xd9dd('0x29')](function(_0x589163){_0x2ac067=_0x589163;return getCall(_0x3b4814,_0x1a3125,_0x5ac6ae,_0x59eda6,_0x2ac067,_0x5c2dc8,_0x57fdb4,'Outbound');})['then'](function(_0x331460){if(_0x331460){logger[_0xd9dd('0x2f')]('The\x20Call\x20ID\x20is:',_0x331460['id']);logger[_0xd9dd('0x2f')](_0xd9dd('0x94'),_0xd9dd('0x96'));emit(util['format'](_0xd9dd('0x8f'),_0x449587[_0xd9dd('0x1a')]),_0xd9dd('0x90'),{'uri':'https://crm.'+_0x5ac6ae[_0xd9dd('0x7f')]+_0xd9dd('0x91')+_0x331460['id']});}})[_0xd9dd('0x2c')](function(_0xd0932a){logger[_0xd9dd('0x2d')](_0xd9dd('0x94'),JSON['stringify'](_0xd0932a));});};exports[_0xd9dd('0x97')]=function(_0x13f148,_0x3e1caf,_0x270f70,_0x65b9b7,_0x220fdc,_0x25b87c){var _0x512259,_0x316699,_0x3a7550;_0x25b87c[_0xd9dd('0x7f')]=intUtil['stripTrailingSlash'](_0x25b87c[_0xd9dd('0x7f')]);_0x25b87c['serverUrl']=intUtil[_0xd9dd('0x80')](_0x25b87c[_0xd9dd('0x81')]);if(_0x220fdc&&_0x220fdc['monitor_format']){logger[_0xd9dd('0x2f')]('['+_0x3e1caf[_0xd9dd('0x6a')]['toUpperCase']()+']',_0xd9dd('0x83'));_0x3e1caf['recordingURL']=_0x25b87c[_0xd9dd('0x81')]+_0xd9dd('0x85')+_0x3e1caf[_0xd9dd('0x87')]+_0xd9dd('0x86')+md5(_0x3e1caf[_0xd9dd('0x87')]);}else{_0x3e1caf[_0xd9dd('0x84')]='';}var _0x144456=_0x25b87c['host']===_0xd9dd('0x88')?'eu':_0xd9dd('0x89');return getAccessToken(_0x25b87c)[_0xd9dd('0x29')](function(_0x2474b0){_0x3a7550=_0x2474b0;return getUser(_0x3a7550,_0x144456,_0x25b87c);})[_0xd9dd('0x29')](function(_0x2ba05b){_0x512259=_0x2ba05b;logger[_0xd9dd('0x2f')](_0xd9dd('0x8b'),_0x512259['id']);return getEndUser(_0x3a7550,_0x144456,_0x25b87c,_0x3e1caf[_0xd9dd('0x8c')],_0x3e1caf[_0xd9dd('0x8d')],_0x512259,_0x270f70);})[_0xd9dd('0x29')](function(_0xe9aefc){_0x316699=_0xe9aefc;return getCall(_0x3a7550,_0x144456,_0x25b87c,_0x512259,_0x316699,_0x270f70,_0x3e1caf,_0xd9dd('0x78'));})[_0xd9dd('0x29')](function(_0x2baa2d){if(_0x2baa2d){logger[_0xd9dd('0x2f')](_0xd9dd('0x8e'),_0x2baa2d['id']);}})[_0xd9dd('0x2c')](function(_0x1c0b05){logger[_0xd9dd('0x2d')]('['+_0x3e1caf[_0xd9dd('0x6a')][_0xd9dd('0x98')]()+']',JSON[_0xd9dd('0xf')](_0x1c0b05));});}; \ 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 7d6b700..ea8d072 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 _0x8e13=['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','mustache','trigger','exec','data2','Script'];(function(_0x32e779,_0x1c2596){var _0x47d7b3=function(_0x37c2d8){while(--_0x37c2d8){_0x32e779['push'](_0x32e779['shift']());}};_0x47d7b3(++_0x1c2596);}(_0x8e13,0x88));var _0x38e1=function(_0xcac40,_0xc0c8c4){_0xcac40=_0xcac40-0x0;var _0x411d1b=_0x8e13[_0xcac40];return _0x411d1b;};'use strict';var util=require(_0x38e1('0x0'));var sh=require(_0x38e1('0x1'));var Mustache=require(_0x38e1('0x2'));var logger=require('../../../../config/logger')(_0x38e1('0x3'));exports[_0x38e1('0x4')]=function(_0x3ad199,_0x3bc4df){var _0x2490a8=_0x3ad199[_0x38e1('0x5')]?_0x3ad199['data2']:_0x38e1('0x6');var _0x782cbf=_0x3ad199['data3']?Mustache['render'](_0x3ad199[_0x38e1('0x7')],_0x3bc4df):_0x3bc4df;sh[_0x38e1('0x4')](_0x782cbf,function(_0x5a93d5,_0xf028b0,_0x10431e){if(_0x5a93d5!==0x0){logger[_0x38e1('0x8')](util[_0x38e1('0x9')](_0x38e1('0xa'),_0x2490a8,_0x782cbf,_0x5a93d5,_0x10431e));}else{logger[_0x38e1('0xb')](util[_0x38e1('0x9')](_0x38e1('0xc'),_0x2490a8,_0x782cbf,_0xf028b0));}});}; \ No newline at end of file +var _0xf0e6=['data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','Script'];(function(_0x389500,_0x55d66e){var _0x3fa9cc=function(_0x2e9966){while(--_0x2e9966){_0x389500['push'](_0x389500['shift']());}};_0x3fa9cc(++_0x55d66e);}(_0xf0e6,0x1a6));var _0x6f0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0e6[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6f0e('0x0'));var sh=require(_0x6f0e('0x1'));var Mustache=require(_0x6f0e('0x2'));var logger=require('../../../../config/logger')(_0x6f0e('0x3'));exports[_0x6f0e('0x4')]=function(_0xe54218,_0x361c06){var _0x4f0d19=_0xe54218[_0x6f0e('0x5')]?_0xe54218[_0x6f0e('0x5')]:_0x6f0e('0x6');var _0x3291fb=_0xe54218[_0x6f0e('0x7')]?Mustache[_0x6f0e('0x8')](_0xe54218['data3'],_0x361c06):_0x361c06;sh['exec'](_0x3291fb,function(_0xd4a207,_0x5717d6,_0x43f963){if(_0xd4a207!==0x0){logger[_0x6f0e('0x9')](util[_0x6f0e('0xa')](_0x6f0e('0xb'),_0x4f0d19,_0x3291fb,_0xd4a207,_0x43f963));}else{logger['info'](util[_0x6f0e('0xa')](_0x6f0e('0xc'),_0x4f0d19,_0x3291fb,_0x5717d6));}});}; \ 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 7d2a8b3..085c93c 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 _0x3244=['error','GET','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','headers','parse','data6'];(function(_0x4f3d9b,_0x321a3e){var _0x175ef2=function(_0x594c48){while(--_0x594c48){_0x4f3d9b['push'](_0x4f3d9b['shift']());}};_0x175ef2(++_0x321a3e);}(_0x3244,0xdb));var _0x4324=function(_0x3f8a27,_0x10f8b7){_0x3f8a27=_0x3f8a27-0x0;var _0x2b017b=_0x3244[_0x3f8a27];return _0x2b017b;};'use strict';var rp=require('request-promise');var util=require(_0x4324('0x0'));var _=require(_0x4324('0x1'));var Mustache=require('mustache');var logger=require(_0x4324('0x2'))('trigger');exports[_0x4324('0x3')]=function(_0x2df259,_0x56e42e){var _0x4104f4,_0x264341;var _0x5c0bf2={'method':_0x2df259[_0x4324('0x4')][_0x4324('0x5')](),'uri':Mustache[_0x4324('0x6')](_0x2df259[_0x4324('0x7')],_0x56e42e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2df259[_0x4324('0x8')])==='number'&&parseInt(_0x2df259[_0x4324('0x8')])>=0x1&&parseInt(_0x2df259[_0x4324('0x8')])<=0xa?parseInt(_0x2df259['data5'])*0x3e8:0x5*0x3e8};try{_0x5c0bf2[_0x4324('0x9')]=_0x2df259['data6']?JSON[_0x4324('0xa')](Mustache[_0x4324('0x6')](_0x2df259[_0x4324('0xb')],_0x56e42e)):{};}catch(_0x416166){logger[_0x4324('0xc')](_0x416166['stack']);}switch(_0x2df259['data1'][_0x4324('0x5')]()){case _0x4324('0xd'):case'DELETE':_0x4104f4=null;_0x5c0bf2['qs']=_0x56e42e;break;case _0x4324('0xe'):case _0x4324('0xf'):if(_0x2df259[_0x4324('0x10')]){try{_0x4104f4=JSON['parse'](Mustache[_0x4324('0x6')](_0x2df259[_0x4324('0x10')],_0x56e42e));_0x5c0bf2[_0x4324('0x11')]=_0x4104f4;}catch(_0x38022b){logger[_0x4324('0xc')](_0x38022b[_0x4324('0x12')]);logger['error'](_0x4324('0x13'));}}else{_0x4104f4=_0x56e42e;_0x5c0bf2['body']=_0x4104f4;}break;}logger[_0x4324('0x14')](util[_0x4324('0x15')](_0x4324('0x16'),_0x2df259[_0x4324('0x4')],_0x2df259[_0x4324('0x7')],JSON[_0x4324('0x17')](_0x5c0bf2)));rp(_0x5c0bf2)[_0x4324('0x18')](function(_0x1ef6d6){_0x4104f4=!_['isNil'](_0x4104f4)?_0x4324('0x19')+_0x4104f4:'';_0x264341=typeof _0x1ef6d6['body']===_0x4324('0x1a')?JSON['stringify'](_0x1ef6d6[_0x4324('0x11')]):_0x1ef6d6[_0x4324('0x11')];logger[_0x4324('0x14')](util[_0x4324('0x15')](_0x4324('0x1b'),_0x2df259[_0x4324('0x4')],_0x2df259[_0x4324('0x7')],_0x1ef6d6[_0x4324('0x1c')],_0x264341));})[_0x4324('0x1d')](function(_0x2e787a){logger[_0x4324('0xc')](util[_0x4324('0x15')](_0x4324('0x1e'),_0x2df259[_0x4324('0x4')],_0x2df259[_0x4324('0x7')],_0x2e787a['statusCode'],_0x2e787a[_0x4324('0x1f')],_0x2e787a[_0x4324('0x20')]));});}; \ No newline at end of file +var _0x50f6=['toUpperCase','GET','PUT','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify','then','isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','mustache','render','data2','number','data5','headers','parse','data6','error','stack','data1'];(function(_0x46c5d3,_0x591ff9){var _0x280fc2=function(_0x5e7d2c){while(--_0x5e7d2c){_0x46c5d3['push'](_0x46c5d3['shift']());}};_0x280fc2(++_0x591ff9);}(_0x50f6,0x89));var _0x650f=function(_0xcffcbe,_0x143d81){_0xcffcbe=_0xcffcbe-0x0;var _0x447d0d=_0x50f6[_0xcffcbe];return _0x447d0d;};'use strict';var rp=require(_0x650f('0x0'));var util=require(_0x650f('0x1'));var _=require('lodash');var Mustache=require(_0x650f('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x47ba84,_0x4a1ea7){var _0x222e77,_0x3fa5e4;var _0x32ad47={'method':_0x47ba84['data1']['toUpperCase'](),'uri':Mustache[_0x650f('0x3')](_0x47ba84[_0x650f('0x4')],_0x4a1ea7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x47ba84['data5'])===_0x650f('0x5')&&parseInt(_0x47ba84[_0x650f('0x6')])>=0x1&&parseInt(_0x47ba84[_0x650f('0x6')])<=0xa?parseInt(_0x47ba84[_0x650f('0x6')])*0x3e8:0x5*0x3e8};try{_0x32ad47[_0x650f('0x7')]=_0x47ba84['data6']?JSON[_0x650f('0x8')](Mustache[_0x650f('0x3')](_0x47ba84[_0x650f('0x9')],_0x4a1ea7)):{};}catch(_0x27b41d){logger[_0x650f('0xa')](_0x27b41d[_0x650f('0xb')]);}switch(_0x47ba84[_0x650f('0xc')][_0x650f('0xd')]()){case _0x650f('0xe'):case'DELETE':_0x222e77=null;_0x32ad47['qs']=_0x4a1ea7;break;case'POST':case _0x650f('0xf'):if(_0x47ba84['data7']){try{_0x222e77=JSON['parse'](Mustache['render'](_0x47ba84['data7'],_0x4a1ea7));_0x32ad47[_0x650f('0x10')]=_0x222e77;}catch(_0x312a0f){logger[_0x650f('0xa')](_0x312a0f[_0x650f('0xb')]);logger[_0x650f('0xa')](_0x650f('0x11'));}}else{_0x222e77=_0x4a1ea7;_0x32ad47[_0x650f('0x10')]=_0x222e77;}break;}logger[_0x650f('0x12')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x47ba84['data1'],_0x47ba84['data2'],JSON[_0x650f('0x13')](_0x32ad47)));rp(_0x32ad47)[_0x650f('0x14')](function(_0x7a9593){_0x222e77=!_[_0x650f('0x15')](_0x222e77)?_0x650f('0x16')+_0x222e77:'';_0x3fa5e4=typeof _0x7a9593[_0x650f('0x10')]===_0x650f('0x17')?JSON[_0x650f('0x13')](_0x7a9593[_0x650f('0x10')]):_0x7a9593[_0x650f('0x10')];logger['info'](util[_0x650f('0x18')](_0x650f('0x19'),_0x47ba84[_0x650f('0xc')],_0x47ba84[_0x650f('0x4')],_0x7a9593['statusCode'],_0x3fa5e4));})['catch'](function(_0x3da51d){logger[_0x650f('0xa')](util[_0x650f('0x18')](_0x650f('0x1a'),_0x47ba84[_0x650f('0xc')],_0x47ba84['data2'],_0x3da51d[_0x650f('0x1b')],_0x3da51d[_0x650f('0x1c')],_0x3da51d[_0x650f('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 6257115..20a3af8 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 _0x210c=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','rpc','error','message','result'];(function(_0x39afbe,_0x5b50c9){var _0x24311d=function(_0x295280){while(--_0x295280){_0x39afbe['push'](_0x39afbe['shift']());}};_0x24311d(++_0x5b50c9);}(_0x210c,0xf0));var _0xc210=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0x210c[_0x4a9beb];return _0x2d4c58;};'use strict';var jayson=require(_0xc210('0x0'));var BPromise=require(_0xc210('0x1'));var logger=require(_0xc210('0x2'))(_0xc210('0x3'));var client=jayson[_0xc210('0x4')][_0xc210('0x5')]({'port':0x2329});client[_0xc210('0x6')]=function(_0x2f8223,_0x5a882b){return new BPromise(function(_0x128db3,_0x4fa6b6){return client[_0xc210('0x7')](_0x2f8223,_0x5a882b)['then'](function(_0x2f71d1){logger['debug'](_0xc210('0x8'),_0xc210('0x3'),_0x2f8223,_0x5a882b,_0x2f71d1);if(_0x2f71d1['error']){logger[_0xc210('0x9')](_0xc210('0x8'),_0xc210('0x3'),_0x2f8223,_0x2f71d1['error']['message'],_0x5a882b);return _0x4fa6b6(_0x2f71d1[_0xc210('0x9')][_0xc210('0xa')]);}else{return _0x128db3(_0x2f71d1[_0xc210('0xb')]);}})[_0xc210('0xc')](function(_0x2adf1b){logger['error'](_0xc210('0x8'),'routing',_0x2f8223,_0x2adf1b,_0x5a882b);return _0x4fa6b6(_0x2adf1b);});});};module[_0xc210('0xd')]=client; \ No newline at end of file +var _0x44d0=['request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x44d0,0x1c9));var _0x044d=function(_0x18675e,_0x4ae5e8){_0x18675e=_0x18675e-0x0;var _0x306559=_0x44d0[_0x18675e];return _0x306559;};'use strict';var jayson=require(_0x044d('0x0'));var BPromise=require(_0x044d('0x1'));var logger=require(_0x044d('0x2'))(_0x044d('0x3'));var client=jayson[_0x044d('0x4')][_0x044d('0x5')]({'port':0x2329});client[_0x044d('0x6')]=function(_0xa40f91,_0x4aca82){return new BPromise(function(_0x4a6f4a,_0x521a97){return client[_0x044d('0x7')](_0xa40f91,_0x4aca82)[_0x044d('0x8')](function(_0x1213ac){logger[_0x044d('0x9')](_0x044d('0xa'),'routing',_0xa40f91,_0x4aca82,_0x1213ac);if(_0x1213ac[_0x044d('0xb')]){logger[_0x044d('0xb')](_0x044d('0xa'),'routing',_0xa40f91,_0x1213ac[_0x044d('0xb')][_0x044d('0xc')],_0x4aca82);return _0x521a97(_0x1213ac['error'][_0x044d('0xc')]);}else{return _0x4a6f4a(_0x1213ac[_0x044d('0xd')]);}})[_0x044d('0xe')](function(_0x4c1ed9){logger[_0x044d('0xb')](_0x044d('0xa'),_0x044d('0x3'),_0xa40f91,_0x4c1ed9,_0x4aca82);return _0x521a97(_0x4c1ed9);});});};module[_0x044d('0xf')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 16eb78e..1cfbb20 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 _0xe430=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts'];(function(_0x3ee51d,_0x51cf1f){var _0x5524f9=function(_0xbbcd9){while(--_0xbbcd9){_0x3ee51d['push'](_0x3ee51d['shift']());}};_0x5524f9(++_0x51cf1f);}(_0xe430,0x128));var _0x0e43=function(_0x4d7df9,_0x51dae1){_0x4d7df9=_0x4d7df9-0x0;var _0x2b9291=_0xe430[_0x4d7df9];return _0x2b9291;};'use strict';var server=require(_0x0e43('0x0'));var Realtime=require(_0x0e43('0x1'));var EmailChannel=require(_0x0e43('0x2'));var mailAccount=require(_0x0e43('0x3'));var setting=require(_0x0e43('0x4'));var logger=require(_0x0e43('0x5'))(_0x0e43('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x0e43('0x7')](mailAccount[_0x0e43('0x8')]())['then'](realtime[_0x0e43('0x9')]())[_0x0e43('0x7')](function(){email[_0x0e43('0xa')](realtime[_0x0e43('0xb')]);return realtime;});}function main(){return server[_0x0e43('0xc')](realtime,email)[_0x0e43('0x7')](function(){return initRealtime();})[_0x0e43('0x7')](function(){return setting[_0x0e43('0xd')]();})[_0x0e43('0x7')](function(_0x2c7932){return setInterval(initRealtime,_0x2c7932[_0x0e43('0xe')]*0x3e8);})['catch'](function(_0x95d903){logger[_0x0e43('0xf')](_0x0e43('0x10'),_0x95d903);});}main(); \ No newline at end of file +var _0x92d2=['./rpc/mailAccount','../../config/logger','email','resolve','then','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x92d2,0xb3));var _0x292d=function(_0x134c96,_0xf5e3a4){_0x134c96=_0x134c96-0x0;var _0x3990c8=_0x92d2[_0x134c96];return _0x3990c8;};'use strict';var server=require(_0x292d('0x0'));var Realtime=require(_0x292d('0x1'));var EmailChannel=require(_0x292d('0x2'));var mailAccount=require(_0x292d('0x3'));var setting=require('./rpc/setting');var logger=require(_0x292d('0x4'))(_0x292d('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x292d('0x6')]()[_0x292d('0x7')](mailAccount['getMailAccounts']())[_0x292d('0x7')](realtime['initMailAccounts']())[_0x292d('0x7')](function(){email['refresh'](realtime[_0x292d('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x292d('0x7')](function(){return initRealtime();})[_0x292d('0x7')](function(){return setting[_0x292d('0x9')]();})[_0x292d('0x7')](function(_0x4b653e){return setInterval(initRealtime,_0x4b653e[_0x292d('0xa')]*0x3e8);})[_0x292d('0xb')](function(_0x179bff){logger[_0x292d('0xc')](_0x292d('0xd'),_0x179bff);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ea7c9dd..2b75823 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 _0x27d4=['lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','then','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','prototype','Imap','messageStatus','total','stringify','emit','mailAccount:update','hasOwnProperty','active','provider','custom','service','imapAccounts','email','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','isNil','disabled','status','connected','messages','info','firstName'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0x27d4,0xf1));var _0x427d=function(_0x1751fb,_0x3f7254){_0x1751fb=_0x1751fb-0x0;var _0x508c24=_0x27d4[_0x1751fb];return _0x508c24;};'use strict';var _=require(_0x427d('0x0'));var moment=require(_0x427d('0x1'));var BPromise=require('bluebird');var md5=require(_0x427d('0x2'));var Redis=require(_0x427d('0x3'));var config=require(_0x427d('0x4'));var logger=require(_0x427d('0x5'))('email');config[_0x427d('0x6')]=_[_0x427d('0x7')](config['redis'],{'host':_0x427d('0x8'),'port':0x18eb});var io=require(_0x427d('0x9'))(new Redis(config[_0x427d('0x6')]));var EmailImap=require(_0x427d('0xa'));var EmailSmtp=require(_0x427d('0xb'));var mailAccount=require(_0x427d('0xc'));var md5Accounts={};function EmailChannel(_0x19b3de){logger['info'](_0x427d('0xd'));this[_0x427d('0xe')]=_0x19b3de[_0x427d('0xe')];this['imapAccounts']={};this[_0x427d('0xf')]=new EmailSmtp();}EmailChannel[_0x427d('0x10')]['emit']=function(_0x9179f5){var _0x448f7c=this['mailAccounts'][_0x9179f5];var _0x2c40f6={'id':_0x448f7c['id'],'name':_0x448f7c['name'],'key':_0x448f7c['key'],'active':_0x448f7c['active'],'Imap':{'status':_0x448f7c[_0x427d('0x11')]['status'],'messageStatus':_0x448f7c[_0x427d('0x11')][_0x427d('0x12')],'total':_0x448f7c[_0x427d('0x11')][_0x427d('0x13')]}};if(_['isNil'](md5Accounts[_0x9179f5])){md5Accounts[_0x9179f5]={};}var _0xfe660=md5(JSON[_0x427d('0x14')](_0x2c40f6));if(md5Accounts[_0x9179f5][_0x427d('0x2')]!==_0xfe660){md5Accounts[_0x9179f5]['md5']=_0xfe660;io[_0x427d('0x15')](_0x427d('0x16'),_0x2c40f6);}};EmailChannel[_0x427d('0x10')]['refresh']=function(_0x30acc7){for(var _0x8573aa in _0x30acc7){if(_0x30acc7[_0x427d('0x17')](_0x8573aa)){if(_0x30acc7[_0x8573aa][_0x427d('0x11')]&&_0x30acc7[_0x8573aa][_0x427d('0x18')]){var _0x3313c1=_0x30acc7[_0x8573aa][_0x427d('0x11')];if(!_0x3313c1['service']&&_0x30acc7[_0x8573aa][_0x427d('0x19')]!==_0x427d('0x1a'))_0x3313c1[_0x427d('0x1b')]=_0x30acc7[_0x8573aa][_0x427d('0x19')];if(!this[_0x427d('0x1c')][_0x427d('0x17')](_0x3313c1['id'])){this['imapAccounts'][_0x3313c1['id']]=new EmailImap(_0x3313c1,_0x30acc7[_0x8573aa][_0x427d('0x1d')]);this['imapAccounts'][_0x3313c1['id']]['on']('box',this[_0x427d('0x1e')]['bind'](this,_0x8573aa));this[_0x427d('0x1c')][_0x3313c1['id']]['on'](_0x427d('0x1d'),this[_0x427d('0x1f')]['bind'](this,_0x8573aa));this[_0x427d('0x1c')][_0x3313c1['id']]['on'](_0x427d('0x20'),this[_0x427d('0x21')][_0x427d('0x22')](this,_0x8573aa));this['imapAccounts'][_0x3313c1['id']]['on'](_0x427d('0x23'),this[_0x427d('0x24')][_0x427d('0x22')](this,_0x8573aa));}}else{if(_[_0x427d('0x25')](this[_0x427d('0xe')][_0x8573aa][_0x427d('0x11')])){this[_0x427d('0xe')][_0x8573aa]['Imap']={};}this[_0x427d('0xe')][_0x8573aa][_0x427d('0x11')]['status']=_0x427d('0x26');this[_0x427d('0xe')][_0x8573aa][_0x427d('0x11')][_0x427d('0x12')]='';this[_0x427d('0x15')](_0x8573aa);}}}};EmailChannel[_0x427d('0x10')]['handleImapBox']=function(_0x42dff2,_0x28f0d2){if(this[_0x427d('0xe')][_0x42dff2]){this['mailAccounts'][_0x42dff2][_0x427d('0x11')][_0x427d('0x27')]=_0x427d('0x28');this[_0x427d('0xe')][_0x42dff2][_0x427d('0x11')][_0x427d('0x12')]=_0x28f0d2['name'];if(_0x28f0d2[_0x427d('0x29')]){this['mailAccounts'][_0x42dff2][_0x427d('0x11')][_0x427d('0x13')]=_0x28f0d2[_0x427d('0x29')][_0x427d('0x13')];}return this['emit'](_0x42dff2);}};EmailChannel['prototype']['handleImapEmail']=function(_0x5a2ea2,_0x10a708){logger[_0x427d('0x2a')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x10a708[_0x427d('0x2b')],_0x10a708[_0x427d('0x2c')],_0x10a708[_0x427d('0x2d')],_0x5a2ea2);if(this['mailAccounts'][_0x5a2ea2]){return mailAccount[_0x427d('0x2e')](_0x5a2ea2,_0x10a708)['then'](function(_0x2e5a9f){if(_0x2e5a9f){logger['info'](_0x427d('0x2f'));}})[_0x427d('0x30')](function(_0x4d1896){logger[_0x427d('0x23')](_0x427d('0x31'),JSON['stringify'](_0x4d1896));});}};EmailChannel['prototype'][_0x427d('0x21')]=function(_0x4b0c29){if(this[_0x427d('0xe')][_0x4b0c29]&&this['mailAccounts'][_0x4b0c29][_0x427d('0x11')]){if(this[_0x427d('0x1c')][this[_0x427d('0xe')][_0x4b0c29][_0x427d('0x11')]['id']]){delete this[_0x427d('0x1c')][this[_0x427d('0xe')][_0x4b0c29][_0x427d('0x11')]['id']];}this['mailAccounts'][_0x4b0c29][_0x427d('0x11')][_0x427d('0x32')]=moment();this[_0x427d('0x15')](_0x4b0c29);}};EmailChannel[_0x427d('0x10')][_0x427d('0x24')]=function(_0x1088ec,_0xee3ca7){if(this[_0x427d('0xe')][_0x1088ec]){this[_0x427d('0xe')][_0x1088ec][_0x427d('0x11')]['status']=_0x427d('0x23');this[_0x427d('0xe')][_0x1088ec][_0x427d('0x11')][_0x427d('0x12')]=_0xee3ca7;return this[_0x427d('0x15')](_0x1088ec);}};EmailChannel[_0x427d('0x10')]['sendMail']=function(_0x45ab26,_0xc224f5){return this['smtp'][_0x427d('0x33')](_0x45ab26,_0xc224f5);};EmailChannel[_0x427d('0x10')][_0x427d('0x34')]=function(_0x14ef35){var _0x14f51c=this;if(this[_0x427d('0xe')][_0x14ef35['id']]){if(_[_0x427d('0x25')](this['mailAccounts'][_0x14ef35['id']]['Smtp'])){this['mailAccounts'][_0x14ef35['id']][_0x427d('0x35')]={};}this['mailAccounts'][_0x14ef35['id']][_0x427d('0x35')]['lastSync']=moment();return new BPromise(function(_0x2efe14,_0x20e82d){return _0x14f51c[_0x427d('0xf')][_0x427d('0x36')](_0x14ef35)[_0x427d('0x37')](function(_0x229022){_0x14f51c['mailAccounts'][_0x14ef35['id']][_0x427d('0x35')][_0x427d('0x27')]='verified';_0x14f51c[_0x427d('0xe')][_0x14ef35['id']]['Smtp'][_0x427d('0x12')]='';_0x14f51c[_0x427d('0x15')](_0x14ef35['id']);_0x2efe14(_0x229022);})['catch'](function(_0x5ae086){_0x14f51c[_0x427d('0xe')][_0x14ef35['id']][_0x427d('0x35')][_0x427d('0x27')]='error';_0x14f51c[_0x427d('0xe')][_0x14ef35['id']][_0x427d('0x35')][_0x427d('0x12')]=_0x5ae086;_0x14f51c[_0x427d('0x15')](_0x14ef35['id']);_0x20e82d(_0x5ae086);});});}return this[_0x427d('0xf')]['verify'](_0x14ef35);};module[_0x427d('0x38')]=EmailChannel; \ No newline at end of file +var _0x30aa=['name','Imap','messageStatus','total','isNil','mailAccount:update','hasOwnProperty','active','service','provider','custom','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','lastSync','verify','exports','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit'];(function(_0xb8b43f,_0x32f81f){var _0x1f9efa=function(_0x4b4bac){while(--_0x4b4bac){_0xb8b43f['push'](_0xb8b43f['shift']());}};_0x1f9efa(++_0x32f81f);}(_0x30aa,0x10b));var _0xa30a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x30aa[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var moment=require(_0xa30a('0x0'));var BPromise=require(_0xa30a('0x1'));var md5=require(_0xa30a('0x2'));var Redis=require('ioredis');var config=require(_0xa30a('0x3'));var logger=require(_0xa30a('0x4'))(_0xa30a('0x5'));config[_0xa30a('0x6')]=_[_0xa30a('0x7')](config[_0xa30a('0x6')],{'host':_0xa30a('0x8'),'port':0x18eb});var io=require(_0xa30a('0x9'))(new Redis(config[_0xa30a('0x6')]));var EmailImap=require(_0xa30a('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xa30a('0xb'));var md5Accounts={};function EmailChannel(_0xd948bf){logger[_0xa30a('0xc')]('start\x20email\x20channel');this[_0xa30a('0xd')]=_0xd948bf['mailAccounts'];this[_0xa30a('0xe')]={};this[_0xa30a('0xf')]=new EmailSmtp();}EmailChannel[_0xa30a('0x10')][_0xa30a('0x11')]=function(_0x38c5c8){var _0x39a6ab=this[_0xa30a('0xd')][_0x38c5c8];var _0x4aa572={'id':_0x39a6ab['id'],'name':_0x39a6ab[_0xa30a('0x12')],'key':_0x39a6ab['key'],'active':_0x39a6ab['active'],'Imap':{'status':_0x39a6ab[_0xa30a('0x13')]['status'],'messageStatus':_0x39a6ab[_0xa30a('0x13')][_0xa30a('0x14')],'total':_0x39a6ab[_0xa30a('0x13')][_0xa30a('0x15')]}};if(_[_0xa30a('0x16')](md5Accounts[_0x38c5c8])){md5Accounts[_0x38c5c8]={};}var _0x4eab01=md5(JSON['stringify'](_0x4aa572));if(md5Accounts[_0x38c5c8][_0xa30a('0x2')]!==_0x4eab01){md5Accounts[_0x38c5c8][_0xa30a('0x2')]=_0x4eab01;io[_0xa30a('0x11')](_0xa30a('0x17'),_0x4aa572);}};EmailChannel[_0xa30a('0x10')]['refresh']=function(_0x49ee2b){for(var _0x9deae3 in _0x49ee2b){if(_0x49ee2b[_0xa30a('0x18')](_0x9deae3)){if(_0x49ee2b[_0x9deae3][_0xa30a('0x13')]&&_0x49ee2b[_0x9deae3][_0xa30a('0x19')]){var _0x42cd00=_0x49ee2b[_0x9deae3][_0xa30a('0x13')];if(!_0x42cd00[_0xa30a('0x1a')]&&_0x49ee2b[_0x9deae3][_0xa30a('0x1b')]!==_0xa30a('0x1c'))_0x42cd00[_0xa30a('0x1a')]=_0x49ee2b[_0x9deae3][_0xa30a('0x1b')];if(!this[_0xa30a('0xe')][_0xa30a('0x18')](_0x42cd00['id'])){this[_0xa30a('0xe')][_0x42cd00['id']]=new EmailImap(_0x42cd00,_0x49ee2b[_0x9deae3][_0xa30a('0x5')]);this['imapAccounts'][_0x42cd00['id']]['on'](_0xa30a('0x1d'),this['handleImapBox'][_0xa30a('0x1e')](this,_0x9deae3));this['imapAccounts'][_0x42cd00['id']]['on'](_0xa30a('0x5'),this[_0xa30a('0x1f')][_0xa30a('0x1e')](this,_0x9deae3));this[_0xa30a('0xe')][_0x42cd00['id']]['on'](_0xa30a('0x20'),this[_0xa30a('0x21')][_0xa30a('0x1e')](this,_0x9deae3));this[_0xa30a('0xe')][_0x42cd00['id']]['on'](_0xa30a('0x22'),this[_0xa30a('0x23')][_0xa30a('0x1e')](this,_0x9deae3));}}else{if(_[_0xa30a('0x16')](this[_0xa30a('0xd')][_0x9deae3][_0xa30a('0x13')])){this[_0xa30a('0xd')][_0x9deae3]['Imap']={};}this['mailAccounts'][_0x9deae3][_0xa30a('0x13')][_0xa30a('0x24')]=_0xa30a('0x25');this[_0xa30a('0xd')][_0x9deae3]['Imap']['messageStatus']='';this[_0xa30a('0x11')](_0x9deae3);}}}};EmailChannel[_0xa30a('0x10')][_0xa30a('0x26')]=function(_0x58a22d,_0x2cb3cd){if(this[_0xa30a('0xd')][_0x58a22d]){this['mailAccounts'][_0x58a22d][_0xa30a('0x13')][_0xa30a('0x24')]=_0xa30a('0x27');this['mailAccounts'][_0x58a22d]['Imap']['messageStatus']=_0x2cb3cd[_0xa30a('0x12')];if(_0x2cb3cd[_0xa30a('0x28')]){this[_0xa30a('0xd')][_0x58a22d][_0xa30a('0x13')][_0xa30a('0x15')]=_0x2cb3cd[_0xa30a('0x28')][_0xa30a('0x15')];}return this[_0xa30a('0x11')](_0x58a22d);}};EmailChannel[_0xa30a('0x10')][_0xa30a('0x1f')]=function(_0x4d6f2d,_0x3d8077){logger[_0xa30a('0xc')](_0xa30a('0x29'),_0x3d8077[_0xa30a('0x2a')],_0x3d8077[_0xa30a('0x2b')],_0x3d8077[_0xa30a('0x2c')],_0x4d6f2d);if(this[_0xa30a('0xd')][_0x4d6f2d]){return mailAccount['notify'](_0x4d6f2d,_0x3d8077)[_0xa30a('0x2d')](function(_0x1a8f41){if(_0x1a8f41){logger[_0xa30a('0xc')](_0xa30a('0x2e'));}})[_0xa30a('0x2f')](function(_0x589840){logger[_0xa30a('0x22')](_0xa30a('0x30'),JSON[_0xa30a('0x31')](_0x589840));});}};EmailChannel[_0xa30a('0x10')]['handleImapEnd']=function(_0x5eeded){if(this[_0xa30a('0xd')][_0x5eeded]&&this['mailAccounts'][_0x5eeded][_0xa30a('0x13')]){if(this[_0xa30a('0xe')][this[_0xa30a('0xd')][_0x5eeded][_0xa30a('0x13')]['id']]){delete this[_0xa30a('0xe')][this[_0xa30a('0xd')][_0x5eeded][_0xa30a('0x13')]['id']];}this[_0xa30a('0xd')][_0x5eeded][_0xa30a('0x13')]['lastSync']=moment();this[_0xa30a('0x11')](_0x5eeded);}};EmailChannel['prototype']['handleImapError']=function(_0x5af2a6,_0x38a167){if(this[_0xa30a('0xd')][_0x5af2a6]){this['mailAccounts'][_0x5af2a6][_0xa30a('0x13')][_0xa30a('0x24')]=_0xa30a('0x22');this[_0xa30a('0xd')][_0x5af2a6][_0xa30a('0x13')]['messageStatus']=_0x38a167;return this[_0xa30a('0x11')](_0x5af2a6);}};EmailChannel[_0xa30a('0x10')][_0xa30a('0x32')]=function(_0x5815b5,_0x244f51){return this['smtp'][_0xa30a('0x33')](_0x5815b5,_0x244f51);};EmailChannel['prototype'][_0xa30a('0x34')]=function(_0x58ffa5){var _0x1223b2=this;if(this['mailAccounts'][_0x58ffa5['id']]){if(_[_0xa30a('0x16')](this[_0xa30a('0xd')][_0x58ffa5['id']][_0xa30a('0x35')])){this[_0xa30a('0xd')][_0x58ffa5['id']]['Smtp']={};}this[_0xa30a('0xd')][_0x58ffa5['id']][_0xa30a('0x35')][_0xa30a('0x36')]=moment();return new BPromise(function(_0x52bafa,_0x54e106){return _0x1223b2[_0xa30a('0xf')][_0xa30a('0x37')](_0x58ffa5)[_0xa30a('0x2d')](function(_0x18345b){_0x1223b2[_0xa30a('0xd')][_0x58ffa5['id']]['Smtp'][_0xa30a('0x24')]='verified';_0x1223b2[_0xa30a('0xd')][_0x58ffa5['id']][_0xa30a('0x35')]['messageStatus']='';_0x1223b2[_0xa30a('0x11')](_0x58ffa5['id']);_0x52bafa(_0x18345b);})[_0xa30a('0x2f')](function(_0x30ce0b){_0x1223b2[_0xa30a('0xd')][_0x58ffa5['id']][_0xa30a('0x35')][_0xa30a('0x24')]=_0xa30a('0x22');_0x1223b2['mailAccounts'][_0x58ffa5['id']][_0xa30a('0x35')][_0xa30a('0x14')]=_0x30ce0b;_0x1223b2[_0xa30a('0x11')](_0x58ffa5['id']);_0x54e106(_0x30ce0b);});});}return this[_0xa30a('0xf')]['verify'](_0x58ffa5);};module[_0xa30a('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 741eb51..7955baa 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 _0xc1d8=['handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','length','fetch','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','account','once','ready','handleReady','end','bind','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox'];(function(_0x3961e5,_0x48475a){var _0x4096d0=function(_0x2a85c6){while(--_0x2a85c6){_0x3961e5['push'](_0x3961e5['shift']());}};_0x4096d0(++_0x48475a);}(_0xc1d8,0x115));var _0x8c1d=function(_0x5c5a90,_0x524356){_0x5c5a90=_0x5c5a90-0x0;var _0x56a378=_0xc1d8[_0x5c5a90];return _0x56a378;};'use strict';var _=require(_0x8c1d('0x0'));var util=require('util');var Imap=require(_0x8c1d('0x1'));var simpleParser=require(_0x8c1d('0x2'))[_0x8c1d('0x3')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x8c1d('0x4'))[_0x8c1d('0x5')];var utils=require(_0x8c1d('0x6'));var logger=require(_0x8c1d('0x7'))(_0x8c1d('0x8'));function EmailImap(_0x5a5631,_0x3be94d){this[_0x8c1d('0x9')]=_0x5a5631[_0x8c1d('0x9')];this['account']=this[_0x8c1d('0xa')](_0x5a5631,_0x3be94d);this[_0x8c1d('0x1')]=new Imap(this[_0x8c1d('0xb')]);this['imap'][_0x8c1d('0xc')](_0x8c1d('0xd'),this[_0x8c1d('0xe')]['bind'](this));this[_0x8c1d('0x1')][_0x8c1d('0xc')](_0x8c1d('0xf'),this['handleEnd'][_0x8c1d('0x10')](this));this[_0x8c1d('0x1')]['on'](_0x8c1d('0x11'),this[_0x8c1d('0x12')][_0x8c1d('0x10')](this));this['imap']['connect']();}util[_0x8c1d('0x13')](EmailImap,EventEmitter);EmailImap[_0x8c1d('0x14')]['getAccount']=function(_0x4c3a77,_0x5ddecb){var _0x49cb0a={'connTimeout':_0x4c3a77[_0x8c1d('0x15')]?_0x4c3a77[_0x8c1d('0x15')]*0x3e8:0x2710,'authTimeout':_0x4c3a77[_0x8c1d('0x16')]?_0x4c3a77[_0x8c1d('0x16')]*0x3e8:0x1388};if(_0x4c3a77[_0x8c1d('0x17')]){_0x49cb0a['user']=_0x4c3a77[_0x8c1d('0x18')];if(_0x4c3a77['modernAuthentication']){_0x49cb0a[_0x8c1d('0x19')]=utils[_0x8c1d('0x1a')](_0x4c3a77[_0x8c1d('0x1b')][_0x8c1d('0x1c')],_0x4c3a77['user']);}else{_0x49cb0a[_0x8c1d('0x1d')]=_0x4c3a77[_0x8c1d('0x1d')];}}else{if(_0x4c3a77[_0x8c1d('0x1e')]){_0x49cb0a['user']=_0x4c3a77[_0x8c1d('0x18')];_0x49cb0a['password']=_0x4c3a77[_0x8c1d('0x1d')];}}_0x49cb0a['email']=_0x5ddecb||_0x4c3a77[_0x8c1d('0x18')]||_0x8c1d('0x1f');_0x49cb0a[_0x8c1d('0x20')]=_0x4c3a77[_0x8c1d('0x20')];_0x49cb0a['port']=_0x4c3a77[_0x8c1d('0x21')]||0x3e1;if(_0x4c3a77[_0x8c1d('0x22')]){_0x49cb0a[_0x8c1d('0x22')]=!![];}else{_0x49cb0a[_0x8c1d('0x22')]=![];_0x49cb0a[_0x8c1d('0x23')]=_0x8c1d('0x24');}return _0x49cb0a;};EmailImap[_0x8c1d('0x14')][_0x8c1d('0xe')]=function(){this[_0x8c1d('0x1')][_0x8c1d('0x25')](this[_0x8c1d('0x9')],![],this[_0x8c1d('0x26')][_0x8c1d('0x10')](this));};EmailImap['prototype'][_0x8c1d('0x26')]=function(_0x23e3ee,_0x580ab4){if(_0x23e3ee){this[_0x8c1d('0x12')](_0x23e3ee,!![]);}else{this[_0x8c1d('0x27')](_0x8c1d('0x28'),_0x580ab4);this[_0x8c1d('0x29')]();}};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x2a')]=function(_0x492d17){if(_0x492d17){this[_0x8c1d('0x12')](_0x492d17,!![]);}else{this[_0x8c1d('0x1')][_0x8c1d('0xf')]();}};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x29')]=function(){this['imap'][_0x8c1d('0x2b')]([_0x8c1d('0x2c')],this['handleReadUnseen'][_0x8c1d('0x10')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x64b5e6,_0x28420b){if(_0x64b5e6){this[_0x8c1d('0x12')](_0x64b5e6,!![]);}else{if(_0x28420b[_0x8c1d('0x2d')]){try{var _0x4407e7=this[_0x8c1d('0x1')][_0x8c1d('0x2e')](_0x28420b,{'bodies':'','markSeen':!![]});_0x4407e7['on']('message',this[_0x8c1d('0x2f')][_0x8c1d('0x10')](this));_0x4407e7['once']('error',this[_0x8c1d('0x30')][_0x8c1d('0x10')](this));_0x4407e7['once'](_0x8c1d('0xf'),this['handleFetchEnd'][_0x8c1d('0x10')](this));}catch(_0x210c35){logger[_0x8c1d('0x11')](_0x210c35);}}else{this[_0x8c1d('0x1')][_0x8c1d('0x31')](!![],this[_0x8c1d('0x2a')][_0x8c1d('0x10')](this));}}};EmailImap['prototype'][_0x8c1d('0x2f')]=function(_0x33e5b3){_0x33e5b3['on'](_0x8c1d('0x32'),this[_0x8c1d('0x33')][_0x8c1d('0x10')](this));_0x33e5b3[_0x8c1d('0xc')]('attributes',this[_0x8c1d('0x34')][_0x8c1d('0x10')](this));_0x33e5b3[_0x8c1d('0xc')](_0x8c1d('0xf'),this[_0x8c1d('0x35')][_0x8c1d('0x10')](this));};EmailImap[_0x8c1d('0x14')]['handleMessageBody']=function(_0x4343b6){simpleParser(_0x4343b6,{'Iconv':Iconv},this[_0x8c1d('0x36')][_0x8c1d('0x10')](this));};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x34')]=function(){};EmailImap['prototype'][_0x8c1d('0x35')]=function(){};EmailImap['prototype'][_0x8c1d('0x36')]=function(_0x1e3465,_0x2efe59){if(_0x1e3465){logger['error'](_0x1e3465);}else{var _0x464407=this;utils[_0x8c1d('0x37')](this[_0x8c1d('0xb')],_0x2efe59,function(_0xb15723){_0x464407['emit'](_0x8c1d('0x8'),_0xb15723);});}};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x38')]=function(){this['imap'][_0x8c1d('0x31')](!![],this[_0x8c1d('0x2a')][_0x8c1d('0x10')](this));};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x30')]=function(_0x5a624b){this[_0x8c1d('0x12')](_0x5a624b);this['imap'][_0x8c1d('0x31')](!![],this[_0x8c1d('0x2a')]['bind'](this));};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x39')]=function(){this[_0x8c1d('0x27')](_0x8c1d('0xf'));};EmailImap[_0x8c1d('0x14')][_0x8c1d('0x12')]=function(_0x36a4a5,_0x3145fb){logger[_0x8c1d('0x11')]('handleError',this[_0x8c1d('0xb')][_0x8c1d('0x8')],JSON[_0x8c1d('0x3a')](_0x36a4a5));var _0x59084c='';if(_0x36a4a5){if(_0x36a4a5[_0x8c1d('0x3b')]){_0x59084c=_0x36a4a5['textCode'];}else{for(var _0x2a149c in _0x36a4a5){if(_0x36a4a5[_0x8c1d('0x3c')](_0x2a149c)){_0x59084c+=_[_0x8c1d('0x3d')](_0x2a149c)+':\x20'+_0x36a4a5[_0x2a149c]+'\x0a';}}}}if(_0x3145fb){this[_0x8c1d('0x1')][_0x8c1d('0xf')]();}else{this['emit']('error',_0x59084c);this[_0x8c1d('0x27')](_0x8c1d('0xf'));}};module[_0x8c1d('0x3e')]=EmailImap; \ No newline at end of file +var _0x4ba9=['tls','required','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageEnd','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','port'];(function(_0x3ad8b1,_0x11b5f2){var _0x171c6d=function(_0x3a57c8){while(--_0x3a57c8){_0x3ad8b1['push'](_0x3ad8b1['shift']());}};_0x171c6d(++_0x11b5f2);}(_0x4ba9,0x18f));var _0x94ba=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x4ba9[_0x5e709a];return _0x57401a;};'use strict';var _=require(_0x94ba('0x0'));var util=require(_0x94ba('0x1'));var Imap=require(_0x94ba('0x2'));var simpleParser=require(_0x94ba('0x3'))['simpleParser'];var Iconv=require(_0x94ba('0x4'))[_0x94ba('0x5')];var EventEmitter=require(_0x94ba('0x6'))[_0x94ba('0x7')];var utils=require(_0x94ba('0x8'));var logger=require(_0x94ba('0x9'))(_0x94ba('0xa'));function EmailImap(_0x494061,_0x3aa516){this[_0x94ba('0xb')]=_0x494061['mailbox'];this[_0x94ba('0xc')]=this[_0x94ba('0xd')](_0x494061,_0x3aa516);this[_0x94ba('0x2')]=new Imap(this[_0x94ba('0xc')]);this[_0x94ba('0x2')]['once'](_0x94ba('0xe'),this[_0x94ba('0xf')][_0x94ba('0x10')](this));this['imap'][_0x94ba('0x11')](_0x94ba('0x12'),this[_0x94ba('0x13')]['bind'](this));this['imap']['on']('error',this[_0x94ba('0x14')][_0x94ba('0x10')](this));this[_0x94ba('0x2')][_0x94ba('0x15')]();}util[_0x94ba('0x16')](EmailImap,EventEmitter);EmailImap[_0x94ba('0x17')][_0x94ba('0xd')]=function(_0xc092,_0x44e354){var _0x1a64a5={'connTimeout':_0xc092[_0x94ba('0x18')]?_0xc092['connTimeout']*0x3e8:0x2710,'authTimeout':_0xc092[_0x94ba('0x19')]?_0xc092[_0x94ba('0x19')]*0x3e8:0x1388};if(_0xc092[_0x94ba('0x1a')]){_0x1a64a5[_0x94ba('0x1b')]=_0xc092['user'];if(_0xc092['modernAuthentication']){_0x1a64a5['xoauth2']=utils[_0x94ba('0x1c')](_0xc092[_0x94ba('0x1d')][_0x94ba('0x1e')],_0xc092['user']);}else{_0x1a64a5[_0x94ba('0x1f')]=_0xc092[_0x94ba('0x1f')];}}else{if(_0xc092['authentication']){_0x1a64a5[_0x94ba('0x1b')]=_0xc092[_0x94ba('0x1b')];_0x1a64a5['password']=_0xc092['password'];}}_0x1a64a5[_0x94ba('0xa')]=_0x44e354||_0xc092['user']||_0x94ba('0x20');_0x1a64a5[_0x94ba('0x21')]=_0xc092[_0x94ba('0x21')];_0x1a64a5[_0x94ba('0x22')]=_0xc092[_0x94ba('0x22')]||0x3e1;if(_0xc092['tls']){_0x1a64a5[_0x94ba('0x23')]=!![];}else{_0x1a64a5[_0x94ba('0x23')]=![];_0x1a64a5['autotls']=_0x94ba('0x24');}return _0x1a64a5;};EmailImap['prototype']['handleReady']=function(){this[_0x94ba('0x2')][_0x94ba('0x25')](this['mailbox'],![],this[_0x94ba('0x26')][_0x94ba('0x10')](this));};EmailImap[_0x94ba('0x17')]['handleOpenBox']=function(_0x344c8d,_0x393370){if(_0x344c8d){this[_0x94ba('0x14')](_0x344c8d,!![]);}else{this[_0x94ba('0x27')]('box',_0x393370);this[_0x94ba('0x28')]();}};EmailImap[_0x94ba('0x17')][_0x94ba('0x29')]=function(_0x14a2af){if(_0x14a2af){this[_0x94ba('0x14')](_0x14a2af,!![]);}else{this['imap']['end']();}};EmailImap[_0x94ba('0x17')][_0x94ba('0x28')]=function(){this[_0x94ba('0x2')]['search']([_0x94ba('0x2a')],this['handleReadUnseen']['bind'](this));};EmailImap[_0x94ba('0x17')][_0x94ba('0x2b')]=function(_0xda464d,_0x348c76){if(_0xda464d){this[_0x94ba('0x14')](_0xda464d,!![]);}else{if(_0x348c76[_0x94ba('0x2c')]){try{var _0x53eb12=this[_0x94ba('0x2')][_0x94ba('0x2d')](_0x348c76,{'bodies':'','markSeen':!![]});_0x53eb12['on']('message',this[_0x94ba('0x2e')][_0x94ba('0x10')](this));_0x53eb12[_0x94ba('0x11')](_0x94ba('0x2f'),this[_0x94ba('0x30')]['bind'](this));_0x53eb12['once']('end',this[_0x94ba('0x31')][_0x94ba('0x10')](this));}catch(_0x3dbf70){logger[_0x94ba('0x2f')](_0x3dbf70);}}else{this[_0x94ba('0x2')][_0x94ba('0x32')](!![],this[_0x94ba('0x29')]['bind'](this));}}};EmailImap[_0x94ba('0x17')]['handleFetchMessage']=function(_0x2398cf){_0x2398cf['on'](_0x94ba('0x33'),this['handleMessageBody'][_0x94ba('0x10')](this));_0x2398cf[_0x94ba('0x11')]('attributes',this['handleMessageAttributes'][_0x94ba('0x10')](this));_0x2398cf[_0x94ba('0x11')]('end',this[_0x94ba('0x34')][_0x94ba('0x10')](this));};EmailImap['prototype'][_0x94ba('0x35')]=function(_0x3087f4){simpleParser(_0x3087f4,{'Iconv':Iconv},this['handleSimpleParser'][_0x94ba('0x10')](this));};EmailImap[_0x94ba('0x17')][_0x94ba('0x36')]=function(){};EmailImap[_0x94ba('0x17')][_0x94ba('0x34')]=function(){};EmailImap[_0x94ba('0x17')][_0x94ba('0x37')]=function(_0x27b3ef,_0x424720){if(_0x27b3ef){logger[_0x94ba('0x2f')](_0x27b3ef);}else{var _0x800111=this;utils[_0x94ba('0x38')](this['account'],_0x424720,function(_0x665a1){_0x800111['emit']('email',_0x665a1);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x94ba('0x2')][_0x94ba('0x32')](!![],this[_0x94ba('0x29')][_0x94ba('0x10')](this));};EmailImap['prototype'][_0x94ba('0x30')]=function(_0x467132){this[_0x94ba('0x14')](_0x467132);this['imap'][_0x94ba('0x32')](!![],this[_0x94ba('0x29')][_0x94ba('0x10')](this));};EmailImap[_0x94ba('0x17')][_0x94ba('0x13')]=function(){this[_0x94ba('0x27')](_0x94ba('0x12'));};EmailImap[_0x94ba('0x17')][_0x94ba('0x14')]=function(_0x8200,_0x546e41){logger[_0x94ba('0x2f')](_0x94ba('0x14'),this[_0x94ba('0xc')][_0x94ba('0xa')],JSON[_0x94ba('0x39')](_0x8200));var _0xf58b5f='';if(_0x8200){if(_0x8200['textCode']){_0xf58b5f=_0x8200[_0x94ba('0x3a')];}else{for(var _0x7bdf6f in _0x8200){if(_0x8200[_0x94ba('0x3b')](_0x7bdf6f)){_0xf58b5f+=_[_0x94ba('0x3c')](_0x7bdf6f)+':\x20'+_0x8200[_0x7bdf6f]+'\x0a';}}}}if(_0x546e41){this[_0x94ba('0x2')][_0x94ba('0x12')]();}else{this[_0x94ba('0x27')](_0x94ba('0x2f'),_0xf58b5f);this[_0x94ba('0x27')](_0x94ba('0x12'));}};module[_0x94ba('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4ea2aa9..6697338 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 _0x359e=['toString','prototype','verify','createTransport','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','use','sendMail'];(function(_0x56b017,_0x42535b){var _0x499d3a=function(_0x434ac5){while(--_0x434ac5){_0x56b017['push'](_0x56b017['shift']());}};_0x499d3a(++_0x42535b);}(_0x359e,0x17c));var _0xe359=function(_0x117552,_0x459a11){_0x117552=_0x117552-0x0;var _0x2d2768=_0x359e[_0x117552];return _0x2d2768;};'use strict';var nodemailer=require(_0xe359('0x0'));var inlineBase64=require(_0xe359('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xe359('0x2')]=function(_0x4c4180,_0x15ce29){return new Promise(function(_0x51536b,_0x3d9f19){var _0x129e8e=nodemailer['createTransport'](_0x4c4180);_0x129e8e[_0xe359('0x3')]('compile',inlineBase64());_0x129e8e[_0xe359('0x4')](_0x15ce29,function(_0x3853ec,_0x22b8e1){if(_0x3853ec){_0x3d9f19(_0x3853ec[_0xe359('0x5')]());}else{_0x51536b(_0x22b8e1);}});});};EmailSmtp[_0xe359('0x6')][_0xe359('0x7')]=function(_0x24cda0){return new Promise(function(_0x57672,_0x4b26f8){var _0x3f14ba=nodemailer[_0xe359('0x8')](_0x24cda0);_0x3f14ba[_0xe359('0x7')](function(_0x4bbc31,_0xe0c5c9){if(_0x4bbc31){_0x4b26f8(_0x4bbc31[_0xe359('0x5')]());}else{if(_0xe0c5c9){_0x57672(_0xe0c5c9);}else{_0x4b26f8(_0xe359('0x9'));}}});});};module[_0xe359('0xa')]=EmailSmtp; \ No newline at end of file +var _0xb2ed=['toString','Not\x20verifired','exports','nodemailer','prototype','send','createTransport','use','sendMail','verify'];(function(_0x3c3cc0,_0x26af62){var _0x1ee282=function(_0x4872a3){while(--_0x4872a3){_0x3c3cc0['push'](_0x3c3cc0['shift']());}};_0x1ee282(++_0x26af62);}(_0xb2ed,0xdf));var _0xdb2e=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0xb2ed[_0x4d180c];return _0x49b57e;};'use strict';var nodemailer=require(_0xdb2e('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xdb2e('0x1')][_0xdb2e('0x2')]=function(_0x363b6b,_0x5ae36d){return new Promise(function(_0x5a24c6,_0x35fd89){var _0x2d52dc=nodemailer[_0xdb2e('0x3')](_0x363b6b);_0x2d52dc[_0xdb2e('0x4')]('compile',inlineBase64());_0x2d52dc[_0xdb2e('0x5')](_0x5ae36d,function(_0x4c9555,_0x597afb){if(_0x4c9555){_0x35fd89(_0x4c9555['toString']());}else{_0x5a24c6(_0x597afb);}});});};EmailSmtp[_0xdb2e('0x1')][_0xdb2e('0x6')]=function(_0xa16c6c){return new Promise(function(_0x7a4a33,_0x148954){var _0x484a03=nodemailer[_0xdb2e('0x3')](_0xa16c6c);_0x484a03[_0xdb2e('0x6')](function(_0x534968,_0x545a18){if(_0x534968){_0x148954(_0x534968[_0xdb2e('0x7')]());}else{if(_0x545a18){_0x7a4a33(_0x545a18);}else{_0x148954(_0xdb2e('0x8'));}}});});};module[_0xdb2e('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8de50a7..b718ed4 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 _0x6b9f=['Empty\x20message

','user=','base64','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','html','includes','0x1?_0x2b3bc4[_0xf6b9('0x13')](0x0,-0x1)['join']('\x20'):_0x3a920f[_0xf6b9('0xe')];}return _0xf6b9('0x14');}function getLastName(_0x5dd980){var _0x369e05=_[_0xf6b9('0x8')](_0x5dd980['value']);if(_0x369e05&&_0x369e05[_0xf6b9('0xe')]){var _0x17460a=_0x369e05[_0xf6b9('0xe')][_0xf6b9('0x11')](/\s+/);return _0x17460a[_0xf6b9('0x12')]>0x1?_0x17460a[_0xf6b9('0x15')]():'';}return'';}function getMails(_0x15a51b,_0x46dbdb){var _0x1afe8e='';for(var _0x1b4881=0x0;_0x1b4881<_0x46dbdb[_0xf6b9('0x9')]['length'];_0x1b4881+=0x1){if(_0x46dbdb[_0xf6b9('0x9')][_0x1b4881]['address']!==_0x15a51b){if(!_[_0xf6b9('0x16')](_0x1afe8e)){_0x1afe8e+=',';}_0x1afe8e+=_0x46dbdb[_0xf6b9('0x9')][_0x1b4881][_0xf6b9('0xe')]||_0x46dbdb[_0xf6b9('0x9')][_0x1b4881][_0xf6b9('0xa')]||'';_0x1afe8e+='\x20<';_0x1afe8e+=_0x46dbdb[_0xf6b9('0x9')][_0x1b4881][_0xf6b9('0xa')]?_0x46dbdb[_0xf6b9('0x9')][_0x1b4881][_0xf6b9('0xa')]:_0xf6b9('0xb')+random[_0xf6b9('0xc')](0x6)+_0xf6b9('0xd');_0x1afe8e+='>';}}return _0x1afe8e;}function parseEmail(_0x4073d2,_0x2e9468,_0x4273c3){if(_0x2e9468[_0xf6b9('0x17')]){var _0x5ceb81=/)<[^<]*)*<\/script>/gi;while(_0x5ceb81['test'](_0x2e9468[_0xf6b9('0x17')])){_0x2e9468[_0xf6b9('0x17')]=_0x2e9468[_0xf6b9('0x17')]['replace'](_0x5ceb81,'');}if(_0x2e9468[_0xf6b9('0x17')][_0xf6b9('0x18')](_0xf6b9('0x19'))){var _0x176586=[];_0x2e9468[_0xf6b9('0x1a')][_0xf6b9('0x1b')](_0x3c7129=>{_0x176586[_0xf6b9('0x1c')](_0x3c7129[_0xf6b9('0x1d')]);});var _0x431ad4=/]+>/g;var _0x4fec3a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x42339d=_0x2e9468['html'][_0xf6b9('0x1e')](_0x4fec3a,_0xf6b9('0x1f'));var _0x519c1c=_0x42339d[_0xf6b9('0x1e')](_0x431ad4,_0xf6b9('0x20'));for(let _0x56afce=0x0;_0x56afce<_0x176586[_0xf6b9('0x12')];_0x56afce++){var _0x129bfd=_0x519c1c[_0xf6b9('0x1e')](_0xf6b9('0x20'),'\x20[Attachment:\x20'+_0x176586[_0x56afce]+'\x20]');_0x519c1c=_0x129bfd;}_0x2e9468[_0xf6b9('0x17')]=_0x519c1c;}_0x4273c3[_0xf6b9('0x21')]=_0x2e9468[_0xf6b9('0x17')];}else{_0x4273c3[_0xf6b9('0x21')]=_0x2e9468['textAsHtml'];}if(_0x4273c3[_0xf6b9('0x21')]){_0x4273c3[_0xf6b9('0x21')]=_0x4273c3[_0xf6b9('0x21')][_0xf6b9('0x1e')](/0x0){var _0x434c09=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0xf6b9('0x2f')];for(var _0x8fccec=0x0;_0x8fccec<_0x2e9468['headerLines'][_0xf6b9('0x12')];_0x8fccec++){var _0x4ddd84=_[_0xf6b9('0x10')](_0x434c09,_0x2e9468['headerLines'][_0x8fccec][_0xf6b9('0x30')]);if(_0x4ddd84>=0x0){_0x4273c3[_0xf6b9('0x31')]=!![];}}}return _0x4273c3;}exports[_0xf6b9('0x32')]=function(_0x460696,_0x14af30,_0x37bc4a){var _0x210be8={'from':getAddress(_0x14af30['from']),'firstName':getFirstName(_0x14af30[_0xf6b9('0x33')]),'lastName':getLastName(_0x14af30[_0xf6b9('0x33')]),'mapKey':'email','message':{'from':getMails(_0x460696[_0xf6b9('0x6')],_0x14af30['from']),'to':_0x460696[_0xf6b9('0x6')],'cc':'','subject':_0x14af30[_0xf6b9('0x34')]||'','messageId':_0x14af30[_0xf6b9('0x35')],'inReplyTo':_0x14af30[_0xf6b9('0x36')],'sentAt':moment(_0x14af30[_0xf6b9('0x37')])[_0xf6b9('0x38')](_0xf6b9('0x39')),'attach':![],'attachments':[]}};if(!_0x14af30[_0xf6b9('0x17')]&&!_0x14af30[_0xf6b9('0x3a')]){var _0x40ffa7=_[_0xf6b9('0x3b')](_0x14af30[_0xf6b9('0x1a')],{'contentType':_0xf6b9('0x3c')});if(_0x40ffa7[_0xf6b9('0x12')]){logger[_0xf6b9('0x3d')](util[_0xf6b9('0x38')](_0xf6b9('0x3e'),_0x14af30[_0xf6b9('0x35')]));tnef['parseBuffer'](_[_0xf6b9('0x3f')](_0x40ffa7)['content'],function(_0x1ab517,_0x1dd7ce){if(_0x1dd7ce){_0x14af30[_0xf6b9('0x17')]=_0x1dd7ce['BodyHTML']||'

Empty\x20message

';if(_0x1dd7ce[_0xf6b9('0x40')]){for(var _0x4f18f3=0x0;_0x4f18f3<_0x1dd7ce['Attachments']['length'];_0x4f18f3++){var _0x14d7bd=_0x1dd7ce[_0xf6b9('0x40')][_0x4f18f3];_0x210be8['message']['attachments'][_0xf6b9('0x1c')]({'filename':_0x14d7bd['Title'],'content':Buffer[_0xf6b9('0x33')](_0x14d7bd['Data'])});}}}_0x37bc4a(parseEmail(_0x460696,_0x14af30,_0x210be8));});}else{_0x14af30[_0xf6b9('0x17')]=_0xf6b9('0x41');_0x37bc4a(parseEmail(_0x460696,_0x14af30,_0x210be8));}}else{_0x37bc4a(parseEmail(_0x460696,_0x14af30,_0x210be8));}};exports['generateXOAuth2Token']=function(_0x83d62d,_0x2d03ab){var _0x7fa2fc=[_0xf6b9('0x42')+(_0x2d03ab||''),'auth=Bearer\x20'+_0x83d62d,'',''];return Buffer['from'](_0x7fa2fc[_0xf6b9('0x29')](''),'utf-8')['toString'](_0xf6b9('0x43'));}; \ No newline at end of file +var _0xfb83=['forEach','filename','replace','_SRC','_IMG','\x20[Attachment:\x20','textAsHtml','body','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','split','length','slice','join','Anonymous','pop','test','html','includes','attachments'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xfb83,0x78));var _0x3fb8=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0xfb83[_0x259d17];return _0x407535;};'use strict';var _=require(_0x3fb8('0x0'));var moment=require(_0x3fb8('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x3fb8('0x2'));var util=require(_0x3fb8('0x3'));var tnef=require('node-tnef');var logger=require(_0x3fb8('0x4'))('email');var config=require(_0x3fb8('0x5'));function getAddress(_0x37fc9a){var _0x3cadad=_[_0x3fb8('0x6')](_0x37fc9a[_0x3fb8('0x7')]);return _0x3cadad&&_0x3cadad[_0x3fb8('0x8')]?_0x3cadad[_0x3fb8('0x8')]:_0x3fb8('0x9')+random[_0x3fb8('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x9e3fc6){var _0x59d9de=_[_0x3fb8('0x6')](_0x9e3fc6[_0x3fb8('0x7')]);if(_0x59d9de&&_0x59d9de[_0x3fb8('0xb')]){if(_0x59d9de[_0x3fb8('0xb')]==_0x59d9de[_0x3fb8('0x8')]){return _0x59d9de[_0x3fb8('0xb')][_0x3fb8('0xc')](0x0,_0x59d9de[_0x3fb8('0xb')][_0x3fb8('0xd')]('@'));}var _0x26ed8f=_0x59d9de[_0x3fb8('0xb')][_0x3fb8('0xe')](/\s+/);return _0x26ed8f[_0x3fb8('0xf')]>0x1?_0x26ed8f[_0x3fb8('0x10')](0x0,-0x1)[_0x3fb8('0x11')]('\x20'):_0x59d9de[_0x3fb8('0xb')];}return _0x3fb8('0x12');}function getLastName(_0x303432){var _0x5782d6=_[_0x3fb8('0x6')](_0x303432['value']);if(_0x5782d6&&_0x5782d6['name']){var _0x267c69=_0x5782d6[_0x3fb8('0xb')][_0x3fb8('0xe')](/\s+/);return _0x267c69[_0x3fb8('0xf')]>0x1?_0x267c69[_0x3fb8('0x13')]():'';}return'';}function getMails(_0x4b84f3,_0x6b0c85){var _0x5ae8cb='';for(var _0xaa6923=0x0;_0xaa6923<_0x6b0c85[_0x3fb8('0x7')]['length'];_0xaa6923+=0x1){if(_0x6b0c85[_0x3fb8('0x7')][_0xaa6923][_0x3fb8('0x8')]!==_0x4b84f3){if(!_['isEmpty'](_0x5ae8cb)){_0x5ae8cb+=',';}_0x5ae8cb+=_0x6b0c85[_0x3fb8('0x7')][_0xaa6923][_0x3fb8('0xb')]||_0x6b0c85[_0x3fb8('0x7')][_0xaa6923]['address']||'';_0x5ae8cb+='\x20<';_0x5ae8cb+=_0x6b0c85[_0x3fb8('0x7')][_0xaa6923][_0x3fb8('0x8')]?_0x6b0c85[_0x3fb8('0x7')][_0xaa6923]['address']:'anonymous'+random[_0x3fb8('0xa')](0x6)+'@xcally.com';_0x5ae8cb+='>';}}return _0x5ae8cb;}function parseEmail(_0x74b970,_0x4bdbe2,_0x533b59){if(_0x4bdbe2['html']){var _0x317cee=/)<[^<]*)*<\/script>/gi;while(_0x317cee[_0x3fb8('0x14')](_0x4bdbe2['html'])){_0x4bdbe2[_0x3fb8('0x15')]=_0x4bdbe2['html']['replace'](_0x317cee,'');}if(_0x4bdbe2['html'][_0x3fb8('0x16')]('{_0x52e31a['push'](_0x12a06e[_0x3fb8('0x19')]);});var _0x5a2efd=/]+>/g;var _0x4f49b3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x460f53=_0x4bdbe2[_0x3fb8('0x15')][_0x3fb8('0x1a')](_0x4f49b3,_0x3fb8('0x1b'));var _0x4defc4=_0x460f53[_0x3fb8('0x1a')](_0x5a2efd,_0x3fb8('0x1c'));for(let _0xcfd23f=0x0;_0xcfd23f<_0x52e31a[_0x3fb8('0xf')];_0xcfd23f++){var _0x2a2a6a=_0x4defc4[_0x3fb8('0x1a')]('_IMG',_0x3fb8('0x1d')+_0x52e31a[_0xcfd23f]+'\x20]');_0x4defc4=_0x2a2a6a;}_0x4bdbe2['html']=_0x4defc4;}_0x533b59['body']=_0x4bdbe2[_0x3fb8('0x15')];}else{_0x533b59['body']=_0x4bdbe2[_0x3fb8('0x1e')];}if(_0x533b59[_0x3fb8('0x1f')]){_0x533b59['body']=_0x533b59['body']['replace'](/0x0){var _0x5a11bf=['Auto-Submitted:\x20auto-replied',_0x3fb8('0x32'),_0x3fb8('0x33')];for(var _0x278863=0x0;_0x278863<_0x4bdbe2[_0x3fb8('0x31')][_0x3fb8('0xf')];_0x278863++){var _0x683494=_[_0x3fb8('0xd')](_0x5a11bf,_0x4bdbe2[_0x3fb8('0x31')][_0x278863]['line']);if(_0x683494>=0x0){_0x533b59[_0x3fb8('0x34')]=!![];}}}return _0x533b59;}exports[_0x3fb8('0x35')]=function(_0xe17a40,_0x18a913,_0x5928bf){var _0x2ef290={'from':getAddress(_0x18a913[_0x3fb8('0x36')]),'firstName':getFirstName(_0x18a913[_0x3fb8('0x36')]),'lastName':getLastName(_0x18a913[_0x3fb8('0x36')]),'mapKey':_0x3fb8('0x24'),'message':{'from':getMails(_0xe17a40[_0x3fb8('0x24')],_0x18a913[_0x3fb8('0x36')]),'to':_0xe17a40['email'],'cc':'','subject':_0x18a913[_0x3fb8('0x37')]||'','messageId':_0x18a913[_0x3fb8('0x38')],'inReplyTo':_0x18a913['inReplyTo'],'sentAt':moment(_0x18a913[_0x3fb8('0x39')])[_0x3fb8('0x2a')](_0x3fb8('0x3a')),'attach':![],'attachments':[]}};if(!_0x18a913[_0x3fb8('0x15')]&&!_0x18a913['textAsHtml']){var _0x47294c=_[_0x3fb8('0x3b')](_0x18a913[_0x3fb8('0x17')],{'contentType':'application/ms-tnef'});if(_0x47294c[_0x3fb8('0xf')]){logger['info'](util[_0x3fb8('0x2a')](_0x3fb8('0x3c'),_0x18a913['messageId']));tnef[_0x3fb8('0x3d')](_[_0x3fb8('0x3e')](_0x47294c)[_0x3fb8('0x2e')],function(_0x5ae25c,_0x3f5fa2){if(_0x3f5fa2){_0x18a913[_0x3fb8('0x15')]=_0x3f5fa2[_0x3fb8('0x3f')]||'

Empty\x20message

';if(_0x3f5fa2[_0x3fb8('0x40')]){for(var _0x59a1db=0x0;_0x59a1db<_0x3f5fa2['Attachments'][_0x3fb8('0xf')];_0x59a1db++){var _0x156f56=_0x3f5fa2[_0x3fb8('0x40')][_0x59a1db];_0x2ef290[_0x3fb8('0x25')][_0x3fb8('0x17')][_0x3fb8('0x2f')]({'filename':_0x156f56['Title'],'content':Buffer['from'](_0x156f56[_0x3fb8('0x41')])});}}}_0x5928bf(parseEmail(_0xe17a40,_0x18a913,_0x2ef290));});}else{_0x18a913[_0x3fb8('0x15')]=_0x3fb8('0x42');_0x5928bf(parseEmail(_0xe17a40,_0x18a913,_0x2ef290));}}else{_0x5928bf(parseEmail(_0xe17a40,_0x18a913,_0x2ef290));}};exports[_0x3fb8('0x43')]=function(_0x2ed2af,_0x412aae){var _0x78f9ac=['user='+(_0x412aae||''),_0x3fb8('0x44')+_0x2ed2af,'',''];return Buffer[_0x3fb8('0x36')](_0x78f9ac['join'](''),_0x3fb8('0x45'))[_0x3fb8('0x46')](_0x3fb8('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b324216..b4879dd 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 _0x4f00=['SERV','active','Smtp','exports','lodash','name','key'];(function(_0x428c99,_0x3f22c3){var _0x51c90f=function(_0x21a28e){while(--_0x21a28e){_0x428c99['push'](_0x428c99['shift']());}};_0x51c90f(++_0x3f22c3);}(_0x4f00,0x1ee));var _0x04f0=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x4f00[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x04f0('0x0'));function MailAccount(_0x297c1d){this['id']=_0x297c1d['id']||0x0;this[_0x04f0('0x1')]=_0x297c1d[_0x04f0('0x1')]||'Service';this[_0x04f0('0x2')]=_0x297c1d[_0x04f0('0x2')]||_0x04f0('0x3');this[_0x04f0('0x4')]=_0x297c1d['active']||![];this['Imap']=_0x297c1d['Imap']||[];this[_0x04f0('0x5')]=_0x297c1d[_0x04f0('0x5')]||[];}module[_0x04f0('0x6')]=MailAccount; \ No newline at end of file +var _0xe813=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe813,0xe5));var _0x3e81=function(_0x105c51,_0x412d34){_0x105c51=_0x105c51-0x0;var _0x1f727d=_0xe813[_0x105c51];return _0x1f727d;};'use strict';var _=require(_0x3e81('0x0'));function MailAccount(_0x5ba7e7){this['id']=_0x5ba7e7['id']||0x0;this[_0x3e81('0x1')]=_0x5ba7e7[_0x3e81('0x1')]||_0x3e81('0x2');this[_0x3e81('0x3')]=_0x5ba7e7[_0x3e81('0x3')]||_0x3e81('0x4');this[_0x3e81('0x5')]=_0x5ba7e7[_0x3e81('0x5')]||![];this[_0x3e81('0x6')]=_0x5ba7e7[_0x3e81('0x6')]||[];this[_0x3e81('0x7')]=_0x5ba7e7[_0x3e81('0x7')]||[];}module[_0x3e81('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index f292536..0d5b225 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 _0xd0ba=['isUndefined','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xd0ba,0xdf));var _0xad0b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xd0ba[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xad0b('0x0'));var MailAccount=require(_0xad0b('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x350d94,_0x44f4b4,_0x21b0e3){var _0x149fe2=_[_0xad0b('0x2')](_0x350d94,function(_0xa8e0c0,_0x450ebd){return _0xa8e0c0[_0x21b0e3];});for(var _0x46fd66 in _0x44f4b4){if(_0x44f4b4[_0xad0b('0x3')](_0x46fd66)){if(!_0x149fe2[_0x46fd66]){delete _0x44f4b4[_0x46fd66];}}}}Realtime[_0xad0b('0x4')][_0xad0b('0x5')]=function(_0x10c7bb,_0x36d418){for(var _0x965ac9 in _0x36d418){if(_0x10c7bb[_0xad0b('0x3')](_0x965ac9)){_0x10c7bb[_0x965ac9]=_0x36d418[_0x965ac9];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x844bae=this;return function(_0x2a44fe){if(_0x2a44fe){freeIsNotKey(_0x2a44fe,_0x844bae[_0xad0b('0x6')],'id');for(var _0x52476e=0x0,_0x48ce33={},_0x1aa38b={};_0x52476e<_0x2a44fe[_0xad0b('0x7')];_0x52476e+=0x1){_0x48ce33=_0x2a44fe[_0x52476e];if(_[_0xad0b('0x8')](_0x844bae[_0xad0b('0x6')][_0x48ce33['id']])){_0x844bae[_0xad0b('0x6')][_0x48ce33['id']]=new MailAccount(_0x48ce33);}else{_[_0xad0b('0x9')](_0x844bae['mailAccounts'][_0x48ce33['id']],_0x48ce33);}}}return _0x844bae[_0xad0b('0x6')];};};module[_0xad0b('0xa')]=Realtime; \ No newline at end of file +var _0xbe5a=['prototype','mergeFromDatabase','initMailAccounts','isUndefined','lodash','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x3541f3,_0x605588){var _0x5dcf70=function(_0x2d2e9c){while(--_0x2d2e9c){_0x3541f3['push'](_0x3541f3['shift']());}};_0x5dcf70(++_0x605588);}(_0xbe5a,0xfc));var _0xabe5=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xbe5a[_0x280f4a];return _0x1bb157;};'use strict';var _=require(_0xabe5('0x0'));var MailAccount=require(_0xabe5('0x1'));var Realtime=function(){this[_0xabe5('0x2')]={};};function freeIsNotKey(_0x545cf4,_0x1a86f1,_0x5c8f2b){var _0x16418a=_['mapKeys'](_0x545cf4,function(_0x27abb5,_0x1110ee){return _0x27abb5[_0x5c8f2b];});for(var _0x3aa75f in _0x1a86f1){if(_0x1a86f1[_0xabe5('0x3')](_0x3aa75f)){if(!_0x16418a[_0x3aa75f]){delete _0x1a86f1[_0x3aa75f];}}}}Realtime[_0xabe5('0x4')][_0xabe5('0x5')]=function(_0x414784,_0x5a2425){for(var _0x5296cf in _0x5a2425){if(_0x414784[_0xabe5('0x3')](_0x5296cf)){_0x414784[_0x5296cf]=_0x5a2425[_0x5296cf];}}};Realtime[_0xabe5('0x4')][_0xabe5('0x6')]=function(){var _0x33b1c9=this;return function(_0x597e81){if(_0x597e81){freeIsNotKey(_0x597e81,_0x33b1c9[_0xabe5('0x2')],'id');for(var _0x420173=0x0,_0x38a59a={},_0x503e8f={};_0x420173<_0x597e81['length'];_0x420173+=0x1){_0x38a59a=_0x597e81[_0x420173];if(_[_0xabe5('0x7')](_0x33b1c9[_0xabe5('0x2')][_0x38a59a['id']])){_0x33b1c9[_0xabe5('0x2')][_0x38a59a['id']]=new MailAccount(_0x38a59a);}else{_['merge'](_0x33b1c9[_0xabe5('0x2')][_0x38a59a['id']],_0x38a59a);}}}return _0x33b1c9[_0xabe5('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index a0de8eb..5d8f635 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 _0xaa00=['Imap','CloudProvider','type','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','active','key','ListId'];(function(_0x42d7dc,_0x1c97d0){var _0x325710=function(_0x57054d){while(--_0x57054d){_0x42d7dc['push'](_0x42d7dc['shift']());}};_0x325710(++_0x1c97d0);}(_0xaa00,0x1f4));var _0x0aa0=function(_0x16f8fa,_0x532102){_0x16f8fa=_0x16f8fa-0x0;var _0x4682a2=_0xaa00[_0x16f8fa];return _0x4682a2;};'use strict';var client=require(_0x0aa0('0x0'));exports[_0x0aa0('0x1')]=function(){return function(){return client[_0x0aa0('0x2')](_0x0aa0('0x3'),{'options':{'attributes':['id',_0x0aa0('0x4'),_0x0aa0('0x5'),_0x0aa0('0x6'),'email',_0x0aa0('0x7'),_0x0aa0('0x8'),_0x0aa0('0x9'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x0aa0('0xa'),'include':[{'model':_0x0aa0('0xb'),'attributes':['id','name',_0x0aa0('0x6'),_0x0aa0('0xc'),'data5'],'as':_0x0aa0('0xb')}]},{'model':_0x0aa0('0xd'),'as':_0x0aa0('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x0aa0('0x4'),_0x0aa0('0x6'),'type','data5'],'as':'CloudProvider'}]}]},'log':_0x0aa0('0xf')});};};exports['notify']=function(_0x4d6679,_0x4aaaa5){return client['Request'](_0x0aa0('0x10'),{'account':{'id':_0x4d6679},'body':_0x4aaaa5,'log':_0x0aa0('0x10')});}; \ No newline at end of file +var _0xcb07=['../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','ListId','MailServerIn','Imap','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount'];(function(_0x4b871a,_0x255bbf){var _0x1ddcf0=function(_0xb6cde8){while(--_0xb6cde8){_0x4b871a['push'](_0x4b871a['shift']());}};_0x1ddcf0(++_0x255bbf);}(_0xcb07,0x98));var _0x7cb0=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xcb07[_0x2c7618];return _0x5ce3f0;};'use strict';var client=require(_0x7cb0('0x0'));exports[_0x7cb0('0x1')]=function(){return function(){return client[_0x7cb0('0x2')](_0x7cb0('0x3'),{'options':{'attributes':['id',_0x7cb0('0x4'),'provider',_0x7cb0('0x5'),_0x7cb0('0x6'),_0x7cb0('0x7'),'key',_0x7cb0('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x7cb0('0x9'),'as':_0x7cb0('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0x7cb0('0x4'),_0x7cb0('0x5'),_0x7cb0('0xb'),_0x7cb0('0xc')],'as':_0x7cb0('0xd')}]},{'model':_0x7cb0('0xe'),'as':_0x7cb0('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0x7cb0('0x4'),_0x7cb0('0x5'),_0x7cb0('0xb'),'data5'],'as':'CloudProvider'}]}]},'log':_0x7cb0('0x10')});};};exports[_0x7cb0('0x11')]=function(_0x543c8a,_0x57f3cf){return client['Request'](_0x7cb0('0x12'),{'account':{'id':_0x543c8a},'body':_0x57f3cf,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 26e257d..27235e6 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 _0x6e98=['GetSettings'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x6e98,0x1d6));var _0x86e9=function(_0x54daf5,_0x528643){_0x54daf5=_0x54daf5-0x0;var _0xf70158=_0x6e98[_0x54daf5];return _0xf70158;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x86e9('0x0')});}; \ No newline at end of file +var _0x5f86=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x36315f,_0x2f6eec){var _0x32c1fe=function(_0x4e9185){while(--_0x4e9185){_0x36315f['push'](_0x36315f['shift']());}};_0x32c1fe(++_0x2f6eec);}(_0x5f86,0x14e));var _0x65f8=function(_0x2e221d,_0x3bfb1c){_0x2e221d=_0x2e221d-0x0;var _0x22c3b5=_0x5f86[_0x2e221d];return _0x22c3b5;};'use strict';var client=require(_0x65f8('0x0'));exports[_0x65f8('0x1')]=function(){return client[_0x65f8('0x2')](_0x65f8('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x65f8('0x4')]},'log':_0x65f8('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 81ce44b..192b636 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(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 b589996..1f5f5ff 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 _0x3462=['default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','defaults','redis','localhost','adapter'];(function(_0x4fcf67,_0x452b73){var _0x598eab=function(_0x26a5e7){while(--_0x26a5e7){_0x4fcf67['push'](_0x4fcf67['shift']());}};_0x598eab(++_0x452b73);}(_0x3462,0x8a));var _0x2346=function(_0x23ff04,_0x11d7ad){_0x23ff04=_0x23ff04-0x0;var _0x4e0f3f=_0x3462[_0x23ff04];return _0x4e0f3f;};'use strict';var _=require(_0x2346('0x0'));var http=require(_0x2346('0x1'));var express=require(_0x2346('0x2'));var sticky=require('sticky-session');var Redis=require(_0x2346('0x3'));var config=require(_0x2346('0x4'));var app=express();var server=http[_0x2346('0x5')](app);server[_0x2346('0x6')]=0xdbba0;if(sticky[_0x2346('0x7')](server,config[_0x2346('0x8')])){var socketio=require(_0x2346('0x9'))(server,{'transports':[_0x2346('0xa'),_0x2346('0xb')]});config['redis']=_[_0x2346('0xc')](config[_0x2346('0xd')],{'host':_0x2346('0xe'),'port':0x18eb});socketio[_0x2346('0xf')](require('socket.io-redis')({'pubClient':new Redis(config[_0x2346('0xd')]),'subClient':new Redis(config[_0x2346('0xd')])}));require('../../config/triggers')[_0x2346('0x10')]();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0x2346('0x10')](app);require(_0x2346('0x11'))[_0x2346('0x10')](app);}else{server[_0x2346('0x12')](_0x2346('0x13'),function(){console[_0x2346('0x14')](_0x2346('0x15'),config[_0x2346('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xc5e4=['../../config/triggers','../../config/socketio','default','../../config/express','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','createServer','timeout','listen','port','socket.io','websocket','polling','redis','localhost','adapter'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc5e4,0x194));var _0x4c5e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc5e4[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var http=require(_0x4c5e('0x0'));var express=require(_0x4c5e('0x1'));var sticky=require(_0x4c5e('0x2'));var Redis=require(_0x4c5e('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x4c5e('0x4')](app);server[_0x4c5e('0x5')]=0xdbba0;if(sticky[_0x4c5e('0x6')](server,config[_0x4c5e('0x7')])){var socketio=require(_0x4c5e('0x8'))(server,{'transports':[_0x4c5e('0x9'),_0x4c5e('0xa')]});config[_0x4c5e('0xb')]=_['defaults'](config[_0x4c5e('0xb')],{'host':_0x4c5e('0xc'),'port':0x18eb});socketio[_0x4c5e('0xd')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x4c5e('0xb')])}));require(_0x4c5e('0xe'))['default']();require(_0x4c5e('0xf'))[_0x4c5e('0x10')](socketio);require(_0x4c5e('0x11'))[_0x4c5e('0x10')](app);require('../../routes')[_0x4c5e('0x10')](app);}else{server[_0x4c5e('0x12')](_0x4c5e('0x13'),function(){console['log'](_0x4c5e('0x14'),config[_0x4c5e('0x7')]);});}exports=module[_0x4c5e('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index da96110..7e570ca 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 _0x1753=['message','result','catch','exports','jayson/promise','../../config/logger','routing','client','request','then','debug','rpc','error'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x1753,0x86));var _0x3175=function(_0x3bc24e,_0x409e8b){_0x3bc24e=_0x3bc24e-0x0;var _0x1b70f7=_0x1753[_0x3bc24e];return _0x1b70f7;};'use strict';var jayson=require(_0x3175('0x0'));var BPromise=require('bluebird');var logger=require(_0x3175('0x1'))(_0x3175('0x2'));var client=jayson[_0x3175('0x3')]['http']({'port':0x2329});client['Request']=function(_0x31f195,_0x5a4ecd){return new BPromise(function(_0x235698,_0x13f753){return client[_0x3175('0x4')](_0x31f195,_0x5a4ecd)[_0x3175('0x5')](function(_0x1ffac7){logger[_0x3175('0x6')](_0x3175('0x7'),_0x3175('0x2'),_0x31f195,_0x5a4ecd,_0x1ffac7);if(_0x1ffac7[_0x3175('0x8')]){logger['error'](_0x3175('0x7'),_0x3175('0x2'),_0x31f195,_0x1ffac7[_0x3175('0x8')][_0x3175('0x9')],_0x5a4ecd);return _0x13f753(_0x1ffac7[_0x3175('0x8')][_0x3175('0x9')]);}else{return _0x235698(_0x1ffac7[_0x3175('0xa')]);}})[_0x3175('0xb')](function(_0x535496){logger[_0x3175('0x8')](_0x3175('0x7'),_0x3175('0x2'),_0x31f195,_0x535496,_0x5a4ecd);return _0x13f753(_0x535496);});});};module[_0x3175('0xc')]=client; \ No newline at end of file +var _0xfb9e=['then','debug','rpc','error','message','result','exports','bluebird','../../config/logger','routing','client','http','Request','request'];(function(_0x1a2107,_0x146585){var _0x3ad213=function(_0x119f22){while(--_0x119f22){_0x1a2107['push'](_0x1a2107['shift']());}};_0x3ad213(++_0x146585);}(_0xfb9e,0x181));var _0xefb9=function(_0x10f50d,_0x1b200c){_0x10f50d=_0x10f50d-0x0;var _0x24128c=_0xfb9e[_0x10f50d];return _0x24128c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xefb9('0x0'));var logger=require(_0xefb9('0x1'))(_0xefb9('0x2'));var client=jayson[_0xefb9('0x3')][_0xefb9('0x4')]({'port':0x2329});client[_0xefb9('0x5')]=function(_0xa1d1c1,_0x127dc0){return new BPromise(function(_0x194e7d,_0x1fc141){return client[_0xefb9('0x6')](_0xa1d1c1,_0x127dc0)[_0xefb9('0x7')](function(_0x363b00){logger[_0xefb9('0x8')](_0xefb9('0x9'),_0xefb9('0x2'),_0xa1d1c1,_0x127dc0,_0x363b00);if(_0x363b00[_0xefb9('0xa')]){logger[_0xefb9('0xa')](_0xefb9('0x9'),_0xefb9('0x2'),_0xa1d1c1,_0x363b00['error'][_0xefb9('0xb')],_0x127dc0);return _0x1fc141(_0x363b00[_0xefb9('0xa')]['message']);}else{return _0x194e7d(_0x363b00[_0xefb9('0xc')]);}})['catch'](function(_0x9fdf3e){logger['error'](_0xefb9('0x9'),_0xefb9('0x2'),_0xa1d1c1,_0x9fdf3e,_0x127dc0);return _0x1fc141(_0x9fdf3e);});});};module[_0xefb9('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 8484ca0..88c87d9 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 _0xcf2e=['getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getSmsQueues','initSmsQueues'];(function(_0x582e69,_0x606d1a){var _0x5e9a96=function(_0x4cbb0f){while(--_0x4cbb0f){_0x582e69['push'](_0x582e69['shift']());}};_0x5e9a96(++_0x606d1a);}(_0xcf2e,0x14d));var _0xecf2=function(_0x50e89b,_0x4bded8){_0x50e89b=_0x50e89b-0x0;var _0x4b9202=_0xcf2e[_0x50e89b];return _0x4b9202;};'use strict';var BPromise=require(_0xecf2('0x0'));var server=require('./server');var Realtime=require(_0xecf2('0x1'));var user=require(_0xecf2('0x2'));var interval=require(_0xecf2('0x3'));var openchannelQueue=require(_0xecf2('0x4'));var chatQueue=require(_0xecf2('0x5'));var smsQueue=require(_0xecf2('0x6'));var mailQueue=require(_0xecf2('0x7'));var faxQueue=require(_0xecf2('0x8'));var whatsappQueue=require(_0xecf2('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xecf2('0xa')](user['getAgents']())[_0xecf2('0xa')](realtime[_0xecf2('0xb')]())[_0xecf2('0xa')](interval[_0xecf2('0xc')]())['then'](realtime[_0xecf2('0xd')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xecf2('0xa')](realtime[_0xecf2('0xe')]())['then'](chatQueue['getChatQueues']())['then'](realtime['initChatQueues']())[_0xecf2('0xa')](smsQueue[_0xecf2('0xf')]())[_0xecf2('0xa')](realtime[_0xecf2('0x10')]())[_0xecf2('0xa')](mailQueue[_0xecf2('0x11')]())[_0xecf2('0xa')](realtime[_0xecf2('0x12')]())[_0xecf2('0xa')](faxQueue[_0xecf2('0x13')]())[_0xecf2('0xa')](realtime[_0xecf2('0x14')]())['then'](whatsappQueue[_0xecf2('0x15')]())[_0xecf2('0xa')](realtime[_0xecf2('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0xecf2('0x17')](realtime)[_0xecf2('0xa')](function(_0x4be9e2){return initRealtime();})[_0xecf2('0xa')](function(_0x1b2819){return setInterval(initRealtime,0x1388);})[_0xecf2('0x18')](function(_0x14c7f2){console['log'](_0x14c7f2);});}main(); \ No newline at end of file +var _0x156d=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents'];(function(_0x134f89,_0x54401f){var _0xc8cf54=function(_0x4fccfd){while(--_0x4fccfd){_0x134f89['push'](_0x134f89['shift']());}};_0xc8cf54(++_0x54401f);}(_0x156d,0x1e7));var _0xd156=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x156d[_0x42cae2];return _0x5f256f;};'use strict';var BPromise=require(_0xd156('0x0'));var server=require(_0xd156('0x1'));var Realtime=require(_0xd156('0x2'));var user=require(_0xd156('0x3'));var interval=require(_0xd156('0x4'));var openchannelQueue=require(_0xd156('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xd156('0x6'));var mailQueue=require(_0xd156('0x7'));var faxQueue=require(_0xd156('0x8'));var whatsappQueue=require(_0xd156('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd156('0xa')]()[_0xd156('0xb')](user[_0xd156('0xc')]())['then'](realtime['initAgents']())['then'](interval['getIntervals']())[_0xd156('0xb')](realtime[_0xd156('0xd')]())[_0xd156('0xb')](openchannelQueue[_0xd156('0xe')]())[_0xd156('0xb')](realtime[_0xd156('0xf')]())[_0xd156('0xb')](chatQueue['getChatQueues']())[_0xd156('0xb')](realtime[_0xd156('0x10')]())[_0xd156('0xb')](smsQueue['getSmsQueues']())[_0xd156('0xb')](realtime['initSmsQueues']())['then'](mailQueue[_0xd156('0x11')]())['then'](realtime[_0xd156('0x12')]())[_0xd156('0xb')](faxQueue[_0xd156('0x13')]())[_0xd156('0xb')](realtime['initFaxQueues']())[_0xd156('0xb')](whatsappQueue[_0xd156('0x14')]())[_0xd156('0xb')](realtime[_0xd156('0x15')]())[_0xd156('0xb')](function(){return realtime;});}function main(){return server[_0xd156('0x16')](realtime)[_0xd156('0xb')](function(_0xa5c8c){return initRealtime();})[_0xd156('0xb')](function(_0x1d9721){return setInterval(initRealtime,0x1388);})[_0xd156('0x17')](function(_0x3d1e21){console[_0xd156('0x18')](_0x3d1e21);});}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 65afd77..2e238b7 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x1d67f6,_0x125103){var _0x11543f=function(_0x41b16f){while(--_0x41b16f){_0x1d67f6['push'](_0x1d67f6['shift']());}};_0x11543f(++_0x125103);}(_0x2ef3,0xba));var _0x32ef=function(_0x52f0ee,_0x3579a5){_0x52f0ee=_0x52f0ee-0x0;var _0x1173dc=_0x2ef3[_0x52f0ee];return _0x1173dc;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x607300,_0x57d85b){var _0x4d0fd6=function(_0x421924){while(--_0x421924){_0x607300['push'](_0x607300['shift']());}};_0x4d0fd6(++_0x57d85b);}(_0xe14b,0x93));var _0xbe14=function(_0x5d72f7,_0x3a3a87){_0x5d72f7=_0x5d72f7-0x0;var _0x276690=_0xe14b[_0x5d72f7];return _0x276690;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index af336cd..5c822d2 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 _0xbd42=['jayson/promise','client','http','request','then','error','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd42,0xee));var _0x2bd4=function(_0x4614d5,_0x5c8f33){_0x4614d5=_0x4614d5-0x0;var _0x265def=_0xbd42[_0x4614d5];return _0x265def;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x2bd4('0x0'));var client=jayson[_0x2bd4('0x1')][_0x2bd4('0x2')]({'port':0x232b});function request(_0x2e181e,_0x19eb68){return new BPromise(function(_0x16f710,_0x2595a3){return client[_0x2bd4('0x3')](_0x2e181e,_0x19eb68)[_0x2bd4('0x4')](function(_0x4ab216){if(_0x4ab216[_0x2bd4('0x5')]){return _0x2595a3(_0x4ab216[_0x2bd4('0x5')][_0x2bd4('0x6')]);}else{return _0x16f710(_0x4ab216['result']);}})['catch'](function(_0x14427a){return _0x2595a3(_0x14427a);});});}exports['sendMailMessage']=function(_0x6138f7,_0xe88bb1){return request('SendMail',{'account':_0x6138f7,'message':_0xe88bb1});}; \ No newline at end of file +var _0xed8b=['error','message','result','sendMailMessage','bluebird','request','then'];(function(_0x23dd5a,_0x17c458){var _0x438754=function(_0x5bc33c){while(--_0x5bc33c){_0x23dd5a['push'](_0x23dd5a['shift']());}};_0x438754(++_0x17c458);}(_0xed8b,0x115));var _0xbed8=function(_0x4f7a5b,_0x3ef4b9){_0x4f7a5b=_0x4f7a5b-0x0;var _0x175d9a=_0xed8b[_0x4f7a5b];return _0x175d9a;};'use strict';var BPromise=require(_0xbed8('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x2227dc,_0x29c862){return new BPromise(function(_0x18b77b,_0x510a41){return client[_0xbed8('0x1')](_0x2227dc,_0x29c862)[_0xbed8('0x2')](function(_0x36d157){if(_0x36d157[_0xbed8('0x3')]){return _0x510a41(_0x36d157[_0xbed8('0x3')][_0xbed8('0x4')]);}else{return _0x18b77b(_0x36d157[_0xbed8('0x5')]);}})['catch'](function(_0x2efc77){return _0x510a41(_0x2efc77);});});}exports[_0xbed8('0x6')]=function(_0x25ddbe,_0x41f37f){return request('SendMail',{'account':_0x25ddbe,'message':_0x41f37f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b62137d..2f346f6 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 _0xd741=['whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','smsStatus','openchannelStatus','isEqual','omit','emit','exports','moment','../../../config/environment','redis','defaults','localhost','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd741,0x1ad));var _0x1d74=function(_0xe6beab,_0x299dd7){_0xe6beab=_0xe6beab-0x0;var _0x452825=_0xd741[_0xe6beab];return _0x452825;};'use strict';var _=require('lodash');var moment=require(_0x1d74('0x0'));var Redis=require('ioredis');var config=require(_0x1d74('0x1'));config[_0x1d74('0x2')]=_[_0x1d74('0x3')](config[_0x1d74('0x2')],{'host':_0x1d74('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x3acd8b){this['id']=_0x3acd8b['id']||0x0;this['name']=_0x3acd8b[_0x1d74('0x5')]||'';this[_0x1d74('0x6')]=_0x3acd8b[_0x1d74('0x6')]||!![];this[_0x1d74('0x7')]=_0x3acd8b[_0x1d74('0x7')]||![];this['chatPause']=_0x3acd8b['chatPause']||![];this[_0x1d74('0x8')]=_0x3acd8b['mailPause']||![];this[_0x1d74('0x9')]=_0x3acd8b['faxPause']||![];this[_0x1d74('0xa')]=_0x3acd8b[_0x1d74('0xa')]||![];this[_0x1d74('0xb')]=_0x3acd8b[_0x1d74('0xb')]||![];this[_0x1d74('0xc')]=_0x1d74('0xd');this['chatStatusTime']=0x0;this[_0x1d74('0xe')]=_0x3acd8b['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x1d74('0xf')]=_0x1d74('0xd');this[_0x1d74('0x10')]=0x0;this[_0x1d74('0x11')]=_0x3acd8b[_0x1d74('0x11')]||0x0;this[_0x1d74('0x12')]=0x0;this[_0x1d74('0x13')]=_0x1d74('0xd');this[_0x1d74('0x14')]=0x0;this[_0x1d74('0x15')]=_0x3acd8b[_0x1d74('0x15')]||0x0;this[_0x1d74('0x16')]=0x0;this['smsStatus']='unknown';this[_0x1d74('0x17')]=0x0;this[_0x1d74('0x18')]=_0x3acd8b[_0x1d74('0x18')]||0x0;this[_0x1d74('0x19')]=0x0;this[_0x1d74('0x1a')]=_0x1d74('0xd');this[_0x1d74('0x1b')]=0x0;this[_0x1d74('0x1c')]=_0x3acd8b[_0x1d74('0x1c')]||0x0;this[_0x1d74('0x1d')]=0x0;this['openchannelStatus']=_0x1d74('0xd');this[_0x1d74('0x1e')]=0x0;this[_0x1d74('0x1f')]=_0x3acd8b[_0x1d74('0x1f')]||0x0;this[_0x1d74('0x20')]=0x0;this[_0x1d74('0x21')]=![];this[_0x1d74('0x22')]=undefined;this[_0x1d74('0x23')]={};this['faxWaitingInteractions']={};this[_0x1d74('0x24')]={};this[_0x1d74('0x25')]={};this[_0x1d74('0x26')]={};this[_0x1d74('0x27')]={};this['updateRealtime']();}Agent[_0x1d74('0x28')][_0x1d74('0x29')]=function(_0x37144b){if(this[_0x37144b+_0x1d74('0x2a')]>0x0){if(this[_0x37144b+_0x1d74('0x2b')]>0x0&&this[_0x37144b+_0x1d74('0x2a')]>=this[_0x37144b+_0x1d74('0x2b')]){return _0x1d74('0x2c');}else{return _0x1d74('0x2d');}}else{return _0x1d74('0x2e');}};Agent[_0x1d74('0x28')][_0x1d74('0x2f')]=function(){var _0x217bff=[_0x1d74('0x30'),_0x1d74('0x31'),_0x1d74('0x32'),'fax',_0x1d74('0x33'),_0x1d74('0x34')];for(var _0x2e9645=0x0;_0x2e9645<_0x217bff[_0x1d74('0x35')];_0x2e9645+=0x1){var _0x484c75=this[_0x1d74('0x29')](_0x217bff[_0x2e9645]);if(this[_0x217bff[_0x2e9645]+_0x1d74('0x36')]!==_0x484c75){this[_0x217bff[_0x2e9645]+_0x1d74('0x37')]=_[_0x1d74('0x38')](moment()[_0x1d74('0x39')]('x'));}this[_0x217bff[_0x2e9645]+_0x1d74('0x36')]=_0x484c75;}var _0x195a99={'id':this['id'],'name':this['name'],'online':this[_0x1d74('0x6')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x1d74('0x8')],'smsPause':this['smsPause'],'faxPause':this[_0x1d74('0x9')],'openchannelPause':this[_0x1d74('0xb')],'chatStatus':this[_0x1d74('0xc')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x1d74('0xe')],'chatCurrentCapacity':this[_0x1d74('0x3a')],'mailStatus':this[_0x1d74('0xf')],'mailStatusTime':this[_0x1d74('0x10')],'mailCapacity':this[_0x1d74('0x11')],'mailCurrentCapacity':this[_0x1d74('0x12')],'faxStatus':this[_0x1d74('0x13')],'faxStatusTime':this[_0x1d74('0x14')],'faxCapacity':this[_0x1d74('0x15')],'faxCurrentCapacity':this[_0x1d74('0x16')],'smsStatus':this[_0x1d74('0x3b')],'smsStatusTime':this[_0x1d74('0x17')],'smsCapacity':this[_0x1d74('0x18')],'smsCurrentCapacity':this[_0x1d74('0x19')],'whatsappStatus':this[_0x1d74('0x1a')],'whatsappStatusTime':this[_0x1d74('0x1b')],'whatsappCapacity':this[_0x1d74('0x1c')],'whatsappCurrentCapacity':this[_0x1d74('0x1d')],'openchannelStatus':this[_0x1d74('0x3c')],'openchannelStatusTime':this[_0x1d74('0x1e')],'openchannelCapacity':this[_0x1d74('0x1f')],'openchannelCurrentCapacity':this[_0x1d74('0x20')],'busy':this[_0x1d74('0x21')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x1d74('0x23')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x1d74('0x24')],'openchannelWaitingInteractions':this[_0x1d74('0x25')],'smsWaitingInteractions':this[_0x1d74('0x26')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};if(!_[_0x1d74('0x3d')](_[_0x1d74('0x3e')](this,[_0x1d74('0x6')]),_[_0x1d74('0x3e')](_0x195a99,[_0x1d74('0x6')]))){io[_0x1d74('0x3f')]('user:routing:update',_0x195a99);}};module[_0x1d74('0x40')]=Agent; \ No newline at end of file +var _0x388d=['toNumber','format','chatCurrentCapacity','mailStatus','mailCurrentCapacity','whatsappCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','omit','emit','user:routing:update','exports','lodash','moment','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','faxWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','openchannel','fax','sms','whatsapp','Status','StatusTime'];(function(_0x156147,_0x16978e){var _0x532175=function(_0x3ff117){while(--_0x3ff117){_0x156147['push'](_0x156147['shift']());}};_0x532175(++_0x16978e);}(_0x388d,0xc7));var _0xd388=function(_0x1b2d3e,_0x1a311b){_0x1b2d3e=_0x1b2d3e-0x0;var _0x5c2113=_0x388d[_0x1b2d3e];return _0x5c2113;};'use strict';var _=require(_0xd388('0x0'));var moment=require(_0xd388('0x1'));var Redis=require(_0xd388('0x2'));var config=require('../../../config/environment');config[_0xd388('0x3')]=_['defaults'](config['redis'],{'host':_0xd388('0x4'),'port':0x18eb});var io=require(_0xd388('0x5'))(new Redis(config[_0xd388('0x3')]));function Agent(_0x408eeb){this['id']=_0x408eeb['id']||0x0;this[_0xd388('0x6')]=_0x408eeb[_0xd388('0x6')]||'';this['online']=_0x408eeb[_0xd388('0x7')]||!![];this[_0xd388('0x8')]=_0x408eeb[_0xd388('0x8')]||![];this[_0xd388('0x9')]=_0x408eeb[_0xd388('0x9')]||![];this['mailPause']=_0x408eeb[_0xd388('0xa')]||![];this[_0xd388('0xb')]=_0x408eeb[_0xd388('0xb')]||![];this['smsPause']=_0x408eeb[_0xd388('0xc')]||![];this[_0xd388('0xd')]=_0x408eeb[_0xd388('0xd')]||![];this[_0xd388('0xe')]=_0xd388('0xf');this[_0xd388('0x10')]=0x0;this[_0xd388('0x11')]=_0x408eeb[_0xd388('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this['mailStatusTime']=0x0;this['mailCapacity']=_0x408eeb[_0xd388('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xd388('0x13')]='unknown';this[_0xd388('0x14')]=0x0;this[_0xd388('0x15')]=_0x408eeb[_0xd388('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xd388('0xf');this[_0xd388('0x16')]=0x0;this[_0xd388('0x17')]=_0x408eeb[_0xd388('0x17')]||0x0;this[_0xd388('0x18')]=0x0;this['whatsappStatus']=_0xd388('0xf');this[_0xd388('0x19')]=0x0;this[_0xd388('0x1a')]=_0x408eeb[_0xd388('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xd388('0x1b')]=_0xd388('0xf');this[_0xd388('0x1c')]=0x0;this[_0xd388('0x1d')]=_0x408eeb[_0xd388('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xd388('0x1e')]=![];this[_0xd388('0x1f')]=undefined;this['chatWaitingInteractions']={};this[_0xd388('0x20')]={};this['mailWaitingInteractions']={};this[_0xd388('0x21')]={};this['smsWaitingInteractions']={};this[_0xd388('0x22')]={};this[_0xd388('0x23')]();}Agent[_0xd388('0x24')][_0xd388('0x25')]=function(_0x1b1d5c){if(this[_0x1b1d5c+'CurrentCapacity']>0x0){if(this[_0x1b1d5c+'Capacity']>0x0&&this[_0x1b1d5c+_0xd388('0x26')]>=this[_0x1b1d5c+_0xd388('0x27')]){return _0xd388('0x28');}else{return _0xd388('0x29');}}else{return'idle';}};Agent['prototype'][_0xd388('0x23')]=function(){var _0x22909f=[_0xd388('0x2a'),'chat',_0xd388('0x2b'),_0xd388('0x2c'),_0xd388('0x2d'),_0xd388('0x2e')];for(var _0x519b10=0x0;_0x519b10<_0x22909f['length'];_0x519b10+=0x1){var _0x5d15e1=this[_0xd388('0x25')](_0x22909f[_0x519b10]);if(this[_0x22909f[_0x519b10]+_0xd388('0x2f')]!==_0x5d15e1){this[_0x22909f[_0x519b10]+_0xd388('0x30')]=_[_0xd388('0x31')](moment()[_0xd388('0x32')]('x'));}this[_0x22909f[_0x519b10]+_0xd388('0x2f')]=_0x5d15e1;}var _0x5f11b6={'id':this['id'],'name':this[_0xd388('0x6')],'online':this[_0xd388('0x7')],'voicePause':this[_0xd388('0x8')],'chatPause':this[_0xd388('0x9')],'mailPause':this[_0xd388('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0xd388('0xb')],'openchannelPause':this[_0xd388('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd388('0x11')],'chatCurrentCapacity':this[_0xd388('0x33')],'mailStatus':this[_0xd388('0x34')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xd388('0x12')],'mailCurrentCapacity':this[_0xd388('0x35')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd388('0x17')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xd388('0x19')],'whatsappCapacity':this[_0xd388('0x1a')],'whatsappCurrentCapacity':this[_0xd388('0x36')],'openchannelStatus':this[_0xd388('0x1b')],'openchannelStatusTime':this[_0xd388('0x1c')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xd388('0x1e')],'busyQueue':this[_0xd388('0x1f')],'chatWaitingInteractions':this[_0xd388('0x37')],'faxWaitingInteractions':this[_0xd388('0x20')],'mailWaitingInteractions':this[_0xd388('0x38')],'openchannelWaitingInteractions':this[_0xd388('0x21')],'smsWaitingInteractions':this[_0xd388('0x39')],'whatsappWaitingInteractions':this[_0xd388('0x22')]};if(!_['isEqual'](_[_0xd388('0x3a')](this,['online']),_[_0xd388('0x3a')](_0x5f11b6,[_0xd388('0x7')]))){io[_0xd388('0x3b')](_0xd388('0x3c'),_0x5f11b6);}};module[_0xd388('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 72d9cb1..7cb9761 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 _0x4667=['available','format','emit','exports','lodash','md5','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','chatPause'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4667,0x162));var _0x7466=function(_0x29976,_0x35de12){_0x29976=_0x29976-0x0;var _0x5cd575=_0x4667[_0x29976];return _0x5cd575;};'use strict';var _=require(_0x7466('0x0'));var md5=require(_0x7466('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x7466('0x2')]=_[_0x7466('0x3')](config[_0x7466('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x7466('0x4'))(new Redis(config[_0x7466('0x2')]));function ChatQueue(_0x5b986a){this['id']=_0x5b986a['id']||0x0;this[_0x7466('0x5')]=_0x5b986a['name']||'';this[_0x7466('0x6')]=_0x5b986a['timeout']||0xa;this[_0x7466('0x7')]=_0x5b986a[_0x7466('0x7')]||_0x7466('0x8');this[_0x7466('0x9')]=_0x5b986a[_0x7466('0x9')];this['mapAgentsId']={};this[_0x7466('0xa')]=0x0;this[_0x7466('0x1')]='';this[_0x7466('0xb')]();this[_0x7466('0xc')]();}ChatQueue[_0x7466('0xd')][_0x7466('0xb')]=function(){var _0x2dda09=this['mapAgentsId'][_0x7466('0xe')];this[_0x7466('0xf')]=_[_0x7466('0x10')](this['Agents'],'id');this[_0x7466('0xf')]['_rr']=_0x2dda09;};ChatQueue[_0x7466('0xd')][_0x7466('0xc')]=function(){this[_0x7466('0x11')]=0x0;this[_0x7466('0x12')]=0x0;for(var _0x4689c8=0x0;_0x4689c8=0x0?this[_0x7466('0x15')]:0x0;var _0x585bab={'id':this['id'],'available':this[_0x7466('0x15')],'loggedIn':this[_0x7466('0x11')],'name':this[_0x7466('0x5')],'paused':this[_0x7466('0x12')],'waiting':this['waiting']};var _0x4b8a6d=md5(JSON['stringify'](_0x585bab));if(this['md5']!==_0x4b8a6d){this[_0x7466('0x1')]=_0x4b8a6d;io['to'](util[_0x7466('0x16')]('chat:queue:%s',_0x585bab[_0x7466('0x5')]))[_0x7466('0x17')]('chat_queue:save',_0x585bab);}};module[_0x7466('0x18')]=ChatQueue; \ No newline at end of file +var _0xf6e1=['updateRealtime','loggedIn','length','online','chatPause','paused','available','format','emit','chat_queue:save','exports','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','mapAgentsId','_rr','map'];(function(_0x31504c,_0x296c3e){var _0x173831=function(_0x5450d5){while(--_0x5450d5){_0x31504c['push'](_0x31504c['shift']());}};_0x173831(++_0x296c3e);}(_0xf6e1,0x11e));var _0x1f6e=function(_0x3fb736,_0x2e5efe){_0x3fb736=_0x3fb736-0x0;var _0x33cefd=_0xf6e1[_0x3fb736];return _0x33cefd;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x1f6e('0x0'));var config=require('../../../config/environment');config[_0x1f6e('0x1')]=_['defaults'](config[_0x1f6e('0x1')],{'host':_0x1f6e('0x2'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1f6e('0x1')]));function ChatQueue(_0x22a16d){this['id']=_0x22a16d['id']||0x0;this['name']=_0x22a16d[_0x1f6e('0x3')]||'';this[_0x1f6e('0x4')]=_0x22a16d[_0x1f6e('0x4')]||0xa;this[_0x1f6e('0x5')]=_0x22a16d[_0x1f6e('0x5')]||_0x1f6e('0x6');this['Agents']=_0x22a16d[_0x1f6e('0x7')];this['mapAgentsId']={};this[_0x1f6e('0x8')]=0x0;this[_0x1f6e('0x9')]='';this[_0x1f6e('0xa')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0xf7a18d=this[_0x1f6e('0xb')][_0x1f6e('0xc')];this['mapAgentsId']=_[_0x1f6e('0xd')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0xf7a18d;};ChatQueue['prototype'][_0x1f6e('0xe')]=function(){this[_0x1f6e('0xf')]=0x0;this['paused']=0x0;for(var _0x31a99f=0x0;_0x31a99f=0x0?this[_0x1f6e('0x14')]:0x0;var _0x4ae767={'id':this['id'],'available':this[_0x1f6e('0x14')],'loggedIn':this[_0x1f6e('0xf')],'name':this['name'],'paused':this[_0x1f6e('0x13')],'waiting':this[_0x1f6e('0x8')]};var _0x5a0ac3=md5(JSON['stringify'](_0x4ae767));if(this[_0x1f6e('0x9')]!==_0x5a0ac3){this[_0x1f6e('0x9')]=_0x5a0ac3;io['to'](util[_0x1f6e('0x15')]('chat:queue:%s',_0x4ae767[_0x1f6e('0x3')]))[_0x1f6e('0x16')](_0x1f6e('0x17'),_0x4ae767);}};module[_0x1f6e('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 866ea6e..21c5403 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 _0xfb61=['available','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','map','updateRealtime','loggedIn','paused','length','faxPause'];(function(_0x527bdf,_0x20bd3a){var _0x33abdf=function(_0x415366){while(--_0x415366){_0x527bdf['push'](_0x527bdf['shift']());}};_0x33abdf(++_0x20bd3a);}(_0xfb61,0xf7));var _0x1fb6=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0xfb61[_0x545fe3];return _0x480702;};'use strict';var _=require(_0x1fb6('0x0'));var md5=require(_0x1fb6('0x1'));var util=require(_0x1fb6('0x2'));var Redis=require(_0x1fb6('0x3'));var config=require(_0x1fb6('0x4'));config[_0x1fb6('0x5')]=_[_0x1fb6('0x6')](config['redis'],{'host':_0x1fb6('0x7'),'port':0x18eb});var io=require(_0x1fb6('0x8'))(new Redis(config[_0x1fb6('0x5')]));function FaxQueue(_0xd26d8e){this['id']=_0xd26d8e['id']||0x0;this[_0x1fb6('0x9')]=_0xd26d8e[_0x1fb6('0x9')]||'';this[_0x1fb6('0xa')]=_0xd26d8e[_0x1fb6('0xa')]||0xa;this['strategy']=_0xd26d8e[_0x1fb6('0xb')]||_0x1fb6('0xc');this[_0x1fb6('0xd')]=_0xd26d8e[_0x1fb6('0xd')];this[_0x1fb6('0xe')]={};this['waiting']=0x0;this[_0x1fb6('0x1')]='';this[_0x1fb6('0xf')]();this['updateRealtime']();}FaxQueue[_0x1fb6('0x10')]['updateRouting']=function(){var _0x8c87ed=this[_0x1fb6('0xe')]['_rr'];this['mapAgentsId']=_[_0x1fb6('0x11')](this[_0x1fb6('0xd')],'id');this[_0x1fb6('0xe')]['_rr']=_0x8c87ed;};FaxQueue[_0x1fb6('0x10')][_0x1fb6('0x12')]=function(){this[_0x1fb6('0x13')]=0x0;this[_0x1fb6('0x14')]=0x0;for(var _0x16bf78=0x0;_0x16bf78=0x0?this[_0x1fb6('0x17')]:0x0;var _0x48216b={'id':this['id'],'available':this[_0x1fb6('0x17')],'loggedIn':this[_0x1fb6('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1fb6('0x18')]};var _0x4bde0f=md5(JSON['stringify'](_0x48216b));if(this[_0x1fb6('0x1')]!==_0x4bde0f){this['md5']=_0x4bde0f;io['to'](util[_0x1fb6('0x19')](_0x1fb6('0x1a'),_0x48216b[_0x1fb6('0x9')]))[_0x1fb6('0x1b')](_0x1fb6('0x1c'),_0x48216b);}};module[_0x1fb6('0x1d')]=FaxQueue; \ No newline at end of file +var _0x76a1=['beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','online','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy'];(function(_0x35674e,_0x3f6452){var _0x107863=function(_0x19b1d4){while(--_0x19b1d4){_0x35674e['push'](_0x35674e['shift']());}};_0x107863(++_0x3f6452);}(_0x76a1,0x153));var _0x176a=function(_0x995c2e,_0x10a89a){_0x995c2e=_0x995c2e-0x0;var _0x335f3c=_0x76a1[_0x995c2e];return _0x335f3c;};'use strict';var _=require(_0x176a('0x0'));var md5=require(_0x176a('0x1'));var util=require(_0x176a('0x2'));var Redis=require('ioredis');var config=require(_0x176a('0x3'));config[_0x176a('0x4')]=_['defaults'](config[_0x176a('0x4')],{'host':_0x176a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x53a15c){this['id']=_0x53a15c['id']||0x0;this[_0x176a('0x6')]=_0x53a15c[_0x176a('0x6')]||'';this[_0x176a('0x7')]=_0x53a15c[_0x176a('0x7')]||0xa;this['strategy']=_0x53a15c[_0x176a('0x8')]||_0x176a('0x9');this[_0x176a('0xa')]=_0x53a15c[_0x176a('0xa')];this['mapAgentsId']={};this[_0x176a('0xb')]=0x0;this[_0x176a('0x1')]='';this[_0x176a('0xc')]();this[_0x176a('0xd')]();}FaxQueue[_0x176a('0xe')][_0x176a('0xc')]=function(){var _0x2914b6=this['mapAgentsId'][_0x176a('0xf')];this[_0x176a('0x10')]=_[_0x176a('0x11')](this['Agents'],'id');this[_0x176a('0x10')][_0x176a('0xf')]=_0x2914b6;};FaxQueue[_0x176a('0xe')][_0x176a('0xd')]=function(){this[_0x176a('0x12')]=0x0;this[_0x176a('0x13')]=0x0;for(var _0x12e6c3=0x0;_0x12e6c3=0x0?this[_0x176a('0x16')]:0x0;var _0x49c508={'id':this['id'],'available':this[_0x176a('0x16')],'loggedIn':this[_0x176a('0x12')],'name':this[_0x176a('0x6')],'paused':this[_0x176a('0x13')],'waiting':this['waiting']};var _0x7fcb3a=md5(JSON[_0x176a('0x17')](_0x49c508));if(this['md5']!==_0x7fcb3a){this['md5']=_0x7fcb3a;io['to'](util[_0x176a('0x18')](_0x176a('0x19'),_0x49c508[_0x176a('0x6')]))[_0x176a('0x1a')](_0x176a('0x1b'),_0x49c508);}};module[_0x176a('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index e2b540b..600ddcf 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 _0xe335=['Intervals','name'];(function(_0x58eaf0,_0x4a1875){var _0x45e959=function(_0x1e1289){while(--_0x1e1289){_0x58eaf0['push'](_0x58eaf0['shift']());}};_0x45e959(++_0x4a1875);}(_0xe335,0x9b));var _0x5e33=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe335[_0x19950b];return _0x3c6b41;};'use strict';function Interval(_0x39d4a3){this['id']=_0x39d4a3['id']||0x0;this[_0x5e33('0x0')]=_0x39d4a3[_0x5e33('0x0')]||'';this[_0x5e33('0x1')]=_0x39d4a3[_0x5e33('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xa3d0=['Intervals','exports','name'];(function(_0xd8813a,_0x315766){var _0x487db6=function(_0x538ca9){while(--_0x538ca9){_0xd8813a['push'](_0xd8813a['shift']());}};_0x487db6(++_0x315766);}(_0xa3d0,0x152));var _0x0a3d=function(_0x21a8ef,_0x5f4873){_0x21a8ef=_0x21a8ef-0x0;var _0x546160=_0xa3d0[_0x21a8ef];return _0x546160;};'use strict';function Interval(_0x3b82d2){this['id']=_0x3b82d2['id']||0x0;this[_0x0a3d('0x0')]=_0x3b82d2[_0x0a3d('0x0')]||'';this[_0x0a3d('0x1')]=_0x3b82d2['Intervals']||{};}module[_0x0a3d('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 ea14eb6..13d2b59 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 _0xcc68=['../../../config/environment','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','length','online','loggedIn','mailPause','paused','available','stringify','format','emit','mail_queue:save','exports','md5','util','ioredis'];(function(_0x201583,_0x5e64fc){var _0x4cb47f=function(_0x1a0cb0){while(--_0x1a0cb0){_0x201583['push'](_0x201583['shift']());}};_0x4cb47f(++_0x5e64fc);}(_0xcc68,0xab));var _0x8cc6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcc68[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var md5=require(_0x8cc6('0x0'));var util=require(_0x8cc6('0x1'));var Redis=require(_0x8cc6('0x2'));var config=require(_0x8cc6('0x3'));config[_0x8cc6('0x4')]=_['defaults'](config[_0x8cc6('0x4')],{'host':_0x8cc6('0x5'),'port':0x18eb});var io=require(_0x8cc6('0x6'))(new Redis(config[_0x8cc6('0x4')]));function MailQueue(_0xc1a92d){this['id']=_0xc1a92d['id']||0x0;this['name']=_0xc1a92d[_0x8cc6('0x7')]||'';this['timeout']=_0xc1a92d['timeout']||0xa;this[_0x8cc6('0x8')]=_0xc1a92d[_0x8cc6('0x8')]||_0x8cc6('0x9');this[_0x8cc6('0xa')]=_0xc1a92d[_0x8cc6('0xa')];this[_0x8cc6('0xb')]={};this[_0x8cc6('0xc')]=0x0;this['md5']='';this[_0x8cc6('0xd')]();this[_0x8cc6('0xe')]();}MailQueue[_0x8cc6('0xf')]['updateRouting']=function(){var _0x14e73d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x8cc6('0x10')](this[_0x8cc6('0xa')],'id');this[_0x8cc6('0xb')][_0x8cc6('0x11')]=_0x14e73d;};MailQueue[_0x8cc6('0xf')][_0x8cc6('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5ee046=0x0;_0x5ee046=0x0?this[_0x8cc6('0x17')]:0x0;var _0x103509={'id':this['id'],'available':this[_0x8cc6('0x17')],'loggedIn':this[_0x8cc6('0x14')],'name':this['name'],'paused':this[_0x8cc6('0x16')],'waiting':this['waiting']};var _0x28ac04=md5(JSON[_0x8cc6('0x18')](_0x103509));if(this['md5']!==_0x28ac04){this[_0x8cc6('0x0')]=_0x28ac04;io['to'](util[_0x8cc6('0x19')]('mail:queue:%s',_0x103509['name']))[_0x8cc6('0x1a')](_0x8cc6('0x1b'),_0x103509);}};module[_0x8cc6('0x1c')]=MailQueue; \ No newline at end of file +var _0xb495=['name','paused','stringify','mail:queue:%s','emit','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','available'];(function(_0x4e29f1,_0x3da155){var _0x4bc72f=function(_0x443443){while(--_0x443443){_0x4e29f1['push'](_0x4e29f1['shift']());}};_0x4bc72f(++_0x3da155);}(_0xb495,0x101));var _0x5b49=function(_0x3f4a7e,_0x3b1cc1){_0x3f4a7e=_0x3f4a7e-0x0;var _0x5d0c93=_0xb495[_0x3f4a7e];return _0x5d0c93;};'use strict';var _=require(_0x5b49('0x0'));var md5=require('md5');var util=require(_0x5b49('0x1'));var Redis=require(_0x5b49('0x2'));var config=require(_0x5b49('0x3'));config['redis']=_['defaults'](config[_0x5b49('0x4')],{'host':_0x5b49('0x5'),'port':0x18eb});var io=require(_0x5b49('0x6'))(new Redis(config[_0x5b49('0x4')]));function MailQueue(_0x519906){this['id']=_0x519906['id']||0x0;this['name']=_0x519906['name']||'';this[_0x5b49('0x7')]=_0x519906[_0x5b49('0x7')]||0xa;this[_0x5b49('0x8')]=_0x519906['strategy']||_0x5b49('0x9');this[_0x5b49('0xa')]=_0x519906[_0x5b49('0xa')];this[_0x5b49('0xb')]={};this[_0x5b49('0xc')]=0x0;this[_0x5b49('0xd')]='';this[_0x5b49('0xe')]();this[_0x5b49('0xf')]();}MailQueue[_0x5b49('0x10')]['updateRouting']=function(){var _0x892547=this['mapAgentsId'][_0x5b49('0x11')];this[_0x5b49('0xb')]=_[_0x5b49('0x12')](this[_0x5b49('0xa')],'id');this[_0x5b49('0xb')][_0x5b49('0x11')]=_0x892547;};MailQueue[_0x5b49('0x10')][_0x5b49('0xf')]=function(){this[_0x5b49('0x13')]=0x0;this['paused']=0x0;for(var _0x5224ee=0x0;_0x5224ee=0x0?this['available']:0x0;var _0xfb2431={'id':this['id'],'available':this[_0x5b49('0x16')],'loggedIn':this[_0x5b49('0x13')],'name':this[_0x5b49('0x17')],'paused':this[_0x5b49('0x18')],'waiting':this[_0x5b49('0xc')]};var _0x1b7bdb=md5(JSON[_0x5b49('0x19')](_0xfb2431));if(this[_0x5b49('0xd')]!==_0x1b7bdb){this[_0x5b49('0xd')]=_0x1b7bdb;io['to'](util['format'](_0x5b49('0x1a'),_0xfb2431[_0x5b49('0x17')]))[_0x5b49('0x1b')]('mail_queue:save',_0xfb2431);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 15cb342..76b4d4f 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(_0x1c4b8d,_0x146a41){var _0x203346=function(_0x541d4d){while(--_0x541d4d){_0x1c4b8d['push'](_0x1c4b8d['shift']());}};_0x203346(++_0x146a41);}(_0x5fc3,0xa8));var _0x35fc=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0x5fc3[_0x7a3247];return _0x1bfde5;};'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 _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(_0x78f3a8,_0x4d9551){var _0x48af0d=function(_0x243b35){while(--_0x243b35){_0x78f3a8['push'](_0x78f3a8['shift']());}};_0x48af0d(++_0x4d9551);}(_0x5fc3,0xa8));var _0x35fc=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x5fc3[_0x28a5ad];return _0x176b8a;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 86b52ee..51a086b 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 _0x2ce1=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','map','_rr','loggedIn','length','online','smsPause','paused','available','format','emit','sms_queue:save','exports','ioredis'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x2ce1,0x8b));var _0x12ce=function(_0xcc8967,_0x381427){_0xcc8967=_0xcc8967-0x0;var _0x393c0d=_0x2ce1[_0xcc8967];return _0x393c0d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x12ce('0x0'));var config=require(_0x12ce('0x1'));config[_0x12ce('0x2')]=_[_0x12ce('0x3')](config['redis'],{'host':_0x12ce('0x4'),'port':0x18eb});var io=require(_0x12ce('0x5'))(new Redis(config['redis']));function SmsQueue(_0xf5b373){this['id']=_0xf5b373['id']||0x0;this[_0x12ce('0x6')]=_0xf5b373[_0x12ce('0x6')]||'';this['timeout']=_0xf5b373[_0x12ce('0x7')]||0xa;this['strategy']=_0xf5b373[_0x12ce('0x8')]||_0x12ce('0x9');this[_0x12ce('0xa')]=_0xf5b373['Agents'];this[_0x12ce('0xb')]={};this[_0x12ce('0xc')]=0x0;this[_0x12ce('0xd')]='';this[_0x12ce('0xe')]();this['updateRealtime']();}SmsQueue[_0x12ce('0xf')]['updateRouting']=function(){var _0x3a3d4d=this['mapAgentsId']['_rr'];this[_0x12ce('0xb')]=_[_0x12ce('0x10')](this[_0x12ce('0xa')],'id');this[_0x12ce('0xb')][_0x12ce('0x11')]=_0x3a3d4d;};SmsQueue[_0x12ce('0xf')]['updateRealtime']=function(){this[_0x12ce('0x12')]=0x0;this['paused']=0x0;for(var _0x12bcf2=0x0;_0x12bcf2=0x0?this[_0x12ce('0x17')]:0x0;var _0x2a0f3f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x12ce('0x12')],'name':this['name'],'paused':this[_0x12ce('0x16')],'waiting':this['waiting']};var _0xe24a11=md5(JSON['stringify'](_0x2a0f3f));if(this[_0x12ce('0xd')]!==_0xe24a11){this['md5']=_0xe24a11;io['to'](util[_0x12ce('0x18')]('sms:queue:%s',_0x2a0f3f['name']))[_0x12ce('0x19')](_0x12ce('0x1a'),_0x2a0f3f);}};module[_0x12ce('0x1b')]=SmsQueue; \ No newline at end of file +var _0x2bdb=['lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','paused','length','loggedIn','smsPause','available','stringify','sms:queue:%s','emit','exports'];(function(_0x3f4aec,_0x2c43b3){var _0x24c328=function(_0x51c212){while(--_0x51c212){_0x3f4aec['push'](_0x3f4aec['shift']());}};_0x24c328(++_0x2c43b3);}(_0x2bdb,0x105));var _0xb2bd=function(_0x7d74ec,_0x1f0f30){_0x7d74ec=_0x7d74ec-0x0;var _0x2737d1=_0x2bdb[_0x7d74ec];return _0x2737d1;};'use strict';var _=require(_0xb2bd('0x0'));var md5=require('md5');var util=require(_0xb2bd('0x1'));var Redis=require('ioredis');var config=require(_0xb2bd('0x2'));config[_0xb2bd('0x3')]=_[_0xb2bd('0x4')](config['redis'],{'host':_0xb2bd('0x5'),'port':0x18eb});var io=require(_0xb2bd('0x6'))(new Redis(config[_0xb2bd('0x3')]));function SmsQueue(_0x4676c1){this['id']=_0x4676c1['id']||0x0;this[_0xb2bd('0x7')]=_0x4676c1[_0xb2bd('0x7')]||'';this[_0xb2bd('0x8')]=_0x4676c1['timeout']||0xa;this[_0xb2bd('0x9')]=_0x4676c1['strategy']||_0xb2bd('0xa');this[_0xb2bd('0xb')]=_0x4676c1[_0xb2bd('0xb')];this[_0xb2bd('0xc')]={};this[_0xb2bd('0xd')]=0x0;this[_0xb2bd('0xe')]='';this[_0xb2bd('0xf')]();this[_0xb2bd('0x10')]();}SmsQueue[_0xb2bd('0x11')]['updateRouting']=function(){var _0x79b4e2=this[_0xb2bd('0xc')][_0xb2bd('0x12')];this[_0xb2bd('0xc')]=_[_0xb2bd('0x13')](this[_0xb2bd('0xb')],'id');this[_0xb2bd('0xc')][_0xb2bd('0x12')]=_0x79b4e2;};SmsQueue['prototype'][_0xb2bd('0x10')]=function(){this['loggedIn']=0x0;this[_0xb2bd('0x14')]=0x0;for(var _0x2adda1=0x0;_0x2adda1=0x0?this[_0xb2bd('0x18')]:0x0;var _0x387897={'id':this['id'],'available':this[_0xb2bd('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xb2bd('0x7')],'paused':this[_0xb2bd('0x14')],'waiting':this['waiting']};var _0xd89760=md5(JSON[_0xb2bd('0x19')](_0x387897));if(this['md5']!==_0xd89760){this['md5']=_0xd89760;io['to'](util['format'](_0xb2bd('0x1a'),_0x387897['name']))[_0xb2bd('0x1b')]('sms_queue:save',_0x387897);}};module[_0xb2bd('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 21cf872..61d0516 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 _0x7565=['prototype','map','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime'];(function(_0x51d5fa,_0x4046b4){var _0x56583c=function(_0x2aa4ed){while(--_0x2aa4ed){_0x51d5fa['push'](_0x51d5fa['shift']());}};_0x56583c(++_0x4046b4);}(_0x7565,0x1ef));var _0x5756=function(_0x6022b2,_0x258604){_0x6022b2=_0x6022b2-0x0;var _0x34e323=_0x7565[_0x6022b2];return _0x34e323;};'use strict';var _=require(_0x5756('0x0'));var md5=require('md5');var util=require(_0x5756('0x1'));var Redis=require(_0x5756('0x2'));var config=require(_0x5756('0x3'));config[_0x5756('0x4')]=_[_0x5756('0x5')](config[_0x5756('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5756('0x6'))(new Redis(config[_0x5756('0x4')]));function WhatsappQueue(_0x40beab){this['id']=_0x40beab['id']||0x0;this[_0x5756('0x7')]=_0x40beab[_0x5756('0x7')]||'';this[_0x5756('0x8')]=_0x40beab[_0x5756('0x8')]||0xa;this[_0x5756('0x9')]=_0x40beab['strategy']||_0x5756('0xa');this[_0x5756('0xb')]=_0x40beab[_0x5756('0xb')];this[_0x5756('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x5756('0xd')]();this[_0x5756('0xe')]();}WhatsappQueue[_0x5756('0xf')][_0x5756('0xd')]=function(){var _0x394167=this[_0x5756('0xc')]['_rr'];this[_0x5756('0xc')]=_[_0x5756('0x10')](this[_0x5756('0xb')],'id');this[_0x5756('0xc')][_0x5756('0x11')]=_0x394167;};WhatsappQueue['prototype'][_0x5756('0xe')]=function(){this[_0x5756('0x12')]=0x0;this[_0x5756('0x13')]=0x0;for(var _0x380710=0x0;_0x380710=0x0?this[_0x5756('0x17')]:0x0;var _0x49c84e={'id':this['id'],'available':this[_0x5756('0x17')],'loggedIn':this[_0x5756('0x12')],'name':this[_0x5756('0x7')],'paused':this[_0x5756('0x13')],'waiting':this['waiting']};var _0x4d9174=md5(JSON[_0x5756('0x18')](_0x49c84e));if(this[_0x5756('0x19')]!==_0x4d9174){this[_0x5756('0x19')]=_0x4d9174;io['to'](util[_0x5756('0x1a')](_0x5756('0x1b'),_0x49c84e[_0x5756('0x7')]))[_0x5756('0x1c')](_0x5756('0x1d'),_0x49c84e);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xdc3d=['available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause'];(function(_0x53db10,_0x11c0a9){var _0x18ff27=function(_0x58734a){while(--_0x58734a){_0x53db10['push'](_0x53db10['shift']());}};_0x18ff27(++_0x11c0a9);}(_0xdc3d,0x1ab));var _0xddc3=function(_0x33d59c,_0x37c9cc){_0x33d59c=_0x33d59c-0x0;var _0x2f60fa=_0xdc3d[_0x33d59c];return _0x2f60fa;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xddc3('0x0'));var Redis=require('ioredis');var config=require(_0xddc3('0x1'));config[_0xddc3('0x2')]=_[_0xddc3('0x3')](config[_0xddc3('0x2')],{'host':_0xddc3('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xddc3('0x2')]));function WhatsappQueue(_0x25f2fc){this['id']=_0x25f2fc['id']||0x0;this[_0xddc3('0x5')]=_0x25f2fc[_0xddc3('0x5')]||'';this[_0xddc3('0x6')]=_0x25f2fc[_0xddc3('0x6')]||0xa;this[_0xddc3('0x7')]=_0x25f2fc['strategy']||_0xddc3('0x8');this[_0xddc3('0x9')]=_0x25f2fc[_0xddc3('0x9')];this[_0xddc3('0xa')]={};this[_0xddc3('0xb')]=0x0;this[_0xddc3('0xc')]='';this['updateRouting']();this[_0xddc3('0xd')]();}WhatsappQueue[_0xddc3('0xe')]['updateRouting']=function(){var _0xfe5cd3=this[_0xddc3('0xa')][_0xddc3('0xf')];this['mapAgentsId']=_['map'](this[_0xddc3('0x9')],'id');this[_0xddc3('0xa')][_0xddc3('0xf')]=_0xfe5cd3;};WhatsappQueue[_0xddc3('0xe')]['updateRealtime']=function(){this[_0xddc3('0x10')]=0x0;this[_0xddc3('0x11')]=0x0;for(var _0x54687f=0x0;_0x54687f=0x0?this['available']:0x0;var _0x543e76={'id':this['id'],'available':this[_0xddc3('0x15')],'loggedIn':this[_0xddc3('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xddc3('0xb')]};var _0x15b131=md5(JSON[_0xddc3('0x16')](_0x543e76));if(this[_0xddc3('0xc')]!==_0x15b131){this['md5']=_0x15b131;io['to'](util[_0xddc3('0x17')](_0xddc3('0x18'),_0x543e76[_0xddc3('0x5')]))[_0xddc3('0x19')](_0xddc3('0x1a'),_0x543e76);}};module[_0xddc3('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2a5bc4a..d351fd7 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x22c248,_0x28515d){var _0x14e237=function(_0x37af89){while(--_0x37af89){_0x22c248['push'](_0x22c248['shift']());}};_0x14e237(++_0x28515d);}(_0xb10b,0x12a));var _0xbb10=function(_0x14102c,_0x1cb214){_0x14102c=_0x14102c-0x0;var _0x13297b=_0xb10b[_0x14102c];return _0x13297b;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index e85e6d5..12b0146 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 _0x3e8a=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3e8a,0x196));var _0xa3e8=function(_0x1f544e,_0x1edbbd){_0x1f544e=_0x1f544e-0x0;var _0x394caa=_0x3e8a[_0x1f544e];return _0x394caa;};'use strict';var client=require('../client');exports[_0xa3e8('0x0')]=function(_0x1dabd3,_0x1b368a){return client[_0xa3e8('0x1')]('UpdateChatInteraction',{'body':_0x1b368a,'options':{'where':{'id':_0x1dabd3}},'log':_0xa3e8('0x2')});};exports[_0xa3e8('0x3')]=function(_0x4d8502,_0x62ecac){return client[_0xa3e8('0x1')](_0xa3e8('0x4'),{'body':_0x62ecac,'options':{'where':{'id':_0x4d8502}},'log':_0xa3e8('0x5')});}; \ No newline at end of file +var _0x255c=['../client','update','Request','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x37942f,_0x3801b0){var _0x3b01ce=function(_0x68acae){while(--_0x68acae){_0x37942f['push'](_0x37942f['shift']());}};_0x3b01ce(++_0x3801b0);}(_0x255c,0x108));var _0xc255=function(_0x362fc6,_0x492248){_0x362fc6=_0x362fc6-0x0;var _0x4450ed=_0x255c[_0x362fc6];return _0x4450ed;};'use strict';var client=require(_0xc255('0x0'));exports[_0xc255('0x1')]=function(_0x3448ae,_0x4cd89c){return client[_0xc255('0x2')]('UpdateChatInteraction',{'body':_0x4cd89c,'options':{'where':{'id':_0x3448ae}},'log':_0xc255('0x3')});};exports['addTags']=function(_0x3f1019,_0x217b02){return client[_0xc255('0x2')](_0xc255('0x4'),{'body':_0x217b02,'options':{'where':{'id':_0x3f1019}},'log':_0xc255('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 45ed77d..dbff004 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 _0xa832=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x3b967e,_0x21da88){var _0x4f0f27=function(_0x579b70){while(--_0x579b70){_0x3b967e['push'](_0x3b967e['shift']());}};_0x4f0f27(++_0x21da88);}(_0xa832,0x82));var _0x2a83=function(_0x1e6027,_0x255d10){_0x1e6027=_0x1e6027-0x0;var _0x18171e=_0xa832[_0x1e6027];return _0x18171e;};'use strict';var client=require(_0x2a83('0x0'));exports[_0x2a83('0x1')]=function(_0x5312e8){return client[_0x2a83('0x2')](_0x2a83('0x3'),{'body':_0x5312e8,'log':_0x2a83('0x4')});}; \ No newline at end of file +var _0x899d=['create','Request','CreateChatMessage','../client'];(function(_0x4669fc,_0x13b2c4){var _0x11076a=function(_0x1154e2){while(--_0x1154e2){_0x4669fc['push'](_0x4669fc['shift']());}};_0x11076a(++_0x13b2c4);}(_0x899d,0x12b));var _0xd899=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x899d[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xd899('0x0'));exports[_0xd899('0x1')]=function(_0x4df2e9){return client[_0xd899('0x2')](_0xd899('0x3'),{'body':_0x4df2e9,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index da587ab..fbe5a1e 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 _0xa93e=['online','chatPause','getChatQueues','Request','GetChatQueue','timeout','User'];(function(_0x5843d2,_0x121877){var _0x6dd37=function(_0x3fe2dc){while(--_0x3fe2dc){_0x5843d2['push'](_0x5843d2['shift']());}};_0x6dd37(++_0x121877);}(_0xa93e,0x1df));var _0xea93=function(_0x59d1f3,_0x5c2e87){_0x59d1f3=_0x59d1f3-0x0;var _0x240d3d=_0xa93e[_0x59d1f3];return _0x240d3d;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0xea93('0x0')](_0xea93('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xea93('0x2'),'strategy'],'include':[{'model':_0xea93('0x3'),'as':'Agents','attributes':['id','name',_0xea93('0x4'),_0xea93('0x5')]}]},'log':_0xea93('0x6')});};}; \ No newline at end of file +var _0xf8de=['User','Agents','online','chatPause','getChatQueues','Request','name','strategy'];(function(_0x59f6c1,_0x7bda0d){var _0x13df0a=function(_0x16f4b6){while(--_0x16f4b6){_0x59f6c1['push'](_0x59f6c1['shift']());}};_0x13df0a(++_0x7bda0d);}(_0xf8de,0x1d4));var _0xef8d=function(_0x4ba720,_0x3e16bd){_0x4ba720=_0x4ba720-0x0;var _0x290ddc=_0xf8de[_0x4ba720];return _0x290ddc;};'use strict';var client=require('../client');exports[_0xef8d('0x0')]=function(){return function(){return client[_0xef8d('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xef8d('0x2'),'timeout',_0xef8d('0x3')],'include':[{'model':_0xef8d('0x4'),'as':_0xef8d('0x5'),'attributes':['id','name',_0xef8d('0x6'),_0xef8d('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 5743048..91e2fa4 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 _0x92f0=['CreateChatQueueReport','Request','UpdateChatQueueReport','DESC','create'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x92f0,0x10d));var _0x092f=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x92f0[_0x326d35];return _0xd3f8f3;};'use strict';var client=require('../client');exports[_0x092f('0x0')]=function(_0x209c83){return client['Request'](_0x092f('0x1'),{'body':_0x209c83,'log':_0x092f('0x1')});};exports['update']=function(_0x47f54d,_0x16bf0b){return client[_0x092f('0x2')](_0x092f('0x3'),{'body':_0x16bf0b,'options':{'where':{'uniqueid':_0x47f54d},'order':[['id',_0x092f('0x4')]],'limit':0x1},'log':_0x092f('0x3')});}; \ No newline at end of file +var _0xf3dc=['Request','../client','create','CreateChatQueueReport','update'];(function(_0x2201f1,_0x374da6){var _0xab8669=function(_0x27f520){while(--_0x27f520){_0x2201f1['push'](_0x2201f1['shift']());}};_0xab8669(++_0x374da6);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x43f16f,_0x5b99e5){_0x43f16f=_0x43f16f-0x0;var _0x66db51=_0xf3dc[_0x43f16f];return _0x66db51;};'use strict';var client=require(_0xcf3d('0x0'));exports[_0xcf3d('0x1')]=function(_0x3a135c){return client['Request'](_0xcf3d('0x2'),{'body':_0x3a135c,'log':_0xcf3d('0x2')});};exports[_0xcf3d('0x3')]=function(_0x226c79,_0x17b83e){return client[_0xcf3d('0x4')]('UpdateChatQueueReport',{'body':_0x17b83e,'options':{'where':{'uniqueid':_0x226c79},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 76294ac..97360d9 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1ddc32,_0x2b6aeb){var _0x14e4ce=function(_0x524da5){while(--_0x524da5){_0x1ddc32['push'](_0x1ddc32['shift']());}};_0x14e4ce(++_0x2b6aeb);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x7a54,0x106));var _0x47a5=function(_0xfa3c4f,_0x2d9fff){_0xfa3c4f=_0xfa3c4f-0x0;var _0x2319f1=_0x7a54[_0xfa3c4f];return _0x2319f1;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 9eb54f4..07a952f 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 _0x13e3=['create','../client'];(function(_0x319ec7,_0x5dadae){var _0x5c2675=function(_0x27a202){while(--_0x27a202){_0x319ec7['push'](_0x319ec7['shift']());}};_0x5c2675(++_0x5dadae);}(_0x13e3,0xed));var _0x313e=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x13e3[_0xa45395];return _0x3c83d2;};'use strict';var client=require(_0x313e('0x0'));exports[_0x313e('0x1')]=function(_0x573c9a){return client['Request']('CreateFaxMessage',{'body':_0x573c9a,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xeb47=['CreateFaxMessage','../client','create'];(function(_0xa1ae5c,_0x44beef){var _0x4573c1=function(_0x2580ec){while(--_0x2580ec){_0xa1ae5c['push'](_0xa1ae5c['shift']());}};_0x4573c1(++_0x44beef);}(_0xeb47,0x1b1));var _0x7eb4=function(_0x1a17c5,_0x671a6f){_0x1a17c5=_0x1a17c5-0x0;var _0x63a093=_0xeb47[_0x1a17c5];return _0x63a093;};'use strict';var client=require(_0x7eb4('0x0'));exports[_0x7eb4('0x1')]=function(_0x1d9ee9){return client['Request'](_0x7eb4('0x2'),{'body':_0x1d9ee9,'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 760acd5..84dc4e0 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 _0xf6c2=['faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0xa940b7,_0x59344a){var _0x352428=function(_0x4a3dcd){while(--_0x4a3dcd){_0xa940b7['push'](_0xa940b7['shift']());}};_0x352428(++_0x59344a);}(_0xf6c2,0x1f0));var _0x2f6c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf6c2[_0x3e5086];return _0xfeb102;};'use strict';var client=require('../client');exports[_0x2f6c('0x0')]=function(){return function(){return client[_0x2f6c('0x1')](_0x2f6c('0x2'),{'options':{'raw':![],'attributes':['id',_0x2f6c('0x3'),_0x2f6c('0x4'),'strategy'],'include':[{'model':_0x2f6c('0x5'),'as':_0x2f6c('0x6'),'attributes':['id',_0x2f6c('0x3'),_0x2f6c('0x7'),_0x2f6c('0x8')]}]},'log':_0x2f6c('0x0')});};}; \ No newline at end of file +var _0x4694=['Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0x4694,0xb7));var _0x4469=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0x4694[_0x2212d1];return _0x15eec5;};'use strict';var client=require(_0x4469('0x0'));exports[_0x4469('0x1')]=function(){return function(){return client[_0x4469('0x2')](_0x4469('0x3'),{'options':{'raw':![],'attributes':['id',_0x4469('0x4'),_0x4469('0x5'),_0x4469('0x6')],'include':[{'model':'User','as':_0x4469('0x7'),'attributes':['id',_0x4469('0x4'),_0x4469('0x8'),_0x4469('0x9')]}]},'log':_0x4469('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e57cadf..e097e12 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 _0x811e=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x25aa36,_0x3a8ea8){var _0x530d69=function(_0x4411e1){while(--_0x4411e1){_0x25aa36['push'](_0x25aa36['shift']());}};_0x530d69(++_0x3a8ea8);}(_0x811e,0x1cc));var _0xe811=function(_0xa024c3,_0x28ebc9){_0xa024c3=_0xa024c3-0x0;var _0x74f2e9=_0x811e[_0xa024c3];return _0x74f2e9;};'use strict';var client=require(_0xe811('0x0'));exports[_0xe811('0x1')]=function(_0x4d5a46){return client[_0xe811('0x2')](_0xe811('0x3'),{'body':_0x4d5a46,'log':'CreateFaxQueueReport'});};exports[_0xe811('0x4')]=function(_0x23912a,_0x2840e7){return client['Request'](_0xe811('0x5'),{'body':_0x2840e7,'options':{'where':{'uniqueid':_0x23912a},'order':[['id',_0xe811('0x6')]],'limit':0x1},'log':_0xe811('0x5')});}; \ No newline at end of file +var _0xf83c=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x3205ee,_0x598178){var _0x39ddeb=function(_0x386a3e){while(--_0x386a3e){_0x3205ee['push'](_0x3205ee['shift']());}};_0x39ddeb(++_0x598178);}(_0xf83c,0x78));var _0xcf83=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0xf83c[_0x1d83db];return _0x2dc1d1;};'use strict';var client=require('../client');exports[_0xcf83('0x0')]=function(_0x556484){return client[_0xcf83('0x1')](_0xcf83('0x2'),{'body':_0x556484,'log':'CreateFaxQueueReport'});};exports[_0xcf83('0x3')]=function(_0x3ab731,_0x484a2a){return client[_0xcf83('0x1')](_0xcf83('0x4'),{'body':_0x484a2a,'options':{'where':{'uniqueid':_0x3ab731},'order':[['id','DESC']],'limit':0x1},'log':_0xcf83('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 34613ef..5374969 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 _0xc068=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0x361687,_0x2aeba4){var _0x223327=function(_0x4cf28b){while(--_0x4cf28b){_0x361687['push'](_0x361687['shift']());}};_0x223327(++_0x2aeba4);}(_0xc068,0x1a6));var _0x8c06=function(_0xb6ef81,_0x7be25f){_0xb6ef81=_0xb6ef81-0x0;var _0xa6edfe=_0xc068[_0xb6ef81];return _0xa6edfe;};'use strict';var client=require(_0x8c06('0x0'));exports[_0x8c06('0x1')]=function(){return function(){return client['Request'](_0x8c06('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8c06('0x3')],'include':[{'model':_0x8c06('0x4'),'as':_0x8c06('0x5'),'attributes':['id',_0x8c06('0x3'),_0x8c06('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x5eaa=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x36de8d,_0x140ef9){var _0x4b4326=function(_0x2b2900){while(--_0x2b2900){_0x36de8d['push'](_0x36de8d['shift']());}};_0x4b4326(++_0x140ef9);}(_0x5eaa,0x1ab));var _0xa5ea=function(_0x32c8c2,_0x5e0ab0){_0x32c8c2=_0x32c8c2-0x0;var _0x16ed42=_0x5eaa[_0x32c8c2];return _0x16ed42;};'use strict';var client=require(_0xa5ea('0x0'));exports[_0xa5ea('0x1')]=function(){return function(){return client[_0xa5ea('0x2')](_0xa5ea('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa5ea('0x4')],'include':[{'model':_0xa5ea('0x5'),'as':_0xa5ea('0x6'),'attributes':['id','name',_0xa5ea('0x7')]}]},'log':_0xa5ea('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 71e4cc4..edae0eb 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61e=['addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0xf61e,0x191));var _0xef61=function(_0x5c3a56,_0x582ecc){_0x5c3a56=_0x5c3a56-0x0;var _0x4e55de=_0xf61e[_0x5c3a56];return _0x4e55de;};'use strict';var client=require(_0xef61('0x0'));exports[_0xef61('0x1')]=function(_0xe535c3,_0xcf15bd){return client[_0xef61('0x2')](_0xef61('0x3'),{'body':_0xcf15bd,'options':{'where':{'id':_0xe535c3}},'log':_0xef61('0x4')});};exports[_0xef61('0x5')]=function(_0x2bd1d0,_0x14122a){return client[_0xef61('0x2')](_0xef61('0x6'),{'body':_0x14122a,'options':{'where':{'id':_0x2bd1d0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xeb3b=['../client','update','Request','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x35e1a8,_0x3556f1){var _0x25d163=function(_0x238f29){while(--_0x238f29){_0x35e1a8['push'](_0x35e1a8['shift']());}};_0x25d163(++_0x3556f1);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0xeb3b[_0x5b7963];return _0x57f611;};'use strict';var client=require(_0xbeb3('0x0'));exports[_0xbeb3('0x1')]=function(_0xc5aaa3,_0x33e049){return client[_0xbeb3('0x2')]('UpdateMailInteraction',{'body':_0x33e049,'options':{'where':{'id':_0xc5aaa3}},'log':'updateMailInteraction'});};exports[_0xbeb3('0x3')]=function(_0x5b0e3b,_0x2e8ce3){return client['Request'](_0xbeb3('0x4'),{'body':_0x2e8ce3,'options':{'where':{'id':_0x5b0e3b}},'log':_0xbeb3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 9ffb838..16ba2c7 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 _0x6b85=['../client','create','createMailMessage'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x6b85,0xc0));var _0x56b8=function(_0xd1e1d5,_0xc5f71c){_0xd1e1d5=_0xd1e1d5-0x0;var _0x4e7e61=_0x6b85[_0xd1e1d5];return _0x4e7e61;};'use strict';var client=require(_0x56b8('0x0'));exports[_0x56b8('0x1')]=function(_0x56ef1b){return client['Request']('CreateMailMessage',{'body':_0x56ef1b,'log':_0x56b8('0x2')});}; \ No newline at end of file +var _0xd56e=['../client','create','Request','createMailMessage'];(function(_0x109e4c,_0x17d52c){var _0x5c244a=function(_0x47ed73){while(--_0x47ed73){_0x109e4c['push'](_0x109e4c['shift']());}};_0x5c244a(++_0x17d52c);}(_0xd56e,0x1ec));var _0xed56=function(_0x188afd,_0x7656f3){_0x188afd=_0x188afd-0x0;var _0x173405=_0xd56e[_0x188afd];return _0x173405;};'use strict';var client=require(_0xed56('0x0'));exports[_0xed56('0x1')]=function(_0x452756){return client[_0xed56('0x2')]('CreateMailMessage',{'body':_0x452756,'log':_0xed56('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 844a71b..0fa8a2c 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 _0x778d=['User','Agents','online','mailPause','getMailQueues','Request','name','timeout','strategy'];(function(_0x31d3be,_0x3ffcae){var _0x1bf996=function(_0x523a8c){while(--_0x523a8c){_0x31d3be['push'](_0x31d3be['shift']());}};_0x1bf996(++_0x3ffcae);}(_0x778d,0x70));var _0xd778=function(_0xaf808c,_0x5f1ef1){_0xaf808c=_0xaf808c-0x0;var _0x318df8=_0x778d[_0xaf808c];return _0x318df8;};'use strict';var client=require('../client');exports[_0xd778('0x0')]=function(){return function(){return client[_0xd778('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xd778('0x2'),_0xd778('0x3'),_0xd778('0x4')],'include':[{'model':_0xd778('0x5'),'as':_0xd778('0x6'),'attributes':['id',_0xd778('0x2'),_0xd778('0x7'),_0xd778('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x89f5=['GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause','getMailQueues','Request'];(function(_0x2db9d3,_0x1f503c){var _0x3b0d4a=function(_0x209971){while(--_0x209971){_0x2db9d3['push'](_0x2db9d3['shift']());}};_0x3b0d4a(++_0x1f503c);}(_0x89f5,0x1d5));var _0x589f=function(_0x1415c4,_0xea0f21){_0x1415c4=_0x1415c4-0x0;var _0xec5cbb=_0x89f5[_0x1415c4];return _0xec5cbb;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x589f('0x0')](_0x589f('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x589f('0x2'),_0x589f('0x3')],'include':[{'model':_0x589f('0x4'),'as':_0x589f('0x5'),'attributes':['id',_0x589f('0x6'),_0x589f('0x7'),_0x589f('0x8')]}]},'log':_0x589f('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 47eef5a..4792e8f 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 _0x08c3=['DESC','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x223850,_0x4e556a){var _0x2a57ee=function(_0x370667){while(--_0x370667){_0x223850['push'](_0x223850['shift']());}};_0x2a57ee(++_0x4e556a);}(_0x08c3,0xd9));var _0x308c=function(_0x3b204d,_0x2868c6){_0x3b204d=_0x3b204d-0x0;var _0x31c4dd=_0x08c3[_0x3b204d];return _0x31c4dd;};'use strict';var client=require('../client');exports[_0x308c('0x0')]=function(_0x2ea513){return client['Request']('CreateMailQueueReport',{'body':_0x2ea513,'log':_0x308c('0x1')});};exports[_0x308c('0x2')]=function(_0x57abb4,_0x26e472){return client[_0x308c('0x3')](_0x308c('0x4'),{'body':_0x26e472,'options':{'where':{'uniqueid':_0x57abb4},'order':[['id',_0x308c('0x5')]],'limit':0x1},'log':_0x308c('0x4')});}; \ No newline at end of file +var _0x83d1=['../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x12fb4c,_0xe3f37d){var _0x1b982e=function(_0x5e9b87){while(--_0x5e9b87){_0x12fb4c['push'](_0x12fb4c['shift']());}};_0x1b982e(++_0xe3f37d);}(_0x83d1,0x1a4));var _0x183d=function(_0x2a0a0b,_0x1699a6){_0x2a0a0b=_0x2a0a0b-0x0;var _0x251c2e=_0x83d1[_0x2a0a0b];return _0x251c2e;};'use strict';var client=require(_0x183d('0x0'));exports['create']=function(_0x373309){return client[_0x183d('0x1')](_0x183d('0x2'),{'body':_0x373309,'log':'CreateMailQueueReport'});};exports[_0x183d('0x3')]=function(_0x839824,_0x3d920f){return client[_0x183d('0x1')](_0x183d('0x4'),{'body':_0x3d920f,'options':{'where':{'uniqueid':_0x839824},'order':[['id','DESC']],'limit':0x1},'log':_0x183d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 12468b5..20cd3f5 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 _0xae8e=['addTagsToChatInteraction','../client','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction'];(function(_0x1d69d4,_0x10de54){var _0x5a4a09=function(_0x533090){while(--_0x533090){_0x1d69d4['push'](_0x1d69d4['shift']());}};_0x5a4a09(++_0x10de54);}(_0xae8e,0x1dc));var _0xeae8=function(_0x15eeb9,_0x4ab07e){_0x15eeb9=_0x15eeb9-0x0;var _0x5391d9=_0xae8e[_0x15eeb9];return _0x5391d9;};'use strict';var client=require(_0xeae8('0x0'));exports['update']=function(_0x34c030,_0x176934){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x176934,'options':{'where':{'id':_0x34c030}},'log':_0xeae8('0x1')});};exports['addTags']=function(_0x5539ee,_0x491529){return client[_0xeae8('0x2')](_0xeae8('0x3'),{'body':_0x491529,'options':{'where':{'id':_0x5539ee}},'log':_0xeae8('0x4')});}; \ No newline at end of file +var _0x6049=['Request','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x5a13dd,_0x2bfd88){var _0x2455f8=function(_0xa5218e){while(--_0xa5218e){_0x5a13dd['push'](_0x5a13dd['shift']());}};_0x2455f8(++_0x2bfd88);}(_0x6049,0x180));var _0x9604=function(_0x4241b4,_0x303883){_0x4241b4=_0x4241b4-0x0;var _0x2f1bf8=_0x6049[_0x4241b4];return _0x2f1bf8;};'use strict';var client=require('../client');exports[_0x9604('0x0')]=function(_0x2ce480,_0x311c3c){return client[_0x9604('0x1')]('UpdateOpenchannelInteraction',{'body':_0x311c3c,'options':{'where':{'id':_0x2ce480}},'log':'updateOpenchannelInteraction'});};exports[_0x9604('0x2')]=function(_0x14470f,_0x24386d){return client[_0x9604('0x1')](_0x9604('0x3'),{'body':_0x24386d,'options':{'where':{'id':_0x14470f}},'log':_0x9604('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3fd80a8..8971f96 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 _0xcd6a=['createOpenchannelMessage','../client','create','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcd6a,0x79));var _0xacd6=function(_0x305347,_0x3cddbe){_0x305347=_0x305347-0x0;var _0x2076cc=_0xcd6a[_0x305347];return _0x2076cc;};'use strict';var client=require(_0xacd6('0x0'));exports[_0xacd6('0x1')]=function(_0x5193e3){return client[_0xacd6('0x2')]('CreateOpenchannelMessage',{'body':_0x5193e3,'log':_0xacd6('0x3')});}; \ No newline at end of file +var _0xa5c0=['CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x2b91fb,_0x3c47ac){var _0xffd6ad=function(_0x5185ef){while(--_0x5185ef){_0x2b91fb['push'](_0x2b91fb['shift']());}};_0xffd6ad(++_0x3c47ac);}(_0xa5c0,0xf2));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0a5c('0x0'));exports['create']=function(_0x2c0417){return client['Request'](_0x0a5c('0x1'),{'body':_0x2c0417,'log':_0x0a5c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 738da96..246a298 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 _0x923d=['Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x4180c6,_0x642cf3){var _0xe0e5aa=function(_0x37f4e8){while(--_0x37f4e8){_0x4180c6['push'](_0x4180c6['shift']());}};_0xe0e5aa(++_0x642cf3);}(_0x923d,0xdf));var _0xd923=function(_0xf83d72,_0x4f67aa){_0xf83d72=_0xf83d72-0x0;var _0x23cea1=_0x923d[_0xf83d72];return _0x23cea1;};'use strict';var client=require('../client');exports[_0xd923('0x0')]=function(){return function(){return client[_0xd923('0x1')](_0xd923('0x2'),{'options':{'raw':![],'attributes':['id',_0xd923('0x3'),_0xd923('0x4'),_0xd923('0x5')],'include':[{'model':_0xd923('0x6'),'as':_0xd923('0x7'),'attributes':['id','name',_0xd923('0x8'),_0xd923('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x8ea4=['User','Agents','online','openchannelPause','getOpenchannelQueues','../client','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x5285f0,_0x3a9ed7){var _0x51e77d=function(_0x5253f3){while(--_0x5253f3){_0x5285f0['push'](_0x5285f0['shift']());}};_0x51e77d(++_0x3a9ed7);}(_0x8ea4,0x1b3));var _0x48ea=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x8ea4[_0x491a7f];return _0x3d8f44;};'use strict';var client=require(_0x48ea('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x48ea('0x1'),{'options':{'raw':![],'attributes':['id',_0x48ea('0x2'),_0x48ea('0x3'),_0x48ea('0x4')],'include':[{'model':_0x48ea('0x5'),'as':_0x48ea('0x6'),'attributes':['id',_0x48ea('0x2'),_0x48ea('0x7'),_0x48ea('0x8')]}]},'log':_0x48ea('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index eaad204..a45bbd9 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 _0x195e=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x34503b,_0x10ceec){var _0xdc2736=function(_0x15ac6f){while(--_0x15ac6f){_0x34503b['push'](_0x34503b['shift']());}};_0xdc2736(++_0x10ceec);}(_0x195e,0xa1));var _0xe195=function(_0x496224,_0x4ba496){_0x496224=_0x496224-0x0;var _0x430870=_0x195e[_0x496224];return _0x430870;};'use strict';var client=require(_0xe195('0x0'));exports['create']=function(_0x533cad){return client[_0xe195('0x1')](_0xe195('0x2'),{'body':_0x533cad,'log':_0xe195('0x2')});};exports[_0xe195('0x3')]=function(_0x28337c,_0x546613){return client[_0xe195('0x1')](_0xe195('0x4'),{'body':_0x546613,'options':{'where':{'uniqueid':_0x28337c},'order':[['id',_0xe195('0x5')]],'limit':0x1},'log':_0xe195('0x4')});}; \ No newline at end of file +var _0xb9fc=['update','DESC','Request','CreateOpenchannelQueueReport'];(function(_0xb0330a,_0x4b4d04){var _0x3b1396=function(_0x26d9a0){while(--_0x26d9a0){_0xb0330a['push'](_0xb0330a['shift']());}};_0x3b1396(++_0x4b4d04);}(_0xb9fc,0x6e));var _0xcb9f=function(_0x589794,_0x409573){_0x589794=_0x589794-0x0;var _0x130c76=_0xb9fc[_0x589794];return _0x130c76;};'use strict';var client=require('../client');exports['create']=function(_0x33bd84){return client[_0xcb9f('0x0')](_0xcb9f('0x1'),{'body':_0x33bd84,'log':_0xcb9f('0x1')});};exports[_0xcb9f('0x2')]=function(_0x96544b,_0x4549f2){return client[_0xcb9f('0x0')]('UpdateOpenchannelQueueReport',{'body':_0x4549f2,'options':{'where':{'uniqueid':_0x96544b},'order':[['id',_0xcb9f('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1b39157..ba033fa 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 _0xc5c7=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x13f00f,_0x425f9f){_0x13f00f=_0x13f00f-0x0;var _0x9d5330=_0xc5c7[_0x13f00f];return _0x9d5330;};'use strict';var client=require('../client');exports[_0x7c5c('0x0')]=function(_0x28e1a9,_0x2e1b3a){return client[_0x7c5c('0x1')](_0x7c5c('0x2'),{'body':_0x2e1b3a,'options':{'where':{'id':_0x28e1a9}},'log':_0x7c5c('0x3')});};exports['addTags']=function(_0xff325e,_0x2b4355){return client[_0x7c5c('0x1')](_0x7c5c('0x4'),{'body':_0x2b4355,'options':{'where':{'id':_0xff325e}},'log':_0x7c5c('0x5')});}; \ No newline at end of file +var _0x5c37=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x335141,_0x7d1994){var _0x34864d=function(_0x493454){while(--_0x493454){_0x335141['push'](_0x335141['shift']());}};_0x34864d(++_0x7d1994);}(_0x5c37,0x11e));var _0x75c3=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x5c37[_0x531d15];return _0x271a18;};'use strict';var client=require(_0x75c3('0x0'));exports[_0x75c3('0x1')]=function(_0x302a73,_0x43cf5a){return client[_0x75c3('0x2')](_0x75c3('0x3'),{'body':_0x43cf5a,'options':{'where':{'id':_0x302a73}},'log':'updateSmsInteraction'});};exports[_0x75c3('0x4')]=function(_0x2e1094,_0x207698){return client['Request'](_0x75c3('0x5'),{'body':_0x207698,'options':{'where':{'id':_0x2e1094}},'log':_0x75c3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c4e464e..e09d26f 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 _0x7782=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x1a9fb5,_0x20d367){var _0x53c0a2=function(_0x4340ad){while(--_0x4340ad){_0x1a9fb5['push'](_0x1a9fb5['shift']());}};_0x53c0a2(++_0x20d367);}(_0x7782,0xd6));var _0x2778=function(_0x6f7a64,_0x5e4222){_0x6f7a64=_0x6f7a64-0x0;var _0x48225f=_0x7782[_0x6f7a64];return _0x48225f;};'use strict';var client=require(_0x2778('0x0'));exports[_0x2778('0x1')]=function(_0x14fa59){return client[_0x2778('0x2')](_0x2778('0x3'),{'body':_0x14fa59,'log':_0x2778('0x4')});}; \ No newline at end of file +var _0x672a=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x324e1c,_0x402538){var _0x3cac6b=function(_0x34f8cf){while(--_0x34f8cf){_0x324e1c['push'](_0x324e1c['shift']());}};_0x3cac6b(++_0x402538);}(_0x672a,0x1bf));var _0xa672=function(_0x4de9f3,_0x36fb2c){_0x4de9f3=_0x4de9f3-0x0;var _0x2185c2=_0x672a[_0x4de9f3];return _0x2185c2;};'use strict';var client=require(_0xa672('0x0'));exports[_0xa672('0x1')]=function(_0x10bd5c){return client[_0xa672('0x2')](_0xa672('0x3'),{'body':_0x10bd5c,'log':_0xa672('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9fbc7ed..6500566 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x208426,_0x2b1a5c){var _0x4420f4=function(_0xd1661b){while(--_0xd1661b){_0x208426['push'](_0x208426['shift']());}};_0x4420f4(++_0x2b1a5c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xcb91[_0x3b4b1d];return _0x488c36;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x1cc0ef,_0x411d09){var _0x1f6ed2=function(_0x34f75c){while(--_0x34f75c){_0x1cc0ef['push'](_0x1cc0ef['shift']());}};_0x1f6ed2(++_0x411d09);}(_0xb7e7,0x121));var _0x7b7e=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb7e7[_0x24259d];return _0x5a701;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b7d4a92..08d2226 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0xedd9,0xfc));var _0x9edd=function(_0x23c628,_0x320062){_0x23c628=_0x23c628-0x0;var _0x2dd978=_0xedd9[_0x23c628];return _0x2dd978;};'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 +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x5cba27,_0x598fc4){var _0x288c3b=function(_0x2d59c9){while(--_0x2d59c9){_0x5cba27['push'](_0x5cba27['shift']());}};_0x288c3b(++_0x598fc4);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ec12c85..2388086 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(_0x595209,_0x157b5c){var _0x59d27e=function(_0x113101){while(--_0x113101){_0x595209['push'](_0x595209['shift']());}};_0x59d27e(++_0x157b5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x35d35d,_0xfb8c78){var _0x604622=function(_0x526141){while(--_0x526141){_0x35d35d['push'](_0x35d35d['shift']());}};_0x604622(++_0xfb8c78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 cc0a50d..53abc7b 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 _0xbd0a=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction','addTags'];(function(_0xbf083d,_0x4a2bf2){var _0x140eab=function(_0x4aa489){while(--_0x4aa489){_0xbf083d['push'](_0xbf083d['shift']());}};_0x140eab(++_0x4a2bf2);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x318e2e,_0x3db0e5){_0x318e2e=_0x318e2e-0x0;var _0x4fdc14=_0xbd0a[_0x318e2e];return _0x4fdc14;};'use strict';var client=require(_0xabd0('0x0'));exports['update']=function(_0x3b0fc0,_0x48c569){return client['Request']('UpdateWhatsappInteraction',{'body':_0x48c569,'options':{'where':{'id':_0x3b0fc0}},'log':_0xabd0('0x1')});};exports[_0xabd0('0x2')]=function(_0x41e52b,_0x3d1138){return client[_0xabd0('0x3')](_0xabd0('0x4'),{'body':_0x3d1138,'options':{'where':{'id':_0x41e52b}},'log':_0xabd0('0x5')});}; \ No newline at end of file +var _0x7c09=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','update','Request'];(function(_0xea17a7,_0x3f7d93){var _0x247ed5=function(_0x54e1be){while(--_0x54e1be){_0xea17a7['push'](_0xea17a7['shift']());}};_0x247ed5(++_0x3f7d93);}(_0x7c09,0x102));var _0x97c0=function(_0x1a20aa,_0x293d0b){_0x1a20aa=_0x1a20aa-0x0;var _0x1ee6d1=_0x7c09[_0x1a20aa];return _0x1ee6d1;};'use strict';var client=require('../client');exports[_0x97c0('0x0')]=function(_0x3aaf7c,_0x53ad71){return client[_0x97c0('0x1')](_0x97c0('0x2'),{'body':_0x53ad71,'options':{'where':{'id':_0x3aaf7c}},'log':_0x97c0('0x3')});};exports[_0x97c0('0x4')]=function(_0x12eb6d,_0x99bf54){return client[_0x97c0('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x99bf54,'options':{'where':{'id':_0x12eb6d}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 9fd4fd0..82dcb91 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 _0x222f=['Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x24243b,_0x55c567){var _0x1a85ce=function(_0x28c017){while(--_0x28c017){_0x24243b['push'](_0x24243b['shift']());}};_0x1a85ce(++_0x55c567);}(_0x222f,0x1df));var _0xf222=function(_0x1f5e4a,_0x16111e){_0x1f5e4a=_0x1f5e4a-0x0;var _0x380da7=_0x222f[_0x1f5e4a];return _0x380da7;};'use strict';var client=require(_0xf222('0x0'));exports['create']=function(_0x31d867){return client[_0xf222('0x1')](_0xf222('0x2'),{'body':_0x31d867,'log':_0xf222('0x3')});}; \ No newline at end of file +var _0xe108=['Request','CreateWhatsappMessage','../client','create'];(function(_0x4eff95,_0x329594){var _0xf1d5df=function(_0x9feece){while(--_0x9feece){_0x4eff95['push'](_0x4eff95['shift']());}};_0xf1d5df(++_0x329594);}(_0xe108,0xc2));var _0x8e10=function(_0x1760e9,_0xbbfd0b){_0x1760e9=_0x1760e9-0x0;var _0x3fe586=_0xe108[_0x1760e9];return _0x3fe586;};'use strict';var client=require(_0x8e10('0x0'));exports[_0x8e10('0x1')]=function(_0x1e55d4){return client[_0x8e10('0x2')](_0x8e10('0x3'),{'body':_0x1e55d4,'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 927eb2c..e666692 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 _0x8c36=['Agents','name','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy'];(function(_0x2af589,_0x220272){var _0x37c7f7=function(_0x486a3c){while(--_0x486a3c){_0x2af589['push'](_0x2af589['shift']());}};_0x37c7f7(++_0x220272);}(_0x8c36,0xc0));var _0x68c3=function(_0x2ca7dd,_0x21f79d){_0x2ca7dd=_0x2ca7dd-0x0;var _0x23a724=_0x8c36[_0x2ca7dd];return _0x23a724;};'use strict';var client=require(_0x68c3('0x0'));exports[_0x68c3('0x1')]=function(){return function(){return client[_0x68c3('0x2')](_0x68c3('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x68c3('0x4'),_0x68c3('0x5')],'include':[{'model':'User','as':_0x68c3('0x6'),'attributes':['id',_0x68c3('0x7'),'online',_0x68c3('0x8')]}]},'log':_0x68c3('0x1')});};}; \ No newline at end of file +var _0x9dbc=['../client','Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','getWhatsappQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dbc,0x7e));var _0xc9db=function(_0x4a4b3c,_0x42f623){_0x4a4b3c=_0x4a4b3c-0x0;var _0x126a63=_0x9dbc[_0x4a4b3c];return _0x126a63;};'use strict';var client=require(_0xc9db('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xc9db('0x1')](_0xc9db('0x2'),{'options':{'raw':![],'attributes':['id',_0xc9db('0x3'),_0xc9db('0x4'),_0xc9db('0x5')],'include':[{'model':'User','as':_0xc9db('0x6'),'attributes':['id',_0xc9db('0x3'),_0xc9db('0x7'),'whatsappPause']}]},'log':_0xc9db('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 2004bf6..c9cb62a 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 _0x816e=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x308ec2,_0xca47f4){var _0x5b4bf7=function(_0x2eaa36){while(--_0x2eaa36){_0x308ec2['push'](_0x308ec2['shift']());}};_0x5b4bf7(++_0xca47f4);}(_0x816e,0x1c8));var _0xe816=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x816e[_0x247fa1];return _0x244f35;};'use strict';var client=require(_0xe816('0x0'));exports[_0xe816('0x1')]=function(_0x485295){return client[_0xe816('0x2')]('CreateWhatsappQueueReport',{'body':_0x485295,'log':_0xe816('0x3')});};exports[_0xe816('0x4')]=function(_0x3cce17,_0x35a688){return client[_0xe816('0x2')](_0xe816('0x5'),{'body':_0x35a688,'options':{'where':{'uniqueid':_0x3cce17},'order':[['id',_0xe816('0x6')]],'limit':0x1},'log':_0xe816('0x5')});}; \ No newline at end of file +var _0x07c6=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x3e99bb,_0x5efae3){var _0x508168=function(_0x2dc805){while(--_0x2dc805){_0x3e99bb['push'](_0x3e99bb['shift']());}};_0x508168(++_0x5efae3);}(_0x07c6,0x1b2));var _0x607c=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x07c6[_0x243b2f];return _0xcb3c2d;};'use strict';var client=require(_0x607c('0x0'));exports['create']=function(_0x5c0ef5){return client[_0x607c('0x1')](_0x607c('0x2'),{'body':_0x5c0ef5,'log':_0x607c('0x2')});};exports['update']=function(_0x488346,_0x4534b8){return client['Request'](_0x607c('0x3'),{'body':_0x4534b8,'options':{'where':{'uniqueid':_0x488346},'order':[['id',_0x607c('0x4')]],'limit':0x1},'log':_0x607c('0x3')});}; \ 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 a05457f..43ded8b 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 _0x83f9=['stop','find','agents','timeout','createQueue','channel','format','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','join'];(function(_0x4c5e8b,_0x11b9fa){var _0x3ca42e=function(_0x323316){while(--_0x323316){_0x4c5e8b['push'](_0x4c5e8b['shift']());}};_0x3ca42e(++_0x11b9fa);}(_0x83f9,0x106));var _0x983f=function(_0x5937f1,_0x22132e){_0x5937f1=_0x5937f1-0x0;var _0x1f40b9=_0x83f9[_0x5937f1];return _0x1f40b9;};'use strict';var schema=require(_0x983f('0x0'));var _=require(_0x983f('0x1'));var util=require(_0x983f('0x2'));var seqqueue=require(_0x983f('0x3'));var logger=require('../../../../config/logger')(_0x983f('0x4'));var strategy=require(_0x983f('0x5'));var queue=schema({'name':{'type':_0x983f('0x6'),'required':!![],'message':_0x983f('0x7')},'timeout':{'type':_0x983f('0x8'),'message':_0x983f('0x9')}});function writeLog(_0x45f569,_0x2bb0fd,_0x54df89){return logger[_0x983f('0xa')](util['format'](_0x983f('0xb'),_0x45f569,_0x2bb0fd[_0x983f('0xc')],_0x54df89));}function handleFindAgent(_0x380be5){return function(_0xa5acf4){return _0xa5acf4[_0x983f('0xc')][_0x983f('0xd')]()===_0x380be5[_0x983f('0xd')]();};}exports['consequence']=function(_0x44f894,_0x12ded0,_0x5745ed,_0x213722){return function(_0x5b1675){try{var _0x30176b={'name':_0x12ded0[0x0],'timeout':_0x12ded0[0x1]};var _0x52cdf8=queue[_0x983f('0x0')](_0x30176b,{'typecast':!![]});if(_0x52cdf8['length']){logger[_0x983f('0xe')](_0x983f('0xf'),_0x44f894,_['map'](_0x52cdf8,'message')[_0x983f('0x10')](',\x20'));_0x5b1675[_0x983f('0x11')]();}else{var _0xd3547b=_[_0x983f('0x12')](_0x5745ed[_0x983f('0x13')],handleFindAgent(_0x30176b[_0x983f('0xc')]));if(_0xd3547b){var _0x26a744=(_0x30176b[_0x983f('0x14')]||0xa)*0x3e8;var _0x5a5cb4,_0x560d32;var _0x252a0c=seqqueue[_0x983f('0x15')](_0x26a744);_0x252a0c['id']=_0x44f894;_0x252a0c['atimeout']=_0x26a744;_0x252a0c[_0x983f('0x16')]=_0x213722['channel'];writeLog(_0x44f894,_0xd3547b,util[_0x983f('0x17')](_0x983f('0x18'),_0x26a744));_0x5745ed[_0x983f('0x19')][_0x44f894]['on'](_0x983f('0x1a'),function(){logger[_0x983f('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x44f894);clearTimeout(_0x560d32);_0x560d32=undefined;_0x252a0c[_0x983f('0x1b')]();if(_0x5745ed['rules'][_0x44f894]){delete _0x5745ed[_0x983f('0x19')][_0x44f894];}_0x5b1675[_0x983f('0x11')]();});_0x5745ed[_0x983f('0x19')][_0x44f894]['on'](_0x983f('0x1c'),function(){if(_0x5745ed['rules'][_0x44f894]){delete _0x5745ed['rules'][_0x44f894];}});_0x560d32=setTimeout(function(){logger[_0x983f('0xa')](_0x983f('0x1d'),_0x44f894);clearTimeout(_0x560d32);_0x252a0c['close']();_0x5b1675['next']();},_0x26a744);strategy['agent'](_0x252a0c,_0xd3547b,_0x5745ed,_0x213722);}else{logger['error'](_0x983f('0x1e'),_0x44f894,_0x30176b['name']);_0x5b1675[_0x983f('0x11')]();}}}catch(_0x1da0b0){console['log'](_0x1da0b0);logger[_0x983f('0xe')]('[%s][QUEUE]\x20%s',_0x44f894,_0x1da0b0['stack']);_0x5b1675[_0x983f('0x11')]();}};}; \ No newline at end of file +var _0x0e50=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','createQueue','atimeout','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','log','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','../../../../config/logger','routing','./strategy','string'];(function(_0xb2dab9,_0x2f6f99){var _0x10c6ae=function(_0x40bd7b){while(--_0x40bd7b){_0xb2dab9['push'](_0xb2dab9['shift']());}};_0x10c6ae(++_0x2f6f99);}(_0x0e50,0x1ce));var _0x00e5=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x0e50[_0x36884e];return _0x1cc367;};'use strict';var schema=require('validate');var _=require(_0x00e5('0x0'));var util=require('util');var seqqueue=require(_0x00e5('0x1'));var logger=require(_0x00e5('0x2'))(_0x00e5('0x3'));var strategy=require(_0x00e5('0x4'));var queue=schema({'name':{'type':_0x00e5('0x5'),'required':!![],'message':_0x00e5('0x6')},'timeout':{'type':_0x00e5('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x40ac0d,_0x31aca7,_0x514dc9){return logger['info'](util['format'](_0x00e5('0x8'),_0x40ac0d,_0x31aca7[_0x00e5('0x9')],_0x514dc9));}function handleFindAgent(_0x13e81e){return function(_0xfbc777){return _0xfbc777[_0x00e5('0x9')][_0x00e5('0xa')]()===_0x13e81e[_0x00e5('0xa')]();};}exports[_0x00e5('0xb')]=function(_0x541307,_0x18e1a2,_0x10a6fd,_0x15858b){return function(_0x2be895){try{var _0x3c3f14={'name':_0x18e1a2[0x0],'timeout':_0x18e1a2[0x1]};var _0x196fac=queue[_0x00e5('0xc')](_0x3c3f14,{'typecast':!![]});if(_0x196fac[_0x00e5('0xd')]){logger['error'](_0x00e5('0xe'),_0x541307,_[_0x00e5('0xf')](_0x196fac,'message')[_0x00e5('0x10')](',\x20'));_0x2be895[_0x00e5('0x11')]();}else{var _0x3b74a1=_['find'](_0x10a6fd[_0x00e5('0x12')],handleFindAgent(_0x3c3f14['name']));if(_0x3b74a1){var _0x2b374a=(_0x3c3f14[_0x00e5('0x13')]||0xa)*0x3e8;var _0x124d85,_0x2a7900;var _0x2e4b2d=seqqueue[_0x00e5('0x14')](_0x2b374a);_0x2e4b2d['id']=_0x541307;_0x2e4b2d[_0x00e5('0x15')]=_0x2b374a;_0x2e4b2d[_0x00e5('0x16')]=_0x15858b[_0x00e5('0x16')];writeLog(_0x541307,_0x3b74a1,util['format']('START:%s',_0x2b374a));_0x10a6fd[_0x00e5('0x17')][_0x541307]['on'](_0x00e5('0x18'),function(){logger[_0x00e5('0x19')](_0x00e5('0x1a'),_0x541307);clearTimeout(_0x2a7900);_0x2a7900=undefined;_0x2e4b2d[_0x00e5('0x1b')]();if(_0x10a6fd['rules'][_0x541307]){delete _0x10a6fd['rules'][_0x541307];}_0x2be895[_0x00e5('0x11')]();});_0x10a6fd[_0x00e5('0x17')][_0x541307]['on'](_0x00e5('0x1c'),function(){if(_0x10a6fd['rules'][_0x541307]){delete _0x10a6fd[_0x00e5('0x17')][_0x541307];}});_0x2a7900=setTimeout(function(){logger[_0x00e5('0x19')](_0x00e5('0x1d'),_0x541307);clearTimeout(_0x2a7900);_0x2e4b2d[_0x00e5('0x1b')]();_0x2be895[_0x00e5('0x1e')]();},_0x2b374a);strategy[_0x00e5('0x1f')](_0x2e4b2d,_0x3b74a1,_0x10a6fd,_0x15858b);}else{logger[_0x00e5('0x20')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x541307,_0x3c3f14[_0x00e5('0x9')]);_0x2be895['stop']();}}}catch(_0xb5ae6c){console[_0x00e5('0x21')](_0xb5ae6c);logger['error'](_0x00e5('0x22'),_0x541307,_0xb5ae6c[_0x00e5('0x23')]);_0x2be895[_0x00e5('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index c75dbab..728a72b 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 _0x9d76=['providerResponse','dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','Message','create','then','info','body','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','amazonlex'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0x9d76,0x1ce));var _0x69d7=function(_0x1f6563,_0x216261){_0x1f6563=_0x1f6563-0x0;var _0x744817=_0x9d76[_0x1f6563];return _0x744817;};'use strict';var _=require(_0x69d7('0x0'));var moment=require(_0x69d7('0x1'));var AWS=require(_0x69d7('0x2'));var utils=require(_0x69d7('0x3'));var logger=require(_0x69d7('0x4'))(_0x69d7('0x5'));var rpc={'chatMessage':require(_0x69d7('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x69d7('0x7')),'smsMessage':require(_0x69d7('0x8')),'faxMessage':require(_0x69d7('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1a5c8d,_0x5caa1b){return function(_0x5ccbe1){try{if(!_[_0x69d7('0xa')](this[_0x69d7('0xb')][_0x69d7('0xc')])){logger['info'](_0x69d7('0xd'),_0x1a5c8d,_0x69d7('0xe'));return _0x5ccbe1[_0x69d7('0xf')]();}var _0x2383e1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x69d7('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x69d7('0x11')};if(this[_0x69d7('0x12')]==='sms'||this[_0x69d7('0x12')]===_0x69d7('0x13')){_0x2383e1[_0x69d7('0x14')]=this[_0x69d7('0xb')][_0x69d7('0x14')];}var _0xa23cb9=this[_0x69d7('0x12')];if(_0xa23cb9===_0x69d7('0x15')){_0x2383e1[_0x69d7('0x16')]=this['account']['id'];}else{_0x2383e1[_[_0x69d7('0x17')](_0xa23cb9)+_0x69d7('0x18')]=this[_0x69d7('0x19')]['id'];}_0x2383e1[_[_0x69d7('0x17')](_0xa23cb9)+_0x69d7('0x1a')]=this['interaction']['id'];if(this[_0x69d7('0xb')][_0x69d7('0x1b')]){var _0x1fea2d=_0x5caa1b[0x4];if(!_['isEmpty'](_0x1fea2d)){_0x2383e1['body']=utils['getMustacheRender'](_0x1fea2d,this);return rpc[_0xa23cb9+_0x69d7('0x1c')][_0x69d7('0x1d')](_0x2383e1)[_0x69d7('0x1e')](function(_0x94951){logger[_0x69d7('0x1f')](_0x69d7('0xd'),_0x1a5c8d,_0x2383e1[_0x69d7('0x20')]);})[_0x69d7('0x21')](function(_0x2d6041){logger[_0x69d7('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1a5c8d,JSON[_0x69d7('0x23')](_0x2d6041));})[_0x69d7('0x24')](function(){logger[_0x69d7('0x1f')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1a5c8d);_0x5ccbe1[_0x69d7('0x25')]();});}else{logger[_0x69d7('0x1f')](_0x69d7('0x26'),_0x1a5c8d);_0x5ccbe1[_0x69d7('0x25')]();}}else{var _0x42b338=this;var _0x47c8ce=new AWS[(_0x69d7('0x27'))]({'accessKeyId':_0x5caa1b[0x0],'secretAccessKey':_0x5caa1b[0x1],'region':_0x5caa1b[0x2]});var _0x353977={'botAlias':_0x69d7('0x28'),'botName':_0x5caa1b[0x3],'inputText':this[_0x69d7('0x29')][_0x69d7('0x20')],'userId':this[_0x69d7('0x12')]+':'+this['interaction']['id']['toString']()};_0x47c8ce[_0x69d7('0x2a')](_0x353977,function(_0x2cad91,_0x579fe1){if(_0x2cad91){logger[_0x69d7('0x22')](_0x69d7('0xd'),_0x1a5c8d,_0x2cad91[_0x69d7('0x29')]);_0x5ccbe1[_0x69d7('0xf')]();}else if(_0x579fe1&&_0x579fe1[_0x69d7('0x29')]){_0x42b338[_0x69d7('0x20')][_0x69d7('0x2b')]=_0x579fe1;_0x2383e1[_0x69d7('0x20')]=_0x579fe1[_0x69d7('0x29')];_0x2383e1['providerName']=_0x69d7('0x2b');_0x2383e1[_0x69d7('0x2c')]=JSON['stringify'](_0x579fe1);return rpc[_0xa23cb9+_0x69d7('0x1c')][_0x69d7('0x1d')](_0x2383e1)[_0x69d7('0x1e')](function(_0x5e7741){logger[_0x69d7('0x1f')](_0x69d7('0xd'),_0x1a5c8d,_0x2383e1[_0x69d7('0x20')]);if(_0x579fe1[_0x69d7('0x2d')]=='Failed'){_0x5ccbe1['next']();}else{_0x5ccbe1['stop']();}})['catch'](function(_0x3ea026){logger[_0x69d7('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1a5c8d,JSON[_0x69d7('0x23')](_0x3ea026));_0x5ccbe1['next']();});}else{_0x5ccbe1[_0x69d7('0xf')]();}});}}catch(_0x51164a){logger[_0x69d7('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1a5c8d,JSON['stringify'](_0x51164a));_0x5ccbe1['stop']();}};}; \ No newline at end of file +var _0xa0d8=['ChatWebsiteId','AccountId','account','created','isEmpty','body','Message','create','[%s][AMAZONLEX]\x20%s','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','postText','amazonlex','providerName','providerResponse','stringify','then','dialogState','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone'];(function(_0x26bdb0,_0x5b6eef){var _0xe5070=function(_0xb58e02){while(--_0xb58e02){_0x26bdb0['push'](_0x26bdb0['shift']());}};_0xe5070(++_0x5b6eef);}(_0xa0d8,0x1ce));var _0x8a0d=function(_0x2db098,_0x2a5133){_0x2db098=_0x2db098-0x0;var _0x1cb4d7=_0xa0d8[_0x2db098];return _0x1cb4d7;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x8a0d('0x0'));var utils=require(_0x8a0d('0x1'));var logger=require('../../../../config/logger')(_0x8a0d('0x2'));var rpc={'chatMessage':require(_0x8a0d('0x3')),'openchannelMessage':require(_0x8a0d('0x4')),'mailMessage':require(_0x8a0d('0x5')),'smsMessage':require(_0x8a0d('0x6')),'faxMessage':require(_0x8a0d('0x7')),'whatsappMessage':require(_0x8a0d('0x8'))};exports[_0x8a0d('0x9')]=function(_0x3c2d18,_0x56c1c9){return function(_0x2f83c9){try{if(!_[_0x8a0d('0xa')](this[_0x8a0d('0xb')][_0x8a0d('0xc')])){logger[_0x8a0d('0xd')]('[%s][AMAZONLEX]\x20%s',_0x3c2d18,_0x8a0d('0xe'));return _0x2f83c9[_0x8a0d('0xf')]();}var _0x14e8f6={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8a0d('0x10')](_0x8a0d('0x11')),'direction':_0x8a0d('0x12')};if(this[_0x8a0d('0x13')]==='sms'||this[_0x8a0d('0x13')]===_0x8a0d('0x14')){_0x14e8f6[_0x8a0d('0x15')]=this[_0x8a0d('0xb')][_0x8a0d('0x15')];}var _0x2ce029=this[_0x8a0d('0x13')];if(_0x2ce029==='chat'){_0x14e8f6[_0x8a0d('0x16')]=this['account']['id'];}else{_0x14e8f6[_['upperFirst'](_0x2ce029)+_0x8a0d('0x17')]=this[_0x8a0d('0x18')]['id'];}_0x14e8f6[_['upperFirst'](_0x2ce029)+'InteractionId']=this[_0x8a0d('0xb')]['id'];if(this[_0x8a0d('0xb')][_0x8a0d('0x19')]){var _0x3c13c8=_0x56c1c9[0x4];if(!_[_0x8a0d('0x1a')](_0x3c13c8)){_0x14e8f6[_0x8a0d('0x1b')]=utils['getMustacheRender'](_0x3c13c8,this);return rpc[_0x2ce029+_0x8a0d('0x1c')][_0x8a0d('0x1d')](_0x14e8f6)['then'](function(_0x543430){logger['info'](_0x8a0d('0x1e'),_0x3c2d18,_0x14e8f6[_0x8a0d('0x1b')]);})[_0x8a0d('0x1f')](function(_0x42707){logger[_0x8a0d('0x20')]('[%s][AMAZONLEX]\x20%s',_0x3c2d18,JSON['stringify'](_0x42707));})[_0x8a0d('0x21')](function(){logger[_0x8a0d('0xd')](_0x8a0d('0x22'),_0x3c2d18);_0x2f83c9[_0x8a0d('0x23')]();});}else{logger[_0x8a0d('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3c2d18);_0x2f83c9['stop']();}}else{var _0x4c98fa=this;var _0x38fe70=new AWS['LexRuntime']({'accessKeyId':_0x56c1c9[0x0],'secretAccessKey':_0x56c1c9[0x1],'region':_0x56c1c9[0x2]});var _0x2fffe9={'botAlias':'$LATEST','botName':_0x56c1c9[0x3],'inputText':this[_0x8a0d('0x24')][_0x8a0d('0x1b')],'userId':this[_0x8a0d('0x13')]+':'+this[_0x8a0d('0xb')]['id']['toString']()};_0x38fe70[_0x8a0d('0x25')](_0x2fffe9,function(_0x21713c,_0x4c1df6){if(_0x21713c){logger[_0x8a0d('0x20')](_0x8a0d('0x1e'),_0x3c2d18,_0x21713c[_0x8a0d('0x24')]);_0x2f83c9[_0x8a0d('0xf')]();}else if(_0x4c1df6&&_0x4c1df6['message']){_0x4c98fa[_0x8a0d('0x1b')][_0x8a0d('0x26')]=_0x4c1df6;_0x14e8f6[_0x8a0d('0x1b')]=_0x4c1df6['message'];_0x14e8f6[_0x8a0d('0x27')]=_0x8a0d('0x26');_0x14e8f6[_0x8a0d('0x28')]=JSON[_0x8a0d('0x29')](_0x4c1df6);return rpc[_0x2ce029+_0x8a0d('0x1c')][_0x8a0d('0x1d')](_0x14e8f6)[_0x8a0d('0x2a')](function(_0x1c5efe){logger[_0x8a0d('0xd')](_0x8a0d('0x1e'),_0x3c2d18,_0x14e8f6[_0x8a0d('0x1b')]);if(_0x4c1df6[_0x8a0d('0x2b')]=='Failed'){_0x2f83c9[_0x8a0d('0xf')]();}else{_0x2f83c9['stop']();}})[_0x8a0d('0x1f')](function(_0x4bfb82){logger['error'](_0x8a0d('0x1e'),_0x3c2d18,JSON[_0x8a0d('0x29')](_0x4bfb82));_0x2f83c9[_0x8a0d('0xf')]();});}else{_0x2f83c9[_0x8a0d('0xf')]();}});}}catch(_0x396791){logger[_0x8a0d('0x20')]('[%s][AMAZONLEX]\x20%s',_0x3c2d18,JSON[_0x8a0d('0x29')](_0x396791));_0x2f83c9[_0x8a0d('0x23')]();}};}; \ 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 e15d620..57d4787 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 _0x8042=['stringify','catch','error','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','mail','body','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','replace','','headers','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','then'];(function(_0x355e93,_0x30fe47){var _0x39c654=function(_0x1740fe){while(--_0x1740fe){_0x355e93['push'](_0x355e93['shift']());}};_0x39c654(++_0x30fe47);}(_0x8042,0x1ed));var _0x2804=function(_0x3ec0dd,_0x3a5e67){_0x3ec0dd=_0x3ec0dd-0x0;var _0x2818c7=_0x8042[_0x3ec0dd];return _0x2818c7;};'use strict';var _=require(_0x2804('0x0'));var moment=require(_0x2804('0x1'));var utils=require('./utils');var logger=require(_0x2804('0x2'))(_0x2804('0x3'));var rpc={'chatMessage':require(_0x2804('0x4')),'openchannelMessage':require(_0x2804('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2804('0x6')),'faxMessage':require(_0x2804('0x7')),'whatsappMessage':require(_0x2804('0x8')),'chatInteraction':require(_0x2804('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x2804('0xa')),'smsInteraction':require(_0x2804('0xb')),'faxInteraction':require(_0x2804('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x2804('0xd'));exports[_0x2804('0xe')]=function(_0x5c5739,_0x5c088a,_0x11cac0,_0x462dcd){return function(_0x1a2a01){try{var _0x34c542=this['channel'];if(_0x34c542===_0x2804('0xf')&&_0x462dcd[_0x2804('0x10')]['isAutoreply']){logger[_0x2804('0x11')](_0x2804('0x12'),_0x5c5739,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1a2a01[_0x2804('0x13')]();}if(_0x5c088a[0x0]==='1'&&(_[_0x2804('0x14')](this['interaction']['created'])||!this[_0x2804('0x15')][_0x2804('0x16')])){logger['info'](_0x2804('0x12'),_0x5c5739,_0x2804('0x17'));return _0x1a2a01['next']();}if(_0x5c088a[0x0]==='2'&&this[_0x2804('0x15')][_0x2804('0x18')]){logger[_0x2804('0x11')](_0x2804('0x19'),_0x5c5739,_0x2804('0x1a'));return _0x1a2a01[_0x2804('0x13')]();}var _0x2794ea={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2804('0x1b')](_0x2804('0x1c')),'direction':_0x2804('0x1d')};if(this[_0x2804('0x1e')]===_0x2804('0xf')){_0x2794ea['body']=utils[_0x2804('0x1f')](_0x5c088a[0x2],this);}else{_0x2794ea[_0x2804('0x10')]=utils[_0x2804('0x1f')](_0x5c088a[0x1],this);}if(this[_0x2804('0x20')]){_0x2794ea['to']=this[_0x2804('0x20')]['from']||'';if(this['channel']==='mail'&&_0x5c088a[0x1]==='1'){_0x2794ea['cc']=this[_0x2804('0x20')]['cc']||'';}_0x2794ea[_0x2804('0x21')]=this[_0x2804('0x20')]['to']||'';_0x2794ea[_0x2804('0x22')]=this[_0x2804('0x20')][_0x2804('0x22')]||'';_0x2794ea[_0x2804('0x23')]=!![];if(this[_0x2804('0x20')][_0x2804('0x24')]){_0x2794ea[_0x2804('0x24')]='';_0x2794ea[_0x2804('0x24')]+=_[_0x2804('0x25')](this['message'][_0x2804('0x24')],_0x2804('0x26'))?'':'Re:\x20';_0x2794ea['subject']+=this[_0x2804('0x20')][_0x2804('0x24')];}}if(this[_0x2804('0x1e')]===_0x2804('0x27')){_0x2794ea[_0x2804('0x28')]=this[_0x2804('0x29')]['id'];}else{_0x2794ea[_[_0x2804('0x2a')](this[_0x2804('0x1e')])+_0x2804('0x2b')]=this[_0x2804('0x29')]['id'];}_0x2794ea[_[_0x2804('0x2a')](this[_0x2804('0x1e')])+_0x2804('0x2c')]=this[_0x2804('0x15')]['id'];var _0x212380=this[_0x2804('0x15')];if(rpc[this[_0x2804('0x1e')]+_0x2804('0x2d')]){if(this[_0x2804('0x1e')]==='mail'){_0x2794ea[_0x2804('0x2e')]=this[_0x2804('0x20')][_0x2804('0x2f')];_0x2794ea[_0x2804('0x30')]=''+_[_0x2804('0x31')](_0x2794ea[_0x2804('0x10')],_0x2804('0x32'),_0x2804('0x33'))+_0x2804('0x34');_0x2794ea[_0x2804('0x35')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x2804('0x36'),'Precedence':_0x2804('0x37')};return mailRpc[_0x2804('0x38')](this[_0x2804('0x29')]['smtpOptions'],_0x2794ea)['then'](function(_0xa283b2){logger[_0x2804('0x11')](_0x2804('0x39'),_0x5c5739);_0x2794ea[_0x2804('0x2f')]=_0xa283b2[_0x2804('0x20')]['messageId'];return rpc[_0x34c542+_0x2804('0x2d')]['create'](_0x2794ea);})[_0x2804('0x3a')](function(_0x53cfae){logger[_0x2804('0x11')](_0x2804('0x12'),_0x5c5739,JSON[_0x2804('0x3b')](_0x53cfae));})[_0x2804('0x3c')](function(_0x5450d4){logger[_0x2804('0x3d')]('[RPC][%s][AUTOREPLY]\x20%s',_0x5c5739,JSON[_0x2804('0x3b')](_0x5450d4));})['finally'](function(){Promise[_0x2804('0x3e')]()[_0x2804('0x3a')](function(){if(_0x5c088a[0x0]!=='2'||_0x212380[_0x2804('0x18')])return;return rpc[_0x34c542+_0x2804('0x3f')][_0x2804('0x40')](_0x212380['id'],{'autoreplyExecuted':!![]})[_0x2804('0x3a')](function(_0x5026c1){logger['info'](_0x2804('0x19'),_0x5c5739,JSON[_0x2804('0x3b')](_0x5026c1));})[_0x2804('0x3c')](function(_0x16dbab){logger['error'](_0x2804('0x41'),_0x5c5739,JSON['stringify'](_0x16dbab));});})[_0x2804('0x3a')](function(){_0x1a2a01[_0x2804('0x13')]();});});}else{return rpc[this[_0x2804('0x1e')]+_0x2804('0x2d')][_0x2804('0x42')](_0x2794ea)[_0x2804('0x3a')](function(){logger[_0x2804('0x11')](_0x2804('0x12'),_0x5c5739,_0x2794ea['body']);})[_0x2804('0x3c')](function(_0x14b621){logger[_0x2804('0x3d')](_0x2804('0x12'),_0x5c5739,JSON['stringify'](_0x14b621));})[_0x2804('0x43')](function(){Promise['resolve']()[_0x2804('0x3a')](function(){if(_0x5c088a[0x0]!=='2'||_0x212380[_0x2804('0x18')])return;return rpc[_0x34c542+_0x2804('0x3f')][_0x2804('0x40')](_0x212380['id'],{'autoreplyExecuted':!![]})['then'](function(_0x20142d){logger[_0x2804('0x11')](_0x2804('0x19'),_0x5c5739,JSON['stringify'](_0x20142d));})[_0x2804('0x3c')](function(_0x43c93e){logger[_0x2804('0x3d')](_0x2804('0x41'),_0x5c5739,JSON[_0x2804('0x3b')](_0x43c93e));});})[_0x2804('0x3a')](function(){_0x1a2a01[_0x2804('0x13')]();});});}}}catch(_0xa35177){logger[_0x2804('0x3d')](_0x2804('0x12'),_0x5c5739,JSON[_0x2804('0x3b')](_0xa35177));_0x1a2a01[_0x2804('0x44')]();}};}; \ No newline at end of file +var _0xed0b=['autoreplyExecuted','One\x20Time\x20already\x20sent','next','format','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','account','AccountId','upperFirst','InteractionId','Message','messageId','','replace','','headers','auto-replied','All','sendMailMessage','smtpOptions','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','created','Autoreply\x20already\x20sent'];(function(_0x1a6a0a,_0x40aa84){var _0x3295e4=function(_0x50b37f){while(--_0x50b37f){_0x1a6a0a['push'](_0x1a6a0a['shift']());}};_0x3295e4(++_0x40aa84);}(_0xed0b,0x16f));var _0xbed0=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xed0b[_0x243217];return _0x478029;};'use strict';var _=require(_0xbed0('0x0'));var moment=require('moment');var utils=require(_0xbed0('0x1'));var logger=require(_0xbed0('0x2'))(_0xbed0('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbed0('0x4')),'smsMessage':require(_0xbed0('0x5')),'faxMessage':require(_0xbed0('0x6')),'whatsappMessage':require(_0xbed0('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xbed0('0x8')),'mailInteraction':require(_0xbed0('0x9')),'smsInteraction':require(_0xbed0('0xa')),'faxInteraction':require(_0xbed0('0xb')),'whatsappInteraction':require(_0xbed0('0xc'))};var mailRpc=require(_0xbed0('0xd'));exports['consequence']=function(_0x4d331c,_0x53626b,_0x300ccb,_0x227af1){return function(_0x210331){try{var _0x107727=this[_0xbed0('0xe')];if(_0x107727==='mail'&&_0x227af1[_0xbed0('0xf')][_0xbed0('0x10')]){logger[_0xbed0('0x11')](_0xbed0('0x12'),_0x4d331c,_0xbed0('0x13'));return _0x210331['next']();}if(_0x53626b[0x0]==='1'&&(_['isNil'](this[_0xbed0('0x14')][_0xbed0('0x15')])||!this[_0xbed0('0x14')][_0xbed0('0x15')])){logger[_0xbed0('0x11')]('[%s][AUTOREPLY]\x20%s',_0x4d331c,_0xbed0('0x16'));return _0x210331['next']();}if(_0x53626b[0x0]==='2'&&this[_0xbed0('0x14')][_0xbed0('0x17')]){logger[_0xbed0('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d331c,_0xbed0('0x18'));return _0x210331[_0xbed0('0x19')]();}var _0x39561b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xbed0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xbed0('0x1b')};if(this[_0xbed0('0xe')]===_0xbed0('0x1c')){_0x39561b[_0xbed0('0xf')]=utils[_0xbed0('0x1d')](_0x53626b[0x2],this);}else{_0x39561b[_0xbed0('0xf')]=utils['getMustacheRender'](_0x53626b[0x1],this);}if(this['message']){_0x39561b['to']=this[_0xbed0('0x1e')][_0xbed0('0x1f')]||'';if(this[_0xbed0('0xe')]===_0xbed0('0x1c')&&_0x53626b[0x1]==='1'){_0x39561b['cc']=this[_0xbed0('0x1e')]['cc']||'';}_0x39561b[_0xbed0('0x1f')]=this[_0xbed0('0x1e')]['to']||'';_0x39561b[_0xbed0('0x20')]=this[_0xbed0('0x1e')]['phone']||'';_0x39561b[_0xbed0('0x21')]=!![];if(this[_0xbed0('0x1e')][_0xbed0('0x22')]){_0x39561b['subject']='';_0x39561b['subject']+=_[_0xbed0('0x23')](this[_0xbed0('0x1e')][_0xbed0('0x22')],_0xbed0('0x24'))?'':'Re:\x20';_0x39561b['subject']+=this['message']['subject'];}}if(this['channel']===_0xbed0('0x25')){_0x39561b['ChatWebsiteId']=this[_0xbed0('0x26')]['id'];}else{_0x39561b[_['upperFirst'](this[_0xbed0('0xe')])+_0xbed0('0x27')]=this[_0xbed0('0x26')]['id'];}_0x39561b[_[_0xbed0('0x28')](this[_0xbed0('0xe')])+_0xbed0('0x29')]=this[_0xbed0('0x14')]['id'];var _0x310157=this[_0xbed0('0x14')];if(rpc[this[_0xbed0('0xe')]+_0xbed0('0x2a')]){if(this[_0xbed0('0xe')]===_0xbed0('0x1c')){_0x39561b['inReplyTo']=this['message'][_0xbed0('0x2b')];_0x39561b['html']=_0xbed0('0x2c')+_[_0xbed0('0x2d')](_0x39561b[_0xbed0('0xf')],_0xbed0('0x2e'),_0xbed0('0x2f'))+_0xbed0('0x30');_0x39561b[_0xbed0('0x31')]={'Auto-Submitted':_0xbed0('0x32'),'X-Auto-Response-Suppress':_0xbed0('0x33'),'Precedence':'auto_reply'};return mailRpc[_0xbed0('0x34')](this['account'][_0xbed0('0x35')],_0x39561b)['then'](function(_0x202e74){logger[_0xbed0('0x11')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x4d331c);_0x39561b[_0xbed0('0x2b')]=_0x202e74['message'][_0xbed0('0x2b')];return rpc[_0x107727+_0xbed0('0x2a')][_0xbed0('0x36')](_0x39561b);})[_0xbed0('0x37')](function(_0x4fe4fd){logger[_0xbed0('0x11')](_0xbed0('0x12'),_0x4d331c,JSON[_0xbed0('0x38')](_0x4fe4fd));})[_0xbed0('0x39')](function(_0x4e3b5d){logger[_0xbed0('0x3a')](_0xbed0('0x3b'),_0x4d331c,JSON['stringify'](_0x4e3b5d));})[_0xbed0('0x3c')](function(){Promise['resolve']()[_0xbed0('0x37')](function(){if(_0x53626b[0x0]!=='2'||_0x310157[_0xbed0('0x17')])return;return rpc[_0x107727+_0xbed0('0x3d')][_0xbed0('0x3e')](_0x310157['id'],{'autoreplyExecuted':!![]})['then'](function(_0x14050a){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d331c,JSON[_0xbed0('0x38')](_0x14050a));})[_0xbed0('0x39')](function(_0x2e5ac4){logger[_0xbed0('0x3a')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d331c,JSON[_0xbed0('0x38')](_0x2e5ac4));});})[_0xbed0('0x37')](function(){_0x210331[_0xbed0('0x19')]();});});}else{return rpc[this[_0xbed0('0xe')]+_0xbed0('0x2a')][_0xbed0('0x36')](_0x39561b)['then'](function(){logger[_0xbed0('0x11')](_0xbed0('0x12'),_0x4d331c,_0x39561b[_0xbed0('0xf')]);})['catch'](function(_0x376849){logger[_0xbed0('0x3a')](_0xbed0('0x12'),_0x4d331c,JSON[_0xbed0('0x38')](_0x376849));})[_0xbed0('0x3c')](function(){Promise[_0xbed0('0x3f')]()[_0xbed0('0x37')](function(){if(_0x53626b[0x0]!=='2'||_0x310157['autoreplyExecuted'])return;return rpc[_0x107727+_0xbed0('0x3d')][_0xbed0('0x3e')](_0x310157['id'],{'autoreplyExecuted':!![]})[_0xbed0('0x37')](function(_0x5a8253){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d331c,JSON[_0xbed0('0x38')](_0x5a8253));})['catch'](function(_0x5c88a5){logger[_0xbed0('0x3a')](_0xbed0('0x40'),_0x4d331c,JSON[_0xbed0('0x38')](_0x5c88a5));});})[_0xbed0('0x37')](function(){_0x210331[_0xbed0('0x19')]();});});}}}catch(_0x3466de){logger['error'](_0xbed0('0x12'),_0x4d331c,JSON[_0xbed0('0x38')](_0x3466de));_0x210331['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 09e7ba8..020321b 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 _0x5574=['Interaction','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','system','channel'];(function(_0x422162,_0x159c4c){var _0x5af2f8=function(_0x46f5ad){while(--_0x46f5ad){_0x422162['push'](_0x422162['shift']());}};_0x5af2f8(++_0x159c4c);}(_0x5574,0xe6));var _0x4557=function(_0x29fdd7,_0x252b01){_0x29fdd7=_0x29fdd7-0x0;var _0x53357a=_0x5574[_0x29fdd7];return _0x53357a;};'use strict';var moment=require(_0x4557('0x0'));var logger=require('../../../../config/logger')(_0x4557('0x1'));var rpc={'chatInteraction':require(_0x4557('0x2')),'openchannelInteraction':require(_0x4557('0x3')),'smsInteraction':require(_0x4557('0x4')),'mailInteraction':require(_0x4557('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4557('0x6'))};exports[_0x4557('0x7')]=function(_0x362251,_0xf6383c,_0x42dcc2,_0x2ab204){return function(_0xf347b6){try{logger['info'](_0x4557('0x8'),_0x362251,_0xf6383c[0x0]);var _0x32fb4f={'closed':0x1,'closedAt':moment()[_0x4557('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x4557('0xa'),'disposition':_0xf6383c[0x0]};if(rpc[_0x2ab204[_0x4557('0xb')]+'Interaction']){rpc[_0x2ab204[_0x4557('0xb')]+_0x4557('0xc')]['update'](_0x2ab204[_0x4557('0xd')]['id'],_0x32fb4f)[_0x4557('0xe')](function(_0x419573){logger[_0x4557('0xf')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x362251,_0x2ab204[_0x4557('0xd')]['id']);})[_0x4557('0x10')](function(_0x18888a){logger[_0x4557('0x11')](_0x4557('0x12'),_0x362251,JSON['stringify'](_0x18888a));})[_0x4557('0x13')](function(){_0xf347b6['stop']();});}}catch(_0x57a93a){logger[_0x4557('0x11')](_0x4557('0x12'),_0x362251,JSON[_0x4557('0x14')](_0x57a93a));_0xf347b6[_0x4557('0x15')]();}};}; \ No newline at end of file +var _0x6895=['../../rpc/whatsappInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction'];(function(_0x119ef1,_0x14d235){var _0x1e60bb=function(_0x28d0e1){while(--_0x28d0e1){_0x119ef1['push'](_0x119ef1['shift']());}};_0x1e60bb(++_0x14d235);}(_0x6895,0x175));var _0x5689=function(_0x43e61d,_0x27d424){_0x43e61d=_0x43e61d-0x0;var _0x3a9d5b=_0x6895[_0x43e61d];return _0x3a9d5b;};'use strict';var moment=require(_0x5689('0x0'));var logger=require('../../../../config/logger')(_0x5689('0x1'));var rpc={'chatInteraction':require(_0x5689('0x2')),'openchannelInteraction':require(_0x5689('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5689('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5689('0x5'))};exports[_0x5689('0x6')]=function(_0xb8ddb5,_0x1907dc,_0x1c99fa,_0x4e3997){return function(_0x109a2a){try{logger[_0x5689('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0xb8ddb5,_0x1907dc[0x0]);var _0x557628={'closed':0x1,'closedAt':moment()['format'](_0x5689('0x8')),'closeReason':'system','disposition':_0x1907dc[0x0]};if(rpc[_0x4e3997[_0x5689('0x9')]+_0x5689('0xa')]){rpc[_0x4e3997['channel']+_0x5689('0xa')][_0x5689('0xb')](_0x4e3997[_0x5689('0xc')]['id'],_0x557628)['then'](function(_0x43bd12){logger[_0x5689('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xb8ddb5,_0x4e3997[_0x5689('0xc')]['id']);})[_0x5689('0xd')](function(_0x478d49){logger['error'](_0x5689('0xe'),_0xb8ddb5,JSON[_0x5689('0xf')](_0x478d49));})[_0x5689('0x10')](function(){_0x109a2a[_0x5689('0x11')]();});}}catch(_0x32be0f){logger['error'](_0x5689('0xe'),_0xb8ddb5,JSON[_0x5689('0xf')](_0x32be0f));_0x109a2a[_0x5689('0x11')]();}};}; \ 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 f11fff0..e59aed8 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 _0xd9c8=['finally','stop','textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','endConversation','error','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','sms','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify'];(function(_0x20a922,_0x315dd1){var _0x3f9f36=function(_0x302b85){while(--_0x302b85){_0x20a922['push'](_0x20a922['shift']());}};_0x3f9f36(++_0x315dd1);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd9c8[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x8d9c('0x0'));var moment=require(_0x8d9c('0x1'));var apiai=require('apiai-promise');var md5=require(_0x8d9c('0x2'));var utils=require(_0x8d9c('0x3'));var logger=require(_0x8d9c('0x4'))(_0x8d9c('0x5'));var rpc={'chatMessage':require(_0x8d9c('0x6')),'openchannelMessage':require(_0x8d9c('0x7')),'mailMessage':require(_0x8d9c('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8d9c('0x9')]=function(_0x1ebb5a,_0x475edd){return function(_0x49c96f){try{if(!_[_0x8d9c('0xa')](this[_0x8d9c('0xb')][_0x8d9c('0xc')])){logger[_0x8d9c('0xd')](_0x8d9c('0xe'),_0x1ebb5a,_0x8d9c('0xf'));return _0x49c96f[_0x8d9c('0x10')]();}var _0xaa0a72={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8d9c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8d9c('0x12')};if(this['channel']===_0x8d9c('0x13')||this['channel']==='whatsapp'){_0xaa0a72[_0x8d9c('0x14')]=this['interaction'][_0x8d9c('0x14')];}var _0x416883=this[_0x8d9c('0x15')];if(_0x416883===_0x8d9c('0x16')){_0xaa0a72[_0x8d9c('0x17')]=this[_0x8d9c('0x18')]['id'];}else{_0xaa0a72[_[_0x8d9c('0x19')](_0x416883)+_0x8d9c('0x1a')]=this[_0x8d9c('0x18')]['id'];}_0xaa0a72[_[_0x8d9c('0x19')](_0x416883)+'InteractionId']=this[_0x8d9c('0xb')]['id'];if(this[_0x8d9c('0xb')][_0x8d9c('0x1b')]){var _0x24c036=_0x475edd[0x2];if(!_[_0x8d9c('0x1c')](_0x24c036)){_0xaa0a72[_0x8d9c('0x1d')]=utils[_0x8d9c('0x1e')](_0x24c036,this);return rpc[_0x416883+_0x8d9c('0x1f')][_0x8d9c('0x20')](_0xaa0a72)[_0x8d9c('0x21')](function(_0x48fffd){logger[_0x8d9c('0xd')](_0x8d9c('0xe'),_0x1ebb5a,_0xaa0a72['body']);})[_0x8d9c('0x22')](function(_0x224b53){logger['error'](_0x8d9c('0xe'),_0x1ebb5a,JSON[_0x8d9c('0x23')](_0x224b53));})[_0x8d9c('0x24')](function(){logger[_0x8d9c('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1ebb5a);_0x49c96f[_0x8d9c('0x25')]();});}else{logger[_0x8d9c('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1ebb5a);_0x49c96f['stop']();}}else{var _0x13de89=this;var _0x2d2bf7=apiai(_0x475edd[0x0],{'language':_0x475edd[0x1]||'en'});return _0x2d2bf7[_0x8d9c('0x26')](this[_0x8d9c('0x27')][_0x8d9c('0x1d')],{'sessionId':md5(this[_0x8d9c('0xb')]['id'])})[_0x8d9c('0x21')](function(_0x47ae95){_0x13de89[_0x8d9c('0x1d')]['dialogflow']=_0x47ae95;_0xaa0a72[_0x8d9c('0x1d')]=_0x47ae95[_0x8d9c('0x28')][_0x8d9c('0x29')][_0x8d9c('0x2a')];_0xaa0a72[_0x8d9c('0x2b')]=_0x8d9c('0x2c');_0xaa0a72[_0x8d9c('0x2d')]=JSON['stringify'](_0x47ae95);return rpc[_0x416883+'Message']['create'](_0xaa0a72)['then'](function(_0x5b0230){logger[_0x8d9c('0xd')](_0x8d9c('0xe'),_0x1ebb5a,_0xaa0a72[_0x8d9c('0x1d')]);if(_0x47ae95[_0x8d9c('0x28')]['metadata'][_0x8d9c('0x2e')]){_0x49c96f[_0x8d9c('0x10')]();}else{_0x49c96f['stop']();}})['catch'](function(_0x3f2b44){logger['error'](_0x8d9c('0xe'),_0x1ebb5a,JSON[_0x8d9c('0x23')](_0x3f2b44));_0x49c96f[_0x8d9c('0x10')]();});})['catch'](function(_0x5eaa3e){logger[_0x8d9c('0x2f')](_0x8d9c('0xe'),_0x1ebb5a,_0x5eaa3e[_0x8d9c('0x27')]);_0x49c96f[_0x8d9c('0x10')]();});}}catch(_0xf639a7){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x1ebb5a,JSON[_0x8d9c('0x23')](_0xf639a7));_0x49c96f['stop']();}};}; \ No newline at end of file +var _0xa423=['result','fulfillment','speech','providerName','stringify','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','created','getMustacheRender','Message','create','then','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa423,0x16c));var _0x3a42=function(_0x21ce77,_0x41ed85){_0x21ce77=_0x21ce77-0x0;var _0x21aa27=_0xa423[_0x21ce77];return _0x21aa27;};'use strict';var _=require(_0x3a42('0x0'));var moment=require(_0x3a42('0x1'));var apiai=require(_0x3a42('0x2'));var md5=require(_0x3a42('0x3'));var utils=require(_0x3a42('0x4'));var logger=require('../../../../config/logger')(_0x3a42('0x5'));var rpc={'chatMessage':require(_0x3a42('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3a42('0x7')),'smsMessage':require(_0x3a42('0x8')),'faxMessage':require(_0x3a42('0x9')),'whatsappMessage':require(_0x3a42('0xa'))};exports[_0x3a42('0xb')]=function(_0x563134,_0x65e0ba){return function(_0x439418){try{if(!_[_0x3a42('0xc')](this[_0x3a42('0xd')][_0x3a42('0xe')])){logger[_0x3a42('0xf')](_0x3a42('0x10'),_0x563134,_0x3a42('0x11'));return _0x439418[_0x3a42('0x12')]();}var _0x2a25c0={'ContactId':this[_0x3a42('0x13')]['id'],'sentAt':moment()['format'](_0x3a42('0x14')),'direction':_0x3a42('0x15')};if(this[_0x3a42('0x16')]===_0x3a42('0x17')||this['channel']==='whatsapp'){_0x2a25c0[_0x3a42('0x18')]=this['interaction'][_0x3a42('0x18')];}var _0x2f210f=this[_0x3a42('0x16')];if(_0x2f210f===_0x3a42('0x19')){_0x2a25c0[_0x3a42('0x1a')]=this[_0x3a42('0x1b')]['id'];}else{_0x2a25c0[_['upperFirst'](_0x2f210f)+_0x3a42('0x1c')]=this['account']['id'];}_0x2a25c0[_[_0x3a42('0x1d')](_0x2f210f)+'InteractionId']=this[_0x3a42('0xd')]['id'];if(this[_0x3a42('0xd')][_0x3a42('0x1e')]){var _0x4edcf5=_0x65e0ba[0x2];if(!_['isEmpty'](_0x4edcf5)){_0x2a25c0['body']=utils[_0x3a42('0x1f')](_0x4edcf5,this);return rpc[_0x2f210f+_0x3a42('0x20')][_0x3a42('0x21')](_0x2a25c0)[_0x3a42('0x22')](function(_0x318526){logger['info'](_0x3a42('0x10'),_0x563134,_0x2a25c0[_0x3a42('0x23')]);})[_0x3a42('0x24')](function(_0x151835){logger[_0x3a42('0x25')](_0x3a42('0x10'),_0x563134,JSON['stringify'](_0x151835));})[_0x3a42('0x26')](function(){logger[_0x3a42('0xf')](_0x3a42('0x27'),_0x563134);_0x439418[_0x3a42('0x28')]();});}else{logger[_0x3a42('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x563134);_0x439418[_0x3a42('0x28')]();}}else{var _0x42b40f=this;var _0x379fe6=apiai(_0x65e0ba[0x0],{'language':_0x65e0ba[0x1]||'en'});return _0x379fe6[_0x3a42('0x29')](this[_0x3a42('0x2a')]['body'],{'sessionId':md5(this[_0x3a42('0xd')]['id'])})[_0x3a42('0x22')](function(_0x477cb9){_0x42b40f[_0x3a42('0x23')][_0x3a42('0x2b')]=_0x477cb9;_0x2a25c0[_0x3a42('0x23')]=_0x477cb9[_0x3a42('0x2c')][_0x3a42('0x2d')][_0x3a42('0x2e')];_0x2a25c0[_0x3a42('0x2f')]=_0x3a42('0x2b');_0x2a25c0['providerResponse']=JSON[_0x3a42('0x30')](_0x477cb9);return rpc[_0x2f210f+_0x3a42('0x20')]['create'](_0x2a25c0)[_0x3a42('0x22')](function(_0x5b5897){logger[_0x3a42('0xf')](_0x3a42('0x10'),_0x563134,_0x2a25c0[_0x3a42('0x23')]);if(_0x477cb9[_0x3a42('0x2c')][_0x3a42('0x31')][_0x3a42('0x32')]){_0x439418['next']();}else{_0x439418[_0x3a42('0x28')]();}})[_0x3a42('0x24')](function(_0x1dc0c0){logger[_0x3a42('0x25')](_0x3a42('0x10'),_0x563134,JSON[_0x3a42('0x30')](_0x1dc0c0));_0x439418[_0x3a42('0x12')]();});})['catch'](function(_0x2d6192){logger[_0x3a42('0x25')](_0x3a42('0x10'),_0x563134,_0x2d6192[_0x3a42('0x2a')]);_0x439418[_0x3a42('0x12')]();});}}catch(_0x50ece0){logger['error'](_0x3a42('0x10'),_0x563134,JSON['stringify'](_0x50ece0));_0x439418[_0x3a42('0x28')]();}};}; \ 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 2b5faca..ee4232f 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 _0x4907=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','catch','finally','stop','replace','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','stack','dialogflow','md5','moment','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','sms','whatsapp','phone','interaction','channel'];(function(_0x541319,_0x1fcf8e){var _0x985156=function(_0x1cdb6c){while(--_0x1cdb6c){_0x541319['push'](_0x541319['shift']());}};_0x985156(++_0x1fcf8e);}(_0x4907,0xac));var _0x7490=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4907[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var dialogflow=require(_0x7490('0x0'));var md5=require(_0x7490('0x1'));var moment=require(_0x7490('0x2'));var Promise=require('bluebird');var logger=require(_0x7490('0x3'))('routing');var utils=require(_0x7490('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7490('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7490('0x6')),'faxMessage':require(_0x7490('0x7')),'whatsappMessage':require(_0x7490('0x8'))};function createMessage(_0x1230a2,_0x5c860a,_0x7b0d29,_0x154b44){return new Promise(function(_0x4b81b4,_0x4bb848){var _0x1c05c0=_[_0x7490('0x9')](_0x7b0d29);_0x1c05c0['body']=_0x154b44;return rpc[_0x5c860a+_0x7490('0xa')][_0x7490('0xb')](_0x1c05c0)[_0x7490('0xc')](function(){logger[_0x7490('0xd')](_0x7490('0xe'),_0x1230a2,_0x1c05c0[_0x7490('0xf')]);_0x4b81b4();})['catch'](function(_0x41983f){logger[_0x7490('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1230a2,JSON[_0x7490('0x11')](_0x41983f));_0x4bb848(_0x41983f);});});}exports[_0x7490('0x12')]=function(_0x28240b,_0x8d6288){return function(_0x221bf5){try{if(!_[_0x7490('0x13')](this['interaction'][_0x7490('0x14')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x28240b,_0x7490('0x15'));return _0x221bf5[_0x7490('0x16')]();}var _0x18a40e={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7490('0x17')};if(this['channel']===_0x7490('0x18')||this['channel']===_0x7490('0x19')){_0x18a40e[_0x7490('0x1a')]=this[_0x7490('0x1b')]['phone'];}var _0x3dae8b=this[_0x7490('0x1c')];if(_0x3dae8b===_0x7490('0x1d')){_0x18a40e[_0x7490('0x1e')]=this[_0x7490('0x1f')]['id'];}else{_0x18a40e[_[_0x7490('0x20')](_0x3dae8b)+_0x7490('0x21')]=this[_0x7490('0x1f')]['id'];}_0x18a40e[_['upperFirst'](_0x3dae8b)+_0x7490('0x22')]=this[_0x7490('0x1b')]['id'];if(this[_0x7490('0x1b')]['created']){var _0xc40766=_0x8d6288[0x4];if(!_[_0x7490('0x23')](_0xc40766)){_0x18a40e[_0x7490('0xf')]=utils['getMustacheRender'](_0xc40766,this);return rpc[_0x3dae8b+_0x7490('0xa')]['create'](_0x18a40e)['then'](function(_0xe7264c){logger[_0x7490('0xd')](_0x7490('0xe'),_0x28240b,_0x18a40e[_0x7490('0xf')]);})[_0x7490('0x24')](function(_0x1cd71f){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x28240b,JSON[_0x7490('0x11')](_0x1cd71f));})[_0x7490('0x25')](function(){logger[_0x7490('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x28240b);_0x221bf5[_0x7490('0x26')]();});}else{logger[_0x7490('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x28240b);_0x221bf5['stop']();}}else{var _0x1378bf=this;var _0x2b34bb=_0x8d6288[0x2][_0x7490('0x27')](/\\n/g,'\x0a');var _0x2154fc={'credentials':{'private_key':_0x2b34bb,'client_email':_0x8d6288[0x1]}};var _0x5c9a3e=new dialogflow[(_0x7490('0x28'))](_0x2154fc);var _0x1d7822=_0x5c9a3e['sessionPath'](_0x8d6288[0x0],md5(_0x1378bf[_0x7490('0x1b')]['id']));var _0x43ee73={'session':_0x1d7822,'queryInput':{'text':{'text':_0x1378bf[_0x7490('0x29')][_0x7490('0xf')],'languageCode':_0x8d6288[0x3]||'en'}}};return _0x5c9a3e[_0x7490('0x2a')](_0x43ee73)[_0x7490('0xc')](function(_0x13dbbd){if(_0x13dbbd&&_0x13dbbd[_0x7490('0x2b')]){_0x1378bf[_0x7490('0xf')][_0x7490('0x2c')]=_0x13dbbd;var _0x1db624=_0x13dbbd[0x0];var _0x558fe4=_0x1db624[_0x7490('0x2d')]['diagnosticInfo']&&_0x1db624[_0x7490('0x2d')][_0x7490('0x2e')][_0x7490('0x2f')]?_0x1db624['queryResult'][_0x7490('0x2e')]['fields'][_0x7490('0x30')][_0x7490('0x31')]:![];_0x1378bf[_0x7490('0xf')][_0x7490('0x32')]=_0x1db624['queryResult'][_0x7490('0x33')];_0x1378bf[_0x7490('0xf')][_0x7490('0x34')]=_0x1db624[_0x7490('0x2d')]['allRequiredParamsPresent'];_0x1378bf[_0x7490('0xf')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1db624['queryResult'][_0x7490('0x2e')]&&_0x1db624['queryResult']['diagnosticInfo'][_0x7490('0x2f')]?_0x1db624['queryResult'][_0x7490('0x2e')][_0x7490('0x2f')][_0x7490('0x30')][_0x7490('0x31')]:![];_0x1378bf[_0x7490('0xf')]['DIALOGFLOWV2_INTENTNAME']=_0x1db624['queryResult'][_0x7490('0x35')][_0x7490('0x36')];_0x1378bf[_0x7490('0xf')][_0x7490('0x37')]=_0x1db624['queryResult']['intent'][_0x7490('0x38')];_0x1378bf[_0x7490('0xf')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1db624[_0x7490('0x2d')]['intent'][_0x7490('0x39')];_0x1378bf[_0x7490('0xf')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1db624['queryResult']['languageCode'];_0x1378bf['body'][_0x7490('0x3a')]=_0x1db624[_0x7490('0x2d')][_0x7490('0x3b')];_0x1378bf[_0x7490('0xf')][_0x7490('0x3c')]=_0x1db624['queryResult'][_0x7490('0x3d')];_0x18a40e[_0x7490('0x3e')]='dialogflowV2';_0x18a40e[_0x7490('0x3f')]=JSON[_0x7490('0x11')](_0x13dbbd);var _0x41be14=[];for(var _0x58c3d6=0x0;_0x58c3d6<_0x13dbbd[_0x7490('0x2b')];_0x58c3d6++){var _0x488ee3=_0x13dbbd[_0x58c3d6];if(_0x488ee3&&_0x488ee3[_0x7490('0x2d')]&&_0x488ee3[_0x7490('0x2d')]['fulfillmentText']){_0x41be14[_0x7490('0x40')](createMessage(_0x28240b,_0x3dae8b,_0x18a40e,_0x488ee3['queryResult'][_0x7490('0x41')]));}}return Promise['all'](_0x41be14)['then'](function(){if(_0x558fe4){_0x221bf5[_0x7490('0x16')]();}else{_0x221bf5[_0x7490('0x26')]();}})['catch'](function(_0x51b11e){logger[_0x7490('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x28240b,JSON[_0x7490('0x11')](_0x51b11e));_0x221bf5['next']();});}})[_0x7490('0x24')](function(_0x258e03){logger['error'](_0x7490('0xe'),_0x28240b,_0x258e03['message'],_0x258e03[_0x7490('0x42')]);_0x221bf5[_0x7490('0x16')]();});}}catch(_0x2c6369){logger[_0x7490('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x28240b,JSON[_0x7490('0x11')](_0x2c6369));_0x221bf5[_0x7490('0x26')]();}};}; \ No newline at end of file +var _0x5d65=['../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','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!','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','length','push','fulfillmentText','message','stack','next','lodash','dialogflow','md5','moment','bluebird','./utils'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0x5d65,0xcf));var _0x55d6=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x5d65[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x55d6('0x0'));var dialogflow=require(_0x55d6('0x1'));var md5=require(_0x55d6('0x2'));var moment=require(_0x55d6('0x3'));var Promise=require(_0x55d6('0x4'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x55d6('0x5'));var rpc={'chatMessage':require(_0x55d6('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x55d6('0x7')),'faxMessage':require(_0x55d6('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x238049,_0x289829,_0x356888,_0x1cffc9){return new Promise(function(_0x95ea04,_0x4889fb){var _0x5b9444=_['clone'](_0x356888);_0x5b9444[_0x55d6('0x9')]=_0x1cffc9;return rpc[_0x289829+_0x55d6('0xa')][_0x55d6('0xb')](_0x5b9444)[_0x55d6('0xc')](function(){logger[_0x55d6('0xd')](_0x55d6('0xe'),_0x238049,_0x5b9444[_0x55d6('0x9')]);_0x95ea04();})[_0x55d6('0xf')](function(_0x3d3abd){logger[_0x55d6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x238049,JSON[_0x55d6('0x11')](_0x3d3abd));_0x4889fb(_0x3d3abd);});});}exports[_0x55d6('0x12')]=function(_0x1658f2,_0x301eed){return function(_0x52766d){try{if(!_[_0x55d6('0x13')](this[_0x55d6('0x14')][_0x55d6('0x15')])){logger[_0x55d6('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x1658f2,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x52766d['next']();}var _0xc191de={'ContactId':this[_0x55d6('0x16')]['id'],'sentAt':moment()[_0x55d6('0x17')](_0x55d6('0x18')),'direction':_0x55d6('0x19')};if(this[_0x55d6('0x1a')]===_0x55d6('0x1b')||this[_0x55d6('0x1a')]===_0x55d6('0x1c')){_0xc191de[_0x55d6('0x1d')]=this[_0x55d6('0x14')][_0x55d6('0x1d')];}var _0x84000b=this['channel'];if(_0x84000b===_0x55d6('0x1e')){_0xc191de[_0x55d6('0x1f')]=this[_0x55d6('0x20')]['id'];}else{_0xc191de[_[_0x55d6('0x21')](_0x84000b)+'AccountId']=this[_0x55d6('0x20')]['id'];}_0xc191de[_[_0x55d6('0x21')](_0x84000b)+_0x55d6('0x22')]=this[_0x55d6('0x14')]['id'];if(this[_0x55d6('0x14')][_0x55d6('0x23')]){var _0x170afe=_0x301eed[0x4];if(!_[_0x55d6('0x24')](_0x170afe)){_0xc191de[_0x55d6('0x9')]=utils['getMustacheRender'](_0x170afe,this);return rpc[_0x84000b+_0x55d6('0xa')][_0x55d6('0xb')](_0xc191de)[_0x55d6('0xc')](function(_0xa1159b){logger['info'](_0x55d6('0xe'),_0x1658f2,_0xc191de[_0x55d6('0x9')]);})['catch'](function(_0x443d6c){logger[_0x55d6('0x10')](_0x55d6('0xe'),_0x1658f2,JSON[_0x55d6('0x11')](_0x443d6c));})[_0x55d6('0x25')](function(){logger[_0x55d6('0xd')](_0x55d6('0x26'),_0x1658f2);_0x52766d[_0x55d6('0x27')]();});}else{logger[_0x55d6('0xd')](_0x55d6('0x28'),_0x1658f2);_0x52766d[_0x55d6('0x27')]();}}else{var _0x537dfe=this;var _0x110ce4=_0x301eed[0x2]['replace'](/\\n/g,'\x0a');var _0x117702={'credentials':{'private_key':_0x110ce4,'client_email':_0x301eed[0x1]}};var _0x47b952=new dialogflow['SessionsClient'](_0x117702);var _0x47ead5=_0x47b952['sessionPath'](_0x301eed[0x0],md5(_0x537dfe[_0x55d6('0x14')]['id']));var _0x140e67={'session':_0x47ead5,'queryInput':{'text':{'text':_0x537dfe['message'][_0x55d6('0x9')],'languageCode':_0x301eed[0x3]||'en'}}};return _0x47b952[_0x55d6('0x29')](_0x140e67)[_0x55d6('0xc')](function(_0xf803bd){if(_0xf803bd&&_0xf803bd['length']){_0x537dfe[_0x55d6('0x9')][_0x55d6('0x2a')]=_0xf803bd;var _0x5e0243=_0xf803bd[0x0];var _0x2ca3ff=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')]&&_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')][_0x55d6('0x2d')]?_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')][_0x55d6('0x2d')][_0x55d6('0x2e')][_0x55d6('0x2f')]:![];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x30')]=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x31')];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x32')]=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x33')];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x34')]=_0x5e0243[_0x55d6('0x2b')]['diagnosticInfo']&&_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')]['fields']?_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')][_0x55d6('0x2d')][_0x55d6('0x2e')]['boolValue']:![];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x35')]=_0x5e0243['queryResult'][_0x55d6('0x36')][_0x55d6('0x37')];_0x537dfe['body'][_0x55d6('0x38')]=_0x5e0243['queryResult'][_0x55d6('0x36')]['displayName'];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x39')]=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x36')][_0x55d6('0x3a')];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x3b')]=_0x5e0243[_0x55d6('0x2b')]['languageCode'];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x3c')]=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x3d')];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x3e')]=_0x5e0243['queryResult'][_0x55d6('0x3f')];_0xc191de[_0x55d6('0x40')]=_0x55d6('0x2a');_0xc191de['providerResponse']=JSON['stringify'](_0xf803bd);var _0x42cbea=[];for(var _0x135456=0x0;_0x135456<_0xf803bd[_0x55d6('0x41')];_0x135456++){var _0x3a79a1=_0xf803bd[_0x135456];if(_0x3a79a1&&_0x3a79a1[_0x55d6('0x2b')]&&_0x3a79a1[_0x55d6('0x2b')]['fulfillmentText']){_0x42cbea[_0x55d6('0x42')](createMessage(_0x1658f2,_0x84000b,_0xc191de,_0x3a79a1['queryResult'][_0x55d6('0x43')]));}}return Promise['all'](_0x42cbea)[_0x55d6('0xc')](function(){if(_0x2ca3ff){_0x52766d['next']();}else{_0x52766d[_0x55d6('0x27')]();}})[_0x55d6('0xf')](function(_0x1ef823){logger[_0x55d6('0x10')](_0x55d6('0xe'),_0x1658f2,JSON['stringify'](_0x1ef823));_0x52766d['next']();});}})[_0x55d6('0xf')](function(_0x3c19fc){logger['error'](_0x55d6('0xe'),_0x1658f2,_0x3c19fc[_0x55d6('0x44')],_0x3c19fc[_0x55d6('0x45')]);_0x52766d[_0x55d6('0x46')]();});}}catch(_0x29b7bf){logger[_0x55d6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1658f2,JSON[_0x55d6('0x11')](_0x29b7bf));_0x52766d['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 25dbfbb..4679fba 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 _0xc743=['info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xc743,0x164));var _0x3c74=function(_0x16dcf7,_0x53d1ee){_0x16dcf7=_0x16dcf7-0x0;var _0x1d4553=_0xc743[_0x16dcf7];return _0x1d4553;};'use strict';var schema=require(_0x3c74('0x0'));var _=require(_0x3c74('0x1'));var htmlToText=require(_0x3c74('0x2'));var utils=require(_0x3c74('0x3'));var logger=require('../../../../config/logger')(_0x3c74('0x4'));var gotoif=schema({'condition':{'type':_0x3c74('0x5'),'required':!![],'message':_0x3c74('0x6')},'priorityTrue':{'type':_0x3c74('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x3c74('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x24c7c7,_0x24a4bc){return function(_0x4c2f29){try{var _0x40689e={'condition':htmlToText[_0x3c74('0x8')](utils[_0x3c74('0x9')](_0x24a4bc[0x0],this),{'wordwrap':![]})[_0x3c74('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x24a4bc[0x1],'priorityFalse':_0x24a4bc[0x2]};var _0x3d5228=gotoif[_0x3c74('0x0')](_0x40689e,{'typecast':!![]});if(_0x3d5228[_0x3c74('0xb')]){logger['error'](_0x3c74('0xc'),_0x24c7c7,_['map'](_0x3d5228,_0x3c74('0xd'))[_0x3c74('0xe')](',\x20'));_0x4c2f29[_0x3c74('0xf')]();}else{try{var _0x37f1fd=eval('('+_0x40689e[_0x3c74('0x10')]+')');var _0x2d5684=_0x37f1fd?_0x40689e[_0x3c74('0x11')]:_0x40689e[_0x3c74('0x12')];logger[_0x3c74('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x24c7c7,_0x40689e[_0x3c74('0x10')],_0x37f1fd,_0x2d5684||_0x3c74('0x14'));if(_0x2d5684){var _0x1e147d=_[_0x3c74('0x15')](_0x4c2f29['rules'](),{'p':_0x2d5684});if(_0x1e147d>=0x0){logger[_0x3c74('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x24c7c7,_0x2d5684||'next',_0x1e147d);_0x4c2f29[_0x3c74('0x14')](_0x1e147d);}else{logger[_0x3c74('0x13')](_0x3c74('0x16'),_0x24c7c7,_0x2d5684||_0x3c74('0x14'));_0x4c2f29[_0x3c74('0xf')]();}}else{_0x4c2f29[_0x3c74('0x14')]();}}catch(_0x4b915b){logger[_0x3c74('0x17')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x24c7c7,_0x4b915b['message']);_0x4c2f29[_0x3c74('0xf')]();}}}catch(_0xe394a){logger[_0x3c74('0x17')](_0x3c74('0xc'),_0x24c7c7,JSON[_0x3c74('0x18')](_0xe394a));_0x4c2f29[_0x3c74('0xf')]();}};}; \ No newline at end of file +var _0xe082=['fromString','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','stop','stringify','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0xdf79a0,_0x5ba2ed){var _0x145390=function(_0x4da834){while(--_0x4da834){_0xdf79a0['push'](_0xdf79a0['shift']());}};_0x145390(++_0x5ba2ed);}(_0xe082,0xb6));var _0x2e08=function(_0x5967c0,_0x452377){_0x5967c0=_0x5967c0-0x0;var _0x2ad249=_0xe082[_0x5967c0];return _0x2ad249;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x2e08('0x0'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x2e08('0x1'),'required':!![],'message':_0x2e08('0x2')},'priorityTrue':{'type':_0x2e08('0x3'),'message':_0x2e08('0x4')},'priorityFalse':{'type':_0x2e08('0x3'),'message':_0x2e08('0x5')}});exports[_0x2e08('0x6')]=function(_0x405f18,_0x554b0c){return function(_0x3866ef){try{var _0x5641a5={'condition':htmlToText[_0x2e08('0x7')](utils['getMustacheRender'](_0x554b0c[0x0],this),{'wordwrap':![]})[_0x2e08('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x554b0c[0x1],'priorityFalse':_0x554b0c[0x2]};var _0x47d954=gotoif[_0x2e08('0x9')](_0x5641a5,{'typecast':!![]});if(_0x47d954[_0x2e08('0xa')]){logger[_0x2e08('0xb')](_0x2e08('0xc'),_0x405f18,_[_0x2e08('0xd')](_0x47d954,_0x2e08('0xe'))[_0x2e08('0xf')](',\x20'));_0x3866ef['stop']();}else{try{var _0x59c468=eval('('+_0x5641a5[_0x2e08('0x10')]+')');var _0x421756=_0x59c468?_0x5641a5[_0x2e08('0x11')]:_0x5641a5[_0x2e08('0x12')];logger[_0x2e08('0x13')](_0x2e08('0x14'),_0x405f18,_0x5641a5[_0x2e08('0x10')],_0x59c468,_0x421756||'next');if(_0x421756){var _0x54ce0f=_['findIndex'](_0x3866ef[_0x2e08('0x15')](),{'p':_0x421756});if(_0x54ce0f>=0x0){logger[_0x2e08('0x13')](_0x2e08('0x16'),_0x405f18,_0x421756||'next',_0x54ce0f);_0x3866ef[_0x2e08('0x17')](_0x54ce0f);}else{logger[_0x2e08('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x405f18,_0x421756||'next');_0x3866ef['stop']();}}else{_0x3866ef['next']();}}catch(_0xa8c2bd){logger['error'](_0x2e08('0x18'),_0x405f18,_0xa8c2bd[_0x2e08('0xe')]);_0x3866ef[_0x2e08('0x19')]();}}}catch(_0x29d36a){logger['error'](_0x2e08('0xc'),_0x405f18,JSON[_0x2e08('0x1a')](_0x29d36a));_0x3866ef[_0x2e08('0x19')]();}};}; \ 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 6b7d779..4cf4ee8 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 _0x7fb2=['stop','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x55559b,_0x58cc43){var _0x171100=function(_0x800903){while(--_0x800903){_0x55559b['push'](_0x55559b['shift']());}};_0x171100(++_0x58cc43);}(_0x7fb2,0x1a4));var _0x27fb=function(_0x51951e,_0x3efd3f){_0x51951e=_0x51951e-0x0;var _0x52c26d=_0x7fb2[_0x51951e];return _0x52c26d;};'use strict';var schema=require('validate');var _=require(_0x27fb('0x0'));var logger=require(_0x27fb('0x1'))(_0x27fb('0x2'));var gotop=schema({'priority':{'type':_0x27fb('0x3'),'required':!![],'message':_0x27fb('0x4')}});exports['consequence']=function(_0x188cd5,_0x2073f1){return function(_0x4e8f6c){try{var _0x5d5fc0={'priority':_0x2073f1[0x0]};var _0x455f67=gotop[_0x27fb('0x5')](_0x5d5fc0,{'typecast':!![]});if(_0x455f67[_0x27fb('0x6')]){logger[_0x27fb('0x7')](_0x27fb('0x8'),_0x188cd5,_[_0x27fb('0x9')](_0x455f67,_0x27fb('0xa'))[_0x27fb('0xb')](',\x20'));_0x4e8f6c['stop']();}else{logger[_0x27fb('0xc')](_0x27fb('0xd'),_0x188cd5,_0x5d5fc0['priority']);if(_0x5d5fc0[_0x27fb('0xe')]){var _0x5085cc=_[_0x27fb('0xf')](_0x4e8f6c[_0x27fb('0x10')](),{'p':_0x5d5fc0[_0x27fb('0xe')]});if(_0x5085cc>=0x0){logger['info'](_0x27fb('0x11'),_0x188cd5,_0x5d5fc0[_0x27fb('0xe')]||_0x27fb('0x12'),_0x5085cc);_0x4e8f6c[_0x27fb('0x12')](_0x5085cc);}else{logger[_0x27fb('0xc')](_0x27fb('0x13'),_0x188cd5,_0x5d5fc0[_0x27fb('0xe')]||_0x27fb('0x12'));_0x4e8f6c[_0x27fb('0x14')]();}}else{_0x4e8f6c['next']();}}}catch(_0x2ddd11){logger[_0x27fb('0x7')]('[%s][GOTOP]\x20%s',_0x188cd5,JSON[_0x27fb('0x15')](_0x2ddd11));_0x4e8f6c[_0x27fb('0x14')]();}};}; \ No newline at end of file +var _0xd6d0=['message','join','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map'];(function(_0x552e24,_0x312fcc){var _0x500753=function(_0x30cfad){while(--_0x30cfad){_0x552e24['push'](_0x552e24['shift']());}};_0x500753(++_0x312fcc);}(_0xd6d0,0xb4));var _0x0d6d=function(_0x102f07,_0x4ddd65){_0x102f07=_0x102f07-0x0;var _0x4e7ff5=_0xd6d0[_0x102f07];return _0x4e7ff5;};'use strict';var schema=require('validate');var _=require(_0x0d6d('0x0'));var logger=require(_0x0d6d('0x1'))(_0x0d6d('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x0d6d('0x3')}});exports[_0x0d6d('0x4')]=function(_0x56fa52,_0x4bf9d1){return function(_0x2b6fe8){try{var _0x432d6b={'priority':_0x4bf9d1[0x0]};var _0x4e68ef=gotop[_0x0d6d('0x5')](_0x432d6b,{'typecast':!![]});if(_0x4e68ef[_0x0d6d('0x6')]){logger[_0x0d6d('0x7')](_0x0d6d('0x8'),_0x56fa52,_[_0x0d6d('0x9')](_0x4e68ef,_0x0d6d('0xa'))[_0x0d6d('0xb')](',\x20'));_0x2b6fe8['stop']();}else{logger[_0x0d6d('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x56fa52,_0x432d6b[_0x0d6d('0xd')]);if(_0x432d6b['priority']){var _0x3b1254=_[_0x0d6d('0xe')](_0x2b6fe8['rules'](),{'p':_0x432d6b[_0x0d6d('0xd')]});if(_0x3b1254>=0x0){logger[_0x0d6d('0xc')](_0x0d6d('0xf'),_0x56fa52,_0x432d6b[_0x0d6d('0xd')]||_0x0d6d('0x10'),_0x3b1254);_0x2b6fe8['next'](_0x3b1254);}else{logger[_0x0d6d('0xc')](_0x0d6d('0x11'),_0x56fa52,_0x432d6b[_0x0d6d('0xd')]||'next');_0x2b6fe8[_0x0d6d('0x12')]();}}else{_0x2b6fe8[_0x0d6d('0x10')]();}}}catch(_0x58bb92){logger[_0x0d6d('0x7')]('[%s][GOTOP]\x20%s',_0x56fa52,JSON['stringify'](_0x58bb92));_0x2b6fe8[_0x0d6d('0x12')]();}};}; \ 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 9cd0b07..aab1232 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 _0xeae6=['interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','account','upperFirst'];(function(_0x25c762,_0xc0156b){var _0x48e0af=function(_0x5038ec){while(--_0x5038ec){_0x25c762['push'](_0x25c762['shift']());}};_0x48e0af(++_0xc0156b);}(_0xeae6,0xc3));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6eae('0x0'));var utils=require(_0x6eae('0x1'));var logger=require(_0x6eae('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6eae('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6eae('0x4')),'faxMessage':require(_0x6eae('0x5')),'whatsappMessage':require(_0x6eae('0x6'))};exports[_0x6eae('0x7')]=function(_0x3e0903,_0x134c6a){return function(_0x19d1e9){try{var _0x778b34={'body':utils['getMustacheRender'](_0x134c6a[0x0],this),'ContactId':this['contact']['id']};if(this[_0x6eae('0x8')]===_0x6eae('0x9')){_0x778b34['ChatWebsiteId']=this[_0x6eae('0xa')]['id'];}else{_0x778b34[_[_0x6eae('0xb')](this['channel'])+'AccountId']=this[_0x6eae('0xa')]['id'];}_0x778b34[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x6eae('0xc')]['id'];if(rpc[this[_0x6eae('0x8')]+'Message']){return rpc[this[_0x6eae('0x8')]+_0x6eae('0xd')][_0x6eae('0xe')](_0x778b34)[_0x6eae('0xf')](function(_0x118bc0){logger[_0x6eae('0x10')](_0x6eae('0x11'),_0x3e0903,_0x778b34['body']);_0x19d1e9[_0x6eae('0x12')]();})[_0x6eae('0x13')](function(_0x147b90){logger[_0x6eae('0x14')](_0x6eae('0x11'),_0x3e0903,JSON[_0x6eae('0x15')](_0x147b90));_0x19d1e9[_0x6eae('0x16')]();});}}catch(_0x350393){logger[_0x6eae('0x14')](_0x6eae('0x11'),_0x3e0903,JSON[_0x6eae('0x15')](_0x350393));_0x19d1e9[_0x6eae('0x16')]();}};}; \ No newline at end of file +var _0x01bb=['../../rpc/faxMessage','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage'];(function(_0x4375c4,_0x2677d2){var _0x5b9765=function(_0x400b86){while(--_0x400b86){_0x4375c4['push'](_0x4375c4['shift']());}};_0x5b9765(++_0x2677d2);}(_0x01bb,0x171));var _0xb01b=function(_0x4ce71c,_0x22a42c){_0x4ce71c=_0x4ce71c-0x0;var _0x59322d=_0x01bb[_0x4ce71c];return _0x59322d;};'use strict';var _=require(_0xb01b('0x0'));var utils=require(_0xb01b('0x1'));var logger=require(_0xb01b('0x2'))(_0xb01b('0x3'));var rpc={'chatMessage':require(_0xb01b('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb01b('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb01b('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x17c73a,_0x13afdd){return function(_0x3e3360){try{var _0xc9f593={'body':utils[_0xb01b('0x7')](_0x13afdd[0x0],this),'ContactId':this[_0xb01b('0x8')]['id']};if(this[_0xb01b('0x9')]===_0xb01b('0xa')){_0xc9f593['ChatWebsiteId']=this[_0xb01b('0xb')]['id'];}else{_0xc9f593[_[_0xb01b('0xc')](this[_0xb01b('0x9')])+_0xb01b('0xd')]=this[_0xb01b('0xb')]['id'];}_0xc9f593[_['upperFirst'](this[_0xb01b('0x9')])+_0xb01b('0xe')]=this[_0xb01b('0xf')]['id'];if(rpc[this[_0xb01b('0x9')]+'Message']){return rpc[this[_0xb01b('0x9')]+_0xb01b('0x10')]['create'](_0xc9f593)['then'](function(_0x1ee445){logger[_0xb01b('0x11')](_0xb01b('0x12'),_0x17c73a,_0xc9f593[_0xb01b('0x13')]);_0x3e3360[_0xb01b('0x14')]();})[_0xb01b('0x15')](function(_0x358c09){logger[_0xb01b('0x16')](_0xb01b('0x12'),_0x17c73a,JSON[_0xb01b('0x17')](_0x358c09));_0x3e3360['stop']();});}}catch(_0x3788be){logger[_0xb01b('0x16')](_0xb01b('0x12'),_0x17c73a,JSON[_0xb01b('0x17')](_0x3788be));_0x3e3360[_0xb01b('0x18')]();}};}; \ 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 cfe74fc..affcb9b 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 _0xd668=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','./utils'];(function(_0x4d8c9a,_0x163fdc){var _0x16c561=function(_0x3464d2){while(--_0x3464d2){_0x4d8c9a['push'](_0x4d8c9a['shift']());}};_0x16c561(++_0x163fdc);}(_0xd668,0x15e));var _0x8d66=function(_0x563025,_0x354482){_0x563025=_0x563025-0x0;var _0x564c94=_0xd668[_0x563025];return _0x564c94;};'use strict';var utils=require(_0x8d66('0x0'));var logger=require(_0x8d66('0x1'))(_0x8d66('0x2'));exports[_0x8d66('0x3')]=function(_0x5a6fc2,_0x4db4f7){return function(_0x385f7e){try{logger[_0x8d66('0x4')](_0x8d66('0x5'),_0x5a6fc2,utils[_0x8d66('0x6')](_0x4db4f7[0x0],this));_0x385f7e[_0x8d66('0x7')]();}catch(_0xfc5c9c){logger[_0x8d66('0x8')](_0x8d66('0x5'),_0x5a6fc2,JSON['stringify'](_0xfc5c9c));_0x385f7e['stop']();}};}; \ No newline at end of file +var _0xc830=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','consequence'];(function(_0x438ab6,_0x57ee95){var _0x13317b=function(_0x11c5c7){while(--_0x11c5c7){_0x438ab6['push'](_0x438ab6['shift']());}};_0x13317b(++_0x57ee95);}(_0xc830,0x85));var _0x0c83=function(_0x58a064,_0x1c4d59){_0x58a064=_0x58a064-0x0;var _0x5a295f=_0xc830[_0x58a064];return _0x5a295f;};'use strict';var utils=require(_0x0c83('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0x0c83('0x1')]=function(_0x872e2,_0xbcef1c){return function(_0x2d8241){try{logger[_0x0c83('0x2')](_0x0c83('0x3'),_0x872e2,utils[_0x0c83('0x4')](_0xbcef1c[0x0],this));_0x2d8241[_0x0c83('0x5')]();}catch(_0x10a7f8){logger[_0x0c83('0x6')]('[%s][NOOP]\x20%s',_0x872e2,JSON[_0x0c83('0x7')](_0x10a7f8));_0x2d8241[_0x0c83('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 6ce36ea..db048ad 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 _0x0e01=['../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','next','strategy','rrmemory','beepall','stack','validate','seq-queue','moment','ioredis','routing','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x63394b,_0x257d25){var _0x5a9e5b=function(_0x7cf872){while(--_0x7cf872){_0x63394b['push'](_0x63394b['shift']());}};_0x5a9e5b(++_0x257d25);}(_0x0e01,0x87));var _0x10e0=function(_0x39ef69,_0x43a3dd){_0x39ef69=_0x39ef69-0x0;var _0x48fd17=_0x0e01[_0x39ef69];return _0x48fd17;};'use strict';var schema=require(_0x10e0('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x10e0('0x1'));var moment=require(_0x10e0('0x2'));var Redis=require(_0x10e0('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x10e0('0x4'));var strategy=require('./strategy');config['redis']=_[_0x10e0('0x5')](config['redis'],{'host':_0x10e0('0x6'),'port':0x18eb});var io=require(_0x10e0('0x7'))(new Redis(config['redis']));var attributes=['id',_0x10e0('0x8'),_0x10e0('0x9'),_0x10e0('0xa'),'from',_0x10e0('0xb')];function emit(_0x5e4ea2,_0x55c2fc,_0x328910){io['to'](_0x5e4ea2)[_0x10e0('0xc')](_0x55c2fc,_0x328910);}function emitChannelQueueInteraction(_0x23d5e8,_0x494ecc,_0x304d5d,_0x3db643,_0x72a88e,_0x2d0236,_0x301c50,_0x471cdd){var _0x3c9ff4=_[_0x10e0('0xd')](_0x304d5d);_0x3c9ff4[_0x10e0('0x8')]=_0x471cdd;_0x3c9ff4[_0x10e0('0xa')]=_0x494ecc;_0x3c9ff4[_0x10e0('0x9')]=_0x3db643;_0x3c9ff4['id']=_0x72a88e;if(_0x2d0236){attributes[_0x10e0('0xe')](_['capitalize'](_0x23d5e8)+_0x10e0('0xf'));_0x301c50[util[_0x10e0('0x10')](_0x10e0('0x11'),_0x23d5e8)][_0x72a88e]=_[_0x10e0('0x12')](_0x3c9ff4,attributes);}else{delete _0x301c50[util[_0x10e0('0x10')]('%sQueuesWaitingInteractions',_0x23d5e8)][_0x72a88e];}emit(util[_0x10e0('0x10')](_0x10e0('0x13'),_0x23d5e8,_0x494ecc),util['format'](_0x10e0('0x14'),_0x23d5e8,_0x2d0236?_0x10e0('0x15'):_0x10e0('0x16')),_[_0x10e0('0x12')](_0x3c9ff4,attributes));}var rpc={'openchannelQueueReport':require(_0x10e0('0x17')),'mailQueueReport':require(_0x10e0('0x18')),'chatQueueReport':require(_0x10e0('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x10e0('0x1a')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x10e0('0x1b')),'mailInteraction':require(_0x10e0('0x1c')),'openchannelInteraction':require(_0x10e0('0x1d')),'smsInteraction':require(_0x10e0('0x1e')),'whatsappInteraction':require(_0x10e0('0x1f'))};var queue=schema({'name':{'type':_0x10e0('0x20'),'required':!![],'message':_0x10e0('0x21')},'timeout':{'type':_0x10e0('0x22'),'message':_0x10e0('0x23')}});function startRouting(_0x4daaf8,_0x3d87cd,_0x5b7779,_0x43396f){if(_0x4daaf8&&_0x3d87cd&&_0x5b7779){_0x3d87cd[_0x10e0('0x24')]+=0x1;var _0x422cb6={'uniqueid':_0x4daaf8,'from':_0x5b7779['body']?_0x5b7779[_0x10e0('0x25')][_0x10e0('0x26')]:'','joinAt':moment()[_0x10e0('0x10')](_0x10e0('0x27')),'ContactId':_0x5b7779[_0x10e0('0x28')]?_0x5b7779[_0x10e0('0x28')]['id']:null,'ListId':_0x5b7779['list']?_0x5b7779['list']['id']:null};_0x422cb6[_[_0x10e0('0x29')](_0x5b7779['channel'])+_0x10e0('0x2a')]=_0x3d87cd['id']||null;_0x422cb6[_[_0x10e0('0x29')](_0x5b7779['channel'])+_0x10e0('0xf')]=_0x5b7779[_0x10e0('0x2b')]?_0x5b7779[_0x10e0('0x2b')]['id']:null;_0x422cb6[_['upperFirst'](_0x5b7779[_0x10e0('0x2c')])+_0x10e0('0x2d')]=_0x5b7779[_0x10e0('0x2e')]?_0x5b7779['message']['id']:null;_0x422cb6[_[_0x10e0('0x29')](_0x5b7779[_0x10e0('0x2c')])+(_0x5b7779[_0x10e0('0x2c')]!==_0x10e0('0x2f')?_0x10e0('0x30'):_0x10e0('0x31'))]=_0x5b7779[_0x10e0('0x9')]?_0x5b7779[_0x10e0('0x9')]['id']:null;logger[_0x10e0('0x32')](util[_0x10e0('0x10')](_0x10e0('0x33'),_0x4daaf8,_0x3d87cd[_0x10e0('0x34')]));emitChannelQueueInteraction(_0x5b7779[_0x10e0('0x2c')],_0x3d87cd['name'],_0x422cb6,_0x5b7779[_0x10e0('0x9')][_0x10e0('0x34')],_0x5b7779[_0x10e0('0x2e')]['id'],!![],_0x43396f,_0x3d87cd['id']);if(rpc[_0x5b7779[_0x10e0('0x2c')]+'QueueReport']){return rpc[_0x5b7779[_0x10e0('0x2c')]+_0x10e0('0x35')]['create'](_0x422cb6)[_0x10e0('0x36')](function(_0x41f17d){logger['error'](_0x10e0('0x37'),_0x41f17d);});}}}function stopRouting(_0x525fcd,_0xb69e11,_0x279084,_0x547090){if(_0x525fcd&&_0xb69e11){_0xb69e11['waiting']-=0x1;var _0x5878a3={'leaveAt':moment()[_0x10e0('0x10')](_0x10e0('0x27')),'acceptAt':moment()[_0x10e0('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x10e0('0x38')};logger[_0x10e0('0x32')](util[_0x10e0('0x10')](_0x10e0('0x39'),_0x525fcd,_0xb69e11['name']));emitChannelQueueInteraction(_0x279084['channel'],_0xb69e11[_0x10e0('0x34')],_0x279084[_0x10e0('0x25')],_0x279084['account'][_0x10e0('0x34')],_0x279084[_0x10e0('0x2e')]['id'],![],_0x547090,_0xb69e11['id']);return rpc[_0x279084[_0x10e0('0x2c')]+_0x10e0('0x3a')][_0x10e0('0x3b')](_0x279084['interaction']['id'],{'queueId':_0xb69e11['id']})[_0x10e0('0x3c')](function(){if(rpc[_0x279084[_0x10e0('0x2c')]+_0x10e0('0x35')]){return rpc[_0x279084['channel']+_0x10e0('0x35')][_0x10e0('0x3b')](_0x525fcd,_0x5878a3)[_0x10e0('0x36')](function(_0x1d0556){logger[_0x10e0('0x3d')](_0x10e0('0x3e'),_0x1d0556);});}});}}function endRouting(_0x3ce0e4,_0x1429bc,_0x1e95ed,_0x5198b5){if(_0x3ce0e4&&_0x1429bc){_0x1429bc[_0x10e0('0x24')]-=0x1;var _0x3cb5a5={'leaveAt':moment()[_0x10e0('0x10')](_0x10e0('0x27')),'exitAt':moment()[_0x10e0('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x10e0('0x32')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x3ce0e4,_0x1429bc[_0x10e0('0x34')]));emitChannelQueueInteraction(_0x1e95ed[_0x10e0('0x2c')],_0x1429bc['name'],_0x1e95ed[_0x10e0('0x25')],_0x1e95ed['account'][_0x10e0('0x34')],_0x1e95ed[_0x10e0('0x2e')]['id'],![],_0x5198b5);if(rpc[_0x1e95ed[_0x10e0('0x2c')]+_0x10e0('0x35')]){return rpc[_0x1e95ed[_0x10e0('0x2c')]+_0x10e0('0x35')][_0x10e0('0x3b')](_0x3ce0e4,_0x3cb5a5)[_0x10e0('0x36')](function(_0xa55745){logger[_0x10e0('0x3d')](_0x10e0('0x3e'),_0xa55745);});}}}function handleFindQueue(_0x326cbe){return function(_0x5e3860){return _0x5e3860[_0x10e0('0x34')][_0x10e0('0x3f')]()===_0x326cbe[_0x10e0('0x3f')]();};}exports['consequence']=function(_0x163323,_0x3ce65b,_0x4e228a,_0x4931cc){return function(_0x464448){try{var _0x13d56d={'name':_0x3ce65b[0x0],'timeout':_0x3ce65b[0x1]};var _0x39faa0=queue[_0x10e0('0x0')](_0x13d56d,{'typecast':!![]});if(_0x39faa0[_0x10e0('0x40')]){logger[_0x10e0('0x3d')](_0x10e0('0x41'),_0x163323,_[_0x10e0('0x42')](_0x39faa0,_0x10e0('0x2e'))[_0x10e0('0x43')](',\x20'));_0x464448['stop']();}else{var _0x3cde37=_[_0x10e0('0x44')](_0x4e228a[_0x4931cc[_0x10e0('0x2c')]+'Queues'],handleFindQueue(_0x13d56d[_0x10e0('0x34')]));if(_0x3cde37){startRouting(_0x163323,_0x3cde37,_0x4931cc,_0x4e228a);var _0x6305a2=(_0x3cde37[_0x10e0('0x45')]||0xa)*0x3e8;var _0x2eb0ed=(_0x13d56d[_0x10e0('0x45')]||0x14)*0x3e8;var _0x1052f3;if(_0x6305a2>_0x2eb0ed){_0x2eb0ed=_0x6305a2;}var _0xf81cd6=seqqueue[_0x10e0('0x46')](_0x6305a2);_0xf81cd6['id']=_0x163323;_0xf81cd6[_0x10e0('0x47')]=_0x6305a2;_0xf81cd6[_0x10e0('0x48')]=_0x2eb0ed;_0xf81cd6[_0x10e0('0x2c')]=_0x4931cc[_0x10e0('0x2c')];_0x4e228a[_0x10e0('0x49')][_0x163323]['on'](_0x10e0('0x4a'),function(){logger[_0x10e0('0x32')](_0x10e0('0x4b'),_0x163323);stopRouting(_0x163323,_0x3cde37,_0x4931cc,_0x4e228a);clearTimeout(_0x1052f3);_0x1052f3=undefined;_0xf81cd6[_0x10e0('0x4c')](!![]);if(_0x4e228a[_0x10e0('0x49')][_0x163323]){delete _0x4e228a['rules'][_0x163323];}_0x464448[_0x10e0('0x4d')]();});_0x4e228a[_0x10e0('0x49')][_0x163323]['on']('complete',function(){if(_0x4e228a[_0x10e0('0x49')][_0x163323]){delete _0x4e228a[_0x10e0('0x49')][_0x163323];}});_0x1052f3=setTimeout(function(){logger[_0x10e0('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x163323);endRouting(_0x163323,_0x3cde37,_0x4931cc,_0x4e228a);clearTimeout(_0x1052f3);_0xf81cd6[_0x10e0('0x4c')](!![]);_0x464448[_0x10e0('0x4e')]();},_0x2eb0ed);switch(_0x3cde37[_0x10e0('0x4f')]){case _0x10e0('0x50'):strategy[_0x10e0('0x50')](_0xf81cd6,_0x3cde37,_0x4e228a,_0x4931cc);break;default:strategy[_0x10e0('0x51')](_0xf81cd6,_0x3cde37,_0x4e228a,_0x4931cc);}}else{logger[_0x10e0('0x3d')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x163323,_0x13d56d[_0x10e0('0x34')]);_0x464448[_0x10e0('0x4d')]();}}}catch(_0x293d5a){logger[_0x10e0('0x3d')](_0x10e0('0x41'),_0x163323,_0x293d5a[_0x10e0('0x52')]);_0x464448[_0x10e0('0x4d')]();}};}; \ No newline at end of file +var _0x9c79=['upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','account','name','QueueReport','create','catch','error','accepted','info','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','createQueue','qtimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','from','emit','clone','queue','push','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel'];(function(_0x19c788,_0x2cf31d){var _0x364e70=function(_0x4106ce){while(--_0x4106ce){_0x19c788['push'](_0x19c788['shift']());}};_0x364e70(++_0x2cf31d);}(_0x9c79,0x1d6));var _0x99c7=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0x9c79[_0xacb1e2];return _0x463815;};'use strict';var schema=require(_0x99c7('0x0'));var _=require(_0x99c7('0x1'));var util=require(_0x99c7('0x2'));var seqqueue=require(_0x99c7('0x3'));var moment=require(_0x99c7('0x4'));var Redis=require(_0x99c7('0x5'));var config=require(_0x99c7('0x6'));var logger=require('../../../../config/logger')(_0x99c7('0x7'));var strategy=require(_0x99c7('0x8'));config[_0x99c7('0x9')]=_[_0x99c7('0xa')](config[_0x99c7('0x9')],{'host':_0x99c7('0xb'),'port':0x18eb});var io=require(_0x99c7('0xc'))(new Redis(config[_0x99c7('0x9')]));var attributes=['id',_0x99c7('0xd'),'account','queue',_0x99c7('0xe'),'joinAt'];function emit(_0x5993cd,_0x433d33,_0x13c9e6){io['to'](_0x5993cd)[_0x99c7('0xf')](_0x433d33,_0x13c9e6);}function emitChannelQueueInteraction(_0x2bab2f,_0x1dc799,_0x5864f8,_0xe634ad,_0x245464,_0x6ed154,_0x5de676,_0x506bc4){var _0x1fce2b=_[_0x99c7('0x10')](_0x5864f8);_0x1fce2b['queue_id']=_0x506bc4;_0x1fce2b[_0x99c7('0x11')]=_0x1dc799;_0x1fce2b['account']=_0xe634ad;_0x1fce2b['id']=_0x245464;if(_0x6ed154){attributes[_0x99c7('0x12')](_['capitalize'](_0x2bab2f)+_0x99c7('0x13'));_0x5de676[util['format'](_0x99c7('0x14'),_0x2bab2f)][_0x245464]=_[_0x99c7('0x15')](_0x1fce2b,attributes);}else{delete _0x5de676[util[_0x99c7('0x16')](_0x99c7('0x14'),_0x2bab2f)][_0x245464];}emit(util[_0x99c7('0x16')](_0x99c7('0x17'),_0x2bab2f,_0x1dc799),util['format'](_0x99c7('0x18'),_0x2bab2f,_0x6ed154?_0x99c7('0x19'):_0x99c7('0x1a')),_[_0x99c7('0x15')](_0x1fce2b,attributes));}var rpc={'openchannelQueueReport':require(_0x99c7('0x1b')),'mailQueueReport':require(_0x99c7('0x1c')),'chatQueueReport':require(_0x99c7('0x1d')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x99c7('0x1e')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x99c7('0x1f')),'faxInteraction':require(_0x99c7('0x20')),'mailInteraction':require(_0x99c7('0x21')),'openchannelInteraction':require(_0x99c7('0x22')),'smsInteraction':require(_0x99c7('0x23')),'whatsappInteraction':require(_0x99c7('0x24'))};var queue=schema({'name':{'type':_0x99c7('0x25'),'required':!![],'message':_0x99c7('0x26')},'timeout':{'type':_0x99c7('0x27'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xcdab88,_0x44e208,_0x1c4735,_0x4fbac0){if(_0xcdab88&&_0x44e208&&_0x1c4735){_0x44e208[_0x99c7('0x28')]+=0x1;var _0x2f968d={'uniqueid':_0xcdab88,'from':_0x1c4735[_0x99c7('0x29')]?_0x1c4735[_0x99c7('0x29')][_0x99c7('0xe')]:'','joinAt':moment()[_0x99c7('0x16')](_0x99c7('0x2a')),'ContactId':_0x1c4735['contact']?_0x1c4735[_0x99c7('0x2b')]['id']:null,'ListId':_0x1c4735[_0x99c7('0x2c')]?_0x1c4735['list']['id']:null};_0x2f968d[_['upperFirst'](_0x1c4735[_0x99c7('0x2d')])+'QueueId']=_0x44e208['id']||null;_0x2f968d[_[_0x99c7('0x2e')](_0x1c4735[_0x99c7('0x2d')])+'InteractionId']=_0x1c4735[_0x99c7('0x2f')]?_0x1c4735['interaction']['id']:null;_0x2f968d[_[_0x99c7('0x2e')](_0x1c4735[_0x99c7('0x2d')])+_0x99c7('0x30')]=_0x1c4735[_0x99c7('0x31')]?_0x1c4735[_0x99c7('0x31')]['id']:null;_0x2f968d[_[_0x99c7('0x2e')](_0x1c4735['channel'])+(_0x1c4735['channel']!==_0x99c7('0x32')?_0x99c7('0x33'):_0x99c7('0x34'))]=_0x1c4735[_0x99c7('0x35')]?_0x1c4735[_0x99c7('0x35')]['id']:null;logger['info'](util[_0x99c7('0x16')]('[%s][START:QUEUE][NAME:%s]',_0xcdab88,_0x44e208[_0x99c7('0x36')]));emitChannelQueueInteraction(_0x1c4735[_0x99c7('0x2d')],_0x44e208[_0x99c7('0x36')],_0x2f968d,_0x1c4735[_0x99c7('0x35')][_0x99c7('0x36')],_0x1c4735[_0x99c7('0x31')]['id'],!![],_0x4fbac0,_0x44e208['id']);if(rpc[_0x1c4735['channel']+'QueueReport']){return rpc[_0x1c4735[_0x99c7('0x2d')]+_0x99c7('0x37')][_0x99c7('0x38')](_0x2f968d)[_0x99c7('0x39')](function(_0x505c42){logger[_0x99c7('0x3a')]('create\x20queue\x20report',_0x505c42);});}}}function stopRouting(_0x56132c,_0x17a484,_0x35628f,_0x850ebf){if(_0x56132c&&_0x17a484){_0x17a484[_0x99c7('0x28')]-=0x1;var _0x5e8392={'leaveAt':moment()[_0x99c7('0x16')](_0x99c7('0x2a')),'acceptAt':moment()['format'](_0x99c7('0x2a')),'reason':_0x99c7('0x3b')};logger[_0x99c7('0x3c')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x56132c,_0x17a484[_0x99c7('0x36')]));emitChannelQueueInteraction(_0x35628f['channel'],_0x17a484[_0x99c7('0x36')],_0x35628f[_0x99c7('0x29')],_0x35628f[_0x99c7('0x35')]['name'],_0x35628f['message']['id'],![],_0x850ebf,_0x17a484['id']);return rpc[_0x35628f[_0x99c7('0x2d')]+_0x99c7('0x3d')][_0x99c7('0x3e')](_0x35628f[_0x99c7('0x2f')]['id'],{'queueId':_0x17a484['id']})[_0x99c7('0x3f')](function(){if(rpc[_0x35628f[_0x99c7('0x2d')]+_0x99c7('0x37')]){return rpc[_0x35628f[_0x99c7('0x2d')]+_0x99c7('0x37')][_0x99c7('0x3e')](_0x56132c,_0x5e8392)['catch'](function(_0xa98165){logger[_0x99c7('0x3a')](_0x99c7('0x40'),_0xa98165);});}});}}function endRouting(_0x4ecf69,_0x221d77,_0x3e0951,_0x33d802){if(_0x4ecf69&&_0x221d77){_0x221d77['waiting']-=0x1;var _0x4af252={'leaveAt':moment()[_0x99c7('0x16')](_0x99c7('0x2a')),'exitAt':moment()[_0x99c7('0x16')](_0x99c7('0x2a')),'reason':_0x99c7('0x41')};logger[_0x99c7('0x3c')](util[_0x99c7('0x16')](_0x99c7('0x42'),_0x4ecf69,_0x221d77[_0x99c7('0x36')]));emitChannelQueueInteraction(_0x3e0951[_0x99c7('0x2d')],_0x221d77[_0x99c7('0x36')],_0x3e0951[_0x99c7('0x29')],_0x3e0951[_0x99c7('0x35')][_0x99c7('0x36')],_0x3e0951[_0x99c7('0x31')]['id'],![],_0x33d802);if(rpc[_0x3e0951[_0x99c7('0x2d')]+_0x99c7('0x37')]){return rpc[_0x3e0951['channel']+_0x99c7('0x37')][_0x99c7('0x3e')](_0x4ecf69,_0x4af252)[_0x99c7('0x39')](function(_0x3fe6d9){logger[_0x99c7('0x3a')](_0x99c7('0x40'),_0x3fe6d9);});}}}function handleFindQueue(_0x3a679d){return function(_0x30cdc3){return _0x30cdc3[_0x99c7('0x36')][_0x99c7('0x43')]()===_0x3a679d[_0x99c7('0x43')]();};}exports[_0x99c7('0x44')]=function(_0x55eb9d,_0x3f8078,_0x5bf252,_0x16e21b){return function(_0x3662ff){try{var _0x27a6c3={'name':_0x3f8078[0x0],'timeout':_0x3f8078[0x1]};var _0x54c1c7=queue[_0x99c7('0x0')](_0x27a6c3,{'typecast':!![]});if(_0x54c1c7[_0x99c7('0x45')]){logger[_0x99c7('0x3a')](_0x99c7('0x46'),_0x55eb9d,_[_0x99c7('0x47')](_0x54c1c7,_0x99c7('0x31'))['join'](',\x20'));_0x3662ff[_0x99c7('0x48')]();}else{var _0x39ccf2=_[_0x99c7('0x49')](_0x5bf252[_0x16e21b[_0x99c7('0x2d')]+'Queues'],handleFindQueue(_0x27a6c3[_0x99c7('0x36')]));if(_0x39ccf2){startRouting(_0x55eb9d,_0x39ccf2,_0x16e21b,_0x5bf252);var _0x405432=(_0x39ccf2[_0x99c7('0x41')]||0xa)*0x3e8;var _0x500064=(_0x27a6c3[_0x99c7('0x41')]||0x14)*0x3e8;var _0x196ac6;if(_0x405432>_0x500064){_0x500064=_0x405432;}var _0x3e65bc=seqqueue[_0x99c7('0x4a')](_0x405432);_0x3e65bc['id']=_0x55eb9d;_0x3e65bc['atimeout']=_0x405432;_0x3e65bc[_0x99c7('0x4b')]=_0x500064;_0x3e65bc[_0x99c7('0x2d')]=_0x16e21b[_0x99c7('0x2d')];_0x5bf252[_0x99c7('0x4c')][_0x55eb9d]['on'](_0x99c7('0x4d'),function(){logger[_0x99c7('0x3c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x55eb9d);stopRouting(_0x55eb9d,_0x39ccf2,_0x16e21b,_0x5bf252);clearTimeout(_0x196ac6);_0x196ac6=undefined;_0x3e65bc[_0x99c7('0x4e')](!![]);if(_0x5bf252[_0x99c7('0x4c')][_0x55eb9d]){delete _0x5bf252[_0x99c7('0x4c')][_0x55eb9d];}_0x3662ff[_0x99c7('0x48')]();});_0x5bf252['rules'][_0x55eb9d]['on'](_0x99c7('0x4f'),function(){if(_0x5bf252[_0x99c7('0x4c')][_0x55eb9d]){delete _0x5bf252['rules'][_0x55eb9d];}});_0x196ac6=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x55eb9d);endRouting(_0x55eb9d,_0x39ccf2,_0x16e21b,_0x5bf252);clearTimeout(_0x196ac6);_0x3e65bc[_0x99c7('0x4e')](!![]);_0x3662ff[_0x99c7('0x50')]();},_0x500064);switch(_0x39ccf2[_0x99c7('0x51')]){case _0x99c7('0x52'):strategy['rrmemory'](_0x3e65bc,_0x39ccf2,_0x5bf252,_0x16e21b);break;default:strategy[_0x99c7('0x53')](_0x3e65bc,_0x39ccf2,_0x5bf252,_0x16e21b);}}else{logger[_0x99c7('0x3a')](_0x99c7('0x54'),_0x55eb9d,_0x27a6c3[_0x99c7('0x36')]);_0x3662ff[_0x99c7('0x48')]();}}}catch(_0x2cc147){logger[_0x99c7('0x3a')](_0x99c7('0x46'),_0x55eb9d,_0x2cc147[_0x99c7('0x55')]);_0x3662ff[_0x99c7('0x48')]();}};}; \ 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 c30a75f..a9cf30d 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0bb=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xfc53fc,_0x4204d6){_0xfc53fc=_0xfc53fc-0x0;var _0x423828=_0xd0bb[_0xfc53fc];return _0x423828;};'use strict';var _=require(_0xbd0b('0x0'));var uuid=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var logger=require('../../../../../config/logger')(_0xbd0b('0x3'));var Agent=function(_0x4ab08f,_0x39b03a,_0x1f6ec3,_0x53e6ce){this[_0xbd0b('0x4')]=uuid['v4']();this['squeue']=_0x4ab08f;this[_0xbd0b('0x5')]=_0x39b03a;this[_0xbd0b('0x6')]=_0x1f6ec3;this[_0xbd0b('0x3')]=_0x53e6ce;this[_0xbd0b('0x7')][_0xbd0b('0x8')](this['handleRun'][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xb'),this['handleTimeout']['bind'](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xc'),this['handleDrained'][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')]['push']=function(){this[_0xbd0b('0x7')][_0xbd0b('0x8')](this[_0xbd0b('0xe')][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')][_0xbd0b('0xf')]=function(){this[_0xbd0b('0xa')](!![]);};Agent[_0xbd0b('0xd')][_0xbd0b('0xe')]=function(){logger['debug'](_0xbd0b('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']])){logger[_0xbd0b('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xbd0b('0x5')]['id']);setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}else{if(this[_0xbd0b('0x3')][_0xbd0b('0x14')]||util[_0xbd0b('0x15')](this['squeue']['id'],this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']],this[_0xbd0b('0x7')][_0xbd0b('0x16')],![])){this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=!![];this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']]['busyQueue']=undefined;util[_0xbd0b('0x18')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x19')](this['notificationId'],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],null,this[_0xbd0b('0x3')]);util[_0xbd0b('0x1a')](this['squeue']['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xbd0b('0x1b')+(this[_0xbd0b('0x3')][_0xbd0b('0x14')]?':FORCED':''));}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1c'),this[_0xbd0b('0x7')]['id'],this['agent']['id']);setTimeout(this['push'][_0xbd0b('0x9')](this),0x3e8);}}};Agent[_0xbd0b('0xd')][_0xbd0b('0xa')]=function(_0xf4ba04){if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']])){return logger[_0xbd0b('0x13')](_0xbd0b('0x1d'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1e'),this['squeue']['id'],this[_0xbd0b('0x5')]['id']);util[_0xbd0b('0x1f')](this[_0xbd0b('0x4')],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']],null,this[_0xbd0b('0x3')]);this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=![];this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x20')]=undefined;util[_0xbd0b('0x21')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x1a')](this[_0xbd0b('0x7')]['id'],this['realtime'][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xf4ba04?_0xbd0b('0x22'):_0xbd0b('0x23'));}if(!_0xf4ba04){setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}};function agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098){return new Agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098);}module[_0xbd0b('0x24')]=agent; \ No newline at end of file +var _0x826a=['forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','removeWaitingNotification','TIMEOUT','exports','uuid','../../../../../config/logger','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','agents','debug','isAgentAvailable','channel','showNotification','notificationId','writeLog','RINGING'];(function(_0x22f50a,_0x293bae){var _0xc90790=function(_0x16d718){while(--_0x16d718){_0x22f50a['push'](_0x22f50a['shift']());}};_0xc90790(++_0x293bae);}(_0x826a,0x1aa));var _0xa826=function(_0xc0ab42,_0x5d4821){_0xc0ab42=_0xc0ab42-0x0;var _0x50645c=_0x826a[_0xc0ab42];return _0x50645c;};'use strict';var _=require('lodash');var uuid=require(_0xa826('0x0'));var util=require('./util');var logger=require(_0xa826('0x1'))('routing');var Agent=function(_0x376d53,_0x19ba11,_0x2212a4,_0x34e1ad){this['notificationId']=uuid['v4']();this[_0xa826('0x2')]=_0x376d53;this[_0xa826('0x3')]=_0x19ba11;this[_0xa826('0x4')]=_0x2212a4;this[_0xa826('0x5')]=_0x34e1ad;this[_0xa826('0x2')][_0xa826('0x6')](this[_0xa826('0x7')][_0xa826('0x8')](this),this[_0xa826('0x9')][_0xa826('0x8')](this));this[_0xa826('0x2')]['on'](_0xa826('0xa'),this[_0xa826('0x9')][_0xa826('0x8')](this));this[_0xa826('0x2')]['on'](_0xa826('0xb'),this['handleDrained'][_0xa826('0x8')](this));};Agent['prototype'][_0xa826('0x6')]=function(){this[_0xa826('0x2')][_0xa826('0x6')](this[_0xa826('0x7')][_0xa826('0x8')](this),this[_0xa826('0x9')][_0xa826('0x8')](this));};Agent['prototype'][_0xa826('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xa826('0xd')][_0xa826('0x7')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xa826('0x3')]['id']);if(_['isNil'](this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']])){logger[_0xa826('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);setTimeout(this[_0xa826('0x6')][_0xa826('0x8')](this),0x3e8);}else{if(this[_0xa826('0x5')]['forcedOwnership']||util[_0xa826('0x10')](this[_0xa826('0x2')]['id'],this[_0xa826('0x4')]['agents'][this['agent']['id']],this[_0xa826('0x2')][_0xa826('0x11')],![])){this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busy']=!![];this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this[_0xa826('0x4')],this[_0xa826('0x5')],this[_0xa826('0x3')],this['squeue'][_0xa826('0x11')]);util[_0xa826('0x12')](this[_0xa826('0x13')],this[_0xa826('0x2')]['id'],this[_0xa826('0x4')]['agents'][this[_0xa826('0x3')]['id']],null,this['routing']);util[_0xa826('0x14')](this[_0xa826('0x2')]['id'],this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']],_0xa826('0x15')+(this[_0xa826('0x5')][_0xa826('0x16')]?_0xa826('0x17'):''));}else{logger[_0xa826('0xf')](_0xa826('0x18'),this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);setTimeout(this[_0xa826('0x6')][_0xa826('0x8')](this),0x3e8);}}};Agent[_0xa826('0xd')][_0xa826('0x9')]=function(_0x2253c7){if(_[_0xa826('0x19')](this['realtime'][_0xa826('0xe')][this['agent']['id']])){return logger[_0xa826('0xf')](_0xa826('0x1a'),this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);}else{logger[_0xa826('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xa826('0x3')]['id']);util[_0xa826('0x1b')](this[_0xa826('0x13')],this[_0xa826('0x2')]['id'],this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']],null,this['routing']);this[_0xa826('0x4')]['agents'][this[_0xa826('0x3')]['id']][_0xa826('0x1c')]=![];this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busyQueue']=undefined;util[_0xa826('0x1d')](this[_0xa826('0x4')],this[_0xa826('0x5')],this[_0xa826('0x3')],this[_0xa826('0x2')][_0xa826('0x11')]);util[_0xa826('0x14')](this[_0xa826('0x2')]['id'],this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']],_0x2253c7?'STOP':_0xa826('0x1e'));}if(!_0x2253c7){setTimeout(this['push'][_0xa826('0x8')](this),0x3e8);}};function agent(_0x4d8c2a,_0x179c29,_0x2bae70,_0x31889f){return new Agent(_0x4d8c2a,_0x179c29,_0x2bae70,_0x31889f);}module[_0xa826('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index a762aa4..0ff2f89 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 _0x5550=['STOP','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','routing','handleRun','bind','timeout','handleTimeout','drained','prototype','push','handleDrained','isNil','Agents','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5550,0x106));var _0x0555=function(_0x1a958f,_0x36a2a0){_0x1a958f=_0x1a958f-0x0;var _0x4de394=_0x5550[_0x1a958f];return _0x4de394;};'use strict';var _=require(_0x0555('0x0'));var uuid=require(_0x0555('0x1'));var util=require(_0x0555('0x2'));var logger=require(_0x0555('0x3'))('routing');var Beepall=function(_0x227ad8,_0x3bee65,_0x138220,_0x37b2ac){this[_0x0555('0x4')]=uuid['v4']();this[_0x0555('0x5')]=_0x227ad8;this[_0x0555('0x6')]=_0x3bee65;this['realtime']=_0x138220;this[_0x0555('0x7')]=_0x37b2ac;this[_0x0555('0x5')]['push'](this[_0x0555('0x8')][_0x0555('0x9')](this),this['handleTimeout'][_0x0555('0x9')](this));this['squeue']['on'](_0x0555('0xa'),this[_0x0555('0xb')][_0x0555('0x9')](this));this[_0x0555('0x5')]['on'](_0x0555('0xc'),this['handleDrained'][_0x0555('0x9')](this));};Beepall[_0x0555('0xd')]['push']=function(){this[_0x0555('0x5')][_0x0555('0xe')](this['handleRun']['bind'](this),this['handleTimeout'][_0x0555('0x9')](this));};Beepall[_0x0555('0xd')][_0x0555('0xf')]=function(){this[_0x0555('0xb')](!![]);};Beepall[_0x0555('0xd')][_0x0555('0x8')]=function(){var _0x2a4ded=!![];if(!_['isNil'](this[_0x0555('0x6')])&&!_[_0x0555('0x10')](this['queue'][_0x0555('0x11')])&&this['queue']['Agents']['length']>0x0){for(var _0x3c117f=0x0,_0x500c5d;_0x3c117f0x0){for(var _0x16507c=0x0,_0x3d98c5;_0x16507c0x0&&_0x275cb6[_0x2bd103+_0x5837('0x24')]>=_0x275cb6[_0x2bd103+_0x5837('0x22')]){writeLog(_0x5475c3,_0x275cb6,_0x2bd103[_0x5837('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x1d545c,_0x15655e,_0x23a4e3,_0x2ae6a0,_0x2d5c00){return sendNotification(!![],_0x1d545c,_0x15655e,_0x23a4e3,_0x2ae6a0,_0x2d5c00);};exports[_0x5837('0x26')]=function(_0x2baf9b,_0x2ee271,_0x492603,_0x2f0c8d,_0x13830f){return sendNotification(![],_0x2baf9b,_0x2ee271,_0x492603,_0x2f0c8d,_0x13830f);};exports[_0x5837('0x27')]=function(_0x3918ee,_0x1c9f32,_0x228f1){var _0x1761c1=_0x1c9f32[_0x5837('0x28')]['UserId'];if(!_0x1761c1&&_0x228f1){_0x1761c1=_0x228f1['id'];}var _0x4f7502=_[_0x5837('0x29')](_0x3918ee[_0x1c9f32[_0x5837('0x2a')]+'QueuesWaitingInteractions'],function(_0x298ea1){var _0x6ea409=_['capitalize'](_0x1c9f32[_0x5837('0x2a')])+_0x5837('0x2b');return _0x298ea1[_0x6ea409]===_0x1c9f32[_0x5837('0x28')]['id'];});if(!_0x4f7502&&_0x1761c1&&_0x3918ee['agents'][_0x1761c1]){_0x4f7502=_['some'](_0x3918ee['agents'][_0x1761c1][_0x1c9f32[_0x5837('0x2a')]+_0x5837('0x2c')],function(_0x200ec7){return _0x200ec7['id']===_0x1c9f32[_0x5837('0x28')]['id'];});}return _0x4f7502;};exports[_0x5837('0x2d')]=function(_0x4d2a08,_0x4bf885,_0x157107,_0x3bb513){if(_0x157107&&_0x157107['id']&&_0x4d2a08['agents']&&_0x4d2a08['agents'][_0x157107['id']]){_0x4d2a08[_0x5837('0x2e')][_0x157107['id']][_0x3bb513+'WaitingInteractions'][_0x4bf885['message']['id']]={'id':_0x4bf885[_0x5837('0x28')]['id']};}};exports[_0x5837('0x2f')]=function(_0x50dd31,_0x704f13,_0x323981,_0x2c8321){if(_0x323981&&_0x323981['id']&&_0x50dd31['agents']&&_0x50dd31[_0x5837('0x2e')][_0x323981['id']]){delete _0x50dd31[_0x5837('0x2e')][_0x323981['id']][_0x2c8321+_0x5837('0x2c')][_0x704f13[_0x5837('0x19')]['id']];}};exports[_0x5837('0x30')]=writeLog; \ No newline at end of file +var _0x56a6=['CurrentCapacity','toUpperCase','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','QueuesWaitingInteractions','capitalize','channel','InteractionId','agents','saveWaitingNotification','WaitingInteractions','writeLog','lodash','util','../utils','ioredis','routing','redis','defaults','localhost','socket.io-emitter','name','emit','user:save','split','\x20interaction','notificationShake','body','queue','msg','getMustacheRender','account','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','debug','busy','online','OFFLINE','Pause','hasOwnProperty','Capacity'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0x56a6,0x17b));var _0x656a=function(_0xd802fd,_0x325b69){_0xd802fd=_0xd802fd-0x0;var _0x176c44=_0x56a6[_0xd802fd];return _0x176c44;};'use strict';var _=require(_0x656a('0x0'));var util=require(_0x656a('0x1'));var utils=require(_0x656a('0x2'));var Redis=require(_0x656a('0x3'));var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0x656a('0x4'));config[_0x656a('0x5')]=_[_0x656a('0x6')](config['redis'],{'host':_0x656a('0x7'),'port':0x18eb});var io=require(_0x656a('0x8'))(new Redis(config[_0x656a('0x5')]));function sendNotification(_0x529aac,_0x42f089,_0x33cb4a,_0x29e66f,_0x551d61,_0xea808c){io['to'](util['format']('user:%s',_0x29e66f[_0x656a('0x9')]))[_0x656a('0xa')](_0x656a('0xb'),_0x29e66f);var _0x218d19=_0xea808c||{};var _0x4d9f32=_0x33cb4a[_0x656a('0xc')]('.');var _0xd98931={'uniqueid':_0x42f089,'channel':_0x4d9f32[0x0],'id':_0x4d9f32[0x1],'title':_0x4d9f32[0x0]+_0x656a('0xd'),'interactionId':_0x4d9f32[0x2],'queue':_0x551d61?_0x551d61[_0x656a('0x9')]:null,'sound':_0x218d19['account']['notificationSound'],'shake':_0x218d19['account'][_0x656a('0xe')]};try{if(!_0x218d19[_0x656a('0xf')]){_0x218d19[_0x656a('0xf')]={};}if(_0x551d61){_0x218d19[_0x656a('0xf')][_0x656a('0x10')]=_0x551d61;}else if(_0x218d19['body'][_0x656a('0x10')]){delete _0x218d19[_0x656a('0xf')][_0x656a('0x10')];}_0xd98931[_0x656a('0x11')]=utils[_0x656a('0x12')](_0x218d19[_0x656a('0x13')][_0x656a('0x14')],_0x218d19);}catch(_0x3c8d71){_0xd98931['msg']=_0x656a('0x15');logger[_0x656a('0x16')](util[_0x656a('0x17')](_0x656a('0x18'),_0x42f089,_0x3c8d71[_0x656a('0x19')]));}io['to'](util[_0x656a('0x17')](_0x656a('0x1a'),_0x29e66f[_0x656a('0x9')]))[_0x656a('0xa')](util['format'](_0x656a('0x1b'),_0x529aac?_0x656a('0x1c'):_0x656a('0x1d')),_0xd98931);}function writeLog(_0x2affe9,_0x2ecc76,_0x17377a){return logger[_0x656a('0x1e')](util[_0x656a('0x17')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2affe9,_0x2ecc76[_0x656a('0x9')],_0x17377a));}exports['isAgentAvailable']=function(_0x507cad,_0x5c2e25,_0x53c0b6,_0x124f76){if(_0x5c2e25[_0x656a('0x1f')]){writeLog(_0x507cad,_0x5c2e25,'BUSY');return![];}if(!_0x5c2e25[_0x656a('0x20')]){writeLog(_0x507cad,_0x5c2e25,_0x656a('0x21'));return![];}if(_0x5c2e25[_0x53c0b6+_0x656a('0x22')]){writeLog(_0x507cad,_0x5c2e25,'PAUSE');return![];}if(_0x124f76&&_0x5c2e25[_0x656a('0x23')](_0x53c0b6+_0x656a('0x24'))&&_0x5c2e25[_0x656a('0x23')](_0x53c0b6+_0x656a('0x25'))){if(_0x5c2e25[_0x53c0b6+_0x656a('0x24')]>0x0&&_0x5c2e25[_0x53c0b6+_0x656a('0x25')]>=_0x5c2e25[_0x53c0b6+_0x656a('0x24')]){writeLog(_0x507cad,_0x5c2e25,_0x53c0b6[_0x656a('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x656a('0x27')]=function(_0x4c79cd,_0x223d67,_0x568066,_0x2008fe,_0x505680){return sendNotification(!![],_0x4c79cd,_0x223d67,_0x568066,_0x2008fe,_0x505680);};exports[_0x656a('0x28')]=function(_0x4b60f0,_0x5b5bd4,_0x5b580a,_0x55abd2,_0x47bcc0){return sendNotification(![],_0x4b60f0,_0x5b5bd4,_0x5b580a,_0x55abd2,_0x47bcc0);};exports[_0x656a('0x29')]=function(_0x49a723,_0xb19ba7,_0x5a756c){var _0x2ac965=_0xb19ba7[_0x656a('0x2a')][_0x656a('0x2b')];if(!_0x2ac965&&_0x5a756c){_0x2ac965=_0x5a756c['id'];}var _0x2db0d3=_['some'](_0x49a723[_0xb19ba7['channel']+_0x656a('0x2c')],function(_0x3a877b){var _0x503b06=_[_0x656a('0x2d')](_0xb19ba7[_0x656a('0x2e')])+_0x656a('0x2f');return _0x3a877b[_0x503b06]===_0xb19ba7[_0x656a('0x2a')]['id'];});if(!_0x2db0d3&&_0x2ac965&&_0x49a723['agents'][_0x2ac965]){_0x2db0d3=_['some'](_0x49a723[_0x656a('0x30')][_0x2ac965][_0xb19ba7[_0x656a('0x2e')]+'WaitingInteractions'],function(_0x5ee4f4){return _0x5ee4f4['id']===_0xb19ba7[_0x656a('0x2a')]['id'];});}return _0x2db0d3;};exports[_0x656a('0x31')]=function(_0x2e835e,_0x4c4457,_0x5422f3,_0x3d6d8a){if(_0x5422f3&&_0x5422f3['id']&&_0x2e835e[_0x656a('0x30')]&&_0x2e835e[_0x656a('0x30')][_0x5422f3['id']]){_0x2e835e[_0x656a('0x30')][_0x5422f3['id']][_0x3d6d8a+_0x656a('0x32')][_0x4c4457[_0x656a('0x19')]['id']]={'id':_0x4c4457['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x375b4b,_0x401b45,_0x4cc1db,_0x377763){if(_0x4cc1db&&_0x4cc1db['id']&&_0x375b4b[_0x656a('0x30')]&&_0x375b4b['agents'][_0x4cc1db['id']]){delete _0x375b4b[_0x656a('0x30')][_0x4cc1db['id']][_0x377763+_0x656a('0x32')][_0x401b45[_0x656a('0x19')]['id']];}};exports[_0x656a('0x33')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 34ad4c5..73fed4f 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 _0xbe9a=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message'];(function(_0xcc2ec6,_0x2edc8e){var _0x4e8d8d=function(_0x4e5967){while(--_0x4e5967){_0xcc2ec6['push'](_0xcc2ec6['shift']());}};_0x4e8d8d(++_0x2edc8e);}(_0xbe9a,0x1a4));var _0xabe9=function(_0x13f853,_0x414bb2){_0x13f853=_0x13f853-0x0;var _0x2003ca=_0xbe9a[_0x13f853];return _0x2003ca;};'use strict';var schema=require(_0xabe9('0x0'));var sh=require('shelljs');var _=require(_0xabe9('0x1'));var utils=require(_0xabe9('0x2'));var logger=require(_0xabe9('0x3'))('routing');var system=schema({'command':{'type':_0xabe9('0x4'),'required':!![],'message':_0xabe9('0x5')}});exports[_0xabe9('0x6')]=function(_0x2dcb9d,_0x4bbaff){return function(_0x238c65){try{var _0x40b9aa={'command':_0x4bbaff[0x0]};var _0x1ee7e0=system[_0xabe9('0x0')](_0x40b9aa,{'typecast':!![]});if(_0x1ee7e0[_0xabe9('0x7')]){logger[_0xabe9('0x8')](_0xabe9('0x9'),_0x2dcb9d,_[_0xabe9('0xa')](_0x1ee7e0,_0xabe9('0xb'))['join'](',\x20'));logger[_0xabe9('0xc')](_0xabe9('0xd'),_0x2dcb9d);_0x238c65[_0xabe9('0xe')]();}else{var _0x1746f7=this;var _0x3dff04=utils[_0xabe9('0xf')](_0x4bbaff[0x0],this);logger[_0xabe9('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2dcb9d,_0x3dff04);sh[_0xabe9('0x10')](_[_0xabe9('0x11')](_0x3dff04),function(_0x5168fd,_0x3c4e89){logger[_0xabe9('0xc')](_0xabe9('0x12'),_0x2dcb9d,_0x5168fd);if(_0x5168fd==0x0){var _0x17858c=_0x3c4e89[_0xabe9('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4bbaff[0x1])||_[_0xabe9('0x14')](_0x4bbaff[0x1])){logger[_0xabe9('0xc')](_0xabe9('0x15'),_0x2dcb9d);_0x1746f7['body'][_0x4bbaff[0x1]]=_0x17858c;}else{logger[_0xabe9('0xc')](_0xabe9('0x16'),_0x2dcb9d,_0x4bbaff[0x1],_0x17858c);_0x1746f7['body'][_0x4bbaff[0x1]]=_0x17858c;}}_0x238c65[_0xabe9('0xe')]();});}}catch(_0x50dac7){logger[_0xabe9('0x8')](_0xabe9('0x9'),_0x2dcb9d,_['isObject'](_0x50dac7)?JSON[_0xabe9('0x17')](_0x50dac7):_0x50dac7);logger[_0xabe9('0xc')](_0xabe9('0xd'),_0x2dcb9d);_0x238c65[_0xabe9('0xe')]();}};}; \ No newline at end of file +var _0x1832=['stringify','validate','shelljs','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject'];(function(_0x20a1fa,_0x52f364){var _0x114327=function(_0x10fc2d){while(--_0x10fc2d){_0x20a1fa['push'](_0x20a1fa['shift']());}};_0x114327(++_0x52f364);}(_0x1832,0x12a));var _0x2183=function(_0x53119d,_0x1b1a45){_0x53119d=_0x53119d-0x0;var _0x297a30=_0x1832[_0x53119d];return _0x297a30;};'use strict';var schema=require(_0x2183('0x0'));var sh=require(_0x2183('0x1'));var _=require('lodash');var utils=require(_0x2183('0x2'));var logger=require('../../../../config/logger')(_0x2183('0x3'));var system=schema({'command':{'type':_0x2183('0x4'),'required':!![],'message':_0x2183('0x5')}});exports[_0x2183('0x6')]=function(_0x29b67a,_0x16fac5){return function(_0x204056){try{var _0x4059fa={'command':_0x16fac5[0x0]};var _0x2a8215=system['validate'](_0x4059fa,{'typecast':!![]});if(_0x2a8215[_0x2183('0x7')]){logger[_0x2183('0x8')](_0x2183('0x9'),_0x29b67a,_[_0x2183('0xa')](_0x2a8215,_0x2183('0xb'))[_0x2183('0xc')](',\x20'));logger[_0x2183('0xd')](_0x2183('0xe'),_0x29b67a);_0x204056[_0x2183('0xf')]();}else{var _0x247234=this;var _0x36febf=utils['getMustacheRender'](_0x16fac5[0x0],this);logger[_0x2183('0xd')](_0x2183('0x10'),_0x29b67a,_0x36febf);sh[_0x2183('0x11')](_['trim'](_0x36febf),function(_0x161a67,_0x36d150){logger[_0x2183('0xd')](_0x2183('0x12'),_0x29b67a,_0x161a67);if(_0x161a67==0x0){var _0x33971f=_0x36d150[_0x2183('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x2183('0x14')](_0x16fac5[0x1])||_[_0x2183('0x15')](_0x16fac5[0x1])){logger[_0x2183('0xd')](_0x2183('0x16'),_0x29b67a);_0x247234[_0x2183('0x17')][_0x16fac5[0x1]]=_0x33971f;}else{logger[_0x2183('0xd')](_0x2183('0x18'),_0x29b67a,_0x16fac5[0x1],_0x33971f);_0x247234[_0x2183('0x17')][_0x16fac5[0x1]]=_0x33971f;}}_0x204056[_0x2183('0xf')]();});}}catch(_0x4f01f9){logger['error'](_0x2183('0x9'),_0x29b67a,_[_0x2183('0x19')](_0x4f01f9)?JSON[_0x2183('0x1a')](_0x4f01f9):_0x4f01f9);logger[_0x2183('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x29b67a);_0x204056['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 3fb794a..0c3d72d 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 _0x4956=['../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','finally','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x4956,0x17d));var _0x6495=function(_0x564c9e,_0x3481ec){_0x564c9e=_0x564c9e-0x0;var _0x59319e=_0x4956[_0x564c9e];return _0x59319e;};'use strict';var schema=require('validate');var _=require(_0x6495('0x0'));var rpc={'chatInteraction':require(_0x6495('0x1')),'openchannelInteraction':require(_0x6495('0x2')),'smsInteraction':require(_0x6495('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x6495('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x6495('0x5'))(_0x6495('0x6'));var tag=schema({'tag':{'type':_0x6495('0x7'),'required':!![],'message':_0x6495('0x8')}});exports[_0x6495('0x9')]=function(_0x5c071d,_0x256dd1,_0x5a9857,_0x331d60){return function(_0x5f04ac){try{var _0x324243={'tag':_0x256dd1[0x0]};var _0x4be519=tag['validate'](_0x324243,{'typecast':!![]});if(_0x4be519[_0x6495('0xa')]){logger[_0x6495('0xb')]('[%s][TAG]\x20%s',_0x5c071d,_['map'](_0x4be519,_0x6495('0xc'))['join'](',\x20'));logger[_0x6495('0xd')](_0x6495('0xe'),_0x5c071d);_0x5f04ac[_0x6495('0xf')]();}else{var _0x4d8321={'ids':[_0x256dd1[0x0]]};if(rpc[_0x331d60['channel']+_0x6495('0x10')]){rpc[_0x331d60['channel']+'Interaction'][_0x6495('0x11')](_0x331d60[_0x6495('0x12')]['id'],_0x4d8321)[_0x6495('0x13')](function(_0x62a936){logger[_0x6495('0xd')](_0x6495('0x14'),_0x5c071d,_0x256dd1[0x1],_0x331d60['channel'],_0x331d60['interaction']['id']);})['catch'](function(_0x5cd397){logger[_0x6495('0xb')](_0x6495('0x15'),_0x5c071d,JSON[_0x6495('0x16')](_0x5cd397));logger[_0x6495('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5c071d);})[_0x6495('0x17')](function(){_0x5f04ac[_0x6495('0xf')]();});}}}catch(_0x136161){logger['error'](_0x6495('0x15'),_0x5c071d,_['isObject'](_0x136161)?JSON[_0x6495('0x16')](_0x136161):_0x136161);logger[_0x6495('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5c071d);_0x5f04ac[_0x6495('0xf')]();}};}; \ No newline at end of file +var _0x4119=['error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','consequence','length'];(function(_0x42aeb7,_0x51ea14){var _0x23db20=function(_0x3a8392){while(--_0x3a8392){_0x42aeb7['push'](_0x42aeb7['shift']());}};_0x23db20(++_0x51ea14);}(_0x4119,0x64));var _0x9411=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4119[_0x4cf98e];return _0x1623ac;};'use strict';var schema=require(_0x9411('0x0'));var _=require(_0x9411('0x1'));var rpc={'chatInteraction':require(_0x9411('0x2')),'openchannelInteraction':require(_0x9411('0x3')),'smsInteraction':require(_0x9411('0x4')),'mailInteraction':require(_0x9411('0x5')),'faxInteraction':require(_0x9411('0x6')),'whatsappInteraction':require(_0x9411('0x7'))};var logger=require(_0x9411('0x8'))('routing');var tag=schema({'tag':{'type':_0x9411('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9411('0xa')]=function(_0xd03ec5,_0x4c1f6c,_0xb5c9cf,_0x47733f){return function(_0x53500d){try{var _0x1118e8={'tag':_0x4c1f6c[0x0]};var _0x959a3e=tag[_0x9411('0x0')](_0x1118e8,{'typecast':!![]});if(_0x959a3e[_0x9411('0xb')]){logger[_0x9411('0xc')](_0x9411('0xd'),_0xd03ec5,_[_0x9411('0xe')](_0x959a3e,'message')[_0x9411('0xf')](',\x20'));logger[_0x9411('0x10')](_0x9411('0x11'),_0xd03ec5);_0x53500d[_0x9411('0x12')]();}else{var _0x269a96={'ids':[_0x4c1f6c[0x0]]};if(rpc[_0x47733f[_0x9411('0x13')]+'Interaction']){rpc[_0x47733f[_0x9411('0x13')]+_0x9411('0x14')][_0x9411('0x15')](_0x47733f['interaction']['id'],_0x269a96)[_0x9411('0x16')](function(_0x21bcb2){logger[_0x9411('0x10')](_0x9411('0x17'),_0xd03ec5,_0x4c1f6c[0x1],_0x47733f[_0x9411('0x13')],_0x47733f[_0x9411('0x18')]['id']);})[_0x9411('0x19')](function(_0x328144){logger['error'](_0x9411('0xd'),_0xd03ec5,JSON['stringify'](_0x328144));logger['info'](_0x9411('0x11'),_0xd03ec5);})['finally'](function(){_0x53500d[_0x9411('0x12')]();});}}}catch(_0x38b06e){logger[_0x9411('0xc')](_0x9411('0xd'),_0xd03ec5,_[_0x9411('0x1a')](_0x38b06e)?JSON[_0x9411('0x1b')](_0x38b06e):_0x38b06e);logger['info'](_0x9411('0x11'),_0xd03ec5);_0x53500d[_0x9411('0x12')]();}};}; \ 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 43db550..6012d1e 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 _0x6b8a=['[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence','\x20-\x20','replace','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','params','stringify','utf8','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error'];(function(_0xfa8f7f,_0x240f01){var _0x291537=function(_0x3eedfe){while(--_0x3eedfe){_0xfa8f7f['push'](_0xfa8f7f['shift']());}};_0x291537(++_0x240f01);}(_0x6b8a,0x16f));var _0xa6b8=function(_0x1aba44,_0x228eb7){_0x1aba44=_0x1aba44-0x0;var _0x3c0a1c=_0x6b8a[_0x1aba44];return _0x3c0a1c;};'use strict';var rp=require('request-promise');var logger=require(_0xa6b8('0x0'))('routing');var _=require(_0xa6b8('0x1'));var arr=[];exports[_0xa6b8('0x2')]=function(_0xc3399,_0x3f0071){return function(_0x870342){var _0x11a8bc=_0x3f0071[0xa];var _0x2e1b6e=_0x3f0071[0xb];var _0x56525e=_0x3f0071[0xc];var _0x4f6e8d=_0x3f0071[0xd];var _0x454473=_0x3f0071[0xe];var _0x1021d2=_0x3f0071[0xf]['replace'](/\n/g,_0xa6b8('0x3'));var _0x1e34b0=_0x3f0071[0x10][_0xa6b8('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x2e1b6e)){arr[_0xa6b8('0x5')](_0x2e1b6e);var _0x1777e2=_0x3f0071[0x3];var _0x5cc7c6=_0x3f0071[0x4];var _0x2b0ba0=_0x3f0071[0x1];var _0x557ded=_0x3f0071[0x0];var _0xaa250a={};_0xaa250a[_0xa6b8('0x6')]=_0x3f0071[0x8]+_0xa6b8('0x7')+_0x56525e+'|'+_0x11a8bc+'|'+_0x4f6e8d+'|'+_0x2e1b6e+'|'+_0x454473;_0xaa250a[_0xa6b8('0x8')]=_0x3f0071[0x7]+_0xa6b8('0x7')+_0x56525e+'|'+_0x11a8bc+'|'+_0x4f6e8d+'|'+_0x2e1b6e+'|'+_0x454473+'|'+_0x1021d2+'|'+_0x1e34b0;_0xaa250a[_0xa6b8('0x9')]=_0x3f0071[0x9];var _0x2c9f74={};_0x2c9f74[_0xa6b8('0xa')]=_0xa6b8('0xb');_0x2c9f74[_0xa6b8('0xc')]='login';var _0x3c59e6=[];_0x3c59e6[_0xa6b8('0x5')](_0x3f0071[0x2]);_0x3c59e6[_0xa6b8('0x5')](_0x3f0071[0x5]);_0x3c59e6[_0xa6b8('0x5')](_0x3f0071[0x6]);_0x2c9f74[_0xa6b8('0xd')]=_0x3c59e6;_0x2c9f74['id']=0x1;var _0x52dd53=JSON[_0xa6b8('0xe')](_0x2c9f74);var _0x2785af={'encoding':_0xa6b8('0xf'),'method':_0xa6b8('0x10'),'timeout':0x2710,'url':_0x1777e2,'headers':{'Content-Type':_0xa6b8('0x11')},'body':_0x52dd53};return rp(_0x2785af)[_0xa6b8('0x12')](function(_0x4262ce){const _0x5c3c1d=JSON['parse'](_0x4262ce);if(!_0x5c3c1d[_0xa6b8('0x13')][_0xa6b8('0x14')]){throw new Error(_0xa6b8('0x15'));}var _0x13f459=_0x2e1b6e;var _0x5331c4='channelId='+_0x2b0ba0+_0xa6b8('0x16')+_0x557ded+_0xa6b8('0x17')+_0x13f459+_0xa6b8('0x18')+JSON['stringify'](_0xaa250a);var _0x1ac942=_0x5cc7c6+'?'+_0x5331c4;return rp(_0x1ac942);})[_0xa6b8('0x12')](function(_0x2457a2){logger[_0xa6b8('0x19')](_0xa6b8('0x1a'),_0xc3399,_0x2457a2);_0x870342[_0xa6b8('0x1b')]();})['catch'](function(_0x3e5188){logger[_0xa6b8('0x1c')](_0xa6b8('0x1d'),_0xc3399,_[_0xa6b8('0x1e')](_0x3e5188)?JSON['stringify'](_0x3e5188):_0x3e5188);_0x870342[_0xa6b8('0x1b')]();});}else{logger[_0xa6b8('0x19')](_0xa6b8('0x1f'),_0xc3399);_0x870342[_0xa6b8('0x20')]();}};}; \ No newline at end of file +var _0x9b8c=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','push','title','jsonrpc','2.0','login','params','stringify','utf8','application/json-rpc','parse','result','logged'];(function(_0x4560f3,_0x517d6e){var _0x531125=function(_0x5bacb4){while(--_0x5bacb4){_0x4560f3['push'](_0x4560f3['shift']());}};_0x531125(++_0x517d6e);}(_0x9b8c,0x6a));var _0xc9b8=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x9b8c[_0x25b4a4];return _0x707267;};'use strict';var rp=require(_0xc9b8('0x0'));var logger=require(_0xc9b8('0x1'))(_0xc9b8('0x2'));var _=require(_0xc9b8('0x3'));var arr=[];exports[_0xc9b8('0x4')]=function(_0x35ff7d,_0x124eb7){return function(_0x5baccc){var _0x3c2399=_0x124eb7[0xa];var _0x346a70=_0x124eb7[0xb];var _0x3a8b7e=_0x124eb7[0xc];var _0x5ae694=_0x124eb7[0xd];var _0x25c8a7=_0x124eb7[0xe];var _0x4b2604=_0x124eb7[0xf][_0xc9b8('0x5')](/\n/g,'\x20-\x20');var _0x35d2b3=_0x124eb7[0x10][_0xc9b8('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x346a70)){arr[_0xc9b8('0x6')](_0x346a70);var _0x2d8f57=_0x124eb7[0x3];var _0x54df35=_0x124eb7[0x4];var _0x2bd2f9=_0x124eb7[0x1];var _0xd4d94a=_0x124eb7[0x0];var _0x2f65a4={};_0x2f65a4['urlOnAnswer']=_0x124eb7[0x8]+'?params='+_0x3a8b7e+'|'+_0x3c2399+'|'+_0x5ae694+'|'+_0x346a70+'|'+_0x25c8a7;_0x2f65a4['urlOnRing']=_0x124eb7[0x7]+'?params='+_0x3a8b7e+'|'+_0x3c2399+'|'+_0x5ae694+'|'+_0x346a70+'|'+_0x25c8a7+'|'+_0x4b2604+'|'+_0x35d2b3;_0x2f65a4[_0xc9b8('0x7')]=_0x124eb7[0x9];var _0x45be46={};_0x45be46[_0xc9b8('0x8')]=_0xc9b8('0x9');_0x45be46['method']=_0xc9b8('0xa');var _0x2f5d53=[];_0x2f5d53[_0xc9b8('0x6')](_0x124eb7[0x2]);_0x2f5d53[_0xc9b8('0x6')](_0x124eb7[0x5]);_0x2f5d53[_0xc9b8('0x6')](_0x124eb7[0x6]);_0x45be46[_0xc9b8('0xb')]=_0x2f5d53;_0x45be46['id']=0x1;var _0x16e49d=JSON[_0xc9b8('0xc')](_0x45be46);var _0x35e08a={'encoding':_0xc9b8('0xd'),'method':'POST','timeout':0x2710,'url':_0x2d8f57,'headers':{'Content-Type':_0xc9b8('0xe')},'body':_0x16e49d};return rp(_0x35e08a)['then'](function(_0x39aff9){const _0x385570=JSON[_0xc9b8('0xf')](_0x39aff9);if(!_0x385570[_0xc9b8('0x10')][_0xc9b8('0x11')]){throw new Error(_0xc9b8('0x12'));}var _0x5c82b9=_0x346a70;var _0x3de4a0=_0xc9b8('0x13')+_0x2bd2f9+_0xc9b8('0x14')+_0xd4d94a+'&sessionId='+_0x5c82b9+_0xc9b8('0x15')+JSON[_0xc9b8('0xc')](_0x2f65a4);var _0x2807c1=_0x54df35+'?'+_0x3de4a0;return rp(_0x2807c1);})[_0xc9b8('0x16')](function(_0x1bf8d4){logger[_0xc9b8('0x17')](_0xc9b8('0x18'),_0x35ff7d,_0x1bf8d4);_0x5baccc[_0xc9b8('0x19')]();})[_0xc9b8('0x1a')](function(_0x5421fb){logger[_0xc9b8('0x1b')](_0xc9b8('0x1c'),_0x35ff7d,_[_0xc9b8('0x1d')](_0x5421fb)?JSON[_0xc9b8('0xc')](_0x5421fb):_0x5421fb);_0x5baccc[_0xc9b8('0x19')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x35ff7d);_0x5baccc[_0xc9b8('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 11e2eda..7fc51ab 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x2e8f6a,_0x506688){var _0x29db49=function(_0x31b6fb){while(--_0x31b6fb){_0x2e8f6a['push'](_0x2e8f6a['shift']());}};_0x29db49(++_0x506688);}(_0xe706,0xa3));var _0x6e70=function(_0x4291dd,_0x95d82){_0x4291dd=_0x4291dd-0x0;var _0x152462=_0xe706[_0x4291dd];return _0x152462;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1e06c7,_0x216c56){var _0x2a8b1a=function(_0x21297b){while(--_0x21297b){_0x1e06c7['push'](_0x1e06c7['shift']());}};_0x2a8b1a(++_0x216c56);}(_0xe706,0xa3));var _0x6e70=function(_0x56bcff,_0x158e5f){_0x56bcff=_0x56bcff-0x0;var _0x340351=_0xe706[_0x56bcff];return _0x340351;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2ede91a..788416b 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 _0xd076=['values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','amazonlex','tag','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','rules','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','paused','waiting','mailQueues','name','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xd076,0xd4));var _0x6d07=function(_0x2f44cf,_0x25c0c1){_0x2f44cf=_0x2f44cf-0x0;var _0xc8ca1e=_0xd076[_0x2f44cf];return _0xc8ca1e;};'use strict';var _=require(_0x6d07('0x0'));var util=require(_0x6d07('0x1'));var path=require(_0x6d07('0x2'));var fs=require('fs');var jayson=require(_0x6d07('0x3'));var BPromise=require(_0x6d07('0x4'));var utils=require(_0x6d07('0x5'));var sUtils=require(_0x6d07('0x6'));var logger=require(_0x6d07('0x7'))(_0x6d07('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6d07('0x9')),'chatQueueReport':require(_0x6d07('0xa')),'smsQueueReport':require(_0x6d07('0xb')),'faxQueueReport':require(_0x6d07('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x6d07('0xd'));function getId(_0x87e9b7,_0x9a8d62,_0x50c270){return util[_0x6d07('0xe')](_0x6d07('0xf'),_0x87e9b7,_0x9a8d62||0x0,_0x50c270||0x0);}function getIntervals(_0x20a7c9,_0x5a16a6){var _0x396184=[];if(!_['isNil'](_0x5a16a6[_0x6d07('0x10')])&&!_[_0x6d07('0x11')](_0x20a7c9[_0x5a16a6[_0x6d07('0x10')]])&&!_[_0x6d07('0x11')](_0x20a7c9[_0x5a16a6[_0x6d07('0x10')]][_0x6d07('0x12')])){_0x396184=_[_0x6d07('0x13')](_0x20a7c9[_0x5a16a6[_0x6d07('0x10')]]['Intervals'],'interval');}else if(!_[_0x6d07('0x11')](_0x5a16a6[_0x6d07('0x14')])){_0x396184=[_0x5a16a6['interval']];}return _0x396184;}exports[_0x6d07('0x15')]=function(_0x323a10){_0x323a10['rules']={};return new BPromise(function(_0x177426,_0x274b7a){var _0x31e314={'Start':function(_0x409efd){var _0x28b63e=this;return new Promise(function(_0x17e9c1,_0x570fb8){if(_0x409efd){try{var _0xb35478=[];var _0x3db1ef=getId(_0x409efd[_0x6d07('0x16')],_0x409efd[_0x6d07('0x17')]?_0x409efd[_0x6d07('0x17')]['id']:0x0,_0x409efd[_0x6d07('0x18')]?_0x409efd[_0x6d07('0x18')]['id']:0x0);var _0x33b273=sUtils[_0x6d07('0x19')](_0x323a10,_0x409efd);if(!_0x33b273&&_0x409efd[_0x6d07('0x1a')]&&_['isArray'](_0x409efd[_0x6d07('0x1a')])&&_0x409efd[_0x6d07('0x1a')][_0x6d07('0x1b')]){for(var _0xeeba8f=0x0;_0xeeba8f<_0x409efd[_0x6d07('0x1a')][_0x6d07('0x1b')];_0xeeba8f+=0x1){var _0x43f37f=_0x409efd[_0x6d07('0x1a')][_0xeeba8f];if(fs[_0x6d07('0x1c')](path[_0x6d07('0x1d')](__dirname,_0x6d07('0x1a'),_0x43f37f[_0x6d07('0x1e')]+_0x6d07('0x1f')))){var _0x3119d4=[];switch(_0x43f37f['app'][_0x6d07('0x20')]()){case _0x6d07('0x21'):var _0x28a509=_0x43f37f[_0x6d07('0x22')]['split'](',');if(_0x409efd[_0x6d07('0x16')]===_0x6d07('0x23')){_0x3119d4[_0x6d07('0x24')](_0x28a509[0x0]);_0x3119d4['push'](_0x28a509[0x1]);_0x3119d4['push'](_0x28a509[_0x6d07('0x25')](0x2,_0x28a509[_0x6d07('0x1b')])[_0x6d07('0x1d')](','));}else{_0x3119d4[_0x6d07('0x24')](_0x28a509[0x0]);_0x3119d4[_0x6d07('0x24')](_0x28a509[_0x6d07('0x25')](0x1,_0x28a509['length'])[_0x6d07('0x1d')](','));}break;case _0x6d07('0x26'):var _0x4fc996=_0x43f37f['appdata']['split'](',');_0x3119d4['push'](_0x4fc996[0x0]);_0x3119d4['push'](_0x4fc996[0x1]);_0x3119d4[_0x6d07('0x24')](_0x4fc996[_0x6d07('0x25')](0x2,_0x4fc996[_0x6d07('0x1b')])['join'](','));break;case'dialogflowv2':var _0xf7c3af=_0x43f37f[_0x6d07('0x22')][_0x6d07('0x27')](',');_0x3119d4[_0x6d07('0x24')](_0xf7c3af[0x0]);_0x3119d4['push'](_0xf7c3af[0x1]);_0x3119d4['push'](_0xf7c3af[0x2]);_0x3119d4[_0x6d07('0x24')](_0xf7c3af[0x3]);_0x3119d4[_0x6d07('0x24')](_0xf7c3af[_0x6d07('0x25')](0x4,_0xf7c3af[_0x6d07('0x1b')])[_0x6d07('0x1d')](','));break;case _0x6d07('0x28'):var _0xaa44a7=_0x43f37f['appdata'][_0x6d07('0x27')](',');_0x3119d4[_0x6d07('0x24')](_0xaa44a7[0x0]);_0x3119d4[_0x6d07('0x24')](_0xaa44a7[0x1]);_0x3119d4[_0x6d07('0x24')](_0xaa44a7[0x2]);_0x3119d4[_0x6d07('0x24')](_0xaa44a7[0x3]);_0x3119d4[_0x6d07('0x24')](_0xaa44a7[_0x6d07('0x25')](0x4,_0xaa44a7[_0x6d07('0x1b')])[_0x6d07('0x1d')](','));break;case _0x6d07('0x17'):_0x3119d4[_0x6d07('0x24')](_0x43f37f[_0x6d07('0x22')]);break;case _0x6d07('0x29'):_0x3119d4[_0x6d07('0x24')](_0x43f37f[_0x6d07('0x2a')]);_0x3119d4[_0x6d07('0x24')](_0x43f37f[_0x6d07('0x22')]);break;case'tvox':var _0x16da75=utils['getMustacheRender'](_0x409efd[_0x6d07('0x2b')][_0x6d07('0x2c')],_0x409efd);var _0x304871=_0x43f37f['appdata'][_0x6d07('0x27')](',');_0x3119d4[_0x6d07('0x24')](_0x304871[0x0]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x1]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x2]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x3]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x4]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x5]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x6]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x7]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x8]);_0x3119d4[_0x6d07('0x24')](_0x304871[0x9]);_0x3119d4[_0x6d07('0x24')](_0x304871[0xa]);_0x3119d4['push'](_0x409efd[_0x6d07('0x18')]['id']);_0x3119d4[_0x6d07('0x24')](_0x409efd[_0x6d07('0x17')]['id']);_0x3119d4[_0x6d07('0x24')](_0x43f37f[_0x6d07('0x2d')]);_0x3119d4[_0x6d07('0x24')](_0x409efd[_0x6d07('0x18')][_0x6d07('0x2e')]);_0x3119d4[_0x6d07('0x24')](_0x409efd[_0x6d07('0x2f')][_0x6d07('0x2f')]);_0x3119d4[_0x6d07('0x24')](_0x16da75);break;default:_0x3119d4=_['isNil'](_0x43f37f[_0x6d07('0x22')])?[]:_0x43f37f['appdata']['split'](',');}var _0x47ccfa={'id':util[_0x6d07('0xe')](_0x6d07('0x30'),_0x3db1ef,_0x43f37f['id'],_0x43f37f['app']),'condition':require(_0x6d07('0x31'))[_0x6d07('0x32')](_0x3db1ef,getIntervals(_0x323a10[_0x6d07('0x33')],_0x43f37f),_0x323a10),'consequence':require('./applications/'+_0x43f37f['app'])[_0x6d07('0x34')](_0x3db1ef,_0x3119d4,_0x323a10,_0x409efd),'p':_0x43f37f[_0x6d07('0x35')]||0x0};logger[_0x6d07('0x36')](_0x6d07('0x37'),_0x47ccfa['id'],_0x6d07('0x38'),getIntervals(_0x323a10[_0x6d07('0x33')],_0x43f37f)[_0x6d07('0x1d')](_0x6d07('0x39')));_0xb35478[_0x6d07('0x24')](_0x47ccfa);}else{logger[_0x6d07('0x3a')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x6d07('0x1a'),_0x43f37f[_0x6d07('0x1e')]+_0x6d07('0x1f')));}}_0x323a10[_0x6d07('0x3b')][_0x3db1ef]=new RuleEngine(_0xb35478);_0x323a10['rules'][_0x3db1ef]['execute'](_0x409efd,function(_0x3db718){logger['info']('Applications\x20executed',JSON[_0x6d07('0x3c')](_0x3db718[_0x6d07('0x3d')]));if(_0x323a10[_0x6d07('0x3b')][_0x3db1ef]){_0x323a10[_0x6d07('0x3b')][_0x3db1ef][_0x6d07('0x3e')](_0x6d07('0x3f'));}});return _0x17e9c1({'code':0xc8,'message':_0x409efd});}else{if(_0x33b273){logger['info'](util['format']('Skipped\x20routing\x20for\x20%s',_0x3db1ef));}else{logger[_0x6d07('0x36')]('No\x20applications\x20to\x20execute');}return _0x17e9c1({'code':0xc8,'message':_0x409efd});}}catch(_0xfab8cd){logger['error'](_0xfab8cd[_0x6d07('0x40')]);return _0x570fb8(_0x28b63e['error'](0x1f4,_0xfab8cd));}}return _0x570fb8(_0x6d07('0x41'));});},'AcceptMessage':function(_0x4b7d89){var _0x5c8083=this;return new Promise(function(_0x1c5f7d,_0x429a49){if(_0x4b7d89[_0x6d07('0x42')]&&_0x4b7d89[_0x6d07('0x42')]['id']){if(_0x323a10[_0x6d07('0x43')][_0x4b7d89[_0x6d07('0x42')]['id']]){_0x323a10[_0x6d07('0x43')][_0x4b7d89[_0x6d07('0x42')]['id']]['busy']=![];_0x323a10[_0x6d07('0x43')][_0x4b7d89[_0x6d07('0x42')]['id']][_0x6d07('0x44')]=undefined;}}if(_0x4b7d89[_0x6d07('0x17')]&&_0x4b7d89[_0x6d07('0x17')]['id']){try{var _0x3415b3=getId(_0x4b7d89['channel'],_0x4b7d89[_0x6d07('0x17')]?_0x4b7d89['message']['id']:0x0,_0x4b7d89[_0x6d07('0x18')]?_0x4b7d89[_0x6d07('0x18')]['id']:0x0);if(_0x323a10[_0x6d07('0x3b')][_0x3415b3]){_0x323a10['rules'][_0x3415b3][_0x6d07('0x3e')](_0x6d07('0x45'));if(rpc[_0x4b7d89['channel']+_0x6d07('0x46')]){rpc[_0x4b7d89['channel']+_0x6d07('0x46')][_0x6d07('0x47')](_0x3415b3,{'UserId':_0x4b7d89[_0x6d07('0x17')][_0x6d07('0x48')]})['catch'](function(){logger['error'](_0x6d07('0x49'));});}}return _0x1c5f7d({'code':0xc8,'message':_0x4b7d89});}catch(_0x38fc32){logger[_0x6d07('0x3a')](_0x38fc32['stack']);return _0x429a49(_0x5c8083[_0x6d07('0x3a')](0x1f4,_0x38fc32));}}logger['error'](_0x6d07('0x4a'));return _0x429a49(_0x5c8083[_0x6d07('0x3a')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2e0cae){var _0x3dbeab=this;return new Promise(function(_0x4e6656,_0x1cb98f){if(_0x2e0cae[_0x6d07('0x42')]&&_0x2e0cae[_0x6d07('0x42')]['id']){try{if(_0x323a10[_0x6d07('0x43')][_0x2e0cae[_0x6d07('0x42')]['id']]){_0x323a10[_0x6d07('0x43')][_0x2e0cae[_0x6d07('0x42')]['id']][_0x6d07('0x4b')]=![];_0x323a10[_0x6d07('0x43')][_0x2e0cae[_0x6d07('0x42')]['id']][_0x6d07('0x44')]=undefined;}return _0x4e6656({'code':0xc8,'message':_0x2e0cae});}catch(_0x5e1ecb){logger[_0x6d07('0x3a')](_0x5e1ecb[_0x6d07('0x40')]);return _0x1cb98f(_0x3dbeab[_0x6d07('0x3a')](0x1f4,_0x5e1ecb));}}logger[_0x6d07('0x3a')](_0x6d07('0x4a'));return _0x1cb98f(_0x3dbeab['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2884c2){var _0x621121=this;return new Promise(function(_0x3db116,_0xff3949){if(_0x2884c2[_0x6d07('0x16')]&&_0x2884c2[_0x6d07('0x18')]&&_0x2884c2[_0x6d07('0x18')]['id']){try{var _0x272799=getId(_0x2884c2[_0x6d07('0x16')],_0x2884c2[_0x6d07('0x17')]?_0x2884c2[_0x6d07('0x17')]['id']:0x0,_0x2884c2[_0x6d07('0x18')]?_0x2884c2[_0x6d07('0x18')]['id']:0x0);if(_0x323a10[_0x6d07('0x3b')][_0x272799]){_0x323a10[_0x6d07('0x3b')][_0x272799][_0x6d07('0x3e')](_0x6d07('0x45'));}return _0x3db116({'code':0xc8,'message':_0x2884c2});}catch(_0x19096d){logger[_0x6d07('0x3a')](_0x19096d[_0x6d07('0x40')]);return _0xff3949(_0x621121['error'](0x1f4,_0x19096d));}}logger[_0x6d07('0x3a')](_0x6d07('0x4a'));return _0xff3949(_0x621121[_0x6d07('0x3a')](0x1f4,_0x6d07('0x4a')));});},'AgentCapacity':function(_0x4b1e36){var _0x1a4421=this;return new Promise(function(_0x301a0e,_0x267e9d){if(_0x323a10[_0x6d07('0x43')][_0x6d07('0x4c')](_0x4b1e36['id'])){for(var _0x44e0e4 in _0x4b1e36[_0x6d07('0x4d')]){if(_0x4b1e36[_0x6d07('0x4d')][_0x6d07('0x4c')](_0x44e0e4)){if(_0x323a10[_0x6d07('0x43')][_0x4b1e36['id']][_0x6d07('0x4c')](_0x44e0e4+_0x6d07('0x4e'))){_0x323a10[_0x6d07('0x43')][_0x4b1e36['id']][_0x44e0e4+_0x6d07('0x4e')]=parseInt(_0x4b1e36[_0x6d07('0x4d')][_0x44e0e4],0xa);}}}_0x323a10[_0x6d07('0x43')][_0x4b1e36['id']][_0x6d07('0x4f')]();return _0x301a0e({'code':0xc8,'message':_0x323a10[_0x6d07('0x43')][_0x4b1e36['id']]});}else{return _0x267e9d(_0x1a4421[_0x6d07('0x3a')](0x1f4,_0x6d07('0x50')));}});},'Agents':function(_0x347a3e){return new Promise(function(_0x5072c0){var _0x5c4282=_['values'](_0x323a10[_0x6d07('0x43')]);if(_0x347a3e&&_0x347a3e['id']){var _0x404c6e=_[_0x6d07('0x51')](_0x5c4282,function(_0x33ccb4){return _0x33ccb4['id']===_0x347a3e['id'];});_0x5072c0(_0x404c6e);}else{_0x5072c0({'count':_0x5c4282['length'],'rows':_0x5c4282});}});},'ChatQueues':function(){return new Promise(function(_0x5735a1){var _0x27264d=[];for(var _0x388dc9 in _0x323a10[_0x6d07('0x52')]){if(_0x323a10[_0x6d07('0x52')][_0x6d07('0x4c')](_0x388dc9)){var _0x14b0ae=_0x323a10[_0x6d07('0x52')][_0x388dc9];var _0x1ceb5d={'id':_0x14b0ae['id'],'available':_0x14b0ae[_0x6d07('0x53')],'loggedIn':_0x14b0ae['loggedIn'],'name':_0x14b0ae['name'],'paused':_0x14b0ae[_0x6d07('0x54')],'waiting':_0x14b0ae[_0x6d07('0x55')]};_0x27264d[_0x6d07('0x24')](_0x1ceb5d);}}_0x5735a1({'count':_0x27264d[_0x6d07('0x1b')],'rows':_0x27264d});});},'MailQueues':function(){return new Promise(function(_0x47073a){var _0x508c58=[];for(var _0x3fd3a8 in _0x323a10[_0x6d07('0x56')]){if(_0x323a10[_0x6d07('0x56')]['hasOwnProperty'](_0x3fd3a8)){var _0x1989bd=_0x323a10[_0x6d07('0x56')][_0x3fd3a8];var _0x50b679={'id':_0x1989bd['id'],'available':_0x1989bd[_0x6d07('0x53')],'loggedIn':_0x1989bd['loggedIn'],'name':_0x1989bd[_0x6d07('0x57')],'paused':_0x1989bd[_0x6d07('0x54')],'waiting':_0x1989bd[_0x6d07('0x55')]};_0x508c58['push'](_0x50b679);}}_0x47073a({'count':_0x508c58[_0x6d07('0x1b')],'rows':_0x508c58});});},'OpenchannelQueues':function(){return new Promise(function(_0x39be9c){var _0x44a3ed=[];for(var _0x363f7d in _0x323a10[_0x6d07('0x58')]){if(_0x323a10[_0x6d07('0x58')][_0x6d07('0x4c')](_0x363f7d)){var _0xaccb1=_0x323a10['openchannelQueues'][_0x363f7d];var _0x1477ae={'id':_0xaccb1['id'],'available':_0xaccb1['available'],'loggedIn':_0xaccb1[_0x6d07('0x59')],'name':_0xaccb1[_0x6d07('0x57')],'paused':_0xaccb1[_0x6d07('0x54')],'waiting':_0xaccb1[_0x6d07('0x55')]};_0x44a3ed['push'](_0x1477ae);}}_0x39be9c({'count':_0x44a3ed[_0x6d07('0x1b')],'rows':_0x44a3ed});});},'SmsQueues':function(){return new Promise(function(_0x5af627){var _0x1632f9=[];for(var _0x45b131 in _0x323a10['smsQueues']){if(_0x323a10['smsQueues'][_0x6d07('0x4c')](_0x45b131)){var _0xe2c01e=_0x323a10[_0x6d07('0x5a')][_0x45b131];var _0x196bce={'id':_0xe2c01e['id'],'available':_0xe2c01e[_0x6d07('0x53')],'loggedIn':_0xe2c01e[_0x6d07('0x59')],'name':_0xe2c01e['name'],'paused':_0xe2c01e[_0x6d07('0x54')],'waiting':_0xe2c01e['waiting']};_0x1632f9[_0x6d07('0x24')](_0x196bce);}}_0x5af627({'count':_0x1632f9[_0x6d07('0x1b')],'rows':_0x1632f9});});},'FaxQueues':function(){return new Promise(function(_0xfacc9e){var _0x1db582=[];for(var _0x5a33b5 in _0x323a10['faxQueues']){if(_0x323a10[_0x6d07('0x5b')][_0x6d07('0x4c')](_0x5a33b5)){var _0x5126fb=_0x323a10['faxQueues'][_0x5a33b5];var _0x19a1b8={'id':_0x5126fb['id'],'available':_0x5126fb[_0x6d07('0x53')],'loggedIn':_0x5126fb[_0x6d07('0x59')],'name':_0x5126fb[_0x6d07('0x57')],'paused':_0x5126fb[_0x6d07('0x54')],'waiting':_0x5126fb[_0x6d07('0x55')]};_0x1db582[_0x6d07('0x24')](_0x19a1b8);}}_0xfacc9e({'count':_0x1db582[_0x6d07('0x1b')],'rows':_0x1db582});});},'WhatsappQueues':function(){return new Promise(function(_0x1a9b9f){var _0x512be6=[];for(var _0x186a80 in _0x323a10[_0x6d07('0x5c')]){if(_0x323a10[_0x6d07('0x5c')][_0x6d07('0x4c')](_0x186a80)){var _0x5dc45e=_0x323a10['whatsappQueues'][_0x186a80];var _0x4b8afd={'id':_0x5dc45e['id'],'available':_0x5dc45e[_0x6d07('0x53')],'loggedIn':_0x5dc45e[_0x6d07('0x59')],'name':_0x5dc45e[_0x6d07('0x57')],'paused':_0x5dc45e[_0x6d07('0x54')],'waiting':_0x5dc45e[_0x6d07('0x55')]};_0x512be6[_0x6d07('0x24')](_0x4b8afd);}}_0x1a9b9f({'count':_0x512be6[_0x6d07('0x1b')],'rows':_0x512be6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xc48b1c){var _0x331251=_['values'](_0x323a10[_0x6d07('0x5d')]);_0xc48b1c({'count':_0x331251[_0x6d07('0x1b')],'rows':_0x331251});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3b5501){var _0x52f521=_[_0x6d07('0x5e')](_0x323a10['mailQueuesWaitingInteractions']);_0x3b5501({'count':_0x52f521[_0x6d07('0x1b')],'rows':_0x52f521});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xbee0e0){var _0x1e92a1=_['values'](_0x323a10[_0x6d07('0x5f')]);_0xbee0e0({'count':_0x1e92a1[_0x6d07('0x1b')],'rows':_0x1e92a1});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2381d5){var _0x4a0f1d=_['values'](_0x323a10[_0x6d07('0x60')]);_0x2381d5({'count':_0x4a0f1d[_0x6d07('0x1b')],'rows':_0x4a0f1d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5cf28c){var _0x2b26cd=_['values'](_0x323a10['faxQueuesWaitingInteractions']);_0x5cf28c({'count':_0x2b26cd[_0x6d07('0x1b')],'rows':_0x2b26cd});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2c432){var _0x1fe63d=_['values'](_0x323a10[_0x6d07('0x61')]);_0x2c432({'count':_0x1fe63d[_0x6d07('0x1b')],'rows':_0x1fe63d});});}};var _0x5dd88d=jayson[_0x6d07('0x62')](_0x31e314)['http']();_0x5dd88d['on'](_0x6d07('0x3a'),function(_0x21e1bd){logger[_0x6d07('0x3a')](JSON[_0x6d07('0x3c')](_0x21e1bd));return _0x274b7a(_0x21e1bd);});_0x5dd88d[_0x6d07('0x15')](0x232c,_0x6d07('0x63'),function(){console['log'](_0x6d07('0x64'),0x232c);return _0x177426(_0x6d07('0x65')+0x232c);});});}; \ No newline at end of file +var _0xf966=['smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','toLowerCase','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','.js','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions'];(function(_0x11259a,_0x23221e){var _0x2e9148=function(_0x554f16){while(--_0x554f16){_0x11259a['push'](_0x11259a['shift']());}};_0x2e9148(++_0x23221e);}(_0xf966,0x6c));var _0x6f96=function(_0x4ae27d,_0x4cf5ae){_0x4ae27d=_0x4ae27d-0x0;var _0x42eae7=_0xf966[_0x4ae27d];return _0x42eae7;};'use strict';var _=require(_0x6f96('0x0'));var util=require(_0x6f96('0x1'));var path=require(_0x6f96('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6f96('0x3'));var utils=require(_0x6f96('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6f96('0x5'))(_0x6f96('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6f96('0x7')),'chatQueueReport':require(_0x6f96('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x6f96('0x9')),'whatsappQueueReport':require(_0x6f96('0xa'))};var RuleEngine=require(_0x6f96('0xb'));function getId(_0x4832af,_0x2a344d,_0x247c1c){return util[_0x6f96('0xc')]('%s.%s.%s',_0x4832af,_0x2a344d||0x0,_0x247c1c||0x0);}function getIntervals(_0xd8c2b0,_0x51e137){var _0xe87a04=[];if(!_[_0x6f96('0xd')](_0x51e137[_0x6f96('0xe')])&&!_[_0x6f96('0xd')](_0xd8c2b0[_0x51e137[_0x6f96('0xe')]])&&!_[_0x6f96('0xd')](_0xd8c2b0[_0x51e137[_0x6f96('0xe')]][_0x6f96('0xf')])){_0xe87a04=_[_0x6f96('0x10')](_0xd8c2b0[_0x51e137[_0x6f96('0xe')]]['Intervals'],_0x6f96('0x11'));}else if(!_['isNil'](_0x51e137[_0x6f96('0x11')])){_0xe87a04=[_0x51e137['interval']];}return _0xe87a04;}exports[_0x6f96('0x12')]=function(_0x357e18){_0x357e18[_0x6f96('0x13')]={};return new BPromise(function(_0x42583f,_0x1bcdf1){var _0x570693={'Start':function(_0x5a02a7){var _0xb5e924=this;return new Promise(function(_0x58fe22,_0x347c80){if(_0x5a02a7){try{var _0x12bacd=[];var _0x6f4b57=getId(_0x5a02a7[_0x6f96('0x14')],_0x5a02a7[_0x6f96('0x15')]?_0x5a02a7[_0x6f96('0x15')]['id']:0x0,_0x5a02a7[_0x6f96('0x16')]?_0x5a02a7[_0x6f96('0x16')]['id']:0x0);var _0xd7076c=sUtils[_0x6f96('0x17')](_0x357e18,_0x5a02a7);if(!_0xd7076c&&_0x5a02a7[_0x6f96('0x18')]&&_[_0x6f96('0x19')](_0x5a02a7[_0x6f96('0x18')])&&_0x5a02a7[_0x6f96('0x18')][_0x6f96('0x1a')]){for(var _0x32e87a=0x0;_0x32e87a<_0x5a02a7[_0x6f96('0x18')][_0x6f96('0x1a')];_0x32e87a+=0x1){var _0x451588=_0x5a02a7[_0x6f96('0x18')][_0x32e87a];if(fs[_0x6f96('0x1b')](path[_0x6f96('0x1c')](__dirname,_0x6f96('0x18'),_0x451588[_0x6f96('0x1d')]+'.js'))){var _0x5e013a=[];switch(_0x451588[_0x6f96('0x1d')][_0x6f96('0x1e')]()){case'autoreply':var _0x4facd1=_0x451588[_0x6f96('0x1f')][_0x6f96('0x20')](',');if(_0x5a02a7[_0x6f96('0x14')]===_0x6f96('0x21')){_0x5e013a[_0x6f96('0x22')](_0x4facd1[0x0]);_0x5e013a[_0x6f96('0x22')](_0x4facd1[0x1]);_0x5e013a[_0x6f96('0x22')](_0x4facd1[_0x6f96('0x23')](0x2,_0x4facd1[_0x6f96('0x1a')])['join'](','));}else{_0x5e013a[_0x6f96('0x22')](_0x4facd1[0x0]);_0x5e013a[_0x6f96('0x22')](_0x4facd1['slice'](0x1,_0x4facd1['length'])[_0x6f96('0x1c')](','));}break;case'dialogflow':var _0x235613=_0x451588[_0x6f96('0x1f')][_0x6f96('0x20')](',');_0x5e013a[_0x6f96('0x22')](_0x235613[0x0]);_0x5e013a[_0x6f96('0x22')](_0x235613[0x1]);_0x5e013a['push'](_0x235613['slice'](0x2,_0x235613['length'])[_0x6f96('0x1c')](','));break;case _0x6f96('0x24'):var _0x3e5376=_0x451588[_0x6f96('0x1f')]['split'](',');_0x5e013a[_0x6f96('0x22')](_0x3e5376[0x0]);_0x5e013a[_0x6f96('0x22')](_0x3e5376[0x1]);_0x5e013a['push'](_0x3e5376[0x2]);_0x5e013a[_0x6f96('0x22')](_0x3e5376[0x3]);_0x5e013a['push'](_0x3e5376[_0x6f96('0x23')](0x4,_0x3e5376[_0x6f96('0x1a')])[_0x6f96('0x1c')](','));break;case _0x6f96('0x25'):var _0x29223d=_0x451588[_0x6f96('0x1f')]['split'](',');_0x5e013a['push'](_0x29223d[0x0]);_0x5e013a[_0x6f96('0x22')](_0x29223d[0x1]);_0x5e013a['push'](_0x29223d[0x2]);_0x5e013a[_0x6f96('0x22')](_0x29223d[0x3]);_0x5e013a[_0x6f96('0x22')](_0x29223d[_0x6f96('0x23')](0x4,_0x29223d[_0x6f96('0x1a')])[_0x6f96('0x1c')](','));break;case'message':_0x5e013a[_0x6f96('0x22')](_0x451588[_0x6f96('0x1f')]);break;case _0x6f96('0x26'):_0x5e013a['push'](_0x451588[_0x6f96('0x27')]);_0x5e013a[_0x6f96('0x22')](_0x451588[_0x6f96('0x1f')]);break;case _0x6f96('0x28'):var _0x20d906=utils[_0x6f96('0x29')](_0x5a02a7[_0x6f96('0x2a')][_0x6f96('0x2b')],_0x5a02a7);var _0x33108=_0x451588[_0x6f96('0x1f')][_0x6f96('0x20')](',');_0x5e013a['push'](_0x33108[0x0]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x1]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x2]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x3]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x4]);_0x5e013a['push'](_0x33108[0x5]);_0x5e013a['push'](_0x33108[0x6]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x7]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x8]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x9]);_0x5e013a[_0x6f96('0x22')](_0x33108[0xa]);_0x5e013a[_0x6f96('0x22')](_0x5a02a7[_0x6f96('0x16')]['id']);_0x5e013a[_0x6f96('0x22')](_0x5a02a7[_0x6f96('0x15')]['id']);_0x5e013a[_0x6f96('0x22')](_0x451588['ChatWebsiteId']);_0x5e013a['push'](_0x5a02a7[_0x6f96('0x16')][_0x6f96('0x2c')]);_0x5e013a['push'](_0x5a02a7['body'][_0x6f96('0x2d')]);_0x5e013a[_0x6f96('0x22')](_0x20d906);break;default:_0x5e013a=_[_0x6f96('0xd')](_0x451588[_0x6f96('0x1f')])?[]:_0x451588[_0x6f96('0x1f')][_0x6f96('0x20')](',');}var _0x3a9cdb={'id':util['format'](_0x6f96('0x2e'),_0x6f4b57,_0x451588['id'],_0x451588[_0x6f96('0x1d')]),'condition':require(_0x6f96('0x2f'))[_0x6f96('0x30')](_0x6f4b57,getIntervals(_0x357e18[_0x6f96('0x31')],_0x451588),_0x357e18),'consequence':require(_0x6f96('0x32')+_0x451588[_0x6f96('0x1d')])[_0x6f96('0x33')](_0x6f4b57,_0x5e013a,_0x357e18,_0x5a02a7),'p':_0x451588[_0x6f96('0x34')]||0x0};logger[_0x6f96('0x35')]('Push\x20new\x20rule',_0x3a9cdb['id'],_0x6f96('0x36'),getIntervals(_0x357e18[_0x6f96('0x31')],_0x451588)[_0x6f96('0x1c')](_0x6f96('0x37')));_0x12bacd['push'](_0x3a9cdb);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x6f96('0x1c')](__dirname,_0x6f96('0x18'),_0x451588['app']+_0x6f96('0x38')));}}_0x357e18['rules'][_0x6f4b57]=new RuleEngine(_0x12bacd);_0x357e18[_0x6f96('0x13')][_0x6f4b57]['execute'](_0x5a02a7,function(_0x598bc3){logger[_0x6f96('0x35')](_0x6f96('0x39'),JSON[_0x6f96('0x3a')](_0x598bc3[_0x6f96('0x3b')]));if(_0x357e18[_0x6f96('0x13')][_0x6f4b57]){_0x357e18[_0x6f96('0x13')][_0x6f4b57][_0x6f96('0x3c')](_0x6f96('0x3d'));}});return _0x58fe22({'code':0xc8,'message':_0x5a02a7});}else{if(_0xd7076c){logger['info'](util[_0x6f96('0xc')]('Skipped\x20routing\x20for\x20%s',_0x6f4b57));}else{logger[_0x6f96('0x35')](_0x6f96('0x3e'));}return _0x58fe22({'code':0xc8,'message':_0x5a02a7});}}catch(_0x81c2f4){logger[_0x6f96('0x3f')](_0x81c2f4[_0x6f96('0x40')]);return _0x347c80(_0xb5e924[_0x6f96('0x3f')](0x1f4,_0x81c2f4));}}return _0x347c80('routing\x20is\x20empty');});},'AcceptMessage':function(_0x52a645){var _0x487206=this;return new Promise(function(_0x10611e,_0x133637){if(_0x52a645[_0x6f96('0x41')]&&_0x52a645[_0x6f96('0x41')]['id']){if(_0x357e18['agents'][_0x52a645[_0x6f96('0x41')]['id']]){_0x357e18[_0x6f96('0x42')][_0x52a645[_0x6f96('0x41')]['id']][_0x6f96('0x43')]=![];_0x357e18[_0x6f96('0x42')][_0x52a645['agent']['id']][_0x6f96('0x44')]=undefined;}}if(_0x52a645[_0x6f96('0x15')]&&_0x52a645[_0x6f96('0x15')]['id']){try{var _0x374bb4=getId(_0x52a645[_0x6f96('0x14')],_0x52a645['message']?_0x52a645['message']['id']:0x0,_0x52a645['interaction']?_0x52a645['interaction']['id']:0x0);if(_0x357e18[_0x6f96('0x13')][_0x374bb4]){_0x357e18[_0x6f96('0x13')][_0x374bb4][_0x6f96('0x3c')](_0x6f96('0x45'));if(rpc[_0x52a645[_0x6f96('0x14')]+_0x6f96('0x46')]){rpc[_0x52a645[_0x6f96('0x14')]+'QueueReport'][_0x6f96('0x47')](_0x374bb4,{'UserId':_0x52a645[_0x6f96('0x15')][_0x6f96('0x48')]})['catch'](function(){logger['error'](_0x6f96('0x49'));});}}return _0x10611e({'code':0xc8,'message':_0x52a645});}catch(_0x1ae293){logger[_0x6f96('0x3f')](_0x1ae293[_0x6f96('0x40')]);return _0x133637(_0x487206[_0x6f96('0x3f')](0x1f4,_0x1ae293));}}logger['error'](_0x6f96('0x4a'));return _0x133637(_0x487206[_0x6f96('0x3f')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x878469){var _0x1a8d30=this;return new Promise(function(_0x499670,_0x8660af){if(_0x878469['agent']&&_0x878469[_0x6f96('0x41')]['id']){try{if(_0x357e18[_0x6f96('0x42')][_0x878469[_0x6f96('0x41')]['id']]){_0x357e18[_0x6f96('0x42')][_0x878469[_0x6f96('0x41')]['id']][_0x6f96('0x43')]=![];_0x357e18[_0x6f96('0x42')][_0x878469['agent']['id']][_0x6f96('0x44')]=undefined;}return _0x499670({'code':0xc8,'message':_0x878469});}catch(_0x531372){logger[_0x6f96('0x3f')](_0x531372[_0x6f96('0x40')]);return _0x8660af(_0x1a8d30['error'](0x1f4,_0x531372));}}logger[_0x6f96('0x3f')](_0x6f96('0x4a'));return _0x8660af(_0x1a8d30[_0x6f96('0x3f')](0x1f4,_0x6f96('0x4a')));});},'AbandonInteraction':function(_0x3b81be){var _0x5821d2=this;return new Promise(function(_0x3ffe4c,_0x4ca5ea){if(_0x3b81be[_0x6f96('0x14')]&&_0x3b81be[_0x6f96('0x16')]&&_0x3b81be[_0x6f96('0x16')]['id']){try{var _0x5f3a18=getId(_0x3b81be[_0x6f96('0x14')],_0x3b81be[_0x6f96('0x15')]?_0x3b81be[_0x6f96('0x15')]['id']:0x0,_0x3b81be[_0x6f96('0x16')]?_0x3b81be[_0x6f96('0x16')]['id']:0x0);if(_0x357e18[_0x6f96('0x13')][_0x5f3a18]){_0x357e18['rules'][_0x5f3a18]['emit'](_0x6f96('0x45'));}return _0x3ffe4c({'code':0xc8,'message':_0x3b81be});}catch(_0x2f226f){logger[_0x6f96('0x3f')](_0x2f226f[_0x6f96('0x40')]);return _0x4ca5ea(_0x5821d2['error'](0x1f4,_0x2f226f));}}logger[_0x6f96('0x3f')](_0x6f96('0x4a'));return _0x4ca5ea(_0x5821d2['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x16f08d){var _0x318592=this;return new Promise(function(_0x12d1f1,_0x2d78de){if(_0x357e18[_0x6f96('0x42')][_0x6f96('0x4b')](_0x16f08d['id'])){for(var _0x5c588f in _0x16f08d[_0x6f96('0x4c')]){if(_0x16f08d[_0x6f96('0x4c')]['hasOwnProperty'](_0x5c588f)){if(_0x357e18[_0x6f96('0x42')][_0x16f08d['id']][_0x6f96('0x4b')](_0x5c588f+_0x6f96('0x4d'))){_0x357e18[_0x6f96('0x42')][_0x16f08d['id']][_0x5c588f+'CurrentCapacity']=parseInt(_0x16f08d[_0x6f96('0x4c')][_0x5c588f],0xa);}}}_0x357e18[_0x6f96('0x42')][_0x16f08d['id']][_0x6f96('0x4e')]();return _0x12d1f1({'code':0xc8,'message':_0x357e18['agents'][_0x16f08d['id']]});}else{return _0x2d78de(_0x318592[_0x6f96('0x3f')](0x1f4,_0x6f96('0x4f')));}});},'Agents':function(_0x16a3f3){return new Promise(function(_0x394a85){var _0x8c5df4=_[_0x6f96('0x50')](_0x357e18[_0x6f96('0x42')]);if(_0x16a3f3&&_0x16a3f3['id']){var _0xa8353a=_['find'](_0x8c5df4,function(_0x470f04){return _0x470f04['id']===_0x16a3f3['id'];});_0x394a85(_0xa8353a);}else{_0x394a85({'count':_0x8c5df4[_0x6f96('0x1a')],'rows':_0x8c5df4});}});},'ChatQueues':function(){return new Promise(function(_0x4b0e9b){var _0x597597=[];for(var _0x2b0890 in _0x357e18[_0x6f96('0x51')]){if(_0x357e18[_0x6f96('0x51')][_0x6f96('0x4b')](_0x2b0890)){var _0x254f30=_0x357e18['chatQueues'][_0x2b0890];var _0x403335={'id':_0x254f30['id'],'available':_0x254f30[_0x6f96('0x52')],'loggedIn':_0x254f30[_0x6f96('0x53')],'name':_0x254f30[_0x6f96('0x54')],'paused':_0x254f30['paused'],'waiting':_0x254f30[_0x6f96('0x55')]};_0x597597[_0x6f96('0x22')](_0x403335);}}_0x4b0e9b({'count':_0x597597[_0x6f96('0x1a')],'rows':_0x597597});});},'MailQueues':function(){return new Promise(function(_0x3f3dff){var _0x29c57c=[];for(var _0x20a203 in _0x357e18['mailQueues']){if(_0x357e18[_0x6f96('0x56')][_0x6f96('0x4b')](_0x20a203)){var _0x5071f3=_0x357e18[_0x6f96('0x56')][_0x20a203];var _0x5178f1={'id':_0x5071f3['id'],'available':_0x5071f3[_0x6f96('0x52')],'loggedIn':_0x5071f3['loggedIn'],'name':_0x5071f3[_0x6f96('0x54')],'paused':_0x5071f3[_0x6f96('0x57')],'waiting':_0x5071f3[_0x6f96('0x55')]};_0x29c57c[_0x6f96('0x22')](_0x5178f1);}}_0x3f3dff({'count':_0x29c57c['length'],'rows':_0x29c57c});});},'OpenchannelQueues':function(){return new Promise(function(_0x1f4f9c){var _0x4719bd=[];for(var _0x1b5bb7 in _0x357e18[_0x6f96('0x58')]){if(_0x357e18[_0x6f96('0x58')][_0x6f96('0x4b')](_0x1b5bb7)){var _0x4a5c91=_0x357e18['openchannelQueues'][_0x1b5bb7];var _0x1da454={'id':_0x4a5c91['id'],'available':_0x4a5c91[_0x6f96('0x52')],'loggedIn':_0x4a5c91[_0x6f96('0x53')],'name':_0x4a5c91[_0x6f96('0x54')],'paused':_0x4a5c91['paused'],'waiting':_0x4a5c91[_0x6f96('0x55')]};_0x4719bd[_0x6f96('0x22')](_0x1da454);}}_0x1f4f9c({'count':_0x4719bd[_0x6f96('0x1a')],'rows':_0x4719bd});});},'SmsQueues':function(){return new Promise(function(_0x5dc979){var _0x33d51f=[];for(var _0x33a06f in _0x357e18['smsQueues']){if(_0x357e18[_0x6f96('0x59')]['hasOwnProperty'](_0x33a06f)){var _0xdc966=_0x357e18[_0x6f96('0x59')][_0x33a06f];var _0x567f1e={'id':_0xdc966['id'],'available':_0xdc966[_0x6f96('0x52')],'loggedIn':_0xdc966['loggedIn'],'name':_0xdc966[_0x6f96('0x54')],'paused':_0xdc966['paused'],'waiting':_0xdc966['waiting']};_0x33d51f['push'](_0x567f1e);}}_0x5dc979({'count':_0x33d51f[_0x6f96('0x1a')],'rows':_0x33d51f});});},'FaxQueues':function(){return new Promise(function(_0xdae9fd){var _0xdebc04=[];for(var _0x4ea81a in _0x357e18[_0x6f96('0x5a')]){if(_0x357e18[_0x6f96('0x5a')][_0x6f96('0x4b')](_0x4ea81a)){var _0x419c43=_0x357e18[_0x6f96('0x5a')][_0x4ea81a];var _0x32ff05={'id':_0x419c43['id'],'available':_0x419c43[_0x6f96('0x52')],'loggedIn':_0x419c43[_0x6f96('0x53')],'name':_0x419c43[_0x6f96('0x54')],'paused':_0x419c43['paused'],'waiting':_0x419c43[_0x6f96('0x55')]};_0xdebc04['push'](_0x32ff05);}}_0xdae9fd({'count':_0xdebc04['length'],'rows':_0xdebc04});});},'WhatsappQueues':function(){return new Promise(function(_0x5133ce){var _0x383f1f=[];for(var _0x51066c in _0x357e18[_0x6f96('0x5b')]){if(_0x357e18['whatsappQueues'][_0x6f96('0x4b')](_0x51066c)){var _0x4b75b1=_0x357e18['whatsappQueues'][_0x51066c];var _0x1dda41={'id':_0x4b75b1['id'],'available':_0x4b75b1['available'],'loggedIn':_0x4b75b1[_0x6f96('0x53')],'name':_0x4b75b1['name'],'paused':_0x4b75b1[_0x6f96('0x57')],'waiting':_0x4b75b1[_0x6f96('0x55')]};_0x383f1f[_0x6f96('0x22')](_0x1dda41);}}_0x5133ce({'count':_0x383f1f[_0x6f96('0x1a')],'rows':_0x383f1f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5e1deb){var _0x2cfe36=_[_0x6f96('0x50')](_0x357e18[_0x6f96('0x5c')]);_0x5e1deb({'count':_0x2cfe36[_0x6f96('0x1a')],'rows':_0x2cfe36});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x25146c){var _0x4f0023=_[_0x6f96('0x50')](_0x357e18['mailQueuesWaitingInteractions']);_0x25146c({'count':_0x4f0023['length'],'rows':_0x4f0023});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x571008){var _0x5777f4=_[_0x6f96('0x50')](_0x357e18[_0x6f96('0x5d')]);_0x571008({'count':_0x5777f4[_0x6f96('0x1a')],'rows':_0x5777f4});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x130cfc){var _0x66f441=_['values'](_0x357e18[_0x6f96('0x5e')]);_0x130cfc({'count':_0x66f441[_0x6f96('0x1a')],'rows':_0x66f441});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1c884a){var _0x5882ca=_[_0x6f96('0x50')](_0x357e18['faxQueuesWaitingInteractions']);_0x1c884a({'count':_0x5882ca[_0x6f96('0x1a')],'rows':_0x5882ca});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x19b97a){var _0x4fa3af=_[_0x6f96('0x50')](_0x357e18[_0x6f96('0x5f')]);_0x19b97a({'count':_0x4fa3af[_0x6f96('0x1a')],'rows':_0x4fa3af});});}};var _0x10200b=jayson[_0x6f96('0x60')](_0x570693)[_0x6f96('0x61')]();_0x10200b['on'](_0x6f96('0x3f'),function(_0x1a43ca){logger[_0x6f96('0x3f')](JSON[_0x6f96('0x3a')](_0x1a43ca));return _0x1bcdf1(_0x1a43ca);});_0x10200b['listen'](0x232c,_0x6f96('0x62'),function(){console['log'](_0x6f96('0x63'),0x232c);return _0x42583f(_0x6f96('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 06a7477..f04bb0b 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 _0xa1ef=['stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','../../../utils/iftime','../../../config/logger','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1ef,0x1ce));var _0xfa1e=function(_0x2dffd7,_0x50e766){_0x2dffd7=_0x2dffd7-0x0;var _0x55e83f=_0xa1ef[_0x2dffd7];return _0x55e83f;};'use strict';var _=require('lodash');var iftime=require(_0xfa1e('0x0'))['iftime'];var logger=require(_0xfa1e('0x1'))('routing');exports[_0xfa1e('0x2')]=function(_0x20c752,_0x37df27,_0x156b75){return function(_0x3c2b28){if(_0x156b75[_0xfa1e('0x3')]&&!_0x156b75[_0xfa1e('0x3')][_0x20c752]){logger[_0xfa1e('0x4')](_0xfa1e('0x5'),_0x20c752);return _0x3c2b28[_0xfa1e('0x6')]();}var _0x3af7cc=_0x37df27[_0xfa1e('0x7')](function(_0x1a8fa6){return iftime(_0x1a8fa6);});var _0x2b1aff=_[_0xfa1e('0x8')](_0x3af7cc);if(_0x2b1aff){logger['info'](_0xfa1e('0x9'),_0x20c752,_0x37df27[_0xfa1e('0xa')](_0xfa1e('0xb')),_0x2b1aff);_0x3c2b28['when'](_0x2b1aff);}else{logger[_0xfa1e('0x4')](_0xfa1e('0xc'),_0x20c752,_0x37df27[_0xfa1e('0xa')](_0xfa1e('0xb')));_0x3c2b28['stop']();}};}; \ No newline at end of file +var _0x71a9=['lodash','../../../utils/iftime','iftime','../../../config/logger','routing','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71a9,0x150));var _0x971a=function(_0x4418c7,_0x618c1a){_0x4418c7=_0x4418c7-0x0;var _0x4d8504=_0x71a9[_0x4418c7];return _0x4d8504;};'use strict';var _=require(_0x971a('0x0'));var iftime=require(_0x971a('0x1'))[_0x971a('0x2')];var logger=require(_0x971a('0x3'))(_0x971a('0x4'));exports['condition']=function(_0x57f1c7,_0x1ff0ee,_0x295b20){return function(_0x3b86a7){if(_0x295b20[_0x971a('0x5')]&&!_0x295b20['rules'][_0x57f1c7]){logger[_0x971a('0x6')](_0x971a('0x7'),_0x57f1c7);return _0x3b86a7[_0x971a('0x8')]();}var _0x21af72=_0x1ff0ee[_0x971a('0x9')](function(_0x3eb30e){return iftime(_0x3eb30e);});var _0x4b69a5=_[_0x971a('0xa')](_0x21af72);if(_0x4b69a5){logger[_0x971a('0x6')](_0x971a('0xb'),_0x57f1c7,_0x1ff0ee['join'](_0x971a('0xc')),_0x4b69a5);_0x3b86a7[_0x971a('0xd')](_0x4b69a5);}else{logger[_0x971a('0x6')](_0x971a('0xe'),_0x57f1c7,_0x1ff0ee[_0x971a('0xf')](_0x971a('0xc')));_0x3b86a7['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a9f4659..a4b0e5e 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 _0x9348=['clone','calleridname','transfer','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agentcomplete','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','uniqueid','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid'];(function(_0x370d14,_0x1e801e){var _0xe41199=function(_0x36c812){while(--_0x36c812){_0x370d14['push'](_0x370d14['shift']());}};_0xe41199(++_0x1e801e);}(_0x9348,0x10d));var _0x8934=function(_0x69d845,_0x2f77e6){_0x69d845=_0x69d845-0x0;var _0x1efb81=_0x9348[_0x69d845];return _0x1efb81;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var utils=require(_0x8934('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x135b2c,_0x46a231){utils['info'](util[_0x8934('0x3')](_0x8934('0x4'),_0x135b2c['uniqueid'],_0x135b2c[_0x8934('0x5')],_0x135b2c[_0x8934('0x6')],_0x135b2c[_0x8934('0x7')],_0x135b2c[_0x8934('0x8')],_0x135b2c[_0x8934('0x9')],_0x135b2c[_0x8934('0xa')],_0x135b2c['lastevent']));if(_0x135b2c[_0x8934('0x6')]){utils[_0x8934('0xb')](_0x135b2c[_0x8934('0x6')])['then'](function(_0x4b470d){if(_0x4b470d){_0x135b2c['type']=_0x4b470d['type'];_0x135b2c[_0x8934('0xc')]=_0x135b2c['agentcomplete']?_0x4b470d[_0x8934('0xd')]:![];_0x135b2c[_0x8934('0xe')]=_0x135b2c[_0x8934('0xc')]?_0x4b470d[_0x8934('0xf')]:0x0;}utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);});}else{utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);}if(_0x46a231){delete transfers[_0x135b2c['uniqueid']];}else{delete agents[_0x135b2c[_0x8934('0x12')]];}}exports[_0x8934('0x13')]=function(_0x46bca5){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0x46bca5);agents[_0x46bca5[_0x8934('0x12')]]=_0x46bca5;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x19');agents[_0x46bca5[_0x8934('0x12')]]['connectedlinenum']=null;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x1a')]=null;utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x46bca5['uniqueid'],agents[_0x46bca5[_0x8934('0x12')]]['membername'],_0x46bca5[_0x8934('0x12')]));}catch(_0xa9c394){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0xa9c394);}};exports[_0x8934('0x1d')]=function(_0x5ae49f){try{if(!_[_0x8934('0x1e')](agents[_0x5ae49f[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x5ae49f);utils[_0x8934('0x1b')](util['format'](_0x8934('0x21'),_0x5ae49f[_0x8934('0x20')],agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x7')],_0x5ae49f[_0x8934('0x12')]));agents[_0x5ae49f['destuniqueid']][_0x8934('0x1d')]=!![];agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x22')]=utils['now']();agents[_0x5ae49f[_0x8934('0x12')]]['lastevent']=_0x8934('0x23');agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x24')]='timeout';agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x25')]=_0x5ae49f[_0x8934('0x26')]?parseInt(_0x5ae49f[_0x8934('0x26')])/0x3e8:0x0;agents[_0x5ae49f['destuniqueid']][_0x8934('0x27')]=0x0;unanswered[_0x8934('0x28')](_0x5ae49f[_0x8934('0x12')]);}}catch(_0x3d93c7){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x3d93c7);}};exports[_0x8934('0x29')]=function(_0x18938a){try{_['forIn'](agents,function(_0x1d068c,_0x3e973e){if(_0x1d068c['uniqueid']==_0x18938a[_0x8934('0x20')]&&!_[_0x8934('0x2a')](unanswered,_0x1d068c[_0x8934('0x12')])){utils[_0x8934('0x14')](util['format'](_0x8934('0x2b'),_0x18938a[_0x8934('0x20')]),_0x18938a);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2c'),_0x18938a['uniqueid'],_0x1d068c[_0x8934('0x7')],_0x1d068c['destuniqueid']));_0x1d068c['agentringnoanswer']=!![];_0x1d068c[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x1d068c[_0x8934('0x18')]=_0x8934('0x2d');_0x1d068c['reason']=_0x8934('0x2d');_0x1d068c[_0x8934('0x25')]=_0x18938a[_0x8934('0x25')];_0x1d068c[_0x8934('0x27')]=0x0;writeDB(_0x1d068c);}});}catch(_0x7b2a1c){utils['error'](util[_0x8934('0x3')](_0x8934('0x2b'),_0x18938a['uniqueid']),_0x7b2a1c);}};exports['agentconnect']=function(_0x845028){try{if(agents[_0x845028[_0x8934('0x12')]]){utils['debug'](util['format'](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x845028);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2f'),_0x845028[_0x8934('0x20')],agents[_0x845028[_0x8934('0x12')]][_0x8934('0x7')],_0x845028[_0x8934('0x12')]));agents[_0x845028[_0x8934('0x12')]][_0x8934('0x30')]=utils['now']();agents[_0x845028[_0x8934('0x12')]][_0x8934('0xa')]=_0x845028['connectedlinenum'];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x1a')]=_0x845028[_0x8934('0x1a')];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x25')]=_0x845028['ringtime'];agents[_0x845028['destuniqueid']]['lastevent']=_0x8934('0x31');_[_0x8934('0x32')](agents,function(_0x8814f6,_0x53581b){if(_0x8814f6[_0x8934('0x12')]!=_0x845028['destuniqueid']&&_0x8814f6['uniqueid']==_0x845028[_0x8934('0x20')]){_0x8814f6[_0x8934('0x27')]=0x0;_0x8814f6['holdtime']=_0x845028['ringtime'];_0x8814f6[_0x8934('0x1d')]=!![];_0x8814f6[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x8814f6['lastevent']=_0x8934('0x33');_0x8814f6['reason']=_0x8934('0x33');_0x8814f6['answeredelsewheredestinationuniqueid']=_0x845028[_0x8934('0x12')];_0x8814f6[_0x8934('0x34')]=_0x845028[_0x8934('0x7')];writeDB(_0x8814f6);}});}}catch(_0x566d67){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x566d67);}};exports['agentcomplete']=function(_0x2182db){try{if(!_[_0x8934('0x1e')](agents[_0x2182db[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0x2182db);utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2182db['uniqueid'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x7')],_0x2182db['destuniqueid']));agents[_0x2182db[_0x8934('0x12')]]['agentcomplete']=!![];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x36')]=utils['now']();agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x2182db[_0x8934('0x12')]]['agentcompleteAt'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x30')]);agents[_0x2182db['destuniqueid']][_0x8934('0x24')]=_0x2182db[_0x8934('0x24')];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x38');writeDB(agents[_0x2182db[_0x8934('0x12')]]);}}catch(_0xa45543){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0xa45543);}};exports[_0x8934('0x39')]=function(_0x2c322d){try{if(!_[_0x8934('0x1e')](agents[_0x2c322d[_0x8934('0x3a')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x3b'),_0x2c322d['uniqueid']),_0x2c322d);utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2c322d['uniqueid'],agents[_0x2c322d['transfereruniqueid']]['membername'],agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')]));agents[_0x2c322d[_0x8934('0x3a')]]['transfer']=!![];agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3c')]='blind';agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3d')]=_0x2c322d[_0x8934('0x3e')];agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x3f')]=agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')];}}catch(_0x3902fb){utils['error'](util[_0x8934('0x3')]('[%s][agents][blindtransfer]',_0x2c322d[_0x8934('0x20')]),_0x3902fb);}};exports[_0x8934('0x40')]=function(_0x2d776a){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x41'),_0x2d776a[_0x8934('0x42')]),_0x2d776a);if(_0x2d776a[_0x8934('0x42')]==_0x2d776a['origtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x43')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a['origtransfereruniqueid'],agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x7')]));agents[_0x2d776a[_0x8934('0x43')]]['transfer']=!![];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a['secondtransfereruniqueid']]['transferexten']=_0x2d776a['origtransfererexten'];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x42')];}if(_0x2d776a['transfereeuniqueid']&&agents[_0x2d776a[_0x8934('0x46')]]){agents[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x1;transfers[_0x2d776a['transfereeuniqueid']]=_[_0x8934('0x47')](agents[_0x2d776a[_0x8934('0x46')]]);transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x9')]=agents[_0x2d776a['secondtransfereruniqueid']]['calleridnum'];transfers[_0x2d776a['transfereeuniqueid']]['calleridname']=agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['agentconnectAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x2;}}else if(_0x2d776a[_0x8934('0x43')]==_0x2d776a['secondtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x42')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a[_0x8934('0x42')],agents[_0x2d776a[_0x8934('0x42')]]['membername']));agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x49')]=!![];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3d')]=_0x2d776a[_0x8934('0x4a')];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x43')];}if(_0x2d776a[_0x8934('0x4b')]&&agents[_0x2d776a[_0x8934('0x4b')]]){agents[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x1;transfers[_0x2d776a['transfertargetuniqueid']]=_['clone'](agents[_0x2d776a[_0x8934('0x4b')]]);transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x9')]=agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x9')];transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x48')]=agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x4b')]]['agentcalledAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a['transfertargetuniqueid']][_0x8934('0x30')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x4b')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x2;}}}catch(_0x544fa7){utils[_0x8934('0x1c')](util['format'](_0x8934('0x41'),_0x2d776a['origtransfereruniqueid']),_0x544fa7);}};exports[_0x8934('0x4d')]=function(_0x6b3376){try{utils[_0x8934('0x14')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x6b3376);if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]]['reason']===_0x8934('0x23')){if(_0x6b3376['cause']==='21'){agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=_0x8934('0x4f');agents[_0x6b3376[_0x8934('0x20')]]['lastevent']=_0x8934('0x4f');}utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376['uniqueid']]['reason'],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);var _0x1efd58=unanswered[_0x8934('0x50')](_0x6b3376[_0x8934('0x20')]);if(_0x1efd58>-0x1){unanswered[_0x8934('0x51')](_0x1efd58,0x1);}}if(transfers[_0x6b3376[_0x8934('0x20')]]){transfers[_0x6b3376[_0x8934('0x20')]]['agentcomplete']=!![];transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils['diffTime'](transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')],transfers[_0x6b3376['uniqueid']][_0x8934('0x30')]);transfers[_0x6b3376['uniqueid']]['reason']='agent';transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]=_0x8934('0x38');utils['info'](util[_0x8934('0x3')](_0x8934('0x52'),_0x6b3376['uniqueid'],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(transfers[_0x6b3376[_0x8934('0x20')]],!![]);}if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]){agents[_0x6b3376['uniqueid']][_0x8934('0x53')]=!![];agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x6b3376['uniqueid']][_0x8934('0x36')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]);agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x49')]?_0x8934('0x49'):_0x8934('0x54');agents[_0x6b3376['uniqueid']]['lastevent']=_0x8934('0x38');utils[_0x8934('0x1b')](util['format'](_0x8934('0x52'),_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);}}catch(_0x2d094e){utils[_0x8934('0x1c')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x2d094e);}}; \ No newline at end of file +var _0xe706=['then','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','now','called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x251202,_0x35b6d1){var _0x53b928=function(_0x9c5dde){while(--_0x9c5dde){_0x251202['push'](_0x251202['shift']());}};_0x53b928(++_0x35b6d1);}(_0xe706,0xa3));var _0x6e70=function(_0x19bf5f,_0x1ca6b9){_0x19bf5f=_0x19bf5f-0x0;var _0x237efa=_0xe706[_0x19bf5f];return _0x237efa;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var utils=require(_0x6e70('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e8446,_0x2cae77){utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x5'),_0x5e8446[_0x6e70('0x6')],_0x5e8446[_0x6e70('0x7')],_0x5e8446[_0x6e70('0x8')],_0x5e8446[_0x6e70('0x9')],_0x5e8446[_0x6e70('0xa')],_0x5e8446[_0x6e70('0xb')],_0x5e8446[_0x6e70('0xc')],_0x5e8446[_0x6e70('0xd')]));if(_0x5e8446[_0x6e70('0x8')]){utils[_0x6e70('0xe')](_0x5e8446[_0x6e70('0x8')])[_0x6e70('0xf')](function(_0x954545){if(_0x954545){_0x5e8446[_0x6e70('0x10')]=_0x954545[_0x6e70('0x10')];_0x5e8446[_0x6e70('0x11')]=_0x5e8446[_0x6e70('0x12')]?_0x954545[_0x6e70('0x13')]:![];_0x5e8446[_0x6e70('0x14')]=_0x5e8446[_0x6e70('0x11')]?_0x954545['acwTimeout']:0x0;}utils['request'](_0x6e70('0x15'),_0x5e8446);});}else{utils[_0x6e70('0x16')](_0x6e70('0x15'),_0x5e8446);}if(_0x2cae77){delete transfers[_0x5e8446[_0x6e70('0x6')]];}else{delete agents[_0x5e8446[_0x6e70('0x17')]];}}exports[_0x6e70('0x18')]=function(_0xa1eb74){try{utils[_0x6e70('0x19')](util['format']('[%s][agents][agentcalled]',_0xa1eb74['uniqueid']),_0xa1eb74);agents[_0xa1eb74[_0x6e70('0x17')]]=_0xa1eb74;agents[_0xa1eb74['destuniqueid']]['agentcalledAt']=utils[_0x6e70('0x1a')]();agents[_0xa1eb74[_0x6e70('0x17')]]['lastevent']=_0x6e70('0x1b');agents[_0xa1eb74['destuniqueid']][_0x6e70('0xc')]=null;agents[_0xa1eb74[_0x6e70('0x17')]]['connectedlinename']=null;utils['info'](util[_0x6e70('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa1eb74[_0x6e70('0x6')],agents[_0xa1eb74[_0x6e70('0x17')]]['membername'],_0xa1eb74['destuniqueid']));}catch(_0xc238ba){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x1d'),_0xa1eb74[_0x6e70('0x6')]),_0xc238ba);}};exports[_0x6e70('0x1e')]=function(_0x1b2453){try{if(!_[_0x6e70('0x1f')](agents[_0x1b2453[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x1b2453);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x21'),_0x1b2453[_0x6e70('0x6')],agents[_0x1b2453[_0x6e70('0x17')]]['membername'],_0x1b2453[_0x6e70('0x17')]));agents[_0x1b2453['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1b2453['destuniqueid']][_0x6e70('0x22')]=utils[_0x6e70('0x1a')]();agents[_0x1b2453['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x23');agents[_0x1b2453['destuniqueid']][_0x6e70('0x24')]=_0x6e70('0x23');agents[_0x1b2453[_0x6e70('0x17')]]['holdtime']=_0x1b2453['ringtime']?parseInt(_0x1b2453[_0x6e70('0x25')])/0x3e8:0x0;agents[_0x1b2453[_0x6e70('0x17')]][_0x6e70('0x26')]=0x0;unanswered[_0x6e70('0x27')](_0x1b2453[_0x6e70('0x17')]);}}catch(_0x5d772a){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x5d772a);}};exports[_0x6e70('0x28')]=function(_0x20a225){try{_[_0x6e70('0x29')](agents,function(_0x24114a,_0x3a0821){if(_0x24114a[_0x6e70('0x6')]==_0x20a225['uniqueid']&&!_[_0x6e70('0x2a')](unanswered,_0x24114a['destuniqueid'])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x2b'),_0x20a225[_0x6e70('0x6')]),_0x20a225);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x2c'),_0x20a225[_0x6e70('0x6')],_0x24114a['membername'],_0x24114a[_0x6e70('0x17')]));_0x24114a[_0x6e70('0x1e')]=!![];_0x24114a['agentringnoanswerAt']=utils[_0x6e70('0x1a')]();_0x24114a[_0x6e70('0xd')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x24')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x2e')]=_0x20a225[_0x6e70('0x2e')];_0x24114a[_0x6e70('0x26')]=0x0;writeDB(_0x24114a);}});}catch(_0xf146fd){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x2b'),_0x20a225['uniqueid']),_0xf146fd);}};exports[_0x6e70('0x2f')]=function(_0x3222a2){try{if(agents[_0x3222a2[_0x6e70('0x17')]]){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x30'),_0x3222a2[_0x6e70('0x6')]),_0x3222a2);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x6')],agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x9')],_0x3222a2['destuniqueid']));agents[_0x3222a2['destuniqueid']]['agentconnectAt']=utils[_0x6e70('0x1a')]();agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xc')]=_0x3222a2[_0x6e70('0xc')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x32')]=_0x3222a2['connectedlinename'];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xd')]=_0x6e70('0x33');_[_0x6e70('0x29')](agents,function(_0x16fc7d,_0x5be100){if(_0x16fc7d[_0x6e70('0x17')]!=_0x3222a2[_0x6e70('0x17')]&&_0x16fc7d[_0x6e70('0x6')]==_0x3222a2[_0x6e70('0x6')]){_0x16fc7d[_0x6e70('0x26')]=0x0;_0x16fc7d[_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];_0x16fc7d['agentringnoanswer']=!![];_0x16fc7d['agentringnoanswerAt']=utils['now']();_0x16fc7d[_0x6e70('0xd')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x24')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x35')]=_0x3222a2['destuniqueid'];_0x16fc7d[_0x6e70('0x36')]=_0x3222a2[_0x6e70('0x9')];writeDB(_0x16fc7d);}});}}catch(_0x2a2aca){utils['error'](util['format']('[%s][agents][agentconnect]',_0x3222a2[_0x6e70('0x6')]),_0x2a2aca);}};exports['agentcomplete']=function(_0x42f49a){try{if(!_[_0x6e70('0x1f')](agents[_0x42f49a[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x42f49a);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x38'),_0x42f49a[_0x6e70('0x6')],agents[_0x42f49a['destuniqueid']][_0x6e70('0x9')],_0x42f49a[_0x6e70('0x17')]));agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x12')]=!![];agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')]=utils[_0x6e70('0x1a')]();agents[_0x42f49a['destuniqueid']][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')],agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x3b')]);agents[_0x42f49a[_0x6e70('0x17')]]['reason']=_0x42f49a[_0x6e70('0x24')];agents[_0x42f49a['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x3c');writeDB(agents[_0x42f49a['destuniqueid']]);}}catch(_0x53efc3){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x53efc3);}};exports['blindtransfer']=function(_0x238ebb){try{if(!_[_0x6e70('0x1f')](agents[_0x238ebb[_0x6e70('0x3d')]])){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb['uniqueid']),_0x238ebb);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x3f'),_0x238ebb[_0x6e70('0x6')],agents[_0x238ebb[_0x6e70('0x3d')]]['membername'],agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')]));agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x40')]=!![];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x41')]='blind';agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x42')]=_0x238ebb[_0x6e70('0x43')];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x44')]=agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')];}}catch(_0x1dd242){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb[_0x6e70('0x6')]),_0x1dd242);}};exports['attendedtransfer']=function(_0x40e7c6){try{utils[_0x6e70('0x19')](util['format'](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x40e7c6);if(_0x40e7c6['origtransfereruniqueid']==_0x40e7c6[_0x6e70('0x47')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x48')]])){utils[_0x6e70('0x3')](util[_0x6e70('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x9')]));agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x40')]=!![];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x41')]=_0x6e70('0x49');agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x42')]=_0x40e7c6[_0x6e70('0x4a')];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x46')];}if(_0x40e7c6[_0x6e70('0x4b')]&&agents[_0x40e7c6[_0x6e70('0x4b')]]){agents[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x4b')]]=_[_0x6e70('0x4d')](agents[_0x40e7c6['transfereeuniqueid']]);transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0xb')];transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4e')]=agents[_0x40e7c6['secondtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x4b')]]['agentcalledAt']=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x3b')]=utils['now']();transfers[_0x40e7c6['transfereeuniqueid']][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x2;}}else if(_0x40e7c6[_0x6e70('0x48')]==_0x40e7c6[_0x6e70('0x4f')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x46')]])){utils['info'](util['format'](_0x6e70('0x50'),_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x9')]));agents[_0x40e7c6['origtransfereruniqueid']]['transfer']=!![];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x41')]='ATTENDED';agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x42')]=_0x40e7c6['secondtransfererexten'];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x48')];}if(_0x40e7c6[_0x6e70('0x51')]&&agents[_0x40e7c6[_0x6e70('0x51')]]){agents[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x51')]]=_['clone'](agents[_0x40e7c6[_0x6e70('0x51')]]);transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0xb')];transfers[_0x40e7c6['transfertargetuniqueid']]['calleridname']=agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x52')]=utils['now']();transfers[_0x40e7c6['transfertargetuniqueid']][_0x6e70('0x3b')]=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x2;}}}catch(_0x5eb6f0){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x5eb6f0);}};exports['hangup']=function(_0xce964b){try{utils['debug'](util['format'](_0x6e70('0x53'),_0xce964b[_0x6e70('0x6')]),_0xce964b);if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]===_0x6e70('0x23')){if(_0xce964b['cause']==='21'){agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x54');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x54');}utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')],agents[_0xce964b['uniqueid']]['lastevent']));writeDB(agents[_0xce964b[_0x6e70('0x6')]]);var _0x18ecf0=unanswered[_0x6e70('0x56')](_0xce964b[_0x6e70('0x6')]);if(_0x18ecf0>-0x1){unanswered[_0x6e70('0x57')](_0x18ecf0,0x1);}}if(transfers[_0xce964b['uniqueid']]){transfers[_0xce964b['uniqueid']][_0x6e70('0x12')]=!![];transfers[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x3b')]);transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x58');transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils['info'](util['format'](_0x6e70('0x55'),_0xce964b['uniqueid'],transfers[_0xce964b[_0x6e70('0x6')]]['membername'],transfers[_0xce964b['uniqueid']][_0x6e70('0x24')],transfers[_0xce964b['uniqueid']]['lastevent']));writeDB(transfers[_0xce964b[_0x6e70('0x6')]],!![]);}if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']){agents[_0xce964b['uniqueid']]['agentcomplete']=!![];agents[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']);agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=agents[_0xce964b[_0x6e70('0x6')]]['transfer']?_0x6e70('0x40'):_0x6e70('0x58');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]]['reason'],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]));writeDB(agents[_0xce964b['uniqueid']]);}}catch(_0x596d71){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x53'),_0xce964b['uniqueid']),_0x596d71);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index fbca5a7..19ac7f3 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 _0x5912=['transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstop]','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr','split','substring','includes','execif','gotoif','lastapplication','lodash','./utils','NO\x20ANSWER','ANSWERED','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','context','exten','calleridnum','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield'];(function(_0x49f65c,_0x15595d){var _0x57d131=function(_0x1a3666){while(--_0x1a3666){_0x49f65c['push'](_0x49f65c['shift']());}};_0x57d131(++_0x15595d);}(_0x5912,0xfd));var _0x2591=function(_0x572a4d,_0x62d3a9){_0x572a4d=_0x572a4d-0x0;var _0x2575ea=_0x5912[_0x572a4d];return _0x2575ea;};'use strict';var _=require(_0x2591('0x0'));var util=require('util');var utils=require(_0x2591('0x1'));var dispositions=[_0x2591('0x2'),'FAILED','FAILED',_0x2591('0x2'),_0x2591('0x2'),_0x2591('0x2'),_0x2591('0x3'),'BUSY','FAILED',_0x2591('0x4'),'FAILED'];var channels={};function writeDB(_0x12e02f){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x7'),_0x12e02f[_0x2591('0x8')],_0x12e02f['channel'],_0x12e02f[_0x2591('0x9')],_0x12e02f[_0x2591('0xa')],_0x12e02f['interface'],_0x12e02f['calleridnum'],_0x12e02f[_0x2591('0xb')],_0x12e02f[_0x2591('0xc')]));if(_0x12e02f[_0x2591('0xd')]){utils[_0x2591('0xe')](_0x12e02f['accountcode'])[_0x2591('0xf')](function(_0x3ac5e8){if(_0x3ac5e8){_0x12e02f['UserId']=_0x3ac5e8['id'];}utils[_0x2591('0x10')](_0x2591('0x11'),_0x12e02f);});}else{utils[_0x2591('0x10')](_0x2591('0x11'),_0x12e02f);}if(channels[_0x12e02f['uniqueid']]){delete channels[_0x12e02f[_0x2591('0x8')]];}}exports['newchannel']=function(_0x51dec7){try{utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x13'),_0x51dec7[_0x2591('0x8')]),_0x51dec7);if(_0x51dec7[_0x2591('0x8')]==_0x51dec7[_0x2591('0x14')]&&_0x51dec7[_0x2591('0x15')]!=_0x2591('0x16')){utils[_0x2591('0x5')](util[_0x2591('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x51dec7[_0x2591('0x8')],_0x51dec7[_0x2591('0x17')],_0x51dec7[_0x2591('0x18')]));channels[_0x51dec7[_0x2591('0x8')]]={'uniqueid':_0x51dec7['uniqueid'],'accountcode':_0x51dec7['accountcode'],'source':_0x51dec7[_0x2591('0x19')],'destination':_0x51dec7[_0x2591('0x18')],'destinationcontext':_0x51dec7[_0x2591('0x17')],'channel':_0x51dec7[_0x2591('0x15')],'starttime':utils[_0x2591('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x2591('0x1b')};}}catch(_0x40f562){utils[_0x2591('0x1c')](util[_0x2591('0x6')](_0x2591('0x13'),_0x51dec7[_0x2591('0x8')]),_0x40f562);}};exports['newstate']=function(_0x3954f0){try{utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x1d'),_0x3954f0[_0x2591('0x8')]),_0x3954f0);if(!_[_0x2591('0x1e')](channels[_0x3954f0[_0x2591('0x8')]])&&_0x3954f0['channelstate']==0x6){utils['info'](util['format'](_0x2591('0x1f'),_0x3954f0['uniqueid'],_0x3954f0[_0x2591('0x17')],_0x3954f0[_0x2591('0x15')]));if(_['isNil'](channels[_0x3954f0[_0x2591('0x8')]]['systemanswertime'])){channels[_0x3954f0[_0x2591('0x8')]][_0x2591('0x20')]=utils[_0x2591('0x1a')]();}}else if(!_[_0x2591('0x1e')](channels[_0x3954f0[_0x2591('0x14')]])&&_0x3954f0[_0x2591('0x21')]==0x6&&_0x3954f0[_0x2591('0x17')]!=_0x2591('0x22')){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x23'),_0x3954f0[_0x2591('0x8')],_0x3954f0[_0x2591('0x14')],_0x3954f0[_0x2591('0x17')],_0x3954f0['channel']));channels[_0x3954f0['linkedid']][_0x2591('0xd')]=_0x3954f0[_0x2591('0xd')];channels[_0x3954f0[_0x2591('0x14')]]['destinationchannel']=_0x3954f0[_0x2591('0x15')];if(_[_0x2591('0x1e')](channels[_0x3954f0[_0x2591('0x14')]][_0x2591('0x24')])){channels[_0x3954f0['linkedid']][_0x2591('0x24')]=utils['now']();}channels[_0x3954f0['linkedid']][_0x2591('0x25')]=dispositions[_[_0x2591('0x26')](_0x3954f0[_0x2591('0x21')])]||_0x2591('0x3');}}catch(_0x50a650){utils[_0x2591('0x1c')](util[_0x2591('0x6')](_0x2591('0x1d'),_0x3954f0[_0x2591('0x8')]),_0x50a650);}};exports[_0x2591('0x27')]=function(_0x37f3f6){try{if(!_[_0x2591('0x1e')](channels[_0x37f3f6[_0x2591('0x8')]])){utils['debug'](util[_0x2591('0x6')]('[%s][calls][hangup]',_0x37f3f6[_0x2591('0x8')]),_0x37f3f6);if(_[_0x2591('0x1e')](channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x28')])){channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x28')]=_0x37f3f6[_0x2591('0x29')]+'\x20<'+_0x37f3f6[_0x2591('0x19')]+'>';}utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x2a'),_0x37f3f6[_0x2591('0x8')],channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x28')],_0x37f3f6[_0x2591('0x2b')]));channels[_0x37f3f6['uniqueid']][_0x2591('0x2c')]=utils[_0x2591('0x1a')]();channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x2d')]=utils[_0x2591('0x2e')](channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x2c')],channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x2f')]);channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x30')]=channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x24')]?utils[_0x2591('0x2e')](channels[_0x37f3f6[_0x2591('0x8')]][_0x2591('0x2c')],channels[_0x37f3f6[_0x2591('0x8')]]['answertime']):0x0;writeDB(channels[_0x37f3f6[_0x2591('0x8')]]);}}catch(_0x163216){utils[_0x2591('0x1c')](util['format']('[%s][calls][hangup]',_0x37f3f6[_0x2591('0x8')]),_0x163216);}};exports['attendedtransfer']=function(_0x1cf979){try{if(!_[_0x2591('0x1e')](channels[_0x1cf979['localtwolinkedid']])){utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x31'),_0x1cf979[_0x2591('0x32')]),_0x1cf979);if(channels[_0x1cf979[_0x2591('0x33')]][_0x2591('0x15')]==_0x1cf979[_0x2591('0x34')]){utils[_0x2591('0x5')](util[_0x2591('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1cf979[_0x2591('0x32')],_0x1cf979['localtwolinkedid'],_0x1cf979['secondtransfererchannel']));channels[_0x1cf979['localtwolinkedid']][_0x2591('0x35')]=_0x1cf979[_0x2591('0x36')];channels[_0x1cf979[_0x2591('0x33')]][_0x2591('0x37')]='_attended';}else if(channels[_0x1cf979[_0x2591('0x33')]][_0x2591('0x15')]=_0x1cf979[_0x2591('0x38')]){utils[_0x2591('0x5')](util['format'](_0x2591('0x39'),_0x1cf979['origtransfereruniqueid'],_0x1cf979[_0x2591('0x33')],_0x1cf979[_0x2591('0x3a')]));channels[_0x1cf979[_0x2591('0x33')]][_0x2591('0x35')]=_0x1cf979['origtransfererchannel'];channels[_0x1cf979[_0x2591('0x33')]]['userfield']=_0x2591('0x3b');}}}catch(_0x31f103){utils['error'](util[_0x2591('0x6')](_0x2591('0x31'),_0x1cf979[_0x2591('0x32')]),_0x31f103);}};exports[_0x2591('0x3c')]=function(_0x498a86){try{if(!_[_0x2591('0x1e')](channels[_0x498a86[_0x2591('0x8')]])){utils[_0x2591('0x12')](util[_0x2591('0x6')]('[%s][calls][musiconholdstart]',_0x498a86[_0x2591('0x8')]),_0x498a86);channels[_0x498a86[_0x2591('0x8')]]['musiconholdstartAt']=utils[_0x2591('0x1a')]();utils[_0x2591('0x5')](util[_0x2591('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x498a86[_0x2591('0x8')],channels[_0x498a86[_0x2591('0x8')]]['musiconholdstartAt']));}}catch(_0x4572f2){utils[_0x2591('0x1c')](util[_0x2591('0x6')]('[%s][calls][musiconholdstart]',_0x498a86[_0x2591('0x8')]),_0x4572f2);}};exports['musiconholdstop']=function(_0x4ee176){try{if(!_[_0x2591('0x1e')](channels[_0x4ee176['uniqueid']])){utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x3d'),_0x4ee176['uniqueid']),_0x4ee176);if(!_[_0x2591('0x1e')](channels[_0x4ee176['uniqueid']][_0x2591('0x3e')])){channels[_0x4ee176[_0x2591('0x8')]]['mohtime']+=utils[_0x2591('0x2e')](utils['now'](),channels[_0x4ee176[_0x2591('0x8')]]['musiconholdstartAt']);utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x3f'),_0x4ee176['uniqueid'],channels[_0x4ee176[_0x2591('0x8')]][_0x2591('0x40')]));delete channels[_0x4ee176['uniqueid']][_0x2591('0x3e')];}}}catch(_0x2167d0){utils['error'](util[_0x2591('0x6')](_0x2591('0x3d'),_0x4ee176[_0x2591('0x8')]),_0x2167d0);}};exports[_0x2591('0x41')]=function(_0x2d98b0){try{if(!_[_0x2591('0x1e')](channels[_0x2d98b0[_0x2591('0x8')]])){utils[_0x2591('0x12')](util['format']('[%s][calls][varset]',_0x2d98b0[_0x2591('0x8')]),_0x2d98b0);if(!_['isNil'](_0x2d98b0[_0x2591('0x42')][_0x2591('0x43')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x44'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x46')]=_0x2d98b0['value'];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x47')])){utils[_0x2591('0x5')](util[_0x2591('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0['uniqueid']]['destination']=_0x2d98b0[_0x2591('0x45')];channels[_0x2d98b0['uniqueid']][_0x2591('0x28')]='\x22'+_0x2d98b0[_0x2591('0x45')]+'\x22\x20<'+_0x2d98b0['value']+'>';}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')]['xmd-callerid-preview'])||!_['isNil'](_0x2d98b0['variable'][_0x2591('0x48')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x49'),_0x2d98b0[_0x2591('0x8')],!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')]['xmd-callerid-preview'])?_0x2591('0x4a'):'xmd-callerid',_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x28')]=_0x2d98b0[_0x2591('0x45')];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x4b')])||!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x4c')])){utils[_0x2591('0x5')](util['format'](_0x2591('0x49'),_0x2d98b0[_0x2591('0x8')],!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x4b')])?'xmd-queue':'xmcs-queue',_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]]['lastapplication']=_0x2591('0x4d');channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x4e')]=_0x2d98b0[_0x2591('0x45')];channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x9')]=!![];}if(!_[_0x2591('0x1e')](_0x2d98b0['variable'][_0x2591('0x4f')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x50'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0['uniqueid']][_0x2591('0x51')]=_0x2d98b0[_0x2591('0x45')];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x52')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x53'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x54')]=_0x2d98b0['value'];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x55')])){utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x56'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0[_0x2591('0x8')]][_0x2591('0x57')]=_0x2d98b0['value'];}if(!_[_0x2591('0x1e')](_0x2d98b0[_0x2591('0x42')][_0x2591('0x58')])){utils[_0x2591('0x5')](util['format'](_0x2591('0x59'),_0x2d98b0[_0x2591('0x8')],_0x2d98b0[_0x2591('0x45')]));channels[_0x2d98b0['uniqueid']][_0x2591('0x58')]=_0x2d98b0[_0x2591('0x45')];}}}catch(_0x37a6f2){utils[_0x2591('0x1c')](util['format']('[%s][calls][varset]',_0x2d98b0['uniqueid']),_0x37a6f2);}};exports['newexten']=function(_0x1dff1d){try{if(!_[_0x2591('0x1e')](channels[_0x1dff1d[_0x2591('0x8')]])){utils[_0x2591('0x12')](util[_0x2591('0x6')](_0x2591('0x5a'),_0x1dff1d[_0x2591('0x8')]),_0x1dff1d);utils[_0x2591('0x5')](util[_0x2591('0x6')](_0x2591('0x5b'),_0x1dff1d[_0x2591('0x8')],_0x1dff1d['application'],_0x1dff1d['appdata']));if(_0x1dff1d[_0x2591('0x5c')][_0x2591('0x5d')]()==_0x2591('0x5e')&&_['startsWith'](_0x1dff1d[_0x2591('0x5f')]['toLowerCase'](),_0x2591('0x60'))){var _0x56245a=_0x1dff1d[_0x2591('0x5f')][_0x2591('0x61')]('=');var _0x269cf0=_0x56245a[0x0][_0x2591('0x62')](_0x56245a[0x0]['lastIndexOf']('(')+0x1,_0x56245a[0x0]['lastIndexOf'](')'));var _0x384382=_0x56245a[0x1];channels[_0x1dff1d[_0x2591('0x8')]][_0x269cf0]=_0x384382;}if(!_[_0x2591('0x63')]([_0x2591('0x27'),'noop',_0x2591('0x64'),'set',_0x2591('0x65')],_0x1dff1d[_0x2591('0x5c')][_0x2591('0x5d')]())){channels[_0x1dff1d[_0x2591('0x8')]][_0x2591('0x66')]=_0x1dff1d[_0x2591('0x5c')];channels[_0x1dff1d[_0x2591('0x8')]][_0x2591('0x4e')]=_0x1dff1d['appdata'];}}}catch(_0x46971f){utils[_0x2591('0x1c')](util[_0x2591('0x6')]('[%s][calls][newexten]',_0x1dff1d[_0x2591('0x8')]),_0x46971f);}}; \ No newline at end of file +var _0x9eb9=['attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','substring','lastIndexOf','noop','execif','set','gotoif','toLowerCase','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','membername','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','channelstate','transfer','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime'];(function(_0x33881e,_0x37ef12){var _0x2fc09f=function(_0x1522ab){while(--_0x1522ab){_0x33881e['push'](_0x33881e['shift']());}};_0x2fc09f(++_0x37ef12);}(_0x9eb9,0x1d3));var _0x99eb=function(_0x1b99dc,_0x2e894e){_0x1b99dc=_0x1b99dc-0x0;var _0x5a72e1=_0x9eb9[_0x1b99dc];return _0x5a72e1;};'use strict';var _=require(_0x99eb('0x0'));var util=require(_0x99eb('0x1'));var utils=require('./utils');var dispositions=[_0x99eb('0x2'),'FAILED',_0x99eb('0x3'),_0x99eb('0x2'),_0x99eb('0x2'),'NO\x20ANSWER','ANSWERED',_0x99eb('0x4'),_0x99eb('0x3'),_0x99eb('0x3'),_0x99eb('0x3')];var channels={};function writeDB(_0x348ffb){utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x348ffb[_0x99eb('0x7')],_0x348ffb['channel'],_0x348ffb['queue'],_0x348ffb[_0x99eb('0x8')],_0x348ffb[_0x99eb('0x9')],_0x348ffb[_0x99eb('0xa')],_0x348ffb[_0x99eb('0xb')],_0x348ffb['lastevent']));if(_0x348ffb[_0x99eb('0xc')]){utils['getUserByInternal'](_0x348ffb['accountcode'])[_0x99eb('0xd')](function(_0x360dfc){if(_0x360dfc){_0x348ffb[_0x99eb('0xe')]=_0x360dfc['id'];}utils[_0x99eb('0xf')](_0x99eb('0x10'),_0x348ffb);});}else{utils[_0x99eb('0xf')](_0x99eb('0x10'),_0x348ffb);}if(channels[_0x348ffb['uniqueid']]){delete channels[_0x348ffb[_0x99eb('0x7')]];}}exports[_0x99eb('0x11')]=function(_0x29f48e){try{utils[_0x99eb('0x12')](util[_0x99eb('0x6')]('[%s][calls][newchannel]',_0x29f48e[_0x99eb('0x7')]),_0x29f48e);if(_0x29f48e[_0x99eb('0x7')]==_0x29f48e[_0x99eb('0x13')]&&_0x29f48e[_0x99eb('0x14')]!=_0x99eb('0x15')){utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x29f48e[_0x99eb('0x7')],_0x29f48e[_0x99eb('0x16')],_0x29f48e[_0x99eb('0x17')]));channels[_0x29f48e[_0x99eb('0x7')]]={'uniqueid':_0x29f48e[_0x99eb('0x7')],'accountcode':_0x29f48e[_0x99eb('0xc')],'source':_0x29f48e[_0x99eb('0xa')],'destination':_0x29f48e[_0x99eb('0x17')],'destinationcontext':_0x29f48e['context'],'channel':_0x29f48e[_0x99eb('0x14')],'starttime':utils[_0x99eb('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x99eb('0x2'),'amaflags':_0x99eb('0x19')};}}catch(_0x5f6d0a){utils[_0x99eb('0x1a')](util[_0x99eb('0x6')]('[%s][calls][newchannel]',_0x29f48e[_0x99eb('0x7')]),_0x5f6d0a);}};exports[_0x99eb('0x1b')]=function(_0x100c4a){try{utils[_0x99eb('0x12')](util[_0x99eb('0x6')](_0x99eb('0x1c'),_0x100c4a['uniqueid']),_0x100c4a);if(!_['isNil'](channels[_0x100c4a[_0x99eb('0x7')]])&&_0x100c4a['channelstate']==0x6){utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x1d'),_0x100c4a[_0x99eb('0x7')],_0x100c4a['context'],_0x100c4a[_0x99eb('0x14')]));if(_[_0x99eb('0x1e')](channels[_0x100c4a[_0x99eb('0x7')]][_0x99eb('0x1f')])){channels[_0x100c4a['uniqueid']][_0x99eb('0x1f')]=utils[_0x99eb('0x18')]();}}else if(!_[_0x99eb('0x1e')](channels[_0x100c4a['linkedid']])&&_0x100c4a[_0x99eb('0x20')]==0x6&&_0x100c4a[_0x99eb('0x16')]!=_0x99eb('0x21')){utils[_0x99eb('0x5')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x100c4a[_0x99eb('0x7')],_0x100c4a['linkedid'],_0x100c4a[_0x99eb('0x16')],_0x100c4a['channel']));channels[_0x100c4a[_0x99eb('0x13')]]['accountcode']=_0x100c4a['accountcode'];channels[_0x100c4a[_0x99eb('0x13')]][_0x99eb('0x22')]=_0x100c4a[_0x99eb('0x14')];if(_[_0x99eb('0x1e')](channels[_0x100c4a[_0x99eb('0x13')]][_0x99eb('0x23')])){channels[_0x100c4a[_0x99eb('0x13')]][_0x99eb('0x23')]=utils[_0x99eb('0x18')]();}channels[_0x100c4a['linkedid']][_0x99eb('0x24')]=dispositions[_[_0x99eb('0x25')](_0x100c4a[_0x99eb('0x20')])]||_0x99eb('0x26');}}catch(_0x2c65d9){utils[_0x99eb('0x1a')](util[_0x99eb('0x6')](_0x99eb('0x1c'),_0x100c4a[_0x99eb('0x7')]),_0x2c65d9);}};exports[_0x99eb('0x27')]=function(_0x1f948e){try{if(!_[_0x99eb('0x1e')](channels[_0x1f948e[_0x99eb('0x7')]])){utils[_0x99eb('0x12')](util[_0x99eb('0x6')](_0x99eb('0x28'),_0x1f948e['uniqueid']),_0x1f948e);if(_['isNil'](channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x29')])){channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x29')]=_0x1f948e[_0x99eb('0x2a')]+'\x20<'+_0x1f948e[_0x99eb('0xa')]+'>';}utils[_0x99eb('0x5')](util['format'](_0x99eb('0x2b'),_0x1f948e['uniqueid'],channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x29')],_0x1f948e[_0x99eb('0x2c')]));channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x2d')]=utils[_0x99eb('0x18')]();channels[_0x1f948e[_0x99eb('0x7')]]['duration']=utils[_0x99eb('0x2e')](channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x2d')],channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x2f')]);channels[_0x1f948e[_0x99eb('0x7')]]['billableseconds']=channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x23')]?utils[_0x99eb('0x2e')](channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x2d')],channels[_0x1f948e[_0x99eb('0x7')]]['answertime']):0x0;writeDB(channels[_0x1f948e[_0x99eb('0x7')]]);}}catch(_0x474548){utils['error'](util[_0x99eb('0x6')]('[%s][calls][hangup]',_0x1f948e['uniqueid']),_0x474548);}};exports[_0x99eb('0x30')]=function(_0x26dd49){try{if(!_[_0x99eb('0x1e')](channels[_0x26dd49[_0x99eb('0x31')]])){utils[_0x99eb('0x12')](util['format'](_0x99eb('0x32'),_0x26dd49[_0x99eb('0x33')]),_0x26dd49);if(channels[_0x26dd49[_0x99eb('0x31')]]['channel']==_0x26dd49[_0x99eb('0x34')]){utils[_0x99eb('0x5')](util['format'](_0x99eb('0x35'),_0x26dd49[_0x99eb('0x33')],_0x26dd49[_0x99eb('0x31')],_0x26dd49[_0x99eb('0x36')]));channels[_0x26dd49[_0x99eb('0x31')]][_0x99eb('0x22')]=_0x26dd49[_0x99eb('0x36')];channels[_0x26dd49['localtwolinkedid']][_0x99eb('0x37')]=_0x99eb('0x38');}else if(channels[_0x26dd49[_0x99eb('0x31')]]['channel']=_0x26dd49[_0x99eb('0x39')]){utils[_0x99eb('0x5')](util['format'](_0x99eb('0x35'),_0x26dd49[_0x99eb('0x33')],_0x26dd49[_0x99eb('0x31')],_0x26dd49['origtransfererchannel']));channels[_0x26dd49[_0x99eb('0x31')]]['destinationchannel']=_0x26dd49['origtransfererchannel'];channels[_0x26dd49['localtwolinkedid']][_0x99eb('0x37')]='_attended';}}}catch(_0x17e8f4){utils['error'](util[_0x99eb('0x6')](_0x99eb('0x32'),_0x26dd49[_0x99eb('0x33')]),_0x17e8f4);}};exports[_0x99eb('0x3a')]=function(_0x243e91){try{if(!_[_0x99eb('0x1e')](channels[_0x243e91[_0x99eb('0x7')]])){utils['debug'](util[_0x99eb('0x6')](_0x99eb('0x3b'),_0x243e91[_0x99eb('0x7')]),_0x243e91);channels[_0x243e91[_0x99eb('0x7')]][_0x99eb('0x3c')]=utils[_0x99eb('0x18')]();utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x3d'),_0x243e91[_0x99eb('0x7')],channels[_0x243e91[_0x99eb('0x7')]][_0x99eb('0x3c')]));}}catch(_0x5d7361){utils[_0x99eb('0x1a')](util['format'](_0x99eb('0x3b'),_0x243e91[_0x99eb('0x7')]),_0x5d7361);}};exports[_0x99eb('0x3e')]=function(_0x588b3e){try{if(!_[_0x99eb('0x1e')](channels[_0x588b3e[_0x99eb('0x7')]])){utils['debug'](util[_0x99eb('0x6')](_0x99eb('0x3f'),_0x588b3e[_0x99eb('0x7')]),_0x588b3e);if(!_[_0x99eb('0x1e')](channels[_0x588b3e['uniqueid']][_0x99eb('0x3c')])){channels[_0x588b3e[_0x99eb('0x7')]][_0x99eb('0x40')]+=utils[_0x99eb('0x2e')](utils['now'](),channels[_0x588b3e[_0x99eb('0x7')]][_0x99eb('0x3c')]);utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x588b3e[_0x99eb('0x7')],channels[_0x588b3e['uniqueid']][_0x99eb('0x40')]));delete channels[_0x588b3e[_0x99eb('0x7')]][_0x99eb('0x3c')];}}}catch(_0x30bb30){utils[_0x99eb('0x1a')](util[_0x99eb('0x6')]('[%s][calls][musiconholdstop]',_0x588b3e[_0x99eb('0x7')]),_0x30bb30);}};exports[_0x99eb('0x41')]=function(_0x40e0ec){try{if(!_[_0x99eb('0x1e')](channels[_0x40e0ec[_0x99eb('0x7')]])){utils['debug'](util['format']('[%s][calls][varset]',_0x40e0ec[_0x99eb('0x7')]),_0x40e0ec);if(!_['isNil'](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x43')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x44'),_0x40e0ec[_0x99eb('0x7')],_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x46')]=_0x40e0ec[_0x99eb('0x45')];}if(!_['isNil'](_0x40e0ec['variable'][_0x99eb('0x47')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x48'),_0x40e0ec['uniqueid'],_0x40e0ec['value']));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x49')]=_0x40e0ec[_0x99eb('0x45')];channels[_0x40e0ec['uniqueid']][_0x99eb('0x29')]='\x22'+_0x40e0ec['value']+_0x99eb('0x4a')+_0x40e0ec[_0x99eb('0x45')]+'>';}if(!_['isNil'](_0x40e0ec[_0x99eb('0x42')]['xmd-callerid-preview'])||!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x4b')])){utils[_0x99eb('0x5')](util['format'](_0x99eb('0x4c'),_0x40e0ec[_0x99eb('0x7')],!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x4d')])?_0x99eb('0x4d'):_0x99eb('0x4b'),_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x29')]=_0x40e0ec[_0x99eb('0x45')];}if(!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x4e')])||!_['isNil'](_0x40e0ec['variable'][_0x99eb('0x4f')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x4c'),_0x40e0ec[_0x99eb('0x7')],!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x4e')])?'xmd-queue':_0x99eb('0x4f'),_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x50')]=_0x99eb('0x51');channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x52')]=_0x40e0ec['value'];channels[_0x40e0ec['uniqueid']]['queue']=!![];}if(!_['isNil'](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x53')])){utils['info'](util[_0x99eb('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x40e0ec[_0x99eb('0x7')],_0x40e0ec['value']));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x54')]=_0x40e0ec[_0x99eb('0x45')];}if(!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x55')])){utils['info'](util[_0x99eb('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x40e0ec[_0x99eb('0x7')],_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x56')]=_0x40e0ec[_0x99eb('0x45')];}if(!_['isNil'](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x57')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x40e0ec[_0x99eb('0x7')],_0x40e0ec['value']));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x58')]=_0x40e0ec[_0x99eb('0x45')];}if(!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x59')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x40e0ec[_0x99eb('0x7')],_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]]['sipcallid']=_0x40e0ec['value'];}}}catch(_0x28131c){utils['error'](util[_0x99eb('0x6')](_0x99eb('0x5a'),_0x40e0ec['uniqueid']),_0x28131c);}};exports['newexten']=function(_0x3de104){try{if(!_[_0x99eb('0x1e')](channels[_0x3de104[_0x99eb('0x7')]])){utils[_0x99eb('0x12')](util[_0x99eb('0x6')]('[%s][calls][newexten]',_0x3de104[_0x99eb('0x7')]),_0x3de104);utils[_0x99eb('0x5')](util['format'](_0x99eb('0x5b'),_0x3de104[_0x99eb('0x7')],_0x3de104[_0x99eb('0x5c')],_0x3de104[_0x99eb('0x5d')]));if(_0x3de104['application']['toLowerCase']()=='set'&&_[_0x99eb('0x5e')](_0x3de104[_0x99eb('0x5d')]['toLowerCase'](),'cdr')){var _0x54f017=_0x3de104[_0x99eb('0x5d')]['split']('=');var _0x527b04=_0x54f017[0x0][_0x99eb('0x5f')](_0x54f017[0x0][_0x99eb('0x60')]('(')+0x1,_0x54f017[0x0][_0x99eb('0x60')](')'));var _0x4dd52b=_0x54f017[0x1];channels[_0x3de104[_0x99eb('0x7')]][_0x527b04]=_0x4dd52b;}if(!_['includes']([_0x99eb('0x27'),_0x99eb('0x61'),_0x99eb('0x62'),_0x99eb('0x63'),_0x99eb('0x64')],_0x3de104[_0x99eb('0x5c')][_0x99eb('0x65')]())){channels[_0x3de104[_0x99eb('0x7')]][_0x99eb('0x50')]=_0x3de104[_0x99eb('0x5c')];channels[_0x3de104[_0x99eb('0x7')]][_0x99eb('0x52')]=_0x3de104[_0x99eb('0x5d')];}}}catch(_0x236565){utils[_0x99eb('0x1a')](util[_0x99eb('0x6')](_0x99eb('0x66'),_0x3de104[_0x99eb('0x7')]),_0x236565);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6c67ed8..6d31976 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 _0x4f83=['[core]\x20fullybooted','close','[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x2471ba,_0xb5cad){var _0x3464e3=function(_0x40e977){while(--_0x40e977){_0x2471ba['push'](_0x2471ba['shift']());}};_0x3464e3(++_0xb5cad);}(_0x4f83,0x15b));var _0x34f8=function(_0x2186af,_0x565f21){_0x2186af=_0x2186af-0x0;var _0x20023a=_0x4f83[_0x2186af];return _0x20023a;};'use strict';var utils=require(_0x34f8('0x0'));exports[_0x34f8('0x1')]=function(){utils[_0x34f8('0x2')](_0x34f8('0x3'));};exports[_0x34f8('0x4')]=function(){utils[_0x34f8('0x2')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x34f8('0x2')](_0x34f8('0x5'));};exports['error']=function(_0x7d5252){utils['error']('[core]\x20error',_0x7d5252);};exports[_0x34f8('0x6')]=function(){utils[_0x34f8('0x2')](_0x34f8('0x7'));};exports['managerevent']=function(_0x15469f){}; \ No newline at end of file +var _0x9d93=['./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x25a0b9,_0x86e28f){var _0x30b9ab=function(_0x883a4){while(--_0x883a4){_0x25a0b9['push'](_0x25a0b9['shift']());}};_0x30b9ab(++_0x86e28f);}(_0x9d93,0x15c));var _0x39d9=function(_0x123e27,_0xd0fb68){_0x123e27=_0x123e27-0x0;var _0x5e5be4=_0x9d93[_0x123e27];return _0x5e5be4;};'use strict';var utils=require(_0x39d9('0x0'));exports['connect']=function(){utils[_0x39d9('0x1')](_0x39d9('0x2'));};exports[_0x39d9('0x3')]=function(){utils[_0x39d9('0x1')](_0x39d9('0x4'));};exports[_0x39d9('0x5')]=function(){utils['info'](_0x39d9('0x6'));};exports['error']=function(_0x54a55a){utils[_0x39d9('0x7')](_0x39d9('0x8'),_0x54a55a);};exports[_0x39d9('0x9')]=function(){utils[_0x39d9('0x1')](_0x39d9('0xa'));};exports[_0x39d9('0xb')]=function(_0x2170a4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a9860b9..c3c3d9a 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 _0x7096=['diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','split','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration'];(function(_0x29e4be,_0x40a76d){var _0x266025=function(_0x26466f){while(--_0x26466f){_0x29e4be['push'](_0x29e4be['shift']());}};_0x266025(++_0x40a76d);}(_0x7096,0x1e4));var _0x6709=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7096[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x6709('0x0'));var util=require(_0x6709('0x1'));var utils=require(_0x6709('0x2'));var dials={};function writeDB(_0x3fd03c){utils[_0x6709('0x3')](util[_0x6709('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x3fd03c[_0x6709('0x5')],_0x3fd03c[_0x6709('0x6')],_0x3fd03c[_0x6709('0x7')],_0x3fd03c[_0x6709('0x8')],_0x3fd03c[_0x6709('0x9')],_0x3fd03c['dialstatus']));utils[_0x6709('0xa')](_0x6709('0xb'),_0x3fd03c);delete dials[_0x3fd03c['uniqueid']];}exports[_0x6709('0xc')]=function(_0x2c58f0){try{utils[_0x6709('0xd')](util['format']('[%s][dials][newexten]',_0x2c58f0[_0x6709('0x5')]),_0x2c58f0);utils[_0x6709('0x3')](util[_0x6709('0x4')](_0x6709('0xe'),_0x2c58f0[_0x6709('0x5')],_0x2c58f0[_0x6709('0xf')],_0x2c58f0['appdata']));if(_0x2c58f0[_0x6709('0xf')][_0x6709('0x10')]()==_0x6709('0x11')&&_[_0x6709('0x12')](_0x2c58f0['appdata'][_0x6709('0x10')](),'cdr(routeid)')){var _0x31aff3=_0x2c58f0['appdata'][_0x6709('0x13')]('=');dials[_0x2c58f0[_0x6709('0x5')]]={'routeId':_0x31aff3[0x1]};}}catch(_0x54ebd7){utils['error'](util['format']('[%s][dials][newexten]',_0x2c58f0['uniqueid']),_0x54ebd7);}};exports['varset']=function(_0x43ab0b){try{utils[_0x6709('0xd')](util[_0x6709('0x4')](_0x6709('0x14'),_0x43ab0b[_0x6709('0x5')]),_0x43ab0b);if(!_[_0x6709('0x15')](_0x43ab0b[_0x6709('0x16')]['outboundrouteid'])){utils['info'](util[_0x6709('0x4')](_0x6709('0x17'),_0x43ab0b[_0x6709('0x5')],_0x43ab0b[_0x6709('0x18')]));dials[_0x43ab0b[_0x6709('0x5')]]={'routeId':_0x43ab0b['value']};}}catch(_0x1edaf7){utils[_0x6709('0x19')](util[_0x6709('0x4')]('[%s][dials][varset]',_0x43ab0b[_0x6709('0x5')]),_0x1edaf7);}};exports[_0x6709('0x1a')]=function(_0x30aef6){try{if(!_[_0x6709('0x15')](dials[_0x30aef6['uniqueid']])){utils[_0x6709('0xd')](util[_0x6709('0x4')](_0x6709('0x1b'),_0x30aef6[_0x6709('0x5')]),_0x30aef6);dials[_0x30aef6[_0x6709('0x5')]]=_[_0x6709('0x1c')](dials[_0x30aef6[_0x6709('0x5')]],_0x30aef6);dials[_0x30aef6['uniqueid']][_0x6709('0x1d')]=utils[_0x6709('0x1e')]();dials[_0x30aef6['uniqueid']][_0x6709('0x1f')]=_0x6709('0x20');utils[_0x6709('0x3')](util[_0x6709('0x4')](_0x6709('0x21'),_0x30aef6['uniqueid'],dials[_0x30aef6['uniqueid']][_0x6709('0x1d')]));}}catch(_0x1b2156){utils['error'](util[_0x6709('0x4')](_0x6709('0x1b'),_0x30aef6[_0x6709('0x5')]),_0x1b2156);}};exports[_0x6709('0x22')]=function(_0x559525){try{if(!_[_0x6709('0x15')](dials[_0x559525[_0x6709('0x5')]])){utils[_0x6709('0xd')](util[_0x6709('0x4')](_0x6709('0x23'),_0x559525['uniqueid']),_0x559525);dials[_0x559525[_0x6709('0x5')]][_0x6709('0x24')]=_0x559525['dialstatus'];if(_0x559525[_0x6709('0x24')]=='ANSWER'){dials[_0x559525['uniqueid']]=_['assign'](dials[_0x559525[_0x6709('0x5')]],_0x559525);dials[_0x559525[_0x6709('0x5')]][_0x6709('0x25')]=utils[_0x6709('0x1e')]();dials[_0x559525[_0x6709('0x5')]][_0x6709('0x1f')]='connect';utils[_0x6709('0x3')](util['format'](_0x6709('0x26'),_0x559525[_0x6709('0x5')],_0x559525['dialstatus'],dials[_0x559525[_0x6709('0x5')]][_0x6709('0x25')]));}else{utils[_0x6709('0x3')](util[_0x6709('0x4')](_0x6709('0x27'),_0x559525['uniqueid'],_0x559525[_0x6709('0x24')]));}}}catch(_0x4a9eef){utils[_0x6709('0x19')](util[_0x6709('0x4')](_0x6709('0x23'),_0x559525['uniqueid']),_0x4a9eef);}};exports['hangup']=function(_0x344a7d){try{if(!_[_0x6709('0x15')](dials[_0x344a7d[_0x6709('0x5')]])){utils[_0x6709('0xd')](util[_0x6709('0x4')]('[%s][dials][hangup]',_0x344a7d[_0x6709('0x5')]),_0x344a7d);utils[_0x6709('0x3')](util[_0x6709('0x4')](_0x6709('0x28'),_0x344a7d[_0x6709('0x5')],_0x344a7d[_0x6709('0x8')],_0x344a7d[_0x6709('0x29')],_0x344a7d[_0x6709('0x2a')]));dials[_0x344a7d[_0x6709('0x5')]]=_[_0x6709('0x1c')](dials[_0x344a7d[_0x6709('0x5')]],{'endtime':utils[_0x6709('0x1e')](),'lastevent':'complete'});dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x2b')]=utils[_0x6709('0x2c')](dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x2d')],dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x1d')]);dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x2e')]=utils[_0x6709('0x2c')](dials[_0x344a7d[_0x6709('0x5')]][_0x6709('0x25')]||dials[_0x344a7d['uniqueid']][_0x6709('0x2d')],dials[_0x344a7d[_0x6709('0x5')]]['starttime']);dials[_0x344a7d['uniqueid']][_0x6709('0x2f')]=dials[_0x344a7d['uniqueid']][_0x6709('0x25')]?utils[_0x6709('0x2c')](dials[_0x344a7d[_0x6709('0x5')]]['endtime'],dials[_0x344a7d['uniqueid']]['answertime']):0x0;writeDB(dials[_0x344a7d[_0x6709('0x5')]]);}}catch(_0x2115b8){utils['error'](util['format']('[%s][dials][hangup]',_0x344a7d['uniqueid']),_0x2115b8);}}; \ No newline at end of file +var _0x7953=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format'];(function(_0x3a57b0,_0x23145a){var _0x2b8f3e=function(_0x1c721a){while(--_0x1c721a){_0x3a57b0['push'](_0x3a57b0['shift']());}};_0x2b8f3e(++_0x23145a);}(_0x7953,0x1e1));var _0x3795=function(_0x1f0679,_0x53d43c){_0x1f0679=_0x1f0679-0x0;var _0x3dc3a4=_0x7953[_0x1f0679];return _0x3dc3a4;};'use strict';var _=require(_0x3795('0x0'));var util=require(_0x3795('0x1'));var utils=require(_0x3795('0x2'));var dials={};function writeDB(_0x24fa17){utils[_0x3795('0x3')](util[_0x3795('0x4')](_0x3795('0x5'),_0x24fa17[_0x3795('0x6')],_0x24fa17[_0x3795('0x7')],_0x24fa17[_0x3795('0x8')],_0x24fa17['calleridnum'],_0x24fa17[_0x3795('0x9')],_0x24fa17[_0x3795('0xa')]));utils[_0x3795('0xb')](_0x3795('0xc'),_0x24fa17);delete dials[_0x24fa17[_0x3795('0x6')]];}exports[_0x3795('0xd')]=function(_0x565ddd){try{utils[_0x3795('0xe')](util[_0x3795('0x4')]('[%s][dials][newexten]',_0x565ddd[_0x3795('0x6')]),_0x565ddd);utils[_0x3795('0x3')](util['format'](_0x3795('0xf'),_0x565ddd[_0x3795('0x6')],_0x565ddd[_0x3795('0x10')],_0x565ddd[_0x3795('0x11')]));if(_0x565ddd[_0x3795('0x10')]['toLowerCase']()==_0x3795('0x12')&&_[_0x3795('0x13')](_0x565ddd['appdata'][_0x3795('0x14')](),_0x3795('0x15'))){var _0x564a28=_0x565ddd[_0x3795('0x11')][_0x3795('0x16')]('=');dials[_0x565ddd[_0x3795('0x6')]]={'routeId':_0x564a28[0x1]};}}catch(_0x364e82){utils[_0x3795('0x17')](util[_0x3795('0x4')](_0x3795('0x18'),_0x565ddd['uniqueid']),_0x364e82);}};exports[_0x3795('0x19')]=function(_0x452bfc){try{utils[_0x3795('0xe')](util[_0x3795('0x4')](_0x3795('0x1a'),_0x452bfc[_0x3795('0x6')]),_0x452bfc);if(!_[_0x3795('0x1b')](_0x452bfc['variable'][_0x3795('0x1c')])){utils[_0x3795('0x3')](util[_0x3795('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x452bfc['uniqueid'],_0x452bfc[_0x3795('0x1d')]));dials[_0x452bfc[_0x3795('0x6')]]={'routeId':_0x452bfc[_0x3795('0x1d')]};}}catch(_0x5e91b2){utils[_0x3795('0x17')](util[_0x3795('0x4')](_0x3795('0x1a'),_0x452bfc[_0x3795('0x6')]),_0x5e91b2);}};exports[_0x3795('0x1e')]=function(_0x50ba22){try{if(!_[_0x3795('0x1b')](dials[_0x50ba22['uniqueid']])){utils[_0x3795('0xe')](util['format'](_0x3795('0x1f'),_0x50ba22[_0x3795('0x6')]),_0x50ba22);dials[_0x50ba22[_0x3795('0x6')]]=_[_0x3795('0x20')](dials[_0x50ba22[_0x3795('0x6')]],_0x50ba22);dials[_0x50ba22[_0x3795('0x6')]][_0x3795('0x21')]=utils['now']();dials[_0x50ba22[_0x3795('0x6')]][_0x3795('0x22')]=_0x3795('0x23');utils['info'](util[_0x3795('0x4')](_0x3795('0x24'),_0x50ba22[_0x3795('0x6')],dials[_0x50ba22[_0x3795('0x6')]]['starttime']));}}catch(_0x36f5aa){utils[_0x3795('0x17')](util[_0x3795('0x4')](_0x3795('0x1f'),_0x50ba22[_0x3795('0x6')]),_0x36f5aa);}};exports[_0x3795('0x25')]=function(_0x10689a){try{if(!_[_0x3795('0x1b')](dials[_0x10689a[_0x3795('0x6')]])){utils[_0x3795('0xe')](util[_0x3795('0x4')](_0x3795('0x26'),_0x10689a[_0x3795('0x6')]),_0x10689a);dials[_0x10689a[_0x3795('0x6')]]['dialstatus']=_0x10689a['dialstatus'];if(_0x10689a[_0x3795('0xa')]=='ANSWER'){dials[_0x10689a[_0x3795('0x6')]]=_['assign'](dials[_0x10689a[_0x3795('0x6')]],_0x10689a);dials[_0x10689a[_0x3795('0x6')]][_0x3795('0x27')]=utils[_0x3795('0x28')]();dials[_0x10689a[_0x3795('0x6')]][_0x3795('0x22')]=_0x3795('0x29');utils['info'](util['format'](_0x3795('0x2a'),_0x10689a['uniqueid'],_0x10689a[_0x3795('0xa')],dials[_0x10689a[_0x3795('0x6')]][_0x3795('0x27')]));}else{utils[_0x3795('0x3')](util[_0x3795('0x4')](_0x3795('0x2b'),_0x10689a['uniqueid'],_0x10689a[_0x3795('0xa')]));}}}catch(_0xd5fbb6){utils['error'](util[_0x3795('0x4')](_0x3795('0x26'),_0x10689a[_0x3795('0x6')]),_0xd5fbb6);}};exports[_0x3795('0x2c')]=function(_0x104b05){try{if(!_[_0x3795('0x1b')](dials[_0x104b05[_0x3795('0x6')]])){utils['debug'](util[_0x3795('0x4')](_0x3795('0x2d'),_0x104b05[_0x3795('0x6')]),_0x104b05);utils[_0x3795('0x3')](util[_0x3795('0x4')](_0x3795('0x2e'),_0x104b05[_0x3795('0x6')],_0x104b05[_0x3795('0x2f')],_0x104b05['calleridname'],_0x104b05[_0x3795('0x30')]));dials[_0x104b05[_0x3795('0x6')]]=_[_0x3795('0x20')](dials[_0x104b05[_0x3795('0x6')]],{'endtime':utils[_0x3795('0x28')](),'lastevent':_0x3795('0x31')});dials[_0x104b05[_0x3795('0x6')]][_0x3795('0x32')]=utils[_0x3795('0x33')](dials[_0x104b05[_0x3795('0x6')]]['endtime'],dials[_0x104b05['uniqueid']]['starttime']);dials[_0x104b05[_0x3795('0x6')]]['holdtime']=utils[_0x3795('0x33')](dials[_0x104b05['uniqueid']][_0x3795('0x27')]||dials[_0x104b05['uniqueid']][_0x3795('0x34')],dials[_0x104b05[_0x3795('0x6')]][_0x3795('0x21')]);dials[_0x104b05['uniqueid']][_0x3795('0x35')]=dials[_0x104b05[_0x3795('0x6')]][_0x3795('0x27')]?utils[_0x3795('0x33')](dials[_0x104b05[_0x3795('0x6')]][_0x3795('0x34')],dials[_0x104b05[_0x3795('0x6')]]['answertime']):0x0;writeDB(dials[_0x104b05[_0x3795('0x6')]]);}}catch(_0x15ea10){utils['error'](util['format']('[%s][dials][hangup]',_0x104b05[_0x3795('0x6')]),_0x15ea10);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0d58cc1..b6289b9 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 _0xa4cc=['queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x4c007d,_0x289126){var _0x582594=function(_0x40f2eb){while(--_0x40f2eb){_0x4c007d['push'](_0x4c007d['shift']());}};_0x582594(++_0x289126);}(_0xa4cc,0xed));var _0xca4c=function(_0x4689bc,_0x5730fe){_0x4689bc=_0x4689bc-0x0;var _0x412dbb=_0xa4cc[_0x4689bc];return _0x412dbb;};var AsteriskManager=require('asterisk-manager');var config=require(_0xca4c('0x0'));var utils=require(_0xca4c('0x1'));var util=require('util');var isXDREnabled=config[_0xca4c('0x2')]&&config[_0xca4c('0x2')][_0xca4c('0x3')]?!config['xdr']['disabled']:!![];var isProduction=config[_0xca4c('0x4')]===_0xca4c('0x5')||![];var isLocalAsterisk=config[_0xca4c('0x2')]&&config[_0xca4c('0x2')][_0xca4c('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xca4c('0x7')][_0xca4c('0x8')],config['asterisk']['ip'],config[_0xca4c('0x7')]['username'],config[_0xca4c('0x7')][_0xca4c('0x9')],!![]);ami[_0xca4c('0xa')]();if(!isXDREnabled){utils[_0xca4c('0xb')](_0xca4c('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xca4c('0xb')](_0xca4c('0xd'));}else{var agents=require(_0xca4c('0xe'));var calls=require(_0xca4c('0xf'));var queues=require(_0xca4c('0x10'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xca4c('0x11'));var core=require(_0xca4c('0x12'));ami['on'](_0xca4c('0x13'),core[_0xca4c('0x13')]);ami['on'](_0xca4c('0x14'),core[_0xca4c('0x14')]);ami['on'](_0xca4c('0x15'),core[_0xca4c('0x15')]);ami['on']('error',core[_0xca4c('0x16')]);ami['on'](_0xca4c('0x17'),core[_0xca4c('0x17')]);ami['on'](_0xca4c('0x18'),core[_0xca4c('0x18')]);ami['on'](_0xca4c('0x19'),function(_0x35e988){try{utils['debug'](util[_0xca4c('0x1a')](_0xca4c('0x1b'),_0x35e988[_0xca4c('0x1c')]),_0x35e988);members['devicestatechange'](_0x35e988);}catch(_0x493be5){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x1b'),_0x35e988[_0xca4c('0x1c')]),_0x493be5);}});ami['on'](_0xca4c('0x1d'),function(_0x3274d5){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x1f'),_0x3274d5['uniqueid']),_0x3274d5);agents['agentcalled'](_0x3274d5);}catch(_0x454be0){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x1f'),_0x3274d5[_0xca4c('0x20')]),_0x454be0);}});ami['on'](_0xca4c('0x21'),function(_0x42b025){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x22'),_0x42b025['uniqueid']),_0x42b025);agents[_0xca4c('0x21')](_0x42b025);}catch(_0x7e41c8){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x22'),_0x42b025['uniqueid']),_0x7e41c8);}});ami['on'](_0xca4c('0x23'),function(_0x479e84){try{utils[_0xca4c('0x1e')](util['format'](_0xca4c('0x24'),_0x479e84['uniqueid']),_0x479e84);agents[_0xca4c('0x23')](_0x479e84);queues[_0xca4c('0x23')](_0x479e84);}catch(_0x42e7a7){utils['error'](util[_0xca4c('0x1a')](_0xca4c('0x24'),_0x479e84[_0xca4c('0x20')]),_0x42e7a7);}});ami['on'](_0xca4c('0x25'),function(_0x41184f){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x26'),_0x41184f[_0xca4c('0x20')]),_0x41184f);agents[_0xca4c('0x25')](_0x41184f);queues[_0xca4c('0x25')](_0x41184f);members[_0xca4c('0x25')](_0x41184f);}catch(_0x2d95a9){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')]('[%s][index][agentcomplete]',_0x41184f[_0xca4c('0x20')]),_0x2d95a9);}});ami['on'](_0xca4c('0x27'),function(_0x5ab7d4){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x28'),_0x5ab7d4[_0xca4c('0x20')]),_0x5ab7d4);agents[_0xca4c('0x27')](_0x5ab7d4);queues['queuecallerabandon'](_0x5ab7d4);}catch(_0x53070c){utils['error'](util['format'](_0xca4c('0x28'),_0x5ab7d4[_0xca4c('0x20')]),_0x53070c);}});ami['on'](_0xca4c('0x29'),function(_0x271774){try{utils['debug'](util[_0xca4c('0x1a')](_0xca4c('0x2a'),_0x271774['uniqueid']),_0x271774);queues[_0xca4c('0x29')](_0x271774);recordings[_0xca4c('0x29')](_0x271774);}catch(_0x336df9){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x2a'),_0x271774[_0xca4c('0x20')]),_0x336df9);}});ami['on'](_0xca4c('0x2b'),function(_0x7dec0a){try{utils[_0xca4c('0x1e')](util['format'](_0xca4c('0x2c'),_0x7dec0a['uniqueid']),_0x7dec0a);queues[_0xca4c('0x2b')](_0x7dec0a);}catch(_0x340c64){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')]('[%s][index][queuecallerleave]',_0x7dec0a[_0xca4c('0x20')]),_0x340c64);}});ami['on'](_0xca4c('0x2d'),function(_0x3e6fb4){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x2e'),_0x3e6fb4['uniqueid']),_0x3e6fb4);queues[_0xca4c('0x2d')](_0x3e6fb4);calls[_0xca4c('0x2d')](_0x3e6fb4);}catch(_0x3c2d69){utils[_0xca4c('0x16')](util['format'](_0xca4c('0x2e'),_0x3e6fb4[_0xca4c('0x20')]),_0x3c2d69);}});ami['on'](_0xca4c('0x2f'),function(_0x2c4bbc){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x30'),_0x2c4bbc[_0xca4c('0x20')]),_0x2c4bbc);queues[_0xca4c('0x2f')](_0x2c4bbc);calls[_0xca4c('0x2f')](_0x2c4bbc);}catch(_0x3290ca){utils[_0xca4c('0x16')](util['format']('[%s][index][musiconholdstop]',_0x2c4bbc[_0xca4c('0x20')]),_0x3290ca);}});ami['on'](_0xca4c('0x31'),function(_0x5a8ac5){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x32'),_0x5a8ac5['uniqueid']),_0x5a8ac5);calls['newstate'](_0x5a8ac5);recordings['newstate'](_0x5a8ac5);}catch(_0x4952d9){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x32'),_0x5a8ac5[_0xca4c('0x20')]),_0x4952d9);}});ami['on'](_0xca4c('0x33'),function(_0x5e353f){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x34'),_0x5e353f['uniqueid']),_0x5e353f);calls[_0xca4c('0x33')](_0x5e353f);recordings[_0xca4c('0x33')](_0x5e353f);dials[_0xca4c('0x33')](_0x5e353f);agents[_0xca4c('0x33')](_0x5e353f);queues[_0xca4c('0x33')](_0x5e353f);}catch(_0x5145a9){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')]('[%s][index][hangup]',_0x5e353f['uniqueid']),_0x5145a9);}});ami['on']('cdr',function(_0x299276){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x35'),_0x299276[_0xca4c('0x20')]),_0x299276);members[_0xca4c('0x36')](_0x299276);}catch(_0x36bae8){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x35'),_0x299276['uniqueid']),_0x36bae8);}});ami['on'](_0xca4c('0x37'),function(_0x426bbd){try{utils['debug'](util[_0xca4c('0x1a')](_0xca4c('0x38'),_0x426bbd[_0xca4c('0x20')]),_0x426bbd);queues[_0xca4c('0x37')](_0x426bbd);agents['blindtransfer'](_0x426bbd);transfers[_0xca4c('0x37')](_0x426bbd);}catch(_0x33671c){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x38'),_0x426bbd[_0xca4c('0x20')]),_0x33671c);}});ami['on']('attendedtransfer',function(_0x446663){try{utils['debug'](util['format'](_0xca4c('0x39'),_0x446663['origtransfereruniqueid']),_0x446663);queues[_0xca4c('0x3a')](_0x446663);transfers['attendedtransfer'](_0x446663);agents[_0xca4c('0x3a')](_0x446663);calls[_0xca4c('0x3a')](_0x446663);}catch(_0x1e9dee){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x39'),_0x446663[_0xca4c('0x3b')]),_0x1e9dee);}});ami['on']('varset',function(_0x324a74){try{utils[_0xca4c('0x1e')](util['format']('[%s][index][varset]',_0x324a74[_0xca4c('0x20')]),_0x324a74);queues[_0xca4c('0x3c')](_0x324a74);recordings[_0xca4c('0x3c')](_0x324a74);calls['varset'](_0x324a74);dials[_0xca4c('0x3c')](_0x324a74);}catch(_0xa32c56){utils['error'](util[_0xca4c('0x1a')](_0xca4c('0x3d'),_0x324a74[_0xca4c('0x20')]),_0xa32c56);}});ami['on'](_0xca4c('0x3e'),function(_0x2bd313){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')](_0xca4c('0x3f'),_0x2bd313['uniqueid']),_0x2bd313);calls['newexten'](_0x2bd313);recordings[_0xca4c('0x3e')](_0x2bd313);dials[_0xca4c('0x3e')](_0x2bd313);}catch(_0x228c22){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x3f'),_0x2bd313['uniqueid']),_0x228c22);}});ami['on'](_0xca4c('0x40'),function(_0x46d0e8){try{utils['debug'](util[_0xca4c('0x1a')]('[%s][index][newchannel]',_0x46d0e8[_0xca4c('0x20')]),_0x46d0e8);calls[_0xca4c('0x40')](_0x46d0e8);recordings['newchannel'](_0x46d0e8);}catch(_0x32f25c){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')]('[%s][index][newchannel]',_0x46d0e8['uniqueid']),_0x32f25c);}});ami['on'](_0xca4c('0x41'),function(_0x43d153){try{utils[_0xca4c('0x1e')](util[_0xca4c('0x1a')]('[%s][index][dialbegin]',_0x43d153['uniqueid']),_0x43d153);dials[_0xca4c('0x41')](_0x43d153);}catch(_0x522fbc){utils[_0xca4c('0x16')](util[_0xca4c('0x1a')](_0xca4c('0x42'),_0x43d153[_0xca4c('0x20')]),_0x522fbc);}});ami['on'](_0xca4c('0x43'),function(_0xf8583e){try{utils[_0xca4c('0x1e')](util['format'](_0xca4c('0x44'),_0xf8583e[_0xca4c('0x20')]),_0xf8583e);dials[_0xca4c('0x43')](_0xf8583e);}catch(_0x318674){utils[_0xca4c('0x16')](util['format'](_0xca4c('0x44'),_0xf8583e[_0xca4c('0x20')]),_0x318674);}});} \ No newline at end of file +var _0xa5ae=['dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','[%s][index][hangup]','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'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa5ae,0x90));var _0xea5a=function(_0x4ebb5d,_0x1e92b6){_0x4ebb5d=_0x4ebb5d-0x0;var _0x5abafd=_0xa5ae[_0x4ebb5d];return _0x5abafd;};var AsteriskManager=require(_0xea5a('0x0'));var config=require('../../config/environment');var utils=require(_0xea5a('0x1'));var util=require(_0xea5a('0x2'));var isXDREnabled=config[_0xea5a('0x3')]&&config[_0xea5a('0x3')]['disabled']?!config[_0xea5a('0x3')][_0xea5a('0x4')]:!![];var isProduction=config[_0xea5a('0x5')]==='production'||![];var isLocalAsterisk=config[_0xea5a('0x3')]&&config[_0xea5a('0x3')][_0xea5a('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xea5a('0x7')][_0xea5a('0x8')],config[_0xea5a('0x7')]['ip'],config[_0xea5a('0x7')][_0xea5a('0x9')],config['asterisk'][_0xea5a('0xa')],!![]);ami[_0xea5a('0xb')]();if(!isXDREnabled){utils[_0xea5a('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xea5a('0xd'));}else{var agents=require(_0xea5a('0xe'));var calls=require(_0xea5a('0xf'));var queues=require(_0xea5a('0x10'));var recordings=require(_0xea5a('0x11'));var members=require('./members.controller');var dials=require(_0xea5a('0x12'));var transfers=require(_0xea5a('0x13'));var core=require('./core.controller');ami['on'](_0xea5a('0x14'),core[_0xea5a('0x14')]);ami['on'](_0xea5a('0x15'),core['shutdown']);ami['on'](_0xea5a('0x16'),core[_0xea5a('0x16')]);ami['on'](_0xea5a('0x17'),core[_0xea5a('0x17')]);ami['on'](_0xea5a('0x18'),core['close']);ami['on'](_0xea5a('0x19'),core[_0xea5a('0x19')]);ami['on'](_0xea5a('0x1a'),function(_0x13de52){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x1d'),_0x13de52[_0xea5a('0x1e')]),_0x13de52);members[_0xea5a('0x1a')](_0x13de52);}catch(_0x4d32b9){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')]('[%s][index][devicestatechange]',_0x13de52[_0xea5a('0x1e')]),_0x4d32b9);}});ami['on'](_0xea5a('0x1f'),function(_0x477b0f){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')]('[%s][index][agentcalled]',_0x477b0f[_0xea5a('0x20')]),_0x477b0f);agents[_0xea5a('0x1f')](_0x477b0f);}catch(_0x185360){utils[_0xea5a('0x17')](util['format'](_0xea5a('0x21'),_0x477b0f[_0xea5a('0x20')]),_0x185360);}});ami['on']('agentringnoanswer',function(_0x318586){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x22'),_0x318586[_0xea5a('0x20')]),_0x318586);agents[_0xea5a('0x23')](_0x318586);}catch(_0x5e2a5e){utils['error'](util[_0xea5a('0x1c')](_0xea5a('0x22'),_0x318586['uniqueid']),_0x5e2a5e);}});ami['on'](_0xea5a('0x24'),function(_0x239d1c){try{utils['debug'](util[_0xea5a('0x1c')](_0xea5a('0x25'),_0x239d1c[_0xea5a('0x20')]),_0x239d1c);agents['agentconnect'](_0x239d1c);queues[_0xea5a('0x24')](_0x239d1c);}catch(_0x397207){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x25'),_0x239d1c['uniqueid']),_0x397207);}});ami['on'](_0xea5a('0x26'),function(_0x4d41a7){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x27'),_0x4d41a7[_0xea5a('0x20')]),_0x4d41a7);agents[_0xea5a('0x26')](_0x4d41a7);queues[_0xea5a('0x26')](_0x4d41a7);members[_0xea5a('0x26')](_0x4d41a7);}catch(_0x1e2f89){utils['error'](util['format'](_0xea5a('0x27'),_0x4d41a7['uniqueid']),_0x1e2f89);}});ami['on'](_0xea5a('0x28'),function(_0x1be830){try{utils[_0xea5a('0x1b')](util['format'](_0xea5a('0x29'),_0x1be830[_0xea5a('0x20')]),_0x1be830);agents[_0xea5a('0x28')](_0x1be830);queues[_0xea5a('0x28')](_0x1be830);}catch(_0x5eae60){utils[_0xea5a('0x17')](util['format'](_0xea5a('0x29'),_0x1be830[_0xea5a('0x20')]),_0x5eae60);}});ami['on'](_0xea5a('0x2a'),function(_0x48d938){try{utils[_0xea5a('0x1b')](util['format'](_0xea5a('0x2b'),_0x48d938[_0xea5a('0x20')]),_0x48d938);queues[_0xea5a('0x2a')](_0x48d938);recordings[_0xea5a('0x2a')](_0x48d938);}catch(_0x35c82d){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x2b'),_0x48d938[_0xea5a('0x20')]),_0x35c82d);}});ami['on']('queuecallerleave',function(_0xa1feef){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x2c'),_0xa1feef[_0xea5a('0x20')]),_0xa1feef);queues['queuecallerleave'](_0xa1feef);}catch(_0x282e30){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x2c'),_0xa1feef[_0xea5a('0x20')]),_0x282e30);}});ami['on'](_0xea5a('0x2d'),function(_0x259a9a){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x2e'),_0x259a9a[_0xea5a('0x20')]),_0x259a9a);queues['musiconholdstart'](_0x259a9a);calls[_0xea5a('0x2d')](_0x259a9a);}catch(_0x1ce08d){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x2e'),_0x259a9a[_0xea5a('0x20')]),_0x1ce08d);}});ami['on']('musiconholdstop',function(_0x590fbd){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x2f'),_0x590fbd[_0xea5a('0x20')]),_0x590fbd);queues[_0xea5a('0x30')](_0x590fbd);calls[_0xea5a('0x30')](_0x590fbd);}catch(_0x2cb62c){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x2f'),_0x590fbd[_0xea5a('0x20')]),_0x2cb62c);}});ami['on']('newstate',function(_0x1baee5){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x31'),_0x1baee5[_0xea5a('0x20')]),_0x1baee5);calls[_0xea5a('0x32')](_0x1baee5);recordings['newstate'](_0x1baee5);}catch(_0x2917de){utils[_0xea5a('0x17')](util['format'](_0xea5a('0x31'),_0x1baee5[_0xea5a('0x20')]),_0x2917de);}});ami['on']('hangup',function(_0x141d78){try{utils['debug'](util['format'](_0xea5a('0x33'),_0x141d78[_0xea5a('0x20')]),_0x141d78);calls[_0xea5a('0x34')](_0x141d78);recordings['hangup'](_0x141d78);dials[_0xea5a('0x34')](_0x141d78);agents[_0xea5a('0x34')](_0x141d78);queues[_0xea5a('0x34')](_0x141d78);}catch(_0xc20291){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x33'),_0x141d78['uniqueid']),_0xc20291);}});ami['on'](_0xea5a('0x35'),function(_0xfe82b2){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x36'),_0xfe82b2['uniqueid']),_0xfe82b2);members[_0xea5a('0x35')](_0xfe82b2);}catch(_0x3474ed){utils['error'](util['format'](_0xea5a('0x36'),_0xfe82b2[_0xea5a('0x20')]),_0x3474ed);}});ami['on'](_0xea5a('0x37'),function(_0x2f33c5){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x38'),_0x2f33c5['uniqueid']),_0x2f33c5);queues[_0xea5a('0x37')](_0x2f33c5);agents[_0xea5a('0x37')](_0x2f33c5);transfers[_0xea5a('0x37')](_0x2f33c5);}catch(_0x26e7dc){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x38'),_0x2f33c5[_0xea5a('0x20')]),_0x26e7dc);}});ami['on'](_0xea5a('0x39'),function(_0x25c561){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')]('[%s][index][attendedtransfer]',_0x25c561[_0xea5a('0x3a')]),_0x25c561);queues[_0xea5a('0x39')](_0x25c561);transfers['attendedtransfer'](_0x25c561);agents['attendedtransfer'](_0x25c561);calls[_0xea5a('0x39')](_0x25c561);}catch(_0x35624b){utils['error'](util[_0xea5a('0x1c')](_0xea5a('0x3b'),_0x25c561[_0xea5a('0x3a')]),_0x35624b);}});ami['on']('varset',function(_0x867bc){try{utils['debug'](util[_0xea5a('0x1c')]('[%s][index][varset]',_0x867bc[_0xea5a('0x20')]),_0x867bc);queues['varset'](_0x867bc);recordings[_0xea5a('0x3c')](_0x867bc);calls['varset'](_0x867bc);dials[_0xea5a('0x3c')](_0x867bc);}catch(_0xbc5416){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x3d'),_0x867bc['uniqueid']),_0xbc5416);}});ami['on'](_0xea5a('0x3e'),function(_0x36ef4f){try{utils['debug'](util[_0xea5a('0x1c')](_0xea5a('0x3f'),_0x36ef4f[_0xea5a('0x20')]),_0x36ef4f);calls[_0xea5a('0x3e')](_0x36ef4f);recordings[_0xea5a('0x3e')](_0x36ef4f);dials[_0xea5a('0x3e')](_0x36ef4f);}catch(_0x374ca5){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x3f'),_0x36ef4f[_0xea5a('0x20')]),_0x374ca5);}});ami['on'](_0xea5a('0x40'),function(_0x48bb9f){try{utils[_0xea5a('0x1b')](util['format'](_0xea5a('0x41'),_0x48bb9f[_0xea5a('0x20')]),_0x48bb9f);calls[_0xea5a('0x40')](_0x48bb9f);recordings['newchannel'](_0x48bb9f);}catch(_0x1d579b){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')]('[%s][index][newchannel]',_0x48bb9f[_0xea5a('0x20')]),_0x1d579b);}});ami['on'](_0xea5a('0x42'),function(_0x1595bf){try{utils[_0xea5a('0x1b')](util['format'](_0xea5a('0x43'),_0x1595bf[_0xea5a('0x20')]),_0x1595bf);dials[_0xea5a('0x42')](_0x1595bf);}catch(_0x3a66e7){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x44'),_0x1595bf[_0xea5a('0x20')]),_0x3a66e7);}});ami['on'](_0xea5a('0x45'),function(_0x2929fb){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x46'),_0x2929fb['uniqueid']),_0x2929fb);dials['dialend'](_0x2929fb);}catch(_0x3436ab){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')]('[%s][index][dialend]',_0x2929fb['uniqueid']),_0x3436ab);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 9bc11f0..2205e67 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 _0x8318=['./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','split','name','CreateMemberReport','catch','format','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util'];(function(_0x29a578,_0x406599){var _0x1cebfe=function(_0x2cb7da){while(--_0x2cb7da){_0x29a578['push'](_0x29a578['shift']());}};_0x1cebfe(++_0x406599);}(_0x8318,0x6a));var _0x8831=function(_0x4b8e29,_0x5d5708){_0x4b8e29=_0x4b8e29-0x0;var _0x50cf62=_0x8318[_0x4b8e29];return _0x50cf62;};'use strict';var _=require(_0x8831('0x0'));var util=require(_0x8831('0x1'));var utils=require(_0x8831('0x2'));var members={};var exclude=[_0x8831('0x3'),_0x8831('0x4')];function writeDB(_0x2c2dc1){utils[_0x8831('0x5')](util['format'](_0x8831('0x6'),_0x2c2dc1['uniqueid'],_0x2c2dc1[_0x8831('0x7')],_0x2c2dc1[_0x8831('0x8')],_0x2c2dc1[_0x8831('0x9')],_0x2c2dc1[_0x8831('0xa')],_0x2c2dc1[_0x8831('0xb')]));if(_0x2c2dc1['interface']){utils[_0x8831('0xc')](_0x2c2dc1['interface'])[_0x8831('0xd')](function(_0x2f9dc8){if(_0x2f9dc8){_0x2c2dc1['membername']=_0x2f9dc8['name'];_0x2c2dc1[_0x8831('0xe')]=_0x2f9dc8[_0x8831('0xe')];utils[_0x8831('0xf')]('CreateMemberReport',_0x2c2dc1);}else{utils[_0x8831('0x10')](_0x2c2dc1['interface'][_0x8831('0x11')]('/')[0x1])['then'](function(_0xefd394){if(_0xefd394){_0x2c2dc1[_0x8831('0xa')]=_0xefd394[_0x8831('0x12')];_0x2c2dc1['internal']=_0xefd394[_0x8831('0xe')];utils[_0x8831('0xf')](_0x8831('0x13'),_0x2c2dc1);}});}})[_0x8831('0x14')](function(_0x6bf66e){utils['error'](util[_0x8831('0x15')]('[%s][members][writeDB]',_0x2c2dc1['uniqueid']),_0x6bf66e);});}delete members[_0x2c2dc1[_0x8831('0x7')]];}function startsWith(_0x55bdbe,_0x1343bc){return _[_0x8831('0x16')](_0x55bdbe,function(_0x5a43a6){return _[_0x8831('0x17')](_0x1343bc,_0x5a43a6);});}exports[_0x8831('0x18')]=function(_0x32ffe0){try{utils[_0x8831('0x19')](util[_0x8831('0x15')](_0x8831('0x1a'),members[_0x32ffe0[_0x8831('0x1b')]]?members[_0x32ffe0[_0x8831('0x1b')]][_0x8831('0x1c')]:_0x32ffe0['device']),_0x32ffe0);utils['info'](util[_0x8831('0x15')](_0x8831('0x1d'),members[_0x32ffe0['device']]?members[_0x32ffe0[_0x8831('0x1b')]]['uniqueid']:_0x32ffe0[_0x8831('0x1b')],_0x32ffe0[_0x8831('0x1e')],_0x32ffe0[_0x8831('0x1b')]));switch(_0x32ffe0[_0x8831('0x1e')]){case _0x8831('0x1f'):case'BUSY':if(!startsWith(exclude,_0x32ffe0[_0x8831('0x1b')])){members[_0x32ffe0[_0x8831('0x1b')]]={'channel':'voice','interface':_0x32ffe0['device'],'type':_0x8831('0x20'),'enterAt':utils[_0x8831('0x21')](),'role':'agent'};}break;case _0x8831('0x22'):if(!_['isNil'](members[_0x32ffe0['device']])){members[_0x32ffe0[_0x8831('0x1b')]][_0x8831('0x23')]=utils[_0x8831('0x21')]();members[_0x32ffe0['device']][_0x8831('0x24')]=utils[_0x8831('0x25')](members[_0x32ffe0['device']]['exitAt'],members[_0x32ffe0['device']][_0x8831('0x26')]);if(members[_0x32ffe0['device']][_0x8831('0x1c')]){writeDB(members[_0x32ffe0['device']]);}}break;default:break;}}catch(_0x486d2e){utils[_0x8831('0x27')](util[_0x8831('0x15')](_0x8831('0x1a'),members[_0x32ffe0[_0x8831('0x1b')]]?members[_0x32ffe0['device']][_0x8831('0x1c')]:_0x32ffe0['device']),_0x486d2e);}};exports[_0x8831('0x28')]=function(_0x5e20f5){try{if(!_[_0x8831('0x29')](members[_0x5e20f5[_0x8831('0x7')]])){utils['debug'](util['format'](_0x8831('0x2a'),_0x5e20f5[_0x8831('0x1c')]),_0x5e20f5);utils['info'](util[_0x8831('0x15')](_0x8831('0x2b'),_0x5e20f5[_0x8831('0x1c')],_0x5e20f5['interface'],_0x5e20f5[_0x8831('0x2c')]));members[_0x5e20f5[_0x8831('0x7')]]=_[_0x8831('0x2d')](members[_0x5e20f5[_0x8831('0x7')]],{'data4':_0x5e20f5[_0x8831('0x2c')],'uniqueid':_0x5e20f5['uniqueid']});}}catch(_0xf2e2a4){utils[_0x8831('0x27')](util[_0x8831('0x15')](_0x8831('0x2a'),_0x5e20f5[_0x8831('0x1c')]),_0xf2e2a4);}};exports[_0x8831('0x2e')]=function(_0x55d676){try{utils[_0x8831('0x19')](util[_0x8831('0x15')](_0x8831('0x2f'),_0x55d676[_0x8831('0x1c')]),_0x55d676);if(_0x55d676[_0x8831('0x8')]){var _0x51014d=_0x55d676['channel'][_0x8831('0x11')]('-')[0x0];if(!_[_0x8831('0x29')](members[_0x51014d])){members[_0x51014d]=_[_0x8831('0x2d')](members[_0x51014d],{'data1':members[_0x51014d][_0x8831('0x30')]||_0x55d676[_0x8831('0xb')],'data2':members[_0x51014d][_0x8831('0x9')]||_0x55d676[_0x8831('0x31')],'data3':members[_0x51014d]['data3']||_0x55d676[_0x8831('0x32')],'uniqueid':members[_0x51014d][_0x8831('0x1c')]||_0x55d676[_0x8831('0x1c')]});utils[_0x8831('0x5')](util['format'](_0x8831('0x33'),_0x55d676[_0x8831('0x1c')],members[_0x51014d]['data1'],members[_0x51014d]['data2'],members[_0x51014d][_0x8831('0x34')]));if(members[_0x51014d][_0x8831('0x23')]){writeDB(members[_0x51014d]);}}}if(_0x55d676[_0x8831('0x35')]){var _0x3b4b8e=_0x55d676[_0x8831('0x35')][_0x8831('0x11')]('-')[0x0];if(!_[_0x8831('0x29')](members[_0x3b4b8e])){members[_0x3b4b8e]=_[_0x8831('0x2d')](members[_0x3b4b8e],{'data1':members[_0x3b4b8e][_0x8831('0x30')]||_0x55d676['type'],'data2':members[_0x3b4b8e][_0x8831('0x9')]||_0x55d676['source'],'data3':members[_0x3b4b8e][_0x8831('0x34')]||_0x55d676[_0x8831('0x32')],'uniqueid':members[_0x3b4b8e][_0x8831('0x1c')]||_0x55d676[_0x8831('0x1c')]});utils[_0x8831('0x5')](util[_0x8831('0x15')](_0x8831('0x33'),_0x55d676[_0x8831('0x1c')],members[_0x3b4b8e][_0x8831('0x30')],members[_0x3b4b8e][_0x8831('0x9')],members[_0x3b4b8e][_0x8831('0x34')]));if(members[_0x3b4b8e][_0x8831('0x23')]){writeDB(members[_0x3b4b8e]);}}}}catch(_0x526f7a){utils[_0x8831('0x27')](util[_0x8831('0x15')](_0x8831('0x2f'),_0x55d676[_0x8831('0x1c')]),_0x526f7a);}}; \ No newline at end of file +var _0x9b87=['data2','membername','type','name','internal','request','CreateMemberReport','getUserByName','then','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','exitAt','duration','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][cdr]','split','assign','data1','source','data3','destination','destinationchannel','isNil','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x9b87,0x8e));var _0x79b8=function(_0x1154d4,_0x5b94d7){_0x1154d4=_0x1154d4-0x0;var _0x1d328e=_0x9b87[_0x1154d4];return _0x1d328e;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var utils=require(_0x79b8('0x2'));var members={};var exclude=[_0x79b8('0x3'),_0x79b8('0x4')];function writeDB(_0x4386a6){utils[_0x79b8('0x5')](util[_0x79b8('0x6')](_0x79b8('0x7'),_0x4386a6[_0x79b8('0x8')],_0x4386a6[_0x79b8('0x9')],_0x4386a6[_0x79b8('0xa')],_0x4386a6[_0x79b8('0xb')],_0x4386a6[_0x79b8('0xc')],_0x4386a6[_0x79b8('0xd')]));if(_0x4386a6[_0x79b8('0x9')]){utils['getUserByInterface'](_0x4386a6['interface'])['then'](function(_0x4c058b){if(_0x4c058b){_0x4386a6[_0x79b8('0xc')]=_0x4c058b[_0x79b8('0xe')];_0x4386a6[_0x79b8('0xf')]=_0x4c058b['internal'];utils[_0x79b8('0x10')](_0x79b8('0x11'),_0x4386a6);}else{utils[_0x79b8('0x12')](_0x4386a6['interface']['split']('/')[0x1])[_0x79b8('0x13')](function(_0x476e35){if(_0x476e35){_0x4386a6[_0x79b8('0xc')]=_0x476e35[_0x79b8('0xe')];_0x4386a6[_0x79b8('0xf')]=_0x476e35[_0x79b8('0xf')];utils[_0x79b8('0x10')](_0x79b8('0x11'),_0x4386a6);}});}})[_0x79b8('0x14')](function(_0x1614fe){utils[_0x79b8('0x15')](util['format'](_0x79b8('0x16'),_0x4386a6['uniqueid']),_0x1614fe);});}delete members[_0x4386a6['interface']];}function startsWith(_0x3142e9,_0x21aae0){return _[_0x79b8('0x17')](_0x3142e9,function(_0x5ddab5){return _[_0x79b8('0x18')](_0x21aae0,_0x5ddab5);});}exports['devicestatechange']=function(_0x5ef869){try{utils[_0x79b8('0x19')](util[_0x79b8('0x6')](_0x79b8('0x1a'),members[_0x5ef869[_0x79b8('0x1b')]]?members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x8')]:_0x5ef869['device']),_0x5ef869);utils[_0x79b8('0x5')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x5ef869[_0x79b8('0x1b')]]?members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x8')]:_0x5ef869[_0x79b8('0x1b')],_0x5ef869[_0x79b8('0x1c')],_0x5ef869[_0x79b8('0x1b')]));switch(_0x5ef869[_0x79b8('0x1c')]){case _0x79b8('0x1d'):case _0x79b8('0x1e'):if(!startsWith(exclude,_0x5ef869['device'])){members[_0x5ef869[_0x79b8('0x1b')]]={'channel':_0x79b8('0x1f'),'interface':_0x5ef869['device'],'type':_0x79b8('0x20'),'enterAt':utils[_0x79b8('0x21')](),'role':'agent'};}break;case _0x79b8('0x22'):if(!_['isNil'](members[_0x5ef869['device']])){members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x23')]=utils[_0x79b8('0x21')]();members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x24')]=utils['diffTime'](members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x23')],members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x25')]);if(members[_0x5ef869['device']][_0x79b8('0x8')]){writeDB(members[_0x5ef869[_0x79b8('0x1b')]]);}}break;default:break;}}catch(_0x14a4d6){utils['error'](util[_0x79b8('0x6')](_0x79b8('0x1a'),members[_0x5ef869[_0x79b8('0x1b')]]?members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x8')]:_0x5ef869[_0x79b8('0x1b')]),_0x14a4d6);}};exports['agentcomplete']=function(_0x434ecd){try{if(!_['isNil'](members[_0x434ecd[_0x79b8('0x9')]])){utils['debug'](util[_0x79b8('0x6')](_0x79b8('0x26'),_0x434ecd[_0x79b8('0x8')]),_0x434ecd);utils['info'](util[_0x79b8('0x6')](_0x79b8('0x27'),_0x434ecd[_0x79b8('0x8')],_0x434ecd[_0x79b8('0x9')],_0x434ecd['queue']));members[_0x434ecd[_0x79b8('0x9')]]=_['assign'](members[_0x434ecd['interface']],{'data4':_0x434ecd[_0x79b8('0x28')],'uniqueid':_0x434ecd[_0x79b8('0x8')]});}}catch(_0x4a038b){utils[_0x79b8('0x15')](util['format']('[%s][members][agentcomplete]',_0x434ecd[_0x79b8('0x8')]),_0x4a038b);}};exports['cdr']=function(_0x1ad785){try{utils[_0x79b8('0x19')](util['format'](_0x79b8('0x29'),_0x1ad785[_0x79b8('0x8')]),_0x1ad785);if(_0x1ad785[_0x79b8('0xa')]){var _0x1e5bd9=_0x1ad785[_0x79b8('0xa')][_0x79b8('0x2a')]('-')[0x0];if(!_['isNil'](members[_0x1e5bd9])){members[_0x1e5bd9]=_[_0x79b8('0x2b')](members[_0x1e5bd9],{'data1':members[_0x1e5bd9][_0x79b8('0x2c')]||_0x1ad785[_0x79b8('0xd')],'data2':members[_0x1e5bd9][_0x79b8('0xb')]||_0x1ad785[_0x79b8('0x2d')],'data3':members[_0x1e5bd9][_0x79b8('0x2e')]||_0x1ad785[_0x79b8('0x2f')],'uniqueid':members[_0x1e5bd9][_0x79b8('0x8')]||_0x1ad785[_0x79b8('0x8')]});utils[_0x79b8('0x5')](util[_0x79b8('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1ad785[_0x79b8('0x8')],members[_0x1e5bd9][_0x79b8('0x2c')],members[_0x1e5bd9][_0x79b8('0xb')],members[_0x1e5bd9]['data3']));if(members[_0x1e5bd9][_0x79b8('0x23')]){writeDB(members[_0x1e5bd9]);}}}if(_0x1ad785[_0x79b8('0x30')]){var _0x2252b8=_0x1ad785[_0x79b8('0x30')][_0x79b8('0x2a')]('-')[0x0];if(!_[_0x79b8('0x31')](members[_0x2252b8])){members[_0x2252b8]=_['assign'](members[_0x2252b8],{'data1':members[_0x2252b8][_0x79b8('0x2c')]||_0x1ad785['type'],'data2':members[_0x2252b8]['data2']||_0x1ad785[_0x79b8('0x2d')],'data3':members[_0x2252b8]['data3']||_0x1ad785['destination'],'uniqueid':members[_0x2252b8][_0x79b8('0x8')]||_0x1ad785[_0x79b8('0x8')]});utils[_0x79b8('0x5')](util[_0x79b8('0x6')](_0x79b8('0x32'),_0x1ad785[_0x79b8('0x8')],members[_0x2252b8][_0x79b8('0x2c')],members[_0x2252b8][_0x79b8('0xb')],members[_0x2252b8][_0x79b8('0x2e')]));if(members[_0x2252b8][_0x79b8('0x23')]){writeDB(members[_0x2252b8]);}}}}catch(_0x10f8e1){utils[_0x79b8('0x15')](util[_0x79b8('0x6')]('[%s][members][cdr]',_0x1ad785[_0x79b8('0x8')]),_0x10f8e1);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 00f73c0..c2774b6 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 _0xe4b8=['[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][queuecallerabandon]','queuecallerabandonAt','queuecallerleave','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','assigned','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0xe4b8,0x1a4));var _0x8e4b=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xe4b8[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x8e4b('0x0'));var util=require(_0x8e4b('0x1'));var utils=require(_0x8e4b('0x2'));var queues={};function writeDB(_0x519587){utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x4'),_0x519587['uniqueid'],_0x519587[_0x8e4b('0x5')],_0x519587[_0x8e4b('0x6')],_0x519587['lastAssignedTo'],_0x519587[_0x8e4b('0x7')],_0x519587[_0x8e4b('0x8')],_0x519587[_0x8e4b('0x9')]));if(_0x519587[_0x8e4b('0x6')]){utils[_0x8e4b('0xa')](_0x519587[_0x8e4b('0x6')])['then'](function(_0x2aa141){if(_0x2aa141){_0x519587[_0x8e4b('0xb')]=_0x2aa141['type'];}utils['request'](_0x8e4b('0xc'),_0x519587);});}else{utils[_0x8e4b('0xd')](_0x8e4b('0xc'),_0x519587);}if(_0x519587[_0x8e4b('0xe')]){delete queues[_0x519587[_0x8e4b('0xe')]];}else{delete queues[_0x519587[_0x8e4b('0xf')]];}}exports[_0x8e4b('0x10')]=function(_0x5be5a8){try{utils['debug'](util[_0x8e4b('0x11')](_0x8e4b('0x12'),_0x5be5a8[_0x8e4b('0xf')]),_0x5be5a8);utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x13'),_0x5be5a8[_0x8e4b('0xf')],_0x5be5a8[_0x8e4b('0x6')],_0x5be5a8['position']));queues[_0x5be5a8[_0x8e4b('0xf')]]=_[_0x8e4b('0x14')](_0x5be5a8,{'originalposition':_0x5be5a8[_0x8e4b('0x15')],'queuecallerjoinAt':utils[_0x8e4b('0x16')](),'mohtime':0x0});}catch(_0x27b098){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')](_0x8e4b('0x12'),_0x5be5a8[_0x8e4b('0xf')]),_0x27b098);}};exports[_0x8e4b('0x18')]=function(_0x1fc169){try{if(!_[_0x8e4b('0x19')](queues[_0x1fc169['uniqueid']])){utils[_0x8e4b('0x1a')](util['format'](_0x8e4b('0x1b'),_0x1fc169[_0x8e4b('0xf')]),_0x1fc169);if(queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x1c')]){if(!queues[_0x1fc169[_0x8e4b('0xf')]]['queuecallerabandon']&&!queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x1d')]){queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x1e')]=!![];queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x1f')]=utils[_0x8e4b('0x16')]();queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x9')]=_0x8e4b('0x20');}utils['info'](util[_0x8e4b('0x11')](_0x8e4b('0x21'),_0x1fc169[_0x8e4b('0xf')],queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x22')],queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0x9')]));writeDB(queues[_0x1fc169['uniqueid']]);}else if(queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0xe')]){utils['info'](util[_0x8e4b('0x11')](_0x8e4b('0x23'),_0x1fc169[_0x8e4b('0xf')],queues[_0x1fc169[_0x8e4b('0xf')]]['name'],queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0xe')]));queues[queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0xe')]]=queues[_0x1fc169[_0x8e4b('0xf')]];queues[queues[_0x1fc169[_0x8e4b('0xf')]][_0x8e4b('0xe')]][_0x8e4b('0x24')]=0x2;delete queues[_0x1fc169['uniqueid']];}}}catch(_0x31deef){utils['error'](util[_0x8e4b('0x11')](_0x8e4b('0x1b'),_0x1fc169[_0x8e4b('0xf')]),_0x31deef);}};exports[_0x8e4b('0x25')]=function(_0x237c8d){try{utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')](_0x8e4b('0x26'),_0x237c8d[_0x8e4b('0xf')]),_0x237c8d);if(!_[_0x8e4b('0x19')](_0x237c8d['variable'][_0x8e4b('0x27')])&&_0x237c8d['value'][_0x8e4b('0x28')]()!==_0x8e4b('0x29')){if(!_[_0x8e4b('0x19')](queues[_0x237c8d['uniqueid']])){queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x2a')]=![];queues[_0x237c8d[_0x8e4b('0xf')]]['queuecallerabandonAt']=null;queues[_0x237c8d[_0x8e4b('0xf')]]['queuecallerexit']=!![];queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x2b')]=utils[_0x8e4b('0x16')]();queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x9')]=_0x237c8d[_0x8e4b('0x2c')][_0x8e4b('0x28')]();utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')](_0x8e4b('0x2d'),_0x237c8d[_0x8e4b('0xf')],queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x22')],_0x237c8d['value'],queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x9')]));writeDB(queues[_0x237c8d[_0x8e4b('0xf')]]);}}else if(!_[_0x8e4b('0x19')](_0x237c8d[_0x8e4b('0x2e')][_0x8e4b('0x2f')])){if(!_[_0x8e4b('0x19')](queues[_0x237c8d['uniqueid']])&&!queues[_0x237c8d[_0x8e4b('0xf')]]['queuecallerabandon']){queues[_0x237c8d[_0x8e4b('0xf')]]['queuecallerabandon']=![];queues[_0x237c8d['uniqueid']]['queuecallerabandonAt']=null;queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x1d')]=!![];queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x2b')]=utils[_0x8e4b('0x16')]();queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x9')]='EXITWITHKEY';utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x237c8d[_0x8e4b('0xf')],queues[_0x237c8d['uniqueid']]['name'],_0x237c8d[_0x8e4b('0x2c')],queues[_0x237c8d[_0x8e4b('0xf')]][_0x8e4b('0x9')]));}}}catch(_0x382c16){utils[_0x8e4b('0x17')](util['format'](_0x8e4b('0x26'),_0x237c8d[_0x8e4b('0xf')]),_0x382c16);}};exports[_0x8e4b('0x2a')]=function(_0x9e160b){try{if(!_[_0x8e4b('0x19')](queues[_0x9e160b[_0x8e4b('0xf')]])){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')](_0x8e4b('0x30'),_0x9e160b['uniqueid']),_0x9e160b);queues[_0x9e160b[_0x8e4b('0xf')]]['queuecallerexit']=![];queues[_0x9e160b['uniqueid']][_0x8e4b('0x2b')]=null;queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x2a')]=!![];queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x31')]=utils[_0x8e4b('0x16')]();queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x9')]='ABANDONED';utils[_0x8e4b('0x3')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x9e160b[_0x8e4b('0xf')],queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x22')],queues[_0x9e160b[_0x8e4b('0xf')]][_0x8e4b('0x9')]));}}catch(_0x39ba9d){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')]('[%s][queues][queuecallerabandon]',_0x9e160b[_0x8e4b('0xf')]),_0x39ba9d);}};exports[_0x8e4b('0x32')]=function(_0x5231b4){try{if(!_['isNil'](queues[_0x5231b4['uniqueid']])){utils['debug'](util[_0x8e4b('0x11')]('[%s][queues][queuecallerleave]',_0x5231b4[_0x8e4b('0xf')]),_0x5231b4);utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5231b4[_0x8e4b('0xf')],queues[_0x5231b4['uniqueid']]['name'],_0x5231b4[_0x8e4b('0x33')],_0x5231b4[_0x8e4b('0x34')]));queues[_0x5231b4['uniqueid']][_0x8e4b('0x32')]=!![];queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x1c')]=utils[_0x8e4b('0x16')]();queues[_0x5231b4['uniqueid']][_0x8e4b('0x35')]=utils[_0x8e4b('0x36')](queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x1c')],queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x37')]);queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x15')]=_0x5231b4[_0x8e4b('0x15')];queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x38')]=_0x5231b4[_0x8e4b('0x38')];queues[_0x5231b4[_0x8e4b('0xf')]][_0x8e4b('0x33')]=_0x5231b4[_0x8e4b('0x33')];queues[_0x5231b4['uniqueid']][_0x8e4b('0x34')]=_0x5231b4[_0x8e4b('0x34')];}}catch(_0x43f1a2){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')](_0x8e4b('0x39'),_0x5231b4[_0x8e4b('0xf')]),_0x43f1a2);}};exports[_0x8e4b('0x3a')]=function(_0x1e2a00){try{if(!_[_0x8e4b('0x19')](queues[_0x1e2a00['uniqueid']])){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')]('[%s][queues][agentconnect]',_0x1e2a00[_0x8e4b('0xf')]),_0x1e2a00);utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x3b'),_0x1e2a00[_0x8e4b('0xf')],queues[_0x1e2a00[_0x8e4b('0xf')]][_0x8e4b('0x22')],_0x1e2a00[_0x8e4b('0x3c')],_0x1e2a00[_0x8e4b('0x3d')]));queues[_0x1e2a00[_0x8e4b('0xf')]]['queuecallerabandon']=![];queues[_0x1e2a00[_0x8e4b('0xf')]]['queuecallerabandon']=![];queues[_0x1e2a00['uniqueid']][_0x8e4b('0x31')]=null;queues[_0x1e2a00[_0x8e4b('0xf')]][_0x8e4b('0x1d')]=![];queues[_0x1e2a00['uniqueid']][_0x8e4b('0x9')]=null;queues[_0x1e2a00[_0x8e4b('0xf')]][_0x8e4b('0x2b')]=null;queues[_0x1e2a00[_0x8e4b('0xf')]]['assigned']=!![];queues[_0x1e2a00[_0x8e4b('0xf')]]['accountcode']=_0x1e2a00['destaccountcode'];queues[_0x1e2a00[_0x8e4b('0xf')]][_0x8e4b('0x3e')]=_0x1e2a00[_0x8e4b('0x3c')];}}catch(_0x2bc6c8){utils['error'](util[_0x8e4b('0x11')]('[%s][queues][agentconnect]',_0x1e2a00[_0x8e4b('0xf')]),_0x2bc6c8);}};exports[_0x8e4b('0x3f')]=function(_0x4e1595){try{if(!_[_0x8e4b('0x19')](queues[_0x4e1595[_0x8e4b('0xf')]])){if(queues[_0x4e1595['uniqueid']]['queuecallerleaveAt']){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')]('[%s][queues][agentcomplete]',_0x4e1595[_0x8e4b('0xf')]),_0x4e1595);queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x2a')]=![];queues[_0x4e1595[_0x8e4b('0xf')]]['queuecallerabandon']=![];queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x31')]=null;queues[_0x4e1595[_0x8e4b('0xf')]]['queuecallerexit']=![];queues[_0x4e1595['uniqueid']][_0x8e4b('0x2b')]=null;queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x40')]=!![];queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x3e')]=_0x4e1595[_0x8e4b('0x3c')];queues[_0x4e1595[_0x8e4b('0xf')]]['queuecallercomplete']=!![];queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x1f')]=utils['now']();if(_0x4e1595[_0x8e4b('0x41')]==_0x8e4b('0x42')){if(!queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x42')]){queues[_0x4e1595[_0x8e4b('0xf')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x4e1595['uniqueid']][_0x8e4b('0x9')]=_0x8e4b('0x43')+_0x4e1595[_0x8e4b('0x41')]['toUpperCase']();}utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')](_0x8e4b('0x44'),_0x4e1595[_0x8e4b('0xf')],queues[_0x4e1595['uniqueid']][_0x8e4b('0x22')],_0x4e1595['membername'],queues[_0x4e1595[_0x8e4b('0xf')]][_0x8e4b('0x9')]));writeDB(queues[_0x4e1595['uniqueid']]);}}}catch(_0x290c88){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')]('[%s][queues][agentcomplete]',_0x4e1595['uniqueid']),_0x290c88);}};exports[_0x8e4b('0x45')]=function(_0x23e771){try{if(!_[_0x8e4b('0x19')](queues[_0x23e771[_0x8e4b('0x46')]])){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')](_0x8e4b('0x47'),_0x23e771[_0x8e4b('0xf')]),_0x23e771);queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x42')]=!![];queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x48')]=_0x8e4b('0x49');queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x4a')]=_0x23e771[_0x8e4b('0x4b')];queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x4c')]=_0x23e771[_0x8e4b('0x46')];queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x9')]=_0x8e4b('0x4d');utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x4e'),_0x23e771[_0x8e4b('0xf')],queues[_0x23e771[_0x8e4b('0x46')]][_0x8e4b('0x22')],_0x23e771['transfereeuniqueid'],_0x23e771[_0x8e4b('0x4b')]));}}catch(_0x562570){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')]('[%s][queues][blindtransfer]',_0x23e771['uniqueid']),_0x562570);}};exports[_0x8e4b('0x4f')]=function(_0x40f540){try{utils['debug'](util[_0x8e4b('0x11')]('[%s][queues][attendedtransfer]',_0x40f540[_0x8e4b('0x50')]),_0x40f540);if(_0x40f540[_0x8e4b('0x50')]==_0x40f540[_0x8e4b('0x51')]){if(!_[_0x8e4b('0x19')](queues[_0x40f540[_0x8e4b('0x52')]])){utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x52')]][_0x8e4b('0x22')],_0x40f540['origtransfererexten']));queues[_0x40f540[_0x8e4b('0x52')]][_0x8e4b('0x42')]=!![];queues[_0x40f540['secondtransfererlinkedid']][_0x8e4b('0x48')]=_0x8e4b('0x53');queues[_0x40f540[_0x8e4b('0x52')]][_0x8e4b('0x4a')]=_0x40f540[_0x8e4b('0x54')];queues[_0x40f540[_0x8e4b('0x52')]]['transferuniqueid']=_0x40f540[_0x8e4b('0x50')];queues[_0x40f540['secondtransfererlinkedid']][_0x8e4b('0x9')]=_0x8e4b('0x55');}if(!_['isNil'](queues[_0x40f540[_0x8e4b('0x51')]])){if(_0x40f540['transfereelinkedid']&&queues[_0x40f540[_0x8e4b('0x56')]]){queues[_0x40f540[_0x8e4b('0x56')]]['queuecallerenterreason']=0x1;queues[_0x40f540[_0x8e4b('0x46')]]=_[_0x8e4b('0x57')](queues[_0x40f540[_0x8e4b('0x56')]]);queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0xe')]=_0x40f540[_0x8e4b('0x58')];queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x24')]=0x2;queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x7')]=queues[_0x40f540[_0x8e4b('0x52')]][_0x8e4b('0x7')];queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x59')]=queues[_0x40f540[_0x8e4b('0x52')]]['calleridname'];queues[_0x40f540[_0x8e4b('0x46')]]['queuecallerjoinAt']=utils[_0x8e4b('0x16')]();queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x1c')]=utils[_0x8e4b('0x16')]();queues[_0x40f540[_0x8e4b('0x46')]]['holdtime']=0x0;queues[_0x40f540['transfereeuniqueid']][_0x8e4b('0x5a')]=0x0;utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x22')],queues[_0x40f540[_0x8e4b('0x46')]][_0x8e4b('0x7')],queues[_0x40f540[_0x8e4b('0x46')]]['calleridname']));}else{utils['info'](util[_0x8e4b('0x11')](_0x8e4b('0x5b'),_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x22')],_0x40f540[_0x8e4b('0x52')]));queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0xe')]=_0x40f540[_0x8e4b('0x52')];}}}else if(_0x40f540[_0x8e4b('0x5c')]==_0x40f540[_0x8e4b('0x52')]){if(!_[_0x8e4b('0x19')](queues[_0x40f540['origtransfererlinkedid']])){utils[_0x8e4b('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x22')],_0x40f540[_0x8e4b('0x5c')],_0x40f540[_0x8e4b('0x5d')]));queues[_0x40f540[_0x8e4b('0x51')]]['transfer']=!![];queues[_0x40f540['origtransfererlinkedid']][_0x8e4b('0x48')]=_0x8e4b('0x53');queues[_0x40f540['origtransfererlinkedid']]['transferexten']=_0x40f540['secondtransfererexten'];queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x4c')]=_0x40f540[_0x8e4b('0x5c')];queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x9')]=_0x8e4b('0x55');}if(!_[_0x8e4b('0x19')](queues[_0x40f540['secondtransfererlinkedid']])){if(_0x40f540[_0x8e4b('0x5e')]&&queues[_0x40f540['transfertargetlinkedid']]){queues[_0x40f540[_0x8e4b('0x5e')]][_0x8e4b('0x24')]=0x1;queues[_0x40f540['transfertargetuniqueid']]=_[_0x8e4b('0x57')](queues[_0x40f540[_0x8e4b('0x5e')]]);queues[_0x40f540[_0x8e4b('0x58')]]['transfereduniqueid']=_0x40f540[_0x8e4b('0x58')];queues[_0x40f540[_0x8e4b('0x58')]]['queuecallerenterreason']=0x2;queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x7')]=queues[_0x40f540[_0x8e4b('0x51')]][_0x8e4b('0x7')];queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x59')]=queues[_0x40f540['origtransfererlinkedid']][_0x8e4b('0x59')];queues[_0x40f540[_0x8e4b('0x58')]]['queuecallerjoinAt']=utils['now']();queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x1c')]=utils[_0x8e4b('0x16')]();queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x35')]=0x0;queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x5a')]=0x0;utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x40f540[_0x8e4b('0x50')],queues[_0x40f540['transfertargetuniqueid']][_0x8e4b('0x22')],queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0xe')],queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x7')],queues[_0x40f540[_0x8e4b('0x58')]][_0x8e4b('0x59')]));}else{utils['info'](util['format'](_0x8e4b('0x5b'),_0x40f540[_0x8e4b('0x50')],queues[_0x40f540[_0x8e4b('0x52')]]['name'],_0x40f540[_0x8e4b('0x51')]));queues[_0x40f540[_0x8e4b('0x52')]]['transfereduniqueid']=_0x40f540['origtransfererlinkedid'];}}}}catch(_0x565227){utils['error'](util[_0x8e4b('0x11')](_0x8e4b('0x5f'),_0x40f540[_0x8e4b('0x50')]),_0x565227);}};exports[_0x8e4b('0x60')]=function(_0x10c0c4){try{if(!_[_0x8e4b('0x19')](queues[_0x10c0c4['uniqueid']])){utils['debug'](util[_0x8e4b('0x11')](_0x8e4b('0x61'),_0x10c0c4[_0x8e4b('0xf')]),_0x10c0c4);queues[_0x10c0c4[_0x8e4b('0xf')]]['musiconholdstartAt']=utils[_0x8e4b('0x16')]();utils[_0x8e4b('0x3')](util['format'](_0x8e4b('0x62'),_0x10c0c4['uniqueid'],queues[_0x10c0c4[_0x8e4b('0xf')]][_0x8e4b('0x22')],queues[_0x10c0c4[_0x8e4b('0xf')]]['musiconholdstartAt']));}}catch(_0x30fbf0){utils[_0x8e4b('0x17')](util[_0x8e4b('0x11')](_0x8e4b('0x61'),_0x10c0c4[_0x8e4b('0xf')]),_0x30fbf0);}};exports[_0x8e4b('0x63')]=function(_0x5885de){try{if(!_[_0x8e4b('0x19')](queues[_0x5885de[_0x8e4b('0xf')]])){if(!_[_0x8e4b('0x19')](queues[_0x5885de[_0x8e4b('0xf')]][_0x8e4b('0x64')])){utils[_0x8e4b('0x1a')](util[_0x8e4b('0x11')](_0x8e4b('0x65'),_0x5885de[_0x8e4b('0xf')]),_0x5885de);queues[_0x5885de[_0x8e4b('0xf')]][_0x8e4b('0x5a')]+=utils['diffTime'](utils[_0x8e4b('0x16')](),queues[_0x5885de[_0x8e4b('0xf')]][_0x8e4b('0x64')]);utils[_0x8e4b('0x3')](util[_0x8e4b('0x11')](_0x8e4b('0x66'),_0x5885de['uniqueid'],queues[_0x5885de[_0x8e4b('0xf')]][_0x8e4b('0x22')],queues[_0x5885de['uniqueid']][_0x8e4b('0x5a')]));delete queues[_0x5885de['uniqueid']]['musiconholdstartAt'];}}}catch(_0x29b4d8){utils['error'](util['format'](_0x8e4b('0x65'),_0x5885de[_0x8e4b('0xf')]),_0x29b4d8);}}; \ No newline at end of file +var _0xcb93=['origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','now','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xcb93,0x1a6));var _0x3cb9=function(_0x3807de,_0x53e08d){_0x3807de=_0x3807de-0x0;var _0x6fbce=_0xcb93[_0x3807de];return _0x6fbce;};'use strict';var _=require(_0x3cb9('0x0'));var util=require('util');var utils=require(_0x3cb9('0x1'));var queues={};function writeDB(_0xd6cab5){utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x4'),_0xd6cab5[_0x3cb9('0x5')],_0xd6cab5['channel'],_0xd6cab5[_0x3cb9('0x6')],_0xd6cab5[_0x3cb9('0x7')],_0xd6cab5[_0x3cb9('0x8')],_0xd6cab5[_0x3cb9('0x9')],_0xd6cab5[_0x3cb9('0xa')]));if(_0xd6cab5[_0x3cb9('0x6')]){utils[_0x3cb9('0xb')](_0xd6cab5[_0x3cb9('0x6')])[_0x3cb9('0xc')](function(_0x52f95e){if(_0x52f95e){_0xd6cab5[_0x3cb9('0xd')]=_0x52f95e[_0x3cb9('0xd')];}utils[_0x3cb9('0xe')](_0x3cb9('0xf'),_0xd6cab5);});}else{utils['request'](_0x3cb9('0xf'),_0xd6cab5);}if(_0xd6cab5['transfereduniqueid']){delete queues[_0xd6cab5[_0x3cb9('0x10')]];}else{delete queues[_0xd6cab5[_0x3cb9('0x5')]];}}exports[_0x3cb9('0x11')]=function(_0x1ce6aa){try{utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x13'),_0x1ce6aa[_0x3cb9('0x5')]),_0x1ce6aa);utils['info'](util[_0x3cb9('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1ce6aa['uniqueid'],_0x1ce6aa['queue'],_0x1ce6aa[_0x3cb9('0x14')]));queues[_0x1ce6aa[_0x3cb9('0x5')]]=_['assign'](_0x1ce6aa,{'originalposition':_0x1ce6aa[_0x3cb9('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4438d8){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x13'),_0x1ce6aa[_0x3cb9('0x5')]),_0x4438d8);}};exports[_0x3cb9('0x16')]=function(_0x28feaa){try{if(!_['isNil'](queues[_0x28feaa[_0x3cb9('0x5')]])){utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x17'),_0x28feaa[_0x3cb9('0x5')]),_0x28feaa);if(queues[_0x28feaa['uniqueid']][_0x3cb9('0x18')]){if(!queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x19')]&&!queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x1a')]){queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x1b')]=!![];queues[_0x28feaa[_0x3cb9('0x5')]]['queuecallercompleteAt']=utils['now']();queues[_0x28feaa[_0x3cb9('0x5')]]['queuecallerexitreason']=_0x3cb9('0x1c');}utils['info'](util[_0x3cb9('0x3')](_0x3cb9('0x1d'),_0x28feaa[_0x3cb9('0x5')],queues[_0x28feaa[_0x3cb9('0x5')]]['name'],queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0xa')]));writeDB(queues[_0x28feaa['uniqueid']]);}else if(queues[_0x28feaa['uniqueid']]['transfereduniqueid']){utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x1e'),_0x28feaa[_0x3cb9('0x5')],queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x1f')],queues[_0x28feaa[_0x3cb9('0x5')]]['transfereduniqueid']));queues[queues[_0x28feaa['uniqueid']][_0x3cb9('0x10')]]=queues[_0x28feaa[_0x3cb9('0x5')]];queues[queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x10')]][_0x3cb9('0x20')]=0x2;delete queues[_0x28feaa[_0x3cb9('0x5')]];}}}catch(_0x19cdf6){utils['error'](util['format'](_0x3cb9('0x17'),_0x28feaa[_0x3cb9('0x5')]),_0x19cdf6);}};exports[_0x3cb9('0x21')]=function(_0x46eee1){try{utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x22'),_0x46eee1[_0x3cb9('0x5')]),_0x46eee1);if(!_[_0x3cb9('0x23')](_0x46eee1[_0x3cb9('0x24')][_0x3cb9('0x25')])&&_0x46eee1['value'][_0x3cb9('0x26')]()!=='CONTINUE'){if(!_[_0x3cb9('0x23')](queues[_0x46eee1[_0x3cb9('0x5')]])){queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x19')]=![];queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x27')]=null;queues[_0x46eee1['uniqueid']]['queuecallerexit']=!![];queues[_0x46eee1['uniqueid']][_0x3cb9('0x28')]=utils['now']();queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0xa')]=_0x46eee1[_0x3cb9('0x29')][_0x3cb9('0x26')]();utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x2a'),_0x46eee1[_0x3cb9('0x5')],queues[_0x46eee1[_0x3cb9('0x5')]]['name'],_0x46eee1['value'],queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0xa')]));writeDB(queues[_0x46eee1['uniqueid']]);}}else if(!_[_0x3cb9('0x23')](_0x46eee1[_0x3cb9('0x24')][_0x3cb9('0x2b')])){if(!_[_0x3cb9('0x23')](queues[_0x46eee1[_0x3cb9('0x5')]])&&!queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x19')]){queues[_0x46eee1['uniqueid']]['queuecallerabandon']=![];queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x27')]=null;queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x1a')]=!![];queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x28')]=utils[_0x3cb9('0x2c')]();queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0xa')]=_0x3cb9('0x2d');utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x2e'),_0x46eee1[_0x3cb9('0x5')],queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x1f')],_0x46eee1[_0x3cb9('0x29')],queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0xa')]));}}}catch(_0x27f8a8){utils[_0x3cb9('0x15')](util['format'](_0x3cb9('0x22'),_0x46eee1[_0x3cb9('0x5')]),_0x27f8a8);}};exports['queuecallerabandon']=function(_0x1266b5){try{if(!_[_0x3cb9('0x23')](queues[_0x1266b5[_0x3cb9('0x5')]])){utils[_0x3cb9('0x12')](util['format'](_0x3cb9('0x2f'),_0x1266b5[_0x3cb9('0x5')]),_0x1266b5);queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x1a')]=![];queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x28')]=null;queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x19')]=!![];queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x27')]=utils['now']();queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0xa')]=_0x3cb9('0x30');utils['info'](util[_0x3cb9('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1266b5[_0x3cb9('0x5')],queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x1f')],queues[_0x1266b5['uniqueid']][_0x3cb9('0xa')]));}}catch(_0x5979c3){utils[_0x3cb9('0x15')](util['format']('[%s][queues][queuecallerabandon]',_0x1266b5[_0x3cb9('0x5')]),_0x5979c3);}};exports[_0x3cb9('0x31')]=function(_0x134cd7){try{if(!_[_0x3cb9('0x23')](queues[_0x134cd7[_0x3cb9('0x5')]])){utils['debug'](util['format']('[%s][queues][queuecallerleave]',_0x134cd7['uniqueid']),_0x134cd7);utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x32'),_0x134cd7[_0x3cb9('0x5')],queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x1f')],_0x134cd7['connectedlinenum'],_0x134cd7[_0x3cb9('0x33')]));queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x31')]=!![];queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x18')]=utils[_0x3cb9('0x2c')]();queues[_0x134cd7['uniqueid']][_0x3cb9('0x34')]=utils[_0x3cb9('0x35')](queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x18')],queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x36')]);queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x14')]=_0x134cd7[_0x3cb9('0x14')];queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x37')]=_0x134cd7[_0x3cb9('0x37')];queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x38')]=_0x134cd7[_0x3cb9('0x38')];queues[_0x134cd7['uniqueid']]['connectedlinename']=_0x134cd7[_0x3cb9('0x33')];}}catch(_0x3878ee){utils[_0x3cb9('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x134cd7[_0x3cb9('0x5')]),_0x3878ee);}};exports[_0x3cb9('0x39')]=function(_0x5b63b8){try{if(!_[_0x3cb9('0x23')](queues[_0x5b63b8[_0x3cb9('0x5')]])){utils[_0x3cb9('0x12')](util['format'](_0x3cb9('0x3a'),_0x5b63b8[_0x3cb9('0x5')]),_0x5b63b8);utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5b63b8['uniqueid'],queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0x1f')],_0x5b63b8[_0x3cb9('0x3b')],_0x5b63b8[_0x3cb9('0x3c')]));queues[_0x5b63b8[_0x3cb9('0x5')]]['queuecallerabandon']=![];queues[_0x5b63b8['uniqueid']]['queuecallerabandon']=![];queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0x27')]=null;queues[_0x5b63b8[_0x3cb9('0x5')]]['queuecallerexit']=![];queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0xa')]=null;queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0x28')]=null;queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0x3d')]=!![];queues[_0x5b63b8['uniqueid']][_0x3cb9('0x9')]=_0x5b63b8[_0x3cb9('0x3c')];queues[_0x5b63b8[_0x3cb9('0x5')]]['lastAssignedTo']=_0x5b63b8[_0x3cb9('0x3b')];}}catch(_0xdadb8a){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x3a'),_0x5b63b8[_0x3cb9('0x5')]),_0xdadb8a);}};exports['agentcomplete']=function(_0x11cfdd){try{if(!_[_0x3cb9('0x23')](queues[_0x11cfdd[_0x3cb9('0x5')]])){if(queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x18')]){utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x3e'),_0x11cfdd[_0x3cb9('0x5')]),_0x11cfdd);queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x19')]=![];queues[_0x11cfdd['uniqueid']][_0x3cb9('0x19')]=![];queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x27')]=null;queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x1a')]=![];queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x28')]=null;queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x3d')]=!![];queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x7')]=_0x11cfdd[_0x3cb9('0x3b')];queues[_0x11cfdd[_0x3cb9('0x5')]]['queuecallercomplete']=!![];queues[_0x11cfdd[_0x3cb9('0x5')]]['queuecallercompleteAt']=utils['now']();if(_0x11cfdd[_0x3cb9('0x3f')]==_0x3cb9('0x40')){if(!queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x40')]){queues[_0x11cfdd['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0xa')]='COMPLETEDBY'+_0x11cfdd[_0x3cb9('0x3f')][_0x3cb9('0x26')]();}utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x41'),_0x11cfdd[_0x3cb9('0x5')],queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x1f')],_0x11cfdd['membername'],queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0xa')]));writeDB(queues[_0x11cfdd[_0x3cb9('0x5')]]);}}}catch(_0x241adb){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x3e'),_0x11cfdd[_0x3cb9('0x5')]),_0x241adb);}};exports[_0x3cb9('0x42')]=function(_0x4a0eb0){try{if(!_[_0x3cb9('0x23')](queues[_0x4a0eb0[_0x3cb9('0x43')]])){utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x44'),_0x4a0eb0['uniqueid']),_0x4a0eb0);queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0x40')]=!![];queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0x45')]=_0x3cb9('0x46');queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0x47')]=_0x4a0eb0[_0x3cb9('0x48')];queues[_0x4a0eb0[_0x3cb9('0x43')]]['transferuniqueid']=_0x4a0eb0[_0x3cb9('0x43')];queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0xa')]='BLINDTRANSFER';utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x49'),_0x4a0eb0[_0x3cb9('0x5')],queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0x1f')],_0x4a0eb0[_0x3cb9('0x43')],_0x4a0eb0['extension']));}}catch(_0x3391ad){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x44'),_0x4a0eb0[_0x3cb9('0x5')]),_0x3391ad);}};exports[_0x3cb9('0x4a')]=function(_0x2c52d7){try{utils[_0x3cb9('0x12')](util['format'](_0x3cb9('0x4b'),_0x2c52d7[_0x3cb9('0x4c')]),_0x2c52d7);if(_0x2c52d7[_0x3cb9('0x4c')]==_0x2c52d7['origtransfererlinkedid']){if(!_[_0x3cb9('0x23')](queues[_0x2c52d7['secondtransfererlinkedid']])){utils['info'](util['format'](_0x3cb9('0x4d'),_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x1f')],_0x2c52d7[_0x3cb9('0x4f')]));queues[_0x2c52d7['secondtransfererlinkedid']][_0x3cb9('0x40')]=!![];queues[_0x2c52d7['secondtransfererlinkedid']][_0x3cb9('0x45')]=_0x3cb9('0x50');queues[_0x2c52d7[_0x3cb9('0x4e')]]['transferexten']=_0x2c52d7['origtransfererexten'];queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x51')]=_0x2c52d7[_0x3cb9('0x4c')];queues[_0x2c52d7['secondtransfererlinkedid']]['queuecallerexitreason']=_0x3cb9('0x52');}if(!_[_0x3cb9('0x23')](queues[_0x2c52d7[_0x3cb9('0x53')]])){if(_0x2c52d7[_0x3cb9('0x54')]&&queues[_0x2c52d7[_0x3cb9('0x54')]]){queues[_0x2c52d7[_0x3cb9('0x54')]]['queuecallerenterreason']=0x1;queues[_0x2c52d7[_0x3cb9('0x43')]]=_['clone'](queues[_0x2c52d7[_0x3cb9('0x54')]]);queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x10')]=_0x2c52d7[_0x3cb9('0x55')];queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x20')]=0x2;queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x8')]=queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x8')];queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x56')]=queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x56')];queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x36')]=utils[_0x3cb9('0x2c')]();queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x18')]=utils['now']();queues[_0x2c52d7[_0x3cb9('0x43')]]['holdtime']=0x0;queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x57')]=0x0;utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x58'),_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7['transfereeuniqueid']]['name'],queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x8')],queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x56')]));}else{utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x59'),_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x1f')],_0x2c52d7[_0x3cb9('0x4e')]));queues[_0x2c52d7['origtransfererlinkedid']][_0x3cb9('0x10')]=_0x2c52d7['secondtransfererlinkedid'];}}}else if(_0x2c52d7[_0x3cb9('0x5a')]==_0x2c52d7['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x2c52d7['origtransfererlinkedid']])){utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x53')]]['name'],_0x2c52d7['secondtransfereruniqueid'],_0x2c52d7[_0x3cb9('0x5b')]));queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x40')]=!![];queues[_0x2c52d7['origtransfererlinkedid']][_0x3cb9('0x45')]=_0x3cb9('0x50');queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x47')]=_0x2c52d7[_0x3cb9('0x5b')];queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x51')]=_0x2c52d7[_0x3cb9('0x5a')];queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0xa')]=_0x3cb9('0x52');}if(!_[_0x3cb9('0x23')](queues[_0x2c52d7[_0x3cb9('0x4e')]])){if(_0x2c52d7[_0x3cb9('0x5c')]&&queues[_0x2c52d7['transfertargetlinkedid']]){queues[_0x2c52d7[_0x3cb9('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x2c52d7[_0x3cb9('0x55')]]=_[_0x3cb9('0x5d')](queues[_0x2c52d7['transfertargetlinkedid']]);queues[_0x2c52d7['transfertargetuniqueid']]['transfereduniqueid']=_0x2c52d7['transfertargetuniqueid'];queues[_0x2c52d7[_0x3cb9('0x55')]]['queuecallerenterreason']=0x2;queues[_0x2c52d7['transfertargetuniqueid']][_0x3cb9('0x8')]=queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x8')];queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x56')]=queues[_0x2c52d7['origtransfererlinkedid']][_0x3cb9('0x56')];queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x36')]=utils[_0x3cb9('0x2c')]();queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x18')]=utils[_0x3cb9('0x2c')]();queues[_0x2c52d7['transfertargetuniqueid']][_0x3cb9('0x34')]=0x0;queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x57')]=0x0;utils['info'](util[_0x3cb9('0x3')](_0x3cb9('0x5e'),_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x1f')],queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x10')],queues[_0x2c52d7['transfertargetuniqueid']][_0x3cb9('0x8')],queues[_0x2c52d7[_0x3cb9('0x55')]]['calleridname']));}else{utils['info'](util[_0x3cb9('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x1f')],_0x2c52d7[_0x3cb9('0x53')]));queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x10')]=_0x2c52d7[_0x3cb9('0x53')];}}}}catch(_0x3cba57){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x4b'),_0x2c52d7[_0x3cb9('0x4c')]),_0x3cba57);}};exports[_0x3cb9('0x5f')]=function(_0x18cbd3){try{if(!_[_0x3cb9('0x23')](queues[_0x18cbd3['uniqueid']])){utils['debug'](util['format'](_0x3cb9('0x60'),_0x18cbd3['uniqueid']),_0x18cbd3);queues[_0x18cbd3[_0x3cb9('0x5')]]['musiconholdstartAt']=utils['now']();utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x61'),_0x18cbd3['uniqueid'],queues[_0x18cbd3[_0x3cb9('0x5')]][_0x3cb9('0x1f')],queues[_0x18cbd3[_0x3cb9('0x5')]][_0x3cb9('0x62')]));}}catch(_0x2f745f){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')]('[%s][queues][musiconholdstart]',_0x18cbd3[_0x3cb9('0x5')]),_0x2f745f);}};exports[_0x3cb9('0x63')]=function(_0x3460d5){try{if(!_['isNil'](queues[_0x3460d5[_0x3cb9('0x5')]])){if(!_[_0x3cb9('0x23')](queues[_0x3460d5[_0x3cb9('0x5')]][_0x3cb9('0x62')])){utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')]('[%s][queues][musiconholdstop]',_0x3460d5[_0x3cb9('0x5')]),_0x3460d5);queues[_0x3460d5[_0x3cb9('0x5')]]['mohtime']+=utils[_0x3cb9('0x35')](utils[_0x3cb9('0x2c')](),queues[_0x3460d5[_0x3cb9('0x5')]][_0x3cb9('0x62')]);utils['info'](util[_0x3cb9('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3460d5[_0x3cb9('0x5')],queues[_0x3460d5['uniqueid']][_0x3cb9('0x1f')],queues[_0x3460d5[_0x3cb9('0x5')]][_0x3cb9('0x57')]));delete queues[_0x3460d5[_0x3cb9('0x5')]]['musiconholdstartAt'];}}}catch(_0x2f1380){utils['error'](util['format'](_0x3cb9('0x64'),_0x3460d5['uniqueid']),_0x2f1380);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 236d036..508ea72 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 _0xa2b0=['toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','info','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]','application','appdata','set','startsWith'];(function(_0x2c1683,_0x39c6ab){var _0xc229a5=function(_0x42a025){while(--_0x42a025){_0x2c1683['push'](_0x2c1683['shift']());}};_0xc229a5(++_0x39c6ab);}(_0xa2b0,0xc4));var _0x0a2b=function(_0x40f445,_0x3f81dd){_0x40f445=_0x40f445-0x0;var _0x33bf67=_0xa2b0[_0x40f445];return _0x33bf67;};'use strict';var _=require(_0x0a2b('0x0'));var util=require(_0x0a2b('0x1'));var utils=require(_0x0a2b('0x2'));var recordings={};function writeDB(_0x398332){utils['info'](util[_0x0a2b('0x3')](_0x0a2b('0x4'),_0x398332['uniqueid']));if(_0x398332[_0x0a2b('0x5')]){utils[_0x0a2b('0x6')](_0x398332[_0x0a2b('0x5')])[_0x0a2b('0x7')](function(_0x5e61d8){if(_0x5e61d8){_0x398332[_0x0a2b('0x8')]=_0x5e61d8[_0x0a2b('0x9')];_0x398332[_0x0a2b('0xa')]=_0x5e61d8['id'];}utils[_0x0a2b('0xb')](_0x0a2b('0xc'),_0x398332);});}else{utils[_0x0a2b('0xb')](_0x0a2b('0xc'),_0x398332);}}exports[_0x0a2b('0xd')]=function(_0x3c575c){try{utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')](_0x0a2b('0xf'),_0x3c575c[_0x0a2b('0x10')]),_0x3c575c);if(_0x3c575c[_0x0a2b('0x10')]==_0x3c575c[_0x0a2b('0x11')]){utils['info'](util[_0x0a2b('0x3')](_0x0a2b('0x12'),_0x3c575c[_0x0a2b('0x10')],_0x3c575c[_0x0a2b('0x13')],_0x3c575c['exten']));recordings[_0x3c575c[_0x0a2b('0x10')]]={'uniqueid':_0x3c575c['uniqueid'],'accountcode':_0x3c575c[_0x0a2b('0x5')],'exten':_0x3c575c[_0x0a2b('0x14')],'context':_0x3c575c[_0x0a2b('0x13')],'channel':_0x3c575c[_0x0a2b('0x15')],'monitors':[]};}}catch(_0x285057){utils[_0x0a2b('0x16')](util[_0x0a2b('0x3')](_0x0a2b('0xf'),_0x3c575c[_0x0a2b('0x10')]),_0x285057);}};exports[_0x0a2b('0x17')]=function(_0x53170a){try{utils['debug'](util['format'](_0x0a2b('0x18'),_0x53170a[_0x0a2b('0x10')]),_0x53170a);if(!_[_0x0a2b('0x19')](recordings[_0x53170a[_0x0a2b('0x10')]])&&_0x53170a['channelstate']==0x6){utils['info'](util[_0x0a2b('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x53170a[_0x0a2b('0x10')],_0x53170a['context'],_0x53170a[_0x0a2b('0x15')]));}else if(!_['isNil'](recordings[_0x53170a[_0x0a2b('0x11')]])&&_0x53170a[_0x0a2b('0x1a')]==0x6&&_0x53170a[_0x0a2b('0x13')]!=_0x0a2b('0x1b')){utils[_0x0a2b('0x1c')](util[_0x0a2b('0x3')](_0x0a2b('0x1d'),_0x53170a[_0x0a2b('0x10')],_0x53170a['linkedid'],_0x53170a[_0x0a2b('0x13')],_0x53170a[_0x0a2b('0x15')]));recordings[_0x53170a[_0x0a2b('0x11')]][_0x0a2b('0x5')]=_0x53170a[_0x0a2b('0x5')];}}catch(_0x40d48a){utils[_0x0a2b('0x16')](util[_0x0a2b('0x3')](_0x0a2b('0x18'),_0x53170a['uniqueid']),_0x40d48a);}};exports[_0x0a2b('0x1e')]=function(_0x54d83a){try{if(!_[_0x0a2b('0x19')](_0x54d83a[_0x0a2b('0x1f')])&&!_[_0x0a2b('0x19')](_0x54d83a['variable'][_0x0a2b('0x20')])){utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')](_0x0a2b('0x21'),_0x54d83a[_0x0a2b('0x10')]),_0x54d83a);utils[_0x0a2b('0x1c')](util['format'](_0x0a2b('0x22'),_0x54d83a['uniqueid'],_0x54d83a['variable'],_0x54d83a[_0x0a2b('0x23')]));if(_[_0x0a2b('0x24')](_0x54d83a[_0x0a2b('0x23')],_0x0a2b('0x25'))){_0x54d83a[_0x0a2b('0x23')]=_0x54d83a['value'][_0x0a2b('0x26')](_0x0a2b('0x25'),'.WAV');}if(recordings[_0x54d83a[_0x0a2b('0x11')]]){var _0x803eae=_[_0x0a2b('0x27')](recordings[_0x54d83a[_0x0a2b('0x11')]]['monitors'],{'value':_0x54d83a[_0x0a2b('0x23')]});if(_[_0x0a2b('0x19')](_0x803eae)){recordings[_0x54d83a['linkedid']][_0x0a2b('0x28')][_0x0a2b('0x29')]({'value':_0x54d83a[_0x0a2b('0x23')]});}}}}catch(_0x3c0274){utils['error'](util[_0x0a2b('0x3')](_0x0a2b('0x21'),_0x54d83a['uniqueid']),_0x3c0274);}};exports[_0x0a2b('0x2a')]=function(_0x4fdbf1){try{if(!_[_0x0a2b('0x19')](recordings[_0x4fdbf1[_0x0a2b('0x10')]])){utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')](_0x0a2b('0x2b'),_0x4fdbf1['uniqueid']),_0x4fdbf1);utils[_0x0a2b('0x1c')](util[_0x0a2b('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4fdbf1['uniqueid'],_0x4fdbf1['calleridnum'],_0x4fdbf1[_0x0a2b('0x2c')],_0x4fdbf1['cause-txt']));recordings[_0x4fdbf1[_0x0a2b('0x10')]]['calleridnum']=_0x4fdbf1[_0x0a2b('0x2d')];recordings[_0x4fdbf1['uniqueid']][_0x0a2b('0x2c')]=_0x4fdbf1[_0x0a2b('0x2c')];recordings[_0x4fdbf1[_0x0a2b('0x10')]][_0x0a2b('0x2e')]=_0x4fdbf1['connectedlinenum'];recordings[_0x4fdbf1['uniqueid']]['connectedlinename']=_0x4fdbf1[_0x0a2b('0x2f')];if(recordings[_0x4fdbf1['uniqueid']][_0x0a2b('0x30')]==_0x0a2b('0x31')&&recordings[_0x4fdbf1['uniqueid']][_0x0a2b('0x5')]){recordings[_0x4fdbf1[_0x0a2b('0x10')]][_0x0a2b('0x2e')]=recordings[_0x4fdbf1[_0x0a2b('0x10')]]['accountcode'];recordings[_0x4fdbf1[_0x0a2b('0x10')]][_0x0a2b('0x2f')]='';}recordings[_0x4fdbf1['uniqueid']][_0x0a2b('0x28')][_0x0a2b('0x32')](function(_0x3fbe67){var _0x214233=_['clone'](recordings[_0x4fdbf1['uniqueid']]);_0x214233[_0x0a2b('0x23')]=_0x3fbe67[_0x0a2b('0x23')];writeDB(_0x214233);});delete recordings[_0x4fdbf1[_0x0a2b('0x10')]];}}catch(_0x2b1fa9){utils[_0x0a2b('0x16')](util[_0x0a2b('0x3')](_0x0a2b('0x2b'),_0x4fdbf1[_0x0a2b('0x10')]),_0x2b1fa9);}};exports['newexten']=function(_0x405337){try{if(!_['isNil'](recordings[_0x405337[_0x0a2b('0x10')]])){utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')](_0x0a2b('0x33'),_0x405337[_0x0a2b('0x10')]),_0x405337);utils[_0x0a2b('0x1c')](util[_0x0a2b('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x405337[_0x0a2b('0x10')],_0x405337[_0x0a2b('0x34')],_0x405337[_0x0a2b('0x35')]));if(_0x405337['application']['toLowerCase']()==_0x0a2b('0x36')&&_[_0x0a2b('0x37')](_0x405337['appdata'][_0x0a2b('0x38')](),'cdr')){var _0x247e8e=_0x405337[_0x0a2b('0x35')][_0x0a2b('0x39')]('=');var _0x3ef888=_0x247e8e[0x0][_0x0a2b('0x3a')](_0x247e8e[0x0][_0x0a2b('0x3b')]('(')+0x1,_0x247e8e[0x0][_0x0a2b('0x3b')](')'));var _0x5ddefe=_0x247e8e[0x1];recordings[_0x405337['uniqueid']][_0x3ef888]=_0x5ddefe;}}}catch(_0x7621ea){utils[_0x0a2b('0x16')](util[_0x0a2b('0x3')](_0x0a2b('0x33'),_0x405337['uniqueid']),_0x7621ea);}};exports[_0x0a2b('0x3c')]=function(_0xb757a4){try{if(!_['isNil'](recordings[_0xb757a4['uniqueid']])){utils[_0x0a2b('0xe')](util[_0x0a2b('0x3')]('[%s][recordings][queuecallerjoin]',_0xb757a4[_0x0a2b('0x10')]),_0xb757a4);utils[_0x0a2b('0x1c')](util[_0x0a2b('0x3')](_0x0a2b('0x3d'),_0xb757a4[_0x0a2b('0x10')],_0xb757a4[_0x0a2b('0x3e')]));recordings[_0xb757a4[_0x0a2b('0x10')]][_0x0a2b('0x3e')]=_0xb757a4['queue'];}}catch(_0x2919d4){utils[_0x0a2b('0x16')](util['format']('[%s][recordings][queuecallerjoin]',_0xb757a4[_0x0a2b('0x10')]),_0x2919d4);}}; \ No newline at end of file +var _0x8778=['mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','error','varset','variable'];(function(_0x39a475,_0x56eaba){var _0x3e36c1=function(_0x108ee0){while(--_0x108ee0){_0x39a475['push'](_0x39a475['shift']());}};_0x3e36c1(++_0x56eaba);}(_0x8778,0x10f));var _0x8877=function(_0x1d497a,_0x217cab){_0x1d497a=_0x1d497a-0x0;var _0x13fadc=_0x8778[_0x1d497a];return _0x13fadc;};'use strict';var _=require(_0x8877('0x0'));var util=require(_0x8877('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x1fa072){utils[_0x8877('0x2')](util[_0x8877('0x3')](_0x8877('0x4'),_0x1fa072[_0x8877('0x5')]));if(_0x1fa072['accountcode']){utils[_0x8877('0x6')](_0x1fa072[_0x8877('0x7')])[_0x8877('0x8')](function(_0x4b7ba8){if(_0x4b7ba8){_0x1fa072['membername']=_0x4b7ba8[_0x8877('0x9')];_0x1fa072['UserId']=_0x4b7ba8['id'];}utils[_0x8877('0xa')](_0x8877('0xb'),_0x1fa072);});}else{utils[_0x8877('0xa')]('CreateVoiceRecording',_0x1fa072);}}exports[_0x8877('0xc')]=function(_0x4bc7a9){try{utils[_0x8877('0xd')](util[_0x8877('0x3')]('[%s][recordings][newchannel]',_0x4bc7a9[_0x8877('0x5')]),_0x4bc7a9);if(_0x4bc7a9[_0x8877('0x5')]==_0x4bc7a9['linkedid']){utils[_0x8877('0x2')](util['format'](_0x8877('0xe'),_0x4bc7a9[_0x8877('0x5')],_0x4bc7a9[_0x8877('0xf')],_0x4bc7a9[_0x8877('0x10')]));recordings[_0x4bc7a9[_0x8877('0x5')]]={'uniqueid':_0x4bc7a9[_0x8877('0x5')],'accountcode':_0x4bc7a9[_0x8877('0x7')],'exten':_0x4bc7a9[_0x8877('0x10')],'context':_0x4bc7a9[_0x8877('0xf')],'channel':_0x4bc7a9[_0x8877('0x11')],'monitors':[]};}}catch(_0x2e4c64){utils['error'](util['format']('[%s][recordings][newchannel]',_0x4bc7a9[_0x8877('0x5')]),_0x2e4c64);}};exports[_0x8877('0x12')]=function(_0xe2169){try{utils[_0x8877('0xd')](util[_0x8877('0x3')](_0x8877('0x13'),_0xe2169[_0x8877('0x5')]),_0xe2169);if(!_[_0x8877('0x14')](recordings[_0xe2169[_0x8877('0x5')]])&&_0xe2169[_0x8877('0x15')]==0x6){utils['info'](util['format'](_0x8877('0x16'),_0xe2169[_0x8877('0x5')],_0xe2169['context'],_0xe2169[_0x8877('0x11')]));}else if(!_[_0x8877('0x14')](recordings[_0xe2169['linkedid']])&&_0xe2169[_0x8877('0x15')]==0x6&&_0xe2169['context']!=_0x8877('0x17')){utils[_0x8877('0x2')](util[_0x8877('0x3')](_0x8877('0x18'),_0xe2169[_0x8877('0x5')],_0xe2169[_0x8877('0x19')],_0xe2169[_0x8877('0xf')],_0xe2169[_0x8877('0x11')]));recordings[_0xe2169['linkedid']][_0x8877('0x7')]=_0xe2169[_0x8877('0x7')];}}catch(_0x30360c){utils[_0x8877('0x1a')](util[_0x8877('0x3')](_0x8877('0x13'),_0xe2169[_0x8877('0x5')]),_0x30360c);}};exports[_0x8877('0x1b')]=function(_0x18d03e){try{if(!_[_0x8877('0x14')](_0x18d03e[_0x8877('0x1c')])&&!_[_0x8877('0x14')](_0x18d03e[_0x8877('0x1c')][_0x8877('0x1d')])){utils[_0x8877('0xd')](util[_0x8877('0x3')](_0x8877('0x1e'),_0x18d03e[_0x8877('0x5')]),_0x18d03e);utils['info'](util[_0x8877('0x3')](_0x8877('0x1f'),_0x18d03e[_0x8877('0x5')],_0x18d03e[_0x8877('0x1c')],_0x18d03e[_0x8877('0x20')]));if(_[_0x8877('0x21')](_0x18d03e[_0x8877('0x20')],_0x8877('0x22'))){_0x18d03e[_0x8877('0x20')]=_0x18d03e[_0x8877('0x20')][_0x8877('0x23')](_0x8877('0x22'),_0x8877('0x24'));}if(recordings[_0x18d03e[_0x8877('0x19')]]){var _0x56ebab=_[_0x8877('0x25')](recordings[_0x18d03e[_0x8877('0x19')]]['monitors'],{'value':_0x18d03e[_0x8877('0x20')]});if(_[_0x8877('0x14')](_0x56ebab)){recordings[_0x18d03e[_0x8877('0x19')]][_0x8877('0x26')][_0x8877('0x27')]({'value':_0x18d03e[_0x8877('0x20')]});}}}}catch(_0x2bc83f){utils[_0x8877('0x1a')](util[_0x8877('0x3')]('[%s][recordings][varset]',_0x18d03e[_0x8877('0x5')]),_0x2bc83f);}};exports['hangup']=function(_0x47fc1b){try{if(!_[_0x8877('0x14')](recordings[_0x47fc1b[_0x8877('0x5')]])){utils[_0x8877('0xd')](util[_0x8877('0x3')](_0x8877('0x28'),_0x47fc1b[_0x8877('0x5')]),_0x47fc1b);utils[_0x8877('0x2')](util[_0x8877('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x47fc1b[_0x8877('0x5')],_0x47fc1b[_0x8877('0x29')],_0x47fc1b['calleridname'],_0x47fc1b[_0x8877('0x2a')]));recordings[_0x47fc1b[_0x8877('0x5')]]['calleridnum']=_0x47fc1b['calleridnum'];recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2b')]=_0x47fc1b[_0x8877('0x2b')];recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2c')]=_0x47fc1b[_0x8877('0x2c')];recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2d')]=_0x47fc1b[_0x8877('0x2d')];if(recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2e')]=='outbound'&&recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x7')]){recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2c')]=recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x7')];recordings[_0x47fc1b[_0x8877('0x5')]]['connectedlinename']='';}recordings[_0x47fc1b['uniqueid']][_0x8877('0x26')]['forEach'](function(_0x39d3b9){var _0x163a03=_['clone'](recordings[_0x47fc1b['uniqueid']]);_0x163a03['value']=_0x39d3b9['value'];writeDB(_0x163a03);});delete recordings[_0x47fc1b['uniqueid']];}}catch(_0x10840c){utils[_0x8877('0x1a')](util['format']('[%s][recordings][hangup]',_0x47fc1b[_0x8877('0x5')]),_0x10840c);}};exports[_0x8877('0x2f')]=function(_0xbbb0e8){try{if(!_[_0x8877('0x14')](recordings[_0xbbb0e8[_0x8877('0x5')]])){utils[_0x8877('0xd')](util['format'](_0x8877('0x30'),_0xbbb0e8[_0x8877('0x5')]),_0xbbb0e8);utils[_0x8877('0x2')](util[_0x8877('0x3')](_0x8877('0x31'),_0xbbb0e8[_0x8877('0x5')],_0xbbb0e8[_0x8877('0x32')],_0xbbb0e8[_0x8877('0x33')]));if(_0xbbb0e8[_0x8877('0x32')]['toLowerCase']()==_0x8877('0x34')&&_['startsWith'](_0xbbb0e8[_0x8877('0x33')][_0x8877('0x35')](),_0x8877('0x36'))){var _0xea270a=_0xbbb0e8[_0x8877('0x33')]['split']('=');var _0x268e98=_0xea270a[0x0]['substring'](_0xea270a[0x0][_0x8877('0x37')]('(')+0x1,_0xea270a[0x0][_0x8877('0x37')](')'));var _0xe6dcd0=_0xea270a[0x1];recordings[_0xbbb0e8[_0x8877('0x5')]][_0x268e98]=_0xe6dcd0;}}}catch(_0x603a48){utils[_0x8877('0x1a')](util[_0x8877('0x3')](_0x8877('0x30'),_0xbbb0e8['uniqueid']),_0x603a48);}};exports[_0x8877('0x38')]=function(_0x1d3bca){try{if(!_[_0x8877('0x14')](recordings[_0x1d3bca['uniqueid']])){utils[_0x8877('0xd')](util[_0x8877('0x3')](_0x8877('0x39'),_0x1d3bca[_0x8877('0x5')]),_0x1d3bca);utils[_0x8877('0x2')](util['format'](_0x8877('0x3a'),_0x1d3bca[_0x8877('0x5')],_0x1d3bca[_0x8877('0x3b')]));recordings[_0x1d3bca[_0x8877('0x5')]][_0x8877('0x3b')]=_0x1d3bca['queue'];}}catch(_0x3c6cd8){utils[_0x8877('0x1a')](util[_0x8877('0x3')](_0x8877('0x39'),_0x1d3bca[_0x8877('0x5')]),_0x3c6cd8);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b906788..a5a736a 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 _0x6545=['transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','transferercalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum'];(function(_0x1ff7de,_0x31fc27){var _0x523bf9=function(_0x103772){while(--_0x103772){_0x1ff7de['push'](_0x1ff7de['shift']());}};_0x523bf9(++_0x31fc27);}(_0x6545,0x75));var _0x5654=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6545[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5654('0x0'));var util=require('util');var utils=require(_0x5654('0x1'));function writeDB(_0x5f561d){utils['info'](util[_0x5654('0x2')](_0x5654('0x3'),_0x5f561d[_0x5654('0x4')]===_0x5654('0x5')?_0x5f561d[_0x5654('0x6')]:_0x5f561d[_0x5654('0x7')],_0x5f561d[_0x5654('0x4')]));utils[_0x5654('0x8')](_0x5654('0x9'),_0x5f561d);}exports[_0x5654('0xa')]=function(_0x14f04a){try{utils[_0x5654('0xb')](util[_0x5654('0x2')](_0x5654('0xc'),_0x14f04a[_0x5654('0x7')]),_0x14f04a);utils[_0x5654('0xd')](util[_0x5654('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x14f04a[_0x5654('0x7')],_0x14f04a['transferercalleridnum'],_0x14f04a[_0x5654('0xe')],_0x14f04a['transfereecalleridnum'],_0x14f04a['transfereecalleridname']));_0x14f04a[_0x5654('0x4')]=_0x5654('0xf');writeDB(_0x14f04a);}catch(_0x2ec15c){utils['error'](util[_0x5654('0x2')](_0x5654('0xc'),_0x14f04a[_0x5654('0x7')]),_0x2ec15c);}};exports[_0x5654('0x10')]=function(_0xf3031){try{utils[_0x5654('0xb')](util[_0x5654('0x2')]('[%s][transfers][attendedtransfer]',_0xf3031['origtransfereruniqueid']),_0xf3031);utils[_0x5654('0xd')](util[_0x5654('0x2')](_0x5654('0x11'),_0xf3031[_0x5654('0x6')],_0xf3031[_0x5654('0x12')],_0xf3031['origtransferercalleridname'],_0xf3031['transfertargetcalleridnum'],_0xf3031[_0x5654('0x13')]));_0xf3031=_[_0x5654('0x14')](_0xf3031,{'transfererchannel':_0xf3031[_0x5654('0x15')],'transferercalleridnum':_0xf3031['origtransferercalleridnum'],'transferercalleridname':_0xf3031[_0x5654('0x16')],'transfererconnectedlinenum':_0xf3031[_0x5654('0x17')],'transfererconnectedlinename':_0xf3031['secondtransfererconnectedlinename'],'transfereraccountcode':_0xf3031['origtransfereraccountcode'],'transferercontext':_0xf3031[_0x5654('0x18')],'transfererexten':_0xf3031[_0x5654('0x19')],'transfererlinkedid':_0xf3031[_0x5654('0x1a')],'context':_0xf3031[_0x5654('0x1b')],'extension':_0xf3031[_0x5654('0x1c')],'type':'attended'});if(_[_0x5654('0x1d')](_0xf3031['transfereechannel'])){_0xf3031=_[_0x5654('0x14')](_0xf3031,{'transfereechannel':_0xf3031['transfertargetchannel'],'transfereecalleridnum':_0xf3031['transfertargetcalleridnum'],'transfereecalleridname':_0xf3031[_0x5654('0x13')],'transfereeconnectedlinenum':_0xf3031['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xf3031[_0x5654('0x1e')],'transfereeaccountcode':_0xf3031[_0x5654('0x1f')],'transfereecontext':_0xf3031[_0x5654('0x20')],'transfereeexten':_0xf3031[_0x5654('0x21')],'transfereelinkedid':_0xf3031['transfertargetlinkedid']});}writeDB(_0xf3031);}catch(_0x276369){utils['error'](util[_0x5654('0x2')]('[%s][transfers][attendedtransfer]',_0xf3031['origtransfereruniqueid']),_0x276369);}}; \ No newline at end of file +var _0x7355=['attended','transfereechannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','CreateVoiceTransferReport','blindtransfer','debug','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten'];(function(_0x1af930,_0x505ec6){var _0x26e706=function(_0x9523b1){while(--_0x9523b1){_0x1af930['push'](_0x1af930['shift']());}};_0x26e706(++_0x505ec6);}(_0x7355,0xa0));var _0x5735=function(_0x4354ee,_0x27a0d0){_0x4354ee=_0x4354ee-0x0;var _0x19ca89=_0x7355[_0x4354ee];return _0x19ca89;};'use strict';var _=require(_0x5735('0x0'));var util=require(_0x5735('0x1'));var utils=require('./utils');function writeDB(_0x16bcf0){utils[_0x5735('0x2')](util[_0x5735('0x3')](_0x5735('0x4'),_0x16bcf0[_0x5735('0x5')]==='attended'?_0x16bcf0[_0x5735('0x6')]:_0x16bcf0['uniqueid'],_0x16bcf0[_0x5735('0x5')]));utils['request'](_0x5735('0x7'),_0x16bcf0);}exports[_0x5735('0x8')]=function(_0xa964ff){try{utils[_0x5735('0x9')](util[_0x5735('0x3')]('[%s][transfers][blindtransfer]',_0xa964ff[_0x5735('0xa')]),_0xa964ff);utils[_0x5735('0x2')](util[_0x5735('0x3')](_0x5735('0xb'),_0xa964ff['uniqueid'],_0xa964ff['transferercalleridnum'],_0xa964ff[_0x5735('0xc')],_0xa964ff[_0x5735('0xd')],_0xa964ff[_0x5735('0xe')]));_0xa964ff['type']=_0x5735('0xf');writeDB(_0xa964ff);}catch(_0x52bc2b){utils[_0x5735('0x10')](util[_0x5735('0x3')](_0x5735('0x11'),_0xa964ff[_0x5735('0xa')]),_0x52bc2b);}};exports[_0x5735('0x12')]=function(_0x1ad259){try{utils[_0x5735('0x9')](util[_0x5735('0x3')]('[%s][transfers][attendedtransfer]',_0x1ad259[_0x5735('0x6')]),_0x1ad259);utils['info'](util[_0x5735('0x3')](_0x5735('0x13'),_0x1ad259['origtransfereruniqueid'],_0x1ad259['origtransferercalleridnum'],_0x1ad259[_0x5735('0x14')],_0x1ad259[_0x5735('0x15')],_0x1ad259[_0x5735('0x16')]));_0x1ad259=_[_0x5735('0x17')](_0x1ad259,{'transfererchannel':_0x1ad259['origtransfererchannel'],'transferercalleridnum':_0x1ad259[_0x5735('0x18')],'transferercalleridname':_0x1ad259['origtransferercalleridname'],'transfererconnectedlinenum':_0x1ad259[_0x5735('0x19')],'transfererconnectedlinename':_0x1ad259['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1ad259[_0x5735('0x1a')],'transferercontext':_0x1ad259['secondtransferercontext'],'transfererexten':_0x1ad259[_0x5735('0x1b')],'transfererlinkedid':_0x1ad259[_0x5735('0x1c')],'context':_0x1ad259['origtransferercontext'],'extension':_0x1ad259[_0x5735('0x1d')],'type':_0x5735('0x1e')});if(_['isNil'](_0x1ad259[_0x5735('0x1f')])){_0x1ad259=_[_0x5735('0x17')](_0x1ad259,{'transfereechannel':_0x1ad259['transfertargetchannel'],'transfereecalleridnum':_0x1ad259[_0x5735('0x15')],'transfereecalleridname':_0x1ad259[_0x5735('0x16')],'transfereeconnectedlinenum':_0x1ad259[_0x5735('0x20')],'transfereeconnectedlinename':_0x1ad259['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1ad259[_0x5735('0x21')],'transfereecontext':_0x1ad259[_0x5735('0x22')],'transfereeexten':_0x1ad259[_0x5735('0x23')],'transfereelinkedid':_0x1ad259[_0x5735('0x24')]});}writeDB(_0x1ad259);}catch(_0x2fd19e){utils['error'](util['format'](_0x5735('0x25'),_0x1ad259[_0x5735('0x6')]),_0x2fd19e);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1e0c9b7..c8f83e1 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 _0xae32=['xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','subtractTime','subtract','diffTime','diff','sumTime','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','bluebird','jayson/promise','moment','util','client','http','../../config/logger'];(function(_0x2c2c3c,_0x4ed336){var _0x5c320e=function(_0x5c6e89){while(--_0x5c6e89){_0x2c2c3c['push'](_0x2c2c3c['shift']());}};_0x5c320e(++_0x4ed336);}(_0xae32,0x157));var _0x2ae3=function(_0x1077f2,_0x35e639){_0x1077f2=_0x1077f2-0x0;var _0x22ba90=_0xae32[_0x1077f2];return _0x22ba90;};'use strict';var BPromise=require(_0x2ae3('0x0'));var jayson=require(_0x2ae3('0x1'));var moment=require(_0x2ae3('0x2'));var util=require(_0x2ae3('0x3'));var client=jayson[_0x2ae3('0x4')][_0x2ae3('0x5')]({'port':0x2329});var logger=require(_0x2ae3('0x6'))(_0x2ae3('0x7'));exports[_0x2ae3('0x8')]=function(_0x451f55,_0x3c352f){logger[_0x2ae3('0x8')](_0x451f55,_0x3c352f?util[_0x2ae3('0x9')](_0x3c352f,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x2e182a,_0x3dd609){logger[_0x2ae3('0xa')](_0x2e182a,_0x3dd609?util[_0x2ae3('0x9')](_0x3dd609,{'showHidden':![],'depth':null}):'');};exports[_0x2ae3('0xb')]=function(_0x1ad7bf,_0x2beb82){logger[_0x2ae3('0xb')](_0x1ad7bf,_0x2beb82?util[_0x2ae3('0x9')](_0x2beb82,{'showHidden':![],'depth':null}):'');};exports[_0x2ae3('0xc')]=function(_0xb7733,_0x49d380){return client[_0x2ae3('0xc')](_0xb7733,{'body':_0x49d380})['then'](function(_0x303582){logger[_0x2ae3('0xa')](_0x2ae3('0xd'),_0xb7733,_0x303582?util['inspect'](_0x303582,{'showHidden':![],'depth':null}):'');})[_0x2ae3('0xe')](function(_0x29a005){logger[_0x2ae3('0xb')](_0x2ae3('0xd'),_0xb7733,_0x29a005?util[_0x2ae3('0x9')](_0x29a005,{'showHidden':![],'depth':null}):'');});};function getUser(_0x53404d){return client[_0x2ae3('0xc')](_0x2ae3('0xf'),{'options':{'raw':!![],'attributes':['id',_0x2ae3('0x10'),'name',_0x2ae3('0x11')],'where':_0x53404d,'limit':0x1}})[_0x2ae3('0x12')](function(_0xa7ad3a){logger[_0x2ae3('0xa')](_0x2ae3('0x13'),JSON[_0x2ae3('0x14')](_0x53404d),_0xa7ad3a?util[_0x2ae3('0x9')](_0xa7ad3a,{'showHidden':![],'depth':null}):'');return _0xa7ad3a[_0x2ae3('0x15')][_0x2ae3('0x16')]?_0xa7ad3a[_0x2ae3('0x15')][0x0]:null;});}exports[_0x2ae3('0x17')]=function(_0x3c0acd){return new BPromise(function(_0x3232d4,_0x121cfe){if(_0x3c0acd){return getUser({'internal':_0x3c0acd})['then'](function(_0x530236){logger[_0x2ae3('0x8')](_0x2ae3('0x18'),_0x3c0acd,_0x530236?'found':'notfound');return _0x3232d4(_0x530236);})[_0x2ae3('0xe')](function(_0x436dd4){logger[_0x2ae3('0xb')](_0x2ae3('0x19'),_0x436dd4?util[_0x2ae3('0x9')](_0x436dd4,{'showHidden':![],'depth':null}):'');return _0x3232d4(null);});}return _0x3232d4(null);});};exports['getUserByInterface']=function(_0x3d0f4c){return new BPromise(function(_0xbc4e07,_0x5aa169){if(_0x3d0f4c){return getUser({'interface':_0x3d0f4c})[_0x2ae3('0x12')](function(_0x455b60){logger[_0x2ae3('0x8')](_0x2ae3('0x1a'),_0x3d0f4c,_0x455b60?_0x2ae3('0x1b'):'notfound');return _0xbc4e07(_0x455b60);})['catch'](function(_0x419142){logger[_0x2ae3('0xb')](_0x2ae3('0x1c'),_0x419142?util[_0x2ae3('0x9')](_0x419142,{'showHidden':![],'depth':null}):'');return _0xbc4e07(null);});}return _0xbc4e07(null);});};exports[_0x2ae3('0x1d')]=function(_0x531691){return new BPromise(function(_0x5b9c55,_0x9c5526){if(_0x531691){return getUser({'name':_0x531691})[_0x2ae3('0x12')](function(_0x42e38f){logger[_0x2ae3('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x531691,_0x42e38f?_0x2ae3('0x1b'):_0x2ae3('0x1e'));return _0x5b9c55(_0x42e38f);})[_0x2ae3('0xe')](function(_0x3680d5){logger['error'](_0x2ae3('0x1f'),_0x3680d5?util[_0x2ae3('0x9')](_0x3680d5,{'showHidden':![],'depth':null}):'');return _0x5b9c55(null);});}return _0x5b9c55(null);});};exports[_0x2ae3('0x20')]=function(_0x1f79e1){return new BPromise(function(_0xf6e48,_0x370e85){if(_0x1f79e1){return client[_0x2ae3('0xc')](_0x2ae3('0x21'),{'options':{'raw':!![],'attributes':['id',_0x2ae3('0x22'),_0x2ae3('0x23'),'acw',_0x2ae3('0x24')],'where':{'name':_0x1f79e1},'limit':0x1}})[_0x2ae3('0x12')](function(_0x2b7116){logger[_0x2ae3('0xa')](_0x2ae3('0x25'),_0x1f79e1,_0x2b7116?util[_0x2ae3('0x9')](_0x2b7116,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1f79e1,_0x2b7116?_0x2ae3('0x1b'):_0x2ae3('0x1e'));return _0xf6e48(_0x2b7116['result'][_0x2ae3('0x16')]?_0x2b7116[_0x2ae3('0x15')][0x0]:null);})[_0x2ae3('0xe')](function(_0x3534f8){logger[_0x2ae3('0xb')]('[utils][getVoiceQueueByName]',_0x3534f8?util[_0x2ae3('0x9')](_0x3534f8,{'showHidden':![],'depth':null}):'');return _0xf6e48(null);});}return _0xf6e48(null);});};exports[_0x2ae3('0x26')]=function(_0x41adb2,_0x180627){return moment(_0x41adb2)[_0x2ae3('0x27')](_0x180627,_0x2ae3('0x28'))[_0x2ae3('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2ae3('0x2a')]=function(_0x24eee4,_0x1b9ad6){return moment(_0x24eee4)[_0x2ae3('0x2b')](_0x1b9ad6,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2ae3('0x2c')]=function(_0x32c816,_0x435f36){return moment(_0x32c816)[_0x2ae3('0x2d')](moment(_0x435f36),'seconds');};exports[_0x2ae3('0x2e')]=function(_0x674f46,_0x2735a6){return parseInt(_0x674f46,0xa)+parseInt(_0x2735a6,0xa);};exports[_0x2ae3('0x2f')]=function(){return moment()['format'](_0x2ae3('0x30'));};exports[_0x2ae3('0x31')]=function(_0x1a3bde,_0x14d36f){if(_0x14d36f){return moment(_0x1a3bde)[_0x2ae3('0x31')](_0x14d36f);}return!![];};exports['isBefore']=function(_0x3c0421,_0x4cd631){if(_0x4cd631){return moment(_0x3c0421)['isBefore'](_0x4cd631);}else if(_0x3c0421){return!![];}return![];}; \ No newline at end of file +var _0xf34f=['catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','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]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s'];(function(_0x3afb73,_0xaa578f){var _0x5165f2=function(_0x142ac9){while(--_0x142ac9){_0x3afb73['push'](_0x3afb73['shift']());}};_0x5165f2(++_0xaa578f);}(_0xf34f,0x16b));var _0xff34=function(_0x1e6543,_0x57aff3){_0x1e6543=_0x1e6543-0x0;var _0x1abf8b=_0xf34f[_0x1e6543];return _0x1abf8b;};'use strict';var BPromise=require(_0xff34('0x0'));var jayson=require('jayson/promise');var moment=require(_0xff34('0x1'));var util=require(_0xff34('0x2'));var client=jayson['client'][_0xff34('0x3')]({'port':0x2329});var logger=require(_0xff34('0x4'))(_0xff34('0x5'));exports[_0xff34('0x6')]=function(_0x284405,_0x2c74d2){logger[_0xff34('0x6')](_0x284405,_0x2c74d2?util[_0xff34('0x7')](_0x2c74d2,{'showHidden':![],'depth':null}):'');};exports[_0xff34('0x8')]=function(_0x380b91,_0x5d8f59){logger['debug'](_0x380b91,_0x5d8f59?util['inspect'](_0x5d8f59,{'showHidden':![],'depth':null}):'');};exports[_0xff34('0x9')]=function(_0x4cd392,_0x1d2128){logger['error'](_0x4cd392,_0x1d2128?util[_0xff34('0x7')](_0x1d2128,{'showHidden':![],'depth':null}):'');};exports[_0xff34('0xa')]=function(_0x28647e,_0x35918f){return client[_0xff34('0xa')](_0x28647e,{'body':_0x35918f})[_0xff34('0xb')](function(_0x58c77a){logger['debug'](_0xff34('0xc'),_0x28647e,_0x58c77a?util[_0xff34('0x7')](_0x58c77a,{'showHidden':![],'depth':null}):'');})[_0xff34('0xd')](function(_0x4d0d6a){logger[_0xff34('0x9')]('[utils][request]\x20name:%s',_0x28647e,_0x4d0d6a?util[_0xff34('0x7')](_0x4d0d6a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x28d34c){return client[_0xff34('0xa')](_0xff34('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xff34('0xf'),_0xff34('0x10')],'where':_0x28d34c,'limit':0x1}})[_0xff34('0xb')](function(_0x3a3a72){logger[_0xff34('0x8')](_0xff34('0x11'),JSON[_0xff34('0x12')](_0x28d34c),_0x3a3a72?util[_0xff34('0x7')](_0x3a3a72,{'showHidden':![],'depth':null}):'');return _0x3a3a72[_0xff34('0x13')]['length']?_0x3a3a72[_0xff34('0x13')][0x0]:null;});}exports[_0xff34('0x14')]=function(_0x28d233){return new BPromise(function(_0x4f6c77,_0x30fb87){if(_0x28d233){return getUser({'internal':_0x28d233})['then'](function(_0x5f11eb){logger[_0xff34('0x6')](_0xff34('0x15'),_0x28d233,_0x5f11eb?_0xff34('0x16'):_0xff34('0x17'));return _0x4f6c77(_0x5f11eb);})[_0xff34('0xd')](function(_0x4ac8fe){logger['error']('[utils][getUserByInternal]',_0x4ac8fe?util[_0xff34('0x7')](_0x4ac8fe,{'showHidden':![],'depth':null}):'');return _0x4f6c77(null);});}return _0x4f6c77(null);});};exports[_0xff34('0x18')]=function(_0x1de513){return new BPromise(function(_0x32fb48,_0x53dfe8){if(_0x1de513){return getUser({'interface':_0x1de513})['then'](function(_0x2d0505){logger[_0xff34('0x6')](_0xff34('0x19'),_0x1de513,_0x2d0505?_0xff34('0x16'):'notfound');return _0x32fb48(_0x2d0505);})[_0xff34('0xd')](function(_0xb82a33){logger['error'](_0xff34('0x1a'),_0xb82a33?util[_0xff34('0x7')](_0xb82a33,{'showHidden':![],'depth':null}):'');return _0x32fb48(null);});}return _0x32fb48(null);});};exports[_0xff34('0x1b')]=function(_0x4feed6){return new BPromise(function(_0x48cdab,_0xb9d85e){if(_0x4feed6){return getUser({'name':_0x4feed6})[_0xff34('0xb')](function(_0x48fe93){logger[_0xff34('0x6')](_0xff34('0x1c'),_0x4feed6,_0x48fe93?_0xff34('0x16'):_0xff34('0x17'));return _0x48cdab(_0x48fe93);})['catch'](function(_0x12844b){logger[_0xff34('0x9')](_0xff34('0x1d'),_0x12844b?util[_0xff34('0x7')](_0x12844b,{'showHidden':![],'depth':null}):'');return _0x48cdab(null);});}return _0x48cdab(null);});};exports[_0xff34('0x1e')]=function(_0x22c568){return new BPromise(function(_0x11ab1e,_0x401472){if(_0x22c568){return client[_0xff34('0xa')](_0xff34('0x1f'),{'options':{'raw':!![],'attributes':['id','name',_0xff34('0x20'),_0xff34('0x21'),_0xff34('0x22')],'where':{'name':_0x22c568},'limit':0x1}})[_0xff34('0xb')](function(_0x2bfa20){logger['debug'](_0xff34('0x23'),_0x22c568,_0x2bfa20?util[_0xff34('0x7')](_0x2bfa20,{'showHidden':![],'depth':null}):'');logger[_0xff34('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x22c568,_0x2bfa20?_0xff34('0x16'):_0xff34('0x17'));return _0x11ab1e(_0x2bfa20[_0xff34('0x13')]['length']?_0x2bfa20[_0xff34('0x13')][0x0]:null);})[_0xff34('0xd')](function(_0x59f4fd){logger[_0xff34('0x9')](_0xff34('0x24'),_0x59f4fd?util['inspect'](_0x59f4fd,{'showHidden':![],'depth':null}):'');return _0x11ab1e(null);});}return _0x11ab1e(null);});};exports['addTime']=function(_0x6ca582,_0xef3cfe){return moment(_0x6ca582)[_0xff34('0x25')](_0xef3cfe,_0xff34('0x26'))[_0xff34('0x27')](_0xff34('0x28'));};exports[_0xff34('0x29')]=function(_0x4a8b6d,_0x181fc7){return moment(_0x4a8b6d)['subtract'](_0x181fc7,_0xff34('0x26'))[_0xff34('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x1893c2,_0x40021f){return moment(_0x1893c2)[_0xff34('0x2a')](moment(_0x40021f),'seconds');};exports[_0xff34('0x2b')]=function(_0x371374,_0x2a6d84){return parseInt(_0x371374,0xa)+parseInt(_0x2a6d84,0xa);};exports[_0xff34('0x2c')]=function(){return moment()[_0xff34('0x27')](_0xff34('0x28'));};exports[_0xff34('0x2d')]=function(_0x426ffa,_0x2bb5a2){if(_0x2bb5a2){return moment(_0x426ffa)['isAfter'](_0x2bb5a2);}return!![];};exports[_0xff34('0x2e')]=function(_0xf3481c,_0x3b5d7d){if(_0x3b5d7d){return moment(_0xf3481c)['isBefore'](_0x3b5d7d);}else if(_0xf3481c){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 ef8f413..2fff2c6 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 _0x858a=['headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','name','%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)','agent_name','test','url','setupLoggers','fs-extra','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','client','role','ensureDir','then','catch','user','no-user','data','timestamp','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method'];(function(_0x5382f1,_0x5704ec){var _0x914fae=function(_0x460173){while(--_0x460173){_0x5382f1['push'](_0x5382f1['shift']());}};_0x914fae(++_0x5704ec);}(_0x858a,0x1ad));var _0xa858=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x858a[_0x273c39];return _0x46d6b5;};var fs=require(_0xa858('0x0'));var _=require('lodash');var ewinston=require(_0xa858('0x1'));var path=require(_0xa858('0x2'));var util=require(_0xa858('0x3'));var fileLogger=require(_0xa858('0x4'))['fileLogger'];var safeTemplate=require(_0xa858('0x5'))[_0xa858('0x6')];var maskSensitiveData=require(_0xa858('0x7'))[_0xa858('0x8')];function ClientSideLogger(){function _0x2489f5(_0xf76095){var _0x360311=path[_0xa858('0x9')]('/var',_0xa858('0xa'),'xcally');var _0x3f1a52=path['join'](_0xa858('0xb'),_0xf76095[_0xa858('0xc')]+'-'+_0xf76095['name']);return fs[_0xa858('0xd')](path[_0xa858('0x9')](_0x360311,_0x3f1a52))[_0xa858('0xe')](function(){var _0x4c3d60=fileLogger(_0xa858('0xb'),path[_0xa858('0x9')](_0x360311,_0x3f1a52));return _0x4c3d60;})[_0xa858('0xf')](function(_0x2f0c60){throw _0x2f0c60;});}this[_0xa858('0xa')]=function(_0x14bf2c,_0x2b32d4,_0x417b64,_0x1a3315){return _0x2489f5(_0x14bf2c[_0xa858('0x10')])[_0xa858('0xe')](function(_0x564dfa){var _0x5eeec6=_0x564dfa[_0x2b32d4];return _0x5eeec6;})[_0xa858('0xe')](function(_0x30f905){var _0x5cae42=_0x14bf2c[_0xa858('0x10')]?_0x14bf2c[_0xa858('0x10')]['id']:_0xa858('0x11');var _0x50ba37=_0x1a3315[_0xa858('0x12')];var _0x4620d1=_0x1a3315[_0xa858('0x13')];var _0x21a66a=new Date(Number(_0x4620d1));return _0x30f905(_0x5cae42,_0x21a66a,_0x417b64,_0x50ba37);})[_0xa858('0xf')](function(_0x2c3656){fileLogger(_0xa858('0xb'))[_0xa858('0x14')](_0x2c3656);});};}function setupLoggers(_0x23afe5){return new Promise(function(_0x3f784d){var _0x1dbf83=new ClientSideLogger();var _0x424f74=fileLogger(_0xa858('0x15'));var _0x2b71e8=fileLogger('auth');_0x23afe5[_0xa858('0x16')](_0xa858('0x17'),_0x1dbf83);_0x23afe5[_0xa858('0x18')](ewinston[_0xa858('0x19')]({'winstonInstance':_0x424f74,'meta':![],'statusLevels':!![],'msg':function(_0xd32a03,_0x444311){var _0x435c72=_0xa858('0x1a');if(!_[_0xa858('0x1b')](_0xd32a03[_0xa858('0x1c')])){_0x435c72+='\x20body=%s';var _0x264491=_0xd32a03[_0xa858('0x1c')];maskSensitiveData(_0x264491);}return safeTemplate(util[_0xa858('0x1d')](_0x435c72,_0xd32a03[_0xa858('0x1e')],_0xd32a03[_0xa858('0x1f')]['x-forwarded-for']?_0xd32a03['headers'][_0xa858('0x20')]:_0xd32a03[_0xa858('0x21')][_0xa858('0x22')]||_0xd32a03['ip'],_0xd32a03['url'],_0x444311[_0xa858('0x23')],_0x444311[_0xa858('0x24')],_0xd32a03[_0xa858('0x10')]?_0xd32a03[_0xa858('0x10')]['id']:null,_0xd32a03[_0xa858('0x10')]?_0xd32a03['user'][_0xa858('0x25')]:null,_0xd32a03[_0xa858('0x10')]?_0xd32a03[_0xa858('0x10')][_0xa858('0xc')]:null,_0x264491?util['inspect'](_0x264491,![],null):''));}}));_0x23afe5[_0xa858('0x18')](ewinston[_0xa858('0x19')]({'winstonInstance':_0x2b71e8,'meta':![],'statusLevels':!![],'msg':function(_0x28a257,_0x41a1a5){var _0x5e1a5c=_0xa858('0x26');if(_0x28a257[_0xa858('0x1c')]&&_0x28a257['body'][_0xa858('0x27')]&&_0x28a257['body'][_0xa858('0x28')]){_0x5e1a5c=_0xa858('0x29');}return util[_0xa858('0x1d')](_0x5e1a5c,_0x28a257[_0xa858('0x1e')],_0x28a257[_0xa858('0x1f')][_0xa858('0x20')]?_0x28a257[_0xa858('0x1f')][_0xa858('0x20')]:_0x28a257['connection'][_0xa858('0x22')]||_0x28a257['ip'],_0x28a257['url'],_0x41a1a5[_0xa858('0x23')],_0x41a1a5[_0xa858('0x24')],_0x28a257[_0xa858('0x10')]?_0x28a257[_0xa858('0x10')]['id']:null,_0x28a257[_0xa858('0x10')]?_0x28a257[_0xa858('0x10')][_0xa858('0x25')]:null,_0x28a257[_0xa858('0x10')]?_0x28a257[_0xa858('0x10')][_0xa858('0xc')]:null,_0x28a257[_0xa858('0x1c')]&&_0x28a257[_0xa858('0x1c')][_0xa858('0x27')]?_0x28a257[_0xa858('0x1c')][_0xa858('0x27')]:'other',_0x28a257[_0xa858('0x1c')]&&_0x28a257[_0xa858('0x1c')][_0xa858('0x28')]?_0x28a257[_0xa858('0x1c')]['agent_id']:'',_0x28a257[_0xa858('0x1c')]&&_0x28a257['body'][_0xa858('0x2a')]?_0x28a257[_0xa858('0x1c')][_0xa858('0x2a')]:'');},'ignoreRoute':function(_0x5dfebf){var _0xb08c1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xb08c1[_0xa858('0x2b')](_0x5dfebf[_0xa858('0x2c')]);}}));return _0x3f784d();});}exports[_0xa858('0x2d')]=setupLoggers; \ No newline at end of file +var _0xa3a9=['test','setupLoggers','fs-extra','express-winston','path','util','fileLogger','maskSensitiveData','/var','log','xcally','client','role','name','ensureDir','join','then','catch','user','data','timestamp','api','auth','set','logger','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','format','device','other','agent_name'];(function(_0x2a86e6,_0x3f3bc9){var _0x121c19=function(_0x2022fc){while(--_0x2022fc){_0x2a86e6['push'](_0x2a86e6['shift']());}};_0x121c19(++_0x3f3bc9);}(_0xa3a9,0x80));var _0x9a3a=function(_0x4d444f,_0x5eeef0){_0x4d444f=_0x4d444f-0x0;var _0x2f917d=_0xa3a9[_0x4d444f];return _0x2f917d;};var fs=require(_0x9a3a('0x0'));var _=require('lodash');var ewinston=require(_0x9a3a('0x1'));var path=require(_0x9a3a('0x2'));var util=require(_0x9a3a('0x3'));var fileLogger=require('./loggers')[_0x9a3a('0x4')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x9a3a('0x5')];function ClientSideLogger(){function _0x194409(_0x16cf51){var _0x5ca685=path['join'](_0x9a3a('0x6'),_0x9a3a('0x7'),_0x9a3a('0x8'));var _0x1a1b1f=path['join'](_0x9a3a('0x9'),_0x16cf51[_0x9a3a('0xa')]+'-'+_0x16cf51[_0x9a3a('0xb')]);return fs[_0x9a3a('0xc')](path[_0x9a3a('0xd')](_0x5ca685,_0x1a1b1f))[_0x9a3a('0xe')](function(){var _0x5ac1e6=fileLogger(_0x9a3a('0x9'),path[_0x9a3a('0xd')](_0x5ca685,_0x1a1b1f));return _0x5ac1e6;})[_0x9a3a('0xf')](function(_0x5141ed){throw _0x5141ed;});}this[_0x9a3a('0x7')]=function(_0x5bf03b,_0x3dc2e6,_0x497321,_0x4e52cb){return _0x194409(_0x5bf03b[_0x9a3a('0x10')])[_0x9a3a('0xe')](function(_0x446baf){var _0x2a4128=_0x446baf[_0x3dc2e6];return _0x2a4128;})[_0x9a3a('0xe')](function(_0x3d8f68){var _0x3f0105=_0x5bf03b[_0x9a3a('0x10')]?_0x5bf03b[_0x9a3a('0x10')]['id']:'no-user';var _0x3493bf=_0x4e52cb[_0x9a3a('0x11')];var _0x3eb670=_0x4e52cb[_0x9a3a('0x12')];var _0x33ac30=new Date(Number(_0x3eb670));return _0x3d8f68(_0x3f0105,_0x33ac30,_0x497321,_0x3493bf);})[_0x9a3a('0xf')](function(_0x20d346){fileLogger(_0x9a3a('0x9'))['error'](_0x20d346);});};}function setupLoggers(_0x3a5d2b){return new Promise(function(_0x235283){var _0x3416f2=new ClientSideLogger();var _0x143079=fileLogger(_0x9a3a('0x13'));var _0x146df0=fileLogger(_0x9a3a('0x14'));_0x3a5d2b[_0x9a3a('0x15')]('client-side-logger',_0x3416f2);_0x3a5d2b['use'](ewinston[_0x9a3a('0x16')]({'winstonInstance':_0x143079,'meta':![],'statusLevels':!![],'msg':function(_0x335c0c,_0x5ab25d){var _0x1a7aca='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x335c0c[_0x9a3a('0x17')])){_0x1a7aca+=_0x9a3a('0x18');var _0x16852b=_0x335c0c[_0x9a3a('0x17')];maskSensitiveData(_0x16852b);}return safeTemplate(util['format'](_0x1a7aca,_0x335c0c[_0x9a3a('0x19')],_0x335c0c[_0x9a3a('0x1a')]['x-forwarded-for']?_0x335c0c[_0x9a3a('0x1a')][_0x9a3a('0x1b')]:_0x335c0c[_0x9a3a('0x1c')][_0x9a3a('0x1d')]||_0x335c0c['ip'],_0x335c0c[_0x9a3a('0x1e')],_0x5ab25d[_0x9a3a('0x1f')],_0x5ab25d[_0x9a3a('0x20')],_0x335c0c[_0x9a3a('0x10')]?_0x335c0c[_0x9a3a('0x10')]['id']:null,_0x335c0c[_0x9a3a('0x10')]?_0x335c0c[_0x9a3a('0x10')][_0x9a3a('0xb')]:null,_0x335c0c['user']?_0x335c0c[_0x9a3a('0x10')][_0x9a3a('0xa')]:null,_0x16852b?util['inspect'](_0x16852b,![],null):''));}}));_0x3a5d2b[_0x9a3a('0x21')](ewinston[_0x9a3a('0x16')]({'winstonInstance':_0x146df0,'meta':![],'statusLevels':!![],'msg':function(_0x24a744,_0x22fecf){var _0x2c7342=_0x9a3a('0x22');if(_0x24a744['body']&&_0x24a744['body']['device']&&_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x23')]){_0x2c7342='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x9a3a('0x24')](_0x2c7342,_0x24a744[_0x9a3a('0x19')],_0x24a744[_0x9a3a('0x1a')][_0x9a3a('0x1b')]?_0x24a744[_0x9a3a('0x1a')][_0x9a3a('0x1b')]:_0x24a744['connection'][_0x9a3a('0x1d')]||_0x24a744['ip'],_0x24a744[_0x9a3a('0x1e')],_0x22fecf['statusCode'],_0x22fecf[_0x9a3a('0x20')],_0x24a744[_0x9a3a('0x10')]?_0x24a744[_0x9a3a('0x10')]['id']:null,_0x24a744[_0x9a3a('0x10')]?_0x24a744[_0x9a3a('0x10')]['name']:null,_0x24a744[_0x9a3a('0x10')]?_0x24a744['user'][_0x9a3a('0xa')]:null,_0x24a744['body']&&_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x25')]?_0x24a744[_0x9a3a('0x17')]['device']:_0x9a3a('0x26'),_0x24a744[_0x9a3a('0x17')]&&_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x23')]?_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x23')]:'',_0x24a744[_0x9a3a('0x17')]&&_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x27')]?_0x24a744['body'][_0x9a3a('0x27')]:'');},'ignoreRoute':function(_0x147a6a){var _0x4dab1c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4dab1c[_0x9a3a('0x28')](_0x147a6a[_0x9a3a('0x1e')]);}}));return _0x235283();});}exports[_0x9a3a('0x29')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 883b119..4035a55 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfb8=['iftime','lodash','moment-timezone','source','join','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','map','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','endOf','isBetween','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','isMoment','padStart','length'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0xcfb8,0x139));var _0x8cfb=function(_0x5a3b32,_0x1d92f4){_0x5a3b32=_0x5a3b32-0x0;var _0x9d9608=_0xcfb8[_0x5a3b32];return _0x9d9608;};var _=require(_0x8cfb('0x0'));var moment=require(_0x8cfb('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0xe00282){return _0xe00282[_0x8cfb('0x2')];})[_0x8cfb('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x8cfb('0x4');function throwIfDateNotValid(_0x4a638d){if(!_0x4a638d[_0x8cfb('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4e89d2){var _0x445dfd=_0x4e89d2[_0x8cfb('0x6')](':')['map'](function(_0x3bcb3e){return parseInt(_0x3bcb3e,0xa);});var _0x3bd4ed=_0x445dfd[0x0];var _0x34ba10=_0x445dfd[0x1];if(_0x3bd4ed<0x0||_0x3bd4ed>0x17||_0x34ba10<0x0||_0x34ba10>0x3b){throw new Error(EINVALID_DATE);}return[_0x3bd4ed,_0x34ba10];}function circularDoWInterval(_0x526028,_0x1ef1fb){if(_0x526028===_0x1ef1fb){return[_0x526028];}else{var _0x15b15a=moment[_0x8cfb('0x7')]();moment[_0x8cfb('0x7')]('en');var _0x1fa7a1=moment[_0x8cfb('0x8')]()[_0x8cfb('0x9')](function(_0x334ec1){return _0x334ec1[_0x8cfb('0xa')]();});moment[_0x8cfb('0x7')](_0x15b15a);var _0x2011ec=_0x1fa7a1[_0x8cfb('0xb')](_0x526028);var _0x5b583b=_0x1fa7a1[_0x8cfb('0xb')](_0x1ef1fb);if(_0x5b583b>_0x2011ec){return _0x1fa7a1[_0x8cfb('0xc')](_0x2011ec,_0x5b583b+0x1);}else{var _0x6b3325=_0x1fa7a1['slice'](0x0,_0x5b583b+0x1);var _0x1171d1=_0x1fa7a1[_0x8cfb('0xc')](_0x2011ec);return _0x1171d1[_0x8cfb('0xd')](_0x6b3325);}}}module[_0x8cfb('0xe')][_0x8cfb('0xf')]=circularDoWInterval;function circularMonthInterval(_0xadbd63,_0x1b914a){if(_0xadbd63===_0x1b914a){return[_0xadbd63];}else{var _0x556af2=moment[_0x8cfb('0x7')]();moment[_0x8cfb('0x7')]('en');var _0x1575d1=moment[_0x8cfb('0x10')]()['map'](function(_0x3c3950){return _0x3c3950[_0x8cfb('0xa')]();});moment[_0x8cfb('0x7')](_0x556af2);var _0x1d4941=_0x1575d1[_0x8cfb('0xb')](_0xadbd63);var _0x4036a2=_0x1575d1['indexOf'](_0x1b914a);if(_0x4036a2>_0x1d4941){return _0x1575d1[_0x8cfb('0xc')](_0x1d4941,_0x4036a2+0x1);}else{var _0xa7cb47=_0x1575d1[_0x8cfb('0xc')](0x0,_0x4036a2+0x1);var _0x1330ba=_0x1575d1['slice'](_0x1d4941);return _0x1330ba[_0x8cfb('0xd')](_0xa7cb47);}}}module['exports'][_0x8cfb('0x11')]=circularMonthInterval;function parseDom(_0x56086e){var _0x574c3f=parseInt(_0x56086e,0xa);if(_0x574c3f<0x1||_0x574c3f>0x1f){throw new Error(EINVALID_DATE);}return _0x574c3f;}function timeCompare(_0x515ffe,_0x51b8a8,_0x48d00a){var _0x2cce80=_0x515ffe[_0x8cfb('0x12')]();var _0x2d9901=extractTime(_0x51b8a8);var _0xc78280=_0x2d9901[0x0];var _0x2895a1=_0x2d9901[0x1];var _0x2ee7d6=_0x515ffe['clone']()['hours'](_0xc78280)[_0x8cfb('0x13')](_0x2895a1);throwIfDateNotValid(_0x2ee7d6);var _0x4b1d57=extractTime(_0x48d00a);var _0x3423f0=_0x4b1d57[0x0];var _0x21b3e6=_0x4b1d57[0x1];var _0x395095=_0x515ffe['clone']()[_0x8cfb('0x14')](_0x3423f0)[_0x8cfb('0x13')](_0x21b3e6);throwIfDateNotValid(_0x395095);if(_0x395095[_0x8cfb('0x15')](_0x2ee7d6)){var _0x3bc444=_0x2cce80[_0x8cfb('0x12')]()[_0x8cfb('0x16')](_0x8cfb('0x17'));var _0x117b1a=_0x2cce80[_0x8cfb('0x12')]()[_0x8cfb('0x18')](_0x8cfb('0x17'));return _0x2cce80[_0x8cfb('0x19')](_0x2ee7d6,_0x117b1a,undefined,'[]')||_0x2cce80[_0x8cfb('0x19')](_0x3bc444,_0x395095,undefined,'[]');}else{return _0x2cce80['isBetween'](_0x2ee7d6,_0x395095,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x32465f,_0x4fe8ef,_0x3a9525){var _0x5e5b22=_0x32465f[_0x8cfb('0x7')]('en')['format'](_0x8cfb('0x1a'))[_0x8cfb('0xa')]();return circularDoWInterval(_0x4fe8ef,_0x3a9525)[_0x8cfb('0x1b')](_0x5e5b22);}module[_0x8cfb('0xe')][_0x8cfb('0x1c')]=dowCompare;function domCompare(_0x4f4c9c,_0x67740f,_0x2ad843){var _0x42be86=_0x4f4c9c[_0x8cfb('0x1d')]();if(_0x67740f===_0x2ad843){return _0x42be86===_0x67740f;}else{var _0x56192a=_0x4f4c9c[_0x8cfb('0x1e')]();var _0x3559f3=_0x67740f<_0x2ad843;let _0x55371a=![];var _0x54a667=0x0;var _0x528374=0x0;if(_0x3559f3){_0x54a667=Math[_0x8cfb('0x1f')](0x1,_0x67740f);_0x528374=Math['min'](_0x2ad843,_0x56192a);_0x55371a=_0x42be86>=_0x54a667&&_0x42be86<=_0x528374;}else{_0x54a667=Math[_0x8cfb('0x20')](_0x67740f,_0x56192a);_0x528374=Math['max'](0x1,_0x2ad843);_0x55371a=_0x42be86>=_0x54a667||_0x42be86<=_0x528374;}return _0x55371a;}}module[_0x8cfb('0xe')][_0x8cfb('0x21')]=domCompare;function monthCompare(_0x982fdd,_0x4e4ca6,_0x4dc00f){var _0x51921c=_0x982fdd[_0x8cfb('0x7')]('en')['format']('MMM')[_0x8cfb('0xa')]();return circularMonthInterval(_0x4e4ca6,_0x4dc00f)[_0x8cfb('0x1b')](_0x51921c);}module[_0x8cfb('0xe')][_0x8cfb('0x22')]=monthCompare;function iftime(_0x466ee9,_0x902cd=moment['tz']['guess'](),_0x535788=moment()){if(!validateRx['test'](_0x466ee9)){throw new Error(EINVALID_STRING);}else{var _0x2e5287=(moment[_0x8cfb('0x23')](_0x535788)?_0x535788[_0x8cfb('0x12')]():moment(_0x535788))['tz'](_0x902cd)[_0x8cfb('0x7')]('en');throwIfDateNotValid(_0x2e5287);var _0x311268=_0x466ee9[_0x8cfb('0x6')](',');var _0x2c1ffa=_0x311268[0x0];var _0x49bb94=_0x311268[0x1];var _0x56ac15=_0x311268[0x2];var _0x220f0b=_0x311268[0x3];let _0x495677=!![];if(_0x2c1ffa!=='*'){var _0x485826=_0x2c1ffa[_0x8cfb('0x6')]('-');var _0x42d890=_[_0x8cfb('0x24')](_0x485826[0x0],0x5,'0');var _0x49a95b=_0x485826[_0x8cfb('0x25')]===0x2?_[_0x8cfb('0x24')](_0x485826[0x1],0x5,'0'):_0x42d890;_0x495677=timeCompare(_0x2e5287,_0x42d890,_0x49a95b);}let _0x16352f=!![];if(_0x49bb94!=='*'){var _0x31f10c=_0x49bb94[_0x8cfb('0x6')]('-');var _0x36e2e5=_0x31f10c[0x0];var _0x2b6491=_0x31f10c[_0x8cfb('0x25')]===0x2?_0x31f10c[0x1]:_0x36e2e5;_0x16352f=dowCompare(_0x2e5287,_0x36e2e5,_0x2b6491);}let _0x551354=!![];if(_0x56ac15!=='*'){var _0x315a44=_0x56ac15[_0x8cfb('0x6')]('-');var _0x369ca1=parseDom(_0x315a44[0x0]);var _0x178d21=_0x315a44[_0x8cfb('0x25')]===0x2?parseDom(_0x315a44[0x1]):_0x369ca1;_0x551354=domCompare(_0x2e5287,_0x369ca1,_0x178d21);}let _0x27c8e5=!![];if(_0x220f0b!=='*'){var _0x32bd65=_0x220f0b[_0x8cfb('0x6')]('-');var _0x132e91=_0x32bd65[0x0];var _0x12bb59=_0x32bd65[_0x8cfb('0x25')]===0x2?_0x32bd65[0x1]:_0x32bd65[0x0];_0x27c8e5=monthCompare(_0x2e5287,_0x132e91,_0x12bb59);}return _0x495677&&_0x16352f&&_0x551354&&_0x27c8e5;}}module['exports'][_0x8cfb('0x26')]=iftime; \ No newline at end of file +var _0xf23d=['ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','clone','hours','minutes','day','endOf','isBetween','timeCompare','format'];(function(_0x3544a1,_0x175b4d){var _0x556878=function(_0x45a88e){while(--_0x45a88e){_0x3544a1['push'](_0x3544a1['shift']());}};_0x556878(++_0x175b4d);}(_0xf23d,0x18c));var _0xdf23=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xf23d[_0xd0b415];return _0x2bdf2c;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xdf23('0x0')](function(_0x3c5f7a){return _0x3c5f7a[_0xdf23('0x1')];})[_0xdf23('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xdf23('0x3');var EINVALID_DATE=_0xdf23('0x4');function throwIfDateNotValid(_0x3eb05d){if(!_0x3eb05d[_0xdf23('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xdb1b27){var _0x41d8bf=_0xdb1b27[_0xdf23('0x6')](':')[_0xdf23('0x0')](function(_0x5a137b){return parseInt(_0x5a137b,0xa);});var _0x4c4b05=_0x41d8bf[0x0];var _0x148b9a=_0x41d8bf[0x1];if(_0x4c4b05<0x0||_0x4c4b05>0x17||_0x148b9a<0x0||_0x148b9a>0x3b){throw new Error(EINVALID_DATE);}return[_0x4c4b05,_0x148b9a];}function circularDoWInterval(_0xe834f,_0x3ec292){if(_0xe834f===_0x3ec292){return[_0xe834f];}else{var _0x23d0f0=moment[_0xdf23('0x7')]();moment['locale']('en');var _0x112fe9=moment['weekdaysShort']()[_0xdf23('0x0')](function(_0x1d0bed){return _0x1d0bed[_0xdf23('0x8')]();});moment[_0xdf23('0x7')](_0x23d0f0);var _0x39fc51=_0x112fe9[_0xdf23('0x9')](_0xe834f);var _0x1dc56b=_0x112fe9[_0xdf23('0x9')](_0x3ec292);if(_0x1dc56b>_0x39fc51){return _0x112fe9[_0xdf23('0xa')](_0x39fc51,_0x1dc56b+0x1);}else{var _0x3d2767=_0x112fe9['slice'](0x0,_0x1dc56b+0x1);var _0x50f596=_0x112fe9[_0xdf23('0xa')](_0x39fc51);return _0x50f596[_0xdf23('0xb')](_0x3d2767);}}}module[_0xdf23('0xc')][_0xdf23('0xd')]=circularDoWInterval;function circularMonthInterval(_0x508a0c,_0x2662f8){if(_0x508a0c===_0x2662f8){return[_0x508a0c];}else{var _0x1ba8ef=moment[_0xdf23('0x7')]();moment['locale']('en');var _0x3fde2e=moment['monthsShort']()[_0xdf23('0x0')](function(_0x28169e){return _0x28169e[_0xdf23('0x8')]();});moment[_0xdf23('0x7')](_0x1ba8ef);var _0x1fd5bf=_0x3fde2e[_0xdf23('0x9')](_0x508a0c);var _0x54d038=_0x3fde2e[_0xdf23('0x9')](_0x2662f8);if(_0x54d038>_0x1fd5bf){return _0x3fde2e['slice'](_0x1fd5bf,_0x54d038+0x1);}else{var _0x1b613b=_0x3fde2e['slice'](0x0,_0x54d038+0x1);var _0x1aa133=_0x3fde2e[_0xdf23('0xa')](_0x1fd5bf);return _0x1aa133[_0xdf23('0xb')](_0x1b613b);}}}module[_0xdf23('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x51ad74){var _0x6f2b8a=parseInt(_0x51ad74,0xa);if(_0x6f2b8a<0x1||_0x6f2b8a>0x1f){throw new Error(EINVALID_DATE);}return _0x6f2b8a;}function timeCompare(_0x384174,_0x4d3a1c,_0x3b5d45){var _0x2fadb9=_0x384174['clone']();var _0x59e84c=extractTime(_0x4d3a1c);var _0xf0242e=_0x59e84c[0x0];var _0x4e62ac=_0x59e84c[0x1];var _0x2fa9f4=_0x384174[_0xdf23('0xe')]()[_0xdf23('0xf')](_0xf0242e)[_0xdf23('0x10')](_0x4e62ac);throwIfDateNotValid(_0x2fa9f4);var _0x9f695d=extractTime(_0x3b5d45);var _0x257fa1=_0x9f695d[0x0];var _0x34727f=_0x9f695d[0x1];var _0x47eaf3=_0x384174['clone']()[_0xdf23('0xf')](_0x257fa1)[_0xdf23('0x10')](_0x34727f);throwIfDateNotValid(_0x47eaf3);if(_0x47eaf3['isBefore'](_0x2fa9f4)){var _0x22af12=_0x2fadb9[_0xdf23('0xe')]()['startOf'](_0xdf23('0x11'));var _0x5bfbc4=_0x2fadb9['clone']()[_0xdf23('0x12')]('day');return _0x2fadb9[_0xdf23('0x13')](_0x2fa9f4,_0x5bfbc4,undefined,'[]')||_0x2fadb9[_0xdf23('0x13')](_0x22af12,_0x47eaf3,undefined,'[]');}else{return _0x2fadb9[_0xdf23('0x13')](_0x2fa9f4,_0x47eaf3,undefined,'[]');}}module[_0xdf23('0xc')][_0xdf23('0x14')]=timeCompare;function dowCompare(_0x26b36d,_0x5773be,_0x53ef2f){var _0x351210=_0x26b36d[_0xdf23('0x7')]('en')[_0xdf23('0x15')](_0xdf23('0x16'))[_0xdf23('0x8')]();return circularDoWInterval(_0x5773be,_0x53ef2f)[_0xdf23('0x17')](_0x351210);}module[_0xdf23('0xc')][_0xdf23('0x18')]=dowCompare;function domCompare(_0x1f1295,_0x4da499,_0xedf1ef){var _0x3e3ba2=_0x1f1295[_0xdf23('0x19')]();if(_0x4da499===_0xedf1ef){return _0x3e3ba2===_0x4da499;}else{var _0x19861c=_0x1f1295[_0xdf23('0x1a')]();var _0x4faf56=_0x4da499<_0xedf1ef;let _0x470c66=![];var _0x5bd824=0x0;var _0x378d3b=0x0;if(_0x4faf56){_0x5bd824=Math[_0xdf23('0x1b')](0x1,_0x4da499);_0x378d3b=Math[_0xdf23('0x1c')](_0xedf1ef,_0x19861c);_0x470c66=_0x3e3ba2>=_0x5bd824&&_0x3e3ba2<=_0x378d3b;}else{_0x5bd824=Math[_0xdf23('0x1c')](_0x4da499,_0x19861c);_0x378d3b=Math[_0xdf23('0x1b')](0x1,_0xedf1ef);_0x470c66=_0x3e3ba2>=_0x5bd824||_0x3e3ba2<=_0x378d3b;}return _0x470c66;}}module['exports'][_0xdf23('0x1d')]=domCompare;function monthCompare(_0x25d3d6,_0x56c1c5,_0x518420){var _0x7776a2=_0x25d3d6[_0xdf23('0x7')]('en')[_0xdf23('0x15')](_0xdf23('0x1e'))[_0xdf23('0x8')]();return circularMonthInterval(_0x56c1c5,_0x518420)[_0xdf23('0x17')](_0x7776a2);}module[_0xdf23('0xc')][_0xdf23('0x1f')]=monthCompare;function iftime(_0x52a2de,_0x2637d9=moment['tz'][_0xdf23('0x20')](),_0x502bae=moment()){if(!validateRx[_0xdf23('0x21')](_0x52a2de)){throw new Error(EINVALID_STRING);}else{var _0x531225=(moment[_0xdf23('0x22')](_0x502bae)?_0x502bae[_0xdf23('0xe')]():moment(_0x502bae))['tz'](_0x2637d9)['locale']('en');throwIfDateNotValid(_0x531225);var _0x2ec76b=_0x52a2de[_0xdf23('0x6')](',');var _0x784665=_0x2ec76b[0x0];var _0x11c22d=_0x2ec76b[0x1];var _0x55ebf2=_0x2ec76b[0x2];var _0x3f6413=_0x2ec76b[0x3];let _0x276a2c=!![];if(_0x784665!=='*'){var _0x3793c7=_0x784665[_0xdf23('0x6')]('-');var _0x487589=_[_0xdf23('0x23')](_0x3793c7[0x0],0x5,'0');var _0x248382=_0x3793c7[_0xdf23('0x24')]===0x2?_[_0xdf23('0x23')](_0x3793c7[0x1],0x5,'0'):_0x487589;_0x276a2c=timeCompare(_0x531225,_0x487589,_0x248382);}let _0x4228ac=!![];if(_0x11c22d!=='*'){var _0x1f91f3=_0x11c22d[_0xdf23('0x6')]('-');var _0x71757d=_0x1f91f3[0x0];var _0x413ce2=_0x1f91f3[_0xdf23('0x24')]===0x2?_0x1f91f3[0x1]:_0x71757d;_0x4228ac=dowCompare(_0x531225,_0x71757d,_0x413ce2);}let _0x2c0634=!![];if(_0x55ebf2!=='*'){var _0x81308b=_0x55ebf2['split']('-');var _0x9e1626=parseDom(_0x81308b[0x0]);var _0x45a132=_0x81308b[_0xdf23('0x24')]===0x2?parseDom(_0x81308b[0x1]):_0x9e1626;_0x2c0634=domCompare(_0x531225,_0x9e1626,_0x45a132);}let _0x330c73=!![];if(_0x3f6413!=='*'){var _0x52003b=_0x3f6413[_0xdf23('0x6')]('-');var _0x5750f8=_0x52003b[0x0];var _0x4a4b69=_0x52003b[_0xdf23('0x24')]===0x2?_0x52003b[0x1]:_0x52003b[0x0];_0x330c73=monthCompare(_0x531225,_0x5750f8,_0x4a4b69);}return _0x276a2c&&_0x4228ac&&_0x2c0634&&_0x330c73;}}module[_0xdf23('0xc')][_0xdf23('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ae48611..50cae51 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0d3=['Logger','transports','File','%s-%s','error','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','bold\x20white','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','message','{{{','meta','keys','length','stringify','Console','warn'];(function(_0x294c01,_0x20edbb){var _0x4b8163=function(_0x298683){while(--_0x298683){_0x294c01['push'](_0x294c01['shift']());}};_0x4b8163(++_0x20edbb);}(_0xd0d3,0x192));var _0x3d0d=function(_0x5d7bfa,_0x4f9fd1){_0x5d7bfa=_0x5d7bfa-0x0;var _0x24106d=_0xd0d3[_0x5d7bfa];return _0x24106d;};'use strict';var path=require(_0x3d0d('0x0'));var util=require(_0x3d0d('0x1'));var moment=require('moment');var winston=require(_0x3d0d('0x2'));var config=require(_0x3d0d('0x3'));var debugLevel=config[_0x3d0d('0x4')]?config[_0x3d0d('0x4')][_0x3d0d('0x5')]():_0x3d0d('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x3d0d('0x7'),'warn':_0x3d0d('0x8'),'info':'white','print':_0x3d0d('0x9'),'success':'bold\x20green','http':_0x3d0d('0xa'),'verbose':_0x3d0d('0xb'),'debug':'bold\x20blue','silly':_0x3d0d('0xc')};winston[_0x3d0d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x3a2f06,_0x38deef,_0x5a4cf4){var _0x541687=_0x3a2f06||_0x3d0d('0xe');return path[_0x3d0d('0xf')](_0x541687,util[_0x3d0d('0x10')](_0x3d0d('0x11'),_0x38deef,_0x5a4cf4));}function formatter(_0x5dab4c,_0x8458b9){_0x8458b9['message']=_0x8458b9['message']['replace'](/@@{/g,'{{{')[_0x3d0d('0x12')](/}@@/g,_0x3d0d('0x13'))['replace'](/@{/g,'{{')[_0x3d0d('0x12')](/}@/g,'}}');return util[_0x3d0d('0x10')](_0x3d0d('0x14'),moment()[_0x3d0d('0x10')](_0x3d0d('0x15')),_0x8458b9['level']['toUpperCase'](),_0x5dab4c,_0x8458b9[_0x3d0d('0x16')]);}function fileFormat(_0x5550fa,_0x5abd7e){_0x5abd7e[_0x3d0d('0x16')]=_0x5abd7e[_0x3d0d('0x16')][_0x3d0d('0x12')](/@@{/g,_0x3d0d('0x17'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x565410=_0x5abd7e[_0x3d0d('0x18')]&&Object[_0x3d0d('0x19')](_0x5abd7e['meta'])[_0x3d0d('0x1a')]?'\x0a\x09'+JSON[_0x3d0d('0x1b')](_0x5abd7e[_0x3d0d('0x18')]):'';return util[_0x3d0d('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x3d0d('0x15')),_0x5abd7e['level']['toUpperCase'](),_0x5550fa,_0x5abd7e[_0x3d0d('0x16')],_0x565410);}function consoleLogger(){var _0x5551bf=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x3d0d('0x1c'))]({'level':_0x3d0d('0x1d'),'json':![],'formatter':function(_0x37c160){return formatter('',_0x37c160);}})]});return _0x5551bf;}function fileLogger(_0x40d81f,_0x2042ee){var _0x78d1a8=new winston[(_0x3d0d('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3d0d('0x1f'))][(_0x3d0d('0x20'))]({'name':util[_0x3d0d('0x10')](_0x3d0d('0x21'),_0x40d81f,_0x3d0d('0x22')),'filename':getLogFileName(_0x2042ee,_0x40d81f,'error'),'level':_0x3d0d('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x49d836){return fileFormat(_0x40d81f,_0x49d836);}}),new winston[(_0x3d0d('0x1f'))][(_0x3d0d('0x20'))]({'name':util[_0x3d0d('0x10')](_0x3d0d('0x21'),_0x40d81f,debugLevel),'filename':getLogFileName(_0x2042ee,_0x40d81f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b5bae){return fileFormat(_0x40d81f,_0x3b5bae);}}),new winston[(_0x3d0d('0x1f'))][(_0x3d0d('0x1c'))]({'level':_0x3d0d('0x1d'),'json':![],'formatter':function(_0x87ecd0){return fileFormat(_0x40d81f,_0x87ecd0);}})]});return _0x78d1a8;}exports['consoleLogger']=consoleLogger;exports[_0x3d0d('0x23')]=fileLogger; \ No newline at end of file +var _0x3d30=['warn','File','%s-%s','error','consoleLogger','fileLogger','path','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','join','%s-%s.log','message','replace','{{{','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','}}}','meta','keys','length','toUpperCase','Logger','transports','Console'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x3d30,0x75));var _0x03d3=function(_0x45496c,_0xb76fb1){_0x45496c=_0x45496c-0x0;var _0x17945a=_0x3d30[_0x45496c];return _0x17945a;};'use strict';var path=require(_0x03d3('0x0'));var util=require('util');var moment=require('moment');var winston=require('winston');var config=require(_0x03d3('0x1'));var debugLevel=config[_0x03d3('0x2')]?config['debugLevel'][_0x03d3('0x3')]():_0x03d3('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':_0x03d3('0x5'),'error':_0x03d3('0x6'),'warn':_0x03d3('0x7'),'info':'white','print':_0x03d3('0x8'),'success':_0x03d3('0x9'),'http':_0x03d3('0xa'),'verbose':'bold\x20magenta','debug':_0x03d3('0xb'),'silly':_0x03d3('0xc')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x367d3b,_0x33ef59,_0x19df6f){var _0x27e3f0=_0x367d3b||_0x03d3('0xd');return path[_0x03d3('0xe')](_0x27e3f0,util['format'](_0x03d3('0xf'),_0x33ef59,_0x19df6f));}function formatter(_0x3e3ad8,_0xde4969){_0xde4969[_0x03d3('0x10')]=_0xde4969[_0x03d3('0x10')][_0x03d3('0x11')](/@@{/g,_0x03d3('0x12'))['replace'](/}@@/g,'}}}')[_0x03d3('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x03d3('0x13')](_0x03d3('0x14'),moment()[_0x03d3('0x13')](_0x03d3('0x15')),_0xde4969[_0x03d3('0x16')]['toUpperCase'](),_0x3e3ad8,_0xde4969[_0x03d3('0x10')]);}function fileFormat(_0x1a06e8,_0x886469){_0x886469[_0x03d3('0x10')]=_0x886469['message'][_0x03d3('0x11')](/@@{/g,'{{{')[_0x03d3('0x11')](/}@@/g,_0x03d3('0x17'))[_0x03d3('0x11')](/@{/g,'{{')[_0x03d3('0x11')](/}@/g,'}}');var _0x5125cb=_0x886469[_0x03d3('0x18')]&&Object[_0x03d3('0x19')](_0x886469[_0x03d3('0x18')])[_0x03d3('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x886469[_0x03d3('0x18')]):'';return util[_0x03d3('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x03d3('0x13')](_0x03d3('0x15')),_0x886469[_0x03d3('0x16')][_0x03d3('0x1b')](),_0x1a06e8,_0x886469[_0x03d3('0x10')],_0x5125cb);}function consoleLogger(){var _0x304663=new winston[(_0x03d3('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x03d3('0x1d'))][(_0x03d3('0x1e'))]({'level':_0x03d3('0x1f'),'json':![],'formatter':function(_0x5e21c2){return formatter('',_0x5e21c2);}})]});return _0x304663;}function fileLogger(_0x1ada68,_0xd0e79f){var _0x4421e0=new winston[(_0x03d3('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x03d3('0x1d'))][(_0x03d3('0x20'))]({'name':util[_0x03d3('0x13')](_0x03d3('0x21'),_0x1ada68,_0x03d3('0x22')),'filename':getLogFileName(_0xd0e79f,_0x1ada68,'error'),'level':_0x03d3('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2a5d20){return fileFormat(_0x1ada68,_0x2a5d20);}}),new winston[(_0x03d3('0x1d'))][(_0x03d3('0x20'))]({'name':util[_0x03d3('0x13')]('%s-%s',_0x1ada68,debugLevel),'filename':getLogFileName(_0xd0e79f,_0x1ada68,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58bba1){return fileFormat(_0x1ada68,_0x58bba1);}}),new winston['transports']['Console']({'level':_0x03d3('0x1f'),'json':![],'formatter':function(_0x3c5bfd){return fileFormat(_0x1ada68,_0x3c5bfd);}})]});return _0x4421e0;}exports[_0x03d3('0x23')]=consoleLogger;exports[_0x03d3('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index bdb4c12..28f9b68 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 _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0xabbb53,_0x5e2e4b){var _0x368b4a=function(_0x15e62e){while(--_0x15e62e){_0xabbb53['push'](_0xabbb53['shift']());}};_0x368b4a(++_0x5e2e4b);}(_0xda2d,0x102));var _0xdda2=function(_0x1cb72c,_0x56012b){_0x1cb72c=_0x1cb72c-0x0;var _0x51e056=_0xda2d[_0x1cb72c];return _0x51e056;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x57ca,0x108));var _0xa57c=function(_0x1fe30b,_0x1ac73e){_0x1fe30b=_0x1fe30b-0x0;var _0x458980=_0x57ca[_0x1fe30b];return _0x458980;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index dc0b0f6..d01410a 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 _0xda3f=['isPlainObject','keys','exports','safeTemplate','{\x20{\x20','string','isArray','map'];(function(_0x10e151,_0x136e6a){var _0x1a0248=function(_0x41c7f5){while(--_0x41c7f5){_0x10e151['push'](_0x10e151['shift']());}};_0x1a0248(++_0x136e6a);}(_0xda3f,0xec));var _0xfda3=function(_0x416f7a,_0x2164d9){_0x416f7a=_0x416f7a-0x0;var _0x57a5eb=_0xda3f[_0x416f7a];return _0x57a5eb;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x89912f){return _0x89912f==='{{'?_0xfda3('0x0'):'\x20}\x20}';}function safeTemplate(_0x5299b0){var _0x5d7071=_0x5299b0;if(typeof _0x5299b0===_0xfda3('0x1')){_0x5d7071=_0x5299b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfda3('0x2')](_0x5299b0)){_0x5d7071=_0x5299b0[_0xfda3('0x3')](function(_0x516500){return safeTemplate(_0x516500);});}else if(_[_0xfda3('0x4')](_0x5299b0)){_0x5d7071=Object[_0xfda3('0x5')](_0x5299b0)['reduce'](function(_0x4e72d1,_0x316792){_0x4e72d1[_0x316792]=safeTemplate(_0x5299b0[_0x316792]);return _0x4e72d1;},{});}return _0x5d7071;}module[_0xfda3('0x6')][_0xfda3('0x7')]=safeTemplate; \ No newline at end of file +var _0xed3c=['{\x20{\x20','\x20}\x20}','string','replace','isPlainObject','keys','reduce','safeTemplate','lodash'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xed3c,0x1a6));var _0xced3=function(_0x2b6453,_0xbaeaf){_0x2b6453=_0x2b6453-0x0;var _0x3fa2dc=_0xed3c[_0x2b6453];return _0x3fa2dc;};var _=require(_0xced3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x408853){return _0x408853==='{{'?_0xced3('0x1'):_0xced3('0x2');}function safeTemplate(_0x558ee8){var _0xfdc1ed=_0x558ee8;if(typeof _0x558ee8===_0xced3('0x3')){_0xfdc1ed=_0x558ee8[_0xced3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x558ee8)){_0xfdc1ed=_0x558ee8['map'](function(_0x3d3aa0){return safeTemplate(_0x3d3aa0);});}else if(_[_0xced3('0x5')](_0x558ee8)){_0xfdc1ed=Object[_0xced3('0x6')](_0x558ee8)[_0xced3('0x7')](function(_0x4795cd,_0x510164){_0x4795cd[_0x510164]=safeTemplate(_0x558ee8[_0x510164]);return _0x4795cd;},{});}return _0xfdc1ed;}module['exports'][_0xced3('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 6fb3b08..146d710 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e38=['writeJSON','exports','fs-extra','../config/environment','root','server/app.json','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','updated','info'];(function(_0x3f5796,_0xad61e8){var _0x47cb37=function(_0x14cb99){while(--_0x14cb99){_0x3f5796['push'](_0x3f5796['shift']());}};_0x47cb37(++_0xad61e8);}(_0x7e38,0x1e2));var _0x87e3=function(_0x1e4abc,_0x2edf2d){_0x1e4abc=_0x1e4abc-0x0;var _0x2f3eee=_0x7e38[_0x1e4abc];return _0x2f3eee;};var fs=require(_0x87e3('0x0'));var path=require('path');var config=require(_0x87e3('0x1'));var root=config[_0x87e3('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x87e3('0x3'));var NODEPATH=path[_0x87e3('0x4')](root,_0x87e3('0x5'));function setLegacyLibsNodeEnvPath(_0x4dbc3c){let _0x4dbfad=![];if(Array[_0x87e3('0x6')](_0x4dbc3c[_0x87e3('0x7')])){var _0x3582db=_0x4dbc3c[_0x87e3('0x7')][_0x87e3('0x8')](function(_0x1b2b18){return _0x1b2b18[_0x87e3('0x9')]===_0x87e3('0xa');});if(_0x3582db>-0x1){var _0x423890=_0x4dbc3c[_0x87e3('0x7')][_0x3582db];if(typeof _0x423890[_0x87e3('0xb')][_0x87e3('0xc')]!==_0x87e3('0xd')){_0x423890[_0x87e3('0xb')]['NODE_PATH']=NODEPATH;_0x4dbfad=!![];}}return{'appConfig':_0x4dbc3c,'updated':_0x4dbfad};}}function updateAppConfig(_0x4723a9){return fs[_0x87e3('0xe')](APP_JSON_PATH)[_0x87e3('0xf')](function(_0x4f760c){if(_0x4f760c){return fs['readJSON'](APP_JSON_PATH)[_0x87e3('0xf')](function(_0x1593eb){var _0x4a1740=setLegacyLibsNodeEnvPath(_0x1593eb);if(_0x4a1740[_0x87e3('0x10')]){_0x4723a9[_0x87e3('0x11')]('Updating\x20app.json');return fs[_0x87e3('0x12')](APP_JSON_PATH,_0x1593eb,{'spaces':0x2});}else{return Promise[_0x87e3('0x4')]();}});}else{return Promise['resolve']();}});}module[_0x87e3('0x13')]=updateAppConfig; \ No newline at end of file +var _0xfa97=['apps','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','resolve','legacy-libs'];(function(_0x27d84f,_0x38caf4){var _0x419d56=function(_0xf74fa2){while(--_0xf74fa2){_0x27d84f['push'](_0x27d84f['shift']());}};_0x419d56(++_0x38caf4);}(_0xfa97,0x109));var _0x7fa9=function(_0x346379,_0xd5f749){_0x346379=_0x346379-0x0;var _0x9c1bb6=_0xfa97[_0x346379];return _0x9c1bb6;};var fs=require(_0x7fa9('0x0'));var path=require(_0x7fa9('0x1'));var config=require(_0x7fa9('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x7fa9('0x3')](root,'server/app.json');var NODEPATH=path[_0x7fa9('0x3')](root,_0x7fa9('0x4'));function setLegacyLibsNodeEnvPath(_0xa72c9e){let _0xd04997=![];if(Array['isArray'](_0xa72c9e['apps'])){var _0x72b054=_0xa72c9e[_0x7fa9('0x5')]['findIndex'](function(_0x4f4f47){return _0x4f4f47['name']===_0x7fa9('0x6');});if(_0x72b054>-0x1){var _0x5ee5f4=_0xa72c9e['apps'][_0x72b054];if(typeof _0x5ee5f4[_0x7fa9('0x7')][_0x7fa9('0x8')]!==_0x7fa9('0x9')){_0x5ee5f4[_0x7fa9('0x7')][_0x7fa9('0x8')]=NODEPATH;_0xd04997=!![];}}return{'appConfig':_0xa72c9e,'updated':_0xd04997};}}function updateAppConfig(_0x2a88cb){return fs[_0x7fa9('0xa')](APP_JSON_PATH)[_0x7fa9('0xb')](function(_0x435f75){if(_0x435f75){return fs[_0x7fa9('0xc')](APP_JSON_PATH)['then'](function(_0x8cec94){var _0x2089e6=setLegacyLibsNodeEnvPath(_0x8cec94);if(_0x2089e6[_0x7fa9('0xd')]){_0x2a88cb[_0x7fa9('0xe')](_0x7fa9('0xf'));return fs[_0x7fa9('0x10')](APP_JSON_PATH,_0x8cec94,{'spaces':0x2});}else{return Promise[_0x7fa9('0x3')]();}});}else{return Promise[_0x7fa9('0x3')]();}});}module[_0x7fa9('0x11')]=updateAppConfig; \ No newline at end of file